summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/Makefile309
-rw-r--r--usr.bin/Makefile.amd643
-rw-r--r--usr.bin/Makefile.arm2
-rw-r--r--usr.bin/Makefile.i3863
-rw-r--r--usr.bin/Makefile.inc6
-rw-r--r--usr.bin/Makefile.powerpc3
-rw-r--r--usr.bin/Makefile.sparc643
-rw-r--r--usr.bin/addr2line/Makefile16
-rw-r--r--usr.bin/addr2line/Makefile.depend21
-rw-r--r--usr.bin/alias/Makefile21
-rw-r--r--usr.bin/alias/Makefile.depend11
-rw-r--r--usr.bin/alias/generic.sh4
-rw-r--r--usr.bin/apply/Makefile14
-rw-r--r--usr.bin/apply/Makefile.depend19
-rw-r--r--usr.bin/apply/apply.1140
-rw-r--r--usr.bin/apply/apply.c260
-rw-r--r--usr.bin/apply/tests/Makefile13
-rw-r--r--usr.bin/apply/tests/Makefile.depend11
-rw-r--r--usr.bin/apply/tests/legacy_test.sh6
-rw-r--r--usr.bin/apply/tests/regress.00.in1
-rw-r--r--usr.bin/apply/tests/regress.00.out1
-rw-r--r--usr.bin/apply/tests/regress.01.out1
-rw-r--r--usr.bin/apply/tests/regress.01.sh15
-rw-r--r--usr.bin/apply/tests/regress.sh10
-rw-r--r--usr.bin/ar/Makefile20
-rw-r--r--usr.bin/ar/Makefile.depend27
-rw-r--r--usr.bin/ar/acplex.l81
-rw-r--r--usr.bin/ar/acpyacc.y660
-rw-r--r--usr.bin/ar/ar.1608
-rw-r--r--usr.bin/ar/ar.c420
-rw-r--r--usr.bin/ar/ar.h125
-rw-r--r--usr.bin/ar/read.c212
-rw-r--r--usr.bin/ar/util.c86
-rw-r--r--usr.bin/ar/write.c912
-rw-r--r--usr.bin/asa/Makefile6
-rw-r--r--usr.bin/asa/Makefile.depend17
-rw-r--r--usr.bin/asa/asa.198
-rw-r--r--usr.bin/asa/asa.c141
-rw-r--r--usr.bin/at/LEGAL29
-rw-r--r--usr.bin/at/Makefile32
-rw-r--r--usr.bin/at/Makefile.depend18
-rw-r--r--usr.bin/at/Makefile.inc21
-rw-r--r--usr.bin/at/at.c913
-rw-r--r--usr.bin/at/at.h31
-rw-r--r--usr.bin/at/at.man362
-rw-r--r--usr.bin/at/panic.c92
-rw-r--r--usr.bin/at/panic.h32
-rw-r--r--usr.bin/at/parsetime.c670
-rw-r--r--usr.bin/at/parsetime.h26
-rw-r--r--usr.bin/at/perm.c124
-rw-r--r--usr.bin/at/perm.h28
-rw-r--r--usr.bin/at/privs.h106
-rw-r--r--usr.bin/atm/Makefile5
-rw-r--r--usr.bin/atm/Makefile.inc3
-rw-r--r--usr.bin/atm/sscop/Makefile13
-rw-r--r--usr.bin/atm/sscop/Makefile.depend20
-rw-r--r--usr.bin/awk/Makefile31
-rw-r--r--usr.bin/awk/Makefile.depend20
-rw-r--r--usr.bin/banner/Makefile7
-rw-r--r--usr.bin/banner/Makefile.depend18
-rw-r--r--usr.bin/banner/banner.678
-rw-r--r--usr.bin/banner/banner.c1181
-rw-r--r--usr.bin/basename/Makefile13
-rw-r--r--usr.bin/basename/Makefile.depend18
-rw-r--r--usr.bin/basename/basename.1113
-rw-r--r--usr.bin/basename/basename.c143
-rw-r--r--usr.bin/basename/tests/Makefile7
-rw-r--r--usr.bin/basename/tests/Makefile.depend11
-rw-r--r--usr.bin/bc/Makefile15
-rw-r--r--usr.bin/bc/Makefile.depend21
-rw-r--r--usr.bin/bc/bc.1416
-rw-r--r--usr.bin/bc/bc.library274
-rw-r--r--usr.bin/bc/bc.y1216
-rw-r--r--usr.bin/bc/extern.h47
-rw-r--r--usr.bin/bc/pathnames.h21
-rw-r--r--usr.bin/bc/scan.l370
-rw-r--r--usr.bin/bc/tty.c65
-rw-r--r--usr.bin/biff/Makefile6
-rw-r--r--usr.bin/biff/Makefile.depend18
-rw-r--r--usr.bin/biff/biff.1123
-rw-r--r--usr.bin/biff/biff.c113
-rw-r--r--usr.bin/bluetooth/Makefile10
-rw-r--r--usr.bin/bluetooth/Makefile.inc4
-rw-r--r--usr.bin/bluetooth/bthost/Makefile8
-rw-r--r--usr.bin/bluetooth/bthost/Makefile.depend19
-rw-r--r--usr.bin/bluetooth/bthost/bthost.1115
-rw-r--r--usr.bin/bluetooth/bthost/bthost.c143
-rw-r--r--usr.bin/bluetooth/btsockstat/Makefile11
-rw-r--r--usr.bin/bluetooth/btsockstat/Makefile.depend21
-rw-r--r--usr.bin/bluetooth/btsockstat/btsockstat.183
-rw-r--r--usr.bin/bluetooth/btsockstat/btsockstat.c639
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/Makefile10
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/Makefile.depend21
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c266
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1186
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c460
-rw-r--r--usr.bin/bmake/Makefile177
-rw-r--r--usr.bin/bmake/Makefile.config25
-rw-r--r--usr.bin/bmake/Makefile.depend18
-rw-r--r--usr.bin/bmake/Makefile.inc26
-rw-r--r--usr.bin/bmake/config.h346
-rw-r--r--usr.bin/bmake/tests/Makefile17
-rw-r--r--usr.bin/bmake/tests/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/Makefile.inc3
-rw-r--r--usr.bin/bmake/tests/README174
-rw-r--r--usr.bin/bmake/tests/archives/Makefile7
-rw-r--r--usr.bin/bmake/tests/archives/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/Makefile33
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.21
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.31
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.41
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.51
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.51
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.50
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.60
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.70
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh15
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/libtest.abin0 -> 2104 bytes
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile33
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test64
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.21
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.31
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.41
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.51
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.51
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.50
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.60
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.70
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh15
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.abin0 -> 2104 bytes
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile32
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test62
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.11
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.21
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.31
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.41
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.51
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.50
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.61
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.71
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.20
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.30
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.40
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.50
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.60
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.70
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh15
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.abin0 -> 2016 bytes
-rw-r--r--usr.bin/bmake/tests/basic/Makefile7
-rw-r--r--usr.bin/bmake/tests/basic/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/basic/t0/Makefile13
-rw-r--r--usr.bin/bmake/tests/basic/t0/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.status.11
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.stderr.11
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/basic/t0/legacy_test.sh16
-rw-r--r--usr.bin/bmake/tests/basic/t1/Makefile14
-rw-r--r--usr.bin/bmake/tests/basic/t1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/basic/t1/Makefile.test5
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.status.11
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/basic/t1/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/basic/t2/Makefile14
-rw-r--r--usr.bin/bmake/tests/basic/t2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/basic/t2/Makefile.test6
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.status.11
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/basic/t2/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/basic/t3/Makefile13
-rw-r--r--usr.bin/bmake/tests/basic/t3/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.status.11
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.stderr.11
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/basic/t3/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/common.sh533
-rw-r--r--usr.bin/bmake/tests/execution/Makefile7
-rw-r--r--usr.bin/bmake/tests/execution/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/Makefile14
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/Makefile.test21
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.status.11
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.stdout.112
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/execution/empty/Makefile14
-rw-r--r--usr.bin/bmake/tests/execution/empty/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/execution/empty/Makefile.test13
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.status.11
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/execution/empty/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/execution/joberr/Makefile14
-rw-r--r--usr.bin/bmake/tests/execution/joberr/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/execution/joberr/Makefile.test10
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.status.11
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.stderr.130
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.stdout.190
-rw-r--r--usr.bin/bmake/tests/execution/joberr/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/execution/plus/Makefile14
-rw-r--r--usr.bin/bmake/tests/execution/plus/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/execution/plus/Makefile.test7
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.status.11
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/execution/plus/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/shell/Makefile7
-rw-r--r--usr.bin/bmake/tests/shell/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/builtin/Makefile18
-rw-r--r--usr.bin/bmake/tests/shell/builtin/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/builtin/Makefile.test18
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/shell/builtin/legacy_test.sh17
-rw-r--r--usr.bin/bmake/tests/shell/builtin/sh6
-rw-r--r--usr.bin/bmake/tests/shell/meta/Makefile18
-rw-r--r--usr.bin/bmake/tests/shell/meta/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/meta/Makefile.test18
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/shell/meta/legacy_test.sh17
-rw-r--r--usr.bin/bmake/tests/shell/meta/sh6
-rw-r--r--usr.bin/bmake/tests/shell/path/Makefile18
-rw-r--r--usr.bin/bmake/tests/shell/path/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/path/Makefile.test31
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/shell/path/legacy_test.sh20
-rw-r--r--usr.bin/bmake/tests/shell/path/sh6
-rw-r--r--usr.bin/bmake/tests/shell/path_select/Makefile18
-rw-r--r--usr.bin/bmake/tests/shell/path_select/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/path_select/Makefile.test31
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/shell/path_select/legacy_test.sh19
-rw-r--r--usr.bin/bmake/tests/shell/path_select/shell6
-rw-r--r--usr.bin/bmake/tests/shell/replace/Makefile18
-rw-r--r--usr.bin/bmake/tests/shell/replace/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/replace/Makefile.test21
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stdout.13
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stdout.26
-rw-r--r--usr.bin/bmake/tests/shell/replace/legacy_test.sh17
-rw-r--r--usr.bin/bmake/tests/shell/replace/shell6
-rw-r--r--usr.bin/bmake/tests/shell/select/Makefile17
-rw-r--r--usr.bin/bmake/tests/shell/select/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/shell/select/Makefile.test28
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.status.11
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.status.21
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/shell/select/legacy_test.sh16
-rw-r--r--usr.bin/bmake/tests/suffixes/Makefile7
-rw-r--r--usr.bin/bmake/tests/suffixes/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/Makefile15
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/Makefile.test13
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/TEST1.a1
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.status.11
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/legacy_test.sh19
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/Makefile16
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test7
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a1
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a1
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.status.11
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh19
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/Makefile16
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test12
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a1
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a1
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.status.11
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh19
-rw-r--r--usr.bin/bmake/tests/syntax/Makefile7
-rw-r--r--usr.bin/bmake/tests/syntax/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/Makefile14
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/Makefile.test8
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.status.11
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.12
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.10
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/syntax/enl/Makefile26
-rw-r--r--usr.bin/bmake/tests/syntax/enl/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/syntax/enl/Makefile.test59
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.11
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.21
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.31
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.41
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.51
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.30
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.40
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.50
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.32
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.41
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.51
-rw-r--r--usr.bin/bmake/tests/syntax/enl/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/Makefile17
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/Makefile.test14
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.status.11
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.status.21
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh12
-rw-r--r--usr.bin/bmake/tests/syntax/semi/Makefile17
-rw-r--r--usr.bin/bmake/tests/syntax/semi/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/syntax/semi/Makefile.test26
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.status.11
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.status.21
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stdout.22
-rw-r--r--usr.bin/bmake/tests/syntax/semi/legacy_test.sh13
-rw-r--r--usr.bin/bmake/tests/sysmk/Makefile7
-rw-r--r--usr.bin/bmake/tests/sysmk/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/Makefile14
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test6
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh15
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/Makefile7
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/Makefile8
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/mk/Makefile11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/mk/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test3
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/Makefile14
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/cleanup3
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh17
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/Makefile7
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/Makefile8
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/mk/Makefile11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/mk/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test3
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/Makefile14
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/cleanup3
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh17
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/Makefile7
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/Makefile8
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/mk/Makefile11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/mk/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test3
-rw-r--r--usr.bin/bmake/tests/test-new.mk9
-rw-r--r--usr.bin/bmake/tests/variables/Makefile7
-rw-r--r--usr.bin/bmake/tests/variables/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/Makefile14
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/Makefile.test18
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.status.11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.stdout.17
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh9
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/Makefile20
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/Makefile.test15
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.21
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.31
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.30
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.11
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.21
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.31
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh12
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/Makefile17
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/Makefile.test15
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.status.11
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.status.21
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stderr.20
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stdout.12
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stdout.22
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/legacy_test.sh12
-rw-r--r--usr.bin/bmake/tests/variables/t0/Makefile14
-rw-r--r--usr.bin/bmake/tests/variables/t0/Makefile.depend11
-rw-r--r--usr.bin/bmake/tests/variables/t0/Makefile.test23
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.status.11
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.stderr.10
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.stdout.115
-rw-r--r--usr.bin/bmake/tests/variables/t0/legacy_test.sh9
-rw-r--r--usr.bin/bmake/unit-tests/Makefile158
-rw-r--r--usr.bin/brandelf/Makefile5
-rw-r--r--usr.bin/brandelf/Makefile.depend18
-rw-r--r--usr.bin/brandelf/brandelf.1104
-rw-r--r--usr.bin/brandelf/brandelf.c210
-rw-r--r--usr.bin/bsdcat/Makefile31
-rw-r--r--usr.bin/bsdcat/Makefile.depend25
-rw-r--r--usr.bin/bsdcat/tests/Makefile68
-rwxr-xr-xusr.bin/bsdcat/tests/functional_test.sh56
-rw-r--r--usr.bin/bsdiff/Makefile5
-rw-r--r--usr.bin/bsdiff/Makefile.inc3
-rw-r--r--usr.bin/bsdiff/bsdiff/Makefile7
-rw-r--r--usr.bin/bsdiff/bsdiff/Makefile.depend19
-rw-r--r--usr.bin/bsdiff/bsdiff/bsdiff.188
-rw-r--r--usr.bin/bsdiff/bsdiff/bsdiff.c436
-rw-r--r--usr.bin/bsdiff/bspatch/Makefile7
-rw-r--r--usr.bin/bsdiff/bspatch/Makefile.depend19
-rw-r--r--usr.bin/bsdiff/bspatch/bspatch.186
-rw-r--r--usr.bin/bsdiff/bspatch/bspatch.c216
-rw-r--r--usr.bin/bzip2/Makefile50
-rw-r--r--usr.bin/bzip2/Makefile.depend20
-rw-r--r--usr.bin/bzip2recover/Makefile11
-rw-r--r--usr.bin/bzip2recover/Makefile.depend18
-rw-r--r--usr.bin/c89/Makefile5
-rw-r--r--usr.bin/c89/Makefile.depend18
-rw-r--r--usr.bin/c89/c89.1184
-rw-r--r--usr.bin/c89/c89.c111
-rw-r--r--usr.bin/c99/Makefile5
-rw-r--r--usr.bin/c99/Makefile.depend18
-rw-r--r--usr.bin/c99/c99.1190
-rw-r--r--usr.bin/c99/c99.c133
-rw-r--r--usr.bin/caesar/Makefile10
-rw-r--r--usr.bin/caesar/Makefile.depend19
-rw-r--r--usr.bin/caesar/caesar.673
-rw-r--r--usr.bin/caesar/caesar.c159
-rw-r--r--usr.bin/caesar/rot13.sh33
-rw-r--r--usr.bin/calendar/Makefile38
-rw-r--r--usr.bin/calendar/Makefile.depend19
-rw-r--r--usr.bin/calendar/calendar.1334
-rw-r--r--usr.bin/calendar/calendar.c232
-rw-r--r--usr.bin/calendar/calendar.h197
-rw-r--r--usr.bin/calendar/calendars/calendar.all24
-rw-r--r--usr.bin/calendar/calendars/calendar.australia72
-rw-r--r--usr.bin/calendar/calendars/calendar.birthday304
-rw-r--r--usr.bin/calendar/calendars/calendar.brazilian13
-rw-r--r--usr.bin/calendar/calendars/calendar.christian36
-rw-r--r--usr.bin/calendar/calendars/calendar.computer76
-rw-r--r--usr.bin/calendar/calendars/calendar.croatian12
-rw-r--r--usr.bin/calendar/calendars/calendar.dutch79
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd393
-rw-r--r--usr.bin/calendar/calendars/calendar.french12
-rw-r--r--usr.bin/calendar/calendars/calendar.german12
-rw-r--r--usr.bin/calendar/calendars/calendar.history475
-rw-r--r--usr.bin/calendar/calendars/calendar.holiday563
-rw-r--r--usr.bin/calendar/calendars/calendar.hungarian12
-rw-r--r--usr.bin/calendar/calendars/calendar.judaic694
-rw-r--r--usr.bin/calendar/calendars/calendar.lotr48
-rw-r--r--usr.bin/calendar/calendars/calendar.music240
-rw-r--r--usr.bin/calendar/calendars/calendar.newzealand25
-rw-r--r--usr.bin/calendar/calendars/calendar.russian12
-rw-r--r--usr.bin/calendar/calendars/calendar.southafrica23
-rw-r--r--usr.bin/calendar/calendars/calendar.ukrainian12
-rw-r--r--usr.bin/calendar/calendars/calendar.usholiday42
-rw-r--r--usr.bin/calendar/calendars/calendar.world19
-rw-r--r--usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag62
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.all17
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.feiertag56
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte198
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.kirche32
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.literatur54
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.musik66
-rw-r--r--usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.wissenschaft19
-rw-r--r--usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.all14
-rw-r--r--usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes630
-rw-r--r--usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.french12
-rw-r--r--usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.jferies46
-rw-r--r--usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.proverbes354
-rw-r--r--usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.all12
-rw-r--r--usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici44
-rw-r--r--usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.all13
-rw-r--r--usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.nevnapok386
-rw-r--r--usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.unnepek53
-rw-r--r--usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.all15
-rw-r--r--usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.commemorative191
-rw-r--r--usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.holidays25
-rw-r--r--usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.mcommemorative22
-rw-r--r--usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.all16
-rw-r--r--usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.commemorative191
-rw-r--r--usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.holidays25
-rw-r--r--usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.mcommemorative22
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all16
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common105
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday25
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military28
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox36
-rw-r--r--usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan42
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.all16
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common105
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.holiday25
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military28
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.orthodox36
-rw-r--r--usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan42
-rw-r--r--usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.all14
-rw-r--r--usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.holiday22
-rw-r--r--usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.misc18
-rw-r--r--usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.orthodox35
-rw-r--r--usr.bin/calendar/dates.c451
-rw-r--r--usr.bin/calendar/day.c117
-rw-r--r--usr.bin/calendar/events.c126
-rw-r--r--usr.bin/calendar/io.c503
-rw-r--r--usr.bin/calendar/locale.c166
-rw-r--r--usr.bin/calendar/ostern.c67
-rw-r--r--usr.bin/calendar/parsedata.c1116
-rw-r--r--usr.bin/calendar/paskha.c66
-rw-r--r--usr.bin/calendar/pathnames.h35
-rw-r--r--usr.bin/calendar/pom.c276
-rw-r--r--usr.bin/calendar/sunpos.c448
-rw-r--r--usr.bin/calendar/tests/Makefile38
-rw-r--r--usr.bin/calendar/tests/Makefile.depend11
-rw-r--r--usr.bin/calendar/tests/calendar.calibrate374
-rw-r--r--usr.bin/calendar/tests/legacy_test.sh6
-rw-r--r--usr.bin/calendar/tests/regress.a1.out4
-rw-r--r--usr.bin/calendar/tests/regress.a2.out4
-rw-r--r--usr.bin/calendar/tests/regress.a3.out4
-rw-r--r--usr.bin/calendar/tests/regress.a4.out4
-rw-r--r--usr.bin/calendar/tests/regress.a5.out4
-rw-r--r--usr.bin/calendar/tests/regress.b1.out4
-rw-r--r--usr.bin/calendar/tests/regress.b2.out4
-rw-r--r--usr.bin/calendar/tests/regress.b3.out4
-rw-r--r--usr.bin/calendar/tests/regress.b4.out4
-rw-r--r--usr.bin/calendar/tests/regress.b5.out4
-rw-r--r--usr.bin/calendar/tests/regress.s1.out4
-rw-r--r--usr.bin/calendar/tests/regress.s2.out2
-rw-r--r--usr.bin/calendar/tests/regress.s3.out2
-rw-r--r--usr.bin/calendar/tests/regress.s4.out2
-rw-r--r--usr.bin/calendar/tests/regress.sh45
-rw-r--r--usr.bin/calendar/tests/regress.w0-1.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-2.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-3.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-4.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-5.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-6.out1
-rw-r--r--usr.bin/calendar/tests/regress.w0-7.out1
-rw-r--r--usr.bin/calendar/tests/regress.wn-1.out1
-rw-r--r--usr.bin/calendar/tests/regress.wn-2.out2
-rw-r--r--usr.bin/calendar/tests/regress.wn-3.out3
-rw-r--r--usr.bin/calendar/tests/regress.wn-4.out4
-rw-r--r--usr.bin/calendar/tests/regress.wn-5.out5
-rw-r--r--usr.bin/calendar/tests/regress.wn-6.out6
-rw-r--r--usr.bin/calendar/tests/regress.wn-7.out7
-rw-r--r--usr.bin/cap_mkdb/Makefile6
-rw-r--r--usr.bin/cap_mkdb/Makefile.depend18
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.1105
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.c268
-rw-r--r--usr.bin/catman/Makefile5
-rw-r--r--usr.bin/catman/Makefile.depend18
-rw-r--r--usr.bin/catman/catman.1109
-rw-r--r--usr.bin/catman/catman.c819
-rw-r--r--usr.bin/chat/Makefile9
-rw-r--r--usr.bin/chat/Makefile.depend18
-rw-r--r--usr.bin/chat/chat.8644
-rw-r--r--usr.bin/chat/chat.c1536
-rw-r--r--usr.bin/checknr/Makefile6
-rw-r--r--usr.bin/checknr/Makefile.depend18
-rw-r--r--usr.bin/checknr/checknr.1159
-rw-r--r--usr.bin/checknr/checknr.c647
-rw-r--r--usr.bin/chkey/Makefile15
-rw-r--r--usr.bin/chkey/Makefile.depend23
-rw-r--r--usr.bin/chkey/chkey.125
-rw-r--r--usr.bin/chkey/chkey.c274
-rw-r--r--usr.bin/chpass/Makefile45
-rw-r--r--usr.bin/chpass/Makefile.depend21
-rw-r--r--usr.bin/chpass/chpass.1485
-rw-r--r--usr.bin/chpass/chpass.c305
-rw-r--r--usr.bin/chpass/chpass.h79
-rw-r--r--usr.bin/chpass/edit.c296
-rw-r--r--usr.bin/chpass/field.c261
-rw-r--r--usr.bin/chpass/table.c62
-rw-r--r--usr.bin/chpass/util.c182
-rw-r--r--usr.bin/cksum/Makefile9
-rw-r--r--usr.bin/cksum/Makefile.depend18
-rw-r--r--usr.bin/cksum/cksum.1177
-rw-r--r--usr.bin/cksum/cksum.c136
-rw-r--r--usr.bin/cksum/crc.c143
-rw-r--r--usr.bin/cksum/crc32.c122
-rw-r--r--usr.bin/cksum/extern.h46
-rw-r--r--usr.bin/cksum/print.c71
-rw-r--r--usr.bin/cksum/sum1.c72
-rw-r--r--usr.bin/cksum/sum2.c74
-rw-r--r--usr.bin/clang/Makefile41
-rw-r--r--usr.bin/clang/bugpoint/Makefile45
-rw-r--r--usr.bin/clang/bugpoint/Makefile.depend45
-rw-r--r--usr.bin/clang/bugpoint/bugpoint.1293
-rw-r--r--usr.bin/clang/clang-format/Makefile23
-rw-r--r--usr.bin/clang/clang-format/Makefile.depend32
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile22
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile.depend24
-rw-r--r--usr.bin/clang/clang.prog.mk23
-rwxr-xr-xusr.bin/clang/clang/CC.sh4
-rw-r--r--usr.bin/clang/clang/Makefile131
-rw-r--r--usr.bin/clang/clang/Makefile.depend100
-rw-r--r--usr.bin/clang/clang/clang.1584
-rw-r--r--usr.bin/clang/llc/Makefile75
-rw-r--r--usr.bin/clang/llc/Makefile.depend83
-rw-r--r--usr.bin/clang/llc/llc.1265
-rw-r--r--usr.bin/clang/lldb/Makefile173
-rw-r--r--usr.bin/clang/lldb/Makefile.depend159
-rw-r--r--usr.bin/clang/lli/Makefile49
-rw-r--r--usr.bin/clang/lli/Makefile.depend56
-rw-r--r--usr.bin/clang/lli/lli.1298
-rw-r--r--usr.bin/clang/llvm-ar/Makefile73
-rw-r--r--usr.bin/clang/llvm-ar/Makefile.depend82
-rw-r--r--usr.bin/clang/llvm-ar/llvm-ar.1390
-rw-r--r--usr.bin/clang/llvm-as/Makefile17
-rw-r--r--usr.bin/clang/llvm-as/Makefile.depend27
-rw-r--r--usr.bin/clang/llvm-as/llvm-as.187
-rw-r--r--usr.bin/clang/llvm-bcanalyzer/Makefile16
-rw-r--r--usr.bin/clang/llvm-bcanalyzer/Makefile.depend26
-rw-r--r--usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1476
-rw-r--r--usr.bin/clang/llvm-cov/Makefile27
-rw-r--r--usr.bin/clang/llvm-cov/Makefile.depend30
-rw-r--r--usr.bin/clang/llvm-cov/llvm-cov.1319
-rw-r--r--usr.bin/clang/llvm-cxxdump/Makefile71
-rw-r--r--usr.bin/clang/llvm-cxxdump/Makefile.depend79
-rw-r--r--usr.bin/clang/llvm-diff/Makefile21
-rw-r--r--usr.bin/clang/llvm-diff/Makefile.depend28
-rw-r--r--usr.bin/clang/llvm-diff/llvm-diff.177
-rw-r--r--usr.bin/clang/llvm-dis/Makefile18
-rw-r--r--usr.bin/clang/llvm-dis/Makefile.depend27
-rw-r--r--usr.bin/clang/llvm-dis/llvm-dis.188
-rw-r--r--usr.bin/clang/llvm-dwarfdump/Makefile20
-rw-r--r--usr.bin/clang/llvm-dwarfdump/Makefile.depend30
-rw-r--r--usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.160
-rw-r--r--usr.bin/clang/llvm-extract/Makefile30
-rw-r--r--usr.bin/clang/llvm-extract/Makefile.depend40
-rw-r--r--usr.bin/clang/llvm-extract/llvm-extract.1129
-rw-r--r--usr.bin/clang/llvm-link/Makefile25
-rw-r--r--usr.bin/clang/llvm-link/Makefile.depend35
-rw-r--r--usr.bin/clang/llvm-link/llvm-link.189
-rw-r--r--usr.bin/clang/llvm-lto/Makefile80
-rw-r--r--usr.bin/clang/llvm-lto/Makefile.depend87
-rw-r--r--usr.bin/clang/llvm-mc/Makefile71
-rw-r--r--usr.bin/clang/llvm-mc/Makefile.depend79
-rw-r--r--usr.bin/clang/llvm-nm/Makefile71
-rw-r--r--usr.bin/clang/llvm-nm/Makefile.depend80
-rw-r--r--usr.bin/clang/llvm-nm/llvm-nm.1213
-rw-r--r--usr.bin/clang/llvm-objdump/Makefile74
-rw-r--r--usr.bin/clang/llvm-objdump/Makefile.depend80
-rw-r--r--usr.bin/clang/llvm-pdbdump/Makefile31
-rw-r--r--usr.bin/clang/llvm-pdbdump/Makefile.depend30
-rw-r--r--usr.bin/clang/llvm-profdata/Makefile22
-rw-r--r--usr.bin/clang/llvm-profdata/Makefile.depend31
-rw-r--r--usr.bin/clang/llvm-profdata/llvm-profdata.1223
-rw-r--r--usr.bin/clang/llvm-rtdyld/Makefile74
-rw-r--r--usr.bin/clang/llvm-rtdyld/Makefile.depend83
-rw-r--r--usr.bin/clang/llvm-symbolizer/Makefile22
-rw-r--r--usr.bin/clang/llvm-symbolizer/Makefile.depend32
-rw-r--r--usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1163
-rw-r--r--usr.bin/clang/llvm-tblgen/Makefile44
-rw-r--r--usr.bin/clang/llvm-tblgen/Makefile.depend24
-rw-r--r--usr.bin/clang/llvm-tblgen/llvm-tblgen.1182
-rw-r--r--usr.bin/clang/opt/Makefile85
-rw-r--r--usr.bin/clang/opt/Makefile.depend87
-rw-r--r--usr.bin/clang/opt/opt.1170
-rw-r--r--usr.bin/cmp/Makefile13
-rw-r--r--usr.bin/cmp/Makefile.depend18
-rw-r--r--usr.bin/cmp/cmp.1128
-rw-r--r--usr.bin/cmp/cmp.c192
-rw-r--r--usr.bin/cmp/extern.h45
-rw-r--r--usr.bin/cmp/link.c93
-rw-r--r--usr.bin/cmp/misc.c62
-rw-r--r--usr.bin/cmp/regular.c172
-rw-r--r--usr.bin/cmp/special.c104
-rw-r--r--usr.bin/cmp/tests/Makefile9
-rw-r--r--usr.bin/cmp/tests/Makefile.depend11
-rw-r--r--usr.bin/col/Makefile12
-rw-r--r--usr.bin/col/Makefile.depend18
-rw-r--r--usr.bin/col/README48
-rw-r--r--usr.bin/col/col.1167
-rw-r--r--usr.bin/col/col.c599
-rw-r--r--usr.bin/col/tests/Makefile11
-rw-r--r--usr.bin/col/tests/Makefile.depend11
-rwxr-xr-xusr.bin/col/tests/col.sh33
-rw-r--r--usr.bin/col/tests/rlf.in2
-rw-r--r--usr.bin/col/tests/rlf2.in2
-rw-r--r--usr.bin/colcrt/Makefile6
-rw-r--r--usr.bin/colcrt/Makefile.depend18
-rw-r--r--usr.bin/colcrt/colcrt.1120
-rw-r--r--usr.bin/colcrt/colcrt.c283
-rw-r--r--usr.bin/colldef/Makefile12
-rw-r--r--usr.bin/colldef/Makefile.depend21
-rw-r--r--usr.bin/colldef/colldef.1279
-rw-r--r--usr.bin/colldef/common.h11
-rw-r--r--usr.bin/colldef/parse.y403
-rw-r--r--usr.bin/colldef/scan.l287
-rw-r--r--usr.bin/colrm/Makefile6
-rw-r--r--usr.bin/colrm/Makefile.depend18
-rw-r--r--usr.bin/colrm/colrm.192
-rw-r--r--usr.bin/colrm/colrm.c142
-rw-r--r--usr.bin/column/Makefile6
-rw-r--r--usr.bin/column/Makefile.depend18
-rw-r--r--usr.bin/column/column.1101
-rw-r--r--usr.bin/column/column.c334
-rw-r--r--usr.bin/comm/Makefile12
-rw-r--r--usr.bin/comm/Makefile.depend18
-rw-r--r--usr.bin/comm/comm.1118
-rw-r--r--usr.bin/comm/comm.c249
-rw-r--r--usr.bin/comm/tests/Makefile18
-rw-r--r--usr.bin/comm/tests/Makefile.depend11
-rw-r--r--usr.bin/comm/tests/legacy_test.sh6
-rw-r--r--usr.bin/comm/tests/regress.00.out2
-rw-r--r--usr.bin/comm/tests/regress.00a.in5
-rw-r--r--usr.bin/comm/tests/regress.00b.in2
-rw-r--r--usr.bin/comm/tests/regress.01.out2
-rw-r--r--usr.bin/comm/tests/regress.01a.in5
-rw-r--r--usr.bin/comm/tests/regress.01b.in2
-rw-r--r--usr.bin/comm/tests/regress.02.out5
-rw-r--r--usr.bin/comm/tests/regress.02a.in3
-rw-r--r--usr.bin/comm/tests/regress.02b.in3
-rw-r--r--usr.bin/comm/tests/regress.sh11
-rw-r--r--usr.bin/compile_et/Makefile12
-rw-r--r--usr.bin/compile_et/Makefile.depend23
-rw-r--r--usr.bin/compress/Makefile12
-rw-r--r--usr.bin/compress/Makefile.depend18
-rw-r--r--usr.bin/compress/compress.1253
-rw-r--r--usr.bin/compress/compress.c437
-rw-r--r--usr.bin/compress/doc/NOTES142
-rw-r--r--usr.bin/compress/doc/README284
-rw-r--r--usr.bin/compress/doc/revision.log118
-rw-r--r--usr.bin/compress/zopen.3137
-rw-r--r--usr.bin/compress/zopen.c738
-rw-r--r--usr.bin/compress/zopen.h34
-rw-r--r--usr.bin/cpio/Makefile39
-rw-r--r--usr.bin/cpio/Makefile.depend25
-rw-r--r--usr.bin/cpio/tests/Makefile121
-rw-r--r--usr.bin/cpio/tests/Makefile.depend25
-rwxr-xr-xusr.bin/cpio/tests/functional_test.sh56
-rw-r--r--usr.bin/cpuset/Makefile5
-rw-r--r--usr.bin/cpuset/Makefile.depend18
-rw-r--r--usr.bin/cpuset/cpuset.1197
-rw-r--r--usr.bin/cpuset/cpuset.c365
-rw-r--r--usr.bin/csplit/Makefile5
-rw-r--r--usr.bin/csplit/Makefile.depend18
-rw-r--r--usr.bin/csplit/csplit.1169
-rw-r--r--usr.bin/csplit/csplit.c467
-rw-r--r--usr.bin/ctags/C.c532
-rw-r--r--usr.bin/ctags/Makefile8
-rw-r--r--usr.bin/ctags/Makefile.depend18
-rw-r--r--usr.bin/ctags/ctags.1251
-rw-r--r--usr.bin/ctags/ctags.c322
-rw-r--r--usr.bin/ctags/ctags.h96
-rw-r--r--usr.bin/ctags/fortran.c168
-rw-r--r--usr.bin/ctags/lisp.c106
-rw-r--r--usr.bin/ctags/print.c113
-rw-r--r--usr.bin/ctags/test/ctags.test67
-rw-r--r--usr.bin/ctags/tree.c133
-rw-r--r--usr.bin/ctags/yacc.c151
-rw-r--r--usr.bin/ctlstat/Makefile8
-rw-r--r--usr.bin/ctlstat/Makefile.depend18
-rw-r--r--usr.bin/ctlstat/ctlstat.8122
-rw-r--r--usr.bin/ctlstat/ctlstat.c752
-rw-r--r--usr.bin/cut/Makefile12
-rw-r--r--usr.bin/cut/Makefile.depend18
-rw-r--r--usr.bin/cut/cut.1163
-rw-r--r--usr.bin/cut/cut.c479
-rw-r--r--usr.bin/cut/tests/Makefile17
-rw-r--r--usr.bin/cut/tests/Makefile.depend11
-rw-r--r--usr.bin/cxxfilt/Makefile17
-rw-r--r--usr.bin/cxxfilt/Makefile.depend20
-rw-r--r--usr.bin/dc/Makefile8
-rw-r--r--usr.bin/dc/Makefile.depend20
-rw-r--r--usr.bin/dc/bcode.c1776
-rw-r--r--usr.bin/dc/bcode.h97
-rw-r--r--usr.bin/dc/dc.1554
-rw-r--r--usr.bin/dc/dc.c140
-rw-r--r--usr.bin/dc/extern.h63
-rw-r--r--usr.bin/dc/inout.c418
-rw-r--r--usr.bin/dc/mem.c110
-rw-r--r--usr.bin/dc/stack.c379
-rw-r--r--usr.bin/dirname/Makefile13
-rw-r--r--usr.bin/dirname/Makefile.depend17
-rw-r--r--usr.bin/dirname/dirname.c83
-rw-r--r--usr.bin/dirname/tests/Makefile7
-rw-r--r--usr.bin/dirname/tests/Makefile.depend11
-rw-r--r--usr.bin/dpv/Makefile11
-rw-r--r--usr.bin/dpv/Makefile.depend24
-rw-r--r--usr.bin/dpv/dpv.1433
-rw-r--r--usr.bin/dpv/dpv.c545
-rw-r--r--usr.bin/dpv/dpv_util.h68
-rw-r--r--usr.bin/drill/Makefile17
-rw-r--r--usr.bin/drill/Makefile.depend22
-rw-r--r--usr.bin/dtc/HACKING63
-rw-r--r--usr.bin/dtc/Makefile13
-rw-r--r--usr.bin/dtc/Makefile.depend21
-rw-r--r--usr.bin/dtc/checking.cc259
-rw-r--r--usr.bin/dtc/checking.hh308
-rw-r--r--usr.bin/dtc/dtb.cc311
-rw-r--r--usr.bin/dtc/dtb.hh365
-rw-r--r--usr.bin/dtc/dtc.1332
-rw-r--r--usr.bin/dtc/dtc.cc344
-rw-r--r--usr.bin/dtc/fdt.cc1616
-rw-r--r--usr.bin/dtc/fdt.hh866
-rw-r--r--usr.bin/dtc/input_buffer.cc831
-rw-r--r--usr.bin/dtc/input_buffer.hh316
-rw-r--r--usr.bin/dtc/string.cc258
-rw-r--r--usr.bin/dtc/string.hh164
-rw-r--r--usr.bin/dtc/util.hh92
-rw-r--r--usr.bin/du/Makefile7
-rw-r--r--usr.bin/du/Makefile.depend19
-rw-r--r--usr.bin/du/du.1222
-rw-r--r--usr.bin/du/du.c544
-rw-r--r--usr.bin/ee/Makefile36
-rw-r--r--usr.bin/ee/Makefile.depend19
-rw-r--r--usr.bin/ee/nls/de_DE.ISO8859-1/ee.msg185
-rw-r--r--usr.bin/ee/nls/fr_FR.ISO8859-1/ee.msg185
-rw-r--r--usr.bin/ee/nls/hu_HU.ISO8859-2/ee.msg185
-rw-r--r--usr.bin/ee/nls/pl_PL.ISO8859-2/ee.msg185
-rw-r--r--usr.bin/ee/nls/pt_BR.ISO8859-1/ee.msg186
-rw-r--r--usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg187
-rw-r--r--usr.bin/ee/nls/uk_UA.KOI8-U/ee.msg185
-rw-r--r--usr.bin/elf2aout/Makefile7
-rw-r--r--usr.bin/elf2aout/Makefile.depend18
-rw-r--r--usr.bin/elf2aout/elf2aout.164
-rw-r--r--usr.bin/elf2aout/elf2aout.c162
-rw-r--r--usr.bin/elfcopy/Makefile46
-rw-r--r--usr.bin/elfcopy/Makefile.depend28
-rw-r--r--usr.bin/elfdump/Makefile5
-rw-r--r--usr.bin/elfdump/Makefile.depend18
-rw-r--r--usr.bin/elfdump/elfdump.1112
-rw-r--r--usr.bin/elfdump/elfdump.c1257
-rw-r--r--usr.bin/enigma/Makefile10
-rw-r--r--usr.bin/enigma/Makefile.depend19
-rw-r--r--usr.bin/enigma/enigma.1132
-rw-r--r--usr.bin/enigma/enigma.c158
-rw-r--r--usr.bin/env/Makefile7
-rw-r--r--usr.bin/env/Makefile.depend18
-rw-r--r--usr.bin/env/env.1482
-rw-r--r--usr.bin/env/env.c144
-rw-r--r--usr.bin/env/envopts.c468
-rw-r--r--usr.bin/env/envopts.h37
-rw-r--r--usr.bin/expand/Makefile7
-rw-r--r--usr.bin/expand/Makefile.depend18
-rw-r--r--usr.bin/expand/expand.1114
-rw-r--r--usr.bin/expand/expand.c196
-rw-r--r--usr.bin/factor/Makefile19
-rw-r--r--usr.bin/factor/Makefile.depend19
-rw-r--r--usr.bin/factor/factor.6127
-rw-r--r--usr.bin/factor/factor.c374
-rw-r--r--usr.bin/false/Makefile6
-rw-r--r--usr.bin/false/Makefile.depend17
-rw-r--r--usr.bin/false/false.163
-rw-r--r--usr.bin/false/false.c46
-rw-r--r--usr.bin/fetch/Makefile7
-rw-r--r--usr.bin/fetch/Makefile.depend21
-rw-r--r--usr.bin/fetch/fetch.1427
-rw-r--r--usr.bin/fetch/fetch.c1175
-rw-r--r--usr.bin/file/Makefile48
-rw-r--r--usr.bin/file/Makefile.depend20
-rw-r--r--usr.bin/file2c/Makefile11
-rw-r--r--usr.bin/file2c/Makefile.depend17
-rw-r--r--usr.bin/file2c/file2c.175
-rw-r--r--usr.bin/file2c/file2c.c92
-rw-r--r--usr.bin/file2c/tests/Makefile19
-rw-r--r--usr.bin/file2c/tests/Makefile.depend11
-rw-r--r--usr.bin/file2c/tests/legacy_test.sh6
-rw-r--r--usr.bin/file2c/tests/regress.1.out1
-rw-r--r--usr.bin/file2c/tests/regress.2.out3
-rw-r--r--usr.bin/file2c/tests/regress.3.out5
-rw-r--r--usr.bin/file2c/tests/regress.4.out4
-rw-r--r--usr.bin/file2c/tests/regress.5.out1
-rw-r--r--usr.bin/file2c/tests/regress.6.out9
-rw-r--r--usr.bin/file2c/tests/regress.7.out8
-rw-r--r--usr.bin/file2c/tests/regress.8.out4
-rw-r--r--usr.bin/file2c/tests/regress.9.out104
-rw-r--r--usr.bin/file2c/tests/regress.inbin0 -> 2048 bytes
-rw-r--r--usr.bin/file2c/tests/regress.sh19
-rw-r--r--usr.bin/find/Makefile11
-rw-r--r--usr.bin/find/Makefile.depend19
-rw-r--r--usr.bin/find/extern.h124
-rw-r--r--usr.bin/find/find.11119
-rw-r--r--usr.bin/find/find.c240
-rw-r--r--usr.bin/find/find.h145
-rw-r--r--usr.bin/find/function.c1786
-rw-r--r--usr.bin/find/getdate.y959
-rw-r--r--usr.bin/find/ls.c119
-rw-r--r--usr.bin/find/main.c168
-rw-r--r--usr.bin/find/misc.c115
-rw-r--r--usr.bin/find/operator.c273
-rw-r--r--usr.bin/find/option.c198
-rw-r--r--usr.bin/finger/Makefile8
-rw-r--r--usr.bin/finger/Makefile.depend18
-rw-r--r--usr.bin/finger/extern.h61
-rw-r--r--usr.bin/finger/finger.1245
-rw-r--r--usr.bin/finger/finger.c406
-rw-r--r--usr.bin/finger/finger.conf.591
-rw-r--r--usr.bin/finger/finger.h72
-rw-r--r--usr.bin/finger/lprint.c363
-rw-r--r--usr.bin/finger/net.c237
-rw-r--r--usr.bin/finger/pathnames.h41
-rw-r--r--usr.bin/finger/sprint.c184
-rw-r--r--usr.bin/finger/util.c405
-rw-r--r--usr.bin/fmt/Makefile6
-rw-r--r--usr.bin/fmt/Makefile.depend18
-rw-r--r--usr.bin/fmt/fmt.1192
-rw-r--r--usr.bin/fmt/fmt.c786
-rw-r--r--usr.bin/fold/Makefile6
-rw-r--r--usr.bin/fold/Makefile.depend18
-rw-r--r--usr.bin/fold/fold.1117
-rw-r--r--usr.bin/fold/fold.c235
-rw-r--r--usr.bin/fortune/Makefile5
-rw-r--r--usr.bin/fortune/Makefile.inc3
-rw-r--r--usr.bin/fortune/Notes178
-rw-r--r--usr.bin/fortune/README42
-rw-r--r--usr.bin/fortune/datfiles/Makefile22
-rw-r--r--usr.bin/fortune/datfiles/Makefile.depend11
-rw-r--r--usr.bin/fortune/datfiles/fortunes59053
-rw-r--r--usr.bin/fortune/datfiles/fortunes.sp.ok4469
-rw-r--r--usr.bin/fortune/datfiles/freebsd-tips464
-rw-r--r--usr.bin/fortune/datfiles/freebsd-tips.sp.ok87
-rw-r--r--usr.bin/fortune/datfiles/gerrold.limerick814
-rw-r--r--usr.bin/fortune/datfiles/limerick4812
-rw-r--r--usr.bin/fortune/datfiles/limerick.sp.ok462
-rw-r--r--usr.bin/fortune/datfiles/murphy2212
-rw-r--r--usr.bin/fortune/datfiles/murphy-o30
-rw-r--r--usr.bin/fortune/datfiles/murphy.sp.ok36
-rw-r--r--usr.bin/fortune/datfiles/startrek759
-rw-r--r--usr.bin/fortune/datfiles/startrek.sp.ok86
-rw-r--r--usr.bin/fortune/datfiles/zippy1335
-rw-r--r--usr.bin/fortune/datfiles/zippy.sp.ok211
-rw-r--r--usr.bin/fortune/fortune/Makefile11
-rw-r--r--usr.bin/fortune/fortune/Makefile.depend18
-rw-r--r--usr.bin/fortune/fortune/fortune.6191
-rw-r--r--usr.bin/fortune/fortune/fortune.c1427
-rw-r--r--usr.bin/fortune/fortune/pathnames.h34
-rw-r--r--usr.bin/fortune/strfile/Makefile8
-rw-r--r--usr.bin/fortune/strfile/Makefile.depend18
-rw-r--r--usr.bin/fortune/strfile/strfile.8159
-rw-r--r--usr.bin/fortune/strfile/strfile.c454
-rw-r--r--usr.bin/fortune/strfile/strfile.h54
-rw-r--r--usr.bin/fortune/tools/Do_spell10
-rw-r--r--usr.bin/fortune/tools/Do_troff10
-rw-r--r--usr.bin/fortune/tools/Troff.mac26
-rw-r--r--usr.bin/fortune/tools/Troff.sed13
-rw-r--r--usr.bin/fortune/tools/do_sort13
-rw-r--r--usr.bin/fortune/tools/do_uniq.py68
-rw-r--r--usr.bin/fortune/unstr/Makefile8
-rw-r--r--usr.bin/fortune/unstr/Makefile.depend18
-rw-r--r--usr.bin/fortune/unstr/unstr.c137
-rw-r--r--usr.bin/from/Makefile6
-rw-r--r--usr.bin/from/Makefile.depend18
-rw-r--r--usr.bin/from/from.196
-rw-r--r--usr.bin/from/from.c167
-rw-r--r--usr.bin/fstat/Makefile11
-rw-r--r--usr.bin/fstat/Makefile.depend22
-rw-r--r--usr.bin/fstat/fstat.1235
-rw-r--r--usr.bin/fstat/fstat.c567
-rw-r--r--usr.bin/fstat/functions.h34
-rw-r--r--usr.bin/fstat/fuser.1153
-rw-r--r--usr.bin/fstat/fuser.c368
-rw-r--r--usr.bin/fstat/main.c49
-rw-r--r--usr.bin/fsync/Makefile5
-rw-r--r--usr.bin/fsync/Makefile.depend17
-rw-r--r--usr.bin/fsync/fsync.163
-rw-r--r--usr.bin/fsync/fsync.c80
-rw-r--r--usr.bin/ftp/Makefile32
-rw-r--r--usr.bin/ftp/Makefile.depend21
-rw-r--r--usr.bin/ftp/tnftp_config.h514
-rw-r--r--usr.bin/gcore/Makefile14
-rw-r--r--usr.bin/gcore/Makefile.depend20
-rw-r--r--usr.bin/gcore/elf32core.c48
-rw-r--r--usr.bin/gcore/elfcore.c810
-rw-r--r--usr.bin/gcore/extern.h40
-rw-r--r--usr.bin/gcore/gcore.1104
-rw-r--r--usr.bin/gcore/gcore.c177
-rw-r--r--usr.bin/gencat/Makefile5
-rw-r--r--usr.bin/gencat/Makefile.depend19
-rw-r--r--usr.bin/gencat/gencat.1191
-rw-r--r--usr.bin/gencat/gencat.c694
-rw-r--r--usr.bin/getconf/Makefile37
-rw-r--r--usr.bin/getconf/Makefile.depend18
-rw-r--r--usr.bin/getconf/confstr.gperf70
-rw-r--r--usr.bin/getconf/fake-gperf.awk66
-rw-r--r--usr.bin/getconf/getconf.1207
-rw-r--r--usr.bin/getconf/getconf.c190
-rw-r--r--usr.bin/getconf/getconf.h43
-rw-r--r--usr.bin/getconf/limits.gperf118
-rw-r--r--usr.bin/getconf/pathconf.gperf62
-rw-r--r--usr.bin/getconf/progenv.gperf67
-rw-r--r--usr.bin/getconf/sysconf.gperf149
-rw-r--r--usr.bin/getent/Makefile5
-rw-r--r--usr.bin/getent/Makefile.depend20
-rw-r--r--usr.bin/getent/getent.1129
-rw-r--r--usr.bin/getent/getent.c715
-rw-r--r--usr.bin/getopt/Makefile6
-rw-r--r--usr.bin/getopt/Makefile.depend17
-rw-r--r--usr.bin/getopt/getopt.1134
-rw-r--r--usr.bin/getopt/getopt.c37
-rw-r--r--usr.bin/gprof/Makefile12
-rw-r--r--usr.bin/gprof/Makefile.depend18
-rw-r--r--usr.bin/gprof/amd64.h40
-rw-r--r--usr.bin/gprof/aout.c229
-rw-r--r--usr.bin/gprof/arcs.c953
-rw-r--r--usr.bin/gprof/arm.h40
-rw-r--r--usr.bin/gprof/dfn.c321
-rw-r--r--usr.bin/gprof/elf.c144
-rw-r--r--usr.bin/gprof/gprof.1328
-rw-r--r--usr.bin/gprof/gprof.c593
-rw-r--r--usr.bin/gprof/gprof.callg108
-rw-r--r--usr.bin/gprof/gprof.flat32
-rw-r--r--usr.bin/gprof/gprof.h330
-rw-r--r--usr.bin/gprof/hertz.c63
-rw-r--r--usr.bin/gprof/i386.h40
-rw-r--r--usr.bin/gprof/kernel.c64
-rw-r--r--usr.bin/gprof/lookup.c119
-rw-r--r--usr.bin/gprof/mips.h46
-rw-r--r--usr.bin/gprof/pathnames.h35
-rw-r--r--usr.bin/gprof/powerpc.h40
-rw-r--r--usr.bin/gprof/printgprof.c746
-rw-r--r--usr.bin/gprof/printlist.c90
-rw-r--r--usr.bin/gprof/sparc64.h40
-rw-r--r--usr.bin/grdc/Makefile8
-rw-r--r--usr.bin/grdc/Makefile.depend19
-rw-r--r--usr.bin/grdc/grdc.633
-rw-r--r--usr.bin/grdc/grdc.c273
-rw-r--r--usr.bin/grep/Makefile93
-rw-r--r--usr.bin/grep/Makefile.depend23
-rw-r--r--usr.bin/grep/file.c351
-rw-r--r--usr.bin/grep/grep.1488
-rw-r--r--usr.bin/grep/grep.c748
-rw-r--r--usr.bin/grep/grep.h153
-rw-r--r--usr.bin/grep/nls/C.msg13
-rw-r--r--usr.bin/grep/nls/Makefile.inc18
-rw-r--r--usr.bin/grep/nls/es_ES.ISO8859-1.msg13
-rw-r--r--usr.bin/grep/nls/gl_ES.ISO8859-1.msg13
-rw-r--r--usr.bin/grep/nls/hu_HU.ISO8859-2.msg13
-rw-r--r--usr.bin/grep/nls/ja_JP.SJIS.msg13
-rw-r--r--usr.bin/grep/nls/ja_JP.UTF-8.msg13
-rw-r--r--usr.bin/grep/nls/ja_JP.eucJP.msg13
-rw-r--r--usr.bin/grep/nls/pt_BR.ISO8859-1.msg13
-rw-r--r--usr.bin/grep/nls/ru_RU.KOI8-R.msg13
-rw-r--r--usr.bin/grep/nls/uk_UA.UTF-8.msg12
-rw-r--r--usr.bin/grep/nls/zh_CN.UTF-8.msg13
-rw-r--r--usr.bin/grep/queue.c113
-rw-r--r--usr.bin/grep/regex/fastmatch.c169
-rw-r--r--usr.bin/grep/regex/fastmatch.h108
-rw-r--r--usr.bin/grep/regex/glue.h67
-rw-r--r--usr.bin/grep/regex/hashtable.c268
-rw-r--r--usr.bin/grep/regex/hashtable.h35
-rw-r--r--usr.bin/grep/regex/tre-compile.c103
-rw-r--r--usr.bin/grep/regex/tre-fastmatch.c1042
-rw-r--r--usr.bin/grep/regex/tre-fastmatch.h21
-rw-r--r--usr.bin/grep/regex/xmalloc.c349
-rw-r--r--usr.bin/grep/regex/xmalloc.h79
-rw-r--r--usr.bin/grep/tests/Makefile36
-rw-r--r--usr.bin/grep/tests/Makefile.depend11
-rw-r--r--usr.bin/grep/util.c492
-rw-r--r--usr.bin/gzip/Makefile34
-rw-r--r--usr.bin/gzip/Makefile.depend22
-rw-r--r--usr.bin/gzip/gzexe179
-rw-r--r--usr.bin/gzip/gzexe.173
-rw-r--r--usr.bin/gzip/gzip.1234
-rw-r--r--usr.bin/gzip/gzip.c2174
-rw-r--r--usr.bin/gzip/tests/Makefile9
-rw-r--r--usr.bin/gzip/tests/Makefile.depend11
-rw-r--r--usr.bin/gzip/unbzip2.c141
-rw-r--r--usr.bin/gzip/unpack.c329
-rw-r--r--usr.bin/gzip/unxz.c153
-rw-r--r--usr.bin/gzip/zdiff142
-rw-r--r--usr.bin/gzip/zdiff.1142
-rw-r--r--usr.bin/gzip/zforce55
-rw-r--r--usr.bin/gzip/zforce.153
-rw-r--r--usr.bin/gzip/zmore82
-rw-r--r--usr.bin/gzip/zmore.1110
-rw-r--r--usr.bin/gzip/znew137
-rw-r--r--usr.bin/gzip/znew.171
-rw-r--r--usr.bin/gzip/zuncompress.c396
-rw-r--r--usr.bin/head/Makefile6
-rw-r--r--usr.bin/head/Makefile.depend18
-rw-r--r--usr.bin/head/head.178
-rw-r--r--usr.bin/head/head.c182
-rw-r--r--usr.bin/hesinfo/Makefile5
-rw-r--r--usr.bin/hesinfo/hesinfo.1198
-rw-r--r--usr.bin/hesinfo/hesinfo.c108
-rw-r--r--usr.bin/hexdump/Makefile11
-rw-r--r--usr.bin/hexdump/Makefile.depend18
-rw-r--r--usr.bin/hexdump/conv.c178
-rw-r--r--usr.bin/hexdump/display.c395
-rw-r--r--usr.bin/hexdump/hexdump.1347
-rw-r--r--usr.bin/hexdump/hexdump.c82
-rw-r--r--usr.bin/hexdump/hexdump.h104
-rw-r--r--usr.bin/hexdump/hexsyntax.c140
-rw-r--r--usr.bin/hexdump/od.1264
-rw-r--r--usr.bin/hexdump/odsyntax.c438
-rw-r--r--usr.bin/hexdump/parse.c515
-rw-r--r--usr.bin/host/Makefile20
-rw-r--r--usr.bin/host/Makefile.depend21
-rw-r--r--usr.bin/iconv/Makefile10
-rw-r--r--usr.bin/iconv/Makefile.depend18
-rw-r--r--usr.bin/iconv/iconv.1119
-rw-r--r--usr.bin/iconv/iconv.c219
-rw-r--r--usr.bin/id/Makefile15
-rw-r--r--usr.bin/id/Makefile.depend18
-rw-r--r--usr.bin/id/groups.159
-rw-r--r--usr.bin/id/id.1162
-rw-r--r--usr.bin/id/id.c501
-rw-r--r--usr.bin/id/whoami.156
-rw-r--r--usr.bin/ident/Makefile13
-rw-r--r--usr.bin/ident/Makefile.depend19
-rw-r--r--usr.bin/ident/ident.168
-rw-r--r--usr.bin/ident/ident.c242
-rw-r--r--usr.bin/ident/tests/Makefile11
-rw-r--r--usr.bin/ident/tests/Makefile.depend11
-rwxr-xr-xusr.bin/ident/tests/ident.sh16
-rw-r--r--usr.bin/ident/tests/test.in15
-rw-r--r--usr.bin/ident/tests/test.out6
-rw-r--r--usr.bin/ident/tests/testnoid0
-rw-r--r--usr.bin/indent/Makefile9
-rw-r--r--usr.bin/indent/Makefile.depend18
-rw-r--r--usr.bin/indent/README100
-rw-r--r--usr.bin/indent/args.c327
-rw-r--r--usr.bin/indent/indent.1557
-rw-r--r--usr.bin/indent/indent.c1234
-rw-r--r--usr.bin/indent/indent.h47
-rw-r--r--usr.bin/indent/indent_codes.h70
-rw-r--r--usr.bin/indent/indent_globs.h329
-rw-r--r--usr.bin/indent/io.c667
-rw-r--r--usr.bin/indent/lexi.c608
-rw-r--r--usr.bin/indent/parse.c332
-rw-r--r--usr.bin/indent/pr_comment.c429
-rw-r--r--usr.bin/ipcrm/Makefile11
-rw-r--r--usr.bin/ipcrm/Makefile.depend20
-rw-r--r--usr.bin/ipcrm/ipcrm.1119
-rw-r--r--usr.bin/ipcrm/ipcrm.c300
-rw-r--r--usr.bin/ipcs/Makefile7
-rw-r--r--usr.bin/ipcs/Makefile.depend20
-rw-r--r--usr.bin/ipcs/ipc.c205
-rw-r--r--usr.bin/ipcs/ipc.h68
-rw-r--r--usr.bin/ipcs/ipcs.1176
-rw-r--r--usr.bin/ipcs/ipcs.c570
-rw-r--r--usr.bin/iscsictl/Makefile19
-rw-r--r--usr.bin/iscsictl/Makefile.depend22
-rw-r--r--usr.bin/iscsictl/iscsi.conf.5178
-rw-r--r--usr.bin/iscsictl/iscsictl.8223
-rw-r--r--usr.bin/iscsictl/iscsictl.c1042
-rw-r--r--usr.bin/iscsictl/iscsictl.h123
-rw-r--r--usr.bin/iscsictl/parse.y359
-rw-r--r--usr.bin/iscsictl/periphs.c202
-rw-r--r--usr.bin/iscsictl/token.l99
-rw-r--r--usr.bin/join/Makefile12
-rw-r--r--usr.bin/join/Makefile.depend18
-rw-r--r--usr.bin/join/join.1223
-rw-r--r--usr.bin/join/join.c665
-rw-r--r--usr.bin/join/tests/Makefile12
-rw-r--r--usr.bin/join/tests/Makefile.depend11
-rw-r--r--usr.bin/join/tests/legacy_test.sh6
-rw-r--r--usr.bin/join/tests/regress.1.in4
-rw-r--r--usr.bin/join/tests/regress.2.in4
-rw-r--r--usr.bin/join/tests/regress.out5
-rw-r--r--usr.bin/join/tests/regress.sh9
-rw-r--r--usr.bin/jot/Makefile12
-rw-r--r--usr.bin/jot/Makefile.depend18
-rw-r--r--usr.bin/jot/jot.1328
-rw-r--r--usr.bin/jot/jot.c493
-rw-r--r--usr.bin/jot/tests/Makefile70
-rw-r--r--usr.bin/jot/tests/Makefile.depend11
-rw-r--r--usr.bin/jot/tests/legacy_test.sh6
-rw-r--r--usr.bin/jot/tests/regress.ascii.outbin0 -> 256 bytes
-rw-r--r--usr.bin/jot/tests/regress.block.out512
-rw-r--r--usr.bin/jot/tests/regress.dddd.out100
-rw-r--r--usr.bin/jot/tests/regress.dddh.out100
-rw-r--r--usr.bin/jot/tests/regress.ddhd.out100
-rw-r--r--usr.bin/jot/tests/regress.ddhd2.out100
-rw-r--r--usr.bin/jot/tests/regress.ddhh.out100
-rw-r--r--usr.bin/jot/tests/regress.ddhh2.out100
-rw-r--r--usr.bin/jot/tests/regress.dhdd.out100
-rw-r--r--usr.bin/jot/tests/regress.dhdh.out100
-rw-r--r--usr.bin/jot/tests/regress.dhhd.out101
-rw-r--r--usr.bin/jot/tests/regress.dhhd2.out141
-rw-r--r--usr.bin/jot/tests/regress.dhhh.out51
-rw-r--r--usr.bin/jot/tests/regress.dhhh2.out71
-rw-r--r--usr.bin/jot/tests/regress.ed.out30
-rw-r--r--usr.bin/jot/tests/regress.grep.out1
-rw-r--r--usr.bin/jot/tests/regress.hddd.out50
-rw-r--r--usr.bin/jot/tests/regress.hddd2.out30
-rw-r--r--usr.bin/jot/tests/regress.hddh.out50
-rw-r--r--usr.bin/jot/tests/regress.hddh2.out30
-rw-r--r--usr.bin/jot/tests/regress.hdhd.out50
-rw-r--r--usr.bin/jot/tests/regress.hdhd2.out30
-rw-r--r--usr.bin/jot/tests/regress.hdhh.out50
-rw-r--r--usr.bin/jot/tests/regress.hdhh2.out30
-rw-r--r--usr.bin/jot/tests/regress.hhdd.out50
-rw-r--r--usr.bin/jot/tests/regress.hhdd2.out30
-rw-r--r--usr.bin/jot/tests/regress.hhdh.out50
-rw-r--r--usr.bin/jot/tests/regress.hhdh2.out30
-rw-r--r--usr.bin/jot/tests/regress.hhhd.out50
-rw-r--r--usr.bin/jot/tests/regress.hhhd2.out30
-rw-r--r--usr.bin/jot/tests/regress.hhhh.out50
-rw-r--r--usr.bin/jot/tests/regress.hhhh2.out30
-rw-r--r--usr.bin/jot/tests/regress.n21.out21
-rw-r--r--usr.bin/jot/tests/regress.rand1.out10
-rw-r--r--usr.bin/jot/tests/regress.rand2.out10
-rw-r--r--usr.bin/jot/tests/regress.sh68
-rw-r--r--usr.bin/jot/tests/regress.stutter.out19
-rw-r--r--usr.bin/jot/tests/regress.stutter2.out20
-rw-r--r--usr.bin/jot/tests/regress.tabs.out1
-rw-r--r--usr.bin/jot/tests/regress.wX1.out10
-rw-r--r--usr.bin/jot/tests/regress.wXl.out10
-rw-r--r--usr.bin/jot/tests/regress.wc.out10
-rw-r--r--usr.bin/jot/tests/regress.wdl.out0
-rw-r--r--usr.bin/jot/tests/regress.wdn.out10
-rw-r--r--usr.bin/jot/tests/regress.we.out10
-rw-r--r--usr.bin/jot/tests/regress.wf.out10
-rw-r--r--usr.bin/jot/tests/regress.wg.out10
-rw-r--r--usr.bin/jot/tests/regress.wgd.out10
-rw-r--r--usr.bin/jot/tests/regress.wo.out10
-rw-r--r--usr.bin/jot/tests/regress.wp1.out10
-rw-r--r--usr.bin/jot/tests/regress.wp2.out10
-rw-r--r--usr.bin/jot/tests/regress.wp3.out10
-rw-r--r--usr.bin/jot/tests/regress.wp4.out10
-rw-r--r--usr.bin/jot/tests/regress.wp5.out10
-rw-r--r--usr.bin/jot/tests/regress.wp6.out10
-rw-r--r--usr.bin/jot/tests/regress.wu.out10
-rw-r--r--usr.bin/jot/tests/regress.wwe.out10
-rw-r--r--usr.bin/jot/tests/regress.wx.out10
-rw-r--r--usr.bin/jot/tests/regress.wxn.out0
-rw-r--r--usr.bin/jot/tests/regress.x.out1
-rw-r--r--usr.bin/jot/tests/regress.xaa.out26
-rw-r--r--usr.bin/jot/tests/regress.yes.out10
-rw-r--r--usr.bin/kdump/Makefile31
-rw-r--r--usr.bin/kdump/Makefile.depend24
-rw-r--r--usr.bin/kdump/kdump.1185
-rw-r--r--usr.bin/kdump/kdump.c1843
-rw-r--r--usr.bin/kdump/linux32_syscalls.conf11
-rw-r--r--usr.bin/kdump/linux_syscalls.conf11
-rw-r--r--usr.bin/kdump/mksubr759
-rw-r--r--usr.bin/keylogin/Makefile7
-rw-r--r--usr.bin/keylogin/Makefile.depend21
-rw-r--r--usr.bin/keylogin/keylogin.130
-rw-r--r--usr.bin/keylogin/keylogin.c85
-rw-r--r--usr.bin/keylogout/Makefile5
-rw-r--r--usr.bin/keylogout/Makefile.depend20
-rw-r--r--usr.bin/keylogout/keylogout.142
-rw-r--r--usr.bin/keylogout/keylogout.c69
-rw-r--r--usr.bin/killall/Makefile6
-rw-r--r--usr.bin/killall/Makefile.depend19
-rw-r--r--usr.bin/killall/killall.1178
-rw-r--r--usr.bin/killall/killall.c437
-rw-r--r--usr.bin/ktrace/Makefile8
-rw-r--r--usr.bin/ktrace/Makefile.depend18
-rw-r--r--usr.bin/ktrace/ktrace.1188
-rw-r--r--usr.bin/ktrace/ktrace.c240
-rw-r--r--usr.bin/ktrace/ktrace.h44
-rw-r--r--usr.bin/ktrace/subr.c129
-rw-r--r--usr.bin/ktrdump/Makefile9
-rw-r--r--usr.bin/ktrdump/Makefile.depend20
-rw-r--r--usr.bin/ktrdump/ktrdump.892
-rw-r--r--usr.bin/ktrdump/ktrdump.c321
-rw-r--r--usr.bin/lam/Makefile6
-rw-r--r--usr.bin/lam/Makefile.depend18
-rw-r--r--usr.bin/lam/lam.1144
-rw-r--r--usr.bin/lam/lam.c226
-rw-r--r--usr.bin/last/Makefile8
-rw-r--r--usr.bin/last/Makefile.depend18
-rw-r--r--usr.bin/last/last.1221
-rw-r--r--usr.bin/last/last.c558
-rw-r--r--usr.bin/lastcomm/Makefile15
-rw-r--r--usr.bin/lastcomm/Makefile.depend18
-rw-r--r--usr.bin/lastcomm/lastcomm.1185
-rw-r--r--usr.bin/lastcomm/lastcomm.c275
-rw-r--r--usr.bin/lastcomm/pathnames.h34
-rw-r--r--usr.bin/lastcomm/readrec.c227
-rw-r--r--usr.bin/lastcomm/tests/Makefile20
-rw-r--r--usr.bin/lastcomm/tests/Makefile.depend11
-rw-r--r--usr.bin/lastcomm/tests/README10
-rw-r--r--usr.bin/lastcomm/tests/legacy_test.sh38
-rw-r--r--usr.bin/lastcomm/tests/v1-amd64-acct.inbin0 -> 1568 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-amd64.out28
-rw-r--r--usr.bin/lastcomm/tests/v1-i386-acct.inbin0 -> 1344 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-i386.out28
-rw-r--r--usr.bin/lastcomm/tests/v1-sparc64-acct.inbin0 -> 1568 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-sparc64.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-amd64-acct.inbin0 -> 2016 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-amd64.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-i386-acct.inbin0 -> 1792 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-i386.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-sparc64-acct.inbin0 -> 2592 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-sparc64.out36
-rwxr-xr-xusr.bin/lastcomm/tests/values.sh83
-rw-r--r--usr.bin/ldd/Makefile9
-rw-r--r--usr.bin/ldd/Makefile.depend19
-rw-r--r--usr.bin/ldd/extern.h30
-rw-r--r--usr.bin/ldd/ldd.180
-rw-r--r--usr.bin/ldd/ldd.c413
-rw-r--r--usr.bin/ldd/sods.c571
-rw-r--r--usr.bin/leave/Makefile8
-rw-r--r--usr.bin/leave/Makefile.depend18
-rw-r--r--usr.bin/leave/leave.196
-rw-r--r--usr.bin/leave/leave.c192
-rw-r--r--usr.bin/less/Makefile20
-rw-r--r--usr.bin/less/Makefile.common12
-rw-r--r--usr.bin/less/Makefile.depend19
-rw-r--r--usr.bin/less/defines.h439
-rw-r--r--usr.bin/less/lesspipe.sh25
-rw-r--r--usr.bin/less/zless.sh7
-rw-r--r--usr.bin/lessecho/Makefile8
-rw-r--r--usr.bin/lessecho/Makefile.depend18
-rw-r--r--usr.bin/lesskey/Makefile8
-rw-r--r--usr.bin/lesskey/Makefile.depend18
-rw-r--r--usr.bin/lex/Makefile64
-rw-r--r--usr.bin/lex/Makefile.depend19
-rw-r--r--usr.bin/lex/config.h208
-rw-r--r--usr.bin/lex/initparse.c1849
-rw-r--r--usr.bin/lex/initparse.h46
-rw-r--r--usr.bin/lex/initscan.c5216
-rw-r--r--usr.bin/lex/initskel.c3738
-rw-r--r--usr.bin/lex/lex.14297
-rw-r--r--usr.bin/lex/lib/Makefile22
-rw-r--r--usr.bin/lex/lib/Makefile.depend11
-rw-r--r--usr.bin/lex/version.awk13
-rw-r--r--usr.bin/limits/Makefile12
-rw-r--r--usr.bin/limits/Makefile.depend19
-rw-r--r--usr.bin/limits/limits.1406
-rw-r--r--usr.bin/limits/limits.c779
-rw-r--r--usr.bin/limits/tests/Makefile5
-rw-r--r--usr.bin/limits/tests/Makefile.depend11
-rwxr-xr-xusr.bin/limits/tests/limits_test.sh65
-rw-r--r--usr.bin/locale/Makefile7
-rw-r--r--usr.bin/locale/Makefile.depend18
-rw-r--r--usr.bin/locale/locale.1118
-rw-r--r--usr.bin/locale/locale.c690
-rw-r--r--usr.bin/localedef/Makefile26
-rw-r--r--usr.bin/localedef/Makefile.depend19
-rw-r--r--usr.bin/localedef/README11
-rw-r--r--usr.bin/localedef/charmap.c362
-rw-r--r--usr.bin/localedef/collate.c1313
-rw-r--r--usr.bin/localedef/ctype.c463
-rw-r--r--usr.bin/localedef/localedef.1267
-rw-r--r--usr.bin/localedef/localedef.c346
-rw-r--r--usr.bin/localedef/localedef.h172
-rw-r--r--usr.bin/localedef/messages.c121
-rw-r--r--usr.bin/localedef/monetary.c211
-rw-r--r--usr.bin/localedef/numeric.c119
-rw-r--r--usr.bin/localedef/parser.y706
-rw-r--r--usr.bin/localedef/scanner.c866
-rw-r--r--usr.bin/localedef/time.c277
-rw-r--r--usr.bin/localedef/wide.c666
-rw-r--r--usr.bin/locate/Makefile7
-rw-r--r--usr.bin/locate/Makefile.inc5
-rw-r--r--usr.bin/locate/bigram/Makefile9
-rw-r--r--usr.bin/locate/bigram/Makefile.depend17
-rw-r--r--usr.bin/locate/bigram/locate.bigram.c112
-rw-r--r--usr.bin/locate/code/Makefile9
-rw-r--r--usr.bin/locate/code/Makefile.depend18
-rw-r--r--usr.bin/locate/code/locate.code.c278
-rw-r--r--usr.bin/locate/locate/Makefile23
-rw-r--r--usr.bin/locate/locate/Makefile.depend19
-rw-r--r--usr.bin/locate/locate/concatdb.sh70
-rw-r--r--usr.bin/locate/locate/fastfind.c329
-rw-r--r--usr.bin/locate/locate/locate.1272
-rw-r--r--usr.bin/locate/locate/locate.c368
-rw-r--r--usr.bin/locate/locate/locate.h72
-rw-r--r--usr.bin/locate/locate/locate.rc33
-rw-r--r--usr.bin/locate/locate/locate.updatedb.875
-rw-r--r--usr.bin/locate/locate/mklocatedb.sh92
-rw-r--r--usr.bin/locate/locate/pathnames.h36
-rw-r--r--usr.bin/locate/locate/updatedb.sh102
-rw-r--r--usr.bin/locate/locate/util.c279
-rw-r--r--usr.bin/lock/Makefile10
-rw-r--r--usr.bin/lock/Makefile.depend19
-rw-r--r--usr.bin/lock/lock.184
-rw-r--r--usr.bin/lock/lock.c292
-rw-r--r--usr.bin/lockf/Makefile5
-rw-r--r--usr.bin/lockf/Makefile.depend17
-rw-r--r--usr.bin/lockf/lockf.1173
-rw-r--r--usr.bin/lockf/lockf.c241
-rw-r--r--usr.bin/logger/Makefile12
-rw-r--r--usr.bin/logger/Makefile.depend18
-rw-r--r--usr.bin/logger/logger.1130
-rw-r--r--usr.bin/logger/logger.c296
-rw-r--r--usr.bin/login/Makefile25
-rw-r--r--usr.bin/login/Makefile.depend21
-rw-r--r--usr.bin/login/README12
-rw-r--r--usr.bin/login/login.1164
-rw-r--r--usr.bin/login/login.c1033
-rw-r--r--usr.bin/login/login.h37
-rw-r--r--usr.bin/login/login_audit.c204
-rw-r--r--usr.bin/login/login_fbtab.c142
-rw-r--r--usr.bin/login/pathnames.h38
-rw-r--r--usr.bin/logins/Makefile5
-rw-r--r--usr.bin/logins/Makefile.depend18
-rw-r--r--usr.bin/logins/logins.1104
-rw-r--r--usr.bin/logins/logins.c408
-rw-r--r--usr.bin/logname/Makefile6
-rw-r--r--usr.bin/logname/Makefile.depend17
-rw-r--r--usr.bin/logname/logname.171
-rw-r--r--usr.bin/logname/logname.c67
-rw-r--r--usr.bin/look/Makefile6
-rw-r--r--usr.bin/look/Makefile.depend18
-rw-r--r--usr.bin/look/look.1126
-rw-r--r--usr.bin/look/look.c361
-rw-r--r--usr.bin/look/pathnames.h34
-rw-r--r--usr.bin/lorder/Makefile7
-rw-r--r--usr.bin/lorder/Makefile.depend11
-rw-r--r--usr.bin/lorder/lorder.190
-rw-r--r--usr.bin/lorder/lorder.sh90
-rw-r--r--usr.bin/lsvfs/Makefile5
-rw-r--r--usr.bin/lsvfs/Makefile.depend18
-rw-r--r--usr.bin/lsvfs/lsvfs.155
-rw-r--r--usr.bin/lsvfs/lsvfs.c97
-rw-r--r--usr.bin/lzmainfo/Makefile21
-rw-r--r--usr.bin/lzmainfo/Makefile.depend20
-rw-r--r--usr.bin/m4/Makefile27
-rw-r--r--usr.bin/m4/Makefile.depend23
-rw-r--r--usr.bin/m4/NOTES64
-rw-r--r--usr.bin/m4/TEST/ack.m440
-rw-r--r--usr.bin/m4/TEST/hanoi.m445
-rw-r--r--usr.bin/m4/TEST/hash.m455
-rw-r--r--usr.bin/m4/TEST/math.m4181
-rw-r--r--usr.bin/m4/TEST/sqroot.m445
-rw-r--r--usr.bin/m4/TEST/string.m445
-rw-r--r--usr.bin/m4/TEST/test.m4243
-rw-r--r--usr.bin/m4/eval.c1014
-rw-r--r--usr.bin/m4/expr.c47
-rw-r--r--usr.bin/m4/extern.h179
-rw-r--r--usr.bin/m4/gnum4.c673
-rw-r--r--usr.bin/m4/look.c339
-rw-r--r--usr.bin/m4/m4.1512
-rw-r--r--usr.bin/m4/main.c632
-rw-r--r--usr.bin/m4/mdef.h238
-rw-r--r--usr.bin/m4/misc.c470
-rw-r--r--usr.bin/m4/parser.y86
-rw-r--r--usr.bin/m4/pathnames.h39
-rw-r--r--usr.bin/m4/stdd.h56
-rw-r--r--usr.bin/m4/tests/Makefile51
-rw-r--r--usr.bin/m4/tests/Makefile.depend11
-rw-r--r--usr.bin/m4/tests/args.m49
-rw-r--r--usr.bin/m4/tests/args2.m45
-rw-r--r--usr.bin/m4/tests/comments.m459
-rw-r--r--usr.bin/m4/tests/esyscmd.m443
-rw-r--r--usr.bin/m4/tests/eval.m46
-rw-r--r--usr.bin/m4/tests/ff_after_dnl.m4.uu11
-rw-r--r--usr.bin/m4/tests/gnueval.m47
-rw-r--r--usr.bin/m4/tests/gnuformat.m42
-rw-r--r--usr.bin/m4/tests/gnupatterns.m44
-rw-r--r--usr.bin/m4/tests/gnupatterns2.m46
-rw-r--r--usr.bin/m4/tests/gnuprefix.m42
-rw-r--r--usr.bin/m4/tests/gnusofterror.m44
-rw-r--r--usr.bin/m4/tests/includes.aux3
-rw-r--r--usr.bin/m4/tests/includes.m45
-rw-r--r--usr.bin/m4/tests/legacy_test.sh6
-rw-r--r--usr.bin/m4/tests/m4wrap3.m412
-rw-r--r--usr.bin/m4/tests/patterns.m412
-rw-r--r--usr.bin/m4/tests/quotes.m458
-rw-r--r--usr.bin/m4/tests/redef.m417
-rw-r--r--usr.bin/m4/tests/regress.args.out3
-rw-r--r--usr.bin/m4/tests/regress.args2.out1
-rw-r--r--usr.bin/m4/tests/regress.comments.out47
-rw-r--r--usr.bin/m4/tests/regress.esyscmd.out578
-rw-r--r--usr.bin/m4/tests/regress.eval.out3
-rw-r--r--usr.bin/m4/tests/regress.ff_after_dnl.out2
-rw-r--r--usr.bin/m4/tests/regress.gnueval.out3
-rw-r--r--usr.bin/m4/tests/regress.gnuformat.out1
-rw-r--r--usr.bin/m4/tests/regress.gnupatterns.out3
-rw-r--r--usr.bin/m4/tests/regress.gnupatterns2.out1
-rw-r--r--usr.bin/m4/tests/regress.gnuprefix.out46
-rw-r--r--usr.bin/m4/tests/regress.gnusofterror.out2
-rw-r--r--usr.bin/m4/tests/regress.gnutranslit2.out6
-rw-r--r--usr.bin/m4/tests/regress.includes.out1
-rw-r--r--usr.bin/m4/tests/regress.m4wrap3.out4
-rw-r--r--usr.bin/m4/tests/regress.patterns.out6
-rw-r--r--usr.bin/m4/tests/regress.quotes.out49
-rw-r--r--usr.bin/m4/tests/regress.redef.out2
-rw-r--r--usr.bin/m4/tests/regress.sh33
-rw-r--r--usr.bin/m4/tests/regress.strangequotes.out1
-rw-r--r--usr.bin/m4/tests/regress.translit.out1
-rw-r--r--usr.bin/m4/tests/regress.translit2.out6
-rw-r--r--usr.bin/m4/tests/strangequotes.m4.uu8
-rw-r--r--usr.bin/m4/tests/translit.m44
-rw-r--r--usr.bin/m4/tests/translit2.m49
-rw-r--r--usr.bin/m4/tokenizer.l114
-rw-r--r--usr.bin/m4/trace.c198
-rw-r--r--usr.bin/mail/Makefile22
-rw-r--r--usr.bin/mail/Makefile.depend18
-rw-r--r--usr.bin/mail/cmd1.c466
-rw-r--r--usr.bin/mail/cmd2.c504
-rw-r--r--usr.bin/mail/cmd3.c713
-rw-r--r--usr.bin/mail/cmdtab.c121
-rw-r--r--usr.bin/mail/collect.c732
-rw-r--r--usr.bin/mail/def.h274
-rw-r--r--usr.bin/mail/edit.c214
-rw-r--r--usr.bin/mail/extern.h252
-rw-r--r--usr.bin/mail/fio.c451
-rw-r--r--usr.bin/mail/getname.c69
-rw-r--r--usr.bin/mail/glob.h98
-rw-r--r--usr.bin/mail/head.c275
-rw-r--r--usr.bin/mail/lex.c699
-rw-r--r--usr.bin/mail/list.c816
-rw-r--r--usr.bin/mail/mail.11280
-rw-r--r--usr.bin/mail/main.c347
-rw-r--r--usr.bin/mail/misc/mail.help23
-rw-r--r--usr.bin/mail/misc/mail.rc2
-rw-r--r--usr.bin/mail/misc/mail.tildehelp36
-rw-r--r--usr.bin/mail/names.c762
-rw-r--r--usr.bin/mail/pathnames.h38
-rw-r--r--usr.bin/mail/popen.c373
-rw-r--r--usr.bin/mail/quit.c494
-rw-r--r--usr.bin/mail/rcv.h42
-rw-r--r--usr.bin/mail/send.c585
-rw-r--r--usr.bin/mail/strings.c124
-rw-r--r--usr.bin/mail/temp.c88
-rw-r--r--usr.bin/mail/tty.c289
-rw-r--r--usr.bin/mail/util.c598
-rw-r--r--usr.bin/mail/v7.local.c93
-rw-r--r--usr.bin/mail/vars.c182
-rw-r--r--usr.bin/mail/version.c42
-rw-r--r--usr.bin/makewhatis/Makefile6
-rw-r--r--usr.bin/makewhatis/Makefile.depend19
-rw-r--r--usr.bin/makewhatis/makewhatis.1136
-rw-r--r--usr.bin/makewhatis/makewhatis.c1049
-rw-r--r--usr.bin/makewhatis/makewhatis.local.883
-rw-r--r--usr.bin/makewhatis/makewhatis.local.sh58
-rw-r--r--usr.bin/man/Makefile17
-rw-r--r--usr.bin/man/Makefile.depend11
-rw-r--r--usr.bin/man/apropos.188
-rw-r--r--usr.bin/man/man.1365
-rw-r--r--usr.bin/man/man.conf.5142
-rwxr-xr-xusr.bin/man/man.sh1005
-rw-r--r--usr.bin/man/manpath.1123
-rw-r--r--usr.bin/mandoc/Makefile91
-rw-r--r--usr.bin/mandoc/Makefile.depend22
-rw-r--r--usr.bin/mesg/Makefile6
-rw-r--r--usr.bin/mesg/Makefile.depend18
-rw-r--r--usr.bin/mesg/mesg.1108
-rw-r--r--usr.bin/mesg/mesg.c112
-rw-r--r--usr.bin/minigzip/Makefile12
-rw-r--r--usr.bin/minigzip/Makefile.depend19
-rw-r--r--usr.bin/minigzip/minigzip.183
-rw-r--r--usr.bin/ministat/Makefile14
-rw-r--r--usr.bin/ministat/Makefile.depend19
-rw-r--r--usr.bin/ministat/README50
-rw-r--r--usr.bin/ministat/chameleon6
-rw-r--r--usr.bin/ministat/iguana8
-rw-r--r--usr.bin/ministat/ministat.1135
-rw-r--r--usr.bin/ministat/ministat.c635
-rw-r--r--usr.bin/mkcsmapper/Makefile11
-rw-r--r--usr.bin/mkcsmapper/Makefile.depend20
-rw-r--r--usr.bin/mkcsmapper/Makefile.inc9
-rw-r--r--usr.bin/mkcsmapper/ldef.h41
-rw-r--r--usr.bin/mkcsmapper/lex.l109
-rw-r--r--usr.bin/mkcsmapper/mkcsmapper.189
-rw-r--r--usr.bin/mkcsmapper/yacc.y731
-rw-r--r--usr.bin/mkcsmapper_static/Makefile17
-rw-r--r--usr.bin/mkcsmapper_static/Makefile.depend20
-rw-r--r--usr.bin/mkdep/Makefile8
-rw-r--r--usr.bin/mkdep/Makefile.depend11
-rw-r--r--usr.bin/mkdep/mkdep.1129
-rw-r--r--usr.bin/mkdep/mkdep.gcc.sh96
-rw-r--r--usr.bin/mkdep/mkdep.sh109
-rw-r--r--usr.bin/mkesdb/Makefile10
-rw-r--r--usr.bin/mkesdb/Makefile.depend19
-rw-r--r--usr.bin/mkesdb/Makefile.inc5
-rw-r--r--usr.bin/mkesdb/ldef.h39
-rw-r--r--usr.bin/mkesdb/lex.l102
-rw-r--r--usr.bin/mkesdb/mkesdb.184
-rw-r--r--usr.bin/mkesdb/yacc.y332
-rw-r--r--usr.bin/mkesdb_static/Makefile17
-rw-r--r--usr.bin/mkesdb_static/Makefile.depend20
-rw-r--r--usr.bin/mkfifo/Makefile6
-rw-r--r--usr.bin/mkfifo/Makefile.depend18
-rw-r--r--usr.bin/mkfifo/mkfifo.198
-rw-r--r--usr.bin/mkfifo/mkfifo.c110
-rw-r--r--usr.bin/mkimg/Makefile42
-rw-r--r--usr.bin/mkimg/Makefile.depend19
-rw-r--r--usr.bin/mkimg/apm.c123
-rw-r--r--usr.bin/mkimg/bsd.c139
-rw-r--r--usr.bin/mkimg/ebr.c136
-rw-r--r--usr.bin/mkimg/format.c87
-rw-r--r--usr.bin/mkimg/format.h49
-rw-r--r--usr.bin/mkimg/gpt.c310
-rw-r--r--usr.bin/mkimg/image.c727
-rw-r--r--usr.bin/mkimg/image.h45
-rw-r--r--usr.bin/mkimg/mbr.c132
-rw-r--r--usr.bin/mkimg/mkimg.1331
-rw-r--r--usr.bin/mkimg/mkimg.c638
-rw-r--r--usr.bin/mkimg/mkimg.h95
-rw-r--r--usr.bin/mkimg/pc98.c130
-rw-r--r--usr.bin/mkimg/qcow.c370
-rw-r--r--usr.bin/mkimg/raw.c62
-rw-r--r--usr.bin/mkimg/scheme.c190
-rw-r--r--usr.bin/mkimg/scheme.h93
-rw-r--r--usr.bin/mkimg/tests/Makefile18
-rw-r--r--usr.bin/mkimg/tests/Makefile.depend11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.vhd.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-apm.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow.gz.uu125
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.raw.gz.uu10
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdf.gz.uu13
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-bsd.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-ebr.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu132
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu26
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu87
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-mbr.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow.gz.uu125
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.raw.gz.uu10
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.vhd.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-apm.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.qcow.gz.uu125
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.raw.gz.uu10
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.vhdf.gz.uu13
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-bsd.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-ebr.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu132
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu26
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu87
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-mbr.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu82
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow.gz.uu125
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.raw.gz.uu10
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-1x1-512-vtoc8.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-apm.vmdk.gz.uu83
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow.gz.uu126
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-bsd.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow.gz.uu128
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-ebr.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu132
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu26
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu88
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow.gz.uu128
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.vhd.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-mbr.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu126
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vmdk.gz.uu83
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-apm.vmdk.gz.uu83
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.qcow.gz.uu126
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.vhd.gz.uu17
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-bsd.vmdk.gz.uu81
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.qcow.gz.uu128
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-ebr.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu132
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu26
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu23
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu88
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.qcow.gz.uu128
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.vhd.gz.uu19
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-mbr.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu126
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu22
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu12
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu15
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu84
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow.gz.uu127
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow2.gz.uu21
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.raw.gz.uu11
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhd.gz.uu18
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdf.gz.uu14
-rw-r--r--usr.bin/mkimg/tests/img-63x255-512-vtoc8.vmdk.gz.uu83
-rwxr-xr-xusr.bin/mkimg/tests/mkimg.sh164
-rw-r--r--usr.bin/mkimg/vhd.c432
-rw-r--r--usr.bin/mkimg/vmdk.c261
-rw-r--r--usr.bin/mkimg/vtoc8.c118
-rw-r--r--usr.bin/mklocale/Makefile10
-rw-r--r--usr.bin/mklocale/Makefile.depend20
-rw-r--r--usr.bin/mklocale/extern.h35
-rw-r--r--usr.bin/mklocale/ldef.h53
-rw-r--r--usr.bin/mklocale/lex.l175
-rw-r--r--usr.bin/mklocale/mklocale.1311
-rw-r--r--usr.bin/mklocale/yacc.y869
-rw-r--r--usr.bin/mkstr/Makefile8
-rw-r--r--usr.bin/mkstr/Makefile.depend18
-rw-r--r--usr.bin/mkstr/mkstr.1136
-rw-r--r--usr.bin/mkstr/mkstr.c333
-rw-r--r--usr.bin/mktemp/Makefile5
-rw-r--r--usr.bin/mktemp/Makefile.depend18
-rw-r--r--usr.bin/mktemp/mktemp.1207
-rw-r--r--usr.bin/mktemp/mktemp.c156
-rw-r--r--usr.bin/mkuzip/Makefile12
-rw-r--r--usr.bin/mkuzip/Makefile.depend23
-rw-r--r--usr.bin/mkuzip/mkuz_blk.c45
-rw-r--r--usr.bin/mkuzip/mkuz_blk.h48
-rw-r--r--usr.bin/mkuzip/mkuz_blk_chain.h35
-rw-r--r--usr.bin/mkuzip/mkuz_blockcache.c148
-rw-r--r--usr.bin/mkuzip/mkuz_blockcache.h31
-rw-r--r--usr.bin/mkuzip/mkuz_cfg.h40
-rw-r--r--usr.bin/mkuzip/mkuz_cloop.h50
-rw-r--r--usr.bin/mkuzip/mkuz_conveyor.c129
-rw-r--r--usr.bin/mkuzip/mkuz_conveyor.h52
-rw-r--r--usr.bin/mkuzip/mkuz_format.h37
-rw-r--r--usr.bin/mkuzip/mkuz_fqueue.c214
-rw-r--r--usr.bin/mkuzip/mkuz_fqueue.h51
-rw-r--r--usr.bin/mkuzip/mkuz_lzma.c121
-rw-r--r--usr.bin/mkuzip/mkuz_lzma.h42
-rw-r--r--usr.bin/mkuzip/mkuz_time.c45
-rw-r--r--usr.bin/mkuzip/mkuz_time.h41
-rw-r--r--usr.bin/mkuzip/mkuz_zlib.c87
-rw-r--r--usr.bin/mkuzip/mkuz_zlib.h36
-rw-r--r--usr.bin/mkuzip/mkuzip.8185
-rw-r--r--usr.bin/mkuzip/mkuzip.c454
-rw-r--r--usr.bin/mkuzip/mkuzip.h33
-rw-r--r--usr.bin/morse/Makefile7
-rw-r--r--usr.bin/morse/Makefile.depend18
-rw-r--r--usr.bin/morse/morse.6197
-rw-r--r--usr.bin/morse/morse.c589
-rw-r--r--usr.bin/msgs/Makefile8
-rw-r--r--usr.bin/msgs/Makefile.depend19
-rw-r--r--usr.bin/msgs/msgs.1232
-rw-r--r--usr.bin/msgs/msgs.c911
-rw-r--r--usr.bin/msgs/pathnames.h38
-rw-r--r--usr.bin/mt/Makefile7
-rw-r--r--usr.bin/mt/Makefile.depend21
-rw-r--r--usr.bin/mt/mt.1626
-rw-r--r--usr.bin/mt/mt.c1597
-rw-r--r--usr.bin/nc/Makefile13
-rw-r--r--usr.bin/nc/Makefile.depend20
-rw-r--r--usr.bin/ncal/Makefile16
-rw-r--r--usr.bin/ncal/Makefile.depend20
-rw-r--r--usr.bin/ncal/ncal.1198
-rw-r--r--usr.bin/ncal/ncal.c1177
-rw-r--r--usr.bin/ncal/tests/Makefile98
-rw-r--r--usr.bin/ncal/tests/Makefile.depend11
-rw-r--r--usr.bin/ncal/tests/legacy_test.sh6
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200901-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200901-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200902-jd-nhl.out18
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200902-md-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200903-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200903-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200904-jd-nhl.out18
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200904-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200905-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200905-md-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200906-jd-nhl.out18
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200906-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200907-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200907-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200908-jd-nhl.out18
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200908-md-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200909-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200909-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200910-jd-nhl.out18
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200910-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200911-jd-nhl.out17
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200911-md-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200912-jd-nhl.out19
-rw-r--r--usr.bin/ncal/tests/regress.b-3m200912-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.b-y2008-jd-nhl.out54
-rw-r--r--usr.bin/ncal/tests/regress.b-y2008-md-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.b-y2009-jd-nhl.out54
-rw-r--r--usr.bin/ncal/tests/regress.b-y2009-md-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.b-y2010-jd-nhl.out54
-rw-r--r--usr.bin/ncal/tests/regress.b-y2010-md-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.b-y2011-jd-nhl.out54
-rw-r--r--usr.bin/ncal/tests/regress.b-y2011-md-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.f-3A-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-3AB-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-3B-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-3gy-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-3y-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-mgm-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-yA-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-yAB-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-yB-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-ygm-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.f-ym-nhl.out1
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200901-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200901-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200902-jd-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200902-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200903-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200903-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200904-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200904-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200905-jd-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200905-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200906-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200906-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200907-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200907-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200908-jd-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200908-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200909-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200909-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200910-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200910-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200911-jd-nhl.out9
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200911-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200912-jd-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-3m200912-md-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.r-y2008-jd-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.r-y2008-md-nhl.out27
-rw-r--r--usr.bin/ncal/tests/regress.r-y2009-jd-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.r-y2009-md-nhl.out27
-rw-r--r--usr.bin/ncal/tests/regress.r-y2010-jd-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.r-y2010-md-nhl.out27
-rw-r--r--usr.bin/ncal/tests/regress.r-y2011-jd-nhl.out36
-rw-r--r--usr.bin/ncal/tests/regress.r-y2011-md-nhl.out27
-rw-r--r--usr.bin/ncal/tests/regress.s-b-3-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-A-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-AB-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-B-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-gmgy-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-m-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-b-mgy-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-3-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-A-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-AB-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-B-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-gmgy-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-m-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.s-r-mgy-nhl.out8
-rw-r--r--usr.bin/ncal/tests/regress.sh80
-rw-r--r--usr.bin/netstat/Makefile66
-rw-r--r--usr.bin/netstat/Makefile.depend25
-rw-r--r--usr.bin/netstat/bpf.c169
-rw-r--r--usr.bin/netstat/flowtable.c88
-rw-r--r--usr.bin/netstat/if.c655
-rw-r--r--usr.bin/netstat/inet.c1482
-rw-r--r--usr.bin/netstat/inet6.c1348
-rw-r--r--usr.bin/netstat/ipsec.c455
-rw-r--r--usr.bin/netstat/main.c874
-rw-r--r--usr.bin/netstat/mbuf.c359
-rw-r--r--usr.bin/netstat/mroute.c454
-rw-r--r--usr.bin/netstat/mroute6.c278
-rw-r--r--usr.bin/netstat/netgraph.c144
-rw-r--r--usr.bin/netstat/netisr.c507
-rw-r--r--usr.bin/netstat/netstat.1828
-rw-r--r--usr.bin/netstat/netstat.h148
-rw-r--r--usr.bin/netstat/nlist_symbols55
-rw-r--r--usr.bin/netstat/pfkey.c208
-rw-r--r--usr.bin/netstat/route.c787
-rw-r--r--usr.bin/netstat/sctp.c919
-rw-r--r--usr.bin/netstat/unix.c331
-rw-r--r--usr.bin/newgrp/Makefile12
-rw-r--r--usr.bin/newgrp/Makefile.depend20
-rw-r--r--usr.bin/newgrp/newgrp.1104
-rw-r--r--usr.bin/newgrp/newgrp.c310
-rw-r--r--usr.bin/newkey/Makefile13
-rw-r--r--usr.bin/newkey/Makefile.depend23
-rw-r--r--usr.bin/newkey/extern.h47
-rw-r--r--usr.bin/newkey/generic.c132
-rw-r--r--usr.bin/newkey/newkey.859
-rw-r--r--usr.bin/newkey/newkey.c235
-rw-r--r--usr.bin/newkey/update.c332
-rw-r--r--usr.bin/nfsstat/Makefile7
-rw-r--r--usr.bin/nfsstat/Makefile.depend18
-rw-r--r--usr.bin/nfsstat/nfsstat.1116
-rw-r--r--usr.bin/nfsstat/nfsstat.c727
-rw-r--r--usr.bin/nice/Makefile6
-rw-r--r--usr.bin/nice/Makefile.depend18
-rw-r--r--usr.bin/nice/nice.1120
-rw-r--r--usr.bin/nice/nice.c111
-rw-r--r--usr.bin/nl/Makefile5
-rw-r--r--usr.bin/nl/Makefile.depend18
-rw-r--r--usr.bin/nl/nl.1249
-rw-r--r--usr.bin/nl/nl.c410
-rw-r--r--usr.bin/nm/Makefile16
-rw-r--r--usr.bin/nm/Makefile.depend21
-rw-r--r--usr.bin/nohup/Makefile6
-rw-r--r--usr.bin/nohup/Makefile.depend18
-rw-r--r--usr.bin/nohup/nohup.1120
-rw-r--r--usr.bin/nohup/nohup.c133
-rw-r--r--usr.bin/numactl/Makefile5
-rw-r--r--usr.bin/numactl/Makefile.depend18
-rw-r--r--usr.bin/numactl/numactl.1132
-rw-r--r--usr.bin/numactl/numactl.c285
-rw-r--r--usr.bin/number/Makefile7
-rw-r--r--usr.bin/number/Makefile.depend18
-rw-r--r--usr.bin/number/number.658
-rw-r--r--usr.bin/number/number.c285
-rw-r--r--usr.bin/opieinfo/Makefile21
-rw-r--r--usr.bin/opieinfo/Makefile.depend20
-rw-r--r--usr.bin/opiekey/Makefile23
-rw-r--r--usr.bin/opiekey/Makefile.depend20
-rw-r--r--usr.bin/opiepasswd/Makefile21
-rw-r--r--usr.bin/opiepasswd/Makefile.depend20
-rw-r--r--usr.bin/pagesize/Makefile7
-rw-r--r--usr.bin/pagesize/Makefile.depend11
-rw-r--r--usr.bin/pagesize/pagesize.154
-rw-r--r--usr.bin/pagesize/pagesize.sh36
-rw-r--r--usr.bin/pamtest/Makefile11
-rw-r--r--usr.bin/pamtest/Makefile.depend17
-rw-r--r--usr.bin/passwd/Makefile22
-rw-r--r--usr.bin/passwd/Makefile.depend18
-rw-r--r--usr.bin/passwd/passwd.1234
-rw-r--r--usr.bin/passwd/passwd.c164
-rw-r--r--usr.bin/paste/Makefile5
-rw-r--r--usr.bin/paste/Makefile.depend18
-rw-r--r--usr.bin/paste/paste.1146
-rw-r--r--usr.bin/paste/paste.c272
-rw-r--r--usr.bin/patch/Makefile8
-rw-r--r--usr.bin/patch/Makefile.depend18
-rw-r--r--usr.bin/patch/backupfile.c246
-rw-r--r--usr.bin/patch/backupfile.h39
-rw-r--r--usr.bin/patch/common.h112
-rw-r--r--usr.bin/patch/inp.c433
-rw-r--r--usr.bin/patch/inp.h32
-rw-r--r--usr.bin/patch/mkpath.c78
-rw-r--r--usr.bin/patch/patch.1690
-rw-r--r--usr.bin/patch/patch.c1082
-rw-r--r--usr.bin/patch/pathnames.h12
-rw-r--r--usr.bin/patch/pch.c1617
-rw-r--r--usr.bin/patch/pch.h56
-rw-r--r--usr.bin/patch/util.c422
-rw-r--r--usr.bin/patch/util.h51
-rw-r--r--usr.bin/pathchk/Makefile5
-rw-r--r--usr.bin/pathchk/Makefile.depend18
-rw-r--r--usr.bin/pathchk/pathchk.1131
-rw-r--r--usr.bin/pathchk/pathchk.c202
-rw-r--r--usr.bin/perror/Makefile5
-rw-r--r--usr.bin/perror/Makefile.depend18
-rw-r--r--usr.bin/perror/perror.150
-rw-r--r--usr.bin/perror/perror.c72
-rw-r--r--usr.bin/pom/Makefile8
-rw-r--r--usr.bin/pom/Makefile.depend19
-rw-r--r--usr.bin/pom/pom.666
-rw-r--r--usr.bin/pom/pom.c241
-rw-r--r--usr.bin/pr/Makefile7
-rw-r--r--usr.bin/pr/Makefile.depend18
-rw-r--r--usr.bin/pr/egetopt.c217
-rw-r--r--usr.bin/pr/extern.h63
-rw-r--r--usr.bin/pr/pr.1389
-rw-r--r--usr.bin/pr/pr.c1828
-rw-r--r--usr.bin/pr/pr.h74
-rw-r--r--usr.bin/primes/Makefile9
-rw-r--r--usr.bin/primes/Makefile.depend19
-rw-r--r--usr.bin/primes/pattern.c444
-rw-r--r--usr.bin/primes/pr_tbl.c548
-rw-r--r--usr.bin/primes/primes.c325
-rw-r--r--usr.bin/primes/primes.h77
-rw-r--r--usr.bin/primes/spsp.c181
-rw-r--r--usr.bin/printenv/Makefile6
-rw-r--r--usr.bin/printenv/Makefile.depend18
-rw-r--r--usr.bin/printenv/printenv.184
-rw-r--r--usr.bin/printenv/printenv.c99
-rw-r--r--usr.bin/printf/Makefile12
-rw-r--r--usr.bin/printf/Makefile.depend18
-rw-r--r--usr.bin/printf/printf.1382
-rw-r--r--usr.bin/printf/printf.c686
-rw-r--r--usr.bin/printf/tests/Makefile22
-rw-r--r--usr.bin/printf/tests/Makefile.depend11
-rw-r--r--usr.bin/printf/tests/legacy_test.sh6
-rw-r--r--usr.bin/printf/tests/regress.b.out1
-rw-r--r--usr.bin/printf/tests/regress.d.out1
-rw-r--r--usr.bin/printf/tests/regress.f.out1
-rw-r--r--usr.bin/printf/tests/regress.l1.out1
-rw-r--r--usr.bin/printf/tests/regress.l2.out1
-rw-r--r--usr.bin/printf/tests/regress.m1.outbin0 -> 7 bytes
-rw-r--r--usr.bin/printf/tests/regress.m2.out2
-rw-r--r--usr.bin/printf/tests/regress.m3.out4
-rw-r--r--usr.bin/printf/tests/regress.m4.out1
-rw-r--r--usr.bin/printf/tests/regress.m5.out1
-rw-r--r--usr.bin/printf/tests/regress.missingpos1.out1
-rw-r--r--usr.bin/printf/tests/regress.s.out1
-rw-r--r--usr.bin/printf/tests/regress.sh31
-rw-r--r--usr.bin/printf/tests/regress.zero.out1
-rw-r--r--usr.bin/procstat/Makefile22
-rw-r--r--usr.bin/procstat/Makefile.depend25
-rw-r--r--usr.bin/procstat/procstat.1562
-rw-r--r--usr.bin/procstat/procstat.c349
-rw-r--r--usr.bin/procstat/procstat.h59
-rw-r--r--usr.bin/procstat/procstat_args.c96
-rw-r--r--usr.bin/procstat/procstat_auxv.c189
-rw-r--r--usr.bin/procstat/procstat_basic.c68
-rw-r--r--usr.bin/procstat/procstat_bin.c64
-rw-r--r--usr.bin/procstat/procstat_cred.c103
-rw-r--r--usr.bin/procstat/procstat_cs.c119
-rw-r--r--usr.bin/procstat/procstat_files.c576
-rw-r--r--usr.bin/procstat/procstat_kstack.c246
-rw-r--r--usr.bin/procstat/procstat_rlimit.c127
-rw-r--r--usr.bin/procstat/procstat_rusage.c197
-rw-r--r--usr.bin/procstat/procstat_sigs.c180
-rw-r--r--usr.bin/procstat/procstat_threads.c134
-rw-r--r--usr.bin/procstat/procstat_vm.c164
-rw-r--r--usr.bin/protect/Makefile6
-rw-r--r--usr.bin/protect/Makefile.depend17
-rw-r--r--usr.bin/protect/protect.189
-rw-r--r--usr.bin/protect/protect.c122
-rw-r--r--usr.bin/quota/Makefile10
-rw-r--r--usr.bin/quota/Makefile.depend22
-rw-r--r--usr.bin/quota/quota.1176
-rw-r--r--usr.bin/quota/quota.c687
-rw-r--r--usr.bin/random/Makefile8
-rw-r--r--usr.bin/random/Makefile.depend18
-rw-r--r--usr.bin/random/random.6125
-rw-r--r--usr.bin/random/random.c194
-rw-r--r--usr.bin/random/randomize_fd.c248
-rw-r--r--usr.bin/random/randomize_fd.h51
-rw-r--r--usr.bin/rctl/Makefile8
-rw-r--r--usr.bin/rctl/Makefile.depend19
-rw-r--r--usr.bin/rctl/rctl.8322
-rw-r--r--usr.bin/rctl/rctl.c686
-rw-r--r--usr.bin/readelf/Makefile28
-rw-r--r--usr.bin/readelf/Makefile.depend21
-rw-r--r--usr.bin/renice/Makefile7
-rw-r--r--usr.bin/renice/Makefile.depend18
-rw-r--r--usr.bin/renice/renice.8134
-rw-r--r--usr.bin/renice/renice.c182
-rw-r--r--usr.bin/resizewin/Makefile6
-rw-r--r--usr.bin/resizewin/Makefile.depend18
-rw-r--r--usr.bin/resizewin/resizewin.164
-rw-r--r--usr.bin/resizewin/resizewin.c129
-rw-r--r--usr.bin/rev/Makefile6
-rw-r--r--usr.bin/rev/Makefile.depend18
-rw-r--r--usr.bin/rev/rev.145
-rw-r--r--usr.bin/rev/rev.c114
-rw-r--r--usr.bin/revoke/Makefile5
-rw-r--r--usr.bin/revoke/Makefile.depend17
-rw-r--r--usr.bin/revoke/revoke.156
-rw-r--r--usr.bin/revoke/revoke.c59
-rw-r--r--usr.bin/rlogin/Makefile11
-rw-r--r--usr.bin/rlogin/Makefile.depend18
-rw-r--r--usr.bin/rlogin/rlogin.1158
-rw-r--r--usr.bin/rlogin/rlogin.c722
-rw-r--r--usr.bin/rpcgen/Makefile7
-rw-r--r--usr.bin/rpcgen/Makefile.depend18
-rw-r--r--usr.bin/rpcgen/rpc_clntout.c278
-rw-r--r--usr.bin/rpcgen/rpc_cout.c719
-rw-r--r--usr.bin/rpcgen/rpc_hout.c523
-rw-r--r--usr.bin/rpcgen/rpc_main.c1267
-rw-r--r--usr.bin/rpcgen/rpc_parse.c639
-rw-r--r--usr.bin/rpcgen/rpc_parse.h200
-rw-r--r--usr.bin/rpcgen/rpc_sample.c294
-rw-r--r--usr.bin/rpcgen/rpc_scan.c497
-rw-r--r--usr.bin/rpcgen/rpc_scan.h136
-rw-r--r--usr.bin/rpcgen/rpc_svcout.c1020
-rw-r--r--usr.bin/rpcgen/rpc_tblout.c172
-rw-r--r--usr.bin/rpcgen/rpc_util.c511
-rw-r--r--usr.bin/rpcgen/rpc_util.h230
-rw-r--r--usr.bin/rpcgen/rpcgen.1536
-rw-r--r--usr.bin/rpcinfo/Makefile12
-rw-r--r--usr.bin/rpcinfo/Makefile.depend20
-rw-r--r--usr.bin/rpcinfo/rpcinfo.8341
-rw-r--r--usr.bin/rpcinfo/rpcinfo.c1675
-rw-r--r--usr.bin/rs/Makefile5
-rw-r--r--usr.bin/rs/Makefile.depend18
-rw-r--r--usr.bin/rs/rs.1247
-rw-r--r--usr.bin/rs/rs.c553
-rw-r--r--usr.bin/rsh/Makefile12
-rw-r--r--usr.bin/rsh/Makefile.depend19
-rw-r--r--usr.bin/rsh/rsh.1172
-rw-r--r--usr.bin/rsh/rsh.c376
-rw-r--r--usr.bin/rup/Makefile8
-rw-r--r--usr.bin/rup/Makefile.depend22
-rw-r--r--usr.bin/rup/rup.195
-rw-r--r--usr.bin/rup/rup.c254
-rw-r--r--usr.bin/ruptime/Makefile8
-rw-r--r--usr.bin/ruptime/Makefile.depend19
-rw-r--r--usr.bin/ruptime/ruptime.190
-rw-r--r--usr.bin/ruptime/ruptime.c295
-rw-r--r--usr.bin/rusers/Makefile7
-rw-r--r--usr.bin/rusers/Makefile.depend22
-rw-r--r--usr.bin/rusers/rusers.1104
-rw-r--r--usr.bin/rusers/rusers.c251
-rw-r--r--usr.bin/rwall/Makefile5
-rw-r--r--usr.bin/rwall/Makefile.depend20
-rw-r--r--usr.bin/rwall/rwall.179
-rw-r--r--usr.bin/rwall/rwall.c183
-rw-r--r--usr.bin/rwho/Makefile8
-rw-r--r--usr.bin/rwho/Makefile.depend19
-rw-r--r--usr.bin/rwho/rwho.180
-rw-r--r--usr.bin/rwho/rwho.c247
-rw-r--r--usr.bin/script/Makefile8
-rw-r--r--usr.bin/script/Makefile.depend19
-rw-r--r--usr.bin/script/script.1217
-rw-r--r--usr.bin/script/script.c507
-rw-r--r--usr.bin/sdiff/Makefile15
-rw-r--r--usr.bin/sdiff/Makefile.depend18
-rw-r--r--usr.bin/sdiff/common.c24
-rw-r--r--usr.bin/sdiff/common.h9
-rw-r--r--usr.bin/sdiff/edit.c205
-rw-r--r--usr.bin/sdiff/extern.h12
-rw-r--r--usr.bin/sdiff/sdiff.1174
-rw-r--r--usr.bin/sdiff/sdiff.c1189
-rw-r--r--usr.bin/sdiff/tests/Makefile35
-rw-r--r--usr.bin/sdiff/tests/d_dot.in1
-rw-r--r--usr.bin/sdiff/tests/d_flags_l.out102
-rw-r--r--usr.bin/sdiff/tests/d_flags_s.out79
-rw-r--r--usr.bin/sdiff/tests/d_flags_w.out102
-rw-r--r--usr.bin/sdiff/tests/d_iflags_a1.out100
-rw-r--r--usr.bin/sdiff/tests/d_iflags_a2.out96
-rw-r--r--usr.bin/sdiff/tests/d_iflags_b1.out69
-rw-r--r--usr.bin/sdiff/tests/d_iflags_b2.out65
-rw-r--r--usr.bin/sdiff/tests/d_iflags_c1.out99
-rw-r--r--usr.bin/sdiff/tests/d_iflags_c2.out94
-rw-r--r--usr.bin/sdiff/tests/d_iflags_d1.out69
-rw-r--r--usr.bin/sdiff/tests/d_iflags_d2.out65
-rw-r--r--usr.bin/sdiff/tests/d_input172
-rw-r--r--usr.bin/sdiff/tests/d_input269
-rw-r--r--usr.bin/sdiff/tests/d_oneline.in1
-rw-r--r--usr.bin/sdiff/tests/d_oneline_a.out1
-rw-r--r--usr.bin/sdiff/tests/d_oneline_b.out1
-rw-r--r--usr.bin/sdiff/tests/d_same.out72
-rw-r--r--usr.bin/sdiff/tests/d_short.out15
-rw-r--r--usr.bin/sdiff/tests/d_tabends.in17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_a.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_b.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_c.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabs.out102
-rw-r--r--usr.bin/sdiff/tests/d_tabs1.in72
-rw-r--r--usr.bin/sdiff/tests/d_tabs2.in69
-rwxr-xr-xusr.bin/sdiff/tests/sdiff.sh207
-rw-r--r--usr.bin/sed/Makefile15
-rw-r--r--usr.bin/sed/Makefile.depend18
-rw-r--r--usr.bin/sed/POSIX204
-rw-r--r--usr.bin/sed/compile.c949
-rw-r--r--usr.bin/sed/defs.h149
-rw-r--r--usr.bin/sed/extern.h56
-rw-r--r--usr.bin/sed/main.c537
-rw-r--r--usr.bin/sed/misc.c71
-rw-r--r--usr.bin/sed/process.c784
-rw-r--r--usr.bin/sed/sed.1638
-rw-r--r--usr.bin/sed/tests/Makefile38
-rw-r--r--usr.bin/sed/tests/Makefile.depend11
-rw-r--r--usr.bin/sed/tests/hanoi.sed103
-rw-r--r--usr.bin/sed/tests/inplace_race_test.sh79
-rw-r--r--usr.bin/sed/tests/legacy_test.sh6
-rw-r--r--usr.bin/sed/tests/math.sed439
-rw-r--r--usr.bin/sed/tests/multi_test.sh496
-rw-r--r--usr.bin/sed/tests/regress.G.out8
-rw-r--r--usr.bin/sed/tests/regress.P.out8
-rw-r--r--usr.bin/sed/tests/regress.b2a.out3
-rw-r--r--usr.bin/sed/tests/regress.bcb.out4
-rw-r--r--usr.bin/sed/tests/regress.c0.out4
-rw-r--r--usr.bin/sed/tests/regress.c1.out4
-rw-r--r--usr.bin/sed/tests/regress.c2.out3
-rw-r--r--usr.bin/sed/tests/regress.c3.out3
-rw-r--r--usr.bin/sed/tests/regress.hanoi.out17
-rw-r--r--usr.bin/sed/tests/regress.icase1.out3
-rw-r--r--usr.bin/sed/tests/regress.icase2.out4
-rw-r--r--usr.bin/sed/tests/regress.icase3.out4
-rw-r--r--usr.bin/sed/tests/regress.icase4.out4
-rw-r--r--usr.bin/sed/tests/regress.in4
-rw-r--r--usr.bin/sed/tests/regress.math.out1
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.128
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1014
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1114
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1342
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1442
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1542
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1656
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1728
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.1814
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.328
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.4.114
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.528
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.628
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.728
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.828
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/1.914
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.11
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.101
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.111
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.124
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.1323
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.1423
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.1520
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.1617
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.1717
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.187
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.191
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.21
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.201
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.215
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.223
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.232
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.31
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.41
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.50
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.61
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.70
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.80
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/2.91
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/3.114
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/3.214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/3.314
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/3.414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.147
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.254
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.356
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.51
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.61
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.71
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/4.80
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.117
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.312
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.55
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.65
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.76
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/5.814
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.114
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.213
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.30
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.420
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.514
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/6.60
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.115
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.232
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.324
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.423
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.514
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.614
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.72814
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/7.81
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.114
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1014
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1128
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1314
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1513
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.167
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1714
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1814
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.1914
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.214
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.2014
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.211
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.222
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.231
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.314
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.414
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.514
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.614
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.714
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.814
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/8.942
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.11
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.101
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.111
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.121
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.131
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.141
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.151
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.161
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.171
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.181
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.191
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.21
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.201
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.211
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.221
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.231
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.241
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.251
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.261
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.271
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.281
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.291
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.31
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.301
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.311
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.41
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.51
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.61
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.71
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.81
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/9.91
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/Makefile137
-rw-r--r--usr.bin/sed/tests/regress.multitest.out/Makefile.depend11
-rw-r--r--usr.bin/sed/tests/regress.not.out1
-rw-r--r--usr.bin/sed/tests/regress.psl.out4
-rw-r--r--usr.bin/sed/tests/regress.s3.out1
-rw-r--r--usr.bin/sed/tests/regress.s4.out1
-rw-r--r--usr.bin/sed/tests/regress.s5.out1
-rw-r--r--usr.bin/sed/tests/regress.sg.out1
-rw-r--r--usr.bin/sed/tests/regress.sh75
-rw-r--r--usr.bin/sed/tests/regress.y.out1
-rw-r--r--usr.bin/send-pr/Makefile5
-rw-r--r--usr.bin/send-pr/Makefile.depend11
-rwxr-xr-xusr.bin/send-pr/send-pr.sh11
-rw-r--r--usr.bin/seq/Makefile8
-rw-r--r--usr.bin/seq/Makefile.depend19
-rw-r--r--usr.bin/seq/seq.1188
-rw-r--r--usr.bin/seq/seq.c471
-rw-r--r--usr.bin/setchannel/Makefile5
-rw-r--r--usr.bin/setchannel/Makefile.depend16
-rw-r--r--usr.bin/setchannel/setchannel.1103
-rw-r--r--usr.bin/setchannel/setchannel.c285
-rw-r--r--usr.bin/shar/Makefile7
-rw-r--r--usr.bin/shar/Makefile.depend11
-rw-r--r--usr.bin/shar/shar.1107
-rw-r--r--usr.bin/shar/shar.sh80
-rw-r--r--usr.bin/showmount/Makefile7
-rw-r--r--usr.bin/showmount/Makefile.depend20
-rw-r--r--usr.bin/showmount/showmount.8109
-rw-r--r--usr.bin/showmount/showmount.c413
-rw-r--r--usr.bin/size/Makefile16
-rw-r--r--usr.bin/size/Makefile.depend20
-rw-r--r--usr.bin/smbutil/Makefile15
-rw-r--r--usr.bin/smbutil/Makefile.depend21
-rw-r--r--usr.bin/sockstat/Makefile5
-rw-r--r--usr.bin/sockstat/Makefile.depend19
-rw-r--r--usr.bin/sockstat/sockstat.1168
-rw-r--r--usr.bin/sockstat/sockstat.c1218
-rw-r--r--usr.bin/soelim/Makefile11
-rw-r--r--usr.bin/soelim/Makefile.depend18
-rw-r--r--usr.bin/soelim/soelim.191
-rw-r--r--usr.bin/soelim/soelim.c178
-rw-r--r--usr.bin/soelim/tests/Makefile14
-rw-r--r--usr.bin/soelim/tests/Makefile.depend11
-rw-r--r--usr.bin/soelim/tests/basic1
-rw-r--r--usr.bin/soelim/tests/basic-with-space.in3
-rw-r--r--usr.bin/soelim/tests/basic-with-space.out4
-rw-r--r--usr.bin/soelim/tests/basic.in3
-rw-r--r--usr.bin/soelim/tests/basic.out3
-rw-r--r--usr.bin/soelim/tests/nonexisting.in3
-rwxr-xr-xusr.bin/soelim/tests/soelim.sh103
-rw-r--r--usr.bin/sort/Makefile35
-rw-r--r--usr.bin/sort/Makefile.depend20
-rw-r--r--usr.bin/sort/bwstring.c1149
-rw-r--r--usr.bin/sort/bwstring.h142
-rw-r--r--usr.bin/sort/coll.c1302
-rw-r--r--usr.bin/sort/coll.h167
-rw-r--r--usr.bin/sort/file.c1597
-rw-r--r--usr.bin/sort/file.h126
-rw-r--r--usr.bin/sort/mem.c81
-rw-r--r--usr.bin/sort/mem.h45
-rw-r--r--usr.bin/sort/nls/C.msg16
-rw-r--r--usr.bin/sort/nls/hu_HU.ISO8859-2.msg16
-rw-r--r--usr.bin/sort/radixsort.c691
-rw-r--r--usr.bin/sort/radixsort.h38
-rw-r--r--usr.bin/sort/sort.1.in637
-rw-r--r--usr.bin/sort/sort.c1321
-rw-r--r--usr.bin/sort/sort.h128
-rw-r--r--usr.bin/sort/vsort.c265
-rw-r--r--usr.bin/sort/vsort.h37
-rw-r--r--usr.bin/split/Makefile8
-rw-r--r--usr.bin/split/Makefile.depend19
-rw-r--r--usr.bin/split/split.1181
-rw-r--r--usr.bin/split/split.c402
-rw-r--r--usr.bin/ssh-copy-id/Makefile7
-rw-r--r--usr.bin/ssh-copy-id/Makefile.depend11
-rw-r--r--usr.bin/ssh-copy-id/ssh-copy-id.190
-rwxr-xr-xusr.bin/ssh-copy-id/ssh-copy-id.sh117
-rw-r--r--usr.bin/stat/Makefile8
-rw-r--r--usr.bin/stat/Makefile.depend18
-rw-r--r--usr.bin/stat/stat.1606
-rw-r--r--usr.bin/stat/stat.c1098
-rw-r--r--usr.bin/stdbuf/Makefile6
-rw-r--r--usr.bin/stdbuf/Makefile.depend17
-rw-r--r--usr.bin/stdbuf/stdbuf.1116
-rw-r--r--usr.bin/stdbuf/stdbuf.c110
-rw-r--r--usr.bin/strings/Makefile15
-rw-r--r--usr.bin/strings/Makefile.depend20
-rw-r--r--usr.bin/su/Makefile21
-rw-r--r--usr.bin/su/Makefile.depend21
-rw-r--r--usr.bin/su/su.1250
-rw-r--r--usr.bin/su/su.c642
-rw-r--r--usr.bin/svn/Makefile8
-rw-r--r--usr.bin/svn/Makefile.inc62
-rw-r--r--usr.bin/svn/expat.h4
-rw-r--r--usr.bin/svn/lib/Makefile9
-rw-r--r--usr.bin/svn/lib/Makefile.inc17
-rw-r--r--usr.bin/svn/lib/libapr/Makefile34
-rw-r--r--usr.bin/svn/lib/libapr/Makefile.depend15
-rw-r--r--usr.bin/svn/lib/libapr/apr.h660
-rw-r--r--usr.bin/svn/lib/libapr/apr_private.h1005
-rw-r--r--usr.bin/svn/lib/libapr_util/Makefile38
-rw-r--r--usr.bin/svn/lib/libapr_util/Makefile.depend14
-rw-r--r--usr.bin/svn/lib/libapr_util/apr_ldap.h198
-rw-r--r--usr.bin/svn/lib/libapr_util/apu.h131
-rw-r--r--usr.bin/svn/lib/libapr_util/apu_config.h179
-rw-r--r--usr.bin/svn/lib/libapr_util/apu_select_dbm.h30
-rw-r--r--usr.bin/svn/lib/libapr_util/apu_want.h53
-rw-r--r--usr.bin/svn/lib/libapr_util/expat.h3
-rw-r--r--usr.bin/svn/lib/libserf/Makefile25
-rw-r--r--usr.bin/svn/lib/libserf/Makefile.depend16
-rw-r--r--usr.bin/svn/lib/libsvn_client/Makefile27
-rw-r--r--usr.bin/svn/lib/libsvn_client/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_delta/Makefile22
-rw-r--r--usr.bin/svn/lib/libsvn_delta/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_diff/Makefile23
-rw-r--r--usr.bin/svn/lib/libsvn_diff/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_fs/Makefile20
-rw-r--r--usr.bin/svn/lib/libsvn_fs/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_fs_fs/Makefile24
-rw-r--r--usr.bin/svn/lib/libsvn_fs_fs/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_fs_util/Makefile20
-rw-r--r--usr.bin/svn/lib/libsvn_fs_util/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_fs_x/Makefile24
-rw-r--r--usr.bin/svn/lib/libsvn_fs_x/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_ra/Makefile21
-rw-r--r--usr.bin/svn/lib/libsvn_ra/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_ra_local/Makefile20
-rw-r--r--usr.bin/svn/lib/libsvn_ra_local/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_ra_serf/Makefile26
-rw-r--r--usr.bin/svn/lib/libsvn_ra_serf/Makefile.depend14
-rw-r--r--usr.bin/svn/lib/libsvn_ra_svn/Makefile21
-rw-r--r--usr.bin/svn/lib/libsvn_ra_svn/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_repos/Makefile23
-rw-r--r--usr.bin/svn/lib/libsvn_repos/Makefile.depend13
-rw-r--r--usr.bin/svn/lib/libsvn_subr/Makefile40
-rw-r--r--usr.bin/svn/lib/libsvn_subr/Makefile.depend17
-rw-r--r--usr.bin/svn/lib/libsvn_wc/Makefile28
-rw-r--r--usr.bin/svn/lib/libsvn_wc/Makefile.depend13
-rw-r--r--usr.bin/svn/svn/Makefile67
-rw-r--r--usr.bin/svn/svn/Makefile.depend42
-rw-r--r--usr.bin/svn/svn_private_config.h295
-rw-r--r--usr.bin/svn/svnadmin/Makefile36
-rw-r--r--usr.bin/svn/svnadmin/Makefile.depend31
-rw-r--r--usr.bin/svn/svnbench/Makefile48
-rw-r--r--usr.bin/svn/svnbench/Makefile.depend42
-rw-r--r--usr.bin/svn/svndumpfilter/Makefile36
-rw-r--r--usr.bin/svn/svndumpfilter/Makefile.depend32
-rw-r--r--usr.bin/svn/svnfsfs/Makefile36
-rw-r--r--usr.bin/svn/svnfsfs/Makefile.depend32
-rw-r--r--usr.bin/svn/svnlook/Makefile37
-rw-r--r--usr.bin/svn/svnlook/Makefile.depend32
-rw-r--r--usr.bin/svn/svnmucc/Makefile45
-rw-r--r--usr.bin/svn/svnmucc/Makefile.depend41
-rw-r--r--usr.bin/svn/svnrdump/Makefile46
-rw-r--r--usr.bin/svn/svnrdump/Makefile.depend41
-rw-r--r--usr.bin/svn/svnserve/Makefile42
-rw-r--r--usr.bin/svn/svnserve/Makefile.depend36
-rw-r--r--usr.bin/svn/svnsync/Makefile42
-rw-r--r--usr.bin/svn/svnsync/Makefile.depend38
-rw-r--r--usr.bin/svn/svnversion/Makefile32
-rw-r--r--usr.bin/svn/svnversion/Makefile.depend28
-rw-r--r--usr.bin/systat/Makefile21
-rw-r--r--usr.bin/systat/Makefile.depend24
-rw-r--r--usr.bin/systat/cmds.c196
-rw-r--r--usr.bin/systat/cmdtab.c86
-rw-r--r--usr.bin/systat/convtbl.c150
-rw-r--r--usr.bin/systat/convtbl.h59
-rw-r--r--usr.bin/systat/devs.c321
-rw-r--r--usr.bin/systat/devs.h30
-rw-r--r--usr.bin/systat/extern.h177
-rw-r--r--usr.bin/systat/fetch.c138
-rw-r--r--usr.bin/systat/icmp.c279
-rw-r--r--usr.bin/systat/icmp6.c278
-rw-r--r--usr.bin/systat/ifcmds.c77
-rw-r--r--usr.bin/systat/ifstat.c496
-rw-r--r--usr.bin/systat/iostat.c395
-rw-r--r--usr.bin/systat/ip.c339
-rw-r--r--usr.bin/systat/ip6.c300
-rw-r--r--usr.bin/systat/keyboard.c180
-rw-r--r--usr.bin/systat/main.c380
-rw-r--r--usr.bin/systat/mode.c99
-rw-r--r--usr.bin/systat/mode.h44
-rw-r--r--usr.bin/systat/netcmds.c308
-rw-r--r--usr.bin/systat/netstat.c657
-rw-r--r--usr.bin/systat/pigs.c193
-rw-r--r--usr.bin/systat/sctp.c362
-rw-r--r--usr.bin/systat/swap.c218
-rw-r--r--usr.bin/systat/systat.1683
-rw-r--r--usr.bin/systat/systat.h68
-rw-r--r--usr.bin/systat/tcp.c326
-rw-r--r--usr.bin/systat/vmstat.c896
-rw-r--r--usr.bin/systat/zarc.c221
-rw-r--r--usr.bin/tabs/Makefile7
-rw-r--r--usr.bin/tabs/Makefile.depend19
-rw-r--r--usr.bin/tabs/tabs.1160
-rw-r--r--usr.bin/tabs/tabs.c237
-rw-r--r--usr.bin/tail/Makefile7
-rw-r--r--usr.bin/tail/Makefile.depend18
-rw-r--r--usr.bin/tail/extern.h72
-rw-r--r--usr.bin/tail/forward.c423
-rw-r--r--usr.bin/tail/misc.c129
-rw-r--r--usr.bin/tail/read.c209
-rw-r--r--usr.bin/tail/reverse.c284
-rw-r--r--usr.bin/tail/tail.1202
-rw-r--r--usr.bin/tail/tail.c336
-rw-r--r--usr.bin/talk/Makefile10
-rw-r--r--usr.bin/talk/Makefile.depend21
-rw-r--r--usr.bin/talk/ctl.c122
-rw-r--r--usr.bin/talk/ctl_transact.c105
-rw-r--r--usr.bin/talk/display.c210
-rw-r--r--usr.bin/talk/get_addrs.c65
-rw-r--r--usr.bin/talk/get_iface.c100
-rw-r--r--usr.bin/talk/get_names.c115
-rw-r--r--usr.bin/talk/init_disp.c233
-rw-r--r--usr.bin/talk/invite.c196
-rw-r--r--usr.bin/talk/io.c177
-rw-r--r--usr.bin/talk/look_up.c121
-rw-r--r--usr.bin/talk/msgs.c80
-rw-r--r--usr.bin/talk/talk.1159
-rw-r--r--usr.bin/talk/talk.c82
-rw-r--r--usr.bin/talk/talk.h94
-rw-r--r--usr.bin/talk/talk_ctl.h41
-rw-r--r--usr.bin/tar/Makefile40
-rw-r--r--usr.bin/tar/Makefile.depend25
-rw-r--r--usr.bin/tar/tests/Makefile116
-rw-r--r--usr.bin/tar/tests/Makefile.depend19
-rwxr-xr-xusr.bin/tar/tests/functional_test.sh51
-rw-r--r--usr.bin/tcopy/Makefile6
-rw-r--r--usr.bin/tcopy/Makefile.depend18
-rw-r--r--usr.bin/tcopy/tcopy.1125
-rw-r--r--usr.bin/tcopy/tcopy.c337
-rw-r--r--usr.bin/tee/Makefile6
-rw-r--r--usr.bin/tee/Makefile.depend18
-rw-r--r--usr.bin/tee/tee.182
-rw-r--r--usr.bin/tee/tee.c139
-rw-r--r--usr.bin/telnet/Makefile44
-rw-r--r--usr.bin/telnet/Makefile.depend35
-rw-r--r--usr.bin/tests/Makefile10
-rw-r--r--usr.bin/tests/Makefile.depend11
-rw-r--r--usr.bin/tests/regress.m459
-rw-r--r--usr.bin/tftp/Makefile13
-rw-r--r--usr.bin/tftp/Makefile.depend21
-rw-r--r--usr.bin/tftp/main.c1053
-rw-r--r--usr.bin/tftp/tftp.1272
-rw-r--r--usr.bin/tftp/tftp.c270
-rw-r--r--usr.bin/tftp/tftp.h38
-rw-r--r--usr.bin/time/Makefile6
-rw-r--r--usr.bin/time/Makefile.depend18
-rw-r--r--usr.bin/time/time.1145
-rw-r--r--usr.bin/time/time.c307
-rw-r--r--usr.bin/timeout/Makefile11
-rw-r--r--usr.bin/timeout/Makefile.depend18
-rw-r--r--usr.bin/timeout/tests/Makefile5
-rw-r--r--usr.bin/timeout/tests/Makefile.depend11
-rw-r--r--usr.bin/timeout/tests/timeout.sh215
-rw-r--r--usr.bin/timeout/timeout.1129
-rw-r--r--usr.bin/timeout/timeout.c362
-rw-r--r--usr.bin/tip/Makefile5
-rw-r--r--usr.bin/tip/Makefile.inc3
-rw-r--r--usr.bin/tip/README63
-rw-r--r--usr.bin/tip/TODO20
-rw-r--r--usr.bin/tip/libacu/biz22.c187
-rw-r--r--usr.bin/tip/libacu/biz31.c254
-rw-r--r--usr.bin/tip/libacu/courier.c354
-rw-r--r--usr.bin/tip/libacu/df.c137
-rw-r--r--usr.bin/tip/libacu/dn11.c149
-rw-r--r--usr.bin/tip/libacu/hayes.c320
-rw-r--r--usr.bin/tip/libacu/t3000.c372
-rw-r--r--usr.bin/tip/libacu/v3451.c212
-rw-r--r--usr.bin/tip/libacu/v831.c263
-rw-r--r--usr.bin/tip/libacu/ventel.c259
-rw-r--r--usr.bin/tip/tip/Makefile57
-rw-r--r--usr.bin/tip/tip/Makefile.depend18
-rw-r--r--usr.bin/tip/tip/acu.c195
-rw-r--r--usr.bin/tip/tip/acutab.c89
-rw-r--r--usr.bin/tip/tip/cmds.c999
-rw-r--r--usr.bin/tip/tip/cmdtab.c66
-rw-r--r--usr.bin/tip/tip/cu.1506
-rw-r--r--usr.bin/tip/tip/cu.c210
-rw-r--r--usr.bin/tip/tip/hunt.c109
-rw-r--r--usr.bin/tip/tip/log.c92
-rw-r--r--usr.bin/tip/tip/partab.c63
-rw-r--r--usr.bin/tip/tip/pathnames.h41
-rw-r--r--usr.bin/tip/tip/remote.c242
-rw-r--r--usr.bin/tip/tip/tip.1603
-rw-r--r--usr.bin/tip/tip/tip.c627
-rw-r--r--usr.bin/tip/tip/tip.h354
-rw-r--r--usr.bin/tip/tip/tipout.c188
-rw-r--r--usr.bin/tip/tip/uucplock.c131
-rw-r--r--usr.bin/tip/tip/value.c349
-rw-r--r--usr.bin/tip/tip/vars.c124
-rw-r--r--usr.bin/top/Makefile49
-rw-r--r--usr.bin/top/Makefile.depend23
-rw-r--r--usr.bin/top/machine.c1602
-rw-r--r--usr.bin/top/top.local.175
-rw-r--r--usr.bin/touch/Makefile6
-rw-r--r--usr.bin/touch/Makefile.depend18
-rw-r--r--usr.bin/touch/touch.1252
-rw-r--r--usr.bin/touch/touch.c404
-rw-r--r--usr.bin/tput/Makefile9
-rw-r--r--usr.bin/tput/Makefile.depend19
-rw-r--r--usr.bin/tput/clear.sh35
-rw-r--r--usr.bin/tput/tput.1154
-rw-r--r--usr.bin/tput/tput.c212
-rw-r--r--usr.bin/tr/Makefile13
-rw-r--r--usr.bin/tr/Makefile.depend18
-rw-r--r--usr.bin/tr/cmap.c212
-rw-r--r--usr.bin/tr/cmap.h83
-rw-r--r--usr.bin/tr/cset.c290
-rw-r--r--usr.bin/tr/cset.h74
-rw-r--r--usr.bin/tr/extern.h51
-rw-r--r--usr.bin/tr/str.c387
-rw-r--r--usr.bin/tr/tests/Makefile25
-rw-r--r--usr.bin/tr/tests/Makefile.depend11
-rw-r--r--usr.bin/tr/tests/legacy_test.sh6
-rw-r--r--usr.bin/tr/tests/regress.00.out4
-rw-r--r--usr.bin/tr/tests/regress.01.out4
-rw-r--r--usr.bin/tr/tests/regress.02.out4
-rw-r--r--usr.bin/tr/tests/regress.03.out4
-rw-r--r--usr.bin/tr/tests/regress.04.out4
-rw-r--r--usr.bin/tr/tests/regress.05.out4
-rw-r--r--usr.bin/tr/tests/regress.06.out9
-rw-r--r--usr.bin/tr/tests/regress.07.out9
-rw-r--r--usr.bin/tr/tests/regress.08.out9
-rw-r--r--usr.bin/tr/tests/regress.09.out1
-rw-r--r--usr.bin/tr/tests/regress.0a.out1
-rw-r--r--usr.bin/tr/tests/regress.0b.out1
-rw-r--r--usr.bin/tr/tests/regress.0c.out1
-rw-r--r--usr.bin/tr/tests/regress.0d.out1
-rw-r--r--usr.bin/tr/tests/regress.in4
-rw-r--r--usr.bin/tr/tests/regress.sh22
-rw-r--r--usr.bin/tr/tests/regress2.in9
-rw-r--r--usr.bin/tr/tr.1421
-rw-r--r--usr.bin/tr/tr.c373
-rw-r--r--usr.bin/true/Makefile6
-rw-r--r--usr.bin/true/Makefile.depend16
-rw-r--r--usr.bin/true/true.163
-rw-r--r--usr.bin/true/true.c46
-rw-r--r--usr.bin/truncate/Makefile12
-rw-r--r--usr.bin/truncate/Makefile.depend19
-rw-r--r--usr.bin/truncate/tests/Makefile5
-rw-r--r--usr.bin/truncate/tests/Makefile.depend11
-rw-r--r--usr.bin/truncate/tests/truncate_test.sh399
-rw-r--r--usr.bin/truncate/truncate.1152
-rw-r--r--usr.bin/truncate/truncate.c162
-rw-r--r--usr.bin/truss/Makefile42
-rw-r--r--usr.bin/truss/Makefile.depend20
-rw-r--r--usr.bin/truss/aarch64-cloudabi64.c85
-rw-r--r--usr.bin/truss/aarch64-freebsd.c107
-rw-r--r--usr.bin/truss/amd64-cloudabi64.c94
-rw-r--r--usr.bin/truss/amd64-freebsd.c129
-rw-r--r--usr.bin/truss/amd64-freebsd32.c134
-rw-r--r--usr.bin/truss/amd64-linux.c104
-rw-r--r--usr.bin/truss/amd64-linux32.c114
-rw-r--r--usr.bin/truss/arm-freebsd.c136
-rw-r--r--usr.bin/truss/extern.h40
-rw-r--r--usr.bin/truss/i386-freebsd.c128
-rw-r--r--usr.bin/truss/i386-linux.c111
-rw-r--r--usr.bin/truss/main.c215
-rwxr-xr-xusr.bin/truss/makesyscallsconf.sh21
-rw-r--r--usr.bin/truss/mips-freebsd.c139
-rw-r--r--usr.bin/truss/powerpc-freebsd.c120
-rw-r--r--usr.bin/truss/powerpc64-freebsd.c116
-rw-r--r--usr.bin/truss/powerpc64-freebsd32.c125
-rw-r--r--usr.bin/truss/setup.c688
-rw-r--r--usr.bin/truss/sparc64-freebsd.c123
-rw-r--r--usr.bin/truss/syscall.h123
-rw-r--r--usr.bin/truss/syscalls.c2114
-rw-r--r--usr.bin/truss/truss.1114
-rw-r--r--usr.bin/truss/truss.h124
-rw-r--r--usr.bin/tset/Makefile11
-rw-r--r--usr.bin/tset/Makefile.depend19
-rw-r--r--usr.bin/tset/extern.h49
-rw-r--r--usr.bin/tset/map.c251
-rw-r--r--usr.bin/tset/misc.c66
-rw-r--r--usr.bin/tset/set.c322
-rw-r--r--usr.bin/tset/term.c156
-rw-r--r--usr.bin/tset/tset.1421
-rw-r--r--usr.bin/tset/tset.c297
-rw-r--r--usr.bin/tset/wrterm.c114
-rw-r--r--usr.bin/tsort/Makefile6
-rw-r--r--usr.bin/tsort/Makefile.depend18
-rw-r--r--usr.bin/tsort/tsort.193
-rw-r--r--usr.bin/tsort/tsort.c428
-rw-r--r--usr.bin/tty/Makefile6
-rw-r--r--usr.bin/tty/Makefile.depend17
-rw-r--r--usr.bin/tty/tty.183
-rw-r--r--usr.bin/tty/tty.c79
-rw-r--r--usr.bin/ul/Makefile8
-rw-r--r--usr.bin/ul/Makefile.depend19
-rw-r--r--usr.bin/ul/ul.1102
-rw-r--r--usr.bin/ul/ul.c561
-rw-r--r--usr.bin/uname/Makefile5
-rw-r--r--usr.bin/uname/Makefile.depend17
-rw-r--r--usr.bin/uname/uname.1131
-rw-r--r--usr.bin/uname/uname.c285
-rw-r--r--usr.bin/unexpand/Makefile7
-rw-r--r--usr.bin/unexpand/Makefile.depend18
-rw-r--r--usr.bin/unexpand/unexpand.c227
-rw-r--r--usr.bin/unifdef/Makefile8
-rw-r--r--usr.bin/unifdef/Makefile.depend18
-rw-r--r--usr.bin/unifdef/unifdef.1517
-rw-r--r--usr.bin/unifdef/unifdef.c1662
-rw-r--r--usr.bin/unifdef/unifdef.h52
-rw-r--r--usr.bin/unifdef/unifdefall.sh60
-rw-r--r--usr.bin/uniq/Makefile6
-rw-r--r--usr.bin/uniq/Makefile.depend18
-rw-r--r--usr.bin/uniq/uniq.1151
-rw-r--r--usr.bin/uniq/uniq.c357
-rw-r--r--usr.bin/units/Makefile15
-rw-r--r--usr.bin/units/Makefile.depend20
-rw-r--r--usr.bin/units/README18
-rw-r--r--usr.bin/units/definitions.units908
-rw-r--r--usr.bin/units/tests/Makefile7
-rw-r--r--usr.bin/units/tests/Makefile.depend11
-rw-r--r--usr.bin/units/tests/basics_test.sh22
-rw-r--r--usr.bin/units/units.1205
-rw-r--r--usr.bin/units/units.c886
-rw-r--r--usr.bin/unvis/Makefile8
-rw-r--r--usr.bin/unvis/Makefile.depend17
-rw-r--r--usr.bin/unzip/Makefile7
-rw-r--r--usr.bin/unzip/Makefile.depend25
-rw-r--r--usr.bin/unzip/unzip.1191
-rw-r--r--usr.bin/unzip/unzip.c1064
-rw-r--r--usr.bin/usbhidaction/Makefile8
-rw-r--r--usr.bin/usbhidaction/Makefile.depend19
-rw-r--r--usr.bin/usbhidaction/usbhidaction.1174
-rw-r--r--usr.bin/usbhidaction/usbhidaction.c518
-rw-r--r--usr.bin/usbhidctl/Makefile9
-rw-r--r--usr.bin/usbhidctl/Makefile.depend19
-rw-r--r--usr.bin/usbhidctl/usbhid.c531
-rw-r--r--usr.bin/usbhidctl/usbhidctl.1151
-rw-r--r--usr.bin/users/Makefile8
-rw-r--r--usr.bin/users/Makefile.depend21
-rw-r--r--usr.bin/users/users.157
-rw-r--r--usr.bin/users/users.cc65
-rw-r--r--usr.bin/uudecode/Makefile14
-rw-r--r--usr.bin/uudecode/Makefile.depend19
-rw-r--r--usr.bin/uudecode/tests/Makefile12
-rw-r--r--usr.bin/uudecode/tests/Makefile.depend11
-rw-r--r--usr.bin/uudecode/tests/legacy_test.sh6
-rw-r--r--usr.bin/uudecode/tests/regress.base64.in88
-rw-r--r--usr.bin/uudecode/tests/regress.outbin0 -> 4096 bytes
-rw-r--r--usr.bin/uudecode/tests/regress.sh10
-rw-r--r--usr.bin/uudecode/tests/regress.traditional.in95
-rw-r--r--usr.bin/uudecode/uudecode.c466
-rw-r--r--usr.bin/uuencode/Makefile18
-rw-r--r--usr.bin/uuencode/Makefile.depend19
-rw-r--r--usr.bin/uuencode/tests/Makefile12
-rw-r--r--usr.bin/uuencode/tests/Makefile.depend11
-rw-r--r--usr.bin/uuencode/tests/legacy_test.sh6
-rw-r--r--usr.bin/uuencode/tests/regress.base64.out74
-rw-r--r--usr.bin/uuencode/tests/regress.inbin0 -> 4096 bytes
-rw-r--r--usr.bin/uuencode/tests/regress.sh10
-rw-r--r--usr.bin/uuencode/tests/regress.traditional.out95
-rw-r--r--usr.bin/uuencode/uuencode.1221
-rw-r--r--usr.bin/uuencode/uuencode.c230
-rw-r--r--usr.bin/uuencode/uuencode.format.5102
-rw-r--r--usr.bin/vacation/Makefile28
-rw-r--r--usr.bin/vacation/Makefile.depend21
-rw-r--r--usr.bin/vgrind/Makefile33
-rw-r--r--usr.bin/vgrind/Makefile.depend18
-rw-r--r--usr.bin/vgrind/extern.h60
-rw-r--r--usr.bin/vgrind/pathnames.h34
-rw-r--r--usr.bin/vgrind/regexp.c596
-rw-r--r--usr.bin/vgrind/tmac.vgrind72
-rw-r--r--usr.bin/vgrind/vfontedpr.c716
-rw-r--r--usr.bin/vgrind/vgrind.1242
-rw-r--r--usr.bin/vgrind/vgrind.sh131
-rw-r--r--usr.bin/vgrind/vgrindefs.5170
-rw-r--r--usr.bin/vgrind/vgrindefs.src157
-rw-r--r--usr.bin/vi/Makefile77
-rw-r--r--usr.bin/vi/Makefile.depend21
-rw-r--r--usr.bin/vi/catalog/Makefile166
-rw-r--r--usr.bin/vi/catalog/Makefile.depend11
-rw-r--r--usr.bin/vi/catalog/dutch.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/french.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/german.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/polish.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/ru_RU.UTF-8.base311
-rw-r--r--usr.bin/vi/catalog/spanish.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/swedish.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/uk_UA.UTF-8.base306
-rw-r--r--usr.bin/vi/catalog/zh_CN.UTF-8.base311
-rw-r--r--usr.bin/vi/config.h23
-rw-r--r--usr.bin/vi/pathnames.h29
-rw-r--r--usr.bin/vis/Makefile10
-rw-r--r--usr.bin/vis/Makefile.depend18
-rw-r--r--usr.bin/vmstat/Makefile10
-rw-r--r--usr.bin/vmstat/Makefile.depend24
-rw-r--r--usr.bin/vmstat/vmstat.8388
-rw-r--r--usr.bin/vmstat/vmstat.c1729
-rw-r--r--usr.bin/vtfontcvt/Makefile6
-rw-r--r--usr.bin/vtfontcvt/Makefile.depend18
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.874
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.c594
-rw-r--r--usr.bin/w/Makefile12
-rw-r--r--usr.bin/w/Makefile.depend24
-rw-r--r--usr.bin/w/extern.h38
-rw-r--r--usr.bin/w/pr_time.c130
-rw-r--r--usr.bin/w/proc_compare.c121
-rw-r--r--usr.bin/w/uptime.157
-rw-r--r--usr.bin/w/w.1154
-rw-r--r--usr.bin/w/w.c559
-rw-r--r--usr.bin/wall/Makefile9
-rw-r--r--usr.bin/wall/Makefile.depend18
-rw-r--r--usr.bin/wall/ttymsg.c167
-rw-r--r--usr.bin/wall/ttymsg.h3
-rw-r--r--usr.bin/wall/wall.175
-rw-r--r--usr.bin/wall/wall.c292
-rw-r--r--usr.bin/wc/Makefile7
-rw-r--r--usr.bin/wc/Makefile.depend20
-rw-r--r--usr.bin/wc/wc.1197
-rw-r--r--usr.bin/wc/wc.c348
-rw-r--r--usr.bin/what/Makefile6
-rw-r--r--usr.bin/what/Makefile.depend17
-rw-r--r--usr.bin/what/what.189
-rw-r--r--usr.bin/what/what.c137
-rw-r--r--usr.bin/whereis/Makefile5
-rw-r--r--usr.bin/whereis/Makefile.depend18
-rw-r--r--usr.bin/whereis/pathnames.h55
-rw-r--r--usr.bin/whereis/whereis.1185
-rw-r--r--usr.bin/whereis/whereis.c691
-rw-r--r--usr.bin/which/Makefile6
-rw-r--r--usr.bin/which/Makefile.depend18
-rw-r--r--usr.bin/which/which.185
-rw-r--r--usr.bin/which/which.c146
-rw-r--r--usr.bin/who/Makefile6
-rw-r--r--usr.bin/who/Makefile.depend18
-rw-r--r--usr.bin/who/who.1157
-rw-r--r--usr.bin/who/who.c313
-rw-r--r--usr.bin/whois/Makefile13
-rw-r--r--usr.bin/whois/Makefile.depend19
-rw-r--r--usr.bin/whois/whois.1287
-rw-r--r--usr.bin/whois/whois.c527
-rw-r--r--usr.bin/write/Makefile8
-rw-r--r--usr.bin/write/Makefile.depend18
-rw-r--r--usr.bin/write/write.1109
-rw-r--r--usr.bin/write/write.c311
-rw-r--r--usr.bin/xargs/Makefile13
-rw-r--r--usr.bin/xargs/Makefile.depend18
-rw-r--r--usr.bin/xargs/pathnames.h34
-rw-r--r--usr.bin/xargs/strnsubst.c109
-rw-r--r--usr.bin/xargs/tests/Makefile28
-rw-r--r--usr.bin/xargs/tests/Makefile.depend11
-rw-r--r--usr.bin/xargs/tests/legacy_test.sh6
-rw-r--r--usr.bin/xargs/tests/regress.0.inbin0 -> 86 bytes
-rw-r--r--usr.bin/xargs/tests/regress.0.out8
-rw-r--r--usr.bin/xargs/tests/regress.0I.out18
-rw-r--r--usr.bin/xargs/tests/regress.0J.out4
-rw-r--r--usr.bin/xargs/tests/regress.0L.out6
-rw-r--r--usr.bin/xargs/tests/regress.0P1.out4
-rw-r--r--usr.bin/xargs/tests/regress.I.out4
-rw-r--r--usr.bin/xargs/tests/regress.J.out1
-rw-r--r--usr.bin/xargs/tests/regress.L.out2
-rw-r--r--usr.bin/xargs/tests/regress.P1.out1
-rw-r--r--usr.bin/xargs/tests/regress.R.out4
-rw-r--r--usr.bin/xargs/tests/regress.in4
-rw-r--r--usr.bin/xargs/tests/regress.n1.out8
-rw-r--r--usr.bin/xargs/tests/regress.n2.out4
-rw-r--r--usr.bin/xargs/tests/regress.n2P0.out4
-rw-r--r--usr.bin/xargs/tests/regress.n3.out3
-rw-r--r--usr.bin/xargs/tests/regress.normal.out1
-rw-r--r--usr.bin/xargs/tests/regress.quotes.in4
-rw-r--r--usr.bin/xargs/tests/regress.quotes.out7
-rw-r--r--usr.bin/xargs/tests/regress.sh24
-rw-r--r--usr.bin/xargs/xargs.1365
-rw-r--r--usr.bin/xargs/xargs.c786
-rw-r--r--usr.bin/xinstall/Makefile21
-rw-r--r--usr.bin/xinstall/Makefile.depend20
-rw-r--r--usr.bin/xinstall/install.1380
-rw-r--r--usr.bin/xinstall/tests/Makefile5
-rwxr-xr-xusr.bin/xinstall/tests/install_test.sh345
-rw-r--r--usr.bin/xinstall/xinstall.c1418
-rw-r--r--usr.bin/xlint/Makefile12
-rw-r--r--usr.bin/xlint/Makefile.inc15
-rw-r--r--usr.bin/xlint/arch/aarch64/targparam.h50
-rw-r--r--usr.bin/xlint/arch/amd64/targparam.h53
-rw-r--r--usr.bin/xlint/arch/arm/targparam.h63
-rw-r--r--usr.bin/xlint/arch/i386/targparam.h53
-rw-r--r--usr.bin/xlint/arch/m68000/targparam.h53
-rw-r--r--usr.bin/xlint/arch/m68k/targparam.h53
-rw-r--r--usr.bin/xlint/arch/mips/targparam.h53
-rw-r--r--usr.bin/xlint/arch/ns32k/targparam.h53
-rw-r--r--usr.bin/xlint/arch/powerpc/targparam.h55
-rw-r--r--usr.bin/xlint/arch/powerpc64/targparam.h55
-rw-r--r--usr.bin/xlint/arch/riscv/targparam.h53
-rw-r--r--usr.bin/xlint/arch/sh3/targparam.h53
-rw-r--r--usr.bin/xlint/arch/sparc/targparam.h53
-rw-r--r--usr.bin/xlint/arch/sparc64/targparam.h55
-rw-r--r--usr.bin/xlint/arch/vax/targparam.h53
-rw-r--r--usr.bin/xlint/arch/x86_64/targparam.h53
-rw-r--r--usr.bin/xlint/common/emit.c234
-rw-r--r--usr.bin/xlint/common/externs.h66
-rw-r--r--usr.bin/xlint/common/ilp32.h59
-rw-r--r--usr.bin/xlint/common/inittyp.c133
-rw-r--r--usr.bin/xlint/common/lint.h128
-rw-r--r--usr.bin/xlint/common/lp64.h59
-rw-r--r--usr.bin/xlint/common/mem.c93
-rw-r--r--usr.bin/xlint/common/param.h81
-rw-r--r--usr.bin/xlint/lint1/Makefile21
-rw-r--r--usr.bin/xlint/lint1/Makefile.depend21
-rw-r--r--usr.bin/xlint/lint1/cgram.y1893
-rw-r--r--usr.bin/xlint/lint1/decl.c3052
-rw-r--r--usr.bin/xlint/lint1/emit.c243
-rw-r--r--usr.bin/xlint/lint1/emit1.c601
-rw-r--r--usr.bin/xlint/lint1/err.c552
-rw-r--r--usr.bin/xlint/lint1/externs1.h292
-rw-r--r--usr.bin/xlint/lint1/func.c1288
-rw-r--r--usr.bin/xlint/lint1/init.c656
-rw-r--r--usr.bin/xlint/lint1/lint.h120
-rw-r--r--usr.bin/xlint/lint1/lint1.h424
-rw-r--r--usr.bin/xlint/lint1/main1.c230
-rw-r--r--usr.bin/xlint/lint1/makeman80
-rw-r--r--usr.bin/xlint/lint1/mem1.c365
-rw-r--r--usr.bin/xlint/lint1/op.h120
-rw-r--r--usr.bin/xlint/lint1/param.h143
-rw-r--r--usr.bin/xlint/lint1/scan.l1531
-rw-r--r--usr.bin/xlint/lint1/tree.c4040
-rw-r--r--usr.bin/xlint/lint2/Makefile14
-rw-r--r--usr.bin/xlint/lint2/Makefile.depend18
-rw-r--r--usr.bin/xlint/lint2/chk.c1350
-rw-r--r--usr.bin/xlint/lint2/emit2.c300
-rw-r--r--usr.bin/xlint/lint2/externs2.h93
-rw-r--r--usr.bin/xlint/lint2/hash.c166
-rw-r--r--usr.bin/xlint/lint2/lint2.h188
-rw-r--r--usr.bin/xlint/lint2/main2.c191
-rw-r--r--usr.bin/xlint/lint2/mem2.c97
-rw-r--r--usr.bin/xlint/lint2/msg.c138
-rw-r--r--usr.bin/xlint/lint2/read.c1245
-rw-r--r--usr.bin/xlint/llib/Makefile30
-rw-r--r--usr.bin/xlint/llib/Makefile.depend14
-rw-r--r--usr.bin/xlint/llib/llib-lposix314
-rw-r--r--usr.bin/xlint/llib/llib-lstdc254
-rw-r--r--usr.bin/xlint/xlint/Makefile15
-rw-r--r--usr.bin/xlint/xlint/Makefile.depend18
-rw-r--r--usr.bin/xlint/xlint/lint.1627
-rw-r--r--usr.bin/xlint/xlint/pathnames.h45
-rw-r--r--usr.bin/xlint/xlint/xlint.c883
-rw-r--r--usr.bin/xo/Makefile24
-rw-r--r--usr.bin/xo/Makefile.depend20
-rw-r--r--usr.bin/xo/tests/Makefile41
-rw-r--r--usr.bin/xo/tests/Makefile.depend11
-rwxr-xr-xusr.bin/xo/tests/functional_test.sh72
-rw-r--r--usr.bin/xstr/Makefile5
-rw-r--r--usr.bin/xstr/Makefile.depend18
-rw-r--r--usr.bin/xstr/pathnames.h34
-rw-r--r--usr.bin/xstr/xstr.1163
-rw-r--r--usr.bin/xstr/xstr.c491
-rw-r--r--usr.bin/xz/Makefile48
-rw-r--r--usr.bin/xz/Makefile.depend20
-rw-r--r--usr.bin/xzdec/Makefile27
-rw-r--r--usr.bin/xzdec/Makefile.depend20
-rw-r--r--usr.bin/yacc/Makefile28
-rw-r--r--usr.bin/yacc/Makefile.depend18
-rw-r--r--usr.bin/yacc/tests/Makefile334
-rw-r--r--usr.bin/yacc/tests/Makefile.depend11
-rwxr-xr-xusr.bin/yacc/tests/yacc_tests.sh17
-rw-r--r--usr.bin/yes/Makefile6
-rw-r--r--usr.bin/yes/Makefile.depend17
-rw-r--r--usr.bin/yes/yes.155
-rw-r--r--usr.bin/yes/yes.c58
-rw-r--r--usr.bin/ypcat/Makefile8
-rw-r--r--usr.bin/ypcat/Makefile.depend20
-rw-r--r--usr.bin/ypcat/ypcat.174
-rw-r--r--usr.bin/ypcat/ypcat.c142
-rw-r--r--usr.bin/ypmatch/Makefile8
-rw-r--r--usr.bin/ypmatch/Makefile.depend20
-rw-r--r--usr.bin/ypmatch/ypmatch.175
-rw-r--r--usr.bin/ypmatch/ypmatch.c140
-rw-r--r--usr.bin/ypwhich/Makefile14
-rw-r--r--usr.bin/ypwhich/Makefile.depend21
-rw-r--r--usr.bin/ypwhich/ypwhich.1103
-rw-r--r--usr.bin/ypwhich/ypwhich.c277
3111 files changed, 460703 insertions, 0 deletions
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
new file mode 100644
index 0000000..9d29b4f
--- /dev/null
+++ b/usr.bin/Makefile
@@ -0,0 +1,309 @@
+# From: @(#)Makefile 8.3 (Berkeley) 1/7/94
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+# XXX MISSING: deroff diction graph learn plot
+# spell spline struct xsend
+# XXX Use GNU versions: diff ld patch
+# Moved to secure: bdes
+#
+
+SUBDIR= alias \
+ apply \
+ asa \
+ awk \
+ banner \
+ basename \
+ brandelf \
+ bsdcat \
+ bsdiff \
+ bzip2 \
+ bzip2recover \
+ cap_mkdb \
+ chat \
+ chpass \
+ cksum \
+ cmp \
+ col \
+ colldef \
+ colrm \
+ column \
+ comm \
+ compress \
+ cpuset \
+ csplit \
+ ctlstat \
+ cut \
+ dirname \
+ dpv \
+ du \
+ elf2aout \
+ elfdump \
+ enigma \
+ env \
+ expand \
+ false \
+ fetch \
+ find \
+ fmt \
+ fold \
+ fstat \
+ fsync \
+ gcore \
+ gencat \
+ getconf \
+ getent \
+ getopt \
+ grep \
+ gzip \
+ head \
+ hexdump \
+ id \
+ ident \
+ ipcrm \
+ ipcs \
+ join \
+ jot \
+ keylogin \
+ keylogout \
+ killall \
+ ktrace \
+ ktrdump \
+ lam \
+ lastcomm \
+ ldd \
+ leave \
+ less \
+ lessecho \
+ lesskey \
+ limits \
+ locale \
+ localedef \
+ lock \
+ lockf \
+ logger \
+ login \
+ logins \
+ logname \
+ look \
+ lorder \
+ lsvfs \
+ lzmainfo \
+ m4 \
+ mandoc \
+ mesg \
+ minigzip \
+ ministat \
+ mkdep \
+ mkfifo \
+ mkimg \
+ mklocale \
+ mktemp \
+ mkuzip \
+ mt \
+ ncal \
+ netstat \
+ newgrp \
+ nfsstat \
+ nice \
+ nl \
+ numactl \
+ nohup \
+ opieinfo \
+ opiekey \
+ opiepasswd \
+ pagesize \
+ passwd \
+ paste \
+ patch \
+ pathchk \
+ perror \
+ pr \
+ printenv \
+ printf \
+ procstat \
+ protect \
+ rctl \
+ renice \
+ resizewin \
+ rev \
+ revoke \
+ rpcinfo \
+ rs \
+ rup \
+ rusers \
+ rwall \
+ script \
+ sdiff \
+ sed \
+ send-pr \
+ seq \
+ shar \
+ showmount \
+ sockstat \
+ soelim \
+ sort \
+ split \
+ stat \
+ stdbuf \
+ su \
+ systat \
+ tabs \
+ tail \
+ tar \
+ tcopy \
+ tee \
+ time \
+ timeout \
+ tip \
+ top \
+ touch \
+ tput \
+ tr \
+ true \
+ truncate \
+ tset \
+ tsort \
+ tty \
+ uname \
+ unexpand \
+ uniq \
+ unzip \
+ units \
+ unvis \
+ uudecode \
+ uuencode \
+ vis \
+ vmstat \
+ w \
+ wall \
+ wc \
+ what \
+ whereis \
+ which \
+ whois \
+ write \
+ xargs \
+ xinstall \
+ xo \
+ xz \
+ xzdec \
+ yes
+
+# NB: keep these sorted by MK_* knobs
+
+SUBDIR.${MK_AT}+= at
+SUBDIR.${MK_ATM}+= atm
+SUBDIR.${MK_BLUETOOTH}+= bluetooth
+SUBDIR.${MK_BSD_CPIO}+= cpio
+SUBDIR.${MK_CALENDAR}+= calendar
+SUBDIR.${MK_CLANG}+= clang
+SUBDIR.${MK_EE}+= ee
+SUBDIR.${MK_FILE}+= file
+SUBDIR.${MK_FINGER}+= finger
+SUBDIR.${MK_FTP}+= ftp
+SUBDIR.${MK_GAMES}+= caesar
+SUBDIR.${MK_GAMES}+= factor
+SUBDIR.${MK_GAMES}+= fortune
+SUBDIR.${MK_GAMES}+= grdc
+SUBDIR.${MK_GAMES}+= morse
+SUBDIR.${MK_GAMES}+= number
+SUBDIR.${MK_GAMES}+= pom
+SUBDIR.${MK_GAMES}+= primes
+SUBDIR.${MK_GAMES}+= random
+.if ${MK_GPL_DTC} != "yes"
+.if ${COMPILER_FEATURES:Mc++11}
+SUBDIR+= dtc
+.endif
+.endif
+SUBDIR.${MK_GROFF}+= vgrind
+SUBDIR.${MK_HESIOD}+= hesinfo
+SUBDIR.${MK_ICONV}+= iconv
+SUBDIR.${MK_ICONV}+= mkcsmapper
+SUBDIR.${MK_ICONV}+= mkesdb
+SUBDIR.${MK_ISCSI}+= iscsictl
+SUBDIR.${MK_KDUMP}+= kdump
+SUBDIR.${MK_KDUMP}+= truss
+SUBDIR.${MK_KERBEROS_SUPPORT}+= compile_et
+SUBDIR.${MK_LDNS_UTILS}+= drill
+SUBDIR.${MK_LDNS_UTILS}+= host
+SUBDIR.${MK_LOCATE}+= locate
+# XXX msgs?
+SUBDIR.${MK_MAIL}+= biff
+SUBDIR.${MK_MAIL}+= from
+SUBDIR.${MK_MAIL}+= mail
+SUBDIR.${MK_MAIL}+= msgs
+SUBDIR.${MK_MAKE}+= bmake
+SUBDIR.${MK_MAN_UTILS}+= catman
+.if ${MK_MANDOCDB} == "no" # AND
+SUBDIR.${MK_MAN_UTILS}+= makewhatis
+.endif
+SUBDIR.${MK_MAN_UTILS}+= man
+SUBDIR.${MK_NETCAT}+= nc
+SUBDIR.${MK_NIS}+= ypcat
+SUBDIR.${MK_NIS}+= ypmatch
+SUBDIR.${MK_NIS}+= ypwhich
+SUBDIR.${MK_OPENSSH}+= ssh-copy-id
+SUBDIR.${MK_OPENSSL}+= bc
+SUBDIR.${MK_OPENSSL}+= chkey
+SUBDIR.${MK_OPENSSL}+= dc
+SUBDIR.${MK_OPENSSL}+= newkey
+SUBDIR.${MK_QUOTAS}+= quota
+SUBDIR.${MK_RCMDS}+= rlogin
+SUBDIR.${MK_RCMDS}+= rsh
+SUBDIR.${MK_RCMDS}+= ruptime
+SUBDIR.${MK_RCMDS}+= rwho
+SUBDIR.${MK_SENDMAIL}+= vacation
+SUBDIR.${MK_TALK}+= talk
+SUBDIR.${MK_TELNET}+= telnet
+SUBDIR.${MK_TESTS}+= tests
+SUBDIR.${MK_TEXTPROC}+= checknr
+SUBDIR.${MK_TEXTPROC}+= colcrt
+SUBDIR.${MK_TEXTPROC}+= ul
+SUBDIR.${MK_TFTP}+= tftp
+SUBDIR.${MK_TOOLCHAIN}+= addr2line
+SUBDIR.${MK_TOOLCHAIN}+= ar
+SUBDIR.${MK_TOOLCHAIN}+= c89
+SUBDIR.${MK_TOOLCHAIN}+= c99
+SUBDIR.${MK_TOOLCHAIN}+= ctags
+SUBDIR.${MK_TOOLCHAIN}+= cxxfilt
+SUBDIR.${MK_TOOLCHAIN}+= elfcopy
+SUBDIR.${MK_TOOLCHAIN}+= file2c
+.if ${MACHINE_ARCH} != "aarch64" && \ # ARM64TODO gprof does not build
+ ${MACHINE_CPUARCH} != "riscv" # RISCVTODO gprof does not build
+SUBDIR.${MK_TOOLCHAIN}+= gprof
+.endif
+SUBDIR.${MK_TOOLCHAIN}+= indent
+SUBDIR.${MK_TOOLCHAIN}+= lex
+SUBDIR.${MK_TOOLCHAIN}+= mkstr
+SUBDIR.${MK_TOOLCHAIN}+= nm
+SUBDIR.${MK_TOOLCHAIN}+= readelf
+SUBDIR.${MK_TOOLCHAIN}+= rpcgen
+SUBDIR.${MK_TOOLCHAIN}+= unifdef
+SUBDIR.${MK_TOOLCHAIN}+= size
+SUBDIR.${MK_TOOLCHAIN}+= strings
+.if ${MACHINE_ARCH} != "aarch64" # ARM64TODO xlint does not build
+SUBDIR.${MK_TOOLCHAIN}+= xlint
+.endif
+SUBDIR.${MK_TOOLCHAIN}+= xstr
+SUBDIR.${MK_TOOLCHAIN}+= yacc
+SUBDIR.${MK_VI}+= vi
+SUBDIR.${MK_VT}+= vtfontcvt
+SUBDIR.${MK_USB}+= usbhidaction
+SUBDIR.${MK_USB}+= usbhidctl
+SUBDIR.${MK_UTMPX}+= last
+.if ${MACHINE_CPUARCH} != "riscv" # RISCVTODO users does not build
+SUBDIR.${MK_UTMPX}+= users
+.endif
+SUBDIR.${MK_UTMPX}+= who
+SUBDIR.${MK_SVN}+= svn
+SUBDIR.${MK_SVNLITE}+= svn
+
+.include <bsd.arch.inc.mk>
+
+SUBDIR:= ${SUBDIR:O:u}
+
+SUBDIR_PARALLEL=
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/Makefile.amd64 b/usr.bin/Makefile.amd64
new file mode 100644
index 0000000..fee2fb0
--- /dev/null
+++ b/usr.bin/Makefile.amd64
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.arm b/usr.bin/Makefile.arm
new file mode 100644
index 0000000..b720e3d
--- /dev/null
+++ b/usr.bin/Makefile.arm
@@ -0,0 +1,2 @@
+# $FreeBSD$
+
diff --git a/usr.bin/Makefile.i386 b/usr.bin/Makefile.i386
new file mode 100644
index 0000000..fee2fb0
--- /dev/null
+++ b/usr.bin/Makefile.i386
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.inc b/usr.bin/Makefile.inc
new file mode 100644
index 0000000..534349f
--- /dev/null
+++ b/usr.bin/Makefile.inc
@@ -0,0 +1,6 @@
+# @(#)Makefile.inc 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+BINDIR?= /usr/bin
+
+WARNS?= 6
diff --git a/usr.bin/Makefile.powerpc b/usr.bin/Makefile.powerpc
new file mode 100644
index 0000000..fee2fb0
--- /dev/null
+++ b/usr.bin/Makefile.powerpc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.sparc64 b/usr.bin/Makefile.sparc64
new file mode 100644
index 0000000..fee2fb0
--- /dev/null
+++ b/usr.bin/Makefile.sparc64
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+SUBDIR+= smbutil
diff --git a/usr.bin/addr2line/Makefile b/usr.bin/addr2line/Makefile
new file mode 100644
index 0000000..fe9883f
--- /dev/null
+++ b/usr.bin/addr2line/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+ADDR2LINEDIR= ${ELFTCDIR}/addr2line
+
+.PATH: ${ADDR2LINEDIR}
+
+PROG= addr2line
+
+LIBADD= elftc dwarf elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/addr2line/Makefile.depend b/usr.bin/addr2line/Makefile.depend
new file mode 100644
index 0000000..20f498c
--- /dev/null
+++ b/usr.bin/addr2line/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdwarf \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/alias/Makefile b/usr.bin/alias/Makefile
new file mode 100644
index 0000000..e6345cf
--- /dev/null
+++ b/usr.bin/alias/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+SCRIPTS=generic.sh
+SCRIPTSNAME=alias
+
+LINKS= ${BINDIR}/alias ${BINDIR}/bg \
+ ${BINDIR}/alias ${BINDIR}/cd \
+ ${BINDIR}/alias ${BINDIR}/command \
+ ${BINDIR}/alias ${BINDIR}/fc \
+ ${BINDIR}/alias ${BINDIR}/fg \
+ ${BINDIR}/alias ${BINDIR}/getopts \
+ ${BINDIR}/alias ${BINDIR}/hash \
+ ${BINDIR}/alias ${BINDIR}/jobs \
+ ${BINDIR}/alias ${BINDIR}/read \
+ ${BINDIR}/alias ${BINDIR}/type \
+ ${BINDIR}/alias ${BINDIR}/ulimit \
+ ${BINDIR}/alias ${BINDIR}/umask \
+ ${BINDIR}/alias ${BINDIR}/unalias \
+ ${BINDIR}/alias ${BINDIR}/wait
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/alias/Makefile.depend b/usr.bin/alias/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/alias/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/alias/generic.sh b/usr.bin/alias/generic.sh
new file mode 100644
index 0000000..d9c3127
--- /dev/null
+++ b/usr.bin/alias/generic.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# $FreeBSD$
+# This file is in the public domain.
+builtin ${0##*/} ${1+"$@"}
diff --git a/usr.bin/apply/Makefile b/usr.bin/apply/Makefile
new file mode 100644
index 0000000..2233434
--- /dev/null
+++ b/usr.bin/apply/Makefile
@@ -0,0 +1,14 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= apply
+
+LIBADD= sbuf
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/apply/Makefile.depend b/usr.bin/apply/Makefile.depend
new file mode 100644
index 0000000..6002005
--- /dev/null
+++ b/usr.bin/apply/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/apply/apply.1 b/usr.bin/apply/apply.1
new file mode 100644
index 0000000..ff5e97c
--- /dev/null
+++ b/usr.bin/apply/apply.1
@@ -0,0 +1,140 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)apply.1 8.2 (Berkeley) 4/4/94
+.\" $FreeBSD$
+.\"
+.Dd December 13, 2006
+.Dt APPLY 1
+.Os
+.Sh NAME
+.Nm apply
+.Nd apply a command to a set of arguments
+.Sh SYNOPSIS
+.Nm
+.Op Fl a Ar c
+.Op Fl d
+.Op Fl #
+.Ar command argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility runs the named
+.Ar command
+on each
+argument
+.Ar argument
+in turn.
+.Pp
+Character sequences of the form
+.Dq Li \&%d
+in
+.Ar command ,
+where
+.Sq Li d
+is a digit from 1 to 9, are replaced by the
+.Li d Ns \'th
+following unused
+.Ar argument .
+In this case, the largest digit number of arguments are discarded for
+each execution of
+.Ar command .
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl #
+Normally arguments are taken singly; the optional number
+.Fl #
+specifies the number of arguments to be passed to
+.Ar command .
+If the number is zero,
+.Ar command
+is run, without arguments, once for each
+.Ar argument .
+.Pp
+If any sequences of
+.Dq Li \&%d
+occur in
+.Ar command ,
+the
+.Fl #
+option is ignored.
+.It Fl a Ar c
+The use of the character
+.Sq Li %
+as a magic character may be changed with the
+.Fl a
+option.
+.It Fl d
+Display the commands that would have been executed, but do not actually
+execute them.
+.El
+.Sh ENVIRONMENT
+The following environment variable affects the execution of
+.Nm :
+.Bl -tag -width SHELL
+.It Ev SHELL
+Pathname of shell to use.
+If this variable is not defined, the Bourne shell is used.
+.El
+.Sh FILES
+.Bl -tag -width /bin/sh -compact
+.It Pa /bin/sh
+default shell
+.El
+.Sh EXAMPLES
+.Bl -tag -width apply -compact
+.It Li "apply echo *"
+is similar to
+.Xr ls 1 ;
+.It Li "apply \-2 cmp a1 b1 a2 b2 a3 b3"
+compares the `a' files to the `b' files;
+.It Li "apply \-0 who 1 2 3 4 5"
+runs
+.Xr who 1
+5 times; and
+.It Li "apply \'ln %1 /usr/joe\'" *
+links all files in the current directory to the directory
+.Pa /usr/joe .
+.El
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Sh AUTHORS
+.An Rob Pike
+.Sh BUGS
+Shell metacharacters in
+.Ar command
+may have bizarre effects; it is best to enclose complicated
+commands in single quotes
+.Pq '' .
+.Pp
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c
new file mode 100644
index 0000000..c886660
--- /dev/null
+++ b/usr.bin/apply/apply.c
@@ -0,0 +1,260 @@
+/*-
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/sbuf.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define EXEC "exec "
+
+static int exec_shell(const char *, const char *, const char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct sbuf *cmdbuf;
+ long arg_max;
+ int ch, debug, i, magic, n, nargs, offset, rval;
+ size_t cmdsize;
+ char *cmd, *name, *p, *shell, *slashp, *tmpshell;
+
+ debug = 0;
+ magic = '%'; /* Default magic char is `%'. */
+ nargs = -1;
+ while ((ch = getopt(argc, argv, "a:d0123456789")) != -1)
+ switch (ch) {
+ case 'a':
+ if (optarg[1] != '\0')
+ errx(1,
+ "illegal magic character specification");
+ magic = optarg[0];
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (nargs != -1)
+ errx(1,
+ "only one -# argument may be specified");
+ nargs = optopt - '0';
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 2)
+ usage();
+
+ /*
+ * The command to run is argv[0], and the args are argv[1..].
+ * Look for %digit references in the command, remembering the
+ * largest one.
+ */
+ for (n = 0, p = argv[0]; *p != '\0'; ++p)
+ if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
+ ++p;
+ if (p[0] - '0' > n)
+ n = p[0] - '0';
+ }
+
+ /*
+ * Figure out the shell and name arguments to pass to execl()
+ * in exec_shell(). Always malloc() shell and just set name
+ * to point at the last part of shell if there are any backslashes,
+ * otherwise just set it to point at the space malloc()'d. If
+ * SHELL environment variable exists, replace contents of
+ * shell with it.
+ */
+ shell = name = NULL;
+ tmpshell = getenv("SHELL");
+ shell = (tmpshell != NULL) ? strdup(tmpshell) : strdup(_PATH_BSHELL);
+ if (shell == NULL)
+ err(1, "strdup() failed");
+ slashp = strrchr(shell, '/');
+ name = (slashp != NULL) ? slashp + 1 : shell;
+
+ /*
+ * If there were any %digit references, then use those, otherwise
+ * build a new command string with sufficient %digit references at
+ * the end to consume (nargs) arguments each time round the loop.
+ * Allocate enough space to hold the maximum command. Save the
+ * size to pass to snprintf().
+ */
+ cmdsize = sizeof(EXEC) - 1 + strlen(argv[0])
+ + 9 * (sizeof(" %1") - 1) + 1;
+ if ((cmd = malloc(cmdsize)) == NULL)
+ err(1, NULL);
+
+ if (n == 0) {
+ /* If nargs not set, default to a single argument. */
+ if (nargs == -1)
+ nargs = 1;
+
+ p = cmd;
+ offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
+ if ((size_t)offset >= cmdsize)
+ errx(1, "snprintf() failed");
+ p += offset;
+ cmdsize -= offset;
+ for (i = 1; i <= nargs; i++) {
+ offset = snprintf(p, cmdsize, " %c%d", magic, i);
+ if ((size_t)offset >= cmdsize)
+ errx(1, "snprintf() failed");
+ p += offset;
+ cmdsize -= offset;
+ }
+
+ /*
+ * If nargs set to the special value 0, eat a single
+ * argument for each command execution.
+ */
+ if (nargs == 0)
+ nargs = 1;
+ } else {
+ offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
+ if ((size_t)offset >= cmdsize)
+ errx(1, "snprintf() failed");
+ nargs = n;
+ }
+
+ cmdbuf = sbuf_new(NULL, NULL, 1024, SBUF_AUTOEXTEND);
+ if (cmdbuf == NULL)
+ err(1, NULL);
+
+ arg_max = sysconf(_SC_ARG_MAX);
+
+ /*
+ * (argc) and (argv) are still offset by one to make it simpler to
+ * expand %digit references. At the end of the loop check for (argc)
+ * equals 1 means that all the (argv) has been consumed.
+ */
+ for (rval = 0; argc > nargs; argc -= nargs, argv += nargs) {
+ sbuf_clear(cmdbuf);
+ /* Expand command argv references. */
+ for (p = cmd; *p != '\0'; ++p) {
+ if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
+ if (sbuf_cat(cmdbuf, argv[(++p)[0] - '0'])
+ == -1)
+ errc(1, ENOMEM, "sbuf");
+ } else {
+ if (sbuf_putc(cmdbuf, *p) == -1)
+ errc(1, ENOMEM, "sbuf");
+ }
+ if (sbuf_len(cmdbuf) > arg_max)
+ errc(1, E2BIG, NULL);
+ }
+
+ /* Terminate the command string. */
+ sbuf_finish(cmdbuf);
+
+ /* Run the command. */
+ if (debug)
+ (void)printf("%s\n", sbuf_data(cmdbuf));
+ else
+ if (exec_shell(sbuf_data(cmdbuf), shell, name))
+ rval = 1;
+ }
+
+ if (argc != 1)
+ errx(1, "expecting additional argument%s after \"%s\"",
+ (nargs - argc) ? "s" : "", argv[argc - 1]);
+ free(cmd);
+ sbuf_delete(cmdbuf);
+ free(shell);
+ exit(rval);
+}
+
+/*
+ * exec_shell --
+ * Execute a shell command using passed use_shell and use_name
+ * arguments.
+ */
+static int
+exec_shell(const char *command, const char *use_shell, const char *use_name)
+{
+ pid_t pid;
+ int omask, pstat;
+ sig_t intsave, quitsave;
+
+ if (!command) /* just checking... */
+ return(1);
+
+ omask = sigblock(sigmask(SIGCHLD));
+ switch(pid = vfork()) {
+ case -1: /* error */
+ err(1, "vfork");
+ case 0: /* child */
+ (void)sigsetmask(omask);
+ execl(use_shell, use_name, "-c", command, (char *)NULL);
+ warn("%s", use_shell);
+ _exit(1);
+ }
+ intsave = signal(SIGINT, SIG_IGN);
+ quitsave = signal(SIGQUIT, SIG_IGN);
+ pid = waitpid(pid, &pstat, 0);
+ (void)sigsetmask(omask);
+ (void)signal(SIGINT, intsave);
+ (void)signal(SIGQUIT, quitsave);
+ return(pid == -1 ? -1 : pstat);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: apply [-a magic] [-d] [-0123456789] command arguments ...\n");
+ exit(1);
+}
diff --git a/usr.bin/apply/tests/Makefile b/usr.bin/apply/tests/Makefile
new file mode 100644
index 0000000..af17a27
--- /dev/null
+++ b/usr.bin/apply/tests/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.00.in
+${PACKAGE}FILES+= regress.00.out
+${PACKAGE}FILES+= regress.01.out
+${PACKAGE}FILES+= regress.01.sh
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/apply/tests/Makefile.depend b/usr.bin/apply/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/apply/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/apply/tests/legacy_test.sh b/usr.bin/apply/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/apply/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/apply/tests/regress.00.in b/usr.bin/apply/tests/regress.00.in
new file mode 100644
index 0000000..8282be7
--- /dev/null
+++ b/usr.bin/apply/tests/regress.00.in
@@ -0,0 +1 @@
+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
diff --git a/usr.bin/apply/tests/regress.00.out b/usr.bin/apply/tests/regress.00.out
new file mode 100644
index 0000000..c725cb2
--- /dev/null
+++ b/usr.bin/apply/tests/regress.00.out
@@ -0,0 +1 @@
+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
diff --git a/usr.bin/apply/tests/regress.01.out b/usr.bin/apply/tests/regress.01.out
new file mode 100644
index 0000000..bcf5ab2
--- /dev/null
+++ b/usr.bin/apply/tests/regress.01.out
@@ -0,0 +1 @@
+apply: Argument list too long
diff --git a/usr.bin/apply/tests/regress.01.sh b/usr.bin/apply/tests/regress.01.sh
new file mode 100644
index 0000000..db5f1d4
--- /dev/null
+++ b/usr.bin/apply/tests/regress.01.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# $FreeBSD$
+
+SHELL=/bin/sh; export SHELL
+
+ARG_MAX=$(getconf ARG_MAX)
+ARG_MAX_HALF=$((ARG_MAX / 2))
+
+apply 'echo %1 %1 %1' $(jot $ARG_MAX_HALF 1 1 | tr -d '\n') 2>&1
+
+if [ $? -eq 0 ]; then
+ return 1
+else
+ return 0
+fi
diff --git a/usr.bin/apply/tests/regress.sh b/usr.bin/apply/tests/regress.sh
new file mode 100644
index 0000000..0a20d50
--- /dev/null
+++ b/usr.bin/apply/tests/regress.sh
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+echo 1..2
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `apply "echo %1 %1 %1 %1" $(cat ${SRCDIR}/regress.00.in)')
+REGRESSION_TEST(`01', `sh ${SRCDIR}/regress.01.sh')
+
+REGRESSION_END()
diff --git a/usr.bin/ar/Makefile b/usr.bin/ar/Makefile
new file mode 100644
index 0000000..7a6601a
--- /dev/null
+++ b/usr.bin/ar/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= ar
+SRCS= ar.c acplex.l acpyacc.y read.c util.c write.c y.tab.h
+
+LIBADD= archive elf
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+CFLAGS+=-I. -I${.CURDIR}
+
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED?= yes
+.endif
+LINKS= ${BINDIR}/ar ${BINDIR}/ranlib
+MLINKS= ar.1 ranlib.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ar/Makefile.depend b/usr.bin/ar/Makefile.depend
new file mode 100644
index 0000000..8def7bc
--- /dev/null
+++ b/usr.bin/ar/Makefile.depend
@@ -0,0 +1,27 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ar/acplex.l b/usr.bin/ar/acplex.l
new file mode 100644
index 0000000..589888e
--- /dev/null
+++ b/usr.bin/ar/acplex.l
@@ -0,0 +1,81 @@
+%{
+/*-
+ * Copyright (c) 2008 Kai Wang
+ * 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 <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sysexits.h>
+
+#include "y.tab.h"
+
+int lineno = 1;
+
+int yylex(void);
+
+#define YY_DECL int yylex(void)
+
+%}
+
+%option nounput
+%option noinput
+%option noyywrap
+
+%%
+
+ADDLIB|addlib { return (ADDLIB); }
+ADDMOD|addmod { return (ADDMOD); }
+CLEAR|clear { return (CLEAR); }
+CREATE|create { return (CREATE); }
+DELETE|delete { return (DELETE); }
+DIRECTORY|directory { return (DIRECTORY); }
+END|end { return (END); }
+EXTRACT|extract { return (EXTRACT); }
+LIST|list { return (LIST); }
+OPEN|open { return (OPEN); }
+REPLACE|replace { return (REPLACE); }
+VERBOSE|verbose { return (VERBOSE); }
+SAVE|save { return (SAVE); }
+"(" { return (LP); }
+")" { return (RP); }
+"," { return (COMMA); }
+
+[-_A-Za-z0-9/:$.\\]+ {
+ yylval.str = strdup(yytext);
+ if (yylval.str == NULL)
+ errc(EX_SOFTWARE, errno, "strdup failed");
+ return (FNAME);
+}
+
+[ \t] /* whitespace */
+"*".* /* comment */
+";".* /* comment */
+"+\n" { lineno++; /* '+' is line continuation char */ }
+"\n" { lineno++; return (EOL); }
diff --git a/usr.bin/ar/acpyacc.y b/usr.bin/ar/acpyacc.y
new file mode 100644
index 0000000..456ee1f
--- /dev/null
+++ b/usr.bin/ar/acpyacc.y
@@ -0,0 +1,660 @@
+%{
+/*-
+ * Copyright (c) 2008 Kai Wang
+ * 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/mman.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "ar.h"
+
+#define TEMPLATE "arscp.XXXXXXXX"
+
+struct list {
+ char *str;
+ struct list *next;
+};
+
+
+extern int yylex(void);
+
+static void yyerror(const char *);
+static void arscp_addlib(char *archive, struct list *list);
+static void arscp_addmod(struct list *list);
+static void arscp_clear(void);
+static int arscp_copy(int ifd, int ofd);
+static void arscp_create(char *in, char *out);
+static void arscp_delete(struct list *list);
+static void arscp_dir(char *archive, struct list *list, char *rlt);
+static void arscp_end(int eval);
+static void arscp_extract(struct list *list);
+static void arscp_free_argv(void);
+static void arscp_free_mlist(struct list *list);
+static void arscp_list(void);
+static struct list *arscp_mlist(struct list *list, char *str);
+static void arscp_mlist2argv(struct list *list);
+static int arscp_mlist_len(struct list *list);
+static void arscp_open(char *fname);
+static void arscp_prompt(void);
+static void arscp_replace(struct list *list);
+static void arscp_save(void);
+static int arscp_target_exist(void);
+
+extern int lineno;
+
+static struct bsdar *bsdar;
+static char *target;
+static char *tmpac;
+static int interactive;
+static int verbose;
+
+%}
+
+%token ADDLIB
+%token ADDMOD
+%token CLEAR
+%token CREATE
+%token DELETE
+%token DIRECTORY
+%token END
+%token EXTRACT
+%token LIST
+%token OPEN
+%token REPLACE
+%token VERBOSE
+%token SAVE
+%token LP
+%token RP
+%token COMMA
+%token EOL
+%token <str> FNAME
+%type <list> mod_list
+
+%union {
+ char *str;
+ struct list *list;
+}
+
+%%
+
+begin
+ : { arscp_prompt(); } ar_script
+ ;
+
+ar_script
+ : cmd_list
+ |
+ ;
+
+mod_list
+ : FNAME { $$ = arscp_mlist(NULL, $1); }
+ | mod_list separator FNAME { $$ = arscp_mlist($1, $3); }
+ ;
+
+separator
+ : COMMA
+ |
+ ;
+
+cmd_list
+ : rawcmd
+ | cmd_list rawcmd
+ ;
+
+rawcmd
+ : cmd EOL { arscp_prompt(); }
+ ;
+
+cmd
+ : addlib_cmd
+ | addmod_cmd
+ | clear_cmd
+ | create_cmd
+ | delete_cmd
+ | directory_cmd
+ | end_cmd
+ | extract_cmd
+ | list_cmd
+ | open_cmd
+ | replace_cmd
+ | verbose_cmd
+ | save_cmd
+ | invalid_cmd
+ | empty_cmd
+ | error
+ ;
+
+addlib_cmd
+ : ADDLIB FNAME LP mod_list RP { arscp_addlib($2, $4); }
+ | ADDLIB FNAME { arscp_addlib($2, NULL); }
+ ;
+
+addmod_cmd
+ : ADDMOD mod_list { arscp_addmod($2); }
+ ;
+
+clear_cmd
+ : CLEAR { arscp_clear(); }
+ ;
+
+create_cmd
+ : CREATE FNAME { arscp_create(NULL, $2); }
+ ;
+
+delete_cmd
+ : DELETE mod_list { arscp_delete($2); }
+ ;
+
+directory_cmd
+ : DIRECTORY FNAME { arscp_dir($2, NULL, NULL); }
+ | DIRECTORY FNAME LP mod_list RP { arscp_dir($2, $4, NULL); }
+ | DIRECTORY FNAME LP mod_list RP FNAME { arscp_dir($2, $4, $6); }
+ ;
+
+end_cmd
+ : END { arscp_end(EX_OK); }
+ ;
+
+extract_cmd
+ : EXTRACT mod_list { arscp_extract($2); }
+ ;
+
+list_cmd
+ : LIST { arscp_list(); }
+ ;
+
+open_cmd
+ : OPEN FNAME { arscp_open($2); }
+ ;
+
+replace_cmd
+ : REPLACE mod_list { arscp_replace($2); }
+ ;
+
+save_cmd
+ : SAVE { arscp_save(); }
+ ;
+
+verbose_cmd
+ : VERBOSE { verbose = !verbose; }
+ ;
+
+empty_cmd
+ :
+ ;
+
+invalid_cmd
+ : FNAME { yyerror(NULL); }
+ ;
+
+%%
+
+/* ARGSUSED */
+static void
+yyerror(const char *s)
+{
+
+ (void) s;
+ printf("Syntax error in archive script, line %d\n", lineno);
+}
+
+/*
+ * arscp_open first open an archive and check its validity. If the archive
+ * format is valid, it calls arscp_create to create a temporary copy of
+ * the archive.
+ */
+static void
+arscp_open(char *fname)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ int r;
+
+ if ((a = archive_read_new()) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
+ archive_read_support_format_ar(a);
+ AC(archive_read_open_filename(a, fname, DEF_BLKSZ));
+ if ((r = archive_read_next_header(a, &entry)))
+ bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
+ AC(archive_read_close(a));
+ AC(archive_read_free(a));
+ if (r != ARCHIVE_OK)
+ return;
+ arscp_create(fname, fname);
+}
+
+/*
+ * Create archive. in != NULL indicate it's a OPEN cmd, and resulting
+ * archive is based on modification of an existing one. If in == NULL,
+ * we are in CREATE cmd and a new empty archive will be created.
+ */
+static void
+arscp_create(char *in, char *out)
+{
+ struct archive *a;
+ int ifd, ofd;
+
+ /* Delete previously created temporary archive, if any. */
+ if (tmpac) {
+ if (unlink(tmpac) < 0)
+ bsdar_errc(bsdar, EX_IOERR, errno, "unlink failed");
+ free(tmpac);
+ }
+
+ tmpac = strdup(TEMPLATE);
+ if (tmpac == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ if ((ofd = mkstemp(tmpac)) < 0)
+ bsdar_errc(bsdar, EX_IOERR, errno, "mkstemp failed");
+
+ if (in) {
+ /*
+ * Command OPEN creates a temporary copy of the
+ * input archive.
+ */
+ if ((ifd = open(in, O_RDONLY)) < 0) {
+ bsdar_warnc(bsdar, errno, "open failed");
+ return;
+ }
+ if (arscp_copy(ifd, ofd)) {
+ bsdar_warnc(bsdar, 0, "arscp_copy failed");
+ return;
+ }
+ close(ifd);
+ close(ofd);
+ } else {
+ /*
+ * Command CREATE creates an "empty" archive.
+ * (archive with only global header)
+ */
+ if ((a = archive_write_new()) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_write_new failed");
+ archive_write_set_format_ar_svr4(a);
+ AC(archive_write_open_fd(a, ofd));
+ AC(archive_write_close(a));
+ AC(archive_write_free(a));
+ }
+
+ /* Override previous target, if any. */
+ if (target)
+ free(target);
+
+ target = out;
+ bsdar->filename = tmpac;
+}
+
+/* A file copying implementation using mmap. */
+static int
+arscp_copy(int ifd, int ofd)
+{
+ struct stat sb;
+ char *buf, *p;
+ ssize_t w;
+ size_t bytes;
+
+ if (fstat(ifd, &sb) < 0) {
+ bsdar_warnc(bsdar, errno, "fstate failed");
+ return (1);
+ }
+ if ((p = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, ifd,
+ (off_t)0)) == MAP_FAILED) {
+ bsdar_warnc(bsdar, errno, "mmap failed");
+ return (1);
+ }
+ for (buf = p, bytes = sb.st_size; bytes > 0; bytes -= w) {
+ w = write(ofd, buf, bytes);
+ if (w <= 0) {
+ bsdar_warnc(bsdar, errno, "write failed");
+ break;
+ }
+ }
+ if (munmap(p, sb.st_size) < 0)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "munmap failed");
+ if (bytes > 0)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Add all modules of archive to current archive, if list != NULL,
+ * only those modules specified in 'list' will be added.
+ */
+static void
+arscp_addlib(char *archive, struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ bsdar->addlib = archive;
+ ar_mode_A(bsdar);
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/* Add modules into current archive. */
+static void
+arscp_addmod(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_mode_q(bsdar);
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/* Delete modules from current archive. */
+static void
+arscp_delete(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_mode_d(bsdar);
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/* Extract modules from current archive. */
+static void
+arscp_extract(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_mode_x(bsdar);
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/* List modules of archive. (Simple Mode) */
+static void
+arscp_list(void)
+{
+
+ if (!arscp_target_exist())
+ return;
+ bsdar->argc = 0;
+ bsdar->argv = NULL;
+ /* Always verbose. */
+ bsdar->options |= AR_V;
+ ar_mode_t(bsdar);
+ bsdar->options &= ~AR_V;
+}
+
+/* List modules of archive. (Advance Mode) */
+static void
+arscp_dir(char *archive, struct list *list, char *rlt)
+{
+ FILE *out;
+
+ /* If rlt != NULL, redirect output to it */
+ out = NULL;
+ if (rlt) {
+ out = stdout;
+ if ((stdout = fopen(rlt, "w")) == NULL)
+ bsdar_errc(bsdar, EX_IOERR, errno,
+ "fopen %s failed", rlt);
+ }
+
+ bsdar->filename = archive;
+ if (list)
+ arscp_mlist2argv(list);
+ else {
+ bsdar->argc = 0;
+ bsdar->argv = NULL;
+ }
+ if (verbose)
+ bsdar->options |= AR_V;
+ ar_mode_t(bsdar);
+ bsdar->options &= ~AR_V;
+
+ if (rlt) {
+ if (fclose(stdout) == EOF)
+ bsdar_errc(bsdar, EX_IOERR, errno,
+ "fclose %s failed", rlt);
+ stdout = out;
+ free(rlt);
+ }
+ free(archive);
+ bsdar->filename = tmpac;
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+
+/* Replace modules of current archive. */
+static void
+arscp_replace(struct list *list)
+{
+
+ if (!arscp_target_exist())
+ return;
+ arscp_mlist2argv(list);
+ ar_mode_r(bsdar);
+ arscp_free_argv();
+ arscp_free_mlist(list);
+}
+
+/* Rename the temporary archive to the target archive. */
+static void
+arscp_save(void)
+{
+ mode_t mask;
+
+ if (target) {
+ if (rename(tmpac, target) < 0)
+ bsdar_errc(bsdar, EX_IOERR, errno, "rename failed");
+ /*
+ * mkstemp creates temp files with mode 0600, here we
+ * set target archive mode per process umask.
+ */
+ mask = umask(0);
+ umask(mask);
+ if (chmod(target, 0666 & ~mask) < 0)
+ bsdar_errc(bsdar, EX_IOERR, errno, "chmod failed");
+ free(tmpac);
+ free(target);
+ tmpac = NULL;
+ target= NULL;
+ bsdar->filename = NULL;
+ } else
+ bsdar_warnc(bsdar, 0, "no open output archive");
+}
+
+/*
+ * Discard all the contents of current archive. This is achieved by
+ * invoking CREATE cmd on current archive.
+ */
+static void
+arscp_clear(void)
+{
+ char *new_target;
+
+ if (target) {
+ new_target = strdup(target);
+ if (new_target == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ arscp_create(NULL, new_target);
+ }
+}
+
+/*
+ * Quit ar(1). Note that END cmd will not SAVE current archive
+ * before exit.
+ */
+static void
+arscp_end(int eval)
+{
+
+ if (target)
+ free(target);
+ if (tmpac) {
+ if (unlink(tmpac) == -1)
+ bsdar_errc(bsdar, EX_IOERR, errno, "unlink %s failed",
+ tmpac);
+ free(tmpac);
+ }
+
+ exit(eval);
+}
+
+/*
+ * Check if target specified, i.e, whether OPEN or CREATE has been
+ * issued by user.
+ */
+static int
+arscp_target_exist(void)
+{
+
+ if (target)
+ return (1);
+
+ bsdar_warnc(bsdar, 0, "no open output archive");
+ return (0);
+}
+
+/* Construct module list. */
+static struct list *
+arscp_mlist(struct list *list, char *str)
+{
+ struct list *l;
+
+ l = malloc(sizeof(*l));
+ if (l == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ l->str = str;
+ l->next = list;
+
+ return (l);
+}
+
+/* Calculate the length of a mlist. */
+static int
+arscp_mlist_len(struct list *list)
+{
+ int len;
+
+ for(len = 0; list; list = list->next)
+ len++;
+
+ return (len);
+}
+
+/* Free the space allocated for mod_list. */
+static void
+arscp_free_mlist(struct list *list)
+{
+ struct list *l;
+
+ /* Note that list->str was freed in arscp_free_argv. */
+ for(; list; list = l) {
+ l = list->next;
+ free(list);
+ }
+}
+
+/* Convert mlist to argv array. */
+static void
+arscp_mlist2argv(struct list *list)
+{
+ char **argv;
+ int i, n;
+
+ n = arscp_mlist_len(list);
+ argv = malloc(n * sizeof(*argv));
+ if (argv == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+
+ /* Note that module names are stored in reverse order in mlist. */
+ for(i = n - 1; i >= 0; i--, list = list->next) {
+ if (list == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "invalid mlist");
+ argv[i] = list->str;
+ }
+
+ bsdar->argc = n;
+ bsdar->argv = argv;
+}
+
+/* Free space allocated for argv array and its elements. */
+static void
+arscp_free_argv(void)
+{
+ int i;
+
+ for(i = 0; i < bsdar->argc; i++)
+ free(bsdar->argv[i]);
+
+ free(bsdar->argv);
+}
+
+/* Show a prompt if we are in interactive mode */
+static void
+arscp_prompt(void)
+{
+
+ if (interactive) {
+ printf("AR >");
+ fflush(stdout);
+ }
+}
+
+/* Main function for ar script mode. */
+void
+ar_mode_script(struct bsdar *ar)
+{
+
+ bsdar = ar;
+ interactive = isatty(fileno(stdin));
+ while(yyparse()) {
+ if (!interactive)
+ arscp_end(1);
+ }
+
+ /* Script ends without END */
+ arscp_end(EX_OK);
+}
diff --git a/usr.bin/ar/ar.1 b/usr.bin/ar/ar.1
new file mode 100644
index 0000000..9d9a860
--- /dev/null
+++ b/usr.bin/ar/ar.1
@@ -0,0 +1,608 @@
+.\" Copyright (c) 2007 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy 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 16, 2016
+.Dt AR 1
+.Os
+.Sh NAME
+.Nm ar ,
+.Nm ranlib
+.Nd manage archives
+.Sh SYNOPSIS
+.Nm
+.Fl d
+.Op Fl T
+.Op Fl f
+.Op Fl j
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl m
+.Op Fl T
+.Op Fl a Ar position-after
+.Op Fl b Ar position-before
+.Op Fl f
+.Op Fl i Ar position-before
+.Op Fl j
+.Op Fl s | Fl S
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl p
+.Op Fl T
+.Op Fl f
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl q
+.Op Fl T
+.Op Fl c
+.Op Fl D
+.Op Fl f
+.Op Fl s | Fl S
+.Op Fl U
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl r
+.Op Fl T
+.Op Fl a Ar position-after
+.Op Fl b Ar position-before
+.Op Fl c
+.Op Fl D
+.Op Fl f
+.Op Fl i Ar position-before
+.Op Fl j
+.Op Fl s | Fl S
+.Op Fl u
+.Op Fl U
+.Op Fl v
+.Op Fl z
+.Ar archive
+.Ar
+.Nm
+.Fl s
+.Op Fl j
+.Op Fl z
+.Ar archive
+.Nm
+.Fl t
+.Op Fl f
+.Op Fl T
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl x
+.Op Fl C
+.Op Fl T
+.Op Fl f
+.Op Fl o
+.Op Fl u
+.Op Fl v
+.Ar archive
+.Op Ar
+.Nm
+.Fl M
+.Nm ranlib
+.Op Fl D
+.Op Fl U
+.Ar archive ...
+.Sh DESCRIPTION
+The
+.Nm
+utility creates and maintains groups of files combined into an
+archive.
+Once an archive has been created, new files can be added to it, and
+existing files can be extracted, deleted or replaced.
+.Pp
+Files are named in the archive by their last file name component,
+so if a file referenced by a path containing a
+.Dq /
+is archived, it will be named by the last component of the path.
+Similarly when matching paths listed on the command line against
+file names stored in the archive, only the last component of the
+path will be compared.
+.Pp
+The normal use of
+.Nm
+is for the creation and maintenance of libraries suitable for use
+with the link editor
+.Xr ld 1 ,
+although it is not restricted to this purpose.
+The
+.Nm
+utility can create and manage an archive symbol table (see
+.Xr ar 5 )
+used to speed up link editing operations.
+If a symbol table is present in an archive, it will be
+kept up-to-date by subsequent operations on the archive.
+.Pp
+The
+.Nm ranlib
+utility is used to add an archive symbol table
+to an existing archive.
+.Sh OPTIONS
+The
+.Nm
+utility supports the following options:
+.Bl -tag -width indent
+.It Fl a Ar member-after
+When used with option
+.Fl m
+this option specifies that the archive members specified by
+arguments
+.Ar
+are moved to after the archive member named by argument
+.Ar member-after .
+When used with option
+.Fl r
+this option specifies that the files specified by arguments
+.Ar
+are added after the archive member named by argument
+.Ar member-after .
+.It Fl b Ar member-before
+When used with option
+.Fl m
+this option specifies that the archive members specified by
+arguments
+.Ar
+are moved to before the archive member named by argument
+.Ar member-before .
+When used with option
+.Fl r
+this option specifies that the files specified by arguments
+.Ar
+are added before the archive member named by argument
+.Ar member-before .
+.It Fl c
+Suppress the informational message printed when a new archive is
+created using the
+.Fl r
+and
+.Fl q
+options.
+.It Fl C
+Prevent extracted files from replacing like-named files
+in the file system.
+.It Fl d
+Delete the members named by arguments
+.Ar
+from the archive specified by argument
+.Ar archive .
+The archive's symbol table, if present, is updated to reflect
+the new contents of the archive.
+.It Fl D
+When used in combination with the
+.Fl r
+or
+.Fl q
+option,
+with the
+.Fl s
+option without other options, or when invoked as
+.Nm ranlib ,
+insert 0's instead of the real mtime, uid and gid values
+and 0644 instead of file mode from the members named by arguments
+.Ar .
+This ensures that checksums on the resulting archives are reproducible
+when member contents are identical.
+This option is enabled by default.
+If multiple
+.Fl D
+and
+.Fl U
+options are specified on the command line, the final one takes precedence.
+.It Fl f
+Synonymous with option
+.Fl T .
+.It Fl i Ar member-before
+Synonymous with option
+.Fl b .
+.It Fl j
+This option is accepted but ignored.
+.It Fl l
+This option is accepted for compatibility with GNU
+.Xr ar 1 ,
+but is ignored.
+.It Fl m
+Move archive members specified by arguments
+.Ar
+within the archive.
+If a position has been specified by one of the
+.Fl a ,
+.Fl b
+or
+.Fl i
+options, the members are moved to before or after the specified
+position.
+If no position has been specified, the specified members are moved
+to the end of the archive.
+If the archive has a symbol table, it is updated to reflect the
+new contents of the archive.
+.It Fl M
+Read and execute MRI librarian commands from standard input.
+The commands understood by the
+.Nm
+utility are described in the section
+.Sx "MRI Librarian Commands" .
+.It Fl o
+Preserve the original modification times of members when extracting
+them.
+.It Fl p
+Write the contents of the specified archive members named by
+arguments
+.Ar
+to standard output.
+If no members were specified, the contents of all the files in the
+archive are written in the order they appear in the archive.
+.It Fl q
+Append the files specified by arguments
+.Ar
+to the archive specified by argument
+.Ar archive
+without checking if the files already exist in the archive.
+The archive symbol table will be updated as needed.
+If the file specified by the argument
+.Ar archive
+does not already exist, a new archive will be created.
+.It Fl r
+Replace (add) the files specified by arguments
+.Ar
+in the archive specified by argument
+.Ar archive ,
+creating the archive if necessary.
+Replacing existing members will not change the order of members within
+the archive.
+If a file named in arguments
+.Ar
+does not exist, existing members in the archive that match that
+name are not changed.
+New files are added to the end of the archive unless one of the
+positioning options
+.Fl a ,
+.Fl b
+or
+.Fl i
+is specified.
+The archive symbol table, if it exists, is updated to reflect the
+new state of the archive.
+.It Fl s
+Add an archive symbol table (see
+.Xr ar 5 )
+to the archive specified by argument
+.Ar archive .
+Invoking
+.Nm
+with the
+.Fl s
+option alone is equivalent to invoking
+.Nm ranlib .
+.It Fl S
+Do not generate an archive symbol table.
+.It Fl t
+List the files specified by arguments
+.Ar
+in the order in which they appear in the archive, one per line.
+If no files are specified, all files in the archive are listed.
+.It Fl T
+Use only the first fifteen characters of the archive member name or
+command line file name argument when naming archive members.
+.It Fl u
+Conditionally update the archive or extract members.
+When used with the
+.Fl r
+option, files named by arguments
+.Ar
+will be replaced in the archive if they are newer than their
+archived versions.
+When used with the
+.Fl x
+option, the members specified by arguments
+.Ar
+will be extracted only if they are newer than the corresponding
+files in the file system.
+.It Fl U
+When used in combination with the
+.Fl r
+or
+.Fl q
+option, insert the real mtime, uid and gid, and file mode values
+from the members named by arguments
+.Ar .
+If multiple
+.Fl D
+and
+.Fl U
+options are specified on the command line, the final one takes precedence.
+.It Fl v
+Provide verbose output.
+When used with the
+.Fl d ,
+.Fl m ,
+.Fl q
+or
+.Fl x
+options,
+.Nm
+gives a file-by-file description of the archive modification being
+performed, which consists of three white-space separated fields:
+the option letter, a dash
+.Dq "-" ,
+and the file name.
+When used with the
+.Fl r
+option,
+.Nm
+displays the description as above, but the initial letter is an
+.Dq a
+if the file is added to the archive, or an
+.Dq r
+if the file replaces a file already in the archive.
+When used with the
+.Fl p
+option, the name of the file enclosed in
+.Dq <
+and
+.Dq >
+characters is written to standard output preceded by a single newline
+character and followed by two newline characters.
+The contents of the named file follow the file name.
+When used with the
+.Fl t
+option,
+.Nm
+displays eight whitespace separated fields:
+the file permissions as displayed by
+.Xr strmode 3 ,
+decimal user and group IDs separated by a slash (
+.Dq / Ns ) ,
+the file size in bytes, the file modification time in
+.Xr strftime 3
+format
+.Dq "%b %e %H:%M %Y" ,
+and the name of the file.
+.It Fl V
+Print a version string and exit.
+.It Fl x
+Extract archive members specified by arguments
+.Ar
+into the current directory.
+If no members have been specified, extract all members of the archive.
+If the file corresponding to an extracted member does not exist it
+will be created.
+If the file corresponding to an extracted member does exist, its owner
+and group will not be changed while its contents will be overwritten
+and its permissions will set to that entered in the archive.
+The file's access and modification time would be that of the time
+of extraction unless the
+.Fl o
+option was specified.
+.It Fl z
+This option is accepted but ignored.
+.El
+.Ss "MRI Librarian Commands"
+If the
+.Fl M
+option is specified, the
+.Nm
+utility will read and execute commands from its standard input.
+If standard input is a terminal, the
+.Nm
+utility will display the prompt
+.Dq Li "AR >"
+before reading a line, and will continue operation even if errors are
+encountered.
+If standard input is not a terminal, the
+.Nm
+utility will not display a prompt and will terminate execution on
+encountering an error.
+.Pp
+Each input line contains a single command.
+Words in an input line are separated by whitespace characters.
+The first word of the line is the command, the remaining words are
+the arguments to the command.
+The command word may be specified in either case.
+Arguments may be separated by commas or blanks.
+.Pp
+Empty lines are allowed and are ignored.
+Long lines are continued by ending them with the
+.Dq Li +
+character.
+.Pp
+The
+.Dq Li *
+and
+.Dq Li "\&;"
+characters start a comment.
+Comments extend till the end of the line.
+.Pp
+When executing an MRI librarian script the
+.Nm
+utility works on a temporary copy of an archive.
+Changes to the copy are made permanent using the
+.Ic save
+command.
+.Pp
+Commands understood by the
+.Nm
+utility are:
+.Bl -tag -width indent
+.It Ic addlib Ar archive | Ic addlib Ar archive Pq Ar member Oo Li , Ar member Oc Ns ...
+Add the contents of the archive named by argument
+.Ar archive
+to the current archive.
+If specific members are named using the arguments
+.Ar member ,
+then those members are added to the current archive.
+If no members are specified, the entire contents of the archive
+are added to the current archive.
+.It Ic addmod Ar member Oo Li , Ar member Oc Ns ...
+Add the files named by arguments
+.Ar member
+to the current archive.
+.It Ic clear
+Discard all the contents of the current archive.
+.It Ic create Ar archive
+Create a new archive named by the argument
+.Ar archive ,
+and makes it the current archive.
+If the named archive already exists, it will be overwritten
+when the
+.Ic save
+command is issued.
+.It Ic delete Ar module Oo Li , Ar member Oc Ns ...
+Delete the modules named by the arguments
+.Ar member
+from the current archive.
+.It Ic directory Ar archive Po Ar member Oo Li , Ar member Oc Ns ... Pc Op Ar outputfile
+List each named module in the archive.
+The format of the output depends on the verbosity setting set using
+the
+.Ic verbose
+command.
+Output is sent to standard output, or to the file specified by
+argument
+.Ar outputfile .
+.It Ic end
+Exit successfully from the
+.Nm
+utility.
+Any unsaved changes to the current archive will be discarded.
+.It Ic extract Ar member Oo Li , Ar member Oc Ns ...
+Extract the members named by the arguments
+.Ar member
+from the current archive.
+.It Ic list
+Display the contents of the current archive in verbose style.
+.It Ic open Ar archive
+Open the archive named by argument
+.Ar archive
+and make it the current archive.
+.It Ic replace Ar member Oo Li , Ar member Oc Ns ...
+Replace named members in the current archive with the files specified
+by arguments
+.Ar member .
+The files must be present in the current directory and the named
+modules must already exist in the current archive.
+.It Ic save
+Commit all changes to the current archive.
+.It Ic verbose
+Toggle the verbosity of the
+.Ic directory
+command.
+.El
+.Sh EXAMPLES
+To create a new archive
+.Pa ex.a
+containing three files
+.Pa ex1.o ,
+.Pa ex2.o
+and
+.Pa ex3.o ,
+use:
+.Dl "ar -rc ex.a ex1.o ex2.o ex3.o"
+.Pp
+To add an archive symbol table to an existing archive
+.Pa ex.a ,
+use:
+.Dl "ar -s ex.a"
+.Pp
+To delete file
+.Pa ex1.o
+from archive
+.Pa ex.a ,
+use:
+.D1 "ar -d ex.a ex1.o"
+.Pp
+To verbosely list the contents of archive
+.Pa ex.a ,
+use:
+.D1 "ar -tv ex.a"
+.Pp
+To create a new archive
+.Pa ex.a
+containing the files
+.Pa ex1.o ,
+and
+.Pa ex2.o ,
+using MRI librarian commands, use the following script:
+.Bd -literal -offset indent
+create ex.a * specify the output archive
+addmod ex1.o ex2.o * add modules
+save * save pending changes
+end * exit the utility
+.Ed
+.Sh DIAGNOSTICS
+.Ex -std
+.Sh SEE ALSO
+.Xr ld 1 ,
+.Xr archive 3 ,
+.Xr elf 3 ,
+.Xr strftime 3 ,
+.Xr strmode 3 ,
+.Xr ar 5
+.Sh STANDARDS COMPLIANCE
+The
+.Nm
+utility's support for the
+.Fl a ,
+.Fl b ,
+.Fl c ,
+.Fl i ,
+.Fl m ,
+.Fl p ,
+.Fl q ,
+.Fl r ,
+.Fl s ,
+.Fl t ,
+.Fl u ,
+.Fl v ,
+.Fl C
+and
+.Fl T
+options is believed to be compliant with
+.St -p1003.2 .
+.Sh HISTORY
+An
+.Nm
+command first appeared in AT&T UNIX Version 1.
+In
+.Fx 8.0 ,
+.An Kai Wang Aq Mt kaiw@FreeBSD.org
+reimplemented
+.Nm
+and
+.Nm ranlib
+using the
+.Lb libarchive
+and the
+.Lb libelf .
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c
new file mode 100644
index 0000000..c1050aa
--- /dev/null
+++ b/usr.bin/ar/ar.c
@@ -0,0 +1,420 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 2007 Tim Kientzle
+ * Copyright (c) 2007 Joseph Koshy
+ * 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.
+ */
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * 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. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/queue.h>
+#include <sys/types.h>
+#include <archive.h>
+#include <errno.h>
+#include <getopt.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+
+#include "ar.h"
+
+enum options
+{
+ OPTION_HELP
+};
+
+static struct option longopts[] =
+{
+ {"help", no_argument, NULL, OPTION_HELP},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
+};
+
+static void bsdar_usage(void);
+static void ranlib_usage(void);
+static void set_mode(struct bsdar *bsdar, char opt);
+static void only_mode(struct bsdar *bsdar, const char *opt,
+ const char *valid_modes);
+static void bsdar_version(void);
+static void ranlib_version(void);
+
+int
+main(int argc, char **argv)
+{
+ struct bsdar *bsdar, bsdar_storage;
+ char *p;
+ size_t len;
+ int i, opt, Dflag, Uflag;
+
+ bsdar = &bsdar_storage;
+ memset(bsdar, 0, sizeof(*bsdar));
+ Dflag = 0;
+ Uflag = 0;
+
+ if ((bsdar->progname = getprogname()) == NULL)
+ bsdar->progname = "ar";
+
+ /* Act like ranlib if our name ends in "ranlib"; this
+ * accommodates arm-freebsd7.1-ranlib, bsdranlib, etc. */
+ len = strlen(bsdar->progname);
+ if (len >= strlen("ranlib") &&
+ strcmp(bsdar->progname + len - strlen("ranlib"), "ranlib") == 0) {
+ while ((opt = getopt_long(argc, argv, "tDUV", longopts,
+ NULL)) != -1) {
+ switch(opt) {
+ case 't':
+ /* Ignored. */
+ break;
+ case 'D':
+ Dflag = 1;
+ Uflag = 0;
+ break;
+ case 'U':
+ Uflag = 1;
+ Dflag = 0;
+ break;
+ case 'V':
+ ranlib_version();
+ break;
+ case OPTION_HELP:
+ ranlib_usage();
+ default:
+ ranlib_usage();
+ }
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (*argv == NULL)
+ ranlib_usage();
+
+ /* Enable determinstic mode unless -U is set. */
+ if (Uflag == 0)
+ bsdar->options |= AR_D;
+ bsdar->options |= AR_S;
+ while ((bsdar->filename = *argv++) != NULL)
+ ar_mode_s(bsdar);
+
+ exit(EX_OK);
+ } else {
+ if (argc < 2)
+ bsdar_usage();
+
+ if (*argv[1] != '-') {
+ len = strlen(argv[1]) + 2;
+ if ((p = malloc(len)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "malloc failed");
+ *p = '-';
+ (void)strlcpy(p + 1, argv[1], len - 1);
+ argv[1] = p;
+ }
+ }
+
+ while ((opt = getopt_long(argc, argv, "abCcdDfijlMmopqrSsTtUuVvxz",
+ longopts, NULL)) != -1) {
+ switch(opt) {
+ case 'a':
+ bsdar->options |= AR_A;
+ break;
+ case 'b':
+ case 'i':
+ bsdar->options |= AR_B;
+ break;
+ case 'C':
+ bsdar->options |= AR_CC;
+ break;
+ case 'c':
+ bsdar->options |= AR_C;
+ break;
+ case 'd':
+ set_mode(bsdar, opt);
+ break;
+ case 'D':
+ Dflag = 1;
+ Uflag = 0;
+ break;
+ case 'f':
+ case 'T':
+ bsdar->options |= AR_TR;
+ break;
+ case 'j':
+ /* ignored */
+ break;
+ case 'l':
+ /* ignored, for GNU ar comptibility */
+ break;
+ case 'M':
+ set_mode(bsdar, opt);
+ break;
+ case 'm':
+ set_mode(bsdar, opt);
+ break;
+ case 'o':
+ bsdar->options |= AR_O;
+ break;
+ case 'p':
+ set_mode(bsdar, opt);
+ break;
+ case 'q':
+ set_mode(bsdar, opt);
+ break;
+ case 'r':
+ set_mode(bsdar, opt);
+ break;
+ case 'S':
+ bsdar->options |= AR_SS;
+ break;
+ case 's':
+ bsdar->options |= AR_S;
+ break;
+ case 't':
+ set_mode(bsdar, opt);
+ break;
+ case 'U':
+ Uflag = 1;
+ Dflag = 0;
+ break;
+ case 'u':
+ bsdar->options |= AR_U;
+ break;
+ case 'V':
+ bsdar_version();
+ break;
+ case 'v':
+ bsdar->options |= AR_V;
+ break;
+ case 'x':
+ set_mode(bsdar, opt);
+ break;
+ case 'z':
+ /* ignored */
+ break;
+ case OPTION_HELP:
+ bsdar_usage();
+ default:
+ bsdar_usage();
+ }
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ if (*argv == NULL && bsdar->mode != 'M')
+ bsdar_usage();
+
+ if (bsdar->options & AR_A && bsdar->options & AR_B)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "only one of -a and -[bi] options allowed");
+
+ if (bsdar->options & AR_J && bsdar->options & AR_Z)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "only one of -j and -z options allowed");
+
+ if (bsdar->options & AR_S && bsdar->options & AR_SS)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "only one of -s and -S options allowed");
+
+ if (bsdar->options & (AR_A | AR_B)) {
+ if (*argv == NULL)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "no position operand specified");
+ if ((bsdar->posarg = basename(*argv)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "basename failed");
+ argc--;
+ argv++;
+ }
+
+ /* Set determinstic mode for -D, and by default without -U. */
+ if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r' ||
+ (bsdar->mode == '\0' && bsdar->options & AR_S))))
+ bsdar->options |= AR_D;
+
+ if (bsdar->options & AR_A)
+ only_mode(bsdar, "-a", "mqr");
+ if (bsdar->options & AR_B)
+ only_mode(bsdar, "-b", "mqr");
+ if (bsdar->options & AR_C)
+ only_mode(bsdar, "-c", "qr");
+ if (bsdar->options & AR_CC)
+ only_mode(bsdar, "-C", "x");
+ if (Dflag)
+ only_mode(bsdar, "-D", "qr");
+ if (Uflag)
+ only_mode(bsdar, "-U", "qr");
+ if (bsdar->options & AR_O)
+ only_mode(bsdar, "-o", "x");
+ if (bsdar->options & AR_SS)
+ only_mode(bsdar, "-S", "mqr");
+ if (bsdar->options & AR_U)
+ only_mode(bsdar, "-u", "qrx");
+
+ if (bsdar->mode == 'M') {
+ ar_mode_script(bsdar);
+ exit(EX_OK);
+ }
+
+ if ((bsdar->filename = *argv) == NULL)
+ bsdar_usage();
+
+ bsdar->argc = --argc;
+ bsdar->argv = ++argv;
+
+ if ((!bsdar->mode || strchr("ptx", bsdar->mode)) &&
+ bsdar->options & AR_S) {
+ ar_mode_s(bsdar);
+ if (!bsdar->mode)
+ exit(EX_OK);
+ }
+
+ switch(bsdar->mode) {
+ case 'd':
+ ar_mode_d(bsdar);
+ break;
+ case 'm':
+ ar_mode_m(bsdar);
+ break;
+ case 'p':
+ ar_mode_p(bsdar);
+ break;
+ case 'q':
+ ar_mode_q(bsdar);
+ break;
+ case 'r':
+ ar_mode_r(bsdar);
+ break;
+ case 't':
+ ar_mode_t(bsdar);
+ break;
+ case 'x':
+ ar_mode_x(bsdar);
+ break;
+ default:
+ bsdar_usage();
+ /* NOTREACHED */
+ }
+
+ for (i = 0; i < bsdar->argc; i++)
+ if (bsdar->argv[i] != NULL)
+ bsdar_warnc(bsdar, 0, "%s: not found in archive",
+ bsdar->argv[i]);
+
+ exit(EX_OK);
+}
+
+static void
+set_mode(struct bsdar *bsdar, char opt)
+{
+
+ if (bsdar->mode != '\0' && bsdar->mode != opt)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "Can't specify both -%c and -%c", opt, bsdar->mode);
+ bsdar->mode = opt;
+}
+
+static void
+only_mode(struct bsdar *bsdar, const char *opt, const char *valid_modes)
+{
+
+ if (strchr(valid_modes, bsdar->mode) == NULL)
+ bsdar_errc(bsdar, EX_USAGE, 0,
+ "Option %s is not permitted in mode -%c", opt, bsdar->mode);
+}
+
+static void
+bsdar_usage(void)
+{
+
+ (void)fprintf(stderr, "usage: ar -d [-Tjsvz] archive file ...\n");
+ (void)fprintf(stderr, "\tar -m [-Tjsvz] archive file ...\n");
+ (void)fprintf(stderr, "\tar -m [-Tabijsvz] position archive file ...\n");
+ (void)fprintf(stderr, "\tar -p [-Tv] archive [file ...]\n");
+ (void)fprintf(stderr, "\tar -q [-TcDjsUvz] archive file ...\n");
+ (void)fprintf(stderr, "\tar -r [-TcDjsUuvz] archive file ...\n");
+ (void)fprintf(stderr, "\tar -r [-TabcDijsUuvz] position archive file ...\n");
+ (void)fprintf(stderr, "\tar -s [-jz] archive\n");
+ (void)fprintf(stderr, "\tar -t [-Tv] archive [file ...]\n");
+ (void)fprintf(stderr, "\tar -x [-CTouv] archive [file ...]\n");
+ (void)fprintf(stderr, "\tar -V\n");
+ exit(EX_USAGE);
+}
+
+static void
+ranlib_usage(void)
+{
+
+ (void)fprintf(stderr, "usage: ranlib [-DtU] archive ...\n");
+ (void)fprintf(stderr, "\tranlib -V\n");
+ exit(EX_USAGE);
+}
+
+static void
+bsdar_version(void)
+{
+ (void)printf("BSD ar %s - %s\n", BSDAR_VERSION, archive_version_string());
+ exit(EX_OK);
+}
+
+static void
+ranlib_version(void)
+{
+ (void)printf("ranlib %s - %s\n", BSDAR_VERSION, archive_version_string());
+ exit(EX_OK);
+}
diff --git a/usr.bin/ar/ar.h b/usr.bin/ar/ar.h
new file mode 100644
index 0000000..957a985
--- /dev/null
+++ b/usr.bin/ar/ar.h
@@ -0,0 +1,125 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#define BSDAR_VERSION "1.1.0"
+
+/*
+ * ar(1) options.
+ */
+#define AR_A 0x0001 /* position-after */
+#define AR_B 0x0002 /* position-before */
+#define AR_C 0x0004 /* creating new archive */
+#define AR_CC 0x0008 /* do not overwrite when extracting */
+#define AR_J 0x0010 /* bzip2 compression */
+#define AR_O 0x0020 /* preserve original mtime when extracting */
+#define AR_S 0x0040 /* write archive symbol table */
+#define AR_SS 0x0080 /* do not write archive symbol table */
+#define AR_TR 0x0100 /* only keep first 15 chars for member name */
+#define AR_U 0x0200 /* only extract or update newer members.*/
+#define AR_V 0x0400 /* verbose mode */
+#define AR_Z 0x0800 /* gzip compression */
+#define AR_D 0x1000 /* insert dummy mode, mtime, uid and gid */
+
+#define DEF_BLKSZ 10240 /* default block size */
+
+/*
+ * Convenient wrapper for general libarchive error handling.
+ */
+#define AC(CALL) do { \
+ if ((CALL)) \
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", \
+ archive_error_string(a)); \
+} while (0)
+
+/*
+ * In-memory representation of archive member(object).
+ */
+struct ar_obj {
+ char *name; /* member name */
+ void *maddr; /* mmap start address */
+ uid_t uid; /* user id */
+ gid_t gid; /* group id */
+ mode_t md; /* octal file permissions */
+ size_t size; /* member size */
+ time_t mtime; /* modification time */
+ int fd; /* file descriptor */
+ dev_t dev; /* inode's device */
+ ino_t ino; /* inode's number */
+
+ TAILQ_ENTRY(ar_obj) objs;
+};
+
+/*
+ * Structure encapsulates the "global" data for "ar" program.
+ */
+struct bsdar {
+ const char *filename; /* archive name. */
+ const char *addlib; /* target of ADDLIB. */
+ const char *posarg; /* position arg for modifiers -a, -b. */
+ char mode; /* program mode */
+ int options; /* command line options */
+
+ const char *progname; /* program name */
+ int argc;
+ char **argv;
+
+ /*
+ * Fields for the archive string table.
+ */
+ char *as; /* buffer for archive string table. */
+ size_t as_sz; /* current size of as table. */
+ size_t as_cap; /* capacity of as table buffer. */
+
+ /*
+ * Fields for the archive symbol table.
+ */
+ uint32_t s_cnt; /* current number of symbols. */
+ uint32_t *s_so; /* symbol offset table. */
+ size_t s_so_cap; /* capacity of so table buffer. */
+ char *s_sn; /* symbol name table */
+ size_t s_sn_cap; /* capacity of sn table buffer. */
+ size_t s_sn_sz; /* current size of sn table. */
+ /* Current member's offset (relative to the end of pseudo members.) */
+ off_t rela_off;
+
+ TAILQ_HEAD(, ar_obj) v_obj; /* object(member) list */
+};
+
+void bsdar_errc(struct bsdar *, int _eval, int _code,
+ const char *fmt, ...) __dead2;
+void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
+void ar_mode_d(struct bsdar *bsdar);
+void ar_mode_m(struct bsdar *bsdar);
+void ar_mode_p(struct bsdar *bsdar);
+void ar_mode_q(struct bsdar *bsdar);
+void ar_mode_r(struct bsdar *bsdar);
+void ar_mode_s(struct bsdar *bsdar);
+void ar_mode_t(struct bsdar *bsdar);
+void ar_mode_x(struct bsdar *bsdar);
+void ar_mode_A(struct bsdar *bsdar);
+void ar_mode_script(struct bsdar *ar);
diff --git a/usr.bin/ar/read.c b/usr.bin/ar/read.c
new file mode 100644
index 0000000..704812c
--- /dev/null
+++ b/usr.bin/ar/read.c
@@ -0,0 +1,212 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 2007 Tim Kientzle
+ * 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/queue.h>
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <errno.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <string.h>
+#include <sysexits.h>
+
+#include "ar.h"
+
+static void read_archive(struct bsdar *bsdar, char mode);
+
+void
+ar_mode_p(struct bsdar *bsdar)
+{
+
+ read_archive(bsdar, 'p');
+}
+
+void
+ar_mode_t(struct bsdar *bsdar)
+{
+
+ read_archive(bsdar, 't');
+}
+
+void
+ar_mode_x(struct bsdar *bsdar)
+{
+
+ read_archive(bsdar, 'x');
+}
+
+/*
+ * Handle read modes: 'x', 't' and 'p'.
+ */
+static void
+read_archive(struct bsdar *bsdar, char mode)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat sb;
+ struct tm *tp;
+ const char *bname;
+ const char *name;
+ mode_t md;
+ size_t size;
+ time_t mtime;
+ uid_t uid;
+ gid_t gid;
+ char **av;
+ char buf[25];
+ char find;
+ int flags, r, i;
+
+ if ((a = archive_read_new()) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
+ archive_read_support_format_ar(a);
+ AC(archive_read_open_filename(a, bsdar->filename, DEF_BLKSZ));
+
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_WARN || r == ARCHIVE_RETRY ||
+ r == ARCHIVE_FATAL)
+ bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
+ if (r == ARCHIVE_EOF || r == ARCHIVE_FATAL)
+ break;
+ if (r == ARCHIVE_RETRY) {
+ bsdar_warnc(bsdar, 0, "Retrying...");
+ continue;
+ }
+
+ if ((name = archive_entry_pathname(entry)) == NULL)
+ break;
+
+ /* Skip pseudo members. */
+ if (strcmp(name, "/") == 0 || strcmp(name, "//") == 0)
+ continue;
+
+ if (bsdar->argc > 0) {
+ find = 0;
+ for(i = 0; i < bsdar->argc; i++) {
+ av = &bsdar->argv[i];
+ if (*av == NULL)
+ continue;
+ if ((bname = basename(*av)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "basename failed");
+ if (strcmp(bname, name) != 0)
+ continue;
+
+ *av = NULL;
+ find = 1;
+ break;
+ }
+ if (!find)
+ continue;
+ }
+
+ if (mode == 't') {
+ if (bsdar->options & AR_V) {
+ md = archive_entry_mode(entry);
+ uid = archive_entry_uid(entry);
+ gid = archive_entry_gid(entry);
+ size = archive_entry_size(entry);
+ mtime = archive_entry_mtime(entry);
+ (void)strmode(md, buf);
+ (void)fprintf(stdout, "%s %6d/%-6d %8ju ",
+ buf + 1, uid, gid, (uintmax_t)size);
+ tp = localtime(&mtime);
+ (void)strftime(buf, sizeof(buf),
+ "%b %e %H:%M %Y", tp);
+ (void)fprintf(stdout, "%s %s", buf, name);
+ } else
+ (void)fprintf(stdout, "%s", name);
+ r = archive_read_data_skip(a);
+ if (r == ARCHIVE_WARN || r == ARCHIVE_RETRY ||
+ r == ARCHIVE_FATAL) {
+ (void)fprintf(stdout, "\n");
+ bsdar_warnc(bsdar, 0, "%s",
+ archive_error_string(a));
+ }
+
+ if (r == ARCHIVE_FATAL)
+ break;
+
+ (void)fprintf(stdout, "\n");
+ } else {
+ /* mode == 'x' || mode = 'p' */
+ if (mode == 'p') {
+ if (bsdar->options & AR_V) {
+ (void)fprintf(stdout, "\n<%s>\n\n",
+ name);
+ fflush(stdout);
+ }
+ r = archive_read_data_into_fd(a, 1);
+ } else {
+ /* mode == 'x' */
+ if (stat(name, &sb) != 0) {
+ if (errno != ENOENT) {
+ bsdar_warnc(bsdar, 0,
+ "stat %s failed",
+ bsdar->filename);
+ continue;
+ }
+ } else {
+ /* stat success, file exist */
+ if (bsdar->options & AR_CC)
+ continue;
+ if (bsdar->options & AR_U &&
+ archive_entry_mtime(entry) <=
+ sb.st_mtime)
+ continue;
+ }
+
+ if (bsdar->options & AR_V)
+ (void)fprintf(stdout, "x - %s\n", name);
+ /* Disallow absolute paths. */
+ if (name[0] == '/') {
+ bsdar_warnc(bsdar, 0,
+ "Absolute path '%s'", name);
+ continue;
+ }
+ /* Basic path security flags. */
+ flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS |
+ ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ if (bsdar->options & AR_O)
+ flags |= ARCHIVE_EXTRACT_TIME;
+
+ r = archive_read_extract(a, entry, flags);
+ }
+
+ if (r)
+ bsdar_warnc(bsdar, 0, "%s",
+ archive_error_string(a));
+ }
+ }
+ AC(archive_read_close(a));
+ AC(archive_read_free(a));
+}
diff --git a/usr.bin/ar/util.c b/usr.bin/ar/util.c
new file mode 100644
index 0000000..e1230e3
--- /dev/null
+++ b/usr.bin/ar/util.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * 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/queue.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ar.h"
+
+static void bsdar_vwarnc(struct bsdar *, int code,
+ const char *fmt, va_list ap);
+static void bsdar_verrc(struct bsdar *bsdar, int code,
+ const char *fmt, va_list ap);
+
+static void
+bsdar_vwarnc(struct bsdar *bsdar, int code, const char *fmt, va_list ap)
+{
+
+ fprintf(stderr, "%s: warning: ", bsdar->progname);
+ vfprintf(stderr, fmt, ap);
+ if (code != 0)
+ fprintf(stderr, ": %s", strerror(code));
+ fprintf(stderr, "\n");
+}
+
+void
+bsdar_warnc(struct bsdar *bsdar, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bsdar_vwarnc(bsdar, code, fmt, ap);
+ va_end(ap);
+}
+
+static void
+bsdar_verrc(struct bsdar *bsdar, int code, const char *fmt, va_list ap)
+{
+
+ fprintf(stderr, "%s: fatal: ", bsdar->progname);
+ vfprintf(stderr, fmt, ap);
+ if (code != 0)
+ fprintf(stderr, ": %s", strerror(code));
+ fprintf(stderr, "\n");
+}
+
+void
+bsdar_errc(struct bsdar *bsdar, int eval, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bsdar_verrc(bsdar, code, fmt, ap);
+ va_end(ap);
+ exit(eval);
+}
diff --git a/usr.bin/ar/write.c b/usr.bin/ar/write.c
new file mode 100644
index 0000000..96f4199
--- /dev/null
+++ b/usr.bin/ar/write.c
@@ -0,0 +1,912 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * 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/endian.h>
+#include <sys/mman.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "ar.h"
+
+#define _ARMAG_LEN 8 /* length of ar magic string */
+#define _ARHDR_LEN 60 /* length of ar header */
+#define _INIT_AS_CAP 128 /* initial archive string table size */
+#define _INIT_SYMOFF_CAP (256*(sizeof(uint32_t))) /* initial so table size */
+#define _INIT_SYMNAME_CAP 1024 /* initial sn table size */
+#define _MAXNAMELEN_SVR4 15 /* max member name length in svr4 variant */
+#define _TRUNCATE_LEN 15 /* number of bytes to keep for member name */
+
+static void add_to_ar_str_table(struct bsdar *bsdar, const char *name);
+static void add_to_ar_sym_table(struct bsdar *bsdar, const char *name);
+static struct ar_obj *create_obj_from_file(struct bsdar *bsdar,
+ const char *name, time_t mtime);
+static void create_symtab_entry(struct bsdar *bsdar, void *maddr,
+ size_t size);
+static void free_obj(struct bsdar *bsdar, struct ar_obj *obj);
+static void insert_obj(struct bsdar *bsdar, struct ar_obj *obj,
+ struct ar_obj *pos);
+static void prefault_buffer(const char *buf, size_t s);
+static void read_objs(struct bsdar *bsdar, const char *archive,
+ int checkargv);
+static void write_archive(struct bsdar *bsdar, char mode);
+static void write_cleanup(struct bsdar *bsdar);
+static void write_data(struct bsdar *bsdar, struct archive *a,
+ const void *buf, size_t s);
+static void write_objs(struct bsdar *bsdar);
+
+void
+ar_mode_d(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 'd');
+}
+
+void
+ar_mode_m(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 'm');
+}
+
+void
+ar_mode_q(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 'q');
+}
+
+void
+ar_mode_r(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 'r');
+}
+
+void
+ar_mode_s(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 's');
+}
+
+void
+ar_mode_A(struct bsdar *bsdar)
+{
+
+ write_archive(bsdar, 'A');
+}
+
+/*
+ * Create object from file, return created obj upon success, or NULL
+ * when an error occurs or the member is not newer than existing
+ * one while -u is specified.
+ */
+static struct ar_obj *
+create_obj_from_file(struct bsdar *bsdar, const char *name, time_t mtime)
+{
+ struct ar_obj *obj;
+ struct stat sb;
+ const char *bname;
+ char *tmpname;
+
+ if (name == NULL)
+ return (NULL);
+
+ obj = malloc(sizeof(struct ar_obj));
+ if (obj == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ if ((obj->fd = open(name, O_RDONLY, 0)) < 0) {
+ bsdar_warnc(bsdar, errno, "can't open file: %s", name);
+ free(obj);
+ return (NULL);
+ }
+
+ tmpname = strdup(name);
+ if (tmpname == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ if ((bname = basename(tmpname)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "basename failed");
+ if (bsdar->options & AR_TR && strlen(bname) > _TRUNCATE_LEN) {
+ if ((obj->name = malloc(_TRUNCATE_LEN + 1)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ (void)strncpy(obj->name, bname, _TRUNCATE_LEN);
+ obj->name[_TRUNCATE_LEN] = '\0';
+ } else
+ if ((obj->name = strdup(bname)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ free(tmpname);
+
+ if (fstat(obj->fd, &sb) < 0) {
+ bsdar_warnc(bsdar, errno, "can't fstat file: %s", obj->name);
+ goto giveup;
+ }
+ if (!S_ISREG(sb.st_mode)) {
+ bsdar_warnc(bsdar, 0, "%s is not an ordinary file", obj->name);
+ goto giveup;
+ }
+
+ /*
+ * When option '-u' is specified and member is not newer than the
+ * existing one, the replace will not happen. While if mtime == 0,
+ * which indicates that this is to "replace a none exist member",
+ * the replace will proceed regardless of '-u'.
+ */
+ if (mtime != 0 && bsdar->options & AR_U && sb.st_mtime <= mtime)
+ goto giveup;
+
+ /*
+ * When option '-D' is specified, mtime and UID / GID from the file
+ * will be replaced with 0, and file mode with 644. This ensures that
+ * checksums will match for two archives containing the exact same
+ * files.
+ */
+ if (bsdar->options & AR_D) {
+ obj->uid = 0;
+ obj->gid = 0;
+ obj->mtime = 0;
+ obj->md = S_IFREG | 0644;
+ } else {
+ obj->uid = sb.st_uid;
+ obj->gid = sb.st_gid;
+ obj->mtime = sb.st_mtime;
+ obj->md = sb.st_mode;
+ }
+ obj->size = sb.st_size;
+ obj->dev = sb.st_dev;
+ obj->ino = sb.st_ino;
+
+ if (obj->size == 0) {
+ obj->maddr = NULL;
+ return (obj);
+ }
+
+ if ((obj->maddr = mmap(NULL, obj->size, PROT_READ,
+ MAP_PRIVATE, obj->fd, (off_t)0)) == MAP_FAILED) {
+ bsdar_warnc(bsdar, errno, "can't mmap file: %s", obj->name);
+ goto giveup;
+ }
+ if (close(obj->fd) < 0)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "close failed: %s",
+ obj->name);
+
+ return (obj);
+
+giveup:
+ if (close(obj->fd) < 0)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "close failed: %s",
+ obj->name);
+ free(obj->name);
+ free(obj);
+ return (NULL);
+}
+
+/*
+ * Free object itself and its associated allocations.
+ */
+static void
+free_obj(struct bsdar *bsdar, struct ar_obj *obj)
+{
+ if (obj->fd == -1)
+ free(obj->maddr);
+ else
+ if (obj->maddr != NULL && munmap(obj->maddr, obj->size))
+ bsdar_warnc(bsdar, errno,
+ "can't munmap file: %s", obj->name);
+ free(obj->name);
+ free(obj);
+}
+
+/*
+ * Insert obj to the tail, or before/after the pos obj.
+ */
+static void
+insert_obj(struct bsdar *bsdar, struct ar_obj *obj, struct ar_obj *pos)
+{
+ if (obj == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "try to insert a null obj");
+
+ if (pos == NULL || obj == pos)
+ /*
+ * If the object to move happens to be the position obj,
+ * or if there is not a pos obj, move it to tail.
+ */
+ goto tail;
+
+ if (bsdar->options & AR_B) {
+ TAILQ_INSERT_BEFORE(pos, obj, objs);
+ return;
+ }
+ if (bsdar->options & AR_A) {
+ TAILQ_INSERT_AFTER(&bsdar->v_obj, pos, obj, objs);
+ return;
+ }
+
+tail:
+ TAILQ_INSERT_TAIL(&bsdar->v_obj, obj, objs);
+
+}
+
+/*
+ * Read objects from archive into v_obj list. Note that checkargv is
+ * set when read_objs is used to read objects from the target of
+ * ADDLIB command (ar script mode), in this case argv array possibly
+ * specifies the members ADDLIB want.
+ */
+static void
+read_objs(struct bsdar *bsdar, const char *archive, int checkargv)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ struct ar_obj *obj;
+ const char *name;
+ const char *bname;
+ char *buff;
+ char **av;
+ size_t size;
+ int i, r, find;
+
+ if ((a = archive_read_new()) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed");
+ archive_read_support_format_ar(a);
+ AC(archive_read_open_filename(a, archive, DEF_BLKSZ));
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_FATAL)
+ bsdar_errc(bsdar, EX_DATAERR, 0, "%s",
+ archive_error_string(a));
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r == ARCHIVE_WARN || r == ARCHIVE_RETRY)
+ bsdar_warnc(bsdar, 0, "%s", archive_error_string(a));
+ if (r == ARCHIVE_RETRY) {
+ bsdar_warnc(bsdar, 0, "Retrying...");
+ continue;
+ }
+
+ name = archive_entry_pathname(entry);
+
+ /*
+ * skip pseudo members.
+ */
+ if (strcmp(name, "/") == 0 || strcmp(name, "//") == 0)
+ continue;
+
+ /*
+ * If checkargv is set, only read those members specified
+ * in argv.
+ */
+ if (checkargv && bsdar->argc > 0) {
+ find = 0;
+ for(i = 0; i < bsdar->argc; i++) {
+ av = &bsdar->argv[i];
+ if (*av == NULL)
+ continue;
+ if ((bname = basename(*av)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "basename failed");
+ if (strcmp(bname, name) != 0)
+ continue;
+
+ *av = NULL;
+ find = 1;
+ break;
+ }
+ if (!find)
+ continue;
+ }
+
+ size = archive_entry_size(entry);
+
+ if (size > 0) {
+ if ((buff = malloc(size)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "malloc failed");
+ if (archive_read_data(a, buff, size) != (ssize_t)size) {
+ bsdar_warnc(bsdar, 0, "%s",
+ archive_error_string(a));
+ free(buff);
+ continue;
+ }
+ } else
+ buff = NULL;
+
+ obj = malloc(sizeof(struct ar_obj));
+ if (obj == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ obj->maddr = buff;
+ if ((obj->name = strdup(name)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "strdup failed");
+ obj->size = size;
+ obj->uid = archive_entry_uid(entry);
+ obj->gid = archive_entry_gid(entry);
+ obj->md = archive_entry_mode(entry);
+ obj->mtime = archive_entry_mtime(entry);
+ obj->dev = 0;
+ obj->ino = 0;
+
+ /*
+ * Objects from archive have obj->fd set to -1,
+ * for the ease of cleaning up.
+ */
+ obj->fd = -1;
+ TAILQ_INSERT_TAIL(&bsdar->v_obj, obj, objs);
+ }
+ AC(archive_read_close(a));
+ AC(archive_read_free(a));
+}
+
+/*
+ * Determine the constitution of resulting archive.
+ */
+static void
+write_archive(struct bsdar *bsdar, char mode)
+{
+ struct ar_obj *nobj, *obj, *obj_temp, *pos;
+ struct stat sb;
+ const char *bname;
+ char **av;
+ int i;
+
+ TAILQ_INIT(&bsdar->v_obj);
+ nobj = NULL;
+ pos = NULL;
+ memset(&sb, 0, sizeof(sb));
+
+ /*
+ * Test if the specified archive exists, to figure out
+ * whether we are creating one here.
+ */
+ if (stat(bsdar->filename, &sb) != 0) {
+ if (errno != ENOENT) {
+ bsdar_warnc(bsdar, 0, "stat %s failed",
+ bsdar->filename);
+ return;
+ }
+
+ /* We do not create archive in mode 'd', 'm' and 's'. */
+ if (mode != 'r' && mode != 'q') {
+ bsdar_warnc(bsdar, 0, "%s: no such file",
+ bsdar->filename);
+ return;
+ }
+
+ /* Issue a warning if -c is not specified when creating. */
+ if (!(bsdar->options & AR_C))
+ bsdar_warnc(bsdar, 0, "creating %s", bsdar->filename);
+ goto new_archive;
+ }
+
+ /*
+ * First read members from existing archive.
+ */
+ read_objs(bsdar, bsdar->filename, 0);
+
+ /*
+ * For mode 's', no member will be moved, deleted or replaced.
+ */
+ if (mode == 's')
+ goto write_objs;
+
+ /*
+ * For mode 'q', we don't need to adjust existing members either.
+ * Also, -a, -b and -i are ignored in this mode. New members are
+ * always inserted at tail.
+ */
+ if (mode == 'q')
+ goto new_archive;
+
+ /*
+ * Mode 'A' adds the contents of another archive to the tail of
+ * current archive. Note that mode 'A' is a special mode for the
+ * ADDLIB command of the ar script mode. Currently there is no
+ * access to this function from the ar command line mode.
+ */
+ if (mode == 'A') {
+ /*
+ * Read objects from the target archive of ADDLIB command.
+ * If there are members specified in argv, read those members
+ * only, otherwise the entire archive will be read.
+ */
+ read_objs(bsdar, bsdar->addlib, 1);
+ goto write_objs;
+ }
+
+ /*
+ * Try to find the position member specified by user.
+ */
+ if (bsdar->options & AR_A || bsdar->options & AR_B) {
+ TAILQ_FOREACH(obj, &bsdar->v_obj, objs) {
+ if (strcmp(obj->name, bsdar->posarg) == 0) {
+ pos = obj;
+ break;
+ }
+ }
+
+ /*
+ * If can't find `pos' specified by user,
+ * silently insert objects at tail.
+ */
+ if (pos == NULL)
+ bsdar->options &= ~(AR_A | AR_B);
+ }
+
+ for (i = 0; i < bsdar->argc; i++) {
+ av = &bsdar->argv[i];
+
+ TAILQ_FOREACH_SAFE(obj, &bsdar->v_obj, objs, obj_temp) {
+ if ((bname = basename(*av)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno,
+ "basename failed");
+ if (bsdar->options & AR_TR) {
+ if (strncmp(bname, obj->name, _TRUNCATE_LEN))
+ continue;
+ } else
+ if (strcmp(bname, obj->name) != 0)
+ continue;
+
+ if (mode == 'r') {
+ /*
+ * if the new member is not qualified
+ * to replace the old one, skip it.
+ */
+ nobj = create_obj_from_file(bsdar, *av,
+ obj->mtime);
+ if (nobj == NULL)
+ goto skip_obj;
+ }
+
+ if (bsdar->options & AR_V)
+ (void)fprintf(stdout, "%c - %s\n", mode,
+ *av);
+
+ TAILQ_REMOVE(&bsdar->v_obj, obj, objs);
+ if (mode == 'd' || mode == 'r')
+ free_obj(bsdar, obj);
+
+ if (mode == 'm')
+ insert_obj(bsdar, obj, pos);
+ if (mode == 'r')
+ insert_obj(bsdar, nobj, pos);
+
+ skip_obj:
+ *av = NULL;
+ break;
+ }
+
+ }
+
+new_archive:
+ /*
+ * When operating in mode 'r', directly add those user specified
+ * objects which do not exist in current archive. When operating
+ * in mode 'q', all objects specified in command line args are
+ * appended to the archive, without comparing with existing ones.
+ */
+ for (i = 0; i < bsdar->argc; i++) {
+ av = &bsdar->argv[i];
+ if (*av != NULL && (mode == 'r' || mode == 'q')) {
+ nobj = create_obj_from_file(bsdar, *av, 0);
+ if (nobj != NULL)
+ insert_obj(bsdar, nobj, pos);
+ if (bsdar->options & AR_V && nobj != NULL)
+ (void)fprintf(stdout, "a - %s\n", *av);
+ *av = NULL;
+ }
+ }
+
+write_objs:
+ write_objs(bsdar);
+ write_cleanup(bsdar);
+}
+
+/*
+ * Memory cleaning up.
+ */
+static void
+write_cleanup(struct bsdar *bsdar)
+{
+ struct ar_obj *obj, *obj_temp;
+
+ TAILQ_FOREACH_SAFE(obj, &bsdar->v_obj, objs, obj_temp) {
+ TAILQ_REMOVE(&bsdar->v_obj, obj, objs);
+ free_obj(bsdar, obj);
+ }
+
+ free(bsdar->as);
+ free(bsdar->s_so);
+ free(bsdar->s_sn);
+ bsdar->as = NULL;
+ bsdar->s_so = NULL;
+ bsdar->s_sn = NULL;
+}
+
+/*
+ * Fault in the buffer prior to writing as a workaround for poor performance
+ * due to interaction with kernel fs deadlock avoidance code. See the comment
+ * above vn_io_fault_doio() in sys/kern/vfs_vnops.c for details of the issue.
+ */
+static void
+prefault_buffer(const char *buf, size_t s)
+{
+ volatile const char *p;
+ size_t page_size;
+
+ if (s == 0)
+ return;
+ page_size = sysconf(_SC_PAGESIZE);
+ for (p = buf; p < buf + s; p += page_size)
+ *p;
+ /*
+ * Ensure we touch the last page as well, in case the buffer is not
+ * page-aligned.
+ */
+ *(volatile const char *)(buf + s - 1);
+}
+
+/*
+ * Wrapper for archive_write_data().
+ */
+static void
+write_data(struct bsdar *bsdar, struct archive *a, const void *buf, size_t s)
+{
+ prefault_buffer(buf, s);
+ if (archive_write_data(a, buf, s) != (ssize_t)s)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s",
+ archive_error_string(a));
+}
+
+/*
+ * Write the resulting archive members.
+ */
+static void
+write_objs(struct bsdar *bsdar)
+{
+ struct ar_obj *obj;
+ struct archive *a;
+ struct archive_entry *entry;
+ size_t s_sz; /* size of archive symbol table. */
+ size_t pm_sz; /* size of pseudo members */
+ int i, nr;
+
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "ELF library initialization failed: %s", elf_errmsg(-1));
+
+ bsdar->rela_off = 0;
+
+ /* Create archive symbol table and archive string table, if need. */
+ TAILQ_FOREACH(obj, &bsdar->v_obj, objs) {
+ if (!(bsdar->options & AR_SS) && obj->maddr != NULL)
+ create_symtab_entry(bsdar, obj->maddr, obj->size);
+ if (strlen(obj->name) > _MAXNAMELEN_SVR4)
+ add_to_ar_str_table(bsdar, obj->name);
+ bsdar->rela_off += _ARHDR_LEN + obj->size + obj->size % 2;
+ }
+
+ /*
+ * Pad the symbol name string table. It is treated specially because
+ * symbol name table should be padded by a '\0', not the common '\n'
+ * for other members. The size of sn table includes the pad bit.
+ */
+ if (bsdar->s_cnt != 0 && bsdar->s_sn_sz % 2 != 0)
+ bsdar->s_sn[bsdar->s_sn_sz++] = '\0';
+
+ /*
+ * Archive string table is padded by a "\n" as the normal members.
+ * The difference is that the size of archive string table counts
+ * in the pad bit, while normal members' size fileds do not.
+ */
+ if (bsdar->as != NULL && bsdar->as_sz % 2 != 0)
+ bsdar->as[bsdar->as_sz++] = '\n';
+
+ /*
+ * If there is a symbol table, calculate the size of pseudo members,
+ * convert previously stored relative offsets to absolute ones, and
+ * then make them Big Endian.
+ *
+ * absolute_offset = htobe32(relative_offset + size_of_pseudo_members)
+ */
+
+ if (bsdar->s_cnt != 0) {
+ s_sz = (bsdar->s_cnt + 1) * sizeof(uint32_t) + bsdar->s_sn_sz;
+ pm_sz = _ARMAG_LEN + (_ARHDR_LEN + s_sz);
+ if (bsdar->as != NULL)
+ pm_sz += _ARHDR_LEN + bsdar->as_sz;
+ for (i = 0; (size_t)i < bsdar->s_cnt; i++)
+ *(bsdar->s_so + i) = htobe32(*(bsdar->s_so + i) +
+ pm_sz);
+ }
+
+ if ((a = archive_write_new()) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_write_new failed");
+
+ archive_write_set_format_ar_svr4(a);
+
+ AC(archive_write_open_filename(a, bsdar->filename));
+
+ /*
+ * write the archive symbol table, if there is one.
+ * If options -s is explicitly specified or we are invoked
+ * as ranlib, write the symbol table even if it is empty.
+ */
+ if ((bsdar->s_cnt != 0 && !(bsdar->options & AR_SS)) ||
+ bsdar->options & AR_S) {
+ entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
+ archive_entry_copy_pathname(entry, "/");
+ if ((bsdar->options & AR_D) == 0)
+ archive_entry_set_mtime(entry, time(NULL), 0);
+ archive_entry_set_size(entry, (bsdar->s_cnt + 1) *
+ sizeof(uint32_t) + bsdar->s_sn_sz);
+ AC(archive_write_header(a, entry));
+ nr = htobe32(bsdar->s_cnt);
+ write_data(bsdar, a, &nr, sizeof(uint32_t));
+ write_data(bsdar, a, bsdar->s_so, sizeof(uint32_t) *
+ bsdar->s_cnt);
+ write_data(bsdar, a, bsdar->s_sn, bsdar->s_sn_sz);
+ archive_entry_free(entry);
+ }
+
+ /* write the archive string table, if any. */
+ if (bsdar->as != NULL) {
+ entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
+ archive_entry_copy_pathname(entry, "//");
+ archive_entry_set_size(entry, bsdar->as_sz);
+ AC(archive_write_header(a, entry));
+ write_data(bsdar, a, bsdar->as, bsdar->as_sz);
+ archive_entry_free(entry);
+ }
+
+ /* write normal members. */
+ TAILQ_FOREACH(obj, &bsdar->v_obj, objs) {
+ entry = archive_entry_new();
+ if (entry == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "archive_entry_new failed");
+ archive_entry_copy_pathname(entry, obj->name);
+ archive_entry_set_uid(entry, obj->uid);
+ archive_entry_set_gid(entry, obj->gid);
+ archive_entry_set_mode(entry, obj->md);
+ archive_entry_set_size(entry, obj->size);
+ archive_entry_set_mtime(entry, obj->mtime, 0);
+ archive_entry_set_dev(entry, obj->dev);
+ archive_entry_set_ino(entry, obj->ino);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ AC(archive_write_header(a, entry));
+ write_data(bsdar, a, obj->maddr, obj->size);
+ archive_entry_free(entry);
+ }
+
+ AC(archive_write_close(a));
+ AC(archive_write_free(a));
+}
+
+/*
+ * Extract global symbols from ELF binary members.
+ */
+static void
+create_symtab_entry(struct bsdar *bsdar, void *maddr, size_t size)
+{
+ Elf *e;
+ Elf_Scn *scn;
+ GElf_Shdr shdr;
+ GElf_Sym sym;
+ Elf_Data *data;
+ char *name;
+ size_t n, shstrndx;
+ int elferr, tabndx, len, i;
+
+ if ((e = elf_memory(maddr, size)) == NULL) {
+ bsdar_warnc(bsdar, 0, "elf_memory() failed: %s",
+ elf_errmsg(-1));
+ return;
+ }
+ if (elf_kind(e) != ELF_K_ELF) {
+ /* Silently ignore non-elf member. */
+ elf_end(e);
+ return;
+ }
+ if (elf_getshstrndx(e, &shstrndx) == 0) {
+ bsdar_warnc(bsdar, EX_SOFTWARE, 0, "elf_getshstrndx failed: %s",
+ elf_errmsg(-1));
+ elf_end(e);
+ return;
+ }
+
+ tabndx = -1;
+ scn = NULL;
+ while ((scn = elf_nextscn(e, scn)) != NULL) {
+ if (gelf_getshdr(scn, &shdr) != &shdr) {
+ bsdar_warnc(bsdar, 0,
+ "elf_getshdr failed: %s", elf_errmsg(-1));
+ continue;
+ }
+ if ((name = elf_strptr(e, shstrndx, shdr.sh_name)) == NULL) {
+ bsdar_warnc(bsdar, 0,
+ "elf_strptr failed: %s", elf_errmsg(-1));
+ continue;
+ }
+ if (strcmp(name, ".strtab") == 0) {
+ tabndx = elf_ndxscn(scn);
+ break;
+ }
+ }
+ elferr = elf_errno();
+ if (elferr != 0)
+ bsdar_warnc(bsdar, 0, "elf_nextscn failed: %s",
+ elf_errmsg(elferr));
+ if (tabndx == -1) {
+ bsdar_warnc(bsdar, 0, "can't find .strtab section");
+ elf_end(e);
+ return;
+ }
+
+ scn = NULL;
+ while ((scn = elf_nextscn(e, scn)) != NULL) {
+ if (gelf_getshdr(scn, &shdr) != &shdr) {
+ bsdar_warnc(bsdar, EX_SOFTWARE, 0,
+ "elf_getshdr failed: %s", elf_errmsg(-1));
+ continue;
+ }
+ if (shdr.sh_type != SHT_SYMTAB)
+ continue;
+
+ data = NULL;
+ n = 0;
+ while (n < shdr.sh_size &&
+ (data = elf_getdata(scn, data)) != NULL) {
+ len = data->d_size / shdr.sh_entsize;
+ for (i = 0; i < len; i++) {
+ if (gelf_getsym(data, i, &sym) != &sym) {
+ bsdar_warnc(bsdar, EX_SOFTWARE, 0,
+ "gelf_getsym failed: %s",
+ elf_errmsg(-1));
+ continue;
+ }
+
+ /* keep only global or weak symbols */
+ if (GELF_ST_BIND(sym.st_info) != STB_GLOBAL &&
+ GELF_ST_BIND(sym.st_info) != STB_WEAK)
+ continue;
+
+ /* keep only defined symbols */
+ if (sym.st_shndx == SHN_UNDEF)
+ continue;
+
+ if ((name = elf_strptr(e, tabndx,
+ sym.st_name)) == NULL) {
+ bsdar_warnc(bsdar, EX_SOFTWARE, 0,
+ "elf_strptr failed: %s",
+ elf_errmsg(-1));
+ continue;
+ }
+
+ add_to_ar_sym_table(bsdar, name);
+ }
+ }
+ }
+ elferr = elf_errno();
+ if (elferr != 0)
+ bsdar_warnc(bsdar, EX_SOFTWARE, 0, "elf_nextscn failed: %s",
+ elf_errmsg(elferr));
+
+ elf_end(e);
+}
+
+/*
+ * Append to the archive string table buffer.
+ */
+static void
+add_to_ar_str_table(struct bsdar *bsdar, const char *name)
+{
+
+ if (bsdar->as == NULL) {
+ bsdar->as_cap = _INIT_AS_CAP;
+ bsdar->as_sz = 0;
+ if ((bsdar->as = malloc(bsdar->as_cap)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ }
+
+ /*
+ * The space required for holding one member name in as table includes:
+ * strlen(name) + (1 for '/') + (1 for '\n') + (possibly 1 for padding).
+ */
+ while (bsdar->as_sz + strlen(name) + 3 > bsdar->as_cap) {
+ bsdar->as_cap *= 2;
+ bsdar->as = realloc(bsdar->as, bsdar->as_cap);
+ if (bsdar->as == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "realloc failed");
+ }
+ strncpy(&bsdar->as[bsdar->as_sz], name, strlen(name));
+ bsdar->as_sz += strlen(name);
+ bsdar->as[bsdar->as_sz++] = '/';
+ bsdar->as[bsdar->as_sz++] = '\n';
+}
+
+/*
+ * Append to the archive symbol table buffer.
+ */
+static void
+add_to_ar_sym_table(struct bsdar *bsdar, const char *name)
+{
+
+ if (bsdar->s_so == NULL) {
+ if ((bsdar->s_so = malloc(_INIT_SYMOFF_CAP)) ==
+ NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ bsdar->s_so_cap = _INIT_SYMOFF_CAP;
+ bsdar->s_cnt = 0;
+ }
+
+ if (bsdar->s_sn == NULL) {
+ if ((bsdar->s_sn = malloc(_INIT_SYMNAME_CAP)) == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed");
+ bsdar->s_sn_cap = _INIT_SYMNAME_CAP;
+ bsdar->s_sn_sz = 0;
+ }
+
+ if (bsdar->s_cnt * sizeof(uint32_t) >= bsdar->s_so_cap) {
+ bsdar->s_so_cap *= 2;
+ bsdar->s_so = realloc(bsdar->s_so, bsdar->s_so_cap);
+ if (bsdar->s_so == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "realloc failed");
+ }
+ bsdar->s_so[bsdar->s_cnt] = bsdar->rela_off;
+ bsdar->s_cnt++;
+
+ /*
+ * The space required for holding one symbol name in sn table includes:
+ * strlen(name) + (1 for '\n') + (possibly 1 for padding).
+ */
+ while (bsdar->s_sn_sz + strlen(name) + 2 > bsdar->s_sn_cap) {
+ bsdar->s_sn_cap *= 2;
+ bsdar->s_sn = realloc(bsdar->s_sn, bsdar->s_sn_cap);
+ if (bsdar->s_sn == NULL)
+ bsdar_errc(bsdar, EX_SOFTWARE, errno, "realloc failed");
+ }
+ strncpy(&bsdar->s_sn[bsdar->s_sn_sz], name, strlen(name));
+ bsdar->s_sn_sz += strlen(name);
+ bsdar->s_sn[bsdar->s_sn_sz++] = '\0';
+}
diff --git a/usr.bin/asa/Makefile b/usr.bin/asa/Makefile
new file mode 100644
index 0000000..c2a221a
--- /dev/null
+++ b/usr.bin/asa/Makefile
@@ -0,0 +1,6 @@
+# $NetBSD: Makefile,v 1.2 1995/03/25 18:04:51 glass Exp $
+# $FreeBSD$
+
+PROG= asa
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/asa/Makefile.depend b/usr.bin/asa/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/asa/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/asa/asa.1 b/usr.bin/asa/asa.1
new file mode 100644
index 0000000..5f5c236
--- /dev/null
+++ b/usr.bin/asa/asa.1
@@ -0,0 +1,98 @@
+.\" $NetBSD: asa.1,v 1.11 2002/02/08 01:36:18 ross Exp $
+.\"
+.\" Copyright (c) 1993 Winning Strategies, 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Winning Strategies, Inc.
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 9, 2002
+.Dt ASA 1
+.Os
+.Sh NAME
+.Nm asa
+.Nd interpret carriage-control characters
+.Sh SYNOPSIS
+.Nm
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility reads files sequentially, mapping
+.Tn FORTRAN
+carriage-control characters to line-printer control sequences,
+and writes them to the standard output.
+.Pp
+The first character of each line is interpreted as a carriage-control
+character.
+The following characters are interpreted as follows:
+.Bl -tag -width ".Aq space"
+.It Aq space
+Output the rest of the line without change.
+.It 0
+Output a
+.Aq newline
+character before printing the rest of the line.
+.It 1
+Output a
+.Aq formfeed
+character before printing the rest of the line.
+.It \&+
+The trailing
+.Aq newline
+of the previous line is replaced by a
+.Aq carriage-return
+before printing the rest of the line.
+.El
+.Pp
+Lines beginning with characters other than the above are treated as if they
+begin with
+.Aq space .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+To view a file containing the output of a
+.Tn FORTRAN
+program:
+.Pp
+.Dl "asa file"
+.Pp
+To format the output of a
+.Tn FORTRAN
+program and redirect it to a line-printer:
+.Pp
+.Dl "a.out | asa | lpr"
+.Sh SEE ALSO
+.Xr f77 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh AUTHORS
+.An J.T. Conklin ,
+Winning Strategies, Inc.
diff --git a/usr.bin/asa/asa.c b/usr.bin/asa/asa.c
new file mode 100644
index 0000000..692b8375
--- /dev/null
+++ b/usr.bin/asa/asa.c
@@ -0,0 +1,141 @@
+/* $NetBSD: asa.c,v 1.11 1997/09/20 14:55:00 lukem Exp $ */
+
+/*
+ * Copyright (c) 1993,94 Winning Strategies, 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Winning Strategies, Inc.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#ifndef lint
+__RCSID("$NetBSD: asa.c,v 1.11 1997/09/20 14:55:00 lukem Exp $");
+#endif
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void asa(FILE *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int ch, exval;
+ FILE *fp;
+ const char *fn;
+
+ while ((ch = getopt(argc, argv, "")) != -1) {
+ switch (ch) {
+ case '?':
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ exval = 0;
+ if (argc == 0)
+ asa(stdin);
+ else {
+ while ((fn = *argv++) != NULL) {
+ if ((fp = fopen(fn, "r")) == NULL) {
+ warn("%s", fn);
+ exval = 1;
+ continue;
+ }
+ asa(fp);
+ fclose(fp);
+ }
+ }
+
+ exit(exval);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: asa [file ...]\n");
+ exit(1);
+}
+
+static void
+asa(FILE *f)
+{
+ size_t len;
+ char *buf;
+
+ if ((buf = fgetln(f, &len)) != NULL) {
+ if (buf[len - 1] == '\n')
+ buf[--len] = '\0';
+ /* special case the first line */
+ switch (buf[0]) {
+ case '0':
+ putchar('\n');
+ break;
+ case '1':
+ putchar('\f');
+ break;
+ }
+
+ if (len > 1 && buf[0] && buf[1])
+ printf("%.*s", (int)(len - 1), buf + 1);
+
+ while ((buf = fgetln(f, &len)) != NULL) {
+ if (buf[len - 1] == '\n')
+ buf[--len] = '\0';
+ switch (buf[0]) {
+ default:
+ case ' ':
+ putchar('\n');
+ break;
+ case '0':
+ putchar('\n');
+ putchar('\n');
+ break;
+ case '1':
+ putchar('\f');
+ break;
+ case '+':
+ putchar('\r');
+ break;
+ }
+
+ if (len > 1 && buf[0] && buf[1])
+ printf("%.*s", (int)(len - 1), buf + 1);
+ }
+
+ putchar('\n');
+ }
+}
diff --git a/usr.bin/at/LEGAL b/usr.bin/at/LEGAL
new file mode 100644
index 0000000..92b1b49
--- /dev/null
+++ b/usr.bin/at/LEGAL
@@ -0,0 +1,29 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+
+Sorry for the long wait, but there still were a few things to
+be ironed out in at, which I've finally done :-)
+
+The FreeBSD team does have my permission to use at, version 2.9,
+under the BSD license.
+
+You'll find it on sunsite.unc.edu's Incoming, hopefully; the
+md5 checksum is
+
+3ba2ca3c0e87e1a04feae2c6c1376b0d at-2.9.tgz
+
+Best regards
+ Thomas
+- --
+Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
+The joy of engineering is to find a straight line on a double
+logarithmic diagram.
+
+-----BEGIN PGP SIGNATURE-----
+Version: 2.6.2i
+
+iQCVAwUBMCjVrPBu+cbJcKCVAQFNiQP/dpWP57s/E8plVGUD3zfgOXDmKUvg8U7a
+VwRzJrIMuSgnSJs0wkpvcomc3NLicipfX7hhWLh/xatPM2YbF7O5HZoNdvWvexD2
+1Y67zJ+0HFb1mPnSBOrS5RFiQAe3KqmGec6E14Rih/qNoFQZBVRFXZ4xxuwP+0Rs
+e2U+TVTUz6A=
+=TvyW
+-----END PGP SIGNATURE-----
diff --git a/usr.bin/at/Makefile b/usr.bin/at/Makefile
new file mode 100644
index 0000000..5e9cfc9
--- /dev/null
+++ b/usr.bin/at/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/Makefile.inc"
+
+PROG= at
+SRCS= at.c panic.c parsetime.c perm.c
+LINKS= ${BINDIR}/at ${BINDIR}/atq \
+ ${BINDIR}/at ${BINDIR}/atrm \
+ ${BINDIR}/at ${BINDIR}/batch
+MLINKS= at.1 batch.1 \
+ at.1 atq.1 \
+ at.1 atrm.1
+
+NO_WFORMAT=
+
+BINOWN= root
+BINMODE= 4555
+CLEANFILES+= at.1
+
+at.1: at.man
+ @${ECHO} Making ${.TARGET:T} from ${.ALLSRC:T}; \
+ sed -e \
+ "s@_ATSPOOL_DIR@$(ATSPOOL_DIR)@g; \
+ s@_ATJOB_DIR@$(ATJOB_DIR)@g; \
+ s@_DEFAULT_BATCH_QUEUE@$(DEFAULT_BATCH_QUEUE)@g; \
+ s@_DEFAULT_AT_QUEUE@$(DEFAULT_AT_QUEUE)@g; \
+ s@_LOADAVG_MX@$(LOADAVG_MX)@g; \
+ s@_PERM_PATH@$(PERM_PATH)@g; \
+ s@_LOCKFILE@$(LOCKFILE)@g" \
+ < ${.ALLSRC} > ${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/at/Makefile.depend b/usr.bin/at/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/at/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/at/Makefile.inc b/usr.bin/at/Makefile.inc
new file mode 100644
index 0000000..3bd4373
--- /dev/null
+++ b/usr.bin/at/Makefile.inc
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+LOCKFILE = .lockfile
+ATSPOOL_DIR=/var/at/spool
+ATJOB_DIR=/var/at/jobs
+ATLIB_DIR=/usr/libexec
+LOADAVG_MX=1.5
+DAEMON_GID=1
+DAEMON_UID=1
+DEFAULT_BATCH_QUEUE=E
+DEFAULT_AT_QUEUE=c
+PERM_PATH=/var/at
+PACKAGE= at
+
+CFLAGS += -DATJOB_DIR=\"$(ATJOB_DIR)/\" \
+ -DLFILE=\"$(ATJOB_DIR)/$(LOCKFILE)\" \
+ -DLOADAVG_MX=$(LOADAVG_MX) -DATSPOOL_DIR=\"$(ATSPOOL_DIR)\" \
+ -DDAEMON_UID=$(DAEMON_UID) -DDAEMON_GID=$(DAEMON_GID) \
+ -DDEFAULT_BATCH_QUEUE=\'$(DEFAULT_BATCH_QUEUE)\' \
+ -DDEFAULT_AT_QUEUE=\'$(DEFAULT_AT_QUEUE)\' -DPERM_PATH=\"$(PERM_PATH)/\"
+
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
new file mode 100644
index 0000000..fec0df3
--- /dev/null
+++ b/usr.bin/at/at.c
@@ -0,0 +1,913 @@
+/*
+ * at.c : Put file into atrun queue
+ * Copyright (C) 1993, 1994 Thomas Koenig
+ *
+ * Atrun & Atq modifications
+ * Copyright (C) 1993 David Parsons
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$");
+
+#define _USE_BSD 1
+
+/* System Headers */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#ifndef __FreeBSD__
+#include <getopt.h>
+#endif
+#ifdef __FreeBSD__
+#include <locale.h>
+#endif
+#include <pwd.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+/* Local headers */
+
+#include "at.h"
+#include "panic.h"
+#include "parsetime.h"
+#include "perm.h"
+
+#define MAIN
+#include "privs.h"
+
+/* Macros */
+
+#ifndef ATJOB_DIR
+#define ATJOB_DIR "/usr/spool/atjobs/"
+#endif
+
+#ifndef LFILE
+#define LFILE ATJOB_DIR ".lockfile"
+#endif
+
+#ifndef ATJOB_MX
+#define ATJOB_MX 255
+#endif
+
+#define ALARMC 10 /* Number of seconds to wait for timeout */
+
+#define SIZE 255
+#define TIMESIZE 50
+
+enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
+
+/* File scope variables */
+
+static const char *no_export[] = {
+ "TERM", "TERMCAP", "DISPLAY", "_"
+};
+static int send_mail = 0;
+static char *atinput = NULL; /* where to get input from */
+static char atqueue = 0; /* which queue to examine for jobs (atq) */
+
+/* External variables */
+
+extern char **environ;
+int fcreated;
+char atfile[] = ATJOB_DIR "12345678901234";
+char atverify = 0; /* verify time instead of queuing job */
+char *namep;
+
+/* Function declarations */
+
+static void sigc(int signo);
+static void alarmc(int signo);
+static char *cwdname(void);
+static void writefile(time_t runtimer, char queue);
+static void list_jobs(long *, int);
+static long nextjob(void);
+static time_t ttime(const char *arg);
+static int in_job_list(long, long *, int);
+static long *get_job_list(int, char *[], int *);
+
+/* Signal catching functions */
+
+static void sigc(int signo __unused)
+{
+/* If the user presses ^C, remove the spool file and exit
+ */
+ if (fcreated)
+ {
+ PRIV_START
+ unlink(atfile);
+ PRIV_END
+ }
+
+ _exit(EXIT_FAILURE);
+}
+
+static void alarmc(int signo __unused)
+{
+ char buf[1024];
+
+ /* Time out after some seconds. */
+ strlcpy(buf, namep, sizeof(buf));
+ strlcat(buf, ": file locking timed out\n", sizeof(buf));
+ write(STDERR_FILENO, buf, strlen(buf));
+ sigc(0);
+}
+
+/* Local functions */
+
+static char *cwdname(void)
+{
+/* Read in the current directory; the name will be overwritten on
+ * subsequent calls.
+ */
+ static char *ptr = NULL;
+ static size_t size = SIZE;
+
+ if (ptr == NULL)
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
+
+ while (1)
+ {
+ if (ptr == NULL)
+ panic("out of memory");
+
+ if (getcwd(ptr, size-1) != NULL)
+ return ptr;
+
+ if (errno != ERANGE)
+ perr("cannot get directory");
+
+ free (ptr);
+ size += SIZE;
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
+ }
+}
+
+static long
+nextjob(void)
+{
+ long jobno;
+ FILE *fid;
+
+ if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != NULL) {
+ if (fscanf(fid, "%5lx", &jobno) == 1) {
+ rewind(fid);
+ jobno = (1+jobno) % 0xfffff; /* 2^20 jobs enough? */
+ fprintf(fid, "%05lx\n", jobno);
+ }
+ else
+ jobno = EOF;
+ fclose(fid);
+ return jobno;
+ }
+ else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != NULL) {
+ fprintf(fid, "%05lx\n", jobno = 1);
+ fclose(fid);
+ return 1;
+ }
+ return EOF;
+}
+
+static void
+writefile(time_t runtimer, char queue)
+{
+/* This does most of the work if at or batch are invoked for writing a job.
+ */
+ long jobno;
+ char *ap, *ppos, *mailname;
+ struct passwd *pass_entry;
+ struct stat statbuf;
+ int fdes, lockdes, fd2;
+ FILE *fp, *fpin;
+ struct sigaction act;
+ char **atenv;
+ int ch;
+ mode_t cmask;
+ struct flock lock;
+
+#ifdef __FreeBSD__
+ (void) setlocale(LC_TIME, "");
+#endif
+
+/* Install the signal handler for SIGINT; terminate after removing the
+ * spool file if necessary
+ */
+ act.sa_handler = sigc;
+ sigemptyset(&(act.sa_mask));
+ act.sa_flags = 0;
+
+ sigaction(SIGINT, &act, NULL);
+
+ ppos = atfile + strlen(ATJOB_DIR);
+
+ /* Loop over all possible file names for running something at this
+ * particular time, see if a file is there; the first empty slot at any
+ * particular time is used. Lock the file LFILE first to make sure
+ * we're alone when doing this.
+ */
+
+ PRIV_START
+
+ if ((lockdes = open(LFILE, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR)) < 0)
+ perr("cannot open lockfile " LFILE);
+
+ lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = 0;
+ lock.l_len = 0;
+
+ act.sa_handler = alarmc;
+ sigemptyset(&(act.sa_mask));
+ act.sa_flags = 0;
+
+ /* Set an alarm so a timeout occurs after ALARMC seconds, in case
+ * something is seriously broken.
+ */
+ sigaction(SIGALRM, &act, NULL);
+ alarm(ALARMC);
+ fcntl(lockdes, F_SETLKW, &lock);
+ alarm(0);
+
+ if ((jobno = nextjob()) == EOF)
+ perr("cannot generate job number");
+
+ sprintf(ppos, "%c%5lx%8lx", queue,
+ jobno, (unsigned long) (runtimer/60));
+
+ for(ap=ppos; *ap != '\0'; ap ++)
+ if (*ap == ' ')
+ *ap = '0';
+
+ if (stat(atfile, &statbuf) != 0)
+ if (errno != ENOENT)
+ perr("cannot access " ATJOB_DIR);
+
+ /* Create the file. The x bit is only going to be set after it has
+ * been completely written out, to make sure it is not executed in the
+ * meantime. To make sure they do not get deleted, turn off their r
+ * bit. Yes, this is a kluge.
+ */
+ cmask = umask(S_IRUSR | S_IWUSR | S_IXUSR);
+ if ((fdes = creat(atfile, O_WRONLY)) == -1)
+ perr("cannot create atjob file");
+
+ if ((fd2 = dup(fdes)) <0)
+ perr("error in dup() of job file");
+
+ if(fchown(fd2, real_uid, real_gid) != 0)
+ perr("cannot give away file");
+
+ PRIV_END
+
+ /* We no longer need suid root; now we just need to be able to write
+ * to the directory, if necessary.
+ */
+
+ REDUCE_PRIV(DAEMON_UID, DAEMON_GID)
+
+ /* We've successfully created the file; let's set the flag so it
+ * gets removed in case of an interrupt or error.
+ */
+ fcreated = 1;
+
+ /* Now we can release the lock, so other people can access it
+ */
+ lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = 0;
+ lock.l_len = 0;
+ fcntl(lockdes, F_SETLKW, &lock);
+ close(lockdes);
+
+ if((fp = fdopen(fdes, "w")) == NULL)
+ panic("cannot reopen atjob file");
+
+ /* Get the userid to mail to, first by trying getlogin(),
+ * then from LOGNAME, finally from getpwuid().
+ */
+ mailname = getlogin();
+ if (mailname == NULL)
+ mailname = getenv("LOGNAME");
+
+ if ((mailname == NULL) || (mailname[0] == '\0')
+ || (strlen(mailname) >= MAXLOGNAME) || (getpwnam(mailname)==NULL))
+ {
+ pass_entry = getpwuid(real_uid);
+ if (pass_entry != NULL)
+ mailname = pass_entry->pw_name;
+ }
+
+ if (atinput != (char *) NULL)
+ {
+ fpin = freopen(atinput, "r", stdin);
+ if (fpin == NULL)
+ perr("cannot open input file");
+ }
+ fprintf(fp, "#!/bin/sh\n# atrun uid=%ld gid=%ld\n# mail %*s %d\n",
+ (long) real_uid, (long) real_gid, MAXLOGNAME - 1, mailname,
+ send_mail);
+
+ /* Write out the umask at the time of invocation
+ */
+ fprintf(fp, "umask %lo\n", (unsigned long) cmask);
+
+ /* Write out the environment. Anything that may look like a
+ * special character to the shell is quoted, except for \n, which is
+ * done with a pair of "'s. Don't export the no_export list (such
+ * as TERM or DISPLAY) because we don't want these.
+ */
+ for (atenv= environ; *atenv != NULL; atenv++)
+ {
+ int export = 1;
+ char *eqp;
+
+ eqp = strchr(*atenv, '=');
+ if (eqp == NULL)
+ eqp = *atenv;
+ else
+ {
+ size_t i;
+ for (i=0; i<sizeof(no_export)/sizeof(no_export[0]); i++)
+ {
+ export = export
+ && (strncmp(*atenv, no_export[i],
+ (size_t) (eqp-*atenv)) != 0);
+ }
+ eqp++;
+ }
+
+ if (export)
+ {
+ (void)fputs("export ", fp);
+ fwrite(*atenv, sizeof(char), eqp-*atenv, fp);
+ for(ap = eqp;*ap != '\0'; ap++)
+ {
+ if (*ap == '\n')
+ fprintf(fp, "\"\n\"");
+ else
+ {
+ if (!isalnum(*ap)) {
+ switch (*ap) {
+ case '%': case '/': case '{': case '[':
+ case ']': case '=': case '}': case '@':
+ case '+': case '#': case ',': case '.':
+ case ':': case '-': case '_':
+ break;
+ default:
+ fputc('\\', fp);
+ break;
+ }
+ }
+ fputc(*ap, fp);
+ }
+ }
+ fputc('\n', fp);
+
+ }
+ }
+ /* Cd to the directory at the time and write out all the
+ * commands the user supplies from stdin.
+ */
+ fprintf(fp, "cd ");
+ for (ap = cwdname(); *ap != '\0'; ap++)
+ {
+ if (*ap == '\n')
+ fprintf(fp, "\"\n\"");
+ else
+ {
+ if (*ap != '/' && !isalnum(*ap))
+ fputc('\\', fp);
+
+ fputc(*ap, fp);
+ }
+ }
+ /* Test cd's exit status: die if the original directory has been
+ * removed, become unreadable or whatever
+ */
+ fprintf(fp, " || {\n\t echo 'Execution directory "
+ "inaccessible' >&2\n\t exit 1\n}\n");
+
+ while((ch = getchar()) != EOF)
+ fputc(ch, fp);
+
+ fprintf(fp, "\n");
+ if (ferror(fp))
+ panic("output error");
+
+ if (ferror(stdin))
+ panic("input error");
+
+ fclose(fp);
+
+ /* Set the x bit so that we're ready to start executing
+ */
+
+ if (fchmod(fd2, S_IRUSR | S_IWUSR | S_IXUSR) < 0)
+ perr("cannot give away file");
+
+ close(fd2);
+ fprintf(stderr, "Job %ld will be executed using /bin/sh\n", jobno);
+}
+
+static int
+in_job_list(long job, long *joblist, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (job == joblist[i])
+ return 1;
+
+ return 0;
+}
+
+static void
+list_jobs(long *joblist, int len)
+{
+ /* List all a user's jobs in the queue, by looping through ATJOB_DIR,
+ * or everybody's if we are root
+ */
+ struct passwd *pw;
+ DIR *spool;
+ struct dirent *dirent;
+ struct stat buf;
+ struct tm runtime;
+ unsigned long ctm;
+ char queue;
+ long jobno;
+ time_t runtimer;
+ char timestr[TIMESIZE];
+ int first=1;
+
+#ifdef __FreeBSD__
+ (void) setlocale(LC_TIME, "");
+#endif
+
+ PRIV_START
+
+ if (chdir(ATJOB_DIR) != 0)
+ perr("cannot change to " ATJOB_DIR);
+
+ if ((spool = opendir(".")) == NULL)
+ perr("cannot open " ATJOB_DIR);
+
+ /* Loop over every file in the directory
+ */
+ while((dirent = readdir(spool)) != NULL) {
+ if (stat(dirent->d_name, &buf) != 0)
+ perr("cannot stat in " ATJOB_DIR);
+
+ /* See it's a regular file and has its x bit turned on and
+ * is the user's
+ */
+ if (!S_ISREG(buf.st_mode)
+ || ((buf.st_uid != real_uid) && ! (real_uid == 0))
+ || !(S_IXUSR & buf.st_mode || atverify))
+ continue;
+
+ if(sscanf(dirent->d_name, "%c%5lx%8lx", &queue, &jobno, &ctm)!=3)
+ continue;
+
+ /* If jobs are given, only list those jobs */
+ if (joblist && !in_job_list(jobno, joblist, len))
+ continue;
+
+ if (atqueue && (queue != atqueue))
+ continue;
+
+ runtimer = 60*(time_t) ctm;
+ runtime = *localtime(&runtimer);
+ strftime(timestr, TIMESIZE, "%+", &runtime);
+ if (first) {
+ printf("Date\t\t\t\tOwner\t\tQueue\tJob#\n");
+ first=0;
+ }
+ pw = getpwuid(buf.st_uid);
+
+ printf("%s\t%-16s%c%s\t%ld\n",
+ timestr,
+ pw ? pw->pw_name : "???",
+ queue,
+ (S_IXUSR & buf.st_mode) ? "":"(done)",
+ jobno);
+ }
+ PRIV_END
+ closedir(spool);
+}
+
+static void
+process_jobs(int argc, char **argv, int what)
+{
+ /* Delete every argument (job - ID) given
+ */
+ int i;
+ int rc;
+ int nofJobs;
+ int nofDone;
+ int statErrno;
+ struct stat buf;
+ DIR *spool;
+ struct dirent *dirent;
+ unsigned long ctm;
+ char queue;
+ long jobno;
+
+ nofJobs = argc - optind;
+ nofDone = 0;
+
+ PRIV_START
+
+ if (chdir(ATJOB_DIR) != 0)
+ perr("cannot change to " ATJOB_DIR);
+
+ if ((spool = opendir(".")) == NULL)
+ perr("cannot open " ATJOB_DIR);
+
+ PRIV_END
+
+ /* Loop over every file in the directory
+ */
+ while((dirent = readdir(spool)) != NULL) {
+
+ PRIV_START
+ rc = stat(dirent->d_name, &buf);
+ statErrno = errno;
+ PRIV_END
+ /* There's a race condition between readdir above and stat here:
+ * another atrm process could have removed the file from the spool
+ * directory under our nose. If this happens, stat will set errno to
+ * ENOENT, which we shouldn't treat as fatal.
+ */
+ if (rc != 0) {
+ if (statErrno == ENOENT)
+ continue;
+ else
+ perr("cannot stat in " ATJOB_DIR);
+ }
+
+ if(sscanf(dirent->d_name, "%c%5lx%8lx", &queue, &jobno, &ctm)!=3)
+ continue;
+
+ for (i=optind; i < argc; i++) {
+ if (atoi(argv[i]) == jobno) {
+ if ((buf.st_uid != real_uid) && !(real_uid == 0))
+ errx(EXIT_FAILURE, "%s: not owner", argv[i]);
+ switch (what) {
+ case ATRM:
+
+ PRIV_START
+
+ if (unlink(dirent->d_name) != 0)
+ perr(dirent->d_name);
+
+ PRIV_END
+
+ break;
+
+ case CAT:
+ {
+ FILE *fp;
+ int ch;
+
+ PRIV_START
+
+ fp = fopen(dirent->d_name,"r");
+
+ PRIV_END
+
+ if (!fp) {
+ perr("cannot open file");
+ }
+ while((ch = getc(fp)) != EOF) {
+ putchar(ch);
+ }
+ fclose(fp);
+ }
+ break;
+
+ default:
+ errx(EXIT_FAILURE, "internal error, process_jobs = %d",
+ what);
+ }
+
+ /* All arguments have been processed
+ */
+ if (++nofDone == nofJobs)
+ goto end;
+ }
+ }
+ }
+end:
+ closedir(spool);
+} /* delete_jobs */
+
+#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
+
+static time_t
+ttime(const char *arg)
+{
+ /*
+ * This is pretty much a copy of stime_arg1() from touch.c. I changed
+ * the return value and the argument list because it's more convenient
+ * (IMO) to do everything in one place. - Joe Halpin
+ */
+ struct timeval tv[2];
+ time_t now;
+ struct tm *t;
+ int yearset;
+ char *p;
+
+ if (gettimeofday(&tv[0], NULL))
+ panic("Cannot get current time");
+
+ /* Start with the current time. */
+ now = tv[0].tv_sec;
+ if ((t = localtime(&now)) == NULL)
+ panic("localtime");
+ /* [[CC]YY]MMDDhhmm[.SS] */
+ if ((p = strchr(arg, '.')) == NULL)
+ t->tm_sec = 0; /* Seconds defaults to 0. */
+ else {
+ if (strlen(p + 1) != 2)
+ goto terr;
+ *p++ = '\0';
+ t->tm_sec = ATOI2(p);
+ }
+
+ yearset = 0;
+ switch(strlen(arg)) {
+ case 12: /* CCYYMMDDhhmm */
+ t->tm_year = ATOI2(arg);
+ t->tm_year *= 100;
+ yearset = 1;
+ /* FALLTHROUGH */
+ case 10: /* YYMMDDhhmm */
+ if (yearset) {
+ yearset = ATOI2(arg);
+ t->tm_year += yearset;
+ } else {
+ yearset = ATOI2(arg);
+ t->tm_year = yearset + 2000;
+ }
+ t->tm_year -= 1900; /* Convert to UNIX time. */
+ /* FALLTHROUGH */
+ case 8: /* MMDDhhmm */
+ t->tm_mon = ATOI2(arg);
+ --t->tm_mon; /* Convert from 01-12 to 00-11 */
+ t->tm_mday = ATOI2(arg);
+ t->tm_hour = ATOI2(arg);
+ t->tm_min = ATOI2(arg);
+ break;
+ default:
+ goto terr;
+ }
+
+ t->tm_isdst = -1; /* Figure out DST. */
+ tv[0].tv_sec = tv[1].tv_sec = mktime(t);
+ if (tv[0].tv_sec != -1)
+ return tv[0].tv_sec;
+ else
+terr:
+ panic(
+ "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
+}
+
+static long *
+get_job_list(int argc, char *argv[], int *joblen)
+{
+ int i, len;
+ long *joblist;
+ char *ep;
+
+ joblist = NULL;
+ len = argc;
+ if (len > 0) {
+ if ((joblist = malloc(len * sizeof(*joblist))) == NULL)
+ panic("out of memory");
+
+ for (i = 0; i < argc; i++) {
+ errno = 0;
+ if ((joblist[i] = strtol(argv[i], &ep, 10)) < 0 ||
+ ep == argv[i] || *ep != '\0' || errno)
+ panic("invalid job number");
+ }
+ }
+
+ *joblen = len;
+ return joblist;
+}
+
+int
+main(int argc, char **argv)
+{
+ int c;
+ char queue = DEFAULT_AT_QUEUE;
+ char queue_set = 0;
+ char *pgm;
+
+ int program = AT; /* our default program */
+ const char *options = "q:f:t:rmvldbc"; /* default options for at */
+ time_t timer;
+ long *joblist;
+ int joblen;
+
+ joblist = NULL;
+ joblen = 0;
+ timer = -1;
+ RELINQUISH_PRIVS
+
+ /* Eat any leading paths
+ */
+ if ((pgm = strrchr(argv[0], '/')) == NULL)
+ pgm = argv[0];
+ else
+ pgm++;
+
+ namep = pgm;
+
+ /* find out what this program is supposed to do
+ */
+ if (strcmp(pgm, "atq") == 0) {
+ program = ATQ;
+ options = "q:v";
+ }
+ else if (strcmp(pgm, "atrm") == 0) {
+ program = ATRM;
+ options = "";
+ }
+ else if (strcmp(pgm, "batch") == 0) {
+ program = BATCH;
+ options = "f:q:mv";
+ }
+
+ /* process whatever options we can process
+ */
+ opterr=1;
+ while ((c=getopt(argc, argv, options)) != -1)
+ switch (c) {
+ case 'v': /* verify time settings */
+ atverify = 1;
+ break;
+
+ case 'm': /* send mail when job is complete */
+ send_mail = 1;
+ break;
+
+ case 'f':
+ atinput = optarg;
+ break;
+
+ case 'q': /* specify queue */
+ if (strlen(optarg) > 1)
+ usage();
+
+ atqueue = queue = *optarg;
+ if (!(islower(queue)||isupper(queue)))
+ usage();
+
+ queue_set = 1;
+ break;
+
+ case 'd':
+ warnx("-d is deprecated; use -r instead");
+ /* fall through to 'r' */
+
+ case 'r':
+ if (program != AT)
+ usage();
+
+ program = ATRM;
+ options = "";
+ break;
+
+ case 't':
+ if (program != AT)
+ usage();
+ timer = ttime(optarg);
+ break;
+
+ case 'l':
+ if (program != AT)
+ usage();
+
+ program = ATQ;
+ options = "q:";
+ break;
+
+ case 'b':
+ if (program != AT)
+ usage();
+
+ program = BATCH;
+ options = "f:q:mv";
+ break;
+
+ case 'c':
+ program = CAT;
+ options = "";
+ break;
+
+ default:
+ usage();
+ break;
+ }
+ /* end of options eating
+ */
+
+ /* select our program
+ */
+ if(!check_permission())
+ errx(EXIT_FAILURE, "you do not have permission to use this program");
+ switch (program) {
+ case ATQ:
+
+ REDUCE_PRIV(DAEMON_UID, DAEMON_GID)
+
+ if (queue_set == 0)
+ joblist = get_job_list(argc - optind, argv + optind, &joblen);
+ list_jobs(joblist, joblen);
+ break;
+
+ case ATRM:
+
+ REDUCE_PRIV(DAEMON_UID, DAEMON_GID)
+
+ process_jobs(argc, argv, ATRM);
+ break;
+
+ case CAT:
+
+ process_jobs(argc, argv, CAT);
+ break;
+
+ case AT:
+ /*
+ * If timer is > -1, then the user gave the time with -t. In that
+ * case, it's already been set. If not, set it now.
+ */
+ if (timer == -1)
+ timer = parsetime(argc, argv);
+
+ if (atverify)
+ {
+ struct tm *tm = localtime(&timer);
+ fprintf(stderr, "%s\n", asctime(tm));
+ }
+ writefile(timer, queue);
+ break;
+
+ case BATCH:
+ if (queue_set)
+ queue = toupper(queue);
+ else
+ queue = DEFAULT_BATCH_QUEUE;
+
+ if (argc > optind)
+ timer = parsetime(argc, argv);
+ else
+ timer = time(NULL);
+
+ if (atverify)
+ {
+ struct tm *tm = localtime(&timer);
+ fprintf(stderr, "%s\n", asctime(tm));
+ }
+
+ writefile(timer, queue);
+ break;
+
+ default:
+ panic("internal error");
+ break;
+ }
+ exit(EXIT_SUCCESS);
+}
diff --git a/usr.bin/at/at.h b/usr.bin/at/at.h
new file mode 100644
index 0000000..3d72bbb
--- /dev/null
+++ b/usr.bin/at/at.h
@@ -0,0 +1,31 @@
+/*
+ * at.h - header for at(1)
+ * Copyright (C) 1993 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$
+ */
+
+extern int fcreated;
+extern char *namep;
+extern char atfile[];
+extern char atverify;
diff --git a/usr.bin/at/at.man b/usr.bin/at/at.man
new file mode 100644
index 0000000..7dc1529
--- /dev/null
+++ b/usr.bin/at/at.man
@@ -0,0 +1,362 @@
+.\" $FreeBSD$
+.Dd January 13, 2002
+.Dt "AT" 1
+.Os
+.Sh NAME
+.Nm at ,
+.Nm batch ,
+.Nm atq ,
+.Nm atrm
+.Nd queue, examine or delete jobs for later execution
+.Sh SYNOPSIS
+.Nm at
+.Op Fl q Ar queue
+.Op Fl f Ar file
+.Op Fl mldbv
+.Ar time
+.Nm at
+.Op Fl q Ar queue
+.Op Fl f Ar file
+.Op Fl mldbv
+.Fl t
+.Sm off
+.Op Oo Ar CC Oc Ar YY
+.Ar MM DD hh mm Op . Ar SS
+.Sm on
+.Nm at
+.Fl c Ar job Op Ar job ...
+.Nm at
+.Fl l Op Ar job ...
+.Nm at
+.Fl l
+.Fl q Ar queue
+.Nm at
+.Fl r Ar job Op Ar job ...
+.Pp
+.Nm atq
+.Op Fl q Ar queue
+.Op Fl v
+.Pp
+.Nm atrm
+.Ar job
+.Op Ar job ...
+.Pp
+.Nm batch
+.Op Fl q Ar queue
+.Op Fl f Ar file
+.Op Fl mv
+.Op Ar time
+.Sh DESCRIPTION
+The
+.Nm at
+and
+.Nm batch
+utilities
+read commands from standard input or a specified file which are to
+be executed at a later time, using
+.Xr sh 1 .
+.Bl -tag -width indent
+.It Nm at
+executes commands at a specified time;
+.It Nm atq
+lists the user's pending jobs, unless the user is the superuser; in that
+case, everybody's jobs are listed;
+.It Nm atrm
+deletes jobs;
+.It Nm batch
+executes commands when system load levels permit; in other words, when the load average
+drops below _LOADAVG_MX, or the value specified in the invocation of
+.Nm atrun .
+.El
+.Pp
+The
+.Nm at
+utility allows some moderately complex
+.Ar time
+specifications.
+It accepts times of the form
+.Ar HHMM
+or
+.Ar HH:MM
+to run a job at a specific time of day.
+(If that time is already past, the next day is assumed.)
+As an alternative, the following keywords may be specified:
+.Em midnight ,
+.Em noon ,
+or
+.Em teatime
+(4pm)
+and time-of-day may be suffixed with
+.Em AM
+or
+.Em PM
+for running in the morning or the evening.
+The day on which the job is to be run may also be specified
+by giving a date in the form
+.Ar \%month-name day
+with an optional
+.Ar year ,
+or giving a date of the forms
+.Ar DD.MM.YYYY ,
+.Ar DD.MM.YY ,
+.Ar MM/DD/YYYY ,
+.Ar MM/DD/YY ,
+.Ar MMDDYYYY , or
+.Ar MMDDYY .
+The specification of a date must follow the specification of
+the time of day.
+Time can also be specified as:
+.Op Em now
+.Em + Ar count \%time-units ,
+where the time-units can be
+.Em minutes ,
+.Em hours ,
+.Em days ,
+.Em weeks ,
+.Em months
+or
+.Em years
+and
+.Nm
+may be told to run the job today by suffixing the time with
+.Em today
+and to run the job tomorrow by suffixing the time with
+.Em tomorrow .
+.Pp
+For example, to run a job at 4pm three days from now, use
+.Nm at Ar 4pm + 3 days ,
+to run a job at 10:00am on July 31, use
+.Nm at Ar 10am Jul 31
+and to run a job at 1am tomorrow, use
+.Nm at Ar 1am tomorrow .
+.Pp
+The
+.Nm at
+utility also supports the
+.Tn POSIX
+time format (see
+.Fl t
+option).
+.Pp
+For both
+.Nm
+and
+.Nm batch ,
+commands are read from standard input or the file specified
+with the
+.Fl f
+option and executed.
+The working directory, the environment (except for the variables
+.Ev TERM ,
+.Ev TERMCAP ,
+.Ev DISPLAY
+and
+.Em _ )
+and the
+.Ar umask
+are retained from the time of invocation.
+An
+.Nm
+or
+.Nm batch
+command invoked from a
+.Xr su 1
+shell will retain the current userid.
+The user will be mailed standard error and standard output from his
+commands, if any.
+Mail will be sent using the command
+.Xr sendmail 8 .
+If
+.Nm
+is executed from a
+.Xr su 1
+shell, the owner of the login shell will receive the mail.
+.Pp
+The superuser may use these commands in any case.
+For other users, permission to use
+.Nm
+is determined by the files
+.Pa _PERM_PATH/at.allow
+and
+.Pa _PERM_PATH/at.deny .
+.Pp
+If the file
+.Pa _PERM_PATH/at.allow
+exists, only usernames mentioned in it are allowed to use
+.Nm .
+In these two files, a user is considered to be listed only if the user
+name has no blank or other characters before it on its line and a
+newline character immediately after the name, even at the end of
+the file.
+Other lines are ignored and may be used for comments.
+.Pp
+If
+.Pa _PERM_PATH/at.allow
+does not exist,
+.Pa _PERM_PATH/at.deny
+is checked, every username not mentioned in it is then allowed
+to use
+.Nm .
+.Pp
+If neither exists, only the superuser is allowed use of
+.Nm .
+This is the default configuration.
+.Sh IMPLEMENTATION NOTES
+Note that
+.Nm
+is implemented through the
+.Xr cron 8
+daemon by calling
+.Xr atrun 8
+every five minutes.
+This implies that the granularity of
+.Nm
+might not be optimal for every deployment.
+If a finer granularity is needed, the system crontab at
+.Pa /etc/crontab
+needs to be changed.
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl q Ar queue
+Use the specified queue.
+A queue designation consists of a single letter; valid queue designations
+range from
+.Ar a
+to
+.Ar z
+and
+.Ar A
+to
+.Ar Z .
+The
+.Ar _DEFAULT_AT_QUEUE
+queue is the default for
+.Nm
+and the
+.Ar _DEFAULT_BATCH_QUEUE
+queue for
+.Nm batch .
+Queues with higher letters run with increased niceness.
+If a job is submitted to a queue designated with an uppercase letter, it
+is treated as if it had been submitted to batch at that time.
+If
+.Nm atq
+is given a specific queue, it will only show jobs pending in that queue.
+.It Fl m
+Send mail to the user when the job has completed even if there was no
+output.
+.It Fl f Ar file
+Read the job from
+.Ar file
+rather than standard input.
+.It Fl l
+With no arguments, list all jobs for the invoking user.
+If one or more
+job numbers are given, list only those jobs.
+.It Fl d
+Is an alias for
+.Nm atrm
+(this option is deprecated; use
+.Fl r
+instead).
+.It Fl b
+Is an alias for
+.Nm batch .
+.It Fl v
+For
+.Nm atq ,
+shows completed but not yet deleted jobs in the queue; otherwise
+shows the time the job will be executed.
+.It Fl c
+Cat the jobs listed on the command line to standard output.
+.It Fl r
+Remove the specified jobs.
+.It Fl t
+Specify the job time using the \*[Px] time format.
+The argument should be in the form
+.Sm off
+.Op Oo Ar CC Oc Ar YY
+.Ar MM DD hh mm Op . Ar SS
+.Sm on
+where each pair of letters represents the following:
+.Pp
+.Bl -tag -width indent -compact -offset indent
+.It Ar CC
+The first two digits of the year (the century).
+.It Ar YY
+The second two digits of the year.
+.It Ar MM
+The month of the year, from 1 to 12.
+.It Ar DD
+the day of the month, from 1 to 31.
+.It Ar hh
+The hour of the day, from 0 to 23.
+.It Ar mm
+The minute of the hour, from 0 to 59.
+.It Ar SS
+The second of the minute, from 0 to 61.
+.El
+.Pp
+If the
+.Ar CC
+and
+.Ar YY
+letter pairs are not specified, the values default to the current
+year.
+If the
+.Ar SS
+letter pair is not specified, the value defaults to 0.
+.El
+.Sh FILES
+.Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact
+.It Pa _ATJOB_DIR
+directory containing job files
+.It Pa _ATSPOOL_DIR
+directory containing output spool files
+.It Pa /var/run/utx.active
+login records
+.It Pa _PERM_PATH/at.allow
+allow permission control
+.It Pa _PERM_PATH/at.deny
+deny permission control
+.It Pa _ATJOB_DIR/_LOCKFILE
+job-creation lock file
+.El
+.Sh SEE ALSO
+.Xr nice 1 ,
+.Xr sh 1 ,
+.Xr umask 2 ,
+.Xr atrun 8 ,
+.Xr cron 8 ,
+.Xr sendmail 8
+.Sh AUTHORS
+.An -nosplit
+At was mostly written by
+.An Thomas Koenig Aq Mt ig25@rz.uni-karlsruhe.de .
+The time parsing routines are by
+.An David Parsons Aq Mt orc@pell.chi.il.us ,
+with minor enhancements by
+.An Joe Halpin Aq Mt joe.halpin@attbi.com .
+.Sh BUGS
+If the file
+.Pa /var/run/utx.active
+is not available or corrupted, or if the user is not logged on at the
+time
+.Nm
+is invoked, the mail is sent to the userid found
+in the environment variable
+.Ev LOGNAME .
+If that is undefined or empty, the current userid is assumed.
+.Pp
+The
+.Nm at
+and
+.Nm batch
+utilities
+as presently implemented are not suitable when users are competing for
+resources.
+If this is the case, another batch system such as
+.Em nqs
+may be more suitable.
+.Pp
+Specifying a date past 2038 may not work on some systems.
diff --git a/usr.bin/at/panic.c b/usr.bin/at/panic.c
new file mode 100644
index 0000000..ef5265b
--- /dev/null
+++ b/usr.bin/at/panic.c
@@ -0,0 +1,92 @@
+/*
+ * panic.c - terminate fast in case of error
+ * Copyright (C) 1993 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$");
+
+/* System Headers */
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Local headers */
+
+#include "panic.h"
+#include "privs.h"
+#include "at.h"
+
+/* External variables */
+
+/* Global functions */
+
+void
+panic(const char *a)
+{
+/* Something fatal has happened, print error message and exit.
+ */
+ if (fcreated) {
+ PRIV_START
+ unlink(atfile);
+ PRIV_END
+ }
+
+ errx(EXIT_FAILURE, "%s", a);
+}
+
+void
+perr(const char *a)
+{
+/* Some operating system error; print error message and exit.
+ */
+ int serrno = errno;
+
+ if (fcreated) {
+ PRIV_START
+ unlink(atfile);
+ PRIV_END
+ }
+
+ errno = serrno;
+ err(EXIT_FAILURE, "%s", a);
+}
+
+void
+usage(void)
+{
+ /* Print usage and exit. */
+ fprintf(stderr, "usage: at [-q x] [-f file] [-m] time\n"
+ " at -c job [job ...]\n"
+ " at [-f file] -t [[CC]YY]MMDDhhmm[.SS]\n"
+ " at -r job [job ...]\n"
+ " at -l -q queuename\n"
+ " at -l [job ...]\n"
+ " atq [-q x] [-v]\n"
+ " atrm job [job ...]\n"
+ " batch [-f file] [-m]\n");
+ exit(EXIT_FAILURE);
+}
diff --git a/usr.bin/at/panic.h b/usr.bin/at/panic.h
new file mode 100644
index 0000000..832de83
--- /dev/null
+++ b/usr.bin/at/panic.h
@@ -0,0 +1,32 @@
+/*
+ * panic.h - header for at(1)
+ * Copyright (C) 1993 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$
+ */
+
+#include <sys/cdefs.h>
+
+void panic(const char *a) __dead2;
+void perr(const char *a) __dead2;
+void usage(void) __dead2;
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c
new file mode 100644
index 0000000..0604a1c
--- /dev/null
+++ b/usr.bin/at/parsetime.c
@@ -0,0 +1,670 @@
+/*
+ * parsetime.c - parse time for at(1)
+ * Copyright (C) 1993, 1994 Thomas Koenig
+ *
+ * modifications for English-language times
+ * Copyright (C) 1993 David Parsons
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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.
+ *
+ * at [NOW] PLUS NUMBER MINUTES|HOURS|DAYS|WEEKS
+ * /NUMBER [DOT NUMBER] [AM|PM]\ /[MONTH NUMBER [NUMBER]] \
+ * |NOON | |[TOMORROW] |
+ * |MIDNIGHT | |[DAY OF WEEK] |
+ * \TEATIME / |NUMBER [SLASH NUMBER [SLASH NUMBER]]|
+ * \PLUS NUMBER MINUTES|HOURS|DAYS|WEEKS/
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* System Headers */
+
+#include <sys/types.h>
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#ifndef __FreeBSD__
+#include <getopt.h>
+#endif
+
+/* Local headers */
+
+#include "at.h"
+#include "panic.h"
+#include "parsetime.h"
+
+
+/* Structures and unions */
+
+enum { /* symbols */
+ MIDNIGHT, NOON, TEATIME,
+ PM, AM, TOMORROW, TODAY, NOW,
+ MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
+ NUMBER, PLUS, MINUS, DOT, SLASH, ID, JUNK,
+ JAN, FEB, MAR, APR, MAY, JUN,
+ JUL, AUG, SEP, OCT, NOV, DEC,
+ SUN, MON, TUE, WED, THU, FRI, SAT
+ };
+
+/* parse translation table - table driven parsers can be your FRIEND!
+ */
+static const struct {
+ const char *name; /* token name */
+ int value; /* token id */
+ int plural; /* is this plural? */
+} Specials[] = {
+ { "midnight", MIDNIGHT,0 }, /* 00:00:00 of today or tomorrow */
+ { "noon", NOON,0 }, /* 12:00:00 of today or tomorrow */
+ { "teatime", TEATIME,0 }, /* 16:00:00 of today or tomorrow */
+ { "am", AM,0 }, /* morning times for 0-12 clock */
+ { "pm", PM,0 }, /* evening times for 0-12 clock */
+ { "tomorrow", TOMORROW,0 }, /* execute 24 hours from time */
+ { "today", TODAY, 0 }, /* execute today - don't advance time */
+ { "now", NOW,0 }, /* opt prefix for PLUS */
+
+ { "minute", MINUTES,0 }, /* minutes multiplier */
+ { "minutes", MINUTES,1 }, /* (pluralized) */
+ { "hour", HOURS,0 }, /* hours ... */
+ { "hours", HOURS,1 }, /* (pluralized) */
+ { "day", DAYS,0 }, /* days ... */
+ { "days", DAYS,1 }, /* (pluralized) */
+ { "week", WEEKS,0 }, /* week ... */
+ { "weeks", WEEKS,1 }, /* (pluralized) */
+ { "month", MONTHS,0 }, /* month ... */
+ { "months", MONTHS,1 }, /* (pluralized) */
+ { "year", YEARS,0 }, /* year ... */
+ { "years", YEARS,1 }, /* (pluralized) */
+ { "jan", JAN,0 },
+ { "feb", FEB,0 },
+ { "mar", MAR,0 },
+ { "apr", APR,0 },
+ { "may", MAY,0 },
+ { "jun", JUN,0 },
+ { "jul", JUL,0 },
+ { "aug", AUG,0 },
+ { "sep", SEP,0 },
+ { "oct", OCT,0 },
+ { "nov", NOV,0 },
+ { "dec", DEC,0 },
+ { "january", JAN,0 },
+ { "february", FEB,0 },
+ { "march", MAR,0 },
+ { "april", APR,0 },
+ { "may", MAY,0 },
+ { "june", JUN,0 },
+ { "july", JUL,0 },
+ { "august", AUG,0 },
+ { "september", SEP,0 },
+ { "october", OCT,0 },
+ { "november", NOV,0 },
+ { "december", DEC,0 },
+ { "sunday", SUN, 0 },
+ { "sun", SUN, 0 },
+ { "monday", MON, 0 },
+ { "mon", MON, 0 },
+ { "tuesday", TUE, 0 },
+ { "tue", TUE, 0 },
+ { "wednesday", WED, 0 },
+ { "wed", WED, 0 },
+ { "thursday", THU, 0 },
+ { "thu", THU, 0 },
+ { "friday", FRI, 0 },
+ { "fri", FRI, 0 },
+ { "saturday", SAT, 0 },
+ { "sat", SAT, 0 },
+} ;
+
+/* File scope variables */
+
+static char **scp; /* scanner - pointer at arglist */
+static char scc; /* scanner - count of remaining arguments */
+static char *sct; /* scanner - next char pointer in current argument */
+static int need; /* scanner - need to advance to next argument */
+
+static char *sc_token; /* scanner - token buffer */
+static size_t sc_len; /* scanner - length of token buffer */
+static int sc_tokid; /* scanner - token id */
+static int sc_tokplur; /* scanner - is token plural? */
+
+/* Local functions */
+
+/*
+ * parse a token, checking if it's something special to us
+ */
+static int
+parse_token(char *arg)
+{
+ size_t i;
+
+ for (i=0; i<(sizeof Specials/sizeof Specials[0]); i++)
+ if (strcasecmp(Specials[i].name, arg) == 0) {
+ sc_tokplur = Specials[i].plural;
+ return sc_tokid = Specials[i].value;
+ }
+
+ /* not special - must be some random id */
+ return ID;
+} /* parse_token */
+
+
+/*
+ * init_scanner() sets up the scanner to eat arguments
+ */
+static void
+init_scanner(int argc, char **argv)
+{
+ scp = argv;
+ scc = argc;
+ need = 1;
+ sc_len = 1;
+ while (argc-- > 0)
+ sc_len += strlen(*argv++);
+
+ if ((sc_token = malloc(sc_len)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
+} /* init_scanner */
+
+/*
+ * token() fetches a token from the input stream
+ */
+static int
+token(void)
+{
+ int idx;
+
+ while (1) {
+ memset(sc_token, 0, sc_len);
+ sc_tokid = EOF;
+ sc_tokplur = 0;
+ idx = 0;
+
+ /* if we need to read another argument, walk along the argument list;
+ * when we fall off the arglist, we'll just return EOF forever
+ */
+ if (need) {
+ if (scc < 1)
+ return sc_tokid;
+ sct = *scp;
+ scp++;
+ scc--;
+ need = 0;
+ }
+ /* eat whitespace now - if we walk off the end of the argument,
+ * we'll continue, which puts us up at the top of the while loop
+ * to fetch the next argument in
+ */
+ while (isspace(*sct))
+ ++sct;
+ if (!*sct) {
+ need = 1;
+ continue;
+ }
+
+ /* preserve the first character of the new token
+ */
+ sc_token[0] = *sct++;
+
+ /* then see what it is
+ */
+ if (isdigit(sc_token[0])) {
+ while (isdigit(*sct))
+ sc_token[++idx] = *sct++;
+ sc_token[++idx] = 0;
+ return sc_tokid = NUMBER;
+ }
+ else if (isalpha(sc_token[0])) {
+ while (isalpha(*sct))
+ sc_token[++idx] = *sct++;
+ sc_token[++idx] = 0;
+ return parse_token(sc_token);
+ }
+ else if (sc_token[0] == ':' || sc_token[0] == '.')
+ return sc_tokid = DOT;
+ else if (sc_token[0] == '+')
+ return sc_tokid = PLUS;
+ else if (sc_token[0] == '-')
+ return sc_tokid = MINUS;
+ else if (sc_token[0] == '/')
+ return sc_tokid = SLASH;
+ else
+ return sc_tokid = JUNK;
+ } /* while (1) */
+} /* token */
+
+
+/*
+ * plonk() gives an appropriate error message if a token is incorrect
+ */
+static void
+plonk(int tok)
+{
+ panic((tok == EOF) ? "incomplete time"
+ : "garbled time");
+} /* plonk */
+
+
+/*
+ * expect() gets a token and dies most horribly if it's not the token we want
+ */
+static void
+expect(int desired)
+{
+ if (token() != desired)
+ plonk(sc_tokid); /* and we die here... */
+} /* expect */
+
+
+/*
+ * plus_or_minus() holds functionality common to plus() and minus()
+ */
+static void
+plus_or_minus(struct tm *tm, int delay)
+{
+ int expectplur;
+
+ expectplur = (delay != 1 && delay != -1) ? 1 : 0;
+
+ switch (token()) {
+ case YEARS:
+ tm->tm_year += delay;
+ break;
+ case MONTHS:
+ tm->tm_mon += delay;
+ break;
+ case WEEKS:
+ delay *= 7;
+ case DAYS:
+ tm->tm_mday += delay;
+ break;
+ case HOURS:
+ tm->tm_hour += delay;
+ break;
+ case MINUTES:
+ tm->tm_min += delay;
+ break;
+ default:
+ plonk(sc_tokid);
+ break;
+ }
+
+ if (expectplur != sc_tokplur)
+ warnx("pluralization is wrong");
+
+ tm->tm_isdst = -1;
+ if (mktime(tm) < 0)
+ plonk(sc_tokid);
+} /* plus_or_minus */
+
+
+/*
+ * plus() parses a now + time
+ *
+ * at [NOW] PLUS NUMBER [MINUTES|HOURS|DAYS|WEEKS|MONTHS|YEARS]
+ *
+ */
+static void
+plus(struct tm *tm)
+{
+ int delay;
+
+ expect(NUMBER);
+
+ delay = atoi(sc_token);
+ plus_or_minus(tm, delay);
+} /* plus */
+
+
+/*
+ * minus() is like plus but can not be used with NOW
+ */
+static void
+minus(struct tm *tm)
+{
+ int delay;
+
+ expect(NUMBER);
+
+ delay = -atoi(sc_token);
+ plus_or_minus(tm, delay);
+} /* minus */
+
+
+/*
+ * tod() computes the time of day
+ * [NUMBER [DOT NUMBER] [AM|PM]]
+ */
+static void
+tod(struct tm *tm)
+{
+ int hour, minute = 0;
+ int tlen;
+
+ hour = atoi(sc_token);
+ tlen = strlen(sc_token);
+
+ /* first pick out the time of day - if it's 4 digits, we assume
+ * a HHMM time, otherwise it's HH DOT MM time
+ */
+ if (token() == DOT) {
+ expect(NUMBER);
+ minute = atoi(sc_token);
+ if (minute > 59)
+ panic("garbled time");
+ token();
+ }
+ else if (tlen == 4) {
+ minute = hour%100;
+ if (minute > 59)
+ panic("garbled time");
+ hour = hour/100;
+ }
+
+ /* check if an AM or PM specifier was given
+ */
+ if (sc_tokid == AM || sc_tokid == PM) {
+ if (hour > 12)
+ panic("garbled time");
+
+ if (sc_tokid == PM) {
+ if (hour != 12) /* 12:xx PM is 12:xx, not 24:xx */
+ hour += 12;
+ } else {
+ if (hour == 12) /* 12:xx AM is 00:xx, not 12:xx */
+ hour = 0;
+ }
+ token();
+ }
+ else if (hour > 23)
+ panic("garbled time");
+
+ /* if we specify an absolute time, we don't want to bump the day even
+ * if we've gone past that time - but if we're specifying a time plus
+ * a relative offset, it's okay to bump things
+ */
+ if ((sc_tokid == EOF || sc_tokid == PLUS || sc_tokid == MINUS) &&
+ tm->tm_hour > hour) {
+ tm->tm_mday++;
+ tm->tm_wday++;
+ }
+
+ tm->tm_hour = hour;
+ tm->tm_min = minute;
+ if (tm->tm_hour == 24) {
+ tm->tm_hour = 0;
+ tm->tm_mday++;
+ }
+} /* tod */
+
+
+/*
+ * assign_date() assigns a date, wrapping to next year if needed
+ */
+static void
+assign_date(struct tm *tm, long mday, long mon, long year)
+{
+
+ /*
+ * Convert year into tm_year format (year - 1900).
+ * We may be given the year in 2 digit, 4 digit, or tm_year format.
+ */
+ if (year != -1) {
+ if (year >= 1900)
+ year -= 1900; /* convert from 4 digit year */
+ else if (year < 100) {
+ /* convert from 2 digit year */
+ struct tm *lt;
+ time_t now;
+
+ time(&now);
+ lt = localtime(&now);
+
+ /* Convert to tm_year assuming current century */
+ year += (lt->tm_year / 100) * 100;
+
+ if (year == lt->tm_year - 1) year++;
+ else if (year < lt->tm_year)
+ year += 100; /* must be in next century */
+ }
+ }
+
+ if (year < 0 &&
+ (tm->tm_mon > mon ||(tm->tm_mon == mon && tm->tm_mday > mday)))
+ year = tm->tm_year + 1;
+
+ tm->tm_mday = mday;
+ tm->tm_mon = mon;
+
+ if (year >= 0)
+ tm->tm_year = year;
+} /* assign_date */
+
+
+/*
+ * month() picks apart a month specification
+ *
+ * /[<month> NUMBER [NUMBER]] \
+ * |[TOMORROW] |
+ * |[DAY OF WEEK] |
+ * |NUMBER [SLASH NUMBER [SLASH NUMBER]]|
+ * \PLUS NUMBER MINUTES|HOURS|DAYS|WEEKS/
+ */
+static void
+month(struct tm *tm)
+{
+ long year= (-1);
+ long mday = 0, wday, mon;
+ int tlen;
+
+ switch (sc_tokid) {
+ case PLUS:
+ plus(tm);
+ break;
+ case MINUS:
+ minus(tm);
+ break;
+
+ case TOMORROW:
+ /* do something tomorrow */
+ tm->tm_mday ++;
+ tm->tm_wday ++;
+ case TODAY: /* force ourselves to stay in today - no further processing */
+ token();
+ break;
+
+ case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
+ case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
+ /* do month mday [year]
+ */
+ mon = (sc_tokid-JAN);
+ expect(NUMBER);
+ mday = atol(sc_token);
+ if (token() == NUMBER) {
+ year = atol(sc_token);
+ token();
+ }
+ assign_date(tm, mday, mon, year);
+ break;
+
+ case SUN: case MON: case TUE:
+ case WED: case THU: case FRI:
+ case SAT:
+ /* do a particular day of the week
+ */
+ wday = (sc_tokid-SUN);
+
+ mday = tm->tm_mday;
+
+ /* if this day is < today, then roll to next week
+ */
+ if (wday < tm->tm_wday)
+ mday += 7 - (tm->tm_wday - wday);
+ else
+ mday += (wday - tm->tm_wday);
+
+ tm->tm_wday = wday;
+
+ assign_date(tm, mday, tm->tm_mon, tm->tm_year);
+ break;
+
+ case NUMBER:
+ /* get numeric MMDDYY, mm/dd/yy, or dd.mm.yy
+ */
+ tlen = strlen(sc_token);
+ mon = atol(sc_token);
+ token();
+
+ if (sc_tokid == SLASH || sc_tokid == DOT) {
+ int sep;
+
+ sep = sc_tokid;
+ expect(NUMBER);
+ mday = atol(sc_token);
+ if (token() == sep) {
+ expect(NUMBER);
+ year = atol(sc_token);
+ token();
+ }
+
+ /* flip months and days for European timing
+ */
+ if (sep == DOT) {
+ int x = mday;
+ mday = mon;
+ mon = x;
+ }
+ }
+ else if (tlen == 6 || tlen == 8) {
+ if (tlen == 8) {
+ year = (mon % 10000) - 1900;
+ mon /= 10000;
+ }
+ else {
+ year = mon % 100;
+ mon /= 100;
+ }
+ mday = mon % 100;
+ mon /= 100;
+ }
+ else
+ panic("garbled time");
+
+ mon--;
+ if (mon < 0 || mon > 11 || mday < 1 || mday > 31)
+ panic("garbled time");
+
+ assign_date(tm, mday, mon, year);
+ break;
+ } /* case */
+} /* month */
+
+
+/* Global functions */
+
+time_t
+parsetime(int argc, char **argv)
+{
+/* Do the argument parsing, die if necessary, and return the time the job
+ * should be run.
+ */
+ time_t nowtimer, runtimer;
+ struct tm nowtime, runtime;
+ int hr = 0;
+ /* this MUST be initialized to zero for midnight/noon/teatime */
+
+ nowtimer = time(NULL);
+ nowtime = *localtime(&nowtimer);
+
+ runtime = nowtime;
+ runtime.tm_sec = 0;
+ runtime.tm_isdst = 0;
+
+ if (argc <= optind)
+ usage();
+
+ init_scanner(argc-optind, argv+optind);
+
+ switch (token()) {
+ case NOW:
+ if (scc < 1) {
+ return nowtimer;
+ }
+ /* now is optional prefix for PLUS tree */
+ expect(PLUS);
+ case PLUS:
+ plus(&runtime);
+ break;
+
+ /* MINUS is different from PLUS in that NOW is not
+ * an optional prefix for it
+ */
+ case MINUS:
+ minus(&runtime);
+ break;
+ case NUMBER:
+ tod(&runtime);
+ month(&runtime);
+ break;
+
+ /* evil coding for TEATIME|NOON|MIDNIGHT - we've initialised
+ * hr to zero up above, then fall into this case in such a
+ * way so we add +12 +4 hours to it for teatime, +12 hours
+ * to it for noon, and nothing at all for midnight, then
+ * set our runtime to that hour before leaping into the
+ * month scanner
+ */
+ case TEATIME:
+ hr += 4;
+ case NOON:
+ hr += 12;
+ case MIDNIGHT:
+ if (runtime.tm_hour >= hr) {
+ runtime.tm_mday++;
+ runtime.tm_wday++;
+ }
+ runtime.tm_hour = hr;
+ runtime.tm_min = 0;
+ token();
+ /* FALLTHROUGH to month setting */
+ default:
+ month(&runtime);
+ break;
+ } /* ugly case statement */
+ expect(EOF);
+
+ /* convert back to time_t
+ */
+ runtime.tm_isdst = -1;
+ runtimer = mktime(&runtime);
+
+ if (runtimer < 0)
+ panic("garbled time");
+
+ if (nowtimer > runtimer)
+ panic("trying to travel back in time");
+
+ return runtimer;
+} /* parsetime */
diff --git a/usr.bin/at/parsetime.h b/usr.bin/at/parsetime.h
new file mode 100644
index 0000000..30c3f20
--- /dev/null
+++ b/usr.bin/at/parsetime.h
@@ -0,0 +1,26 @@
+/*
+ * at.h - header for at(1)
+ * Copyright (C) 1993 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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.
+ */
+
+time_t parsetime(int argc, char **argv);
diff --git a/usr.bin/at/perm.c b/usr.bin/at/perm.c
new file mode 100644
index 0000000..91176b4
--- /dev/null
+++ b/usr.bin/at/perm.c
@@ -0,0 +1,124 @@
+/*
+ * perm.c - check user permission for at(1)
+ * Copyright (C) 1994 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$");
+
+/* System Headers */
+
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <pwd.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Local headers */
+
+#include "at.h"
+#include "perm.h"
+#include "privs.h"
+
+/* Macros */
+
+#define MAXUSERID 10
+
+/* Structures and unions */
+
+/* Function declarations */
+
+static int check_for_user(FILE *fp,const char *name);
+
+/* Local functions */
+
+static int check_for_user(FILE *fp,const char *name)
+{
+ char *buffer;
+ size_t len;
+ int found = 0;
+
+ len = strlen(name);
+ if ((buffer = malloc(len+2)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
+
+ while(fgets(buffer, len+2, fp) != NULL)
+ {
+ if ((strncmp(name, buffer, len) == 0) &&
+ (buffer[len] == '\n'))
+ {
+ found = 1;
+ break;
+ }
+ }
+ fclose(fp);
+ free(buffer);
+ return found;
+}
+/* Global functions */
+int check_permission(void)
+{
+ FILE *fp;
+ uid_t uid = geteuid();
+ struct passwd *pentry;
+
+ if (uid==0)
+ return 1;
+
+ if ((pentry = getpwuid(uid)) == NULL)
+ err(EXIT_FAILURE, "cannot access user database");
+
+ PRIV_START
+
+ fp=fopen(PERM_PATH "at.allow","r");
+
+ PRIV_END
+
+ if (fp != NULL)
+ {
+ return check_for_user(fp, pentry->pw_name);
+ }
+ else if (errno == ENOENT)
+ {
+
+ PRIV_START
+
+ fp=fopen(PERM_PATH "at.deny", "r");
+
+ PRIV_END
+
+ if (fp != NULL)
+ {
+ return !check_for_user(fp, pentry->pw_name);
+ }
+ else if (errno != ENOENT)
+ warn("at.deny");
+ }
+ else
+ warn("at.allow");
+ return 0;
+}
diff --git a/usr.bin/at/perm.h b/usr.bin/at/perm.h
new file mode 100644
index 0000000..b55b5fb
--- /dev/null
+++ b/usr.bin/at/perm.h
@@ -0,0 +1,28 @@
+/*
+ * perm.h - header for at(1)
+ * Copyright (C) 1994 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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$
+ */
+
+int check_permission(void);
diff --git a/usr.bin/at/privs.h b/usr.bin/at/privs.h
new file mode 100644
index 0000000..2b0d34a
--- /dev/null
+++ b/usr.bin/at/privs.h
@@ -0,0 +1,106 @@
+/*
+ * privs.h - header for privileged operations
+ * Copyright (C) 1993 Thomas Koenig
+ *
+ * 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. The name of the author(s) 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(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, WETHER 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 _PRIVS_H
+#define _PRIVS_H
+
+#include <unistd.h>
+
+/* Relinquish privileges temporarily for a setuid or setgid program
+ * with the option of getting them back later. This is done by
+ * utilizing POSIX saved user and group IDs. Call RELINQUISH_PRIVS once
+ * at the beginning of the main program. This will cause all operations
+ * to be executed with the real userid. When you need the privileges
+ * of the setuid/setgid invocation, call PRIV_START; when you no longer
+ * need it, call PRIV_END. Note that it is an error to call PRIV_START
+ * and not PRIV_END within the same function.
+ *
+ * Use RELINQUISH_PRIVS_ROOT(a,b) if your program started out running
+ * as root, and you want to drop back the effective userid to a
+ * and the effective group id to b, with the option to get them back
+ * later.
+ *
+ * If you no longer need root privileges, but those of some other
+ * userid/groupid, you can call REDUCE_PRIV(a,b) when your effective
+ * is the user's.
+ *
+ * Problems: Do not use return between PRIV_START and PRIV_END; this
+ * will cause the program to continue running in an unprivileged
+ * state.
+ *
+ * It is NOT safe to call exec(), system() or popen() with a user-
+ * supplied program (i.e. without carefully checking PATH and any
+ * library load paths) with relinquished privileges; the called program
+ * can acquire them just as easily. Set both effective and real userid
+ * to the real userid before calling any of them.
+ */
+
+extern uid_t real_uid, effective_uid;
+extern gid_t real_gid, effective_gid;
+
+#ifdef MAIN
+uid_t real_uid, effective_uid;
+gid_t real_gid, effective_gid;
+#endif
+
+#define RELINQUISH_PRIVS { \
+ real_uid = getuid(); \
+ effective_uid = geteuid(); \
+ real_gid = getgid(); \
+ effective_gid = getegid(); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
+}
+
+#define RELINQUISH_PRIVS_ROOT(a, b) { \
+ real_uid = (a); \
+ effective_uid = geteuid(); \
+ real_gid = (b); \
+ effective_gid = getegid(); \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
+}
+
+#define PRIV_START { \
+ if (seteuid(effective_uid) != 0) err(1, "seteuid failed"); \
+ if (setegid(effective_gid) != 0) err(1, "setegid failed"); \
+}
+
+#define PRIV_END { \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
+}
+
+#define REDUCE_PRIV(a, b) { \
+ PRIV_START \
+ effective_uid = (a); \
+ effective_gid = (b); \
+ if (setregid((gid_t)-1, effective_gid) != 0) err(1, "setregid failed"); \
+ if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \
+ PRIV_END \
+}
+#endif
diff --git a/usr.bin/atm/Makefile b/usr.bin/atm/Makefile
new file mode 100644
index 0000000..9ed46ef
--- /dev/null
+++ b/usr.bin/atm/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR= sscop
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/atm/Makefile.inc b/usr.bin/atm/Makefile.inc
new file mode 100644
index 0000000..265f86d
--- /dev/null
+++ b/usr.bin/atm/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
diff --git a/usr.bin/atm/sscop/Makefile b/usr.bin/atm/sscop/Makefile
new file mode 100644
index 0000000..cc688fd
--- /dev/null
+++ b/usr.bin/atm/sscop/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+CONTRIB= ${.CURDIR}/../../../contrib/ngatm/sscop
+
+.PATH: ${CONTRIB}
+
+PROG= sscop
+SRCS= common.c sscop_main.c
+CFLAGS+= -I${CONTRIB} -DUSE_LIBBEGEMOT
+
+LIBADD= begemot ngatm
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atm/sscop/Makefile.depend b/usr.bin/atm/sscop/Makefile.depend
new file mode 100644
index 0000000..a49eafb
--- /dev/null
+++ b/usr.bin/atm/sscop/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbegemot \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libngatm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile
new file mode 100644
index 0000000..f6c1baa
--- /dev/null
+++ b/usr.bin/awk/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+AWKSRC= ${.CURDIR}/../../contrib/one-true-awk
+.PATH: ${AWKSRC}
+
+PROG= awk
+SRCS= awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c ytab.h
+
+CFLAGS+= -DHAS_ISBLANK -I. -I${AWKSRC} -DFOPEN_MAX=64
+
+WARNS?= 1
+
+LIBADD= m
+
+LINKS= ${BINDIR}/awk ${BINDIR}/nawk
+MLINKS= awk.1 nawk.1
+
+CLEANFILES= maketab proctab.c ytab.h
+
+# XXX: awkgram.c isn't really needed here but it is added to keep
+# awkgram.h: .NOMETA respected.
+ytab.h: awkgram.c awkgram.h .NOMETA
+ ln -sf ${.ALLSRC:M*.h} ${.TARGET}
+
+proctab.c: maketab
+ ${BTOOLSPATH:U.}/maketab > proctab.c
+
+build-tools: maketab
+maketab: ytab.h ${AWKSRC}/maketab.c ${BUILD_TOOLS_META}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/awk/Makefile.depend b/usr.bin/awk/Makefile.depend
new file mode 100644
index 0000000..cb80454
--- /dev/null
+++ b/usr.bin/awk/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/banner/Makefile b/usr.bin/banner/Makefile
new file mode 100644
index 0000000..67d4ba7
--- /dev/null
+++ b/usr.bin/banner/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= banner
+MAN= banner.6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/banner/Makefile.depend b/usr.bin/banner/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/banner/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/banner/banner.6 b/usr.bin/banner/banner.6
new file mode 100644
index 0000000..090a3dc
--- /dev/null
+++ b/usr.bin/banner/banner.6
@@ -0,0 +1,78 @@
+.\" Copyright (c) 1980, 1993, 1995
+.\" 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.
+.\"
+.\" From: @(#)banner.6 8.2 (Berkeley) 4/29/95
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2005
+.Dt BANNER 6
+.Os
+.Sh NAME
+.Nm banner
+.Nd print large banner on printer
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Op Fl t
+.Op Fl w Ar width
+.Ar message ...
+.Sh DESCRIPTION
+.Nm Banner
+prints a large, high quality banner on the standard output.
+If the message is omitted, it prompts for and reads one line of its
+standard input.
+.Pp
+The output should be printed on paper of the appropriate width,
+with no breaks between the pages.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl d
+Enable debug.
+.It Fl t
+Enable trace.
+.It Fl w Ar width
+Change the output from a width of 132 to
+.Ar width ,
+suitable for a narrow terminal.
+.El
+.Sh AUTHORS
+.An Mark Horton
+.Sh BUGS
+Several
+.Tn ASCII
+characters are not defined, notably <, >, [, ], \\,
+^, _, {, }, |, and ~.
+Also, the characters ", ', and & are funny looking (but in a useful way.)
+.Pp
+The
+.Fl w
+option is implemented by skipping some rows and columns.
+The smaller it gets, the grainier the output.
+Sometimes it runs letters together.
+.Pp
+Messages are limited to 1024 characters in length.
diff --git a/usr.bin/banner/banner.c b/usr.bin/banner/banner.c
new file mode 100644
index 0000000..b363f72
--- /dev/null
+++ b/usr.bin/banner/banner.c
@@ -0,0 +1,1181 @@
+/*
+ * Copyright (c) 1980, 1993, 1994
+ * 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, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * banner - prints large signs
+ * banner [-w#] [-d] [-t] message ...
+ */
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MAXMSG 1024
+#define DWIDTH 132
+#define NCHARS 128
+#define NBYTES 9271
+
+/* Pointers into data_table for each ASCII char */
+static const int asc_ptr[NCHARS] = {
+/* ^@ */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* ^H */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* ^P */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* ^X */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* */ 1, 3, 50, 81, 104, 281, 483, 590,
+/* ( */ 621, 685, 749, 851, 862, 893, 898, 921,
+/* 0 */1019, 1150, 1200, 1419, 1599, 1744, 1934, 2111,
+/* 8 */2235, 2445, 2622, 2659, 0, 2708, 0, 2715,
+/* @ */2857, 3072, 3273, 3403, 3560, 3662, 3730, 3785,
+/* H */3965, 4000, 4015, 4115, 4281, 4314, 4432, 4548,
+/* P */4709, 4790, 4999, 5188, 5397, 5448, 5576, 5710,
+/* X */5892, 6106, 6257, 0, 0, 0, 0, 0,
+/* ` */ 50, 6503, 6642, 6733, 6837, 6930, 7073, 7157,
+/* h */7380, 7452, 7499, 7584, 7689, 7702, 7797, 7869,
+/* p */7978, 8069, 8160, 8222, 8381, 8442, 8508, 8605,
+/* x */8732, 8888, 9016, 0, 0, 0, 0, 0
+};
+
+/*
+ * Table of stuff to print. Format:
+ * 128+n -> print current line n times.
+ * 64+n -> this is last byte of char.
+ * else, put m chars at position n (where m
+ * is the next elt in array) and goto second
+ * next element in array.
+ */
+static const unsigned char data_table[NBYTES] = {
+/* 0 1 2 3 4 5 6 7 8 9 */
+/* 0 */ 129, 227, 130, 34, 6, 90, 19, 129, 32, 10,
+/* 10 */ 74, 40, 129, 31, 12, 64, 53, 129, 30, 14,
+/* 20 */ 54, 65, 129, 30, 14, 53, 67, 129, 30, 14,
+/* 30 */ 54, 65, 129, 31, 12, 64, 53, 129, 32, 10,
+/* 40 */ 74, 40, 129, 34, 6, 90, 19, 129, 194, 130,
+/* 50 */ 99, 9, 129, 97, 14, 129, 96, 18, 129, 95,
+/* 60 */ 22, 129, 95, 16, 117, 2, 129, 95, 14, 129,
+/* 70 */ 96, 11, 129, 97, 9, 129, 99, 6, 129, 194,
+/* 80 */ 129, 87, 4, 101, 4, 131, 82, 28, 131, 87,
+/* 90 */ 4, 101, 4, 133, 82, 28, 131, 87, 4, 101,
+/* 100 */ 4, 131, 193, 129, 39, 1, 84, 27, 129, 38,
+/* 110 */ 3, 81, 32, 129, 37, 5, 79, 35, 129, 36,
+/* 120 */ 5, 77, 38, 129, 35, 5, 76, 40, 129, 34,
+/* 130 */ 5, 75, 21, 103, 14, 129, 33, 5, 74, 19,
+/* 140 */ 107, 11, 129, 32, 5, 73, 17, 110, 9, 129,
+/* 150 */ 32, 4, 73, 16, 112, 7, 129, 31, 4, 72,
+/* 160 */ 15, 114, 6, 129, 31, 4, 72, 14, 115, 5,
+/* 170 */ 129, 30, 4, 71, 15, 116, 5, 129, 27, 97,
+/* 180 */ 131, 30, 4, 69, 14, 117, 4, 129, 30, 4,
+/* 190 */ 68, 15, 117, 4, 132, 30, 4, 68, 14, 117,
+/* 200 */ 4, 129, 27, 97, 131, 30, 5, 65, 15, 116,
+/* 210 */ 5, 129, 31, 4, 65, 14, 116, 4, 129, 31,
+/* 220 */ 6, 64, 15, 116, 4, 129, 32, 7, 62, 16,
+/* 230 */ 115, 4, 129, 32, 9, 61, 17, 114, 5, 129,
+/* 240 */ 33, 11, 58, 19, 113, 5, 129, 34, 14, 55,
+/* 250 */ 21, 112, 5, 129, 35, 40, 111, 5, 129, 36,
+/* 260 */ 38, 110, 5, 129, 37, 35, 109, 5, 129, 38,
+/* 270 */ 32, 110, 3, 129, 40, 27, 111, 1, 129, 193,
+/* 280 */ 129, 30, 4, 103, 9, 129, 30, 7, 100, 15,
+/* 290 */ 129, 30, 10, 99, 17, 129, 33, 10, 97, 6,
+/* 300 */ 112, 6, 129, 36, 10, 96, 5, 114, 5, 129,
+/* 310 */ 39, 10, 96, 4, 115, 4, 129, 42, 10, 95,
+/* 320 */ 4, 116, 4, 129, 45, 10, 95, 3, 117, 3,
+/* 330 */ 129, 48, 10, 95, 3, 117, 3, 129, 51, 10,
+/* 340 */ 95, 4, 116, 4, 129, 54, 10, 96, 4, 115,
+/* 350 */ 4, 129, 57, 10, 96, 5, 114, 5, 129, 60,
+/* 360 */ 10, 97, 6, 112, 6, 129, 63, 10, 99, 17,
+/* 370 */ 129, 66, 10, 100, 15, 129, 69, 10, 103, 9,
+/* 380 */ 129, 39, 9, 72, 10, 129, 36, 15, 75, 10,
+/* 390 */ 129, 35, 17, 78, 10, 129, 33, 6, 48, 6,
+/* 400 */ 81, 10, 129, 32, 5, 50, 5, 84, 10, 129,
+/* 410 */ 32, 4, 51, 4, 87, 10, 129, 31, 4, 52,
+/* 420 */ 4, 90, 10, 129, 31, 3, 53, 3, 93, 10,
+/* 430 */ 129, 31, 3, 53, 3, 96, 10, 129, 31, 4,
+/* 440 */ 52, 4, 99, 10, 129, 32, 4, 51, 4, 102,
+/* 450 */ 10, 129, 32, 5, 50, 5, 105, 10, 129, 33,
+/* 460 */ 6, 48, 6, 108, 10, 129, 35, 17, 111, 10,
+/* 470 */ 129, 36, 15, 114, 7, 129, 40, 9, 118, 4,
+/* 480 */ 129, 193, 129, 48, 18, 129, 43, 28, 129, 41,
+/* 490 */ 32, 129, 39, 36, 129, 37, 40, 129, 35, 44,
+/* 500 */ 129, 34, 46, 129, 33, 13, 68, 13, 129, 32,
+/* 510 */ 9, 73, 9, 129, 32, 7, 75, 7, 129, 31,
+/* 520 */ 6, 77, 6, 129, 31, 5, 78, 5, 129, 30,
+/* 530 */ 5, 79, 5, 129, 20, 74, 132, 30, 4, 80,
+/* 540 */ 4, 129, 31, 3, 79, 4, 129, 31, 4, 79,
+/* 550 */ 4, 129, 32, 3, 78, 4, 129, 32, 4, 76,
+/* 560 */ 6, 129, 33, 4, 74, 7, 129, 34, 4, 72,
+/* 570 */ 8, 129, 35, 5, 72, 7, 129, 37, 5, 73,
+/* 580 */ 4, 129, 39, 4, 74, 1, 129, 129, 193, 130,
+/* 590 */ 111, 6, 129, 109, 10, 129, 108, 12, 129, 107,
+/* 600 */ 14, 129, 97, 2, 105, 16, 129, 99, 22, 129,
+/* 610 */ 102, 18, 129, 105, 14, 129, 108, 9, 129, 194,
+/* 620 */ 130, 63, 25, 129, 57, 37, 129, 52, 47, 129,
+/* 630 */ 48, 55, 129, 44, 63, 129, 41, 69, 129, 38,
+/* 640 */ 75, 129, 36, 79, 129, 34, 83, 129, 33, 28,
+/* 650 */ 90, 28, 129, 32, 23, 96, 23, 129, 32, 17,
+/* 660 */ 102, 17, 129, 31, 13, 107, 13, 129, 30, 9,
+/* 670 */ 112, 9, 129, 30, 5, 116, 5, 129, 30, 1,
+/* 680 */ 120, 1, 129, 194, 130, 30, 1, 120, 1, 129,
+/* 690 */ 30, 5, 116, 5, 129, 30, 9, 112, 9, 129,
+/* 700 */ 31, 13, 107, 13, 129, 32, 17, 102, 17, 129,
+/* 710 */ 32, 23, 96, 23, 129, 33, 28, 90, 28, 129,
+/* 720 */ 34, 83, 129, 36, 79, 129, 38, 75, 129, 41,
+/* 730 */ 69, 129, 44, 63, 129, 48, 55, 129, 52, 47,
+/* 740 */ 129, 57, 37, 129, 63, 25, 129, 194, 129, 80,
+/* 750 */ 4, 130, 80, 4, 129, 68, 2, 80, 4, 94,
+/* 760 */ 2, 129, 66, 6, 80, 4, 92, 6, 129, 67,
+/* 770 */ 7, 80, 4, 90, 7, 129, 69, 7, 80, 4,
+/* 780 */ 88, 7, 129, 71, 6, 80, 4, 87, 6, 129,
+/* 790 */ 72, 20, 129, 74, 16, 129, 76, 12, 129, 62,
+/* 800 */ 40, 131, 76, 12, 129, 74, 16, 129, 72, 20,
+/* 810 */ 129, 71, 6, 80, 4, 87, 6, 129, 69, 7,
+/* 820 */ 80, 4, 88, 7, 129, 67, 7, 80, 4, 90,
+/* 830 */ 7, 129, 66, 6, 80, 4, 92, 6, 129, 68,
+/* 840 */ 2, 80, 4, 94, 2, 129, 80, 4, 130, 193,
+/* 850 */ 129, 60, 4, 139, 41, 42, 131, 60, 4, 139,
+/* 860 */ 193, 130, 34, 6, 129, 32, 10, 129, 31, 12,
+/* 870 */ 129, 30, 14, 129, 20, 2, 28, 16, 129, 22,
+/* 880 */ 22, 129, 24, 19, 129, 27, 15, 129, 31, 9,
+/* 890 */ 129, 194, 129, 60, 4, 152, 193, 130, 34, 6,
+/* 900 */ 129, 32, 10, 129, 31, 12, 129, 30, 14, 131,
+/* 910 */ 31, 12, 129, 32, 10, 129, 34, 6, 129, 194,
+/* 920 */ 129, 30, 4, 129, 30, 7, 129, 30, 10, 129,
+/* 930 */ 33, 10, 129, 36, 10, 129, 39, 10, 129, 42,
+/* 940 */ 10, 129, 45, 10, 129, 48, 10, 129, 51, 10,
+/* 950 */ 129, 54, 10, 129, 57, 10, 129, 60, 10, 129,
+/* 960 */ 63, 10, 129, 66, 10, 129, 69, 10, 129, 72,
+/* 970 */ 10, 129, 75, 10, 129, 78, 10, 129, 81, 10,
+/* 980 */ 129, 84, 10, 129, 87, 10, 129, 90, 10, 129,
+/* 990 */ 93, 10, 129, 96, 10, 129, 99, 10, 129, 102,
+/* 1000 */ 10, 129, 105, 10, 129, 108, 10, 129, 111, 10,
+/* 1010 */ 129, 114, 7, 129, 117, 4, 129, 193, 129, 60,
+/* 1020 */ 31, 129, 53, 45, 129, 49, 53, 129, 46, 59,
+/* 1030 */ 129, 43, 65, 129, 41, 69, 129, 39, 73, 129,
+/* 1040 */ 37, 77, 129, 36, 79, 129, 35, 15, 101, 15,
+/* 1050 */ 129, 34, 11, 106, 11, 129, 33, 9, 109, 9,
+/* 1060 */ 129, 32, 7, 112, 7, 129, 31, 6, 114, 6,
+/* 1070 */ 129, 31, 5, 115, 5, 129, 30, 5, 116, 5,
+/* 1080 */ 129, 30, 4, 117, 4, 132, 30, 5, 116, 5,
+/* 1090 */ 129, 31, 5, 115, 5, 129, 31, 6, 114, 6,
+/* 1100 */ 129, 32, 7, 112, 7, 129, 33, 9, 109, 9,
+/* 1110 */ 129, 34, 11, 106, 11, 129, 35, 15, 101, 15,
+/* 1120 */ 129, 36, 79, 129, 37, 77, 129, 39, 73, 129,
+/* 1130 */ 41, 69, 129, 43, 65, 129, 46, 59, 129, 49,
+/* 1140 */ 53, 129, 53, 45, 129, 60, 31, 129, 193, 129,
+/* 1150 */ 30, 4, 129, 30, 4, 100, 1, 129, 30, 4,
+/* 1160 */ 100, 3, 129, 30, 4, 100, 5, 129, 30, 76,
+/* 1170 */ 129, 30, 78, 129, 30, 80, 129, 30, 82, 129,
+/* 1180 */ 30, 83, 129, 30, 85, 129, 30, 87, 129, 30,
+/* 1190 */ 89, 129, 30, 91, 129, 30, 4, 132, 193, 129,
+/* 1200 */ 30, 3, 129, 30, 7, 129, 30, 10, 112, 1,
+/* 1210 */ 129, 30, 13, 112, 2, 129, 30, 16, 112, 3,
+/* 1220 */ 129, 30, 18, 111, 5, 129, 30, 21, 111, 6,
+/* 1230 */ 129, 30, 23, 112, 6, 129, 30, 14, 47, 8,
+/* 1240 */ 113, 6, 129, 30, 14, 49, 8, 114, 5, 129,
+/* 1250 */ 30, 14, 51, 8, 115, 5, 129, 30, 14, 53,
+/* 1260 */ 8, 116, 4, 129, 30, 14, 55, 8, 116, 5,
+/* 1270 */ 129, 30, 14, 56, 9, 117, 4, 129, 30, 14,
+/* 1280 */ 57, 9, 117, 4, 129, 30, 14, 58, 10, 117,
+/* 1290 */ 4, 129, 30, 14, 59, 10, 117, 4, 129, 30,
+/* 1300 */ 14, 60, 11, 117, 4, 129, 30, 14, 61, 11,
+/* 1310 */ 116, 5, 129, 30, 14, 62, 11, 116, 5, 129,
+/* 1320 */ 30, 14, 63, 12, 115, 6, 129, 30, 14, 64,
+/* 1330 */ 13, 114, 7, 129, 30, 14, 65, 13, 113, 8,
+/* 1340 */ 129, 30, 14, 65, 15, 111, 9, 129, 30, 14,
+/* 1350 */ 66, 16, 109, 11, 129, 30, 14, 67, 17, 107,
+/* 1360 */ 12, 129, 30, 14, 68, 20, 103, 16, 129, 30,
+/* 1370 */ 14, 69, 49, 129, 30, 14, 70, 47, 129, 30,
+/* 1380 */ 14, 71, 45, 129, 30, 14, 73, 42, 129, 30,
+/* 1390 */ 15, 75, 38, 129, 33, 12, 77, 34, 129, 36,
+/* 1400 */ 10, 79, 30, 129, 40, 6, 82, 23, 129, 44,
+/* 1410 */ 3, 86, 15, 129, 47, 1, 129, 193, 129, 129,
+/* 1420 */ 38, 3, 129, 37, 5, 111, 1, 129, 36, 7,
+/* 1430 */ 111, 2, 129, 35, 9, 110, 5, 129, 34, 8,
+/* 1440 */ 110, 6, 129, 33, 7, 109, 8, 129, 32, 7,
+/* 1450 */ 110, 8, 129, 32, 6, 112, 7, 129, 31, 6,
+/* 1460 */ 113, 6, 129, 31, 5, 114, 6, 129, 30, 5,
+/* 1470 */ 115, 5, 129, 30, 5, 116, 4, 129, 30, 4,
+/* 1480 */ 117, 4, 131, 30, 4, 117, 4, 129, 30, 4,
+/* 1490 */ 79, 2, 117, 4, 129, 30, 5, 78, 4, 117,
+/* 1500 */ 4, 129, 30, 5, 77, 6, 116, 5, 129, 30,
+/* 1510 */ 6, 76, 8, 115, 6, 129, 30, 7, 75, 11,
+/* 1520 */ 114, 6, 129, 30, 8, 73, 15, 112, 8, 129,
+/* 1530 */ 31, 9, 71, 19, 110, 9, 129, 31, 11, 68,
+/* 1540 */ 26, 107, 12, 129, 32, 13, 65, 14, 82, 36,
+/* 1550 */ 129, 32, 16, 61, 17, 83, 34, 129, 33, 44,
+/* 1560 */ 84, 32, 129, 34, 42, 85, 30, 129, 35, 40,
+/* 1570 */ 87, 27, 129, 36, 38, 89, 23, 129, 38, 34,
+/* 1580 */ 92, 17, 129, 40, 30, 95, 11, 129, 42, 26,
+/* 1590 */ 129, 45, 20, 129, 49, 11, 129, 193, 129, 49,
+/* 1600 */ 1, 129, 49, 4, 129, 49, 6, 129, 49, 8,
+/* 1610 */ 129, 49, 10, 129, 49, 12, 129, 49, 14, 129,
+/* 1620 */ 49, 17, 129, 49, 19, 129, 49, 21, 129, 49,
+/* 1630 */ 23, 129, 49, 14, 65, 9, 129, 49, 14, 67,
+/* 1640 */ 9, 129, 49, 14, 69, 9, 129, 49, 14, 71,
+/* 1650 */ 10, 129, 49, 14, 74, 9, 129, 49, 14, 76,
+/* 1660 */ 9, 129, 49, 14, 78, 9, 129, 49, 14, 80,
+/* 1670 */ 9, 129, 49, 14, 82, 9, 129, 49, 14, 84,
+/* 1680 */ 9, 129, 30, 4, 49, 14, 86, 10, 129, 30,
+/* 1690 */ 4, 49, 14, 89, 9, 129, 30, 4, 49, 14,
+/* 1700 */ 91, 9, 129, 30, 4, 49, 14, 93, 9, 129,
+/* 1710 */ 30, 74, 129, 30, 76, 129, 30, 78, 129, 30,
+/* 1720 */ 81, 129, 30, 83, 129, 30, 85, 129, 30, 87,
+/* 1730 */ 129, 30, 89, 129, 30, 91, 129, 30, 4, 49,
+/* 1740 */ 14, 132, 193, 129, 37, 1, 129, 36, 3, 77,
+/* 1750 */ 3, 129, 35, 5, 78, 11, 129, 34, 7, 78,
+/* 1760 */ 21, 129, 33, 7, 79, 29, 129, 32, 7, 79,
+/* 1770 */ 38, 129, 32, 6, 80, 4, 92, 29, 129, 31,
+/* 1780 */ 6, 80, 5, 102, 19, 129, 31, 5, 80, 6,
+/* 1790 */ 107, 14, 129, 31, 4, 81, 5, 107, 14, 129,
+/* 1800 */ 30, 5, 81, 6, 107, 14, 129, 30, 4, 81,
+/* 1810 */ 6, 107, 14, 130, 30, 4, 81, 7, 107, 14,
+/* 1820 */ 129, 30, 4, 80, 8, 107, 14, 130, 30, 5,
+/* 1830 */ 80, 8, 107, 14, 129, 30, 5, 79, 9, 107,
+/* 1840 */ 14, 129, 31, 5, 79, 9, 107, 14, 129, 31,
+/* 1850 */ 6, 78, 10, 107, 14, 129, 32, 6, 76, 11,
+/* 1860 */ 107, 14, 129, 32, 8, 74, 13, 107, 14, 129,
+/* 1870 */ 33, 10, 71, 16, 107, 14, 129, 33, 15, 67,
+/* 1880 */ 19, 107, 14, 129, 34, 51, 107, 14, 129, 35,
+/* 1890 */ 49, 107, 14, 129, 36, 47, 107, 14, 129, 37,
+/* 1900 */ 45, 107, 14, 129, 39, 41, 107, 14, 129, 41,
+/* 1910 */ 37, 107, 14, 129, 44, 32, 107, 14, 129, 47,
+/* 1920 */ 25, 111, 10, 129, 51, 16, 115, 6, 129, 119,
+/* 1930 */ 2, 129, 193, 129, 56, 39, 129, 51, 49, 129,
+/* 1940 */ 47, 57, 129, 44, 63, 129, 42, 67, 129, 40,
+/* 1950 */ 71, 129, 38, 75, 129, 37, 77, 129, 35, 81,
+/* 1960 */ 129, 34, 16, 74, 5, 101, 16, 129, 33, 11,
+/* 1970 */ 76, 5, 107, 11, 129, 32, 9, 77, 5, 110,
+/* 1980 */ 9, 129, 32, 7, 79, 4, 112, 7, 129, 31,
+/* 1990 */ 6, 80, 4, 114, 6, 129, 31, 5, 81, 4,
+/* 2000 */ 115, 5, 129, 30, 5, 82, 4, 116, 5, 129,
+/* 2010 */ 30, 4, 82, 4, 116, 5, 129, 30, 4, 82,
+/* 2020 */ 5, 117, 4, 131, 30, 5, 82, 5, 117, 4,
+/* 2030 */ 129, 31, 5, 81, 6, 117, 4, 129, 31, 6,
+/* 2040 */ 80, 7, 117, 4, 129, 32, 7, 79, 8, 117,
+/* 2050 */ 4, 129, 32, 9, 77, 9, 116, 5, 129, 33,
+/* 2060 */ 11, 75, 11, 116, 4, 129, 34, 16, 69, 16,
+/* 2070 */ 115, 5, 129, 35, 49, 114, 5, 129, 37, 46,
+/* 2080 */ 113, 5, 129, 38, 44, 112, 6, 129, 40, 41,
+/* 2090 */ 112, 5, 129, 42, 37, 113, 3, 129, 44, 33,
+/* 2100 */ 114, 1, 129, 47, 27, 129, 51, 17, 129, 193,
+/* 2110 */ 129, 103, 2, 129, 103, 6, 129, 104, 9, 129,
+/* 2120 */ 105, 12, 129, 106, 15, 129, 107, 14, 135, 30,
+/* 2130 */ 10, 107, 14, 129, 30, 17, 107, 14, 129, 30,
+/* 2140 */ 25, 107, 14, 129, 30, 31, 107, 14, 129, 30,
+/* 2150 */ 37, 107, 14, 129, 30, 42, 107, 14, 129, 30,
+/* 2160 */ 46, 107, 14, 129, 30, 50, 107, 14, 129, 30,
+/* 2170 */ 54, 107, 14, 129, 30, 58, 107, 14, 129, 59,
+/* 2180 */ 32, 107, 14, 129, 64, 30, 107, 14, 129, 74,
+/* 2190 */ 23, 107, 14, 129, 81, 18, 107, 14, 129, 86,
+/* 2200 */ 16, 107, 14, 129, 91, 14, 107, 14, 129, 96,
+/* 2210 */ 25, 129, 100, 21, 129, 104, 17, 129, 107, 14,
+/* 2220 */ 129, 111, 10, 129, 114, 7, 129, 117, 4, 129,
+/* 2230 */ 120, 1, 129, 193, 129, 48, 13, 129, 44, 21,
+/* 2240 */ 129, 42, 26, 129, 40, 30, 92, 12, 129, 38,
+/* 2250 */ 34, 88, 20, 129, 36, 37, 86, 25, 129, 35,
+/* 2260 */ 39, 84, 29, 129, 34, 13, 63, 12, 82, 33,
+/* 2270 */ 129, 33, 11, 67, 9, 80, 36, 129, 32, 9,
+/* 2280 */ 70, 7, 79, 38, 129, 31, 8, 72, 46, 129,
+/* 2290 */ 30, 7, 74, 22, 108, 11, 129, 30, 6, 75,
+/* 2300 */ 19, 111, 9, 129, 30, 5, 75, 17, 113, 7,
+/* 2310 */ 129, 30, 5, 74, 16, 114, 6, 129, 30, 4,
+/* 2320 */ 73, 16, 115, 6, 129, 30, 4, 72, 16, 116,
+/* 2330 */ 5, 129, 30, 4, 72, 15, 117, 4, 129, 30,
+/* 2340 */ 4, 71, 16, 117, 4, 129, 30, 5, 70, 16,
+/* 2350 */ 117, 4, 129, 30, 5, 70, 15, 117, 4, 129,
+/* 2360 */ 30, 6, 69, 15, 116, 5, 129, 30, 7, 68,
+/* 2370 */ 17, 115, 5, 129, 30, 9, 67, 19, 114, 6,
+/* 2380 */ 129, 30, 10, 65, 22, 113, 6, 129, 31, 12,
+/* 2390 */ 63, 27, 110, 9, 129, 32, 14, 60, 21, 84,
+/* 2400 */ 9, 106, 12, 129, 33, 47, 85, 32, 129, 34,
+/* 2410 */ 45, 86, 30, 129, 35, 43, 88, 26, 129, 36,
+/* 2420 */ 40, 90, 22, 129, 38, 36, 93, 17, 129, 40,
+/* 2430 */ 32, 96, 10, 129, 42, 28, 129, 44, 23, 129,
+/* 2440 */ 48, 15, 129, 193, 129, 83, 17, 129, 77, 27,
+/* 2450 */ 129, 36, 1, 74, 33, 129, 35, 3, 72, 37,
+/* 2460 */ 129, 34, 5, 70, 41, 129, 33, 6, 69, 44,
+/* 2470 */ 129, 33, 5, 68, 46, 129, 32, 5, 67, 49,
+/* 2480 */ 129, 31, 5, 66, 17, 101, 16, 129, 31, 5,
+/* 2490 */ 66, 11, 108, 10, 129, 30, 4, 65, 9, 110,
+/* 2500 */ 9, 129, 30, 4, 64, 8, 112, 7, 129, 30,
+/* 2510 */ 4, 64, 7, 114, 6, 129, 30, 4, 64, 6,
+/* 2520 */ 115, 5, 129, 30, 4, 64, 5, 116, 5, 129,
+/* 2530 */ 30, 4, 64, 5, 117, 4, 131, 30, 4, 65,
+/* 2540 */ 4, 117, 4, 129, 30, 5, 65, 4, 116, 5,
+/* 2550 */ 129, 31, 5, 66, 4, 115, 5, 129, 31, 6,
+/* 2560 */ 67, 4, 114, 6, 129, 32, 7, 68, 4, 112,
+/* 2570 */ 7, 129, 32, 9, 69, 5, 110, 9, 129, 33,
+/* 2580 */ 11, 70, 5, 107, 11, 129, 34, 16, 72, 5,
+/* 2590 */ 101, 16, 129, 35, 81, 129, 37, 77, 129, 38,
+/* 2600 */ 75, 129, 40, 71, 129, 42, 67, 129, 44, 63,
+/* 2610 */ 129, 47, 57, 129, 51, 49, 129, 56, 39, 129,
+/* 2620 */ 193, 130, 34, 6, 74, 6, 129, 32, 10, 72,
+/* 2630 */ 10, 129, 31, 12, 71, 12, 129, 30, 14, 70,
+/* 2640 */ 14, 131, 31, 12, 71, 12, 129, 32, 10, 72,
+/* 2650 */ 10, 129, 34, 6, 74, 6, 129, 194, 130, 34,
+/* 2660 */ 6, 74, 6, 129, 32, 10, 72, 10, 129, 31,
+/* 2670 */ 12, 71, 12, 129, 30, 14, 70, 14, 129, 20,
+/* 2680 */ 2, 28, 16, 70, 14, 129, 22, 22, 70, 14,
+/* 2690 */ 129, 24, 19, 71, 12, 129, 27, 15, 72, 10,
+/* 2700 */ 129, 31, 9, 74, 6, 129, 194, 129, 53, 4,
+/* 2710 */ 63, 4, 152, 193, 130, 99, 7, 129, 97, 13,
+/* 2720 */ 129, 96, 16, 129, 96, 18, 129, 96, 19, 129,
+/* 2730 */ 97, 19, 129, 99, 6, 110, 7, 129, 112, 6,
+/* 2740 */ 129, 114, 5, 129, 34, 6, 57, 5, 115, 4,
+/* 2750 */ 129, 32, 10, 54, 12, 116, 4, 129, 31, 12,
+/* 2760 */ 53, 16, 117, 3, 129, 30, 14, 52, 20, 117,
+/* 2770 */ 4, 129, 30, 14, 52, 23, 117, 4, 129, 30,
+/* 2780 */ 14, 52, 25, 117, 4, 129, 31, 12, 52, 27,
+/* 2790 */ 117, 4, 129, 32, 10, 53, 10, 70, 11, 116,
+/* 2800 */ 5, 129, 34, 6, 55, 5, 73, 10, 115, 6,
+/* 2810 */ 129, 74, 11, 114, 7, 129, 75, 12, 112, 9,
+/* 2820 */ 129, 76, 13, 110, 10, 129, 77, 16, 106, 14,
+/* 2830 */ 129, 78, 41, 129, 80, 38, 129, 81, 36, 129,
+/* 2840 */ 82, 34, 129, 84, 30, 129, 86, 26, 129, 88,
+/* 2850 */ 22, 129, 92, 14, 129, 194, 129, 55, 15, 129,
+/* 2860 */ 50, 25, 129, 47, 32, 129, 45, 13, 70, 12,
+/* 2870 */ 129, 43, 9, 76, 10, 129, 42, 6, 79, 8,
+/* 2880 */ 129, 41, 5, 81, 7, 129, 40, 4, 84, 6,
+/* 2890 */ 129, 39, 4, 59, 12, 85, 6, 129, 38, 4,
+/* 2900 */ 55, 19, 87, 5, 129, 37, 4, 53, 23, 88,
+/* 2910 */ 4, 129, 36, 4, 51, 8, 71, 6, 89, 4,
+/* 2920 */ 129, 36, 4, 51, 6, 73, 4, 89, 4, 129,
+/* 2930 */ 36, 4, 50, 6, 74, 4, 90, 3, 129, 35,
+/* 2940 */ 4, 50, 5, 75, 3, 90, 4, 129, 35, 4,
+/* 2950 */ 50, 4, 75, 4, 90, 4, 131, 35, 4, 50,
+/* 2960 */ 5, 75, 4, 90, 4, 129, 36, 4, 51, 5,
+/* 2970 */ 75, 4, 90, 4, 129, 36, 4, 51, 6, 75,
+/* 2980 */ 4, 90, 4, 129, 36, 4, 53, 26, 90, 4,
+/* 2990 */ 129, 37, 4, 54, 25, 90, 4, 129, 37, 4,
+/* 3000 */ 52, 27, 90, 3, 129, 38, 4, 52, 4, 89,
+/* 3010 */ 4, 129, 39, 4, 51, 4, 88, 4, 129, 40,
+/* 3020 */ 4, 50, 4, 87, 5, 129, 41, 4, 50, 4,
+/* 3030 */ 86, 5, 129, 42, 4, 50, 4, 85, 5, 129,
+/* 3040 */ 43, 3, 50, 4, 83, 6, 129, 44, 2, 51,
+/* 3050 */ 5, 80, 7, 129, 46, 1, 52, 6, 76, 9,
+/* 3060 */ 129, 54, 28, 129, 56, 23, 129, 60, 16, 129,
+/* 3070 */ 193, 129, 30, 4, 132, 30, 5, 129, 30, 8,
+/* 3080 */ 129, 30, 12, 129, 30, 16, 129, 30, 4, 37,
+/* 3090 */ 12, 129, 30, 4, 41, 12, 129, 30, 4, 44,
+/* 3100 */ 13, 129, 30, 4, 48, 13, 129, 52, 13, 129,
+/* 3110 */ 56, 12, 129, 58, 14, 129, 58, 4, 64, 12,
+/* 3120 */ 129, 58, 4, 68, 12, 129, 58, 4, 72, 12,
+/* 3130 */ 129, 58, 4, 75, 13, 129, 58, 4, 79, 13,
+/* 3140 */ 129, 58, 4, 83, 13, 129, 58, 4, 87, 13,
+/* 3150 */ 129, 58, 4, 91, 12, 129, 58, 4, 95, 12,
+/* 3160 */ 129, 58, 4, 96, 15, 129, 58, 4, 93, 22,
+/* 3170 */ 129, 58, 4, 89, 30, 129, 58, 4, 85, 36,
+/* 3180 */ 129, 58, 4, 81, 38, 129, 58, 4, 77, 38,
+/* 3190 */ 129, 58, 4, 73, 38, 129, 58, 4, 70, 37,
+/* 3200 */ 129, 58, 4, 66, 37, 129, 58, 41, 129, 58,
+/* 3210 */ 37, 129, 54, 38, 129, 30, 4, 50, 38, 129,
+/* 3220 */ 30, 4, 46, 38, 129, 30, 4, 42, 38, 129,
+/* 3230 */ 30, 4, 38, 39, 129, 30, 43, 129, 30, 39,
+/* 3240 */ 129, 30, 35, 129, 30, 31, 129, 30, 27, 129,
+/* 3250 */ 30, 24, 129, 30, 20, 129, 30, 16, 129, 30,
+/* 3260 */ 12, 129, 30, 8, 129, 30, 5, 129, 30, 4,
+/* 3270 */ 132, 193, 129, 30, 4, 117, 4, 132, 30, 91,
+/* 3280 */ 137, 30, 4, 80, 4, 117, 4, 138, 30, 4,
+/* 3290 */ 80, 5, 116, 5, 129, 30, 5, 79, 6, 116,
+/* 3300 */ 5, 130, 30, 6, 78, 8, 115, 6, 129, 31,
+/* 3310 */ 6, 77, 9, 115, 6, 129, 31, 7, 76, 11,
+/* 3320 */ 114, 6, 129, 31, 8, 75, 14, 112, 8, 129,
+/* 3330 */ 32, 8, 74, 16, 111, 9, 129, 32, 9, 73,
+/* 3340 */ 19, 109, 10, 129, 33, 10, 71, 24, 106, 13,
+/* 3350 */ 129, 33, 13, 68, 12, 83, 35, 129, 34, 16,
+/* 3360 */ 64, 15, 84, 33, 129, 35, 43, 85, 31, 129,
+/* 3370 */ 36, 41, 86, 29, 129, 37, 39, 88, 25, 129,
+/* 3380 */ 38, 37, 90, 21, 129, 40, 33, 93, 15, 129,
+/* 3390 */ 42, 29, 96, 9, 129, 45, 24, 129, 49, 16,
+/* 3400 */ 129, 193, 129, 63, 25, 129, 57, 37, 129, 53,
+/* 3410 */ 45, 129, 50, 51, 129, 47, 57, 129, 45, 61,
+/* 3420 */ 129, 43, 65, 129, 41, 69, 129, 39, 73, 129,
+/* 3430 */ 38, 25, 92, 21, 129, 36, 21, 97, 18, 129,
+/* 3440 */ 35, 18, 102, 14, 129, 34, 16, 106, 11, 129,
+/* 3450 */ 33, 14, 108, 10, 129, 32, 12, 111, 8, 129,
+/* 3460 */ 32, 10, 113, 6, 129, 31, 10, 114, 6, 129,
+/* 3470 */ 31, 8, 115, 5, 129, 30, 8, 116, 5, 129,
+/* 3480 */ 30, 7, 116, 5, 129, 30, 6, 117, 4, 130,
+/* 3490 */ 30, 5, 117, 4, 131, 31, 4, 116, 5, 129,
+/* 3500 */ 32, 4, 116, 4, 129, 32, 5, 115, 5, 129,
+/* 3510 */ 33, 4, 114, 5, 129, 34, 4, 112, 6, 129,
+/* 3520 */ 35, 4, 110, 7, 129, 37, 4, 107, 9, 129,
+/* 3530 */ 39, 4, 103, 12, 129, 41, 4, 103, 18, 129,
+/* 3540 */ 43, 4, 103, 18, 129, 45, 5, 103, 18, 129,
+/* 3550 */ 48, 5, 103, 18, 129, 51, 1, 129, 193, 129,
+/* 3560 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
+/* 3570 */ 117, 4, 135, 30, 5, 116, 5, 130, 30, 6,
+/* 3580 */ 115, 6, 130, 31, 6, 114, 6, 129, 31, 7,
+/* 3590 */ 113, 7, 129, 32, 7, 112, 7, 129, 32, 8,
+/* 3600 */ 111, 8, 129, 33, 9, 109, 9, 129, 33, 12,
+/* 3610 */ 106, 12, 129, 34, 13, 104, 13, 129, 35, 15,
+/* 3620 */ 101, 15, 129, 36, 19, 96, 19, 129, 37, 24,
+/* 3630 */ 90, 24, 129, 39, 73, 129, 40, 71, 129, 42,
+/* 3640 */ 67, 129, 44, 63, 129, 46, 59, 129, 49, 53,
+/* 3650 */ 129, 52, 47, 129, 56, 39, 129, 61, 29, 129,
+/* 3660 */ 193, 129, 30, 4, 117, 4, 132, 30, 91, 137,
+/* 3670 */ 30, 4, 80, 4, 117, 4, 140, 30, 4, 79,
+/* 3680 */ 6, 117, 4, 129, 30, 4, 77, 10, 117, 4,
+/* 3690 */ 129, 30, 4, 73, 18, 117, 4, 132, 30, 4,
+/* 3700 */ 117, 4, 130, 30, 5, 116, 5, 130, 30, 7,
+/* 3710 */ 114, 7, 129, 30, 8, 113, 8, 129, 30, 11,
+/* 3720 */ 110, 11, 129, 30, 18, 103, 18, 132, 193, 129,
+/* 3730 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
+/* 3740 */ 80, 4, 117, 4, 132, 80, 4, 117, 4, 136,
+/* 3750 */ 79, 6, 117, 4, 129, 77, 10, 117, 4, 129,
+/* 3760 */ 73, 18, 117, 4, 132, 117, 4, 130, 116, 5,
+/* 3770 */ 130, 114, 7, 129, 113, 8, 129, 110, 11, 129,
+/* 3780 */ 103, 18, 132, 193, 129, 63, 25, 129, 57, 37,
+/* 3790 */ 129, 53, 45, 129, 50, 51, 129, 47, 57, 129,
+/* 3800 */ 45, 61, 129, 43, 65, 129, 41, 69, 129, 39,
+/* 3810 */ 73, 129, 38, 25, 92, 21, 129, 36, 21, 97,
+/* 3820 */ 18, 129, 35, 18, 102, 14, 129, 34, 16, 106,
+/* 3830 */ 11, 129, 33, 14, 108, 10, 129, 32, 12, 111,
+/* 3840 */ 8, 129, 32, 10, 113, 6, 129, 31, 10, 114,
+/* 3850 */ 6, 129, 31, 8, 115, 5, 129, 30, 8, 116,
+/* 3860 */ 5, 129, 30, 7, 116, 5, 129, 30, 6, 117,
+/* 3870 */ 4, 130, 30, 5, 117, 4, 131, 30, 5, 75,
+/* 3880 */ 4, 116, 5, 129, 31, 5, 75, 4, 116, 4,
+/* 3890 */ 129, 31, 6, 75, 4, 115, 5, 129, 32, 7,
+/* 3900 */ 75, 4, 114, 5, 129, 32, 9, 75, 4, 112,
+/* 3910 */ 6, 129, 33, 11, 75, 4, 110, 7, 129, 34,
+/* 3920 */ 15, 75, 4, 107, 9, 129, 35, 44, 103, 12,
+/* 3930 */ 129, 36, 43, 103, 18, 129, 38, 41, 103, 18,
+/* 3940 */ 129, 39, 40, 103, 18, 129, 41, 38, 103, 18,
+/* 3950 */ 129, 44, 35, 129, 48, 31, 129, 52, 27, 129,
+/* 3960 */ 61, 18, 129, 193, 129, 30, 4, 117, 4, 132,
+/* 3970 */ 30, 91, 137, 30, 4, 80, 4, 117, 4, 132,
+/* 3980 */ 80, 4, 140, 30, 4, 80, 4, 117, 4, 132,
+/* 3990 */ 30, 91, 137, 30, 4, 117, 4, 132, 193, 129,
+/* 4000 */ 30, 4, 117, 4, 132, 30, 91, 137, 30, 4,
+/* 4010 */ 117, 4, 132, 193, 129, 44, 7, 129, 40, 13,
+/* 4020 */ 129, 37, 17, 129, 35, 20, 129, 34, 22, 129,
+/* 4030 */ 33, 23, 129, 32, 24, 129, 32, 23, 129, 31,
+/* 4040 */ 6, 41, 13, 129, 31, 5, 42, 11, 129, 30,
+/* 4050 */ 5, 44, 7, 129, 30, 4, 132, 30, 5, 130,
+/* 4060 */ 31, 5, 129, 31, 6, 117, 4, 129, 31, 8,
+/* 4070 */ 117, 4, 129, 32, 9, 117, 4, 129, 33, 11,
+/* 4080 */ 117, 4, 129, 34, 87, 129, 35, 86, 129, 36,
+/* 4090 */ 85, 129, 37, 84, 129, 38, 83, 129, 40, 81,
+/* 4100 */ 129, 42, 79, 129, 45, 76, 129, 50, 71, 129,
+/* 4110 */ 117, 4, 132, 193, 129, 30, 4, 117, 4, 132,
+/* 4120 */ 30, 91, 137, 30, 4, 76, 8, 117, 4, 129,
+/* 4130 */ 30, 4, 73, 13, 117, 4, 129, 30, 4, 70,
+/* 4140 */ 18, 117, 4, 129, 30, 4, 67, 23, 117, 4,
+/* 4150 */ 129, 65, 26, 129, 62, 31, 129, 59, 35, 129,
+/* 4160 */ 56, 29, 89, 7, 129, 53, 29, 91, 7, 129,
+/* 4170 */ 50, 29, 93, 7, 129, 47, 29, 95, 6, 129,
+/* 4180 */ 30, 4, 45, 29, 96, 7, 129, 30, 4, 42,
+/* 4190 */ 29, 98, 7, 129, 30, 4, 39, 30, 100, 6,
+/* 4200 */ 129, 30, 4, 36, 30, 101, 7, 129, 30, 33,
+/* 4210 */ 103, 7, 117, 4, 129, 30, 30, 105, 6, 117,
+/* 4220 */ 4, 129, 30, 27, 106, 7, 117, 4, 129, 30,
+/* 4230 */ 25, 108, 7, 117, 4, 129, 30, 22, 110, 11,
+/* 4240 */ 129, 30, 19, 111, 10, 129, 30, 16, 113, 8,
+/* 4250 */ 129, 30, 13, 115, 6, 129, 30, 11, 116, 5,
+/* 4260 */ 129, 30, 8, 117, 4, 129, 30, 5, 117, 4,
+/* 4270 */ 129, 30, 4, 117, 4, 130, 30, 4, 130, 193,
+/* 4280 */ 129, 30, 4, 117, 4, 132, 30, 91, 137, 30,
+/* 4290 */ 4, 117, 4, 132, 30, 4, 144, 30, 5, 130,
+/* 4300 */ 30, 7, 129, 30, 8, 129, 30, 11, 129, 30,
+/* 4310 */ 18, 132, 193, 129, 30, 4, 117, 4, 132, 30,
+/* 4320 */ 91, 132, 30, 4, 103, 18, 129, 30, 4, 97,
+/* 4330 */ 24, 129, 30, 4, 92, 29, 129, 30, 4, 87,
+/* 4340 */ 34, 129, 81, 40, 129, 76, 45, 129, 70, 49,
+/* 4350 */ 129, 65, 49, 129, 60, 49, 129, 55, 49, 129,
+/* 4360 */ 50, 48, 129, 44, 49, 129, 39, 48, 129, 33,
+/* 4370 */ 49, 129, 30, 47, 129, 34, 37, 129, 40, 26,
+/* 4380 */ 129, 46, 19, 129, 52, 19, 129, 58, 19, 129,
+/* 4390 */ 64, 19, 129, 70, 19, 129, 76, 19, 129, 82,
+/* 4400 */ 19, 129, 30, 4, 88, 18, 129, 30, 4, 94,
+/* 4410 */ 18, 129, 30, 4, 100, 18, 129, 30, 4, 106,
+/* 4420 */ 15, 129, 30, 91, 137, 30, 4, 117, 4, 132,
+/* 4430 */ 193, 129, 30, 4, 117, 4, 132, 30, 91, 132,
+/* 4440 */ 30, 4, 107, 14, 129, 30, 4, 104, 17, 129,
+/* 4450 */ 30, 4, 101, 20, 129, 30, 4, 99, 22, 129,
+/* 4460 */ 96, 25, 129, 93, 28, 129, 91, 28, 129, 88,
+/* 4470 */ 29, 129, 85, 29, 129, 82, 29, 129, 79, 29,
+/* 4480 */ 129, 76, 29, 129, 74, 29, 129, 71, 29, 129,
+/* 4490 */ 68, 29, 129, 65, 29, 129, 62, 29, 129, 60,
+/* 4500 */ 29, 129, 57, 29, 129, 54, 29, 129, 51, 29,
+/* 4510 */ 129, 49, 28, 129, 46, 29, 129, 43, 29, 129,
+/* 4520 */ 40, 29, 117, 4, 129, 37, 29, 117, 4, 129,
+/* 4530 */ 35, 29, 117, 4, 129, 32, 29, 117, 4, 129,
+/* 4540 */ 30, 91, 132, 117, 4, 132, 193, 129, 63, 25,
+/* 4550 */ 129, 57, 37, 129, 53, 45, 129, 50, 51, 129,
+/* 4560 */ 47, 57, 129, 45, 61, 129, 43, 65, 129, 41,
+/* 4570 */ 69, 129, 39, 73, 129, 38, 21, 92, 21, 129,
+/* 4580 */ 36, 18, 97, 18, 129, 35, 14, 102, 14, 129,
+/* 4590 */ 34, 11, 106, 11, 129, 33, 10, 108, 10, 129,
+/* 4600 */ 32, 8, 111, 8, 129, 32, 6, 113, 6, 129,
+/* 4610 */ 31, 6, 114, 6, 129, 31, 5, 115, 5, 129,
+/* 4620 */ 30, 5, 116, 5, 130, 30, 4, 117, 4, 132,
+/* 4630 */ 30, 5, 116, 5, 130, 31, 5, 115, 5, 129,
+/* 4640 */ 31, 6, 114, 6, 129, 32, 6, 113, 6, 129,
+/* 4650 */ 32, 8, 111, 8, 129, 33, 10, 108, 10, 129,
+/* 4660 */ 34, 11, 106, 11, 129, 35, 14, 102, 14, 129,
+/* 4670 */ 36, 18, 97, 18, 129, 38, 21, 92, 21, 129,
+/* 4680 */ 39, 73, 129, 41, 69, 129, 43, 65, 129, 45,
+/* 4690 */ 61, 129, 47, 57, 129, 50, 51, 129, 53, 45,
+/* 4700 */ 129, 57, 37, 129, 63, 25, 129, 193, 129, 30,
+/* 4710 */ 4, 117, 4, 132, 30, 91, 137, 30, 4, 80,
+/* 4720 */ 4, 117, 4, 132, 80, 4, 117, 4, 134, 80,
+/* 4730 */ 5, 116, 5, 131, 80, 6, 115, 6, 130, 81,
+/* 4740 */ 6, 114, 6, 129, 81, 8, 112, 8, 129, 81,
+/* 4750 */ 9, 111, 9, 129, 82, 10, 109, 10, 129, 82,
+/* 4760 */ 13, 106, 13, 129, 83, 35, 129, 84, 33, 129,
+/* 4770 */ 85, 31, 129, 86, 29, 129, 88, 25, 129, 90,
+/* 4780 */ 21, 129, 93, 15, 129, 96, 9, 129, 193, 129,
+/* 4790 */ 63, 25, 129, 57, 37, 129, 53, 45, 129, 50,
+/* 4800 */ 51, 129, 47, 57, 129, 45, 61, 129, 43, 65,
+/* 4810 */ 129, 41, 69, 129, 39, 73, 129, 38, 21, 92,
+/* 4820 */ 21, 129, 36, 18, 97, 18, 129, 35, 14, 102,
+/* 4830 */ 14, 129, 34, 11, 106, 11, 129, 33, 10, 108,
+/* 4840 */ 10, 129, 32, 8, 111, 8, 129, 32, 6, 113,
+/* 4850 */ 6, 129, 31, 6, 114, 6, 129, 31, 5, 115,
+/* 4860 */ 5, 129, 30, 5, 116, 5, 130, 30, 4, 39,
+/* 4870 */ 2, 117, 4, 129, 30, 4, 40, 4, 117, 4,
+/* 4880 */ 129, 30, 4, 41, 5, 117, 4, 129, 30, 4,
+/* 4890 */ 41, 6, 117, 4, 129, 30, 5, 40, 8, 116,
+/* 4900 */ 5, 129, 30, 5, 39, 10, 116, 5, 129, 31,
+/* 4910 */ 5, 38, 11, 115, 5, 129, 31, 18, 114, 6,
+/* 4920 */ 129, 32, 17, 113, 6, 129, 32, 16, 111, 8,
+/* 4930 */ 129, 33, 15, 108, 10, 129, 33, 14, 106, 11,
+/* 4940 */ 129, 32, 17, 102, 14, 129, 31, 23, 97, 18,
+/* 4950 */ 129, 31, 28, 92, 21, 129, 30, 82, 129, 30,
+/* 4960 */ 80, 129, 30, 11, 43, 65, 129, 30, 10, 45,
+/* 4970 */ 61, 129, 31, 8, 47, 57, 129, 32, 6, 50,
+/* 4980 */ 51, 129, 33, 5, 53, 45, 129, 35, 4, 57,
+/* 4990 */ 37, 129, 38, 2, 63, 25, 129, 193, 129, 30,
+/* 5000 */ 4, 117, 4, 132, 30, 91, 137, 30, 4, 76,
+/* 5010 */ 8, 117, 4, 129, 30, 4, 73, 11, 117, 4,
+/* 5020 */ 129, 30, 4, 70, 14, 117, 4, 129, 30, 4,
+/* 5030 */ 67, 17, 117, 4, 129, 65, 19, 117, 4, 129,
+/* 5040 */ 62, 22, 117, 4, 129, 59, 25, 117, 4, 129,
+/* 5050 */ 56, 28, 117, 4, 129, 53, 31, 117, 4, 129,
+/* 5060 */ 50, 34, 117, 4, 129, 47, 29, 80, 5, 116,
+/* 5070 */ 5, 129, 30, 4, 45, 29, 80, 5, 116, 5,
+/* 5080 */ 129, 30, 4, 42, 29, 80, 5, 116, 5, 129,
+/* 5090 */ 30, 4, 39, 30, 80, 6, 115, 6, 129, 30,
+/* 5100 */ 4, 36, 30, 80, 6, 115, 6, 129, 30, 33,
+/* 5110 */ 81, 6, 114, 6, 129, 30, 30, 81, 8, 112,
+/* 5120 */ 8, 129, 30, 27, 81, 9, 111, 9, 129, 30,
+/* 5130 */ 25, 82, 10, 109, 10, 129, 30, 22, 82, 13,
+/* 5140 */ 106, 13, 129, 30, 19, 83, 35, 129, 30, 16,
+/* 5150 */ 84, 33, 129, 30, 13, 85, 31, 129, 30, 11,
+/* 5160 */ 86, 29, 129, 30, 8, 88, 25, 129, 30, 5,
+/* 5170 */ 90, 21, 129, 30, 4, 93, 15, 129, 30, 4,
+/* 5180 */ 96, 9, 129, 30, 4, 130, 193, 129, 30, 18,
+/* 5190 */ 130, 30, 18, 89, 15, 129, 30, 18, 85, 23,
+/* 5200 */ 129, 34, 11, 83, 27, 129, 34, 9, 81, 31,
+/* 5210 */ 129, 33, 8, 79, 35, 129, 33, 6, 78, 16,
+/* 5220 */ 106, 9, 129, 32, 6, 77, 15, 109, 7, 129,
+/* 5230 */ 32, 5, 76, 14, 111, 6, 129, 31, 5, 75,
+/* 5240 */ 14, 113, 5, 129, 31, 4, 74, 15, 114, 5,
+/* 5250 */ 129, 31, 4, 74, 14, 115, 4, 129, 30, 4,
+/* 5260 */ 73, 15, 116, 4, 129, 30, 4, 73, 14, 116,
+/* 5270 */ 4, 129, 30, 4, 73, 14, 117, 4, 129, 30,
+/* 5280 */ 4, 72, 15, 117, 4, 130, 30, 4, 71, 15,
+/* 5290 */ 117, 4, 130, 30, 4, 70, 15, 117, 4, 129,
+/* 5300 */ 30, 5, 70, 15, 117, 4, 129, 30, 5, 69,
+/* 5310 */ 15, 116, 5, 129, 30, 6, 68, 16, 115, 5,
+/* 5320 */ 129, 31, 6, 67, 16, 114, 6, 129, 31, 7,
+/* 5330 */ 66, 17, 113, 6, 129, 32, 7, 64, 18, 111,
+/* 5340 */ 8, 129, 32, 8, 62, 19, 109, 9, 129, 33,
+/* 5350 */ 9, 60, 20, 107, 10, 129, 34, 11, 57, 22,
+/* 5360 */ 103, 13, 129, 35, 43, 103, 18, 129, 36, 41,
+/* 5370 */ 103, 18, 129, 38, 38, 103, 18, 129, 39, 35,
+/* 5380 */ 103, 18, 129, 41, 31, 129, 43, 27, 129, 46,
+/* 5390 */ 22, 129, 49, 14, 129, 193, 129, 103, 18, 132,
+/* 5400 */ 110, 11, 129, 113, 8, 129, 114, 7, 129, 116,
+/* 5410 */ 5, 130, 117, 4, 132, 30, 4, 117, 4, 132,
+/* 5420 */ 30, 91, 137, 30, 4, 117, 4, 132, 117, 4,
+/* 5430 */ 132, 116, 5, 130, 114, 7, 129, 113, 8, 129,
+/* 5440 */ 110, 11, 129, 103, 18, 132, 193, 129, 117, 4,
+/* 5450 */ 132, 56, 65, 129, 50, 71, 129, 46, 75, 129,
+/* 5460 */ 44, 77, 129, 42, 79, 129, 40, 81, 129, 38,
+/* 5470 */ 83, 129, 36, 85, 129, 35, 86, 129, 34, 20,
+/* 5480 */ 117, 4, 129, 33, 17, 117, 4, 129, 32, 15,
+/* 5490 */ 117, 4, 129, 32, 13, 117, 4, 129, 31, 12,
+/* 5500 */ 129, 31, 10, 129, 31, 9, 129, 30, 9, 129,
+/* 5510 */ 30, 8, 130, 30, 7, 132, 31, 6, 130, 31,
+/* 5520 */ 7, 129, 32, 6, 129, 32, 7, 129, 33, 7,
+/* 5530 */ 129, 34, 7, 129, 35, 8, 129, 36, 9, 117,
+/* 5540 */ 4, 129, 38, 9, 117, 4, 129, 40, 10, 117,
+/* 5550 */ 4, 129, 42, 12, 117, 4, 129, 44, 77, 129,
+/* 5560 */ 46, 75, 129, 50, 71, 129, 56, 43, 100, 21,
+/* 5570 */ 129, 117, 4, 132, 193, 129, 117, 4, 132, 115,
+/* 5580 */ 6, 129, 110, 11, 129, 105, 16, 129, 101, 20,
+/* 5590 */ 129, 96, 25, 129, 92, 29, 129, 87, 34, 129,
+/* 5600 */ 83, 38, 129, 78, 43, 129, 74, 47, 129, 70,
+/* 5610 */ 42, 117, 4, 129, 65, 42, 117, 4, 129, 60,
+/* 5620 */ 43, 117, 4, 129, 56, 42, 129, 51, 42, 129,
+/* 5630 */ 46, 43, 129, 42, 43, 129, 37, 44, 129, 33,
+/* 5640 */ 43, 129, 30, 42, 129, 33, 34, 129, 38, 25,
+/* 5650 */ 129, 42, 16, 129, 47, 15, 129, 52, 15, 129,
+/* 5660 */ 57, 15, 129, 61, 16, 129, 66, 16, 129, 71,
+/* 5670 */ 16, 129, 76, 16, 129, 80, 16, 129, 85, 16,
+/* 5680 */ 117, 4, 129, 90, 16, 117, 4, 129, 95, 16,
+/* 5690 */ 117, 4, 129, 100, 21, 129, 105, 16, 129, 110,
+/* 5700 */ 11, 129, 114, 7, 129, 117, 4, 132, 193, 129,
+/* 5710 */ 117, 4, 132, 115, 6, 129, 110, 11, 129, 105,
+/* 5720 */ 16, 129, 101, 20, 129, 96, 25, 129, 92, 29,
+/* 5730 */ 129, 87, 34, 129, 83, 38, 129, 78, 43, 129,
+/* 5740 */ 74, 47, 129, 70, 42, 117, 4, 129, 65, 42,
+/* 5750 */ 117, 4, 129, 60, 43, 117, 4, 129, 56, 42,
+/* 5760 */ 129, 51, 42, 129, 46, 43, 129, 42, 43, 129,
+/* 5770 */ 37, 44, 129, 33, 43, 129, 30, 42, 129, 33,
+/* 5780 */ 34, 129, 38, 25, 129, 42, 16, 129, 47, 15,
+/* 5790 */ 129, 52, 15, 129, 57, 15, 129, 61, 16, 129,
+/* 5800 */ 65, 17, 129, 60, 27, 129, 56, 36, 129, 51,
+/* 5810 */ 42, 129, 46, 43, 129, 42, 43, 129, 37, 44,
+/* 5820 */ 129, 33, 43, 129, 30, 42, 129, 33, 34, 129,
+/* 5830 */ 38, 25, 129, 42, 16, 129, 47, 15, 129, 52,
+/* 5840 */ 15, 129, 57, 15, 129, 61, 16, 129, 66, 16,
+/* 5850 */ 129, 71, 16, 129, 76, 16, 129, 80, 16, 129,
+/* 5860 */ 85, 16, 117, 4, 129, 90, 16, 117, 4, 129,
+/* 5870 */ 95, 16, 117, 4, 129, 100, 21, 129, 105, 16,
+/* 5880 */ 129, 110, 11, 129, 114, 7, 129, 117, 4, 132,
+/* 5890 */ 193, 129, 30, 4, 117, 4, 132, 30, 4, 115,
+/* 5900 */ 6, 129, 30, 4, 112, 9, 129, 30, 6, 109,
+/* 5910 */ 12, 129, 30, 9, 106, 15, 129, 30, 11, 103,
+/* 5920 */ 18, 129, 30, 14, 100, 21, 129, 30, 4, 38,
+/* 5930 */ 9, 98, 23, 129, 30, 4, 40, 10, 95, 26,
+/* 5940 */ 129, 30, 4, 43, 9, 92, 29, 129, 46, 9,
+/* 5950 */ 89, 32, 129, 49, 8, 86, 28, 117, 4, 129,
+/* 5960 */ 51, 9, 83, 28, 117, 4, 129, 54, 9, 80,
+/* 5970 */ 28, 117, 4, 129, 57, 8, 77, 28, 117, 4,
+/* 5980 */ 129, 59, 9, 74, 28, 129, 62, 37, 129, 64,
+/* 5990 */ 33, 129, 66, 28, 129, 63, 28, 129, 60, 28,
+/* 6000 */ 129, 57, 28, 129, 54, 33, 129, 51, 39, 129,
+/* 6010 */ 48, 29, 83, 9, 129, 30, 4, 45, 29, 86,
+/* 6020 */ 9, 129, 30, 4, 42, 29, 89, 9, 129, 30,
+/* 6030 */ 4, 39, 29, 92, 8, 129, 30, 4, 36, 29,
+/* 6040 */ 94, 9, 129, 30, 32, 97, 9, 129, 30, 29,
+/* 6050 */ 100, 8, 117, 4, 129, 30, 26, 103, 8, 117,
+/* 6060 */ 4, 129, 30, 23, 105, 9, 117, 4, 129, 30,
+/* 6070 */ 20, 108, 13, 129, 30, 18, 111, 10, 129, 30,
+/* 6080 */ 15, 113, 8, 129, 30, 12, 116, 5, 129, 30,
+/* 6090 */ 9, 117, 4, 129, 30, 6, 117, 4, 129, 30,
+/* 6100 */ 4, 117, 4, 132, 193, 129, 117, 4, 132, 114,
+/* 6110 */ 7, 129, 111, 10, 129, 108, 13, 129, 105, 16,
+/* 6120 */ 129, 102, 19, 129, 100, 21, 129, 96, 25, 129,
+/* 6130 */ 93, 28, 129, 90, 31, 129, 87, 34, 129, 84,
+/* 6140 */ 30, 117, 4, 129, 30, 4, 81, 30, 117, 4,
+/* 6150 */ 129, 30, 4, 78, 30, 117, 4, 129, 30, 4,
+/* 6160 */ 75, 30, 117, 4, 129, 30, 4, 72, 30, 129,
+/* 6170 */ 30, 69, 129, 30, 66, 129, 30, 63, 129, 30,
+/* 6180 */ 60, 129, 30, 57, 129, 30, 54, 129, 30, 51,
+/* 6190 */ 129, 30, 48, 129, 30, 51, 129, 30, 4, 73,
+/* 6200 */ 12, 129, 30, 4, 76, 12, 129, 30, 4, 80,
+/* 6210 */ 12, 129, 30, 4, 83, 12, 129, 87, 12, 129,
+/* 6220 */ 90, 12, 117, 4, 129, 94, 11, 117, 4, 129,
+/* 6230 */ 97, 12, 117, 4, 129, 101, 12, 117, 4, 129,
+/* 6240 */ 104, 17, 129, 108, 13, 129, 111, 10, 129, 115,
+/* 6250 */ 6, 129, 117, 4, 134, 193, 129, 30, 1, 103,
+/* 6260 */ 18, 129, 30, 4, 103, 18, 129, 30, 7, 103,
+/* 6270 */ 18, 129, 30, 9, 103, 18, 129, 30, 12, 110,
+/* 6280 */ 11, 129, 30, 15, 113, 8, 129, 30, 18, 114,
+/* 6290 */ 7, 129, 30, 21, 116, 5, 129, 30, 24, 116,
+/* 6300 */ 5, 129, 30, 27, 117, 4, 129, 30, 30, 117,
+/* 6310 */ 4, 129, 30, 33, 117, 4, 129, 30, 4, 37,
+/* 6320 */ 28, 117, 4, 129, 30, 4, 40, 28, 117, 4,
+/* 6330 */ 129, 30, 4, 42, 29, 117, 4, 129, 30, 4,
+/* 6340 */ 45, 29, 117, 4, 129, 30, 4, 48, 29, 117,
+/* 6350 */ 4, 129, 30, 4, 51, 29, 117, 4, 129, 30,
+/* 6360 */ 4, 54, 29, 117, 4, 129, 30, 4, 57, 29,
+/* 6370 */ 117, 4, 129, 30, 4, 59, 30, 117, 4, 129,
+/* 6380 */ 30, 4, 62, 30, 117, 4, 129, 30, 4, 65,
+/* 6390 */ 30, 117, 4, 129, 30, 4, 68, 30, 117, 4,
+/* 6400 */ 129, 30, 4, 71, 30, 117, 4, 129, 30, 4,
+/* 6410 */ 74, 30, 117, 4, 129, 30, 4, 77, 30, 117,
+/* 6420 */ 4, 129, 30, 4, 80, 30, 117, 4, 129, 30,
+/* 6430 */ 4, 83, 30, 117, 4, 129, 30, 4, 86, 35,
+/* 6440 */ 129, 30, 4, 89, 32, 129, 30, 4, 91, 30,
+/* 6450 */ 129, 30, 4, 94, 27, 129, 30, 5, 97, 24,
+/* 6460 */ 129, 30, 5, 100, 21, 129, 30, 7, 103, 18,
+/* 6470 */ 129, 30, 8, 106, 15, 129, 30, 11, 109, 12,
+/* 6480 */ 129, 30, 18, 112, 9, 129, 30, 18, 115, 6,
+/* 6490 */ 129, 30, 18, 117, 4, 129, 30, 18, 120, 1,
+/* 6500 */ 129, 193, 129, 42, 8, 129, 38, 16, 129, 36,
+/* 6510 */ 20, 129, 34, 24, 71, 5, 129, 33, 26, 69,
+/* 6520 */ 10, 129, 32, 28, 68, 13, 129, 31, 30, 68,
+/* 6530 */ 14, 129, 31, 9, 52, 9, 68, 15, 129, 30,
+/* 6540 */ 8, 54, 8, 69, 14, 129, 30, 7, 55, 7,
+/* 6550 */ 71, 4, 78, 6, 129, 30, 6, 56, 6, 79,
+/* 6560 */ 5, 129, 30, 6, 56, 6, 80, 4, 130, 31,
+/* 6570 */ 5, 56, 5, 80, 4, 129, 31, 5, 56, 5,
+/* 6580 */ 79, 5, 129, 32, 5, 55, 5, 78, 6, 129,
+/* 6590 */ 33, 5, 54, 5, 77, 7, 129, 34, 6, 52,
+/* 6600 */ 6, 74, 9, 129, 35, 48, 129, 33, 49, 129,
+/* 6610 */ 32, 49, 129, 31, 49, 129, 30, 49, 129, 30,
+/* 6620 */ 47, 129, 30, 45, 129, 30, 41, 129, 30, 6,
+/* 6630 */ 129, 30, 4, 129, 30, 3, 129, 30, 2, 129,
+/* 6640 */ 193, 129, 30, 4, 117, 4, 130, 31, 90, 136,
+/* 6650 */ 37, 5, 72, 5, 129, 35, 5, 74, 5, 129,
+/* 6660 */ 33, 5, 76, 5, 129, 32, 5, 77, 5, 129,
+/* 6670 */ 31, 5, 78, 5, 129, 31, 4, 79, 4, 129,
+/* 6680 */ 30, 5, 79, 5, 131, 30, 6, 78, 6, 129,
+/* 6690 */ 30, 7, 77, 7, 129, 31, 8, 75, 8, 129,
+/* 6700 */ 31, 11, 72, 11, 129, 32, 15, 67, 15, 129,
+/* 6710 */ 33, 48, 129, 34, 46, 129, 35, 44, 129, 37,
+/* 6720 */ 40, 129, 39, 36, 129, 42, 30, 129, 46, 22,
+/* 6730 */ 129, 193, 129, 48, 18, 129, 43, 28, 129, 41,
+/* 6740 */ 32, 129, 39, 36, 129, 37, 40, 129, 35, 44,
+/* 6750 */ 129, 34, 46, 129, 33, 13, 68, 13, 129, 32,
+/* 6760 */ 9, 73, 9, 129, 32, 7, 75, 7, 129, 31,
+/* 6770 */ 6, 77, 6, 129, 31, 5, 78, 5, 129, 30,
+/* 6780 */ 5, 79, 5, 129, 30, 4, 80, 4, 133, 31,
+/* 6790 */ 3, 79, 4, 129, 31, 4, 79, 4, 129, 32,
+/* 6800 */ 3, 78, 4, 129, 32, 4, 76, 6, 129, 33,
+/* 6810 */ 4, 74, 7, 129, 34, 4, 72, 8, 129, 35,
+/* 6820 */ 5, 72, 7, 129, 37, 5, 73, 4, 129, 39,
+/* 6830 */ 4, 74, 1, 129, 129, 193, 129, 46, 22, 129,
+/* 6840 */ 42, 30, 129, 39, 36, 129, 37, 40, 129, 35,
+/* 6850 */ 44, 129, 34, 46, 129, 33, 48, 129, 32, 15,
+/* 6860 */ 67, 15, 129, 31, 11, 72, 11, 129, 31, 8,
+/* 6870 */ 75, 8, 129, 30, 7, 77, 7, 129, 30, 6,
+/* 6880 */ 78, 6, 129, 30, 5, 79, 5, 131, 31, 4,
+/* 6890 */ 79, 4, 129, 31, 5, 78, 5, 129, 32, 5,
+/* 6900 */ 77, 5, 129, 33, 5, 76, 5, 129, 35, 5,
+/* 6910 */ 74, 5, 117, 4, 129, 37, 5, 72, 5, 117,
+/* 6920 */ 4, 129, 30, 91, 136, 30, 4, 130, 193, 129,
+/* 6930 */ 48, 18, 129, 43, 28, 129, 41, 32, 129, 39,
+/* 6940 */ 36, 129, 37, 40, 129, 35, 44, 129, 34, 46,
+/* 6950 */ 129, 33, 13, 55, 4, 68, 13, 129, 32, 9,
+/* 6960 */ 55, 4, 73, 9, 129, 32, 7, 55, 4, 75,
+/* 6970 */ 7, 129, 31, 6, 55, 4, 77, 6, 129, 31,
+/* 6980 */ 5, 55, 4, 78, 5, 129, 30, 5, 55, 4,
+/* 6990 */ 79, 5, 129, 30, 4, 55, 4, 80, 4, 132,
+/* 7000 */ 30, 4, 55, 4, 79, 5, 129, 31, 3, 55,
+/* 7010 */ 4, 78, 5, 129, 31, 4, 55, 4, 77, 6,
+/* 7020 */ 129, 32, 3, 55, 4, 75, 7, 129, 32, 4,
+/* 7030 */ 55, 4, 73, 9, 129, 33, 4, 55, 4, 68,
+/* 7040 */ 13, 129, 34, 4, 55, 25, 129, 35, 5, 55,
+/* 7050 */ 24, 129, 37, 5, 55, 22, 129, 39, 4, 55,
+/* 7060 */ 20, 129, 55, 18, 129, 55, 16, 129, 55, 11,
+/* 7070 */ 129, 193, 129, 80, 4, 129, 30, 4, 80, 4,
+/* 7080 */ 130, 30, 78, 129, 30, 82, 129, 30, 85, 129,
+/* 7090 */ 30, 87, 129, 30, 88, 129, 30, 89, 129, 30,
+/* 7100 */ 90, 130, 30, 4, 80, 4, 115, 6, 129, 30,
+/* 7110 */ 4, 80, 4, 117, 4, 129, 80, 4, 105, 6,
+/* 7120 */ 117, 4, 129, 80, 4, 103, 10, 116, 5, 129,
+/* 7130 */ 80, 4, 102, 19, 129, 80, 4, 101, 19, 129,
+/* 7140 */ 101, 19, 129, 101, 18, 129, 102, 16, 129, 103,
+/* 7150 */ 12, 129, 105, 6, 129, 193, 129, 12, 10, 59,
+/* 7160 */ 11, 129, 9, 16, 55, 19, 129, 7, 20, 53,
+/* 7170 */ 23, 129, 6, 7, 23, 5, 32, 6, 51, 27,
+/* 7180 */ 129, 4, 7, 25, 16, 50, 29, 129, 3, 6,
+/* 7190 */ 27, 16, 49, 31, 129, 2, 6, 28, 16, 48,
+/* 7200 */ 33, 129, 1, 6, 27, 18, 47, 35, 129, 1,
+/* 7210 */ 6, 27, 31, 71, 12, 129, 1, 5, 26, 15,
+/* 7220 */ 44, 10, 75, 8, 129, 1, 5, 25, 14, 45,
+/* 7230 */ 7, 77, 7, 129, 1, 5, 25, 13, 45, 5,
+/* 7240 */ 79, 5, 129, 1, 5, 24, 14, 45, 4, 80,
+/* 7250 */ 4, 129, 1, 5, 24, 13, 45, 4, 80, 4,
+/* 7260 */ 129, 1, 5, 23, 14, 45, 4, 80, 4, 129,
+/* 7270 */ 1, 5, 23, 13, 45, 4, 80, 4, 129, 1,
+/* 7280 */ 6, 22, 13, 45, 5, 79, 5, 129, 1, 6,
+/* 7290 */ 21, 14, 45, 7, 77, 7, 129, 1, 7, 21,
+/* 7300 */ 13, 46, 8, 75, 8, 129, 1, 8, 20, 13,
+/* 7310 */ 46, 12, 71, 12, 129, 1, 10, 18, 15, 47,
+/* 7320 */ 35, 129, 2, 30, 48, 33, 129, 3, 29, 49,
+/* 7330 */ 32, 129, 4, 27, 50, 31, 129, 5, 25, 51,
+/* 7340 */ 27, 80, 2, 86, 4, 129, 7, 21, 53, 23,
+/* 7350 */ 80, 3, 85, 6, 129, 9, 17, 55, 19, 80,
+/* 7360 */ 12, 129, 12, 12, 59, 11, 81, 11, 129, 82,
+/* 7370 */ 10, 129, 84, 7, 129, 86, 4, 129, 193, 129,
+/* 7380 */ 30, 4, 117, 4, 130, 30, 91, 136, 30, 4,
+/* 7390 */ 72, 5, 129, 30, 4, 74, 5, 129, 75, 5,
+/* 7400 */ 129, 76, 5, 129, 76, 6, 129, 77, 6, 130,
+/* 7410 */ 77, 7, 130, 76, 8, 129, 30, 4, 75, 9,
+/* 7420 */ 129, 30, 4, 72, 12, 129, 30, 54, 129, 30,
+/* 7430 */ 53, 130, 30, 52, 129, 30, 51, 129, 30, 49,
+/* 7440 */ 129, 30, 46, 129, 30, 42, 129, 30, 4, 130,
+/* 7450 */ 193, 129, 30, 4, 80, 4, 129, 30, 4, 80,
+/* 7460 */ 4, 100, 6, 129, 30, 54, 98, 10, 129, 30,
+/* 7470 */ 54, 97, 12, 129, 30, 54, 96, 14, 131, 30,
+/* 7480 */ 54, 97, 12, 129, 30, 54, 98, 10, 129, 30,
+/* 7490 */ 54, 100, 6, 129, 30, 4, 130, 193, 129, 7,
+/* 7500 */ 6, 129, 4, 11, 129, 3, 13, 129, 2, 14,
+/* 7510 */ 129, 1, 15, 130, 1, 3, 6, 9, 129, 1,
+/* 7520 */ 3, 7, 6, 129, 1, 3, 130, 1, 4, 129,
+/* 7530 */ 1, 5, 80, 4, 129, 1, 7, 80, 4, 100,
+/* 7540 */ 6, 129, 2, 82, 98, 10, 129, 3, 81, 97,
+/* 7550 */ 12, 129, 4, 80, 96, 14, 129, 5, 79, 96,
+/* 7560 */ 14, 129, 7, 77, 96, 14, 129, 10, 74, 97,
+/* 7570 */ 12, 129, 14, 70, 98, 10, 129, 19, 65, 100,
+/* 7580 */ 6, 129, 193, 129, 30, 4, 117, 4, 130, 30,
+/* 7590 */ 91, 136, 30, 4, 57, 9, 129, 30, 4, 55,
+/* 7600 */ 12, 129, 52, 17, 129, 50, 20, 129, 48, 24,
+/* 7610 */ 129, 46, 27, 129, 44, 21, 69, 6, 129, 41,
+/* 7620 */ 22, 70, 6, 80, 4, 129, 30, 4, 39, 21,
+/* 7630 */ 72, 6, 80, 4, 129, 30, 4, 36, 22, 73,
+/* 7640 */ 11, 129, 30, 26, 75, 9, 129, 30, 23, 76,
+/* 7650 */ 8, 129, 30, 21, 78, 6, 129, 30, 19, 79,
+/* 7660 */ 5, 129, 30, 16, 80, 4, 129, 30, 14, 80,
+/* 7670 */ 4, 129, 30, 12, 129, 30, 10, 129, 30, 7,
+/* 7680 */ 129, 30, 5, 129, 30, 4, 130, 193, 129, 30,
+/* 7690 */ 4, 117, 4, 130, 30, 91, 136, 30, 4, 130,
+/* 7700 */ 193, 129, 30, 4, 80, 4, 130, 30, 54, 136,
+/* 7710 */ 30, 4, 72, 5, 129, 30, 4, 74, 5, 129,
+/* 7720 */ 75, 5, 129, 76, 5, 129, 30, 4, 75, 7,
+/* 7730 */ 129, 30, 4, 74, 9, 129, 30, 54, 132, 30,
+/* 7740 */ 53, 129, 30, 52, 129, 30, 51, 129, 30, 48,
+/* 7750 */ 129, 30, 4, 72, 5, 129, 30, 4, 74, 5,
+/* 7760 */ 129, 75, 5, 129, 76, 5, 129, 30, 4, 75,
+/* 7770 */ 7, 129, 30, 4, 74, 9, 129, 30, 54, 132,
+/* 7780 */ 30, 53, 129, 30, 52, 129, 30, 51, 129, 30,
+/* 7790 */ 48, 129, 30, 4, 130, 193, 129, 30, 4, 80,
+/* 7800 */ 4, 130, 30, 54, 136, 30, 4, 72, 5, 129,
+/* 7810 */ 30, 4, 74, 5, 129, 75, 5, 129, 76, 5,
+/* 7820 */ 129, 76, 6, 129, 77, 6, 130, 77, 7, 130,
+/* 7830 */ 76, 8, 129, 30, 4, 75, 9, 129, 30, 4,
+/* 7840 */ 72, 12, 129, 30, 54, 129, 30, 53, 130, 30,
+/* 7850 */ 52, 129, 30, 51, 129, 30, 49, 129, 30, 46,
+/* 7860 */ 129, 30, 42, 129, 30, 4, 130, 193, 129, 48,
+/* 7870 */ 18, 129, 43, 28, 129, 41, 32, 129, 39, 36,
+/* 7880 */ 129, 37, 40, 129, 35, 44, 129, 34, 46, 129,
+/* 7890 */ 33, 13, 68, 13, 129, 32, 9, 73, 9, 129,
+/* 7900 */ 32, 7, 75, 7, 129, 31, 6, 77, 6, 129,
+/* 7910 */ 31, 5, 78, 5, 129, 30, 5, 79, 5, 129,
+/* 7920 */ 30, 4, 80, 4, 132, 30, 5, 79, 5, 130,
+/* 7930 */ 31, 5, 78, 5, 129, 31, 6, 77, 6, 129,
+/* 7940 */ 32, 7, 75, 7, 129, 32, 9, 73, 9, 129,
+/* 7950 */ 33, 13, 68, 13, 129, 34, 46, 129, 35, 44,
+/* 7960 */ 129, 37, 40, 129, 39, 36, 129, 41, 32, 129,
+/* 7970 */ 43, 28, 129, 48, 18, 129, 193, 129, 1, 3,
+/* 7980 */ 80, 4, 130, 1, 83, 137, 37, 5, 72, 5,
+/* 7990 */ 129, 35, 5, 74, 5, 129, 33, 5, 76, 5,
+/* 8000 */ 129, 32, 5, 77, 5, 129, 31, 5, 78, 5,
+/* 8010 */ 129, 31, 4, 79, 4, 129, 30, 5, 79, 5,
+/* 8020 */ 131, 30, 6, 78, 6, 129, 30, 7, 77, 7,
+/* 8030 */ 129, 31, 8, 75, 8, 129, 31, 11, 72, 11,
+/* 8040 */ 129, 32, 15, 67, 15, 129, 33, 48, 129, 34,
+/* 8050 */ 46, 129, 35, 44, 129, 37, 40, 129, 39, 36,
+/* 8060 */ 129, 42, 30, 129, 46, 22, 129, 193, 129, 46,
+/* 8070 */ 22, 129, 42, 30, 129, 39, 36, 129, 37, 40,
+/* 8080 */ 129, 35, 44, 129, 34, 46, 129, 33, 48, 129,
+/* 8090 */ 32, 15, 67, 15, 129, 31, 11, 72, 11, 129,
+/* 8100 */ 31, 8, 75, 8, 129, 30, 7, 77, 7, 129,
+/* 8110 */ 30, 6, 78, 6, 129, 30, 5, 79, 5, 131,
+/* 8120 */ 31, 4, 79, 4, 129, 31, 5, 78, 5, 129,
+/* 8130 */ 32, 5, 77, 5, 129, 33, 5, 76, 5, 129,
+/* 8140 */ 35, 5, 74, 5, 129, 37, 5, 72, 5, 129,
+/* 8150 */ 1, 83, 136, 1, 3, 80, 4, 130, 193, 129,
+/* 8160 */ 30, 4, 80, 4, 130, 30, 54, 136, 30, 4,
+/* 8170 */ 68, 6, 129, 30, 4, 70, 6, 129, 71, 7,
+/* 8180 */ 129, 72, 7, 129, 73, 7, 129, 74, 7, 129,
+/* 8190 */ 74, 8, 129, 75, 8, 130, 69, 15, 129, 67,
+/* 8200 */ 17, 129, 66, 18, 129, 65, 19, 130, 65, 18,
+/* 8210 */ 130, 66, 16, 129, 67, 13, 129, 69, 8, 129,
+/* 8220 */ 193, 129, 30, 13, 64, 8, 129, 30, 13, 61,
+/* 8230 */ 14, 129, 30, 13, 59, 18, 129, 30, 13, 57,
+/* 8240 */ 22, 129, 33, 8, 56, 24, 129, 32, 7, 55,
+/* 8250 */ 26, 129, 32, 6, 54, 28, 129, 31, 6, 53,
+/* 8260 */ 16, 77, 6, 129, 31, 5, 53, 14, 79, 4,
+/* 8270 */ 129, 30, 5, 52, 14, 80, 4, 129, 30, 5,
+/* 8280 */ 52, 13, 80, 4, 129, 30, 4, 52, 13, 80,
+/* 8290 */ 4, 129, 30, 4, 52, 12, 80, 4, 129, 30,
+/* 8300 */ 4, 51, 13, 80, 4, 130, 30, 4, 50, 13,
+/* 8310 */ 79, 5, 129, 30, 4, 50, 13, 78, 5, 129,
+/* 8320 */ 30, 5, 49, 14, 77, 6, 129, 31, 4, 49,
+/* 8330 */ 13, 76, 6, 129, 31, 5, 48, 14, 75, 7,
+/* 8340 */ 129, 32, 5, 47, 14, 73, 8, 129, 32, 6,
+/* 8350 */ 45, 16, 71, 13, 129, 33, 27, 71, 13, 129,
+/* 8360 */ 34, 26, 71, 13, 129, 35, 24, 71, 13, 129,
+/* 8370 */ 37, 20, 129, 39, 16, 129, 43, 9, 129, 193,
+/* 8380 */ 129, 80, 4, 131, 41, 56, 129, 37, 60, 129,
+/* 8390 */ 35, 62, 129, 33, 64, 129, 32, 65, 129, 31,
+/* 8400 */ 66, 129, 30, 67, 130, 30, 11, 80, 4, 129,
+/* 8410 */ 30, 9, 80, 4, 129, 30, 8, 80, 4, 129,
+/* 8420 */ 31, 7, 80, 4, 129, 31, 6, 129, 32, 5,
+/* 8430 */ 129, 33, 5, 129, 35, 4, 129, 38, 3, 129,
+/* 8440 */ 193, 129, 80, 4, 130, 42, 42, 129, 38, 46,
+/* 8450 */ 129, 35, 49, 129, 33, 51, 129, 32, 52, 129,
+/* 8460 */ 31, 53, 130, 30, 54, 129, 30, 12, 129, 30,
+/* 8470 */ 9, 129, 30, 8, 129, 30, 7, 130, 31, 6,
+/* 8480 */ 130, 32, 6, 129, 33, 5, 129, 34, 5, 129,
+/* 8490 */ 35, 5, 80, 4, 129, 37, 5, 80, 4, 129,
+/* 8500 */ 30, 54, 136, 30, 4, 130, 193, 129, 80, 4,
+/* 8510 */ 130, 77, 7, 129, 74, 10, 129, 70, 14, 129,
+/* 8520 */ 66, 18, 129, 62, 22, 129, 59, 25, 129, 55,
+/* 8530 */ 29, 129, 51, 33, 129, 47, 37, 129, 44, 32,
+/* 8540 */ 80, 4, 129, 40, 32, 80, 4, 129, 36, 32,
+/* 8550 */ 129, 32, 33, 129, 30, 31, 129, 33, 24, 129,
+/* 8560 */ 36, 17, 129, 40, 12, 129, 44, 12, 129, 48,
+/* 8570 */ 12, 129, 51, 13, 129, 55, 13, 129, 59, 13,
+/* 8580 */ 80, 4, 129, 63, 13, 80, 4, 129, 67, 17,
+/* 8590 */ 129, 71, 13, 129, 74, 10, 129, 78, 6, 129,
+/* 8600 */ 80, 4, 131, 193, 129, 80, 4, 130, 77, 7,
+/* 8610 */ 129, 74, 10, 129, 70, 14, 129, 66, 18, 129,
+/* 8620 */ 62, 22, 129, 59, 25, 129, 55, 29, 129, 51,
+/* 8630 */ 33, 129, 47, 37, 129, 44, 32, 80, 4, 129,
+/* 8640 */ 40, 32, 80, 4, 129, 36, 32, 129, 32, 33,
+/* 8650 */ 129, 30, 31, 129, 33, 24, 129, 36, 17, 129,
+/* 8660 */ 40, 12, 129, 44, 12, 129, 47, 13, 129, 44,
+/* 8670 */ 20, 129, 40, 28, 129, 36, 31, 129, 32, 32,
+/* 8680 */ 129, 30, 30, 129, 33, 24, 129, 36, 17, 129,
+/* 8690 */ 40, 12, 129, 44, 12, 129, 48, 12, 129, 51,
+/* 8700 */ 13, 129, 55, 13, 129, 59, 13, 80, 4, 129,
+/* 8710 */ 63, 13, 80, 4, 129, 67, 17, 129, 71, 13,
+/* 8720 */ 129, 74, 10, 129, 78, 6, 129, 80, 4, 131,
+/* 8730 */ 193, 129, 30, 4, 80, 4, 130, 30, 4, 79,
+/* 8740 */ 5, 129, 30, 5, 77, 7, 129, 30, 6, 74,
+/* 8750 */ 10, 129, 30, 8, 72, 12, 129, 30, 11, 69,
+/* 8760 */ 15, 129, 30, 13, 67, 17, 129, 30, 4, 37,
+/* 8770 */ 8, 64, 20, 129, 30, 4, 39, 8, 62, 22,
+/* 8780 */ 129, 41, 8, 59, 25, 129, 43, 8, 57, 27,
+/* 8790 */ 129, 45, 8, 55, 22, 80, 4, 129, 47, 27,
+/* 8800 */ 80, 4, 129, 49, 23, 129, 47, 22, 129, 44,
+/* 8810 */ 23, 129, 42, 22, 129, 30, 4, 39, 27, 129,
+/* 8820 */ 30, 4, 37, 31, 129, 30, 27, 62, 8, 129,
+/* 8830 */ 30, 25, 64, 8, 129, 30, 22, 66, 8, 80,
+/* 8840 */ 4, 129, 30, 20, 68, 8, 80, 4, 129, 30,
+/* 8850 */ 17, 70, 8, 80, 4, 129, 30, 15, 73, 11,
+/* 8860 */ 129, 30, 12, 75, 9, 129, 30, 10, 77, 7,
+/* 8870 */ 129, 30, 7, 79, 5, 129, 30, 5, 80, 4,
+/* 8880 */ 129, 30, 4, 80, 4, 130, 193, 129, 4, 5,
+/* 8890 */ 80, 4, 129, 2, 9, 80, 4, 129, 1, 11,
+/* 8900 */ 77, 7, 129, 1, 12, 74, 10, 129, 1, 12,
+/* 8910 */ 70, 14, 129, 1, 12, 66, 18, 129, 1, 11,
+/* 8920 */ 62, 22, 129, 2, 9, 59, 25, 129, 4, 11,
+/* 8930 */ 55, 29, 129, 7, 12, 51, 33, 129, 10, 12,
+/* 8940 */ 47, 37, 129, 14, 12, 44, 32, 80, 4, 129,
+/* 8950 */ 17, 13, 40, 32, 80, 4, 129, 21, 13, 36,
+/* 8960 */ 32, 129, 25, 40, 129, 29, 32, 129, 33, 24,
+/* 8970 */ 129, 36, 17, 129, 40, 12, 129, 44, 12, 129,
+/* 8980 */ 48, 12, 129, 51, 13, 129, 55, 13, 129, 59,
+/* 8990 */ 13, 80, 4, 129, 63, 13, 80, 4, 129, 67,
+/* 9000 */ 17, 129, 71, 13, 129, 74, 10, 129, 78, 6,
+/* 9010 */ 129, 80, 4, 131, 193, 129, 30, 1, 71, 13,
+/* 9020 */ 129, 30, 3, 71, 13, 129, 30, 6, 71, 13,
+/* 9030 */ 129, 30, 9, 75, 9, 129, 30, 11, 77, 7,
+/* 9040 */ 129, 30, 14, 79, 5, 129, 30, 17, 79, 5,
+/* 9050 */ 129, 30, 19, 80, 4, 129, 30, 22, 80, 4,
+/* 9060 */ 129, 30, 25, 80, 4, 129, 30, 27, 80, 4,
+/* 9070 */ 129, 30, 4, 36, 24, 80, 4, 129, 30, 4,
+/* 9080 */ 38, 25, 80, 4, 129, 30, 4, 41, 24, 80,
+/* 9090 */ 4, 129, 30, 4, 44, 24, 80, 4, 129, 30,
+/* 9100 */ 4, 46, 25, 80, 4, 129, 30, 4, 49, 25,
+/* 9110 */ 80, 4, 129, 30, 4, 52, 24, 80, 4, 129,
+/* 9120 */ 30, 4, 54, 30, 129, 30, 4, 57, 27, 129,
+/* 9130 */ 30, 4, 59, 25, 129, 30, 4, 62, 22, 129,
+/* 9140 */ 30, 4, 65, 19, 129, 30, 5, 67, 17, 129,
+/* 9150 */ 30, 5, 70, 14, 129, 30, 7, 73, 11, 129,
+/* 9160 */ 30, 9, 76, 8, 129, 30, 13, 78, 6, 129,
+/* 9170 */ 30, 13, 81, 3, 129, 30, 13, 129, 193, 2,
+/* 9180 */ 9, 59, 25, 129, 4, 11, 55, 29, 129, 7,
+/* 9190 */ 12, 51, 33, 129, 10, 12, 47, 37, 129, 14,
+/* 9200 */ 12, 44, 32, 80, 4, 129, 17, 13, 40, 32,
+/* 9210 */ 80, 4, 129, 21, 13, 36, 32, 129, 25, 40,
+/* 9220 */ 129, 29, 32, 129, 33, 24, 129, 36, 17, 129,
+/* 9230 */ 40, 12, 129, 44, 12, 129, 48, 12, 129, 51,
+/* 9240 */ 13, 129, 55, 13, 129, 59, 13, 80, 4, 129,
+/* 9250 */ 63, 13, 80, 4, 129, 67, 17, 129, 71, 13,
+/* 9260 */ 129, 74, 10, 129, 78, 6, 129, 80, 4, 131,
+/* 9270 */ 193
+};
+
+static char line[DWIDTH];
+static char *message;
+static char print[DWIDTH];
+static int debug, i, j, linen, max, nchars, pc, term, trace, x, y;
+static int width = DWIDTH; /* -w option: scrunch letters to 80 columns */
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, "w:td")) != -1)
+ switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 't':
+ trace = 1;
+ break;
+ case 'w':
+ width = atoi(optarg);
+ if (width <= 0 || width > DWIDTH)
+ errx(1, "illegal argument for -w option");
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ for (i = 0; i < width; i++) {
+ j = i * DWIDTH / width;
+ print[j] = 1;
+ }
+
+ /* Have now read in the data. Next get the message to be printed. */
+ if (*argv) {
+ for(i=0, j=0; i < argc; i++)
+ j += strlen(argv[i]) + 1;
+ if ((message = malloc((size_t)j)) == NULL)
+ err(1, "malloc");
+ strcpy(message, *argv);
+ while (*++argv) {
+ strcat(message, " ");
+ strcat(message, *argv);
+ }
+ nchars = strlen(message);
+ } else {
+ if ((message = malloc((size_t)MAXMSG)) == NULL)
+ err(1, "malloc");
+ fprintf(stderr,"Message: ");
+ if (fgets(message, MAXMSG, stdin) == NULL) {
+ nchars = 0;
+ message[0] = '\0';
+ } else {
+ nchars = strlen(message);
+
+ /* Get rid of newline. */
+ if (message[nchars - 1] == '\n')
+ message[--nchars] = '\0';
+ }
+ }
+
+ /* some debugging print statements */
+ if (debug) {
+ printf("const int asc_ptr[NCHARS] = {\n");
+ for (i = 0; i < 128; i++) {
+ printf("%4d, ",asc_ptr[i]);
+ if ((i+1) % 8 == 0)
+ printf("\n");
+ }
+ printf("};\nconst unsigned char data_table[NBYTES] = {\n");
+ printf("/* ");
+ for (i = 0; i < 10; i++) printf(" %3d ",i);
+ printf("*/\n");
+ for (i = 0; i < NBYTES; i += 10) {
+ printf("/* %4d */ ",i);
+ for (j = i; j < i+10; j++) {
+ x = data_table[j] & 0377;
+ printf(" %3d, ",x);
+ }
+ putchar('\n');
+ }
+ printf("};\n");
+ }
+
+ /* check message to make sure it's legal */
+ j = 0;
+ for (i = 0; i < nchars; i++)
+ if ((u_char) message[i] >= NCHARS ||
+ asc_ptr[(u_char) message[i]] == 0) {
+ warnx("the character '%c' is not in my character set",
+ message[i]);
+ j++;
+ }
+ if (j)
+ exit(1);
+
+ if (trace)
+ printf("Message '%s' is OK\n",message);
+ /* Now have message. Print it one character at a time. */
+
+ for (i = 0; i < nchars; i++) {
+ if (trace)
+ printf("Char #%d: %c\n", i, message[i]);
+ for (j = 0; j < DWIDTH; j++) line[j] = ' ';
+ pc = asc_ptr[(u_char) message[i]];
+ term = 0;
+ max = 0;
+ linen = 0;
+ while (!term) {
+ if (pc < 0 || pc > NBYTES) {
+ printf("bad pc: %d\n",pc);
+ exit(1);
+ }
+ x = data_table[pc] & 0377;
+ if (trace)
+ printf("pc=%d, term=%d, max=%d, linen=%d, x=%d\n",pc,term,max,linen,x);
+ if (x >= 128) {
+ if (x>192) term++;
+ x = x & 63;
+ while (x--) {
+ if (print[linen++]) {
+ for (j=0; j <= max; j++)
+ if (print[j])
+ putchar(line[j]);
+ putchar('\n');
+ }
+ }
+ for (j = 0; j < DWIDTH; j++) line[j] = ' ';
+ pc++;
+ }
+ else {
+ y = data_table[pc+1];
+ /* compensate for narrow teminals */
+#ifdef notdef
+ x = (x*width + (DWIDTH/2)) / DWIDTH;
+ y = (y*width + (DWIDTH/2)) / DWIDTH;
+#endif
+ max = x+y;
+ while (x < max) line[x++] = '#';
+ pc += 2;
+ if (trace)
+ printf("x=%d, y=%d, max=%d\n",x,y,max);
+ }
+ }
+ }
+
+ free(message);
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: banner [-d] [-t] [-w width] message ...\n");
+ exit(1);
+}
diff --git a/usr.bin/basename/Makefile b/usr.bin/basename/Makefile
new file mode 100644
index 0000000..b392c3f
--- /dev/null
+++ b/usr.bin/basename/Makefile
@@ -0,0 +1,13 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= basename
+MLINKS= basename.1 dirname.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/basename/Makefile.depend b/usr.bin/basename/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/basename/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/basename/basename.1 b/usr.bin/basename/basename.1
new file mode 100644
index 0000000..2410250
--- /dev/null
+++ b/usr.bin/basename/basename.1
@@ -0,0 +1,113 @@
+.\" Copyright (c) 1990, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)basename.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd April 18, 1994
+.Dt BASENAME 1
+.Os
+.Sh NAME
+.Nm basename , dirname
+.Nd return filename or directory portion of pathname
+.Sh SYNOPSIS
+.Nm
+.Ar string
+.Op Ar suffix
+.Nm
+.Op Fl a
+.Op Fl s Ar suffix
+.Ar string
+.Op Ar ...
+.Nm dirname
+.Ar string
+.Op Ar ...
+.Sh DESCRIPTION
+The
+.Nm
+utility deletes any prefix ending with the last slash
+.Ql \&/
+character present in
+.Ar string
+(after first stripping trailing slashes),
+and a
+.Ar suffix ,
+if given.
+The
+.Ar suffix
+is not stripped if it is identical to the remaining characters in
+.Ar string .
+The resulting filename is written to the standard output.
+A non-existent suffix is ignored.
+If
+.Fl a
+is specified, then every argument is treated as a
+.Ar string
+as if
+.Nm
+were invoked with just one argument.
+If
+.Fl s
+is specified, then the
+.Ar suffix
+is taken as its argument, and all other arguments are treated as a
+.Ar string .
+.Pp
+The
+.Nm dirname
+utility deletes the filename portion, beginning
+with the last slash
+.Ql \&/
+character to the end of
+.Ar string
+(after first stripping trailing slashes),
+and writes the result to the standard output.
+.Sh EXIT STATUS
+.Ex -std basename dirname
+.Sh EXAMPLES
+The following line sets the shell variable
+.Ev FOO
+to
+.Pa /usr/bin .
+.Pp
+.Dl FOO=`dirname /usr/bin/trail`
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr sh 1 ,
+.Xr basename 3 ,
+.Xr dirname 3
+.Sh STANDARDS
+The
+.Nm
+and
+.Nm dirname
+utilities are expected to be
+.St -p1003.2
+compatible.
diff --git a/usr.bin/basename/basename.c b/usr.bin/basename/basename.c
new file mode 100644
index 0000000..4c1023f
--- /dev/null
+++ b/usr.bin/basename/basename.c
@@ -0,0 +1,143 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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) 1991, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)basename.c 8.4 (Berkeley) 5/4/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <libgen.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+void stripsuffix(char *, const char *, size_t);
+void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ char *p, *suffix;
+ size_t suffixlen;
+ int aflag, ch;
+
+ setlocale(LC_ALL, "");
+
+ aflag = 0;
+ suffix = NULL;
+ suffixlen = 0;
+
+ while ((ch = getopt(argc, argv, "as:")) != -1)
+ switch(ch) {
+ case 'a':
+ aflag = 1;
+ break;
+ case 's':
+ suffix = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ if (!*argv[0]) {
+ printf("\n");
+ exit(0);
+ }
+ if ((p = basename(argv[0])) == NULL)
+ err(1, "%s", argv[0]);
+ if ((suffix == NULL && !aflag) && argc == 2) {
+ suffix = argv[1];
+ argc--;
+ }
+ if (suffix != NULL)
+ suffixlen = strlen(suffix);
+ while (argc--) {
+ if ((p = basename(*argv)) == NULL)
+ err(1, "%s", argv[0]);
+ stripsuffix(p, suffix, suffixlen);
+ argv++;
+ (void)printf("%s\n", p);
+ }
+ exit(0);
+}
+
+void
+stripsuffix(char *p, const char *suffix, size_t suffixlen)
+{
+ char *q, *r;
+ mbstate_t mbs;
+ size_t n;
+
+ if (suffixlen && (q = strchr(p, '\0') - suffixlen) > p &&
+ strcmp(suffix, q) == 0) {
+ /* Ensure that the match occurred on a character boundary. */
+ memset(&mbs, 0, sizeof(mbs));
+ for (r = p; r < q; r += n) {
+ n = mbrlen(r, MB_LEN_MAX, &mbs);
+ if (n == (size_t)-1 || n == (size_t)-2) {
+ memset(&mbs, 0, sizeof(mbs));
+ n = 1;
+ }
+ }
+ /* Chop off the suffix. */
+ if (q == r)
+ *q = '\0';
+ }
+}
+
+void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+"usage: basename string [suffix]\n"
+" basename [-a] [-s suffix] string [...]\n");
+ exit(1);
+}
diff --git a/usr.bin/basename/tests/Makefile b/usr.bin/basename/tests/Makefile
new file mode 100644
index 0000000..bad7b28
--- /dev/null
+++ b/usr.bin/basename/tests/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+NETBSD_ATF_TESTS_SH= basename_test
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/basename/tests/Makefile.depend b/usr.bin/basename/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/basename/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bc/Makefile b/usr.bin/bc/Makefile
new file mode 100644
index 0000000..14d5677
--- /dev/null
+++ b/usr.bin/bc/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+# $OpenBSD: Makefile,v 1.7 2013/09/19 16:12:00 otto Exp $
+
+PROG= bc
+SRCS= bc.y scan.l tty.c
+CFLAGS+= -I. -I${.CURDIR}
+
+LIBADD= edit
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+FILES+= bc.library
+FILESDIR=${SHAREDIR}/misc
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bc/Makefile.depend b/usr.bin/bc/Makefile.depend
new file mode 100644
index 0000000..eb5b174
--- /dev/null
+++ b/usr.bin/bc/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/ncurses/ncursesw \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bc/bc.1 b/usr.bin/bc/bc.1
new file mode 100644
index 0000000..a762832
--- /dev/null
+++ b/usr.bin/bc/bc.1
@@ -0,0 +1,416 @@
+.\" $FreeBSD$
+.\" $OpenBSD: bc.1,v 1.32 2015/11/17 05:45:35 mmcc Exp $
+.\"
+.\" Copyright (C) Caldera International Inc. 2001-2002.
+.\" 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 and documentation 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 or owned by Caldera
+.\" International, Inc.
+.\" 4. Neither the name of Caldera International, Inc. nor the names of other
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
+.\" INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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.
+.\"
+.\" @(#)bc.1 6.8 (Berkeley) 8/8/91
+.\"
+.Dd November 21 2015
+.Dt BC 1
+.Os
+.Sh NAME
+.Nm bc
+.Nd arbitrary-precision arithmetic language and calculator
+.Sh SYNOPSIS
+.Nm bc
+.Op Fl chlv
+.Op Fl e Ar expression
+.Op Ar file ...
+.Sh DESCRIPTION
+.Nm
+is an interactive processor for a language which resembles
+C but provides unlimited precision arithmetic.
+It takes input from any expressions on the command line and
+any files given, then reads the standard input.
+.Pp
+Options available:
+.Bl -tag -width Ds
+.It Fl c
+.Nm
+is actually a preprocessor for
+.Xr dc 1 ,
+which it invokes automatically, unless the
+.Fl c
+.Pq compile only
+option is present.
+In this case the generated
+.Xr dc 1
+instructions are sent to the standard output,
+instead of being interpreted by a running
+.Xr dc 1
+process.
+.It Fl e Ar expression , Fl Fl expression Ar expression
+Evaluate
+.Ar expression .
+If multiple
+.Fl e
+options are specified, they are processed in the order given,
+separated by newlines.
+.It Fl h , Fl Fl help
+Prints usage information.
+.It Fl l , Fl Fl mathlib
+Allow specification of an arbitrary precision math library.
+The definitions in the library are available to command line
+expressions.
+.It Fl v , Fl Fl version
+Prints version information.
+.El
+.Pp
+The syntax for
+.Nm
+programs is as follows:
+.Sq L
+means letter a-z;
+.Sq E
+means expression;
+.Sq S
+means statement.
+As a non-portable extension, it is possible to use long names
+in addition to single letter names.
+A long name is a sequence starting with a lowercase letter
+followed by any number of lowercase letters and digits.
+The underscore character
+.Pq Sq _
+counts as a letter.
+.Pp
+Comments
+.Bd -unfilled -offset indent -compact
+are enclosed in /* and */
+are enclosed in # and the next newline
+.Ed
+.Pp
+The newline is not part of the line comment,
+which in itself is a non-portable extension.
+.Pp
+Names
+.Bd -unfilled -offset indent -compact
+simple variables: L
+array elements: L [ E ]
+The words `ibase', `obase', and `scale'
+The word `last' or a single dot
+.Ed
+.Pp
+Other operands
+.Bd -unfilled -offset indent -compact
+arbitrarily long numbers with optional sign and decimal point
+( E )
+sqrt ( E )
+length ( E ) number of significant decimal digits
+scale ( E ) number of digits right of decimal point
+L ( E , ... , E )
+.Ed
+.Pp
+The sequence
+.Sq \e<newline><whitespace>
+is ignored within numbers.
+.Pp
+Operators
+.Pp
+The following arithmetic and logical operators can be used.
+The semantics of the operators is the same as in the C language.
+They are listed in order of decreasing precedence.
+Operators in the same group have the same precedence.
+.Bl -column "= += \-= *= /= %= ^=" "Associativity" "multiply, divide, modulus" -offset indent
+.It Sy "Operator" Ta Sy "Associativity" Ta Sy "Description"
+.It "++ \-\-" Ta "none" Ta "increment, decrement"
+.It "\-" Ta "none" Ta "unary minus"
+.It "^" Ta "right" Ta "power"
+.It "* / %" Ta "left" Ta "multiply, divide, modulus"
+.It "+ \-" Ta "left" Ta "plus, minus"
+.It "= += -= *= /= %= ^=" Ta "right" Ta "assignment"
+.It "== <= >= != < >" Ta "none" Ta "relational"
+.It "!" Ta "none" Ta "boolean not"
+.It "&&" Ta "left" Ta "boolean and"
+.It "||" Ta "left" Ta "boolean or"
+.El
+.Pp
+Note the following:
+.Bl -bullet -offset indent
+.It
+The relational operators may appear in any expression.
+The
+.St -p1003.1-2008
+standard only allows them in the conditional expression of an
+.Sq if ,
+.Sq while
+or
+.Sq for
+statement.
+.It
+The relational operators have a lower precedence than the assignment
+operators.
+This has the consequence that the expression
+.Sy a = b < c
+is interpreted as
+.Sy (a = b) < c ,
+which is probably not what the programmer intended.
+.It
+In contrast with the C language, the relational operators all have
+the same precedence, and are non-associative.
+The expression
+.Sy a < b < c
+will produce a syntax error.
+.It
+The boolean operators (!, && and ||) are non-portable extensions.
+.It
+The boolean not
+(!) operator has much lower precedence than the same operator in the
+C language.
+This has the consequence that the expression
+.Sy !a < b
+is interpreted as
+.Sy !(a < b) .
+Prudent programmers use parentheses when writing expressions involving
+boolean operators.
+.El
+.Pp
+Statements
+.Bd -unfilled -offset indent -compact
+E
+{ S ; ... ; S }
+if ( E ) S
+if ( E ) S else S
+while ( E ) S
+for ( E ; E ; E ) S
+null statement
+break
+continue
+quit
+a string of characters, enclosed in double quotes
+print E ,..., E
+.Ed
+.Pp
+A string may contain any character, except double quote.
+The if statement with an else branch is a non-portable extension.
+All three E's in a for statement may be empty.
+This is a non-portable extension.
+The continue and print statements are also non-portable extensions.
+.Pp
+The print statement takes a list of comma-separated expressions.
+Each expression in the list is evaluated and the computed
+value is printed and assigned to the variable `last'.
+No trailing newline is printed.
+The expression may also be a string enclosed in double quotes.
+Within these strings the following escape sequences may be used:
+.Sq \ea
+for bell (alert),
+.Sq \eb
+for backspace,
+.Sq \ef
+for formfeed,
+.Sq \en
+for newline,
+.Sq \er
+for carriage return,
+.Sq \et
+for tab,
+.Sq \eq
+for double quote and
+.Sq \e\e
+for backslash.
+Any other character following a backslash will be ignored.
+Strings will not be assigned to `last'.
+.Pp
+Function definitions
+.Bd -unfilled -offset indent
+define L ( L ,..., L ) {
+ auto L, ... , L
+ S; ... S
+ return ( E )
+}
+.Ed
+.Pp
+As a non-portable extension, the opening brace of the define statement
+may appear on the next line.
+The return statement may also appear in the following forms:
+.Bd -unfilled -offset indent
+return
+return ()
+return E
+.Ed
+.Pp
+The first two are equivalent to the statement
+.Dq return 0 .
+The last form is a non-portable extension.
+Not specifying a return statement is equivalent to writing
+.Dq return (0) .
+.Pp
+Functions available in the math library, which is loaded by specifying the
+.Fl l
+flag on the command line
+.Pp
+.Bl -tag -width j(n,x) -offset indent -compact
+.It s(x)
+sine
+.It c(x)
+cosine
+.It e(x)
+exponential
+.It l(x)
+log
+.It a(x)
+arctangent
+.It j(n,x)
+Bessel function
+.El
+.Pp
+All function arguments are passed by value.
+.Pp
+The value of a statement that is an expression is printed
+unless the main operator is an assignment.
+The value printed is assigned to the special variable `last'.
+This is a non-portable extension.
+A single dot may be used as a synonym for `last'.
+Either semicolons or newlines may separate statements.
+Assignment to
+.Ar scale
+influences the number of digits to be retained on arithmetic
+operations in the manner of
+.Xr dc 1 .
+Assignments to
+.Ar ibase
+or
+.Ar obase
+set the input and output number radix respectively.
+.Pp
+The same letter may be used as an array, a function,
+and a simple variable simultaneously.
+All variables are global to the program.
+`Auto' variables are pushed down during function calls.
+When using arrays as function arguments
+or defining them as automatic variables,
+empty square brackets must follow the array name.
+.Pp
+For example
+.Bd -literal -offset indent
+scale = 20
+define e(x){
+ auto a, b, c, i, s
+ a = 1
+ b = 1
+ s = 1
+ for(i=1; 1==1; i++){
+ a = a*x
+ b = b*i
+ c = a/b
+ if(c == 0) return(s)
+ s = s+c
+ }
+}
+.Ed
+.Pp
+defines a function to compute an approximate value of
+the exponential function and
+.Pp
+.Dl for(i=1; i<=10; i++) e(i)
+.Pp
+prints approximate values of the exponential function of
+the first ten integers.
+.Bd -literal -offset indent
+$ bc -l -e 'scale = 500; 2 * a(2^10000)' -e quit
+.Ed
+.Pp
+prints an approximation of pi.
+.Sh COMMAND LINE EDITING
+.Nm
+supports interactive command line editing, via the
+.Xr editline 3
+library.
+It is enabled by default if input is from a tty.
+Previous lines can be recalled and edited with the arrow keys,
+and other GNU Emacs-style editing keys may be used as well.
+.Pp
+The
+.Xr editline 3
+library is configured with a
+.Pa .editrc
+file \- refer to
+.Xr editrc 5
+for more information.
+.Sh FILES
+.Bl -tag -width /usr/share/misc/bc.library -compact
+.It Pa /usr/share/misc/bc.library
+math library, read when the
+.Fl l
+option is specified on the command line.
+.El
+.Sh COMPATIBILITY
+The
+.Fl q
+and
+.Fl Fl quiet
+options are no-ops for compatibility with some other implementations of
+.Nm
+and their use is discouraged.
+.Sh SEE ALSO
+.Xr dc 1
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The flags
+.Op Fl ce ,
+as well as the parts noted above,
+are extensions to that specification.
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.At v6 .
+A complete rewrite of the
+.Nm
+command first appeared in
+.Ox 3.5 .
+.Sh AUTHORS
+.An -nosplit
+The original version of the
+.Nm
+command was written by
+.An Robert Morris
+and
+.An Lorinda Cherry .
+The current version of the
+.Nm
+utility was written by
+.An Otto Moerbeek .
+.Sh BUGS
+The
+.Ql quit
+statement is interpreted when read, not when executed.
+.Pp
+Some non-portable extensions, as found in the GNU version of the
+.Nm
+utility are not implemented (yet).
diff --git a/usr.bin/bc/bc.library b/usr.bin/bc/bc.library
new file mode 100644
index 0000000..8b92d25
--- /dev/null
+++ b/usr.bin/bc/bc.library
@@ -0,0 +1,274 @@
+/* $FreeBSD$ */
+/* $OpenBSD: bc.library,v 1.4 2012/03/14 07:35:53 otto Exp $ */
+
+/*
+ * Copyright (C) Caldera International Inc. 2001-2002.
+ * 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 and documentation 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 or owned by Caldera
+ * International, Inc.
+ * 4. Neither the name of Caldera International, Inc. nor the names of other
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
+ * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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.
+ */
+
+/*
+ * @(#)bc.library 5.1 (Berkeley) 4/17/91
+ */
+
+scale = 20
+define e(x) {
+ auto a, b, c, d, e, g, t, w, y, r
+
+ r = ibase
+ ibase = A
+ t = scale
+ scale = 0
+ if (x > 0) scale = (0.435*x)/1
+ scale = scale + t + length(scale + t) + 1
+
+ w = 0
+ if (x < 0) {
+ x = -x
+ w = 1
+ }
+ y = 0
+ while (x > 2) {
+ x = x/2
+ y = y + 1
+ }
+
+ a = 1
+ b = 1
+ c = b
+ d = 1
+ e = 1
+ for (a = 1; 1 == 1; a++) {
+ b = b*x
+ c = c*a + b
+ d = d*a
+ g = c/d
+ if (g == e) {
+ g = g/1
+ while (y--) {
+ g = g*g
+ }
+ scale = t
+ ibase = r
+ if (w == 1) return (1/g)
+ return (g/1)
+ }
+ e = g
+ }
+}
+
+define l(x) {
+ auto a, b, c, d, e, f, g, u, s, t, r
+ r = ibase
+ ibase = A
+ if (x <= 0) {
+ a = (1 - 10^scale)
+ ibase = r
+ return (a)
+ }
+ t = scale
+
+ f = 1
+ if (x < 1) {
+ s = scale(x)
+ } else {
+ s = length(x)-scale(x)
+ }
+ scale = 0
+ a = (2.31*s)/1 /* estimated integer part of the answer */
+ s = t + length(a) + 2 /* estimated length of the answer */
+ while (x > 2) {
+ scale = 0
+ scale = (length(x) + scale(x))/2 + 1
+ if (scale < s) scale = s
+ x = sqrt(x)
+ f = f*2
+ }
+ while (x < .5) {
+ scale = 0
+ scale = scale(x)/2 + 1
+ if (scale < s) scale = s
+ x = sqrt(x)
+ f = f*2
+ }
+
+ scale = 0
+ scale = t + length(f) + length((1.05*(t+length(f))/1)) + 1
+ u = (x - 1)/(x + 1)
+ s = u*u
+ scale = t + 2
+ b = 2*f
+ c = b
+ d = 1
+ e = 1
+ for (a = 3; 1 == 1 ; a = a + 2) {
+ b = b*s
+ c = c*a + d*b
+ d = d*a
+ g = c/d
+ if (g == e) {
+ scale = t
+ ibase = r
+ return (u*c/d)
+ }
+ e = g
+ }
+}
+
+define s(x) {
+ auto a, b, c, s, t, y, p, n, i, r
+ r = ibase
+ ibase = A
+ t = scale
+ y = x/.7853
+ s = t + length(y) - scale(y)
+ if (s < t) s = t
+ scale = s
+ p = a(1)
+
+ scale = 0
+ if (x >= 0) n = (x/(2*p) + 1)/2
+ if (x < 0) n = (x/(2*p) - 1)/2
+ x = x - 4*n*p
+ if (n % 2 != 0) x = -x
+
+ scale = t + length(1.2*t) - scale(1.2*t)
+ y = -x*x
+ a = x
+ b = 1
+ s = x
+ for (i =3 ; 1 == 1; i = i + 2) {
+ a = a*y
+ b = b*i*(i - 1)
+ c = a/b
+ if (c == 0) {
+ scale = t
+ ibase = r
+ return (s/1)
+ }
+ s = s + c
+ }
+}
+
+define c(x) {
+ auto t, r
+ r = ibase
+ ibase = A
+ t = scale
+ scale = scale + 1
+ x = s(x + 2*a(1))
+ scale = t
+ ibase = r
+ return (x/1)
+}
+
+define a(x) {
+ auto a, b, c, d, e, f, g, s, t, r
+ if (x == 0) return(0)
+
+ r = ibase
+ ibase = A
+ if (x == 1) {
+ if (scale < 52) {
+ a = .7853981633974483096156608458198757210492923498437764/1
+ ibase = r
+ return (a)
+ }
+ }
+ t = scale
+ f = 1
+ while (x > .5) {
+ scale = scale + 1
+ x = -(1 - sqrt(1. + x*x))/x
+ f = f*2
+ }
+ while (x < -.5) {
+ scale = scale + 1
+ x = -(1 - sqrt(1. + x*x))/x
+ f = f*2
+ }
+ s = -x*x
+ b = f
+ c = f
+ d = 1
+ e = 1
+ for (a = 3; 1 == 1; a = a + 2) {
+ b = b*s
+ c = c*a + d*b
+ d = d*a
+ g = c/d
+ if (g == e) {
+ ibase = r
+ scale = t
+ return (x*c/d)
+ }
+ e = g
+ }
+}
+
+define j(n,x) {
+ auto a, b, c, d, e, g, i, s, k, t, r
+
+ r = ibase
+ ibase = A
+ t = scale
+ k = 1.36*x + 1.16*t - n
+ k = length(k) - scale(k)
+ if (k > 0) scale = scale + k
+
+ s = -x*x/4
+ if (n < 0) {
+ n = -n
+ x = -x
+ }
+ a = 1
+ c = 1
+ for (i = 1; i <= n; i++) {
+ a = a*x
+ c = c*2*i
+ }
+ b = a
+ d = 1
+ e = 1
+ for (i = 1; 1; i++) {
+ a = a*s
+ b = b*i*(n + i) + a
+ c = c*i*(n + i)
+ g = b/c
+ if (g == e) {
+ ibase = r
+ scale = t
+ return (g/1)
+ }
+ e = g
+ }
+}
+/* vim: set filetype=bc shiftwidth=8 noexpandtab: */
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
new file mode 100644
index 0000000..17f308e
--- /dev/null
+++ b/usr.bin/bc/bc.y
@@ -0,0 +1,1216 @@
+%{
+/* $OpenBSD: bc.y,v 1.44 2013/11/20 21:33:54 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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.
+ */
+
+/*
+ * This implementation of bc(1) uses concepts from the original 4.4
+ * BSD bc(1). The code itself is a complete rewrite, based on the
+ * Posix defined bc(1) grammar. Other differences include type safe
+ * usage of pointers to build the tree of emitted code, typed yacc
+ * rule values, dynamic allocation of all data structures and a
+ * completely rewritten lexical analyzer using lex(1).
+ *
+ * Some effort has been made to make sure that the generated code is
+ * the same as the code generated by the older version, to provide
+ * easy regression testing.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <histedit.h>
+#include <limits.h>
+#include <search.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "extern.h"
+#include "pathnames.h"
+
+#define BC_VER "1.1-FreeBSD"
+#define END_NODE ((ssize_t) -1)
+#define CONST_STRING ((ssize_t) -2)
+#define ALLOC_STRING ((ssize_t) -3)
+
+extern char *yytext;
+extern FILE *yyin;
+
+struct tree {
+ union {
+ char *astr;
+ const char *cstr;
+ } u;
+ ssize_t index;
+};
+
+int yywrap(void);
+
+int fileindex;
+int sargc;
+const char **sargv;
+const char *filename;
+char *cmdexpr;
+
+static void grow(void);
+static ssize_t cs(const char *);
+static ssize_t as(const char *);
+static ssize_t node(ssize_t, ...);
+static void emit(ssize_t, int);
+static void emit_macro(int, ssize_t);
+static void free_tree(void);
+static ssize_t numnode(int);
+static ssize_t lookup(char *, size_t, char);
+static ssize_t letter_node(char *);
+static ssize_t array_node(char *);
+static ssize_t function_node(char *);
+
+static void add_par(ssize_t);
+static void add_local(ssize_t);
+static void warning(const char *);
+static void init(void);
+static void usage(void);
+static char *escape(const char *);
+
+static ssize_t instr_sz = 0;
+static struct tree *instructions = NULL;
+static ssize_t current = 0;
+static int macro_char = '0';
+static int reset_macro_char = '0';
+static int nesting = 0;
+static int breakstack[16];
+static int breaksp = 0;
+static ssize_t prologue;
+static ssize_t epilogue;
+static bool st_has_continue;
+static char str_table[UCHAR_MAX][2];
+static bool do_fork = true;
+static u_short var_count;
+static pid_t dc;
+
+static void sigchld(int);
+
+extern char *__progname;
+
+#define BREAKSTACK_SZ (sizeof(breakstack)/sizeof(breakstack[0]))
+
+/* These values are 4.4BSD bc compatible */
+#define FUNC_CHAR 0x01
+#define ARRAY_CHAR 0xa1
+
+/* Skip '\0', [, \ and ] */
+#define ENCODE(c) ((c) < '[' ? (c) : (c) + 3);
+#define VAR_BASE (256-4)
+#define MAX_VARIABLES (VAR_BASE * VAR_BASE)
+
+const struct option long_options[] =
+{
+ {"expression", required_argument, NULL, 'e'},
+ {"help", no_argument, NULL, 'h'},
+ {"mathlib", no_argument, NULL, 'l'},
+ /* compatibility option */
+ {"quiet", no_argument, NULL, 'q'},
+ {"version", no_argument, NULL, 'v'},
+ {NULL, no_argument, NULL, 0}
+};
+
+%}
+
+%start program
+
+%union {
+ struct lvalue lvalue;
+ const char *str;
+ char *astr;
+ ssize_t node;
+}
+
+%token COMMA SEMICOLON LPAR RPAR LBRACE RBRACE LBRACKET RBRACKET DOT
+%token NEWLINE
+%token <astr> LETTER
+%token <str> NUMBER STRING
+%token DEFINE BREAK QUIT LENGTH
+%token RETURN FOR IF WHILE SQRT
+%token SCALE IBASE OBASE AUTO
+%token CONTINUE ELSE PRINT
+
+%left BOOL_OR
+%left BOOL_AND
+%nonassoc BOOL_NOT
+%nonassoc EQUALS LESS_EQ GREATER_EQ UNEQUALS LESS GREATER
+%right <str> ASSIGN_OP
+%left PLUS MINUS
+%left MULTIPLY DIVIDE REMAINDER
+%right EXPONENT
+%nonassoc UMINUS
+%nonassoc INCR DECR
+
+%type <lvalue> named_expression
+%type <node> argument_list
+%type <node> alloc_macro
+%type <node> expression
+%type <node> function
+%type <node> function_header
+%type <node> input_item
+%type <node> opt_argument_list
+%type <node> opt_expression
+%type <node> opt_relational_expression
+%type <node> opt_statement
+%type <node> print_expression
+%type <node> print_expression_list
+%type <node> relational_expression
+%type <node> return_expression
+%type <node> semicolon_list
+%type <node> statement
+%type <node> statement_list
+
+%%
+
+program : /* empty */
+ | program input_item
+ ;
+
+input_item : semicolon_list NEWLINE
+ {
+ emit($1, 0);
+ macro_char = reset_macro_char;
+ putchar('\n');
+ free_tree();
+ st_has_continue = false;
+ }
+ | function
+ {
+ putchar('\n');
+ free_tree();
+ st_has_continue = false;
+ }
+ | error NEWLINE
+ {
+ yyerrok;
+ }
+ | error QUIT
+ {
+ yyerrok;
+ }
+ ;
+
+semicolon_list : /* empty */
+ {
+ $$ = cs("");
+ }
+ | statement
+ | semicolon_list SEMICOLON statement
+ {
+ $$ = node($1, $3, END_NODE);
+ }
+ | semicolon_list SEMICOLON
+ ;
+
+statement_list : /* empty */
+ {
+ $$ = cs("");
+ }
+ | statement
+ | statement_list NEWLINE
+ | statement_list NEWLINE statement
+ {
+ $$ = node($1, $3, END_NODE);
+ }
+ | statement_list SEMICOLON
+ | statement_list SEMICOLON statement
+ {
+ $$ = node($1, $3, END_NODE);
+ }
+ ;
+
+
+opt_statement : /* empty */
+ {
+ $$ = cs("");
+ }
+ | statement
+ ;
+
+statement : expression
+ {
+ $$ = node($1, cs("ps."), END_NODE);
+ }
+ | named_expression ASSIGN_OP expression
+ {
+ if ($2[0] == '\0')
+ $$ = node($3, cs($2), $1.store,
+ END_NODE);
+ else
+ $$ = node($1.load, $3, cs($2), $1.store,
+ END_NODE);
+ }
+ | STRING
+ {
+ $$ = node(cs("["), as($1),
+ cs("]P"), END_NODE);
+ }
+ | BREAK
+ {
+ if (breaksp == 0) {
+ warning("break not in for or while");
+ YYERROR;
+ } else {
+ $$ = node(
+ numnode(nesting -
+ breakstack[breaksp-1]),
+ cs("Q"), END_NODE);
+ }
+ }
+ | CONTINUE
+ {
+ if (breaksp == 0) {
+ warning("continue not in for or while");
+ YYERROR;
+ } else {
+ st_has_continue = true;
+ $$ = node(numnode(nesting -
+ breakstack[breaksp-1] - 1),
+ cs("J"), END_NODE);
+ }
+ }
+ | QUIT
+ {
+ sigset_t mask;
+
+ putchar('q');
+ fflush(stdout);
+ if (dc) {
+ sigprocmask(SIG_BLOCK, NULL, &mask);
+ sigsuspend(&mask);
+ } else
+ exit(0);
+ }
+ | RETURN return_expression
+ {
+ if (nesting == 0) {
+ warning("return must be in a function");
+ YYERROR;
+ }
+ $$ = $2;
+ }
+ | FOR LPAR alloc_macro opt_expression SEMICOLON
+ opt_relational_expression SEMICOLON
+ opt_expression RPAR opt_statement pop_nesting
+ {
+ ssize_t n;
+
+ if (st_has_continue)
+ n = node($10, cs("M"), $8, cs("s."),
+ $6, $3, END_NODE);
+ else
+ n = node($10, $8, cs("s."), $6, $3,
+ END_NODE);
+
+ emit_macro($3, n);
+ $$ = node($4, cs("s."), $6, $3, cs(" "),
+ END_NODE);
+ }
+ | IF LPAR alloc_macro pop_nesting relational_expression RPAR
+ opt_statement
+ {
+ emit_macro($3, $7);
+ $$ = node($5, $3, cs(" "), END_NODE);
+ }
+ | IF LPAR alloc_macro pop_nesting relational_expression RPAR
+ opt_statement ELSE alloc_macro pop_nesting opt_statement
+ {
+ emit_macro($3, $7);
+ emit_macro($9, $11);
+ $$ = node($5, $3, cs("e"), $9, cs(" "),
+ END_NODE);
+ }
+ | WHILE LPAR alloc_macro relational_expression RPAR
+ opt_statement pop_nesting
+ {
+ ssize_t n;
+
+ if (st_has_continue)
+ n = node($6, cs("M"), $4, $3, END_NODE);
+ else
+ n = node($6, $4, $3, END_NODE);
+ emit_macro($3, n);
+ $$ = node($4, $3, cs(" "), END_NODE);
+ }
+ | LBRACE statement_list RBRACE
+ {
+ $$ = $2;
+ }
+ | PRINT print_expression_list
+ {
+ $$ = $2;
+ }
+ ;
+
+alloc_macro : /* empty */
+ {
+ $$ = cs(str_table[macro_char]);
+ macro_char++;
+ /* Do not use [, \ and ] */
+ if (macro_char == '[')
+ macro_char += 3;
+ /* skip letters */
+ else if (macro_char == 'a')
+ macro_char = '{';
+ else if (macro_char == ARRAY_CHAR)
+ macro_char += 26;
+ else if (macro_char == 255)
+ fatal("program too big");
+ if (breaksp == BREAKSTACK_SZ)
+ fatal("nesting too deep");
+ breakstack[breaksp++] = nesting++;
+ }
+ ;
+
+pop_nesting : /* empty */
+ {
+ breaksp--;
+ }
+ ;
+
+function : function_header opt_parameter_list RPAR opt_newline
+ LBRACE NEWLINE opt_auto_define_list
+ statement_list RBRACE
+ {
+ int n = node(prologue, $8, epilogue,
+ cs("0"), numnode(nesting),
+ cs("Q"), END_NODE);
+ emit_macro($1, n);
+ reset_macro_char = macro_char;
+ nesting = 0;
+ breaksp = 0;
+ }
+ ;
+
+function_header : DEFINE LETTER LPAR
+ {
+ $$ = function_node($2);
+ free($2);
+ prologue = cs("");
+ epilogue = cs("");
+ nesting = 1;
+ breaksp = 0;
+ breakstack[breaksp] = 0;
+ }
+ ;
+
+opt_newline : /* empty */
+ | NEWLINE
+ ;
+
+opt_parameter_list
+ : /* empty */
+ | parameter_list
+ ;
+
+
+parameter_list : LETTER
+ {
+ add_par(letter_node($1));
+ free($1);
+ }
+ | LETTER LBRACKET RBRACKET
+ {
+ add_par(array_node($1));
+ free($1);
+ }
+ | parameter_list COMMA LETTER
+ {
+ add_par(letter_node($3));
+ free($3);
+ }
+ | parameter_list COMMA LETTER LBRACKET RBRACKET
+ {
+ add_par(array_node($3));
+ free($3);
+ }
+ ;
+
+
+
+opt_auto_define_list
+ : /* empty */
+ | AUTO define_list NEWLINE
+ | AUTO define_list SEMICOLON
+ ;
+
+
+define_list : LETTER
+ {
+ add_local(letter_node($1));
+ free($1);
+ }
+ | LETTER LBRACKET RBRACKET
+ {
+ add_local(array_node($1));
+ free($1);
+ }
+ | define_list COMMA LETTER
+ {
+ add_local(letter_node($3));
+ free($3);
+ }
+ | define_list COMMA LETTER LBRACKET RBRACKET
+ {
+ add_local(array_node($3));
+ free($3);
+ }
+ ;
+
+
+opt_argument_list
+ : /* empty */
+ {
+ $$ = cs("");
+ }
+ | argument_list
+ ;
+
+
+argument_list : expression
+ | argument_list COMMA expression
+ {
+ $$ = node($1, $3, END_NODE);
+ }
+ | argument_list COMMA LETTER LBRACKET RBRACKET
+ {
+ $$ = node($1, cs("l"), array_node($3),
+ END_NODE);
+ free($3);
+ }
+ ;
+
+opt_relational_expression
+ : /* empty */
+ {
+ $$ = cs(" 0 0=");
+ }
+ | relational_expression
+ ;
+
+relational_expression
+ : expression EQUALS expression
+ {
+ $$ = node($1, $3, cs("="), END_NODE);
+ }
+ | expression UNEQUALS expression
+ {
+ $$ = node($1, $3, cs("!="), END_NODE);
+ }
+ | expression LESS expression
+ {
+ $$ = node($1, $3, cs(">"), END_NODE);
+ }
+ | expression LESS_EQ expression
+ {
+ $$ = node($1, $3, cs("!<"), END_NODE);
+ }
+ | expression GREATER expression
+ {
+ $$ = node($1, $3, cs("<"), END_NODE);
+ }
+ | expression GREATER_EQ expression
+ {
+ $$ = node($1, $3, cs("!>"), END_NODE);
+ }
+ | expression
+ {
+ $$ = node($1, cs(" 0!="), END_NODE);
+ }
+ ;
+
+
+return_expression
+ : /* empty */
+ {
+ $$ = node(cs("0"), epilogue,
+ numnode(nesting), cs("Q"), END_NODE);
+ }
+ | expression
+ {
+ $$ = node($1, epilogue,
+ numnode(nesting), cs("Q"), END_NODE);
+ }
+ | LPAR RPAR
+ {
+ $$ = node(cs("0"), epilogue,
+ numnode(nesting), cs("Q"), END_NODE);
+ }
+ ;
+
+
+opt_expression : /* empty */
+ {
+ $$ = cs(" 0");
+ }
+ | expression
+ ;
+
+expression : named_expression
+ {
+ $$ = node($1.load, END_NODE);
+ }
+ | DOT {
+ $$ = node(cs("l."), END_NODE);
+ }
+ | NUMBER
+ {
+ $$ = node(cs(" "), as($1), END_NODE);
+ }
+ | LPAR expression RPAR
+ {
+ $$ = $2;
+ }
+ | LETTER LPAR opt_argument_list RPAR
+ {
+ $$ = node($3, cs("l"),
+ function_node($1), cs("x"),
+ END_NODE);
+ free($1);
+ }
+ | MINUS expression %prec UMINUS
+ {
+ $$ = node(cs(" 0"), $2, cs("-"),
+ END_NODE);
+ }
+ | expression PLUS expression
+ {
+ $$ = node($1, $3, cs("+"), END_NODE);
+ }
+ | expression MINUS expression
+ {
+ $$ = node($1, $3, cs("-"), END_NODE);
+ }
+ | expression MULTIPLY expression
+ {
+ $$ = node($1, $3, cs("*"), END_NODE);
+ }
+ | expression DIVIDE expression
+ {
+ $$ = node($1, $3, cs("/"), END_NODE);
+ }
+ | expression REMAINDER expression
+ {
+ $$ = node($1, $3, cs("%"), END_NODE);
+ }
+ | expression EXPONENT expression
+ {
+ $$ = node($1, $3, cs("^"), END_NODE);
+ }
+ | INCR named_expression
+ {
+ $$ = node($2.load, cs("1+d"), $2.store,
+ END_NODE);
+ }
+ | DECR named_expression
+ {
+ $$ = node($2.load, cs("1-d"),
+ $2.store, END_NODE);
+ }
+ | named_expression INCR
+ {
+ $$ = node($1.load, cs("d1+"),
+ $1.store, END_NODE);
+ }
+ | named_expression DECR
+ {
+ $$ = node($1.load, cs("d1-"),
+ $1.store, END_NODE);
+ }
+ | named_expression ASSIGN_OP expression
+ {
+ if ($2[0] == '\0')
+ $$ = node($3, cs($2), cs("d"), $1.store,
+ END_NODE);
+ else
+ $$ = node($1.load, $3, cs($2), cs("d"),
+ $1.store, END_NODE);
+ }
+ | LENGTH LPAR expression RPAR
+ {
+ $$ = node($3, cs("Z"), END_NODE);
+ }
+ | SQRT LPAR expression RPAR
+ {
+ $$ = node($3, cs("v"), END_NODE);
+ }
+ | SCALE LPAR expression RPAR
+ {
+ $$ = node($3, cs("X"), END_NODE);
+ }
+ | BOOL_NOT expression
+ {
+ $$ = node($2, cs("N"), END_NODE);
+ }
+ | expression BOOL_AND alloc_macro pop_nesting expression
+ {
+ ssize_t n = node(cs("R"), $5, END_NODE);
+ emit_macro($3, n);
+ $$ = node($1, cs("d0!="), $3, END_NODE);
+ }
+ | expression BOOL_OR alloc_macro pop_nesting expression
+ {
+ ssize_t n = node(cs("R"), $5, END_NODE);
+ emit_macro($3, n);
+ $$ = node($1, cs("d0="), $3, END_NODE);
+ }
+ | expression EQUALS expression
+ {
+ $$ = node($1, $3, cs("G"), END_NODE);
+ }
+ | expression UNEQUALS expression
+ {
+ $$ = node($1, $3, cs("GN"), END_NODE);
+ }
+ | expression LESS expression
+ {
+ $$ = node($3, $1, cs("("), END_NODE);
+ }
+ | expression LESS_EQ expression
+ {
+ $$ = node($3, $1, cs("{"), END_NODE);
+ }
+ | expression GREATER expression
+ {
+ $$ = node($1, $3, cs("("), END_NODE);
+ }
+ | expression GREATER_EQ expression
+ {
+ $$ = node($1, $3, cs("{"), END_NODE);
+ }
+ ;
+
+named_expression
+ : LETTER
+ {
+ $$.load = node(cs("l"), letter_node($1),
+ END_NODE);
+ $$.store = node(cs("s"), letter_node($1),
+ END_NODE);
+ free($1);
+ }
+ | LETTER LBRACKET expression RBRACKET
+ {
+ $$.load = node($3, cs(";"),
+ array_node($1), END_NODE);
+ $$.store = node($3, cs(":"),
+ array_node($1), END_NODE);
+ free($1);
+ }
+ | SCALE
+ {
+ $$.load = cs("K");
+ $$.store = cs("k");
+ }
+ | IBASE
+ {
+ $$.load = cs("I");
+ $$.store = cs("i");
+ }
+ | OBASE
+ {
+ $$.load = cs("O");
+ $$.store = cs("o");
+ }
+ ;
+
+print_expression_list
+ : print_expression
+ | print_expression_list COMMA print_expression
+ {
+ $$ = node($1, $3, END_NODE);
+ }
+
+print_expression
+ : expression
+ {
+ $$ = node($1, cs("ds.n"), END_NODE);
+ }
+ | STRING
+ {
+ char *p = escape($1);
+ $$ = node(cs("["), as(p), cs("]n"), END_NODE);
+ free(p);
+ }
+%%
+
+
+static void
+grow(void)
+{
+ struct tree *p;
+ size_t newsize;
+
+ if (current == instr_sz) {
+ newsize = instr_sz * 2 + 1;
+ p = realloc(instructions, newsize * sizeof(*p));
+ if (p == NULL) {
+ free(instructions);
+ err(1, NULL);
+ }
+ instructions = p;
+ instr_sz = newsize;
+ }
+}
+
+static ssize_t
+cs(const char *str)
+{
+
+ grow();
+ instructions[current].index = CONST_STRING;
+ instructions[current].u.cstr = str;
+ return (current++);
+}
+
+static ssize_t
+as(const char *str)
+{
+
+ grow();
+ instructions[current].index = ALLOC_STRING;
+ instructions[current].u.astr = strdup(str);
+ if (instructions[current].u.astr == NULL)
+ err(1, NULL);
+ return (current++);
+}
+
+static ssize_t
+node(ssize_t arg, ...)
+{
+ va_list ap;
+ ssize_t ret;
+
+ va_start(ap, arg);
+
+ ret = current;
+ grow();
+ instructions[current++].index = arg;
+
+ do {
+ arg = va_arg(ap, ssize_t);
+ grow();
+ instructions[current++].index = arg;
+ } while (arg != END_NODE);
+
+ va_end(ap);
+ return (ret);
+}
+
+static void
+emit(ssize_t i, int level)
+{
+
+ if (level > 1000)
+ errx(1, "internal error: tree level > 1000");
+ if (instructions[i].index >= 0) {
+ while (instructions[i].index != END_NODE &&
+ instructions[i].index != i) {
+ emit(instructions[i].index, level + 1);
+ i++;
+ }
+ } else if (instructions[i].index != END_NODE)
+ fputs(instructions[i].u.cstr, stdout);
+}
+
+static void
+emit_macro(int nodeidx, ssize_t code)
+{
+
+ putchar('[');
+ emit(code, 0);
+ printf("]s%s\n", instructions[nodeidx].u.cstr);
+ nesting--;
+}
+
+static void
+free_tree(void)
+{
+ ssize_t i;
+
+ for (i = 0; i < current; i++)
+ if (instructions[i].index == ALLOC_STRING)
+ free(instructions[i].u.astr);
+ current = 0;
+}
+
+static ssize_t
+numnode(int num)
+{
+ const char *p;
+
+ if (num < 10)
+ p = str_table['0' + num];
+ else if (num < 16)
+ p = str_table['A' - 10 + num];
+ else
+ errx(1, "internal error: break num > 15");
+ return (node(cs(" "), cs(p), END_NODE));
+}
+
+
+static ssize_t
+lookup(char * str, size_t len, char type)
+{
+ ENTRY entry, *found;
+ u_char *p;
+ u_short num;
+
+ /* The scanner allocated an extra byte already */
+ if (str[len-1] != type) {
+ str[len] = type;
+ str[len+1] = '\0';
+ }
+ entry.key = str;
+ found = hsearch(entry, FIND);
+ if (found == NULL) {
+ if (var_count == MAX_VARIABLES)
+ errx(1, "too many variables");
+ p = malloc(4);
+ if (p == NULL)
+ err(1, NULL);
+ num = var_count++;
+ p[0] = 255;
+ p[1] = ENCODE(num / VAR_BASE + 1);
+ p[2] = ENCODE(num % VAR_BASE + 1);
+ p[3] = '\0';
+
+ entry.data = (char *)p;
+ entry.key = strdup(str);
+ if (entry.key == NULL)
+ err(1, NULL);
+ found = hsearch(entry, ENTER);
+ if (found == NULL)
+ err(1, NULL);
+ }
+ return (cs(found->data));
+}
+
+static ssize_t
+letter_node(char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ if (len == 1 && str[0] != '_')
+ return (cs(str_table[(int)str[0]]));
+ else
+ return (lookup(str, len, 'L'));
+}
+
+static ssize_t
+array_node(char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ if (len == 1 && str[0] != '_')
+ return (cs(str_table[(int)str[0] - 'a' + ARRAY_CHAR]));
+ else
+ return (lookup(str, len, 'A'));
+}
+
+static ssize_t
+function_node(char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ if (len == 1 && str[0] != '_')
+ return (cs(str_table[(int)str[0] - 'a' + FUNC_CHAR]));
+ else
+ return (lookup(str, len, 'F'));
+}
+
+static void
+add_par(ssize_t n)
+{
+
+ prologue = node(cs("S"), n, prologue, END_NODE);
+ epilogue = node(epilogue, cs("L"), n, cs("s."), END_NODE);
+}
+
+static void
+add_local(ssize_t n)
+{
+
+ prologue = node(cs("0S"), n, prologue, END_NODE);
+ epilogue = node(epilogue, cs("L"), n, cs("s."), END_NODE);
+}
+
+void
+yyerror(const char *s)
+{
+ char *p, *str;
+ int n;
+
+ if (yyin != NULL && feof(yyin))
+ n = asprintf(&str, "%s: %s:%d: %s: unexpected EOF",
+ __progname, filename, lineno, s);
+ else if (yytext[0] == '\n')
+ n = asprintf(&str,
+ "%s: %s:%d: %s: newline unexpected",
+ __progname, filename, lineno, s);
+ else if (isspace((unsigned char)yytext[0]) ||
+ !isprint((unsigned char)yytext[0]))
+ n = asprintf(&str,
+ "%s: %s:%d: %s: ascii char 0x%02x unexpected",
+ __progname, filename, lineno, s, yytext[0] & 0xff);
+ else
+ n = asprintf(&str, "%s: %s:%d: %s: %s unexpected",
+ __progname, filename, lineno, s, yytext);
+ if (n == -1)
+ err(1, NULL);
+
+ fputs("c[", stdout);
+ for (p = str; *p != '\0'; p++) {
+ if (*p == '[' || *p == ']' || *p =='\\')
+ putchar('\\');
+ putchar(*p);
+ }
+ fputs("]pc\n", stdout);
+ free(str);
+}
+
+void
+fatal(const char *s)
+{
+
+ errx(1, "%s:%d: %s", filename, lineno, s);
+}
+
+static void
+warning(const char *s)
+{
+
+ warnx("%s:%d: %s", filename, lineno, s);
+}
+
+static void
+init(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < UCHAR_MAX; i++) {
+ str_table[i][0] = i;
+ str_table[i][1] = '\0';
+ }
+ if (hcreate(1 << 16) == 0)
+ err(1, NULL);
+}
+
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: %s [-chlv] [-e expression] [file ...]\n",
+ __progname);
+ exit(1);
+}
+
+static char *
+escape(const char *str)
+{
+ char *p, *ret;
+
+ ret = malloc(strlen(str) + 1);
+ if (ret == NULL)
+ err(1, NULL);
+
+ p = ret;
+ while (*str != '\0') {
+ /*
+ * We get _escaped_ strings here. Single backslashes are
+ * already converted to double backslashes
+ */
+ if (*str == '\\') {
+ if (*++str == '\\') {
+ switch (*++str) {
+ case 'a':
+ *p++ = '\a';
+ break;
+ case 'b':
+ *p++ = '\b';
+ break;
+ case 'f':
+ *p++ = '\f';
+ break;
+ case 'n':
+ *p++ = '\n';
+ break;
+ case 'q':
+ *p++ = '"';
+ break;
+ case 'r':
+ *p++ = '\r';
+ break;
+ case 't':
+ *p++ = '\t';
+ break;
+ case '\\':
+ *p++ = '\\';
+ break;
+ }
+ str++;
+ } else {
+ *p++ = '\\';
+ *p++ = *str++;
+ }
+ } else
+ *p++ = *str++;
+ }
+ *p = '\0';
+ return (ret);
+}
+
+/* ARGSUSED */
+static void
+sigchld(int signo __unused)
+{
+ pid_t pid;
+ int status, save_errno = errno;
+
+ for (;;) {
+ pid = waitpid(dc, &status, WCONTINUED | WNOHANG);
+ if (pid == -1) {
+ if (errno == EINTR)
+ continue;
+ _exit(0);
+ } else if (pid == 0)
+ break;
+ if (WIFEXITED(status) || WIFSIGNALED(status))
+ _exit(0);
+ else
+ break;
+ }
+ errno = save_errno;
+}
+
+static const char *
+dummy_prompt(void)
+{
+
+ return ("");
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *q;
+ int p[2];
+ int ch, i;
+
+ init();
+ setvbuf(stdout, NULL, _IOLBF, 0);
+
+ sargv = malloc(argc * sizeof(char *));
+ if (sargv == NULL)
+ err(1, NULL);
+
+ if ((cmdexpr = strdup("")) == NULL)
+ err(1, NULL);
+ /* The d debug option is 4.4 BSD bc(1) compatible */
+ while ((ch = getopt_long(argc, argv, "cde:hlqv",
+ long_options, NULL)) != -1) {
+ switch (ch) {
+ case 'c':
+ case 'd':
+ do_fork = false;
+ break;
+ case 'e':
+ q = cmdexpr;
+ if (asprintf(&cmdexpr, "%s%s\n", cmdexpr, optarg) == -1)
+ err(1, NULL);
+ free(q);
+ break;
+ case 'h':
+ usage();
+ break;
+ case 'l':
+ sargv[sargc++] = _PATH_LIBB;
+ break;
+ case 'q':
+ /* compatibility option */
+ break;
+ case 'v':
+ fprintf(stderr, "%s (BSD bc) %s\n", __progname, BC_VER);
+ exit(0);
+ break;
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ interactive = isatty(STDIN_FILENO);
+ for (i = 0; i < argc; i++)
+ sargv[sargc++] = argv[i];
+
+ if (do_fork) {
+ if (pipe(p) == -1)
+ err(1, "cannot create pipe");
+ dc = fork();
+ if (dc == -1)
+ err(1, "cannot fork");
+ else if (dc != 0) {
+ signal(SIGCHLD, sigchld);
+ close(STDOUT_FILENO);
+ dup(p[1]);
+ close(p[0]);
+ close(p[1]);
+ } else {
+ close(STDIN_FILENO);
+ dup(p[0]);
+ close(p[0]);
+ close(p[1]);
+ execl(_PATH_DC, "dc", "-x", (char *)NULL);
+ err(1, "cannot find dc");
+ }
+ }
+ if (interactive) {
+ gettty(&ttysaved);
+ el = el_init("bc", stdin, stderr, stderr);
+ hist = history_init();
+ history(hist, &he, H_SETSIZE, 100);
+ el_set(el, EL_HIST, history, hist);
+ el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_SIGNAL, 1);
+ el_set(el, EL_PROMPT, dummy_prompt);
+ el_set(el, EL_ADDFN, "bc_eof", "", bc_eof);
+ el_set(el, EL_BIND, "^D", "bc_eof", NULL);
+ el_source(el, NULL);
+ }
+ yywrap();
+ return (yyparse());
+}
diff --git a/usr.bin/bc/extern.h b/usr.bin/bc/extern.h
new file mode 100644
index 0000000..7909a17
--- /dev/null
+++ b/usr.bin/bc/extern.h
@@ -0,0 +1,47 @@
+/* $FreeBSD$ */
+/* $OpenBSD: extern.h,v 1.12 2014/04/17 19:07:14 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <stdbool.h>
+#include <stdio.h>
+
+struct lvalue {
+ ssize_t load;
+ ssize_t store;
+};
+
+int yylex(void);
+void yyerror(const char *);
+void fatal(const char *);
+void abort_line(int);
+struct termios;
+int gettty(struct termios *);
+void tstpcont(int);
+unsigned char bc_eof(EditLine *, int);
+
+extern int lineno;
+extern int fileindex;
+extern int sargc;
+extern const char **sargv;
+extern const char *filename;
+extern bool interactive;
+extern EditLine *el;
+extern History *hist;
+extern HistEvent he;
+extern char *cmdexpr;
+extern struct termios ttysaved;
diff --git a/usr.bin/bc/pathnames.h b/usr.bin/bc/pathnames.h
new file mode 100644
index 0000000..defb766
--- /dev/null
+++ b/usr.bin/bc/pathnames.h
@@ -0,0 +1,21 @@
+/* $FreeBSD$ */
+/* $OpenBSD: pathnames.h,v 1.1 2003/09/25 19:32:44 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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.
+ */
+
+#define _PATH_LIBB "/usr/share/misc/bc.library"
+#define _PATH_DC "/usr/bin/dc"
diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l
new file mode 100644
index 0000000..cb1977a
--- /dev/null
+++ b/usr.bin/bc/scan.l
@@ -0,0 +1,370 @@
+%{
+/* $OpenBSD: scan.l,v 1.28 2013/09/19 16:12:01 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <err.h>
+#include <errno.h>
+#include <histedit.h>
+#include <stdbool.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+#include "bc.h"
+#include "pathnames.h"
+
+int lineno;
+bool interactive;
+
+HistEvent he;
+EditLine *el;
+History *hist;
+
+static char *strbuf = NULL;
+static size_t strbuf_sz = 1;
+static bool dot_seen;
+static int use_el;
+static volatile sig_atomic_t skipchars;
+
+static void init_strbuf(void);
+static void add_str(const char *);
+
+static int bc_yyinput(char *, int);
+
+#define YY_DECL int yylex(void)
+#define YY_NO_INPUT
+#undef YY_INPUT
+#define YY_INPUT(buf,retval,max) \
+ (retval = bc_yyinput(buf, max))
+
+%}
+
+%option always-interactive
+
+DIGIT [0-9A-F]
+ALPHA [a-z_]
+ALPHANUM [a-z_0-9]
+
+%x comment string number
+
+%%
+
+"/*" BEGIN(comment);
+<comment>{
+ "*/" BEGIN(INITIAL);
+ \n lineno++;
+ \* ;
+ [^*\n]+ ;
+ <<EOF>> fatal("end of file in comment");
+}
+
+\" BEGIN(string); init_strbuf();
+<string>{
+ [^"\n\\\[\]]+ add_str(yytext);
+ \[ add_str("\\[");
+ \] add_str("\\]");
+ \\ add_str("\\\\");
+ \n add_str("\n"); lineno++;
+ \" BEGIN(INITIAL); yylval.str = strbuf; return STRING;
+ <<EOF>> fatal("end of file in string");
+}
+
+{DIGIT}+ {
+ BEGIN(number);
+ dot_seen = false;
+ init_strbuf();
+ add_str(yytext);
+ }
+\. {
+ BEGIN(number);
+ dot_seen = true;
+ init_strbuf();
+ add_str(".");
+ }
+<number>{
+ {DIGIT}+ add_str(yytext);
+ \. {
+ if (dot_seen) {
+ BEGIN(INITIAL);
+ yylval.str = strbuf;
+ unput('.');
+ return NUMBER;
+ } else {
+ dot_seen = true;
+ add_str(".");
+ }
+ }
+ \\\n[ \t]* lineno++;
+ [^0-9A-F\.] {
+ BEGIN(INITIAL);
+ unput(yytext[0]);
+ if (strcmp(strbuf, ".") == 0)
+ return DOT;
+ else {
+ yylval.str = strbuf;
+ return NUMBER;
+ }
+ }
+}
+
+"auto" return AUTO;
+"break" return BREAK;
+"continue" return CONTINUE;
+"define" return DEFINE;
+"else" return ELSE;
+"ibase" return IBASE;
+"if" return IF;
+"last" return DOT;
+"for" return FOR;
+"length" return LENGTH;
+"obase" return OBASE;
+"print" return PRINT;
+"quit" return QUIT;
+"return" return RETURN;
+"scale" return SCALE;
+"sqrt" return SQRT;
+"while" return WHILE;
+
+"^" return EXPONENT;
+"*" return MULTIPLY;
+"/" return DIVIDE;
+"%" return REMAINDER;
+
+"!" return BOOL_NOT;
+"&&" return BOOL_AND;
+"||" return BOOL_OR;
+
+"+" return PLUS;
+"-" return MINUS;
+
+"++" return INCR;
+"--" return DECR;
+
+"=" yylval.str = ""; return ASSIGN_OP;
+"+=" yylval.str = "+"; return ASSIGN_OP;
+"-=" yylval.str = "-"; return ASSIGN_OP;
+"*=" yylval.str = "*"; return ASSIGN_OP;
+"/=" yylval.str = "/"; return ASSIGN_OP;
+"%=" yylval.str = "%"; return ASSIGN_OP;
+"^=" yylval.str = "^"; return ASSIGN_OP;
+
+"==" return EQUALS;
+"<=" return LESS_EQ;
+">=" return GREATER_EQ;
+"!=" return UNEQUALS;
+"<" return LESS;
+">" return GREATER;
+
+"," return COMMA;
+";" return SEMICOLON;
+
+"(" return LPAR;
+")" return RPAR;
+
+"[" return LBRACKET;
+"]" return RBRACKET;
+
+"{" return LBRACE;
+"}" return RBRACE;
+
+{ALPHA}{ALPHANUM}* {
+ /* alloc an extra byte for the type marker */
+ char *p = malloc(yyleng + 2);
+ if (p == NULL)
+ err(1, NULL);
+ strlcpy(p, yytext, yyleng + 1);
+ yylval.astr = p;
+ return LETTER;
+ }
+
+\\\n lineno++;
+\n lineno++; return NEWLINE;
+
+#[^\n]* ;
+[ \t] ;
+<<EOF>> return QUIT;
+. yyerror("illegal character");
+
+%%
+
+static void
+init_strbuf(void)
+{
+ if (strbuf == NULL) {
+ strbuf = malloc(strbuf_sz);
+ if (strbuf == NULL)
+ err(1, NULL);
+ }
+ strbuf[0] = '\0';
+}
+
+static void
+add_str(const char *str)
+{
+ size_t arglen;
+
+ arglen = strlen(str);
+
+ if (strlen(strbuf) + arglen + 1 > strbuf_sz) {
+ size_t newsize;
+ char *p;
+
+ newsize = strbuf_sz + arglen + 1;
+ p = realloc(strbuf, newsize);
+ if (p == NULL) {
+ free(strbuf);
+ err(1, NULL);
+ }
+ strbuf_sz = newsize;
+ strbuf = p;
+ }
+ strlcat(strbuf, str, strbuf_sz);
+}
+
+/* ARGSUSED */
+void
+abort_line(int sig __unused)
+{
+ static const char str1[] = "[\n]P\n";
+ static const char str2[] = "[^C\n]P\n";
+ int save_errno;
+ const LineInfo *info;
+
+ save_errno = errno;
+ if (use_el) {
+ write(STDOUT_FILENO, str2, sizeof(str2) - 1);
+ info = el_line(el);
+ skipchars = info->lastchar - info->buffer;
+ } else
+ write(STDOUT_FILENO, str1, sizeof(str1) - 1);
+ errno = save_errno;
+}
+
+/*
+ * Avoid the echo of ^D by the default code of editline and take
+ * into account skipchars to make ^D work when the cursor is at start of
+ * line after a ^C.
+ */
+unsigned char
+bc_eof(EditLine *e, int ch __unused)
+{
+ const struct lineinfo *info = el_line(e);
+
+ if (info->buffer + skipchars == info->cursor &&
+ info->cursor == info->lastchar)
+ return (CC_EOF);
+ else
+ return (CC_ERROR);
+}
+
+int
+yywrap(void)
+{
+ static int state;
+ static YY_BUFFER_STATE buf;
+
+ if (fileindex == 0 && sargc > 0 && strcmp(sargv[0], _PATH_LIBB) == 0) {
+ filename = sargv[fileindex++];
+ yyin = fopen(filename, "r");
+ lineno = 1;
+ if (yyin == NULL)
+ err(1, "cannot open %s", filename);
+ return (0);
+ }
+ if (state == 0 && cmdexpr[0] != '\0') {
+ buf = yy_scan_string(cmdexpr);
+ state++;
+ lineno = 1;
+ filename = "command line";
+ return (0);
+ } else if (state == 1) {
+ yy_delete_buffer(buf);
+ free(cmdexpr);
+ state++;
+ }
+ if (yyin != NULL && yyin != stdin)
+ fclose(yyin);
+ if (fileindex < sargc) {
+ filename = sargv[fileindex++];
+ yyin = fopen(filename, "r");
+ lineno = 1;
+ if (yyin == NULL)
+ err(1, "cannot open %s", filename);
+ return (0);
+ } else if (fileindex == sargc) {
+ fileindex++;
+ yyin = stdin;
+ if (interactive) {
+ signal(SIGINT, abort_line);
+ signal(SIGTSTP, tstpcont);
+ }
+ lineno = 1;
+ filename = "stdin";
+ return (0);
+ }
+ return (1);
+}
+
+static int
+bc_yyinput(char *buf, int maxlen)
+{
+ int num;
+
+ if (el != NULL)
+ el_get(el, EL_EDITMODE, &use_el);
+
+ if (yyin == stdin && interactive && use_el) {
+ const char *bp;
+ sigset_t oset, nset;
+
+ if ((bp = el_gets(el, &num)) == NULL || num == 0)
+ return (0);
+ sigemptyset(&nset);
+ sigaddset(&nset, SIGINT);
+ sigprocmask(SIG_BLOCK, &nset, &oset);
+ if (skipchars < num) {
+ bp += skipchars;
+ num -= skipchars;
+ }
+ skipchars = 0;
+ sigprocmask(SIG_SETMASK, &oset, NULL);
+ if (num > maxlen) {
+ el_push(el, bp + maxlen);
+ num = maxlen;
+ }
+ memcpy(buf, bp, num);
+ history(hist, &he, H_ENTER, bp);
+ el_get(el, EL_EDITMODE, &use_el);
+ } else {
+ int c = '*';
+ for (num = 0; num < maxlen &&
+ (c = getc(yyin)) != EOF && c != '\n'; ++num)
+ buf[num] = (char) c;
+ if (c == '\n')
+ buf[num++] = (char) c;
+ if (c == EOF && ferror(yyin))
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+ }
+ return (num);
+}
+
+
diff --git a/usr.bin/bc/tty.c b/usr.bin/bc/tty.c
new file mode 100644
index 0000000..f5d72fc
--- /dev/null
+++ b/usr.bin/bc/tty.c
@@ -0,0 +1,65 @@
+/* $FreeBSD$ */
+/* $OpenBSD: tty.c,v 1.3 2015/09/05 09:49:24 jsg Exp $ */
+
+/*
+ * Copyright (c) 2013, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <errno.h>
+#include <signal.h>
+#include <histedit.h>
+#include <termios.h>
+#include "extern.h"
+
+struct termios ttysaved, ttyedit;
+
+static int
+settty(struct termios *t)
+{
+ int ret;
+
+ while ((ret = tcsetattr(0, TCSADRAIN, t)) == -1 && errno == EINTR)
+ continue;
+ return ret;
+}
+
+int
+gettty(struct termios *t)
+{
+ int ret;
+
+ while ((ret = tcgetattr(0, t)) == -1 && errno == EINTR)
+ continue;
+ return ret;
+}
+
+/* ARGSUSED */
+void
+tstpcont(int sig)
+{
+ int save_errno = errno;
+
+ if (sig == SIGTSTP) {
+ signal(SIGCONT, tstpcont);
+ gettty(&ttyedit);
+ settty(&ttysaved);
+ } else {
+ signal(SIGTSTP, tstpcont);
+ settty(&ttyedit);
+ }
+ signal(sig, SIG_DFL);
+ kill(0, sig);
+ errno = save_errno;
+}
diff --git a/usr.bin/biff/Makefile b/usr.bin/biff/Makefile
new file mode 100644
index 0000000..1510943
--- /dev/null
+++ b/usr.bin/biff/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= biff
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/biff/Makefile.depend b/usr.bin/biff/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/biff/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/biff/biff.1 b/usr.bin/biff/biff.1
new file mode 100644
index 0000000..b22956d
--- /dev/null
+++ b/usr.bin/biff/biff.1
@@ -0,0 +1,123 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)biff.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 28, 2013
+.Dt BIFF 1
+.Os
+.Sh NAME
+.Nm biff
+.Nd "be notified if mail arrives and who it is from"
+.Sh SYNOPSIS
+.Nm
+.Op Cm n | y | b
+.Sh DESCRIPTION
+The
+.Nm
+utility informs the system whether you want to be notified on your terminal
+when mail arrives.
+.Pp
+Affected is the first terminal associated with the standard input,
+standard output or standard error file descriptor, in that order.
+Thus, it is possible to use the redirection facilities of a shell to
+toggle the notification for other terminals than the one
+.Nm
+runs on.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Cm n
+Disable notification.
+.It Cm y
+Enable header notification.
+.It Cm b
+Enable bell notification.
+.El
+.Pp
+When header notification is enabled, the header and first few lines of
+the message will be printed on your terminal whenever mail arrives.
+A
+.Dq "biff y"
+command is often included in the file
+.Pa .login
+or
+.Pa .profile
+to be executed at each login.
+.Pp
+When bell notification is enabled, only two bell characters
+.Tn ( ASCII
+\\007)
+will be printed on your terminal whenever mail arrives.
+.Pp
+If no arguments are given,
+.Nm
+displays the present notification status of the terminal to the
+standard output.
+.Pp
+The
+.Nm
+utility operates asynchronously.
+For synchronous notification use the
+.Ev MAIL
+variable of
+.Xr sh 1
+or the
+.Va mail
+variable of
+.Xr csh 1 .
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Bl -tag -width indent
+.It 0
+Notification was enabled at the time of invocation.
+.It 1
+Notification was disabled at the time of invocation.
+.It >1
+An error occurred.
+.El
+.Sh COMPATIBILITY
+Previous versions of the
+.Nm
+utility affected the terminal attached to standard error without first
+trying the standard input or output devices.
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr mail 1 ,
+.Xr sh 1 ,
+.Xr comsat 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.0 .
+It was named after the dog of Heidi Stettner.
+He died
+in August 1993, at 15.
diff --git a/usr.bin/biff/biff.c b/usr.bin/biff/biff.c
new file mode 100644
index 0000000..0adda01
--- /dev/null
+++ b/usr.bin/biff/biff.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)biff.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ int ch;
+ char *name;
+
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if ((name = ttyname(STDIN_FILENO)) == NULL &&
+ (name = ttyname(STDOUT_FILENO)) == NULL &&
+ (name = ttyname(STDERR_FILENO)) == NULL)
+ err(2, "unknown tty");
+
+ if (stat(name, &sb))
+ err(2, "stat");
+
+ if (*argv == NULL) {
+ (void)printf("is %s\n",
+ sb.st_mode & S_IXUSR ? "y" :
+ sb.st_mode & S_IXGRP ? "b" : "n");
+ return (sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1);
+
+ }
+
+ switch (argv[0][0]) {
+ case 'n':
+ if (chmod(name, sb.st_mode & ~(S_IXUSR | S_IXGRP)) < 0)
+ err(2, "%s", name);
+ break;
+ case 'y':
+ if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXUSR)
+ < 0)
+ err(2, "%s", name);
+ break;
+ case 'b':
+ if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXGRP)
+ < 0)
+ err(2, "%s", name);
+ break;
+ default:
+ usage();
+ }
+ return (sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: biff [n | y | b]\n");
+ exit(2);
+}
diff --git a/usr.bin/bluetooth/Makefile b/usr.bin/bluetooth/Makefile
new file mode 100644
index 0000000..9ef16cc
--- /dev/null
+++ b/usr.bin/bluetooth/Makefile
@@ -0,0 +1,10 @@
+# $Id $
+# $FreeBSD$
+
+SUBDIR= \
+ bthost \
+ btsockstat \
+ rfcomm_sppd
+
+.include <bsd.subdir.mk>
+
diff --git a/usr.bin/bluetooth/Makefile.inc b/usr.bin/bluetooth/Makefile.inc
new file mode 100644
index 0000000..c0e05cf
--- /dev/null
+++ b/usr.bin/bluetooth/Makefile.inc
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../../Makefile.inc"
+
diff --git a/usr.bin/bluetooth/bthost/Makefile b/usr.bin/bluetooth/bthost/Makefile
new file mode 100644
index 0000000..13b1d90
--- /dev/null
+++ b/usr.bin/bluetooth/bthost/Makefile
@@ -0,0 +1,8 @@
+# $Id: Makefile,v 1.4 2003/08/14 20:07:13 max Exp $
+# $FreeBSD$
+
+PROG= bthost
+
+LIBADD= bluetooth
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bluetooth/bthost/Makefile.depend b/usr.bin/bluetooth/bthost/Makefile.depend
new file mode 100644
index 0000000..5d21038
--- /dev/null
+++ b/usr.bin/bluetooth/bthost/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbluetooth \
+ 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/bluetooth/bthost/bthost.1 b/usr.bin/bluetooth/bthost/bthost.1
new file mode 100644
index 0000000..6ee4b08
--- /dev/null
+++ b/usr.bin/bluetooth/bthost/bthost.1
@@ -0,0 +1,115 @@
+.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" 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.
+.\"
+.\" $Id: bthost.1,v 1.7 2003/05/21 22:19:00 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd May 8, 2003
+.Dt BTHOST 1
+.Os
+.Sh NAME
+.Nm bthost
+.Nd look up Bluetooth host names and Protocol Service Multiplexor values
+.Sh SYNOPSIS
+.Nm
+.Op Fl bhp
+.Ar host_or_protocol
+.Sh DESCRIPTION
+The
+.Nm
+utility looks for information about Bluetooth hosts and
+Protocol Service Multiplexor (PSM) values.
+It gets this information from the
+.Pa /etc/bluetooth/hosts
+and
+.Pa /etc/bluetooth/protocols
+files.
+.Pp
+In host mode, it simply converts between the host names and Bluetooth addresses.
+The argument can be either a host name or a Bluetooth address.
+The program first attempts to interpret it as a Bluetooth address.
+If this fails, it will treat it as a host name.
+A Bluetooth address consists of six hex bytes separated by a colon,
+e.g.,
+.Dq Li 01:02:03:04:05:06 .
+A host name consists of names separated by dots, e.g.,
+.Dq Li my.cell.phone .
+.Pp
+In protocol mode, it simply converts between the Protocol Service Multiplexor
+names and assigned numbers.
+The argument can be either a Protocol Service Multiplexor name or
+an assigned number.
+The program first attempts to interpret it as an assigned number.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b
+Produce brief output.
+.It Fl h
+Display usage message and exit.
+.It Fl p
+Activate protocol mode.
+.El
+.Pp
+The
+.Nm
+utility will print results to the standard output, and error messages to the
+standard error.
+An output can be quite different,
+here is an example that demonstrates all of the possibilities:
+.Bd -literal -offset indent
+% bthost localhost
+Host localhost has address FF:FF:FF:00:00:00
+% bthost ff:ff:ff:00:00:00
+Host FF:FF:FF:00:00:00 has name localhost
+% bthost -b localhost
+FF:FF:FF:00:00:00
+% bthost -b ff:ff:ff:00:00:00
+localhost
+% bthost do.not.exists
+do.not.exists: Unknown host
+% bthost 0:0:0:0:0:0
+00:00:00:00:00:00: Unknown host
+% bthost -p sdp
+Protocol/Service Multiplexor sdp has number 1
+% bthost -p 3
+Protocol/Service Multiplexor rfcomm has number 3
+% bthost -bp HID-Control
+17
+% bthost -p foo
+foo: Unknown Protocol/Service Multiplexor
+.Ed
+.Sh FILES
+.Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact
+.It Pa /etc/bluetooth/hosts
+.It Pa /etc/bluetooth/protocols
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr bluetooth 3 ,
+.Xr bluetooth.hosts 5 ,
+.Xr bluetooth.protocols 5
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
diff --git a/usr.bin/bluetooth/bthost/bthost.c b/usr.bin/bluetooth/bthost/bthost.c
new file mode 100644
index 0000000..69ce3f5
--- /dev/null
+++ b/usr.bin/bluetooth/bthost/bthost.c
@@ -0,0 +1,143 @@
+/*
+ * bthost.c
+ *
+ * Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+ * 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.
+ *
+ * $Id: bthost.c,v 1.5 2003/05/21 20:30:01 max Exp $
+ * $FreeBSD$
+ */
+
+#define L2CAP_SOCKET_CHECKED
+#include <bluetooth.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static int hostmode (char const *arg, int brief);
+static int protomode (char const *arg, int brief);
+static void usage (void);
+
+int
+main(int argc, char **argv)
+{
+ int opt, brief = 0, proto = 0;
+
+ while ((opt = getopt(argc, argv, "bhp")) != -1) {
+ switch (opt) {
+ case 'b':
+ brief = 1;
+ break;
+
+ case 'p':
+ proto = 1;
+ break;
+
+ case 'h':
+ default:
+ usage();
+ /* NOT REACHED */
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ exit(proto? protomode(*argv, brief) : hostmode(*argv, brief));
+}
+
+static int
+hostmode(char const *arg, int brief)
+{
+ struct hostent *he = NULL;
+ bdaddr_t ba;
+ char bastr[32];
+ int reverse;
+
+ if (bt_aton(arg, &ba) == 1) {
+ reverse = 1;
+ he = bt_gethostbyaddr((char const *) &ba, sizeof(ba),
+ AF_BLUETOOTH);
+ } else {
+ reverse = 0;
+ he = bt_gethostbyname(arg);
+ }
+
+ if (he == NULL) {
+ herror(reverse? bt_ntoa(&ba, bastr) : arg);
+ return (1);
+ }
+
+ if (brief)
+ printf("%s", reverse? he->h_name :
+ bt_ntoa((bdaddr_t *)(he->h_addr), bastr));
+ else
+ printf("Host %s has %s %s\n",
+ reverse? bt_ntoa(&ba, bastr) : arg,
+ reverse? "name" : "address",
+ reverse? he->h_name :
+ bt_ntoa((bdaddr_t *)(he->h_addr), bastr));
+
+ return (0);
+}
+
+static int
+protomode(char const *arg, int brief)
+{
+ struct protoent *pe = NULL;
+ int proto;
+
+ if ((proto = atoi(arg)) != 0)
+ pe = bt_getprotobynumber(proto);
+ else
+ pe = bt_getprotobyname(arg);
+
+ if (pe == NULL) {
+ fprintf(stderr, "%s: Unknown Protocol/Service Multiplexor\n", arg);
+ return (1);
+ }
+
+ if (brief) {
+ if (proto)
+ printf("%s", pe->p_name);
+ else
+ printf("%d", pe->p_proto);
+ } else {
+ printf("Protocol/Service Multiplexor %s has number %d\n",
+ pe->p_name, pe->p_proto);
+ }
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stdout, "Usage: bthost [-b -h -p] host_or_protocol\n");
+ exit(255);
+}
+
diff --git a/usr.bin/bluetooth/btsockstat/Makefile b/usr.bin/bluetooth/btsockstat/Makefile
new file mode 100644
index 0000000..36ef850
--- /dev/null
+++ b/usr.bin/bluetooth/btsockstat/Makefile
@@ -0,0 +1,11 @@
+# $Id: Makefile,v 1.7 2003/08/14 20:07:14 max Exp $
+# $FreeBSD$
+
+PROG= btsockstat
+WARNS?= 2
+BINGRP= kmem
+BINMODE= 2555
+
+LIBADD= bluetooth kvm
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bluetooth/btsockstat/Makefile.depend b/usr.bin/bluetooth/btsockstat/Makefile.depend
new file mode 100644
index 0000000..0ea1c90
--- /dev/null
+++ b/usr.bin/bluetooth/btsockstat/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbluetooth \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bluetooth/btsockstat/btsockstat.1 b/usr.bin/bluetooth/btsockstat/btsockstat.1
new file mode 100644
index 0000000..41bf2a1
--- /dev/null
+++ b/usr.bin/bluetooth/btsockstat/btsockstat.1
@@ -0,0 +1,83 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" 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.
+.\"
+.\" $Id: btsockstat.1,v 1.6 2003/05/21 00:09:45 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd October 12, 2003
+.Dt BTSOCKSTAT 1
+.Os
+.Sh NAME
+.Nm btsockstat
+.Nd show Bluetooth sockets information
+.Sh SYNOPSIS
+.Nm
+.Op Fl nrh
+.Op Fl M Ar core
+.Op Fl p Ar protocol
+.Sh DESCRIPTION
+The
+.Nm
+utility symbolically displays the contents of various Bluetooth sockets
+related data structures.
+There are few output formats, depending on the
+options for the information presented.
+The
+.Nm
+utility
+will print results to the standard output and error messages to the
+standard error.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl h
+Display usage message and exit.
+.It Fl M Ar core
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl n
+Show Bluetooth addresses as numbers.
+Normally,
+.Nm
+attempts to resolve Bluetooth addresses, and display them symbolically.
+.It Fl p Ar protocol
+Display a list of active sockets (protocol control blocks) for each
+specified protocol.
+Supported protocols are:
+.Cm hci_raw , l2cap_raw , l2cap, rfcomm
+and
+.Cm rfcomm_s .
+.It Fl r
+Display a list of active routing entries (if any) for specified protocol.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr ng_btsocket 4
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
+.Sh BUGS
+Most likely.
+Please report if found.
diff --git a/usr.bin/bluetooth/btsockstat/btsockstat.c b/usr.bin/bluetooth/btsockstat/btsockstat.c
new file mode 100644
index 0000000..78f6127
--- /dev/null
+++ b/usr.bin/bluetooth/btsockstat/btsockstat.c
@@ -0,0 +1,639 @@
+/*
+ * btsockstat.c
+ *
+ * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+ * 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.
+ *
+ * $Id: btsockstat.c,v 1.8 2003/05/21 22:40:25 max Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/callout.h>
+#include <sys/param.h>
+#include <sys/protosw.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+#include <net/if.h>
+
+#define L2CAP_SOCKET_CHECKED
+#include <bluetooth.h>
+#include <err.h>
+#include <fcntl.h>
+#include <kvm.h>
+#include <limits.h>
+#include <nlist.h>
+
+#include <netgraph/bluetooth/include/ng_bluetooth.h>
+#include <netgraph/bluetooth/include/ng_btsocket_hci_raw.h>
+#include <netgraph/bluetooth/include/ng_btsocket_l2cap.h>
+#include <netgraph/bluetooth/include/ng_btsocket_rfcomm.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void hcirawpr (kvm_t *kvmd, u_long addr);
+static void l2caprawpr (kvm_t *kvmd, u_long addr);
+static void l2cappr (kvm_t *kvmd, u_long addr);
+static void l2caprtpr (kvm_t *kvmd, u_long addr);
+static void rfcommpr (kvm_t *kvmd, u_long addr);
+static void rfcommpr_s (kvm_t *kvmd, u_long addr);
+
+static char * bdaddrpr (bdaddr_p const ba, char *str, int len);
+
+static kvm_t * kopen (char const *memf);
+static int kread (kvm_t *kvmd, u_long addr, char *buffer, int size);
+
+static void usage (void);
+
+/*
+ * List of symbols
+ */
+
+static struct nlist nl[] = {
+#define N_HCI_RAW 0
+ { "_ng_btsocket_hci_raw_sockets" },
+#define N_L2CAP_RAW 1
+ { "_ng_btsocket_l2cap_raw_sockets" },
+#define N_L2CAP 2
+ { "_ng_btsocket_l2cap_sockets" },
+#define N_L2CAP_RAW_RT 3
+ { "_ng_btsocket_l2cap_raw_rt" },
+#define N_L2CAP_RT 4
+ { "_ng_btsocket_l2cap_rt" },
+#define N_RFCOMM 5
+ { "_ng_btsocket_rfcomm_sockets" },
+#define N_RFCOMM_S 6
+ { "_ng_btsocket_rfcomm_sessions" },
+ { "" },
+};
+
+#define state2str(x) \
+ (((x) >= sizeof(states)/sizeof(states[0]))? "UNKNOWN" : states[(x)])
+
+/*
+ * Main
+ */
+
+static int numeric_bdaddr = 0;
+
+int
+main(int argc, char *argv[])
+{
+ int opt, proto = -1, route = 0;
+ kvm_t *kvmd = NULL;
+ char *memf = NULL;
+
+ while ((opt = getopt(argc, argv, "hnM:p:r")) != -1) {
+ switch (opt) {
+ case 'n':
+ numeric_bdaddr = 1;
+ break;
+
+ case 'M':
+ memf = optarg;
+ break;
+
+ case 'p':
+ if (strcasecmp(optarg, "hci_raw") == 0)
+ proto = N_HCI_RAW;
+ else if (strcasecmp(optarg, "l2cap_raw") == 0)
+ proto = N_L2CAP_RAW;
+ else if (strcasecmp(optarg, "l2cap") == 0)
+ proto = N_L2CAP;
+ else if (strcasecmp(optarg, "rfcomm") == 0)
+ proto = N_RFCOMM;
+ else if (strcasecmp(optarg, "rfcomm_s") == 0)
+ proto = N_RFCOMM_S;
+ else
+ usage();
+ /* NOT REACHED */
+ break;
+
+ case 'r':
+ route = 1;
+ break;
+
+ case 'h':
+ default:
+ usage();
+ /* NOT REACHED */
+ }
+ }
+
+ if ((proto == N_HCI_RAW || proto == N_RFCOMM || proto == N_RFCOMM_S) && route)
+ usage();
+ /* NOT REACHED */
+
+ /*
+ * Discard setgid privileges if not the running kernel so that
+ * bad guys can't print interesting stuff from kernel memory.
+ */
+ if (memf != NULL)
+ if (setgid(getgid()) != 0)
+ err(1, "setgid");
+
+ kvmd = kopen(memf);
+ if (kvmd == NULL)
+ return (1);
+
+ switch (proto) {
+ case N_HCI_RAW:
+ hcirawpr(kvmd, nl[N_HCI_RAW].n_value);
+ break;
+
+ case N_L2CAP_RAW:
+ if (route)
+ l2caprtpr(kvmd, nl[N_L2CAP_RAW_RT].n_value);
+ else
+ l2caprawpr(kvmd, nl[N_L2CAP_RAW].n_value);
+ break;
+
+ case N_L2CAP:
+ if (route)
+ l2caprtpr(kvmd, nl[N_L2CAP_RT].n_value);
+ else
+ l2cappr(kvmd, nl[N_L2CAP].n_value);
+ break;
+
+ case N_RFCOMM:
+ rfcommpr(kvmd, nl[N_RFCOMM].n_value);
+ break;
+
+ case N_RFCOMM_S:
+ rfcommpr_s(kvmd, nl[N_RFCOMM_S].n_value);
+ break;
+
+ default:
+ if (route) {
+ l2caprtpr(kvmd, nl[N_L2CAP_RAW_RT].n_value);
+ l2caprtpr(kvmd, nl[N_L2CAP_RT].n_value);
+ } else {
+ hcirawpr(kvmd, nl[N_HCI_RAW].n_value);
+ l2caprawpr(kvmd, nl[N_L2CAP_RAW].n_value);
+ l2cappr(kvmd, nl[N_L2CAP].n_value);
+ rfcommpr_s(kvmd, nl[N_RFCOMM_S].n_value);
+ rfcommpr(kvmd, nl[N_RFCOMM].n_value);
+ }
+ break;
+ }
+
+ return (kvm_close(kvmd));
+} /* main */
+
+/*
+ * Print raw HCI sockets
+ */
+
+static void
+hcirawpr(kvm_t *kvmd, u_long addr)
+{
+ ng_btsocket_hci_raw_pcb_p this = NULL, next = NULL;
+ ng_btsocket_hci_raw_pcb_t pcb;
+ struct socket so;
+ int first = 1;
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &pcb, sizeof(pcb)) < 0)
+ return;
+ if (kread(kvmd, (u_long) pcb.so, (char *) &so, sizeof(so)) < 0)
+ return;
+
+ next = LIST_NEXT(&pcb, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Active raw HCI sockets\n" \
+"%-8.8s %-8.8s %-6.6s %-6.6s %-6.6s %-16.16s\n",
+ "Socket",
+ "PCB",
+ "Flags",
+ "Recv-Q",
+ "Send-Q",
+ "Local address");
+ }
+
+ if (pcb.addr.hci_node[0] == 0) {
+ pcb.addr.hci_node[0] = '*';
+ pcb.addr.hci_node[1] = 0;
+ }
+
+ fprintf(stdout,
+"%-8lx %-8lx %-6.6x %6d %6d %-16.16s\n",
+ (unsigned long) pcb.so,
+ (unsigned long) this,
+ pcb.flags,
+ so.so_rcv.sb_ccc,
+ so.so_snd.sb_ccc,
+ pcb.addr.hci_node);
+ }
+} /* hcirawpr */
+
+/*
+ * Print raw L2CAP sockets
+ */
+
+static void
+l2caprawpr(kvm_t *kvmd, u_long addr)
+{
+ ng_btsocket_l2cap_raw_pcb_p this = NULL, next = NULL;
+ ng_btsocket_l2cap_raw_pcb_t pcb;
+ struct socket so;
+ int first = 1;
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &pcb, sizeof(pcb)) < 0)
+ return;
+ if (kread(kvmd, (u_long) pcb.so, (char *) &so, sizeof(so)) < 0)
+ return;
+
+ next = LIST_NEXT(&pcb, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Active raw L2CAP sockets\n" \
+"%-8.8s %-8.8s %-6.6s %-6.6s %-17.17s\n",
+ "Socket",
+ "PCB",
+ "Recv-Q",
+ "Send-Q",
+ "Local address");
+ }
+
+ fprintf(stdout,
+"%-8lx %-8lx %6d %6d %-17.17s\n",
+ (unsigned long) pcb.so,
+ (unsigned long) this,
+ so.so_rcv.sb_ccc,
+ so.so_snd.sb_ccc,
+ bdaddrpr(&pcb.src, NULL, 0));
+ }
+} /* l2caprawpr */
+
+/*
+ * Print L2CAP sockets
+ */
+
+static void
+l2cappr(kvm_t *kvmd, u_long addr)
+{
+ static char const * const states[] = {
+ /* NG_BTSOCKET_L2CAP_CLOSED */ "CLOSED",
+ /* NG_BTSOCKET_L2CAP_CONNECTING */ "CON",
+ /* NG_BTSOCKET_L2CAP_CONFIGURING */ "CONFIG",
+ /* NG_BTSOCKET_L2CAP_OPEN */ "OPEN",
+ /* NG_BTSOCKET_L2CAP_DISCONNECTING */ "DISCON"
+ };
+
+ ng_btsocket_l2cap_pcb_p this = NULL, next = NULL;
+ ng_btsocket_l2cap_pcb_t pcb;
+ struct socket so;
+ int first = 1;
+ char local[24], remote[24];
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &pcb, sizeof(pcb)) < 0)
+ return;
+ if (kread(kvmd, (u_long) pcb.so, (char *) &so, sizeof(so)) < 0)
+ return;
+
+ next = LIST_NEXT(&pcb, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Active L2CAP sockets\n" \
+"%-8.8s %-6.6s %-6.6s %-23.23s %-17.17s %-5.5s %s\n",
+ "PCB",
+ "Recv-Q",
+ "Send-Q",
+ "Local address/PSM",
+ "Foreign address",
+ "CID",
+ "State");
+ }
+
+ fprintf(stdout,
+"%-8lx %6d %6d %-17.17s/%-5d %-17.17s %-5d %s\n",
+ (unsigned long) this,
+ so.so_rcv.sb_ccc,
+ so.so_snd.sb_ccc,
+ bdaddrpr(&pcb.src, local, sizeof(local)),
+ pcb.psm,
+ bdaddrpr(&pcb.dst, remote, sizeof(remote)),
+ pcb.cid,
+ (so.so_options & SO_ACCEPTCONN)?
+ "LISTEN" : state2str(pcb.state));
+ }
+} /* l2cappr */
+
+/*
+ * Print L2CAP routing table
+ */
+
+static void
+l2caprtpr(kvm_t *kvmd, u_long addr)
+{
+ ng_btsocket_l2cap_rtentry_p this = NULL, next = NULL;
+ ng_btsocket_l2cap_rtentry_t rt;
+ int first = 1;
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &rt, sizeof(rt)) < 0)
+ return;
+
+ next = LIST_NEXT(&rt, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Known %sL2CAP routes\n", (addr == nl[N_L2CAP_RAW_RT].n_value)? "raw " : "");
+ fprintf(stdout,
+"%-8.8s %-8.8s %-17.17s\n", "RTentry",
+ "Hook",
+ "BD_ADDR");
+ }
+
+ fprintf(stdout,
+"%-8lx %-8lx %-17.17s\n",
+ (unsigned long) this,
+ (unsigned long) rt.hook,
+ bdaddrpr(&rt.src, NULL, 0));
+ }
+} /* l2caprtpr */
+
+/*
+ * Print RFCOMM sockets
+ */
+
+static void
+rfcommpr(kvm_t *kvmd, u_long addr)
+{
+ static char const * const states[] = {
+ /* NG_BTSOCKET_RFCOMM_DLC_CLOSED */ "CLOSED",
+ /* NG_BTSOCKET_RFCOMM_DLC_W4_CONNECT */ "W4CON",
+ /* NG_BTSOCKET_RFCOMM_DLC_CONFIGURING */ "CONFIG",
+ /* NG_BTSOCKET_RFCOMM_DLC_CONNECTING */ "CONN",
+ /* NG_BTSOCKET_RFCOMM_DLC_CONNECTED */ "OPEN",
+ /* NG_BTSOCKET_RFCOMM_DLC_DISCONNECTING */ "DISCON"
+ };
+
+ ng_btsocket_rfcomm_pcb_p this = NULL, next = NULL;
+ ng_btsocket_rfcomm_pcb_t pcb;
+ struct socket so;
+ int first = 1;
+ char local[24], remote[24];
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &pcb, sizeof(pcb)) < 0)
+ return;
+ if (kread(kvmd, (u_long) pcb.so, (char *) &so, sizeof(so)) < 0)
+ return;
+
+ next = LIST_NEXT(&pcb, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Active RFCOMM sockets\n" \
+"%-8.8s %-6.6s %-6.6s %-17.17s %-17.17s %-4.4s %-4.4s %s\n",
+ "PCB",
+ "Recv-Q",
+ "Send-Q",
+ "Local address",
+ "Foreign address",
+ "Chan",
+ "DLCI",
+ "State");
+ }
+
+ fprintf(stdout,
+"%-8lx %6d %6d %-17.17s %-17.17s %-4d %-4d %s\n",
+ (unsigned long) this,
+ so.so_rcv.sb_ccc,
+ so.so_snd.sb_ccc,
+ bdaddrpr(&pcb.src, local, sizeof(local)),
+ bdaddrpr(&pcb.dst, remote, sizeof(remote)),
+ pcb.channel,
+ pcb.dlci,
+ (so.so_options & SO_ACCEPTCONN)?
+ "LISTEN" : state2str(pcb.state));
+ }
+} /* rfcommpr */
+
+/*
+ * Print RFCOMM sessions
+ */
+
+static void
+rfcommpr_s(kvm_t *kvmd, u_long addr)
+{
+ static char const * const states[] = {
+ /* NG_BTSOCKET_RFCOMM_SESSION_CLOSED */ "CLOSED",
+ /* NG_BTSOCKET_RFCOMM_SESSION_LISTENING */ "LISTEN",
+ /* NG_BTSOCKET_RFCOMM_SESSION_CONNECTING */ "CONNECTING",
+ /* NG_BTSOCKET_RFCOMM_SESSION_CONNECTED */ "CONNECTED",
+ /* NG_BTSOCKET_RFCOMM_SESSION_OPEN */ "OPEN",
+ /* NG_BTSOCKET_RFCOMM_SESSION_DISCONNECTING */ "DISCONNECTING"
+ };
+
+ ng_btsocket_rfcomm_session_p this = NULL, next = NULL;
+ ng_btsocket_rfcomm_session_t s;
+ struct socket so;
+ int first = 1;
+
+ if (addr == 0)
+ return;
+
+ if (kread(kvmd, addr, (char *) &this, sizeof(this)) < 0)
+ return;
+
+ for ( ; this != NULL; this = next) {
+ if (kread(kvmd, (u_long) this, (char *) &s, sizeof(s)) < 0)
+ return;
+ if (kread(kvmd, (u_long) s.l2so, (char *) &so, sizeof(so)) < 0)
+ return;
+
+ next = LIST_NEXT(&s, next);
+
+ if (first) {
+ first = 0;
+ fprintf(stdout,
+"Active RFCOMM sessions\n" \
+"%-8.8s %-8.8s %-4.4s %-5.5s %-5.5s %-4.4s %s\n",
+ "L2PCB",
+ "PCB",
+ "Flags",
+ "MTU",
+ "Out-Q",
+ "DLCs",
+ "State");
+ }
+
+ fprintf(stdout,
+"%-8lx %-8lx %-4x %-5d %-5d %-4s %s\n",
+ (unsigned long) so.so_pcb,
+ (unsigned long) this,
+ s.flags,
+ s.mtu,
+ s.outq.len,
+ LIST_EMPTY(&s.dlcs)? "No" : "Yes",
+ state2str(s.state));
+ }
+} /* rfcommpr_s */
+
+/*
+ * Return BD_ADDR as string
+ */
+
+static char *
+bdaddrpr(bdaddr_p const ba, char *str, int len)
+{
+ static char buffer[MAXHOSTNAMELEN];
+ struct hostent *he = NULL;
+
+ if (str == NULL) {
+ str = buffer;
+ len = sizeof(buffer);
+ }
+
+ if (memcmp(ba, NG_HCI_BDADDR_ANY, sizeof(*ba)) == 0) {
+ str[0] = '*';
+ str[1] = 0;
+
+ return (str);
+ }
+
+ if (!numeric_bdaddr &&
+ (he = bt_gethostbyaddr((char *)ba, sizeof(*ba), AF_BLUETOOTH)) != NULL) {
+ strlcpy(str, he->h_name, len);
+
+ return (str);
+ }
+
+ bt_ntoa(ba, str);
+
+ return (str);
+} /* bdaddrpr */
+
+/*
+ * Open kvm
+ */
+
+static kvm_t *
+kopen(char const *memf)
+{
+ kvm_t *kvmd = NULL;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ kvmd = kvm_openfiles(NULL, memf, NULL, O_RDONLY, errbuf);
+ if (setgid(getgid()) != 0)
+ err(1, "setgid");
+ if (kvmd == NULL) {
+ warnx("kvm_openfiles: %s", errbuf);
+ return (NULL);
+ }
+
+ if (kvm_nlist(kvmd, nl) < 0) {
+ warnx("kvm_nlist: %s", kvm_geterr(kvmd));
+ goto fail;
+ }
+
+ if (nl[0].n_type == 0) {
+ warnx("kvm_nlist: no namelist");
+ goto fail;
+ }
+
+ return (kvmd);
+fail:
+ kvm_close(kvmd);
+
+ return (NULL);
+} /* kopen */
+
+/*
+ * Read kvm
+ */
+
+static int
+kread(kvm_t *kvmd, u_long addr, char *buffer, int size)
+{
+ if (kvmd == NULL || buffer == NULL)
+ return (-1);
+
+ if (kvm_read(kvmd, addr, buffer, size) != size) {
+ warnx("kvm_read: %s", kvm_geterr(kvmd));
+ return (-1);
+ }
+
+ return (0);
+} /* kread */
+
+/*
+ * Print usage and exit
+ */
+
+static void
+usage(void)
+{
+ fprintf(stdout, "Usage: btsockstat [-M core ] [-n] [-p proto] [-r]\n");
+ exit(255);
+} /* usage */
+
diff --git a/usr.bin/bluetooth/rfcomm_sppd/Makefile b/usr.bin/bluetooth/rfcomm_sppd/Makefile
new file mode 100644
index 0000000..b17c5cf
--- /dev/null
+++ b/usr.bin/bluetooth/rfcomm_sppd/Makefile
@@ -0,0 +1,10 @@
+# $Id: Makefile,v 1.7 2003/09/07 18:15:55 max Exp $
+# $FreeBSD$
+
+PROG= rfcomm_sppd
+SRCS= rfcomm_sppd.c rfcomm_sdp.c
+WARNS?= 2
+
+LIBADD= bluetooth sdp util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bluetooth/rfcomm_sppd/Makefile.depend b/usr.bin/bluetooth/rfcomm_sppd/Makefile.depend
new file mode 100644
index 0000000..4633528
--- /dev/null
+++ b/usr.bin/bluetooth/rfcomm_sppd/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbluetooth \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsdp \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c
new file mode 100644
index 0000000..239597d
--- /dev/null
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c
@@ -0,0 +1,266 @@
+/*
+ * rfcomm_sdp.c
+ *
+ * Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+ * 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.
+ *
+ * $Id: rfcomm_sdp.c,v 1.1 2003/09/07 18:15:55 max Exp $
+ * $FreeBSD$
+ */
+#define L2CAP_SOCKET_CHECKED
+#include <bluetooth.h>
+#include <errno.h>
+#include <sdp.h>
+#include <stdio.h>
+
+#undef PROTOCOL_DESCRIPTOR_LIST_BUFFER_SIZE
+#define PROTOCOL_DESCRIPTOR_LIST_BUFFER_SIZE 256
+
+#undef PROTOCOL_DESCRIPTOR_LIST_MINIMAL_SIZE
+#define PROTOCOL_DESCRIPTOR_LIST_MINIMAL_SIZE 12
+
+static int rfcomm_proto_list_parse (uint8_t const *start, uint8_t const *end,
+ int *channel, int *error);
+
+/*
+ * Lookup RFCOMM channel number in the Protocol Descriptor List
+ */
+
+#undef rfcomm_channel_lookup_exit
+#define rfcomm_channel_lookup_exit(e) { \
+ if (error != NULL) \
+ *error = (e); \
+ if (ss != NULL) { \
+ sdp_close(ss); \
+ ss = NULL; \
+ } \
+ return (((e) == 0)? 0 : -1); \
+}
+
+int
+rfcomm_channel_lookup(bdaddr_t const *local, bdaddr_t const *remote,
+ int service, int *channel, int *error)
+{
+ uint8_t buffer[PROTOCOL_DESCRIPTOR_LIST_BUFFER_SIZE];
+ void *ss = NULL;
+ uint16_t serv = (uint16_t) service;
+ uint32_t attr = SDP_ATTR_RANGE(
+ SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST,
+ SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST);
+ sdp_attr_t proto = { SDP_ATTR_INVALID,0,sizeof(buffer),buffer };
+ uint32_t type, len;
+
+ if (local == NULL)
+ local = NG_HCI_BDADDR_ANY;
+ if (remote == NULL || channel == NULL)
+ rfcomm_channel_lookup_exit(EINVAL);
+
+ if ((ss = sdp_open(local, remote)) == NULL)
+ rfcomm_channel_lookup_exit(ENOMEM);
+ if (sdp_error(ss) != 0)
+ rfcomm_channel_lookup_exit(sdp_error(ss));
+
+ if (sdp_search(ss, 1, &serv, 1, &attr, 1, &proto) != 0)
+ rfcomm_channel_lookup_exit(sdp_error(ss));
+ if (proto.flags != SDP_ATTR_OK)
+ rfcomm_channel_lookup_exit(ENOATTR);
+
+ sdp_close(ss);
+ ss = NULL;
+
+ /*
+ * If it is possible for more than one kind of protocol stack to be
+ * used to gain access to the service, the ProtocolDescriptorList
+ * takes the form of a data element alternative. We always use the
+ * first protocol stack.
+ *
+ * A minimal Protocol Descriptor List for RFCOMM based service would
+ * look like
+ *
+ * seq8 len8 - 2 bytes
+ * seq8 len8 - 2 bytes
+ * uuid16 value16 - 3 bytes L2CAP
+ * seq8 len8 - 2 bytes
+ * uuid16 value16 - 3 bytes RFCOMM
+ * uint8 value8 - 2 bytes RFCOMM param #1
+ * =========
+ * 14 bytes
+ *
+ * Lets not count first [seq8 len8] wrapper, so the minimal size of
+ * the Protocol Descriptor List (the data we are actually interested
+ * in) for RFCOMM based service would be 12 bytes.
+ */
+
+ if (proto.vlen < PROTOCOL_DESCRIPTOR_LIST_MINIMAL_SIZE)
+ rfcomm_channel_lookup_exit(EINVAL);
+
+ SDP_GET8(type, proto.value);
+
+ if (type == SDP_DATA_ALT8) {
+ SDP_GET8(len, proto.value);
+ } else if (type == SDP_DATA_ALT16) {
+ SDP_GET16(len, proto.value);
+ } else if (type == SDP_DATA_ALT32) {
+ SDP_GET32(len, proto.value);
+ } else
+ len = 0;
+
+ if (len > 0)
+ SDP_GET8(type, proto.value);
+
+ switch (type) {
+ case SDP_DATA_SEQ8:
+ SDP_GET8(len, proto.value);
+ break;
+
+ case SDP_DATA_SEQ16:
+ SDP_GET16(len, proto.value);
+ break;
+
+ case SDP_DATA_SEQ32:
+ SDP_GET32(len, proto.value);
+ break;
+
+ default:
+ rfcomm_channel_lookup_exit(ENOATTR);
+ /* NOT REACHED */
+ }
+
+ if (len < PROTOCOL_DESCRIPTOR_LIST_MINIMAL_SIZE)
+ rfcomm_channel_lookup_exit(EINVAL);
+
+ return (rfcomm_proto_list_parse(proto.value,
+ buffer + proto.vlen, channel, error));
+}
+
+/*
+ * Parse protocol descriptor list
+ *
+ * The ProtocolDescriptorList attribute describes one or more protocol
+ * stacks that may be used to gain access to the service described by
+ * the service record. If the ProtocolDescriptorList describes a single
+ * stack, it takes the form of a data element sequence in which each
+ * element of the sequence is a protocol descriptor.
+ */
+
+#undef rfcomm_proto_list_parse_exit
+#define rfcomm_proto_list_parse_exit(e) { \
+ if (error != NULL) \
+ *error = (e); \
+ return (((e) == 0)? 0 : -1); \
+}
+
+static int
+rfcomm_proto_list_parse(uint8_t const *start, uint8_t const *end,
+ int *channel, int *error)
+{
+ int type, len, value;
+
+ while (start < end) {
+
+ /*
+ * Parse protocol descriptor
+ *
+ * A protocol descriptor identifies a communications protocol
+ * and provides protocol specific parameters. A protocol
+ * descriptor is represented as a data element sequence. The
+ * first data element in the sequence must be the UUID that
+ * identifies the protocol. Additional data elements optionally
+ * provide protocol specific information, such as the L2CAP
+ * protocol/service multiplexer (PSM) and the RFCOMM server
+ * channel number (CN).
+ */
+
+ /* We must have at least one byte (type) */
+ if (end - start < 1)
+ rfcomm_proto_list_parse_exit(EINVAL)
+
+ SDP_GET8(type, start);
+ switch (type) {
+ case SDP_DATA_SEQ8:
+ SDP_GET8(len, start);
+ break;
+
+ case SDP_DATA_SEQ16:
+ SDP_GET16(len, start);
+ break;
+
+ case SDP_DATA_SEQ32:
+ SDP_GET32(len, start);
+ break;
+
+ default:
+ rfcomm_proto_list_parse_exit(ENOATTR)
+ /* NOT REACHED */
+ }
+
+ /* We must have at least 3 bytes (type + UUID16) */
+ if (end - start < 3)
+ rfcomm_proto_list_parse_exit(EINVAL);
+
+ /* Get protocol UUID */
+ SDP_GET8(type, start); len -= sizeof(uint8_t);
+ switch (type) {
+ case SDP_DATA_UUID16:
+ SDP_GET16(value, start); len -= sizeof(uint16_t);
+ if (value != SDP_UUID_PROTOCOL_RFCOMM)
+ goto next_protocol;
+ break;
+
+ case SDP_DATA_UUID32: /* XXX FIXME can we have 32-bit UUID */
+ case SDP_DATA_UUID128: /* XXX FIXME can we have 128-bit UUID */
+ default:
+ rfcomm_proto_list_parse_exit(ENOATTR);
+ /* NOT REACHED */
+ }
+
+ /*
+ * First protocol specific parameter for RFCOMM procotol must
+ * be uint8 that represents RFCOMM channel number. So we must
+ * have at least two bytes.
+ */
+
+ if (end - start < 2)
+ rfcomm_proto_list_parse_exit(EINVAL);
+
+ SDP_GET8(type, start);
+ if (type != SDP_DATA_UINT8)
+ rfcomm_proto_list_parse_exit(ENOATTR);
+
+ SDP_GET8(*channel, start);
+
+ rfcomm_proto_list_parse_exit(0);
+ /* NOT REACHED */
+next_protocol:
+ start += len;
+ }
+
+ /*
+ * If we got here then it means we could not find RFCOMM protocol
+ * descriptor, but the reply format was actually valid.
+ */
+
+ rfcomm_proto_list_parse_exit(ENOATTR);
+}
+
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
new file mode 100644
index 0000000..849c02c6
--- /dev/null
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
@@ -0,0 +1,186 @@
+.\" Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" 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.
+.\"
+.\" $Id: rfcomm_sppd.1,v 1.3 2003/09/07 18:15:55 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2008
+.Dt RFCOMM_SPPD 1
+.Os
+.Sh NAME
+.Nm rfcomm_sppd
+.Nd RFCOMM Serial Port Profile daemon
+.Sh SYNOPSIS
+.Nm
+.Op Fl bhtS
+.Fl a Ar address
+.Fl c Ar channel
+.Sh DESCRIPTION
+The
+.Nm
+utility is a Serial Port Profile daemon.
+It can operate in two modes: client and server.
+.Pp
+In client mode,
+.Nm
+opens RFCOMM connection to the specified
+.Ar address
+server and
+.Ar channel .
+Once connection is established, the
+.Nm
+utility provides access to the server's remote serial port via stdin/stdout
+or via
+.Xr pts 4
+interface if
+.Fl t
+option was specified.
+.Pp
+If the
+.Fl S
+option is specified,
+.Nm
+will operate in server mode and act as RFCOMM server,
+listening on
+.Dv ANY
+address and advertising a virtual serial port
+via the
+.Xr sdpd 8
+daemon.
+If
+.Fl t
+options was specified,
+the server side of the virtual serial port is attached to a pseudo-terminal.
+Otherwise the virtual serial port is attached to the stdin/stdout.
+.Nm
+should be run as root in order to communicate with
+.Xr sdpd 8
+in this case.
+.Pp
+The
+.Nm
+utility opens both master and slave pseudo terminals.
+This is done to ensure that RFCOMM connection stays open until
+.Nm
+is terminated.
+The data received from the master pseudo terminal are sent over
+the RFCOMM connection.
+The data received from the RFCOMM connection are written
+into master pseudo terminal.
+The application in its turn opens the slave pseudo
+terminal and operates on it just like it would operate over the standard serial
+port.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a Ar address
+In client mode,
+this required option specifies the address of the remote RFCOMM server.
+If this option is specified in server mode,
+.Nm
+will only accept connections from the
+.Tn Bluetooth
+device with address
+.Ar address .
+The address can be specified as BD_ADDR or name.
+If name was specified then
+.Nm
+utility will attempt to resolve the name via
+.Xr bt_gethostbyname 3 .
+.It Fl b
+Detach from the controlling terminal, i.e., run in background.
+.It Fl c Ar channel
+In both client and server mode,
+this option specifies the RFCOMM channel to connect to or listen on.
+In server mode,
+the channel should be a number between 1 and 30.
+If not specified,
+.Nm
+will try to bind to
+.Dq wildcard
+RFCOMM channel number.
+The actual RFCOMM channel will be obtained via
+.Xr getsockname 2
+call and will be used to register Serial Port service with
+.Xr sdpd 8 .
+In client mode,
+the channel could either be a number between 1 and 30 or a service name.
+Supported service names are:
+.Cm DUN
+(for DialUp Networking service),
+.Cm FAX
+(for Fax service),
+.Cm LAN
+(for LAN Access Using PPP service) and
+.Cm SP
+(for Serial Port service).
+If channel was not specified then
+.Nm
+utility will try to obtain RFCOMM channel for Serial Port service via Service
+Discovery Protocol from the server.
+.It Fl h
+Display usage message and exit.
+.It Fl S
+Server mode; see
+.Sx DESCRIPTION .
+.It Fl t
+Use slave pseudo tty.
+If not set stdin/stdout will be used.
+This option is required if
+.Fl b
+option was specified.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/pts/[num]" -compact
+.It Pa /dev/pts/[num]
+slave pseudo terminals
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t"
+.Pp
+Will start the
+.Nm
+utility and open RFCOMM connection to the server at
+.Li 00:01:02:03:04:05
+and channel
+.Li 1 .
+Once the connection has been established, a
+.Xr pts 4
+can be used to talk to the remote serial port on the server.
+.Nm
+prints the name of the
+.Xr pts 4
+to use on stdout.
+.Sh SEE ALSO
+.Xr bluetooth 3 ,
+.Xr ng_btsocket 4 ,
+.Xr pts 4 ,
+.Xr rfcomm_pppd 8 ,
+.Xr sdpd 8
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
+.Sh BUGS
+Please report if found.
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
new file mode 100644
index 0000000..309bab9
--- /dev/null
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
@@ -0,0 +1,460 @@
+/*
+ * rfcomm_sppd.c
+ */
+
+/*-
+ * Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+ * 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.
+ *
+ * $Id: rfcomm_sppd.c,v 1.4 2003/09/07 18:15:55 max Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#define L2CAP_SOCKET_CHECKED
+#include <bluetooth.h>
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <limits.h>
+#include <paths.h>
+#include <sdp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <termios.h>
+#include <unistd.h>
+#include <libutil.h>
+
+#define SPPD_IDENT "rfcomm_sppd"
+#define SPPD_BUFFER_SIZE 1024
+#define max(a, b) (((a) > (b))? (a) : (b))
+
+int rfcomm_channel_lookup (bdaddr_t const *local,
+ bdaddr_t const *remote,
+ int service, int *channel, int *error);
+
+static int sppd_ttys_open (char **tty, int *amaster, int *aslave);
+static int sppd_read (int fd, char *buffer, int size);
+static int sppd_write (int fd, char *buffer, int size);
+static void sppd_sighandler (int s);
+static void usage (void);
+
+static int done; /* are we done? */
+
+/* Main */
+int
+main(int argc, char *argv[])
+{
+ struct sigaction sa;
+ struct sockaddr_rfcomm ra;
+ bdaddr_t addr;
+ int n, background, channel, service,
+ s, amaster, aslave, fd, doserver,
+ dopty;
+ fd_set rfd;
+ char *tty = NULL, *ep = NULL, buf[SPPD_BUFFER_SIZE];
+
+ memcpy(&addr, NG_HCI_BDADDR_ANY, sizeof(addr));
+ background = channel = 0;
+ service = SDP_SERVICE_CLASS_SERIAL_PORT;
+ doserver = 0;
+ dopty = 0;
+
+ /* Parse command line options */
+ while ((n = getopt(argc, argv, "a:bc:thS")) != -1) {
+ switch (n) {
+ case 'a': /* BDADDR */
+ if (!bt_aton(optarg, &addr)) {
+ struct hostent *he = NULL;
+
+ if ((he = bt_gethostbyname(optarg)) == NULL)
+ errx(1, "%s: %s", optarg, hstrerror(h_errno));
+
+ memcpy(&addr, he->h_addr, sizeof(addr));
+ }
+ break;
+
+ case 'c': /* RFCOMM channel */
+ channel = strtoul(optarg, &ep, 10);
+ if (*ep != '\0') {
+ channel = 0;
+ switch (tolower(optarg[0])) {
+ case 'd': /* DialUp Networking */
+ service = SDP_SERVICE_CLASS_DIALUP_NETWORKING;
+ break;
+
+ case 'f': /* Fax */
+ service = SDP_SERVICE_CLASS_FAX;
+ break;
+
+ case 'l': /* LAN */
+ service = SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP;
+ break;
+
+ case 's': /* Serial Port */
+ service = SDP_SERVICE_CLASS_SERIAL_PORT;
+ break;
+
+ default:
+ errx(1, "Unknown service name: %s",
+ optarg);
+ /* NOT REACHED */
+ }
+ }
+ break;
+
+ case 'b': /* Run in background */
+ background = 1;
+ break;
+
+ case 't': /* Open pseudo TTY */
+ dopty = 1;
+ break;
+
+ case 'S':
+ doserver = 1;
+ break;
+
+ case 'h':
+ default:
+ usage();
+ /* NOT REACHED */
+ }
+ }
+
+ /* Check if we have everything we need */
+ if (!doserver && memcmp(&addr, NG_HCI_BDADDR_ANY, sizeof(addr)) == 0)
+ usage();
+ /* NOT REACHED */
+
+ /* Set signal handlers */
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sppd_sighandler;
+
+ if (sigaction(SIGTERM, &sa, NULL) < 0)
+ err(1, "Could not sigaction(SIGTERM)");
+
+ if (sigaction(SIGHUP, &sa, NULL) < 0)
+ err(1, "Could not sigaction(SIGHUP)");
+
+ if (sigaction(SIGINT, &sa, NULL) < 0)
+ err(1, "Could not sigaction(SIGINT)");
+
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_NOCLDWAIT;
+
+ if (sigaction(SIGCHLD, &sa, NULL) < 0)
+ err(1, "Could not sigaction(SIGCHLD)");
+
+ /* Open TTYs */
+ if (dopty) {
+ if (sppd_ttys_open(&tty, &amaster, &aslave) < 0)
+ exit(1);
+
+ fd = amaster;
+ } else {
+ if (background)
+ usage();
+
+ amaster = STDIN_FILENO;
+ fd = STDOUT_FILENO;
+ }
+
+ /* Open RFCOMM connection */
+
+ if (doserver) {
+ struct sockaddr_rfcomm ma;
+ bdaddr_t bt_addr_any;
+ sdp_sp_profile_t sp;
+ void *ss;
+ uint32_t sdp_handle;
+ int acceptsock, aaddrlen;
+
+ acceptsock = socket(PF_BLUETOOTH, SOCK_STREAM,
+ BLUETOOTH_PROTO_RFCOMM);
+ if (acceptsock < 0)
+ err(1, "Could not create socket");
+
+ memcpy(&bt_addr_any, NG_HCI_BDADDR_ANY, sizeof(bt_addr_any));
+
+ memset(&ma, 0, sizeof(ma));
+ ma.rfcomm_len = sizeof(ma);
+ ma.rfcomm_family = AF_BLUETOOTH;
+ memcpy(&ma.rfcomm_bdaddr, &bt_addr_any, sizeof(bt_addr_any));
+ ma.rfcomm_channel = channel;
+
+ if (bind(acceptsock, (struct sockaddr *)&ma, sizeof(ma)) < 0)
+ err(1, "Could not bind socket on channel %d", channel);
+ if (listen(acceptsock, 10) != 0)
+ err(1, "Could not listen on socket");
+
+ aaddrlen = sizeof(ma);
+ if (getsockname(acceptsock, (struct sockaddr *)&ma, &aaddrlen) < 0)
+ err(1, "Could not get socket name");
+ channel = ma.rfcomm_channel;
+
+ ss = sdp_open_local(NULL);
+ if (ss == NULL)
+ errx(1, "Unable to create local SDP session");
+ if (sdp_error(ss) != 0)
+ errx(1, "Unable to open local SDP session. %s (%d)",
+ strerror(sdp_error(ss)), sdp_error(ss));
+ memset(&sp, 0, sizeof(sp));
+ sp.server_channel = channel;
+
+ if (sdp_register_service(ss, SDP_SERVICE_CLASS_SERIAL_PORT,
+ &bt_addr_any, (void *)&sp, sizeof(sp),
+ &sdp_handle) != 0) {
+ errx(1, "Unable to register LAN service with "
+ "local SDP daemon. %s (%d)",
+ strerror(sdp_error(ss)), sdp_error(ss));
+ }
+
+ s = -1;
+ while (s < 0) {
+ aaddrlen = sizeof(ra);
+ s = accept(acceptsock, (struct sockaddr *)&ra,
+ &aaddrlen);
+ if (s < 0)
+ err(1, "Unable to accept()");
+ if (memcmp(&addr, NG_HCI_BDADDR_ANY, sizeof(addr)) &&
+ memcmp(&addr, &ra.rfcomm_bdaddr, sizeof(addr))) {
+ warnx("Connect from wrong client");
+ close(s);
+ s = -1;
+ }
+ }
+ sdp_unregister_service(ss, sdp_handle);
+ sdp_close(ss);
+ close(acceptsock);
+ } else {
+ /* Check channel, if was not set then obtain it via SDP */
+ if (channel == 0 && service != 0)
+ if (rfcomm_channel_lookup(NULL, &addr,
+ service, &channel, &n) != 0)
+ errc(1, n, "Could not obtain RFCOMM channel");
+ if (channel <= 0 || channel > 30)
+ errx(1, "Invalid RFCOMM channel number %d", channel);
+
+ s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
+ if (s < 0)
+ err(1, "Could not create socket");
+
+ memset(&ra, 0, sizeof(ra));
+ ra.rfcomm_len = sizeof(ra);
+ ra.rfcomm_family = AF_BLUETOOTH;
+
+ if (bind(s, (struct sockaddr *) &ra, sizeof(ra)) < 0)
+ err(1, "Could not bind socket");
+
+ memcpy(&ra.rfcomm_bdaddr, &addr, sizeof(ra.rfcomm_bdaddr));
+ ra.rfcomm_channel = channel;
+
+ if (connect(s, (struct sockaddr *) &ra, sizeof(ra)) < 0)
+ err(1, "Could not connect socket");
+ }
+
+ /* Became daemon if required */
+ if (background && daemon(0, 0) < 0)
+ err(1, "Could not daemon()");
+
+ openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON);
+ syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout");
+
+ /* Print used tty on stdout for wrappers to pick up */
+ if (!background)
+ fprintf(stdout, "%s\n", tty);
+
+ for (done = 0; !done; ) {
+ FD_ZERO(&rfd);
+ FD_SET(amaster, &rfd);
+ FD_SET(s, &rfd);
+
+ n = select(max(amaster, s) + 1, &rfd, NULL, NULL, NULL);
+ if (n < 0) {
+ if (errno == EINTR)
+ continue;
+
+ syslog(LOG_ERR, "Could not select(). %s",
+ strerror(errno));
+ exit(1);
+ }
+
+ if (n == 0)
+ continue;
+
+ if (FD_ISSET(amaster, &rfd)) {
+ n = sppd_read(amaster, buf, sizeof(buf));
+ if (n < 0) {
+ syslog(LOG_ERR, "Could not read master pty, " \
+ "fd=%d. %s", amaster, strerror(errno));
+ exit(1);
+ }
+
+ if (n == 0)
+ break; /* XXX */
+
+ if (sppd_write(s, buf, n) < 0) {
+ syslog(LOG_ERR, "Could not write to socket, " \
+ "fd=%d, size=%d. %s",
+ s, n, strerror(errno));
+ exit(1);
+ }
+ }
+
+ if (FD_ISSET(s, &rfd)) {
+ n = sppd_read(s, buf, sizeof(buf));
+ if (n < 0) {
+ syslog(LOG_ERR, "Could not read socket, " \
+ "fd=%d. %s", s, strerror(errno));
+ exit(1);
+ }
+
+ if (n == 0)
+ break;
+
+ if (sppd_write(fd, buf, n) < 0) {
+ syslog(LOG_ERR, "Could not write to master " \
+ "pty, fd=%d, size=%d. %s",
+ fd, n, strerror(errno));
+ exit(1);
+ }
+ }
+ }
+
+ syslog(LOG_INFO, "Completed on %s", (tty != NULL)? tty : "stdin/stdout");
+ closelog();
+
+ close(s);
+
+ if (tty != NULL) {
+ close(aslave);
+ close(amaster);
+ }
+
+ return (0);
+}
+
+/* Open TTYs */
+static int
+sppd_ttys_open(char **tty, int *amaster, int *aslave)
+{
+ char pty[PATH_MAX];
+ struct termios tio;
+
+ cfmakeraw(&tio);
+
+ if (openpty(amaster, aslave, pty, &tio, NULL) == -1) {
+ syslog(LOG_ERR, "Could not openpty(). %s", strerror(errno));
+ return (-1);
+ }
+
+ if ((*tty = strdup(pty)) == NULL) {
+ syslog(LOG_ERR, "Could not strdup(). %s", strerror(errno));
+ close(*aslave);
+ close(*amaster);
+ return (-1);
+ }
+
+ return (0);
+} /* sppd_ttys_open */
+
+/* Read data */
+static int
+sppd_read(int fd, char *buffer, int size)
+{
+ int n;
+
+again:
+ n = read(fd, buffer, size);
+ if (n < 0) {
+ if (errno == EINTR)
+ goto again;
+
+ return (-1);
+ }
+
+ return (n);
+} /* sppd_read */
+
+/* Write data */
+static int
+sppd_write(int fd, char *buffer, int size)
+{
+ int n, wrote;
+
+ for (wrote = 0; size > 0; ) {
+ n = write(fd, buffer, size);
+ switch (n) {
+ case -1:
+ if (errno != EINTR)
+ return (-1);
+ break;
+
+ case 0:
+ /* XXX can happen? */
+ break;
+
+ default:
+ wrote += n;
+ buffer += n;
+ size -= n;
+ break;
+ }
+ }
+
+ return (wrote);
+} /* sppd_write */
+
+/* Signal handler */
+static void
+sppd_sighandler(int s)
+{
+ syslog(LOG_INFO, "Signal %d received. Total %d signals received\n",
+ s, ++ done);
+} /* sppd_sighandler */
+
+/* Display usage and exit */
+static void
+usage(void)
+{
+ fprintf(stdout,
+"Usage: %s options\n" \
+"Where options are:\n" \
+"\t-a address Peer address (required in client mode)\n" \
+"\t-b Run in background\n" \
+"\t-c channel RFCOMM channel to connect to or listen on\n" \
+"\t-t use slave pseudo tty (required in background mode)\n" \
+"\t-S Server mode\n" \
+"\t-h Display this message\n", SPPD_IDENT);
+ exit(255);
+} /* usage */
+
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
new file mode 100644
index 0000000..a748a9b
--- /dev/null
+++ b/usr.bin/bmake/Makefile
@@ -0,0 +1,177 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+.sinclude "Makefile.inc"
+
+SRCTOP?= ${.CURDIR:H:H}
+
+# look here first for config.h
+CFLAGS+= -I${.CURDIR}
+
+# for after-import
+CLEANDIRS+= FreeBSD
+CLEANFILES+= bootstrap
+
+# $Id: Makefile,v 1.67 2016/06/07 00:46:12 sjg Exp $
+
+# Base version on src date
+_MAKE_VERSION= 20160606
+
+PROG?= ${.CURDIR:T}
+
+SRCS= \
+ arch.c \
+ buf.c \
+ compat.c \
+ cond.c \
+ dir.c \
+ for.c \
+ hash.c \
+ job.c \
+ main.c \
+ make.c \
+ make_malloc.c \
+ meta.c \
+ metachar.c \
+ parse.c \
+ str.c \
+ strlist.c \
+ suff.c \
+ targ.c \
+ trace.c \
+ util.c \
+ var.c
+
+# from lst.lib/
+SRCS+= \
+ lstAppend.c \
+ lstAtEnd.c \
+ lstAtFront.c \
+ lstClose.c \
+ lstConcat.c \
+ lstDatum.c \
+ lstDeQueue.c \
+ lstDestroy.c \
+ lstDupl.c \
+ lstEnQueue.c \
+ lstFind.c \
+ lstFindFrom.c \
+ lstFirst.c \
+ lstForEach.c \
+ lstForEachFrom.c \
+ lstInit.c \
+ lstInsert.c \
+ lstIsAtEnd.c \
+ lstIsEmpty.c \
+ lstLast.c \
+ lstMember.c \
+ lstNext.c \
+ lstOpen.c \
+ lstPrev.c \
+ lstRemove.c \
+ lstReplace.c \
+ lstSucc.c
+
+# this file gets generated by configure
+.sinclude "Makefile.config"
+
+.if !empty(LIBOBJS)
+SRCS+= ${LIBOBJS:T:.o=.c}
+.endif
+
+# just in case
+prefix?= /usr
+srcdir?= ${.CURDIR}
+
+DEFAULT_SYS_PATH?= ${prefix}/share/mk
+
+CPPFLAGS+= -DUSE_META
+CFLAGS+= ${CPPFLAGS}
+CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
+CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
+CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
+COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
+
+# meta mode can be useful even without filemon
+FILEMON_H ?= /usr/include/dev/filemon/filemon.h
+.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
+COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
+.endif
+
+.PATH: ${srcdir}
+.PATH: ${srcdir}/lst.lib
+
+.if make(obj) || make(clean)
+SUBDIR+= unit-tests
+.endif
+
+
+MAN= ${PROG}.1
+MAN1= ${MAN}
+
+.if (${PROG} != "make")
+CLEANFILES+= my.history
+.if make(${MAN}) || !exists(${srcdir}/${MAN})
+my.history: ${MAKEFILE}
+ @(echo ".Nm"; \
+ echo "is derived from NetBSD"; \
+ echo ".Xr make 1 ."; \
+ echo "It uses autoconf to facilitate portability to other platforms."; \
+ echo ".Pp") > $@
+
+.NOPATH: ${MAN}
+${MAN}: make.1 my.history
+ @echo making $@
+ @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
+ -e '/^.Sh HISTORY/rmy.history' \
+ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
+
+all beforeinstall: ${MAN}
+_mfromdir=.
+.endif
+.endif
+
+MANTARGET?= cat
+MANDEST?= ${MANDIR}/${MANTARGET}1
+
+.if ${MANTARGET} == "cat"
+_mfromdir=${srcdir}
+.endif
+
+.include <bsd.prog.mk>
+
+CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
+COPTS.var.c += -Wno-cast-qual
+COPTS.job.c += -Wno-format-nonliteral
+COPTS.parse.c += -Wno-format-nonliteral
+COPTS.var.c += -Wno-format-nonliteral
+
+# Force these
+SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share}
+BINDIR= ${BINDIR.bmake:U${prefix}/bin}
+MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
+
+.if !exists(.depend)
+${OBJS}: config.h
+.endif
+
+# make sure that MAKE_VERSION gets updated.
+main.o: ${SRCS} ${MAKEFILE}
+
+
+# A simple unit-test driver to help catch regressions
+accept test:
+ cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
+
+# override some simple things
+BINDIR= /usr/bin
+MANDIR= /usr/share/man/man
+
+# make sure we get this
+CFLAGS+= ${COPTS.${.IMPSRC:T}}
+
+after-import: ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+ cd ${.CURDIR} && ${.MAKE} -f ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+
diff --git a/usr.bin/bmake/Makefile.config b/usr.bin/bmake/Makefile.config
new file mode 100644
index 0000000..7110870
--- /dev/null
+++ b/usr.bin/bmake/Makefile.config
@@ -0,0 +1,25 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H}
+
+# things set by configure
+
+prefix= /usr
+srcdir= ${SRCTOP}/contrib/bmake
+CC?= gcc
+DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
+
+CPPFLAGS+=
+CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H
+LDFLAGS=
+LIBOBJS= ${LIBOBJDIR}stresep$U.o
+LDADD=
+USE_META= yes
+FILEMON_H= /usr/include/dev/filemon/filemon.h
+BMAKE_PATH_MAX?= 1024
+# used if MAXPATHLEN not defined
+CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX}
+
diff --git a/usr.bin/bmake/Makefile.depend b/usr.bin/bmake/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/bmake/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc
new file mode 100644
index 0000000..4fa3cf7
--- /dev/null
+++ b/usr.bin/bmake/Makefile.inc
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+.sinclude <src.opts.mk>
+
+.if defined(.PARSEDIR)
+# make sure this is available to unit-tests/Makefile
+.export SRCTOP
+.endif
+
+.if exists(${.CURDIR}/tests)
+PROG= make
+.endif
+
+.if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} == "no"
+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
diff --git a/usr.bin/bmake/config.h b/usr.bin/bmake/config.h
new file mode 100644
index 0000000..7a47d4c
--- /dev/null
+++ b/usr.bin/bmake/config.h
@@ -0,0 +1,346 @@
+/* $FreeBSD$ */
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Path of default shell */
+/* #undef DEFSHELL_CUSTOM */
+
+/* Shell spec to use by default */
+/* #undef DEFSHELL_INDEX */
+
+/* Define to 1 if you have the <ar.h> header file. */
+#define HAVE_AR_H 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+ don't. */
+#define HAVE_DECL_SYS_SIGLIST 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dirname' function. */
+#define HAVE_DIRNAME 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the `err' function. */
+#define HAVE_ERR 1
+
+/* Define to 1 if you have the `errx' function. */
+#define HAVE_ERRX 1
+
+/* Define to 1 if you have the <err.h> header file. */
+#define HAVE_ERR_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the `getwd' function. */
+#define HAVE_GETWD 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `killpg' function. */
+#define HAVE_KILLPG 1
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <ranlib.h> header file. */
+#define HAVE_RANLIB_H 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setpgid' function. */
+#define HAVE_SETPGID 1
+
+/* Define to 1 if you have the `setsid' function. */
+#define HAVE_SETSID 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `sigvec' function. */
+#define HAVE_SIGVEC 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `stresep' function. */
+/* #undef HAVE_STRESEP */
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtod' function. */
+#define HAVE_STRTOD 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if `struct stat' is a member of `st_rdev'. */
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+ `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 */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* 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
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `wait3' function. */
+#define HAVE_WAIT3 1
+
+/* Define to 1 if you have the `wait4' function. */
+#define HAVE_WAIT4 1
+
+/* Define to 1 if you have the `waitpid' function. */
+#define HAVE_WAITPID 1
+
+/* Define to 1 if you have the `warn' function. */
+#define HAVE_WARN 1
+
+/* Define to 1 if you have the `warnx' function. */
+#define HAVE_WARNX 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* define if your compiler has __attribute__ */
+/* #undef HAVE___ATTRIBUTE__ */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "sjg@NetBSD.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "bmake"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "bmake 20160606"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "bmake"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "20160606"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* C99 function name */
+/* #undef __func__ */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef mode_t */
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
diff --git a/usr.bin/bmake/tests/Makefile b/usr.bin/bmake/tests/Makefile
new file mode 100644
index 0000000..6c343da
--- /dev/null
+++ b/usr.bin/bmake/tests/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+${PACKAGE}FILES+= common.sh
+${PACKAGE}FILES+= test-new.mk
+
+TESTS_SUBDIRS= archives
+TESTS_SUBDIRS+= basic
+TESTS_SUBDIRS+= execution
+TESTS_SUBDIRS+= shell
+TESTS_SUBDIRS+= suffixes
+TESTS_SUBDIRS+= syntax
+TESTS_SUBDIRS+= sysmk
+TESTS_SUBDIRS+= variables
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/Makefile.depend b/usr.bin/bmake/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/Makefile.inc b/usr.bin/bmake/tests/Makefile.inc
new file mode 100644
index 0000000..b2201e4
--- /dev/null
+++ b/usr.bin/bmake/tests/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+SUBDIR_PARALLEL= t
diff --git a/usr.bin/bmake/tests/README b/usr.bin/bmake/tests/README
new file mode 100644
index 0000000..1ac209b
--- /dev/null
+++ b/usr.bin/bmake/tests/README
@@ -0,0 +1,174 @@
+$FreeBSD$
+
+This directory contains regression tests for make(1).
+
+To invoke the tests, please refer to tests(7).
+
+----------------------------------------------------------------------------
+
+The rest of this file is intended for developers.
+
+The tests are invoked via the test.sh script or prove(1) from p5-Test-Harness.
+Tests are normally executed in a special test directory that is built under
+/tmp. The reason for this is, that make tests are generally influenced by
+all file in a directory, by files in one of make's obscure object directories
+as well as in other directories make happens to look into. Therefor the
+test scripts build a clean environment in the temp directory and the
+tests are executed by cd-ing into that directory and invoking make. The
+output of the make run (standard output, standard error and the exit status)
+are written into files that are created in another directory. So the layout
+for the shell/builtin test looks like:
+
+ ./shell/builtin/ - directory with test stuff
+ /tmp/make.${USER}/shell/builtin - actual test directory
+ /tmp/make.${USER}/shell/builtin.OUTPUT - output files
+
+So a full test consists of the following steps:
+
+ setup - Set up the test environment by creating the test directory
+ and populating it with the needed files. If the test
+ directory already exists an error is printed.
+
+ run - Run the test and produce the output into the output
+ directory.
+
+ show - Show the result files on the screen.
+
+ compare - Compare the results in the output directory with those
+ in the test source directory. This just prints whether
+ the test was ok or not in the format used by prove(1).
+
+ diff - Diff the output files and the expected output files.
+
+ reset - Reset the test to its initial state.
+
+ clean - Remove both the test directory and the output directory.
+
+Each of these steps can independently be invoked with the test script
+contained in each directory. These test scripts are called test.t.
+Additionally the scripts understand the following commands:
+
+ test - Run setup, run and compare.
+
+ prove - Run setup, run, compare and clean. This is identically
+ to invoking the script without an argument.
+
+ desc - Print a short test description.
+
+ update - Update the expected results from the actual results.
+
+The test script has the following syntax:
+
+ % test.t [-v] [-m path_to_make_binary] command
+
+To invoke it via prove(1) use:
+
+ % [MAKE_PROG=path_to_make_binary] prove [options] [files/directories]
+
+Example:
+ % sh test.t -m `pwd`/../obj/make run
+ % MAKE_PROG=/usr/obj/usr/src/usr.bin/make/make prove -r
+
+The test scripts use the following environment variables that can be set
+by the user in the test script's environment:
+
+ WORK_BASE
+ - Base directory for working files. If not set
+ /tmp/make.${USER} is used.
+
+ MAKE_PROG
+ - Path to the make program to test. If not set
+ /usr/bin/make is used.
+
+The following variables are available to test scripts:
+
+ SRC_BASE
+ - test source base directory. This is determined by
+ repeatedly doing cd .. and checking for common.sh.
+ Therefor this can fail if a test source directory is
+ actually a symbolic link and is physically not located
+ below the directory containing common.sh.
+
+ SUBDIR
+ - subdirectory below WORK_BASE and SRC_BASE for current test
+
+ WORK_DIR
+ - ${WORK_BASE}/${SUBDIR}
+
+ SRC_DIR
+ - ${SRC_BASE}/${SUBDIR}
+
+The following variables and functions may be defined by the test script.
+This also lists special filenames.
+
+ DESC
+ A one-line description of the test.
+
+ TEST_MAKE_DIRS
+ A list of pairs of directory names and modes. These
+ directories are created during setup and reset. When
+ the directory already exists (during reset) only the
+ mode change is applied.
+
+ TEST_MAKE_DIRS="subdir 775 subdir/sub 555"
+
+ TEST_COPY_FILES
+ A list of pairs of file names and modes. These files
+ are copied from the source to the working directory
+ during setup and reset. When the file already exists
+ (during reset) only the mode change is applied. Files
+ may be copied from/to sub-directories. The sub-directory
+ in the working directory must already exists (see
+ TEST_MAKE_DIRS).
+
+ TEST_COPY_FILES="libtest.a 444 subdir/libfoo.a 444"
+
+ TEST_TOUCH
+ List of pairs of file names and arguments to touch(1).
+ During setup and reset for each list element touch(1)
+ is executed.
+
+ TEST_TOUCH="file1 '-t 200501011257'"
+
+ TEST_LINK
+ List of pairs of filenames. Each pair is passed to ln(1).
+ All names are prefixed with the working directory.
+
+ Makefile
+ If a file with this name exists in the source directory
+ it is automatically copied to the working directory.
+
+ setup_test()
+ If this function exists it is executed at the end of the
+ setup.
+
+ reset_test()
+ If this function exists it is executed at the end of the
+ reset.
+
+ TEST_CLEAN_FILES
+ A list of file to be deleted when resetting.
+
+ TEST_N
+ Number of tests in this script. If not set this is assumed
+ to be 1.
+
+ TEST_<number>
+ Arguments to make for test number <number>. If not set
+ the default argument of test<number> is used. To run a test
+ without argument to make, set TEST_<number> to the empty string.
+
+ TEST_<number>_SKIP
+ To skip a test (for whatever reason) this should be set
+ to a string explaining the reason for skipping the test.
+
+ TEST_<number>_TODO
+ For a test that should fail this is a short string describing
+ what the problem in make(1) is that should be fixed.
+
+ run_test()
+ Function to run a test. This function gets a single argument
+ which is the number of the test to executed. The default
+ function evaluates the variable TEST_<number> and calls
+ make with the arguments in this variable.
+
diff --git a/usr.bin/bmake/tests/archives/Makefile b/usr.bin/bmake/tests/archives/Makefile
new file mode 100644
index 0000000..f80ffc2
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives
+
+TESTS_SUBDIRS= fmt_44bsd fmt_44bsd_mod fmt_oldbsd
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/archives/Makefile.depend b/usr.bin/bmake/tests/archives/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile
new file mode 100644
index 0000000..99a2093b
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_44bsd
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.status.3
+${PACKAGE}FILES+= expected.status.4
+${PACKAGE}FILES+= expected.status.5
+${PACKAGE}FILES+= expected.status.6
+${PACKAGE}FILES+= expected.status.7
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stderr.3
+${PACKAGE}FILES+= expected.stderr.4
+${PACKAGE}FILES+= expected.stderr.5
+${PACKAGE}FILES+= expected.stderr.6
+${PACKAGE}FILES+= expected.stderr.7
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= expected.stdout.3
+${PACKAGE}FILES+= expected.stdout.4
+${PACKAGE}FILES+= expected.stdout.5
+${PACKAGE}FILES+= expected.stdout.6
+${PACKAGE}FILES+= expected.stdout.7
+${PACKAGE}FILES+= libtest.a
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.depend b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test
new file mode 100644
index 0000000..5a8b065
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test
@@ -0,0 +1,61 @@
+# $FreeBSD$
+# This test checks the code reading archive files. The archive file
+# is a BSD4.4 file with __.SYMTAB and #1/N long file names.
+
+#############################################################################
+
+# should be ok
+test1: libtest.a(short.o)
+ @:
+
+libtest.a(short.o): ood
+ @:
+
+#############################################################################
+
+# should be ok
+test2: libtest.a(exactly15char.o)
+ @:
+
+libtest.a(exactly15char.o): ood
+ @:
+
+#############################################################################
+
+# should be ok
+test3: libtest.a(exactly16chars.o)
+ @:
+
+libtest.a(exactly16chars.o): ood
+ @:
+
+#############################################################################
+
+# should be ok
+test4: libtest.a(verylongobjectname.o)
+ @:
+
+libtest.a(verylongobjectname.o): ood
+ @:
+
+#############################################################################
+
+# Truncated to 16 characters
+# should fail
+test5: libtest.a(verylongobjectna)
+ @:
+
+#############################################################################
+
+# Truncated to 15 characters
+# should fail
+test6: libtest.a(verylongobjectn)
+ @:
+
+#############################################################################
+
+# should fail
+test7: libtest.a(\#1/20)
+ @:
+
+ood:
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5
new file mode 100644
index 0000000..7b91643
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5
@@ -0,0 +1 @@
+make: don't know how to make verylongobjectna. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6
new file mode 100644
index 0000000..fd15190
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6
@@ -0,0 +1 @@
+make: don't know how to make verylongobjectn. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7
new file mode 100644
index 0000000..cb572e1
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7
@@ -0,0 +1 @@
+make: don't know how to make #1/20. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh
new file mode 100644
index 0000000..2604c96
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Archive parsing (BSD4.4 format)."
+
+# Setup
+TEST_COPY_FILES="libtest.a 644"
+
+# Run
+TEST_N=7
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a b/usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a
new file mode 100644
index 0000000..891ce6e
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a
Binary files differ
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile
new file mode 100644
index 0000000..baf3e44
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_44bsd_mod
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.status.3
+${PACKAGE}FILES+= expected.status.4
+${PACKAGE}FILES+= expected.status.5
+${PACKAGE}FILES+= expected.status.6
+${PACKAGE}FILES+= expected.status.7
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stderr.3
+${PACKAGE}FILES+= expected.stderr.4
+${PACKAGE}FILES+= expected.stderr.5
+${PACKAGE}FILES+= expected.stderr.6
+${PACKAGE}FILES+= expected.stderr.7
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= expected.stdout.3
+${PACKAGE}FILES+= expected.stdout.4
+${PACKAGE}FILES+= expected.stdout.5
+${PACKAGE}FILES+= expected.stdout.6
+${PACKAGE}FILES+= expected.stdout.7
+${PACKAGE}FILES+= libtest.a
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.depend b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test
new file mode 100644
index 0000000..cd999da
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test
@@ -0,0 +1,64 @@
+# $FreeBSD$
+# This test checks the code reading archive files. The archive file
+# is a BSD4.4 file with __.SYMTAB and #1/N long file names.
+#
+# The modification of the archive consists in slashes appended to short names.
+#
+
+#############################################################################
+
+# must be ok
+test1: libtest.a(short.o)
+ @:
+
+libtest.a(short.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test2: libtest.a(exactly15char.o)
+ @:
+
+libtest.a(exactly15char.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test3: libtest.a(exactly16chars.o)
+ @:
+
+libtest.a(exactly16chars.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test4: libtest.a(verylongobjectname.o)
+ @:
+
+libtest.a(verylongobjectname.o): ood
+ @:
+
+#############################################################################
+
+# Truncated to 16 characters
+# must fail
+test5: libtest.a(verylongobjectna)
+ @:
+
+#############################################################################
+
+# Truncated to 15 characters
+# must fail
+test6: libtest.a(verylongobjectn)
+ @:
+
+#############################################################################
+
+# must fail
+test7: libtest.a(\#1/20)
+ @:
+
+ood:
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5
new file mode 100644
index 0000000..7b91643
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5
@@ -0,0 +1 @@
+make: don't know how to make verylongobjectna. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6
new file mode 100644
index 0000000..fd15190
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6
@@ -0,0 +1 @@
+make: don't know how to make verylongobjectn. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7
new file mode 100644
index 0000000..cb572e1
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7
@@ -0,0 +1 @@
+make: don't know how to make #1/20. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh
new file mode 100644
index 0000000..bf13f22
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Archive parsing (modified BSD4.4 format)."
+
+# Setup
+TEST_COPY_FILES="libtest.a 644"
+
+# Run
+TEST_N=7
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a
new file mode 100644
index 0000000..57bc407
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a
Binary files differ
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile
new file mode 100644
index 0000000..2dbfa64
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+PACKAGE= tests
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_oldbsd
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.status.3
+${PACKAGE}FILES+= expected.status.4
+${PACKAGE}FILES+= expected.status.5
+${PACKAGE}FILES+= expected.status.6
+${PACKAGE}FILES+= expected.status.7
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stderr.3
+${PACKAGE}FILES+= expected.stderr.4
+${PACKAGE}FILES+= expected.stderr.5
+${PACKAGE}FILES+= expected.stderr.6
+${PACKAGE}FILES+= expected.stderr.7
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= expected.stdout.3
+${PACKAGE}FILES+= expected.stdout.4
+${PACKAGE}FILES+= expected.stdout.5
+${PACKAGE}FILES+= expected.stdout.6
+${PACKAGE}FILES+= expected.stdout.7
+${PACKAGE}FILES+= libtest.a
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.depend b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test
new file mode 100644
index 0000000..b8f5116
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test
@@ -0,0 +1,62 @@
+# $FreeBSD$
+# This test checks the code reading archive files. The archive file
+# is an old BSD file with __.SYMTAB and no long file names. Filenames
+# are truncated to 16 characters.
+
+#############################################################################
+
+# must be ok
+test1: libtest.a(short.o)
+ @:
+
+libtest.a(short.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test2: libtest.a(exactly15char.o)
+ @:
+
+libtest.a(exactly15char.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test3: libtest.a(exactly16chars.o)
+ @:
+
+libtest.a(exactly16chars.o): ood
+ @:
+
+#############################################################################
+
+# must be ok
+test4: libtest.a(verylongobjectname.o)
+ @:
+
+libtest.a(verylongobjectname.o): ood
+ @:
+
+#############################################################################
+
+# Truncated to 16 characters
+# must be ok
+test5: libtest.a(verylongobjectna)
+ @:
+
+#############################################################################
+
+# Truncated to 15 characters
+# must fail
+test6: libtest.a(verylongobjectn)
+ @:
+
+#############################################################################
+
+# must fail
+test7: libtest.a(\#1/20)
+ @:
+
+ood:
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6
new file mode 100644
index 0000000..fd15190
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6
@@ -0,0 +1 @@
+make: don't know how to make verylongobjectn. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7
new file mode 100644
index 0000000..cb572e1
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7
@@ -0,0 +1 @@
+make: don't know how to make #1/20. Stop
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh
new file mode 100644
index 0000000..c7980c5
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Archive parsing (old BSD format)."
+
+# Setup
+TEST_COPY_FILES="libtest.a 644"
+
+# Run
+TEST_N=7
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a b/usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a
new file mode 100644
index 0000000..3434c53
--- /dev/null
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a
Binary files differ
diff --git a/usr.bin/bmake/tests/basic/Makefile b/usr.bin/bmake/tests/basic/Makefile
new file mode 100644
index 0000000..56dfb33
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic
+
+TESTS_SUBDIRS= t0 t1 t2 t3
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/basic/Makefile.depend b/usr.bin/bmake/tests/basic/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/basic/t0/Makefile b/usr.bin/bmake/tests/basic/t0/Makefile
new file mode 100644
index 0000000..0f82a64
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t0
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/basic/t0/Makefile.depend b/usr.bin/bmake/tests/basic/t0/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/basic/t0/expected.status.1 b/usr.bin/bmake/tests/basic/t0/expected.status.1
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/expected.status.1
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/basic/t0/expected.stderr.1 b/usr.bin/bmake/tests/basic/t0/expected.stderr.1
new file mode 100644
index 0000000..90280c8
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/expected.stderr.1
@@ -0,0 +1 @@
+make: no target to make.
diff --git a/usr.bin/bmake/tests/basic/t0/expected.stdout.1 b/usr.bin/bmake/tests/basic/t0/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/expected.stdout.1
diff --git a/usr.bin/bmake/tests/basic/t0/legacy_test.sh b/usr.bin/bmake/tests/basic/t0/legacy_test.sh
new file mode 100644
index 0000000..d23418a
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t0/legacy_test.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="An empty Makefile file and no target given."
+
+# Setup
+TEST_TOUCH="Makefile ''"
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/basic/t1/Makefile b/usr.bin/bmake/tests/basic/t1/Makefile
new file mode 100644
index 0000000..b4bdb25
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t1
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/basic/t1/Makefile.depend b/usr.bin/bmake/tests/basic/t1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/basic/t1/Makefile.test b/usr.bin/bmake/tests/basic/t1/Makefile.test
new file mode 100644
index 0000000..d120087
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/Makefile.test
@@ -0,0 +1,5 @@
+# $FreeBSD$
+#
+# Just a target and nothing else. No target on command line.
+#
+all:
diff --git a/usr.bin/bmake/tests/basic/t1/expected.status.1 b/usr.bin/bmake/tests/basic/t1/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/basic/t1/expected.stderr.1 b/usr.bin/bmake/tests/basic/t1/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/expected.stderr.1
diff --git a/usr.bin/bmake/tests/basic/t1/expected.stdout.1 b/usr.bin/bmake/tests/basic/t1/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/expected.stdout.1
diff --git a/usr.bin/bmake/tests/basic/t1/legacy_test.sh b/usr.bin/bmake/tests/basic/t1/legacy_test.sh
new file mode 100644
index 0000000..b07f927
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t1/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="A Makefile file with only a 'all:' file dependency specification."
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/basic/t2/Makefile b/usr.bin/bmake/tests/basic/t2/Makefile
new file mode 100644
index 0000000..1f0f7f9
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t2
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/basic/t2/Makefile.depend b/usr.bin/bmake/tests/basic/t2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/basic/t2/Makefile.test b/usr.bin/bmake/tests/basic/t2/Makefile.test
new file mode 100644
index 0000000..ab8fe49
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/Makefile.test
@@ -0,0 +1,6 @@
+# $FreeBSD$
+#
+# Just a target and a command. No command line targets.
+#
+all:
+ echo hello
diff --git a/usr.bin/bmake/tests/basic/t2/expected.status.1 b/usr.bin/bmake/tests/basic/t2/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/basic/t2/expected.stderr.1 b/usr.bin/bmake/tests/basic/t2/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/expected.stderr.1
diff --git a/usr.bin/bmake/tests/basic/t2/expected.stdout.1 b/usr.bin/bmake/tests/basic/t2/expected.stdout.1
new file mode 100644
index 0000000..e618540
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/expected.stdout.1
@@ -0,0 +1,2 @@
+echo hello
+hello
diff --git a/usr.bin/bmake/tests/basic/t2/legacy_test.sh b/usr.bin/bmake/tests/basic/t2/legacy_test.sh
new file mode 100644
index 0000000..da4c60a
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t2/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="A Makefile file with only a 'all:' file dependency specification, and shell command."
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/basic/t3/Makefile b/usr.bin/bmake/tests/basic/t3/Makefile
new file mode 100644
index 0000000..05532f3
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t3
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/basic/t3/Makefile.depend b/usr.bin/bmake/tests/basic/t3/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/basic/t3/expected.status.1 b/usr.bin/bmake/tests/basic/t3/expected.status.1
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/expected.status.1
@@ -0,0 +1 @@
+2
diff --git a/usr.bin/bmake/tests/basic/t3/expected.stderr.1 b/usr.bin/bmake/tests/basic/t3/expected.stderr.1
new file mode 100644
index 0000000..90280c8
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/expected.stderr.1
@@ -0,0 +1 @@
+make: no target to make.
diff --git a/usr.bin/bmake/tests/basic/t3/expected.stdout.1 b/usr.bin/bmake/tests/basic/t3/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/expected.stdout.1
diff --git a/usr.bin/bmake/tests/basic/t3/legacy_test.sh b/usr.bin/bmake/tests/basic/t3/legacy_test.sh
new file mode 100644
index 0000000..3c41bb3
--- /dev/null
+++ b/usr.bin/bmake/tests/basic/t3/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="No Makefile file, no command line target."
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/common.sh b/usr.bin/bmake/tests/common.sh
new file mode 100644
index 0000000..5c5df1e
--- /dev/null
+++ b/usr.bin/bmake/tests/common.sh
@@ -0,0 +1,533 @@
+# $FreeBSD$
+#
+# Common code used run regression tests for usr.bin/make.
+
+#
+# Output a message and exit with an error.
+#
+fatal()
+{
+ echo "fatal: $*" >/dev/stderr
+ exit 1
+}
+
+make_is_fmake() {
+ # This test is not very reliable but works for now: the old fmake
+ # does have a -v option while bmake doesn't.
+ ${MAKE_PROG} -f Makefile.non-existent -v 2>&1 | \
+ grep -q "cannot open.*non-existent"
+}
+
+#
+# Check whether the working directory exists - it must.
+#
+ensure_workdir()
+{
+ if [ ! -d ${WORK_DIR} ] ; then
+ fatal "working directory ${WORK_DIR} does not exist."
+ fi
+}
+
+#
+# Make sure all tests have been run
+#
+ensure_run()
+{
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ FAIL=
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ if ! skip_test ${N} ; then
+ if [ ! -f ${OUTPUT_DIR}/status.${N} -o \
+ ! -f ${OUTPUT_DIR}/stdout.${N} -o \
+ ! -f ${OUTPUT_DIR}/stderr.${N} ] ; then
+ echo "Test ${SUBDIR}/${N} no yet run"
+ FAIL=yes
+ fi
+ fi
+ N=$((N + 1))
+ done
+
+ if [ ! -z "${FAIL}" ] ; then
+ exit 1
+ fi
+}
+
+#
+# Output usage messsage.
+#
+print_usage()
+{
+ echo "Usage: sh -v -m <path> -w <dir> $0 command(s)"
+ echo " setup - setup working directory"
+ echo " run - run the tests"
+ echo " show - show test results"
+ echo " compare - compare actual and expected results"
+ echo " diff - diff actual and expected results"
+ echo " reset - reset the test to its initial state"
+ echo " clean - delete working and output directory"
+ echo " test - setup + run + compare"
+ echo " prove - setup + run + compare + clean"
+ echo " desc - print short description"
+ echo " update - update the expected results with the current results"
+ echo " help - show this information"
+}
+
+#
+# Return 0 if we should skip the test. 1 otherwise
+#
+skip_test()
+{
+ eval skip=\${TEST_${1}_SKIP}
+ if [ -z "${skip}" ] ; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+#
+# Common function for setup and reset.
+#
+common_setup()
+{
+ #
+ # If a Makefile exists in the source directory - copy it over
+ #
+ if [ -e ${SRC_DIR}/Makefile.test -a ! -e ${WORK_DIR}/Makefile ] ; then
+ cp ${SRC_DIR}/Makefile.test ${WORK_DIR}/Makefile
+ fi
+
+ #
+ # If the TEST_MAKE_DIRS variable is set, create those directories
+ #
+ set -- ${TEST_MAKE_DIRS}
+ while [ $# -ne 0 ] ; do
+ if [ ! -d ${WORK_DIR}/${1} ] ; then
+ mkdir -p -m ${2} ${WORK_DIR}/${1}
+ else
+ chmod ${2} ${WORK_DIR}/${1}
+ fi
+ shift ; shift
+ done
+
+ #
+ # If the TEST_COPY_FILES variable is set, copy those files over to
+ # the working directory. The value is assumed to be pairs of
+ # filenames and modes.
+ #
+ set -- ${TEST_COPY_FILES}
+ while [ $# -ne 0 ] ; do
+ local dstname="$(echo ${1} | sed -e 's,Makefile.test,Makefile,')"
+ if [ ! -e ${WORK_DIR}/${dstname} ] ; then
+ cp ${SRC_DIR}/${1} ${WORK_DIR}/${dstname}
+ fi
+ chmod ${2} ${WORK_DIR}/${dstname}
+ shift ; shift
+ done
+
+ #
+ # If the TEST_TOUCH variable is set, it is taken to be a list
+ # of pairs of filenames and arguments to touch(1). The arguments
+ # to touch must be surrounded by single quotes if there are more
+ # than one argument.
+ #
+ eval set -- ${TEST_TOUCH}
+ while [ $# -ne 0 ] ; do
+ eval touch ${2} ${WORK_DIR}/${1}
+ shift ; shift
+ done
+
+ #
+ # Now create links
+ #
+ eval set -- ${TEST_LINKS}
+ while [ $# -ne 0 ] ; do
+ eval ln ${WORK_DIR}/${1} ${WORK_DIR}/${2}
+ shift ; shift
+ done
+}
+
+#
+# Setup the test. This creates the working and output directories and
+# populates it with files. If there is a setup_test() function - call it.
+#
+eval_setup()
+{
+ #
+ # Check whether the working directory exists. If it does exit
+ # fatally so that we don't clobber a test the user is working on.
+ #
+ if [ -d ${WORK_DIR} ] ; then
+ fatal "working directory ${WORK_DIR} already exists."
+ fi
+
+ #
+ # Now create it and the output directory
+ #
+ mkdir -p ${WORK_DIR}
+ rm -rf ${OUTPUT_DIR}
+ mkdir -p ${OUTPUT_DIR}
+
+ #
+ # Common stuff
+ #
+ common_setup
+
+ #
+ # Now after all execute the user's setup function if it exists.
+ #
+ setup_test
+}
+
+#
+# Default setup_test function does nothing. This may be overriden by
+# the test.
+#
+setup_test()
+{
+}
+
+#
+# Reset the test. Here we need to rely on information from the test.
+# We executed the same steps as in the setup, by try not to clobber existing
+# files.
+# All files and directories that are listed on the TEST_CLEAN_FILES
+# variable are removed. Then the TEST_TOUCH list is executed and finally
+# the reset_test() function called if it exists.
+#
+eval_reset()
+{
+ ensure_workdir
+
+ #
+ # Clean the output directory
+ #
+ rm -rf ${OUTPUT_DIR}/*
+
+ #
+ # Common stuff
+ #
+ common_setup
+
+ #
+ # Remove files.
+ #
+ for f in ${TEST_CLEAN_FILES} ; do
+ rm -rf ${WORK_DIR}/${f}
+ done
+
+ #
+ # Execute test's function
+ #
+ reset_test
+}
+
+#
+# Default reset_test function does nothing. This may be overriden by
+# the test.
+#
+reset_test()
+{
+}
+
+#
+# Clean the test. This simply removes the working and output directories.
+#
+eval_clean()
+{
+ #
+ # If you have special cleaning needs, provide a 'cleanup' shell script.
+ #
+ if [ -n "${TEST_CLEANUP}" ] ; then
+ . ${SRC_DIR}/cleanup
+ fi
+ if [ -z "${NO_TEST_CLEANUP}" ] ; then
+ rm -rf ${WORK_DIR}
+ rm -rf ${OUTPUT_DIR}
+ fi
+}
+
+#
+# Run the test.
+#
+eval_run()
+{
+ ensure_workdir
+
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ if ! skip_test ${N} ; then
+ ( cd ${WORK_DIR} ;
+ exec 1>${OUTPUT_DIR}/stdout.${N} 2>${OUTPUT_DIR}/stderr.${N}
+ run_test ${N}
+ echo $? >${OUTPUT_DIR}/status.${N}
+ )
+ fi
+ N=$((N + 1))
+ done
+}
+
+#
+# Default run_test() function. It can be replaced by the
+# user specified regression test. The argument to this function is
+# the test number.
+#
+run_test()
+{
+ eval args=\${TEST_${1}-test${1}}
+ ${MAKE_PROG} $args
+}
+
+#
+# Show test results.
+#
+eval_show()
+{
+ ensure_workdir
+
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ if ! skip_test ${N} ; then
+ echo "=== Test ${N} Status =================="
+ cat ${OUTPUT_DIR}/status.${N}
+ echo ".......... Stdout .................."
+ cat ${OUTPUT_DIR}/stdout.${N}
+ echo ".......... Stderr .................."
+ cat ${OUTPUT_DIR}/stderr.${N}
+ fi
+ N=$((N + 1))
+ done
+}
+
+#
+# Compare results with expected results
+#
+eval_compare()
+{
+ ensure_workdir
+ ensure_run
+
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ echo "1..${TEST_N}"
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ fail=
+ todo=
+ skip=
+ if ! skip_test ${N} ; then
+ do_compare stdout ${N} || fail="${fail}stdout "
+ do_compare stderr ${N} || fail="${fail}stderr "
+ do_compare status ${N} || fail="${fail}status "
+ eval todo=\${TEST_${N}_TODO}
+ else
+ eval skip=\${TEST_${N}_SKIP}
+ fi
+ msg=
+ if [ ! -z "$fail" ]; then
+ msg="${msg}not "
+ fi
+ msg="${msg}ok ${N} ${SUBDIR}/${N}"
+ if [ ! -z "$fail" -o ! -z "$todo" -o ! -z "$skip" ]; then
+ msg="${msg} # "
+ fi
+ if [ ! -z "$skip" ] ; then
+ msg="${msg}skip ${skip}; "
+ fi
+ if [ ! -z "$todo" ] ; then
+ msg="${msg}TODO ${todo}; "
+ fi
+ if [ ! -z "$fail" ] ; then
+ msg="${msg}reason: ${fail}"
+ fi
+ echo ${msg}
+ N=$((N + 1))
+ done
+}
+
+#
+# Check if the test result is the same as the expected result.
+#
+# $1 Input file
+# $2 Test number
+#
+do_compare()
+{
+ local EXPECTED RESULT
+ EXPECTED="${SRC_DIR}/expected.$1.$2"
+ RESULT="${OUTPUT_DIR}/$1.$2"
+
+ if [ -f $EXPECTED ]; then
+ cat $RESULT | sed -e "s,^$(basename $MAKE_PROG):,make:," | \
+ diff -u $EXPECTED -
+ #diff -q $EXPECTED - 1>/dev/null 2>/dev/null
+ return $?
+ else
+ return 1 # FAIL
+ fi
+}
+
+#
+# Diff current and expected results
+#
+eval_diff()
+{
+ ensure_workdir
+ ensure_run
+
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ if ! skip_test ${N} ; then
+ FAIL=
+ do_diff stdout ${N}
+ do_diff stderr ${N}
+ do_diff status ${N}
+ fi
+ N=$((N + 1))
+ done
+}
+
+#
+# Check if the test result is the same as the expected result.
+#
+# $1 Input file
+# $2 Test number
+#
+do_diff()
+{
+ local EXPECTED RESULT
+ EXPECTED="${SRC_DIR}/expected.$1.$2"
+ RESULT="${OUTPUT_DIR}/$1.$2"
+
+ echo diff -u $EXPECTED $RESULT
+ if [ -f $EXPECTED ]; then
+ diff -u $EXPECTED $RESULT
+ else
+ echo "${EXPECTED} does not exist"
+ fi
+}
+
+#
+# Update expected results
+#
+eval_update()
+{
+ ensure_workdir
+ ensure_run
+
+ if [ -z "${TEST_N}" ] ; then
+ TEST_N=1
+ fi
+
+ FAIL=
+ N=1
+ while [ ${N} -le ${TEST_N} ] ; do
+ if ! skip_test ${N} ; then
+ cp ${OUTPUT_DIR}/stdout.${N} expected.stdout.${N}
+ cp ${OUTPUT_DIR}/stderr.${N} expected.stderr.${N}
+ cp ${OUTPUT_DIR}/status.${N} expected.status.${N}
+ fi
+ N=$((N + 1))
+ done
+}
+
+#
+# Print description
+#
+eval_desc()
+{
+ echo "${SUBDIR}: ${DESC}"
+}
+
+#
+# Run the test
+#
+eval_test()
+{
+ eval_setup
+ eval_run
+ eval_compare
+}
+
+#
+# Run the test for prove(1)
+#
+eval_prove()
+{
+ eval_setup
+ eval_run
+ eval_compare
+ eval_clean
+}
+
+#
+# Main function. Execute the command(s) on the command line.
+#
+eval_cmd()
+{
+ if [ $# -eq 0 ] ; then
+ # if no arguments given default to 'prove'
+ set -- prove
+ fi
+
+ if ! make_is_fmake ; then
+ for i in $(jot ${TEST_N:-1}) ; do
+ eval TEST_${i}_SKIP=\"make is not fmake\"
+ done
+ fi
+
+ for i
+ do
+ case $i in
+
+ setup | run | compare | diff | clean | reset | show | \
+ test | prove | desc | update)
+ eval eval_$i
+ ;;
+ * | help)
+ print_usage
+ ;;
+ esac
+ done
+}
+
+##############################################################################
+#
+# Main code
+#
+
+#
+# Determine our sub-directory. Argh.
+#
+SRC_DIR=$(dirname $0)
+SRC_BASE=`cd ${SRC_DIR} ; while [ ! -f common.sh ] ; do cd .. ; done ; pwd`
+SUBDIR=`echo ${SRC_DIR} | sed "s@${SRC_BASE}/@@"`
+
+#
+# Construct working directory
+#
+WORK_DIR=$(pwd)/work/${SUBDIR}
+OUTPUT_DIR=${WORK_DIR}.OUTPUT
+
+#
+# Make to use
+#
+MAKE_PROG=${MAKE_PROG:-/usr/bin/make}
diff --git a/usr.bin/bmake/tests/execution/Makefile b/usr.bin/bmake/tests/execution/Makefile
new file mode 100644
index 0000000..2c91bbb
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution
+
+TESTS_SUBDIRS= ellipsis empty joberr plus
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/execution/Makefile.depend b/usr.bin/bmake/tests/execution/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/execution/ellipsis/Makefile b/usr.bin/bmake/tests/execution/ellipsis/Makefile
new file mode 100644
index 0000000..e3008fa
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/ellipsis
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/execution/ellipsis/Makefile.depend b/usr.bin/bmake/tests/execution/ellipsis/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/execution/ellipsis/Makefile.test b/usr.bin/bmake/tests/execution/ellipsis/Makefile.test
new file mode 100644
index 0000000..d19f642
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/Makefile.test
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+ELLIPSIS= ...
+
+check-ellipsis:
+ @${MAKE} -f ${MAKEFILE} do-$@
+ @${MAKE} -f ${MAKEFILE} -j2 do-$@
+ @${MAKE} -f ${MAKEFILE} -j2 -B do-$@
+
+do-check-ellipsis: do-check-ellipsis-1 do-check-ellipsis-2
+.ORDER: do-check-ellipsis-1 do-check-ellipsis-2
+
+do-check-ellipsis-1:
+ @echo before $@
+ ${ELLIPSIS}
+ @echo after $@
+
+do-check-ellipsis-2:
+ @echo before $@
+ ${ELLIPSIS}
+ @echo after $@
diff --git a/usr.bin/bmake/tests/execution/ellipsis/expected.status.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1
diff --git a/usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1
new file mode 100644
index 0000000..a7e5727
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1
@@ -0,0 +1,12 @@
+before do-check-ellipsis-1
+before do-check-ellipsis-2
+after do-check-ellipsis-1
+after do-check-ellipsis-2
+before do-check-ellipsis-1
+before do-check-ellipsis-2
+after do-check-ellipsis-1
+after do-check-ellipsis-2
+before do-check-ellipsis-1
+before do-check-ellipsis-2
+after do-check-ellipsis-1
+after do-check-ellipsis-2
diff --git a/usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh b/usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh
new file mode 100644
index 0000000..9e9cd01
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Ellipsis command from variable"
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/execution/empty/Makefile b/usr.bin/bmake/tests/execution/empty/Makefile
new file mode 100644
index 0000000..3a9390c
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/empty
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/execution/empty/Makefile.depend b/usr.bin/bmake/tests/execution/empty/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/execution/empty/Makefile.test b/usr.bin/bmake/tests/execution/empty/Makefile.test
new file mode 100644
index 0000000..f687bce
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/Makefile.test
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+EMPTY=
+
+check-empty:
+ @${MAKE} -f ${MAKEFILE} do-$@
+ @${MAKE} -f ${MAKEFILE} -j2 do-$@
+ @${MAKE} -f ${MAKEFILE} -j2 -B do-$@
+
+do-check-empty:
+ ${EMPTY}
+ @${EMPTY}
+ @-${EMPTY}
diff --git a/usr.bin/bmake/tests/execution/empty/expected.status.1 b/usr.bin/bmake/tests/execution/empty/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/execution/empty/expected.stderr.1 b/usr.bin/bmake/tests/execution/empty/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/expected.stderr.1
diff --git a/usr.bin/bmake/tests/execution/empty/expected.stdout.1 b/usr.bin/bmake/tests/execution/empty/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/expected.stdout.1
diff --git a/usr.bin/bmake/tests/execution/empty/legacy_test.sh b/usr.bin/bmake/tests/execution/empty/legacy_test.sh
new file mode 100644
index 0000000..e02d175
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/empty/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Empty command (from variable)"
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/execution/joberr/Makefile b/usr.bin/bmake/tests/execution/joberr/Makefile
new file mode 100644
index 0000000..8eeaa82
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/joberr
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/execution/joberr/Makefile.depend b/usr.bin/bmake/tests/execution/joberr/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/execution/joberr/Makefile.test b/usr.bin/bmake/tests/execution/joberr/Makefile.test
new file mode 100644
index 0000000..aca86e8
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/Makefile.test
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+check-joberr:
+.for _t in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
+ @-${MAKE} -f ${MAKEFILE} -j2 do-$@
+.endfor
+
+do-check-joberr:
+ @echo "Error: build failed"
+ @exit 1
diff --git a/usr.bin/bmake/tests/execution/joberr/expected.status.1 b/usr.bin/bmake/tests/execution/joberr/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/execution/joberr/expected.stderr.1 b/usr.bin/bmake/tests/execution/joberr/expected.stderr.1
new file mode 100644
index 0000000..d0c8a2e
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/expected.stderr.1
@@ -0,0 +1,30 @@
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
+1 error
diff --git a/usr.bin/bmake/tests/execution/joberr/expected.stdout.1 b/usr.bin/bmake/tests/execution/joberr/expected.stdout.1
new file mode 100644
index 0000000..0ee28f4
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/expected.stdout.1
@@ -0,0 +1,90 @@
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+Error: build failed
+*** [do-check-joberr] Error code 1
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
+*** [check-joberr] Error code 2 (ignored)
diff --git a/usr.bin/bmake/tests/execution/joberr/legacy_test.sh b/usr.bin/bmake/tests/execution/joberr/legacy_test.sh
new file mode 100644
index 0000000..429bfe1
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/joberr/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Test job make error output"
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/execution/plus/Makefile b/usr.bin/bmake/tests/execution/plus/Makefile
new file mode 100644
index 0000000..884b991
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/plus
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/execution/plus/Makefile.depend b/usr.bin/bmake/tests/execution/plus/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/execution/plus/Makefile.test b/usr.bin/bmake/tests/execution/plus/Makefile.test
new file mode 100644
index 0000000..ae3bdc3
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/Makefile.test
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+check-+:
+ @${MAKE} -f ${MAKEFILE} -j2 -n do-$@
+
+do-check-+:
+ @+echo $@
diff --git a/usr.bin/bmake/tests/execution/plus/expected.status.1 b/usr.bin/bmake/tests/execution/plus/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/execution/plus/expected.stderr.1 b/usr.bin/bmake/tests/execution/plus/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/expected.stderr.1
diff --git a/usr.bin/bmake/tests/execution/plus/expected.stdout.1 b/usr.bin/bmake/tests/execution/plus/expected.stdout.1
new file mode 100644
index 0000000..b334fc7
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/expected.stdout.1
@@ -0,0 +1 @@
+do-check-+
diff --git a/usr.bin/bmake/tests/execution/plus/legacy_test.sh b/usr.bin/bmake/tests/execution/plus/legacy_test.sh
new file mode 100644
index 0000000..0737d1b
--- /dev/null
+++ b/usr.bin/bmake/tests/execution/plus/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Test '+command' execution with -n -jX"
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/Makefile b/usr.bin/bmake/tests/shell/Makefile
new file mode 100644
index 0000000..13b570e
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell
+
+TESTS_SUBDIRS= builtin meta path path_select replace select
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/Makefile.depend b/usr.bin/bmake/tests/shell/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/builtin/Makefile b/usr.bin/bmake/tests/shell/builtin/Makefile
new file mode 100644
index 0000000..d603c46
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/builtin
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/builtin/Makefile.depend b/usr.bin/bmake/tests/shell/builtin/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/builtin/Makefile.test b/usr.bin/bmake/tests/shell/builtin/Makefile.test
new file mode 100644
index 0000000..0376478
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/Makefile.test
@@ -0,0 +1,18 @@
+#
+# In compat mode (the default without -j) a line that contains no shell
+# meta characters and no shell builtins is not passed to the shell but
+# executed directly. In our example the ls line without meta characters
+# will really execute ls, while the line with meta characters will execute
+# our special shell.
+#
+# $FreeBSD$
+
+.SHELL: path="${.CURDIR}/sh"
+
+.PHONY: builtin no-builtin
+
+builtin:
+ @exec ls -d .
+
+no-builtin:
+ @ls -d .
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.status.1 b/usr.bin/bmake/tests/shell/builtin/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.status.2 b/usr.bin/bmake/tests/shell/builtin/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stderr.1 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stderr.2 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stdout.1 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/bmake/tests/shell/builtin/expected.stdout.2 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2
new file mode 100644
index 0000000..e350eaf
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2
@@ -0,0 +1 @@
+-ec exec ls -d .
diff --git a/usr.bin/bmake/tests/shell/builtin/legacy_test.sh b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh
new file mode 100644
index 0000000..6347583
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Check that a command line with a builtin is passed to the shell."
+
+# Setup
+TEST_COPY_FILES="sh 755"
+
+# Run
+TEST_N=2
+TEST_1="-B no-builtin"
+TEST_2="-B builtin"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/builtin/sh b/usr.bin/bmake/tests/shell/builtin/sh
new file mode 100644
index 0000000..3a507b87
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/builtin/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo "$@"
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/bmake/tests/shell/meta/Makefile b/usr.bin/bmake/tests/shell/meta/Makefile
new file mode 100644
index 0000000..f7cab6c
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/meta
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/meta/Makefile.depend b/usr.bin/bmake/tests/shell/meta/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/meta/Makefile.test b/usr.bin/bmake/tests/shell/meta/Makefile.test
new file mode 100644
index 0000000..bcf19d0
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/Makefile.test
@@ -0,0 +1,18 @@
+#
+# In compat mode (the default without -j) a line that contains no shell
+# meta characters and no shell builtins is not passed to the shell but
+# executed directly. In our example the ls line without meta characters
+# will really execute ls, while the line with meta characters will execute
+# our special shell.
+#
+# $FreeBSD$
+
+.SHELL: path="${.OBJDIR}/sh"
+
+.PHONY: meta no-meta
+
+meta:
+ @ls *
+
+no-meta:
+ @ls -d .
diff --git a/usr.bin/bmake/tests/shell/meta/expected.status.1 b/usr.bin/bmake/tests/shell/meta/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/meta/expected.status.2 b/usr.bin/bmake/tests/shell/meta/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/meta/expected.stderr.1 b/usr.bin/bmake/tests/shell/meta/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/meta/expected.stderr.2 b/usr.bin/bmake/tests/shell/meta/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/meta/expected.stdout.1 b/usr.bin/bmake/tests/shell/meta/expected.stdout.1
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.1
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/bmake/tests/shell/meta/expected.stdout.2 b/usr.bin/bmake/tests/shell/meta/expected.stdout.2
new file mode 100644
index 0000000..6ac6f19
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.2
@@ -0,0 +1 @@
+-ec ls *
diff --git a/usr.bin/bmake/tests/shell/meta/legacy_test.sh b/usr.bin/bmake/tests/shell/meta/legacy_test.sh
new file mode 100644
index 0000000..41cd763
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/legacy_test.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Check that a command line with meta characters is passed to the shell."
+
+# Setup
+TEST_COPY_FILES="sh 755"
+
+# Run
+TEST_N=2
+TEST_1="-B no-meta"
+TEST_2="-B meta"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/meta/sh b/usr.bin/bmake/tests/shell/meta/sh
new file mode 100644
index 0000000..3a507b87
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/meta/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo "$@"
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/bmake/tests/shell/path/Makefile b/usr.bin/bmake/tests/shell/path/Makefile
new file mode 100644
index 0000000..6dbb872
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/path/Makefile.depend b/usr.bin/bmake/tests/shell/path/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/path/Makefile.test b/usr.bin/bmake/tests/shell/path/Makefile.test
new file mode 100644
index 0000000..fe40b64
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/Makefile.test
@@ -0,0 +1,31 @@
+#
+# Change the path for builtin shells. There are two methods to do this.
+# This is the first of them when the basename of the path is equal to
+# one of the builtin shells so that the .SHELL target automatically
+# also selectes the shell without specifying the name.
+#
+# Be sure to include a meta-character into the command line, so that
+# really our shell is executed.
+#
+# $FreeBSD$
+#
+
+.ifmake sh_test
+
+.SHELL: path=${.OBJDIR}/sh
+sh_test:
+ @: This is the shell.
+
+.elifmake csh_test
+
+.SHELL: path=${.OBJDIR}/csh
+csh_test:
+ @: This is the C-shell.
+
+.elifmake ksh_test
+
+.SHELL: path=${.OBJDIR}/ksh
+ksh_test:
+ @: This is the Korn-shell.
+
+.endif
diff --git a/usr.bin/bmake/tests/shell/path/expected.status.1 b/usr.bin/bmake/tests/shell/path/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/path/expected.status.2 b/usr.bin/bmake/tests/shell/path/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/path/expected.stderr.1 b/usr.bin/bmake/tests/shell/path/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/path/expected.stderr.2 b/usr.bin/bmake/tests/shell/path/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/path/expected.stdout.1 b/usr.bin/bmake/tests/shell/path/expected.stdout.1
new file mode 100644
index 0000000..d881364
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.stdout.1
@@ -0,0 +1 @@
+-ec : This is the shell.
diff --git a/usr.bin/bmake/tests/shell/path/expected.stdout.2 b/usr.bin/bmake/tests/shell/path/expected.stdout.2
new file mode 100644
index 0000000..de3fc89
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/expected.stdout.2
@@ -0,0 +1 @@
+-ec : This is the C-shell.
diff --git a/usr.bin/bmake/tests/shell/path/legacy_test.sh b/usr.bin/bmake/tests/shell/path/legacy_test.sh
new file mode 100644
index 0000000..9289a8d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/legacy_test.sh
@@ -0,0 +1,20 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="New path for builtin shells."
+
+# Setup
+TEST_COPY_FILES="sh 755"
+TEST_LINKS="sh csh sh ksh"
+
+# Run
+TEST_N=3
+TEST_1="sh_test"
+TEST_2="csh_test"
+TEST_3="ksh_test"
+TEST_3_SKIP="no ksh on FreeBSD"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/path/sh b/usr.bin/bmake/tests/shell/path/sh
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo $@
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/bmake/tests/shell/path_select/Makefile b/usr.bin/bmake/tests/shell/path_select/Makefile
new file mode 100644
index 0000000..7fecfd3
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path_select
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= shell
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/path_select/Makefile.depend b/usr.bin/bmake/tests/shell/path_select/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/path_select/Makefile.test b/usr.bin/bmake/tests/shell/path_select/Makefile.test
new file mode 100644
index 0000000..05cfb27
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/Makefile.test
@@ -0,0 +1,31 @@
+#
+# Change the path for builtin shells. There are two methods to do this.
+# This is the second of them when both a path and a name are specified.
+# This selects a builtin shell according to the name, but executes it
+# from the specified path.
+#
+# Be sure to include a meta-character into the command line, so that
+# really our shell is executed.
+#
+# $FreeBSD$
+#
+
+.ifmake sh_test
+
+.SHELL: name=sh path=${.CURDIR}/shell
+sh_test:
+ @: This is the shell.
+
+.elifmake csh_test
+
+.SHELL: name=csh path=${.CURDIR}/shell
+csh_test:
+ @: This is the C-shell.
+
+.elifmake ksh_test
+
+.SHELL: name=ksh path=${.CURDIR}/shell
+ksh_test:
+ @: This is the Korn-shell.
+
+.endif
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.status.1 b/usr.bin/bmake/tests/shell/path_select/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.status.2 b/usr.bin/bmake/tests/shell/path_select/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stderr.1 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stderr.2 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stdout.1 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1
new file mode 100644
index 0000000..d881364
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1
@@ -0,0 +1 @@
+-ec : This is the shell.
diff --git a/usr.bin/bmake/tests/shell/path_select/expected.stdout.2 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2
new file mode 100644
index 0000000..de3fc89
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2
@@ -0,0 +1 @@
+-ec : This is the C-shell.
diff --git a/usr.bin/bmake/tests/shell/path_select/legacy_test.sh b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh
new file mode 100644
index 0000000..6b75b90
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="New path for builtin shells (2)."
+
+# Setup
+TEST_COPY_FILES="shell 755"
+
+# Run
+TEST_N=3
+TEST_1="sh_test"
+TEST_2="csh_test"
+TEST_3="ksh_test"
+TEST_3_SKIP="no ksh on FreeBSD"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/path_select/shell b/usr.bin/bmake/tests/shell/path_select/shell
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/path_select/shell
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo $@
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/bmake/tests/shell/replace/Makefile b/usr.bin/bmake/tests/shell/replace/Makefile
new file mode 100644
index 0000000..980b99c
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/replace
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= shell
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/replace/Makefile.depend b/usr.bin/bmake/tests/shell/replace/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/replace/Makefile.test b/usr.bin/bmake/tests/shell/replace/Makefile.test
new file mode 100644
index 0000000..2160dbf
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/Makefile.test
@@ -0,0 +1,21 @@
+#
+# Test that we can replace the shell and set all the shell parameters
+# (except meta and builtin which have their own test). This is done by
+# using a shell script for the shell that echoes all command line
+# arguments and its standard input. The shell name should not be one of
+# the builtin shells.
+#
+# XXX There seems to be a problem here in -j1 mode: for the line without
+# @- make should switch on echoing again, but it doesn't.
+#
+# $FreeBSD$
+
+.SHELL: name="shell" path="${.CURDIR}/shell" \
+ quiet="be quiet" echo="be verbose" filter="be verbose" \
+ echoFlag="x" errFlag="y" \
+ hasErrCtl=y check="check errors" ignore="ignore errors"
+
+.PHONY: test1
+test1:
+ -@funny $$
+ funnier $$
diff --git a/usr.bin/bmake/tests/shell/replace/expected.status.1 b/usr.bin/bmake/tests/shell/replace/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/replace/expected.status.2 b/usr.bin/bmake/tests/shell/replace/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/replace/expected.stderr.1 b/usr.bin/bmake/tests/shell/replace/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/replace/expected.stderr.2 b/usr.bin/bmake/tests/shell/replace/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/replace/expected.stdout.1 b/usr.bin/bmake/tests/shell/replace/expected.stdout.1
new file mode 100644
index 0000000..eff99ea
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.1
@@ -0,0 +1,3 @@
+-c funny $
+funnier $
+-ec funnier $
diff --git a/usr.bin/bmake/tests/shell/replace/expected.stdout.2 b/usr.bin/bmake/tests/shell/replace/expected.stdout.2
new file mode 100644
index 0000000..c79a09a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.2
@@ -0,0 +1,6 @@
+-yx
+be quiet
+ignore errors
+funny $
+check errors
+funnier $
diff --git a/usr.bin/bmake/tests/shell/replace/legacy_test.sh b/usr.bin/bmake/tests/shell/replace/legacy_test.sh
new file mode 100644
index 0000000..880ca78
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/legacy_test.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Check that the shell can be replaced."
+
+# Setup
+TEST_COPY_FILES="shell 755"
+
+# Run
+TEST_N=2
+TEST_1=
+TEST_2=-j2
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/shell/replace/shell b/usr.bin/bmake/tests/shell/replace/shell
new file mode 100644
index 0000000..46169eb
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/replace/shell
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+echo $@
+if ! test -t 0 ; then
+ cat
+fi
diff --git a/usr.bin/bmake/tests/shell/select/Makefile b/usr.bin/bmake/tests/shell/select/Makefile
new file mode 100644
index 0000000..1695c88
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/select
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/shell/select/Makefile.depend b/usr.bin/bmake/tests/shell/select/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/shell/select/Makefile.test b/usr.bin/bmake/tests/shell/select/Makefile.test
new file mode 100644
index 0000000..74d96e1
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/Makefile.test
@@ -0,0 +1,28 @@
+#
+# We just select the builtin shells and check whether it is really
+# executed. This should print just the shell paths. Because we
+# normally don't have a ksh, we make this test conditional. This means
+# one has to recreate the test results once ksh is installed.
+#
+# $FreeBSD$
+#
+
+.ifmake sh_test
+
+.SHELL: name=sh
+sh_test: print_path
+
+.elifmake csh_test
+
+.SHELL: name=csh
+csh_test: print_path
+
+.elifmake ksh_test
+
+.SHELL: name=ksh
+ksh_test: print_path
+
+.endif
+
+print_path:
+ @ps -x -opid,command | awk '$$1=='$$$$' { print $$2; }'
diff --git a/usr.bin/bmake/tests/shell/select/expected.status.1 b/usr.bin/bmake/tests/shell/select/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/select/expected.status.2 b/usr.bin/bmake/tests/shell/select/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/shell/select/expected.stderr.1 b/usr.bin/bmake/tests/shell/select/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.stderr.1
diff --git a/usr.bin/bmake/tests/shell/select/expected.stderr.2 b/usr.bin/bmake/tests/shell/select/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.stderr.2
diff --git a/usr.bin/bmake/tests/shell/select/expected.stdout.1 b/usr.bin/bmake/tests/shell/select/expected.stdout.1
new file mode 100644
index 0000000..c2cdaa0
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.stdout.1
@@ -0,0 +1 @@
+/bin/sh
diff --git a/usr.bin/bmake/tests/shell/select/expected.stdout.2 b/usr.bin/bmake/tests/shell/select/expected.stdout.2
new file mode 100644
index 0000000..5a831e8
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/expected.stdout.2
@@ -0,0 +1 @@
+/bin/csh
diff --git a/usr.bin/bmake/tests/shell/select/legacy_test.sh b/usr.bin/bmake/tests/shell/select/legacy_test.sh
new file mode 100644
index 0000000..46d3eaf
--- /dev/null
+++ b/usr.bin/bmake/tests/shell/select/legacy_test.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Select the builtin sh shell."
+
+# Run
+TEST_N=3
+TEST_1="sh_test"
+TEST_2="csh_test"
+TEST_3="ksh_test"
+TEST_3_SKIP="no ksh on FreeBSD"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/suffixes/Makefile b/usr.bin/bmake/tests/suffixes/Makefile
new file mode 100644
index 0000000..60ec86e
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes
+
+TESTS_SUBDIRS= basic src_wild1 src_wild2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/suffixes/Makefile.depend b/usr.bin/bmake/tests/suffixes/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/suffixes/basic/Makefile b/usr.bin/bmake/tests/suffixes/basic/Makefile
new file mode 100644
index 0000000..bbfc150
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/basic
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES= Makefile.test
+${PACKAGE}FILES+= TEST1.a
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/suffixes/basic/Makefile.depend b/usr.bin/bmake/tests/suffixes/basic/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/suffixes/basic/Makefile.test b/usr.bin/bmake/tests/suffixes/basic/Makefile.test
new file mode 100644
index 0000000..45d9130
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/Makefile.test
@@ -0,0 +1,13 @@
+# $FreeBSD$
+#
+# Check that a simple suffix rule is correctly processed.
+
+test1: TEST1.b
+ diff -u TEST1.a TEST1.b
+
+.SUFFIXES:
+
+.SUFFIXES: .a .b
+
+.a.b:
+ cat ${.IMPSRC} >${.TARGET}
diff --git a/usr.bin/bmake/tests/suffixes/basic/TEST1.a b/usr.bin/bmake/tests/suffixes/basic/TEST1.a
new file mode 100644
index 0000000..da5569b
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/TEST1.a
@@ -0,0 +1 @@
+I'm test file 1.
diff --git a/usr.bin/bmake/tests/suffixes/basic/expected.status.1 b/usr.bin/bmake/tests/suffixes/basic/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/suffixes/basic/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/basic/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.stderr.1
diff --git a/usr.bin/bmake/tests/suffixes/basic/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/basic/expected.stdout.1
new file mode 100644
index 0000000..582927e
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.stdout.1
@@ -0,0 +1,2 @@
+cat TEST1.a >TEST1.b
+diff -u TEST1.a TEST1.b
diff --git a/usr.bin/bmake/tests/suffixes/basic/legacy_test.sh b/usr.bin/bmake/tests/suffixes/basic/legacy_test.sh
new file mode 100644
index 0000000..3446bf0
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/basic/legacy_test.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Basic suffix operation."
+
+# Setup
+TEST_COPY_FILES="TEST1.a 644"
+
+# Reset
+TEST_CLEAN="Test1.b"
+
+# Run
+TEST_N=1
+TEST_1="-r test1"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/Makefile b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile
new file mode 100644
index 0000000..cfcfdca
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/src_wild1
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= TEST1.a
+${PACKAGE}FILES+= TEST2.a
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.depend b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test
new file mode 100644
index 0000000..d0258ad
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+test1: TEST1.b
+ cat TEST1.a TEST2.a | diff -u - TEST1.b
+
+TEST1.b: *.a
+ cat ${.ALLSRC} >${.TARGET}
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a b/usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a
new file mode 100644
index 0000000..da5569b
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a
@@ -0,0 +1 @@
+I'm test file 1.
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a b/usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a
new file mode 100644
index 0000000..34f8508
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a
@@ -0,0 +1 @@
+I'm test file 2.
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1
new file mode 100644
index 0000000..3cd2129
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1
@@ -0,0 +1,2 @@
+cat TEST1.a TEST2.a >TEST1.b
+cat TEST1.a TEST2.a | diff -u - TEST1.b
diff --git a/usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh b/usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh
new file mode 100644
index 0000000..053cc6c
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Source wildcard expansion."
+
+# Setup
+TEST_COPY_FILES="TEST1.a 644 TEST2.a 644"
+
+# Reset
+TEST_CLEAN="TEST1.b"
+
+# Run
+TEST_N=1
+TEST_1="-r test1"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/Makefile b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile
new file mode 100644
index 0000000..d66ca35
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/src_wild2
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= TEST1.a
+${PACKAGE}FILES+= TEST2.a
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.depend b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test
new file mode 100644
index 0000000..1dea7ea
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test
@@ -0,0 +1,12 @@
+# $FreeBSD$
+#
+# Source expansion with the source in a macro
+#
+
+SRC=*.a
+
+test1: TEST1.b
+ cat TEST1.a TEST2.a | diff -u - TEST1.b
+
+TEST1.b: ${SRC}
+ cat ${.ALLSRC} >${.TARGET}
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a b/usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a
new file mode 100644
index 0000000..da5569b
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a
@@ -0,0 +1 @@
+I'm test file 1.
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a b/usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a
new file mode 100644
index 0000000..34f8508
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a
@@ -0,0 +1 @@
+I'm test file 2.
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1
new file mode 100644
index 0000000..3cd2129
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1
@@ -0,0 +1,2 @@
+cat TEST1.a TEST2.a >TEST1.b
+cat TEST1.a TEST2.a | diff -u - TEST1.b
diff --git a/usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh b/usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh
new file mode 100644
index 0000000..03cff93
--- /dev/null
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Source wildcard expansion (2)."
+
+# Setup
+TEST_COPY_FILES="TEST1.a 644 TEST2.a 644"
+
+# Reset
+TEST_CLEAN="TEST1.b"
+
+# Run
+TEST_N=1
+TEST_1="-r test1"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/syntax/Makefile b/usr.bin/bmake/tests/syntax/Makefile
new file mode 100644
index 0000000..3cd89f8
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax
+
+TESTS_SUBDIRS= directive-t0 enl funny-targets semi
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/syntax/Makefile.depend b/usr.bin/bmake/tests/syntax/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
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..d29b830
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/directive-t0
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/Makefile.depend b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/Makefile.test b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.test
new file mode 100644
index 0000000..0f95a21
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.test
@@ -0,0 +1,8 @@
+# $FreeBSD$
+#
+# A typo'ed directive.
+#
+
+.uudef foo
+
+all:
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/expected.status.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.status.1
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.status.1
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1
new file mode 100644
index 0000000..de66fcc
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1
@@ -0,0 +1,2 @@
+"Makefile", line 6: Unknown directive
+make: fatal errors encountered -- cannot continue
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh b/usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh
new file mode 100644
index 0000000..451c876
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="A typo'ed directive."
+
+# Run
+TEST_N=1
+TEST_1=
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/syntax/enl/Makefile b/usr.bin/bmake/tests/syntax/enl/Makefile
new file mode 100644
index 0000000..b41c752
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/enl
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.status.3
+${PACKAGE}FILES+= expected.status.4
+${PACKAGE}FILES+= expected.status.5
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stderr.3
+${PACKAGE}FILES+= expected.stderr.4
+${PACKAGE}FILES+= expected.stderr.5
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= expected.stdout.3
+${PACKAGE}FILES+= expected.stdout.4
+${PACKAGE}FILES+= expected.stdout.5
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/syntax/enl/Makefile.depend b/usr.bin/bmake/tests/syntax/enl/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/syntax/enl/Makefile.test b/usr.bin/bmake/tests/syntax/enl/Makefile.test
new file mode 100644
index 0000000..a7c6955
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/Makefile.test
@@ -0,0 +1,59 @@
+# $FreeBSD$
+#
+# Test handling of escaped newlines.
+#
+
+.ifmake test1
+
+# This should succeed
+\
+\
+\
+test1:
+ @echo ok
+
+.elifmake test2
+
+# This should print ok because the second assignment to foo is actually
+# a continued comment.
+FOO=ok
+#\
+\
+FOO=not ok
+test2:
+ @echo "${FOO}"
+
+.elifmake test3
+
+# Make sure an escaped newline inserts a space
+test3: a\
+b
+
+a:
+ @echo a
+
+b:
+ @echo b
+
+.elifmake test4
+
+# Make sure an escaped newline inserts exactly one space
+FOO=a\
+ b
+
+test4:
+ @echo "${FOO}"
+
+.elifmake test5
+
+# Make sure each escaped newline inserts exactly one space
+FOO=a\
+\
+\
+\
+b
+
+test5:
+ @echo "${FOO}"
+
+.endif
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.status.1 b/usr.bin/bmake/tests/syntax/enl/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.status.2 b/usr.bin/bmake/tests/syntax/enl/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.status.3 b/usr.bin/bmake/tests/syntax/enl/expected.status.3
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.3
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.status.4 b/usr.bin/bmake/tests/syntax/enl/expected.status.4
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.4
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.status.5 b/usr.bin/bmake/tests/syntax/enl/expected.status.5
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.5
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stderr.1 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.1
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stderr.2 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.2
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stderr.3 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.3
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stderr.4 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.4
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stderr.5 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.5
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stdout.1 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.1
new file mode 100644
index 0000000..9766475
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.1
@@ -0,0 +1 @@
+ok
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stdout.2 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.2
new file mode 100644
index 0000000..9766475
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.2
@@ -0,0 +1 @@
+ok
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stdout.3 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.3
new file mode 100644
index 0000000..422c2b7
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.3
@@ -0,0 +1,2 @@
+a
+b
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stdout.4 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.4
new file mode 100644
index 0000000..b2901ea
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.4
@@ -0,0 +1 @@
+a b
diff --git a/usr.bin/bmake/tests/syntax/enl/expected.stdout.5 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.5
new file mode 100644
index 0000000..5120076
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.5
@@ -0,0 +1 @@
+a b
diff --git a/usr.bin/bmake/tests/syntax/enl/legacy_test.sh b/usr.bin/bmake/tests/syntax/enl/legacy_test.sh
new file mode 100644
index 0000000..307c1f0
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/enl/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Test escaped new-lines handling."
+
+# Run
+TEST_N=5
+TEST_2_TODO="bug in parser"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/Makefile b/usr.bin/bmake/tests/syntax/funny-targets/Makefile
new file mode 100644
index 0000000..eae22ec
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/funny-targets
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/Makefile.depend b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/Makefile.test b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.test
new file mode 100644
index 0000000..064ab3a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.test
@@ -0,0 +1,14 @@
+# $FreeBSD$
+#
+# PR bin/6612 / GRN r102178
+#
+
+test1: colons::colons::target
+
+colons::colons::target:
+ @echo '${.TARGET}'
+
+test2: exclamation!target
+
+exclamation!target:
+ @echo '${.TARGET}
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.status.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.status.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1
new file mode 100644
index 0000000..09cb232
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1
@@ -0,0 +1 @@
+colons::colons::target
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2
new file mode 100644
index 0000000..b2f0364
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2
@@ -0,0 +1 @@
+exclamation!target
diff --git a/usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh b/usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh
new file mode 100644
index 0000000..e9cd317
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC='Target names with "funny" embeded characters.'
+
+# Run
+TEST_N=2
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/syntax/semi/Makefile b/usr.bin/bmake/tests/syntax/semi/Makefile
new file mode 100644
index 0000000..c48e175
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/semi
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/syntax/semi/Makefile.depend b/usr.bin/bmake/tests/syntax/semi/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/syntax/semi/Makefile.test b/usr.bin/bmake/tests/syntax/semi/Makefile.test
new file mode 100644
index 0000000..12f5225
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/Makefile.test
@@ -0,0 +1,26 @@
+# $FreeBSD$
+#
+# Test handling of escaped newlines.
+#
+
+.ifmake test1
+
+FOO=
+BAR=bar
+FOO != echo ${FOO} ; echo ${BAR}
+
+test1:
+ echo ${FOO}
+
+.endif
+
+.ifmake test2
+
+FOO=foo
+BAR=bar
+FOO != echo ${FOO} ; echo ${BAR}
+
+test2:
+ echo ${FOO}
+
+.endif
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.status.1 b/usr.bin/bmake/tests/syntax/semi/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.status.2 b/usr.bin/bmake/tests/syntax/semi/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.stderr.1 b/usr.bin/bmake/tests/syntax/semi/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stderr.1
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.stderr.2 b/usr.bin/bmake/tests/syntax/semi/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stderr.2
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.stdout.1 b/usr.bin/bmake/tests/syntax/semi/expected.stdout.1
new file mode 100644
index 0000000..12b9617
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stdout.1
@@ -0,0 +1,2 @@
+echo bar
+bar
diff --git a/usr.bin/bmake/tests/syntax/semi/expected.stdout.2 b/usr.bin/bmake/tests/syntax/semi/expected.stdout.2
new file mode 100644
index 0000000..be0fa55
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stdout.2
@@ -0,0 +1,2 @@
+echo foo bar
+foo bar
diff --git a/usr.bin/bmake/tests/syntax/semi/legacy_test.sh b/usr.bin/bmake/tests/syntax/semi/legacy_test.sh
new file mode 100644
index 0000000..092635a
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/semi/legacy_test.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Test semicolon handling."
+
+# Run
+TEST_N=2
+TEST_1_TODO="parser bug"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/sysmk/Makefile b/usr.bin/bmake/tests/sysmk/Makefile
new file mode 100644
index 0000000..90d90f1
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk
+
+TESTS_SUBDIRS= t0 t1 t2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/Makefile.depend b/usr.bin/bmake/tests/sysmk/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile
new file mode 100644
index 0000000..0522432
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/2/1
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.depend b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test
new file mode 100644
index 0000000..fc95f46
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test
@@ -0,0 +1,6 @@
+# $FreeBSD$
+#
+# Can we traverse up to / and find a 'mk/sys.mk'?
+#
+all:
+ @echo ${DASH_M_DOTDOTDOT}
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1
new file mode 100644
index 0000000..6f29307
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1
@@ -0,0 +1 @@
+Found_DotDotDot_sys_mk
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh
new file mode 100644
index 0000000..0214842
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../../../common.sh
+
+# Description
+DESC="Can we traverse up to / and find a 'mk/sys.mk'?"
+
+# Run
+TEST_N=1
+TEST_1="-m .../mk"
+TEST_MAKE_DIRS="../../mk 755"
+TEST_COPY_FILES="../../mk/sys.mk 644"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/Makefile b/usr.bin/bmake/tests/sysmk/t0/2/Makefile
new file mode 100644
index 0000000..2204807
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/2
+
+TESTS_SUBDIRS= 1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t0/2/Makefile.depend b/usr.bin/bmake/tests/sysmk/t0/2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t0/Makefile b/usr.bin/bmake/tests/sysmk/t0/Makefile
new file mode 100644
index 0000000..f38383c
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0
+
+TESTS_SUBDIRS= 2
+SUBDIR= mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t0/Makefile.depend b/usr.bin/bmake/tests/sysmk/t0/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t0/mk/Makefile b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile
new file mode 100644
index 0000000..ef40ab9
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/mk
+
+${PACKAGE}FILES+= sys.mk.test
+
+${PACKAGE}FILESNAME_sys.mk.test= sys.mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t0/mk/Makefile.depend b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test
new file mode 100644
index 0000000..60f1955
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+DASH_M_DOTDOTDOT=Found_DotDotDot_sys_mk
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile
new file mode 100644
index 0000000..eb01f5d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/2/1
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= cleanup
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile.depend b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/cleanup b/usr.bin/bmake/tests/sysmk/t1/2/1/cleanup
new file mode 100644
index 0000000..c3d58b7
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/cleanup
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+rm -rf ${WORK_DIR}/../../../t0/2/1
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1
new file mode 100644
index 0000000..6f29307
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1
@@ -0,0 +1 @@
+Found_DotDotDot_sys_mk
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh
new file mode 100644
index 0000000..fb73851
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../../../common.sh
+
+# Description
+DESC="Can we traverse up to / and find a 'mk/sys.mk' with -C -m?"
+
+# Run
+TEST_N=1
+TEST_1="-C ../../../t0/2/1 -m .../mk"
+TEST_MAKE_DIRS="../../mk 755 ../../../t0/mk 755 ../../../t0/2/1 755"
+TEST_COPY_FILES="../../mk/sys.mk 644 ../../../t0/mk/sys.mk 644 ../../../t0/2/1/Makefile.test 644"
+TEST_CLEAN_FILES="../../../t0/2/1"
+TEST_CLEANUP=clean-special
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/Makefile b/usr.bin/bmake/tests/sysmk/t1/2/Makefile
new file mode 100644
index 0000000..7c2e619
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/2
+
+TESTS_SUBDIRS= 1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t1/2/Makefile.depend b/usr.bin/bmake/tests/sysmk/t1/2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t1/Makefile b/usr.bin/bmake/tests/sysmk/t1/Makefile
new file mode 100644
index 0000000..4d32823
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1
+
+TESTS_SUBDIRS= 2
+SUBDIR= mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t1/Makefile.depend b/usr.bin/bmake/tests/sysmk/t1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t1/mk/Makefile b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile
new file mode 100644
index 0000000..dea788d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/mk
+
+${PACKAGE}FILES+= sys.mk.test
+
+${PACKAGE}FILESNAME_sys.mk.test= sys.mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t1/mk/Makefile.depend b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test
new file mode 100644
index 0000000..99b8ecc
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+DASH_M_DOTDOTDOT=Found_WRONG_DotDotDot_sys_mk__with_C_before_m
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile
new file mode 100644
index 0000000..36d0575
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/2/1
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= cleanup
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile.depend b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/cleanup b/usr.bin/bmake/tests/sysmk/t2/2/1/cleanup
new file mode 100644
index 0000000..c3d58b7
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/cleanup
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+rm -rf ${WORK_DIR}/../../../t0/2/1
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1
new file mode 100644
index 0000000..70f1be3
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1
@@ -0,0 +1 @@
+Found_DotDotDot_sys_mk__with_m_before_C
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh
new file mode 100644
index 0000000..ca817d8
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../../../common.sh
+
+# Description
+DESC="Can we traverse up to / and find a 'mk/sys.mk' with -m -C?"
+
+# Run
+TEST_N=1
+TEST_1="-m .../mk -C ../../../t0/2/1"
+TEST_MAKE_DIRS="../../mk 755 ../../../t0/mk 755 ../../../t0/2/1 755"
+TEST_COPY_FILES="../../mk/sys.mk 644 ../../../t0/mk/sys.mk 644 ../../../t0/2/1/Makefile.test 644"
+TEST_CLEAN_FILES="../../../t0/2/1"
+TEST_CLEANUP=clean-special
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/Makefile b/usr.bin/bmake/tests/sysmk/t2/2/Makefile
new file mode 100644
index 0000000..7d1c68e
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/2
+
+TESTS_SUBDIRS= 1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t2/2/Makefile.depend b/usr.bin/bmake/tests/sysmk/t2/2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t2/Makefile b/usr.bin/bmake/tests/sysmk/t2/Makefile
new file mode 100644
index 0000000..734c7d8
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2
+
+TESTS_SUBDIRS= 2
+SUBDIR= mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t2/Makefile.depend b/usr.bin/bmake/tests/sysmk/t2/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t2/mk/Makefile b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile
new file mode 100644
index 0000000..f35c07c
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/mk
+
+${PACKAGE}FILES+= sys.mk.test
+
+${PACKAGE}FILESNAME_sys.mk.test= sys.mk
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/sysmk/t2/mk/Makefile.depend b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test
new file mode 100644
index 0000000..55632fd
--- /dev/null
+++ b/usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+DASH_M_DOTDOTDOT=Found_DotDotDot_sys_mk__with_m_before_C
diff --git a/usr.bin/bmake/tests/test-new.mk b/usr.bin/bmake/tests/test-new.mk
new file mode 100644
index 0000000..f200833
--- /dev/null
+++ b/usr.bin/bmake/tests/test-new.mk
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+NEW_DIR!= make -C ${.CURDIR}/../../../../usr.bin/make -V .OBJDIR
+
+all:
+ rm -rf /tmp/${USER}.make.test
+ env MAKE_PROG=${NEW_DIR}/make ${.SHELL} ./all.sh
+
+.include <bsd.obj.mk>
diff --git a/usr.bin/bmake/tests/variables/Makefile b/usr.bin/bmake/tests/variables/Makefile
new file mode 100644
index 0000000..e010718
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables
+
+TESTS_SUBDIRS= modifier_M modifier_t opt_V t0
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/variables/Makefile.depend b/usr.bin/bmake/tests/variables/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
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..f4bd324
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/modifier_M
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/variables/modifier_M/Makefile.depend b/usr.bin/bmake/tests/variables/modifier_M/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/variables/modifier_M/Makefile.test b/usr.bin/bmake/tests/variables/modifier_M/Makefile.test
new file mode 100644
index 0000000..34d4cd4
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/Makefile.test
@@ -0,0 +1,18 @@
+# $FreeBSD$
+#
+# Test the M modifier.
+#
+FILES = \
+ main.c globals.h \
+ util.c util.h \
+ map.c map.h \
+ parser.y lexer.l \
+ cmdman.1 format.5
+test1:
+ @echo "all files: ${FILES}"
+ @echo "cfiles: ${FILES:M*.c}"
+ @echo "hfiles: ${FILES:M*.h}"
+ @echo "grammar and lexer: ${FILES:M*.[ly]}"
+ @echo "man page: ${FILES:M*.[1-9]}"
+ @echo "utility files: ${FILES:Mutil.?}"
+ @echo "m files: ${FILES:Mm*}"
diff --git a/usr.bin/bmake/tests/variables/modifier_M/expected.status.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1
diff --git a/usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1
new file mode 100644
index 0000000..b29e6df
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1
@@ -0,0 +1,7 @@
+all files: main.c globals.h util.c util.h map.c map.h parser.y lexer.l cmdman.1 format.5
+cfiles: main.c util.c map.c
+hfiles: globals.h util.h map.h
+grammar and lexer: parser.y lexer.l
+man page: cmdman.1 format.5
+utility files: util.c util.h
+m files: main.c map.c map.h
diff --git a/usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh b/usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh
new file mode 100644
index 0000000..6a3e68f
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Variable expansion with M modifier"
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/variables/modifier_t/Makefile b/usr.bin/bmake/tests/variables/modifier_t/Makefile
new file mode 100644
index 0000000..364ff11
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/modifier_t
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.status.3
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stderr.3
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+${PACKAGE}FILES+= expected.stdout.3
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/variables/modifier_t/Makefile.depend b/usr.bin/bmake/tests/variables/modifier_t/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/variables/modifier_t/Makefile.test b/usr.bin/bmake/tests/variables/modifier_t/Makefile.test
new file mode 100644
index 0000000..53844ee
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/Makefile.test
@@ -0,0 +1,15 @@
+# $FreeBSD$
+#
+# Test the t modifier.
+#
+# below is missing '
+ASCII= !"\#$$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+
+test1:
+ @echo '${ASCII}'
+
+test2:
+ @echo '${ASCII:tl}'
+
+test3:
+ @echo '${ASCII:tu}'
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.status.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.status.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.status.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.3
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.3
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1
new file mode 100644
index 0000000..dff38fd
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2
new file mode 100644
index 0000000..71a0f60
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
diff --git a/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3
new file mode 100644
index 0000000..6434c7b
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3
@@ -0,0 +1 @@
+!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~
diff --git a/usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh b/usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh
new file mode 100644
index 0000000..7f14571
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Variable expansion with t modifiers"
+
+# Run
+TEST_N=3
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/variables/opt_V/Makefile b/usr.bin/bmake/tests/variables/opt_V/Makefile
new file mode 100644
index 0000000..cd9cb51
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/opt_V
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.status.2
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stderr.2
+${PACKAGE}FILES+= expected.stdout.1
+${PACKAGE}FILES+= expected.stdout.2
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/variables/opt_V/Makefile.depend b/usr.bin/bmake/tests/variables/opt_V/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/variables/opt_V/Makefile.test b/usr.bin/bmake/tests/variables/opt_V/Makefile.test
new file mode 100644
index 0000000..128e511
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/Makefile.test
@@ -0,0 +1,15 @@
+# $FreeBSD$
+#
+# Test the -V option
+#
+
+FOO= foo
+FOOBAR= ${FOO}bar
+
+test1:
+ @echo "-V FOOBAR"
+ @${MAKE} -V FOOBAR
+
+test2:
+ @echo '-V "$${FOOBAR}"'
+ @${MAKE} -V '$${FOOBAR}'
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.status.1 b/usr.bin/bmake/tests/variables/opt_V/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.status.2 b/usr.bin/bmake/tests/variables/opt_V/expected.status.2
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.status.2
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.stderr.1 b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.1
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.stderr.2 b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.2
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.stdout.1 b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.1
new file mode 100644
index 0000000..050db40
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.1
@@ -0,0 +1,2 @@
+-V FOOBAR
+foobar
diff --git a/usr.bin/bmake/tests/variables/opt_V/expected.stdout.2 b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.2
new file mode 100644
index 0000000..4da2aef
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.2
@@ -0,0 +1,2 @@
+-V "${FOOBAR}"
+foobar
diff --git a/usr.bin/bmake/tests/variables/opt_V/legacy_test.sh b/usr.bin/bmake/tests/variables/opt_V/legacy_test.sh
new file mode 100644
index 0000000..4b1122a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/opt_V/legacy_test.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Variable expansion using command line '-V'"
+
+# Run
+TEST_N=2
+
+eval_cmd $*
diff --git a/usr.bin/bmake/tests/variables/t0/Makefile b/usr.bin/bmake/tests/variables/t0/Makefile
new file mode 100644
index 0000000..50a8ff7
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/t0
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= Makefile.test
+${PACKAGE}FILES+= expected.status.1
+${PACKAGE}FILES+= expected.stderr.1
+${PACKAGE}FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bmake/tests/variables/t0/Makefile.depend b/usr.bin/bmake/tests/variables/t0/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bmake/tests/variables/t0/Makefile.test b/usr.bin/bmake/tests/variables/t0/Makefile.test
new file mode 100644
index 0000000..1cc58ee
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/Makefile.test
@@ -0,0 +1,23 @@
+# $FreeBSD$
+#
+# A unsorted set of macro expansions. This should be sorted out.
+#
+A = 0
+AV = 1
+test1:
+ @echo $A
+ @echo ${AV}
+ @echo ${A}
+ @# The following are soo broken why no syntax error?
+ @echo $(
+ @echo $)
+ @echo ${
+ @echo ${A
+ @echo ${A)
+ @echo ${A){
+ @echo ${AV
+ @echo ${AV)
+ @echo ${AV){
+ @echo ${AV{
+ @echo ${A{
+ @echo $}
diff --git a/usr.bin/bmake/tests/variables/t0/expected.status.1 b/usr.bin/bmake/tests/variables/t0/expected.status.1
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/expected.status.1
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/bmake/tests/variables/t0/expected.stderr.1 b/usr.bin/bmake/tests/variables/t0/expected.stderr.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/expected.stderr.1
diff --git a/usr.bin/bmake/tests/variables/t0/expected.stdout.1 b/usr.bin/bmake/tests/variables/t0/expected.stdout.1
new file mode 100644
index 0000000..e2c70de
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/expected.stdout.1
@@ -0,0 +1,15 @@
+0
+1
+0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/usr.bin/bmake/tests/variables/t0/legacy_test.sh b/usr.bin/bmake/tests/variables/t0/legacy_test.sh
new file mode 100644
index 0000000..8c78e2d
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/t0/legacy_test.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+# $FreeBSD$
+
+. $(dirname $0)/../../common.sh
+
+# Description
+DESC="Variable expansion."
+
+eval_cmd $*
diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile
new file mode 100644
index 0000000..ced3aeb
--- /dev/null
+++ b/usr.bin/bmake/unit-tests/Makefile
@@ -0,0 +1,158 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H:H}
+
+# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $
+#
+# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $
+#
+# Unit tests for make(1)
+# The main targets are:
+#
+# all: run all the tests
+# test: run 'all', and compare to expected results
+# accept: move generated output to expected results
+#
+# Adding a test case.
+# Each feature should get its own set of tests in its own suitably
+# named makefile (*.mk), with its own set of expected results (*.exp),
+# and it should be added to the TESTNAMES list.
+#
+
+srcdir= ${SRCTOP}/contrib/bmake/unit-tests
+
+.MAIN: all
+
+UNIT_TESTS:= ${srcdir}
+.PATH: ${UNIT_TESTS}
+
+# Each test is in a sub-makefile.
+# Keep the list sorted.
+TESTNAMES= \
+ comment \
+ cond1 \
+ cond2 \
+ error \
+ export \
+ export-all \
+ export-env \
+ doterror \
+ dotwait \
+ forloop \
+ forsubst \
+ hash \
+ misc \
+ moderrs \
+ modmatch \
+ modmisc \
+ modorder \
+ modts \
+ modword \
+ order \
+ posix \
+ qequals \
+ sunshcmd \
+ sysv \
+ ternary \
+ unexport \
+ unexport-env \
+ varcmd \
+ varmisc \
+ varshell
+
+# these tests were broken by referting POSIX chanegs
+STRICT_POSIX_TESTS = \
+ escape \
+ impsrc \
+ phony-end \
+ posix1 \
+ suffixes
+
+# Override make flags for certain tests
+flags.doterror=
+flags.order=-j1
+
+OUTFILES= ${TESTNAMES:S/$/.out/}
+
+all: ${OUTFILES}
+
+CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
+CLEANFILES += obj*.[och] lib*.a # posix1.mk
+CLEANFILES += issue* .[ab]* # suffixes.mk
+CLEANRECURSIVE += dir dummy # posix1.mk
+
+clean:
+ rm -f ${CLEANFILES}
+.if !empty(CLEANRECURSIVE)
+ rm -rf ${CLEANRECURSIVE}
+.endif
+
+TEST_MAKE?= ${.MAKE}
+TOOL_SED?= sed
+TOOL_TR?= tr
+TOOL_DIFF?= diff
+DIFF_FLAGS?= -u
+
+.if defined(.PARSEDIR)
+# ensure consistent results from sort(1)
+LC_ALL= C
+LANG= C
+.export LANG LC_ALL
+.endif
+
+# some tests need extra post-processing
+SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
+ -e '/command/s,No such.*,not found,'
+
+# the tests are actually done with sub-makes.
+.SUFFIXES: .mk .rawout .out
+.mk.rawout:
+ @echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
+ -@cd ${.OBJDIR} && \
+ { ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
+ 2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
+ @mv ${.TARGET}.tmp ${.TARGET}
+
+# We always pretend .MAKE was called 'make'
+# and strip ${.CURDIR}/ from the output
+# and replace anything after 'stopped in' with unit-tests
+# so the results can be compared.
+.rawout.out:
+ @echo postprocess ${.TARGET}
+ @${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
+ -e 's,${TEST_MAKE:C/\./\\\./g},make,' \
+ -e '/stopped/s, /.*, unit-tests,' \
+ -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
+ -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
+ < ${.IMPSRC} > ${.TARGET}.tmp
+ @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
+ @mv ${.TARGET}.tmp ${.TARGET}
+
+# Compare all output files
+test: ${OUTFILES} .PHONY
+ @failed= ; \
+ for test in ${TESTNAMES}; do \
+ ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
+ || failed="$${failed}$${failed:+ }$${test}" ; \
+ done ; \
+ if [ -n "$${failed}" ]; then \
+ echo "Failed tests: $${failed}" ; false ; \
+ else \
+ echo "All tests passed" ; \
+ fi
+
+accept:
+ @for test in ${TESTNAMES}; do \
+ cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
+ || { echo "Replacing $${test}.exp" ; \
+ cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
+ done
+
+.if exists(${TEST_MAKE})
+${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
+.endif
+
+.sinclude <bsd.obj.mk>
diff --git a/usr.bin/brandelf/Makefile b/usr.bin/brandelf/Makefile
new file mode 100644
index 0000000..2c4859f
--- /dev/null
+++ b/usr.bin/brandelf/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= brandelf
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/brandelf/Makefile.depend b/usr.bin/brandelf/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/brandelf/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/brandelf/brandelf.1 b/usr.bin/brandelf/brandelf.1
new file mode 100644
index 0000000..309f467
--- /dev/null
+++ b/usr.bin/brandelf/brandelf.1
@@ -0,0 +1,104 @@
+.\" Copyright 1997 John-Mark Gurney. 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 March 25, 2014
+.Dt BRANDELF 1
+.Os
+.Sh NAME
+.Nm brandelf
+.Nd mark an ELF binary for a specific ABI
+.Sh SYNOPSIS
+.Nm
+.Op Fl lv
+.Op Fl f Ar ELF_ABI_number
+.Op Fl t Ar string
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility marks an ELF binary to be run under a certain ABI for
+.Fx .
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl f Ar ELF_ABI_number
+Forces branding with the supplied ELF ABI number.
+Incompatible with the
+.Fl t
+option.
+These values are assigned by SCO/USL.
+.It Fl l
+Writes the list of all known ELF types to the standard error.
+.It Fl v
+Turns on verbose output.
+.It Fl t Ar string
+Brands the given ELF binaries to be of the
+.Ar string
+ABI type.
+Currently supported ABIs are
+.Dq Li FreeBSD ,
+.Dq Li Linux ,
+and
+.Dq Li SVR4 .
+.It Ar file
+If
+.Fl t Ar string
+is given it will brand
+.Ar file
+to be of type
+.Ar string ,
+otherwise it will simply display the branding of
+.Ar file .
+.El
+.Sh EXIT STATUS
+Exit status is 0 on success, and 1 if the command
+fails if a file does not exist, is too short, fails to brand properly,
+or the brand requested is not one of the known types and the
+.Fl f
+option is not set.
+.Sh EXAMPLES
+The following is an example of a typical usage
+of the
+.Nm
+command:
+.Bd -literal -offset indent
+brandelf file
+brandelf -t Linux file
+.Ed
+.Sh SEE ALSO
+.Rs
+.%A The Santa Cruz Operation, Inc.
+.%T System V Application Binary Interface
+.%D April 29, 1998 (DRAFT)
+.%U http://www.sco.com/developer/devspecs/
+.Re
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+This manual page was written by
+.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .
diff --git a/usr.bin/brandelf/brandelf.c b/usr.bin/brandelf/brandelf.c
new file mode 100644
index 0000000..ce462e9
--- /dev/null
+++ b/usr.bin/brandelf/brandelf.c
@@ -0,0 +1,210 @@
+/*-
+ * Copyright (c) 2000, 2001 David O'Brien
+ * Copyright (c) 1996 Søren Schmidt
+ * 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.
+ * 3. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/elf_common.h>
+#include <sys/errno.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static int elftype(const char *);
+static const char *iselftype(int);
+static void printelftypes(void);
+static void usage(void);
+
+struct ELFtypes {
+ const char *str;
+ int value;
+};
+/* XXX - any more types? */
+static struct ELFtypes elftypes[] = {
+ { "FreeBSD", ELFOSABI_FREEBSD },
+ { "Linux", ELFOSABI_LINUX },
+ { "Solaris", ELFOSABI_SOLARIS },
+ { "SVR4", ELFOSABI_SYSV }
+};
+
+int
+main(int argc, char **argv)
+{
+
+ const char *strtype = "FreeBSD";
+ int type = ELFOSABI_FREEBSD;
+ int retval = 0;
+ int ch, change = 0, force = 0, listed = 0;
+
+ while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
+ switch (ch) {
+ case 'f':
+ if (change)
+ errx(1, "f option incompatible with t option");
+ force = 1;
+ type = atoi(optarg);
+ if (errno == ERANGE || type < 0 || type > 255) {
+ warnx("invalid argument to option f: %s",
+ optarg);
+ usage();
+ }
+ break;
+ case 'l':
+ printelftypes();
+ listed = 1;
+ break;
+ case 'v':
+ /* does nothing */
+ break;
+ case 't':
+ if (force)
+ errx(1, "t option incompatible with f option");
+ change = 1;
+ strtype = optarg;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+ if (!argc) {
+ if (listed)
+ exit(0);
+ else {
+ warnx("no file(s) specified");
+ usage();
+ }
+ }
+
+ if (!force && (type = elftype(strtype)) == -1) {
+ warnx("invalid ELF type '%s'", strtype);
+ printelftypes();
+ usage();
+ }
+
+ while (argc) {
+ int fd;
+ char buffer[EI_NIDENT];
+
+ if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
+ warn("error opening file %s", argv[0]);
+ retval = 1;
+ goto fail;
+ }
+ if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
+ warnx("file '%s' too short", argv[0]);
+ retval = 1;
+ goto fail;
+ }
+ if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 ||
+ buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) {
+ warnx("file '%s' is not ELF format", argv[0]);
+ retval = 1;
+ goto fail;
+ }
+ if (!change && !force) {
+ fprintf(stdout,
+ "File '%s' is of brand '%s' (%u).\n",
+ argv[0], iselftype(buffer[EI_OSABI]),
+ buffer[EI_OSABI]);
+ if (!iselftype(type)) {
+ warnx("ELF ABI Brand '%u' is unknown",
+ type);
+ printelftypes();
+ }
+ }
+ else {
+ buffer[EI_OSABI] = type;
+ lseek(fd, 0, SEEK_SET);
+ if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
+ warn("error writing %s %d", argv[0], fd);
+ retval = 1;
+ goto fail;
+ }
+ }
+fail:
+ close(fd);
+ argc--;
+ argv++;
+ }
+
+ return retval;
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n");
+ exit(1);
+}
+
+static const char *
+iselftype(int etype)
+{
+ size_t elfwalk;
+
+ for (elfwalk = 0;
+ elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+ elfwalk++)
+ if (etype == elftypes[elfwalk].value)
+ return elftypes[elfwalk].str;
+ return 0;
+}
+
+static int
+elftype(const char *elfstrtype)
+{
+ size_t elfwalk;
+
+ for (elfwalk = 0;
+ elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+ elfwalk++)
+ if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
+ return elftypes[elfwalk].value;
+ return -1;
+}
+
+static void
+printelftypes(void)
+{
+ size_t elfwalk;
+
+ fprintf(stderr, "known ELF types are: ");
+ for (elfwalk = 0;
+ elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+ elfwalk++)
+ fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
+ elftypes[elfwalk].value);
+ fprintf(stderr, "\n");
+}
diff --git a/usr.bin/bsdcat/Makefile b/usr.bin/bsdcat/Makefile
new file mode 100644
index 0000000..65099e5
--- /dev/null
+++ b/usr.bin/bsdcat/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+_LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
+_LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive
+
+PROG= bsdcat
+BSDCAT_VERSION_STRING= 3.2.1
+
+.PATH: ${_LIBARCHIVEDIR}/cat
+SRCS= bsdcat.c cmdline.c
+
+.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
+SRCS+= err.c
+
+CFLAGS+= -DBSDCAT_VERSION_STRING=\"${BSDCAT_VERSION_STRING}\"
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\"
+CFLAGS+= -I${_LIBARCHIVEDIR}/cat -I${_LIBARCHIVEDIR}/libarchive_fe
+
+LIBADD= archive
+
+.if ${MK_ICONV} != "no"
+CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
+.endif
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bsdcat/Makefile.depend b/usr.bin/bsdcat/Makefile.depend
new file mode 100644
index 0000000..4e7906b
--- /dev/null
+++ b/usr.bin/bsdcat/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bsdcat/tests/Makefile b/usr.bin/bsdcat/tests/Makefile
new file mode 100644
index 0000000..1fbaa9b
--- /dev/null
+++ b/usr.bin/bsdcat/tests/Makefile
@@ -0,0 +1,68 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
+
+ATF_TESTS_SH+= functional_test
+
+BINDIR= ${TESTSDIR}
+
+PROGS+= bsdcat_test
+
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+= -I${SRCTOP}/lib/libarchive -I${.OBJDIR}
+
+CFLAGS+= -I${.OBJDIR}
+CFLAGS+= -I${_LIBARCHIVEDIR}/cat -I${_LIBARCHIVEDIR}/libarchive_fe
+CFLAGS+= -I${_LIBARCHIVEDIR}/test_utils
+
+# Uncomment to link against dmalloc
+#LDADD+= -L/usr/local/lib -ldmalloc
+#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
+
+.PATH: ${_LIBARCHIVEDIR}/cat/test
+TESTS_SRCS= \
+ test_0.c \
+ test_empty_gz.c \
+ test_empty_lz4.c \
+ test_empty_xz.c \
+ test_error.c \
+ test_error_mixed.c \
+ test_expand_Z.c \
+ test_expand_bz2.c \
+ test_expand_gz.c \
+ test_expand_lz4.c \
+ test_expand_mixed.c \
+ test_expand_plain.c \
+ test_expand_xz.c \
+ test_help.c \
+ test_version.c
+
+SRCS.bsdcat_test= list.h \
+ ${TESTS_SRCS} \
+ main.c
+
+.PATH: ${_LIBARCHIVEDIR}/test_utils
+SRCS.bsdcat_test+= test_utils.c
+
+LIBADD.bsdcat_test= archive
+
+list.h: ${TESTS_SRCS} Makefile
+ @(cd ${_LIBARCHIVEDIR}/tar/test && \
+ grep -h DEFINE_TEST ${.ALLSRC:N*Makefile}) > ${.TARGET}.tmp
+ @mv ${.TARGET}.tmp ${.TARGET}
+
+CLEANFILES+= list.h list.h.tmp
+
+${PACKAGE}FILES+= test_empty.gz.uu
+${PACKAGE}FILES+= test_empty.lz4.uu
+${PACKAGE}FILES+= test_empty.xz.uu
+${PACKAGE}FILES+= test_expand.Z.uu
+${PACKAGE}FILES+= test_expand.bz2.uu
+${PACKAGE}FILES+= test_expand.gz.uu
+${PACKAGE}FILES+= test_expand.lz4.uu
+${PACKAGE}FILES+= test_expand.plain.uu
+${PACKAGE}FILES+= test_expand.xz.uu
+
+.include <bsd.test.mk>
diff --git a/usr.bin/bsdcat/tests/functional_test.sh b/usr.bin/bsdcat/tests/functional_test.sh
new file mode 100755
index 0000000..ae5307d
--- /dev/null
+++ b/usr.bin/bsdcat/tests/functional_test.sh
@@ -0,0 +1,56 @@
+#
+# Copyright 2015 EMC Corp.
+# 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.
+#
+# 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$
+
+SRCDIR=$(atf_get_srcdir)
+TESTER="${SRCDIR}/bsdcat_test"
+export BSDCAT=$(which bsdcat)
+
+check()
+{
+ local testcase=${1}; shift
+
+ # For some odd reason /bin/sh spuriously writes
+ # "write error on stdout" with some of the testcases
+ #
+ # Probably an issue with how they're written as it calls system(3) to
+ # clean up directories..
+ atf_check -e ignore -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}"
+}
+
+atf_init_test_cases()
+{
+ # Redirect stderr to stdout for the usage message because if you don't
+ # kyua list/kyua test will break:
+ # https://github.com/jmmv/kyua/issues/149
+ testcases=$(${TESTER} -h 2>&1 | awk 'p != 0 && $1 ~ /^[0-9]+:/ { print $NF } /Available tests:/ { p=1 }')
+ for testcase in ${testcases}; do
+ atf_test_case ${testcase}
+ eval "${testcase}_body() { check ${testcase}; }"
+ atf_add_test_case ${testcase}
+ done
+}
diff --git a/usr.bin/bsdiff/Makefile b/usr.bin/bsdiff/Makefile
new file mode 100644
index 0000000..8a8bc31
--- /dev/null
+++ b/usr.bin/bsdiff/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR= bsdiff bspatch
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/bsdiff/Makefile.inc b/usr.bin/bsdiff/Makefile.inc
new file mode 100644
index 0000000..265f86d
--- /dev/null
+++ b/usr.bin/bsdiff/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
diff --git a/usr.bin/bsdiff/bsdiff/Makefile b/usr.bin/bsdiff/bsdiff/Makefile
new file mode 100644
index 0000000..7569b4f
--- /dev/null
+++ b/usr.bin/bsdiff/bsdiff/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= bsdiff
+
+LIBADD= bz2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bsdiff/bsdiff/Makefile.depend b/usr.bin/bsdiff/bsdiff/Makefile.depend
new file mode 100644
index 0000000..36fe468
--- /dev/null
+++ b/usr.bin/bsdiff/bsdiff/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbz2 \
+ 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/bsdiff/bsdiff/bsdiff.1 b/usr.bin/bsdiff/bsdiff/bsdiff.1
new file mode 100644
index 0000000..bca199f
--- /dev/null
+++ b/usr.bin/bsdiff/bsdiff/bsdiff.1
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright 2003-2005 Colin Percival
+.\" All rights reserved
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted providing 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 ``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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 18, 2003
+.Dt BSDIFF 1
+.Os
+.Sh NAME
+.Nm bsdiff
+.Nd "generate a patch between two binary files"
+.Sh SYNOPSIS
+.Nm
+.Ar oldfile newfile patchfile
+.Sh DESCRIPTION
+The
+.Nm
+utility
+compares
+.Ar oldfile
+to
+.Ar newfile
+and writes to
+.Ar patchfile
+a binary patch suitable for use by
+.Xr bspatch 1 .
+When
+.Ar oldfile
+and
+.Ar newfile
+are two versions of an executable program, the
+patches produced are on average a factor of five smaller
+than those produced by any other binary patch tool known
+to the author.
+.Pp
+The
+.Nm
+utility
+uses memory equal to 17 times the size of
+.Ar oldfile ,
+and requires
+an absolute minimum working set size of 8 times the size of
+.Ar oldfile .
+.Sh SEE ALSO
+.Xr bspatch 1
+.Sh AUTHORS
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
+.Sh BUGS
+The
+.Nm
+utility does not store the hashes of
+.Ar oldfile
+or
+.Ar newfile
+in
+.Ar patchfile .
+As a result, it is possible to apply a patch to the wrong file; this
+will usually produce garbage.
+It is recommended that users of
+.Nm
+store the hashes of
+.Ar oldfile
+and
+.Ar newfile
+and compare against them before and after applying
+.Ar patchfile .
diff --git a/usr.bin/bsdiff/bsdiff/bsdiff.c b/usr.bin/bsdiff/bsdiff/bsdiff.c
new file mode 100644
index 0000000..e0b3ee7
--- /dev/null
+++ b/usr.bin/bsdiff/bsdiff/bsdiff.c
@@ -0,0 +1,436 @@
+/*-
+ * Copyright 2003-2005 Colin Percival
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted providing 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <bzlib.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#define MIN(x,y) (((x)<(y)) ? (x) : (y))
+
+static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h)
+{
+ off_t i,j,k,x,tmp,jj,kk;
+
+ if(len<16) {
+ for(k=start;k<start+len;k+=j) {
+ j=1;x=V[I[k]+h];
+ for(i=1;k+i<start+len;i++) {
+ if(V[I[k+i]+h]<x) {
+ x=V[I[k+i]+h];
+ j=0;
+ }
+ if(V[I[k+i]+h]==x) {
+ tmp=I[k+j];I[k+j]=I[k+i];I[k+i]=tmp;
+ j++;
+ }
+ }
+ for(i=0;i<j;i++) V[I[k+i]]=k+j-1;
+ if(j==1) I[k]=-1;
+ }
+ return;
+ }
+
+ x=V[I[start+len/2]+h];
+ jj=0;kk=0;
+ for(i=start;i<start+len;i++) {
+ if(V[I[i]+h]<x) jj++;
+ if(V[I[i]+h]==x) kk++;
+ }
+ jj+=start;kk+=jj;
+
+ i=start;j=0;k=0;
+ while(i<jj) {
+ if(V[I[i]+h]<x) {
+ i++;
+ } else if(V[I[i]+h]==x) {
+ tmp=I[i];I[i]=I[jj+j];I[jj+j]=tmp;
+ j++;
+ } else {
+ tmp=I[i];I[i]=I[kk+k];I[kk+k]=tmp;
+ k++;
+ }
+ }
+
+ while(jj+j<kk) {
+ if(V[I[jj+j]+h]==x) {
+ j++;
+ } else {
+ tmp=I[jj+j];I[jj+j]=I[kk+k];I[kk+k]=tmp;
+ k++;
+ }
+ }
+
+ if(jj>start) split(I,V,start,jj-start,h);
+
+ for(i=0;i<kk-jj;i++) V[I[jj+i]]=kk-1;
+ if(jj==kk-1) I[jj]=-1;
+
+ if(start+len>kk) split(I,V,kk,start+len-kk,h);
+}
+
+static void qsufsort(off_t *I,off_t *V,u_char *old,off_t oldsize)
+{
+ off_t buckets[256];
+ off_t i,h,len;
+
+ for(i=0;i<256;i++) buckets[i]=0;
+ for(i=0;i<oldsize;i++) buckets[old[i]]++;
+ for(i=1;i<256;i++) buckets[i]+=buckets[i-1];
+ for(i=255;i>0;i--) buckets[i]=buckets[i-1];
+ buckets[0]=0;
+
+ for(i=0;i<oldsize;i++) I[++buckets[old[i]]]=i;
+ I[0]=oldsize;
+ for(i=0;i<oldsize;i++) V[i]=buckets[old[i]];
+ V[oldsize]=0;
+ for(i=1;i<256;i++) if(buckets[i]==buckets[i-1]+1) I[buckets[i]]=-1;
+ I[0]=-1;
+
+ for(h=1;I[0]!=-(oldsize+1);h+=h) {
+ len=0;
+ for(i=0;i<oldsize+1;) {
+ if(I[i]<0) {
+ len-=I[i];
+ i-=I[i];
+ } else {
+ if(len) I[i-len]=-len;
+ len=V[I[i]]+1-i;
+ split(I,V,i,len,h);
+ i+=len;
+ len=0;
+ }
+ }
+ if(len) I[i-len]=-len;
+ }
+
+ for(i=0;i<oldsize+1;i++) I[V[i]]=i;
+}
+
+static off_t matchlen(u_char *old,off_t oldsize,u_char *new,off_t newsize)
+{
+ off_t i;
+
+ for(i=0;(i<oldsize)&&(i<newsize);i++)
+ if(old[i]!=new[i]) break;
+
+ return i;
+}
+
+static off_t search(off_t *I,u_char *old,off_t oldsize,
+ u_char *new,off_t newsize,off_t st,off_t en,off_t *pos)
+{
+ off_t x,y;
+
+ if(en-st<2) {
+ x=matchlen(old+I[st],oldsize-I[st],new,newsize);
+ y=matchlen(old+I[en],oldsize-I[en],new,newsize);
+
+ if(x>y) {
+ *pos=I[st];
+ return x;
+ } else {
+ *pos=I[en];
+ return y;
+ }
+ }
+
+ x=st+(en-st)/2;
+ if(memcmp(old+I[x],new,MIN(oldsize-I[x],newsize))<0) {
+ return search(I,old,oldsize,new,newsize,x,en,pos);
+ } else {
+ return search(I,old,oldsize,new,newsize,st,x,pos);
+ };
+}
+
+static void offtout(off_t x,u_char *buf)
+{
+ off_t y;
+
+ if(x<0) y=-x; else y=x;
+
+ buf[0]=y%256;y-=buf[0];
+ y=y/256;buf[1]=y%256;y-=buf[1];
+ y=y/256;buf[2]=y%256;y-=buf[2];
+ y=y/256;buf[3]=y%256;y-=buf[3];
+ y=y/256;buf[4]=y%256;y-=buf[4];
+ y=y/256;buf[5]=y%256;y-=buf[5];
+ y=y/256;buf[6]=y%256;y-=buf[6];
+ y=y/256;buf[7]=y%256;
+
+ if(x<0) buf[7]|=0x80;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: bsdiff oldfile newfile patchfile\n");
+ exit(1);
+}
+
+int main(int argc,char *argv[])
+{
+ int fd;
+ u_char *old,*new;
+ off_t oldsize,newsize;
+ off_t *I,*V;
+ off_t scan,pos,len;
+ off_t lastscan,lastpos,lastoffset;
+ off_t oldscore,scsc;
+ off_t s,Sf,lenf,Sb,lenb;
+ off_t overlap,Ss,lens;
+ off_t i;
+ off_t dblen,eblen;
+ u_char *db,*eb;
+ u_char buf[8];
+ u_char header[32];
+ FILE * pf;
+ BZFILE * pfbz2;
+ int bz2err;
+
+ if (argc != 4)
+ usage();
+
+ /* Allocate oldsize+1 bytes instead of oldsize bytes to ensure
+ that we never try to malloc(0) and get a NULL pointer */
+ if(((fd=open(argv[1],O_RDONLY|O_BINARY,0))<0) ||
+ ((oldsize=lseek(fd,0,SEEK_END))==-1))
+ err(1, "%s", argv[1]);
+
+ if (oldsize > SSIZE_MAX ||
+ (uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t) ||
+ oldsize == OFF_MAX) {
+ errno = EFBIG;
+ err(1, "%s", argv[1]);
+ }
+
+ if (((old=malloc(oldsize+1))==NULL) ||
+ (lseek(fd,0,SEEK_SET)!=0) ||
+ (read(fd,old,oldsize)!=oldsize) ||
+ (close(fd)==-1)) err(1,"%s",argv[1]);
+
+ if(((I=malloc((oldsize+1)*sizeof(off_t)))==NULL) ||
+ ((V=malloc((oldsize+1)*sizeof(off_t)))==NULL)) err(1,NULL);
+
+ qsufsort(I,V,old,oldsize);
+
+ free(V);
+
+ /* Allocate newsize+1 bytes instead of newsize bytes to ensure
+ that we never try to malloc(0) and get a NULL pointer */
+ if(((fd=open(argv[2],O_RDONLY|O_BINARY,0))<0) ||
+ ((newsize=lseek(fd,0,SEEK_END))==-1))
+ err(1, "%s", argv[2]);
+
+ if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX ||
+ newsize == OFF_MAX) {
+ errno = EFBIG;
+ err(1, "%s", argv[2]);
+ }
+
+ if (((new=malloc(newsize+1))==NULL) ||
+ (lseek(fd,0,SEEK_SET)!=0) ||
+ (read(fd,new,newsize)!=newsize) ||
+ (close(fd)==-1)) err(1,"%s",argv[2]);
+
+ if(((db=malloc(newsize+1))==NULL) ||
+ ((eb=malloc(newsize+1))==NULL)) err(1,NULL);
+ dblen=0;
+ eblen=0;
+
+ /* Create the patch file */
+ if ((pf = fopen(argv[3], "wb")) == NULL)
+ err(1, "%s", argv[3]);
+
+ /* Header is
+ 0 8 "BSDIFF40"
+ 8 8 length of bzip2ed ctrl block
+ 16 8 length of bzip2ed diff block
+ 24 8 length of new file */
+ /* File is
+ 0 32 Header
+ 32 ?? Bzip2ed ctrl block
+ ?? ?? Bzip2ed diff block
+ ?? ?? Bzip2ed extra block */
+ memcpy(header,"BSDIFF40",8);
+ offtout(0, header + 8);
+ offtout(0, header + 16);
+ offtout(newsize, header + 24);
+ if (fwrite(header, 32, 1, pf) != 1)
+ err(1, "fwrite(%s)", argv[3]);
+
+ /* Compute the differences, writing ctrl as we go */
+ if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
+ errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
+ scan=0;len=0;pos=0;
+ lastscan=0;lastpos=0;lastoffset=0;
+ while(scan<newsize) {
+ oldscore=0;
+
+ for(scsc=scan+=len;scan<newsize;scan++) {
+ len=search(I,old,oldsize,new+scan,newsize-scan,
+ 0,oldsize,&pos);
+
+ for(;scsc<scan+len;scsc++)
+ if((scsc+lastoffset<oldsize) &&
+ (old[scsc+lastoffset] == new[scsc]))
+ oldscore++;
+
+ if(((len==oldscore) && (len!=0)) ||
+ (len>oldscore+8)) break;
+
+ if((scan+lastoffset<oldsize) &&
+ (old[scan+lastoffset] == new[scan]))
+ oldscore--;
+ }
+
+ if((len!=oldscore) || (scan==newsize)) {
+ s=0;Sf=0;lenf=0;
+ for(i=0;(lastscan+i<scan)&&(lastpos+i<oldsize);) {
+ if(old[lastpos+i]==new[lastscan+i]) s++;
+ i++;
+ if(s*2-i>Sf*2-lenf) { Sf=s; lenf=i; }
+ }
+
+ lenb=0;
+ if(scan<newsize) {
+ s=0;Sb=0;
+ for(i=1;(scan>=lastscan+i)&&(pos>=i);i++) {
+ if(old[pos-i]==new[scan-i]) s++;
+ if(s*2-i>Sb*2-lenb) { Sb=s; lenb=i; }
+ }
+ }
+
+ if(lastscan+lenf>scan-lenb) {
+ overlap=(lastscan+lenf)-(scan-lenb);
+ s=0;Ss=0;lens=0;
+ for(i=0;i<overlap;i++) {
+ if(new[lastscan+lenf-overlap+i]==
+ old[lastpos+lenf-overlap+i]) s++;
+ if(new[scan-lenb+i]==
+ old[pos-lenb+i]) s--;
+ if(s>Ss) { Ss=s; lens=i+1; }
+ }
+
+ lenf+=lens-overlap;
+ lenb-=lens;
+ }
+
+ for(i=0;i<lenf;i++)
+ db[dblen+i]=new[lastscan+i]-old[lastpos+i];
+ for(i=0;i<(scan-lenb)-(lastscan+lenf);i++)
+ eb[eblen+i]=new[lastscan+lenf+i];
+
+ dblen+=lenf;
+ eblen+=(scan-lenb)-(lastscan+lenf);
+
+ offtout(lenf,buf);
+ BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
+
+ offtout((scan-lenb)-(lastscan+lenf),buf);
+ BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
+
+ offtout((pos-lenb)-(lastpos+lenf),buf);
+ BZ2_bzWrite(&bz2err, pfbz2, buf, 8);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
+
+ lastscan=scan-lenb;
+ lastpos=pos-lenb;
+ lastoffset=pos-scan;
+ }
+ }
+ BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
+
+ /* Compute size of compressed ctrl data */
+ if ((len = ftello(pf)) == -1)
+ err(1, "ftello");
+ offtout(len-32, header + 8);
+
+ /* Write compressed diff data */
+ if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
+ errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
+ BZ2_bzWrite(&bz2err, pfbz2, db, dblen);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
+ BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
+
+ /* Compute size of compressed diff data */
+ if ((newsize = ftello(pf)) == -1)
+ err(1, "ftello");
+ offtout(newsize - len, header + 16);
+
+ /* Write compressed extra data */
+ if ((pfbz2 = BZ2_bzWriteOpen(&bz2err, pf, 9, 0, 0)) == NULL)
+ errx(1, "BZ2_bzWriteOpen, bz2err = %d", bz2err);
+ BZ2_bzWrite(&bz2err, pfbz2, eb, eblen);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWrite, bz2err = %d", bz2err);
+ BZ2_bzWriteClose(&bz2err, pfbz2, 0, NULL, NULL);
+ if (bz2err != BZ_OK)
+ errx(1, "BZ2_bzWriteClose, bz2err = %d", bz2err);
+
+ /* Seek to the beginning, write the header, and close the file */
+ if (fseeko(pf, 0, SEEK_SET))
+ err(1, "fseeko");
+ if (fwrite(header, 32, 1, pf) != 1)
+ err(1, "fwrite(%s)", argv[3]);
+ if (fclose(pf))
+ err(1, "fclose");
+
+ /* Free the memory we used */
+ free(db);
+ free(eb);
+ free(I);
+ free(old);
+ free(new);
+
+ return 0;
+}
diff --git a/usr.bin/bsdiff/bspatch/Makefile b/usr.bin/bsdiff/bspatch/Makefile
new file mode 100644
index 0000000..c2d6d4e
--- /dev/null
+++ b/usr.bin/bsdiff/bspatch/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= bspatch
+
+LIBADD= bz2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bsdiff/bspatch/Makefile.depend b/usr.bin/bsdiff/bspatch/Makefile.depend
new file mode 100644
index 0000000..36fe468
--- /dev/null
+++ b/usr.bin/bsdiff/bspatch/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbz2 \
+ 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/bsdiff/bspatch/bspatch.1 b/usr.bin/bsdiff/bspatch/bspatch.1
new file mode 100644
index 0000000..edbfb19
--- /dev/null
+++ b/usr.bin/bsdiff/bspatch/bspatch.1
@@ -0,0 +1,86 @@
+.\"-
+.\" Copyright 2003-2005 Colin Percival
+.\" All rights reserved
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted providing 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 ``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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 18, 2003
+.Dt BSPATCH 1
+.Os
+.Sh NAME
+.Nm bspatch
+.Nd apply a patch built with
+.Xr bsdiff 1
+.Sh SYNOPSIS
+.Nm
+.Ar oldfile newfile patchfile
+.Sh DESCRIPTION
+The
+.Nm
+utility
+generates
+.Ar newfile
+from
+.Ar oldfile
+and
+.Ar patchfile
+where
+.Ar patchfile
+is a binary patch built by
+.Xr bsdiff 1 .
+.Pp
+The
+.Nm
+utility
+uses memory equal to the size of
+.Ar oldfile
+plus the size of
+.Ar newfile ,
+but can tolerate a very small working set without a dramatic loss
+of performance.
+.Sh SEE ALSO
+.Xr bsdiff 1
+.Sh AUTHORS
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
+.Sh BUGS
+The
+.Nm
+utility does not verify that
+.Ar oldfile
+is the correct source file for
+.Ar patchfile .
+Attempting to apply a patch to the wrong file will usually produce
+garbage; consequently it is strongly recommended that users of
+.Nm
+verify that
+.Ar oldfile
+matches the source file from which
+.Ar patchfile
+was built, by comparing cryptographic hashes, for example.
+Users may also wish to verify after running
+.Nm
+that
+.Ar newfile
+matches the target file from which
+.Ar was built.
diff --git a/usr.bin/bsdiff/bspatch/bspatch.c b/usr.bin/bsdiff/bspatch/bspatch.c
new file mode 100644
index 0000000..eb99e5b
--- /dev/null
+++ b/usr.bin/bsdiff/bspatch/bspatch.c
@@ -0,0 +1,216 @@
+/*-
+ * Copyright 2003-2005 Colin Percival
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted providing 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <bzlib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <err.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+static off_t offtin(u_char *buf)
+{
+ off_t y;
+
+ y=buf[7]&0x7F;
+ y=y*256;y+=buf[6];
+ y=y*256;y+=buf[5];
+ y=y*256;y+=buf[4];
+ y=y*256;y+=buf[3];
+ y=y*256;y+=buf[2];
+ y=y*256;y+=buf[1];
+ y=y*256;y+=buf[0];
+
+ if(buf[7]&0x80) y=-y;
+
+ return y;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: bspatch oldfile newfile patchfile\n");
+ exit(1);
+}
+
+int main(int argc,char * argv[])
+{
+ FILE * f, * cpf, * dpf, * epf;
+ BZFILE * cpfbz2, * dpfbz2, * epfbz2;
+ int cbz2err, dbz2err, ebz2err;
+ int fd;
+ ssize_t oldsize,newsize;
+ ssize_t bzctrllen,bzdatalen;
+ u_char header[32],buf[8];
+ u_char *old, *new;
+ off_t oldpos,newpos;
+ off_t ctrl[3];
+ off_t lenread;
+ off_t i;
+
+ if (argc != 4)
+ usage();
+
+ /* Open patch file */
+ if ((f = fopen(argv[3], "rb")) == NULL)
+ err(1, "fopen(%s)", argv[3]);
+
+ /*
+ File format:
+ 0 8 "BSDIFF40"
+ 8 8 X
+ 16 8 Y
+ 24 8 sizeof(newfile)
+ 32 X bzip2(control block)
+ 32+X Y bzip2(diff block)
+ 32+X+Y ??? bzip2(extra block)
+ with control block a set of triples (x,y,z) meaning "add x bytes
+ from oldfile to x bytes from the diff block; copy y bytes from the
+ extra block; seek forwards in oldfile by z bytes".
+ */
+
+ /* Read header */
+ if (fread(header, 1, 32, f) < 32) {
+ if (feof(f))
+ errx(1, "Corrupt patch\n");
+ err(1, "fread(%s)", argv[3]);
+ }
+
+ /* Check for appropriate magic */
+ if (memcmp(header, "BSDIFF40", 8) != 0)
+ errx(1, "Corrupt patch\n");
+
+ /* Read lengths from header */
+ bzctrllen=offtin(header+8);
+ bzdatalen=offtin(header+16);
+ newsize=offtin(header+24);
+ if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
+ errx(1,"Corrupt patch\n");
+
+ /* Close patch file and re-open it via libbzip2 at the right places */
+ if (fclose(f))
+ err(1, "fclose(%s)", argv[3]);
+ if ((cpf = fopen(argv[3], "rb")) == NULL)
+ err(1, "fopen(%s)", argv[3]);
+ if (fseeko(cpf, 32, SEEK_SET))
+ err(1, "fseeko(%s, %lld)", argv[3],
+ (long long)32);
+ if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL)
+ errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err);
+ if ((dpf = fopen(argv[3], "rb")) == NULL)
+ err(1, "fopen(%s)", argv[3]);
+ if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
+ err(1, "fseeko(%s, %lld)", argv[3],
+ (long long)(32 + bzctrllen));
+ if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL)
+ errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err);
+ if ((epf = fopen(argv[3], "rb")) == NULL)
+ err(1, "fopen(%s)", argv[3]);
+ if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
+ err(1, "fseeko(%s, %lld)", argv[3],
+ (long long)(32 + bzctrllen + bzdatalen));
+ if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL)
+ errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
+
+ if(((fd=open(argv[1],O_RDONLY|O_BINARY,0))<0) ||
+ ((oldsize=lseek(fd,0,SEEK_END))==-1) ||
+ ((old=malloc(oldsize+1))==NULL) ||
+ (lseek(fd,0,SEEK_SET)!=0) ||
+ (read(fd,old,oldsize)!=oldsize) ||
+ (close(fd)==-1)) err(1,"%s",argv[1]);
+ if((new=malloc(newsize+1))==NULL) err(1,NULL);
+
+ oldpos=0;newpos=0;
+ while(newpos<newsize) {
+ /* Read control data */
+ for(i=0;i<=2;i++) {
+ lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8);
+ if ((lenread < 8) || ((cbz2err != BZ_OK) &&
+ (cbz2err != BZ_STREAM_END)))
+ errx(1, "Corrupt patch\n");
+ ctrl[i]=offtin(buf);
+ }
+
+ /* Sanity-check */
+ if(newpos+ctrl[0]>newsize)
+ errx(1,"Corrupt patch\n");
+
+ /* Read diff string */
+ lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
+ if ((lenread < ctrl[0]) ||
+ ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
+ errx(1, "Corrupt patch\n");
+
+ /* Add old data to diff string */
+ for(i=0;i<ctrl[0];i++)
+ if((oldpos+i>=0) && (oldpos+i<oldsize))
+ new[newpos+i]+=old[oldpos+i];
+
+ /* Adjust pointers */
+ newpos+=ctrl[0];
+ oldpos+=ctrl[0];
+
+ /* Sanity-check */
+ if(newpos+ctrl[1]>newsize)
+ errx(1,"Corrupt patch\n");
+
+ /* Read extra string */
+ lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
+ if ((lenread < ctrl[1]) ||
+ ((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
+ errx(1, "Corrupt patch\n");
+
+ /* Adjust pointers */
+ newpos+=ctrl[1];
+ oldpos+=ctrl[2];
+ }
+
+ /* Clean up the bzip2 reads */
+ BZ2_bzReadClose(&cbz2err, cpfbz2);
+ BZ2_bzReadClose(&dbz2err, dpfbz2);
+ BZ2_bzReadClose(&ebz2err, epfbz2);
+ if (fclose(cpf) || fclose(dpf) || fclose(epf))
+ err(1, "fclose(%s)", argv[3]);
+
+ /* Write the new file */
+ if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666))<0) ||
+ (write(fd,new,newsize)!=newsize) || (close(fd)==-1))
+ err(1,"%s",argv[2]);
+
+ free(new);
+ free(old);
+
+ return 0;
+}
diff --git a/usr.bin/bzip2/Makefile b/usr.bin/bzip2/Makefile
new file mode 100644
index 0000000..5cb33b3
--- /dev/null
+++ b/usr.bin/bzip2/Makefile
@@ -0,0 +1,50 @@
+# $FreeBSD$
+
+BZ2DIR= ${.CURDIR}/../../contrib/bzip2
+.PATH: ${BZ2DIR}
+
+PROG= bzip2
+CFLAGS+= -D_FILE_OFFSET_BITS=64
+
+WARNS?= 3
+
+LIBADD= bz2
+
+LINKS= ${BINDIR}/bzip2 ${BINDIR}/bunzip2
+LINKS+= ${BINDIR}/bzip2 ${BINDIR}/bzcat
+MLINKS= bzip2.1 bunzip2.1 bzip2.1 bzcat.1
+
+REFFILES= sample1.ref sample2.ref sample3.ref
+DREFFILES= sample1.bz2 sample2.bz2 sample3.bz2
+TESTFILES= ${REFFILES} ${DREFFILES}
+
+CLEANFILES+= ${TESTFILES} \
+ sample1.rb2 sample2.rb2 sample3.rb2 \
+ sample1.tst sample2.tst sample3.tst
+
+.for f in ${REFFILES}
+${f}: ${f}.gz.uu
+ uudecode -p ${BZ2DIR}/${f}.gz.uu | gunzip > ${f}
+.endfor
+.for f in ${DREFFILES}
+${f}: ${f}.uu
+ uudecode ${BZ2DIR}/${f}.uu
+.endfor
+
+test: bzip2 ${TESTFILES}
+ @cat ${BZ2DIR}/words1
+ ./bzip2 -1 < sample1.ref > sample1.rb2
+ ./bzip2 -2 < sample2.ref > sample2.rb2
+ ./bzip2 -3 < sample3.ref > sample3.rb2
+ ./bzip2 -d < sample1.bz2 > sample1.tst
+ ./bzip2 -d < sample2.bz2 > sample2.tst
+ ./bzip2 -ds < sample3.bz2 > sample3.tst
+ cmp sample1.bz2 sample1.rb2
+ cmp sample2.bz2 sample2.rb2
+ cmp sample3.bz2 sample3.rb2
+ cmp sample1.tst sample1.ref
+ cmp sample2.tst sample2.ref
+ cmp sample3.tst sample3.ref
+ @cat ${BZ2DIR}/words3
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bzip2/Makefile.depend b/usr.bin/bzip2/Makefile.depend
new file mode 100644
index 0000000..509010f
--- /dev/null
+++ b/usr.bin/bzip2/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/bzip2recover/Makefile b/usr.bin/bzip2recover/Makefile
new file mode 100644
index 0000000..97b9615
--- /dev/null
+++ b/usr.bin/bzip2recover/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+BZ2DIR= ${.CURDIR}/../../contrib/bzip2
+.PATH: ${BZ2DIR}
+
+PROG= bzip2recover
+MAN=
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bzip2recover/Makefile.depend b/usr.bin/bzip2recover/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/bzip2recover/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/c89/Makefile b/usr.bin/c89/Makefile
new file mode 100644
index 0000000..1d9551c
--- /dev/null
+++ b/usr.bin/c89/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= c89
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/c89/Makefile.depend b/usr.bin/c89/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/c89/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/c89/c89.1 b/usr.bin/c89/c89.1
new file mode 100644
index 0000000..82acf37
--- /dev/null
+++ b/usr.bin/c89/c89.1
@@ -0,0 +1,184 @@
+.\"
+.\" Copyright (c) 1997 Joerg Wunsch
+.\"
+.\" 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 DEVELOPERS ``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 DEVELOPERS 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 September 17, 1997
+.Dt C89 1
+.Os
+.Sh NAME
+.Nm c89
+.Nd POSIX.2 C language compiler
+.Sh SYNOPSIS
+.Nm
+.Op Fl cEgOs
+.Oo Fl D Ar name Ns Oo = Ns Ar value Oc Oc ...
+.Oo Fl I Ar directory Oc ...
+.Oo Fl L Ar directory Oc ...
+.Op Fl o Ar outfile
+.Oo Fl U Ar name Oc ...
+.Ar operand ...
+.Sh DESCRIPTION
+This is the name of the C language compiler as required by the
+.St -p1003.2
+standard.
+.Pp
+The
+.Nm
+compiler accepts the following options:
+.Bl -tag -width indent
+.It Fl c
+Suppress the link-edit phase of the compilation, and do not remove any
+object files that are produced.
+.It Fl D Ar name Ns Op = Ns Ar value
+Define name as if by a C-language
+.Ic #define
+directive.
+If no
+.Dq = Ns Ar value
+is given, a value of 1 will be used.
+Note that in order to request a
+translation as specified by
+.St -p1003.2
+you need to define
+.Dv _POSIX_SOURCE
+either in the source or using this option.
+The
+.Fl D
+option has lower precedence than the
+.Fl U
+option.
+That is, if
+.Ar name
+is used in both a
+.Fl U
+and a
+.Fl D
+option,
+.Ar name
+will be undefined regardless of the order of the options.
+The
+.Fl D
+option may be specified more than once.
+.It Fl E
+Copy C-language source files to the standard output, expanding all
+preprocessor directives; no compilation will be performed.
+.It Fl g
+Produce symbolic information in the object or executable files.
+.It Fl I Ar directory
+Change the algorithm for searching for headers whose names are not
+absolute pathnames to look in the directory named by the
+.Ar directory
+pathname before looking in the usual places.
+Thus, headers whose
+names are enclosed in double-quotes
+.Pq Qq
+will be searched for first
+in the directory of the file with the
+.Ic #include
+line, then in
+directories named in
+.Fl I
+options, and last in the usual places.
+For headers whose names are enclosed in angle brackets
+.Pq Aq ,
+the header
+will be searched for only in directories named in
+.Fl I
+options and then in the usual places.
+Directories named in
+.Fl I
+options shall be searched in the order specified.
+The
+.Fl I
+option may be specified more than once.
+.It Fl L Ar directory
+Change the algorithm of searching for the libraries named in the
+.Fl l
+objects to look in the directory named by the
+.Ar directory
+pathname before looking in the usual places.
+Directories named in
+.Fl L
+options will be searched in the order specified.
+The
+.Fl L
+option may be specified more than once.
+.It Fl o Ar outfile
+Use the pathname
+.Ar outfile ,
+instead of the default
+.Pa a.out ,
+for the executable file produced.
+.It Fl O
+Optimize the compilation.
+.It Fl s
+Produce object and/or executable files from which symbolic and other
+information not required for proper execution has been removed
+(stripped).
+.It Fl U Ar name
+Remove any initial definition of
+.Ar name .
+The
+.Fl U
+option may be specified more than once.
+.El
+.Pp
+An operand is either in the form of a pathname or the form
+.Fl l
+library.
+At least one operand of the pathname form needs to be specified.
+Supported operands are of the form:
+.Bl -tag -offset indent -width ".Fl l Ar library"
+.It Ar file Ns Pa .c
+A C-language source file to be compiled and optionally linked.
+The operand must be of this form if the
+.Fl c
+option is used.
+.It Ar file Ns Pa .a
+A library of object files, as produced by
+.Xr ar 1 ,
+passed directly to the link editor.
+.It Ar file Ns Pa .o
+An object file produced by
+.Nm Fl c ,
+and passed directly to the link editor.
+.It Fl l Ar library
+Search the library named
+.Pa lib Ns Ar library Ns Pa .a .
+A library will be searched when its name is encountered, so the
+placement of a
+.Fl l
+operand is significant.
+.El
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr c99 1 ,
+.Xr cc 1
+.Sh STANDARDS
+The
+.Nm
+utility is believed to comply with
+.St -p1003.2 .
diff --git a/usr.bin/c89/c89.c b/usr.bin/c89/c89.c
new file mode 100644
index 0000000..930153f
--- /dev/null
+++ b/usr.bin/c89/c89.c
@@ -0,0 +1,111 @@
+/*-
+ * This is the Posix.2 mandated C compiler. Basically, a hook to the
+ * cc(1) command.
+ *
+ * Copyright (c) 2001 by Jens Schweikhardt
+ *
+ * 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 ``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 <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+
+#define CC "/usr/bin/cc" /* The big kahuna doing the actual work. */
+#define N_ARGS_PREPENDED (sizeof(args_prepended) / sizeof(args_prepended[0]))
+
+/*
+ * We do not add -D_POSIX_SOURCE here because any POSIX source is supposed to
+ * define it before inclusion of POSIX headers. This has the additional
+ * benefit of making c89 -D_ANSI_SOURCE do the right thing (or any other
+ * -D_FOO_SOURCE feature test macro we support.)
+ */
+static const char *args_prepended[] = {
+ "-std=iso9899:199409",
+ "-pedantic"
+};
+
+static void usage(void);
+
+/*
+ * Prepend the strings from args_prepended[] to the arg list; parse options,
+ * accepting only the POSIX c89 mandated options. Then exec cc to do the
+ * actual work.
+ */
+int
+main(int argc, char **argv)
+{
+ int Argc, i;
+ size_t j;
+ union {
+ const char **a;
+ char * const *b;
+ } Argv;
+
+ Argc = 0;
+ Argv.a = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv.a);
+ if (Argv.a == NULL)
+ err(1, "malloc");
+ Argv.a[Argc++] = CC;
+ for (j = 0; j < N_ARGS_PREPENDED; ++j)
+ Argv.a[Argc++] = args_prepended[j];
+ while ((i = getopt(argc, argv, "cD:EgI:l:L:o:OsU:")) != -1) {
+ if (i == '?')
+ usage();
+ if (i == 'l') {
+ if (argv[optind - 1][0] == '-') /* -llib */
+ optind -= 1;
+ else /* -l lib */
+ optind -= 2;
+ break; /* -llib or -l lib starts the operands. */
+ }
+ }
+ if (argc == optind) {
+ warnx("missing operand");
+ usage();
+ }
+
+ /* Append argv[1..] at the end of Argv[].a. */
+ for (i = 1; i <= argc; ++i)
+ Argv.a[Argc++] = argv[i];
+ (void)execv(CC, Argv.b);
+ err(1, "execv(" CC ")");
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+"usage: c89 [-cEgOs] [-D name[=value]] ... [-I directory] ... [-L directory] ...\n"
+" [-o outfile] [-U name] ... operand ...\n"
+"\n"
+" where operand is one or more of file.c, file.o, file.a\n"
+" or -llibrary\n");
+ exit(1);
+}
diff --git a/usr.bin/c99/Makefile b/usr.bin/c99/Makefile
new file mode 100644
index 0000000..580065f
--- /dev/null
+++ b/usr.bin/c99/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= c99
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/c99/Makefile.depend b/usr.bin/c99/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/c99/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/c99/c99.1 b/usr.bin/c99/c99.1
new file mode 100644
index 0000000..c993397
--- /dev/null
+++ b/usr.bin/c99/c99.1
@@ -0,0 +1,190 @@
+.\"
+.\" Copyright (c) 1997 Joerg Wunsch
+.\"
+.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
+.\"
+.\" From FreeBSD: src/usr.bin/c89/c89.1,v 1.11 2007/03/10 07:10:01 ru Exp
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2015
+.Dt C99 1
+.Os
+.Sh NAME
+.Nm c99
+.Nd standard C language compiler
+.Sh SYNOPSIS
+.Nm
+.Op Fl cEgs
+.Oo Fl D Ar name Ns Oo = Ns Ar value Oc Oc ...
+.Oo Fl I Ar directory Oc ...
+.Oo Fl L Ar directory Oc ...
+.Op Fl o Ar outfile
+.Op Fl O Ar optlevel
+.Oo Fl U Ar name Oc ...
+.Ar operand ...
+.Sh DESCRIPTION
+This is the name of the C language compiler as required by the
+.St -p1003.1-2001
+standard.
+.Pp
+The
+.Nm
+compiler accepts the following options:
+.Bl -tag -width indent
+.It Fl c
+Suppress the link-edit phase of the compilation, and do not remove any
+object files that are produced.
+.It Fl D Ar name Ns Op = Ns Ar value
+Define name as if by a C-language
+.Ic #define
+directive.
+If no
+.Dq = Ns Ar value
+is given, a value of 1 will be used.
+Note that in order to request a
+translation as specified by
+.St -p1003.1-2001 ,
+you need to define
+.Dv _POSIX_C_SOURCE=200112L
+either in the source or using this option.
+The
+.Fl D
+option has lower precedence than the
+.Fl U
+option.
+That is, if
+.Ar name
+is used in both a
+.Fl U
+and a
+.Fl D
+option,
+.Ar name
+will be undefined regardless of the order of the options.
+The
+.Fl D
+option may be specified more than once.
+.It Fl E
+Copy C-language source files to the standard output, expanding all
+preprocessor directives; no compilation will be performed.
+.It Fl g
+Produce symbolic information in the object or executable files.
+.It Fl I Ar directory
+Change the algorithm for searching for headers whose names are not
+absolute pathnames to look in the directory named by the
+.Ar directory
+pathname before looking in the usual places.
+Thus, headers whose
+names are enclosed in double-quotes
+.Pq Qq
+will be searched for first
+in the directory of the file with the
+.Ic #include
+line, then in
+directories named in
+.Fl I
+options, and last in the usual places.
+For headers whose names are enclosed in angle brackets
+.Pq Aq ,
+the header
+will be searched for only in directories named in
+.Fl I
+options and then in the usual places.
+Directories named in
+.Fl I
+options shall be searched in the order specified.
+The
+.Fl I
+option may be specified more than once.
+.It Fl L Ar directory
+Change the algorithm of searching for the libraries named in the
+.Fl l
+objects to look in the directory named by the
+.Ar directory
+pathname before looking in the usual places.
+Directories named in
+.Fl L
+options will be searched in the order specified.
+The
+.Fl L
+option may be specified more than once.
+.It Fl o Ar outfile
+Use the pathname
+.Ar outfile ,
+instead of the default
+.Pa a.out ,
+for the executable file produced.
+.It Fl O Ar optlevel
+If
+.Ar optlevel
+is zero, disable all optimizations.
+Otherwise, enable optimizations at the specified level.
+.It Fl s
+Produce object and/or executable files from which symbolic and other
+information not required for proper execution has been removed
+(stripped).
+.It Fl U Ar name
+Remove any initial definition of
+.Ar name .
+The
+.Fl U
+option may be specified more than once.
+.El
+.Pp
+An operand is either in the form of a pathname or the form
+.Fl l
+library.
+At least one operand of the pathname form needs to be specified.
+Supported operands are of the form:
+.Bl -tag -offset indent -width ".Fl l Ar library"
+.It Ar file Ns Pa .c
+A C-language source file to be compiled and optionally linked.
+The operand must be of this form if the
+.Fl c
+option is used.
+.It Ar file Ns Pa .a
+A library of object files, as produced by
+.Xr ar 1 ,
+passed directly to the link editor.
+.It Ar file Ns Pa .o
+An object file produced by
+.Nm Fl c ,
+and passed directly to the link editor.
+.It Fl l Ar library
+Search the library named
+.Pa lib Ns Ar library Ns Pa .a .
+A library will be searched when its name is encountered, so the
+placement of a
+.Fl l
+operand is significant.
+.El
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr c89 1 ,
+.Xr cc 1 ,
+.Xr c99 7
+.Sh STANDARDS
+The
+.Nm
+utility interface conforms to
+.St -p1003.1-2001 .
diff --git a/usr.bin/c99/c99.c b/usr.bin/c99/c99.c
new file mode 100644
index 0000000..79cca89
--- /dev/null
+++ b/usr.bin/c99/c99.c
@@ -0,0 +1,133 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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.
+ */
+
+/*
+ * c99 -- compile standard C programs
+ *
+ * This is essentially a wrapper around the system C compiler that forces
+ * the compiler into C99 mode and handles some of the standard libraries
+ * specially.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static char **args;
+static u_int cargs, nargs;
+
+static void addarg(const char *);
+static void addlib(const char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int ch, i;
+
+ args = NULL;
+ cargs = nargs = 0;
+
+ while ((ch = getopt(argc, argv, "cD:EgI:L:o:O:sU:l:")) != -1) {
+ if (ch == 'l') {
+ /* Gone too far. Back up and get out. */
+ if (argv[optind - 1][0] == '-')
+ optind -= 1;
+ else
+ optind -= 2;
+ break;
+ } else if (ch == '?')
+ usage();
+ }
+
+ addarg("/usr/bin/cc");
+ addarg("-std=iso9899:1999");
+ addarg("-pedantic");
+ for (i = 1; i < optind; i++)
+ addarg(argv[i]);
+ while (i < argc) {
+ if (strncmp(argv[i], "-l", 2) == 0) {
+ if (argv[i][2] != '\0')
+ addlib(argv[i++] + 2);
+ else {
+ if (argv[++i] == NULL)
+ usage();
+ addlib(argv[i++]);
+ }
+ } else
+ addarg(argv[i++]);
+ }
+ execv("/usr/bin/cc", args);
+ err(1, "/usr/bin/cc");
+}
+
+static void
+addarg(const char *item)
+{
+ if (nargs + 1 >= cargs) {
+ cargs += 16;
+ if ((args = realloc(args, sizeof(*args) * cargs)) == NULL)
+ err(1, "malloc");
+ }
+ if ((args[nargs++] = strdup(item)) == NULL)
+ err(1, "strdup");
+ args[nargs] = NULL;
+}
+
+static void
+addlib(const char *lib)
+{
+
+ if (strcmp(lib, "pthread") == 0)
+ /* FreeBSD's gcc uses -pthread instead of -lpthread. */
+ addarg("-pthread");
+ else if (strcmp(lib, "rt") == 0)
+ /* librt functionality is in libc or unimplemented. */
+ ;
+ else if (strcmp(lib, "xnet") == 0)
+ /* xnet functionality is in libc. */
+ ;
+ else {
+ addarg("-l");
+ addarg(lib);
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n",
+"usage: c99 [-cEgs] [-D name[=value]] ... [-I directory] ... [-L directory] ...",
+" [-o outfile] [-O optlevel] [-U name] ... operand ...");
+ exit(1);
+}
diff --git a/usr.bin/caesar/Makefile b/usr.bin/caesar/Makefile
new file mode 100644
index 0000000..2ad96b7
--- /dev/null
+++ b/usr.bin/caesar/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= caesar
+LIBADD= m
+SCRIPTS=rot13.sh
+MAN= caesar.6
+MLINKS= caesar.6 rot13.6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/caesar/Makefile.depend b/usr.bin/caesar/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/caesar/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/caesar/caesar.6 b/usr.bin/caesar/caesar.6
new file mode 100644
index 0000000..91e9af8
--- /dev/null
+++ b/usr.bin/caesar/caesar.6
@@ -0,0 +1,73 @@
+.\" Copyright (c) 1989, 1991, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)caesar.6 8.2 (Berkeley) 11/16/93
+.\" $FreeBSD$
+.\"
+.Dd November 16, 1993
+.Dt CAESAR 6
+.Os
+.Sh NAME
+.Nm caesar , rot13
+.Nd decrypt caesar ciphers
+.Sh SYNOPSIS
+.Nm
+.Op Ar rotation
+.Nm rot13
+.Sh DESCRIPTION
+The
+.Nm
+utility attempts to decrypt caesar ciphers using English letter frequency
+statistics.
+.Nm Caesar
+reads from the standard input and writes to the standard output.
+.Pp
+The optional numerical argument
+.Ar rotation
+may be used to specify a specific rotation value.
+If invoked as
+.Nm rot13 ,
+a rotation value of 13 will be used.
+.Pp
+The frequency (from most common to least) of English letters is as follows:
+.Bd -ragged -offset indent
+ETAONRISHDLFCMUGPYWBVKXJQZ
+.Ed
+.Pp
+Their frequencies as a percentage are as follows:
+.Bd -ragged -offset indent
+E(13), T(10.5), A(8.1), O(7.9), N(7.1), R(6.8), I(6.3), S(6.1), H(5.2),
+D(3.8), L(3.4), F(2.9), C(2.7), M(2.5), U(2.4), G(2),
+P(1.9), Y(1.9),
+W(1.5), B(1.4), V(.9), K(.4), X(.15), J(.13), Q(.11), Z(.07).
+.Ed
+.Pp
+Rotated postings to
+.Tn USENET
+and some of the databases used by the
+.Xr fortune 6
+program are rotated by 13 characters.
diff --git a/usr.bin/caesar/caesar.c b/usr.bin/caesar/caesar.c
new file mode 100644
index 0000000..b1f9920
--- /dev/null
+++ b/usr.bin/caesar/caesar.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Adams.
+ *
+ * Authors:
+ * Stan King, John Eldridge, based on algorithm suggested by
+ * Bob Morris
+ * 29-Sep-82
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <errno.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#define LINELENGTH 2048
+#define ROTATE(ch, perm) \
+ isascii(ch) ? ( \
+ isupper(ch) ? ('A' + (ch - 'A' + perm) % 26) : \
+ islower(ch) ? ('a' + (ch - 'a' + perm) % 26) : ch) : ch
+
+/*
+ * letter frequencies (taken from some unix(tm) documentation)
+ * (unix is a trademark of Bell Laboratories)
+ */
+static double stdf[26] = {
+ 7.97, 1.35, 3.61, 4.78, 12.37, 2.01, 1.46, 4.49, 6.39, 0.04,
+ 0.42, 3.81, 2.69, 5.92, 6.96, 2.91, 0.08, 6.63, 8.77, 9.68,
+ 2.62, 0.81, 1.88, 0.23, 2.07, 0.06,
+};
+
+static void printit(char *);
+
+int
+main(int argc, char **argv)
+{
+ int ch, dot, i, nread, winnerdot = 0;
+ char *inbuf;
+ int obs[26], try, winner;
+
+ if (argc > 1)
+ printit(argv[1]);
+
+ if (!(inbuf = malloc((size_t)LINELENGTH))) {
+ (void)fprintf(stderr, "caesar: out of memory.\n");
+ exit(1);
+ }
+
+ /* adjust frequency table to weight low probs REAL low */
+ for (i = 0; i < 26; ++i)
+ stdf[i] = log(stdf[i]) + log(26.0 / 100.0);
+
+ /* zero out observation table */
+ bzero(obs, 26 * sizeof(int));
+
+ if ((nread = read(STDIN_FILENO, inbuf, (size_t)LINELENGTH)) < 0) {
+ (void)fprintf(stderr, "caesar: %s\n", strerror(errno));
+ exit(1);
+ }
+ for (i = nread; i--;) {
+ ch = (unsigned char) inbuf[i];
+ if (isascii(ch)) {
+ if (islower(ch))
+ ++obs[ch - 'a'];
+ else if (isupper(ch))
+ ++obs[ch - 'A'];
+ }
+ }
+
+ /*
+ * now "dot" the freqs with the observed letter freqs
+ * and keep track of best fit
+ */
+ for (try = winner = 0; try < 26; ++try) { /* += 13) { */
+ dot = 0;
+ for (i = 0; i < 26; i++)
+ dot += obs[i] * stdf[(i + try) % 26];
+ /* initialize winning score */
+ if (try == 0)
+ winnerdot = dot;
+ if (dot > winnerdot) {
+ /* got a new winner! */
+ winner = try;
+ winnerdot = dot;
+ }
+ }
+
+ for (;;) {
+ for (i = 0; i < nread; ++i) {
+ ch = (unsigned char) inbuf[i];
+ putchar(ROTATE(ch, winner));
+ }
+ if (nread < LINELENGTH)
+ break;
+ if ((nread = read(STDIN_FILENO, inbuf, (size_t)LINELENGTH)) < 0) {
+ (void)fprintf(stderr, "caesar: %s\n", strerror(errno));
+ exit(1);
+ }
+ }
+ exit(0);
+}
+
+static void
+printit(char *arg)
+{
+ int ch, rot;
+
+ if ((rot = atoi(arg)) < 0) {
+ (void)fprintf(stderr, "caesar: bad rotation value.\n");
+ exit(1);
+ }
+ while ((ch = getchar()) != EOF)
+ putchar(ROTATE(ch, rot));
+ exit(0);
+}
diff --git a/usr.bin/caesar/rot13.sh b/usr.bin/caesar/rot13.sh
new file mode 100644
index 0000000..7dcef74
--- /dev/null
+++ b/usr.bin/caesar/rot13.sh
@@ -0,0 +1,33 @@
+#!/bin/sh -
+#
+# Copyright (c) 1992, 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.
+# 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.
+#
+# 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.
+#
+# @(#)rot13.sh 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+exec /usr/bin/caesar 13 "$@"
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile
new file mode 100644
index 0000000..5e8ba88
--- /dev/null
+++ b/usr.bin/calendar/Makefile
@@ -0,0 +1,38 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= calendar
+SRCS= calendar.c locale.c events.c dates.c parsedata.c io.c day.c \
+ ostern.c paskha.c pom.c sunpos.c
+LIBADD= m
+INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \
+ hr_HR.ISO8859-2 hu_HU.ISO8859-2 pt_BR.ISO8859-1 \
+ pt_BR.UTF-8 ru_RU.KOI8-R ru_RU.UTF-8 uk_UA.KOI8-U
+DE_LINKS= de_DE.ISO8859-15
+FR_LINKS= fr_FR.ISO8859-15
+TEXTMODE?= 444
+
+beforeinstall:
+ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
+ ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
+.for lang in ${INTER}
+ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
+ ${.CURDIR}/calendars/${lang}/calendar.* \
+ ${DESTDIR}${SHAREDIR}/calendar/${lang}
+.endfor
+.for link in ${DE_LINKS}
+ rm -rf ${DESTDIR}${SHAREDIR}/calendar/${link}
+ ln -s de_DE.ISO8859-1 ${DESTDIR}${SHAREDIR}/calendar/${link}
+.endfor
+.for link in ${FR_LINKS}
+ rm -rf ${DESTDIR}${SHAREDIR}/calendar/${link}
+ ln -s fr_FR.ISO8859-1 ${DESTDIR}${SHAREDIR}/calendar/${link}
+.endfor
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/calendar/Makefile.depend b/usr.bin/calendar/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/calendar/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/calendar/calendar.1 b/usr.bin/calendar/calendar.1
new file mode 100644
index 0000000..374fbef
--- /dev/null
+++ b/usr.bin/calendar/calendar.1
@@ -0,0 +1,334 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" @(#)calendar.1 8.1 (Berkeley) 6/29/93
+.\" $FreeBSD$
+.\"
+.Dd April 6, 2013
+.Dt CALENDAR 1
+.Os
+.Sh NAME
+.Nm calendar
+.Nd reminder service
+.Sh SYNOPSIS
+.Nm
+.Op Fl A Ar num
+.Op Fl a
+.Op Fl B Ar num
+.Op Fl D Ar moon|sun
+.Op Fl d
+.Op Fl F Ar friday
+.Op Fl f Ar calendarfile
+.Op Fl l Ar longitude
+.Oo
+.Bk -words
+.Fl t Ar dd Ns
+.Sm off
+.Op . Ar mm Op . Ar year
+.Sm on
+.Ek
+.Oc
+.Op Fl U Ar UTC-offset
+.Op Fl W Ar num
+.Sh DESCRIPTION
+The
+.Nm
+utility checks the current directory for a file named
+.Pa calendar
+and displays lines that fall into the specified date range.
+On the day before a weekend (normally Friday), events for the next
+three days are displayed.
+.Pp
+The following options are available:
+.Bl -tag -width Ds
+.It Fl A Ar num
+Print lines from today and the next
+.Ar num
+days (forward, future).
+.It Fl a
+Process the ``calendar'' files of all users and mail the results
+to them.
+This requires super-user privileges.
+.It Fl B Ar num
+Print lines from today and the previous
+.Ar num
+days (backward, past).
+.It Fl D Ar moon|sun
+Print UTC offset, longitude and moon or sun information.
+.It Fl d
+Debug option: print current date information.
+.It Fl F Ar friday
+Specify which day of the week is ``Friday'' (the day before the
+weekend begins).
+Default is 5.
+.It Fl f Pa calendarfile
+Use
+.Pa calendarfile
+as the default calendar file.
+.It Fl l Ar longitude
+Perform lunar and solar calculations from this longitude.
+If neither longitude nor UTC offset is specified, the calculations will
+be based on the difference between UTC time and localtime.
+If both are specified, UTC offset overrides longitude.
+.It Xo Fl t
+.Sm off
+.Ar dd
+.Op . Ar mm Op . Ar year
+.Sm on
+.Xc
+For test purposes only: set date directly to argument values.
+.It Fl U Ar UTC-offset
+Perform lunar and solar calculations from this UTC offset.
+If neither UTC offset nor longitude is specified, the calculations
+will be based on the difference between UTC time and localtime.
+If both are specified, UTC offset overrides longitude.
+.It Fl W Ar num
+Print lines from today and the next
+.Ar num
+days (forward, future).
+Ignore weekends when calculating the number of days.
+.El
+.Sh FILE FORMAT
+To handle calendars in your national code table you can specify
+.Dq LANG=<locale_name>
+in the calendar file as early as possible.
+.Pp
+To handle the local name of sequences, you can specify them as:
+.Dq SEQUENCE=<first> <second> <third> <fourth> <fifth> <last>
+in the calendar file as early as possible.
+.Pp
+The names of the following special days are recognized:
+.Bl -tag -width 123456789012345 -compact
+.It Easter
+Catholic Easter.
+.It Paskha
+Orthodox Easter.
+.It NewMoon
+The lunar New Moon.
+.It FullMoon
+The lunar Full Moon.
+.It MarEquinox
+The solar equinox in March.
+.It JunSolstice
+The solar solstice in June.
+.It SepEquinox
+The solar equinox in September.
+.It DecSolstice
+The solar solstice in December.
+.It ChineseNewYear
+The first day of the Chinese year.
+.El
+These names may be reassigned to their local names via an assignment
+like
+.Dq Easter=Pasen
+in the calendar file.
+.Pp
+Other lines should begin with a month and day.
+They may be entered in almost any format, either numeric or as character
+strings.
+If the proper locale is set, national month and weekday
+names can be used.
+A single asterisk (``*'') matches every month.
+A day without a month matches that day of every week.
+A month without a day matches the first of that month.
+Two numbers default to the month followed by the day.
+Lines with leading tabs default to the last entered date, allowing
+multiple line specifications for a single date.
+.Pp
+The names of the recognized special days may be followed by a
+positive or negative integer, like:
+.Dq Easter+3
+or
+.Dq Paskha-4 .
+.Pp
+Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for
+last, first, second, third, fourth) for moving events like
+``the last Monday in April''.
+.Pp
+By convention, dates followed by an asterisk are not fixed, i.e., change
+from year to year.
+.Pp
+Day descriptions start after the first <tab> character in the line;
+if the line does not contain a <tab> character, it is not displayed.
+If the first character in the line is a <tab> character, it is treated as
+a continuation of the previous line.
+.Pp
+The
+.Nm
+file is preprocessed by a limited subset of
+.Xr cpp 1
+internally, allowing the inclusion of shared files such as
+lists of company holidays or meetings.
+This limited subset consists of \fB#include #ifndef #endif\fR and \fB#define\fR.
+If the shared file is not referenced by a full pathname,
+.Xr calendar 1
+searches in the current (or home) directory first, and then in the
+directory
+.Pa /usr/share/calendar .
+Empty lines and lines protected by the C commenting syntax
+.Pq Li /* ... */
+are ignored.
+.Pp
+Some possible calendar entries (<tab> characters highlighted by
+\fB\et\fR sequence)
+.Bd -unfilled -offset indent
+LANG=C
+Easter=Ostern
+
+#include <calendar.usholiday>
+#include <calendar.birthday>
+
+6/15\fB\et\fRJune 15 (if ambiguous, will default to month/day).
+Jun. 15\fB\et\fRJune 15.
+15 June\fB\et\fRJune 15.
+Thursday\fB\et\fREvery Thursday.
+June\fB\et\fREvery June 1st.
+15 *\fB\et\fR15th of every month.
+2010/4/15\fB\et\fR15 April 2010
+
+May Sun+2\fB\et\fRsecond Sunday in May (Muttertag)
+04/SunLast\fB\et\fRlast Sunday in April,
+\fB\et\fRsummer time in Europe
+Easter\fB\et\fREaster
+Ostern-2\fB\et\fRGood Friday (2 days before Easter)
+Paskha\fB\et\fROrthodox Easter
+
+.Ed
+.Sh FILES
+.Bl -tag -width calendar.christian -compact
+.It Pa calendar
+file in current directory.
+.It Pa ~/.calendar
+.Pa calendar
+HOME directory.
+A chdir is done into this directory if it exists.
+.It Pa ~/.calendar/calendar
+calendar file to use if no calendar file exists in the current directory.
+.It Pa ~/.calendar/nomail
+do not send mail if this file exists.
+.El
+.Pp
+The following default calendar files are provided in
+.Pa /usr/share/calendar:
+.Pp
+.Bl -tag -width calendar.southafrica -compact
+.It Pa calendar.all
+File which includes all the default files.
+.It Pa calendar.australia
+Calendar of events in Australia.
+.It Pa calendar.birthday
+Births and deaths of famous (and not-so-famous) people.
+.It Pa calendar.christian
+Christian holidays.
+This calendar should be updated yearly by the local system administrator
+so that roving holidays are set correctly for the current year.
+.It Pa calendar.computer
+Days of special significance to computer people.
+.It Pa calendar.croatian
+Calendar of events in Croatia.
+.It Pa calendar.dutch
+Calendar of events in the Netherlands.
+.It Pa calendar.freebsd
+Birthdays of
+.Fx
+committers.
+.It Pa calendar.french
+Calendar of events in France.
+.It Pa calendar.german
+Calendar of events in Germany.
+.It Pa calendar.history
+Everything else, mostly U.S.\& historical events.
+.It Pa calendar.holiday
+Other holidays, including the not-well-known, obscure, and
+.Em really
+obscure.
+.It Pa calendar.judaic
+Jewish holidays.
+The entries for this calendar have been obtained from the port
+deskutils/hebcal.
+.It Pa calendar.music
+Musical events, births, and deaths.
+Strongly oriented toward rock 'n' roll.
+.It Pa calendar.newzealand
+Calendar of events in New Zealand.
+.It Pa calendar.russian
+Russian calendar.
+.It Pa calendar.southafrica
+Calendar of events in South Africa.
+.It Pa calendar.usholiday
+U.S.\& holidays.
+This calendar should be updated yearly by the local system administrator
+so that roving holidays are set correctly for the current year.
+.It Pa calendar.world
+Includes all calendar files except for national files.
+.El
+.Sh COMPATIBILITY
+The
+.Nm
+program previously selected lines which had the correct date anywhere
+in the line.
+This is no longer true, the date is only recognized when it occurs
+at the beginning of a line.
+.Sh SEE ALSO
+.Xr at 1 ,
+.Xr cpp 1 ,
+.Xr mail 1 ,
+.Xr cron 8
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v7 .
+.Sh NOTES
+Chinese New Year is calculated at 120 degrees east of Greenwich,
+which roughly corresponds with the east coast of China.
+For people west of China, this might result that the start of Chinese
+New Year and the day of the related new moon might differ.
+.Pp
+The phases of the moon and the longitude of the sun are calculated
+against the local position which corresponds with 30 degrees times
+the time-difference towards Greenwich.
+.Pp
+The new and full moons are happening on the day indicated: They
+might happen in the time period in the early night or in the late
+evening.
+It does not indicate that they are starting in the night on that date.
+.Pp
+Because of minor differences between the output of the formulas
+used and other sources on the Internet, Druids and Werewolves should
+double-check the start and end time of solar and lunar events.
+.Sh BUGS
+The
+.Nm
+internal cpp does not correctly do #ifndef and will discard the rest
+of the file if a #ifndef is triggered.
+It also has a maximum of 50 include file and/or 100 #defines
+and only recognises #include, #define and
+#ifndef.
+.Pp
+There is no possibility to properly specify the local position
+needed for solar and lunar calculations.
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c
new file mode 100644
index 0000000..84d1880
--- /dev/null
+++ b/usr.bin/calendar/calendar.c
@@ -0,0 +1,232 @@
+/*-
+ * Copyright (c) 1989, 1993, 1994
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "calendar.h"
+
+#define UTCOFFSET_NOTSET 100 /* Expected between -24 and +24 */
+#define LONGITUDE_NOTSET 1000 /* Expected between -360 and +360 */
+
+struct passwd *pw;
+int doall = 0;
+int debug = 0;
+static char *DEBUG = NULL;
+static time_t f_time = 0;
+double UTCOffset = UTCOFFSET_NOTSET;
+int EastLongitude = LONGITUDE_NOTSET;
+
+static void usage(void) __dead2;
+
+int
+main(int argc, char *argv[])
+{
+ int f_dayAfter = 0; /* days after current date */
+ int f_dayBefore = 0; /* days before current date */
+ int Friday = 5; /* day before weekend */
+
+ int ch;
+ struct tm tp1, tp2;
+
+ (void)setlocale(LC_ALL, "");
+
+ while ((ch = getopt(argc, argv, "-A:aB:D:dF:f:l:t:U:W:?")) != -1)
+ switch (ch) {
+ case '-': /* backward contemptible */
+ case 'a':
+ if (getuid()) {
+ errno = EPERM;
+ err(1, NULL);
+ }
+ doall = 1;
+ break;
+
+ case 'W': /* we don't need no steenking Fridays */
+ Friday = -1;
+ /* FALLTHROUGH */
+
+ case 'A': /* days after current date */
+ f_dayAfter = atoi(optarg);
+ if (f_dayAfter < 0)
+ errx(1, "number of days must be positive");
+ break;
+
+ case 'B': /* days before current date */
+ f_dayBefore = atoi(optarg);
+ if (f_dayBefore < 0)
+ errx(1, "number of days must be positive");
+ break;
+
+ case 'D': /* debug output of sun and moon info */
+ DEBUG = optarg;
+ break;
+
+ case 'd': /* debug output of current date */
+ debug = 1;
+ break;
+
+ case 'F': /* Change the time: When does weekend start? */
+ Friday = atoi(optarg);
+ break;
+
+ case 'f': /* other calendar file */
+ calendarFile = optarg;
+ break;
+
+ case 'l': /* Change longitudal position */
+ EastLongitude = strtol(optarg, NULL, 10);
+ break;
+
+ case 't': /* other date, for tests */
+ f_time = Mktime(optarg);
+ break;
+
+ case 'U': /* Change UTC offset */
+ UTCOffset = strtod(optarg, NULL);
+ break;
+
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc)
+ usage();
+
+ /* use current time */
+ if (f_time <= 0)
+ (void)time(&f_time);
+
+ /* if not set, determine where I could be */
+ {
+ if (UTCOffset == UTCOFFSET_NOTSET &&
+ EastLongitude == LONGITUDE_NOTSET) {
+ /* Calculate on difference between here and UTC */
+ time_t t;
+ struct tm tm;
+ long utcoffset, hh, mm, ss;
+ double uo;
+
+ time(&t);
+ localtime_r(&t, &tm);
+ utcoffset = tm.tm_gmtoff;
+ /* seconds -> hh:mm:ss */
+ hh = utcoffset / SECSPERHOUR;
+ utcoffset %= SECSPERHOUR;
+ mm = utcoffset / SECSPERMINUTE;
+ utcoffset %= SECSPERMINUTE;
+ ss = utcoffset;
+
+ /* hh:mm:ss -> hh.mmss */
+ uo = mm + (100.0 * (ss / 60.0));
+ uo /= 60.0 / 100.0;
+ uo = hh + uo / 100;
+
+ UTCOffset = uo;
+ EastLongitude = UTCOffset * 15;
+ } else if (UTCOffset == UTCOFFSET_NOTSET) {
+ /* Base on information given */
+ UTCOffset = EastLongitude / 15;
+ } else if (EastLongitude == LONGITUDE_NOTSET) {
+ /* Base on information given */
+ EastLongitude = UTCOffset * 15;
+ }
+ }
+
+ settimes(f_time, f_dayBefore, f_dayAfter, Friday, &tp1, &tp2);
+ generatedates(&tp1, &tp2);
+
+ /*
+ * FROM now on, we are working in UTC.
+ * This will only affect moon and sun related events anyway.
+ */
+ if (setenv("TZ", "UTC", 1) != 0)
+ errx(1, "setenv: %s", strerror(errno));
+ tzset();
+
+ if (debug)
+ dumpdates();
+
+ if (DEBUG != NULL) {
+ dodebug(DEBUG);
+ exit(0);
+ }
+
+ if (doall)
+ while ((pw = getpwent()) != NULL) {
+ (void)setegid(pw->pw_gid);
+ (void)initgroups(pw->pw_name, pw->pw_gid);
+ (void)seteuid(pw->pw_uid);
+ if (!chdir(pw->pw_dir))
+ cal();
+ (void)seteuid(0);
+ }
+ else
+ cal();
+ exit(0);
+}
+
+
+static void __dead2
+usage(void)
+{
+
+ fprintf(stderr, "%s\n%s\n%s\n",
+ "usage: calendar [-A days] [-a] [-B days] [-D sun|moon] [-d]",
+ " [-F friday] [-f calendarfile] [-l longitude]",
+ " [-t dd[.mm[.year]]] [-U utcoffset] [-W days]"
+ );
+ exit(1);
+}
diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h
new file mode 100644
index 0000000..1113c4a
--- /dev/null
+++ b/usr.bin/calendar/calendar.h
@@ -0,0 +1,197 @@
+/*-
+ * Copyright (c) 1989, 1993, 1994
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/uio.h>
+
+#define SECSPERDAY (24 * 60 * 60)
+#define SECSPERHOUR (60 * 60)
+#define SECSPERMINUTE (60)
+#define MINSPERHOUR (60)
+#define HOURSPERDAY (24)
+#define FSECSPERDAY (24.0 * 60.0 * 60.0)
+#define FSECSPERHOUR (60.0 * 60.0)
+#define FSECSPERMINUTE (60.0)
+#define FMINSPERHOUR (60.0)
+#define FHOURSPERDAY (24.0)
+
+#define DAYSPERYEAR 365
+#define DAYSPERLEAPYEAR 366
+
+/* Not yet categorized */
+
+extern struct passwd *pw;
+extern int doall;
+extern time_t t1, t2;
+extern const char *calendarFile;
+extern int yrdays;
+extern struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
+extern struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
+extern double UTCOffset;
+extern int EastLongitude;
+
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+
+/* Flags to determine the returned values by determinestyle() in parsedata.c */
+#define F_NONE 0x00000
+#define F_MONTH 0x00001
+#define F_DAYOFWEEK 0x00002
+#define F_DAYOFMONTH 0x00004
+#define F_MODIFIERINDEX 0x00008
+#define F_MODIFIEROFFSET 0x00010
+#define F_SPECIALDAY 0x00020
+#define F_ALLMONTH 0x00040
+#define F_ALLDAY 0x00080
+#define F_VARIABLE 0x00100
+#define F_EASTER 0x00200
+#define F_CNY 0x00400
+#define F_PASKHA 0x00800
+#define F_NEWMOON 0x01000
+#define F_FULLMOON 0x02000
+#define F_MAREQUINOX 0x04000
+#define F_SEPEQUINOX 0x08000
+#define F_JUNSOLSTICE 0x10000
+#define F_DECSOLSTICE 0x20000
+#define F_YEAR 0x40000
+
+#define STRING_EASTER "Easter"
+#define STRING_PASKHA "Paskha"
+#define STRING_CNY "ChineseNewYear"
+#define STRING_NEWMOON "NewMoon"
+#define STRING_FULLMOON "FullMoon"
+#define STRING_MAREQUINOX "MarEquinox"
+#define STRING_SEPEQUINOX "SepEquinox"
+#define STRING_JUNSOLSTICE "JunSolstice"
+#define STRING_DECSOLSTICE "DecSolstice"
+
+#define MAXCOUNT 125 /* Random number of maximum number of
+ * repeats of an event. Should be 52
+ * (number of weeks per year), if you
+ * want to show two years then it
+ * should be 104. If you are seeing
+ * more than this you are using this
+ * program wrong.
+ */
+
+/*
+ * All the astronomical calculations are carried out for the meridian 120
+ * degrees east of Greenwich.
+ */
+#define UTCOFFSET_CNY 8.0
+
+extern int debug; /* show parsing of the input */
+extern int year1, year2;
+
+/* events.c */
+/*
+ * Event sorting related functions:
+ * - Use event_add() to create a new event
+ * - Use event_continue() to add more text to the last added event
+ * - Use event_print_all() to display them in time chronological order
+ */
+struct event *event_add(int, int, int, char *, int, char *, char *);
+void event_continue(struct event *events, char *txt);
+void event_print_all(FILE *fp);
+struct event {
+ int year;
+ int month;
+ int day;
+ int var;
+ char *date;
+ char *text;
+ char *extra;
+ struct event *next;
+};
+
+/* locale.c */
+
+struct fixs {
+ char *name;
+ size_t len;
+};
+
+extern const char *days[];
+extern const char *fdays[];
+extern const char *fmonths[];
+extern const char *months[];
+extern const char *sequences[];
+extern struct fixs fndays[8]; /* full national days names */
+extern struct fixs fnmonths[13]; /* full national months names */
+extern struct fixs ndays[8]; /* short national days names */
+extern struct fixs nmonths[13]; /* short national month names */
+extern struct fixs nsequences[10];
+
+void setnnames(void);
+void setnsequences(char *);
+
+/* day.c */
+extern const struct tm tm0;
+extern char dayname[];
+void settimes(time_t,int before, int after, int friday, struct tm *tp1, struct tm *tp2);
+time_t Mktime(char *);
+
+/* parsedata.c */
+int parsedaymonth(char *, int *, int *, int *, int *, char **);
+void dodebug(char *type);
+
+/* io.c */
+void cal(void);
+void closecal(FILE *);
+FILE *opencalin(void);
+FILE *opencalout(void);
+
+/* ostern.c / paskha.c */
+int paskha(int);
+int easter(int);
+int j2g(int);
+
+/* dates.c */
+extern int cumdaytab[][14];
+extern int monthdaytab[][14];
+extern int debug_remember;
+void generatedates(struct tm *tp1, struct tm *tp2);
+void dumpdates(void);
+int remember_ymd(int y, int m, int d);
+int remember_yd(int y, int d, int *rm, int *rd);
+int first_dayofweek_of_year(int y);
+int first_dayofweek_of_month(int y, int m);
+int walkthrough_dates(struct event **e);
+void addtodate(struct event *e, int year, int month, int day);
+
+/* pom.c */
+#define MAXMOONS 18
+void pom(int year, double UTCoffset, int *fms, int *nms);
+void fpom(int year, double utcoffset, double *ffms, double *fnms);
+
+/* sunpos.c */
+void equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays);
+void fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays);
+int calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths);
diff --git a/usr.bin/calendar/calendars/calendar.all b/usr.bin/calendar/calendars/calendar.all
new file mode 100644
index 0000000..6ed1cce
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.all
@@ -0,0 +1,24 @@
+/*
+ * International and national calendar files
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_all_
+#define _calendar_all_
+
+#include <calendar.world>
+#include <calendar.australia>
+#include <calendar.brazilian>
+#include <calendar.croatian>
+#include <calendar.dutch>
+#include <calendar.french>
+#include <calendar.german>
+#include <calendar.hungarian>
+#include <calendar.newzealand>
+#include <calendar.russian>
+#include <calendar.southafrica>
+#include <calendar.ukrainian>
+#include <calendar.usholiday>
+
+#endif /* !_calendar_all_ */
diff --git a/usr.bin/calendar/calendars/calendar.australia b/usr.bin/calendar/calendars/calendar.australia
new file mode 100644
index 0000000..daa07ff
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.australia
@@ -0,0 +1,72 @@
+/*
+ * Australian holidays
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_australia_
+#define _calendar_australia_
+
+LANG=en_AU.ISO8859-1
+
+/* Australia */
+Jan 26 Australia Day
+Apr/SunFirst Daylight Savings Time ends in ACT, NSW, SA, TAS and VIC.
+Apr 25 Anzac Day
+Jun/MonSecond Queen's Birthday Holiday (Australia, except WA)
+Oct/SunFirst Daylight Savings Time starts in ACT, NSW, SA and VIC.
+
+/* ACT, NSW, common */
+Mar 18 Canberra Day (ACT)
+Sep/MonLast Family & Community Day (ACT)
+Aug/MonFirst Bank Holiday (ACT, NSW)
+Oct/MonFirst Labour Day (ACT, NSW, SA)
+
+/* Victoria */
+Mar/MonSecond Labour Day (VIC)
+Nov/TueFirst Melbourne Cup (VIC)
+
+/* Tasmania
+ * http://www.wst.tas.gov.au/employment_info/public_holidays/html/2010
+ */
+Feb/MonSecond Regatta Day (TAS)
+Feb/WedLast Launceston Cup (TAS)
+Mar/TueFirst King Island show (TAS)
+Mar/MonSecond Eight Hours Day (TAS)
+Oct 10 Launceston Show Day (TAS) /* Thursday preceding second Saturday in October */
+Oct 24 Hobart Show Day (TAS) /* Thursday preceding fourth Saturday in October */
+Nov/MonFirst Recreation Day (N TAS)
+
+/*
+Oct/SatSecond-2 Launceston Show Day (TAS) // Thursday preceding second Sat in October
+Oct/SatFourth-2 Hobart Show Day (TAS) // Thursday preceding fourth Sat in October
+May/ThuFirst+1 Agfest (Circular Head only) // Friday following the first Thursday in May
+Oct/SatFirst-1 Burnie Show // Friday preceding first Saturday in October
+Oct/SatThird-1 Flinders Island Show // Friday preceding third Saturday in October
+
+DEVONPORT CUP Wednesday not earlier than fifth and not later than eleventh day of January
+DEVONPORT SHOW Friday nearest last day in November, but not later than first day of December
+*/
+
+/* South Australia */
+May/MonThird Adelaide Cup (SA)
+Dec 26 Proclamation Day holiday (SA)
+
+/* Western Australia */
+Mar/MonFirst Labour Day (WA)
+Jun/MonFirst Foundation Day (WA)
+Sep 30 Queen's Birthday (WA)
+
+/* Northern Territory */
+May/MonFirst May Day (NT)
+Jul/FriFirst Alice Springs Show Day (NT)
+Jul/FriSecond Tennant Creek Show Day (NT)
+Jul/FriThird Katherine Show Day (NT)
+Jul/FriLast Darwin Show Day (NT)
+Aug/MonFirst Picnic Day (NT)
+
+/* Queensland */
+May/MonFirst Labour Day (QLD)
+Aug/WedSecond RNA Show Day (Brisbane metro) /* Second Last Wednesday */
+
+#endif
diff --git a/usr.bin/calendar/calendars/calendar.birthday b/usr.bin/calendar/calendars/calendar.birthday
new file mode 100644
index 0000000..51745e3
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.birthday
@@ -0,0 +1,304 @@
+/*
+ * Birthday
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_birthday_
+#define _calendar_birthday_
+#undef unix
+
+01/01 J.D. Salinger born, 1919
+01/01 Paul Revere born in Boston, 1735
+01/02 Isaac Asimov born in Petrovichi, Russian SFSR, 1920
+01/04 George Washington Carver born in Missouri, 1864
+01/04 Jakob Grimm born, 1785
+01/04 Wilhelm Beer born, 1797, first astronomer to map Mars
+01/05 DeWitt B. Brace born, 1859, inventor of spectrophotometer
+01/10 Ethan Allen born, 1738
+01/11 Alexander Hamilton born in Nevis, British West Indies, 1757?
+01/12 "Long" John Baldry is born in London, 1941
+01/13 Horatio Alger born, 1834
+01/13 Sophie Tucker born, 1884
+01/13 Wilhelm Wien born, 1864, Nobel prize for blackbody radiation laws
+01/14 Albert Schweitzer born, 1875
+01/15 Martin Luther King, Jr. born
+01/17 Benjamin Franklin born in Boston, 1706
+01/19 Edgar Allan Poe born in Boston, 1809
+01/19 Robert Edward Lee born in Stratford Estate, Virginia, 1807
+01/20 George Burns born, 1898
+01/21 Lenin died, 1924
+01/21 Thomas Jonathan "Stonewall" Jackson born in Clarksburg, VA, 1824
+01/22 Sir Francis Bacon born, 1561
+01/23 Ernst Abbe born, 1840, formulated diffraction theory
+01/23 Humphrey Bogart born in New York City, 1899
+01/23 John Hancock born, 1737
+01/23 Joseph Hewes born, 1730
+01/23 Samuel Barber died, 1981
+01/24 John Belushi is born in Chicago, 1949
+01/25 Robert Burns born, 1759
+01/25 Virginia Woolf born, 1882
+01/25 W. Somerset Maugham born, 1874
+01/27 Samuel Gompers born, 1850
+01/30 Franklin Delano Roosevelt born in Hyde Park, New York, 1882
+01/31 Jackie Robinson born, 1919
+02/03 Gertrude Stein born, 1874
+02/04 Ken Thompson, creator of unix, born, 1943
+02/05 Alex Harvey (SAHB) is born in Glasgow, Scotland, 1935
+02/06 King George VI of UK dies; his daughter becomes Elizabeth II, 1952
+02/07 Sinclair Lewis born, 1885
+02/08 Friedleib F. Runge born, 1795, father of paper chromatography
+02/08 Jules Verne born in Nantes, France, 1828
+02/09 George Hartmann born, 1489, designed astrolabes, timepieces, etc.
+02/10 Charles Lamb born, 1775
+02/10 William Allen White born, 1868
+02/11 Thos. Edison born, 1847
+02/11 William Henry Fox Talbot (photographic pioneer) born, 1800
+02/12 Abraham Lincoln born, 1809
+02/12 Charles Darwin born in Shrewsbury, England, 1809
+02/15 Galileo Galilei born in Pisa, Italy, 1564
+02/15 Susan B. Anthony born, 1820
+02/16 Pierre Bouguer born, 1698, founder of photometry
+02/17 Federick Eugene Ives born, 1856, pioneer of halftone
+02/17 Marion Anderson born, 1902
+02/17 T. J. Watson, Sr. born, 1874
+02/18 Ernst Mach born, 1838, philosopher & optics pioneer
+02/19 Nicolas Copernicus born in Thorn, Poland, 1473
+02/20 Ludwig Boltzmann born, 1838, atomic physics pioneer
+02/21 Alexis De Rochon born, 1838, developed the spyglass
+02/22 George Washington born, 1732
+02/22 Pierre Jules Cesar Janssen born, 1838, found hydrogen in the sun
+02/23 W.E.B. DuBois born, 1868
+02/24 Winslow Homer born, 1836
+02/24 Steve Jobs born, 1955
+02/25 George Harrison born in Liverpool, England, 1943
+02/25 Renoir born, 1841
+02/26 Dominique Francois Jean Arago born, 1786;
+ observed "Poisson's spot" cf June 21
+02/28 Michel de Mantaigne born, 1533
+02/29 Herman Hollerith born, 1860
+03/01 David Niven born, 1910
+03/02 Dr. Seuss born, 1904
+03/04 Casimir Pulaski born, 1747
+03/05 John Belushi dies in Los Angeles, 1982
+03/07 Sir John Frederick William Herschel born, 1792, astronomer
+03/08 Alvan Clark born, 1804, astronomer & lens manufacturer
+03/08 Howard Aiken born, 1900
+03/11 Robert Treat Paine born, 1737
+03/11 Vannevar Bush born, 1890
+03/12 Gustav Robert Kirchhoff born, 1824, physicist
+03/14 Albert Einstein born, 1879
+03/14 Casey Jones born, 1864
+03/14 Giovanni Virginia Schiaparelli born, 1835, astronomer;
+ named Mars "canals"
+03/14 Jean Baptiste Joseph Fourier born, 1768, mathematician & physicist
+03/15 Andrew "Old Hickory" Jackson, 7th President of the United States,
+ born in Waxhaw, South Carolina, 1767
+03/15 J.J. Robert's Birthday in Liberia
+03/16 George Clymer born, 1739
+03/16 James Madison, 4th President of the United States, born in King George
+ County, Virginia, 1751
+03/21 NetBSD project born, 1993
+03/24 Harry Houdini born, 1874
+03/26 Benjamin Thompson born, 1753, Count Rumford; physicist
+03/26 David Packard died, 1996; age of 83
+03/27 Wilhelm Conrad Roentgen born, 1845, discoverer of X-rays
+03/28 Pierre Simon de Laplace born, 1749, mathematician & astronomer
+03/30 Francisco Jose de Goya born, 1746
+03/30 Sean O'Casey born, 1880
+03/30 Vincent Van Gogh born, 1853
+03/31 Rene Descartes born, 1596, mathematician & philosopher
+04/02 Hans Christian Andersen born, 1805, fairy tale author
+04/02 Pope John Paul II (Karol Wojtyla) died in Vatican, 2005
+04/03 Washington Irving born, 1783
+04/05 Thomas Hobbes born, 1588, philosopher
+04/08 Buddha born, 563 BC
+04/08 David Rittenhouse born, 1732, astronomer & mathematician
+04/09 Edward Muybridge born, 1830, motion-picture pioneer
+04/09 J. Presper Eckert born, 1919
+04/10 Commodore Matthew Calbraith Perry born, 1794
+04/10 William Booth born, 1829, founder of the Salvation Army
+04/13 Thomas Jefferson, 3rd President of the United States, born Shadwell
+ Plantation, Albemarle County, Virginia, 1743
+04/14 Christiaan Huygens born, 1629, physicist & astronomer;
+ discovered Saturn's rings
+04/15 Leonardo da Vinci born, 1452
+04/16 Charles (Charlie) Chaplin (Sir) born in London, 1889
+04/22 Kant born, 1724
+04/27 Louis Victor de Broglie born, 1774, physicist
+04/28 James Monroe, 5th President of the United States, born in Westmoreland
+ County, Viriginia, 1758
+04/29 Jules Henri Poincare born, 1854, founder of topology
+04/29 William Randolph Hearst born in San Francisco, 1863
+04/30 Karl Friedrich Gauss born, 1777, mathematician & astronomer
+05/01 Little Walter (Marion Walter Jacobs) is born in Alexandria,
+ Louisiana, 1930
+05/02 Dr. Benjamin Spock born, 1903
+05/04 Alice Liddell born, 1852, Alice's Adventures in Wonderland
+ & Through the Looking-Glass
+05/09 Pinza died, 1957
+05/10 Fred Astaire (Frederick Austerlitz) born in Omaha, Nebraska, 1899
+05/11 Johnny Appleseed born, 1768
+05/12 Florence Nightingale born in Florence, Italy, 1820
+05/13 Arthur S. Sullivan born, 1842
+05/15 Mike Oldfield is born in Essex, England, 1953
+05/18 Pope John Paul II (Karol Wojtyla) born in Wadowice, Poland, 1920
+05/19 Ho Chi Minh born, 1890
+05/21 Plato (Aristocles) born in Athens(?), 427BC
+05/27 Hubert H. Humphrey born, 1911
+05/28 Dionne quintuplets born, 1934
+05/29 Gilbert Keith Chesterton born, 1874
+05/29 John Fitzgerald Kennedy, 35th President of the United States, born in
+ Brookline, Massachusetts, 1917
+05/29 Patrick Henry born, 1736
+05/30 Mel (Melvin Jerome) Blanc born in San Francisco, 1908
+06/01 Brigham Young born, 1801
+06/01 Marilyn Monroe born, 1928
+06/02 Edward Elgar (Sir) born in Worcester, England, 1857
+06/03 Henry James born, 1811
+06/07 (Eugene Henri) Paul Gaugin born, 1848
+06/07 George Bryan "Beau" Brummel born, 1778
+06/07 Alan Mathison Turing died, 1954
+06/08 Frank Lloyd Wright born in Richland Center, Wisconsin, 1867
+06/13 Alexander the Great dies (323BC)
+06/15 Edward (Edvard Hagerup) Grieg born in Bergen, Norway, 1843
+06/16 Hammurabi the Great dies, Babylon, 1686 BC
+06/18 M.C. Escher born, 1898
+06/19 FreeBSD project born, 1993
+06/22 Carl Hubbell born, 1903
+06/22 Meryl Streep born in Summit, New Jersey, 1949
+06/22 Konrad Zuse born in Berlin, 1919
+06/23 Alan Mathison Turing born, 1912
+06/25 Eric Arthur Blair (a.k.a. George Orwell) born, 1903
+06/27 Helen Keller born, 1880
+07/03 Franz Kafka born, 1883
+07/04 Nathaniel Hawthorne born in Salem, Massachusetts, 1804
+07/04 John Adams and Thomas Jefferson die on same day, 1826
+07/06 (Helen) Beatrix Potter born, 1866
+07/06 John Paul Jones born, 1747
+07/07 P.T. Barnum dies, 1891
+07/08 Count Ferdinand von Zeppelin born, 1838
+07/10 John Calvin born, 1509
+07/11 John Quincy Adams, 6th President of the United States, born in
+ Braintree, Massachusetts, 1767
+07/12 Henry David Thoreau born, 1817
+07/15 Clement Clarke Moore born, 1779, author of "A Visit from
+ Saint Nicholas"
+07/18 Brian Auger is born in London, 1939
+07/25 Steve Goodman is born in Chicago, 1948
+07/29 Mussolini born, 1883
+07/30 Emily Bronte born, 1818
+07/30 Henry Ford born, 1863
+08/01 Herman Melville born, 1819
+08/03 Lenny Bruce dies of a morphine overdose, 1966
+08/06 Jonathan B. Postel is born in Altadena, California, 1943
+08/08 Dustin Hoffman born in Los Angeles, 1937
+08/12 Thomas Mann's Death, 1955
+08/13 Alfred Hitchcock born, 1899
+08/13 Annie Oakley born, 1860
+08/13 Fidel Castro born, 1927
+08/17 Mae West born, 1892
+08/18 Meriwether Lewis born, 1774
+08/20 Leon Trotsky assassinated, 1940
+08/21 Christopher Robin Milne born, 1920
+08/21 Winnie-the-Pooh (Edward Bear) born (given to Christopher Robin
+ Milne), 1921
+08/23 Gene Kelly born, 1912
+08/27 Lyndon B. Johnson born, 1908
+08/29 Oliver Wendell Holmes born, 1809, physician & father of the jurist
+08/30 John W. Mauchly born, 1907
+09/05 King Louis XIV of France born, 1638
+09/05 Raquel Welch born, 1942
+09/06 Word is received that Perry has reached the North Pole and died, 1909
+09/07 James Fenimore Cooper born in Burlington, NJ, 1789
+09/07 Queen Elizabeth I of England born, 1533
+09/08 Richard ``the Lionheart'', king of England born in Oxford, 1157
+09/08 Peter Sellers born in Southsea, England, 1925
+09/09 Chinese Communist Party Chairman Mao Tse-Tung dies at age 82, 1976
+09/09 Dennis MacAlistair Ritchie, creator of C, born, 1941
+09/12 Jesse Owens born, 1913
+09/13 Walter Reed born, 1851
+09/15 Agatha Christie born in Torquay, England, 1890
+09/16 Allen Funt born in Brooklyn, NY, 1914
+09/18 Greta Garbo born, 1905
+09/18 Jimi Hendrix dies from an overdose, 1970
+09/20 Upton (Beall) Sinclair born, 1878
+09/21 H.G. (Herbert George) Wells born in Bromley, England, 1866
+09/21 Louis Joliet born, 1645
+09/22 President Garfield dies of wounds in Baltimore, 1881
+09/23 Augustus (Gaius Octavius) Caesar born in Rome, 63 BC
+09/23 Euripides born in Salamis, Greece, 480 BC
+09/24 F. Scott Fitzgerald born, 1896
+09/26 Johnny Appleseed born, 1774
+09/26 T.S. (Thomas Stearns) Eliot born in St. Louis, 1888
+09/27 Thomas Nast born, 1840
+09/28 Michelangelo Buonarroti born in Caprese, Italy, 1573
+09/28 Pompey (Gnaeus Pompeius Magnus) born in Rome, 106BC
+09/28 Seymour Cray born, 1925
+09/29 Gene Autry born, 1907
+10/01 Jimmy Carter, 39th President of United States, born in Plains, Georgia,
+ 1924
+10/02 Aristotle dies of indigestion, 322 BC
+10/02 Mohandas K. Gandhi born at Porbandar, Kathiawad, India, 1869
+10/04 John V. Atanasoff born, 1903
+10/05 Ray Kroc (founder of McDonald's) born, 1902
+10/05 Steve Jobs died at the age of 56, 2011
+10/12 Dennis MacAlistair Ritchie died at the age of 70, 2011
+10/13 Lenny Bruce is born in New York City, 1925
+10/13 Virgil (Publius Vergilius Maro) born near Mantua, Italy, 70 BC
+10/14 Dwight David Eisenhower, 34th President of the United States, born in
+ Denison, Texas, 1890
+10/14 William Penn born in London, 1644
+10/15 Pelham Grenville Wodehouse born, 1881
+10/16 Noah Webster born, 1758
+10/16 Oscar (Fingal O'Flahertie Wills) Wilde born in Dublin, 1854
+10/16 Dr. Jonathan B. Postel dies at age 55, 1998
+10/17 Richard Mentor Johnson born, 1780, 9th V.P. of U.S.
+10/21 Alfred Nobel born in Stockholm, 1833
+10/25 Pablo Picasso born in Malaga, Spain, 1881
+10/27 James Cook is born, 1728
+10/27 Theodore (Teddy) Roosevelt, 26th President of the United States, born
+ New York, New York, 1858
+10/27 Gerald M. Weinberg born, 1933
+10/30 John Adams, 2nd President of the United States, born Quincy,
+ Massachusetts 1735.
+10/31 Chiang Kai-Shek born, 1887
+10/31 Dale Evans born, 1912
+11/02 Daniel Boone born near Reading, PA, 1734
+11/04 King William III of Orange born, 1650
+11/05 Roy Rogers born, 1912
+11/09 Carl Sagan born, 1934
+11/10 Martin Luther born in Eisleben, Germany, 1483
+11/10 Soviet President Leonid Brezhnev dies at age 75, 1982
+11/11 Kurt Vonnegut, Jr, born in Indianapolis, 1922
+11/13 Robert Louis Stevenson born, 1850
+11/13 St. Augustine of Hippo born in Numidia, Algeria, 354
+11/18 Imogene Coca born, 1908
+11/18 William S. Gilbert born, 1836
+11/20 Robert Francis Kennedy (RFK) born in Boston, Massachusetts, 1925
+11/26 Charles Schulz born in Minneapolis, 1922
+11/26 Norbert Wiener born in Columbia, Missouri, 1894
+11/29 John Mayall is born in Cheshire, England, 1933
+11/30 Cleopatra died, 30 BC
+11/30 Mark Twain (Samuel Clemmens) born in Florida, Missouri, 1835
+12/01 Woody Allen (Allen Stuart Konigsberg) born in Brooklyn, NY, 1935
+12/04 Tommy Bolin dies of a heroin overdose in Miami, 1976
+12/05 Martin Van Buren, 8th President of the United States, born in
+ Kinderhook, New York, 1837
+12/05 Walt (Walter Elias) Disney born in Chicago, 1901
+12/08 Horace (Quintus Horatius Flaccus) born in Venosa (Italy), 65BC
+12/08 James (Grover) Thurber born in Columbus, Ohio, 1894
+12/10 Emily Dickenson born, 1830
+12/12 E.G. Robinson born, 1893
+12/14 George Washington dies, 1799
+12/17 William Safire (Safir) born, 1929
+12/18 Konrad Zuse died in Hünfeld, 1995
+12/20 Carl Sagan died, 1996
+12/21 Benjamin Disraeli born, 1804
+12/22 Giacomo Puccini born, 1858
+12/23 Joseph Smith born, 1805
+12/25 Isaac Newton (Sir) born in Grantham, England, 1642
+12/26 Chas. Babbage born, 1791
+12/28 John von Neumann born, 1903
+
+#endif /* !_calendar_birthday_ */
diff --git a/usr.bin/calendar/calendars/calendar.brazilian b/usr.bin/calendar/calendars/calendar.brazilian
new file mode 100644
index 0000000..d847cb3
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.brazilian
@@ -0,0 +1,13 @@
+/*
+ * $FreeBSD$
+ *
+ * Brazilian calendar file(s), originally submitted by
+ * Renato Tambellini <rtsanch@gmail.com>
+ */
+
+#ifndef _calendar_brazilian_
+#define _calendar_brazilian_
+
+#include <pt_BR.ISO8859-1/calendar.all>
+
+#endif
diff --git a/usr.bin/calendar/calendars/calendar.christian b/usr.bin/calendar/calendars/calendar.christian
new file mode 100644
index 0000000..f213594
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.christian
@@ -0,0 +1,36 @@
+/*
+ * Christian
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_christian_
+#define _calendar_christian_
+
+01/01 Solemnity of Mary, Mother of God
+01/05 Last (twelfth) day of Christmastide
+01/06 Epiphany
+Easter-47 Shrove Tuesday / Mardi Gras (day before Ash Wednesday)
+Easter-46 Ash Wednesday (First day of Lent)
+Easter-7 Palm Sunday (7 days before Easter)
+Easter-3 Maundy Thursday (3 days before Easter)
+Easter-2 Good Friday (2 days before Easter)
+Easter Easter Sunday
+Easter+39 Ascension Day (10 days before Pentecost)
+Easter+49 Pentecost (Whitsunday)
+Easter+50 Whitmonday
+Easter+56 Trinity Sunday (7 days after Pentecost)
+Easter+60 Corpus Christi (11 days after Pentecost)
+05/28* Rogation Sunday
+08/15 Assumption of the Blessed Virgin Mary
+10/18 Feast Day of St. Luke
+11/01 All Saints' Day
+11/SunLast First Sunday of Advent (4th Sunday before Christmas)
+12/SunFirst First Sunday of Advent (4th Sunday before Christmas)
+12/06 St. Nicholas' Day
+12/08 Feast of the Immaculate Conception
+12/24 Christmas Eve
+12/25 Christmastide begins: First day of Christmas
+12/26 Second day of Christmas (Boxing Day)
+
+#endif /* !_calendar_christian_ */
diff --git a/usr.bin/calendar/calendars/calendar.computer b/usr.bin/calendar/calendars/calendar.computer
new file mode 100644
index 0000000..8d6176e
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.computer
@@ -0,0 +1,76 @@
+/*
+ * Computer
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_computer_
+#define _calendar_computer_
+
+01/01 AT&T officially divests its local Bell companies, 1984
+01/01 The Epoch (Time 0 for UNIX systems, Midnight GMT, 1970)
+01/03 Apple Computer founded, 1977
+01/08 American Telephone and Telegraph loses antitrust case, 1982
+01/08 Herman Hollerith patents first data processing computer, 1889
+01/08 Justice Dept. drops IBM suit, 1982
+01/10 First CDC 1604 delivered to Navy, 1960
+01/16 Set uid bit patent issued, to Dennis Ritchie, 1979
+01/17 Justice Dept. begins IBM anti-trust suit, 1969 (drops it, January 8, 1982)
+01/24 DG Nova introduced, 1969
+01/25 First U.S. meeting of ALGOL definition committee, 1958
+01/26 EDVAC demonstrated, 1952
+01/31 Hewlett-Packard founded, 1939
+02/11 Last day of JOSS service at RAND Corp., 1966
+02/14 First micro-on-a-chip patented (TI), 1978
+02/15 ENIAC demonstrated, 1946
+03/01 First NPL (later PL/I) report published, 1964
+03/04 First Cray-1 shipped to Los Alamos
+03/09 "GOTO considered harmful" (E.J. Dijkstra) published in CACM, 1968
+03/14 LISP introduced, 1960
+03/28 DEC announces PDP-11, 1970
+03/31 Eckert-Mauchly Computer Corp. founded, Phila, 1946
+04/01 Yourdon, Inc. founded, 1974 (It figures.)
+04/03 IBM 701 introduced, 1953
+04/04 Tandy Corp. acquires Radio Shack, 1963 (9 stores)
+04/07 IBM announces System/360, 1964
+04/09 ENIAC Project begun, 1943
+04/28 Zilog Z-80 introduced, 1976
+05/06 EDSAC demonstrated, 1949
+05/01 First BASIC program run at Dartmouth, 1964
+05/16 First report on SNOBOL distributed (within BTL), 1963
+05/19 UNIX is 10000 days old, 1997
+05/21 DEC announces PDP-8, 1965
+05/22 Ethernet first described, 1973
+05/27 First joint meeting of U.S. and European ALGOL definition cte., 1958
+05/28 First meeting of COBOL definition cte. (eventually CODASYL), 1959
+05/30 Colossus Mark II, 1944
+06/02 First issue of Computerworld, 1967
+06/07 Alan Mathison Turing died, 1954
+06/10 First Apple II shipped, 1977
+06/15 UNIVAC I delivered to the Census Bureau, 1951
+06/16 First publicized programming error at Census Bureau, 1951
+06/23 IBM unbundles software, 1969
+06/23 Alan Mathison Turing born, 1912
+06/30 First advanced degree on computer related topic: to H. Karamanian,
+ Temple Univ., Phila, 1948, for symbolic differentiation on the ENIAC
+07/08 Bell Telephone Co. formed (predecessor of AT&T), 1877
+07/08 CDC incorporated, 1957
+07/FriLast System Administrator Appreciation Day
+08/14 First Unix-based mallet created, 1954
+08/14 IBM PC announced, 1981
+08/22 CDC 6600 introduced, 1963
+08/23 DEC founded, 1957
+09/15 ACM founded, 1947
+09/20 Harlan Herrick runs first FORTRAN program, 1954
+10/02 First robotics-based CAM, 1939
+10/06 First GPSS manual published, 1961
+10/08 First VisiCalc prototype, 1978
+10/12 Univac gives contract for SIMULA compiler to Nygaard and Dahl, 1962
+10/14 British Computer Society founded, 1957
+10/15 First FORTRAN Programmer's Reference Manual published, 1956
+10/20 Zurich ALGOL report published, 1958
+10/25 DEC announces VAX-11/780, 1977
+11/04 UNIVAC I program predicts Eisenhower victory based on 7% of votes, 1952
+12/08 First Ph.D. awarded by Computer Science Dept, Univ. of Penna, 1965
+
+#endif /* !_calendar_computer_ */
diff --git a/usr.bin/calendar/calendars/calendar.croatian b/usr.bin/calendar/calendars/calendar.croatian
new file mode 100644
index 0000000..4431227
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.croatian
@@ -0,0 +1,12 @@
+/*
+ * Croatian calendar files
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_croatian_
+#define _calendar_croatian_
+
+#include <hr_HR.ISO8859-2/calendar.all>
+
+#endif /* !_calendar_croatian_ */
diff --git a/usr.bin/calendar/calendars/calendar.dutch b/usr.bin/calendar/calendars/calendar.dutch
new file mode 100644
index 0000000..13a456b
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.dutch
@@ -0,0 +1,79 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Edwin Groothuis <edwin@FreeBSD.org>
+ */
+
+LANG=nl_NL.ISO8859-15
+Easter=Pasen
+
+/*
+ * Feestdagen
+ */
+jan/01 Nieuwjaar
+jan/06 Driekoningen
+apr/01 1 april
+apr/27 Koningsdag
+mei/01 Dag van de Arbeid
+mei/04 Dodenherdenking
+mei/05 Bevrijdingsdag
+okt/04 Dierendag
+nov/01 Allerheiligen
+nov/02 Allerzielen
+nov/11 Sint Maarten
+nov/11 Elfde-van-de-elfde
+dec/05 Sinterklaasavond
+dec/15 Koninkrijksdag
+dec/24 Kerstavond
+dec/25 Eerste Kerstdag
+dec/26 Tweede Kerstdag
+dec/28 Feest der Onnozele Kinderen
+dec/31 Oudjaar
+
+/*
+ * Pasen gerelateerd
+ */
+Pasen-50 Carnaval
+Pasen-49 Carnaval
+Pasen-48 Carnaval
+Pasen-47 Carnaval (Vastenavond)
+Pasen-46 Aswoensdag
+Pasen-7 Palmzondag
+Pasen-3 Witte Donderdag
+Pasen-2 Goede Vrijdag
+Pasen-1 Stille Zaterdag
+Pasen Eerste Paasdag
+Pasen+1 Tweede Paasdag
+Pasen+39 Hemelvaartsdag
+Pasen+49 Eerste Pinksterdag
+Pasen+50 Tweede Pinksterdag
+Pasen+56 Trinitatis
+
+/*
+ * Misc
+ */
+mei/SunSecond Moederdag
+jun/SunThird Vaderdag
+sep/TueThird Prinsjesdag
+
+/*
+ * Het koningshuis
+ */
+jan/19 Prinses Margriet (1943)
+jan/31 Prinses Beatrix (1938)
+feb/17 Prins Willem III (1817 - 1890)
+feb/18 Prinses Christina (1947)
+apr/10 Prinses Ariane (2007)
+apr/19 Prins Hendrik (1876 - 1934)
+apr/27 Koning Willem-Alexander (1967)
+apr/30 Prinses Juliana (1909 - 2004)
+apr/30 Mr. Pieter van Vollenhoven (1939)
+mei/17 Koningin Maxima (1971)
+jun/26 Prinses Alexia (2005)
+jun/29 Prins Bernhard (1911 - 2004)
+aug/05 Prinses Irene (1939)
+aug/31 Prinses Wilhelmina (1880 - 1962)
+sep/06 Prins Claus (1925 - 2002)
+sep/25 Prins Johan Friso (1968 - 2013)
+okt/11 Prins Constantijn (1969)
+dec/07 Kroonprinses Catharina-Amalia (2003)
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
new file mode 100644
index 0000000..6254f1a
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -0,0 +1,393 @@
+/*
+ * FreeBSD
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_freebsd_
+#define _calendar_freebsd_
+
+01/01 Dimitry Andric <dim@FreeBSD.org> born in Utrecht, the Netherlands, 1969
+01/01 Alexander Langer <alex@FreeBSD.org> born in Duesseldorf, Nordrhein-Westfalen, Germany, 1981
+01/02 Ion-Mihai "IOnut" Tetcu <itetcu@FreeBSD.org> born in Bucharest, Romania, 1980
+01/02 Patrick Li <pat@FreeBSD.org> born in Beijing, People's Republic of China, 1985
+01/03 Tetsurou Okazaki <okazaki@FreeBSD.org> born in Mobara, Chiba, Japan, 1972
+01/04 Hiroyuki Hanai <hanai@FreeBSD.org> born in Kagawa pre., Japan, 1969
+01/06 Philippe Audeoud <jadawin@FreeBSD.org> born in Bretigny-Sur-Orge, France, 1980
+01/08 Michael L. Hostbaek <mich@FreeBSD.org> born in Copenhagen, Denmark, 1977
+01/10 Jean-Yves Lefort <jylefort@FreeBSD.org> born in Charleroi, Belgium, 1980
+01/12 Yen-Ming Lee <leeym@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1977
+01/12 Ying-Chieh Liao <ijliao@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1979
+01/14 Yi-Jheng Lin <yzlin@FreeBSD.org> born in Taichung, Taiwan, Republic of China, 1985
+01/16 Ariff Abdullah <ariff@FreeBSD.org> born in Kuala Lumpur, Malaysia, 1978
+01/16 Dmitry Sivachenko <demon@FreeBSD.org> born in Moscow, USSR, 1978
+01/16 Vanilla I. Shu <vanilla@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1978
+01/17 Raphael Kubo da Costa <rakuco@FreeBSD.org> born in Sao Paulo, Sao Paulo, Brazil, 1989
+01/18 Dejan Lesjak <lesi@FreeBSD.org> born in Ljubljana, Slovenia, Yugoslavia, 1977
+01/19 Marshall Kirk McKusick <mckusick@FreeBSD.org> born in Wilmington, Delaware, United States, 1954
+01/19 Ruslan Ermilov <ru@FreeBSD.org> born in Simferopol, USSR, 1974
+01/19 Marcelo S. Araujo <araujo@FreeBSD.org> born in Joinville, Santa Catarina, Brazil, 1981
+01/20 Poul-Henning Kamp <phk@FreeBSD.org> born in Korsoer, Denmark, 1966
+01/22 Johann Visagie <wjv@FreeBSD.org> born in Cape Town, South Africa, 1970
+01/23 Hideyuki KURASHINA <rushani@FreeBSD.org> born in Niigata, Japan, 1982
+01/24 Fabien Thomas <fabient@FreeBSD.org> born in Avignon, France, 1971
+01/24 Matteo Riondato <matteo@FreeBSD.org> born in Padova, Italy, 1986
+01/25 Bernd Walter <ticso@FreeBSD.org> born in Moers, Nordrhein-Westfalen, Germany, 1974
+01/26 Andrew Gallatin <gallatin@FreeBSD.org> born in Buffalo, New York, United States, 1970
+01/27 Nick Sayer <nsayer@FreeBSD.org> born in San Diego, California, United States, 1968
+01/27 Jacques Anthony Vidrine <nectar@FreeBSD.org> born in Baton Rouge, Louisiana, United States, 1971
+01/27 Ngie Cooper <ngie@FreeBSD.org> born in Seattle, Washington, United States, 1984
+01/31 Hidetoshi Shimokawa <simokawa@FreeBSD.org> born in Yokohama, Kanagawa, Japan, 1970
+02/01 Doug Rabson <dfr@FreeBSD.org> born in London, England, 1966
+02/01 Nicola Vitale <nivit@FreeBSD.org> born in Busto Arsizio, Varese, Italy, 1976
+02/01 Paul Saab <ps@FreeBSD.org> born in Champaign-Urbana, Illinois, United States, 1978
+02/01 Martin Wilke <miwi@FreeBSD.org> born in Ludwigsfelde, Brandenburg, Germany, 1980
+02/01 Christian Brueffer <brueffer@FreeBSD.org> born in Gronau, Nordrhein-Westfalen, Germany, 1982
+02/01 Steven Kreuzer <skreuzer@FreeBSD.org> born in Oceanside, New York, United States, 1982
+02/01 Juli Mallett <jmallett@FreeBSD.org> born in Washington, Pennsylvania, United States, 1985
+02/02 Diomidis D. Spinellis <dds@FreeBSD.org> born in Athens, Greece, 1967
+02/02 Michael W Lucas <mwlucas@FreeBSD.org> born in Detroit, Michigan, United States, 1967
+02/02 Dmitry Chagin <dchagin@FreeBSD.org> born in Stalingrad, USSR, 1976
+02/02 Yoichi Nakayama <yoichi@FreeBSD.org> born in Tsu, Mie, Japan, 1976
+02/03 Jason Helfman <jgh@FreeBSD.org> born in Royal Oak, Michigan, United States, 1972
+02/04 Eitan Adler <eadler@FreeBSD.org> born in West Hempstead, New York, United States, 1991
+02/05 Frank Laszlo <laszlof@FreeBSD.org> born in Howell, Michigan, United States, 1983
+02/06 Julien Charbon <jch@FreeBSD.org> born in Saint Etienne, Loire, France, 1978
+02/10 David Greenman <dg@FreeBSD.org> born in Portland, Oregon, United States, 1968
+02/10 Paul Richards <paul@FreeBSD.org> born in Ammanford, Carmarthenshire, United Kingdom, 1968
+02/10 Simon Barner <barner@FreeBSD.org> born in Rosenheim, Bayern, Germany, 1980
+02/10 Jason E. Hale <jhale@FreeBSD.org> born in Pittsburgh, Pennsylvania, Unites States, 1982
+02/13 Jesper Skriver <jesper@FreeBSD.org> born in Aarhus, Denmark, 1975
+02/13 Steve Wills <swills@FreeBSD.org> born in Lynchburg, Virginia, United States, 1975
+02/13 Andrey Slusar <anray@FreeBSD.org> born in Odessa, USSR, 1979
+02/13 David W. Chapman Jr. <dwcjr@FreeBSD.org> born in Bethel, Connecticut, United States, 1981
+02/14 Manolis Kiagias <manolis@FreeBSD.org> born in Chania, Greece, 1970
+02/14 Erwin Lansing <erwin@FreeBSD.org> born in 's-Hertogenbosch, the Netherlands, 1975
+02/14 Martin Blapp <mbr@FreeBSD.org> born in Olten, Switzerland, 1976
+02/15 Hiren Panchasara <hiren@FreeBSD.org> born in Ahmedabad, Gujarat, India, 1984
+02/19 Murray Stokely <murray@FreeBSD.org> born in Jacksonville, Florida, United States, 1979
+02/20 Anders Nordby <anders@FreeBSD.org> born in Oslo, Norway, 1976
+02/21 Alexey Zelkin <phantom@FreeBSD.org> born in Simferopol, Ukraine, 1978
+02/22 Brooks Davis <brooks@FreeBSD.org> born in Longview, Washington, United States, 1976
+02/22 Jake Burkholder <jake@FreeBSD.org> born in Maynooth, Ontario, Canada, 1979
+02/23 Peter Wemm <peter@FreeBSD.org> born in Perth, Western Australia, Australia, 1971
+02/23 Mathieu Arnold <mat@FreeBSD.org> born in Champigny sur Marne, Val de Marne, France, 1978
+02/24 Johan Karlsson <johan@FreeBSD.org> born in Mariannelund, Sweden, 1974
+02/24 Colin Percival <cperciva@FreeBSD.org> born in Burnaby, Canada, 1981
+02/26 Pietro Cerutti <gahr@FreeBSD.org> born in Faido, Switzerland, 1984
+02/28 Daichi GOTO <daichi@FreeBSD.org> born in Shimizu Suntou, Shizuoka, Japan, 1980
+02/28 Ruslan Makhmatkhanov <rm@FreeBSD.org> born in Rostov-on-Don, USSR, 1984
+03/01 Hye-Shik Chang <perky@FreeBSD.org> born in Daejeon, Republic of Korea, 1980
+03/02 Cy Schubert <cy@FreeBSD.org> born in Edmonton, Alberta, Canada, 1956
+03/03 Sergey Matveychuk <sem@FreeBSD.org> born in Moscow, Russian Federation, 1973
+03/03 Doug White <dwhite@FreeBSD.org> born in Eugene, Oregon, United States, 1977
+03/03 Gordon Tetlow <gordon@FreeBSD.org> born in Reno, Nevada, United States, 1978
+03/04 Oleksandr Tymoshenko <gonzo@FreeBSD.org> born in Chernihiv, Ukraine, 1980
+03/05 Baptiste Daroussin <bapt@FreeBSD.org> born in Beauvais, France, 1980
+03/05 Philip Paeps <philip@FreeBSD.org> born in Leuven, Belgium, 1983
+03/05 Ulf Lilleengen <lulf@FreeBSD.org> born in Hamar, Norway, 1985
+03/06 Christopher Piazza <cpiazza@FreeBSD.org> born in Kamloops, British Columbia, Canada, 1981
+03/07 Michael P. Pritchard <mpp@FreeBSD.org> born in Los Angeles, California, United States, 1964
+03/07 Giorgos Keramidas <keramida@FreeBSD.org> born in Athens, Greece, 1976
+03/10 Andreas Klemm <andreas@FreeBSD.org> born in Duesseldorf, Nordrhein-Westfalen, Germany, 1963
+03/11 Soeren Straarup <xride@FreeBSD.org> born in Andst, Denmark, 1978
+03/12 Greg Lewis <glewis@FreeBSD.org> born in Adelaide, South Australia, Australia, 1969
+03/13 Alexander Leidinger <netchild@FreeBSD.org> born in Neunkirchen, Saarland, Germany, 1976
+03/13 Will Andrews <will@FreeBSD.org> born in Pontiac, Michigan, United States, 1982
+03/14 Bernhard Froehlich <decke@FreeBSD.org> born in Graz, Styria, Austria, 1985
+03/15 Paolo Pisati <piso@FreeBSD.org> born in Lodi, Italy, 1977
+03/15 Brian Fundakowski Feldman <green@FreeBSD.org> born in Alexandria, Virginia, United States, 1983
+03/17 Michael Smith <msmith@FreeBSD.org> born in Bankstown, New South Wales, Australia, 1971
+03/17 Alexander Motin <mav@FreeBSD.org> born in Simferopol, Ukraine, 1979
+03/18 Koop Mast <kwm@FreeBSD.org> born in Dokkum, the Netherlands, 1981
+03/19 Mikhail Teterin <mi@FreeBSD.org> born in Kyiv, Ukraine, 1972
+03/20 Joseph S. Atkinson <jsa@FreeBSD.org> born in Batesville, Arkansas, United States, 1977
+03/20 Henrik Brix Andersen <brix@FreeBSD.org> born in Aarhus, Denmark, 1978
+03/20 MANTANI Nobutaka <nobutaka@FreeBSD.org> born in Hiroshima, Japan, 1978
+03/20 Cameron Grant <cg@FreeBSD.org> died in Hemel Hempstead, United Kingdom, 2005
+03/22 Brad Davis <brd@FreeBSD.org> born in Farmington, New Mexico, United States, 1983
+03/23 Daniel C. Sobral <dcs@FreeBSD.org> born in Brasilia, Distrito Federal, Brazil, 1971
+03/23 Benno Rice <benno@FreeBSD.org> born in Adelaide, South Australia, Australia, 1977
+03/24 Marcel Moolenaar <marcel@FreeBSD.org> born in Hilversum, the Netherlands, 1968
+03/24 Emanuel Haupt <ehaupt@FreeBSD.org> born in Zurich, Switzerland, 1979
+03/25 Andrew R. Reiter <arr@FreeBSD.org> born in Springfield, Massachusetts, United States, 1980
+03/27 Josef El-Rayes <josef@FreeBSD.org> born in Linz, Austria, 1982
+03/28 Sean C. Farley <scf@FreeBSD.org> born in Indianapolis, Indiana, United States, 1970
+03/29 Thierry Thomas <thierry@FreeBSD.org> born in Luxeuil les Bains, France, 1961
+03/30 Po-Chuan Hsieh <sunpoet@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1978
+03/31 First quarter status reports are due on 04/15
+04/01 Matthew Jacob <mjacob@FreeBSD.org> born in San Francisco, California, United States, 1958
+04/01 Bill Fenner <fenner@FreeBSD.org> born in Bellefonte, Pennsylvania, United States, 1971
+04/01 Peter Edwards <peadar@FreeBSD.org> born in Dublin, Ireland, 1973
+04/03 Hellmuth Michaelis <hm@FreeBSD.org> born in Kiel, Schleswig-Holstein, Germany, 1958
+04/03 Tong Liu <nemoliu@FreeBSD.org> born in Beijing, People's Republic of China, 1981
+04/03 Gabor Pali <pgj@FreeBSD.org> born in Kunhegyes, Hungary, 1982
+04/04 Jason Unovitch <junovitch@FreeBSD.org> born in Scranton, Pennsylvania, United States, 1986
+04/05 Stacey Son <sson@FreeBSD.org> born in Burley, Idaho, United States, 1967
+04/06 Peter Jeremy <peterj@FreeBSD.org> born in Sydney, New South Wales, Australia, 1961
+04/07 Edward Tomasz Napierala <trasz@FreeBSD.org> born in Wolsztyn, Poland, 1981
+04/08 Jordan K. Hubbard <jkh@FreeBSD.org> born in Honolulu, Hawaii, United States, 1963
+04/09 Ceri Davies <ceri@FreeBSD.org> born in Haverfordwest, Pembrokeshire, United Kingdom, 1976
+04/11 Bruce A. Mah <bmah@FreeBSD.org> born in Fresno, California, United States, 1969
+04/12 Patrick Gardella <patrick@FreeBSD.org> born in Columbus, Ohio, United States, 1967
+04/12 Ed Schouten <ed@FreeBSD.org> born in Oss, the Netherlands, 1986
+04/13 Oliver Braun <obraun@FreeBSD.org> born in Nuremberg, Bavaria, Germany, 1972
+04/14 Crist J. Clark <cjc@FreeBSD.org> born in Milwaukee, Wisconsin, United States, 1970
+04/14 Glen J. Barber <gjb@FreeBSD.org> born in Wilkes-Barre, Pennsylvania, United States, 1981
+04/15 David Malone <dwmalone@FreeBSD.org> born in Dublin, Ireland, 1973
+04/17 Alexey Degtyarev <alexey@FreeBSD.org> born in Ahtubinsk, Russian Federation, 1984
+04/17 Dryice Liu <dryice@FreeBSD.org> born in Jinan, Shandong, China, 1975
+04/22 Joerg Wunsch <joerg@FreeBSD.org> born in Dresden, Sachsen, Germany, 1962
+04/22 Jun Kuriyama <kuriyama@FreeBSD.org> born in Matsue, Shimane, Japan, 1973
+04/22 Jakub Klama <jceel@FreeBSD.org> born in Blachownia, Silesia, Poland, 1989
+04/26 Rene Ladan <rene@FreeBSD.org> born in Geldrop, the Netherlands, 1980
+04/29 Adam Weinberger <adamw@FreeBSD.org> born in Berkeley, California, United States, 1980
+04/29 Eric Anholt <anholt@FreeBSD.org> born in Portland, Oregon, United States, 1983
+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
+05/08 Sean Kelly <smkelly@FreeBSD.org> born in Walnut Creek, California, United States, 1982
+05/09 Daniel Eischen <deischen@FreeBSD.org> born in Syracuse, New York, United States, 1963
+05/09 Aaron Dalton <aaron@FreeBSD.org> born in Boise, Idaho, United States, 1973
+05/09 Jase Thew <jase@FreeBSD.org> born in Abergavenny, Gwent, United Kingdom, 1974
+05/10 Markus Brueffer <markus@FreeBSD.org> born in Gronau, Nordrhein-Westfalen, Germany, 1977
+05/11 Kurt Lidl <lidl@FreeBSD.org> born in Rockville, Maryland, United States, 1968
+05/11 Jesus Rodriguez <jesusr@FreeBSD.org> born in Barcelona, Spain, 1972
+05/11 Roman Kurakin <rik@FreeBSD.org> born in Moscow, USSR, 1979
+05/11 Ulrich Spoerlein <uqs@FreeBSD.org> born in Schesslitz, Bayern, Germany, 1981
+05/13 Pete Fritchman <petef@FreeBSD.org> born in Lansdale, Pennsylvania, United States, 1983
+05/14 Tatsumi Hosokawa <hosokawa@FreeBSD.org> born in Tokyo, Japan, 1968
+05/14 Shigeyuku Fukushima <shige@FreeBSD.org> born in Osaka, Japan, 1974
+05/14 Bruce Cran <brucec@FreeBSD.org> born in Cambridge, United Kingdom, 1981
+05/16 Johann Kois <jkois@FreeBSD.org> born in Wolfsberg, Austria, 1975
+05/16 Marcus Alves Grando <mnag@FreeBSD.org> born in Florianopolis, Santa Catarina, Brazil, 1979
+05/17 Thomas Abthorpe <tabthorpe@FreeBSD.org> born in Port Arthur, Ontario, Canada, 1968
+05/19 Philippe Charnier <charnier@FreeBSD.org> born in Fontainebleau, France, 1966
+05/19 Ian Dowse <iedowse@FreeBSD.org> born in Dublin, Ireland, 1975
+05/19 Sofian Brabez <sbz@FreeBSD.org> born in Toulouse, France, 1984
+05/20 Dan Moschuk <dan@FreeBSD.org> died in Burlington, Ontario, Canada, 2010
+05/21 Kris Kennaway <kris@FreeBSD.org> born in Winnipeg, Manitoba, Canada, 1978
+05/22 Clive Tong-I Lin <clive@FreeBSD.org> born in Changhua, Taiwan, Republic of China, 1978
+05/22 Michael Bushkov <bushman@FreeBSD.org> born in Rostov-on-Don, Russian Federation, 1985
+05/22 Rui Paulo <rpaulo@FreeBSD.org> born in Evora, Portugal, 1986
+05/22 David Naylor <dbn@FreeBSD.org> born in Johannesburg, South Africa, 1988
+05/23 Munechika Sumikawa <sumikawa@FreeBSD.org> born in Osaka, Osaka, Japan, 1972
+05/24 Duncan McLennan Barclay <dmlb@FreeBSD.org> born in London, Middlesex, United Kingdom, 1970
+05/24 Oliver Lehmann <oliver@FreeBSD.org> born in Karlsburg, Germany, 1981
+05/25 Tom Rhodes <trhodes@FreeBSD.org> born in Ellwood City, Pennsylvania, United States, 1981
+05/25 Roman Divacky <rdivacky@FreeBSD.org> born in Brno, Czech Republic, 1983
+05/26 Jim Pirzyk <pirzyk@FreeBSD.org> born in Chicago, Illinois, United States, 1968
+05/26 Florian Smeets <flo@FreeBSD.org> born in Schwerte, Nordrhein-Westfalen, Germany, 1982
+05/27 Ollivier Robert <roberto@FreeBSD.org> born in Paris, France, 1967
+05/29 Wilko Bulte <wilko@FreeBSD.org> born in Arnhem, the Netherlands, 1965
+05/29 Seigo Tanimura <tanimura@FreeBSD.org> born in Kitakyushu, Fukuoka, Japan, 1976
+05/31 Ville Skytta <scop@FreeBSD.org> born in Helsinki, Finland, 1974
+06/02 Jean-Marc Zucconi <jmz@FreeBSD.org> born in Pontarlier, France, 1954
+06/02 Alexander Botero-Lowry <alexbl@FreeBSD.org> born in Austin, Texas, United States, 1986
+06/03 CHOI Junho <cjh@FreeBSD.org> born in Seoul, Korea, 1974
+06/03 Wesley Shields <wxs@FreeBSD.org> born in Binghamton, New York, United States, 1981
+06/04 Julian Elischer <julian@FreeBSD.org> born in Perth, Australia, 1959
+06/04 Justin Gibbs <gibbs@FreeBSD.org> born in San Pedro, California, United States, 1973
+06/04 Jason Evans <jasone@FreeBSD.org> born in Greeley, Colorado, United States, 1973
+06/04 Thomas Moestl <tmm@FreeBSD.org> born in Braunschweig, Niedersachsen, Germany, 1980
+06/04 Devin Teske <dteske@FreeBSD.org> born in Arcadia, California, United States, 1982
+06/04 Zack Kirsch <zack@FreeBSD.org> born in Memphis, Tennessee, United States, 1982
+06/04 Johannes Jost Meixner <xmj@FreeBSD.org> born in Wiesbaden, Germany, 1987
+06/06 Sergei Kolobov <sergei@FreeBSD.org> born in Karpinsk, Russian Federation, 1972
+06/06 Alan Eldridge <alane@FreeBSD.org> died in Denver, Colorado, 2003
+06/07 Jimmy Olgeni <olgeni@FreeBSD.org> born in Milano, Italy, 1976
+06/07 Benjamin Close <benjsc@FreeBSD.org> born in Adelaide, Australia, 1978
+06/11 Alonso Cardenas Marquez <acm@FreeBSD.org> born in Arequipa, Peru, 1979
+06/14 Josh Paetzel <jpaetzel@FreeBSD.org> born in Minneapolis, Minnesota, United States, 1973
+06/17 Tilman Linneweh <arved@FreeBSD.org> born in Weinheim, Baden-Wuerttemberg, Germany, 1978
+06/18 Li-Wen Hsu <lwhsu@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1984
+06/18 Roman Bogorodskiy <novel@FreeBSD.org> born in Saratov, Russian Federation, 1986
+06/19 Charlie Root <root@FreeBSD.org> born in Portland, Oregon, United States, 1993
+06/21 Ganbold Tsagaankhuu <ganbold@FreeBSD.org> born in Ulaanbaatar, Mongolia, 1971
+06/21 Niels Heinen <niels@FreeBSD.org> born in Markelo, the Netherlands, 1978
+06/22 Andreas Tobler <andreast@FreeBSD.org> born in Heiden, Switzerland, 1968
+06/24 Chris Faulhaber <jedgar@FreeBSD.org> born in Springfield, Illinois, United States, 1971
+06/26 Brian Somers <brian@FreeBSD.org> born in Dundrum, Dublin, Ireland, 1967
+06/28 Mark Santcroos <marks@FreeBSD.org> born in Rotterdam, the Netherlands, 1979
+06/28 Xin Li <delphij@FreeBSD.org> born in Beijing, People's Republic of China, 1982
+06/29 Wilfredo Sanchez Vega <wsanchez@FreeBSD.org> born in Majaguez, Puerto Rico, United States, 1972
+06/29 Daniel Harris <dannyboy@FreeBSD.org> born in Lubbock, Texas, United States, 1985
+06/29 Andrew Pantyukhin <sat@FreeBSD.org> born in Moscow, Russian Federation, 1985
+06/30 Guido van Rooij <guido@FreeBSD.org> born in Best, Noord-Brabant, the Netherlands, 1965
+06/30 Second quarter status reports are due on 07/15
+07/01 Matthew Dillon <dillon@apollo.backplane.net> born in San Francisco, California, United States, 1966
+07/02 Mark Christopher Ovens <marko@FreeBSD.org> born in Preston, Lancashire, United Kingdom, 1958
+07/02 Vasil Venelinov Dimov <vd@FreeBSD.org> born in Shumen, Bulgaria, 1982
+07/04 Motoyuki Konno <motoyuki@FreeBSD.org> born in Musashino, Tokyo, Japan, 1969
+07/04 Florent Thoumie <flz@FreeBSD.org> born in Montmorency, Val d'Oise, France, 1982
+07/05 Olivier Cochard-Labbe <olivier@FreeBSD.org> born in Brest, France, 1977
+07/05 Sergey Kandaurov <pluknet@FreeBSD.org> born in Gubkin, Russian Federation, 1985
+07/07 Andrew Thompson <thompsa@FreeBSD.org> born in Lower Hutt, Wellington, New Zealand, 1979
+07/07 Maxime Henrion <mux@FreeBSD.org> born in Metz, France, 1981
+07/07 George Reid <greid@FreeBSD.org> born in Frimley, Hampshire, United Kingdom, 1983
+07/10 Jung-uk Kim <jkim@FreeBSD.org> born in Seoul, Korea, 1971
+07/10 Justin Seger <jseger@FreeBSD.org> born in Harvard, Massachusetts, United States, 1981
+07/10 David Schultz <das@FreeBSD.org> born in Oakland, California, United States, 1982
+07/10 Ben Woods <woodsb02@FreeBSD.org> born in Perth, Western Australia, Australia, 1984
+07/11 Jesus R. Camou <jcamou@FreeBSD.org> born in Hermosillo, Sonora, Mexico, 1983
+07/15 Gary Jennejohn <gj@FreeBSD.org> born in Rochester, New York, United States, 1950
+07/16 Suleiman Souhlal <ssouhlal@FreeBSD.org> born in Roma, Italy, 1983
+07/16 Davide Italiano <davide@FreeBSD.org> born in Milazzo, Italy, 1989
+07/17 Michael Chin-Yuan Wu <keichii@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1980
+07/19 Masafumi NAKANE <max@FreeBSD.org> born in Okazaki, Aichi, Japan, 1972
+07/19 Simon L. Nielsen <simon@FreeBSD.org> born in Copenhagen, Denmark, 1980
+07/19 Gleb Smirnoff <glebius@FreeBSD.org> born in Kharkov, USSR, 1981
+07/20 Andrey V. Elsukov <ae@FreeBSD.org> born in Kotelnich, Russian Federation, 1981
+07/22 James Housley <jeh@FreeBSD.org> born in Chicago, Illinois, United States, 1965
+07/22 Jens Schweikhardt <schweikh@FreeBSD.org> born in Waiblingen, Baden-Wuerttemberg, Germany, 1967
+07/22 Lukas Ertl <le@FreeBSD.org> born in Weissenbach/Enns, Steiermark, Austria, 1976
+07/23 Sergey A. Osokin <osa@FreeBSD.org> born in Krasnogorsky, Stepnogorsk, Akmolinskaya region, Kazakhstan, 1972
+07/23 Andrey Zonov <zont@FreeBSD.org> born in Kirov, Russian Federation, 1985
+07/24 Alexander Nedotsukov <bland@FreeBSD.org> born in Ulyanovsk, Russian Federation, 1974
+07/24 Alberto Villa <avilla@FreeBSD.org> born in Vercelli, Italy, 1987
+07/27 Andriy Gapon <avg@FreeBSD.org> born in Kyrykivka, Sumy region, Ukraine, 1976
+07/28 Jim Mock <jim@FreeBSD.org> born in Bethlehem, Pennsylvania, United States, 1974
+07/28 Tom Hukins <tom@FreeBSD.org> born in Manchester, United Kingdom, 1976
+07/29 Dirk Meyer <dinoex@FreeBSD.org> born in Kassel, Hessen, Germany, 1965
+07/29 Felippe M. Motta <lippe@FreeBSD.org> born in Maceio, Alagoas, Brazil, 1988
+08/02 Gabor Kovesdan <gabor@FreeBSD.org> born in Budapest, Hungary, 1987
+08/03 Peter Holm <pho@FreeBSD.org> born in Copenhagen, Denmark, 1955
+08/05 Alfred Perlstein <alfred@FreeBSD.org> born in Brooklyn, New York, United States, 1978
+08/06 Anton Berezin <tobez@FreeBSD.org> born in Dnepropetrovsk, Ukraine, 1970
+08/06 John-Mark Gurney <jmg@FreeBSD.org> born in Detroit, Michigan, United States, 1978
+08/06 Damjan Marion <dmarion@FreeBSD.org> born in Rijeka, Croatia, 1978
+08/07 Jonathan Mini <mini@FreeBSD.org> born in San Mateo, California, United States, 1979
+08/08 Mikolaj Golub <trociny@FreeBSD.org> born in Kharkov, USSR, 1977
+08/08 Juergen Lock <nox@FreeBSD.org> died in Bremen, Germany, 2015
+08/09 Stefan Farfeleder <stefanf@FreeBSD.org> died in Wien, Austria, 2015
+08/10 Julio Merino <jmmv@FreeBSD.org> born in Barcelona, Spain, 1984
+08/10 Peter Pentchev <roam@FreeBSD.org> born in Sofia, Bulgaria, 1977
+08/12 Joe Marcus Clarke <marcus@FreeBSD.org> born in Lakeland, Florida, United States, 1976
+08/12 Max Brazhnikov <makc@FreeBSD.org> born in Leningradskaya, Russian Federation, 1979
+08/14 Stefan Esser <se@FreeBSD.org> born in Cologne, Nordrhein-Westfalen, Germany, 1961
+08/17 Olivier Houchard <cognet@FreeBSD.org> born in Nancy, France, 1980
+08/19 Chin-San Huang <chinsan@FreeBSD.org> born in Yi-Lan, Taiwan, Republic of China, 1979
+08/19 Pav Lucistnik <pav@FreeBSD.org> born in Kutna Hora, Czech Republic, 1980
+08/20 Michael Heffner <mikeh@FreeBSD.org> born in Cleona, Pennsylvania, United States, 1981
+08/24 Mark Linimon <linimon@FreeBSD.org> born in Houston, Texas, United States, 1955
+08/24 Alexander Botero-Lowry <alexbl@FreeBSD.org> died in San Francisco, California, United States, 2012
+08/25 Beech Rintoul <beech@FreeBSD.org> born in Oakland, California, United States, 1952
+08/25 Jean Milanez Melo <jmelo@FreeBSD.org> born in Divinopolis, Minas Gerais, Brazil, 1982
+08/26 Dima Ruban <dima@FreeBSD.org> born in Nalchik, USSR, 1970
+08/26 Marc Fonvieille <blackend@FreeBSD.org> born in Avignon, France, 1972
+08/26 Herve Quiroz <hq@FreeBSD.org> born in Aix-en-Provence, France, 1977
+08/27 Andrey Chernov <ache@FreeBSD.org> born in Moscow, USSR, 1966
+08/27 Tony Finch <fanf@FreeBSD.org> born in London, United Kingdom, 1974
+08/27 Michael Johnson <ahze@FreeBSD.org> born in Morganton, North Carolina, United States, 1980
+08/28 Norikatsu Shigemura <nork@FreeBSD.org> born in Fujisawa, Kanagawa, Japan, 1974
+08/29 Thomas Gellekum <tg@FreeBSD.org> born in Moenchengladbach, Nordrhein-Westfalen, Germany, 1967
+08/29 Max Laier <mlaier@FreeBSD.org> born in Karlsruhe, Germany, 1981
+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
+09/09 Yoshio Mita <mita@FreeBSD.org> born in Hiroshima, Japan, 1972
+09/10 Wesley R. Peters <wes@FreeBSD.org> born in Hartford, Alabama, United States, 1961
+09/12 Weongyo Jeong <weongyo@FreeBSD.org> born in Haman, Korea, 1980
+09/12 Benedict Christopher Reuschling <bcr@FreeBSD.org> born in Darmstadt, Germany, 1981
+09/12 William C. Fumerola II <billf@FreeBSD.org> born in Detroit, Michigan, United States, 1981
+09/14 Matthew Seaman <matthew@FreeBSD.org> born in Bristol, United Kingdom, 1965
+09/15 Aleksandr Rybalko <ray@FreeBSD.org> born in Odessa, Ukraine, 1977
+09/15 Dima Panov <fluffy@FreeBSD.org> born in Khabarovsk, Russian Federation, 1978
+09/17 Maxim Bolotin <mb@FreeBSD.org> born in Rostov-on-Don, Russian Federation, 1976
+09/18 Matthew Fleming <mdf@FreeBSD.org> born in Cleveland, Ohio, United States, 1975
+09/20 Kevin Lo <kevlo@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1972
+09/21 Gleb Kurtsou <gleb@FreeBSD.org> born in Minsk, Belarus, 1984
+09/22 Bryan Drewery <bdrewery@FreeBSD.org> born in San Diego, California, United States, 1984
+09/27 Neil Blakey-Milner <nbm@FreeBSD.org> born in Port Elizabeth, South Africa, 1978
+09/27 Renato Botelho <garga@FreeBSD.org> born in Araras, Sao Paulo, Brazil, 1979
+09/28 Greg Lehey <grog@FreeBSD.org> born in Melbourne, Victoria, Australia, 1948
+09/28 Alex Dupre <ale@FreeBSD.org> born in Milano, Italy, 1980
+09/29 Matthew Hunt <mph@FreeBSD.org> born in Johnstown, Pennsylvania, United States, 1976
+09/30 Mark Felder <feld@FreeBSD.org> born in Prairie du Chien, Wisconsin, United States, 1985
+09/30 Hiten M. Pandya <hmp@FreeBSD.org> born in Dar-es-Salaam, Tanzania, East Africa, 1986
+09/30 Third quarter status reports are due on 10/15
+10/02 Beat Gaetzi <beat@FreeBSD.org> born in Zurich, Switzerland, 1980
+10/02 Grzegorz Blach <gblach@FreeBSD.org> born in Starachowice, Poland, 1985
+10/05 Hiroki Sato <hrs@FreeBSD.org> born in Yamagata, Japan, 1977
+10/05 Chris Costello <chris@FreeBSD.org> born in Houston, Texas, United States, 1985
+10/09 Stefan Walter <stefan@FreeBSD.org> born in Werne, Nordrhein-Westfalen, Germany, 1978
+10/12 Pawel Jakub Dawidek <pjd@FreeBSD.org> born in Radzyn Podlaski, Poland, 1980
+10/15 Maxim Konovalov <maxim@FreeBSD.org> born in Khabarovsk, USSR, 1973
+10/16 Remko Lodder <remko@FreeBSD.org> born in Rotterdam, the Netherlands, 1983
+10/17 Maho NAKATA <maho@FreeBSD.org> born in Osaka, Japan, 1974
+10/18 Sheldon Hearn <sheldonh@FreeBSD.org> born in Cape Town, Western Cape, South Africa, 1974
+10/19 Nicholas Souchu <nsouch@FreeBSD.org> born in Suresnes, Hauts-de-Seine, France, 1972
+10/19 Nick Barkas <snb@FreeBSD.org> born in Longview, Washington, United States, 1981
+10/20 Joel Dahl <joel@FreeBSD.org> born in Bitterna, Skaraborg, Sweden, 1983
+10/20 Dmitry Marakasov <amdmi3@FreeBSD.org> born in Moscow, Russian Federation, 1984
+10/21 Ben Smithurst <ben@FreeBSD.org> born in Sheffield, South Yorkshire, United Kingdom, 1981
+10/22 Jean-Sebastien Pedron <dumbbell@FreeBSD.org> born in Redon, Ille-et-Vilaine, France, 1980
+10/23 Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> born in Brasilia, Distrito Federal, Brazil, 1976
+10/25 Eric Melville <eric@FreeBSD.org> born in Los Gatos, California, United States, 1980
+10/25 Julien Laffaye <jlaffaye@FreeBSD.org> born in Toulouse, France, 1988
+10/25 Ashish SHUKLA <ashish@FreeBSD.org> born in Kanpur, India, 1985
+10/26 Matthew Ahrens <mahrens@FreeBSD.org> born in United States, 1979
+10/26 Philip M. Gollucci <pgollucci@FreeBSD.org> born in Silver Spring, Maryland, United States, 1979
+10/27 Takanori Watanabe <takawata@FreeBSD.org> born in Numazu, Shizuoka, Japan, 1972
+11/05 M. Warner Losh <imp@FreeBSD.org> born in Kansas City, Kansas, United States, 1966
+11/09 Coleman Kane <cokane@FreeBSD.org> born in Cincinnati, Ohio, United States, 1980
+11/09 Antoine Brodin <antoine@FreeBSD.org> born in Bagnolet, France, 1981
+11/10 Gregory Neil Shapiro <gshapiro@FreeBSD.org> born in Providence, Rhode Island, United States, 1970
+11/11 Danilo E. Gondolfo <danilo@FreeBSD.org> born in Lobato, Parana, Brazil, 1987
+11/13 John Baldwin <jhb@FreeBSD.org> born in Stuart, Virginia, United States, 1977
+11/14 Jeremie Le Hen <jlh@FreeBSD.org> born in Nancy, France, 1980
+11/15 Lars Engels <lme@FreeBSD.org> born in Hilden, Nordrhein-Westfalen, Germany, 1980
+11/15 Tijl Coosemans <tijl@FreeBSD.org> born in Duffel, Belgium, 1983
+11/16 Jose Maria Alcaide Salinas <jmas@FreeBSD.org> born in Madrid, Spain, 1962
+11/17 Ralf S. Engelschall <rse@FreeBSD.org> born in Dachau, Bavaria, Germany, 1972
+11/18 Thomas Quinot <thomas@FreeBSD.org> born in Paris, France, 1977
+11/19 Konstantin Belousov <kib@FreeBSD.org> born in Kiev, USSR, 1972
+11/20 Dmitry Morozovsky <marck@FreeBSD.org> born in Moscow, USSR, 1968
+11/20 Gavin Atkinson <gavin@FreeBSD.org> born in Middlesbrough, United Kingdom, 1979
+11/21 Mark Johnston <markj@FreeBSD.org> born in Toronto, Ontario, Canada, 1989
+11/22 Frederic Culot <culot@FreeBSD.org> born in Saint-Germain-En-Laye, France, 1976
+11/23 Josef Lawrence Karthauser <joe@FreeBSD.org> born in Pembury, Kent, United Kingdom, 1972
+11/24 Andrey Zakhvatov <andy@FreeBSD.org> born in Chelyabinsk, Russian Federation, 1974
+11/24 Daniel Gerzo <danger@FreeBSD.org> born in Bratislava, Slovakia, 1986
+11/28 Nik Clayton <nik@FreeBSD.org> born in Peterborough, United Kingdom, 1973
+11/28 Stanislav Sedov <stas@FreeBSD.org> born in Chelyabinsk, USSR, 1985
+12/01 Hajimu Umemoto <ume@FreeBSD.org> born in Nara, Japan, 1961
+12/01 Alexey Dokuchaev <danfe@FreeBSD.org> born in Magadan, USSR, 1980
+12/02 Ermal Luçi <eri@FreeBSD.org> born in Tirane, Albania, 1980
+12/03 Diane Bruce <db@FreeBSD.org> born in Ottawa, Ontario, Canada, 1952
+12/04 Mariusz Zaborski <oshogbo@FreeBSD.org> born in Skierniewice, Poland, 1990
+12/05 Ivan Voras <ivoras@FreeBSD.org> born in Slavonski Brod, Croatia, 1981
+12/06 Stefan Farfeleder <stefanf@FreeBSD.org> born in Wien, Austria, 1980
+12/11 Ganael Laplanche <martymac@FreeBSD.org> born in Reims, France, 1980
+12/15 James FitzGibbon <jfitz@FreeBSD.org> born in Amersham, Buckinghamshire, United Kingdom, 1974
+12/15 Timur I. Bakeyev <timur@FreeBSD.org> born in Kazan, Republic of Tatarstan, USSR, 1974
+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 Muhammad Moinur Rahman <bofh@FreeBSD.org> born in Dhaka, Bangladesh, 1983
+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
+12/23 Alejandro Pulver <alepulver@FreeBSD.org> born in Buenos Aires, Argentina, 1989
+12/24 Guido Falsi <madpilot@FreeBSD.org> born in Firenze, Italy, 1978
+12/25 Niclas Zeising <zeising@FreeBSD.org> born in Stockholm, Sweden, 1986
+12/28 Soren Schmidt <sos@FreeBSD.org> born in Maribo, Denmark, 1960
+12/28 Ade Lovett <ade@FreeBSD.org> born in London, England, 1969
+12/28 Marius Strobl <marius@FreeBSD.org> born in Cham, Bavaria, Germany, 1978
+12/31 Edwin Groothuis <edwin@FreeBSD.org> born in Geldrop, the Netherlands, 1970
+12/31 Fourth quarter status reports are due on 01/15
+
+#endif /* !_calendar_freebsd_ */
diff --git a/usr.bin/calendar/calendars/calendar.french b/usr.bin/calendar/calendars/calendar.french
new file mode 100644
index 0000000..18b4d8a
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.french
@@ -0,0 +1,12 @@
+/*
+ * French calendar file(s)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_french_
+#define _calendar_french_
+
+#include <fr_FR.ISO8859-1/calendar.all>
+
+#endif /* !_calendar_french_ */
diff --git a/usr.bin/calendar/calendars/calendar.german b/usr.bin/calendar/calendars/calendar.german
new file mode 100644
index 0000000..635aef1
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.german
@@ -0,0 +1,12 @@
+/*
+ * German calendar file(s)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_german_
+#define _calendar_german_
+
+#include <de_DE.ISO8859-1/calendar.all>
+
+#endif /* !_calendar_german_ */
diff --git a/usr.bin/calendar/calendars/calendar.history b/usr.bin/calendar/calendars/calendar.history
new file mode 100644
index 0000000..e343293
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.history
@@ -0,0 +1,475 @@
+/*
+ * History
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_history_
+#define _calendar_history_
+
+01/01 Anniversary of the Triumph of the Revolution in Cuba
+01/01 Castro expels Cuban President Batista, 1959
+01/01 Churchill delivers his "Iron Curtain" speech, 1947
+01/01 First Rose Bowl; Michigan 49 - Stanford 0, 1902
+01/04 Quadrantid meteor shower (look north)
+01/05 -50 degrees F, Strawberry UT, 1913
+01/05 The FCC hears the first demonstration of FM radio, 1940
+01/05 Twelfth night
+01/06 Millard Fillmore's birthday (let's party!)
+01/08 Battle of New Orleans
+01/09 Plough Monday
+01/10 First meeting of United Nations General Assembly in London, 1946
+01/10 Thomas Paine's Common Sense published, 1776
+01/11 Anniversary of the Peoples Republic of Albania
+01/11 De Hostos' Birthday in Puerto Rico
+01/11 Milk delivered in bottles for first time, 1878
+01/11 Prithvi Jayanti in Nepal
+01/11 Surgeon General condemned cigarettes, 1964
+01/11 The Whiskey-A-Go-Go opens on Sunset Boulevard in Los Angeles, 1963
+01/14 The first "Be-In" is held in Golden Gate Park, 1967
+01/16 Prohibition begins, 1920
+01/18 Grey whale migration, California
+01/20 St. Agnes Eve (Ah, bitter chill it was...)
+01/24 Eskimo Pie patented by Christian Nelson, 1922
+01/24 Gold discovered in California at Sutter's Mill, 1848
+01/26 Sydney, New South Wales settled, 1788
+01/27 Grissom, White and Chaffe burned to death in Apollo 1, 1967
+01/27 Vietnam War cease-fire signed, 1973
+01/28 First ski tow, Woodstock VT, 1914
+01/28 Space Shuttle Challenger (51-L) explodes 74 seconds after liftoff
+ killing Scobee, Smith, McNair, Resnick, Jarvis, Onizuka and McAuliffe,
+ 1986
+01/30 Mohandas Gandhi assassinated in New Delhi by Hindu fanatic, 1948
+01/30 Tet Offensive, 1968
+01/31 "Ham" the chimpanzee soars into space aboard Mercury-Redstone 2, 1961
+01/31 Explorer I launched, 1958. Van Allen Belt discovered
+01/31 Irving Langmuir, 1881, invented tungsten filament lamp
+02/01 First TV soap: Secret Storm, 1954
+02/01 Forces led by Khomeini take over Iran, 1979
+02/01 Space Shuttle Columbia (STS-107) disintegrates 15 minutes before landing
+ killing Husband, McCool, Chawla, Clark, Ramon, Brown, and Anderson, 2003
+02/04 Cybernet inaugurated, 1969
+02/04 Patricia Hearst kidnapped by Symbionese Liberation Army, 1974
+02/08 1963 Revolution Anniversary in Iraq
+02/09 -51 degrees F, Vanderbilt MI, 1934
+02/12 US President Abraham Lincoln's real birthday
+02/12 Santa Barbara oil leak, 1969
+02/14 Bombing of Dresden, 1945
+02/15 Chicago Seven convicted, 1970
+02/16 Nylon patented, 1937
+02/16 Stephen Decatur burns US frigate in Tripoli, 1804
+02/18 Pluto discovered by Clyde Tombaugh, Lowell Observatory, AZ, 1930
+02/19 US Marines land on Iwo Jima, 1945
+02/20 John Glenn orbits the Earth 3 times, 1962
+02/21 Battle of Verdun begins, 1916 1M casualties
+02/21 First telephone directory, New Haven, Connecticut, 1878
+02/21 Malcom X shot to death in Harlem, 1965
+02/23 Lt. Calley confesses, implicates Cpt. Medina, 1971
+02/24 Impeachment proceedings against Andrew Johnson begin, 1868
+02/28 The "French Connection" drug bust occurs in Marseilles, 1972
+02/29 French and Indian raid on Deerfield MA, 1704
+03/01 Sarah Goode, Sarah Osborne, and Tituba arrested for witchcraft
+ in Salem, Massachusetts, 1692
+03/02 Blackthorn winds (New England) (Does anyone know what this is?)
+03/04 First meeting of Congress, 1789, in N.Y.C.
+03/13 "Striptease" introduced, Paris, 1894
+03/14 Teddy Roosevelt excludes Japanese laborers from continental US, 1907
+03/15 Day of the 1848 revolution in Hungary
+03/15 Buzzards return to Hinckley OH
+03/15 France assumes protectorate over Vietnam, 1874
+03/15 Watts, Los Angeles, riots kill two, injure 25, 1966
+03/15 Ides of March. Gaius Julius Caesar assassinated by senators,
+ including adoptive son Marcus Junius Brutus Caepio, 44BC
+03/16 MyLai Massacre; 300 non-combatant villagers killed by US infantrymen
+03/16 Robert Goddard launches first liquid-fueled rocket, Auburn MA, 1926
+03/17 Vanguard I launched, 1958. Earth proved pear-shaped
+03/18 Aleksei Leonov performs first spacewalk, 1965
+03/19 Swallows return to Capistrano
+03/20 Radio Caroline, the original British pirate radio station, sinks, 1980
+03/24 Construction of New York subway system begins, 1900
+03/25 Triangle Shirt Waist Fire, 1911
+03/26 Popeye statue unveiled, Crystal City TX Spinach Festival, 1937
+03/27 Khrushchev becomes Premier of Soviet Union, 1958
+03/28 Three Mile Island releases radioactive gas, 1979
+03/29 Swedish settled Christiana (Wilmington) DE, 1638
+03/30 Alaska purchased from Russia for $7.2 million, 1867
+03/30 Five rings around Uranus discovered, 1977
+03/30 Pencil with eraser patented, 1858
+04/01 People of superb intelligence, savoir-faire, etc. born this day.
+04/04 Martin Luther King assassinated in Memphis, Tennessee, 1968
+04/04 NATO Established, 1949
+04/06 Joseph Smith founds Mormon Church, 1830
+04/07 Alewives run, Cape Cod
+04/08 Matthew Flinders and Nicolas Baudin meet in Encounter Bay, 1802
+04/09 Lee surrenders to Grant at Appomattox Courthouse, 1865
+04/12 Confederate troops fire first shots of Civil War at Ft Sumter, 1861
+04/12 Space Shuttle Columbia launched, 1981
+04/12 Yuri Gagarin becomes the first man in space, 1961
+04/13 Laotian New Year (3 days) in Laos
+04/14 US President Abraham Lincoln shot in Ford's Theatre by John Wilkes Booth, 1865
+04/14 Titanic hits iceberg and sinks, 1912
+04/15 US President Abraham Lincoln dies, 1865
+04/15 Ray Kroc opens first McDonalds in Des Plaines, IL, 1955
+04/17 Bay of Pigs invasion crushed by Castro forces, 1961
+04/18 Einstein's Death, 1955
+04/18 First Laundromat opens, Fort Worth Texas, 1934
+04/18 San Francisco earthquake, 1906
+04/19 Landing of the "33" in Uruguay
+04/19 Warsaw Ghetto uprising, 1943
+04/20 Supreme Court unanimously rules in favor of busing, 1971
+04/21 Lyrid meteor shower
+04/22 Vladimir Ilich Ulyanov, called Lenin, Russian political leader, born in Simbirsk, 1870
+04/23 Hank Aaron hits his first home run, 1954
+04/26 William Shakespeare baptized in Stratford-on-Avon, England, 1564,
+ birthdate unknown
+04/27 Magellan killed in Philippines, 1521
+04/29 Zipper patented by Gideon Sindback, 1913
+05/01 Beltaine; Feast of the god Bel, sun god
+05/03 Anti-war protest disrupts business in Washington, 1971
+05/04 Four Kent State students are shot down by the National Guard, 1970
+05/05 John Scopes arrested for teaching evolution, Dayton, TN, 1925
+05/06 Hindenburg explodes and burns upon landing at Lakehurst, NJ, 1937
+05/07 Germany surrenders after WWII, 1945
+05/08 Beginning of ostrich mating season
+05/08 US institutes mining of Haiphong Harbor, 1972
+05/09 94 degrees, New York, 1979
+05/10 Germany invades Low Countries, 1940
+05/10 Nazi bookburning, 1933
+05/14 Beginning of Lewis and Clark Expedition, 1804
+05/14 Nation of Israel proclaimed, 1948
+05/15 Asylum for Inebriates founded, Binghamton NY, 1854
+05/17 24" rain in 11 hours, Pearl River, S. China, 1982
+05/17 Six SLA members killed in televised gun fight, 1974
+05/18 Battle of Las Piedras in Uruguay
+05/18 Napoleon crowned Emperor, 1804
+05/21 Battle of Iquique in Chile
+05/21 US explodes first hydrogen bomb, 1956
+05/22 US Civil War ends, 1865
+05/23 Israeli raid into Argentina to capture Adolf Eichmann, 1960
+05/23 Two Yetis sighted, Mt. Everest, 1953
+05/23 Federal Republic of Germany founded, 1949
+05/24 Battle of Pinchincha in Ecuador
+05/25 Oral Roberts sees 900 foot tall Jesus Christ, Tulsa OK, 1980
+05/25 Successful test of the limelight in Purfleet, England, 1830
+05/26 Congress sets first immigration quotas, 1924
+05/27 Golden Gate Bridge opens, 1937
+05/29 Edmund Hillary and Tenzing Norkay climb Mt. Everest, 1953
+05/29 First food stamps issued, 1961
+05/30 US Marines sent to Nicaragua, 1912
+06/02 Native Americans "granted" citizenship, 1924
+06/04 Roquefort cheese developed, 1070
+06/05 Robert Kennedy assassinated, 1968
+06/05 US leaves the Gold Standard, 1933
+06/06 First drive-in movie, 1933
+06/06 Normandy landing, 1944
+06/10 Death of Alexander the Great, 323 B.C.
+06/10 Denver police tear gas Jethro Tull and 2000 fans at Red Rocks, 1971
+06/11 Greeks seize Troy, 1184BC
+06/13 Pioneer flies past Neptune, and therefore out of the Solar System
+06/14 Sandpaper invented by I. Fischer, Jr., 1834
+06/15 Ben Franklin's kite experiment, 1752
+06/15 Magna Carta signed, 1215
+06/15 Series of photographs by Edward Muggeridge prove to Leland Stanford
+ that all the hooves of a horse are off the ground during the gallop,
+ 1878
+06/16 "The Blues Brothers" premieres in Chicago, 1980
+06/17 China explodes its first Hydrogen bomb, 1967
+06/17 Watergate Democratic National Committee break-in, 1972
+06/19 Julius and Ethel Rosenberg are executed in Sing-Sing prison, 1953
+06/19 Lizzie Bordon acquitted, 1893
+06/20 Victoria crowned, 1837
+06/21 Berlin airlift begins, 1948
+06/21 Sun rises over Heelstone at Stonehenge
+06/22 Civil rights workers disappear in Mississippi, 1964
+06/23 Slavery abolished in England, 1772
+06/24 Senate repeals Gulf of Tonkin resolution, 1970
+06/25 Custer's Last Stand at Little Big Horn, 1876
+06/25 North Korea invades South Korea, 1950
+06/26 Battle of Gettysburg, 1863
+06/26 St. Lawrence Seaway dedicated by Eisenhower & Queen Elizabeth II, 1959
+06/26 Toothbrush invented, 1498
+06/27 100 degrees, Fort Yukon, 1915
+06/27 Bill Graham closes the Fillmore East, 1971
+06/28 Supreme Court decides in favor of Alan Bakke, 1978
+06/30 "That" explosion in Siberia, 1908
+06/30 China and Soviet Union announce split over ideology, 1960
+07/01 Battle of Gettysburg begins, 1863
+07/03 Dog days begin
+07/04 Battles of Vicksburg and Gettysburg won by Union forces, 1863
+07/04 Cloudy, 76 degrees, Philadelphia PA, 1776
+07/04 New York abstains on Declaration of Independence vote, 1776
+07/04 Thoreau enters woods, 1845
+07/06 First `talkie' (talking motion picture) premiere in New York, 1928
+07/06 Lawrence of Arabia captures Aqaba, 1917
+07/07 First radio broadcast of "Dragnet", 1949
+07/07 Terrorists detonate four bombs on London public transport, 2005
+07/08 First public reading of the Declaration of Independence, 1776
+07/08 Liberty Bell cracks while being rung at funeral of John Marshall, 1835
+07/09 10-hour working day set by law, NH, 1847
+07/10 134 degrees in Death Valley, 1913
+07/12 Minimum wages established: 40 cents/hour, 1933
+07/13 Women first compete in Olympic games, 1908
+07/16 Detonation of the first atomic bomb at Alamagordo, NM, 1945
+07/17 Disneyland opens, 1955
+07/18 Ty Cobb gets 4000th base hit, 1927
+07/19 Five Massachusetts women executed for witchcraft, 1692
+07/20 Armstrong and Aldrin land on moon, 1969
+07/21 First Train Robbery, Jesse James gets $3000 near Adair, Iowa, 1873
+07/21 Vietnam divided at 17th parallel, 1954
+07/23 Ice cream cone introduced, St. Louis MO, 1904
+07/24 Scopes Monkey Trial, 1925
+07/30 "In God We Trust" made US motto, 1956
+07/31 Harry S. Truman dedicates N.Y. Int'l Airport @ Idlewild Field, 1948,
+ later JFK
+08/01 Lughnasa; Feast of the god Lugh, a 30 day Celtic feast centers on
+ this day
+08/03 Columbus sets sail for Cathay, 1492
+08/03 USS Nautilus crosses under north polar ice cap, 1958
+08/04 Axe murder of Andrew and Abbey Borden, 1892
+08/04 Bombing of N. Vietnam begins, 1964
+08/04 Britain declares war on Germany starting World War I, 1914
+08/06 Atomic bomb dropped on Hiroshima, 1945
+08/06 Caricom in Barbados
+08/06 Cy Young pitches first game, 1890
+08/08 Montenegro declares war on Germany, 1914
+08/08 Richard Nixon resigns the US presidency, 1974
+08/08 The Great Train Robbery -- $7,368,000, 1963
+08/09 Helter Skelter... the Charles Manson murders take place, 1969
+08/09 Persia defeats Spartan King Leonidas at Thermopylae, 480 BC
+08/09 US/Canada border defined in the Webster-Ashburton Treaty, 1842
+08/09 Atomic bomb dropped on Nagasaki, 1945
+08/09 Singapore secedes from Malaysia, 1965
+08/10 Chicago incorporated as a village of 300 people, 1833
+08/10 US and Panama agree to transfer the canal in the year 2000, 1977
+08/11 Dog days end
+08/11 France Ends War in Indochina, 1954
+08/11 Perseid meteor shower (look north; three days)
+08/12 First test flight of Space Shuttle "Enterprise" from 747, 1977
+08/12 Last US ground troops out of Vietnam, 1972
+08/13 Berlin wall erected, 1961
+08/13 Li'l Abner debut, 1934
+08/14 Social Security begins in US, 1935
+08/15 Gandhi's movement obtains independence for Pakistan and India, 1947
+08/15 Hurricane hits Plymouth Plantation, 1635
+08/16 Roller Coaster patented, 1898
+08/17 First public bath opened in N.Y., 1891
+08/18 Anti-Cigarette League of America formed
+08/19 Air Force cargo plane snares payload from Discoverer 14 spy satellite,
+ marking start of practical military reconnaissance from space, 1960
+08/19 Gail Borden patents condensed milk, 1856
+08/22 Death of King Richard III, 1485, Last of the Plantagenets
+08/22 Joe Walker sets X-15 all time altitude mark (67 miles), 1963
+08/22 St. Columbia reports seeing monster in Loch Ness, 565
+08/23 Sacco and Vanzetti executed, 1927
+08/24 "Alice's Restaurant" premieres in New York and Los Angeles, 1969
+08/24 -126.9 F at Vostok, Antarctica, 1960
+08/24 British troops burn Washington, 1814
+08/25 Gen. De Gaulle leads French forces into Paris, 1944
+08/26 19th amendment of US constitution gives women the vote, 1920
+08/27 "Tarzan of the Apes" published, 1912
+08/27 Krakatoa, Java explodes with a force of 1,300 megatons, 1883
+08/28 Martin Luther King leads over 200,000 in civil rights rally in Washington, DC, 1963
+08/29 Star in Cygnus goes nova and becomes 4th brightest in sky, 1975;
+ Nova Cygni 1975.
+08/30 75 cents a pound tariff set on opium, 1842
+08/30 Japan Stationery Co. sells first felt-tipped pen, 1960
+08/30 St. Rose of Lima in Peru
+08/30 Washington-to-Moscow hot line connected, 1963
+08/31 269 people killed after Korean Airlines 747 shot down by USSR, 1983
+08/31 Mary Anne Nichols becomes Jack the Ripper's first victim, 1888
+08/31 Non-aggression pact signed by USSR and Afghanistan, 1926
+08/31 Federation of Malaya gains independence from Great Britain, 1957
+09/01 Bobby Fischer defeats Boris Spassky in World Chess Match, 1972
+09/01 Joshua A. Norton proclaims himself 'Emperor Norton I', 1859
+09/02 Great Britain adopts Gregorian Calendar, 1752
+09/02 Japan signs unconditional surrender on US battleship `Missouri', 1945
+09/03 Richard ``the Lionheart'' crowned king of England, 1189
+09/03 Anniversary of the Founding of the Republic in San Marino
+09/05 US President Kennedy orders resumption of underground nuclear tests, 1961
+09/05 The first Continental Congress was convened in Philadelphia, 1774
+09/06 149 Pilgrims set forth from England aboard the Mayflower, 1620
+09/06 First Star Trek episode (The Man Trap) aired 1966
+09/06 US President McKinley shot, 1901
+09/06 Somhlolo in Swaziland
+09/08 "Star Trek" debuts on NBC (1966)
+09/08 Jack the Ripper kills again, Annie Chapman is second victim, 1888
+09/08 US President Ford pardons Richard M. Nixon, 1974
+09/09 California becomes the 31st state of the USA, 1850
+09/09 United Colonies is renamed the United States, 1776
+09/10 Mountain Meadows Massacre. Mormons kill Gentile wagon train, 1857
+09/11 CIA-sponsored terrorists overthrow Chilean government, murder President Allende, 1973
+09/11 Terrorists destroy World Trade Center in New York, 2001
+09/12 German paratroopers rescue Mussolini from captivity in Rome, 1943
+09/12 Germany annexes Sudetenland, 1938
+09/13 58 °C (136.4 °F) measured at el Azizia, Libya, 1922
+09/13 British defeat the French at the Plains of Abraham, just outside the walls of Quebec City, 1759
+09/13 Building of Hadrian's Wall begun, 122
+09/13 Chiang Kai-Shek becomes president of China, 1943
+09/14 Benjamin Franklin is sent to France as an American minister, 1778
+09/14 Salem, Massachusetts, is founded, 1629
+09/14 The US Selective Service Act establishes the first peacetime draft, 1940
+09/15 Soviet Premier Nikita Khrushchev begins his 13 day tour of the US, 1959
+09/15 The US Foreign Affairs Dept. becomes the US State Department, 1789
+09/16 The village of Shawmut, Massachusetts, becomes the city of Boston, 1630
+09/16 Malaya, Sabah, Sarawak and Singapore unite to become Malaysia, 1963
+09/17 Battle of Antietam, 1862
+09/18 Victory of Uprona in Burundi
+09/19 New Zealand women get the right to vote, 1893
+09/20 Equal Rights Party nominates Belva Lockwood for US President, 1884
+09/20 First meeting of the American Association for the Advancement of
+ Science, 1848
+09/20 First meeting of the US National Research Council, 1916
+09/20 Magellan leaves Spain on the first Round the World passage, 1519
+09/20 The Roxy Theater opens in Hollywood, 1973
+09/22 US President Lincoln issues the Emancipation Proclamation, 1862
+09/22 Special prosecutor Leon Jeworski subpoenas US President Nixon, 1974
+09/22 The first Soviet atomic bomb explodes, 1949
+09/23 Philippine President Ferdinand Marcos declares martial law, 1972
+09/23 The New York Knickerbockers becomes the first US Baseball club, 1845
+09/23 US Vice President Nixon denies campaign fund fraud with his "Checkers" speech, 1952
+09/25 Sandra Day O'Connor becomes first woman on US Supreme Court, 1981
+09/27 The first passenger was hauled in a locomotive in England, 1825
+09/28 "Pilgrim's Progress" published, 1678
+09/28 A Greek soldier runs 26+ miles after the Persian defeat at Marathon,
+ 490BC
+09/30 Red Jack kills 2, Elizabeth Stride (#3) and Catherine Eddowes (#4),
+ 1888
+09/30 The first tooth is extracted under anesthesia in Charleston, Mass, 1846
+09/30 The verdicts of the Nuremberg trials are announced, 1946
+10/01 NASA officially begins operations, 1958
+10/02 Thurgood Marshall sworn as the first black Supreme Court Justice, 1967
+10/04 Crimean war begins, 1853
+10/04 First space vehicle, Sputnik I, launched, 1957
+10/06 Antioch College is the first public school to admit men and women, 1853
+10/06 Egyptian President Anwar es-Sadat is assassinated in Cairo, 1981
+10/06 Israel is attacked by the alliance of Egypt and Syria, 1973
+10/07 Foundation of the German Democratic Republic (GDR or DDR), 1949
+10/07 Georgia Tech. beats Cumberland Univ. 222-0, 1916
+10/07 Maryland Governor Marvin Mandel sent to prison on fraud charges, 1977
+10/07 Mother Teresa of Calcutta awarded the Nobel Peace Prize, 1979
+10/07 Police stop Wilbur Mills car, Fanne Fox jumps into water, 1974
+10/08 Great Chicago Fire, 1871
+10/09 First two-way telephone conversation, 1876
+10/10 Beginning of the Wars for Independence in Cuba
+10/10 Foundation of the Workers Party in North Korea
+10/10 Mercury at Superior Conjunction with Sun. Moves into night sky. (1984)
+10/10 Spiro T. Agnew resigns as Vice-President due to income tax fraud, 1973
+10/11 "Saturday Night Live" premiers on NBC-TV, 1975
+10/11 The Gang of Four are arrested in Peking, 1976
+10/11 The first steam powered ferry ran between New York and Hoboken, 1811
+10/11 The second Vatican Ecumenical Council opens in Rome, 1962
+10/11 First broadcast of Saturday Night Live, 1975
+10/12 Bahama Natives discover Columbus of Europe lost on their shores, 1492
+10/12 Khrushchev pounds his desk with shoe during a speech to the UN, 1960
+10/12 Man O'War's last race, 1920
+10/12 Native Americans discover Columbus of Europe lost on their shores, 1492
+10/13 Italy declares war on Germany, 1943
+10/13 US Navy born, 1775, authorized by the Second Continental Congress
+10/14 Battle of Hastings won by William the Conqueror and the Normans, 1066
+10/14 Chuck Yeager breaks sound barrier, 1947
+10/15 First draft card burned, 1965
+10/18 Boston Shoemakers form first US labor org., 1648
+10/18 Soviets announce their probe took photos of the Moon's far side, 1959
+10/19 Mao Tse-tung establishes the People's Republic of China, 1949
+10/19 Napoleon's beaten army begins the long retreat from Moscow, 1812
+10/20 "Saturday Night Massacre", 1973
+10/20 OPEC embargo, 1973
+10/21 Edison makes the first practical incandescent lamp, 1879
+10/21 Guggenheim Museum opens, 1959
+10/23 Battle of Leyte Gulf begins, 1944
+10/23 Day of the 1956 revolution in Hungary
+10/23 Earth created at 6:30 AM, 4004BC.
+10/23 Swallows leave Capistrano
+10/25 The UN removes Taiwan and admits the People's Republic of China, 1971
+10/26 UN's World Health Organization declares smallpox eradicated, 1978
+10/27 New York's Boss Tweed is arrested on fraud charges, 1871
+10/27 The first New York Subway is opened, 1904
+10/28 Columbus discovers Cuba, 1492
+10/28 Constantine's army defeats forces of Maxentius at Mulvian Bridge, 312
+10/28 Harvard was founded in Massachusetts, 1636
+10/28 Statue of Liberty was dedicated on Bedloe's Island, 1886
+10/29 Stock Market Crash, 1929
+10/30 Orson Welles' "War of the Worlds" broadcast, 1938
+10/31 Luther nails 95 Theses to door of Castle Church, Wittenberg, 1517
+11/01 Austria-Hungary become two separate nations, 1918
+11/01 Puerto Rican nationalists try to kill Truman at the Blair House, 1950
+11/02 Luftwaffe completes 57 consecutive nights of bombing of London, 1940
+11/02 Two Frenchmen make the first free hot air balloon flight, 1783
+11/03 Beef rises to 3 cents a pound, IL, 1837
+11/03 Linus Pauling wins Nobel Chemistry Prize, 1954
+11/03 Sputnik II launched, 1957, bearing space dog Laika
+11/04 Iranian militants seize US embassy personnel in Teheran, 1979
+11/04 Soviet forces crush the anti-communist revolt in Hungary, 1956
+11/05 Guy Fawkes' Plot, 1605
+11/07 Abolitionist newspaperman Elijah P. Lovejoy murdered by mob, 1837
+11/07 Lewis and Clark Expedition in sight of the Pacific Ocean, 1805
+11/09 Blackout of New York, New England, and Eastern Canada, 1965
+11/09 Giant panda discovered (?!), China, 1927
+11/09 Jack the Ripper kills fifth and final victim, Jane Kelly, 1888
+11/09 Margaret Sanger forms American Birth Control League, 1921
+11/09 Roosevelt establishes the Civil Works Administration, 1933
+11/10 41 Women arrested in suffragette demonstrations near White House, 1917
+11/10 Cpt. Wirz, commandant of Andersonville Prison hanged, 1865
+11/10 Henry Stanley asks David Livingstone, "Dr. Livingstone, I presume?", 1871
+11/11 Washington becomes the 42nd state, 1889
+11/12 Dr. Sun Yat-sen's Birthday in Taiwan
+11/12 USA first exports oil to Europe, 1861
+11/14 Quarter Pounder price raised from $0.53 to $0.55 in violation of Nixon
+ price controls (but okayed by Price Commission after formal request
+ from McDonald's), 1971
+11/15 Niagara Falls power plant startup, 1896
+11/16 Opening of the Suez Canal, 1869
+11/16 Albert Hofmann synthesizes LSD in Switzerland, 1938
+11/17 46,000 meteoroids fall over AZ in 20 minutes, 1966
+11/17 Richard Nixon says "I am not a crook.", 1973
+11/18 First hydrogen bomb blasts Enewetok, 1952
+11/18 Local standard time zones established for US, 1883
+11/19 Gettysburg Address delivered, 1863
+11/21 Announcement of 18 1/2 minute gap on Watergate tape, 1973
+11/22 Kennedy shot in Dallas, Texas by Lee Harvey Oswald, 1963
+11/23 First broadcast of Dr. Who (longest running TV series), 1963
+11/24 Lee Harvey Oswald killed by Jack Ruby, 1963
+11/25 Alfred Nobel invents dynamite, 1867
+11/27 Alfred Nobel establishes Nobel Prize, 1895
+11/27 Friction match invented, England, 1826
+11/27 Hoosac Railroad Tunnel completed, 1873, in NW Massachusetts
+11/29 King Tut's tomb opened, 1922
+12/01 First national corn-husking championship, Alleman IA, 1924
+12/01 Martin Luther King Jr., leads black boycott of Montgomery buses, 1955
+12/01 Rosa Parks refuses to move to back of the bus (Montgomery, AL), 1953
+12/03 First neon light display, Paris, 1910
+12/03 First successful human heart transplant led by Dr. Barnard, 1967
+12/03 The Montreux Casino burns down during a Frank Zappa concert, 1971
+12/04 Washington takes leave of his officers at Fraunce's Tavern, NYC, 1783
+12/05 End of Prohibition, 1933 (at least the alcohol part)
+12/05 Phi Beta Kappa founded, 1776
+12/05 The Eighteenth Amendment repealed, ending Prohibition, 1933
+12/07 Japan bombs Pearl Harbor, 1941
+12/08 Japan enters Second World War with invasion of Pantai Sabak, Kelantan, 1941
+12/09 Ball-bearing roller skates patented, 1884
+12/10 Metric system established in France, 1799
+12/10 Nobel Peace Prize awarded each year
+12/12 First wireless message sent across Atlantic by Marconi, 1901
+12/13 Apollo 17 leaves the moon, with "last" men to walk on moon aboard, 1972
+12/13 Dartmouth College chartered, 1769
+12/13 Geminid meteor shower (look south)
+12/15 Argo Merchant oil spill, 1976
+12/15 Bill of Rights adopted, 1791
+12/15 James Naismith invents basketball, Canada, 1891
+12/15 Sitting Bull shot in head while submitting to arrest, 1890
+12/20 US buys ~1,000,000 sq. miles of Louisiana for ~$20/sq.mi.
+12/21 Phileas Fogg completes his trip around the world in less than 80 days
+12/21 Women gain the right to vote in South Australia, 1894
+12/21 Women gain the right to hold political office in South Australia, 1894
+12/24 KKK formed in Pulaski, Tenn, 1865
+12/26 DPMA founded, 1951
+12/27 APT report published, 1956
+12/27 Ether first used as anesthetic in childbirth, 1845
+12/28 Comet Kohoutek at perihelion, 1973
+12/28 Proclamation of the Province of South Australia, 1836
+12/29 Battle of Wounded knee, 1890
+12/30 First Los Angeles freeway dedicated, 1940
+12/31 St. Sylvester in Switzerland
+12/31 Winterland closes its doors, 1978
+
+#endif /* !_calendar_history_ */
diff --git a/usr.bin/calendar/calendars/calendar.holiday b/usr.bin/calendar/calendars/calendar.holiday
new file mode 100644
index 0000000..f3115c6
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.holiday
@@ -0,0 +1,563 @@
+/*
+ * Holiday
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_holiday_
+#define _calendar_holiday_
+
+01/01 Beginning of the Year in Japan
+01/01 Independence Day in Haiti and Sudan
+01/01 Universal Fraternity Day in Mozambique
+01/02 Ancestry Day in Haiti
+01/02 St. Berchtold's Day in Switzerland
+01/03 New Year's Holiday in Scotland
+01/03 Revolution Day in Upper Volta
+01/04 Independence Day in Burma
+01/04 Martyrs Day in Zaire
+01/06 Children's Day in Uruguay
+01/06 Three Kings' Day in Puerto Rico
+01/07 Christmas in Ethiopia
+01/07 Pioneer's Day in Liberia
+01/09 Day of the Martyrs in Panama
+01/11 Armed Forces Day in Liberia
+01/12 Zanzibar Revolution Day in Tanzania
+01/13 National Liberation Day in Togo
+01/15 Arbor Day in Jordan
+01/16 Martyrs Day in Benin
+01/18 Revolution Day in Tunisia
+01/19 Confederate Heroes Day in Texas
+01/19 Ethiopian Epiphany in Ethiopia
+01/19 Nameday of Archbishop Makarios in Cyprus
+01/20 Army Day in Mali
+01/20 National Heroes Day in Guinea-Bissau
+01/21 Our Lady of Altagracia in Dominican Republic
+01/23 Feast of St. Ildefonsus
+01/23 US National Handwriting Day
+01/24 Economic Liberation Day in Togo
+01/26 Republic Day in India
+01/MonSecond Adults Day in Japan
+01/MonThird Lee-Jackson Day in Virginia (3rd Monday)
+01/MonThird Robert E. Lee's Birthday in Alabama & Mississippi (3rd Monday)
+01/MonThird Martin Luther King Day in New York (3rd Monday)
+02/01 Chinese New Year Holiday (3 days) in Taiwan
+02/02 Candlemas
+02/04 Independence Commemoration Day in Sri Lanka
+02/05 Constitution Day in Mexico
+02/06 New Zealand Day
+02/07 Independence Day in Grenada
+02/09 St. Maron's Day in Lebanon
+02/10 Feast of St. Paul's Shipwreck, AD 60
+02/11 National Foundation Day in Japan
+02/12 Pyidaungsa Day in Burma
+02/16 Makha Bucha Day in Thailand
+02/18 Democracy Day in Nepal
+02/18 Independence Day in The Gambia
+02/23 Republic Day in Guyana
+02/24 Gregorian Calendar Day
+02/25 National Day in Kuwait
+02/27 Independence Day in Dominican Republic
+03/01 Samil Independence Movement Day in South Korea
+03/01 St. David's Day - Patron Saint of Wales
+03/02 Peasants Day in Burma
+03/02 Texas Independence day
+03/02 Victory of Adowa in Ethiopia
+03/03 Throne Day in Morocco
+03/03 Independence day (Treaty of San Stefano) in Bulgaria
+03/04 Vermont Admission Day (admitted as 14th US state in 1791)
+03/05 Independence Day in Equatorial Guinea
+03/06 Lantern Day, Bejing
+03/08 First Annual International Women's Day, 1909
+03/08 International Women's Day in former USSR
+03/08 Syrian National Day in Libyan Arab Republic
+03/08 Women's Day in Guinea-Bissau, Taiwan and Yemen Democratic Republic
+03/08 Youth Day in Zambia
+03/09 Decoration Day in Liberia
+03/09 Falgun Purnima Day in Nepal
+03/10 Labor Day in South Korea
+03/11 Johnny Appleseed Day; anniversary of the death of John Chapman
+03/12 Commonwealth Day in Swaziland
+03/12 Independence Day in Mauritius
+03/12 Moshoeshoe's Birthday in Lesotho
+03/12 Renovation Day in Gabon
+03/13 National Day in Grenada
+03/16 Black Press Day; first US Black newspaper founded in 1827
+03/17 Evacuation Day in Suffolk County, Massachusetts
+03/17 St. Patrick's Day - one of the Patron Saints of Ireland
+03/19 St. Joseph's Day, observed in Colombia, Costa Rica, Holy See,
+ Liechtenstein, San Marino, Spain, Venezuela
+03/19 Tree Planting Day in Lestho
+03/20 Independence Day in Tunisia
+03/20 Youth Day in Oklahoma
+03/20* Vernal Equinox in Japan
+03/21 Afghan New Year in Afghanistan
+03/21 Juarez' Birthday in Mexico
+03/21* Vernal Equinox in Japan
+03/22 Abolition Day in Puerto Rico
+03/23 Pakistan Day in Pakistan
+03/25 Greek Independence Day in Cyprus
+03/25 Lady Day (a.k.a. the Feast of the Annunciation)
+03/25 Maryland Day in Maryland
+03/25 National Holiday in Greece
+03/26 Independence Day in Bangladesh
+03/26 Prince Jonah Kuhio Kalanianaole Day in Hawaii
+03/27 Armed Forces Day in Burma
+03/29 Death of President Barthelemy Boganda in Central African Republic
+03/29 Memorial Day in Madagascar
+03/31 National Day in Malta
+03/MonLast Seward's Day in Alaska (last Monday)
+04/01 Youth Day in Benin
+04/02 Malvinas Day in Argentina
+04/02 Pascua Florida Day in Florida
+04/04 Ching Ming Festival in Hong Kong
+04/04 Liberation Day in Hungary
+04/04 National Day in Senegal
+04/05 Arbor Day in South Korea
+04/05 Tomb Sweeping Day in Taiwan
+04/06 Chakri Memorial Day in Thailand
+04/06 Victory Day in Ethiopia
+04/08 Fast and Prayer Day in Liberia
+04/09 Martyrs Day in Tunisia
+04/11 National Heroes Day in Costa Rica
+04/13 National Day in Chad
+04/13 Songkron Day in Thailand
+04/14 Day of the Americas in Honduras
+04/15 Bengali New Year in Bangladesh
+04/16 De Diego's Birthday celebrated in Puerto Rico
+04/16 Holy Week (5 days) in Venezuela
+04/16 Tourist Week (5 days) in Uruguay
+04/17 Burmese New Year in Burma
+04/18 Independence Day in Chile and Zimbabwe
+04/19 Declaration of Independence in Venezuela
+04/19 Republic Day in Sierra Leone
+04/21 San Jacinto Day in Texas
+04/21 Tiradentes in Brazil
+04/22 Arbor Day in Nebraska & Delaware
+04/22 Oklahoma Day in Oklahoma
+04/23 St. George's Day - Patron Saint of England
+04/24 Victory Day in Togo
+04/25 Anniversary of the Revolution in Portugal
+04/25 Anzac Day, observed in Australia, New Zealand, Tonga and Western Samoa
+04/25 Liberation Day in Italy
+04/25 National Flag Day in Swaziland
+04/26 Confederate Memorial Day in Florida & Georgia
+04/26 Union Day in Tanzania
+04/27 Independence Day in Togo
+04/27 King's Birthday in the Netherlands, the Netherlands Antilles
+04/29 Showa Day in Japan
+04/30 The Workers Day in Uruguay
+04/MonLast Arbor Day in Wyoming (last Monday)
+04/MonLast Confederate Memorial Day in Alabama & Mississippi (last Monday)
+04/MonThird Patriot's Day in Maine & Massachusetts (3rd Monday)
+05/01 Labor Day in many places in the USA
+05/01 May Day in many places
+05/01 US Law Day (decl. by Eisenhower)
+05/02 King's Birthday in Lesotho
+05/03 Constitution Memorial Day in Japan
+05/04 Greenery Day in Japan
+05/04 Rhode Island Independence Day
+05/05 Battle of Puebla in Mexico
+05/05 Children's Day in Japan and South Korea
+05/05 Coronation Day in Thailand
+05/05 Liberation Day in the Netherlands
+05/06 Bataan Day in Philippines
+05/06* Bank Holiday in UK
+05/07 May Day in United Kingdom
+05/08 Buddha's Birthday in South Korea
+05/08 Elections for the National Assembly in Philippines
+05/08 Truman Day in Missouri
+05/09 VE day, end of Second World War, celebrated in many countries
+05/10 Confederate Memorial Day in South Carolina
+05/10 Mothers Day in Guatemala
+05/11 Minnesota Day in Minnesota
+05/14 Anniversary of the Founding of Guinean Democratic Party in Guinea
+05/14 Buddhist Holiday (Waisak 2528) in Indonesia
+05/14 Independence Day (2 days) in Paraguay
+05/14 Unification Day in Liberia
+05/15 Kamuzu Day in Malawi
+05/15 Vesak Day, observed in Singapore and Malaysia
+05/15 Visakha Bucha Day in Thailand
+05/16 Discovery Day in Cayman Islands
+05/17 Constitution Day in Nauru and Norway
+05/18 Flag Day in Haiti
+05/18 Prayer Day in Denmark
+05/19 Youth and Sports Day in Turkey
+05/20 Mecklenburg Independence Day in North Carolina
+05/20 National Day in Cameroon
+05/20 Victoria Day in Canada
+05/22 National Heroes Day in Sri Lanka
+05/23 Commonwealth Day in Jamaica and Belize
+05/23 National Labor Day in Jamaica
+05/24 Bermuda Day in Bermuda
+05/24 Day of Slav Letters in Bulgaria
+05/25 African Freedom Day in Zimbabwe
+05/25 African Liberation Day in Chad, Mauritania and Zambia
+05/25 Anniversary of the Revolution of 1810 in Argentina
+05/25 Independence Day in Jordan
+05/25 Memorial Day in New Mexico & Puerto Rico
+05/25 Revolution in the Sudan in Libyan Arab Republic
+05/27 Afghanistan attains sovereignty, 1921
+05/27* Bank Holiday in UK
+05/28 Mothers Day in Central African Republic
+05/31 Pya Martyrs Day in Togo
+05/MonThird Memorial Day in Michigan (3rd Monday)
+06/01 Independence Days (3 days) in Western Samoa
+06/01 Madaraka Day in Kenya
+06/01 Victory Day in Tunisia
+06/02 Corpus Christi in Paraguay
+06/03 Confederate Memorial Day in Kentucky & Louisiana
+06/03 Labor Day in Bahamas
+06/03* Bank Holiday in Rep. of Ireland
+06/04 Emancipation Day in Tonga
+06/04 Queen's Birthday in New Zealand
+06/05 Constitution Day in Denmark
+06/05 Liberation Day in Seychelles
+06/06 His Majesty, Yang Di-Pertuan Agong's Birthday in Malaysia
+06/06 Memorial Day in South Korea
+06/09 Senior Citizen's Day in Oklahoma
+06/10 Camoes Day in Portugal
+06/11 King Kamehameha I Day in Hawaii
+06/11 Queen's Birthday
+06/12 Independence Day in Philippines
+06/12 Peace with Bolivia in Paraguay
+06/13 Corrective Movement in Yemen Arab Republic
+06/14 Flag Day, USA
+06/16 Bloomsday - Anniversary of Dublin events, 1904, in "Ulysses"
+06/17 Bunker Hill Day in Suffolk County, Massachusetts
+06/17 Independence Day in Iceland
+06/18 Evacuation Day in Egypt
+06/18 Queen's Birthday in Fiji
+06/19 Artigas Birthday in Uruguay
+06/19 Emancipation Day in Texas
+06/19 Labor Day in Trinidad and Tobago
+06/19 Revolution Day in Algeria
+06/20 Flag Day in Argentina
+06/20 West Virginia Day in West Virginia
+06/22 Corrective Movement in Yemen Democratic Republic
+06/22 Midsummer Eve in Finland, Sweden
+06/22 National Sovereignty Day in Haiti
+06/23 National Holiday in Luxembourg
+06/24 Battle of Carabobob in Venezuela
+06/24 Fisherman's Day in Madagascar, Mozambique and Somalia
+06/24 Kings Day in Spain
+06/24 Peasants Day in Peru
+06/24 St. Jean-Baptiste Day in Quebec
+06/28 Mothers Day in Central African Republic
+06/29 Independence Day in Seychelles
+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 Canada Day
+07/01 Freedom Day in Suriname
+07/01 Independence Day in Burundi
+07/01 National Day in Rwanda
+07/01 Republic Day in Ghana
+07/01 Union of the Somalia Republic in Somalia
+07/02 National Day in Kiribati
+07/04 Caribbean Day in Guyana
+07/04 Constitution Day in Cayman Islands
+07/04 Family Day in Lesotho
+07/04 Heroes Day in Zambia
+07/04 Kadooment Day in Barbados
+07/04 Philippine-American Friendship Day in the Philippines
+07/04 Warriors Day (2 days) in Yugoslavia
+07/05 Day of Peace and Unity in Rwanda
+07/05 Independence Day in Algeria and Venezuela
+07/07 Anniversary of the P.U.N. in Equatorial Guinea
+07/07 National Day in Malawi
+07/07 Saba Saba Day in Tanzania
+07/09 Independence Day in Argentina
+07/10 Independence Day in Bahamas
+07/11 National Holiday in the Mongolian People's Republic
+07/12 Battle of Boyne celebrated in Northern Ireland
+07/13 Buddhist Lent in Thailand
+07/14 Anniversary of the Revolution in Iraq
+07/14 French National Festival
+07/14 National Holiday in Monaco
+07/15 St. Swithin's Day
+07/16 Presidents Day in Botswana
+07/17 Constitution Day in South Korea
+07/17 July Revolution in Iraq
+07/17 Munoz Rivera's Birthday (celebrated in Puerto Rico)
+07/17 Public Holiday in Botswana
+07/18 Constitution Day in Uruguay
+07/18 Liberation Day in Nicaragua
+07/19 Martyrs Day in Burma
+07/20 Independence Day in Colombia
+07/21 National Holiday in Belgium
+07/22 King's Birthday in Swaziland
+07/22 National Day in Poland
+07/23 Anniversary of the Revolution in Egypt
+07/23 Egyptian National Day in Syrian Arab Republic
+07/23 Remembrance Day in Papua New Guinea
+07/24 Pioneer Day in Utah
+07/24 Simon Bolivar's Day in Ecuador and Venezuela
+07/25 Constitution Day in Puerto Rico
+07/25 National Rebellion Day (3 days) in Cuba
+07/25 Republic Day in Tunisia
+07/25 St. James, Patron Saint in Spain
+07/26 Independence Day in Liberia
+07/26 National Day in Maldives
+07/27 Barbosa's Birthday (celebrated in Puerto Rico)
+07/28 Independence Days (2 days) in Peru
+07/29 Olsok Eve in Norway to commemorate Norway's Viking King St. Olav
+07/29 Rain Day in Waynesburg, PA
+07/31 Revolution Day in Congo
+07/MonThird Day of Sea in Japan
+08/01 Discovery Day in Trinidad and Tobago
+08/01 Emancipation Day in Granada
+08/01 Founding of Asuncion in Paraguay
+08/01 Freedom Day in Guyana
+08/01 National Day in Switzerland
+08/01 National Holidays (5 days) in El Salvador
+08/01 Parent's Day in Zaire
+08/02 Our Lady of Los Angeles in Costa Rica
+08/03 Independence Day in Jamaica and Niger
+08/03 Massacre of the Pidjiguiti in Guinea-Bissau
+08/03 Memorial Day of Archbishop Makarios in Cyprus
+08/04 Freedom Day in Guyana
+08/05* Bank Holiday in Scotland and Northern Ireland
+08/06 Bank Holiday in British Columbia, Fiji, Iceland, Ireland, Ontario
+08/06 Emancipation Day in Bahamas
+08/06 Independence Day in Bolivia
+08/07 Battle of Boyaca in Colombia
+08/09 National Day in Singapore
+08/10 Independence Day in Ecuador
+08/11 Heroes Day (2 days) in Zimbabwe
+08/11 Independence Day in Chad
+08/11 King Hussein's Accession to the Throne in Jordan
+08/12 Queen's Birthday in Thailand
+08/13 Proclamation of Independence in Central African Republic
+08/13 Women's Day in Tunisia
+08/14 Independence Day in Pakistan
+08/14 VJ Day, 1945
+08/14 Waddi Dhahab in Morocco
+08/15 Founding of Ascuncion in Paraguay
+08/15 Independence Day in India
+08/15 Liberation Day in South Korea
+08/15 National Day in Congo
+08/15 Santa Maria in Malta
+08/16 Bennington Battle Day in Vermont
+08/16 Independence Days (3 days) in Gabon
+08/16 Restoration Day in Dominican Republic
+08/17 Anniversary of the Death of General San Martin in Argentina
+08/17 Independence Day in Indonesia
+08/19 Independence Day in Afghanistan
+08/20 Constitution Day in Hungary
+08/24 National Flag Day in Liberia
+08/25 Constitution Day in Paraguay
+08/25 Independence Day in Uruguay
+08/26 Susan B. Anthony Day in Massachusetts
+08/26* Bank Holiday in England and Wales
+08/27 Liberation Day in Hong Kong
+08/28 Heroes Day in Philippines
+08/30 Huey P. Long Day in Louisiana
+08/30 Victory Day in Turkey
+08/31 Independence Day (Merdeka) in Malaysia
+08/31 Independence Day in Trinidad and Tobago
+08/31 Pashtoonian Day in Afghanistan
+08/FriThird Admission Day in Hawaii, 1959 (3rd Friday)
+09/01 Army Day in Chile
+09/03 Independence Day in Qatar
+09/03 Memorial Day in Tunisia
+09/06 Defense of Pakistan Day in Pakistan
+09/06 Unification of Bulgaria
+09/07 Independence Day in Brazil
+09/09 Admission Day in California
+09/09 National Day in North Korea
+09/10 Korean Thanksgiving Day (Chusuk) in South Korea
+09/10 Moon Festival in Taiwan
+09/10 National Day in Belize
+09/11 Anniversary of military coup in Chile
+09/11 Ethiopian New Year in Ethiopia
+09/11 National Holiday in Chile
+09/12 Amilcar Cabral's Birthday in Guinea-Bissau
+09/12 Defender's Day in Maryland
+09/12 Revolution Day in Ethiopia
+09/13 Barry Day commemorates the death of Commodore John Barry, USA
+09/14 Battle of San Jacinto in Nicaragua
+09/15 Foundation of Panama in Panama
+09/16 Cherokee Strip Day in Oklahoma
+09/16 Independence Days in Mexico and Papua New Guinea
+09/17 National Heroes Day in Angola
+09/18 Independence Day in Chile and Zimbabwe
+09/19 Army Day in Chile
+09/21 Independence Day in Belize
+09/22 Independence Day in Mali
+09/22 National Sovereignty Day in Haiti
+09/22* Autumnal Equinox in Japan
+09/23 Grito de Lares in Puerto Rico
+09/23* Autumnal Equinox in Japan
+09/24 Anniversary of the Third Republic in Ghana
+09/24 Independence Day in Guinea-Bissau
+09/24 National Day in Saudi Arabia
+09/24 Our Lady of Mercedes in Dominican Republic
+09/24 Republic Day in Trinidad and Tobago
+09/25 Army Day in Mozambique
+09/25 Referendum Day in Rwanda
+09/26 National Day in Maldives
+09/26 Revolution Anniversary Day in Yemen
+09/27 Feast of Finding the True Cross in Ethiopia
+09/28 Confucius' Day in Taiwan
+09/29 Michaelmas
+09/29 Battle of Boqueron in Paraguay
+09/30 Botswana Day in Botswana
+09/MonThird Respect for the Aged Day in Japan
+10/01 Armed Forces Day in South Korea
+10/01 Independence Day in Nigeria
+10/01 National Liberation Day (2 days) in China
+10/01 Public Holiday in Botswana
+10/02 Anniversary of Guinean Independence in Guinea
+10/03 Chung Yeung Festival in Hong Kong
+10/03 Francisco Morazan's Birthday in Honduras
+10/03 German Reunification Day
+10/03 National Foundation Day in South Korea
+10/03 U.N. Day in Barbados
+10/04 Independence Day in Lesotho
+10/05 Anniversary of Proclamation of the Republic in Portugal
+10/06 National Sports Day in Lesotho
+10/07 National Heroes Day in Jamaica
+10/08 Battle of Agamos in Peru
+10/08 Constitution Day in former USSR
+10/08 Thanksgiving Day in Canada
+10/08* Fiji Day
+10/09 Independence Day in Uganda
+10/09 Independence of Guayaquil in Ecuador
+10/09 Korean Alphabet Day in South Korea
+10/09 Leif Erikson Day commemorates the discovery of North America in AD 1000
+10/09 Republic Day in Khmer Republic
+10/10 National Day in Taiwan
+10/10 Oklahoma Historical Day in Oklahoma
+10/11 Day of the Revolution in Panama
+10/12 Day of the Race in Argentina
+10/12 Discovery Day in Bahamas
+10/12 National Day in Equatorial Guinea and Spain
+10/12 Our Lady Aparecida Day in Brazil
+10/12 Pan American Day in Belize
+10/14 National Day in Yemen Arab Republic
+10/14 Young People's Day in Zaire
+10/14* Thanksgiving Day in Canada
+10/15 Evacuation Day in Tunisia
+10/16 National Boss Day, USA
+10/17 Dessaline's Death Anniversary in Haiti
+10/17 Heroes Day in Jamaica
+10/17 Mother's Day in Malawi
+10/20 Anniversary of the 1944 Revolution in Guatemala
+10/20 Kenyatta Day in Kenya
+10/21 Armed Forces Day in Honduras
+10/21 Revolution Days (2 days) in Somalia
+10/23 Chulalongkron's Day in Thailand
+10/24 Independence Day in Zambia
+10/24 United Nations Day
+10/25 Taiwan Restoration Day in Taiwan
+10/25 St. Crispin's day, patron saint of shoemakers
+10/26 Agam Day in Nauru
+10/26 Armed Forces Day in Benin and Rwanda
+10/26 National Day in Austria
+10/28 National Holiday in Greece
+10/28 OHI Day in Cyprus
+10/28* Bank Holiday in Republic of Ireland
+10/29 Republic Day in Turkey
+10/31 All Hallows Eve ("Halloween")
+10/31 Nevada Day in Nevada
+10/MonFourth Labour Day in New Zealand
+10/MonSecond Health Sports Day in Japan
+11/01 All Saints Day
+11/01 Samhain; Beginning of the Celtic year and most important holiday.
+11/02 All Souls Day
+11/02 Memorial Day in Ecuador
+11/03 Culture Day in Japan
+11/03 Independence from Columbia in Panama
+11/03 Independence of Cuenca in Ecuador
+11/03 Thanksgiving Day in Liberia
+11/04 Flag Day in Panama
+11/04 Will Rogers Day, USA
+11/06 Green March Day in Morocco
+11/07 October Revolution Day in Hungary
+11/08 Her Majesty, the Queen's Birthday in Nepal
+11/10 King's Birthday in Bhutan
+11/11 Angola gains independence from Portugal, 1975
+11/11 Independence Day in Angola
+11/11 Independence of Cartagena in Colombia
+11/11 Remembrance Day in Canada
+11/11 Republic Day in Maldives
+11/14 King Hussein's Birthday in Jordan
+11/15 Dynasty Day in Belgium
+11/15 Proclamation of the Republic in Brazil
+11/15 Thatlouang Festival in Laos
+11/16 Oklahoma Heritage Week in Oklahoma
+11/17 Army Day in Zaire
+11/17 Corrective Movement in Syrian Arab Republic
+11/18 Battle of Viertieres in Haiti
+11/18 Independence Day in Morocco
+11/18 National Days (4 days) in Oman
+11/19 Anniversary of the 1968 Coup by the Army in Mali
+11/19 Discovery Day in Puerto Rico
+11/19 Feast Day of S.A.S. Prince Rainier in Monaco
+11/19 Garifuna Settlement in Belize
+11/20 Revolution Day in Mexico
+11/22 Anniversary of Portuguese Aggression in Guinea
+11/22 Independence Day in Lebanon
+11/23 Labor Thanksgiving Day in Japan
+11/24 Anniversary of the New Regime in Zaire
+11/25 Independence Day in Suriname
+11/28 Independence Day in Albania and Mauritania
+11/28 Independence from Spain in Panama
+11/28 Proclamation of the Republic in Chad
+11/29 Day of the Republic (2 days) in Yugoslavia
+11/29 Goodwill Day in Liberia
+11/29 Liberation Day in Albania
+11/29 National Day in Burma
+11/30 Independence Day in Barbados and Yemen Democratic Republic
+11/30 National Day in Benin
+11/30 National Heroes Day in Philippines
+11/30 St. Andrew's Day - Patron Saint of Scotland
+11/Wed+3 Day of Prayer and Repentance (Buss- und Bettag) in Federal Republic of Germany
+12/01 Anniversary of the Restoration of Independence in Portugal
+12/01 Union Day in Romania
+12/01 Independence Day in Central African Republic
+12/01 World AIDS Day
+12/02 National Holiday in United Arab Emirates
+12/03 National Holiday in Laos
+12/05 King's Birthday in Thailand
+12/06 Independence Day in Finland
+12/07 Delaware Day in Delaware
+12/07 Independence Day in Ivory Coast
+12/07 Independence Day in Panama
+12/08 Blessing of the Water in Uruguay
+12/08 Mother's Day in Panama
+12/08 Our Lady of the Cacupe in Paraguay
+12/09 Independence Day in Tanzania
+12/10 Foundation of Worker's Party in Angola
+12/10 Human Rights Day
+12/10 Thai Constitution Day in Thailand
+12/10 Wyoming Day in Wyoming
+12/11 Independence Day in Upper Volta
+12/12 Independence Day in Kenya
+12/13 Republic Day in Malta
+12/15 Statue Day in the Netherlands Antilles
+12/16 Constitution Day in Nepal
+12/16 National Day in Bahrain
+12/16 Victory Day in Bangladesh
+12/17 National Day in Bhutan
+12/18 Republic Day in Niger
+12/23 Emperor's Birthday in Japan
+12/23 Victory Day in Egypt
+12/25 Birthday of Quaid-i-Azam in Pakistan
+12/25 Children's Day in Congo
+12/26 Boxing Day
+12/26 Feast of Our Theotokos in Greece
+12/26 St. Stephen's Day
+12/26 Bank Holiday in Canada, Rep. of Ireland, and UK
+12/27 Bank Holiday in Cayman Islands
+12/27 Constitution Day in North Korea
+12/27 Public Holiday in Lesotho, Zimbabwe
+12/29 Civic Holidays (3 days) in Costa Rica
+12/29 His Majesty, the King's Birthday in Nepal
+12/30 Anniversary of the Democratic Republic of Madagascar in Madagascar
+12/31 Bank Holiday in El Salvador, Honduras, Pakistan
+12/31 Feed Yourself Day in Benin
+12/31 Proclamation of the Republic in Congo
+
+#endif /* !_calendar_holiday_ */
diff --git a/usr.bin/calendar/calendars/calendar.hungarian b/usr.bin/calendar/calendars/calendar.hungarian
new file mode 100644
index 0000000..1b29dfa
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.hungarian
@@ -0,0 +1,12 @@
+/*
+ * Hungarian calendar file(s)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_hungarian_
+#define _calendar_hungarian_
+
+#include <hu_HU.ISO8859-2/calendar.all>
+
+#endif /* !_calendar_hungarian_ */
diff --git a/usr.bin/calendar/calendars/calendar.judaic b/usr.bin/calendar/calendars/calendar.judaic
new file mode 100644
index 0000000..6bfdbc2
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.judaic
@@ -0,0 +1,694 @@
+/*
+ * Judaic Calendar. Maintained by Josef Grosch <jgrosch@mooseriver.com>.
+ *
+ * $FreeBSD$
+ *
+ */
+
+/*
+ * $Id: calendar.judaic,v 1.45 2007/01/01 22:24:53 jgrosch Exp $
+ */
+
+#ifndef _calendar_judaic_
+#define _calendar_judaic_
+
+/*
+ * The calendar below has been obtained from the port deskutils/hebcal
+ * for the year of 2010 to 2015 and for the city of New York.
+ */
+
+2010/Jan/16* Rosh Chodesh Sh'vat
+2010/Jan/30* Tu B'Shvat
+2010/Feb/13* Shabbat Shekalim
+2010/Feb/14* Rosh Chodesh Adar
+2010/Feb/15* Rosh Chodesh Adar
+2010/Feb/25* Ta'anit Esther
+2010/Feb/27* Shabbat Zachor
+2010/Feb/28* Purim
+2010/Mar/1* Shushan Purim
+2010/Mar/6* Shabbat Parah
+2010/Mar/13* Shabbat HaChodesh
+2010/Mar/16* Rosh Chodesh Nisan
+2010/Mar/27* Shabbat HaGadol
+2010/Mar/29* Ta'anit Bechorot
+2010/Mar/29* Erev Pesach
+2010/Mar/30* Pesach I
+2010/Mar/31* Pesach II
+2010/Apr/1* Pesach III (CH''M)
+2010/Apr/2* Pesach IV (CH''M)
+2010/Apr/3* Pesach V (CH''M)
+2010/Apr/4* Pesach VI (CH''M)
+2010/Apr/5* Pesach VII
+2010/Apr/6* Pesach VIII
+2010/Apr/11* Yom HaShoah
+2010/Apr/14* Rosh Chodesh Iyyar
+2010/Apr/15* Rosh Chodesh Iyyar
+2010/Apr/19* Yom HaZikaron
+2010/Apr/20* Yom HaAtzma'ut
+2010/May/2* Lag B'Omer
+2010/May/Dec* Yom Yerushalayim
+2010/May/14* Rosh Chodesh Sivan
+2010/May/18* Erev Shavuot
+2010/May/19* Shavuot I
+2010/May/20* Shavuot II
+2010/Jun/Dec* Rosh Chodesh Tamuz
+2010/Jun/13* Rosh Chodesh Tamuz
+2010/Jun/29* Tzom Tammuz
+2010/Jul/Dec* Rosh Chodesh Av
+2010/Jul/17* Shabbat Hazon
+2010/Jul/20* Tish'a B'Av
+2010/Jul/24* Shabbat Nachamu
+2010/Aug/Oct* Rosh Chodesh Elul
+2010/Aug/11* Rosh Chodesh Elul
+2010/Sep/8* Erev Rosh Hashana
+2010/Sep/9* Rosh Hashana 5771
+2010/Sep/Oct* Rosh Hashana II
+2010/Sep/11* Shabbat Shuva
+2010/Sep/Dec* Tzom Gedaliah
+2010/Sep/17* Erev Yom Kippur
+2010/Sep/18* Yom Kippur
+2010/Sep/22* Erev Sukkot
+2010/Sep/23* Sukkot I
+2010/Sep/24* Sukkot II
+2010/Sep/25* Sukkot III (CH''M)
+2010/Sep/26* Sukkot IV (CH''M)
+2010/Sep/27* Sukkot V (CH''M)
+2010/Sep/28* Sukkot VI (CH''M)
+2010/Sep/29* Sukkot VII (Hoshana Raba)
+2010/Sep/30* Shmini Atzeret
+2010/Oct/1* Simchat Torah
+2010/Oct/8* Rosh Chodesh Cheshvan
+2010/Oct/9* Rosh Chodesh Cheshvan
+2010/Nov/7* Rosh Chodesh Kislev
+2010/Nov/8* Rosh Chodesh Kislev
+2010/Dec/1* Chanukah: 1 Candle
+2010/Dec/2* Chanukah: 2 Candles
+2010/Dec/3* Chanukah: 3 Candles
+2010/Dec/4* Chanukah: 4 Candles
+2010/Dec/5* Chanukah: 5 Candles
+2010/Dec/6* Chanukah: 6 Candles
+2010/Dec/7* Rosh Chodesh Tevet
+2010/Dec/7* Chanukah: 7 Candles
+2010/Dec/8* Rosh Chodesh Tevet
+2010/Dec/8* Chanukah: 8 Candles
+2010/Dec/9* Chanukah: 8th Day
+2010/Dec/16* Asara B'Tevet
+2011/1/6* Rosh Chodesh Sh'vat
+2011/1/20* Tu B'Shvat
+2011/2/4* Rosh Chodesh Adar I
+2011/2/5* Rosh Chodesh Adar I
+2011/2/18* Purim Katan
+2011/3/5* Shabbat Shekalim
+2011/3/6* Rosh Chodesh Adar II
+2011/3/7* Rosh Chodesh Adar II
+2011/3/17* Ta'anit Esther
+2011/3/19* Shabbat Zachor
+2011/3/20* Purim
+2011/3/21* Shushan Purim
+2011/3/26* Shabbat Parah
+2011/4/2* Shabbat HaChodesh
+2011/4/5* Rosh Chodesh Nisan
+2011/4/16* Shabbat HaGadol
+2011/4/18* Ta'anit Bechorot
+2011/4/18* Erev Pesach
+2011/4/19* Pesach I
+2011/4/20* Pesach II
+2011/4/21* Pesach III (CH''M)
+2011/4/22* Pesach IV (CH''M)
+2011/4/23* Pesach V (CH''M)
+2011/4/24* Pesach VI (CH''M)
+2011/4/25* Pesach VII
+2011/4/26* Pesach VIII
+2011/5/1* Yom HaShoah
+2011/5/4* Rosh Chodesh Iyyar
+2011/5/5* Rosh Chodesh Iyyar
+2011/5/9* Yom HaZikaron
+2011/5/10* Yom HaAtzma'ut
+2011/5/22* Lag B'Omer
+2011/6/1* Yom Yerushalayim
+2011/6/3* Rosh Chodesh Sivan
+2011/6/7* Erev Shavuot
+2011/6/8* Shavuot I
+2011/6/9* Shavuot II
+2011/7/2* Rosh Chodesh Tamuz
+2011/7/3* Rosh Chodesh Tamuz
+2011/7/19* Tzom Tammuz
+2011/8/1* Rosh Chodesh Av
+2011/8/6* Shabbat Hazon
+2011/8/9* Tish'a B'Av
+2011/8/13* Shabbat Nachamu
+2011/8/30* Rosh Chodesh Elul
+2011/8/31* Rosh Chodesh Elul
+2011/9/28* Erev Rosh Hashana
+2011/9/29* Rosh Hashana 5772
+2011/9/30* Rosh Hashana II
+2011/10/1* Shabbat Shuva
+2011/10/2* Tzom Gedaliah
+2011/10/7* Erev Yom Kippur
+2011/10/8* Yom Kippur
+2011/10/12* Erev Sukkot
+2011/10/13* Sukkot I
+2011/10/14* Sukkot II
+2011/10/15* Sukkot III (CH''M)
+2011/10/16* Sukkot IV (CH''M)
+2011/10/17* Sukkot V (CH''M)
+2011/10/18* Sukkot VI (CH''M)
+2011/10/19* Sukkot VII (Hoshana Raba)
+2011/10/20* Shmini Atzeret
+2011/10/21* Simchat Torah
+2011/10/28* Rosh Chodesh Cheshvan
+2011/10/29* Rosh Chodesh Cheshvan
+2011/11/27* Rosh Chodesh Kislev
+2011/12/20* Chanukah: 1 Candle
+2011/12/21* Chanukah: 2 Candles
+2011/12/22* Chanukah: 3 Candles
+2011/12/23* Chanukah: 4 Candles
+2011/12/24* Chanukah: 5 Candles
+2011/12/25* Chanukah: 6 Candles
+2011/12/26* Rosh Chodesh Tevet
+2011/12/26* Chanukah: 7 Candles
+2011/12/27* Rosh Chodesh Tevet
+2011/12/27* Chanukah: 8 Candles
+2011/12/28* Chanukah: 8th Day
+2012/1/5* Asara B'Tevet
+2012/1/25* Rosh Chodesh Sh'vat
+2012/2/8* Tu B'Shvat
+2012/2/18* Shabbat Shekalim
+2012/2/23* Rosh Chodesh Adar
+2012/2/24* Rosh Chodesh Adar
+2012/3/3* Shabbat Zachor
+2012/3/7* Ta'anit Esther
+2012/3/8* Purim
+2012/3/9* Shushan Purim
+2012/3/17* Shabbat Parah
+2012/3/24* Rosh Chodesh Nisan
+2012/3/24* Shabbat HaChodesh
+2012/3/31* Shabbat HaGadol
+2012/4/5* Ta'anit Bechorot
+2012/4/6* Erev Pesach
+2012/4/7* Pesach I
+2012/4/8* Pesach II
+2012/4/9* Pesach III (CH''M)
+2012/4/10* Pesach IV (CH''M)
+2012/4/11* Pesach V (CH''M)
+2012/4/12* Pesach VI (CH''M)
+2012/4/13* Pesach VII
+2012/4/14* Pesach VIII
+2012/4/19* Yom HaShoah
+2012/4/22* Rosh Chodesh Iyyar
+2012/4/23* Rosh Chodesh Iyyar
+2012/4/25* Yom HaZikaron
+2012/4/26* Yom HaAtzma'ut
+2012/5/10* Lag B'Omer
+2012/5/20* Yom Yerushalayim
+2012/5/22* Rosh Chodesh Sivan
+2012/5/26* Erev Shavuot
+2012/5/27* Shavuot I
+2012/5/28* Shavuot II
+2012/6/20* Rosh Chodesh Tamuz
+2012/6/21* Rosh Chodesh Tamuz
+2012/7/8* Tzom Tammuz
+2012/7/20* Rosh Chodesh Av
+2012/7/28* Shabbat Hazon
+2012/7/29* Tish'a B'Av
+2012/8/4* Shabbat Nachamu
+2012/8/18* Rosh Chodesh Elul
+2012/8/19* Rosh Chodesh Elul
+2012/9/16* Erev Rosh Hashana
+2012/9/17* Rosh Hashana 5773
+2012/9/18* Rosh Hashana II
+2012/9/19* Tzom Gedaliah
+2012/9/22* Shabbat Shuva
+2012/9/25* Erev Yom Kippur
+2012/9/26* Yom Kippur
+2012/9/30* Erev Sukkot
+2012/10/1* Sukkot I
+2012/10/2* Sukkot II
+2012/10/3* Sukkot III (CH''M)
+2012/10/4* Sukkot IV (CH''M)
+2012/10/5* Sukkot V (CH''M)
+2012/10/6* Sukkot VI (CH''M)
+2012/10/7* Sukkot VII (Hoshana Raba)
+2012/10/8* Shmini Atzeret
+2012/10/9* Simchat Torah
+2012/10/16* Rosh Chodesh Cheshvan
+2012/10/17* Rosh Chodesh Cheshvan
+2012/11/15* Rosh Chodesh Kislev
+2012/12/8* Chanukah: 1 Candle
+2012/12/9* Chanukah: 2 Candles
+2012/12/10* Chanukah: 3 Candles
+2012/12/11* Chanukah: 4 Candles
+2012/12/12* Chanukah: 5 Candles
+2012/12/13* Chanukah: 6 Candles
+2012/12/14* Rosh Chodesh Tevet
+2012/12/14* Chanukah: 7 Candles
+2012/12/15* Chanukah: 8 Candles
+2012/12/16* Chanukah: 8th Day
+2012/12/23* Asara B'Tevet
+2013/1/12* Rosh Chodesh Sh'vat
+2013/1/26* Tu B'Shvat
+2013/2/9* Shabbat Shekalim
+2013/2/10* Rosh Chodesh Adar
+2013/2/11* Rosh Chodesh Adar
+2013/2/21* Ta'anit Esther
+2013/2/23* Shabbat Zachor
+2013/2/24* Purim
+2013/2/25* Shushan Purim
+2013/3/2* Shabbat Parah
+2013/3/9* Shabbat HaChodesh
+2013/3/12* Rosh Chodesh Nisan
+2013/3/23* Shabbat HaGadol
+2013/3/25* Ta'anit Bechorot
+2013/3/25* Erev Pesach
+2013/3/26* Pesach I
+2013/3/27* Pesach II
+2013/3/28* Pesach III (CH''M)
+2013/3/29* Pesach IV (CH''M)
+2013/3/30* Pesach V (CH''M)
+2013/3/31* Pesach VI (CH''M)
+2013/4/1* Pesach VII
+2013/4/2* Pesach VIII
+2013/4/7* Yom HaShoah
+2013/4/10* Rosh Chodesh Iyyar
+2013/4/11* Rosh Chodesh Iyyar
+2013/4/15* Yom HaZikaron
+2013/4/16* Yom HaAtzma'ut
+2013/4/28* Lag B'Omer
+2013/5/8* Yom Yerushalayim
+2013/5/10* Rosh Chodesh Sivan
+2013/5/14* Erev Shavuot
+2013/5/15* Shavuot I
+2013/5/16* Shavuot II
+2013/6/8* Rosh Chodesh Tamuz
+2013/6/9* Rosh Chodesh Tamuz
+2013/6/25* Tzom Tammuz
+2013/7/8* Rosh Chodesh Av
+2013/7/13* Shabbat Hazon
+2013/7/16* Tish'a B'Av
+2013/7/20* Shabbat Nachamu
+2013/8/6* Rosh Chodesh Elul
+2013/8/7* Rosh Chodesh Elul
+2013/9/4* Erev Rosh Hashana
+2013/9/5* Rosh Hashana 5774
+2013/9/6* Rosh Hashana II
+2013/9/7* Shabbat Shuva
+2013/9/8* Tzom Gedaliah
+2013/9/13* Erev Yom Kippur
+2013/9/14* Yom Kippur
+2013/9/18* Erev Sukkot
+2013/9/19* Sukkot I
+2013/9/20* Sukkot II
+2013/9/21* Sukkot III (CH''M)
+2013/9/22* Sukkot IV (CH''M)
+2013/9/23* Sukkot V (CH''M)
+2013/9/24* Sukkot VI (CH''M)
+2013/9/25* Sukkot VII (Hoshana Raba)
+2013/9/26* Shmini Atzeret
+2013/9/27* Simchat Torah
+2013/10/4* Rosh Chodesh Cheshvan
+2013/10/5* Rosh Chodesh Cheshvan
+2013/11/3* Rosh Chodesh Kislev
+2013/11/4* Rosh Chodesh Kislev
+2013/11/27* Chanukah: 1 Candle
+2013/11/28* Chanukah: 2 Candles
+2013/11/29* Chanukah: 3 Candles
+2013/11/30* Chanukah: 4 Candles
+2013/12/1* Chanukah: 5 Candles
+2013/12/2* Chanukah: 6 Candles
+2013/12/3* Rosh Chodesh Tevet
+2013/12/3* Chanukah: 7 Candles
+2013/12/4* Rosh Chodesh Tevet
+2013/12/4* Chanukah: 8 Candles
+2013/12/5* Chanukah: 8th Day
+2013/12/12* Asara B'Tevet
+2014/1/2* Rosh Chodesh Sh'vat
+2014/1/16* Tu B'Shvat
+2014/1/31* Rosh Chodesh Adar I
+2014/2/1* Rosh Chodesh Adar I
+2014/2/14* Purim Katan
+2014/3/1* Shabbat Shekalim
+2014/3/2* Rosh Chodesh Adar II
+2014/3/3* Rosh Chodesh Adar II
+2014/3/13* Ta'anit Esther
+2014/3/15* Shabbat Zachor
+2014/3/16* Purim
+2014/3/17* Shushan Purim
+2014/3/22* Shabbat Parah
+2014/3/29* Shabbat HaChodesh
+2014/4/1* Rosh Chodesh Nisan
+2014/4/12* Shabbat HaGadol
+2014/4/14* Ta'anit Bechorot
+2014/4/14* Erev Pesach
+2014/4/15* Pesach I
+2014/4/16* Pesach II
+2014/4/17* Pesach III (CH''M)
+2014/4/18* Pesach IV (CH''M)
+2014/4/19* Pesach V (CH''M)
+2014/4/20* Pesach VI (CH''M)
+2014/4/21* Pesach VII
+2014/4/22* Pesach VIII
+2014/4/27* Yom HaShoah
+2014/4/30* Rosh Chodesh Iyyar
+2014/5/1* Rosh Chodesh Iyyar
+2014/5/5* Yom HaZikaron
+2014/5/6* Yom HaAtzma'ut
+2014/5/18* Lag B'Omer
+2014/5/28* Yom Yerushalayim
+2014/5/30* Rosh Chodesh Sivan
+2014/6/3* Erev Shavuot
+2014/6/4* Shavuot I
+2014/6/5* Shavuot II
+2014/6/28* Rosh Chodesh Tamuz
+2014/6/29* Rosh Chodesh Tamuz
+2014/7/15* Tzom Tammuz
+2014/7/28* Rosh Chodesh Av
+2014/8/2* Shabbat Hazon
+2014/8/5* Tish'a B'Av
+2014/8/9* Shabbat Nachamu
+2014/8/26* Rosh Chodesh Elul
+2014/8/27* Rosh Chodesh Elul
+2014/9/24* Erev Rosh Hashana
+2014/9/25* Rosh Hashana 5775
+2014/9/26* Rosh Hashana II
+2014/9/27* Shabbat Shuva
+2014/9/28* Tzom Gedaliah
+2014/10/3* Erev Yom Kippur
+2014/10/4* Yom Kippur
+2014/10/8* Erev Sukkot
+2014/10/9* Sukkot I
+2014/10/10* Sukkot II
+2014/10/11* Sukkot III (CH''M)
+2014/10/12* Sukkot IV (CH''M)
+2014/10/13* Sukkot V (CH''M)
+2014/10/14* Sukkot VI (CH''M)
+2014/10/15* Sukkot VII (Hoshana Raba)
+2014/10/16* Shmini Atzeret
+2014/10/17* Simchat Torah
+2014/10/24* Rosh Chodesh Cheshvan
+2014/10/25* Rosh Chodesh Cheshvan
+2014/11/23* Rosh Chodesh Kislev
+2014/12/16* Chanukah: 1 Candle
+2014/12/17* Chanukah: 2 Candles
+2014/12/18* Chanukah: 3 Candles
+2014/12/19* Chanukah: 4 Candles
+2014/12/20* Chanukah: 5 Candles
+2014/12/21* Chanukah: 6 Candles
+2014/12/22* Rosh Chodesh Tevet
+2014/12/22* Chanukah: 7 Candles
+2014/12/23* Rosh Chodesh Tevet
+2014/12/23* Chanukah: 8 Candles
+2014/12/24* Chanukah: 8th Day
+2015/1/1* Asara B'Tevet
+2015/1/21* Rosh Chodesh Sh'vat
+2015/2/4* Tu B'Shvat
+2015/2/14* Shabbat Shekalim
+2015/2/19* Rosh Chodesh Adar
+2015/2/20* Rosh Chodesh Adar
+2015/2/28* Shabbat Zachor
+2015/3/4* Ta'anit Esther
+2015/3/5* Purim
+2015/3/6* Shushan Purim
+2015/3/14* Shabbat Parah
+2015/3/21* Rosh Chodesh Nisan
+2015/3/21* Shabbat HaChodesh
+2015/3/28* Shabbat HaGadol
+2015/4/2* Ta'anit Bechorot
+2015/4/3* Erev Pesach
+2015/4/4* Pesach I
+2015/4/5* Pesach II
+2015/4/6* Pesach III (CH''M)
+2015/4/7* Pesach IV (CH''M)
+2015/4/8* Pesach V (CH''M)
+2015/4/9* Pesach VI (CH''M)
+2015/4/10* Pesach VII
+2015/4/11* Pesach VIII
+2015/4/16* Yom HaShoah
+2015/4/19* Rosh Chodesh Iyyar
+2015/4/20* Rosh Chodesh Iyyar
+2015/4/22* Yom HaZikaron
+2015/4/23* Yom HaAtzma'ut
+2015/5/7* Lag B'Omer
+2015/5/17* Yom Yerushalayim
+2015/5/19* Rosh Chodesh Sivan
+2015/5/23* Erev Shavuot
+2015/5/24* Shavuot I
+2015/5/25* Shavuot II
+2015/6/17* Rosh Chodesh Tamuz
+2015/6/18* Rosh Chodesh Tamuz
+2015/7/5* Tzom Tammuz
+2015/7/17* Rosh Chodesh Av
+2015/7/25* Shabbat Hazon
+2015/7/26* Tish'a B'Av
+2015/8/1* Shabbat Nachamu
+2015/8/15* Rosh Chodesh Elul
+2015/8/16* Rosh Chodesh Elul
+2015/9/13* Erev Rosh Hashana
+2015/9/14* Rosh Hashana 5776
+2015/9/15* Rosh Hashana II
+2015/9/16* Tzom Gedaliah
+2015/9/19* Shabbat Shuva
+2015/9/22* Erev Yom Kippur
+2015/9/23* Yom Kippur
+2015/9/27* Erev Sukkot
+2015/9/28* Sukkot I
+2015/9/29* Sukkot II
+2015/9/30* Sukkot III (CH''M)
+2015/10/1* Sukkot IV (CH''M)
+2015/10/2* Sukkot V (CH''M)
+2015/10/3* Sukkot VI (CH''M)
+2015/10/4* Sukkot VII (Hoshana Raba)
+2015/10/5* Shmini Atzeret
+2015/10/6* Simchat Torah
+2015/10/13* Rosh Chodesh Cheshvan
+2015/10/14* Rosh Chodesh Cheshvan
+2015/11/12* Rosh Chodesh Kislev
+2015/11/13* Rosh Chodesh Kislev
+2015/12/6* Chanukah: 1 Candle
+2015/12/7* Chanukah: 2 Candles
+2015/12/8* Chanukah: 3 Candles
+2015/12/9* Chanukah: 4 Candles
+2015/12/10* Chanukah: 5 Candles
+2015/12/11* Chanukah: 6 Candles
+2015/12/12* Rosh Chodesh Tevet
+2015/12/12* Chanukah: 7 Candles
+2015/12/13* Rosh Chodesh Tevet
+2015/12/13* Chanukah: 8 Candles
+2015/12/14* Chanukah: 8th Day
+2015/12/22* Asara B'Tevet
+
+/*
+ * The calendar data below was for 2007, so it is commented out.
+ */
+
+/*
+ * Jewish calendar for the CE year 2007
+ * 11 Tevet 5767 - 22 tevet 5768
+
+01/06* Parshas Vayechi
+01/13* Parshas Shemos
+01/20* Parshas Vaera
+01/20* Rosh Chodesh Shevat (Beginning of the month of Shevat)
+01/27* Parshas Bo
+02/03* Parshas Beshalach
+02/03* Shabbos Shira
+02/03* Tu B'Shevat (Feast of Trees)
+02/10* Parshas Yisro
+02/17* Parshas Mishpatim
+02/17* Shabbos Shekalim
+02/18* Rosh Chodesh Adar (Beginning of the month of Adar)
+02/18* Be Happy! It's Adar
+02/19* Rosh Chodesh Adar (Beginning of the month of Adar)
+02/19* Be Happy! It's Adar
+02/24* Parshas Terumah
+03/01* Ta'anis Esther (Fast of Esther, Battle of Purim)
+03/03* Parshas Tetzaveh
+03/03* Shabbos Zachor
+03/04* Purim (Feast of Lots)
+03/05* Shushan Purim
+03/10* Parshas Ki Sisa
+03/10* Shabbos Parah
+03/17* Parshas Vayakhel-Pekudei
+03/17* Shabbos HaChodesh
+03/20* Rosh Chodesh Nissan (Beginning of the month of Nissan)
+03/24* Parshas Vayikra
+03/31* Parshas Tzav
+03/31* Shabbos Haggadol
+04/02* Erev Pesach
+04/02* Ta'anis Bechoros (Fast of the First Born)
+04/02* First Seder night
+04/03* Pesach (First Day of Passover; sabbatical)
+04/03* Second Sedar night
+04/04* Pesach (Second Day of Passover; sabbatical)
+04/04* Sefirat ha-Omer begins (Counting of the Omer)
+04/05* Omer 2nd day
+04/05* Pesach (Third Day of Passover; sabbatical)
+04/05* Hol Hamoed
+04/06* Omer 3rd day
+04/06* Pesach (Fourth Day of Passover)
+04/06* Hol Hamoed
+04/07* Omer 4th day
+04/07* Pesach (Fifth Day of Passover)
+04/07* Hol Hamoed
+04/08* Omer 5th day
+04/08* Pesach (Sixth Day of Passover)
+04/08* Hol Hamoed
+04/09* Omer 6th day
+04/09* Pesach (Seventh Day of Passover)
+04/10* Omer 7th day
+04/10* Pesach (Last Day of Passover; 8th day of Pesach; sabbatical)
+04/10* Yizkor
+04/11* Omer 8th day
+04/12* Omer 9th day
+04/13* Omer 10th day
+04/14* Omer 11th day
+04/14* Parshas Shmini
+04/15* Omer 12th day
+04/15* Yom HaShoah (Holocaust Memorial Day)
+04/16* Omer 13th day
+04/17* Omer 14th day
+04/18* Omer 15th day
+04/18* Rosh Chodesh Iyar (Beginning of the month of Iyar)
+04/19* Omer 16th day
+04/19* Rosh Chodesh Iyar (Beginning of the month of Iyar)
+04/20* Omer 17th day
+04/21* Omer 18th day
+04/21* Parshas Tazria-Metzora
+04/22* Omer 19th day
+04/23* Omer 20th day
+04/23* Yom HaZikaron
+04/24* Omer 21th day
+04/24* Yom HaAtzma'ut (Israel Independence Day)
+04/25* Omer 22th day
+04/26* Omer 23th day
+04/27* Omer 24th day
+04/28* Omer 25th day
+04/28* Parshas Achrei Kedoshim
+04/29* Omer 26th day
+04/30* Omer 27th day
+05/01* Omer 28th day
+05/02* Omer 29th day
+05/03* Omer 30th day
+05/04* Omer 31th day
+05/05* Omer 32th day
+05/05* Parshas Emor
+05/06* Lag B'Omer (Commemoration of the Great Rebellion)
+05/06* Omer 33th day
+05/07* Omer 34th day
+05/08* Omer 35th day
+05/09* Omer 36th day
+05/10* Omer 37th day
+05/11* Omer 38th day
+05/12* Omer 39th day
+05/12* Parshas Behar-Bechukosai
+05/13* Omer 40th day
+05/14* Omer 41th day
+05/15* Omer 42th day
+05/16* Omer 43th day
+05/16* Yom Yerushalayim (Reunification of Jerusalem)
+05/17* Omer 44th day
+05/18* Omer 45th day
+05/18* Rosh Chodesh Sivan (Beginning of the month of Sivan)
+05/19* Omer 46th day
+05/19* Parshas Bamidbar
+05/20* Omer 47th day
+05/21* Omer 48th day
+05/22* Erev Shavuos
+05/22* Omer 49th day
+05/23* Shavuos (Festival of Weeks; sabbatical)
+05/24* Shavuos (Festival of Weeks; sabbatical)
+05/24* Yizkor
+05/26* Parshas Nasso
+06/02* Parshas Beha'aloscha
+06/09* Parshas Shelach Lecha
+06/16* Parshas Korach
+06/16* Rosh Chodesh Tammuz (Beginning of the month of Tammuz)
+06/17* Rosh Chodesh Tammuz (Beginning of the month of Tammuz)
+06/23* Parshas Chukas
+06/30* Parshas Balak
+07/03* Fast of Shiv'a Asar B'Tammuz (Romans breach Wall of Jerusalem; fast day)
+07/03* Tzom Tammuz
+07/07* Parshas Pinchas
+07/14* Parshas Matos-Masei
+07/16* Rosh Chodesh Av (Beginning of the month of Av)
+07/21* Parshas Devarim
+07/21* Shabbos Hazon
+07/24* Fast of Tish'a B'Av (Babylon/Rome destroys Holy Temple; fast day)
+07/28* Parshas Vaeschanan
+07/28* Shabbos Nachamu
+07/30* Tu B'Av
+08/04* Parshas Eikev
+08/11* Parshas Re'eh
+08/14* Rosh Chodesh Elul (Beginning of the month of Elul)
+08/15* Rosh Chodesh Elul (Beginning of the month of Elul)
+08/18* Parshas Shoftim
+08/25* Parshas Ki Tetze
+09/01* Parshas Ki Savo
+09/08* Parshas Nitzavim-Vayeilech
+09/12* Erev Rosh Hashana
+09/13* First Day of Rosh Hashanah (Jewish New Year; 5768; sabbatical)
+09/13* Rosh Chodesh Tishrei (Beginning of the month of Tishrei)
+09/14* Rosh Hashanah (sabbatical)
+09/15* Parshas Ha'Azinu
+09/15* Shabbos Shuvah
+09/16* Fast of Gedalya (Murder of Gedalya and subsequent Exile; fast day)
+09/16* Tzom Gedaliah
+09/21* Erev Yom Kippur
+09/22* Yom Kippur (Day of Atonement; sabbatical, fast day)
+09/22* Yizkor
+09/26* Erev Sukkos
+09/27* Succos (Festival of Tabernacles; sabbatical)
+09/28* Succos (sabbatical)
+09/28* Sukkos (Second day of Sukkos)
+09/29* Sukkos (Third day of Sukkos)
+09/29* Hol Hamoed
+09/30* Sukkos (Fourth day of Sukkos)
+09/30* Hol Hamoed
+10/01* Sukkos (Fifth day of Sukkos)
+10/01* Hol Hamoed
+10/02* Sukkos (Sixth day of Sukkos)
+10/02* Hol Hamoed
+10/03* Hoshanah Rabba (Seventh day of Succos)
+10/03* Sukkos (Seventh day of Sukkos)
+10/04* Shmini Atzeres (8th Day of Gathering; sabbatical)
+10/04* Yizkor
+10/05* Simchas Torah (Rejoicing of the Law; sabbatical)
+10/06* Parshas Bereshis
+10/12* Rosh Chodesh Heshvan (Beginning of the month of Heshvan)
+10/13* Parshas Noach
+10/13* Rosh Chodesh Heshvan (Beginning of the month of Heshvan)
+10/20* Parshas Lech-Lecha
+10/27* Parshas Vayera
+11/03* Parshas Chayei Sara
+11/10* Parshas Toldos
+11/11* Rosh Chodesh Kislev (Beginning of the month of Kislev)
+11/17* Parshas Vayetzei
+11/24* Parshas Vayishlach
+12/01* Parshas Vayeshev
+12/04* Erev Chanukah
+12/04* Light 1st candle
+12/05* Chanukah (First Day)
+12/05* Light 2nd candle
+12/06* Chanukah (Second Day)
+12/06* Light 3rd candle
+12/07* Chanukah (Third Day)
+12/07* Light 4th candle
+12/08* Chanukah (Fourth Day)
+12/08* Parshas Miketz
+12/08* Light 5th candle
+12/09* Chanukah (Fifth Day)
+12/09* Light 6th candle
+12/10* Chanukah (Sixth Day)
+12/10* Rosh Chodesh Tevet (Beginning of the month of Tevet)
+12/10* Light 7th candle
+12/11* Chanukah (Seventh Day)
+12/11* Light 8th candle
+12/12* Chanukah (Eight Day)
+12/15* Parshas Vayigash
+12/19* Asara B'Tevet
+12/19* Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day)
+12/22* Parshas Vayechi
+12/29* Parshas Shemos
+
+*/
+
+#endif /* !_calendar_judaic_ */
diff --git a/usr.bin/calendar/calendars/calendar.lotr b/usr.bin/calendar/calendars/calendar.lotr
new file mode 100644
index 0000000..2450e36
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.lotr
@@ -0,0 +1,48 @@
+/*
+ * Lord Of The Rings
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_lotr_
+#define _calendar_lotr_
+
+01/05 Fellowship enters Moria
+01/09 Fellowship reaches Lorien
+01/17 Passing of Gandalf
+02/07 Fellowship leaves Lorien
+02/17 Death of Boromir
+02/20 Meriadoc & Pippin meet Treebeard
+02/22 Passing of King Ellesar
+02/24 Ents destroy Isengard
+02/26 Aragorn takes the Paths of the Dead
+03/05 Frodo & Samwise encounter Shelob
+03/08 Deaths of Denethor & Theoden
+03/18 Destruction of the Ring
+03/29 Flowering of the Mallorn
+04/04 Gandalf visits Bilbo
+04/17 An unexpected party
+04/23 Crowning of King Ellesar
+05/19 Arwen leaves Lorian to wed King Ellesar
+06/11 Sauron attacks Osgilliath
+06/13 Bilbo returns to Bag End
+06/23 Wedding of Ellesar & Arwen
+07/04 Gandalf imprisoned by Saruman
+07/24 The ring comes to Bilbo
+07/26 Bilbo rescued from Wargs by Eagles
+08/03 Funeral of King Theoden
+08/29 Saruman enters the Shire
+09/10 Gandalf escapes from Orthanc
+09/14 Frodo & Bilbo's birthday
+09/15 Black riders enter the Shire
+09/18 Frodo and company rescued by Bombadil
+09/28 Frodo wounded at Weathertop
+10/05 Frodo crosses bridge of Mitheithel
+10/16 Boromir reaches Rivendell
+10/17 Council of Elrond
+10/25 End of War of the Ring
+11/16 Bilbo reaches the Lonely Mountain
+12/05 Death of Smaug
+12/16 Fellowship begins Quest
+
+#endif /* !_calendar_lotr_ */
diff --git a/usr.bin/calendar/calendars/calendar.music b/usr.bin/calendar/calendars/calendar.music
new file mode 100644
index 0000000..967f6af
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.music
@@ -0,0 +1,240 @@
+/*
+ * Music
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_music_
+#define _calendar_music_
+
+01/01 Country Joe McDonald is born in El Monte, California, 1942
+01/03 Steven Stills is born in Dallas, 1945
+01/04 Jazz great Charlie Mingus dies at 57 in Cuernavaca, Mexico, 1979
+01/08 David Bowie (then David Robert Jones) is born in London, 1947
+01/08 Elvis Presley born, 1935
+01/09 James Patrick Page (Led Zeppelin) is born in Middlesex, England, 1945
+01/10 Blues guitarist Howlin' Wolf dies in Chicago, 1976
+01/10 Jim Croce is born in Philadelphia, 1943
+01/10 Pat Benatar is born in Long Island, 1952
+01/10 Rod Stewart is born in Glasgow, Scotland, 1945
+01/13 Eric Clapton plays the "Rainbow Concert" in London, 1973
+01/17 Led Zeppelin's first album is released, 1969
+01/19 Janis Joplin is born in Port Arthur, Texas, 1943
+01/22 Sam Cooke is born in Chicago, 1935
+01/24 Warren Zevon is born in Chicago, 1947
+01/25 Bob Dylan plays the second "Hurricane" benefit, in the Astrodome, 1978
+01/27 Bobby "Blue" Bland (Robert Calvin Bland) is born in Tennessee, 1930
+01/27 Wolfgang Amadeus Mozart is born in Salzburg, Austria, 1756
+01/28 Jimi Hendrix headlines Madison Square Garden, 1970
+01/30 Lightnin' Hopkins, the most-recorded blues artist ever, dies, 1982
+01/31 Franz Schubert is born in Lichtenthal, Vienna, Austria, 1797
+01/31 The Grateful Dead are busted in New Orleans, 1970
+02/01 RCA Victor unveils the 45 rpm record playing system, 1949
+02/02 Graham Nash is born in Lancashire, England, 1942
+02/03 Felix Mendelssohn Bartholdy is born in Hamburg, Germany, 1809
+02/03 The Day The Music Died; Buddy Holly, Richie Valens, and the Big
+ Bopper are killed in a plane crash outside Mason City, Iowa, 1959
+02/07 Beatles land at JFK airport to begin first U.S. tour, 1964
+02/07 Steven Stills makes the first digitally recorded rock album, 1979
+02/09 Carole King (Carole Klein) is born in Brooklyn, 1941
+02/12 The Beatles play Carnegie Hall in New York City, 1964
+02/13 Richard Wagner dies in Venice, Italy, 1883
+02/17 Jazz great Thelonius Monk dies in Englewood, New Jersey, 1982
+02/18 Yoko Ono Lennon is born in Tokyo, 1933
+02/19 Paul McCartney's "Give Ireland Back to the Irish" is banned in
+ Britain, 1972
+02/19 William "Smokey" Robinson is born in Detroit, 1940
+02/20 J. Geils (J. Geils Band) is born, 1946
+02/20 Yes sells out Madison Square Garden...without advertising, 1974
+02/23 George Friedrich Handel is born in Halle on the Saale, Germany, 1685
+02/23 Johnny Winter is born in Leland, Mississippi, 1944
+02/25 George Harrison born in Liverpool, England, 1943
+02/29 Jimmy Dorsey born, 1904
+03/01 Frederic Chopin is born in Zelazowa Wola, Warsaw, Poland, 1810
+03/01 Jim Morrison is busted for obscenity in Miami, 1969
+03/02 Blues guitarist Rory Gallagher is born in Ballyshannon, Ireland, 1949
+03/03 Buffalo Springfield is formed in Los Angeles, 1966
+03/04 Antonio Vivaldi born in Venice, Italy, 1678
+03/07 Last Gilbert & Sullivan opera produced, 1896
+03/08 Ron "Pigpen" McKernan (Grateful Dead) dies in California, 1973
+03/08 (Louis) Hector Berlioz dies in Paris, 1869
+03/09 Robin Trower is born in London, 1945
+03/13 The Allman Brothers record their live album at the Fillmore East, 1971
+03/15 Sly Stone born, 1944
+03/17 Paul Kantner (Jefferson Airplane) is born in San Francisco, 1942
+03/21 Johann Sebastian Bach is born in Eisenach, Germany, 1685
+03/22 Ten Years After plays their last concert, 1974
+03/25 Aretha Franklin is born in Detroit, 1943
+03/25 Bela Bartok is born in Nagyszentmiklos, Hungary, 1881
+03/26 Emerson, Lake, and Palmer record "Pictures at an Exhibition" live, 1971
+03/26 Ludwig van Beethoven dies in Vienna, Austria, 1827
+03/28 Sergej Rachmaninow dies in Beverley Hills, 1943
+03/29 Carl Orff dies in Munich, Germany, 1982
+03/29 Dr. Hook gets a group picture on the cover of "Rolling Stone", 1973
+03/30 Eric Clapton is born in Surrey, England, 1945
+03/31 Joseph Haydn is born in Rohrau, Austria, 1732
+04/01 Sergej Rachmaninow is born in Oneg, Russia, 1873
+04/02 Marvin Gaye is born in Washington, D.C., 1939
+04/04 Muddy Waters (McKinley Morganfield) is born in Rolling Fork,
+ Mississippi, 1915
+04/09 Paul Robeson born, 1898
+04/10 Paul McCartney announces that he's quitting the Beatles, 1970
+04/14 George Friedrich Handel dies in London, England, 1759
+04/14 Ritchie Blackmore (Deep Purple, Rainbow) is born, 1945
+04/18 Yes breaks up after 13 years, 1981
+04/25 Blues guitarist Albert King is born, 1925
+04/25 Ella Fitzgerald born, 1918
+04/26 Carol Burnett born in San Antonio, Texas, 1933
+04/29 "Hair" premiers on Broadway, 1968
+05/01 Kate Smith born, 1909
+05/01 Antonin Dvorak dies in Prague, 1904
+05/03 Bob Seger is born in Ann Arbor, Michigan, 1945
+05/07 Johannes Brahms is born in Hamburg, Germany, 1833
+05/07 Tchaikowsky born, 1840
+05/10 Dave Mason is born in Worcester, England, 1945
+05/11 Bob Marley dies in his sleep in Miami, 1981
+05/12 Pink Floyd performs the first quadrophonic concert, 1977
+05/18 Gustav Mahler dies in Vienna, Austria, 1911
+05/18 Rick Wakeman is born in West London, England, 1949
+05/19 Pete Townshend is born in London, 1945
+05/20 The Jimi Hendrix Experience is signed by Reprise Records, 1967
+05/22 Richard Wagner is born in Leipzig, Germany, 1813
+05/23 Blues great Elmore James dies, 1963
+05/24 Bob Dylan (Robert Zimmerman) is born in Duluth, 1941
+05/26 Al Jolson born, 1886
+05/31 Joseph Haydn dies in Vienna, Austria, 1809
+05/31 The Who perform the loudest concert ever -- 76,000 watts of PA, 1976
+06/01 The Beatles release "Sgt. Pepper", 1967
+06/03 Georges Bizet dies in Bougival, Paris, France, 1875
+06/05 Carl Maria von Weber dies in London, England, 1826
+06/06 "Rock Around The Clock" makes Billboard's #1 slot, 1955
+06/06 Dee Dee Ramone dies, 2002
+06/07 Blind Faith debuts in concert at London's Hyde Park, 1969
+06/08 Robert Schumann is born in Zwickau, Germany, 1810
+06/09 Les Paul (Lester Polfus) is born in Waukesha, Wisconsin, 1923
+06/10 Howlin' Wolf (Chester Burnett) is born in West Point, Mississippi, 1910
+06/10 Judy Garland born, 1922
+06/11 Richard Strauss is born in Munich, Germany, 1864
+06/15 Edvard Grieg is born in Bergen, Norway, 1843
+06/15 Harry Nilsson is born in Brooklyn, 1941
+06/16 The Monterey Pop festival opens, 1967
+06/18 Paul McCartney born in Liverpool, England, 1942
+06/21 Columbia records announces the first mass production of LP's, 1948
+06/22 Todd Rundgren is born in Upper Darby, Pennsylvania, 1948
+06/24 Jeff Beck is born in Surrey, England, 1944
+06/27 John Entwistle dies in Las Vegas, 2002
+07/02 Felix Pappalardi and Leslie West form Mountain, 1969
+07/03 Jim Morrison dies in Paris, 1971
+07/06 The Jefferson Airplane is formed in San Francisco, 1965
+07/07 Gustav Mahler is born in Kalischt, Bohemia, 1860
+07/07 Ringo Starr (Richard Starkey) born in Liverpool, England, 1940
+07/10 Carl Orff is born in Munich, Germany, 1895
+07/12 Chicago DJ Steve Dahl holds "Disco Demolition" at Kamisky Park, 1979
+07/14 Woodie Guthrie born, 1912
+07/16 Cream forms in the U.K., 1966
+07/16 Harry Chapin dies on Long Island Expressway, 1981
+07/17 "Yellow Submarine" premieres at the London Pavilion, 1968
+07/20 Carlos Santana is born in Autlan, Mexico, 1947
+07/25 Bob Dylan goes electric at the Newport Folk Festival, 1965
+07/25 Crosby, Stills, Nash & Young debut at the Fillmore East, 1969
+07/26 Mick Jagger is born in Kent, England, 1943
+07/28 Antonio Vivaldi dies in Vienna, 1741
+07/28 Johann Sebastian Bach dies in Leipzig, 1750
+07/28 The Watkins Glen "Summer Jam" opens, 1973
+07/29 Robert Schumann dies in Endenich, Bonn, Germany, 1856
+08/01 The Concert for Bangla Desh takes place at Madison Square Garden, 1971
+08/04 John Lennon points out that "the Beatles are more popular than Jesus", 1966
+08/10 Ian Anderson (Jethro Tull) is born in Edinburgh, Scotland, 1947
+08/13 Dan Fogelberg is born in Peoria, Illinois, 1951
+08/15 Beatles replace drummer Pete Best with Richard Starkey, 1962
+08/15 The Beatles play Shea Stadium in New York, 1965
+08/15 Woodstock Festival, Max Yasgur's farm, 1969
+08/16 Elvis Presley dies, 1977
+08/16 Madonna Louise Ciccone born in Bay City, Michigan, 1958
+08/21 Joe Strummer (The Clash), born John Mellor in Ankara, Turkey, 1952
+08/23 Keith Moon is born in London, England, 1946
+08/26 Jimi Hendrix gives his last performance at the Isle of Wight, 1970
+08/26 Jimi Hendrix's Electric Ladyland Studios opens in New York, 1970
+09/04 Edvard Grieg dies in Bergen, Norway, 1907
+09/07 Keith Moon (The Who) dies in London of a drug overdose, 1978
+09/07 Warren Zevon dies in Los Angeles of lung cancer (mesothelioma), 2003
+09/08 Antonin Dvorak born in Nelahozeves, Bohemia, 1841
+09/08 Richard Strauss dies in Garmisch-Partenkirchen, Germany, 1949
+09/08 Ron "Pigpen" McKernan (Grateful Dead) is born in San Bruno, California, 1945
+09/14 Francis Scott Key writes words to "Star Spangled Banner", 1814
+09/16 B.B. King is born in Itta Bena, Mississippi, 1925
+09/18 Dee Dee Ramone (Douglas Colvin) born in Fort Lee, Virginia, 1952
+09/19 Simon & Garfunkel reunite to play New York's Central Park, 1981
+09/20 Jim Croce dies in a plane crash, 1973
+09/23 "Paul is dead" rumors sweep the country, 1969
+09/23 Bruce "The Boss" Springsteen is born in Freehold, New Jersey, 1949
+09/25 John Bonham (Led Zeppelin) dies of alcohol poisoning, 1980
+09/26 Bela Bartok dies in New York, 1945
+09/26 George Gershwin is born in Brooklyn, NY, 1898
+10/04 Janis Joplin dies of a heroin overdose in Hollywood, 1970
+10/05 Steve Miller is born in Dallas, 1943
+10/07 First Bandstand (later, American Bandstand) broadcast, 1957
+10/09 John Entwistle is born in London, England, 1944
+10/09 John Lennon born in Liverpool, England, 1940
+10/10 John Prine is born in Maywood, Illinois, 1946
+10/12 Ray Conniff dies after falling down and hitting his head, 2002
+10/12 The Jimi Hendrix Experience is formed in London, 1966
+10/16 Bob Weir (Grateful Dead) is born in San Francisco, 1947
+10/17 "Hair" opens at New York's Public Theater, 1967
+10/17 Frederic Chopin dies in Paris, France, 1849
+10/18 Chuck Berry is born in St. Louis, Missouri, 1926
+10/20 Three members of Lynyrd Skynyrd die in a plane crash, 1977
+10/21 Jesus Christ Super Star debuted on Broadway, 1971
+10/22 Franz Liszt born, 1811
+10/22 Pablo Casals dies in Puerto Rico, 1973
+10/25 Georges Bizet is born in Paris, France, 1838
+10/25 Jon Anderson (Yes) is born in Lancashire, England, 1944
+10/25 The Rolling Stones appear on The Ed Sullivan Show, 1964
+10/29 Duane Allman dies in motorcycle crash near Macon, Georgia, 1971
+10/30 Grace Slick is born in Chicago, 1939
+11/02 Jimi Hendrix's "Electric Ladyland" enters US charts at #1, 1968
+11/02 Keith Emerson is born, 1944
+11/03 James Taylor and Carly Simon are married in Manhattan, 1972
+11/04 Felix Mendelssohn Bartholdy dies in Leipzig, Germany, 1847
+11/06 Ray Conniff born in Attleboro, Massachusetts, 1916
+11/07 Joni Mitchell (Roberta Joan Anderson) is born in Alberta, Canada, 1943
+11/08 Patti Page born, 1927
+11/09 The first issue of "Rolling Stone" is published, 1967
+11/10 Greg Lake is born in Bournemouth, England, 1948
+11/12 Neil Young is born in Toronto, 1945
+11/13 Paul Simon born, 1942
+11/16 Bill Ham first demonstrates his psychedelic "Light Show", 1965
+11/18 Carl Maria von Weber is born in Eutin, Germany, 1786
+11/19 Franz Schubert dies in Vienna, Austria, 1828
+11/20 Duane Allman is born in Nashville, Tennessee, 1946
+11/20 Joe Walsh is born in Cleveland, 1947
+11/22 Saint Cecilia's day (patron saint of music)
+11/24 Scott Joplin born, 1868
+11/25 "The Last Waltz" concert is played by The Band at Winterland, 1976
+11/25 Johann Strauss, Jr., writes `On the Beautiful Blue Danube', 1867
+11/26 Cream performs their farewell concert at Royal Albert Hall, 1968
+11/26 Paul Hindemith is born in Hanau, Germany, 1895
+11/27 Jimi Hendrix (Johnny Allen Hendrix) is born in Seattle, 1942
+11/29 Pau Casals born in Vendrell, 1876
+11/30 George Harrison dies at 13:30 in L.A., 2001
+12/04 Frank Zappa dies in his Laurel Canyon home shortly before 18:00, 1993
+12/05 Wolfgang Amadeus Mozart dies in Vienna, Austria, 1791
+12/06 First sound recording made by Thomas Edison, 1877
+12/06 The Rolling Stones play Altamont Speedway near San Francisco, 1969
+12/07 Harry Chapin is born in New York City, 1942
+12/08 Jim Morrison is born in Melbourne, Florida, 1943
+12/08 John Lennon is shot and killed in New York City, 1980
+12/09 The Who's "Tommy" premieres in London, 1973
+12/11 (Louis) Hector Berlioz born in La-Côte-Saint-André, 1803
+12/13 Ted Nugent, the motor city madman, born in Detroit, 1949
+12/15 Thomas Edison receives patent on the phonograph, 1877
+12/16 Don McLean's "American Pie" is released, 1971
+12/17 Ludwig van Beethoven is christened in Bonn, 1770
+12/21 Frank Zappa is born in Baltimore, 1940
+12/23 First G&S collaboration, Thespis, 1871
+12/23 Joe Strummer (born John Mellor) dies in Broomfield, England, 2002
+12/28 Edgar Winter is born in Beaumont, Texas, 1946
+12/28 Paul Hindemith dies in Frankfurt/Main, Germany, 1963
+12/31 Jimi Hendrix introduces the Band of Gypsies at the Fillmore East, 1969
+
+#endif /* !_calendar_music_ */
diff --git a/usr.bin/calendar/calendars/calendar.newzealand b/usr.bin/calendar/calendars/calendar.newzealand
new file mode 100644
index 0000000..be069df
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.newzealand
@@ -0,0 +1,25 @@
+/*
+ * New Zealand holidays
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_newzealand_
+#define _calendar_newzealand_
+
+Jan 02 New Year Holiday (NZ)
+Jan 14 Anniversary Day (Southland)
+Jan 21 Anniversary Day (Wellington)
+Jan 28 Anniversary Day (Auckland)
+Feb 06 Waitangi Day (NZ)
+Mar 11 Anniversary Day (Taranaki)
+Mar 25 Anniversary Day (Otago)
+Jun 03 Queen's Birthday (NZ)
+Sep 23 Anniversary Day (South Canterbury)
+Oct 25 Anniversary Day (Hawke's Bay)
+Oct 28 Labour Day (NZ)
+Nov 04 Anniversary Day (Marlborough)
+Nov 15 Anniversary Day (Canterbury)
+Dec 02 Anniversary Day (Chatham Islands)
+
+#endif
diff --git a/usr.bin/calendar/calendars/calendar.russian b/usr.bin/calendar/calendars/calendar.russian
new file mode 100644
index 0000000..0701876
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.russian
@@ -0,0 +1,12 @@
+/*
+ * Russian calendar files
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_russian_
+#define _calendar_russian_
+
+#include <ru_RU.KOI8-R/calendar.all>
+
+#endif /* !_calendar_russian_ */
diff --git a/usr.bin/calendar/calendars/calendar.southafrica b/usr.bin/calendar/calendars/calendar.southafrica
new file mode 100644
index 0000000..ae683b0
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.southafrica
@@ -0,0 +1,23 @@
+/*
+ * South African holidays
+ * Note: The Public Holidays Act (Act No 36 of 1994) determines whenever
+ * any public holiday falls on a Sunday, the Monday following on it shall
+ * be an unnamed public holiday in addition to the named holiday the day
+ * before. This file format is not complex enough to reflect this, but
+ * if it ever is, the change should be made.
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_southafrica_
+#define _calendar_southafrica_
+
+03/01 Human Rights Day in South Africa
+04/27 Freedom Day in South Africa
+05/01 Workers Day in South Africa
+06/16 Youth Day in South Africa
+08/09 National Women's Day in South Africa
+09/24 Heritage Day in South Africa
+12/16 Day of Reconciliation in South Africa
+12/26 Day of Goodwill in South Africa
+
+#endif
diff --git a/usr.bin/calendar/calendars/calendar.ukrainian b/usr.bin/calendar/calendars/calendar.ukrainian
new file mode 100644
index 0000000..3cff8c5
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.ukrainian
@@ -0,0 +1,12 @@
+/*
+ * Ukrainian calendar files
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_ukrainian_
+#define _calendar_ukrainian_
+
+#include <uk_UA.KOI8-U/calendar.all>
+
+#endif /* !_calendar_ukrainian_ */
diff --git a/usr.bin/calendar/calendars/calendar.usholiday b/usr.bin/calendar/calendars/calendar.usholiday
new file mode 100644
index 0000000..8ae0bc0
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.usholiday
@@ -0,0 +1,42 @@
+/*
+ * USA holiday
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_usholiday_
+#define _calendar_usholiday_
+
+01/01 New Year's Day
+01/14 Julian Calendar New Year's Day
+02/02 Groundhog Day
+02/14 St. Valentine's Day
+02/MonThird President's Day (3rd Monday of February)
+03/05 Mother-in-Law Day, USA
+03/SunSecond Daylight Savings Time begins in USA; clocks move forward (2nd Sunday of March)
+03/17 St. Patrick's Day
+03/20* Vernal Equinox
+04/01 April Fool's Day
+04/15 Income Tax Day, USA.
+04/28* Arbor Day, USA (varies from state to state)
+05/SunSecond Mother's Day (2nd Sunday of May)
+05/SatThird Armed Forces in USA Day (3rd Saturday of May)
+05/MonLast Memorial Day in USA (Last Monday of May)
+06/SunThird Father's Day (3rd Sunday of June)
+06/21* Summer Solstice
+07/04 US Independence Day
+09/MonFirst Labor Day in USA (1st Monday of September)
+09/SunSecond Grandparent's Day in USA (2nd Sunday of September; varies from state to state)
+09/22* Autumnal Equinox
+10/MonSecond Columbus Day in USA (2nd Monday of October)
+10/31 All Hallows Eve (Halloween)
+11/05* Election Day in USA (1st Tuesday after 1st Monday for even years)
+11/SunFirst Daylight Savings Time ends in USA; clocks move back (1st Sunday of November)
+11/11 Veterans' Day
+11/ThuFourth Thanksgiving Day (4th Thursday in November)
+12/21* Winter Solstice
+12/24 Christmas Eve
+12/25 Christmas
+12/31 New Year's Eve
+
+#endif /* !_calendar_usholiday_ */
diff --git a/usr.bin/calendar/calendars/calendar.world b/usr.bin/calendar/calendars/calendar.world
new file mode 100644
index 0000000..2b65f1a
--- /dev/null
+++ b/usr.bin/calendar/calendars/calendar.world
@@ -0,0 +1,19 @@
+/*
+ * World wide calendar files, except national calendars
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_world_
+#define _calendar_world_
+
+#include <calendar.birthday>
+#include <calendar.christian>
+#include <calendar.computer>
+#include <calendar.history>
+#include <calendar.lotr>
+#include <calendar.holiday>
+#include <calendar.judaic>
+#include <calendar.music>
+
+#endif /* !_calendar_world_ */
diff --git a/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag b/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag
new file mode 100644
index 0000000..751c001
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag
@@ -0,0 +1,62 @@
+/*
+ * Feiertage
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_AT_ISO8859_15_feiertag_
+#define _de_AT_ISO8859_15_feiertag_
+
+LANG=de_AT.ISO8859-15
+
+/* arbeitsfreie staatliche Feiertage */
+01/01 Neujahr
+05/01 Staatsfeiertag
+10/26 Nationalfeiertag
+
+/* christliche Feiertage, meist irgendwo arbeitsfrei */
+01/06 Heilige 3 Könige
+Easter-2 Karfreitag
+Easter Ostersonntag
+Easter+1 Ostermontag
+Easter+49 Pfingstsonntag
+Easter+50 Pfingstmontag
+Easter+39 Christi Himmelfahrt
+Easter+60 Fronleichnam
+
+08/15 Mariä Himmelfahrt
+
+11/01 Allerheiligen
+11/02 Allerseelen
+
+12/08 Mariä Empfängnis
+12/24 Heiligabend
+12/25 Weihnachten
+12/26 Stephanstag
+12/31 Silvester
+
+/* Gedenktage - nicht arbeitsfreie Feiertage */
+02/14 Valentinstag
+02/WednesdayLast Aschermittwoch
+Easter-7 Palmsonntag
+Nov Sun+3 Totensonntag
+Nov Sun+4 1. Advent
+Dec Sun+1 2. Advent
+12/06 Nikolaus
+Dec Sun+2 3. Advent
+Dec Sun+3 4. Advent
+
+/* Jahreszeiten */
+03/20* Frühlingsanfang
+06/21* Sommeranfang
+09/23* Herbstanfang
+12/21* Winteranfang
+
+/* Sommer- und Winterzeit */
+03/SundayLast Anfang der Sommerzeit
+10/SundayLast Ende der Sommerzeit
+
+/* Blumenverkäufer */
+May Sun+2 Muttertag
+
+#endif /*! _de_AT_ISO8859_15_feiertag_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.all b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.all
new file mode 100644
index 0000000..f2a33cc
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.all
@@ -0,0 +1,17 @@
+/*
+ * deutscher Kalender
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_all_
+#define _de_DE_ISO8859_1_all_
+
+#include <de_DE.ISO8859-1/calendar.feiertag>
+#include <de_DE.ISO8859-1/calendar.geschichte>
+#include <de_DE.ISO8859-1/calendar.kirche>
+#include <de_DE.ISO8859-1/calendar.literatur>
+#include <de_DE.ISO8859-1/calendar.musik>
+#include <de_DE.ISO8859-1/calendar.wissenschaft>
+
+#endif /* !_de_DE.ISO8859-1_all_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.feiertag b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.feiertag
new file mode 100644
index 0000000..f966c0d
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.feiertag
@@ -0,0 +1,56 @@
+/*
+ * Feiertage
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_feiertag_
+#define _de_DE_ISO8859_1_feiertag_
+
+LANG=de_DE.ISO8859-1
+
+/* arbeitsfreie staatliche Feiertage */
+01/01 Neujahr
+05/01 Maifeiertag
+10/03 Tag der deutschen Einheit
+
+/* christliche Feiertage, meist irgendwo arbeitsfrei */
+Easter-2 Karfreitag
+Easter Ostersonntag
+Easter+1 Ostermontag
+Easter+49 Pfingstsonntag
+Easter+50 Pfingstmontag
+Easter+39 Christi Himmelfahrt
+Easter+60 Fronleichnam
+
+08/08 Friedensfest (Augsburg)
+08/15 Mariä Himmelfahrt
+
+10/31 Reformationstag
+11/01 Allerheiligen
+11/02 Allerseelen
+11/Wed+4 Buß- und Bettag
+
+12/24 Heiligabend
+12/25 Erster Weihnachtstag
+12/26 Zweiter Weihnachtstag
+12/31 Silvester
+
+/* Gedenktage - nicht arbeitsfreie Feiertage :-( */
+06/17 Arbeiteraufstand am 17. Juni 1953
+01/27 Gedenktag für die Opfer des Nationalsozialismus
+
+/* Jahreszeiten */
+03/20* Frühlingsanfang
+06/21* Sommeranfang
+09/23* Herbstanfang
+12/21* Winteranfang
+
+/* Sommer- und Winterzeit */
+03/SundayLast Anfang der Sommerzeit
+10/SundayLast Ende der Sommerzeit
+
+/* Blumenverkäufer */
+May Sun+2 Muttertag
+
+#endif /*! _de_DE_ISO8859_1_feiertag_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte
new file mode 100644
index 0000000..4ca78bb
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte
@@ -0,0 +1,198 @@
+/*
+ * deutsche Geschichte
+ *
+ *
+ * Die Angaben wurden überwiegend entnommen aus dem Buch:
+ *
+ * Fragen an die deutsche Geschichte, Ideen, Kräfte, Entscheidungen von
+ * 1800 bis zur Gegenwart; historische Ausstellung im Reichstagsgebäude
+ * in Berlin; Katalog, 16. Auflage, Sonderausgabe - Bonn: Deutscher
+ * Bundestag, Referat Öffentlichkeitsarbeit, 1990
+ *
+ * English Title: Questions on German history
+ *
+ * ISBN 3-924521-59-X
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_geschichte_
+#define _de_DE_ISO8859_1_geschichte_
+
+LANG=de_DE.ISO8859-1
+
+/* 1800-1933 */
+07/11 Gründung des Rheinbundes, 1806
+10/14 Doppelschlacht bei Jena und Auerstedt, 1806
+10/16 Völkerschlacht bei Leipzig, 1813
+06/18 Niederlage Napoleons bei Waterloo, 1815
+10/18 Wartburgfest der Deutschen Burschenschaften, 1817
+01/01 Inkrafttreten des Vertrages über den deutschen Zollverein, 1834
+12/07 Erste deutsche Eisenbahn zwischen Nürnberg und Fürth, 1835
+06 Aufstand der schlesischen Weber, 1844
+12/21 Verabschiedung des Gesetzes über die Grundrechte des deutschen
+ Volkes durch die Frankfurter Nationalversammlung, 1848
+03/27 Annahme der deutschen Reichsverfassung in der Frankfurter
+ Paulskirche, Wahl von Friedrich Wilhelm IV von Preußen zum
+ deutschen Kaiser, 1849
+04/28 Ablehnung der deutschen Kaiserkrone durch den preußischen König, 1849
+07/03 Schlacht von Königgrätz
+07/13 Emser Depesche, 1870
+07/18 Verkündung des Dogmas von der päpstlichen Unfehlbarkeit
+ durch das I. Vatikanische Konzil
+01/18 Proklamation des deutschen Kaiserreiches in Versailles, 1871
+10/18 Verabschiedung des Sozialistengesetzes durch den Reichstag, 1878
+03/20 Entlassung von Bismarck als Reichskanzler und
+ preußischer Ministerpräsident, 1890
+06/21 Eröffnung des Nord-Ostsee-Kanals, 1895
+01/07 Billigung des Bürgerlichen Gesetzbuches (BGB) durch den Reichstag, 1896
+01/01 Bürgerliches Gesetzbuch tritt in Kraft, 1900
+06/28 Ermordung des österreichischen Thronfolgers Erzherzog Franz
+ Ferdinand durch serbische Nationalisten in Sarajewo, 1914
+07/28 Kriegserklärung Österreich-Ungarns an Serbien, 1914
+08/01 Deutsche Mobilmachung und Kriegserklärung an Rußland, 1914
+08/03 Deutsche Kriegserklärung an Frankreich, 1914
+08/04 Kriegserklärung Großbritanniens an Deutschland, 1914
+08/04 Bewilligung der Kriegskredite im Reichstag, 1914
+08/26 Schlacht bei Tannenberg, 1914
+02/21 Schlacht um Verdun, 1916
+03/08 Ausbruch der Revolution in Rußland, Abdankung von Zar Nikolaus II, 1917
+04/06 Kriegserklärung der USA an Deutschland, 1917
+12/15 Waffenstillstand zwisch Rußland und Deutschland, 1917
+03/03 Frieden von Brest-Litowsk, 1918
+11/03 Matrosenaufstand in Kiel, 1918
+11/09 Ausrufung der Republik durch Scheidemann (SPD), 1918
+02/11 Friedrich Ebert wird Reichspräsident, Weimar 1919
+06/28 Unterzeichnung des Versailler Vertrages, 1919
+03/21 Volksabstimmung in Oberschlesien, 1921
+04/16 Vertrag von Rapallo, 1922
+06/24 Ermordung von Reichsaußenminister Rathenau, 1922
+01/11 Besetzung des Ruhrgebietes durch Frankreich und Belgien, 1923
+09/10 Eintritt Deutschlands in den Völkerbund, 1926
+10/25 Schwarzer Freitag in New York, Beginn der Weltwirtschaftskrise, 1929
+
+
+/* II. Weltkrieg */
+10/14 Austritt Deutschlands aus dem Völkerbund, 1933
+03/16 Wiedereinführung der allgemeinen Wehrpflicht in Deutschland, 1935
+10/25 Deutsch-italienischer Vertrag, Achse Berlin-Rom, 1936
+11/25 Antikominternpakt zwischen Deutschland und Japan, 1936
+01/13 Volksabstimmung im Saargebiet über die Rückführung
+ ins deutsche Reich, 1935
+03/12 Einmarsch deutscher Truppen in Österreich, 1938
+09/29 Münchner Abkommen, 1938
+03/15 Einmarsch deutscher Truppen in die Tschechoslowakei, 1939
+03/23 Rückgabe des Memelgebietes an Deutschland, 1939
+08/23 Abschluß des Hitler-Stalin-Paktes, 1939
+09/03 Kriegserklärung Großbritaniens und Frankreichs an Deutschland, 1939
+04/09 Deutsche Besetzung Dänemarks, Invasion in Norwegen, 1940
+05/10 Deutscher Angriff auf Belgien, die Niederlande, Luxemburg
+ und Frankreich, 1940
+06/22 Deutscher Angriff gegen die Sowjetunion, 1941
+12/11 Kriegserklärung Deutschlands an die USA, 1941
+01/14 Konferenz von Casablanca, 1943
+01/31 Kapitulation der 6. deutschen Armee in Stalingrad, 1943
+06/06 Alliierte Landung in Nordwestfrankreich, 1944
+02/04 Konferenz von Jalta, 4.-11.2. 1945
+04/25 Zusammentreffen von amerikanischen und sowjetischen Truppen
+ bei Torgau an der Elbe, 1945
+05/08 Bedingungslose Kapitulation von Deutschland, 1945
+07/01 Rückzug britischer und amerikanischer Truppen aus Sachsen, Thüringen und
+ Mecklenburg, Einmarsch westlicher Truppen in Berlin, 1945
+07/17 Potsdamer Konferenz, 1945
+09/01 Deutscher Überfall auf Polen, Beginn des 2. Weltkrieges, 1939
+10/01 Verkündigung der Urteile im Nürnberger Hauptkriegsverbrecherprozeß, 1946
+02/25 Auflösung der Landes Preußen durch den Kontrollrat, 1947
+08/06 Erster Atombombenabwurf auf Hiroshima, 1945
+08/08 Atombombenabwurf auf Nagasaki, 1945
+04/19 Aufstand im Warschauer Ghetto, 1943
+12/07 Japan bombardiert Pearl Harbor, 1941
+
+/* Deutschland nach dem 2. Weltkrieg */
+04/11 Attentat auf Dutschke, Studentenunruhen, 1968
+04/26 GAU in Tschernobyl, 1986
+05/05 Natobeitritt, Wiederbewaffnung, Souveränität der Bundesrepublik, 1955
+05/06 Rücktritt von Brandt, 1974
+05/16 Wahl von Schmidt (SPD) zum Bundeskanzler, 1974
+05/23 Verkündung des Grundgesetzes, 1949
+05/23 Wahl von Richard von Weizsäcker zum Bundespräsidenten, 1984
+06/05 Marshallplan, 1947
+06/20 Währungsreform in den Westzonen, 1948
+06/24 Beginn der Berliner Blockade, 1948
+07/01 Wahl von Heinrich Lübke zum Bundespräsidenten, 1959
+07/01 Wirtschafts- und Währungsunion, 1990
+08/12 Deutsch-sowjetischer Gewaltverzichtsvertrag, Moskau 1970
+08/14 Wahl zum ersten deutschen Bundestag, 1949
+09/03 Vier-Mächte-Abkommen über Berlin, 1971
+09/05 Entführung und Ermordung von Arbeitgeberpräsident Schleyer,
+ Entführung einer Lufthansa-Maschine nach Mogadischu, 1977
+09/07 DDR-Staatsratsvorsitzender Honecker in der Bundesrepublik, 1987
+09/12 Wahl von Theodor Heuss (FDP) zum Bundespräsidenten, 1949
+09/15 Wahl von Konrad Adenauer (CDU) zum Bundeskanzler, 1949
+09/17 Bruch der Sozialliberalen Koalition, 1982
+09/18 Aufnahme von Bundesrepublik und DDR in die UNO, 1973
+10/01 Ablösung von Bundeskanzler Schmidt durch Kohl, 1982
+10/23 Volksabstimmung im Saargebiet, 1955
+12/02 Washingtoner Abkommen über Bi-Zone, 1946
+12/07 Deutsch-polnischer Vertrag, Warschau 1970
+12/10 Friedensnobelpreis für Brandt, 1971
+12/12 Nachrüstungsbeschluß des NATO-Ministerates, 1979
+12/21 Grundlagenvertrag zwischen DDR und Bundesrepublik, 1972
+
+
+/* Nationalsozialismus */
+11/09 Hitler-Putsch in München/Marsch auf die Feldherrenhalle, 1923
+11/09 Reichskristallnacht, 1938
+09/14 Reichstagswahl: Erdrutsch zugunsten der NSDAP, 1930
+07/31 Reichstagswahl: NSDAP wird stärkste Fraktion, 1932
+11/06 Reichstagswahl: Rückgang der NSDAP, 1932
+01/30 Ernennung von Hitler zum Reichskanzler, 1933
+02/27 Reichstagsbrand, 1933
+03/05 Reichstagswahl: Mehrheit für NSDAP+DNVP, 1933
+03/23 Annahme des Ermächtigungsgesetzes, 1933
+03/31 Erstes Gesetz zur Gleichschaltung der Länder, 1933
+04/01 Organisierter Boykott jüdischer Geschäfte, 1933
+04/07 Zweites Gesetz zur Gleichschaltung der Länder, 1933
+05/02 Auflösung der Gewerkschaften, 1933
+06 Auflösung aller Parteien außer NSDAP, 1933
+07/20 Konkordat zwischen Deutschland und dem Vatikan, 1933
+06/30 Röhm-Putsch, Ausschaltung der SA-Führung, 1934
+09/15 Nürnberger Gesetze, 1935
+01/08 Eröffnung der olympischen Spiele in Berlin, 1936
+01/20 Wannseekonferenz, 1942
+04/30 Selbstmord Hitlers, 1945
+07/29 Mussolini geboren, 1883
+
+/* Sozialismus */
+01/21 Lenin gestorben, 1924
+06 Gründung des Bundes der Kommunisten in London
+ durch Marx und Engels, 1847
+05/23 Gründung des Allgemeinen Deutschen Arbeitervereins in Leipzig
+ unter Führung von Ferdinand Lassalles, 1863
+08/07 Gründung der Sozialdemokratischen Arbeiterpartei in Eisenach
+ unter der Führung von August Bebel und Wilhelm Liebknecht, 1869
+04/06 Gründung der Unabhängigen Sozialdemokratischen Partei, Gotha 1917
+11/07 Oktoberrevolution in Rußland, Putsch der Bolschewisten, 1917
+12/31 Gründung der KPD, 1918
+01/15 Ermordung von Rosa Luxemburg und Karl Liebknecht, 1919
+03/05 Tod Stalins, 1953
+03/18 Erste demokratische Volkskammerwahl, 1990
+04/21 Zwangsvereinigung von KPD und SPD zur SED, 1946
+05/14 Gründung der Warschauer Paktes, 1955
+06/17 Arbeiteraufstand am 17. Juni 1953
+06/25 Begin der Korea-Krieges, 1950
+08/13 Bau der Berliner Mauer, 1961
+08/21 Einmarsch des Warschauer Pakts in die Tschechoslowakei, 1968
+10/03 Offizielles Ende der DDR :-), 1990
+10/07 Gründung der DDR, 1949
+10/09 Massendemonstration in Leipzig, 1989
+10/14 Kuba-Krise, 1962
+10/18 Ablösung von Erich Honecker als SED-Generalsekretär, 1989
+11/09 Fall der Berliner Mauer, 1989
+09/09 Mao Tse-Tung gestorben im Alter von 82 Jahren, 1976
+11/10 Sowjetischer Präsident Leonid Breschnew gestorben, Alter 75, 1982
+03/27 Chruschtschow wird sowjetischer Präsident, 1958
+10/12 Chruschtschow schlägt während einer Rede in der UNO mit den
+ Schuhen auf den Tisch, 1960
+
+#endif /* _de_DE_ISO8859_1_geschichte_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.kirche b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.kirche
new file mode 100644
index 0000000..02640b1
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.kirche
@@ -0,0 +1,32 @@
+/*
+ * Kirche in Deutschland
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_kirche_
+#define _de_DE_ISO8859_1_kirche_
+
+LANG=de_DE.ISO8859-1
+
+Easter-46 Aschermittwoch
+Easter-48 Rosenmontag
+Easter-7 Palmsonntag
+
+11/Sun-3 Volkstrauertag (maybe)
+11/Sun-2 Volkstrauertag oder Totensonntag
+11/Sun-1 1. Advent oder Totensonntag
+12/Sun+1 1. oder 2. Advent
+12/Sun+2 2. oder 3. Advent
+12/Sun+3 3. oder 4. Advent
+12/Sun+4 4. Advent (maybe)
+
+12/06 Nikolaus
+12/25 1. Weihnachtstag
+12/26 2. Weihnachtstag
+
+/* Evangelische Kirche */
+11/10 Martin Luther geboren in Eisleben, 1483
+10/31 95 Thesen von Luther, Wittenberg, 1517
+
+#endif /* !_de_DE_ISO8859_1_kirche_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.literatur b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.literatur
new file mode 100644
index 0000000..bfa33e6
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.literatur
@@ -0,0 +1,54 @@
+/*
+ * Literatur
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_literatur_
+#define _de_DE_ISO8859_1_literatur_
+
+LANG=de_DE.ISO8859-1
+
+/* Schriftsteller
+
+ Fontane
+ Goethe
+ Grass
+ Hegel
+ Heine
+ Schiller
+ */
+
+01/04 Jakob Grimm geboren, 1785
+01/18 Arno Schmidt in Hamburg geboren, 1914
+02/09 Thomas Bernhard in Heerlen geboren, 1931
+02/12 Immanuel Kant in Königsberg gestorben, 1804
+02/12 Thomas Bernhard in Gmunden gestorben, 1989
+02/17 Heinrich Heine in Paris gestorben, 1856
+03/22 Johann Wolfgang von Goethe in Weimar gestorben, 1832
+04/22 Kant geboren, 1724
+05/09 Friedrich von Schiller in Weimar gestorben, 1805
+06/03 Arno Schmidt in Celle gestorben, 1979
+06/03 Franz Kafka in Prag gestorben, 1924
+06/06 Thomas Mann in Lübeck geboren, 1875
+07/03 Franz Kafka geboren, 1883
+08/12 Thomas Mann gestorben, 1955
+08/27 Georg Wilhelm Friedrich Hegel in Stuttgart geboren, 1770
+08/28 Johann Wolfgang von Goethe in Frankfurt am Main geboren, 1749
+09/20 Theodor Fontane in Berlin gestorben, 1898
+10/16 Günter Grass in Danzig geboren, 1927
+11/10 Friedrich von Schiller in Marbach geboren, 1759
+11/14 Georg Wilhelm Friedrich Hegel in Berlin gestorben, 1831
+12/13 Heinrich Heine in Düsseldorf geboren, 1797
+12/30 Theodor Fontane in Neuruppin geboren, 1819
+
+
+/* Verlage */
+03/09 "die tageszeitung" als erste täglich aktualisierte deutsche
+ Tageszeitung im WWW, 1995, Betatest, vollständige Ausgabe
+05/05 Schweriner Volkszeitung als erste deutsche Tageszeitung im WWW, 1995
+05/12 "die tageszeitung" offiziell im WWW, 1995
+08/31 Hitler stellt Frankfurter Zeitung ein, 1943
+11/01 Frankfurter Allgemeine Zeitung in Leben gerufen, 1949
+
+#endif /* !_de_DE_ISO8859_1_literatur_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.musik b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.musik
new file mode 100644
index 0000000..318969c
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.musik
@@ -0,0 +1,66 @@
+/*
+ * Musik
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_musik_
+#define _de_DE_ISO8859_1_musik_
+
+LANG=de_DE.ISO8859-1
+
+/* Barock */
+02/23 Georg Friedrich Händel in Halle an der Saale geboren, 1685
+03/14 Georg Philipp Telemann in Magdeburg geboren, 1681
+03/21 Johann Sebastian Bach in Eisenach geboren, 1685
+04/14 Georg Friedrich Händel in London gestorben, 1759
+06/25 Georg Philipp Telemann in Hamburg gestorben, 1767
+07/17 Diderich Buxtehude in Lübeck gestorben, 1707
+07/28 Johann Sebastian Bach in Leipzig gestorben, 1750
+
+/* Klassik */
+01/27 Wolfgang Amadeus Mozart in Salzburg geboren, 1756
+01/31 Franz Schubert in Lichtenthal bei Wien geboren, 1797
+02/03 Felix Mendelssohn Bartholdy in Hamburg geboren, 1809
+02/13 Richard Wagner in Venedig gestorben, 1883
+03/01 Frederic Chopin in Zelazowa-Wola bei Warschau geboren, 1810
+03/08 (Louis) Hector Berlioz in Paris gestorben, 1869
+03/25 Bela Bartok in Nagyszentmiklos geboren, 1881
+03/26 Ludwig van Beethoven in Wien gestorben, 1827
+03/28 Sergej Rachmaninow in Beverley Hills gestorben, 1943
+03/29 Carl Orff in München gestorben, 1982
+03/31 Joseph Haydn in Rohrau geboren, 1732
+04/01 Sergej Rachmaninow in Oneg geboren, 1873
+04/03 Johannes Brahms in Wien gestorben, 1897
+05/07 Johannes Brahms in Hamburg geboren, 1833
+05/18 Gustav Mahler in Wien gestorben, 1911
+05/22 Richard Wagner in Leipzig geboren, 1813
+05/31 Joseph Haydn in Wien gestorben, 1809
+06/03 Georges Bizet in Bougival bei Paris gestorben, 1875
+06/05 Carl Maria von Weber in London gestorben, 1826
+06/08 Robert Schumann in Zwickau geboren, 1810
+06/11 Richard Strauss in München geboren, 1864
+06/15 Edvard Grieg in Bergen geboren, 1843
+07/07 Gustav Mahler in Kalischt geboren, 1860
+07/10 Carl Orff in München geboren, 1895
+07/29 Robert Schumann in Endenich bei Bonn gestorben, 1856
+07/31 Franz Liszt in Bayreuth gestorben, 1886
+09/04 Edvard Grieg in Bergen gestorben, 1907
+09/08 Richard Strauss in Garmisch-Partenkirchen gestorben, 1949
+09/26 Bela Bartok in New York gestorben, 1945
+10/17 Frederic Chopin in Paris gestorben, 1849
+10/22 Franz Liszt in Raiding (Ungarn) geboren, 1811
+10/25 Georges Bizet in Paris geboren, 1838
+11/04 Felix Mendelssohn Bartholdy in Leipzig gestorben, 1847
+11/18 Carl Maria von Weber in Eutin geboren, 1786
+11/19 Franz Schubert in Wien gestorben, 1828
+11/26 Paul Hindemith in Hanau geboren, 1895
+12/05 Wolfgang Amadeus Mozart in Wien gestorben, 1791
+12/11 (Louis) Hector Berlioz in La-Côte-Saint-André geboren, 1803
+12/17 Ludwig van Beethoven in Bonn getauft, 1770
+12/28 Paul Hindemith in Frankfurt am Main gestorben, 1963
+
+/* Pop */
+09/18 Jimi Hendrix in Paris gestorben, 1970
+
+#endif /* !_de_DE_ISO8859_1_musik_ */
diff --git a/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.wissenschaft b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.wissenschaft
new file mode 100644
index 0000000..2c76392
--- /dev/null
+++ b/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.wissenschaft
@@ -0,0 +1,19 @@
+/*
+ * Wissenschaft
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _de_DE_ISO8859_1_wissenschaft_
+#define _de_DE_ISO8859_1_wissenschaft_
+
+LANG=de_DE.ISO8859-1
+
+04/12 Erster Mann im All, Juri Gagarin, 1961
+04/18 Einstein gestorben, 1955
+06/22 Konrad Zuse geboren in Berlin, 1919
+10/04 Sputnik 1, erster Satellit im Weltraum, 1957
+12/18 Konrad Zuse gestorben in Hünfeld, 1995
+
+
+#endif /* ! _de_DE_ISO8859_1_wissenschaft_ */
diff --git a/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.all b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.all
new file mode 100644
index 0000000..785512e
--- /dev/null
+++ b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.all
@@ -0,0 +1,14 @@
+/*
+ * Calendrier français
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _fr_FR_ISO8859_1_all_
+#define _fr_FR_ISO8859_1_all_
+
+#include <fr_FR.ISO8859-1/calendar.jferies>
+#include <fr_FR.ISO8859-1/calendar.fetes>
+#include <fr_FR.ISO8859-1/calendar.proverbes>
+
+#endif /* !_fr_FR.ISO8859-1_all_ */
diff --git a/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes
new file mode 100644
index 0000000..d80a875
--- /dev/null
+++ b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes
@@ -0,0 +1,630 @@
+/*
+ * Fêtes à souhaiter
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _fr_FR_ISO8859_1_fetes_
+#define _fr_FR_ISO8859_1_fetes_
+
+LANG=fr_FR.ISO8859-1
+
+/*
+ * N.B.: ceci n'est pas un calendrier liturgique !
+ * Il a seulement été réalisé pour me faire payer à boire
+ * par mes collègues de travail ; on n'y trouve donc que
+ * des prénoms seuls.
+ *
+ * Par ex. « St Antoine de Padoue » se retrouve abrégé en
+ * Antoine, et si Antoine est fêté plusieurs jours par an,
+ * tant mieux pour lui, c'est voulu.
+ */
+
+01/01 Aujourd'hui, c'est la St(e) Almaque.
+01/01 N'oubliez pas les Télémaque !
+01/02 Bonne fête aux Basile !
+01/02 Aujourd'hui, c'est la St(e) Vassili.
+01/02 N'oubliez pas les Grégoire !
+01/03 Bonne fête aux Geneviève !
+01/03 Aujourd'hui, c'est la St(e) Ginette.
+01/04 N'oubliez pas les Odilon !
+01/04 Bonne fête aux Angèle !
+01/04 Aujourd'hui, c'est la St(e) Robert.
+01/05 N'oubliez pas les Édouard !
+01/05 Bonne fête aux Gerlac !
+01/06 Aujourd'hui, c'est la St(e) Mélaine.
+01/06 N'oubliez pas les André !
+01/07 Galette des rois
+01/07 Aujourd'hui, c'est la St(e) Raymond.
+01/07 N'oubliez pas les Raymonde !
+01/07 Bonne fête aux Virginie !
+01/08 Aujourd'hui, c'est la St(e) Lucien.
+01/08 N'oubliez pas les Lucienne !
+01/08 Bonne fête aux Peggy !
+01/08 Aujourd'hui, c'est la St(e) Gudule.
+01/09 N'oubliez pas les Adrien !
+01/09 Bonne fête aux Alix !
+01/10 Aujourd'hui, c'est la St(e) Guillaume.
+01/10 N'oubliez pas les Guillemette !
+01/11 Bonne fête aux Paulin !
+01/11 Aujourd'hui, c'est la St(e) Pauline.
+01/12 N'oubliez pas les Tatiana !
+01/12 Bonne fête aux Alfred !
+01/12 Aujourd'hui, c'est la St(e) Ailred (Aelred, Eilred, Elred).
+01/13 N'oubliez pas les Vivant !
+01/13 Bonne fête aux Vivence !
+01/13 Aujourd'hui, c'est la St(e) Hilaire.
+01/13 N'oubliez pas les Yvette !
+01/14 Bonne fête aux Nina !
+01/14 Aujourd'hui, c'est la St(e) Séraphin.
+01/15 N'oubliez pas les Rémi !
+01/16 Bonne fête aux Marcel !
+01/16 Aujourd'hui, c'est la St(e) Marcelle.
+01/16 N'oubliez pas les Marceau !
+01/16 Bonne fête aux Honorat !
+01/17 Aujourd'hui, c'est la St(e) Roseline.
+01/17 N'oubliez pas les Antoine !
+01/17 Bonne fête aux Anthony !
+01/18 Aujourd'hui, c'est la St(e) Prisca.
+01/18 N'oubliez pas les Libert !
+01/19 Bonne fête aux Marius !
+01/19 Aujourd'hui, c'est la St(e) Canut.
+01/20 N'oubliez pas les Fabienne !
+01/20 Bonne fête aux Sébastien !
+01/20 Aujourd'hui, c'est la St(e) Bastien.
+01/21 N'oubliez pas les Agnès !
+01/21 Bonne fête aux Fructueux !
+01/21 Aujourd'hui, c'est la St(e) Augure.
+01/21 N'oubliez pas les Euloge !
+01/21 Bonne fête aux Avit !
+01/22 Aujourd'hui, c'est la St(e) Vincent.
+01/22 N'oubliez pas les Blésille !
+01/23 Bonne fête aux Barnard !
+01/24 Aujourd'hui, c'est la St(e) François.
+01/25 N'oubliez pas les Morgane !
+01/26 Bonne fête aux Paule !
+01/26 Aujourd'hui, c'est la St(e) Timothée.
+01/26 N'oubliez pas les Tite !
+01/27 Bonne fête aux Angèle !
+01/28 Aujourd'hui, c'est la St(e) Thomas.
+01/29 N'oubliez pas les Gildas !
+01/29 Bonne fête aux Sulpice !
+01/30 Aujourd'hui, c'est la St(e) Martine.
+01/31 N'oubliez pas les Marcelle !
+01/31 Bonne fête aux Jean !
+02/01 Aujourd'hui, c'est la St(e) Ella.
+02/01 N'oubliez pas les Viridiane !
+02/02 Bonne fête aux Théophane !
+02/03 Aujourd'hui, c'est la St(e) Blaise.
+02/03 N'oubliez pas les Anschaire !
+02/04 Bonne fête aux Véronique !
+02/04 Aujourd'hui, c'est la St(e) Jeanne.
+02/04 N'oubliez pas les Gilbert !
+02/05 Bonne fête aux Agathe !
+02/06 Aujourd'hui, c'est la St(e) Gaston.
+02/06 N'oubliez pas les Armand !
+02/07 Bonne fête aux Eugénie !
+02/07 Aujourd'hui, c'est la St(e) Partène.
+02/08 N'oubliez pas les Jacqueline !
+02/08 Bonne fête aux Jérôme !
+02/09 Aujourd'hui, c'est la St(e) Apolline.
+02/09 N'oubliez pas les Appollonie !
+02/10 Bonne fête aux Arnaud !
+02/10 Aujourd'hui, c'est la St(e) Scholastique.
+02/11 N'oubliez pas les Séverin !
+02/11 Bonne fête aux Séverine !
+02/12 Aujourd'hui, c'est la St(e) Félix.
+02/12 N'oubliez pas les Eulalie !
+02/13 Bonne fête aux Béatrice !
+02/13 Aujourd'hui, c'est la St(e) Polyeucte.
+02/14 N'oubliez pas les Valentin !
+02/14 Bonne fête aux Méthode !
+02/14 Aujourd'hui, c'est la St(e) Cyrille.
+02/15 N'oubliez pas les Claude !
+02/15 Bonne fête aux Georgette !
+02/16 Aujourd'hui, c'est la St(e) Julienne.
+02/17 N'oubliez pas les Alexis !
+02/18 Bonne fête aux Bernadette et aux Nadine !
+02/19 Aujourd'hui, c'est la St(e) Gabin.
+02/20 N'oubliez pas les Aimée !
+02/20 Bonne fête aux Aimé !
+02/20 Aujourd'hui, c'est la St(e) Amata.
+02/21 N'oubliez pas les Pierre-Damien !
+02/22 Bonne fête aux Isabelle !
+02/23 Aujourd'hui, c'est la St(e) Lazare.
+02/23 N'oubliez pas les Polycarpe !
+02/24 Bonne fête aux Modeste !
+02/25 Aujourd'hui, c'est la St(e) Roméo.
+02/25 N'oubliez pas les Avertan !
+02/26 Bonne fête aux Nestor !
+02/27 Aujourd'hui, c'est la St(e) Honorine.
+02/27 N'oubliez pas les Gabriel !
+02/28 Bonne fête aux Romain !
+02/28 Aujourd'hui, c'est la St(e) Lupicin.
+02/29 N'oubliez pas les Auguste !
+03/01 Bonne fête aux Aubin !
+03/01 Aujourd'hui, c'est la St(e) Albin.
+03/02 N'oubliez pas les Charles !
+03/03 Bonne fête aux Guénolé (Gwénolé) !
+03/04 Aujourd'hui, c'est la St(e) Casimir.
+03/05 N'oubliez pas les Olive !
+03/05 Bonne fête aux Olivia !
+03/06 Aujourd'hui, c'est la St(e) Colette.
+03/06 N'oubliez pas les Nicole !
+03/07 Bonne fête aux Félicité !
+03/07 Aujourd'hui, c'est la St(e) Félicie.
+03/07 N'oubliez pas les Perpétue !
+03/08 Bonne fête aux Jean !
+03/09 Aujourd'hui, c'est la St(e) Françoise.
+03/10 N'oubliez pas les Vivien !
+03/10 Bonne fête aux Dominique !
+03/11 Aujourd'hui, c'est la St(e) Rosine.
+03/12 N'oubliez pas les Justine !
+03/12 Bonne fête aux Maximilien !
+03/13 Aujourd'hui, c'est la St(e) Rodrigue.
+03/13 N'oubliez pas les Salomon !
+03/13 Bonne fête aux Euphrasie !
+03/14 Aujourd'hui, c'est la St(e) Mathilde.
+03/15 N'oubliez pas les Louise !
+03/16 Bonne fête aux Bénédicte !
+03/16 Aujourd'hui, c'est la St(e) Benoîte.
+03/16 N'oubliez pas les Julien !
+03/17 C'est la St Patrick !
+03/17 Aujourd'hui, c'est la St(e) Patrice.
+03/18 N'oubliez pas les Cyrille !
+03/19 Bonne fête aux Joseph !
+03/20 Aujourd'hui, c'est la St(e) Herbert.
+03/20 N'oubliez pas les Wulfran !
+03/21 Bonne fête aux Clémence !
+03/22 Aujourd'hui, c'est la St(e) Léa.
+03/23 N'oubliez pas les Victorien !
+03/23 Bonne fête aux Turibio !
+03/24 Aujourd'hui, c'est la St(e) Catherine.
+03/24 N'oubliez pas les Karine !
+03/26 Bonne fête aux Lara !
+03/26 Aujourd'hui, c'est la St(e) Ludger.
+03/26 N'oubliez pas les Larissa !
+03/27 Bonne fête aux Habib !
+03/28 Aujourd'hui, c'est la St(e) Gontran.
+03/29 N'oubliez pas les Gwladys !
+03/29 Bonne fête aux Eustase !
+03/30 Aujourd'hui, c'est la St(e) Amédée.
+03/31 N'oubliez pas les Benjamin !
+03/31 Bonne fête aux Benjamine !
+04/01 Votre fichier calendar est corrompu.
+04/01 N'oubliez pas les Hugues !
+04/02 Bonne fête aux Sandrine !
+04/03 Aujourd'hui, c'est la St(e) Richard.
+04/04 N'oubliez pas les Isidore !
+04/04 Bonne fête aux Benoît !
+04/05 Aujourd'hui, c'est la St(e) Irène.
+04/05 N'oubliez pas les Vincent !
+04/06 Bonne fête aux Marcellin !
+04/06 Aujourd'hui, c'est la St(e) Célestin.
+04/06 N'oubliez pas les Guillaume !
+04/07 Bonne fête aux Jean-Baptiste !
+04/07 Aujourd'hui, c'est la St(e) Julienne.
+04/08 N'oubliez pas les Perpet !
+04/08 Bonne fête aux Perpetuus !
+04/09 Aujourd'hui, c'est la St(e) Gautier.
+04/09 N'oubliez pas les Jean !
+04/10 Bonne fête aux Fulbert !
+04/10 Aujourd'hui, c'est la St(e) Michel.
+04/11 N'oubliez pas les Stanislas !
+04/11 Bonne fête aux Gemma !
+04/11 Aujourd'hui, c'est la St(e) Léon.
+04/12 N'oubliez pas les Jules !
+04/12 Bonne fête aux Sabas !
+04/13 Aujourd'hui, c'est la St(e) Ida.
+04/13 N'oubliez pas les Herménégilde !
+04/14 Bonne fête aux Maxime !
+04/14 Aujourd'hui, c'est la St(e) Lydwine.
+04/14 N'oubliez pas les Bénézet !
+04/15 Bonne fête aux Pierre !
+04/16 Aujourd'hui, c'est la St(e) Benoît.
+04/17 N'oubliez pas les Anicet !
+04/17 Bonne fête aux Kateri !
+04/18 Aujourd'hui, c'est la St(e) Parfait.
+04/19 N'oubliez pas les Emma !
+04/19 Bonne fête aux Elphège !
+04/20 Aujourd'hui, c'est la St(e) Odette.
+04/20 N'oubliez pas les Agnès !
+04/21 Bonne fête aux Anselme !
+04/22 Aujourd'hui, c'est la St(e) Alexandre.
+04/22 N'oubliez pas les Soter !
+04/22 Bonne fête aux Caïus !
+04/22 Aujourd'hui, c'est la St(e) Léonide.
+04/23 N'oubliez pas les Georges !
+04/23 Bonne fête aux Pierre !
+04/24 Aujourd'hui, c'est la St(e) Fidèle.
+04/24 N'oubliez pas les Marie-Euphrasie !
+04/25 Bonne fête aux Marc !
+04/26 Aujourd'hui, c'est la St(e) Alida.
+04/27 N'oubliez pas les Zita !
+04/27 Bonne fête aux Pierre !
+04/28 Aujourd'hui, c'est la St(e) Valérie.
+04/28 N'oubliez pas les Louis-Marie !
+04/28 Bonne fête aux Paul !
+04/29 Aujourd'hui, c'est la St(e) Joseph-Benoît.
+04/29 N'oubliez pas les Hugues !
+04/30 Bonne fête aux Robert !
+04/30 Aujourd'hui, c'est la St(e) Catherine.
+05/02 N'oubliez pas les Boris !
+05/03 Bonne fête aux Jacques !
+05/03 Aujourd'hui, c'est la St(e) Philippe.
+05/04 N'oubliez pas les Sylvain !
+05/05 Bonne fête aux Judith !
+05/06 Aujourd'hui, c'est la St(e) Prudence.
+05/07 N'oubliez pas les Gisèle !
+05/09 Bonne fête aux Pacôme !
+05/10 Aujourd'hui, c'est la St(e) Solange.
+05/11 N'oubliez pas les Estelle !
+05/12 Bonne fête aux Achille !
+05/14 Aujourd'hui, c'est la St(e) Matthias.
+05/15 N'oubliez pas les Denise !
+05/16 Bonne fête aux Honoré !
+05/17 Aujourd'hui, c'est la St(e) Pascal.
+05/18 N'oubliez pas les Éric !
+05/19 Bonne fête aux Yves !
+05/19 Aujourd'hui, c'est la St(e) Yvonne.
+05/20 N'oubliez pas les Bernardin !
+05/21 Bonne fête aux Constantin !
+05/22 Aujourd'hui, c'est la St(e) Émile.
+05/23 N'oubliez pas les Didier !
+05/24 Bonne fête aux Donatien !
+05/25 Aujourd'hui, c'est la St(e) Sophie.
+05/26 N'oubliez pas les Bérenger !
+05/28 Bonne fête aux Germain !
+05/29 Aujourd'hui, c'est la St(e) Aymard.
+05/30 N'oubliez pas les Ferdinand !
+06/01 Bonne fête aux Justin !
+06/02 Aujourd'hui, c'est la St(e) Blandine.
+06/03 N'oubliez pas les Kévin !
+06/04 Bonne fête aux Clotilde !
+06/05 Aujourd'hui, c'est la St(e) Igor.
+06/06 N'oubliez pas les Norbert !
+06/07 Bonne fête aux Gilbert !
+06/08 Aujourd'hui, c'est la St(e) Médard.
+06/09 N'oubliez pas les Diane !
+06/11 Bonne fête aux Barnabé !
+06/11 Aujourd'hui, c'est la St(e) Yolande.
+06/12 N'oubliez pas les Guy !
+06/13 Bonne fête aux Antoine !
+06/14 Aujourd'hui, c'est la St(e) Élisée.
+06/15 N'oubliez pas les Germaine !
+06/16 Bonne fête aux Jean-François !
+06/17 Aujourd'hui, c'est la St(e) Hervé.
+06/18 N'oubliez pas les Léonce !
+06/19 Bonne fête aux Romuald !
+06/20 Aujourd'hui, c'est la St(e) Silvère.
+06/21 N'oubliez pas les Rodolphe !
+06/22 Bonne fête aux Alban !
+06/23 Aujourd'hui, c'est la St(e) Audrey.
+06/24 N'oubliez pas les Jean-Baptiste !
+06/25 Bonne fête aux Prosper !
+06/26 Aujourd'hui, c'est la St(e) Anthelme.
+06/27 N'oubliez pas les Fernand !
+06/28 Bonne fête aux Irénée !
+06/29 Aujourd'hui, c'est la St(e) Paul.
+06/29 N'oubliez pas les Pierre !
+06/30 Bonne fête aux Martial !
+07/01 Aujourd'hui, c'est la St(e) Thierry.
+07/02 N'oubliez pas les Martinien !
+07/03 Bonne fête aux Thomas !
+07/04 Aujourd'hui, c'est la St(e) Florent.
+07/05 N'oubliez pas les Antoine !
+07/06 Bonne fête aux Mariette !
+07/07 Aujourd'hui, c'est la St(e) Raoul.
+07/08 N'oubliez pas les Thibaut !
+07/09 Bonne fête aux Amandine !
+07/10 Aujourd'hui, c'est la St(e) Ulrich.
+07/11 N'oubliez pas les Benoît !
+07/12 Bonne fête aux Olivier !
+07/13 Aujourd'hui, c'est la St(e) Henri.
+07/13 N'oubliez pas les Joël !
+07/14 Bonne fête aux Camille !
+07/15 Aujourd'hui, c'est la St(e) Donald.
+07/17 N'oubliez pas les Caroline !
+07/17 Bonne fête aux Charlotte !
+07/18 Aujourd'hui, c'est la St(e) Frédéric.
+07/19 N'oubliez pas les Arsène !
+07/20 Bonne fête aux Marina !
+07/21 Aujourd'hui, c'est la St(e) Victor.
+07/22 N'oubliez pas les Marie-Madeleine !
+07/23 Bonne fête aux Brigitte !
+07/24 Aujourd'hui, c'est la St(e) Christine.
+07/25 N'oubliez pas les Jacques !
+07/26 Bonne fête aux Anne !
+07/26 Aujourd'hui, c'est la St(e) Joachim.
+07/27 N'oubliez pas les Nathalie !
+07/28 Bonne fête aux Samson !
+07/29 Aujourd'hui, c'est la St(e) Marthe.
+07/30 N'oubliez pas les Juliette !
+07/31 Bonne fête aux Ignace !
+08/01 Aujourd'hui, c'est la St(e) Alphonse.
+08/01 N'oubliez pas les Pierre !
+08/02 Bonne fête aux Julien !
+08/03 Aujourd'hui, c'est la St(e) Lydie.
+08/03 N'oubliez pas les Pierre-Julien !
+08/04 Bonne fête aux Jean-Marie !
+08/04 Aujourd'hui, c'est la St(e) Dominique.
+08/05 N'oubliez pas les Abel !
+08/05 Bonne fête aux Oswald !
+08/07 Aujourd'hui, c'est la St(e) Gaëtan.
+08/08 N'oubliez pas les Dominique !
+08/08 Bonne fête aux Cyriaque !
+08/09 Aujourd'hui, c'est la St(e) Amour.
+08/10 N'oubliez pas les Laurent !
+08/11 Bonne fête aux Claire !
+08/11 Aujourd'hui, c'est la St(e) Philomène.
+08/12 N'oubliez pas les Clarisse !
+08/13 Bonne fête aux Hyppolite !
+08/13 Aujourd'hui, c'est la St(e) Radegonde.
+08/14 N'oubliez pas les Évrard !
+08/14 Bonne fête aux Maximilien !
+08/15 Aujourd'hui, c'est la St(e) Marie.
+08/16 N'oubliez pas les Armel !
+08/16 Bonne fête aux Roch !
+08/17 Aujourd'hui, c'est la St(e) Hyacinthe.
+08/18 N'oubliez pas les Hélène !
+08/19 Bonne fête aux Jean-Eudes !
+08/19 Aujourd'hui, c'est la St(e) Louis.
+08/20 N'oubliez pas les Bernard !
+08/21 Bonne fête aux Christophe !
+08/21 Aujourd'hui, c'est la St(e) Jeanne.
+08/22 N'oubliez pas les Fabrice !
+08/22 Bonne fête aux Symphorien !
+08/23 Aujourd'hui, c'est la St(e) Rose.
+08/23 N'oubliez pas les Philippe !
+08/24 Bonne fête aux Barthélémy !
+08/25 Aujourd'hui, c'est la St(e) Louis.
+08/26 N'oubliez pas les Natacha !
+08/26 Bonne fête aux Zéphirin !
+08/26 Aujourd'hui, c'est la St(e) Eulade.
+08/27 N'oubliez pas les Edwige !
+08/27 Bonne fête aux Monique et aux Joseph !
+08/28 Aujourd'hui, c'est la St(e) Augustin.
+08/29 N'oubliez pas les Sabine !
+08/30 Bonne fête aux Fiacre !
+08/30 Aujourd'hui, c'est la St(e) Rose.
+08/31 N'oubliez pas les Aristide !
+08/31 Bonne fête aux Raymond !
+09/01 Aujourd'hui, c'est la St(e) Gilles.
+09/02 N'oubliez pas les Ingrid !
+09/03 Bonne fête aux Grégoire !
+09/04 Aujourd'hui, c'est la St(e) Rosalie.
+09/05 N'oubliez pas les Raïssa !
+09/06 Bonne fête aux Bertrand !
+09/07 Aujourd'hui, c'est la St(e) Reine.
+09/09 N'oubliez pas les Alain !
+09/10 Bonne fête aux Inès !
+09/11 Aujourd'hui, c'est la St(e) Adelphe.
+09/12 N'oubliez pas les Apollinaire !
+09/13 Bonne fête aux Aimé !
+09/15 Aujourd'hui, c'est la St(e) Roland.
+09/16 N'oubliez pas les Édith !
+09/17 Bonne fête aux Renaud !
+09/18 Aujourd'hui, c'est la St(e) Nadège.
+09/19 N'oubliez pas les Émilie !
+09/20 Bonne fête aux Davy !
+09/21 Aujourd'hui, c'est la St(e) Matthieu.
+09/22 N'oubliez pas les Maurice !
+09/23 Bonne fête aux Constant !
+09/24 Aujourd'hui, c'est la St(e) Thècle.
+09/25 N'oubliez pas les Hermann !
+09/26 Bonne fête aux Côme !
+09/26 Aujourd'hui, c'est la St(e) Damien.
+09/27 N'oubliez pas les Vincent !
+09/28 Bonne fête aux Venceslas !
+09/29 Aujourd'hui, c'est la St(e) Michel.
+09/29 N'oubliez pas les Raphaël !
+09/30 Bonne fête aux Jérôme !
+10/01 Aujourd'hui, c'est la St(e) Thérèse.
+10/02 N'oubliez pas les Léger !
+10/03 Bonne fête aux Gérard !
+10/04 Aujourd'hui, c'est la St(e) François.
+10/05 N'oubliez pas les Placide !
+10/05 Bonne fête aux Fleur !
+10/05 Aujourd'hui, c'est la St(e) Flore.
+10/05 N'oubliez pas les Pâquerette !
+10/05 Bonne fête aux Violette !
+10/05 Aujourd'hui, c'est la St(e) Pervenche.
+10/05 N'oubliez pas les Anémone !
+10/05 Bonne fête aux Bluette !
+10/05 Aujourd'hui, c'est la St(e) Capucine.
+10/05 N'oubliez pas les Dahlia !
+10/05 Bonne fête aux Myrtille !
+10/05 Aujourd'hui, c'est la St(e) Hortense.
+10/05 N'oubliez pas les Violaine !
+10/05 Bonne fête aux Anne-Aymone !
+10/05 Aujourd'hui, c'est la St(e) Dalie.
+10/06 N'oubliez pas les Bruno !
+10/06 Bonne fête aux Foy !
+10/07 Aujourd'hui, c'est la St(e) Serge.
+10/08 N'oubliez pas les Pélagie !
+10/26 Bonne fête aux Démétrius !
+10/09 Aujourd'hui, c'est la St(e) Denis.
+10/09 N'oubliez pas les Denys !
+10/10 Bonne fête aux Ghislain !
+10/10 Aujourd'hui, c'est la St(e) Ghislaine.
+10/10 N'oubliez pas les Guislain !
+10/10 Bonne fête aux Guislaine !
+10/11 Aujourd'hui, c'est la St(e) Firmin.
+10/11 N'oubliez pas les Gausbert !
+10/12 Bonne fête aux Wilfried !
+10/12 Aujourd'hui, c'est la St(e) Séraphin.
+10/13 N'oubliez pas les Géraud !
+10/14 Bonne fête aux Juste !
+10/14 Aujourd'hui, c'est la St(e) Calliste.
+10/15 N'oubliez pas les Thérèse !
+10/16 Bonne fête aux Edwige !
+10/16 Aujourd'hui, c'est la St(e) Marie-Marguerite.
+10/17 N'oubliez pas les Baudoin !
+10/17 Bonne fête aux Ignace !
+10/18 Aujourd'hui, c'est la St(e) Luc.
+10/19 N'oubliez pas les René !
+10/20 Bonne fête aux Adeline !
+10/20 Aujourd'hui, c'est la St(e) Aline.
+10/20 N'oubliez pas les Line !
+10/21 Bonne fête aux Céline !
+10/21 Aujourd'hui, c'est la St(e) Hilarion.
+10/22 N'oubliez pas les Élodie !
+10/22 Bonne fête aux Nunillon !
+10/22 Aujourd'hui, c'est la St(e) Salomé.
+10/23 N'oubliez pas les Jean !
+10/24 Bonne fête aux Florentin !
+10/25 Aujourd'hui, c'est la St(e) Crépin.
+10/25 N'oubliez pas les Crépinien !
+10/25 Bonne fête aux Chrysanthe !
+10/25 Aujourd'hui, c'est la St(e) Darie.
+10/25 N'oubliez pas les Enguerran !
+10/26 Bonne fête aux Dimitri !
+10/26 Aujourd'hui, c'est la St(e) Évariste.
+10/27 N'oubliez pas les Émeline !
+10/27 Bonne fête aux Didier !
+10/27 Aujourd'hui, c'est la St(e) Frumence.
+10/28 N'oubliez pas les Jude !
+10/28 Bonne fête aux Judas !
+10/28 Aujourd'hui, c'est la St(e) Thaddée.
+10/28 N'oubliez pas les Simon !
+10/28 Bonne fête aux Simone (Simonne) !
+10/29 Aujourd'hui, c'est la St(e) Narcisse.
+10/30 N'oubliez pas les Bienvenue !
+10/30 Bonne fête aux Dorothée !
+10/31 Aujourd'hui, c'est la St(e) Quentin.
+10/31 N'oubliez pas les Alphonse !
+10/31 Bonne fête aux Wolfgang !
+11/03 Aujourd'hui, c'est la St(e) Hubert.
+11/04 N'oubliez pas les Charles !
+11/04 Bonne fête aux Amans !
+11/05 Aujourd'hui, c'est la St(e) Sylvie.
+11/05 N'oubliez pas les Sylvette !
+11/05 Bonne fête aux Sylviane !
+11/05 Aujourd'hui, c'est la St(e) Zacharie.
+11/05 N'oubliez pas les Élisabeth !
+11/06 Bonne fête aux Bertille !
+11/06 Aujourd'hui, c'est la St(e) Léonard.
+11/06 N'oubliez pas les Winnoc !
+11/07 Bonne fête aux Carine !
+11/07 Aujourd'hui, c'est la St(e) Karine.
+11/07 N'oubliez pas les Ernest !
+11/07 Bonne fête aux Ernst !
+11/07 Aujourd'hui, c'est la St(e) Willibrord.
+11/08 N'oubliez pas les Geoffroy !
+11/09 Bonne fête aux Théodore !
+11/10 Aujourd'hui, c'est la St(e) Léon.
+11/10 N'oubliez pas les Léontine !
+11/10 Bonne fête aux Lionel !
+11/11 Aujourd'hui, c'est la St(e) Martin.
+11/12 N'oubliez pas les Christian !
+11/12 Bonne fête aux Josaphat !
+11/13 Aujourd'hui, c'est la St(e) Brice.
+11/13 N'oubliez pas les Diégo !
+11/13 Bonne fête aux Didace !
+11/14 Aujourd'hui, c'est la St(e) Sidoine.
+11/14 N'oubliez pas les Sidonie !
+11/14 Bonne fête aux Sérapion !
+11/15 Aujourd'hui, c'est la St(e) Albert.
+11/16 N'oubliez pas les Marguerite !
+11/16 Bonne fête aux Gertrude !
+11/17 Aujourd'hui, c'est la St(e) Élisabeth.
+11/17 N'oubliez pas les Élise !
+11/17 Bonne fête aux Lise !
+11/18 Aujourd'hui, c'est la St(e) Aude.
+11/19 N'oubliez pas les Tanguy !
+11/19 Bonne fête aux Tanneguy !
+11/19 Aujourd'hui, c'est la St(e) Mechtilde.
+11/19 N'oubliez pas les Mathilde !
+11/19 Bonne fête aux Patrocle !
+11/20 Aujourd'hui, c'est la St(e) Edmond.
+11/20 N'oubliez pas les Octave !
+11/20 Bonne fête aux Adventor !
+11/20 Aujourd'hui, c'est la St(e) Solutor.
+11/20 N'oubliez pas les Ambroise !
+11/20 Bonne fête aux Rutus !
+11/22 Aujourd'hui, c'est la St(e) Cécile.
+11/22 N'oubliez pas les Célia !
+11/23 Bonne fête aux Clément !
+11/23 Aujourd'hui, c'est la St(e) Clémentine.
+11/23 N'oubliez pas les Colomban !
+11/24 Bonne fête aux Augusta !
+11/24 Aujourd'hui, c'est la St(e) Flora.
+11/25 N'oubliez pas les Catherine !
+11/24 Bonne fête aux Maria !
+11/26 Aujourd'hui, c'est la St(e) Delphine.
+11/26 N'oubliez pas les Elzéar !
+11/27 Bonne fête aux Séverin !
+11/27 Aujourd'hui, c'est la St(e) Séverine.
+11/27 N'oubliez pas les Maxime !
+11/28 Bonne fête aux Jacques !
+11/29 Aujourd'hui, c'est la St(e) Saturnin.
+11/29 N'oubliez pas les Sernin (Cernin) !
+11/29 Bonne fête aux Savourin !
+11/29 Aujourd'hui, c'est la St(e) Sornin.
+11/30 N'oubliez pas les André !
+11/30 Bonne fête aux Andréa !
+12/01 Aujourd'hui, c'est la St(e) Florence.
+12/01 N'oubliez pas les Éloi !
+12/01 Bonne fête aux Airy !
+12/02 Aujourd'hui, c'est la St(e) Viviane.
+12/03 N'oubliez pas les François-Xavier !
+12/03 Bonne fête aux Xavier !
+12/03 Aujourd'hui, c'est la St(e) Eugène.
+12/04 N'oubliez pas les Barbara !
+12/04 Bonne fête aux Barbe !
+12/05 Aujourd'hui, c'est la St(e) Gérald.
+12/05 N'oubliez pas les Géraldine !
+12/05 Bonne fête aux Géraud !
+12/05 Aujourd'hui, c'est la St(e) Sabas.
+12/06 N'oubliez pas les Nicolas !
+12/07 Bonne fête aux Ambroise !
+12/09 Aujourd'hui, c'est la St(e) Pierre.
+12/10 N'oubliez pas les Romaric !
+12/10 Bonne fête aux Eulalie !
+12/10 Aujourd'hui, c'est la St(e) Melchaide.
+12/10 N'oubliez pas les Miltiade !
+12/11 Bonne fête aux Daniel !
+12/11 Aujourd'hui, c'est la St(e) Damase.
+12/12 N'oubliez pas les Chantal !
+12/13 Bonne fête aux Lucie !
+12/13 Aujourd'hui, c'est la St(e) Rolande.
+12/13 N'oubliez pas les Aurore !
+12/14 Bonne fête aux Odile !
+12/15 Aujourd'hui, c'est la St(e) Ninon.
+12/15 N'oubliez pas les Nina !
+12/15 Bonne fête aux Christiane !
+12/15 Aujourd'hui, c'est la St(e) Christina.
+12/16 N'oubliez pas les Alice !
+12/16 Bonne fête aux Adélaïde !
+12/16 Aujourd'hui, c'est la St(e) Évrard.
+12/16 N'oubliez pas les Éberhard !
+12/17 Bonne fête aux Gaël !
+12/17 Aujourd'hui, c'est la St(e) Lazare.
+12/17 N'oubliez pas les Olympe !
+12/17 Bonne fête aux Olympias !
+12/17 Aujourd'hui, c'est la St(e) Judicaël.
+12/18 N'oubliez pas les Gatien !
+12/18 Bonne fête aux Winebald !
+12/19 Aujourd'hui, c'est la St(e) Urbain.
+12/20 N'oubliez pas les Abraham !
+12/20 Bonne fête aux Théophile !
+12/21 Aujourd'hui, c'est la St(e) Pierre.
+12/22 N'oubliez pas les Françoise-Xavière !
+12/22 Bonne fête aux Flavien !
+12/23 Aujourd'hui, c'est la St(e) Armand.
+12/24 N'oubliez pas les Adèle !
+12/24 Bonne fête aux Charbel !
+12/25 Aujourd'hui, c'est la St(e) Emmanuel.
+12/25 N'oubliez pas les Emmanuelle !
+12/25 Bonne fête aux Noël !
+12/26 Aujourd'hui, c'est la St(e) Étienne.
+12/26 N'oubliez pas les Stéphane !
+12/26 Bonne fête aux Stéphanie !
+12/27 Aujourd'hui, c'est la St(e) Jean.
+12/27 N'oubliez pas les Yann !
+12/28 Bonne fête aux Innocents !
+12/29 Aujourd'hui, c'est la St(e) David.
+12/30 N'oubliez pas les Roger !
+12/31 Bonne fête aux Sylvestre !
+
+#endif /*! _fr_FR_ISO8859_1_fetes */
diff --git a/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.french b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.french
new file mode 100644
index 0000000..18b4d8a
--- /dev/null
+++ b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.french
@@ -0,0 +1,12 @@
+/*
+ * French calendar file(s)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _calendar_french_
+#define _calendar_french_
+
+#include <fr_FR.ISO8859-1/calendar.all>
+
+#endif /* !_calendar_french_ */
diff --git a/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.jferies b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.jferies
new file mode 100644
index 0000000..48867ac
--- /dev/null
+++ b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.jferies
@@ -0,0 +1,46 @@
+/*
+ * Jours fériés
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _fr_FR_ISO8859_1_jferies_
+#define _fr_FR_ISO8859_1_jferies_
+
+LANG=fr_FR.ISO8859-1
+
+/* Jours chômés */
+01/01 Nouvel an
+05/01 Fête du travail
+05/08 Armistice 1945
+07/14 Fête nationale française
+11/11 Armistice 1918
+
+/* Jours fériés religieux */
+Easter Pâques
+Easter+1 Lundi de Pâques
+Easter+39 Ascension
+Easter+49 Pentecôte
+Easter+50 Lundi de Pentecôte
+08/15 Assomption
+11/01 Toussaint
+12/25 Noël
+
+/* Les dates suivantes ne sont malheureusement pas fériées... */
+
+/* Saisons */
+03/21* Printemps
+06/21* Été
+09/21* Automne
+12/21* Hiver
+
+/* Changements d'heure */
+03/SundayLast Passage à l'heure d'été
+10/SundayLast Passage à l'heure d'hiver
+
+/* Divers */
+/* BUG : si Penteco^te = 05/SunLast, fe^te des me`res repousse'e d'une semaine */
+05/SundayLast Fêtes des mères
+June Sun+3 Fêtes des pères
+
+#endif /*! _fr_FR_ISO8859_1_jferies_ */
diff --git a/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.proverbes b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.proverbes
new file mode 100644
index 0000000..5a9f0ea
--- /dev/null
+++ b/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.proverbes
@@ -0,0 +1,354 @@
+/*
+ * Proverbes liés au calendrier
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _fr_FR_ISO8859_1_proverbes_
+#define _fr_FR_ISO8859_1_proverbes_
+
+LANG=fr_FR.ISO8859-1
+
+/* Janvier */
+01/01 Calme et claire nuit de l'an
+ À bonne année donne l'élan.
+01/02 Janvier d'eau chiche
+ Fait le paysan riche.
+01/04 Un mois de janvier sans gelée
+ N'amène jamais une bonne année.
+01/06 Pluie aux Rois,
+ Blé jusqu'au toit.
+01/08 Janvier sec et sage
+ Est un bon présage.
+01/09 Saint Julien brise la glace ;
+ S'il ne la brise, c'est qu'il l'embrasse.
+01/10 Beau temps à la saint Guillaume
+ Donne plus de blé que de chaume.
+01/13 Soleil au jour de saint Hilaire,
+ Fends du bois pour ton hiver.
+01/14 Pingouin dans les champs,
+ Hiver méchant.
+01/15 S'il gèle à la saint Maur,
+ La moitié de l'hiver est dehors.
+01/18 À la saint Pierre,
+ L'hiver s'en va ou se resserre.
+01/20 S'il gèle à la saint Sébastien,
+ L'hiver s'en va ou revient.
+01/22 Pour saint Vincent,
+ L'hiver perd ses dents
+ Ou les retrouve pour longtemps.
+01/24 S'il tonne en janvier,
+ Monte les barriques au grenier.
+01/25 Le jour de saint Paul,
+ L'hiver se rompt le col.
+01/31 Janvier fait le péché,
+ Mars en est accusé.
+
+/* Février */
+02/01 À la saint Ignace,
+ L'eau est de glace.
+02/02 Chandeleur claire, hiver derrière ;
+ Chandeleur trouble, hiver redouble.
+02/03 À la saint Blaise,
+ L'hiver s'apaise,
+ Mais s'il redouble et s'il reprend,
+ Longtemps après on s'en ressent.
+02/05 Pour la sainte Agathe, sème ton oignon,
+ Fût-il dans la glace, il deviendra bon.
+02/09 À la sainte Apolline
+ Bien souvent l'hiver nous quitte.
+02/12 Si le soleil rit à la sainte Eulalie,
+ Pommes et cidre à la folie.
+02/14 À la saint Valentin,
+ Tous les vents sont marins.
+02/16 Pluie de février
+ À la terre vaut du fumier.
+02/18 Février trop doux,
+ Printemps en courroux.
+02/20 La neige de février
+ Brûle le blé.
+02/22 Neige à la sainte Isabelle
+ Fait la fleur plus belle.
+02/24 Saint Mathias
+ Casse la glace ;
+ S'il n'y en a pas,
+ Il en fera.
+02/27 Gelée de la sainte Honorine
+ Rend toute la vallée chagrine.
+02/28 Fleur de février
+ Va mal au pommier.
+
+/* Mars */
+03/01 Taille à la saint Aubin
+ Donnera de gros raisins.
+03/02 Quand mars mouillera,
+ Bien du vin tu auras.
+03/03 Soit au début, soit à la fin,
+ Mars nous montre son venin.
+03/06 À la sainte Colette
+ Commence à chanter l'alouette.
+03/08 Quand en mars il tonne,
+ L'année sera bonne.
+03/10 Mars venteux,
+ Vergers pommeux.
+03/12 À la saint Grégoire,
+ Il faut tailler la vigne pour boire.
+03/13 Poussière de mars
+ Est poussière d'or...
+03/15 Pluie de mars grandit l'herbette
+ Et souvent annonce disette.
+03/17 S'il fait doux à la saint Patrice,
+ De leurs trous sortent les écrevisses.
+03/19 Pour saint Joseph,
+ L'hirondelle va et vient.
+03/21 S'il pleut à la saint Benoît,
+ Il pleut trente-sept jours plus trois.
+03/23 Quand à glace il gèle à la saint Victorien,
+ En pêches et en abricots il n'y a rien.
+03/25 Quand fleurs en mars il y aura,
+ Guère de fruits ne mangeras.
+03/28 À la saint Gontran, si la température est belle,
+ Arrivent les premières hirondelles.
+03/30 Quand mars se déguise en été,
+ Avril prend ses habits fourrés.
+03/31 À la saint Benjamin,
+ Le mauvais temps prend fin.
+
+/* Mobiles */
+Easter-7 Le propre jour des Rameaux
+ Sème oignons et poireaux.
+Easter-3 La gelée du jeudi saint
+ Gèle le sarrasin.
+Easter-2 Gelée du vendredi saint
+ Gèle le pain et le vin.
+Easter S'il pleut à Pâques,
+ Il pleut pendant quarante jours.
+Easter Pâques en mars,
+ Pestes, guerres ou famines.
+Easter+36 Haricots de rogations
+ Rendent à foison.
+Easter+37 Belles rogations,
+ Belles moissons.
+Easter+39 S'il pleut à l'Ascension,
+ Tout va en perdition.
+Easter+49 La Pentecôte
+ Donne les fruits, ou les ôte.
+Easter+56 S'il pleut à la Trinité,
+ Il pleut tous les jours de l'année.
+
+/* Avril */
+04/01 Avril entrant,
+ Coucou chantant,
+ Sonnailles tintant.
+04/05 Avril fait la fleur,
+ Mai en a l'honneur.
+04/10 Il n'est point d'avril si beau
+ Qu'il n'ait de neige à son chapeau.
+04/15 En avril, ne te découvre pas d'un fil ;
+ En mai, fais ce qu'il te plaît ;
+ En juin, de trois habits n'en garde qu'un.
+04/17 Orage en avril,
+ Prépare tes barrils.
+04/19 À la sainte Léonide
+ Chaque blé pousse rapide.
+04/22 Pluie à la sainte Opportune,
+ Ni cerises ni prunes.
+04/23 À la saint Georges,
+ Sème ton orge,
+ À la saint Marc,
+ Il est trop tard.
+04/25 À la saint Marc, s'il tombe de l'eau,
+ Il n'y aura pas de fruits à couteau.
+04/28 Avril pluvieux et mai venteux
+ Ne rendent pas le paysan disetteux.
+04/30 La pluie à la saint Robert
+ De bon vin emplira ton verre.
+
+/* Mai */
+05/03 Les trois saints au sang de navet,
+ Pancrace, Mamert et Servais,
+ Sont bien nommés les saints de glace,
+ Mamert, Servais et Pancrace.
+05/15 À la sainte Denise,
+ Le froid n'en fait plus à sa guise.
+05/16 À la saint Honoré,
+ S'il fait gelée,
+ Le vin diminue de moitié.
+05/18 Bon fermier à sainte Juliette
+ Doit vendre ses poulettes.
+05/22 Beau temps à la sainte Émilie
+ Donne du fruit à la folie.
+05/23 Qui sème haricots à la saint Didier
+ Les arrachera à poignées.
+
+/* Juin */
+06/08 S'il pleut à la saint Médard,
+ Il pleut quarante jours plus tard,
+ À moins que saint Barnabé
+ Ne vienne l'arrêter.
+06/11 À la saint Barnabé,
+ Fauche ton pré.
+06/16 Si le jour de saint Fargeau
+ La lune se fait dans l'eau,
+ Le reste du mois est beau.
+06/19 S'il pleut à la saint Gervais,
+ Il pleut quarante jours après.
+06/20 Pluie d'orage à la saint Sylvère,
+ C'est beaucoup de vin dans le verre.
+06/24 S'il pleut à la saint Jean,
+ Guère de vin ni de pain.
+06/25 Après la saint Jean, si le coucou chante,
+ L'année sera rude et méchante.
+06/29 S'il pleut la veille de la saint Pierre,
+ La vigne est réduite du tiers.
+
+/* Juillet */
+07/02 S'il pleut à la Visitation,
+ Pluie à discrétion.
+07/03 À la saint Anatole,
+ Confiture dans la casserole.
+07/06 Juillet sans orage,
+ Famine au village.
+07/10 Petite pluie de juillet ensoleillé
+ Emplit caves et greniers.
+07/13 Quand reviendra la saint Henri,
+ Tu planteras ton céleri.
+07/16 Qui veut des beaux navets
+ Les sème en juillet.
+07/20 À la sainte Marguerite, pluie
+ Jamais au paysan ne souris ;
+ Mais pluie à la sainte Anne,
+ Pour lui c'est de la manne.
+07/21 S'il pleut à la saint Victor,
+ La récolte n'est pas d'or.
+07/22 S'il pleut à la sainte Madeleine,
+ Il pleuvra durant six semaines.
+07/25 Si saint jacques est serein,
+ L'hiver sera dû et serein.
+07/26 Pour la sainte Anne, s'il pleut,
+ Trente jours seront pluvieux.
+
+/* Août */
+August Sun+2 En août et vendanges, il n'y a ni fêtes ni dimanches.
+08/02 S'il pleut au mois d'août,
+ Les truffes sont au bout.
+08/04 Août donne goût.
+08/06 Soleil rouge en août,
+ C'est de la pluie partout.
+08/10 Qui sème à la saint Laurent
+ Y perd la graine et puis le temps.
+08/13 S'il pleut à la sainte Radegonde,
+ Misère abonde sur le monde.
+08/15 Pluie de l'Assomption,
+ Huit jours de mouillon.
+08/16 De saint Roch la grande chaleur
+ Prépare du vin la couleur.
+08/18 Temps trop beau en août
+ Annonce hiver en courroux.
+08/20 Brumes d'août font passer les châtaignes.
+08/22 Jamais d'août la sécheresse
+ N'amènera la richesse.
+08/24 À la saint Barthélémy,
+ Paie to dû.
+08/28 Fine pluie à la saint Augustin,
+ C'est comme s'il pleuvait du vin.
+08/29 Quand les hirondelles voient la saint Michel,
+ L'hiver ne vient qu'à Noël.
+
+/* Septembre */
+09/01 Pluie de la saint Gilles ruine les glands.
+09/05 Septembre humide,
+ Pas de tonneau vide.
+09/11 Tu peux semer sans crainte
+ Quand arrive la saint Hyacinthe.
+09/15 La rosée de saint Albin
+ est, dit-on, rosée de vin.
+09/19 Qui sème à la saint Janvier
+ De l'an récolte le premier.
+09/21 Si Matthieu pleure au lieu de rire,
+ Le vin en vinaigre vire.
+09/22 Semis de saint Maurice,
+ Récolte à ton caprice.
+09/23 Septembre se nomme
+ Le mai de l'automne.
+09/25 À la saint Firmin
+ L'hiver est en chemin.
+09/29 Pluie de saint Michel sans orage
+ D'un hiver doux est le présage.
+09/30 À la saint Jérôme,
+ Hoche tes pommes.
+
+/* Octobre */
+10/02 À la saint Léger,
+ Faut s'purger !
+10/04 Sème à la saint François,
+ Ton blé aura plus de poids.
+10/09 Beau temps à la saint Denis,
+ Hiver pourri.
+10/13 En octobre, qui ne fume rien
+ Ne récolte rien.
+10/16 Coupe ton chou à la saint Gall,
+ En hiver c'est un régal.
+10/18 À la saint Luc, sème dru,
+ Ou ne sème plus.
+10/23 Gelée d'octobre
+ Rend le vigneron sobre.
+10/25 Pour saint Crépin, mort aux mouches.
+10/28 À la sainte Simone,
+ Il faut avoir rentré ses pommes.
+10/31 Quand octobre prend sa fin,
+ Dans la cave est le vin.
+
+/* Novembre */
+11/01 À la Toussaint commence l'été de la saint Martin.
+11/02 Telle Toussaint, tel Noël,
+ Et Pâques pareil.
+11/04 À la saint Charles,
+ La gelée parle.
+11/08 En novembre, s'il tonne,
+ L'année sera bonne.
+11/11 Si l'hiver va droit son chemin,
+ Vous l'aurez à la saint Martin,
+ Mais s'il trouve quelque encombrée,
+ Vous l'aurez à la saint André.
+11/11 Tue ton cochon à la saint Martin
+ Et invite ton voisin.
+11/19 Sainte Élisabeth nous montre quel bonhomme sera l'hiver.
+11/22 Pour sainte Cécile,
+ Chaque haricot en fait mille.
+11/23 Quand l'hiver vient doucement,
+ Il est là à la saint Clément.
+11/25 Sainte Catherine, toute fille veut la fêter,
+ Mais aucune ne veut la coiffer.
+11/25 Quand sainte Catherine au ciel fait la moue,
+ Il faut patauger longtemps dans la boue.
+11/30 Quand l'hiver n'est pas pressé,
+ Il arrive à la saint André.
+
+/* Décembre */
+12/SundayFirst Tel avent,
+ Tel printemps.
+12/06 Neige de saint Nicolas
+ Donne froid pour trois mois.
+12/07 À la saint Ambroise,
+ Du froid pour huit jours.
+12/10 À la sainte Julie,
+ Le soleil ne quitte pas son lit.
+12/13 À la sainte Luce,
+ Le jour croît du saut d'une puce.
+12/16 Décembre de froid trop chiche
+ Ne fait pas le paysan riche.
+12/21 S'il gèle à la saint Thomas,
+ Il gèlera encore trois mois.
+12/23 Le tonnerre en décembre
+ Annonce pour l'an qui vient
+ Aux bêtes et aux gens
+ Abondance de biens.
+12/25 Noël au balcon,
+ Pâques au tison.
+12/26 À la saint Étienne,
+ Chacun trouve la sienne.
+12/28 Les jours entre Noël et les Rois
+ Indiquent le temps des douze mois.
+
+#endif /*! _fr_FR_ISO8859_1_proverbes_ */
diff --git a/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.all b/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.all
new file mode 100644
index 0000000..8c45910
--- /dev/null
+++ b/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.all
@@ -0,0 +1,12 @@
+/*
+ * hrvatski calendar
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _hr_HR_ISO8859_2_all_
+#define _hr_HR_ISO8859_2_all_
+
+#include <hr_HR.ISO8859-2/calendar.praznici>
+
+#endif /* !_hr_HR_ISO8859_2_all_ */
diff --git a/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici b/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici
new file mode 100644
index 0000000..60ae5e3
--- /dev/null
+++ b/usr.bin/calendar/calendars/hr_HR.ISO8859-2/calendar.praznici
@@ -0,0 +1,44 @@
+/*
+ * hrvatski praznici
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _hr_HR_ISO8859_2_praznici_
+#define _hr_HR_ISO8859_2_praznici_
+
+LANG=hr_HR.ISO8859-2
+
+/* dr¾avni praznici */
+01/01 Nova godina
+05/01 Praznik rada
+05/30 Tjelovo
+06/22 Dan antifa¹istièke borbe
+06/25 Dan dr¾avnosti
+08/05 Dan domovinske zahvalnosti
+10/08 Dan neovisnosti
+
+/* katolièki blagdani */
+01/06 Sveta tri kralja
+Easter-2 Veliki petak
+Easter Uskrs
+Easter+1 Uskrsni ponedjeljak
+Easter+49 Duhovi
+Easter+50 Duhovni ponedjeljak
+Easter+39 Uza¹a¹æe
+08/15 Velika Gospa
+11/01 Svi sveti
+12/25 Bo¾iæ
+12/26 Stjepandan
+
+/* godi¹nja doba */
+03/21* Poèetak proljeæa
+06/21* Poèetak ljeta
+09/21* Poèetak jesena
+12/21* Poèetak zime
+
+/* ljetno vrijeme */
+03/NedjeljaLast Poèetak ljetnog vremena
+10/NedjeljaLast Kraj ljetnog vremena
+
+#endif /* !_hr_HR_ISO8859_2_praznici_ */
diff --git a/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.all b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.all
new file mode 100644
index 0000000..5084dc7
--- /dev/null
+++ b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.all
@@ -0,0 +1,13 @@
+/*
+ * Magyar kalendárium
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _hu_HU_ISO8859_2_all_
+#define _hu_HU_ISO8859_2_all_
+
+#include <hu_HU.ISO8859-2/calendar.unnepek>
+#include <hu_HU.ISO8859-2/calendar.nevnapok>
+
+#endif /* !_hu_HU.ISO8859-2_all_ */
diff --git a/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.nevnapok b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.nevnapok
new file mode 100644
index 0000000..f85c084
--- /dev/null
+++ b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.nevnapok
@@ -0,0 +1,386 @@
+/*
+ * Névnapok
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _hu_HU_ISO8859_2_nevnapok_
+#define _hu_HU_ISO8859_2_nevnapok_
+
+LANG=hu_HU.ISO8859-2
+
+/*
+ * N.B.: A névnapok Magyarországon a szentek napjai alapján szerepelnek
+ * a naptárban. Néhány név többször is szerepel, de mindenki
+ * csak egyszer tart névnapot egy évben. A választott nap
+ * ebben az esetben a hagyományokon és az illetõn múlik.
+ *
+ */
+
+01/01 Fruzsina
+01/02 Ábel, Gergely
+01/03 Genovéva, Benjámin
+01/04 Titusz, Leona
+01/05 Simon
+01/06 Boldizsár, Menyhárt
+01/07 Attila, Ramóna
+01/08 Gyöngyvér
+01/09 Marcell
+01/10 Melánia
+01/11 Ágota, Baltazár
+01/12 Ernõ, Cézár
+01/13 Veronika
+01/14 Bódog, Félix
+01/15 Lóránt, Loránd
+01/16 Gusztáv
+01/17 Antal, Antónia
+01/18 Piroska
+01/19 Sára, Márió
+01/20 Fábián, Sebestyén
+01/21 Ágnes
+01/22 Vince, Artúr
+01/23 Zelma, Rajmund
+01/24 Timót, Xénia
+01/25 Pál
+01/26 Vanda, Paula
+01/27 Angelika, Angéla
+01/28 Károly, Karola
+01/29 Adél
+01/30 Gerda, Martina
+01/31 Marcella
+02/01 Ignác
+02/02 Karolina, Aida
+02/03 Balázs
+02/04 Ráhel, Csenge
+02/05 Ágota, Ingrid
+02/06 Dóra, Dorottya
+02/07 Rómeó, Tódor
+02/08 Aranka
+02/09 Abigél, Alex
+02/10 Elvira
+02/11 Bertold, Marietta
+02/12 Lívia, Lídia
+02/13 Ella, Linda
+02/14 Bálint, Valentin
+02/15 Kolos
+02/16 Julianna, Lilla
+02/17 Donát
+02/18 Bernadett
+02/19 Zsuzsanna
+02/20 Aladár, Álmos
+02/21 Eleonóra
+02/22 Gerzson
+02/23 Alfréd
+02/24 Mátyás
+02/25 Géza
+02/26 Edina
+02/27 Ákos, Bátor
+02/28 Elemér
+03/01 Albin
+03/02 Lujza
+03/03 Kornélia
+03/04 Kázmér
+03/05 Adorján, Adrián
+03/06 Leonóra, Inez
+03/07 Tamás
+03/08 Zoltán
+03/09 Franciska, Fanni
+03/10 Ildikó
+03/11 Szilárd
+03/12 Gergely
+03/13 Krisztián, Ajtony
+03/14 Matild
+03/15 Kristóf
+03/16 Henrietta
+03/17 Gertrúd, Patrik
+03/18 Sándor, Ede
+03/19 József, Bánk
+03/20 Klaudia
+03/21 Benedek
+03/22 Beáta, Izolda
+03/23 Emõke
+03/24 Gábor, Karina
+03/25 Irén, Irisz
+03/26 Emánuel
+03/27 Hajnalka
+03/28 Gedeon, Johanna
+03/29 Aguszta
+03/30 Zalán
+03/31 Árpád
+04/01 Hugó
+04/02 Áron
+04/03 Buda, Richárd
+04/04 Izidor
+04/05 Vince
+04/06 Vilmos, Bíborka
+04/07 Herman
+04/08 Dénes
+04/09 Erhard
+04/10 Zsolt
+04/11 Leó, Szaniszló
+04/12 Gyula
+04/13 Ida
+04/14 Tibor
+04/15 Anasztázia, Tas
+04/16 Csongor
+04/17 Rudolf
+04/18 Andrea, Ilma
+04/19 Emma
+04/20 Tivadar
+04/21 Konrád
+04/22 Csilla, Noémi
+04/23 Béla
+04/24 György
+04/25 Márk
+04/26 Ervin
+04/27 Zita
+04/28 Valéria
+04/29 Péter
+04/30 Katalin, Kitti
+05/01 Fülöp, Jakab
+05/02 Zsigmond
+05/03 Tímea, Irma
+05/04 Mónika, Flórián
+05/05 Györgyi
+05/06 Ivett, Frida
+05/07 Gizella
+05/08 Mihály
+05/09 Gergely
+05/10 Ármin, Pálma
+05/11 Ferenc
+05/12 Pongrác
+05/13 Szervác, Imola
+05/14 Bonifác
+05/15 Zsófia, Szonja
+05/16 Mózes, Botond
+05/17 Paszkál
+05/18 Erik, Alexandra
+05/19 Ivó, Milán
+05/20 Bernát, Felícia
+05/21 Konstantin
+05/22 Júlia, Rita
+05/23 Dezsõ
+05/24 Eszter, Eliza
+05/25 Orbán
+05/26 Fülöp, Evelin
+05/27 Hella
+05/28 Emil, Csanád
+05/29 Magdolna
+05/30 Janka, Zsanett
+05/31 Angéla, Petronella
+06/01 Tünde
+06/02 Kármen, Anita
+06/03 Klotild
+06/04 Bulcsú
+06/05 Fatime
+06/06 Norbert, Cintia
+06/07 Róbert
+06/08 Medárd
+06/09 Félix
+06/10 Margit, Gitta, Gréta
+06/11 Barnabás
+06/12 Villõ
+06/13 Antal, Anett
+06/14 Vazul
+06/15 Jolán, Vid
+06/16 Jusztin
+06/17 Laura, Alida
+06/18 Arnold, Levente
+06/19 Gyárfás
+06/20 Rafael
+06/21 Alajos, Leila
+06/22 Paulina
+06/23 Zoltán, Szidonia
+06/24 Iván
+06/25 Vilmos, Viola
+06/26 János, Pál
+06/27 László
+06/28 Levente, Irén
+06/29 Péter, Pál
+06/30 Pál
+07/01 Annamária, Tihamér
+07/02 Ottó
+07/03 Kornél, Soma
+07/04 Ulrik
+07/05 Emese, Sarolta
+07/06 Csaba
+07/07 Apollónia
+07/08 Ellák
+07/09 Lukrécia
+07/10 Amália
+07/11 Nóra, Lili
+07/12 Izabella, Dalma
+07/13 Jenõ
+07/14 Örs, Stella
+07/15 Henrik, Roland
+07/16 Valter
+07/17 Endre, Elek
+07/18 Frigyes
+07/19 Emília
+07/20 Illés
+07/21 Daniella, Dániel
+07/22 Magdolna
+07/23 Lenke
+07/24 Kinga, Kincsõ
+07/25 Kristóf, Jakab
+07/26 Anna, Anikó
+07/27 Olga, Liliána
+07/28 Szabolcs
+07/29 Márta, Flóra
+07/30 Judit, Xénia
+07/31 Oszkár
+08/01 Boglárka
+08/02 Lehel
+08/03 Hermina
+08/04 Domonkos, Dominika
+08/05 Krisztina
+08/06 Berta, Bettina
+08/07 Ibolya
+08/08 László
+08/09 Emõd
+08/10 Lõrinc
+08/11 Zsuzsanna, Tiborc
+08/12 Klára
+08/13 Ipoly
+08/14 Marcell
+08/15 Mária
+08/16 Ábrahám
+08/17 Jácint
+08/18 Ilona
+08/19 Huba
+08/20 István
+08/21 Sámuel, Hajna
+08/22 Menyhért, Mirjam
+08/23 Bence
+08/24 Bertalan
+08/25 Lajos, Patrícia
+08/26 Izsó
+08/27 Gáspár
+08/28 Ágoston
+08/29 Beatrix, Erna
+08/30 Rózsa
+08/31 Erika, Bella
+09/01 Egyed, Egon
+09/02 Rebeka, Dorina
+09/03 Hilda
+09/04 Rozália
+09/05 Viktor, Lõrinc
+09/06 Zakariás
+09/07 Regina
+09/08 Mária, Adrienn
+09/09 Ádám
+09/10 Nikolett, Hunor
+09/11 Teodóra
+09/12 Mária
+09/13 Kornél
+09/14 Szeréna, Roxána
+09/15 Enikõ, Melitta
+09/16 Edit
+09/17 Zsófia
+09/18 Diána
+09/19 Vilhelmina
+09/20 Friderika
+09/21 Máté, Mirella
+09/22 Móric
+09/23 Tekla
+09/24 Gellért, Mercédesz
+09/25 Eufrozina, Kende
+09/26 Jusztina
+09/27 Adalbert
+09/28 Vencel
+09/29 Mihály
+09/30 Jeromos
+10/01 Malvin
+10/02 Petra
+10/03 Helga
+10/04 Ferenc
+10/05 Aurél
+10/06 Brúnó, Renáta
+10/07 Amália
+10/08 Koppány
+10/09 Dénes
+10/10 Gedeon
+10/11 Brigitta
+10/12 Miksa
+10/13 Kálmán, Ede
+10/14 Helén
+10/15 Teréz
+10/16 Gál
+10/17 Hedvig
+10/18 Lukács
+10/19 Nándor
+10/20 Vendel
+10/21 Orsolya
+10/22 Elõd
+10/23 Gyöngyi
+10/24 Salamon
+10/25 Blanka, Bianka
+10/26 Dömötör
+10/27 Szabina
+10/28 Simon, Szimonetta
+10/29 Nárcisz
+10/30 Alfonz
+10/31 Farkas
+11/01 Marianna
+11/02 Achilles
+11/03 Gyõzõ
+11/04 Károly
+11/05 Imre
+11/06 Lénárd
+11/07 Rezsõ
+11/08 Zsombor
+11/09 Tivadar
+11/10 Réka
+11/11 Márton
+11/12 Jónás, Renátó
+11/13 Szilvia
+11/14 Aliz
+11/15 Albert, Lipót
+11/16 Ödön
+11/17 Hortenzia, Gergõ
+11/18 Jenõ
+11/19 Erzsébet
+11/20 Jolán
+11/21 Olivér
+11/22 Cecília
+11/23 Kelemen, Klementina
+11/24 Emma
+11/25 Katalin
+11/26 Virág
+11/27 Virgil
+11/28 Stefánia
+11/29 Taksony
+11/30 András, Andor
+12/01 Elza
+12/02 Melinda, Vivien
+12/03 Ferenc, Olívia
+12/04 Borbála, Barbara
+12/05 Vilma
+12/06 Miklós
+12/07 Ambrus
+12/08 Mária
+12/09 Natália
+12/10 Judit
+12/11 Árpád
+12/12 Gabriella
+12/13 Luca, Otília
+12/14 Szilárda
+12/15 Valér
+12/16 Etelka, Aletta
+12/17 Lázár, Olimpia
+12/18 Auguszta
+12/19 Viola
+12/20 Teofil
+12/21 Tamás
+12/22 Zénó
+12/23 Viktória
+12/24 Ádám, Éva
+12/25 Eugénia
+12/26 István
+12/27 János
+12/28 Kamilla
+12/29 Tamás, Tamara
+12/30 Dávid
+12/31 Szilveszter
+
+#endif /*! _hu_HU_ISO8859_2_nevnapok_ */
diff --git a/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.unnepek b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.unnepek
new file mode 100644
index 0000000..dab8ead
--- /dev/null
+++ b/usr.bin/calendar/calendars/hu_HU.ISO8859-2/calendar.unnepek
@@ -0,0 +1,53 @@
+/*
+ * Ünnepnapok
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _hu_HU_ISO8859_2_unnepek_
+#define _hu_HU_ISO8859_2_unnepek_
+
+LANG=hu_HU.ISO8859-2
+
+/* Munkaszüneti napok */
+01/01 Újév
+03/15 1848-as szabadságharc és forradalom ünnepe
+05/01 Munka ünnepe
+10/23 1956-os forradalom ünnepe
+
+/* Vallási munkaszüneti napok */
+Easter Húsvét
+Easter+1 Húsvét hétfõ
+Easter+42 Virágvasárnap
+Easter+49 Pünkösd
+Easter+50 Pünkösd hétfõ
+08/20 Szent István nap, Államalapítás ünnepe
+11/01 Halottak napja
+12/25 Karácsony elsõ napja
+12/26 Karácsony második napja
+
+/* Az itt következõ dátumok nem munkaszüneti napok csak ünnepnapok */
+
+/* Csillagászati évszakok */
+03/21* Tavaszi napéjegyenlõség
+06/21* Nyári napforduló
+09/21* Õszi napéjegyenlõség
+12/21* Téli napforduló
+
+/* Téli és nyári idõszámítás közötti váltás */
+03/SundayLast Váltás a nyári idõszámításra
+10/SundayLast Váltás a téli idõszámításra
+
+/* Egyéb vallási ünnepek amelyek nem munkaszüneti napok */
+Easter-2 Nagy péntek ("a harangok Romába mennek")
+
+/* Egyéb ünnepnapok és emléknapok*/
+02/14 Valentin nap - a szerelmesek ünnepe
+03/08 Nõ nap - egy-egy szál virág a nõknek
+May Sun+2 Anyák napja
+10/06 Az 1848-as aradi vértanuk napja
+12/06 Mikulás napja - gyerekek csokit kapnak
+12/24 Karácsony elõestéje
+12/31 Szilveszter napja
+
+#endif /*! _hu_HU_ISO8859_2_unnepek_ */
diff --git a/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.all b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.all
new file mode 100644
index 0000000..cdffa48
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.all
@@ -0,0 +1,15 @@
+/*
+ * $FreeBSD$
+ *
+ * Brazilian calendar originally submitted by
+ * Renato Tambellini <rtsanch@gmail.com>
+ */
+
+#ifndef _pt_BR_ISO8859_1_all_
+#define _pt_BR_ISO8859_1_all_
+
+#include <pt_BR.ISO8859-1/calendar.holidays>
+#include <pt_BR.ISO8859-1/calendar.commemorative>
+#include <pt_BR.ISO8859-1/calendar.mcommemorative>
+
+#endif /* !_pt_BR.ISO8859_1_all_ */
diff --git a/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.commemorative b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.commemorative
new file mode 100644
index 0000000..9be5deb
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.commemorative
@@ -0,0 +1,191 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian commemorative days
+ *
+ * http://www.ibge.gov.br/ibgeteen/datas/home.html
+ */
+
+#ifndef _pt_BR_ISO8859_1_commemorative_
+#define _pt_BR_ISO8859_1_commemorative_
+
+LANG=pt_BR.ISO8859-1
+
+01/06 Dia nacional do fotógrafo
+01/06 Dia da gratidão
+01/07 Dia da liberdade de culto
+01/09 Dia do Fico
+01/12 Aniversário de Belém
+01/20 Dia do farmacêutico
+01/20 Dia nacional do fusca
+01/21 Dia mundial da religião
+01/24 Dia da Previdência Social
+01/25 Dia do carteiro
+01/25 Aniversário da cidade de São Paulo
+01/28 Aniversário da abertura dos portos no Brasil, em 1808
+01/30 Dia da saudade
+02/01 Dia do publicitário
+02/04 Aniversário de Macapá
+02/07 Dia do gráfico
+02/16 Dia do repórter
+02/19 Dia do esportista
+03/01 Aniversário da cidade do Rio de Janeiro
+03/02 Dia do turismo
+03/05 Dia do filatelista brasileiro
+03/07 Dia do fuzileiro naval
+03/08 Dia internacional da mulher
+03/10 Dia do telefone
+03/12 Aniversário de Recife
+03/12 Dia do bibliotecário
+03/14 Dia nacional da poesia
+03/15 Dia da escola
+03/15 Dia mundial do consumidor
+03/17 Aniversário de Aracaju
+03/21 Dia da eliminação da discriminação racial
+03/22 Dia mundial da água
+03/23 Aniversário de Florianópolis
+03/23 Dia do meteorologista
+03/26 Aniversário de Porto Alegre
+03/27 Dia do circo
+03/27 Dia do teatro
+03/28 Dia do revisor e do diagramador
+03/29 Aniversário de Curitiba
+03/31 Aniversário do golpe militar
+04/01 Dia da mentira
+04/02 Dia internacional do livro para crianças
+04/07 Dia mundial da saúde
+04/07 Dia do jornalismo
+04/08 Dia mundial de combate ao câncer
+04/08 Dia da natação
+04/08 Aniversário de Cuiabá
+04/12 Aniversário de Fortaleza
+04/13 Dia dos jovens
+04/14 Dia internacional do café
+04/15 Dia mundial do desenhista
+04/15 Dia da conservação do solo
+04/19 Dia do índio
+04/20 Dia do diplomata
+04/21 Aniversário de Brasília
+04/21 Dia do metalúrgico
+04/22 Dia do descobrimento do Brasil
+04/22 Dia do planeta Terra
+04/22 Dia da Força Aérea Brasileira
+04/23 Dia mundial do escoteiro
+04/25 Dia do contabilista
+04/27 Dia da empregada doméstica
+04/28 Dia da educação
+04/30 Dia do ferroviário
+05/05 Dia do cartógrafo
+05/08 Dia do artista plástico
+05/08 Dia internacional da Cruz Vermelha
+05/12 Dia mundial do enfermeiro
+05/13 Dia da abolição da escravatura
+05/13 Dia do automóvel
+05/15 Dia do assistente social
+05/16 Dia do gari
+05/17 Dia internacional das telecomunicações
+05/18 Dia mundial dos museus
+05/20 Aniversário de Palmas
+05/21 Dia da Língua Nacional
+05/22 Dia do apicultor
+05/24 Dia do vestibulando
+05/25 Dia da indústria
+05/27 Dia do profissional liberal
+05/29 Dia do estatístico
+05/29 Dia do geógrafo
+05/30 Dia do geólogo
+06/01 Dia da imprensa
+06/04 Dia internacional das crianças vítimas de agressão
+06/05 Dia mundial do meio ambiente e da ecologia
+06/09 Dia do porteiro
+06/10 Dia da Língua Portuguesa
+06/11 Dia da Marinha do Brasil
+06/12 Dia dos namorados
+06/15 Dia do paleontólogo
+06/18 Dia do químico
+06/19 Dia do migrante
+06/21 Dia da música
+06/22 Dia do aeroviário
+06/25 Dia do imigrante
+06/26 Dia internacional do combate às drogas
+06/26 Dia do metrologista
+06/29 Dia da telefonista
+06/29 Dia do pescador
+07/01 Dia da vacina BCG
+07/02 Dia do bombeiro
+07/09 Aniversário de Boa Vista
+07/11 Dia mundial da população
+07/12 Dia do engenheiro florestal
+07/13 Dia mundial do rock
+07/17 Dia de proteção às florestas
+07/19 Dia do futebol
+07/20 Chegada do homem à Lua
+07/20 Dia da amizade
+07/25 Dia do escritor
+07/27 Dia nacional da prevenção de acidentes de trabalho
+07/28 Dia do agricultor
+08/11 Dia do advogado
+08/11 Dia da televisão
+08/13 Dia do economista
+08/15 Dia da informática
+08/16 Aniversário de Teresina
+08/21 Dia da habitação
+08/22 Dia do folclore
+08/25 Dia do soldado
+08/26 Aniversário de Campo Grande
+08/27 Dia do psicólogo
+08/31 Dia do nutricionista
+09/03 Dia do biólogo
+09/08 Dia mundial da alfabetização
+09/08 Aniversário de Vitória
+09/08 Aniversário de São Luís
+09/09 Dia do administrador
+09/09 Dia do médico veterinário
+09/16 Dia internacional para preservação da camada de ozônio
+09/18 Dia dos símbolos nacionais
+09/21 Dia do idoso
+09/21 Dia da árvore
+09/25 Dia do rádio
+09/25 Dia nacional do trânsito
+09/30 Dia da secretária
+10/04 Dia dos animais
+10/05 Dia da promulgação da atual Constituição brasileira
+10/11 Dia nacional da pessoa portadora de deficiência física
+10/12 Dia da criança
+10/12 Dia do descobrimento da América
+10/12 Dia do agrônomo
+10/13 Dia do fisioterapeuta
+10/14 Dia da pecuária
+10/15 Dia do professor
+10/16 Dia mundial da alimentação
+10/18 Dia do médico
+10/23 Dia do aviador
+10/24 Dia da ONU
+10/25 Dia da democracia
+10/25 Dia do dentista
+10/28 Dia do funcionário público
+10/29 Dia nacional do livro
+10/30 Dia do comércio
+10/31 Dia das bruxas
+11/05 Dia do cinema brasileiro
+11/19 Dia da bandeira
+11/20 Dia nacional da consciência negra
+11/30 Dia do teólogo
+11/30 Dia da reforma agrária
+12/01 Dia mundial de luta contra a AIDS
+12/02 Dia da astronomia
+12/03 Dia internacional das pessoas portadoras de deficiência
+12/04 Dia do orientador educacional
+12/05 Aniversário de Maceió
+12/05 Dia internacional do voluntário
+12/08 Dia da família
+12/09 Dia do fonoaudiólogo
+12/10 Dia da declaração dos direitos do homem
+12/11 Dia do engenheiro
+12/11 Dia do arquiteto
+12/12 Aniversário de Belo Horizonte
+12/28 Aniversário de Rio Branco
+
+#endif
diff --git a/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.holidays b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.holidays
new file mode 100644
index 0000000..caf1139
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.holidays
@@ -0,0 +1,25 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian holidays
+ *
+ * Federal laws 662/1949, 6.802/1980, 9.093/1995 and 10.607/2002.
+ */
+
+#ifndef _pt_BR_ISO8859_1_holidays_
+#define _pt_BR_ISO8859_1_holidays_
+
+LANG=pt_BR.ISO8859-1
+
+01/01 Dia da confraternização universal e da paz
+04/21 Dia do Tiradentes
+05/01 Dia do trabalho
+09/07 Dia da independência do Brasil
+10/12 Dia da Nossa Senhora Aparecida
+11/02 Dia de Finados
+11/15 Dia da proclamação da República
+12/25 Natal
+
+#endif
diff --git a/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.mcommemorative b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.mcommemorative
new file mode 100644
index 0000000..1a113f8
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.ISO8859-1/calendar.mcommemorative
@@ -0,0 +1,22 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian mobile commemorative days
+ *
+ * http://www.novomilenio.inf.br/porto/mapas/nmcalenp.htm
+ */
+
+#ifndef _pt_BR_ISO8859_1_mcommemorative_
+#define _pt_BR_ISO8859_1_mcommemorative_
+
+LANG=pt_BR.ISO8859-1
+
+Easter-47 Carnaval
+Easter-7 Domingo de Ramos
+Easter-2 Sexta-feira Santa
+Easter Páscoa
+Easter+60 Corpus Christi
+
+#endif
diff --git a/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.all b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.all
new file mode 100644
index 0000000..25db5e1
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.all
@@ -0,0 +1,16 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian calendar
+ */
+
+#ifndef _pt_BR_UTF_8_all_
+#define _pt_BR_UTF_8_all_
+
+#include <pt_BR.UTF-8/calendar.holidays>
+#include <pt_BR.UTF-8/calendar.commemorative>
+#include <pt_BR.UTF-8/calendar.mcommemorative>
+
+#endif /* !_pt_BR.UTF_8_all_ */
diff --git a/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.commemorative b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.commemorative
new file mode 100644
index 0000000..2620aae
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.commemorative
@@ -0,0 +1,191 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian commemorative days
+ *
+ * http://www.ibge.gov.br/ibgeteen/datas/home.html
+ */
+
+#ifndef _pt_BR_UTF_8_commemorative_
+#define _pt_BR_UTF_8_commemorative_
+
+LANG=pt_BR.UTF-8
+
+01/06 Dia nacional do fotógrafo
+01/06 Dia da gratidão
+01/07 Dia da liberdade de culto
+01/09 Dia do Fico
+01/12 Aniversário de Belém
+01/20 Dia do farmacêutico
+01/20 Dia nacional do fusca
+01/21 Dia mundial da religião
+01/24 Dia da Previdência Social
+01/25 Dia do carteiro
+01/25 Aniversário da cidade de São Paulo
+01/28 Aniversário da abertura dos portos no Brasil, em 1808
+01/30 Dia da saudade
+02/01 Dia do publicitário
+02/04 Aniversário de Macapá
+02/07 Dia do gráfico
+02/16 Dia do repórter
+02/19 Dia do esportista
+03/01 Aniversário da cidade do Rio de Janeiro
+03/02 Dia do turismo
+03/05 Dia do filatelista brasileiro
+03/07 Dia do fuzileiro naval
+03/08 Dia internacional da mulher
+03/10 Dia do telefone
+03/12 Aniversário de Recife
+03/12 Dia do bibliotecário
+03/14 Dia nacional da poesia
+03/15 Dia da escola
+03/15 Dia mundial do consumidor
+03/17 Aniversário de Aracaju
+03/21 Dia da eliminação da discriminação racial
+03/22 Dia mundial da água
+03/23 Aniversário de Florianópolis
+03/23 Dia do meteorologista
+03/26 Aniversário de Porto Alegre
+03/27 Dia do circo
+03/27 Dia do teatro
+03/28 Dia do revisor e do diagramador
+03/29 Aniversário de Curitiba
+03/31 Aniversário do golpe militar
+04/01 Dia da mentira
+04/02 Dia internacional do livro para crianças
+04/07 Dia mundial da saúde
+04/07 Dia do jornalismo
+04/08 Dia mundial de combate ao câncer
+04/08 Dia da natação
+04/08 Aniversário de Cuiabá
+04/12 Aniversário de Fortaleza
+04/13 Dia dos jovens
+04/14 Dia internacional do café
+04/15 Dia mundial do desenhista
+04/15 Dia da conservação do solo
+04/19 Dia do índio
+04/20 Dia do diplomata
+04/21 Aniversário de Brasília
+04/21 Dia do metalúrgico
+04/22 Dia do descobrimento do Brasil
+04/22 Dia do planeta Terra
+04/22 Dia da Força Aérea Brasileira
+04/23 Dia mundial do escoteiro
+04/25 Dia do contabilista
+04/27 Dia da empregada doméstica
+04/28 Dia da educação
+04/30 Dia do ferroviário
+05/05 Dia do cartógrafo
+05/08 Dia do artista plástico
+05/08 Dia internacional da Cruz Vermelha
+05/12 Dia mundial do enfermeiro
+05/13 Dia da abolição da escravatura
+05/13 Dia do automóvel
+05/15 Dia do assistente social
+05/16 Dia do gari
+05/17 Dia internacional das telecomunicações
+05/18 Dia mundial dos museus
+05/20 Aniversário de Palmas
+05/21 Dia da Língua Nacional
+05/22 Dia do apicultor
+05/24 Dia do vestibulando
+05/25 Dia da indústria
+05/27 Dia do profissional liberal
+05/29 Dia do estatístico
+05/29 Dia do geógrafo
+05/30 Dia do geólogo
+06/01 Dia da imprensa
+06/04 Dia internacional das crianças vítimas de agressão
+06/05 Dia mundial do meio ambiente e da ecologia
+06/09 Dia do porteiro
+06/10 Dia da Língua Portuguesa
+06/11 Dia da Marinha do Brasil
+06/12 Dia dos namorados
+06/15 Dia do paleontólogo
+06/18 Dia do químico
+06/19 Dia do migrante
+06/21 Dia da música
+06/22 Dia do aeroviário
+06/25 Dia do imigrante
+06/26 Dia internacional do combate às drogas
+06/26 Dia do metrologista
+06/29 Dia da telefonista
+06/29 Dia do pescador
+07/01 Dia da vacina BCG
+07/02 Dia do bombeiro
+07/09 Aniversário de Boa Vista
+07/11 Dia mundial da população
+07/12 Dia do engenheiro florestal
+07/13 Dia mundial do rock
+07/17 Dia de proteção às florestas
+07/19 Dia do futebol
+07/20 Chegada do homem à Lua
+07/20 Dia da amizade
+07/25 Dia do escritor
+07/27 Dia nacional da prevenção de acidentes de trabalho
+07/28 Dia do agricultor
+08/11 Dia do advogado
+08/11 Dia da televisão
+08/13 Dia do economista
+08/15 Dia da informática
+08/16 Aniversário de Teresina
+08/21 Dia da habitação
+08/22 Dia do folclore
+08/25 Dia do soldado
+08/26 Aniversário de Campo Grande
+08/27 Dia do psicólogo
+08/31 Dia do nutricionista
+09/03 Dia do biólogo
+09/08 Dia mundial da alfabetização
+09/08 Aniversário de Vitória
+09/08 Aniversário de São Luís
+09/09 Dia do administrador
+09/09 Dia do médico veterinário
+09/16 Dia internacional para preservação da camada de ozônio
+09/18 Dia dos símbolos nacionais
+09/21 Dia do idoso
+09/21 Dia da árvore
+09/25 Dia do rádio
+09/25 Dia nacional do trânsito
+09/30 Dia da secretária
+10/04 Dia dos animais
+10/05 Dia da promulgação da atual Constituição brasileira
+10/11 Dia nacional da pessoa portadora de deficiência física
+10/12 Dia da criança
+10/12 Dia do descobrimento da América
+10/12 Dia do agrônomo
+10/13 Dia do fisioterapeuta
+10/14 Dia da pecuária
+10/15 Dia do professor
+10/16 Dia mundial da alimentação
+10/18 Dia do médico
+10/23 Dia do aviador
+10/24 Dia da ONU
+10/25 Dia da democracia
+10/25 Dia do dentista
+10/28 Dia do funcionário público
+10/29 Dia nacional do livro
+10/30 Dia do comércio
+10/31 Dia das bruxas
+11/05 Dia do cinema brasileiro
+11/19 Dia da bandeira
+11/20 Dia nacional da consciência negra
+11/30 Dia do teólogo
+11/30 Dia da reforma agrária
+12/01 Dia mundial de luta contra a AIDS
+12/02 Dia da astronomia
+12/03 Dia internacional das pessoas portadoras de deficiência
+12/04 Dia do orientador educacional
+12/05 Aniversário de Maceió
+12/05 Dia internacional do voluntário
+12/08 Dia da família
+12/09 Dia do fonoaudiólogo
+12/10 Dia da declaração dos direitos do homem
+12/11 Dia do engenheiro
+12/11 Dia do arquiteto
+12/12 Aniversário de Belo Horizonte
+12/28 Aniversário de Rio Branco
+
+#endif
diff --git a/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.holidays b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.holidays
new file mode 100644
index 0000000..7df0c34
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.holidays
@@ -0,0 +1,25 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian holidays
+ *
+ * Federal laws 662/1949, 6.802/1980, 9.093/1995 and 10.607/2002.
+ */
+
+#ifndef _pt_BR_UTF_8_holidays_
+#define _pt_BR_UTF_8_holidays_
+
+LANG=pt_BR.UTF-8
+
+01/01 Dia da confraternização universal e da paz
+04/21 Dia do Tiradentes
+05/01 Dia do trabalho
+09/07 Dia da independência do Brasil
+10/12 Dia da Nossa Senhora Aparecida
+11/02 Dia de Finados
+11/15 Dia da proclamação da República
+12/25 Natal
+
+#endif
diff --git a/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.mcommemorative b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.mcommemorative
new file mode 100644
index 0000000..b3eb732
--- /dev/null
+++ b/usr.bin/calendar/calendars/pt_BR.UTF-8/calendar.mcommemorative
@@ -0,0 +1,22 @@
+/*
+ * $FreeBSD$
+ *
+ * Originally submitted by Renato Tambellini <rtsanch@gmail.com>
+ *
+ * Brazilian mobile commemorative days
+ *
+ * http://www.novomilenio.inf.br/porto/mapas/nmcalenp.htm
+ */
+
+#ifndef _pt_BR_UTF_8_mcommemorative_
+#define _pt_BR_UTF_8_mcommemorative_
+
+LANG=pt_BR.UTF-8
+
+Easter-47 Carnaval
+Easter-7 Domingo de Ramos
+Easter-2 Sexta-feira Santa
+Easter Páscoa
+Easter+60 Corpus Christi
+
+#endif
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all
new file mode 100644
index 0000000..c7d1cfa
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all
@@ -0,0 +1,16 @@
+/*
+ * òÕÓÓËÉÊ ËÁÌÅÎÄÁÒØ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_all_
+#define _ru_RU_KOI8_R_all_
+
+#include <ru_RU.KOI8-R/calendar.common>
+#include <ru_RU.KOI8-R/calendar.holiday>
+#include <ru_RU.KOI8-R/calendar.military>
+#include <ru_RU.KOI8-R/calendar.orthodox>
+#include <ru_RU.KOI8-R/calendar.pagan>
+
+#endif /* !_ru_RU_KOI8_R_all_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
new file mode 100644
index 0000000..8367d42
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
@@ -0,0 +1,105 @@
+/*
+ * òÏÓÓÉÊÓËÉÅ ÐÒÁÚÄÎÉËÉ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_common_
+#define _ru_RU_KOI8_R_common_
+
+LANG=ru_RU.KOI8-R
+
+12 ÑÎ× äÅÎØ ÒÁÂÏÔÎÉËÁ ÐÒÏËÕÒÁÔÕÒÙ
+13 ÑÎ× äÅÎØ ÒÏÓÓÉÊÓËÏÊ ÐÅÞÁÔÉ
+14 ÑÎ× óÔÁÒÙÊ îÏ×ÙÊ ÇÏÄ
+21 ÑÎ× äÅÎØ ÉÎÖÅÎÅÒÎÙÈ ×ÏÊÓË
+25 ÑÎ× ôÁÔØÑÎÉÎ ÄÅÎØ. óÔÕÄÅÎÞÅÓËÉÊ ÐÒÁÚÄÎÉË
+ 8 ÆÅ× äÅÎØ ÒÏÓÓÉÊÓËÏÊ ÎÁÕËÉ
+10 ÆÅ× äÅÎØ ÄÉÐÌÏÍÁÔÉÞÅÓËÏÇÏ ÒÁÂÏÔÎÉËÁ
+ 1 ÍÁÒ ÷ÓÅÍÉÒÎÙÊ ÄÅÎØ ÇÒÁÖÄÁÎÓËÏÊ ÏÂÏÒÏÎÙ
+03/SunSecond äÅÎØ ÒÁÂÏÔÎÉËÏ× ÇÅÏÄÅÚÉÉ É ËÁÒÔÏÇÒÁÆÉÉ
+11 ÍÁÒ äÅÎØ ÒÁÂÏÔÎÉËÁ ÏÒÇÁÎÏ× ÎÁÒËÏËÏÎÔÒÏÌÑ
+18 ÍÁÒ äÅÎØ ÎÁÌÏÇÏ×ÏÊ ÐÏÌÉÃÉÉ
+03/SunThird äÅÎØ ÒÁÂÏÔÎÉËÏ× ÔÏÒÇÏ×ÌÉ, ÂÙÔÏ×ÏÇÏ ÏÂÓÌÕÖÉ×ÁÎÉÑ ÎÁÓÅÌÅÎÉÑ É ÖÉÌÉÝÎÏ-ËÏÍÍÕÎÁÌØÎÏÇÏ ÈÏÚÑÊÓÔ×Á
+27 ÍÁÒ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ÔÅÁÔÒÁ
+27 ÍÁÒ äÅÎØ ×ÎÕÔÒÅÎÎÉÈ ×ÏÊÓË
+ 1 ÁÐÒ äÅÎØ ÓÍÅÈÁ
+ 2 ÁÐÒ äÅÎØ ÅÄÉÎÅÎÉÑ ÎÁÒÏÄÏ×
+04/SunFirst äÅÎØ ÇÅÏÌÏÇÁ
+12 ÁÐÒ äÅÎØ ËÏÓÍÏÎÁ×ÔÉËÉ
+04/SunSecond äÅÎØ ×ÏÊÓË ÐÒÏÔÉ×Ï×ÏÚÄÕÛÎÏÊ ÏÂÏÒÏÎÙ
+26 ÁÐÒ äÅÎØ ÐÁÍÑÔÉ ÐÏÇÉÂÛÉÈ × ÒÁÄÉÁÃÉÏÎÎÙÈ Á×ÁÒÉÑÈ É ËÁÔÁÓÔÒÏÆÁÈ
+30 ÁÐÒ äÅÎØ ÐÏÖÁÒÎÏÊ ÏÈÒÁÎÙ
+ 7 ÍÁÊ äÅÎØ ÒÁÄÉÏ
+17 ÍÁÊ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ÔÅÌÅËÏÍÍÕÎÉËÁÃÉÊ
+18 ÍÁÊ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ÍÕÚÅÅ×
+24 ÍÁÊ äÅÎØ ÓÌÁ×ÑÎÓËÏÊ ÐÉÓØÍÅÎÎÏÓÔÉ É ËÕÌØÔÕÒÙ
+26 ÍÁÊ äÅÎØ ÒÏÓÓÉÊÓËÏÇÏ ÐÒÅÄÐÒÉÎÉÍÁÔÅÌØÓÔ×Á
+27 ÍÁÊ ïÂÝÅÒÏÓÓÉÊÓËÉÊ ÄÅÎØ ÂÉÂÌÉÏÔÅË
+28 ÍÁÊ äÅÎØ ÐÏÇÒÁÎÉÞÎÉËÁ
+30 ÍÁÊ äÅÎØ ÐÏÖÁÒÎÏÊ ÏÈÒÁÎÙ
+31 ÍÁÊ äÅÎØ òÏÓÓÉÊÓËÏÊ áÄ×ÏËÁÔÕÒÙ
+05/SunLast äÅÎØ ÈÉÍÉËÁ
+ 1 ÉÀÎ äÅÎØ ÚÁÝÉÔÙ ÄÅÔÅÊ
+ 5 ÉÀÎ äÅÎØ ÜËÏÌÏÇÁ
+ 6 ÉÀÎ ðÕÛËÉÎÓËÉÊ ÄÅÎØ
+ 8 ÉÀÎ äÅÎØ ÓÏÃÉÁÌØÎÏÇÏ ÒÁÂÏÔÎÉËÁ
+06/SunSecond äÅÎØ ÒÁÂÏÔÎÉËÏ× ÌÅÇËÏÊ ÐÒÏÍÙÛÌÅÎÎÏÓÔÉ
+06/SunThird äÅÎØ ÍÅÄÉÃÉÎÓËÏÇÏ ÒÁÂÏÔÎÉËÁ
+22 ÉÀÎ äÅÎØ ÐÁÍÑÔÉ É ÓËÏÒÂÉ (îÁÞÁÌÏ ÷ÅÌÉËÏÊ ïÔÅÞÅÓÔ×ÅÎÎÏÊ ÷ÏÊÎÙ, 1941 ÇÏÄ)
+27 ÉÀÎ äÅÎØ ÍÏÌÏÄÅÖÉ
+29 ÉÀÎ äÅÎØ ÐÁÒÔÉÚÁÎ É ÐÏÄÐÏÌØÝÉËÏ×
+06/SatLast äÅÎØ ÉÚÏÂÒÅÔÁÔÅÌÑ É ÒÁÃÉÏÎÁÌÉÚÁÔÏÒÁ
+07/SunFirst äÅÎØ ÒÁÂÏÔÎÉËÏ× ÍÏÒÓËÏÇÏ É ÒÅÞÎÏÇÏ ÆÌÏÔÁ
+07/SunSecond äÅÎØ ÒÙÂÁËÁ
+07/SunSecond äÅÎØ ÒÏÓÓÉÊÓËÏÊ ÐÏÞÔÙ
+07/SunThird äÅÎØ ÍÅÔÁÌÌÕÒÇÁ
+07/SunLast äÅÎØ ÷ÏÅÎÎÏ-íÏÒÓËÏÇÏ æÌÏÔÁ
+28 ÉÀÌ äÅÎØ ËÒÅÝÅÎÉÑ òÕÓÉ
+ 6 Á×Ç äÅÎØ ÖÅÌÅÚÎÏÄÏÒÏÖÎÙÈ ×ÏÊÓË
+08/SunFirst äÅÎØ ÖÅÌÅÚÎÏÄÏÒÏÖÎÉËÁ
+12 Á×Ç äÅÎØ ×ÏÅÎÎÏ-×ÏÚÄÕÛÎÙÈ ÓÉÌ
+08/SunSecond äÅÎØ ÓÔÒÏÉÔÅÌÑ
+08/SunThird äÅÎØ ÷ÏÚÄÕÛÎÏÇÏ æÌÏÔÁ
+22 Á×Ç äÅÎØ ÇÏÓÕÄÁÒÓÔ×ÅÎÎÏÇÏ ÆÌÁÇÁ
+27 Á×Ç äÅÎØ ËÉÎÏ
+08/SunLast äÅÎØ ÛÁÈÔÅÒÁ
+ 1 ÓÅÎ äÅÎØ ÚÎÁÎÉÊ
+ 2 ÓÅÎ äÅÎØ ÒÏÓÓÉÊÓËÏÊ Ç×ÁÒÄÉÉ
+ 3 ÓÅÎ äÅÎØ ÓÏÌÉÄÁÒÎÏÓÔÉ × ÂÏÒØÂÅ Ó ÔÅÒÒÏÒÉÚÍÏÍ
+ 4 ÓÅÎ äÅÎØ ÓÐÅÃÉÁÌÉÓÔÁ ÐÏ ÑÄÅÒÎÏÍÕ ÏÂÅÓÐÅÞÅÎÉÀ
+09/SunFirst äÅÎØ ÒÁÂÏÔÎÉËÏ× ÎÅÆÔÑÎÏÊ É ÇÁÚÏ×ÏÊ ÐÒÏÍÙÛÌÅÎÎÏÓÔÉ
+09/SunSecond äÅÎØ ÔÁÎËÉÓÔÁ
+09/SunThird äÅÎØ ÒÁÂÏÔÎÉËÏ× ÌÅÓÁ
+28 ÓÅÎ äÅÎØ ÒÁÂÏÔÎÉËÁ ÁÔÏÍÎÏÊ ÐÒÏÍÙÛÌÅÎÎÏÓÔÉ
+09/SunLast äÅÎØ ÍÁÛÉÎÏÓÔÒÏÉÔÅÌÑ
+ 1 ÏËÔ äÅÎØ ÐÏÖÉÌÙÈ ÌÀÄÅÊ
+ 1 ÏËÔ äÅÎØ ÓÕÈÏÐÕÔÎÙÈ ×ÏÊÓË
+ 4 ÏËÔ äÅÎØ ËÏÓÍÉÞÅÓËÉÈ ×ÏÊÓË
+ 5 ÏËÔ äÅÎØ ÕÞÉÔÅÌÑ
+14 ÏËÔ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ÓÔÁÎÄÁÒÔÉÚÁÃÉÉ
+10/SunSecond äÅÎØ ÒÁÂÏÔÎÉËÏ× ÓÅÌØÓËÏÇÏ ÈÏÚÑÊÓÔ×Á É ÐÅÒÅÒÁÂÁÔÙ×ÁÀÝÅÊ ÐÒÏÍÙÛÌÅÎÎÏÓÔÉ
+10/SunThird äÅÎØ ÒÁÂÏÔÎÉËÏ× ÄÏÒÏÖÎÏÇÏ ÈÏÚÑÊÓÔ×Á
+24 ÏËÔ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ïïî
+25 ÏËÔ äÅÎØ ÔÁÍÏÖÅÎÎÉËÁ
+30 ÏËÔ äÅÎØ ÐÁÍÑÔÉ ÖÅÒÔ× ÐÏÌÉÔÉÞÅÓËÉÈ ÒÅÐÒÅÓÓÉÊ
+10/SunLast äÅÎØ ÒÁÂÏÔÎÉËÏ× Á×ÔÏÍÏÂÉÌØÎÏÇÏ ÔÒÁÎÓÐÏÒÔÁ
+ 7 ÎÏÑ äÅÎØ ÏËÔÑÂÒØÓËÏÊ ÒÅ×ÏÌÀÃÉÉ 1917 ÇÏÄÁ
+ 9 ÎÏÑ ÷ÓÅÍÉÒÎÙÊ ÄÅÎØ ËÁÞÅÓÔ×Á
+10 ÎÏÑ äÅÎØ ÍÉÌÉÃÉÉ
+16 ÎÏÑ äÅÎØ ÍÏÒÓËÏÊ ÐÅÈÏÔÙ
+17 ÎÏÑ íÅÖÄÕÎÁÒÏÄÎÙÊ ÄÅÎØ ÓÔÕÄÅÎÔÏ×
+19 ÎÏÑ äÅÎØ ÒÁËÅÔÎÙÈ ×ÏÊÓË É ÁÒÔÉÌÌÅÒÉÉ
+21 ÎÏÑ äÅÎØ ÒÁÂÏÔÎÉËÏ× ÎÁÌÏÇÏ×ÙÈ ÏÒÇÁÎÏ×
+26 ÎÏÑ ÷ÓÅÍÉÒÎÙÊ ÄÅÎØ ÉÎÆÏÒÍÁÃÉÉ
+11/SunLast äÅÎØ ÍÁÔÅÒÉ
+ 1 ÄÅË ÷ÓÅÍÉÒÎÙÊ ÄÅÎØ ÂÏÒØÂÙ ÓÏ óðéäÏÍ
+ 3 ÄÅË äÅÎØ ÀÒÉÓÔÁ
+ 9 ÄÅË äÅÎØ çÅÒÏÅ× ïÔÅÞÅÓÔ×Á
+12 ÄÅË äÅÎØ ëÏÎÓÔÉÔÕÃÉÉ
+17 ÄÅË äÅÎØ ÒÁËÅÔÎÙÈ ×ÏÊÓË ÓÔÒÁÔÅÇÉÞÅÓËÏÇÏ ÎÁÚÎÁÞÅÎÉÑ
+20 ÄÅË äÅÎØ ÒÁÂÏÔÎÉËÁ ÏÒÇÁÎÏ× ÂÅÚÏÐÁÓÎÏÓÔÉ
+22 ÄÅË äÅÎØ ÜÎÅÒÇÅÔÉËÁ
+27 ÄÅË äÅÎØ ÓÐÁÓÁÔÅÌÑ
+
+#endif /* !_ru_RU_KOI8_R_common_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday
new file mode 100644
index 0000000..c062b57
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday
@@ -0,0 +1,25 @@
+/*
+ * òÏÓÓÉÊÓËÉÅ ÐÒÁÚÄÎÉËÉ (ÎÅÒÁÂÏÞÉÅ "ËÒÁÓÎÙÅ" ÄÎÉ)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_holiday_
+#define _ru_RU_KOI8_R_holiday_
+
+LANG=ru_RU.KOI8-R
+
+ 1 ÑÎ× îÏ×ÙÊ ÇÏÄ
+ 2 ÑÎ× îÏ×ÏÇÏÄÎÉÅ ËÁÎÉËÕÌÙ
+ 3 ÑÎ× îÏ×ÏÇÏÄÎÉÅ ËÁÎÉËÕÌÙ
+ 4 ÑÎ× îÏ×ÏÇÏÄÎÉÅ ËÁÎÉËÕÌÙ
+ 5 ÑÎ× îÏ×ÏÇÏÄÎÉÅ ËÁÎÉËÕÌÙ
+ 7 ÑÎ× òÏÖÄÅÓÔ×Ï èÒÉÓÔÏ×Ï
+23 ÆÅ× äÅÎØ ÚÁÝÉÔÎÉËÁ ïÔÅÞÅÓÔ×Á
+ 8 ÍÁÒ íÅÖÄÕÎÁÒÏÄÎÙÊ ÖÅÎÓËÉÊ ÄÅÎØ
+ 1 ÍÁÊ ðÒÁÚÄÎÉË ÷ÅÓÎÙ É ôÒÕÄÁ
+ 9 ÍÁÊ äÅÎØ ðÏÂÅÄÙ
+12 ÉÀÎ äÅÎØ òÏÓÓÉÉ
+ 4 ÎÏÑ äÅÎØ ÎÁÒÏÄÎÏÇÏ ÅÄÉÎÓÔ×Á
+
+#endif /* !_ru_RU_KOI8_R_holiday_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military
new file mode 100644
index 0000000..5188fc0
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military
@@ -0,0 +1,28 @@
+/*
+ * äÎÉ ×ÏÉÎÓËÏÊ ÓÌÁ×Ù òÏÓÓÉÉ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_military_
+#define _ru_RU_KOI8_R_military_
+
+LANG=ru_RU.KOI8-R
+
+27 ÑÎ× äÅÎØ ÓÎÑÔÉÑ ÂÌÏËÁÄÙ ÇÏÒÏÄÁ ìÅÎÉÎÇÒÁÄÁ (1944 ÇÏÄ)
+ 2 ÆÅ× äÅÎØ ÒÁÚÇÒÏÍÁ ÓÏ×ÅÔÓËÉÍÉ ×ÏÊÓËÁÍÉ ÎÅÍÅÃËÏ-ÆÁÛÉÓÔÓËÉÈ ×ÏÊÓË × óÔÁÌÉÎÇÒÁÄÓËÏÊ ÂÉÔ×Å (1943 ÇÏÄ)
+23 ÆÅ× äÅÎØ ÐÏÂÅÄÙ ëÒÁÓÎÏÊ áÒÍÉÉ ÎÁÄ ËÁÊÚÅÒÏ×ÓËÉÍÉ ×ÏÊÓËÁÍÉ çÅÒÍÁÎÉÉ (1918 ÇÏÄ)
+18 ÁÐÒ äÅÎØ ÐÏÂÅÄÙ ÒÕÓÓËÉÈ ×ÏÉÎÏ× ËÎÑÚÑ áÌÅËÓÁÎÄÒÁ îÅ×ÓËÏÇÏ ÎÁÄ ÎÅÍÅÃËÉÍÉ ÒÙÃÁÒÑÍÉ ÎÁ þÕÄÓËÏÍ ÏÚÅÒÅ (ìÅÄÏ×ÏÅ ÐÏÂÏÉÝÅ, 1242 ÇÏÄ)
+10 ÉÀÌ äÅÎØ ÐÏÂÅÄÙ ÒÕÓÓËÏÊ ÁÒÍÉÉ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ ðÅÔÒÁ ðÅÒ×ÏÇÏ ÎÁÄ Û×ÅÄÁÍÉ × ðÏÌÔÁ×ÓËÏÍ ÓÒÁÖÅÎÉÉ (1709 ÇÏÄ)
+ 9 Á×Ç äÅÎØ ÐÅÒ×ÏÊ × ÒÏÓÓÉÊÓËÏÊ ÉÓÔÏÒÉÉ ÍÏÒÓËÏÊ ÐÏÂÅÄÙ ÒÕÓÓËÏÇÏ ÆÌÏÔÁ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ ðÅÔÒÁ ðÅÒ×ÏÇÏ ÎÁÄ Û×ÅÄÁÍÉ Õ ÍÙÓÁ çÁÎÇÕÔ (1714 ÇÏÄ)
+23 Á×Ç äÅÎØ ÒÁÚÇÒÏÍÁ ÓÏ×ÅÔÓËÉÍÉ ×ÏÊÓËÁÍÉ ÎÅÍÅÃËÏ-ÆÁÛÉÓÔÓËÉÈ ×ÏÊÓË × ëÕÒÓËÏÊ ÂÉÔ×Å (1943 ÇÏÄ)
+ 2 ÓÅÎ äÅÎØ ÏËÏÎÞÁÎÉÑ ÷ÔÏÒÏÊ ÍÉÒÏ×ÏÊ ×ÏÊÎÙ (1945 ÇÏÄ)
+ 8 ÓÅÎ äÅÎØ âÏÒÏÄÉÎÓËÏÇÏ ÓÒÁÖÅÎÉÑ ÒÕÓÓËÏÊ ÁÒÍÉÉ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ í.é. ëÕÔÕÚÏ×Á Ó ÆÒÁÎÃÕÚÓËÏÊ ÁÒÍÉÅÊ (1812 ÇÏÄ)
+11 ÓÅÎ äÅÎØ ÐÏÂÅÄÙ ÒÕÓÓËÏÊ ÜÓËÁÄÒÙ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ æ.æ. õÛÁËÏ×Á ÎÁÄ ÔÕÒÅÃËÏÊ ÜÓËÁÄÒÏÊ Õ ÍÙÓÁ ôÅÎÄÒÁ (1790 ÇÏÄ)
+21 ÓÅÎ äÅÎØ ÐÏÂÅÄÙ ÒÕÓÓËÉÈ ÐÏÌËÏ× ×Ï ÇÌÁ×Å Ó ×ÅÌÉËÉÍ ËÎÑÚÅÍ äÍÉÔÒÉÅÍ äÏÎÓËÉÍ ÎÁÄ ÍÏÎÇÏÌÏ-ÔÁÔÁÒÓËÉÍÉ ×ÏÊÓËÁÍÉ × ëÕÌÉËÏ×ÓËÏÊ ÂÉÔ×Å (1380 ÇÏÄ)
+ 7 ÎÏÑ äÅÎØ ÏÓ×ÏÂÏÖÄÅÎÉÑ íÏÓË×Ù ÓÉÌÁÍÉ ÎÁÒÏÄÎÏÇÏ ÏÐÏÌÞÅÎÉÑ ÐÏÄ ÒÕËÏ×ÏÄÓÔ×ÏÍ ëÕÚØÍÙ íÉÎÉÎÁ É äÍÉÔÒÉÑ ðÏÖÁÒÓËÏÇÏ ÏÔ ÐÏÌØÓËÉÈ ÉÎÔÅÒ×ÅÎÔÏ× (1612 ÇÏÄ)
+ 1 ÄÅË äÅÎØ ÐÏÂÅÄÙ ÒÕÓÓËÏÊ ÜÓËÁÄÒÙ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ ð.ó. îÁÈÉÍÏ×Á ÎÁÄ ÔÕÒÅÃËÏÊ ÜÓËÁÄÒÏÊ Õ ÍÙÓÁ óÉÎÏÐ (1853 ÇÏÄ)
+ 5 ÄÅË äÅÎØ ÎÁÞÁÌÁ ËÏÎÔÒÎÁÓÔÕÐÌÅÎÉÑ ÓÏ×ÅÔÓËÉÈ ×ÏÊÓË ÐÒÏÔÉ× ÎÅÍÅÃËÏ-ÆÁÛÉÓÔÓËÉÈ ×ÏÊÓË × ÂÉÔ×Å ÐÏÄ íÏÓË×ÏÊ (1941 ÇÏÄ)
+24 ÄÅË äÅÎØ ×ÚÑÔÉÑ ÔÕÒÅÃËÏÊ ËÒÅÐÏÓÔÉ éÚÍÁÉÌ ÒÕÓÓËÉÍÉ ×ÏÊÓËÁÍÉ ÐÏÄ ËÏÍÁÎÄÏ×ÁÎÉÅÍ á.÷. óÕ×ÏÒÏ×Á (1790 ÇÏÄ)
+
+#endif /* !_ru_RU_KOI8_R_military_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox
new file mode 100644
index 0000000..83d1710
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox
@@ -0,0 +1,36 @@
+/*
+ * ðÒÁ×ÏÓÌÁ×ÎÙÅ ÐÒÁÚÄÎÉËÉ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_orthodox_
+#define _ru_RU_KOI8_R_orthodox_
+
+LANG=ru_RU.KOI8-R
+Paskha=ðÁÓÈÁ
+
+21 ÓÅÎ òÏÖÄÅÓÔ×Ï ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ
+27 ÓÅÎ ÷ÏÚÄ×ÉÖÅÎÉÅ ëÒÅÓÔÁ çÏÓÐÏÄÎÑ
+14 ÏËÔ ðÏËÒÏ× ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ
+ 4 ÄÅË ÷×ÅÄÅÎÉÅ ×Ï ÈÒÁÍ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ
+ 7 ÑÎ× òÏÖÄÅÓÔ×Ï èÒÉÓÔÏ×Ï
+14 ÑÎ× ïÂÒÅÚÁÎÉÅ çÏÓÐÏÄÎÅ
+19 ÑÎ× âÏÇÏÑ×ÌÅÎÉÅ ÉÌÉ ëÒÅÝÅÎÉÅ çÏÓÐÏÄÎÅ
+15 ÆÅ× óÒÅÔÅÎÉÅ çÏÓÐÏÄÎÅ
+ðÁÓÈÁ-48 ÷ÅÌÉËÉÊ ðÏÓÔ
+ðÁÓÈÁ-7 ÷ÈÏÄ çÏÓÐÏÄÅÎØ × éÅÒÕÓÁÌÉÍ. ÷ÅÒÂÎÏÅ ÷ÏÓËÒÅÓÅÎØÅ
+ðÁÓÈÁ-3 ÷ÅÌÉËÉÊ þÅÔ×ÅÒÇ
+ðÁÓÈÁ-2 óÔÒÁÓÔÎÁÑ ðÑÔÎÉÃÁ
+ðÁÓÈÁ ÷ÏÓËÒÅÓÅÎÉÅ èÒÉÓÔÏ×Ï
+ðÁÓÈÁ+39 ÷ÏÚÎÅÓÅÎÉÅ
+ðÁÓÈÁ+49 äÅÎØ ó×ÑÔÏÊ ôÒÏÉÃÙ. ðÑÔÉÄÅÓÑÔÎÉÃÁ
+ 7 ÁÐÒ âÌÁÇÏ×ÅÝÅÎÉÅ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ
+ 7 ÉÀÌ òÏÖÄÅÓÔ×Ï éÏÁÎÎÁ ðÒÅÄÔÅÞÉ
+12 ÉÀÌ äÅÎØ Ó×ÑÔÙÈ ÐÅÒ×Ï×ÅÒÈÏ×ÎÙÈ ÁÐÏÓÔÏÌÏ× ðÅÔÒÁ É ðÁ×ÌÁ
+19 Á×Ç ðÒÅÏÂÒÁÖÅÎÉÅ çÏÓÐÏÄÎÅ
+28 Á×Ç õÓÐÅÎÉÅ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ
+11 ÓÅÎ õÓÅËÎÏ×ÅÎÉÅ ÇÌÁ×Ù éÏÁÎÎÁ ðÒÅÄÔÅÞÉ
+
+#endif /* !_ru_RU_KOI8_R_orthodox_ */
+
diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan
new file mode 100644
index 0000000..f2fc4e0
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan
@@ -0,0 +1,42 @@
+/*
+ * ñÚÙÞÅÓËÉÅ ÐÒÁÚÄÎÉËÉ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_KOI8_R_pagan_
+#define _ru_RU_KOI8_R_pagan_
+
+LANG=ru_RU.KOI8-R
+Paskha=ðÁÓÈÁ
+
+21 ÄÅË* úÉÍÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ
+25 ÄÅË ëÏÌÑÄÁ (ÓÄ×ÉÎÕÔÏÅ ÚÉÍÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ)
+ 6 ÑÎ× äÅÎØ ëÁÝÅÑ É ÷ÅÌÅÓÁ
+24 ÆÅ× äÅÎØ ÷ÅÌÅÓÁ
+29 ÆÅ× äÅÎØ ëÁÝÅÑ
+ 1 ÍÁÒ äÅÎØ íÁÒÅÎÙ
+14 ÍÁÒ îÏ×ÙÊ çÏÄ, ï×ÓÅÎØ ÍÁÌÙÊ
+ðÁÓÈÁ-55 íÁÓÌÅÎÉÃÁ
+ðÁÓÈÁ+7 ëÒÁÓÎÁÑ çÏÒËÁ
+ðÁÓÈÁ+16 òÁÄÕÎÉÃÁ
+20 ÍÁÒ* ÷ÅÓÅÎÎÉÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ
+ 7 ÁÐÒ äÅÎØ íÁÒÅÎÙ (ÓÄ×ÉÎÕÔÏÅ ×ÅÓÅÎÎÅÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ)
+ 6 ÍÁÊ äÅÎØ äÁÖØÂÏÇÁ, ï×ÓÅÎØ ÂÏÌØÛÏÊ
+22 ÍÁÊ ñÒÉÌÉÎ äÅÎØ
+15 ÉÀÎ äÅÎØ ôÒÉÇÌÁ×Á
+21 ÉÀÎ* ìÅÔÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ
+ 1 ÉÀÌ òÕÓÁÌØÎÁÑ îÅÄÅÌÑ
+ 7 ÉÀÌ ëÕÐÁÌÁ (ÓÄ×ÉÎÕÔÏÅ ÌÅÔÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ)
+27 ÉÀÌ ïÔÂÏÒ ÖÅÒÔ× ðÅÒÕÎÕ, ÒÕÓÁÌÉÉ
+ 2 Á×Ç ðÅÒÕÎÏ× äÅÎØ
+21 Á×Ç äÅÎØ óÔÒÉÂÏÇÁ
+28 Á×Ç õÓÐÅÎÉÅ úÌÁÔÏÇÏÒËÉ
+14 ÓÅÎ äÅÎØ ÷ÏÌÈÁ úÍÅÅ×ÉÞÁ
+22 ÓÅÎ* ðÏ×ÏÒÏÔ Ë ÚÉÍÅ (ÏÓÅÎÎÅÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ)
+10 ÎÏÑ äÅÎØ íÁËÏÛÉ
+21 ÎÏÑ äÅÎØ ó×ÁÒÏÇÁ É óÅÍÁÒÇÌÁ
+ 9 ÄÅË äÅÎØ äÁÖØÂÏÇÁ É íÁÒÅÎÙ
+
+#endif /* !_ru_RU_KOI8_R_pagan_ */
+
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.all b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.all
new file mode 100644
index 0000000..038bfb0
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.all
@@ -0,0 +1,16 @@
+/*
+ * РуÑÑкий календарь
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_all_
+#define _ru_RU_UTF_8_all_
+
+#include <ru_RU.UTF-8/calendar.common>
+#include <ru_RU.UTF-8/calendar.holiday>
+#include <ru_RU.UTF-8/calendar.military>
+#include <ru_RU.UTF-8/calendar.orthodox>
+#include <ru_RU.UTF-8/calendar.pagan>
+
+#endif /* !_ru_RU_UTF_8_all_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common
new file mode 100644
index 0000000..8c0a823
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common
@@ -0,0 +1,105 @@
+/*
+ * РоÑÑийÑкие праздники
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_common_
+#define _ru_RU_UTF_8_common_
+
+LANG=ru_RU.UTF-8
+
+12 Ñнв День работника прокуратуры
+13 Ñнв День роÑÑийÑкой печати
+14 Ñнв Старый Ðовый год
+21 Ñнв День инженерных войÑк
+25 Ñнв ТатьÑнин день. СтуденчеÑкий праздник
+ 8 фев День роÑÑийÑкой науки
+10 фев День дипломатичеÑкого работника
+ 1 мар Ð’Ñемирный день гражданÑкой обороны
+03/SunSecond День работников геодезии и картографии
+11 мар День работника органов наркоконтролÑ
+18 мар День налоговой полиции
+03/SunThird День работников торговли, бытового обÑÐ»ÑƒÐ¶Ð¸Ð²Ð°Ð½Ð¸Ñ Ð½Ð°ÑÐµÐ»ÐµÐ½Ð¸Ñ Ð¸ жилищно-коммунального хозÑйÑтва
+27 мар Международный день театра
+27 мар День внутренних войÑк
+ 1 апр День Ñмеха
+ 2 апр День ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ð½Ð°Ñ€Ð¾Ð´Ð¾Ð²
+04/SunFirst День геолога
+12 апр День коÑмонавтики
+04/SunSecond День войÑк противовоздушной обороны
+26 апр День памÑти погибших в радиационных авариÑÑ… и катаÑтрофах
+30 апр День пожарной охраны
+ 7 май День радио
+17 май Международный день телекоммуникаций
+18 май Международный день музеев
+24 май День ÑлавÑнÑкой пиÑьменноÑти и культуры
+26 май День роÑÑийÑкого предпринимательÑтва
+27 май ОбщероÑÑийÑкий день библиотек
+28 май День пограничника
+30 май День пожарной охраны
+31 май День РоÑÑийÑкой Ðдвокатуры
+05/SunLast День химика
+ 1 июн День защиты детей
+ 5 июн День Ñколога
+ 6 июн ПушкинÑкий день
+ 8 июн День Ñоциального работника
+06/SunSecond День работников легкой промышленноÑти
+06/SunThird День медицинÑкого работника
+22 июн День памÑти и Ñкорби (Ðачало Великой ОтечеÑтвенной Войны, 1941 год)
+27 июн День молодежи
+29 июн День партизан и подпольщиков
+06/SatLast День Ð¸Ð·Ð¾Ð±Ñ€ÐµÑ‚Ð°Ñ‚ÐµÐ»Ñ Ð¸ рационализатора
+07/SunFirst День работников морÑкого и речного флота
+07/SunSecond День рыбака
+07/SunSecond День роÑÑийÑкой почты
+07/SunThird День металлурга
+07/SunLast День Военно-МорÑкого Флота
+28 июл День ÐºÑ€ÐµÑ‰ÐµÐ½Ð¸Ñ Ð ÑƒÑи
+ 6 авг День железнодорожных войÑк
+08/SunFirst День железнодорожника
+12 авг День военно-воздушных Ñил
+08/SunSecond День ÑтроителÑ
+08/SunThird День Воздушного Флота
+22 авг День гоÑударÑтвенного флага
+27 авг День кино
+08/SunLast День шахтера
+ 1 Ñен День знаний
+ 2 Ñен День роÑÑийÑкой гвардии
+ 3 Ñен День ÑолидарноÑти в борьбе Ñ Ñ‚ÐµÑ€Ñ€Ð¾Ñ€Ð¸Ð·Ð¼Ð¾Ð¼
+ 4 Ñен День ÑпециалиÑта по Ñдерному обеÑпечению
+09/SunFirst День работников нефтÑной и газовой промышленноÑти
+09/SunSecond День танкиÑта
+09/SunThird День работников леÑа
+28 Ñен День работника атомной промышленноÑти
+09/SunLast День машиноÑтроителÑ
+ 1 окт День пожилых людей
+ 1 окт День Ñухопутных войÑк
+ 4 окт День коÑмичеÑких войÑк
+ 5 окт День учителÑ
+14 окт Международный день Ñтандартизации
+10/SunSecond День работников ÑельÑкого хозÑйÑтва и перерабатывающей промышленноÑти
+10/SunThird День работников дорожного хозÑйÑтва
+24 окт Международный день ООÐ
+25 окт День таможенника
+30 окт День памÑти жертв политичеÑких репреÑÑий
+10/SunLast День работников автомобильного транÑпорта
+ 7 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ октÑбрьÑкой революции 1917 года
+ 9 Ð½Ð¾Ñ Ð’Ñемирный день качеÑтва
+10 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ милиции
+16 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ морÑкой пехоты
+17 Ð½Ð¾Ñ ÐœÐµÐ¶Ð´ÑƒÐ½Ð°Ñ€Ð¾Ð´Ð½Ñ‹Ð¹ день Ñтудентов
+19 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ ракетных войÑк и артиллерии
+21 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ работников налоговых органов
+26 Ð½Ð¾Ñ Ð’Ñемирный день информации
+11/SunLast День матери
+ 1 дек Ð’Ñемирный день борьбы Ñо СПИДом
+ 3 дек День юриÑта
+ 9 дек День Героев ОтечеÑтва
+12 дек День КонÑтитуции
+17 дек День ракетных войÑк ÑтратегичеÑкого назначениÑ
+20 дек День работника органов безопаÑноÑти
+22 дек День Ñнергетика
+27 дек День ÑпаÑателÑ
+
+#endif /* !_ru_RU_UTF_8_common_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.holiday b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.holiday
new file mode 100644
index 0000000..13a7bc0
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.holiday
@@ -0,0 +1,25 @@
+/*
+ * РоÑÑийÑкие праздники (нерабочие "краÑные" дни)
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_holiday_
+#define _ru_RU_UTF_8_holiday_
+
+LANG=ru_RU.UTF-8
+
+ 1 Ñнв Ðовый год
+ 2 Ñнв Ðовогодние каникулы
+ 3 Ñнв Ðовогодние каникулы
+ 4 Ñнв Ðовогодние каникулы
+ 5 Ñнв Ðовогодние каникулы
+ 7 Ñнв РождеÑтво ХриÑтово
+23 фев День защитника ОтечеÑтва
+ 8 мар Международный женÑкий день
+ 1 май Праздник ВеÑны и Труда
+ 9 май День Победы
+12 июн День РоÑÑии
+ 4 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ народного единÑтва
+
+#endif /* !_ru_RU_UTF_8_holiday_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military
new file mode 100644
index 0000000..48f257c
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military
@@ -0,0 +1,28 @@
+/*
+ * Дни воинÑкой Ñлавы РоÑÑии
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_military_
+#define _ru_RU_UTF_8_military_
+
+LANG=ru_RU.UTF-8
+
+27 Ñнв День ÑнÑÑ‚Ð¸Ñ Ð±Ð»Ð¾ÐºÐ°Ð´Ñ‹ города Ленинграда (1944 год)
+ 2 фев День разгрома ÑоветÑкими войÑками немецко-фашиÑÑ‚Ñких войÑк в СталинградÑкой битве (1943 год)
+23 фев День победы КраÑной Ðрмии над кайзеровÑкими войÑками Германии (1918 год)
+18 апр День победы руÑÑких воинов кнÑÐ·Ñ ÐлекÑандра ÐевÑкого над немецкими рыцарÑми на ЧудÑком озере (Ледовое побоище, 1242 год)
+10 июл День победы руÑÑкой армии под командованием Петра Первого над шведами в ПолтавÑком Ñражении (1709 год)
+ 9 авг День первой в роÑÑийÑкой иÑтории морÑкой победы руÑÑкого флота под командованием Петра Первого над шведами у мыÑа Гангут (1714 год)
+23 авг День разгрома ÑоветÑкими войÑками немецко-фашиÑÑ‚Ñких войÑк в КурÑкой битве (1943 год)
+ 2 Ñен День Ð¾ÐºÐ¾Ð½Ñ‡Ð°Ð½Ð¸Ñ Ð’Ñ‚Ð¾Ñ€Ð¾Ð¹ мировой войны (1945 год)
+ 8 Ñен День БородинÑкого ÑÑ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñ€ÑƒÑÑкой армии под командованием Ðœ.И. Кутузова Ñ Ñ„Ñ€Ð°Ð½Ñ†ÑƒÐ·Ñкой армией (1812 год)
+11 Ñен День победы руÑÑкой ÑÑкадры под командованием Ф.Ф. Ушакова над турецкой ÑÑкадрой у мыÑа Тендра (1790 год)
+21 Ñен День победы руÑÑких полков во главе Ñ Ð²ÐµÐ»Ð¸ÐºÐ¸Ð¼ кнÑзем Дмитрием ДонÑким над монголо-татарÑкими войÑками в КуликовÑкой битве (1380 год)
+ 7 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ оÑÐ²Ð¾Ð±Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ ÐœÐ¾Ñквы Ñилами народного Ð¾Ð¿Ð¾Ð»Ñ‡ÐµÐ½Ð¸Ñ Ð¿Ð¾Ð´ руководÑтвом Кузьмы Минина и Ð”Ð¼Ð¸Ñ‚Ñ€Ð¸Ñ ÐŸÐ¾Ð¶Ð°Ñ€Ñкого от польÑких интервентов (1612 год)
+ 1 дек День победы руÑÑкой ÑÑкадры под командованием П.С. Ðахимова над турецкой ÑÑкадрой у мыÑа Синоп (1853 год)
+ 5 дек День начала контрнаÑÑ‚ÑƒÐ¿Ð»ÐµÐ½Ð¸Ñ ÑоветÑких войÑк против немецко-фашиÑÑ‚Ñких войÑк в битве под МоÑквой (1941 год)
+24 дек День взÑÑ‚Ð¸Ñ Ñ‚ÑƒÑ€ÐµÑ†ÐºÐ¾Ð¹ крепоÑти Измаил руÑÑкими войÑками под командованием Ð.Ð’. Суворова (1790 год)
+
+#endif /* !_ru_RU_UTF_8_military_ */
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.orthodox b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.orthodox
new file mode 100644
index 0000000..f42c6ae
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.orthodox
@@ -0,0 +1,36 @@
+/*
+ * ПравоÑлавные праздники
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_orthodox_
+#define _ru_RU_UTF_8_orthodox_
+
+LANG=ru_RU.UTF-8
+Paskha=ПаÑха
+
+21 Ñен РождеÑтво ПреÑвÑтой Богородицы
+27 Ñен Воздвижение КреÑта ГоÑподнÑ
+14 окт Покров ПреÑвÑтой Богородицы
+ 4 дек Введение во храм ПреÑвÑтой Богородицы
+ 7 Ñнв РождеÑтво ХриÑтово
+14 Ñнв Обрезание ГоÑподне
+19 Ñнв БогоÑвление или Крещение ГоÑподне
+15 фев Сретение ГоÑподне
+ПаÑха-48 Великий ПоÑÑ‚
+ПаÑха-7 Вход ГоÑподень в ИеруÑалим. Вербное ВоÑкреÑенье
+ПаÑха-3 Великий Четверг
+ПаÑха-2 СтраÑÑ‚Ð½Ð°Ñ ÐŸÑтница
+ПаÑха ВоÑкреÑение ХриÑтово
+ПаÑха+39 ВознеÑение
+ПаÑха+49 День СвÑтой Троицы. ПÑтидеÑÑтница
+ 7 апр Благовещение ПреÑвÑтой Богородицы
+ 7 июл РождеÑтво Иоанна Предтечи
+12 июл День ÑвÑÑ‚Ñ‹Ñ… первоверховных апоÑтолов Петра и Павла
+19 авг Преображение ГоÑподне
+28 авг УÑпение ПреÑвÑтой Богородицы
+11 Ñен УÑекновение главы Иоанна Предтечи
+
+#endif /* !_ru_RU_UTF_8_orthodox_ */
+
diff --git a/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan
new file mode 100644
index 0000000..144a649
--- /dev/null
+++ b/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan
@@ -0,0 +1,42 @@
+/*
+ * ЯзычеÑкие праздники
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ru_RU_UTF_8_pagan_
+#define _ru_RU_UTF_8_pagan_
+
+LANG=ru_RU.UTF-8
+Paskha=ПаÑха
+
+21 дек* Зимнее ÑолнцеÑтоÑние
+25 дек КолÑда (Ñдвинутое зимнее ÑолнцеÑтоÑние)
+ 6 Ñнв День ÐšÐ°Ñ‰ÐµÑ Ð¸ ВелеÑа
+24 фев День ВелеÑа
+29 фев День КащеÑ
+ 1 мар День Марены
+14 мар Ðовый Год, ОвÑень малый
+ПаÑха-55 МаÑленица
+ПаÑха+7 КраÑÐ½Ð°Ñ Ð“Ð¾Ñ€ÐºÐ°
+ПаÑха+16 Радуница
+20 мар* ВеÑенние равноденÑтвие
+ 7 апр День Марены (Ñдвинутое веÑеннее равноденÑтвие)
+ 6 май День Дажьбога, ОвÑень большой
+22 май Ярилин День
+15 июн День Триглава
+21 июн* Летнее ÑолнцеÑтоÑние
+ 1 июл РуÑÐ°Ð»ÑŒÐ½Ð°Ñ ÐеделÑ
+ 7 июл Купала (Ñдвинутое летнее ÑолнцеÑтоÑние)
+27 июл Отбор жертв Перуну, руÑалии
+ 2 авг Перунов День
+21 авг День Стрибога
+28 авг УÑпение Златогорки
+14 Ñен День Волха Змеевича
+22 Ñен* Поворот к зиме (оÑеннее равноденÑтвие)
+10 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ Макоши
+21 Ð½Ð¾Ñ Ð”ÐµÐ½ÑŒ Сварога и Семаргла
+ 9 дек День Дажьбога и Марены
+
+#endif /* !_ru_RU_UTF_8_pagan_ */
+
diff --git a/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.all b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.all
new file mode 100644
index 0000000..1dfa262
--- /dev/null
+++ b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.all
@@ -0,0 +1,14 @@
+/*
+ * õËÒÁ§ÎÓØËÉÊ ËÁÌÅÎÄÁÒ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _uk_UA_KOI8_U_all_
+#define _uk_UA_KOI8_U_all_
+
+#include <uk_UA.KOI8-U/calendar.holiday>
+#include <uk_UA.KOI8-U/calendar.orthodox>
+#include <uk_UA.KOI8-U/calendar.misc>
+
+#endif /* !_uk_UA_KOI8_U_all_ */
diff --git a/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.holiday b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.holiday
new file mode 100644
index 0000000..08559d8
--- /dev/null
+++ b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.holiday
@@ -0,0 +1,22 @@
+/*
+ * õËÒÁ§ÎÓØ˦ ÄÅÒÖÁ×Φ Ó×ÑÔÁ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _uk_UA_KOI8_U_holiday_
+#define _uk_UA_KOI8_U_holiday_
+
+LANG=uk_UA.KOI8-U
+Paskha=÷ÅÌÉËÄÅÎØ
+
+ó¦Þ 01 îÏ×ÉÊ ò¦Ë
+ó¦Þ 07 ò¦ÚÄ×Ï èÒÉÓÔÏ×Å
+âÅÒ 08 8 âÅÒÅÚÎÑ - í¦ÖÎÁÒÏÄÎÉÊ ö¦ÎÏÞÉÊ äÅÎØ
+ôÒÁ 01 1 ôÒÁ×ÎÑ - äÅÎØ ðÒÁæ
+ôÒÁ 09 äÅÎØ ðÅÒÅÍÏÇÉ
+÷ÅÌÉËÄÅÎØ+49 ôÒ¦ÊÃÑ
+þÅÒ 28 äÅÎØ ëÏÎÓÔÉÔÕæ§ õËÒÁ§ÎÉ
+óÅÒ 24 äÅÎØ îÅÚÁÌÅÖÎÏÓÔ¦ õËÒÁ§ÎÉ
+
+#endif /* !_uk_UA_KOI8_U_holiday_ */
diff --git a/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.misc b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.misc
new file mode 100644
index 0000000..b49769d
--- /dev/null
+++ b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.misc
@@ -0,0 +1,18 @@
+/*
+ * ¶ÎÛ¦ æËÁצ ÄÁÔÉ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _uk_UA_KOI8_U_misc_
+#define _uk_UA_KOI8_U_misc_
+
+LANG=uk_UA.KOI8-U
+
+/* ðÏÓÔÁÎÏ×Á ëÁ¦ÎÅÔÕ í¦Î¦ÓÔÒ¦× õËÒÁ§ÎÉ ×¦Ä 13 ÔÒÁ×ÎÑ 1996 Ò. N 509
+ * "ðÒÏ ÐÏÒÑÄÏË ÏÂÞÉÓÌÅÎÎÑ ÞÁÓÕ ÎÁ ÔÅÒÉÔÏÒ¦§ õËÒÁ§ÎÉ"
+ */
+âÅÒ îÄ-1 ðÅÒÅÈ¦Ä ÎÁ ̦ÔÎ¦Ê ÞÁÓ (ÏÓÔÁÎÎÑ ÎÅĦÌÑ ÂÅÒÅÚÎÑ)
+öÏ× îÄ-1 ðÅÒÅÈ¦Ä ÎÁ ÚÉÍÏ×ÉÊ ÞÁÓ (ÏÓÔÁÎÎÑ ÎÅĦÌÑ ÖÏ×ÔÎÑ)
+
+#endif /* !_uk_UA_KOI8_U_misc_ */
diff --git a/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.orthodox b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.orthodox
new file mode 100644
index 0000000..797c8c1
--- /dev/null
+++ b/usr.bin/calendar/calendars/uk_UA.KOI8-U/calendar.orthodox
@@ -0,0 +1,35 @@
+/*
+ * ðÒÁ×ÏÓÌÁ×Φ Ó×ÑÔÁ
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _uk_UA_KOI8_U_orthodox_
+#define _uk_UA_KOI8_U_orthodox_
+
+LANG=uk_UA.KOI8-U
+Paskha=÷ÅÌÉËÄÅÎØ
+
+ 7 ó¦Þ ò¦ÚÄ×Ï èÒÉÓÔÏ×Å
+19 ó¦Þ âÏÇÏÑ×ÌÅÎÎÑ ÁÂÏ èÒÅÝÅÎÎÑ çÏÓÐÏÄΤ
+15 ìÀÔ óÔÒ¦ÔÅÎÎÑ çÏÓÐÏÄΤ
+÷ÅÌÉËÄÅÎØ-46 ÷ÅÌÉËÉÊ ð¦ÓÔ
+÷ÅÌÉËÄÅÎØ-7 ÷ÅÒÂÎÁ îÅĦÌÑ
+÷ÅÌÉËÄÅÎØ-3 ÷ÅÌÉËÉÊ þÅÔ×ÅÒ
+÷ÅÌÉËÄÅÎØ-2 óÔÒÁÓÎÁ ð'ÑÔÎÉÃÑ
+÷ÅÌÉËÄÅÎØ ÷ÏÓËÒÅÓ¦ÎÎÑ èÒÉÓÔÏ×Å
+÷ÅÌÉËÄÅÎØ+39 ÷ÏÚÎÅÓ¦ÎÎÑ çÏÓÐÏÄΤ
+÷ÅÌÉËÄÅÎØ+49 äÅÎØ ó×ÑÔϧ ôÒ¦Êæ, ð'ÑÔÉÄÅÓÑÔÎÉÃÑ
+÷ÅÌÉËÄÅÎØ+60 ó×ÑÔÏ Ô¦ÌÁ èÒÉÓÔÏ×ÏÇÏ
+ 7 ëצ âÌÁÇÏצÝÅÎÎÑ ðÒÅÓ×ÑÔϧ ä¦×É íÁÒ¦§
+ 7 ìÉÐ ò¦ÚÄ×Ï Ó×ÑÔÏÇÏ ¶×ÁÎÁ èÒÅÓÔÉÔÅÌÑ
+12 ìÉÐ ó×ÑÔÉÈ ÷ÅÒÈÏ×ÎÉÈ ÁÐÏÓÔÏÌ¦× ðÅÔÒÁ ¦ ðÁ×ÌÁ
+19 óÅÒ ðÒÅÏÂÒÁÖÅÎÎÑ çÏÓÐÏÄΤ
+28 óÅÒ õÓÐÅÎÎÑ ðÒÅÓ×ÑÔϧ âÏÇÏÒÏÄÉæ
+11 ÷ÅÒ õÓ¦ËÎÏ×ÅÎÎÑ ÞÅÓÎϧ ÇÏÌÏ×É Ó×ÑÔÏÇÏ ¶×ÁÎÁ èÒÅÓÔÉÔÅÌÑ
+21 ÷ÅÒ ò¦ÚÄ×Ï ðÒÅÓ×ÑÔϧ âÏÇÏÒÏÄÉæ
+27 ÷ÅÒ ÷ÏÚÄ×ÉÖÅÎÎÑ þÅÓÎÏÇÏ èÒÅÓÔÁ
+14 öÏ× ðÏËÒÏ×Á ðÒÅÓ×ÑÔϧ âÏÇÏÒÏÄÉæ
+ 4 çÒÕ ÷×ÅÄÅÎÎÑ ÄÏ ÈÒÁÍÕ ðÒÅÓ×ÑÔϧ âÏÇÏÒÏÄÉæ
+
+#endif /* !_uk_UA_KOI8_U_orthodox_ */
diff --git a/usr.bin/calendar/dates.c b/usr.bin/calendar/dates.c
new file mode 100644
index 0000000..86d8a1f
--- /dev/null
+++ b/usr.bin/calendar/dates.c
@@ -0,0 +1,451 @@
+/*-
+ * Copyright (c) 1992-2009 Edwin Groothuis <edwin@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 <stdio.h>
+#include <stdlib.h>
+#include <err.h>
+#include <time.h>
+
+#include "calendar.h"
+
+struct cal_year {
+ int year; /* 19xx, 20xx, 21xx */
+ int easter; /* Julian day */
+ int paskha; /* Julian day */
+ int cny; /* Julian day */
+ int firstdayofweek; /* 0 .. 6 */
+ struct cal_month *months;
+ struct cal_year *nextyear;
+};
+
+struct cal_month {
+ int month; /* 01 .. 12 */
+ int firstdayjulian; /* 000 .. 366 */
+ int firstdayofweek; /* 0 .. 6 */
+ struct cal_year *year; /* points back */
+ struct cal_day *days;
+ struct cal_month *nextmonth;
+};
+
+struct cal_day {
+ int dayofmonth; /* 01 .. 31 */
+ int julianday; /* 000 .. 366 */
+ int dayofweek; /* 0 .. 6 */
+ struct cal_day *nextday;
+ struct cal_month *month; /* points back */
+ struct cal_year *year; /* points back */
+ struct event *events;
+};
+
+int debug_remember = 0;
+static struct cal_year *hyear = NULL;
+
+/* 1-based month, 0-based days, cumulative */
+int cumdaytab[][14] = {
+ {0, -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364},
+ {0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
+};
+/* 1-based month, individual */
+static int *monthdays;
+int monthdaytab[][14] = {
+ {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
+ {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
+};
+
+static struct cal_day * find_day(int yy, int mm, int dd);
+
+static void
+createdate(int y, int m, int d)
+{
+ struct cal_year *py, *pyp;
+ struct cal_month *pm, *pmp;
+ struct cal_day *pd, *pdp;
+ int *cumday;
+
+ pyp = NULL;
+ py = hyear;
+ while (py != NULL) {
+ if (py->year == y + 1900)
+ break;
+ pyp = py;
+ py = py->nextyear;
+ }
+
+ if (py == NULL) {
+ struct tm td;
+ time_t t;
+ py = (struct cal_year *)calloc(1, sizeof(struct cal_year));
+ py->year = y + 1900;
+ py->easter = easter(y);
+ py->paskha = paskha(y);
+
+ td = tm0;
+ td.tm_year = y;
+ td.tm_mday = 1;
+ t = mktime(&td);
+ localtime_r(&t, &td);
+ py->firstdayofweek = td.tm_wday;
+
+ if (pyp != NULL)
+ pyp->nextyear = py;
+ }
+ if (pyp == NULL) {
+ /* The very very very first one */
+ hyear = py;
+ }
+
+ pmp = NULL;
+ pm = py->months;
+ while (pm != NULL) {
+ if (pm->month == m)
+ break;
+ pmp = pm;
+ pm = pm->nextmonth;
+ }
+
+ if (pm == NULL) {
+ pm = (struct cal_month *)calloc(1, sizeof(struct cal_month));
+ pm->year = py;
+ pm->month = m;
+ cumday = cumdaytab[isleap(y)];
+ pm->firstdayjulian = cumday[m] + 2;
+ pm->firstdayofweek =
+ (py->firstdayofweek + pm->firstdayjulian -1) % 7;
+ if (pmp != NULL)
+ pmp->nextmonth = pm;
+ }
+ if (pmp == NULL)
+ py->months = pm;
+
+ pdp = NULL;
+ pd = pm->days;
+ while (pd != NULL) {
+ pdp = pd;
+ pd = pd->nextday;
+ }
+
+ if (pd == NULL) { /* Always true */
+ pd = (struct cal_day *)calloc(1, sizeof(struct cal_day));
+ pd->month = pm;
+ pd->year = py;
+ pd->dayofmonth = d;
+ pd->julianday = pm->firstdayjulian + d - 1;
+ pd->dayofweek = (pm->firstdayofweek + d - 1) % 7;
+ if (pdp != NULL)
+ pdp->nextday = pd;
+ }
+ if (pdp == NULL)
+ pm->days = pd;
+}
+
+void
+generatedates(struct tm *tp1, struct tm *tp2)
+{
+ int y1, m1, d1;
+ int y2, m2, d2;
+ int y, m, d;
+
+ y1 = tp1->tm_year;
+ m1 = tp1->tm_mon + 1;
+ d1 = tp1->tm_mday;
+ y2 = tp2->tm_year;
+ m2 = tp2->tm_mon + 1;
+ d2 = tp2->tm_mday;
+
+ if (y1 == y2) {
+ if (m1 == m2) {
+ /* Same year, same month. Easy! */
+ for (d = d1; d <= d2; d++)
+ createdate(y1, m1, d);
+ return;
+ }
+ /*
+ * Same year, different month.
+ * - Take the leftover days from m1
+ * - Take all days from <m1 .. m2>
+ * - Take the first days from m2
+ */
+ monthdays = monthdaytab[isleap(y1)];
+ for (d = d1; d <= monthdays[m1]; d++)
+ createdate(y1, m1, d);
+ for (m = m1 + 1; m < m2; m++)
+ for (d = 1; d <= monthdays[m]; d++)
+ createdate(y1, m, d);
+ for (d = 1; d <= d2; d++)
+ createdate(y1, m2, d);
+ return;
+ }
+ /*
+ * Different year, different month.
+ * - Take the leftover days from y1-m1
+ * - Take all days from y1-<m1 .. 12]
+ * - Take all days from <y1 .. y2>
+ * - Take all days from y2-[1 .. m2>
+ * - Take the first days of y2-m2
+ */
+ monthdays = monthdaytab[isleap(y1)];
+ for (d = d1; d <= monthdays[m1]; d++)
+ createdate(y1, m1, d);
+ for (m = m1 + 1; m <= 12; m++)
+ for (d = 1; d <= monthdays[m]; d++)
+ createdate(y1, m, d);
+ for (y = y1 + 1; y < y2; y++) {
+ monthdays = monthdaytab[isleap(y)];
+ for (m = 1; m <= 12; m++)
+ for (d = 1; d <= monthdays[m]; d++)
+ createdate(y, m, d);
+ }
+ monthdays = monthdaytab[isleap(y2)];
+ for (m = 1; m < m2; m++)
+ for (d = 1; d <= monthdays[m]; d++)
+ createdate(y2, m, d);
+ for (d = 1; d <= d2; d++)
+ createdate(y2, m2, d);
+}
+
+void
+dumpdates(void)
+{
+ struct cal_year *y;
+ struct cal_month *m;
+ struct cal_day *d;
+
+ y = hyear;
+ while (y != NULL) {
+ printf("%-5d (wday:%d)\n", y->year, y->firstdayofweek);
+ m = y->months;
+ while (m != NULL) {
+ printf("-- %-5d (julian:%d, dow:%d)\n", m->month,
+ m->firstdayjulian, m->firstdayofweek);
+ d = m->days;
+ while (d != NULL) {
+ printf(" -- %-5d (julian:%d, dow:%d)\n",
+ d->dayofmonth, d->julianday, d->dayofweek);
+ d = d->nextday;
+ }
+ m = m->nextmonth;
+ }
+ y = y->nextyear;
+ }
+}
+
+int
+remember_ymd(int yy, int mm, int dd)
+{
+ struct cal_year *y;
+ struct cal_month *m;
+ struct cal_day *d;
+
+ if (debug_remember)
+ printf("remember_ymd: %d - %d - %d\n", yy, mm, dd);
+
+ y = hyear;
+ while (y != NULL) {
+ if (y->year != yy) {
+ y = y->nextyear;
+ continue;
+ }
+ m = y->months;
+ while (m != NULL) {
+ if (m->month != mm) {
+ m = m->nextmonth;
+ continue;
+ }
+ d = m->days;
+ while (d != NULL) {
+ if (d->dayofmonth == dd)
+ return (1);
+ d = d->nextday;
+ continue;
+ }
+ return (0);
+ }
+ return (0);
+ }
+ return (0);
+}
+
+int
+remember_yd(int yy, int dd, int *rm, int *rd)
+{
+ struct cal_year *y;
+ struct cal_month *m;
+ struct cal_day *d;
+
+ if (debug_remember)
+ printf("remember_yd: %d - %d\n", yy, dd);
+
+ y = hyear;
+ while (y != NULL) {
+ if (y->year != yy) {
+ y = y->nextyear;
+ continue;
+ }
+ m = y->months;
+ while (m != NULL) {
+ d = m->days;
+ while (d != NULL) {
+ if (d->julianday == dd) {
+ *rm = m->month;
+ *rd = d->dayofmonth;
+ return (1);
+ }
+ d = d->nextday;
+ }
+ m = m->nextmonth;
+ }
+ return (0);
+ }
+ return (0);
+}
+
+int
+first_dayofweek_of_year(int yy)
+{
+ struct cal_year *y;
+
+ y = hyear;
+ while (y != NULL) {
+ if (y->year == yy)
+ return (y->firstdayofweek);
+ y = y->nextyear;
+ }
+
+ /* Should not happen */
+ return (-1);
+}
+
+int
+first_dayofweek_of_month(int yy, int mm)
+{
+ struct cal_year *y;
+ struct cal_month *m;
+
+ y = hyear;
+ while (y != NULL) {
+ if (y->year != yy) {
+ y = y->nextyear;
+ continue;
+ }
+ m = y->months;
+ while (m != NULL) {
+ if (m->month == mm)
+ return (m->firstdayofweek);
+ m = m->nextmonth;
+ }
+ /* No data for this month */
+ return (-1);
+ }
+
+ /* No data for this year. Error? */
+ return (-1);
+}
+
+int
+walkthrough_dates(struct event **e)
+{
+ static struct cal_year *y = NULL;
+ static struct cal_month *m = NULL;
+ static struct cal_day *d = NULL;
+
+ if (y == NULL) {
+ y = hyear;
+ m = y->months;
+ d = m->days;
+ *e = d->events;
+ return (1);
+ }
+ if (d->nextday != NULL) {
+ d = d->nextday;
+ *e = d->events;
+ return (1);
+ }
+ if (m->nextmonth != NULL) {
+ m = m->nextmonth;
+ d = m->days;
+ *e = d->events;
+ return (1);
+ }
+ if (y->nextyear != NULL) {
+ y = y->nextyear;
+ m = y->months;
+ d = m->days;
+ *e = d->events;
+ return (1);
+ }
+
+ return (0);
+}
+
+static struct cal_day *
+find_day(int yy, int mm, int dd)
+{
+ struct cal_year *y;
+ struct cal_month *m;
+ struct cal_day *d;
+
+ if (debug_remember)
+ printf("remember_ymd: %d - %d - %d\n", yy, mm, dd);
+
+ y = hyear;
+ while (y != NULL) {
+ if (y->year != yy) {
+ y = y->nextyear;
+ continue;
+ }
+ m = y->months;
+ while (m != NULL) {
+ if (m->month != mm) {
+ m = m->nextmonth;
+ continue;
+ }
+ d = m->days;
+ while (d != NULL) {
+ if (d->dayofmonth == dd)
+ return (d);
+ d = d->nextday;
+ continue;
+ }
+ return (NULL);
+ }
+ return (NULL);
+ }
+ return (NULL);
+}
+
+void
+addtodate(struct event *e, int year, int month, int day)
+{
+ struct cal_day *d;
+
+ d = find_day(year, month, day);
+ e->next = d->events;
+ d->events = e;
+}
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c
new file mode 100644
index 0000000..dac6115
--- /dev/null
+++ b/usr.bin/calendar/day.c
@@ -0,0 +1,117 @@
+/*-
+ * Copyright (c) 1989, 1993, 1994
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "calendar.h"
+
+static time_t time1, time2;
+const struct tm tm0;
+char dayname[100];
+int year1, year2;
+
+
+void
+settimes(time_t now, int before, int after, int friday, struct tm *tp1, struct tm *tp2)
+{
+ char *oldl, *lbufp;
+ struct tm tp;
+
+ localtime_r(&now, &tp);
+
+ /* Friday displays Monday's events */
+ if (after == 0 && before == 0 && friday != -1)
+ after = tp.tm_wday == friday ? 3 : 1;
+
+ time1 = now - SECSPERDAY * before;
+ localtime_r(&time1, tp1);
+ year1 = 1900 + tp1->tm_year;
+ time2 = now + SECSPERDAY * after;
+ localtime_r(&time2, tp2);
+ year2 = 1900 + tp2->tm_year;
+
+ strftime(dayname, sizeof(dayname) - 1, "%A, %d %B %Y", tp1);
+
+ oldl = NULL;
+ lbufp = setlocale(LC_TIME, NULL);
+ if (lbufp != NULL && (oldl = strdup(lbufp)) == NULL)
+ errx(1, "cannot allocate memory");
+ (void)setlocale(LC_TIME, "C");
+ (void)setlocale(LC_TIME, (oldl != NULL ? oldl : ""));
+ if (oldl != NULL)
+ free(oldl);
+
+ setnnames();
+}
+
+/* convert Day[/Month][/Year] into unix time (since 1970)
+ * Day: two digits, Month: two digits, Year: digits
+ */
+time_t
+Mktime(char *dp)
+{
+ time_t t;
+ int d, m, y;
+ struct tm tm, tp;
+
+ (void)time(&t);
+ localtime_r(&t, &tp);
+
+ tm = tm0;
+ tm.tm_mday = tp.tm_mday;
+ tm.tm_mon = tp.tm_mon;
+ tm.tm_year = tp.tm_year;
+
+ switch (sscanf(dp, "%d.%d.%d", &d, &m, &y)) {
+ case 3:
+ if (y > 1900)
+ y -= 1900;
+ tm.tm_year = y;
+ /* FALLTHROUGH */
+ case 2:
+ tm.tm_mon = m - 1;
+ /* FALLTHROUGH */
+ case 1:
+ tm.tm_mday = d;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "Mktime: %d %d %s\n",
+ (int)mktime(&tm), (int)t, asctime(&tm));
+#endif
+ return (mktime(&tm));
+}
diff --git a/usr.bin/calendar/events.c b/usr.bin/calendar/events.c
new file mode 100644
index 0000000..d6f358a
--- /dev/null
+++ b/usr.bin/calendar/events.c
@@ -0,0 +1,126 @@
+/*-
+ * Copyright (c) 1992-2009 Edwin Groothuis <edwin@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/time.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pathnames.h"
+#include "calendar.h"
+
+struct event *
+event_add(int year, int month, int day, char *date, int var, char *txt,
+ char *extra)
+{
+ struct event *e;
+
+ /*
+ * Creating a new event:
+ * - Create a new event
+ * - Copy the machine readable day and month
+ * - Copy the human readable and language specific date
+ * - Copy the text of the event
+ */
+ e = (struct event *)calloc(1, sizeof(struct event));
+ if (e == NULL)
+ errx(1, "event_add: cannot allocate memory");
+ e->month = month;
+ e->day = day;
+ e->var = var;
+ e->date = strdup(date);
+ if (e->date == NULL)
+ errx(1, "event_add: cannot allocate memory");
+ e->text = strdup(txt);
+ if (e->text == NULL)
+ errx(1, "event_add: cannot allocate memory");
+ e->extra = NULL;
+ if (extra != NULL && extra[0] != '\0')
+ e->extra = strdup(extra);
+ addtodate(e, year, month, day);
+ return (e);
+}
+
+void
+event_continue(struct event *e, char *txt)
+{
+ char *text;
+
+ /*
+ * Adding text to the event:
+ * - Save a copy of the old text (unknown length, so strdup())
+ * - Allocate enough space for old text + \n + new text + 0
+ * - Store the old text + \n + new text
+ * - Destroy the saved copy.
+ */
+ text = strdup(e->text);
+ if (text == NULL)
+ errx(1, "event_continue: cannot allocate memory");
+
+ free(e->text);
+ e->text = (char *)malloc(strlen(text) + strlen(txt) + 3);
+ if (e->text == NULL)
+ errx(1, "event_continue: cannot allocate memory");
+ strcpy(e->text, text);
+ strcat(e->text, "\n");
+ strcat(e->text, txt);
+ free(text);
+
+ return;
+}
+
+void
+event_print_all(FILE *fp)
+{
+ struct event *e;
+
+ while (walkthrough_dates(&e) != 0) {
+#ifdef DEBUG
+ fprintf(stderr, "event_print_allmonth: %d, day: %d\n",
+ month, day);
+#endif
+
+ /*
+ * Go through all events and print the text of the matching
+ * dates
+ */
+ while (e != NULL) {
+ (void)fprintf(fp, "%s%c%s%s%s%s\n", e->date,
+ e->var ? '*' : ' ', e->text,
+ e->extra != NULL ? " (" : "",
+ e->extra != NULL ? e->extra : "",
+ e->extra != NULL ? ")" : ""
+ );
+
+ e = e->next;
+ }
+ }
+}
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
new file mode 100644
index 0000000..0a5dd85
--- /dev/null
+++ b/usr.bin/calendar/io.c
@@ -0,0 +1,503 @@
+/*-
+ * Copyright (c) 1989, 1993, 1994
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <pwd.h>
+#include <stdbool.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stringlist.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+#include "calendar.h"
+
+enum {
+ T_OK = 0,
+ T_ERR,
+ T_PROCESS,
+};
+
+const char *calendarFile = "calendar"; /* default calendar file */
+static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
+static const char *calendarNoMail = "nomail";/* don't sent mail if file exist */
+
+static char path[MAXPATHLEN];
+
+struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
+struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
+
+static int cal_parse(FILE *in, FILE *out);
+
+static StringList *definitions = NULL;
+static struct event *events[MAXCOUNT];
+static char *extradata[MAXCOUNT];
+
+static void
+trimlr(char **buf)
+{
+ char *walk = *buf;
+ char *last;
+
+ while (isspace(*walk))
+ walk++;
+ if (*walk != '\0') {
+ last = walk + strlen(walk) - 1;
+ while (last > walk && isspace(*last))
+ last--;
+ *(last+1) = 0;
+ }
+
+ *buf = walk;
+}
+
+static FILE *
+cal_fopen(const char *file)
+{
+ FILE *fp;
+ char *home = getenv("HOME");
+ unsigned int i;
+
+ if (home == NULL || *home == '\0') {
+ warnx("Cannot get home directory");
+ return (NULL);
+ }
+
+ if (chdir(home) != 0) {
+ warnx("Cannot enter home directory");
+ return (NULL);
+ }
+
+ for (i = 0; i < sizeof(calendarHomes)/sizeof(calendarHomes[0]) ; i++) {
+ if (chdir(calendarHomes[i]) != 0)
+ continue;
+
+ if ((fp = fopen(file, "r")) != NULL)
+ return (fp);
+ }
+
+ warnx("can't open calendar file \"%s\"", file);
+
+ return (NULL);
+}
+
+static int
+token(char *line, FILE *out, bool *skip)
+{
+ char *walk, c, a;
+
+ if (strncmp(line, "endif", 5) == 0) {
+ *skip = false;
+ return (T_OK);
+ }
+
+ if (*skip)
+ return (T_OK);
+
+ if (strncmp(line, "include", 7) == 0) {
+ walk = line + 7;
+
+ trimlr(&walk);
+
+ if (*walk == '\0') {
+ warnx("Expecting arguments after #include");
+ return (T_ERR);
+ }
+
+ if (*walk != '<' && *walk != '\"') {
+ warnx("Excecting '<' or '\"' after #include");
+ return (T_ERR);
+ }
+
+ a = *walk;
+ walk++;
+ c = walk[strlen(walk) - 1];
+
+ switch(c) {
+ case '>':
+ if (a != '<') {
+ warnx("Unterminated include expecting '\"'");
+ return (T_ERR);
+ }
+ break;
+ case '\"':
+ if (a != '\"') {
+ warnx("Unterminated include expecting '>'");
+ return (T_ERR);
+ }
+ break;
+ default:
+ warnx("Unterminated include expecting '%c'",
+ a == '<' ? '>' : '\"' );
+ return (T_ERR);
+ }
+ walk[strlen(walk) - 1] = '\0';
+
+ if (cal_parse(cal_fopen(walk), out))
+ return (T_ERR);
+
+ return (T_OK);
+ }
+
+ if (strncmp(line, "define", 6) == 0) {
+ if (definitions == NULL)
+ definitions = sl_init();
+ walk = line + 6;
+ trimlr(&walk);
+
+ if (*walk == '\0') {
+ warnx("Expecting arguments after #define");
+ return (T_ERR);
+ }
+
+ sl_add(definitions, strdup(walk));
+ return (T_OK);
+ }
+
+ if (strncmp(line, "ifndef", 6) == 0) {
+ walk = line + 6;
+ trimlr(&walk);
+
+ if (*walk == '\0') {
+ warnx("Expecting arguments after #ifndef");
+ return (T_ERR);
+ }
+
+ if (definitions != NULL && sl_find(definitions, walk) != NULL)
+ *skip = true;
+
+ return (T_OK);
+ }
+
+ return (T_PROCESS);
+
+}
+
+#define REPLACE(string, slen, struct_) \
+ if (strncasecmp(buf, (string), (slen)) == 0 && buf[(slen)]) { \
+ if (struct_.name != NULL) \
+ free(struct_.name); \
+ if ((struct_.name = strdup(buf + (slen))) == NULL) \
+ errx(1, "cannot allocate memory"); \
+ struct_.len = strlen(buf + (slen)); \
+ continue; \
+ }
+static int
+cal_parse(FILE *in, FILE *out)
+{
+ char *line = NULL;
+ char *buf;
+ size_t linecap = 0;
+ ssize_t linelen;
+ ssize_t l;
+ static int d_first = -1;
+ static int count = 0;
+ int i;
+ int month[MAXCOUNT];
+ int day[MAXCOUNT];
+ int year[MAXCOUNT];
+ bool skip = false;
+ char dbuf[80];
+ char *pp, p;
+ struct tm tm;
+ int flags;
+
+ /* Unused */
+ tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_hour = 0;
+ tm.tm_wday = 0;
+
+ if (in == NULL)
+ return (1);
+
+ while ((linelen = getline(&line, &linecap, in)) > 0) {
+ if (*line == '#') {
+ switch (token(line+1, out, &skip)) {
+ case T_ERR:
+ free(line);
+ return (1);
+ case T_OK:
+ continue;
+ case T_PROCESS:
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (skip)
+ continue;
+
+ buf = line;
+ for (l = linelen;
+ l > 0 && isspace((unsigned char)buf[l - 1]);
+ l--)
+ ;
+ buf[l] = '\0';
+ if (buf[0] == '\0')
+ continue;
+
+ /* Parse special definitions: LANG, Easter, Paskha etc */
+ if (strncmp(buf, "LANG=", 5) == 0) {
+ (void)setlocale(LC_ALL, buf + 5);
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ setnnames();
+ continue;
+ }
+ REPLACE("Easter=", 7, neaster);
+ REPLACE("Paskha=", 7, npaskha);
+ REPLACE("ChineseNewYear=", 15, ncny);
+ REPLACE("NewMoon=", 8, nnewmoon);
+ REPLACE("FullMoon=", 9, nfullmoon);
+ REPLACE("MarEquinox=", 11, nmarequinox);
+ REPLACE("SepEquinox=", 11, nsepequinox);
+ REPLACE("JunSolstice=", 12, njunsolstice);
+ REPLACE("DecSolstice=", 12, ndecsolstice);
+ if (strncmp(buf, "SEQUENCE=", 9) == 0) {
+ setnsequences(buf + 9);
+ continue;
+ }
+
+ /*
+ * If the line starts with a tab, the data has to be
+ * added to the previous line
+ */
+ if (buf[0] == '\t') {
+ for (i = 0; i < count; i++)
+ event_continue(events[i], buf);
+ continue;
+ }
+
+ /* Get rid of leading spaces (non-standard) */
+ while (isspace((unsigned char)buf[0]))
+ memcpy(buf, buf + 1, strlen(buf));
+
+ /* No tab in the line, then not a valid line */
+ if ((pp = strchr(buf, '\t')) == NULL)
+ continue;
+
+ /* Trim spaces in front of the tab */
+ while (isspace((unsigned char)pp[-1]))
+ pp--;
+
+ p = *pp;
+ *pp = '\0';
+ if ((count = parsedaymonth(buf, year, month, day, &flags,
+ extradata)) == 0)
+ continue;
+ *pp = p;
+ if (count < 0) {
+ /* Show error status based on return value */
+ if (debug)
+ fprintf(stderr, "Ignored: %s\n", buf);
+ if (count == -1)
+ continue;
+ count = -count + 1;
+ }
+
+ /* Find the last tab */
+ while (pp[1] == '\t')
+ pp++;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+
+ for (i = 0; i < count; i++) {
+ tm.tm_mon = month[i] - 1;
+ tm.tm_mday = day[i];
+ tm.tm_year = year[i] - 1900;
+ (void)strftime(dbuf, sizeof(dbuf),
+ d_first ? "%e %b" : "%b %e", &tm);
+ if (debug)
+ fprintf(stderr, "got %s\n", pp);
+ events[i] = event_add(year[i], month[i], day[i], dbuf,
+ ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp,
+ extradata[i]);
+ }
+ }
+
+ free(line);
+ fclose(in);
+
+ return (0);
+}
+
+void
+cal(void)
+{
+ FILE *fpin;
+ FILE *fpout;
+ int i;
+
+ for (i = 0; i < MAXCOUNT; i++)
+ extradata[i] = (char *)calloc(1, 20);
+
+
+ if ((fpin = opencalin()) == NULL)
+ return;
+
+ if ((fpout = opencalout()) == NULL) {
+ fclose(fpin);
+ return;
+ }
+
+ if (cal_parse(fpin, fpout))
+ return;
+
+ event_print_all(fpout);
+ closecal(fpout);
+}
+
+FILE *
+opencalin(void)
+{
+ struct stat sbuf;
+ FILE *fpin;
+
+ /* open up calendar file */
+ if ((fpin = fopen(calendarFile, "r")) == NULL) {
+ if (doall) {
+ if (chdir(calendarHomes[0]) != 0)
+ return (NULL);
+ if (stat(calendarNoMail, &sbuf) == 0)
+ return (NULL);
+ if ((fpin = fopen(calendarFile, "r")) == NULL)
+ return (NULL);
+ } else {
+ fpin = cal_fopen(calendarFile);
+ }
+ }
+ return (fpin);
+}
+
+FILE *
+opencalout(void)
+{
+ int fd;
+
+ /* not reading all calendar files, just set output to stdout */
+ if (!doall)
+ return (stdout);
+
+ /* set output to a temporary file, so if no output don't send mail */
+ snprintf(path, sizeof(path), "%s/_calXXXXXX", _PATH_TMP);
+ if ((fd = mkstemp(path)) < 0)
+ return (NULL);
+ return (fdopen(fd, "w+"));
+}
+
+void
+closecal(FILE *fp)
+{
+ uid_t uid;
+ struct stat sbuf;
+ int nread, pdes[2], status;
+ char buf[1024];
+
+ if (!doall)
+ return;
+
+ rewind(fp);
+ if (fstat(fileno(fp), &sbuf) || !sbuf.st_size)
+ goto done;
+ if (pipe(pdes) < 0)
+ goto done;
+ switch (fork()) {
+ case -1: /* error */
+ (void)close(pdes[0]);
+ (void)close(pdes[1]);
+ goto done;
+ case 0:
+ /* child -- set stdin to pipe output */
+ if (pdes[0] != STDIN_FILENO) {
+ (void)dup2(pdes[0], STDIN_FILENO);
+ (void)close(pdes[0]);
+ }
+ (void)close(pdes[1]);
+ uid = geteuid();
+ if (setuid(getuid()) < 0) {
+ warnx("setuid failed");
+ _exit(1);
+ }
+ if (setgid(getegid()) < 0) {
+ warnx("setgid failed");
+ _exit(1);
+ }
+ if (setuid(uid) < 0) {
+ warnx("setuid failed");
+ _exit(1);
+ }
+ execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F",
+ "\"Reminder Service\"", (char *)NULL);
+ warn(_PATH_SENDMAIL);
+ _exit(1);
+ }
+ /* parent -- write to pipe input */
+ (void)close(pdes[0]);
+
+ write(pdes[1], "From: \"Reminder Service\" <", 26);
+ write(pdes[1], pw->pw_name, strlen(pw->pw_name));
+ write(pdes[1], ">\nTo: <", 7);
+ write(pdes[1], pw->pw_name, strlen(pw->pw_name));
+ write(pdes[1], ">\nSubject: ", 11);
+ write(pdes[1], dayname, strlen(dayname));
+ write(pdes[1], "'s Calendar\nPrecedence: bulk\n\n", 30);
+
+ while ((nread = read(fileno(fp), buf, sizeof(buf))) > 0)
+ (void)write(pdes[1], buf, nread);
+ (void)close(pdes[1]);
+done: (void)fclose(fp);
+ (void)unlink(path);
+ while (wait(&status) >= 0);
+}
diff --git a/usr.bin/calendar/locale.c b/usr.bin/calendar/locale.c
new file mode 100644
index 0000000..7018428
--- /dev/null
+++ b/usr.bin/calendar/locale.c
@@ -0,0 +1,166 @@
+/*-
+ * Copyright (c) 1989, 1993, 1994
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "calendar.h"
+
+const char *fdays[] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
+ "Saturday", NULL,
+};
+
+const char *days[] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL,
+};
+
+const char *fmonths[] = {
+ "January", "February", "March", "April", "May", "June", "Juli",
+ "August", "September", "October", "November", "December", NULL,
+};
+
+const char *months[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL,
+};
+
+const char *sequences[] = {
+ "First", "Second", "Third", "Fourth", "Fifth", "Last"
+};
+
+struct fixs fndays[8]; /* full national days names */
+struct fixs ndays[8]; /* short national days names */
+struct fixs fnmonths[13]; /* full national months names */
+struct fixs nmonths[13]; /* short national month names */
+struct fixs nsequences[10]; /* national sequence names */
+
+
+void
+setnnames(void)
+{
+ char buf[80];
+ int i, l;
+ struct tm tm;
+
+ memset(&tm, 0, sizeof(struct tm));
+ for (i = 0; i < 7; i++) {
+ tm.tm_wday = i;
+ strftime(buf, sizeof(buf), "%a", &tm);
+ for (l = strlen(buf);
+ l > 0 && isspace((unsigned char)buf[l - 1]);
+ l--)
+ ;
+ buf[l] = '\0';
+ if (ndays[i].name != NULL)
+ free(ndays[i].name);
+ if ((ndays[i].name = strdup(buf)) == NULL)
+ errx(1, "cannot allocate memory");
+ ndays[i].len = strlen(buf);
+
+ strftime(buf, sizeof(buf), "%A", &tm);
+ for (l = strlen(buf);
+ l > 0 && isspace((unsigned char)buf[l - 1]);
+ l--)
+ ;
+ buf[l] = '\0';
+ if (fndays[i].name != NULL)
+ free(fndays[i].name);
+ if ((fndays[i].name = strdup(buf)) == NULL)
+ errx(1, "cannot allocate memory");
+ fndays[i].len = strlen(buf);
+ }
+
+ memset(&tm, 0, sizeof(struct tm));
+ for (i = 0; i < 12; i++) {
+ tm.tm_mon = i;
+ strftime(buf, sizeof(buf), "%b", &tm);
+ for (l = strlen(buf);
+ l > 0 && isspace((unsigned char)buf[l - 1]);
+ l--)
+ ;
+ buf[l] = '\0';
+ if (nmonths[i].name != NULL)
+ free(nmonths[i].name);
+ if ((nmonths[i].name = strdup(buf)) == NULL)
+ errx(1, "cannot allocate memory");
+ nmonths[i].len = strlen(buf);
+
+ strftime(buf, sizeof(buf), "%B", &tm);
+ for (l = strlen(buf);
+ l > 0 && isspace((unsigned char)buf[l - 1]);
+ l--)
+ ;
+ buf[l] = '\0';
+ if (fnmonths[i].name != NULL)
+ free(fnmonths[i].name);
+ if ((fnmonths[i].name = strdup(buf)) == NULL)
+ errx(1, "cannot allocate memory");
+ fnmonths[i].len = strlen(buf);
+ }
+}
+
+void
+setnsequences(char *seq)
+{
+ int i;
+ char *p;
+
+ p = seq;
+ for (i = 0; i < 5; i++) {
+ nsequences[i].name = p;
+ if ((p = strchr(p, ' ')) == NULL) {
+ /* Oh oh there is something wrong. Erase! Erase! */
+ for (i = 0; i < 5; i++) {
+ nsequences[i].name = NULL;
+ nsequences[i].len = 0;
+ }
+ return;
+ }
+ *p = '\0';
+ p++;
+ }
+ nsequences[i].name = p;
+
+ for (i = 0; i < 5; i++) {
+ nsequences[i].name = strdup(nsequences[i].name);
+ nsequences[i].len = nsequences[i + 1].name - nsequences[i].name;
+ }
+ nsequences[i].name = strdup(nsequences[i].name);
+ nsequences[i].len = strlen(nsequences[i].name);
+
+ return;
+}
diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c
new file mode 100644
index 0000000..3cce299
--- /dev/null
+++ b/usr.bin/calendar/ostern.c
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "calendar.h"
+
+/* return year day for Easter */
+
+/*
+ * This code is based on the Calendar FAQ's code for how to calculate
+ * easter is. This is the Gregorian calendar version. They refer to
+ * the Algorithm of Oudin in the "Explanatory Supplement to the
+ * Astronomical Almanac".
+ */
+
+int
+easter(int year) /* 0 ... abcd, NOT since 1900 */
+{
+ int G, /* Golden number - 1 */
+ C, /* Century */
+ H, /* 23 - epact % 30 */
+ I, /* days from 21 March to Paschal full moon */
+ J, /* weekday of full moon */
+ L; /* days from 21 March to Sunday on of before full moon */
+
+ G = year % 19;
+ C = year / 100;
+ H = (C - C / 4 - (8 * C + 13) / 25 + 19 * G + 15) % 30;
+ I = H - (H / 28) * (1 - (H / 28) * (29 / (H + 1)) * ((21 - G) / 11));
+ J = (year + year / 4 + I + 2 - C + C / 4) % 7;
+
+ L = I - J;
+
+ if (isleap(year))
+ return 31 + 29 + 21 + L + 7;
+ else
+ return 31 + 28 + 21 + L + 7;
+}
diff --git a/usr.bin/calendar/parsedata.c b/usr.bin/calendar/parsedata.c
new file mode 100644
index 0000000..1a19164
--- /dev/null
+++ b/usr.bin/calendar/parsedata.c
@@ -0,0 +1,1116 @@
+/*-
+ * Copyright (c) 1992-2009 Edwin Groothuis <edwin@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 <ctype.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+
+#include "calendar.h"
+
+static char *showflags(int flags);
+static int isonlydigits(char *s, int nostar);
+static const char *getmonthname(int i);
+static int checkmonth(char *s, size_t *len, size_t *offset, const char **month);
+static const char *getdayofweekname(int i);
+static int checkdayofweek(char *s, size_t *len, size_t *offset, const char **dow);
+static int indextooffset(char *s);
+static int parseoffset(char *s);
+static char *floattoday(int year, double f);
+static char *floattotime(double f);
+static int wdayom (int day, int offset, int month, int year);
+
+/*
+ * Expected styles:
+ *
+ * Date ::= Month . ' ' . DayOfMonth |
+ * Month . ' ' . DayOfWeek . ModifierIndex |
+ * Month . '/' . DayOfMonth |
+ * Month . '/' . DayOfWeek . ModifierIndex |
+ * DayOfMonth . ' ' . Month |
+ * DayOfMonth . '/' . Month |
+ * DayOfWeek . ModifierIndex . ' ' .Month |
+ * DayOfWeek . ModifierIndex . '/' .Month |
+ * DayOfWeek . ModifierIndex |
+ * SpecialDay . ModifierOffset
+ *
+ * Month ::= MonthName | MonthNumber | '*'
+ * MonthNumber ::= '0' ... '9' | '00' ... '09' | '10' ... '12'
+ * MonthName ::= MonthNameShort | MonthNameLong
+ * MonthNameLong ::= 'January' ... 'December'
+ * MonthNameShort ::= 'Jan' ... 'Dec' | 'Jan.' ... 'Dec.'
+ *
+ * DayOfWeek ::= DayOfWeekShort | DayOfWeekLong
+ * DayOfWeekShort ::= 'Mon' .. 'Sun'
+ * DayOfWeekLong ::= 'Monday' .. 'Sunday'
+ * DayOfMonth ::= '0' ... '9' | '00' ... '09' | '10' ... '29' |
+ * '30' ... '31' | '*'
+ *
+ * ModifierOffset ::= '' | '+' . ModifierNumber | '-' . ModifierNumber
+ * ModifierNumber ::= '0' ... '9' | '00' ... '99' | '000' ... '299' |
+ * '300' ... '359' | '360' ... '365'
+ * ModifierIndex ::= 'Second' | 'Third' | 'Fourth' | 'Fifth' |
+ * 'First' | 'Last'
+ *
+ * SpecialDay ::= 'Easter' | 'Paskha' | 'ChineseNewYear'
+ *
+ */
+static int
+determinestyle(char *date, int *flags,
+ char *month, int *imonth, char *dayofmonth, int *idayofmonth,
+ char *dayofweek, int *idayofweek, char *modifieroffset,
+ char *modifierindex, char *specialday, char *year, int *iyear)
+{
+ char *p, *p1, *p2, *py;
+ const char *dow, *pmonth;
+ char pold;
+ size_t len, offset;
+
+ *flags = F_NONE;
+ *month = '\0';
+ *imonth = 0;
+ *year = '\0';
+ *iyear = 0;
+ *dayofmonth = '\0';
+ *idayofmonth = 0;
+ *dayofweek = '\0';
+ *idayofweek = 0;
+ *modifieroffset = '\0';
+ *modifierindex = '\0';
+ *specialday = '\0';
+
+#define CHECKSPECIAL(s1, s2, lens2, type) \
+ if (s2 != NULL && strncmp(s1, s2, lens2) == 0) { \
+ *flags |= F_SPECIALDAY; \
+ *flags |= type; \
+ *flags |= F_VARIABLE; \
+ if (strlen(s1) == lens2) { \
+ strcpy(specialday, s1); \
+ return (1); \
+ } \
+ strncpy(specialday, s1, lens2); \
+ specialday[lens2] = '\0'; \
+ strcpy(modifieroffset, s1 + lens2); \
+ *flags |= F_MODIFIEROFFSET; \
+ return (1); \
+ }
+
+ if ((p = strchr(date, ' ')) == NULL) {
+ if ((p = strchr(date, '/')) == NULL) {
+ CHECKSPECIAL(date, STRING_CNY, strlen(STRING_CNY),
+ F_CNY);
+ CHECKSPECIAL(date, ncny.name, ncny.len, F_CNY);
+ CHECKSPECIAL(date, STRING_NEWMOON,
+ strlen(STRING_NEWMOON), F_NEWMOON);
+ CHECKSPECIAL(date, nnewmoon.name, nnewmoon.len,
+ F_NEWMOON);
+ CHECKSPECIAL(date, STRING_FULLMOON,
+ strlen(STRING_FULLMOON), F_FULLMOON);
+ CHECKSPECIAL(date, nfullmoon.name, nfullmoon.len,
+ F_FULLMOON);
+ CHECKSPECIAL(date, STRING_PASKHA,
+ strlen(STRING_PASKHA), F_PASKHA);
+ CHECKSPECIAL(date, npaskha.name, npaskha.len, F_PASKHA);
+ CHECKSPECIAL(date, STRING_EASTER,
+ strlen(STRING_EASTER), F_EASTER);
+ CHECKSPECIAL(date, neaster.name, neaster.len, F_EASTER);
+ CHECKSPECIAL(date, STRING_MAREQUINOX,
+ strlen(STRING_MAREQUINOX), F_MAREQUINOX);
+ CHECKSPECIAL(date, nmarequinox.name, nmarequinox.len,
+ F_SEPEQUINOX);
+ CHECKSPECIAL(date, STRING_SEPEQUINOX,
+ strlen(STRING_SEPEQUINOX), F_SEPEQUINOX);
+ CHECKSPECIAL(date, nsepequinox.name, nsepequinox.len,
+ F_SEPEQUINOX);
+ CHECKSPECIAL(date, STRING_JUNSOLSTICE,
+ strlen(STRING_JUNSOLSTICE), F_JUNSOLSTICE);
+ CHECKSPECIAL(date, njunsolstice.name, njunsolstice.len,
+ F_JUNSOLSTICE);
+ CHECKSPECIAL(date, STRING_DECSOLSTICE,
+ strlen(STRING_DECSOLSTICE), F_DECSOLSTICE);
+ CHECKSPECIAL(date, ndecsolstice.name, ndecsolstice.len,
+ F_DECSOLSTICE);
+ if (checkdayofweek(date, &len, &offset, &dow) != 0) {
+ *flags |= F_DAYOFWEEK;
+ *flags |= F_VARIABLE;
+ *idayofweek = offset;
+ if (strlen(date) == len) {
+ strcpy(dayofweek, date);
+ return (1);
+ }
+ strncpy(dayofweek, date, len);
+ dayofweek[len] = '\0';
+ strcpy(modifierindex, date + len);
+ *flags |= F_MODIFIERINDEX;
+ return (1);
+ }
+ if (isonlydigits(date, 1)) {
+ /* Assume month number only */
+ *flags |= F_MONTH;
+ *imonth = (int)strtol(date, (char **)NULL, 10);
+ strcpy(month, getmonthname(*imonth));
+ return(1);
+ }
+ return (0);
+ }
+ }
+
+ /*
+ * After this, leave by goto-ing to "allfine" or "fail" to restore the
+ * original data in `date'.
+ */
+ pold = *p;
+ *p = 0;
+ p1 = date;
+ p2 = p + 1;
+ /* Now p2 points to the next field and p1 to the first field */
+
+ if ((py = strchr(p2, '/')) != NULL) {
+ /* We have a year in the string. Now this is getting tricky */
+ strcpy(year, p1);
+ *iyear = (int)strtol(year, NULL, 10);
+ p1 = p2;
+ p2 = py + 1;
+ *py = 0;
+ *flags |= F_YEAR;
+ }
+
+ /* Check if there is a month-string in the date */
+ if ((checkmonth(p1, &len, &offset, &pmonth) != 0)
+ || (checkmonth(p2, &len, &offset, &pmonth) != 0 && (p2 = p1))) {
+ /* p2 is the non-month part */
+ *flags |= F_MONTH;
+ *imonth = offset;
+
+ strcpy(month, getmonthname(offset));
+ if (isonlydigits(p2, 1)) {
+ strcpy(dayofmonth, p2);
+ *idayofmonth = (int)strtol(p2, (char **)NULL, 10);
+ *flags |= F_DAYOFMONTH;
+ goto allfine;
+ }
+ if (strcmp(p2, "*") == 0) {
+ *flags |= F_ALLDAY;
+ goto allfine;
+ }
+
+ if (checkdayofweek(p2, &len, &offset, &dow) != 0) {
+ *flags |= F_DAYOFWEEK;
+ *flags |= F_VARIABLE;
+ *idayofweek = offset;
+ strcpy(dayofweek, getdayofweekname(offset));
+ if (strlen(p2) == len)
+ goto allfine;
+ strcpy(modifierindex, p2 + len);
+ *flags |= F_MODIFIERINDEX;
+ goto allfine;
+ }
+ goto fail;
+ }
+
+ /* Check if there is an every-day or every-month in the string */
+ if ((strcmp(p1, "*") == 0 && isonlydigits(p2, 1))
+ || (strcmp(p2, "*") == 0 && isonlydigits(p1, 1) && (p2 = p1))) {
+ int d;
+
+ *flags |= F_ALLMONTH;
+ *flags |= F_DAYOFMONTH;
+ d = (int)strtol(p2, (char **)NULL, 10);
+ *idayofmonth = d;
+ sprintf(dayofmonth, "%d", d);
+ goto allfine;
+ }
+
+ /* Month as a number, then a weekday */
+ if (isonlydigits(p1, 1)
+ && checkdayofweek(p2, &len, &offset, &dow) != 0) {
+ int d;
+
+ *flags |= F_MONTH;
+ *flags |= F_DAYOFWEEK;
+ *flags |= F_VARIABLE;
+
+ *idayofweek = offset;
+ d = (int)strtol(p1, (char **)NULL, 10);
+ *imonth = d;
+ strcpy(month, getmonthname(d));
+
+ strcpy(dayofweek, getdayofweekname(offset));
+ if (strlen(p2) == len)
+ goto allfine;
+ strcpy(modifierindex, p2 + len);
+ *flags |= F_MODIFIERINDEX;
+ goto allfine;
+ }
+
+ /* If both the month and date are specified as numbers */
+ if (isonlydigits(p1, 1) && isonlydigits(p2, 0)) {
+ /* Now who wants to be this ambiguous? :-( */
+ int m, d;
+
+ if (strchr(p2, '*') != NULL)
+ *flags |= F_VARIABLE;
+
+ m = (int)strtol(p1, (char **)NULL, 10);
+ d = (int)strtol(p2, (char **)NULL, 10);
+
+ *flags |= F_MONTH;
+ *flags |= F_DAYOFMONTH;
+
+ if (m > 12) {
+ *imonth = d;
+ *idayofmonth = m;
+ strcpy(month, getmonthname(d));
+ sprintf(dayofmonth, "%d", m);
+ } else {
+ *imonth = m;
+ *idayofmonth = d;
+ strcpy(month, getmonthname(m));
+ sprintf(dayofmonth, "%d", d);
+ }
+ goto allfine;
+ }
+
+ /* FALLTHROUGH */
+fail:
+ *p = pold;
+ return (0);
+allfine:
+ *p = pold;
+ return (1);
+
+}
+
+void
+remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm,
+ int dd, char *extra);
+void
+remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm,
+ int dd, char *extra)
+{
+ static int warned = 0;
+
+ if (*rememberindex >= MAXCOUNT - 1) {
+ if (warned == 0)
+ warnx("Index > %d, ignored", MAXCOUNT);
+ warned++;
+ return;
+ }
+ y[*rememberindex] = yy;
+ m[*rememberindex] = mm;
+ d[*rememberindex] = dd;
+ if (extra != NULL)
+ strcpy(ed[*rememberindex], extra);
+ else
+ ed[*rememberindex][0] = '\0';
+ *rememberindex += 1;
+}
+
+static void
+debug_determinestyle(int dateonly, char *date, int flags, char *month,
+ int imonth, char *dayofmonth, int idayofmonth, char *dayofweek,
+ int idayofweek, char *modifieroffset, char *modifierindex, char *specialday,
+ char *year, int iyear)
+{
+
+ if (dateonly != 0) {
+ printf("-------\ndate: |%s|\n", date);
+ if (dateonly == 1)
+ return;
+ }
+ printf("flags: %x - %s\n", flags, showflags(flags));
+ if (modifieroffset[0] != '\0')
+ printf("modifieroffset: |%s|\n", modifieroffset);
+ if (modifierindex[0] != '\0')
+ printf("modifierindex: |%s|\n", modifierindex);
+ if (year[0] != '\0')
+ printf("year: |%s| (%d)\n", year, iyear);
+ if (month[0] != '\0')
+ printf("month: |%s| (%d)\n", month, imonth);
+ if (dayofmonth[0] != '\0')
+ printf("dayofmonth: |%s| (%d)\n", dayofmonth, idayofmonth);
+ if (dayofweek[0] != '\0')
+ printf("dayofweek: |%s| (%d)\n", dayofweek, idayofweek);
+ if (specialday[0] != '\0')
+ printf("specialday: |%s|\n", specialday);
+}
+
+static struct yearinfo {
+ int year;
+ int ieaster, ipaskha, firstcnyday;
+ double ffullmoon[MAXMOONS], fnewmoon[MAXMOONS];
+ double ffullmooncny[MAXMOONS], fnewmooncny[MAXMOONS];
+ int ichinesemonths[MAXMOONS];
+ double equinoxdays[2], solsticedays[2];
+ int *monthdays;
+ struct yearinfo *next;
+} *years, *yearinfo;
+
+/*
+ * Calculate dates with offset from weekdays, like Thurs-3, Wed+2, etc.
+ * day is the day of the week,
+ * offset the ordinal number of the weekday in the month.
+ */
+static int
+wdayom (int day, int offset, int month, int year)
+{
+/* Weekday of first day in month */
+ int wday1; /* first day of month */
+/* Weekday of last day in month */
+ int wdayn;
+ int d;
+
+ wday1 = first_dayofweek_of_month(year, month);
+ if (wday1 < 0) /* not set */
+ return (wday1);
+ /*
+ * Date of zeroth or first of our weekday in month, depending on the
+ * relationship with the first of the month. The range is -6:6.
+ */
+ d = (day - wday1 + 1) % 7;
+ /*
+ * Which way are we counting? Offset 0 is invalid, abs (offset) > 5 is
+ * meaningless, but that's OK. Offset 5 may or may not be meaningless,
+ * so there's no point in complaining for complaining's sake.
+ */
+ if (offset < 0) { /* back from end of month */
+ /* FIXME */
+ wdayn = d;
+ while (wdayn <= yearinfo->monthdays[month])
+ wdayn += 7;
+ d = offset * 7 + wdayn;
+ } else if (offset > 0){
+ if (d > 0)
+ d += offset * 7 - 7;
+ else
+ d += offset * 7;
+ } else
+ warnx ("Invalid offset 0");
+ return (d);
+}
+
+/*
+ * Possible date formats include any combination of:
+ * 3-charmonth (January, Jan, Jan)
+ * 3-charweekday (Friday, Monday, mon.)
+ * numeric month or day (1, 2, 04)
+ *
+ * Any character may separate them, or they may not be separated. Any line,
+ * following a line that is matched, that starts with "whitespace", is shown
+ * along with the matched line.
+ */
+int
+parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
+ char **edp)
+{
+ char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100];
+ char syear[100];
+ char modifierindex[100], specialday[100];
+ int idayofweek = -1, imonth = -1, idayofmonth = -1, iyear = -1;
+ int year, remindex;
+ int d, m, dow, rm, rd, offset;
+ char *ed;
+ int retvalsign = 1;
+
+ /*
+ * CONVENTION
+ *
+ * Month: 1-12
+ * Monthname: Jan .. Dec
+ * Day: 1-31
+ * Weekday: Mon .. Sun
+ *
+ */
+
+ *flags = 0;
+
+ if (debug)
+ debug_determinestyle(1, date, *flags, month, imonth,
+ dayofmonth, idayofmonth, dayofweek, idayofweek,
+ modifieroffset, modifierindex, specialday, syear, iyear);
+ if (determinestyle(date, flags, month, &imonth, dayofmonth,
+ &idayofmonth, dayofweek, &idayofweek, modifieroffset,
+ modifierindex, specialday, syear, &iyear) == 0) {
+ if (debug)
+ printf("Failed!\n");
+ return (0);
+ }
+
+ if (debug)
+ debug_determinestyle(0, date, *flags, month, imonth,
+ dayofmonth, idayofmonth, dayofweek, idayofweek,
+ modifieroffset, modifierindex, specialday, syear, iyear);
+
+ remindex = 0;
+ for (year = year1; year <= year2; year++) {
+
+ int lflags = *flags;
+ /* If the year is specified, only do it if it is this year! */
+ if ((lflags & F_YEAR) != 0)
+ if (iyear != year)
+ continue;
+ lflags &= ~F_YEAR;
+
+ /* Get important dates for this year */
+ yearinfo = years;
+ while (yearinfo != NULL) {
+ if (yearinfo->year == year)
+ break;
+ yearinfo = yearinfo -> next;
+ }
+ if (yearinfo == NULL) {
+ yearinfo = (struct yearinfo *)calloc(1,
+ sizeof(struct yearinfo));
+ if (yearinfo == NULL)
+ errx(1, "Unable to allocate more years");
+ yearinfo->year = year;
+ yearinfo->next = years;
+ years = yearinfo;
+
+ yearinfo->monthdays = monthdaytab[isleap(year)];
+ yearinfo->ieaster = easter(year);
+ yearinfo->ipaskha = paskha(year);
+ fpom(year, UTCOffset, yearinfo->ffullmoon,
+ yearinfo->fnewmoon);
+ fpom(year, UTCOFFSET_CNY, yearinfo->ffullmooncny,
+ yearinfo->fnewmooncny);
+ fequinoxsolstice(year, UTCOffset,
+ yearinfo->equinoxdays, yearinfo->solsticedays);
+
+ /*
+ * CNY: Match day with sun longitude at 330` with new
+ * moon
+ */
+ yearinfo->firstcnyday = calculatesunlongitude30(year,
+ UTCOFFSET_CNY, yearinfo->ichinesemonths);
+ for (m = 0; yearinfo->fnewmooncny[m] >= 0; m++) {
+ if (yearinfo->fnewmooncny[m] >
+ yearinfo->firstcnyday) {
+ yearinfo->firstcnyday =
+ floor(yearinfo->fnewmooncny[m - 1]);
+ break;
+ }
+ }
+ }
+
+ /* Same day every year */
+ if (lflags == (F_MONTH | F_DAYOFMONTH)) {
+ if (!remember_ymd(year, imonth, idayofmonth))
+ continue;
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, imonth, idayofmonth, NULL);
+ continue;
+ }
+
+ /* XXX Same day every year, but variable */
+ if (lflags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) {
+ if (!remember_ymd(year, imonth, idayofmonth))
+ continue;
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, imonth, idayofmonth, NULL);
+ continue;
+ }
+
+ /* Same day every month */
+ if (lflags == (F_ALLMONTH | F_DAYOFMONTH)) {
+ for (m = 1; m <= 12; m++) {
+ if (!remember_ymd(year, m, idayofmonth))
+ continue;
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, m, idayofmonth, NULL);
+ }
+ continue;
+ }
+
+ /* Every day of a month */
+ if (lflags == (F_ALLDAY | F_MONTH)) {
+ for (d = 1; d <= yearinfo->monthdays[imonth]; d++) {
+ if (!remember_ymd(year, imonth, d))
+ continue;
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, imonth, d, NULL);
+ }
+ continue;
+ }
+
+ /* One day of every month */
+ if (lflags == (F_ALLMONTH | F_DAYOFWEEK)) {
+ for (m = 1; m <= 12; m++) {
+ if (!remember_ymd(year, m, idayofmonth))
+ continue;
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, m, idayofmonth, NULL);
+ }
+ continue;
+ }
+
+ /* Every dayofweek of the year */
+ if (lflags == (F_DAYOFWEEK | F_VARIABLE)) {
+ dow = first_dayofweek_of_year(year);
+ d = (idayofweek - dow + 8) % 7;
+ while (d <= 366) {
+ if (remember_yd(year, d, &rm, &rd))
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, rm, rd, NULL);
+ d += 7;
+ }
+ continue;
+ }
+
+ /*
+ * Every so-manied dayofweek of every month of the year:
+ * Thu-3
+ */
+ if (lflags == (F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
+ offset = indextooffset(modifierindex);
+
+ for (m = 0; m <= 12; m++) {
+ d = wdayom (idayofweek, offset, m, year);
+ if (remember_ymd(year, m, d)) {
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, m, d, NULL);
+ continue;
+ }
+ }
+ continue;
+ }
+
+ /*
+ * A certain dayofweek of a month
+ * Jan/Thu-3
+ */
+ if (lflags ==
+ (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
+ offset = indextooffset(modifierindex);
+ dow = first_dayofweek_of_month(year, imonth);
+ d = (idayofweek - dow + 8) % 7;
+
+ if (offset > 0) {
+ while (d <= yearinfo->monthdays[imonth]) {
+ if (--offset == 0
+ && remember_ymd(year, imonth, d)) {
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, imonth, d, NULL);
+ continue;
+ }
+ d += 7;
+ }
+ continue;
+ }
+ if (offset < 0) {
+ while (d <= yearinfo->monthdays[imonth])
+ d += 7;
+ while (offset != 0) {
+ offset++;
+ d -= 7;
+ }
+ if (remember_ymd(year, imonth, d))
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, imonth, d, NULL);
+ continue;
+ }
+ continue;
+ }
+
+ /* Every dayofweek of the month */
+ if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) {
+ dow = first_dayofweek_of_month(year, imonth);
+ d = (idayofweek - dow + 8) % 7;
+ while (d <= yearinfo->monthdays[imonth]) {
+ if (remember_ymd(year, imonth, d))
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, imonth, d, NULL);
+ d += 7;
+ }
+ continue;
+ }
+
+ /* Easter */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_EASTER)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year, yearinfo->ieaster + offset,
+ &rm, &rd))
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, NULL);
+ continue;
+ }
+
+ /* Paskha */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_PASKHA)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year, yearinfo->ipaskha + offset,
+ &rm, &rd))
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, NULL);
+ continue;
+ }
+
+ /* Chinese New Year */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_CNY)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year, yearinfo->firstcnyday + offset,
+ &rm, &rd))
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, NULL);
+ continue;
+ }
+
+ /* FullMoon */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_FULLMOON)) {
+ int i;
+
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ for (i = 0; yearinfo->ffullmoon[i] > 0; i++) {
+ if (remember_yd(year,
+ floor(yearinfo->ffullmoon[i]) + offset,
+ &rm, &rd)) {
+ ed = floattotime(
+ yearinfo->ffullmoon[i]);
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ }
+ continue;
+ }
+
+ /* NewMoon */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_NEWMOON)) {
+ int i;
+
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ for (i = 0; yearinfo->ffullmoon[i] > 0; i++) {
+ if (remember_yd(year,
+ floor(yearinfo->fnewmoon[i]) + offset,
+ &rm, &rd)) {
+ ed = floattotime(yearinfo->fnewmoon[i]);
+ remember(&remindex,
+ yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ }
+ continue;
+ }
+
+ /* (Mar|Sep)Equinox */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_MAREQUINOX)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year, yearinfo->equinoxdays[0] + offset,
+ &rm, &rd)) {
+ ed = floattotime(yearinfo->equinoxdays[0]);
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ continue;
+ }
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_SEPEQUINOX)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year, yearinfo->equinoxdays[1] + offset,
+ &rm, &rd)) {
+ ed = floattotime(yearinfo->equinoxdays[1]);
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ continue;
+ }
+
+ /* (Jun|Dec)Solstice */
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_JUNSOLSTICE)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year,
+ yearinfo->solsticedays[0] + offset, &rm, &rd)) {
+ ed = floattotime(yearinfo->solsticedays[0]);
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ continue;
+ }
+ if ((lflags & ~F_MODIFIEROFFSET) ==
+ (F_SPECIALDAY | F_VARIABLE | F_DECSOLSTICE)) {
+ offset = 0;
+ if ((lflags & F_MODIFIEROFFSET) != 0)
+ offset = parseoffset(modifieroffset);
+ if (remember_yd(year,
+ yearinfo->solsticedays[1] + offset, &rm, &rd)) {
+ ed = floattotime(yearinfo->solsticedays[1]);
+ remember(&remindex, yearp, monthp, dayp, edp,
+ year, rm, rd, ed);
+ }
+ continue;
+ }
+
+ if (debug) {
+ printf("Unprocessed:\n");
+ debug_determinestyle(2, date, lflags, month, imonth,
+ dayofmonth, idayofmonth, dayofweek, idayofweek,
+ modifieroffset, modifierindex, specialday, syear,
+ iyear);
+ }
+ retvalsign = -1;
+ }
+
+ if (retvalsign == -1)
+ return (-remindex - 1);
+ else
+ return (remindex);
+}
+
+static char *
+showflags(int flags)
+{
+ static char s[1000];
+ s[0] = '\0';
+
+ if ((flags & F_YEAR) != 0)
+ strcat(s, "year ");
+ if ((flags & F_MONTH) != 0)
+ strcat(s, "month ");
+ if ((flags & F_DAYOFWEEK) != 0)
+ strcat(s, "dayofweek ");
+ if ((flags & F_DAYOFMONTH) != 0)
+ strcat(s, "dayofmonth ");
+ if ((flags & F_MODIFIERINDEX) != 0)
+ strcat(s, "modifierindex ");
+ if ((flags & F_MODIFIEROFFSET) != 0)
+ strcat(s, "modifieroffset ");
+ if ((flags & F_SPECIALDAY) != 0)
+ strcat(s, "specialday ");
+ if ((flags & F_ALLMONTH) != 0)
+ strcat(s, "allmonth ");
+ if ((flags & F_ALLDAY) != 0)
+ strcat(s, "allday ");
+ if ((flags & F_VARIABLE) != 0)
+ strcat(s, "variable ");
+ if ((flags & F_CNY) != 0)
+ strcat(s, "chinesenewyear ");
+ if ((flags & F_PASKHA) != 0)
+ strcat(s, "paskha ");
+ if ((flags & F_EASTER) != 0)
+ strcat(s, "easter ");
+ if ((flags & F_FULLMOON) != 0)
+ strcat(s, "fullmoon ");
+ if ((flags & F_NEWMOON) != 0)
+ strcat(s, "newmoon ");
+ if ((flags & F_MAREQUINOX) != 0)
+ strcat(s, "marequinox ");
+ if ((flags & F_SEPEQUINOX) != 0)
+ strcat(s, "sepequinox ");
+ if ((flags & F_JUNSOLSTICE) != 0)
+ strcat(s, "junsolstice ");
+ if ((flags & F_DECSOLSTICE) != 0)
+ strcat(s, "decsolstice ");
+
+ return s;
+}
+
+static const char *
+getmonthname(int i)
+{
+ if (i <= 0 || i > 12)
+ return ("");
+ if (nmonths[i - 1].len != 0 && nmonths[i - 1].name != NULL)
+ return (nmonths[i - 1].name);
+ return (months[i - 1]);
+}
+
+static int
+checkmonth(char *s, size_t *len, size_t *offset, const char **month)
+{
+ struct fixs *n;
+ int i;
+
+ for (i = 0; fnmonths[i].name != NULL; i++) {
+ n = fnmonths + i;
+ if (strncasecmp(s, n->name, n->len) == 0) {
+ *len = n->len;
+ *month = n->name;
+ *offset = i + 1;
+ return (1);
+ }
+ }
+ for (i = 0; nmonths[i].name != NULL; i++) {
+ n = nmonths + i;
+ if (strncasecmp(s, n->name, n->len) == 0) {
+ *len = n->len;
+ *month = n->name;
+ *offset = i + 1;
+ return (1);
+ }
+ }
+ for (i = 0; fmonths[i] != NULL; i++) {
+ *len = strlen(fmonths[i]);
+ if (strncasecmp(s, fmonths[i], *len) == 0) {
+ *month = fmonths[i];
+ *offset = i + 1;
+ return (1);
+ }
+ }
+ for (i = 0; months[i] != NULL; i++) {
+ if (strncasecmp(s, months[i], 3) == 0) {
+ *len = 3;
+ *month = months[i];
+ *offset = i + 1;
+ return (1);
+ }
+ }
+ return (0);
+}
+
+static const char *
+getdayofweekname(int i)
+{
+ if (ndays[i].len != 0 && ndays[i].name != NULL)
+ return (ndays[i].name);
+ return (days[i]);
+}
+
+static int
+checkdayofweek(char *s, size_t *len, size_t *offset, const char **dow)
+{
+ struct fixs *n;
+ int i;
+
+ for (i = 0; fndays[i].name != NULL; i++) {
+ n = fndays + i;
+ if (strncasecmp(s, n->name, n->len) == 0) {
+ *len = n->len;
+ *dow = n->name;
+ *offset = i;
+ return (1);
+ }
+ }
+ for (i = 0; ndays[i].name != NULL; i++) {
+ n = ndays + i;
+ if (strncasecmp(s, n->name, n->len) == 0) {
+ *len = n->len;
+ *dow = n->name;
+ *offset = i;
+ return (1);
+ }
+ }
+ for (i = 0; fdays[i] != NULL; i++) {
+ *len = strlen(fdays[i]);
+ if (strncasecmp(s, fdays[i], *len) == 0) {
+ *dow = fdays[i];
+ *offset = i;
+ return (1);
+ }
+ }
+ for (i = 0; days[i] != NULL; i++) {
+ if (strncasecmp(s, days[i], 3) == 0) {
+ *len = 3;
+ *dow = days[i];
+ *offset = i;
+ return (1);
+ }
+ }
+ return (0);
+}
+
+static int
+isonlydigits(char *s, int nostar)
+{
+ int i;
+ for (i = 0; s[i] != '\0'; i++) {
+ if (nostar == 0 && s[i] == '*' && s[i + 1] == '\0')
+ return 1;
+ if (!isdigit((unsigned char)s[i]))
+ return (0);
+ }
+ return (1);
+}
+
+static int
+indextooffset(char *s)
+{
+ int i;
+ struct fixs *n;
+ char *es;
+
+ if (s[0] == '+' || s[0] == '-') {
+ i = strtol (s, &es, 10);
+ if (*es != '\0') /* trailing junk */
+ errx (1, "Invalid specifier format: %s\n", s);
+ return (i);
+ }
+
+ for (i = 0; i < 6; i++) {
+ if (strcasecmp(s, sequences[i]) == 0) {
+ if (i == 5)
+ return (-1);
+ return (i + 1);
+ }
+ }
+ for (i = 0; i < 6; i++) {
+ n = nsequences + i;
+ if (n->len == 0)
+ continue;
+ if (strncasecmp(s, n->name, n->len) == 0) {
+ if (i == 5)
+ return (-1);
+ return (i + 1);
+ }
+ }
+ return (0);
+}
+
+static int
+parseoffset(char *s)
+{
+ return strtol(s, NULL, 10);
+}
+
+static char *
+floattotime(double f)
+{
+ static char buf[100];
+ int hh, mm, ss, i;
+
+ f -= floor(f);
+ i = f * SECSPERDAY;
+
+ hh = i / SECSPERHOUR;
+ i %= SECSPERHOUR;
+ mm = i / SECSPERMINUTE;
+ i %= SECSPERMINUTE;
+ ss = i;
+
+ sprintf(buf, "%02d:%02d:%02d", hh, mm, ss);
+ return (buf);
+}
+
+static char *
+floattoday(int year, double f)
+{
+ static char buf[100];
+ int i, m, d, hh, mm, ss;
+ int *cumdays = cumdaytab[isleap(year)];
+
+ for (i = 0; 1 + cumdays[i] < f; i++)
+ ;
+ m = --i;
+ d = floor(f - 1 - cumdays[i]);
+ f -= floor(f);
+ i = f * SECSPERDAY;
+
+ hh = i / SECSPERHOUR;
+ i %= SECSPERHOUR;
+ mm = i / SECSPERMINUTE;
+ i %= SECSPERMINUTE;
+ ss = i;
+
+ sprintf(buf, "%02d-%02d %02d:%02d:%02d", m, d, hh, mm, ss);
+ return (buf);
+}
+
+void
+dodebug(char *what)
+{
+ int year;
+
+ printf("UTCOffset: %g\n", UTCOffset);
+ printf("eastlongitude: %d\n", EastLongitude);
+
+ if (strcmp(what, "moon") == 0) {
+ double ffullmoon[MAXMOONS], fnewmoon[MAXMOONS];
+ int i;
+
+ for (year = year1; year <= year2; year++) {
+ fpom(year, UTCOffset, ffullmoon, fnewmoon);
+ printf("Full moon %d:\t", year);
+ for (i = 0; ffullmoon[i] >= 0; i++) {
+ printf("%g (%s) ", ffullmoon[i],
+ floattoday(year, ffullmoon[i]));
+ }
+ printf("\nNew moon %d:\t", year);
+ for (i = 0; fnewmoon[i] >= 0; i++) {
+ printf("%g (%s) ", fnewmoon[i],
+ floattoday(year, fnewmoon[i]));
+ }
+ printf("\n");
+
+ }
+
+ return;
+ }
+
+ if (strcmp(what, "sun") == 0) {
+ double equinoxdays[2], solsticedays[2];
+ for (year = year1; year <= year2; year++) {
+ printf("Sun in %d:\n", year);
+ fequinoxsolstice(year, UTCOffset, equinoxdays,
+ solsticedays);
+ printf("e[0] - %g (%s)\n",
+ equinoxdays[0],
+ floattoday(year, equinoxdays[0]));
+ printf("e[1] - %g (%s)\n",
+ equinoxdays[1],
+ floattoday(year, equinoxdays[1]));
+ printf("s[0] - %g (%s)\n",
+ solsticedays[0],
+ floattoday(year, solsticedays[0]));
+ printf("s[1] - %g (%s)\n",
+ solsticedays[1],
+ floattoday(year, solsticedays[1]));
+ }
+ return;
+ }
+}
diff --git a/usr.bin/calendar/paskha.c b/usr.bin/calendar/paskha.c
new file mode 100644
index 0000000..ab369ad
--- /dev/null
+++ b/usr.bin/calendar/paskha.c
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (C) 1993-1996 by Andrey A. Chernov, Moscow, Russia.
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "calendar.h"
+
+#define PASKHA "paskha"
+#define PASKHALEN (sizeof(PASKHA) - 1)
+
+/* return difference in days between Julian and Gregorian calendars */
+int
+j2g(int year)
+{
+ return (year < 1500) ?
+ 0 :
+ 10 + (year/100 - 16) - ((year/100 - 16) / 4);
+}
+
+/* return year day for Orthodox Easter using Gauss formula */
+/* (new style result) */
+
+int
+paskha(int R) /*year*/
+{
+ int a, b, c, d, e;
+ static int x = 15;
+ static int y = 6;
+ int *cumday;
+
+ a = R % 19;
+ b = R % 4;
+ c = R % 7;
+ d = (19 * a + x) % 30;
+ e = (2 * b + 4 * c + 6 * d + y) % 7;
+ cumday = cumdaytab[isleap(R)];
+ return (((cumday[3] + 1) + 22) + (d + e) + j2g(R));
+}
diff --git a/usr.bin/calendar/pathnames.h b/usr.bin/calendar/pathnames.h
new file mode 100644
index 0000000..e5507a1
--- /dev/null
+++ b/usr.bin/calendar/pathnames.h
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <paths.h>
+
+#define _PATH_INCLUDE "/usr/share/calendar"
diff --git a/usr.bin/calendar/pom.c b/usr.bin/calendar/pom.c
new file mode 100644
index 0000000..671763a
--- /dev/null
+++ b/usr.bin/calendar/pom.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software posted to USENET.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Phase of the Moon. Calculates the current phase of the moon.
+ * Based on routines from `Practical Astronomy with Your Calculator',
+ * by Duffett-Smith. Comments give the section from the book that
+ * particular piece of code was adapted from.
+ *
+ * -- Keith E. Brandt VIII 1984
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <sysexits.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "calendar.h"
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+#define EPOCH 85
+#define EPSILONg 279.611371 /* solar ecliptic long at EPOCH */
+#define RHOg 282.680403 /* solar ecliptic long of perigee at EPOCH */
+#define ECCEN 0.01671542 /* solar orbit eccentricity */
+#define lzero 18.251907 /* lunar mean long at EPOCH */
+#define Pzero 192.917585 /* lunar mean long of perigee at EPOCH */
+#define Nzero 55.204723 /* lunar mean long of node at EPOCH */
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+
+static void adj360(double *);
+static double dtor(double);
+static double potm(double onday);
+static double potm_minute(double onday, int olddir);
+
+void
+pom(int year, double utcoffset, int *fms, int *nms)
+{
+ double ffms[MAXMOONS];
+ double fnms[MAXMOONS];
+ int i, j;
+
+ fpom(year, utcoffset, ffms, fnms);
+
+ j = 0;
+ for (i = 0; ffms[i] != 0; i++)
+ fms[j++] = round(ffms[i]);
+ fms[i] = -1;
+ for (i = 0; fnms[i] != 0; i++)
+ nms[i] = round(fnms[i]);
+ nms[i] = -1;
+}
+
+void
+fpom(int year, double utcoffset, double *ffms, double *fnms)
+{
+ time_t tt;
+ struct tm GMT, tmd_today, tmd_tomorrow;
+ double days_today, days_tomorrow, today, tomorrow;
+ int cnt, d;
+ int yeardays;
+ int olddir, newdir;
+ double *pfnms, *pffms, t;
+
+ pfnms = fnms;
+ pffms = ffms;
+
+ /*
+ * We take the phase of the moon one second before and one second
+ * after midnight.
+ */
+ memset(&tmd_today, 0, sizeof(tmd_today));
+ tmd_today.tm_year = year - 1900;
+ tmd_today.tm_mon = 0;
+ tmd_today.tm_mday = -1; /* 31 December */
+ tmd_today.tm_hour = 23;
+ tmd_today.tm_min = 59;
+ tmd_today.tm_sec = 59;
+ memset(&tmd_tomorrow, 0, sizeof(tmd_tomorrow));
+ tmd_tomorrow.tm_year = year - 1900;
+ tmd_tomorrow.tm_mon = 0;
+ tmd_tomorrow.tm_mday = 0; /* 01 January */
+ tmd_tomorrow.tm_hour = 0;
+ tmd_tomorrow.tm_min = 0;
+ tmd_tomorrow.tm_sec = 1;
+
+ tt = mktime(&tmd_today);
+ gmtime_r(&tt, &GMT);
+ yeardays = 0;
+ for (cnt = EPOCH; cnt < GMT.tm_year; ++cnt)
+ yeardays += isleap(1900 + cnt) ? DAYSPERLEAPYEAR : DAYSPERYEAR;
+ days_today = (GMT.tm_yday + 1) + ((GMT.tm_hour +
+ (GMT.tm_min / FSECSPERMINUTE) + (GMT.tm_sec / FSECSPERHOUR)) /
+ FHOURSPERDAY);
+ days_today += yeardays;
+
+ tt = mktime(&tmd_tomorrow);
+ gmtime_r(&tt, &GMT);
+ yeardays = 0;
+ for (cnt = EPOCH; cnt < GMT.tm_year; ++cnt)
+ yeardays += isleap(1900 + cnt) ? DAYSPERLEAPYEAR : DAYSPERYEAR;
+ days_tomorrow = (GMT.tm_yday + 1) + ((GMT.tm_hour +
+ (GMT.tm_min / FSECSPERMINUTE) + (GMT.tm_sec / FSECSPERHOUR)) /
+ FHOURSPERDAY);
+ days_tomorrow += yeardays;
+
+ today = potm(days_today); /* 30 December 23:59:59 */
+ tomorrow = potm(days_tomorrow); /* 31 December 00:00:01 */
+ olddir = today > tomorrow ? -1 : +1;
+
+ yeardays = 1 + (isleap(year) ? DAYSPERLEAPYEAR : DAYSPERYEAR); /* reuse */
+ for (d = 0; d <= yeardays; d++) {
+ today = potm(days_today);
+ tomorrow = potm(days_tomorrow);
+ newdir = today > tomorrow ? -1 : +1;
+ if (olddir != newdir) {
+ t = potm_minute(days_today - 1, olddir) +
+ utcoffset / FHOURSPERDAY;
+ if (olddir == -1 && newdir == +1) {
+ *pfnms = d - 1 + t;
+ pfnms++;
+ } else if (olddir == +1 && newdir == -1) {
+ *pffms = d - 1 + t;
+ pffms++;
+ }
+ }
+ olddir = newdir;
+ days_today++;
+ days_tomorrow++;
+ }
+ *pffms = -1;
+ *pfnms = -1;
+}
+
+static double
+potm_minute(double onday, int olddir) {
+ double period = FSECSPERDAY / 2.0;
+ double p1, p2;
+ double before, after;
+ int newdir;
+
+// printf("---> days:%g olddir:%d\n", days, olddir);
+
+ p1 = onday + (period / SECSPERDAY);
+ period /= 2;
+
+ while (period > 30) { /* half a minute */
+// printf("period:%g - p1:%g - ", period, p1);
+ p2 = p1 + (2.0 / SECSPERDAY);
+ before = potm(p1);
+ after = potm(p2);
+// printf("before:%10.10g - after:%10.10g\n", before, after);
+ newdir = before < after ? -1 : +1;
+ if (olddir != newdir)
+ p1 += (period / SECSPERDAY);
+ else
+ p1 -= (period / SECSPERDAY);
+ period /= 2;
+// printf("newdir:%d - p1:%10.10f - period:%g\n",
+// newdir, p1, period);
+ }
+ p1 -= floor(p1);
+ //exit(0);
+ return (p1);
+}
+
+/*
+ * potm --
+ * return phase of the moon, as a percentage [0 ... 100]
+ */
+static double
+potm(double onday)
+{
+ double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime;
+ double A4, lprime, V, ldprime, D, Nm;
+
+ N = 360 * onday / 365.2422; /* sec 42 #3 */
+ adj360(&N);
+ Msol = N + EPSILONg - RHOg; /* sec 42 #4 */
+ adj360(&Msol);
+ Ec = 360 / PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */
+ LambdaSol = N + Ec + EPSILONg; /* sec 42 #6 */
+ adj360(&LambdaSol);
+ l = 13.1763966 * onday + lzero; /* sec 61 #4 */
+ adj360(&l);
+ Mm = l - (0.1114041 * onday) - Pzero; /* sec 61 #5 */
+ adj360(&Mm);
+ Nm = Nzero - (0.0529539 * onday); /* sec 61 #6 */
+ adj360(&Nm);
+ Ev = 1.2739 * sin(dtor(2*(l - LambdaSol) - Mm)); /* sec 61 #7 */
+ Ac = 0.1858 * sin(dtor(Msol)); /* sec 61 #8 */
+ A3 = 0.37 * sin(dtor(Msol));
+ Mmprime = Mm + Ev - Ac - A3; /* sec 61 #9 */
+ Ec = 6.2886 * sin(dtor(Mmprime)); /* sec 61 #10 */
+ A4 = 0.214 * sin(dtor(2 * Mmprime)); /* sec 61 #11 */
+ lprime = l + Ev + Ec - Ac + A4; /* sec 61 #12 */
+ V = 0.6583 * sin(dtor(2 * (lprime - LambdaSol))); /* sec 61 #13 */
+ ldprime = lprime + V; /* sec 61 #14 */
+ D = ldprime - LambdaSol; /* sec 63 #2 */
+ return(50 * (1 - cos(dtor(D)))); /* sec 63 #3 */
+}
+
+/*
+ * dtor --
+ * convert degrees to radians
+ */
+static double
+dtor(double deg)
+{
+
+ return(deg * PI / 180);
+}
+
+/*
+ * adj360 --
+ * adjust value so 0 <= deg <= 360
+ */
+static void
+adj360(double *deg)
+{
+
+ for (;;)
+ if (*deg < 0)
+ *deg += 360;
+ else if (*deg > 360)
+ *deg -= 360;
+ else
+ break;
+}
diff --git a/usr.bin/calendar/sunpos.c b/usr.bin/calendar/sunpos.c
new file mode 100644
index 0000000..f905c3f
--- /dev/null
+++ b/usr.bin/calendar/sunpos.c
@@ -0,0 +1,448 @@
+/*-
+ * Copyright (c) 2009-2010 Edwin Groothuis <edwin@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$");
+
+/*
+ * This code is created to match the formulas available at:
+ * Formula and examples obtained from "How to Calculate alt/az: SAAO" at
+ * http://www.saao.ac.za/public-info/sun-moon-stars/sun-index/how-to-calculate-altaz/
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#include "calendar.h"
+
+#define D2R(m) ((m) / 180 * M_PI)
+#define R2D(m) ((m) * 180 / M_PI)
+
+#define SIN(x) (sin(D2R(x)))
+#define COS(x) (cos(D2R(x)))
+#define TAN(x) (tan(D2R(x)))
+#define ASIN(x) (R2D(asin(x)))
+#define ATAN(x) (R2D(atan(x)))
+
+#ifdef NOTDEF
+static void
+comp(char *s, double v, double c)
+{
+
+ printf("%-*s %*g %*g %*g\n", 15, s, 15, v, 15, c, 15, v - c);
+}
+
+int expY;
+double expZJ = 30.5;
+double expUTHM = 8.5;
+double expD = 34743.854;
+double expT = 0.9512349;
+double expL = 324.885;
+double expM = 42.029;
+double expepsilon = 23.4396;
+double explambda = 326.186;
+double expalpha = 328.428;
+double expDEC = -12.789;
+double expeastlongitude = 17.10;
+double explatitude = -22.57;
+double expHA = -37.673;
+double expALT = 49.822;
+double expAZ = 67.49;
+#endif
+
+static double
+fixup(double *d)
+{
+
+ if (*d < 0) {
+ while (*d < 0)
+ *d += 360;
+ } else {
+ while (*d > 360)
+ *d -= 360;
+ }
+
+ return (*d);
+}
+
+static double ZJtable[] = {
+ 0, -0.5, 30.5, 58.5, 89.5, 119.5, 150.5, 180.5, 211.5, 242.5, 272.5, 303.5, 333.5 };
+
+static void
+sunpos(int inYY, int inMM, int inDD, double UTCOFFSET, int inHOUR, int inMIN,
+ int inSEC, double eastlongitude, double latitude, double *L, double *DEC)
+{
+ int Y;
+ double ZJ, D, T, M, epsilon, lambda, alpha, HA, UTHM;
+
+ ZJ = ZJtable[inMM];
+ if (inMM <= 2 && isleap(inYY))
+ ZJ -= 1.0;
+
+ UTHM = inHOUR + inMIN / FMINSPERHOUR + inSEC / FSECSPERHOUR - UTCOFFSET;
+ Y = inYY - 1900; /* 1 */
+ D = floor(365.25 * Y) + ZJ + inDD + UTHM / FHOURSPERDAY; /* 3 */
+ T = D / 36525.0; /* 4 */
+ *L = 279.697 + 36000.769 * T; /* 5 */
+ fixup(L);
+ M = 358.476 + 35999.050 * T; /* 6 */
+ fixup(&M);
+ epsilon = 23.452 - 0.013 * T; /* 7 */
+ fixup(&epsilon);
+
+ lambda = *L + (1.919 - 0.005 * T) * SIN(M) + 0.020 * SIN(2 * M);/* 8 */
+ fixup(&lambda);
+ alpha = ATAN(TAN(lambda) * COS(epsilon)); /* 9 */
+
+ /* Alpha should be in the same quadrant as lamba */
+ {
+ int lssign = sin(D2R(lambda)) < 0 ? -1 : 1;
+ int lcsign = cos(D2R(lambda)) < 0 ? -1 : 1;
+ while (((sin(D2R(alpha)) < 0) ? -1 : 1) != lssign
+ || ((cos(D2R(alpha)) < 0) ? -1 : 1) != lcsign)
+ alpha += 90.0;
+ }
+ fixup(&alpha);
+
+ *DEC = ASIN(SIN(lambda) * SIN(epsilon)); /* 10 */
+ fixup(DEC);
+ fixup(&eastlongitude);
+ HA = *L - alpha + 180 + 15 * UTHM + eastlongitude; /* 12 */
+ fixup(&HA);
+ fixup(&latitude);
+#ifdef NOTDEF
+ printf("%02d/%02d %02d:%02d:%02d l:%g d:%g h:%g\n",
+ inMM, inDD, inHOUR, inMIN, inSEC, latitude, *DEC, HA);
+#endif
+ return;
+
+ /*
+ * The following calculations are not used, so to save time
+ * they are not calculated.
+ */
+#ifdef NOTDEF
+ *ALT = ASIN(SIN(latitude) * SIN(*DEC) +
+ COS(latitude) * COS(*DEC) * COS(HA)); /* 13 */
+ fixup(ALT);
+ *AZ = ATAN(SIN(HA) /
+ (COS(HA) * SIN(latitude) - TAN(*DEC) * COS(latitude))); /* 14 */
+
+ if (*ALT > 180)
+ *ALT -= 360;
+ if (*ALT < -180)
+ *ALT += 360;
+ printf("a:%g a:%g\n", *ALT, *AZ);
+#endif
+
+#ifdef NOTDEF
+ printf("Y:\t\t\t %d\t\t %d\t\t %d\n", Y, expY, Y - expY);
+ comp("ZJ", ZJ, expZJ);
+ comp("UTHM", UTHM, expUTHM);
+ comp("D", D, expD);
+ comp("T", T, expT);
+ comp("L", L, fixup(&expL));
+ comp("M", M, fixup(&expM));
+ comp("epsilon", epsilon, fixup(&expepsilon));
+ comp("lambda", lambda, fixup(&explambda));
+ comp("alpha", alpha, fixup(&expalpha));
+ comp("DEC", DEC, fixup(&expDEC));
+ comp("eastlongitude", eastlongitude, fixup(&expeastlongitude));
+ comp("latitude", latitude, fixup(&explatitude));
+ comp("HA", HA, fixup(&expHA));
+ comp("ALT", ALT, fixup(&expALT));
+ comp("AZ", AZ, fixup(&expAZ));
+#endif
+}
+
+
+#define SIGN(a) (((a) > 180) ? -1 : 1)
+#define ANGLE(a, b) (((a) < (b)) ? 1 : -1)
+#define SHOUR(s) ((s) / 3600)
+#define SMIN(s) (((s) % 3600) / 60)
+#define SSEC(s) ((s) % 60)
+#define HOUR(h) ((h) / 4)
+#define MIN(h) (15 * ((h) % 4))
+#define SEC(h) 0
+#define DEBUG1(y, m, d, hh, mm, pdec, dec) \
+ printf("%4d-%02d-%02d %02d:%02d:00 - %7.7g -> %7.7g\n", \
+ y, m, d, hh, mm, pdec, dec)
+#define DEBUG2(y, m, d, hh, mm, pdec, dec, pang, ang) \
+ printf("%4d-%02d-%02d %02d:%02d:00 - %7.7g -> %7.7g - %d -> %d\n", \
+ y, m, d, hh, mm, pdec, dec, pang, ang)
+void
+equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int *solsticedays)
+{
+ double fe[2], fs[2];
+
+ fequinoxsolstice(year, UTCoffset, fe, fs);
+ equinoxdays[0] = round(fe[0]);
+ equinoxdays[1] = round(fe[1]);
+ solsticedays[0] = round(fs[0]);
+ solsticedays[1] = round(fs[1]);
+}
+
+void
+fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays)
+{
+ double dec, prevdec, L;
+ int h, d, prevangle, angle;
+ int found = 0;
+
+ double decleft, decright, decmiddle;
+ int dial, s;
+
+ int *cumdays;
+ cumdays = cumdaytab[isleap(year)];
+
+ /*
+ * Find the first equinox, somewhere in March:
+ * It happens when the returned value "dec" goes from
+ * [350 ... 360> -> [0 ... 10]
+ */
+ for (d = 18; d < 31; d++) {
+ /* printf("Comparing day %d to %d.\n", d, d+1); */
+ sunpos(year, 3, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft);
+ sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0,
+ &L, &decright);
+ /* printf("Found %g and %g.\n", decleft, decright); */
+ if (SIGN(decleft) == SIGN(decright))
+ continue;
+
+ dial = SECSPERDAY;
+ s = SECSPERDAY / 2;
+ while (s > 0) {
+ /* printf("Obtaining %d (%02d:%02d)\n",
+ dial, SHOUR(dial), SMIN(dial)); */
+ sunpos(year, 3, d, UTCoffset,
+ SHOUR(dial), SMIN(dial), SSEC(dial),
+ 0.0, 0.0, &L, &decmiddle);
+ /* printf("Found %g\n", decmiddle); */
+ if (SIGN(decleft) == SIGN(decmiddle)) {
+ decleft = decmiddle;
+ dial += s;
+ } else {
+ decright = decmiddle;
+ dial -= s;
+ }
+ /*
+ printf("New boundaries: %g - %g\n", decleft, decright);
+ */
+
+ s /= 2;
+ }
+ equinoxdays[0] = 1 + cumdays[3] + d + (dial / FSECSPERDAY);
+ break;
+ }
+
+ /* Find the second equinox, somewhere in September:
+ * It happens when the returned value "dec" goes from
+ * [10 ... 0] -> <360 ... 350]
+ */
+ for (d = 18; d < 31; d++) {
+ /* printf("Comparing day %d to %d.\n", d, d+1); */
+ sunpos(year, 9, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft);
+ sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0,
+ &L, &decright);
+ /* printf("Found %g and %g.\n", decleft, decright); */
+ if (SIGN(decleft) == SIGN(decright))
+ continue;
+
+ dial = SECSPERDAY;
+ s = SECSPERDAY / 2;
+ while (s > 0) {
+ /* printf("Obtaining %d (%02d:%02d)\n",
+ dial, SHOUR(dial), SMIN(dial)); */
+ sunpos(year, 9, d, UTCoffset,
+ SHOUR(dial), SMIN(dial), SSEC(dial),
+ 0.0, 0.0, &L, &decmiddle);
+ /* printf("Found %g\n", decmiddle); */
+ if (SIGN(decleft) == SIGN(decmiddle)) {
+ decleft = decmiddle;
+ dial += s;
+ } else {
+ decright = decmiddle;
+ dial -= s;
+ }
+ /*
+ printf("New boundaries: %g - %g\n", decleft, decright);
+ */
+
+ s /= 2;
+ }
+ equinoxdays[1] = 1 + cumdays[9] + d + (dial / FSECSPERDAY);
+ break;
+ }
+
+ /*
+ * Find the first solstice, somewhere in June:
+ * It happens when the returned value "dec" peaks
+ * [40 ... 45] -> [45 ... 40]
+ */
+ found = 0;
+ prevdec = 0;
+ prevangle = 1;
+ for (d = 18; d < 31; d++) {
+ for (h = 0; h < 4 * HOURSPERDAY; h++) {
+ sunpos(year, 6, d, UTCoffset, HOUR(h), MIN(h), SEC(h),
+ 0.0, 0.0, &L, &dec);
+ angle = ANGLE(prevdec, dec);
+ if (prevangle != angle) {
+#ifdef NOTDEF
+ DEBUG2(year, 6, d, HOUR(h), MIN(h),
+ prevdec, dec, prevangle, angle);
+#endif
+ solsticedays[0] = 1 + cumdays[6] + d +
+ ((h / 4.0) / 24.0);
+ found = 1;
+ break;
+ }
+ prevdec = dec;
+ prevangle = angle;
+ }
+ if (found)
+ break;
+ }
+
+ /*
+ * Find the second solstice, somewhere in December:
+ * It happens when the returned value "dec" peaks
+ * [315 ... 310] -> [310 ... 315]
+ */
+ found = 0;
+ prevdec = 360;
+ prevangle = -1;
+ for (d = 18; d < 31; d++) {
+ for (h = 0; h < 4 * HOURSPERDAY; h++) {
+ sunpos(year, 12, d, UTCoffset, HOUR(h), MIN(h), SEC(h),
+ 0.0, 0.0, &L, &dec);
+ angle = ANGLE(prevdec, dec);
+ if (prevangle != angle) {
+#ifdef NOTDEF
+ DEBUG2(year, 12, d, HOUR(h), MIN(h),
+ prevdec, dec, prevangle, angle);
+#endif
+ solsticedays[1] = 1 + cumdays[12] + d +
+ ((h / 4.0) / 24.0);
+ found = 1;
+ break;
+ }
+ prevdec = dec;
+ prevangle = angle;
+ }
+ if (found)
+ break;
+ }
+
+ return;
+}
+
+int
+calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths)
+{
+ int m, d, h;
+ double dec;
+ double curL, prevL;
+ int *pichinesemonths, *monthdays, *cumdays, i;
+ int firstmonth330 = -1;
+
+ cumdays = cumdaytab[isleap(year)];
+ monthdays = monthdaytab[isleap(year)];
+ pichinesemonths = ichinesemonths;
+
+ h = 0;
+ sunpos(year - 1, 12, 31,
+ -24 * (degreeGMToffset / 360.0),
+ HOUR(h), MIN(h), SEC(h), 0.0, 0.0, &prevL, &dec);
+
+ for (m = 1; m <= 12; m++) {
+ for (d = 1; d <= monthdays[m]; d++) {
+ for (h = 0; h < 4 * HOURSPERDAY; h++) {
+ sunpos(year, m, d,
+ -24 * (degreeGMToffset / 360.0),
+ HOUR(h), MIN(h), SEC(h),
+ 0.0, 0.0, &curL, &dec);
+ if (curL < 180 && prevL > 180) {
+ *pichinesemonths = cumdays[m] + d;
+#ifdef DEBUG
+printf("%04d-%02d-%02d %02d:%02d - %d %g\n",
+ year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL);
+#endif
+ pichinesemonths++;
+ } else {
+ for (i = 0; i <= 360; i += 30)
+ if (curL > i && prevL < i) {
+ *pichinesemonths =
+ cumdays[m] + d;
+#ifdef DEBUG
+printf("%04d-%02d-%02d %02d:%02d - %d %g\n",
+ year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL);
+#endif
+ if (i == 330)
+ firstmonth330 = *pichinesemonths;
+ pichinesemonths++;
+ }
+ }
+ prevL = curL;
+ }
+ }
+ }
+ *pichinesemonths = -1;
+ return (firstmonth330);
+}
+
+#ifdef NOTDEF
+int
+main(int argc, char **argv)
+{
+/*
+ year Mar June Sept Dec
+ day time day time day time day time
+ 2004 20 06:49 21 00:57 22 16:30 21 12:42
+ 2005 20 12:33 21 06:46 22 22:23 21 18:35
+ 2006 20 18:26 21 12:26 23 04:03 22 00:22
+ 2007 21 00:07 21 18:06 23 09:51 22 06:08
+ 2008 20 05:48 20 23:59 22 15:44 21 12:04
+ 2009 20 11:44 21 05:45 22 21:18 21 17:47
+ 2010 20 17:32 21 11:28 23 03:09 21 23:38
+ 2011 20 23:21 21 17:16 23 09:04 22 05:30
+ 2012 20 05:14 20 23:09 22 14:49 21 11:11
+ 2013 20 11:02 21 05:04 22 20:44 21 17:11
+ 2014 20 16:57 21 10:51 23 02:29 21 23:03
+ 2015 20 22:45 21 16:38 23 08:20 22 04:48
+ 2016 20 04:30 20 22:34 22 14:21 21 10:44
+ 2017 20 10:28 21 04:24 22 20:02 21 16:28
+*/
+
+ int eq[2], sol[2];
+ equinoxsolstice(strtol(argv[1], NULL, 10), 0.0, eq, sol);
+ printf("%d - %d - %d - %d\n", eq[0], sol[0], eq[1], sol[1]);
+ return(0);
+}
+#endif
diff --git a/usr.bin/calendar/tests/Makefile b/usr.bin/calendar/tests/Makefile
new file mode 100644
index 0000000..4491e22
--- /dev/null
+++ b/usr.bin/calendar/tests/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= calendar.calibrate
+${PACKAGE}FILES+= regress.a1.out
+${PACKAGE}FILES+= regress.a2.out
+${PACKAGE}FILES+= regress.a3.out
+${PACKAGE}FILES+= regress.a4.out
+${PACKAGE}FILES+= regress.a5.out
+${PACKAGE}FILES+= regress.b1.out
+${PACKAGE}FILES+= regress.b2.out
+${PACKAGE}FILES+= regress.b3.out
+${PACKAGE}FILES+= regress.b4.out
+${PACKAGE}FILES+= regress.b5.out
+${PACKAGE}FILES+= regress.s1.out
+${PACKAGE}FILES+= regress.s2.out
+${PACKAGE}FILES+= regress.s3.out
+${PACKAGE}FILES+= regress.s4.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.w0-1.out
+${PACKAGE}FILES+= regress.w0-2.out
+${PACKAGE}FILES+= regress.w0-3.out
+${PACKAGE}FILES+= regress.w0-4.out
+${PACKAGE}FILES+= regress.w0-5.out
+${PACKAGE}FILES+= regress.w0-6.out
+${PACKAGE}FILES+= regress.w0-7.out
+${PACKAGE}FILES+= regress.wn-1.out
+${PACKAGE}FILES+= regress.wn-2.out
+${PACKAGE}FILES+= regress.wn-3.out
+${PACKAGE}FILES+= regress.wn-4.out
+${PACKAGE}FILES+= regress.wn-5.out
+${PACKAGE}FILES+= regress.wn-6.out
+${PACKAGE}FILES+= regress.wn-7.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/calendar/tests/Makefile.depend b/usr.bin/calendar/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/calendar/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/calendar/tests/calendar.calibrate b/usr.bin/calendar/tests/calendar.calibrate
new file mode 100644
index 0000000..28e7e4a
--- /dev/null
+++ b/usr.bin/calendar/tests/calendar.calibrate
@@ -0,0 +1,374 @@
+/*
+ * Calibration calendar for calendar(1)
+ *
+ * $FreeBSD$
+ */
+
+LANG=C
+
+01/01 jan 1
+01/02 jan 2
+01/03 jan 3
+01/04 jan 4
+01/05 jan 5
+01/06 jan 6
+01/07 jan 7
+01/08 jan 8
+01/09 jan 9
+01/10 jan 10
+01/11 jan 11
+01/12 jan 12
+01/13 jan 13
+01/14 jan 14
+01/15 jan 15
+01/16 jan 16
+01/17 jan 17
+01/18 jan 18
+01/19 jan 19
+01/20 jan 20
+01/21 jan 21
+01/22 jan 22
+01/23 jan 23
+01/24 jan 24
+01/25 jan 25
+01/26 jan 26
+01/27 jan 27
+01/28 jan 28
+01/29 jan 29
+01/30 jan 30
+01/31 jan 31
+02/01 feb 1
+02/02 feb 2
+02/03 feb 3
+02/04 feb 4
+02/05 feb 5
+02/06 feb 6
+02/07 feb 7
+02/08 feb 8
+02/09 feb 9
+02/10 feb 10
+02/11 feb 11
+02/12 feb 12
+02/13 feb 13
+02/14 feb 14
+02/15 feb 15
+02/16 feb 16
+02/17 feb 17
+02/18 feb 18
+02/19 feb 19
+02/20 feb 20
+02/21 feb 21
+02/22 feb 22
+02/23 feb 23
+02/24 feb 24
+02/25 feb 25
+02/26 feb 26
+02/27 feb 27
+02/28 feb 28
+02/29 feb 29
+03/01 mar 1
+03/02 mar 2
+03/03 mar 3
+03/04 mar 4
+03/05 mar 5
+03/06 mar 6
+03/07 mar 7
+03/08 mar 8
+03/09 mar 9
+03/10 mar 10
+03/11 mar 11
+03/12 mar 12
+03/13 mar 13
+03/14 mar 14
+03/15 mar 15
+03/16 mar 16
+03/17 mar 17
+03/18 mar 18
+03/19 mar 19
+03/20 mar 20
+03/21 mar 21
+03/22 mar 22
+03/23 mar 23
+03/24 mar 24
+03/25 mar 25
+03/26 mar 26
+03/27 mar 27
+03/28 mar 28
+03/29 mar 29
+03/30 mar 30
+03/31 mar 31
+04/01 apr 1
+04/02 apr 2
+04/03 apr 3
+04/04 apr 4
+04/05 apr 5
+04/06 apr 6
+04/07 apr 7
+04/08 apr 8
+04/09 apr 9
+04/10 apr 10
+04/11 apr 11
+04/12 apr 12
+04/13 apr 13
+04/14 apr 14
+04/15 apr 15
+04/16 apr 16
+04/17 apr 17
+04/18 apr 18
+04/19 apr 19
+04/20 apr 20
+04/21 apr 21
+04/22 apr 22
+04/23 apr 23
+04/24 apr 24
+04/25 apr 25
+04/26 apr 26
+04/27 apr 27
+04/28 apr 28
+04/29 apr 29
+04/30 apr 30
+05/01 may 1
+05/02 may 2
+05/03 may 3
+05/04 may 4
+05/05 may 5
+05/06 may 6
+05/07 may 7
+05/08 may 8
+05/09 may 9
+05/10 may 10
+05/11 may 11
+05/12 may 12
+05/13 may 13
+05/14 may 14
+05/15 may 15
+05/16 may 16
+05/17 may 17
+05/18 may 18
+05/19 may 19
+05/20 may 20
+05/21 may 21
+05/22 may 22
+05/23 may 23
+05/24 may 24
+05/25 may 25
+05/26 may 26
+05/27 may 27
+05/28 may 28
+05/29 may 29
+05/30 may 30
+05/31 may 31
+06/01 jun 1
+06/02 jun 2
+06/03 jun 3
+06/04 jun 4
+06/05 jun 5
+06/06 jun 6
+06/07 jun 7
+06/08 jun 8
+06/09 jun 9
+06/10 jun 10
+06/11 jun 11
+06/12 jun 12
+06/13 jun 13
+06/14 jun 14
+06/15 jun 15
+06/16 jun 16
+06/17 jun 17
+06/18 jun 18
+06/19 jun 19
+06/20 jun 20
+06/21 jun 21
+06/22 jun 22
+06/23 jun 23
+06/24 jun 24
+06/25 jun 25
+06/26 jun 26
+06/27 jun 27
+06/28 jun 28
+06/29 jun 29
+06/30 jun 30
+07/01 jul 1
+07/02 jul 2
+07/03 jul 3
+07/04 jul 4
+07/05 jul 5
+07/06 jul 6
+07/07 jul 7
+07/08 jul 8
+07/09 jul 9
+07/10 jul 10
+07/11 jul 11
+07/12 jul 12
+07/13 jul 13
+07/14 jul 14
+07/15 jul 15
+07/16 jul 16
+07/17 jul 17
+07/18 jul 18
+07/19 jul 19
+07/20 jul 20
+07/21 jul 21
+07/22 jul 22
+07/23 jul 23
+07/24 jul 24
+07/25 jul 25
+07/26 jul 26
+07/27 jul 27
+07/28 jul 28
+07/29 jul 29
+07/30 jul 30
+07/31 jul 31
+08/01 aug 1
+08/02 aug 2
+08/03 aug 3
+08/04 aug 4
+08/05 aug 5
+08/06 aug 6
+08/07 aug 7
+08/08 aug 8
+08/09 aug 9
+08/10 aug 10
+08/11 aug 11
+08/12 aug 12
+08/13 aug 13
+08/14 aug 14
+08/15 aug 15
+08/16 aug 16
+08/17 aug 17
+08/18 aug 18
+08/19 aug 19
+08/20 aug 20
+08/21 aug 21
+08/22 aug 22
+08/23 aug 23
+08/24 aug 24
+08/25 aug 25
+08/26 aug 26
+08/27 aug 27
+08/28 aug 28
+08/29 aug 29
+08/30 aug 30
+08/31 aug 31
+09/01 sep 1
+09/02 sep 2
+09/03 sep 3
+09/04 sep 4
+09/05 sep 5
+09/06 sep 6
+09/07 sep 7
+09/08 sep 8
+09/09 sep 9
+09/10 sep 10
+09/11 sep 11
+09/12 sep 12
+09/13 sep 13
+09/14 sep 14
+09/15 sep 15
+09/16 sep 16
+09/17 sep 17
+09/18 sep 18
+09/19 sep 19
+09/20 sep 20
+09/21 sep 21
+09/22 sep 22
+09/23 sep 23
+09/24 sep 24
+09/25 sep 25
+09/26 sep 26
+09/27 sep 27
+09/28 sep 28
+09/29 sep 29
+09/30 sep 30
+10/01 oct 1
+10/02 oct 2
+10/03 oct 3
+10/04 oct 4
+10/05 oct 5
+10/06 oct 6
+10/07 oct 7
+10/08 oct 8
+10/09 oct 9
+10/10 oct 10
+10/11 oct 11
+10/12 oct 12
+10/13 oct 13
+10/14 oct 14
+10/15 oct 15
+10/16 oct 16
+10/17 oct 17
+10/18 oct 18
+10/19 oct 19
+10/20 oct 20
+10/21 oct 21
+10/22 oct 22
+10/23 oct 23
+10/24 oct 24
+10/25 oct 25
+10/26 oct 26
+10/27 oct 27
+10/28 oct 28
+10/29 oct 29
+10/30 oct 30
+10/31 oct 31
+11/01 nov 1
+11/02 nov 2
+11/03 nov 3
+11/04 nov 4
+11/05 nov 5
+11/06 nov 6
+11/07 nov 7
+11/08 nov 8
+11/09 nov 9
+11/10 nov 10
+11/11 nov 11
+11/12 nov 12
+11/13 nov 13
+11/14 nov 14
+11/15 nov 15
+11/16 nov 16
+11/17 nov 17
+11/18 nov 18
+11/19 nov 19
+11/20 nov 20
+11/21 nov 21
+11/22 nov 22
+11/23 nov 23
+11/24 nov 24
+11/25 nov 25
+11/26 nov 26
+11/27 nov 27
+11/28 nov 28
+11/29 nov 29
+11/30 nov 30
+12/01 dec 1
+12/02 dec 2
+12/03 dec 3
+12/04 dec 4
+12/05 dec 5
+12/06 dec 6
+12/07 dec 7
+12/08 dec 8
+12/09 dec 9
+12/10 dec 10
+12/11 dec 11
+12/12 dec 12
+12/13 dec 13
+12/14 dec 14
+12/15 dec 15
+12/16 dec 16
+12/17 dec 17
+12/18 dec 18
+12/19 dec 19
+12/20 dec 20
+12/21 dec 21
+12/22 dec 22
+12/23 dec 23
+12/24 dec 24
+12/25 dec 25
+12/26 dec 26
+12/27 dec 27
+12/28 dec 28
+12/29 dec 29
+12/30 dec 30
+12/31 dec 31
diff --git a/usr.bin/calendar/tests/legacy_test.sh b/usr.bin/calendar/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/calendar/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/calendar/tests/regress.a1.out b/usr.bin/calendar/tests/regress.a1.out
new file mode 100644
index 0000000..ef3d71d
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.a1.out
@@ -0,0 +1,4 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
diff --git a/usr.bin/calendar/tests/regress.a2.out b/usr.bin/calendar/tests/regress.a2.out
new file mode 100644
index 0000000..0fed38b
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.a2.out
@@ -0,0 +1,4 @@
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.a3.out b/usr.bin/calendar/tests/regress.a3.out
new file mode 100644
index 0000000..9dabd33
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.a3.out
@@ -0,0 +1,4 @@
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
diff --git a/usr.bin/calendar/tests/regress.a4.out b/usr.bin/calendar/tests/regress.a4.out
new file mode 100644
index 0000000..e3756b1
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.a4.out
@@ -0,0 +1,4 @@
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
+Jan 3 jan 3
diff --git a/usr.bin/calendar/tests/regress.a5.out b/usr.bin/calendar/tests/regress.a5.out
new file mode 100644
index 0000000..4f61d48
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.a5.out
@@ -0,0 +1,4 @@
+Jan 1 jan 1
+Jan 2 jan 2
+Jan 3 jan 3
+Jan 4 jan 4
diff --git a/usr.bin/calendar/tests/regress.b1.out b/usr.bin/calendar/tests/regress.b1.out
new file mode 100644
index 0000000..ef3d71d
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.b1.out
@@ -0,0 +1,4 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
diff --git a/usr.bin/calendar/tests/regress.b2.out b/usr.bin/calendar/tests/regress.b2.out
new file mode 100644
index 0000000..0fed38b
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.b2.out
@@ -0,0 +1,4 @@
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.b3.out b/usr.bin/calendar/tests/regress.b3.out
new file mode 100644
index 0000000..9dabd33
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.b3.out
@@ -0,0 +1,4 @@
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
diff --git a/usr.bin/calendar/tests/regress.b4.out b/usr.bin/calendar/tests/regress.b4.out
new file mode 100644
index 0000000..e3756b1
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.b4.out
@@ -0,0 +1,4 @@
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
+Jan 3 jan 3
diff --git a/usr.bin/calendar/tests/regress.b5.out b/usr.bin/calendar/tests/regress.b5.out
new file mode 100644
index 0000000..4f61d48
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.b5.out
@@ -0,0 +1,4 @@
+Jan 1 jan 1
+Jan 2 jan 2
+Jan 3 jan 3
+Jan 4 jan 4
diff --git a/usr.bin/calendar/tests/regress.s1.out b/usr.bin/calendar/tests/regress.s1.out
new file mode 100644
index 0000000..0fed38b
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.s1.out
@@ -0,0 +1,4 @@
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.s2.out b/usr.bin/calendar/tests/regress.s2.out
new file mode 100644
index 0000000..65ab9c9
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.s2.out
@@ -0,0 +1,2 @@
+Dec 30 dec 30
+Dec 31 dec 31
diff --git a/usr.bin/calendar/tests/regress.s3.out b/usr.bin/calendar/tests/regress.s3.out
new file mode 100644
index 0000000..0c61207
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.s3.out
@@ -0,0 +1,2 @@
+Dec 31 dec 31
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.s4.out b/usr.bin/calendar/tests/regress.s4.out
new file mode 100644
index 0000000..8489769
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.s4.out
@@ -0,0 +1,2 @@
+Jan 1 jan 1
+Jan 2 jan 2
diff --git a/usr.bin/calendar/tests/regress.sh b/usr.bin/calendar/tests/regress.sh
new file mode 100644
index 0000000..248123a
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.sh
@@ -0,0 +1,45 @@
+# $FreeBSD$
+
+CALENDAR_FILE="-f ${SRCDIR}/calendar.calibrate"
+CALENDAR_BIN="calendar"
+
+CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}"
+
+REGRESSION_START($1)
+
+echo 1..28
+
+REGRESSION_TEST(`s1',`$CALENDAR -t 29.12.2006')
+REGRESSION_TEST(`s2',`$CALENDAR -t 30.12.2006')
+REGRESSION_TEST(`s3',`$CALENDAR -t 31.12.2006')
+REGRESSION_TEST(`s4',`$CALENDAR -t 01.01.2007')
+
+REGRESSION_TEST(`a1',`$CALENDAR -A 3 -t 28.12.2006')
+REGRESSION_TEST(`a2',`$CALENDAR -A 3 -t 29.12.2006')
+REGRESSION_TEST(`a3',`$CALENDAR -A 3 -t 30.12.2006')
+REGRESSION_TEST(`a4',`$CALENDAR -A 3 -t 31.12.2006')
+REGRESSION_TEST(`a5',`$CALENDAR -A 3 -t 01.01.2007')
+
+REGRESSION_TEST(`b1',`$CALENDAR -B 3 -t 31.12.2006')
+REGRESSION_TEST(`b2',`$CALENDAR -B 3 -t 01.01.2007')
+REGRESSION_TEST(`b3',`$CALENDAR -B 3 -t 02.01.2007')
+REGRESSION_TEST(`b4',`$CALENDAR -B 3 -t 03.01.2007')
+REGRESSION_TEST(`b5',`$CALENDAR -B 3 -t 04.01.2007')
+
+REGRESSION_TEST(`w0-1',`$CALENDAR -W 0 -t 28.12.2006')
+REGRESSION_TEST(`w0-2',`$CALENDAR -W 0 -t 29.12.2006')
+REGRESSION_TEST(`w0-3',`$CALENDAR -W 0 -t 30.12.2006')
+REGRESSION_TEST(`w0-4',`$CALENDAR -W 0 -t 31.12.2006')
+REGRESSION_TEST(`w0-5',`$CALENDAR -W 0 -t 01.01.2007')
+REGRESSION_TEST(`w0-6',`$CALENDAR -W 0 -t 02.01.2007')
+REGRESSION_TEST(`w0-7',`$CALENDAR -W 0 -t 03.01.2007')
+
+REGRESSION_TEST(`wn-1',`$CALENDAR -W 0 -t 28.12.2006')
+REGRESSION_TEST(`wn-2',`$CALENDAR -W 1 -t 28.12.2006')
+REGRESSION_TEST(`wn-3',`$CALENDAR -W 2 -t 28.12.2006')
+REGRESSION_TEST(`wn-4',`$CALENDAR -W 3 -t 28.12.2006')
+REGRESSION_TEST(`wn-5',`$CALENDAR -W 4 -t 28.12.2006')
+REGRESSION_TEST(`wn-6',`$CALENDAR -W 5 -t 28.12.2006')
+REGRESSION_TEST(`wn-7',`$CALENDAR -W 6 -t 28.12.2006')
+
+REGRESSION_END()
diff --git a/usr.bin/calendar/tests/regress.w0-1.out b/usr.bin/calendar/tests/regress.w0-1.out
new file mode 100644
index 0000000..5bd4072
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-1.out
@@ -0,0 +1 @@
+Dec 28 dec 28
diff --git a/usr.bin/calendar/tests/regress.w0-2.out b/usr.bin/calendar/tests/regress.w0-2.out
new file mode 100644
index 0000000..66e7063
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-2.out
@@ -0,0 +1 @@
+Dec 29 dec 29
diff --git a/usr.bin/calendar/tests/regress.w0-3.out b/usr.bin/calendar/tests/regress.w0-3.out
new file mode 100644
index 0000000..03073ee
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-3.out
@@ -0,0 +1 @@
+Dec 30 dec 30
diff --git a/usr.bin/calendar/tests/regress.w0-4.out b/usr.bin/calendar/tests/regress.w0-4.out
new file mode 100644
index 0000000..a14f6b6
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-4.out
@@ -0,0 +1 @@
+Dec 31 dec 31
diff --git a/usr.bin/calendar/tests/regress.w0-5.out b/usr.bin/calendar/tests/regress.w0-5.out
new file mode 100644
index 0000000..1232b9b
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-5.out
@@ -0,0 +1 @@
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.w0-6.out b/usr.bin/calendar/tests/regress.w0-6.out
new file mode 100644
index 0000000..b3545a2
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-6.out
@@ -0,0 +1 @@
+Jan 2 jan 2
diff --git a/usr.bin/calendar/tests/regress.w0-7.out b/usr.bin/calendar/tests/regress.w0-7.out
new file mode 100644
index 0000000..6449760
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.w0-7.out
@@ -0,0 +1 @@
+Jan 3 jan 3
diff --git a/usr.bin/calendar/tests/regress.wn-1.out b/usr.bin/calendar/tests/regress.wn-1.out
new file mode 100644
index 0000000..5bd4072
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-1.out
@@ -0,0 +1 @@
+Dec 28 dec 28
diff --git a/usr.bin/calendar/tests/regress.wn-2.out b/usr.bin/calendar/tests/regress.wn-2.out
new file mode 100644
index 0000000..84a2b33
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-2.out
@@ -0,0 +1,2 @@
+Dec 28 dec 28
+Dec 29 dec 29
diff --git a/usr.bin/calendar/tests/regress.wn-3.out b/usr.bin/calendar/tests/regress.wn-3.out
new file mode 100644
index 0000000..7f027e5
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-3.out
@@ -0,0 +1,3 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
diff --git a/usr.bin/calendar/tests/regress.wn-4.out b/usr.bin/calendar/tests/regress.wn-4.out
new file mode 100644
index 0000000..ef3d71d
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-4.out
@@ -0,0 +1,4 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
diff --git a/usr.bin/calendar/tests/regress.wn-5.out b/usr.bin/calendar/tests/regress.wn-5.out
new file mode 100644
index 0000000..c38c00b
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-5.out
@@ -0,0 +1,5 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
diff --git a/usr.bin/calendar/tests/regress.wn-6.out b/usr.bin/calendar/tests/regress.wn-6.out
new file mode 100644
index 0000000..63c99fe
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-6.out
@@ -0,0 +1,6 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
diff --git a/usr.bin/calendar/tests/regress.wn-7.out b/usr.bin/calendar/tests/regress.wn-7.out
new file mode 100644
index 0000000..4b48f68
--- /dev/null
+++ b/usr.bin/calendar/tests/regress.wn-7.out
@@ -0,0 +1,7 @@
+Dec 28 dec 28
+Dec 29 dec 29
+Dec 30 dec 30
+Dec 31 dec 31
+Jan 1 jan 1
+Jan 2 jan 2
+Jan 3 jan 3
diff --git a/usr.bin/cap_mkdb/Makefile b/usr.bin/cap_mkdb/Makefile
new file mode 100644
index 0000000..408790c
--- /dev/null
+++ b/usr.bin/cap_mkdb/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= cap_mkdb
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cap_mkdb/Makefile.depend b/usr.bin/cap_mkdb/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/cap_mkdb/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/cap_mkdb/cap_mkdb.1 b/usr.bin/cap_mkdb/cap_mkdb.1
new file mode 100644
index 0000000..e2e3090
--- /dev/null
+++ b/usr.bin/cap_mkdb/cap_mkdb.1
@@ -0,0 +1,105 @@
+.\" Copyright (c) 1992, 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.
+.\"
+.\" @(#)cap_mkdb.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 22, 2005
+.Dt CAP_MKDB 1
+.Os
+.Sh NAME
+.Nm cap_mkdb
+.Nd create capability database
+.Sh SYNOPSIS
+.Nm
+.Op Fl b | l
+.Op Fl v
+.Op Fl f Ar outfile
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility builds a hashed database out of the
+.Xr getcap 3
+logical database constructed by the concatenation of the specified
+files.
+.Pp
+The database is named by the basename of the first file argument and
+the string
+.Dq .db .
+The
+.Xr getcap 3
+routines can access the database in this form much more quickly
+than they can the original text file(s).
+.Pp
+The ``tc'' capabilities of the records are expanded before the
+record is stored into the database.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl b
+Use big-endian byte order for database metadata.
+.It Fl f Ar outfile
+Specify a different database basename.
+.It Fl l
+Use little-endian byte order for database metadata.
+.It Fl v
+Print out the number of capability records in the database.
+.El
+.Pp
+The
+.Fl b
+and
+.Fl l
+flags are mutually exclusive.
+The default byte ordering is the current host order.
+.Sh FORMAT
+Each record is stored in the database using two different types of keys.
+.Pp
+The first type is a key which consists of the first capability of
+the record (not including the trailing colon (``:'')) with a data
+field consisting of a special byte followed by the rest of the record.
+The special byte is either a 0 or 1, where a 0 means that the record
+is okay, and a 1 means that there was a ``tc'' capability in the record
+that could not be expanded.
+.Pp
+The second type is a key which consists of one of the names from the
+first capability of the record with a data field consisting a special
+byte followed by the first capability of the record.
+The special byte is a 2.
+.Pp
+In normal operation names are looked up in the database, resulting
+in a key/data pair of the second type.
+The data field of this key/data pair is used to look up a key/data
+pair of the first type which has the real data associated with the
+name.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr dbopen 3 ,
+.Xr getcap 3 ,
+.Xr termcap 5
diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
new file mode 100644
index 0000000..2f8bd96
--- /dev/null
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -0,0 +1,268 @@
+/*-
+ * Copyright (c) 1992, 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) 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <db.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void db_build(char **);
+static void dounlink(void);
+static void usage(void);
+
+static DB *capdbp;
+static int verbose;
+static char *capname, buf[8 * 1024];
+
+static HASHINFO openinfo = {
+ 4096, /* bsize */
+ 0, /* ffactor */
+ 0, /* nelem */
+ 0, /* cachesize */
+ NULL, /* hash() */
+ 0 /* lorder */
+};
+
+/*
+ * Mkcapdb creates a capability hash database for quick retrieval of capability
+ * records. The database contains 2 types of entries: records and references
+ * marked by the first byte in the data. A record entry contains the actual
+ * capability record whereas a reference contains the name (key) under which
+ * the correct record is stored.
+ */
+int
+main(int argc, char *argv[])
+{
+ int byteorder, c;
+
+ capname = NULL;
+ byteorder = 0;
+ while ((c = getopt(argc, argv, "bf:lv")) != -1) {
+ switch(c) {
+ case 'b':
+ case 'l':
+ if (byteorder != 0)
+ usage();
+ byteorder = c == 'b' ? 4321 : 1234;
+ break;
+ case 'f':
+ capname = optarg;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (*argv == NULL)
+ usage();
+
+ /* Set byte order. */
+ openinfo.lorder = byteorder;
+
+ /*
+ * The database file is the first argument if no name is specified.
+ * Make arrangements to unlink it if exit badly.
+ */
+ (void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
+ if ((capname = strdup(buf)) == NULL)
+ errx(1, "strdup failed");
+ if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
+ DEFFILEMODE, DB_HASH, &openinfo)) == NULL)
+ err(1, "%s", buf);
+
+ if (atexit(dounlink))
+ err(1, "atexit");
+
+ db_build(argv);
+
+ if (capdbp->close(capdbp) < 0)
+ err(1, "%s", capname);
+ capname = NULL;
+ exit(0);
+}
+
+static void
+dounlink(void)
+{
+ if (capname != NULL)
+ (void)unlink(capname);
+}
+
+/*
+ * Any changes to these definitions should be made also in the getcap(3)
+ * library routines.
+ */
+#define RECOK (char)0
+#define TCERR (char)1
+#define SHADOW (char)2
+
+/*
+ * Db_build() builds the name and capability databases according to the
+ * details above.
+ */
+static void
+db_build(char **ifiles)
+{
+ DBT key, data;
+ recno_t reccnt;
+ size_t len, bplen;
+ int st;
+ char *bp, *p, *t;
+
+ data.data = NULL;
+ key.data = NULL;
+ for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0;) {
+
+ /*
+ * Allocate enough memory to store record, terminating
+ * NULL and one extra byte.
+ */
+ len = strlen(bp);
+ if (bplen <= len + 2) {
+ bplen += MAX(256, len + 2);
+ if ((data.data = realloc(data.data, bplen)) == NULL)
+ errx(1, "malloc failed");
+ }
+
+ /* Find the end of the name field. */
+ if ((p = strchr(bp, ':')) == NULL) {
+ warnx("no name field: %.*s", (int)MIN(len, 20), bp);
+ continue;
+ }
+
+ /* First byte of stored record indicates status. */
+ switch(st) {
+ case 1:
+ ((char *)(data.data))[0] = RECOK;
+ break;
+ case 2:
+ ((char *)(data.data))[0] = TCERR;
+ warnx("record not tc expanded: %.*s", (int)(p - bp),
+ bp);
+ break;
+ }
+
+ /* Create the stored record. */
+ memmove(&((u_char *)(data.data))[1], bp, len + 1);
+ data.size = len + 2;
+
+ /* Store the record under the name field. */
+ key.data = bp;
+ key.size = p - bp;
+
+ switch(capdbp->put(capdbp, &key, &data, R_NOOVERWRITE)) {
+ case -1:
+ err(1, "put");
+ /* NOTREACHED */
+ case 1:
+ warnx("ignored duplicate: %.*s",
+ (int)key.size, (char *)key.data);
+ continue;
+ }
+ ++reccnt;
+
+ /* If only one name, ignore the rest. */
+ *p = '\0';
+ if (strchr(bp, '|') == NULL)
+ continue;
+ *p = ':';
+
+ /* The rest of the names reference the entire name. */
+ ((char *)(data.data))[0] = SHADOW;
+ memmove(&((u_char *)(data.data))[1], key.data, key.size);
+ data.size = key.size + 1;
+
+ /* Store references for other names. */
+ for (p = t = bp;; ++p) {
+ if (p > t && (*p == ':' || *p == '|')) {
+ key.size = p - t;
+ key.data = t;
+ switch(capdbp->put(capdbp,
+ &key, &data, R_NOOVERWRITE)) {
+ case -1:
+ err(1, "put");
+ /* NOTREACHED */
+ case 1:
+ warnx("ignored duplicate: %.*s",
+ (int)key.size, (char *)key.data);
+ }
+ t = p + 1;
+ }
+ if (*p == ':')
+ break;
+ }
+ }
+
+ switch(st) {
+ case -1:
+ err(1, "file argument");
+ /* NOTREACHED */
+ case -2:
+ errx(1, "potential reference loop detected");
+ /* NOTREACHED */
+ }
+
+ if (verbose)
+ (void)printf("cap_mkdb: %d capability records\n", reccnt);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: cap_mkdb [-b | -l] [-v] [-f outfile] file ...\n");
+ exit(1);
+}
diff --git a/usr.bin/catman/Makefile b/usr.bin/catman/Makefile
new file mode 100644
index 0000000..ab4c014
--- /dev/null
+++ b/usr.bin/catman/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= catman
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/catman/Makefile.depend b/usr.bin/catman/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/catman/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/catman/catman.1 b/usr.bin/catman/catman.1
new file mode 100644
index 0000000..fe85587
--- /dev/null
+++ b/usr.bin/catman/catman.1
@@ -0,0 +1,109 @@
+.\" Copyright (c) 2002 John Rochester
+.\" 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 December 3, 2005
+.Dt CATMAN 1
+.Os
+.Sh NAME
+.Nm catman
+.Nd "preformat man pages"
+.Sh SYNOPSIS
+.Nm
+.Op Fl fLnrv
+.Op Ar directories ...
+.Sh DESCRIPTION
+The
+.Nm
+utility preformats all the man pages in
+.Ar directories
+using the
+.Nm nroff Fl man
+command.
+Directories may be separated by colons instead of spaces.
+If no
+.Ar directories
+are specified, the contents of the
+.Ev MANPATH
+environment variable is used, or if that is not set, the default directory
+.Pa /usr/share/man
+is processed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl f
+Force all man pages to be reformatted even if the corresponding cat page
+is newer.
+.It Fl L
+Process only localized subdirectories corresponding to the locale specified
+in the standard environment variables.
+.It Fl n
+Print out what would be done instead of performing any formatting.
+.It Fl r
+Scan for and remove
+.Dq junk
+files that are neither man pages nor their
+corresponding formatted cat pages.
+.It Fl v
+Cause
+.Nm
+to be more verbose about what it is doing.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev MANPATH"
+.It Ev LC_ALL , LC_CTYPE , LANG
+These variables control what subdirectories will be processed if the
+.Fl L
+option is used.
+.It Ev MACHINE
+If set, overrides the current machine type when searching for
+machine specific man page subdirectories.
+.It Ev MACHINE_ARCH
+If set, overrides the current architecture when searching for
+architecture specific man page subdirectories.
+.It Ev MANPATH
+Determines the set of directories to be processed if none are given on
+the command line.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/man" -compact
+.It Pa /usr/share/man
+Default directory to process if the
+.Ev MANPATH
+environment variable is not set.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr makewhatis 1 ,
+.Xr man 1 ,
+.Xr nroff 1
+.Sh HISTORY
+A previous version of the
+.Nm
+command appeared in
+.Fx 2.1 .
+.Sh AUTHORS
+.An John Rochester
diff --git a/usr.bin/catman/catman.c b/usr.bin/catman/catman.c
new file mode 100644
index 0000000..47906f5
--- /dev/null
+++ b/usr.bin/catman/catman.c
@@ -0,0 +1,819 @@
+/*-
+ * Copyright (c) 2002 John Rochester
+ * 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.
+ * 3. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <langinfo.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define DEFAULT_MANPATH "/usr/share/man"
+
+#define TOP_LEVEL_DIR 0 /* signifies a top-level man directory */
+#define MAN_SECTION_DIR 1 /* signifies a man section directory */
+#define UNKNOWN 2 /* signifies an unclassifiable directory */
+
+#define TEST_EXISTS 0x01
+#define TEST_DIR 0x02
+#define TEST_FILE 0x04
+#define TEST_READABLE 0x08
+#define TEST_WRITABLE 0x10
+
+static int verbose; /* -v flag: be verbose with warnings */
+static int pretend; /* -n, -p flags: print out what would be done
+ instead of actually doing it */
+static int force; /* -f flag: force overwriting all cat pages */
+static int rm_junk; /* -r flag: remove garbage pages */
+static char *locale; /* user's locale if -L is used */
+static char *lang_locale; /* short form of locale */
+static const char *machine, *machine_arch;
+static int exit_code; /* exit code to use when finished */
+
+/*
+ * -T argument for nroff
+ */
+static const char *nroff_device = "ascii";
+
+/*
+ * Mapping from locale to nroff device
+ */
+static const char *locale_device[] = {
+ "KOI8-R", "koi8-r",
+ "ISO8859-1", "latin1",
+ "ISO8859-15", "latin1",
+ NULL
+};
+
+#define BZ2_CMD "bzip2"
+#define BZ2_EXT ".bz2"
+#define BZ2CAT_CMD "bz"
+#define GZ_CMD "gzip"
+#define GZ_EXT ".gz"
+#define GZCAT_CMD "z"
+enum Ziptype {NONE, BZIP, GZIP};
+
+static uid_t uid;
+static int starting_dir;
+static char tmp_file[MAXPATHLEN];
+static struct stat test_st;
+
+/*
+ * A hashtable is an array of chains composed of this entry structure.
+ */
+struct hash_entry {
+ ino_t inode_number;
+ dev_t device_number;
+ const char *data;
+ struct hash_entry *next;
+};
+
+#define HASHTABLE_ALLOC 16384 /* allocation for hashtable (power of 2) */
+#define HASH_MASK (HASHTABLE_ALLOC - 1)
+
+static struct hash_entry *visited[HASHTABLE_ALLOC];
+static struct hash_entry *links[HASHTABLE_ALLOC];
+
+/*
+ * Inserts a string into a hashtable keyed by inode & device number.
+ */
+static void
+insert_hashtable(struct hash_entry **table,
+ ino_t inode_number,
+ dev_t device_number,
+ const char *data)
+{
+ struct hash_entry *new_entry;
+ struct hash_entry **chain;
+
+ new_entry = (struct hash_entry *) malloc(sizeof(struct hash_entry));
+ if (new_entry == NULL)
+ err(1, "can't insert into hashtable");
+ chain = &table[inode_number & HASH_MASK];
+ new_entry->inode_number = inode_number;
+ new_entry->device_number = device_number;
+ new_entry->data = data;
+ new_entry->next = *chain;
+ *chain = new_entry;
+}
+
+/*
+ * Finds a string in a hashtable keyed by inode & device number.
+ */
+static const char *
+find_hashtable(struct hash_entry **table,
+ ino_t inode_number,
+ dev_t device_number)
+{
+ struct hash_entry *chain;
+
+ chain = table[inode_number & HASH_MASK];
+ while (chain != NULL) {
+ if (chain->inode_number == inode_number &&
+ chain->device_number == device_number)
+ return chain->data;
+ chain = chain->next;
+ }
+ return NULL;
+}
+
+static void
+trap_signal(int sig __unused)
+{
+ if (tmp_file[0] != '\0')
+ unlink(tmp_file);
+ exit(1);
+}
+
+/*
+ * Deals with junk files in the man or cat section directories.
+ */
+static void
+junk(const char *mandir, const char *name, const char *reason)
+{
+ if (verbose)
+ fprintf(stderr, "%s/%s: %s\n", mandir, name, reason);
+ if (rm_junk) {
+ fprintf(stderr, "rm %s/%s\n", mandir, name);
+ if (!pretend && unlink(name) < 0)
+ warn("%s/%s", mandir, name);
+ }
+}
+
+/*
+ * Returns TOP_LEVEL_DIR for .../man, MAN_SECTION_DIR for .../manXXX,
+ * and UNKNOWN for everything else.
+ */
+static int
+directory_type(char *dir)
+{
+ char *p;
+
+ for (;;) {
+ p = strrchr(dir, '/');
+ if (p == NULL || p[1] != '\0')
+ break;
+ *p = '\0';
+ }
+ if (p == NULL)
+ p = dir;
+ else
+ p++;
+ if (strncmp(p, "man", 3) == 0) {
+ p += 3;
+ if (*p == '\0')
+ return TOP_LEVEL_DIR;
+ while (isalnum((unsigned char)*p) || *p == '_') {
+ if (*++p == '\0')
+ return MAN_SECTION_DIR;
+ }
+ }
+ return UNKNOWN;
+}
+
+/*
+ * Tests whether the given file name (without a preceding path)
+ * is a proper man page name (like "mk-amd-map.8.gz").
+ * Only alphanumerics and '_' are allowed after the last '.' and
+ * the last '.' can't be the first or last characters.
+ */
+static int
+is_manpage_name(char *name)
+{
+ char *lastdot = NULL;
+ char *n = name;
+
+ while (*n != '\0') {
+ if (!isalnum((unsigned char)*n)) {
+ switch (*n) {
+ case '_':
+ break;
+ case '-':
+ case '+':
+ case '[':
+ case ':':
+ lastdot = NULL;
+ break;
+ case '.':
+ lastdot = n;
+ break;
+ default:
+ return 0;
+ }
+ }
+ n++;
+ }
+ return lastdot > name && lastdot + 1 < n;
+}
+
+static int
+is_bzipped(char *name)
+{
+ int len = strlen(name);
+ return len >= 5 && strcmp(&name[len - 4], BZ2_EXT) == 0;
+}
+
+static int
+is_gzipped(char *name)
+{
+ int len = strlen(name);
+ return len >= 4 && strcmp(&name[len - 3], GZ_EXT) == 0;
+}
+
+/*
+ * Converts manXXX to catXXX.
+ */
+static char *
+get_cat_section(char *section)
+{
+ char *cat_section;
+
+ cat_section = strdup(section);
+ assert(strlen(section) > 3 && strncmp(section, "man", 3) == 0);
+ memcpy(cat_section, "cat", 3);
+ return cat_section;
+}
+
+/*
+ * Tests to see if the given directory has already been visited.
+ */
+static int
+already_visited(char *mandir, char *dir, int count_visit)
+{
+ struct stat st;
+
+ if (stat(dir, &st) < 0) {
+ if (mandir != NULL)
+ warn("%s/%s", mandir, dir);
+ else
+ warn("%s", dir);
+ exit_code = 1;
+ return 1;
+ }
+ if (find_hashtable(visited, st.st_ino, st.st_dev) != NULL) {
+ if (mandir != NULL)
+ warnx("already visited %s/%s", mandir, dir);
+ else
+ warnx("already visited %s", dir);
+ return 1;
+ }
+ if (count_visit)
+ insert_hashtable(visited, st.st_ino, st.st_dev, "");
+ return 0;
+}
+
+/*
+ * Returns a set of TEST_* bits describing a file's type and permissions.
+ * If mod_time isn't NULL, it will contain the file's modification time.
+ */
+static int
+test_path(char *name, time_t *mod_time)
+{
+ int result;
+
+ if (stat(name, &test_st) < 0)
+ return 0;
+ result = TEST_EXISTS;
+ if (mod_time != NULL)
+ *mod_time = test_st.st_mtime;
+ if (S_ISDIR(test_st.st_mode))
+ result |= TEST_DIR;
+ else if (S_ISREG(test_st.st_mode))
+ result |= TEST_FILE;
+ if (access(name, R_OK))
+ result |= TEST_READABLE;
+ if (access(name, W_OK))
+ result |= TEST_WRITABLE;
+ return result;
+}
+
+/*
+ * Checks whether a file is a symbolic link.
+ */
+static int
+is_symlink(char *path)
+{
+ struct stat st;
+
+ return lstat(path, &st) >= 0 && S_ISLNK(st.st_mode);
+}
+
+/*
+ * Tests to see if the given directory can be written to.
+ */
+static void
+check_writable(char *mandir)
+{
+ if (verbose && !(test_path(mandir, NULL) & TEST_WRITABLE))
+ fprintf(stderr, "%s: not writable - will only be able to write to existing cat directories\n", mandir);
+}
+
+/*
+ * If the directory exists, attempt to make it writable, otherwise
+ * attempt to create it.
+ */
+static int
+make_writable_dir(char *mandir, char *dir)
+{
+ int test;
+
+ if ((test = test_path(dir, NULL)) != 0) {
+ if (!(test & TEST_WRITABLE) && chmod(dir, 0755) < 0) {
+ warn("%s/%s: chmod", mandir, dir);
+ exit_code = 1;
+ return 0;
+ }
+ } else {
+ if (verbose || pretend)
+ fprintf(stderr, "mkdir %s\n", dir);
+ if (!pretend) {
+ unlink(dir);
+ if (mkdir(dir, 0755) < 0) {
+ warn("%s/%s: mkdir", mandir, dir);
+ exit_code = 1;
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+/*
+ * Processes a single man page source by using nroff to create
+ * the preformatted cat page.
+ */
+static void
+process_page(char *mandir, char *src, char *cat, enum Ziptype zipped)
+{
+ int src_test, cat_test;
+ time_t src_mtime, cat_mtime;
+ char cmd[MAXPATHLEN];
+ dev_t src_dev;
+ ino_t src_ino;
+ const char *link_name;
+
+ src_test = test_path(src, &src_mtime);
+ if (!(src_test & (TEST_FILE|TEST_READABLE))) {
+ if (!(src_test & TEST_DIR)) {
+ warnx("%s/%s: unreadable", mandir, src);
+ exit_code = 1;
+ if (rm_junk && is_symlink(src))
+ junk(mandir, src, "bogus symlink");
+ }
+ return;
+ }
+ src_dev = test_st.st_dev;
+ src_ino = test_st.st_ino;
+ cat_test = test_path(cat, &cat_mtime);
+ if (cat_test & (TEST_FILE|TEST_READABLE)) {
+ if (!force && cat_mtime >= src_mtime) {
+ if (verbose) {
+ fprintf(stderr, "\t%s/%s: up to date\n",
+ mandir, src);
+ }
+ return;
+ }
+ }
+ /*
+ * Is the man page a link to one we've already processed?
+ */
+ if ((link_name = find_hashtable(links, src_ino, src_dev)) != NULL) {
+ if (verbose || pretend) {
+ fprintf(stderr, "%slink %s -> %s\n",
+ verbose ? "\t" : "", cat, link_name);
+ }
+ if (!pretend) {
+ (void) unlink(cat);
+ if (link(link_name, cat) < 0)
+ warn("%s %s: link", link_name, cat);
+ }
+ return;
+ }
+ insert_hashtable(links, src_ino, src_dev, strdup(cat));
+ if (verbose || pretend) {
+ fprintf(stderr, "%sformat %s -> %s\n",
+ verbose ? "\t" : "", src, cat);
+ if (pretend)
+ return;
+ }
+ snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat);
+ snprintf(cmd, sizeof cmd,
+ "%scat %s | tbl | nroff -c -T%s -man | %s > %s.tmp",
+ zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
+ src, nroff_device,
+ zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
+ cat);
+ if (system(cmd) != 0)
+ err(1, "formatting pipeline");
+ if (rename(tmp_file, cat) < 0)
+ warn("%s", cat);
+ tmp_file[0] = '\0';
+}
+
+/*
+ * Scan the man section directory for pages and process each one,
+ * then check for junk in the corresponding cat section.
+ */
+static void
+scan_section(char *mandir, char *section, char *cat_section)
+{
+ struct dirent **entries;
+ char **expected = NULL;
+ int npages;
+ int nexpected = 0;
+ int i, e;
+ enum Ziptype zipped;
+ char *page_name;
+ char page_path[MAXPATHLEN];
+ char cat_path[MAXPATHLEN];
+ char zip_path[MAXPATHLEN];
+
+ /*
+ * scan the man section directory for pages
+ */
+ npages = scandir(section, &entries, NULL, alphasort);
+ if (npages < 0) {
+ warn("%s/%s", mandir, section);
+ exit_code = 1;
+ return;
+ }
+ if (verbose || rm_junk) {
+ /*
+ * Maintain a list of all cat pages that should exist,
+ * corresponding to existing man pages.
+ */
+ expected = (char **) calloc(npages, sizeof(char *));
+ }
+ for (i = 0; i < npages; free(entries[i++])) {
+ page_name = entries[i]->d_name;
+ snprintf(page_path, sizeof page_path, "%s/%s", section,
+ page_name);
+ if (!is_manpage_name(page_name)) {
+ if (!(test_path(page_path, NULL) & TEST_DIR)) {
+ junk(mandir, page_path,
+ "invalid man page name");
+ }
+ continue;
+ }
+ zipped = is_bzipped(page_name) ? BZIP :
+ is_gzipped(page_name) ? GZIP : NONE;
+ if (zipped != NONE) {
+ snprintf(cat_path, sizeof cat_path, "%s/%s",
+ cat_section, page_name);
+ if (expected != NULL)
+ expected[nexpected++] = strdup(page_name);
+ process_page(mandir, page_path, cat_path, zipped);
+ } else {
+ /*
+ * We've got an uncompressed man page,
+ * check to see if there's a (preferred)
+ * compressed one.
+ */
+ snprintf(zip_path, sizeof zip_path, "%s%s",
+ page_path, GZ_EXT);
+ if (test_path(zip_path, NULL) != 0) {
+ junk(mandir, page_path,
+ "man page unused due to existing " GZ_EXT);
+ } else {
+ if (verbose) {
+ fprintf(stderr,
+ "warning, %s is uncompressed\n",
+ page_path);
+ }
+ snprintf(cat_path, sizeof cat_path, "%s/%s",
+ cat_section, page_name);
+ if (expected != NULL) {
+ asprintf(&expected[nexpected++],
+ "%s", page_name);
+ }
+ process_page(mandir, page_path, cat_path, NONE);
+ }
+ }
+ }
+ free(entries);
+ if (expected == NULL)
+ return;
+ /*
+ * scan cat sections for junk
+ */
+ npages = scandir(cat_section, &entries, NULL, alphasort);
+ e = 0;
+ for (i = 0; i < npages; free(entries[i++])) {
+ const char *junk_reason;
+ int cmp = 1;
+
+ page_name = entries[i]->d_name;
+ if (strcmp(page_name, ".") == 0 || strcmp(page_name, "..") == 0)
+ continue;
+ /*
+ * Keep the index into the expected cat page list
+ * ahead of the name we've found.
+ */
+ while (e < nexpected &&
+ (cmp = strcmp(page_name, expected[e])) > 0)
+ free(expected[e++]);
+ if (cmp == 0)
+ continue;
+ /* we have an unexpected page */
+ snprintf(cat_path, sizeof cat_path, "%s/%s", cat_section,
+ page_name);
+ if (!is_manpage_name(page_name)) {
+ if (test_path(cat_path, NULL) & TEST_DIR)
+ continue;
+ junk_reason = "invalid cat page name";
+ } else if (!is_gzipped(page_name) && e + 1 < nexpected &&
+ strncmp(page_name, expected[e + 1], strlen(page_name)) == 0 &&
+ strlen(expected[e + 1]) == strlen(page_name) + 3) {
+ junk_reason = "cat page unused due to existing " GZ_EXT;
+ } else
+ junk_reason = "cat page without man page";
+ junk(mandir, cat_path, junk_reason);
+ }
+ free(entries);
+ while (e < nexpected)
+ free(expected[e++]);
+ free(expected);
+}
+
+
+/*
+ * Processes a single man section.
+ */
+static void
+process_section(char *mandir, char *section)
+{
+ char *cat_section;
+
+ if (already_visited(mandir, section, 1))
+ return;
+ if (verbose)
+ fprintf(stderr, " section %s\n", section);
+ cat_section = get_cat_section(section);
+ if (make_writable_dir(mandir, cat_section))
+ scan_section(mandir, section, cat_section);
+ free(cat_section);
+}
+
+static int
+select_sections(const struct dirent *entry)
+{
+ char *name;
+ int ret;
+
+ name = strdup(entry->d_name);
+ ret = directory_type(name) == MAN_SECTION_DIR;
+ free(name);
+ return (ret);
+}
+
+/*
+ * Processes a single top-level man directory. If section isn't NULL,
+ * it will only process that section sub-directory, otherwise it will
+ * process all of them.
+ */
+static void
+process_mandir(char *dir_name, char *section)
+{
+ if (fchdir(starting_dir) < 0)
+ err(1, "fchdir");
+ if (already_visited(NULL, dir_name, section == NULL))
+ return;
+ check_writable(dir_name);
+ if (verbose)
+ fprintf(stderr, "man directory %s\n", dir_name);
+ if (pretend)
+ fprintf(stderr, "cd %s\n", dir_name);
+ if (chdir(dir_name) < 0) {
+ warn("%s: chdir", dir_name);
+ exit_code = 1;
+ return;
+ }
+ if (section != NULL) {
+ process_section(dir_name, section);
+ } else {
+ struct dirent **entries;
+ char *machine_dir, *arch_dir;
+ int nsections;
+ int i;
+
+ nsections = scandir(".", &entries, select_sections, alphasort);
+ if (nsections < 0) {
+ warn("%s", dir_name);
+ exit_code = 1;
+ return;
+ }
+ for (i = 0; i < nsections; i++) {
+ process_section(dir_name, entries[i]->d_name);
+ asprintf(&machine_dir, "%s/%s", entries[i]->d_name,
+ machine);
+ if (test_path(machine_dir, NULL) & TEST_DIR)
+ process_section(dir_name, machine_dir);
+ free(machine_dir);
+ if (strcmp(machine_arch, machine) != 0) {
+ asprintf(&arch_dir, "%s/%s", entries[i]->d_name,
+ machine_arch);
+ if (test_path(arch_dir, NULL) & TEST_DIR)
+ process_section(dir_name, arch_dir);
+ free(arch_dir);
+ }
+ free(entries[i]);
+ }
+ free(entries);
+ }
+}
+
+/*
+ * Processes one argument, which may be a colon-separated list of
+ * directories.
+ */
+static void
+process_argument(const char *arg)
+{
+ char *dir;
+ char *mandir;
+ char *section;
+ char *parg;
+
+ parg = strdup(arg);
+ if (parg == NULL)
+ err(1, "out of memory");
+ while ((dir = strsep(&parg, ":")) != NULL) {
+ switch (directory_type(dir)) {
+ case TOP_LEVEL_DIR:
+ if (locale != NULL) {
+ asprintf(&mandir, "%s/%s", dir, locale);
+ process_mandir(mandir, NULL);
+ free(mandir);
+ if (lang_locale != NULL) {
+ asprintf(&mandir, "%s/%s", dir,
+ lang_locale);
+ process_mandir(mandir, NULL);
+ free(mandir);
+ }
+ } else {
+ process_mandir(dir, NULL);
+ }
+ break;
+ case MAN_SECTION_DIR: {
+ mandir = strdup(dirname(dir));
+ section = strdup(basename(dir));
+ process_mandir(mandir, section);
+ free(mandir);
+ free(section);
+ break;
+ }
+ default:
+ warnx("%s: directory name not in proper man form", dir);
+ exit_code = 1;
+ }
+ }
+ free(parg);
+}
+
+static void
+determine_locale(void)
+{
+ char *sep;
+
+ if ((locale = setlocale(LC_CTYPE, "")) == NULL) {
+ warnx("-L option used, but no locale found\n");
+ return;
+ }
+ sep = strchr(locale, '_');
+ if (sep != NULL && isupper((unsigned char)sep[1])
+ && isupper((unsigned char)sep[2])) {
+ asprintf(&lang_locale, "%.*s%s", (int)(sep - locale),
+ locale, &sep[3]);
+ }
+ sep = nl_langinfo(CODESET);
+ if (sep != NULL && *sep != '\0' && strcmp(sep, "US-ASCII") != 0) {
+ int i;
+
+ for (i = 0; locale_device[i] != NULL; i += 2) {
+ if (strcmp(sep, locale_device[i]) == 0) {
+ nroff_device = locale_device[i + 1];
+ break;
+ }
+ }
+ }
+ if (verbose) {
+ if (lang_locale != NULL)
+ fprintf(stderr, "short locale is %s\n", lang_locale);
+ fprintf(stderr, "nroff device is %s\n", nroff_device);
+ }
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-fLnrv] [directories ...]\n",
+ getprogname());
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ int opt;
+
+ if ((uid = getuid()) == 0) {
+ fprintf(stderr, "don't run %s as root, use:\n echo", argv[0]);
+ for (optind = 0; optind < argc; optind++) {
+ fprintf(stderr, " %s", argv[optind]);
+ }
+ fprintf(stderr, " | nice -5 su -m man\n");
+ exit(1);
+ }
+ while ((opt = getopt(argc, argv, "vnfLrh")) != -1) {
+ switch (opt) {
+ case 'f':
+ force++;
+ break;
+ case 'L':
+ determine_locale();
+ break;
+ case 'n':
+ pretend++;
+ break;
+ case 'r':
+ rm_junk++;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ if ((starting_dir = open(".", 0)) < 0) {
+ err(1, ".");
+ }
+ umask(022);
+ signal(SIGINT, trap_signal);
+ signal(SIGHUP, trap_signal);
+ signal(SIGQUIT, trap_signal);
+ signal(SIGTERM, trap_signal);
+
+ if ((machine = getenv("MACHINE")) == NULL) {
+ static struct utsname utsname;
+
+ if (uname(&utsname) == -1)
+ err(1, "uname");
+ machine = utsname.machine;
+ }
+
+ if ((machine_arch = getenv("MACHINE_ARCH")) == NULL)
+ machine_arch = MACHINE_ARCH;
+
+ if (optind == argc) {
+ const char *manpath = getenv("MANPATH");
+ if (manpath == NULL)
+ manpath = DEFAULT_MANPATH;
+ process_argument(manpath);
+ } else {
+ while (optind < argc)
+ process_argument(argv[optind++]);
+ }
+ exit(exit_code);
+}
diff --git a/usr.bin/chat/Makefile b/usr.bin/chat/Makefile
new file mode 100644
index 0000000..8aa23eb
--- /dev/null
+++ b/usr.bin/chat/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+# I once used this extensively, but no longer have a modem. Feel free
+# to ask me questions about it, but I disclaim ownership now. -Peter
+
+PROG= chat
+MAN= chat.8
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/chat/Makefile.depend b/usr.bin/chat/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/chat/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/chat/chat.8 b/usr.bin/chat/chat.8
new file mode 100644
index 0000000..b130ee8
--- /dev/null
+++ b/usr.bin/chat/chat.8
@@ -0,0 +1,644 @@
+.\" $FreeBSD$
+.Dd September 10, 2012
+.Dt CHAT 8
+.Os
+.Sh NAME
+.Nm chat
+.Nd Automated conversational script with a modem
+.Sh SYNOPSIS
+.Nm
+.Op Fl eSsVv
+.Op Fl f Ar chat-file
+.Op Fl r Ar report-file
+.Op Fl T Ar phone-number
+.Op Fl t Ar timeout
+.Op Fl U Ar phone-number2
+.Op Ar script
+.Sh DESCRIPTION
+The
+.Nm
+program defines a conversational exchange between the
+computer and the modem.
+Its primary purpose is to establish the
+connection between the Point-to-Point Protocol Daemon
+.Pq pppd
+and the remote's pppd process.
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl e
+Start with the echo option turned on.
+Echoing may also be turned on
+or off at specific points in the chat script by using the ECHO
+keyword.
+When echoing is enabled, all output from the modem is echoed
+to
+.Em stderr .
+.It Fl f Ar chat-file
+Read the chat script from the chat file.
+The use of this option
+is mutually exclusive with the chat script parameters.
+The user must
+have read access to the file.
+Multiple lines are permitted in the file.
+Space or horizontal tab characters should be used to separate
+the strings.
+.It Fl r Ar report-file
+Set the file for output of the report strings.
+If you use the keyword
+.Dv REPORT ,
+the resulting strings are written to this file.
+If this
+option is not used and you still use
+.Dv REPORT
+keywords, the
+.Pa stderr
+file is used for the report strings.
+.It Fl S
+Do not use
+.Xr syslog 3 .
+By default, error messages are sent to
+.Xr syslog 3 .
+The use of
+.Fl S
+will prevent both log messages from
+.Fl v
+and error messages from being sent to
+.Xr syslog 3 .
+.It Fl s
+Use
+.Em stderr .
+All log messages from
+.Fl v
+and all error messages will be
+sent to
+.Em stderr .
+.It Fl T Ar phone-number
+Pass in an arbitrary string, usually a phone number, that will be
+substituted for the \\T substitution metacharacter in a send string.
+.It Fl t Ar timeout
+Set the timeout for the expected string to be received.
+If the string
+is not received within the time limit then the reply string is not
+sent.
+An alternate reply may be sent or the script will fail if there
+is no alternate reply string.
+A failed script will cause the
+.Nm
+program to terminate with a non-zero error code.
+.It Fl U Ar phone-number2
+Pass in a second string, usually a phone number, that will be
+substituted for the \\U substitution metacharacter in a send string.
+This is useful when dialing an ISDN terminal adapter that requires two
+numbers.
+.It Fl V
+Request that the
+.Nm
+script be executed in a
+.Em stderr
+verbose mode.
+The
+.Nm
+program will then log all text received from the
+modem and the output strings sent to the modem to the stderr device.
+This
+device is usually the local console at the station running the chat or
+pppd program.
+.It Fl v
+Request that the
+.Nm
+script be executed in a verbose mode.
+The
+.Nm
+program will then log the execution state of the chat
+script as well as all text received from the modem and the output
+strings sent to the modem.
+The default is to log through
+.Xr syslog 3 ;
+the logging method may be altered with the
+.Fl S
+and
+.Fl s
+flags.
+Logging is done to the
+.Em local2
+facility at level
+.Em info
+for verbose tracing and level
+.Em err
+for some errors.
+.El
+.Sh CHAT SCRIPT
+The
+.Nm
+script defines the communications.
+A script consists of one or more "expect-send" pairs of strings,
+separated by spaces, with an optional "subexpect-subsend" string pair,
+separated by a dash as in the following example:
+.Pp
+.D1 ogin:-BREAK-ogin: ppp ssword: hello2u2
+.Pp
+This line indicates that the
+.Nm
+program should expect the string "ogin:".
+If it fails to receive a login prompt within the time interval
+allotted, it is to send a break sequence to the remote and then expect the
+string "ogin:".
+If the first "ogin:" is received then the break sequence is
+not generated.
+.Pp
+Once it received the login prompt the
+.Nm
+program will send the
+string ppp and then expect the prompt "ssword:".
+When it receives the
+prompt for the password, it will send the password hello2u2.
+.Pp
+A carriage return is normally sent following the reply string.
+It is not
+expected in the "expect" string unless it is specifically requested by using
+the \\r character sequence.
+.Pp
+The expect sequence should contain only what is needed to identify the
+string.
+Since it is normally stored on a disk file, it should not contain
+variable information.
+It is generally not acceptable to look for time
+strings, network identification strings, or other variable pieces of data as
+an expect string.
+.Pp
+To help correct for characters which may be corrupted during the initial
+sequence, look for the string "ogin:" rather than "login:".
+It is possible
+that the leading "l" character may be received in error and you may never
+find the string even though it was sent by the system.
+For this reason,
+scripts look for "ogin:" rather than "login:" and "ssword:" rather than
+"password:".
+.Pp
+A very simple script might look like this:
+.Pp
+.D1 ogin: ppp ssword: hello2u2
+.Pp
+In other words, expect ....ogin:, send ppp, expect ...ssword:, send hello2u2.
+.Pp
+In actual practice, simple scripts are rare.
+At the vary least, you
+should include sub-expect sequences should the original string not be
+received.
+For example, consider the following script:
+.Pp
+.D1 ogin:--ogin: ppp ssword: hello2u2
+.Pp
+This would be a better script than the simple one used earlier.
+This would look
+for the same login: prompt, however, if one was not received, a single
+return sequence is sent and then it will look for login: again.
+Should line
+noise obscure the first login prompt then sending the empty line will
+usually generate a login prompt again.
+.Sh COMMENTS
+Comments can be embedded in the chat script.
+A comment is a line which
+starts with the # (hash) character in column 1.
+Such comment
+lines are just ignored by the chat program.
+If a '#' character is to
+be expected as the first character of the expect sequence, you should
+quote the expect string.
+If you want to wait for a prompt that starts with a # (hash)
+character, you would have to write something like this:
+.Bd -literal -offset indent
+# Now wait for the prompt and send logout string
+\&'# ' logout
+.Ed
+.Sh ABORT STRINGS
+Many modems will report the status of the call as a string.
+These strings may be
+.Dv CONNECTED
+or
+.Dv NO CARRIER
+or
+.Dv BUSY .
+It is often desirable to terminate the script should the modem fail to
+connect to the remote.
+The difficulty is that a script would not know
+exactly which modem string it may receive.
+On one attempt, it may receive
+.Dv BUSY
+while the next time it may receive
+.Dv NO CARRIER .
+.Pp
+These "abort" strings may be specified in the script using the ABORT
+sequence.
+It is written in the script as in the following example:
+.Pp
+.D1 ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ATDT5551212 CONNECT
+.Pp
+This sequence will expect nothing; and then send the string ATZ.
+The expected response to this is the string
+.Dv OK .
+When it receives
+.Dv OK ,
+the string ATDT5551212 to dial the telephone.
+The expected string is
+.Dv CONNECT .
+If the string
+.Dv CONNECT
+is received the remainder of the
+script is executed.
+However, should the modem find a busy telephone, it will
+send the string
+.Dv BUSY .
+This will cause the string to match the abort
+character sequence.
+The script will then fail because it found a match to
+the abort string.
+If it received the string
+.Dv NO CARRIER ,
+it will abort
+for the same reason.
+Either string may be received.
+Either string will
+terminate the
+.Nm
+script.
+.Sh CLR_ABORT STRINGS
+This sequence allows for clearing previously set
+.Dv ABORT
+strings.
+.Dv ABORT
+strings are kept in an array of a pre-determined size (at
+compilation time); CLR_ABORT will reclaim the space for cleared
+entries so that new strings can use that space.
+.Sh SAY STRINGS
+The
+.Dv SAY
+directive allows the script to send strings to the user
+at the terminal via standard error.
+If
+.Nm
+is being run by
+pppd, and pppd is running as a daemon (detached from its controlling
+terminal), standard error will normally be redirected to the file
+.Pa /etc/ppp/connect-errors .
+.Pp
+.Dv SAY
+strings must be enclosed in single or double quotes.
+If carriage return and line feed are needed in the string to be output,
+you must explicitly add them to your string.
+.Pp
+The
+.Dv SAY
+strings could be used to give progress messages in sections of
+the script where you want to have 'ECHO OFF' but still let the user
+know what is happening. An example is:
+.Bd -literal -offset indent
+ABORT BUSY
+ECHO OFF
+SAY "Dialling your ISP...\\n"
+\&'' ATDT5551212
+TIMEOUT 120
+SAY "Waiting up to 2 minutes for connection ... "
+CONNECT ''
+SAY "Connected, now logging in ...\\n"
+ogin: account
+ssword: pass
+$ SAY "Logged in OK ...\\n" \fIetc ...\fR
+.Ed
+.Pp
+This sequence will only present the
+.Dv SAY
+strings to the user and all
+the details of the script will remain hidden.
+For example, if the
+above script works, the user will see:
+.Bd -literal -offset indent
+Dialling your ISP...
+Waiting up to 2 minutes for connection ... Connected, now logging in ...
+Logged in OK ...
+.Ed
+.Sh REPORT STRINGS
+A report string is similar to the
+.Dv ABORT
+string.
+The difference
+is that the strings, and all characters to the next control character
+such as a carriage return, are written to the report file.
+.Pp
+The report strings may be used to isolate the transmission rate of the
+modem's connect string and return the value to the chat user.
+The
+analysis of the report string logic occurs in conjunction with the
+other string processing such as looking for the expect string.
+The use
+of the same string for a report and abort sequence is probably not
+very useful, however, it is possible.
+.Pp
+The report strings to no change the completion code of the program.
+.Pp
+These "report" strings may be specified in the script using the
+.Dv REPORT
+sequence.
+It is written in the script as in the following example:
+.Pp
+.D1 REPORT CONNECT ABORT BUSY '' ATDT5551212 CONNECT '' ogin: account
+.Pp
+This sequence will expect nothing; and then send the string
+ATDT5551212 to dial the telephone.
+The expected string is
+.Dv CONNECT .
+If the string
+.Dv CONNECT
+is received the remainder
+of the script is executed.
+In addition the program will write to the
+expect-file the string "CONNECT" plus any characters which follow it
+such as the connection rate.
+.Sh CLR_REPORT STRINGS
+This sequence allows for clearing previously set
+.Dv REPORT
+strings.
+.Dv REPORT
+strings are kept in an array of a pre-determined size (at
+compilation time); CLR_REPORT will reclaim the space for cleared
+entries so that new strings can use that space.
+.Sh ECHO
+The echo options controls whether the output from the modem is echoed
+to
+.Em stderr .
+This option may be set with the
+.Fl e
+option, but
+it can also be controlled by the
+.Dv ECHO
+keyword.
+The "expect-send"
+pair
+.Dv ECHO ON
+enables echoing, and
+.Dv ECHO OFF
+disables it.
+With this keyword you can select which parts of the
+conversation should be visible.
+For instance, with the following
+script:
+.Bd -literal -offset indent
+ABORT 'BUSY'
+ABORT 'NO CARRIER'
+\&'' ATZ
+OK\\r\\n ATD1234567
+\\r\\n \\c
+ECHO ON
+CONNECT \\c
+ogin: account
+.Ed
+.Pp
+all output resulting from modem configuration and dialing is not visible,
+but starting with the
+.Dv CONNECT
+or
+.Dv BUSY
+message, everything
+will be echoed.
+.Sh HANGUP
+The
+.Dv HANGUP
+options control whether a modem hangup should be considered
+as an error or not.
+This option is useful in scripts for dialling
+systems which will hang up and call your system back.
+The
+.Dv HANGUP
+options can be
+.Dv ON
+or
+.Dv OFF .
+.Pp
+When
+.Dv HANGUP
+is set
+.Dv OFF
+and the modem hangs up (e.g., after the first
+stage of logging in to a callback system),
+.Nm
+will continue
+running the script (e.g., waiting for the incoming call and second
+stage login prompt).
+As soon as the incoming call is connected, you
+should use the
+.Dv HANGUP ON
+directive to reinstall normal hang up
+signal behavior.
+Here is a (simple) example script:
+.Bd -literal -offset indent
+ABORT 'BUSY'
+\&'' ATZ
+OK\\r\\n ATD1234567
+\\r\\n \\c
+CONNECT \\c
+\&'Callback login:' call_back_ID
+HANGUP OFF
+ABORT "Bad Login"
+\&'Callback Password:' Call_back_password
+TIMEOUT 120
+CONNECT \\c
+HANGUP ON
+ABORT "NO CARRIER"
+ogin:--BREAK--ogin: real_account
+\fIetc ...\fR
+.Ed
+.Sh TIMEOUT
+The initial timeout value is 45 seconds.
+This may be changed using the
+.Fl t
+parameter.
+.Pp
+To change the timeout value for the next expect string, the following
+example may be used:
+.Bd -literal -offset indent
+ATZ OK ATDT5551212 CONNECT TIMEOUT 10 ogin:--ogin: TIMEOUT 5 assword: hello2u2
+.Ed
+.Pp
+This will change the timeout to 10 seconds when it expects the login:
+prompt.
+The timeout is then changed to 5 seconds when it looks for the
+password prompt.
+.Pp
+The timeout, once changed, remains in effect until it is changed again.
+.Sh SENDING EOT
+The special reply string of
+.Dv EOT
+indicates that the chat program
+should send an
+.Dv EOT
+character to the remote.
+This is normally the
+End-of-file character sequence.
+A return character is not sent
+following the
+.Dv EOT .
+.Pp
+The
+.Dv EOT
+sequence may be embedded into the send string using the
+sequence ^D.
+.Sh GENERATING BREAK
+The special reply string of
+.Dv BREAK
+will cause a break condition
+to be sent.
+The break is a special signal on the transmitter.
+The
+normal processing on the receiver is to change the transmission rate.
+It may be used to cycle through the available transmission rates on
+the remote until you are able to receive a valid login prompt.
+.Pp
+The break sequence may be embedded into the send string using the
+\fI\\K\fR sequence.
+.Sh ESCAPE SEQUENCES
+The expect and reply strings may contain escape sequences.
+All of the
+sequences are legal in the reply string.
+Many are legal in the expect.
+Those which are not valid in the expect sequence are so indicated.
+.Bl -tag -width indent
+.It ''
+Expects or sends a null string.
+If you send a null string then it will still
+send the return character.
+This sequence may either be a pair of apostrophe
+or quote characters.
+.It \eb
+represents a backspace character.
+.It \ec
+Suppresses the newline at the end of the reply string.
+This is the only
+method to send a string without a trailing return character.
+It must
+be at the end of the send string.
+For example,
+the sequence hello\\c will simply send the characters h, e, l, l, o
+.Pq Em not valid in expect .
+.It \ed
+Delay for one second.
+The program uses sleep(1) which will delay to a
+maximum of one second
+.Pq Em not valid in expect .
+.It \eK
+Insert a
+.Dv BREAK
+.Pq Em not valid in expect .
+.It \en
+Send a newline or linefeed character.
+.It \eN
+Send a null character.
+The same sequence may be represented by \\0
+.Pq Em not valid in expect .
+.It \ep
+Pause for a fraction of a second.
+The delay is 1/10th of a second
+.Pq Em not valid in expect .
+.It \eq
+Suppress writing the string to
+.Xr syslogd 8 .
+The string ?????? is
+written to the log in its place
+.Pq Em not valid in expect .
+.It \er
+Send or expect a carriage return.
+.It \es
+Represents a space character in the string.
+This may be used when it
+is not desirable to quote the strings which contains spaces.
+The
+sequence 'HI TIM' and HI\\sTIM are the same.
+.It \et
+Send or expect a tab character.
+.It \e
+Send or expect a backslash character.
+.It \eddd
+Collapse the octal digits (ddd) into a single ASCII character and send that
+character
+.Pq Em some characters are not valid in expect .
+.It \^^C
+Substitute the sequence with the control character represented by C.
+For example, the character DC1 (17) is shown as \^^Q
+.Pq Em some characters are not valid in expect .
+.El
+.Sh TERMINATION CODES
+The
+.Nm
+program will terminate with the following completion
+codes.
+.Bl -tag -width indent
+.It 0
+The normal termination of the program.
+This indicates that the script
+was executed without error to the normal conclusion.
+.It 1
+One or more of the parameters are invalid or an expect string was too
+large for the internal buffers.
+This indicates that the program as not
+properly executed.
+.It 2
+An error occurred during the execution of the program.
+This may be due
+to a read or write operation failing for some reason or chat receiving
+a signal such as
+.Dv SIGINT .
+.It 3
+A timeout event occurred when there was an
+.Em expect
+string without
+having a "-subsend" string.
+This may mean that you did not program the
+script correctly for the condition or that some unexpected event has
+occurred and the expected string could not be found.
+.It 4
+The first string marked as an
+.Dv ABORT
+condition occurred.
+.It 5
+The second string marked as an
+.Dv ABORT
+condition occurred.
+.It 6
+The third string marked as an
+.Dv ABORT
+condition occurred.
+.It 7
+The fourth string marked as an
+.Dv ABORT
+condition occurred.
+.It ...
+The other termination codes are also strings marked as an
+.Dv ABORT
+condition.
+.El
+.Pp
+Using the termination code, it is possible to determine which event
+terminated the script.
+It is possible to decide if the string "BUSY"
+was received from the modem as opposed to "NO DIAL TONE".
+While the
+first event may be retried, the second will probably have little
+chance of succeeding during a retry.
+.Sh SEE ALSO
+Additional information about
+.Nm
+scripts may be found with UUCP
+documentation.
+The
+.Nm
+script was taken from the ideas proposed
+by the scripts used by the uucico program.
+.Pp
+.Xr syslog 3 ,
+.Xr syslogd 8
+.Sh COPYRIGHT
+The
+.Nm
+program is in public domain.
+This is not the GNU public
+license.
+If it breaks then you get to keep both pieces.
diff --git a/usr.bin/chat/chat.c b/usr.bin/chat/chat.c
new file mode 100644
index 0000000..107d951
--- /dev/null
+++ b/usr.bin/chat/chat.c
@@ -0,0 +1,1536 @@
+/*
+ * Chat -- a program for automatic session establishment (i.e. dial
+ * the phone and log in).
+ *
+ * Standard termination codes:
+ * 0 - successful completion of the script
+ * 1 - invalid argument, expect string too large, etc.
+ * 2 - error on an I/O operation or fatal error condition.
+ * 3 - timeout waiting for a simple string.
+ * 4 - the first string declared as "ABORT"
+ * 5 - the second string declared as "ABORT"
+ * 6 - ... and so on for successive ABORT strings.
+ *
+ * This software is in the public domain.
+ *
+ * -----------------
+ * added -T and -U option and \T and \U substitution to pass a phone
+ * number into chat script. Two are needed for some ISDN TA applications.
+ * Keith Dart <kdart@cisco.com>
+ *
+ *
+ * Added SAY keyword to send output to stderr.
+ * This allows to turn ECHO OFF and to output specific, user selected,
+ * text to give progress messages. This best works when stderr
+ * exists (i.e.: pppd in nodetach mode).
+ *
+ * Added HANGUP directives to allow for us to be called
+ * back. When HANGUP is set to NO, chat will not hangup at HUP signal.
+ * We rely on timeouts in that case.
+ *
+ * Added CLR_ABORT to clear previously set ABORT string. This has been
+ * dictated by the HANGUP above as "NO CARRIER" (for example) must be
+ * an ABORT condition until we know the other host is going to close
+ * the connection for call back. As soon as we have completed the
+ * first stage of the call back sequence, "NO CARRIER" is a valid, non
+ * fatal string. As soon as we got called back (probably get "CONNECT"),
+ * we should re-arm the ABORT "NO CARRIER". Hence the CLR_ABORT command.
+ * Note that CLR_ABORT packs the abort_strings[] array so that we do not
+ * have unused entries not being reclaimed.
+ *
+ * In the same vein as above, added CLR_REPORT keyword.
+ *
+ * Allow for comments. Line starting with '#' are comments and are
+ * ignored. If a '#' is to be expected as the first character, the
+ * expect string must be quoted.
+ *
+ *
+ * Francis Demierre <Francis@SwissMail.Com>
+ * Thu May 15 17:15:40 MET DST 1997
+ *
+ *
+ * Added -r "report file" switch & REPORT keyword.
+ * Robert Geer <bgeer@xmission.com>
+ *
+ * Added -s "use stderr" and -S "don't use syslog" switches.
+ * June 18, 1997
+ * Karl O. Pinc <kop@meme.com>
+ *
+ *
+ * Added -e "echo" switch & ECHO keyword
+ * Dick Streefland <dicks@tasking.nl>
+ *
+ *
+ * Considerable updates and modifications by
+ * Al Longyear <longyear@pobox.com>
+ * Paul Mackerras <paulus@cs.anu.edu.au>
+ *
+ *
+ * The original author is:
+ *
+ * Karl Fox <karl@MorningStar.Com>
+ * Morning Star Technologies, Inc.
+ * 1760 Zollinger Road
+ * Columbus, OH 43221
+ * (614)451-1883
+ *
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+
+#define STR_LEN 1024
+
+#ifndef SIGTYPE
+#define SIGTYPE void
+#endif
+
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
+#endif
+
+#define MAX_ABORTS 50
+#define MAX_REPORTS 50
+#define DEFAULT_CHAT_TIMEOUT 45
+
+static int echo;
+static int verbose;
+static int to_log;
+static int to_stderr;
+static int Verbose;
+static int quiet;
+static int exit_code;
+static FILE* report_fp;
+static char *report_file;
+static char *chat_file;
+static char *phone_num;
+static char *phone_num2;
+static int timeout = DEFAULT_CHAT_TIMEOUT;
+
+static char blank[] = "";
+
+static int have_tty_parameters;
+
+#define term_parms struct termios
+#define get_term_param(param) tcgetattr(0, param)
+#define set_term_param(param) tcsetattr(0, TCSANOW, param)
+static struct termios saved_tty_parameters;
+
+static char *abort_string[MAX_ABORTS], *fail_reason, fail_buffer[50];
+static int n_aborts, abort_next, timeout_next, echo_next;
+static int clear_abort_next;
+
+static char *report_string[MAX_REPORTS];
+static char report_buffer[50];
+static int n_reports, report_next, report_gathering;
+static int clear_report_next;
+
+static int say_next, hup_next;
+
+void *dup_mem(void *b, size_t c);
+void *copy_of(char *s);
+static void usage(void);
+void chat_logf(const char *fmt, ...);
+void fatal(int code, const char *fmt, ...);
+SIGTYPE sigalrm(int signo);
+SIGTYPE sigint(int signo);
+SIGTYPE sigterm(int signo);
+SIGTYPE sighup(int signo);
+void init(void);
+void set_tty_parameters(void);
+void echo_stderr(int);
+void break_sequence(void);
+void terminate(int status);
+void do_file(char *chatfile);
+int get_string(char *string);
+int put_string(char *s);
+int write_char(int c);
+int put_char(int c);
+int get_char(void);
+void chat_send(char *s);
+char *character(int c);
+void chat_expect(char *s);
+char *clean(char *s, int sending);
+void pack_array(char **array, int end);
+char *expect_strtok(char *, const char *);
+int vfmtmsg(char *, int, const char *, va_list); /* vsprintf++ */
+
+void *
+dup_mem(void *b, size_t c)
+{
+ void *ans = malloc (c);
+ if (!ans)
+ fatal(2, "memory error!");
+
+ memcpy (ans, b, c);
+ return ans;
+}
+
+void *
+copy_of(char *s)
+{
+ return dup_mem (s, strlen (s) + 1);
+}
+
+/*
+ * chat [-esSvV] [-f chat-file] [-r report-file] [-t timeout]
+ * [-T phone-number] [-U phone-number2] [chat-script]
+ * where chat-script has the form:
+ * [...[[expect[-send[-expect...]] send expect[-send[-expect]] ...]]]
+ *
+ * Perform a UUCP-dialer-like chat script on stdin and stdout.
+ */
+int
+main(int argc, char *argv[])
+{
+ int option;
+
+ tzset();
+
+ while ((option = getopt(argc, argv, "ef:r:sSt:T:U:vV")) != -1) {
+ switch (option) {
+ case 'e':
+ ++echo;
+ break;
+
+ case 'f':
+ if (chat_file != NULL)
+ free(chat_file);
+ chat_file = copy_of(optarg);
+ break;
+
+ case 'r':
+ if (report_fp != NULL)
+ fclose(report_fp);
+ if (report_file != NULL)
+ free(report_file);
+ report_file = copy_of(optarg);
+ report_fp = fopen(report_file, "a");
+ if (report_fp != NULL) {
+ if (verbose)
+ fprintf(report_fp, "Opening \"%s\"...\n", report_file);
+ } else
+ fatal(2, "cannot open \"%s\" for appending", report_file);
+ break;
+
+ case 's':
+ ++to_stderr;
+ break;
+
+ case 'S':
+ to_log = 0;
+ break;
+
+ case 't':
+ timeout = atoi(optarg);
+ break;
+
+ case 'T':
+ if (phone_num != NULL)
+ free(phone_num);
+ phone_num = copy_of(optarg);
+ break;
+
+ case 'U':
+ if (phone_num2 != NULL)
+ free(phone_num2);
+ phone_num2 = copy_of(optarg);
+ break;
+
+ case 'v':
+ ++verbose;
+ break;
+
+ case 'V':
+ ++Verbose;
+ break;
+
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+/*
+ * Default the report file to the stderr location
+ */
+ if (report_fp == NULL)
+ report_fp = stderr;
+
+ if (to_log) {
+ openlog("chat", LOG_PID | LOG_NDELAY, LOG_LOCAL2);
+
+ if (verbose)
+ setlogmask(LOG_UPTO(LOG_INFO));
+ else
+ setlogmask(LOG_UPTO(LOG_WARNING));
+ }
+
+ if (chat_file != NULL) {
+ if (*argv != NULL)
+ usage();
+ else {
+ init();
+ do_file(chat_file);
+ }
+ } else {
+ init();
+ while (*argv != NULL && argc > 0) {
+ chat_expect(*argv);
+ argv++;
+ argc--;
+
+ if (*argv != NULL && argc > 0) {
+ chat_send(*argv);
+ argv++;
+ argc--;
+ }
+ }
+ }
+
+ terminate(0);
+ return 0;
+}
+
+/*
+ * Process a chat script when read from a file.
+ */
+
+void
+do_file(char *chatfile)
+{
+ int linect, sendflg;
+ char *sp, *arg, quote;
+ char buf [STR_LEN];
+ FILE *cfp;
+
+ cfp = fopen (chatfile, "r");
+ if (cfp == NULL)
+ fatal(1, "%s -- open failed: %m", chatfile);
+
+ linect = 0;
+ sendflg = 0;
+
+ while (fgets(buf, STR_LEN, cfp) != NULL) {
+ sp = strchr (buf, '\n');
+ if (sp)
+ *sp = '\0';
+
+ linect++;
+ sp = buf;
+
+ /* lines starting with '#' are comments. If a real '#'
+ is to be expected, it should be quoted .... */
+ if ( *sp == '#' )
+ continue;
+
+ while (*sp != '\0') {
+ if (*sp == ' ' || *sp == '\t') {
+ ++sp;
+ continue;
+ }
+
+ if (*sp == '"' || *sp == '\'') {
+ quote = *sp++;
+ arg = sp;
+ while (*sp != quote) {
+ if (*sp == '\0')
+ fatal(1, "unterminated quote (line %d)", linect);
+
+ if (*sp++ == '\\') {
+ if (*sp != '\0')
+ ++sp;
+ }
+ }
+ }
+ else {
+ arg = sp;
+ while (*sp != '\0' && *sp != ' ' && *sp != '\t')
+ ++sp;
+ }
+
+ if (*sp != '\0')
+ *sp++ = '\0';
+
+ if (sendflg)
+ chat_send (arg);
+ else
+ chat_expect (arg);
+ sendflg = !sendflg;
+ }
+ }
+ fclose (cfp);
+}
+
+/*
+ * We got an error parsing the command line.
+ */
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "Usage: chat [-esSvV] [-f chat-file] [-r report-file] [-t timeout]\n"
+ " [-T phone-number] [-U phone-number2] [chat-script]\n"
+ "where chat-script has the form:\n"
+ " [...[[expect[-send[-expect...]] send expect[-send[-expect]] ...]]]\n");
+ exit(1);
+}
+
+/*
+ * Send a message to syslog and/or stderr.
+ */
+void
+chat_logf(const char *fmt, ...)
+{
+ char line[1024];
+ va_list args;
+
+ va_start(args, fmt);
+ vfmtmsg(line, sizeof(line), fmt, args);
+ va_end(args);
+ if (to_log)
+ syslog(LOG_INFO, "%s", line);
+ if (to_stderr)
+ fprintf(stderr, "%s\n", line);
+}
+
+/*
+ * Print an error message and terminate.
+ */
+
+void
+fatal(int code, const char *fmt, ...)
+{
+ char line[1024];
+ va_list args;
+
+ va_start(args, fmt);
+ vfmtmsg(line, sizeof(line), fmt, args);
+ va_end(args);
+ if (to_log)
+ syslog(LOG_ERR, "%s", line);
+ if (to_stderr)
+ fprintf(stderr, "%s\n", line);
+ terminate(code);
+}
+
+static int alarmed;
+
+SIGTYPE sigalrm(int signo __unused)
+{
+ int flags;
+
+ alarm(1);
+ alarmed = 1; /* Reset alarm to avoid race window */
+ signal(SIGALRM, sigalrm); /* that can cause hanging in read() */
+
+ if ((flags = fcntl(0, F_GETFL, 0)) == -1)
+ fatal(2, "Can't get file mode flags on stdin: %m");
+
+ if (fcntl(0, F_SETFL, flags | O_NONBLOCK) == -1)
+ fatal(2, "Can't set file mode flags on stdin: %m");
+
+ if (verbose)
+ chat_logf("alarm");
+}
+
+SIGTYPE sigint(int signo __unused)
+{
+ fatal(2, "SIGINT");
+}
+
+SIGTYPE sigterm(int signo __unused)
+{
+ fatal(2, "SIGTERM");
+}
+
+SIGTYPE sighup(int signo __unused)
+{
+ fatal(2, "SIGHUP");
+}
+
+void init(void)
+{
+ signal(SIGINT, sigint);
+ signal(SIGTERM, sigterm);
+ signal(SIGHUP, sighup);
+
+ set_tty_parameters();
+ signal(SIGALRM, sigalrm);
+ alarm(0);
+ alarmed = 0;
+}
+
+void set_tty_parameters(void)
+{
+#if defined(get_term_param)
+ term_parms t;
+
+ if (get_term_param (&t) < 0)
+ fatal(2, "Can't get terminal parameters: %m");
+
+ saved_tty_parameters = t;
+ have_tty_parameters = 1;
+
+ t.c_iflag |= IGNBRK | ISTRIP | IGNPAR;
+ t.c_oflag = 0;
+ t.c_lflag = 0;
+ t.c_cc[VERASE] =
+ t.c_cc[VKILL] = 0;
+ t.c_cc[VMIN] = 1;
+ t.c_cc[VTIME] = 0;
+
+ if (set_term_param (&t) < 0)
+ fatal(2, "Can't set terminal parameters: %m");
+#endif
+}
+
+void break_sequence(void)
+{
+ tcsendbreak (0, 0);
+}
+
+void terminate(int status)
+{
+ echo_stderr(-1);
+ if (report_file != (char *) 0 && report_fp != (FILE *) NULL) {
+/*
+ * Allow the last of the report string to be gathered before we terminate.
+ */
+ if (report_gathering) {
+ int c;
+ size_t rep_len;
+
+ rep_len = strlen(report_buffer);
+ while (rep_len + 1 < sizeof(report_buffer)) {
+ alarm(1);
+ c = get_char();
+ alarm(0);
+ if (c < 0 || iscntrl(c))
+ break;
+ report_buffer[rep_len] = c;
+ ++rep_len;
+ }
+ report_buffer[rep_len] = 0;
+ fprintf (report_fp, "chat: %s\n", report_buffer);
+ }
+ if (verbose)
+ fprintf (report_fp, "Closing \"%s\".\n", report_file);
+ fclose (report_fp);
+ report_fp = (FILE *) NULL;
+ }
+
+#if defined(get_term_param)
+ if (have_tty_parameters) {
+ if (set_term_param (&saved_tty_parameters) < 0)
+ fatal(2, "Can't restore terminal parameters: %m");
+ }
+#endif
+
+ exit(status);
+}
+
+/*
+ * 'Clean up' this string.
+ */
+char *
+clean(char *s, int sending)
+{
+ char temp[STR_LEN], cur_chr;
+ char *s1, *phchar;
+ int add_return = sending;
+#define isoctal(chr) (((chr) >= '0') && ((chr) <= '7'))
+
+ s1 = temp;
+ /* Don't overflow buffer, leave room for chars we append later */
+ while (*s && s1 - temp < (off_t)(sizeof(temp) - 2 - add_return)) {
+ cur_chr = *s++;
+ if (cur_chr == '^') {
+ cur_chr = *s++;
+ if (cur_chr == '\0') {
+ *s1++ = '^';
+ break;
+ }
+ cur_chr &= 0x1F;
+ if (cur_chr != 0) {
+ *s1++ = cur_chr;
+ }
+ continue;
+ }
+
+ if (cur_chr != '\\') {
+ *s1++ = cur_chr;
+ continue;
+ }
+
+ cur_chr = *s++;
+ if (cur_chr == '\0') {
+ if (sending) {
+ *s1++ = '\\';
+ *s1++ = '\\';
+ }
+ break;
+ }
+
+ switch (cur_chr) {
+ case 'b':
+ *s1++ = '\b';
+ break;
+
+ case 'c':
+ if (sending && *s == '\0')
+ add_return = 0;
+ else
+ *s1++ = cur_chr;
+ break;
+
+ case '\\':
+ case 'K':
+ case 'p':
+ case 'd':
+ if (sending)
+ *s1++ = '\\';
+
+ *s1++ = cur_chr;
+ break;
+
+ case 'T':
+ if (sending && phone_num) {
+ for ( phchar = phone_num; *phchar != '\0'; phchar++)
+ *s1++ = *phchar;
+ }
+ else {
+ *s1++ = '\\';
+ *s1++ = 'T';
+ }
+ break;
+
+ case 'U':
+ if (sending && phone_num2) {
+ for ( phchar = phone_num2; *phchar != '\0'; phchar++)
+ *s1++ = *phchar;
+ }
+ else {
+ *s1++ = '\\';
+ *s1++ = 'U';
+ }
+ break;
+
+ case 'q':
+ quiet = 1;
+ break;
+
+ case 'r':
+ *s1++ = '\r';
+ break;
+
+ case 'n':
+ *s1++ = '\n';
+ break;
+
+ case 's':
+ *s1++ = ' ';
+ break;
+
+ case 't':
+ *s1++ = '\t';
+ break;
+
+ case 'N':
+ if (sending) {
+ *s1++ = '\\';
+ *s1++ = '\0';
+ }
+ else
+ *s1++ = 'N';
+ break;
+
+ default:
+ if (isoctal (cur_chr)) {
+ cur_chr &= 0x07;
+ if (isoctal (*s)) {
+ cur_chr <<= 3;
+ cur_chr |= *s++ - '0';
+ if (isoctal (*s)) {
+ cur_chr <<= 3;
+ cur_chr |= *s++ - '0';
+ }
+ }
+
+ if (cur_chr != 0 || sending) {
+ if (sending && (cur_chr == '\\' || cur_chr == 0))
+ *s1++ = '\\';
+ *s1++ = cur_chr;
+ }
+ break;
+ }
+
+ if (sending)
+ *s1++ = '\\';
+ *s1++ = cur_chr;
+ break;
+ }
+ }
+
+ if (add_return)
+ *s1++ = '\r';
+
+ *s1++ = '\0'; /* guarantee closure */
+ *s1++ = '\0'; /* terminate the string */
+ return dup_mem (temp, (size_t) (s1 - temp)); /* may have embedded nuls */
+}
+
+/*
+ * A modified version of 'strtok'. This version skips \ sequences.
+ */
+
+char *
+expect_strtok (char *s, const char *term)
+{
+ static char *str = blank;
+ int escape_flag = 0;
+ char *result;
+
+/*
+ * If a string was specified then do initial processing.
+ */
+ if (s)
+ str = s;
+
+/*
+ * If this is the escape flag then reset it and ignore the character.
+ */
+ if (*str)
+ result = str;
+ else
+ result = (char *) 0;
+
+ while (*str) {
+ if (escape_flag) {
+ escape_flag = 0;
+ ++str;
+ continue;
+ }
+
+ if (*str == '\\') {
+ ++str;
+ escape_flag = 1;
+ continue;
+ }
+
+/*
+ * If this is not in the termination string, continue.
+ */
+ if (strchr (term, *str) == (char *) 0) {
+ ++str;
+ continue;
+ }
+
+/*
+ * This is the terminator. Mark the end of the string and stop.
+ */
+ *str++ = '\0';
+ break;
+ }
+ return (result);
+}
+
+/*
+ * Process the expect string
+ */
+
+void
+chat_expect(char *s)
+{
+ char *expect;
+ char *reply;
+
+ if (strcmp(s, "HANGUP") == 0) {
+ ++hup_next;
+ return;
+ }
+
+ if (strcmp(s, "ABORT") == 0) {
+ ++abort_next;
+ return;
+ }
+
+ if (strcmp(s, "CLR_ABORT") == 0) {
+ ++clear_abort_next;
+ return;
+ }
+
+ if (strcmp(s, "REPORT") == 0) {
+ ++report_next;
+ return;
+ }
+
+ if (strcmp(s, "CLR_REPORT") == 0) {
+ ++clear_report_next;
+ return;
+ }
+
+ if (strcmp(s, "TIMEOUT") == 0) {
+ ++timeout_next;
+ return;
+ }
+
+ if (strcmp(s, "ECHO") == 0) {
+ ++echo_next;
+ return;
+ }
+
+ if (strcmp(s, "SAY") == 0) {
+ ++say_next;
+ return;
+ }
+
+/*
+ * Fetch the expect and reply string.
+ */
+ for (;;) {
+ expect = expect_strtok (s, "-");
+ s = (char *) 0;
+
+ if (expect == (char *) 0)
+ return;
+
+ reply = expect_strtok (s, "-");
+
+/*
+ * Handle the expect string. If successful then exit.
+ */
+ if (get_string (expect))
+ return;
+
+/*
+ * If there is a sub-reply string then send it. Otherwise any condition
+ * is terminal.
+ */
+ if (reply == (char *) 0 || exit_code != 3)
+ break;
+
+ chat_send (reply);
+ }
+
+/*
+ * The expectation did not occur. This is terminal.
+ */
+ if (fail_reason)
+ chat_logf("Failed (%s)", fail_reason);
+ else
+ chat_logf("Failed");
+ terminate(exit_code);
+}
+
+/*
+ * Translate the input character to the appropriate string for printing
+ * the data.
+ */
+
+char *
+character(int c)
+{
+ static char string[10];
+ const char *meta;
+
+ meta = (c & 0x80) ? "M-" : "";
+ c &= 0x7F;
+
+ if (c < 32)
+ sprintf(string, "%s^%c", meta, (int)c + '@');
+ else if (c == 127)
+ sprintf(string, "%s^?", meta);
+ else
+ sprintf(string, "%s%c", meta, c);
+
+ return (string);
+}
+
+/*
+ * process the reply string
+ */
+void
+chat_send(char *s)
+{
+ if (say_next) {
+ say_next = 0;
+ s = clean(s,0);
+ write(STDERR_FILENO, s, strlen(s));
+ free(s);
+ return;
+ }
+
+ if (hup_next) {
+ hup_next = 0;
+ if (strcmp(s, "OFF") == 0)
+ signal(SIGHUP, SIG_IGN);
+ else
+ signal(SIGHUP, sighup);
+ return;
+ }
+
+ if (echo_next) {
+ echo_next = 0;
+ echo = (strcmp(s, "ON") == 0);
+ return;
+ }
+
+ if (abort_next) {
+ char *s1;
+
+ abort_next = 0;
+
+ if (n_aborts >= MAX_ABORTS)
+ fatal(2, "Too many ABORT strings");
+
+ s1 = clean(s, 0);
+
+ if (strlen(s1) > strlen(s)
+ || strlen(s1) + 1 > sizeof(fail_buffer))
+ fatal(1, "Illegal or too-long ABORT string ('%v')", s);
+
+ abort_string[n_aborts++] = s1;
+
+ if (verbose)
+ chat_logf("abort on (%v)", s);
+ return;
+ }
+
+ if (clear_abort_next) {
+ char *s1;
+ int i;
+ int old_max;
+ int pack = 0;
+
+ clear_abort_next = 0;
+
+ s1 = clean(s, 0);
+
+ if (strlen(s1) > strlen(s)
+ || strlen(s1) + 1 > sizeof(fail_buffer))
+ fatal(1, "Illegal or too-long CLR_ABORT string ('%v')", s);
+
+ old_max = n_aborts;
+ for (i=0; i < n_aborts; i++) {
+ if ( strcmp(s1,abort_string[i]) == 0 ) {
+ free(abort_string[i]);
+ abort_string[i] = NULL;
+ pack++;
+ n_aborts--;
+ if (verbose)
+ chat_logf("clear abort on (%v)", s);
+ }
+ }
+ free(s1);
+ if (pack)
+ pack_array(abort_string,old_max);
+ return;
+ }
+
+ if (report_next) {
+ char *s1;
+
+ report_next = 0;
+ if (n_reports >= MAX_REPORTS)
+ fatal(2, "Too many REPORT strings");
+
+ s1 = clean(s, 0);
+
+ if (strlen(s1) > strlen(s) || strlen(s1) > sizeof fail_buffer - 1)
+ fatal(1, "Illegal or too-long REPORT string ('%v')", s);
+
+ report_string[n_reports++] = s1;
+
+ if (verbose)
+ chat_logf("report (%v)", s);
+ return;
+ }
+
+ if (clear_report_next) {
+ char *s1;
+ int i;
+ int old_max;
+ int pack = 0;
+
+ clear_report_next = 0;
+
+ s1 = clean(s, 0);
+
+ if (strlen(s1) > strlen(s) || strlen(s1) > sizeof fail_buffer - 1)
+ fatal(1, "Illegal or too-long REPORT string ('%v')", s);
+
+ old_max = n_reports;
+ for (i=0; i < n_reports; i++) {
+ if ( strcmp(s1,report_string[i]) == 0 ) {
+ free(report_string[i]);
+ report_string[i] = NULL;
+ pack++;
+ n_reports--;
+ if (verbose)
+ chat_logf("clear report (%v)", s);
+ }
+ }
+ free(s1);
+ if (pack)
+ pack_array(report_string,old_max);
+
+ return;
+ }
+
+ if (timeout_next) {
+ timeout_next = 0;
+ timeout = atoi(s);
+
+ if (timeout <= 0)
+ timeout = DEFAULT_CHAT_TIMEOUT;
+
+ if (verbose)
+ chat_logf("timeout set to %d seconds", timeout);
+
+ return;
+ }
+
+ if (strcmp(s, "EOT") == 0)
+ s = strdup("^D\\c");
+ else if (strcmp(s, "BREAK") == 0)
+ s = strdup("\\K\\c");
+
+ if (!put_string(s))
+ fatal(1, "Failed");
+}
+
+int
+get_char(void)
+{
+ int status;
+ char c;
+
+ status = read(STDIN_FILENO, &c, 1);
+
+ switch (status) {
+ case 1:
+ return ((int)c & 0x7F);
+
+ default:
+ chat_logf("warning: read() on stdin returned %d", status);
+
+ case -1:
+ if ((status = fcntl(0, F_GETFL, 0)) == -1)
+ fatal(2, "Can't get file mode flags on stdin: %m");
+
+ if (fcntl(0, F_SETFL, status & ~O_NONBLOCK) == -1)
+ fatal(2, "Can't set file mode flags on stdin: %m");
+
+ return (-1);
+ }
+}
+
+int put_char(int c)
+{
+ int status;
+ char ch = c;
+
+ usleep(10000); /* inter-character typing delay (?) */
+
+ status = write(STDOUT_FILENO, &ch, 1);
+
+ switch (status) {
+ case 1:
+ return (0);
+
+ default:
+ chat_logf("warning: write() on stdout returned %d", status);
+
+ case -1:
+ if ((status = fcntl(0, F_GETFL, 0)) == -1)
+ fatal(2, "Can't get file mode flags on stdin, %m");
+
+ if (fcntl(0, F_SETFL, status & ~O_NONBLOCK) == -1)
+ fatal(2, "Can't set file mode flags on stdin: %m");
+
+ return (-1);
+ }
+}
+
+int
+write_char(int c)
+{
+ if (alarmed || put_char(c) < 0) {
+ alarm(0);
+ alarmed = 0;
+
+ if (verbose) {
+ if (errno == EINTR || errno == EWOULDBLOCK)
+ chat_logf(" -- write timed out");
+ else
+ chat_logf(" -- write failed: %m");
+ }
+ return (0);
+ }
+ return (1);
+}
+
+int
+put_string(char *s)
+{
+ quiet = 0;
+ s = clean(s, 1);
+
+ if (verbose)
+ chat_logf("send (%v)", quiet ? "??????" : s);
+
+ alarm(timeout); alarmed = 0;
+
+ while (*s) {
+ char c = *s++;
+
+ if (c != '\\') {
+ if (!write_char (c))
+ return 0;
+ continue;
+ }
+
+ c = *s++;
+ switch (c) {
+ case 'd':
+ sleep(1);
+ break;
+
+ case 'K':
+ break_sequence();
+ break;
+
+ case 'p':
+ usleep(10000); /* 1/100th of a second (arg is microseconds) */
+ break;
+
+ default:
+ if (!write_char (c))
+ return 0;
+ break;
+ }
+ }
+
+ alarm(0);
+ alarmed = 0;
+ return (1);
+}
+
+/*
+ * Echo a character to stderr.
+ * When called with -1, a '\n' character is generated when
+ * the cursor is not at the beginning of a line.
+ */
+void
+echo_stderr(int n)
+{
+ static int need_lf;
+ char *s;
+
+ switch (n) {
+ case '\r': /* ignore '\r' */
+ break;
+ case -1:
+ if (need_lf == 0)
+ break;
+ /* FALLTHROUGH */
+ case '\n':
+ write(STDERR_FILENO, "\n", 1);
+ need_lf = 0;
+ break;
+ default:
+ s = character(n);
+ write(STDERR_FILENO, s, strlen(s));
+ need_lf = 1;
+ break;
+ }
+}
+
+/*
+ * 'Wait for' this string to appear on this file descriptor.
+ */
+int
+get_string(char *string)
+{
+ char temp[STR_LEN];
+ int c, printed = 0;
+ size_t len, minlen;
+ char *s = temp, *end = s + STR_LEN;
+ char *logged = temp;
+
+ fail_reason = (char *)0;
+
+ if (strlen(string) > STR_LEN) {
+ chat_logf("expect string is too long");
+ exit_code = 1;
+ return 0;
+ }
+
+ string = clean(string, 0);
+ len = strlen(string);
+ minlen = (len > sizeof(fail_buffer)? len: sizeof(fail_buffer)) - 1;
+
+ if (verbose)
+ chat_logf("expect (%v)", string);
+
+ if (len == 0) {
+ if (verbose)
+ chat_logf("got it");
+ return (1);
+ }
+
+ alarm(timeout);
+ alarmed = 0;
+
+ while ( ! alarmed && (c = get_char()) >= 0) {
+ int n, abort_len, report_len;
+
+ if (echo)
+ echo_stderr(c);
+ if (verbose && c == '\n') {
+ if (s == logged)
+ chat_logf(""); /* blank line */
+ else
+ chat_logf("%0.*v", s - logged, logged);
+ logged = s + 1;
+ }
+
+ *s++ = c;
+
+ if (verbose && s >= logged + 80) {
+ chat_logf("%0.*v", s - logged, logged);
+ logged = s;
+ }
+
+ if (Verbose) {
+ if (c == '\n')
+ fputc( '\n', stderr );
+ else if (c != '\r')
+ fprintf( stderr, "%s", character(c) );
+ }
+
+ if (!report_gathering) {
+ for (n = 0; n < n_reports; ++n) {
+ if ((report_string[n] != (char*) NULL) &&
+ s - temp >= (report_len = strlen(report_string[n])) &&
+ strncmp(s - report_len, report_string[n], report_len) == 0) {
+ time_t time_now = time ((time_t*) NULL);
+ struct tm* tm_now = localtime (&time_now);
+
+ strftime (report_buffer, 20, "%b %d %H:%M:%S ", tm_now);
+ strcat (report_buffer, report_string[n]);
+
+ report_string[n] = (char *) NULL;
+ report_gathering = 1;
+ break;
+ }
+ }
+ }
+ else {
+ if (!iscntrl (c)) {
+ int rep_len = strlen (report_buffer);
+ report_buffer[rep_len] = c;
+ report_buffer[rep_len + 1] = '\0';
+ }
+ else {
+ report_gathering = 0;
+ fprintf (report_fp, "chat: %s\n", report_buffer);
+ }
+ }
+
+ if ((size_t)(s - temp) >= len &&
+ c == string[len - 1] &&
+ strncmp(s - len, string, len) == 0) {
+ if (verbose) {
+ if (s > logged)
+ chat_logf("%0.*v", s - logged, logged);
+ chat_logf(" -- got it\n");
+ }
+
+ alarm(0);
+ alarmed = 0;
+ return (1);
+ }
+
+ for (n = 0; n < n_aborts; ++n) {
+ if (s - temp >= (abort_len = strlen(abort_string[n])) &&
+ strncmp(s - abort_len, abort_string[n], abort_len) == 0) {
+ if (verbose) {
+ if (s > logged)
+ chat_logf("%0.*v", s - logged, logged);
+ chat_logf(" -- failed");
+ }
+
+ alarm(0);
+ alarmed = 0;
+ exit_code = n + 4;
+ strcpy(fail_reason = fail_buffer, abort_string[n]);
+ return (0);
+ }
+ }
+
+ if (s >= end) {
+ if (logged < s - minlen) {
+ chat_logf("%0.*v", s - logged, logged);
+ logged = s;
+ }
+ s -= minlen;
+ memmove(temp, s, minlen);
+ logged = temp + (logged - s);
+ s = temp + minlen;
+ }
+
+ if (alarmed && verbose)
+ chat_logf("warning: alarm synchronization problem");
+ }
+
+ alarm(0);
+
+ if (verbose && printed) {
+ if (alarmed)
+ chat_logf(" -- read timed out");
+ else
+ chat_logf(" -- read failed: %m");
+ }
+
+ exit_code = 3;
+ alarmed = 0;
+ return (0);
+}
+
+void
+pack_array(char **array, int end)
+{
+ int i, j;
+
+ for (i = 0; i < end; i++) {
+ if (array[i] == NULL) {
+ for (j = i+1; j < end; ++j)
+ if (array[j] != NULL)
+ array[i++] = array[j];
+ for (; i < end; ++i)
+ array[i] = NULL;
+ break;
+ }
+ }
+}
+
+/*
+ * vfmtmsg - format a message into a buffer. Like vsprintf except we
+ * also specify the length of the output buffer, and we handle the
+ * %m (error message) format.
+ * Doesn't do floating-point formats.
+ * Returns the number of chars put into buf.
+ */
+#define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0)
+
+int
+vfmtmsg(char *buf, int buflen, const char *fmt, va_list args)
+{
+ int c, i, n;
+ int width, prec, fillch;
+ int base, len, neg, quoted;
+ unsigned long val = 0;
+ char *str, *buf0;
+ const char *f;
+ unsigned char *p;
+ char num[32];
+ static char hexchars[] = "0123456789abcdef";
+
+ buf0 = buf;
+ --buflen;
+ while (buflen > 0) {
+ for (f = fmt; *f != '%' && *f != 0; ++f)
+ ;
+ if (f > fmt) {
+ len = f - fmt;
+ if (len > buflen)
+ len = buflen;
+ memcpy(buf, fmt, len);
+ buf += len;
+ buflen -= len;
+ fmt = f;
+ }
+ if (*fmt == 0)
+ break;
+ c = *++fmt;
+ width = prec = 0;
+ fillch = ' ';
+ if (c == '0') {
+ fillch = '0';
+ c = *++fmt;
+ }
+ if (c == '*') {
+ width = va_arg(args, int);
+ c = *++fmt;
+ } else {
+ while (isdigit(c)) {
+ width = width * 10 + c - '0';
+ c = *++fmt;
+ }
+ }
+ if (c == '.') {
+ c = *++fmt;
+ if (c == '*') {
+ prec = va_arg(args, int);
+ c = *++fmt;
+ } else {
+ while (isdigit(c)) {
+ prec = prec * 10 + c - '0';
+ c = *++fmt;
+ }
+ }
+ }
+ str = NULL;
+ base = 0;
+ neg = 0;
+ ++fmt;
+ switch (c) {
+ case 'd':
+ i = va_arg(args, int);
+ if (i < 0) {
+ neg = 1;
+ val = -i;
+ } else
+ val = i;
+ base = 10;
+ break;
+ case 'o':
+ val = va_arg(args, unsigned int);
+ base = 8;
+ break;
+ case 'x':
+ val = va_arg(args, unsigned int);
+ base = 16;
+ break;
+ case 'p':
+ val = (unsigned long) va_arg(args, void *);
+ base = 16;
+ neg = 2;
+ break;
+ case 's':
+ str = va_arg(args, char *);
+ break;
+ case 'c':
+ num[0] = va_arg(args, int);
+ num[1] = 0;
+ str = num;
+ break;
+ case 'm':
+ str = strerror(errno);
+ break;
+ case 'v': /* "visible" string */
+ case 'q': /* quoted string */
+ quoted = c == 'q';
+ p = va_arg(args, unsigned char *);
+ if (fillch == '0' && prec > 0) {
+ n = prec;
+ } else {
+ n = strlen((char *)p);
+ if (prec > 0 && prec < n)
+ n = prec;
+ }
+ while (n > 0 && buflen > 0) {
+ c = *p++;
+ --n;
+ if (!quoted && c >= 0x80) {
+ OUTCHAR('M');
+ OUTCHAR('-');
+ c -= 0x80;
+ }
+ if (quoted && (c == '"' || c == '\\'))
+ OUTCHAR('\\');
+ if (c < 0x20 || (0x7f <= c && c < 0xa0)) {
+ if (quoted) {
+ OUTCHAR('\\');
+ switch (c) {
+ case '\t': OUTCHAR('t'); break;
+ case '\n': OUTCHAR('n'); break;
+ case '\b': OUTCHAR('b'); break;
+ case '\f': OUTCHAR('f'); break;
+ default:
+ OUTCHAR('x');
+ OUTCHAR(hexchars[c >> 4]);
+ OUTCHAR(hexchars[c & 0xf]);
+ }
+ } else {
+ if (c == '\t')
+ OUTCHAR(c);
+ else {
+ OUTCHAR('^');
+ OUTCHAR(c ^ 0x40);
+ }
+ }
+ } else
+ OUTCHAR(c);
+ }
+ continue;
+ default:
+ *buf++ = '%';
+ if (c != '%')
+ --fmt; /* so %z outputs %z etc. */
+ --buflen;
+ continue;
+ }
+ if (base != 0) {
+ str = num + sizeof(num);
+ *--str = 0;
+ while (str > num + neg) {
+ *--str = hexchars[val % base];
+ val = val / base;
+ if (--prec <= 0 && val == 0)
+ break;
+ }
+ switch (neg) {
+ case 1:
+ *--str = '-';
+ break;
+ case 2:
+ *--str = 'x';
+ *--str = '0';
+ break;
+ }
+ len = num + sizeof(num) - 1 - str;
+ } else {
+ len = strlen(str);
+ if (prec > 0 && len > prec)
+ len = prec;
+ }
+ if (width > 0) {
+ if (width > buflen)
+ width = buflen;
+ if ((n = width - len) > 0) {
+ buflen -= n;
+ for (; n > 0; --n)
+ *buf++ = fillch;
+ }
+ }
+ if (len > buflen)
+ len = buflen;
+ memcpy(buf, str, len);
+ buf += len;
+ buflen -= len;
+ }
+ *buf = 0;
+ return buf - buf0;
+}
diff --git a/usr.bin/checknr/Makefile b/usr.bin/checknr/Makefile
new file mode 100644
index 0000000..8a47b59
--- /dev/null
+++ b/usr.bin/checknr/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= checknr
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/checknr/Makefile.depend b/usr.bin/checknr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/checknr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/checknr/checknr.1 b/usr.bin/checknr/checknr.1
new file mode 100644
index 0000000..a89706e
--- /dev/null
+++ b/usr.bin/checknr/checknr.1
@@ -0,0 +1,159 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)checknr.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 5, 2015
+.Dt CHECKNR 1
+.Os
+.Sh NAME
+.Nm checknr
+.Nd check nroff/troff files
+.Sh SYNOPSIS
+.Nm
+.Op Fl a Ns Ar \&.x1.y1.x2.y2. ... \&.xn.yn
+.Op Fl c Ns Ar \&.x1.x2.x3 ... \&.xn
+.Op Fl s
+.Op Fl f
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility checks a list of
+.Xr nroff 1
+or
+.Xr troff 1
+input files for certain kinds of errors
+involving mismatched opening and closing delimiters
+and unknown commands.
+If no files are specified,
+.Nm
+checks the standard input.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Add additional pairs of macros to the list of known macros.
+This must be followed by groups of six characters, each group defining
+a pair of macros.
+The six characters are
+a period,
+the first macro name,
+another period,
+and the second macro name.
+For example, to define a pair .BS and .ES, use
+.Sq Li \-a.BS.ES
+.It Fl c
+Define commands which would otherwise be complained about
+as undefined.
+.It Fl f
+Request
+.Nm
+to ignore
+.Ql \ef
+font changes.
+.It Fl s
+Ignore
+.Ql \es
+size changes.
+.El
+.Pp
+Delimiters checked are:
+.Bl -enum
+.It
+Font changes using \efx ...\& \efP.
+.It
+Size changes using \esx ...\& \es0.
+.It
+Macros that come in open ...\& close forms, for example,
+the .TS and .TE macros which must always come in pairs.
+.El
+.Pp
+The
+.Nm
+utility is intended for use on documents that are prepared with
+.Nm
+in mind, much the same as
+.Xr lint 1 .
+It expects a certain document writing style for
+.Ql \ef
+and
+.Ql \es
+commands,
+in that each
+.Ql \efx
+must be terminated with
+.Ql \efP
+and
+each
+.Ql \esx
+must be terminated with
+.Ql \es0 .
+While it will work to directly go into the next font or explicitly
+specify the original font or point size,
+and many existing documents actually do this,
+such a practice will produce complaints from
+.Nm .
+Since it is probably better to use the
+.Ql \efP
+and
+.Ql \es0
+forms anyway,
+you should think of this as a contribution to your document
+preparation style.
+.Pp
+The
+.Nm
+utility knows about the
+.Xr ms 7
+and
+.Xr me 7
+macro packages.
+.Sh DIAGNOSTICS
+.Bd -ragged -compact
+Complaints about unmatched delimiters.
+Complaints about unrecognized commands.
+Various complaints about the syntax of commands.
+.Ed
+.Sh SEE ALSO
+.Xr nroff 1 ,
+.Xr troff 1 ,
+.Xr me 7 ,
+.Xr ms 7
+.\" .Xr checkeq 1 ,
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.0 .
+.Sh BUGS
+There is no way to define a 1 character macro name using
+.Fl a .
+.Pp
+Does not correctly recognize certain reasonable constructs,
+such as conditionals.
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
new file mode 100644
index 0000000..06395b0
--- /dev/null
+++ b/usr.bin/checknr/checknr.c
@@ -0,0 +1,647 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * checknr: check an nroff/troff input file for matching macro calls.
+ * we also attempt to match size and font changes, but only the embedded
+ * kind. These must end in \s0 and \fP resp. Maybe more sophistication
+ * later but for now think of these restrictions as contributions to
+ * structured typesetting.
+ */
+#include <err.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#define MAXSTK 100 /* Stack size */
+#define MAXBR 100 /* Max number of bracket pairs known */
+#define MAXCMDS 600 /* Max number of commands known */
+
+static void addcmd(char *);
+static void addmac(const char *);
+static int binsrch(const char *);
+static void checkknown(const char *);
+static void chkcmd(const char *, const char *);
+static void complain(int);
+static int eq(const char *, const char *);
+static void nomatch(const char *);
+static void pe(int);
+static void process(FILE *);
+static void prop(int);
+static void usage(void);
+
+/*
+ * The stack on which we remember what we've seen so far.
+ */
+static struct stkstr {
+ int opno; /* number of opening bracket */
+ int pl; /* '+', '-', ' ' for \s, 1 for \f, 0 for .ft */
+ int parm; /* parm to size, font, etc */
+ int lno; /* line number */
+} stk[MAXSTK];
+static int stktop;
+
+/*
+ * The kinds of opening and closing brackets.
+ */
+static struct brstr {
+ const char *opbr;
+ const char *clbr;
+} br[MAXBR] = {
+ /* A few bare bones troff commands */
+#define SZ 0
+ {"sz", "sz"}, /* also \s */
+#define FT 1
+ {"ft", "ft"}, /* also \f */
+ /* the -mm package */
+ {"AL", "LE"},
+ {"AS", "AE"},
+ {"BL", "LE"},
+ {"BS", "BE"},
+ {"DF", "DE"},
+ {"DL", "LE"},
+ {"DS", "DE"},
+ {"FS", "FE"},
+ {"ML", "LE"},
+ {"NS", "NE"},
+ {"RL", "LE"},
+ {"VL", "LE"},
+ /* the -ms package */
+ {"AB", "AE"},
+ {"BD", "DE"},
+ {"CD", "DE"},
+ {"DS", "DE"},
+ {"FS", "FE"},
+ {"ID", "DE"},
+ {"KF", "KE"},
+ {"KS", "KE"},
+ {"LD", "DE"},
+ {"LG", "NL"},
+ {"QS", "QE"},
+ {"RS", "RE"},
+ {"SM", "NL"},
+ {"XA", "XE"},
+ {"XS", "XE"},
+ /* The -me package */
+ {"(b", ")b"},
+ {"(c", ")c"},
+ {"(d", ")d"},
+ {"(f", ")f"},
+ {"(l", ")l"},
+ {"(q", ")q"},
+ {"(x", ")x"},
+ {"(z", ")z"},
+ /* The -mdoc package */
+ {"Ao", "Ac"},
+ {"Bd", "Ed"},
+ {"Bk", "Ek"},
+ {"Bo", "Bc"},
+ {"Do", "Dc"},
+ {"Fo", "Fc"},
+ {"Oo", "Oc"},
+ {"Po", "Pc"},
+ {"Qo", "Qc"},
+ {"Rs", "Re"},
+ {"So", "Sc"},
+ {"Xo", "Xc"},
+ /* Things needed by preprocessors */
+ {"EQ", "EN"},
+ {"TS", "TE"},
+ /* Refer */
+ {"[", "]"},
+ {0, 0}
+};
+
+/*
+ * All commands known to nroff, plus macro packages.
+ * Used so we can complain about unrecognized commands.
+ */
+static const char *knowncmds[MAXCMDS] = {
+"$c", "$f", "$h", "$p", "$s", "%A", "%B", "%C", "%D", "%I", "%J", "%N", "%O",
+"%P", "%Q", "%R", "%T", "%V", "(b", "(c", "(d", "(f", "(l", "(q", "(t", "(x",
+"(z", ")b", ")c", ")d", ")f", ")l", ")q", ")t", ")x", ")z", "++", "+c", "1C",
+"1c", "2C", "2c", "@(", "@)", "@C", "@D", "@F", "@I", "@M", "@c", "@e", "@f",
+"@h", "@m", "@n", "@o", "@p", "@r", "@t", "@z", "AB", "AE", "AF", "AI", "AL",
+"AM", "AS", "AT", "AU", "AX", "Ac", "Ad", "An", "Ao", "Ap", "Aq", "Ar", "At",
+"B", "B" , "B1", "B2", "BD", "BE", "BG", "BL", "BS", "BT", "BX", "Bc", "Bd",
+"Bf", "Bk", "Bl", "Bo", "Bq", "Bsx", "Bx", "C1", "C2", "CD", "CM", "CT", "Cd",
+"Cm", "D", "D" , "D1", "DA", "DE", "DF", "DL", "DS", "DT", "Db", "Dc", "Dd",
+"Dl", "Do", "Dq", "Dt", "Dv", "EC", "EF", "EG", "EH", "EM", "EN", "EQ", "EX",
+"Ec", "Ed", "Ef", "Ek", "El", "Em", "Eo", "Er", "Ev", "FA", "FD", "FE", "FG",
+"FJ", "FK", "FL", "FN", "FO", "FQ", "FS", "FV", "FX", "Fa", "Fc", "Fd", "Fl",
+"Fn", "Fo", "Ft", "Fx", "H", "H" , "HC", "HD", "HM", "HO", "HU", "I", "I" ,
+"ID", "IE", "IH", "IM", "IP", "IX", "IZ", "Ic", "In", "It", "KD", "KE", "KF",
+"KQ", "KS", "LB", "LC", "LD", "LE", "LG", "LI", "LP", "Lb", "Li", "MC", "ME",
+"MF", "MH", "ML", "MR", "MT", "ND", "NE", "NH", "NL", "NP", "NS", "Nd", "Nm",
+"No", "Ns", "Nx", "OF", "OH", "OK", "OP", "Oc", "Oo", "Op", "Os", "Ot", "Ox",
+"P", "P" , "P1", "PF", "PH", "PP", "PT", "PX", "PY", "Pa", "Pc", "Pf", "Po",
+"Pp", "Pq", "QE", "QP", "QS", "Qc", "Ql", "Qo", "Qq", "R", "R" , "RA", "RC",
+"RE", "RL", "RP", "RQ", "RS", "RT", "Re", "Rs", "S", "S" , "S0", "S2", "S3",
+"SA", "SG", "SH", "SK", "SM", "SP", "SY", "Sc", "Sh", "Sm", "So", "Sq", "Ss",
+"St", "Sx", "Sy", "T&", "TA", "TB", "TC", "TD", "TE", "TH", "TL", "TM", "TP",
+"TQ", "TR", "TS", "TX", "Tn", "UL", "US", "UX", "Ud", "Ux", "VL", "Va", "Vt",
+"WC", "WH", "XA", "XD", "XE", "XF", "XK", "XP", "XS", "Xc", "Xo", "Xr", "[",
+"[" , "[-", "[0", "[1", "[2", "[3", "[4", "[5", "[<", "[>", "[]", "\\{", "\\}",
+"]", "]" , "]-", "]<", "]>", "][", "ab", "ac", "ad", "af", "am", "ar", "as",
+"b", "b" , "ba", "bc", "bd", "bi", "bl", "bp", "br", "bx", "c.", "c2", "cc",
+"ce", "cf", "ch", "chop", "cs", "ct", "cu", "da", "de", "di", "dl", "dn", "do",
+"ds", "dt", "dw", "dy", "ec", "ef", "eh", "el", "em", "eo", "ep", "ev", "evc",
+"ex", "fallback", "fc", "feature", "fi", "fl", "flig", "fo", "fp", "ft", "ftr",
+"fz", "fzoom", "hc", "he", "hidechar", "hl", "hp", "ht", "hw", "hx", "hy",
+"hylang", "i", "i" , "ie", "if", "ig", "in", "ip", "it", "ix", "kern",
+"kernafter", "kernbefore", "kernpair", "lc", "lc_ctype", "lg", "lhang", "li",
+"ll", "ln", "lo", "lp", "ls", "lt", "m1", "m2", "m3", "m4", "mc", "mk", "mo",
+"n1", "n2", "na", "ne", "nf", "nh", "nl", "nm", "nn", "np", "nr", "ns", "nx",
+"of", "oh", "os", "pa", "papersize", "pc", "pi", "pl", "pm", "pn", "po", "pp",
+"ps", "q", "q" , "r", "r" , "rb", "rd", "re", "recursionlimit", "return",
+"rhang", "rm", "rn", "ro", "rr", "rs", "rt", "sb", "sc", "sh", "shift", "sk",
+"so", "sp", "ss", "st", "sv", "sz", "ta", "tc", "th", "ti", "tl", "tm", "tp",
+"tr", "track", "u", "uf", "uh", "ul", "vs", "wh", "xflag", "xp", "yr",
+0
+};
+
+static int lineno; /* current line number in input file */
+static const char *cfilename; /* name of current file */
+static int nfiles; /* number of files to process */
+static int fflag; /* -f: ignore \f */
+static int sflag; /* -s: ignore \s */
+static int ncmds; /* size of knowncmds */
+static int slot; /* slot in knowncmds found by binsrch */
+
+int
+main(int argc, char **argv)
+{
+ FILE *f;
+ int i;
+ char *cp;
+ char b1[4];
+
+ /* Figure out how many known commands there are */
+ while (knowncmds[ncmds])
+ ncmds++;
+ while (argc > 1 && argv[1][0] == '-') {
+ switch(argv[1][1]) {
+
+ /* -a: add pairs of macros */
+ case 'a':
+ i = strlen(argv[1]) - 2;
+ if (i % 6 != 0)
+ usage();
+ /* look for empty macro slots */
+ for (i=0; br[i].opbr; i++)
+ ;
+ for (cp=argv[1]+3; cp[-1]; cp += 6) {
+ char *tmp;
+
+ if (i >= MAXBR)
+ errx(1, "too many pairs");
+ if ((tmp = malloc(3)) == NULL)
+ err(1, "malloc");
+ strlcpy(tmp, cp, 3);
+ br[i].opbr = tmp;
+ if ((tmp = malloc(3)) == NULL)
+ err(1, "malloc");
+ strlcpy(tmp, cp+3, 3);
+ br[i].clbr = tmp;
+ addmac(br[i].opbr); /* knows pairs are also known cmds */
+ addmac(br[i].clbr);
+ i++;
+ }
+ break;
+
+ /* -c: add known commands */
+ case 'c':
+ i = strlen(argv[1]) - 2;
+ if (i % 3 != 0)
+ usage();
+ for (cp=argv[1]+3; cp[-1]; cp += 3) {
+ if (cp[2] && cp[2] != '.')
+ usage();
+ strncpy(b1, cp, 2);
+ b1[2] = '\0';
+ addmac(b1);
+ }
+ break;
+
+ /* -f: ignore font changes */
+ case 'f':
+ fflag = 1;
+ break;
+
+ /* -s: ignore size changes */
+ case 's':
+ sflag = 1;
+ break;
+ default:
+ usage();
+ }
+ argc--; argv++;
+ }
+
+ nfiles = argc - 1;
+
+ if (nfiles > 0) {
+ for (i = 1; i < argc; i++) {
+ cfilename = argv[i];
+ f = fopen(cfilename, "r");
+ if (f == NULL)
+ warn("%s", cfilename);
+ else {
+ process(f);
+ fclose(f);
+ }
+ }
+ } else {
+ cfilename = "stdin";
+ process(stdin);
+ }
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: checknr [-a.xx.yy.xx.yy...] [-c.xx.xx.xx...] [-s] [-f] file\n");
+ exit(1);
+}
+
+static void
+process(FILE *f)
+{
+ int i, n;
+ char mac[64]; /* The current macro or nroff command */
+ char *line;
+ size_t linecap;
+ int pl;
+
+ line = NULL;
+ linecap = 0;
+ stktop = -1;
+ for (lineno = 1; getline(&line, &linecap, f) > 0; lineno++) {
+ if (line[0] == '.') {
+ /*
+ * find and isolate the macro/command name.
+ */
+ strncpy(mac, line+1, 4);
+ if (isspace(mac[0])) {
+ pe(lineno);
+ printf("Empty command\n");
+ } else if (isspace(mac[1])) {
+ mac[1] = 0;
+ } else if (isspace(mac[2])) {
+ mac[2] = 0;
+ } else if (mac[0] != '\\' || mac[1] != '\"') {
+ pe(lineno);
+ printf("Command too long\n");
+ }
+
+ /*
+ * Is it a known command?
+ */
+ checkknown(mac);
+
+ /*
+ * Should we add it?
+ */
+ if (eq(mac, "de"))
+ addcmd(line);
+
+ chkcmd(line, mac);
+ }
+
+ /*
+ * At this point we process the line looking
+ * for \s and \f.
+ */
+ for (i = 0; line[i]; i++)
+ if (line[i] == '\\' && (i == 0 || line[i-1] != '\\')) {
+ if (!sflag && line[++i] == 's') {
+ pl = line[++i];
+ if (isdigit(pl)) {
+ n = pl - '0';
+ pl = ' ';
+ } else
+ n = 0;
+ while (isdigit(line[++i]))
+ n = 10 * n + line[i] - '0';
+ i--;
+ if (n == 0) {
+ if (stktop >= 0 &&
+ stk[stktop].opno == SZ) {
+ stktop--;
+ } else {
+ pe(lineno);
+ printf("unmatched \\s0\n");
+ }
+ } else {
+ stk[++stktop].opno = SZ;
+ stk[stktop].pl = pl;
+ stk[stktop].parm = n;
+ stk[stktop].lno = lineno;
+ }
+ } else if (!fflag && line[i] == 'f') {
+ n = line[++i];
+ if (n == 'P') {
+ if (stktop >= 0 &&
+ stk[stktop].opno == FT) {
+ stktop--;
+ } else {
+ pe(lineno);
+ printf("unmatched \\fP\n");
+ }
+ } else {
+ stk[++stktop].opno = FT;
+ stk[stktop].pl = 1;
+ stk[stktop].parm = n;
+ stk[stktop].lno = lineno;
+ }
+ }
+ }
+ }
+ free(line);
+ /*
+ * We've hit the end and look at all this stuff that hasn't been
+ * matched yet! Complain, complain.
+ */
+ for (i = stktop; i >= 0; i--) {
+ complain(i);
+ }
+}
+
+static void
+complain(int i)
+{
+ pe(stk[i].lno);
+ printf("Unmatched ");
+ prop(i);
+ printf("\n");
+}
+
+static void
+prop(int i)
+{
+ if (stk[i].pl == 0)
+ printf(".%s", br[stk[i].opno].opbr);
+ else switch(stk[i].opno) {
+ case SZ:
+ printf("\\s%c%d", stk[i].pl, stk[i].parm);
+ break;
+ case FT:
+ printf("\\f%c", stk[i].parm);
+ break;
+ default:
+ printf("Bug: stk[%d].opno = %d = .%s, .%s",
+ i, stk[i].opno, br[stk[i].opno].opbr,
+ br[stk[i].opno].clbr);
+ }
+}
+
+static void
+chkcmd(const char *line __unused, const char *mac)
+{
+ int i;
+
+ /*
+ * Check to see if it matches top of stack.
+ */
+ if (stktop >= 0 && eq(mac, br[stk[stktop].opno].clbr))
+ stktop--; /* OK. Pop & forget */
+ else {
+ /* No. Maybe it's an opener */
+ for (i=0; br[i].opbr; i++) {
+ if (eq(mac, br[i].opbr)) {
+ /* Found. Push it. */
+ stktop++;
+ stk[stktop].opno = i;
+ stk[stktop].pl = 0;
+ stk[stktop].parm = 0;
+ stk[stktop].lno = lineno;
+ break;
+ }
+ /*
+ * Maybe it's an unmatched closer.
+ * NOTE: this depends on the fact
+ * that none of the closers can be
+ * openers too.
+ */
+ if (eq(mac, br[i].clbr)) {
+ nomatch(mac);
+ break;
+ }
+ }
+ }
+}
+
+static void
+nomatch(const char *mac)
+{
+ int i, j;
+
+ /*
+ * Look for a match further down on stack
+ * If we find one, it suggests that the stuff in
+ * between is supposed to match itself.
+ */
+ for (j=stktop; j>=0; j--)
+ if (eq(mac,br[stk[j].opno].clbr)) {
+ /* Found. Make a good diagnostic. */
+ if (j == stktop-2) {
+ /*
+ * Check for special case \fx..\fR and don't
+ * complain.
+ */
+ if (stk[j+1].opno==FT && stk[j+1].parm!='R'
+ && stk[j+2].opno==FT && stk[j+2].parm=='R') {
+ stktop = j -1;
+ return;
+ }
+ /*
+ * We have two unmatched frobs. Chances are
+ * they were intended to match, so we mention
+ * them together.
+ */
+ pe(stk[j+1].lno);
+ prop(j+1);
+ printf(" does not match %d: ", stk[j+2].lno);
+ prop(j+2);
+ printf("\n");
+ } else for (i=j+1; i <= stktop; i++) {
+ complain(i);
+ }
+ stktop = j-1;
+ return;
+ }
+ /* Didn't find one. Throw this away. */
+ pe(lineno);
+ printf("Unmatched .%s\n", mac);
+}
+
+/* eq: are two strings equal? */
+static int
+eq(const char *s1, const char *s2)
+{
+ return (strcmp(s1, s2) == 0);
+}
+
+/* print the first part of an error message, given the line number */
+static void
+pe(int linen)
+{
+ if (nfiles > 1)
+ printf("%s: ", cfilename);
+ printf("%d: ", linen);
+}
+
+static void
+checkknown(const char *mac)
+{
+
+ if (eq(mac, "."))
+ return;
+ if (binsrch(mac) >= 0)
+ return;
+ if (mac[0] == '\\' && mac[1] == '"') /* comments */
+ return;
+
+ pe(lineno);
+ printf("Unknown command: .%s\n", mac);
+}
+
+/*
+ * We have a .de xx line in "line". Add xx to the list of known commands.
+ */
+static void
+addcmd(char *line)
+{
+ char *mac;
+
+ /* grab the macro being defined */
+ mac = line+4;
+ while (isspace(*mac))
+ mac++;
+ if (*mac == 0) {
+ pe(lineno);
+ printf("illegal define: %s\n", line);
+ return;
+ }
+ mac[2] = 0;
+ if (isspace(mac[1]) || mac[1] == '\\')
+ mac[1] = 0;
+ if (ncmds >= MAXCMDS) {
+ printf("Only %d known commands allowed\n", MAXCMDS);
+ exit(1);
+ }
+ addmac(mac);
+}
+
+/*
+ * Add mac to the list. We should really have some kind of tree
+ * structure here but this is a quick-and-dirty job and I just don't
+ * have time to mess with it. (I wonder if this will come back to haunt
+ * me someday?) Anyway, I claim that .de is fairly rare in user
+ * nroff programs, and the register loop below is pretty fast.
+ */
+static void
+addmac(const char *mac)
+{
+ const char **src, **dest, **loc;
+
+ if (binsrch(mac) >= 0){ /* it's OK to redefine something */
+#ifdef DEBUG
+ printf("binsrch(%s) -> already in table\n", mac);
+#endif
+ return;
+ }
+ /* binsrch sets slot as a side effect */
+#ifdef DEBUG
+ printf("binsrch(%s) -> %d\n", mac, slot);
+#endif
+ loc = &knowncmds[slot];
+ src = &knowncmds[ncmds-1];
+ dest = src+1;
+ while (dest > loc)
+ *dest-- = *src--;
+ if ((*loc = strdup(mac)) == NULL)
+ err(1, "strdup");
+ ncmds++;
+#ifdef DEBUG
+ printf("after: %s %s %s %s %s, %d cmds\n",
+ knowncmds[slot-2], knowncmds[slot-1], knowncmds[slot],
+ knowncmds[slot+1], knowncmds[slot+2], ncmds);
+#endif
+}
+
+/*
+ * Do a binary search in knowncmds for mac.
+ * If found, return the index. If not, return -1.
+ */
+static int
+binsrch(const char *mac)
+{
+ const char *p; /* pointer to current cmd in list */
+ int d; /* difference if any */
+ int mid; /* mid point in binary search */
+ int top, bot; /* boundaries of bin search, inclusive */
+
+ top = ncmds-1;
+ bot = 0;
+ while (top >= bot) {
+ mid = (top+bot)/2;
+ p = knowncmds[mid];
+ d = p[0] - mac[0];
+ if (d == 0)
+ d = p[1] - mac[1];
+ if (d == 0)
+ return (mid);
+ if (d < 0)
+ bot = mid + 1;
+ else
+ top = mid - 1;
+ }
+ slot = bot; /* place it would have gone */
+ return (-1);
+}
diff --git a/usr.bin/chkey/Makefile b/usr.bin/chkey/Makefile
new file mode 100644
index 0000000..4f47b9c
--- /dev/null
+++ b/usr.bin/chkey/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+.PATH: ${.CURDIR}/../newkey
+
+PROG= chkey
+SRCS= chkey.c generic.c update.c
+CFLAGS+= -I${.CURDIR}/../newkey
+.if ${MK_NIS} != "no"
+CFLAGS+= -DYP
+.endif
+LIBADD+= rpcsvc mp
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/chkey/Makefile.depend b/usr.bin/chkey/Makefile.depend
new file mode 100644
index 0000000..bae15c2
--- /dev/null
+++ b/usr.bin/chkey/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmp \
+ lib/librpcsvc \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/chkey/chkey.1 b/usr.bin/chkey/chkey.1
new file mode 100644
index 0000000..a4467c8
--- /dev/null
+++ b/usr.bin/chkey/chkey.1
@@ -0,0 +1,25 @@
+.\" @(#)chkey.1 1.5 91/03/11 TIRPC 1.0;
+.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
+.\" $FreeBSD$
+.\"
+.Dd July 5, 1989
+.Dt CHKEY 1
+.Os
+.Sh NAME
+.Nm chkey
+.Nd change your encryption key
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility prompts the user for their login password,
+and uses it to encrypt a new encryption key
+for the user to be stored in the
+.Xr publickey 5
+database.
+.Sh "SEE ALSO"
+.Xr keylogin 1 ,
+.Xr publickey 5 ,
+.Xr keyserv 8 ,
+.Xr newkey 8
diff --git a/usr.bin/chkey/chkey.c b/usr.bin/chkey/chkey.c
new file mode 100644
index 0000000..4751a28
--- /dev/null
+++ b/usr.bin/chkey/chkey.c
@@ -0,0 +1,274 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)chkey.c 1.7 91/03/11 Copyr 1986 Sun Micro";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+
+/*
+ * Command to change one's public key in the public key database
+ */
+#include <rpc/rpc.h>
+#include <rpc/key_prot.h>
+#ifdef YP
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#else
+#define YPOP_STORE 4
+#endif
+#include <sys/fcntl.h>
+#include <err.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#ifdef YPPASSWD
+struct passwd *ypgetpwuid(uid_t);
+#endif
+
+#ifdef YP
+static char *domain;
+static char PKMAP[] = "publickey.byname";
+#else
+static char PKFILE[] = "/etc/publickey";
+#endif /* YP */
+static char ROOTKEY[] = "/etc/.rootkey";
+
+static void usage(void);
+extern int yp_update(char *, char *, int, char *, size_t, char *, size_t);
+
+int
+main(int argc, char **argv)
+{
+ char name[MAXNETNAMELEN+1];
+ char public[HEXKEYBYTES + 1];
+ char secret[HEXKEYBYTES + 1];
+ char crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
+ char crypt2[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
+ int status;
+ char *pass;
+ struct passwd *pw;
+ uid_t uid;
+ int force = 0;
+ int ch;
+#ifdef YP
+ char *master;
+#endif
+#ifdef YPPASSWD
+ char *cryptpw;
+#endif
+
+ while ((ch = getopt(argc, argv, "f")) != -1)
+ switch(ch) {
+ case 'f':
+ force = 1;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 0)
+ usage();
+
+#ifdef YP
+ (void)yp_get_default_domain(&domain);
+ if (yp_master(domain, PKMAP, &master) != 0)
+ errx(1, "can't find master of publickey database");
+#endif
+ uid = getuid() /*geteuid()*/;
+ if (uid == 0) {
+ if (host2netname(name, NULL, NULL) == 0)
+ errx(1, "cannot convert hostname to netname");
+ } else {
+ if (user2netname(name, uid, NULL) == 0)
+ errx(1, "cannot convert username to netname");
+ }
+ (void)printf("Generating new key for %s.\n", name);
+
+ if (!force) {
+ if (uid != 0) {
+#ifdef YPPASSWD
+ pw = ypgetpwuid(uid);
+#else
+ pw = getpwuid(uid);
+#endif
+ if (pw == NULL) {
+#ifdef YPPASSWD
+ errx(1,
+ "no NIS password entry found: can't change key");
+#else
+ errx(1,
+ "no password entry found: can't change key");
+#endif
+ }
+ } else {
+ pw = getpwuid(0);
+ if (pw == NULL)
+ errx(1, "no password entry found: can't change key");
+ }
+ }
+ pass = getpass("Password:");
+#ifdef YPPASSWD
+ if (!force) {
+ cryptpw = crypt(pass, pw->pw_passwd);
+ if (cryptpw == NULL || strcmp(cryptpw, pw->pw_passwd) != 0)
+ errx(1, "invalid password");
+ }
+#else
+ force = 1; /* Make this mandatory */
+#endif
+ genkeys(public, secret, pass);
+
+ memcpy(crypt1, secret, HEXKEYBYTES);
+ memcpy(crypt1 + HEXKEYBYTES, secret, KEYCHECKSUMSIZE);
+ crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE] = 0;
+ xencrypt(crypt1, pass);
+
+ if (force) {
+ memcpy(crypt2, crypt1, HEXKEYBYTES + KEYCHECKSUMSIZE + 1);
+ xdecrypt(crypt2, getpass("Retype password:"));
+ if (memcmp(crypt2, crypt2 + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0
+ || memcmp(crypt2, secret, HEXKEYBYTES) != 0)
+ errx(1, "password incorrect");
+ }
+
+#ifdef YP
+ (void)printf("Sending key change request to %s...\n", master);
+#endif
+ status = setpublicmap(name, public, crypt1);
+ if (status != 0) {
+#ifdef YP
+ errx(1, "unable to update NIS database (%u): %s",
+ status, yperr_string(status));
+#else
+ errx(1, "unable to update publickey database");
+#endif
+ }
+
+ if (uid == 0) {
+ /*
+ * Root users store their key in /etc/$ROOTKEY so
+ * that they can auto reboot without having to be
+ * around to type a password. Storing this in a file
+ * is rather dubious: it should really be in the EEPROM
+ * so it does not go over the net.
+ */
+ int fd;
+
+ fd = open(ROOTKEY, O_WRONLY|O_TRUNC|O_CREAT, 0);
+ if (fd < 0) {
+ warn("%s", ROOTKEY);
+ } else {
+ char newline = '\n';
+
+ if (write(fd, secret, strlen(secret)) < 0 ||
+ write(fd, &newline, sizeof(newline)) < 0)
+ warn("%s: write", ROOTKEY);
+ }
+ close(fd);
+ }
+
+ if (key_setsecret(secret) < 0)
+ errx(1, "unable to login with new secret key");
+ (void)printf("Done.\n");
+ exit(0);
+ /* NOTREACHED */
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: chkey [-f]\n");
+ exit(1);
+ /* NOTREACHED */
+}
+
+
+/*
+ * Set the entry in the public key file
+ */
+int
+setpublicmap(char *name, char *public, char *secret)
+{
+ char pkent[1024];
+
+ (void)sprintf(pkent,"%s:%s", public, secret);
+#ifdef YP
+ return (yp_update(domain, PKMAP, YPOP_STORE,
+ name, strlen(name), pkent, strlen(pkent)));
+#else
+ return (localupdate(name, PKFILE, YPOP_STORE,
+ strlen(name), name, strlen(pkent), pkent));
+#endif
+}
+
+#ifdef YPPASSWD
+struct passwd *
+ypgetpwuid(uid_t uid)
+{
+ char uidstr[10];
+ char *val;
+ int vallen;
+ static struct passwd pw;
+ char *p;
+
+ (void)sprintf(uidstr, "%d", uid);
+ if (yp_match(domain, "passwd.byuid", uidstr, strlen(uidstr),
+ &val, &vallen) != 0) {
+ return (NULL);
+ }
+ p = strchr(val, ':');
+ if (p == NULL) {
+ return (NULL);
+ }
+ pw.pw_passwd = p + 1;
+ p = strchr(pw.pw_passwd, ':');
+ if (p == NULL) {
+ return (NULL);
+ }
+ *p = 0;
+ return (&pw);
+}
+#endif /* YPPASSWD */
diff --git a/usr.bin/chpass/Makefile b/usr.bin/chpass/Makefile
new file mode 100644
index 0000000..16974e2
--- /dev/null
+++ b/usr.bin/chpass/Makefile
@@ -0,0 +1,45 @@
+# @(#)Makefile 8.2 (Berkeley) 4/2/94
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+.PATH: ${.CURDIR}/../../usr.sbin/pwd_mkdb ${.CURDIR}/../../lib/libc/gen
+
+PROG= chpass
+SRCS= chpass.c edit.c field.c pw_scan.c table.c util.c
+BINOWN= root
+BINMODE=4555
+PRECIOUSPROG=
+.if ${MK_NIS} != "no"
+CFLAGS+= -DYP
+.endif
+#Some people need this, uncomment to activate
+#CFLAGS+=-DRESTRICT_FULLNAME_CHANGE
+CFLAGS+=-I${.CURDIR}/../../usr.sbin/pwd_mkdb -I${.CURDIR}/../../lib/libc/gen -I.
+
+LIBADD= crypt util
+.if ${MK_NIS} != "no"
+LIBADD+= ypclnt
+.endif
+
+SYMLINKS= ${BINDIR}/chpass ${BINDIR}/chfn
+SYMLINKS+= ${BINDIR}/chpass ${BINDIR}/chsh
+.if ${MK_NIS} != "no"
+SYMLINKS+= ${BINDIR}/chpass ${BINDIR}/ypchpass
+SYMLINKS+= ${BINDIR}/chpass ${BINDIR}/ypchfn
+SYMLINKS+= ${BINDIR}/chpass ${BINDIR}/ypchsh
+.endif
+
+MLINKS= chpass.1 chfn.1 chpass.1 chsh.1
+.if ${MK_NIS} != "no"
+MLINKS+= chpass.1 ypchpass.1 chpass.1 ypchfn.1 chpass.1 ypchsh.1
+.endif
+
+beforeinstall:
+.for i in chpass chfn chsh ypchpass ypchfn ypchsh
+.if exists(${DESTDIR}${BINDIR}/$i)
+ -chflags noschg ${DESTDIR}${BINDIR}/$i
+.endif
+.endfor
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/chpass/Makefile.depend b/usr.bin/chpass/Makefile.depend
new file mode 100644
index 0000000..3dc74b2
--- /dev/null
+++ b/usr.bin/chpass/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ lib/libutil \
+ lib/libypclnt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/chpass/chpass.1 b/usr.bin/chpass/chpass.1
new file mode 100644
index 0000000..a97531e
--- /dev/null
+++ b/usr.bin/chpass/chpass.1
@@ -0,0 +1,485 @@
+.\" Copyright (c) 1988, 1990, 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.
+.\"
+.\" @(#)chpass.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd December 30, 1993
+.Dt CHPASS 1
+.Os
+.Sh NAME
+.Nm chpass ,
+.Nm chfn ,
+.Nm chsh ,
+.Nm ypchpass ,
+.Nm ypchfn ,
+.Nm ypchsh
+.Nd add or change user database information
+.Sh SYNOPSIS
+.Nm
+.Op Fl a Ar list
+.Op Fl p Ar encpass
+.Op Fl e Ar expiretime
+.Op Fl s Ar newshell
+.Op user
+.Nm
+.Op Fl oly
+.Op Fl a Ar list
+.Op Fl p Ar encpass
+.Op Fl e Ar expiretime
+.Op Fl s Ar newshell
+.Op Fl d Ar domain
+.Op Fl h Ar host
+.Op user
+.Sh DESCRIPTION
+The
+.Nm
+utility
+allows editing of the user database information associated
+with
+.Ar user
+or, by default, the current user.
+.Pp
+The
+.Nm chfn ,
+.Nm chsh ,
+.Nm ypchpass ,
+.Nm ypchfn
+and
+.Nm ypchsh
+utilities behave identically to
+.Nm .
+(There is only one program.)
+.Pp
+The information is formatted and supplied to an editor for changes.
+.Pp
+Only the information that the user is allowed to change is displayed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+The super-user is allowed to directly supply a user database
+entry, in the format specified by
+.Xr passwd 5 ,
+as an argument.
+This argument must be a colon
+.Pq Dq \&:
+separated list of all the
+user database fields, although they may be empty.
+.It Fl p
+The super-user is allowed to directly supply an encrypted password field,
+in the format used by
+.Xr crypt 3 ,
+as an argument.
+.It Fl e Ar expiretime
+Change the account expire time.
+This option is used to set the expire time
+from a script as if it was done in the interactive editor.
+.It Fl s Ar newshell
+Attempt to change the user's shell to
+.Ar newshell .
+.El
+.Pp
+Possible display items are as follows:
+.Pp
+.Bl -tag -width "Other Information:" -compact -offset indent
+.It Login:
+user's login name
+.It Password:
+user's encrypted password
+.It Uid:
+user's login
+.It Gid:
+user's login group
+.It Class:
+user's general classification
+.It Change:
+password change time
+.It Expire:
+account expiration time
+.It Full Name:
+user's real name
+.It Office Location:
+user's office location (1)
+.It Office Phone:
+user's office phone (1)
+.It Home Phone:
+user's home phone (1)
+.It Other Information:
+any locally defined parameters for user (1)
+.It Home Directory:
+user's home directory
+.It Shell:
+user's login shell
+.Pp
+.It NOTE(1) -
+In the actual master.passwd file, these fields are comma-delimited
+fields embedded in the FullName field.
+.El
+.Pp
+The
+.Ar login
+field is the user name used to access the computer account.
+.Pp
+The
+.Ar password
+field contains the encrypted form of the user's password.
+.Pp
+The
+.Ar uid
+field is the number associated with the
+.Ar login
+field.
+Both of these fields should be unique across the system (and often
+across a group of systems) as they control file access.
+.Pp
+While it is possible to have multiple entries with identical login names
+and/or identical user id's, it is usually a mistake to do so.
+Routines
+that manipulate these files will often return only one of the multiple
+entries, and that one by random selection.
+.Pp
+The
+.Ar gid
+field is the group that the user will be placed in at login.
+Since
+.Bx
+supports multiple groups (see
+.Xr groups 1 )
+this field currently has little special meaning.
+This field may be filled in with either a number or a group name (see
+.Xr group 5 ) .
+.Pp
+The
+.Ar class
+field references class descriptions in
+.Pa /etc/login.conf
+and is typically used to initialize the user's system resource limits
+when they login.
+.Pp
+The
+.Ar change
+field is the date by which the password must be changed.
+.Pp
+The
+.Ar expire
+field is the date on which the account expires.
+.Pp
+Both the
+.Ar change
+and
+.Ar expire
+fields should be entered in the form
+.Dq month day year
+where
+.Ar month
+is the month name (the first three characters are sufficient),
+.Ar day
+is the day of the month, and
+.Ar year
+is the year.
+.Pp
+Five fields are available for storing the user's
+.Ar full name , office location ,
+.Ar work
+and
+.Ar home telephone
+numbers and finally
+.Ar other information
+which is a single comma delimited string to represent any additional
+gecos fields (typically used for site specific user information).
+Note that
+.Xr finger 1
+will display the office location and office phone together under the
+heading
+.Ar Office: .
+.Pp
+The user's
+.Ar home directory
+is the full
+.Ux
+path name where the user
+will be placed at login.
+.Pp
+The
+.Ar shell
+field is the command interpreter the user prefers.
+If the
+.Ar shell
+field is empty, the Bourne shell,
+.Pa /bin/sh ,
+is assumed.
+When altering a login shell, and not the super-user, the user
+may not change from a non-standard shell or to a non-standard
+shell.
+Non-standard is defined as a shell not found in
+.Pa /etc/shells .
+.Pp
+Once the information has been verified,
+.Nm
+uses
+.Xr pwd_mkdb 8
+to update the user database.
+.Sh ENVIRONMENT
+The
+.Xr vi 1
+editor will be used unless the environment variable
+.Ev EDITOR
+is set to
+an alternate editor.
+When the editor terminates, the information is re-read and used to
+update the user database itself.
+Only the user, or the super-user, may edit the information associated
+with the user.
+.Pp
+See
+.Xr pwd_mkdb 8
+for an explanation of the impact of setting the
+.Ev PW_SCAN_BIG_IDS
+environment variable.
+.Sh NIS INTERACTION
+The
+.Nm
+utility can also be used in conjunction with NIS, however some restrictions
+apply.
+Currently,
+.Nm
+can only make changes to the NIS passwd maps through
+.Xr rpc.yppasswdd 8 ,
+which normally only permits changes to a user's password, shell and GECOS
+fields.
+Except when invoked by the super-user on the NIS master server,
+.Nm
+(and, similarly,
+.Xr passwd 1 )
+cannot use the
+.Xr rpc.yppasswdd 8
+server to change other user information or
+add new records to the NIS passwd maps.
+Furthermore,
+.Xr rpc.yppasswdd 8
+requires password authentication before it will make any
+changes.
+The only user allowed to submit changes without supplying
+a password is the super-user on the NIS master server; all other users,
+including those with root privileges on NIS clients (and NIS slave
+servers) must enter a password.
+(The super-user on the NIS master is allowed to bypass these restrictions
+largely for convenience: a user with root access
+to the NIS master server already has the privileges required to make
+updates to the NIS maps, but editing the map source files by hand can
+be cumbersome.
+.Pp
+Note: these exceptions only apply when the NIS master server is a
+.Fx
+system).
+.Pp
+Consequently, except where noted, the following restrictions apply when
+.Nm
+is used with NIS:
+.Bl -enum -offset indent
+.It
+.Em "Only the shell and GECOS information may be changed" .
+All other
+fields are restricted, even when
+.Nm
+is invoked by the super-user.
+While support for
+changing other fields could be added, this would lead to
+compatibility problems with other NIS-capable systems.
+Even though the super-user may supply data for other fields
+while editing an entry, the extra information (other than the
+password -- see below) will be silently discarded.
+.Pp
+Exception: the super-user on the NIS master server is permitted to
+change any field.
+.It
+.Em "Password authentication is required" .
+The
+.Nm
+utility will prompt for the user's NIS password before effecting
+any changes.
+If the password is invalid, all changes will be
+discarded.
+.Pp
+Exception: the super-user on the NIS master server is allowed to
+submit changes without supplying a password.
+(The super-user may
+choose to turn off this feature using the
+.Fl o
+flag, described below.)
+.It
+.Em "Adding new records to the local password database is discouraged" .
+The
+.Nm
+utility will allow the administrator to add new records to the
+local password database while NIS is enabled, but this can lead to
+some confusion since the new records are appended to the end of
+the master password file, usually after the special NIS '+' entries.
+The administrator should use
+.Xr vipw 8
+to modify the local password
+file when NIS is running.
+.Pp
+The super-user on the NIS master server is permitted to add new records
+to the NIS password maps, provided the
+.Xr rpc.yppasswdd 8
+server has been started with the
+.Fl a
+flag to permitted additions (it refuses them by default).
+The
+.Nm
+utility tries to update the local password database by default; to update the
+NIS maps instead, invoke chpass with the
+.Fl y
+flag.
+.It
+.Em "Password changes are not permitted".
+Users should use
+.Xr passwd 1
+or
+.Xr yppasswd 1
+to change their NIS passwords.
+The super-user is allowed to specify
+a new password (even though the
+.Dq Password:
+field does not show
+up in the editor template, the super-user may add it back by hand),
+but even the super-user must supply the user's original password
+otherwise
+.Xr rpc.yppasswdd 8
+will refuse to update the NIS maps.
+.Pp
+Exception: the super-user on the NIS master server is permitted to
+change a user's NIS password with
+.Nm .
+.El
+.Pp
+There are also a few extra option flags that are available when
+.Nm
+is compiled with NIS support:
+.Bl -tag -width indent
+.It Fl l
+Force
+.Nm
+to modify the local copy of a user's password
+information in the event that a user exists in both
+the local and NIS databases.
+.It Fl y
+Opposite effect of
+.Fl l .
+This flag is largely redundant since
+.Nm
+operates on NIS entries by default if NIS is enabled.
+.It Fl d Ar domain
+Specify a particular NIS domain.
+The
+.Nm
+utility uses the system domain name by default, as set by the
+.Xr domainname 1
+utility.
+The
+.Fl d
+option can be used to override a default, or to specify a domain
+when the system domain name is not set.
+.It Fl h Ar host
+Specify the name or address of an NIS server to query.
+Normally,
+.Nm
+will communicate with the NIS master host specified in the
+.Pa master.passwd
+or
+.Pa passwd
+maps.
+On hosts that have not been configured as NIS clients, there is
+no way for the program to determine this information unless the user
+provides the hostname of a server.
+Note that the specified hostname need
+not be that of the NIS master server; the name of any server, master or
+slave, in a given NIS domain will do.
+.Pp
+When using the
+.Fl d
+option, the hostname defaults to
+.Dq localhost .
+The
+.Fl h
+option can be used in conjunction with the
+.Fl d
+option, in which case the user-specified hostname will override
+the default.
+.It Fl o
+Force the use of RPC-based updates when communicating with
+.Xr rpc.yppasswdd 8
+.Pq Dq old-mode .
+When invoked by the super-user on the NIS master server,
+.Nm
+allows unrestricted changes to the NIS passwd maps using dedicated,
+non-RPC-based mechanism (in this case, a
+.Ux
+domain socket).
+The
+.Fl o
+flag can be used to force
+.Nm
+to use the standard update mechanism instead.
+This option is provided
+mainly for testing purposes.
+.El
+.Sh FILES
+.Bl -tag -width /etc/master.passwd -compact
+.It Pa /etc/master.passwd
+the user database
+.It Pa /etc/passwd
+a Version 7 format password file
+.It Pa /etc/chpass.XXXXXX
+temporary copy of the password file
+.It Pa /etc/shells
+the list of approved shells
+.El
+.Sh SEE ALSO
+.Xr finger 1 ,
+.Xr login 1 ,
+.Xr passwd 1 ,
+.Xr getusershell 3 ,
+.Xr login.conf 5 ,
+.Xr passwd 5 ,
+.Xr pw 8 ,
+.Xr pwd_mkdb 8 ,
+.Xr vipw 8
+.Rs
+.%A Robert Morris
+.%A Ken Thompson
+.%T "UNIX Password security"
+.Re
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.3 Reno .
+.Sh BUGS
+User information should (and eventually will) be stored elsewhere.
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
new file mode 100644
index 0000000..9f9be53
--- /dev/null
+++ b/usr.bin/chpass/chpass.c
@@ -0,0 +1,305 @@
+/*-
+ * Copyright (c) 1988, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1988, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <err.h>
+#include <errno.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef YP
+#include <ypclnt.h>
+#endif
+
+#include <pw_scan.h>
+#include <libutil.h>
+
+#include "chpass.h"
+
+int master_mode;
+
+static void baduser(void);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ enum { NEWSH, LOADENTRY, EDITENTRY, NEWPW, NEWEXP } op;
+ struct passwd lpw, *old_pw, *pw;
+ int ch, pfd, tfd;
+ const char *password;
+ char *arg = NULL;
+ uid_t uid;
+#ifdef YP
+ struct ypclnt *ypclnt;
+ const char *yp_domain = NULL, *yp_host = NULL;
+#endif
+
+ pw = old_pw = NULL;
+ op = EDITENTRY;
+#ifdef YP
+ while ((ch = getopt(argc, argv, "a:p:s:e:d:h:loy")) != -1)
+#else
+ while ((ch = getopt(argc, argv, "a:p:s:e:")) != -1)
+#endif
+ switch (ch) {
+ case 'a':
+ op = LOADENTRY;
+ arg = optarg;
+ break;
+ case 's':
+ op = NEWSH;
+ arg = optarg;
+ break;
+ case 'p':
+ op = NEWPW;
+ arg = optarg;
+ break;
+ case 'e':
+ op = NEWEXP;
+ arg = optarg;
+ break;
+#ifdef YP
+ case 'd':
+ yp_domain = optarg;
+ break;
+ case 'h':
+ yp_host = optarg;
+ break;
+ case 'l':
+ case 'o':
+ case 'y':
+ /* compatibility */
+ break;
+#endif
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 1)
+ usage();
+
+ uid = getuid();
+
+ if (op == EDITENTRY || op == NEWSH || op == NEWPW || op == NEWEXP) {
+ if (argc == 0) {
+ if ((pw = getpwuid(uid)) == NULL)
+ errx(1, "unknown user: uid %lu",
+ (unsigned long)uid);
+ } else {
+ if ((pw = getpwnam(*argv)) == NULL)
+ errx(1, "unknown user: %s", *argv);
+ if (uid != 0 && uid != pw->pw_uid)
+ baduser();
+ }
+
+ /* Make a copy for later verification */
+ if ((pw = pw_dup(pw)) == NULL ||
+ (old_pw = pw_dup(pw)) == NULL)
+ err(1, "pw_dup");
+ }
+
+#ifdef YP
+ if (pw != NULL && (pw->pw_fields & _PWF_SOURCE) == _PWF_NIS) {
+ ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
+ master_mode = (ypclnt != NULL &&
+ ypclnt_connect(ypclnt) != -1 &&
+ ypclnt_havepasswdd(ypclnt) == 1);
+ ypclnt_free(ypclnt);
+ } else
+#endif
+ master_mode = (uid == 0);
+
+ if (op == NEWSH) {
+ /* protect p_shell -- it thinks NULL is /bin/sh */
+ if (!arg[0])
+ usage();
+ if (p_shell(arg, pw, (ENTRY *)NULL) == -1)
+ exit(1);
+ }
+
+ if (op == NEWEXP) {
+ if (uid) /* only root can change expire */
+ baduser();
+ if (p_expire(arg, pw, (ENTRY *)NULL) == -1)
+ exit(1);
+ }
+
+ if (op == LOADENTRY) {
+ if (uid)
+ baduser();
+ pw = &lpw;
+ old_pw = NULL;
+ if (!__pw_scan(arg, pw, _PWSCAN_WARN|_PWSCAN_MASTER))
+ exit(1);
+ }
+
+ if (op == NEWPW) {
+ if (uid)
+ baduser();
+
+ if (strchr(arg, ':'))
+ errx(1, "invalid format for password");
+ pw->pw_passwd = arg;
+ }
+
+ if (op == EDITENTRY) {
+ /*
+ * We don't really need pw_*() here, but pw_edit() (used
+ * by edit()) is just too useful...
+ */
+ if (pw_init(NULL, NULL))
+ err(1, "pw_init()");
+ if ((tfd = pw_tmp(-1)) == -1) {
+ pw_fini();
+ err(1, "pw_tmp()");
+ }
+ free(pw);
+ pw = edit(pw_tempname(), old_pw);
+ pw_fini();
+ if (pw == NULL)
+ err(1, "edit()");
+ /*
+ * pw_equal does not check for crypted passwords, so we
+ * should do it explicitly
+ */
+ if (pw_equal(old_pw, pw) &&
+ strcmp(old_pw->pw_passwd, pw->pw_passwd) == 0)
+ errx(0, "user information unchanged");
+ }
+
+ if (old_pw && !master_mode) {
+ password = getpass("Password: ");
+ if (strcmp(crypt(password, old_pw->pw_passwd),
+ old_pw->pw_passwd) != 0)
+ baduser();
+ } else {
+ password = "";
+ }
+
+ if (old_pw != NULL)
+ pw->pw_fields |= (old_pw->pw_fields & _PWF_SOURCE);
+ switch (pw->pw_fields & _PWF_SOURCE) {
+#ifdef YP
+ case _PWF_NIS:
+ ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
+ if (ypclnt == NULL) {
+ warnx("ypclnt_new failed");
+ exit(1);
+ }
+ if (ypclnt_connect(ypclnt) == -1 ||
+ ypclnt_passwd(ypclnt, pw, password) == -1) {
+ warnx("%s", ypclnt->error);
+ ypclnt_free(ypclnt);
+ exit(1);
+ }
+ ypclnt_free(ypclnt);
+ errx(0, "NIS user information updated");
+#endif /* YP */
+ case 0:
+ case _PWF_FILES:
+ if (pw_init(NULL, NULL))
+ err(1, "pw_init()");
+ if ((pfd = pw_lock()) == -1) {
+ pw_fini();
+ err(1, "pw_lock()");
+ }
+ if ((tfd = pw_tmp(-1)) == -1) {
+ pw_fini();
+ err(1, "pw_tmp()");
+ }
+ if (pw_copy(pfd, tfd, pw, old_pw) == -1) {
+ pw_fini();
+ err(1, "pw_copy");
+ }
+ if (pw_mkdb(pw->pw_name) == -1) {
+ pw_fini();
+ err(1, "pw_mkdb()");
+ }
+ pw_fini();
+ errx(0, "user information updated");
+ break;
+ default:
+ errx(1, "unsupported passwd source");
+ }
+}
+
+static void
+baduser(void)
+{
+
+ errx(1, "%s", strerror(EACCES));
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: chpass%s %s [user]\n",
+#ifdef YP
+ " [-d domain] [-h host]",
+#else
+ "",
+#endif
+ "[-a list] [-p encpass] [-s shell] [-e mmm dd yy]");
+ exit(1);
+}
diff --git a/usr.bin/chpass/chpass.h b/usr.bin/chpass/chpass.h
new file mode 100644
index 0000000..fd3a839
--- /dev/null
+++ b/usr.bin/chpass/chpass.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1988, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)chpass.h 8.4 (Berkeley) 4/2/94
+ * $FreeBSD$
+ */
+
+struct passwd;
+
+typedef struct _entry {
+ const char *prompt;
+ int (*func)(char *, struct passwd *, struct _entry *);
+ int restricted;
+ size_t len;
+ const char *except, *save;
+} ENTRY;
+
+/* Field numbers. */
+#define E_BPHONE 8
+#define E_HPHONE 9
+#define E_LOCATE 10
+#define E_NAME 7
+#define E_OTHER 11
+#define E_SHELL 13
+
+extern ENTRY list[];
+extern int master_mode;
+
+int atot(char *, time_t *);
+struct passwd *edit(const char *, struct passwd *);
+int ok_shell(char *);
+char *dup_shell(char *);
+int p_change(char *, struct passwd *, ENTRY *);
+int p_class(char *, struct passwd *, ENTRY *);
+int p_expire(char *, struct passwd *, ENTRY *);
+int p_gecos(char *, struct passwd *, ENTRY *);
+int p_gid(char *, struct passwd *, ENTRY *);
+int p_hdir(char *, struct passwd *, ENTRY *);
+int p_login(char *, struct passwd *, ENTRY *);
+int p_passwd(char *, struct passwd *, ENTRY *);
+int p_shell(char *, struct passwd *, ENTRY *);
+int p_uid(char *, struct passwd *, ENTRY *);
+char *ttoa(time_t);
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
new file mode 100644
index 0000000..ce82f8e
--- /dev/null
+++ b/usr.bin/chpass/edit.c
@@ -0,0 +1,296 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <pw_scan.h>
+#include <libutil.h>
+
+#include "chpass.h"
+
+static int display(const char *tfn, struct passwd *pw);
+static struct passwd *verify(const char *tfn, struct passwd *pw);
+
+struct passwd *
+edit(const char *tfn, struct passwd *pw)
+{
+ struct passwd *npw;
+ char *line;
+ size_t len;
+
+ if (display(tfn, pw) == -1)
+ return (NULL);
+ for (;;) {
+ switch (pw_edit(1)) {
+ case -1:
+ return (NULL);
+ case 0:
+ return (pw_dup(pw));
+ default:
+ break;
+ }
+ if ((npw = verify(tfn, pw)) != NULL)
+ return (npw);
+ free(npw);
+ printf("re-edit the password file? ");
+ fflush(stdout);
+ if ((line = fgetln(stdin, &len)) == NULL) {
+ warn("fgetln()");
+ return (NULL);
+ }
+ if (len > 0 && (*line == 'N' || *line == 'n'))
+ return (NULL);
+ }
+}
+
+/*
+ * display --
+ * print out the file for the user to edit; strange side-effect:
+ * set conditional flag if the user gets to edit the shell.
+ */
+static int
+display(const char *tfn, struct passwd *pw)
+{
+ FILE *fp;
+ char *bp, *gecos, *p;
+
+ if ((fp = fopen(tfn, "w")) == NULL) {
+ warn("%s", tfn);
+ return (-1);
+ }
+
+ (void)fprintf(fp,
+ "#Changing user information for %s.\n", pw->pw_name);
+ if (master_mode) {
+ (void)fprintf(fp, "Login: %s\n", pw->pw_name);
+ (void)fprintf(fp, "Password: %s\n", pw->pw_passwd);
+ (void)fprintf(fp, "Uid [#]: %lu\n", (unsigned long)pw->pw_uid);
+ (void)fprintf(fp, "Gid [# or name]: %lu\n",
+ (unsigned long)pw->pw_gid);
+ (void)fprintf(fp, "Change [month day year]: %s\n",
+ ttoa(pw->pw_change));
+ (void)fprintf(fp, "Expire [month day year]: %s\n",
+ ttoa(pw->pw_expire));
+ (void)fprintf(fp, "Class: %s\n", pw->pw_class);
+ (void)fprintf(fp, "Home directory: %s\n", pw->pw_dir);
+ (void)fprintf(fp, "Shell: %s\n",
+ *pw->pw_shell ? pw->pw_shell : _PATH_BSHELL);
+ }
+ /* Only admin can change "restricted" shells. */
+#if 0
+ else if (ok_shell(pw->pw_shell))
+ /*
+ * Make shell a restricted field. Ugly with a
+ * necklace, but there's not much else to do.
+ */
+#else
+ else if ((!list[E_SHELL].restricted && ok_shell(pw->pw_shell)) ||
+ master_mode)
+ /*
+ * If change not restrict (table.c) and standard shell
+ * OR if root, then allow editing of shell.
+ */
+#endif
+ (void)fprintf(fp, "Shell: %s\n",
+ *pw->pw_shell ? pw->pw_shell : _PATH_BSHELL);
+ else
+ list[E_SHELL].restricted = 1;
+
+ if ((bp = gecos = strdup(pw->pw_gecos)) == NULL) {
+ warn(NULL);
+ fclose(fp);
+ return (-1);
+ }
+
+ p = strsep(&bp, ",");
+ p = strdup(p ? p : "");
+ list[E_NAME].save = p;
+ if (!list[E_NAME].restricted || master_mode)
+ (void)fprintf(fp, "Full Name: %s\n", p);
+
+ p = strsep(&bp, ",");
+ p = strdup(p ? p : "");
+ list[E_LOCATE].save = p;
+ if (!list[E_LOCATE].restricted || master_mode)
+ (void)fprintf(fp, "Office Location: %s\n", p);
+
+ p = strsep(&bp, ",");
+ p = strdup(p ? p : "");
+ list[E_BPHONE].save = p;
+ if (!list[E_BPHONE].restricted || master_mode)
+ (void)fprintf(fp, "Office Phone: %s\n", p);
+
+ p = strsep(&bp, ",");
+ p = strdup(p ? p : "");
+ list[E_HPHONE].save = p;
+ if (!list[E_HPHONE].restricted || master_mode)
+ (void)fprintf(fp, "Home Phone: %s\n", p);
+
+ bp = strdup(bp ? bp : "");
+ list[E_OTHER].save = bp;
+ if (!list[E_OTHER].restricted || master_mode)
+ (void)fprintf(fp, "Other information: %s\n", bp);
+
+ free(gecos);
+
+ (void)fchown(fileno(fp), getuid(), getgid());
+ (void)fclose(fp);
+ return (0);
+}
+
+static struct passwd *
+verify(const char *tfn, struct passwd *pw)
+{
+ struct passwd *npw;
+ ENTRY *ep;
+ char *buf, *p, *val;
+ struct stat sb;
+ FILE *fp;
+ int line;
+ size_t len;
+
+ if ((pw = pw_dup(pw)) == NULL)
+ return (NULL);
+ if ((fp = fopen(tfn, "r")) == NULL ||
+ fstat(fileno(fp), &sb) == -1) {
+ warn("%s", tfn);
+ free(pw);
+ return (NULL);
+ }
+ if (sb.st_size == 0) {
+ warnx("corrupted temporary file");
+ fclose(fp);
+ free(pw);
+ return (NULL);
+ }
+ val = NULL;
+ for (line = 1; (buf = fgetln(fp, &len)) != NULL; ++line) {
+ if (*buf == '\0' || *buf == '#')
+ continue;
+ while (len > 0 && isspace(buf[len - 1]))
+ --len;
+ for (ep = list;; ++ep) {
+ if (!ep->prompt) {
+ warnx("%s: unrecognized field on line %d",
+ tfn, line);
+ goto bad;
+ }
+ if (ep->len > len)
+ continue;
+ if (strncasecmp(buf, ep->prompt, ep->len) != 0)
+ continue;
+ if (ep->restricted && !master_mode) {
+ warnx("%s: you may not change the %s field",
+ tfn, ep->prompt);
+ goto bad;
+ }
+ for (p = buf; p < buf + len && *p != ':'; ++p)
+ /* nothing */ ;
+ if (*p != ':') {
+ warnx("%s: line %d corrupted", tfn, line);
+ goto bad;
+ }
+ while (++p < buf + len && isspace(*p))
+ /* nothing */ ;
+ free(val);
+ asprintf(&val, "%.*s", (int)(buf + len - p), p);
+ if (val == NULL)
+ goto bad;
+ if (ep->except && strpbrk(val, ep->except)) {
+ warnx("%s: invalid character in \"%s\" field '%s'",
+ tfn, ep->prompt, val);
+ goto bad;
+ }
+ if ((ep->func)(val, pw, ep))
+ goto bad;
+ break;
+ }
+ }
+ free(val);
+ fclose(fp);
+
+ /* Build the gecos field. */
+ len = asprintf(&p, "%s,%s,%s,%s,%s", list[E_NAME].save,
+ list[E_LOCATE].save, list[E_BPHONE].save,
+ list[E_HPHONE].save, list[E_OTHER].save);
+ if (p == NULL) {
+ warn("asprintf()");
+ free(pw);
+ return (NULL);
+ }
+ while (len > 0 && p[len - 1] == ',')
+ p[--len] = '\0';
+ pw->pw_gecos = p;
+ buf = pw_make(pw);
+ free(pw);
+ free(p);
+ if (buf == NULL) {
+ warn("pw_make()");
+ return (NULL);
+ }
+ npw = pw_scan(buf, PWSCAN_WARN|PWSCAN_MASTER);
+ free(buf);
+ return (npw);
+bad:
+ free(pw);
+ free(val);
+ fclose(fp);
+ return (NULL);
+}
diff --git a/usr.bin/chpass/field.c b/usr.bin/chpass/field.c
new file mode 100644
index 0000000..eac5561
--- /dev/null
+++ b/usr.bin/chpass/field.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 1988, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "chpass.h"
+
+/* ARGSUSED */
+int
+p_login(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!*p) {
+ warnx("empty login field");
+ return (-1);
+ }
+ if (*p == '-') {
+ warnx("login names may not begin with a hyphen");
+ return (-1);
+ }
+ if (!(pw->pw_name = strdup(p))) {
+ warnx("can't save entry");
+ return (-1);
+ }
+ if (strchr(p, '.'))
+ warnx("\'.\' is dangerous in a login name");
+ for (; *p; ++p)
+ if (isupper(*p)) {
+ warnx("upper-case letters are dangerous in a login name");
+ break;
+ }
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_passwd(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!(pw->pw_passwd = strdup(p))) {
+ warnx("can't save password entry");
+ return (-1);
+ }
+
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_uid(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ uid_t id;
+ char *np;
+
+ if (!*p) {
+ warnx("empty uid field");
+ return (-1);
+ }
+ if (!isdigit(*p)) {
+ warnx("illegal uid");
+ return (-1);
+ }
+ errno = 0;
+ id = strtoul(p, &np, 10);
+ if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
+ warnx("illegal uid");
+ return (-1);
+ }
+ pw->pw_uid = id;
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_gid(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ struct group *gr;
+ gid_t id;
+ char *np;
+
+ if (!*p) {
+ warnx("empty gid field");
+ return (-1);
+ }
+ if (!isdigit(*p)) {
+ if (!(gr = getgrnam(p))) {
+ warnx("unknown group %s", p);
+ return (-1);
+ }
+ pw->pw_gid = gr->gr_gid;
+ return (0);
+ }
+ errno = 0;
+ id = strtoul(p, &np, 10);
+ if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
+ warnx("illegal gid");
+ return (-1);
+ }
+ pw->pw_gid = id;
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_class(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!(pw->pw_class = strdup(p))) {
+ warnx("can't save entry");
+ return (-1);
+ }
+
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_change(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!atot(p, &pw->pw_change))
+ return (0);
+ warnx("illegal date for change field");
+ return (-1);
+}
+
+/* ARGSUSED */
+int
+p_expire(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!atot(p, &pw->pw_expire))
+ return (0);
+ warnx("illegal date for expire field");
+ return (-1);
+}
+
+/* ARGSUSED */
+int
+p_gecos(char *p, struct passwd *pw __unused, ENTRY *ep)
+{
+ if (!(ep->save = strdup(p))) {
+ warnx("can't save entry");
+ return (-1);
+ }
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_hdir(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ if (!*p) {
+ warnx("empty home directory field");
+ return (-1);
+ }
+ if (!(pw->pw_dir = strdup(p))) {
+ warnx("can't save entry");
+ return (-1);
+ }
+ return (0);
+}
+
+/* ARGSUSED */
+int
+p_shell(char *p, struct passwd *pw, ENTRY *ep __unused)
+{
+ struct stat sbuf;
+
+ if (!*p) {
+ pw->pw_shell = strdup(_PATH_BSHELL);
+ return (0);
+ }
+ /* only admin can change from or to "restricted" shells */
+ if (!master_mode && pw->pw_shell && !ok_shell(pw->pw_shell)) {
+ warnx("%s: current shell non-standard", pw->pw_shell);
+ return (-1);
+ }
+ if (!ok_shell(p)) {
+ if (!master_mode) {
+ warnx("%s: non-standard shell", p);
+ return (-1);
+ }
+ pw->pw_shell = strdup(p);
+ }
+ else
+ pw->pw_shell = dup_shell(p);
+ if (!pw->pw_shell) {
+ warnx("can't save entry");
+ return (-1);
+ }
+ if (stat(pw->pw_shell, &sbuf) < 0) {
+ if (errno == ENOENT)
+ warnx("WARNING: shell '%s' does not exist",
+ pw->pw_shell);
+ else
+ warn("WARNING: can't stat shell '%s'", pw->pw_shell);
+ return (0);
+ }
+ if (!S_ISREG(sbuf.st_mode)) {
+ warnx("WARNING: shell '%s' is not a regular file",
+ pw->pw_shell);
+ return (0);
+ }
+ if ((sbuf.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)) == 0) {
+ warnx("WARNING: shell '%s' is not executable", pw->pw_shell);
+ return (0);
+ }
+ return (0);
+}
diff --git a/usr.bin/chpass/table.c b/usr.bin/chpass/table.c
new file mode 100644
index 0000000..a4918b4
--- /dev/null
+++ b/usr.bin/chpass/table.c
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static const char sccsid[] = "@(#)table.c 8.3 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <stddef.h>
+#include "chpass.h"
+
+ENTRY list[] = {
+ { "login", p_login, 1, 5, ": ", NULL },
+ { "password", p_passwd, 1, 8, ": ", NULL },
+ { "uid", p_uid, 1, 3, ": ", NULL },
+ { "gid", p_gid, 1, 3, ": ", NULL },
+ { "class", p_class, 1, 5, ": ", NULL },
+ { "change", p_change, 1, 6, NULL, NULL },
+ { "expire", p_expire, 1, 6, NULL, NULL },
+#ifdef RESTRICT_FULLNAME_CHANGE /* do not allow fullname changes */
+ { "full name", p_gecos, 1, 9, ":,", NULL },
+#else
+ { "full name", p_gecos, 0, 9, ":,", NULL },
+#endif
+ { "office phone", p_gecos, 0, 12, ":,", NULL },
+ { "home phone", p_gecos, 0, 10, ":,", NULL },
+ { "office location", p_gecos, 0, 15, ":,", NULL },
+ { "other information", p_gecos, 0, 11, ": ", NULL },
+ { "home directory", p_hdir, 1, 14, ": ", NULL },
+ { "shell", p_shell, 0, 5, ": ", NULL },
+ { NULL, NULL, 0, 0, NULL, NULL },
+};
diff --git a/usr.bin/chpass/util.c b/usr.bin/chpass/util.c
new file mode 100644
index 0000000..baf160e
--- /dev/null
+++ b/usr.bin/chpass/util.c
@@ -0,0 +1,182 @@
+/*-
+ * Copyright (c) 1988, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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
+#if 0
+static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "chpass.h"
+
+static const char *months[] =
+ { "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November",
+ "December", NULL };
+
+char *
+ttoa(time_t tval)
+{
+ struct tm *tp;
+ static char tbuf[50];
+
+ if (tval) {
+ tp = localtime(&tval);
+ (void)sprintf(tbuf, "%s %d, %d", months[tp->tm_mon],
+ tp->tm_mday, tp->tm_year + 1900);
+ }
+ else
+ *tbuf = '\0';
+ return (tbuf);
+}
+
+int
+atot(char *p, time_t *store)
+{
+ static struct tm *lt;
+ char *t;
+ const char **mp;
+ time_t tval;
+ int day, month, year;
+
+ if (!*p) {
+ *store = 0;
+ return (0);
+ }
+ if (!lt) {
+ unsetenv("TZ");
+ (void)time(&tval);
+ lt = localtime(&tval);
+ }
+ if (!(t = strtok(p, " \t")))
+ goto bad;
+ if (isdigit(*t)) {
+ month = atoi(t);
+ } else {
+ for (mp = months;; ++mp) {
+ if (!*mp)
+ goto bad;
+ if (!strncasecmp(*mp, t, 3)) {
+ month = mp - months + 1;
+ break;
+ }
+ }
+ }
+ if (!(t = strtok(NULL, " \t,")) || !isdigit(*t))
+ goto bad;
+ day = atoi(t);
+ if (!(t = strtok(NULL, " \t,")) || !isdigit(*t))
+ goto bad;
+ year = atoi(t);
+ if (day < 1 || day > 31 || month < 1 || month > 12)
+ goto bad;
+ /* Allow two digit years 1969-2068 */
+ if (year < 69)
+ year += 2000;
+ else if (year < 100)
+ year += 1900;
+ if (year < 1969)
+bad: return (1);
+ lt->tm_year = year - 1900;
+ lt->tm_mon = month - 1;
+ lt->tm_mday = day;
+ lt->tm_hour = 0;
+ lt->tm_min = 0;
+ lt->tm_sec = 0;
+ lt->tm_isdst = -1;
+ if ((tval = mktime(lt)) < 0)
+ return (1);
+ *store = tval;
+ return (0);
+}
+
+int
+ok_shell(char *name)
+{
+ char *p, *sh;
+
+ setusershell();
+ while ((sh = getusershell())) {
+ if (!strcmp(name, sh)) {
+ endusershell();
+ return (1);
+ }
+ /* allow just shell name, but use "real" path */
+ if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) {
+ endusershell();
+ return (1);
+ }
+ }
+ endusershell();
+ return (0);
+}
+
+char *
+dup_shell(char *name)
+{
+ char *p, *sh, *ret;
+
+ setusershell();
+ while ((sh = getusershell())) {
+ if (!strcmp(name, sh)) {
+ endusershell();
+ return (strdup(name));
+ }
+ /* allow just shell name, but use "real" path */
+ if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) {
+ ret = strdup(sh);
+ endusershell();
+ return (ret);
+ }
+ }
+ endusershell();
+ return (NULL);
+}
diff --git a/usr.bin/cksum/Makefile b/usr.bin/cksum/Makefile
new file mode 100644
index 0000000..828900a
--- /dev/null
+++ b/usr.bin/cksum/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.2 (Berkeley) 4/28/95
+# $FreeBSD$
+
+PROG= cksum
+SRCS= cksum.c crc.c print.c sum1.c sum2.c crc32.c
+LINKS= ${BINDIR}/cksum ${BINDIR}/sum
+MLINKS= cksum.1 sum.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cksum/Makefile.depend b/usr.bin/cksum/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/cksum/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/cksum/cksum.1 b/usr.bin/cksum/cksum.1
new file mode 100644
index 0000000..f1987f0
--- /dev/null
+++ b/usr.bin/cksum/cksum.1
@@ -0,0 +1,177 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)cksum.1 8.2 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd April 28, 1995
+.Dt CKSUM 1
+.Os
+.Sh NAME
+.Nm cksum ,
+.Nm sum
+.Nd display file checksums and block counts
+.Sh SYNOPSIS
+.Nm
+.Op Fl o Ar 1 | 2 | 3
+.Op Ar
+.Nm sum
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility writes to the standard output three whitespace separated
+fields for each input file.
+These fields are a checksum
+.Tn CRC ,
+the total number of octets in the file and the file name.
+If no file name is specified, the standard input is used and no file name
+is written.
+.Pp
+The
+.Nm sum
+utility is identical to the
+.Nm
+utility, except that it defaults to using historic algorithm 1, as
+described below.
+It is provided for compatibility only.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl o
+Use historic algorithms instead of the (superior) default one.
+.Pp
+Algorithm 1 is the algorithm used by historic
+.Bx
+systems as the
+.Xr sum 1
+algorithm and by historic
+.At V
+systems as the
+.Xr sum 1
+algorithm when using the
+.Fl r
+option.
+This is a 16-bit checksum, with a right rotation before each addition;
+overflow is discarded.
+.Pp
+Algorithm 2 is the algorithm used by historic
+.At V
+systems as the
+default
+.Xr sum 1
+algorithm.
+This is a 32-bit checksum, and is defined as follows:
+.Bd -unfilled -offset indent
+s = sum of all bytes;
+r = s % 2^16 + (s % 2^32) / 2^16;
+cksum = (r % 2^16) + r / 2^16;
+.Ed
+.Pp
+Algorithm 3 is what is commonly called the
+.Ql 32bit CRC
+algorithm.
+This is a 32-bit checksum.
+.Pp
+Both algorithm 1 and 2 write to the standard output the same fields as
+the default algorithm except that the size of the file in bytes is
+replaced with the size of the file in blocks.
+For historic reasons, the block size is 1024 for algorithm 1 and 512
+for algorithm 2.
+Partial blocks are rounded up.
+.El
+.Pp
+The default
+.Tn CRC
+used is based on the polynomial used for
+.Tn CRC
+error checking
+in the networking standard
+.St -iso8802-3 .
+The
+.Tn CRC
+checksum encoding is defined by the generating polynomial:
+.Bd -unfilled -offset indent
+G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 +
+ x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
+.Ed
+.Pp
+Mathematically, the
+.Tn CRC
+value corresponding to a given file is defined by
+the following procedure:
+.Bd -ragged -offset indent
+The
+.Ar n
+bits to be evaluated are considered to be the coefficients of a mod 2
+polynomial M(x) of degree
+.Ar n Ns \-1 .
+These
+.Ar n
+bits are the bits from the file, with the most significant bit being the most
+significant bit of the first octet of the file and the last bit being the least
+significant bit of the last octet, padded with zero bits (if necessary) to
+achieve an integral number of octets, followed by one or more octets
+representing the length of the file as a binary value, least significant octet
+first.
+The smallest number of octets capable of representing this integer are used.
+.Pp
+M(x) is multiplied by x^32 (i.e., shifted left 32 bits) and divided by
+G(x) using mod 2 division, producing a remainder R(x) of degree <= 31.
+.Pp
+The coefficients of R(x) are considered to be a 32-bit sequence.
+.Pp
+The bit sequence is complemented and the result is the CRC.
+.Ed
+.Sh EXIT STATUS
+.Ex -std cksum sum
+.Sh SEE ALSO
+.Xr md5 1
+.Pp
+The default calculation is identical to that given in pseudo-code
+in the following
+.Tn ACM
+article.
+.Rs
+.%T "Computation of Cyclic Redundancy Checks Via Table Lookup"
+.%A Dilip V. Sarwate
+.%J "Communications of the" Tn ACM
+.%D "August 1988"
+.Re
+.Sh STANDARDS
+The
+.Nm
+utility is expected to conform to
+.St -p1003.2-92 .
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.4 .
diff --git a/usr.bin/cksum/cksum.c b/usr.bin/cksum/cksum.c
new file mode 100644
index 0000000..05dc8bb
--- /dev/null
+++ b/usr.bin/cksum/cksum.c
@@ -0,0 +1,136 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James W. Williams of NASA Goddard Space Flight Center.
+ *
+ * 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) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)cksum.c 8.2 (Berkeley) 4/28/95";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ uint32_t val;
+ int ch, fd, rval;
+ off_t len;
+ char *fn, *p;
+ int (*cfncn)(int, uint32_t *, off_t *);
+ void (*pfncn)(char *, uint32_t, off_t);
+
+ if ((p = strrchr(argv[0], '/')) == NULL)
+ p = argv[0];
+ else
+ ++p;
+ if (!strcmp(p, "sum")) {
+ cfncn = csum1;
+ pfncn = psum1;
+ ++argv;
+ } else {
+ cfncn = crc;
+ pfncn = pcrc;
+
+ while ((ch = getopt(argc, argv, "o:")) != -1)
+ switch (ch) {
+ case 'o':
+ if (!strcmp(optarg, "1")) {
+ cfncn = csum1;
+ pfncn = psum1;
+ } else if (!strcmp(optarg, "2")) {
+ cfncn = csum2;
+ pfncn = psum2;
+ } else if (!strcmp(optarg, "3")) {
+ cfncn = crc32;
+ pfncn = pcrc;
+ } else {
+ warnx("illegal argument to -o option");
+ usage();
+ }
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+ }
+
+ fd = STDIN_FILENO;
+ fn = NULL;
+ rval = 0;
+ do {
+ if (*argv) {
+ fn = *argv++;
+ if ((fd = open(fn, O_RDONLY, 0)) < 0) {
+ warn("%s", fn);
+ rval = 1;
+ continue;
+ }
+ }
+ if (cfncn(fd, &val, &len)) {
+ warn("%s", fn ? fn : "stdin");
+ rval = 1;
+ } else
+ pfncn(fn, val, len);
+ (void)close(fd);
+ } while (*argv);
+ exit(rval);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: cksum [-o 1 | 2 | 3] [file ...]\n");
+ (void)fprintf(stderr, " sum [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c
new file mode 100644
index 0000000..a76876a9
--- /dev/null
+++ b/usr.bin/cksum/crc.c
@@ -0,0 +1,143 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James W. Williams of NASA Goddard Space Flight Center.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+static const uint32_t crctab[] = {
+ 0x0,
+ 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
+ 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
+ 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
+ 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac,
+ 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f,
+ 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a,
+ 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58,
+ 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033,
+ 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe,
+ 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
+ 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4,
+ 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
+ 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5,
+ 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
+ 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07,
+ 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c,
+ 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1,
+ 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b,
+ 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698,
+ 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d,
+ 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
+ 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f,
+ 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
+ 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80,
+ 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
+ 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a,
+ 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629,
+ 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c,
+ 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e,
+ 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65,
+ 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8,
+ 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
+ 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2,
+ 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
+ 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74,
+ 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
+ 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21,
+ 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a,
+ 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087,
+ 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d,
+ 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce,
+ 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb,
+ 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
+ 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09,
+ 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
+ 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf,
+ 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
+};
+
+/*
+ * Compute a POSIX 1003.2 checksum. This routine has been broken out so that
+ * other programs can use it. It takes a file descriptor to read from and
+ * locations to store the crc and the number of bytes read. It returns 0 on
+ * success and 1 on failure. Errno is set on failure.
+ */
+uint32_t crc_total = ~0; /* The crc over a number of files. */
+
+int
+crc(int fd, uint32_t *cval, off_t *clen)
+{
+ uint32_t lcrc;
+ int nr;
+ off_t len;
+ u_char *p;
+ u_char buf[16 * 1024];
+
+#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
+
+ lcrc = len = 0;
+ crc_total = ~crc_total;
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ for (len += nr, p = buf; nr--; ++p) {
+ COMPUTE(lcrc, *p);
+ COMPUTE(crc_total, *p);
+ }
+ if (nr < 0)
+ return (1);
+
+ *clen = len;
+
+ /* Include the length of the file. */
+ for (; len != 0; len >>= 8) {
+ COMPUTE(lcrc, len & 0xff);
+ COMPUTE(crc_total, len & 0xff);
+ }
+
+ *cval = ~lcrc;
+ crc_total = ~crc_total;
+ return (0);
+}
diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c
new file mode 100644
index 0000000..cadbc17
--- /dev/null
+++ b/usr.bin/cksum/crc32.c
@@ -0,0 +1,122 @@
+/*
+ * This code implements the AUTODIN II polynomial used by Ethernet,
+ * and can be used to calculate multicast address hash indices.
+ * It assumes that the low order bits will be transmitted first,
+ * and consequently the low byte should be sent first when
+ * the crc computation is finished. The crc should be complemented
+ * before transmission.
+ * The variable corresponding to the macro argument "crc" should
+ * be an unsigned long and should be preset to all ones for Ethernet
+ * use. An error-free packet will leave 0xDEBB20E3 in the crc.
+ * Spencer Garrett <srg@quick.com>
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
+
+/* generated using the AUTODIN II polynomial
+ * x^32 + x^26 + x^23 + x^22 + x^16 +
+ * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
+ */
+static const uint32_t crctab[256] = {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
+ 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
+ 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
+ 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
+ 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
+ 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
+ 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
+ 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
+ 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
+ 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
+ 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
+ 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
+ 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
+ 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
+ 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
+ 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
+ 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
+ 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
+};
+
+uint32_t crc32_total = 0;
+
+int
+crc32(int fd, uint32_t *cval, off_t *clen)
+{
+ uint32_t lcrc = ~0;
+ int nr ;
+ off_t len ;
+ char buf[BUFSIZ], *p ;
+
+ len = 0 ;
+ crc32_total = ~crc32_total ;
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ for (len += nr, p = buf; nr--; ++p) {
+ CRC(lcrc, *p) ;
+ CRC(crc32_total, *p) ;
+ }
+ if (nr < 0)
+ return 1 ;
+
+ *clen = len ;
+ *cval = ~lcrc ;
+ crc32_total = ~crc32_total ;
+ return 0 ;
+}
diff --git a/usr.bin/cksum/extern.h b/usr.bin/cksum/extern.h
new file mode 100644
index 0000000..84ec8d2
--- /dev/null
+++ b/usr.bin/cksum/extern.h
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+
+extern uint32_t crc_total;
+extern uint32_t crc32_total;
+
+__BEGIN_DECLS
+int crc(int, uint32_t *, off_t *);
+void pcrc(char *, uint32_t, off_t);
+void psum1(char *, uint32_t, off_t);
+void psum2(char *, uint32_t, off_t);
+int csum1(int, uint32_t *, off_t *);
+int csum2(int, uint32_t *, off_t *);
+int crc32(int, uint32_t *, off_t *);
+__END_DECLS
diff --git a/usr.bin/cksum/print.c b/usr.bin/cksum/print.c
new file mode 100644
index 0000000..912ffd6
--- /dev/null
+++ b/usr.bin/cksum/print.c
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 1991, 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
+#if 0
+static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "extern.h"
+
+void
+pcrc(char *fn, uint32_t val, off_t len)
+{
+ (void)printf("%lu %jd", (u_long)val, (intmax_t)len);
+ if (fn != NULL)
+ (void)printf(" %s", fn);
+ (void)printf("\n");
+}
+
+void
+psum1(char *fn, uint32_t val, off_t len)
+{
+ (void)printf("%lu %jd", (u_long)val, (intmax_t)(len + 1023) / 1024);
+ if (fn != NULL)
+ (void)printf(" %s", fn);
+ (void)printf("\n");
+}
+
+void
+psum2(char *fn, uint32_t val, off_t len)
+{
+ (void)printf("%lu %jd", (u_long)val, (intmax_t)(len + 511) / 512);
+ if (fn != NULL)
+ (void)printf(" %s", fn);
+ (void)printf("\n");
+}
diff --git a/usr.bin/cksum/sum1.c b/usr.bin/cksum/sum1.c
new file mode 100644
index 0000000..60640a7
--- /dev/null
+++ b/usr.bin/cksum/sum1.c
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 1991, 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
+#if 0
+static char sccsid[] = "@(#)sum1.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <unistd.h>
+#include <stdint.h>
+
+#include "extern.h"
+
+int
+csum1(int fd, uint32_t *cval, off_t *clen)
+{
+ int nr;
+ u_int lcrc;
+ off_t total;
+ u_char *p;
+ u_char buf[8192];
+
+ /*
+ * 16-bit checksum, rotating right before each addition;
+ * overflow is discarded.
+ */
+ lcrc = total = 0;
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ for (total += nr, p = buf; nr--; ++p) {
+ if (lcrc & 1)
+ lcrc |= 0x10000;
+ lcrc = ((lcrc >> 1) + *p) & 0xffff;
+ }
+ if (nr < 0)
+ return (1);
+
+ *cval = lcrc;
+ *clen = total;
+ return (0);
+}
diff --git a/usr.bin/cksum/sum2.c b/usr.bin/cksum/sum2.c
new file mode 100644
index 0000000..540d9e5
--- /dev/null
+++ b/usr.bin/cksum/sum2.c
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 1991, 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
+#if 0
+static char sccsid[] = "@(#)sum2.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <unistd.h>
+#include <stdint.h>
+
+#include "extern.h"
+
+int
+csum2(int fd, uint32_t *cval, off_t *clen)
+{
+ uint32_t lcrc;
+ int nr;
+ off_t total;
+ u_char *p;
+ u_char buf[8192];
+
+ /*
+ * Draft 8 POSIX 1003.2:
+ *
+ * s = sum of all bytes
+ * r = s % 2^16 + (s % 2^32) / 2^16
+ * lcrc = (r % 2^16) + r / 2^16
+ */
+ lcrc = total = 0;
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ for (total += nr, p = buf; nr--; ++p)
+ lcrc += *p;
+ if (nr < 0)
+ return (1);
+
+ lcrc = (lcrc & 0xffff) + (lcrc >> 16);
+ lcrc = (lcrc & 0xffff) + (lcrc >> 16);
+
+ *cval = lcrc;
+ *clen = total;
+ return (0);
+}
diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile
new file mode 100644
index 0000000..5d4c514
--- /dev/null
+++ b/usr.bin/clang/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+SUBDIR= clang clang-tblgen llvm-tblgen
+
+.if !defined(TOOLS_PREFIX)
+.if ${MK_CLANG_EXTRAS} != "no"
+SUBDIR+=bugpoint \
+ clang-format \
+ llc \
+ lli \
+ llvm-ar \
+ llvm-as \
+ llvm-bcanalyzer \
+ llvm-cov \
+ llvm-cxxdump \
+ llvm-diff \
+ llvm-dis \
+ llvm-dwarfdump \
+ llvm-extract \
+ llvm-link \
+ llvm-lto \
+ llvm-mc \
+ llvm-nm \
+ llvm-objdump \
+ llvm-pdbdump \
+ llvm-profdata \
+ llvm-rtdyld \
+ llvm-symbolizer \
+ opt
+.endif
+
+.if ${MK_LLDB} != "no"
+SUBDIR+=lldb
+.endif
+.endif # TOOLS_PREFIX
+
+SUBDIR_PARALLEL=
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/clang/bugpoint/Makefile b/usr.bin/clang/bugpoint/Makefile
new file mode 100644
index 0000000..6c675da
--- /dev/null
+++ b/usr.bin/clang/bugpoint/Makefile
@@ -0,0 +1,45 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=bugpoint
+
+SRCDIR= tools/bugpoint
+SRCS= BugDriver.cpp \
+ CrashDebugger.cpp \
+ ExecutionDriver.cpp \
+ ExtractFunction.cpp \
+ FindBugs.cpp \
+ Miscompilation.cpp \
+ OptimizerDriver.cpp \
+ ToolRunner.cpp \
+ bugpoint.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmcodegen \
+ llvmtarget \
+ llvmobjcarcopts \
+ llvmbitwriter \
+ llvmipo \
+ llvmvectorize \
+ llvmlinker \
+ llvmirreader \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmtransformutils \
+ llvmmc \
+ llvmanalysis \
+ llvmasmparser \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/bugpoint/Makefile.depend b/usr.bin/clang/bugpoint/Makefile.depend
new file mode 100644
index 0000000..00803ce
--- /dev/null
+++ b/usr.bin/clang/bugpoint/Makefile.depend
@@ -0,0 +1,45 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobjcarcopts \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/bugpoint/bugpoint.1 b/usr.bin/clang/bugpoint/bugpoint.1
new file mode 100644
index 0000000..36b0aed
--- /dev/null
+++ b/usr.bin/clang/bugpoint/bugpoint.1
@@ -0,0 +1,293 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "BUGPOINT" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+bugpoint \- automatic test case reduction tool
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBbugpoint\fP [\fIoptions\fP] [\fIinput LLVM ll/bc files\fP] [\fILLVM passes\fP] \fB\-\-args\fP
+\fIprogram arguments\fP
+.SH DESCRIPTION
+.sp
+\fBbugpoint\fP narrows down the source of problems in LLVM tools and passes. It
+can be used to debug three types of failures: optimizer crashes, miscompilations
+by optimizers, or bad native code generation (including problems in the static
+and JIT compilers). It aims to reduce large test cases to small, useful ones.
+For more information on the design and inner workings of \fBbugpoint\fP, as well as
+advice for using bugpoint, see \fIllvm/docs/Bugpoint.html\fP in the LLVM
+distribution.
+.SH OPTIONS
+.sp
+\fB\-\-additional\-so\fP \fIlibrary\fP
+.INDENT 0.0
+.INDENT 3.5
+Load the dynamic shared object \fIlibrary\fP into the test program whenever it is
+run. This is useful if you are debugging programs which depend on non\-LLVM
+libraries (such as the X or curses libraries) to run.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-append\-exit\-code\fP=\fI{true,false}\fP
+.INDENT 0.0
+.INDENT 3.5
+Append the test programs exit code to the output file so that a change in exit
+code is considered a test failure. Defaults to false.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-args\fP \fIprogram args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-args\fP to the test program whenever it runs.
+Note that if any of the \fIprogram args\fP start with a "\fB\-\fP", you should use:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+bugpoint [bugpoint args] \-\-args \-\- [program args]
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+The "\fB\-\-\fP" right after the \fB\-\-args\fP option tells \fBbugpoint\fP to consider
+any options starting with "\fB\-\fP" to be part of the \fB\-\-args\fP option, not as
+options to \fBbugpoint\fP itself.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-tool\-args\fP \fItool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-tool\-args\fP to the LLVM tool under test
+(\fBllc\fP, \fBlli\fP, etc.) whenever it runs. You should use this option in the
+following way:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+bugpoint [bugpoint args] \-\-tool\-args \-\- [tool args]
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+The "\fB\-\-\fP" right after the \fB\-\-tool\-args\fP option tells \fBbugpoint\fP to
+consider any options starting with "\fB\-\fP" to be part of the \fB\-\-tool\-args\fP
+option, not as options to \fBbugpoint\fP itself. (See \fB\-\-args\fP, above.)
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-tool\-args\fP \fItool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-safe\-tool\-args\fP to the "safe" execution
+tool.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-gcc\-tool\-args\fP \fIgcc tool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-gcc\-tool\-args\fP to the invocation of
+\fBgcc\fP\&.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-opt\-args\fP \fIopt args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-opt\-args\fP to the invocation of \fBopt\fP\&.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-disable\-{dce,simplifycfg}\fP
+.INDENT 0.0
+.INDENT 3.5
+Do not run the specified passes to clean up and reduce the size of the test
+program. By default, \fBbugpoint\fP uses these passes internally when attempting to
+reduce test programs. If you\(aqre trying to find a bug in one of these passes,
+\fBbugpoint\fP may crash.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-valgrind\fP
+.INDENT 0.0
+.INDENT 3.5
+Use valgrind to find faults in the optimization phase. This will allow
+bugpoint to find otherwise asymptomatic problems caused by memory
+mis\-management.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-find\-bugs\fP
+.INDENT 0.0
+.INDENT 3.5
+Continually randomize the specified passes and run them on the test program
+until a bug is found or the user kills \fBbugpoint\fP\&.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
+Print a summary of command line options.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-input\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Open \fIfilename\fP and redirect the standard input of the test program, whenever
+it runs, to come from that file.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-load\fP \fIplugin\fP
+.INDENT 0.0
+.INDENT 3.5
+Load the dynamic object \fIplugin\fP into \fBbugpoint\fP itself. This object should
+register new optimization passes. Once loaded, the object will add new command
+line options to enable various optimizations. To see the new complete list of
+optimizations, use the \fB\-help\fP and \fB\-\-load\fP options together; for example:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+bugpoint \-\-load myNewPass.so \-help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-mlimit\fP \fImegabytes\fP
+.INDENT 0.0
+.INDENT 3.5
+Specifies an upper limit on memory usage of the optimization and codegen. Set
+to zero to disable the limit.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-output\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Whenever the test program produces output on its standard output stream, it
+should match the contents of \fIfilename\fP (the "reference output"). If you
+do not use this option, \fBbugpoint\fP will attempt to generate a reference output
+by compiling the program with the "safe" backend and running it.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-run\-{int,jit,llc,custom}\fP
+.INDENT 0.0
+.INDENT 3.5
+Whenever the test program is compiled, \fBbugpoint\fP should generate code for it
+using the specified code generator. These options allow you to choose the
+interpreter, the JIT compiler, the static native code compiler, or a
+custom command (see \fB\-\-exec\-command\fP) respectively.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-{llc,custom}\fP
+.INDENT 0.0
+.INDENT 3.5
+When debugging a code generator, \fBbugpoint\fP should use the specified code
+generator as the "safe" code generator. This is a known\-good code generator
+used to generate the "reference output" if it has not been provided, and to
+compile portions of the program that as they are excluded from the testcase.
+These options allow you to choose the
+static native code compiler, or a custom command, (see \fB\-\-exec\-command\fP)
+respectively. The interpreter and the JIT backends cannot currently
+be used as the "safe" backends.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-exec\-command\fP \fIcommand\fP
+.INDENT 0.0
+.INDENT 3.5
+This option defines the command to use with the \fB\-\-run\-custom\fP and
+\fB\-\-safe\-custom\fP options to execute the bitcode testcase. This can
+be useful for cross\-compilation.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-compile\-command\fP \fIcommand\fP
+.INDENT 0.0
+.INDENT 3.5
+This option defines the command to use with the \fB\-\-compile\-custom\fP
+option to compile the bitcode testcase. This can be useful for
+testing compiler output without running any link or execute stages. To
+generate a reduced unit test, you may add CHECK directives to the
+testcase and pass the name of an executable compile\-command script in this form:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+#!/bin/sh
+llc "$@"
+not FileCheck [bugpoint input file].ll < bugpoint\-test\-program.s
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+This script will "fail" as long as FileCheck passes. So the result
+will be the minimum bitcode that passes FileCheck.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-path\fP \fIpath\fP
+.INDENT 0.0
+.INDENT 3.5
+This option defines the path to the command to execute with the
+\fB\-\-safe\-{int,jit,llc,custom}\fP
+option.
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBbugpoint\fP succeeds in finding a problem, it will exit with 0. Otherwise,
+if an error occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+opt|opt
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/clang-format/Makefile b/usr.bin/clang/clang-format/Makefile
new file mode 100644
index 0000000..86e0d8d
--- /dev/null
+++ b/usr.bin/clang/clang-format/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=clang-format
+
+SRCDIR= tools/clang/tools/clang-format
+SRCS= ClangFormat.cpp
+
+LIBDEPS=clangrewrite \
+ clanglex \
+ clangformat \
+ clangbasic \
+ clangast \
+ clangtoolingcore \
+ llvmmc \
+ llvmcore \
+ llvmsupport \
+
+TGHDRS= DiagnosticCommonKinds
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang-format/Makefile.depend b/usr.bin/clang/clang-format/Makefile.depend
new file mode 100644
index 0000000..6c4e251
--- /dev/null
+++ b/usr.bin/clang/clang-format/Makefile.depend
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libclangast \
+ lib/clang/libclangbasic \
+ lib/clang/libclangformat \
+ lib/clang/libclanglex \
+ lib/clang/libclangrewrite \
+ lib/clang/libclangtoolingcore \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/clang-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/clang-tblgen/Makefile b/usr.bin/clang/clang-tblgen/Makefile
new file mode 100644
index 0000000..0f64ad3
--- /dev/null
+++ b/usr.bin/clang/clang-tblgen/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=clang-tblgen
+
+SRCDIR= tools/clang/utils/TableGen
+SRCS= ClangASTNodesEmitter.cpp \
+ ClangAttrEmitter.cpp \
+ ClangCommentCommandInfoEmitter.cpp \
+ ClangCommentHTMLNamedCharacterReferenceEmitter.cpp \
+ ClangCommentHTMLTagsEmitter.cpp \
+ ClangDiagnosticsEmitter.cpp \
+ ClangSACheckersEmitter.cpp \
+ NeonEmitter.cpp \
+ TableGen.cpp
+
+LIBDEPS=llvmtablegen \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang-tblgen/Makefile.depend b/usr.bin/clang/clang-tblgen/Makefile.depend
new file mode 100644
index 0000000..58ed9a7
--- /dev/null
+++ b/usr.bin/clang/clang-tblgen/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtablegen \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk
new file mode 100644
index 0000000..b1dd7c1
--- /dev/null
+++ b/usr.bin/clang/clang.prog.mk
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm
+
+.include "../../lib/clang/clang.build.mk"
+
+.for lib in ${LIBDEPS}
+DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+.endfor
+
+PACKAGE= clang
+
+LIBADD+= ncursesw pthread
+
+BINDIR?= /usr/bin
+
+
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED= yes
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/clang/clang/CC.sh b/usr.bin/clang/clang/CC.sh
new file mode 100755
index 0000000..45faeec
--- /dev/null
+++ b/usr.bin/clang/clang/CC.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# $FreeBSD$
+# This file is in the public domain.
+exec /usr/bin/c++ "$@"
diff --git a/usr.bin/clang/clang/Makefile b/usr.bin/clang/clang/Makefile
new file mode 100644
index 0000000..3665888
--- /dev/null
+++ b/usr.bin/clang/clang/Makefile
@@ -0,0 +1,131 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG_CXX=clang
+
+SRCDIR= tools/clang/tools/driver
+SRCS= cc1_main.cpp \
+ cc1as_main.cpp \
+ driver.cpp
+
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED?= yes
+
+.if ${MACHINE_CPUARCH} == "arm"
+CFLAGS+= -mlong-calls
+.endif
+.endif
+
+LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \
+ ${BINDIR}/clang ${BINDIR}/clang-cpp
+MLINKS= clang.1 clang++.1 \
+ clang.1 clang-cpp.1
+.if ${MK_CLANG_IS_CC} != "no"
+SCRIPTS=CC.sh
+SCRIPTSNAME=CC
+
+LINKS+= ${BINDIR}/clang ${BINDIR}/cc \
+ ${BINDIR}/clang ${BINDIR}/c++ \
+ ${BINDIR}/clang ${BINDIR}/cpp
+MLINKS+= clang.1 cc.1 \
+ clang.1 c++.1 \
+ clang.1 CC.1 \
+ clang.1 cpp.1
+.endif
+
+TGHDRS= Attributes \
+ Intrinsics \
+ DiagnosticCommonKinds \
+ DiagnosticDriverKinds \
+ DiagnosticFrontendKinds \
+ DiagnosticLexKinds \
+ DiagnosticSemaKinds \
+ Options
+
+.if ${MK_CLANG_FULL} != "no"
+_clangstaticanalyzer= \
+ clangstaticanalyzerfrontend \
+ clangstaticanalyzercheckers \
+ clangstaticanalyzercore
+_clangarcmigrate= \
+ clangarcmigrate
+.endif # MK_CLANG_FULL
+
+LIBDEPS=clangfrontendtool \
+ clangfrontend \
+ clangdriver \
+ clangserialization \
+ clangcodegen \
+ clangparse \
+ clangsema \
+ clangrewritefrontend \
+ clangrewrite \
+ ${_clangstaticanalyzer} \
+ ${_clangarcmigrate} \
+ clanganalysis \
+ clangedit \
+ clangast \
+ clanglex \
+ clangbasic \
+ llvmoption \
+ llvmobjcarcopts \
+ llvmipo \
+ llvmvectorize \
+ llvmlinker \
+ llvmirreader \
+ llvmasmparser \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang/Makefile.depend b/usr.bin/clang/clang/Makefile.depend
new file mode 100644
index 0000000..eea6f09
--- /dev/null
+++ b/usr.bin/clang/clang/Makefile.depend
@@ -0,0 +1,100 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libclanganalysis \
+ lib/clang/libclangarcmigrate \
+ lib/clang/libclangast \
+ lib/clang/libclangbasic \
+ lib/clang/libclangcodegen \
+ lib/clang/libclangdriver \
+ lib/clang/libclangedit \
+ lib/clang/libclangfrontend \
+ lib/clang/libclangfrontendtool \
+ lib/clang/libclanglex \
+ lib/clang/libclangparse \
+ lib/clang/libclangrewrite \
+ lib/clang/libclangrewritefrontend \
+ lib/clang/libclangsema \
+ lib/clang/libclangserialization \
+ lib/clang/libclangstaticanalyzercheckers \
+ lib/clang/libclangstaticanalyzercore \
+ lib/clang/libclangstaticanalyzerfrontend \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobjcarcopts \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmoption \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/clang-tblgen.host \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/clang/clang.1 b/usr.bin/clang/clang/clang.1
new file mode 100644
index 0000000..5fcc9ac
--- /dev/null
+++ b/usr.bin/clang/clang/clang.1
@@ -0,0 +1,584 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "CLANG" "1" "March 04, 2016" "3.8" "Clang"
+.SH NAME
+clang \- the Clang C, C++, and Objective-C compiler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBclang\fP [\fIoptions\fP] \fIfilename ...\fP
+.SH DESCRIPTION
+.sp
+\fBclang\fP is a C, C++, and Objective\-C compiler which encompasses
+preprocessing, parsing, optimization, code generation, assembly, and linking.
+Depending on which high\-level mode setting is passed, Clang will stop before
+doing a full link. While Clang is highly integrated, it is important to
+understand the stages of compilation, to understand how to invoke it. These
+stages are:
+.INDENT 0.0
+.TP
+.B Driver
+The clang executable is actually a small driver which controls the overall
+execution of other tools such as the compiler, assembler and linker.
+Typically you do not need to interact with the driver, but you
+transparently use it to run the other tools.
+.TP
+.B Preprocessing
+This stage handles tokenization of the input source file, macro expansion,
+#include expansion and handling of other preprocessor directives. The
+output of this stage is typically called a ".i" (for C), ".ii" (for C++),
+".mi" (for Objective\-C), or ".mii" (for Objective\-C++) file.
+.TP
+.B Parsing and Semantic Analysis
+This stage parses the input file, translating preprocessor tokens into a
+parse tree. Once in the form of a parse tree, it applies semantic
+analysis to compute types for expressions as well and determine whether
+the code is well formed. This stage is responsible for generating most of
+the compiler warnings as well as parse errors. The output of this stage is
+an "Abstract Syntax Tree" (AST).
+.TP
+.B Code Generation and Optimization
+This stage translates an AST into low\-level intermediate code (known as
+"LLVM IR") and ultimately to machine code. This phase is responsible for
+optimizing the generated code and handling target\-specific code generation.
+The output of this stage is typically called a ".s" file or "assembly" file.
+.sp
+Clang also supports the use of an integrated assembler, in which the code
+generator produces object files directly. This avoids the overhead of
+generating the ".s" file and of calling the target assembler.
+.TP
+.B Assembler
+This stage runs the target assembler to translate the output of the
+compiler into a target object file. The output of this stage is typically
+called a ".o" file or "object" file.
+.TP
+.B Linker
+This stage runs the target linker to merge multiple object files into an
+executable or dynamic library. The output of this stage is typically called
+an "a.out", ".dylib" or ".so" file.
+.UNINDENT
+.sp
+\fBClang Static Analyzer\fP
+.sp
+The Clang Static Analyzer is a tool that scans source code to try to find bugs
+through code analysis. This tool uses many parts of Clang and is built into
+the same driver. Please see <\fI\%http://clang\-analyzer.llvm.org\fP> for more details
+on how to use the static analyzer.
+.SH OPTIONS
+.SS Stage Selection Options
+.INDENT 0.0
+.TP
+.B \-E
+Run the preprocessor stage.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fsyntax\-only
+Run the preprocessor, parser and type checking stages.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-S
+Run the previous stages as well as LLVM generation and optimization stages
+and target\-specific code generation, producing an assembly file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-c
+Run all of the above, plus the assembler, generating a target ".o" object file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B no stage selection option
+If no stage selection option is specified, all stages above are run, and the
+linker is run to combine the results into an executable or shared library.
+.UNINDENT
+.SS Language Selection and Mode Options
+.INDENT 0.0
+.TP
+.B \-x <language>
+Treat subsequent input files as having type language.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-std=<language>
+Specify the language standard to compile for.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-stdlib=<library>
+Specify the C++ standard library to use; supported options are libstdc++ and
+libc++.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ansi
+Same as \-std=c89.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ObjC, \-ObjC++
+Treat source input files as Objective\-C and Object\-C++ inputs respectively.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-trigraphs
+Enable trigraphs.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ffreestanding
+Indicate that the file should be compiled for a freestanding, not a hosted,
+environment.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fno\-builtin
+Disable special handling and optimizations of builtin functions like
+\fBstrlen()\fP and \fBmalloc()\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fmath\-errno
+Indicate that math functions should be treated as updating \fBerrno\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fpascal\-strings
+Enable support for Pascal\-style strings with "\epfoo".
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fms\-extensions
+Enable support for Microsoft extensions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fmsc\-version=
+Set _MSC_VER. Defaults to 1300 on Windows. Not set otherwise.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fborland\-extensions
+Enable support for Borland extensions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fwritable\-strings
+Make all string literals default to writable. This disables uniquing of
+strings and other optimizations.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-flax\-vector\-conversions
+Allow loose type checking rules for implicit vector conversions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fblocks
+Enable the "Blocks" language feature.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fobjc\-gc\-only
+Indicate that Objective\-C code should be compiled in GC\-only mode, which only
+works when Objective\-C Garbage Collection is enabled.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fobjc\-gc
+Indicate that Objective\-C code should be compiled in hybrid\-GC mode, which
+works with both GC and non\-GC mode.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fobjc\-abi\-version=version
+Select the Objective\-C ABI version to use. Available versions are 1 (legacy
+"fragile" ABI), 2 (non\-fragile ABI 1), and 3 (non\-fragile ABI 2).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fobjc\-nonfragile\-abi\-version=<version>
+Select the Objective\-C non\-fragile ABI version to use by default. This will
+only be used as the Objective\-C ABI when the non\-fragile ABI is enabled
+(either via \fI\%\-fobjc\-nonfragile\-abi\fP, or because it is the platform
+default).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fobjc\-nonfragile\-abi
+Enable use of the Objective\-C non\-fragile ABI. On platforms for which this is
+the default ABI, it can be disabled with \fB\-fno\-objc\-nonfragile\-abi\fP\&.
+.UNINDENT
+.SS Target Selection Options
+.sp
+Clang fully supports cross compilation as an inherent part of its design.
+Depending on how your version of Clang is configured, it may have support for a
+number of cross compilers, or may only support a native target.
+.INDENT 0.0
+.TP
+.B \-arch <architecture>
+Specify the architecture to build for.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mmacosx\-version\-min=<version>
+When building for Mac OS X, specify the minimum version supported by your
+application.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-miphoneos\-version\-min
+When building for iPhone OS, specify the minimum version supported by your
+application.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-march=<cpu>
+Specify that Clang should generate code for a specific processor family
+member and later. For example, if you specify \-march=i486, the compiler is
+allowed to generate instructions that are valid on i486 and later processors,
+but which may not exist on earlier ones.
+.UNINDENT
+.SS Code Generation Options
+.INDENT 0.0
+.TP
+.B \-O0, \-O1, \-O2, \-O3, \-Ofast, \-Os, \-Oz, \-O, \-O4
+Specify which optimization level to use:
+.INDENT 7.0
+.INDENT 3.5
+\fI\%\-O0\fP Means "no optimization": this level compiles the fastest and
+generates the most debuggable code.
+.sp
+\fI\%\-O1\fP Somewhere between \fI\%\-O0\fP and \fI\%\-O2\fP\&.
+.sp
+\fI\%\-O2\fP Moderate level of optimization which enables most
+optimizations.
+.sp
+\fI\%\-O3\fP Like \fI\%\-O2\fP, except that it enables optimizations that
+take longer to perform or that may generate larger code (in an attempt to
+make the program run faster).
+.sp
+\fI\%\-Ofast\fP Enables all the optimizations from \fI\%\-O3\fP along
+with other aggressive optimizations that may violate strict compliance with
+language standards.
+.sp
+\fI\%\-Os\fP Like \fI\%\-O2\fP with extra optimizations to reduce code
+size.
+.sp
+\fI\%\-Oz\fP Like \fI\%\-Os\fP (and thus \fI\%\-O2\fP), but reduces code
+size further.
+.sp
+\fI\%\-O\fP Equivalent to \fI\%\-O2\fP\&.
+.sp
+\fI\%\-O4\fP and higher
+.INDENT 0.0
+.INDENT 3.5
+Currently equivalent to \fI\%\-O3\fP
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-g
+Generate debug information. Note that Clang debug information works best at \-O0.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gmodules
+Generate debug information that contains external references to
+types defined in clang modules or precompiled headers instead of
+emitting redundant debug type information into every object file.
+This option implies \fB\-fmodule\-format=obj\fP\&.
+.sp
+This option should not be used when building static libraries for
+distribution to other machines because the debug info will contain
+references to the module cache on the machine the object files in
+the library were built on.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fstandalone\-debug \-fno\-standalone\-debug
+Clang supports a number of optimizations to reduce the size of debug
+information in the binary. They work based on the assumption that the
+debug type information can be spread out over multiple compilation units.
+For instance, Clang will not emit type definitions for types that are not
+needed by a module and could be replaced with a forward declaration.
+Further, Clang will only emit type info for a dynamic C++ class in the
+module that contains the vtable for the class.
+.sp
+The \fB\-fstandalone\-debug\fP option turns off these optimizations.
+This is useful when working with 3rd\-party libraries that don\(aqt come with
+debug information. This is the default on Darwin. Note that Clang will
+never emit type information for types that are not referenced at all by the
+program.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fexceptions
+Enable generation of unwind information. This allows exceptions to be thrown
+through Clang compiled stack frames. This is on by default in x86\-64.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ftrapv
+Generate code to catch integer overflow errors. Signed integer overflow is
+undefined in C. With this flag, extra code is generated to detect this and
+abort when it happens.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fvisibility
+This flag sets the default visibility level.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-fcommon
+This flag specifies that variables without initializers get common linkage.
+It can be disabled with \fB\-fno\-common\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ftls\-model=<model>
+Set the default thread\-local storage (TLS) model to use for thread\-local
+variables. Valid values are: "global\-dynamic", "local\-dynamic",
+"initial\-exec" and "local\-exec". The default is "global\-dynamic". The default
+model can be overridden with the tls_model attribute. The compiler will try
+to choose a more efficient model if possible.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-flto, \-emit\-llvm
+Generate output files in LLVM formats, suitable for link time optimization.
+When used with \fI\%\-S\fP this generates LLVM intermediate language
+assembly files, otherwise this generates LLVM bitcode format object files
+(which may be passed to the linker depending on the stage selection options).
+.UNINDENT
+.SS Driver Options
+.INDENT 0.0
+.TP
+.B \-###
+Print (but do not run) the commands to run for this compilation.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-help
+Display available options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Qunused\-arguments
+Do not emit any warnings for unused driver arguments.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Wa,<args>
+Pass the comma separated arguments in args to the assembler.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Wl,<args>
+Pass the comma separated arguments in args to the linker.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Wp,<args>
+Pass the comma separated arguments in args to the preprocessor.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Xanalyzer <arg>
+Pass arg to the static analyzer.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Xassembler <arg>
+Pass arg to the assembler.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Xlinker <arg>
+Pass arg to the linker.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-Xpreprocessor <arg>
+Pass arg to the preprocessor.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-o <file>
+Write output to file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-file\-name=<file>
+Print the full library path of file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-libgcc\-file\-name
+Print the library path for "libgcc.a".
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-prog\-name=<name>
+Print the full program path of name.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-search\-dirs
+Print the paths used for finding libraries and programs.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-save\-temps
+Save intermediate compilation results.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-integrated\-as, \-no\-integrated\-as
+Used to enable and disable, respectively, the use of the integrated
+assembler. Whether the integrated assembler is on by default is target
+dependent.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-time
+Time individual commands.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-ftime\-report
+Print timing summary of each stage of compilation.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-v
+Show commands to run and use verbose output.
+.UNINDENT
+.SS Diagnostics Options
+.INDENT 0.0
+.TP
+.B \-fshow\-column, \-fshow\-source\-location, \-fcaret\-diagnostics, \-fdiagnostics\-fixit\-info, \-fdiagnostics\-parseable\-fixits, \-fdiagnostics\-print\-source\-range\-info, \-fprint\-source\-range\-info, \-fdiagnostics\-show\-option, \-fmessage\-length
+These options control how Clang prints out information about diagnostics
+(errors and warnings). Please see the Clang User\(aqs Manual for more information.
+.UNINDENT
+.SS Preprocessor Options
+.INDENT 0.0
+.TP
+.B \-D<macroname>=<value>
+Adds an implicit #define into the predefines buffer which is read before the
+source file is preprocessed.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-U<macroname>
+Adds an implicit #undef into the predefines buffer which is read before the
+source file is preprocessed.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-include <filename>
+Adds an implicit #include into the predefines buffer which is read before the
+source file is preprocessed.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-I<directory>
+Add the specified directory to the search path for include files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-F<directory>
+Add the specified directory to the search path for framework include files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-nostdinc
+Do not search the standard system directories or compiler builtin directories
+for include files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-nostdlibinc
+Do not search the standard system directories for include files, but do
+search compiler builtin include directories.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-nobuiltininc
+Do not search clang\(aqs builtin directory for include files.
+.UNINDENT
+.SH ENVIRONMENT
+.INDENT 0.0
+.TP
+.B TMPDIR, TEMP, TMP
+These environment variables are checked, in order, for the location to write
+temporary files used during the compilation process.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B CPATH
+If this environment variable is present, it is treated as a delimited list of
+paths to be added to the default system include path list. The delimiter is
+the platform dependent delimiter, as used in the PATH environment variable.
+.sp
+Empty components in the environment variable are ignored.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B C_INCLUDE_PATH, OBJC_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJCPLUS_INCLUDE_PATH
+These environment variables specify additional paths, as for \fI\%CPATH\fP, which are
+only used when processing the appropriate language.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B MACOSX_DEPLOYMENT_TARGET
+If \fI\%\-mmacosx\-version\-min\fP is unspecified, the default deployment
+target is read from this environment variable. This option only affects
+Darwin targets.
+.UNINDENT
+.SH BUGS
+.sp
+To report bugs, please visit <\fI\%http://llvm.org/bugs/\fP>. Most bug reports should
+include preprocessed source files (use the \fI\%\-E\fP option) and the full
+output of the compiler, along with information to reproduce.
+.SH SEE ALSO
+.sp
+\fIas(1)\fP, \fIld(1)\fP
+.SH AUTHOR
+Maintained by the Clang / LLVM Team (<http://clang.llvm.org>)
+.SH COPYRIGHT
+2007-2016, The Clang Team
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llc/Makefile b/usr.bin/clang/llc/Makefile
new file mode 100644
index 0000000..a9d16db
--- /dev/null
+++ b/usr.bin/clang/llc/Makefile
@@ -0,0 +1,75 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llc
+
+SRCDIR= tools/llc
+SRCS= llc.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmmirparser \
+ llvmirreader \
+ llvmasmparser \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llc/Makefile.depend b/usr.bin/clang/llc/Makefile.depend
new file mode 100644
index 0000000..374f871
--- /dev/null
+++ b/usr.bin/clang/llc/Makefile.depend
@@ -0,0 +1,83 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmmirparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llc/llc.1 b/usr.bin/clang/llc/llc.1
new file mode 100644
index 0000000..1ec01b7
--- /dev/null
+++ b/usr.bin/clang/llc/llc.1
@@ -0,0 +1,265 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLC" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llc \- LLVM static compiler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllc\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllc\fP command compiles LLVM source inputs into assembly language
+for a specified architecture. The assembly language output can then be passed
+through a native assembler and linker to generate a native executable.
+.sp
+The choice of architecture for the output assembly code is automatically
+determined from the input file, unless the \fB\-march\fP option is used to
+override the default.
+.SH OPTIONS
+.sp
+If \fBfilename\fP is "\fB\-\fP" or omitted, \fBllc\fP reads from standard input.
+Otherwise, it will from \fBfilename\fP\&. Inputs can be in either the LLVM assembly
+language format (\fB\&.ll\fP) or the LLVM bitcode format (\fB\&.bc\fP).
+.sp
+If the \fB\-o\fP option is omitted, then \fBllc\fP will send its output
+to standard output if the input is from standard input. If the \fB\-o\fP
+option specifies "\fB\-\fP", then the output will also be sent to standard output.
+.sp
+If no \fB\-o\fP option is specified and an input file other than "\fB\-\fP" is
+specified, then \fBllc\fP creates the output filename by taking the input
+filename, removing any existing \fB\&.bc\fP extension, and adding a \fB\&.s\fP suffix.
+.sp
+Other \fBllc\fP options are described below.
+.SS End\-user Options
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-O=uint
+Generate code at different optimization levels. These correspond to the
+\fB\-O0\fP, \fB\-O1\fP, \fB\-O2\fP, and \fB\-O3\fP optimization levels used by
+\fBclang\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mtriple=<target triple>
+Override the target triple specified in the input file with the specified
+string.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-march=<arch>
+Specify the architecture for which to generate assembly, overriding the target
+encoded in the input file. See the output of \fBllc \-help\fP for a list of
+valid architectures. By default this is inferred from the target triple or
+autodetected to the current architecture.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mcpu=<cpuname>
+Specify a specific chip in the current architecture to generate code for.
+By default this is inferred from the target triple and autodetected to
+the current architecture. For a list of available CPUs, use:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+llvm\-as < /dev/null | llc \-march=xyz \-mcpu=help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-filetype=<output file type>
+Specify what kind of output \fBllc\fP should generated. Options are: \fBasm\fP
+for textual assembly ( \fB\(aq.s\(aq\fP), \fBobj\fP for native object files (\fB\(aq.o\(aq\fP)
+and \fBnull\fP for not emitting anything (for performance testing).
+.sp
+Note that not all targets support all options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mattr=a1,+a2,\-a3,...
+Override or control specific attributes of the target, such as whether SIMD
+operations are enabled or not. The default set of attributes is set by the
+current CPU. For a list of available attributes, use:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+llvm\-as < /dev/null | llc \-march=xyz \-mattr=help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-disable\-fp\-elim
+Disable frame pointer elimination optimization.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-disable\-excess\-fp\-precision
+Disable optimizations that may produce excess precision for floating point.
+Note that this option can dramatically slow down code on some systems
+(e.g. X86).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-enable\-no\-infs\-fp\-math
+Enable optimizations that assume no Inf values.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-enable\-no\-nans\-fp\-math
+Enable optimizations that assume no NAN values.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-enable\-unsafe\-fp\-math
+Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
+addition is associative) or may not work for all input ranges. These
+optimizations allow the code generator to make use of some instructions which
+would otherwise not be usable (such as \fBfsin\fP on X86).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-stats
+Print statistics recorded by code\-generation passes.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-time\-passes
+Record the amount of time needed for each pass and print a report to standard
+error.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-load=<dso_path>
+Dynamically load \fBdso_path\fP (a path to a dynamically shared object) that
+implements an LLVM target. This will permit the target name to be used with
+the \fB\-march\fP option so that code can be generated for that target.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-meabi=[default|gnu|4|5]
+Specify which EABI version should conform to. Valid EABI versions are \fIgnu\fP,
+\fI4\fP and \fI5\fP\&. Default value (\fIdefault\fP) depends on the triple.
+.UNINDENT
+.SS Tuning/Configuration Options
+.INDENT 0.0
+.TP
+.B \-\-print\-machineinstrs
+Print generated machine code between compilation phases (useful for debugging).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-regalloc=<allocator>
+Specify the register allocator to use.
+Valid register allocators are:
+.sp
+\fIbasic\fP
+.INDENT 7.0
+.INDENT 3.5
+Basic register allocator.
+.UNINDENT
+.UNINDENT
+.sp
+\fIfast\fP
+.INDENT 7.0
+.INDENT 3.5
+Fast register allocator. It is the default for unoptimized code.
+.UNINDENT
+.UNINDENT
+.sp
+\fIgreedy\fP
+.INDENT 7.0
+.INDENT 3.5
+Greedy register allocator. It is the default for optimized code.
+.UNINDENT
+.UNINDENT
+.sp
+\fIpbqp\fP
+.INDENT 7.0
+.INDENT 3.5
+Register allocator based on \(aqPartitioned Boolean Quadratic Programming\(aq.
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-spiller=<spiller>
+Specify the spiller to use for register allocators that support it. Currently
+this option is used only by the linear scan register allocator. The default
+\fBspiller\fP is \fIlocal\fP\&. Valid spillers are:
+.sp
+\fIsimple\fP
+.INDENT 7.0
+.INDENT 3.5
+Simple spiller
+.UNINDENT
+.UNINDENT
+.sp
+\fIlocal\fP
+.INDENT 7.0
+.INDENT 3.5
+Local spiller
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SS Intel IA\-32\-specific Options
+.INDENT 0.0
+.TP
+.B \-\-x86\-asm\-syntax=[att|intel]
+Specify whether to emit assembly code in AT&T syntax (the default) or Intel
+syntax.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllc\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+lli
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/lldb/Makefile b/usr.bin/clang/lldb/Makefile
new file mode 100644
index 0000000..b2c9050
--- /dev/null
+++ b/usr.bin/clang/lldb/Makefile
@@ -0,0 +1,173 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=lldb
+
+LLDB_SRCS=${.CURDIR}/../../../contrib/llvm/tools/lldb
+
+CFLAGS+= -I${LLDB_SRCS}/include
+CXXFLAGS+= -std=c++11
+.if ${MACHINE_CPUARCH} == "arm"
+CFLAGS+= -mlong-calls
+.endif
+
+SRCDIR= tools/lldb/tools/driver
+SRCS= Driver.cpp \
+ Platform.cpp
+
+# Man page directory
+.PATH: ${LLDB_SRCS}/docs
+
+LIBADD+= edit panel ncursesw execinfo z
+
+LLDB_LIBS=\
+ lldb \
+ \
+ lldbAPI \
+ lldbBreakpoint \
+ lldbCommands \
+ lldbCore \
+ lldbDataFormatters \
+ lldbExpression \
+ lldbHostFreeBSD \
+ lldbHostCommon \
+ lldbHostPOSIX \
+ lldbInitialization \
+ lldbInterpreter \
+ lldbSymbol \
+ lldbTarget \
+ lldbUtility \
+ \
+ lldbPluginABISysV_arm \
+ lldbPluginABISysV_arm64 \
+ lldbPluginABISysV_i386 \
+ lldbPluginABISysV_mips \
+ lldbPluginABISysV_mips64 \
+ lldbPluginABISysV_ppc \
+ lldbPluginABISysV_ppc64 \
+ lldbPluginABISysV_x86_64 \
+ lldbPluginCXXItaniumABI \
+ lldbPluginDisassemblerLLVM \
+ lldbPluginExpressionParserClang \
+ lldbPluginExpressionParserGo \
+ lldbPluginInstructionARM \
+ lldbPluginInstructionARM64 \
+ lldbPluginInstructionMIPS \
+ lldbPluginInstructionMIPS64 \
+ lldbPluginInstrumentationRuntimeAddressSanitizer \
+ lldbPluginJITLoaderGDB \
+ lldbPluginLanguageCPlusPlus \
+ lldbPluginLanguageObjC \
+ lldbPluginSymbolFileDWARF \
+ lldbPluginSymbolFileSymtab \
+ lldbPluginDynamicLoaderStatic \
+ lldbPluginDynamicLoaderPosixDYLD \
+ lldbPluginMemoryHistoryASan \
+ lldbPluginObjectContainerBSDArchive \
+ lldbPluginObjectFileELF \
+ lldbPluginObjectFileJIT \
+ lldbPluginScriptInterpreterNone \
+ lldbPluginSymbolVendorELF \
+ lldbPluginPlatformFreeBSD \
+ lldbPluginPlatformGDB \
+ lldbPluginProcessElfCore \
+ lldbPluginProcessFreeBSD \
+ lldbPluginProcessGDBRemote \
+ lldbPluginProcessUtility \
+ lldbPluginProcessPOSIX \
+ lldbPluginProcessFreeBSD \
+ lldbPluginUnwindAssemblyInstEmulation \
+ lldbPluginUnwindAssemblyX86
+
+LDADD+= -Wl,--start-group
+.for lib in ${LLDB_LIBS}
+DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+.endfor
+LDADD+= -Wl,--end-group
+
+# Clang and LLVM libraries
+LIBDEPS=\
+ clangfrontend \
+ clangdriver \
+ clangserialization \
+ clangcodegen \
+ clangparse \
+ clangsema \
+ clanganalysis \
+ clangedit \
+ clangast \
+ clanglex \
+ clangbasic \
+ \
+ llvmoption \
+ llvmobjcarcopts \
+ llvmlinker \
+ llvmmcjit \
+ llvmruntimedyld \
+ llvmexecutionengine \
+ llvmirreader \
+ llvmipo \
+ llvmvectorize \
+ llvmbitwriter \
+ llvmasmparser \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvmprofiledata \
+ llvminstcombine \
+ llvmtransformutils \
+ llvmanalysis \
+ llvminstrumentation \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= pthread
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/lldb/Makefile.depend b/usr.bin/clang/lldb/Makefile.depend
new file mode 100644
index 0000000..acf1b8c
--- /dev/null
+++ b/usr.bin/clang/lldb/Makefile.depend
@@ -0,0 +1,159 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libclanganalysis \
+ lib/clang/libclangast \
+ lib/clang/libclangbasic \
+ lib/clang/libclangcodegen \
+ lib/clang/libclangdriver \
+ lib/clang/libclangedit \
+ lib/clang/libclangfrontend \
+ lib/clang/libclanglex \
+ lib/clang/libclangparse \
+ lib/clang/libclangsema \
+ lib/clang/libclangserialization \
+ lib/clang/liblldb \
+ lib/clang/liblldbAPI \
+ lib/clang/liblldbBreakpoint \
+ lib/clang/liblldbCommands \
+ lib/clang/liblldbCore \
+ lib/clang/liblldbDataFormatters \
+ lib/clang/liblldbExpression \
+ lib/clang/liblldbHostCommon \
+ lib/clang/liblldbHostFreeBSD \
+ lib/clang/liblldbHostPOSIX \
+ lib/clang/liblldbInitialization \
+ lib/clang/liblldbInterpreter \
+ lib/clang/liblldbPluginABISysV_arm \
+ lib/clang/liblldbPluginABISysV_arm64 \
+ lib/clang/liblldbPluginABISysV_i386 \
+ lib/clang/liblldbPluginABISysV_mips \
+ lib/clang/liblldbPluginABISysV_mips64 \
+ lib/clang/liblldbPluginABISysV_ppc \
+ lib/clang/liblldbPluginABISysV_ppc64 \
+ lib/clang/liblldbPluginABISysV_x86_64 \
+ lib/clang/liblldbPluginCXXItaniumABI \
+ lib/clang/liblldbPluginDisassemblerLLVM \
+ lib/clang/liblldbPluginDynamicLoaderPosixDYLD \
+ lib/clang/liblldbPluginDynamicLoaderStatic \
+ lib/clang/liblldbPluginExpressionParserClang \
+ lib/clang/liblldbPluginExpressionParserGo \
+ lib/clang/liblldbPluginInstructionARM \
+ lib/clang/liblldbPluginInstructionARM64 \
+ lib/clang/liblldbPluginInstructionMIPS \
+ lib/clang/liblldbPluginInstructionMIPS64 \
+ lib/clang/liblldbPluginInstrumentationRuntimeAddressSanitizer \
+ lib/clang/liblldbPluginJITLoaderGDB \
+ lib/clang/liblldbPluginLanguageCPlusPlus \
+ lib/clang/liblldbPluginLanguageObjC \
+ lib/clang/liblldbPluginMemoryHistoryASan \
+ lib/clang/liblldbPluginObjectContainerBSDArchive \
+ lib/clang/liblldbPluginObjectFileELF \
+ lib/clang/liblldbPluginObjectFileJIT \
+ lib/clang/liblldbPluginPlatformFreeBSD \
+ lib/clang/liblldbPluginPlatformGDB \
+ lib/clang/liblldbPluginProcessElfCore \
+ lib/clang/liblldbPluginProcessFreeBSD \
+ lib/clang/liblldbPluginProcessGDBRemote \
+ lib/clang/liblldbPluginProcessPOSIX \
+ lib/clang/liblldbPluginProcessUtility \
+ lib/clang/liblldbPluginScriptInterpreterNone \
+ lib/clang/liblldbPluginSymbolFileDWARF \
+ lib/clang/liblldbPluginSymbolFileSymtab \
+ lib/clang/liblldbPluginSymbolVendorELF \
+ lib/clang/liblldbPluginUnwindAssemblyInstEmulation \
+ lib/clang/liblldbPluginUnwindAssemblyX86 \
+ lib/clang/liblldbSymbol \
+ lib/clang/liblldbTarget \
+ lib/clang/liblldbUtility \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmexecutionengine \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcjit \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobjcarcopts \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmoption \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmruntimedyld \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/libelf \
+ lib/libexecinfo \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
+ lib/ncurses/panel \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/lli/Makefile b/usr.bin/clang/lli/Makefile
new file mode 100644
index 0000000..b7826b9
--- /dev/null
+++ b/usr.bin/clang/lli/Makefile
@@ -0,0 +1,49 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=lli
+
+SRCDIR= tools/lli
+SRCS= OrcLazyJIT.cpp \
+ lli.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmx86disassembler \
+ llvmx86asmparser \
+ llvmirreader \
+ llvmasmparser \
+ llvmx86codegen \
+ llvmx86desc \
+ llvmx86info \
+ llvmmcdisassembler \
+ llvmx86asmprinter \
+ llvmx86utils \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvminterpreter \
+ llvmcodegen \
+ llvmscalaropts \
+ llvminstcombine \
+ llvmbitwriter \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmorcjit \
+ llvmtransformutils \
+ llvmmcjit \
+ llvmexecutionengine \
+ llvmtarget \
+ llvmanalysis \
+ llvmruntimedyld \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmc \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/lli/Makefile.depend b/usr.bin/clang/lli/Makefile.depend
new file mode 100644
index 0000000..7ceb1a7
--- /dev/null
+++ b/usr.bin/clang/lli/Makefile.depend
@@ -0,0 +1,56 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmexecutionengine \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvminterpreter \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcjit \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmorcjit \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmruntimedyld \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/lli/lli.1 b/usr.bin/clang/lli/lli.1
new file mode 100644
index 0000000..7b805f7
--- /dev/null
+++ b/usr.bin/clang/lli/lli.1
@@ -0,0 +1,298 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLI" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+lli \- directly execute programs from LLVM bitcode
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBlli\fP [\fIoptions\fP] [\fIfilename\fP] [\fIprogram args\fP]
+.SH DESCRIPTION
+.sp
+\fBlli\fP directly executes programs in LLVM bitcode format. It takes a program
+in LLVM bitcode format and executes it using a just\-in\-time compiler or an
+interpreter.
+.sp
+\fBlli\fP is \fInot\fP an emulator. It will not execute IR of different architectures
+and it can only interpret (or JIT\-compile) for the host architecture.
+.sp
+The JIT compiler takes the same arguments as other tools, like \fBllc\fP,
+but they don\(aqt necessarily work for the interpreter.
+.sp
+If \fIfilename\fP is not specified, then \fBlli\fP reads the LLVM bitcode for the
+program from standard input.
+.sp
+The optional \fIargs\fP specified on the command line are passed to the program as
+arguments.
+.SH GENERAL OPTIONS
+.INDENT 0.0
+.TP
+.B \-fake\-argv0=executable
+Override the \fBargv[0]\fP value passed into the executing program.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-force\-interpreter={false,true}
+If set to true, use the interpreter even if a just\-in\-time compiler is available
+for this architecture. Defaults to false.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-load=pluginfilename
+Causes \fBlli\fP to load the plugin (shared object) named \fIpluginfilename\fP and use
+it for optimization.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-stats
+Print statistics from the code\-generation passes. This is only meaningful for
+the just\-in\-time compiler, at present.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-time\-passes
+Record the amount of time needed for each code\-generation pass and print it to
+standard error.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-version
+Print out the version of \fBlli\fP and exit without doing anything else.
+.UNINDENT
+.SH TARGET OPTIONS
+.INDENT 0.0
+.TP
+.B \-mtriple=target triple
+Override the target triple specified in the input bitcode file with the
+specified string. This may result in a crash if you pick an
+architecture which is not compatible with the current system.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-march=arch
+Specify the architecture for which to generate assembly, overriding the target
+encoded in the bitcode file. See the output of \fBllc \-help\fP for a list of
+valid architectures. By default this is inferred from the target triple or
+autodetected to the current architecture.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mcpu=cpuname
+Specify a specific chip in the current architecture to generate code for.
+By default this is inferred from the target triple and autodetected to
+the current architecture. For a list of available CPUs, use:
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mcpu=help\fP
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-mattr=a1,+a2,\-a3,...
+Override or control specific attributes of the target, such as whether SIMD
+operations are enabled or not. The default set of attributes is set by the
+current CPU. For a list of available attributes, use:
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mattr=help\fP
+.UNINDENT
+.SH FLOATING POINT OPTIONS
+.INDENT 0.0
+.TP
+.B \-disable\-excess\-fp\-precision
+Disable optimizations that may increase floating point precision.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-enable\-no\-infs\-fp\-math
+Enable optimizations that assume no Inf values.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-enable\-no\-nans\-fp\-math
+Enable optimizations that assume no NAN values.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-enable\-unsafe\-fp\-math
+Causes \fBlli\fP to enable optimizations that may decrease floating point
+precision.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-soft\-float
+Causes \fBlli\fP to generate software floating point library calls instead of
+equivalent hardware instructions.
+.UNINDENT
+.SH CODE GENERATION OPTIONS
+.INDENT 0.0
+.TP
+.B \-code\-model=model
+Choose the code model from:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+default: Target default code model
+small: Small code model
+kernel: Kernel code model
+medium: Medium code model
+large: Large code model
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-disable\-post\-RA\-scheduler
+Disable scheduling after register allocation.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-disable\-spill\-fusing
+Disable fusing of spill code into instructions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-jit\-enable\-eh
+Exception handling should be enabled in the just\-in\-time compiler.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-join\-liveintervals
+Coalesce copies (default=true).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-nozero\-initialized\-in\-bss
+Don\(aqt place zero\-initialized symbols into the BSS section.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-pre\-RA\-sched=scheduler
+Instruction schedulers available (before register allocation):
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+=default: Best scheduler for the target
+=none: No scheduling: breadth first sequencing
+=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
+=simple\-noitin: Simple two pass scheduling: Same as simple except using generic latency
+=list\-burr: Bottom\-up register reduction list scheduling
+=list\-tdrr: Top\-down register reduction list scheduling
+=list\-td: Top\-down list scheduler \-print\-machineinstrs \- Print generated machine code
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-regalloc=allocator
+Register allocator to use (default=linearscan)
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+=bigblock: Big\-block register allocator
+=linearscan: linear scan register allocator =local \- local register allocator
+=simple: simple register allocator
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-relocation\-model=model
+Choose relocation model from:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+=default: Target default relocation model
+=static: Non\-relocatable code =pic \- Fully relocatable, position independent code
+=dynamic\-no\-pic: Relocatable external references, non\-relocatable code
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-spiller
+Spiller to use (default=local)
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+=simple: simple spiller
+=local: local spiller
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-x86\-asm\-syntax=syntax
+Choose style of code to emit from X86 backend:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+=att: Emit AT&T\-style assembly
+=intel: Emit Intel\-style assembly
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBlli\fP fails to load the program, it will exit with an exit code of 1.
+Otherwise, it will return the exit code of the program it executes.
+.SH SEE ALSO
+.sp
+\fBllc\fP
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-ar/Makefile b/usr.bin/clang/llvm-ar/Makefile
new file mode 100644
index 0000000..6052067
--- /dev/null
+++ b/usr.bin/clang/llvm-ar/Makefile
@@ -0,0 +1,73 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-ar
+
+SRCDIR= tools/llvm-ar
+SRCS= llvm-ar.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmlibdriver \
+ llvmoption \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-ar/Makefile.depend b/usr.bin/clang/llvm-ar/Makefile.depend
new file mode 100644
index 0000000..6c076d8
--- /dev/null
+++ b/usr.bin/clang/llvm-ar/Makefile.depend
@@ -0,0 +1,82 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmlibdriver \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmoption \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-ar/llvm-ar.1 b/usr.bin/clang/llvm-ar/llvm-ar.1
new file mode 100644
index 0000000..7b7e062
--- /dev/null
+++ b/usr.bin/clang/llvm-ar/llvm-ar.1
@@ -0,0 +1,390 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-AR" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-ar \- LLVM archiver
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-ar\fP [\-]{dmpqrtx}[Rabfikou] [relpos] [count] <archive> [files...]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-ar\fP command is similar to the common Unix utility, \fBar\fP\&. It
+archives several files together into a single file. The intent for this is
+to produce archive libraries by LLVM bitcode that can be linked into an
+LLVM program. However, the archive can contain any kind of file. By default,
+\fBllvm\-ar\fP generates a symbol table that makes linking faster because
+only the symbol table needs to be consulted, not each individual file member
+of the archive.
+.sp
+The \fBllvm\-ar\fP command can be used to \fIread\fP SVR4, GNU and BSD style archive
+files. However, right now it can only write in the GNU format. If an
+SVR4 or BSD style archive is used with the \fBr\fP (replace) or \fBq\fP (quick
+update) operations, the archive will be reconstructed in GNU format.
+.sp
+Here\(aqs where \fBllvm\-ar\fP departs from previous \fBar\fP implementations:
+.sp
+\fISymbol Table\fP
+.INDENT 0.0
+.INDENT 3.5
+Since \fBllvm\-ar\fP supports bitcode files. The symbol table it creates
+is in GNU format and includes both native and bitcode files.
+.UNINDENT
+.UNINDENT
+.sp
+\fILong Paths\fP
+.INDENT 0.0
+.INDENT 3.5
+Currently \fBllvm\-ar\fP can read GNU and BSD long file names, but only writes
+archives with the GNU format.
+.UNINDENT
+.UNINDENT
+.SH OPTIONS
+.sp
+The options to \fBllvm\-ar\fP are compatible with other \fBar\fP implementations.
+However, there are a few modifiers (\fIR\fP) that are not found in other \fBar\fP
+implementations. The options to \fBllvm\-ar\fP specify a single basic operation to
+perform on the archive, a variety of modifiers for that operation, the name of
+the archive file, and an optional list of file names. These options are used to
+determine how \fBllvm\-ar\fP should process the archive file.
+.sp
+The Operations and Modifiers are explained in the sections below. The minimal
+set of options is at least one operator and the name of the archive. Typically
+archive files end with a \fB\&.a\fP suffix, but this is not required. Following
+the \fIarchive\-name\fP comes a list of \fIfiles\fP that indicate the specific members
+of the archive to operate on. If the \fIfiles\fP option is not specified, it
+generally means either "none" or "all" members, depending on the operation.
+.SS Operations
+.sp
+d
+.INDENT 0.0
+.INDENT 3.5
+Delete files from the archive. No modifiers are applicable to this operation.
+The \fIfiles\fP options specify which members should be removed from the
+archive. It is not an error if a specified file does not appear in the archive.
+If no \fIfiles\fP are specified, the archive is not modified.
+.UNINDENT
+.UNINDENT
+.sp
+m[abi]
+.INDENT 0.0
+.INDENT 3.5
+Move files from one location in the archive to another. The \fIa\fP, \fIb\fP, and
+\fIi\fP modifiers apply to this operation. The \fIfiles\fP will all be moved
+to the location given by the modifiers. If no modifiers are used, the files
+will be moved to the end of the archive. If no \fIfiles\fP are specified, the
+archive is not modified.
+.UNINDENT
+.UNINDENT
+.sp
+p
+.INDENT 0.0
+.INDENT 3.5
+Print files to the standard output. This operation simply prints the
+\fIfiles\fP indicated to the standard output. If no \fIfiles\fP are
+specified, the entire archive is printed. Printing bitcode files is
+ill\-advised as they might confuse your terminal settings. The \fIp\fP
+operation never modifies the archive.
+.UNINDENT
+.UNINDENT
+.sp
+q
+.INDENT 0.0
+.INDENT 3.5
+Quickly append files to the end of the archive. This operation quickly adds the
+\fIfiles\fP to the archive without checking for duplicates that should be
+removed first. If no \fIfiles\fP are specified, the archive is not modified.
+Because of the way that \fBllvm\-ar\fP constructs the archive file, its dubious
+whether the \fIq\fP operation is any faster than the \fIr\fP operation.
+.UNINDENT
+.UNINDENT
+.sp
+r[abu]
+.INDENT 0.0
+.INDENT 3.5
+Replace or insert file members. The \fIa\fP, \fIb\fP, and \fIu\fP
+modifiers apply to this operation. This operation will replace existing
+\fIfiles\fP or insert them at the end of the archive if they do not exist. If no
+\fIfiles\fP are specified, the archive is not modified.
+.UNINDENT
+.UNINDENT
+.sp
+t[v]
+.INDENT 0.0
+.INDENT 3.5
+Print the table of contents. Without any modifiers, this operation just prints
+the names of the members to the standard output. With the \fIv\fP modifier,
+\fBllvm\-ar\fP also prints out the file type (B=bitcode, S=symbol
+table, blank=regular file), the permission mode, the owner and group, the
+size, and the date. If any \fIfiles\fP are specified, the listing is only for
+those files. If no \fIfiles\fP are specified, the table of contents for the
+whole archive is printed.
+.UNINDENT
+.UNINDENT
+.sp
+x[oP]
+.INDENT 0.0
+.INDENT 3.5
+Extract archive members back to files. The \fIo\fP modifier applies to this
+operation. This operation retrieves the indicated \fIfiles\fP from the archive
+and writes them back to the operating system\(aqs file system. If no
+\fIfiles\fP are specified, the entire archive is extract.
+.UNINDENT
+.UNINDENT
+.SS Modifiers (operation specific)
+.sp
+The modifiers below are specific to certain operations. See the Operations
+section (above) to determine which modifiers are applicable to which operations.
+.sp
+[a]
+.INDENT 0.0
+.INDENT 3.5
+When inserting or moving member files, this option specifies the destination of
+the new files as being after the \fIrelpos\fP member. If \fIrelpos\fP is not found,
+the files are placed at the end of the archive.
+.UNINDENT
+.UNINDENT
+.sp
+[b]
+.INDENT 0.0
+.INDENT 3.5
+When inserting or moving member files, this option specifies the destination of
+the new files as being before the \fIrelpos\fP member. If \fIrelpos\fP is not
+found, the files are placed at the end of the archive. This modifier is
+identical to the \fIi\fP modifier.
+.UNINDENT
+.UNINDENT
+.sp
+[i]
+.INDENT 0.0
+.INDENT 3.5
+A synonym for the \fIb\fP option.
+.UNINDENT
+.UNINDENT
+.sp
+[o]
+.INDENT 0.0
+.INDENT 3.5
+When extracting files, this option will cause \fBllvm\-ar\fP to preserve the
+original modification times of the files it writes.
+.UNINDENT
+.UNINDENT
+.sp
+[u]
+.INDENT 0.0
+.INDENT 3.5
+When replacing existing files in the archive, only replace those files that have
+a time stamp than the time stamp of the member in the archive.
+.UNINDENT
+.UNINDENT
+.SS Modifiers (generic)
+.sp
+The modifiers below may be applied to any operation.
+.sp
+[c]
+.INDENT 0.0
+.INDENT 3.5
+For all operations, \fBllvm\-ar\fP will always create the archive if it doesn\(aqt
+exist. Normally, \fBllvm\-ar\fP will print a warning message indicating that the
+archive is being created. Using this modifier turns off that warning.
+.UNINDENT
+.UNINDENT
+.sp
+[s]
+.INDENT 0.0
+.INDENT 3.5
+This modifier requests that an archive index (or symbol table) be added to the
+archive. This is the default mode of operation. The symbol table will contain
+all the externally visible functions and global variables defined by all the
+bitcode files in the archive.
+.UNINDENT
+.UNINDENT
+.sp
+[S]
+.INDENT 0.0
+.INDENT 3.5
+This modifier is the opposite of the \fIs\fP modifier. It instructs \fBllvm\-ar\fP to
+not build the symbol table. If both \fIs\fP and \fIS\fP are used, the last modifier to
+occur in the options will prevail.
+.UNINDENT
+.UNINDENT
+.sp
+[v]
+.INDENT 0.0
+.INDENT 3.5
+This modifier instructs \fBllvm\-ar\fP to be verbose about what it is doing. Each
+editing operation taken against the archive will produce a line of output saying
+what is being done.
+.UNINDENT
+.UNINDENT
+.SH STANDARDS
+.sp
+The \fBllvm\-ar\fP utility is intended to provide a superset of the IEEE Std 1003.2
+(POSIX.2) functionality for \fBar\fP\&. \fBllvm\-ar\fP can read both SVR4 and BSD4.4 (or
+Mac OS X) archives. If the \fBf\fP modifier is given to the \fBx\fP or \fBr\fP operations
+then \fBllvm\-ar\fP will write SVR4 compatible archives. Without this modifier,
+\fBllvm\-ar\fP will write BSD4.4 compatible archives that have long names
+immediately after the header and indicated using the "#1/ddd" notation for the
+name in the header.
+.SH FILE FORMAT
+.sp
+The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX
+archive files. In fact, except for the symbol table, the \fBar\fP commands on those
+operating systems should be able to read LLVM archive files. The details of the
+file format follow.
+.sp
+Each archive begins with the archive magic number which is the eight printable
+characters "!<arch>n" where n represents the newline character (0x0A).
+Following the magic number, the file is composed of even length members that
+begin with an archive header and end with a n padding character if necessary
+(to make the length even). Each file member is composed of a header (defined
+below), an optional newline\-terminated "long file name" and the contents of
+the file.
+.sp
+The fields of the header are described in the items below. All fields of the
+header contain only ASCII characters, are left justified and are right padded
+with space characters.
+.sp
+name \- char[16]
+.INDENT 0.0
+.INDENT 3.5
+This field of the header provides the name of the archive member. If the name is
+longer than 15 characters or contains a slash (/) character, then this field
+contains \fB#1/nnn\fP where \fBnnn\fP provides the length of the name and the \fB#1/\fP
+is literal. In this case, the actual name of the file is provided in the \fBnnn\fP
+bytes immediately following the header. If the name is 15 characters or less, it
+is contained directly in this field and terminated with a slash (/) character.
+.UNINDENT
+.UNINDENT
+.sp
+date \- char[12]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the date of modification of the file in the form of a
+decimal encoded number that provides the number of seconds since the epoch
+(since 00:00:00 Jan 1, 1970) per Posix specifications.
+.UNINDENT
+.UNINDENT
+.sp
+uid \- char[6]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the user id of the file encoded as a decimal ASCII string.
+This field might not make much sense on non\-Unix systems. On Unix, it is the
+same value as the st_uid field of the stat structure returned by the stat(2)
+operating system call.
+.UNINDENT
+.UNINDENT
+.sp
+gid \- char[6]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the group id of the file encoded as a decimal ASCII string.
+This field might not make much sense on non\-Unix systems. On Unix, it is the
+same value as the st_gid field of the stat structure returned by the stat(2)
+operating system call.
+.UNINDENT
+.UNINDENT
+.sp
+mode \- char[8]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the access mode of the file encoded as an octal ASCII
+string. This field might not make much sense on non\-Unix systems. On Unix, it
+is the same value as the st_mode field of the stat structure returned by the
+stat(2) operating system call.
+.UNINDENT
+.UNINDENT
+.sp
+size \- char[10]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the size of the file, in bytes, encoded as a decimal ASCII
+string.
+.UNINDENT
+.UNINDENT
+.sp
+fmag \- char[2]
+.INDENT 0.0
+.INDENT 3.5
+This field is the archive file member magic number. Its content is always the
+two characters back tick (0x60) and newline (0x0A). This provides some measure
+utility in identifying archive files that have been corrupted.
+.UNINDENT
+.UNINDENT
+.sp
+offset \- vbr encoded 32\-bit integer
+.INDENT 0.0
+.INDENT 3.5
+The offset item provides the offset into the archive file where the bitcode
+member is stored that is associated with the symbol. The offset value is 0
+based at the start of the first "normal" file member. To derive the actual
+file offset of the member, you must add the number of bytes occupied by the file
+signature (8 bytes) and the symbol tables. The value of this item is encoded
+using variable bit rate encoding to reduce the size of the symbol table.
+Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
+if there are more bytes to follow. The remaining 7 bits in each byte carry bits
+from the value. The final byte does not have the high bit set.
+.UNINDENT
+.UNINDENT
+.sp
+length \- vbr encoded 32\-bit integer
+.INDENT 0.0
+.INDENT 3.5
+The length item provides the length of the symbol that follows. Like this
+\fIoffset\fP item, the length is variable bit rate encoded.
+.UNINDENT
+.UNINDENT
+.sp
+symbol \- character array
+.INDENT 0.0
+.INDENT 3.5
+The symbol item provides the text of the symbol that is associated with the
+\fIoffset\fP\&. The symbol is not terminated by any character. Its length is provided
+by the \fIlength\fP field. Note that is allowed (but unwise) to use non\-printing
+characters (even 0x00) in the symbol. This allows for multiple encodings of
+symbol names.
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-ar\fP succeeds, it will exit with 0. A usage error, results
+in an exit code of 1. A hard (file system typically) error results in an
+exit code of 2. Miscellaneous or unknown errors result in an
+exit code of 3.
+.SH SEE ALSO
+.sp
+ar(1)
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-as/Makefile b/usr.bin/clang/llvm-as/Makefile
new file mode 100644
index 0000000..964f6fa
--- /dev/null
+++ b/usr.bin/clang/llvm-as/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-as
+
+SRCDIR= tools/llvm-as
+SRCS= llvm-as.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmbitwriter \
+ llvmasmparser \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-as/Makefile.depend b/usr.bin/clang/llvm-as/Makefile.depend
new file mode 100644
index 0000000..a41464d
--- /dev/null
+++ b/usr.bin/clang/llvm-as/Makefile.depend
@@ -0,0 +1,27 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-as/llvm-as.1 b/usr.bin/clang/llvm-as/llvm-as.1
new file mode 100644
index 0000000..bd00ef0
--- /dev/null
+++ b/usr.bin/clang/llvm-as/llvm-as.1
@@ -0,0 +1,87 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-AS" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-as \- LLVM assembler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-as\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-as\fP is the LLVM assembler. It reads a file containing human\-readable
+LLVM assembly language, translates it to LLVM bitcode, and writes the result
+into a file or to standard output.
+.sp
+If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-as\fP reads its input from
+standard input.
+.sp
+If an output file is not specified with the \fB\-o\fP option, then
+\fBllvm\-as\fP sends its output to a file or standard output by following
+these rules:
+.INDENT 0.0
+.IP \(bu 2
+If the input is standard input, then the output is standard output.
+.IP \(bu 2
+If the input is a file that ends with \fB\&.ll\fP, then the output file is of the
+same name, except that the suffix is changed to \fB\&.bc\fP\&.
+.IP \(bu 2
+If the input is a file that does not end with the \fB\&.ll\fP suffix, then the
+output file has the same name as the input file, except that the \fB\&.bc\fP
+suffix is appended.
+.UNINDENT
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \fB\-f\fP
+Enable binary output on terminals. Normally, \fBllvm\-as\fP will refuse to
+write raw bitcode output if the output stream is a terminal. With this option,
+\fBllvm\-as\fP will write raw bitcode regardless of the output device.
+.TP
+.B \fB\-help\fP
+Print a summary of command line options.
+.TP
+.B \fB\-o\fP \fIfilename\fP
+Specify the output file name. If \fIfilename\fP is \fB\-\fP, then \fBllvm\-as\fP
+sends its output to standard output.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-as\fP succeeds, it will exit with 0. Otherwise, if an error occurs, it
+will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+llvm\-dis|llvm\-dis, gccas|gccas
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-bcanalyzer/Makefile b/usr.bin/clang/llvm-bcanalyzer/Makefile
new file mode 100644
index 0000000..f900fdc
--- /dev/null
+++ b/usr.bin/clang/llvm-bcanalyzer/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-bcanalyzer
+
+SRCDIR= tools/llvm-bcanalyzer
+SRCS= llvm-bcanalyzer.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-bcanalyzer/Makefile.depend b/usr.bin/clang/llvm-bcanalyzer/Makefile.depend
new file mode 100644
index 0000000..d5ac336
--- /dev/null
+++ b/usr.bin/clang/llvm-bcanalyzer/Makefile.depend
@@ -0,0 +1,26 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1
new file mode 100644
index 0000000..a88ab88
--- /dev/null
+++ b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1
@@ -0,0 +1,476 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-BCANALYZER" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-bcanalyzer \- LLVM bitcode analyzer
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-bcanalyzer\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-bcanalyzer\fP command is a small utility for analyzing bitcode
+files. The tool reads a bitcode file (such as generated with the
+\fBllvm\-as\fP tool) and produces a statistical report on the contents of
+the bitcode file. The tool can also dump a low level but human readable
+version of the bitcode file. This tool is probably not of much interest or
+utility except for those working directly with the bitcode file format. Most
+LLVM users can just ignore this tool.
+.sp
+If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-bcanalyzer\fP reads its
+input from standard input. This is useful for combining the tool into a
+pipeline. Output is written to the standard output.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-nodetails
+Causes \fBllvm\-bcanalyzer\fP to abbreviate its output by writing out only
+a module level summary. The details for individual functions are not
+displayed.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-dump
+Causes \fBllvm\-bcanalyzer\fP to dump the bitcode in a human readable
+format. This format is significantly different from LLVM assembly and
+provides details about the encoding of the bitcode file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-verify
+Causes \fBllvm\-bcanalyzer\fP to verify the module produced by reading the
+bitcode. This ensures that the statistics generated are based on a consistent
+module.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-bcanalyzer\fP succeeds, it will exit with 0. Otherwise, if an
+error occurs, it will exit with a non\-zero value, usually 1.
+.SH SUMMARY OUTPUT DEFINITIONS
+.sp
+The following items are always printed by llvm\-bcanalyzer. They comprize the
+summary output.
+.sp
+\fBBitcode Analysis Of Module\fP
+.INDENT 0.0
+.INDENT 3.5
+This just provides the name of the module for which bitcode analysis is being
+generated.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBitcode Version Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The bitcode version (not LLVM version) of the file read by the analyzer.
+.UNINDENT
+.UNINDENT
+.sp
+\fBFile Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of the entire bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBModule Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of the module block. Percentage is relative to File Size.
+.UNINDENT
+.UNINDENT
+.sp
+\fBFunction Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of all the function blocks. Percentage is relative to File
+Size.
+.UNINDENT
+.UNINDENT
+.sp
+\fBGlobal Types Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of the Global Types Pool. Percentage is relative to File
+Size. This is the size of the definitions of all types in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBConstant Pool Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
+Size.
+.UNINDENT
+.UNINDENT
+.sp
+\fBModule Globals Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+Ths size, in bytes, of the Global Variable Definitions and their initializers.
+Percentage is relative to File Size.
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstruction List Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of all the instruction lists in all the functions.
+Percentage is relative to File Size. Note that this value is also included in
+the Function Bytes.
+.UNINDENT
+.UNINDENT
+.sp
+\fBCompaction Table Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of all the compaction tables in all the functions.
+Percentage is relative to File Size. Note that this value is also included in
+the Function Bytes.
+.UNINDENT
+.UNINDENT
+.sp
+\fBSymbol Table Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of all the symbol tables in all the functions. Percentage is
+relative to File Size. Note that this value is also included in the Function
+Bytes.
+.UNINDENT
+.UNINDENT
+.sp
+\fBDependent Libraries Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The size, in bytes, of the list of dependent libraries in the module. Percentage
+is relative to File Size. Note that this value is also included in the Module
+Global Bytes.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Bitcode Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of blocks of any kind in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Functions\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of function definitions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Types\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of types defined in the Global Types Pool.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Constants\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of constants (of any type) defined in the Constant Pool.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Basic Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of basic blocks defined in all functions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of instructions defined in all functions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Long Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of long instructions defined in all functions in the bitcode
+file. Long instructions are those taking greater than 4 bytes. Typically long
+instructions are GetElementPtr with several indices, PHI nodes, and calls to
+functions with large numbers of arguments.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Operands\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of operands used in all instructions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Compaction Tables\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of compaction tables in all functions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Symbol Tables\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of symbol tables in all functions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Dependent Libs\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of dependent libraries found in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBTotal Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The total size of the instructions in all functions in the bitcode file.
+.UNINDENT
+.UNINDENT
+.sp
+\fBAverage Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The average number of bytes per instruction across all functions in the bitcode
+file. This value is computed by dividing Total Instruction Size by Number Of
+Instructions.
+.UNINDENT
+.UNINDENT
+.sp
+\fBMaximum Type Slot Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The maximum value used for a type\(aqs slot number. Larger slot number values take
+more bytes to encode.
+.UNINDENT
+.UNINDENT
+.sp
+\fBMaximum Value Slot Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The maximum value used for a value\(aqs slot number. Larger slot number values take
+more bytes to encode.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Value\fP
+.INDENT 0.0
+.INDENT 3.5
+The average size of a Value definition (of any type). This is computed by
+dividing File Size by the total number of values of any type.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Global\fP
+.INDENT 0.0
+.INDENT 3.5
+The average size of a global definition (constants and global variables).
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Function\fP
+.INDENT 0.0
+.INDENT 3.5
+The average number of bytes per function definition. This is computed by
+dividing Function Bytes by Number Of Functions.
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR 32\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of 32\-bit integers encoded using the Variable Bit Rate
+encoding scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR 64\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of 64\-bit integers encoded using the Variable Bit Rate encoding
+scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR Compressed Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes consumed by the 32\-bit and 64\-bit integers that use
+the Variable Bit Rate encoding scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR Expanded Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes that would have been consumed by the 32\-bit and 64\-bit
+integers had they not been compressed with the Variable Bit Rage encoding
+scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Saved With VBR\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes saved by using the Variable Bit Rate encoding scheme.
+The percentage is relative to # of VBR Expanded Bytes.
+.UNINDENT
+.UNINDENT
+.SH DETAILED OUTPUT DEFINITIONS
+.sp
+The following definitions occur only if the \-nodetails option was not given.
+The detailed output provides additional information on a per\-function basis.
+.sp
+\fBType\fP
+.INDENT 0.0
+.INDENT 3.5
+The type signature of the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBByte Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in the function\(aqs block.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBasic Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
+The number of basic blocks defined by the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstructions\fP
+.INDENT 0.0
+.INDENT 3.5
+The number of instructions defined by the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBLong Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
+The number of instructions using the long instruction format in the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBOperands\fP
+.INDENT 0.0
+.INDENT 3.5
+The number of operands used by all instructions in the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The number of bytes consumed by instructions in the function.
+.UNINDENT
+.UNINDENT
+.sp
+\fBAverage Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The average number of bytes consumed by the instructions in the function.
+This value is computed by dividing Instruction Size by Instructions.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Instruction\fP
+.INDENT 0.0
+.INDENT 3.5
+The average number of bytes used by the function per instruction. This value
+is computed by dividing Byte Size by Instructions. Note that this is not the
+same as Average Instruction Size. It computes a number relative to the total
+function size not just the size of the instruction list.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR 32\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of 32\-bit integers found in this function (for any use).
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR 64\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of 64\-bit integers found in this function (for any use).
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR Compressed Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in this function consumed by the 32\-bit and 64\-bit
+integers that use the Variable Bit Rate encoding scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR Expanded Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in this function that would have been consumed by
+the 32\-bit and 64\-bit integers had they not been compressed with the Variable
+Bit Rate encoding scheme.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Saved With VBR\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes saved in this function by using the Variable Bit
+Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
+.UNINDENT
+.UNINDENT
+.SH SEE ALSO
+.sp
+\fB/CommandGuide/llvm\-dis\fP, \fB/BitCodeFormat\fP
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-cov/Makefile b/usr.bin/clang/llvm-cov/Makefile
new file mode 100644
index 0000000..cca4754
--- /dev/null
+++ b/usr.bin/clang/llvm-cov/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-cov
+
+SRCDIR= tools/llvm-cov
+SRCS= CodeCoverage.cpp \
+ CoverageFilters.cpp \
+ CoverageReport.cpp \
+ CoverageSummaryInfo.cpp \
+ SourceCoverageView.cpp \
+ TestingSupport.cpp \
+ gcov.cpp \
+ llvm-cov.cpp
+
+LIBDEPS=llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-cov/Makefile.depend b/usr.bin/clang/llvm-cov/Makefile.depend
new file mode 100644
index 0000000..652277f
--- /dev/null
+++ b/usr.bin/clang/llvm-cov/Makefile.depend
@@ -0,0 +1,30 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-cov/llvm-cov.1 b/usr.bin/clang/llvm-cov/llvm-cov.1
new file mode 100644
index 0000000..07c4000
--- /dev/null
+++ b/usr.bin/clang/llvm-cov/llvm-cov.1
@@ -0,0 +1,319 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-COV" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-cov \- emit coverage information
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-cov\fP \fIcommand\fP [\fIargs...\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-cov\fP tool shows code coverage information for
+programs that are instrumented to emit profile data. It can be used to
+work with \fBgcov\fP\-style coverage or with \fBclang\fP\(aqs instrumentation
+based profiling.
+.sp
+If the program is invoked with a base name of \fBgcov\fP, it will behave as if
+the \fBllvm\-cov gcov\fP command were called. Otherwise, a command should
+be provided.
+.SH COMMANDS
+.INDENT 0.0
+.IP \(bu 2
+\fI\%gcov\fP
+.IP \(bu 2
+\fI\%show\fP
+.IP \(bu 2
+\fI\%report\fP
+.UNINDENT
+.SH GCOV COMMAND
+.SS SYNOPSIS
+.sp
+\fBllvm\-cov gcov\fP [\fIoptions\fP] \fISOURCEFILE\fP
+.SS DESCRIPTION
+.sp
+The \fBllvm\-cov gcov\fP tool reads code coverage data files and displays
+the coverage information for a specified source file. It is compatible with the
+\fBgcov\fP tool from version 4.2 of \fBGCC\fP and may also be compatible with some
+later versions of \fBgcov\fP\&.
+.sp
+To use \fBllvm\-cov gcov\fP, you must first build an instrumented version
+of your application that collects coverage data as it runs. Compile with the
+\fB\-fprofile\-arcs\fP and \fB\-ftest\-coverage\fP options to add the
+instrumentation. (Alternatively, you can use the \fB\-\-coverage\fP option, which
+includes both of those other options.) You should compile with debugging
+information (\fB\-g\fP) and without optimization (\fB\-O0\fP); otherwise, the
+coverage data cannot be accurately mapped back to the source code.
+.sp
+At the time you compile the instrumented code, a \fB\&.gcno\fP data file will be
+generated for each object file. These \fB\&.gcno\fP files contain half of the
+coverage data. The other half of the data comes from \fB\&.gcda\fP files that are
+generated when you run the instrumented program, with a separate \fB\&.gcda\fP
+file for each object file. Each time you run the program, the execution counts
+are summed into any existing \fB\&.gcda\fP files, so be sure to remove any old
+files if you do not want their contents to be included.
+.sp
+By default, the \fB\&.gcda\fP files are written into the same directory as the
+object files, but you can override that by setting the \fBGCOV_PREFIX\fP and
+\fBGCOV_PREFIX_STRIP\fP environment variables. The \fBGCOV_PREFIX_STRIP\fP
+variable specifies a number of directory components to be removed from the
+start of the absolute path to the object file directory. After stripping those
+directories, the prefix from the \fBGCOV_PREFIX\fP variable is added. These
+environment variables allow you to run the instrumented program on a machine
+where the original object file directories are not accessible, but you will
+then need to copy the \fB\&.gcda\fP files back to the object file directories
+where \fBllvm\-cov gcov\fP expects to find them.
+.sp
+Once you have generated the coverage data files, run \fBllvm\-cov gcov\fP
+for each main source file where you want to examine the coverage results. This
+should be run from the same directory where you previously ran the
+compiler. The results for the specified source file are written to a file named
+by appending a \fB\&.gcov\fP suffix. A separate output file is also created for
+each file included by the main source file, also with a \fB\&.gcov\fP suffix added.
+.sp
+The basic content of an \fB\&.gcov\fP output file is a copy of the source file with
+an execution count and line number prepended to every line. The execution
+count is shown as \fB\-\fP if a line does not contain any executable code. If
+a line contains code but that code was never executed, the count is displayed
+as \fB#####\fP\&.
+.SS OPTIONS
+.INDENT 0.0
+.TP
+.B \-a, \-\-all\-blocks
+Display all basic blocks. If there are multiple blocks for a single line of
+source code, this option causes llvm\-cov to show the count for each block
+instead of just one count for the entire line.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-b, \-\-branch\-probabilities
+Display conditional branch probabilities and a summary of branch information.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-c, \-\-branch\-counts
+Display branch counts instead of probabilities (requires \-b).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-f, \-\-function\-summaries
+Show a summary of coverage for each function instead of just one summary for
+an entire source file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-help
+Display available options (\-\-help\-hidden for more).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-l, \-\-long\-file\-names
+For coverage output of files included from the main source file, add the
+main file name followed by \fB##\fP as a prefix to the output file names. This
+can be combined with the \-\-preserve\-paths option to use complete paths for
+both the main file and the included file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-n, \-\-no\-output
+Do not output any \fB\&.gcov\fP files. Summary information is still
+displayed.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-o=<DIR|FILE>, \-\-object\-directory=<DIR>, \-\-object\-file=<FILE>
+Find objects in DIR or based on FILE\(aqs path. If you specify a particular
+object file, the coverage data files are expected to have the same base name
+with \fB\&.gcno\fP and \fB\&.gcda\fP extensions. If you specify a directory, the
+files are expected in that directory with the same base name as the source
+file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-p, \-\-preserve\-paths
+Preserve path components when naming the coverage output files. In addition
+to the source file name, include the directories from the path to that
+file. The directories are separate by \fB#\fP characters, with \fB\&.\fP directories
+removed and \fB\&..\fP directories replaced by \fB^\fP characters. When used with
+the \-\-long\-file\-names option, this applies to both the main file name and the
+included file name.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-u, \-\-unconditional\-branches
+Include unconditional branches in the output for the \-\-branch\-probabilities
+option.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-version
+Display the version of llvm\-cov.
+.UNINDENT
+.SS EXIT STATUS
+.sp
+\fBllvm\-cov gcov\fP returns 1 if it cannot read input files. Otherwise,
+it exits with zero.
+.SH SHOW COMMAND
+.SS SYNOPSIS
+.sp
+\fBllvm\-cov show\fP [\fIoptions\fP] \-instr\-profile \fIPROFILE\fP \fIBIN\fP [\fISOURCES\fP]
+.SS DESCRIPTION
+.sp
+The \fBllvm\-cov show\fP command shows line by line coverage of a binary
+\fIBIN\fP using the profile data \fIPROFILE\fP\&. It can optionally be filtered to only
+show the coverage for the files listed in \fISOURCES\fP\&.
+.sp
+To use \fBllvm\-cov show\fP, you need a program that is compiled with
+instrumentation to emit profile and coverage data. To build such a program with
+\fBclang\fP use the \fB\-fprofile\-instr\-generate\fP and \fB\-fcoverage\-mapping\fP
+flags. If linking with the \fBclang\fP driver, pass \fB\-fprofile\-instr\-generate\fP
+to the link stage to make sure the necessary runtime libraries are linked in.
+.sp
+The coverage information is stored in the built executable or library itself,
+and this is what you should pass to \fBllvm\-cov show\fP as the \fIBIN\fP
+argument. The profile data is generated by running this instrumented program
+normally. When the program exits it will write out a raw profile file,
+typically called \fBdefault.profraw\fP, which can be converted to a format that
+is suitable for the \fIPROFILE\fP argument using the \fBllvm\-profdata merge\fP
+tool.
+.SS OPTIONS
+.INDENT 0.0
+.TP
+.B \-show\-line\-counts
+Show the execution counts for each line. This is enabled by default, unless
+another \fB\-show\fP option is used.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-show\-expansions
+Expand inclusions, such as preprocessor macros or textual inclusions, inline
+in the display of the source file.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-show\-instantiations
+For source regions that are instantiated multiple times, such as templates in
+\fBC++\fP, show each instantiation separately as well as the combined summary.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-show\-regions
+Show the execution counts for each region by displaying a caret that points to
+the character where the region starts.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-show\-line\-counts\-or\-regions
+Show the execution counts for each line if there is only one region on the
+line, but show the individual regions if there are multiple on the line.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-use\-color[=VALUE]
+Enable or disable color output. By default this is autodetected.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-arch=<name>
+If the covered binary is a universal binary, select the architecture to use.
+It is an error to specify an architecture that is not included in the
+universal binary or to use an architecture that does not match a
+non\-universal binary.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-name=<NAME>
+Show code coverage only for functions with the given name.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-name\-regex=<PATTERN>
+Show code coverage only for functions that match the given regular expression.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-line\-coverage\-gt=<N>
+Show code coverage only for functions with line coverage greater than the
+given threshold.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-line\-coverage\-lt=<N>
+Show code coverage only for functions with line coverage less than the given
+threshold.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-region\-coverage\-gt=<N>
+Show code coverage only for functions with region coverage greater than the
+given threshold.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-region\-coverage\-lt=<N>
+Show code coverage only for functions with region coverage less than the given
+threshold.
+.UNINDENT
+.SH REPORT COMMAND
+.SS SYNOPSIS
+.sp
+\fBllvm\-cov report\fP [\fIoptions\fP] \-instr\-profile \fIPROFILE\fP \fIBIN\fP [\fISOURCES\fP]
+.SS DESCRIPTION
+.sp
+The \fBllvm\-cov report\fP command displays a summary of the coverage of a
+binary \fIBIN\fP using the profile data \fIPROFILE\fP\&. It can optionally be filtered to
+only show the coverage for the files listed in \fISOURCES\fP\&.
+.sp
+If no source files are provided, a summary line is printed for each file in the
+coverage data. If any files are provided, summaries are shown for each function
+in the listed files instead.
+.sp
+For information on compiling programs for coverage and generating profile data,
+see \fI\%SHOW COMMAND\fP\&.
+.SS OPTIONS
+.INDENT 0.0
+.TP
+.B \-use\-color[=VALUE]
+Enable or disable color output. By default this is autodetected.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-arch=<name>
+If the covered binary is a universal binary, select the architecture to use.
+It is an error to specify an architecture that is not included in the
+universal binary or to use an architecture that does not match a
+non\-universal binary.
+.UNINDENT
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-cxxdump/Makefile b/usr.bin/clang/llvm-cxxdump/Makefile
new file mode 100644
index 0000000..33a08a9
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxdump/Makefile
@@ -0,0 +1,71 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-cxxdump
+
+SRCDIR= tools/llvm-cxxdump
+SRCS= Error.cpp \
+ llvm-cxxdump.cpp
+
+LIBDEPS=llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmx86utils \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-cxxdump/Makefile.depend b/usr.bin/clang/llvm-cxxdump/Makefile.depend
new file mode 100644
index 0000000..e1873fe
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxdump/Makefile.depend
@@ -0,0 +1,79 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-diff/Makefile b/usr.bin/clang/llvm-diff/Makefile
new file mode 100644
index 0000000..0891d47
--- /dev/null
+++ b/usr.bin/clang/llvm-diff/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-diff
+
+SRCDIR= tools/llvm-diff
+SRCS= llvm-diff.cpp \
+ DiffConsumer.cpp \
+ DiffLog.cpp \
+ DifferenceEngine.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmirreader \
+ llvmbitreader \
+ llvmasmparser \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-diff/Makefile.depend b/usr.bin/clang/llvm-diff/Makefile.depend
new file mode 100644
index 0000000..0406d2f
--- /dev/null
+++ b/usr.bin/clang/llvm-diff/Makefile.depend
@@ -0,0 +1,28 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-diff/llvm-diff.1 b/usr.bin/clang/llvm-diff/llvm-diff.1
new file mode 100644
index 0000000..9ec9940
--- /dev/null
+++ b/usr.bin/clang/llvm-diff/llvm-diff.1
@@ -0,0 +1,77 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-DIFF" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-diff \- LLVM structural 'diff'
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-diff\fP [\fIoptions\fP] \fImodule 1\fP \fImodule 2\fP [\fIglobal name ...\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-diff\fP compares the structure of two LLVM modules, primarily
+focusing on differences in function definitions. Insignificant
+differences, such as changes in the ordering of globals or in the
+names of local values, are ignored.
+.sp
+An input module will be interpreted as an assembly file if its name
+ends in \(aq.ll\(aq; otherwise it will be read in as a bitcode file.
+.sp
+If a list of global names is given, just the values with those names
+are compared; otherwise, all global values are compared, and
+diagnostics are produced for globals which only appear in one module
+or the other.
+.sp
+\fBllvm\-diff\fP compares two functions by comparing their basic blocks,
+beginning with the entry blocks. If the terminators seem to match,
+then the corresponding successors are compared; otherwise they are
+ignored. This algorithm is very sensitive to changes in control flow,
+which tend to stop any downstream changes from being detected.
+.sp
+\fBllvm\-diff\fP is intended as a debugging tool for writers of LLVM
+passes and frontends. It does not have a stable output format.
+.SH EXIT STATUS
+.sp
+If \fBllvm\-diff\fP finds no differences between the modules, it will exit
+with 0 and produce no output. Otherwise it will exit with a non\-zero
+value.
+.SH BUGS
+.sp
+Many important differences, like changes in linkage or function
+attributes, are not diagnosed.
+.sp
+Changes in memory behavior (for example, coalescing loads) can cause
+massive detected differences in blocks.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-dis/Makefile b/usr.bin/clang/llvm-dis/Makefile
new file mode 100644
index 0000000..0fb8884
--- /dev/null
+++ b/usr.bin/clang/llvm-dis/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-dis
+
+SRCDIR= tools/llvm-dis
+SRCS= llvm-dis.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmanalysis \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-dis/Makefile.depend b/usr.bin/clang/llvm-dis/Makefile.depend
new file mode 100644
index 0000000..bf56a27
--- /dev/null
+++ b/usr.bin/clang/llvm-dis/Makefile.depend
@@ -0,0 +1,27 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-dis/llvm-dis.1 b/usr.bin/clang/llvm-dis/llvm-dis.1
new file mode 100644
index 0000000..2a9566e
--- /dev/null
+++ b/usr.bin/clang/llvm-dis/llvm-dis.1
@@ -0,0 +1,88 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-DIS" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-dis \- LLVM disassembler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-dis\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-dis\fP command is the LLVM disassembler. It takes an LLVM
+bitcode file and converts it into human\-readable LLVM assembly language.
+.sp
+If filename is omitted or specified as \fB\-\fP, \fBllvm\-dis\fP reads its
+input from standard input.
+.sp
+If the input is being read from standard input, then \fBllvm\-dis\fP
+will send its output to standard output by default. Otherwise, the
+output will be written to a file named after the input file, with
+a \fB\&.ll\fP suffix added (any existing \fB\&.bc\fP suffix will first be
+removed). You can override the choice of output file using the
+\fB\-o\fP option.
+.SH OPTIONS
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBllvm\-dis\fP will refuse to
+write raw bitcode output if the output stream is a terminal. With this option,
+\fBllvm\-dis\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
+Print a summary of command line options.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output file name. If \fIfilename\fP is \-, then the output is sent
+to standard output.
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-dis\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+llvm\-as|llvm\-as
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-dwarfdump/Makefile b/usr.bin/clang/llvm-dwarfdump/Makefile
new file mode 100644
index 0000000..32f3afa
--- /dev/null
+++ b/usr.bin/clang/llvm-dwarfdump/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-dwarfdump
+
+SRCDIR= tools/llvm-dwarfdump
+SRCS= llvm-dwarfdump.cpp
+
+LIBDEPS=llvmdebuginfodwarf \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-dwarfdump/Makefile.depend b/usr.bin/clang/llvm-dwarfdump/Makefile.depend
new file mode 100644
index 0000000..0f051781
--- /dev/null
+++ b/usr.bin/clang/llvm-dwarfdump/Makefile.depend
@@ -0,0 +1,30 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmdebuginfodwarf \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1 b/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1
new file mode 100644
index 0000000..8e559a2
--- /dev/null
+++ b/usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1
@@ -0,0 +1,60 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-DWARFDUMP" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-dwarfdump \- print contents of DWARF sections
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-dwarfdump\fP [\fIoptions\fP] [\fIfilenames...\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-dwarfdump\fP parses DWARF sections in the object files
+and prints their contents in human\-readable form.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-debug\-dump=section
+Specify the DWARF section to dump.
+For example, use \fBabbrev\fP to dump the contents of \fB\&.debug_abbrev\fP section,
+\fBloc.dwo\fP to dump the contents of \fB\&.debug_loc.dwo\fP etc.
+See \fBllvm\-dwarfdump \-\-help\fP for the complete list of supported sections.
+Use \fBall\fP to dump all DWARF sections. It is the default.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-dwarfdump\fP returns 0 if the input files were parsed and dumped
+successfully. Otherwise, it returns 1.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-extract/Makefile b/usr.bin/clang/llvm-extract/Makefile
new file mode 100644
index 0000000..92d69c3
--- /dev/null
+++ b/usr.bin/clang/llvm-extract/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-extract
+
+SRCDIR= tools/llvm-extract
+SRCS= llvm-extract.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmbitwriter \
+ llvmipo \
+ llvmvectorize \
+ llvmscalaropts \
+ llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmlinker \
+ llvmirreader \
+ llvmbitreader \
+ llvmasmparser \
+ llvminstcombine \
+ llvmtransformutils \
+ llvmanalysis \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-extract/Makefile.depend b/usr.bin/clang/llvm-extract/Makefile.depend
new file mode 100644
index 0000000..35cf93b
--- /dev/null
+++ b/usr.bin/clang/llvm-extract/Makefile.depend
@@ -0,0 +1,40 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-extract/llvm-extract.1 b/usr.bin/clang/llvm-extract/llvm-extract.1
new file mode 100644
index 0000000..b69439c
--- /dev/null
+++ b/usr.bin/clang/llvm-extract/llvm-extract.1
@@ -0,0 +1,129 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-EXTRACT" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-extract \- extract a function from an LLVM module
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-extract\fP [\fIoptions\fP] \fB\-\-func\fP \fIfunction\-name\fP [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-extract\fP command takes the name of a function and extracts
+it from the specified LLVM bitcode file. It is primarily used as a debugging
+tool to reduce test cases from larger programs that are triggering a bug.
+.sp
+In addition to extracting the bitcode of the specified function,
+\fBllvm\-extract\fP will also remove unreachable global variables,
+prototypes, and unused types.
+.sp
+The \fBllvm\-extract\fP command reads its input from standard input if
+filename is omitted or if filename is \fB\-\fP\&. The output is always written to
+standard output, unless the \fB\-o\fP option is specified (see below).
+.SH OPTIONS
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBllvm\-extract\fP will
+refuse to write raw bitcode output if the output stream is a terminal. With
+this option, \fBllvm\-extract\fP will write raw bitcode regardless of the
+output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-func\fP \fIfunction\-name\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the function named \fIfunction\-name\fP from the LLVM bitcode. May be
+specified multiple times to extract multiple functions at once.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-rfunc\fP \fIfunction\-regular\-expr\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the function(s) matching \fIfunction\-regular\-expr\fP from the LLVM bitcode.
+All functions matching the regular expression will be extracted. May be
+specified multiple times.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-glob\fP \fIglobal\-name\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the global variable named \fIglobal\-name\fP from the LLVM bitcode. May be
+specified multiple times to extract multiple global variables at once.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-rglob\fP \fIglob\-regular\-expr\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the global variable(s) matching \fIglobal\-regular\-expr\fP from the LLVM
+bitcode. All global variables matching the regular expression will be
+extracted. May be specified multiple times.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
+Print a summary of command line options.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output filename. If filename is "\-" (the default), then
+\fBllvm\-extract\fP sends its output to standard output.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-S\fP
+.INDENT 0.0
+.INDENT 3.5
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-extract\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+bugpoint
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-link/Makefile b/usr.bin/clang/llvm-link/Makefile
new file mode 100644
index 0000000..d556f9a
--- /dev/null
+++ b/usr.bin/clang/llvm-link/Makefile
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-link
+
+SRCDIR= tools/llvm-link
+SRCS= llvm-link.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmirreader \
+ llvmasmparser \
+ llvmbitwriter \
+ llvmbitreader \
+ llvmlinker \
+ llvmtransformutils \
+ llvmanalysis \
+ llvmcore \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-link/Makefile.depend b/usr.bin/clang/llvm-link/Makefile.depend
new file mode 100644
index 0000000..0195115
--- /dev/null
+++ b/usr.bin/clang/llvm-link/Makefile.depend
@@ -0,0 +1,35 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtransformutils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-link/llvm-link.1 b/usr.bin/clang/llvm-link/llvm-link.1
new file mode 100644
index 0000000..91ed377
--- /dev/null
+++ b/usr.bin/clang/llvm-link/llvm-link.1
@@ -0,0 +1,89 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-LINK" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-link \- LLVM bitcode linker
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-link\fP [\fIoptions\fP] \fIfilename ...\fP
+.SH DESCRIPTION
+.sp
+\fBllvm\-link\fP takes several LLVM bitcode files and links them together
+into a single LLVM bitcode file. It writes the output file to standard output,
+unless the \fB\-o\fP option is used to specify a filename.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-f
+Enable binary output on terminals. Normally, \fBllvm\-link\fP will refuse
+to write raw bitcode output if the output stream is a terminal. With this
+option, \fBllvm\-link\fP will write raw bitcode regardless of the output
+device.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-o filename
+Specify the output file name. If \fBfilename\fP is "\fB\-\fP", then
+\fBllvm\-link\fP will write its output to standard output.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-S
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-d
+If specified, \fBllvm\-link\fP prints a human\-readable version of the
+output bitcode file to standard error.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-v
+Verbose mode. Print information about what \fBllvm\-link\fP is doing.
+This typically includes a message for each bitcode file linked in and for each
+library found.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-link\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-lto/Makefile b/usr.bin/clang/llvm-lto/Makefile
new file mode 100644
index 0000000..3e0dc83
--- /dev/null
+++ b/usr.bin/clang/llvm-lto/Makefile
@@ -0,0 +1,80 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-lto
+
+SRCDIR= tools/llvm-lto
+SRCS= llvm-lto.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmx86desc \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmx86utils \
+ llvmmcdisassembler \
+ llvmlto \
+ llvmobjcarcopts \
+ llvmipo \
+ llvmvectorize \
+ llvmlinker \
+ llvmirreader \
+ llvmasmparser \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmtransformutils \
+ llvmmc \
+ llvmbitwriter \
+ llvmbitreader \
+ llvmanalysis \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-lto/Makefile.depend b/usr.bin/clang/llvm-lto/Makefile.depend
new file mode 100644
index 0000000..6915918
--- /dev/null
+++ b/usr.bin/clang/llvm-lto/Makefile.depend
@@ -0,0 +1,87 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmlto \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobjcarcopts \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-mc/Makefile b/usr.bin/clang/llvm-mc/Makefile
new file mode 100644
index 0000000..b19ea90
--- /dev/null
+++ b/usr.bin/clang/llvm-mc/Makefile
@@ -0,0 +1,71 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-mc
+
+SRCDIR= tools/llvm-mc
+SRCS= Disassembler.cpp \
+ llvm-mc.cpp
+
+LIBDEPS=llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-mc/Makefile.depend b/usr.bin/clang/llvm-mc/Makefile.depend
new file mode 100644
index 0000000..e1873fe
--- /dev/null
+++ b/usr.bin/clang/llvm-mc/Makefile.depend
@@ -0,0 +1,79 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-nm/Makefile b/usr.bin/clang/llvm-nm/Makefile
new file mode 100644
index 0000000..7eb9d9f
--- /dev/null
+++ b/usr.bin/clang/llvm-nm/Makefile
@@ -0,0 +1,71 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-nm
+
+SRCDIR= tools/llvm-nm
+SRCS= llvm-nm.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-nm/Makefile.depend b/usr.bin/clang/llvm-nm/Makefile.depend
new file mode 100644
index 0000000..df4b7a2
--- /dev/null
+++ b/usr.bin/clang/llvm-nm/Makefile.depend
@@ -0,0 +1,80 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-nm/llvm-nm.1 b/usr.bin/clang/llvm-nm/llvm-nm.1
new file mode 100644
index 0000000..7454a15
--- /dev/null
+++ b/usr.bin/clang/llvm-nm/llvm-nm.1
@@ -0,0 +1,213 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-NM" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-nm \- list LLVM bitcode and object file's symbol table
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-nm\fP [\fIoptions\fP] [\fIfilenames...\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-nm\fP utility lists the names of symbols from the LLVM bitcode
+files, object files, or \fBar\fP archives containing them, named on the
+command line. Each symbol is listed along with some simple information about
+its provenance. If no file name is specified, or \fI\-\fP is used as a file name,
+\fBllvm\-nm\fP will process a file on its standard input stream.
+.sp
+\fBllvm\-nm\fP\(aqs default output format is the traditional BSD \fBnm\fP
+output format. Each such output record consists of an (optional) 8\-digit
+hexadecimal address, followed by a type code character, followed by a name, for
+each symbol. One record is printed per line; fields are separated by spaces.
+When the address is omitted, it is replaced by 8 spaces.
+.sp
+Type code characters currently supported, and their meanings, are as follows:
+.sp
+U
+.INDENT 0.0
+.INDENT 3.5
+Named object is referenced but undefined in this bitcode file
+.UNINDENT
+.UNINDENT
+.sp
+C
+.INDENT 0.0
+.INDENT 3.5
+Common (multiple definitions link together into one def)
+.UNINDENT
+.UNINDENT
+.sp
+W
+.INDENT 0.0
+.INDENT 3.5
+Weak reference (multiple definitions link together into zero or one definitions)
+.UNINDENT
+.UNINDENT
+.sp
+t
+.INDENT 0.0
+.INDENT 3.5
+Local function (text) object
+.UNINDENT
+.UNINDENT
+.sp
+T
+.INDENT 0.0
+.INDENT 3.5
+Global function (text) object
+.UNINDENT
+.UNINDENT
+.sp
+d
+.INDENT 0.0
+.INDENT 3.5
+Local data object
+.UNINDENT
+.UNINDENT
+.sp
+D
+.INDENT 0.0
+.INDENT 3.5
+Global data object
+.UNINDENT
+.UNINDENT
+.sp
+?
+.INDENT 0.0
+.INDENT 3.5
+Something unrecognizable
+.UNINDENT
+.UNINDENT
+.sp
+Because LLVM bitcode files typically contain objects that are not considered to
+have addresses until they are linked into an executable image or dynamically
+compiled "just\-in\-time", \fBllvm\-nm\fP does not print an address for any
+symbol in an LLVM bitcode file, even symbols which are defined in the bitcode
+file.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-B (default)
+Use BSD output format. Alias for \fB\-\-format=bsd\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-P
+Use POSIX.2 output format. Alias for \fB\-\-format=posix\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-debug\-syms, \-a
+Show all symbols, even debugger only.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-defined\-only
+Print only symbols defined in this file (as opposed to
+symbols which may be referenced by objects in this file, but not
+defined in this file.)
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-dynamic, \-D
+Display dynamic symbols instead of normal symbols.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-extern\-only, \-g
+Print only symbols whose definitions are external; that is, accessible
+from other files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-format=format, \-f format
+Select an output format; \fIformat\fP may be \fIsysv\fP, \fIposix\fP, or \fIbsd\fP\&. The default
+is \fIbsd\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command\-line options and their meanings.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-no\-sort, \-p
+Shows symbols in order encountered.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-numeric\-sort, \-n, \-v
+Sort symbols by address.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-print\-file\-name, \-A, \-o
+Precede each symbol with the file it came from.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-print\-size, \-S
+Show symbol size instead of address.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-size\-sort
+Sort symbols by size.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-undefined\-only, \-u
+Print only symbols referenced but not defined in this file.
+.UNINDENT
+.SH BUGS
+.INDENT 0.0
+.INDENT 3.5
+.INDENT 0.0
+.IP \(bu 2
+\fBllvm\-nm\fP cannot demangle C++ mangled names, like GNU \fBnm\fP
+can.
+.IP \(bu 2
+\fBllvm\-nm\fP does not support the full set of arguments that GNU
+\fBnm\fP does.
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-nm\fP exits with an exit code of zero.
+.SH SEE ALSO
+.sp
+llvm\-dis, ar(1), nm(1)
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-objdump/Makefile b/usr.bin/clang/llvm-objdump/Makefile
new file mode 100644
index 0000000..dcbf1f9
--- /dev/null
+++ b/usr.bin/clang/llvm-objdump/Makefile
@@ -0,0 +1,74 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-objdump
+
+SRCDIR= tools/llvm-objdump
+SRCS= llvm-objdump.cpp \
+ COFFDump.cpp \
+ ELFDump.cpp \
+ MachODump.cpp
+
+LIBDEPS=llvmdebuginfodwarf \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-objdump/Makefile.depend b/usr.bin/clang/llvm-objdump/Makefile.depend
new file mode 100644
index 0000000..40d8758
--- /dev/null
+++ b/usr.bin/clang/llvm-objdump/Makefile.depend
@@ -0,0 +1,80 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmdebuginfodwarf \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-pdbdump/Makefile b/usr.bin/clang/llvm-pdbdump/Makefile
new file mode 100644
index 0000000..72d6214
--- /dev/null
+++ b/usr.bin/clang/llvm-pdbdump/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-pdbdump
+
+SRCDIR= tools/llvm-pdbdump
+SRCS= BuiltinDumper.cpp \
+ ClassDefinitionDumper.cpp \
+ CompilandDumper.cpp \
+ EnumDumper.cpp \
+ ExternalSymbolDumper.cpp \
+ FunctionDumper.cpp \
+ LinePrinter.cpp \
+ TypeDumper.cpp \
+ TypedefDumper.cpp \
+ VariableDumper.cpp \
+ llvm-pdbdump.cpp
+
+LIBDEPS=llvmdebuginfopdb \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-pdbdump/Makefile.depend b/usr.bin/clang/llvm-pdbdump/Makefile.depend
new file mode 100644
index 0000000..99720d3
--- /dev/null
+++ b/usr.bin/clang/llvm-pdbdump/Makefile.depend
@@ -0,0 +1,30 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmdebuginfopdb \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-profdata/Makefile b/usr.bin/clang/llvm-profdata/Makefile
new file mode 100644
index 0000000..95fc7e5
--- /dev/null
+++ b/usr.bin/clang/llvm-profdata/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-profdata
+
+SRCDIR= tools/llvm-profdata
+SRCS= llvm-profdata.cpp
+
+TGHDRS= Attributes
+
+LIBDEPS=llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-profdata/Makefile.depend b/usr.bin/clang/llvm-profdata/Makefile.depend
new file mode 100644
index 0000000..42a42b2
--- /dev/null
+++ b/usr.bin/clang/llvm-profdata/Makefile.depend
@@ -0,0 +1,31 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmsupport \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-profdata/llvm-profdata.1 b/usr.bin/clang/llvm-profdata/llvm-profdata.1
new file mode 100644
index 0000000..18c26fc
--- /dev/null
+++ b/usr.bin/clang/llvm-profdata/llvm-profdata.1
@@ -0,0 +1,223 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-PROFDATA" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-profdata \- Profile data tool
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-profdata\fP \fIcommand\fP [\fIargs...\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-profdata\fP tool is a small utility for working with profile
+data files.
+.SH COMMANDS
+.INDENT 0.0
+.IP \(bu 2
+\fI\%merge\fP
+.IP \(bu 2
+\fI\%show\fP
+.UNINDENT
+.SH MERGE
+.SS SYNOPSIS
+.sp
+\fBllvm\-profdata merge\fP [\fIoptions\fP] [\fIfilename...\fP]
+.SS DESCRIPTION
+.sp
+\fBllvm\-profdata merge\fP takes several profile data files
+generated by PGO instrumentation and merges them together into a single
+indexed profile data file.
+.sp
+By default profile data is merged without modification. This means that the
+relative importance of each input file is proportional to the number of samples
+or counts it contains. In general, the input from a longer training run will be
+interpreted as relatively more important than a shorter run. Depending on the
+nature of the training runs it may be useful to adjust the weight given to each
+input file by using the \fB\-weighted\-input\fP option.
+.SS OPTIONS
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-output=output, \-o=output
+Specify the output file name. \fIOutput\fP cannot be \fB\-\fP as the resulting
+indexed profile data can\(aqt be written to standard output.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-weighted\-input=weight,filename
+Specify an input file name along with a weight. The profile counts of the input
+file will be scaled (multiplied) by the supplied \fBweight\fP, where where \fBweight\fP
+is a decimal integer >= 1. Input files specified without using this option are
+assigned a default weight of 1. Examples are shown below.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-instr (default)
+Specify that the input profile is an instrumentation\-based profile.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-sample
+Specify that the input profile is a sample\-based profile.
+.sp
+The format of the generated file can be generated in one of three ways:
+.INDENT 7.0
+.TP
+.B \-binary (default)
+.UNINDENT
+.sp
+Emit the profile using a binary encoding. For instrumentation\-based profile
+the output format is the indexed binary format.
+.INDENT 7.0
+.TP
+.B \-text
+.UNINDENT
+.sp
+Emit the profile in text mode. This option can also be used with both
+sample\-based and instrumentation\-based profile. When this option is used
+the profile will be dumped in the text format that is parsable by the profile
+reader.
+.INDENT 7.0
+.TP
+.B \-gcc
+.UNINDENT
+.sp
+Emit the profile using GCC\(aqs gcov format (Not yet supported).
+.UNINDENT
+.SS EXAMPLES
+.SS Basic Usage
+.sp
+Merge three profiles:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+llvm\-profdata merge foo.profdata bar.profdata baz.profdata \-output merged.profdata
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SS Weighted Input
+.sp
+The input file \fIfoo.profdata\fP is especially important, multiply its counts by 10:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+llvm\-profdata merge \-weighted\-input=10,foo.profdata bar.profdata baz.profdata \-output merged.profdata
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+Exactly equivalent to the previous invocation (explicit form; useful for programmatic invocation):
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+llvm\-profdata merge \-weighted\-input=10,foo.profdata \-weighted\-input=1,bar.profdata \-weighted\-input=1,baz.profdata \-output merged.profdata
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH SHOW
+.SS SYNOPSIS
+.sp
+\fBllvm\-profdata show\fP [\fIoptions\fP] [\fIfilename\fP]
+.SS DESCRIPTION
+.sp
+\fBllvm\-profdata show\fP takes a profile data file and displays the
+information about the profile counters for this file and
+for any of the specified function(s).
+.sp
+If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-profdata show\fP reads its
+input from standard input.
+.SS OPTIONS
+.INDENT 0.0
+.TP
+.B \-all\-functions
+Print details for every function.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-counts
+Print the counter values for the displayed functions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-function=string
+Print details for a function if the function\(aqs name contains the given string.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-output=output, \-o=output
+Specify the output file name. If \fIoutput\fP is \fB\-\fP or it isn\(aqt specified,
+then the output is sent to standard output.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-instr (default)
+Specify that the input profile is an instrumentation\-based profile.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-text
+Instruct the profile dumper to show profile counts in the text format of the
+instrumentation\-based profile data representation. By default, the profile
+information is dumped in a more human readable form (also in text) with
+annotations.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-sample
+Specify that the input profile is a sample\-based profile.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-profdata\fP returns 1 if the command is omitted or is invalid,
+if it cannot read input files, or if there is a mismatch between their data.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-rtdyld/Makefile b/usr.bin/clang/llvm-rtdyld/Makefile
new file mode 100644
index 0000000..3c5304b
--- /dev/null
+++ b/usr.bin/clang/llvm-rtdyld/Makefile
@@ -0,0 +1,74 @@
+# $FreeBSD$
+
+MAN=
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-rtdyld
+
+SRCDIR= tools/llvm-rtdyld
+SRCS= llvm-rtdyld.cpp
+
+LIBDEPS=llvmdebuginfodwarf \
+ llvmmcjit \
+ llvmexecutionengine \
+ llvmruntimedyld \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmtransformutils \
+ llvmbitwriter \
+ llvmanalysis \
+ llvmx86desc \
+ llvmobject \
+ llvmmcparser \
+ llvmbitreader \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmmc \
+ llvmx86utils \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-rtdyld/Makefile.depend b/usr.bin/clang/llvm-rtdyld/Makefile.depend
new file mode 100644
index 0000000..bf4a9ba
--- /dev/null
+++ b/usr.bin/clang/llvm-rtdyld/Makefile.depend
@@ -0,0 +1,83 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmdebuginfodwarf \
+ lib/clang/libllvmexecutionengine \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcjit \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmruntimedyld \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-symbolizer/Makefile b/usr.bin/clang/llvm-symbolizer/Makefile
new file mode 100644
index 0000000..a71663b
--- /dev/null
+++ b/usr.bin/clang/llvm-symbolizer/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-symbolizer
+
+SRCDIR= tools/llvm-symbolizer
+SRCS= llvm-symbolizer.cpp
+
+LIBDEPS=llvmsymbolize \
+ llvmdebuginfopdb \
+ llvmdebuginfodwarf \
+ llvmobject \
+ llvmmcparser \
+ llvmmc \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-symbolizer/Makefile.depend b/usr.bin/clang/llvm-symbolizer/Makefile.depend
new file mode 100644
index 0000000..d489cce
--- /dev/null
+++ b/usr.bin/clang/llvm-symbolizer/Makefile.depend
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmcore \
+ lib/clang/libllvmdebuginfodwarf \
+ lib/clang/libllvmdebuginfopdb \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmsymbolize \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1 b/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1
new file mode 100644
index 0000000..fc43d8d
--- /dev/null
+++ b/usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1
@@ -0,0 +1,163 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "LLVM-SYMBOLIZER" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+llvm-symbolizer \- convert addresses into source code locations
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBllvm\-symbolizer\fP [options]
+.SH DESCRIPTION
+.sp
+\fBllvm\-symbolizer\fP reads object file names and addresses from standard
+input and prints corresponding source code locations to standard output.
+If object file is specified in command line, \fBllvm\-symbolizer\fP
+processes only addresses from standard input, the rest is output verbatim.
+This program uses debug info sections and symbol table in the object files.
+.SH EXAMPLE
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+$ cat addr.txt
+a.out 0x4004f4
+/tmp/b.out 0x400528
+/tmp/c.so 0x710
+/tmp/mach_universal_binary:i386 0x1f84
+/tmp/mach_universal_binary:x86_64 0x100000f24
+$ llvm\-symbolizer < addr.txt
+main
+/tmp/a.cc:4
+
+f(int, int)
+/tmp/b.cc:11
+
+h_inlined_into_g
+/tmp/header.h:2
+g_inlined_into_f
+/tmp/header.h:7
+f_inlined_into_main
+/tmp/source.cc:3
+main
+/tmp/source.cc:8
+
+_main
+/tmp/source_i386.cc:8
+
+_main
+/tmp/source_x86_64.cc:8
+$ cat addr2.txt
+0x4004f4
+0x401000
+$ llvm\-symbolizer \-obj=a.out < addr2.txt
+main
+/tmp/a.cc:4
+
+foo(int)
+/tmp/a.cc:12
+$cat addr.txt
+0x40054d
+$llvm\-symbolizer \-inlining \-print\-address \-pretty\-print \-obj=addr.exe < addr.txt
+0x40054d: inc at /tmp/x.c:3:3
+ (inlined by) main at /tmp/x.c:9:0
+$llvm\-symbolizer \-inlining \-pretty\-print \-obj=addr.exe < addr.txt
+inc at /tmp/x.c:3:3
+ (inlined by) main at /tmp/x.c:9:0
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-obj
+Path to object file to be symbolized.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-functions=[none|short|linkage]
+Specify the way function names are printed (omit function name,
+print short function name, or print full linkage name, respectively).
+Defaults to \fBlinkage\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-use\-symbol\-table
+Prefer function names stored in symbol table to function names
+in debug info sections. Defaults to true.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-demangle
+Print demangled function names. Defaults to true.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-inlining
+If a source code location is in an inlined function, prints all the
+inlnied frames. Defaults to true.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-default\-arch
+If a binary contains object files for multiple architectures (e.g. it is a
+Mach\-O universal binary), symbolize the object file for a given architecture.
+You can also specify architecture by writing \fBbinary_name:arch_name\fP in the
+input (see example above). If architecture is not specified in either way,
+address will not be symbolized. Defaults to empty string.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-dsym\-hint=<path/to/file.dSYM>
+(Darwin\-only flag). If the debug info for a binary isn\(aqt present in the default
+location, look for the debug info at the .dSYM path provided via the
+\fB\-dsym\-hint\fP flag. This flag can be used multiple times.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-address
+Print address before the source code location. Defaults to false.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-pretty\-print
+Print human readable output. If \fB\-inlining\fP is specified, enclosing scope is
+prefixed by (inlined by). Refer to listed examples.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-symbolizer\fP returns 0. Other exit codes imply internal program error.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-tblgen/Makefile b/usr.bin/clang/llvm-tblgen/Makefile
new file mode 100644
index 0000000..14b46db
--- /dev/null
+++ b/usr.bin/clang/llvm-tblgen/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=llvm-tblgen
+
+SRCDIR= utils/TableGen
+SRCS= AsmMatcherEmitter.cpp \
+ AsmWriterEmitter.cpp \
+ AsmWriterInst.cpp \
+ Attributes.cpp \
+ CTagsEmitter.cpp \
+ CallingConvEmitter.cpp \
+ CodeEmitterGen.cpp \
+ CodeGenDAGPatterns.cpp \
+ CodeGenInstruction.cpp \
+ CodeGenMapTable.cpp \
+ CodeGenRegisters.cpp \
+ CodeGenSchedule.cpp \
+ CodeGenTarget.cpp \
+ DAGISelEmitter.cpp \
+ DAGISelMatcher.cpp \
+ DAGISelMatcherEmitter.cpp \
+ DAGISelMatcherGen.cpp \
+ DAGISelMatcherOpt.cpp \
+ DFAPacketizerEmitter.cpp \
+ DisassemblerEmitter.cpp \
+ FastISelEmitter.cpp \
+ FixedLenDecoderEmitter.cpp \
+ InstrInfoEmitter.cpp \
+ IntrinsicEmitter.cpp \
+ OptParserEmitter.cpp \
+ PseudoLoweringEmitter.cpp \
+ RegisterInfoEmitter.cpp \
+ SubtargetEmitter.cpp \
+ TableGen.cpp \
+ X86DisassemblerTables.cpp \
+ X86ModRMFilters.cpp \
+ X86RecognizableInstr.cpp
+
+LIBDEPS=llvmtablegen \
+ llvmsupport
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-tblgen/Makefile.depend b/usr.bin/clang/llvm-tblgen/Makefile.depend
new file mode 100644
index 0000000..58ed9a7
--- /dev/null
+++ b/usr.bin/clang/llvm-tblgen/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtablegen \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-tblgen/llvm-tblgen.1 b/usr.bin/clang/llvm-tblgen/llvm-tblgen.1
new file mode 100644
index 0000000..291a9de
--- /dev/null
+++ b/usr.bin/clang/llvm-tblgen/llvm-tblgen.1
@@ -0,0 +1,182 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "TBLGEN" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+tblgen \- Target Description To C++ Code Generator
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBtblgen\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+\fBtblgen\fP translates from target description (\fB\&.td\fP) files into C++
+code that can be included in the definition of an LLVM target library. Most
+users of LLVM will not need to use this program. It is only for assisting with
+writing an LLVM target backend.
+.sp
+The input and output of \fBtblgen\fP is beyond the scope of this short
+introduction; please see the \fBintroduction to TableGen\fP\&.
+.sp
+The \fIfilename\fP argument specifies the name of a Target Description (\fB\&.td\fP)
+file to read as input.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-o filename
+Specify the output file name. If \fBfilename\fP is \fB\-\fP, then
+\fBtblgen\fP sends its output to standard output.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-I directory
+Specify where to find other target description files for inclusion. The
+\fBdirectory\fP value should be a full or partial path to a directory that
+contains target description files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-asmparsernum N
+Make \-gen\-asm\-parser emit assembly writer number \fBN\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-asmwriternum N
+Make \-gen\-asm\-writer emit assembly writer number \fBN\fP\&.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-class className
+Print the enumeration list for this class.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-records
+Print all records to standard output (default).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-enums
+Print enumeration values for a class.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-print\-sets
+Print expanded sets for testing DAG exprs.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-emitter
+Generate machine code emitter.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-register\-info
+Generate registers and register classes info.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-instr\-info
+Generate instruction descriptions.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-asm\-writer
+Generate the assembly writer.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-disassembler
+Generate disassembler.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-pseudo\-lowering
+Generate pseudo instruction lowering.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-dag\-isel
+Generate a DAG (Directed Acycle Graph) instruction selector.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-asm\-matcher
+Generate assembly instruction matcher.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-dfa\-packetizer
+Generate DFA Packetizer for VLIW targets.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-fast\-isel
+Generate a "fast" instruction selector.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-subtarget
+Generate subtarget enumerations.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-intrinsic
+Generate intrinsic information.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-tgt\-intrinsic
+Generate target intrinsic information.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-gen\-enhanced\-disassembly\-info
+Generate enhanced disassembly info.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-version
+Show the version number of this program.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBtblgen\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/opt/Makefile b/usr.bin/clang/opt/Makefile
new file mode 100644
index 0000000..9285a3c
--- /dev/null
+++ b/usr.bin/clang/opt/Makefile
@@ -0,0 +1,85 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PROG_CXX=opt
+
+SRCDIR= tools/opt
+SRCS= AnalysisWrappers.cpp \
+ BreakpointPrinter.cpp \
+ GraphPrinters.cpp \
+ NewPMDriver.cpp \
+ PassPrinters.cpp \
+ PrintSCC.cpp \
+ opt.cpp
+
+TGHDRS= Attributes \
+ Intrinsics
+
+LIBDEPS=llvmpasses \
+ llvmaarch64disassembler \
+ llvmaarch64codegen \
+ llvmaarch64asmparser \
+ llvmaarch64desc \
+ llvmaarch64info \
+ llvmaarch64asmprinter \
+ llvmaarch64utils \
+ llvmarmdisassembler \
+ llvmarmcodegen \
+ llvmarmasmparser \
+ llvmarmdesc \
+ llvmarminfo \
+ llvmarmasmprinter \
+ llvmmipsdisassembler \
+ llvmmipscodegen \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsasmprinter \
+ llvmpowerpcdisassembler \
+ llvmpowerpccodegen \
+ llvmpowerpcasmparser \
+ llvmpowerpcdesc \
+ llvmpowerpcinfo \
+ llvmpowerpcasmprinter \
+ llvmsparcdisassembler \
+ llvmsparccodegen \
+ llvmsparcasmparser \
+ llvmsparcdesc \
+ llvmsparcinfo \
+ llvmsparcasmprinter \
+ llvmx86disassembler \
+ llvmx86asmparser \
+ llvmx86codegen \
+ llvmselectiondag \
+ llvmasmprinter \
+ llvmcodegen \
+ llvmtarget \
+ llvmx86desc \
+ llvmmcdisassembler \
+ llvmx86info \
+ llvmx86asmprinter \
+ llvmx86utils \
+ llvmipo \
+ llvmvectorize \
+ llvmlinker \
+ llvmobjcarcopts \
+ llvmscalaropts \
+ llvminstcombine \
+ llvminstrumentation \
+ llvmprofiledata \
+ llvmobject \
+ llvmmcparser \
+ llvmtransformutils \
+ llvmmc \
+ llvmanalysis \
+ llvmirreader \
+ llvmasmparser \
+ llvmbitwriter \
+ llvmbitreader \
+ llvmcore \
+ llvmsupport
+
+LIBADD+= z
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/opt/Makefile.depend b/usr.bin/clang/opt/Makefile.depend
new file mode 100644
index 0000000..b2a718f
--- /dev/null
+++ b/usr.bin/clang/opt/Makefile.depend
@@ -0,0 +1,87 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvmaarch64asmparser \
+ lib/clang/libllvmaarch64asmprinter \
+ lib/clang/libllvmaarch64codegen \
+ lib/clang/libllvmaarch64desc \
+ lib/clang/libllvmaarch64disassembler \
+ lib/clang/libllvmaarch64info \
+ lib/clang/libllvmaarch64utils \
+ lib/clang/libllvmanalysis \
+ lib/clang/libllvmarmasmparser \
+ lib/clang/libllvmarmasmprinter \
+ lib/clang/libllvmarmcodegen \
+ lib/clang/libllvmarmdesc \
+ lib/clang/libllvmarmdisassembler \
+ lib/clang/libllvmarminfo \
+ lib/clang/libllvmasmparser \
+ lib/clang/libllvmasmprinter \
+ lib/clang/libllvmbitreader \
+ lib/clang/libllvmbitwriter \
+ lib/clang/libllvmcodegen \
+ lib/clang/libllvmcore \
+ lib/clang/libllvminstcombine \
+ lib/clang/libllvminstrumentation \
+ lib/clang/libllvmipo \
+ lib/clang/libllvmirreader \
+ lib/clang/libllvmlinker \
+ lib/clang/libllvmmc \
+ lib/clang/libllvmmcdisassembler \
+ lib/clang/libllvmmcparser \
+ lib/clang/libllvmmipsasmparser \
+ lib/clang/libllvmmipsasmprinter \
+ lib/clang/libllvmmipscodegen \
+ lib/clang/libllvmmipsdesc \
+ lib/clang/libllvmmipsdisassembler \
+ lib/clang/libllvmmipsinfo \
+ lib/clang/libllvmobjcarcopts \
+ lib/clang/libllvmobject \
+ lib/clang/libllvmpasses \
+ lib/clang/libllvmpowerpcasmparser \
+ lib/clang/libllvmpowerpcasmprinter \
+ lib/clang/libllvmpowerpccodegen \
+ lib/clang/libllvmpowerpcdesc \
+ lib/clang/libllvmpowerpcdisassembler \
+ lib/clang/libllvmpowerpcinfo \
+ lib/clang/libllvmprofiledata \
+ lib/clang/libllvmscalaropts \
+ lib/clang/libllvmselectiondag \
+ lib/clang/libllvmsparcasmparser \
+ lib/clang/libllvmsparcasmprinter \
+ lib/clang/libllvmsparccodegen \
+ lib/clang/libllvmsparcdesc \
+ lib/clang/libllvmsparcdisassembler \
+ lib/clang/libllvmsparcinfo \
+ lib/clang/libllvmsupport \
+ lib/clang/libllvmtarget \
+ lib/clang/libllvmtransformutils \
+ lib/clang/libllvmvectorize \
+ lib/clang/libllvmx86asmparser \
+ lib/clang/libllvmx86asmprinter \
+ lib/clang/libllvmx86codegen \
+ lib/clang/libllvmx86desc \
+ lib/clang/libllvmx86disassembler \
+ lib/clang/libllvmx86info \
+ lib/clang/libllvmx86utils \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+ usr.bin/clang/llvm-tblgen.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/opt/opt.1 b/usr.bin/clang/opt/opt.1
new file mode 100644
index 0000000..a498d99
--- /dev/null
+++ b/usr.bin/clang/opt/opt.1
@@ -0,0 +1,170 @@
+.\" $FreeBSD$
+.\" Man page generated from reStructuredText.
+.
+.TH "OPT" "1" "2016-03-03" "3.8" "LLVM"
+.SH NAME
+opt \- LLVM optimizer
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.sp
+\fBopt\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBopt\fP command is the modular LLVM optimizer and analyzer. It
+takes LLVM source files as input, runs the specified optimizations or analyses
+on it, and then outputs the optimized file or the analysis results. The
+function of \fBopt\fP depends on whether the \fB\-analyze\fP option is
+given.
+.sp
+When \fB\-analyze\fP is specified, \fBopt\fP performs various analyses
+of the input source. It will usually print the results on standard output, but
+in a few cases, it will print output to standard error or generate a file with
+the analysis output, which is usually done when the output is meant for another
+program.
+.sp
+While \fB\-analyze\fP is \fInot\fP given, \fBopt\fP attempts to produce an
+optimized output file. The optimizations available via \fBopt\fP depend
+upon what libraries were linked into it as well as any additional libraries
+that have been loaded with the \fI\%\-load\fP option. Use the \fI\%\-help\fP
+option to determine what optimizations you can use.
+.sp
+If \fBfilename\fP is omitted from the command line or is "\fB\-\fP", \fBopt\fP
+reads its input from standard input. Inputs can be in either the LLVM assembly
+language format (\fB\&.ll\fP) or the LLVM bitcode format (\fB\&.bc\fP).
+.sp
+If an output filename is not specified with the \fI\%\-o\fP option,
+\fBopt\fP writes its output to the standard output.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-f
+Enable binary output on terminals. Normally, \fBopt\fP will refuse to
+write raw bitcode output if the output stream is a terminal. With this option,
+\fBopt\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-o <filename>
+Specify the output filename.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-S
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-{passname}
+\fBopt\fP provides the ability to run any of LLVM\(aqs optimization or
+analysis passes in any order. The \fI\%\-help\fP option lists all the passes
+available. The order in which the options occur on the command line are the
+order in which they are executed (within pass constraints).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-disable\-inlining
+This option simply removes the inlining pass from the standard list.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-disable\-opt
+This option is only meaningful when \fB\-std\-link\-opts\fP is given. It
+disables most passes.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-strip\-debug
+This option causes opt to strip debug information from the module before
+applying other optimizations. It is essentially the same as \fB\-strip\fP
+but it ensures that stripping of debug information is done first.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-verify\-each
+This option causes opt to add a verify pass after every pass otherwise
+specified on the command line (including \fB\-verify\fP). This is useful
+for cases where it is suspected that a pass is creating an invalid module but
+it is not clear which pass is doing it.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-stats
+Print statistics.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-time\-passes
+Record the amount of time needed for each pass and print it to standard
+error.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-debug
+If this is a debug build, this option will enable debug printouts from passes
+which use the \fBDEBUG()\fP macro. See the \fI\%LLVM Programmer\(aqs Manual\fP, section \fB#DEBUG\fP for more information.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-load=<plugin>
+Load the dynamic object \fBplugin\fP\&. This object should register new
+optimization or analysis passes. Once loaded, the object will add new command
+line options to enable various optimizations or analyses. To see the new
+complete list of optimizations, use the \fI\%\-help\fP and \fI\%\-load\fP
+options together. For example:
+.INDENT 7.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+opt \-load=plugin.so \-help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-p
+Print module after each transformation.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBopt\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2003-2016, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile
new file mode 100644
index 0000000..5b9fdfc
--- /dev/null
+++ b/usr.bin/cmp/Makefile
@@ -0,0 +1,13 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= cmp
+SRCS= cmp.c link.c misc.c regular.c special.c
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cmp/Makefile.depend b/usr.bin/cmp/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/cmp/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/cmp/cmp.1 b/usr.bin/cmp/cmp.1
new file mode 100644
index 0000000..142bd3e
--- /dev/null
+++ b/usr.bin/cmp/cmp.1
@@ -0,0 +1,128 @@
+.\" Copyright (c) 1987, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)cmp.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd November 18, 2013
+.Dt CMP 1
+.Os
+.Sh NAME
+.Nm cmp
+.Nd compare two files
+.Sh SYNOPSIS
+.Nm
+.Op Fl l | s | x
+.Op Fl hz
+.Ar file1 file2
+.Op Ar skip1 Op Ar skip2
+.Sh DESCRIPTION
+The
+.Nm
+utility compares two files of any type and writes the results
+to the standard output.
+By default,
+.Nm
+is silent if the files are the same; if they differ, the byte
+and line number at which the first difference occurred is reported.
+.Pp
+Bytes and lines are numbered beginning with one.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl h
+Do not follow symbolic links.
+.It Fl l
+Print the byte number (decimal) and the differing
+byte values (octal) for each difference.
+.It Fl s
+Print nothing for differing files; return exit
+status only.
+.It Fl x
+Like
+.Fl l
+but prints in hexadecimal and using zero as index
+for the first byte in the files.
+.It Fl z
+For regular files compare file sizes first, and fail the comparison if they
+are not equal.
+.El
+.Pp
+The optional arguments
+.Ar skip1
+and
+.Ar skip2
+are the byte offsets from the beginning of
+.Ar file1
+and
+.Ar file2 ,
+respectively, where the comparison will begin.
+The offset is decimal by default, but may be expressed as a hexadecimal
+or octal value by preceding it with a leading ``0x'' or ``0''.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Bl -tag -width 4n
+.It 0
+The files are identical.
+.It 1
+The files are different; this includes the case
+where one file is identical to the first part of
+the other.
+In the latter case, if the
+.Fl s
+option has not been specified,
+.Nm
+writes to standard error that EOF was reached in the shorter
+file (before any differences were found).
+.It >1
+An error occurred.
+.El
+.Sh SEE ALSO
+.Xr diff 1 ,
+.Xr diff3 1
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
+The
+.Fl h ,
+.Fl x ,
+and
+.Fl z
+options are extensions to the standard.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
new file mode 100644
index 0000000..f3ac717
--- /dev/null
+++ b/usr.bin/cmp/cmp.c
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1987, 1990, 1993, 1994
+ * 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) 1987, 1990, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+int lflag, sflag, xflag, zflag;
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb1, sb2;
+ off_t skip1, skip2;
+ int ch, fd1, fd2, oflag, special;
+ const char *file1, *file2;
+
+ oflag = O_RDONLY;
+ while ((ch = getopt(argc, argv, "hlsxz")) != -1)
+ switch (ch) {
+ case 'h': /* Don't follow symlinks */
+ oflag |= O_NOFOLLOW;
+ break;
+ case 'l': /* print all differences */
+ lflag = 1;
+ break;
+ case 's': /* silent run */
+ sflag = 1;
+ zflag = 1;
+ break;
+ case 'x': /* hex output */
+ lflag = 1;
+ xflag = 1;
+ break;
+ case 'z': /* compare size first */
+ zflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (lflag && sflag)
+ errx(ERR_EXIT, "specifying -s with -l or -x is not permitted");
+
+ if (argc < 2 || argc > 4)
+ usage();
+
+ /* Backward compatibility -- handle "-" meaning stdin. */
+ special = 0;
+ if (strcmp(file1 = argv[0], "-") == 0) {
+ special = 1;
+ fd1 = 0;
+ file1 = "stdin";
+ }
+ else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file1);
+ else
+ exit(ERR_EXIT);
+ }
+ if (strcmp(file2 = argv[1], "-") == 0) {
+ if (special)
+ errx(ERR_EXIT,
+ "standard input may only be specified once");
+ special = 1;
+ fd2 = 0;
+ file2 = "stdin";
+ }
+ else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file2);
+ else
+ exit(ERR_EXIT);
+ }
+
+ skip1 = argc > 2 ? strtol(argv[2], NULL, 0) : 0;
+ skip2 = argc == 4 ? strtol(argv[3], NULL, 0) : 0;
+
+ if (fd1 == -1) {
+ if (fd2 == -1) {
+ c_link(file1, skip1, file2, skip2);
+ exit(0);
+ } else if (!sflag)
+ errx(ERR_EXIT, "%s: Not a symbolic link", file2);
+ else
+ exit(ERR_EXIT);
+ } else if (fd2 == -1) {
+ if (!sflag)
+ errx(ERR_EXIT, "%s: Not a symbolic link", file1);
+ else
+ exit(ERR_EXIT);
+ }
+
+ if (!special) {
+ if (fstat(fd1, &sb1)) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file1);
+ else
+ exit(ERR_EXIT);
+ }
+ if (!S_ISREG(sb1.st_mode))
+ special = 1;
+ else {
+ if (fstat(fd2, &sb2)) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file2);
+ else
+ exit(ERR_EXIT);
+ }
+ if (!S_ISREG(sb2.st_mode))
+ special = 1;
+ }
+ }
+
+ if (special)
+ c_special(fd1, file1, skip1, fd2, file2, skip2);
+ else {
+ if (zflag && sb1.st_size != sb2.st_size) {
+ if (!sflag)
+ (void) printf("%s %s differ: size\n",
+ file1, file2);
+ exit(DIFF_EXIT);
+ }
+ c_regular(fd1, file1, skip1, sb1.st_size,
+ fd2, file2, skip2, sb2.st_size);
+ }
+ exit(0);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: cmp [-l | -s | -x] [-hz] file1 file2 [skip1 [skip2]]\n");
+ exit(ERR_EXIT);
+}
diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h
new file mode 100644
index 0000000..a35cc3d
--- /dev/null
+++ b/usr.bin/cmp/extern.h
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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.
+ *
+ * @(#)extern.h 8.3 (Berkeley) 4/2/94
+ *
+ * $FreeBSD$
+ *
+ */
+
+#define OK_EXIT 0
+#define DIFF_EXIT 1
+#define ERR_EXIT 2 /* error exit code */
+
+void c_link(const char *, off_t, const char *, off_t);
+void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t);
+void c_special(int, const char *, off_t, int, const char *, off_t);
+void diffmsg(const char *, const char *, off_t, off_t);
+void eofmsg(const char *);
+
+extern int lflag, sflag, xflag, zflag;
diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c
new file mode 100644
index 0000000..fe45def
--- /dev/null
+++ b/usr.bin/cmp/link.c
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2005 Brian Somers <brian@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/types.h>
+#include <err.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+void
+c_link(const char *file1, off_t skip1, const char *file2, off_t skip2)
+{
+ char buf1[PATH_MAX], *p1;
+ char buf2[PATH_MAX], *p2;
+ int dfound, len1, len2;
+ off_t byte;
+ u_char ch;
+
+ if ((len1 = readlink(file1, buf1, sizeof(buf1) - 1)) < 0) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file1);
+ else
+ exit(ERR_EXIT);
+ }
+
+ if ((len2 = readlink(file2, buf2, sizeof(buf2) - 1)) < 0) {
+ if (!sflag)
+ err(ERR_EXIT, "%s", file2);
+ else
+ exit(ERR_EXIT);
+ }
+
+ if (skip1 > len1)
+ skip1 = len1;
+ buf1[len1] = '\0';
+
+ if (skip2 > len2)
+ skip2 = len2;
+ buf2[len2] = '\0';
+
+ dfound = 0;
+ byte = 1;
+ for (p1 = buf1 + skip1, p2 = buf2 + skip2; *p1 && *p2; p1++, p2++) {
+ if ((ch = *p1) != *p2) {
+ if (xflag) {
+ dfound = 1;
+ (void)printf("%08llx %02x %02x\n",
+ (long long)byte - 1, ch, *p2);
+ } else if (lflag) {
+ dfound = 1;
+ (void)printf("%6lld %3o %3o\n",
+ (long long)byte, ch, *p2);
+ } else
+ diffmsg(file1, file2, byte, 1);
+ /* NOTREACHED */
+ }
+ byte++;
+ }
+
+ if (*p1 || *p2)
+ eofmsg (*p1 ? file2 : file1);
+ if (dfound)
+ exit(DIFF_EXIT);
+}
diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c
new file mode 100644
index 0000000..0e94ea5
--- /dev/null
+++ b/usr.bin/cmp/misc.c
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "extern.h"
+
+void
+eofmsg(const char *file)
+{
+ if (!sflag)
+ warnx("EOF on %s", file);
+ exit(DIFF_EXIT);
+}
+
+void
+diffmsg(const char *file1, const char *file2, off_t byte, off_t line)
+{
+ if (!sflag)
+ (void)printf("%s %s differ: char %lld, line %lld\n",
+ file1, file2, (long long)byte, (long long)line);
+ exit(DIFF_EXIT);
+}
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
new file mode 100644
index 0000000..7ed83c1
--- /dev/null
+++ b/usr.bin/cmp/regular.c
@@ -0,0 +1,172 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)regular.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+static u_char *remmap(u_char *, int, off_t);
+static void segv_handler(int);
+#define MMAP_CHUNK (8*1024*1024)
+
+#define ROUNDPAGE(i) ((i) & ~pagemask)
+
+void
+c_regular(int fd1, const char *file1, off_t skip1, off_t len1,
+ int fd2, const char *file2, off_t skip2, off_t len2)
+{
+ u_char ch, *p1, *p2, *m1, *m2, *e1, *e2;
+ off_t byte, length, line;
+ int dfound;
+ off_t pagemask, off1, off2;
+ size_t pagesize;
+ struct sigaction act, oact;
+
+ if (skip1 > len1)
+ eofmsg(file1);
+ len1 -= skip1;
+ if (skip2 > len2)
+ eofmsg(file2);
+ len2 -= skip2;
+
+ if (sflag && len1 != len2)
+ exit(DIFF_EXIT);
+
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_NODEFER;
+ act.sa_handler = segv_handler;
+ if (sigaction(SIGSEGV, &act, &oact))
+ err(ERR_EXIT, "sigaction()");
+
+ pagesize = getpagesize();
+ pagemask = (off_t)pagesize - 1;
+ off1 = ROUNDPAGE(skip1);
+ off2 = ROUNDPAGE(skip2);
+
+ length = MIN(len1, len2);
+
+ if ((m1 = remmap(NULL, fd1, off1)) == NULL) {
+ c_special(fd1, file1, skip1, fd2, file2, skip2);
+ return;
+ }
+
+ if ((m2 = remmap(NULL, fd2, off2)) == NULL) {
+ munmap(m1, MMAP_CHUNK);
+ c_special(fd1, file1, skip1, fd2, file2, skip2);
+ return;
+ }
+
+ dfound = 0;
+ e1 = m1 + MMAP_CHUNK;
+ e2 = m2 + MMAP_CHUNK;
+ p1 = m1 + (skip1 - off1);
+ p2 = m2 + (skip2 - off2);
+
+ for (byte = line = 1; length--; ++byte) {
+ if ((ch = *p1) != *p2) {
+ if (xflag) {
+ dfound = 1;
+ (void)printf("%08llx %02x %02x\n",
+ (long long)byte - 1, ch, *p2);
+ } else if (lflag) {
+ dfound = 1;
+ (void)printf("%6lld %3o %3o\n",
+ (long long)byte, ch, *p2);
+ } else
+ diffmsg(file1, file2, byte, line);
+ /* NOTREACHED */
+ }
+ if (ch == '\n')
+ ++line;
+ if (++p1 == e1) {
+ off1 += MMAP_CHUNK;
+ if ((p1 = m1 = remmap(m1, fd1, off1)) == NULL) {
+ munmap(m2, MMAP_CHUNK);
+ err(ERR_EXIT, "remmap %s", file1);
+ }
+ e1 = m1 + MMAP_CHUNK;
+ }
+ if (++p2 == e2) {
+ off2 += MMAP_CHUNK;
+ if ((p2 = m2 = remmap(m2, fd2, off2)) == NULL) {
+ munmap(m1, MMAP_CHUNK);
+ err(ERR_EXIT, "remmap %s", file2);
+ }
+ e2 = m2 + MMAP_CHUNK;
+ }
+ }
+ munmap(m1, MMAP_CHUNK);
+ munmap(m2, MMAP_CHUNK);
+
+ if (sigaction(SIGSEGV, &oact, NULL))
+ err(ERR_EXIT, "sigaction()");
+
+ if (len1 != len2)
+ eofmsg (len1 > len2 ? file2 : file1);
+ if (dfound)
+ exit(DIFF_EXIT);
+}
+
+static u_char *
+remmap(u_char *mem, int fd, off_t offset)
+{
+ if (mem != NULL)
+ munmap(mem, MMAP_CHUNK);
+ mem = mmap(NULL, MMAP_CHUNK, PROT_READ, MAP_SHARED, fd, offset);
+ if (mem == MAP_FAILED)
+ return (NULL);
+ madvise(mem, MMAP_CHUNK, MADV_SEQUENTIAL);
+ return (mem);
+}
+
+static void
+segv_handler(int sig __unused) {
+ static const char msg[] = "cmp: Input/output error (caught SIGSEGV)\n";
+
+ write(STDERR_FILENO, msg, sizeof(msg));
+ _exit(EXIT_FAILURE);
+}
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
new file mode 100644
index 0000000..8225185
--- /dev/null
+++ b/usr.bin/cmp/special.c
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)special.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "extern.h"
+
+void
+c_special(int fd1, const char *file1, off_t skip1,
+ int fd2, const char *file2, off_t skip2)
+{
+ int ch1, ch2;
+ off_t byte, line;
+ FILE *fp1, *fp2;
+ int dfound;
+
+ if ((fp1 = fdopen(fd1, "r")) == NULL)
+ err(ERR_EXIT, "%s", file1);
+ if ((fp2 = fdopen(fd2, "r")) == NULL)
+ err(ERR_EXIT, "%s", file2);
+
+ dfound = 0;
+ while (skip1--)
+ if (getc(fp1) == EOF)
+ goto eof;
+ while (skip2--)
+ if (getc(fp2) == EOF)
+ goto eof;
+
+ for (byte = line = 1;; ++byte) {
+ ch1 = getc(fp1);
+ ch2 = getc(fp2);
+ if (ch1 == EOF || ch2 == EOF)
+ break;
+ if (ch1 != ch2) {
+ if (xflag) {
+ dfound = 1;
+ (void)printf("%08llx %02x %02x\n",
+ (long long)byte - 1, ch1, ch2);
+ } else if (lflag) {
+ dfound = 1;
+ (void)printf("%6lld %3o %3o\n",
+ (long long)byte, ch1, ch2);
+ } else {
+ diffmsg(file1, file2, byte, line);
+ /* NOTREACHED */
+ }
+ }
+ if (ch1 == '\n')
+ ++line;
+ }
+
+eof: if (ferror(fp1))
+ err(ERR_EXIT, "%s", file1);
+ if (ferror(fp2))
+ err(ERR_EXIT, "%s", file2);
+ if (feof(fp1)) {
+ if (!feof(fp2))
+ eofmsg(file1);
+ } else
+ if (feof(fp2))
+ eofmsg(file2);
+ if (dfound)
+ exit(DIFF_EXIT);
+}
diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile
new file mode 100644
index 0000000..bfae46c
--- /dev/null
+++ b/usr.bin/cmp/tests/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+NETBSD_ATF_TESTS_SH= cmp_test
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/cmp/tests/Makefile.depend b/usr.bin/cmp/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/cmp/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/col/Makefile b/usr.bin/col/Makefile
new file mode 100644
index 0000000..a162866
--- /dev/null
+++ b/usr.bin/col/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= col
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/col/Makefile.depend b/usr.bin/col/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/col/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/col/README b/usr.bin/col/README
new file mode 100644
index 0000000..116a044
--- /dev/null
+++ b/usr.bin/col/README
@@ -0,0 +1,48 @@
+# @(#)README 8.1 (Berkeley) 6/6/93
+#
+# $FreeBSD$
+
+col - filter out reverse line feeds.
+
+Options are:
+ -b do not print any backspaces (last character written is printed)
+ -f allow half line feeds in output, by default characters between
+ lines are pushed to the line below
+ -p force unknown control sequences to be passed through unchanged
+ -x do not compress spaces into tabs.
+ -l num keep (at least) num lines in memory, 128 are kept by default
+
+In the 32V source code to col(1) the default behavior was to NOT compress
+spaces into tabs. There was a -h option which caused it to compress spaces
+into tabs. There was no -x flag.
+
+The 32V documentation, however, was consistent with the SVID (actually, V7
+at the time) and documented a -x flag (as defined above) while making no
+mention of a -h flag. Just before 4.3BSD went out, CSRG updated the manual
+page to reflect the way the code worked. Suspecting that this was probably
+the wrong way to go, this version adopts the SVID defaults, and no longer
+documents the -h option.
+
+Known differences between AT&T's col and this one (# is delimiter):
+ Input AT&T col this col
+ #\nabc\E7def\n# # def\nabc\r# # def\nabc\n#
+ #a# ## #a\n#
+ - last line always ends with at least one \n (or \E9)
+ #1234567 8\n# #1234567\t8\n# #1234567 8\n#
+ - single space not expanded to tab
+ -f #a\E8b\n# #ab\n# # b\E9\ra\n#
+ - can back up past first line (as far as you want) so you
+ *can* have a super script on the first line
+ #\E9_\ba\E8\nb\n# #\n_\bb\ba\n# #\n_\ba\bb\n#
+ - always print last character written to a position,
+ AT&T col claims to do this but doesn't.
+
+If a character is to be placed on a line that has been flushed, a warning
+is produced (the AT&T col is silent). The -l flag (not in AT&T col) can
+be used to increase the number of lines buffered to avoid the problem.
+
+General algorithm: a limited number of lines are buffered in a linked
+list. When a printable character is read, it is put in the buffer of
+the current line along with the column it's supposed to be in. When
+a line is flushed, the characters in the line are sorted according to
+column and then printed.
diff --git a/usr.bin/col/col.1 b/usr.bin/col/col.1
new file mode 100644
index 0000000..fc02ca4
--- /dev/null
+++ b/usr.bin/col/col.1
@@ -0,0 +1,167 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Michael Rendell.
+.\"
+.\" 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.
+.\"
+.\" @(#)col.1 8.1 (Berkeley) 6/29/93
+.\" $FreeBSD$
+.\"
+.Dd May 10, 2015
+.Dt COL 1
+.Os
+.Sh NAME
+.Nm col
+.Nd filter reverse line feeds from input
+.Sh SYNOPSIS
+.Nm
+.Op Fl bfhpx
+.Op Fl l Ar num
+.Sh DESCRIPTION
+The
+.Nm
+utility filters out reverse (and half reverse) line feeds so that the output is
+in the correct order with only forward and half forward line
+feeds, and replaces white-space characters with tabs where possible.
+This can be useful in processing the output of
+.Xr nroff 1
+and
+.Xr tbl 1 .
+.Pp
+The
+.Nm
+utility reads from the standard input and writes to the standard output.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b
+Do not output any backspaces, printing only the last character
+written to each column position.
+.It Fl f
+Forward half line feeds are permitted (``fine'' mode).
+Normally characters printed on a half line boundary are printed
+on the following line.
+.It Fl h
+Do not output multiple spaces instead of tabs (default).
+.It Fl l Ar num
+Buffer at least
+.Ar num
+lines in memory.
+By default, 128 lines are buffered.
+.It Fl p
+Force unknown control sequences to be passed through unchanged.
+Normally,
+.Nm
+will filter out any control sequences from the input other than those
+recognized and interpreted by itself, which are listed below.
+.It Fl x
+Output multiple spaces instead of tabs.
+.El
+.Pp
+In the input stream,
+.Nm
+understands both the escape sequences of the form escape-digit
+mandated by
+.St -susv2
+and the traditional
+.Bx
+format escape-control-character.
+The control sequences for carriage motion and their ASCII values
+are as follows:
+.Pp
+.Bl -tag -width "carriage return" -compact
+.It ESC\-BELL
+reverse line feed (escape then bell).
+.It ESC\-7
+reverse line feed (escape then 7).
+.It ESC\-BACKSPACE
+half reverse line feed (escape then backspace).
+.It ESC\-8
+half reverse line feed (escape then 8).
+.It ESC\-TAB
+half forward line feed (escape than tab).
+.It ESC\-9
+half forward line feed (escape then 9).
+In
+.Fl f
+mode, this sequence may also occur in the output stream.
+.It backspace
+moves back one column (8); ignored in the first column
+.It carriage return
+(13)
+.It newline
+forward line feed (10); also does carriage return
+.It shift in
+shift to normal character set (15)
+.It shift out
+shift to alternate character set (14)
+.It space
+moves forward one column (32)
+.It tab
+moves forward to next tab stop (9)
+.It vertical tab
+reverse line feed (11)
+.El
+.Pp
+All unrecognized control characters and escape sequences are
+discarded.
+.Pp
+The
+.Nm
+utility keeps track of the character set as characters are read and makes
+sure the character set is correct when they are output.
+.Pp
+If the input attempts to back up to the last flushed line,
+.Nm
+will display a warning message.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr colcrt 1 ,
+.Xr expand 1 ,
+.Xr nroff 1 ,
+.Xr tbl 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -susv2 .
+.Sh HISTORY
+A
+.Nm
+command
+appeared in
+.At v6 .
diff --git a/usr.bin/col/col.c b/usr.bin/col/col.c
new file mode 100644
index 0000000..13df126
--- /dev/null
+++ b/usr.bin/col/col.c
@@ -0,0 +1,599 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Michael Rendell of the Memorial University of Newfoundland.
+ *
+ * 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) 1990, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)col.c 8.5 (Berkeley) 5/4/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/capsicum.h>
+
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define BS '\b' /* backspace */
+#define TAB '\t' /* tab */
+#define SPACE ' ' /* space */
+#define NL '\n' /* newline */
+#define CR '\r' /* carriage return */
+#define ESC '\033' /* escape */
+#define SI '\017' /* shift in to normal character set */
+#define SO '\016' /* shift out to alternate character set */
+#define VT '\013' /* vertical tab (aka reverse line feed) */
+#define RLF '7' /* ESC-7 reverse line feed */
+#define RHLF '8' /* ESC-8 reverse half-line feed */
+#define FHLF '9' /* ESC-9 forward half-line feed */
+
+/* build up at least this many lines before flushing them out */
+#define BUFFER_MARGIN 32
+
+typedef char CSET;
+
+typedef struct char_str {
+#define CS_NORMAL 1
+#define CS_ALTERNATE 2
+ short c_column; /* column character is in */
+ CSET c_set; /* character set (currently only 2) */
+ wchar_t c_char; /* character in question */
+ int c_width; /* character width */
+} CHAR;
+
+typedef struct line_str LINE;
+struct line_str {
+ CHAR *l_line; /* characters on the line */
+ LINE *l_prev; /* previous line */
+ LINE *l_next; /* next line */
+ int l_lsize; /* allocated sizeof l_line */
+ int l_line_len; /* strlen(l_line) */
+ int l_needs_sort; /* set if chars went in out of order */
+ int l_max_col; /* max column in the line */
+};
+
+static void addto_lineno(int *, int);
+static LINE *alloc_line(void);
+static void dowarn(int);
+static void flush_line(LINE *);
+static void flush_lines(int);
+static void flush_blanks(void);
+static void free_line(LINE *);
+static void usage(void);
+
+static CSET last_set; /* char_set of last char printed */
+static LINE *lines;
+static int compress_spaces; /* if doing space -> tab conversion */
+static int fine; /* if `fine' resolution (half lines) */
+static int max_bufd_lines; /* max # of half lines to keep in memory */
+static int nblank_lines; /* # blanks after last flushed line */
+static int no_backspaces; /* if not to output any backspaces */
+static int pass_unknown_seqs; /* pass unknown control sequences */
+
+#define PUTC(ch) \
+ do { \
+ if (putwchar(ch) == WEOF) \
+ errx(1, "write error"); \
+ } while (0)
+
+int
+main(int argc, char **argv)
+{
+ wint_t ch;
+ CHAR *c;
+ CSET cur_set; /* current character set */
+ LINE *l; /* current line */
+ int extra_lines; /* # of lines above first line */
+ int cur_col; /* current column */
+ int cur_line; /* line number of current position */
+ int max_line; /* max value of cur_line */
+ int this_line; /* line l points to */
+ int nflushd_lines; /* number of lines that were flushed */
+ int adjust, opt, warned, width;
+ const char *errstr;
+ cap_rights_t rights;
+ unsigned long cmd;
+
+ (void)setlocale(LC_CTYPE, "");
+
+ cap_rights_init(&rights, CAP_FSTAT, CAP_READ);
+ if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for stdin");
+ cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE, CAP_IOCTL);
+ if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for stdout");
+ cmd = TIOCGETA; /* required by isatty(3) in printf(3) */
+ if (cap_ioctls_limit(STDOUT_FILENO, &cmd, 1) < 0 && errno != ENOSYS)
+ err(1, "unable to limit ioctls for stdout");
+
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
+ max_bufd_lines = 256;
+ compress_spaces = 1; /* compress spaces into tabs */
+ while ((opt = getopt(argc, argv, "bfhl:px")) != -1)
+ switch (opt) {
+ case 'b': /* do not output backspaces */
+ no_backspaces = 1;
+ break;
+ case 'f': /* allow half forward line feeds */
+ fine = 1;
+ break;
+ case 'h': /* compress spaces into tabs */
+ compress_spaces = 1;
+ break;
+ case 'l': /* buffered line count */
+ max_bufd_lines = strtonum(optarg, 1,
+ (INT_MAX - BUFFER_MARGIN) / 2, &errstr) * 2;
+ if (errstr != NULL)
+ errx(1, "bad -l argument, %s: %s", errstr,
+ optarg);
+ break;
+ case 'p': /* pass unknown control sequences */
+ pass_unknown_seqs = 1;
+ break;
+ case 'x': /* do not compress spaces into tabs */
+ compress_spaces = 0;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ if (optind != argc)
+ usage();
+
+ adjust = cur_col = extra_lines = warned = 0;
+ cur_line = max_line = nflushd_lines = this_line = 0;
+ cur_set = last_set = CS_NORMAL;
+ lines = l = alloc_line();
+
+ while ((ch = getwchar()) != WEOF) {
+ if (!iswgraph(ch)) {
+ switch (ch) {
+ case BS: /* can't go back further */
+ if (cur_col == 0)
+ continue;
+ --cur_col;
+ continue;
+ case CR:
+ cur_col = 0;
+ continue;
+ case ESC: /* just ignore EOF */
+ switch(getwchar()) {
+ /*
+ * In the input stream, accept both the
+ * XPG5 sequences ESC-digit and the
+ * traditional BSD sequences ESC-ctrl.
+ */
+ case '\007':
+ /* FALLTHROUGH */
+ case RLF:
+ addto_lineno(&cur_line, -2);
+ break;
+ case '\010':
+ /* FALLTHROUGH */
+ case RHLF:
+ addto_lineno(&cur_line, -1);
+ break;
+ case '\011':
+ /* FALLTHROUGH */
+ case FHLF:
+ addto_lineno(&cur_line, 1);
+ if (cur_line > max_line)
+ max_line = cur_line;
+ }
+ continue;
+ case NL:
+ addto_lineno(&cur_line, 2);
+ if (cur_line > max_line)
+ max_line = cur_line;
+ cur_col = 0;
+ continue;
+ case SPACE:
+ ++cur_col;
+ continue;
+ case SI:
+ cur_set = CS_NORMAL;
+ continue;
+ case SO:
+ cur_set = CS_ALTERNATE;
+ continue;
+ case TAB: /* adjust column */
+ cur_col |= 7;
+ ++cur_col;
+ continue;
+ case VT:
+ addto_lineno(&cur_line, -2);
+ continue;
+ }
+ if (iswspace(ch)) {
+ if ((width = wcwidth(ch)) > 0)
+ cur_col += width;
+ continue;
+ }
+ if (!pass_unknown_seqs)
+ continue;
+ }
+
+ /* Must stuff ch in a line - are we at the right one? */
+ if (cur_line + adjust != this_line) {
+ LINE *lnew;
+
+ /* round up to next line */
+ adjust = !fine && (cur_line & 1);
+
+ if (cur_line + adjust < this_line) {
+ while (cur_line + adjust < this_line &&
+ l->l_prev != NULL) {
+ l = l->l_prev;
+ this_line--;
+ }
+ if (cur_line + adjust < this_line) {
+ if (nflushd_lines == 0) {
+ /*
+ * Allow backup past first
+ * line if nothing has been
+ * flushed yet.
+ */
+ while (cur_line + adjust
+ < this_line) {
+ lnew = alloc_line();
+ l->l_prev = lnew;
+ lnew->l_next = l;
+ l = lines = lnew;
+ extra_lines++;
+ this_line--;
+ }
+ } else {
+ if (!warned++)
+ dowarn(cur_line);
+ cur_line = this_line - adjust;
+ }
+ }
+ } else {
+ /* may need to allocate here */
+ while (cur_line + adjust > this_line) {
+ if (l->l_next == NULL) {
+ l->l_next = alloc_line();
+ l->l_next->l_prev = l;
+ }
+ l = l->l_next;
+ this_line++;
+ }
+ }
+ if (this_line > nflushd_lines &&
+ this_line - nflushd_lines >=
+ max_bufd_lines + BUFFER_MARGIN) {
+ if (extra_lines) {
+ flush_lines(extra_lines);
+ extra_lines = 0;
+ }
+ flush_lines(this_line - nflushd_lines -
+ max_bufd_lines);
+ nflushd_lines = this_line - max_bufd_lines;
+ }
+ }
+ /* grow line's buffer? */
+ if (l->l_line_len + 1 >= l->l_lsize) {
+ int need;
+
+ need = l->l_lsize ? l->l_lsize * 2 : 90;
+ if ((l->l_line = realloc(l->l_line,
+ (unsigned)need * sizeof(CHAR))) == NULL)
+ err(1, NULL);
+ l->l_lsize = need;
+ }
+ c = &l->l_line[l->l_line_len++];
+ c->c_char = ch;
+ c->c_set = cur_set;
+ c->c_column = cur_col;
+ c->c_width = wcwidth(ch);
+ /*
+ * If things are put in out of order, they will need sorting
+ * when it is flushed.
+ */
+ if (cur_col < l->l_max_col)
+ l->l_needs_sort = 1;
+ else
+ l->l_max_col = cur_col;
+ if (c->c_width > 0)
+ cur_col += c->c_width;
+ }
+ if (ferror(stdin))
+ err(1, NULL);
+ if (extra_lines)
+ flush_lines(extra_lines);
+
+ /* goto the last line that had a character on it */
+ for (; l->l_next; l = l->l_next)
+ this_line++;
+ flush_lines(this_line - nflushd_lines + 1);
+
+ /* make sure we leave things in a sane state */
+ if (last_set != CS_NORMAL)
+ PUTC(SI);
+
+ /* flush out the last few blank lines */
+ if (max_line > this_line)
+ nblank_lines = max_line - this_line;
+ if (max_line & 1)
+ nblank_lines++;
+ flush_blanks();
+ exit(0);
+}
+
+static void
+flush_lines(int nflush)
+{
+ LINE *l;
+
+ while (--nflush >= 0) {
+ l = lines;
+ lines = l->l_next;
+ if (l->l_line) {
+ flush_blanks();
+ flush_line(l);
+ }
+ if (l->l_line || l->l_next)
+ nblank_lines++;
+ if (l->l_line)
+ (void)free(l->l_line);
+ free_line(l);
+ }
+ if (lines)
+ lines->l_prev = NULL;
+}
+
+/*
+ * Print a number of newline/half newlines. If fine flag is set, nblank_lines
+ * is the number of half line feeds, otherwise it is the number of whole line
+ * feeds.
+ */
+static void
+flush_blanks(void)
+{
+ int half, i, nb;
+
+ half = 0;
+ nb = nblank_lines;
+ if (nb & 1) {
+ if (fine)
+ half = 1;
+ else
+ nb++;
+ }
+ nb /= 2;
+ for (i = nb; --i >= 0;)
+ PUTC('\n');
+ if (half) {
+ PUTC(ESC);
+ PUTC(FHLF);
+ if (!nb)
+ PUTC('\r');
+ }
+ nblank_lines = 0;
+}
+
+/*
+ * Write a line to stdout taking care of space to tab conversion (-h flag)
+ * and character set shifts.
+ */
+static void
+flush_line(LINE *l)
+{
+ CHAR *c, *endc;
+ int i, j, nchars, last_col, save, this_col, tot;
+
+ last_col = 0;
+ nchars = l->l_line_len;
+
+ if (l->l_needs_sort) {
+ static CHAR *sorted;
+ static int count_size, *count, sorted_size;
+
+ /*
+ * Do an O(n) sort on l->l_line by column being careful to
+ * preserve the order of characters in the same column.
+ */
+ if (l->l_lsize > sorted_size) {
+ sorted_size = l->l_lsize;
+ if ((sorted = realloc(sorted,
+ (unsigned)sizeof(CHAR) * sorted_size)) == NULL)
+ err(1, NULL);
+ }
+ if (l->l_max_col >= count_size) {
+ count_size = l->l_max_col + 1;
+ if ((count = realloc(count,
+ (unsigned)sizeof(int) * count_size)) == NULL)
+ err(1, NULL);
+ }
+ memset(count, 0, sizeof(int) * l->l_max_col + 1);
+ for (i = nchars, c = l->l_line; --i >= 0; c++)
+ count[c->c_column]++;
+
+ /*
+ * calculate running total (shifted down by 1) to use as
+ * indices into new line.
+ */
+ for (tot = 0, i = 0; i <= l->l_max_col; i++) {
+ save = count[i];
+ count[i] = tot;
+ tot += save;
+ }
+
+ for (i = nchars, c = l->l_line; --i >= 0; c++)
+ sorted[count[c->c_column]++] = *c;
+ c = sorted;
+ } else
+ c = l->l_line;
+ while (nchars > 0) {
+ this_col = c->c_column;
+ endc = c;
+ do {
+ ++endc;
+ } while (--nchars > 0 && this_col == endc->c_column);
+
+ /* if -b only print last character */
+ if (no_backspaces) {
+ c = endc - 1;
+ if (nchars > 0 &&
+ this_col + c->c_width > endc->c_column)
+ continue;
+ }
+
+ if (this_col > last_col) {
+ int nspace = this_col - last_col;
+
+ if (compress_spaces && nspace > 1) {
+ while (1) {
+ int tab_col, tab_size;
+
+ tab_col = (last_col + 8) & ~7;
+ if (tab_col > this_col)
+ break;
+ tab_size = tab_col - last_col;
+ if (tab_size == 1)
+ PUTC(' ');
+ else
+ PUTC('\t');
+ nspace -= tab_size;
+ last_col = tab_col;
+ }
+ }
+ while (--nspace >= 0)
+ PUTC(' ');
+ last_col = this_col;
+ }
+
+ for (;;) {
+ if (c->c_set != last_set) {
+ switch (c->c_set) {
+ case CS_NORMAL:
+ PUTC(SI);
+ break;
+ case CS_ALTERNATE:
+ PUTC(SO);
+ }
+ last_set = c->c_set;
+ }
+ PUTC(c->c_char);
+ if ((c + 1) < endc)
+ for (j = 0; j < c->c_width; j++)
+ PUTC('\b');
+ if (++c >= endc)
+ break;
+ }
+ last_col += (c - 1)->c_width;
+ }
+}
+
+/*
+ * Increment or decrement a line number, checking for overflow.
+ * Stop one below INT_MAX such that the adjust variable is safe.
+ */
+void
+addto_lineno(int *lno, int offset)
+{
+ if (offset > 0) {
+ if (*lno >= INT_MAX - offset)
+ errx(1, "too many lines");
+ } else {
+ if (*lno < INT_MIN - offset)
+ errx(1, "too many reverse line feeds");
+ }
+ *lno += offset;
+}
+
+#define NALLOC 64
+
+static LINE *line_freelist;
+
+static LINE *
+alloc_line(void)
+{
+ LINE *l;
+ int i;
+
+ if (!line_freelist) {
+ if ((l = realloc(NULL, sizeof(LINE) * NALLOC)) == NULL)
+ err(1, NULL);
+ line_freelist = l;
+ for (i = 1; i < NALLOC; i++, l++)
+ l->l_next = l + 1;
+ l->l_next = NULL;
+ }
+ l = line_freelist;
+ line_freelist = l->l_next;
+
+ memset(l, 0, sizeof(LINE));
+ return (l);
+}
+
+static void
+free_line(LINE *l)
+{
+
+ l->l_next = line_freelist;
+ line_freelist = l;
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: col [-bfhpx] [-l nline]\n");
+ exit(1);
+}
+
+static void
+dowarn(int line)
+{
+
+ warnx("warning: can't back up %s",
+ line < 0 ? "past first line" : "-- line already flushed");
+}
diff --git a/usr.bin/col/tests/Makefile b/usr.bin/col/tests/Makefile
new file mode 100644
index 0000000..43ae05b
--- /dev/null
+++ b/usr.bin/col/tests/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= col
+
+${PACKAGE}FILES+= \
+ rlf.in \
+ rlf2.in
+
+.include <bsd.test.mk>
diff --git a/usr.bin/col/tests/Makefile.depend b/usr.bin/col/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/col/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/col/tests/col.sh b/usr.bin/col/tests/col.sh
new file mode 100755
index 0000000..c072aab
--- /dev/null
+++ b/usr.bin/col/tests/col.sh
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+atf_test_case rlf
+
+rlf_head()
+{
+ atf_set "descr" "testing reverse line feed"
+}
+rlf_body()
+{
+ atf_check \
+ -o inline:"a b\n" \
+ -e empty \
+ -s exit:0 \
+ col < $(atf_get_srcdir)/rlf.in
+
+ atf_check \
+ -o inline:"a b\n" \
+ -e empty \
+ -s exit:0 \
+ col < $(atf_get_srcdir)/rlf2.in
+
+ atf_check \
+ -o inline:"a b\n" \
+ -e empty \
+ -s exit:0 \
+ col -x < $(atf_get_srcdir)/rlf2.in
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case rlf
+}
diff --git a/usr.bin/col/tests/rlf.in b/usr.bin/col/tests/rlf.in
new file mode 100644
index 0000000..57a14e5
--- /dev/null
+++ b/usr.bin/col/tests/rlf.in
@@ -0,0 +1,2 @@
+a
+ 7b
diff --git a/usr.bin/col/tests/rlf2.in b/usr.bin/col/tests/rlf2.in
new file mode 100644
index 0000000..dd46851
--- /dev/null
+++ b/usr.bin/col/tests/rlf2.in
@@ -0,0 +1,2 @@
+a
+ 7b
diff --git a/usr.bin/colcrt/Makefile b/usr.bin/colcrt/Makefile
new file mode 100644
index 0000000..87d96ca
--- /dev/null
+++ b/usr.bin/colcrt/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= colcrt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/colcrt/Makefile.depend b/usr.bin/colcrt/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/colcrt/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/colcrt/colcrt.1 b/usr.bin/colcrt/colcrt.1
new file mode 100644
index 0000000..1b4aacf
--- /dev/null
+++ b/usr.bin/colcrt/colcrt.1
@@ -0,0 +1,120 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)colcrt.1 8.1 (Berkeley) 6/30/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt COLCRT 1
+.Os
+.Sh NAME
+.Nm colcrt
+.Nd filter nroff output for CRT previewing
+.Sh SYNOPSIS
+.Nm
+.Op Fl
+.Op Fl \&2
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility provides virtual half-line and reverse line feed sequences
+for terminals without such capability, and on which overstriking
+is destructive.
+Half-line characters and underlining (changed to dashing `\-')
+are placed on new lines in between the normal output lines.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl
+Suppress all underlining.
+This option is especially useful for previewing
+.Em allboxed
+tables from
+.Xr tbl 1 .
+.It Fl 2
+Cause all half-lines to be printed, effectively double spacing the output.
+Normally, a minimal space output format is used which will suppress empty
+lines.
+The program never suppresses two consecutive empty lines, however.
+The
+.Fl 2
+option is useful for sending output to the line printer when the output
+contains superscripts and subscripts which would otherwise be invisible.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+A typical use of
+.Nm
+would be
+.Bd -literal
+tbl exum2.n \&| nroff \-ms \&| colcrt \- \&| more
+.Ed
+.Sh SEE ALSO
+.Xr col 1 ,
+.Xr more 1 ,
+.Xr nroff 1 ,
+.Xr troff 1 ,
+.Xr ul 1
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 1 .
+.Sh BUGS
+Should fold underlines onto blanks even with the
+.Sq Fl
+option so that
+a true underline character would show.
+.Pp
+Cannot back up more than 102 lines.
+.Pp
+General overstriking is lost;
+as a special case
+.Ql \&|
+overstruck with
+.Ql \-
+or underline becomes
+.Ql \&+ .
+.Pp
+Lines are trimmed to 132 characters.
+.Pp
+Some provision should be made for processing superscripts and subscripts
+in documents which are already double-spaced.
+.Pp
+Characters that take up more than one column position may not be
+underlined correctly.
diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c
new file mode 100644
index 0000000..7ac274b
--- /dev/null
+++ b/usr.bin/colcrt/colcrt.c
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)colcrt.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+/*
+ * colcrt - replaces col for crts with new nroff esp. when using tbl.
+ * Bill Joy UCB July 14, 1977
+ *
+ * This filter uses a screen buffer, 267 half-lines by 132 columns.
+ * It interprets the up and down sequences generated by the new
+ * nroff when used with tbl and by \u \d and \r.
+ * General overstriking doesn't work correctly.
+ * Underlining is split onto multiple lines, etc.
+ *
+ * Option - suppresses all underlining.
+ * Option -2 forces printing of all half lines.
+ */
+
+static wchar_t page[267][132];
+
+static int outline = 1;
+static int outcol;
+
+static char suppresul;
+static char printall;
+
+static void move(int, int);
+static void pflush(int);
+static int plus(wchar_t, wchar_t);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ wint_t c;
+ wchar_t *cp, *dp;
+ int ch, i, w;
+
+ setlocale(LC_ALL, "");
+
+ while ((ch = getopt(argc, argv, "-2")) != -1)
+ switch (ch) {
+ case '-':
+ suppresul = 1;
+ break;
+ case '2':
+ printall = 1;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ do {
+ if (argc > 0) {
+ if (freopen(argv[0], "r", stdin) == NULL) {
+ fflush(stdout);
+ err(1, "%s", argv[0]);
+ }
+ argc--;
+ argv++;
+ }
+ for (;;) {
+ c = getwc(stdin);
+ if (c == WEOF) {
+ pflush(outline);
+ fflush(stdout);
+ break;
+ }
+ switch (c) {
+ case '\n':
+ if (outline >= 265)
+ pflush(62);
+ outline += 2;
+ outcol = 0;
+ continue;
+ case '\016':
+ case '\017':
+ continue;
+ case 033:
+ c = getwc(stdin);
+ switch (c) {
+ case '9':
+ if (outline >= 266)
+ pflush(62);
+ outline++;
+ continue;
+ case '8':
+ if (outline >= 1)
+ outline--;
+ continue;
+ case '7':
+ outline -= 2;
+ if (outline < 0)
+ outline = 0;
+ continue;
+ default:
+ continue;
+ }
+ case '\b':
+ if (outcol)
+ outcol--;
+ continue;
+ case '\t':
+ outcol += 8;
+ outcol &= ~7;
+ outcol--;
+ c = ' ';
+ default:
+ if ((w = wcwidth(c)) <= 0)
+ w = 1; /* XXX */
+ if (outcol + w > 132) {
+ outcol += w;
+ continue;
+ }
+ cp = &page[outline][outcol];
+ outcol += w;
+ if (c == '_') {
+ if (suppresul)
+ continue;
+ cp += 132;
+ c = '-';
+ }
+ if (*cp == 0) {
+ for (i = 0; i < w; i++)
+ cp[i] = c;
+ dp = cp - (outcol - w);
+ for (cp--; cp >= dp && *cp == 0; cp--)
+ *cp = ' ';
+ } else {
+ if (plus(c, *cp) || plus(*cp, c))
+ *cp = '+';
+ else if (*cp == ' ' || *cp == 0) {
+ for (i = 1; i < w; i++)
+ if (cp[i] != ' ' &&
+ cp[i] != 0)
+ goto cont;
+ for (i = 0; i < w; i++)
+ cp[i] = c;
+ }
+ }
+cont:
+ continue;
+ }
+ }
+ if (ferror(stdin))
+ err(1, NULL);
+ } while (argc > 0);
+ fflush(stdout);
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n");
+ exit(1);
+}
+
+static int
+plus(wchar_t c, wchar_t d)
+{
+
+ return ((c == '|' && d == '-') || d == '_');
+}
+
+static void
+pflush(int ol)
+{
+ static int first;
+ int i;
+ wchar_t *cp;
+ char lastomit;
+ int l, w;
+
+ l = ol;
+ lastomit = 0;
+ if (l > 266)
+ l = 266;
+ else
+ l |= 1;
+ for (i = first | 1; i < l; i++) {
+ move(i, i - 1);
+ move(i, i + 1);
+ }
+ for (i = first; i < l; i++) {
+ cp = page[i];
+ if (printall == 0 && lastomit == 0 && *cp == 0) {
+ lastomit = 1;
+ continue;
+ }
+ lastomit = 0;
+ while (*cp != L'\0') {
+ if ((w = wcwidth(*cp)) > 0) {
+ putwchar(*cp);
+ cp += w;
+ } else
+ cp++;
+ }
+ putwchar(L'\n');
+ }
+ wmemcpy(page[0], page[ol], (267 - ol) * 132);
+ wmemset(page[267- ol], L'\0', ol * 132);
+ outline -= ol;
+ outcol = 0;
+ first = 1;
+}
+
+static void
+move(int l, int m)
+{
+ wchar_t *cp, *dp;
+
+ for (cp = page[l], dp = page[m]; *cp; cp++, dp++) {
+ switch (*cp) {
+ case '|':
+ if (*dp != ' ' && *dp != '|' && *dp != 0)
+ return;
+ break;
+ case ' ':
+ break;
+ default:
+ return;
+ }
+ }
+ if (*cp == 0) {
+ for (cp = page[l], dp = page[m]; *cp; cp++, dp++)
+ if (*cp == '|')
+ *dp = '|';
+ else if (*dp == 0)
+ *dp = ' ';
+ page[l][0] = 0;
+ }
+}
diff --git a/usr.bin/colldef/Makefile b/usr.bin/colldef/Makefile
new file mode 100644
index 0000000..8e32b7f
--- /dev/null
+++ b/usr.bin/colldef/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PROG= colldef
+SRCS= parse.y scan.l y.tab.h
+LFLAGS= -8 -i
+CFLAGS+=-I. -I${.CURDIR}
+CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT -DYY_NO_INPUT
+LIBADD= l
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/colldef/Makefile.depend b/usr.bin/colldef/Makefile.depend
new file mode 100644
index 0000000..26839bd
--- /dev/null
+++ b/usr.bin/colldef/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/lex/lib \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/colldef/colldef.1 b/usr.bin/colldef/colldef.1
new file mode 100644
index 0000000..7d20f4d
--- /dev/null
+++ b/usr.bin/colldef/colldef.1
@@ -0,0 +1,279 @@
+.\" Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+.\" at Electronni Visti IA, Kiev, Ukraine.
+.\" 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 ``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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 18, 2016
+.Dt COLLDEF 1
+.Os
+.Sh NAME
+.Nm colldef
+.Nd convert collation sequence source definition
+.Sh SYNOPSIS
+.Nm
+.Op Fl I Ar map_dir
+.Op Fl o Ar out_file
+.Op Ar filename
+.Sh DESCRIPTION
+The
+.Nm
+utility converts a collation sequence source definition
+into a format usable by the
+.Fn strxfrm
+and
+.Fn strcoll
+functions.
+It is used to define the many ways in which
+strings can be ordered and collated.
+The
+.Fn strxfrm
+function transforms
+its first argument and places the result in its second
+argument.
+The transformed string is such that it can be
+correctly ordered with other transformed strings by using
+.Fn strcmp ,
+.Fn strncmp ,
+or
+.Fn memcmp .
+The
+.Fn strcoll
+function transforms its arguments and does a
+comparison.
+.Pp
+The
+.Nm
+utility reads the collation sequence source definition
+from the standard input and stores the converted definition in filename.
+The output file produced contains the
+database with collating sequence information in a form
+usable by system commands and routines.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl I Ar map_dir
+Set directory name where
+.Ar charmap
+files can be found, current directory by default.
+.It Fl o Ar out_file
+Set output file name,
+.Ar LC_COLLATE
+by default.
+.El
+.Pp
+The collation sequence definition specifies a set of collating elements and
+the rules defining how strings containing these should be ordered.
+This is most useful for different language definitions.
+.Pp
+The specification file can consist of three statements:
+.Ar charmap ,
+.Ar substitute
+and
+.Ar order .
+.Pp
+Of these, only the
+.Ar order
+statement is required.
+When
+.Ar charmap
+or
+.Ar substitute
+is
+supplied, these statements must be ordered as above.
+Any
+statements after the order statement are ignored.
+.Pp
+Lines in the specification file beginning with a
+.Ql #
+are
+treated as comments and are ignored.
+Blank lines are also
+ignored.
+.Pp
+.Dl "charmap charmapfile"
+.Pp
+.Ar Charmap
+defines where a mapping of the character
+and collating element symbols to the actual
+character encoding can be found.
+.Pp
+The format of
+.Ar charmapfile
+is shown below.
+Symbol
+names are separated from their values by TAB or
+SPACE characters.
+Symbol-value can be specified in
+a hexadecimal (\ex\fI??\fR) or octal (\e\fI???\fR)
+representation, and can be only one character in length.
+.Bd -literal -offset indent
+symbol-name1 symbol-value1
+symbol-name2 symbol-value2
+\&...
+.Ed
+.Pp
+Symbol names cannot be specified in
+.Ar substitute
+fields.
+.Pp
+The
+.Ar charmap
+statement is optional.
+.Bd -literal -offset indent
+substitute "symbol" with "repl_string"
+.Ed
+.Pp
+The
+.Ar substitute
+statement substitutes the character
+.Ar symbol
+with the string
+.Ar repl_string .
+Symbol names cannot be specified in
+.Ar repl_string
+field.
+The
+.Ar substitute
+statement is optional.
+.Pp
+.Dl "order order_list"
+.Pp
+.Ar Order_list
+is a list of symbols, separated by semi colons, that defines the
+collating sequence.
+The
+special symbol
+.Ar ...
+specifies, in a short-hand
+form, symbols that are sequential in machine code
+order.
+.Pp
+An order list element
+can be represented in any one of the following
+ways:
+.Bl -bullet
+.It
+The symbol itself (for example,
+.Ar a
+for the lower-case letter
+.Ar a ) .
+.It
+The symbol in octal representation (for example,
+.Ar \e141
+for the letter
+.Ar a ) .
+.It
+The symbol in hexadecimal representation (for example,
+.Ar \ex61
+for the letter
+.Ar a ) .
+.It
+The symbol name as defined in the
+.Ar charmap
+file (for example,
+.Ar <letterA>
+for
+.Ar letterA \e023
+record in
+.Ar charmapfile ) .
+If character map name have
+.Ar >
+character, it must be escaped as
+.Ar /> ,
+single
+.Ar /
+must be escaped as
+.Ar // .
+.It
+Symbols
+.Ar \ea ,
+.Ar \eb ,
+.Ar \ef ,
+.Ar \en ,
+.Ar \er ,
+.Ar \ev
+are permitted in its usual C-language meaning.
+.It
+The symbol chain (for example:
+.Ar abc ,
+.Ar <letterA><letterB>c ,
+.Ar \exf1b\exf2 )
+.It
+The symbol range (for example,
+.Ar a;...;z ) .
+.It
+Comma-separated symbols, ranges and chains enclosed in parenthesis (for example
+.Ar \&(
+.Ar sym1 ,
+.Ar sym2 ,
+.Ar ...
+.Ar \&) )
+are assigned the
+same primary ordering but different secondary
+ordering.
+.It
+Comma-separated symbols, ranges and chains enclosed in curly brackets (for example
+.Ar \&{
+.Ar sym1 ,
+.Ar sym2 ,
+.Ar ...
+.Ar \&} )
+are assigned the same primary ordering only.
+.El
+.Pp
+The backslash character
+.Ar \e
+is used for continuation.
+In this case, no characters are permitted
+after the backslash character.
+.Sh FILES
+.Bl -tag -width indent
+.It Pa /usr/share/locale/ Ns Ao Ar language Ac Ns Pa /LC_COLLATE
+The standard shared location for collation orders
+under the locale
+.Aq Ar language .
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with the following values:
+.Bl -tag -width indent
+.It Li 0
+No errors were found and the output was successfully created.
+.It Li !=0
+Errors were found.
+.El
+.Sh NOTES
+.Nm
+has been replaced by
+.Xr localedef 1
+in
+.Fx 11.0 .
+.Sh SEE ALSO
+.Xr localedef 1 ,
+.Xr mklocale 1 ,
+.Xr setlocale 3 ,
+.Xr strcoll 3 ,
+.Xr strxfrm 3
diff --git a/usr.bin/colldef/common.h b/usr.bin/colldef/common.h
new file mode 100644
index 0000000..316490d
--- /dev/null
+++ b/usr.bin/colldef/common.h
@@ -0,0 +1,11 @@
+/*
+ * $FreeBSD$
+ */
+
+#define CHARMAP_SYMBOL_LEN 64
+#define BUFSIZE 80
+
+extern int line_no;
+
+extern u_char charmap_table[UCHAR_MAX + 1][CHARMAP_SYMBOL_LEN];
+extern char map_name[FILENAME_MAX];
diff --git a/usr.bin/colldef/parse.y b/usr.bin/colldef/parse.y
new file mode 100644
index 0000000..44a62cd
--- /dev/null
+++ b/usr.bin/colldef/parse.y
@@ -0,0 +1,403 @@
+%{
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <err.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include "common.h"
+
+extern FILE *yyin;
+void yyerror(const char *fmt, ...) __printflike(1, 2);
+int yyparse(void);
+int yylex(void);
+static void usage(void);
+static void collate_print_tables(void);
+
+#undef STR_LEN
+#define STR_LEN 10
+#undef TABLE_SIZE
+#define TABLE_SIZE 100
+#undef COLLATE_VERSION
+#define COLLATE_VERSION "1.0\n"
+#undef COLLATE_VERSION_2
+#define COLLATE_VERSION1_2 "1.2\n"
+
+struct __collate_st_char_pri {
+ int prim, sec;
+};
+
+struct __collate_st_chain_pri {
+ u_char str[STR_LEN];
+ int prim, sec;
+};
+
+char map_name[FILENAME_MAX] = ".";
+char curr_chain[STR_LEN];
+
+char __collate_version[STR_LEN];
+u_char charmap_table[UCHAR_MAX + 1][CHARMAP_SYMBOL_LEN];
+
+#undef __collate_substitute_table
+u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
+#undef __collate_char_pri_table
+struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
+struct __collate_st_chain_pri *__collate_chain_pri_table;
+
+int chain_index = 0;
+int prim_pri = 1, sec_pri = 1;
+#ifdef COLLATE_DEBUG
+int debug;
+#endif
+
+const char *out_file = "LC_COLLATE";
+%}
+%union {
+ u_char ch;
+ u_char str[BUFSIZE];
+}
+%token SUBSTITUTE WITH ORDER RANGE
+%token <str> STRING
+%token <str> DEFN
+%token <ch> CHAR
+%%
+collate : statment_list
+;
+statment_list : statment
+ | statment_list '\n' statment
+;
+statment :
+ | charmap
+ | substitute
+ | order
+;
+charmap : DEFN CHAR {
+ if (strlen($1) + 1 > CHARMAP_SYMBOL_LEN)
+ yyerror("Charmap symbol name '%s' is too long", $1);
+ strcpy(charmap_table[$2], $1);
+}
+;
+substitute : SUBSTITUTE CHAR WITH STRING {
+ if ($2 == '\0')
+ yyerror("NUL character can't be substituted");
+ if (strchr($4, $2) != NULL)
+ yyerror("Char 0x%02x substitution is recursive", $2);
+ if (strlen($4) + 1 > STR_LEN)
+ yyerror("Char 0x%02x substitution is too long", $2);
+ strcpy(__collate_substitute_table[$2], $4);
+}
+;
+order : ORDER order_list {
+ FILE *fp;
+ int ch, substed, ordered;
+ uint32_t u32;
+
+ for (ch = 0; ch < UCHAR_MAX + 1; ch++) {
+ substed = (__collate_substitute_table[ch][0] != ch);
+ ordered = !!__collate_char_pri_table[ch].prim;
+ if (!ordered && !substed)
+ yyerror("Char 0x%02x not found", ch);
+ if (substed && ordered)
+ yyerror("Char 0x%02x can't be ordered since substituted", ch);
+ }
+
+ if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
+ sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
+ yyerror("can't grow chain table");
+ (void)memset(&__collate_chain_pri_table[chain_index], 0,
+ sizeof(__collate_chain_pri_table[0]));
+ chain_index++;
+
+#ifdef COLLATE_DEBUG
+ if (debug)
+ collate_print_tables();
+#endif
+ if ((fp = fopen(out_file, "w")) == NULL)
+ err(EX_UNAVAILABLE, "can't open destination file %s",
+ out_file);
+
+ strcpy(__collate_version, COLLATE_VERSION1_2);
+ if (fwrite(__collate_version, sizeof(__collate_version), 1, fp) != 1)
+ err(EX_IOERR,
+ "I/O error writing collate version to destination file %s",
+ out_file);
+ u32 = htonl(chain_index);
+ if (fwrite(&u32, sizeof(u32), 1, fp) != 1)
+ err(EX_IOERR,
+ "I/O error writing chains number to destination file %s",
+ out_file);
+ if (fwrite(__collate_substitute_table,
+ sizeof(__collate_substitute_table), 1, fp) != 1)
+ err(EX_IOERR,
+ "I/O error writing substitution table to destination file %s",
+ out_file);
+ for (ch = 0; ch < UCHAR_MAX + 1; ch++) {
+ __collate_char_pri_table[ch].prim =
+ htonl(__collate_char_pri_table[ch].prim);
+ __collate_char_pri_table[ch].sec =
+ htonl(__collate_char_pri_table[ch].sec);
+ }
+ if (fwrite(__collate_char_pri_table,
+ sizeof(__collate_char_pri_table), 1, fp) != 1)
+ err(EX_IOERR,
+ "I/O error writing char table to destination file %s",
+ out_file);
+ for (ch = 0; ch < chain_index; ch++) {
+ __collate_chain_pri_table[ch].prim =
+ htonl(__collate_chain_pri_table[ch].prim);
+ __collate_chain_pri_table[ch].sec =
+ htonl(__collate_chain_pri_table[ch].sec);
+ }
+ if (fwrite(__collate_chain_pri_table,
+ sizeof(*__collate_chain_pri_table), chain_index, fp) !=
+ (size_t)chain_index)
+ err(EX_IOERR,
+ "I/O error writing chain table to destination file %s",
+ out_file);
+ if (fclose(fp) != 0)
+ err(EX_IOERR, "I/O error closing destination file %s",
+ out_file);
+ exit(EX_OK);
+}
+;
+order_list : item
+ | order_list ';' item
+;
+chain : CHAR CHAR {
+ curr_chain[0] = $1;
+ curr_chain[1] = $2;
+ if (curr_chain[0] == '\0' || curr_chain[1] == '\0')
+ yyerror("\\0 can't be chained");
+ curr_chain[2] = '\0';
+}
+ | chain CHAR {
+ static char tb[2];
+
+ tb[0] = $2;
+ if (tb[0] == '\0')
+ yyerror("\\0 can't be chained");
+ if (strlen(curr_chain) + 2 > STR_LEN)
+ yyerror("Chain '%s' grows too long", curr_chain);
+ (void)strcat(curr_chain, tb);
+}
+;
+item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x duplicated", $1);
+ __collate_char_pri_table[$1].prim = prim_pri++;
+}
+ | chain {
+ if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
+ sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
+ yyerror("can't grow chain table");
+ (void)memset(&__collate_chain_pri_table[chain_index], 0,
+ sizeof(__collate_chain_pri_table[0]));
+ (void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
+ __collate_chain_pri_table[chain_index].prim = prim_pri++;
+ chain_index++;
+}
+ | CHAR RANGE CHAR {
+ u_int i;
+
+ if ($3 <= $1)
+ yyerror("Illegal range 0x%02x -- 0x%02x", $1, $3);
+
+ for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x duplicated", (u_char)i);
+ __collate_char_pri_table[(u_char)i].prim = prim_pri++;
+ }
+}
+ | '{' prim_order_list '}' {
+ prim_pri++;
+}
+ | '(' sec_order_list ')' {
+ prim_pri++;
+ sec_pri = 1;
+}
+;
+prim_order_list : prim_sub_item
+ | prim_order_list ',' prim_sub_item
+;
+sec_order_list : sec_sub_item
+ | sec_order_list ',' sec_sub_item
+;
+prim_sub_item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x duplicated", $1);
+ __collate_char_pri_table[$1].prim = prim_pri;
+}
+ | CHAR RANGE CHAR {
+ u_int i;
+
+ if ($3 <= $1)
+ yyerror("Illegal range 0x%02x -- 0x%02x",
+ $1, $3);
+
+ for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x duplicated", (u_char)i);
+ __collate_char_pri_table[(u_char)i].prim = prim_pri;
+ }
+}
+ | chain {
+ if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
+ sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
+ yyerror("can't grow chain table");
+ (void)memset(&__collate_chain_pri_table[chain_index], 0,
+ sizeof(__collate_chain_pri_table[0]));
+ (void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
+ __collate_chain_pri_table[chain_index].prim = prim_pri;
+ chain_index++;
+}
+;
+sec_sub_item : CHAR {
+ if (__collate_char_pri_table[$1].prim)
+ yyerror("Char 0x%02x duplicated", $1);
+ __collate_char_pri_table[$1].prim = prim_pri;
+ __collate_char_pri_table[$1].sec = sec_pri++;
+}
+ | CHAR RANGE CHAR {
+ u_int i;
+
+ if ($3 <= $1)
+ yyerror("Illegal range 0x%02x -- 0x%02x",
+ $1, $3);
+
+ for (i = $1; i <= $3; i++) {
+ if (__collate_char_pri_table[(u_char)i].prim)
+ yyerror("Char 0x%02x duplicated", (u_char)i);
+ __collate_char_pri_table[(u_char)i].prim = prim_pri;
+ __collate_char_pri_table[(u_char)i].sec = sec_pri++;
+ }
+}
+ | chain {
+ if ((__collate_chain_pri_table = realloc(__collate_chain_pri_table,
+ sizeof(*__collate_chain_pri_table) * (chain_index + 1))) == NULL)
+ yyerror("can't grow chain table");
+ (void)memset(&__collate_chain_pri_table[chain_index], 0,
+ sizeof(__collate_chain_pri_table[0]));
+ (void)strcpy(__collate_chain_pri_table[chain_index].str, curr_chain);
+ __collate_chain_pri_table[chain_index].prim = prim_pri;
+ __collate_chain_pri_table[chain_index].sec = sec_pri++;
+ chain_index++;
+}
+;
+%%
+int
+main(int ac, char **av)
+{
+ int ch;
+
+#ifdef COLLATE_DEBUG
+ while((ch = getopt(ac, av, ":do:I:")) != -1) {
+#else
+ while((ch = getopt(ac, av, ":o:I:")) != -1) {
+#endif
+ switch (ch)
+ {
+#ifdef COLLATE_DEBUG
+ case 'd':
+ debug++;
+ break;
+#endif
+ case 'o':
+ out_file = optarg;
+ break;
+
+ case 'I':
+ strlcpy(map_name, optarg, sizeof(map_name));
+ break;
+
+ default:
+ usage();
+ }
+ }
+ ac -= optind;
+ av += optind;
+ if (ac > 0) {
+ if ((yyin = fopen(*av, "r")) == NULL)
+ err(EX_UNAVAILABLE, "can't open source file %s", *av);
+ }
+ for (ch = 0; ch <= UCHAR_MAX; ch++)
+ __collate_substitute_table[ch][0] = ch;
+ yyparse();
+ return 0;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: colldef [-I map_dir] [-o out_file] [filename]\n");
+ exit(EX_USAGE);
+}
+
+void
+yyerror(const char *fmt, ...)
+{
+ va_list ap;
+ char msg[128];
+
+ va_start(ap, fmt);
+ vsnprintf(msg, sizeof(msg), fmt, ap);
+ va_end(ap);
+ errx(EX_UNAVAILABLE, "%s near line %d", msg, line_no);
+}
+
+#ifdef COLLATE_DEBUG
+static void
+collate_print_tables(void)
+{
+ int i;
+
+ printf("Substitute table:\n");
+ for (i = 0; i < UCHAR_MAX + 1; i++)
+ if (i != *__collate_substitute_table[i])
+ printf("\t'%c' --> \"%s\"\n", i,
+ __collate_substitute_table[i]);
+ printf("Chain priority table:\n");
+ for (i = 0; i < chain_index - 1; i++)
+ printf("\t\"%s\" : %d %d\n",
+ __collate_chain_pri_table[i].str,
+ __collate_chain_pri_table[i].prim,
+ __collate_chain_pri_table[i].sec);
+ printf("Char priority table:\n");
+ for (i = 0; i < UCHAR_MAX + 1; i++)
+ printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
+ __collate_char_pri_table[i].sec);
+}
+#endif
diff --git a/usr.bin/colldef/scan.l b/usr.bin/colldef/scan.l
new file mode 100644
index 0000000..b396ed0
--- /dev/null
+++ b/usr.bin/colldef/scan.l
@@ -0,0 +1,287 @@
+%x string name charmap defn nchar subs subs2
+%{
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include <sysexits.h>
+#include "common.h"
+#include "y.tab.h"
+
+int line_no = 1, save_no, fromsubs;
+u_char buf[BUFSIZE], *ptr;
+FILE *map_fp;
+YY_BUFFER_STATE main_buf, map_buf;
+#ifdef FLEX_DEBUG
+YYSTYPE yylval;
+#endif /* FLEX_DEBUG */
+int yylex(void);
+%}
+%%
+<INITIAL,charmap,nchar,subs,subs2>[ \t]+ ;
+<subs2>\" { ptr = buf; BEGIN(string); }
+<subs>\< { ptr = buf; fromsubs = 1; BEGIN(name); }
+<INITIAL>\< { ptr = buf; fromsubs = 0; BEGIN(name); }
+^#.*\n line_no++;
+^\n line_no++;
+<INITIAL>\\\n line_no++;
+<INITIAL,nchar,subs>\\t { yylval.ch = '\t'; return CHAR; }
+<INITIAL,nchar,subs>\\n { yylval.ch = '\n'; return CHAR; }
+<INITIAL,nchar,subs>\\b { yylval.ch = '\b'; return CHAR; }
+<INITIAL,nchar,subs>\\f { yylval.ch = '\f'; return CHAR; }
+<INITIAL,nchar,subs>\\v { yylval.ch = '\v'; return CHAR; }
+<INITIAL,nchar,subs>\\r { yylval.ch = '\r'; return CHAR; }
+<INITIAL,nchar,subs>\\a { yylval.ch = '\a'; return CHAR; }
+<subs2>\n {
+ line_no++;
+ BEGIN(INITIAL);
+ return '\n';
+}
+<INITIAL,nchar>\n {
+ line_no++;
+ if (map_fp != NULL) {
+ ptr = buf;
+ BEGIN(defn);
+ }
+ return '\n';
+}
+<INITIAL>[;,{}()] return *yytext;
+<INITIAL>substitute { BEGIN(subs); return SUBSTITUTE; }
+<subs>with { BEGIN(subs2); return WITH; }
+<INITIAL>order return ORDER;
+<INITIAL>charmap BEGIN(charmap);
+<INITIAL>;[ \t]*\.\.\.[ \t]*; return RANGE;
+<INITIAL,nchar,subs>\\[0-7]{3} {
+ u_int v;
+
+ sscanf(&yytext[1], "%o", &v);
+ yylval.ch = (u_char)v;
+ return CHAR;
+}
+<INITIAL,nchar,subs>\\x[0-9a-fA-F]{2} {
+ u_int v;
+
+ sscanf(&yytext[2], "%x", &v);
+ yylval.ch = (u_char)v;
+ return CHAR;
+}
+<INITIAL,nchar,subs>\\. { yylval.ch = yytext[1]; return CHAR; }
+<INITIAL,nchar,subs>. { yylval.ch = *yytext; return CHAR; }
+<defn>^#.*\n line_no++;
+<defn>[ \t]+ {
+ if (ptr == buf)
+ errx(EX_UNAVAILABLE, "map expected near line %u of %s",
+ line_no, map_name);
+ *ptr = '\0';
+ strcpy(yylval.str, buf);
+ BEGIN(nchar);
+ return DEFN;
+}
+<name>\/\/ {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '/'",
+ line_no);
+ *ptr++ = '/';
+}
+<name>\/\> {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '>'",
+ line_no);
+ *ptr++ = '>';
+}
+<string>\\\" {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\"'",
+ line_no);
+ *ptr++ = '"';
+}
+<name>\> {
+ u_int i;
+
+ if (ptr == buf)
+ errx(EX_UNAVAILABLE, "non-empty name expected near line %u",
+ line_no);
+ *ptr = '\0';
+ for (i = 0; i <= UCHAR_MAX; i++) {
+ if (strcmp(charmap_table[i], buf) == 0)
+ goto findit;
+ }
+ errx(EX_UNAVAILABLE, "name <%s> not 'charmap'-defined near line %u",
+ buf, line_no);
+ findit:
+ yylval.ch = i;
+ if (fromsubs)
+ BEGIN(subs);
+ else
+ BEGIN(INITIAL);
+ return CHAR;
+}
+<string>\" {
+ *ptr = '\0';
+ strcpy(yylval.str, buf);
+ BEGIN(subs2);
+ return STRING;
+}
+<name,defn>. {
+ const char *s = (map_fp != NULL) ? map_name : "input";
+
+ if (!isascii(*yytext) || !isprint(*yytext))
+ errx(EX_UNAVAILABLE, "non-ASCII or non-printable character 0x%02x not allowed in the map/name near line %u of %s",
+ *yytext, line_no, s);
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "map/name buffer overflow near line %u of %s, character '%c'",
+ line_no, s, *yytext);
+ *ptr++ = *yytext;
+}
+<string>\\t {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\t'",
+ line_no);
+ *ptr++ = '\t';
+}
+<string>\\b {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\b'",
+ line_no);
+ *ptr++ = '\b';
+}
+<string>\\f {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\f'",
+ line_no);
+ *ptr++ = '\f';
+}
+<string>\\v {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\v'",
+ line_no);
+ *ptr++ = '\v';
+}
+<string>\\n {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\n'",
+ line_no);
+ *ptr++ = '\n';
+}
+<string>\\r {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\r'",
+ line_no);
+ *ptr++ = '\r';
+}
+<string>\\a {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\a'",
+ line_no);
+ *ptr++ = '\a';
+}
+<name,string,defn>\n {
+ const char *s = (map_fp != NULL) ? map_name : "input";
+
+ errx(EX_UNAVAILABLE, "unterminated map/name/string near line %u of %s", line_no, s);
+}
+<name,string,nchar><<EOF>> {
+ const char *s = (map_fp != NULL) ? map_name : "input";
+
+ errx(EX_UNAVAILABLE, "premature EOF in the name/string/char near line %u of %s", line_no, s);
+}
+<string>\\x[0-9a-f]{2} {
+ u_int v;
+
+ sscanf(&yytext[2], "%x", &v);
+ *ptr++ = (u_char)v;
+}
+<string>\\[0-7]{3} {
+ u_int v;
+
+ sscanf(&yytext[1], "%o", &v);
+ *ptr++ = (u_char)v;
+}
+<string>\\. {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '%c'",
+ line_no, yytext[1]);
+ *ptr++ = yytext[1];
+}
+<string>. {
+ if(ptr >= buf + sizeof(buf) - 1)
+ errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '%c'",
+ line_no, *yytext);
+ *ptr++ = *yytext;
+}
+<charmap>[^ \t\n]+ {
+ strcat(map_name, "/");
+ strcat(map_name, yytext);
+ if((map_fp = fopen(map_name, "r")) == NULL)
+ err(EX_UNAVAILABLE, "can't open 'charmap' file %s",
+ map_name);
+ save_no = line_no;
+ line_no = 1;
+ map_buf = yy_new_buffer(map_fp, YY_BUF_SIZE);
+ main_buf = YY_CURRENT_BUFFER;
+ yy_switch_to_buffer(map_buf);
+ ptr = buf;
+ BEGIN(defn);
+}
+<charmap>\n {
+ errx(EX_UNAVAILABLE, "'charmap' file name expected near line %u",
+ line_no);
+}
+<charmap><<EOF>> {
+ errx(EX_UNAVAILABLE, "'charmap' file name expected near line %u",
+ line_no);
+}
+<INITIAL,defn><<EOF>> {
+ if(map_fp != NULL) {
+ if (ptr != buf)
+ errx(EX_UNAVAILABLE, "premature EOF in the map near line %u of %s", line_no, map_name);
+ yy_switch_to_buffer(main_buf);
+ yy_delete_buffer(map_buf);
+ fclose(map_fp);
+ map_fp = NULL;
+ line_no = save_no;
+ BEGIN(INITIAL);
+ } else
+ yyterminate();
+}
+%%
+#ifdef FLEX_DEBUG
+main()
+{
+ while(yylex())
+ ;
+ return 0;
+}
+#endif /* FLEX_DEBUG */
diff --git a/usr.bin/colrm/Makefile b/usr.bin/colrm/Makefile
new file mode 100644
index 0000000..1258576
--- /dev/null
+++ b/usr.bin/colrm/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= colrm
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/colrm/Makefile.depend b/usr.bin/colrm/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/colrm/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/colrm/colrm.1 b/usr.bin/colrm/colrm.1
new file mode 100644
index 0000000..9454ed5
--- /dev/null
+++ b/usr.bin/colrm/colrm.1
@@ -0,0 +1,92 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)colrm.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt COLRM 1
+.Os
+.Sh NAME
+.Nm colrm
+.Nd remove columns from a file
+.Sh SYNOPSIS
+.Nm
+.Op Ar start Op Ar stop
+.Sh DESCRIPTION
+The
+.Nm
+utility removes selected columns from the lines of a file.
+A column is defined as a single character in a line.
+Input is read from the standard input.
+Output is written to the standard output.
+.Pp
+If only the
+.Ar start
+column is specified, columns numbered less than the
+.Ar start
+column will be written.
+If both
+.Ar start
+and
+.Ar stop
+columns are specified, columns numbered less than the
+.Ar start
+column
+or greater than the
+.Ar stop
+column will be written.
+Column numbering starts with one, not zero.
+.Pp
+Tab characters increment the column count to the next multiple of eight.
+Backspace characters decrement the column count by one.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr awk 1 ,
+.Xr column 1 ,
+.Xr cut 1 ,
+.Xr paste 1
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 1 .
+.Sh AUTHORS
+.An Jeff Schriebman
+wrote the original version of
+.Nm
+in November 1974.
diff --git a/usr.bin/colrm/colrm.c b/usr.bin/colrm/colrm.c
new file mode 100644
index 0000000..c37a3ca
--- /dev/null
+++ b/usr.bin/colrm/colrm.c
@@ -0,0 +1,142 @@
+/*-
+ * Copyright (c) 1991, 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) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)colrm.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#define TAB 8
+
+void check(FILE *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ u_long column, start, stop;
+ int ch, width;
+ char *p;
+
+ setlocale(LC_ALL, "");
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ start = stop = 0;
+ switch(argc) {
+ case 2:
+ stop = strtol(argv[1], &p, 10);
+ if (stop <= 0 || *p)
+ errx(1, "illegal column -- %s", argv[1]);
+ /* FALLTHROUGH */
+ case 1:
+ start = strtol(argv[0], &p, 10);
+ if (start <= 0 || *p)
+ errx(1, "illegal column -- %s", argv[0]);
+ break;
+ case 0:
+ break;
+ default:
+ usage();
+ }
+
+ if (stop && start > stop)
+ errx(1, "illegal start and stop columns");
+
+ for (column = 0;;) {
+ switch (ch = getwchar()) {
+ case WEOF:
+ check(stdin);
+ break;
+ case '\b':
+ if (column)
+ --column;
+ break;
+ case '\n':
+ column = 0;
+ break;
+ case '\t':
+ column = (column + TAB) & ~(TAB - 1);
+ break;
+ default:
+ if ((width = wcwidth(ch)) > 0)
+ column += width;
+ break;
+ }
+
+ if ((!start || column < start || (stop && column > stop)) &&
+ putwchar(ch) == WEOF)
+ check(stdout);
+ }
+}
+
+void
+check(FILE *stream)
+{
+ if (feof(stream))
+ exit(0);
+ if (ferror(stream))
+ err(1, "%s", stream == stdin ? "stdin" : "stdout");
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: colrm [start [stop]]\n");
+ exit(1);
+}
+
diff --git a/usr.bin/column/Makefile b/usr.bin/column/Makefile
new file mode 100644
index 0000000..771723e
--- /dev/null
+++ b/usr.bin/column/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= column
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/column/Makefile.depend b/usr.bin/column/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/column/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/column/column.1 b/usr.bin/column/column.1
new file mode 100644
index 0000000..10aa57b
--- /dev/null
+++ b/usr.bin/column/column.1
@@ -0,0 +1,101 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" @(#)column.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd July 29, 2004
+.Dt COLUMN 1
+.Os
+.Sh NAME
+.Nm column
+.Nd columnate lists
+.Sh SYNOPSIS
+.Nm
+.Op Fl tx
+.Op Fl c Ar columns
+.Op Fl s Ar sep
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility formats its input into multiple columns.
+Rows are filled before columns.
+Input is taken from
+.Ar file
+operands, or, by default, from the standard input.
+Empty lines are ignored.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl c
+Output is formatted for a display
+.Ar columns
+wide.
+.It Fl s
+Specify a set of characters to be used to delimit columns for the
+.Fl t
+option.
+.It Fl t
+Determine the number of columns the input contains and create a table.
+Columns are delimited with whitespace, by default, or with the characters
+supplied using the
+.Fl s
+option.
+Useful for pretty-printing displays.
+.It Fl x
+Fill columns before filling rows.
+.El
+.Sh ENVIRONMENT
+The
+.Ev COLUMNS , LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Dl (printf \&"PERM LINKS OWNER GROUP SIZE MONTH DAY \&"\ \&;\ \&\e
+.Dl printf \&"HH:MM/YEAR NAME\en\&"\ \&;\ \&\e
+.Dl ls -l \&| sed 1d) \&| column -t
+.Sh SEE ALSO
+.Xr colrm 1 ,
+.Xr ls 1 ,
+.Xr paste 1 ,
+.Xr sort 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 Reno .
+.Sh BUGS
+Input lines are limited to
+.Dv LINE_MAX
+(2048) bytes in length.
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c
new file mode 100644
index 0000000..eb8ca66
--- /dev/null
+++ b/usr.bin/column/column.c
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * 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) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define TAB 8
+
+static void c_columnate(void);
+static void input(FILE *);
+static void maketbl(void);
+static void print(void);
+static void r_columnate(void);
+static void usage(void);
+static int width(const wchar_t *);
+
+static int termwidth = 80; /* default terminal width */
+
+static int entries; /* number of records */
+static int eval; /* exit value */
+static int maxlength; /* longest record */
+static wchar_t **list; /* array of pointers to records */
+static const wchar_t *separator = L"\t "; /* field separator for table option */
+
+int
+main(int argc, char **argv)
+{
+ struct winsize win;
+ FILE *fp;
+ int ch, tflag, xflag;
+ char *p;
+ const char *src;
+ wchar_t *newsep;
+ size_t seplen;
+
+ setlocale(LC_ALL, "");
+
+ if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
+ if ((p = getenv("COLUMNS")))
+ termwidth = atoi(p);
+ } else
+ termwidth = win.ws_col;
+
+ tflag = xflag = 0;
+ while ((ch = getopt(argc, argv, "c:s:tx")) != -1)
+ switch(ch) {
+ case 'c':
+ termwidth = atoi(optarg);
+ break;
+ case 's':
+ src = optarg;
+ seplen = mbsrtowcs(NULL, &src, 0, NULL);
+ if (seplen == (size_t)-1)
+ err(1, "bad separator");
+ newsep = malloc((seplen + 1) * sizeof(wchar_t));
+ if (newsep == NULL)
+ err(1, NULL);
+ mbsrtowcs(newsep, &src, seplen + 1, NULL);
+ separator = newsep;
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!*argv)
+ input(stdin);
+ else for (; *argv; ++argv)
+ if ((fp = fopen(*argv, "r"))) {
+ input(fp);
+ (void)fclose(fp);
+ } else {
+ warn("%s", *argv);
+ eval = 1;
+ }
+
+ if (!entries)
+ exit(eval);
+
+ maxlength = roundup(maxlength + 1, TAB);
+ if (tflag)
+ maketbl();
+ else if (maxlength >= termwidth)
+ print();
+ else if (xflag)
+ c_columnate();
+ else
+ r_columnate();
+ exit(eval);
+}
+
+static void
+c_columnate(void)
+{
+ int chcnt, col, cnt, endcol, numcols;
+ wchar_t **lp;
+
+ numcols = termwidth / maxlength;
+ endcol = maxlength;
+ for (chcnt = col = 0, lp = list;; ++lp) {
+ wprintf(L"%ls", *lp);
+ chcnt += width(*lp);
+ if (!--entries)
+ break;
+ if (++col == numcols) {
+ chcnt = col = 0;
+ endcol = maxlength;
+ putwchar('\n');
+ } else {
+ while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
+ (void)putwchar('\t');
+ chcnt = cnt;
+ }
+ endcol += maxlength;
+ }
+ }
+ if (chcnt)
+ putwchar('\n');
+}
+
+static void
+r_columnate(void)
+{
+ int base, chcnt, cnt, col, endcol, numcols, numrows, row;
+
+ numcols = termwidth / maxlength;
+ numrows = entries / numcols;
+ if (entries % numcols)
+ ++numrows;
+
+ for (row = 0; row < numrows; ++row) {
+ endcol = maxlength;
+ for (base = row, chcnt = col = 0; col < numcols; ++col) {
+ wprintf(L"%ls", list[base]);
+ chcnt += width(list[base]);
+ if ((base += numrows) >= entries)
+ break;
+ while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
+ (void)putwchar('\t');
+ chcnt = cnt;
+ }
+ endcol += maxlength;
+ }
+ putwchar('\n');
+ }
+}
+
+static void
+print(void)
+{
+ int cnt;
+ wchar_t **lp;
+
+ for (cnt = entries, lp = list; cnt--; ++lp)
+ (void)wprintf(L"%ls\n", *lp);
+}
+
+typedef struct _tbl {
+ wchar_t **list;
+ int cols, *len;
+} TBL;
+#define DEFCOLS 25
+
+static void
+maketbl(void)
+{
+ TBL *t;
+ int coloff, cnt;
+ wchar_t *p, **lp;
+ int *lens, maxcols;
+ TBL *tbl;
+ wchar_t **cols;
+ wchar_t *last;
+
+ if ((t = tbl = calloc(entries, sizeof(TBL))) == NULL)
+ err(1, NULL);
+ if ((cols = calloc((maxcols = DEFCOLS), sizeof(*cols))) == NULL)
+ err(1, NULL);
+ if ((lens = calloc(maxcols, sizeof(int))) == NULL)
+ err(1, NULL);
+ for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
+ for (coloff = 0, p = *lp;
+ (cols[coloff] = wcstok(p, separator, &last));
+ p = NULL)
+ if (++coloff == maxcols) {
+ if (!(cols = realloc(cols, ((u_int)maxcols +
+ DEFCOLS) * sizeof(wchar_t *))) ||
+ !(lens = realloc(lens,
+ ((u_int)maxcols + DEFCOLS) * sizeof(int))))
+ err(1, NULL);
+ memset((char *)lens + maxcols * sizeof(int),
+ 0, DEFCOLS * sizeof(int));
+ maxcols += DEFCOLS;
+ }
+ if ((t->list = calloc(coloff, sizeof(*t->list))) == NULL)
+ err(1, NULL);
+ if ((t->len = calloc(coloff, sizeof(int))) == NULL)
+ err(1, NULL);
+ for (t->cols = coloff; --coloff >= 0;) {
+ t->list[coloff] = cols[coloff];
+ t->len[coloff] = width(cols[coloff]);
+ if (t->len[coloff] > lens[coloff])
+ lens[coloff] = t->len[coloff];
+ }
+ }
+ for (cnt = 0, t = tbl; cnt < entries; ++cnt, ++t) {
+ for (coloff = 0; coloff < t->cols - 1; ++coloff)
+ (void)wprintf(L"%ls%*ls", t->list[coloff],
+ lens[coloff] - t->len[coloff] + 2, L" ");
+ (void)wprintf(L"%ls\n", t->list[coloff]);
+ }
+}
+
+#define DEFNUM 1000
+#define MAXLINELEN (LINE_MAX + 1)
+
+static void
+input(FILE *fp)
+{
+ static int maxentry;
+ int len;
+ wchar_t *p, buf[MAXLINELEN];
+
+ if (!list)
+ if ((list = calloc((maxentry = DEFNUM), sizeof(*list))) ==
+ NULL)
+ err(1, NULL);
+ while (fgetws(buf, MAXLINELEN, fp)) {
+ for (p = buf; *p && iswspace(*p); ++p);
+ if (!*p)
+ continue;
+ if (!(p = wcschr(p, L'\n'))) {
+ warnx("line too long");
+ eval = 1;
+ continue;
+ }
+ *p = L'\0';
+ len = width(buf);
+ if (maxlength < len)
+ maxlength = len;
+ if (entries == maxentry) {
+ maxentry += DEFNUM;
+ if (!(list = realloc(list,
+ (u_int)maxentry * sizeof(*list))))
+ err(1, NULL);
+ }
+ list[entries] = malloc((wcslen(buf) + 1) * sizeof(wchar_t));
+ if (list[entries] == NULL)
+ err(1, NULL);
+ wcscpy(list[entries], buf);
+ entries++;
+ }
+}
+
+/* Like wcswidth(), but ignores non-printing characters. */
+static int
+width(const wchar_t *wcs)
+{
+ int w, cw;
+
+ for (w = 0; *wcs != L'\0'; wcs++)
+ if ((cw = wcwidth(*wcs)) > 0)
+ w += cw;
+ return (w);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: column [-tx] [-c columns] [-s sep] [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/comm/Makefile b/usr.bin/comm/Makefile
new file mode 100644
index 0000000..ca91343
--- /dev/null
+++ b/usr.bin/comm/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= comm
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/comm/Makefile.depend b/usr.bin/comm/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/comm/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/comm/comm.1 b/usr.bin/comm/comm.1
new file mode 100644
index 0000000..e5fc940
--- /dev/null
+++ b/usr.bin/comm/comm.1
@@ -0,0 +1,118 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" From: @(#)comm.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 12, 2009
+.Dt COMM 1
+.Os
+.Sh NAME
+.Nm comm
+.Nd select or reject lines common to two files
+.Sh SYNOPSIS
+.Nm
+.Op Fl 123i
+.Ar file1 file2
+.Sh DESCRIPTION
+The
+.Nm
+utility reads
+.Ar file1
+and
+.Ar file2 ,
+which should be
+sorted lexically, and produces three text
+columns as output: lines only in
+.Ar file1 ;
+lines only in
+.Ar file2 ;
+and lines in both files.
+.Pp
+The filename ``-'' means the standard input.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl 1
+Suppress printing of column 1, lines only in
+.Ar file1 .
+.It Fl 2
+Suppress printing of column 2, lines only in
+.Ar file2 .
+.It Fl 3
+Suppress printing of column 3, lines common to both.
+.It Fl i
+Case insensitive comparison of lines.
+.El
+.Pp
+Each column will have a number of tab characters prepended to it
+equal to the number of lower numbered columns that are being printed.
+For example, if column number two is being suppressed, lines printed
+in column number one will not have any tabs preceding them, and lines
+printed in column number three will have one.
+.Pp
+The
+.Nm
+utility assumes that the files are lexically sorted; all characters
+participate in line comparisons.
+.Sh ENVIRONMENT
+The
+.Ev LANG ,
+.Ev LC_ALL ,
+.Ev LC_COLLATE ,
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr cmp 1 ,
+.Xr diff 1 ,
+.Xr sort 1 ,
+.Xr uniq 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.2-92 .
+.Pp
+The
+.Fl i
+option is an extension to the
+.Tn POSIX
+standard.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v4 .
diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c
new file mode 100644
index 0000000..54763e1
--- /dev/null
+++ b/usr.bin/comm/comm.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Case Larsen.
+ *
+ * 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) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "From: @(#)comm.c 8.4 (Berkeley) 5/4/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+static int iflag;
+static const char *tabs[] = { "", "\t", "\t\t" };
+
+static FILE *file(const char *);
+static wchar_t *convert(const char *);
+static void show(FILE *, const char *, const char *, char **, size_t *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int comp, read1, read2;
+ int ch, flag1, flag2, flag3;
+ FILE *fp1, *fp2;
+ const char *col1, *col2, *col3;
+ size_t line1len, line2len;
+ char *line1, *line2;
+ ssize_t n1, n2;
+ wchar_t *tline1, *tline2;
+ const char **p;
+
+ (void) setlocale(LC_ALL, "");
+
+ flag1 = flag2 = flag3 = 1;
+
+ while ((ch = getopt(argc, argv, "123i")) != -1)
+ switch(ch) {
+ case '1':
+ flag1 = 0;
+ break;
+ case '2':
+ flag2 = 0;
+ break;
+ case '3':
+ flag3 = 0;
+ break;
+ case 'i':
+ iflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ fp1 = file(argv[0]);
+ fp2 = file(argv[1]);
+
+ /* for each column printed, add another tab offset */
+ p = tabs;
+ col1 = col2 = col3 = NULL;
+ if (flag1)
+ col1 = *p++;
+ if (flag2)
+ col2 = *p++;
+ if (flag3)
+ col3 = *p;
+
+ line1len = line2len = 0;
+ line1 = line2 = NULL;
+ n1 = n2 = -1;
+
+ for (read1 = read2 = 1;;) {
+ /* read next line, check for EOF */
+ if (read1) {
+ n1 = getline(&line1, &line1len, fp1);
+ if (n1 < 0 && ferror(fp1))
+ err(1, "%s", argv[0]);
+ if (n1 > 0 && line1[n1 - 1] == '\n')
+ line1[n1 - 1] = '\0';
+
+ }
+ if (read2) {
+ n2 = getline(&line2, &line2len, fp2);
+ if (n2 < 0 && ferror(fp2))
+ err(1, "%s", argv[1]);
+ if (n2 > 0 && line2[n2 - 1] == '\n')
+ line2[n2 - 1] = '\0';
+ }
+
+ /* if one file done, display the rest of the other file */
+ if (n1 < 0) {
+ if (n2 >= 0 && col2 != NULL)
+ show(fp2, argv[1], col2, &line2, &line2len);
+ break;
+ }
+ if (n2 < 0) {
+ if (n1 >= 0 && col1 != NULL)
+ show(fp1, argv[0], col1, &line1, &line1len);
+ break;
+ }
+
+ tline2 = NULL;
+ if ((tline1 = convert(line1)) != NULL)
+ tline2 = convert(line2);
+ if (tline1 == NULL || tline2 == NULL)
+ comp = strcmp(line1, line2);
+ else
+ comp = wcscoll(tline1, tline2);
+ if (tline1 != NULL)
+ free(tline1);
+ if (tline2 != NULL)
+ free(tline2);
+
+ /* lines are the same */
+ if (!comp) {
+ read1 = read2 = 1;
+ if (col3 != NULL)
+ (void)printf("%s%s\n", col3, line1);
+ continue;
+ }
+
+ /* lines are different */
+ if (comp < 0) {
+ read1 = 1;
+ read2 = 0;
+ if (col1 != NULL)
+ (void)printf("%s%s\n", col1, line1);
+ } else {
+ read1 = 0;
+ read2 = 1;
+ if (col2 != NULL)
+ (void)printf("%s%s\n", col2, line2);
+ }
+ }
+ exit(0);
+}
+
+static wchar_t *
+convert(const char *str)
+{
+ size_t n;
+ wchar_t *buf, *p;
+
+ if ((n = mbstowcs(NULL, str, 0)) == (size_t)-1)
+ return (NULL);
+ if (SIZE_MAX / sizeof(*buf) < n + 1)
+ errx(1, "conversion buffer length overflow");
+ if ((buf = malloc((n + 1) * sizeof(*buf))) == NULL)
+ err(1, "malloc");
+ if (mbstowcs(buf, str, n + 1) != n)
+ errx(1, "internal mbstowcs() error");
+
+ if (iflag) {
+ for (p = buf; *p != L'\0'; p++)
+ *p = towlower(*p);
+ }
+
+ return (buf);
+}
+
+static void
+show(FILE *fp, const char *fn, const char *offset, char **bufp, size_t *buflenp)
+{
+ ssize_t n;
+
+ do {
+ (void)printf("%s%s\n", offset, *bufp);
+ if ((n = getline(bufp, buflenp, fp)) < 0)
+ break;
+ if (n > 0 && (*bufp)[n - 1] == '\n')
+ (*bufp)[n - 1] = '\0';
+ } while (1);
+ if (ferror(fp))
+ err(1, "%s", fn);
+}
+
+static FILE *
+file(const char *name)
+{
+ FILE *fp;
+
+ if (!strcmp(name, "-"))
+ return (stdin);
+ if ((fp = fopen(name, "r")) == NULL) {
+ err(1, "%s", name);
+ }
+ return (fp);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: comm [-123i] file1 file2\n");
+ exit(1);
+}
diff --git a/usr.bin/comm/tests/Makefile b/usr.bin/comm/tests/Makefile
new file mode 100644
index 0000000..653ad22
--- /dev/null
+++ b/usr.bin/comm/tests/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.00.out
+${PACKAGE}FILES+= regress.00a.in
+${PACKAGE}FILES+= regress.00b.in
+${PACKAGE}FILES+= regress.01.out
+${PACKAGE}FILES+= regress.01a.in
+${PACKAGE}FILES+= regress.01b.in
+${PACKAGE}FILES+= regress.02.out
+${PACKAGE}FILES+= regress.02a.in
+${PACKAGE}FILES+= regress.02b.in
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/comm/tests/Makefile.depend b/usr.bin/comm/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/comm/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/comm/tests/legacy_test.sh b/usr.bin/comm/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/comm/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/comm/tests/regress.00.out b/usr.bin/comm/tests/regress.00.out
new file mode 100644
index 0000000..89a65da
--- /dev/null
+++ b/usr.bin/comm/tests/regress.00.out
@@ -0,0 +1,2 @@
+a b
+e f g
diff --git a/usr.bin/comm/tests/regress.00a.in b/usr.bin/comm/tests/regress.00a.in
new file mode 100644
index 0000000..85b5cd5
--- /dev/null
+++ b/usr.bin/comm/tests/regress.00a.in
@@ -0,0 +1,5 @@
+a b
+c d
+e f
+e f g
+h i
diff --git a/usr.bin/comm/tests/regress.00b.in b/usr.bin/comm/tests/regress.00b.in
new file mode 100644
index 0000000..89a65da
--- /dev/null
+++ b/usr.bin/comm/tests/regress.00b.in
@@ -0,0 +1,2 @@
+a b
+e f g
diff --git a/usr.bin/comm/tests/regress.01.out b/usr.bin/comm/tests/regress.01.out
new file mode 100644
index 0000000..05ab154
--- /dev/null
+++ b/usr.bin/comm/tests/regress.01.out
@@ -0,0 +1,2 @@
+a b
+e f g
diff --git a/usr.bin/comm/tests/regress.01a.in b/usr.bin/comm/tests/regress.01a.in
new file mode 100644
index 0000000..78c410b
--- /dev/null
+++ b/usr.bin/comm/tests/regress.01a.in
@@ -0,0 +1,5 @@
+a b
+c d
+e f
+e f g
+h i
diff --git a/usr.bin/comm/tests/regress.01b.in b/usr.bin/comm/tests/regress.01b.in
new file mode 100644
index 0000000..05ab154
--- /dev/null
+++ b/usr.bin/comm/tests/regress.01b.in
@@ -0,0 +1,2 @@
+a b
+e f g
diff --git a/usr.bin/comm/tests/regress.02.out b/usr.bin/comm/tests/regress.02.out
new file mode 100644
index 0000000..a451adb
--- /dev/null
+++ b/usr.bin/comm/tests/regress.02.out
@@ -0,0 +1,5 @@
+a
+b
+ c
+ d
+ e
diff --git a/usr.bin/comm/tests/regress.02a.in b/usr.bin/comm/tests/regress.02a.in
new file mode 100644
index 0000000..1c943a9
--- /dev/null
+++ b/usr.bin/comm/tests/regress.02a.in
@@ -0,0 +1,3 @@
+a
+b
+c \ No newline at end of file
diff --git a/usr.bin/comm/tests/regress.02b.in b/usr.bin/comm/tests/regress.02b.in
new file mode 100644
index 0000000..36019ee
--- /dev/null
+++ b/usr.bin/comm/tests/regress.02b.in
@@ -0,0 +1,3 @@
+c
+d
+e \ No newline at end of file
diff --git a/usr.bin/comm/tests/regress.sh b/usr.bin/comm/tests/regress.sh
new file mode 100644
index 0000000..dcd0348
--- /dev/null
+++ b/usr.bin/comm/tests/regress.sh
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+echo 1..3
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `comm -12 ${SRCDIR}/regress.00a.in ${SRCDIR}/regress.00b.in')
+REGRESSION_TEST(`01', `comm -12 ${SRCDIR}/regress.01a.in ${SRCDIR}/regress.01b.in')
+REGRESSION_TEST(`02', `comm ${SRCDIR}/regress.02a.in ${SRCDIR}/regress.02b.in')
+
+REGRESSION_END()
diff --git a/usr.bin/compile_et/Makefile b/usr.bin/compile_et/Makefile
new file mode 100644
index 0000000..8af87ae
--- /dev/null
+++ b/usr.bin/compile_et/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/com_err
+
+PROG= compile_et
+SRCS= compile_et.c parse.y lex.l
+LIBADD= roken vers
+CFLAGS+=-I. -I${.CURDIR}/../../contrib/com_err
+
+WARNS?= 0
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/compile_et/Makefile.depend b/usr.bin/compile_et/Makefile.depend
new file mode 100644
index 0000000..1288666
--- /dev/null
+++ b/usr.bin/compile_et/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ kerberos5/lib/libroken \
+ kerberos5/lib/libvers \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/compress/Makefile b/usr.bin/compress/Makefile
new file mode 100644
index 0000000..a586b97f
--- /dev/null
+++ b/usr.bin/compress/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.2 (Berkeley) 4/17/94
+# $FreeBSD$
+
+PROG= compress
+SRCS= compress.c zopen.c
+LINKS= ${BINDIR}/compress ${BINDIR}/uncompress
+MLINKS= compress.1 uncompress.1
+
+# XXX zopen is not part of libc
+# MAN=zopen.3
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/compress/Makefile.depend b/usr.bin/compress/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/compress/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/compress/compress.1 b/usr.bin/compress/compress.1
new file mode 100644
index 0000000..b2018da
--- /dev/null
+++ b/usr.bin/compress/compress.1
@@ -0,0 +1,253 @@
+.\" Copyright (c) 1986, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" James A. Woods, derived from original work by Spencer Thomas
+.\" and Joseph Orost.
+.\"
+.\" 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.
+.\"
+.\" @(#)compress.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd May 17, 2002
+.Dt COMPRESS 1
+.Os
+.Sh NAME
+.Nm compress ,
+.Nm uncompress
+.Nd compress and expand data
+.Sh SYNOPSIS
+.Nm
+.Op Fl fv
+.Op Fl b Ar bits
+.Op Ar
+.Nm
+.Fl c
+.Op Fl b Ar bits
+.Op Ar file
+.Nm uncompress
+.Op Fl f
+.Op Ar
+.Nm uncompress
+.Fl c
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility reduces the size of files using adaptive Lempel-Ziv coding.
+Each
+.Ar file
+is renamed to the same name plus the extension
+.Pa .Z .
+A
+.Ar file
+argument with a
+.Pa .Z
+extension will be ignored except it will cause an
+error exit after other arguments are processed.
+If compression would not reduce the size of a
+.Ar file ,
+the file is ignored.
+.Pp
+The
+.Nm uncompress
+utility restores compressed files to their original form, renaming the
+files by deleting the
+.Pa .Z
+extensions.
+A file specification need not include the file's
+.Pa .Z
+extension.
+If a file's name in its file system does not have a
+.Pa .Z
+extension, it will not be uncompressed and it will cause
+an error exit after other arguments are processed.
+.Pp
+If renaming the files would cause files to be overwritten and the standard
+input device is a terminal, the user is prompted (on the standard error
+output) for confirmation.
+If prompting is not possible or confirmation is not received, the files
+are not overwritten.
+.Pp
+As many of the modification time, access time, file flags, file mode,
+user ID, and group ID as allowed by permissions are retained in the
+new file.
+.Pp
+If no files are specified or a
+.Ar file
+argument is a single dash
+.Pq Sq Fl ,
+the standard input is compressed or uncompressed to the standard output.
+If either the input and output files are not regular files, the checks for
+reduction in size and file overwriting are not performed, the input file is
+not removed, and the attributes of the input file are not retained
+in the output file.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl b Ar bits"
+.It Fl b Ar bits
+The code size (see below) is limited to
+.Ar bits ,
+which must be in the range 9..16.
+The default is 16.
+.It Fl c
+Compressed or uncompressed output is written to the standard output.
+No files are modified.
+The
+.Fl v
+option is ignored.
+Compression is attempted even if the results will be larger than the
+original.
+.It Fl f
+Files are overwritten without prompting for confirmation.
+Also, for
+.Nm compress ,
+files are compressed even if they are not actually reduced in size.
+.It Fl v
+Print the percentage reduction of each file.
+Ignored by
+.Nm uncompress
+or if the
+.Fl c
+option is also used.
+.El
+.Pp
+The
+.Nm
+utility uses a modified Lempel-Ziv algorithm.
+Common substrings in the file are first replaced by 9-bit codes 257 and up.
+When code 512 is reached, the algorithm switches to 10-bit codes and
+continues to use more bits until the
+limit specified by the
+.Fl b
+option or its default is reached.
+.Pp
+After the limit is reached,
+.Nm
+periodically checks the compression ratio.
+If it is increasing,
+.Nm
+continues to use the existing code dictionary.
+However, if the compression ratio decreases,
+.Nm
+discards the table of substrings and rebuilds it from scratch.
+This allows
+the algorithm to adapt to the next "block" of the file.
+.Pp
+The
+.Fl b
+option is unavailable for
+.Nm uncompress
+since the
+.Ar bits
+parameter specified during compression
+is encoded within the output, along with
+a magic number to ensure that neither decompression of random data nor
+recompression of compressed data is attempted.
+.Pp
+The amount of compression obtained depends on the size of the
+input, the number of
+.Ar bits
+per code, and the distribution of common substrings.
+Typically, text such as source code or English is reduced by 50\-60%.
+Compression is generally much better than that achieved by Huffman
+coding (as used in the historical command pack), or adaptive Huffman
+coding (as used in the historical command compact), and takes less
+time to compute.
+.Sh EXIT STATUS
+.Ex -std compress uncompress
+.Pp
+The
+.Nm compress
+utility exits 2 if attempting to compress a file would not reduce its size
+and the
+.Fl f
+option was not specified and if no other error occurs.
+.Sh SEE ALSO
+.Xr gunzip 1 ,
+.Xr gzexe 1 ,
+.Xr gzip 1 ,
+.Xr zcat 1 ,
+.Xr zmore 1 ,
+.Xr znew 1
+.Rs
+.%A Welch, Terry A.
+.%D June, 1984
+.%T "A Technique for High Performance Data Compression"
+.%J "IEEE Computer"
+.%V 17:6
+.%P pp. 8-19
+.Re
+.Sh STANDARDS
+The
+.Nm compress
+and
+.Nm uncompress
+utilities conform to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
+.Sh BUGS
+Some of these might be considered otherwise-undocumented features.
+.Pp
+.Nm compress :
+If the utility does not compress a file because doing so would not
+reduce its size, and a file of the same name except with an
+.Pa .Z
+extension exists, the named file is not really ignored as stated above;
+it causes a prompt to confirm the overwriting of the file with the extension.
+If the operation is confirmed, that file is deleted.
+.Pp
+.Nm uncompress :
+If an empty file is compressed (using
+.Fl f ) ,
+the resulting
+.Pa .Z
+file is also empty.
+That seems right, but if
+.Nm uncompress
+is then used on that file, an error will occur.
+.Pp
+Both utilities: If a
+.Sq Fl
+argument is used and the utility prompts the user, the standard input
+is taken as the user's reply to the prompt.
+.Pp
+Both utilities:
+If the specified file does not exist, but a similarly-named one with (for
+.Nm compress )
+or without (for
+.Nm uncompress )
+a
+.Pa .Z
+extension does exist, the utility will waste the user's time by not
+immediately emitting an error message about the missing file and
+continuing.
+Instead, it first asks for confirmation to overwrite
+the existing file and then does not overwrite it.
diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c
new file mode 100644
index 0000000..2d2efb3
--- /dev/null
+++ b/usr.bin/compress/compress.c
@@ -0,0 +1,437 @@
+/*-
+ * Copyright (c) 1992, 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) 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)compress.c 8.2 (Berkeley) 1/7/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "zopen.h"
+
+static void compress(const char *, const char *, int);
+static void cwarn(const char *, ...) __printflike(1, 2);
+static void cwarnx(const char *, ...) __printflike(1, 2);
+static void decompress(const char *, const char *, int);
+static int permission(const char *);
+static void setfile(const char *, struct stat *);
+static void usage(int);
+
+static int eval, force, verbose;
+
+int
+main(int argc, char *argv[])
+{
+ enum {COMPRESS, DECOMPRESS} style;
+ size_t len;
+ int bits, cat, ch;
+ char *p, newname[MAXPATHLEN];
+
+ cat = 0;
+ if ((p = strrchr(argv[0], '/')) == NULL)
+ p = argv[0];
+ else
+ ++p;
+ if (!strcmp(p, "uncompress"))
+ style = DECOMPRESS;
+ else if (!strcmp(p, "compress"))
+ style = COMPRESS;
+ else if (!strcmp(p, "zcat")) {
+ cat = 1;
+ style = DECOMPRESS;
+ } else
+ errx(1, "unknown program name");
+
+ bits = 0;
+ while ((ch = getopt(argc, argv, "b:cdfv")) != -1)
+ switch(ch) {
+ case 'b':
+ bits = strtol(optarg, &p, 10);
+ if (*p)
+ errx(1, "illegal bit count -- %s", optarg);
+ break;
+ case 'c':
+ cat = 1;
+ break;
+ case 'd': /* Backward compatible. */
+ style = DECOMPRESS;
+ break;
+ case 'f':
+ force = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case '?':
+ default:
+ usage(style == COMPRESS);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0) {
+ switch(style) {
+ case COMPRESS:
+ (void)compress("/dev/stdin", "/dev/stdout", bits);
+ break;
+ case DECOMPRESS:
+ (void)decompress("/dev/stdin", "/dev/stdout", bits);
+ break;
+ }
+ exit (eval);
+ }
+
+ if (cat == 1 && argc > 1)
+ errx(1, "the -c option permits only a single file argument");
+
+ for (; *argv; ++argv)
+ switch(style) {
+ case COMPRESS:
+ if (strcmp(*argv, "-") == 0) {
+ compress("/dev/stdin", "/dev/stdout", bits);
+ break;
+ } else if (cat) {
+ compress(*argv, "/dev/stdout", bits);
+ break;
+ }
+ if ((p = strrchr(*argv, '.')) != NULL &&
+ !strcmp(p, ".Z")) {
+ cwarnx("%s: name already has trailing .Z",
+ *argv);
+ break;
+ }
+ len = strlen(*argv);
+ if (len > sizeof(newname) - 3) {
+ cwarnx("%s: name too long", *argv);
+ break;
+ }
+ memmove(newname, *argv, len);
+ newname[len] = '.';
+ newname[len + 1] = 'Z';
+ newname[len + 2] = '\0';
+ compress(*argv, newname, bits);
+ break;
+ case DECOMPRESS:
+ if (strcmp(*argv, "-") == 0) {
+ decompress("/dev/stdin", "/dev/stdout", bits);
+ break;
+ }
+ len = strlen(*argv);
+ if ((p = strrchr(*argv, '.')) == NULL ||
+ strcmp(p, ".Z")) {
+ if (len > sizeof(newname) - 3) {
+ cwarnx("%s: name too long", *argv);
+ break;
+ }
+ memmove(newname, *argv, len);
+ newname[len] = '.';
+ newname[len + 1] = 'Z';
+ newname[len + 2] = '\0';
+ decompress(newname,
+ cat ? "/dev/stdout" : *argv, bits);
+ } else {
+ if (len - 2 > sizeof(newname) - 1) {
+ cwarnx("%s: name too long", *argv);
+ break;
+ }
+ memmove(newname, *argv, len - 2);
+ newname[len - 2] = '\0';
+ decompress(*argv,
+ cat ? "/dev/stdout" : newname, bits);
+ }
+ break;
+ }
+ exit (eval);
+}
+
+static void
+compress(const char *in, const char *out, int bits)
+{
+ size_t nr;
+ struct stat isb, sb;
+ FILE *ifp, *ofp;
+ int exists, isreg, oreg;
+ u_char buf[1024];
+
+ exists = !stat(out, &sb);
+ if (!force && exists && S_ISREG(sb.st_mode) && !permission(out))
+ return;
+ isreg = oreg = !exists || S_ISREG(sb.st_mode);
+
+ ifp = ofp = NULL;
+ if ((ifp = fopen(in, "r")) == NULL) {
+ cwarn("%s", in);
+ return;
+ }
+ if (stat(in, &isb)) { /* DON'T FSTAT! */
+ cwarn("%s", in);
+ goto err;
+ }
+ if (!S_ISREG(isb.st_mode))
+ isreg = 0;
+
+ if ((ofp = zopen(out, "w", bits)) == NULL) {
+ cwarn("%s", out);
+ goto err;
+ }
+ while ((nr = fread(buf, 1, sizeof(buf), ifp)) != 0)
+ if (fwrite(buf, 1, nr, ofp) != nr) {
+ cwarn("%s", out);
+ goto err;
+ }
+
+ if (ferror(ifp) || fclose(ifp)) {
+ cwarn("%s", in);
+ goto err;
+ }
+ ifp = NULL;
+
+ if (fclose(ofp)) {
+ cwarn("%s", out);
+ goto err;
+ }
+ ofp = NULL;
+
+ if (isreg) {
+ if (stat(out, &sb)) {
+ cwarn("%s", out);
+ goto err;
+ }
+
+ if (!force && sb.st_size >= isb.st_size) {
+ if (verbose)
+ (void)fprintf(stderr, "%s: file would grow; left unmodified\n",
+ in);
+ eval = 2;
+ if (unlink(out))
+ cwarn("%s", out);
+ goto err;
+ }
+
+ setfile(out, &isb);
+
+ if (unlink(in))
+ cwarn("%s", in);
+
+ if (verbose) {
+ (void)fprintf(stderr, "%s: ", out);
+ if (isb.st_size > sb.st_size)
+ (void)fprintf(stderr, "%.0f%% compression\n",
+ ((float)sb.st_size / isb.st_size) * 100.0);
+ else
+ (void)fprintf(stderr, "%.0f%% expansion\n",
+ ((float)isb.st_size / sb.st_size) * 100.0);
+ }
+ }
+ return;
+
+err: if (ofp) {
+ if (oreg)
+ (void)unlink(out);
+ (void)fclose(ofp);
+ }
+ if (ifp)
+ (void)fclose(ifp);
+}
+
+static void
+decompress(const char *in, const char *out, int bits)
+{
+ size_t nr;
+ struct stat sb;
+ FILE *ifp, *ofp;
+ int exists, isreg, oreg;
+ u_char buf[1024];
+
+ exists = !stat(out, &sb);
+ if (!force && exists && S_ISREG(sb.st_mode) && !permission(out))
+ return;
+ isreg = oreg = !exists || S_ISREG(sb.st_mode);
+
+ ifp = ofp = NULL;
+ if ((ifp = zopen(in, "r", bits)) == NULL) {
+ cwarn("%s", in);
+ return;
+ }
+ if (stat(in, &sb)) {
+ cwarn("%s", in);
+ goto err;
+ }
+ if (!S_ISREG(sb.st_mode))
+ isreg = 0;
+
+ /*
+ * Try to read the first few uncompressed bytes from the input file
+ * before blindly truncating the output file.
+ */
+ if ((nr = fread(buf, 1, sizeof(buf), ifp)) == 0) {
+ cwarn("%s", in);
+ (void)fclose(ifp);
+ return;
+ }
+ if ((ofp = fopen(out, "w")) == NULL ||
+ (nr != 0 && fwrite(buf, 1, nr, ofp) != nr)) {
+ cwarn("%s", out);
+ (void)fclose(ifp);
+ return;
+ }
+
+ while ((nr = fread(buf, 1, sizeof(buf), ifp)) != 0)
+ if (fwrite(buf, 1, nr, ofp) != nr) {
+ cwarn("%s", out);
+ goto err;
+ }
+
+ if (ferror(ifp) || fclose(ifp)) {
+ cwarn("%s", in);
+ goto err;
+ }
+ ifp = NULL;
+
+ if (fclose(ofp)) {
+ cwarn("%s", out);
+ goto err;
+ }
+
+ if (isreg) {
+ setfile(out, &sb);
+
+ if (unlink(in))
+ cwarn("%s", in);
+ }
+ return;
+
+err: if (ofp) {
+ if (oreg)
+ (void)unlink(out);
+ (void)fclose(ofp);
+ }
+ if (ifp)
+ (void)fclose(ifp);
+}
+
+static void
+setfile(const char *name, struct stat *fs)
+{
+ static struct timespec tspec[2];
+
+ fs->st_mode &= S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
+
+ tspec[0] = fs->st_atim;
+ tspec[1] = fs->st_mtim;
+ if (utimensat(AT_FDCWD, name, tspec, 0))
+ cwarn("utimensat: %s", name);
+
+ /*
+ * Changing the ownership probably won't succeed, unless we're root
+ * or POSIX_CHOWN_RESTRICTED is not set. Set uid/gid before setting
+ * the mode; current BSD behavior is to remove all setuid bits on
+ * chown. If chown fails, lose setuid/setgid bits.
+ */
+ if (chown(name, fs->st_uid, fs->st_gid)) {
+ if (errno != EPERM)
+ cwarn("chown: %s", name);
+ fs->st_mode &= ~(S_ISUID|S_ISGID);
+ }
+ if (chmod(name, fs->st_mode) && errno != EOPNOTSUPP)
+ cwarn("chmod: %s", name);
+
+ if (chflags(name, fs->st_flags) && errno != EOPNOTSUPP)
+ cwarn("chflags: %s", name);
+}
+
+static int
+permission(const char *fname)
+{
+ int ch, first;
+
+ if (!isatty(fileno(stderr)))
+ return (0);
+ (void)fprintf(stderr, "overwrite %s? ", fname);
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ return (first == 'y');
+}
+
+static void
+usage(int iscompress)
+{
+ if (iscompress)
+ (void)fprintf(stderr,
+ "usage: compress [-cfv] [-b bits] [file ...]\n");
+ else
+ (void)fprintf(stderr,
+ "usage: uncompress [-c] [-b bits] [file ...]\n");
+ exit(1);
+}
+
+static void
+cwarnx(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vwarnx(fmt, ap);
+ va_end(ap);
+ eval = 1;
+}
+
+static void
+cwarn(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vwarn(fmt, ap);
+ va_end(ap);
+ eval = 1;
+}
diff --git a/usr.bin/compress/doc/NOTES b/usr.bin/compress/doc/NOTES
new file mode 100644
index 0000000..ef3931a
--- /dev/null
+++ b/usr.bin/compress/doc/NOTES
@@ -0,0 +1,142 @@
+
+ $FreeBSD$
+
+From: James A. Woods <jaw@eos.arc.nasa.gov>
+
+>From vn Fri Dec 2 18:05:27 1988
+Subject: Re: Looking for C source for RSA
+Newsgroups: sci.crypt
+
+# Illegitimi noncarborundum
+
+Patents are a tar pit.
+
+A good case can be made that most are just a license to sue, and nothing
+is illegal until a patent is upheld in court.
+
+For example, if you receive netnews by means other than 'nntp',
+these very words are being modulated by 'compress',
+a variation on the patented Lempel-Ziv-Welch algorithm.
+
+Original Ziv-Lempel is patent number 4,464,650, and the more powerful
+LZW method is #4,558,302. Yet despite any similarities between 'compress'
+and LZW (the public-domain 'compress' code was designed and given to the
+world before the ink on the Welch patent was dry), no attorneys from Sperry
+(the assignee) have asked you to unplug your Usenet connection.
+
+Why? I can't speak for them, but it is possible the claims are too broad,
+or, just as bad, not broad enough. ('compress' does things not mentioned
+in the Welch patent.) Maybe they realize that they can commercialize
+LZW better by selling hardware implementations rather than by licensing
+software. Again, the LZW software delineated in the patent is *not*
+the same as that of 'compress'.
+
+At any rate, court-tested software patents are a different animal;
+corporate patents in a portfolio are usually traded like baseball cards
+to shut out small fry rather than actually be defended before
+non-technical juries. Perhaps RSA will undergo this test successfully,
+although the grant to "exclude others from making, using, or selling"
+the invention would then only apply to the U.S. (witness the
+Genentech patent of the TPA molecule in the U.S. but struck down
+in Great Britain as too broad.)
+
+The concept is still exotic for those who learned in school the rule of thumb
+that one may patent "apparatus" but not an "idea".
+Apparently this all changed in Diamond v. Diehr (1981) when the U. S. Supreme
+Court reversed itself.
+
+Scholars should consult the excellent article in the Washington and Lee
+Law Review (fall 1984, vol. 41, no. 4) by Anthony and Colwell for a
+comprehensive survey of an area which will remain murky for some time.
+
+Until the dust clears, how you approach ideas which are patented depends
+on how paranoid you are of a legal onslaught. Arbitrary? Yes. But
+the patent bar of the CCPA (Court of Customs and Patent Appeals)
+thanks you for any uncertainty as they, at least, stand to gain
+from any trouble.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+From: James A. Woods <jaw@eos.arc.nasa.gov>
+Subject: Re: Looking for C source for RSA (actually 'compress' patents)
+
+ In article <2042@eos.UUCP> you write:
+ >The concept is still exotic for those who learned in school the rule of thumb
+ >that one may patent "apparatus" but not an "idea".
+
+A rule of thumb that has never been completely valid, as any chemical
+engineer can tell you. (Chemical processes were among the earliest patents,
+as I recall.)
+
+ ah yes -- i date myself when relaying out-of-date advice from elderly
+ attorneys who don't even specialize in patents. one other interesting
+ class of patents include the output of optical lens design programs,
+ which yield formulae which can then fairly directly can be molded
+ into glass. although there are restrictions on patenting equations,
+ the "embedded systems" seem to fly past the legal gauntlets.
+
+ anyway, I'm still learning about intellectual property law after
+ several conversations from a Unisys (nee sperry) lawyer re 'compress'.
+
+ it's more complicated than this, but they're letting (oral
+ communication only) software versions of 'compress' slide
+ as far as licensing fees go. this includes 'arc', 'stuffit',
+ and other commercial wrappers for 'compress'. yet they are
+ signing up licensees for hardware chips. Hewlett-Packard
+ supposedly has an active vlsi project, and Unisys has
+ board-level LZW-based tape controllers. (to build LZW into
+ a disk controller would be strange, as you'd have to build
+ in a filesystem too!)
+
+ it's byzantine
+ that Unisys is in a tiff with HP regarding the patents,
+ after discovering some sort of "compress" button on some
+ HP terminal product. why? well, professor Abraham Lempel jumped
+ from being department chairman of computer science at technion in
+ Israel to sperry (where he got the first patent), but then to work
+ at Hewlett-Packard on sabbatical. the second Welch patent
+ is only weakly derivative of the first, so they want chip
+ licenses and HP relented. however, everyone agrees something
+ like the current Unix implementation is the way to go with
+ software, so HP (and UCB) long ago asked spencer Thomas and i to sign
+ off on copyright permission (although they didn't need to, it being pd).
+ Lempel, HP, and Unisys grumbles they can't make money off the
+ software since a good free implementation (not the best --
+ i have more ideas!) escaped via Usenet. (Lempel's own pascal
+ code was apparently horribly slow.)
+ i don't follow the IBM 'arc' legal bickering; my impression
+ is that the pc folks are making money off the archiver/wrapper
+ look/feel of the thing [if ms-dos can be said to have a look and feel].
+
+ now where is telebit with the compress firmware? in a limbo
+ netherworld, probably, with sperry still welcoming outfits
+ to sign patent licenses, a common tactic to bring other small fry
+ into the fold. the guy who crammed 12-bit compress into the modem
+ there left. also what is transpiring with 'compress' and sys 5 rel 4?
+ beats me, but if sperry got a hold of them on these issues,
+ at&t would likely re-implement another algorithm if they
+ thought 'compress' infringes. needful to say, i don't think
+ it does after the above mentioned legal conversation.
+ my own beliefs on whether algorithms should be patentable at all
+ change with the weather. if the courts finally nail down
+ patent protection for algorithms, academic publication in
+ textbooks will be somewhat at odds with the engineering world,
+ where the textbook codes will simply be a big tease to get
+ money into the patent holder coffers...
+
+ oh, if you implement LZW from the patent, you won't get
+ good rates because it doesn't mention adaptive table reset,
+ lack thereof being *the* serious deficiency of Thomas' first version.
+
+ now i know that patent law generally protects against independent
+ re-invention (like the 'xor' hash function pleasantly mentioned
+ in the patent [but not the paper]).
+ but the upshot is that if anyone ever wanted to sue us,
+ we're partially covered with
+ independently-developed twists, plus the fact that some of us work
+ in a bureaucratic morass (as contractor to a public agency in my case).
+
+ quite a mess, huh? I've wanted to tell someone this stuff
+ for a long time, for posterity if nothing else.
+
+james
+
diff --git a/usr.bin/compress/doc/README b/usr.bin/compress/doc/README
new file mode 100644
index 0000000..2b5f6ba
--- /dev/null
+++ b/usr.bin/compress/doc/README
@@ -0,0 +1,284 @@
+
+ @(#)README 8.1 (Berkeley) 6/9/93
+ $FreeBSD$
+
+Compress version 4.0 improvements over 3.0:
+ o compress() speedup (10-50%) by changing division hash to xor
+ o decompress() speedup (5-10%)
+ o Memory requirements reduced (3-30%)
+ o Stack requirements reduced to less than 4kb
+ o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
+ o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
+ o Default to 'quiet' mode
+ o Unification of 'force' flags
+ o Manual page overhaul
+ o Portability enhancement for M_XENIX
+ o Removed text on #else and #endif
+ o Added "-V" switch to print version and options
+ o Added #defines for SIGNED_COMPARE_SLOW
+ o Added Makefile and "usermem" program
+ o Removed all floating point computations
+ o New programs: [deleted]
+
+The "usermem" script attempts to determine the maximum process size. Some
+editing of the script may be necessary (see the comments). [It should work
+fine on 4.3 BSD.] If you can't get it to work at all, just create file
+"USERMEM" containing the maximum process size in decimal.
+
+The following preprocessor symbols control the compilation of "compress.c":
+
+ o USERMEM Maximum process memory on the system
+ o SACREDMEM Amount to reserve for other processes
+ o SIGNED_COMPARE_SLOW Unsigned compare instructions are faster
+ o NO_UCHAR Don't use "unsigned char" types
+ o BITS Overrules default set by USERMEM-SACREDMEM
+ o vax Generate inline assembler
+ o interdata Defines SIGNED_COMPARE_SLOW
+ o M_XENIX Makes arrays < 65536 bytes each
+ o pdp11 BITS=12, NO_UCHAR
+ o z8000 BITS=12
+ o pcxt BITS=12
+ o BSD4_2 Allow long filenames ( > 14 characters) &
+ Call setlinebuf(stderr)
+
+The difference "usermem-sacredmem" determines the maximum BITS that can be
+specified with the "-b" flag.
+
+memory: at least BITS
+------ -- ----- ----
+ 433,484 16
+ 229,600 15
+ 127,536 14
+ 73,464 13
+ 0 12
+
+The default is BITS=16.
+
+The maximum bits can be overruled by specifying "-DBITS=bits" at
+compilation time.
+
+WARNING: files compressed on a large machine with more bits than allowed by
+a version of compress on a smaller machine cannot be decompressed! Use the
+"-b12" flag to generate a file on a large machine that can be uncompressed
+on a 16-bit machine.
+
+The output of compress 4.0 is fully compatible with that of compress 3.0.
+In other words, the output of compress 4.0 may be fed into uncompress 3.0 or
+the output of compress 3.0 may be fed into uncompress 4.0.
+
+The output of compress 4.0 not compatible with that of
+compress 2.0. However, compress 4.0 still accepts the output of
+compress 2.0. To generate output that is compatible with compress
+2.0, use the undocumented "-C" flag.
+
+ -from mod.sources, submitted by vax135!petsd!joe (Joe Orost), 8/1/85
+--------------------------------
+
+Enclosed is compress version 3.0 with the following changes:
+
+1. "Block" compression is performed. After the BITS run out, the
+ compression ratio is checked every so often. If it is decreasing,
+ the table is cleared and a new set of substrings are generated.
+
+ This makes the output of compress 3.0 not compatible with that of
+ compress 2.0. However, compress 3.0 still accepts the output of
+ compress 2.0. To generate output that is compatible with compress
+ 2.0, use the undocumented "-C" flag.
+
+2. A quiet "-q" flag has been added for use by the news system.
+
+3. The character chaining has been deleted and the program now uses
+ hashing. This improves the speed of the program, especially
+ during decompression. Other speed improvements have been made,
+ such as using putc() instead of fwrite().
+
+4. A large table is used on large machines when a relatively small
+ number of bits is specified. This saves much time when compressing
+ for a 16-bit machine on a 32-bit virtual machine. Note that the
+ speed improvement only occurs when the input file is > 30000
+ characters, and the -b BITS is less than or equal to the cutoff
+ described below.
+
+Most of these changes were made by James A. Woods (ames!jaw). Thank you
+James!
+
+To compile compress:
+
+ cc -O -DUSERMEM=usermem -o compress compress.c
+
+Where "usermem" is the amount of physical user memory available (in bytes).
+If any physical memory is to be reserved for other processes, put in
+"-DSACREDMEM sacredmem", where "sacredmem" is the amount to be reserved.
+
+The difference "usermem-sacredmem" determines the maximum BITS that can be
+specified, and the cutoff bits where the large+fast table is used.
+
+memory: at least BITS cutoff
+------ -- ----- ---- ------
+ 4,718,592 16 13
+ 2,621,440 16 12
+ 1,572,864 16 11
+ 1,048,576 16 10
+ 631,808 16 --
+ 329,728 15 --
+ 178,176 14 --
+ 99,328 13 --
+ 0 12 --
+
+The default memory size is 750,000 which gives a maximum BITS=16 and no
+large+fast table.
+
+The maximum bits can be overruled by specifying "-DBITS=bits" at
+compilation time.
+
+If your machine doesn't support unsigned characters, define "NO_UCHAR"
+when compiling.
+
+If your machine has "int" as 16-bits, define "SHORT_INT" when compiling.
+
+After compilation, move "compress" to a standard executable location, such
+as /usr/local. Then:
+ cd /usr/local
+ ln compress uncompress
+ ln compress zcat
+
+On machines that have a fixed stack size (such as Perkin-Elmer), set the
+stack to at least 12kb. ("setstack compress 12" on Perkin-Elmer).
+
+Next, install the manual (compress.l).
+ cp compress.l /usr/man/manl
+ cd /usr/man/manl
+ ln compress.l uncompress.l
+ ln compress.l zcat.l
+
+ - or -
+
+ cp compress.l /usr/man/man1/compress.1
+ cd /usr/man/man1
+ ln compress.1 uncompress.1
+ ln compress.1 zcat.1
+
+ regards,
+ petsd!joe
+
+Here is a note from the net:
+
+>From hplabs!pesnta!amd!turtlevax!ken Sat Jan 5 03:35:20 1985
+Path: ames!hplabs!pesnta!amd!turtlevax!ken
+From: ken@turtlevax.UUCP (Ken Turkowski)
+Newsgroups: net.sources
+Subject: Re: Compress release 3.0 : sample Makefile
+Organization: CADLINC, Inc. @ Menlo Park, CA
+
+In the compress 3.0 source recently posted to mod.sources, there is a
+#define variable which can be set for optimum performance on a machine
+with a large amount of memory. A program (usermem) to calculate the
+usable amount of physical user memory is enclosed, as well as a sample
+4.2BSD Vax Makefile for compress.
+
+Here is the README file from the previous version of compress (2.0):
+
+>Enclosed is compress.c version 2.0 with the following bugs fixed:
+>
+>1. The packed files produced by compress are different on different
+> machines and dependent on the vax sysgen option.
+> The bug was in the different byte/bit ordering on the
+> various machines. This has been fixed.
+>
+> This version is NOT compatible with the original vax posting
+> unless the '-DCOMPATIBLE' option is specified to the C
+> compiler. The original posting has a bug which I fixed,
+> causing incompatible files. I recommend you NOT to use this
+> option unless you already have a lot of packed files from
+> the original posting by Thomas.
+>2. The exit status is not well defined (on some machines) causing the
+> scripts to fail.
+> The exit status is now 0,1 or 2 and is documented in
+> compress.l.
+>3. The function getopt() is not available in all C libraries.
+> The function getopt() is no longer referenced by the
+> program.
+>4. Error status is not being checked on the fwrite() and fflush() calls.
+> Fixed.
+>
+>The following enhancements have been made:
+>
+>1. Added facilities of "compact" into the compress program. "Pack",
+> "Unpack", and "Pcat" are no longer required (no longer supplied).
+>2. Installed work around for C compiler bug with "-O".
+>3. Added a magic number header (\037\235). Put the bits specified
+> in the file.
+>4. Added "-f" flag to force overwrite of output file.
+>5. Added "-c" flag and "zcat" program. 'ln compress zcat' after you
+> compile.
+>6. The 'uncompress' script has been deleted; simply
+> 'ln compress uncompress' after you compile and it will work.
+>7. Removed extra bit masking for machines that support unsigned
+> characters. If your machine doesn't support unsigned characters,
+> define "NO_UCHAR" when compiling.
+>
+>Compile "compress.c" with "-O -o compress" flags. Move "compress" to a
+>standard executable location, such as /usr/local. Then:
+> cd /usr/local
+> ln compress uncompress
+> ln compress zcat
+>
+>On machines that have a fixed stack size (such as Perkin-Elmer), set the
+>stack to at least 12kb. ("setstack compress 12" on Perkin-Elmer).
+>
+>Next, install the manual (compress.l).
+> cp compress.l /usr/man/manl - or -
+> cp compress.l /usr/man/man1/compress.1
+>
+>Here is the README that I sent with my first posting:
+>
+>>Enclosed is a modified version of compress.c, along with scripts to make it
+>>run identically to pack(1), unpack(1), and pcat(1). Here is what I
+>>(petsd!joe) and a colleague (petsd!peora!srd) did:
+>>
+>>1. Removed VAX dependencies.
+>>2. Changed the struct to separate arrays; saves mucho memory.
+>>3. Did comparisons in unsigned, where possible. (Faster on Perkin-Elmer.)
+>>4. Sorted the character next chain and changed the search to stop
+>>prematurely. This saves a lot on the execution time when compressing.
+>>
+>>This version is totally compatible with the original version. Even though
+>>lint(1) -p has no complaints about compress.c, it won't run on a 16-bit
+>>machine, due to the size of the arrays.
+>>
+>>Here is the README file from the original author:
+>>
+>>>Well, with all this discussion about file compression (for news batching
+>>>in particular) going around, I decided to implement the text compression
+>>>algorithm described in the June Computer magazine. The author claimed
+>>>blinding speed and good compression ratios. It's certainly faster than
+>>>compact (but, then, what wouldn't be), but it's also the same speed as
+>>>pack, and gets better compression than both of them. On 350K bytes of
+>>>Unix-wizards, compact took about 8 minutes of CPU, pack took about 80
+>>>seconds, and compress (herein) also took 80 seconds. But, compact and
+>>>pack got about 30% compression, whereas compress got over 50%. So, I
+>>>decided I had something, and that others might be interested, too.
+>>>
+>>>As is probably true of compact and pack (although I haven't checked),
+>>>the byte order within a word is probably relevant here, but as long as
+>>>you stay on a single machine type, you should be ok. (Can anybody
+>>>elucidate on this?) There are a couple of asm's in the code (extv and
+>>>insv instructions), so anyone porting it to another machine will have to
+>>>deal with this anyway (and could probably make it compatible with Vax
+>>>byte order at the same time). Anyway, I've linted the code (both with
+>>>and without -p), so it should run elsewhere. Note the longs in the
+>>>code, you can take these out if you reduce BITS to <= 15.
+>>>
+>>>Have fun, and as always, if you make good enhancements, or bug fixes,
+>>>I'd like to see them.
+>>>
+>>>=Spencer (thomas@utah-20, {harpo,hplabs,arizona}!utah-cs!thomas)
+>>
+>> regards,
+>> joe
+>>
+>>--
+>>Full-Name: Joseph M. Orost
+>>UUCP: ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
+>>US Mail: MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
+>>Phone: (201) 870-5844
diff --git a/usr.bin/compress/doc/revision.log b/usr.bin/compress/doc/revision.log
new file mode 100644
index 0000000..2d5d9d9
--- /dev/null
+++ b/usr.bin/compress/doc/revision.log
@@ -0,0 +1,118 @@
+/* $FreeBSD$ */
+
+/*
+ * $Header: compress.c,v 4.0 85/07/30 12:50:00 joe Release $
+ *
+ * Revision 4.0 85/07/30 12:50:00 joe
+ * Removed ferror() calls in output routine on every output except first.
+ * Prepared for release to the world.
+ *
+ * Revision 3.6 85/07/04 01:22:21 joe
+ * Remove much wasted storage by overlaying hash table with the tables
+ * used by decompress: tab_suffix[1<<BITS], stack[8000]. Updated USERMEM
+ * computations. Fixed dump_tab() DEBUG routine.
+ *
+ * Revision 3.5 85/06/30 20:47:21 jaw
+ * Change hash function to use exclusive-or. Rip out hash cache. These
+ * speedups render the megamemory version defunct, for now. Make decoder
+ * stack global. Parts of the RCS trunks 2.7, 2.6, and 2.1 no longer apply.
+ *
+ * Revision 3.4 85/06/27 12:00:00 ken
+ * Get rid of all floating-point calculations by doing all compression ratio
+ * calculations in fixed point.
+ *
+ * Revision 3.3 85/06/24 21:53:24 joe
+ * Incorporate portability suggestion for M_XENIX. Got rid of text on #else
+ * and #endif lines. Cleaned up #ifdefs for vax and interdata.
+ *
+ * Revision 3.2 85/06/06 21:53:24 jaw
+ * Incorporate portability suggestions for Z8000, IBM PC/XT from mailing list.
+ * Default to "quiet" output (no compression statistics).
+ *
+ * Revision 3.1 85/05/12 18:56:13 jaw
+ * Integrate decompress() stack speedups (from early pointer mods by McKie).
+ * Repair multi-file USERMEM gaffe. Unify 'force' flags to mimic semantics
+ * of SVR2 'pack'. Streamline block-compress table clear logic. Increase
+ * output byte count by magic number size.
+ *
+ * Revision 3.0 84/11/27 11:50:00 petsd!joe
+ * Set HSIZE depending on BITS. Set BITS depending on USERMEM. Unrolled
+ * loops in clear routines. Added "-C" flag for 2.0 compatibility. Used
+ * unsigned compares on Perkin-Elmer. Fixed foreground check.
+ *
+ * Revision 2.7 84/11/16 19:35:39 ames!jaw
+ * Cache common hash codes based on input statistics; this improves
+ * performance for low-density raster images. Pass on #ifdef bundle
+ * from Turkowski.
+ *
+ * Revision 2.6 84/11/05 19:18:21 ames!jaw
+ * Vary size of hash tables to reduce time for small files.
+ * Tune PDP-11 hash function.
+ *
+ * Revision 2.5 84/10/30 20:15:14 ames!jaw
+ * Junk chaining; replace with the simpler (and, on the VAX, faster)
+ * double hashing, discussed within. Make block compression standard.
+ *
+ * Revision 2.4 84/10/16 11:11:11 ames!jaw
+ * Introduce adaptive reset for block compression, to boost the rate
+ * another several percent. (See mailing list notes.)
+ *
+ * Revision 2.3 84/09/22 22:00:00 petsd!joe
+ * Implemented "-B" block compress. Implemented REVERSE sorting of tab_next.
+ * Bug fix for last bits. Changed fwrite to putchar loop everywhere.
+ *
+ * Revision 2.2 84/09/18 14:12:21 ames!jaw
+ * Fold in news changes, small machine typedef from thomas,
+ * #ifdef interdata from joe.
+ *
+ * Revision 2.1 84/09/10 12:34:56 ames!jaw
+ * Configured fast table lookup for 32-bit machines.
+ * This cuts user time in half for b <= FBITS, and is useful for news batching
+ * from VAX to PDP sites. Also sped up decompress() [fwrite->putc] and
+ * added signal catcher [plus beef in writeerr()] to delete effluvia.
+ *
+ * Revision 2.0 84/08/28 22:00:00 petsd!joe
+ * Add check for foreground before prompting user. Insert maxbits into
+ * compressed file. Force file being uncompressed to end with ".Z".
+ * Added "-c" flag and "zcat". Prepared for release.
+ *
+ * Revision 1.10 84/08/24 18:28:00 turtlevax!ken
+ * Will only compress regular files (no directories), added a magic number
+ * header (plus an undocumented -n flag to handle old files without headers),
+ * added -f flag to force overwriting of possibly existing destination file,
+ * otherwise the user is prompted for a response. Will tack on a .Z to a
+ * filename if it doesn't have one when decompressing. Will only replace
+ * file if it was compressed.
+ *
+ * Revision 1.9 84/08/16 17:28:00 turtlevax!ken
+ * Removed scanargs(), getopt(), added .Z extension and unlimited number of
+ * filenames to compress. Flags may be clustered (-Ddvb12) or separated
+ * (-D -d -v -b 12), or combination thereof. Modes and other status is
+ * copied with copystat(). -O bug for 4.2 seems to have disappeared with
+ * 1.8.
+ *
+ * Revision 1.8 84/08/09 23:15:00 joe
+ * Made it compatible with vax version, installed jim's fixes/enhancements
+ *
+ * Revision 1.6 84/08/01 22:08:00 joe
+ * Sped up algorithm significantly by sorting the compress chain.
+ *
+ * Revision 1.5 84/07/13 13:11:00 srd
+ * Added C version of vax asm routines. Changed structure to arrays to
+ * save much memory. Do unsigned compares where possible (faster on
+ * Perkin-Elmer)
+ *
+ * Revision 1.4 84/07/05 03:11:11 thomas
+ * Clean up the code a little and lint it. (Lint complains about all
+ * the regs used in the asm, but I'm not going to "fix" this.)
+ *
+ * Revision 1.3 84/07/05 02:06:54 thomas
+ * Minor fixes.
+ *
+ * Revision 1.2 84/07/05 00:27:27 thomas
+ * Add variable bit length output.
+ *
+ */
+
+static char rcs_ident[] =
+ "$Header: compress.c,v 4.0 85/07/30 12:50:00 joe Release $";
diff --git a/usr.bin/compress/zopen.3 b/usr.bin/compress/zopen.3
new file mode 100644
index 0000000..9704a63
--- /dev/null
+++ b/usr.bin/compress/zopen.3
@@ -0,0 +1,137 @@
+.\" Copyright (c) 1992, 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.
+.\"
+.\" @(#)zopen.3 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt ZOPEN 3
+.Os
+.Sh NAME
+.Nm zopen
+.Nd compressed stream open function
+.Sh SYNOPSIS
+.Fd #include \&"zopen.h\&"
+.Ft FILE *
+.Fn zopen "const char *path" "const char *mode" "int bits"
+.Sh DESCRIPTION
+The
+.Fn zopen
+function
+opens the compressed file whose name is the string pointed to by
+.Fa path
+and associates a stream with it.
+.Pp
+The argument
+.Fa mode
+points to one of the following one-character strings:
+.Bl -tag -width indent
+.It Dq Li r
+Open compressed file for reading.
+The stream is positioned at the beginning of the file.
+.It Dq Li w
+Truncate file to zero length or create compressed file for writing.
+The stream is positioned at the beginning of the file.
+.El
+.Pp
+Any created files will have mode
+.Pf \\*q Dv S_IRUSR
+\&|
+.Dv S_IWUSR
+\&|
+.Dv S_IRGRP
+\&|
+.Dv S_IWGRP
+\&|
+.Dv S_IROTH
+\&|
+.Dv S_IWOTH Ns \\*q
+.Pq Li 0666 ,
+as modified by the process'
+umask value (see
+.Xr umask 2 ) .
+.Pp
+Files may only be read or written.
+Seek operations are not allowed.
+.Pp
+The
+.Fa bits
+argument, if non-zero, is set to the bits code limit.
+If zero, the default is 16.
+See
+.Xr compress 1
+for more information.
+.Sh RETURN VALUES
+Upon successful completion
+.Fn zopen
+returns a
+.Tn FILE
+pointer.
+Otherwise,
+.Dv NULL
+is returned and the global variable
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+.Bl -tag -width [EINVAL]
+.It Bq Er EINVAL
+The
+.Fa mode
+or
+.Fa bits
+arguments specified to
+.Fn zopen
+were invalid.
+.It Bq Er EFTYPE
+The compressed file starts with an invalid header, or the compressed
+file is compressed with more bits than can be handled.
+.El
+.Pp
+The
+.Fn zopen
+function may also fail and set
+.Va errno
+for any of the errors specified for the routines
+.Xr fopen 3
+or
+.Xr funopen 3 .
+.Sh SEE ALSO
+.Xr compress 1 ,
+.Xr fopen 3 ,
+.Xr funopen 3
+.Sh HISTORY
+The
+.Nm
+function
+first appeared in
+.Bx 4.4 .
+.Sh BUGS
+The
+.Fn zopen
+function
+may not be portable to systems other than
+.Bx .
diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c
new file mode 100644
index 0000000..8ae3d7d
--- /dev/null
+++ b/usr.bin/compress/zopen.c
@@ -0,0 +1,738 @@
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)zopen.c 8.1 (Berkeley) 6/27/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*-
+ * fcompress.c - File compression ala IEEE Computer, June 1984.
+ *
+ * Compress authors:
+ * Spencer W. Thomas (decvax!utah-cs!thomas)
+ * Jim McKie (decvax!mcvax!jim)
+ * Steve Davies (decvax!vax135!petsd!peora!srd)
+ * Ken Turkowski (decvax!decwrl!turtlevax!ken)
+ * James A. Woods (decvax!ihnp4!ames!jaw)
+ * Joe Orost (decvax!vax135!petsd!joe)
+ *
+ * Cleaned up and converted to library returning I/O streams by
+ * Diomidis Spinellis <dds@doc.ic.ac.uk>.
+ *
+ * zopen(filename, mode, bits)
+ * Returns a FILE * that can be used for read or write. The modes
+ * supported are only "r" and "w". Seeking is not allowed. On
+ * reading the file is decompressed, on writing it is compressed.
+ * The output is compatible with compress(1) with 16 bit tables.
+ * Any file produced by compress(1) can be read.
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "zopen.h"
+
+#define BITS 16 /* Default bits. */
+#define HSIZE 69001 /* 95% occupancy */
+
+/* A code_int must be able to hold 2**BITS values of type int, and also -1. */
+typedef long code_int;
+typedef long count_int;
+
+typedef u_char char_type;
+static char_type magic_header[] =
+ {'\037', '\235'}; /* 1F 9D */
+
+#define BIT_MASK 0x1f /* Defines for third byte of header. */
+#define BLOCK_MASK 0x80
+
+/*
+ * Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is
+ * a fourth header byte (for expansion).
+ */
+#define INIT_BITS 9 /* Initial number of bits/code. */
+
+#define MAXCODE(n_bits) ((1 << (n_bits)) - 1)
+
+struct s_zstate {
+ FILE *zs_fp; /* File stream for I/O */
+ char zs_mode; /* r or w */
+ enum {
+ S_START, S_MIDDLE, S_EOF
+ } zs_state; /* State of computation */
+ u_int zs_n_bits; /* Number of bits/code. */
+ u_int zs_maxbits; /* User settable max # bits/code. */
+ code_int zs_maxcode; /* Maximum code, given n_bits. */
+ code_int zs_maxmaxcode; /* Should NEVER generate this code. */
+ count_int zs_htab [HSIZE];
+ u_short zs_codetab [HSIZE];
+ code_int zs_hsize; /* For dynamic table sizing. */
+ code_int zs_free_ent; /* First unused entry. */
+ /*
+ * Block compression parameters -- after all codes are used up,
+ * and compression rate changes, start over.
+ */
+ int zs_block_compress;
+ int zs_clear_flg;
+ long zs_ratio;
+ count_int zs_checkpoint;
+ u_int zs_offset;
+ long zs_in_count; /* Length of input. */
+ long zs_bytes_out; /* Length of compressed output. */
+ long zs_out_count; /* # of codes output (for debugging). */
+ char_type zs_buf[BITS];
+ union {
+ struct {
+ long zs_fcode;
+ code_int zs_ent;
+ code_int zs_hsize_reg;
+ int zs_hshift;
+ } w; /* Write parameters */
+ struct {
+ char_type *zs_stackp;
+ int zs_finchar;
+ code_int zs_code, zs_oldcode, zs_incode;
+ int zs_roffset, zs_size;
+ char_type zs_gbuf[BITS];
+ } r; /* Read parameters */
+ } u;
+};
+
+/* Definitions to retain old variable names */
+#define fp zs->zs_fp
+#define zmode zs->zs_mode
+#define state zs->zs_state
+#define n_bits zs->zs_n_bits
+#define maxbits zs->zs_maxbits
+#define maxcode zs->zs_maxcode
+#define maxmaxcode zs->zs_maxmaxcode
+#define htab zs->zs_htab
+#define codetab zs->zs_codetab
+#define hsize zs->zs_hsize
+#define free_ent zs->zs_free_ent
+#define block_compress zs->zs_block_compress
+#define clear_flg zs->zs_clear_flg
+#define ratio zs->zs_ratio
+#define checkpoint zs->zs_checkpoint
+#define offset zs->zs_offset
+#define in_count zs->zs_in_count
+#define bytes_out zs->zs_bytes_out
+#define out_count zs->zs_out_count
+#define buf zs->zs_buf
+#define fcode zs->u.w.zs_fcode
+#define hsize_reg zs->u.w.zs_hsize_reg
+#define ent zs->u.w.zs_ent
+#define hshift zs->u.w.zs_hshift
+#define stackp zs->u.r.zs_stackp
+#define finchar zs->u.r.zs_finchar
+#define code zs->u.r.zs_code
+#define oldcode zs->u.r.zs_oldcode
+#define incode zs->u.r.zs_incode
+#define roffset zs->u.r.zs_roffset
+#define size zs->u.r.zs_size
+#define gbuf zs->u.r.zs_gbuf
+
+/*
+ * To save much memory, we overlay the table used by compress() with those
+ * used by decompress(). The tab_prefix table is the same size and type as
+ * the codetab. The tab_suffix table needs 2**BITS characters. We get this
+ * from the beginning of htab. The output stack uses the rest of htab, and
+ * contains characters. There is plenty of room for any possible stack
+ * (stack used to be 8000 characters).
+ */
+
+#define htabof(i) htab[i]
+#define codetabof(i) codetab[i]
+
+#define tab_prefixof(i) codetabof(i)
+#define tab_suffixof(i) ((char_type *)(htab))[i]
+#define de_stack ((char_type *)&tab_suffixof(1 << BITS))
+
+#define CHECK_GAP 10000 /* Ratio check interval. */
+
+/*
+ * the next two codes should not be changed lightly, as they must not
+ * lie within the contiguous general code space.
+ */
+#define FIRST 257 /* First free entry. */
+#define CLEAR 256 /* Table clear output code. */
+
+static int cl_block(struct s_zstate *);
+static void cl_hash(struct s_zstate *, count_int);
+static code_int getcode(struct s_zstate *);
+static int output(struct s_zstate *, code_int);
+static int zclose(void *);
+static int zread(void *, char *, int);
+static int zwrite(void *, const char *, int);
+
+/*-
+ * Algorithm from "A Technique for High Performance Data Compression",
+ * Terry A. Welch, IEEE Computer Vol 17, No 6 (June 1984), pp 8-19.
+ *
+ * Algorithm:
+ * Modified Lempel-Ziv method (LZW). Basically finds common
+ * substrings and replaces them with a variable size code. This is
+ * deterministic, and can be done on the fly. Thus, the decompression
+ * procedure needs no input table, but tracks the way the table was built.
+ */
+
+/*-
+ * compress write
+ *
+ * Algorithm: use open addressing double hashing (no chaining) on the
+ * prefix code / next character combination. We do a variant of Knuth's
+ * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
+ * secondary probe. Here, the modular division first probe is gives way
+ * to a faster exclusive-or manipulation. Also do block compression with
+ * an adaptive reset, whereby the code table is cleared when the compression
+ * ratio decreases, but after the table fills. The variable-length output
+ * codes are re-sized at this point, and a special CLEAR code is generated
+ * for the decompressor. Late addition: construct the table according to
+ * file size for noticeable speed improvement on small files. Please direct
+ * questions about this implementation to ames!jaw.
+ */
+static int
+zwrite(void *cookie, const char *wbp, int num)
+{
+ code_int i;
+ int c, disp;
+ struct s_zstate *zs;
+ const u_char *bp;
+ u_char tmp;
+ int count;
+
+ if (num == 0)
+ return (0);
+
+ zs = cookie;
+ count = num;
+ bp = (const u_char *)wbp;
+ if (state == S_MIDDLE)
+ goto middle;
+ state = S_MIDDLE;
+
+ maxmaxcode = 1L << maxbits;
+ if (fwrite(magic_header,
+ sizeof(char), sizeof(magic_header), fp) != sizeof(magic_header))
+ return (-1);
+ tmp = (u_char)((maxbits) | block_compress);
+ if (fwrite(&tmp, sizeof(char), sizeof(tmp), fp) != sizeof(tmp))
+ return (-1);
+
+ offset = 0;
+ bytes_out = 3; /* Includes 3-byte header mojo. */
+ out_count = 0;
+ clear_flg = 0;
+ ratio = 0;
+ in_count = 1;
+ checkpoint = CHECK_GAP;
+ maxcode = MAXCODE(n_bits = INIT_BITS);
+ free_ent = ((block_compress) ? FIRST : 256);
+
+ ent = *bp++;
+ --count;
+
+ hshift = 0;
+ for (fcode = (long)hsize; fcode < 65536L; fcode *= 2L)
+ hshift++;
+ hshift = 8 - hshift; /* Set hash code range bound. */
+
+ hsize_reg = hsize;
+ cl_hash(zs, (count_int)hsize_reg); /* Clear hash table. */
+
+middle: for (i = 0; count--;) {
+ c = *bp++;
+ in_count++;
+ fcode = (long)(((long)c << maxbits) + ent);
+ i = ((c << hshift) ^ ent); /* Xor hashing. */
+
+ if (htabof(i) == fcode) {
+ ent = codetabof(i);
+ continue;
+ } else if ((long)htabof(i) < 0) /* Empty slot. */
+ goto nomatch;
+ disp = hsize_reg - i; /* Secondary hash (after G. Knott). */
+ if (i == 0)
+ disp = 1;
+probe: if ((i -= disp) < 0)
+ i += hsize_reg;
+
+ if (htabof(i) == fcode) {
+ ent = codetabof(i);
+ continue;
+ }
+ if ((long)htabof(i) >= 0)
+ goto probe;
+nomatch: if (output(zs, (code_int) ent) == -1)
+ return (-1);
+ out_count++;
+ ent = c;
+ if (free_ent < maxmaxcode) {
+ codetabof(i) = free_ent++; /* code -> hashtable */
+ htabof(i) = fcode;
+ } else if ((count_int)in_count >=
+ checkpoint && block_compress) {
+ if (cl_block(zs) == -1)
+ return (-1);
+ }
+ }
+ return (num);
+}
+
+static int
+zclose(void *cookie)
+{
+ struct s_zstate *zs;
+ int rval;
+
+ zs = cookie;
+ if (zmode == 'w') { /* Put out the final code. */
+ if (output(zs, (code_int) ent) == -1) {
+ (void)fclose(fp);
+ free(zs);
+ return (-1);
+ }
+ out_count++;
+ if (output(zs, (code_int) - 1) == -1) {
+ (void)fclose(fp);
+ free(zs);
+ return (-1);
+ }
+ }
+ rval = fclose(fp) == EOF ? -1 : 0;
+ free(zs);
+ return (rval);
+}
+
+/*-
+ * Output the given code.
+ * Inputs:
+ * code: A n_bits-bit integer. If == -1, then EOF. This assumes
+ * that n_bits =< (long)wordsize - 1.
+ * Outputs:
+ * Outputs code to the file.
+ * Assumptions:
+ * Chars are 8 bits long.
+ * Algorithm:
+ * Maintain a BITS character long buffer (so that 8 codes will
+ * fit in it exactly). Use the VAX insv instruction to insert each
+ * code in turn. When the buffer fills up empty it and start over.
+ */
+
+static char_type lmask[9] =
+ {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00};
+static char_type rmask[9] =
+ {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
+
+static int
+output(struct s_zstate *zs, code_int ocode)
+{
+ int r_off;
+ u_int bits;
+ char_type *bp;
+
+ r_off = offset;
+ bits = n_bits;
+ bp = buf;
+ if (ocode >= 0) {
+ /* Get to the first byte. */
+ bp += (r_off >> 3);
+ r_off &= 7;
+ /*
+ * Since ocode is always >= 8 bits, only need to mask the first
+ * hunk on the left.
+ */
+ *bp = (*bp & rmask[r_off]) | ((ocode << r_off) & lmask[r_off]);
+ bp++;
+ bits -= (8 - r_off);
+ ocode >>= 8 - r_off;
+ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+ if (bits >= 8) {
+ *bp++ = ocode;
+ ocode >>= 8;
+ bits -= 8;
+ }
+ /* Last bits. */
+ if (bits)
+ *bp = ocode;
+ offset += n_bits;
+ if (offset == (n_bits << 3)) {
+ bp = buf;
+ bits = n_bits;
+ bytes_out += bits;
+ if (fwrite(bp, sizeof(char), bits, fp) != bits)
+ return (-1);
+ bp += bits;
+ bits = 0;
+ offset = 0;
+ }
+ /*
+ * If the next entry is going to be too big for the ocode size,
+ * then increase it, if possible.
+ */
+ if (free_ent > maxcode || (clear_flg > 0)) {
+ /*
+ * Write the whole buffer, because the input side won't
+ * discover the size increase until after it has read it.
+ */
+ if (offset > 0) {
+ if (fwrite(buf, 1, n_bits, fp) != n_bits)
+ return (-1);
+ bytes_out += n_bits;
+ }
+ offset = 0;
+
+ if (clear_flg) {
+ maxcode = MAXCODE(n_bits = INIT_BITS);
+ clear_flg = 0;
+ } else {
+ n_bits++;
+ if (n_bits == maxbits)
+ maxcode = maxmaxcode;
+ else
+ maxcode = MAXCODE(n_bits);
+ }
+ }
+ } else {
+ /* At EOF, write the rest of the buffer. */
+ if (offset > 0) {
+ offset = (offset + 7) / 8;
+ if (fwrite(buf, 1, offset, fp) != offset)
+ return (-1);
+ bytes_out += offset;
+ }
+ offset = 0;
+ }
+ return (0);
+}
+
+/*
+ * Decompress read. This routine adapts to the codes in the file building
+ * the "string" table on-the-fly; requiring no table to be stored in the
+ * compressed file. The tables used herein are shared with those of the
+ * compress() routine. See the definitions above.
+ */
+static int
+zread(void *cookie, char *rbp, int num)
+{
+ u_int count;
+ struct s_zstate *zs;
+ u_char *bp, header[3];
+
+ if (num == 0)
+ return (0);
+
+ zs = cookie;
+ count = num;
+ bp = (u_char *)rbp;
+ switch (state) {
+ case S_START:
+ state = S_MIDDLE;
+ break;
+ case S_MIDDLE:
+ goto middle;
+ case S_EOF:
+ goto eof;
+ }
+
+ /* Check the magic number */
+ if (fread(header,
+ sizeof(char), sizeof(header), fp) != sizeof(header) ||
+ memcmp(header, magic_header, sizeof(magic_header)) != 0) {
+ errno = EFTYPE;
+ return (-1);
+ }
+ maxbits = header[2]; /* Set -b from file. */
+ block_compress = maxbits & BLOCK_MASK;
+ maxbits &= BIT_MASK;
+ maxmaxcode = 1L << maxbits;
+ if (maxbits > BITS || maxbits < 12) {
+ errno = EFTYPE;
+ return (-1);
+ }
+ /* As above, initialize the first 256 entries in the table. */
+ maxcode = MAXCODE(n_bits = INIT_BITS);
+ for (code = 255; code >= 0; code--) {
+ tab_prefixof(code) = 0;
+ tab_suffixof(code) = (char_type) code;
+ }
+ free_ent = block_compress ? FIRST : 256;
+
+ finchar = oldcode = getcode(zs);
+ if (oldcode == -1) /* EOF already? */
+ return (0); /* Get out of here */
+
+ /* First code must be 8 bits = char. */
+ *bp++ = (u_char)finchar;
+ count--;
+ stackp = de_stack;
+
+ while ((code = getcode(zs)) > -1) {
+
+ if ((code == CLEAR) && block_compress) {
+ for (code = 255; code >= 0; code--)
+ tab_prefixof(code) = 0;
+ clear_flg = 1;
+ free_ent = FIRST;
+ oldcode = -1;
+ continue;
+ }
+ incode = code;
+
+ /* Special case for kWkWk string. */
+ if (code >= free_ent) {
+ if (code > free_ent || oldcode == -1) {
+ /* Bad stream. */
+ errno = EINVAL;
+ return (-1);
+ }
+ *stackp++ = finchar;
+ code = oldcode;
+ }
+ /*
+ * The above condition ensures that code < free_ent.
+ * The construction of tab_prefixof in turn guarantees that
+ * each iteration decreases code and therefore stack usage is
+ * bound by 1 << BITS - 256.
+ */
+
+ /* Generate output characters in reverse order. */
+ while (code >= 256) {
+ *stackp++ = tab_suffixof(code);
+ code = tab_prefixof(code);
+ }
+ *stackp++ = finchar = tab_suffixof(code);
+
+ /* And put them out in forward order. */
+middle: do {
+ if (count-- == 0)
+ return (num);
+ *bp++ = *--stackp;
+ } while (stackp > de_stack);
+
+ /* Generate the new entry. */
+ if ((code = free_ent) < maxmaxcode && oldcode != -1) {
+ tab_prefixof(code) = (u_short) oldcode;
+ tab_suffixof(code) = finchar;
+ free_ent = code + 1;
+ }
+
+ /* Remember previous code. */
+ oldcode = incode;
+ }
+ state = S_EOF;
+eof: return (num - count);
+}
+
+/*-
+ * Read one code from the standard input. If EOF, return -1.
+ * Inputs:
+ * stdin
+ * Outputs:
+ * code or -1 is returned.
+ */
+static code_int
+getcode(struct s_zstate *zs)
+{
+ code_int gcode;
+ int r_off, bits;
+ char_type *bp;
+
+ bp = gbuf;
+ if (clear_flg > 0 || roffset >= size || free_ent > maxcode) {
+ /*
+ * If the next entry will be too big for the current gcode
+ * size, then we must increase the size. This implies reading
+ * a new buffer full, too.
+ */
+ if (free_ent > maxcode) {
+ n_bits++;
+ if (n_bits == maxbits) /* Won't get any bigger now. */
+ maxcode = maxmaxcode;
+ else
+ maxcode = MAXCODE(n_bits);
+ }
+ if (clear_flg > 0) {
+ maxcode = MAXCODE(n_bits = INIT_BITS);
+ clear_flg = 0;
+ }
+ size = fread(gbuf, 1, n_bits, fp);
+ if (size <= 0) /* End of file. */
+ return (-1);
+ roffset = 0;
+ /* Round size down to integral number of codes. */
+ size = (size << 3) - (n_bits - 1);
+ }
+ r_off = roffset;
+ bits = n_bits;
+
+ /* Get to the first byte. */
+ bp += (r_off >> 3);
+ r_off &= 7;
+
+ /* Get first part (low order bits). */
+ gcode = (*bp++ >> r_off);
+ bits -= (8 - r_off);
+ r_off = 8 - r_off; /* Now, roffset into gcode word. */
+
+ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+ if (bits >= 8) {
+ gcode |= *bp++ << r_off;
+ r_off += 8;
+ bits -= 8;
+ }
+
+ /* High order bits. */
+ gcode |= (*bp & rmask[bits]) << r_off;
+ roffset += n_bits;
+
+ return (gcode);
+}
+
+static int
+cl_block(struct s_zstate *zs) /* Table clear for block compress. */
+{
+ long rat;
+
+ checkpoint = in_count + CHECK_GAP;
+
+ if (in_count > 0x007fffff) { /* Shift will overflow. */
+ rat = bytes_out >> 8;
+ if (rat == 0) /* Don't divide by zero. */
+ rat = 0x7fffffff;
+ else
+ rat = in_count / rat;
+ } else
+ rat = (in_count << 8) / bytes_out; /* 8 fractional bits. */
+ if (rat > ratio)
+ ratio = rat;
+ else {
+ ratio = 0;
+ cl_hash(zs, (count_int) hsize);
+ free_ent = FIRST;
+ clear_flg = 1;
+ if (output(zs, (code_int) CLEAR) == -1)
+ return (-1);
+ }
+ return (0);
+}
+
+static void
+cl_hash(struct s_zstate *zs, count_int cl_hsize) /* Reset code table. */
+{
+ count_int *htab_p;
+ long i, m1;
+
+ m1 = -1;
+ htab_p = htab + cl_hsize;
+ i = cl_hsize - 16;
+ do { /* Might use Sys V memset(3) here. */
+ *(htab_p - 16) = m1;
+ *(htab_p - 15) = m1;
+ *(htab_p - 14) = m1;
+ *(htab_p - 13) = m1;
+ *(htab_p - 12) = m1;
+ *(htab_p - 11) = m1;
+ *(htab_p - 10) = m1;
+ *(htab_p - 9) = m1;
+ *(htab_p - 8) = m1;
+ *(htab_p - 7) = m1;
+ *(htab_p - 6) = m1;
+ *(htab_p - 5) = m1;
+ *(htab_p - 4) = m1;
+ *(htab_p - 3) = m1;
+ *(htab_p - 2) = m1;
+ *(htab_p - 1) = m1;
+ htab_p -= 16;
+ } while ((i -= 16) >= 0);
+ for (i += 16; i > 0; i--)
+ *--htab_p = m1;
+}
+
+FILE *
+zopen(const char *fname, const char *mode, int bits)
+{
+ struct s_zstate *zs;
+
+ if ((mode[0] != 'r' && mode[0] != 'w') || mode[1] != '\0' ||
+ bits < 0 || bits > BITS) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if ((zs = calloc(1, sizeof(struct s_zstate))) == NULL)
+ return (NULL);
+
+ maxbits = bits ? bits : BITS; /* User settable max # bits/code. */
+ maxmaxcode = 1L << maxbits; /* Should NEVER generate this code. */
+ hsize = HSIZE; /* For dynamic table sizing. */
+ free_ent = 0; /* First unused entry. */
+ block_compress = BLOCK_MASK;
+ clear_flg = 0;
+ ratio = 0;
+ checkpoint = CHECK_GAP;
+ in_count = 1; /* Length of input. */
+ out_count = 0; /* # of codes output (for debugging). */
+ state = S_START;
+ roffset = 0;
+ size = 0;
+
+ /*
+ * Layering compress on top of stdio in order to provide buffering,
+ * and ensure that reads and write work with the data specified.
+ */
+ if ((fp = fopen(fname, mode)) == NULL) {
+ free(zs);
+ return (NULL);
+ }
+ switch (*mode) {
+ case 'r':
+ zmode = 'r';
+ return (funopen(zs, zread, NULL, NULL, zclose));
+ case 'w':
+ zmode = 'w';
+ return (funopen(zs, NULL, zwrite, NULL, zclose));
+ }
+ /* NOTREACHED */
+ return (NULL);
+}
diff --git a/usr.bin/compress/zopen.h b/usr.bin/compress/zopen.h
new file mode 100644
index 0000000..a27a4f9
--- /dev/null
+++ b/usr.bin/compress/zopen.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 1996
+ * FreeBSD 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 FreeBSD Inc. 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 [your name] 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 _ZOPEN_H_
+#define _ZOPEN_H_
+
+FILE *zopen(const char *, const char *, int);
+
+#endif /* _ZOPEN_H_ */
diff --git a/usr.bin/cpio/Makefile b/usr.bin/cpio/Makefile
new file mode 100644
index 0000000..48043f6
--- /dev/null
+++ b/usr.bin/cpio/Makefile
@@ -0,0 +1,39 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+_LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
+_LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive
+
+PROG= bsdcpio
+BSDCPIO_VERSION_STRING= 3.2.1
+
+.PATH: ${_LIBARCHIVEDIR}/cpio
+SRCS= cpio.c cmdline.c
+
+.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
+SRCS+= err.c line_reader.c passphrase.c
+
+CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\"
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\"
+CFLAGS+= -I${_LIBARCHIVEDIR}/cpio -I${_LIBARCHIVEDIR}/libarchive_fe
+
+.ifdef RELEASE_CRUNCH
+# FreeBSD's installer uses cpio in crunched binaries that are
+# statically linked, cannot use -lcrypto, and are size sensitive.
+CFLAGS+= -DSMALLER
+.endif
+LIBADD= archive
+
+.if ${MK_ICONV} != "no"
+CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
+.endif
+
+SYMLINKS=bsdcpio ${BINDIR}/cpio
+MLINKS= bsdcpio.1 cpio.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cpio/Makefile.depend b/usr.bin/cpio/Makefile.depend
new file mode 100644
index 0000000..4e7906b
--- /dev/null
+++ b/usr.bin/cpio/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/cpio/tests/Makefile b/usr.bin/cpio/tests/Makefile
new file mode 100644
index 0000000..5ffa27fe
--- /dev/null
+++ b/usr.bin/cpio/tests/Makefile
@@ -0,0 +1,121 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
+
+ATF_TESTS_SH+= functional_test
+
+BINDIR= ${TESTSDIR}
+
+PROGS+= bsdcpio_test
+
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+= -I${SRCTOP}/lib/libarchive -I${.OBJDIR}
+
+CFLAGS+= -I${.OBJDIR}
+CFLAGS+= -I${_LIBARCHIVEDIR}/cpio -I${_LIBARCHIVEDIR}/libarchive_fe
+CFLAGS+= -I${_LIBARCHIVEDIR}/test_utils
+
+# Uncomment to link against dmalloc
+#LDADD+= -L/usr/local/lib -ldmalloc
+#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
+
+.PATH: ${_LIBARCHIVEDIR}/cpio
+CPIO_SRCS= cmdline.c
+
+.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
+CPIO_SRCS+= err.c
+
+.PATH: ${_LIBARCHIVEDIR}/cpio/test
+TESTS_SRCS= \
+ test_0.c \
+ test_basic.c \
+ test_cmdline.c \
+ test_extract_cpio_Z.c \
+ test_extract_cpio_bz2.c \
+ test_extract_cpio_grz.c \
+ test_extract_cpio_gz.c \
+ test_extract_cpio_lrz.c \
+ test_extract_cpio_lz.c \
+ test_extract_cpio_lz4.c \
+ test_extract_cpio_lzma.c \
+ test_extract_cpio_lzo.c \
+ test_extract_cpio_xz.c \
+ test_format_newc.c \
+ test_gcpio_compat.c \
+ test_missing_file.c \
+ test_option_0.c \
+ test_option_B_upper.c \
+ test_option_C_upper.c \
+ test_option_J_upper.c \
+ test_option_L_upper.c \
+ test_option_Z_upper.c \
+ test_option_a.c \
+ test_option_b64encode.c \
+ test_option_c.c \
+ test_option_d.c \
+ test_option_f.c \
+ test_option_grzip.c \
+ test_option_help.c \
+ test_option_l.c \
+ test_option_lrzip.c \
+ test_option_lz4.c \
+ test_option_lzma.c \
+ test_option_lzop.c \
+ test_option_m.c \
+ test_option_passphrase.c \
+ test_option_t.c \
+ test_option_u.c \
+ test_option_uuencode.c \
+ test_option_version.c \
+ test_option_xz.c \
+ test_option_y.c \
+ test_option_z.c \
+ test_owner_parse.c \
+ test_passthrough_dotdot.c \
+ test_passthrough_reverse.c
+
+SRCS.bsdcpio_test= list.h \
+ ${CPIO_SRCS} \
+ ${TESTS_SRCS} \
+ main.c
+
+.PATH: ${_LIBARCHIVEDIR}/test_utils
+SRCS.bsdcpio_test+= test_utils.c
+
+LIBADD.bsdcpio_test= archive
+
+list.h: ${TESTS_SRCS} Makefile
+ @(cd ${_LIBARCHIVEDIR}/tar/test && \
+ grep -h DEFINE_TEST ${.ALLSRC:N*Makefile}) > ${.TARGET}.tmp
+ @mv ${.TARGET}.tmp ${.TARGET}
+
+CLEANFILES+= list.h list.h.tmp
+
+${PACKAGE}FILES+= test_extract.cpio.Z.uu
+${PACKAGE}FILES+= test_extract.cpio.bz2.uu
+${PACKAGE}FILES+= test_extract.cpio.grz.uu
+${PACKAGE}FILES+= test_extract.cpio.gz.uu
+${PACKAGE}FILES+= test_extract.cpio.lrz.uu
+${PACKAGE}FILES+= test_extract.cpio.lz.uu
+${PACKAGE}FILES+= test_extract.cpio.lz4.uu
+${PACKAGE}FILES+= test_extract.cpio.lzma.uu
+${PACKAGE}FILES+= test_extract.cpio.lzo.uu
+${PACKAGE}FILES+= test_extract.cpio.xz.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref.bin.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref.crc.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref.newc.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref.ustar.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref_nosym.bin.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref_nosym.crc.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref_nosym.newc.uu
+${PACKAGE}FILES+= test_gcpio_compat_ref_nosym.ustar.uu
+${PACKAGE}FILES+= test_option_f.cpio.uu
+${PACKAGE}FILES+= test_option_m.cpio.uu
+${PACKAGE}FILES+= test_option_passphrase.zip.uu
+${PACKAGE}FILES+= test_option_t.cpio.uu
+${PACKAGE}FILES+= test_option_t.stdout.uu
+${PACKAGE}FILES+= test_option_tv.stdout.uu
+
+.include <bsd.test.mk>
diff --git a/usr.bin/cpio/tests/Makefile.depend b/usr.bin/cpio/tests/Makefile.depend
new file mode 100644
index 0000000..4e7906b
--- /dev/null
+++ b/usr.bin/cpio/tests/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/cpio/tests/functional_test.sh b/usr.bin/cpio/tests/functional_test.sh
new file mode 100755
index 0000000..48116c0
--- /dev/null
+++ b/usr.bin/cpio/tests/functional_test.sh
@@ -0,0 +1,56 @@
+#
+# Copyright 2015 EMC Corp.
+# 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.
+#
+# 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$
+
+SRCDIR=$(atf_get_srcdir)
+TESTER="${SRCDIR}/bsdcpio_test"
+export BSDCPIO=$(which cpio)
+
+check()
+{
+ local testcase=${1}; shift
+
+ # For some odd reason /bin/sh spuriously writes
+ # "write error on stdout" with some of the testcases
+ #
+ # Probably an issue with how they're written as it calls system(3) to
+ # clean up directories..
+ atf_check -e ignore -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}"
+}
+
+atf_init_test_cases()
+{
+ # Redirect stderr to stdout for the usage message because if you don't
+ # kyua list/kyua test will break:
+ # https://github.com/jmmv/kyua/issues/149
+ testcases=$(${TESTER} -h 2>&1 | awk 'p != 0 && $1 ~ /^[0-9]+:/ { print $NF } /Available tests:/ { p=1 }')
+ for testcase in ${testcases}; do
+ atf_test_case ${testcase}
+ eval "${testcase}_body() { check ${testcase}; }"
+ atf_add_test_case ${testcase}
+ done
+}
diff --git a/usr.bin/cpuset/Makefile b/usr.bin/cpuset/Makefile
new file mode 100644
index 0000000..660a096
--- /dev/null
+++ b/usr.bin/cpuset/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= cpuset
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cpuset/Makefile.depend b/usr.bin/cpuset/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/cpuset/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1
new file mode 100644
index 0000000..174eeb6
--- /dev/null
+++ b/usr.bin/cpuset/cpuset.1
@@ -0,0 +1,197 @@
+.\" Copyright (c) 2008 Christian Brueffer
+.\" Copyright (c) 2008 Jeffrey Roberson
+.\" 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 January 8, 2015
+.Dt CPUSET 1
+.Os
+.Sh NAME
+.Nm cpuset
+.Nd "configure processor sets"
+.Sh SYNOPSIS
+.Nm
+.Op Fl l Ar cpu-list
+.Op Fl s Ar setid
+.Ar cmd ...
+.Nm
+.Op Fl l Ar cpu-list
+.Op Fl s Ar setid
+.Fl p Ar pid
+.Nm
+.Op Fl c
+.Op Fl l Ar cpu-list
+.Fl C
+.Fl p Ar pid
+.Nm
+.Op Fl c
+.Op Fl l Ar cpu-list
+.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
+.Nm
+.Fl g
+.Op Fl cir
+.Op Fl d Ar domain | j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
+.Sh DESCRIPTION
+The
+.Nm
+command can be used to assign processor sets to processes, run commands
+constrained to a given set or list of processors, and query information
+about processor binding, sets, and available processors in the system.
+.Pp
+.Nm
+requires a target to modify or query.
+The target may be specified as a command, process id, thread id, a
+cpuset id, an irq, a jail id, or a NUMA domain.
+Using
+.Fl g
+the target's set id or mask may be queried.
+Using
+.Fl l
+or
+.Fl s
+the target's CPU mask or set id may be set.
+If no target is specified,
+.Nm
+operates on itself.
+Not all combinations of operations and targets are supported.
+For example,
+you may not set the id of an existing set or query and launch a command
+at the same time.
+.Pp
+There are two sets applicable to each process and one private mask per thread.
+Every process in the system belongs to a cpuset.
+By default processes are started in set 1.
+The mask or id may be queried using
+.Fl c .
+Each thread also has a private mask of CPUs it is allowed to run
+on that must be a subset of the assigned set.
+And finally, there is a root set, numbered 0, that is immutable.
+This last set is the list of all possible CPUs in the system and is
+queried using
+.Fl r .
+.Pp
+When running a command it may join a set specified with
+.Fl s
+otherwise a new set is created.
+In addition, a mask for the command may be specified using
+.Fl l .
+When used in conjunction with
+.Fl c
+the mask modifies the supplied or created set rather than the private mask
+for the thread.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl l Ar cpu-list"
+.It Fl C
+Create a new cpuset and assign the target process to that set.
+.It Fl c
+The requested operation should reference the cpuset available via the
+target specifier.
+.It Fl d Ar domain
+Specifies a NUMA domain id as the target of the operation.
+.It Fl g
+Causes
+.Nm
+to print either a list of valid CPUs or, using
+.Fl i ,
+the id of the target.
+.It Fl i
+When used with the
+.Fl g
+option print the id rather than the valid mask of the target.
+.It Fl j Ar jailid
+Specifies a jail id as the target of the operation.
+.It Fl l Ar cpu-list
+Specifies a list of CPUs to apply to a target.
+Specification may include
+numbers separated by '-' for ranges and commas separating individual numbers.
+A special list of
+.Dq all
+may be specified in which case the list includes all CPUs from the root set.
+.It Fl p Ar pid
+Specifies a pid as the target of the operation.
+.It Fl s Ar setid
+Specifies a set id as the target of the operation.
+.It Fl r
+The requested operation should reference the root set available via the
+target specifier.
+.It Fl t Ar tid
+Specifies a thread id as the target of the operation.
+.It Fl x Ar irq
+Specifies an irq as the target of the operation.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Create a new group with CPUs 0-4 inclusive and run
+.Pa /bin/sh
+on it:
+.Dl cpuset -c -l 0-4 /bin/sh
+.Pp
+Query the mask of CPUs the
+.Aq sh pid
+is allowed to run on:
+.Dl cpuset -g -p <sh pid>
+.Pp
+Restrict
+.Pa /bin/sh
+to run on CPUs 0 and 2 while its group is still allowed to run on
+CPUs 0-4:
+.Dl cpuset -l 0,2 -p <sh pid>
+.Pp
+Modify the cpuset
+.Pa /bin/sh
+belongs to restricting it to CPUs 0 and 2:
+.Dl cpuset -l 0,2 -c -p <sh pid>
+.Pp
+Modify the cpuset all threads are in by default to contain only
+the first 4 CPUs, leaving the rest idle:
+.Dl cpuset -l 0-3 -s 1
+.Pp
+Print the id of the cpuset
+.Pa /bin/sh
+is in:
+.Dl cpuset -g -i -p <sh pid>
+.Pp
+Move the
+.Ar pid
+into the specified cpuset
+.Ar setid
+so it may be managed with other pids in that set:
+.Dl cpuset -s <setid> -p <pid>
+.Pp
+Create a new cpuset that is restricted to CPUs 0 and 2 and move
+.Ar pid
+into the new set:
+.Dl cpuset -C -c -l 0,2 -p <pid>
+.Sh SEE ALSO
+.Xr cpuset 2
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/usr.bin/cpuset/cpuset.c b/usr.bin/cpuset/cpuset.c
new file mode 100644
index 0000000..c619259
--- /dev/null
+++ b/usr.bin/cpuset/cpuset.c
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2007, 2008 Jeffrey Roberson <jeff@freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * 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 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/cpuset.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <string.h>
+
+static int Cflag;
+static int cflag;
+static int dflag;
+static int gflag;
+static int iflag;
+static int jflag;
+static int lflag;
+static int pflag;
+static int rflag;
+static int sflag;
+static int tflag;
+static int xflag;
+static id_t id;
+static cpulevel_t level;
+static cpuwhich_t which;
+
+static void usage(void);
+
+static void printset(cpuset_t *mask);
+
+static void
+parselist(char *list, cpuset_t *mask)
+{
+ enum { NONE, NUM, DASH } state;
+ int lastnum;
+ int curnum;
+ char *l;
+
+ if (strcasecmp(list, "all") == 0) {
+ if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1,
+ sizeof(*mask), mask) != 0)
+ err(EXIT_FAILURE, "getaffinity");
+ return;
+ }
+ state = NONE;
+ curnum = lastnum = 0;
+ for (l = list; *l != '\0';) {
+ if (isdigit(*l)) {
+ curnum = atoi(l);
+ if (curnum > CPU_SETSIZE)
+ errx(EXIT_FAILURE,
+ "Only %d cpus supported", CPU_SETSIZE);
+ while (isdigit(*l))
+ l++;
+ switch (state) {
+ case NONE:
+ lastnum = curnum;
+ state = NUM;
+ break;
+ case DASH:
+ for (; lastnum <= curnum; lastnum++)
+ CPU_SET(lastnum, mask);
+ state = NONE;
+ break;
+ case NUM:
+ default:
+ goto parserr;
+ }
+ continue;
+ }
+ switch (*l) {
+ case ',':
+ switch (state) {
+ case NONE:
+ break;
+ case NUM:
+ CPU_SET(curnum, mask);
+ state = NONE;
+ break;
+ case DASH:
+ goto parserr;
+ break;
+ }
+ break;
+ case '-':
+ if (state != NUM)
+ goto parserr;
+ state = DASH;
+ break;
+ default:
+ goto parserr;
+ }
+ l++;
+ }
+ switch (state) {
+ case NONE:
+ break;
+ case NUM:
+ CPU_SET(curnum, mask);
+ break;
+ case DASH:
+ goto parserr;
+ }
+ return;
+parserr:
+ errx(EXIT_FAILURE, "Malformed cpu-list %s", list);
+}
+
+static void
+printset(cpuset_t *mask)
+{
+ int once;
+ int cpu;
+
+ for (once = 0, cpu = 0; cpu < CPU_SETSIZE; cpu++) {
+ if (CPU_ISSET(cpu, mask)) {
+ if (once == 0) {
+ printf("%d", cpu);
+ once = 1;
+ } else
+ printf(", %d", cpu);
+ }
+ }
+ printf("\n");
+}
+
+static const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq", "jail",
+ "domain" };
+static const char *levelnames[] = { NULL, " root", " cpuset", "" };
+
+static void
+printaffinity(void)
+{
+ cpuset_t mask;
+
+ if (cpuset_getaffinity(level, which, id, sizeof(mask), &mask) != 0)
+ err(EXIT_FAILURE, "getaffinity");
+ printf("%s %jd%s mask: ", whichnames[which], (intmax_t)id,
+ levelnames[level]);
+ printset(&mask);
+ exit(EXIT_SUCCESS);
+}
+
+static void
+printsetid(void)
+{
+ cpusetid_t setid;
+
+ /*
+ * Only LEVEL_WHICH && WHICH_CPUSET has a numbered id.
+ */
+ if (level == CPU_LEVEL_WHICH && !sflag)
+ level = CPU_LEVEL_CPUSET;
+ if (cpuset_getid(level, which, id, &setid))
+ err(errno, "getid");
+ printf("%s %jd%s id: %d\n", whichnames[which], (intmax_t)id,
+ levelnames[level], setid);
+}
+
+int
+main(int argc, char *argv[])
+{
+ cpusetid_t setid;
+ cpuset_t mask;
+ lwpid_t tid;
+ pid_t pid;
+ int ch;
+
+ CPU_ZERO(&mask);
+ level = CPU_LEVEL_WHICH;
+ which = CPU_WHICH_PID;
+ id = pid = tid = setid = -1;
+ while ((ch = getopt(argc, argv, "Ccd:gij:l:p:rs:t:x:")) != -1) {
+ switch (ch) {
+ case 'C':
+ Cflag = 1;
+ break;
+ case 'c':
+ cflag = 1;
+ level = CPU_LEVEL_CPUSET;
+ break;
+ case 'd':
+ dflag = 1;
+ which = CPU_WHICH_DOMAIN;
+ id = atoi(optarg);
+ break;
+ case 'g':
+ gflag = 1;
+ break;
+ case 'i':
+ iflag = 1;
+ break;
+ case 'j':
+ jflag = 1;
+ which = CPU_WHICH_JAIL;
+ id = atoi(optarg);
+ break;
+ case 'l':
+ lflag = 1;
+ parselist(optarg, &mask);
+ break;
+ case 'p':
+ pflag = 1;
+ which = CPU_WHICH_PID;
+ id = pid = atoi(optarg);
+ break;
+ case 'r':
+ level = CPU_LEVEL_ROOT;
+ rflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ which = CPU_WHICH_CPUSET;
+ id = setid = atoi(optarg);
+ break;
+ case 't':
+ tflag = 1;
+ which = CPU_WHICH_TID;
+ id = tid = atoi(optarg);
+ break;
+ case 'x':
+ xflag = 1;
+ which = CPU_WHICH_IRQ;
+ id = atoi(optarg);
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (gflag) {
+ if (argc || Cflag || lflag)
+ usage();
+ /* Only one identity specifier. */
+ if (dflag + jflag + xflag + sflag + pflag + tflag > 1)
+ usage();
+ if (iflag)
+ printsetid();
+ else
+ printaffinity();
+ exit(EXIT_SUCCESS);
+ }
+ if (dflag || iflag || rflag)
+ usage();
+ /*
+ * The user wants to run a command with a set and possibly cpumask.
+ */
+ if (argc) {
+ if (Cflag || pflag || tflag || xflag || jflag)
+ usage();
+ if (sflag) {
+ if (cpuset_setid(CPU_WHICH_PID, -1, setid))
+ err(argc, "setid");
+ } else {
+ if (cpuset(&setid))
+ err(argc, "newid");
+ }
+ if (lflag) {
+ if (cpuset_setaffinity(level, CPU_WHICH_PID,
+ -1, sizeof(mask), &mask) != 0)
+ err(EXIT_FAILURE, "setaffinity");
+ }
+ errno = 0;
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+ }
+ /*
+ * We're modifying something that presently exists.
+ */
+ if (Cflag && (jflag || !pflag || sflag || tflag || xflag))
+ usage();
+ if (!lflag && cflag)
+ usage();
+ if (!lflag && !(Cflag || sflag))
+ usage();
+ /* You can only set a mask on a thread. */
+ if (tflag && (sflag | pflag | xflag | jflag))
+ usage();
+ /* You can only set a mask on an irq. */
+ if (xflag && (jflag | pflag | sflag | tflag))
+ usage();
+ if (Cflag) {
+ /*
+ * Create a new cpuset and move the specified process
+ * into the set.
+ */
+ if (cpuset(&setid) < 0)
+ err(EXIT_FAILURE, "newid");
+ sflag = 1;
+ }
+ if (pflag && sflag) {
+ if (cpuset_setid(CPU_WHICH_PID, pid, setid))
+ err(EXIT_FAILURE, "setid");
+ /*
+ * If the user specifies a set and a list we want the mask
+ * to effect the pid and not the set.
+ */
+ which = CPU_WHICH_PID;
+ id = pid;
+ }
+ if (lflag) {
+ if (cpuset_setaffinity(level, which, id, sizeof(mask),
+ &mask) != 0)
+ err(EXIT_FAILURE, "setaffinity");
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: cpuset [-l cpu-list] [-s setid] cmd ...\n");
+ fprintf(stderr,
+ " cpuset [-l cpu-list] [-s setid] -p pid\n");
+ fprintf(stderr,
+ " cpuset [-c] [-l cpu-list] -C -p pid\n");
+ fprintf(stderr,
+ " cpuset [-c] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
+ fprintf(stderr,
+ " cpuset -g [-cir] [-d domain | -j jailid | -p pid | -t tid | -s setid |\n"
+ " -x irq]\n");
+ exit(1);
+}
diff --git a/usr.bin/csplit/Makefile b/usr.bin/csplit/Makefile
new file mode 100644
index 0000000..3f370c7
--- /dev/null
+++ b/usr.bin/csplit/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= csplit
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/csplit/Makefile.depend b/usr.bin/csplit/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/csplit/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/csplit/csplit.1 b/usr.bin/csplit/csplit.1
new file mode 100644
index 0000000..91e97e9
--- /dev/null
+++ b/usr.bin/csplit/csplit.1
@@ -0,0 +1,169 @@
+.\" Copyright (c) 2002 Tim J. Robbins.
+.\" 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 February 6, 2014
+.Dt CSPLIT 1
+.Os
+.Sh NAME
+.Nm csplit
+.Nd split files based on context
+.Sh SYNOPSIS
+.Nm
+.Op Fl ks
+.Op Fl f Ar prefix
+.Op Fl n Ar number
+.Ar file args ...
+.Sh DESCRIPTION
+The
+.Nm
+utility splits
+.Ar file
+into pieces using the patterns
+.Ar args .
+If
+.Ar file
+is
+a dash
+.Pq Sq Fl ,
+.Nm
+reads from standard input.
+.Pp
+Files are created with a prefix of
+.Dq xx
+and two decimal digits.
+The size of each file is written to standard output
+as it is created.
+If an error occurs whilst files are being created,
+or a
+.Dv HUP ,
+.Dv INT ,
+or
+.Dv TERM
+signal is received,
+all files previously written are removed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl f Ar prefix
+Create file names beginning with
+.Ar prefix ,
+instead of
+.Dq Pa xx .
+.It Fl k
+Do not remove previously created files if an error occurs or a
+.Dv HUP ,
+.Dv INT ,
+or
+.Dv TERM
+signal is received.
+.It Fl n Ar number
+Create file names beginning with
+.Ar number
+of decimal digits after the prefix,
+instead of 2.
+.It Fl s
+Do not write the size of each output file to standard output as it is
+created.
+.El
+.Pp
+The
+.Ar args
+operands may be a combination of the following patterns:
+.Bl -tag -width indent
+.It Xo
+.Sm off
+.Cm / Ar regexp Cm / Op Oo Cm + | - Oc Ar offset
+.Sm on
+.Xc
+Create a file containing the input from the current line to (but not including)
+the next line matching the given basic regular expression.
+An optional
+.Ar offset
+from the line that matched may be specified.
+.It Xo
+.Sm off
+.Cm % Ar regexp Cm % Op Oo Cm + | - Oc Ar offset
+.Sm on
+.Xc
+Same as above but a file is not created for the output.
+.It Ar line_no
+Create containing the input from the current line to (but not including)
+the specified line number.
+.It Cm { Ns Ar num Ns Cm }
+Repeat the previous pattern the specified number of times.
+If it follows a line number pattern, a new file will be created for each
+.Ar line_no
+lines,
+.Ar num
+times.
+The first line of the file is line number 1 for historic reasons.
+.El
+.Pp
+After all the patterns have been processed, the remaining input data
+(if there is any) will be written to a new file.
+.Pp
+Requesting to split at a line before the current line number or past the
+end of the file will result in an error.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_COLLATE
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Split the
+.Xr mdoc 7
+file
+.Pa foo.1
+into one file for each section (up to 21 plus one for the rest, if any):
+.Pp
+.Dl "csplit -k foo.1 '%^\e.Sh%' '/^\e.Sh/' '{20}'"
+.Pp
+Split standard input after the first 99 lines and every 100 lines thereafter:
+.Pp
+.Dl "csplit -k - 100 '{19}'"
+.Sh SEE ALSO
+.Xr sed 1 ,
+.Xr split 1 ,
+.Xr re_format 7
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+command appeared in PWB UNIX.
+.Sh BUGS
+Input lines are limited to
+.Dv LINE_MAX
+(2048) bytes in length.
diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c
new file mode 100644
index 0000000..a5e819f
--- /dev/null
+++ b/usr.bin/csplit/csplit.c
@@ -0,0 +1,467 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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.
+ */
+
+/*
+ * csplit -- split files based on context
+ *
+ * This utility splits its input into numbered output files by line number
+ * or by a regular expression. Regular expression matches have an optional
+ * offset with them, allowing the split to occur a specified number of
+ * lines before or after the match.
+ *
+ * To handle negative offsets, we stop reading when the match occurs and
+ * store the offset that the file should have been split at, then use
+ * this output file as input until all the "overflowed" lines have been read.
+ * The file is then closed and truncated to the correct length.
+ *
+ * We assume that the output files can be seeked upon (ie. they cannot be
+ * symlinks to named pipes or character devices), but make no such
+ * assumption about the input.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <regex.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void cleanup(void);
+static void do_lineno(const char *);
+static void do_rexp(const char *);
+static char *get_line(void);
+static void handlesig(int);
+static FILE *newfile(void);
+static void toomuch(FILE *, long);
+static void usage(void);
+
+/*
+ * Command line options
+ */
+static const char *prefix; /* File name prefix */
+static long sufflen; /* Number of decimal digits for suffix */
+static int sflag; /* Suppress output of file names */
+static int kflag; /* Keep output if error occurs */
+
+/*
+ * Other miscellaneous globals (XXX too many)
+ */
+static long lineno; /* Current line number in input file */
+static long reps; /* Number of repetitions for this pattern */
+static long nfiles; /* Number of files output so far */
+static long maxfiles; /* Maximum number of files we can create */
+static char currfile[PATH_MAX]; /* Current output file */
+static const char *infn; /* Name of the input file */
+static FILE *infile; /* Input file handle */
+static FILE *overfile; /* Overflow file for toomuch() */
+static off_t truncofs; /* Offset this file should be truncated at */
+static int doclean; /* Should cleanup() remove output? */
+
+int
+main(int argc, char *argv[])
+{
+ struct sigaction sa;
+ long i;
+ int ch;
+ const char *expr;
+ char *ep, *p;
+ FILE *ofp;
+
+ setlocale(LC_ALL, "");
+
+ kflag = sflag = 0;
+ prefix = "xx";
+ sufflen = 2;
+ while ((ch = getopt(argc, argv, "ksf:n:")) > 0) {
+ switch (ch) {
+ case 'f':
+ prefix = optarg;
+ break;
+ case 'k':
+ kflag = 1;
+ break;
+ case 'n':
+ errno = 0;
+ sufflen = strtol(optarg, &ep, 10);
+ if (sufflen <= 0 || *ep != '\0' || errno != 0)
+ errx(1, "%s: bad suffix length", optarg);
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ }
+
+ if (sufflen + strlen(prefix) >= PATH_MAX)
+ errx(1, "name too long");
+
+ argc -= optind;
+ argv += optind;
+
+ if ((infn = *argv++) == NULL)
+ usage();
+ if (strcmp(infn, "-") == 0) {
+ infile = stdin;
+ infn = "stdin";
+ } else if ((infile = fopen(infn, "r")) == NULL)
+ err(1, "%s", infn);
+
+ if (!kflag) {
+ doclean = 1;
+ atexit(cleanup);
+ sa.sa_flags = 0;
+ sa.sa_handler = handlesig;
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGHUP);
+ sigaddset(&sa.sa_mask, SIGINT);
+ sigaddset(&sa.sa_mask, SIGTERM);
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+ }
+
+ lineno = 0;
+ nfiles = 0;
+ truncofs = 0;
+ overfile = NULL;
+
+ /* Ensure 10^sufflen < LONG_MAX. */
+ for (maxfiles = 1, i = 0; i < sufflen; i++) {
+ if (maxfiles > LONG_MAX / 10)
+ errx(1, "%ld: suffix too long (limit %ld)",
+ sufflen, i);
+ maxfiles *= 10;
+ }
+
+ /* Create files based on supplied patterns. */
+ while (nfiles < maxfiles - 1 && (expr = *argv++) != NULL) {
+ /* Look ahead & see if this pattern has any repetitions. */
+ if (*argv != NULL && **argv == '{') {
+ errno = 0;
+ reps = strtol(*argv + 1, &ep, 10);
+ if (reps < 0 || *ep != '}' || errno != 0)
+ errx(1, "%s: bad repetition count", *argv + 1);
+ argv++;
+ } else
+ reps = 0;
+
+ if (*expr == '/' || *expr == '%') {
+ do
+ do_rexp(expr);
+ while (reps-- != 0 && nfiles < maxfiles - 1);
+ } else if (isdigit((unsigned char)*expr))
+ do_lineno(expr);
+ else
+ errx(1, "%s: unrecognised pattern", expr);
+ }
+
+ /* Copy the rest into a new file. */
+ if (!feof(infile)) {
+ ofp = newfile();
+ while ((p = get_line()) != NULL && fputs(p, ofp) == 0)
+ ;
+ if (!sflag)
+ printf("%jd\n", (intmax_t)ftello(ofp));
+ if (fclose(ofp) != 0)
+ err(1, "%s", currfile);
+ }
+
+ toomuch(NULL, 0);
+ doclean = 0;
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+"usage: csplit [-ks] [-f prefix] [-n number] file args ...\n");
+ exit(1);
+}
+
+static void
+handlesig(int sig __unused)
+{
+ const char msg[] = "csplit: caught signal, cleaning up\n";
+
+ write(STDERR_FILENO, msg, sizeof(msg) - 1);
+ cleanup();
+ _exit(2);
+}
+
+/* Create a new output file. */
+static FILE *
+newfile(void)
+{
+ FILE *fp;
+
+ if ((size_t)snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix,
+ (int)sufflen, nfiles) >= sizeof(currfile))
+ errc(1, ENAMETOOLONG, NULL);
+ if ((fp = fopen(currfile, "w+")) == NULL)
+ err(1, "%s", currfile);
+ nfiles++;
+
+ return (fp);
+}
+
+/* Remove partial output, called before exiting. */
+static void
+cleanup(void)
+{
+ char fnbuf[PATH_MAX];
+ long i;
+
+ if (!doclean)
+ return;
+
+ /*
+ * NOTE: One cannot portably assume to be able to call snprintf()
+ * from inside a signal handler. It does, however, appear to be safe
+ * to do on FreeBSD. The solution to this problem is worse than the
+ * problem itself.
+ */
+
+ for (i = 0; i < nfiles; i++) {
+ snprintf(fnbuf, sizeof(fnbuf), "%s%0*ld", prefix,
+ (int)sufflen, i);
+ unlink(fnbuf);
+ }
+}
+
+/* Read a line from the input into a static buffer. */
+static char *
+get_line(void)
+{
+ static char lbuf[LINE_MAX];
+ FILE *src;
+
+ src = overfile != NULL ? overfile : infile;
+
+again: if (fgets(lbuf, sizeof(lbuf), src) == NULL) {
+ if (src == overfile) {
+ src = infile;
+ goto again;
+ }
+ return (NULL);
+ }
+ if (ferror(src))
+ err(1, "%s", infn);
+ lineno++;
+
+ return (lbuf);
+}
+
+/* Conceptually rewind the input (as obtained by get_line()) back `n' lines. */
+static void
+toomuch(FILE *ofp, long n)
+{
+ char buf[BUFSIZ];
+ size_t i, nread;
+
+ if (overfile != NULL) {
+ /*
+ * Truncate the previous file we overflowed into back to
+ * the correct length, close it.
+ */
+ if (fflush(overfile) != 0)
+ err(1, "overflow");
+ if (ftruncate(fileno(overfile), truncofs) != 0)
+ err(1, "overflow");
+ if (fclose(overfile) != 0)
+ err(1, "overflow");
+ overfile = NULL;
+ }
+
+ if (n == 0)
+ /* Just tidying up */
+ return;
+
+ lineno -= n;
+
+ /*
+ * Wind the overflow file backwards to `n' lines before the
+ * current one.
+ */
+ do {
+ if (ftello(ofp) < (off_t)sizeof(buf))
+ rewind(ofp);
+ else
+ fseeko(ofp, -(off_t)sizeof(buf), SEEK_CUR);
+ if (ferror(ofp))
+ errx(1, "%s: can't seek", currfile);
+ if ((nread = fread(buf, 1, sizeof(buf), ofp)) == 0)
+ errx(1, "can't read overflowed output");
+ if (fseeko(ofp, -(off_t)nread, SEEK_CUR) != 0)
+ err(1, "%s", currfile);
+ for (i = 1; i <= nread; i++)
+ if (buf[nread - i] == '\n' && n-- == 0)
+ break;
+ if (ftello(ofp) == 0)
+ break;
+ } while (n > 0);
+ if (fseeko(ofp, nread - i + 1, SEEK_CUR) != 0)
+ err(1, "%s", currfile);
+
+ /*
+ * get_line() will read from here. Next call will truncate to
+ * truncofs in this file.
+ */
+ overfile = ofp;
+ truncofs = ftello(overfile);
+}
+
+/* Handle splits for /regexp/ and %regexp% patterns. */
+static void
+do_rexp(const char *expr)
+{
+ regex_t cre;
+ intmax_t nwritten;
+ long ofs;
+ int first;
+ char *ecopy, *ep, *p, *pofs, *re;
+ FILE *ofp;
+
+ if ((ecopy = strdup(expr)) == NULL)
+ err(1, "strdup");
+
+ re = ecopy + 1;
+ if ((pofs = strrchr(ecopy, *expr)) == NULL || pofs[-1] == '\\')
+ errx(1, "%s: missing trailing %c", expr, *expr);
+ *pofs++ = '\0';
+
+ if (*pofs != '\0') {
+ errno = 0;
+ ofs = strtol(pofs, &ep, 10);
+ if (*ep != '\0' || errno != 0)
+ errx(1, "%s: bad offset", pofs);
+ } else
+ ofs = 0;
+
+ if (regcomp(&cre, re, REG_BASIC|REG_NOSUB) != 0)
+ errx(1, "%s: bad regular expression", re);
+
+ if (*expr == '/')
+ /* /regexp/: Save results to a file. */
+ ofp = newfile();
+ else {
+ /* %regexp%: Make a temporary file for overflow. */
+ if ((ofp = tmpfile()) == NULL)
+ err(1, "tmpfile");
+ }
+
+ /* Read and output lines until we get a match. */
+ first = 1;
+ while ((p = get_line()) != NULL) {
+ if (fputs(p, ofp) != 0)
+ break;
+ if (!first && regexec(&cre, p, 0, NULL, 0) == 0)
+ break;
+ first = 0;
+ }
+
+ if (p == NULL)
+ errx(1, "%s: no match", re);
+
+ if (ofs <= 0) {
+ /*
+ * Negative (or zero) offset: throw back any lines we should
+ * not have read yet.
+ */
+ if (p != NULL) {
+ toomuch(ofp, -ofs + 1);
+ nwritten = (intmax_t)truncofs;
+ } else
+ nwritten = (intmax_t)ftello(ofp);
+ } else {
+ /*
+ * Positive offset: copy the requested number of lines
+ * after the match.
+ */
+ while (--ofs > 0 && (p = get_line()) != NULL)
+ fputs(p, ofp);
+ toomuch(NULL, 0);
+ nwritten = (intmax_t)ftello(ofp);
+ if (fclose(ofp) != 0)
+ err(1, "%s", currfile);
+ }
+
+ if (!sflag && *expr == '/')
+ printf("%jd\n", nwritten);
+
+ regfree(&cre);
+ free(ecopy);
+}
+
+/* Handle splits based on line number. */
+static void
+do_lineno(const char *expr)
+{
+ long lastline, tgtline;
+ char *ep, *p;
+ FILE *ofp;
+
+ errno = 0;
+ tgtline = strtol(expr, &ep, 10);
+ if (tgtline <= 0 || errno != 0 || *ep != '\0')
+ errx(1, "%s: bad line number", expr);
+ lastline = tgtline;
+ if (lastline <= lineno)
+ errx(1, "%s: can't go backwards", expr);
+
+ while (nfiles < maxfiles - 1) {
+ ofp = newfile();
+ while (lineno + 1 != lastline) {
+ if ((p = get_line()) == NULL)
+ errx(1, "%ld: out of range", lastline);
+ if (fputs(p, ofp) != 0)
+ break;
+ }
+ if (!sflag)
+ printf("%jd\n", (intmax_t)ftello(ofp));
+ if (fclose(ofp) != 0)
+ err(1, "%s", currfile);
+ if (reps-- == 0)
+ break;
+ lastline += tgtline;
+ }
+}
diff --git a/usr.bin/ctags/C.c b/usr.bin/ctags/C.c
new file mode 100644
index 0000000..2287848
--- /dev/null
+++ b/usr.bin/ctags/C.c
@@ -0,0 +1,532 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctags.h"
+
+static int func_entry(void);
+static void hash_entry(void);
+static void skip_string(int);
+static int str_entry(int);
+
+/*
+ * c_entries --
+ * read .c and .h files and call appropriate routines
+ */
+void
+c_entries(void)
+{
+ int c; /* current character */
+ int level; /* brace level */
+ int token; /* if reading a token */
+ int t_def; /* if reading a typedef */
+ int t_level; /* typedef's brace level */
+ char *sp; /* buffer pointer */
+ char tok[MAXTOKEN]; /* token buffer */
+
+ lineftell = ftell(inf);
+ sp = tok; token = t_def = NO; t_level = -1; level = 0; lineno = 1;
+ while (GETC(!=, EOF)) {
+ switch (c) {
+ /*
+ * Here's where it DOESN'T handle: {
+ * foo(a)
+ * {
+ * #ifdef notdef
+ * }
+ * #endif
+ * if (a)
+ * puts("hello, world");
+ * }
+ */
+ case '{':
+ ++level;
+ goto endtok;
+ case '}':
+ /*
+ * if level goes below zero, try and fix
+ * it, even though we've already messed up
+ */
+ if (--level < 0)
+ level = 0;
+ goto endtok;
+
+ case '\n':
+ SETLINE;
+ /*
+ * the above 3 cases are similar in that they
+ * are special characters that also end tokens.
+ */
+ endtok: if (sp > tok) {
+ *sp = EOS;
+ token = YES;
+ sp = tok;
+ }
+ else
+ token = NO;
+ continue;
+
+ /*
+ * We ignore quoted strings and character constants
+ * completely.
+ */
+ case '"':
+ case '\'':
+ skip_string(c);
+ break;
+
+ /*
+ * comments can be fun; note the state is unchanged after
+ * return, in case we found:
+ * "foo() XX comment XX { int bar; }"
+ */
+ case '/':
+ if (GETC(==, '*') || c == '/') {
+ skip_comment(c);
+ continue;
+ }
+ (void)ungetc(c, inf);
+ c = '/';
+ goto storec;
+
+ /* hash marks flag #define's. */
+ case '#':
+ if (sp == tok) {
+ hash_entry();
+ break;
+ }
+ goto storec;
+
+ /*
+ * if we have a current token, parenthesis on
+ * level zero indicates a function.
+ */
+ case '(':
+ if (!level && token) {
+ int curline;
+
+ if (sp != tok)
+ *sp = EOS;
+ /*
+ * grab the line immediately, we may
+ * already be wrong, for example,
+ * foo\n
+ * (arg1,
+ */
+ get_line();
+ curline = lineno;
+ if (func_entry()) {
+ ++level;
+ pfnote(tok, curline);
+ }
+ break;
+ }
+ goto storec;
+
+ /*
+ * semi-colons indicate the end of a typedef; if we find a
+ * typedef we search for the next semi-colon of the same
+ * level as the typedef. Ignoring "structs", they are
+ * tricky, since you can find:
+ *
+ * "typedef long time_t;"
+ * "typedef unsigned int u_int;"
+ * "typedef unsigned int u_int [10];"
+ *
+ * If looking at a typedef, we save a copy of the last token
+ * found. Then, when we find the ';' we take the current
+ * token if it starts with a valid token name, else we take
+ * the one we saved. There's probably some reasonable
+ * alternative to this...
+ */
+ case ';':
+ if (t_def && level == t_level) {
+ t_def = NO;
+ get_line();
+ if (sp != tok)
+ *sp = EOS;
+ pfnote(tok, lineno);
+ break;
+ }
+ goto storec;
+
+ /*
+ * store characters until one that can't be part of a token
+ * comes along; check the current token against certain
+ * reserved words.
+ */
+ default:
+ /* ignore whitespace */
+ if (c == ' ' || c == '\t') {
+ int save = c;
+ while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
+ ;
+ if (c == EOF)
+ return;
+ (void)ungetc(c, inf);
+ c = save;
+ }
+ storec: if (!intoken(c)) {
+ if (sp == tok)
+ break;
+ *sp = EOS;
+ if (tflag) {
+ /* no typedefs inside typedefs */
+ if (!t_def &&
+ !memcmp(tok, "typedef",8)) {
+ t_def = YES;
+ t_level = level;
+ break;
+ }
+ /* catch "typedef struct" */
+ if ((!t_def || t_level < level)
+ && (!memcmp(tok, "struct", 7)
+ || !memcmp(tok, "union", 6)
+ || !memcmp(tok, "enum", 5))) {
+ /*
+ * get line immediately;
+ * may change before '{'
+ */
+ get_line();
+ if (str_entry(c))
+ ++level;
+ break;
+ /* } */
+ }
+ }
+ sp = tok;
+ }
+ else if (sp != tok || begtoken(c)) {
+ if (sp == tok + sizeof tok - 1)
+ /* Too long -- truncate it */
+ *sp = EOS;
+ else
+ *sp++ = c;
+ token = YES;
+ }
+ continue;
+ }
+
+ sp = tok;
+ token = NO;
+ }
+}
+
+/*
+ * func_entry --
+ * handle a function reference
+ */
+static int
+func_entry(void)
+{
+ int c; /* current character */
+ int level = 0; /* for matching '()' */
+
+ /*
+ * Find the end of the assumed function declaration.
+ * Note that ANSI C functions can have type definitions so keep
+ * track of the parentheses nesting level.
+ */
+ while (GETC(!=, EOF)) {
+ switch (c) {
+ case '\'':
+ case '"':
+ /* skip strings and character constants */
+ skip_string(c);
+ break;
+ case '/':
+ /* skip comments */
+ if (GETC(==, '*') || c == '/')
+ skip_comment(c);
+ break;
+ case '(':
+ level++;
+ break;
+ case ')':
+ if (level == 0)
+ goto fnd;
+ level--;
+ break;
+ case '\n':
+ SETLINE;
+ }
+ }
+ return (NO);
+fnd:
+ /*
+ * we assume that the character after a function's right paren
+ * is a token character if it's a function and a non-token
+ * character if it's a declaration. Comments don't count...
+ */
+ for (;;) {
+ while (GETC(!=, EOF) && iswhite(c))
+ if (c == '\n')
+ SETLINE;
+ if (intoken(c) || c == '{')
+ break;
+ if (c == '/' && (GETC(==, '*') || c == '/'))
+ skip_comment(c);
+ else { /* don't ever "read" '/' */
+ (void)ungetc(c, inf);
+ return (NO);
+ }
+ }
+ if (c != '{')
+ (void)skip_key('{');
+ return (YES);
+}
+
+/*
+ * hash_entry --
+ * handle a line starting with a '#'
+ */
+static void
+hash_entry(void)
+{
+ int c; /* character read */
+ int curline; /* line started on */
+ char *sp; /* buffer pointer */
+ char tok[MAXTOKEN]; /* storage buffer */
+
+ /* ignore leading whitespace */
+ while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
+ ;
+ (void)ungetc(c, inf);
+
+ curline = lineno;
+ for (sp = tok;;) { /* get next token */
+ if (GETC(==, EOF))
+ return;
+ if (iswhite(c))
+ break;
+ if (sp == tok + sizeof tok - 1)
+ /* Too long -- truncate it */
+ *sp = EOS;
+ else
+ *sp++ = c;
+ }
+ *sp = EOS;
+ if (memcmp(tok, "define", 6)) /* only interested in #define's */
+ goto skip;
+ for (;;) { /* this doesn't handle "#define \n" */
+ if (GETC(==, EOF))
+ return;
+ if (!iswhite(c))
+ break;
+ }
+ for (sp = tok;;) { /* get next token */
+ if (sp == tok + sizeof tok - 1)
+ /* Too long -- truncate it */
+ *sp = EOS;
+ else
+ *sp++ = c;
+ if (GETC(==, EOF))
+ return;
+ /*
+ * this is where it DOESN'T handle
+ * "#define \n"
+ */
+ if (!intoken(c))
+ break;
+ }
+ *sp = EOS;
+ if (dflag || c == '(') { /* only want macros */
+ get_line();
+ pfnote(tok, curline);
+ }
+skip: if (c == '\n') { /* get rid of rest of define */
+ SETLINE
+ if (*(sp - 1) != '\\')
+ return;
+ }
+ (void)skip_key('\n');
+}
+
+/*
+ * str_entry --
+ * handle a struct, union or enum entry
+ */
+static int
+str_entry(int c) /* c is current character */
+{
+ int curline; /* line started on */
+ char *sp; /* buffer pointer */
+ char tok[LINE_MAX]; /* storage buffer */
+
+ curline = lineno;
+ while (iswhite(c))
+ if (GETC(==, EOF))
+ return (NO);
+ if (c == '{') /* it was "struct {" */
+ return (YES);
+ for (sp = tok;;) { /* get next token */
+ if (sp == tok + sizeof tok - 1)
+ /* Too long -- truncate it */
+ *sp = EOS;
+ else
+ *sp++ = c;
+ if (GETC(==, EOF))
+ return (NO);
+ if (!intoken(c))
+ break;
+ }
+ switch (c) {
+ case '{': /* it was "struct foo{" */
+ --sp;
+ break;
+ case '\n': /* it was "struct foo\n" */
+ SETLINE;
+ /*FALLTHROUGH*/
+ default: /* probably "struct foo " */
+ while (GETC(!=, EOF))
+ if (!iswhite(c))
+ break;
+ if (c != '{') {
+ (void)ungetc(c, inf);
+ return (NO);
+ }
+ }
+ *sp = EOS;
+ pfnote(tok, curline);
+ return (YES);
+}
+
+/*
+ * skip_comment --
+ * skip over comment
+ */
+void
+skip_comment(int t) /* t is comment character */
+{
+ int c; /* character read */
+ int star; /* '*' flag */
+
+ for (star = 0; GETC(!=, EOF);)
+ switch(c) {
+ /* comments don't nest, nor can they be escaped. */
+ case '*':
+ star = YES;
+ break;
+ case '/':
+ if (star && t == '*')
+ return;
+ break;
+ case '\n':
+ if (t == '/')
+ return;
+ SETLINE;
+ /*FALLTHROUGH*/
+ default:
+ star = NO;
+ break;
+ }
+}
+
+/*
+ * skip_string --
+ * skip to the end of a string or character constant.
+ */
+void
+skip_string(int key)
+{
+ int c,
+ skip;
+
+ for (skip = NO; GETC(!=, EOF); )
+ switch (c) {
+ case '\\': /* a backslash escapes anything */
+ skip = !skip; /* we toggle in case it's "\\" */
+ break;
+ case '\n':
+ SETLINE;
+ /*FALLTHROUGH*/
+ default:
+ if (c == key && !skip)
+ return;
+ skip = NO;
+ }
+}
+
+/*
+ * skip_key --
+ * skip to next char "key"
+ */
+int
+skip_key(int key)
+{
+ int c,
+ skip,
+ retval;
+
+ for (skip = retval = NO; GETC(!=, EOF);)
+ switch(c) {
+ case '\\': /* a backslash escapes anything */
+ skip = !skip; /* we toggle in case it's "\\" */
+ break;
+ case ';': /* special case for yacc; if one */
+ case '|': /* of these chars occurs, we may */
+ retval = YES; /* have moved out of the rule */
+ break; /* not used by C */
+ case '\'':
+ case '"':
+ /* skip strings and character constants */
+ skip_string(c);
+ break;
+ case '/':
+ /* skip comments */
+ if (GETC(==, '*') || c == '/') {
+ skip_comment(c);
+ break;
+ }
+ (void)ungetc(c, inf);
+ c = '/';
+ goto norm;
+ case '\n':
+ SETLINE;
+ /*FALLTHROUGH*/
+ default:
+ norm:
+ if (c == key && !skip)
+ return (retval);
+ skip = NO;
+ }
+ return (retval);
+}
diff --git a/usr.bin/ctags/Makefile b/usr.bin/ctags/Makefile
new file mode 100644
index 0000000..dc639af
--- /dev/null
+++ b/usr.bin/ctags/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= ctags
+SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c
+CFLAGS+=-I${.CURDIR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ctags/Makefile.depend b/usr.bin/ctags/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/ctags/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/ctags/ctags.1 b/usr.bin/ctags/ctags.1
new file mode 100644
index 0000000..e795b72
--- /dev/null
+++ b/usr.bin/ctags/ctags.1
@@ -0,0 +1,251 @@
+.\" Copyright (c) 1987, 1990, 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.
+.\"
+.\" @(#)ctags.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt CTAGS 1
+.Os
+.Sh NAME
+.Nm ctags
+.Nd create a
+.Pa tags
+file
+.Sh SYNOPSIS
+.Nm
+.Op Fl BFTaduwvx
+.Op Fl f Ar tagsfile
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility makes a
+.Pa tags
+file for
+.Xr ex 1
+from the specified C,
+Pascal, Fortran,
+.Xr yacc 1 ,
+.Xr lex 1 ,
+and Lisp sources.
+A tags file gives the locations of specified objects in a group of files.
+Each line of the tags file contains the object name, the file in which it
+is defined, and a search pattern for the object definition, separated by
+white-space.
+Using the
+.Pa tags
+file,
+.Xr ex 1
+can quickly locate these object definitions.
+Depending upon the options provided to
+.Nm ,
+objects will consist of subroutines, typedefs, defines, structs,
+enums and unions.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl B
+Use backward searching patterns
+.Pq Li ?...? .
+.It Fl F
+Use forward searching patterns
+.Pq Li /.../
+(the default).
+.It Fl T
+Do not create tags for typedefs, structs, unions, and enums.
+.It Fl a
+Append to
+.Pa tags
+file.
+.It Fl d
+Create tags for
+.Li #defines
+that do not take arguments;
+.Li #defines
+that take arguments are tagged automatically.
+.It Fl f
+Place the tag descriptions in a file called
+.Ar tagsfile .
+The default behaviour is to place them in a file called
+.Pa tags .
+.It Fl u
+Update the specified files in the
+.Pa tags
+file, that is, all
+references to them are deleted, and the new values are appended to the
+file.
+(Beware: this option is implemented in a way which is rather
+slow; it is usually faster to simply rebuild the
+.Pa tags
+file.)
+.It Fl v
+An index of the form expected by
+.Xr vgrind 1
+is produced on the standard output.
+This listing
+contains the object name, file name, and page number (assuming 64
+line pages).
+Since the output will be sorted into lexicographic order,
+it may be desired to run the output through
+.Xr sort 1 .
+Sample use:
+.Bd -literal -offset indent
+ctags -v files | sort -f > index
+vgrind -x index
+.Ed
+.It Fl w
+Suppress warning diagnostics.
+.It Fl x
+.Nm
+produces a list of object
+names, the line number and file name on which each is defined, as well
+as the text of that line and prints this on the standard output.
+This
+is a simple index which can be printed out as an off-line readable
+function index.
+.El
+.Pp
+Files whose names end in
+.Pa .c
+or
+.Pa .h
+are assumed to be C
+source files and are searched for C style routine and macro definitions.
+Files whose names end in
+.Pa .y
+are assumed to be
+.Xr yacc 1
+source files.
+Files whose names end in
+.Pa .l
+are assumed to be Lisp files if their
+first non-blank character is
+.Ql \&; ,
+.Ql \&( ,
+or
+.Ql \&[ ,
+otherwise, they are
+treated as
+.Xr lex 1
+files.
+Other files are first examined to see if they
+contain any Pascal or Fortran routine definitions, and, if not, are
+searched for C style definitions.
+.Pp
+The tag
+.Dq Li main
+is treated specially in C programs.
+The tag formed
+is created by prepending
+.Ql M
+to the name of the file, with the
+trailing
+.Pa .c
+and any leading pathname components removed.
+This makes use of
+.Nm
+practical in directories with more than one
+program.
+.Pp
+The
+.Xr yacc 1
+and
+.Xr lex 1
+files each have a special tag.
+.Dq Li yyparse
+is the start
+of the second section of the
+.Xr yacc 1
+file, and
+.Dq Li yylex
+is the start of
+the second section of the
+.Xr lex 1
+file.
+.Sh FILES
+.Bl -tag -width ".Pa tags" -compact
+.It Pa tags
+default output tags file
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with a value of 1 if an error occurred, 0 otherwise.
+Duplicate objects are not considered errors.
+.Sh COMPATIBILITY
+The
+.Fl t
+option is a no-op for compatibility with previous versions of
+.Nm
+that did not create tags for typedefs, enums, structs and unions
+by default.
+.Sh SEE ALSO
+.Xr ex 1 ,
+.Xr vi 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 3.0 .
+.Sh BUGS
+Recognition of functions, subroutines and procedures
+for Fortran and Pascal is done in a very simpleminded way.
+No attempt
+is made to deal with block structure; if you have two Pascal procedures
+in different blocks with the same name you lose.
+The
+.Nm
+utility does not
+understand about Pascal types.
+.Pp
+The method of deciding whether to look for C, Pascal or
+Fortran
+functions is a hack.
+.Pp
+The
+.Nm
+utility relies on the input being well formed, and any syntactical
+errors will completely confuse it.
+It also finds some legal syntax
+confusing; for example, since it does not understand
+.Li #ifdef Ns 's
+(incidentally, that is a feature, not a bug), any code with unbalanced
+braces inside
+.Li #ifdef Ns 's
+will cause it to become somewhat disoriented.
+In a similar fashion, multiple line changes within a definition will
+cause it to enter the last line of the object, rather than the first, as
+the searching pattern.
+The last line of multiple line
+.Li typedef Ns 's
+will similarly be noted.
diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c
new file mode 100644
index 0000000..2819840
--- /dev/null
+++ b/usr.bin/ctags/ctags.c
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 1987, 1993, 1994, 1995
+ * 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) 1987, 1993, 1994, 1995\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ctags.h"
+
+/*
+ * ctags: create a tags file
+ */
+
+NODE *head; /* head of the sorted binary tree */
+
+ /* boolean "func" (see init()) */
+bool _wht[256], _etk[256], _itk[256], _btk[256], _gd[256];
+
+FILE *inf; /* ioptr for current input file */
+FILE *outf; /* ioptr for tags file */
+
+long lineftell; /* ftell after getc( inf ) == '\n' */
+
+int lineno; /* line number of current line */
+int dflag; /* -d: non-macro defines */
+int tflag; /* -t: create tags for typedefs */
+int vflag; /* -v: vgrind style index output */
+int wflag; /* -w: suppress warnings */
+int xflag; /* -x: cxref style output */
+
+char *curfile; /* current input file name */
+char searchar = '/'; /* use /.../ searches by default */
+char lbuf[LINE_MAX];
+
+void init(void);
+void find_entries(char *);
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ static const char *outfile = "tags"; /* output file */
+ int aflag; /* -a: append to tags */
+ int uflag; /* -u: update tags */
+ int exit_val; /* exit value */
+ int step; /* step through args */
+ int ch; /* getopts char */
+
+ setlocale(LC_ALL, "");
+
+ aflag = uflag = NO;
+ tflag = YES;
+ while ((ch = getopt(argc, argv, "BFTadf:tuwvx")) != -1)
+ switch(ch) {
+ case 'B':
+ searchar = '?';
+ break;
+ case 'F':
+ searchar = '/';
+ break;
+ case 'T':
+ tflag = NO;
+ break;
+ case 'a':
+ aflag++;
+ break;
+ case 'd':
+ dflag++;
+ break;
+ case 'f':
+ outfile = optarg;
+ break;
+ case 't':
+ tflag = YES;
+ break;
+ case 'u':
+ uflag++;
+ break;
+ case 'w':
+ wflag++;
+ break;
+ case 'v':
+ vflag++;
+ case 'x':
+ xflag++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+ if (!argc)
+ usage();
+
+ if (!xflag)
+ setlocale(LC_COLLATE, "C");
+
+ init();
+
+ for (exit_val = step = 0; step < argc; ++step)
+ if (!(inf = fopen(argv[step], "r"))) {
+ warn("%s", argv[step]);
+ exit_val = 1;
+ }
+ else {
+ curfile = argv[step];
+ find_entries(argv[step]);
+ (void)fclose(inf);
+ }
+
+ if (head) {
+ if (xflag)
+ put_entries(head);
+ else {
+ if (uflag) {
+ FILE *oldf;
+ regex_t *regx;
+
+ if ((oldf = fopen(outfile, "r")) == NULL)
+ err(1, "opening %s", outfile);
+ if (unlink(outfile))
+ err(1, "unlinking %s", outfile);
+ if ((outf = fopen(outfile, "w")) == NULL)
+ err(1, "recreating %s", outfile);
+ if ((regx = calloc(argc, sizeof(regex_t))) == NULL)
+ err(1, "RE alloc");
+ for (step = 0; step < argc; step++) {
+ (void)strcpy(lbuf, "\t");
+ (void)strlcat(lbuf, argv[step], LINE_MAX);
+ (void)strlcat(lbuf, "\t", LINE_MAX);
+ if (regcomp(regx + step, lbuf,
+ REG_NOSPEC))
+ warn("RE compilation failed");
+ }
+nextline:
+ while (fgets(lbuf, LINE_MAX, oldf)) {
+ for (step = 0; step < argc; step++)
+ if (regexec(regx + step,
+ lbuf, 0, NULL, 0) == 0)
+ goto nextline;
+ fputs(lbuf, outf);
+ }
+ for (step = 0; step < argc; step++)
+ regfree(regx + step);
+ free(regx);
+ fclose(oldf);
+ fclose(outf);
+ ++aflag;
+ }
+ if (!(outf = fopen(outfile, aflag ? "a" : "w")))
+ err(1, "%s", outfile);
+ put_entries(head);
+ (void)fclose(outf);
+ if (uflag) {
+ pid_t pid;
+
+ if ((pid = fork()) == -1)
+ err(1, "fork failed");
+ else if (pid == 0) {
+ execlp("sort", "sort", "-o", outfile,
+ outfile, NULL);
+ err(1, "exec of sort failed");
+ }
+ /* Just assume the sort went OK. The old code
+ did not do any checks either. */
+ (void)wait(NULL);
+ }
+ }
+ }
+ exit(exit_val);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: ctags [-BFTaduwvx] [-f tagsfile] file ...\n");
+ exit(1);
+}
+
+/*
+ * init --
+ * this routine sets up the boolean pseudo-functions which work by
+ * setting boolean flags dependent upon the corresponding character.
+ * Every char which is NOT in that string is false with respect to
+ * the pseudo-function. Therefore, all of the array "_wht" is NO
+ * by default and then the elements subscripted by the chars in
+ * CWHITE are set to YES. Thus, "_wht" of a char is YES if it is in
+ * the string CWHITE, else NO.
+ */
+void
+init(void)
+{
+ int i;
+ const unsigned char *sp;
+
+ for (i = 0; i < 256; i++) {
+ _wht[i] = _etk[i] = _itk[i] = _btk[i] = NO;
+ _gd[i] = YES;
+ }
+#define CWHITE " \f\t\n"
+ for (sp = CWHITE; *sp; sp++) /* white space chars */
+ _wht[*sp] = YES;
+#define CTOKEN " \t\n\"'#()[]{}=-+%*/&|^~!<>;,.:?"
+ for (sp = CTOKEN; *sp; sp++) /* token ending chars */
+ _etk[*sp] = YES;
+#define CINTOK "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz0123456789"
+ for (sp = CINTOK; *sp; sp++) /* valid in-token chars */
+ _itk[*sp] = YES;
+#define CBEGIN "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
+ for (sp = CBEGIN; *sp; sp++) /* token starting chars */
+ _btk[*sp] = YES;
+#define CNOTGD ",;"
+ for (sp = CNOTGD; *sp; sp++) /* invalid after-function chars */
+ _gd[*sp] = NO;
+}
+
+/*
+ * find_entries --
+ * this routine opens the specified file and calls the function
+ * which searches the file.
+ */
+void
+find_entries(char *file)
+{
+ char *cp;
+
+ lineno = 0; /* should be 1 ?? KB */
+ if ((cp = strrchr(file, '.'))) {
+ if (cp[1] == 'l' && !cp[2]) {
+ int c;
+
+ for (;;) {
+ if (GETC(==, EOF))
+ return;
+ if (!iswhite(c)) {
+ rewind(inf);
+ break;
+ }
+ }
+#define LISPCHR ";(["
+/* lisp */ if (strchr(LISPCHR, c)) {
+ l_entries();
+ return;
+ }
+/* lex */ else {
+ /*
+ * we search all 3 parts of a lex file
+ * for C references. This may be wrong.
+ */
+ toss_yysec();
+ (void)strcpy(lbuf, "%%$");
+ pfnote("yylex", lineno);
+ rewind(inf);
+ }
+ }
+/* yacc */ else if (cp[1] == 'y' && !cp[2]) {
+ /*
+ * we search only the 3rd part of a yacc file
+ * for C references. This may be wrong.
+ */
+ toss_yysec();
+ (void)strcpy(lbuf, "%%$");
+ pfnote("yyparse", lineno);
+ y_entries();
+ }
+/* fortran */ else if ((cp[1] != 'c' && cp[1] != 'h') && !cp[2]) {
+ if (PF_funcs())
+ return;
+ rewind(inf);
+ }
+ }
+/* C */ c_entries();
+}
diff --git a/usr.bin/ctags/ctags.h b/usr.bin/ctags/ctags.h
new file mode 100644
index 0000000..597723d
--- /dev/null
+++ b/usr.bin/ctags/ctags.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ *
+ * @(#)ctags.h 8.3 (Berkeley) 4/2/94
+ *
+ * $FreeBSD$
+ *
+ */
+
+#define bool char
+
+#define YES 1
+#define NO 0
+#define EOS '\0'
+
+#define ENDLINE 50 /* max length of pattern */
+#define MAXTOKEN 250 /* max size of single token */
+
+#define SETLINE {++lineno;lineftell = ftell(inf);}
+#define GETC(op,exp) ((c = getc(inf)) op (int)exp)
+
+/*
+ * These character classification macros assume that the (EOF & 0xff) element
+ * of the arrays is always 'NO', as the EOF return from getc() gets masked
+ * to that value. Masking with 0xff has no effect for normal characters
+ * returned by getc() provided chars have 8 bits.
+ */
+
+#define iswhite(arg) _wht[arg & 0xff] /* T if char is white */
+#define begtoken(arg) _btk[arg & 0xff] /* T if char can start token */
+#define intoken(arg) _itk[arg & 0xff] /* T if char can be in token */
+#define endtoken(arg) _etk[arg & 0xff] /* T if char ends tokens */
+#define isgood(arg) _gd[arg & 0xff] /* T if char can be after ')' */
+
+typedef struct nd_st { /* sorting structure */
+ struct nd_st *left,
+ *right; /* left and right sons */
+ char *entry, /* function or type name */
+ *file, /* file name */
+ *pat; /* search pattern */
+ int lno; /* for -x option */
+ bool been_warned; /* set if noticed dup */
+} NODE;
+
+extern char *curfile; /* current input file name */
+extern NODE *head; /* head of the sorted binary tree */
+extern FILE *inf; /* ioptr for current input file */
+extern FILE *outf; /* ioptr for current output file */
+extern long lineftell; /* ftell after getc( inf ) == '\n' */
+extern int lineno; /* line number of current line */
+extern int dflag; /* -d: non-macro defines */
+extern int tflag; /* -t: create tags for typedefs */
+extern int vflag; /* -v: vgrind style index output */
+extern int wflag; /* -w: suppress warnings */
+extern int xflag; /* -x: cxref style output */
+extern bool _wht[], _etk[], _itk[], _btk[], _gd[];
+extern char lbuf[LINE_MAX];
+extern char *lbp;
+extern char searchar; /* ex search character */
+
+extern int cicmp(const char *);
+extern void get_line(void);
+extern void pfnote(const char *, int);
+extern int skip_key(int);
+extern void put_entries(NODE *);
+extern void toss_yysec(void);
+extern void l_entries(void);
+extern void y_entries(void);
+extern int PF_funcs(void);
+extern void c_entries(void);
+extern void skip_comment(int);
diff --git a/usr.bin/ctags/fortran.c b/usr.bin/ctags/fortran.c
new file mode 100644
index 0000000..66d4b54
--- /dev/null
+++ b/usr.bin/ctags/fortran.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)fortran.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctags.h"
+
+static void takeprec(void);
+
+char *lbp; /* line buffer pointer */
+
+int
+PF_funcs(void)
+{
+ bool pfcnt; /* pascal/fortran functions found */
+ char *cp;
+ char tok[MAXTOKEN];
+
+ for (pfcnt = NO;;) {
+ lineftell = ftell(inf);
+ if (!fgets(lbuf, sizeof(lbuf), inf))
+ return (pfcnt);
+ ++lineno;
+ lbp = lbuf;
+ if (*lbp == '%') /* Ratfor escape to fortran */
+ ++lbp;
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ if (!*lbp)
+ continue;
+ switch (*lbp | ' ') { /* convert to lower-case */
+ case 'c':
+ if (cicmp("complex") || cicmp("character"))
+ takeprec();
+ break;
+ case 'd':
+ if (cicmp("double")) {
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ if (!*lbp)
+ continue;
+ if (cicmp("precision"))
+ break;
+ continue;
+ }
+ break;
+ case 'i':
+ if (cicmp("integer"))
+ takeprec();
+ break;
+ case 'l':
+ if (cicmp("logical"))
+ takeprec();
+ break;
+ case 'r':
+ if (cicmp("real"))
+ takeprec();
+ break;
+ }
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ if (!*lbp)
+ continue;
+ switch (*lbp | ' ') {
+ case 'f':
+ if (cicmp("function"))
+ break;
+ continue;
+ case 'p':
+ if (cicmp("program") || cicmp("procedure"))
+ break;
+ continue;
+ case 's':
+ if (cicmp("subroutine"))
+ break;
+ default:
+ continue;
+ }
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ if (!*lbp)
+ continue;
+ for (cp = lbp + 1; *cp && intoken(*cp); ++cp)
+ continue;
+ if (cp == lbp + 1)
+ continue;
+ *cp = EOS;
+ (void)strlcpy(tok, lbp, sizeof(tok)); /* possible trunc */
+ get_line(); /* process line for ex(1) */
+ pfnote(tok, lineno);
+ pfcnt = YES;
+ }
+ /*NOTREACHED*/
+}
+
+/*
+ * cicmp --
+ * do case-independent strcmp
+ */
+int
+cicmp(const char *cp)
+{
+ int len;
+ char *bp;
+
+ for (len = 0, bp = lbp; *cp && (*cp &~ ' ') == (*bp++ &~ ' ');
+ ++cp, ++len)
+ continue;
+ if (!*cp) {
+ lbp += len;
+ return (YES);
+ }
+ return (NO);
+}
+
+static void
+takeprec(void)
+{
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ if (*lbp == '*') {
+ for (++lbp; isspace(*lbp); ++lbp)
+ continue;
+ if (!isdigit(*lbp))
+ --lbp; /* force failure */
+ else
+ while (isdigit(*++lbp))
+ continue;
+ }
+}
diff --git a/usr.bin/ctags/lisp.c b/usr.bin/ctags/lisp.c
new file mode 100644
index 0000000..0d0e2c2
--- /dev/null
+++ b/usr.bin/ctags/lisp.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ctags.h"
+
+/*
+ * lisp tag functions
+ * just look for (def or (DEF
+ */
+void
+l_entries(void)
+{
+ int special;
+ char *cp;
+ char savedc;
+ char tok[MAXTOKEN];
+
+ for (;;) {
+ lineftell = ftell(inf);
+ if (!fgets(lbuf, sizeof(lbuf), inf))
+ return;
+ ++lineno;
+ lbp = lbuf;
+ if (!cicmp("(def"))
+ continue;
+ special = NO;
+ switch(*lbp | ' ') {
+ case 'm':
+ if (cicmp("method"))
+ special = YES;
+ break;
+ case 'w':
+ if (cicmp("wrapper") || cicmp("whopper"))
+ special = YES;
+ }
+ for (; !isspace(*lbp); ++lbp)
+ continue;
+ for (; isspace(*lbp); ++lbp)
+ continue;
+ for (cp = lbp; *cp && *cp != '\n'; ++cp)
+ continue;
+ *cp = EOS;
+ if (special) {
+ if (!(cp = strchr(lbp, ')')))
+ continue;
+ for (; cp >= lbp && *cp != ':'; --cp)
+ continue;
+ if (cp < lbp)
+ continue;
+ lbp = cp;
+ for (; *cp && *cp != ')' && *cp != ' '; ++cp)
+ continue;
+ }
+ else
+ for (cp = lbp + 1;
+ *cp && *cp != '(' && *cp != ' '; ++cp)
+ continue;
+ savedc = *cp;
+ *cp = EOS;
+ (void)strlcpy(tok, lbp, sizeof(tok)); /* possible trunc */
+ *cp = savedc;
+ get_line();
+ pfnote(tok, lineno);
+ }
+ /*NOTREACHED*/
+}
diff --git a/usr.bin/ctags/print.c b/usr.bin/ctags/print.c
new file mode 100644
index 0000000..ca5b9de
--- /dev/null
+++ b/usr.bin/ctags/print.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <limits.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "ctags.h"
+
+/*
+ * get_line --
+ * get the line the token of interest occurred on,
+ * prepare it for printing.
+ */
+void
+get_line(void)
+{
+ long saveftell;
+ int c;
+ int cnt;
+ char *cp;
+
+ saveftell = ftell(inf);
+ (void)fseek(inf, lineftell, L_SET);
+ if (xflag)
+ for (cp = lbuf; GETC(!=, EOF) && c != '\n'; *cp++ = c)
+ continue;
+ /*
+ * do all processing here, so we don't step through the
+ * line more than once; means you don't call this routine
+ * unless you're sure you've got a keeper.
+ */
+ else for (cnt = 0, cp = lbuf; GETC(!=, EOF) && cnt < ENDLINE; ++cnt) {
+ if (c == '\\') { /* backslashes */
+ if (cnt > ENDLINE - 2)
+ break;
+ *cp++ = '\\'; *cp++ = '\\';
+ ++cnt;
+ }
+ else if (c == (int)searchar) { /* search character */
+ if (cnt > ENDLINE - 2)
+ break;
+ *cp++ = '\\'; *cp++ = c;
+ ++cnt;
+ }
+ else if (c == '\n') { /* end of keep */
+ *cp++ = '$'; /* can find whole line */
+ break;
+ }
+ else
+ *cp++ = c;
+ }
+ *cp = EOS;
+ (void)fseek(inf, saveftell, L_SET);
+}
+
+/*
+ * put_entries --
+ * write out the tags
+ */
+void
+put_entries(NODE *node)
+{
+
+ if (node->left)
+ put_entries(node->left);
+ if (vflag)
+ printf("%s %s %d\n",
+ node->entry, node->file, (node->lno + 63) / 64);
+ else if (xflag)
+ printf("%-16s %4d %-16s %s\n",
+ node->entry, node->lno, node->file, node->pat);
+ else
+ fprintf(outf, "%s\t%s\t%c^%s%c\n",
+ node->entry, node->file, searchar, node->pat, searchar);
+ if (node->right)
+ put_entries(node->right);
+}
diff --git a/usr.bin/ctags/test/ctags.test b/usr.bin/ctags/test/ctags.test
new file mode 100644
index 0000000..1f334ac
--- /dev/null
+++ b/usr.bin/ctags/test/ctags.test
@@ -0,0 +1,67 @@
+int bar = (1 + 5);
+
+FOO("here is a #define test: ) {");
+char sysent[20];
+int nsysent = sizeof (sysent) / sizeof (sysent[0]);
+/*
+ * now is the time for a comment.
+ * four lines in length...
+ */struct struct_xtra{int list;};r4(x,y){};typedef struct{int bar;}struct_xxe;
+#define FOO BAR
+struct struct_three {
+ int list;
+};
+#define SINGLE
+int BAD();
+enum color {red, green, gold, brown};
+char qq[] = " quote(one,two) {int bar;} ";
+typedef struct {
+ int bar;
+ struct struct_two {
+ int foo;
+ union union_3 {
+ struct struct_three entry;
+ char size[25];
+ };
+ struct last {
+ struct struct_three xentry;
+ char list[34];
+ };
+ };
+} struct_one;
+#define TWOLINE ((MAXLIST + FUTURE + 15) \
+ / (time_to_live ? 3 : 4))
+#if (defined(BAR))
+int bar;
+#endif
+#define MULTIPLE {\
+ multiple(one,two); \
+ lineno++; \
+ callroute(one,two); \
+}
+#if defined(BAR)
+int bar;
+#endif
+union union_one {
+ struct struct_three s3;
+ char foo[25];
+};
+#define XYZ(A,B) (A + B / 2) * (3 - 26 + l_lineno)
+routine1(one,two) /* comments here are fun... */
+ struct {
+ int entry;
+ char bar[34];
+ } *one;
+ char two[10];
+{
+typedef unsigned char u_char;
+ register struct buf *bp;
+ five(one,two);
+}
+ routine2 (one,two) { puts("hello\n"); }
+ routine3
+(one,
+two) { puts("world\n"); }
+routine4(int one, char (*two)(void)) /* test ANSI arguments */
+{
+}
diff --git a/usr.bin/ctags/tree.c b/usr.bin/ctags/tree.c
new file mode 100644
index 0000000..b9b2c7a
--- /dev/null
+++ b/usr.bin/ctags/tree.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)tree.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ctags.h"
+
+static void add_node(NODE *, NODE *);
+static void free_tree(NODE *);
+
+/*
+ * pfnote --
+ * enter a new node in the tree
+ */
+void
+pfnote(const char *name, int ln)
+{
+ NODE *np;
+ char *fp;
+ char nbuf[MAXTOKEN];
+
+ /*NOSTRICT*/
+ if (!(np = (NODE *)malloc(sizeof(NODE)))) {
+ warnx("too many entries to sort");
+ put_entries(head);
+ free_tree(head);
+ /*NOSTRICT*/
+ if (!(head = np = (NODE *)malloc(sizeof(NODE))))
+ errx(1, "out of space");
+ }
+ if (!xflag && !strcmp(name, "main")) {
+ if (!(fp = strrchr(curfile, '/')))
+ fp = curfile;
+ else
+ ++fp;
+ (void)snprintf(nbuf, sizeof(nbuf), "M%s", fp);
+ fp = strrchr(nbuf, '.');
+ if (fp && !fp[2])
+ *fp = EOS;
+ name = nbuf;
+ }
+ if (!(np->entry = strdup(name)))
+ err(1, NULL);
+ np->file = curfile;
+ np->lno = ln;
+ np->left = np->right = 0;
+ if (!(np->pat = strdup(lbuf)))
+ err(1, NULL);
+ if (!head)
+ head = np;
+ else
+ add_node(np, head);
+}
+
+static void
+add_node(NODE *node, NODE *cur_node)
+{
+ int dif;
+
+ dif = strcoll(node->entry, cur_node->entry);
+ if (!dif) {
+ if (node->file == cur_node->file) {
+ if (!wflag)
+ fprintf(stderr, "Duplicate entry in file %s, line %d: %s\nSecond entry ignored\n", node->file, lineno, node->entry);
+ return;
+ }
+ if (!cur_node->been_warned)
+ if (!wflag)
+ fprintf(stderr, "Duplicate entry in files %s and %s: %s (Warning only)\n", node->file, cur_node->file, node->entry);
+ cur_node->been_warned = YES;
+ }
+ else if (dif < 0)
+ if (cur_node->left)
+ add_node(node, cur_node->left);
+ else
+ cur_node->left = node;
+ else if (cur_node->right)
+ add_node(node, cur_node->right);
+ else
+ cur_node->right = node;
+}
+
+static void
+free_tree(NODE *node)
+{
+ NODE *node_next;
+ while (node) {
+ if (node->right)
+ free_tree(node->right);
+ node_next = node->left;
+ free(node);
+ node = node_next;
+ }
+}
diff --git a/usr.bin/ctags/yacc.c b/usr.bin/ctags/yacc.c
new file mode 100644
index 0000000..5678da5
--- /dev/null
+++ b/usr.bin/ctags/yacc.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)yacc.c 8.3 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+
+#include "ctags.h"
+
+/*
+ * y_entries:
+ * find the yacc tags and put them in.
+ */
+void
+y_entries(void)
+{
+ int c;
+ char *sp;
+ bool in_rule;
+ char tok[MAXTOKEN];
+
+ in_rule = NO;
+
+ while (GETC(!=, EOF))
+ switch (c) {
+ case '\n':
+ SETLINE;
+ /* FALLTHROUGH */
+ case ' ':
+ case '\f':
+ case '\r':
+ case '\t':
+ break;
+ case '{':
+ if (skip_key('}'))
+ in_rule = NO;
+ break;
+ case '\'':
+ case '"':
+ if (skip_key(c))
+ in_rule = NO;
+ break;
+ case '%':
+ if (GETC(==, '%'))
+ return;
+ (void)ungetc(c, inf);
+ break;
+ case '/':
+ if (GETC(==, '*') || c == '/')
+ skip_comment(c);
+ else
+ (void)ungetc(c, inf);
+ break;
+ case '|':
+ case ';':
+ in_rule = NO;
+ break;
+ default:
+ if (in_rule || (!isalpha(c) && c != '.' && c != '_'))
+ break;
+ sp = tok;
+ *sp++ = c;
+ while (GETC(!=, EOF) && (intoken(c) || c == '.'))
+ *sp++ = c;
+ *sp = EOS;
+ get_line(); /* may change before ':' */
+ while (iswhite(c)) {
+ if (c == '\n')
+ SETLINE;
+ if (GETC(==, EOF))
+ return;
+ }
+ if (c == ':') {
+ pfnote(tok, lineno);
+ in_rule = YES;
+ }
+ else
+ (void)ungetc(c, inf);
+ }
+}
+
+/*
+ * toss_yysec --
+ * throw away lines up to the next "\n%%\n"
+ */
+void
+toss_yysec(void)
+{
+ int c; /* read character */
+ int state;
+
+ /*
+ * state == 0 : waiting
+ * state == 1 : received a newline
+ * state == 2 : received first %
+ * state == 3 : received second %
+ */
+ lineftell = ftell(inf);
+ for (state = 0; GETC(!=, EOF);)
+ switch (c) {
+ case '\n':
+ ++lineno;
+ lineftell = ftell(inf);
+ if (state == 3) /* done! */
+ return;
+ state = 1; /* start over */
+ break;
+ case '%':
+ if (state) /* if 1 or 2 */
+ ++state; /* goto 3 */
+ break;
+ default:
+ state = 0; /* reset */
+ break;
+ }
+}
diff --git a/usr.bin/ctlstat/Makefile b/usr.bin/ctlstat/Makefile
new file mode 100644
index 0000000..0c09184
--- /dev/null
+++ b/usr.bin/ctlstat/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= ctlstat
+MAN= ctlstat.8
+SDIR= ${.CURDIR}/../../sys
+CFLAGS+= -I${SDIR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ctlstat/Makefile.depend b/usr.bin/ctlstat/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/ctlstat/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/ctlstat/ctlstat.8 b/usr.bin/ctlstat/ctlstat.8
new file mode 100644
index 0000000..ebf9f5c
--- /dev/null
+++ b/usr.bin/ctlstat/ctlstat.8
@@ -0,0 +1,122 @@
+.\"
+.\" Copyright (c) 2010 Silicon Graphics International Corp.
+.\" 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,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" substantially similar to the "NO WARRANTY" disclaimer below
+.\" ("Disclaimer") and any redistribution must be conditioned upon
+.\" including a substantially similar Disclaimer requirement for further
+.\" binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" 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 MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+.\"
+.\" ctlstat utility man page.
+.\"
+.\" Author: Ken Merry <ken@FreeBSD.org>
+.\"
+.\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $
+.\" $FreeBSD$
+.\"
+.Dd September 21, 2015
+.Dt CTLSTAT 8
+.Os
+.Sh NAME
+.Nm ctlstat
+.Nd CAM Target Layer statistics utility
+.Sh SYNOPSIS
+.Nm
+.Op Fl t
+.Op Fl c Ar count
+.Op Fl C
+.Op Fl d
+.Op Fl D
+.Op Fl j
+.Op Fl l Ar lun
+.Op Fl n Ar numdevs
+.Op Fl p Ar port
+.Op Fl w Ar wait
+.Sh DESCRIPTION
+The
+.Nm
+utility provides statistics information for the CAM Target Layer.
+The first display (except for dump and JSON modes) shows average statistics
+since system startup.
+Subsequent displays show average statistics during the measurement
+interval.
+.Pp
+The options are as follows:
+.Bl -tag -width 10n
+.It Fl t
+Total mode.
+This displays separate columns with the total read and write output,
+and a combined total column that also includes non I/O operations.
+.It Fl c Ar count
+Display statistics this many times.
+.It Fl C
+Disable CPU statistics display.
+.It Fl d
+Display DMA operation time (latency) instead of overall I/O time (latency).
+.It Fl D
+Text dump mode.
+Dump statistics every 30 seconds in a text format suitable for parsing.
+No statistics are computed in this mode, only raw numbers are displayed.
+.It Fl h
+Suppress display of the header.
+.It Fl j
+JSON dump mode.
+Dump statistics every 30 seconds in JavaScript Object Notation (JSON) format.
+No statistics are computed in this mode, only raw numbers are displayed.
+.It Fl l Ar lun
+Request statistics for the specified LUN.
+.It Fl n Ar numdevs
+Display statistics for this many devices.
+.It Fl p Ar port
+Request statistics for the specified port.
+.It Fl w Ar wait
+Wait this many seconds in between displays.
+If this option is not specified,
+.Nm
+defaults to a 1 second interval.
+.El
+.Sh EXAMPLES
+.Dl ctlstat -t
+.Pp
+Display total statistics for the system with a one second interval.
+.Pp
+.Dl ctlstat -d -l 5 -C
+.Pp
+Display average DMA time for LUN 5 and omit CPU utilization.
+.Pp
+.Dl ctlstat -n 7 -w 10
+.Pp
+Display statistics for the first 7 LUNs, and display average statistics
+every 10 seconds.
+.Sh SEE ALSO
+.Xr cam 3 ,
+.Xr cam 4 ,
+.Xr ctl 4 ,
+.Xr xpt 4 ,
+.Xr camcontrol 8 ,
+.Xr ctladm 8 ,
+.Xr ctld 8 ,
+.Xr iostat 8
+.Sh AUTHORS
+.An Ken Merry Aq Mt ken@FreeBSD.org
+.An Will Andrews Aq Mt will@FreeBSD.org
diff --git a/usr.bin/ctlstat/ctlstat.c b/usr.bin/ctlstat/ctlstat.c
new file mode 100644
index 0000000..3587586
--- /dev/null
+++ b/usr.bin/ctlstat/ctlstat.c
@@ -0,0 +1,752 @@
+/*-
+ * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp.
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.c#4 $
+ */
+/*
+ * CAM Target Layer statistics program
+ *
+ * Authors: Ken Merry <ken@FreeBSD.org>, Will Andrews <will@FreeBSD.org>
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/sysctl.h>
+#include <sys/resource.h>
+#include <sys/queue.h>
+#include <sys/callout.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <string.h>
+#include <errno.h>
+#include <err.h>
+#include <ctype.h>
+#include <bitstring.h>
+#include <cam/scsi/scsi_all.h>
+#include <cam/ctl/ctl.h>
+#include <cam/ctl/ctl_io.h>
+#include <cam/ctl/ctl_scsi_all.h>
+#include <cam/ctl/ctl_util.h>
+#include <cam/ctl/ctl_backend.h>
+#include <cam/ctl/ctl_ioctl.h>
+
+/*
+ * The default amount of space we allocate for LUN storage space. We
+ * dynamically allocate more if needed.
+ */
+#define CTL_STAT_NUM_LUNS 30
+
+/*
+ * The default number of LUN selection bits we allocate. This is large
+ * because we don't currently increase it if the user specifies a LUN
+ * number of 1024 or larger.
+ */
+#define CTL_STAT_LUN_BITS 1024L
+
+static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:";
+static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]"
+ "[-c count] [-n numdevs] [-w wait]\n";
+
+struct ctl_cpu_stats {
+ uint64_t user;
+ uint64_t nice;
+ uint64_t system;
+ uint64_t intr;
+ uint64_t idle;
+};
+
+typedef enum {
+ CTLSTAT_MODE_STANDARD,
+ CTLSTAT_MODE_DUMP,
+ CTLSTAT_MODE_JSON,
+} ctlstat_mode_types;
+
+#define CTLSTAT_FLAG_CPU (1 << 0)
+#define CTLSTAT_FLAG_HEADER (1 << 1)
+#define CTLSTAT_FLAG_FIRST_RUN (1 << 2)
+#define CTLSTAT_FLAG_TOTALS (1 << 3)
+#define CTLSTAT_FLAG_DMA_TIME (1 << 4)
+#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5)
+#define CTLSTAT_FLAG_LUN_MASK (1 << 6)
+#define CTLSTAT_FLAG_PORT_MASK (1 << 7)
+#define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU)
+#define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER)
+#define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN)
+#define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS)
+#define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME)
+#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID)
+#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK)
+#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK)
+
+struct ctlstat_context {
+ ctlstat_mode_types mode;
+ int flags;
+ struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats,
+ *tmp_lun_stats;
+ struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3];
+ struct timespec cur_time, prev_time;
+ struct ctl_cpu_stats cur_cpu, prev_cpu;
+ uint64_t cur_total_jiffies, prev_total_jiffies;
+ uint64_t cur_idle, prev_idle;
+ bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS);
+ bitstr_t bit_decl(port_mask, CTL_MAX_PORTS);
+ int num_luns;
+ int numdevs;
+ int header_interval;
+};
+
+#ifndef min
+#define min(x,y) (((x) < (y)) ? (x) : (y))
+#endif
+
+static void usage(int error);
+static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats,
+ struct timespec *cur_time, int *lun_time_valid);
+static int getcpu(struct ctl_cpu_stats *cpu_stats);
+static void compute_stats(struct ctlstat_context *ctx,
+ struct ctl_lun_io_stats *cur_stats,
+ struct ctl_lun_io_stats *prev_stats,
+ long double etime, long double *mbsec,
+ long double *kb_per_transfer,
+ long double *transfers_per_second,
+ long double *ms_per_transfer,
+ long double *ms_per_dma,
+ long double *dmas_per_second);
+
+static void
+usage(int error)
+{
+ fputs(ctlstat_usage, error ? stderr : stdout);
+}
+
+static int
+getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats,
+ struct timespec *cur_time, int *flags)
+{
+ struct ctl_lun_io_stats *lun_stats;
+ struct ctl_stats stats;
+ int more_space_count;
+
+ more_space_count = 0;
+
+ if (*num_luns == 0)
+ *num_luns = CTL_STAT_NUM_LUNS;
+
+ lun_stats = *xlun_stats;
+retry:
+
+ if (lun_stats == NULL) {
+ lun_stats = (struct ctl_lun_io_stats *)malloc(
+ sizeof(*lun_stats) * *num_luns);
+ }
+
+ memset(&stats, 0, sizeof(stats));
+ stats.alloc_len = *num_luns * sizeof(*lun_stats);
+ memset(lun_stats, 0, stats.alloc_len);
+ stats.lun_stats = lun_stats;
+
+ if (ioctl(fd, CTL_GETSTATS, &stats) == -1)
+ err(1, "error returned from CTL_GETSTATS ioctl");
+
+ switch (stats.status) {
+ case CTL_SS_OK:
+ break;
+ case CTL_SS_ERROR:
+ err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl");
+ break;
+ case CTL_SS_NEED_MORE_SPACE:
+ if (more_space_count > 0) {
+ errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again");
+ }
+ *num_luns = stats.num_luns;
+ free(lun_stats);
+ lun_stats = NULL;
+ more_space_count++;
+ goto retry;
+ break; /* NOTREACHED */
+ default:
+ errx(1, "unknown status %d returned from CTL_GETSTATS ioctl",
+ stats.status);
+ break;
+ }
+
+ *xlun_stats = lun_stats;
+ *num_luns = stats.num_luns;
+ cur_time->tv_sec = stats.timestamp.tv_sec;
+ cur_time->tv_nsec = stats.timestamp.tv_nsec;
+ if (stats.flags & CTL_STATS_FLAG_TIME_VALID)
+ *flags |= CTLSTAT_FLAG_LUN_TIME_VALID;
+ else
+ *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID;
+
+ return (0);
+}
+
+static int
+getcpu(struct ctl_cpu_stats *cpu_stats)
+{
+ long cp_time[CPUSTATES];
+ size_t cplen;
+
+ cplen = sizeof(cp_time);
+
+ if (sysctlbyname("kern.cp_time", &cp_time, &cplen, NULL, 0) == -1) {
+ warn("sysctlbyname(kern.cp_time...) failed");
+ return (1);
+ }
+
+ cpu_stats->user = cp_time[CP_USER];
+ cpu_stats->nice = cp_time[CP_NICE];
+ cpu_stats->system = cp_time[CP_SYS];
+ cpu_stats->intr = cp_time[CP_INTR];
+ cpu_stats->idle = cp_time[CP_IDLE];
+
+ return (0);
+}
+
+static void
+compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats,
+ struct ctl_lun_io_stats *prev_stats, long double etime,
+ long double *mbsec, long double *kb_per_transfer,
+ long double *transfers_per_second, long double *ms_per_transfer,
+ long double *ms_per_dma, long double *dmas_per_second)
+{
+ uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0;
+ uint32_t port;
+ struct bintime total_time_bt, total_dma_bt;
+ struct timespec total_time_ts, total_dma_ts;
+ int i;
+
+ bzero(&total_time_bt, sizeof(total_time_bt));
+ bzero(&total_dma_bt, sizeof(total_dma_bt));
+ bzero(&total_time_ts, sizeof(total_time_ts));
+ bzero(&total_dma_ts, sizeof(total_dma_ts));
+ for (port = 0; port < CTL_MAX_PORTS; port++) {
+ if (F_PORTMASK(ctx) &&
+ bit_test(ctx->port_mask, port) == 0)
+ continue;
+ for (i = 0; i < CTL_STATS_NUM_TYPES; i++) {
+ total_bytes += cur_stats->ports[port].bytes[i];
+ total_operations +=
+ cur_stats->ports[port].operations[i];
+ total_dmas += cur_stats->ports[port].num_dmas[i];
+ bintime_add(&total_time_bt,
+ &cur_stats->ports[port].time[i]);
+ bintime_add(&total_dma_bt,
+ &cur_stats->ports[port].dma_time[i]);
+ if (prev_stats != NULL) {
+ total_bytes -=
+ prev_stats->ports[port].bytes[i];
+ total_operations -=
+ prev_stats->ports[port].operations[i];
+ total_dmas -=
+ prev_stats->ports[port].num_dmas[i];
+ bintime_sub(&total_time_bt,
+ &prev_stats->ports[port].time[i]);
+ bintime_sub(&total_dma_bt,
+ &prev_stats->ports[port].dma_time[i]);
+ }
+ }
+ }
+
+ *mbsec = total_bytes;
+ *mbsec /= 1024 * 1024;
+ if (etime > 0.0)
+ *mbsec /= etime;
+ else
+ *mbsec = 0;
+ *kb_per_transfer = total_bytes;
+ *kb_per_transfer /= 1024;
+ if (total_operations > 0)
+ *kb_per_transfer /= total_operations;
+ else
+ *kb_per_transfer = 0;
+ *transfers_per_second = total_operations;
+ *dmas_per_second = total_dmas;
+ if (etime > 0.0) {
+ *transfers_per_second /= etime;
+ *dmas_per_second /= etime;
+ } else {
+ *transfers_per_second = 0;
+ *dmas_per_second = 0;
+ }
+
+ bintime2timespec(&total_time_bt, &total_time_ts);
+ bintime2timespec(&total_dma_bt, &total_dma_ts);
+ if (total_operations > 0) {
+ /*
+ * Convert the timespec to milliseconds.
+ */
+ *ms_per_transfer = total_time_ts.tv_sec * 1000;
+ *ms_per_transfer += total_time_ts.tv_nsec / 1000000;
+ *ms_per_transfer /= total_operations;
+ } else
+ *ms_per_transfer = 0;
+
+ if (total_dmas > 0) {
+ /*
+ * Convert the timespec to milliseconds.
+ */
+ *ms_per_dma = total_dma_ts.tv_sec * 1000;
+ *ms_per_dma += total_dma_ts.tv_nsec / 1000000;
+ *ms_per_dma /= total_dmas;
+ } else
+ *ms_per_dma = 0;
+}
+
+/* The dump_stats() and json_stats() functions perform essentially the same
+ * purpose, but dump the statistics in different formats. JSON is more
+ * conducive to programming, however.
+ */
+
+#define PRINT_BINTIME(prefix, bt) \
+ printf("%s %jd.%06ju\n", prefix, (intmax_t)(bt).sec, \
+ (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
+static const char *iotypes[] = {"NO IO", "READ", "WRITE"};
+
+static void
+ctlstat_dump(struct ctlstat_context *ctx) {
+ int iotype, lun, port;
+ struct ctl_lun_io_stats *stats = ctx->cur_lun_stats;
+
+ for (lun = 0; lun < ctx->num_luns;lun++) {
+ if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0)
+ continue;
+ printf("lun %d\n", lun);
+ for (port = 0; port < CTL_MAX_PORTS; port++) {
+ if (F_PORTMASK(ctx) &&
+ bit_test(ctx->port_mask, port) == 0)
+ continue;
+ printf(" port %d\n",
+ stats[lun].ports[port].targ_port);
+ for (iotype = 0; iotype < CTL_STATS_NUM_TYPES;
+ iotype++) {
+ printf(" io type %d (%s)\n", iotype,
+ iotypes[iotype]);
+ printf(" bytes %ju\n", (uintmax_t)
+ stats[lun].ports[port].bytes[iotype]);
+ printf(" operations %ju\n", (uintmax_t)
+ stats[lun].ports[port].operations[iotype]);
+ PRINT_BINTIME(" io time",
+ stats[lun].ports[port].time[iotype]);
+ printf(" num dmas %ju\n", (uintmax_t)
+ stats[lun].ports[port].num_dmas[iotype]);
+ PRINT_BINTIME(" dma time",
+ stats[lun].ports[port].dma_time[iotype]);
+ }
+ }
+ }
+}
+
+#define JSON_BINTIME(prefix, bt) \
+ printf("\"%s\":%jd.%06ju,", prefix, (intmax_t)(bt).sec, \
+ (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
+static void
+ctlstat_json(struct ctlstat_context *ctx) {
+ int iotype, lun, port;
+ struct ctl_lun_io_stats *stats = ctx->cur_lun_stats;
+
+ printf("{\"luns\":[");
+ for (lun = 0; lun < ctx->num_luns; lun++) {
+ if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0)
+ continue;
+ printf("{\"ports\":[");
+ for (port = 0; port < CTL_MAX_PORTS;port++) {
+ if (F_PORTMASK(ctx) &&
+ bit_test(ctx->port_mask, port) == 0)
+ continue;
+ printf("{\"num\":%d,\"io\":[",
+ stats[lun].ports[port].targ_port);
+ for (iotype = 0; iotype < CTL_STATS_NUM_TYPES;
+ iotype++) {
+ printf("{\"type\":\"%s\",", iotypes[iotype]);
+ printf("\"bytes\":%ju,", (uintmax_t)stats[
+ lun].ports[port].bytes[iotype]);
+ printf("\"operations\":%ju,", (uintmax_t)stats[
+ lun].ports[port].operations[iotype]);
+ JSON_BINTIME("io time",
+ stats[lun].ports[port].time[iotype]);
+ JSON_BINTIME("dma time",
+ stats[lun].ports[port].dma_time[iotype]);
+ printf("\"num dmas\":%ju}", (uintmax_t)
+ stats[lun].ports[port].num_dmas[iotype]);
+ if (iotype < (CTL_STATS_NUM_TYPES - 1))
+ printf(","); /* continue io array */
+ }
+ printf("]}"); /* close port */
+ if (port < (CTL_MAX_PORTS - 1))
+ printf(","); /* continue port array */
+ }
+ printf("]}"); /* close lun */
+ if (lun < (ctx->num_luns - 1))
+ printf(","); /* continue lun array */
+ }
+ printf("]}"); /* close luns and toplevel */
+}
+
+static void
+ctlstat_standard(struct ctlstat_context *ctx) {
+ long double etime;
+ uint64_t delta_jiffies, delta_idle;
+ uint32_t port;
+ long double cpu_percentage;
+ int i;
+ int j;
+
+ cpu_percentage = 0;
+
+ if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0))
+ errx(1, "error returned from getcpu()");
+
+ etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec +
+ (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9;
+
+ if (F_CPU(ctx)) {
+ ctx->prev_total_jiffies = ctx->cur_total_jiffies;
+ ctx->cur_total_jiffies = ctx->cur_cpu.user +
+ ctx->cur_cpu.nice + ctx->cur_cpu.system +
+ ctx->cur_cpu.intr + ctx->cur_cpu.idle;
+ delta_jiffies = ctx->cur_total_jiffies;
+ if (F_FIRST(ctx) == 0)
+ delta_jiffies -= ctx->prev_total_jiffies;
+ ctx->prev_idle = ctx->cur_idle;
+ ctx->cur_idle = ctx->cur_cpu.idle;
+ delta_idle = ctx->cur_idle - ctx->prev_idle;
+
+ cpu_percentage = delta_jiffies - delta_idle;
+ cpu_percentage /= delta_jiffies;
+ cpu_percentage *= 100;
+ }
+
+ if (F_HDR(ctx)) {
+ ctx->header_interval--;
+ if (ctx->header_interval <= 0) {
+ int hdr_devs;
+
+ hdr_devs = 0;
+
+ if (F_CPU(ctx))
+ fprintf(stdout, " CPU");
+ if (F_TOTALS(ctx)) {
+ fprintf(stdout, "%s Read %s"
+ " Write %s Total\n",
+ (F_LUNVAL(ctx) != 0) ? " " : "",
+ (F_LUNVAL(ctx) != 0) ? " " : "",
+ (F_LUNVAL(ctx) != 0) ? " " : "");
+ hdr_devs = 3;
+ } else {
+ for (i = 0; i < min(CTL_STAT_LUN_BITS,
+ ctx->num_luns); i++) {
+ int lun;
+
+ /*
+ * Obviously this won't work with
+ * LUN numbers greater than a signed
+ * integer.
+ */
+ lun = (int)ctx->cur_lun_stats[i
+ ].lun_number;
+
+ if (F_LUNMASK(ctx) &&
+ bit_test(ctx->lun_mask, lun) == 0)
+ continue;
+ fprintf(stdout, "%15.6s%d %s",
+ "lun", lun,
+ (F_LUNVAL(ctx) != 0) ? " " : "");
+ hdr_devs++;
+ }
+ fprintf(stdout, "\n");
+ }
+ if (F_CPU(ctx))
+ fprintf(stdout, " ");
+ for (i = 0; i < hdr_devs; i++)
+ fprintf(stdout, "%s KB/t %s MB/s",
+ (F_LUNVAL(ctx) != 0) ? " ms" : "",
+ (F_DMA(ctx) == 0) ? "tps" : "dps");
+ fprintf(stdout, "\n");
+ ctx->header_interval = 20;
+ }
+ }
+
+ if (F_CPU(ctx))
+ fprintf(stdout, "%3.0Lf%%", cpu_percentage);
+ if (F_TOTALS(ctx) != 0) {
+ long double mbsec[3];
+ long double kb_per_transfer[3];
+ long double transfers_per_sec[3];
+ long double ms_per_transfer[3];
+ long double ms_per_dma[3];
+ long double dmas_per_sec[3];
+
+ for (i = 0; i < 3; i++)
+ ctx->prev_total_stats[i] = ctx->cur_total_stats[i];
+
+ memset(&ctx->cur_total_stats, 0, sizeof(ctx->cur_total_stats));
+
+ /* Use macros to make the next loop more readable. */
+#define ADD_STATS_BYTES(st, p, i, j) \
+ ctx->cur_total_stats[st].ports[p].bytes[j] += \
+ ctx->cur_lun_stats[i].ports[p].bytes[j]
+#define ADD_STATS_OPERATIONS(st, p, i, j) \
+ ctx->cur_total_stats[st].ports[p].operations[j] += \
+ ctx->cur_lun_stats[i].ports[p].operations[j]
+#define ADD_STATS_NUM_DMAS(st, p, i, j) \
+ ctx->cur_total_stats[st].ports[p].num_dmas[j] += \
+ ctx->cur_lun_stats[i].ports[p].num_dmas[j]
+#define ADD_STATS_TIME(st, p, i, j) \
+ bintime_add(&ctx->cur_total_stats[st].ports[p].time[j], \
+ &ctx->cur_lun_stats[i].ports[p].time[j])
+#define ADD_STATS_DMA_TIME(st, p, i, j) \
+ bintime_add(&ctx->cur_total_stats[st].ports[p].dma_time[j], \
+ &ctx->cur_lun_stats[i].ports[p].dma_time[j])
+
+ for (i = 0; i < ctx->num_luns; i++) {
+ if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask,
+ (int)ctx->cur_lun_stats[i].lun_number) == 0)
+ continue;
+ for (port = 0; port < CTL_MAX_PORTS; port++) {
+ if (F_PORTMASK(ctx) &&
+ bit_test(ctx->port_mask, port) == 0)
+ continue;
+ for (j = 0; j < CTL_STATS_NUM_TYPES; j++) {
+ ADD_STATS_BYTES(2, port, i, j);
+ ADD_STATS_OPERATIONS(2, port, i, j);
+ ADD_STATS_NUM_DMAS(2, port, i, j);
+ ADD_STATS_TIME(2, port, i, j);
+ ADD_STATS_DMA_TIME(2, port, i, j);
+ }
+ ADD_STATS_BYTES(0, port, i, CTL_STATS_READ);
+ ADD_STATS_OPERATIONS(0, port, i,
+ CTL_STATS_READ);
+ ADD_STATS_NUM_DMAS(0, port, i, CTL_STATS_READ);
+ ADD_STATS_TIME(0, port, i, CTL_STATS_READ);
+ ADD_STATS_DMA_TIME(0, port, i, CTL_STATS_READ);
+
+ ADD_STATS_BYTES(1, port, i, CTL_STATS_WRITE);
+ ADD_STATS_OPERATIONS(1, port, i,
+ CTL_STATS_WRITE);
+ ADD_STATS_NUM_DMAS(1, port, i, CTL_STATS_WRITE);
+ ADD_STATS_TIME(1, port, i, CTL_STATS_WRITE);
+ ADD_STATS_DMA_TIME(1, port, i, CTL_STATS_WRITE);
+ }
+ }
+
+ for (i = 0; i < 3; i++) {
+ compute_stats(ctx, &ctx->cur_total_stats[i],
+ F_FIRST(ctx) ? NULL : &ctx->prev_total_stats[i],
+ etime, &mbsec[i], &kb_per_transfer[i],
+ &transfers_per_sec[i],
+ &ms_per_transfer[i], &ms_per_dma[i],
+ &dmas_per_sec[i]);
+ if (F_DMA(ctx) != 0)
+ fprintf(stdout, " %5.1Lf",
+ ms_per_dma[i]);
+ else if (F_LUNVAL(ctx) != 0)
+ fprintf(stdout, " %5.1Lf",
+ ms_per_transfer[i]);
+ fprintf(stdout, " %4.0Lf %5.0Lf %4.0Lf",
+ kb_per_transfer[i],
+ (F_DMA(ctx) == 0) ? transfers_per_sec[i] :
+ dmas_per_sec[i], mbsec[i]);
+ }
+ } else {
+ for (i = 0; i < min(CTL_STAT_LUN_BITS, ctx->num_luns); i++) {
+ long double mbsec, kb_per_transfer;
+ long double transfers_per_sec;
+ long double ms_per_transfer;
+ long double ms_per_dma;
+ long double dmas_per_sec;
+
+ if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask,
+ (int)ctx->cur_lun_stats[i].lun_number) == 0)
+ continue;
+ compute_stats(ctx, &ctx->cur_lun_stats[i],
+ F_FIRST(ctx) ? NULL : &ctx->prev_lun_stats[i],
+ etime, &mbsec, &kb_per_transfer,
+ &transfers_per_sec, &ms_per_transfer,
+ &ms_per_dma, &dmas_per_sec);
+ if (F_DMA(ctx))
+ fprintf(stdout, " %5.1Lf",
+ ms_per_dma);
+ else if (F_LUNVAL(ctx) != 0)
+ fprintf(stdout, " %5.1Lf",
+ ms_per_transfer);
+ fprintf(stdout, " %4.0Lf %5.0Lf %4.0Lf",
+ kb_per_transfer, (F_DMA(ctx) == 0) ?
+ transfers_per_sec : dmas_per_sec, mbsec);
+ }
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ int c;
+ int count, waittime;
+ int fd, retval;
+ struct ctlstat_context ctx;
+
+ /* default values */
+ retval = 0;
+ waittime = 1;
+ count = -1;
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.numdevs = 3;
+ ctx.mode = CTLSTAT_MODE_STANDARD;
+ ctx.flags |= CTLSTAT_FLAG_CPU;
+ ctx.flags |= CTLSTAT_FLAG_FIRST_RUN;
+ ctx.flags |= CTLSTAT_FLAG_HEADER;
+
+ while ((c = getopt(argc, argv, ctlstat_opts)) != -1) {
+ switch (c) {
+ case 'C':
+ ctx.flags &= ~CTLSTAT_FLAG_CPU;
+ break;
+ case 'c':
+ count = atoi(optarg);
+ break;
+ case 'd':
+ ctx.flags |= CTLSTAT_FLAG_DMA_TIME;
+ break;
+ case 'D':
+ ctx.mode = CTLSTAT_MODE_DUMP;
+ waittime = 30;
+ break;
+ case 'h':
+ ctx.flags &= ~CTLSTAT_FLAG_HEADER;
+ break;
+ case 'j':
+ ctx.mode = CTLSTAT_MODE_JSON;
+ waittime = 30;
+ break;
+ case 'l': {
+ int cur_lun;
+
+ cur_lun = atoi(optarg);
+ if (cur_lun > CTL_STAT_LUN_BITS)
+ errx(1, "Invalid LUN number %d", cur_lun);
+
+ if (!F_LUNMASK(&ctx))
+ ctx.numdevs = 1;
+ else
+ ctx.numdevs++;
+ bit_set(ctx.lun_mask, cur_lun);
+ ctx.flags |= CTLSTAT_FLAG_LUN_MASK;
+ break;
+ }
+ case 'n':
+ ctx.numdevs = atoi(optarg);
+ break;
+ case 'p': {
+ int cur_port;
+
+ cur_port = atoi(optarg);
+ if (cur_port > CTL_MAX_PORTS)
+ errx(1, "Invalid LUN number %d", cur_port);
+
+ bit_set(ctx.port_mask, cur_port);
+ ctx.flags |= CTLSTAT_FLAG_PORT_MASK;
+ break;
+ }
+ case 't':
+ ctx.flags |= CTLSTAT_FLAG_TOTALS;
+ break;
+ case 'w':
+ waittime = atoi(optarg);
+ break;
+ default:
+ retval = 1;
+ usage(retval);
+ exit(retval);
+ break;
+ }
+ }
+
+ if (!F_TOTALS(&ctx) && !F_LUNMASK(&ctx)) {
+ /*
+ * Note that this just selects the first N LUNs to display,
+ * but at this point we have no knoweledge of which LUN
+ * numbers actually exist. So we may select LUNs that
+ * aren't there.
+ */
+ bit_nset(ctx.lun_mask, 0, min(ctx.numdevs - 1,
+ CTL_STAT_LUN_BITS - 1));
+ ctx.flags |= CTLSTAT_FLAG_LUN_MASK;
+ }
+
+ if ((fd = open(CTL_DEFAULT_DEV, O_RDWR)) == -1)
+ err(1, "cannot open %s", CTL_DEFAULT_DEV);
+
+ for (;count != 0;) {
+ ctx.tmp_lun_stats = ctx.prev_lun_stats;
+ ctx.prev_lun_stats = ctx.cur_lun_stats;
+ ctx.cur_lun_stats = ctx.tmp_lun_stats;
+ ctx.prev_time = ctx.cur_time;
+ ctx.prev_cpu = ctx.cur_cpu;
+ if (getstats(fd, &ctx.num_luns, &ctx.cur_lun_stats,
+ &ctx.cur_time, &ctx.flags) != 0)
+ errx(1, "error returned from getstats()");
+
+ switch(ctx.mode) {
+ case CTLSTAT_MODE_STANDARD:
+ ctlstat_standard(&ctx);
+ break;
+ case CTLSTAT_MODE_DUMP:
+ ctlstat_dump(&ctx);
+ break;
+ case CTLSTAT_MODE_JSON:
+ ctlstat_json(&ctx);
+ break;
+ default:
+ break;
+ }
+
+ fprintf(stdout, "\n");
+ ctx.flags &= ~CTLSTAT_FLAG_FIRST_RUN;
+ if (count != 1)
+ sleep(waittime);
+ if (count > 0)
+ count--;
+ }
+
+ exit (retval);
+}
+
+/*
+ * vim: ts=8
+ */
diff --git a/usr.bin/cut/Makefile b/usr.bin/cut/Makefile
new file mode 100644
index 0000000..21c1a1c
--- /dev/null
+++ b/usr.bin/cut/Makefile
@@ -0,0 +1,12 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= cut
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cut/Makefile.depend b/usr.bin/cut/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/cut/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/cut/cut.1 b/usr.bin/cut/cut.1
new file mode 100644
index 0000000..5b1d052
--- /dev/null
+++ b/usr.bin/cut/cut.1
@@ -0,0 +1,163 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)cut.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd August 8, 2012
+.Dt CUT 1
+.Os
+.Sh NAME
+.Nm cut
+.Nd cut out selected portions of each line of a file
+.Sh SYNOPSIS
+.Nm
+.Fl b Ar list
+.Op Fl n
+.Op Ar
+.Nm
+.Fl c Ar list
+.Op Ar
+.Nm
+.Fl f Ar list
+.Op Fl w | Fl d Ar delim
+.Op Fl s
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility cuts out selected portions of each line (as specified by
+.Ar list )
+from each
+.Ar file
+and writes them to the standard output.
+If no
+.Ar file
+arguments are specified, or a file argument is a single dash
+.Pq Sq Fl ,
+.Nm
+reads from the standard input.
+The items specified by
+.Ar list
+can be in terms of column position or in terms of fields delimited
+by a special character.
+Column and field numbering start from 1.
+.Pp
+The
+.Ar list
+option argument
+is a comma or whitespace separated set of increasing numbers and/or
+number ranges.
+Number ranges consist of a number, a dash
+.Pq Sq \- ,
+and a second number
+and select the columns or fields from the first number to the second,
+inclusive.
+Numbers or number ranges may be preceded by a dash, which selects all
+columns or fields from 1 to the last number.
+Numbers or number ranges may be followed by a dash, which selects all
+columns or fields from the last number to the end of the line.
+Numbers and number ranges may be repeated, overlapping, and in any order.
+It is not an error to select columns or fields not present in the
+input line.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b Ar list
+The
+.Ar list
+specifies byte positions.
+.It Fl c Ar list
+The
+.Ar list
+specifies character positions.
+.It Fl d Ar delim
+Use
+.Ar delim
+as the field delimiter character instead of the tab character.
+.It Fl f Ar list
+The
+.Ar list
+specifies fields, separated in the input by the field delimiter character
+(see the
+.Fl d
+option).
+Output fields are separated by a single occurrence of the field delimiter
+character.
+.It Fl n
+Do not split multi-byte characters.
+Characters will only be output if at least one byte is selected, and,
+after a prefix of zero or more unselected bytes, the rest of the bytes
+that form the character are selected.
+.It Fl s
+Suppress lines with no field delimiter characters.
+Unless specified, lines with no delimiters are passed through unmodified.
+.It Fl w
+Use whitespace (spaces and tabs) as the delimiter.
+Consecutive spaces and tabs count as one single field separator.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Extract users' login names and shells from the system
+.Xr passwd 5
+file as
+.Dq name:shell
+pairs:
+.Pp
+.Dl "cut -d : -f 1,7 /etc/passwd"
+.Pp
+Show the names and login times of the currently logged in users:
+.Pp
+.Dl "who | cut -c 1-16,26-38"
+.Sh SEE ALSO
+.Xr colrm 1 ,
+.Xr paste 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.2-92 .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.Tn AT&T
+System III
+.Ux .
diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c
new file mode 100644
index 0000000..e343e5a
--- /dev/null
+++ b/usr.bin/cut/cut.c
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam S. Moskowitz of Menlo Consulting and Marciano Pitargue.
+ *
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+static const char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+static int bflag;
+static int cflag;
+static wchar_t dchar;
+static char dcharmb[MB_LEN_MAX + 1];
+static int dflag;
+static int fflag;
+static int nflag;
+static int sflag;
+static int wflag;
+
+static size_t autostart, autostop, maxval;
+static char * positions;
+
+static int b_cut(FILE *, const char *);
+static int b_n_cut(FILE *, const char *);
+static int c_cut(FILE *, const char *);
+static int f_cut(FILE *, const char *);
+static void get_list(char *);
+static int is_delim(wchar_t);
+static void needpos(size_t);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ FILE *fp;
+ int (*fcn)(FILE *, const char *);
+ int ch, rval;
+ size_t n;
+
+ setlocale(LC_ALL, "");
+
+ fcn = NULL;
+ dchar = '\t'; /* default delimiter is \t */
+ strcpy(dcharmb, "\t");
+
+ while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1)
+ switch(ch) {
+ case 'b':
+ get_list(optarg);
+ bflag = 1;
+ break;
+ case 'c':
+ get_list(optarg);
+ cflag = 1;
+ break;
+ case 'd':
+ n = mbrtowc(&dchar, optarg, MB_LEN_MAX, NULL);
+ if (dchar == '\0' || n != strlen(optarg))
+ errx(1, "bad delimiter");
+ strcpy(dcharmb, optarg);
+ dflag = 1;
+ break;
+ case 'f':
+ get_list(optarg);
+ fflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ case 'w':
+ wflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (fflag) {
+ if (bflag || cflag || nflag || (wflag && dflag))
+ usage();
+ } else if (!(bflag || cflag) || dflag || sflag || wflag)
+ usage();
+ else if (!bflag && nflag)
+ usage();
+
+ if (fflag)
+ fcn = f_cut;
+ else if (cflag)
+ fcn = MB_CUR_MAX > 1 ? c_cut : b_cut;
+ else if (bflag)
+ fcn = nflag && MB_CUR_MAX > 1 ? b_n_cut : b_cut;
+
+ rval = 0;
+ if (*argv)
+ for (; *argv; ++argv) {
+ if (strcmp(*argv, "-") == 0)
+ rval |= fcn(stdin, "stdin");
+ else {
+ if (!(fp = fopen(*argv, "r"))) {
+ warn("%s", *argv);
+ rval = 1;
+ continue;
+ }
+ fcn(fp, *argv);
+ (void)fclose(fp);
+ }
+ }
+ else
+ rval = fcn(stdin, "stdin");
+ exit(rval);
+}
+
+static void
+get_list(char *list)
+{
+ size_t setautostart, start, stop;
+ char *pos;
+ char *p;
+
+ /*
+ * set a byte in the positions array to indicate if a field or
+ * column is to be selected; use +1, it's 1-based, not 0-based.
+ * Numbers and number ranges may be overlapping, repeated, and in
+ * any order. We handle "-3-5" although there's no real reason to.
+ */
+ for (; (p = strsep(&list, ", \t")) != NULL;) {
+ setautostart = start = stop = 0;
+ if (*p == '-') {
+ ++p;
+ setautostart = 1;
+ }
+ if (isdigit((unsigned char)*p)) {
+ start = stop = strtol(p, &p, 10);
+ if (setautostart && start > autostart)
+ autostart = start;
+ }
+ if (*p == '-') {
+ if (isdigit((unsigned char)p[1]))
+ stop = strtol(p + 1, &p, 10);
+ if (*p == '-') {
+ ++p;
+ if (!autostop || autostop > stop)
+ autostop = stop;
+ }
+ }
+ if (*p)
+ errx(1, "[-bcf] list: illegal list value");
+ if (!stop || !start)
+ errx(1, "[-bcf] list: values may not include zero");
+ if (maxval < stop) {
+ maxval = stop;
+ needpos(maxval + 1);
+ }
+ for (pos = positions + start; start++ <= stop; *pos++ = 1);
+ }
+
+ /* overlapping ranges */
+ if (autostop && maxval > autostop) {
+ maxval = autostop;
+ needpos(maxval + 1);
+ }
+
+ /* set autostart */
+ if (autostart)
+ memset(positions + 1, '1', autostart);
+}
+
+static void
+needpos(size_t n)
+{
+ static size_t npos;
+ size_t oldnpos;
+
+ /* Grow the positions array to at least the specified size. */
+ if (n > npos) {
+ oldnpos = npos;
+ if (npos == 0)
+ npos = n;
+ while (n > npos)
+ npos *= 2;
+ if ((positions = realloc(positions, npos)) == NULL)
+ err(1, "realloc");
+ memset((char *)positions + oldnpos, 0, npos - oldnpos);
+ }
+}
+
+static int
+b_cut(FILE *fp, const char *fname __unused)
+{
+ int ch, col;
+ char *pos;
+
+ ch = 0;
+ for (;;) {
+ pos = positions + 1;
+ for (col = maxval; col; --col) {
+ if ((ch = getc(fp)) == EOF)
+ return (0);
+ if (ch == '\n')
+ break;
+ if (*pos++)
+ (void)putchar(ch);
+ }
+ if (ch != '\n') {
+ if (autostop)
+ while ((ch = getc(fp)) != EOF && ch != '\n')
+ (void)putchar(ch);
+ else
+ while ((ch = getc(fp)) != EOF && ch != '\n');
+ }
+ (void)putchar('\n');
+ }
+ return (0);
+}
+
+/*
+ * Cut based on byte positions, taking care not to split multibyte characters.
+ * Although this function also handles the case where -n is not specified,
+ * b_cut() ought to be much faster.
+ */
+static int
+b_n_cut(FILE *fp, const char *fname)
+{
+ size_t col, i, lbuflen;
+ char *lbuf;
+ int canwrite, clen, warned;
+ mbstate_t mbs;
+
+ memset(&mbs, 0, sizeof(mbs));
+ warned = 0;
+ while ((lbuf = fgetln(fp, &lbuflen)) != NULL) {
+ for (col = 0; lbuflen > 0; col += clen) {
+ if ((clen = mbrlen(lbuf, lbuflen, &mbs)) < 0) {
+ if (!warned) {
+ warn("%s", fname);
+ warned = 1;
+ }
+ memset(&mbs, 0, sizeof(mbs));
+ clen = 1;
+ }
+ if (clen == 0 || *lbuf == '\n')
+ break;
+ if (col < maxval && !positions[1 + col]) {
+ /*
+ * Print the character if (1) after an initial
+ * segment of un-selected bytes, the rest of
+ * it is selected, and (2) the last byte is
+ * selected.
+ */
+ i = col;
+ while (i < col + clen && i < maxval &&
+ !positions[1 + i])
+ i++;
+ canwrite = i < col + clen;
+ for (; i < col + clen && i < maxval; i++)
+ canwrite &= positions[1 + i];
+ if (canwrite)
+ fwrite(lbuf, 1, clen, stdout);
+ } else {
+ /*
+ * Print the character if all of it has
+ * been selected.
+ */
+ canwrite = 1;
+ for (i = col; i < col + clen; i++)
+ if ((i >= maxval && !autostop) ||
+ (i < maxval && !positions[1 + i])) {
+ canwrite = 0;
+ break;
+ }
+ if (canwrite)
+ fwrite(lbuf, 1, clen, stdout);
+ }
+ lbuf += clen;
+ lbuflen -= clen;
+ }
+ if (lbuflen > 0)
+ putchar('\n');
+ }
+ return (warned);
+}
+
+static int
+c_cut(FILE *fp, const char *fname)
+{
+ wint_t ch;
+ int col;
+ char *pos;
+
+ ch = 0;
+ for (;;) {
+ pos = positions + 1;
+ for (col = maxval; col; --col) {
+ if ((ch = getwc(fp)) == WEOF)
+ goto out;
+ if (ch == '\n')
+ break;
+ if (*pos++)
+ (void)putwchar(ch);
+ }
+ if (ch != '\n') {
+ if (autostop)
+ while ((ch = getwc(fp)) != WEOF && ch != '\n')
+ (void)putwchar(ch);
+ else
+ while ((ch = getwc(fp)) != WEOF && ch != '\n');
+ }
+ (void)putwchar('\n');
+ }
+out:
+ if (ferror(fp)) {
+ warn("%s", fname);
+ return (1);
+ }
+ return (0);
+}
+
+static int
+is_delim(wchar_t ch)
+{
+ if (wflag) {
+ if (ch == ' ' || ch == '\t')
+ return 1;
+ } else {
+ if (ch == dchar)
+ return 1;
+ }
+ return 0;
+}
+
+static int
+f_cut(FILE *fp, const char *fname)
+{
+ wchar_t ch;
+ int field, i, isdelim;
+ char *pos, *p;
+ int output;
+ char *lbuf, *mlbuf;
+ size_t clen, lbuflen, reallen;
+
+ mlbuf = NULL;
+ while ((lbuf = fgetln(fp, &lbuflen)) != NULL) {
+ reallen = lbuflen;
+ /* Assert EOL has a newline. */
+ if (*(lbuf + lbuflen - 1) != '\n') {
+ /* Can't have > 1 line with no trailing newline. */
+ mlbuf = malloc(lbuflen + 1);
+ if (mlbuf == NULL)
+ err(1, "malloc");
+ memcpy(mlbuf, lbuf, lbuflen);
+ *(mlbuf + lbuflen) = '\n';
+ lbuf = mlbuf;
+ reallen++;
+ }
+ output = 0;
+ for (isdelim = 0, p = lbuf;; p += clen) {
+ clen = mbrtowc(&ch, p, lbuf + reallen - p, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2) {
+ warnc(EILSEQ, "%s", fname);
+ free(mlbuf);
+ return (1);
+ }
+ if (clen == 0)
+ clen = 1;
+ /* this should work if newline is delimiter */
+ if (is_delim(ch))
+ isdelim = 1;
+ if (ch == '\n') {
+ if (!isdelim && !sflag)
+ (void)fwrite(lbuf, lbuflen, 1, stdout);
+ break;
+ }
+ }
+ if (!isdelim)
+ continue;
+
+ pos = positions + 1;
+ for (field = maxval, p = lbuf; field; --field, ++pos) {
+ if (*pos && output++)
+ for (i = 0; dcharmb[i] != '\0'; i++)
+ putchar(dcharmb[i]);
+ for (;;) {
+ clen = mbrtowc(&ch, p, lbuf + reallen - p,
+ NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2) {
+ warnc(EILSEQ, "%s", fname);
+ free(mlbuf);
+ return (1);
+ }
+ if (clen == 0)
+ clen = 1;
+ p += clen;
+ if (ch == '\n' || is_delim(ch)) {
+ /* compress whitespace */
+ if (wflag && ch != '\n')
+ while (is_delim(*p))
+ p++;
+ break;
+ }
+ if (*pos)
+ for (i = 0; i < (int)clen; i++)
+ putchar(p[i - clen]);
+ }
+ if (ch == '\n')
+ break;
+ }
+ if (ch != '\n') {
+ if (autostop) {
+ if (output)
+ for (i = 0; dcharmb[i] != '\0'; i++)
+ putchar(dcharmb[i]);
+ for (; (ch = *p) != '\n'; ++p)
+ (void)putchar(ch);
+ } else
+ for (; (ch = *p) != '\n'; ++p);
+ }
+ (void)putchar('\n');
+ }
+ free(mlbuf);
+ return (0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n%s\n",
+ "usage: cut -b list [-n] [file ...]",
+ " cut -c list [file ...]",
+ " cut -f list [-s] [-w | -d delim] [file ...]");
+ exit(1);
+}
diff --git a/usr.bin/cut/tests/Makefile b/usr.bin/cut/tests/Makefile
new file mode 100644
index 0000000..310994e
--- /dev/null
+++ b/usr.bin/cut/tests/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+NETBSD_ATF_TESTS_SH= cut_test
+
+${PACKAGE}FILES= d_basic.out
+${PACKAGE}FILES+= d_cut.in
+${PACKAGE}FILES+= d_dflag.out
+${PACKAGE}FILES+= d_dsflag.out
+${PACKAGE}FILES+= d_latin1.in
+${PACKAGE}FILES+= d_sflag.out
+${PACKAGE}FILES+= d_utf8.in
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/cut/tests/Makefile.depend b/usr.bin/cut/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/cut/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/cxxfilt/Makefile b/usr.bin/cxxfilt/Makefile
new file mode 100644
index 0000000..75f3941
--- /dev/null
+++ b/usr.bin/cxxfilt/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+SRCDIR= ${ELFTCDIR}/cxxfilt
+
+.PATH: ${SRCDIR}
+
+PROG= c++filt
+SRCS= cxxfilt.c
+
+LIBADD= elftc
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/cxxfilt/Makefile.depend b/usr.bin/cxxfilt/Makefile.depend
new file mode 100644
index 0000000..40241f3
--- /dev/null
+++ b/usr.bin/cxxfilt/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dc/Makefile b/usr.bin/dc/Makefile
new file mode 100644
index 0000000..832b197
--- /dev/null
+++ b/usr.bin/dc/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+# $OpenBSD: Makefile,v 1.2 2006/11/26 11:31:09 deraadt Exp $
+
+PROG= dc
+SRCS= dc.c bcode.c inout.c mem.c stack.c
+LIBADD= crypto
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/dc/Makefile.depend b/usr.bin/dc/Makefile.depend
new file mode 100644
index 0000000..9d5105e
--- /dev/null
+++ b/usr.bin/dc/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c
new file mode 100644
index 0000000..52ce85c
--- /dev/null
+++ b/usr.bin/dc/bcode.c
@@ -0,0 +1,1776 @@
+/* $OpenBSD: bcode.c,v 1.45 2012/11/07 11:06:14 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <err.h>
+#include <limits.h>
+#include <openssl/ssl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "extern.h"
+
+/* #define DEBUGGING */
+
+#define MAX_ARRAY_INDEX 2048
+#define READSTACK_SIZE 8
+
+#define NO_ELSE -2 /* -1 is EOF */
+#define REG_ARRAY_SIZE_SMALL (UCHAR_MAX + 1)
+#define REG_ARRAY_SIZE_BIG (UCHAR_MAX + 1 + USHRT_MAX + 1)
+
+struct bmachine {
+ struct source *readstack;
+ struct stack *reg;
+ struct stack stack;
+ u_int scale;
+ u_int obase;
+ u_int ibase;
+ size_t readsp;
+ size_t reg_array_size;
+ size_t readstack_sz;
+ bool extended_regs;
+};
+
+static struct bmachine bmachine;
+
+static __inline int readch(void);
+static __inline void unreadch(void);
+static __inline char *readline(void);
+static __inline void src_free(void);
+
+static __inline u_int max(u_int, u_int);
+static u_long get_ulong(struct number *);
+
+static __inline void push_number(struct number *);
+static __inline void push_string(char *);
+static __inline void push(struct value *);
+static __inline struct value *tos(void);
+static __inline struct number *pop_number(void);
+static __inline char *pop_string(void);
+static __inline void clear_stack(void);
+static __inline void print_tos(void);
+static void pop_print(void);
+static void pop_printn(void);
+static __inline void print_stack(void);
+static __inline void dup(void);
+static void swap(void);
+static void drop(void);
+
+static void get_scale(void);
+static void set_scale(void);
+static void get_obase(void);
+static void set_obase(void);
+static void get_ibase(void);
+static void set_ibase(void);
+static void stackdepth(void);
+static void push_scale(void);
+static u_int count_digits(const struct number *);
+static void num_digits(void);
+static void to_ascii(void);
+static void push_line(void);
+static void comment(void);
+static void bexec(char *);
+static void badd(void);
+static void bsub(void);
+static void bmul(void);
+static void bdiv(void);
+static void bmod(void);
+static void bdivmod(void);
+static void bexp(void);
+static bool bsqrt_stop(const BIGNUM *, const BIGNUM *, u_int *);
+static void bsqrt(void);
+static void not(void);
+static void equal_numbers(void);
+static void less_numbers(void);
+static void lesseq_numbers(void);
+static void equal(void);
+static void not_equal(void);
+static void less(void);
+static void not_less(void);
+static void greater(void);
+static void not_greater(void);
+static void not_compare(void);
+static bool compare_numbers(enum bcode_compare, struct number *,
+ struct number *);
+static void compare(enum bcode_compare);
+static int readreg(void);
+static void load(void);
+static void store(void);
+static void load_stack(void);
+static void store_stack(void);
+static void load_array(void);
+static void store_array(void);
+static void nop(void);
+static void quit(void);
+static void quitN(void);
+static void skipN(void);
+static void skip_until_mark(void);
+static void parse_number(void);
+static void unknown(void);
+static void eval_string(char *);
+static void eval_line(void);
+static void eval_tos(void);
+
+
+typedef void (*opcode_function)(void);
+
+struct jump_entry {
+ u_char ch;
+ opcode_function f;
+};
+
+static opcode_function jump_table[UCHAR_MAX];
+
+static const struct jump_entry jump_table_data[] = {
+ { ' ', nop },
+ { '!', not_compare },
+ { '#', comment },
+ { '%', bmod },
+ { '(', less_numbers },
+ { '*', bmul },
+ { '+', badd },
+ { '-', bsub },
+ { '.', parse_number },
+ { '/', bdiv },
+ { '0', parse_number },
+ { '1', parse_number },
+ { '2', parse_number },
+ { '3', parse_number },
+ { '4', parse_number },
+ { '5', parse_number },
+ { '6', parse_number },
+ { '7', parse_number },
+ { '8', parse_number },
+ { '9', parse_number },
+ { ':', store_array },
+ { ';', load_array },
+ { '<', less },
+ { '=', equal },
+ { '>', greater },
+ { '?', eval_line },
+ { 'A', parse_number },
+ { 'B', parse_number },
+ { 'C', parse_number },
+ { 'D', parse_number },
+ { 'E', parse_number },
+ { 'F', parse_number },
+ { 'G', equal_numbers },
+ { 'I', get_ibase },
+ { 'J', skipN },
+ { 'K', get_scale },
+ { 'L', load_stack },
+ { 'M', nop },
+ { 'N', not },
+ { 'O', get_obase },
+ { 'P', pop_print },
+ { 'Q', quitN },
+ { 'R', drop },
+ { 'S', store_stack },
+ { 'X', push_scale },
+ { 'Z', num_digits },
+ { '[', push_line },
+ { '\f', nop },
+ { '\n', nop },
+ { '\r', nop },
+ { '\t', nop },
+ { '^', bexp },
+ { '_', parse_number },
+ { 'a', to_ascii },
+ { 'c', clear_stack },
+ { 'd', dup },
+ { 'f', print_stack },
+ { 'i', set_ibase },
+ { 'k', set_scale },
+ { 'l', load },
+ { 'n', pop_printn },
+ { 'o', set_obase },
+ { 'p', print_tos },
+ { 'q', quit },
+ { 'r', swap },
+ { 's', store },
+ { 'v', bsqrt },
+ { 'x', eval_tos },
+ { 'z', stackdepth },
+ { '{', lesseq_numbers },
+ { '~', bdivmod }
+};
+
+#define JUMP_TABLE_DATA_SIZE \
+ (sizeof(jump_table_data)/sizeof(jump_table_data[0]))
+
+void
+init_bmachine(bool extended_registers)
+{
+ unsigned int i;
+
+ bmachine.extended_regs = extended_registers;
+ bmachine.reg_array_size = bmachine.extended_regs ?
+ REG_ARRAY_SIZE_BIG : REG_ARRAY_SIZE_SMALL;
+
+ bmachine.reg = calloc(bmachine.reg_array_size,
+ sizeof(bmachine.reg[0]));
+ if (bmachine.reg == NULL)
+ err(1, NULL);
+
+ for (i = 0; i < UCHAR_MAX; i++)
+ jump_table[i] = unknown;
+ for (i = 0; i < JUMP_TABLE_DATA_SIZE; i++)
+ jump_table[jump_table_data[i].ch] = jump_table_data[i].f;
+
+ stack_init(&bmachine.stack);
+
+ for (i = 0; i < bmachine.reg_array_size; i++)
+ stack_init(&bmachine.reg[i]);
+
+ bmachine.readstack_sz = READSTACK_SIZE;
+ bmachine.readstack = calloc(sizeof(struct source),
+ bmachine.readstack_sz);
+ if (bmachine.readstack == NULL)
+ err(1, NULL);
+ bmachine.obase = bmachine.ibase = 10;
+}
+
+u_int
+bmachine_scale(void)
+{
+ return bmachine.scale;
+}
+
+/* Reset the things needed before processing a (new) file */
+void
+reset_bmachine(struct source *src)
+{
+
+ bmachine.readsp = 0;
+ bmachine.readstack[0] = *src;
+}
+
+static __inline int
+readch(void)
+{
+ struct source *src = &bmachine.readstack[bmachine.readsp];
+
+ return (src->vtable->readchar(src));
+}
+
+static __inline void
+unreadch(void)
+{
+ struct source *src = &bmachine.readstack[bmachine.readsp];
+
+ src->vtable->unreadchar(src);
+}
+
+static __inline char *
+readline(void)
+{
+ struct source *src = &bmachine.readstack[bmachine.readsp];
+
+ return (src->vtable->readline(src));
+}
+
+static __inline void
+src_free(void)
+{
+ struct source *src = &bmachine.readstack[bmachine.readsp];
+
+ src->vtable->free(src);
+}
+
+#ifdef DEBUGGING
+void
+pn(const char *str, const struct number *n)
+{
+ char *p = BN_bn2dec(n->number);
+
+ if (p == NULL)
+ err(1, "BN_bn2dec failed");
+ fputs(str, stderr);
+ fprintf(stderr, " %s (%u)\n" , p, n->scale);
+ OPENSSL_free(p);
+}
+
+void
+pbn(const char *str, const BIGNUM *n)
+{
+ char *p = BN_bn2dec(n);
+
+ if (p == NULL)
+ err(1, "BN_bn2dec failed");
+ fputs(str, stderr);
+ fprintf(stderr, " %s\n", p);
+ OPENSSL_free(p);
+}
+
+#endif
+
+static __inline u_int
+max(u_int a, u_int b)
+{
+
+ return (a > b ? a : b);
+}
+
+static unsigned long factors[] = {
+ 0, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
+ 100000000, 1000000000
+};
+
+void
+scale_number(BIGNUM *n, int s)
+{
+ unsigned int abs_scale;
+
+ if (s == 0)
+ return;
+
+ abs_scale = s > 0 ? s : -s;
+
+ if (abs_scale < sizeof(factors)/sizeof(factors[0])) {
+ if (s > 0)
+ bn_check(BN_mul_word(n, factors[abs_scale]));
+ else
+ BN_div_word(n, factors[abs_scale]);
+ } else {
+ BIGNUM *a, *p;
+ BN_CTX *ctx;
+
+ a = BN_new();
+ bn_checkp(a);
+ p = BN_new();
+ bn_checkp(p);
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+
+ bn_check(BN_set_word(a, 10));
+ bn_check(BN_set_word(p, abs_scale));
+ bn_check(BN_exp(a, a, p, ctx));
+ if (s > 0)
+ bn_check(BN_mul(n, n, a, ctx));
+ else
+ bn_check(BN_div(n, NULL, n, a, ctx));
+ BN_CTX_free(ctx);
+ BN_free(a);
+ BN_free(p);
+ }
+}
+
+void
+split_number(const struct number *n, BIGNUM *i, BIGNUM *f)
+{
+ u_long rem;
+
+ bn_checkp(BN_copy(i, n->number));
+
+ if (n->scale == 0 && f != NULL)
+ bn_check(BN_zero(f));
+ else if (n->scale < sizeof(factors)/sizeof(factors[0])) {
+ rem = BN_div_word(i, factors[n->scale]);
+ if (f != NULL)
+ bn_check(BN_set_word(f, rem));
+ } else {
+ BIGNUM *a, *p;
+ BN_CTX *ctx;
+
+ a = BN_new();
+ bn_checkp(a);
+ p = BN_new();
+ bn_checkp(p);
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+
+ bn_check(BN_set_word(a, 10));
+ bn_check(BN_set_word(p, n->scale));
+ bn_check(BN_exp(a, a, p, ctx));
+ bn_check(BN_div(i, f, n->number, a, ctx));
+ BN_CTX_free(ctx);
+ BN_free(a);
+ BN_free(p);
+ }
+}
+
+void
+normalize(struct number *n, u_int s)
+{
+
+ scale_number(n->number, s - n->scale);
+ n->scale = s;
+}
+
+static u_long
+get_ulong(struct number *n)
+{
+
+ normalize(n, 0);
+ return (BN_get_word(n->number));
+}
+
+void
+negate(struct number *n)
+{
+ BN_set_negative(n->number, !BN_is_negative(n->number));
+}
+
+static __inline void
+push_number(struct number *n)
+{
+
+ stack_pushnumber(&bmachine.stack, n);
+}
+
+static __inline void
+push_string(char *string)
+{
+
+ stack_pushstring(&bmachine.stack, string);
+}
+
+static __inline void
+push(struct value *v)
+{
+
+ stack_push(&bmachine.stack, v);
+}
+
+static __inline struct value *
+tos(void)
+{
+
+ return (stack_tos(&bmachine.stack));
+}
+
+static __inline struct value *
+pop(void)
+{
+
+ return (stack_pop(&bmachine.stack));
+}
+
+static __inline struct number *
+pop_number(void)
+{
+
+ return (stack_popnumber(&bmachine.stack));
+}
+
+static __inline char *
+pop_string(void)
+{
+
+ return (stack_popstring(&bmachine.stack));
+}
+
+static __inline void
+clear_stack(void)
+{
+
+ stack_clear(&bmachine.stack);
+}
+
+static __inline void
+print_stack(void)
+{
+
+ stack_print(stdout, &bmachine.stack, "", bmachine.obase);
+}
+
+static __inline void
+print_tos(void)
+{
+ struct value *value = tos();
+
+ if (value != NULL) {
+ print_value(stdout, value, "", bmachine.obase);
+ putchar('\n');
+ }
+ else
+ warnx("stack empty");
+}
+
+static void
+pop_print(void)
+{
+ struct value *value = pop();
+
+ if (value != NULL) {
+ switch (value->type) {
+ case BCODE_NONE:
+ break;
+ case BCODE_NUMBER:
+ normalize(value->u.num, 0);
+ print_ascii(stdout, value->u.num);
+ fflush(stdout);
+ break;
+ case BCODE_STRING:
+ fputs(value->u.string, stdout);
+ fflush(stdout);
+ break;
+ }
+ stack_free_value(value);
+ }
+}
+
+static void
+pop_printn(void)
+{
+ struct value *value = pop();
+
+ if (value != NULL) {
+ print_value(stdout, value, "", bmachine.obase);
+ fflush(stdout);
+ stack_free_value(value);
+ }
+}
+
+static __inline void
+dup(void)
+{
+
+ stack_dup(&bmachine.stack);
+}
+
+static void
+swap(void)
+{
+
+ stack_swap(&bmachine.stack);
+}
+
+static void
+drop(void)
+{
+ struct value *v = pop();
+ if (v != NULL)
+ stack_free_value(v);
+}
+
+static void
+get_scale(void)
+{
+ struct number *n;
+
+ n = new_number();
+ bn_check(BN_set_word(n->number, bmachine.scale));
+ push_number(n);
+}
+
+static void
+set_scale(void)
+{
+ struct number *n;
+ u_long scale;
+
+ n = pop_number();
+ if (n != NULL) {
+ if (BN_is_negative(n->number))
+ warnx("scale must be a nonnegative number");
+ else {
+ scale = get_ulong(n);
+ if (scale != BN_MASK2 && scale <= UINT_MAX)
+ bmachine.scale = (u_int)scale;
+ else
+ warnx("scale too large");
+ }
+ free_number(n);
+ }
+}
+
+static void
+get_obase(void)
+{
+ struct number *n;
+
+ n = new_number();
+ bn_check(BN_set_word(n->number, bmachine.obase));
+ push_number(n);
+}
+
+static void
+set_obase(void)
+{
+ struct number *n;
+ u_long base;
+
+ n = pop_number();
+ if (n != NULL) {
+ base = get_ulong(n);
+ if (base != BN_MASK2 && base > 1 && base <= UINT_MAX)
+ bmachine.obase = (u_int)base;
+ else
+ warnx("output base must be a number greater than 1");
+ free_number(n);
+ }
+}
+
+static void
+get_ibase(void)
+{
+ struct number *n;
+
+ n = new_number();
+ bn_check(BN_set_word(n->number, bmachine.ibase));
+ push_number(n);
+}
+
+static void
+set_ibase(void)
+{
+ struct number *n;
+ u_long base;
+
+ n = pop_number();
+ if (n != NULL) {
+ base = get_ulong(n);
+ if (base != BN_MASK2 && 2 <= base && base <= 16)
+ bmachine.ibase = (u_int)base;
+ else
+ warnx("input base must be a number between 2 and 16 "
+ "(inclusive)");
+ free_number(n);
+ }
+}
+
+static void
+stackdepth(void)
+{
+ struct number *n;
+ size_t i;
+
+ i = stack_size(&bmachine.stack);
+ n = new_number();
+ bn_check(BN_set_word(n->number, i));
+ push_number(n);
+}
+
+static void
+push_scale(void)
+{
+ struct number *n;
+ struct value *value;
+ u_int scale = 0;
+
+ value = pop();
+ if (value != NULL) {
+ switch (value->type) {
+ case BCODE_NONE:
+ return;
+ case BCODE_NUMBER:
+ scale = value->u.num->scale;
+ break;
+ case BCODE_STRING:
+ break;
+ }
+ stack_free_value(value);
+ n = new_number();
+ bn_check(BN_set_word(n->number, scale));
+ push_number(n);
+ }
+}
+
+static u_int
+count_digits(const struct number *n)
+{
+ struct number *int_part, *fract_part;
+ u_int i;
+
+ if (BN_is_zero(n->number))
+ return n->scale ? n->scale : 1;
+
+ int_part = new_number();
+ fract_part = new_number();
+ fract_part->scale = n->scale;
+ split_number(n, int_part->number, fract_part->number);
+
+ i = 0;
+ while (!BN_is_zero(int_part->number)) {
+ BN_div_word(int_part->number, 10);
+ i++;
+ }
+ free_number(int_part);
+ free_number(fract_part);
+ return (i + n->scale);
+}
+
+static void
+num_digits(void)
+{
+ struct number *n = NULL;
+ struct value *value;
+ size_t digits;
+
+ value = pop();
+ if (value != NULL) {
+ switch (value->type) {
+ case BCODE_NONE:
+ return;
+ case BCODE_NUMBER:
+ digits = count_digits(value->u.num);
+ n = new_number();
+ bn_check(BN_set_word(n->number, digits));
+ break;
+ case BCODE_STRING:
+ digits = strlen(value->u.string);
+ n = new_number();
+ bn_check(BN_set_word(n->number, digits));
+ break;
+ }
+ stack_free_value(value);
+ push_number(n);
+ }
+}
+
+static void
+to_ascii(void)
+{
+ struct number *n;
+ struct value *value;
+ char str[2];
+
+ value = pop();
+ if (value != NULL) {
+ str[1] = '\0';
+ switch (value->type) {
+ case BCODE_NONE:
+ return;
+ case BCODE_NUMBER:
+ n = value->u.num;
+ normalize(n, 0);
+ if (BN_num_bits(n->number) > 8)
+ bn_check(BN_mask_bits(n->number, 8));
+ str[0] = (char)BN_get_word(n->number);
+ break;
+ case BCODE_STRING:
+ str[0] = value->u.string[0];
+ break;
+ }
+ stack_free_value(value);
+ push_string(bstrdup(str));
+ }
+}
+
+static int
+readreg(void)
+{
+ int ch1, ch2, idx;
+
+ idx = readch();
+ if (idx == 0xff && bmachine.extended_regs) {
+ ch1 = readch();
+ ch2 = readch();
+ if (ch1 == EOF || ch2 == EOF) {
+ warnx("unexpected eof");
+ idx = -1;
+ } else
+ idx = (ch1 << 8) + ch2 + UCHAR_MAX + 1;
+ }
+ if (idx < 0 || (unsigned)idx >= bmachine.reg_array_size) {
+ warnx("internal error: reg num = %d", idx);
+ idx = -1;
+ }
+ return (idx);
+}
+
+static void
+load(void)
+{
+ struct number *n;
+ struct value *v;
+ struct value copy;
+ int idx;
+
+ idx = readreg();
+ if (idx >= 0) {
+ v = stack_tos(&bmachine.reg[idx]);
+ if (v == NULL) {
+ n = new_number();
+ bn_check(BN_zero(n->number));
+ push_number(n);
+ } else
+ push(stack_dup_value(v, &copy));
+ }
+}
+
+static void
+store(void)
+{
+ struct value *val;
+ int idx;
+
+ idx = readreg();
+ if (idx >= 0) {
+ val = pop();
+ if (val == NULL) {
+ return;
+ }
+ stack_set_tos(&bmachine.reg[idx], val);
+ }
+}
+
+static void
+load_stack(void)
+{
+ struct stack *stack;
+ struct value *value;
+ int idx;
+
+ idx = readreg();
+ if (idx >= 0) {
+ stack = &bmachine.reg[idx];
+ value = NULL;
+ if (stack_size(stack) > 0) {
+ value = stack_pop(stack);
+ }
+ if (value != NULL)
+ push(value);
+ else
+ warnx("stack register '%c' (0%o) is empty",
+ idx, idx);
+ }
+}
+
+static void
+store_stack(void)
+{
+ struct value *value;
+ int idx;
+
+ idx = readreg();
+ if (idx >= 0) {
+ value = pop();
+ if (value == NULL)
+ return;
+ stack_push(&bmachine.reg[idx], value);
+ }
+}
+
+static void
+load_array(void)
+{
+ struct number *inumber, *n;
+ struct stack *stack;
+ struct value *v;
+ struct value copy;
+ u_long idx;
+ int reg;
+
+ reg = readreg();
+ if (reg >= 0) {
+ inumber = pop_number();
+ if (inumber == NULL)
+ return;
+ idx = get_ulong(inumber);
+ if (BN_is_negative(inumber->number))
+ warnx("negative idx");
+ else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX)
+ warnx("idx too big");
+ else {
+ stack = &bmachine.reg[reg];
+ v = frame_retrieve(stack, idx);
+ if (v == NULL || v->type == BCODE_NONE) {
+ n = new_number();
+ bn_check(BN_zero(n->number));
+ push_number(n);
+ }
+ else
+ push(stack_dup_value(v, &copy));
+ }
+ free_number(inumber);
+ }
+}
+
+static void
+store_array(void)
+{
+ struct number *inumber;
+ struct value *value;
+ struct stack *stack;
+ u_long idx;
+ int reg;
+
+ reg = readreg();
+ if (reg >= 0) {
+ inumber = pop_number();
+ if (inumber == NULL)
+ return;
+ value = pop();
+ if (value == NULL) {
+ free_number(inumber);
+ return;
+ }
+ idx = get_ulong(inumber);
+ if (BN_is_negative(inumber->number)) {
+ warnx("negative idx");
+ stack_free_value(value);
+ } else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) {
+ warnx("idx too big");
+ stack_free_value(value);
+ } else {
+ stack = &bmachine.reg[reg];
+ frame_assign(stack, idx, value);
+ }
+ free_number(inumber);
+ }
+}
+
+static void
+push_line(void)
+{
+
+ push_string(read_string(&bmachine.readstack[bmachine.readsp]));
+}
+
+static void
+comment(void)
+{
+
+ free(readline());
+}
+
+static void
+bexec(char *line)
+{
+
+ system(line);
+ free(line);
+}
+
+static void
+badd(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ r = new_number();
+ r->scale = max(a->scale, b->scale);
+ if (r->scale > a->scale)
+ normalize(a, r->scale);
+ else if (r->scale > b->scale)
+ normalize(b, r->scale);
+ bn_check(BN_add(r->number, a->number, b->number));
+ push_number(r);
+ free_number(a);
+ free_number(b);
+}
+
+static void
+bsub(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ r = new_number();
+
+ r->scale = max(a->scale, b->scale);
+ if (r->scale > a->scale)
+ normalize(a, r->scale);
+ else if (r->scale > b->scale)
+ normalize(b, r->scale);
+ bn_check(BN_sub(r->number, b->number, a->number));
+ push_number(r);
+ free_number(a);
+ free_number(b);
+}
+
+void
+bmul_number(struct number *r, struct number *a, struct number *b, u_int scale)
+{
+ BN_CTX *ctx;
+
+ /* Create copies of the scales, since r might be equal to a or b */
+ u_int ascale = a->scale;
+ u_int bscale = b->scale;
+ u_int rscale = ascale + bscale;
+
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ bn_check(BN_mul(r->number, a->number, b->number, ctx));
+ BN_CTX_free(ctx);
+
+ r->scale = rscale;
+ if (rscale > bmachine.scale && rscale > ascale && rscale > bscale)
+ normalize(r, max(scale, max(ascale, bscale)));
+}
+
+static void
+bmul(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ r = new_number();
+ bmul_number(r, a, b, bmachine.scale);
+
+ push_number(r);
+ free_number(a);
+ free_number(b);
+}
+
+static void
+bdiv(void)
+{
+ struct number *a, *b, *r;
+ BN_CTX *ctx;
+ u_int scale;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ r = new_number();
+ r->scale = bmachine.scale;
+ scale = max(a->scale, b->scale);
+
+ if (BN_is_zero(a->number))
+ warnx("divide by zero");
+ else {
+ normalize(a, scale);
+ normalize(b, scale + r->scale);
+
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ bn_check(BN_div(r->number, NULL, b->number, a->number, ctx));
+ BN_CTX_free(ctx);
+ }
+ push_number(r);
+ free_number(a);
+ free_number(b);
+}
+
+static void
+bmod(void)
+{
+ struct number *a, *b, *r;
+ BN_CTX *ctx;
+ u_int scale;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ r = new_number();
+ scale = max(a->scale, b->scale);
+ r->scale = max(b->scale, a->scale + bmachine.scale);
+
+ if (BN_is_zero(a->number))
+ warnx("remainder by zero");
+ else {
+ normalize(a, scale);
+ normalize(b, scale + bmachine.scale);
+
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ bn_check(BN_mod(r->number, b->number, a->number, ctx));
+ BN_CTX_free(ctx);
+ }
+ push_number(r);
+ free_number(a);
+ free_number(b);
+}
+
+static void
+bdivmod(void)
+{
+ struct number *a, *b, *rdiv, *rmod;
+ BN_CTX *ctx;
+ u_int scale;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ rdiv = new_number();
+ rmod = new_number();
+ rdiv->scale = bmachine.scale;
+ rmod->scale = max(b->scale, a->scale + bmachine.scale);
+ scale = max(a->scale, b->scale);
+
+ if (BN_is_zero(a->number))
+ warnx("divide by zero");
+ else {
+ normalize(a, scale);
+ normalize(b, scale + bmachine.scale);
+
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ bn_check(BN_div(rdiv->number, rmod->number,
+ b->number, a->number, ctx));
+ BN_CTX_free(ctx);
+ }
+ push_number(rdiv);
+ push_number(rmod);
+ free_number(a);
+ free_number(b);
+}
+
+static void
+bexp(void)
+{
+ struct number *a, *p;
+ struct number *r;
+ bool neg;
+ u_int rscale;
+
+ p = pop_number();
+ if (p == NULL) {
+ return;
+ }
+ a = pop_number();
+ if (a == NULL) {
+ push_number(p);
+ return;
+ }
+
+ if (p->scale != 0) {
+ BIGNUM *i, *f;
+ i = BN_new();
+ bn_checkp(i);
+ f = BN_new();
+ bn_checkp(f);
+ split_number(p, i, f);
+ if (!BN_is_zero(f))
+ warnx("Runtime warning: non-zero fractional part in exponent");
+ BN_free(i);
+ BN_free(f);
+ }
+
+ normalize(p, 0);
+
+ neg = false;
+ if (BN_is_negative(p->number)) {
+ neg = true;
+ negate(p);
+ rscale = bmachine.scale;
+ } else {
+ /* Posix bc says min(a.scale * b, max(a.scale, scale) */
+ u_long b;
+ u_int m;
+
+ b = BN_get_word(p->number);
+ m = max(a->scale, bmachine.scale);
+ rscale = a->scale * (u_int)b;
+ if (rscale > m || (a->scale > 0 && (b == BN_MASK2 ||
+ b > UINT_MAX)))
+ rscale = m;
+ }
+
+ if (BN_is_zero(p->number)) {
+ r = new_number();
+ bn_check(BN_one(r->number));
+ normalize(r, rscale);
+ } else {
+ u_int ascale, mscale;
+
+ ascale = a->scale;
+ while (!BN_is_bit_set(p->number, 0)) {
+ ascale *= 2;
+ bmul_number(a, a, a, ascale);
+ bn_check(BN_rshift1(p->number, p->number));
+ }
+
+ r = dup_number(a);
+ bn_check(BN_rshift1(p->number, p->number));
+
+ mscale = ascale;
+ while (!BN_is_zero(p->number)) {
+ ascale *= 2;
+ bmul_number(a, a, a, ascale);
+ if (BN_is_bit_set(p->number, 0)) {
+ mscale += ascale;
+ bmul_number(r, r, a, mscale);
+ }
+ bn_check(BN_rshift1(p->number, p->number));
+ }
+
+ if (neg) {
+ BN_CTX *ctx;
+ BIGNUM *one;
+
+ one = BN_new();
+ bn_checkp(one);
+ bn_check(BN_one(one));
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ scale_number(one, r->scale + rscale);
+
+ if (BN_is_zero(r->number))
+ warnx("divide by zero");
+ else
+ bn_check(BN_div(r->number, NULL, one,
+ r->number, ctx));
+ BN_free(one);
+ BN_CTX_free(ctx);
+ r->scale = rscale;
+ } else
+ normalize(r, rscale);
+ }
+ push_number(r);
+ free_number(a);
+ free_number(p);
+}
+
+static bool
+bsqrt_stop(const BIGNUM *x, const BIGNUM *y, u_int *onecount)
+{
+ BIGNUM *r;
+ bool ret;
+
+ r = BN_new();
+ bn_checkp(r);
+ bn_check(BN_sub(r, x, y));
+ if (BN_is_one(r))
+ (*onecount)++;
+ ret = BN_is_zero(r);
+ BN_free(r);
+ return (ret || *onecount > 1);
+}
+
+static void
+bsqrt(void)
+{
+ struct number *n, *r;
+ BIGNUM *x, *y;
+ BN_CTX *ctx;
+ u_int onecount, scale;
+
+ onecount = 0;
+ n = pop_number();
+ if (n == NULL) {
+ return;
+ }
+ if (BN_is_zero(n->number)) {
+ r = new_number();
+ push_number(r);
+ } else if (BN_is_negative(n->number))
+ warnx("square root of negative number");
+ else {
+ scale = max(bmachine.scale, n->scale);
+ normalize(n, 2*scale);
+ x = BN_dup(n->number);
+ bn_checkp(x);
+ bn_check(BN_rshift(x, x, BN_num_bits(x)/2));
+ y = BN_new();
+ bn_checkp(y);
+ ctx = BN_CTX_new();
+ bn_checkp(ctx);
+ for (;;) {
+ bn_checkp(BN_copy(y, x));
+ bn_check(BN_div(x, NULL, n->number, x, ctx));
+ bn_check(BN_add(x, x, y));
+ bn_check(BN_rshift1(x, x));
+ if (bsqrt_stop(x, y, &onecount))
+ break;
+ }
+ r = bmalloc(sizeof(*r));
+ r->scale = scale;
+ r->number = y;
+ BN_free(x);
+ BN_CTX_free(ctx);
+ push_number(r);
+ }
+
+ free_number(n);
+}
+
+static void
+not(void)
+{
+ struct number *a;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ a->scale = 0;
+ bn_check(BN_set_word(a->number, BN_get_word(a->number) ? 0 : 1));
+ push_number(a);
+}
+
+static void
+equal(void)
+{
+
+ compare(BCODE_EQUAL);
+}
+
+static void
+equal_numbers(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+ r = new_number();
+ bn_check(BN_set_word(r->number,
+ compare_numbers(BCODE_EQUAL, a, b) ? 1 : 0));
+ push_number(r);
+}
+
+static void
+less_numbers(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+ r = new_number();
+ bn_check(BN_set_word(r->number,
+ compare_numbers(BCODE_LESS, a, b) ? 1 : 0));
+ push_number(r);
+}
+
+static void
+lesseq_numbers(void)
+{
+ struct number *a, *b, *r;
+
+ a = pop_number();
+ if (a == NULL) {
+ return;
+ }
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+ r = new_number();
+ bn_check(BN_set_word(r->number,
+ compare_numbers(BCODE_NOT_GREATER, a, b) ? 1 : 0));
+ push_number(r);
+}
+
+static void
+not_equal(void)
+{
+
+ compare(BCODE_NOT_EQUAL);
+}
+
+static void
+less(void)
+{
+
+ compare(BCODE_LESS);
+}
+
+static void
+not_compare(void)
+{
+
+ switch (readch()) {
+ case '<':
+ not_less();
+ break;
+ case '>':
+ not_greater();
+ break;
+ case '=':
+ not_equal();
+ break;
+ default:
+ unreadch();
+ bexec(readline());
+ break;
+ }
+}
+
+static void
+not_less(void)
+{
+
+ compare(BCODE_NOT_LESS);
+}
+
+static void
+greater(void)
+{
+
+ compare(BCODE_GREATER);
+}
+
+static void
+not_greater(void)
+{
+
+ compare(BCODE_NOT_GREATER);
+}
+
+static bool
+compare_numbers(enum bcode_compare type, struct number *a, struct number *b)
+{
+ u_int scale;
+ int cmp;
+
+ scale = max(a->scale, b->scale);
+
+ if (scale > a->scale)
+ normalize(a, scale);
+ else if (scale > b->scale)
+ normalize(b, scale);
+
+ cmp = BN_cmp(a->number, b->number);
+
+ free_number(a);
+ free_number(b);
+
+ switch (type) {
+ case BCODE_EQUAL:
+ return (cmp == 0);
+ case BCODE_NOT_EQUAL:
+ return (cmp != 0);
+ case BCODE_LESS:
+ return (cmp < 0);
+ case BCODE_NOT_LESS:
+ return (cmp >= 0);
+ case BCODE_GREATER:
+ return (cmp > 0);
+ case BCODE_NOT_GREATER:
+ return (cmp <= 0);
+ }
+ return (false);
+}
+
+static void
+compare(enum bcode_compare type)
+{
+ struct number *a, *b;
+ struct value *v;
+ int idx, elseidx;
+ bool ok;
+
+ elseidx = NO_ELSE;
+ idx = readreg();
+ if (readch() == 'e')
+ elseidx = readreg();
+ else
+ unreadch();
+
+ a = pop_number();
+ if (a == NULL)
+ return;
+ b = pop_number();
+ if (b == NULL) {
+ push_number(a);
+ return;
+ }
+
+ ok = compare_numbers(type, a, b);
+
+ if (!ok && elseidx != NO_ELSE)
+ idx = elseidx;
+
+ if (idx >= 0 && (ok || (!ok && elseidx != NO_ELSE))) {
+ v = stack_tos(&bmachine.reg[idx]);
+ if (v == NULL)
+ warnx("register '%c' (0%o) is empty", idx, idx);
+ else {
+ switch(v->type) {
+ case BCODE_NONE:
+ warnx("register '%c' (0%o) is empty", idx, idx);
+ break;
+ case BCODE_NUMBER:
+ warn("eval called with non-string argument");
+ break;
+ case BCODE_STRING:
+ eval_string(bstrdup(v->u.string));
+ break;
+ }
+ }
+ }
+}
+
+
+static void
+nop(void)
+{
+
+}
+
+static void
+quit(void)
+{
+
+ if (bmachine.readsp < 2)
+ exit(0);
+ src_free();
+ bmachine.readsp--;
+ src_free();
+ bmachine.readsp--;
+}
+
+static void
+quitN(void)
+{
+ struct number *n;
+ u_long i;
+
+ n = pop_number();
+ if (n == NULL)
+ return;
+ i = get_ulong(n);
+ free_number(n);
+ if (i == BN_MASK2 || i == 0)
+ warnx("Q command requires a number >= 1");
+ else if (bmachine.readsp < i)
+ warnx("Q command argument exceeded string execution depth");
+ else {
+ while (i-- > 0) {
+ src_free();
+ bmachine.readsp--;
+ }
+ }
+}
+
+static void
+skipN(void)
+{
+ struct number *n;
+ u_long i;
+
+ n = pop_number();
+ if (n == NULL)
+ return;
+ i = get_ulong(n);
+ if (i == BN_MASK2)
+ warnx("J command requires a number >= 0");
+ else if (i > 0 && bmachine.readsp < i)
+ warnx("J command argument exceeded string execution depth");
+ else {
+ while (i-- > 0) {
+ src_free();
+ bmachine.readsp--;
+ }
+ skip_until_mark();
+ }
+}
+
+static void
+skip_until_mark(void)
+{
+
+ for (;;) {
+ switch (readch()) {
+ case 'M':
+ return;
+ case EOF:
+ errx(1, "mark not found");
+ return;
+ case 'l':
+ case 'L':
+ case 's':
+ case 'S':
+ case ':':
+ case ';':
+ case '<':
+ case '>':
+ case '=':
+ readreg();
+ if (readch() == 'e')
+ readreg();
+ else
+ unreadch();
+ break;
+ case '[':
+ free(read_string(&bmachine.readstack[bmachine.readsp]));
+ break;
+ case '!':
+ switch (readch()) {
+ case '<':
+ case '>':
+ case '=':
+ readreg();
+ if (readch() == 'e')
+ readreg();
+ else
+ unreadch();
+ break;
+ default:
+ free(readline());
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void
+parse_number(void)
+{
+
+ unreadch();
+ push_number(readnumber(&bmachine.readstack[bmachine.readsp],
+ bmachine.ibase));
+}
+
+static void
+unknown(void)
+{
+ int ch = bmachine.readstack[bmachine.readsp].lastchar;
+ warnx("%c (0%o) is unimplemented", ch, ch);
+}
+
+static void
+eval_string(char *p)
+{
+ int ch;
+
+ if (bmachine.readsp > 0) {
+ /* Check for tail call. Do not recurse in that case. */
+ ch = readch();
+ if (ch == EOF) {
+ src_free();
+ src_setstring(&bmachine.readstack[bmachine.readsp], p);
+ return;
+ } else
+ unreadch();
+ }
+ if (bmachine.readsp == bmachine.readstack_sz - 1) {
+ size_t newsz = bmachine.readstack_sz * 2;
+ struct source *stack;
+ stack = realloc(bmachine.readstack, newsz *
+ sizeof(struct source));
+ if (stack == NULL)
+ err(1, "recursion too deep");
+ bmachine.readstack_sz = newsz;
+ bmachine.readstack = stack;
+ }
+ src_setstring(&bmachine.readstack[++bmachine.readsp], p);
+}
+
+static void
+eval_line(void)
+{
+ /* Always read from stdin */
+ struct source in;
+ char *p;
+
+ clearerr(stdin);
+ src_setstream(&in, stdin);
+ p = (*in.vtable->readline)(&in);
+ eval_string(p);
+}
+
+static void
+eval_tos(void)
+{
+ char *p;
+
+ p = pop_string();
+ if (p == NULL)
+ return;
+ eval_string(p);
+}
+
+void
+eval(void)
+{
+ int ch;
+
+ for (;;) {
+ ch = readch();
+ if (ch == EOF) {
+ if (bmachine.readsp == 0)
+ return;
+ src_free();
+ bmachine.readsp--;
+ continue;
+ }
+#ifdef DEBUGGING
+ fprintf(stderr, "# %c\n", ch);
+ stack_print(stderr, &bmachine.stack, "* ",
+ bmachine.obase);
+ fprintf(stderr, "%zd =>\n", bmachine.readsp);
+#endif
+
+ if (0 <= ch && ch < (signed)UCHAR_MAX)
+ (*jump_table[ch])();
+ else
+ warnx("internal error: opcode %d", ch);
+
+#ifdef DEBUGGING
+ stack_print(stderr, &bmachine.stack, "* ",
+ bmachine.obase);
+ fprintf(stderr, "%zd ==\n", bmachine.readsp);
+#endif
+ }
+}
diff --git a/usr.bin/dc/bcode.h b/usr.bin/dc/bcode.h
new file mode 100644
index 0000000..7911bc2
--- /dev/null
+++ b/usr.bin/dc/bcode.h
@@ -0,0 +1,97 @@
+/* $FreeBSD$ */
+/* $OpenBSD: bcode.h,v 1.7 2012/11/07 11:06:14 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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/types.h>
+#include <openssl/bn.h>
+
+struct number {
+ BIGNUM *number;
+ u_int scale;
+};
+
+enum stacktype {
+ BCODE_NONE,
+ BCODE_NUMBER,
+ BCODE_STRING
+};
+
+enum bcode_compare {
+ BCODE_EQUAL,
+ BCODE_NOT_EQUAL,
+ BCODE_LESS,
+ BCODE_NOT_LESS,
+ BCODE_GREATER,
+ BCODE_NOT_GREATER
+};
+
+struct array;
+
+struct value {
+ union {
+ struct number *num;
+ char *string;
+ } u;
+ struct array *array;
+ enum stacktype type;
+};
+
+struct array {
+ struct value *data;
+ size_t size;
+};
+
+struct stack {
+ struct value *stack;
+ ssize_t size;
+ ssize_t sp;
+};
+
+struct source;
+
+struct vtable {
+ int (*readchar)(struct source *);
+ void (*unreadchar)(struct source *);
+ char *(*readline)(struct source *);
+ void (*free)(struct source *);
+};
+
+struct source {
+ union {
+ struct {
+ u_char *buf;
+ size_t pos;
+ } string;
+ FILE *stream;
+ } u;
+ struct vtable *vtable;
+ int lastchar;
+};
+
+void init_bmachine(bool);
+void reset_bmachine(struct source *);
+u_int bmachine_scale(void);
+void scale_number(BIGNUM *, int);
+void normalize(struct number *, u_int);
+void eval(void);
+void pn(const char *, const struct number *);
+void pbn(const char *, const BIGNUM *);
+void negate(struct number *);
+void split_number(const struct number *, BIGNUM *, BIGNUM *);
+void bmul_number(struct number *, struct number *,
+ struct number *, u_int scale);
diff --git a/usr.bin/dc/dc.1 b/usr.bin/dc/dc.1
new file mode 100644
index 0000000..507bbe6
--- /dev/null
+++ b/usr.bin/dc/dc.1
@@ -0,0 +1,554 @@
+.\" $FreeBSD$
+.\" $OpenBSD: dc.1,v 1.27 2012/08/19 12:07:21 jmc Exp $
+.\"
+.\" Copyright (C) Caldera International Inc. 2001-2002.
+.\" 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 and documentation 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 or owned by Caldera
+.\" International, Inc.
+.\" 4. Neither the name of Caldera International, Inc. nor the names of other
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
+.\" INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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.
+.\"
+.\" @(#)dc.1 8.1 (Berkeley) 6/6/93
+.\"
+.Dd April 16, 2014
+.Dt DC 1
+.Os
+.Sh NAME
+.Nm dc
+.Nd desk calculator
+.Sh SYNOPSIS
+.Nm
+.Op Fl hxV
+.Op Fl e Ar expression
+.Op Fl f Ar filename
+.Op Ar filename
+.Sh DESCRIPTION
+.Nm
+is an arbitrary precision arithmetic package.
+The overall structure of
+.Nm
+is
+a stacking (reverse Polish) calculator i.e.\&
+numbers are stored on a stack.
+Adding a number pushes it onto the stack.
+Arithmetic operations pop arguments off the stack
+and push the results.
+See also the
+.Xr bc 1
+utility, which is a preprocessor for
+.Nm
+providing infix notation and a C-like syntax
+which implements functions and reasonable control
+structures for programs.
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl e Ar expr , Fl Fl expression Ar expr
+Evaluate
+.Ar expression .
+If multiple
+.Fl e
+options are specified, they will be processed in the order given.
+.It Fl f Ar filename , Fl Fl file Ar filename
+Process the content of the given file before further calculations are done.
+If multiple
+.Fl f
+options are specified, they will be processed in the order given.
+.It Fl h , Fl Fl help
+Print short usage info.
+.It Fl V , Fl Fl version
+Print version info.
+.It Fl x
+Enable extended register mode.
+This mode is used by
+.Xr bc 1
+to allow more than 256 registers.
+See
+.Sx Registers
+for a more detailed description.
+.El
+.Pp
+If neither
+.Ar expression
+nor
+.Ar file
+are specified on the command line,
+.Nm
+reads from the standard input.
+Otherwise
+.Ar expression
+and
+.Ar file
+are processed and
+.Nm
+exits.
+.Pp
+Ordinarily,
+.Nm
+operates on decimal integers,
+but one may specify an input base, output base,
+and a number of fractional digits (scale) to be maintained.
+Whitespace is ignored, except where it signals the end of a number,
+end of a line or when a register name is expected.
+The following constructions are recognized:
+.Bl -tag -width "number"
+.It Va number
+The value of the number is pushed on the stack.
+A number is an unbroken string of the digits 0\-9 and letters A\-F.
+It may be preceded by an underscore
+.Pq Sq _
+to input a negative number.
+A number may contain a single decimal point.
+A number may also contain the characters A\-F, with the values 10\-15.
+.It Cm "+ - / * % ~ ^"
+The
+top two values on the stack are added
+(+),
+subtracted
+(\-),
+multiplied (*),
+divided (/),
+remaindered (%),
+divided and remaindered (~),
+or exponentiated (^).
+The two entries are popped off the stack;
+the result is pushed on the stack in their place.
+Any fractional part of an exponent is ignored.
+.Pp
+For addition and subtraction, the scale of the result is the maximum
+of scales of the operands.
+For division the scale of the result is defined
+by the scale set by the
+.Ic k
+operation.
+For multiplication, the scale is defined by the expression
+.Sy min(a+b,max(a,b,scale)) ,
+where
+.Sy a
+and
+.Sy b
+are the scales of the operands, and
+.Sy scale
+is the scale defined by the
+.Ic k
+operation.
+For exponentiation with a non-negative exponent, the scale of the result is
+.Sy min(a*b,max(scale,a)) ,
+where
+.Sy a
+is the scale of the base, and
+.Sy b
+is the
+.Em value
+of the exponent.
+If the exponent is negative, the scale of the result is the scale
+defined by the
+.Ic k
+operation.
+.Pp
+In the case of the division and modulus operator (~),
+the resultant quotient is pushed first followed by the remainder.
+This is a shorthand for the sequence:
+.Bd -literal -offset indent -compact
+x y / x y %
+.Ed
+The division and modulus operator is a non-portable extension.
+.It Ic a
+Pop the top value from the stack.
+If that value is a number, compute the integer part of the number modulo 256.
+If the result is zero, push an empty string.
+Otherwise push a one character string by interpreting the computed value
+as an
+.Tn ASCII
+character.
+.Pp
+If the top value is a string, push a string containing the first character
+of the original string.
+If the original string is empty, an empty string is pushed back.
+The
+.Ic a
+operator is a non-portable extension.
+.It Ic c
+All values on the stack are popped.
+.It Ic d
+The top value on the stack is duplicated.
+.It Ic f
+All values on the stack are printed, separated by newlines.
+.It Ic G
+The top two numbers are popped from the stack and compared.
+A one is pushed if the top of the stack is equal to the second number
+on the stack.
+A zero is pushed otherwise.
+This is a non-portable extension.
+.It Ic I
+Pushes the input base on the top of the stack.
+.It Ic i
+The top value on the stack is popped and used as the
+base for further input.
+The initial input base is 10.
+.It Ic J
+Pop the top value from the stack.
+The recursion level is popped by that value and, following that,
+the input is skipped until the first occurrence of the
+.Ic M
+operator.
+The
+.Ic J
+operator is a non-portable extension, used by the
+.Xr bc 1
+command.
+.It Ic K
+The current scale factor is pushed onto the stack.
+.It Ic k
+The top of the stack is popped, and that value is used as
+a non-negative scale factor:
+the appropriate number of places
+are printed on output,
+and maintained during multiplication, division, and exponentiation.
+The interaction of scale factor,
+input base, and output base will be reasonable if all are changed
+together.
+.It Ic L Ns Ar x
+Register
+.Ar x
+is treated as a stack and its top value is popped onto the main stack.
+.It Ic l Ns Ar x
+The
+value in register
+.Ar x
+is pushed on the stack.
+The register
+.Ar x
+is not altered.
+Initially, all registers contain the value zero.
+.It Ic M
+Mark used by the
+.Ic J
+operator.
+The
+.Ic M
+operator is a non-portable extensions, used by the
+.Xr bc 1
+command.
+.It Ic N
+The top of the stack is replaced by one if the top of the stack
+is equal to zero.
+If the top of the stack is unequal to zero, it is replaced by zero.
+This is a non-portable extension.
+.It Ic n
+The top value on the stack is popped and printed without a newline.
+This is a non-portable extension.
+.It Ic O
+Pushes the output base on the top of the stack.
+.It Ic o
+The top value on the stack is popped and used as the
+base for further output.
+The initial output base is 10.
+.It Ic P
+The top of the stack is popped.
+If the top of the stack is a string, it is printed without a trailing newline.
+If the top of the stack is a number, it is interpreted as a
+base 256 number, and each digit of this base 256 number is printed as
+an
+.Tn ASCII
+character, without a trailing newline.
+.It Ic p
+The top value on the stack is printed with a trailing newline.
+The top value remains unchanged.
+.It Ic Q
+The top value on the stack is popped and the string execution level is popped
+by that value.
+.It Ic q
+Exits the program.
+If executing a string, the recursion level is
+popped by two.
+.It Ic R
+The top of the stack is removed (popped).
+This is a non-portable extension.
+.It Ic r
+The top two values on the stack are reversed (swapped).
+This is a non-portable extension.
+.It Ic S Ns Ar x
+Register
+.Ar x
+is treated as a stack.
+The top value of the main stack is popped and pushed on it.
+.It Ic s Ns Ar x
+The
+top of the stack is popped and stored into
+a register named
+.Ar x .
+.It Ic v
+Replaces the top element on the stack by its square root.
+The scale of the result is the maximum of the scale of the argument
+and the current value of scale.
+.It Ic X
+Replaces the number on the top of the stack with its scale factor.
+If the top of the stack is a string, replace it with the integer 0.
+.It Ic x
+Treats the top element of the stack as a character string
+and executes it as a string of
+.Nm
+commands.
+.It Ic Z
+Replaces the number on the top of the stack with its length.
+The length of a string is its number of characters.
+The length of a number is its number of digits, not counting the minus sign
+and decimal point.
+.It Ic z
+The stack level is pushed onto the stack.
+.It Cm \&[ Ns ... Ns Cm \&]
+Puts the bracketed
+.Tn ASCII
+string onto the top of the stack.
+If the string includes brackets, these must be properly balanced.
+The backslash character
+.Pq Sq \e
+may be used as an escape character, making it
+possible to include unbalanced brackets in strings.
+To include a backslash in a string, use a double backslash.
+.It Xo
+.Cm < Ns Va x
+.Cm > Ns Va x
+.Cm = Ns Va x
+.Cm !< Ns Va x
+.Cm !> Ns Va x
+.Cm != Ns Va x
+.Xc
+The top two elements of the stack are popped and compared.
+Register
+.Ar x
+is executed if they obey the stated
+relation.
+.It Xo
+.Cm < Ns Va x Ns e Ns Va y
+.Cm > Ns Va x Ns e Ns Va y
+.Cm = Ns Va x Ns e Ns Va y
+.Cm !< Ns Va x Ns e Ns Va y
+.Cm !> Ns Va x Ns e Ns Va y
+.Cm != Ns Va x Ns e Ns Va y
+.Xc
+These operations are variants of the comparison operations above.
+The first register name is followed by the letter
+.Sq e
+and another register name.
+Register
+.Ar x
+will be executed if the relation is true, and register
+.Ar y
+will be executed if the relation is false.
+This is a non-portable extension.
+.It Ic \&(
+The top two numbers are popped from the stack and compared.
+A one is pushed if the top of the stack is less than the second number
+on the stack.
+A zero is pushed otherwise.
+This is a non-portable extension.
+.It Ic {
+The top two numbers are popped from the stack and compared.
+A one is pushed if the top of stack is less than or equal to the
+second number on the stack.
+A zero is pushed otherwise.
+This is a non-portable extension.
+.It Ic \&!
+Interprets the rest of the line as a
+.Ux
+command.
+.It Ic \&?
+A line of input is taken from the input source (usually the terminal)
+and executed.
+.It Ic \&: Ns Ar r
+Pop two values from the stack.
+The second value on the stack is stored into the array
+.Ar r
+indexed by the top of stack.
+.It Ic \&; Ns Ar r
+Pop a value from the stack.
+The value is used as an index into register
+.Ar r .
+The value in this register is pushed onto the stack.
+.Pp
+Array elements initially have the value zero.
+Each level of a stacked register has its own array associated with
+it.
+The command sequence
+.Bd -literal -offset indent
+[first] 0:a [dummy] Sa [second] 0:a 0;a p La 0;a p
+.Ed
+.Pp
+will print
+.Bd -literal -offset indent
+second
+first
+.Ed
+.Pp
+since the string
+.Ql second
+is written in an array that is later popped, to reveal the array that
+stored
+.Ql first .
+.It Ic #
+Skip the rest of the line.
+This is a non-portable extension.
+.El
+.Ss Registers
+Registers have a single character name
+.Ar x ,
+where
+.Ar x
+may be any character, including space, tab or any other special character.
+If extended register mode is enabled using the
+.Fl x
+option and the register identifier
+.Ar x
+has the value 255, the next two characters are interpreted as a
+two-byte register index.
+The set of standard single character registers and the set of extended
+registers do not overlap.
+Extended register mode is a non-portable extension.
+.Sh EXAMPLES
+An example which prints the first ten values of
+.Ic n! :
+.Bd -literal -offset indent
+[la1+dsa*pla10>y]sy
+0sa1
+lyx
+.Ed
+.Pp
+Independent of the current input base, the command
+.Bd -literal -offset indent
+Ai
+.Ed
+.Pp
+will reset the input base to decimal 10.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It %c (0%o) is unimplemented
+an undefined operation was called.
+.It stack empty
+for not enough elements on the stack to do what was asked.
+.It stack register '%c' (0%o) is empty
+for an
+.Ar L
+operation from a stack register that is empty.
+.It Runtime warning: non-zero scale in exponent
+for a fractional part of an exponent that is being ignored.
+.It divide by zero
+for trying to divide by zero.
+.It remainder by zero
+for trying to take a remainder by zero.
+.It square root of negative number
+for trying to take the square root of a negative number.
+.It index too big
+for an array index that is larger than 2048.
+.It negative index
+for a negative array index.
+.It "input base must be a number between 2 and 16"
+for trying to set an illegal input base.
+.It output base must be a number greater than 1
+for trying to set an illegal output base.
+.It scale must be a nonnegative number
+for trying to set a negative or zero scale.
+.It scale too large
+for trying to set a scale that is too large.
+A scale must be representable as a 32-bit unsigned number.
+.It Q command argument exceeded string execution depth
+for trying to pop the recursion level more than the current
+recursion level.
+.It Q command requires a number >= 1
+for trying to pop an illegal number of recursion levels.
+.It recursion too deep
+for too many levels of nested execution.
+.Pp
+The recursion level is increased by one if the
+.Ar x
+or
+.Ar ?\&
+operation or one of the compare operations resulting in the execution
+of register is executed.
+As an exception, the recursion level is not increased if the operation
+is executed as the last command of a string.
+For example, the commands
+.Bd -literal -offset indent
+[lax]sa
+1 lax
+.Ed
+.Pp
+will execute an endless loop, while the commands
+.Bd -literal -offset indent
+[laxp]sa
+1 lax
+.Ed
+.Pp
+will terminate because of a too deep recursion level.
+.It J command argument exceeded string execution depth
+for trying to pop the recursion level more than the current
+recursion level.
+.It mark not found
+for a failed scan for an occurrence of the
+.Ic M
+operator.
+.El
+.Sh SEE ALSO
+.Xr bc 1
+.Pp
+.An -nosplit
+.An L. L. Cherry ,
+.An R. Morris
+"DC \- An Interactive Desk Calculator"
+.Pa /usr/share/doc/usd/05.dc/ .
+.Sh STANDARDS
+The arithmetic operations of the
+.Nm
+utility are expected to conform to the definition listed in the
+.Xr bc 1
+section of the
+.St -p1003.2
+specification.
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.At v6 .
+A complete rewrite of the
+.Nm
+command using the
+.Xr bn 3
+big number routines first appeared in
+.Ox 3.5 .
+.Sh AUTHORS
+.An -nosplit
+The original version of the
+.Nm
+command was written by
+.An Robert Morris
+and
+.An Lorinda Cherry .
+The current version of the
+.Nm
+utility was written by
+.An Otto Moerbeek .
diff --git a/usr.bin/dc/dc.c b/usr.bin/dc/dc.c
new file mode 100644
index 0000000..546b247
--- /dev/null
+++ b/usr.bin/dc/dc.c
@@ -0,0 +1,140 @@
+/* $OpenBSD: dc.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ * Copyright (c) 2009, Gabor Kovesdan <gabor@FreeBSD.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 <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#define DC_VER "1.3-FreeBSD"
+
+static void usage(void);
+
+extern char *__progname;
+
+static struct source src;
+
+static const struct option long_options[] =
+{
+ {"expression", required_argument, NULL, 'e'},
+ {"file", required_argument, NULL, 'f'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'}
+};
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-hVx] [-e expression] [file]\n",
+ __progname);
+ exit(1);
+}
+
+static void
+procfile(char *fname) {
+ struct stat st;
+ FILE *file;
+
+ file = fopen(fname, "r");
+ if (file == NULL)
+ err(1, "cannot open file %s", fname);
+ if (fstat(fileno(file), &st) == -1)
+ err(1, "%s", fname);
+ if (S_ISDIR(st.st_mode)) {
+ errno = EISDIR;
+ err(1, "%s", fname);
+ }
+ src_setstream(&src, file);
+ reset_bmachine(&src);
+ eval();
+ fclose(file);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+ bool extended_regs = false, preproc_done = false;
+
+ /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
+ while ((ch = getopt_long(argc, argv, "e:f:hVx", long_options, NULL)) != -1) {
+ switch (ch) {
+ case 'e':
+ if (!preproc_done)
+ init_bmachine(extended_regs);
+ src_setstring(&src, optarg);
+ reset_bmachine(&src);
+ eval();
+ preproc_done = true;
+ break;
+ case 'f':
+ if (!preproc_done)
+ init_bmachine(extended_regs);
+ procfile(optarg);
+ preproc_done = true;
+ break;
+ case 'x':
+ extended_regs = true;
+ break;
+ case 'V':
+ fprintf(stderr, "%s (BSD bc) %s\n", __progname, DC_VER);
+ exit(0);
+ break;
+ case '-':
+ break;
+ case 'h':
+ /* FALLTHROUGH */
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!preproc_done)
+ init_bmachine(extended_regs);
+ setlinebuf(stdout);
+ setlinebuf(stderr);
+
+ if (argc > 1)
+ usage();
+ if (argc == 1) {
+ procfile(argv[0]);
+ preproc_done = true;
+ }
+ if (preproc_done)
+ return (0);
+
+ src_setstream(&src, stdin);
+ reset_bmachine(&src);
+ eval();
+
+ return (0);
+}
diff --git a/usr.bin/dc/extern.h b/usr.bin/dc/extern.h
new file mode 100644
index 0000000..4abf063
--- /dev/null
+++ b/usr.bin/dc/extern.h
@@ -0,0 +1,63 @@
+/* $FreeBSD$ */
+/* $OpenBSD: extern.h,v 1.3 2006/01/16 08:09:25 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <stdbool.h>
+#include "bcode.h"
+
+
+/* inout.c */
+void src_setstream(struct source *, FILE *);
+void src_setstring(struct source *, char *);
+struct number *readnumber(struct source *, u_int);
+void printnumber(FILE *, const struct number *, u_int);
+char *read_string(struct source *);
+void print_value(FILE *, const struct value *, const char *, u_int);
+void print_ascii(FILE *, const struct number *);
+
+/* mem.c */
+struct number *new_number(void);
+void free_number(struct number *);
+struct number *dup_number(const struct number *);
+void *bmalloc(size_t);
+void *brealloc(void *, size_t);
+char *bstrdup(const char *p);
+void bn_check(int);
+void bn_checkp(const void *);
+
+/* stack.c */
+void stack_init(struct stack *);
+void stack_free_value(struct value *);
+struct value *stack_dup_value(const struct value *, struct value *);
+void stack_swap(struct stack *);
+size_t stack_size(const struct stack *);
+void stack_dup(struct stack *);
+void stack_pushnumber(struct stack *, struct number *);
+void stack_pushstring(struct stack *stack, char *);
+void stack_push(struct stack *, struct value *);
+void stack_set_tos(struct stack *, struct value *);
+struct value *stack_tos(const struct stack *);
+struct value *stack_pop(struct stack *);
+struct number *stack_popnumber(struct stack *);
+char *stack_popstring(struct stack *);
+void stack_clear(struct stack *);
+void stack_print(FILE *, const struct stack *, const char *,
+ u_int base);
+void frame_assign(struct stack *, size_t, const struct value *);
+struct value *frame_retrieve(const struct stack *, size_t);
+/* void frame_free(struct stack *); */
diff --git a/usr.bin/dc/inout.c b/usr.bin/dc/inout.c
new file mode 100644
index 0000000..740fb35
--- /dev/null
+++ b/usr.bin/dc/inout.c
@@ -0,0 +1,418 @@
+/* $OpenBSD: inout.c,v 1.17 2012/11/07 11:06:14 otto Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <openssl/ssl.h>
+#include <ctype.h>
+#include <err.h>
+#include <string.h>
+
+#include "extern.h"
+
+#define MAX_CHARS_PER_LINE 68
+
+static int lastchar;
+static int charcount;
+
+static int src_getcharstream(struct source *);
+static void src_ungetcharstream(struct source *);
+static char *src_getlinestream(struct source *);
+static int src_getcharstring(struct source *);
+static void src_ungetcharstring(struct source *);
+static char *src_getlinestring(struct source *);
+static void src_freestring(struct source *);
+static void flushwrap(FILE *);
+static void putcharwrap(FILE *, int);
+static void printwrap(FILE *, const char *);
+static char *get_digit(u_long, int, u_int);
+
+static struct vtable stream_vtable = {
+ src_getcharstream,
+ src_ungetcharstream,
+ src_getlinestream,
+ NULL
+};
+
+static struct vtable string_vtable = {
+ src_getcharstring,
+ src_ungetcharstring,
+ src_getlinestring,
+ src_freestring
+};
+
+void
+src_setstream(struct source *src, FILE *stream)
+{
+
+ src->u.stream = stream;
+ src->vtable = &stream_vtable;
+}
+
+void
+src_setstring(struct source *src, char *p)
+{
+
+ src->u.string.buf = (u_char *)p;
+ src->u.string.pos = 0;
+ src->vtable = &string_vtable;
+}
+
+static int
+src_getcharstream(struct source *src)
+{
+
+ return (src->lastchar = getc(src->u.stream));
+}
+
+static void
+src_ungetcharstream(struct source *src)
+{
+
+ ungetc(src->lastchar, src->u.stream);
+}
+
+static char *
+src_getlinestream(struct source *src)
+{
+ char buf[BUFSIZ];
+
+ if (fgets(buf, BUFSIZ, src->u.stream) == NULL)
+ return (bstrdup(""));
+ return bstrdup(buf);
+}
+
+static int
+src_getcharstring(struct source *src)
+{
+
+ src->lastchar = src->u.string.buf[src->u.string.pos];
+ if (src->lastchar == '\0')
+ return (EOF);
+ else {
+ src->u.string.pos++;
+ return (src->lastchar);
+ }
+}
+
+static void
+src_ungetcharstring(struct source *src)
+{
+
+ if (src->u.string.pos > 0) {
+ if (src->lastchar != '\0')
+ --src->u.string.pos;
+ }
+}
+
+static char *
+src_getlinestring(struct source *src)
+{
+ char buf[BUFSIZ];
+ int i, ch;
+
+ i = 0;
+ while (i < BUFSIZ-1) {
+ ch = src_getcharstring(src);
+ if (ch == EOF)
+ break;
+ buf[i++] = ch;
+ if (ch == '\n')
+ break;
+ }
+ buf[i] = '\0';
+ return (bstrdup(buf));
+}
+
+static void
+src_freestring(struct source *src)
+{
+
+ free(src->u.string.buf);
+}
+
+static void
+flushwrap(FILE *f)
+{
+
+ if (lastchar != -1)
+ putc(lastchar, f);
+}
+
+static void
+putcharwrap(FILE *f, int ch)
+{
+
+ if (charcount >= MAX_CHARS_PER_LINE) {
+ charcount = 0;
+ fputs("\\\n", f);
+ }
+ if (lastchar != -1) {
+ charcount++;
+ putc(lastchar, f);
+ }
+ lastchar = ch;
+}
+
+static void
+printwrap(FILE *f, const char *p)
+{
+ char *q;
+ char buf[12];
+
+ q = buf;
+ strlcpy(buf, p, sizeof(buf));
+ while (*q)
+ putcharwrap(f, *q++);
+}
+
+struct number *
+readnumber(struct source *src, u_int base)
+{
+ struct number *n;
+ BN_ULONG v;
+ u_int i;
+ int ch;
+ bool dot = false, sign = false;
+
+ n = new_number();
+ bn_check(BN_zero(n->number));
+
+ while ((ch = (*src->vtable->readchar)(src)) != EOF) {
+
+ if ('0' <= ch && ch <= '9')
+ v = ch - '0';
+ else if ('A' <= ch && ch <= 'F')
+ v = ch - 'A' + 10;
+ else if (ch == '_') {
+ sign = true;
+ continue;
+ } else if (ch == '.') {
+ if (dot)
+ break;
+ dot = true;
+ continue;
+ } else {
+ (*src->vtable->unreadchar)(src);
+ break;
+ }
+ if (dot)
+ n->scale++;
+
+ bn_check(BN_mul_word(n->number, base));
+
+#if 0
+ /* work around a bug in BN_add_word: 0 += 0 is buggy.... */
+ if (v > 0)
+#endif
+ bn_check(BN_add_word(n->number, v));
+ }
+ if (base != 10) {
+ scale_number(n->number, n->scale);
+ for (i = 0; i < n->scale; i++)
+ BN_div_word(n->number, base);
+ }
+ if (sign)
+ negate(n);
+ return (n);
+}
+
+char *
+read_string(struct source *src)
+{
+ char *p;
+ int count, ch, i, new_sz, sz;
+ bool escape;
+
+ escape = false;
+ count = 1;
+ i = 0;
+ sz = 15;
+ p = bmalloc(sz + 1);
+
+ while ((ch = (*src->vtable->readchar)(src)) != EOF) {
+ if (!escape) {
+ if (ch == '[')
+ count++;
+ else if (ch == ']')
+ count--;
+ if (count == 0)
+ break;
+ }
+ if (ch == '\\' && !escape)
+ escape = true;
+ else {
+ escape = false;
+ if (i == sz) {
+ new_sz = sz * 2;
+ p = brealloc(p, new_sz + 1);
+ sz = new_sz;
+ }
+ p[i++] = ch;
+ }
+ }
+ p[i] = '\0';
+ return (p);
+}
+
+static char *
+get_digit(u_long num, int digits, u_int base)
+{
+ char *p;
+
+ if (base <= 16) {
+ p = bmalloc(2);
+ p[0] = num >= 10 ? num + 'A' - 10 : num + '0';
+ p[1] = '\0';
+ } else {
+ if (asprintf(&p, "%0*lu", digits, num) == -1)
+ err(1, NULL);
+ }
+ return (p);
+}
+
+void
+printnumber(FILE *f, const struct number *b, u_int base)
+{
+ struct number *fract_part, *int_part;
+ struct stack stack;
+ char *p;
+ char buf[11];
+ size_t sz;
+ unsigned int i;
+ int digits;
+
+ charcount = 0;
+ lastchar = -1;
+ if (BN_is_zero(b->number))
+ putcharwrap(f, '0');
+
+ int_part = new_number();
+ fract_part = new_number();
+ fract_part->scale = b->scale;
+
+ if (base <= 16)
+ digits = 1;
+ else {
+ digits = snprintf(buf, sizeof(buf), "%u", base-1);
+ }
+ split_number(b, int_part->number, fract_part->number);
+
+ i = 0;
+ stack_init(&stack);
+ while (!BN_is_zero(int_part->number)) {
+ BN_ULONG rem = BN_div_word(int_part->number, base);
+ stack_pushstring(&stack, get_digit(rem, digits, base));
+ i++;
+ }
+ sz = i;
+ if (BN_is_negative(b->number))
+ putcharwrap(f, '-');
+ for (i = 0; i < sz; i++) {
+ p = stack_popstring(&stack);
+ if (base > 16)
+ putcharwrap(f, ' ');
+ printwrap(f, p);
+ free(p);
+ }
+ stack_clear(&stack);
+ if (b->scale > 0) {
+ struct number *num_base;
+ BIGNUM mult, stop;
+
+ putcharwrap(f, '.');
+ num_base = new_number();
+ bn_check(BN_set_word(num_base->number, base));
+ BN_init(&mult);
+ bn_check(BN_one(&mult));
+ BN_init(&stop);
+ bn_check(BN_one(&stop));
+ scale_number(&stop, b->scale);
+
+ i = 0;
+ while (BN_cmp(&mult, &stop) < 0) {
+ u_long rem;
+
+ if (i && base > 16)
+ putcharwrap(f, ' ');
+ i = 1;
+
+ bmul_number(fract_part, fract_part, num_base,
+ bmachine_scale());
+ split_number(fract_part, int_part->number, NULL);
+ rem = BN_get_word(int_part->number);
+ p = get_digit(rem, digits, base);
+ int_part->scale = 0;
+ normalize(int_part, fract_part->scale);
+ bn_check(BN_sub(fract_part->number, fract_part->number,
+ int_part->number));
+ printwrap(f, p);
+ free(p);
+ bn_check(BN_mul_word(&mult, base));
+ }
+ free_number(num_base);
+ BN_free(&mult);
+ BN_free(&stop);
+ }
+ flushwrap(f);
+ free_number(int_part);
+ free_number(fract_part);
+}
+
+void
+print_value(FILE *f, const struct value *value, const char *prefix, u_int base)
+{
+
+ fputs(prefix, f);
+ switch (value->type) {
+ case BCODE_NONE:
+ if (value->array != NULL)
+ fputs("<array>", f);
+ break;
+ case BCODE_NUMBER:
+ printnumber(f, value->u.num, base);
+ break;
+ case BCODE_STRING:
+ fputs(value->u.string, f);
+ break;
+ }
+}
+
+void
+print_ascii(FILE *f, const struct number *n)
+{
+ BIGNUM *v;
+ int ch, i, numbits;
+
+ v = BN_dup(n->number);
+ bn_checkp(v);
+
+ if (BN_is_negative(v))
+ BN_set_negative(v, 0);
+
+ numbits = BN_num_bytes(v) * 8;
+ while (numbits > 0) {
+ ch = 0;
+ for (i = 0; i < 8; i++)
+ ch |= BN_is_bit_set(v, numbits-i-1) << (7 - i);
+ putc(ch, f);
+ numbits -= 8;
+ }
+ BN_free(v);
+}
diff --git a/usr.bin/dc/mem.c b/usr.bin/dc/mem.c
new file mode 100644
index 0000000..78fb429
--- /dev/null
+++ b/usr.bin/dc/mem.c
@@ -0,0 +1,110 @@
+/* $OpenBSD: mem.c,v 1.5 2009/10/27 23:59:37 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <openssl/err.h>
+
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "extern.h"
+
+struct number *
+new_number(void)
+{
+ struct number *n;
+
+ n = bmalloc(sizeof(*n));
+ n->scale = 0;
+ n->number = BN_new();
+ if (n->number == NULL)
+ err(1, NULL);
+ return (n);
+}
+
+void
+free_number(struct number *n)
+{
+
+ BN_free(n->number);
+ free(n);
+}
+
+struct number *
+dup_number(const struct number *a)
+{
+ struct number *n;
+
+ n = bmalloc(sizeof(*n));
+ n->scale = a->scale;
+ n->number = BN_dup(a->number);
+ bn_checkp(n->number);
+ return (n);
+}
+
+void *
+bmalloc(size_t sz)
+{
+ void *p;
+
+ p = malloc(sz);
+ if (p == NULL)
+ err(1, NULL);
+ return (p);
+}
+
+void *
+brealloc(void *p, size_t sz)
+{
+ void *q;
+
+ q = realloc(p, sz);
+ if (q == NULL)
+ err(1, NULL);
+ return (q);
+}
+
+char *
+bstrdup(const char *p)
+{
+ char *q;
+
+ q = strdup(p);
+ if (q == NULL)
+ err(1, NULL);
+ return (q);
+}
+
+void
+bn_check(int x) \
+{
+
+ if (x == 0)
+ err(1, "big number failure %lx", ERR_get_error());
+}
+
+void
+bn_checkp(const void *p) \
+{
+
+ if (p == NULL)
+ err(1, "allocation failure %lx", ERR_get_error());
+}
diff --git a/usr.bin/dc/stack.c b/usr.bin/dc/stack.c
new file mode 100644
index 0000000..3364ae2
--- /dev/null
+++ b/usr.bin/dc/stack.c
@@ -0,0 +1,379 @@
+/* $OpenBSD: stack.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
+ *
+ * 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 <err.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "extern.h"
+
+static __inline bool stack_empty(const struct stack *);
+static void stack_grow(struct stack *);
+static struct array *array_new(void);
+static __inline void array_free(struct array *);
+static struct array *array_dup(const struct array *);
+static __inline void array_grow(struct array *, size_t);
+static __inline void array_assign(struct array *, size_t, const struct value *);
+static __inline struct value *array_retrieve(const struct array *, size_t);
+
+void
+stack_init(struct stack *stack)
+{
+
+ stack->size = 0;
+ stack->sp = -1;
+ stack->stack = NULL;
+}
+
+static __inline bool
+stack_empty(const struct stack *stack)
+{
+ bool empty = stack->sp == -1;
+
+ if (empty)
+ warnx("stack empty");
+ return empty;
+}
+
+/* Clear number or string, but leave value itself */
+void
+stack_free_value(struct value *v)
+{
+
+ switch (v->type) {
+ case BCODE_NONE:
+ break;
+ case BCODE_NUMBER:
+ free_number(v->u.num);
+ break;
+ case BCODE_STRING:
+ free(v->u.string);
+ break;
+ }
+ if (v->array != NULL) {
+ array_free(v->array);
+ v->array = NULL;
+ }
+}
+
+/* Copy number or string content into already allocated target */
+struct value *
+stack_dup_value(const struct value *a, struct value *copy)
+{
+
+ copy->type = a->type;
+
+ switch (a->type) {
+ case BCODE_NONE:
+ break;
+ case BCODE_NUMBER:
+ copy->u.num = dup_number(a->u.num);
+ break;
+ case BCODE_STRING:
+ copy->u.string = strdup(a->u.string);
+ if (copy->u.string == NULL)
+ err(1, NULL);
+ break;
+ }
+
+ copy->array = a->array == NULL ? NULL : array_dup(a->array);
+
+ return (copy);
+}
+
+size_t
+stack_size(const struct stack *stack)
+{
+
+ return (stack->sp + 1);
+}
+
+void
+stack_dup(struct stack *stack)
+{
+ struct value *value;
+ struct value copy;
+
+ value = stack_tos(stack);
+ if (value == NULL) {
+ warnx("stack empty");
+ return;
+ }
+ stack_push(stack, stack_dup_value(value, &copy));
+}
+
+void
+stack_swap(struct stack *stack)
+{
+ struct value copy;
+
+ if (stack->sp < 1) {
+ warnx("stack empty");
+ return;
+ }
+ copy = stack->stack[stack->sp];
+ stack->stack[stack->sp] = stack->stack[stack->sp-1];
+ stack->stack[stack->sp-1] = copy;
+}
+
+static void
+stack_grow(struct stack *stack)
+{
+ size_t new_size;
+
+ if (++stack->sp == stack->size) {
+ new_size = stack->size * 2 + 1;
+ stack->stack = brealloc(stack->stack,
+ new_size * sizeof(*stack->stack));
+ stack->size = new_size;
+ }
+}
+
+void
+stack_pushnumber(struct stack *stack, struct number *b)
+{
+
+ stack_grow(stack);
+ stack->stack[stack->sp].type = BCODE_NUMBER;
+ stack->stack[stack->sp].u.num = b;
+ stack->stack[stack->sp].array = NULL;
+}
+
+void
+stack_pushstring(struct stack *stack, char *string)
+{
+
+ stack_grow(stack);
+ stack->stack[stack->sp].type = BCODE_STRING;
+ stack->stack[stack->sp].u.string = string;
+ stack->stack[stack->sp].array = NULL;
+}
+
+void
+stack_push(struct stack *stack, struct value *v)
+{
+
+ switch (v->type) {
+ case BCODE_NONE:
+ stack_grow(stack);
+ stack->stack[stack->sp].type = BCODE_NONE;
+ break;
+ case BCODE_NUMBER:
+ stack_pushnumber(stack, v->u.num);
+ break;
+ case BCODE_STRING:
+ stack_pushstring(stack, v->u.string);
+ break;
+ }
+ stack->stack[stack->sp].array = v->array == NULL ?
+ NULL : array_dup(v->array);
+}
+
+struct value *
+stack_tos(const struct stack *stack)
+{
+
+ if (stack->sp == -1)
+ return (NULL);
+ return &stack->stack[stack->sp];
+}
+
+void
+stack_set_tos(struct stack *stack, struct value *v)
+{
+
+ if (stack->sp == -1)
+ stack_push(stack, v);
+ else {
+ stack_free_value(&stack->stack[stack->sp]);
+ stack->stack[stack->sp] = *v;
+ stack->stack[stack->sp].array = v->array == NULL ?
+ NULL : array_dup(v->array);
+ }
+}
+
+struct value *
+stack_pop(struct stack *stack)
+{
+
+ if (stack_empty(stack))
+ return (NULL);
+ return &stack->stack[stack->sp--];
+}
+
+struct number *
+stack_popnumber(struct stack *stack)
+{
+
+ if (stack_empty(stack))
+ return (NULL);
+ if (stack->stack[stack->sp].array != NULL) {
+ array_free(stack->stack[stack->sp].array);
+ stack->stack[stack->sp].array = NULL;
+ }
+ if (stack->stack[stack->sp].type != BCODE_NUMBER) {
+ warnx("not a number"); /* XXX remove */
+ return (NULL);
+ }
+ return stack->stack[stack->sp--].u.num;
+}
+
+char *
+stack_popstring(struct stack *stack)
+{
+
+ if (stack_empty(stack))
+ return (NULL);
+ if (stack->stack[stack->sp].array != NULL) {
+ array_free(stack->stack[stack->sp].array);
+ stack->stack[stack->sp].array = NULL;
+ }
+ if (stack->stack[stack->sp].type != BCODE_STRING) {
+ warnx("not a string"); /* XXX remove */
+ return (NULL);
+ }
+ return stack->stack[stack->sp--].u.string;
+}
+
+void
+stack_clear(struct stack *stack)
+{
+
+ while (stack->sp >= 0) {
+ stack_free_value(&stack->stack[stack->sp--]);
+ }
+ free(stack->stack);
+ stack_init(stack);
+}
+
+void
+stack_print(FILE *f, const struct stack *stack, const char *prefix, u_int base)
+{
+ ssize_t i;
+
+ for (i = stack->sp; i >= 0; i--) {
+ print_value(f, &stack->stack[i], prefix, base);
+ putc('\n', f);
+ }
+}
+
+
+static struct array *
+array_new(void)
+{
+ struct array *a;
+
+ a = bmalloc(sizeof(*a));
+ a->data = NULL;
+ a->size = 0;
+ return a;
+}
+
+static __inline void
+array_free(struct array *a)
+{
+ size_t i;
+
+ if (a == NULL)
+ return;
+ for (i = 0; i < a->size; i++)
+ stack_free_value(&a->data[i]);
+ free(a->data);
+ free(a);
+}
+
+static struct array *
+array_dup(const struct array *a)
+{
+ struct array *n;
+ size_t i;
+
+ if (a == NULL)
+ return (NULL);
+ n = array_new();
+ array_grow(n, a->size);
+ for (i = 0; i < a->size; i++)
+ stack_dup_value(&a->data[i], &n->data[i]);
+ return (n);
+}
+
+static __inline void
+array_grow(struct array *array, size_t newsize)
+{
+ size_t i;
+
+ array->data = brealloc(array->data, newsize * sizeof(*array->data));
+ for (i = array->size; i < newsize; i++) {
+ array->data[i].type = BCODE_NONE;
+ array->data[i].array = NULL;
+ }
+ array->size = newsize;
+}
+
+static __inline void
+array_assign(struct array *array, size_t i, const struct value *v)
+{
+
+ if (i >= array->size)
+ array_grow(array, i + 1);
+ stack_free_value(&array->data[i]);
+ array->data[i] = *v;
+}
+
+static __inline struct value *
+array_retrieve(const struct array *array, size_t i)
+{
+
+ if (i >= array->size)
+ return (NULL);
+ return &array->data[i];
+}
+
+void
+frame_assign(struct stack *stack, size_t i, const struct value *v)
+{
+ struct array *a;
+ struct value n;
+
+ if (stack->sp == -1) {
+ n.type = BCODE_NONE;
+ n.array = NULL;
+ stack_push(stack, &n);
+ }
+
+ a = stack->stack[stack->sp].array;
+ if (a == NULL)
+ a = stack->stack[stack->sp].array = array_new();
+ array_assign(a, i, v);
+}
+
+struct value *
+frame_retrieve(const struct stack *stack, size_t i)
+{
+ struct array *a;
+
+ if (stack->sp == -1)
+ return (NULL);
+ a = stack->stack[stack->sp].array;
+ if (a == NULL)
+ a = stack->stack[stack->sp].array = array_new();
+ return array_retrieve(a, i);
+}
diff --git a/usr.bin/dirname/Makefile b/usr.bin/dirname/Makefile
new file mode 100644
index 0000000..be9193c
--- /dev/null
+++ b/usr.bin/dirname/Makefile
@@ -0,0 +1,13 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= dirname
+MAN=
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/dirname/Makefile.depend b/usr.bin/dirname/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/dirname/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/dirname/dirname.c b/usr.bin/dirname/dirname.c
new file mode 100644
index 0000000..c176995
--- /dev/null
+++ b/usr.bin/dirname/dirname.c
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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) 1991, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ char *p;
+ int ch;
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ while (argc--) {
+ if ((p = dirname(*argv)) == NULL)
+ err(1, "%s", *argv);
+ argv++;
+ (void)printf("%s\n", p);
+ }
+ exit(0);
+}
+
+void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: dirname string [...]\n");
+ exit(1);
+}
diff --git a/usr.bin/dirname/tests/Makefile b/usr.bin/dirname/tests/Makefile
new file mode 100644
index 0000000..cc20dd3
--- /dev/null
+++ b/usr.bin/dirname/tests/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+NETBSD_ATF_TESTS_SH= dirname_test
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/dirname/tests/Makefile.depend b/usr.bin/dirname/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/dirname/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dpv/Makefile b/usr.bin/dpv/Makefile
new file mode 100644
index 0000000..93a6cd1
--- /dev/null
+++ b/usr.bin/dpv/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PROG= dpv
+
+CFLAGS+= -I${.CURDIR}
+
+LIBADD= dpv dialog
+
+WARNS?= 6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/dpv/Makefile.depend b/usr.bin/dpv/Makefile.depend
new file mode 100644
index 0000000..849ebfc
--- /dev/null
+++ b/usr.bin/dpv/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libdialog \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdpv \
+ lib/libfigpar \
+ lib/libutil \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1
new file mode 100644
index 0000000..6af3752
--- /dev/null
+++ b/usr.bin/dpv/dpv.1
@@ -0,0 +1,433 @@
+.\" Copyright (c) 2013-2016 Devin Teske
+.\" 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 Jan 26, 2016
+.Dt DPV 1
+.Os
+.Sh NAME
+.Nm dpv
+.Nd stream data from stdin or multiple paths with dialog progress view
+.Sh SYNOPSIS
+.Nm
+.Op options
+.Ar [bytes:]label
+.Nm
+.Op options
+.Fl m
+.Ar [bytes1:]label1
+.Ar path1
+.Op Ar [bytes2:]label2 path2 ...
+.Sh DESCRIPTION
+.Nm
+provides a dialog progress view, allowing a user to see current throughput rate
+and total data transferred for one or more streams.
+.Pp
+The
+.Nm
+utility has two main modes for processing input.
+.Pp
+The default input mode, without
+.Ql Fl m ,
+.Nm
+reads bytes from standard input.
+A label for the data must be provided.
+.Pp
+The secondary input mode, with
+.Ql Fl m ,
+.Nm
+reads multiple paths
+.Pq up to 2047 or Dq ARG_MAX/2-1 ,
+sequentially.
+.Pp
+Data read in either mode is either thrown away
+.Pq default ,
+sent to a spawned instance of the program specified via
+.Ql Fl x Ar cmd ,
+or sent to a unique file specified by
+.Ql Fl o Ar file .
+.Pp
+With or without
+.Ql Fl m ,
+progress is displayed using one of
+.Xr dialog 3
+.Pq default ,
+.Xr dialog 1
+.Pq see Ql Fl D ,
+or instead
+.Xr Xdialog 1
+.Pq see Ql Fl X .
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl b Ar backtitle"
+.It Fl a Ar text
+Display
+.Ar text
+below the file progress indicator(s).
+.It Fl b Ar backtitle
+Display
+.Ar backtitle
+on the backdrop, at top-left, behind the dialog widget.
+When using
+.Xr Xdialog 1 ,
+this is displayed inside the window
+.Pq at the top
+followed by a separator line.
+.It Fl d
+Debug mode.
+Print dialog prompt data to standard out and provide additional debugging on
+standard error.
+.It Fl D
+Do not use the default interface of
+.Xr dialog 3 ,
+but instead spawn an instance of
+.Xr dialog 1 .
+The path to
+.Xr dialog 1
+is taken from the
+.Ev DIALOG
+environment variable or simply
+.Dq Li dialog
+if unset or NULL.
+.It Fl h
+Produce a short syntax usage with brief option descriptions and exit.
+Output is produced on standard error.
+.It Fl i Ar format
+Customize the single-file format string used to update the status line.
+Ignored when using either
+.Ql Fl D
+or
+.Ql Fl X
+which lack the ability to display the status line
+.Pq containing bytes/rate/thread information .
+Default value
+is
+.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. .
+This format is used when handling one file.
+.It Fl I Ar format
+Customize the multi-file format string used to update the status line.
+Ignored when using either
+.Ql Fl D
+or
+.Ql Fl X
+which lack the ability to display the status line
+.Pq containing bytes/rate/thread information .
+Default value
+is
+.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] .
+This format is used when handling more than one file.
+.It Fl k
+Keep tite.
+Prevent visually distracting initialization/exit routines for scripts running
+.Xr dialog 1
+several times.
+.It Fl l
+Line mode. Read lines from input instead of bytes.
+.It Fl L Ar size
+Label size.
+If negative, shrink to longest label width.
+.It Fl m
+Multi-input mode.
+Instead of reading bytes from standard input, read from a set of paths
+.Pq one for each label .
+By default, each path is processed sequentially in the order given.
+.It Fl n Ar num
+Display at-most
+.Ar num
+progress indicators per screen.
+If zero, display as many as possible.
+If negative, only display the main progress indicator.
+Default is 0.
+Maximum value is 10.
+.It Fl N
+No overrun.
+If enabled, stop reading known-length inputs when input reaches stated length.
+.It Fl o Ar file
+Output data to
+.Ar file .
+The first occurrence of
+.Ql %s
+.Pq if any
+in
+.Ql Ar file
+will be replaced with the
+.Ar label
+text.
+.It Fl p Ar text
+Display
+.Ar text
+above the file progress indicator(s).
+.It Fl P Ar size
+Mini-progressbar size.
+If negative, don't display mini-progressbars
+.Pq only the large overall progress indicator is shown .
+If zero, auto-adjust based on number of files to read.
+When zero and only one file to read, defaults to -1.
+When zero and more than one file to read, defaults to 17.
+.It Fl t Ar title
+Display
+.Ar title
+atop the dialog box.
+Note that if you use this option at the same time as
+.Ql Fl X
+and
+.Ql Fl b Ar backtitle ,
+the
+.Ar backtitle
+and
+.Ar title
+are effectively switched
+.Pq see BUGS section below .
+.It Fl T
+Test mode.
+Simulate reading a number of bytes, divided evenly across the number of files,
+while stepping through each percent value of each file to process.
+Appends
+.Dq Li [TEST MODE]
+to the status line
+.Pq to override, use Ql Fl u Ar format .
+No data is actually read.
+.It Fl U Ar num
+Update status line
+.Ar num
+times per-second.
+Default value is
+.Ql Li 2 .
+A value of
+.Ql Li 0
+disables status line updates.
+If negative, update the status line as fast as possible.
+Ignored when using either
+.Ql Fl D
+or
+.Ql Fl X
+which lack the ability to display the status line
+.Pq containing bytes/rate/thread information .
+.It Fl w
+Wide mode.
+Allows long
+.Ar text
+arguments used with
+.Ql Fl p
+and
+.Ql Fl a
+to bump the dialog width.
+Prompts wider than the maximum width will wrap
+.Pq unless using Xr Xdialog 1 ; see BUGS section below .
+.It Fl x Ar cmd
+Execute
+.Ar cmd
+.Pq via Xr sh 1
+and send it data that has been read.
+Data is available to
+.Ar cmd
+on standard input.
+With
+.Ql Fl m ,
+.Ar cmd
+is executed once for each
+.Ar path
+argument.
+The first occurrence of
+.Ql %s
+.Pq if any
+in
+.Ql Ar cmd
+will be replaced with the
+.Ar label
+text.
+.It Fl X
+Enable X11 mode by using
+.Xr Xdialog 1
+instead of
+.Xr dialog 1
+or
+.Xr dialog 3 .
+.El
+.Sh ENVIRONMENT
+The following environment variables are referenced by
+.Nm :
+.Bl -tag -width ".Ev USE_COLOR"
+.It Ev DIALOG
+Override command string used to launch
+.Xr dialog 1
+.Pq requires Ql Fl D
+or
+.Xr Xdialog 1
+.Pq requires Ql Fl X ;
+default is either
+.Ql dialog
+.Pq for Ql Fl D
+or
+.Ql Xdialog
+.Pq for Ql Fl X .
+.It Ev DIALOGRC
+If set and non-NULL, path to
+.Ql .dialogrc
+file.
+.It Ev HOME
+If
+.Ql Ev $DIALOGRC
+is either not set or NULL, used as a prefix to
+.Ql .dialogrc
+.Pq i.e., Ql $HOME/.dialogrc .
+.It Ev USE_COLOR
+If set and NULL, disables the use of color when using
+.Xr dialog 1
+.Pq does not apply to Xr Xdialog 1 .
+.El
+.Sh DEPENDENCIES
+If using
+.Ql Fl D ,
+.Xr dialog 1
+is required.
+.Pp
+If using
+.Ql Fl X ,
+.Xr Xdialog 1
+is required.
+.Sh FILES
+.Bl -tag -width ".Pa $HOME/.dialogrc" -compact
+.It Pa $HOME/.dialogrc
+.El
+.Sh EXAMPLES
+Simple example to show how fast
+.Xr yes 1
+produces lines
+.Pq usually about ten-million per-second; your results may vary :
+.Bd -literal -offset indent
+yes | dpv -l yes
+.Ed
+.Pp
+Display progress while timing how long it takes
+.Xr yes 1
+to produce a half-billion lines
+.Pq usually under one minute; your results may vary :
+.Bd -literal -offset indent
+time yes | dpv -Nl 500000000:yes
+.Ed
+.Pp
+An example to watch how quickly a file is transferred using
+.Xr nc 1 :
+.Bd -literal -offset indent
+dpv -x "nc -w 1 somewhere.com 3000" -m label file
+.Ed
+.Pp
+A similar example, transferring a file from another process and passing the
+expected size to
+.Nm :
+.Bd -literal -offset indent
+cat file | dpv -x "nc -w 1 somewhere.com 3000" 12345:label
+.Ed
+.Pp
+A more complicated example:
+.Bd -literal -offset indent
+tar cf - . | dpv -x "gzip -9 > out.tgz" \\
+ $( du -s . | awk '{print $1 * 1024}' ):label
+.Ed
+.Pp
+Taking an image of a disk:
+.Bd -literal -offset indent
+dpv -o disk-image.img -m label /dev/ada0
+.Ed
+.Pp
+Writing an image back to a disk:
+.Bd -literal -offset indent
+dpv -o /dev/ada0 -m label disk-image.img
+.Ed
+.Pp
+Zeroing a disk:
+.Bd -literal -offset indent
+dpv -o /dev/md42 < /dev/zero
+.Ed
+.Sh SEE ALSO
+.Xr dialog 1 ,
+.Xr sh 1 ,
+.Xr Xdialog 1 ,
+.Xr dialog 3
+.Sh HISTORY
+A
+.Nm
+utility first appeared in
+.Fx 10.2 .
+.Sh AUTHORS
+.An Devin Teske Aq dteske@FreeBSD.org
+.Sh BUGS
+.Xr Xdialog 1 ,
+when given both
+.Ql Fl -title Ar title
+.Pq see above Ql Fl t Ar title
+and
+.Ql Fl -backtitle Ar backtitle
+.Pq see above Ql Fl b Ar backtitle ,
+displays the backtitle in place of the title and vice-versa.
+.Pp
+.Xr Xdialog 1
+does not wrap long prompt texts received after initial launch.
+This is a known issue with the
+.Ql --gauge
+widget in
+.Xr Xdialog 1 .
+.Pp
+.Xr dialog 1
+does not display the first character after a series of escaped escape-sequences
+(e.g., ``\\\\n'' produces ``\\'' instead of ``\\n'').
+This is a known issue with
+.Xr dialog 1
+and does not affect
+.Xr dialog 3
+or
+.Xr Xdialog 1 .
+.Pp
+If your application ignores
+.Ev USE_COLOR
+when set and NULL before calling
+.Xr dpv 1
+with color escape sequences anyway,
+.Xr dialog 3
+and
+.Xr dialog 1
+may not render properly.
+Workaround is to detect when
+.Ev USE_COLOR
+is set and NULL and either not use color escape sequences at that time or use
+.Xr unset 1
+.Xr [ sh 1 ]
+or
+.Xr unsetenv 1
+.Xr [ csh 1 ]
+to unset
+.Ev USE_COLOR ,
+forcing interpretation of color sequences.
+This does not effect
+.Xr Xdialog 1 ,
+which renders the color escape sequences as plain text.
+See
+.Do
+embedded "\\Z" sequences
+.Dc
+in
+.Xr dialog 1
+for additional information.
diff --git a/usr.bin/dpv/dpv.c b/usr.bin/dpv/dpv.c
new file mode 100644
index 0000000..440b5ab6
--- /dev/null
+++ b/usr.bin/dpv/dpv.c
@@ -0,0 +1,545 @@
+/*-
+ * Copyright (c) 2013-2016 Devin Teske <dteske@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/stat.h>
+#include <sys/types.h>
+
+#define _BSD_SOURCE /* to get dprintf() prototype in stdio.h below */
+#include <dialog.h>
+#include <dpv.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string_m.h>
+#include <unistd.h>
+
+#include "dpv_util.h"
+
+/* Debugging */
+static uint8_t debug = FALSE;
+
+/* Data to process */
+static struct dpv_file_node *file_list = NULL;
+static unsigned int nfiles = 0;
+
+/* Data processing */
+static uint8_t line_mode = FALSE;
+static uint8_t no_overrun = FALSE;
+static char *buf = NULL;
+static int fd = -1;
+static int output_type = DPV_OUTPUT_NONE;
+static size_t bsize;
+static char rpath[PATH_MAX];
+
+/* Extra display information */
+static uint8_t multiple = FALSE; /* `-m' */
+static char *pgm; /* set to argv[0] by main() */
+
+/* Function prototypes */
+static void sig_int(int sig);
+static void usage(void);
+int main(int argc, char *argv[]);
+static int operate_common(struct dpv_file_node *file, int out);
+static int operate_on_bytes(struct dpv_file_node *file, int out);
+static int operate_on_lines(struct dpv_file_node *file, int out);
+
+static int
+operate_common(struct dpv_file_node *file, int out)
+{
+ struct stat sb;
+
+ /* Open the file if necessary */
+ if (fd < 0) {
+ if (multiple) {
+ /* Resolve the file path and attempt to open it */
+ if (realpath(file->path, rpath) == 0 ||
+ (fd = open(rpath, O_RDONLY)) < 0) {
+ warn("%s", file->path);
+ file->status = DPV_STATUS_FAILED;
+ return (-1);
+ }
+ } else {
+ /* Assume stdin, but if that's a TTY instead use the
+ * highest numbered file descriptor (obtained by
+ * generating new fd and then decrementing).
+ *
+ * NB: /dev/stdin should always be open(2)'able
+ */
+ fd = STDIN_FILENO;
+ if (isatty(fd)) {
+ fd = open("/dev/stdin", O_RDONLY);
+ close(fd--);
+ }
+
+ /* This answer might be wrong, if dpv(3) has (by
+ * request) opened an output file or pipe. If we
+ * told dpv(3) to open a file, subtract one from
+ * previous answer. If instead we told dpv(3) to
+ * prepare a pipe output, subtract two.
+ */
+ switch(output_type) {
+ case DPV_OUTPUT_FILE:
+ fd -= 1;
+ break;
+ case DPV_OUTPUT_SHELL:
+ fd -= 2;
+ break;
+ }
+ }
+ }
+
+ /* Allocate buffer if necessary */
+ if (buf == NULL) {
+ /* Use output block size as buffer size if available */
+ if (out >= 0) {
+ if (fstat(out, &sb) != 0) {
+ warn("%i", out);
+ file->status = DPV_STATUS_FAILED;
+ return (-1);
+ }
+ if (S_ISREG(sb.st_mode)) {
+ if (sysconf(_SC_PHYS_PAGES) >
+ PHYSPAGES_THRESHOLD)
+ bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8);
+ else
+ bsize = BUFSIZE_SMALL;
+ } else
+ bsize = MAX(sb.st_blksize,
+ (blksize_t)sysconf(_SC_PAGESIZE));
+ } else
+ bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8);
+
+ /* Attempt to allocate */
+ if ((buf = malloc(bsize+1)) == NULL) {
+ end_dialog();
+ err(EXIT_FAILURE, "Out of memory?!");
+ }
+ }
+
+ return (0);
+}
+
+static int
+operate_on_bytes(struct dpv_file_node *file, int out)
+{
+ int progress;
+ ssize_t r, w;
+
+ if (operate_common(file, out) < 0)
+ return (-1);
+
+ /* [Re-]Fill the buffer */
+ if ((r = read(fd, buf, bsize)) <= 0) {
+ if (fd != STDIN_FILENO)
+ close(fd);
+ fd = -1;
+ file->status = DPV_STATUS_DONE;
+ return (100);
+ }
+
+ /* [Re-]Dump the buffer */
+ if (out >= 0) {
+ if ((w = write(out, buf, r)) < 0) {
+ end_dialog();
+ err(EXIT_FAILURE, "output");
+ }
+ fsync(out);
+ }
+
+ dpv_overall_read += r;
+ file->read += r;
+
+ /* Calculate percentage of completion (if possible) */
+ if (file->length >= 0) {
+ progress = (file->read * 100 / (file->length > 0 ?
+ file->length : 1));
+
+ /* If no_overrun, do not return 100% until read >= length */
+ if (no_overrun && progress == 100 && file->read < file->length)
+ progress--;
+
+ return (progress);
+ } else
+ return (-1);
+}
+
+static int
+operate_on_lines(struct dpv_file_node *file, int out)
+{
+ char *p;
+ int progress;
+ ssize_t r, w;
+
+ if (operate_common(file, out) < 0)
+ return (-1);
+
+ /* [Re-]Fill the buffer */
+ if ((r = read(fd, buf, bsize)) <= 0) {
+ if (fd != STDIN_FILENO)
+ close(fd);
+ fd = -1;
+ file->status = DPV_STATUS_DONE;
+ return (100);
+ }
+ buf[r] = '\0';
+
+ /* [Re-]Dump the buffer */
+ if (out >= 0) {
+ if ((w = write(out, buf, r)) < 0) {
+ end_dialog();
+ err(EXIT_FAILURE, "output");
+ }
+ fsync(out);
+ }
+
+ /* Process the buffer for number of lines */
+ for (p = buf; p != NULL && *p != '\0';)
+ if ((p = strchr(p, '\n')) != NULL)
+ dpv_overall_read++, p++, file->read++;
+
+ /* Calculate percentage of completion (if possible) */
+ if (file->length >= 0) {
+ progress = (file->read * 100 / file->length);
+
+ /* If no_overrun, do not return 100% until read >= length */
+ if (no_overrun && progress == 100 && file->read < file->length)
+ progress--;
+
+ return (progress);
+ } else
+ return (-1);
+}
+
+/*
+ * Takes a list of names that are to correspond to input streams coming from
+ * stdin or fifos and produces necessary config to drive dpv(3) `--gauge'
+ * widget. If the `-d' flag is used, output is instead send to terminal
+ * standard output (and the output can then be saved to a file, piped into
+ * custom [X]dialog(1) invocation, or whatever.
+ */
+int
+main(int argc, char *argv[])
+{
+ char dummy;
+ int ch;
+ int n = 0;
+ size_t config_size = sizeof(struct dpv_config);
+ size_t file_node_size = sizeof(struct dpv_file_node);
+ struct dpv_config *config;
+ struct dpv_file_node *curfile;
+ struct sigaction act;
+
+ pgm = argv[0]; /* store a copy of invocation name */
+
+ /* Allocate config structure */
+ if ((config = malloc(config_size)) == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ memset((void *)(config), '\0', config_size);
+
+ /*
+ * Process command-line options
+ */
+ while ((ch = getopt(argc, argv,
+ "a:b:dDhi:I:klL:mn:No:p:P:t:TU:wx:X")) != -1) {
+ switch(ch) {
+ case 'a': /* additional message text to append */
+ if (config->aprompt == NULL) {
+ config->aprompt = malloc(DPV_APROMPT_MAX);
+ if (config->aprompt == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ }
+ snprintf(config->aprompt, DPV_APROMPT_MAX, "%s",
+ optarg);
+ break;
+ case 'b': /* [X]dialog(1) backtitle */
+ if (config->backtitle != NULL)
+ free((char *)config->backtitle);
+ config->backtitle = malloc(strlen(optarg) + 1);
+ if (config->backtitle == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ *(config->backtitle) = '\0';
+ strcat(config->backtitle, optarg);
+ break;
+ case 'd': /* debugging */
+ debug = TRUE;
+ config->debug = debug;
+ break;
+ case 'D': /* use dialog(1) instead of libdialog */
+ config->display_type = DPV_DISPLAY_DIALOG;
+ break;
+ case 'h': /* help/usage */
+ usage();
+ break; /* NOTREACHED */
+ case 'i': /* status line format string for single-file */
+ config->status_solo = optarg;
+ break;
+ case 'I': /* status line format string for many-files */
+ config->status_many = optarg;
+ break;
+ case 'k': /* keep tite */
+ config->keep_tite = TRUE;
+ break;
+ case 'l': /* Line mode */
+ line_mode = TRUE;
+ break;
+ case 'L': /* custom label size */
+ config->label_size =
+ (int)strtol(optarg, (char **)NULL, 10);
+ if (config->label_size == 0 && errno == EINVAL)
+ errx(EXIT_FAILURE,
+ "`-L' argument must be numeric");
+ else if (config->label_size < -1)
+ config->label_size = -1;
+ break;
+ case 'm': /* enable multiple file arguments */
+ multiple = TRUE;
+ break;
+ case 'o': /* `-o path' for sending data-read to file */
+ output_type = DPV_OUTPUT_FILE;
+ config->output_type = DPV_OUTPUT_FILE;
+ config->output = optarg;
+ break;
+ case 'n': /* custom number of files per `page' */
+ config->display_limit =
+ (int)strtol(optarg, (char **)NULL, 10);
+ if (config->display_limit == 0 && errno == EINVAL)
+ errx(EXIT_FAILURE,
+ "`-n' argument must be numeric");
+ else if (config->display_limit < 0)
+ config->display_limit = -1;
+ break;
+ case 'N': /* No overrun (truncate reads of known-length) */
+ no_overrun = TRUE;
+ config->options |= DPV_NO_OVERRUN;
+ break;
+ case 'p': /* additional message text to use as prefix */
+ if (config->pprompt == NULL) {
+ config->pprompt = malloc(DPV_PPROMPT_MAX + 2);
+ if (config->pprompt == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ /* +2 is for implicit "\n" appended later */
+ }
+ snprintf(config->pprompt, DPV_PPROMPT_MAX, "%s",
+ optarg);
+ break;
+ case 'P': /* custom size for mini-progressbar */
+ config->pbar_size =
+ (int)strtol(optarg, (char **)NULL, 10);
+ if (config->pbar_size == 0 && errno == EINVAL)
+ errx(EXIT_FAILURE,
+ "`-P' argument must be numeric");
+ else if (config->pbar_size < -1)
+ config->pbar_size = -1;
+ break;
+ case 't': /* [X]dialog(1) title */
+ if (config->title != NULL)
+ free(config->title);
+ config->title = malloc(strlen(optarg) + 1);
+ if (config->title == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ *(config->title) = '\0';
+ strcat(config->title, optarg);
+ break;
+ case 'T': /* test mode (don't read data, fake it) */
+ config->options |= DPV_TEST_MODE;
+ break;
+ case 'U': /* updates per second */
+ config->status_updates_per_second =
+ (int)strtol(optarg, (char **)NULL, 10);
+ if (config->status_updates_per_second == 0 &&
+ errno == EINVAL)
+ errx(EXIT_FAILURE,
+ "`-U' argument must be numeric");
+ break;
+ case 'w': /* `-p' and `-a' widths bump [X]dialog(1) width */
+ config->options |= DPV_WIDE_MODE;
+ break;
+ case 'x': /* `-x cmd' for sending data-read to sh(1) code */
+ output_type = DPV_OUTPUT_SHELL;
+ config->output_type = DPV_OUTPUT_SHELL;
+ config->output = optarg;
+ break;
+ case 'X': /* X11 support through x11/xdialog */
+ config->display_type = DPV_DISPLAY_XDIALOG;
+ break;
+ case '?': /* unknown argument (based on optstring) */
+ /* FALLTHROUGH */
+ default: /* unhandled argument (based on switch) */
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* Process remaining arguments as list of names to display */
+ for (curfile = file_list; n < argc; n++) {
+ nfiles++;
+
+ /* Allocate a new struct for the file argument */
+ if (curfile == NULL) {
+ if ((curfile = malloc(file_node_size)) == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ memset((void *)(curfile), '\0', file_node_size);
+ file_list = curfile;
+ } else {
+ if ((curfile->next = malloc(file_node_size)) == NULL)
+ errx(EXIT_FAILURE, "Out of memory?!");
+ memset((void *)(curfile->next), '\0', file_node_size);
+ curfile = curfile->next;
+ }
+ curfile->name = argv[n];
+
+ /* Read possible `lines:' prefix from label syntax */
+ if (sscanf(curfile->name, "%lli:%c", &(curfile->length),
+ &dummy) == 2)
+ curfile->name = strchr(curfile->name, ':') + 1;
+ else
+ curfile->length = -1;
+
+ /* Read path argument if enabled */
+ if (multiple) {
+ if (++n >= argc)
+ errx(EXIT_FAILURE, "Missing path argument "
+ "for label number %i", nfiles);
+ curfile->path = argv[n];
+ } else
+ break;
+ }
+
+ /* Display usage and exit if not given at least one name */
+ if (nfiles == 0) {
+ warnx("no labels provided");
+ usage();
+ /* NOTREACHED */
+ }
+
+ /*
+ * Set cleanup routine for Ctrl-C action
+ */
+ if (config->display_type == DPV_DISPLAY_LIBDIALOG) {
+ act.sa_handler = sig_int;
+ sigaction(SIGINT, &act, 0);
+ }
+
+ /* Set status formats and action */
+ if (line_mode) {
+ config->status_solo = LINE_STATUS_SOLO;
+ config->status_many = LINE_STATUS_SOLO;
+ config->action = operate_on_lines;
+ } else {
+ config->status_solo = BYTE_STATUS_SOLO;
+ config->status_many = BYTE_STATUS_SOLO;
+ config->action = operate_on_bytes;
+ }
+
+ /*
+ * Hand off to dpv(3)...
+ */
+ if (dpv(config, file_list) != 0 && debug)
+ warnx("dpv(3) returned error!?");
+
+ if (!config->keep_tite)
+ end_dialog();
+ dpv_free();
+
+ exit(EXIT_SUCCESS);
+}
+
+/*
+ * Interrupt handler to indicate we received a Ctrl-C interrupt.
+ */
+static void
+sig_int(int sig __unused)
+{
+ dpv_interrupt = TRUE;
+}
+
+/*
+ * Print short usage statement to stderr and exit with error status.
+ */
+static void
+usage(void)
+{
+
+ if (debug) /* No need for usage */
+ exit(EXIT_FAILURE);
+
+ fprintf(stderr, "Usage: %s [options] bytes:label\n", pgm);
+ fprintf(stderr, " %s [options] -m bytes1:label1 path1 "
+ "[bytes2:label2 path2 ...]\n", pgm);
+ fprintf(stderr, "OPTIONS:\n");
+#define OPTFMT "\t%-14s %s\n"
+ fprintf(stderr, OPTFMT, "-a text",
+ "Append text. Displayed below file progress indicators.");
+ fprintf(stderr, OPTFMT, "-b backtitle",
+ "String to be displayed on the backdrop, at top-left.");
+ fprintf(stderr, OPTFMT, "-d",
+ "Debug. Write to standard output instead of dialog.");
+ fprintf(stderr, OPTFMT, "-D",
+ "Use dialog(1) instead of dialog(3) [default].");
+ fprintf(stderr, OPTFMT, "-h",
+ "Produce this output on standard error and exit.");
+ fprintf(stderr, OPTFMT, "-i format",
+ "Customize status line format. See fdpv(1) for details.");
+ fprintf(stderr, OPTFMT, "-I format",
+ "Customize status line format. See fdpv(1) for details.");
+ fprintf(stderr, OPTFMT, "-L size",
+ "Label size. Must be a number greater than 0, or -1.");
+ fprintf(stderr, OPTFMT, "-m",
+ "Enable processing of multiple file argiments.");
+ fprintf(stderr, OPTFMT, "-n num",
+ "Display at-most num files per screen. Default is -1.");
+ fprintf(stderr, OPTFMT, "-N",
+ "No overrun. Stop reading input at stated length, if any.");
+ fprintf(stderr, OPTFMT, "-o file",
+ "Output data to file. First %s replaced with label text.");
+ fprintf(stderr, OPTFMT, "-p text",
+ "Prefix text. Displayed above file progress indicators.");
+ fprintf(stderr, OPTFMT, "-P size",
+ "Mini-progressbar size. Must be a number greater than 3.");
+ fprintf(stderr, OPTFMT, "-t title",
+ "Title string to be displayed at top of dialog(1) box.");
+ fprintf(stderr, OPTFMT, "-T",
+ "Test mode. Don't actually read any data, but fake it.");
+ fprintf(stderr, OPTFMT, "-U num",
+ "Update status line num times per-second. Default is 2.");
+ fprintf(stderr, OPTFMT, "-w",
+ "Wide. Width of `-p' and `-a' text bump dialog(1) width.");
+ fprintf(stderr, OPTFMT, "-x cmd",
+ "Send data to executed cmd. First %s replaced with label.");
+ fprintf(stderr, OPTFMT, "-X",
+ "X11. Use Xdialog(1) instead of dialog(1).");
+ exit(EXIT_FAILURE);
+}
diff --git a/usr.bin/dpv/dpv_util.h b/usr.bin/dpv/dpv_util.h
new file mode 100644
index 0000000..36990be
--- /dev/null
+++ b/usr.bin/dpv/dpv_util.h
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2013-2014 Devin Teske <dteske@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$
+ */
+
+#ifndef _DPV_UTIL_H_
+#define _DPV_UTIL_H_
+
+/* Limits */
+#define BUFSIZE_MAX (2 * 1024 * 1024)
+ /* Buffer size for read(2) input */
+#ifndef MAXPHYS
+#define MAXPHYS (128 * 1024)
+ /* max raw I/O transfer size */
+#endif
+
+/*
+ * Memory strategry threshold, in pages: if physmem is larger than this,
+ * use a large buffer.
+ */
+#define PHYSPAGES_THRESHOLD (32 * 1024)
+
+/*
+ * Small (default) buffer size in bytes. It's inefficient for this to be
+ * smaller than MAXPHYS.
+ */
+#define BUFSIZE_SMALL (MAXPHYS)
+
+/*
+ * Math macros
+ */
+#undef MIN
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#undef MAX
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+
+/*
+ * Extra display information
+ */
+#define BYTE_STATUS_SOLO "%'10lli bytes read @ %'9.1f bytes/sec."
+#define BYTE_STATUS_MANY (BYTE_STATUS_SOLO " [%i/%i busy/wait]")
+#define LINE_STATUS_SOLO "%'10lli lines read @ %'9.1f lines/sec."
+#define LINE_STATUS_MANY (LINE_STATUS_SOLO " [%i/%i busy/wait]")
+
+#endif /* !_DPV_UTIL_H_ */
diff --git a/usr.bin/drill/Makefile b/usr.bin/drill/Makefile
new file mode 100644
index 0000000..0de0ae5
--- /dev/null
+++ b/usr.bin/drill/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+# Vendor sources and generated files
+LDNSDIR= ${.CURDIR}/../../contrib/ldns
+
+.PATH: ${LDNSDIR}/drill
+
+PROG= drill
+SRCS= drill.c drill_util.c error.c root.c work.c \
+ chasetrace.c dnssec.c securetrace.c
+CFLAGS+= -I${LDNSDIR}
+NO_WERROR= true
+MAN= drill.1
+
+LIBADD= ldns crypto
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/drill/Makefile.depend b/usr.bin/drill/Makefile.depend
new file mode 100644
index 0000000..750a0a3
--- /dev/null
+++ b/usr.bin/drill/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libldns \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dtc/HACKING b/usr.bin/dtc/HACKING
new file mode 100644
index 0000000..9acaeef
--- /dev/null
+++ b/usr.bin/dtc/HACKING
@@ -0,0 +1,63 @@
+$FreeBSD$
+
+Notes for people hacking on dtc
+===============================
+
+This file contains some notes for people wishing to hack on dtc.
+
+Upstreaming
+-----------
+
+This code is developed in the FreeBSD svn repository:
+
+https://svn.freebsd.org/base/head/usr.bin/dtc
+
+If you got the source from anywhere else and wish to make changes, please
+ensure that you are working against the latest version, or you may end up
+fixing bugs that are already fixed upstream. Although the license makes no
+requirement that you share any improvements that you make, patches are very
+welcome.
+
+C++11
+-----
+
+This project uses C++11, as the goal for FreeBSD 11 is to require C/C++11 as a
+minimum, either from clang or an external toolchain. In particular, it uses
+`std::unique_ptr` extensively for memory management within the tree. Unique
+pointers are also used in several other places to track ownership.
+
+Most iterator loops use the new loop syntax and the `auto` type for type
+deduction. Range-based `for` loops generally improve the readability of the
+code, though `auto` should only be used in places where the type can be deduced
+as easily by the reader as by the compiler.
+
+The code also makes use of `static_assert()` to track compile-time invariants.
+
+Adding New Checks
+-----------------
+
+Currently, the biggest weakness of this version of the tool is that it lacks
+most of the semantic checkers that can be implemented by simply reading the
+ePAPR spec. The `checker` class provides a simple superclass for implementing
+these quite easily. There are also helper methods on `device_tree` for finding
+specific nodes, for checks that require some understanding of the structure of
+the tree.
+
+We should probably add a parent pointer to the `node` class for easily walking
+up the tree.
+
+Adding Direct C Output
+----------------------
+
+The FreeBSD build system currently uses dtc to generate a blob and then
+converts this to C source code. A new `output_writer` subclass could easily
+generate the C directly.
+
+Parser Improvements
+-------------------
+
+There are a few FIXME lines in the parser for some corner cases that are not
+currently used by FreeBSD. These are mainly related to labels in the middle of
+values. These can be fixed by creating a new `property_value` with the
+specified label, starting at the location of the label. Don't forget to remove
+the associated comments from the BUGS section of the man page if you fix this.
diff --git a/usr.bin/dtc/Makefile b/usr.bin/dtc/Makefile
new file mode 100644
index 0000000..a834f62
--- /dev/null
+++ b/usr.bin/dtc/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PROG_CXX=dtc
+SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc
+MAN= dtc.1
+
+WARNS?= 3
+
+CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions
+
+NO_SHARED?=NO
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/dtc/Makefile.depend b/usr.bin/dtc/Makefile.depend
new file mode 100644
index 0000000..b602708
--- /dev/null
+++ b/usr.bin/dtc/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libcxxrt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/dtc/checking.cc b/usr.bin/dtc/checking.cc
new file mode 100644
index 0000000..26cbbe2
--- /dev/null
+++ b/usr.bin/dtc/checking.cc
@@ -0,0 +1,259 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#include "checking.hh"
+#include <stdio.h>
+
+
+
+namespace dtc
+{
+namespace fdt
+{
+namespace checking
+{
+
+namespace
+{
+ /**
+ * Checker that verifies that every node that has children has
+ * #address-cells and #size-cells properties.
+ */
+ struct address_cells_checker : public checker
+ {
+ address_cells_checker(const char *name) : checker(name) {}
+ virtual bool check_node(device_tree *, const node_ptr &n)
+ {
+ // If this has no children, it trivially meets the
+ // conditions.
+ if (n->child_begin() == n->child_end())
+ {
+ return true;
+ }
+ bool found_address = false;
+ bool found_size = false;
+ for (auto i=n->property_begin(), e=n->property_end() ; i!=e ; ++i)
+ {
+ if (!found_address)
+ {
+ found_address = ((*i)->get_key() == "#address-cells");
+ }
+ if (!found_size)
+ {
+ found_size = ((*i)->get_key() == "#size-cells");
+ }
+ if (found_size && found_address)
+ {
+ break;
+ }
+ }
+ if (!found_address)
+ {
+ report_error("Missing #address-cells property");
+ }
+ if (!found_size)
+ {
+ report_error("Missing #size-cells property");
+ }
+ return found_address && found_size;
+ }
+ };
+} // anonymous namespace
+
+bool
+checker::visit_node(device_tree *tree, const node_ptr &n)
+{
+ path.push_back(std::make_pair(n->name, n->unit_address));
+ // Check this node
+ if (!check_node(tree, n))
+ {
+ return false;
+ }
+ // Now check its properties
+ for (auto i=n->property_begin(), e=n->property_end() ; i!=e ; ++i)
+ {
+ if (!check_property(tree, n, *i))
+ {
+ return false;
+ }
+ }
+ // And then recursively check the children
+ for (node::child_iterator i=n->child_begin(), e=n->child_end() ; i!=e ;
+ ++i)
+ {
+ if (!visit_node(tree, *i))
+ {
+ return false;
+ }
+ }
+ path.pop_back();
+ return true;
+}
+
+void
+checker::report_error(const char *errmsg)
+{
+ fprintf(stderr, "Error: %s, while checking node: ", errmsg);
+ for (auto &p : path)
+ {
+ putc('/', stderr);
+ p.first.dump();
+ if (!(p.second.empty()))
+ {
+ putc('@', stderr);
+ p.second.dump();
+ }
+ }
+ fprintf(stderr, " [-W%s]\n", checker_name);
+}
+
+bool
+property_checker::check_property(device_tree *tree, const node_ptr &n, property_ptr p)
+{
+ if (p->get_key() == key)
+ {
+ if (!check(tree, n, p))
+ {
+ report_error("property check failed");
+ return false;
+ }
+ }
+ return true;
+}
+
+bool
+property_size_checker::check(device_tree *, const node_ptr &, property_ptr p)
+{
+ uint32_t psize = 0;
+ for (property::value_iterator i=p->begin(),e=p->end() ; i!=e ; ++i)
+ {
+ if (!i->is_binary())
+ {
+ return false;
+ }
+ psize += i->byte_data.size();
+ }
+ return psize == size;
+}
+
+template<property_value::value_type T>
+void
+check_manager::add_property_type_checker(const char *name, string prop)
+{
+ checkers.insert(std::make_pair(string(name),
+ new property_type_checker<T>(name, prop)));
+}
+
+void
+check_manager::add_property_size_checker(const char *name,
+ string prop,
+ uint32_t size)
+{
+ checkers.insert(std::make_pair(string(name),
+ new property_size_checker(name, prop, size)));
+}
+
+check_manager::~check_manager()
+{
+ while (checkers.begin() != checkers.end())
+ {
+ delete checkers.begin()->second;
+ checkers.erase(checkers.begin());
+ }
+ while (disabled_checkers.begin() != disabled_checkers.end())
+ {
+ delete disabled_checkers.begin()->second;
+ disabled_checkers.erase(disabled_checkers.begin());
+ }
+}
+
+check_manager::check_manager()
+{
+ // NOTE: All checks listed here MUST have a corresponding line
+ // in the man page!
+ add_property_type_checker<property_value::STRING_LIST>(
+ "type-compatible", string("compatible"));
+ add_property_type_checker<property_value::STRING>(
+ "type-model", string("model"));
+ add_property_size_checker("type-phandle", string("phandle"), 4);
+ disabled_checkers.insert(std::make_pair(string("cells-attributes"),
+ new address_cells_checker("cells-attributes")));
+}
+
+bool
+check_manager::run_checks(device_tree *tree, bool keep_going)
+{
+ bool success = true;
+ for (auto &i : checkers)
+ {
+ success &= i.second->check_tree(tree);
+ if (!(success || keep_going))
+ {
+ break;
+ }
+ }
+ return success;
+}
+
+bool
+check_manager::disable_checker(string name)
+{
+ auto checker = checkers.find(name);
+ if (checker != checkers.end())
+ {
+ disabled_checkers.insert(std::make_pair(name,
+ checker->second));
+ checkers.erase(checker);
+ return true;
+ }
+ return false;
+}
+
+bool
+check_manager::enable_checker(string name)
+{
+ auto checker = disabled_checkers.find(name);
+ if (checker != disabled_checkers.end())
+ {
+ checkers.insert(std::make_pair(name, checker->second));
+ disabled_checkers.erase(checker);
+ return true;
+ }
+ return false;
+}
+
+} // namespace checking
+
+} // namespace fdt
+
+} // namespace dtc
+
diff --git a/usr.bin/dtc/checking.hh b/usr.bin/dtc/checking.hh
new file mode 100644
index 0000000..e3b3d45
--- /dev/null
+++ b/usr.bin/dtc/checking.hh
@@ -0,0 +1,308 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _CHECKING_HH_
+#define _CHECKING_HH_
+#include "string.hh"
+#include "fdt.hh"
+
+namespace dtc
+{
+namespace fdt
+{
+namespace checking
+{
+/**
+ * Base class for all checkers. This will visit the entire tree and perform
+ * semantic checks defined in subclasses. Note that device trees are generally
+ * small (a few dozen nodes at most) and so we optimise for flexibility and
+ * extensibility here, not for performance. Each checker will visit the entire
+ * tree.
+ */
+class checker
+{
+ /**
+ * The path to the current node being checked. This is used for
+ * printing error messages.
+ */
+ device_tree::node_path path;
+ /**
+ * The name of the checker. This is used for printing error messages
+ * and for enabling / disabling specific checkers from the command
+ * line.
+ */
+ const char *checker_name;
+ /**
+ * Visits each node, calling the checker functions on properties and
+ * nodes.
+ */
+ bool visit_node(device_tree *tree, const node_ptr &n);
+ protected:
+ /**
+ * Prints the error message, along with the path to the node that
+ * caused the error and the name of the checker.
+ */
+ void report_error(const char *errmsg);
+ public:
+ /**
+ * Constructor. Takes the name of this checker, which is which is used
+ * when reporting errors.
+ */
+ checker(const char *name) : checker_name(name) {}
+ /**
+ * Virtual destructor in case any subclasses need to do cleanup.
+ */
+ virtual ~checker() {}
+ /**
+ * Method for checking that a node is valid. The root class version
+ * does nothing, subclasses should override this.
+ */
+ virtual bool check_node(device_tree *, const node_ptr &)
+ {
+ return true;
+ }
+ /**
+ * Method for checking that a property is valid. The root class
+ * version does nothing, subclasses should override this.
+ */
+ virtual bool check_property(device_tree *, const node_ptr &, property_ptr )
+ {
+ return true;
+ }
+ /**
+ * Runs the checker on the specified device tree.
+ */
+ bool check_tree(fdt::device_tree *tree)
+ {
+ return visit_node(tree, tree->get_root());
+ }
+};
+
+/**
+ * Abstract base class for simple property checks. This class defines a check
+ * method for subclasses, which is invoked only when it finds a property with
+ * the matching name. To define simple property checkers, just subclass this
+ * and override the check() method.
+ */
+class property_checker : public checker
+{
+ /**
+ * The name of the property that this checker is looking for.
+ */
+ string key;
+ public:
+ /**
+ * Implementation of the generic property-checking method that checks
+ * for a property with the name specified in the constructor
+ */
+ virtual bool check_property(device_tree *tree, const node_ptr &n, property_ptr p);
+ /**
+ * Constructor. Takes the name of the checker and the name of the
+ * property to check.
+ */
+ property_checker(const char* name, string property_name)
+ : checker(name), key(property_name) {}
+ /**
+ * The check method, which subclasses should implement.
+ */
+ virtual bool check(device_tree *tree, const node_ptr &n, property_ptr p) = 0;
+};
+
+/**
+ * Property type checker.
+ */
+template<property_value::value_type T>
+struct property_type_checker : public property_checker
+{
+ /**
+ * Constructor, takes the name of the checker and the name of the
+ * property to check as arguments.
+ */
+ property_type_checker(const char* name, string property_name) :
+ property_checker(name, property_name) {}
+ virtual bool check(device_tree *tree, const node_ptr &n, property_ptr p) = 0;
+};
+
+/**
+ * Empty property checker. This checks that the property has no value.
+ */
+template<>
+struct property_type_checker <property_value::EMPTY> : public property_checker
+{
+ property_type_checker(const char* name, string property_name) :
+ property_checker(name, property_name) {}
+ virtual bool check(device_tree *, const node_ptr &, property_ptr p)
+ {
+ return p->begin() == p->end();
+ }
+};
+
+/**
+ * String property checker. This checks that the property has exactly one
+ * value, which is a string.
+ */
+template<>
+struct property_type_checker <property_value::STRING> : public property_checker
+{
+ property_type_checker(const char* name, string property_name) :
+ property_checker(name, property_name) {}
+ virtual bool check(device_tree *, const node_ptr &, property_ptr p)
+ {
+ return (p->begin() + 1 == p->end()) && p->begin()->is_string();
+ }
+};
+/**
+ * String list property checker. This checks that the property has at least
+ * one value, all of which are strings.
+ */
+template<>
+struct property_type_checker <property_value::STRING_LIST> :
+ public property_checker
+{
+ property_type_checker(const char* name, string property_name) :
+ property_checker(name, property_name) {}
+ virtual bool check(device_tree *, const node_ptr &, property_ptr p)
+ {
+ for (property::value_iterator i=p->begin(),e=p->end() ; i!=e ;
+ ++i)
+ {
+ if (!(i->is_string() || i->is_string_list()))
+ {
+ return false;
+ }
+ }
+ return p->begin() != p->end();
+ }
+};
+
+/**
+ * Phandle property checker. This checks that the property has exactly one
+ * value, which is a valid phandle.
+ */
+template<>
+struct property_type_checker <property_value::PHANDLE> : public property_checker
+{
+ property_type_checker(const char* name, string property_name) :
+ property_checker(name, property_name) {}
+ virtual bool check(device_tree *tree, const node_ptr &, property_ptr p)
+ {
+ return (p->begin() + 1 == p->end()) &&
+ (tree->referenced_node(*p->begin()) != 0);
+ }
+};
+
+/**
+ * Check that a property has the correct size.
+ */
+struct property_size_checker : public property_checker
+{
+ /**
+ * The expected size of the property.
+ */
+ uint32_t size;
+ public:
+ /**
+ * Constructor, takes the name of the checker, the name of the property
+ * to check, and its expected size as arguments.
+ */
+ property_size_checker(const char* name, string property_name, uint32_t bytes)
+ : property_checker(name, property_name), size(bytes) {}
+ /**
+ * Check, validates that the property has the correct size.
+ */
+ virtual bool check(device_tree *tree, const node_ptr &n, property_ptr p);
+};
+
+
+/**
+ * The check manager is the interface to running the checks. This allows
+ * default checks to be enabled, non-default checks to be enabled, and so on.
+ */
+class check_manager
+{
+ /**
+ * The enabled checkers, indexed by their names. The name is used when
+ * disabling checkers from the command line. When this manager runs,
+ * it will only run the checkers from this map.
+ */
+ std::unordered_map<string, checker*> checkers;
+ /**
+ * The disabled checkers. Moving checkers to this list disables them,
+ * but allows them to be easily moved back.
+ */
+ std::unordered_map<string, checker*> disabled_checkers;
+ /**
+ * Helper function for adding a property value checker.
+ */
+ template<property_value::value_type T>
+ void add_property_type_checker(const char *name, string prop);
+ /**
+ * Helper function for adding a simple type checker.
+ */
+ void add_property_type_checker(const char *name, string prop);
+ /**
+ * Helper function for adding a property value checker.
+ */
+ void add_property_size_checker(const char *name,
+ string prop,
+ uint32_t size);
+ public:
+ /**
+ * Delete all of the checkers that are part of this checker manager.
+ */
+ ~check_manager();
+ /**
+ * Default constructor, creates check manager containing all of the
+ * default checks.
+ */
+ check_manager();
+ /**
+ * Run all of the checks on the specified tree.
+ */
+ bool run_checks(device_tree *tree, bool keep_going);
+ /**
+ * Disables the named checker.
+ */
+ bool disable_checker(string name);
+ /**
+ * Enables the named checker.
+ */
+ bool enable_checker(string name);
+};
+
+} // namespace checking
+
+} // namespace fdt
+
+} // namespace dtc
+
+#endif // !_CHECKING_HH_
diff --git a/usr.bin/dtc/dtb.cc b/usr.bin/dtc/dtb.cc
new file mode 100644
index 0000000..bbcf76d
--- /dev/null
+++ b/usr.bin/dtc/dtb.cc
@@ -0,0 +1,311 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#include "dtb.hh"
+#include <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+namespace dtc
+{
+namespace dtb
+{
+
+void output_writer::write_data(byte_buffer b)
+{
+ for (auto i : b)
+ {
+ write_data(i);
+ }
+}
+
+void
+binary_writer::write_string(string name)
+{
+ name.push_to_buffer(buffer);
+ // Trailing nul
+ buffer.push_back(0);
+}
+
+void
+binary_writer::write_data(uint8_t v)
+{
+ buffer.push_back(v);
+}
+
+void
+binary_writer::write_data(uint32_t v)
+{
+ while (buffer.size() % 4 != 0)
+ {
+ buffer.push_back(0);
+ }
+ push_big_endian(buffer, v);
+}
+
+void
+binary_writer::write_data(uint64_t v)
+{
+ while (buffer.size() % 8 != 0)
+ {
+ buffer.push_back(0);
+ }
+ push_big_endian(buffer, v);
+}
+
+void
+binary_writer::write_to_file(int fd)
+{
+ // FIXME: Check return
+ write(fd, buffer.data(), buffer.size());
+}
+
+uint32_t
+binary_writer::size()
+{
+ return buffer.size();
+}
+
+void
+asm_writer::write_string(const char *c)
+{
+ while (*c)
+ {
+ buffer.push_back((uint8_t)*(c++));
+ }
+}
+
+void
+asm_writer::write_line(const char *c)
+{
+ if (byte_count != 0)
+ {
+ byte_count = 0;
+ buffer.push_back('\n');
+ }
+ write_string(c);
+}
+
+void
+asm_writer::write_byte(uint8_t b)
+{
+ char out[3] = {0};
+ if (byte_count++ == 0)
+ {
+ buffer.push_back('\t');
+ }
+ write_string(".byte 0x");
+ snprintf(out, 3, "%.2hhx", b);
+ buffer.push_back(out[0]);
+ buffer.push_back(out[1]);
+ if (byte_count == 4)
+ {
+ buffer.push_back('\n');
+ byte_count = 0;
+ }
+ else
+ {
+ buffer.push_back(';');
+ buffer.push_back(' ');
+ }
+}
+
+void
+asm_writer::write_label(string name)
+{
+ write_line("\t.globl ");
+ name.push_to_buffer(buffer);
+ buffer.push_back('\n');
+ name.push_to_buffer(buffer);
+ buffer.push_back(':');
+ buffer.push_back('\n');
+ buffer.push_back('_');
+ name.push_to_buffer(buffer);
+ buffer.push_back(':');
+ buffer.push_back('\n');
+
+}
+
+void
+asm_writer::write_comment(string name)
+{
+ write_line("\t/* ");
+ name.push_to_buffer(buffer);
+ write_string(" */\n");
+}
+
+void
+asm_writer::write_string(string name)
+{
+ write_line("\t.string \"");
+ name.push_to_buffer(buffer);
+ write_line("\"\n");
+ bytes_written += name.size() + 1;
+}
+
+void
+asm_writer::write_data(uint8_t v)
+{
+ write_byte(v);
+ bytes_written++;
+}
+
+void
+asm_writer::write_data(uint32_t v)
+{
+ if (bytes_written % 4 != 0)
+ {
+ write_line("\t.balign 4\n");
+ bytes_written += (4 - (bytes_written % 4));
+ }
+ write_byte((v >> 24) & 0xff);
+ write_byte((v >> 16) & 0xff);
+ write_byte((v >> 8) & 0xff);
+ write_byte((v >> 0) & 0xff);
+ bytes_written += 4;
+}
+
+void
+asm_writer::write_data(uint64_t v)
+{
+ if (bytes_written % 8 != 0)
+ {
+ write_line("\t.balign 8\n");
+ bytes_written += (8 - (bytes_written % 8));
+ }
+ write_byte((v >> 56) & 0xff);
+ write_byte((v >> 48) & 0xff);
+ write_byte((v >> 40) & 0xff);
+ write_byte((v >> 32) & 0xff);
+ write_byte((v >> 24) & 0xff);
+ write_byte((v >> 16) & 0xff);
+ write_byte((v >> 8) & 0xff);
+ write_byte((v >> 0) & 0xff);
+ bytes_written += 8;
+}
+
+void
+asm_writer::write_to_file(int fd)
+{
+ // FIXME: Check return
+ write(fd, buffer.data(), buffer.size());
+}
+
+uint32_t
+asm_writer::size()
+{
+ return bytes_written;
+}
+
+void
+header::write(output_writer &out)
+{
+ out.write_label(string("dt_blob_start"));
+ out.write_label(string("dt_header"));
+ out.write_comment("magic");
+ out.write_data(magic);
+ out.write_comment("totalsize");
+ out.write_data(totalsize);
+ out.write_comment("off_dt_struct");
+ out.write_data(off_dt_struct);
+ out.write_comment("off_dt_strings");
+ out.write_data(off_dt_strings);
+ out.write_comment("off_mem_rsvmap");
+ out.write_data(off_mem_rsvmap);
+ out.write_comment("version");
+ out.write_data(version);
+ out.write_comment("last_comp_version");
+ out.write_data(last_comp_version);
+ out.write_comment("boot_cpuid_phys");
+ out.write_data(boot_cpuid_phys);
+ out.write_comment("size_dt_strings");
+ out.write_data(size_dt_strings);
+ out.write_comment("size_dt_struct");
+ out.write_data(size_dt_struct);
+}
+
+bool
+header::read_dtb(input_buffer &input)
+{
+ if (!(input.consume_binary(magic) && magic == 0xd00dfeed))
+ {
+ fprintf(stderr, "Missing magic token in header. Got %" PRIx32
+ " expected 0xd00dfeed\n", magic);
+ return false;
+ }
+ return input.consume_binary(totalsize) &&
+ input.consume_binary(off_dt_struct) &&
+ input.consume_binary(off_dt_strings) &&
+ input.consume_binary(off_mem_rsvmap) &&
+ input.consume_binary(version) &&
+ input.consume_binary(last_comp_version) &&
+ input.consume_binary(boot_cpuid_phys) &&
+ input.consume_binary(size_dt_strings) &&
+ input.consume_binary(size_dt_struct);
+}
+uint32_t
+string_table::add_string(string str)
+{
+ auto old = string_offsets.find(str);
+ if (old == string_offsets.end())
+ {
+ uint32_t start = size;
+ // Don't forget the trailing nul
+ size += str.size() + 1;
+ string_offsets.insert(std::make_pair(str, start));
+ strings.push_back(str);
+ return start;
+ }
+ else
+ {
+ return old->second;
+ }
+}
+
+void
+string_table::write(dtb::output_writer &writer)
+{
+ writer.write_comment(string("Strings table."));
+ writer.write_label(string("dt_strings_start"));
+ for (auto &i : strings)
+ {
+ writer.write_string(i);
+ }
+ writer.write_label(string("dt_strings_end"));
+}
+
+} // namespace dtb
+
+} // namespace dtc
+
diff --git a/usr.bin/dtc/dtb.hh b/usr.bin/dtc/dtb.hh
new file mode 100644
index 0000000..184369b
--- /dev/null
+++ b/usr.bin/dtc/dtb.hh
@@ -0,0 +1,365 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _DTB_HH_
+#define _DTB_HH_
+#include <map>
+#include "string.hh"
+
+#include <assert.h>
+
+namespace dtc
+{
+/**
+ * The dtb namespace contains code related to the generation of device tree
+ * blobs, the binary representation of flattened device trees. The abstract
+ * tree representation calls into this code to generate the output.
+ */
+namespace dtb
+{
+/** The token types in the DTB, as defined by §7.4.1 of the ePAPR
+ * specification. All of these values are written in big-endian format in the
+ * output.
+ */
+enum token_type
+{
+ /**
+ * Marker indicating the start of a node in the tree. This is followed
+ * by the nul-terminated name. If a unit address is specified, then
+ * the name also contains the address, with an @ symbol between the end
+ * of the name and the start of the address.
+ *
+ * The name is then padded such that the next token begins on a 4-byte
+ * boundary. The node may contain properties, other nodes, both, or be
+ * empty.
+ */
+ FDT_BEGIN_NODE = 0x00000001,
+ /**
+ * Marker indicating the end of a node.
+ */
+ FDT_END_NODE = 0x00000002,
+ /**
+ * The start of a property. This is followed by two 32-bit big-endian
+ * values. The first indicates the length of the property value, the
+ * second its index in the strings table. It is then followed by the
+ * property value, if the value is of non-zero length.
+ */
+ FDT_PROP = 0x00000003,
+ /**
+ * Ignored token. May be used for padding inside DTB nodes.
+ */
+ FDT_NOP = 0x00000004,
+ /**
+ * Marker indicating the end of the tree.
+ */
+ FDT_END = 0x00000009
+};
+
+/**
+ * Returns the token as a string. This is used for debugging and for printing
+ * human-friendly error messages about malformed DTB input.
+ */
+inline const char *token_type_name(token_type t)
+{
+ switch(t)
+ {
+ case FDT_BEGIN_NODE:
+ return "FDT_BEGIN_NODE";
+ case FDT_END_NODE:
+ return "FDT_END_NODE";
+ case FDT_PROP:
+ return "FDT_PROP";
+ case FDT_NOP:
+ return "FDT_NOP";
+ case FDT_END:
+ return "FDT_END";
+ }
+ assert(0);
+}
+
+/**
+ * Abstract class for writing a section of the output. We create one
+ * of these for each section that needs to be written. It is intended to build
+ * a temporary buffer of the output in memory and then write it to a file
+ * stream. The size can be returned after all of the data has been written
+ * into the internal buffer, so the sizes of the three tables can be calculated
+ * before storing them in the buffer.
+ */
+struct output_writer
+{
+ /**
+ * Writes a label into the output stream. This is only applicable for
+ * assembly output, where the labels become symbols that can be
+ * resolved at link time.
+ */
+ virtual void write_label(string name) = 0;
+ /**
+ * Writes a comment into the output stream. Useful only when debugging
+ * the output.
+ */
+ virtual void write_comment(string name) = 0;
+ /**
+ * Writes a string. A nul terminator is implicitly added.
+ */
+ virtual void write_string(string name) = 0;
+ /**
+ * Writes a single 8-bit value.
+ */
+ virtual void write_data(uint8_t) = 0;
+ /**
+ * Writes a single 32-bit value. The value is written in big-endian
+ * format, but should be passed in the host's native endian.
+ */
+ virtual void write_data(uint32_t) = 0;
+ /**
+ * Writes a single 64-bit value. The value is written in big-endian
+ * format, but should be passed in the host's native endian.
+ */
+ virtual void write_data(uint64_t) = 0;
+ /**
+ * Writes the collected output to the specified file descriptor.
+ */
+ virtual void write_to_file(int fd) = 0;
+ /**
+ * Returns the number of bytes.
+ */
+ virtual uint32_t size() = 0;
+ /**
+ * Helper for writing tokens to the output stream. This writes a
+ * comment above the token describing its value, for easier debugging
+ * of the output.
+ */
+ inline void write_token(token_type t)
+ {
+ write_comment(token_type_name(t));
+ write_data((uint32_t)t);
+ }
+ /**
+ * Helper function that writes a byte buffer to the output, one byte at
+ * a time.
+ */
+ void write_data(byte_buffer b);
+};
+
+/**
+ * Binary file writer. This class is responsible for writing the DTB output
+ * directly in blob format.
+ */
+class binary_writer : public output_writer
+{
+ /**
+ * The internal buffer used to store the blob while it is being
+ * constructed.
+ */
+ byte_buffer buffer;
+ public:
+ /**
+ * The binary format does not support labels, so this method
+ * does nothing.
+ */
+ virtual void write_label(string) {}
+ /**
+ * Comments are ignored by the binary writer.
+ */
+ virtual void write_comment(string) {}
+ virtual void write_string(string name);
+ virtual void write_data(uint8_t v);
+ virtual void write_data(uint32_t v);
+ virtual void write_data(uint64_t v);
+ virtual void write_to_file(int fd);
+ virtual uint32_t size();
+};
+/**
+ * Assembly writer. This class is responsible for writing the output in an
+ * assembly format that is suitable for linking into a kernel, loader, and so
+ * on.
+ */
+class asm_writer : public output_writer
+{
+ /**
+ * The internal buffer for temporary values. Note that this actually
+ * contains ASCII text, but it is a byte buffer so that we can just
+ * copy strings across as-is.
+ */
+ byte_buffer buffer;
+ /**
+ * The number of bytes written to the current line. This is used to
+ * allow line wrapping, where we aim to write four .byte directives to
+ * make the alignment clearer.
+ */
+ int byte_count;
+ /**
+ * The current number of bytes written. This is the number in binary
+ * format, not the number of bytes in the buffer.
+ */
+ uint32_t bytes_written;
+
+ /**
+ * Writes a C string directly to the output as-is. This is mainly used
+ * for writing directives.
+ */
+ void write_string(const char *c);
+ /**
+ * Writes the string, starting on a new line.
+ */
+ void write_line(const char *c);
+ /**
+ * Writes a byte in binary format. This will emit a single .byte
+ * directive, with up to four per line.
+ */
+ void write_byte(uint8_t b);
+ public:
+ asm_writer() : byte_count(0), bytes_written(0) {}
+ virtual void write_label(string name);
+ virtual void write_comment(string name);
+ virtual void write_string(string name);
+ virtual void write_data(uint8_t v);
+ virtual void write_data(uint32_t v);
+ virtual void write_data(uint64_t v);
+ virtual void write_to_file(int fd);
+ virtual uint32_t size();
+};
+
+/**
+ * Class encapsulating the device tree blob header. This class stores all of
+ * the values found in the header and is responsible for writing them to the
+ * output.
+ */
+struct header
+{
+ /**
+ * Magic value, used to validate that this really is a device tree
+ * blob. Should always be set to 0xd00dfeed.
+ */
+ uint32_t magic;
+ /**
+ * The total size of the blob, including header, reservations, strings
+ * table, and padding.
+ */
+ uint32_t totalsize;
+ /**
+ * The offset from the start of the blob of the struct table (i.e. the
+ * part of the blob containing the entire device tree).
+ */
+ uint32_t off_dt_struct;
+ /**
+ * The offset from the start of the blob of the strings table.
+ */
+ uint32_t off_dt_strings;
+ /**
+ * The offset of the reservation map from the start of the blob.
+ */
+ uint32_t off_mem_rsvmap;
+ /**
+ * The version of the blob. This should always be 17.
+ */
+ uint32_t version;
+ /**
+ * The earliest version of the DTB specification with which this blob
+ * is backwards compatible. This should always be 16.
+ */
+ uint32_t last_comp_version;
+ /**
+ * The ID of the CPU where this boots.
+ */
+ uint32_t boot_cpuid_phys;
+ /**
+ * The size of the strings table.
+ */
+ uint32_t size_dt_strings;
+ /**
+ * The size of the struct table.
+ */
+ uint32_t size_dt_struct;
+ /**
+ * Writes the entire header to the specified output buffer.
+ */
+ void write(output_writer &out);
+ /**
+ * Reads the header from bits binary representation in a blob.
+ */
+ bool read_dtb(input_buffer &input);
+ /**
+ * Default constructor. Initialises the values that have sensible
+ * defaults, leaves the others blank.
+ */
+ header() : magic(0xd00dfeed), version(17), last_comp_version(16),
+ boot_cpuid_phys(0) {}
+};
+
+/**
+ * Class encapsulating the string table. FDT strings are stored in a string
+ * section. This maintains a map from strings to their offsets in the strings
+ * section.
+ *
+ * Note: We don't currently do suffix matching, which may save a small amount
+ * of space.
+ */
+class string_table {
+ /**
+ * Map from strings to their offset.
+ */
+ std::map<string, uint32_t> string_offsets;
+ /**
+ * The strings, in the order in which they should be written to the
+ * output. The order must be stable - adding another string must not
+ * change the offset of any that we have already referenced - and so we
+ * simply write the strings in the order that they are passed.
+ */
+ std::vector<string> strings;
+ /**
+ * The current size of the strings section.
+ */
+ uint32_t size;
+ public:
+ /**
+ * Default constructor, creates an empty strings table.
+ */
+ string_table() : size(0) {}
+ /**
+ * Adds a string to the table, returning the offset from the start
+ * where it will be written. If the string is already present, this
+ * will return its existing offset, otherwise it will return a new
+ * offset.
+ */
+ uint32_t add_string(string str);
+ /**
+ * Writes the strings table to the specified output.
+ */
+ void write(dtb::output_writer &writer);
+};
+
+} // namespace dtb
+
+} // namespace dtc
+
+#endif // !_DTB_HH_
diff --git a/usr.bin/dtc/dtc.1 b/usr.bin/dtc/dtc.1
new file mode 100644
index 0000000..afb94f7
--- /dev/null
+++ b/usr.bin/dtc/dtc.1
@@ -0,0 +1,332 @@
+.\"-
+.\" Copyright (c) 2013 David Chisnall
+.\" All rights reserved.
+.\"
+.\" This software was developed by SRI International and the University of
+.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+.\" ("CTSRD"), as part of the DARPA CRASH research programme.
+.\"
+.\" This software was developed by SRI International and the University of
+.\" 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 January 1, 2013
+.Dt DTC 1
+.Os
+.Sh NAME
+.Nm dtc
+.Nd device tree compiler
+.Sh SYNOPSIS
+.Nm
+.Op Fl fhsv
+.Op Fl b Ar boot_cpu_id
+.Op Fl d Ar dependency_file
+.Op Fl E Ar [no-]checker_name
+.Op Fl H Ar phandle_format
+.Op Fl I Ar input_format
+.Op Fl O Ar output_format
+.Op Fl o Ar output_file
+.Op Fl R Ar entries
+.Op Fl S Ar bytes
+.Op Fl p Ar bytes
+.Op Fl V Ar blob_version
+.Op Fl W Ar [no-]checker_name
+.Op Fl P Ar predefined_properties
+.Ar input_file
+.Sh DESCRIPTION
+The
+.Nm
+utility converts flattened device tree (FDT) representations.
+ It is most commonly used to generate device tree blobs (DTB), the binary
+representation of an FDT, from device tree sources (DTS), the ASCII text source
+representation.
+.Pp
+The binary can be written in two formats, binary and assembly.
+The binary is identical to the in-memory representation and can be used
+directly by firmware, loaders, and so on.
+The assembly format, documented in
+.Sx "ASM FORMAT" ,
+will produce the same binary format when assembled, but also includes some
+global variables that refer to parts of the table.
+This format is most commonly used to produce a kernel specific to a device,
+with the device tree blob compiled in.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar dependency_file
+Writes a dependency file understandable by make to the specified file.
+This file can be included in a Makefile and will ensure that the output file
+depends on the input file and any files that it includes.
+This argument is only useful when the input is DTS, as only the source format
+has a notion of inclusions.
+.It Fl E Ar [no-]checker_name
+Enable or disable a specified checker.
+The argument is the name of the checker.
+The full list of checkers is given in
+.Sx CHECKERS .
+.It Fl f
+Force the tool to attempt to generate the output, even if the input had errors.
+.It Fl h
+Display the help text and exit.
+.It Fl H Ar phandle_format
+Specifies the type of phandle nodes to generate in the output.
+Valid values are:
+.Pp
+.Bl -tag -width indent -compact
+.It Ar linux
+Generate the legacy linux,phandle nodes expected by older systems.
+.It Ar epapr
+Generate the phandle nodes, as described in the ePAPR specification.
+This is the most sensible option for device trees being used with
+.Fx .
+.It Ar both
+Generate both, for maximum compatibility.
+.El
+.It Fl I Ar input_format
+Specifies the input format.
+Valid values are:
+.Pp
+.Bl -tag -width indent -compact
+.It Ar dtb
+Device tree blob.
+The binary representation of the FDT.
+.It Ar dts
+Device tree source.
+The ASCII representation of the FDT.
+This is the default if the input format is not explicitly stated.
+.El
+.It Fl O Ar output_format
+Specifies the output format.
+Valid values are:
+.Pp
+.Bl -tag -width indent -compact
+.It Ar asm
+Assembler source for generating a device tree blob, as described in
+.Sx "ASM FORMAT" .
+.It Ar dtb
+Device tree blob.
+The binary representation of the FDT.
+This is the default if the output format is not explicitly stated.
+.It Ar dts
+Device tree source.
+The ASCII representation of the FDT.
+.El
+.It Fl o Ar output_file
+The file to which to write the output.
+.It Fl P Ar predefined_macro
+Defines a macro, in the form
+.Ar name=value
+or
+.Ar name
+to be used for device tree source files that contain conditional components.
+This tool supports two extensions to the standard to support conditional
+compilation of device trees.
+The first is an
+.Ar /include/if [property]/ "file.dts"
+directive that is allowed at the start of a file and which will only include
+the specified file if it the specified property is passed with this flag.
+The second is the
+.Ar $NAME
+format for property values.
+These allow property value to be specified on the command line.
+.It Fl R Ar entries
+The number of empty reservation table entries to pad the table with.
+This is
+useful if you are generating a device tree blob for bootloader or similar that
+needs to reserve some memory before passing control to the operating system.
+.It Fl S Ar bytes
+The minimum size in bytes of the blob.
+The blob will be padded after the strings table to ensure that it is the
+correct size.
+This is useful for environments where the device tree blob must be modified in
+place.
+.It Fl p Ar bytes
+The number of bytes of padding to add to the blob.
+The blob will be padded after the strings table to ensure that it is the
+correct size.
+This is useful for environments where the device tree blob must be modified in
+place.
+.It Fl W Ar [no-]checker_name
+Enable or disable a specified checker.
+This is an alias for
+.Fl E .
+.It Fl s
+Sorts the properties and nodes in the tree.
+This is mainly useful when using tools like
+.Xr diff 1
+to compare two device tree sources.
+.It Fl V Ar output_version
+The version of the format to output.
+This is only relevant for binary outputs, and only a value of 17 is currently
+supported.
+.It Fl v
+Display the tool version and exit.
+.It Ar input_file
+The source file.
+.El
+.Sh "ASM FORMAT"
+The assembly format defines several globals that can be referred to from other
+compilation units, in addition to any labels specified in the source.
+These are:
+.Pp
+.Bl -tag -width "dt_strings_start" -compact -offset indent
+.It dt_blob_start
+start of the device tree blob.
+.It dt_header
+start of the header, usually identical to the start of the blob.
+.It dt_reserve_map
+start of the reservation map.
+.It dt_struct_start
+start of the structure table.
+.It dt_struct_end
+end of the structure table.
+.It dt_strings_start
+start of the strings table.
+.It dt_strings_end
+end of the strings table.
+.It dt_blob_end
+end of the device tree blob.
+.El
+.Sh CHECKERS
+The utility provides a number of semantic checks on the correctness of the
+tree.
+These can be disabled with the
+.Fl W
+flag.
+For example,
+.Fl W Ar no-type-phandle
+will disable the phandle type check.
+The supported checks are:
+.Pp
+.Bl -tag -width "no-type-phandle" -compact -offset indent
+.It type-compatible
+Checks the type of the
+.Va compatible
+property.
+.It type-model
+Checks the type of the
+.Va model
+property.
+.It type-compatible
+Checks the type of the
+.Va compatible
+property.
+.It cells-attributes
+Checks that all nodes with children have both
+.Va #address-cells
+and
+.Va #size-cells
+properties.
+.El
+.Sh EXAMPLES
+The command:
+.Pp
+.Dl "dtc -o blob.S -O asm device.dts"
+.Pp
+will generate a
+.Pa blob.S
+file from the device tree source
+.Pa device.dts
+and print errors if any occur during parsing or property checking.
+The
+resulting file can be assembled and linked into a binary.
+.Pp
+The command:
+.Pp
+.Dl "dtc -o - -O dts -I dtb device.dtb"
+.Pp
+will write the device tree source for the device tree blob
+.Pa device.dtb
+to the standard output.
+This is useful when debugging device trees.
+.Sh COMPATIBILITY
+This utility is intended to be compatible with the device tree compiler
+provided by elinux.org.
+Currently, it implements the subset of features
+required to build FreeBSD and others that have been requested by FreeBSD
+developers.
+.Pp
+The
+.Ar fs
+input format is not supported.
+This builds a tree from a Linux
+.Pa /proc/device-tree ,
+a file system hierarchy not found in FreeBSD, which instead exposes the DTB
+directly via a sysctl.
+.Pp
+The warnings and errors supported by the elinux.org tool are not documented.
+This tool supports the warnings described in the
+.Sx CHECKERS
+section.
+.Sh SEE ALSO
+.Xr fdt 4
+.Sh STANDARDS
+The device tree formats understood by this tool conform to the Power.org
+Standard for Embedded Power Architecture Platform Requirements
+.Pq Vt ePAPR ,
+except as noted in the
+.Sx BUGS
+section and with the following exceptions for compatibility with the elinux.org
+tool:
+.Pp
+.Bl -bullet -compact
+.It
+The target of cross references is defined to be a node name in the
+specification, but is in fact a label.
+.El
+.Pp
+The /include/ directive is not part of the standard, however it is implemented
+with the semantics compatible with the elinux.org tool.
+It must appear in the top level of a file, and imports a new root definition.
+If a file, plus all of its inclusions, contains multiple roots then they are
+merged.
+All nodes that are present in the second but not the first are imported.
+Any that appear in both are recursively merged, with properties from the second
+replacing those from the first and properties child nodes being recursively
+merged.
+.Sh HISTORY
+A dtc tool first appeared in
+.Fx 9.0 .
+This version of the tool first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An David T. Chisnall
+.Pp
+Note: The fact that the tool and the author share the same initials is entirely
+coincidental.
+.Sh BUGS
+The device tree compiler does not yet support the following features:
+.Pp
+.Bl -bullet -compact
+.It
+Labels in the middle of property values.
+This is only useful in the assembly output, and only vaguely useful there, so
+is unlikely to be added soon.
+.It
+Full paths, rather than labels, as the targets for phandles.
+This is not very hard to add, but will probably not be added until something
+actually needs it.
+.El
+.Pp
+The current version performs a very limited set of semantic checks on the tree.
+This will be improved in future versions.
diff --git a/usr.bin/dtc/dtc.cc b/usr.bin/dtc/dtc.cc
new file mode 100644
index 0000000..269c90e
--- /dev/null
+++ b/usr.bin/dtc/dtc.cc
@@ -0,0 +1,344 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#include "fdt.hh"
+#include "checking.hh"
+
+using namespace dtc;
+
+/**
+ * The current major version of the tool.
+ */
+int version_major = 0;
+/**
+ * The current minor version of the tool.
+ */
+int version_minor = 4;
+/**
+ * The current patch level of the tool.
+ */
+int version_patch = 0;
+
+static void usage(const char* argv0)
+{
+ fprintf(stderr, "Usage:\n"
+ "\t%s\t[-fhsv] [-b boot_cpu_id] [-d dependency_file]"
+ "[-E [no-]checker_name]\n"
+ "\t\t[-H phandle_format] [-I input_format]"
+ "[-O output_format]\n"
+ "\t\t[-o output_file] [-R entries] [-S bytes] [-p bytes]"
+ "[-V blob_version]\n"
+ "\t\t-W [no-]checker_name] input_file\n", basename((char*)argv0));
+}
+
+/**
+ * Prints the current version of this program..
+ */
+static void version(const char* progname)
+{
+ fprintf(stderr, "Version: %s %d.%d.%d\n", progname, version_major,
+ version_minor, version_patch);
+}
+
+using fdt::device_tree;
+
+int
+main(int argc, char **argv)
+{
+ int ch;
+ int outfile = fileno(stdout);
+ const char *outfile_name = "-";
+ const char *in_file = "-";
+ FILE *depfile = 0;
+ bool debug_mode = false;
+ void (device_tree::*write_fn)(int) = &device_tree::write_binary;
+ void (device_tree::*read_fn)(const char*, FILE*) =
+ &device_tree::parse_dts;
+ uint32_t boot_cpu;
+ bool boot_cpu_specified = false;
+ bool keep_going = false;
+ bool sort = false;
+ 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: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)
+ {
+ switch (ch)
+ {
+ case 'h':
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ case 'v':
+ version(argv[0]);
+ return EXIT_SUCCESS;
+ case 'I':
+ {
+ string arg = string(optarg);
+ if (arg == string("dtb"))
+ {
+ read_fn = &device_tree::parse_dtb;
+ }
+ else if (arg == string("dts"))
+ {
+ read_fn = &device_tree::parse_dts;
+ }
+ else
+ {
+ fprintf(stderr, "Unknown input format: %s\n", optarg);
+ return EXIT_FAILURE;
+ }
+ break;
+ }
+ case 'O':
+ {
+ string arg = string(optarg);
+ if (arg == string("dtb"))
+ {
+ write_fn = &device_tree::write_binary;
+ }
+ else if (arg == string("asm"))
+ {
+ write_fn = &device_tree::write_asm;
+ }
+ else if (arg == string("dts"))
+ {
+ write_fn = &device_tree::write_dts;
+ }
+ else
+ {
+ fprintf(stderr, "Unknown output format: %s\n", optarg);
+ return EXIT_FAILURE;
+ }
+ break;
+ }
+ case 'o':
+ {
+ outfile_name = optarg;
+ outfile = open(optarg, O_CREAT | O_TRUNC | O_WRONLY, 0666);
+ if (outfile == -1)
+ {
+ perror("Unable to open output file");
+ return EXIT_FAILURE;
+ }
+ break;
+ }
+ case 'D':
+ debug_mode = true;
+ break;
+ case 'V':
+ if (string(optarg) != string("17"))
+ {
+ fprintf(stderr, "Unknown output format version: %s\n", optarg);
+ return EXIT_FAILURE;
+ }
+ break;
+ case 'd':
+ {
+ if (depfile != 0)
+ {
+ fclose(depfile);
+ }
+ if (string(optarg) == string("-"))
+ {
+ depfile = stdout;
+ }
+ else
+ {
+ depfile = fdopen(open(optarg, O_CREAT | O_TRUNC | O_WRONLY, 0666), "w");
+ if (depfile == 0)
+ {
+ perror("Unable to open dependency file");
+ return EXIT_FAILURE;
+ }
+ }
+ break;
+ }
+ case 'H':
+ {
+ string arg = string(optarg);
+ if (arg == string("both"))
+ {
+ tree.set_phandle_format(device_tree::BOTH);
+ }
+ else if (arg == string("epapr"))
+ {
+ tree.set_phandle_format(device_tree::EPAPR);
+ }
+ else if (arg == string("linux"))
+ {
+ tree.set_phandle_format(device_tree::LINUX);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown phandle format: %s\n", optarg);
+ return EXIT_FAILURE;
+ }
+ break;
+ }
+ case 'b':
+ // Don't bother to check if strtoll fails, just
+ // use the 0 it returns.
+ boot_cpu = (uint32_t)strtoll(optarg, 0, 10);
+ boot_cpu_specified = true;
+ break;
+ case 'f':
+ keep_going = true;
+ break;
+ case 'W':
+ case 'E':
+ {
+ string arg = string(optarg);
+ if ((arg.size() > 3) && (strncmp(optarg, "no-", 3) == 0))
+ {
+ arg = string(optarg+3);
+ if (!checks.disable_checker(arg))
+ {
+ fprintf(stderr, "Checker %s either does not exist or is already disabled\n", optarg+3);
+ }
+ break;
+ }
+ if (!checks.enable_checker(arg))
+ {
+ fprintf(stderr, "Checker %s either does not exist or is already enabled\n", optarg);
+ }
+ break;
+ }
+ case 's':
+ {
+ sort = true;
+ break;
+ }
+ case 'i':
+ {
+ tree.add_include_path(optarg);
+ break;
+ }
+ // Should quiet warnings, but for now is silently ignored.
+ case 'q':
+ break;
+ case 'R':
+ tree.set_empty_reserve_map_entries(strtoll(optarg, 0, 10));
+ break;
+ case 'S':
+ tree.set_blob_minimum_size(strtoll(optarg, 0, 10));
+ break;
+ case 'p':
+ tree.set_blob_padding(strtoll(optarg, 0, 10));
+ break;
+ case 'P':
+ if (!tree.parse_define(optarg))
+ {
+ fprintf(stderr, "Invalid predefine value %s\n",
+ optarg);
+ }
+ break;
+ default:
+ fprintf(stderr, "Unknown option %c\n", ch);
+ return EXIT_FAILURE;
+ }
+ }
+ if (optind < argc)
+ {
+ in_file = argv[optind];
+ }
+ if (depfile != 0)
+ {
+ fputs(outfile_name, depfile);
+ fputs(": ", depfile);
+ fputs(in_file, depfile);
+ }
+ clock_t c1 = clock();
+ (tree.*read_fn)(in_file, depfile);
+ // Override the boot CPU found in the header, if we're loading from dtb
+ if (boot_cpu_specified)
+ {
+ tree.set_boot_cpu(boot_cpu);
+ }
+ if (sort)
+ {
+ tree.sort();
+ }
+ if (depfile != 0)
+ {
+ putc('\n', depfile);
+ fclose(depfile);
+ }
+ if (!(tree.is_valid() || keep_going))
+ {
+ fprintf(stderr, "Failed to parse tree. Unhappy face!\n");
+ return EXIT_FAILURE;
+ }
+ clock_t c2 = clock();
+ if (!(checks.run_checks(&tree, true) || keep_going))
+ {
+ return EXIT_FAILURE;
+ }
+ clock_t c3 = clock();
+ (tree.*write_fn)(outfile);
+ close(outfile);
+ clock_t c4 = clock();
+
+ if (debug_mode)
+ {
+ struct rusage r;
+
+ getrusage(RUSAGE_SELF, &r);
+ fprintf(stderr, "Peak memory usage: %ld bytes\n", r.ru_maxrss);
+ fprintf(stderr, "Setup and option parsing took %f seconds\n",
+ ((double)(c1-c0))/CLOCKS_PER_SEC);
+ fprintf(stderr, "Parsing took %f seconds\n",
+ ((double)(c2-c1))/CLOCKS_PER_SEC);
+ fprintf(stderr, "Checking took %f seconds\n",
+ ((double)(c3-c2))/CLOCKS_PER_SEC);
+ fprintf(stderr, "Generating output took %f seconds\n",
+ ((double)(c4-c3))/CLOCKS_PER_SEC);
+ fprintf(stderr, "Total time: %f seconds\n",
+ ((double)(c4-c0))/CLOCKS_PER_SEC);
+ // This is not needed, but keeps valgrind quiet.
+ fclose(stdin);
+ }
+ return EXIT_SUCCESS;
+}
+
diff --git a/usr.bin/dtc/fdt.cc b/usr.bin/dtc/fdt.cc
new file mode 100644
index 0000000..23476ae
--- /dev/null
+++ b/usr.bin/dtc/fdt.cc
@@ -0,0 +1,1616 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#define __STDC_LIMIT_MACROS 1
+
+#include "fdt.hh"
+#include "dtb.hh"
+
+#include <algorithm>
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+namespace dtc
+{
+
+namespace fdt
+{
+
+uint32_t
+property_value::get_as_uint32()
+{
+ if (byte_data.size() != 4)
+ {
+ return 0;
+ }
+ uint32_t v = 0;
+ v &= byte_data[0] << 24;
+ v &= byte_data[1] << 16;
+ v &= byte_data[2] << 8;
+ v &= byte_data[3] << 0;
+ return v;
+}
+
+void
+property_value::push_to_buffer(byte_buffer &buffer)
+{
+ if (!byte_data.empty())
+ {
+ buffer.insert(buffer.end(), byte_data.begin(), byte_data.end());
+ }
+ else
+ {
+ string_data.push_to_buffer(buffer, true);
+ // Trailing nul
+ buffer.push_back(0);
+ }
+}
+
+void
+property_value::write_dts(FILE *file)
+{
+ resolve_type();
+ switch (type)
+ {
+ default:
+ assert(0 && "Invalid type");
+ case STRING:
+ case STRING_LIST:
+ case CROSS_REFERENCE:
+ write_as_string(file);
+ break;
+ case PHANDLE:
+ write_as_cells(file);
+ break;
+ case BINARY:
+ if (byte_data.size() % 4 == 0)
+ {
+ write_as_cells(file);
+ break;
+ }
+ write_as_bytes(file);
+ break;
+ }
+}
+
+void
+property_value::resolve_type()
+{
+ if (type != UNKNOWN)
+ {
+ return;
+ }
+ if (byte_data.empty())
+ {
+ type = STRING;
+ return;
+ }
+ if (byte_data.back() == 0)
+ {
+ bool is_all_printable = true;
+ int nuls = 0;
+ int bytes = 0;
+ bool lastWasNull = false;
+ for (auto i : byte_data)
+ {
+ bytes++;
+ is_all_printable &= (i == '\0') || isprint(i);
+ if (i == '\0')
+ {
+ // If there are two nulls in a row, then we're probably binary.
+ if (lastWasNull)
+ {
+ type = BINARY;
+ return;
+ }
+ nuls++;
+ lastWasNull = true;
+ }
+ else
+ {
+ lastWasNull = false;
+ }
+ if (!is_all_printable)
+ {
+ break;
+ }
+ }
+ if ((is_all_printable && (bytes > nuls)) || bytes == 0)
+ {
+ type = STRING;
+ if (nuls > 1)
+ {
+ type = STRING_LIST;
+ }
+ return;
+ }
+ }
+ type = BINARY;
+}
+
+void
+property_value::write_as_string(FILE *file)
+{
+ putc('"', file);
+ if (byte_data.empty())
+ {
+ string_data.print(file);
+ }
+ else
+ {
+ bool hasNull = (byte_data.back() == '\0');
+ // Remove trailing null bytes from the string before printing as dts.
+ if (hasNull)
+ {
+ byte_data.pop_back();
+ }
+ for (auto i : byte_data)
+ {
+ // FIXME Escape tabs, newlines, and so on.
+ if (i == '\0')
+ {
+ fputs("\", \"", file);
+ continue;
+ }
+ putc(i, file);
+ }
+ if (hasNull)
+ {
+ byte_data.push_back('\0');
+ }
+ }
+ putc('"', file);
+}
+
+void
+property_value::write_as_cells(FILE *file)
+{
+ putc('<', file);
+ assert((byte_data.size() % 4) == 0);
+ for (auto i=byte_data.begin(), e=byte_data.end(); i!=e ; ++i)
+ {
+ uint32_t v = 0;
+ v = (v << 8) | *i;
+ ++i;
+ v = (v << 8) | *i;
+ ++i;
+ v = (v << 8) | *i;
+ ++i;
+ v = (v << 8) | *i;
+ fprintf(file, "0x%" PRIx32, v);
+ if (i+1 != e)
+ {
+ putc(' ', file);
+ }
+ }
+ putc('>', file);
+}
+
+void
+property_value::write_as_bytes(FILE *file)
+{
+ putc('[', file);
+ for (auto i=byte_data.begin(), e=byte_data.end(); i!=e ; i++)
+ {
+ fprintf(file, "%02hhx", *i);
+ if (i+1 != e)
+ {
+ putc(' ', file);
+ }
+ }
+ putc(']', file);
+}
+
+void
+property::parse_string(input_buffer &input)
+{
+ property_value v;
+ assert(input[0] == '"');
+ ++input;
+ const char *start = (const char*)input;
+ int length = 0;
+ while (char c = input[0])
+ {
+ if (c == '"' && input[-1] != '\\')
+ {
+ input.consume('"');
+ break;
+ }
+ ++input;
+ ++length;
+ }
+ v.string_data = string(start, length);
+ values.push_back(v);
+}
+
+void
+property::parse_cells(input_buffer &input, int cell_size)
+{
+ assert(input[0] == '<');
+ ++input;
+ property_value v;
+ input.next_token();
+ while (!input.consume('>'))
+ {
+ input.next_token();
+ // If this is a phandle then we need to get the name of the
+ // referenced node
+ if (input.consume('&'))
+ {
+ if (cell_size != 32)
+ {
+ input.parse_error("reference only permitted in 32-bit arrays");
+ valid = false;
+ return;
+ }
+ input.next_token();
+ // FIXME: We should support full paths here, but we
+ // don't.
+ string referenced = string::parse_node_name(input);
+ if (referenced.empty())
+ {
+ input.parse_error("Expected node name");
+ valid = false;
+ return;
+ }
+ input.next_token();
+ // If we already have some bytes, make the phandle a
+ // separate component.
+ if (!v.byte_data.empty())
+ {
+ values.push_back(v);
+ v = property_value();
+ }
+ v.string_data = referenced;
+ v.type = property_value::PHANDLE;
+ values.push_back(v);
+ v = property_value();
+ }
+ else
+ {
+ //FIXME: We should support labels in the middle
+ //of these, but we don't.
+ unsigned long long val;
+ if (!input.consume_integer_expression(val))
+ {
+ input.parse_error("Expected numbers in array of cells");
+ valid = false;
+ return;
+ }
+ switch (cell_size)
+ {
+ case 8:
+ v.byte_data.push_back(val);
+ break;
+ case 16:
+ push_big_endian(v.byte_data, (uint16_t)val);
+ break;
+ case 32:
+ push_big_endian(v.byte_data, (uint32_t)val);
+ break;
+ case 64:
+ push_big_endian(v.byte_data, (uint64_t)val);
+ break;
+ default:
+ assert(0 && "Invalid cell size!");
+ }
+ input.next_token();
+ }
+ }
+ // Don't store an empty string value here.
+ if (v.byte_data.size() > 0)
+ {
+ values.push_back(v);
+ }
+}
+
+void
+property::parse_bytes(input_buffer &input)
+{
+ assert(input[0] == '[');
+ ++input;
+ property_value v;
+ input.next_token();
+ while (!input.consume(']'))
+ {
+ {
+ //FIXME: We should support
+ //labels in the middle of
+ //these, but we don't.
+ uint8_t val;
+ if (!input.consume_hex_byte(val))
+ {
+ input.parse_error("Expected hex bytes in array of bytes");
+ valid = false;
+ return;
+ }
+ v.byte_data.push_back(val);
+ input.next_token();
+ }
+ }
+ values.push_back(v);
+}
+
+void
+property::parse_reference(input_buffer &input)
+{
+ assert(input[0] == '&');
+ ++input;
+ input.next_token();
+ property_value v;
+ v.string_data = string::parse_node_name(input);
+ if (v.string_data.empty())
+ {
+ input.parse_error("Expected node name");
+ valid = false;
+ return;
+ }
+ v.type = property_value::CROSS_REFERENCE;
+ values.push_back(v);
+}
+
+property::property(input_buffer &structs, input_buffer &strings)
+{
+ uint32_t name_offset;
+ uint32_t length;
+ valid = structs.consume_binary(length) &&
+ structs.consume_binary(name_offset);
+ if (!valid)
+ {
+ fprintf(stderr, "Failed to read property\n");
+ return;
+ }
+ // Find the name
+ input_buffer name_buffer = strings.buffer_from_offset(name_offset);
+ if (name_buffer.empty())
+ {
+ fprintf(stderr, "Property name offset %" PRIu32
+ " is past the end of the strings table\n",
+ name_offset);
+ valid = false;
+ return;
+ }
+ key = string(name_buffer);
+
+ // If we're empty, do not push anything as value.
+ if (!length)
+ return;
+
+ // Read the value
+ uint8_t byte;
+ property_value v;
+ for (uint32_t i=0 ; i<length ; i++)
+ {
+ if (!(valid = structs.consume_binary(byte)))
+ {
+ fprintf(stderr, "Failed to read property value\n");
+ return;
+ }
+ v.byte_data.push_back(byte);
+ }
+ values.push_back(v);
+}
+
+void property::parse_define(input_buffer &input, define_map *defines)
+{
+ input.consume('$');
+ if (!defines)
+ {
+ input.parse_error("No predefined properties to match name\n");
+ valid = false;
+ return;
+ }
+ string name = string::parse_property_name(input);
+ define_map::iterator found;
+ if ((name == string()) ||
+ ((found = defines->find(name)) == defines->end()))
+ {
+ input.parse_error("Undefined property name\n");
+ valid = false;
+ return;
+ }
+ values.push_back((*found).second->values[0]);
+}
+
+property::property(input_buffer &input,
+ string k,
+ string l,
+ bool semicolonTerminated,
+ define_map *defines) : key(k), label(l), valid(true)
+{
+ do {
+ input.next_token();
+ switch (input[0])
+ {
+ case '$':
+ {
+ parse_define(input, defines);
+ if (valid)
+ {
+ break;
+ }
+ }
+ default:
+ input.parse_error("Invalid property value.");
+ valid = false;
+ return;
+ case '/':
+ {
+ unsigned long long bits = 0;
+ valid = input.consume("/bits/");
+ input.next_token();
+ valid &= input.consume_integer(bits);
+ if ((bits != 8) &&
+ (bits != 16) &&
+ (bits != 32) &&
+ (bits != 64)) {
+ input.parse_error("Invalid size for elements");
+ valid = false;
+ }
+ if (!valid) return;
+ input.next_token();
+ if (input[0] != '<')
+ {
+ input.parse_error("/bits/ directive is only valid on arrays");
+ valid = false;
+ return;
+ }
+ parse_cells(input, bits);
+ break;
+ }
+ case '"':
+ parse_string(input);
+ break;
+ case '<':
+ parse_cells(input, 32);
+ break;
+ case '[':
+ parse_bytes(input);
+ break;
+ case '&':
+ parse_reference(input);
+ break;
+ case ';':
+ {
+ break;
+ }
+ }
+ input.next_token();
+ } while (input.consume(','));
+ if (semicolonTerminated && !input.consume(';'))
+ {
+ input.parse_error("Expected ; at end of property");
+ valid = false;
+ }
+}
+
+property_ptr
+property::parse_dtb(input_buffer &structs, input_buffer &strings)
+{
+ property_ptr p(new property(structs, strings));
+ if (!p->valid)
+ {
+ p = nullptr;
+ }
+ return p;
+}
+
+property_ptr
+property::parse(input_buffer &input, string key, string label,
+ bool semicolonTerminated, define_map *defines)
+{
+ property_ptr p(new property(input, key, label, semicolonTerminated, defines));
+ if (!p->valid)
+ {
+ p = nullptr;
+ }
+ return p;
+}
+
+void
+property::write(dtb::output_writer &writer, dtb::string_table &strings)
+{
+ writer.write_token(dtb::FDT_PROP);
+ byte_buffer value_buffer;
+ for (value_iterator i=begin(), e=end() ; i!=e ; ++i)
+ {
+ i->push_to_buffer(value_buffer);
+ }
+ writer.write_data((uint32_t)value_buffer.size());
+ writer.write_comment(key);
+ writer.write_data(strings.add_string(key));
+ writer.write_data(value_buffer);
+}
+
+bool
+property_value::try_to_merge(property_value &other)
+{
+ resolve_type();
+ switch (type)
+ {
+ case UNKNOWN:
+ __builtin_unreachable();
+ assert(0);
+ return false;
+ case EMPTY:
+ *this = other;
+ case STRING:
+ case STRING_LIST:
+ case CROSS_REFERENCE:
+ return false;
+ case PHANDLE:
+ case BINARY:
+ if (other.type == PHANDLE || other.type == BINARY)
+ {
+ type = BINARY;
+ byte_data.insert(byte_data.end(), other.byte_data.begin(),
+ other.byte_data.end());
+ return true;
+ }
+ }
+ return false;
+}
+
+void
+property::write_dts(FILE *file, int indent)
+{
+ for (int i=0 ; i<indent ; i++)
+ {
+ putc('\t', file);
+ }
+ if (label != string())
+ {
+ label.print(file);
+ fputs(": ", file);
+ }
+ if (key != string())
+ {
+ key.print(file);
+ }
+ if (!values.empty())
+ {
+ std::vector<property_value> *vals = &values;
+ std::vector<property_value> v;
+ // If we've got multiple values then try to merge them all together.
+ if (values.size() > 1)
+ {
+ vals = &v;
+ v.push_back(values.front());
+ for (auto i=(++begin()), e=end() ; i!=e ; ++i)
+ {
+ if (!v.back().try_to_merge(*i))
+ {
+ v.push_back(*i);
+ }
+ }
+ }
+ fputs(" = ", file);
+ for (auto i=vals->begin(), e=vals->end() ; i!=e ; ++i)
+ {
+ i->write_dts(file);
+ if (i+1 != e)
+ {
+ putc(',', file);
+ putc(' ', file);
+ }
+ }
+ }
+ fputs(";\n", file);
+}
+
+string
+node::parse_name(input_buffer &input, bool &is_property, const char *error)
+{
+ if (!valid)
+ {
+ return string();
+ }
+ input.next_token();
+ if (is_property)
+ {
+ return string::parse_property_name(input);
+ }
+ string n = string::parse_node_or_property_name(input, is_property);
+ if (n.empty())
+ {
+ if (n.empty())
+ {
+ input.parse_error(error);
+ valid = false;
+ }
+ }
+ return n;
+}
+
+void
+node::visit(std::function<void(node&)> fn)
+{
+ fn(*this);
+ for (auto &&c : children)
+ {
+ c->visit(fn);
+ }
+}
+
+node::node(input_buffer &structs, input_buffer &strings) : valid(true)
+{
+ const char *name_start = (const char*)structs;
+ int name_length = 0;
+ while (structs[0] != '\0' && structs[0] != '@')
+ {
+ name_length++;
+ ++structs;
+ }
+ name = string(name_start, name_length);
+ if (structs[0] == '@')
+ {
+ ++structs;
+ name_start = (const char*)structs;
+ name_length = 0;
+ while (structs[0] != '\0')
+ {
+ name_length++;
+ ++structs;
+ }
+ unit_address = string(name_start, name_length);
+ }
+ ++structs;
+ uint32_t token;
+ while (structs.consume_binary(token))
+ {
+ switch (token)
+ {
+ default:
+ fprintf(stderr, "Unexpected token 0x%" PRIx32
+ " while parsing node.\n", token);
+ valid = false;
+ return;
+ // Child node, parse it.
+ case dtb::FDT_BEGIN_NODE:
+ {
+ node_ptr child = node::parse_dtb(structs, strings);
+ if (child == 0)
+ {
+ valid = false;
+ return;
+ }
+ children.push_back(std::move(child));
+ break;
+ }
+ // End of this node, no errors.
+ case dtb::FDT_END_NODE:
+ return;
+ // Property, parse it.
+ case dtb::FDT_PROP:
+ {
+ property_ptr prop = property::parse_dtb(structs, strings);
+ if (prop == 0)
+ {
+ valid = false;
+ return;
+ }
+ props.push_back(prop);
+ break;
+ }
+ break;
+ // End of structs table. Should appear after
+ // the end of the last node.
+ case dtb::FDT_END:
+ fprintf(stderr, "Unexpected FDT_END token while parsing node.\n");
+ valid = false;
+ return;
+ // NOPs are padding. Ignore them.
+ case dtb::FDT_NOP:
+ break;
+ }
+ }
+ fprintf(stderr, "Failed to read token from structs table while parsing node.\n");
+ valid = false;
+ return;
+}
+
+node::node(input_buffer &input, string n, string l, string a, define_map *defines) :
+ label(l), name(n), unit_address(a), valid(true)
+{
+ if (!input.consume('{'))
+ {
+ input.parse_error("Expected { to start new device tree node.\n");
+ }
+ input.next_token();
+ while (valid && !input.consume('}'))
+ {
+ // flag set if we find any characters that are only in
+ // the property name character set, not the node
+ bool is_property = false;
+ string child_name, child_label, child_address;
+ child_name = parse_name(input, is_property,
+ "Expected property or node name");
+ if (input.consume(':'))
+ {
+ // Node labels can contain any characters? The
+ // spec doesn't say, so we guess so...
+ is_property = false;
+ child_label = child_name;
+ child_name = parse_name(input, is_property, "Expected property or node name");
+ }
+ if (input.consume('@'))
+ {
+ child_address = parse_name(input, is_property, "Expected unit address");
+ }
+ if (!valid)
+ {
+ return;
+ }
+ input.next_token();
+ // If we're parsing a property, then we must actually do that.
+ if (input.consume('='))
+ {
+ property_ptr p = property::parse(input, child_name,
+ child_label, true, defines);
+ if (p == 0)
+ {
+ valid = false;
+ }
+ else
+ {
+ props.push_back(p);
+ }
+ }
+ else if (!is_property && input[0] == ('{'))
+ {
+ node_ptr child = node::parse(input, child_name,
+ child_label, child_address, defines);
+ if (child)
+ {
+ children.push_back(std::move(child));
+ }
+ else
+ {
+ valid = false;
+ }
+ }
+ else if (input.consume(';'))
+ {
+ props.push_back(property_ptr(new property(child_name, child_label)));
+ }
+ else
+ {
+ input.parse_error("Error parsing property.");
+ valid = false;
+ }
+ input.next_token();
+ }
+ input.consume(';');
+}
+
+bool
+node::cmp_properties(property_ptr &p1, property_ptr &p2)
+{
+ return p1->get_key() < p2->get_key();
+}
+
+bool
+node::cmp_children(node_ptr &c1, node_ptr &c2)
+{
+ if (c1->name == c2->name)
+ {
+ return c1->unit_address < c2->unit_address;
+ }
+ return c1->name < c2->name;
+}
+
+void
+node::sort()
+{
+ std::sort(property_begin(), property_end(), cmp_properties);
+ std::sort(child_begin(), child_end(), cmp_children);
+ for (auto &c : child_nodes())
+ {
+ c->sort();
+ }
+}
+
+node_ptr
+node::parse(input_buffer &input,
+ string name,
+ string label,
+ string address,
+ define_map *defines)
+{
+ node_ptr n(new node(input, name, label, address, defines));
+ if (!n->valid)
+ {
+ n = 0;
+ }
+ return n;
+}
+
+node_ptr
+node::parse_dtb(input_buffer &structs, input_buffer &strings)
+{
+ node_ptr n(new node(structs, strings));
+ if (!n->valid)
+ {
+ n = 0;
+ }
+ return n;
+}
+
+property_ptr
+node::get_property(string key)
+{
+ for (auto &i : props)
+ {
+ if (i->get_key() == key)
+ {
+ return i;
+ }
+ }
+ return 0;
+}
+
+void
+node::merge_node(node_ptr other)
+{
+ if (!other->label.empty())
+ {
+ label = other->label;
+ }
+ // Note: this is an O(n*m) operation. It might be sensible to
+ // optimise this if we find that there are nodes with very
+ // large numbers of properties, but for typical usage the
+ // entire vector will fit (easily) into cache, so iterating
+ // over it repeatedly isn't that expensive.
+ for (auto &p : other->properties())
+ {
+ bool found = false;
+ for (auto &mp : properties())
+ {
+ if (mp->get_key() == p->get_key())
+ {
+ mp = p;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ add_property(p);
+ }
+ }
+ for (auto &c : other->children)
+ {
+ bool found = false;
+ for (auto &i : children)
+ {
+ if (i->name == c->name && i->unit_address == c->unit_address)
+ {
+ i->merge_node(std::move(c));
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ children.push_back(std::move(c));
+ }
+ }
+}
+
+void
+node::write(dtb::output_writer &writer, dtb::string_table &strings)
+{
+ writer.write_token(dtb::FDT_BEGIN_NODE);
+ byte_buffer name_buffer;
+ name.push_to_buffer(name_buffer);
+ if (unit_address != string())
+ {
+ name_buffer.push_back('@');
+ unit_address.push_to_buffer(name_buffer);
+ }
+ writer.write_comment(name);
+ writer.write_data(name_buffer);
+ writer.write_data((uint8_t)0);
+ for (auto p : properties())
+ {
+ p->write(writer, strings);
+ }
+ for (auto &c : child_nodes())
+ {
+ c->write(writer, strings);
+ }
+ writer.write_token(dtb::FDT_END_NODE);
+}
+
+void
+node::write_dts(FILE *file, int indent)
+{
+ for (int i=0 ; i<indent ; i++)
+ {
+ putc('\t', file);
+ }
+#ifdef PRINT_LABELS
+ if (label != string())
+ {
+ label.print(file);
+ fputs(": ", file);
+ }
+#endif
+ if (name != string())
+ {
+ name.print(file);
+ }
+ if (unit_address != string())
+ {
+ putc('@', file);
+ unit_address.print(file);
+ }
+ fputs(" {\n\n", file);
+ for (auto p : properties())
+ {
+ p->write_dts(file, indent+1);
+ }
+ for (auto &c : child_nodes())
+ {
+ c->write_dts(file, indent+1);
+ }
+ for (int i=0 ; i<indent ; i++)
+ {
+ putc('\t', file);
+ }
+ fputs("};\n", file);
+}
+
+void
+device_tree::collect_names_recursive(node_ptr &n, node_path &path)
+{
+ string name = n->label;
+ path.push_back(std::make_pair(n->name, n->unit_address));
+ if (name != string())
+ {
+ if (node_names.find(name) == node_names.end())
+ {
+ node_names.insert(std::make_pair(name, n.get()));
+ node_paths.insert(std::make_pair(name, path));
+ }
+ else
+ {
+ node_names[name] = (node*)-1;
+ auto i = node_paths.find(name);
+ if (i != node_paths.end())
+ {
+ node_paths.erase(name);
+ }
+ fprintf(stderr, "Label not unique: ");
+ name.dump();
+ fprintf(stderr, ". References to this label will not be resolved.");
+ }
+ }
+ for (auto &c : n->child_nodes())
+ {
+ collect_names_recursive(c, path);
+ }
+ path.pop_back();
+ // Now we collect the phandles and properties that reference
+ // other nodes.
+ for (auto &p : n->properties())
+ {
+ for (auto &v : *p)
+ {
+ if (v.is_phandle())
+ {
+ phandles.push_back(&v);
+ }
+ if (v.is_cross_reference())
+ {
+ cross_references.push_back(&v);
+ }
+ }
+ if (p->get_key() == string("phandle") ||
+ p->get_key() == string("linux,phandle"))
+ {
+ if (p->begin()->byte_data.size() != 4)
+ {
+ fprintf(stderr, "Invalid phandle value for node ");
+ n->name.dump();
+ fprintf(stderr, ". Should be a 4-byte value.\n");
+ valid = false;
+ }
+ else
+ {
+ uint32_t phandle = p->begin()->get_as_uint32();
+ used_phandles.insert(std::make_pair(phandle, n.get()));
+ }
+ }
+ }
+}
+
+void
+device_tree::collect_names()
+{
+ node_path p;
+ node_names.clear();
+ node_paths.clear();
+ cross_references.clear();
+ phandles.clear();
+ collect_names_recursive(root, p);
+}
+
+void
+device_tree::resolve_cross_references()
+{
+ for (auto *pv : cross_references)
+ {
+ node_path path = node_paths[pv->string_data];
+ // Skip the first name in the path. It's always "", and implicitly /
+ for (auto p=path.begin()+1, pe=path.end() ; p!=pe ; ++p)
+ {
+ pv->byte_data.push_back('/');
+ p->first.push_to_buffer(pv->byte_data);
+ if (!(p->second.empty()))
+ {
+ pv->byte_data.push_back('@');
+ p->second.push_to_buffer(pv->byte_data);
+ pv->byte_data.push_back(0);
+ }
+ }
+ }
+ std::unordered_set<property_value*> phandle_set;
+ for (auto &i : phandles)
+ {
+ phandle_set.insert(i);
+ }
+ std::vector<property_value*> sorted_phandles;
+ root->visit([&](node &n) {
+ for (auto &p : n.properties())
+ {
+ for (auto &v : *p)
+ {
+ if (phandle_set.count(&v))
+ {
+ sorted_phandles.push_back(&v);
+ }
+ }
+ }
+ });
+ assert(sorted_phandles.size() == phandles.size());
+
+ uint32_t phandle = 1;
+ for (auto &i : sorted_phandles)
+ {
+ string target_name = i->string_data;
+ node *target = node_names[target_name];
+ if (target == 0)
+ {
+ fprintf(stderr, "Failed to find node with label: ");
+ target_name.dump();
+ fprintf(stderr, "\n");
+ valid = 0;
+ return;
+ }
+ // If there is an existing phandle, use it
+ property_ptr p = target->get_property("phandle");
+ if (p == 0)
+ {
+ p = target->get_property("linux,phandle");
+ }
+ if (p == 0)
+ {
+ // Otherwise insert a new phandle node
+ property_value v;
+ while (used_phandles.find(phandle) != used_phandles.end())
+ {
+ // Note that we only don't need to
+ // store this phandle in the set,
+ // because we are monotonically
+ // increasing the value of phandle and
+ // so will only ever revisit this value
+ // if we have used 2^32 phandles, at
+ // which point our blob won't fit in
+ // any 32-bit system and we've done
+ // something badly wrong elsewhere
+ // already.
+ phandle++;
+ }
+ push_big_endian(v.byte_data, phandle++);
+ if (phandle_node_name == BOTH || phandle_node_name == LINUX)
+ {
+ p.reset(new property(string("linux,phandle")));
+ p->add_value(v);
+ target->add_property(p);
+ }
+ if (phandle_node_name == BOTH || phandle_node_name == EPAPR)
+ {
+ p.reset(new property(string("phandle")));
+ p->add_value(v);
+ target->add_property(p);
+ }
+ }
+ p->begin()->push_to_buffer(i->byte_data);
+ assert(i->byte_data.size() == 4);
+ }
+}
+
+bool
+device_tree::parse_include(input_buffer &input,
+ const std::string &dir,
+ std::vector<node_ptr> &roots,
+ FILE *depfile,
+ bool &read_header)
+{
+ if (!input.consume("/include/"))
+ {
+ return false;
+ }
+ bool reallyInclude = true;
+ if (input.consume("if "))
+ {
+ input.next_token();
+ string name = string::parse_property_name(input);
+ // XXX: Error handling
+ if (defines.find(name) == defines.end())
+ {
+ reallyInclude = false;
+ }
+ input.consume('/');
+ }
+ input.next_token();
+ if (!input.consume('"'))
+ {
+ input.parse_error("Expected quoted filename");
+ valid = false;
+ return false;
+ }
+ int length = 0;
+ while (input[length] != '"') length++;
+
+ std::string file((const char*)input, length);
+ std::string include_file = dir + '/' + file;
+ input.consume(file.c_str());
+ if (!reallyInclude)
+ {
+ input.consume('"');
+ input.next_token();
+ return true;
+ }
+
+ input_buffer *include_buffer = buffer_for_file(include_file.c_str(), false);
+
+ if (include_buffer == 0)
+ {
+ for (auto i : include_paths)
+ {
+ include_file = i + '/' + file;
+ include_buffer = buffer_for_file(include_file.c_str());
+ if (include_buffer != 0)
+ {
+ break;
+ }
+ }
+ }
+ if (depfile != 0)
+ {
+ putc(' ', depfile);
+ fputs(include_file.c_str(), depfile);
+ }
+ if (include_buffer == 0)
+ {
+ input.parse_error("Unable to locate input file");
+ input.consume('"');
+ input.next_token();
+ valid = false;
+ return true;
+ }
+ input.consume('"');
+ input.next_token();
+ parse_file(*include_buffer, dir, roots, depfile, read_header);
+ return true;
+}
+
+void
+device_tree::parse_file(input_buffer &input,
+ const std::string &dir,
+ std::vector<node_ptr> &roots,
+ FILE *depfile,
+ bool &read_header)
+{
+ input.next_token();
+ // Read the header
+ if (input.consume("/dts-v1/;"))
+ {
+ read_header = true;
+ }
+ input.next_token();
+ input.next_token();
+ if (!read_header)
+ {
+ input.parse_error("Expected /dts-v1/; version string");
+ }
+ while(parse_include(input, dir, roots, depfile, read_header)) {}
+ // Read any memory reservations
+ while(input.consume("/memreserve/"))
+ {
+ unsigned long long start, len;
+ input.next_token();
+ // Read the start and length.
+ if (!(input.consume_integer_expression(start) &&
+ (input.next_token(),
+ input.consume_integer_expression(len))))
+ {
+ input.parse_error("Expected size on /memreserve/ node.");
+ }
+ input.next_token();
+ input.consume(';');
+ reservations.push_back(reservation(start, len));
+ }
+ input.next_token();
+ while(parse_include(input, dir, roots, depfile, read_header)) {}
+ while (valid && !input.finished())
+ {
+ node_ptr n;
+ if (input.consume('/'))
+ {
+ input.next_token();
+ n = node::parse(input, string(), string(), string(), &defines);
+ }
+ else if (input.consume('&'))
+ {
+ input.next_token();
+ string name = string::parse_node_name(input);
+ input.next_token();
+ n = node::parse(input, name, string(), string(), &defines);
+ }
+ else
+ {
+ input.parse_error("Failed to find root node /.");
+ }
+ if (n)
+ {
+ roots.push_back(std::move(n));
+ }
+ else
+ {
+ valid = false;
+ }
+ input.next_token();
+ while(parse_include(input, dir, roots, depfile, read_header)) {}
+ }
+}
+
+input_buffer*
+device_tree::buffer_for_file(const char *path, bool warn)
+{
+ if (string(path) == string("-"))
+ {
+ input_buffer *b = new stream_input_buffer();
+ if (b)
+ {
+ std::unique_ptr<input_buffer> ptr(b);
+ buffers.push_back(std::move(ptr));
+ }
+ return b;
+ }
+ int source = open(path, O_RDONLY);
+ if (source == -1)
+ {
+ if (warn)
+ {
+ fprintf(stderr, "Unable to open file '%s'. %s\n", path, strerror(errno));
+ }
+ 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
+ // lifetimes.
+ if (b)
+ {
+ std::unique_ptr<input_buffer> ptr(b);
+ buffers.push_back(std::move(ptr));
+ }
+ close(source);
+ return b;
+}
+
+template<class writer> void
+device_tree::write(int fd)
+{
+ dtb::string_table st;
+ dtb::header head;
+ writer head_writer;
+ writer reservation_writer;
+ writer struct_writer;
+ writer strings_writer;
+
+ // Build the reservation table
+ reservation_writer.write_comment(string("Memory reservations"));
+ reservation_writer.write_label(string("dt_reserve_map"));
+ for (auto &i : reservations)
+ {
+ reservation_writer.write_comment(string("Reservation start"));
+ reservation_writer.write_data(i.first);
+ reservation_writer.write_comment(string("Reservation length"));
+ reservation_writer.write_data(i.first);
+ }
+ // Write n spare reserve map entries, plus the trailing 0.
+ for (uint32_t i=0 ; i<=spare_reserve_map_entries ; i++)
+ {
+ reservation_writer.write_data((uint64_t)0);
+ reservation_writer.write_data((uint64_t)0);
+ }
+
+
+ struct_writer.write_comment(string("Device tree"));
+ struct_writer.write_label(string("dt_struct_start"));
+ root->write(struct_writer, st);
+ struct_writer.write_token(dtb::FDT_END);
+ struct_writer.write_label(string("dt_struct_end"));
+
+ st.write(strings_writer);
+ // Find the strings size before we stick padding on the end.
+ // Note: We should possibly use a new writer for the padding.
+ head.size_dt_strings = strings_writer.size();
+
+ // Stick the padding in the strings writer, but after the
+ // marker indicating that it's the end.
+ // Note: We probably should add a padding call to the writer so
+ // that the asm back end can write padding directives instead
+ // of a load of 0 bytes.
+ for (uint32_t i=0 ; i<blob_padding ; i++)
+ {
+ strings_writer.write_data((uint8_t)0);
+ }
+ head.totalsize = sizeof(head) + strings_writer.size() +
+ struct_writer.size() + reservation_writer.size();
+ while (head.totalsize < minimum_blob_size)
+ {
+ head.totalsize++;
+ strings_writer.write_data((uint8_t)0);
+ }
+ head.off_dt_struct = sizeof(head) + reservation_writer.size();;
+ head.off_dt_strings = head.off_dt_struct + struct_writer.size();
+ head.off_mem_rsvmap = sizeof(head);
+ head.boot_cpuid_phys = boot_cpu;
+ head.size_dt_struct = struct_writer.size();
+ head.write(head_writer);
+
+ head_writer.write_to_file(fd);
+ reservation_writer.write_to_file(fd);
+ struct_writer.write_to_file(fd);
+ strings_writer.write_label(string("dt_blob_end"));
+ strings_writer.write_to_file(fd);
+}
+
+node*
+device_tree::referenced_node(property_value &v)
+{
+ if (v.is_phandle())
+ {
+ return node_names[v.string_data];
+ }
+ if (v.is_binary())
+ {
+ return used_phandles[v.get_as_uint32()];
+ }
+ return 0;
+}
+
+void
+device_tree::write_binary(int fd)
+{
+ write<dtb::binary_writer>(fd);
+}
+
+void
+device_tree::write_asm(int fd)
+{
+ write<dtb::asm_writer>(fd);
+}
+
+void
+device_tree::write_dts(int fd)
+{
+ FILE *file = fdopen(fd, "w");
+ fputs("/dts-v1/;\n\n", file);
+
+ if (!reservations.empty())
+ {
+ const char msg[] = "/memreserve/";
+ fwrite(msg, sizeof(msg), 1, file);
+ for (auto &i : reservations)
+ {
+ fprintf(file, " %" PRIx64 " %" PRIx64, i.first, i.second);
+ }
+ fputs(";\n\n", file);
+ }
+ putc('/', file);
+ putc(' ', file);
+ root->write_dts(file, 0);
+ fclose(file);
+}
+
+void
+device_tree::parse_dtb(const char *fn, FILE *)
+{
+ input_buffer *in = buffer_for_file(fn);
+ if (in == 0)
+ {
+ valid = false;
+ return;
+ }
+ input_buffer &input = *in;
+ dtb::header h;
+ valid = h.read_dtb(input);
+ boot_cpu = h.boot_cpuid_phys;
+ if (h.last_comp_version > 17)
+ {
+ fprintf(stderr, "Don't know how to read this version of the device tree blob");
+ valid = false;
+ }
+ if (!valid)
+ {
+ return;
+ }
+ input_buffer reservation_map =
+ input.buffer_from_offset(h.off_mem_rsvmap, 0);
+ uint64_t start, length;
+ do
+ {
+ if (!(reservation_map.consume_binary(start) &&
+ reservation_map.consume_binary(length)))
+ {
+ fprintf(stderr, "Failed to read memory reservation table\n");
+ valid = false;
+ return;
+ }
+ } while (!((start == 0) && (length == 0)));
+ input_buffer struct_table =
+ input.buffer_from_offset(h.off_dt_struct, h.size_dt_struct);
+ input_buffer strings_table =
+ input.buffer_from_offset(h.off_dt_strings, h.size_dt_strings);
+ uint32_t token;
+ if (!(struct_table.consume_binary(token) &&
+ (token == dtb::FDT_BEGIN_NODE)))
+ {
+ fprintf(stderr, "Expected FDT_BEGIN_NODE token.\n");
+ valid = false;
+ return;
+ }
+ root = node::parse_dtb(struct_table, strings_table);
+ if (!(struct_table.consume_binary(token) && (token == dtb::FDT_END)))
+ {
+ fprintf(stderr, "Expected FDT_END token after parsing root node.\n");
+ valid = false;
+ return;
+ }
+ valid = (root != 0);
+}
+
+void
+device_tree::parse_dts(const char *fn, FILE *depfile)
+{
+ input_buffer *in = buffer_for_file(fn);
+ std::string dir(dirname((char*)fn));
+ if (in == 0)
+ {
+ valid = false;
+ return;
+ }
+ std::vector<node_ptr> roots;
+ input_buffer &input = *in;
+ bool read_header = false;
+ parse_file(input, dir, roots, depfile, read_header);
+ switch (roots.size())
+ {
+ case 0:
+ valid = false;
+ input.parse_error("Failed to find root node /.");
+ return;
+ case 1:
+ root = std::move(roots[0]);
+ break;
+ default:
+ {
+ root = std::move(roots[0]);
+ for (auto i=++(roots.begin()), e=roots.end() ; i!=e ; ++i)
+ {
+ auto &node = *i;
+ string name = node->name;
+ if (name == string())
+ {
+ root->merge_node(std::move(node));
+ }
+ else
+ {
+ auto existing = node_names.find(name);
+ if (existing == node_names.end())
+ {
+ collect_names();
+ existing = node_names.find(name);
+ }
+ if (existing == node_names.end())
+ {
+ fprintf(stderr, "Unable to merge node: ");
+ name.dump();
+ fprintf(stderr, "\n");
+ }
+ existing->second->merge_node(std::move(node));
+ }
+ }
+ }
+ }
+ collect_names();
+ resolve_cross_references();
+}
+
+bool device_tree::parse_define(const char *def)
+{
+ char *val = strchr(def, '=');
+ if (!val)
+ {
+ if (strlen(def) != 0)
+ {
+ string name(def);
+ defines[name];
+ return true;
+ }
+ return false;
+ }
+ string name(def, val-def);
+ val++;
+ input_buffer in = input_buffer(val, strlen(val));
+ property_ptr p = property::parse(in, name, string(), false);
+ if (p)
+ defines[name] = p;
+ return (bool)p;
+}
+
+} // namespace fdt
+
+} // namespace dtc
+
diff --git a/usr.bin/dtc/fdt.hh b/usr.bin/dtc/fdt.hh
new file mode 100644
index 0000000..5f53f5a
--- /dev/null
+++ b/usr.bin/dtc/fdt.hh
@@ -0,0 +1,866 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _FDT_HH_
+#define _FDT_HH_
+#include <unordered_map>
+#include <unordered_set>
+#include <memory>
+#include <string>
+#include <functional>
+
+#include "util.hh"
+#include "string.hh"
+
+namespace dtc
+{
+
+namespace dtb
+{
+struct output_writer;
+class string_table;
+}
+
+namespace fdt
+{
+class property;
+class node;
+/**
+ * Type for (owned) pointers to properties.
+ */
+typedef std::shared_ptr<property> property_ptr;
+/**
+ * Owning pointer to a node.
+ */
+typedef std::unique_ptr<node> node_ptr;
+/**
+ * Map from macros to property pointers.
+ */
+typedef std::unordered_map<string, property_ptr> define_map;
+/**
+ * Properties may contain a number of different value, each with a different
+ * label. This class encapsulates a single value.
+ */
+struct property_value
+{
+ /**
+ * The label for this data. This is usually empty.
+ */
+ string label;
+ /**
+ * If this value is a string, or something resolved from a string (a
+ * reference) then this contains the source string.
+ */
+ string string_data;
+ /**
+ * The data that should be written to the final output.
+ */
+ byte_buffer byte_data;
+ /**
+ * Enumeration describing the possible types of a value. Note that
+ * property-coded arrays will appear simply as binary (or possibly
+ * string, if they happen to be nul-terminated and printable), and must
+ * be checked separately.
+ */
+ enum value_type
+ {
+ /**
+ * This is a list of strings. When read from source, string
+ * lists become one property value for each string, however
+ * when read from binary we have a single property value
+ * incorporating the entire text, with nul bytes separating the
+ * strings.
+ */
+ STRING_LIST,
+ /**
+ * This property contains a single string.
+ */
+ STRING,
+ /**
+ * This is a binary value. Check the size of byte_data to
+ * determine how many bytes this contains.
+ */
+ BINARY,
+ /** This contains a short-form address that should be replaced
+ * by a fully-qualified version. This will only appear when
+ * the input is a device tree source. When parsed from a
+ * device tree blob, the cross reference will have already been
+ * resolved and the property value will be a string containing
+ * the full path of the target node. */
+ CROSS_REFERENCE,
+ /**
+ * This is a phandle reference. When parsed from source, the
+ * string_data will contain the node label for the target and,
+ * after cross references have been resolved, the binary data
+ * will contain a 32-bit integer that should match the phandle
+ * property of the target node.
+ */
+ PHANDLE,
+ /**
+ * An empty property value. This will never appear on a real
+ * property value, it is used by checkers to indicate that no
+ * property values should exist for a property.
+ */
+ EMPTY,
+ /**
+ * The type of this property has not yet been determined.
+ */
+ UNKNOWN
+ };
+ /**
+ * The type of this property.
+ */
+ value_type type;
+ /**
+ * Returns true if this value is a cross reference, false otherwise.
+ */
+ inline bool is_cross_reference()
+ {
+ return is_type(CROSS_REFERENCE);
+ }
+ /**
+ * Returns true if this value is a phandle reference, false otherwise.
+ */
+ inline bool is_phandle()
+ {
+ return is_type(PHANDLE);
+ }
+ /**
+ * Returns true if this value is a string, false otherwise.
+ */
+ inline bool is_string()
+ {
+ return is_type(STRING);
+ }
+ /**
+ * Returns true if this value is a string list (a nul-separated
+ * sequence of strings), false otherwise.
+ */
+ inline bool is_string_list()
+ {
+ return is_type(STRING_LIST);
+ }
+ /**
+ * Returns true if this value is binary, false otherwise.
+ */
+ inline bool is_binary()
+ {
+ return is_type(BINARY);
+ }
+ /**
+ * Returns this property value as a 32-bit integer. Returns 0 if this
+ * property value is not 32 bits long. The bytes in the property value
+ * are assumed to be in big-endian format, but the return value is in
+ * the host native endian.
+ */
+ uint32_t get_as_uint32();
+ /**
+ * Default constructor, specifying the label of the value.
+ */
+ property_value(string l=string()) : label(l), type(UNKNOWN) {}
+ /**
+ * Writes the data for this value into an output buffer.
+ */
+ void push_to_buffer(byte_buffer &buffer);
+
+ /**
+ * Writes the property value to the standard output. This uses the
+ * following heuristics for deciding how to print the output:
+ *
+ * - If the value is nul-terminated and only contains printable
+ * characters, it is written as a string.
+ * - If it is a multiple of 4 bytes long, then it is printed as cells.
+ * - Otherwise, it is printed as a byte buffer.
+ */
+ void write_dts(FILE *file);
+ /**
+ * Tries to merge adjacent property values, returns true if it succeeds and
+ * false otherwise.
+ */
+ bool try_to_merge(property_value &other);
+ private:
+ /**
+ * Returns whether the value is of the specified type. If the type of
+ * the value has not yet been determined, then this calculates it.
+ */
+ inline bool is_type(value_type v)
+ {
+ if (type == UNKNOWN)
+ {
+ resolve_type();
+ }
+ return type == v;
+ }
+ /**
+ * Determines the type of the value based on its contents.
+ */
+ void resolve_type();
+ /**
+ * Writes the property value to the specified file as a quoted string.
+ * This is used when generating DTS.
+ */
+ void write_as_string(FILE *file);
+ /**
+ * Writes the property value to the specified file as a sequence of
+ * 32-bit big-endian cells. This is used when generating DTS.
+ */
+ void write_as_cells(FILE *file);
+ /**
+ * Writes the property value to the specified file as a sequence of
+ * bytes. This is used when generating DTS.
+ */
+ void write_as_bytes(FILE *file);
+};
+
+/**
+ * A value encapsulating a single property. This contains a key, optionally a
+ * label, and optionally one or more values.
+ */
+class property
+{
+ /**
+ * The name of this property.
+ */
+ string key;
+ /**
+ * An optional label.
+ */
+ string label;
+ /**
+ * The values in this property.
+ */
+ std::vector<property_value> values;
+ /**
+ * Value indicating that this is a valid property. If a parse error
+ * occurs, then this value is false.
+ */
+ bool valid;
+ /**
+ * Parses a string property value, i.e. a value enclosed in double quotes.
+ */
+ void parse_string(input_buffer &input);
+ /**
+ * Parses one or more 32-bit values enclosed in angle brackets.
+ */
+ void parse_cells(input_buffer &input, int cell_size);
+ /**
+ * Parses an array of bytes, contained within square brackets.
+ */
+ void parse_bytes(input_buffer &input);
+ /**
+ * Parses a reference. This is a node label preceded by an ampersand
+ * symbol, which should expand to the full path to that node.
+ *
+ * Note: The specification says that the target of such a reference is
+ * a node name, however dtc assumes that it is a label, and so we
+ * follow their interpretation for compatibility.
+ */
+ void parse_reference(input_buffer &input);
+ /**
+ * Parse a predefined macro definition for a property.
+ */
+ void parse_define(input_buffer &input, define_map *defines);
+ /**
+ * Constructs a new property from two input buffers, pointing to the
+ * struct and strings tables in the device tree blob, respectively.
+ * The structs input buffer is assumed to have just consumed the
+ * FDT_PROP token.
+ */
+ property(input_buffer &structs, input_buffer &strings);
+ /**
+ * Parses a new property from the input buffer.
+ */
+ property(input_buffer &input,
+ string k,
+ string l,
+ bool terminated,
+ define_map *defines);
+ public:
+ /**
+ * Creates an empty property.
+ */
+ property(string k, string l=string()) : key(k), label(l), valid(true)
+ {}
+ /**
+ * Copy constructor.
+ */
+ property(property &p) : key(p.key), label(p.label), values(p.values),
+ valid(p.valid) {}
+ /**
+ * Factory method for constructing a new property. Attempts to parse a
+ * property from the input, and returns it on success. On any parse
+ * error, this will return 0.
+ */
+ static property_ptr parse_dtb(input_buffer &structs,
+ input_buffer &strings);
+ /**
+ * Factory method for constructing a new property. Attempts to parse a
+ * property from the input, and returns it on success. On any parse
+ * error, this will return 0.
+ */
+ static property_ptr parse(input_buffer &input,
+ string key,
+ string label=string(),
+ bool semicolonTerminated=true,
+ define_map *defines=0);
+ /**
+ * Iterator type used for accessing the values of a property.
+ */
+ typedef std::vector<property_value>::iterator value_iterator;
+ /**
+ * Returns an iterator referring to the first value in this property.
+ */
+ inline value_iterator begin()
+ {
+ return values.begin();
+ }
+ /**
+ * Returns an iterator referring to the last value in this property.
+ */
+ inline value_iterator end()
+ {
+ return values.end();
+ }
+ /**
+ * Adds a new value to an existing property.
+ */
+ inline void add_value(property_value v)
+ {
+ values.push_back(v);
+ }
+ /**
+ * Returns the key for this property.
+ */
+ inline string get_key()
+ {
+ return key;
+ }
+ /**
+ * Writes the property to the specified writer. The property name is a
+ * reference into the strings table.
+ */
+ void write(dtb::output_writer &writer, dtb::string_table &strings);
+ /**
+ * Writes in DTS format to the specified file, at the given indent
+ * level. This will begin the line with the number of tabs specified
+ * as the indent level and then write the property in the most
+ * applicable way that it can determine.
+ */
+ void write_dts(FILE *file, int indent);
+};
+
+/**
+ * Class encapsulating a device tree node. Nodes may contain properties and
+ * other nodes.
+ */
+class node
+{
+ public:
+ /**
+ * The label for this node, if any. Node labels are used as the
+ * targets for cross references.
+ */
+ string label;
+ /**
+ * The name of the node.
+ */
+ string name;
+ /**
+ * The unit address of the node, which is optionally written after the
+ * name followed by an at symbol.
+ */
+ string unit_address;
+ /**
+ * The type for the property vector.
+ */
+ typedef std::vector<property_ptr> property_vector;
+ /**
+ * Iterator type for child nodes.
+ */
+ typedef std::vector<node_ptr>::iterator child_iterator;
+ private:
+ /**
+ * Adaptor to use children in range-based for loops.
+ */
+ struct child_range
+ {
+ child_range(node &nd) : n(nd) {}
+ child_iterator begin() { return n.child_begin(); }
+ child_iterator end() { return n.child_end(); }
+ private:
+ node &n;
+ };
+ /**
+ * Adaptor to use properties in range-based for loops.
+ */
+ struct property_range
+ {
+ property_range(node &nd) : n(nd) {}
+ property_vector::iterator begin() { return n.property_begin(); }
+ property_vector::iterator end() { return n.property_end(); }
+ private:
+ node &n;
+ };
+ /**
+ * The properties contained within this node.
+ */
+ property_vector props;
+ /**
+ * The children of this node.
+ */
+ std::vector<node_ptr> children;
+ /**
+ * A flag indicating whether this node is valid. This is set to false
+ * if an error occurs during parsing.
+ */
+ bool valid;
+ /**
+ * Parses a name inside a node, writing the string passed as the last
+ * argument as an error if it fails.
+ */
+ string parse_name(input_buffer &input,
+ bool &is_property,
+ const char *error);
+ /**
+ * Constructs a new node from two input buffers, pointing to the struct
+ * and strings tables in the device tree blob, respectively.
+ */
+ node(input_buffer &structs, input_buffer &strings);
+ /**
+ * Parses a new node from the specified input buffer. This is called
+ * when the input cursor is on the open brace for the start of the
+ * node. The name, and optionally label and unit address, should have
+ * already been parsed.
+ */
+ node(input_buffer &input, string n, string l, string a, define_map*);
+ /**
+ * Comparison function for properties, used when sorting the properties
+ * vector. Orders the properties based on their names.
+ */
+ static inline bool cmp_properties(property_ptr &p1, property_ptr &p2);
+ /*
+ {
+ return p1->get_key() < p2->get_key();
+ }
+ */
+ /**
+ * Comparison function for nodes, used when sorting the children
+ * vector. Orders the nodes based on their names or, if the names are
+ * the same, by the unit addresses.
+ */
+ static inline bool cmp_children(node_ptr &c1, node_ptr &c2);
+ public:
+ /**
+ * Sorts the node's properties and children into alphabetical order and
+ * recursively sorts the children.
+ */
+ void sort();
+ /**
+ * Returns an iterator for the first child of this node.
+ */
+ inline child_iterator child_begin()
+ {
+ return children.begin();
+ }
+ /**
+ * Returns an iterator after the last child of this node.
+ */
+ inline child_iterator child_end()
+ {
+ return children.end();
+ }
+ inline child_range child_nodes()
+ {
+ return child_range(*this);
+ }
+ inline property_range properties()
+ {
+ return property_range(*this);
+ }
+ /**
+ * Returns an iterator after the last property of this node.
+ */
+ inline property_vector::iterator property_begin()
+ {
+ return props.begin();
+ }
+ /**
+ * Returns an iterator for the first property of this node.
+ */
+ inline property_vector::iterator property_end()
+ {
+ return props.end();
+ }
+ /**
+ * Factory method for constructing a new node. Attempts to parse a
+ * node in DTS format from the input, and returns it on success. On
+ * any parse error, this will return 0. This should be called with the
+ * cursor on the open brace of the property, after the name and so on
+ * have been parsed.
+ */
+ static node_ptr parse(input_buffer &input,
+ string name,
+ string label=string(),
+ string address=string(),
+ define_map *defines=0);
+ /**
+ * Factory method for constructing a new node. Attempts to parse a
+ * node in DTB format from the input, and returns it on success. On
+ * any parse error, this will return 0. This should be called with the
+ * cursor on the open brace of the property, after the name and so on
+ * have been parsed.
+ */
+ static node_ptr parse_dtb(input_buffer &structs, input_buffer &strings);
+ /**
+ * Returns a property corresponding to the specified key, or 0 if this
+ * node does not contain a property of that name.
+ */
+ property_ptr get_property(string key);
+ /**
+ * Adds a new property to this node.
+ */
+ inline void add_property(property_ptr &p)
+ {
+ props.push_back(p);
+ }
+ /**
+ * Merges a node into this one. Any properties present in both are
+ * overridden, any properties present in only one are preserved.
+ */
+ void merge_node(node_ptr other);
+ /**
+ * Write this node to the specified output. Although nodes do not
+ * refer to a string table directly, their properties do. The string
+ * table passed as the second argument is used for the names of
+ * properties within this node and its children.
+ */
+ void write(dtb::output_writer &writer, dtb::string_table &strings);
+ /**
+ * Writes the current node as DTS to the specified file. The second
+ * parameter is the indent level. This function will start every line
+ * with this number of tabs.
+ */
+ void write_dts(FILE *file, int indent);
+ /**
+ * Recursively visit this node and then its children.
+ */
+ void visit(std::function<void(node&)>);
+};
+
+/**
+ * Class encapsulating the entire parsed FDT. This is the top-level class,
+ * which parses the entire DTS representation and write out the finished
+ * version.
+ */
+class device_tree
+{
+ public:
+ /**
+ * Type used for node paths. A node path is sequence of names and unit
+ * addresses.
+ */
+ typedef std::vector<std::pair<string,string> > node_path;
+ /**
+ * Name that we should use for phandle nodes.
+ */
+ enum phandle_format
+ {
+ /** linux,phandle */
+ LINUX,
+ /** phandle */
+ EPAPR,
+ /** Create both nodes. */
+ BOTH
+ };
+ private:
+ /**
+ * The format that we should use for writing phandles.
+ */
+ phandle_format phandle_node_name;
+ /**
+ * Flag indicating that this tree is valid. This will be set to false
+ * on parse errors.
+ */
+ bool valid;
+ /**
+ * Type used for memory reservations. A reservation is two 64-bit
+ * values indicating a base address and length in memory that the
+ * kernel should not use. The high 32 bits are ignored on 32-bit
+ * platforms.
+ */
+ typedef std::pair<uint64_t, uint64_t> reservation;
+ /**
+ * The memory reserves table.
+ */
+ std::vector<reservation> reservations;
+ /**
+ * Root node. All other nodes are children of this node.
+ */
+ node_ptr root;
+ /**
+ * Mapping from names to nodes. Only unambiguous names are recorded,
+ * duplicate names are stored as (node*)-1.
+ */
+ std::unordered_map<string, node*> node_names;
+ /**
+ * A map from labels to node paths. When resolving cross references,
+ * we look up referenced nodes in this and replace the cross reference
+ * with the full path to its target.
+ */
+ std::unordered_map<string, node_path> node_paths;
+ /**
+ * A collection of property values that are references to other nodes.
+ * These should be expanded to the full path of their targets.
+ */
+ std::vector<property_value*> cross_references;
+ /**
+ * A collection of property values that refer to phandles. These will
+ * be replaced by the value of the phandle property in their
+ * destination.
+ */
+ std::vector<property_value*> phandles;
+ /**
+ * The names of nodes that target phandles.
+ */
+ std::unordered_set<string> phandle_targets;
+ /**
+ * A collection of input buffers that we are using. These input
+ * buffers are the ones that own their memory, and so we must preserve
+ * them for the lifetime of the device tree.
+ */
+ std::vector<std::unique_ptr<input_buffer>> buffers;
+ /**
+ * A map of used phandle values to nodes. All phandles must be unique,
+ * so we keep a set of ones that the user explicitly provides in the
+ * input to ensure that we don't reuse them.
+ *
+ * This is a map, rather than a set, because we also want to be able to
+ * find phandles that were provided by the user explicitly when we are
+ * doing checking.
+ */
+ std::unordered_map<uint32_t, node*> used_phandles;
+ /**
+ * Paths to search for include files. This contains a set of
+ * nul-terminated strings, which are not owned by this class and so
+ * must be freed separately.
+ */
+ std::vector<std::string> include_paths;
+ /**
+ * Dictionary of predefined macros provided on the command line.
+ */
+ define_map defines;
+ /**
+ * The default boot CPU, specified in the device tree header.
+ */
+ uint32_t boot_cpu;
+ /**
+ * The number of empty reserve map entries to generate in the blob.
+ */
+ uint32_t spare_reserve_map_entries;
+ /**
+ * The minimum size in bytes of the blob.
+ */
+ uint32_t minimum_blob_size;
+ /**
+ * The number of bytes of padding to add to the end of the blob.
+ */
+ uint32_t blob_padding;
+ /**
+ * Visit all of the nodes recursively, and if they have labels then add
+ * them to the node_paths and node_names vectors so that they can be
+ * used in resolving cross references. Also collects phandle
+ * properties that have been explicitly added.
+ */
+ void collect_names_recursive(node_ptr &n, node_path &path);
+ /**
+ * Assign phandle properties to all nodes that have been referenced and
+ * require one. This method will recursively visit the tree starting at
+ * the node that it is passed.
+ */
+ void assign_phandles(node_ptr &n, uint32_t &next);
+ /**
+ * Calls the recursive version of this method on every root node.
+ */
+ void collect_names();
+ /**
+ * Resolves all cross references. Any properties that refer to another
+ * node must have their values replaced by either the node path or
+ * phandle value.
+ */
+ void resolve_cross_references();
+ /**
+ * Parse a top-level include directive.
+ */
+ bool parse_include(input_buffer &input,
+ const std::string &dir,
+ std::vector<node_ptr> &roots,
+ FILE *depfile,
+ bool &read_header);
+ /**
+ * Parses a dts file in the given buffer and adds the roots to the parsed
+ * set. The `read_header` argument indicates whether the header has
+ * already been read. Some dts files place the header in an include,
+ * rather than in the top-level file.
+ */
+ void parse_file(input_buffer &input,
+ const std::string &dir,
+ std::vector<node_ptr> &roots,
+ FILE *depfile,
+ bool &read_header);
+ /**
+ * Allocates a new mmap()'d input buffer for use in parsing. This
+ * object then keeps a reference to it, ensuring that it is not
+ * deallocated until the device tree is destroyed.
+ */
+ input_buffer *buffer_for_file(const char *path, bool warn=true);
+ /**
+ * Template function that writes a dtb blob using the specified writer.
+ * The writer defines the output format (assembly, blob).
+ */
+ template<class writer>
+ void write(int fd);
+ public:
+ /**
+ * Returns the node referenced by the property. If this is a tree that
+ * is in source form, then we have a string that we can use to index
+ * the cross_references array and so we can just look that up.
+ */
+ node *referenced_node(property_value &v);
+ /**
+ * Writes this FDT as a DTB to the specified output.
+ */
+ void write_binary(int fd);
+ /**
+ * Writes this FDT as an assembly representation of the DTB to the
+ * specified output. The result can then be assembled and linked into
+ * a program.
+ */
+ void write_asm(int fd);
+ /**
+ * Writes the tree in DTS (source) format.
+ */
+ void write_dts(int fd);
+ /**
+ * Default constructor. Creates a valid, but empty FDT.
+ */
+ device_tree() : phandle_node_name(EPAPR), valid(true),
+ boot_cpu(0), spare_reserve_map_entries(0),
+ minimum_blob_size(0), blob_padding(0) {}
+ /**
+ * Constructs a device tree from the specified file name, referring to
+ * a file that contains a device tree blob.
+ */
+ void parse_dtb(const char *fn, FILE *depfile);
+ /**
+ * Constructs a device tree from the specified file name, referring to
+ * a file that contains device tree source.
+ */
+ void parse_dts(const char *fn, FILE *depfile);
+ /**
+ * Returns whether this tree is valid.
+ */
+ inline bool is_valid()
+ {
+ return valid;
+ }
+ /**
+ * Sets the format for writing phandle properties.
+ */
+ inline void set_phandle_format(phandle_format f)
+ {
+ phandle_node_name = f;
+ }
+ /**
+ * Returns a pointer to the root node of this tree. No ownership
+ * transfer.
+ */
+ inline const node_ptr &get_root() const
+ {
+ return root;
+ }
+ /**
+ * Sets the physical boot CPU.
+ */
+ void set_boot_cpu(uint32_t cpu)
+ {
+ boot_cpu = cpu;
+ }
+ /**
+ * Sorts the tree. Useful for debugging device trees.
+ */
+ void sort()
+ {
+ root->sort();
+ }
+ /**
+ * Adds a path to search for include files. The argument must be a
+ * nul-terminated string representing the path. The device tree keeps
+ * a pointer to this string, but does not own it: the caller is
+ * responsible for freeing it if required.
+ */
+ void add_include_path(const char *path)
+ {
+ std::string p(path);
+ include_paths.push_back(std::move(p));
+ }
+ /**
+ * Sets the number of empty reserve map entries to add.
+ */
+ void set_empty_reserve_map_entries(uint32_t e)
+ {
+ spare_reserve_map_entries = e;
+ }
+ /**
+ * Sets the minimum size, in bytes, of the blob.
+ */
+ void set_blob_minimum_size(uint32_t s)
+ {
+ minimum_blob_size = s;
+ }
+ /**
+ * Sets the amount of padding to add to the blob.
+ */
+ void set_blob_padding(uint32_t p)
+ {
+ blob_padding = p;
+ }
+ /**
+ * Parses a predefined macro value.
+ */
+ bool parse_define(const char *def);
+};
+
+} // namespace fdt
+
+} // namespace dtc
+
+#endif // !_FDT_HH_
diff --git a/usr.bin/dtc/input_buffer.cc b/usr.bin/dtc/input_buffer.cc
new file mode 100644
index 0000000..6d48adc
--- /dev/null
+++ b/usr.bin/dtc/input_buffer.cc
@@ -0,0 +1,831 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#include "input_buffer.hh"
+#include <ctype.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <functional>
+#ifndef NDEBUG
+#include <iostream>
+#endif
+
+
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <assert.h>
+
+#ifndef MAP_PREFAULT_READ
+#define MAP_PREFAULT_READ 0
+#endif
+
+namespace dtc
+{
+void
+input_buffer::skip_spaces()
+{
+ if (cursor >= size) { return; }
+ if (cursor < 0) { return; }
+ char c = buffer[cursor];
+ while ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\f')
+ || (c == '\v') || (c == '\r'))
+ {
+ cursor++;
+ if (cursor > size)
+ {
+ c = '\0';
+ }
+ else
+ {
+ c = buffer[cursor];
+ }
+ }
+}
+
+input_buffer
+input_buffer::buffer_from_offset(int offset, int s)
+{
+ if (s == 0)
+ {
+ s = size - offset;
+ }
+ if (offset > size)
+ {
+ return input_buffer();
+ }
+ if (s > (size-offset))
+ {
+ return input_buffer();
+ }
+ return input_buffer(&buffer[offset], s);
+}
+
+bool
+input_buffer::consume(const char *str)
+{
+ int len = strlen(str);
+ if (len > size - cursor)
+ {
+ return false;
+ }
+ else
+ {
+ for (int i=0 ; i<len ; ++i)
+ {
+ if (str[i] != buffer[cursor + i])
+ {
+ return false;
+ }
+ }
+ cursor += len;
+ return true;
+ }
+ return false;
+}
+
+bool
+input_buffer::consume_integer(unsigned long long &outInt)
+{
+ // The first character must be a digit. Hex and octal strings
+ // are prefixed by 0 and 0x, respectively.
+ if (!isdigit((*this)[0]))
+ {
+ return false;
+ }
+ char *end=0;
+ outInt = strtoull(&buffer[cursor], &end, 0);
+ if (end == &buffer[cursor])
+ {
+ return false;
+ }
+ cursor = end - buffer;
+ return true;
+}
+
+namespace {
+
+/**
+ * Convenience typedef for the type that we use for all values.
+ */
+typedef unsigned long long valty;
+
+/**
+ * Expression tree currently being parsed.
+ */
+struct expression
+{
+ /**
+ * Evaluate this node, taking into account operator precedence.
+ */
+ virtual valty operator()() = 0;
+ /**
+ * Returns the precedence of this node. Lower values indicate higher
+ * precedence.
+ */
+ virtual int precedence() = 0;
+ virtual ~expression() {}
+#ifndef NDEBUG
+ /**
+ * Dumps this expression to `std::cerr`, appending a newline if `nl` is
+ * `true`.
+ */
+ void dump(bool nl=false)
+ {
+ if (this == nullptr)
+ {
+ std::cerr << "{nullptr}\n";
+ return;
+ }
+ dump_impl();
+ if (nl)
+ {
+ std::cerr << '\n';
+ }
+ }
+ private:
+ /**
+ * Method that sublcasses override to implement the behaviour of `dump()`.
+ */
+ virtual void dump_impl() = 0;
+#endif
+};
+
+/**
+ * Expression wrapping a single integer. Leaf nodes in the expression tree.
+ */
+class terminal_expr : public expression
+{
+ /**
+ * The value that this wraps.
+ */
+ valty val;
+ /**
+ * Evaluate. Trivially returns the value that this class wraps.
+ */
+ valty operator()() override
+ {
+ return val;
+ }
+ int precedence() override
+ {
+ return 0;
+ }
+ public:
+ /**
+ * Constructor.
+ */
+ terminal_expr(valty v) : val(v) {}
+#ifndef NDEBUG
+ void dump_impl() override { std::cerr << val; }
+#endif
+};
+
+/**
+ * Parenthetical expression. Exists to make the contents opaque.
+ */
+struct paren_expression : public expression
+{
+ /**
+ * The expression within the parentheses.
+ */
+ expression_ptr subexpr;
+ /**
+ * Constructor. Takes the child expression as the only argument.
+ */
+ paren_expression(expression_ptr p) : subexpr(std::move(p)) {}
+ int precedence() override
+ {
+ return 0;
+ }
+ /**
+ * Evaluate - just forwards to the underlying expression.
+ */
+ valty operator()() override
+ {
+ return (*subexpr)();
+ }
+#ifndef NDEBUG
+ void dump_impl() override
+ {
+ std::cerr << " (";
+ subexpr->dump();
+ std::cerr << ") ";
+ }
+#endif
+};
+
+/**
+ * Template class for unary operators. The `OpChar` template parameter is
+ * solely for debugging and makes it easy to print the expression. The `Op`
+ * template parameter is a function object that implements the operator that
+ * this class provides. Most of these are provided by the `<functional>`
+ * header.
+ */
+template<char OpChar, class Op>
+class unary_operator : public expression
+{
+ /**
+ * The subexpression for this unary operator.
+ */
+ expression_ptr subexpr;
+ valty operator()() override
+ {
+ Op op;
+ return op((*subexpr)());
+ }
+ /**
+ * All unary operators have the same precedence. They are all evaluated
+ * before binary expressions, but after parentheses.
+ */
+ int precedence() override
+ {
+ return 3;
+ }
+ public:
+ unary_operator(expression_ptr p) : subexpr(std::move(p)) {}
+#ifndef NDEBUG
+ void dump_impl() override
+ {
+ std::cerr << OpChar;
+ subexpr->dump();
+ }
+#endif
+};
+
+/**
+ * Abstract base class for binary operators. Allows the tree to be modified
+ * without knowing what the operations actually are.
+ */
+struct binary_operator_base : public expression
+{
+ /**
+ * The left side of the expression.
+ */
+ expression_ptr lhs;
+ /**
+ * The right side of the expression.
+ */
+ expression_ptr rhs;
+ /**
+ * Insert a node somewhere down the path of left children, until it would
+ * be preempting something that should execute first.
+ */
+ void insert_left(binary_operator_base *new_left)
+ {
+ if (lhs->precedence() < new_left->precedence())
+ {
+ new_left->rhs = std::move(lhs);
+ lhs.reset(new_left);
+ }
+ else
+ {
+ static_cast<binary_operator_base*>(lhs.get())->insert_left(new_left);
+ }
+ }
+};
+
+/**
+ * Template class for binary operators. The precedence and the operation are
+ * provided as template parameters.
+ */
+template<int Precedence, class Op>
+struct binary_operator : public binary_operator_base
+{
+ valty operator()() override
+ {
+ Op op;
+ return op((*lhs)(), (*rhs)());
+ }
+ int precedence() override
+ {
+ return Precedence;
+ }
+#ifdef NDEBUG
+ /**
+ * Constructor. Takes the name of the operator as an argument, for
+ * debugging. Only stores it in debug mode.
+ */
+ binary_operator(const char *) {}
+#else
+ const char *opName;
+ binary_operator(const char *o) : opName(o) {}
+ void dump_impl() override
+ {
+ lhs->dump();
+ std::cerr << opName;
+ rhs->dump();
+ }
+#endif
+};
+
+/**
+ * Ternary conditional operators (`cond ? true : false`) are a special case -
+ * there are no other ternary operators.
+ */
+class ternary_conditional_operator : public expression
+{
+ /**
+ * The condition for the clause.
+ */
+ expression_ptr cond;
+ /**
+ * The expression that this evaluates to if the condition is true.
+ */
+ expression_ptr lhs;
+ /**
+ * The expression that this evaluates to if the condition is false.
+ */
+ expression_ptr rhs;
+ valty operator()() override
+ {
+ return (*cond)() ? (*lhs)() : (*rhs)();
+ }
+ int precedence() override
+ {
+ // The actual precedence of a ternary conditional operator is 15, but
+ // its associativity is the opposite way around to the other operators,
+ // so we fudge it slightly.
+ return 3;
+ }
+#ifndef NDEBUG
+ void dump_impl() override
+ {
+ cond->dump();
+ std::cerr << " ? ";
+ lhs->dump();
+ std::cerr << " : ";
+ rhs->dump();
+ }
+#endif
+ public:
+ ternary_conditional_operator(expression_ptr c,
+ expression_ptr l,
+ expression_ptr r) :
+ cond(std::move(c)), lhs(std::move(l)), rhs(std::move(r)) {}
+};
+
+template<typename T>
+struct lshift
+{
+ constexpr T operator()(const T &lhs, const T &rhs) const
+ {
+ return lhs << rhs;
+ }
+};
+template<typename T>
+struct rshift
+{
+ constexpr T operator()(const T &lhs, const T &rhs) const
+ {
+ return lhs >> rhs;
+ }
+};
+template<typename T>
+struct unary_plus
+{
+ constexpr T operator()(const T &val) const
+ {
+ return +val;
+ }
+};
+// TODO: Replace with std::bit_not once we can guarantee C++14 as a baseline.
+template<typename T>
+struct bit_not
+{
+ constexpr T operator()(const T &val) const
+ {
+ return ~val;
+ }
+};
+
+} // anonymous namespace
+
+
+expression_ptr input_buffer::parse_binary_expression(expression_ptr lhs)
+{
+ next_token();
+ binary_operator_base *expr = nullptr;
+ char op = ((*this)[0]);
+ switch (op)
+ {
+ default:
+ return lhs;
+ case '+':
+ expr = new binary_operator<6, std::plus<valty>>("+");
+ break;
+ case '-':
+ expr = new binary_operator<6, std::minus<valty>>("-");
+ break;
+ case '%':
+ expr = new binary_operator<5, std::modulus<valty>>("%");
+ break;
+ case '*':
+ expr = new binary_operator<5, std::multiplies<valty>>("*");
+ break;
+ case '/':
+ expr = new binary_operator<5, std::divides<valty>>("/");
+ break;
+ case '<':
+ cursor++;
+ switch ((*this)[0])
+ {
+ default:
+ parse_error("Invalid operator");
+ return nullptr;
+ case ' ':
+ case '(':
+ case '0'...'9':
+ cursor--;
+ expr = new binary_operator<8, std::less<valty>>("<");
+ break;
+ case '=':
+ expr = new binary_operator<8, std::less_equal<valty>>("<=");
+ break;
+ case '<':
+ expr = new binary_operator<7, lshift<valty>>("<<");
+ break;
+ }
+ break;
+ case '>':
+ cursor++;
+ switch ((*this)[0])
+ {
+ default:
+ parse_error("Invalid operator");
+ return nullptr;
+ case '(':
+ case ' ':
+ case '0'...'9':
+ cursor--;
+ expr = new binary_operator<8, std::greater<valty>>(">");
+ break;
+ case '=':
+ expr = new binary_operator<8, std::greater_equal<valty>>(">=");
+ break;
+ case '>':
+ expr = new binary_operator<7, rshift<valty>>(">>");
+ break;
+ return lhs;
+ }
+ break;
+ case '=':
+ if ((*this)[1] != '=')
+ {
+ parse_error("Invalid operator");
+ return nullptr;
+ }
+ consume('=');
+ expr = new binary_operator<9, std::equal_to<valty>>("==");
+ break;
+ case '!':
+ if ((*this)[1] != '=')
+ {
+ parse_error("Invalid operator");
+ return nullptr;
+ }
+ cursor++;
+ expr = new binary_operator<9, std::not_equal_to<valty>>("!=");
+ break;
+ case '&':
+ if ((*this)[1] == '&')
+ {
+ expr = new binary_operator<13, std::logical_and<valty>>("&&");
+ }
+ else
+ {
+ expr = new binary_operator<10, std::bit_and<valty>>("&");
+ }
+ break;
+ case '|':
+ if ((*this)[1] == '|')
+ {
+ expr = new binary_operator<12, std::logical_or<valty>>("||");
+ }
+ else
+ {
+ expr = new binary_operator<14, std::bit_or<valty>>("|");
+ }
+ break;
+ case '?':
+ {
+ consume('?');
+ expression_ptr true_case = parse_expression();
+ next_token();
+ if (!true_case || !consume(':'))
+ {
+ parse_error("Expected : in ternary conditional operator");
+ return nullptr;
+ }
+ expression_ptr false_case = parse_expression();
+ if (!false_case)
+ {
+ parse_error("Expected false condition for ternary operator");
+ return nullptr;
+ }
+ return expression_ptr(new ternary_conditional_operator(std::move(lhs),
+ std::move(true_case), std::move(false_case)));
+ }
+ }
+ cursor++;
+ next_token();
+ expression_ptr e(expr);
+ expression_ptr rhs(parse_expression());
+ if (!rhs)
+ {
+ return nullptr;
+ }
+ expr->lhs = std::move(lhs);
+ if (rhs->precedence() < expr->precedence())
+ {
+ expr->rhs = std::move(rhs);
+ }
+ else
+ {
+ // If we're a normal left-to-right expression, then we need to insert
+ // this as the far-left child node of the rhs expression
+ binary_operator_base *rhs_op =
+ static_cast<binary_operator_base*>(rhs.get());
+ rhs_op->insert_left(expr);
+ e.release();
+ return rhs;
+ }
+ return e;
+}
+
+expression_ptr input_buffer::parse_expression(bool stopAtParen)
+{
+ next_token();
+ unsigned long long leftVal;
+ expression_ptr lhs;
+ switch ((*this)[0])
+ {
+ case '0'...'9':
+ if (!consume_integer(leftVal))
+ {
+ return nullptr;
+ }
+ lhs.reset(new terminal_expr(leftVal));
+ break;
+ case '(':
+ {
+ consume('(');
+ expression_ptr &&subexpr = parse_expression();
+ if (!subexpr)
+ {
+ return nullptr;
+ }
+ lhs.reset(new paren_expression(std::move(subexpr)));
+ if (!consume(')'))
+ {
+ return nullptr;
+ }
+ if (stopAtParen)
+ {
+ return lhs;
+ }
+ break;
+ }
+ case '+':
+ {
+ consume('+');
+ expression_ptr &&subexpr = parse_expression();
+ if (!subexpr)
+ {
+ return nullptr;
+ }
+ lhs.reset(new unary_operator<'+', unary_plus<valty>>(std::move(subexpr)));
+ break;
+ }
+ case '-':
+ {
+ consume('-');
+ expression_ptr &&subexpr = parse_expression();
+ if (!subexpr)
+ {
+ return nullptr;
+ }
+ lhs.reset(new unary_operator<'-', std::negate<valty>>(std::move(subexpr)));
+ break;
+ }
+ case '!':
+ {
+ consume('!');
+ expression_ptr &&subexpr = parse_expression();
+ if (!subexpr)
+ {
+ return nullptr;
+ }
+ lhs.reset(new unary_operator<'!', std::logical_not<valty>>(std::move(subexpr)));
+ break;
+ }
+ case '~':
+ {
+ consume('~');
+ expression_ptr &&subexpr = parse_expression();
+ if (!subexpr)
+ {
+ return nullptr;
+ }
+ lhs.reset(new unary_operator<'~', bit_not<valty>>(std::move(subexpr)));
+ break;
+ }
+ }
+ if (!lhs)
+ {
+ return nullptr;
+ }
+ return parse_binary_expression(std::move(lhs));
+}
+
+bool
+input_buffer::consume_integer_expression(unsigned long long &outInt)
+{
+ switch ((*this)[0])
+ {
+ case '(':
+ {
+ expression_ptr e(parse_expression(true));
+ if (!e)
+ {
+ return false;
+ }
+ outInt = (*e)();
+ return true;
+ }
+ case '0'...'9':
+ return consume_integer(outInt);
+ default:
+ return false;
+ }
+}
+
+bool
+input_buffer::consume_hex_byte(uint8_t &outByte)
+{
+ if (!ishexdigit((*this)[0]) && !ishexdigit((*this)[1]))
+ {
+ return false;
+ }
+ outByte = (digittoint((*this)[0]) << 4) | digittoint((*this)[1]);
+ cursor += 2;
+ return true;
+}
+
+input_buffer&
+input_buffer::next_token()
+{
+ int start;
+ do {
+ start = cursor;
+ skip_spaces();
+ // Parse /* comments
+ if ((*this)[0] == '/' && (*this)[1] == '*')
+ {
+ // eat the start of the comment
+ ++(*this);
+ ++(*this);
+ do {
+ // Find the ending * of */
+ while ((**this != '\0') && (**this != '*'))
+ {
+ ++(*this);
+ }
+ // Eat the *
+ ++(*this);
+ } while ((**this != '\0') && (**this != '/'));
+ // Eat the /
+ ++(*this);
+ }
+ // Parse // comments
+ if (((*this)[0] == '/' && (*this)[1] == '/'))
+ {
+ // eat the start of the comment
+ ++(*this);
+ ++(*this);
+ // Find the ending of the line
+ while (**this != '\n')
+ {
+ ++(*this);
+ }
+ // Eat the \n
+ ++(*this);
+ }
+ } while (start != cursor);
+ return *this;
+}
+
+void
+input_buffer::parse_error(const char *msg)
+{
+ int line_count = 1;
+ int line_start = 0;
+ int line_end = cursor;
+ for (int i=cursor ; i>0 ; --i)
+ {
+ if (buffer[i] == '\n')
+ {
+ line_count++;
+ if (line_start == 0)
+ {
+ line_start = i+1;
+ }
+ }
+ }
+ for (int i=cursor+1 ; i<size ; ++i)
+ {
+ if (buffer[i] == '\n')
+ {
+ line_end = i;
+ break;
+ }
+ }
+ fprintf(stderr, "Error on line %d: %s\n", line_count, msg);
+ fwrite(&buffer[line_start], line_end-line_start, 1, stderr);
+ putc('\n', stderr);
+ for (int i=0 ; i<(cursor-line_start) ; ++i)
+ {
+ char c = (buffer[i+line_start] == '\t') ? '\t' : ' ';
+ putc(c, stderr);
+ }
+ putc('^', stderr);
+ putc('\n', stderr);
+}
+#ifndef NDEBUG
+void
+input_buffer::dump()
+{
+ fprintf(stderr, "Current cursor: %d\n", cursor);
+ fwrite(&buffer[cursor], size-cursor, 1, stderr);
+}
+#endif
+
+mmap_input_buffer::mmap_input_buffer(int fd) : input_buffer(0, 0)
+{
+ struct stat sb;
+ if (fstat(fd, &sb))
+ {
+ perror("Failed to stat file");
+ }
+ size = sb.st_size;
+ buffer = (const char*)mmap(0, size, PROT_READ, MAP_PRIVATE |
+ MAP_PREFAULT_READ, fd, 0);
+ if (buffer == MAP_FAILED)
+ {
+ perror("Failed to mmap file");
+ exit(EXIT_FAILURE);
+ }
+}
+
+mmap_input_buffer::~mmap_input_buffer()
+{
+ if (buffer != 0)
+ {
+ munmap((void*)buffer, size);
+ }
+}
+
+stream_input_buffer::stream_input_buffer() : input_buffer(0, 0)
+{
+ int c;
+ while ((c = fgetc(stdin)) != EOF)
+ {
+ b.push_back(c);
+ }
+ buffer = b.data();
+ size = b.size();
+}
+
+} // namespace dtc
+
diff --git a/usr.bin/dtc/input_buffer.hh b/usr.bin/dtc/input_buffer.hh
new file mode 100644
index 0000000..1a87911
--- /dev/null
+++ b/usr.bin/dtc/input_buffer.hh
@@ -0,0 +1,316 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _INPUT_BUFFER_HH_
+#define _INPUT_BUFFER_HH_
+#include "util.hh"
+#include <assert.h>
+
+namespace dtc
+{
+
+namespace {
+struct expression;
+typedef std::unique_ptr<expression> expression_ptr;
+}
+
+/**
+ * Class encapsulating the input file. Can be used as a const char*, but has
+ * range checking. Attempting to access anything out of range will return a 0
+ * byte. The input buffer can be cheaply copied, without copying the
+ * underlying memory, however it is the user's responsibility to ensure that
+ * such copies do not persist beyond the lifetime of the underlying memory.
+ *
+ * This also contains methods for reporting errors and for consuming the token
+ * stream.
+ */
+class input_buffer
+{
+ protected:
+ /**
+ * The buffer. This class doesn't own the buffer, but the
+ * mmap_input_buffer subclass does.
+ */
+ const char* buffer;
+ /**
+ * The size of the buffer.
+ */
+ int size;
+ private:
+ /**
+ * Parse an expression. If `stopAtParen` is set, then only parse a number
+ * or a parenthetical expression, otherwise assume that either is the
+ * left-hand side of a binary expression and try to parse the right-hand
+ * side.
+ */
+ expression_ptr parse_expression(bool stopAtParen=false);
+ /**
+ * Parse a binary expression, having already parsed the right-hand side.
+ */
+ expression_ptr parse_binary_expression(expression_ptr lhs);
+ /**
+ * The current place in the buffer where we are reading. This class
+ * keeps a separate size, pointer, and cursor so that we can move
+ * forwards and backwards and still have checks that we haven't fallen
+ * off either end.
+ */
+ int cursor;
+ /**
+ * Private constructor. This is used to create input buffers that
+ * refer to the same memory, but have different cursors.
+ */
+ input_buffer(const char* b, int s, int c) : buffer(b), size(s),
+ cursor(c) {}
+ /**
+ * Reads forward past any spaces. The DTS format is not whitespace
+ * sensitive and so we want to scan past whitespace when reading it.
+ */
+ void skip_spaces();
+ public:
+ /**
+ * Return whether all input has been consumed.
+ */
+ bool finished() { return cursor >= size; }
+ /**
+ * Virtual destructor. Does nothing, but exists so that subclasses
+ * that own the memory can run cleanup code for deallocating it.
+ */
+ virtual ~input_buffer() {};
+ /**
+ * Constructs an empty buffer.
+ */
+ input_buffer() : buffer(0), size(0), cursor(0) {}
+ /**
+ * Constructs a new buffer with a specified memory region and size.
+ */
+ input_buffer(const char* b, int s) : buffer(b), size(s), cursor(0){}
+ /**
+ * Returns a new input buffer referring into this input, clamped to the
+ * specified size. If the requested buffer would fall outside the
+ * range of this one, then it returns an empty buffer.
+ *
+ * The returned buffer shares the same underlying storage as the
+ * original. This is intended to be used for splitting up the various
+ * sections of a device tree blob. Requesting a size of 0 will give a
+ * buffer that extends to the end of the available memory.
+ */
+ input_buffer buffer_from_offset(int offset, int s=0);
+ /**
+ * Returns true if this buffer has no unconsumed space in it.
+ */
+ inline bool empty()
+ {
+ return cursor >= size;
+ }
+ /**
+ * Dereferencing operator, allows the buffer to be treated as a char*
+ * and dereferenced to give a character. This returns a null byte if
+ * the cursor is out of range.
+ */
+ inline char operator*()
+ {
+ if (cursor >= size) { return '\0'; }
+ if (cursor < 0) { return '\0'; }
+ return buffer[cursor];
+ }
+ /**
+ * Array subscripting operator, returns a character at the specified
+ * index offset from the current cursor. The offset may be negative,
+ * to reread characters that have already been read. If the current
+ * cursor plus offset is outside of the range, this returns a nul
+ * byte.
+ */
+ inline char operator[](int offset)
+ {
+ if (cursor + offset >= size) { return '\0'; }
+ if (cursor + offset < 0) { return '\0'; }
+ return buffer[cursor + offset];
+ }
+ /**
+ * Increments the cursor, iterating forward in the buffer.
+ */
+ inline input_buffer &operator++()
+ {
+ cursor++;
+ return *this;
+ }
+ /**
+ * Cast to char* operator. Returns a pointer into the buffer that can
+ * be used for constructing strings.
+ */
+ inline operator const char*()
+ {
+ if (cursor >= size) { return 0; }
+ if (cursor < 0) { return 0; }
+ return &buffer[cursor];
+ }
+ /**
+ * Consumes a character. Moves the cursor one character forward if the
+ * next character matches the argument, returning true. If the current
+ * character does not match the argument, returns false.
+ */
+ inline bool consume(char c)
+ {
+ if ((*this)[0] == c)
+ {
+ ++(*this);
+ return true;
+ }
+ return false;
+ }
+ /**
+ * Consumes a string. If the (null-terminated) string passed as the
+ * argument appears in the input, advances the cursor to the end and
+ * returns true. Returns false if the string does not appear at the
+ * current point in the input.
+ */
+ bool consume(const char *str);
+ /**
+ * Reads an integer in base 8, 10, or 16. Returns true and advances
+ * the cursor to the end of the integer if the cursor points to an
+ * integer, returns false and does not move the cursor otherwise.
+ *
+ * The parsed value is returned via the argument.
+ */
+ bool consume_integer(unsigned long long &outInt);
+ /**
+ * Reads an arithmetic expression (containing any of the normal C
+ * operators), evaluates it, and returns the result.
+ */
+ bool consume_integer_expression(unsigned long long &outInt);
+ /**
+ * Template function that consumes a binary value in big-endian format
+ * from the input stream. Returns true and advances the cursor if
+ * there is a value of the correct size. This function assumes that
+ * all values must be natively aligned, and so advances the cursor to
+ * the correct alignment before reading.
+ */
+ template<typename T>
+ bool consume_binary(T &out)
+ {
+ int align = 0;
+ int type_size = sizeof(T);
+ if (cursor % type_size != 0)
+ {
+ align = type_size - (cursor % type_size);
+ }
+ if (size < cursor + align + type_size)
+ {
+ return false;
+ }
+ cursor += align;
+ assert(cursor % type_size == 0);
+ out = 0;
+ for (int i=0 ; i<type_size ; ++i)
+ {
+ out <<= 8;
+ out |= (((T)buffer[cursor++]) & 0xff);
+ }
+ return true;
+ }
+ /**
+ * Consumes two hex digits and return the resulting byte via the first
+ * argument. If the next two characters are hex digits, returns true
+ * and advances the cursor. If not, then returns false and leaves the
+ * cursor in place.
+ */
+ bool consume_hex_byte(uint8_t &outByte);
+ /**
+ * Advances the cursor to the start of the next token, skipping
+ * comments and whitespace. If the cursor already points to the start
+ * of a token, then this function does nothing.
+ */
+ input_buffer &next_token();
+ /**
+ * Prints a message indicating the location of a parse error.
+ */
+ void parse_error(const char *msg);
+#ifndef NDEBUG
+ /**
+ * Dumps the current cursor value and the unconsumed values in the
+ * input buffer to the standard error. This method is intended solely
+ * for debugging.
+ */
+ void dump();
+#endif
+};
+/**
+ * Explicit specialisation for reading a single byte.
+ */
+template<>
+inline bool input_buffer::consume_binary(uint8_t &out)
+{
+ if (size < cursor + 1)
+ {
+ return false;
+ }
+ out = buffer[cursor++];
+ return true;
+}
+
+/**
+ * Subclass of input_buffer that mmap()s a file and owns the resulting memory.
+ * When this object is destroyed, the memory is unmapped.
+ */
+struct mmap_input_buffer : public input_buffer
+{
+ /**
+ * Constructs a new buffer from the file passed in as a file
+ * descriptor.
+ */
+ mmap_input_buffer(int fd);
+ /**
+ * Unmaps the buffer, if one exists.
+ */
+ virtual ~mmap_input_buffer();
+};
+/**
+ * Input buffer read from standard input. This is used for reading device tree
+ * blobs and source from standard input. It reads the entire input into
+ * malloc'd memory, so will be very slow for large inputs. DTS and DTB files
+ * are very rarely more than 10KB though, so this is probably not a problem.
+ */
+struct stream_input_buffer : public input_buffer
+{
+ /**
+ * The buffer that will store the data read from the standard input.
+ */
+ std::vector<char> b;
+ /**
+ * Constructs a new buffer from the standard input.
+ */
+ stream_input_buffer();
+};
+
+} // namespace dtc
+
+#endif // !_INPUT_BUFFER_HH_
diff --git a/usr.bin/dtc/string.cc b/usr.bin/dtc/string.cc
new file mode 100644
index 0000000..283bafa
--- /dev/null
+++ b/usr.bin/dtc/string.cc
@@ -0,0 +1,258 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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$
+ */
+
+#include "string.hh"
+#include <ctype.h>
+#include <stdio.h>
+
+namespace
+{
+/**
+ * The source files are ASCII, so we provide a non-locale-aware version of
+ * isalpha. This is a class so that it can be used with a template function
+ * for parsing strings.
+ */
+struct is_alpha
+{
+ static inline bool check(const char c)
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') &&
+ (c <= 'Z'));
+ }
+};
+/**
+ * Check whether a character is in the set allowed for node names. This is a
+ * class so that it can be used with a template function for parsing strings.
+ */
+struct is_node_name_character
+{
+ static inline bool check(const char c)
+ {
+ switch(c)
+ {
+ default:
+ return false;
+ case 'a'...'z': case 'A'...'Z': case '0'...'9':
+ case ',': case '.': case '+': case '-':
+ case '_':
+ return true;
+ }
+ }
+};
+/**
+ * Check whether a character is in the set allowed for property names. This is
+ * a class so that it can be used with a template function for parsing strings.
+ */
+struct is_property_name_character
+{
+ static inline bool check(const char c)
+ {
+ switch(c)
+ {
+ default:
+ return false;
+ case 'a'...'z': case 'A'...'Z': case '0'...'9':
+ case ',': case '.': case '+': case '-':
+ case '_': case '#':
+ return true;
+ }
+ }
+};
+
+}
+
+namespace dtc
+{
+
+template<class T> string
+string::parse(input_buffer &s)
+{
+ const char *start = s;
+ int l=0;
+ while (T::check(*s)) { l++; ++s; }
+ return string(start, l);
+}
+
+string::string(input_buffer &s) : start((const char*)s), length(0)
+{
+ while(s[length] != '\0')
+ {
+ length++;
+ }
+}
+
+string
+string::parse_node_name(input_buffer &s)
+{
+ return parse<is_node_name_character>(s);
+}
+
+string
+string::parse_property_name(input_buffer &s)
+{
+ return parse<is_property_name_character>(s);
+}
+string
+string::parse_node_or_property_name(input_buffer &s, bool &is_property)
+{
+ if (is_property)
+ {
+ return parse_property_name(s);
+ }
+ const char *start = s;
+ int l=0;
+ while (is_node_name_character::check(*s))
+ {
+ l++;
+ ++s;
+ }
+ while (is_property_name_character::check(*s))
+ {
+ l++;
+ ++s;
+ is_property = true;
+ }
+ return string(start, l);
+}
+
+bool
+string::operator==(const string& other) const
+{
+ return (length == other.length) &&
+ (memcmp(start, other.start, length) == 0);
+}
+
+bool
+string::operator==(const char *other) const
+{
+ return strncmp(other, start, length) == 0;
+}
+
+bool
+string::operator<(const string& other) const
+{
+ if (length < other.length) { return true; }
+ if (length > other.length) { return false; }
+ return memcmp(start, other.start, length) < 0;
+}
+
+void
+string::push_to_buffer(byte_buffer &buffer, bool escapes)
+{
+ for (int i=0 ; i<length ; ++i)
+ {
+ uint8_t c = start[i];
+ if (escapes && c == '\\' && i+1 < length)
+ {
+ c = start[++i];
+ switch (c)
+ {
+ // For now, we just ignore invalid escape sequences.
+ default:
+ case '"':
+ case '\'':
+ case '\\':
+ break;
+ case 'a':
+ c = '\a';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case '0'...'7':
+ {
+ int v = digittoint(c);
+ if (i+1 < length && start[i+1] <= '7' && start[i+1] >= '0')
+ {
+ v <<= 3;
+ v |= digittoint(start[i+1]);
+ i++;
+ if (i+1 < length && start[i+1] <= '7' && start[i+1] >= '0')
+ {
+ v <<= 3;
+ v |= digittoint(start[i+1]);
+ }
+ }
+ c = (uint8_t)v;
+ break;
+ }
+ case 'x':
+ {
+ ++i;
+ if (i >= length)
+ {
+ break;
+ }
+ int v = digittoint(start[i]);
+ if (i+1 < length && ishexdigit(start[i+1]))
+ {
+ v <<= 4;
+ v |= digittoint(start[++i]);
+ }
+ c = (uint8_t)v;
+ break;
+ }
+ }
+ }
+ buffer.push_back(c);
+ }
+}
+
+void
+string::print(FILE *file)
+{
+ fwrite(start, length, 1, file);
+}
+
+void
+string::dump()
+{
+ print(stderr);
+}
+
+} // namespace dtc
+
diff --git a/usr.bin/dtc/string.hh b/usr.bin/dtc/string.hh
new file mode 100644
index 0000000..f6acc1b
--- /dev/null
+++ b/usr.bin/dtc/string.hh
@@ -0,0 +1,164 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _STRING_HH_
+#define _STRING_HH_
+#include "input_buffer.hh"
+#include <string>
+#include <functional>
+
+namespace dtc
+{
+
+/**
+ * String, referring to a place in the input file. We don't bother copying
+ * strings until we write them to the final output. These strings should be
+ * two words long: a start and a length. They are intended to be cheap to copy
+ * and store in collections. Copying the string object does not copy the
+ * underlying storage.
+ *
+ * Strings are not nul-terminated.
+ */
+class string
+{
+ friend std::hash<string>;
+ /** Start address. Contained within the mmap()'d input file and not
+ * owned by this object. */
+ const char *start;
+ /** length of the string. DTS strings are allowed to contain nuls */
+ int length;
+ /** Generic function for parsing strings matching the character set
+ * defined by the template argument. */
+ template<class T>
+ static string parse(input_buffer &s);
+ public:
+ /**
+ * Constructs a string referring into another buffer.
+ */
+ string(const char *s, int l) : start(s), length(l) {}
+ /** Constructs a string from a C string. */
+ string(const char *s) : start(s), length(strlen(s)) {}
+ /** Default constructor, returns an empty string. */
+ string() : start(0), length(0) {}
+ /** Construct a from an input buffer, ending with a nul terminator. */
+ string(input_buffer &s);
+ /**
+ * Returns the longest string in the input buffer starting at the
+ * current cursor and composed entirely of characters that are valid in
+ * node names.
+ */
+ static string parse_node_name(input_buffer &s);
+ /**
+ * Returns the longest string in the input buffer starting at the
+ * current cursor and composed entirely of characters that are valid in
+ * property names.
+ */
+ static string parse_property_name(input_buffer &s);
+ /**
+ * Parses either a node or a property name. If is_property is true on
+ * entry, then only property names are parsed. If it is false, then it
+ * will be set, on return, to indicate whether the parsed name is only
+ * valid as a property.
+ */
+ static string parse_node_or_property_name(input_buffer &s,
+ bool &is_property);
+ /**
+ * Compares two strings for equality. Strings are equal if they refer
+ * to identical byte sequences.
+ */
+ bool operator==(const string& other) const;
+ /**
+ * Compares a string against a C string. The trailing nul in the C
+ * string is ignored for the purpose of comparison, so this will always
+ * fail if the string contains nul bytes.
+ */
+ bool operator==(const char *other) const;
+ /**
+ * Inequality operator, defined as the inverse of the equality
+ * operator.
+ */
+ template <typename T>
+ inline bool operator!=(T other)
+ {
+ return !(*this == other);
+ }
+ /**
+ * Comparison operator, defined to allow strings to be used as keys in
+ * maps.
+ */
+ bool operator<(const string& other) const;
+ /**
+ * Returns true if this is the empty string, false otherwise.
+ */
+ inline bool empty() const
+ {
+ return length == 0;
+ }
+ /**
+ * Returns the size of the string, in bytes.
+ */
+ inline size_t size()
+ {
+ return length;
+ }
+ /**
+ * Writes the string to the specified buffer.
+ */
+ void push_to_buffer(byte_buffer &buffer, bool escapes=false);
+ /**
+ * Prints the string to the specified output stream.
+ */
+ void print(FILE *file);
+ /**
+ * Dumps the string to the standard error stream. Intended to be used
+ * for debugging.
+ */
+ void dump();
+};
+
+} // namespace dtc
+namespace std
+{
+ template<>
+ struct hash<dtc::string>
+ {
+ std::size_t operator()(dtc::string const& s) const
+ {
+ std::string str(s.start, s.length);
+ std::hash<std::string> h;
+ return h(str);
+ }
+ };
+}
+
+
+#endif // !_STRING_HH_
diff --git a/usr.bin/dtc/util.hh b/usr.bin/dtc/util.hh
new file mode 100644
index 0000000..7f2ec67
--- /dev/null
+++ b/usr.bin/dtc/util.hh
@@ -0,0 +1,92 @@
+/*-
+ * Copyright (c) 2013 David Chisnall
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 _UTIL_HH_
+#define _UTIL_HH_
+
+#include <vector>
+
+// If we aren't using C++11, then just ignore static asserts.
+#if __cplusplus < 201103L
+#ifndef static_assert
+#define static_assert(x, y) ((void)0)
+#endif
+#endif
+
+namespace dtc {
+
+/**
+ * Type for a buffer of bytes. This is used for a lot of short-lived temporary
+ * variables, so may eventually be changed to something like LLVM's
+ * SmallVector, but currently the program runs in a tiny fraction of a second,
+ * so this is not an issue.
+ */
+typedef std::vector<uint8_t> byte_buffer;
+
+/**
+ * Helper function to push a big endian value into a byte buffer. We use
+ * native-endian values for all of the in-memory data structures and only
+ * transform them into big endian form for output.
+ */
+template<typename T>
+inline void push_big_endian(byte_buffer &v, T val)
+{
+ static_assert(sizeof(T) > 1,
+ "Big endian doesn't make sense for single-byte values");
+ for (int bit=(sizeof(T) - 1)*8 ; bit>=0 ; bit-= 8)
+ {
+ v.push_back((val >> bit) & 0xff);
+ }
+}
+
+/**
+ * Simple inline non-locale-aware check that this is a valid ASCII
+ * digit.
+ */
+inline bool isdigit(char c)
+{
+ return (c >= '0') && (c <= '9');
+}
+
+/**
+ * Simple inline non-locale-aware check that this is a valid ASCII
+ * hex digit.
+ */
+inline bool ishexdigit(char c)
+{
+ return ((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) ||
+ ((c >= 'A') && (c <= 'Z'));
+}
+
+}// namespace dtc
+
+#endif // !_UTIL_HH_
diff --git a/usr.bin/du/Makefile b/usr.bin/du/Makefile
new file mode 100644
index 0000000..9f96ec6
--- /dev/null
+++ b/usr.bin/du/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= du
+LIBADD= util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/du/Makefile.depend b/usr.bin/du/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/du/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1
new file mode 100644
index 0000000..e1224c9
--- /dev/null
+++ b/usr.bin/du/du.1
@@ -0,0 +1,222 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)du.1 8.2 (Berkeley) 4/1/94
+.\" $FreeBSD$
+.\"
+.Dd November 4, 2012
+.Dt DU 1
+.Os
+.Sh NAME
+.Nm du
+.Nd display disk usage statistics
+.Sh SYNOPSIS
+.Nm
+.Op Fl Aclnx
+.Op Fl H | L | P
+.Op Fl g | h | k | m
+.Op Fl a | s | d Ar depth
+.Op Fl B Ar blocksize
+.Op Fl I Ar mask
+.Op Fl t Ar threshold
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the file system block usage for each file argument
+and for each directory in the file hierarchy rooted in each directory
+argument.
+If no file is specified, the block usage of the hierarchy rooted in
+the current directory is displayed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl A
+Display the apparent size instead of the disk usage.
+This can be helpful when operating on compressed volumes or sparse files.
+.It Fl B Ar blocksize
+Calculate block counts in
+.Ar blocksize
+byte blocks.
+This is different from the
+.Fl h, k, m
+and
+.Fl g
+options or setting
+.Ev BLOCKSIZE
+and gives an estimate of how much space the examined file hierarchy would
+require on a filesystem with the given
+.Ar blocksize .
+Unless in
+.Fl A
+mode,
+.Ar blocksize
+is rounded up to the next multiple of 512.
+.It Fl H
+Symbolic links on the command line are followed, symbolic links in file
+hierarchies are not followed.
+.It Fl I Ar mask
+Ignore files and directories matching the specified
+.Ar mask .
+.It Fl L
+Symbolic links on the command line and in file hierarchies are followed.
+.It Fl P
+No symbolic links are followed.
+This is the default.
+.It Fl a
+Display an entry for each file in a file hierarchy.
+.It Fl c
+Display a grand total.
+.It Fl d Ar depth
+Display an entry for all files and directories
+.Ar depth
+directories deep.
+.It Fl g
+Display block counts in 1073741824-byte (1 GiB) blocks.
+.It Fl h
+.Dq Human-readable
+output.
+Use unit suffixes: Byte, Kilobyte, Megabyte,
+Gigabyte, Terabyte and Petabyte.
+.It Fl k
+Display block counts in 1024-byte (1 kiB) blocks.
+.It Fl l
+If a file has multiple hard links, count its size multiple times.
+The default behavior of
+.Nm
+is to count files with multiple hard links only once.
+When the
+.Fl l
+option is specified, the hard link checks are disabled, and these files
+are counted (and displayed) as many times as they are found.
+.It Fl m
+Display block counts in 1048576-byte (1 MiB) blocks.
+.It Fl n
+Ignore files and directories with user
+.Dq nodump
+flag
+.Pq Dv UF_NODUMP
+set.
+.It Fl r
+Generate messages about directories that cannot be read, files
+that cannot be opened, and so on.
+This is the default case.
+This option exists solely for conformance with
+.St -xpg4 .
+.It Fl s
+Display an entry for each specified file.
+(Equivalent to
+.Fl d Li 0 )
+.It Fl t Ar threshold
+Display only entries for which size exceeds
+.Ar threshold .
+If
+.Ar threshold
+is negative, display only entries for which size is less than the absolute
+value of
+.Ar threshold .
+.It Fl x
+File system mount points are not traversed.
+.El
+.Pp
+The
+.Nm
+utility counts the storage used by symbolic links and not the files they
+reference unless the
+.Fl H
+or
+.Fl L
+option is specified.
+If either the
+.Fl H
+or
+.Fl L
+option is specified, storage used by any symbolic links which are
+followed is not counted (or displayed).
+The
+.Fl H ,
+.Fl L
+and
+.Fl P
+options override each other and the command's actions are determined
+by the last one specified.
+.Pp
+The
+.Fl h, k
+and
+.Fl m
+options all override each other; the last one specified determines
+the block counts used.
+.Sh ENVIRONMENT
+.Bl -tag -width BLOCKSIZE
+.It Ev BLOCKSIZE
+If the environment variable
+.Ev BLOCKSIZE
+is set, and the
+.Fl h, k
+or
+.Fl m
+options are not specified, the block counts will be displayed in units of
+that block size.
+If
+.Ev BLOCKSIZE
+is not set, and the
+.Fl h, k
+or
+.Fl m
+options are not specified, the block counts will be displayed in 512-byte
+blocks.
+.El
+.Sh EXAMPLES
+Show disk usage for all files in the current directory.
+Output is in human-readable form:
+.Pp
+.Dl # du -ah
+.Pp
+Summarize disk usage in the current directory:
+.Pp
+.Dl # du -hs
+.Pp
+Summarize disk usage for a specific directory:
+.Pp
+.Dl # du -hs /home
+.Pp
+Show name and size of all C files in a specific directory.
+Also display a grand total at the end:
+.Pp
+.Dl # du -ch /usr/src/sys/kern/*.c
+.Sh SEE ALSO
+.Xr df 1 ,
+.Xr chflags 2 ,
+.Xr fts 3 ,
+.Xr symlink 7 ,
+.Xr quot 8
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
new file mode 100644
index 0000000..506c3f5
--- /dev/null
+++ b/usr.bin/du/du.c
@@ -0,0 +1,544 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Newcomb.
+ *
+ * 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) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static const char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fnmatch.h>
+#include <fts.h>
+#include <libutil.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+static SLIST_HEAD(ignhead, ignentry) ignores;
+struct ignentry {
+ char *mask;
+ SLIST_ENTRY(ignentry) next;
+};
+
+static int linkchk(FTSENT *);
+static void usage(void);
+static void prthumanval(int64_t);
+static void ignoreadd(const char *);
+static void ignoreclean(void);
+static int ignorep(FTSENT *);
+static void siginfo(int __unused);
+
+static int nodumpflag = 0;
+static int Aflag;
+static long blocksize, cblocksize;
+static volatile sig_atomic_t info;
+
+int
+main(int argc, char *argv[])
+{
+ FTS *fts;
+ FTSENT *p;
+ off_t savednumber, curblocks;
+ off_t threshold, threshold_sign;
+ int ftsoptions;
+ int depth;
+ int Hflag, Lflag, aflag, sflag, dflag, cflag;
+ int hflag, lflag, ch, notused, rval;
+ char **save;
+ static char dot[] = ".";
+
+ setlocale(LC_ALL, "");
+
+ Hflag = Lflag = aflag = sflag = dflag = cflag = hflag =
+ lflag = Aflag = 0;
+
+ save = argv;
+ ftsoptions = FTS_PHYSICAL;
+ savednumber = 0;
+ threshold = 0;
+ threshold_sign = 1;
+ cblocksize = DEV_BSIZE;
+ blocksize = 0;
+ depth = INT_MAX;
+ SLIST_INIT(&ignores);
+
+ while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1)
+ switch (ch) {
+ case 'A':
+ Aflag = 1;
+ break;
+ case 'B':
+ errno = 0;
+ cblocksize = atoi(optarg);
+ if (errno == ERANGE || cblocksize <= 0) {
+ warnx("invalid argument to option B: %s",
+ optarg);
+ usage();
+ }
+ break;
+ case 'H':
+ Hflag = 1;
+ Lflag = 0;
+ break;
+ case 'I':
+ ignoreadd(optarg);
+ break;
+ case 'L':
+ Lflag = 1;
+ Hflag = 0;
+ break;
+ case 'P':
+ Hflag = Lflag = 0;
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ errno = 0;
+ depth = atoi(optarg);
+ if (errno == ERANGE || depth < 0) {
+ warnx("invalid argument to option d: %s",
+ optarg);
+ usage();
+ }
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'g':
+ hflag = 0;
+ blocksize = 1073741824;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'k':
+ hflag = 0;
+ blocksize = 1024;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'm':
+ hflag = 0;
+ blocksize = 1048576;
+ break;
+ case 'n':
+ nodumpflag = 1;
+ break;
+ case 'r': /* Compatibility. */
+ break;
+ case 't' :
+ if (expand_number(optarg, &threshold) != 0 ||
+ threshold == 0) {
+ warnx("invalid threshold: %s", optarg);
+ usage();
+ } else if (threshold < 0)
+ threshold_sign = -1;
+ break;
+ case 'x':
+ ftsoptions |= FTS_XDEV;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ /*
+ * XXX
+ * Because of the way that fts(3) works, logical walks will not count
+ * the blocks actually used by symbolic links. We rationalize this by
+ * noting that users computing logical sizes are likely to do logical
+ * copies, so not counting the links is correct. The real reason is
+ * that we'd have to re-implement the kernel's symbolic link traversing
+ * algorithm to get this right. If, for example, you have relative
+ * symbolic links referencing other relative symbolic links, it gets
+ * very nasty, very fast. The bottom line is that it's documented in
+ * the man page, so it's a feature.
+ */
+
+ if (Hflag)
+ ftsoptions |= FTS_COMFOLLOW;
+ if (Lflag) {
+ ftsoptions &= ~FTS_PHYSICAL;
+ ftsoptions |= FTS_LOGICAL;
+ }
+
+ if (!Aflag && (cblocksize % DEV_BSIZE) != 0)
+ cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE;
+
+ if (aflag + dflag + sflag > 1)
+ usage();
+ if (sflag)
+ depth = 0;
+
+ if (!*argv) {
+ argv = save;
+ argv[0] = dot;
+ argv[1] = NULL;
+ }
+
+ if (blocksize == 0)
+ (void)getbsize(&notused, &blocksize);
+
+ if (!Aflag) {
+ cblocksize /= DEV_BSIZE;
+ blocksize /= DEV_BSIZE;
+ }
+
+ if (threshold != 0)
+ threshold = howmany(threshold / DEV_BSIZE * cblocksize,
+ blocksize);
+
+ rval = 0;
+
+ (void)signal(SIGINFO, siginfo);
+
+ if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
+ err(1, "fts_open");
+
+ while ((p = fts_read(fts)) != NULL) {
+ switch (p->fts_info) {
+ case FTS_D: /* Ignore. */
+ if (ignorep(p))
+ fts_set(fts, p, FTS_SKIP);
+ break;
+ case FTS_DP:
+ if (ignorep(p))
+ break;
+
+ curblocks = Aflag ?
+ howmany(p->fts_statp->st_size, cblocksize) :
+ howmany(p->fts_statp->st_blocks, cblocksize);
+ p->fts_parent->fts_bignum += p->fts_bignum +=
+ curblocks;
+
+ if (p->fts_level <= depth && threshold <=
+ threshold_sign * howmany(p->fts_bignum *
+ cblocksize, blocksize)) {
+ if (hflag) {
+ prthumanval(p->fts_bignum);
+ (void)printf("\t%s\n", p->fts_path);
+ } else {
+ (void)printf("%jd\t%s\n",
+ (intmax_t)howmany(p->fts_bignum *
+ cblocksize, blocksize),
+ p->fts_path);
+ }
+ }
+ if (info) {
+ info = 0;
+ (void)printf("\t%s\n", p->fts_path);
+ }
+ break;
+ case FTS_DC: /* Ignore. */
+ break;
+ case FTS_DNR: /* Warn, continue. */
+ case FTS_ERR:
+ case FTS_NS:
+ warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
+ rval = 1;
+ break;
+ default:
+ if (ignorep(p))
+ break;
+
+ if (lflag == 0 && p->fts_statp->st_nlink > 1 &&
+ linkchk(p))
+ break;
+
+ curblocks = Aflag ?
+ howmany(p->fts_statp->st_size, cblocksize) :
+ howmany(p->fts_statp->st_blocks, cblocksize);
+
+ if (aflag || p->fts_level == 0) {
+ if (hflag) {
+ prthumanval(curblocks);
+ (void)printf("\t%s\n", p->fts_path);
+ } else {
+ (void)printf("%jd\t%s\n",
+ (intmax_t)howmany(curblocks *
+ cblocksize, blocksize),
+ p->fts_path);
+ }
+ }
+
+ p->fts_parent->fts_bignum += curblocks;
+ }
+ savednumber = p->fts_parent->fts_bignum;
+ }
+
+ if (errno)
+ err(1, "fts_read");
+
+ if (cflag) {
+ if (hflag) {
+ prthumanval(savednumber);
+ (void)printf("\ttotal\n");
+ } else {
+ (void)printf("%jd\ttotal\n", (intmax_t)howmany(
+ savednumber * cblocksize, blocksize));
+ }
+ }
+
+ ignoreclean();
+ exit(rval);
+}
+
+static int
+linkchk(FTSENT *p)
+{
+ struct links_entry {
+ struct links_entry *next;
+ struct links_entry *previous;
+ int links;
+ dev_t dev;
+ ino_t ino;
+ };
+ static const size_t links_hash_initial_size = 8192;
+ static struct links_entry **buckets;
+ static struct links_entry *free_list;
+ static size_t number_buckets;
+ static unsigned long number_entries;
+ static char stop_allocating;
+ struct links_entry *le, **new_buckets;
+ struct stat *st;
+ size_t i, new_size;
+ int hash;
+
+ st = p->fts_statp;
+
+ /* If necessary, initialize the hash table. */
+ if (buckets == NULL) {
+ number_buckets = links_hash_initial_size;
+ buckets = malloc(number_buckets * sizeof(buckets[0]));
+ if (buckets == NULL)
+ errx(1, "No memory for hardlink detection");
+ for (i = 0; i < number_buckets; i++)
+ buckets[i] = NULL;
+ }
+
+ /* If the hash table is getting too full, enlarge it. */
+ if (number_entries > number_buckets * 10 && !stop_allocating) {
+ new_size = number_buckets * 2;
+ new_buckets = calloc(new_size, sizeof(struct links_entry *));
+
+ /* Try releasing the free list to see if that helps. */
+ if (new_buckets == NULL && free_list != NULL) {
+ while (free_list != NULL) {
+ le = free_list;
+ free_list = le->next;
+ free(le);
+ }
+ new_buckets = calloc(new_size, sizeof(new_buckets[0]));
+ }
+
+ if (new_buckets == NULL) {
+ stop_allocating = 1;
+ warnx("No more memory for tracking hard links");
+ } else {
+ for (i = 0; i < number_buckets; i++) {
+ while (buckets[i] != NULL) {
+ /* Remove entry from old bucket. */
+ le = buckets[i];
+ buckets[i] = le->next;
+
+ /* Add entry to new bucket. */
+ hash = (le->dev ^ le->ino) % new_size;
+
+ if (new_buckets[hash] != NULL)
+ new_buckets[hash]->previous =
+ le;
+ le->next = new_buckets[hash];
+ le->previous = NULL;
+ new_buckets[hash] = le;
+ }
+ }
+ free(buckets);
+ buckets = new_buckets;
+ number_buckets = new_size;
+ }
+ }
+
+ /* Try to locate this entry in the hash table. */
+ hash = ( st->st_dev ^ st->st_ino ) % number_buckets;
+ for (le = buckets[hash]; le != NULL; le = le->next) {
+ if (le->dev == st->st_dev && le->ino == st->st_ino) {
+ /*
+ * Save memory by releasing an entry when we've seen
+ * all of it's links.
+ */
+ if (--le->links <= 0) {
+ if (le->previous != NULL)
+ le->previous->next = le->next;
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ if (buckets[hash] == le)
+ buckets[hash] = le->next;
+ number_entries--;
+ /* Recycle this node through the free list */
+ if (stop_allocating) {
+ free(le);
+ } else {
+ le->next = free_list;
+ free_list = le;
+ }
+ }
+ return (1);
+ }
+ }
+
+ if (stop_allocating)
+ return (0);
+
+ /* Add this entry to the links cache. */
+ if (free_list != NULL) {
+ /* Pull a node from the free list if we can. */
+ le = free_list;
+ free_list = le->next;
+ } else
+ /* Malloc one if we have to. */
+ le = malloc(sizeof(struct links_entry));
+ if (le == NULL) {
+ stop_allocating = 1;
+ warnx("No more memory for tracking hard links");
+ return (0);
+ }
+ le->dev = st->st_dev;
+ le->ino = st->st_ino;
+ le->links = st->st_nlink - 1;
+ number_entries++;
+ le->next = buckets[hash];
+ le->previous = NULL;
+ if (buckets[hash] != NULL)
+ buckets[hash]->previous = le;
+ buckets[hash] = le;
+ return (0);
+}
+
+static void
+prthumanval(int64_t bytes)
+{
+ char buf[5];
+
+ bytes *= cblocksize;
+ if (!Aflag)
+ bytes *= DEV_BSIZE;
+
+ humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE,
+ HN_B | HN_NOSPACE | HN_DECIMAL);
+
+ (void)printf("%4s", buf);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] "
+ "[-a | -s | -d depth] [-B blocksize] [-I mask] "
+ "[-t threshold] [file ...]\n");
+ exit(EX_USAGE);
+}
+
+static void
+ignoreadd(const char *mask)
+{
+ struct ignentry *ign;
+
+ ign = calloc(1, sizeof(*ign));
+ if (ign == NULL)
+ errx(1, "cannot allocate memory");
+ ign->mask = strdup(mask);
+ if (ign->mask == NULL)
+ errx(1, "cannot allocate memory");
+ SLIST_INSERT_HEAD(&ignores, ign, next);
+}
+
+static void
+ignoreclean(void)
+{
+ struct ignentry *ign;
+
+ while (!SLIST_EMPTY(&ignores)) {
+ ign = SLIST_FIRST(&ignores);
+ SLIST_REMOVE_HEAD(&ignores, next);
+ free(ign->mask);
+ free(ign);
+ }
+}
+
+static int
+ignorep(FTSENT *ent)
+{
+ struct ignentry *ign;
+
+ if (nodumpflag && (ent->fts_statp->st_flags & UF_NODUMP))
+ return 1;
+ SLIST_FOREACH(ign, &ignores, next)
+ if (fnmatch(ign->mask, ent->fts_name, 0) != FNM_NOMATCH)
+ return 1;
+ return 0;
+}
+
+static void
+siginfo(int sig __unused)
+{
+
+ info = 1;
+}
diff --git a/usr.bin/ee/Makefile b/usr.bin/ee/Makefile
new file mode 100644
index 0000000..ee43707
--- /dev/null
+++ b/usr.bin/ee/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/ee
+
+CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
+ -DHAS_SYS_WAIT
+
+PACKAGE=ee
+PROG= ee
+LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit
+MLINKS= ee.1 ree.1 ee.1 edit.1
+LIBADD= ncursesw
+
+WARNS?= 2
+
+NLS= C fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \
+ uk_UA.KOI8-U pt_BR.ISO8859-1 ru_RU.KOI8-R hu_HU.ISO8859-2
+
+NLSLINKS_C= en_US.ISO8859-1 en_US.ISO8859-15
+NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
+ fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 fr_CH.ISO8859-15 \
+ fr_FR.ISO8859-15
+NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
+ de_CH.ISO8859-15 de_DE.ISO8859-15
+NLSLINKS_pt_BR.ISO8859-1= pt_PT.ISO8859-1
+
+NLSSRCFILES=ee.msg
+.for lang in ${NLS}
+. if exists(${.CURDIR}/nls/${lang}/ee.msg)
+NLSSRCDIR_${lang}= ${.CURDIR}/nls/${lang}
+. else
+NLSSRCDIR_${lang}= ${.CURDIR}/../../contrib/ee
+. endif
+.endfor
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ee/Makefile.depend b/usr.bin/ee/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/ee/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ee/nls/de_DE.ISO8859-1/ee.msg b/usr.bin/ee/nls/de_DE.ISO8859-1/ee.msg
new file mode 100644
index 0000000..73aa620
--- /dev/null
+++ b/usr.bin/ee/nls/de_DE.ISO8859-1/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "Modus-Menü"
+2 "Tab -> Leerzeichen "
+3 "Suche ohne Groß/Klein"
+4 "Ränder beachten "
+5 "Automatische Absätze "
+6 "8-Bit Zeichen (Uml.) "
+7 "Hilfefenster "
+8 "rechter Rand "
+9 "Ende-Menü"
+10 "Speichern"
+11 "Verwerfen"
+12 "Dateimenü"
+13 "Öffnen"
+14 "Schreiben in Datei"
+15 "Speichern"
+16 "Aktuellen Inhalt drucken"
+17 "Textsuche"
+18 "Suche nach ..."
+19 "Suchen"
+20 "Rechtschreibung"
+21 "'spell' benutzen"
+22 "'ispell' benutzen"
+23 "Verschiedenes"
+24 "Absatz formatieren"
+25 "Unix-Kommando"
+26 "Rechtschreibung prüfen"
+27 "Hauptmenü"
+28 "Editor beenden"
+29 "Hilfe"
+30 "Dateioperationen"
+31 "Bildschirm regenerieren"
+32 "Einstellungen"
+33 "Suche"
+34 "Verschiedenes"
+35 "Steuertasten: "
+36 "^a ASCII-Code direkt ^i Tabulator ^r nach rechts "
+37 "^b Ende des Textes ^j neue Zeile ^t Anfang des Textes "
+38 "^c Befehl ^k Zeichen löschen ^u hoch "
+39 "^d runter ^l nach links ^v Wort zurückholen "
+40 "^e Textsuche (Menü) ^m neue Zeile ^w Wort löschen "
+41 "^f Zeichen zurückholen ^n nächste Seite ^x Weitersuchen "
+42 "^g zum Zeilenanfang ^o zum Zeilenende ^y Zeile löschen "
+43 "^h Rückschritt ^p vorige Seite ^z Zeile zurückholen "
+44 "^[ (Escape) Menü ESC-Enter: ee beenden "
+45 " "
+46 "Befehle: "
+47 "hilfe : diese Hilfe anzeigen datei : Dateinamen anzeigen "
+48 "lesen : Datei öffnen zeichen : ASCII-Code anzeigen "
+49 "schreiben:Datei schreiben grosskl : Suche mit Groß/Kleinschr."
+50 "ende : Sichern und Beenden klein : Suche ohne Groß/Klein. "
+51 "abbruch : Abbruch ohne Sichern !bef : Unix-Befehl \"bef\" ausf. "
+52 "zeile : Zeilennummer anzeigen 0-9 : Zur angegebenen Zeile "
+53 "leer : Tabulat. in Leerz. wandeln tabs : Tabulatoren belassen "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [datei(en)] "
+56 "+#: zu Zeile # -i: k. Hilfefenster -e: Tabulatoren lassen -h: k. Hervorheb."
+57 "^[ (Escape) Menü ^e Textsuche ^y Zeile löschen ^u hoch ^p Seite zur. "
+58 "^a ASCII-Code ^x Weitersuchen ^z Zeile rückhl. ^d runter ^n Seite vor "
+59 "^b Textende ^g Zeilenanfang ^w Wort löschen ^l links "
+60 "^t Textanfang ^o Zeilenende ^v Wort rückhol. ^r rechts "
+61 "^c Befehl ^k Zeichen lösch. ^f Zeichen rückholen ESC-Enter: Ende ee "
+62 "hilfe: Hilfe |datei : Dateiname anzeigen |zeile: Zeilennumer "
+63 "lesen: Datei lesen |zeichen:ASCII-Code des Zeichens |0-9 : zur Zeile "
+64 "schre: Datei schreib. |grosskl:Suche mit Groß/Klein |ende : Speichern,Ende "
+65 "!bef : Unix-\"bef\" |klein: Suche ohne Groß/Klein |abbr : Abbruch "
+66 "leer : Tab -> Leerz. |tabs : Tabulatoren belassen "
+67 " Escape (^[) drücken für Menü"
+68 "Keine Datei"
+69 "ASCII-Code: "
+70 "Pufferinhalt nach \"%s\" schreiben "
+71 "Befehl: "
+72 "Dateiname zum Schreiben: "
+73 "Dateiname zum Lesen: "
+74 "Zeichen = %d"
+75 "Unbekannter Befehl \"%s\""
+76 "Angegebener Befehl ist nicht eindeutig"
+77 "Zeile %d "
+78 "Länge = %d"
+79 "Aktuelle Datei ist \"%s\" "
+80 "Benutzung: %s [-i] [-e] [-h] [+zeilennummer] [dateien]\n"
+81 " -i Hilfefenster ausschalten\n"
+82 " -e Tabulatoren nicht in Leerzeichen wandeln\n"
+83 " -h keine Hervorhebungen\n"
+84 "Datei \"%s\" ist ein Verzeichnis"
+85 "Neue Datei \"%s\""
+86 "Datei \"%s\" kann nicht geöffnet werden"
+87 "Datei \"%s\", %d Zeilen"
+88 "Lesen der Datei \"%s\" beendet"
+89 "Lese die Datei \"%s\""
+90 ", schreibgeschützt"
+91 "Datei \"%s\", %d Zeilen"
+92 "Dateinamen eingeben: "
+93 "Kein Name angegeben; Datei nicht gespeichert"
+94 "Pufferinhalt geändert, wirklich verlassen? (j/n [n]) "
+95 "j"
+96 "Datei existiert bereits, überschreiben? (j/n) [n] "
+97 "Datei \"%s\" kann nicht erzeugt werden"
+98 "Schreibe Datei \"%s\""
+99 "\"%s\" %d Zeilen, %d Zeichen"
+100 " ...Suche läuft"
+101 "Zeichenfolge \"%s\" nicht gefunden"
+102 "Suchen nach: "
+103 "Kann %s nicht ausführen\n"
+104 "Bitte die Eingabetaste drücken "
+105 "Escape zum Beenden"
+106 "Menü ist zu groß für das Fenster"
+107 "eine beliebige Taste drücken "
+108 "Unix-Befehl: "
+109 "...formatiere Absatz..."
+110 "<!echo 'Liste der nicht gefundenen Wörter'; echo -=-=-=-=-=-"
+111 "Sende den Pufferinhalt an 'spell'"
+112 "Rechter Rand: "
+113 "Eingeschränkter Modus: gewünschte Operation unzulässig"
+114 "EIN"
+115 "AUS"
+116 "HILFE"
+117 "SCHREIBEN"
+118 "LESEN"
+119 "ZEILE"
+120 "DATEI"
+121 "ZEICHEN"
+122 "REGENERIEREN"
+123 "UMNUMERIEREN"
+124 "AUTOR"
+125 "VERSION"
+126 "GROSSKL"
+127 "KLEIN"
+128 "LEER"
+129 "TABS"
+130 "ENDE"
+131 "ABBRUCH"
+132 "INFO"
+133 "[INFO]"
+134 "RAND"
+135 "[RAND]"
+136 "FORMAT."
+137 "[FORMAT.]"
+138 "ECHO"
+139 "DRUCKBEFEHL"
+140 "RECHTERRAND"
+141 "HERVORHEB."
+142 "[HERVORHEB.]"
+143 "8-BIT"
+144 "[8-BIT]"
+145 "Emacs-Tastenbelegung "
+146 "^a Zeilenanfang ^i Tabulator ^r Wort zurückholen "
+147 "^b ein Zeichen zurück ^j Zeichen zurückholen ^t Textanfang "
+148 "^c Befehl ^k Zeile löschen ^u Textende "
+149 "^d Zeichen löschen ^l Zeile zurückholen ^v nächste Seite "
+150 "^e Zeilenendee ^m neue Zeile ^w Wort löschen "
+151 "^f ein Zeichen vorwärts ^n neue Zeile ^x Weitersuchen "
+152 "^g vorige Seite ^o ASCII-Zeichen einfü. ^y Textsuche "
+153 "^h Rückschritt ^p vorige Zeile ^z nächstes Wort "
+154 "^[ (Escape) Menü ^y Suchtext eing. ^k Zeile löschen ^p vor.Zeile ^g vor.Seite"
+155 "^o ASCII-Zeichen ^x Weitersuchen ^l Zeile rückhol ^n nä. Zeile ^v nä. Seite"
+156 "^u Textende ^a Zeilenanfang ^w Wort löschen ^b ein Zeichen zurück "
+157 "^t Textanfang ^e Zeilenende ^r Wort rückhol. ^f ein Zeichen vor "
+158 "^c Befehl ^d Zeichen lösch. ^j Zeich. rückh. ^z nächstes Wort "
+159 "EMACS"
+160 "[EMACS]"
+161 " +<zahl> Zeiger auf Zeile <zahl> setzen"
+162 "Kann die Datei .init.ee nicht schreiben, Konfiguration nicht gespeichert!"
+163 "ee-Konfiguration in Datei %s gespeichert"
+164 "speichere Editor-Konfiguration"
+165 "speichere ee-Konfiguration"
+166 "speichern im aktuellen Verzeichnis"
+167 "speichern im Home-Verzeichnis"
+168 "ee-Konfiguration nicht gespeichert"
+169 "beim Aufruf von ree muß ein Dateiname angegeben werden"
+180 "Menü zu groß für den Bildschirm"
+181 "^^weiter^^"
+182 "VVweiterVV"
+183 "16-bit Zeichen "
+184 "16BIT"
+185 "NO16BIT"
diff --git a/usr.bin/ee/nls/fr_FR.ISO8859-1/ee.msg b/usr.bin/ee/nls/fr_FR.ISO8859-1/ee.msg
new file mode 100644
index 0000000..31bfe6e
--- /dev/null
+++ b/usr.bin/ee/nls/fr_FR.ISO8859-1/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "menu de configuration "
+2 "tabulation -> espaces "
+3 "recherche sensible aux maj/min "
+4 "respect des marges "
+5 "formattage automatique des paragraphes"
+6 "caractères 8 bits "
+7 "fenêtre d'informations "
+8 "marge de droite "
+9 "menu de sortie"
+10 "enregistrer les modifications"
+11 "ne pas enregistrer"
+12 "menu fichiers"
+13 "lire un fichier"
+14 "écrire un fichier"
+15 "enregistrer un fichier"
+16 "imprimer le contenu de l'éditeur"
+17 "menu recherche"
+18 "recherche de..."
+19 "rechercher"
+20 "menu correcteur orthographique"
+21 "utiliser 'spell'"
+22 "utiliser 'ispell'"
+23 "menu divers"
+24 "formatter le paragraphe"
+25 "commande du shell"
+26 "vérifier l'orthographe"
+27 "menu principal"
+28 "quitter l'éditeur"
+29 "aide"
+30 "opérations sur les fichiers"
+31 "rafraîchir l'écran"
+32 "configuration"
+33 "recherche"
+34 "divers"
+35 "Contrôle + touche: "
+36 "^a code ascii ^i tabulation ^r droite "
+37 "^b fin du texte ^j nouvelle ligne ^t début du texte "
+38 "^c commande ^k effacer caractère ^u haut "
+39 "^d bas ^l gauche ^v annuler effacement mot "
+40 "^e entrer recherche ^m nouvelle ligne ^w effacer un mot "
+41 "^f annuler eff. caract. ^n page suivante ^x recherche "
+42 "^g début de ligne ^o fin de ligne ^y effacer ligne "
+43 "^h arrière ^p page précédente ^z annuler effacement ligne"
+44 "^[ (échappement) menu ESC-Enter: quitter ee "
+45 " "
+46 "Commandes: "
+47 "aide : pour cet écran d'info fichier: donne le nom du fichier "
+48 "lire : lire un fichier caract : code ascii d'un caractère"
+49 "écrire : créer un fichier minmaj : recherche sensible aux maj/min"
+50 "fin : quitter et enregistrer pasmin : recherche insensible aux maj/min"
+51 "quitter: quitter, ne pas enregistrer !cmd : exécute \"cmd\" par le shell"
+52 "ligne : indique le numéro de ligne 0-9 : aller à la ligne \"#\" "
+53 "tabs : étendre les tabulations pastabs: ne pas étendre les tabulations"
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [fichier(s)] "
+56 " -i : pas de fenêtre d'info -e : ne pas étendre les tabs -h : pas de surbrillance"
+57 "^[ (échap.) menu ^e rechercher... ^y efface ligne ^u haut ^p page préc."
+58 "^a code ascii ^x rechercher ^z annul. eff. ligne ^d bas ^n page suiv."
+59 "^b fin du texte ^g début de ligne ^w efface mot ^l gauche "
+60 "^t début du texte ^o fin de ligne ^v annul. eff. mot ^r droite "
+61 "^c commande ^k efface caract. ^f annul. eff. caract. ESC-Enter: quitter "
+62 "aide: fenêtre d'aide |fichier: nom du fichier |ligne: numéro de ligne"
+63 "lire: lecture fichier|caract : code ascii du car. |0-9: aller ligne \"#\""
+64 "écrire: crée un fich. |minmaj: rech. sensible min/maj|fin: quitte et sauve"
+65 "!cmd: shell \"cmd\" |pasmin: rech. insens. min/maj |quitte: quitte sans sauver"
+66 "tabs: étend les tabs |pastabs: n'étend pas les tabulations"
+67 " pressez sur échap. (^[) pour le menu"
+68 "pas de fichier"
+69 "code ascii : "
+70 "le contenu du buffer est imprimé sur \"%s\" "
+71 "commande : "
+72 "nom du fichier à créer : "
+73 "nom du fichier à lire : "
+74 "caractère = %d"
+75 "commande inconnue : \"%s\""
+76 "la commande tapée est ambiguë"
+77 "ligne %d "
+78 "longueur = %d"
+79 "le fichier courant est \"%s\" "
+80 "utilisation : %s [-i] [-e] [-h] [+numéro_de_ligne] [fichier(s)]\n"
+81 " -i supprime la fenêtre d'informations\n"
+82 " -e ne convertit pas les tabs en espaces\n"
+83 " -h n'utilise pas de surbrillance\n"
+84 "le fichier \"%s\" est un répertoire"
+85 "nouveau fichier \"%s\""
+86 "impossible de d'ouvrir \"%s\""
+87 "fichier \"%s\", %d lignes"
+88 "le fichier \"%s\" a été lu"
+89 "lecture du fichier \"%s\""
+90 ", lecture seule"
+91 "fichier \"%s\", %d lignes"
+92 "entrez un nom de fichier : "
+93 "pas de nom de fichier donné : fichier non enregistré"
+94 "des changements ont été effectués, êtes vous sûr ? (o/n [n]) "
+95 "o"
+96 "le fichier existe déjà, réécrire ? (o/n) [n] "
+97 "impossible de créer le fichier \"%s\""
+98 "écriture du fichier \"%s\""
+99 "\"%s\" %d lignes, %d caractères"
+100 " ...recherche"
+101 "chaîne \"%s\" non trouvée"
+102 "rechercher : "
+103 "impossible d'exécuter %s\n"
+104 "tapez entrée pour continuer "
+105 "pressez sur échap. pour annuler"
+106 "menu trop grand pour la fenêtre"
+107 "appuyez sur une touche pour continuer "
+108 "commande du shell : "
+109 "...formattage du paragraphe..."
+110 "<!echo 'liste des mots non reconnus'; echo -=-=-=-=-=-"
+111 "envoi du contenu du buffer à 'spell'"
+112 "colonne de la marge de droite : "
+113 "mode restreint : impossible d'effectuer l'opération demandée"
+114 "OUI"
+115 "NON"
+116 "AIDE"
+117 "ECRIRE"
+118 "LIRE"
+119 "LIGNE"
+120 "FICHIER"
+121 "CARACTERE"
+122 "RAFRAICHIR"
+123 "RENUMEROTER"
+124 "AUTEUR"
+125 "VERSION"
+126 "MINMAJ"
+127 "PASMINMAJ"
+128 "TABS"
+129 "PASTABS"
+130 "FIN"
+131 "QUITTE"
+132 "INFO"
+133 "PASINFO"
+134 "MARGES"
+135 "PASMARGES"
+136 "AUTOFORMAT"
+137 "PASAUTOFORMAT"
+138 "ECHO"
+139 "COMMANDEIMPRESSION"
+140 "MARGEDROITE"
+141 "SURBRILLANT"
+142 "PASSURBRILLANT"
+143 "8BIT"
+144 "PAS8BIT"
+145 "caractères de contrôle comme emacs "
+146 "^a début de ligne ^i tabulation ^r annule effacement mot "
+147 "^b arrière ^j annule eff. caract. ^t début du texte "
+148 "^c commande ^k efface ligne ^u fin du texte "
+149 "^d efface caractère ^l annule eff. ligne ^v page suivante "
+150 "^e fin de ligne ^m nouvelle ligne ^w effacer un mot "
+151 "^f caractère suivant ^n ligne suivante ^x recherche "
+152 "^g page précédente ^o insère caract. ascii ^y rechercher... "
+153 "^h efface en arrière ^p ligne précédente ^z mot suivant "
+154 "^[ (échap.) menu ^y rechercher... ^k efface ligne ^p ligne préc ^g page préc"
+155 "^o code ascii ^x recherche ^l annul. eff.li ^n ligne suiv ^v page suiv"
+156 "^u fin du fichier ^a début de ligne ^w efface mot ^b arrière "
+157 "^t début du texte ^e fin de ligne ^r annul.eff.mot ^f avance 1 caractère "
+158 "^c commande ^d efface caract. ^j annul.eff.car ^z mot suivant "
+159 "EMACS"
+160 "PASEMACS"
+161 " +# positionne le curseur sur la ligne #\n"
+162 "impossible d'écrire .init.ee, configuration non sauvée !"
+163 "configuration de ee sauvée en %s"
+164 "sauvegarde configuration de l'éditeur"
+165 "sauvegarde configuration de ee"
+166 "sauvegarde dans le répertoire courant"
+167 "sauvegarde dans le répertoire d'accueil"
+168 "configuration de ee non sauvée"
+169 "nom de fichier manquant pour ree"
+180 "menu trop large pour la fenêtre"
+181 "^^encore^^"
+182 "VVencoreVV"
+183 "16 bit characters "
+184 "16BIT"
+185 "NO16BIT"
diff --git a/usr.bin/ee/nls/hu_HU.ISO8859-2/ee.msg b/usr.bin/ee/nls/hu_HU.ISO8859-2/ee.msg
new file mode 100644
index 0000000..ca6253e
--- /dev/null
+++ b/usr.bin/ee/nls/hu_HU.ISO8859-2/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "üzemmód menü"
+2 "tabulátorok szóközzé "
+3 "kis- és nagybetû érzékeny keresés "
+4 "margók megfigyelésre "
+5 "automatikus bekezdésformázás "
+6 "nyolcbites karakterek "
+7 "info ablak "
+8 "jobb margó "
+9 "kilépés a menübõl "
+10 "változtatások mentése"
+11 "nincs mentés"
+12 "fájl menü"
+13 "fájl olvasása"
+14 "fájl írása"
+15 "fájl mentése"
+16 "a szerkesztõ tartalmának nyomtatása"
+17 "keresés menü"
+18 "keresés erre"
+19 "keresés"
+20 "helyesírás menü"
+21 "'spell' használata"
+22 "'ispell' használata"
+23 "egyéb menü"
+24 "bekezdés formázása"
+25 "shell parancs"
+26 "helyesírás-ellenõrzés"
+27 "fõmenü"
+28 "kilépés a szerkesztõbõl"
+29 "súgó"
+30 "fájlmûveletek"
+31 "képernyõ újrarajzolása"
+32 "beállítások"
+33 "keresés"
+34 "egyéb"
+35 "Vezérlõbillentyûk: "
+36 "^a ascii kód ^i tabulátor ^r jobb "
+37 "^b szöveg alja ^j újsor ^t szöveg teteje "
+38 "^c parancs ^k karakter törlése ^u fel "
+39 "^d le ^l balra ^v szótörlés vissza "
+40 "^e keresés prompt ^m újsor ^w szó törlése "
+41 "^f karaktertörlés vissza ^n következõ oldal ^x keresés "
+42 "^g sor eleje ^o sor vége ^y sor törlése "
+43 "^h visszatörlés ^p elõzõ oldal ^z sortörlés vissza "
+44 "^[ (escape) menü "
+45 " "
+46 "Parancsok: "
+47 "help : ez az info file : fájlnév megjelenítése "
+48 "read : fájl olvasása char : karakter ascii kódja "
+49 "write : fájl írása case : k/n betû érzékeny keresés"
+50 "exit : kilépés és mentés nocase : nem betûérzékeny keresés "
+51 "quit : kilépés mentés nélkül !cmd : \"cmd\" shell parancs "
+52 "line : #. sor megjelenítése 0-9 : \"#\" sorra ugrás "
+53 "expand : tabok kifejtése noexpand: ne fejtse ki a tabokat "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [fájl(ok) "
+56 "+# :ugrás sorra # -i :info ablak ki -e :tabkifejtés ki -h :kiemelés ki"
+57 "^[ (escape) menü ^e keresés prompt ^y sor törlése ^u fel ^p elõzõ old "
+58 "^a ascii kód ^x keresés ^z sortörl vissza ^d le ^n köv old "
+59 "^b szöve alja ^g sor eleje ^w szó törlése ^l bal "
+60 "^t szöveg teteje ^o sor vége ^v szótörl vissza ^r jobb "
+61 "^c parancs ^k karalter törl ^f kartörl vissza "
+62 "help : súgó |file : fájlnév megjelenítése |line : sor # kiírása "
+63 "read : fájl olvasása |char : ascii kód |0-9 : # sorra ugrás "
+64 "write: fájl írása |case : k/n érzékeny keresés |exit : kilép és ment "
+65 "!cmd : shell parancs |nocase: nem érzékeny keresés |quit : kilép, nem ment"
+66 "expand: tabkifejtés |noexpand: ne legyen tabkifejtés "
+67 " nyomja le az Escape billentyût (^[) a menü eléréséhez"
+68 "nincs fájl"
+69 "ascii kód: "
+70 "a puffer tartalmának küldése -> \"%s\" "
+71 "parancs: "
+72 "a mentendõ fájl neve: "
+73 "az olvasandó fájl neve: "
+74 "karakter = %d"
+75 "ismeretlen parancs: \"%s\""
+76 "a megadott parancs nem egyéni"
+77 "sor %d "
+78 "hossz = %d"
+79 "az aktuális fájl \"%s\" "
+80 "használat: %s [-i] [-e] [-h] [+sor_száma] [fájl(ok)]\n"
+81 " -i info ablak kikapcsolása\n"
+82 " -e ne konvertálja a tabokat szóközzé\n"
+83 " -h ne használjon kiemelést\n"
+84 "\"%s\" egy könyvtár"
+85 "új fájl: \"%s\""
+86 "\"%s\" nem nyitható meg"
+87 "\"%s\" fájl, %d sor"
+88 "\"%s\" fájl olvasása befejezõdött"
+89 "\"%s\" fájl olvasása"
+90 ", csak olvasható"
+91 "\"%s\" fájl, %d sor"
+92 "adja meg a fájlnevet: "
+93 "nem adott meg fájlnevet: a fájl nem lett elmentve"
+94 "változások történtek, biztos benne? (i/n [n]) "
+95 "i"
+96 "a fájl már létezik, felülírjam? (i/n) [n] "
+97 "\"%s\" fájl nem hozható létre"
+98 "\"%s\" fájl írása"
+99 "\"%s\" %d sor, %d karakter"
+100 " ...keresés"
+101 "\"%s\" karakterlánc nem található"
+102 "keresés erre: "
+103 "%s nem hajtható végre\n"
+104 "nyomjon entert a folytatáshoz"
+105 "nyomja le az Esc billentyût a visszalépéshez"
+106 "a menü túl nagy az ablakhoz"
+107 "nyomjon le egy billentyût a folytatáshoz"
+108 "shell parancs: "
+109 "...bekezdés formázása..."
+110 "<!echo 'felismerhetetlen szavak listája'; echo -=-=-=-=-=-"
+111 "a szerkesztési puffer küldése a 'spell' programhoz"
+112 "jobb margó: "
+113 "korlátozott mód: a kért mûvelet nem hajtható végre"
+114 "ON"
+115 "OFF"
+116 "HELP"
+117 "WRITE"
+118 "READ"
+119 "LINE"
+120 "FILE"
+121 "CHARACTER"
+122 "REDRAW"
+123 "RESEQUENCE"
+124 "AUTHOR"
+125 "VERSION"
+126 "CASE"
+127 "NOCASE"
+128 "EXPAND"
+129 "NOEXPAND"
+130 "EXIT"
+131 "QUIT"
+132 "INFO"
+133 "NOINFO"
+134 "MARGINS"
+135 "NOMARGINS"
+136 "AUTOFORMAT"
+137 "NOAUTOFORMAT"
+138 "ECHO"
+139 "PRINTCOMMAND"
+140 "RIGHTMARGIN"
+141 "HIGHLIGHT"
+142 "NOHIGHLIGHT"
+143 "EIGHTBIT"
+144 "NOEIGHTBIT"
+145 "emacs gomb kiosztás "
+146 "^a sor eleje ^i tab ^r szó visszaállítása "
+147 "^b vissza 1 karaktert ^j karaktertörl vissza ^t fájl eleje "
+148 "^c parancs ^k sor törlése ^u fájl vége "
+149 "^d karakter törlése ^l sortérlés vissza ^v következõ oldal "
+150 "^e sor vége ^m újsor ^w szó törlése "
+151 "^f elõre 1 karaktert ^n következõ sor ^x keresés "
+152 "^g vissza 1 oldalt ^o ascii kar beszúrása ^y keresés prompt "
+153 "^h visszatörlés ^p elõzõ sor ^z következõ sor "
+154 "^[ (escape) menü ^y keresés prompt ^k sor törlése ^p el sor ^g elõzõ old"
+155 "^o ascii kód ^x keresés ^l sortörl vissz ^n köv sor ^v köv old "
+156 "^u fájl vége ^a sor eleje ^w szó törlése ^b vissza 1 kar "
+157 "^t fájl eleje ^e sor vége ^r szótörl vissz ^f elõre 1 kar "
+158 "^c parancs ^d kar törlése ^j kartörl vissz ^z köv szó "
+159 "EMACS"
+160 "NOEMACS"
+161 " +# kurzor mozgatása a sorra #\n"
+162 ".init.ee nem nyitható meg írásra, konfiguráció nem lett mentve!"
+163 "ee konfiguráció elmentve a %s fájlban"
+164 "szerkesztõ konfigurációjának mentése"
+165 "ee konfiguráció mentése"
+166 "mentés az aktuális könyvtárba"
+167 "mentés a home könyvtárba"
+168 "ee konfiguráció nem lett mentve"
+169 "ree hívásához meg kell adni egy fájlnevet"
+180 "a menü túl nagy az ablakhoz"
+181 "^^több^^"
+182 "VVtöbbVV"
+183 "16 bites karakterek "
+184 "16BIT"
+185 "NO16BIT"
diff --git a/usr.bin/ee/nls/pl_PL.ISO8859-2/ee.msg b/usr.bin/ee/nls/pl_PL.ISO8859-2/ee.msg
new file mode 100644
index 0000000..94a1eab
--- /dev/null
+++ b/usr.bin/ee/nls/pl_PL.ISO8859-2/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "menu Tryb pracy"
+2 "tabulacje na spacje "
+3 "szukaj (ma³e!=du¿e) "
+4 "ustawiony margines "
+5 "auto-formatuj akapit "
+6 "znaki o¶miobitowe "
+7 "okno informacyjne "
+8 "prawy margines "
+9 "wyjd¼ z menu"
+10 "zachowaj zmiany"
+11 "brak zachowania"
+12 "menu Plik"
+13 "wczytaj plik"
+14 "zapisz do pliku"
+15 "zachowaj plik"
+16 "drukuj zawarto¶æ edytora"
+17 "menu Szukanie"
+18 "szukaj ..."
+19 "szukanie"
+20 "menu Pisownia"
+21 "u¿yj 'spell'"
+22 "u¿yj 'ispell'"
+23 "menu Inne"
+24 "formatuj akapit"
+25 "polecenie shell"
+26 "sprawd¼ pisowniê"
+27 "menu g³ówne"
+28 "wyjd¼ z edytora"
+29 "pomoc"
+30 "operacje na plikach"
+31 "od¶wie¿ ekran"
+32 "ustawienia"
+33 "szukanie"
+34 "inne"
+35 "Klawisze kontrolne: "
+36 "^a kod ASCII ^i tabulator ^r w prawo "
+37 "^b na dó³ tekstu ^j nowy wiersz ^t do góry tekstu "
+38 "^c polecenie ^k usuñ znak ^u do góry "
+39 "^d do do³u ^l w lewo ^v przywróæ s³owo "
+40 "^e szukanie ^m nowy wiersz ^w usuñ s³owo "
+41 "^f przywróæ znak ^n nastêpna strona ^x szukaj "
+42 "^g na pocz±tek wiersza ^o na koniec wiersza ^y usuñ wiersz "
+43 "^h backspace ^p poprzednia strona ^z przywróæ wiersz "
+44 "^[ (escape) menu ESC-Enter: wyj¶cie z ee "
+45 " "
+46 "Polecenia: "
+47 "help : wy¶wietl tê informacjê file : wy¶wietl nazwê pliku "
+48 "read : wczytaj plik char : kod ASCII znaku "
+49 "write : zapisz do pliku case : szukaj (ma³e!=du¿e) "
+50 "exit : zachowaj i wyjd¼ nocase : szukaj (ma³e==du¿e) "
+51 "quit : wyjd¼ bez zachowania !cmd : wykonaj \"cmd\" w shellu "
+52 "line : wy¶wietl numer wiersza 0-9 : id¼ do wiersza \"#\" "
+53 "expand : rozwiñ tabulacje na spacje noexpand: nie rozwijaj tabulacji "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [plik(i)] "
+56 " -i : bez okna inform. -e : nie rozwijaj tab. -h : bez pod¶wietl."
+57 "^[ (escape) menu ^e szukanie ^y usuñ wiersz ^u do góry ^p poprz. str "
+58 "^a kod ASCII ^x szukaj ^z przywróæ wiersz ^d do do³u ^n nast. str. "
+59 "^b na dó³ tekstu ^g na pocz. wiersza ^w usuñ s³owo ^l w lewo "
+60 "^t do góry tekstu ^o na koniec wiersza ^v przywróæ s³owo ^r w prawo "
+61 "^c polecenie ^k usuñ znak ^f przywróæ znak ESC-Enter: wyj¶cie "
+62 "help : pomoc |file : podaj nazwê pliku |line : numer wiersza"
+63 "read : wczytaj plik |char : kod ASCII znaku |0-9 : id¼ do wr \"#\""
+64 "write: zapisz plik |case : szukaj (ma³e!=du¿e) |exit : zpisz i wyjd¼"
+65 "!cmd : \"cmd\" w shellu |nocase: ma³e==du¿e w szukaniu |quit : wyjd¼, nie zapisuj"
+66 "expand: rozwiñ tabulacje na spacje |noexpand: nie rozwijaj tabulacji "
+67 " naci¶nij Escape (^[) do menu"
+68 "brak pliku"
+69 "kod ASCII: "
+70 "wysy³am zawarto¶æ bufora do \"%s\" "
+71 "polecenie: "
+72 "nazwa pliku do zapisania: "
+73 "nazwa pliku do wczytania: "
+74 "znak = %d"
+75 "nieznane polecenie \"%s\""
+76 "podane polecenie nie jest jednoznaczne"
+77 "wiersz %d "
+78 "d³ugo¶æ = %d"
+79 "aktualny plik to \"%s\" "
+80 "sposób u¿ycia: %s [-i] [-e] [-h] [+numer_wiersza] [plik(i)]\n"
+81 " -i zamknij okno informacyjne\n"
+82 " -e nie rozwijaj tabulacji na spacje\n"
+83 " -h nie u¿ywaj pod¶wietleñ\n"
+84 "plik \"%s\" jest katalogiem"
+85 "nowy plik \"%s\""
+86 "nie mogê otworzyæ \"%s\""
+87 "plik \"%s\", %d wierszy"
+88 "koniec wczytywania pliku \"%s\""
+89 "wczytywanie pliku \"%s\""
+90 ", tylko do odczytu"
+91 "plik \"%s\", %d wierszy"
+92 "podaj nazwê pliku: "
+93 "nie podano nazwy pliku: plik nie zosta³ zachowany"
+94 "plik zosta³ zmieniony, jeste¶ pewien? (t/n [n]) "
+95 "t"
+96 "plik ju¿ istnieje, zast±piæ? (t/n) [n] "
+97 "nie mo¿na utworzyæ pliku \"%s\""
+98 "zapisywanie pliku \"%s\""
+99 "\"%s\" %d wierszy, %d znaków"
+100 " ...szukam"
+101 "napis \"%s\" nie zosta³ znaleziony"
+102 "szukaj: "
+103 "nie mo¿na wykonaæ %s\n"
+104 "naci¶nij Enter ¿eby kontynuowaæ "
+105 "naci¶nij Esc ¿eby anulowaæ"
+106 "menu zbyt du¿e dla tego okna"
+107 "naci¶nij dowolny klawisz "
+108 "polecenie shella: "
+109 "...formatowanie akapitu..."
+110 "<!echo 'lista nieznalezionych s³ów'; echo -=-=-=-=-=-"
+111 "wysy³am zawarto¶æ edytora do programu 'spell'"
+112 "prawy margines: "
+113 "tryb ograniczony: nie mo¿na przeprowadziæ tej operacji"
+114 "ON"
+115 "OFF"
+116 "HELP"
+117 "WRITE"
+118 "READ"
+119 "LINE"
+120 "FILE"
+121 "CHARACTER"
+122 "REDRAW"
+123 "RESEQUENCE"
+124 "AUTHOR"
+125 "VERSION"
+126 "CASE"
+127 "NOCASE"
+128 "EXPAND"
+129 "NOEXPAND"
+130 "EXIT"
+131 "QUIT"
+132 "INFO"
+133 "NOINFO"
+134 "MARGINS"
+135 "NOMARGINS"
+136 "AUTOFORMAT"
+137 "NOAUTOFORMAT"
+138 "ECHO"
+139 "PRINTCOMMAND"
+140 "RIGHTMARGIN"
+141 "HIGHLIGHT"
+142 "NOHIGHLIGHT"
+143 "EIGHTBIT"
+144 "NOEIGHTBIT"
+145 "klawisze emacs "
+146 "^a pocz±tek wiersza ^i tabulacja ^r przywróæ s³owo "
+147 "^b jeden znak wstecz ^j przywróæ znak ^t do góry tekstu "
+148 "^c polecenie ^k usuñ wiersz ^u na dó³ tekstu "
+149 "^d usuñ znak ^l przywróæ wiersz ^v nastêpna strona "
+150 "^e na koniec wiersza ^m nowy wiersz ^w usuñ s³owo "
+151 "^f 1 znak do przodu ^n nastêpny wiersz ^x szukaj "
+152 "^g 1 strona wstecz ^o wstaw znak ASCII ^y szukanie "
+153 "^h backspace ^p poprzedni wiersz ^z nastêpne s³owo "
+154 "^[ (escape) menu ^y szukanie ^k usuñ wiersz ^p <-wiersz ^g <-strona "
+155 "^o kod ASCII ^x szukaj ^l przywr wiersz ^n wiersz-> ^v strona-> "
+156 "^u koniec pliku ^a pocz. wiersza ^w usuñ s³owo ^b 1 znak wstecz "
+157 "^t pocz. tekstu ^e koniec wiersza ^r przywr s³owo ^f 1 znak do przodu "
+158 "^c polecenie ^d usuñ znak ^j przywróæ znak ^z nastêpne s³owo "
+159 "EMACS"
+160 "NIE-EMACS"
+161 " +# umie¶æ kursor w wierszu #\n"
+162 "nie mo¿na otworzyæ .init.ee do zapisu, nie zachowano konfiguracji!"
+163 "konfiguracja ee zachowana do pliku %s"
+164 "zachowaj konfiguracjê edytora"
+165 "zachowaj konfiguracjê ee"
+166 "zachowaj w bie¿±cym katalogu"
+167 "zachowaj w katalogu home"
+168 "nie zachowano konfiguracji ee"
+169 "musisz podaæ nazwê pliku przy wywo³aniu ree"
+180 "menu zbyt du¿e dla tego okna"
+181 "^^dalej^^"
+182 "VVdalejVV"
+183 "16 bit characters "
+184 "16BIT"
+185 "NO16BIT"
diff --git a/usr.bin/ee/nls/pt_BR.ISO8859-1/ee.msg b/usr.bin/ee/nls/pt_BR.ISO8859-1/ee.msg
new file mode 100644
index 0000000..592ea17
--- /dev/null
+++ b/usr.bin/ee/nls/pt_BR.ISO8859-1/ee.msg
@@ -0,0 +1,186 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $Header: /home/hugh/sources/old_ae/RCS/ee.msg,v 1.8 1996/11/30 03:23:40 hugh Exp $
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "modo menu"
+2 "tabs para espaços "
+3 "busca com case sensitive "
+4 "observar margens "
+5 "formatação de auto-parágrafo"
+6 "caracteres de oito bits "
+7 "informação da janela "
+8 "margem direita "
+9 "deixar o menu"
+10 "salvar mudanças"
+11 "sem salvar"
+12 "menu arquivo"
+13 "ler um arquivo"
+14 "escrever uma arquivo"
+15 "salvar arquivo"
+16 "editar conteúdo de impressão"
+17 "menu localizar"
+18 "localizar por ..."
+19 "localizar"
+20 "menu dicionário"
+21 "usar 'spell'"
+22 "usar 'ispell'"
+23 "menu diversos"
+24 "formatação de parágrafo"
+25 "comando shell"
+26 "checar dicionário"
+27 "menu principal"
+28 "deixar editor"
+29 "ajuda"
+30 "operações com arquivos"
+31 "redesenhar tela"
+32 "configurações"
+33 "localizar"
+34 "diversos"
+35 "Teclas de controle: "
+36 "^a código ascii ^i tab ^r direita "
+37 "^b botão de texto ^j nova linha ^t início do texto "
+38 "^c comando ^k deletar caracter ^u para acima "
+39 "^d para baixo ^l esquerda ^v restaurar palavra "
+40 "^e localizar prompt ^m nova linha ^w deletar palavra "
+41 "^f restaurar caracter ^n próxima página ^x localizar "
+42 "^g início da linha ^o fim da linha ^y deletar linha "
+43 "^h backspace ^p página anterior ^z restaurar linha "
+44 "^[ (escape) menu "
+45 " "
+46 "Comandos: "
+47 "help : obter esta informação file : imprimir nome do arquivo "
+48 "read : ler um arquivo char : código ascii de caracter "
+49 "write : escrever a arquivo case : localizar com case sensitive "
+50 "exit : salva e sair nocase : localizar sem case insensitive "
+51 "quit : sair, sem salvar !cmd : executar \"cmd\" no shell "
+52 "line : visualizar linhas # 0-9 : ir para linha \"#\" "
+53 "expand : expandir tabs noexpand: não expande tabs "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [arquivos(s)] "
+56 "+# :ir para linha # -i :sem informação da janela -e : não expandir tabs -h :sem destaque "
+57 "^[ (escape) menu ^e prompt localizar ^y deletar linha ^u para cima ^p página anterior "
+58 "^a código ascii ^x localizar ^z restaurar linha ^d para baixo ^n próxima página "
+59 "^b botão de texto ^g início da linha ^w deletar palavra ^l esquerda "
+60 "^t início do texto ^o fim da linha ^v restaurar palavra ^r direita "
+61 "^c comando ^k deletar caracter ^f restaurar caracter "
+62 "help : obter ajuda |file : imprimir nome do arquivo |line : imprimir linha # "
+63 "read : ler um arquivo |char : código ascii de caracter |0-9 : ir para linha \"#\""
+64 "write: escrever um arquivo |case : localizar com case sensitive |exit : salvar e sair "
+65 "!cmd : shell \"cmd\" |nocase: ignorar case na busca |quit : sair, sem salvar"
+66 "expand: expandir tabs |noexpand: não expandir tabs "
+67 " pressione Escape (^[) para menu"
+68 "sem arquivo"
+69 "código ascii: "
+70 "enviar conteúdo do buffer para \"%s\" "
+71 "comando: "
+72 "nome do arquivo para escrever: "
+73 "nome do arquivo para leitura: "
+74 "caracter = %d"
+75 "comando desconhecido \"%s\""
+76 "mais de um comando digitado"
+77 "linha %d "
+78 "comprimento = %d"
+79 "arquivo atual \"%s\" "
+80 "uso: %s [-i] [-e] [-h] [+número_da_linha] [arquivo(s)]\n"
+81 " -i desligar informações da janela\n"
+82 " -e não converter tabs para espaços\n"
+83 " -h não usar destaque\n"
+84 "arquivo \"%s\" é um diretório"
+85 "novo arquivo \"%s\""
+86 "não posso abrir \"%s\""
+87 "arquivos \"%s\", %d linhas"
+88 "finalizar leitura de arquivo \"%s\""
+89 "lendo arquivo \"%s\""
+90 ", somente leitura"
+91 "arquivo \"%s\", %d linhas"
+92 "digite o nome do arquivo: "
+93 "nenhum arquivo digitado: arquivo não foi salvo"
+94 "Foram feitas alterações, você tem certeza? (y/n [n]) "
+95 "y"
+96 "arquivo já existe, sobrescrever? (y/n) [n] "
+97 "impossível criar arquivo \"%s\""
+98 "escrevendo arquivo \"%s\""
+99 "\"%s\" %d linhas, %d caracteres"
+100 " ...localizando"
+101 "string \"%s\" não encontrada"
+102 "localizar por: "
+103 "execução não permitida %s\n"
+104 "pressione enter para continuar "
+105 "pressione Esc para cancelar"
+106 "menu muito grande para a janela"
+107 "pressione qualquer tecla para continuar "
+108 "comando shell: "
+109 "...formatando parágrafo..."
+110 "<!echo 'lista de palavras não reconhecidas'; echo -=-=-=-=-=-"
+111 "enviando conteúdo no buffer do editor para 'correção'"
+112 "margem direita é: "
+113 "modo restrito: incapaz de executar a operação solicitada"
+114 "LIGADO"
+115 "DESLIGADO"
+116 "AJUDA"
+117 "ESCRITA"
+118 "LEITURA"
+119 "LINHA"
+120 "ARQUIVO"
+121 "CARACTER"
+122 "REDESENHAR"
+123 "RESEQUENCIA"
+124 "AUTOR"
+125 "VERSÃO"
+126 "CASE"
+127 "SEMCASE"
+128 "EXPANDIR"
+129 "NÃOEXPANDIR"
+130 "SAIRSALVANDO"
+131 "SAIRSEMSALVAR"
+132 "INFO"
+133 "SEMINFO"
+134 "MARGENS"
+135 "SEMMARGENS"
+136 "AUTOFORMATAÇÃO"
+137 "SEMAUTOFORMATAÇÃO"
+138 "ECHO"
+139 "IMPRIMIRCOMANDO"
+140 "MARGEMDIREITA"
+141 "DESTAQUE"
+142 "SEMDESTAQUE"
+143 "OITOBIT"
+144 "SEMOITOBIT"
+145 "vínculo com teclas emacs "
+146 "^a início da linha ^i tab ^r restaurar palavra "
+147 "^b voltar 1 caracter ^j resturar caracter ^t início do texto "
+148 "^c comando ^k deletar linha ^u botão de texto "
+149 "^d deletar caracter ^l restaurar linha ^v próxima página "
+150 "^e fim da linha ^m nova linha ^w deletar palavra "
+151 "^f avançar 1 caracter ^n próxima linha ^x localizar "
+152 "^g voltar 1 página ^o inserir caracter ascii ^y prompt localizar "
+153 "^h backspace ^p linha anterior ^z próxima palavra "
+154 "^[ (escape) menu ^y prompt localizar ^k deletar linha ^p linha anterior ^g página anterior"
+155 "^o código ascii ^x localizar ^l restaurar linha ^n próxima linha ^v próxima página "
+156 "^u fim do arquivo ^a início da linha ^w deletar palavra ^b regressar 1 caracter "
+157 "^t início do texto ^e fim da linha ^r restaurar palavra ^f avançar 1 caracter "
+158 "^c comando ^d deletar caracter ^j restaurar caracter ^z próxima palavra "
+159 "EMACS"
+160 "SEMEMACS"
+161 " +# colocar cursor na linha #\n"
+162 "impossível abrir .init.ee para escrita, nenhuma configuração salva!"
+163 "ee configuração salva no arquivo %s"
+164 "salvar configurações do editor"
+165 "salvar configurações do ee"
+166 "salvar no diretório corrente"
+167 "salvar no diretório home"
+168 "configurações do ee não salvas"
+169 "ao invocar ree, deve-se especificar um arquivo"
+180 "menu muito grande para a janela"
+181 "^^mais^^"
+182 "VVmaisVV"
+183 "caracteres de 16 bit "
+184 "16BIT"
+185 "SEM16BIT"
diff --git a/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg b/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg
new file mode 100644
index 0000000..bfced0f
--- /dev/null
+++ b/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg
@@ -0,0 +1,187 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ Based on uk_UA.KOI8-U translation by Olexander Kunytsa <kunia@istc.kiev.ua>
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "íÅÎÀ ÐÁÒÁÍÅÔÒÏ×"
+2 "ÔÁÂÕÌÑÃÉÑ ÐÒÏÂÅÌÁÍÉ "
+3 "ÐÏÉÓË Ó ÕÞ£ÔÏÍ ÒÅÇÉÓÔÒÁ "
+4 "Á×ÔÏ-ÐÅÒÅ×ÏÄ ÓÔÒÏËÉ "
+5 "Á×ÔÏ-ÆÏÒÍÁÔ ÁÂÚÁÃÁ "
+6 "8-ÂÉÔÎÙÅ ÓÉÍ×ÏÌÙ "
+7 "ÏËÎÏ ÐÏÄÓËÁÚËÉ "
+8 "ÛÉÒÉÎÁ ÔÅËÓÔÁ "
+9 "æÁÊÌ ÉÚÍÅΣÎ!"
+10 "ÓÏÈÒÁÎÉÔØ É ×ÙÊÔÉ"
+11 "ÎÅ ÓÏÈÒÁÎÑÔØ"
+12 "íÅÎÀ ÆÁÊÌÏ×ÙÈ ÏÐÅÒÁÃÉÊ"
+13 "ÐÒÏÞÅÓÔØ ÆÁÊÌ"
+14 "ÚÁÐÉÓÁÔØ × ÆÁÊÌ"
+15 "ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
+16 "ÒÁÓÐÅÞÁÔÁÔØ"
+17 "íÅÎÀ ÐÏÉÓËÁ"
+18 "ÞÔÏ ÉÓËÁÔØ..."
+19 "ÐÏ×ÔÏÒÉÔØ ÐÏÉÓË"
+20 "íÅÎÀ ÐÒÏ×ÅÒËÉ ÐÒÁ×ÏÐÉÓÁÎÉÑ"
+21 "ÚÁÐÕÓÔÉÔØ 'spell'"
+22 "ÚÁÐÕÓÔÉÔØ 'ispell'"
+23 "äÏÐÏÌÎÉÔÅÌØÎÙÅ ÏÐÅÒÁÃÉÉ"
+24 "ÆÏÒÍÁÔÉÒÏ×ÁÔØ ÁÂÚÁÃ"
+25 "ËÏÍÁÎÄÁ ÏÂÏÌÏÞËÉ"
+26 "ÐÒÏ×ÅÒÉÔØ ÐÒÁ×ÏÐÉÓÁÎÉÅ"
+27 "çÌÁ×ÎÏÅ ÍÅÎÀ"
+28 "×ÙÊÔÉ ÉÚ ÒÅÄÁËÔÏÒÁ"
+29 "ÐÏÄÓËÁÚËÁ"
+30 "ÏÐÅÒÁÃÉÉ Ó ÆÁÊÌÁÍÉ"
+31 "ÏÂÎÏ×ÉÔØ ÜËÒÁÎ"
+32 "ÐÁÒÁÍÅÔÒÙ"
+33 "ÐÏÉÓË"
+34 "ÒÁÚÎÏÅ"
+35 "ëÌÁ×ÉÛÉ ÕÐÒÁ×ÌÅÎÉÑ: "
+36 "^a ascii-ËÏÄ ^i ÔÁÂÕÌÑÃÉÑ ^r ×ÐÒÁ×Ï "
+37 "^b × ÓÁÍÙÊ ÎÉÚ ^j ÎÏ×ÁÑ ÓÔÒÏËÁ ^t × ÓÁÍÙÊ ×ÅÒÈ "
+38 "^c ËÏÍÁÎÄÁ ^k ÕÄÁÌÉÔØ ÓÉÍ×ÏÌ ^u ××ÅÒÈ "
+39 "^d ×ÎÉÚ ^l ×ÌÅ×Ï ^v ×ÅÒÎÕÔØ ÓÌÏ×Ï "
+40 "^e ÐÏÉÓË... ^m ÎÏ×ÁÑ ÓÔÒÏËÁ ^w ÕÄÁÌÉÔØ ÓÌÏ×Ï "
+41 "^f ×ÅÒÎÕÔØ ÓÉÍ×ÏÌ ^n ÓÌÅÄÕÀÝÁÑ ÓÔÒÁÎÉÃÁ ^x ÐÏ×ÔÏÒ ÐÏÉÓËÁ "
+42 "^g × ÎÁÞÁÌÏ ÓÔÒÏËÉ ^o × ËÏÎÅÃ ÓÔÒÏËÉ ^y ÕÄÁÌÉÔØ ÓÔÒÏËÕ "
+43 "^h ÚÁÂÏÊ ^p ÐÒÅÄÙÄÕÝÁÑ ÓÔÒÁÎÉÃÁ ^z ×ÅÒÎÕÔØ ÓÔÒÏËÕ "
+44 "^[ (Esc) ×ÙÚÏ× ÍÅÎÀ Esc-Enter: ×ÙÊÔÉ ÉÚ ÒÅÄÁËÔÏÒÁ "
+45 " "
+46 "ëÏÍÁÎÄÙ: "
+47 "help : ÜÔÁ ÐÏÄÓËÁÚËÁ file : ÐÏËÁÚÁÔØ ÉÍÑ ÆÁÊÌÁ "
+48 "read : ÐÒÏÞÅÓÔØ ÆÁÊÌ char : ascii-ËÏÄ ÓÉÍ×ÏÌÁ "
+49 "write : ÚÁÐÉÓÁÔØ × ÆÁÊÌ case : ÐÏÉÓË Ó ÕÞ£ÔÏÍ ÒÅÇÉÓÔÒÁ "
+50 "exit : ×ÙÊÔÉ Ó ÓÏÈÒÁÎÅÎÉÅÍ nocase : ÐÏÉÓË ÂÅÚ ÕÞ£ÔÁ ÒÅÇÉÓÔÒÁ "
+51 "quit : ×ÙÊÔÉ ÂÅÚ ÓÏÈÒÁÎÅÎÉÑ !ËÏÍÁÎÄÁ: ×ÙÚ×ÁÔØ ËÏÍÁÎÄÕ ÏÂÏÌÏÞËÉ "
+52 "line : ÐÏËÁÚÁÔØ ÎÏÍÅÒ ÓÔÒÏËÉ 0-9 : ÐÅÒÅÊÔÉ Ë ÓÔÒÏËÅ N "
+53 "expand : ÚÁÍÅÎÑÔØ ÔÁÂÕÌÑÃÉÀ ÐÒÏÂÅÌÁÍÉ noexpand: ÎÅ ÚÁÍÅÎÑÔØ ÔÁÂÕÌÑÃÉÀ "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [ÆÁÊÌ(Ù)] "
+56 "+# :Ë ÓÔÒÏËÅ N -i :ÂÅÚ ÉÎÆÏ-ÏËÎÁ -e :ÎÅ ÚÁÍÅÎÑÔØ ÔÁÂÙ -h :ÂÅÚ ×ÙÄÅÌÅÎÉÑ ÒÁÍÏË "
+57 "^[ (Esc) ÍÅÎÀ ^e ÐÏÉÓË ^y ÕÄÁÌÉÔØ ÓÔÒÏËÕ ^u ××ÅÒÈ ^p ÐÒÅÄ. ÓÔÒ. "
+58 "^a ascii-ËÏÄ ^x ÐÏ×ÔÏÒ ÐÏÉÓËÁ ^z ×ÅÒÎÕÔØ ÓÔÒÏËÕ ^d ×ÎÉÚ ^n ÓÌÅÄ. ÓÔÒ. "
+59 "^b × ÓÁÍÙÊ ÎÉÚ ^g × ÎÁÞÁÌÏ ÓÔÒÏËÉ ^w ÕÄÁÌÉÔØ ÓÌÏ×Ï ^l ×ÌÅ×Ï "
+60 "^t × ÓÁÍÙÊ ×ÅÒÈ ^o × ËÏÎÅà ÓÔÒÏËÉ ^v ×ÅÒÎÕÔØ ÓÌÏ×Ï ^r ×ÐÒÁ×Ï "
+61 "^c ËÏÍÁÎÄÁ ^k ÕÄÁÌÉÔØ ÓÉÍ×ÏÌ ^f ×ÅÒÎÕÔØ ÓÉÍ×ÏÌ Esc-Enter ×ÙÈÏÄ ÉÚ 'ee'"
+62 "help : ÐÏÄÓËÁÚËÁ |file : ÐÏËÁÚÁÔØ ÉÍÑ ÆÁÊÌÁ |line: ÎÏÍÅÒ ÓÔÒÏËÉ "
+63 "read : ÐÒÏÞÅÓÔØ ÆÁÊÌ |char : ascii-ËÏÄ ÓÉÍ×ÏÌÁ |0-9 : ÐÅÒÅÊÔÉ Ë ÓÔÒÏËÅ "
+64 "write: ÚÁÐÉÓÁÔØ ÆÁÊÌ |case : ÐÏÉÓË Ó ÕÞ£ÔÏÍ ÒÅÇÉÓÔÒÁ |exit: ÓÏÈÒÁÎÉÔØ É ×ÙÊÔÉ"
+65 "!ËÍÄ : ×ÙÐÏÌÎÉÔØ ËÍÄ. |nocase:ÐÏÉÓË ÂÅÚ ÕÞ£ÔÁ ÒÅÇÉÓÔÒÁ |quit: ÏÔÍÅÎÉÔØ É ×ÙÊÔÉ"
+66 "expand: ÚÁÍÅÎÑÔØ ÔÁÂÙ |noexpand: ÎÅ ÚÁÍÅÎÑÔØ ÔÁÂÙ ÐÒÏÂÅÌÁÍÉ "
+67 " ÎÁÖÍÉÔÅ Esc (^[) ÄÌÑ ×ÙÚÏ×Á ÍÅÎÀ"
+68 "ÆÁÊÌ ÎÅ ÕËÁÚÁÎ"
+69 "ascii-ËÏÄ: "
+70 "ÐÅÒÅÄÁÀ ÓÏÄÅÒÖÉÍÏÅ ÂÕÆÅÒÁ × \"%s\" "
+71 "ËÏÍÁÎÄÁ: "
+72 "ÚÁÐÉÓÁÔØ × ÆÁÊÌ: "
+73 "ÐÒÏÞÅÓÔØ ÆÁÊÌ: "
+74 "ascii-ËÏÄ ÓÉÍ×ÏÌÁ = %d"
+75 "ÎÅ×ÅÒÎÁÑ ËÏÍÁÎÄÁ \"%s\""
+76 "ÎÅÏÄÎÏÚÎÁÞÎÏÅ ÓÏËÒÁÝÅÎÉÅ ËÏÍÁÎÄÙ"
+77 "ÓÔÒÏËÁ %d "
+78 "ÄÌÉÎÁ = %d ÓÉÍ×."
+79 "ÔÅËÕÝÉÊ ÆÁÊÌ: \"%s\" "
+80 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-i] [-e] [-h] [+ÎÏÍÅÒ_ÓÔÒÏËÉ] [ÆÁÊÌ(Ù)]\n"
+81 " -i ÏÔËÌÀÞÉÔØ ÏËÎÏ ÐÏÄÓËÁÚËÉ\n"
+82 " -e ÎÅ ÚÁÍÅÎÑÔØ ÔÁÂÕÌÑÃÉÀ ÐÒÏÂÅÌÁÍÉ\n"
+83 " -h ÎÅ ×ÙÄÅÌÑÔØ ÒÁÍËÉ\n"
+84 "\"%s\" Ñ×ÌÑÅÔÓÑ ËÁÔÁÌÏÇÏÍ"
+85 "ÎÏ×ÙÊ ÆÁÊÌ \"%s\""
+86 "ÎÅ ÍÏÇÕ ÏÔËÒÙÔØ \"%s\""
+87 "ÆÁÊÌ \"%s\", %d ÓÔÒÏË"
+88 "ÆÁÊÌ \"%s\" ÐÒÏÞÉÔÁÎ"
+89 "ÞÉÔÁÅÍ ÆÁÊÌ \"%s\""
+90 ", ÔÏÌØËÏ ÄÌÑ ÞÔÅÎÉÑ"
+91 "ÆÁÊÌ \"%s\", %d ÓÔÒÏË"
+92 "××ÅÄÉÔÅ ÉÍÑ ÆÁÊÌÁ: "
+93 "ÉÍÑ ÆÁÊÌÁ ÎÅ ÚÁÄÁÎÏ: ÆÁÊÌ ÎÅ ÓÏÈÒÁΣÎ"
+94 "÷Ù Õ×ÅÒÅÎÙ, ÞÔÏ ÈÏÔÉÔÅ ÏÔÍÅÎÉÔØ Ó×ÏÉ ÉÚÍÅÎÅÎÉÑ? (y/n [n]) "
+95 "y"
+96 "ÆÁÊÌ ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ, ÐÅÒÅÐÉÓÁÔØ ÐÏ×ÅÒÈ? (y/n) [n] "
+97 "ÎÅ ÍÏÇÕ ÓÏÚÄÁÔØ ÆÁÊÌ \"%s\""
+98 "ÚÁÐÉÓÙ×ÁÀ ÆÁÊÌ \"%s\""
+99 "\"%s\" %d ÓÔÒÏË, %d ÓÉÍ×ÏÌÏ×"
+100 " ...ÉÄ£Ô ÐÏÉÓË"
+101 "ÐÏÄÓÔÒÏËÁ \"%s\" ÎÅ ÎÁÊÄÅÎÁ"
+102 "ÞÔÏ ÉÓËÁÔØ: "
+103 "ÎÅ ÍÏÇÕ ÚÁÐÕÓÔÉÔØ %s\n"
+104 "ÄÌÑ ÐÒÏÄÏÌÖÅÎÉÑ ÎÁÖÍÉÔÅ Enter"
+105 "ÄÌÑ ÏÔÍÅÎÙ ÎÁÖÍÉÔÅ Esc"
+106 "ÓÌÉÛËÏÍ ÂÏÌØÛÏÅ ÍÅÎÀ - ÎÅ ÐÏÍÅÝÁÅÔÓÑ × ÜËÒÁÎ"
+107 "ÄÌÑ ÐÒÏÄÏÌÖÅÎÉÑ ÎÁÖÍÉÔÅ ÌÀÂÕÀ ËÌÁ×ÉÛÕ"
+108 "ËÏÍÁÎÄÁ ÏÂÏÌÏÞËÉ: "
+109 "...ÆÏÒÍÁÔÉÒÕÀ ÁÂÚÁÃ..."
+110 "<!echo 'ÓÐÉÓÏË ÐÏÄÏÚÒÉÔÅÌØÎÙÈ ÓÌÏ×'; echo -=-=-=-=-=-"
+111 "ÐÒÏ×ÅÒÑÀ ÐÒÁ×ÏÐÉÓÁÎÉÅ Ó ÐÏÍÏÝØÀ 'spell'"
+112 "ÛÉÒÉÎÁ ÔÅËÓÔÁ: "
+113 "äÅÊÓÔ×ÕÅÔ ÓÔÒÏÇÉÊ ÒÅÖÉÍ: ÎÅ ÉÍÅÀ ÐÒÁ×Á ×ÙÐÏÌÎÑÔØ ÜÔÕ ÏÐÅÒÁÃÉÀ"
+114 " äá"
+115 "îåô"
+116 "HELP"
+117 "WRITE"
+118 "READ"
+119 "LINE"
+120 "FILE"
+121 "CHARACTER"
+122 "REDRAW"
+123 "RESEQUENCE"
+124 "AUTHOR"
+125 "VERSION"
+126 "CASE"
+127 "NOCASE"
+128 "EXPAND"
+129 "NOEXPAND"
+130 "EXIT"
+131 "QUIT"
+132 "INFO"
+133 "NOINFO"
+134 "MARGINS"
+135 "NOMARGINS"
+136 "AUTOFORMAT"
+137 "NOAUTOFORMAT"
+138 "ECHO"
+139 "PRINTCOMMAND"
+140 "RIGHTMARGIN"
+141 "HIGHLIGHT"
+142 "NOHIGHLIGHT"
+143 "EIGHTBIT"
+144 "NOEIGHTBIT"
+145 "ËÌÁ×ÉÛÉ ËÁË × Emacs "
+146 "^a × ÎÁÞÁÌÏ ÓÔÒÏËÉ ^i ÔÁÂÕÌÑÃÉÑ ^r ×ÅÒÎÕÔØ ÓÌÏ×Ï "
+147 "^b ×ÌÅ×Ï ^j ×ÅÒÎÕÔØ ÓÉÍ×ÏÌ ^t × ÓÁÍÙÊ ×ÅÒÈ "
+148 "^c ËÏÍÁÎÄÁ ^k ÕÄÁÌÉÔØ ÓÔÒÏËÕ ^u × ÓÁÍÙÊ ÎÉÚ "
+149 "^d ÕÄÁÌÉÔØ ÓÉÍ×ÏÌ ^l ×ÅÒÎÕÔØ ÓÔÒÏËÕ ^v ÓÌÅÄÕÀÝÁÑ ÓÔÒÁÎÉÃÁ "
+150 "^e × ËÏÎÅà ÓÔÒÏËÉ ^m ÎÏ×ÁÑ ÓÔÒÏËÁ ^w ÕÄÁÌÉÔØ ÓÌÏ×Ï "
+151 "^f ×ÐÒÁ×Ï ^n ×ÎÉÚ ^x ÐÏ×ÔÏÒ ÐÏÉÓËÁ "
+152 "^g ÐÒÅÄ. ÓÔÒÁÎÉÃÁ ^o ÓÉÍ×ÏÌ ÐÏ ascii-ËÏÄÕ ^y ÐÏÉÓË... "
+153 "^h ÚÁÂÏÊ ^p ××ÅÒÈ ^z ÓÌÅÄÕÀÝÅÅ ÓÌÏ×Ï "
+154 "^[ (Esc) ÍÅÎÀ ^y ÐÏÉÓË... ^k ÕÄÁÌÉÔØ ÓÔÒÏËÕ ^p ××ÅÒÈ ^g ÐÒÅÄ. ÓÔÒ."
+155 "^o ascii-ËÏÄ ^x ÐÏ×ÔÏÒ ÐÏÉÓËÁ ^l ×ÅÒÎÕÔØ ÓÔÒÏËÕ ^n ×ÎÉÚ ^v ÓÌÅÄ. ÓÔÒ."
+156 "^u × ÓÁÍÙÊ ÎÉÚ ^a × ÎÁÞÁÌÏ ÓÔÒÏËÉ ^w ÕÄÁÌÉÔØ ÓÌÏ×Ï ^b ×ÌÅ×Ï "
+157 "^t × ÓÁÍÙÊ ×ÅÒÈ ^e × ËÏÎÅà ÓÔÒÏËÉ ^r ×ÅÒÎÕÔØ ÓÌÏ×Ï ^f ×ÐÒÁ×Ï "
+158 "^c ËÏÍÁÎÄÁ ^d ÕÄÁÌÉÔØ ÓÉÍ×ÏÌ ^j ×ÅÒÎÕÔØ ÓÉÍ×ÏÌ ^z ÓÌÅÄÕÀÝÅÅ ÓÌÏ×Ï "
+159 "EMACS"
+160 "NOEMACS"
+161 " +# ÐÅÒÅÊÔÉ Ë ÓÔÒÏËÅ #\n"
+162 "ÎÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÕÓÔÁÎÏ×ËÉ ÐÁÒÁÍÅÔÒÏ× × ÆÁÊÌ .init.ee!"
+163 "ÐÁÒÁÍÅÔÒÙ 'ee' ÓÏÈÒÁÎÅÎÙ × ÆÁÊÌÅ %s"
+164 "ÓÏÈÒÁÎÉÔØ ÕÓÔÁÎÏ×ËÉ"
+165 "õÓÔÁÎÏ×ËÉ ÐÁÒÁÍÅÔÒÏ× 'ee'"
+166 "ÓÏÈÒÁÎÉÔØ × ÔÅËÕÝÅÍ ËÁÔÁÌÏÇÅ"
+167 "ÓÏÈÒÁÎÉÔØ × ÄÏÍÁÛÎÅÍ ËÁÔÁÌÏÇÅ"
+168 "ÕÓÔÁÎÏ×ËÉ ÐÁÒÁÍÅÔÒÏ× 'ee' ÎÅ ÓÏÈÒÁÎÅÎÙ"
+169 "ÐÒÉ ÚÁÐÕÓËÅ 'ree' ÎÅÏÂÈÏÄÉÍÏ ÕËÁÚÁÔØ ÆÁÊÌ ÄÌÑ ÒÅÄÁËÔÉÒÏ×ÁÎÉÑ"
+180 "ÓÌÉÛËÏÍ ÂÏÌØÛÏÅ ÍÅÎÀ - ÎÅ ÐÏÍÅÝÁÅÔÓÑ × ÜËÒÁÎ"
+181 "^^ÄÁÌØÛÅ^^"
+182 "VVÄÁÌØÛÅVV"
+183 "16-ÂÉÔÎÙÅ ÓÉÍ×ÏÌÙ "
+184 "16BIT"
+185 "NO16BIT"
diff --git a/usr.bin/ee/nls/uk_UA.KOI8-U/ee.msg b/usr.bin/ee/nls/uk_UA.KOI8-U/ee.msg
new file mode 100644
index 0000000..a9d7fcf
--- /dev/null
+++ b/usr.bin/ee/nls/uk_UA.KOI8-U/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $FreeBSD$
+$
+$
+$set 1
+$quote "
+1 "ÍÅÎÀ ÒÅÖÉͦ×"
+2 "ÔÁÂÕÌÑæÑ->ÐÒϦÌÉ "
+3 "ÒÅ­¦ÓÔÒÏ-ÚÁÌÅÖÎÉÊ ÐÏÛÕË "
+4 "Á×ÔÏ-ÐÅÒÅ×ÅÄÅÎÎÑ ÒÑÄËÕ "
+5 "Á×ÔÏ-ÆÏÒÍÁÔ ÐÁÒÁÇÒÁÆÕ "
+6 "8-¦ÔΦ ÓÉÍ×ÏÌÉ "
+7 "¦ÎÆÏÒÍÁæÊΊצËÎÏ "
+8 "ÐÒÁ×Á ÍÅÖÁ "
+9 "ÍÅÎÀ ×ÉÈÏÄÕ"
+10 "ÚÂÅÒÅÇÔÉ ÚͦÎÉ"
+11 "ÎÅ ÚÂÅÒ¦ÇÁÔÉ"
+12 "ÆÁÊÌÏ×Å ÍÅÎÀ"
+13 "ÐÒÏÞÉÔÁÔÉ ÆÁÊÌ"
+14 "ÚÁÐÉÓÁÔÉ ÆÁÊÌ"
+15 "ÚÂÅÒÅÇÔÉ ÆÁÊÌ"
+16 "ÒÏÚÄÒÕËÕ×ÁÔÉ ×ͦÓÔ ÒÅÄÁËÔÏÒÁ"
+17 "ÍÅÎÀ ÐÏÛÕËÕ"
+18 "ÝÏ ÛÕËÁÔÉ..."
+19 "ÐÏÛÕË"
+20 "íÅÎÀ ÐÅÒÅצÒËÉ ÐÒÁ×ÏÐÉÓÕ"
+21 "×ÉËÏÒÉÓÔÕ×Õ×ÁÔÉ 'spell'"
+22 "×ÉËÏÒÉÓÔÕ×Õ×ÁÔÉ 'ispell'"
+23 "Ò¦ÚÎÅ..."
+24 "ÆÏÒÍÁÔÕ×ÁÎÎÑ ÐÁÒÁÇÒÁÆÕ"
+25 "ËÏÍÁÎÄÁ ÏÂÏÌÏÎËÉ"
+26 "ÐÅÒÅצÒËÁ ÐÒÁ×ÏÐÉÓÕ"
+27 "ÇÏÌÏ×ÎÅ ÍÅÎÀ"
+28 "×ÉÊÔÉ Ú ÒÅÄÁËÔÏÒÕ"
+29 "ÄÏצÄËÁ"
+30 "ÏÐÅÒÁæ§ Ú ÆÁÊÌÁÍÉ"
+31 "ÏÎÏ×ÉÔÉ ÅËÒÁÎ"
+32 "ËÏÎƦÇÕÒÁæÑ"
+33 "ÐÏÛÕË"
+34 "Ò¦ÚÎÅ"
+35 "ëÌÁצۦ ËÅÒÕ×ÁÎÎÑ: "
+36 "^a ascii-ËÏÄ ^i ÔÁÂÕÌÑÃ¦Ñ ^r ×ÐÒÁ×Ï "
+37 "^b ÎÉÚ ÔÅËÓÔÕ ^j ÎÏ×ÉÊ ÒÑÄÏË ^t ×ÅÒÈ ÔÅËÓÔÕ "
+38 "^c ËÏÍÁÎÄÁ ^k ÓÔÅÒÔÉ ÓÉÍ×ÏÌ ^u ××ÅÒÈ "
+39 "^d ×ÎÉÚ ^l ×̦×Ï ^v צÄÎÏ×ÉÔÉ ÓÌÏ×Ï "
+40 "^e ÝÏ ÛÕËÁÔÉ... ^m ÎÏ×ÉÊ ÒÑÄÏË ^w ÓÔÅÒÔÉ ÓÌÏ×Ï "
+41 "^f צÄÎÏ×ÉÔÉ ÓÉÍ×ÏÌ ^n ÎÁÓÔÕÐÎÁ ÓÔÏÒ¦ÎËÁ ^x ÛÕËÁÔÉ "
+42 "^g ÐÏÞÁÔÏË ÒÑÄËÕ ^o ˦ÎÅÃØ ÒÑÄËÕ ^y ÓÔÅÒÔÉ ÒÑÄÏË "
+43 "^h ÚÁÔÅÒÔÉ ^p ÐÏÐÅÒÅÄÎÑ ÓÔÏÒ¦ÎËÁ ^z צÄÎÏ×ÉÔÉ ÒÑÄÏË "
+44 "^[ (escape) ÍÅÎÀ ESC-Enter: ×ÉÊÔÉ Ú ee "
+45 " "
+46 "ëÏÍÁÎÄÉ: "
+47 "help : ÃÑ ÄÏצÄËÁ file : ÐÏËÁÚÁÔÉ ¦Í'Ñ ÆÁÊÌÕ "
+48 "read : ÐÒÏÞÉÔÁÔÉ ÆÁÊÌ char : ascii-ËÏÄ ÓÉÍ×ÏÌÕ "
+49 "write : ÚÁÐÉÓÁÔÉ ÆÁÊÌ case : ÒÅ­¦ÓÔÒÏ-ÚÁÌÅÖÎÉÊ ÐÏÛÕË "
+50 "exit : ÚÂÅÒÅÇÔÉ +×ÉÈ¦Ä nocase : ÒÅ­¦ÓÔÒÏ-ÎÅÚÁÌÅÖÎÉÊ ÐÏÛÕË"
+51 "quit : ×ÉÊÔÉ ÂÅÚ ÚͦΠ!ËÏÍÁÎÄÁ: ×ÉËÏÎÁÔÉ ËÏÍÁÎÄÕ ÏÂÏÌÏÎËÉ "
+52 "line : ÐÏËÁÚÁÔÉ ÎÏÍÅÒ ÒÑÄËÕ 0-9 : ÐÅÒÅÊÔÉ ÄÏ ÒÑÄËÕ "
+53 "expand : ÒÏÚÛÉÒÀ×ÁÔÉ ÔÁÂÕÌÑæÀ noexpand: ÎÅ ÒÏÚÛÉÒÀ×ÁÔÉ ÔÁÂÕÌÑæÀ "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [ÆÁÊÌ(É)] "
+56 "+# ËÕÒÓÏÒ ÎÁ ÒÑÄÏË -i:ÂÅÚ ¦ÎÆÏ-צËÎÁ -e:ÎÅ ÒÏÚÛÉÒÀ×ÁÔÉ ôáâÉ -h:ÂÅÚ Ð¦ÄÓצÔËÉ"
+57 "^[ (ESC) ÍÅÎÀ ^e ÝÏ ÛÕËÁÔÉ... ^y ÓÔÅÒÔÉ ÒÑÄÏË ^u ××ÅÒÈ ^p -ÓÔÏÒ¦ÎËÁ "
+58 "^a ascii-ËÏÄ ^x ÐÏÛÕË ^z צÄÎÏ×. ÒÑÄÏË ^d ×ÎÉÚ ^n +ÓÔÏÒ¦ÎËÁ "
+59 "^b ÎÉÚ ÔÅËÓÔÕ ^g ÐÏÞÁÔÏË ÒÑÄËÕ ^w ÓÔÅÒÔÉ ÓÌÏ×Ï ^l ×̦×Ï "
+60 "^t ×ÅÒÈ ÔÅËÓÔÕ ^o ˦ÎÅÃØ ÒÑÄËÕ ^v צÄÎÏ×. ÓÌÏ×Ï ^r ×ÐÒÁ×Ï "
+61 "^c ËÏÍÁÎÄÁ ^k ÓÔÅÒÔÉ ÓÉÍ×ÏÌ ^f צÄÎÏ×ÉÔÉ ÓÉÍ×ÏÌ ESC-Enter: ×ÉÊÔÉ Ú ee"
+62 "help : ÄÏצÄËÁ |file : ÐÏËÁÚÁÔÉ ¦'ÍÑ ÆÁÊÌÕ |line : ÎÏÍÅÒ ÒÑÄËÕ "
+63 "read : ÐÒÏÞÉÔÁÔÉ ÆÁÊÌ |char : ascii-ËÏÄ ÓÉÍ×ÏÌÕ |0-9 : ÐÅÒÅÊÔÉ ÄÏ ÒÑÄËÕ"
+64 "write: ÚÁÐÉÓÁÔÉ ÆÁÊÌ |case : ÒÅ­¦ÓÔÒÏ-ÚÁÌÅÖÎÉÊ ÐÏÛÕË |exit : ÚÂÅÒÅÇÔÉ +×ÉȦÄ"
+65 "!ËÍÄ : ÚÏ×Î. ËÏÍÁÎÄÁ |nocase: ÒÅ­¦ÓÔÒÏ-ÎÅÚÁÌ. ÐÏÛÕË |quit : ×ÉÊÔÉ ÂÅÚ ÚͦÎ"
+66 "expand: ÒÏÚÛÉÒÀ×ÁÔÉ |noexpand: ÎÅ ÒÏÚÛÉÒÀ×ÁÔÉ ôáâÉ × ÐÒϦÌÉ "
+67 " ÎÁÔÉÓΦÔØ Esc (^[) ÝÏ ×ÉËÌÉËÁÔÉ ÍÅÎÀ"
+68 "ÎÅÍÁ¤ ÆÁÊÌÕ"
+69 "ascii-ËÏÄ: "
+70 "צÄÓÉÌÁÎÎÑ ×ͦÓÔÕ ÂÕÆÅÒÕ ÄÏ \"%s\" "
+71 "ËÏÍÁÎÄÁ: "
+72 "¦Í'Ñ ÆÁÊÌÕ ÄÌÑ ÚÁÐÉÓÕ: "
+73 "¦Í'Ñ ÆÁÊÌÕ ÄÌÑ ÞÉÔÁÎÎÑ: "
+74 "ÓÉÍ×ÏÌ = %d"
+75 "ÎÅצÄÏÍÁ ËÏÍÁÎÄÁ \"%s\""
+76 "ÃÑ ËÏÍÁÎÄÁ ÎÅ ÕΦËÁÌØÎÁ"
+77 "ÒÑÄÏË %d "
+78 "ÄÏ×ÖÉÎÁ = %d"
+79 "ÐÏÔÏÞÎÉÊ ÆÁÊÌ: \"%s\" "
+80 "÷ÉËÏÒÉÓÔÁÎÎÑ: %s [-i] [-e] [-h] [+ÎÏÍÅÒ_ÒÑÄËÕ] [ÆÁÊÌ(É)]\n"
+81 " -i ÎÅ ÐÏËÁÚÕ×ÁÔÉ ¦ÎÆÏÒÍÁæÊΊצËÎÏ\n"
+82 " -e ÎÅ ÐÅÒÅÔ×ÏÒÀ×ÁÔÉ ÔÁÂÕÌÑæÀ × ÐÒϦÌÉ\n"
+83 " -h ÎÅ ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ Ð¦ÄÓצÔËÕ\n"
+84 " ÆÁÊÌ \"%s\" - ÎÁÓÐÒÁ×Ħ ËÁÔÁÌÏÇ"
+85 "ÎÏ×ÉÊ ÆÁÊÌ \"%s\""
+86 "ÎÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ \"%s\""
+87 "ÆÁÊÌ \"%s\", ÒÑÄ˦×: %d"
+88 "ÆÁÊÌ \"%s\" ÐÒÏÞÉÔÁÎÏ"
+89 "ÞÉÔÁÎÎÑ ÆÁÊÌÕ \"%s\""
+90 ", ÔiÌØËu ÄÌÑ ÞÉÔÁÎÎÑ"
+91 "ÆÁÊÌ \"%s\", ÒÑÄ˦×: %d"
+92 "××ÅĦÔØ ¦Í'Ñ ÆÁÊÌÕ: "
+93 "¦Í'Ñ ÆÁÊÌÕ ÎÅ ÚÁÄÁÎÏ: ÆÁÊÌ ÎÅ ÚÁÐÉÓÁÎÏ "
+94 "×ÎÅÓÅÎÏ ÚͦÎÉ, ×É ×ÐÅ×ÎÅΦ? (y/n [n]) "
+95 "y"
+96 "ÆÁÊÌ ×ÖÅ ¦ÓÎÕ¤, ÐÅÒÅÚÁÐÉÓÁÔÉ? (y/n) [n] "
+97 "ÎÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÆÁÊÌ \"%s\""
+98 "ÚÁÐÉÓ ÆÁÊÌÕ \"%s\""
+99 "\"%s\", ÒÑÄ˦×: %d, ÓÉÍ×Ï̦×: %d"
+100 " ...ÐÏÛÕË"
+101 "ÒÑÄÏË \"%s\" ÎÅ ÚÎÁÊÄÅÎÏ"
+102 "ÝÏ ÛÕËÁÔÉ: "
+103 "ÎÅ ÍÏÖÕ ×ÉËÏÎÁÔÉ %s\n"
+104 "ÎÁÔÉÓΦÔØ <enter> ÄÌÑ ÐÒÏÄÏ×ÖÅÎÎÑ..."
+105 "Esc - צÄͦÎÁ"
+106 "ÍÅÎÀ ÚÁ×ÅÌÉËÅ ÄÌÑ ÅËÒÁÎÕ"
+107 "ÎÁÔÉÓΦÔØ ÂÕÄØ-ÑËÕ ËÌÁצÛÕ ÄÌÑ ÐÒÏÄÏ×ÖÅÎÎÑ..."
+108 "ËÏÍÁÎÄÁ ÏÂÏÌÏÎËÉ: "
+109 "...ÆÏÒÍÁÔÕÀ ÐÁÒÁÇÒÁÆ..."
+110 "<!echo 'ÓÐÉÓÏË ÎÅÒÏÚЦÚÎÁÎÉÈ Ó̦×'; echo -=-=-=-=-=-"
+111 "צÄÓÉÌÁÎÎÑ ×ͦÓÔÕ ÂÕÆÅÒÕ ÄÏ 'spell'"
+112 "ÐÒÁ×Á ÍÅÖÁ: "
+113 "ïÂÍÅÖÅÎÉÊ ÒÅÖÉÍ: ÎÅ ÍÏÖÕ ×ÉËÏÎÁÔÉ ÃÀ ÏÐÅÒÁæÀ"
+114 "ON"
+115 "OFF"
+116 "HELP"
+117 "WRITE"
+118 "READ"
+119 "LINE"
+120 "FILE"
+121 "CHARACTER"
+122 "REDRAW"
+123 "RESEQUENCE"
+124 "AUTHOR"
+125 "VERSION"
+126 "CASE"
+127 "NOCASE"
+128 "EXPAND"
+129 "NOEXPAND"
+130 "EXIT"
+131 "QUIT"
+132 "INFO"
+133 "NOINFO"
+134 "MARGINS"
+135 "NOMARGINS"
+136 "AUTOFORMAT"
+137 "NOAUTOFORMAT"
+138 "ECHO"
+139 "PRINTCOMMAND"
+140 "RIGHTMARGIN"
+141 "HIGHLIGHT"
+142 "NOHIGHLIGHT"
+143 "EIGHTBIT"
+144 "NOEIGHTBIT"
+145 "ÐÒÉ×'ÑÚËÁ ËÌÁ×¦Û Emacs "
+146 "^a ÐÏÞÁÔÏË ÒÑÄËÕ ^i ÔÁÂÕÌÑÃ¦Ñ ^r צÄÎÏ×ÉÔÉ ÓÌÏ×Ï "
+147 "^b ÎÁÚÁÄ 1 ÓÉÍ×ÏÌ ^j צÄÎÏ×ÉÔÉ ÓÉÍ×ÏÌ ^t ÐÏÞÁÔÏË ÆÁÊÌÕ "
+148 "^c ËÏÍÁÎÄÁ ^k ÓÔÅÒÔÉ ÒÑÄÏË ^u ˦ÎÅÃØ ÆÁÊÌÕ "
+149 "^d ÓÔÅÒÔÉ ÓÉÍ×ÏÌ ^l צÄÎÏ×ÉÔÉ ÓÉÍ×ÏÌ ^v ÎÁÓÔÕÐÎÁ ÓÔÏÒ¦ÎËÁ "
+150 "^e ˦ÎÅÃØ ÒÑÄËÕ ^m ÎÏ×ÉÊ ÒÑÄÏË ^w ÓÔÅÒÔÉ ÓÌÏ×Ï "
+151 "^f ×ÐÅÒÅÄ 1 ÓÉÍ×ÏÌ ^n ÎÁÓÔÕÐÎÉÊ ÒÑÄÏË ^x ÐÏÛÕË "
+152 "^g ÎÁÚÁÄ 1 ÓÔÏÒ¦ÎËÕ ^o ×ÓÔÁ×ÉÔÉ ASCII ^y ÝÏ ÛÕËÁÔÉ... "
+153 "^h ÚÁÔÅÒÔÉ ^p ÐÏÐÅÒÅÄÎ¦Ê ÒÑÄÏË ^z ÎÁÓÔÕÐÎÅ ÓÌÏ×Ï "
+154 "^[ (ESC) ÍÅÎÀ ^y ÝÏ ÛÕËÁÔÉ ^k ÓÔÅÒÔÉ ÒÑÄÏË ^p -ÒÑÄÏË ^g -ÓÔÏÒ¦ÎËÁ"
+155 "^o ascii-ËÏÄ ^x ÐÏÛÕË ^l צÄÎÏ×. ÒÑÄÏË ^n +ÒÑÄÏË ^v +ÓÔÏÒ¦ÎËÁ"
+156 "^u ˦ÎÅÃØ ÆÁÊÌÕ ^a ÐÏÞÁÔÏË ÒÑÄËÕ ^w ÓÔÅÒÔÉ ÓÌÏ×Ï ^b ÎÁÚÁÄ 1 ÓÉÍ×ÏÌ "
+157 "^t ÐÏÞÁÔÏË ÆÁÊÌÕ ^e ˦ÎÅÃØ ÒÑÄËÕ ^r צÄÎÏ×. ÓÌÏ×Ï ^f ×ÐÅÒÅÄ 1 ÓÉÍ×ÏÌ "
+158 "^c ËÏÍÁÎÄÁ ^d ÓÔÅÒÔÉ ÓÉÍ×ÏÌ ^j צÄÎ. ÓÉÍ×ÏÌ ^z ÎÁÓÔÕÐÎÅ ÓÌÏ×Ï "
+159 "EMACS"
+160 "NOEMACS"
+161 " +# ÐÏÓÔÁ×ÉÔÉ ËÕÒÓÏÒ × ÒÑÄÏË Ú ÎÏÍÅÒÏÍ\n"
+162 "ÎÅ ÍÏÖÕ ×¦ÄËÒÉÔÉ .init.ee ÄÌÑ ÚÁÐÉÓÕ, ËÏÎƦÇÕÒÁæÀ Îe ÚÁÐÉÓÁÎÏ!"
+163 "ËÏÎƦÇÕÒÁæÀ ee ÚÁÐÉÓÁÎÏ Õ ÆÁÊÌ %s"
+164 "ÚÂÅÒÅÇÔÉ ËÏÎƦÇÕÒÁæÀ "
+165 "ÚÂÅÒÅÇÔÉ ËÏÎƦÇÕÒÁæÀ ee"
+166 "ÚÂÅÒÅÇÔÉ × ÐÏÔÏÞÎÏÍÕ ËÁÔÁÌÏÚ¦"
+167 "ÚÂÅÒÅÇÔÉ × ÄÏÍÁÛÎØÏÍÕ ËÁÔÁÌÏÚ¦"
+168 "ËÏÎƦÇÕÒÁæÀ ee Îe ÚÁÐÉÓÁÎÏ"
+169 "Ð¦Ä ÞÁÓ ÚÁÐÕÓËÕ ree ÓÌ¦Ä ×ËÁÚÕ×ÁÔÉ ¦Í'Ñ ÆÁÊÌÕ"
+180 "ÍÅÎÀ ÚÁ×ÅÌÉËÅ ÄÌÑ ÅËÒÁÎÕ"
+181 "^^ÄÁ̦^^"
+182 "VVÄÁ̦VV"
+183 "16-¦ÔÏצ ÓÉÍ×ÏÌÉ "
+184 "16â¶ô"
+185 "ÎÅ16â¶ô"
diff --git a/usr.bin/elf2aout/Makefile b/usr.bin/elf2aout/Makefile
new file mode 100644
index 0000000..2959539
--- /dev/null
+++ b/usr.bin/elf2aout/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= elf2aout
+
+NO_WERROR=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/elf2aout/Makefile.depend b/usr.bin/elf2aout/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/elf2aout/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/elf2aout/elf2aout.1 b/usr.bin/elf2aout/elf2aout.1
new file mode 100644
index 0000000..33c6036
--- /dev/null
+++ b/usr.bin/elf2aout/elf2aout.1
@@ -0,0 +1,64 @@
+.\" Copyright (c) 2008 Tom Rhodes
+.\" 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 December 23, 2008
+.Dt ELF2AOUT 1
+.Os
+.Sh NAME
+.Nm elf2aout
+.Nd "Convert ELF binary to a.out format"
+.Sh SYNOPSIS
+.Nm
+.Op Fl o Ar outfile
+.Ar infile
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to convert an ELF formatted binary,
+namely a kernel, to an a.out formatted one.
+Most
+.Tn OpenBoot
+firmware require an a.out format or FCode boot image
+and this utility is designed to accommodate.
+If
+.Ar infile
+is not in ELF format, an error message will be presented.
+.Sh SEE ALSO
+.Xr elf 3 ,
+.Xr a.out 5
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 4.6 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility was written by
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
+This manual page was written by
+.An Tom Rhodes Aq Mt trhodes@FreeBSD.org .
diff --git a/usr.bin/elf2aout/elf2aout.c b/usr.bin/elf2aout/elf2aout.c
new file mode 100644
index 0000000..7e1ece6
--- /dev/null
+++ b/usr.bin/elf2aout/elf2aout.c
@@ -0,0 +1,162 @@
+/*-
+ * Copyright (c) 2002 Jake Burkholder
+ * 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/elf64.h>
+#include <sys/endian.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define xe16toh(x) ((data == ELFDATA2MSB) ? be16toh(x) : le16toh(x))
+#define xe32toh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x))
+#define xe64toh(x) ((data == ELFDATA2MSB) ? be64toh(x) : le64toh(x))
+#define htoxe32(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x))
+
+struct exec {
+ u_int32_t a_magic;
+ u_int32_t a_text;
+ u_int32_t a_data;
+ u_int32_t a_bss;
+ u_int32_t a_syms;
+ u_int32_t a_entry;
+ u_int32_t a_trsize;
+ u_int32_t a_drsize;
+};
+#define A_MAGIC 0x01030107
+
+static void usage(void);
+
+/*
+ * elf to a.out converter for freebsd/sparc64 bootblocks.
+ */
+int
+main(int ac, char **av)
+{
+ Elf64_Half phentsize;
+ Elf64_Half machine;
+ Elf64_Half phnum;
+ Elf64_Xword filesz;
+ Elf64_Xword memsz;
+ Elf64_Addr entry;
+ Elf64_Off offset;
+ Elf64_Off phoff;
+ Elf64_Word type;
+ unsigned char data;
+ struct stat sb;
+ struct exec a;
+ Elf64_Phdr *p;
+ Elf64_Ehdr *e;
+ void *v;
+ int efd;
+ int fd;
+ int c;
+ int i;
+
+ fd = STDIN_FILENO;
+ while ((c = getopt(ac, av, "o:")) != -1)
+ switch (c) {
+ case 'o':
+ if ((fd = open(optarg, O_CREAT|O_RDWR, 0644)) < 0)
+ err(1, "%s", optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+ if (ac == 0)
+ usage();
+
+ if ((efd = open(*av, O_RDONLY)) < 0 || fstat(efd, &sb) < 0)
+ err(1, NULL);
+ v = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, efd, 0);
+ if ((e = v) == MAP_FAILED)
+ err(1, NULL);
+
+ if (!IS_ELF(*e))
+ errx(1, "not an elf file");
+ if (e->e_ident[EI_CLASS] != ELFCLASS64)
+ errx(1, "wrong class");
+ data = e->e_ident[EI_DATA];
+ if (data != ELFDATA2MSB && data != ELFDATA2LSB)
+ errx(1, "wrong data format");
+ if (e->e_ident[EI_VERSION] != EV_CURRENT)
+ errx(1, "wrong elf version");
+ machine = xe16toh(e->e_machine);
+ if (machine != EM_SPARCV9 && machine != EM_ALPHA)
+ errx(1, "wrong machine type");
+ phentsize = xe16toh(e->e_phentsize);
+ if (phentsize != sizeof(*p))
+ errx(1, "phdr size mismatch");
+
+ entry = xe64toh(e->e_entry);
+ phoff = xe64toh(e->e_phoff);
+ phnum = xe16toh(e->e_phnum);
+ p = (Elf64_Phdr *)((char *)e + phoff);
+ bzero(&a, sizeof(a));
+ for (i = 0; i < phnum; i++) {
+ type = xe32toh(p[i].p_type);
+ switch (type) {
+ case PT_LOAD:
+ if (a.a_magic != 0)
+ errx(1, "too many loadable segments");
+ filesz = xe64toh(p[i].p_filesz);
+ memsz = xe64toh(p[i].p_memsz);
+ offset = xe64toh(p[i].p_offset);
+ a.a_magic = htoxe32(A_MAGIC);
+ a.a_text = htoxe32(filesz);
+ a.a_bss = htoxe32(memsz - filesz);
+ a.a_entry = htoxe32(entry);
+ if (write(fd, &a, sizeof(a)) != sizeof(a) ||
+ write(fd, (char *)e + offset, filesz) != (ssize_t)filesz)
+ err(1, NULL);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: elf2aout [-o outfile] infile\n");
+ exit(1);
+}
diff --git a/usr.bin/elfcopy/Makefile b/usr.bin/elfcopy/Makefile
new file mode 100644
index 0000000..3ffc0d5
--- /dev/null
+++ b/usr.bin/elfcopy/Makefile
@@ -0,0 +1,46 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+ELFCOPYDIR= ${ELFTCDIR}/elfcopy
+
+.PATH: ${ELFCOPYDIR}
+
+.if ${MK_ELFCOPY_AS_OBJCOPY} != "no"
+PROG= objcopy
+objcopy.1: elfcopy.1
+ sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
+ -e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET}
+CLEANFILES+= objcopy.1
+.else
+PROG= elfcopy
+.endif
+
+SRCS= archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
+
+WARNS?= 5
+
+LIBADD= archive elftc elf pe
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
+CFLAGS+=-DWITH_PE=1
+
+MAN= ${PROG}.1 strip.1
+
+LINKS= ${BINDIR}/${PROG} ${BINDIR}/strip
+
+# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
+# We need to link against the correct version of these files. One
+# solution is to include ../../sys in the include path. This causes
+# problems when a header file in sys depends on a file in another
+# part of the tree, e.g. a machine dependent header.
+#
+SRCS+= sys/elf_common.h
+CLEANDIRS= sys
+CFLAGS+= -I.
+sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
+ mkdir -p ${.OBJDIR}/sys
+ ln -sf ${.ALLSRC} ${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/elfcopy/Makefile.depend b/usr.bin/elfcopy/Makefile.depend
new file mode 100644
index 0000000..6416d53
--- /dev/null
+++ b/usr.bin/elfcopy/Makefile.depend
@@ -0,0 +1,28 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libelftc \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libpe \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/elfdump/Makefile b/usr.bin/elfdump/Makefile
new file mode 100644
index 0000000..22e1ca9
--- /dev/null
+++ b/usr.bin/elfdump/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= elfdump
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/elfdump/Makefile.depend b/usr.bin/elfdump/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/elfdump/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/elfdump/elfdump.1 b/usr.bin/elfdump/elfdump.1
new file mode 100644
index 0000000..a549d53
--- /dev/null
+++ b/usr.bin/elfdump/elfdump.1
@@ -0,0 +1,112 @@
+.\" Copyright (c) 2003 David O'Brien
+.\" 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 January 15, 2003
+.Dt ELFDUMP 1
+.Os
+.Sh NAME
+.Nm elfdump
+.Nd "display information about"
+.Tn ELF
+files
+.Sh SYNOPSIS
+.Nm
+.Fl a | cdeGhinprs
+.Op Fl w Ar file
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility
+dumps various information about the specified
+.Tn ELF
+.Ar file .
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl w Ar file"
+.It Fl a
+Dump all information.
+.It Fl c
+Dump section headers.
+.It Fl d
+Dump dynamic symbols.
+.It Fl e
+Dump ELF header.
+.It Fl G
+Dump the GOT.
+.It Fl h
+Dump the hash values.
+.It Fl i
+Dump the dynamic interpreter.
+.It Fl n
+Dump note sections.
+.It Fl p
+Dump the program header.
+.It Fl r
+Dump relocations.
+.It Fl s
+Dump the symbol table.
+.It Fl w Ar file
+Write output to a
+.Ar file
+instead of the standard output.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following is an example of a typical usage
+of the
+.Nm
+command:
+.Pp
+.Dl "elfdump -a -w output /bin/ls"
+.Sh SEE ALSO
+.Xr objdump 1 ,
+.Xr readelf 1
+.Rs
+.%A "AT&T Unix Systems Labs"
+.%T "System V Application Binary Interface"
+.%U http://www.sco.com/developers/gabi/
+.Re
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility
+was written by
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
+This
+manual page was written by
+.An David O'Brien Aq Mt obrien@FreeBSD.org .
+.Sh BUGS
+Does not fully implement the
+.Tn ELF
+gABI.
diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c
new file mode 100644
index 0000000..e42727a
--- /dev/null
+++ b/usr.bin/elfdump/elfdump.c
@@ -0,0 +1,1257 @@
+/*-
+ * Copyright (c) 2003 David O'Brien. All rights reserved.
+ * Copyright (c) 2001 Jake Burkholder
+ * 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/capsicum.h>
+#include <sys/elf32.h>
+#include <sys/elf64.h>
+#include <sys/endian.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ED_DYN (1<<0)
+#define ED_EHDR (1<<1)
+#define ED_GOT (1<<2)
+#define ED_HASH (1<<3)
+#define ED_INTERP (1<<4)
+#define ED_NOTE (1<<5)
+#define ED_PHDR (1<<6)
+#define ED_REL (1<<7)
+#define ED_SHDR (1<<8)
+#define ED_SYMTAB (1<<9)
+#define ED_ALL ((1<<10)-1)
+
+#define elf_get_addr elf_get_quad
+#define elf_get_off elf_get_quad
+#define elf_get_size elf_get_quad
+
+enum elf_member {
+ D_TAG = 1, D_PTR, D_VAL,
+
+ E_CLASS, E_DATA, E_OSABI, E_TYPE, E_MACHINE, E_VERSION, E_ENTRY,
+ E_PHOFF, E_SHOFF, E_FLAGS, E_EHSIZE, E_PHENTSIZE, E_PHNUM, E_SHENTSIZE,
+ E_SHNUM, E_SHSTRNDX,
+
+ N_NAMESZ, N_DESCSZ, N_TYPE,
+
+ P_TYPE, P_OFFSET, P_VADDR, P_PADDR, P_FILESZ, P_MEMSZ, P_FLAGS,
+ P_ALIGN,
+
+ SH_NAME, SH_TYPE, SH_FLAGS, SH_ADDR, SH_OFFSET, SH_SIZE, SH_LINK,
+ SH_INFO, SH_ADDRALIGN, SH_ENTSIZE,
+
+ ST_NAME, ST_VALUE, ST_SIZE, ST_INFO, ST_SHNDX,
+
+ R_OFFSET, R_INFO,
+
+ RA_OFFSET, RA_INFO, RA_ADDEND
+};
+
+typedef enum elf_member elf_member_t;
+
+static int elf32_offsets[] = {
+ 0,
+
+ offsetof(Elf32_Dyn, d_tag), offsetof(Elf32_Dyn, d_un.d_ptr),
+ offsetof(Elf32_Dyn, d_un.d_val),
+
+ offsetof(Elf32_Ehdr, e_ident[EI_CLASS]),
+ offsetof(Elf32_Ehdr, e_ident[EI_DATA]),
+ offsetof(Elf32_Ehdr, e_ident[EI_OSABI]),
+ offsetof(Elf32_Ehdr, e_type), offsetof(Elf32_Ehdr, e_machine),
+ offsetof(Elf32_Ehdr, e_version), offsetof(Elf32_Ehdr, e_entry),
+ offsetof(Elf32_Ehdr, e_phoff), offsetof(Elf32_Ehdr, e_shoff),
+ offsetof(Elf32_Ehdr, e_flags), offsetof(Elf32_Ehdr, e_ehsize),
+ offsetof(Elf32_Ehdr, e_phentsize), offsetof(Elf32_Ehdr, e_phnum),
+ offsetof(Elf32_Ehdr, e_shentsize), offsetof(Elf32_Ehdr, e_shnum),
+ offsetof(Elf32_Ehdr, e_shstrndx),
+
+ offsetof(Elf_Note, n_namesz), offsetof(Elf_Note, n_descsz),
+ offsetof(Elf_Note, n_type),
+
+ offsetof(Elf32_Phdr, p_type), offsetof(Elf32_Phdr, p_offset),
+ offsetof(Elf32_Phdr, p_vaddr), offsetof(Elf32_Phdr, p_paddr),
+ offsetof(Elf32_Phdr, p_filesz), offsetof(Elf32_Phdr, p_memsz),
+ offsetof(Elf32_Phdr, p_flags), offsetof(Elf32_Phdr, p_align),
+
+ offsetof(Elf32_Shdr, sh_name), offsetof(Elf32_Shdr, sh_type),
+ offsetof(Elf32_Shdr, sh_flags), offsetof(Elf32_Shdr, sh_addr),
+ offsetof(Elf32_Shdr, sh_offset), offsetof(Elf32_Shdr, sh_size),
+ offsetof(Elf32_Shdr, sh_link), offsetof(Elf32_Shdr, sh_info),
+ offsetof(Elf32_Shdr, sh_addralign), offsetof(Elf32_Shdr, sh_entsize),
+
+ offsetof(Elf32_Sym, st_name), offsetof(Elf32_Sym, st_value),
+ offsetof(Elf32_Sym, st_size), offsetof(Elf32_Sym, st_info),
+ offsetof(Elf32_Sym, st_shndx),
+
+ offsetof(Elf32_Rel, r_offset), offsetof(Elf32_Rel, r_info),
+
+ offsetof(Elf32_Rela, r_offset), offsetof(Elf32_Rela, r_info),
+ offsetof(Elf32_Rela, r_addend)
+};
+
+static int elf64_offsets[] = {
+ 0,
+
+ offsetof(Elf64_Dyn, d_tag), offsetof(Elf64_Dyn, d_un.d_ptr),
+ offsetof(Elf64_Dyn, d_un.d_val),
+
+ offsetof(Elf32_Ehdr, e_ident[EI_CLASS]),
+ offsetof(Elf32_Ehdr, e_ident[EI_DATA]),
+ offsetof(Elf32_Ehdr, e_ident[EI_OSABI]),
+ offsetof(Elf64_Ehdr, e_type), offsetof(Elf64_Ehdr, e_machine),
+ offsetof(Elf64_Ehdr, e_version), offsetof(Elf64_Ehdr, e_entry),
+ offsetof(Elf64_Ehdr, e_phoff), offsetof(Elf64_Ehdr, e_shoff),
+ offsetof(Elf64_Ehdr, e_flags), offsetof(Elf64_Ehdr, e_ehsize),
+ offsetof(Elf64_Ehdr, e_phentsize), offsetof(Elf64_Ehdr, e_phnum),
+ offsetof(Elf64_Ehdr, e_shentsize), offsetof(Elf64_Ehdr, e_shnum),
+ offsetof(Elf64_Ehdr, e_shstrndx),
+
+ offsetof(Elf_Note, n_namesz), offsetof(Elf_Note, n_descsz),
+ offsetof(Elf_Note, n_type),
+
+ offsetof(Elf64_Phdr, p_type), offsetof(Elf64_Phdr, p_offset),
+ offsetof(Elf64_Phdr, p_vaddr), offsetof(Elf64_Phdr, p_paddr),
+ offsetof(Elf64_Phdr, p_filesz), offsetof(Elf64_Phdr, p_memsz),
+ offsetof(Elf64_Phdr, p_flags), offsetof(Elf64_Phdr, p_align),
+
+ offsetof(Elf64_Shdr, sh_name), offsetof(Elf64_Shdr, sh_type),
+ offsetof(Elf64_Shdr, sh_flags), offsetof(Elf64_Shdr, sh_addr),
+ offsetof(Elf64_Shdr, sh_offset), offsetof(Elf64_Shdr, sh_size),
+ offsetof(Elf64_Shdr, sh_link), offsetof(Elf64_Shdr, sh_info),
+ offsetof(Elf64_Shdr, sh_addralign), offsetof(Elf64_Shdr, sh_entsize),
+
+ offsetof(Elf64_Sym, st_name), offsetof(Elf64_Sym, st_value),
+ offsetof(Elf64_Sym, st_size), offsetof(Elf64_Sym, st_info),
+ offsetof(Elf64_Sym, st_shndx),
+
+ offsetof(Elf64_Rel, r_offset), offsetof(Elf64_Rel, r_info),
+
+ offsetof(Elf64_Rela, r_offset), offsetof(Elf64_Rela, r_info),
+ offsetof(Elf64_Rela, r_addend)
+};
+
+/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#tag_encodings */
+static const char *
+d_tags(u_int64_t tag)
+{
+ static char unknown_tag[48];
+
+ switch (tag) {
+ case DT_NULL: return "DT_NULL";
+ case DT_NEEDED: return "DT_NEEDED";
+ case DT_PLTRELSZ: return "DT_PLTRELSZ";
+ case DT_PLTGOT: return "DT_PLTGOT";
+ case DT_HASH: return "DT_HASH";
+ case DT_STRTAB: return "DT_STRTAB";
+ case DT_SYMTAB: return "DT_SYMTAB";
+ case DT_RELA: return "DT_RELA";
+ case DT_RELASZ: return "DT_RELASZ";
+ case DT_RELAENT: return "DT_RELAENT";
+ case DT_STRSZ: return "DT_STRSZ";
+ case DT_SYMENT: return "DT_SYMENT";
+ case DT_INIT: return "DT_INIT";
+ case DT_FINI: return "DT_FINI";
+ case DT_SONAME: return "DT_SONAME";
+ case DT_RPATH: return "DT_RPATH";
+ case DT_SYMBOLIC: return "DT_SYMBOLIC";
+ case DT_REL: return "DT_REL";
+ case DT_RELSZ: return "DT_RELSZ";
+ case DT_RELENT: return "DT_RELENT";
+ case DT_PLTREL: return "DT_PLTREL";
+ case DT_DEBUG: return "DT_DEBUG";
+ case DT_TEXTREL: return "DT_TEXTREL";
+ case DT_JMPREL: return "DT_JMPREL";
+ case DT_BIND_NOW: return "DT_BIND_NOW";
+ case DT_INIT_ARRAY: return "DT_INIT_ARRAY";
+ case DT_FINI_ARRAY: return "DT_FINI_ARRAY";
+ case DT_INIT_ARRAYSZ: return "DT_INIT_ARRAYSZ";
+ case DT_FINI_ARRAYSZ: return "DT_FINI_ARRAYSZ";
+ case DT_RUNPATH: return "DT_RUNPATH";
+ case DT_FLAGS: return "DT_FLAGS";
+ case DT_PREINIT_ARRAY: return "DT_PREINIT_ARRAY"; /* XXX DT_ENCODING */
+ case DT_PREINIT_ARRAYSZ:return "DT_PREINIT_ARRAYSZ";
+ /* 0x6000000D - 0x6ffff000 operating system-specific semantics */
+ case 0x6ffffdf5: return "DT_GNU_PRELINKED";
+ case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ";
+ case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ";
+ case 0x6ffffdf8: return "DT_SUNW_CHECKSUM";
+ case DT_PLTPADSZ: return "DT_PLTPADSZ";
+ case DT_MOVEENT: return "DT_MOVEENT";
+ case DT_MOVESZ: return "DT_MOVESZ";
+ case DT_FEATURE: return "DT_FEATURE";
+ case DT_POSFLAG_1: return "DT_POSFLAG_1";
+ case DT_SYMINSZ: return "DT_SYMINSZ";
+ case DT_SYMINENT : return "DT_SYMINENT (DT_VALRNGHI)";
+ case DT_ADDRRNGLO: return "DT_ADDRRNGLO";
+ case DT_GNU_HASH: return "DT_GNU_HASH";
+ case 0x6ffffef8: return "DT_GNU_CONFLICT";
+ case 0x6ffffef9: return "DT_GNU_LIBLIST";
+ case DT_CONFIG: return "DT_CONFIG";
+ case DT_DEPAUDIT: return "DT_DEPAUDIT";
+ case DT_AUDIT: return "DT_AUDIT";
+ case DT_PLTPAD: return "DT_PLTPAD";
+ case DT_MOVETAB: return "DT_MOVETAB";
+ case DT_SYMINFO : return "DT_SYMINFO (DT_ADDRRNGHI)";
+ case DT_RELACOUNT: return "DT_RELACOUNT";
+ case DT_RELCOUNT: return "DT_RELCOUNT";
+ case DT_FLAGS_1: return "DT_FLAGS_1";
+ case DT_VERDEF: return "DT_VERDEF";
+ case DT_VERDEFNUM: return "DT_VERDEFNUM";
+ case DT_VERNEED: return "DT_VERNEED";
+ case DT_VERNEEDNUM: return "DT_VERNEEDNUM";
+ case 0x6ffffff0: return "DT_GNU_VERSYM";
+ /* 0x70000000 - 0x7fffffff processor-specific semantics */
+ case 0x70000000: return "DT_IA_64_PLT_RESERVE";
+ case 0x7ffffffd: return "DT_SUNW_AUXILIARY";
+ case 0x7ffffffe: return "DT_SUNW_USED";
+ case 0x7fffffff: return "DT_SUNW_FILTER";
+ }
+ snprintf(unknown_tag, sizeof(unknown_tag),
+ "ERROR: TAG NOT DEFINED -- tag 0x%jx", (uintmax_t)tag);
+ return (unknown_tag);
+}
+
+static const char *
+e_machines(u_int mach)
+{
+ static char machdesc[64];
+
+ switch (mach) {
+ case EM_NONE: return "EM_NONE";
+ case EM_M32: return "EM_M32";
+ case EM_SPARC: return "EM_SPARC";
+ case EM_386: return "EM_386";
+ case EM_68K: return "EM_68K";
+ case EM_88K: return "EM_88K";
+ case EM_IAMCU: return "EM_IAMCU";
+ case EM_860: return "EM_860";
+ case EM_MIPS: return "EM_MIPS";
+ case EM_PPC: return "EM_PPC";
+ case EM_PPC64: return "EM_PPC64";
+ case EM_ARM: return "EM_ARM";
+ case EM_ALPHA: return "EM_ALPHA (legacy)";
+ case EM_SPARCV9:return "EM_SPARCV9";
+ case EM_IA_64: return "EM_IA_64";
+ case EM_X86_64: return "EM_X86_64";
+ case EM_AARCH64:return "EM_AARCH64";
+ case EM_RISCV: return "EM_RISCV";
+ }
+ snprintf(machdesc, sizeof(machdesc),
+ "(unknown machine) -- type 0x%x", mach);
+ return (machdesc);
+}
+
+static const char *e_types[] = {
+ "ET_NONE", "ET_REL", "ET_EXEC", "ET_DYN", "ET_CORE"
+};
+
+static const char *ei_versions[] = {
+ "EV_NONE", "EV_CURRENT"
+};
+
+static const char *ei_classes[] = {
+ "ELFCLASSNONE", "ELFCLASS32", "ELFCLASS64"
+};
+
+static const char *ei_data[] = {
+ "ELFDATANONE", "ELFDATA2LSB", "ELFDATA2MSB"
+};
+
+static const char *ei_abis[256] = {
+ "ELFOSABI_NONE", "ELFOSABI_HPUX", "ELFOSABI_NETBSD", "ELFOSABI_LINUX",
+ "ELFOSABI_HURD", "ELFOSABI_86OPEN", "ELFOSABI_SOLARIS", "ELFOSABI_AIX",
+ "ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
+ "ELFOSABI_MODESTO", "ELFOSABI_OPENBSD",
+ [255] = "ELFOSABI_STANDALONE"
+};
+
+static const char *p_types[] = {
+ "PT_NULL", "PT_LOAD", "PT_DYNAMIC", "PT_INTERP", "PT_NOTE",
+ "PT_SHLIB", "PT_PHDR", "PT_TLS"
+};
+
+static const char *p_flags[] = {
+ "", "PF_X", "PF_W", "PF_X|PF_W", "PF_R", "PF_X|PF_R", "PF_W|PF_R",
+ "PF_X|PF_W|PF_R"
+};
+
+/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */
+static const char *
+sh_types(uint64_t machine, uint64_t sht) {
+ static char unknown_buf[64];
+
+ if (sht < 0x60000000) {
+ switch (sht) {
+ case SHT_NULL: return "SHT_NULL";
+ case SHT_PROGBITS: return "SHT_PROGBITS";
+ case SHT_SYMTAB: return "SHT_SYMTAB";
+ case SHT_STRTAB: return "SHT_STRTAB";
+ case SHT_RELA: return "SHT_RELA";
+ case SHT_HASH: return "SHT_HASH";
+ case SHT_DYNAMIC: return "SHT_DYNAMIC";
+ case SHT_NOTE: return "SHT_NOTE";
+ case SHT_NOBITS: return "SHT_NOBITS";
+ case SHT_REL: return "SHT_REL";
+ case SHT_SHLIB: return "SHT_SHLIB";
+ case SHT_DYNSYM: return "SHT_DYNSYM";
+ case SHT_INIT_ARRAY: return "SHT_INIT_ARRAY";
+ case SHT_FINI_ARRAY: return "SHT_FINI_ARRAY";
+ case SHT_PREINIT_ARRAY: return "SHT_PREINIT_ARRAY";
+ case SHT_GROUP: return "SHT_GROUP";
+ case SHT_SYMTAB_SHNDX: 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 SHT_SUNW_dof: return "SHT_SUNW_dof";
+ case SHT_GNU_HASH: return "SHT_GNU_HASH";
+ case 0x6ffffff7: return "SHT_GNU_LIBLIST";
+ case 0x6ffffffc: return "XXX:VERDEF";
+ case SHT_SUNW_verdef: return "SHT_SUNW(GNU)_verdef";
+ case SHT_SUNW_verneed: return "SHT_SUNW(GNU)_verneed";
+ case SHT_SUNW_versym: 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 SHT_ARM_EXIDX: return "SHT_ARM_EXIDX";
+ case SHT_ARM_PREEMPTMAP:return "SHT_ARM_PREEMPTMAP";
+ case SHT_ARM_ATTRIBUTES:return "SHT_ARM_ATTRIBUTES";
+ case SHT_ARM_DEBUGOVERLAY:
+ return "SHT_ARM_DEBUGOVERLAY";
+ case SHT_ARM_OVERLAYSECTION:
+ return "SHT_ARM_OVERLAYSECTION";
+ }
+ break;
+ case EM_IA_64:
+ switch (sht) {
+ case 0x70000000: return "SHT_IA_64_EXT";
+ case 0x70000001: return "SHT_IA_64_UNWIND";
+ }
+ break;
+ case EM_MIPS:
+ switch (sht) {
+ case SHT_MIPS_REGINFO: return "SHT_MIPS_REGINFO";
+ case SHT_MIPS_OPTIONS: return "SHT_MIPS_OPTIONS";
+ case SHT_MIPS_ABIFLAGS: return "SHT_MIPS_ABIFLAGS";
+ }
+ 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);
+ }
+}
+
+static const char *sh_flags[] = {
+ "", "SHF_WRITE", "SHF_ALLOC", "SHF_WRITE|SHF_ALLOC", "SHF_EXECINSTR",
+ "SHF_WRITE|SHF_EXECINSTR", "SHF_ALLOC|SHF_EXECINSTR",
+ "SHF_WRITE|SHF_ALLOC|SHF_EXECINSTR"
+};
+
+static const char *
+st_type(unsigned int mach, unsigned int type)
+{
+ static char s_type[32];
+
+ switch (type) {
+ case STT_NOTYPE: return "STT_NOTYPE";
+ case STT_OBJECT: return "STT_OBJECT";
+ case STT_FUNC: return "STT_FUNC";
+ case STT_SECTION: return "STT_SECTION";
+ case STT_FILE: return "STT_FILE";
+ case STT_COMMON: return "STT_COMMON";
+ case STT_TLS: return "STT_TLS";
+ case 13:
+ if (mach == EM_SPARCV9)
+ return "STT_SPARC_REGISTER";
+ break;
+ }
+ snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
+ return (s_type);
+}
+
+static const char *st_bindings[] = {
+ "STB_LOCAL", "STB_GLOBAL", "STB_WEAK"
+};
+
+static char *dynstr;
+static char *shstrtab;
+static char *strtab;
+static FILE *out;
+
+static u_int64_t elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quarter(Elf32_Ehdr *e, void *base,
+ elf_member_t member);
+#if 0
+static u_int64_t elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member);
+#endif
+static u_int64_t elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member);
+
+static void elf_print_ehdr(Elf32_Ehdr *e, void *sh);
+static void elf_print_phdr(Elf32_Ehdr *e, void *p);
+static void elf_print_shdr(Elf32_Ehdr *e, void *sh);
+static void elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str);
+static void elf_print_dynamic(Elf32_Ehdr *e, void *sh);
+static void elf_print_rel(Elf32_Ehdr *e, void *r);
+static void elf_print_rela(Elf32_Ehdr *e, void *ra);
+static void elf_print_interp(Elf32_Ehdr *e, void *p);
+static void elf_print_got(Elf32_Ehdr *e, void *sh);
+static void elf_print_hash(Elf32_Ehdr *e, void *sh);
+static void elf_print_note(Elf32_Ehdr *e, void *sh);
+
+static void usage(void);
+
+/*
+ * Helpers for ELF files with shnum or shstrndx values that don't fit in the
+ * ELF header. If the values are too large then an escape value is used to
+ * indicate that the actual value is found in one of section 0's fields.
+ */
+static uint64_t
+elf_get_shnum(Elf32_Ehdr *e, void *sh)
+{
+ uint64_t shnum;
+
+ shnum = elf_get_quarter(e, e, E_SHNUM);
+ if (shnum == 0)
+ shnum = elf_get_word(e, (char *)sh, SH_SIZE);
+ return shnum;
+}
+
+static uint64_t
+elf_get_shstrndx(Elf32_Ehdr *e, void *sh)
+{
+ uint64_t shstrndx;
+
+ shstrndx = elf_get_quarter(e, e, E_SHSTRNDX);
+ if (shstrndx == SHN_XINDEX)
+ shstrndx = elf_get_word(e, (char *)sh, SH_LINK);
+ return shstrndx;
+}
+
+int
+main(int ac, char **av)
+{
+ cap_rights_t rights;
+ u_int64_t phoff;
+ u_int64_t shoff;
+ u_int64_t phentsize;
+ u_int64_t phnum;
+ u_int64_t shentsize;
+ u_int64_t shnum;
+ u_int64_t shstrndx;
+ u_int64_t offset;
+ u_int64_t name;
+ u_int64_t type;
+ struct stat sb;
+ u_int flags;
+ Elf32_Ehdr *e;
+ void *p;
+ void *sh;
+ void *v;
+ int fd;
+ int ch;
+ int i;
+
+ out = stdout;
+ flags = 0;
+ while ((ch = getopt(ac, av, "acdeiGhnprsw:")) != -1)
+ switch (ch) {
+ case 'a':
+ flags = ED_ALL;
+ break;
+ case 'c':
+ flags |= ED_SHDR;
+ break;
+ case 'd':
+ flags |= ED_DYN;
+ break;
+ case 'e':
+ flags |= ED_EHDR;
+ break;
+ case 'i':
+ flags |= ED_INTERP;
+ break;
+ case 'G':
+ flags |= ED_GOT;
+ break;
+ case 'h':
+ flags |= ED_HASH;
+ break;
+ case 'n':
+ flags |= ED_NOTE;
+ break;
+ case 'p':
+ flags |= ED_PHDR;
+ break;
+ case 'r':
+ flags |= ED_REL;
+ break;
+ case 's':
+ flags |= ED_SYMTAB;
+ break;
+ case 'w':
+ if ((out = fopen(optarg, "w")) == NULL)
+ err(1, "%s", optarg);
+ cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE);
+ if (cap_rights_limit(fileno(out), &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for %s", optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+ if (ac == 0 || flags == 0)
+ usage();
+ if ((fd = open(*av, O_RDONLY)) < 0 ||
+ fstat(fd, &sb) < 0)
+ err(1, "%s", *av);
+ cap_rights_init(&rights, CAP_MMAP_R);
+ if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for %s", *av);
+ close(STDIN_FILENO);
+ cap_rights_init(&rights, CAP_WRITE);
+ if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for stdout");
+ if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for stderr");
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+ e = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ if (e == MAP_FAILED)
+ err(1, NULL);
+ if (!IS_ELF(*(Elf32_Ehdr *)e))
+ errx(1, "not an elf file");
+ phoff = elf_get_off(e, e, E_PHOFF);
+ shoff = elf_get_off(e, e, E_SHOFF);
+ phentsize = elf_get_quarter(e, e, E_PHENTSIZE);
+ phnum = elf_get_quarter(e, e, E_PHNUM);
+ shentsize = elf_get_quarter(e, e, E_SHENTSIZE);
+ p = (char *)e + phoff;
+ 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);
+ if (strcmp(shstrtab + name, ".strtab") == 0)
+ strtab = (char *)e + offset;
+ if (strcmp(shstrtab + name, ".dynstr") == 0)
+ dynstr = (char *)e + offset;
+ }
+ if (flags & ED_EHDR)
+ elf_print_ehdr(e, sh);
+ if (flags & ED_PHDR)
+ elf_print_phdr(e, p);
+ if (flags & ED_SHDR)
+ elf_print_shdr(e, sh);
+ for (i = 0; (u_int64_t)i < phnum; i++) {
+ v = (char *)p + i * phentsize;
+ type = elf_get_word(e, v, P_TYPE);
+ switch (type) {
+ case PT_INTERP:
+ if (flags & ED_INTERP)
+ elf_print_interp(e, v);
+ break;
+ case PT_NULL:
+ case PT_LOAD:
+ case PT_DYNAMIC:
+ case PT_NOTE:
+ case PT_SHLIB:
+ case PT_PHDR:
+ break;
+ }
+ }
+ for (i = 0; (u_int64_t)i < shnum; i++) {
+ v = (char *)sh + i * shentsize;
+ type = elf_get_word(e, v, SH_TYPE);
+ switch (type) {
+ case SHT_SYMTAB:
+ if (flags & ED_SYMTAB)
+ elf_print_symtab(e, v, strtab);
+ break;
+ case SHT_DYNAMIC:
+ if (flags & ED_DYN)
+ elf_print_dynamic(e, v);
+ break;
+ case SHT_RELA:
+ if (flags & ED_REL)
+ elf_print_rela(e, v);
+ break;
+ case SHT_REL:
+ if (flags & ED_REL)
+ elf_print_rel(e, v);
+ break;
+ case SHT_NOTE:
+ name = elf_get_word(e, v, SH_NAME);
+ if (flags & ED_NOTE &&
+ strcmp(shstrtab + name, ".note.ABI-tag") == 0)
+ elf_print_note(e, v);
+ break;
+ case SHT_DYNSYM:
+ if (flags & ED_SYMTAB)
+ elf_print_symtab(e, v, dynstr);
+ break;
+ case SHT_PROGBITS:
+ name = elf_get_word(e, v, SH_NAME);
+ if (flags & ED_GOT &&
+ strcmp(shstrtab + name, ".got") == 0)
+ elf_print_got(e, v);
+ break;
+ case SHT_HASH:
+ if (flags & ED_HASH)
+ elf_print_hash(e, v);
+ break;
+ case SHT_NULL:
+ case SHT_STRTAB:
+ case SHT_NOBITS:
+ case SHT_SHLIB:
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static void
+elf_print_ehdr(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t class;
+ u_int64_t data;
+ u_int64_t osabi;
+ u_int64_t type;
+ u_int64_t machine;
+ u_int64_t version;
+ u_int64_t entry;
+ u_int64_t phoff;
+ u_int64_t shoff;
+ u_int64_t flags;
+ u_int64_t ehsize;
+ u_int64_t phentsize;
+ u_int64_t phnum;
+ u_int64_t shentsize;
+ u_int64_t shnum;
+ u_int64_t shstrndx;
+
+ class = elf_get_byte(e, e, E_CLASS);
+ data = elf_get_byte(e, e, E_DATA);
+ osabi = elf_get_byte(e, e, E_OSABI);
+ type = elf_get_quarter(e, e, E_TYPE);
+ machine = elf_get_quarter(e, e, E_MACHINE);
+ version = elf_get_word(e, e, E_VERSION);
+ entry = elf_get_addr(e, e, E_ENTRY);
+ phoff = elf_get_off(e, e, E_PHOFF);
+ shoff = elf_get_off(e, e, E_SHOFF);
+ flags = elf_get_word(e, e, E_FLAGS);
+ ehsize = elf_get_quarter(e, e, E_EHSIZE);
+ phentsize = elf_get_quarter(e, e, E_PHENTSIZE);
+ phnum = elf_get_quarter(e, e, E_PHNUM);
+ shentsize = elf_get_quarter(e, e, E_SHENTSIZE);
+ fprintf(out, "\nelf header:\n");
+ fprintf(out, "\n");
+ fprintf(out, "\te_ident: %s %s %s\n", ei_classes[class], ei_data[data],
+ ei_abis[osabi]);
+ fprintf(out, "\te_type: %s\n", e_types[type]);
+ fprintf(out, "\te_machine: %s\n", e_machines(machine));
+ fprintf(out, "\te_version: %s\n", ei_versions[version]);
+ fprintf(out, "\te_entry: %#jx\n", (intmax_t)entry);
+ fprintf(out, "\te_phoff: %jd\n", (intmax_t)phoff);
+ fprintf(out, "\te_shoff: %jd\n", (intmax_t)shoff);
+ fprintf(out, "\te_flags: %jd\n", (intmax_t)flags);
+ fprintf(out, "\te_ehsize: %jd\n", (intmax_t)ehsize);
+ 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);
+ 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
+elf_print_phdr(Elf32_Ehdr *e, void *p)
+{
+ u_int64_t phentsize;
+ u_int64_t phnum;
+ u_int64_t type;
+ u_int64_t offset;
+ u_int64_t vaddr;
+ u_int64_t paddr;
+ u_int64_t filesz;
+ u_int64_t memsz;
+ u_int64_t flags;
+ u_int64_t align;
+ void *v;
+ int i;
+
+ phentsize = elf_get_quarter(e, e, E_PHENTSIZE);
+ phnum = elf_get_quarter(e, e, E_PHNUM);
+ fprintf(out, "\nprogram header:\n");
+ for (i = 0; (u_int64_t)i < phnum; i++) {
+ v = (char *)p + i * phentsize;
+ type = elf_get_word(e, v, P_TYPE);
+ offset = elf_get_off(e, v, P_OFFSET);
+ vaddr = elf_get_addr(e, v, P_VADDR);
+ paddr = elf_get_addr(e, v, P_PADDR);
+ filesz = elf_get_size(e, v, P_FILESZ);
+ memsz = elf_get_size(e, v, P_MEMSZ);
+ flags = elf_get_word(e, v, P_FLAGS);
+ align = elf_get_size(e, v, P_ALIGN);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\tp_type: %s\n", p_types[type & 0x7]);
+ fprintf(out, "\tp_offset: %jd\n", (intmax_t)offset);
+ fprintf(out, "\tp_vaddr: %#jx\n", (intmax_t)vaddr);
+ fprintf(out, "\tp_paddr: %#jx\n", (intmax_t)paddr);
+ fprintf(out, "\tp_filesz: %jd\n", (intmax_t)filesz);
+ fprintf(out, "\tp_memsz: %jd\n", (intmax_t)memsz);
+ fprintf(out, "\tp_flags: %s\n", p_flags[flags]);
+ fprintf(out, "\tp_align: %jd\n", (intmax_t)align);
+ }
+}
+
+static void
+elf_print_shdr(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t shentsize;
+ u_int64_t shnum;
+ u_int64_t name;
+ u_int64_t type;
+ u_int64_t flags;
+ u_int64_t addr;
+ u_int64_t offset;
+ u_int64_t size;
+ u_int64_t shlink;
+ 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");
+ for (i = 0; (u_int64_t)i < shnum; i++) {
+ v = (char *)sh + i * shentsize;
+ name = elf_get_word(e, v, SH_NAME);
+ type = elf_get_word(e, v, SH_TYPE);
+ flags = elf_get_word(e, v, SH_FLAGS);
+ addr = elf_get_addr(e, v, SH_ADDR);
+ offset = elf_get_off(e, v, SH_OFFSET);
+ size = elf_get_size(e, v, SH_SIZE);
+ shlink = elf_get_word(e, v, SH_LINK);
+ info = elf_get_word(e, v, SH_INFO);
+ addralign = elf_get_size(e, v, SH_ADDRALIGN);
+ entsize = elf_get_size(e, v, SH_ENTSIZE);
+ 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(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);
+ fprintf(out, "\tsh_size: %jd\n", (intmax_t)size);
+ fprintf(out, "\tsh_link: %jd\n", (intmax_t)shlink);
+ fprintf(out, "\tsh_info: %jd\n", (intmax_t)info);
+ fprintf(out, "\tsh_addralign: %jd\n", (intmax_t)addralign);
+ fprintf(out, "\tsh_entsize: %jd\n", (intmax_t)entsize);
+ }
+}
+
+static void
+elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str)
+{
+ u_int64_t machine;
+ u_int64_t offset;
+ u_int64_t entsize;
+ u_int64_t size;
+ u_int64_t name;
+ u_int64_t value;
+ u_int64_t info;
+ u_int64_t shndx;
+ void *st;
+ int len;
+ int i;
+
+ machine = elf_get_quarter(e, e, E_MACHINE);
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ entsize = elf_get_size(e, sh, SH_ENTSIZE);
+ size = elf_get_size(e, sh, SH_SIZE);
+ name = elf_get_word(e, sh, SH_NAME);
+ len = size / entsize;
+ fprintf(out, "\nsymbol table (%s):\n", shstrtab + name);
+ for (i = 0; i < len; i++) {
+ st = (char *)e + offset + i * entsize;
+ name = elf_get_word(e, st, ST_NAME);
+ value = elf_get_addr(e, st, ST_VALUE);
+ size = elf_get_size(e, st, ST_SIZE);
+ info = elf_get_byte(e, st, ST_INFO);
+ shndx = elf_get_quarter(e, st, ST_SHNDX);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\tst_name: %s\n", str + name);
+ fprintf(out, "\tst_value: %#jx\n", value);
+ fprintf(out, "\tst_size: %jd\n", (intmax_t)size);
+ fprintf(out, "\tst_info: %s %s\n",
+ st_type(machine, ELF32_ST_TYPE(info)),
+ st_bindings[ELF32_ST_BIND(info)]);
+ fprintf(out, "\tst_shndx: %jd\n", (intmax_t)shndx);
+ }
+}
+
+static void
+elf_print_dynamic(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t offset;
+ u_int64_t entsize;
+ u_int64_t size;
+ int64_t tag;
+ u_int64_t ptr;
+ u_int64_t val;
+ void *d;
+ int i;
+
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ entsize = elf_get_size(e, sh, SH_ENTSIZE);
+ size = elf_get_size(e, sh, SH_SIZE);
+ fprintf(out, "\ndynamic:\n");
+ for (i = 0; (u_int64_t)i < size / entsize; i++) {
+ d = (char *)e + offset + i * entsize;
+ tag = elf_get_size(e, d, D_TAG);
+ ptr = elf_get_size(e, d, D_PTR);
+ val = elf_get_addr(e, d, D_VAL);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\td_tag: %s\n", d_tags(tag));
+ switch (tag) {
+ case DT_NEEDED:
+ case DT_SONAME:
+ case DT_RPATH:
+ fprintf(out, "\td_val: %s\n", dynstr + val);
+ break;
+ case DT_PLTRELSZ:
+ case DT_RELA:
+ case DT_RELASZ:
+ case DT_RELAENT:
+ case DT_STRSZ:
+ case DT_SYMENT:
+ case DT_RELSZ:
+ case DT_RELENT:
+ case DT_PLTREL:
+ fprintf(out, "\td_val: %jd\n", (intmax_t)val);
+ break;
+ case DT_PLTGOT:
+ case DT_HASH:
+ case DT_STRTAB:
+ case DT_SYMTAB:
+ case DT_INIT:
+ case DT_FINI:
+ case DT_REL:
+ case DT_JMPREL:
+ fprintf(out, "\td_ptr: %#jx\n", ptr);
+ break;
+ case DT_NULL:
+ case DT_SYMBOLIC:
+ case DT_DEBUG:
+ case DT_TEXTREL:
+ break;
+ }
+ }
+}
+
+static void
+elf_print_rela(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t offset;
+ u_int64_t entsize;
+ u_int64_t size;
+ u_int64_t name;
+ u_int64_t info;
+ int64_t addend;
+ void *ra;
+ void *v;
+ int i;
+
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ entsize = elf_get_size(e, sh, SH_ENTSIZE);
+ size = elf_get_size(e, sh, SH_SIZE);
+ name = elf_get_word(e, sh, SH_NAME);
+ v = (char *)e + offset;
+ fprintf(out, "\nrelocation with addend (%s):\n", shstrtab + name);
+ for (i = 0; (u_int64_t)i < size / entsize; i++) {
+ ra = (char *)v + i * entsize;
+ offset = elf_get_addr(e, ra, RA_OFFSET);
+ info = elf_get_word(e, ra, RA_INFO);
+ addend = elf_get_off(e, ra, RA_ADDEND);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\tr_offset: %#jx\n", offset);
+ fprintf(out, "\tr_info: %jd\n", (intmax_t)info);
+ fprintf(out, "\tr_addend: %jd\n", (intmax_t)addend);
+ }
+}
+
+static void
+elf_print_rel(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t offset;
+ u_int64_t entsize;
+ u_int64_t size;
+ u_int64_t name;
+ u_int64_t info;
+ void *r;
+ void *v;
+ int i;
+
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ entsize = elf_get_size(e, sh, SH_ENTSIZE);
+ size = elf_get_size(e, sh, SH_SIZE);
+ name = elf_get_word(e, sh, SH_NAME);
+ v = (char *)e + offset;
+ fprintf(out, "\nrelocation (%s):\n", shstrtab + name);
+ for (i = 0; (u_int64_t)i < size / entsize; i++) {
+ r = (char *)v + i * entsize;
+ offset = elf_get_addr(e, r, R_OFFSET);
+ info = elf_get_word(e, r, R_INFO);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\tr_offset: %#jx\n", offset);
+ fprintf(out, "\tr_info: %jd\n", (intmax_t)info);
+ }
+}
+
+static void
+elf_print_interp(Elf32_Ehdr *e, void *p)
+{
+ u_int64_t offset;
+ char *s;
+
+ offset = elf_get_off(e, p, P_OFFSET);
+ s = (char *)e + offset;
+ fprintf(out, "\ninterp:\n");
+ fprintf(out, "\t%s\n", s);
+}
+
+static void
+elf_print_got(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t offset;
+ u_int64_t addralign;
+ u_int64_t size;
+ u_int64_t addr;
+ void *v;
+ int i;
+
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ addralign = elf_get_size(e, sh, SH_ADDRALIGN);
+ size = elf_get_size(e, sh, SH_SIZE);
+ v = (char *)e + offset;
+ fprintf(out, "\nglobal offset table:\n");
+ for (i = 0; (u_int64_t)i < size / addralign; i++) {
+ addr = elf_get_addr(e, (char *)v + i * addralign, 0);
+ fprintf(out, "\n");
+ fprintf(out, "entry: %d\n", i);
+ fprintf(out, "\t%#jx\n", addr);
+ }
+}
+
+static void
+elf_print_hash(Elf32_Ehdr *e __unused, void *sh __unused)
+{
+}
+
+static void
+elf_print_note(Elf32_Ehdr *e, void *sh)
+{
+ u_int64_t offset;
+ u_int64_t size;
+ u_int64_t name;
+ u_int32_t namesz;
+ u_int32_t descsz;
+ u_int32_t desc;
+ char *n, *s;
+
+ offset = elf_get_off(e, sh, SH_OFFSET);
+ size = elf_get_size(e, sh, SH_SIZE);
+ name = elf_get_word(e, sh, SH_NAME);
+ n = (char *)e + offset;
+ fprintf(out, "\nnote (%s):\n", shstrtab + name);
+ while (n < ((char *)e + offset + size)) {
+ namesz = elf_get_word(e, n, N_NAMESZ);
+ descsz = elf_get_word(e, n, N_DESCSZ);
+ s = n + sizeof(Elf_Note);
+ desc = elf_get_word(e, n + sizeof(Elf_Note) + namesz, 0);
+ fprintf(out, "\t%s %d\n", s, desc);
+ n += sizeof(Elf_Note) + namesz + descsz;
+ }
+}
+
+static u_int64_t
+elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member)
+{
+ u_int64_t val;
+
+ val = 0;
+ switch (e->e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ val = ((uint8_t *)base)[elf32_offsets[member]];
+ break;
+ case ELFCLASS64:
+ val = ((uint8_t *)base)[elf64_offsets[member]];
+ break;
+ case ELFCLASSNONE:
+ errx(1, "invalid class");
+ }
+
+ return val;
+}
+
+static u_int64_t
+elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member)
+{
+ u_int64_t val;
+
+ val = 0;
+ switch (e->e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ base = (char *)base + elf32_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be16dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le16dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASS64:
+ base = (char *)base + elf64_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be16dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le16dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASSNONE:
+ errx(1, "invalid class");
+ }
+
+ return val;
+}
+
+#if 0
+static u_int64_t
+elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member)
+{
+ u_int64_t val;
+
+ val = 0;
+ switch (e->e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ base = (char *)base + elf32_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be16dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le16dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASS64:
+ base = (char *)base + elf64_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be32dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le32dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASSNONE:
+ errx(1, "invalid class");
+ }
+
+ return val;
+}
+#endif
+
+static u_int64_t
+elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member)
+{
+ u_int64_t val;
+
+ val = 0;
+ switch (e->e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ base = (char *)base + elf32_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be32dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le32dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASS64:
+ base = (char *)base + elf64_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be32dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le32dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASSNONE:
+ errx(1, "invalid class");
+ }
+
+ return val;
+}
+
+static u_int64_t
+elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member)
+{
+ u_int64_t val;
+
+ val = 0;
+ switch (e->e_ident[EI_CLASS]) {
+ case ELFCLASS32:
+ base = (char *)base + elf32_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be32dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le32dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASS64:
+ base = (char *)base + elf64_offsets[member];
+ switch (e->e_ident[EI_DATA]) {
+ case ELFDATA2MSB:
+ val = be64dec(base);
+ break;
+ case ELFDATA2LSB:
+ val = le64dec(base);
+ break;
+ case ELFDATANONE:
+ errx(1, "invalid data format");
+ }
+ break;
+ case ELFCLASSNONE:
+ errx(1, "invalid class");
+ }
+
+ return val;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: elfdump -a | -cdeGhinprs [-w file] file\n");
+ exit(1);
+}
diff --git a/usr.bin/enigma/Makefile b/usr.bin/enigma/Makefile
new file mode 100644
index 0000000..55fcc46
--- /dev/null
+++ b/usr.bin/enigma/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+PROG= enigma
+
+LINKS= ${BINDIR}/enigma ${BINDIR}/crypt
+MLINKS= enigma.1 crypt.1
+
+LIBADD= crypt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/enigma/Makefile.depend b/usr.bin/enigma/Makefile.depend
new file mode 100644
index 0000000..4d4fe05
--- /dev/null
+++ b/usr.bin/enigma/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/enigma/enigma.1 b/usr.bin/enigma/enigma.1
new file mode 100644
index 0000000..e5f65ac
--- /dev/null
+++ b/usr.bin/enigma/enigma.1
@@ -0,0 +1,132 @@
+.\"
+.\" enigma (aka. crypt) man page written by Joerg Wunsch.
+.\"
+.\" Since enigma itself is distributed in the Public Domain, this file
+.\" is also.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd May 14, 2004
+.Dt ENIGMA 1
+.Os
+.Sh NAME
+.Nm enigma ,
+.Nm crypt
+.Nd very simple file encryption
+.Sh SYNOPSIS
+.Nm
+.Op Fl s
+.Op Fl k
+.Op Ar password
+.Nm crypt
+.Op Fl s
+.Op Fl k
+.Op Ar password
+.Sh DESCRIPTION
+The
+.Nm
+utility, also known as
+.Nm crypt
+is a
+.Em very
+simple encryption program, working on a
+.Dq secret-key
+basis.
+It operates as a filter, i.e.,
+it encrypts or decrypts a
+stream of data from standard input, and writes the result to standard
+output.
+Since its operation is fully symmetrical, feeding the encrypted data
+stream again through the engine (using the same secret key) will
+decrypt it.
+.Pp
+There are several ways to provide the secret key to the program.
+By
+default, the program prompts the user on the controlling terminal for
+the key, using
+.Xr getpass 3 .
+This is the only safe way of providing it.
+.Pp
+Alternatively, the key can be provided as the sole command-line
+argument
+.Ar password
+when starting the program.
+Obviously, this way the key can easily be
+spotted by other users running
+.Xr ps 1 .
+As yet another alternative,
+.Nm
+can be given the option
+.Fl k ,
+and it will take the key from the environment variable
+.Ev CrYpTkEy .
+While this at a first glance seems to be more secure than the previous
+option, it actually is not since environment variables can also be
+examined with
+.Xr ps 1 .
+Thus this option is mainly provided for compatibility with other
+implementations of
+.Nm .
+.Pp
+When specifying the option
+.Fl s ,
+.Nm
+modifies the encryption engine in a way that is supposed to make it a
+little more secure, but incompatible with other implementations.
+.Pp
+.Ss Warning
+The cryptographic value of
+.Nm
+is rather small.
+This program is only provided here for compatibility
+with other operating systems that also provide an implementation
+(usually called
+.Xr crypt 1
+there).
+For real encryption, refer to
+.Xr bdes 1 ,
+.Xr openssl 1 ,
+.Xr pgp 1 Pq Pa ports/security/pgp ,
+or
+.Xr gpg 1 Pq Pa ports/security/gnupg .
+However, restrictions for exporting,
+importing or using such tools might exist in some countries, so those
+stronger programs are not being shipped as part of the operating
+system by default.
+.Sh ENVIRONMENT
+.Bl -tag -offset indent -width ".Ev CrYpTkEy"
+.It Ev CrYpTkEy
+used to obtain the secret key when option
+.Fl k
+has been given
+.El
+.Sh EXAMPLES
+.Bd -literal -offset indent
+man enigma | enigma > encrypted
+Enter key: (XXX \(em key not echoed)
+.Ed
+.Pp
+This will create an encrypted form of this man page, and store it in
+the file
+.Pa encrypted .
+.Bd -literal -offset indent
+enigma XXX < encrypted
+.Ed
+.Pp
+This displays the previously created file on the terminal.
+.Sh SEE ALSO
+.Xr bdes 1 ,
+.Xr gpg 1 ,
+.Xr openssl 1 ,
+.Xr pgp 1 ,
+.Xr ps 1 ,
+.Xr getpass 3
+.Sh HISTORY
+Implementations of
+.Nm crypt
+are very common among
+.Ux
+operating systems.
+This implementation has been taken from the
+.Em Cryptbreakers Workbench
+which is in the public domain.
diff --git a/usr.bin/enigma/enigma.c b/usr.bin/enigma/enigma.c
new file mode 100644
index 0000000..e476e65
--- /dev/null
+++ b/usr.bin/enigma/enigma.c
@@ -0,0 +1,158 @@
+/*-
+ * "enigma.c" is in file cbw.tar from
+ * anonymous FTP host watmsg.waterloo.edu: pub/crypt/cbw.tar.Z
+ *
+ * A one-rotor machine designed along the lines of Enigma
+ * but considerably trivialized.
+ *
+ * A public-domain replacement for the UNIX "crypt" command.
+ *
+ * Upgraded to function properly on 64-bit machines.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MINUSKVAR "CrYpTkEy"
+
+#define ECHO 010
+#define ROTORSZ 256
+#define MASK 0377
+static char t1[ROTORSZ];
+static char t2[ROTORSZ];
+static char t3[ROTORSZ];
+static char deck[ROTORSZ];
+static char buf[13];
+
+static void shuffle(char *);
+static void setup(char *);
+
+static void
+setup(char *pw)
+{
+ int ic, i, k, temp;
+ char salt[3];
+ unsigned rnd;
+ int32_t seed;
+ char *cryptpw;
+
+ if (crypt_set_format("des") == 0) {
+ fprintf(stderr, "crypt_set_format(\"des\") failed.\n");
+ exit(1);
+ }
+
+ strlcpy(salt, pw, sizeof(salt));
+ cryptpw = crypt(pw, salt);
+ if (cryptpw == NULL) {
+ fprintf(stderr, "crypt(3) failure\n");
+ exit(1);
+ }
+ memcpy(buf, cryptpw, sizeof(buf));
+ seed = 123;
+ for (i=0; i<13; i++)
+ seed = seed*buf[i] + i;
+ for(i=0;i<ROTORSZ;i++) {
+ t1[i] = i;
+ deck[i] = i;
+ }
+ for(i=0;i<ROTORSZ;i++) {
+ seed = 5*seed + buf[i%13];
+ rnd = seed % 65521;
+ k = ROTORSZ-1 - i;
+ ic = (rnd&MASK)%(k+1);
+ rnd >>= 8;
+ temp = t1[k];
+ t1[k] = t1[ic];
+ t1[ic] = temp;
+ if(t3[k]!=0) continue;
+ ic = (rnd&MASK) % k;
+ while(t3[ic]!=0) ic = (ic+1) % k;
+ t3[k] = ic;
+ t3[ic] = k;
+ }
+ for(i=0;i<ROTORSZ;i++)
+ t2[t1[i]&MASK] = i;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int i, n1, n2, nr1, nr2;
+ int secureflg = 0, kflag = 0;
+ char *cp;
+
+ if (argc > 1 && argv[1][0] == '-') {
+ if (argv[1][1] == 's') {
+ argc--;
+ argv++;
+ secureflg = 1;
+ } else if (argv[1][1] == 'k') {
+ argc--;
+ argv++;
+ kflag = 1;
+ }
+ }
+ if (kflag) {
+ if ((cp = getenv(MINUSKVAR)) == NULL) {
+ fprintf(stderr, "%s not set\n", MINUSKVAR);
+ exit(1);
+ }
+ setup(cp);
+ } else if (argc != 2) {
+ setup(getpass("Enter key:"));
+ }
+ else
+ setup(argv[1]);
+ n1 = 0;
+ n2 = 0;
+ nr2 = 0;
+
+ while((i=getchar()) != -1) {
+ if (secureflg) {
+ nr1 = deck[n1]&MASK;
+ nr2 = deck[nr1]&MASK;
+ } else {
+ nr1 = n1;
+ }
+ i = t2[(t3[(t1[(i+nr1)&MASK]+nr2)&MASK]-nr2)&MASK]-nr1;
+ putchar(i);
+ n1++;
+ if(n1==ROTORSZ) {
+ n1 = 0;
+ n2++;
+ if(n2==ROTORSZ) n2 = 0;
+ if (secureflg) {
+ shuffle(deck);
+ } else {
+ nr2 = n2;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static void
+shuffle(char deckary[])
+{
+ int i, ic, k, temp;
+ unsigned rnd;
+ static int32_t seed = 123;
+
+ for(i=0;i<ROTORSZ;i++) {
+ seed = 5*seed + buf[i%13];
+ rnd = seed % 65521;
+ k = ROTORSZ-1 - i;
+ ic = (rnd&MASK)%(k+1);
+ temp = deckary[k];
+ deckary[k] = deckary[ic];
+ deckary[ic] = temp;
+ }
+}
diff --git a/usr.bin/env/Makefile b/usr.bin/env/Makefile
new file mode 100644
index 0000000..89ab594
--- /dev/null
+++ b/usr.bin/env/Makefile
@@ -0,0 +1,7 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= env
+SRCS= env.c envopts.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/env/Makefile.depend b/usr.bin/env/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/env/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/env/env.1 b/usr.bin/env/env.1
new file mode 100644
index 0000000..101f4eb
--- /dev/null
+++ b/usr.bin/env/env.1
@@ -0,0 +1,482 @@
+.\" Copyright (c) 1980, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\" 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.
+.\"
+.\" From @(#)printenv.1 8.1 (Berkeley) 6/6/93
+.\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp
+.\" $FreeBSD$
+.\"
+.Dd April 17, 2008
+.Dt ENV 1
+.Os
+.Sh NAME
+.Nm env
+.Nd set environment and execute command, or print environment
+.Sh SYNOPSIS
+.Nm
+.Op Fl iv
+.Op Fl P Ar altpath
+.Op Fl S Ar string
+.Op Fl u Ar name
+.Op Ar name Ns = Ns Ar value ...
+.Op Ar utility Op Ar argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility executes another
+.Ar utility
+after modifying the environment as
+specified on the command line.
+Each
+.Ar name Ns = Ns Ar value
+option specifies the setting of an environment variable,
+.Ar name ,
+with a value of
+.Ar value .
+All such environment variables are set before the
+.Ar utility
+is executed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl i
+Execute the
+.Ar utility
+with only those environment variables specified by
+.Ar name Ns = Ns Ar value
+options.
+The environment inherited
+by
+.Nm
+is ignored completely.
+.\" -P
+.It Fl P Ar altpath
+Search the set of directories as specified by
+.Ar altpath
+to locate the specified
+.Ar utility
+program, instead of using the value of the
+.Ev PATH
+environment variable.
+.\" -S
+.It Fl S Ar string
+Split apart the given
+.Ar string
+into multiple strings, and process each of the resulting strings
+as separate arguments to the
+.Nm
+utility.
+The
+.Fl S
+option recognizes some special character escape sequences and
+also supports environment-variable substitution, as described
+below.
+.\" -u
+.It Fl u Ar name
+If the environment variable
+.Ar name
+is in the environment, then remove it before processing the
+remaining options.
+This is similar to the
+.Ic unset
+command in
+.Xr sh 1 .
+The value for
+.Ar name
+must not include the
+.Ql =
+character.
+.\" -v
+.It Fl v
+Print verbose information for each step of processing done by the
+.Nm
+utility.
+Additional information will be printed if
+.Fl v
+is specified multiple times.
+.El
+.Pp
+The above options are only recognized when they are specified
+before any
+.Ar name Ns = Ns Ar value
+options.
+.Pp
+If no
+.Ar utility
+is specified,
+.Nm
+prints out the names and values
+of the variables in the environment, with one name/value pair per line.
+.\"
+.Ss Details of Fl S Ss (split-string) processing
+The processing of the
+.Fl S
+option will split the given
+.Ar string
+into separate arguments based on any space or <tab> characters found in the
+.Ar string .
+Each of those new arguments will then be treated as if it had been
+specified as a separate argument on the original
+.Nm
+command.
+.Pp
+Spaces and tabs may be embedded in one of those new arguments by using
+single
+.Pq Dq Li '
+or double
+.Pq Ql \&"
+quotes, or backslashes
+.Pq Ql \e .
+Single quotes will escape all non-single quote characters, up to
+the matching single quote.
+Double quotes will escape all non-double quote characters, up to
+the matching double quote.
+It is an error if the end of the
+.Ar string
+is reached before the matching quote character.
+.Pp
+If
+.Fl S
+would create a new argument that starts with the
+.Ql #
+character, then that argument and the remainder of the
+.Ar string
+will be ignored.
+The
+.Ql \e#
+sequence can be used when you want a new argument to start
+with a
+.Ql #
+character, without causing the remainder of the
+.Ar string
+to be skipped.
+.Pp
+While processing the
+.Ar string
+value,
+.Fl S
+processing will treat certain character combinations as escape
+sequences which represent some action to take.
+The character escape sequences are in backslash notation.
+The characters and their meanings are as follows:
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Cm \ec
+Ignore the remaining characters in the
+.Ar string .
+This must not appear inside a double-quoted string.
+.It Cm \ef
+Replace with a <form-feed> character.
+.It Cm \en
+Replace with a <new-line> character.
+.It Cm \er
+Replace with a <carriage return> character.
+.It Cm \et
+Replace with a <tab> character.
+.It Cm \ev
+Replace with a <vertical tab> character.
+.It Cm \e#
+Replace with a
+.Ql #
+character.
+This would be useful when you need a
+.Ql #
+as the first character in one of the arguments created
+by splitting apart the given
+.Ar string .
+.It Cm \e$
+Replace with a
+.Ql $
+character.
+.It Cm \e_
+If this is found inside of a double-quoted string, then replace it
+with a single blank.
+If this is found outside of a quoted string, then treat this as the
+separator character between new arguments in the original
+.Ar string .
+.It Cm \e"
+Replace with a <double quote> character.
+.It Cm \e\'
+Replace with a <single quote> character.
+.It Cm \e\e
+Replace with a backslash character.
+.El
+.Pp
+The sequences for <single-quote> and backslash are the only sequences
+which are recognized inside of a single-quoted string.
+The other sequences have no special meaning inside a single-quoted
+string.
+All escape sequences are recognized inside of a double-quoted string.
+It is an error if a single
+.Ql \e
+character is followed by a character other than the ones listed above.
+.Pp
+The processing of
+.Fl S
+also supports substitution of values from environment variables.
+To do this, the name of the environment variable must be inside of
+.Ql ${} ,
+such as:
+.Li ${SOMEVAR} .
+The common shell syntax of
+.Li $SOMEVAR
+is not supported.
+All values substituted will be the values of the environment variables
+as they were when the
+.Nm
+utility was originally invoked.
+Those values will not be checked for any of the escape sequences as
+described above.
+And any settings of
+.Ar name Ns = Ns Ar value
+will not effect the values used for substitution in
+.Fl S
+processing.
+.Pp
+Also,
+.Fl S
+processing can not reference the value of the special parameters
+which are defined by most shells.
+For instance,
+.Fl S
+can not recognize special parameters such as:
+.Ql $* ,
+.Ql $@ ,
+.Ql $# ,
+.Ql $?
+or
+.Ql $$
+if they appear inside the given
+.Ar string .
+.\"
+.Ss Use in shell-scripts
+The
+.Nm
+utility is often used as the
+.Ar interpreter
+on the first line of interpreted scripts, as
+described in
+.Xr execve 2 .
+.Pp
+Note that the way the kernel parses the
+.Ql #!
+(first line) of an interpreted script has changed as of
+.Fx 6.0 .
+Prior to that, the
+.Fx
+kernel would split that first line into separate arguments based
+on any whitespace (space or <tab> characters) found in the line.
+So, if a script named
+.Pa /usr/local/bin/someport
+had a first line of:
+.Pp
+.Dl "#!/usr/local/bin/php -n -q -dsafe_mode=0"
+.Pp
+then the
+.Pa /usr/local/bin/php
+program would have been started with the arguments of:
+.Bd -literal -offset indent
+arg[0] = '/usr/local/bin/php'
+arg[1] = '-n'
+arg[2] = '-q'
+arg[3] = '-dsafe_mode=0'
+arg[4] = '/usr/local/bin/someport'
+.Ed
+.Pp
+plus any arguments the user specified when executing
+.Pa someport .
+However, this processing of multiple options on the
+.Ql #!
+line is not the way any other operating system parses the
+first line of an interpreted script.
+So after a change which was made for
+.Fx 6.0
+release, that script will result in
+.Pa /usr/local/bin/php
+being started with the arguments of:
+.Bd -literal -offset indent
+arg[0] = '/usr/local/bin/php'
+arg[1] = '-n -q -dsafe_mode=0'
+arg[2] = '/usr/local/bin/someport'
+.Ed
+.Pp
+plus any arguments the user specified.
+This caused a significant change in the behavior of a few scripts.
+In the case of above script, to have it behave the same way under
+.Fx 6.0
+as it did under earlier releases, the first line should be
+changed to:
+.Pp
+.Dl "#!/usr/bin/env -S /usr/local/bin/php -n -q -dsafe_mode=0"
+.Pp
+The
+.Nm
+utility will be started with the entire line as a single
+argument:
+.Pp
+.Dl "arg[1] = '-S /usr/local/bin/php -n -q -dsafe_mode=0'"
+.Pp
+and then
+.Fl S
+processing will split that line into separate arguments before
+executing
+.Pa /usr/local/bin/php .
+.\"
+.Sh ENVIRONMENT
+The
+.Nm
+utility uses the
+.Ev PATH
+environment variable to locate the requested
+.Ar utility
+if the name contains no
+.Ql /
+characters, unless the
+.Fl P
+option has been specified.
+.Sh EXIT STATUS
+.Ex -std
+An exit status of 126 indicates that
+.Ar utility
+was found, but could not be executed.
+An exit status of 127 indicates that
+.Ar utility
+could not be found.
+.Sh EXAMPLES
+Since the
+.Nm
+utility is often used as part of the first line of an interpreted script,
+the following examples show a number of ways that the
+.Nm
+utility can be useful in scripts.
+.Pp
+The kernel processing of an interpreted script does not allow a script
+to directly reference some other script as its own interpreter.
+As a way around this, the main difference between
+.Pp
+.Dl #!/usr/local/bin/foo
+and
+.Dl "#!/usr/bin/env /usr/local/bin/foo"
+.Pp
+is that the latter works even if
+.Pa /usr/local/bin/foo
+is itself an interpreted script.
+.Pp
+Probably the most common use of
+.Nm
+is to find the correct interpreter for a script, when the interpreter
+may be in different directories on different systems.
+The following example will find the
+.Ql perl
+interpreter by searching through the directories specified by
+.Ev PATH .
+.Pp
+.Dl "#!/usr/bin/env perl"
+.Pp
+One limitation of that example is that it assumes the user's value
+for
+.Ev PATH
+is set to a value which will find the interpreter you want
+to execute.
+The
+.Fl P
+option can be used to make sure a specific list of directories is
+used in the search for
+.Ar utility .
+Note that the
+.Fl S
+option is also required for this example to work correctly.
+.Pp
+.Dl "#!/usr/bin/env -S -P/usr/local/bin:/usr/bin perl"
+.Pp
+The above finds
+.Ql perl
+only if it is in
+.Pa /usr/local/bin
+or
+.Pa /usr/bin .
+That could be combined with the present value of
+.Ev PATH ,
+to provide more flexibility.
+Note that spaces are not required between the
+.Fl S
+and
+.Fl P
+options:
+.Pp
+.Dl "#!/usr/bin/env -S-P/usr/local/bin:/usr/bin:${PATH} perl"
+.Sh COMPATIBILITY
+The
+.Nm
+utility accepts the
+.Fl
+option as a synonym for
+.Fl i .
+.Sh SEE ALSO
+.Xr printenv 1 ,
+.Xr sh 1 ,
+.Xr execvp 3 ,
+.Xr environ 7
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+The
+.Fl P , S , u
+and
+.Fl v
+options are non-standard extensions supported by
+.Fx ,
+but which may not be available on other operating systems.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
+The
+.Fl P , S
+and
+.Fl v
+options were added in
+.Fx 6.0 .
+.Sh BUGS
+The
+.Nm
+utility does not handle values of
+.Ar utility
+which have an equals sign
+.Pq Ql =
+in their name, for obvious reasons.
+.Pp
+The
+.Nm
+utility does not take multibyte characters into account when
+processing the
+.Fl S
+option, which may lead to incorrect results in some locales.
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
new file mode 100644
index 0000000..3dc152a
--- /dev/null
+++ b/usr.bin/env/env.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 1988, 1993, 1994
+ * 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) 1988, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "envopts.h"
+
+extern char **environ;
+
+int env_verbosity;
+
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ char *altpath, **ep, *p, **parg;
+ char *cleanenv[1];
+ int ch, want_clear;
+ int rtrn;
+
+ altpath = NULL;
+ want_clear = 0;
+ while ((ch = getopt(argc, argv, "-iP:S:u:v")) != -1)
+ switch(ch) {
+ case '-':
+ case 'i':
+ want_clear = 1;
+ break;
+ case 'P':
+ altpath = strdup(optarg);
+ break;
+ case 'S':
+ /*
+ * The -S option, for "split string on spaces, with
+ * support for some simple substitutions"...
+ */
+ split_spaces(optarg, &optind, &argc, &argv);
+ break;
+ case 'u':
+ if (env_verbosity)
+ fprintf(stderr, "#env unset:\t%s\n", optarg);
+ rtrn = unsetenv(optarg);
+ if (rtrn == -1)
+ err(EXIT_FAILURE, "unsetenv %s", optarg);
+ break;
+ case 'v':
+ env_verbosity++;
+ if (env_verbosity > 1)
+ fprintf(stderr, "#env verbosity now at %d\n",
+ env_verbosity);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ if (want_clear) {
+ environ = cleanenv;
+ cleanenv[0] = NULL;
+ if (env_verbosity)
+ fprintf(stderr, "#env clearing environ\n");
+ }
+ for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv) {
+ if (env_verbosity)
+ fprintf(stderr, "#env setenv:\t%s\n", *argv);
+ *p = '\0';
+ rtrn = setenv(*argv, p + 1, 1);
+ *p = '=';
+ if (rtrn == -1)
+ err(EXIT_FAILURE, "setenv %s", *argv);
+ }
+ if (*argv) {
+ if (altpath)
+ search_paths(altpath, argv);
+ if (env_verbosity) {
+ fprintf(stderr, "#env executing:\t%s\n", *argv);
+ for (parg = argv, argc = 0; *parg; parg++, argc++)
+ fprintf(stderr, "#env arg[%d]=\t'%s'\n",
+ argc, *parg);
+ if (env_verbosity > 1)
+ sleep(1);
+ }
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+ }
+ for (ep = environ; *ep; ep++)
+ (void)printf("%s\n", *ep);
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: env [-iv] [-P utilpath] [-S string] [-u name]\n"
+ " [name=value ...] [utility [argument ...]]\n");
+ exit(1);
+}
diff --git a/usr.bin/env/envopts.c b/usr.bin/env/envopts.c
new file mode 100644
index 0000000..5740062
--- /dev/null
+++ b/usr.bin/env/envopts.c
@@ -0,0 +1,468 @@
+/*-
+ * Copyright (c) 2005 - Garance Alistair Drosehn <gad@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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * official policies, either expressed or implied, of the FreeBSD Project.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <err.h>
+#include <errno.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "envopts.h"
+
+static const char *
+ expand_vars(int in_thisarg, char **thisarg_p, char **dest_p,
+ const char **src_p);
+static int is_there(char *candidate);
+
+/*
+ * The is*() routines take a parameter of 'int', but expect values in the range
+ * of unsigned char. Define some wrappers which take a value of type 'char',
+ * whether signed or unsigned, and ensure the value ends up in the right range.
+ */
+#define isalnumch(Anychar) isalnum((u_char)(Anychar))
+#define isalphach(Anychar) isalpha((u_char)(Anychar))
+#define isspacech(Anychar) isspace((u_char)(Anychar))
+
+/*
+ * Routine to determine if a given fully-qualified filename is executable.
+ * This is copied almost verbatim from FreeBSD's usr.bin/which/which.c.
+ */
+static int
+is_there(char *candidate)
+{
+ struct stat fin;
+
+ /* XXX work around access(2) false positives for superuser */
+ if (access(candidate, X_OK) == 0 &&
+ stat(candidate, &fin) == 0 &&
+ S_ISREG(fin.st_mode) &&
+ (getuid() != 0 ||
+ (fin.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0)) {
+ if (env_verbosity > 1)
+ fprintf(stderr, "#env matched:\t'%s'\n", candidate);
+ return (1);
+ }
+ return (0);
+}
+
+/**
+ * Routine to search through an alternate path-list, looking for a given
+ * filename to execute. If the file is found, replace the original
+ * unqualified name with a fully-qualified path. This allows `env' to
+ * execute programs from a specific strict list of possible paths, without
+ * changing the value of PATH seen by the program which will be executed.
+ * E.G.:
+ * #!/usr/bin/env -S-P/usr/local/bin:/usr/bin perl
+ * will execute /usr/local/bin/perl or /usr/bin/perl (whichever is found
+ * first), no matter what the current value of PATH is, and without
+ * changing the value of PATH that the script will see when it runs.
+ *
+ * This is similar to the print_matches() routine in usr.bin/which/which.c.
+ */
+void
+search_paths(char *path, char **argv)
+{
+ char candidate[PATH_MAX];
+ const char *d;
+ char *filename, *fqname;
+
+ /* If the file has a `/' in it, then no search is done */
+ filename = *argv;
+ if (strchr(filename, '/') != NULL)
+ return;
+
+ if (env_verbosity > 1) {
+ fprintf(stderr, "#env Searching:\t'%s'\n", path);
+ fprintf(stderr, "#env for file:\t'%s'\n", filename);
+ }
+
+ fqname = NULL;
+ while ((d = strsep(&path, ":")) != NULL) {
+ if (*d == '\0')
+ d = ".";
+ if (snprintf(candidate, sizeof(candidate), "%s/%s", d,
+ filename) >= (int)sizeof(candidate))
+ continue;
+ if (is_there(candidate)) {
+ fqname = candidate;
+ break;
+ }
+ }
+
+ if (fqname == NULL) {
+ errno = ENOENT;
+ err(127, "%s", filename);
+ }
+ *argv = strdup(candidate);
+}
+
+/**
+ * Routine to split a string into multiple parameters, while recognizing a
+ * few special characters. It recognizes both single and double-quoted
+ * strings. This processing is designed entirely for the benefit of the
+ * parsing of "#!"-lines (aka "shebang" lines == the first line of an
+ * executable script). Different operating systems parse that line in very
+ * different ways, and this split-on-spaces processing is meant to provide
+ * ways to specify arbitrary arguments on that line, no matter how the OS
+ * parses it.
+ *
+ * Within a single-quoted string, the two characters "\'" are treated as
+ * a literal "'" character to add to the string, and "\\" are treated as
+ * a literal "\" character to add. Other than that, all characters are
+ * copied until the processing gets to a terminating "'".
+ *
+ * Within a double-quoted string, many more "\"-style escape sequences
+ * are recognized, mostly copied from what is recognized in the `printf'
+ * command. Some OS's will not allow a literal blank character to be
+ * included in the one argument that they recognize on a shebang-line,
+ * so a few additional escape-sequences are defined to provide ways to
+ * specify blanks.
+ *
+ * Within a double-quoted string "\_" is turned into a literal blank.
+ * (Inside of a single-quoted string, the two characters are just copied)
+ * Outside of a quoted string, "\_" is treated as both a blank, and the
+ * end of the current argument. So with a shelbang-line of:
+ * #!/usr/bin/env -SA=avalue\_perl
+ * the -S value would be broken up into arguments "A=avalue" and "perl".
+ */
+void
+split_spaces(const char *str, int *origind, int *origc, char ***origv)
+{
+ static const char *nullarg = "";
+ const char *bq_src, *copystr, *src;
+ char *dest, **newargv, *newstr, **nextarg, **oldarg;
+ int addcount, bq_destlen, copychar, found_sep, in_arg, in_dq, in_sq;
+
+ /*
+ * Ignore leading space on the string, and then malloc enough room
+ * to build a copy of it. The copy might end up shorter than the
+ * original, due to quoted strings and '\'-processing.
+ */
+ while (isspacech(*str))
+ str++;
+ if (*str == '\0')
+ return;
+ newstr = malloc(strlen(str) + 1);
+
+ /*
+ * Allocate plenty of space for the new array of arg-pointers,
+ * and start that array off with the first element of the old
+ * array.
+ */
+ newargv = malloc((*origc + (strlen(str) / 2) + 2) * sizeof(char *));
+ nextarg = newargv;
+ *nextarg++ = **origv;
+
+ /* Come up with the new args by splitting up the given string. */
+ addcount = 0;
+ bq_destlen = in_arg = in_dq = in_sq = 0;
+ bq_src = NULL;
+ for (src = str, dest = newstr; *src != '\0'; src++) {
+ /*
+ * This switch will look at a character in *src, and decide
+ * what should be copied to *dest. It only decides what
+ * character(s) to copy, it should not modify *dest. In some
+ * cases, it will look at multiple characters from *src.
+ */
+ copychar = found_sep = 0;
+ copystr = NULL;
+ switch (*src) {
+ case '"':
+ if (in_sq)
+ copychar = *src;
+ else if (in_dq)
+ in_dq = 0;
+ else {
+ /*
+ * Referencing nullarg ensures that a new
+ * argument is created, even if this quoted
+ * string ends up with zero characters.
+ */
+ copystr = nullarg;
+ in_dq = 1;
+ bq_destlen = dest - *(nextarg - 1);
+ bq_src = src;
+ }
+ break;
+ case '$':
+ if (in_sq)
+ copychar = *src;
+ else {
+ copystr = expand_vars(in_arg, (nextarg - 1),
+ &dest, &src);
+ }
+ break;
+ case '\'':
+ if (in_dq)
+ copychar = *src;
+ else if (in_sq)
+ in_sq = 0;
+ else {
+ /*
+ * Referencing nullarg ensures that a new
+ * argument is created, even if this quoted
+ * string ends up with zero characters.
+ */
+ copystr = nullarg;
+ in_sq = 1;
+ bq_destlen = dest - *(nextarg - 1);
+ bq_src = src;
+ }
+ break;
+ case '\\':
+ if (in_sq) {
+ /*
+ * Inside single-quoted strings, only the
+ * "\'" and "\\" are recognized as special
+ * strings.
+ */
+ copychar = *(src + 1);
+ if (copychar == '\'' || copychar == '\\')
+ src++;
+ else
+ copychar = *src;
+ break;
+ }
+ src++;
+ switch (*src) {
+ case '"':
+ case '#':
+ case '$':
+ case '\'':
+ case '\\':
+ copychar = *src;
+ break;
+ case '_':
+ /*
+ * Alternate way to get a blank, which allows
+ * that blank be used to separate arguments
+ * when it is not inside a quoted string.
+ */
+ if (in_dq)
+ copychar = ' ';
+ else {
+ found_sep = 1;
+ src++;
+ }
+ break;
+ case 'c':
+ /*
+ * Ignore remaining characters in the -S string.
+ * This would not make sense if found in the
+ * middle of a quoted string.
+ */
+ if (in_dq)
+ errx(1, "Sequence '\\%c' is not allowed"
+ " in quoted strings", *src);
+ goto str_done;
+ case 'f':
+ copychar = '\f';
+ break;
+ case 'n':
+ copychar = '\n';
+ break;
+ case 'r':
+ copychar = '\r';
+ break;
+ case 't':
+ copychar = '\t';
+ break;
+ case 'v':
+ copychar = '\v';
+ break;
+ default:
+ if (isspacech(*src))
+ copychar = *src;
+ else
+ errx(1, "Invalid sequence '\\%c' in -S",
+ *src);
+ }
+ break;
+ default:
+ if ((in_dq || in_sq) && in_arg)
+ copychar = *src;
+ else if (isspacech(*src))
+ found_sep = 1;
+ else {
+ /*
+ * If the first character of a new argument
+ * is `#', then ignore the remaining chars.
+ */
+ if (!in_arg && *src == '#')
+ goto str_done;
+ copychar = *src;
+ }
+ }
+ /*
+ * Now that the switch has determined what (if anything)
+ * needs to be copied, copy whatever that is to *dest.
+ */
+ if (copychar || copystr != NULL) {
+ if (!in_arg) {
+ /* This is the first byte of a new argument */
+ *nextarg++ = dest;
+ addcount++;
+ in_arg = 1;
+ }
+ if (copychar)
+ *dest++ = (char)copychar;
+ else if (copystr != NULL)
+ while (*copystr != '\0')
+ *dest++ = *copystr++;
+ } else if (found_sep) {
+ *dest++ = '\0';
+ while (isspacech(*src))
+ src++;
+ --src;
+ in_arg = 0;
+ }
+ }
+str_done:
+ *dest = '\0';
+ *nextarg = NULL;
+ if (in_dq || in_sq) {
+ errx(1, "No terminating quote for string: %.*s%s",
+ bq_destlen, *(nextarg - 1), bq_src);
+ }
+ if (env_verbosity > 1) {
+ fprintf(stderr, "#env split -S:\t'%s'\n", str);
+ oldarg = newargv + 1;
+ fprintf(stderr, "#env into:\t'%s'\n", *oldarg);
+ for (oldarg++; *oldarg; oldarg++)
+ fprintf(stderr, "#env &\t'%s'\n", *oldarg);
+ }
+
+ /* Copy the unprocessed arg-pointers from the original array */
+ for (oldarg = *origv + *origind; *oldarg; oldarg++)
+ *nextarg++ = *oldarg;
+ *nextarg = NULL;
+
+ /* Update optind/argc/argv in the calling routine */
+ *origc += addcount - *origind + 1;
+ *origv = newargv;
+ *origind = 1;
+}
+
+/**
+ * Routine to split expand any environment variables referenced in the string
+ * that -S is processing. For now it only supports the form ${VARNAME}. It
+ * explicitly does not support $VARNAME, and obviously can not handle special
+ * shell-variables such as $?, $*, $1, etc. It is called with *src_p pointing
+ * at the initial '$', and if successful it will update *src_p, *dest_p, and
+ * possibly *thisarg_p in the calling routine.
+ */
+static const char *
+expand_vars(int in_thisarg, char **thisarg_p, char **dest_p, const char **src_p)
+{
+ const char *vbegin, *vend, *vvalue;
+ char *newstr, *vname;
+ int bad_reference;
+ size_t namelen, newlen;
+
+ bad_reference = 1;
+ vbegin = vend = (*src_p) + 1;
+ if (*vbegin++ == '{')
+ if (*vbegin == '_' || isalphach(*vbegin)) {
+ vend = vbegin + 1;
+ while (*vend == '_' || isalnumch(*vend))
+ vend++;
+ if (*vend == '}')
+ bad_reference = 0;
+ }
+ if (bad_reference)
+ errx(1, "Only ${VARNAME} expansion is supported, error at: %s",
+ *src_p);
+
+ /*
+ * We now know we have a valid environment variable name, so update
+ * the caller's source-pointer to the last character in that reference,
+ * and then pick up the matching value. If the variable is not found,
+ * or if it has a null value, then our work here is done.
+ */
+ *src_p = vend;
+ namelen = vend - vbegin + 1;
+ vname = malloc(namelen);
+ strlcpy(vname, vbegin, namelen);
+ vvalue = getenv(vname);
+ if (vvalue == NULL || *vvalue == '\0') {
+ if (env_verbosity > 2)
+ fprintf(stderr,
+ "#env replacing ${%s} with null string\n",
+ vname);
+ free(vname);
+ return (NULL);
+ }
+
+ if (env_verbosity > 2)
+ fprintf(stderr, "#env expanding ${%s} into '%s'\n", vname,
+ vvalue);
+
+ /*
+ * There is some value to copy to the destination. If the value is
+ * shorter than the ${VARNAME} reference that it replaces, then our
+ * caller can just copy the value to the existing destination.
+ */
+ if (strlen(vname) + 3 >= strlen(vvalue)) {
+ free(vname);
+ return (vvalue);
+ }
+
+ /*
+ * The value is longer than the string it replaces, which means the
+ * present destination area is too small to hold it. Create a new
+ * destination area, and update the caller's 'dest' variable to match.
+ * If the caller has already started copying some info for 'thisarg'
+ * into the present destination, then the new destination area must
+ * include a copy of that data, and the pointer to 'thisarg' must also
+ * be updated. Note that it is still the caller which copies this
+ * vvalue to the new *dest.
+ */
+ newlen = strlen(vvalue) + strlen(*src_p) + 1;
+ if (in_thisarg) {
+ **dest_p = '\0'; /* Provide terminator for 'thisarg' */
+ newlen += strlen(*thisarg_p);
+ newstr = malloc(newlen);
+ strcpy(newstr, *thisarg_p);
+ *thisarg_p = newstr;
+ } else {
+ newstr = malloc(newlen);
+ *newstr = '\0';
+ }
+ *dest_p = strchr(newstr, '\0');
+ free(vname);
+ return (vvalue);
+}
diff --git a/usr.bin/env/envopts.h b/usr.bin/env/envopts.h
new file mode 100644
index 0000000..1f15c69
--- /dev/null
+++ b/usr.bin/env/envopts.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2005 - Garance Alistair Drosehn <gad@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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * official policies, either expressed or implied, of the FreeBSD Project.
+ *
+ * $FreeBSD$
+ */
+
+void search_paths(char *path, char **argv);
+void split_spaces(const char *str, int *origind, int *origc,
+ char ***origv);
+
+extern int env_verbosity;
diff --git a/usr.bin/expand/Makefile b/usr.bin/expand/Makefile
new file mode 100644
index 0000000..c6b339c
--- /dev/null
+++ b/usr.bin/expand/Makefile
@@ -0,0 +1,7 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= expand
+MLINKS= expand.1 unexpand.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/expand/Makefile.depend b/usr.bin/expand/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/expand/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/expand/expand.1 b/usr.bin/expand/expand.1
new file mode 100644
index 0000000..2a5cb91
--- /dev/null
+++ b/usr.bin/expand/expand.1
@@ -0,0 +1,114 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)expand.1 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt EXPAND 1
+.Os
+.Sh NAME
+.Nm expand ,
+.Nm unexpand
+.Nd expand tabs to spaces, and vice versa
+.Sh SYNOPSIS
+.Nm
+.Oo
+.Fl t
+.Sm off
+.Ar tab1 , tab2 , ... , tabn
+.Sm on
+.Oc
+.Op Ar
+.Nm unexpand
+.Oo
+.Fl a | t
+.Sm off
+.Ar tab1 , tab2 , ... , tabn
+.Sm on
+.Oc
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility processes the named files or the standard input writing
+the standard output with tabs changed into blanks.
+Backspace characters are preserved into the output and decrement
+the column count for tab calculations.
+The
+.Nm
+utility is useful for pre-processing character files
+(before sorting, looking at specific columns, etc.) that
+contain tabs.
+.Pp
+The
+.Nm unexpand
+utility puts tabs back into the data from the standard input or the named
+files and writes the result on the standard output.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+.Nm ( unexpand
+only.)
+By default, only leading blanks and tabs
+are reconverted to maximal strings of tabs.
+If the
+.Fl a
+option is given, then tabs are inserted whenever they would compress the
+resultant file by replacing two or more characters.
+.It Fl t Sm Ar tab1 , tab2 , ... , tabn Sm
+Set tab stops at column positions
+.Ar tab1 , tab2 , ... , tabn .
+If only a single number is given, tab stops are set that number of
+column positions apart instead of the default number of 8.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+and
+.Nm unexpand
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std expand unexpand
+.Sh STANDARDS
+The
+.Nm
+and
+.Nm unexpand
+utilities conform to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 1 .
diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c
new file mode 100644
index 0000000..1d89089
--- /dev/null
+++ b/usr.bin/expand/expand.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+/*
+ * expand - expand tabs to equivalent spaces
+ */
+static int nstops;
+static int tabstops[100];
+
+static void getstops(char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ const char *curfile;
+ wint_t wc;
+ int c, column;
+ int n;
+ int rval;
+ int width;
+
+ setlocale(LC_CTYPE, "");
+
+ /* handle obsolete syntax */
+ while (argc > 1 && argv[1][0] == '-' &&
+ isdigit((unsigned char)argv[1][1])) {
+ getstops(&argv[1][1]);
+ argc--; argv++;
+ }
+
+ while ((c = getopt (argc, argv, "t:")) != -1) {
+ switch (c) {
+ case 't':
+ getstops(optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ rval = 0;
+ do {
+ if (argc > 0) {
+ if (freopen(argv[0], "r", stdin) == NULL) {
+ warn("%s", argv[0]);
+ rval = 1;
+ argc--, argv++;
+ continue;
+ }
+ curfile = argv[0];
+ argc--, argv++;
+ } else
+ curfile = "stdin";
+ column = 0;
+ while ((wc = getwchar()) != WEOF) {
+ switch (wc) {
+ case '\t':
+ if (nstops == 0) {
+ do {
+ putwchar(' ');
+ column++;
+ } while (column & 07);
+ continue;
+ }
+ if (nstops == 1) {
+ do {
+ putwchar(' ');
+ column++;
+ } while (((column - 1) % tabstops[0]) != (tabstops[0] - 1));
+ continue;
+ }
+ for (n = 0; n < nstops; n++)
+ if (tabstops[n] > column)
+ break;
+ if (n == nstops) {
+ putwchar(' ');
+ column++;
+ continue;
+ }
+ while (column < tabstops[n]) {
+ putwchar(' ');
+ column++;
+ }
+ continue;
+
+ case '\b':
+ if (column)
+ column--;
+ putwchar('\b');
+ continue;
+
+ default:
+ putwchar(wc);
+ if ((width = wcwidth(wc)) > 0)
+ column += width;
+ continue;
+
+ case '\n':
+ putwchar(wc);
+ column = 0;
+ continue;
+ }
+ }
+ if (ferror(stdin)) {
+ warn("%s", curfile);
+ rval = 1;
+ }
+ } while (argc > 0);
+ exit(rval);
+}
+
+static void
+getstops(char *cp)
+{
+ int i;
+
+ nstops = 0;
+ for (;;) {
+ i = 0;
+ while (*cp >= '0' && *cp <= '9')
+ i = i * 10 + *cp++ - '0';
+ if (i <= 0)
+ errx(1, "bad tab stop spec");
+ if (nstops > 0 && i <= tabstops[nstops-1])
+ errx(1, "bad tab stop spec");
+ if (nstops == sizeof(tabstops) / sizeof(*tabstops))
+ errx(1, "too many tab stops");
+ tabstops[nstops++] = i;
+ if (*cp == 0)
+ break;
+ if (*cp != ',' && !isblank((unsigned char)*cp))
+ errx(1, "bad tab stop spec");
+ cp++;
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf (stderr, "usage: expand [-t tablist] [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/factor/Makefile b/usr.bin/factor/Makefile
new file mode 100644
index 0000000..58da816
--- /dev/null
+++ b/usr.bin/factor/Makefile
@@ -0,0 +1,19 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= factor
+SRCS= factor.c pr_tbl.c
+CFLAGS+=-I${.CURDIR}/../primes
+
+.if ${MK_OPENSSL} != "no"
+CFLAGS+=-DHAVE_OPENSSL
+LIBADD+=crypto
+.endif
+
+MAN= factor.6
+MLINKS+=factor.6 primes.6
+.PATH: ${.CURDIR}/../primes
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/factor/Makefile.depend b/usr.bin/factor/Makefile.depend
new file mode 100644
index 0000000..fc0b633
--- /dev/null
+++ b/usr.bin/factor/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/factor/factor.6 b/usr.bin/factor/factor.6
new file mode 100644
index 0000000..ba82f14
--- /dev/null
+++ b/usr.bin/factor/factor.6
@@ -0,0 +1,127 @@
+.\" Copyright (c) 1989, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Landon Curt Noll.
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)factor.6 8.1 (Berkeley) 5/31/93
+.\"
+.\" $FreeBSD$
+.\"
+.\" By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+.\"
+.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+.\"
+.Dd October 10, 2002
+.Dt FACTOR 6
+.Os
+.Sh NAME
+.Nm factor , primes
+.Nd factor a number, generate primes
+.Sh SYNOPSIS
+.Nm
+.Op Fl h
+.Op Ar number ...
+.Nm primes
+.Op Fl h
+.Op Ar start Op Ar stop
+.Sh DESCRIPTION
+The
+.Nm
+utility will factor positive integers.
+When a number is factored, it is printed, followed by a
+.Ql \&: ,
+and the list of factors on a single line.
+Factors are listed in ascending order, and are preceded by a space.
+If a factor divides a value more than once, it will be printed more than once.
+.Pp
+When
+.Nm
+is invoked with one or more arguments, each argument will be factored.
+.Pp
+When
+.Nm
+is invoked with no arguments,
+.Nm
+reads numbers, one per line, from standard input, until end of file or error.
+Leading white-space and empty lines are ignored.
+Numbers may be preceded by a single
+.Ql + .
+Numbers are terminated by a non-digit character (such as a newline).
+After a number is read, it is factored.
+.Pp
+The
+.Nm primes
+utility prints primes in ascending order, one per line, starting at or above
+.Ar start
+and continuing until, but not including
+.Ar stop .
+The
+.Ar start
+value must be at least 0 and not greater than
+.Ar stop .
+The
+.Ar stop
+value must not be greater than the maximum.
+The default and maximum value of
+.Ar stop
+is 3825123056546413050.
+.Pp
+When the
+.Nm primes
+utility is invoked with no arguments,
+.Ar start
+is read from standard input and
+.Ar stop
+is taken to be the maximum.
+The
+.Ar start
+value may be preceded by a single
+.Ql + .
+The
+.Ar start
+value is terminated by a non-digit character (such as a newline).
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "negative numbers aren't permitted"
+.It "illegal numeric format"
+.It "start value must be less than stop value"
+.It "Result too large"
+.El
+.Sh BUGS
+.Nm
+cannot handle the
+.Dq "10 most wanted"
+factor list,
+.Nm primes
+will not get you a world record.
+.Pp
+.Nm primes
+is unable to list primes between 3825123056546413050 and 18446744073709551615
+since it relies on strong pseudoprime tests after sieving, and nobody has
+proven how many strong pseudoprime tests are required to prove primality for
+integers larger than 3825123056546413050.
diff --git a/usr.bin/factor/factor.c b/usr.bin/factor/factor.c
new file mode 100644
index 0000000..19fe830
--- /dev/null
+++ b/usr.bin/factor/factor.c
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Landon Curt Noll.
+ *
+ * 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. 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
+#include <sys/cdefs.h>
+#ifdef __COPYRIGHT
+__COPYRIGHT("@(#) Copyright (c) 1989, 1993\
+ The Regents of the University of California. All rights reserved.");
+#endif
+#ifdef __SCCSID
+__SCCSID("@(#)factor.c 8.4 (Berkeley) 5/4/95");
+#endif
+#ifdef __RCSID
+__RCSID("$NetBSD: factor.c,v 1.19 2009/08/12 05:54:31 dholland Exp $");
+#endif
+#ifdef __FBSDID
+__FBSDID("$FreeBSD$");
+#endif
+#endif /* not lint */
+
+/*
+ * factor - factor a number into primes
+ *
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ *
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ *
+ * usage:
+ * factor [-h] [number] ...
+ *
+ * The form of the output is:
+ *
+ * number: factor1 factor1 factor2 factor3 factor3 factor3 ...
+ *
+ * where factor1 <= factor2 <= factor3 <= ...
+ *
+ * If no args are given, the list of numbers are read from stdin.
+ */
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "primes.h"
+
+#ifdef HAVE_OPENSSL
+
+#include <openssl/bn.h>
+
+#define PRIME_CHECKS 5
+
+static void pollard_pminus1(BIGNUM *); /* print factors for big numbers */
+
+#else
+
+typedef ubig BIGNUM;
+typedef u_long BN_ULONG;
+
+#define BN_CTX int
+#define BN_CTX_new() NULL
+#define BN_new() ((BIGNUM *)calloc(sizeof(BIGNUM), 1))
+#define BN_is_zero(v) (*(v) == 0)
+#define BN_is_one(v) (*(v) == 1)
+#define BN_mod_word(a, b) (*(a) % (b))
+
+static int BN_dec2bn(BIGNUM **a, const char *str);
+static int BN_hex2bn(BIGNUM **a, const char *str);
+static BN_ULONG BN_div_word(BIGNUM *, BN_ULONG);
+static void BN_print_fp(FILE *, const BIGNUM *);
+
+#endif
+
+static void BN_print_dec_fp(FILE *, const BIGNUM *);
+
+static void pr_fact(BIGNUM *); /* print factors of a value */
+static void pr_print(BIGNUM *); /* print a prime */
+static void usage(void);
+
+static BN_CTX *ctx; /* just use a global context */
+static int hflag;
+
+int
+main(int argc, char *argv[])
+{
+ BIGNUM *val;
+ int ch;
+ char *p, buf[LINE_MAX]; /* > max number of digits. */
+
+ ctx = BN_CTX_new();
+ val = BN_new();
+ if (val == NULL)
+ errx(1, "can't initialise bignum");
+
+ while ((ch = getopt(argc, argv, "h")) != -1)
+ switch (ch) {
+ case 'h':
+ hflag++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* No args supplied, read numbers from stdin. */
+ if (argc == 0)
+ for (;;) {
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (ferror(stdin))
+ err(1, "stdin");
+ exit (0);
+ }
+ for (p = buf; isblank(*p); ++p);
+ if (*p == '\n' || *p == '\0')
+ continue;
+ if (*p == '-')
+ errx(1, "negative numbers aren't permitted.");
+ if (BN_dec2bn(&val, buf) == 0 &&
+ BN_hex2bn(&val, buf) == 0)
+ errx(1, "%s: illegal numeric format.", buf);
+ pr_fact(val);
+ }
+ /* Factor the arguments. */
+ else
+ for (; *argv != NULL; ++argv) {
+ if (argv[0][0] == '-')
+ errx(1, "negative numbers aren't permitted.");
+ if (BN_dec2bn(&val, argv[0]) == 0 &&
+ BN_hex2bn(&val, argv[0]) == 0)
+ errx(1, "%s: illegal numeric format.", argv[0]);
+ pr_fact(val);
+ }
+ exit(0);
+}
+
+/*
+ * pr_fact - print the factors of a number
+ *
+ * Print the factors of the number, from the lowest to the highest.
+ * A factor will be printed multiple times if it divides the value
+ * multiple times.
+ *
+ * Factors are printed with leading tabs.
+ */
+static void
+pr_fact(BIGNUM *val)
+{
+ const ubig *fact; /* The factor found. */
+
+ /* Firewall - catch 0 and 1. */
+ if (BN_is_zero(val)) /* Historical practice; 0 just exits. */
+ exit(0);
+ if (BN_is_one(val)) {
+ printf("1: 1\n");
+ return;
+ }
+
+ /* Factor value. */
+
+ if (hflag) {
+ fputs("0x", stdout);
+ BN_print_fp(stdout, val);
+ } else
+ BN_print_dec_fp(stdout, val);
+ putchar(':');
+ for (fact = &prime[0]; !BN_is_one(val); ++fact) {
+ /* Look for the smallest factor. */
+ do {
+ if (BN_mod_word(val, (BN_ULONG)*fact) == 0)
+ break;
+ } while (++fact <= pr_limit);
+
+ /* Watch for primes larger than the table. */
+ if (fact > pr_limit) {
+#ifdef HAVE_OPENSSL
+ BIGNUM *bnfact;
+
+ bnfact = BN_new();
+ BN_set_word(bnfact, *(fact - 1));
+ if (!BN_sqr(bnfact, bnfact, ctx))
+ errx(1, "error in BN_sqr()");
+ if (BN_cmp(bnfact, val) > 0 ||
+ BN_is_prime(val, PRIME_CHECKS,
+ NULL, NULL, NULL) == 1)
+ pr_print(val);
+ else
+ pollard_pminus1(val);
+#else
+ pr_print(val);
+#endif
+ break;
+ }
+
+ /* Divide factor out until none are left. */
+ do {
+ printf(hflag ? " 0x%" PRIx64 "" : " %" PRIu64 "", *fact);
+ BN_div_word(val, (BN_ULONG)*fact);
+ } while (BN_mod_word(val, (BN_ULONG)*fact) == 0);
+
+ /* Let the user know we're doing something. */
+ fflush(stdout);
+ }
+ putchar('\n');
+}
+
+static void
+pr_print(BIGNUM *val)
+{
+ if (hflag) {
+ fputs(" 0x", stdout);
+ BN_print_fp(stdout, val);
+ } else {
+ putchar(' ');
+ BN_print_dec_fp(stdout, val);
+ }
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: factor [-h] [value ...]\n");
+ exit(1);
+}
+
+#ifdef HAVE_OPENSSL
+
+/* pollard p-1, algorithm from Jim Gillogly, May 2000 */
+static void
+pollard_pminus1(BIGNUM *val)
+{
+ BIGNUM *base, *rbase, *num, *i, *x;
+
+ base = BN_new();
+ rbase = BN_new();
+ num = BN_new();
+ i = BN_new();
+ x = BN_new();
+
+ BN_set_word(rbase, 1);
+newbase:
+ if (!BN_add_word(rbase, 1))
+ errx(1, "error in BN_add_word()");
+ BN_set_word(i, 2);
+ BN_copy(base, rbase);
+
+ for (;;) {
+ BN_mod_exp(base, base, i, val, ctx);
+ if (BN_is_one(base))
+ goto newbase;
+
+ BN_copy(x, base);
+ BN_sub_word(x, 1);
+ if (!BN_gcd(x, x, val, ctx))
+ errx(1, "error in BN_gcd()");
+
+ if (!BN_is_one(x)) {
+ if (BN_is_prime(x, PRIME_CHECKS, NULL, NULL,
+ NULL) == 1)
+ pr_print(x);
+ else
+ pollard_pminus1(x);
+ fflush(stdout);
+
+ BN_div(num, NULL, val, x, ctx);
+ if (BN_is_one(num))
+ return;
+ if (BN_is_prime(num, PRIME_CHECKS, NULL, NULL,
+ NULL) == 1) {
+ pr_print(num);
+ fflush(stdout);
+ return;
+ }
+ BN_copy(val, num);
+ }
+ if (!BN_add_word(i, 1))
+ errx(1, "error in BN_add_word()");
+ }
+}
+
+/*
+ * Sigh.. No _decimal_ output to file functions in BN.
+ */
+static void
+BN_print_dec_fp(FILE *fp, const BIGNUM *num)
+{
+ char *buf;
+
+ buf = BN_bn2dec(num);
+ if (buf == NULL)
+ return; /* XXX do anything here? */
+ fprintf(fp, "%s", buf);
+ free(buf);
+}
+
+#else
+
+static void
+BN_print_fp(FILE *fp, const BIGNUM *num)
+{
+ fprintf(fp, "%lx", (unsigned long)*num);
+}
+
+static void
+BN_print_dec_fp(FILE *fp, const BIGNUM *num)
+{
+ fprintf(fp, "%lu", (unsigned long)*num);
+}
+
+static int
+BN_dec2bn(BIGNUM **a, const char *str)
+{
+ char *p;
+
+ errno = 0;
+ **a = strtoul(str, &p, 10);
+ return (errno == 0 && (*p == '\n' || *p == '\0'));
+}
+
+static int
+BN_hex2bn(BIGNUM **a, const char *str)
+{
+ char *p;
+
+ errno = 0;
+ **a = strtoul(str, &p, 16);
+ return (errno == 0 && (*p == '\n' || *p == '\0'));
+}
+
+static BN_ULONG
+BN_div_word(BIGNUM *a, BN_ULONG b)
+{
+ BN_ULONG mod;
+
+ mod = *a % b;
+ *a /= b;
+ return mod;
+}
+
+#endif
diff --git a/usr.bin/false/Makefile b/usr.bin/false/Makefile
new file mode 100644
index 0000000..ffae97d
--- /dev/null
+++ b/usr.bin/false/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= false
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/false/Makefile.depend b/usr.bin/false/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/false/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/false/false.1 b/usr.bin/false/false.1
new file mode 100644
index 0000000..4079f1e
--- /dev/null
+++ b/usr.bin/false/false.1
@@ -0,0 +1,63 @@
+.\" Copyright (c) 1983, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)false.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt FALSE 1
+.Os
+.Sh NAME
+.Nm false
+.Nd return false value
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility always returns with a non-zero exit code.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr sh 1 ,
+.Xr true 1
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
diff --git a/usr.bin/false/false.c b/usr.bin/false/false.c
new file mode 100644
index 0000000..99948bc
--- /dev/null
+++ b/usr.bin/false/false.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1988, 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) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)false.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+int
+main(void)
+{
+ return 1;
+}
diff --git a/usr.bin/fetch/Makefile b/usr.bin/fetch/Makefile
new file mode 100644
index 0000000..93c43a7
--- /dev/null
+++ b/usr.bin/fetch/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= fetch
+CSTD?= c99
+LIBADD= fetch
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fetch/Makefile.depend b/usr.bin/fetch/Makefile.depend
new file mode 100644
index 0000000..30112de
--- /dev/null
+++ b/usr.bin/fetch/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libfetch \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/fetch/fetch.1 b/usr.bin/fetch/fetch.1
new file mode 100644
index 0000000..999fb2e
--- /dev/null
+++ b/usr.bin/fetch/fetch.1
@@ -0,0 +1,427 @@
+.\"-
+.\" Copyright (c) 2000-2014 Dag-Erling Smørgrav
+.\" Copyright (c) 2013-2016 Michael Gmelin <freebsd@grem.de>
+.\" All rights reserved.
+.\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
+.\" by permission.
+.\"
+.\" 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.
+.\" 3. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 18, 2016
+.Dt FETCH 1
+.Os
+.Sh NAME
+.Nm fetch
+.Nd retrieve a file by Uniform Resource Locator
+.Sh SYNOPSIS
+.Nm
+.Op Fl 146AadFlMmnPpqRrsUv
+.Op Fl B Ar bytes
+.Op Fl -bind-address= Ns Ar host
+.Op Fl -ca-cert= Ns Ar file
+.Op Fl -ca-path= Ns Ar dir
+.Op Fl -cert= Ns Ar file
+.Op Fl -crl= Ns Ar file
+.Op Fl i Ar file
+.Op Fl -key= Ns Ar file
+.Op Fl N Ar file
+.Op Fl -no-passive
+.Op Fl -no-proxy= Ns Ar list
+.Op Fl -no-sslv3
+.Op Fl -no-tlsv1
+.Op Fl -no-verify-hostname
+.Op Fl -no-verify-peer
+.Op Fl o Ar file
+.Op Fl -referer= Ns Ar URL
+.Op Fl S Ar bytes
+.Op Fl T Ar seconds
+.Op Fl -user-agent= Ns Ar agent-string
+.Op Fl w Ar seconds
+.Ar URL ...
+.Nm
+.Op Fl 146AadFlMmnPpqRrsUv
+.Op Fl B Ar bytes
+.Op Fl -bind-address= Ns Ar host
+.Op Fl -ca-cert= Ns Ar file
+.Op Fl -ca-path= Ns Ar dir
+.Op Fl -cert= Ns Ar file
+.Op Fl -crl= Ns Ar file
+.Op Fl i Ar file
+.Op Fl -key= Ns Ar file
+.Op Fl N Ar file
+.Op Fl -no-passive
+.Op Fl -no-proxy= Ns Ar list
+.Op Fl -no-sslv3
+.Op Fl -no-tlsv1
+.Op Fl -no-verify-hostname
+.Op Fl -no-verify-peer
+.Op Fl o Ar file
+.Op Fl -referer= Ns Ar URL
+.Op Fl S Ar bytes
+.Op Fl T Ar seconds
+.Op Fl -user-agent= Ns Ar agent-string
+.Op Fl w Ar seconds
+.Fl h Ar host Fl f Ar file Oo Fl c Ar dir Oc
+.Sh DESCRIPTION
+The
+.Nm
+utility provides a command-line interface to the
+.Xr fetch 3
+library.
+Its purpose is to retrieve the file(s) pointed to by the URL(s) on the
+command line.
+.Pp
+The following options are available:
+.Bl -tag -width Fl
+.It Fl 1 , -one-file
+Stop and return exit code 0 at the first successfully retrieved file.
+.It Fl 4 , -ipv4-only
+Forces
+.Nm
+to use IPv4 addresses only.
+.It Fl 6 , -ipv6-only
+Forces
+.Nm
+to use IPv6 addresses only.
+.It Fl A , -no-redirect
+Do not automatically follow ``temporary'' (302) redirects.
+Some broken Web sites will return a redirect instead of a not-found
+error when the requested object does not exist.
+.It Fl a , -retry
+Automatically retry the transfer upon soft failures.
+.It Fl B Ar bytes , Fl -buffer-size= Ns Ar bytes
+Specify the read buffer size in bytes.
+The default is 16,384 bytes.
+Attempts to set a buffer size lower than this will be silently
+ignored.
+The number of reads actually performed is reported at verbosity level
+two or higher (see the
+.Fl v
+flag).
+.It Fl -bind-address= Ns Ar host
+Specifies a hostname or IP address to which sockets used for outgoing
+connections will be bound.
+.It Fl c Ar dir
+The file to retrieve is in directory
+.Ar dir
+on the remote host.
+This option is deprecated and is provided for backward compatibility
+only.
+.It Fl -ca-cert= Ns Ar file
+[SSL]
+Path to certificate bundle containing trusted CA certificates.
+If not specified,
+.Pa /usr/local/etc/ssl/cert.pem
+is used.
+If this file does not exist,
+.Pa /etc/ssl/cert.pem
+is used instead.
+If neither file exists and no CA path has been configured,
+OpenSSL's default CA cert and path settings apply.
+The certificate bundle can contain multiple CA certificates.
+The
+.Pa security/ca_root_nss
+port is a common source of a current CA bundle.
+.It Fl -ca-path= Ns Ar dir
+[SSL]
+The directory
+.Ar dir
+contains trusted CA hashes.
+.It Fl -cert= Ns Ar file
+[SSL]
+.Ar file
+is a PEM encoded client certificate/key which will be used in
+client certificate authentication.
+.It Fl -crl= Ns Ar file
+[SSL]
+Points to certificate revocation list
+.Ar file ,
+which has to be in PEM format and may contain peer certificates that have
+been revoked.
+.It Fl d , -direct
+Use a direct connection even if a proxy is configured.
+.It Fl F , -force-restart
+In combination with the
+.Fl r
+flag, forces a restart even if the local and remote files have
+different modification times.
+Implies
+.Fl R .
+.It Fl f Ar file
+The file to retrieve is named
+.Ar file
+on the remote host.
+This option is deprecated and is provided for backward compatibility
+only.
+.It Fl h Ar host
+The file to retrieve is located on the host
+.Ar host .
+This option is deprecated and is provided for backward compatibility
+only.
+.It Fl i Ar file , Fl -if-modified-since= Ns Ar file
+If-Modified-Since mode: the remote file will only be retrieved if it
+is newer than
+.Ar file
+on the local host.
+(HTTP only)
+.It Fl -key= Ns Ar file
+[SSL]
+.Ar file
+is a PEM encoded client key that will be used in client certificate
+authentication in case key and client certificate are stored separately.
+.It Fl l , -symlink
+If the target is a file-scheme URL, make a symbolic link to the target
+rather than trying to copy it.
+.It Fl M
+.It Fl m , -mirror
+Mirror mode: if the file already exists locally and has the same size
+and modification time as the remote file, it will not be fetched.
+Note that the
+.Fl m
+and
+.Fl r
+flags are mutually exclusive.
+.It Fl N Ar file , Fl -netrc= Ns Ar file
+Use
+.Ar file
+instead of
+.Pa ~/.netrc
+to look up login names and passwords for FTP sites.
+See
+.Xr ftp 1
+for a description of the file format.
+This feature is experimental.
+.It Fl n , -no-mtime
+Do not preserve the modification time of the transferred file.
+.It Fl -no-passive
+Forces the FTP code to use active mode.
+.It Fl -no-proxy= Ns Ar list
+Either a single asterisk, which disables the use of proxies
+altogether, or a comma- or whitespace-separated list of hosts for
+which proxies should not be used.
+.It Fl -no-sslv3
+[SSL]
+Do not allow SSL version 3 when negotiating the connection.
+This option is deprecated and is provided for backward compatibility
+only.
+SSLv3 is disabled by default.
+Set
+.Ev SSL_ALLOW_SSL3
+to change this behavior.
+.It Fl -no-tlsv1
+[SSL]
+Do not allow TLS version 1 when negotiating the connection.
+.It Fl -no-verify-hostname
+[SSL]
+Do not verify that the hostname matches the subject of the
+certificate presented by the server.
+.It Fl -no-verify-peer
+[SSL]
+Do not verify the peer certificate against trusted CAs.
+.It Fl o Ar file , Fl output= Ns Ar file
+Set the output file name to
+.Ar file .
+By default, a ``pathname'' is extracted from the specified URI, and
+its basename is used as the name of the output file.
+A
+.Ar file
+argument of
+.Sq Li \&-
+indicates that results are to be directed to the standard output.
+If the
+.Ar file
+argument is a directory, fetched file(s) will be placed within the
+directory, with name(s) selected as in the default behaviour.
+.It Fl P
+.It Fl p , -passive
+Use passive FTP.
+These flags have no effect, since passive FTP is the default, but are
+provided for compatibility with earlier versions where active FTP was
+the default.
+To force active mode, use the
+.Fl -no-passive
+flag or set the
+.Ev FTP_PASSIVE_MODE
+environment variable to
+.Ql NO .
+.It Fl -referer= Ns Ar URL
+Specifies the referrer URL to use for HTTP requests.
+If
+.Ar URL
+is set to
+.Dq auto ,
+the document URL will be used as referrer URL.
+.It Fl q , -quiet
+Quiet mode.
+.It Fl R , -keep-output
+The output files are precious, and should not be deleted under any
+circumstances, even if the transfer failed or was incomplete.
+.It Fl r , -restart
+Restart a previously interrupted transfer.
+Note that the
+.Fl m
+and
+.Fl r
+flags are mutually exclusive.
+.It Fl S Ar bytes , Fl -require-size= Ns Ar bytes
+Require the file size reported by the server to match the specified
+value.
+If it does not, a message is printed and the file is not fetched.
+If the server does not support reporting file sizes, this option is
+ignored and the file is fetched unconditionally.
+.It Fl s , -print-size
+Print the size in bytes of each requested file, without fetching it.
+.It Fl T Ar seconds , Fl -timeout= Ns Ar seconds
+Set timeout value to
+.Ar seconds .
+Overrides the environment variables
+.Ev FTP_TIMEOUT
+for FTP transfers or
+.Ev HTTP_TIMEOUT
+for HTTP transfers if set.
+.It Fl U , -passive-portrange-default
+When using passive FTP, allocate the port for the data connection from
+the low (default) port range.
+See
+.Xr ip 4
+for details on how to specify which port range this corresponds to.
+.It Fl -user-agent= Ns Ar agent-string
+Specifies the User-Agent string to use for HTTP requests.
+This can be useful when working with HTTP origin or proxy servers that
+differentiate between user agents.
+.It Fl v , -verbose
+Increase verbosity level.
+.It Fl w Ar seconds , Fl -retry-delay= Ns Ar seconds
+When the
+.Fl a
+flag is specified, wait this many seconds between successive retries.
+.El
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+signal (see the
+.Cm status
+argument for
+.Xr stty 1 ) ,
+the current transfer rate statistics will be written to the
+standard error output, in the same format as the standard completion
+message.
+.Sh ENVIRONMENT
+.Bl -tag -width HTTP_TIMEOUT
+.It Ev FTP_TIMEOUT
+Maximum time, in seconds, to wait before aborting an FTP connection.
+.It Ev HTTP_TIMEOUT
+Maximum time, in seconds, to wait before aborting an HTTP connection.
+.El
+.Pp
+See
+.Xr fetch 3
+for a description of additional environment variables, including
+.Ev FETCH_BIND_ADDRESS ,
+.Ev FTP_LOGIN ,
+.Ev FTP_PASSIVE_MODE ,
+.Ev FTP_PASSWORD ,
+.Ev FTP_PROXY ,
+.Ev ftp_proxy ,
+.Ev HTTP_ACCEPT ,
+.Ev HTTP_AUTH ,
+.Ev HTTP_PROXY ,
+.Ev http_proxy ,
+.Ev HTTP_PROXY_AUTH ,
+.Ev HTTP_REFERER ,
+.Ev HTTP_USER_AGENT ,
+.Ev NETRC ,
+.Ev NO_PROXY ,
+.Ev no_proxy ,
+.Ev SSL_CA_CERT_FILE ,
+.Ev SSL_CA_CERT_PATH ,
+.Ev SSL_CLIENT_CERT_FILE ,
+.Ev SSL_CLIENT_KEY_FILE ,
+.Ev SSL_CRL_FILE ,
+.Ev SSL_ALLOW_SSL3 ,
+.Ev SSL_NO_TLS1 ,
+.Ev SSL_NO_TLS1_1 ,
+.Ev SSL_NO_TLS1_2 ,
+.Ev SSL_NO_VERIFY_HOSTNAME
+and
+.Ev SSL_NO_VERIFY_PEER .
+.Sh EXIT STATUS
+The
+.Nm
+command returns zero on success, or one on failure.
+If multiple URLs are listed on the command line,
+.Nm
+will attempt to retrieve each one of them in turn, and will return
+zero only if they were all successfully retrieved.
+.Pp
+If the
+.Fl i
+argument is used and the remote file is not newer than the
+specified file then the command will still return success,
+although no file is transferred.
+.Sh SEE ALSO
+.Xr fetch 3 ,
+.Xr phttpget 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 2.1.5 .
+This implementation first appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An -nosplit
+The original implementation of
+.Nm
+was done by
+.An Jean-Marc Zucconi Aq Mt jmz@FreeBSD.org .
+It was extensively re-worked for
+.Fx 2.2
+by
+.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 Mt des@FreeBSD.org
+and
+.An Michael Gmelin Aq Mt freebsd@grem.de .
+.Sh NOTES
+The
+.Fl b
+and
+.Fl t
+options are no longer supported and will generate warnings.
+They were workarounds for bugs in other OSes which this implementation
+does not trigger.
+.Pp
+One cannot both use the
+.Fl h ,
+.Fl c
+and
+.Fl f
+options and specify URLs on the command line.
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
new file mode 100644
index 0000000..3fbf343
--- /dev/null
+++ b/usr.bin/fetch/fetch.c
@@ -0,0 +1,1175 @@
+/*-
+ * Copyright (c) 2000-2014 Dag-Erling Smørgrav
+ * Copyright (c) 2013 Michael Gmelin <freebsd@grem.de>
+ * 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.
+ * 3. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include <fetch.h>
+
+#define MINBUFSIZE 16384
+#define TIMEOUT 120
+
+/* Option flags */
+static int A_flag; /* -A: do not follow 302 redirects */
+static int a_flag; /* -a: auto retry */
+static off_t B_size; /* -B: buffer size */
+static int b_flag; /*! -b: workaround TCP bug */
+static char *c_dirname; /* -c: remote directory */
+static int d_flag; /* -d: direct connection */
+static int F_flag; /* -F: restart without checking mtime */
+static char *f_filename; /* -f: file to fetch */
+static char *h_hostname; /* -h: host to fetch from */
+static int i_flag; /* -i: specify file for mtime comparison */
+static char *i_filename; /* name of input file */
+static int l_flag; /* -l: link rather than copy file: URLs */
+static int m_flag; /* -[Mm]: mirror mode */
+static char *N_filename; /* -N: netrc file name */
+static int n_flag; /* -n: do not preserve modification time */
+static int o_flag; /* -o: specify output file */
+static int o_directory; /* output file is a directory */
+static char *o_filename; /* name of output file */
+static int o_stdout; /* output file is stdout */
+static int once_flag; /* -1: stop at first successful file */
+static int p_flag; /* -[Pp]: use passive FTP */
+static int R_flag; /* -R: don't delete partial files */
+static int r_flag; /* -r: restart previous transfer */
+static off_t S_size; /* -S: require size to match */
+static int s_flag; /* -s: show size, don't fetch */
+static long T_secs; /* -T: transfer timeout in seconds */
+static int t_flag; /*! -t: workaround TCP bug */
+static int U_flag; /* -U: do not use high ports */
+static int v_level = 1; /* -v: verbosity level */
+static int v_tty; /* stdout is a tty */
+static pid_t pgrp; /* our process group */
+static long w_secs; /* -w: retry delay */
+static int family = PF_UNSPEC; /* -[46]: address family to use */
+
+static int sigalrm; /* SIGALRM received */
+static int siginfo; /* SIGINFO received */
+static int sigint; /* SIGINT received */
+
+static long ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */
+static long http_timeout = TIMEOUT;/* default timeout for HTTP transfers */
+static char *buf; /* transfer buffer */
+
+enum options
+{
+ OPTION_BIND_ADDRESS,
+ OPTION_NO_FTP_PASSIVE_MODE,
+ OPTION_HTTP_REFERER,
+ OPTION_HTTP_USER_AGENT,
+ OPTION_NO_PROXY,
+ OPTION_SSL_CA_CERT_FILE,
+ OPTION_SSL_CA_CERT_PATH,
+ OPTION_SSL_CLIENT_CERT_FILE,
+ OPTION_SSL_CLIENT_KEY_FILE,
+ OPTION_SSL_CRL_FILE,
+ OPTION_SSL_NO_SSL3,
+ OPTION_SSL_NO_TLS1,
+ OPTION_SSL_NO_VERIFY_HOSTNAME,
+ OPTION_SSL_NO_VERIFY_PEER
+};
+
+
+static struct option longopts[] =
+{
+ /* mapping to single character argument */
+ { "one-file", no_argument, NULL, '1' },
+ { "ipv4-only", no_argument, NULL, '4' },
+ { "ipv6-only", no_argument, NULL, '6' },
+ { "no-redirect", no_argument, NULL, 'A' },
+ { "retry", no_argument, NULL, 'a' },
+ { "buffer-size", required_argument, NULL, 'B' },
+ /* -c not mapped, since it's deprecated */
+ { "direct", no_argument, NULL, 'd' },
+ { "force-restart", no_argument, NULL, 'F' },
+ /* -f not mapped, since it's deprecated */
+ /* -h not mapped, since it's deprecated */
+ { "if-modified-since", required_argument, NULL, 'i' },
+ { "symlink", no_argument, NULL, 'l' },
+ /* -M not mapped since it's the same as -m */
+ { "mirror", no_argument, NULL, 'm' },
+ { "netrc", required_argument, NULL, 'N' },
+ { "no-mtime", no_argument, NULL, 'n' },
+ { "output", required_argument, NULL, 'o' },
+ /* -P not mapped since it's the same as -p */
+ { "passive", no_argument, NULL, 'p' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "keep-output", no_argument, NULL, 'R' },
+ { "restart", no_argument, NULL, 'r' },
+ { "require-size", required_argument, NULL, 'S' },
+ { "print-size", no_argument, NULL, 's' },
+ { "timeout", required_argument, NULL, 'T' },
+ { "passive-portrange-default", no_argument, NULL, 'T' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "retry-delay", required_argument, NULL, 'w' },
+
+ /* options without a single character equivalent */
+ { "bind-address", required_argument, NULL, OPTION_BIND_ADDRESS },
+ { "no-passive", no_argument, NULL, OPTION_NO_FTP_PASSIVE_MODE },
+ { "referer", required_argument, NULL, OPTION_HTTP_REFERER },
+ { "user-agent", required_argument, NULL, OPTION_HTTP_USER_AGENT },
+ { "no-proxy", required_argument, NULL, OPTION_NO_PROXY },
+ { "ca-cert", required_argument, NULL, OPTION_SSL_CA_CERT_FILE },
+ { "ca-path", required_argument, NULL, OPTION_SSL_CA_CERT_PATH },
+ { "cert", required_argument, NULL, OPTION_SSL_CLIENT_CERT_FILE },
+ { "key", required_argument, NULL, OPTION_SSL_CLIENT_KEY_FILE },
+ { "crl", required_argument, NULL, OPTION_SSL_CRL_FILE },
+ { "no-sslv3", no_argument, NULL, OPTION_SSL_NO_SSL3 },
+ { "no-tlsv1", no_argument, NULL, OPTION_SSL_NO_TLS1 },
+ { "no-verify-hostname", no_argument, NULL, OPTION_SSL_NO_VERIFY_HOSTNAME },
+ { "no-verify-peer", no_argument, NULL, OPTION_SSL_NO_VERIFY_PEER },
+
+ { NULL, 0, NULL, 0 }
+};
+
+/*
+ * Signal handler
+ */
+static void
+sig_handler(int sig)
+{
+ switch (sig) {
+ case SIGALRM:
+ sigalrm = 1;
+ break;
+ case SIGINFO:
+ siginfo = 1;
+ break;
+ case SIGINT:
+ sigint = 1;
+ break;
+ }
+}
+
+struct xferstat {
+ char name[64];
+ struct timeval start; /* start of transfer */
+ struct timeval last; /* time of last update */
+ struct timeval last2; /* time of previous last update */
+ off_t size; /* size of file per HTTP hdr */
+ off_t offset; /* starting offset in file */
+ off_t rcvd; /* bytes already received */
+ off_t lastrcvd; /* bytes received since last update */
+};
+
+/*
+ * Compute and display ETA
+ */
+static const char *
+stat_eta(struct xferstat *xs)
+{
+ static char str[16];
+ long elapsed, eta;
+ off_t received, expected;
+
+ elapsed = xs->last.tv_sec - xs->start.tv_sec;
+ received = xs->rcvd - xs->offset;
+ expected = xs->size - xs->rcvd;
+ eta = (long)((double)elapsed * expected / received);
+ if (eta > 3600)
+ snprintf(str, sizeof str, "%02ldh%02ldm",
+ eta / 3600, (eta % 3600) / 60);
+ else if (eta > 0)
+ snprintf(str, sizeof str, "%02ldm%02lds",
+ eta / 60, eta % 60);
+ else
+ snprintf(str, sizeof str, "%02ldm%02lds",
+ elapsed / 60, elapsed % 60);
+ return (str);
+}
+
+/*
+ * Format a number as "xxxx YB" where Y is ' ', 'k', 'M'...
+ */
+static const char *prefixes = " kMGTP";
+static const char *
+stat_bytes(off_t bytes)
+{
+ static char str[16];
+ const char *prefix = prefixes;
+
+ while (bytes > 9999 && prefix[1] != '\0') {
+ bytes /= 1024;
+ prefix++;
+ }
+ snprintf(str, sizeof str, "%4jd %cB", (intmax_t)bytes, *prefix);
+ return (str);
+}
+
+/*
+ * Compute and display transfer rate
+ */
+static const char *
+stat_bps(struct xferstat *xs)
+{
+ static char str[16];
+ double delta, bps;
+
+ delta = (xs->last.tv_sec + (xs->last.tv_usec / 1.e6))
+ - (xs->last2.tv_sec + (xs->last2.tv_usec / 1.e6));
+
+ if (delta == 0.0) {
+ snprintf(str, sizeof str, "?? Bps");
+ } else {
+ bps = (xs->rcvd - xs->lastrcvd) / delta;
+ snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
+ }
+ return (str);
+}
+
+/*
+ * Update the stats display
+ */
+static void
+stat_display(struct xferstat *xs, int force)
+{
+ struct timeval now;
+ int ctty_pgrp;
+
+ /* check if we're the foreground process */
+ if (ioctl(STDERR_FILENO, TIOCGPGRP, &ctty_pgrp) == -1 ||
+ (pid_t)ctty_pgrp != pgrp)
+ return;
+
+ gettimeofday(&now, NULL);
+ if (!force && now.tv_sec <= xs->last.tv_sec)
+ return;
+ xs->last2 = xs->last;
+ xs->last = now;
+
+ fprintf(stderr, "\r%-46.46s", xs->name);
+ if (xs->size <= 0) {
+ setproctitle("%s [%s]", xs->name, stat_bytes(xs->rcvd));
+ fprintf(stderr, " %s", stat_bytes(xs->rcvd));
+ } else {
+ setproctitle("%s [%d%% of %s]", xs->name,
+ (int)((100.0 * xs->rcvd) / xs->size),
+ stat_bytes(xs->size));
+ fprintf(stderr, "%3d%% of %s",
+ (int)((100.0 * xs->rcvd) / xs->size),
+ stat_bytes(xs->size));
+ }
+ if (force == 2) {
+ xs->lastrcvd = xs->offset;
+ xs->last2 = xs->start;
+ }
+ fprintf(stderr, " %s", stat_bps(xs));
+ if ((xs->size > 0 && xs->rcvd > 0 &&
+ xs->last.tv_sec >= xs->start.tv_sec + 3) ||
+ force == 2)
+ fprintf(stderr, " %s", stat_eta(xs));
+ xs->lastrcvd = xs->rcvd;
+}
+
+/*
+ * Initialize the transfer statistics
+ */
+static void
+stat_start(struct xferstat *xs, const char *name, off_t size, off_t offset)
+{
+ snprintf(xs->name, sizeof xs->name, "%s", name);
+ gettimeofday(&xs->start, NULL);
+ xs->last.tv_sec = xs->last.tv_usec = 0;
+ xs->size = size;
+ xs->offset = offset;
+ xs->rcvd = offset;
+ xs->lastrcvd = offset;
+ if (v_tty && v_level > 0)
+ stat_display(xs, 1);
+ else if (v_level > 0)
+ fprintf(stderr, "%-46s", xs->name);
+}
+
+/*
+ * Update the transfer statistics
+ */
+static void
+stat_update(struct xferstat *xs, off_t rcvd)
+{
+ xs->rcvd = rcvd;
+ if (v_tty && v_level > 0)
+ stat_display(xs, 0);
+}
+
+/*
+ * Finalize the transfer statistics
+ */
+static void
+stat_end(struct xferstat *xs)
+{
+ gettimeofday(&xs->last, NULL);
+ if (v_tty && v_level > 0) {
+ stat_display(xs, 2);
+ putc('\n', stderr);
+ } else if (v_level > 0) {
+ fprintf(stderr, " %s %s\n",
+ stat_bytes(xs->size), stat_bps(xs));
+ }
+}
+
+/*
+ * Ask the user for authentication details
+ */
+static int
+query_auth(struct url *URL)
+{
+ struct termios tios;
+ tcflag_t saved_flags;
+ int i, nopwd;
+
+ fprintf(stderr, "Authentication required for <%s://%s:%d/>!\n",
+ URL->scheme, URL->host, URL->port);
+
+ fprintf(stderr, "Login: ");
+ if (fgets(URL->user, sizeof URL->user, stdin) == NULL)
+ return (-1);
+ for (i = strlen(URL->user); i >= 0; --i)
+ if (URL->user[i] == '\r' || URL->user[i] == '\n')
+ URL->user[i] = '\0';
+
+ fprintf(stderr, "Password: ");
+ if (tcgetattr(STDIN_FILENO, &tios) == 0) {
+ saved_flags = tios.c_lflag;
+ tios.c_lflag &= ~ECHO;
+ tios.c_lflag |= ECHONL|ICANON;
+ tcsetattr(STDIN_FILENO, TCSAFLUSH|TCSASOFT, &tios);
+ nopwd = (fgets(URL->pwd, sizeof URL->pwd, stdin) == NULL);
+ tios.c_lflag = saved_flags;
+ tcsetattr(STDIN_FILENO, TCSANOW|TCSASOFT, &tios);
+ } else {
+ nopwd = (fgets(URL->pwd, sizeof URL->pwd, stdin) == NULL);
+ }
+ if (nopwd)
+ return (-1);
+ for (i = strlen(URL->pwd); i >= 0; --i)
+ if (URL->pwd[i] == '\r' || URL->pwd[i] == '\n')
+ URL->pwd[i] = '\0';
+
+ return (0);
+}
+
+/*
+ * Fetch a file
+ */
+static int
+fetch(char *URL, const char *path)
+{
+ struct url *url;
+ struct url_stat us;
+ struct stat sb, nsb;
+ struct xferstat xs;
+ FILE *f, *of;
+ size_t size, readcnt, wr;
+ off_t count;
+ char flags[8];
+ const char *slash;
+ char *tmppath;
+ int r;
+ unsigned timeout;
+ char *ptr;
+
+ f = of = NULL;
+ tmppath = NULL;
+
+ timeout = 0;
+ *flags = 0;
+ count = 0;
+
+ /* set verbosity level */
+ if (v_level > 1)
+ strcat(flags, "v");
+ if (v_level > 2)
+ fetchDebug = 1;
+
+ /* parse URL */
+ url = NULL;
+ if (*URL == '\0') {
+ warnx("empty URL");
+ goto failure;
+ }
+ if ((url = fetchParseURL(URL)) == NULL) {
+ warnx("%s: parse error", URL);
+ goto failure;
+ }
+
+ /* if no scheme was specified, take a guess */
+ if (!*url->scheme) {
+ if (!*url->host)
+ strcpy(url->scheme, SCHEME_FILE);
+ else if (strncasecmp(url->host, "ftp.", 4) == 0)
+ strcpy(url->scheme, SCHEME_FTP);
+ else if (strncasecmp(url->host, "www.", 4) == 0)
+ strcpy(url->scheme, SCHEME_HTTP);
+ }
+
+ /* common flags */
+ switch (family) {
+ case PF_INET:
+ strcat(flags, "4");
+ break;
+ case PF_INET6:
+ strcat(flags, "6");
+ break;
+ }
+
+ /* FTP specific flags */
+ if (strcmp(url->scheme, SCHEME_FTP) == 0) {
+ if (p_flag)
+ strcat(flags, "p");
+ if (d_flag)
+ strcat(flags, "d");
+ if (U_flag)
+ strcat(flags, "l");
+ timeout = T_secs ? T_secs : ftp_timeout;
+ }
+
+ /* HTTP specific flags */
+ if (strcmp(url->scheme, SCHEME_HTTP) == 0 ||
+ strcmp(url->scheme, SCHEME_HTTPS) == 0) {
+ if (d_flag)
+ strcat(flags, "d");
+ if (A_flag)
+ strcat(flags, "A");
+ timeout = T_secs ? T_secs : http_timeout;
+ if (i_flag) {
+ if (stat(i_filename, &sb)) {
+ warn("%s: stat()", i_filename);
+ goto failure;
+ }
+ url->ims_time = sb.st_mtime;
+ strcat(flags, "i");
+ }
+ }
+
+ /* set the protocol timeout. */
+ fetchTimeout = timeout;
+
+ /* just print size */
+ if (s_flag) {
+ if (timeout)
+ alarm(timeout);
+ r = fetchStat(url, &us, flags);
+ if (timeout)
+ alarm(0);
+ if (sigalrm || sigint)
+ goto signal;
+ if (r == -1) {
+ warnx("%s", fetchLastErrString);
+ goto failure;
+ }
+ if (us.size == -1)
+ printf("Unknown\n");
+ else
+ printf("%jd\n", (intmax_t)us.size);
+ goto success;
+ }
+
+ /*
+ * If the -r flag was specified, we have to compare the local
+ * and remote files, so we should really do a fetchStat()
+ * first, but I know of at least one HTTP server that only
+ * sends the content size in response to GET requests, and
+ * leaves it out of replies to HEAD requests. Also, in the
+ * (frequent) case that the local and remote files match but
+ * the local file is truncated, we have sufficient information
+ * before the compare to issue a correct request. Therefore,
+ * we always issue a GET request as if we were sure the local
+ * file was a truncated copy of the remote file; we can drop
+ * the connection later if we change our minds.
+ */
+ sb.st_size = -1;
+ if (!o_stdout) {
+ r = stat(path, &sb);
+ if (r == 0 && r_flag && S_ISREG(sb.st_mode)) {
+ url->offset = sb.st_size;
+ } else if (r == -1 || !S_ISREG(sb.st_mode)) {
+ /*
+ * Whatever value sb.st_size has now is either
+ * wrong (if stat(2) failed) or irrelevant (if the
+ * path does not refer to a regular file)
+ */
+ sb.st_size = -1;
+ }
+ if (r == -1 && errno != ENOENT) {
+ warnx("%s: stat()", path);
+ goto failure;
+ }
+ }
+
+ /* start the transfer */
+ if (timeout)
+ alarm(timeout);
+ f = fetchXGet(url, &us, flags);
+ if (timeout)
+ alarm(0);
+ if (sigalrm || sigint)
+ goto signal;
+ if (f == NULL) {
+ warnx("%s: %s", URL, fetchLastErrString);
+ if (i_flag && strcmp(url->scheme, SCHEME_HTTP) == 0
+ && fetchLastErrCode == FETCH_OK
+ && strcmp(fetchLastErrString, "Not Modified") == 0) {
+ /* HTTP Not Modified Response, return OK. */
+ r = 0;
+ goto done;
+ } else
+ goto failure;
+ }
+ if (sigint)
+ goto signal;
+
+ /* check that size is as expected */
+ if (S_size) {
+ if (us.size == -1) {
+ warnx("%s: size unknown", URL);
+ } else if (us.size != S_size) {
+ warnx("%s: size mismatch: expected %jd, actual %jd",
+ URL, (intmax_t)S_size, (intmax_t)us.size);
+ goto failure;
+ }
+ }
+
+ /* symlink instead of copy */
+ if (l_flag && strcmp(url->scheme, "file") == 0 && !o_stdout) {
+ if (symlink(url->doc, path) == -1) {
+ warn("%s: symlink()", path);
+ goto failure;
+ }
+ goto success;
+ }
+
+ if (us.size == -1 && !o_stdout && v_level > 0)
+ warnx("%s: size of remote file is not known", URL);
+ if (v_level > 1) {
+ if (sb.st_size != -1)
+ fprintf(stderr, "local size / mtime: %jd / %ld\n",
+ (intmax_t)sb.st_size, (long)sb.st_mtime);
+ if (us.size != -1)
+ fprintf(stderr, "remote size / mtime: %jd / %ld\n",
+ (intmax_t)us.size, (long)us.mtime);
+ }
+
+ /* open output file */
+ if (o_stdout) {
+ /* output to stdout */
+ of = stdout;
+ } else if (r_flag && sb.st_size != -1) {
+ /* resume mode, local file exists */
+ if (!F_flag && us.mtime && sb.st_mtime != us.mtime) {
+ /* no match! have to refetch */
+ fclose(f);
+ /* if precious, warn the user and give up */
+ if (R_flag) {
+ warnx("%s: local modification time "
+ "does not match remote", path);
+ goto failure_keep;
+ }
+ } else if (url->offset > sb.st_size) {
+ /* gap between what we asked for and what we got */
+ warnx("%s: gap in resume mode", URL);
+ fclose(of);
+ of = NULL;
+ /* picked up again later */
+ } else if (us.size != -1) {
+ if (us.size == sb.st_size)
+ /* nothing to do */
+ goto success;
+ if (sb.st_size > us.size) {
+ /* local file too long! */
+ warnx("%s: local file (%jd bytes) is longer "
+ "than remote file (%jd bytes)", path,
+ (intmax_t)sb.st_size, (intmax_t)us.size);
+ goto failure;
+ }
+ /* we got it, open local file */
+ if ((of = fopen(path, "r+")) == NULL) {
+ warn("%s: fopen()", path);
+ goto failure;
+ }
+ /* check that it didn't move under our feet */
+ if (fstat(fileno(of), &nsb) == -1) {
+ /* can't happen! */
+ warn("%s: fstat()", path);
+ goto failure;
+ }
+ if (nsb.st_dev != sb.st_dev ||
+ nsb.st_ino != sb.st_ino ||
+ nsb.st_size != sb.st_size) {
+ warnx("%s: file has changed", URL);
+ fclose(of);
+ of = NULL;
+ sb = nsb;
+ /* picked up again later */
+ }
+ }
+ /* seek to where we left off */
+ if (of != NULL && fseeko(of, url->offset, SEEK_SET) != 0) {
+ warn("%s: fseeko()", path);
+ fclose(of);
+ of = NULL;
+ /* picked up again later */
+ }
+ } else if (m_flag && sb.st_size != -1) {
+ /* mirror mode, local file exists */
+ if (sb.st_size == us.size && sb.st_mtime == us.mtime)
+ goto success;
+ }
+
+ if (of == NULL) {
+ /*
+ * We don't yet have an output file; either this is a
+ * vanilla run with no special flags, or the local and
+ * remote files didn't match.
+ */
+
+ if (url->offset > 0) {
+ /*
+ * We tried to restart a transfer, but for
+ * some reason gave up - so we have to restart
+ * from scratch if we want the whole file
+ */
+ url->offset = 0;
+ if ((f = fetchXGet(url, &us, flags)) == NULL) {
+ warnx("%s: %s", URL, fetchLastErrString);
+ goto failure;
+ }
+ if (sigint)
+ goto signal;
+ }
+
+ /* construct a temp file name */
+ if (sb.st_size != -1 && S_ISREG(sb.st_mode)) {
+ if ((slash = strrchr(path, '/')) == NULL)
+ slash = path;
+ else
+ ++slash;
+ asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s",
+ (int)(slash - path), path, slash);
+ if (tmppath != NULL) {
+ if (mkstemps(tmppath, strlen(slash) + 1) == -1) {
+ warn("%s: mkstemps()", path);
+ goto failure;
+ }
+ of = fopen(tmppath, "w");
+ chown(tmppath, sb.st_uid, sb.st_gid);
+ chmod(tmppath, sb.st_mode & ALLPERMS);
+ }
+ }
+ if (of == NULL)
+ of = fopen(path, "w");
+ if (of == NULL) {
+ warn("%s: open()", path);
+ goto failure;
+ }
+ }
+ count = url->offset;
+
+ /* start the counter */
+ stat_start(&xs, path, us.size, count);
+
+ sigalrm = siginfo = sigint = 0;
+
+ /* suck in the data */
+ setvbuf(f, NULL, _IOFBF, B_size);
+ signal(SIGINFO, sig_handler);
+ while (!sigint) {
+ if (us.size != -1 && us.size - count < B_size &&
+ us.size - count >= 0)
+ size = us.size - count;
+ else
+ size = B_size;
+ if (siginfo) {
+ stat_end(&xs);
+ siginfo = 0;
+ }
+
+ if (size == 0)
+ break;
+
+ if ((readcnt = fread(buf, 1, size, f)) < size) {
+ if (ferror(f) && errno == EINTR && !sigint)
+ clearerr(f);
+ else if (readcnt == 0)
+ break;
+ }
+
+ stat_update(&xs, count += readcnt);
+ for (ptr = buf; readcnt > 0; ptr += wr, readcnt -= wr)
+ if ((wr = fwrite(ptr, 1, readcnt, of)) < readcnt) {
+ if (ferror(of) && errno == EINTR && !sigint)
+ clearerr(of);
+ else
+ break;
+ }
+ if (readcnt != 0)
+ break;
+ }
+ if (!sigalrm)
+ sigalrm = ferror(f) && errno == ETIMEDOUT;
+ signal(SIGINFO, SIG_DFL);
+
+ stat_end(&xs);
+
+ /*
+ * If the transfer timed out or was interrupted, we still want to
+ * set the mtime in case the file is not removed (-r or -R) and
+ * the user later restarts the transfer.
+ */
+ signal:
+ /* set mtime of local file */
+ if (!n_flag && us.mtime && !o_stdout && of != NULL &&
+ (stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
+ struct timeval tv[2];
+
+ fflush(of);
+ tv[0].tv_sec = (long)(us.atime ? us.atime : us.mtime);
+ tv[1].tv_sec = (long)us.mtime;
+ tv[0].tv_usec = tv[1].tv_usec = 0;
+ if (utimes(tmppath ? tmppath : path, tv))
+ warn("%s: utimes()", tmppath ? tmppath : path);
+ }
+
+ /* timed out or interrupted? */
+ if (sigalrm)
+ warnx("transfer timed out");
+ if (sigint) {
+ warnx("transfer interrupted");
+ goto failure;
+ }
+
+ /* timeout / interrupt before connection completley established? */
+ if (f == NULL)
+ goto failure;
+
+ if (!sigalrm) {
+ /* check the status of our files */
+ if (ferror(f))
+ warn("%s", URL);
+ if (ferror(of))
+ warn("%s", path);
+ if (ferror(f) || ferror(of))
+ goto failure;
+ }
+
+ /* did the transfer complete normally? */
+ if (us.size != -1 && count < us.size) {
+ warnx("%s appears to be truncated: %jd/%jd bytes",
+ path, (intmax_t)count, (intmax_t)us.size);
+ goto failure_keep;
+ }
+
+ /*
+ * If the transfer timed out and we didn't know how much to
+ * expect, assume the worst (i.e. we didn't get all of it)
+ */
+ if (sigalrm && us.size == -1) {
+ warnx("%s may be truncated", path);
+ goto failure_keep;
+ }
+
+ success:
+ r = 0;
+ if (tmppath != NULL && rename(tmppath, path) == -1) {
+ warn("%s: rename()", path);
+ goto failure_keep;
+ }
+ goto done;
+ failure:
+ if (of && of != stdout && !R_flag && !r_flag)
+ if (stat(path, &sb) != -1 && (sb.st_mode & S_IFREG))
+ unlink(tmppath ? tmppath : path);
+ if (R_flag && tmppath != NULL && sb.st_size == -1)
+ rename(tmppath, path); /* ignore errors here */
+ failure_keep:
+ r = -1;
+ goto done;
+ done:
+ if (f)
+ fclose(f);
+ if (of && of != stdout)
+ fclose(of);
+ if (url)
+ fetchFreeURL(url);
+ if (tmppath != NULL)
+ free(tmppath);
+ return (r);
+}
+
+static void
+usage(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: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=host]",
+" [--ca-cert=file] [--ca-path=dir] [--cert=file] [--crl=file]",
+" [-i file] [--key=file] [-N file] [--no-passive] [--no-proxy=list]",
+" [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]",
+" [-o file] [--referer=URL] [-S bytes] [-T seconds]",
+" [--user-agent=agent-string] [-w seconds] URL ...",
+" fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=host]",
+" [--ca-cert=file] [--ca-path=dir] [--cert=file] [--crl=file]",
+" [-i file] [--key=file] [-N file] [--no-passive] [--no-proxy=list]",
+" [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]",
+" [-o file] [--referer=URL] [-S bytes] [-T seconds]",
+" [--user-agent=agent-string] [-w seconds] -h host -f file [-c dir]");
+}
+
+
+/*
+ * Entry point
+ */
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ struct sigaction sa;
+ const char *p, *s;
+ char *end, *q;
+ int c, e, r;
+
+
+ while ((c = getopt_long(argc, argv,
+ "146AaB:bc:dFf:Hh:i:lMmN:nPpo:qRrS:sT:tUvw:",
+ longopts, NULL)) != -1)
+ switch (c) {
+ case '1':
+ once_flag = 1;
+ break;
+ case '4':
+ family = PF_INET;
+ break;
+ case '6':
+ family = PF_INET6;
+ break;
+ case 'A':
+ A_flag = 1;
+ break;
+ case 'a':
+ a_flag = 1;
+ break;
+ case 'B':
+ B_size = (off_t)strtol(optarg, &end, 10);
+ if (*optarg == '\0' || *end != '\0')
+ errx(1, "invalid buffer size (%s)", optarg);
+ break;
+ case 'b':
+ warnx("warning: the -b option is deprecated");
+ b_flag = 1;
+ break;
+ case 'c':
+ c_dirname = optarg;
+ break;
+ case 'd':
+ d_flag = 1;
+ break;
+ case 'F':
+ F_flag = 1;
+ break;
+ case 'f':
+ f_filename = optarg;
+ break;
+ case 'H':
+ warnx("the -H option is now implicit, "
+ "use -U to disable");
+ break;
+ case 'h':
+ h_hostname = optarg;
+ break;
+ case 'i':
+ i_flag = 1;
+ i_filename = optarg;
+ break;
+ case 'l':
+ l_flag = 1;
+ break;
+ case 'o':
+ o_flag = 1;
+ o_filename = optarg;
+ break;
+ case 'M':
+ case 'm':
+ if (r_flag)
+ errx(1, "the -m and -r flags "
+ "are mutually exclusive");
+ m_flag = 1;
+ break;
+ case 'N':
+ N_filename = optarg;
+ break;
+ case 'n':
+ n_flag = 1;
+ break;
+ case 'P':
+ case 'p':
+ p_flag = 1;
+ break;
+ case 'q':
+ v_level = 0;
+ break;
+ case 'R':
+ R_flag = 1;
+ break;
+ case 'r':
+ if (m_flag)
+ errx(1, "the -m and -r flags "
+ "are mutually exclusive");
+ r_flag = 1;
+ break;
+ case 'S':
+ S_size = (off_t)strtol(optarg, &end, 10);
+ if (*optarg == '\0' || *end != '\0')
+ errx(1, "invalid size (%s)", optarg);
+ break;
+ case 's':
+ s_flag = 1;
+ break;
+ case 'T':
+ T_secs = strtol(optarg, &end, 10);
+ if (*optarg == '\0' || *end != '\0')
+ errx(1, "invalid timeout (%s)", optarg);
+ break;
+ case 't':
+ t_flag = 1;
+ warnx("warning: the -t option is deprecated");
+ break;
+ case 'U':
+ U_flag = 1;
+ break;
+ case 'v':
+ v_level++;
+ break;
+ case 'w':
+ a_flag = 1;
+ w_secs = strtol(optarg, &end, 10);
+ if (*optarg == '\0' || *end != '\0')
+ errx(1, "invalid delay (%s)", optarg);
+ break;
+ case OPTION_BIND_ADDRESS:
+ setenv("FETCH_BIND_ADDRESS", optarg, 1);
+ break;
+ case OPTION_NO_FTP_PASSIVE_MODE:
+ setenv("FTP_PASSIVE_MODE", "no", 1);
+ break;
+ case OPTION_HTTP_REFERER:
+ setenv("HTTP_REFERER", optarg, 1);
+ break;
+ case OPTION_HTTP_USER_AGENT:
+ setenv("HTTP_USER_AGENT", optarg, 1);
+ break;
+ case OPTION_NO_PROXY:
+ setenv("NO_PROXY", optarg, 1);
+ break;
+ case OPTION_SSL_CA_CERT_FILE:
+ setenv("SSL_CA_CERT_FILE", optarg, 1);
+ break;
+ case OPTION_SSL_CA_CERT_PATH:
+ setenv("SSL_CA_CERT_PATH", optarg, 1);
+ break;
+ case OPTION_SSL_CLIENT_CERT_FILE:
+ setenv("SSL_CLIENT_CERT_FILE", optarg, 1);
+ break;
+ case OPTION_SSL_CLIENT_KEY_FILE:
+ setenv("SSL_CLIENT_KEY_FILE", optarg, 1);
+ break;
+ case OPTION_SSL_CRL_FILE:
+ setenv("SSL_CLIENT_CRL_FILE", optarg, 1);
+ break;
+ case OPTION_SSL_NO_SSL3:
+ setenv("SSL_NO_SSL3", "", 1);
+ break;
+ case OPTION_SSL_NO_TLS1:
+ setenv("SSL_NO_TLS1", "", 1);
+ break;
+ case OPTION_SSL_NO_VERIFY_HOSTNAME:
+ setenv("SSL_NO_VERIFY_HOSTNAME", "", 1);
+ break;
+ case OPTION_SSL_NO_VERIFY_PEER:
+ setenv("SSL_NO_VERIFY_PEER", "", 1);
+ break;
+ default:
+ usage();
+ exit(1);
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (h_hostname || f_filename || c_dirname) {
+ if (!h_hostname || !f_filename || argc) {
+ usage();
+ exit(1);
+ }
+ /* XXX this is a hack. */
+ if (strcspn(h_hostname, "@:/") != strlen(h_hostname))
+ errx(1, "invalid hostname");
+ if (asprintf(argv, "ftp://%s/%s/%s", h_hostname,
+ c_dirname ? c_dirname : "", f_filename) == -1)
+ errx(1, "%s", strerror(ENOMEM));
+ argc++;
+ }
+
+ if (!argc) {
+ usage();
+ exit(1);
+ }
+
+ /* allocate buffer */
+ if (B_size < MINBUFSIZE)
+ B_size = MINBUFSIZE;
+ if ((buf = malloc(B_size)) == NULL)
+ errx(1, "%s", strerror(ENOMEM));
+
+ /* timeouts */
+ if ((s = getenv("FTP_TIMEOUT")) != NULL) {
+ ftp_timeout = strtol(s, &end, 10);
+ if (*s == '\0' || *end != '\0' || ftp_timeout < 0) {
+ warnx("FTP_TIMEOUT (%s) is not a positive integer", s);
+ ftp_timeout = 0;
+ }
+ }
+ if ((s = getenv("HTTP_TIMEOUT")) != NULL) {
+ http_timeout = strtol(s, &end, 10);
+ if (*s == '\0' || *end != '\0' || http_timeout < 0) {
+ warnx("HTTP_TIMEOUT (%s) is not a positive integer", s);
+ http_timeout = 0;
+ }
+ }
+
+ /* signal handling */
+ sa.sa_flags = 0;
+ sa.sa_handler = sig_handler;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGALRM, &sa, NULL);
+ sa.sa_flags = SA_RESETHAND;
+ sigaction(SIGINT, &sa, NULL);
+ fetchRestartCalls = 0;
+
+ /* output file */
+ if (o_flag) {
+ if (strcmp(o_filename, "-") == 0) {
+ o_stdout = 1;
+ } else if (stat(o_filename, &sb) == -1) {
+ if (errno == ENOENT) {
+ if (argc > 1)
+ errx(1, "%s is not a directory",
+ o_filename);
+ } else {
+ err(1, "%s", o_filename);
+ }
+ } else {
+ if (sb.st_mode & S_IFDIR)
+ o_directory = 1;
+ }
+ }
+
+ /* check if output is to a tty (for progress report) */
+ v_tty = isatty(STDERR_FILENO);
+ if (v_tty)
+ pgrp = getpgrp();
+
+ r = 0;
+
+ /* authentication */
+ if (v_tty)
+ fetchAuthMethod = query_auth;
+ if (N_filename != NULL)
+ if (setenv("NETRC", N_filename, 1) == -1)
+ err(1, "setenv: cannot set NETRC=%s", N_filename);
+
+ while (argc) {
+ if ((p = strrchr(*argv, '/')) == NULL)
+ p = *argv;
+ else
+ p++;
+
+ if (!*p)
+ p = "fetch.out";
+
+ fetchLastErrCode = 0;
+
+ if (o_flag) {
+ if (o_stdout) {
+ e = fetch(*argv, "-");
+ } else if (o_directory) {
+ asprintf(&q, "%s/%s", o_filename, p);
+ e = fetch(*argv, q);
+ free(q);
+ } else {
+ e = fetch(*argv, o_filename);
+ }
+ } else {
+ e = fetch(*argv, p);
+ }
+
+ if (sigint)
+ kill(getpid(), SIGINT);
+
+ if (e == 0 && once_flag)
+ exit(0);
+
+ if (e) {
+ r = 1;
+ if ((fetchLastErrCode
+ && fetchLastErrCode != FETCH_UNAVAIL
+ && fetchLastErrCode != FETCH_MOVED
+ && fetchLastErrCode != FETCH_URL
+ && fetchLastErrCode != FETCH_RESOLV
+ && fetchLastErrCode != FETCH_UNKNOWN)) {
+ if (w_secs && v_level)
+ fprintf(stderr, "Waiting %ld seconds "
+ "before retrying\n", w_secs);
+ if (w_secs)
+ sleep(w_secs);
+ if (a_flag)
+ continue;
+ }
+ }
+
+ argc--, argv++;
+ }
+
+ exit(r);
+}
diff --git a/usr.bin/file/Makefile b/usr.bin/file/Makefile
new file mode 100644
index 0000000..70c211b
--- /dev/null
+++ b/usr.bin/file/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+# Makefile for file(1) cmd.
+# Copyright (c) David E. O'Brien, 2000-2004, 2009
+# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
+#
+# This software is not subject to any license of the American Telephone
+# and Telegraph Company or of the Regents of the University of California.
+#
+# Permission is granted to anyone to use this software for any purpose on
+# any computer system, and to alter it and redistribute it freely, subject
+# to the following restrictions:
+#
+# 1. The author is not responsible for the consequences of use of this
+# software, no matter how awful, even if they arise from flaws in it.
+# 2. The origin of this software must not be misrepresented, either by
+# explicit claim or by omission. Since few users ever read sources,
+# credits must appear in the documentation.
+# 3. Altered versions must be plainly marked as such, and must not be
+# misrepresented as being the original software. Since few users
+# ever read sources, credits must appear in the documentation.
+# 4. This notice may not be removed or altered.
+
+SRCDIR= ${.CURDIR}/../../contrib/file
+.PATH: ${SRCDIR}/src
+.PATH: ${SRCDIR}/doc
+
+PROG= file
+
+MAGICPATH?= /usr/share/misc
+
+CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H
+CFLAGS+= -I${.CURDIR}/../../lib/libmagic
+
+LIBADD= magic
+
+FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
+ ${.CURDIR}/../../lib/libmagic/config.h
+
+CLEANFILES+= ${MAN}
+
+.include <bsd.prog.mk>
+
+.for mp in ${MAN}
+${mp}: ${mp:C/[0-9]/man/}
+ sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \
+ -e 's/__VERSION__/${FILEVER}/g' \
+ -e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET}
+.endfor
diff --git a/usr.bin/file/Makefile.depend b/usr.bin/file/Makefile.depend
new file mode 100644
index 0000000..4057a4c
--- /dev/null
+++ b/usr.bin/file/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmagic \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/file2c/Makefile b/usr.bin/file2c/Makefile
new file mode 100644
index 0000000..214d033
--- /dev/null
+++ b/usr.bin/file2c/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= file2c
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/file2c/Makefile.depend b/usr.bin/file2c/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/file2c/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/file2c/file2c.1 b/usr.bin/file2c/file2c.1
new file mode 100644
index 0000000..40482c2
--- /dev/null
+++ b/usr.bin/file2c/file2c.1
@@ -0,0 +1,75 @@
+.\"----------------------------------------------------------------------------
+.\" "THE BEER-WARE LICENSE" (Revision 42):
+.\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice, you
+.\" can do whatever you want with this file. If we meet some day, and you think
+.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+.\" ---------------------------------------------------------------------------
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 22, 2007
+.Dt FILE2C 1
+.Os
+.Sh NAME
+.Nm file2c
+.Nd convert file to c-source
+.Sh SYNOPSIS
+.Nm
+.Op Fl sx
+.Op Fl n Ar count
+.Op Ar prefix Op Ar suffix
+.Sh DESCRIPTION
+The
+.Nm
+utility reads a file from stdin and writes it to stdout, converting each
+byte to its decimal or hexadecimal representation on the fly.
+The byte values are separated by a comma.
+This also means that the last byte value is not followed by a comma.
+By default the byte values are printed in decimal, but when the
+.Fl x
+option is given, the values will be printed in hexadecimal.
+When
+.Fl s
+option is given, each line is printed with a leading tab and each comma is
+followed by a space except for the last one on the line.
+.Pp
+If more than 70 characters are printed on the same line, that line is
+ended and the output continues on the next line.
+With the
+.Fl n
+option this can be made to happen after the specified number of
+byte values have been printed.
+The length of the line will not be considered anymore.
+To have all the byte values printed on the same line, give the
+.Fl n
+option a negative number.
+.Pp
+A prefix and suffix strings can be printed before and after the byte values
+(resp.)
+If a suffix is to be printed, a prefix must also be specified.
+The first non-option word is the prefix, which may optionally be followed
+by a word that is to be used as the suffix.
+.Pp
+This program is typically used to embed binary files into C source files.
+The prefix is used to define an array type and the suffix is used to end
+the C statement.
+The
+.Fl n , s
+and
+.Fl x
+options are useful when the binary data represents a bitmap and the output
+needs to remain readable and/or editable.
+Fonts, for example, are a good example of this.
+.Sh EXAMPLES
+The command:
+.Bd -literal -offset indent
+date | file2c 'const char date[] = {' ',0};'
+.Ed
+.Pp
+will produce:
+.Bd -literal -offset indent
+const char date[] = {
+83,97,116,32,74,97,110,32,50,56,32,49,54,58,50,56,58,48,53,
+32,80,83,84,32,49,57,57,53,10
+,0};
+.Ed
diff --git a/usr.bin/file2c/file2c.c b/usr.bin/file2c/file2c.c
new file mode 100644
index 0000000..e50bd1f
--- /dev/null
+++ b/usr.bin/file2c/file2c.c
@@ -0,0 +1,92 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: %s [-sx] [-n count] [prefix [suffix]]\n",
+ getprogname());
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int c, count, linepos, maxcount, pretty, radix;
+
+ maxcount = 0;
+ pretty = 0;
+ radix = 10;
+ while ((c = getopt(argc, argv, "n:sx")) != -1) {
+ switch (c) {
+ case 'n': /* Max. number of bytes per line. */
+ maxcount = strtol(optarg, NULL, 10);
+ break;
+ case 's': /* Be more style(9) comliant. */
+ pretty = 1;
+ break;
+ case 'x': /* Print hexadecimal numbers. */
+ radix = 16;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0)
+ printf("%s\n", argv[0]);
+ count = linepos = 0;
+ while((c = getchar()) != EOF) {
+ if (count) {
+ putchar(',');
+ linepos++;
+ }
+ if ((maxcount == 0 && linepos > 70) ||
+ (maxcount > 0 && count >= maxcount)) {
+ putchar('\n');
+ count = linepos = 0;
+ }
+ if (pretty) {
+ if (count) {
+ putchar(' ');
+ linepos++;
+ } else {
+ putchar('\t');
+ linepos += 8;
+ }
+ }
+ switch (radix) {
+ case 10:
+ linepos += printf("%d", c);
+ break;
+ case 16:
+ linepos += printf("0x%02x", c);
+ break;
+ default:
+ abort();
+ }
+ count++;
+ }
+ putchar('\n');
+ if (argc > 1)
+ printf("%s\n", argv[1]);
+ return (0);
+}
diff --git a/usr.bin/file2c/tests/Makefile b/usr.bin/file2c/tests/Makefile
new file mode 100644
index 0000000..a35406b
--- /dev/null
+++ b/usr.bin/file2c/tests/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.1.out
+${PACKAGE}FILES+= regress.2.out
+${PACKAGE}FILES+= regress.3.out
+${PACKAGE}FILES+= regress.4.out
+${PACKAGE}FILES+= regress.5.out
+${PACKAGE}FILES+= regress.6.out
+${PACKAGE}FILES+= regress.7.out
+${PACKAGE}FILES+= regress.8.out
+${PACKAGE}FILES+= regress.9.out
+${PACKAGE}FILES+= regress.in
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/file2c/tests/Makefile.depend b/usr.bin/file2c/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/file2c/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/file2c/tests/legacy_test.sh b/usr.bin/file2c/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/file2c/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/file2c/tests/regress.1.out b/usr.bin/file2c/tests/regress.1.out
new file mode 100644
index 0000000..6b760fe
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.1.out
@@ -0,0 +1 @@
+175,212,59,239,227,234,192,22,186,113,52,204,195
diff --git a/usr.bin/file2c/tests/regress.2.out b/usr.bin/file2c/tests/regress.2.out
new file mode 100644
index 0000000..07acb21
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.2.out
@@ -0,0 +1,3 @@
+PREFIX
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137
diff --git a/usr.bin/file2c/tests/regress.3.out b/usr.bin/file2c/tests/regress.3.out
new file mode 100644
index 0000000..55502df
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.3.out
@@ -0,0 +1,5 @@
+PREFIX
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,
+134
+SUFFIX
diff --git a/usr.bin/file2c/tests/regress.4.out b/usr.bin/file2c/tests/regress.4.out
new file mode 100644
index 0000000..dc21fd0
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.4.out
@@ -0,0 +1,4 @@
+0xaf,0xd4,0x3b,0xef,0xe3,0xea,0xc0,0x16,0xba,0x71,0x34,0xcc,0xc3,0x51,0xf0,
+0xdf,0xad,0x73,0x6d,0x66,0xaf,0xb7,0x18,0xb9,0xad,0x89,0x6b,0x74,0x4d,0x8e,
+0xd9,0xac,0xc4,0x2d,0x3e,0xe4,0x29,0xae,0x86,0x36,0xbb,0xe7,0x35,0x7c,0x92,
+0x88,0xcb,0x34,0x5b,0xae,0xd4,0x73
diff --git a/usr.bin/file2c/tests/regress.5.out b/usr.bin/file2c/tests/regress.5.out
new file mode 100644
index 0000000..8210ab5
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.5.out
@@ -0,0 +1 @@
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,134,54,187,231,53,124,146,136,203,52,91,174,212,115,254,86,214,31,196,19,159,213,217,170,247,32,69
diff --git a/usr.bin/file2c/tests/regress.6.out b/usr.bin/file2c/tests/regress.6.out
new file mode 100644
index 0000000..0f2bb74
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.6.out
@@ -0,0 +1,9 @@
+P
+175,
+212,
+59,
+239,
+227,
+234,
+192
+S
diff --git a/usr.bin/file2c/tests/regress.7.out b/usr.bin/file2c/tests/regress.7.out
new file mode 100644
index 0000000..f94ac55
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.7.out
@@ -0,0 +1,8 @@
+P S
+0xaf,0xd4,
+0x3b,0xef,
+0xe3,0xea,
+0xc0,0x16,
+0xba,0x71,
+0x34,0xcc,
+0xc3,0x51
diff --git a/usr.bin/file2c/tests/regress.8.out b/usr.bin/file2c/tests/regress.8.out
new file mode 100644
index 0000000..5f5ce9d
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.8.out
@@ -0,0 +1,4 @@
+P
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,
+173,115,109,102,175
+-x
diff --git a/usr.bin/file2c/tests/regress.9.out b/usr.bin/file2c/tests/regress.9.out
new file mode 100644
index 0000000..91f5e00
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.9.out
@@ -0,0 +1,104 @@
+const char data[] = {
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,
+134,54,187,231,53,124,146,136,203,52,91,174,212,115,254,86,214,31,196,19,
+159,213,217,170,247,32,69,15,231,52,136,125,195,84,63,231,94,73,173,8,93,
+21,246,118,130,218,200,68,1,213,178,88,162,39,161,153,54,177,161,114,188,
+55,163,166,158,218,151,163,44,7,42,25,221,143,194,40,129,228,100,128,87,
+22,76,210,109,149,64,61,169,252,1,10,61,78,17,233,29,222,247,155,156,34,
+151,186,171,39,111,169,87,194,186,102,95,11,205,207,209,111,83,167,166,
+29,172,60,135,178,208,166,219,38,228,105,200,239,180,184,232,11,1,81,233,
+107,45,73,109,94,17,10,51,91,47,89,38,253,42,224,111,143,244,243,132,225,
+236,187,30,9,241,233,210,161,200,236,249,21,197,176,161,185,240,15,155,
+73,244,186,255,214,180,122,15,206,205,35,217,58,112,50,82,199,35,150,232,
+96,54,67,77,248,243,17,96,131,221,212,44,236,137,88,213,20,21,87,89,238,
+199,156,82,77,167,123,2,92,199,167,190,74,59,80,50,196,105,153,40,27,93,
+170,194,85,110,39,185,21,155,221,105,44,156,220,30,29,17,220,26,54,30,167,
+42,77,239,74,240,203,94,63,221,148,49,14,107,117,66,1,105,243,79,165,175,
+174,213,130,57,187,168,91,229,107,49,55,120,144,120,93,89,120,60,127,84,
+152,194,184,102,115,33,8,221,63,46,181,152,83,62,45,231,162,173,228,103,
+103,116,248,51,141,21,236,8,30,123,30,234,59,188,86,232,101,106,153,116,
+200,64,175,52,18,186,152,60,255,171,132,173,173,176,60,246,21,85,51,240,
+237,224,250,22,33,89,89,204,108,107,121,119,120,215,207,179,181,142,127,
+78,131,95,195,100,48,166,135,170,195,247,111,185,202,47,151,74,62,32,174,
+242,230,104,193,252,28,115,187,212,110,41,39,170,27,167,229,36,31,192,214,
+209,35,149,83,44,7,74,16,6,162,164,171,21,48,68,19,137,29,115,225,31,97,
+226,39,220,241,118,3,172,249,17,144,45,171,247,34,124,160,136,171,7,165,
+127,186,207,150,30,115,162,6,75,153,114,65,146,59,93,162,184,197,81,160,
+173,244,205,8,84,76,85,214,195,73,70,6,38,135,198,111,48,242,129,24,202,
+183,227,77,62,92,136,58,149,235,155,34,100,63,248,185,247,103,12,117,135,
+218,116,114,185,35,11,178,217,192,11,184,239,201,107,24,187,32,183,149,
+180,103,191,36,72,152,129,204,108,46,14,187,236,222,134,28,158,81,41,15,
+83,148,165,165,16,50,134,119,162,211,103,6,28,182,225,13,67,165,25,110,
+51,141,158,80,112,27,2,163,34,96,55,223,171,108,115,119,191,29,45,48,176,
+93,63,123,252,132,121,238,116,180,217,185,178,213,86,194,197,122,13,159,
+70,109,151,247,182,134,65,76,155,189,174,220,28,38,253,222,56,102,50,221,
+183,255,234,113,240,24,149,76,227,18,188,10,201,110,148,51,108,253,37,32,
+192,136,135,149,253,77,23,99,213,12,35,25,219,234,9,251,145,90,23,111,223,
+251,54,16,217,91,116,214,175,95,87,116,228,191,226,227,72,67,72,227,52,
+91,237,107,6,20,30,67,179,215,177,9,138,235,14,83,23,37,127,111,36,122,
+165,179,81,247,230,81,106,89,85,62,188,48,49,122,155,172,71,129,167,98,
+25,108,23,89,100,251,85,108,114,163,179,40,40,129,67,78,165,71,126,55,35,
+108,168,86,141,242,16,178,196,234,255,243,10,170,84,201,160,243,153,12,
+246,112,87,172,229,154,154,231,225,154,62,78,50,100,211,194,225,50,14,134,
+198,5,48,174,154,213,62,249,2,77,18,179,154,27,244,32,44,73,74,150,48,103,
+186,212,126,48,213,41,240,21,209,94,239,111,157,235,120,194,179,15,45,110,
+74,114,107,248,124,221,42,1,248,115,14,20,76,219,51,178,87,83,74,81,179,
+10,188,233,36,90,123,175,106,85,72,85,247,247,150,22,127,238,219,156,230,
+141,108,80,92,226,205,250,61,57,23,128,120,138,195,61,50,48,40,89,57,0,
+108,138,179,29,182,118,58,232,220,199,228,56,184,194,86,244,239,16,198,
+172,248,114,100,209,210,74,246,210,215,83,149,65,151,36,215,64,148,13,198,
+151,160,109,43,109,176,149,187,55,216,239,227,157,71,1,137,235,100,30,155,
+160,6,153,19,17,57,45,17,211,240,230,117,98,228,16,148,211,217,183,210,
+224,126,134,129,133,59,238,108,128,55,9,53,63,209,219,15,241,210,179,126,
+209,237,226,31,168,14,244,84,15,178,156,207,52,183,238,75,46,198,222,199,
+187,122,236,157,216,200,186,206,232,178,139,180,48,172,179,64,255,173,117,
+56,187,111,51,164,176,81,74,18,223,195,241,215,110,118,170,10,85,42,118,
+207,167,76,52,10,223,217,199,21,148,132,227,122,89,95,50,196,35,113,250,
+140,131,221,33,214,61,172,16,167,189,85,183,33,99,28,255,105,45,230,252,
+78,58,141,63,233,184,227,150,177,23,124,88,77,152,224,53,47,208,156,141,
+227,80,76,93,97,205,63,126,216,128,43,234,86,241,35,225,209,53,194,40,228,
+135,97,224,135,136,209,172,124,127,193,198,125,70,219,251,134,56,110,128,
+134,235,20,184,170,1,178,173,176,236,18,79,83,60,110,117,154,242,5,254,
+212,231,224,203,236,117,245,92,109,193,45,187,32,223,184,174,68,68,7,21,
+83,150,227,254,117,189,137,53,47,194,235,84,106,158,96,253,148,233,20,219,
+47,195,115,90,131,219,109,94,179,197,153,117,170,201,115,217,52,34,242,
+177,36,163,172,89,31,237,128,202,79,206,95,232,250,245,250,248,85,205,18,
+42,255,89,27,253,151,196,70,111,223,210,133,43,141,220,38,164,115,97,253,
+143,14,110,111,161,180,120,180,10,67,159,159,131,78,250,171,117,254,102,
+180,19,191,64,121,234,124,209,6,99,115,126,62,6,180,117,63,96,47,252,91,
+238,92,31,161,23,148,54,247,17,114,8,109,120,173,236,230,16,160,52,172,
+135,100,28,109,74,112,236,30,120,44,179,241,226,128,86,36,25,43,0,131,174,
+39,71,145,42,145,57,134,49,119,186,21,71,227,7,143,23,129,207,212,68,86,
+189,223,128,210,13,244,134,154,21,247,229,135,56,126,130,64,24,129,97,170,
+179,60,2,251,235,7,146,54,168,51,205,241,176,243,18,112,166,154,11,185,
+34,2,74,34,112,80,194,44,31,79,148,22,126,184,143,164,65,185,118,97,137,
+197,195,71,201,124,30,189,16,222,168,96,21,114,25,135,66,61,52,196,6,103,
+156,174,43,155,156,146,168,129,221,31,38,17,84,177,13,182,35,86,148,68,
+216,182,162,189,162,229,124,99,43,181,175,191,21,89,116,76,18,120,112,167,
+160,199,230,54,159,75,205,231,34,123,227,122,40,228,137,194,91,15,83,32,
+161,238,160,158,81,254,235,51,181,128,169,77,75,128,9,221,244,167,92,168,
+132,102,155,20,17,0,115,64,13,198,187,22,66,80,133,155,139,35,77,184,50,
+31,108,46,113,132,129,105,10,38,109,158,217,152,252,106,137,70,214,109,
+142,23,193,78,47,157,63,199,246,92,213,249,158,193,196,65,53,159,48,43,
+139,17,210,33,122,153,199,184,146,155,64,139,233,170,2,81,2,116,140,134,
+148,214,138,6,54,223,45,254,180,208,72,255,191,65,129,138,27,28,48,41,125,
+203,72,62,184,117,59,124,59,156,127,22,130,200,25,188,17,87,87,71,180,203,
+126,37,171,228,197,213,193,24,95,185,8,33,6,135,150,88,215,49,121,249,249,
+126,93,145,33,48,231,203,214,171,53,189,190,186,69,74,78,226,152,46,73,
+97,132,93,57,243,62,8,23,160,48,143,26,243,244,69,223,70,9,4,61,104,204,
+57,82,28,232,205,45,164,252,49,24,192,241,200,120,32,90,181,153,234,105,
+124,201,101,91,145,121,236,41,0,73,54,204,145,93,72,105,203,59,118,155,
+173,58,37,137,45,50,207,33,83,188,236,149,223,23,55,24,140,220,235,248,
+224,145,15,225,11,88,85,101,138,235,92,38,59,58,179,203,8,44,28,225,1,147,
+217,197,33,237,115,216,55,178,154,74,207,199,158,198,39,180,203,103,52,
+132,48,98,243,121,32,210,6,119,180,225,230,79,227,207,190,151,119,209,155,
+216,34,156,47,179,133,184,77,108,199,243,170,14,43,166,203,191,43,209,144,
+37,246,211,139,52,133,37,75,31,6,103,246,112,230,134,120,239,33,136,82,
+40,158,0,11,62,156,209,141,170,166,191,34,201,17,115,227,161,89,21,53,200,
+239,123,153,200,115,87,10,4,203,69,132,33,245,27,237,253,86,90,38,51,139,
+117,223,46,112,206,251,91,230,219,203,46,194,226,218,192,8,24,104,111,102,
+55,241,73,26,49,35,15,35,55,48,3,151,212,63,105,195,186,42,7,221,56,14,
+122,92,188,17,179,185,199,165,231,154,149,231,102,135,64,192,7,54,233,13,
+191,88,180,161,11,154,175
+, 0};
diff --git a/usr.bin/file2c/tests/regress.in b/usr.bin/file2c/tests/regress.in
new file mode 100644
index 0000000..405465a
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.in
Binary files differ
diff --git a/usr.bin/file2c/tests/regress.sh b/usr.bin/file2c/tests/regress.sh
new file mode 100644
index 0000000..c8146e7
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.sh
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+echo 1..9
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`1', `head -c 13 ${SRCDIR}/regress.in | file2c')
+REGRESSION_TEST(`2', `head -c 26 ${SRCDIR}/regress.in | file2c PREFIX')
+REGRESSION_TEST(`3', `head -c 39 ${SRCDIR}/regress.in | file2c PREFIX SUFFIX')
+REGRESSION_TEST(`4', `head -c 52 ${SRCDIR}/regress.in | file2c -x')
+REGRESSION_TEST(`5', `head -c 65 ${SRCDIR}/regress.in | file2c -n -1')
+
+REGRESSION_TEST(`6', `head -c 7 ${SRCDIR}/regress.in | file2c -n 1 P S')
+REGRESSION_TEST(`7', `head -c 14 ${SRCDIR}/regress.in | file2c -n 2 -x "P S"')
+REGRESSION_TEST(`8', `head -c 21 ${SRCDIR}/regress.in | file2c -n 16 P -x S')
+
+REGRESSION_TEST(`9', `file2c "const char data[] = {" ", 0};" <${SRCDIR}/regress.in')
+
+REGRESSION_END()
diff --git a/usr.bin/find/Makefile b/usr.bin/find/Makefile
new file mode 100644
index 0000000..cd10f12
--- /dev/null
+++ b/usr.bin/find/Makefile
@@ -0,0 +1,11 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= find
+SRCS= find.c function.c ls.c main.c misc.c operator.c option.c \
+ getdate.y
+YFLAGS=
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/find/Makefile.depend b/usr.bin/find/Makefile.depend
new file mode 100644
index 0000000..ca0b2f9
--- /dev/null
+++ b/usr.bin/find/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h
new file mode 100644
index 0000000..b2e344a
--- /dev/null
+++ b/usr.bin/find/extern.h
@@ -0,0 +1,124 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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.
+ *
+ * @(#)extern.h 8.3 (Berkeley) 4/16/94
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+
+void brace_subst(char *, char **, char *, size_t);
+PLAN *find_create(char ***);
+int find_execute(PLAN *, char **);
+PLAN *find_formplan(char **);
+PLAN *not_squish(PLAN *);
+PLAN *or_squish(PLAN *);
+PLAN *paren_squish(PLAN *);
+time_t get_date(char *);
+struct stat;
+void printlong(char *, char *, struct stat *);
+int queryuser(char **);
+OPTION *lookup_option(const char *);
+void finish_execplus(void);
+
+creat_f c_Xmin;
+creat_f c_Xtime;
+creat_f c_acl;
+creat_f c_and;
+creat_f c_delete;
+creat_f c_depth;
+creat_f c_empty;
+creat_f c_exec;
+creat_f c_flags;
+creat_f c_follow;
+creat_f c_fstype;
+creat_f c_group;
+creat_f c_ignore_readdir_race;
+creat_f c_inum;
+creat_f c_links;
+creat_f c_ls;
+creat_f c_mXXdepth;
+creat_f c_name;
+creat_f c_newer;
+creat_f c_nogroup;
+creat_f c_nouser;
+creat_f c_perm;
+creat_f c_print;
+creat_f c_regex;
+creat_f c_samefile;
+creat_f c_simple;
+creat_f c_size;
+creat_f c_sparse;
+creat_f c_type;
+creat_f c_user;
+creat_f c_xdev;
+
+exec_f f_Xmin;
+exec_f f_Xtime;
+exec_f f_acl;
+exec_f f_always_true;
+exec_f f_closeparen;
+exec_f f_delete;
+exec_f f_depth;
+exec_f f_empty;
+exec_f f_exec;
+exec_f f_expr;
+exec_f f_false;
+exec_f f_flags;
+exec_f f_fstype;
+exec_f f_group;
+exec_f f_inum;
+exec_f f_links;
+exec_f f_ls;
+exec_f f_name;
+exec_f f_newer;
+exec_f f_nogroup;
+exec_f f_not;
+exec_f f_nouser;
+exec_f f_openparen;
+exec_f f_or;
+exec_f f_path;
+exec_f f_perm;
+exec_f f_print;
+exec_f f_print0;
+exec_f f_prune;
+exec_f f_quit;
+exec_f f_regex;
+exec_f f_size;
+exec_f f_sparse;
+exec_f f_type;
+exec_f f_user;
+
+extern int ftsoptions, ignore_readdir_race, isdeprecated, isdepth, isoutput;
+extern int issort, isxargs;
+extern int mindepth, maxdepth;
+extern int regexp_flags;
+extern int exitstatus;
+extern time_t now;
+extern int dotfd;
+extern FTS *tree;
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
new file mode 100644
index 0000000..a6e4d66
--- /dev/null
+++ b/usr.bin/find/find.1
@@ -0,0 +1,1119 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)find.1 8.7 (Berkeley) 5/9/95
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2014
+.Dt FIND 1
+.Os
+.Sh NAME
+.Nm find
+.Nd walk a file hierarchy
+.Sh SYNOPSIS
+.Nm
+.Op Fl H | Fl L | Fl P
+.Op Fl EXdsx
+.Op Fl f Ar path
+.Ar path ...
+.Op Ar expression
+.Nm
+.Op Fl H | Fl L | Fl P
+.Op Fl EXdsx
+.Fl f Ar path
+.Op Ar path ...
+.Op Ar expression
+.Sh DESCRIPTION
+The
+.Nm
+utility recursively descends the directory tree for each
+.Ar path
+listed, evaluating an
+.Ar expression
+(composed of the
+.Dq primaries
+and
+.Dq operands
+listed below) in terms
+of each file in the tree.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl E
+Interpret regular expressions followed by
+.Ic -regex
+and
+.Ic -iregex
+primaries as extended (modern) regular expressions rather than basic
+regular expressions (BRE's).
+The
+.Xr re_format 7
+manual page fully describes both formats.
+.It Fl H
+Cause the file information and file type (see
+.Xr stat 2 )
+returned for each symbolic link specified on the command line to be
+those of the file referenced by the link, not the link itself.
+If the referenced file does not exist, the file information and type will
+be for the link itself.
+File information of all symbolic links not on
+the command line is that of the link itself.
+.It Fl L
+Cause the file information and file type (see
+.Xr stat 2 )
+returned for each symbolic link to be those of the file referenced by the
+link, not the link itself.
+If the referenced file does not exist, the file information and type will
+be for the link itself.
+.Pp
+This option is equivalent to the deprecated
+.Ic -follow
+primary.
+.It Fl P
+Cause the file information and file type (see
+.Xr stat 2 )
+returned for each symbolic link to be those of the link itself.
+This is the default.
+.It Fl X
+Permit
+.Nm
+to be safely used in conjunction with
+.Xr xargs 1 .
+If a file name contains any of the delimiting characters used by
+.Xr xargs 1 ,
+a diagnostic message is displayed on standard error, and the file
+is skipped.
+The delimiting characters include single
+.Pq Dq Li " ' "
+and double
+.Pq Dq Li " \*q "
+quotes, backslash
+.Pq Dq Li \e ,
+space, tab and newline characters.
+.Pp
+However, you may wish to consider the
+.Fl print0
+primary in conjunction with
+.Dq Nm xargs Fl 0
+as an effective alternative.
+.It Fl d
+Cause
+.Nm
+to perform a depth-first traversal.
+.Pp
+This option is a BSD-specific equivalent of the
+.Ic -depth
+primary specified by
+.St -p1003.1-2001 .
+Refer to its description under
+.Sx PRIMARIES
+for more information.
+.It Fl s
+Cause
+.Nm
+to traverse the file hierarchies in lexicographical order,
+i.e., alphabetical order within each directory.
+Note:
+.Ql find -s
+and
+.Ql "find | sort"
+may give different results.
+.It Fl x
+Prevent
+.Nm
+from descending into directories that have a device number different
+than that of the file from which the descent began.
+.Pp
+This option is equivalent to the deprecated
+.Ic -xdev
+primary.
+.El
+.Sh PRIMARIES
+All primaries which take a numeric argument allow the number to be
+preceded by a plus sign
+.Pq Dq Li +
+or a minus sign
+.Pq Dq Li - .
+A preceding plus sign means
+.Dq more than n ,
+a preceding minus sign means
+.Dq less than n
+and neither means
+.Dq exactly n .
+.Bl -tag -width indent
+.It Ic -Bmin Ar n
+True if the difference between the time of a file's inode creation
+and the time
+.Nm
+was started, rounded up to the next full minute, is
+.Ar n
+minutes.
+.It Ic -Bnewer Ar file
+Same as
+.Ic -newerBm .
+.It Ic -Btime Ar n Ns Op Cm smhdw
+If no units are specified, this primary evaluates to
+true if the difference between the time of a file's inode creation
+and the time
+.Nm
+was started, rounded up to the next full 24-hour period, is
+.Ar n
+24-hour periods.
+.Pp
+If units are specified, this primary evaluates to
+true if the difference between the time of a file's inode creation
+and the time
+.Nm
+was started is exactly
+.Ar n
+units.
+Please refer to the
+.Ic -atime
+primary description for information on supported time units.
+.It Ic -acl
+May be used in conjunction with other primaries to locate
+files with extended ACLs.
+See
+.Xr acl 3
+for more information.
+.It Ic -amin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
+True if the difference between the file last access time and the time
+.Nm
+was started, rounded up to the next full minute, is
+more than
+.Ar n
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
+.It Ic -anewer Ar file
+Same as
+.Ic -neweram .
+.It Ic -atime Ar n Ns Op Cm smhdw
+If no units are specified, this primary evaluates to
+true if the difference between the file last access time and the time
+.Nm
+was started, rounded up to the next full 24-hour period, is
+.Ar n
+24-hour periods.
+.Pp
+If units are specified, this primary evaluates to
+true if the difference between the file last access time and the time
+.Nm
+was started is exactly
+.Ar n
+units.
+Possible time units are as follows:
+.Pp
+.Bl -tag -width indent -compact
+.It Cm s
+second
+.It Cm m
+minute (60 seconds)
+.It Cm h
+hour (60 minutes)
+.It Cm d
+day (24 hours)
+.It Cm w
+week (7 days)
+.El
+.Pp
+Any number of units may be combined in one
+.Ic -atime
+argument, for example,
+.Dq Li "-atime -1h30m" .
+Units are probably only useful when used in conjunction with the
+.Cm +
+or
+.Cm -
+modifier.
+.It Ic -cmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
+True if the difference between the time of last change of file status
+information and the time
+.Nm
+was started, rounded up to the next full minute, is
+more than
+.Ar n
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
+.It Ic -cnewer Ar file
+Same as
+.Ic -newercm .
+.It Ic -ctime Ar n Ns Op Cm smhdw
+If no units are specified, this primary evaluates to
+true if the difference between the time of last change of file status
+information and the time
+.Nm
+was started, rounded up to the next full 24-hour period, is
+.Ar n
+24-hour periods.
+.Pp
+If units are specified, this primary evaluates to
+true if the difference between the time of last change of file status
+information and the time
+.Nm
+was started is exactly
+.Ar n
+units.
+Please refer to the
+.Ic -atime
+primary description for information on supported time units.
+.It Ic -d
+Non-portable, BSD-specific version of
+.Ic depth .
+GNU find implements this as a primary in mistaken emulation of
+.Fx
+.Nm .
+.It Ic -delete
+Delete found files and/or directories.
+Always returns true.
+This executes
+from the current working directory as
+.Nm
+recurses down the tree.
+It will not attempt to delete a filename with a
+.Dq Pa /
+character in its pathname relative to
+.Dq Pa \&.
+for security reasons.
+Depth-first traversal processing is implied by this option.
+The
+.Ic -delete
+primary will fail to delete a directory if it is not empty.
+Following symlinks is incompatible with this option.
+.It Ic -depth
+Always true;
+same as the non-portable
+.Fl d
+option.
+Cause
+.Nm
+to perform a depth-first traversal, i.e., directories
+are visited in post-order and all entries in a directory will be acted
+on before the directory itself.
+By default,
+.Nm
+visits directories in pre-order, i.e., before their contents.
+Note, the default is
+.Em not
+a breadth-first traversal.
+.Pp
+The
+.Ic -depth
+primary
+can be useful when
+.Nm
+is used with
+.Xr cpio 1
+to process files that are contained in directories with unusual permissions.
+It ensures that you have write permission while you are placing files in a
+directory, then sets the directory's permissions as the last thing.
+.It Ic -depth Ar n
+True if the depth of the file relative to the starting point of the traversal
+is
+.Ar n .
+.It Ic -empty
+True if the current file or directory is empty.
+.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&;
+True if the program named
+.Ar utility
+returns a zero value as its exit status.
+Optional
+.Ar arguments
+may be passed to the utility.
+The expression must be terminated by a semicolon
+.Pq Dq Li \&; .
+If you invoke
+.Nm
+from a shell you may need to quote the semicolon if the shell would
+otherwise treat it as a control operator.
+If the string
+.Dq Li {}
+appears anywhere in the utility name or the
+arguments it is replaced by the pathname of the current file.
+.Ar Utility
+will be executed from the directory from which
+.Nm
+was executed.
+.Ar Utility
+and
+.Ar arguments
+are not subject to the further expansion of shell patterns
+and constructs.
+.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} +
+Same as
+.Ic -exec ,
+except that
+.Dq Li {}
+is replaced with as many pathnames as possible for each invocation of
+.Ar utility .
+This behaviour is similar to that of
+.Xr xargs 1 .
+The primary always returns true;
+if at least one invocation of
+.Ar utility
+returns a non-zero exit status,
+.Nm
+will return a non-zero exit status.
+.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&;
+The
+.Ic -execdir
+primary is identical to the
+.Ic -exec
+primary with the exception that
+.Ar utility
+will be executed from the directory that holds
+the current file.
+The filename substituted for
+the string
+.Dq Li {}
+is not qualified.
+.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} +
+Same as
+.Ic -execdir ,
+except that
+.Dq Li {}
+is replaced with as many pathnames as possible for each invocation of
+.Ar utility .
+This behaviour is similar to that of
+.Xr xargs 1 .
+The primary always returns true;
+if at least one invocation of
+.Ar utility
+returns a non-zero exit status,
+.Nm
+will return a non-zero exit status.
+.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
+The flags are specified using symbolic names (see
+.Xr chflags 1 ) .
+Those with the
+.Qq Li no
+prefix (except
+.Qq Li nodump )
+are said to be
+.Ar notflags .
+Flags in
+.Ar flags
+are checked to be set, and flags in
+.Ar notflags
+are checked to be not set.
+Note that this is different from
+.Ic -perm ,
+which only allows the user to specify mode bits that are set.
+.Pp
+If flags are preceded by a dash
+.Pq Dq Li - ,
+this primary evaluates to true
+if at least all of the bits in
+.Ar flags
+and none of the bits in
+.Ar notflags
+are set in the file's flags bits.
+If flags are preceded by a plus
+.Pq Dq Li + ,
+this primary evaluates to true
+if any of the bits in
+.Ar flags
+is set in the file's flags bits,
+or any of the bits in
+.Ar notflags
+is not set in the file's flags bits.
+Otherwise,
+this primary evaluates to true
+if the bits in
+.Ar flags
+exactly match the file's flags bits,
+and none of the
+.Ar flags
+bits match those of
+.Ar notflags .
+.It Ic -fstype Ar type
+True if the file is contained in a file system of type
+.Ar type .
+The
+.Xr lsvfs 1
+command can be used to find out the types of file systems
+that are available on the system.
+In addition, there are two pseudo-types,
+.Dq Li local
+and
+.Dq Li rdonly .
+The former matches any file system physically mounted on the system where
+the
+.Nm
+is being executed and the latter matches any file system which is
+mounted read-only.
+.It Ic -gid Ar gname
+The same thing as
+.Ar -group Ar gname
+for compatibility with GNU find.
+GNU find imposes a restriction that
+.Ar gname
+is numeric, while
+.Nm
+does not.
+.It Ic -group Ar gname
+True if the file belongs to the group
+.Ar gname .
+If
+.Ar gname
+is numeric and there is no such group name, then
+.Ar gname
+is treated as a group ID.
+.It Ic -ignore_readdir_race
+Ignore errors because a file or a directory is deleted
+after reading the name from a directory.
+This option does not affect errors occurring on starting points.
+.It Ic -ilname Ar pattern
+Like
+.Ic -lname ,
+but the match is case insensitive.
+This is a GNU find extension.
+.It Ic -iname Ar pattern
+Like
+.Ic -name ,
+but the match is case insensitive.
+.It Ic -inum Ar n
+True if the file has inode number
+.Ar n .
+.It Ic -ipath Ar pattern
+Like
+.Ic -path ,
+but the match is case insensitive.
+.It Ic -iregex Ar pattern
+Like
+.Ic -regex ,
+but the match is case insensitive.
+.It Ic -iwholename Ar pattern
+The same thing as
+.Ic -ipath ,
+for GNU find compatibility.
+.It Ic -links Ar n
+True if the file has
+.Ar n
+links.
+.It Ic -lname Ar pattern
+Like
+.Ic -name ,
+but the contents of the symbolic link are matched instead of the file
+name.
+Note that this only matches broken symbolic links
+if symbolic links are being followed.
+This is a GNU find extension.
+.It Ic -ls
+This primary always evaluates to true.
+The following information for the current file is written to standard output:
+its inode number, size in 512-byte blocks, file permissions, number of hard
+links, owner, group, size in bytes, last modification time, and pathname.
+If the file is a block or character special file, the device number
+will be displayed instead of the size in bytes.
+If the file is a symbolic link, the pathname of the linked-to file will be
+displayed preceded by
+.Dq Li -> .
+The format is identical to that produced by
+.Bk -words
+.Dq Nm ls Fl dgils .
+.Ek
+.It Ic -maxdepth Ar n
+Always true; descend at most
+.Ar n
+directory levels below the command line arguments.
+If any
+.Ic -maxdepth
+primary is specified, it applies to the entire expression even if it would
+not normally be evaluated.
+.Dq Ic -maxdepth Li 0
+limits the whole search to the command line arguments.
+.It Ic -mindepth Ar n
+Always true; do not apply any tests or actions at levels less than
+.Ar n .
+If any
+.Ic -mindepth
+primary is specified, it applies to the entire expression even if it would
+not normally be evaluated.
+.Dq Ic -mindepth Li 1
+processes all but the command line arguments.
+.It Ic -mmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
+True if the difference between the file last modification time and the time
+.Nm
+was started, rounded up to the next full minute, is
+.Ar n
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
+.It Ic -mnewer Ar file
+Same as
+.Ic -newer .
+.It Ic -mount
+The same thing as
+.Ic -xdev ,
+for GNU find compatibility.
+.It Ic -mtime Ar n Ns Op Cm smhdw
+If no units are specified, this primary evaluates to
+true if the difference between the file last modification time and the time
+.Nm
+was started, rounded up to the next full 24-hour period, is
+.Ar n
+24-hour periods.
+.Pp
+If units are specified, this primary evaluates to
+true if the difference between the file last modification time and the time
+.Nm
+was started is exactly
+.Ar n
+units.
+Please refer to the
+.Ic -atime
+primary description for information on supported time units.
+.It Ic -name Ar pattern
+True if the last component of the pathname being examined matches
+.Ar pattern .
+Special shell pattern matching characters
+.Dq ( Li \&[ ,
+.Dq Li \&] ,
+.Dq Li * ,
+and
+.Dq Li \&? )
+may be used as part of
+.Ar pattern .
+These characters may be matched explicitly by escaping them with a
+backslash
+.Pq Dq Li \e .
+.It Ic -newer Ar file
+True if the current file has a more recent last modification time than
+.Ar file .
+.It Ic -newer Ns Ar X Ns Ar Y Ar file
+True if the current file has a more recent last access time
+.Pq Ar X Ns = Ns Cm a ,
+inode creation time
+.Pq Ar X Ns = Ns Cm B ,
+change time
+.Pq Ar X Ns = Ns Cm c ,
+or modification time
+.Pq Ar X Ns = Ns Cm m
+than the last access time
+.Pq Ar Y Ns = Ns Cm a ,
+inode creation time
+.Pq Ar Y Ns = Ns Cm B ,
+change time
+.Pq Ar Y Ns = Ns Cm c ,
+or modification time
+.Pq Ar Y Ns = Ns Cm m
+of
+.Ar file .
+In addition, if
+.Ar Y Ns = Ns Cm t ,
+then
+.Ar file
+is instead interpreted as a direct date specification of the form
+understood by
+.Xr cvs 1 .
+Note that
+.Ic -newermm
+is equivalent to
+.Ic -newer .
+.It Ic -nogroup
+True if the file belongs to an unknown group.
+.It Ic -noignore_readdir_race
+Turn off the effect of
+.Ic -ignore_readdir_race .
+This is default behaviour.
+.It Ic -noleaf
+This option is for GNU find compatibility.
+In GNU find it disables an optimization not relevant to
+.Nm ,
+so it is ignored.
+.It Ic -nouser
+True if the file belongs to an unknown user.
+.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&;
+The
+.Ic -ok
+primary is identical to the
+.Ic -exec
+primary with the exception that
+.Nm
+requests user affirmation for the execution of the
+.Ar utility
+by printing
+a message to the terminal and reading a response.
+If the response is not affirmative
+.Ql ( y
+in the
+.Dq Li POSIX
+locale),
+the command is not executed and the
+value of the
+.Ic -ok
+expression is false.
+.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&;
+The
+.Ic -okdir
+primary is identical to the
+.Ic -execdir
+primary with the same exception as described for the
+.Ic -ok
+primary.
+.It Ic -path Ar pattern
+True if the pathname being examined matches
+.Ar pattern .
+Special shell pattern matching characters
+.Dq ( Li \&[ ,
+.Dq Li \&] ,
+.Dq Li * ,
+and
+.Dq Li \&? )
+may be used as part of
+.Ar pattern .
+These characters may be matched explicitly by escaping them with a
+backslash
+.Pq Dq Li \e .
+Slashes
+.Pq Dq Li /
+are treated as normal characters and do not have to be
+matched explicitly.
+.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
+The
+.Ar mode
+may be either symbolic (see
+.Xr chmod 1 )
+or an octal number.
+If the
+.Ar mode
+is symbolic, a starting value of zero is assumed and the
+.Ar mode
+sets or clears permissions without regard to the process' file mode
+creation mask.
+If the
+.Ar mode
+is octal, only bits 07777
+.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
+of the file's mode bits participate
+in the comparison.
+If the
+.Ar mode
+is preceded by a dash
+.Pq Dq Li - ,
+this primary evaluates to true
+if at least all of the bits in the
+.Ar mode
+are set in the file's mode bits.
+If the
+.Ar mode
+is preceded by a plus
+.Pq Dq Li + ,
+this primary evaluates to true
+if any of the bits in the
+.Ar mode
+are set in the file's mode bits.
+Otherwise, this primary evaluates to true if
+the bits in the
+.Ar mode
+exactly match the file's mode bits.
+Note, the first character of a symbolic mode may not be a dash
+.Pq Dq Li - .
+.It Ic -print
+This primary always evaluates to true.
+It prints the pathname of the current file to standard output.
+If none of
+.Ic -exec , -ls , -print0 ,
+or
+.Ic -ok
+is specified, the given expression shall be effectively replaced by
+.Cm \&( Ar "given expression" Cm \&) Ic -print .
+.It Ic -print0
+This primary always evaluates to true.
+It prints the pathname of the current file to standard output, followed by an
+.Tn ASCII
+.Dv NUL
+character (character code 0).
+.It Ic -prune
+This primary always evaluates to true.
+It causes
+.Nm
+to not descend into the current file.
+Note, the
+.Ic -prune
+primary has no effect if the
+.Fl d
+option was specified.
+.It Ic -quit
+Causes
+.Nm
+to terminate immediately.
+.It Ic -regex Ar pattern
+True if the whole path of the file matches
+.Ar pattern
+using regular expression.
+To match a file named
+.Dq Pa ./foo/xyzzy ,
+you can use the regular expression
+.Dq Li ".*/[xyz]*"
+or
+.Dq Li ".*/foo/.*" ,
+but not
+.Dq Li xyzzy
+or
+.Dq Li /foo/ .
+.It Ic -samefile Ar name
+True if the file is a hard link to
+.Ar name .
+If the command option
+.Ic -L
+is specified, it is also true if the file is a symbolic link and
+points to
+.Ar name .
+.It Ic -size Ar n Ns Op Cm ckMGTP
+True if the file's size, rounded up, in 512-byte blocks is
+.Ar n .
+If
+.Ar n
+is followed by a
+.Cm c ,
+then the primary is true if the
+file's size is
+.Ar n
+bytes (characters).
+Similarly if
+.Ar n
+is followed by a scale indicator then the file's size is compared to
+.Ar n
+scaled as:
+.Pp
+.Bl -tag -width indent -compact
+.It Cm k
+kilobytes (1024 bytes)
+.It Cm M
+megabytes (1024 kilobytes)
+.It Cm G
+gigabytes (1024 megabytes)
+.It Cm T
+terabytes (1024 gigabytes)
+.It Cm P
+petabytes (1024 terabytes)
+.El
+.It Ic -sparse
+True if the current file is sparse,
+i.e. has fewer blocks allocated than expected based on its size in bytes.
+This might also match files that have been compressed by the filesystem.
+.It Ic -type Ar t
+True if the file is of the specified type.
+Possible file types are as follows:
+.Pp
+.Bl -tag -width indent -compact
+.It Cm b
+block special
+.It Cm c
+character special
+.It Cm d
+directory
+.It Cm f
+regular file
+.It Cm l
+symbolic link
+.It Cm p
+FIFO
+.It Cm s
+socket
+.El
+.It Ic -uid Ar uname
+The same thing as
+.Ar -user Ar uname
+for compatibility with GNU find.
+GNU find imposes a restriction that
+.Ar uname
+is numeric, while
+.Nm
+does not.
+.It Ic -user Ar uname
+True if the file belongs to the user
+.Ar uname .
+If
+.Ar uname
+is numeric and there is no such user name, then
+.Ar uname
+is treated as a user ID.
+.It Ic -wholename Ar pattern
+The same thing as
+.Ic -path ,
+for GNU find compatibility.
+.El
+.Sh OPERATORS
+The primaries may be combined using the following operators.
+The operators are listed in order of decreasing precedence.
+.Pp
+.Bl -tag -width indent -compact
+.It Cm \&( Ar expression Cm \&)
+This evaluates to true if the parenthesized expression evaluates to
+true.
+.Pp
+.It Cm \&! Ar expression
+.It Cm -not Ar expression
+This is the unary
+.Tn NOT
+operator.
+It evaluates to true if the expression is false.
+.Pp
+.It Cm -false
+Always false.
+.It Cm -true
+Always true.
+.Pp
+.It Ar expression Cm -and Ar expression
+.It Ar expression expression
+The
+.Cm -and
+operator is the logical
+.Tn AND
+operator.
+As it is implied by the juxtaposition of two expressions it does not
+have to be specified.
+The expression evaluates to true if both expressions are true.
+The second expression is not evaluated if the first expression is false.
+.Pp
+.It Ar expression Cm -or Ar expression
+The
+.Cm -or
+operator is the logical
+.Tn OR
+operator.
+The expression evaluates to true if either the first or the second expression
+is true.
+The second expression is not evaluated if the first expression is true.
+.El
+.Pp
+All operands and primaries must be separate arguments to
+.Nm .
+Primaries which themselves take arguments expect each argument
+to be a separate argument to
+.Nm .
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
+and
+.Ev LC_TIME
+environment variables affect the execution of the
+.Nm
+utility as described in
+.Xr environ 7 .
+.Sh EXAMPLES
+The following examples are shown as given to the shell:
+.Bl -tag -width indent
+.It Li "find / \e! -name \*q*.c\*q -print"
+Print out a list of all the files whose names do not end in
+.Pa .c .
+.It Li "find / -newer ttt -user wnj -print"
+Print out a list of all the files owned by user
+.Dq wnj
+that are newer
+than the file
+.Pa ttt .
+.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
+Print out a list of all the files which are not both newer than
+.Pa ttt
+and owned by
+.Dq wnj .
+.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
+Print out a list of all the files that are either owned by
+.Dq wnj
+or that are newer than
+.Pa ttt .
+.It Li "find / -newerct '1 minute ago' -print"
+Print out a list of all the files whose inode change time is more
+recent than the current time minus one minute.
+.It Li "find / -type f -exec echo {} \e;"
+Use the
+.Xr echo 1
+command to print out a list of all the files.
+.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +"
+Delete all broken symbolic links in
+.Pa /usr/ports/packages .
+.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
+Find files and directories that are at least seven levels deep
+in the working directory
+.Pa /usr/src .
+.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
+Is not equivalent to the previous example, since
+.Ic -prune
+is not evaluated below level seven.
+.El
+.Sh COMPATIBILITY
+The
+.Ic -follow
+primary is deprecated; the
+.Fl L
+option should be used instead.
+See the
+.Sx STANDARDS
+section below for details.
+.Sh SEE ALSO
+.Xr chflags 1 ,
+.Xr chmod 1 ,
+.Xr cvs 1 ,
+.Xr locate 1 ,
+.Xr lsvfs 1 ,
+.Xr whereis 1 ,
+.Xr which 1 ,
+.Xr xargs 1 ,
+.Xr stat 2 ,
+.Xr acl 3 ,
+.Xr fts 3 ,
+.Xr getgrent 3 ,
+.Xr getpwent 3 ,
+.Xr strmode 3 ,
+.Xr re_format 7 ,
+.Xr symlink 7
+.Sh STANDARDS
+The
+.Nm
+utility syntax is a superset of the syntax specified by the
+.St -p1003.1-2001
+standard.
+.Pp
+All the single character options except
+.Fl H
+and
+.Fl L
+as well as
+.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype ,
+.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin ,
+.Ic -path , -print0 , -regex , -sparse
+and all of the
+.Ic -B*
+birthtime related primaries are extensions to
+.St -p1003.1-2001 .
+.Pp
+Historically, the
+.Fl d , L
+and
+.Fl x
+options were implemented using the primaries
+.Ic -depth , -follow ,
+and
+.Ic -xdev .
+These primaries always evaluated to true.
+As they were really global variables that took effect before the traversal
+began, some legal expressions could have unexpected results.
+An example is the expression
+.Ic -print Cm -o Ic -depth .
+As
+.Ic -print
+always evaluates to true, the standard order of evaluation
+implies that
+.Ic -depth
+would never be evaluated.
+This is not the case.
+.Pp
+The operator
+.Cm -or
+was implemented as
+.Cm -o ,
+and the operator
+.Cm -and
+was implemented as
+.Cm -a .
+.Pp
+Historic implementations of the
+.Ic -exec
+and
+.Ic -ok
+primaries did not replace the string
+.Dq Li {}
+in the utility name or the
+utility arguments if it had preceding or following non-whitespace characters.
+This version replaces it no matter where in the utility name or arguments
+it appears.
+.Pp
+The
+.Fl E
+option was inspired by the equivalent
+.Xr grep 1
+and
+.Xr sed 1
+options.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
+.Sh BUGS
+The special characters used by
+.Nm
+are also special characters to many shell programs.
+In particular, the characters
+.Dq Li * ,
+.Dq Li \&[ ,
+.Dq Li \&] ,
+.Dq Li \&? ,
+.Dq Li \&( ,
+.Dq Li \&) ,
+.Dq Li \&! ,
+.Dq Li \e
+and
+.Dq Li \&;
+may have to be escaped from the shell.
+.Pp
+As there is no delimiter separating options and file names or file
+names and the
+.Ar expression ,
+it is difficult to specify files named
+.Pa -xdev
+or
+.Pa \&! .
+These problems are handled by the
+.Fl f
+option and the
+.Xr getopt 3
+.Dq Fl Fl
+construct.
+.Pp
+The
+.Ic -delete
+primary does not interact well with other options that cause the file system
+tree traversal options to be changed.
+.Pp
+The
+.Ic -mindepth
+and
+.Ic -maxdepth
+primaries are actually global options (as documented above).
+They should
+probably be replaced by options which look like options.
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
new file mode 100644
index 0000000..3e5d56b
--- /dev/null
+++ b/usr.bin/find/find.c
@@ -0,0 +1,240 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94";
+#else
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fts.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "find.h"
+
+static int find_compare(const FTSENT * const *s1, const FTSENT * const *s2);
+
+/*
+ * find_compare --
+ * tell fts_open() how to order the traversal of the hierarchy.
+ * This variant gives lexicographical order, i.e., alphabetical
+ * order within each directory.
+ */
+static int
+find_compare(const FTSENT * const *s1, const FTSENT * const *s2)
+{
+
+ return (strcoll((*s1)->fts_name, (*s2)->fts_name));
+}
+
+/*
+ * find_formplan --
+ * process the command line and create a "plan" corresponding to the
+ * command arguments.
+ */
+PLAN *
+find_formplan(char *argv[])
+{
+ PLAN *plan, *tail, *new;
+
+ /*
+ * for each argument in the command line, determine what kind of node
+ * it is, create the appropriate node type and add the new plan node
+ * to the end of the existing plan. The resulting plan is a linked
+ * list of plan nodes. For example, the string:
+ *
+ * % find . -name foo -newer bar -print
+ *
+ * results in the plan:
+ *
+ * [-name foo]--> [-newer bar]--> [-print]
+ *
+ * in this diagram, `[-name foo]' represents the plan node generated
+ * by c_name() with an argument of foo and `-->' represents the
+ * plan->next pointer.
+ */
+ for (plan = tail = NULL; *argv;) {
+ if (!(new = find_create(&argv)))
+ continue;
+ if (plan == NULL)
+ tail = plan = new;
+ else {
+ tail->next = new;
+ tail = new;
+ }
+ }
+
+ /*
+ * if the user didn't specify one of -print, -ok or -exec, then -print
+ * is assumed so we bracket the current expression with parens, if
+ * necessary, and add a -print node on the end.
+ */
+ if (!isoutput) {
+ OPTION *p;
+ char **argv1 = 0;
+
+ if (plan == NULL) {
+ p = lookup_option("-print");
+ new = (p->create)(p, &argv1);
+ tail = plan = new;
+ } else {
+ p = lookup_option("(");
+ new = (p->create)(p, &argv1);
+ new->next = plan;
+ plan = new;
+ p = lookup_option(")");
+ new = (p->create)(p, &argv1);
+ tail->next = new;
+ tail = new;
+ p = lookup_option("-print");
+ new = (p->create)(p, &argv1);
+ tail->next = new;
+ tail = new;
+ }
+ }
+
+ /*
+ * the command line has been completely processed into a search plan
+ * except for the (, ), !, and -o operators. Rearrange the plan so
+ * that the portions of the plan which are affected by the operators
+ * are moved into operator nodes themselves. For example:
+ *
+ * [!]--> [-name foo]--> [-print]
+ *
+ * becomes
+ *
+ * [! [-name foo] ]--> [-print]
+ *
+ * and
+ *
+ * [(]--> [-depth]--> [-name foo]--> [)]--> [-print]
+ *
+ * becomes
+ *
+ * [expr [-depth]-->[-name foo] ]--> [-print]
+ *
+ * operators are handled in order of precedence.
+ */
+
+ plan = paren_squish(plan); /* ()'s */
+ plan = not_squish(plan); /* !'s */
+ plan = or_squish(plan); /* -o's */
+ return (plan);
+}
+
+FTS *tree; /* pointer to top of FTS hierarchy */
+
+/*
+ * find_execute --
+ * take a search plan and an array of search paths and executes the plan
+ * over all FTSENT's returned for the given search paths.
+ */
+int
+find_execute(PLAN *plan, char *paths[])
+{
+ FTSENT *entry;
+ PLAN *p;
+ int e;
+
+ tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL));
+ if (tree == NULL)
+ err(1, "ftsopen");
+
+ exitstatus = 0;
+ while (errno = 0, (entry = fts_read(tree)) != NULL) {
+ if (maxdepth != -1 && entry->fts_level >= maxdepth) {
+ if (fts_set(tree, entry, FTS_SKIP))
+ err(1, "%s", entry->fts_path);
+ }
+
+ switch (entry->fts_info) {
+ case FTS_D:
+ if (isdepth)
+ continue;
+ break;
+ case FTS_DP:
+ if (!isdepth)
+ continue;
+ break;
+ case FTS_DNR:
+ case FTS_NS:
+ if (ignore_readdir_race &&
+ entry->fts_errno == ENOENT && entry->fts_level > 0)
+ continue;
+ /* FALLTHROUGH */
+ case FTS_ERR:
+ (void)fflush(stdout);
+ warnx("%s: %s",
+ entry->fts_path, strerror(entry->fts_errno));
+ exitstatus = 1;
+ continue;
+#ifdef FTS_W
+ case FTS_W:
+ continue;
+#endif /* FTS_W */
+ }
+#define BADCH " \t\n\\'\""
+ if (isxargs && strpbrk(entry->fts_path, BADCH)) {
+ (void)fflush(stdout);
+ warnx("%s: illegal path", entry->fts_path);
+ exitstatus = 1;
+ continue;
+ }
+
+ if (mindepth != -1 && entry->fts_level < mindepth)
+ continue;
+
+ /*
+ * Call all the functions in the execution plan until one is
+ * false or all have been executed. This is where we do all
+ * the work specified by the user on the command line.
+ */
+ for (p = plan; p && (p->execute)(p, entry); p = p->next);
+ }
+ e = errno;
+ finish_execplus();
+ if (e && (!ignore_readdir_race || e != ENOENT))
+ errc(1, e, "fts_read");
+ return (exitstatus);
+}
diff --git a/usr.bin/find/find.h b/usr.bin/find/find.h
new file mode 100644
index 0000000..53cb69f
--- /dev/null
+++ b/usr.bin/find/find.h
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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.
+ *
+ * @(#)find.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <regex.h>
+
+/* forward declarations */
+struct _plandata;
+struct _option;
+
+/* execute function */
+typedef int exec_f(struct _plandata *, FTSENT *);
+/* create function */
+typedef struct _plandata *creat_f(struct _option *, char ***);
+
+/* function modifiers */
+#define F_NEEDOK 0x00000001 /* -ok vs. -exec */
+#define F_EXECDIR 0x00000002 /* -execdir vs. -exec */
+#define F_TIME_A 0x00000004 /* one of -atime, -anewer, -newera* */
+#define F_TIME_C 0x00000008 /* one of -ctime, -cnewer, -newerc* */
+#define F_TIME2_A 0x00000010 /* one of -newer?a */
+#define F_TIME2_C 0x00000020 /* one of -newer?c */
+#define F_TIME2_T 0x00000040 /* one of -newer?t */
+#define F_MAXDEPTH F_TIME_A /* maxdepth vs. mindepth */
+#define F_DEPTH F_TIME_A /* -depth n vs. -d */
+/* command line function modifiers */
+#define F_EQUAL 0x00000000 /* [acm]min [acm]time inum links size */
+#define F_LESSTHAN 0x00000100
+#define F_GREATER 0x00000200
+#define F_ELG_MASK 0x00000300
+#define F_ATLEAST 0x00000400 /* flags perm */
+#define F_ANY 0x00000800 /* perm */
+#define F_MTMASK 0x00003000
+#define F_MTFLAG 0x00000000 /* fstype */
+#define F_MTTYPE 0x00001000
+#define F_MTUNKNOWN 0x00002000
+#define F_IGNCASE 0x00010000 /* iname ipath iregex */
+#define F_EXACTTIME F_IGNCASE /* -[acm]time units syntax */
+#define F_EXECPLUS 0x00020000 /* -exec ... {} + */
+#define F_TIME_B 0x00040000 /* one of -Btime, -Bnewer, -newerB* */
+#define F_TIME2_B 0x00080000 /* one of -newer?B */
+#define F_LINK 0x00100000 /* lname or ilname */
+
+/* node definition */
+typedef struct _plandata {
+ struct _plandata *next; /* next node */
+ exec_f *execute; /* node evaluation function */
+ int flags; /* private flags */
+ union {
+ gid_t _g_data; /* gid */
+ ino_t _i_data; /* inode */
+ mode_t _m_data; /* mode mask */
+ struct {
+ u_long _f_flags;
+ u_long _f_notflags;
+ } fl;
+ nlink_t _l_data; /* link count */
+ short _d_data; /* level depth (-1 to N) */
+ off_t _o_data; /* file size */
+ struct timespec _t_data; /* time value */
+ uid_t _u_data; /* uid */
+ short _mt_data; /* mount flags */
+ struct _plandata *_p_data[2]; /* PLAN trees */
+ struct _ex {
+ char **_e_argv; /* argv array */
+ char **_e_orig; /* original strings */
+ int *_e_len; /* allocated length */
+ int _e_pbnum; /* base num. of args. used */
+ int _e_ppos; /* number of arguments used */
+ int _e_pnummax; /* max. number of arguments */
+ int _e_psize; /* number of bytes of args. */
+ int _e_pbsize; /* base num. of bytes of args */
+ int _e_psizemax; /* max num. of bytes of args */
+ struct _plandata *_e_next;/* next F_EXECPLUS in tree */
+ } ex;
+ char *_a_data[2]; /* array of char pointers */
+ char *_c_data; /* char pointer */
+ regex_t *_re_data; /* regex */
+ } p_un;
+} PLAN;
+#define a_data p_un._a_data
+#define c_data p_un._c_data
+#define d_data p_un._d_data
+#define fl_flags p_un.fl._f_flags
+#define fl_notflags p_un.fl._f_notflags
+#define g_data p_un._g_data
+#define i_data p_un._i_data
+#define l_data p_un._l_data
+#define m_data p_un._m_data
+#define mt_data p_un._mt_data
+#define o_data p_un._o_data
+#define p_data p_un._p_data
+#define t_data p_un._t_data
+#define u_data p_un._u_data
+#define re_data p_un._re_data
+#define e_argv p_un.ex._e_argv
+#define e_orig p_un.ex._e_orig
+#define e_len p_un.ex._e_len
+#define e_pbnum p_un.ex._e_pbnum
+#define e_ppos p_un.ex._e_ppos
+#define e_pnummax p_un.ex._e_pnummax
+#define e_psize p_un.ex._e_psize
+#define e_pbsize p_un.ex._e_pbsize
+#define e_psizemax p_un.ex._e_psizemax
+#define e_next p_un.ex._e_next
+
+typedef struct _option {
+ const char *name; /* option name */
+ creat_f *create; /* create function */
+ exec_f *execute; /* execute function */
+ int flags;
+} OPTION;
+
+#include "extern.h"
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
new file mode 100644
index 0000000..d6466a6
--- /dev/null
+++ b/usr.bin/find/function.c
@@ -0,0 +1,1786 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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
+#if 0
+static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/acl.h>
+#include <sys/wait.h>
+#include <sys/mount.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fnmatch.h>
+#include <fts.h>
+#include <grp.h>
+#include <limits.h>
+#include <pwd.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include "find.h"
+
+static PLAN *palloc(OPTION *);
+static long long find_parsenum(PLAN *, const char *, char *, char *);
+static long long find_parsetime(PLAN *, const char *, char *);
+static char *nextarg(OPTION *, char ***);
+
+extern char **environ;
+
+static PLAN *lastexecplus = NULL;
+
+#define COMPARE(a, b) do { \
+ switch (plan->flags & F_ELG_MASK) { \
+ case F_EQUAL: \
+ return (a == b); \
+ case F_LESSTHAN: \
+ return (a < b); \
+ case F_GREATER: \
+ return (a > b); \
+ default: \
+ abort(); \
+ } \
+} while(0)
+
+static PLAN *
+palloc(OPTION *option)
+{
+ PLAN *new;
+
+ if ((new = malloc(sizeof(PLAN))) == NULL)
+ err(1, NULL);
+ new->execute = option->execute;
+ new->flags = option->flags;
+ new->next = NULL;
+ return new;
+}
+
+/*
+ * find_parsenum --
+ * Parse a string of the form [+-]# and return the value.
+ */
+static long long
+find_parsenum(PLAN *plan, const char *option, char *vp, char *endch)
+{
+ long long value;
+ char *endchar, *str; /* Pointer to character ending conversion. */
+
+ /* Determine comparison from leading + or -. */
+ str = vp;
+ switch (*str) {
+ case '+':
+ ++str;
+ plan->flags |= F_GREATER;
+ break;
+ case '-':
+ ++str;
+ plan->flags |= F_LESSTHAN;
+ break;
+ default:
+ plan->flags |= F_EQUAL;
+ break;
+ }
+
+ /*
+ * Convert the string with strtoq(). Note, if strtoq() returns zero
+ * and endchar points to the beginning of the string we know we have
+ * a syntax error.
+ */
+ value = strtoq(str, &endchar, 10);
+ if (value == 0 && endchar == str)
+ errx(1, "%s: %s: illegal numeric value", option, vp);
+ if (endchar[0] && endch == NULL)
+ errx(1, "%s: %s: illegal trailing character", option, vp);
+ if (endch)
+ *endch = endchar[0];
+ return value;
+}
+
+/*
+ * find_parsetime --
+ * Parse a string of the form [+-]([0-9]+[smhdw]?)+ and return the value.
+ */
+static long long
+find_parsetime(PLAN *plan, const char *option, char *vp)
+{
+ long long secs, value;
+ char *str, *unit; /* Pointer to character ending conversion. */
+
+ /* Determine comparison from leading + or -. */
+ str = vp;
+ switch (*str) {
+ case '+':
+ ++str;
+ plan->flags |= F_GREATER;
+ break;
+ case '-':
+ ++str;
+ plan->flags |= F_LESSTHAN;
+ break;
+ default:
+ plan->flags |= F_EQUAL;
+ break;
+ }
+
+ value = strtoq(str, &unit, 10);
+ if (value == 0 && unit == str) {
+ errx(1, "%s: %s: illegal time value", option, vp);
+ /* NOTREACHED */
+ }
+ if (*unit == '\0')
+ return value;
+
+ /* Units syntax. */
+ secs = 0;
+ for (;;) {
+ switch(*unit) {
+ case 's': /* seconds */
+ secs += value;
+ break;
+ case 'm': /* minutes */
+ secs += value * 60;
+ break;
+ case 'h': /* hours */
+ secs += value * 3600;
+ break;
+ case 'd': /* days */
+ secs += value * 86400;
+ break;
+ case 'w': /* weeks */
+ secs += value * 604800;
+ break;
+ default:
+ errx(1, "%s: %s: bad unit '%c'", option, vp, *unit);
+ /* NOTREACHED */
+ }
+ str = unit + 1;
+ if (*str == '\0') /* EOS */
+ break;
+ value = strtoq(str, &unit, 10);
+ if (value == 0 && unit == str) {
+ errx(1, "%s: %s: illegal time value", option, vp);
+ /* NOTREACHED */
+ }
+ if (*unit == '\0') {
+ errx(1, "%s: %s: missing trailing unit", option, vp);
+ /* NOTREACHED */
+ }
+ }
+ plan->flags |= F_EXACTTIME;
+ return secs;
+}
+
+/*
+ * nextarg --
+ * Check that another argument still exists, return a pointer to it,
+ * and increment the argument vector pointer.
+ */
+static char *
+nextarg(OPTION *option, char ***argvp)
+{
+ char *arg;
+
+ if ((arg = **argvp) == NULL)
+ errx(1, "%s: requires additional arguments", option->name);
+ (*argvp)++;
+ return arg;
+} /* nextarg() */
+
+/*
+ * The value of n for the inode times (atime, birthtime, ctime, mtime) is a
+ * range, i.e. n matches from (n - 1) to n 24 hour periods. This interacts
+ * with -n, such that "-mtime -1" would be less than 0 days, which isn't what
+ * the user wanted. Correct so that -1 is "less than 1".
+ */
+#define TIME_CORRECT(p) \
+ if (((p)->flags & F_ELG_MASK) == F_LESSTHAN) \
+ ++((p)->t_data.tv_sec);
+
+/*
+ * -[acm]min n functions --
+ *
+ * True if the difference between the
+ * file access time (-amin)
+ * file birth time (-Bmin)
+ * last change of file status information (-cmin)
+ * file modification time (-mmin)
+ * and the current time is n min periods.
+ */
+int
+f_Xmin(PLAN *plan, FTSENT *entry)
+{
+ if (plan->flags & F_TIME_C) {
+ COMPARE((now - entry->fts_statp->st_ctime +
+ 60 - 1) / 60, plan->t_data.tv_sec);
+ } else if (plan->flags & F_TIME_A) {
+ COMPARE((now - entry->fts_statp->st_atime +
+ 60 - 1) / 60, plan->t_data.tv_sec);
+ } else if (plan->flags & F_TIME_B) {
+ COMPARE((now - entry->fts_statp->st_birthtime +
+ 60 - 1) / 60, plan->t_data.tv_sec);
+ } else {
+ COMPARE((now - entry->fts_statp->st_mtime +
+ 60 - 1) / 60, plan->t_data.tv_sec);
+ }
+}
+
+PLAN *
+c_Xmin(OPTION *option, char ***argvp)
+{
+ char *nmins;
+ PLAN *new;
+
+ nmins = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ new->t_data.tv_sec = find_parsenum(new, option->name, nmins, NULL);
+ new->t_data.tv_nsec = 0;
+ TIME_CORRECT(new);
+ return new;
+}
+
+/*
+ * -[acm]time n functions --
+ *
+ * True if the difference between the
+ * file access time (-atime)
+ * file birth time (-Btime)
+ * last change of file status information (-ctime)
+ * file modification time (-mtime)
+ * and the current time is n 24 hour periods.
+ */
+
+int
+f_Xtime(PLAN *plan, FTSENT *entry)
+{
+ time_t xtime;
+
+ if (plan->flags & F_TIME_A)
+ xtime = entry->fts_statp->st_atime;
+ else if (plan->flags & F_TIME_B)
+ xtime = entry->fts_statp->st_birthtime;
+ else if (plan->flags & F_TIME_C)
+ xtime = entry->fts_statp->st_ctime;
+ else
+ xtime = entry->fts_statp->st_mtime;
+
+ if (plan->flags & F_EXACTTIME)
+ COMPARE(now - xtime, plan->t_data.tv_sec);
+ else
+ COMPARE((now - xtime + 86400 - 1) / 86400, plan->t_data.tv_sec);
+}
+
+PLAN *
+c_Xtime(OPTION *option, char ***argvp)
+{
+ char *value;
+ PLAN *new;
+
+ value = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ new->t_data.tv_sec = find_parsetime(new, option->name, value);
+ new->t_data.tv_nsec = 0;
+ if (!(new->flags & F_EXACTTIME))
+ TIME_CORRECT(new);
+ return new;
+}
+
+/*
+ * -maxdepth/-mindepth n functions --
+ *
+ * Does the same as -prune if the level of the current file is
+ * greater/less than the specified maximum/minimum depth.
+ *
+ * Note that -maxdepth and -mindepth are handled specially in
+ * find_execute() so their f_* functions are set to f_always_true().
+ */
+PLAN *
+c_mXXdepth(OPTION *option, char ***argvp)
+{
+ char *dstr;
+ PLAN *new;
+
+ dstr = nextarg(option, argvp);
+ if (dstr[0] == '-')
+ /* all other errors handled by find_parsenum() */
+ errx(1, "%s: %s: value must be positive", option->name, dstr);
+
+ new = palloc(option);
+ if (option->flags & F_MAXDEPTH)
+ maxdepth = find_parsenum(new, option->name, dstr, NULL);
+ else
+ mindepth = find_parsenum(new, option->name, dstr, NULL);
+ return new;
+}
+
+/*
+ * -acl function --
+ *
+ * Show files with EXTENDED ACL attributes.
+ */
+int
+f_acl(PLAN *plan __unused, FTSENT *entry)
+{
+ acl_t facl;
+ acl_type_t acl_type;
+ int acl_supported = 0, ret, trivial;
+
+ if (S_ISLNK(entry->fts_statp->st_mode))
+ return 0;
+ ret = pathconf(entry->fts_accpath, _PC_ACL_NFS4);
+ if (ret > 0) {
+ acl_supported = 1;
+ acl_type = ACL_TYPE_NFS4;
+ } else if (ret < 0 && errno != EINVAL) {
+ warn("%s", entry->fts_accpath);
+ return (0);
+ }
+ if (acl_supported == 0) {
+ ret = pathconf(entry->fts_accpath, _PC_ACL_EXTENDED);
+ if (ret > 0) {
+ acl_supported = 1;
+ acl_type = ACL_TYPE_ACCESS;
+ } else if (ret < 0 && errno != EINVAL) {
+ warn("%s", entry->fts_accpath);
+ return (0);
+ }
+ }
+ if (acl_supported == 0)
+ return (0);
+
+ facl = acl_get_file(entry->fts_accpath, acl_type);
+ if (facl == NULL) {
+ warn("%s", entry->fts_accpath);
+ return (0);
+ }
+ ret = acl_is_trivial_np(facl, &trivial);
+ acl_free(facl);
+ if (ret) {
+ warn("%s", entry->fts_accpath);
+ return (0);
+ }
+ if (trivial)
+ return (0);
+ return (1);
+}
+
+PLAN *
+c_acl(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+ return (palloc(option));
+}
+
+/*
+ * -delete functions --
+ *
+ * True always. Makes its best shot and continues on regardless.
+ */
+int
+f_delete(PLAN *plan __unused, FTSENT *entry)
+{
+ /* ignore these from fts */
+ if (strcmp(entry->fts_accpath, ".") == 0 ||
+ strcmp(entry->fts_accpath, "..") == 0)
+ return 1;
+
+ /* sanity check */
+ if (isdepth == 0 || /* depth off */
+ (ftsoptions & FTS_NOSTAT)) /* not stat()ing */
+ errx(1, "-delete: insecure options got turned on");
+
+ if (!(ftsoptions & FTS_PHYSICAL) || /* physical off */
+ (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */
+ errx(1, "-delete: forbidden when symlinks are followed");
+
+ /* Potentially unsafe - do not accept relative paths whatsoever */
+ if (entry->fts_level > FTS_ROOTLEVEL &&
+ strchr(entry->fts_accpath, '/') != NULL)
+ errx(1, "-delete: %s: relative path potentially not safe",
+ entry->fts_accpath);
+
+ /* Turn off user immutable bits if running as root */
+ if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
+ !(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
+ geteuid() == 0)
+ lchflags(entry->fts_accpath,
+ entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
+
+ /* rmdir directories, unlink everything else */
+ if (S_ISDIR(entry->fts_statp->st_mode)) {
+ if (rmdir(entry->fts_accpath) < 0 && errno != ENOTEMPTY)
+ warn("-delete: rmdir(%s)", entry->fts_path);
+ } else {
+ if (unlink(entry->fts_accpath) < 0)
+ warn("-delete: unlink(%s)", entry->fts_path);
+ }
+
+ /* "succeed" */
+ return 1;
+}
+
+PLAN *
+c_delete(OPTION *option, char ***argvp __unused)
+{
+
+ ftsoptions &= ~FTS_NOSTAT; /* no optimise */
+ isoutput = 1; /* possible output */
+ isdepth = 1; /* -depth implied */
+
+ /*
+ * Try to avoid the confusing error message about relative paths
+ * being potentially not safe.
+ */
+ if (ftsoptions & FTS_NOCHDIR)
+ errx(1, "%s: forbidden when the current directory cannot be opened",
+ "-delete");
+
+ return palloc(option);
+}
+
+
+/*
+ * always_true --
+ *
+ * Always true, used for -maxdepth, -mindepth, -xdev, -follow, and -true
+ */
+int
+f_always_true(PLAN *plan __unused, FTSENT *entry __unused)
+{
+ return 1;
+}
+
+/*
+ * -depth functions --
+ *
+ * With argument: True if the file is at level n.
+ * Without argument: Always true, causes descent of the directory hierarchy
+ * to be done so that all entries in a directory are acted on before the
+ * directory itself.
+ */
+int
+f_depth(PLAN *plan, FTSENT *entry)
+{
+ if (plan->flags & F_DEPTH)
+ COMPARE(entry->fts_level, plan->d_data);
+ else
+ return 1;
+}
+
+PLAN *
+c_depth(OPTION *option, char ***argvp)
+{
+ PLAN *new;
+ char *str;
+
+ new = palloc(option);
+
+ str = **argvp;
+ if (str && !(new->flags & F_DEPTH)) {
+ /* skip leading + or - */
+ if (*str == '+' || *str == '-')
+ str++;
+ /* skip sign */
+ if (*str == '+' || *str == '-')
+ str++;
+ if (isdigit(*str))
+ new->flags |= F_DEPTH;
+ }
+
+ if (new->flags & F_DEPTH) { /* -depth n */
+ char *ndepth;
+
+ ndepth = nextarg(option, argvp);
+ new->d_data = find_parsenum(new, option->name, ndepth, NULL);
+ } else { /* -d */
+ isdepth = 1;
+ }
+
+ return new;
+}
+
+/*
+ * -empty functions --
+ *
+ * True if the file or directory is empty
+ */
+int
+f_empty(PLAN *plan __unused, FTSENT *entry)
+{
+ if (S_ISREG(entry->fts_statp->st_mode) &&
+ entry->fts_statp->st_size == 0)
+ return 1;
+ if (S_ISDIR(entry->fts_statp->st_mode)) {
+ struct dirent *dp;
+ int empty;
+ DIR *dir;
+
+ empty = 1;
+ dir = opendir(entry->fts_accpath);
+ if (dir == NULL)
+ return 0;
+ for (dp = readdir(dir); dp; dp = readdir(dir))
+ if (dp->d_name[0] != '.' ||
+ (dp->d_name[1] != '\0' &&
+ (dp->d_name[1] != '.' || dp->d_name[2] != '\0'))) {
+ empty = 0;
+ break;
+ }
+ closedir(dir);
+ return empty;
+ }
+ return 0;
+}
+
+PLAN *
+c_empty(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+
+ return palloc(option);
+}
+
+/*
+ * [-exec | -execdir | -ok] utility [arg ... ] ; functions --
+ *
+ * True if the executed utility returns a zero value as exit status.
+ * The end of the primary expression is delimited by a semicolon. If
+ * "{}" occurs anywhere, it gets replaced by the current pathname,
+ * or, in the case of -execdir, the current basename (filename
+ * without leading directory prefix). For -exec and -ok,
+ * the current directory for the execution of utility is the same as
+ * the current directory when the find utility was started, whereas
+ * for -execdir, it is the directory the file resides in.
+ *
+ * The primary -ok differs from -exec in that it requests affirmation
+ * of the user before executing the utility.
+ */
+int
+f_exec(PLAN *plan, FTSENT *entry)
+{
+ int cnt;
+ pid_t pid;
+ int status;
+ char *file;
+
+ if (entry == NULL && plan->flags & F_EXECPLUS) {
+ if (plan->e_ppos == plan->e_pbnum)
+ return (1);
+ plan->e_argv[plan->e_ppos] = NULL;
+ goto doexec;
+ }
+
+ /* XXX - if file/dir ends in '/' this will not work -- can it? */
+ if ((plan->flags & F_EXECDIR) && \
+ (file = strrchr(entry->fts_path, '/')))
+ file++;
+ else
+ file = entry->fts_path;
+
+ if (plan->flags & F_EXECPLUS) {
+ if ((plan->e_argv[plan->e_ppos] = strdup(file)) == NULL)
+ err(1, NULL);
+ plan->e_len[plan->e_ppos] = strlen(file);
+ plan->e_psize += plan->e_len[plan->e_ppos];
+ if (++plan->e_ppos < plan->e_pnummax &&
+ plan->e_psize < plan->e_psizemax)
+ return (1);
+ plan->e_argv[plan->e_ppos] = NULL;
+ } else {
+ for (cnt = 0; plan->e_argv[cnt]; ++cnt)
+ if (plan->e_len[cnt])
+ brace_subst(plan->e_orig[cnt],
+ &plan->e_argv[cnt], file,
+ plan->e_len[cnt]);
+ }
+
+doexec: if ((plan->flags & F_NEEDOK) && !queryuser(plan->e_argv))
+ return 0;
+
+ /* make sure find output is interspersed correctly with subprocesses */
+ fflush(stdout);
+ fflush(stderr);
+
+ switch (pid = fork()) {
+ case -1:
+ err(1, "fork");
+ /* NOTREACHED */
+ case 0:
+ /* change dir back from where we started */
+ if (!(plan->flags & F_EXECDIR) &&
+ !(ftsoptions & FTS_NOCHDIR) && fchdir(dotfd)) {
+ warn("chdir");
+ _exit(1);
+ }
+ execvp(plan->e_argv[0], plan->e_argv);
+ warn("%s", plan->e_argv[0]);
+ _exit(1);
+ }
+ if (plan->flags & F_EXECPLUS) {
+ while (--plan->e_ppos >= plan->e_pbnum)
+ free(plan->e_argv[plan->e_ppos]);
+ plan->e_ppos = plan->e_pbnum;
+ plan->e_psize = plan->e_pbsize;
+ }
+ pid = waitpid(pid, &status, 0);
+ if (pid != -1 && WIFEXITED(status) && !WEXITSTATUS(status))
+ return (1);
+ if (plan->flags & F_EXECPLUS) {
+ exitstatus = 1;
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * c_exec, c_execdir, c_ok --
+ * build three parallel arrays, one with pointers to the strings passed
+ * on the command line, one with (possibly duplicated) pointers to the
+ * argv array, and one with integer values that are lengths of the
+ * strings, but also flags meaning that the string has to be massaged.
+ */
+PLAN *
+c_exec(OPTION *option, char ***argvp)
+{
+ PLAN *new; /* node returned */
+ long argmax;
+ int cnt, i;
+ char **argv, **ap, **ep, *p;
+
+ /* This would defeat -execdir's intended security. */
+ if (option->flags & F_EXECDIR && ftsoptions & FTS_NOCHDIR)
+ errx(1, "%s: forbidden when the current directory cannot be opened",
+ "-execdir");
+
+ /* XXX - was in c_execdir, but seems unnecessary!?
+ ftsoptions &= ~FTS_NOSTAT;
+ */
+ isoutput = 1;
+
+ /* XXX - this is a change from the previous coding */
+ new = palloc(option);
+
+ for (ap = argv = *argvp;; ++ap) {
+ if (!*ap)
+ errx(1,
+ "%s: no terminating \";\" or \"+\"", option->name);
+ if (**ap == ';')
+ break;
+ if (**ap == '+' && ap != argv && strcmp(*(ap - 1), "{}") == 0) {
+ new->flags |= F_EXECPLUS;
+ break;
+ }
+ }
+
+ if (ap == argv)
+ errx(1, "%s: no command specified", option->name);
+
+ cnt = ap - *argvp + 1;
+ if (new->flags & F_EXECPLUS) {
+ new->e_ppos = new->e_pbnum = cnt - 2;
+ if ((argmax = sysconf(_SC_ARG_MAX)) == -1) {
+ warn("sysconf(_SC_ARG_MAX)");
+ argmax = _POSIX_ARG_MAX;
+ }
+ argmax -= 1024;
+ for (ep = environ; *ep != NULL; ep++)
+ argmax -= strlen(*ep) + 1 + sizeof(*ep);
+ argmax -= 1 + sizeof(*ep);
+ /*
+ * Ensure that -execdir ... {} + does not mix files
+ * from different directories in one invocation.
+ * Files from the same directory should be handled
+ * in one invocation but there is no code for it.
+ */
+ new->e_pnummax = new->flags & F_EXECDIR ? 1 : argmax / 16;
+ argmax -= sizeof(char *) * new->e_pnummax;
+ if (argmax <= 0)
+ errx(1, "no space for arguments");
+ new->e_psizemax = argmax;
+ new->e_pbsize = 0;
+ cnt += new->e_pnummax + 1;
+ new->e_next = lastexecplus;
+ lastexecplus = new;
+ }
+ if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
+ err(1, NULL);
+ if ((new->e_orig = malloc(cnt * sizeof(char *))) == NULL)
+ err(1, NULL);
+ if ((new->e_len = malloc(cnt * sizeof(int))) == NULL)
+ err(1, NULL);
+
+ for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
+ new->e_orig[cnt] = *argv;
+ if (new->flags & F_EXECPLUS)
+ new->e_pbsize += strlen(*argv) + 1;
+ for (p = *argv; *p; ++p)
+ if (!(new->flags & F_EXECPLUS) && p[0] == '{' &&
+ p[1] == '}') {
+ if ((new->e_argv[cnt] =
+ malloc(MAXPATHLEN)) == NULL)
+ err(1, NULL);
+ new->e_len[cnt] = MAXPATHLEN;
+ break;
+ }
+ if (!*p) {
+ new->e_argv[cnt] = *argv;
+ new->e_len[cnt] = 0;
+ }
+ }
+ if (new->flags & F_EXECPLUS) {
+ new->e_psize = new->e_pbsize;
+ cnt--;
+ for (i = 0; i < new->e_pnummax; i++) {
+ new->e_argv[cnt] = NULL;
+ new->e_len[cnt] = 0;
+ cnt++;
+ }
+ argv = ap;
+ goto done;
+ }
+ new->e_argv[cnt] = new->e_orig[cnt] = NULL;
+
+done: *argvp = argv + 1;
+ return new;
+}
+
+/* Finish any pending -exec ... {} + functions. */
+void
+finish_execplus(void)
+{
+ PLAN *p;
+
+ p = lastexecplus;
+ while (p != NULL) {
+ (p->execute)(p, NULL);
+ p = p->e_next;
+ }
+}
+
+int
+f_flags(PLAN *plan, FTSENT *entry)
+{
+ u_long flags;
+
+ flags = entry->fts_statp->st_flags;
+ if (plan->flags & F_ATLEAST)
+ return (flags | plan->fl_flags) == flags &&
+ !(flags & plan->fl_notflags);
+ else if (plan->flags & F_ANY)
+ return (flags & plan->fl_flags) ||
+ (flags | plan->fl_notflags) != flags;
+ else
+ return flags == plan->fl_flags &&
+ !(plan->fl_flags & plan->fl_notflags);
+}
+
+PLAN *
+c_flags(OPTION *option, char ***argvp)
+{
+ char *flags_str;
+ PLAN *new;
+ u_long flags, notflags;
+
+ flags_str = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+
+ if (*flags_str == '-') {
+ new->flags |= F_ATLEAST;
+ flags_str++;
+ } else if (*flags_str == '+') {
+ new->flags |= F_ANY;
+ flags_str++;
+ }
+ if (strtofflags(&flags_str, &flags, &notflags) == 1)
+ errx(1, "%s: %s: illegal flags string", option->name, flags_str);
+
+ new->fl_flags = flags;
+ new->fl_notflags = notflags;
+ return new;
+}
+
+/*
+ * -follow functions --
+ *
+ * Always true, causes symbolic links to be followed on a global
+ * basis.
+ */
+PLAN *
+c_follow(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_PHYSICAL;
+ ftsoptions |= FTS_LOGICAL;
+
+ return palloc(option);
+}
+
+/*
+ * -fstype functions --
+ *
+ * True if the file is of a certain type.
+ */
+int
+f_fstype(PLAN *plan, FTSENT *entry)
+{
+ static dev_t curdev; /* need a guaranteed illegal dev value */
+ static int first = 1;
+ struct statfs sb;
+ static int val_flags;
+ static char fstype[sizeof(sb.f_fstypename)];
+ char *p, save[2] = {0,0};
+
+ if ((plan->flags & F_MTMASK) == F_MTUNKNOWN)
+ return 0;
+
+ /* Only check when we cross mount point. */
+ if (first || curdev != entry->fts_statp->st_dev) {
+ curdev = entry->fts_statp->st_dev;
+
+ /*
+ * Statfs follows symlinks; find wants the link's filesystem,
+ * not where it points.
+ */
+ if (entry->fts_info == FTS_SL ||
+ entry->fts_info == FTS_SLNONE) {
+ if ((p = strrchr(entry->fts_accpath, '/')) != NULL)
+ ++p;
+ else
+ p = entry->fts_accpath;
+ save[0] = p[0];
+ p[0] = '.';
+ save[1] = p[1];
+ p[1] = '\0';
+ } else
+ p = NULL;
+
+ if (statfs(entry->fts_accpath, &sb))
+ err(1, "%s", entry->fts_accpath);
+
+ if (p) {
+ p[0] = save[0];
+ p[1] = save[1];
+ }
+
+ first = 0;
+
+ /*
+ * Further tests may need both of these values, so
+ * always copy both of them.
+ */
+ val_flags = sb.f_flags;
+ strlcpy(fstype, sb.f_fstypename, sizeof(fstype));
+ }
+ switch (plan->flags & F_MTMASK) {
+ case F_MTFLAG:
+ return val_flags & plan->mt_data;
+ case F_MTTYPE:
+ return (strncmp(fstype, plan->c_data, sizeof(fstype)) == 0);
+ default:
+ abort();
+ }
+}
+
+PLAN *
+c_fstype(OPTION *option, char ***argvp)
+{
+ char *fsname;
+ PLAN *new;
+
+ fsname = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ switch (*fsname) {
+ case 'l':
+ if (!strcmp(fsname, "local")) {
+ new->flags |= F_MTFLAG;
+ new->mt_data = MNT_LOCAL;
+ return new;
+ }
+ break;
+ case 'r':
+ if (!strcmp(fsname, "rdonly")) {
+ new->flags |= F_MTFLAG;
+ new->mt_data = MNT_RDONLY;
+ return new;
+ }
+ break;
+ }
+
+ new->flags |= F_MTTYPE;
+ new->c_data = fsname;
+ return new;
+}
+
+/*
+ * -group gname functions --
+ *
+ * True if the file belongs to the group gname. If gname is numeric and
+ * an equivalent of the getgrnam() function does not return a valid group
+ * name, gname is taken as a group ID.
+ */
+int
+f_group(PLAN *plan, FTSENT *entry)
+{
+ COMPARE(entry->fts_statp->st_gid, plan->g_data);
+}
+
+PLAN *
+c_group(OPTION *option, char ***argvp)
+{
+ char *gname;
+ PLAN *new;
+ struct group *g;
+ gid_t gid;
+
+ gname = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ g = getgrnam(gname);
+ if (g == NULL) {
+ char* cp = gname;
+ if (gname[0] == '-' || gname[0] == '+')
+ gname++;
+ gid = atoi(gname);
+ if (gid == 0 && gname[0] != '0')
+ errx(1, "%s: %s: no such group", option->name, gname);
+ gid = find_parsenum(new, option->name, cp, NULL);
+ } else
+ gid = g->gr_gid;
+
+ new->g_data = gid;
+ return new;
+}
+
+/*
+ * -ignore_readdir_race functions --
+ *
+ * Always true. Ignore errors which occur if a file or a directory
+ * in a starting point gets deleted between reading the name and calling
+ * stat on it while find is traversing the starting point.
+ */
+
+PLAN *
+c_ignore_readdir_race(OPTION *option, char ***argvp __unused)
+{
+ if (strcmp(option->name, "-ignore_readdir_race") == 0)
+ ignore_readdir_race = 1;
+ else
+ ignore_readdir_race = 0;
+
+ return palloc(option);
+}
+
+/*
+ * -inum n functions --
+ *
+ * True if the file has inode # n.
+ */
+int
+f_inum(PLAN *plan, FTSENT *entry)
+{
+ COMPARE(entry->fts_statp->st_ino, plan->i_data);
+}
+
+PLAN *
+c_inum(OPTION *option, char ***argvp)
+{
+ char *inum_str;
+ PLAN *new;
+
+ inum_str = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ new->i_data = find_parsenum(new, option->name, inum_str, NULL);
+ return new;
+}
+
+/*
+ * -samefile FN
+ *
+ * True if the file has the same inode (eg hard link) FN
+ */
+
+/* f_samefile is just f_inum */
+PLAN *
+c_samefile(OPTION *option, char ***argvp)
+{
+ char *fn;
+ PLAN *new;
+ struct stat sb;
+
+ fn = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ if (stat(fn, &sb))
+ err(1, "%s", fn);
+ new->i_data = sb.st_ino;
+ return new;
+}
+
+/*
+ * -links n functions --
+ *
+ * True if the file has n links.
+ */
+int
+f_links(PLAN *plan, FTSENT *entry)
+{
+ COMPARE(entry->fts_statp->st_nlink, plan->l_data);
+}
+
+PLAN *
+c_links(OPTION *option, char ***argvp)
+{
+ char *nlinks;
+ PLAN *new;
+
+ nlinks = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ new->l_data = (nlink_t)find_parsenum(new, option->name, nlinks, NULL);
+ return new;
+}
+
+/*
+ * -ls functions --
+ *
+ * Always true - prints the current entry to stdout in "ls" format.
+ */
+int
+f_ls(PLAN *plan __unused, FTSENT *entry)
+{
+ printlong(entry->fts_path, entry->fts_accpath, entry->fts_statp);
+ return 1;
+}
+
+PLAN *
+c_ls(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+ isoutput = 1;
+
+ return palloc(option);
+}
+
+/*
+ * -name functions --
+ *
+ * True if the basename of the filename being examined
+ * matches pattern using Pattern Matching Notation S3.14
+ */
+int
+f_name(PLAN *plan, FTSENT *entry)
+{
+ char fn[PATH_MAX];
+ const char *name;
+ ssize_t len;
+
+ if (plan->flags & F_LINK) {
+ /*
+ * The below test both avoids obviously useless readlink()
+ * calls and ensures that symlinks with existent target do
+ * not match if symlinks are being followed.
+ * Assumption: fts will stat all symlinks that are to be
+ * followed and will return the stat information.
+ */
+ if (entry->fts_info != FTS_NSOK && entry->fts_info != FTS_SL &&
+ entry->fts_info != FTS_SLNONE)
+ return 0;
+ len = readlink(entry->fts_accpath, fn, sizeof(fn) - 1);
+ if (len == -1)
+ return 0;
+ fn[len] = '\0';
+ name = fn;
+ } else
+ name = entry->fts_name;
+ return !fnmatch(plan->c_data, name,
+ plan->flags & F_IGNCASE ? FNM_CASEFOLD : 0);
+}
+
+PLAN *
+c_name(OPTION *option, char ***argvp)
+{
+ char *pattern;
+ PLAN *new;
+
+ pattern = nextarg(option, argvp);
+ new = palloc(option);
+ new->c_data = pattern;
+ return new;
+}
+
+/*
+ * -newer file functions --
+ *
+ * True if the current file has been modified more recently
+ * then the modification time of the file named by the pathname
+ * file.
+ */
+int
+f_newer(PLAN *plan, FTSENT *entry)
+{
+ struct timespec ft;
+
+ if (plan->flags & F_TIME_C)
+ ft = entry->fts_statp->st_ctim;
+ else if (plan->flags & F_TIME_A)
+ ft = entry->fts_statp->st_atim;
+ else if (plan->flags & F_TIME_B)
+ ft = entry->fts_statp->st_birthtim;
+ else
+ ft = entry->fts_statp->st_mtim;
+ return (ft.tv_sec > plan->t_data.tv_sec ||
+ (ft.tv_sec == plan->t_data.tv_sec &&
+ ft.tv_nsec > plan->t_data.tv_nsec));
+}
+
+PLAN *
+c_newer(OPTION *option, char ***argvp)
+{
+ char *fn_or_tspec;
+ PLAN *new;
+ struct stat sb;
+
+ fn_or_tspec = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ /* compare against what */
+ if (option->flags & F_TIME2_T) {
+ new->t_data.tv_sec = get_date(fn_or_tspec);
+ if (new->t_data.tv_sec == (time_t) -1)
+ errx(1, "Can't parse date/time: %s", fn_or_tspec);
+ /* Use the seconds only in the comparison. */
+ new->t_data.tv_nsec = 999999999;
+ } else {
+ if (stat(fn_or_tspec, &sb))
+ err(1, "%s", fn_or_tspec);
+ if (option->flags & F_TIME2_C)
+ new->t_data = sb.st_ctim;
+ else if (option->flags & F_TIME2_A)
+ new->t_data = sb.st_atim;
+ else if (option->flags & F_TIME2_B)
+ new->t_data = sb.st_birthtim;
+ else
+ new->t_data = sb.st_mtim;
+ }
+ return new;
+}
+
+/*
+ * -nogroup functions --
+ *
+ * True if file belongs to a user ID for which the equivalent
+ * of the getgrnam() 9.2.1 [POSIX.1] function returns NULL.
+ */
+int
+f_nogroup(PLAN *plan __unused, FTSENT *entry)
+{
+ return group_from_gid(entry->fts_statp->st_gid, 1) == NULL;
+}
+
+PLAN *
+c_nogroup(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+
+ return palloc(option);
+}
+
+/*
+ * -nouser functions --
+ *
+ * True if file belongs to a user ID for which the equivalent
+ * of the getpwuid() 9.2.2 [POSIX.1] function returns NULL.
+ */
+int
+f_nouser(PLAN *plan __unused, FTSENT *entry)
+{
+ return user_from_uid(entry->fts_statp->st_uid, 1) == NULL;
+}
+
+PLAN *
+c_nouser(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+
+ return palloc(option);
+}
+
+/*
+ * -path functions --
+ *
+ * True if the path of the filename being examined
+ * matches pattern using Pattern Matching Notation S3.14
+ */
+int
+f_path(PLAN *plan, FTSENT *entry)
+{
+ return !fnmatch(plan->c_data, entry->fts_path,
+ plan->flags & F_IGNCASE ? FNM_CASEFOLD : 0);
+}
+
+/* c_path is the same as c_name */
+
+/*
+ * -perm functions --
+ *
+ * The mode argument is used to represent file mode bits. If it starts
+ * with a leading digit, it's treated as an octal mode, otherwise as a
+ * symbolic mode.
+ */
+int
+f_perm(PLAN *plan, FTSENT *entry)
+{
+ mode_t mode;
+
+ mode = entry->fts_statp->st_mode &
+ (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO);
+ if (plan->flags & F_ATLEAST)
+ return (plan->m_data | mode) == mode;
+ else if (plan->flags & F_ANY)
+ return (mode & plan->m_data);
+ else
+ return mode == plan->m_data;
+ /* NOTREACHED */
+}
+
+PLAN *
+c_perm(OPTION *option, char ***argvp)
+{
+ char *perm;
+ PLAN *new;
+ mode_t *set;
+
+ perm = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+
+ if (*perm == '-') {
+ new->flags |= F_ATLEAST;
+ ++perm;
+ } else if (*perm == '+') {
+ new->flags |= F_ANY;
+ ++perm;
+ }
+
+ if ((set = setmode(perm)) == NULL)
+ errx(1, "%s: %s: illegal mode string", option->name, perm);
+
+ new->m_data = getmode(set, 0);
+ free(set);
+ return new;
+}
+
+/*
+ * -print functions --
+ *
+ * Always true, causes the current pathname to be written to
+ * standard output.
+ */
+int
+f_print(PLAN *plan __unused, FTSENT *entry)
+{
+ (void)puts(entry->fts_path);
+ return 1;
+}
+
+PLAN *
+c_print(OPTION *option, char ***argvp __unused)
+{
+ isoutput = 1;
+
+ return palloc(option);
+}
+
+/*
+ * -print0 functions --
+ *
+ * Always true, causes the current pathname to be written to
+ * standard output followed by a NUL character
+ */
+int
+f_print0(PLAN *plan __unused, FTSENT *entry)
+{
+ fputs(entry->fts_path, stdout);
+ fputc('\0', stdout);
+ return 1;
+}
+
+/* c_print0 is the same as c_print */
+
+/*
+ * -prune functions --
+ *
+ * Prune a portion of the hierarchy.
+ */
+int
+f_prune(PLAN *plan __unused, FTSENT *entry)
+{
+ if (fts_set(tree, entry, FTS_SKIP))
+ err(1, "%s", entry->fts_path);
+ return 1;
+}
+
+/* c_prune == c_simple */
+
+/*
+ * -regex functions --
+ *
+ * True if the whole path of the file matches pattern using
+ * regular expression.
+ */
+int
+f_regex(PLAN *plan, FTSENT *entry)
+{
+ char *str;
+ int len;
+ regex_t *pre;
+ regmatch_t pmatch;
+ int errcode;
+ char errbuf[LINE_MAX];
+ int matched;
+
+ pre = plan->re_data;
+ str = entry->fts_path;
+ len = strlen(str);
+ matched = 0;
+
+ pmatch.rm_so = 0;
+ pmatch.rm_eo = len;
+
+ errcode = regexec(pre, str, 1, &pmatch, REG_STARTEND);
+
+ if (errcode != 0 && errcode != REG_NOMATCH) {
+ regerror(errcode, pre, errbuf, sizeof errbuf);
+ errx(1, "%s: %s",
+ plan->flags & F_IGNCASE ? "-iregex" : "-regex", errbuf);
+ }
+
+ if (errcode == 0 && pmatch.rm_so == 0 && pmatch.rm_eo == len)
+ matched = 1;
+
+ return matched;
+}
+
+PLAN *
+c_regex(OPTION *option, char ***argvp)
+{
+ PLAN *new;
+ char *pattern;
+ regex_t *pre;
+ int errcode;
+ char errbuf[LINE_MAX];
+
+ if ((pre = malloc(sizeof(regex_t))) == NULL)
+ err(1, NULL);
+
+ pattern = nextarg(option, argvp);
+
+ if ((errcode = regcomp(pre, pattern,
+ regexp_flags | (option->flags & F_IGNCASE ? REG_ICASE : 0))) != 0) {
+ regerror(errcode, pre, errbuf, sizeof errbuf);
+ errx(1, "%s: %s: %s",
+ option->flags & F_IGNCASE ? "-iregex" : "-regex",
+ pattern, errbuf);
+ }
+
+ new = palloc(option);
+ new->re_data = pre;
+
+ return new;
+}
+
+/* c_simple covers c_prune, c_openparen, c_closeparen, c_not, c_or, c_true, c_false */
+
+PLAN *
+c_simple(OPTION *option, char ***argvp __unused)
+{
+ return palloc(option);
+}
+
+/*
+ * -size n[c] functions --
+ *
+ * True if the file size in bytes, divided by an implementation defined
+ * value and rounded up to the next integer, is n. If n is followed by
+ * one of c k M G T P, the size is in bytes, kilobytes,
+ * megabytes, gigabytes, terabytes or petabytes respectively.
+ */
+#define FIND_SIZE 512
+static int divsize = 1;
+
+int
+f_size(PLAN *plan, FTSENT *entry)
+{
+ off_t size;
+
+ size = divsize ? (entry->fts_statp->st_size + FIND_SIZE - 1) /
+ FIND_SIZE : entry->fts_statp->st_size;
+ COMPARE(size, plan->o_data);
+}
+
+PLAN *
+c_size(OPTION *option, char ***argvp)
+{
+ char *size_str;
+ PLAN *new;
+ char endch;
+ off_t scale;
+
+ size_str = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ endch = 'c';
+ new->o_data = find_parsenum(new, option->name, size_str, &endch);
+ if (endch != '\0') {
+ divsize = 0;
+
+ switch (endch) {
+ case 'c': /* characters */
+ scale = 0x1LL;
+ break;
+ case 'k': /* kilobytes 1<<10 */
+ scale = 0x400LL;
+ break;
+ case 'M': /* megabytes 1<<20 */
+ scale = 0x100000LL;
+ break;
+ case 'G': /* gigabytes 1<<30 */
+ scale = 0x40000000LL;
+ break;
+ case 'T': /* terabytes 1<<40 */
+ scale = 0x10000000000LL;
+ break;
+ case 'P': /* petabytes 1<<50 */
+ scale = 0x4000000000000LL;
+ break;
+ default:
+ errx(1, "%s: %s: illegal trailing character",
+ option->name, size_str);
+ break;
+ }
+ if (new->o_data > QUAD_MAX / scale)
+ errx(1, "%s: %s: value too large",
+ option->name, size_str);
+ new->o_data *= scale;
+ }
+ return new;
+}
+
+/*
+ * -sparse functions --
+ *
+ * Check if a file is sparse by finding if it occupies fewer blocks
+ * than we expect based on its size.
+ */
+int
+f_sparse(PLAN *plan __unused, FTSENT *entry)
+{
+ off_t expected_blocks;
+
+ expected_blocks = (entry->fts_statp->st_size + 511) / 512;
+ return entry->fts_statp->st_blocks < expected_blocks;
+}
+
+PLAN *
+c_sparse(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions &= ~FTS_NOSTAT;
+
+ return palloc(option);
+}
+
+/*
+ * -type c functions --
+ *
+ * True if the type of the file is c, where c is b, c, d, p, f or w
+ * for block special file, character special file, directory, FIFO,
+ * regular file or whiteout respectively.
+ */
+int
+f_type(PLAN *plan, FTSENT *entry)
+{
+ if (plan->m_data == S_IFDIR)
+ return (entry->fts_info == FTS_D || entry->fts_info == FTS_DC ||
+ entry->fts_info == FTS_DNR || entry->fts_info == FTS_DOT ||
+ entry->fts_info == FTS_DP);
+ else
+ return (entry->fts_statp->st_mode & S_IFMT) == plan->m_data;
+}
+
+PLAN *
+c_type(OPTION *option, char ***argvp)
+{
+ char *typestring;
+ PLAN *new;
+ mode_t mask;
+
+ typestring = nextarg(option, argvp);
+ if (typestring[0] != 'd')
+ ftsoptions &= ~FTS_NOSTAT;
+
+ switch (typestring[0]) {
+ case 'b':
+ mask = S_IFBLK;
+ break;
+ case 'c':
+ mask = S_IFCHR;
+ break;
+ case 'd':
+ mask = S_IFDIR;
+ break;
+ case 'f':
+ mask = S_IFREG;
+ break;
+ case 'l':
+ mask = S_IFLNK;
+ break;
+ case 'p':
+ mask = S_IFIFO;
+ break;
+ case 's':
+ mask = S_IFSOCK;
+ break;
+#ifdef FTS_WHITEOUT
+ case 'w':
+ mask = S_IFWHT;
+ ftsoptions |= FTS_WHITEOUT;
+ break;
+#endif /* FTS_WHITEOUT */
+ default:
+ errx(1, "%s: %s: unknown type", option->name, typestring);
+ }
+
+ new = palloc(option);
+ new->m_data = mask;
+ return new;
+}
+
+/*
+ * -user uname functions --
+ *
+ * True if the file belongs to the user uname. If uname is numeric and
+ * an equivalent of the getpwnam() S9.2.2 [POSIX.1] function does not
+ * return a valid user name, uname is taken as a user ID.
+ */
+int
+f_user(PLAN *plan, FTSENT *entry)
+{
+ COMPARE(entry->fts_statp->st_uid, plan->u_data);
+}
+
+PLAN *
+c_user(OPTION *option, char ***argvp)
+{
+ char *username;
+ PLAN *new;
+ struct passwd *p;
+ uid_t uid;
+
+ username = nextarg(option, argvp);
+ ftsoptions &= ~FTS_NOSTAT;
+
+ new = palloc(option);
+ p = getpwnam(username);
+ if (p == NULL) {
+ char* cp = username;
+ if( username[0] == '-' || username[0] == '+' )
+ username++;
+ uid = atoi(username);
+ if (uid == 0 && username[0] != '0')
+ errx(1, "%s: %s: no such user", option->name, username);
+ uid = find_parsenum(new, option->name, cp, NULL);
+ } else
+ uid = p->pw_uid;
+
+ new->u_data = uid;
+ return new;
+}
+
+/*
+ * -xdev functions --
+ *
+ * Always true, causes find not to descend past directories that have a
+ * different device ID (st_dev, see stat() S5.6.2 [POSIX.1])
+ */
+PLAN *
+c_xdev(OPTION *option, char ***argvp __unused)
+{
+ ftsoptions |= FTS_XDEV;
+
+ return palloc(option);
+}
+
+/*
+ * ( expression ) functions --
+ *
+ * True if expression is true.
+ */
+int
+f_expr(PLAN *plan, FTSENT *entry)
+{
+ PLAN *p;
+ int state = 0;
+
+ for (p = plan->p_data[0];
+ p && (state = (p->execute)(p, entry)); p = p->next);
+ return state;
+}
+
+/*
+ * f_openparen and f_closeparen nodes are temporary place markers. They are
+ * eliminated during phase 2 of find_formplan() --- the '(' node is converted
+ * to a f_expr node containing the expression and the ')' node is discarded.
+ * The functions themselves are only used as constants.
+ */
+
+int
+f_openparen(PLAN *plan __unused, FTSENT *entry __unused)
+{
+ abort();
+}
+
+int
+f_closeparen(PLAN *plan __unused, FTSENT *entry __unused)
+{
+ abort();
+}
+
+/* c_openparen == c_simple */
+/* c_closeparen == c_simple */
+
+/*
+ * AND operator. Since AND is implicit, no node is allocated.
+ */
+PLAN *
+c_and(OPTION *option __unused, char ***argvp __unused)
+{
+ return NULL;
+}
+
+/*
+ * ! expression functions --
+ *
+ * Negation of a primary; the unary NOT operator.
+ */
+int
+f_not(PLAN *plan, FTSENT *entry)
+{
+ PLAN *p;
+ int state = 0;
+
+ for (p = plan->p_data[0];
+ p && (state = (p->execute)(p, entry)); p = p->next);
+ return !state;
+}
+
+/* c_not == c_simple */
+
+/*
+ * expression -o expression functions --
+ *
+ * Alternation of primaries; the OR operator. The second expression is
+ * not evaluated if the first expression is true.
+ */
+int
+f_or(PLAN *plan, FTSENT *entry)
+{
+ PLAN *p;
+ int state = 0;
+
+ for (p = plan->p_data[0];
+ p && (state = (p->execute)(p, entry)); p = p->next);
+
+ if (state)
+ return 1;
+
+ for (p = plan->p_data[1];
+ p && (state = (p->execute)(p, entry)); p = p->next);
+ return state;
+}
+
+/* c_or == c_simple */
+
+/*
+ * -false
+ *
+ * Always false.
+ */
+int
+f_false(PLAN *plan __unused, FTSENT *entry __unused)
+{
+ return 0;
+}
+
+/* c_false == c_simple */
+
+/*
+ * -quit
+ *
+ * Exits the program
+ */
+int
+f_quit(PLAN *plan __unused, FTSENT *entry __unused)
+{
+ finish_execplus();
+ exit(exitstatus);
+}
+
+/* c_quit == c_simple */
diff --git a/usr.bin/find/getdate.y b/usr.bin/find/getdate.y
new file mode 100644
index 0000000..16ffb6e
--- /dev/null
+++ b/usr.bin/find/getdate.y
@@ -0,0 +1,959 @@
+%{
+/*
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
+**
+** This grammar has 10 shift/reduce conflicts.
+**
+** This code is in the public domain and has no copyright.
+*/
+/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
+/* SUPPRESS 288 on yyerrlab *//* Label unused */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <ctype.h>
+
+/* The code at the top of get_date which figures out the offset of the
+ current time zone checks various CPP symbols to see if special
+ tricks are need, but defaults to using the gettimeofday system call.
+ Include <sys/time.h> if that will be used. */
+
+#if defined(vms)
+# include <types.h>
+#else /* defined(vms) */
+# include <sys/types.h>
+# include <sys/time.h>
+#endif /* !defined(vms) */
+
+#if defined (__STDC__) || defined (USG)
+#include <string.h>
+#endif
+
+/* Some old versions of bison generate parsers that use bcopy.
+ That loses on systems that don't provide the function, so we have
+ to redefine it here. */
+#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
+#define bcopy(from, to, len) memcpy ((to), (from), (len))
+#endif
+
+#if defined (__STDC__)
+#include <stdlib.h>
+#endif
+
+/* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
+ releases):
+
+ We don't want to mess with all the portability hassles of alloca.
+ In particular, most (all?) versions of bison will use alloca in
+ their parser. If bison works on your system (e.g. it should work
+ with gcc), then go ahead and use it, but the more general solution
+ is to use byacc instead of bison, which should generate a portable
+ parser. I played with adding "#define alloca dont_use_alloca", to
+ give an error if the parser generator uses alloca (and thus detect
+ unportable getdate.c's), but that seems to cause as many problems
+ as it solves. */
+
+#include <time.h>
+
+#define yylex getdate_yylex
+#define yyerror getdate_yyerror
+
+static int yylex(void);
+static int yyerror(const char *);
+
+time_t get_date(char *);
+
+#define EPOCH 1970
+#define HOUR(x) ((time_t)(x) * 60)
+#define SECSPERDAY (24L * 60L * 60L)
+
+
+/*
+** An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+ const char *name;
+ int type;
+ time_t value;
+} TABLE;
+
+
+/*
+** Daylight-savings mode: on, off, or not yet known.
+*/
+typedef enum _DSTMODE {
+ DSTon, DSToff, DSTmaybe
+} DSTMODE;
+
+/*
+** Meridian: am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+ MERam, MERpm, MER24
+} MERIDIAN;
+
+
+/*
+** Global variables. We could get rid of most of these by using a good
+** union as the yacc stack. (This routine was originally written before
+** yacc had the %union construct.) Maybe someday; right now we only use
+** the %union very rarely.
+*/
+static char *yyInput;
+static DSTMODE yyDSTmode;
+static time_t yyDayOrdinal;
+static time_t yyDayNumber;
+static int yyHaveDate;
+static int yyHaveDay;
+static int yyHaveRel;
+static int yyHaveTime;
+static int yyHaveZone;
+static time_t yyTimezone;
+static time_t yyDay;
+static time_t yyHour;
+static time_t yyMinutes;
+static time_t yyMonth;
+static time_t yySeconds;
+static time_t yyYear;
+static MERIDIAN yyMeridian;
+static time_t yyRelMonth;
+static time_t yyRelSeconds;
+
+%}
+
+%union {
+ time_t Number;
+ enum _MERIDIAN Meridian;
+}
+
+%token tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
+%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST
+
+%type <Number> tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT
+%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tZONE
+%type <Meridian> tMERIDIAN o_merid
+
+%%
+
+spec : /* NULL */
+ | spec item
+ ;
+
+item : time {
+ yyHaveTime++;
+ }
+ | zone {
+ yyHaveZone++;
+ }
+ | date {
+ yyHaveDate++;
+ }
+ | day {
+ yyHaveDay++;
+ }
+ | rel {
+ yyHaveRel++;
+ }
+ | number
+ ;
+
+time : tUNUMBER tMERIDIAN {
+ yyHour = $1;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = $2;
+ }
+ | tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = 0;
+ yyMeridian = $4;
+ }
+ | tUNUMBER ':' tUNUMBER tSNUMBER {
+ yyHour = $1;
+ yyMinutes = $3;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ yyTimezone = - ($4 % 100 + ($4 / 100) * 60);
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyMeridian = $6;
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
+ }
+ ;
+
+zone : tZONE {
+ yyTimezone = $1;
+ yyDSTmode = DSToff;
+ }
+ | tDAYZONE {
+ yyTimezone = $1;
+ yyDSTmode = DSTon;
+ }
+ |
+ tZONE tDST {
+ yyTimezone = $1;
+ yyDSTmode = DSTon;
+ }
+ ;
+
+day : tDAY {
+ yyDayOrdinal = 1;
+ yyDayNumber = $1;
+ }
+ | tDAY ',' {
+ yyDayOrdinal = 1;
+ yyDayNumber = $1;
+ }
+ | tUNUMBER tDAY {
+ yyDayOrdinal = $1;
+ yyDayNumber = $2;
+ }
+ ;
+
+date : tUNUMBER '/' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $3;
+ }
+ | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
+ if ($1 >= 100) {
+ yyYear = $1;
+ yyMonth = $3;
+ yyDay = $5;
+ } else {
+ yyMonth = $1;
+ yyDay = $3;
+ yyYear = $5;
+ }
+ }
+ | tUNUMBER tSNUMBER tSNUMBER {
+ /* ISO 8601 format. yyyy-mm-dd. */
+ yyYear = $1;
+ yyMonth = -$2;
+ yyDay = -$3;
+ }
+ | tUNUMBER tMONTH tSNUMBER {
+ /* e.g. 17-JUN-1992. */
+ yyDay = $1;
+ yyMonth = $2;
+ yyYear = -$3;
+ }
+ | tMONTH tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ }
+ | tMONTH tUNUMBER ',' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ yyYear = $4;
+ }
+ | tUNUMBER tMONTH {
+ yyMonth = $2;
+ yyDay = $1;
+ }
+ | tUNUMBER tMONTH tUNUMBER {
+ yyMonth = $2;
+ yyDay = $1;
+ yyYear = $3;
+ }
+ ;
+
+rel : relunit tAGO {
+ yyRelSeconds = -yyRelSeconds;
+ yyRelMonth = -yyRelMonth;
+ }
+ | relunit
+ ;
+
+relunit : tUNUMBER tMINUTE_UNIT {
+ yyRelSeconds += $1 * $2 * 60L;
+ }
+ | tSNUMBER tMINUTE_UNIT {
+ yyRelSeconds += $1 * $2 * 60L;
+ }
+ | tMINUTE_UNIT {
+ yyRelSeconds += $1 * 60L;
+ }
+ | tSNUMBER tSEC_UNIT {
+ yyRelSeconds += $1;
+ }
+ | tUNUMBER tSEC_UNIT {
+ yyRelSeconds += $1;
+ }
+ | tSEC_UNIT {
+ yyRelSeconds++;
+ }
+ | tSNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ | tUNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ | tMONTH_UNIT {
+ yyRelMonth += $1;
+ }
+ ;
+
+number : tUNUMBER {
+ if (yyHaveTime && yyHaveDate && !yyHaveRel)
+ yyYear = $1;
+ else {
+ if($1>10000) {
+ yyHaveDate++;
+ yyDay= ($1)%100;
+ yyMonth= ($1/100)%100;
+ yyYear = $1/10000;
+ }
+ else {
+ yyHaveTime++;
+ if ($1 < 100) {
+ yyHour = $1;
+ yyMinutes = 0;
+ }
+ else {
+ yyHour = $1 / 100;
+ yyMinutes = $1 % 100;
+ }
+ yySeconds = 0;
+ yyMeridian = MER24;
+ }
+ }
+ }
+ ;
+
+o_merid : /* NULL */ {
+ $$ = MER24;
+ }
+ | tMERIDIAN {
+ $$ = $1;
+ }
+ ;
+
+%%
+
+/* Month and day table. */
+static TABLE const MonthDayTable[] = {
+ { "january", tMONTH, 1 },
+ { "february", tMONTH, 2 },
+ { "march", tMONTH, 3 },
+ { "april", tMONTH, 4 },
+ { "may", tMONTH, 5 },
+ { "june", tMONTH, 6 },
+ { "july", tMONTH, 7 },
+ { "august", tMONTH, 8 },
+ { "september", tMONTH, 9 },
+ { "sept", tMONTH, 9 },
+ { "october", tMONTH, 10 },
+ { "november", tMONTH, 11 },
+ { "december", tMONTH, 12 },
+ { "sunday", tDAY, 0 },
+ { "monday", tDAY, 1 },
+ { "tuesday", tDAY, 2 },
+ { "tues", tDAY, 2 },
+ { "wednesday", tDAY, 3 },
+ { "wednes", tDAY, 3 },
+ { "thursday", tDAY, 4 },
+ { "thur", tDAY, 4 },
+ { "thurs", tDAY, 4 },
+ { "friday", tDAY, 5 },
+ { "saturday", tDAY, 6 },
+ { NULL, 0, 0 }
+};
+
+/* Time units table. */
+static TABLE const UnitsTable[] = {
+ { "year", tMONTH_UNIT, 12 },
+ { "month", tMONTH_UNIT, 1 },
+ { "fortnight", tMINUTE_UNIT, 14 * 24 * 60 },
+ { "week", tMINUTE_UNIT, 7 * 24 * 60 },
+ { "day", tMINUTE_UNIT, 1 * 24 * 60 },
+ { "hour", tMINUTE_UNIT, 60 },
+ { "minute", tMINUTE_UNIT, 1 },
+ { "min", tMINUTE_UNIT, 1 },
+ { "second", tSEC_UNIT, 1 },
+ { "sec", tSEC_UNIT, 1 },
+ { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words. */
+static TABLE const OtherTable[] = {
+ { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 },
+ { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 },
+ { "today", tMINUTE_UNIT, 0 },
+ { "now", tMINUTE_UNIT, 0 },
+ { "last", tUNUMBER, -1 },
+ { "this", tMINUTE_UNIT, 0 },
+ { "next", tUNUMBER, 2 },
+ { "first", tUNUMBER, 1 },
+/* { "second", tUNUMBER, 2 }, */
+ { "third", tUNUMBER, 3 },
+ { "fourth", tUNUMBER, 4 },
+ { "fifth", tUNUMBER, 5 },
+ { "sixth", tUNUMBER, 6 },
+ { "seventh", tUNUMBER, 7 },
+ { "eighth", tUNUMBER, 8 },
+ { "ninth", tUNUMBER, 9 },
+ { "tenth", tUNUMBER, 10 },
+ { "eleventh", tUNUMBER, 11 },
+ { "twelfth", tUNUMBER, 12 },
+ { "ago", tAGO, 1 },
+ { NULL, 0, 0 }
+};
+
+/* The timezone table. */
+/* Some of these are commented out because a time_t can't store a float. */
+static TABLE const TimezoneTable[] = {
+ { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
+ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
+ { "utc", tZONE, HOUR( 0) },
+ { "wet", tZONE, HOUR( 0) }, /* Western European */
+ { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */
+ { "wat", tZONE, HOUR( 1) }, /* West Africa */
+ { "at", tZONE, HOUR( 2) }, /* Azores */
+#if 0
+ /* For completeness. BST is also British Summer, and GST is
+ * also Guam Standard. */
+ { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */
+ { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */
+#endif
+#if 0
+ { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */
+ { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */
+ { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */
+#endif
+ { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */
+ { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */
+ { "est", tZONE, HOUR( 5) }, /* Eastern Standard */
+ { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */
+ { "cst", tZONE, HOUR( 6) }, /* Central Standard */
+ { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */
+ { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */
+ { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */
+ { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */
+ { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */
+ { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */
+ { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */
+ { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */
+ { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */
+ { "cat", tZONE, HOUR(10) }, /* Central Alaska */
+ { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */
+ { "nt", tZONE, HOUR(11) }, /* Nome */
+ { "idlw", tZONE, HOUR(12) }, /* International Date Line West */
+ { "cet", tZONE, -HOUR(1) }, /* Central European */
+ { "met", tZONE, -HOUR(1) }, /* Middle European */
+ { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */
+ { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
+ { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */
+ { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */
+ { "fwt", tZONE, -HOUR(1) }, /* French Winter */
+ { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */
+ { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */
+ { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */
+#if 0
+ { "it", tZONE, -HOUR(3.5) },/* Iran */
+#endif
+ { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */
+ { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */
+#if 0
+ { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */
+#endif
+ { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */
+#if 0
+ /* For completeness. NST is also Newfoundland Stanard, and SST is
+ * also Swedish Summer. */
+ { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */
+ { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */
+#endif /* 0 */
+ { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */
+ { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */
+#if 0
+ { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */
+#endif
+ { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */
+ { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */
+#if 0
+ { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */
+ { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */
+#endif
+ { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */
+ { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */
+ { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
+ { "nzt", tZONE, -HOUR(12) }, /* New Zealand */
+ { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
+ { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
+ { "idle", tZONE, -HOUR(12) }, /* International Date Line East */
+ { NULL, 0, 0 }
+};
+
+/* Military timezone table. */
+static TABLE const MilitaryTable[] = {
+ { "a", tZONE, HOUR( 1) },
+ { "b", tZONE, HOUR( 2) },
+ { "c", tZONE, HOUR( 3) },
+ { "d", tZONE, HOUR( 4) },
+ { "e", tZONE, HOUR( 5) },
+ { "f", tZONE, HOUR( 6) },
+ { "g", tZONE, HOUR( 7) },
+ { "h", tZONE, HOUR( 8) },
+ { "i", tZONE, HOUR( 9) },
+ { "k", tZONE, HOUR( 10) },
+ { "l", tZONE, HOUR( 11) },
+ { "m", tZONE, HOUR( 12) },
+ { "n", tZONE, HOUR(- 1) },
+ { "o", tZONE, HOUR(- 2) },
+ { "p", tZONE, HOUR(- 3) },
+ { "q", tZONE, HOUR(- 4) },
+ { "r", tZONE, HOUR(- 5) },
+ { "s", tZONE, HOUR(- 6) },
+ { "t", tZONE, HOUR(- 7) },
+ { "u", tZONE, HOUR(- 8) },
+ { "v", tZONE, HOUR(- 9) },
+ { "w", tZONE, HOUR(-10) },
+ { "x", tZONE, HOUR(-11) },
+ { "y", tZONE, HOUR(-12) },
+ { "z", tZONE, HOUR( 0) },
+ { NULL, 0, 0 }
+};
+
+
+
+
+/* ARGSUSED */
+static int
+yyerror(const char *s __unused)
+{
+ return 0;
+}
+
+
+static time_t
+ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
+{
+ if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
+ return -1;
+ switch (Meridian) {
+ case MER24:
+ if (Hours < 0 || Hours > 23)
+ return -1;
+ return (Hours * 60L + Minutes) * 60L + Seconds;
+ case MERam:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return (Hours * 60L + Minutes) * 60L + Seconds;
+ case MERpm:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
+
+/* Year is either
+ * A negative number, which means to use its absolute value (why?)
+ * A number from 0 to 99, which means a year from 1900 to 1999, or
+ * The actual year (>=100). */
+static time_t
+Convert(time_t Month, time_t Day, time_t Year,
+ time_t Hours, time_t Minutes, time_t Seconds,
+ MERIDIAN Meridian, DSTMODE DSTmode)
+{
+ static int DaysInMonth[12] = {
+ 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+ };
+ time_t tod;
+ time_t Julian;
+ int i;
+
+ if (Year < 0)
+ Year = -Year;
+ if (Year < 69)
+ Year += 2000;
+ else if (Year < 100)
+ Year += 1900;
+ DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
+ ? 29 : 28;
+ /* Checking for 2038 bogusly assumes that time_t is 32 bits. But
+ I'm too lazy to try to check for time_t overflow in another way. */
+ if (Year < EPOCH || Year > 2038
+ || Month < 1 || Month > 12
+ /* Lint fluff: "conversion from long may lose accuracy" */
+ || Day < 1 || Day > DaysInMonth[(int)--Month])
+ return -1;
+
+ for (Julian = Day - 1, i = 0; i < Month; i++)
+ Julian += DaysInMonth[i];
+ for (i = EPOCH; i < Year; i++)
+ Julian += 365 + (i % 4 == 0);
+ Julian *= SECSPERDAY;
+ Julian += yyTimezone * 60L;
+ if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
+ return -1;
+ Julian += tod;
+ if (DSTmode == DSTon
+ || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
+ Julian -= 60 * 60;
+ return Julian;
+}
+
+
+static time_t
+DSTcorrect(time_t Start, time_t Future)
+{
+ time_t StartDay;
+ time_t FutureDay;
+
+ StartDay = (localtime(&Start)->tm_hour + 1) % 24;
+ FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+ return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
+}
+
+
+static time_t
+RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
+{
+ struct tm *tm;
+ time_t now;
+
+ now = Start;
+ tm = localtime(&now);
+ now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
+ now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
+ return DSTcorrect(Start, now);
+}
+
+
+static time_t
+RelativeMonth(time_t Start, time_t RelMonth)
+{
+ struct tm *tm;
+ time_t Month;
+ time_t Year;
+
+ if (RelMonth == 0)
+ return 0;
+ tm = localtime(&Start);
+ Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
+ Year = Month / 12;
+ Month = Month % 12 + 1;
+ return DSTcorrect(Start,
+ Convert(Month, (time_t)tm->tm_mday, Year,
+ (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
+ MER24, DSTmaybe));
+}
+
+
+static int
+LookupWord(char *buff)
+{
+ char *p;
+ char *q;
+ const TABLE *tp;
+ int i;
+ int abbrev;
+
+ /* Make it lowercase. */
+ for (p = buff; *p; p++)
+ if (isupper(*p))
+ *p = tolower(*p);
+
+ if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
+ yylval.Meridian = MERam;
+ return tMERIDIAN;
+ }
+ if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
+ yylval.Meridian = MERpm;
+ return tMERIDIAN;
+ }
+
+ /* See if we have an abbreviation for a month. */
+ if (strlen(buff) == 3)
+ abbrev = 1;
+ else if (strlen(buff) == 4 && buff[3] == '.') {
+ abbrev = 1;
+ buff[3] = '\0';
+ }
+ else
+ abbrev = 0;
+
+ for (tp = MonthDayTable; tp->name; tp++) {
+ if (abbrev) {
+ if (strncmp(buff, tp->name, 3) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+ else if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ if (strcmp(buff, "dst") == 0)
+ return tDST;
+
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Strip off any plural and try the units table again. */
+ i = strlen(buff) - 1;
+ if (buff[i] == 's') {
+ buff[i] = '\0';
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ buff[i] = 's'; /* Put back for "this" in OtherTable. */
+ }
+
+ for (tp = OtherTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Military timezones. */
+ if (buff[1] == '\0' && isalpha(*buff)) {
+ for (tp = MilitaryTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ /* Drop out any periods and try the timezone table again. */
+ for (i = 0, p = q = buff; *q; q++)
+ if (*q != '.')
+ *p++ = *q;
+ else
+ i++;
+ *p = '\0';
+ if (i)
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp(buff, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ return tID;
+}
+
+
+static int
+yylex(void)
+{
+ char c;
+ char *p;
+ char buff[20];
+ int Count;
+ int sign;
+
+ for ( ; ; ) {
+ while (isspace(*yyInput))
+ yyInput++;
+
+ if (isdigit(c = *yyInput) || c == '-' || c == '+') {
+ if (c == '-' || c == '+') {
+ sign = c == '-' ? -1 : 1;
+ if (!isdigit(*++yyInput))
+ /* skip the '-' sign */
+ continue;
+ }
+ else
+ sign = 0;
+ for (yylval.Number = 0; isdigit(c = *yyInput++); )
+ yylval.Number = 10 * yylval.Number + c - '0';
+ yyInput--;
+ if (sign < 0)
+ yylval.Number = -yylval.Number;
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+ if (isalpha(c)) {
+ for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
+ if (p < &buff[sizeof buff - 1])
+ *p++ = c;
+ *p = '\0';
+ yyInput--;
+ return LookupWord(buff);
+ }
+ if (c != '(')
+ return *yyInput++;
+ Count = 0;
+ do {
+ c = *yyInput++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ Count++;
+ else if (c == ')')
+ Count--;
+ } while (Count > 0);
+ }
+}
+
+#define TM_YEAR_ORIGIN 1900
+
+/* Yield A - B, measured in seconds. */
+static long
+difftm (struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ int days = (
+ /* difference in day of year */
+ a->tm_yday - b->tm_yday
+ /* + intervening leap days */
+ + ((ay >> 2) - (by >> 2))
+ - (ay/100 - by/100)
+ + ((ay/100 >> 2) - (by/100 >> 2))
+ /* + difference in years * 365 */
+ + (long)(ay-by) * 365
+ );
+ return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+
+time_t
+get_date(char *p)
+{
+ struct tm *tm, *gmt_ptr, gmt;
+ int tzoff;
+ time_t Start;
+ time_t tod;
+ time_t nowtime;
+
+ bzero (&gmt, sizeof(struct tm));
+ yyInput = p;
+
+ (void)time (&nowtime);
+
+ gmt_ptr = gmtime (&nowtime);
+ if (gmt_ptr != NULL)
+ {
+ /* Make a copy, in case localtime modifies *tm (I think
+ that comment now applies to *gmt_ptr, but I am too
+ lazy to dig into how gmtime and locatime allocate the
+ structures they return pointers to). */
+ gmt = *gmt_ptr;
+ }
+
+ if (! (tm = localtime (&nowtime)))
+ return -1;
+
+ if (gmt_ptr != NULL)
+ tzoff = difftm (&gmt, tm) / 60;
+ else
+ /* We are on a system like VMS, where the system clock is
+ in local time and the system has no concept of timezones.
+ Hopefully we can fake this out (for the case in which the
+ user specifies no timezone) by just saying the timezone
+ is zero. */
+ tzoff = 0;
+
+ if(tm->tm_isdst)
+ tzoff += 60;
+
+ tm = localtime(&nowtime);
+ yyYear = tm->tm_year + 1900;
+ yyMonth = tm->tm_mon + 1;
+ yyDay = tm->tm_mday;
+ yyTimezone = tzoff;
+ yyDSTmode = DSTmaybe;
+ yyHour = 0;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = MER24;
+ yyRelSeconds = 0;
+ yyRelMonth = 0;
+ yyHaveDate = 0;
+ yyHaveDay = 0;
+ yyHaveRel = 0;
+ yyHaveTime = 0;
+ yyHaveZone = 0;
+
+ if (yyparse()
+ || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
+ return -1;
+
+ if (yyHaveDate || yyHaveTime || yyHaveDay) {
+ Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
+ yyMeridian, yyDSTmode);
+ if (Start < 0)
+ return -1;
+ }
+ else {
+ Start = nowtime;
+ if (!yyHaveRel)
+ Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
+ }
+
+ Start += yyRelSeconds;
+ Start += RelativeMonth(Start, yyRelMonth);
+
+ if (yyHaveDay && !yyHaveDate) {
+ tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
+ Start += tod;
+ }
+
+ /* Have to do *something* with a legitimate -1 so it's distinguishable
+ * from the error return value. (Alternately could set errno on error.) */
+ return Start == -1 ? 0 : Start;
+}
+
+
+#if defined(TEST)
+
+/* ARGSUSED */
+int
+main(int ac, char *av[])
+{
+ char buff[128];
+ time_t d;
+
+ (void)printf("Enter date, or blank line to exit.\n\t> ");
+ (void)fflush(stdout);
+ while (gets(buff) && buff[0]) {
+ d = get_date(buff);
+ if (d == -1)
+ (void)printf("Bad format - couldn't convert.\n");
+ else
+ (void)printf("%s", ctime(&d));
+ (void)printf("\t> ");
+ (void)fflush(stdout);
+ }
+ exit(0);
+ /* NOTREACHED */
+}
+#endif /* defined(TEST) */
diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c
new file mode 100644
index 0000000..082fd64
--- /dev/null
+++ b/usr.bin/find/ls.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1989, 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
+#if 0
+static char sccsid[] = "@(#)ls.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fts.h>
+#include <grp.h>
+#include <inttypes.h>
+#include <langinfo.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "find.h"
+
+/* Derived from the print routines in the ls(1) source code. */
+
+static void printlink(char *);
+static void printtime(time_t);
+
+void
+printlong(char *name, char *accpath, struct stat *sb)
+{
+ char modep[15];
+
+ (void)printf("%6ju %8"PRId64" ", (uintmax_t)sb->st_ino, sb->st_blocks);
+ (void)strmode(sb->st_mode, modep);
+ (void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, MAXLOGNAME - 1,
+ user_from_uid(sb->st_uid, 0), MAXLOGNAME - 1,
+ group_from_gid(sb->st_gid, 0));
+
+ if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode))
+ (void)printf("%#8jx ", (uintmax_t)sb->st_rdev);
+ else
+ (void)printf("%8"PRId64" ", sb->st_size);
+ printtime(sb->st_mtime);
+ (void)printf("%s", name);
+ if (S_ISLNK(sb->st_mode))
+ printlink(accpath);
+ (void)putchar('\n');
+}
+
+static void
+printtime(time_t ftime)
+{
+ char longstring[80];
+ static time_t lnow;
+ const char *format;
+ static int d_first = -1;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ if (lnow == 0)
+ lnow = time(NULL);
+
+#define SIXMONTHS ((365 / 2) * 86400)
+ if (ftime + SIXMONTHS > lnow && ftime < lnow + SIXMONTHS)
+ /* mmm dd hh:mm || dd mmm hh:mm */
+ format = d_first ? "%e %b %R " : "%b %e %R ";
+ else
+ /* mmm dd yyyy || dd mmm yyyy */
+ format = d_first ? "%e %b %Y " : "%b %e %Y ";
+ strftime(longstring, sizeof(longstring), format, localtime(&ftime));
+ fputs(longstring, stdout);
+}
+
+static void
+printlink(char *name)
+{
+ int lnklen;
+ char path[MAXPATHLEN];
+
+ if ((lnklen = readlink(name, path, MAXPATHLEN - 1)) == -1) {
+ warn("%s", name);
+ return;
+ }
+ path[lnklen] = '\0';
+ (void)printf(" -> %s", path);
+}
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
new file mode 100644
index 0000000..bcbeed5
--- /dev/null
+++ b/usr.bin/find/main.c
@@ -0,0 +1,168 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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) 1990, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fts.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "find.h"
+
+time_t now; /* time find was run */
+int dotfd; /* starting directory */
+int ftsoptions; /* options for the ftsopen(3) call */
+int ignore_readdir_race; /* ignore readdir race */
+int isdeprecated; /* using deprecated syntax */
+int isdepth; /* do directories on post-order visit */
+int isoutput; /* user specified output operator */
+int issort; /* do hierarchies in lexicographical order */
+int isxargs; /* don't permit xargs delimiting chars */
+int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */
+int regexp_flags = REG_BASIC; /* use the "basic" regexp by default*/
+int exitstatus;
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ char **p, **start;
+ int Hflag, Lflag, ch;
+
+ (void)setlocale(LC_ALL, "");
+
+ (void)time(&now); /* initialize the time-of-day */
+
+ p = start = argv;
+ Hflag = Lflag = 0;
+ ftsoptions = FTS_NOSTAT | FTS_PHYSICAL;
+ while ((ch = getopt(argc, argv, "EHLPXdf:sx")) != -1)
+ switch (ch) {
+ case 'E':
+ regexp_flags |= REG_EXTENDED;
+ break;
+ case 'H':
+ Hflag = 1;
+ Lflag = 0;
+ break;
+ case 'L':
+ Lflag = 1;
+ Hflag = 0;
+ break;
+ case 'P':
+ Hflag = Lflag = 0;
+ break;
+ case 'X':
+ isxargs = 1;
+ break;
+ case 'd':
+ isdepth = 1;
+ break;
+ case 'f':
+ *p++ = optarg;
+ break;
+ case 's':
+ issort = 1;
+ break;
+ case 'x':
+ ftsoptions |= FTS_XDEV;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (Hflag)
+ ftsoptions |= FTS_COMFOLLOW;
+ if (Lflag) {
+ ftsoptions &= ~FTS_PHYSICAL;
+ ftsoptions |= FTS_LOGICAL;
+ }
+
+ /*
+ * Find first option to delimit the file list. The first argument
+ * that starts with a -, or is a ! or a ( must be interpreted as a
+ * part of the find expression, according to POSIX .2.
+ */
+ for (; *argv != NULL; *p++ = *argv++) {
+ if (argv[0][0] == '-')
+ break;
+ if ((argv[0][0] == '!' || argv[0][0] == '(') &&
+ argv[0][1] == '\0')
+ break;
+ }
+
+ if (p == start)
+ usage();
+ *p = NULL;
+
+ if ((dotfd = open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
+ ftsoptions |= FTS_NOCHDIR;
+
+ exit(find_execute(find_formplan(argv), start));
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n",
+"usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]",
+" find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]");
+ exit(1);
+}
diff --git a/usr.bin/find/misc.c b/usr.bin/find/misc.c
new file mode 100644
index 0000000..df2e502
--- /dev/null
+++ b/usr.bin/find/misc.c
@@ -0,0 +1,115 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/1/94";
+#else
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fts.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "find.h"
+
+/*
+ * brace_subst --
+ * Replace occurrences of {} in s1 with s2 and return the result string.
+ */
+void
+brace_subst(char *orig, char **store, char *path, size_t len)
+{
+ const char *pastorigend, *p, *q;
+ char *dst;
+ size_t newlen, plen;
+
+ plen = strlen(path);
+ newlen = strlen(orig) + 1;
+ pastorigend = orig + newlen;
+ for (p = orig; (q = strstr(p, "{}")) != NULL; p = q + 2) {
+ if (plen > 2 && newlen + plen - 2 < newlen)
+ errx(2, "brace_subst overflow");
+ newlen += plen - 2;
+ }
+ if (newlen > len) {
+ *store = reallocf(*store, newlen);
+ if (*store == NULL)
+ err(2, NULL);
+ }
+ dst = *store;
+ for (p = orig; (q = strstr(p, "{}")) != NULL; p = q + 2) {
+ memcpy(dst, p, q - p);
+ dst += q - p;
+ memcpy(dst, path, plen);
+ dst += plen;
+ }
+ memcpy(dst, p, pastorigend - p);
+}
+
+/*
+ * queryuser --
+ * print a message to standard error and then read input from standard
+ * input. If the input is an affirmative response (according to the
+ * current locale) then 1 is returned.
+ */
+int
+queryuser(char *argv[])
+{
+ char *p, resp[256];
+
+ (void)fprintf(stderr, "\"%s", *argv);
+ while (*++argv)
+ (void)fprintf(stderr, " %s", *argv);
+ (void)fprintf(stderr, "\"? ");
+ (void)fflush(stderr);
+
+ if (fgets(resp, sizeof(resp), stdin) == NULL)
+ *resp = '\0';
+ if ((p = strchr(resp, '\n')) != NULL)
+ *p = '\0';
+ else {
+ (void)fprintf(stderr, "\n");
+ (void)fflush(stderr);
+ }
+ return (rpmatch(resp) == 1);
+}
diff --git a/usr.bin/find/operator.c b/usr.bin/find/operator.c
new file mode 100644
index 0000000..b8a6fe4
--- /dev/null
+++ b/usr.bin/find/operator.c
@@ -0,0 +1,273 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)operator.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <fts.h>
+#include <stdio.h>
+
+#include "find.h"
+
+static PLAN *yanknode(PLAN **);
+static PLAN *yankexpr(PLAN **);
+
+/*
+ * yanknode --
+ * destructively removes the top from the plan
+ */
+static PLAN *
+yanknode(PLAN **planp)
+{
+ PLAN *node; /* top node removed from the plan */
+
+ if ((node = (*planp)) == NULL)
+ return (NULL);
+ (*planp) = (*planp)->next;
+ node->next = NULL;
+ return (node);
+}
+
+/*
+ * yankexpr --
+ * Removes one expression from the plan. This is used mainly by
+ * paren_squish. In comments below, an expression is either a
+ * simple node or a f_expr node containing a list of simple nodes.
+ */
+static PLAN *
+yankexpr(PLAN **planp)
+{
+ PLAN *next; /* temp node holding subexpression results */
+ PLAN *node; /* pointer to returned node or expression */
+ PLAN *tail; /* pointer to tail of subplan */
+ PLAN *subplan; /* pointer to head of ( ) expression */
+
+ /* first pull the top node from the plan */
+ if ((node = yanknode(planp)) == NULL)
+ return (NULL);
+
+ /*
+ * If the node is an '(' then we recursively slurp up expressions
+ * until we find its associated ')'. If it's a closing paren we
+ * just return it and unwind our recursion; all other nodes are
+ * complete expressions, so just return them.
+ */
+ if (node->execute == f_openparen)
+ for (tail = subplan = NULL;;) {
+ if ((next = yankexpr(planp)) == NULL)
+ errx(1, "(: missing closing ')'");
+ /*
+ * If we find a closing ')' we store the collected
+ * subplan in our '(' node and convert the node to
+ * a f_expr. The ')' we found is ignored. Otherwise,
+ * we just continue to add whatever we get to our
+ * subplan.
+ */
+ if (next->execute == f_closeparen) {
+ if (subplan == NULL)
+ errx(1, "(): empty inner expression");
+ node->p_data[0] = subplan;
+ node->execute = f_expr;
+ break;
+ } else {
+ if (subplan == NULL)
+ tail = subplan = next;
+ else {
+ tail->next = next;
+ tail = next;
+ }
+ tail->next = NULL;
+ }
+ }
+ return (node);
+}
+
+/*
+ * paren_squish --
+ * replaces "parenthesized" plans in our search plan with "expr" nodes.
+ */
+PLAN *
+paren_squish(PLAN *plan)
+{
+ PLAN *expr; /* pointer to next expression */
+ PLAN *tail; /* pointer to tail of result plan */
+ PLAN *result; /* pointer to head of result plan */
+
+ result = tail = NULL;
+
+ /*
+ * the basic idea is to have yankexpr do all our work and just
+ * collect its results together.
+ */
+ while ((expr = yankexpr(&plan)) != NULL) {
+ /*
+ * if we find an unclaimed ')' it means there is a missing
+ * '(' someplace.
+ */
+ if (expr->execute == f_closeparen)
+ errx(1, "): no beginning '('");
+
+ /* add the expression to our result plan */
+ if (result == NULL)
+ tail = result = expr;
+ else {
+ tail->next = expr;
+ tail = expr;
+ }
+ tail->next = NULL;
+ }
+ return (result);
+}
+
+/*
+ * not_squish --
+ * compresses "!" expressions in our search plan.
+ */
+PLAN *
+not_squish(PLAN *plan)
+{
+ PLAN *next; /* next node being processed */
+ PLAN *node; /* temporary node used in f_not processing */
+ PLAN *tail; /* pointer to tail of result plan */
+ PLAN *result; /* pointer to head of result plan */
+
+ tail = result = NULL;
+
+ while ((next = yanknode(&plan))) {
+ /*
+ * if we encounter a ( expression ) then look for nots in
+ * the expr subplan.
+ */
+ if (next->execute == f_expr)
+ next->p_data[0] = not_squish(next->p_data[0]);
+
+ /*
+ * if we encounter a not, then snag the next node and place
+ * it in the not's subplan. As an optimization we compress
+ * several not's to zero or one not.
+ */
+ if (next->execute == f_not) {
+ int notlevel = 1;
+
+ node = yanknode(&plan);
+ while (node != NULL && node->execute == f_not) {
+ ++notlevel;
+ node = yanknode(&plan);
+ }
+ if (node == NULL)
+ errx(1, "!: no following expression");
+ if (node->execute == f_or)
+ errx(1, "!: nothing between ! and -o");
+ /*
+ * If we encounter ! ( expr ) then look for nots in
+ * the expr subplan.
+ */
+ if (node->execute == f_expr)
+ node->p_data[0] = not_squish(node->p_data[0]);
+ if (notlevel % 2 != 1)
+ next = node;
+ else
+ next->p_data[0] = node;
+ }
+
+ /* add the node to our result plan */
+ if (result == NULL)
+ tail = result = next;
+ else {
+ tail->next = next;
+ tail = next;
+ }
+ tail->next = NULL;
+ }
+ return (result);
+}
+
+/*
+ * or_squish --
+ * compresses -o expressions in our search plan.
+ */
+PLAN *
+or_squish(PLAN *plan)
+{
+ PLAN *next; /* next node being processed */
+ PLAN *tail; /* pointer to tail of result plan */
+ PLAN *result; /* pointer to head of result plan */
+
+ tail = result = next = NULL;
+
+ while ((next = yanknode(&plan)) != NULL) {
+ /*
+ * if we encounter a ( expression ) then look for or's in
+ * the expr subplan.
+ */
+ if (next->execute == f_expr)
+ next->p_data[0] = or_squish(next->p_data[0]);
+
+ /* if we encounter a not then look for or's in the subplan */
+ if (next->execute == f_not)
+ next->p_data[0] = or_squish(next->p_data[0]);
+
+ /*
+ * if we encounter an or, then place our collected plan in the
+ * or's first subplan and then recursively collect the
+ * remaining stuff into the second subplan and return the or.
+ */
+ if (next->execute == f_or) {
+ if (result == NULL)
+ errx(1, "-o: no expression before -o");
+ next->p_data[0] = result;
+ next->p_data[1] = or_squish(plan);
+ if (next->p_data[1] == NULL)
+ errx(1, "-o: no expression after -o");
+ return (next);
+ }
+
+ /* add the node to our result plan */
+ if (result == NULL)
+ tail = result = next;
+ else {
+ tail->next = next;
+ tail = next;
+ }
+ tail->next = NULL;
+ }
+ return (result);
+}
diff --git a/usr.bin/find/option.c b/usr.bin/find/option.c
new file mode 100644
index 0000000..4fc63b6
--- /dev/null
+++ b/usr.bin/find/option.c
@@ -0,0 +1,198 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Cimarron D. Taylor of the University of California, Berkeley.
+ *
+ * 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 char sccsid[] = "@(#)option.c 8.2 (Berkeley) 4/16/94";
+*/
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <fts.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "find.h"
+
+static int typecompare(const void *, const void *);
+
+/* NB: the following table must be sorted lexically. */
+/* Options listed with C++ comments are in gnu find, but not our find */
+static OPTION const options[] = {
+ { "!", c_simple, f_not, 0 },
+ { "(", c_simple, f_openparen, 0 },
+ { ")", c_simple, f_closeparen, 0 },
+ { "-Bmin", c_Xmin, f_Xmin, F_TIME_B },
+ { "-Bnewer", c_newer, f_newer, F_TIME_B },
+ { "-Btime", c_Xtime, f_Xtime, F_TIME_B },
+ { "-a", c_and, NULL, 0 },
+ { "-acl", c_acl, f_acl, 0 },
+ { "-amin", c_Xmin, f_Xmin, F_TIME_A },
+ { "-and", c_and, NULL, 0 },
+ { "-anewer", c_newer, f_newer, F_TIME_A },
+ { "-atime", c_Xtime, f_Xtime, F_TIME_A },
+ { "-cmin", c_Xmin, f_Xmin, F_TIME_C },
+ { "-cnewer", c_newer, f_newer, F_TIME_C },
+ { "-ctime", c_Xtime, f_Xtime, F_TIME_C },
+ { "-d", c_depth, f_depth, 0 },
+// -daystart
+ { "-delete", c_delete, f_delete, 0 },
+ { "-depth", c_depth, f_depth, 0 },
+ { "-empty", c_empty, f_empty, 0 },
+ { "-exec", c_exec, f_exec, 0 },
+ { "-execdir", c_exec, f_exec, F_EXECDIR },
+ { "-false", c_simple, f_false, 0 },
+ { "-flags", c_flags, f_flags, 0 },
+// -fls
+ { "-follow", c_follow, f_always_true, 0 },
+// -fprint
+// -fprint0
+// -fprintf
+ { "-fstype", c_fstype, f_fstype, 0 },
+ { "-gid", c_group, f_group, 0 },
+ { "-group", c_group, f_group, 0 },
+ { "-ignore_readdir_race",c_ignore_readdir_race, f_always_true,0 },
+ { "-ilname", c_name, f_name, F_LINK | F_IGNCASE },
+ { "-iname", c_name, f_name, F_IGNCASE },
+ { "-inum", c_inum, f_inum, 0 },
+ { "-ipath", c_name, f_path, F_IGNCASE },
+ { "-iregex", c_regex, f_regex, F_IGNCASE },
+ { "-iwholename",c_name, f_path, F_IGNCASE },
+ { "-links", c_links, f_links, 0 },
+ { "-lname", c_name, f_name, F_LINK },
+ { "-ls", c_ls, f_ls, 0 },
+ { "-maxdepth", c_mXXdepth, f_always_true, F_MAXDEPTH },
+ { "-mindepth", c_mXXdepth, f_always_true, 0 },
+ { "-mmin", c_Xmin, f_Xmin, 0 },
+ { "-mnewer", c_newer, f_newer, 0 },
+ { "-mount", c_xdev, f_always_true, 0 },
+ { "-mtime", c_Xtime, f_Xtime, 0 },
+ { "-name", c_name, f_name, 0 },
+ { "-newer", c_newer, f_newer, 0 },
+ { "-newerBB", c_newer, f_newer, F_TIME_B | F_TIME2_B },
+ { "-newerBa", c_newer, f_newer, F_TIME_B | F_TIME2_A },
+ { "-newerBc", c_newer, f_newer, F_TIME_B | F_TIME2_C },
+ { "-newerBm", c_newer, f_newer, F_TIME_B },
+ { "-newerBt", c_newer, f_newer, F_TIME_B | F_TIME2_T },
+ { "-neweraB", c_newer, f_newer, F_TIME_A | F_TIME2_B },
+ { "-neweraa", c_newer, f_newer, F_TIME_A | F_TIME2_A },
+ { "-newerac", c_newer, f_newer, F_TIME_A | F_TIME2_C },
+ { "-neweram", c_newer, f_newer, F_TIME_A },
+ { "-newerat", c_newer, f_newer, F_TIME_A | F_TIME2_T },
+ { "-newercB", c_newer, f_newer, F_TIME_C | F_TIME2_B },
+ { "-newerca", c_newer, f_newer, F_TIME_C | F_TIME2_A },
+ { "-newercc", c_newer, f_newer, F_TIME_C | F_TIME2_C },
+ { "-newercm", c_newer, f_newer, F_TIME_C },
+ { "-newerct", c_newer, f_newer, F_TIME_C | F_TIME2_T },
+ { "-newermB", c_newer, f_newer, F_TIME2_B },
+ { "-newerma", c_newer, f_newer, F_TIME2_A },
+ { "-newermc", c_newer, f_newer, F_TIME2_C },
+ { "-newermm", c_newer, f_newer, 0 },
+ { "-newermt", c_newer, f_newer, F_TIME2_T },
+ { "-nogroup", c_nogroup, f_nogroup, 0 },
+ { "-noignore_readdir_race",c_ignore_readdir_race, f_always_true,0 },
+ { "-noleaf", c_simple, f_always_true, 0 },
+ { "-not", c_simple, f_not, 0 },
+ { "-nouser", c_nouser, f_nouser, 0 },
+ { "-o", c_simple, f_or, 0 },
+ { "-ok", c_exec, f_exec, F_NEEDOK },
+ { "-okdir", c_exec, f_exec, F_NEEDOK | F_EXECDIR },
+ { "-or", c_simple, f_or, 0 },
+ { "-path", c_name, f_path, 0 },
+ { "-perm", c_perm, f_perm, 0 },
+ { "-print", c_print, f_print, 0 },
+ { "-print0", c_print, f_print0, 0 },
+// -printf
+ { "-prune", c_simple, f_prune, 0 },
+ { "-quit", c_simple, f_quit, 0 },
+ { "-regex", c_regex, f_regex, 0 },
+ { "-samefile", c_samefile, f_inum, 0 },
+ { "-size", c_size, f_size, 0 },
+ { "-sparse", c_sparse, f_sparse, 0 },
+ { "-true", c_simple, f_always_true, 0 },
+ { "-type", c_type, f_type, 0 },
+ { "-uid", c_user, f_user, 0 },
+ { "-user", c_user, f_user, 0 },
+ { "-wholename", c_name, f_path, 0 },
+ { "-xdev", c_xdev, f_always_true, 0 },
+// -xtype
+};
+
+/*
+ * find_create --
+ * create a node corresponding to a command line argument.
+ *
+ * TODO:
+ * add create/process function pointers to node, so we can skip
+ * this switch stuff.
+ */
+PLAN *
+find_create(char ***argvp)
+{
+ OPTION *p;
+ PLAN *new;
+ char **argv;
+
+ argv = *argvp;
+
+ if ((p = lookup_option(*argv)) == NULL)
+ errx(1, "%s: unknown primary or operator", *argv);
+ ++argv;
+
+ new = (p->create)(p, &argv);
+ *argvp = argv;
+ return (new);
+}
+
+OPTION *
+lookup_option(const char *name)
+{
+ OPTION tmp;
+
+ tmp.name = name;
+ return ((OPTION *)bsearch(&tmp, options,
+ sizeof(options)/sizeof(OPTION), sizeof(OPTION), typecompare));
+}
+
+static int
+typecompare(const void *a, const void *b)
+{
+ return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name));
+}
diff --git a/usr.bin/finger/Makefile b/usr.bin/finger/Makefile
new file mode 100644
index 0000000..983392b
--- /dev/null
+++ b/usr.bin/finger/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= finger
+SRCS= finger.c lprint.c net.c sprint.c util.c
+MAN= finger.1 finger.conf.5
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/finger/Makefile.depend b/usr.bin/finger/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/finger/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/finger/extern.h b/usr.bin/finger/extern.h
new file mode 100644
index 0000000..cc2a203
--- /dev/null
+++ b/usr.bin/finger/extern.h
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.2 (Berkeley) 4/28/95
+ * $FreeBSD$
+ */
+
+#ifndef _EXTERN_H_
+#define _EXTERN_H_
+
+extern char tbuf[1024]; /* Temp buffer for anybody. */
+extern int entries; /* Number of people. */
+extern DB *db; /* Database. */
+extern int d_first;
+extern sa_family_t family;
+extern int gflag;
+extern int lflag;
+extern time_t now;
+extern int oflag;
+extern int pplan; /* don't show .plan/.project */
+extern int invoker_root; /* Invoked by root */
+
+void enter_lastlog(PERSON *);
+PERSON *enter_person(struct passwd *);
+void enter_where(struct utmpx *, PERSON *);
+PERSON *find_person(char *);
+int hide(struct passwd *);
+void lflag_print(void);
+int match(struct passwd *, const char *);
+void netfinger(char *);
+PERSON *palloc(void);
+char *prphone(char *);
+void sflag_print(void);
+int show_text(const char *, const char *, const char *);
+
+#endif /* !_EXTERN_H_ */
diff --git a/usr.bin/finger/finger.1 b/usr.bin/finger/finger.1
new file mode 100644
index 0000000..b430ab4
--- /dev/null
+++ b/usr.bin/finger/finger.1
@@ -0,0 +1,245 @@
+.\" Copyright (c) 1989, 1990, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)finger.1 8.3 (Berkeley) 5/5/94
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2010
+.Dt FINGER 1
+.Os
+.Sh NAME
+.Nm finger
+.Nd user information lookup program
+.Sh SYNOPSIS
+.Nm
+.Op Fl 46gklmpsho
+.Op Ar user ...\&
+.Op Ar user@host ...\&
+.Sh DESCRIPTION
+The
+.Nm
+utility displays information about the system users.
+.Pp
+Options are:
+.Bl -tag -width indent
+.It Fl 4
+Forces
+.Nm
+to use IPv4 addresses only.
+.It Fl 6
+Forces
+.Nm
+to use IPv6 addresses only.
+.It Fl s
+Display the user's login name, real name, terminal name and write
+status (as a ``*'' before the terminal name if write permission is
+denied), idle time, login time, and either office location and office
+phone number, or the remote host.
+If
+.Fl o
+is given, the office location and office phone number is printed
+(the default).
+If
+.Fl h
+is given, the remote host is printed instead.
+.Pp
+Idle time is in minutes if it is a single integer, hours and minutes
+if a ``:'' is present, or days if a ``d'' is present.
+If it is an
+.Dq * ,
+the login time indicates the time of last login.
+Login time is displayed as the day name if less than 6 days, else month, day;
+hours and minutes, unless more than six months ago, in which case the year
+is displayed rather than the hours and minutes.
+.Pp
+Unknown devices as well as nonexistent idle and login times are
+displayed as single asterisks.
+.It Fl h
+When used in conjunction with the
+.Fl s
+option, the name of the remote host is displayed instead of the office
+location and office phone.
+.It Fl o
+When used in conjunction with the
+.Fl s
+option, the office location and office phone information is displayed
+instead of the name of the remote host.
+.It Fl g
+This option restricts the gecos output to only the users' real
+name.
+It also has the side-effect of restricting the output
+of the remote host when used in conjunction with the
+.Fl h
+option.
+.It Fl k
+Disable all use of the user accounting database.
+.It Fl l
+Produce a multi-line format displaying all of the information
+described for the
+.Fl s
+option as well as the user's home directory, home phone number, login
+shell, mail status, and the contents of the files
+.Pa .forward ,
+.Pa .plan ,
+.Pa .project
+and
+.Pa .pubkey
+from the user's home directory.
+.Pp
+If idle time is at least a minute and less than a day, it is
+presented in the form ``hh:mm''.
+Idle times greater than a day are presented as ``d day[s]hh:mm''.
+.Pp
+Phone numbers specified as eleven digits are printed as ``+N-NNN-NNN-NNNN''.
+Numbers specified as ten or seven digits are printed as the appropriate
+subset of that string.
+Numbers specified as five digits are printed as ``xN-NNNN''.
+Numbers specified as four digits are printed as ``xNNNN''.
+.Pp
+If write permission is denied to the device, the phrase ``(messages off)''
+is appended to the line containing the device name.
+One entry per user is displayed with the
+.Fl l
+option; if a user is logged on multiple times, terminal information
+is repeated once per login.
+.Pp
+Mail status is shown as ``No Mail.'' if there is no mail at all, ``Mail
+last read DDD MMM ## HH:MM YYYY (TZ)'' if the person has looked at their
+mailbox since new mail arriving, or ``New mail received ...'', ``Unread
+since ...'' if they have new mail.
+.It Fl p
+Prevent
+the
+.Fl l
+option of
+.Nm
+from displaying the contents of the
+.Pa .forward ,
+.Pa .plan ,
+.Pa .project
+and
+.Pa .pubkey
+files.
+.It Fl m
+Prevent matching of
+.Ar user
+names.
+.Ar User
+is usually a login name; however, matching will also be done on the
+users' real names, unless the
+.Fl m
+option is supplied.
+All name matching performed by
+.Nm
+is case insensitive.
+.El
+.Pp
+If no options are specified,
+.Nm
+defaults to the
+.Fl l
+style output if operands are provided, otherwise to the
+.Fl s
+style.
+Note that some fields may be missing, in either format, if information
+is not available for them.
+.Pp
+If no arguments are specified,
+.Nm
+will print an entry for each user currently logged into the system.
+.Pp
+The
+.Nm
+utility may be used to look up users on a remote machine.
+The format is to specify a
+.Ar user
+as
+.Dq Li user@host ,
+or
+.Dq Li @host ,
+where the default output
+format for the former is the
+.Fl l
+style, and the default output format for the latter is the
+.Fl s
+style.
+The
+.Fl l
+option is the only option that may be passed to a remote machine.
+.Pp
+If the file
+.Pa .nofinger
+exists in the user's home directory,
+and the program is not run with superuser privileges,
+.Nm
+behaves as if the user in question does not exist.
+.Pp
+The optional
+.Xr finger.conf 5
+configuration file can be used to specify aliases.
+Since
+.Nm
+is invoked by
+.Xr fingerd 8 ,
+aliases will work for both local and network queries.
+.Sh ENVIRONMENT
+The
+.Nm
+utility utilizes the following environment variable, if it exists:
+.Bl -tag -width Fl
+.It Ev FINGER
+This variable may be set with favored options to
+.Nm .
+.El
+.Sh FILES
+.Bl -tag -width /var/log/utx.lastlogin -compact
+.It Pa /etc/finger.conf
+alias definition data base
+.It Pa /var/log/utx.lastlogin
+last login data base
+.El
+.Sh SEE ALSO
+.Xr chpass 1 ,
+.Xr w 1 ,
+.Xr who 1 ,
+.Xr finger.conf 5 ,
+.Xr fingerd 8
+.Rs
+.%A D. Zimmerman
+.%T The Finger User Information Protocol
+.%R RFC 1288
+.%D December, 1991
+.Re
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Sh BUGS
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
new file mode 100644
index 0000000..0a4e952
--- /dev/null
+++ b/usr.bin/finger/finger.c
@@ -0,0 +1,406 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ */
+
+/*
+ * Luke Mewburn <lm@rmit.edu.au> added the following on 940622:
+ * - mail status ("No Mail", "Mail read:...", or "New Mail ...,
+ * Unread since ...".)
+ * - 4 digit phone extensions (3210 is printed as x3210.)
+ * - host/office toggling in short format with -h & -o.
+ * - short day names (`Tue' printed instead of `Jun 21' if the
+ * login time is < 6 days.
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Finger prints out information about users. It is not portable since
+ * certain fields (e.g. the full user name, office, and phone numbers) are
+ * extracted from the gecos field of the passwd file which other UNIXes
+ * may not have or may use for other things.
+ *
+ * There are currently two output formats; the short format is one line
+ * per user and displays login name, tty, login time, real name, idle time,
+ * and either remote host information (default) or office location/phone
+ * number, depending on if -h or -o is used respectively.
+ * The long format gives the same information (in a more legible format) as
+ * well as home directory, shell, mail info, and .plan/.project files.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <db.h>
+#include <err.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <locale.h>
+
+#include "finger.h"
+#include "pathnames.h"
+
+DB *db;
+time_t now;
+static int kflag, mflag, sflag;
+int entries, gflag, lflag, pplan, oflag;
+sa_family_t family = PF_UNSPEC;
+int d_first = -1;
+char tbuf[1024];
+int invoker_root = 0;
+
+static void loginlist(void);
+static int option(int, char **);
+static void usage(void);
+static void userlist(int, char **);
+
+static int
+option(int argc, char **argv)
+{
+ int ch;
+
+ optind = 1; /* reset getopt */
+
+ while ((ch = getopt(argc, argv, "46gklmpsho")) != -1)
+ switch(ch) {
+ case '4':
+ family = AF_INET;
+ break;
+ case '6':
+ family = AF_INET6;
+ break;
+ case 'g':
+ gflag = 1;
+ break;
+ case 'k':
+ kflag = 1; /* keep going without utmp */
+ break;
+ case 'l':
+ lflag = 1; /* long format */
+ break;
+ case 'm':
+ mflag = 1; /* force exact match of names */
+ break;
+ case 'p':
+ pplan = 1; /* don't show .plan/.project */
+ break;
+ case 's':
+ sflag = 1; /* short format */
+ break;
+ case 'h':
+ oflag = 0; /* remote host info */
+ break;
+ case 'o':
+ oflag = 1; /* office info */
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ return optind;
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: finger [-46gklmpsho] [user ...] [user@host ...]\n");
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ int envargc, argcnt;
+ char *envargv[3];
+ struct passwd *pw;
+ static char myname[] = "finger";
+
+ if (getuid() == 0 || geteuid() == 0) {
+ invoker_root = 1;
+ if ((pw = getpwnam(UNPRIV_NAME)) && pw->pw_uid > 0) {
+ if (setgid(pw->pw_gid) != 0)
+ err(1, "setgid()");
+ if (setuid(pw->pw_uid) != 0)
+ err(1, "setuid()");
+ } else {
+ if (setgid(UNPRIV_UGID) != 0)
+ err(1, "setgid()");
+ if (setuid(UNPRIV_UGID) != 0)
+ err(1, "setuid()");
+ }
+ }
+
+ (void) setlocale(LC_ALL, "");
+
+ /* remove this line to get remote host */
+ oflag = 1; /* default to old "office" behavior */
+
+ /*
+ * Process environment variables followed by command line arguments.
+ */
+ if ((envargv[1] = getenv("FINGER"))) {
+ envargc = 2;
+ envargv[0] = myname;
+ envargv[2] = NULL;
+ (void) option(envargc, envargv);
+ }
+
+ argcnt = option(argc, argv);
+ argc -= argcnt;
+ argv += argcnt;
+
+ (void)time(&now);
+ setpassent(1);
+ if (!*argv) {
+ /*
+ * Assign explicit "small" format if no names given and -l
+ * not selected. Force the -s BEFORE we get names so proper
+ * screening will be done.
+ */
+ if (!lflag)
+ sflag = 1; /* if -l not explicit, force -s */
+ loginlist();
+ if (entries == 0)
+ (void)printf("No one logged on.\n");
+ } else {
+ userlist(argc, argv);
+ /*
+ * Assign explicit "large" format if names given and -s not
+ * explicitly stated. Force the -l AFTER we get names so any
+ * remote finger attempts specified won't be mishandled.
+ */
+ if (!sflag)
+ lflag = 1; /* if -s not explicit, force -l */
+ }
+ if (entries) {
+ if (lflag)
+ lflag_print();
+ else
+ sflag_print();
+ }
+ return (0);
+}
+
+static void
+loginlist(void)
+{
+ PERSON *pn;
+ DBT data, key;
+ struct passwd *pw;
+ struct utmpx *user;
+ int r, sflag1;
+
+ if (kflag)
+ errx(1, "can't list logins without reading utmp");
+
+ setutxent();
+ while ((user = getutxent()) != NULL) {
+ if (user->ut_type != USER_PROCESS)
+ continue;
+ if ((pn = find_person(user->ut_user)) == NULL) {
+ if ((pw = getpwnam(user->ut_user)) == NULL)
+ continue;
+ if (hide(pw))
+ continue;
+ pn = enter_person(pw);
+ }
+ enter_where(user, pn);
+ }
+ endutxent();
+ if (db && lflag)
+ for (sflag1 = R_FIRST;; sflag1 = R_NEXT) {
+ PERSON *tmp;
+
+ r = (*db->seq)(db, &key, &data, sflag1);
+ if (r == -1)
+ err(1, "db seq");
+ if (r == 1)
+ break;
+ memmove(&tmp, data.data, sizeof tmp);
+ enter_lastlog(tmp);
+ }
+}
+
+static void
+userlist(int argc, char **argv)
+{
+ PERSON *pn;
+ DBT data, key;
+ struct utmpx *user;
+ struct passwd *pw;
+ int r, sflag1, *used, *ip;
+ char **ap, **nargv, **np, **p;
+ FILE *conf_fp;
+ char conf_alias[LINE_MAX];
+ char *conf_realname;
+ int conf_length;
+
+ if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
+ (used = calloc(argc, sizeof(int))) == NULL)
+ err(1, NULL);
+
+ /* Pull out all network requests. */
+ for (ap = p = argv, np = nargv; *p; ++p)
+ if (strchr(*p, '@'))
+ *np++ = *p;
+ else
+ *ap++ = *p;
+
+ *np++ = NULL;
+ *ap++ = NULL;
+
+ if (!*argv)
+ goto net;
+
+ /*
+ * Mark any arguments beginning with '/' as invalid so that we
+ * don't accidentally confuse them with expansions from finger.conf
+ */
+ for (p = argv, ip = used; *p; ++p, ++ip)
+ if (**p == '/') {
+ *ip = 1;
+ warnx("%s: no such user", *p);
+ }
+
+ /*
+ * Traverse the finger alias configuration file of the form
+ * alias:(user|alias), ignoring comment lines beginning '#'.
+ */
+ if ((conf_fp = fopen(_PATH_FINGERCONF, "r")) != NULL) {
+ while(fgets(conf_alias, sizeof(conf_alias), conf_fp) != NULL) {
+ conf_length = strlen(conf_alias);
+ if (*conf_alias == '#' || conf_alias[--conf_length] != '\n')
+ continue;
+ conf_alias[conf_length] = '\0'; /* Remove trailing LF */
+ if ((conf_realname = strchr(conf_alias, ':')) == NULL)
+ continue;
+ *conf_realname = '\0'; /* Replace : with NUL */
+ for (p = argv; *p; ++p) {
+ if (strcmp(*p, conf_alias) == 0) {
+ if ((*p = strdup(conf_realname+1)) == NULL) {
+ err(1, NULL);
+ }
+ }
+ }
+ }
+ (void)fclose(conf_fp);
+ }
+
+ /*
+ * Traverse the list of possible login names and check the login name
+ * and real name against the name specified by the user. If the name
+ * begins with a '/', try to read the file of that name instead of
+ * gathering the traditional finger information.
+ */
+ if (mflag)
+ for (p = argv, ip = used; *p; ++p, ++ip) {
+ if (**p != '/' || *ip == 1 || !show_text("", *p, "")) {
+ if (((pw = getpwnam(*p)) != NULL) && !hide(pw))
+ enter_person(pw);
+ else if (!*ip)
+ warnx("%s: no such user", *p);
+ }
+ }
+ else {
+ while ((pw = getpwent()) != NULL) {
+ for (p = argv, ip = used; *p; ++p, ++ip)
+ if (**p == '/' && *ip != 1
+ && show_text("", *p, ""))
+ *ip = 1;
+ else if (match(pw, *p) && !hide(pw)) {
+ enter_person(pw);
+ *ip = 1;
+ }
+ }
+ for (p = argv, ip = used; *p; ++p, ++ip)
+ if (!*ip)
+ warnx("%s: no such user", *p);
+ }
+
+ /* Handle network requests. */
+net: for (p = nargv; *p;) {
+ netfinger(*p++);
+ if (*p || entries)
+ printf("\n");
+ }
+
+ free(used);
+ if (entries == 0)
+ return;
+
+ if (kflag)
+ return;
+
+ /*
+ * Scan thru the list of users currently logged in, saving
+ * appropriate data whenever a match occurs.
+ */
+ setutxent();
+ while ((user = getutxent()) != NULL) {
+ if (user->ut_type != USER_PROCESS)
+ continue;
+ if ((pn = find_person(user->ut_user)) == NULL)
+ continue;
+ enter_where(user, pn);
+ }
+ endutxent();
+ if (db)
+ for (sflag1 = R_FIRST;; sflag1 = R_NEXT) {
+ PERSON *tmp;
+
+ r = (*db->seq)(db, &key, &data, sflag1);
+ if (r == -1)
+ err(1, "db seq");
+ if (r == 1)
+ break;
+ memmove(&tmp, data.data, sizeof tmp);
+ enter_lastlog(tmp);
+ }
+}
diff --git a/usr.bin/finger/finger.conf.5 b/usr.bin/finger/finger.conf.5
new file mode 100644
index 0000000..54f5eec
--- /dev/null
+++ b/usr.bin/finger/finger.conf.5
@@ -0,0 +1,91 @@
+.\" Copyright (c) 2000 Mark Knight <markk@knigma.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 August 16, 2000
+.Dt FINGER.CONF 5
+.Os
+.Sh NAME
+.Nm finger.conf
+.Nd
+.Xr finger 1
+alias configuration file
+.Sh DESCRIPTION
+The optional
+.Nm
+file is used to provide aliases that can be fingered by local
+and network users.
+This may be useful where a user's login name is not the same
+as their preferred mail address, or for providing virtual login names
+than can be fingered.
+.Pp
+Lines beginning with ``#'' are comments.
+Other lines must consist of an
+alias name and a target name separated by a colon.
+A target name should be either a user, a forward
+reference to another alias or the path of a world readable file.
+.Pp
+Where an alias points to a file, the contents of that file will be displayed
+when the alias is fingered.
+.Sh FILES
+.Bl -tag -width /etc/finger.conf -compact
+.It Pa /etc/finger.conf
+.Xr finger 1
+alias definition data base
+.El
+.Sh EXAMPLES
+.Bd -literal
+# /etc/finger.conf alias definition file
+#
+# Format alias:(user|alias)
+#
+# Individual aliases
+#
+markk:mkn
+john.smith:dev329
+john:dev329
+sue:/etc/finger/sue.txt
+#
+# Network status message
+#
+status:/usr/local/etc/status.txt
+#
+# Administrative redirects
+#
+root:admin
+postmaster:admin
+abuse:admin
+#
+# For the time being, 'sod' is sysadmin.
+#
+admin:sod
+.Ed
+.Sh SEE ALSO
+.Xr finger 1
+.Sh HISTORY
+Support for the
+.Nm
+file was submitted by Mark Knight <markk@knigma.org> and first appeared in
+.Fx 4.2 .
diff --git a/usr.bin/finger/finger.h b/usr.bin/finger/finger.h
new file mode 100644
index 0000000..2b70554
--- /dev/null
+++ b/usr.bin/finger/finger.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ *
+ * @(#)finger.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#ifndef _FINGER_H_
+#define _FINGER_H_
+
+typedef struct person {
+ uid_t uid; /* user id */
+ char *dir; /* user's home directory */
+ char *homephone; /* pointer to home phone no. */
+ char *name; /* login name */
+ char *office; /* pointer to office name */
+ char *officephone; /* pointer to office phone no. */
+ char *realname; /* pointer to full name */
+ char *shell; /* user's shell */
+ time_t mailread; /* last time mail was read */
+ time_t mailrecv; /* last time mail was received */
+ struct where *whead, *wtail; /* list of where user is or has been */
+} PERSON;
+
+enum status { LASTLOG, LOGGEDIN };
+
+typedef struct where {
+ struct where *next; /* next place user is or has been */
+ enum status info; /* type/status of request */
+ short writable; /* tty is writable */
+ time_t loginat; /* time of (last) login */
+ time_t idletime; /* how long idle (if logged in) */
+ char tty[sizeof ((struct utmpx *)0)->ut_line]; /* tty line */
+ char host[sizeof ((struct utmpx *)0)->ut_host]; /* host name */
+} WHERE;
+
+#define UNPRIV_NAME "nobody" /* Preferred privilege level */
+#define UNPRIV_UGID 32767 /* Default uid and gid */
+#define OUTPUT_MAX 100000 /* Do not keep listinging forever */
+#define TIME_LIMIT 360 /* Do not keep listinging forever */
+
+#include "extern.h"
+
+#endif /* !_FINGER_H_ */
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
new file mode 100644
index 0000000..db902df
--- /dev/null
+++ b/usr.bin/finger/lprint.c
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <ctype.h>
+#include <db.h>
+#include <err.h>
+#include <fcntl.h>
+#include <langinfo.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include "finger.h"
+#include "pathnames.h"
+
+#define LINE_LEN 80
+#define TAB_LEN 8 /* 8 spaces between tabs */
+
+static int demi_print(char *, int);
+static void lprint(PERSON *);
+static void vputc(unsigned char);
+
+void
+lflag_print(void)
+{
+ PERSON *pn;
+ int sflag, r;
+ PERSON *tmp;
+ DBT data, key;
+
+ for (sflag = R_FIRST;; sflag = R_NEXT) {
+ r = (*db->seq)(db, &key, &data, sflag);
+ if (r == -1)
+ err(1, "db seq");
+ if (r == 1)
+ break;
+ memmove(&tmp, data.data, sizeof tmp);
+ pn = tmp;
+ if (sflag != R_FIRST)
+ putchar('\n');
+ lprint(pn);
+ if (!pplan) {
+ (void)show_text(pn->dir,
+ _PATH_FORWARD, "Mail forwarded to");
+ (void)show_text(pn->dir, _PATH_PROJECT, "Project");
+ if (!show_text(pn->dir, _PATH_PLAN, "Plan"))
+ (void)printf("No Plan.\n");
+ (void)show_text(pn->dir,
+ _PATH_PUBKEY, "Public key");
+ }
+ }
+}
+
+static void
+lprint(PERSON *pn)
+{
+ struct tm *delta;
+ WHERE *w;
+ int cpr, len, maxlen;
+ struct tm *tp;
+ int oddfield;
+ char t[80];
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ /*
+ * long format --
+ * login name
+ * real name
+ * home directory
+ * shell
+ * office, office phone, home phone if available
+ * mail status
+ */
+ (void)printf("Login: %-15s\t\t\tName: %s\nDirectory: %-25s",
+ pn->name, pn->realname, pn->dir);
+ (void)printf("\tShell: %-s\n", *pn->shell ? pn->shell : _PATH_BSHELL);
+
+ if (gflag)
+ goto no_gecos;
+ /*
+ * try and print office, office phone, and home phone on one line;
+ * if that fails, do line filling so it looks nice.
+ */
+#define OFFICE_TAG "Office"
+#define OFFICE_PHONE_TAG "Office Phone"
+ oddfield = 0;
+ if (pn->office && pn->officephone &&
+ strlen(pn->office) + strlen(pn->officephone) +
+ sizeof(OFFICE_TAG) + 2 <= 5 * TAB_LEN) {
+ (void)snprintf(tbuf, sizeof(tbuf), "%s: %s, %s",
+ OFFICE_TAG, pn->office, prphone(pn->officephone));
+ oddfield = demi_print(tbuf, oddfield);
+ } else {
+ if (pn->office) {
+ (void)snprintf(tbuf, sizeof(tbuf), "%s: %s",
+ OFFICE_TAG, pn->office);
+ oddfield = demi_print(tbuf, oddfield);
+ }
+ if (pn->officephone) {
+ (void)snprintf(tbuf, sizeof(tbuf), "%s: %s",
+ OFFICE_PHONE_TAG, prphone(pn->officephone));
+ oddfield = demi_print(tbuf, oddfield);
+ }
+ }
+ if (pn->homephone) {
+ (void)snprintf(tbuf, sizeof(tbuf), "%s: %s", "Home Phone",
+ prphone(pn->homephone));
+ oddfield = demi_print(tbuf, oddfield);
+ }
+ if (oddfield)
+ putchar('\n');
+
+no_gecos:
+ /*
+ * long format con't:
+ * if logged in
+ * terminal
+ * idle time
+ * if messages allowed
+ * where logged in from
+ * if not logged in
+ * when last logged in
+ */
+ /* find out longest device name for this user for formatting */
+ for (w = pn->whead, maxlen = -1; w != NULL; w = w->next)
+ if ((len = strlen(w->tty)) > maxlen)
+ maxlen = len;
+ /* find rest of entries for user */
+ for (w = pn->whead; w != NULL; w = w->next) {
+ if (w->info == LOGGEDIN) {
+ tp = localtime(&w->loginat);
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R (%Z)" : "%a %b %e %R (%Z)",
+ tp);
+ cpr = printf("On since %s on %s", t, w->tty);
+ /*
+ * idle time is tough; if have one, print a comma,
+ * then spaces to pad out the device name, then the
+ * idle time. Follow with a comma if a remote login.
+ */
+ delta = gmtime(&w->idletime);
+ if (w->idletime != -1 && (delta->tm_yday ||
+ delta->tm_hour || delta->tm_min)) {
+ cpr += printf("%-*s idle ",
+ maxlen - (int)strlen(w->tty) + 1, ",");
+ if (delta->tm_yday > 0) {
+ cpr += printf("%d day%s ",
+ delta->tm_yday,
+ delta->tm_yday == 1 ? "" : "s");
+ }
+ cpr += printf("%d:%02d",
+ delta->tm_hour, delta->tm_min);
+ if (*w->host) {
+ putchar(',');
+ ++cpr;
+ }
+ }
+ if (!w->writable)
+ cpr += printf(" (messages off)");
+ } else if (w->loginat == 0) {
+ cpr = printf("Never logged in.");
+ } else {
+ tp = localtime(&w->loginat);
+ if (now - w->loginat > 86400 * 365 / 2) {
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R %Y (%Z)" :
+ "%a %b %e %R %Y (%Z)",
+ tp);
+ } else {
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R (%Z)" :
+ "%a %b %e %R (%Z)",
+ tp);
+ }
+ cpr = printf("Last login %s on %s", t, w->tty);
+ }
+ if (*w->host) {
+ if (LINE_LEN < (cpr + 6 + strlen(w->host)))
+ (void)printf("\n ");
+ (void)printf(" from %s", w->host);
+ }
+ putchar('\n');
+ }
+ if (pn->mailrecv == -1)
+ printf("No Mail.\n");
+ else if (pn->mailrecv > pn->mailread) {
+ tp = localtime(&pn->mailrecv);
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R %Y (%Z)" :
+ "%a %b %e %R %Y (%Z)",
+ tp);
+ printf("New mail received %s\n", t);
+ tp = localtime(&pn->mailread);
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R %Y (%Z)" :
+ "%a %b %e %R %Y (%Z)",
+ tp);
+ printf(" Unread since %s\n", t);
+ } else {
+ tp = localtime(&pn->mailread);
+ strftime(t, sizeof(t),
+ d_first ? "%a %e %b %R %Y (%Z)" :
+ "%a %b %e %R %Y (%Z)",
+ tp);
+ printf("Mail last read %s\n", t);
+ }
+}
+
+static int
+demi_print(char *str, int oddfield)
+{
+ static int lenlast;
+ int lenthis, maxlen;
+
+ lenthis = strlen(str);
+ if (oddfield) {
+ /*
+ * We left off on an odd number of fields. If we haven't
+ * crossed the midpoint of the screen, and we have room for
+ * the next field, print it on the same line; otherwise,
+ * print it on a new line.
+ *
+ * Note: we insist on having the right hand fields start
+ * no less than 5 tabs out.
+ */
+ maxlen = 5 * TAB_LEN;
+ if (maxlen < lenlast)
+ maxlen = lenlast;
+ if (((((maxlen / TAB_LEN) + 1) * TAB_LEN) +
+ lenthis) <= LINE_LEN) {
+ while(lenlast < (4 * TAB_LEN)) {
+ putchar('\t');
+ lenlast += TAB_LEN;
+ }
+ (void)printf("\t%s\n", str); /* force one tab */
+ } else {
+ (void)printf("\n%s", str); /* go to next line */
+ oddfield = !oddfield; /* this'll be undone below */
+ }
+ } else
+ (void)printf("%s", str);
+ oddfield = !oddfield; /* toggle odd/even marker */
+ lenlast = lenthis;
+ return(oddfield);
+}
+
+int
+show_text(const char *directory, const char *file_name, const char *header)
+{
+ struct stat sb;
+ FILE *fp;
+ int ch, cnt;
+ char *p, lastc;
+ int fd, nr;
+
+ lastc = '\0';
+
+ (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", directory, file_name);
+ if ((fd = open(tbuf, O_RDONLY)) < 0 || fstat(fd, &sb) ||
+ sb.st_size == 0)
+ return(0);
+
+ /* If short enough, and no newlines, show it on a single line.*/
+ if (sb.st_size <= (off_t)(LINE_LEN - strlen(header) - 5)) {
+ nr = read(fd, tbuf, sizeof(tbuf));
+ if (nr <= 0) {
+ (void)close(fd);
+ return(0);
+ }
+ for (p = tbuf, cnt = nr; cnt--; ++p)
+ if (*p == '\n')
+ break;
+ if (cnt <= 1) {
+ if (*header != '\0')
+ (void)printf("%s: ", header);
+ for (p = tbuf, cnt = nr; cnt--; ++p)
+ if (*p != '\r')
+ vputc(lastc = *p);
+ if (lastc != '\n')
+ (void)putchar('\n');
+ (void)close(fd);
+ return(1);
+ }
+ else
+ (void)lseek(fd, 0L, SEEK_SET);
+ }
+ if ((fp = fdopen(fd, "r")) == NULL)
+ return(0);
+ if (*header != '\0')
+ (void)printf("%s:\n", header);
+ while ((ch = getc(fp)) != EOF)
+ if (ch != '\r')
+ vputc(lastc = ch);
+ if (lastc != '\n')
+ (void)putchar('\n');
+ (void)fclose(fp);
+ return(1);
+}
+
+static void
+vputc(unsigned char ch)
+{
+ int meta;
+
+ if (!isprint(ch) && !isascii(ch)) {
+ (void)putchar('M');
+ (void)putchar('-');
+ ch = toascii(ch);
+ meta = 1;
+ } else
+ meta = 0;
+ if (isprint(ch) || (!meta && (ch == ' ' || ch == '\t' || ch == '\n')))
+ (void)putchar(ch);
+ else {
+ (void)putchar('^');
+ (void)putchar(ch == '\177' ? '?' : ch | 0100);
+ }
+}
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
new file mode 100644
index 0000000..db5f96d
--- /dev/null
+++ b/usr.bin/finger/net.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <wctype.h>
+#include <db.h>
+#include <err.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <wchar.h>
+#include "finger.h"
+
+static void cleanup(int sig);
+static int do_protocol(const char *name, const struct addrinfo *ai);
+static void trying(const struct addrinfo *ai);
+
+void
+netfinger(char *name)
+{
+ int error, multi;
+ char *host;
+ struct addrinfo *ai, *ai0;
+ static struct addrinfo hint;
+
+ host = strrchr(name, '@');
+ if (host == NULL)
+ return;
+ *host++ = '\0';
+ signal(SIGALRM, cleanup);
+ alarm(TIME_LIMIT);
+
+ hint.ai_flags = AI_CANONNAME;
+ hint.ai_family = family;
+ hint.ai_socktype = SOCK_STREAM;
+
+ error = getaddrinfo(host, "finger", &hint, &ai0);
+ if (error) {
+ warnx("%s: %s", host, gai_strerror(error));
+ return;
+ }
+
+ multi = (ai0->ai_next) != 0;
+
+ /* ai_canonname may not be filled in if the user specified an IP. */
+ if (ai0->ai_canonname == 0)
+ printf("[%s]\n", host);
+ else
+ printf("[%s]\n", ai0->ai_canonname);
+
+ for (ai = ai0; ai != NULL; ai = ai->ai_next) {
+ if (multi)
+ trying(ai);
+
+ error = do_protocol(name, ai);
+ if (!error)
+ break;
+ }
+ alarm(0);
+ freeaddrinfo(ai0);
+}
+
+static int
+do_protocol(const char *name, const struct addrinfo *ai)
+{
+ int cnt, line_len, s;
+ FILE *fp;
+ wint_t c, lastc;
+ struct iovec iov[3];
+ struct msghdr msg;
+ static char slash_w[] = "/W ";
+ static char neteol[] = "\r\n";
+
+ s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (s < 0) {
+ warn("socket(%d, %d, %d)", ai->ai_family, ai->ai_socktype,
+ ai->ai_protocol);
+ return -1;
+ }
+
+ msg.msg_name = (void *)ai->ai_addr;
+ msg.msg_namelen = ai->ai_addrlen;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 0;
+ msg.msg_control = 0;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
+
+ /* -l flag for remote fingerd */
+ if (lflag) {
+ iov[msg.msg_iovlen].iov_base = slash_w;
+ iov[msg.msg_iovlen++].iov_len = 3;
+ }
+ /* send the name followed by <CR><LF> */
+ iov[msg.msg_iovlen].iov_base = strdup(name);
+ iov[msg.msg_iovlen++].iov_len = strlen(name);
+ iov[msg.msg_iovlen].iov_base = neteol;
+ iov[msg.msg_iovlen++].iov_len = 2;
+
+ if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0) {
+ warn("connect");
+ close(s);
+ return -1;
+ }
+
+ if (sendmsg(s, &msg, 0) < 0) {
+ warn("sendmsg");
+ close(s);
+ return -1;
+ }
+
+ /*
+ * Read from the remote system; once we're connected, we assume some
+ * data. If none arrives, we hang until the user interrupts.
+ *
+ * If we see a <CR> or a <CR> with the high bit set, treat it as
+ * a newline; if followed by a newline character, only output one
+ * newline.
+ *
+ * Otherwise, all high bits are stripped; if it isn't printable and
+ * it isn't a space, we can simply set the 7th bit. Every ASCII
+ * character with bit 7 set is printable.
+ */
+ lastc = 0;
+ if ((fp = fdopen(s, "r")) != NULL) {
+ cnt = 0;
+ line_len = 0;
+ while ((c = getwc(fp)) != EOF) {
+ if (++cnt > OUTPUT_MAX) {
+ printf("\n\n Output truncated at %d bytes...\n",
+ cnt - 1);
+ break;
+ }
+ if (c == 0x0d) {
+ if (lastc == '\r') /* ^M^M - skip dupes */
+ continue;
+ c = '\n';
+ lastc = '\r';
+ } else {
+ if (!iswprint(c) && !iswspace(c)) {
+ c &= 0x7f;
+ c |= 0x40;
+ }
+ if (lastc != '\r' || c != '\n')
+ lastc = c;
+ else {
+ lastc = '\n';
+ continue;
+ }
+ }
+ putwchar(c);
+ if (c != '\n' && ++line_len > _POSIX2_LINE_MAX) {
+ putchar('\\');
+ putchar('\n');
+ lastc = '\r';
+ }
+ if (lastc == '\n' || lastc == '\r')
+ line_len = 0;
+ }
+ if (ferror(fp)) {
+ /*
+ * Assume that whatever it was set errno...
+ */
+ warn("reading from network");
+ }
+ if (lastc != L'\n')
+ putchar('\n');
+
+ fclose(fp);
+ }
+ return 0;
+}
+
+static void
+trying(const struct addrinfo *ai)
+{
+ char buf[NI_MAXHOST];
+
+ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, buf, sizeof buf,
+ (char *)0, 0, NI_NUMERICHOST) != 0)
+ return; /* XXX can't happen */
+
+ printf("Trying %s...\n", buf);
+}
+
+static void
+cleanup(int sig __unused)
+{
+#define ERRSTR "Timed out.\n"
+ write(STDERR_FILENO, ERRSTR, sizeof ERRSTR);
+ exit(1);
+}
+
diff --git a/usr.bin/finger/pathnames.h b/usr.bin/finger/pathnames.h
new file mode 100644
index 0000000..7c9ad19
--- /dev/null
+++ b/usr.bin/finger/pathnames.h
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2000 Mark Knight <markk@knigma.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$
+ */
+
+#ifndef PATHNAMES_H
+
+#define _PATH_FORWARD ".forward"
+#define _PATH_NOFINGER ".nofinger"
+#define _PATH_PLAN ".plan"
+#define _PATH_PROJECT ".project"
+#define _PATH_PUBKEY ".pubkey"
+
+#ifndef _PATH_FINGERCONF
+#define _PATH_FINGERCONF "/etc/finger.conf"
+#endif /* _PATH_FINGERCONF */
+
+#endif /* PATHNAMES_H */
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
new file mode 100644
index 0000000..afbab4e
--- /dev/null
+++ b/usr.bin/finger/sprint.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <db.h>
+#include <err.h>
+#include <langinfo.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <utmpx.h>
+#include "finger.h"
+
+static void stimeprint(WHERE *);
+
+void
+sflag_print(void)
+{
+ PERSON *pn;
+ WHERE *w;
+ int sflag, r, namelen;
+ char p[80];
+ PERSON *tmp;
+ DBT data, key;
+ struct tm *lc;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ /*
+ * short format --
+ * login name
+ * real name
+ * terminal name (the XX of ttyXX)
+ * if terminal writeable (add an '*' to the terminal name
+ * if not)
+ * if logged in show idle time and day logged in, else
+ * show last login date and time.
+ * If > 6 months, show year instead of time.
+ * if (-o)
+ * office location
+ * office phone
+ * else
+ * remote host
+ */
+#define MAXREALNAME 16
+#define MAXHOSTNAME 17 /* in reality, hosts are never longer than 16 */
+ (void)printf("%-*s %-*s%s %s\n", MAXLOGNAME, "Login", MAXREALNAME,
+ "Name", " TTY Idle Login Time ", (gflag) ? "" :
+ oflag ? "Office Phone" : "Where");
+
+ for (sflag = R_FIRST;; sflag = R_NEXT) {
+ r = (*db->seq)(db, &key, &data, sflag);
+ if (r == -1)
+ err(1, "db seq");
+ if (r == 1)
+ break;
+ memmove(&tmp, data.data, sizeof tmp);
+ pn = tmp;
+
+ for (w = pn->whead; w != NULL; w = w->next) {
+ namelen = MAXREALNAME;
+ if (w->info == LOGGEDIN && !w->writable)
+ --namelen; /* leave space before `*' */
+ (void)printf("%-*.*s %-*.*s", MAXLOGNAME, MAXLOGNAME,
+ pn->name, MAXREALNAME, namelen,
+ pn->realname ? pn->realname : "");
+ if (!w->loginat) {
+ (void)printf(" * * No logins ");
+ goto office;
+ }
+ (void)putchar(w->info == LOGGEDIN && !w->writable ?
+ '*' : ' ');
+ if (*w->tty)
+ (void)printf("%-7.7s ",
+ (strncmp(w->tty, "tty", 3)
+ && strncmp(w->tty, "cua", 3))
+ ? w->tty : w->tty + 3);
+ else
+ (void)printf(" ");
+ if (w->info == LOGGEDIN) {
+ stimeprint(w);
+ (void)printf(" ");
+ } else
+ (void)printf(" * ");
+ lc = localtime(&w->loginat);
+#define SECSPERDAY 86400
+#define DAYSPERWEEK 7
+#define DAYSPERNYEAR 365
+ if (now - w->loginat < SECSPERDAY * (DAYSPERWEEK - 1)) {
+ (void)strftime(p, sizeof(p), "%a", lc);
+ } else {
+ (void)strftime(p, sizeof(p),
+ d_first ? "%e %b" : "%b %e", lc);
+ }
+ (void)printf("%-6.6s", p);
+ if (now - w->loginat >= SECSPERDAY * DAYSPERNYEAR / 2) {
+ (void)strftime(p, sizeof(p), "%Y", lc);
+ } else {
+ (void)strftime(p, sizeof(p), "%R", lc);
+ }
+ (void)printf(" %-5.5s", p);
+office:
+ if (gflag)
+ goto no_gecos;
+ if (oflag) {
+ if (pn->office)
+ (void)printf(" %-7.7s", pn->office);
+ else if (pn->officephone)
+ (void)printf(" %-7.7s", " ");
+ if (pn->officephone)
+ (void)printf(" %-.15s",
+ prphone(pn->officephone));
+ } else
+ (void)printf(" %.*s", MAXHOSTNAME, w->host);
+no_gecos:
+ putchar('\n');
+ }
+ }
+}
+
+static void
+stimeprint(WHERE *w)
+{
+ struct tm *delta;
+
+ if (w->idletime == -1) {
+ (void)printf(" ");
+ return;
+ }
+
+ delta = gmtime(&w->idletime);
+ if (!delta->tm_yday)
+ if (!delta->tm_hour)
+ if (!delta->tm_min)
+ (void)printf(" ");
+ else
+ (void)printf("%5d", delta->tm_min);
+ else
+ (void)printf("%2d:%02d",
+ delta->tm_hour, delta->tm_min);
+ else
+ (void)printf("%4dd", delta->tm_yday);
+}
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
new file mode 100644
index 0000000..b7d0d2a
--- /dev/null
+++ b/usr.bin/finger/util.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <db.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include "finger.h"
+#include "pathnames.h"
+
+static void find_idle_and_ttywrite(WHERE *);
+static void userinfo(PERSON *, struct passwd *);
+static WHERE *walloc(PERSON *);
+
+int
+match(struct passwd *pw, const char *user)
+{
+ char *p, *t;
+ char name[1024];
+
+ if (!strcasecmp(pw->pw_name, user))
+ return(1);
+
+ /*
+ * XXX
+ * Why do we skip asterisks!?!?
+ */
+ (void)strncpy(p = tbuf, pw->pw_gecos, sizeof(tbuf));
+ tbuf[sizeof(tbuf) - 1] = '\0';
+ if (*p == '*')
+ ++p;
+
+ /* Ampersands get replaced by the login name. */
+ if ((p = strtok(p, ",")) == NULL)
+ return(0);
+
+ for (t = name; t < &name[sizeof(name) - 1] && (*t = *p) != '\0'; ++p) {
+ if (*t == '&') {
+ (void)strncpy(t, pw->pw_name,
+ sizeof(name) - (t - name));
+ name[sizeof(name) - 1] = '\0';
+ while (t < &name[sizeof(name) - 1] && *++t)
+ continue;
+ } else {
+ ++t;
+ }
+ }
+ *t = '\0';
+ for (t = name; (p = strtok(t, "\t ")) != NULL; t = NULL)
+ if (!strcasecmp(p, user))
+ return(1);
+ return(0);
+}
+
+void
+enter_lastlog(PERSON *pn)
+{
+ WHERE *w;
+ struct utmpx *ut = NULL;
+ char doit = 0;
+
+ if (setutxdb(UTXDB_LASTLOGIN, NULL) == 0)
+ ut = getutxuser(pn->name);
+ if ((w = pn->whead) == NULL)
+ doit = 1;
+ else if (ut != NULL && ut->ut_type == USER_PROCESS) {
+ /* if last login is earlier than some current login */
+ for (; !doit && w != NULL; w = w->next)
+ if (w->info == LOGGEDIN &&
+ w->loginat < ut->ut_tv.tv_sec)
+ doit = 1;
+ /*
+ * and if it's not any of the current logins
+ * can't use time comparison because there may be a small
+ * discrepancy since login calls time() twice
+ */
+ for (w = pn->whead; doit && w != NULL; w = w->next)
+ if (w->info == LOGGEDIN &&
+ strcmp(w->tty, ut->ut_line) == 0)
+ doit = 0;
+ }
+ if (ut != NULL && doit) {
+ w = walloc(pn);
+ w->info = LASTLOG;
+ strcpy(w->tty, ut->ut_line);
+ strcpy(w->host, ut->ut_host);
+ w->loginat = ut->ut_tv.tv_sec;
+ }
+ endutxent();
+}
+
+void
+enter_where(struct utmpx *ut, PERSON *pn)
+{
+ WHERE *w;
+
+ w = walloc(pn);
+ w->info = LOGGEDIN;
+ strcpy(w->tty, ut->ut_line);
+ strcpy(w->host, ut->ut_host);
+ w->loginat = ut->ut_tv.tv_sec;
+ find_idle_and_ttywrite(w);
+}
+
+PERSON *
+enter_person(struct passwd *pw)
+{
+ DBT data, key;
+ PERSON *pn;
+
+ if (db == NULL &&
+ (db = dbopen(NULL, O_RDWR, 0, DB_BTREE, NULL)) == NULL)
+ err(1, NULL);
+
+ key.data = pw->pw_name;
+ key.size = strlen(pw->pw_name);
+
+ switch ((*db->get)(db, &key, &data, 0)) {
+ case 0:
+ memmove(&pn, data.data, sizeof pn);
+ return (pn);
+ default:
+ case -1:
+ err(1, "db get");
+ /* NOTREACHED */
+ case 1:
+ ++entries;
+ pn = palloc();
+ userinfo(pn, pw);
+ pn->whead = NULL;
+
+ data.size = sizeof(PERSON *);
+ data.data = &pn;
+ if ((*db->put)(db, &key, &data, 0))
+ err(1, "db put");
+ return (pn);
+ }
+}
+
+PERSON *
+find_person(char *name)
+{
+ struct passwd *pw;
+
+ DBT data, key;
+ PERSON *p;
+
+ if (!db)
+ return(NULL);
+
+ if ((pw = getpwnam(name)) && hide(pw))
+ return(NULL);
+
+ key.data = name;
+ key.size = strlen(name);
+
+ if ((*db->get)(db, &key, &data, 0))
+ return (NULL);
+ memmove(&p, data.data, sizeof p);
+ return (p);
+}
+
+PERSON *
+palloc(void)
+{
+ PERSON *p;
+
+ if ((p = malloc(sizeof(PERSON))) == NULL)
+ err(1, NULL);
+ return(p);
+}
+
+static WHERE *
+walloc(PERSON *pn)
+{
+ WHERE *w;
+
+ if ((w = malloc(sizeof(WHERE))) == NULL)
+ err(1, NULL);
+ if (pn->whead == NULL)
+ pn->whead = pn->wtail = w;
+ else {
+ pn->wtail->next = w;
+ pn->wtail = w;
+ }
+ w->next = NULL;
+ return(w);
+}
+
+char *
+prphone(char *num)
+{
+ char *p;
+ int len;
+ static char pbuf[20];
+
+ /* don't touch anything if the user has their own formatting */
+ for (p = num; *p; ++p)
+ if (!isdigit(*p))
+ return(num);
+ len = p - num;
+ p = pbuf;
+ switch(len) {
+ case 11: /* +0-123-456-7890 */
+ *p++ = '+';
+ *p++ = *num++;
+ *p++ = '-';
+ /* FALLTHROUGH */
+ case 10: /* 012-345-6789 */
+ *p++ = *num++;
+ *p++ = *num++;
+ *p++ = *num++;
+ *p++ = '-';
+ /* FALLTHROUGH */
+ case 7: /* 012-3456 */
+ *p++ = *num++;
+ *p++ = *num++;
+ *p++ = *num++;
+ break;
+ case 5: /* x0-1234 */
+ case 4: /* x1234 */
+ *p++ = 'x';
+ *p++ = *num++;
+ break;
+ default:
+ return(num);
+ }
+ if (len != 4) {
+ *p++ = '-';
+ *p++ = *num++;
+ }
+ *p++ = *num++;
+ *p++ = *num++;
+ *p++ = *num++;
+ *p = '\0';
+ return(pbuf);
+}
+
+static void
+find_idle_and_ttywrite(WHERE *w)
+{
+ struct stat sb;
+ time_t touched;
+ int error;
+
+ (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_DEV, w->tty);
+
+ error = stat(tbuf, &sb);
+ if (error < 0 && errno == ENOENT) {
+ /*
+ * The terminal listed is not actually a terminal (i.e.,
+ * ":0"). This is a failure, so we'll skip printing
+ * out the idle time, which is non-ideal but better
+ * than a bogus warning and idle time.
+ */
+ w->idletime = -1;
+ return;
+ } else if (error < 0) {
+ warn("%s", tbuf);
+ w->idletime = -1;
+ return;
+ }
+ touched = sb.st_atime;
+ if (touched < w->loginat) {
+ /* tty untouched since before login */
+ touched = w->loginat;
+ }
+ w->idletime = now < touched ? 0 : now - touched;
+
+#define TALKABLE 0220 /* tty is writable if 220 mode */
+ w->writable = ((sb.st_mode & TALKABLE) == TALKABLE);
+}
+
+static void
+userinfo(PERSON *pn, struct passwd *pw)
+{
+ char *p, *t;
+ char *bp, name[1024];
+ struct stat sb;
+
+ pn->realname = pn->office = pn->officephone = pn->homephone = NULL;
+
+ pn->uid = pw->pw_uid;
+ if ((pn->name = strdup(pw->pw_name)) == NULL)
+ err(1, "strdup failed");
+ if ((pn->dir = strdup(pw->pw_dir)) == NULL)
+ err(1, "strdup failed");
+ if ((pn->shell = strdup(pw->pw_shell)) == NULL)
+ err(1, "strdup failed");
+
+ /* why do we skip asterisks!?!? */
+ (void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf));
+ tbuf[sizeof(tbuf) - 1] = '\0';
+ if (*bp == '*')
+ ++bp;
+
+ /* ampersands get replaced by the login name */
+ if (!(p = strsep(&bp, ",")))
+ return;
+ for (t = name; t < &name[sizeof(name) - 1] && (*t = *p) != '\0'; ++p) {
+ if (*t == '&') {
+ (void)strncpy(t, pw->pw_name,
+ sizeof(name) - (t - name));
+ name[sizeof(name) - 1] = '\0';
+ if (islower(*t))
+ *t = toupper(*t);
+ while (t < &name[sizeof(name) - 1] && *++t)
+ continue;
+ } else {
+ ++t;
+ }
+ }
+ *t = '\0';
+ if ((pn->realname = strdup(name)) == NULL)
+ err(1, "strdup failed");
+ pn->office = ((p = strsep(&bp, ",")) && *p) ?
+ strdup(p) : NULL;
+ pn->officephone = ((p = strsep(&bp, ",")) && *p) ?
+ strdup(p) : NULL;
+ pn->homephone = ((p = strsep(&bp, ",")) && *p) ?
+ strdup(p) : NULL;
+ (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_MAILDIR, pw->pw_name);
+ pn->mailrecv = -1; /* -1 == not_valid */
+ if (stat(tbuf, &sb) < 0) {
+ if (errno != ENOENT) {
+ warn("%s", tbuf);
+ return;
+ }
+ } else if (sb.st_size != 0) {
+ pn->mailrecv = sb.st_mtime;
+ pn->mailread = sb.st_atime;
+ }
+}
+
+/*
+ * Is this user hiding from finger?
+ * If ~<user>/.nofinger exists, return 1 (hide), else return 0 (nohide).
+ * Nobody can hide from root.
+ */
+
+int
+hide(struct passwd *pw)
+{
+ struct stat st;
+ char buf[MAXPATHLEN];
+
+ if (invoker_root || !pw->pw_dir)
+ return 0;
+
+ snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, _PATH_NOFINGER);
+
+ if (stat(buf, &st) == 0)
+ return 1;
+
+ return 0;
+}
diff --git a/usr.bin/fmt/Makefile b/usr.bin/fmt/Makefile
new file mode 100644
index 0000000..b15d254
--- /dev/null
+++ b/usr.bin/fmt/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= fmt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fmt/Makefile.depend b/usr.bin/fmt/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/fmt/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/fmt/fmt.1 b/usr.bin/fmt/fmt.1
new file mode 100644
index 0000000..84ef7b5
--- /dev/null
+++ b/usr.bin/fmt/fmt.1
@@ -0,0 +1,192 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)fmt.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.\" Modified by Gareth McCaughan to describe the new version of `fmt'
+.\" rather than the old one.
+.Dd August 2, 2004
+.Dt FMT 1
+.Os
+.Sh NAME
+.Nm fmt
+.Nd simple text formatter
+.Sh SYNOPSIS
+.Nm fmt
+.Op Fl cmnps
+.Op Fl d Ar chars
+.Op Fl l Ar num
+.Op Fl t Ar num
+.Op Ar goal Oo Ar maximum Oc | Fl Ns Ar width | Fl w Ar width
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a simple text formatter which reads the concatenation of input
+files (or standard input if none are given) and produces on standard
+output a version of its input with lines as close to the
+.Ar goal
+length
+as possible without exceeding the
+.Ar maximum .
+The
+.Ar goal
+length defaults
+to 65 and the
+.Ar maximum
+to 10 more than the
+.Ar goal
+length.
+Alternatively, a single
+.Ar width
+parameter can be specified either by prepending a hyphen to it or by using
+.Fl w .
+For example,
+.Dq Li fmt -w 72 ,
+.Dq Li fmt -72 ,
+and
+.Dq Li fmt 72 72
+all produce identical output.
+The spacing at the beginning of the input lines is preserved in the output,
+as are blank lines and interword spacing.
+Lines are joined or split only at white space; that is, words are never
+joined or hyphenated.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl c
+Center the text, line by line.
+In this case, most of the other
+options are ignored; no splitting or joining of lines is done.
+.It Fl m
+Try to format mail header lines contained in the input sensibly.
+.It Fl n
+Format lines beginning with a
+.Ql \&.
+(dot) character.
+Normally,
+.Nm
+does not fill these lines, for compatibility with
+.Xr nroff 1 .
+.It Fl p
+Allow indented paragraphs.
+Without the
+.Fl p
+flag, any change in the amount of whitespace at the start of a line
+results in a new paragraph being begun.
+.It Fl s
+Collapse whitespace inside lines, so that multiple whitespace
+characters are turned into a single space.
+(Or, at the end of a
+sentence, a double space.)
+.It Fl d Ar chars
+Treat the
+.Ar chars
+(and no others) as sentence-ending characters.
+By default the
+sentence-ending characters are full stop
+.Pq Ql \&. ,
+question mark
+.Pq Ql \&?
+and exclamation mark
+.Pq Ql \&! .
+Remember that some characters may need to be
+escaped to protect them from your shell.
+.It Fl l Ar number
+Replace multiple spaces with tabs at the start of each output
+line, if possible.
+Each
+.Ar number
+spaces will be replaced with one tab.
+The default is 8.
+If
+.Ar number
+is 0, spaces are preserved.
+.It Fl t Ar number
+Assume that the input files' tabs assume
+.Ar number
+spaces per tab stop.
+The default is 8.
+.El
+.Pp
+The
+.Nm
+utility
+is meant to format mail messages prior to sending, but may also be useful
+for other simple tasks.
+For instance,
+within visual mode of the
+.Xr ex 1
+editor (e.g.,
+.Xr vi 1 )
+the command
+.Pp
+.Dl \&!}fmt
+.Pp
+will reformat a paragraph,
+evening the lines.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh SEE ALSO
+.Xr fold 1 ,
+.Xr mail 1 ,
+.Xr nroff 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3 .
+.Pp
+The version described herein is a complete rewrite and appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+.An Kurt Shoens
+.An Liz Allen
+(added
+.Ar goal
+length concept)
+.An Gareth McCaughan
+.Sh BUGS
+The program was designed to be simple and fast \- for more complex
+operations, the standard text processors are likely to be more appropriate.
+.Pp
+When the first line of an indented paragraph is very long (more than
+about twice the goal length), the indentation in the output can be
+wrong.
+.Pp
+The
+.Nm
+utility is not infallible in guessing what lines are mail headers and what
+lines are not.
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
new file mode 100644
index 0000000..be196c2
--- /dev/null
+++ b/usr.bin/fmt/fmt.c
@@ -0,0 +1,786 @@
+/* $OpenBSD: fmt.c,v 1.21 2004/04/01 23:14:19 tedu Exp $ */
+
+/* Sensible version of fmt
+ *
+ * Syntax: fmt [ options ] [ goal [ max ] ] [ filename ... ]
+ *
+ * Since the documentation for the original fmt is so poor, here
+ * is an accurate description of what this one does. It's usually
+ * the same. The *mechanism* used may differ from that suggested
+ * here. Note that we are *not* entirely compatible with fmt,
+ * because fmt gets so many things wrong.
+ *
+ * 1. Tabs are expanded, assuming 8-space tab stops.
+ * If the `-t <n>' option is given, we assume <n>-space
+ * tab stops instead.
+ * Trailing blanks are removed from all lines.
+ * x\b == nothing, for any x other than \b.
+ * Other control characters are simply stripped. This
+ * includes \r.
+ * 2. Each line is split into leading whitespace and
+ * everything else. Maximal consecutive sequences of
+ * lines with the same leading whitespace are considered
+ * to form paragraphs, except that a blank line is always
+ * a paragraph to itself.
+ * If the `-p' option is given then the first line of a
+ * paragraph is permitted to have indentation different
+ * from that of the other lines.
+ * If the `-m' option is given then a line that looks
+ * like a mail message header, if it is not immediately
+ * preceded by a non-blank non-message-header line, is
+ * taken to start a new paragraph, which also contains
+ * any subsequent lines with non-empty leading whitespace.
+ * Unless the `-n' option is given, lines beginning with
+ * a . (dot) are not formatted.
+ * 3. The "everything else" is split into words; a word
+ * includes its trailing whitespace, and a word at the
+ * end of a line is deemed to be followed by a single
+ * space, or two spaces if it ends with a sentence-end
+ * character. (See the `-d' option for how to change that.)
+ * If the `-s' option has been given, then a word's trailing
+ * whitespace is replaced by what it would have had if it
+ * had occurred at end of line.
+ * 4. Each paragraph is sent to standard output as follows.
+ * We output the leading whitespace, and then enough words
+ * to make the line length as near as possible to the goal
+ * without exceeding the maximum. (If a single word would
+ * exceed the maximum, we output that anyway.) Of course
+ * the trailing whitespace of the last word is ignored.
+ * We then emit a newline and start again if there are any
+ * words left.
+ * Note that for a blank line this translates as "We emit
+ * a newline".
+ * If the `-l <n>' option is given, then leading whitespace
+ * is modified slightly: <n> spaces are replaced by a tab.
+ * Indented paragraphs (see above under `-p') make matters
+ * more complicated than this suggests. Actually every paragraph
+ * has two `leading whitespace' values; the value for the first
+ * line, and the value for the most recent line. (While processing
+ * the first line, the two are equal. When `-p' has not been
+ * given, they are always equal.) The leading whitespace
+ * actually output is that of the first line (for the first
+ * line of *output*) or that of the most recent line (for
+ * all other lines of output).
+ * When `-m' has been given, message header paragraphs are
+ * taken as having first-leading-whitespace empty and
+ * subsequent-leading-whitespace two spaces.
+ *
+ * Multiple input files are formatted one at a time, so that a file
+ * never ends in the middle of a line.
+ *
+ * There's an alternative mode of operation, invoked by giving
+ * the `-c' option. In that case we just center every line,
+ * and most of the other options are ignored. This should
+ * really be in a separate program, but we must stay compatible
+ * with old `fmt'.
+ *
+ * QUERY: Should `-m' also try to do the right thing with quoted text?
+ * QUERY: `-b' to treat backslashed whitespace as old `fmt' does?
+ * QUERY: Option meaning `never join lines'?
+ * QUERY: Option meaning `split in mid-word to avoid overlong lines'?
+ * (Those last two might not be useful, since we have `fold'.)
+ *
+ * Differences from old `fmt':
+ *
+ * - We have many more options. Options that aren't understood
+ * generate a lengthy usage message, rather than being
+ * treated as filenames.
+ * - Even with `-m', our handling of message headers is
+ * significantly different. (And much better.)
+ * - We don't treat `\ ' as non-word-breaking.
+ * - Downward changes of indentation start new paragraphs
+ * for us, as well as upward. (I think old `fmt' behaves
+ * in the way it does in order to allow indented paragraphs,
+ * but this is a broken way of making indented paragraphs
+ * behave right.)
+ * - Given the choice of going over or under |goal_length|
+ * by the same amount, we go over; old `fmt' goes under.
+ * - We treat `?' as ending a sentence, and not `:'. Old `fmt'
+ * does the reverse.
+ * - We return approved return codes. Old `fmt' returns
+ * 1 for some errors, and *the number of unopenable files*
+ * when that was all that went wrong.
+ * - We have fewer crashes and more helpful error messages.
+ * - We don't turn spaces into tabs at starts of lines unless
+ * specifically requested.
+ * - New `fmt' is somewhat smaller and slightly faster than
+ * old `fmt'.
+ *
+ * Bugs:
+ *
+ * None known. There probably are some, though.
+ *
+ * Portability:
+ *
+ * I believe this code to be pretty portable. It does require
+ * that you have `getopt'. If you need to include "getopt.h"
+ * for this (e.g., if your system didn't come with `getopt'
+ * and you installed it yourself) then you should arrange for
+ * NEED_getopt_h to be #defined.
+ *
+ * Everything here should work OK even on nasty 16-bit
+ * machines and nice 64-bit ones. However, it's only really
+ * been tested on my FreeBSD machine. Your mileage may vary.
+ */
+
+/* Copyright (c) 1997 Gareth McCaughan. All rights reserved.
+ *
+ * Redistribution and use of this code, in source or binary forms,
+ * with or without modification, are permitted subject to the following
+ * conditions:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - If you distribute modified source code it must also include
+ * a notice saying that it has been modified, and giving a brief
+ * description of what changes have been made.
+ *
+ * Disclaimer: I am not responsible for the results of using this code.
+ * If it formats your hard disc, sends obscene messages to
+ * your boss and kills your children then that's your problem
+ * not mine. I give absolutely no warranty of any sort as to
+ * what the program will do, and absolutely refuse to be held
+ * liable for any consequences of your using it.
+ * Thank you. Have a nice day.
+ */
+
+/* RCS change log:
+ * Revision 1.5 1998/03/02 18:02:21 gjm11
+ * Minor changes for portability.
+ *
+ * Revision 1.4 1997/10/01 11:51:28 gjm11
+ * Repair broken indented-paragraph handling.
+ * Add mail message header stuff.
+ * Improve comments and layout.
+ * Make usable with non-BSD systems.
+ * Add revision display to usage message.
+ *
+ * Revision 1.3 1997/09/30 16:24:47 gjm11
+ * Add copyright notice, rcsid string and log message.
+ *
+ * Revision 1.2 1997/09/30 16:13:39 gjm11
+ * Add options: -d <chars>, -l <width>, -p, -s, -t <width>, -h .
+ * Parse options with `getopt'. Clean up code generally.
+ * Make comments more accurate.
+ *
+ * Revision 1.1 1997/09/30 11:29:57 gjm11
+ * Initial revision
+ */
+
+#ifndef lint
+static const char copyright[] =
+"Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+/* Something that, we hope, will never be a genuine line length,
+ * indentation etc.
+ */
+#define SILLY ((size_t)-1)
+
+/* I used to use |strtoul| for this, but (1) not all systems have it
+ * and (2) it's probably better to use |strtol| to detect negative
+ * numbers better.
+ * If |fussyp==0| then we don't complain about non-numbers
+ * (returning 0 instead), but we do complain about bad numbers.
+ */
+static size_t
+get_positive(const char *s, const char *err_mess, int fussyP)
+{
+ char *t;
+ long result = strtol(s, &t, 0);
+
+ if (*t) {
+ if (fussyP)
+ goto Lose;
+ else
+ return 0;
+ }
+ if (result <= 0) {
+Lose: errx(EX_USAGE, "%s", err_mess);
+ }
+ return (size_t)result;
+}
+
+static size_t
+get_nonnegative(const char *s, const char *err_mess, int fussyP)
+{
+ char *t;
+ long result = strtol(s, &t, 0);
+
+ if (*t) {
+ if (fussyP)
+ goto Lose;
+ else
+ return 0;
+ }
+ if (result < 0) {
+Lose: errx(EX_USAGE, "%s", err_mess);
+ }
+ return (size_t)result;
+}
+
+/* Global variables */
+
+static int centerP = 0; /* Try to center lines? */
+static size_t goal_length = 0; /* Target length for output lines */
+static size_t max_length = 0; /* Maximum length for output lines */
+static int coalesce_spaces_P = 0; /* Coalesce multiple whitespace -> ' ' ? */
+static int allow_indented_paragraphs = 0; /* Can first line have diff. ind.? */
+static int tab_width = 8; /* Number of spaces per tab stop */
+static size_t output_tab_width = 8; /* Ditto, when squashing leading spaces */
+static const wchar_t *sentence_enders = L".?!"; /* Double-space after these */
+static int grok_mail_headers = 0; /* treat embedded mail headers magically? */
+static int format_troff = 0; /* Format troff? */
+
+static int n_errors = 0; /* Number of failed files. Return on exit. */
+static wchar_t *output_buffer = NULL; /* Output line will be built here */
+static size_t x; /* Horizontal position in output line */
+static size_t x0; /* Ditto, ignoring leading whitespace */
+static size_t output_buffer_length = 0;
+static size_t pending_spaces; /* Spaces to add before next word */
+static int output_in_paragraph = 0; /* Any of current para written out yet? */
+
+/* Prototypes */
+
+static void process_named_file(const char *);
+static void process_stream(FILE *, const char *);
+static size_t indent_length(const wchar_t *, size_t);
+static int might_be_header(const wchar_t *);
+static void new_paragraph(size_t, size_t);
+static void output_word(size_t, size_t, const wchar_t *, size_t, size_t);
+static void output_indent(size_t);
+static void center_stream(FILE *, const char *);
+static wchar_t *get_line(FILE *, size_t *);
+static void *xrealloc(void *, size_t);
+
+#define XMALLOC(x) xrealloc(0,x)
+
+/* Here is perhaps the right place to mention that this code is
+ * all in top-down order. Hence, |main| comes first.
+ */
+int
+main(int argc, char *argv[])
+{
+ int ch; /* used for |getopt| processing */
+ wchar_t *tmp;
+ size_t len;
+ const char *src;
+
+ (void)setlocale(LC_CTYPE, "");
+
+ /* 1. Grok parameters. */
+
+ while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1)
+ switch (ch) {
+ case 'c':
+ centerP = 1;
+ format_troff = 1;
+ continue;
+ case 'd':
+ src = optarg;
+ len = mbsrtowcs(NULL, &src, 0, NULL);
+ if (len == (size_t)-1)
+ err(EX_USAGE, "bad sentence-ending character set");
+ tmp = XMALLOC((len + 1) * sizeof(wchar_t));
+ mbsrtowcs(tmp, &src, len + 1, NULL);
+ sentence_enders = tmp;
+ continue;
+ case 'l':
+ output_tab_width
+ = get_nonnegative(optarg, "output tab width must be non-negative", 1);
+ continue;
+ case 'm':
+ grok_mail_headers = 1;
+ continue;
+ case 'n':
+ format_troff = 1;
+ continue;
+ case 'p':
+ allow_indented_paragraphs = 1;
+ continue;
+ case 's':
+ coalesce_spaces_P = 1;
+ continue;
+ case 't':
+ tab_width = get_positive(optarg, "tab width must be positive", 1);
+ continue;
+ case 'w':
+ goal_length = get_positive(optarg, "width must be positive", 1);
+ max_length = goal_length;
+ continue;
+ case '0': case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9':
+ /*
+ * XXX this is not a stylistically approved use of
+ * getopt()
+ */
+ if (goal_length == 0) {
+ char *p;
+
+ p = argv[optind - 1];
+ if (p[0] == '-' && p[1] == ch && !p[2])
+ goal_length = get_positive(++p, "width must be nonzero", 1);
+ else
+ goal_length = get_positive(argv[optind] + 1,
+ "width must be nonzero", 1);
+ max_length = goal_length;
+ }
+ continue;
+ case 'h':
+ default:
+ fprintf(stderr,
+ "usage: fmt [-cmps] [-d chars] [-l num] [-t num]\n"
+ " [-w width | -width | goal [maximum]] [file ...]\n"
+ "Options: -c center each line instead of formatting\n"
+ " -d <chars> double-space after <chars> at line end\n"
+ " -l <n> turn each <n> spaces at start of line into a tab\n"
+ " -m try to make sure mail header lines stay separate\n"
+ " -n format lines beginning with a dot\n"
+ " -p allow indented paragraphs\n"
+ " -s coalesce whitespace inside lines\n"
+ " -t <n> have tabs every <n> columns\n"
+ " -w <n> set maximum width to <n>\n"
+ " goal set target width to goal\n");
+ exit(ch == 'h' ? 0 : EX_USAGE);
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* [ goal [ maximum ] ] */
+
+ if (argc > 0 && goal_length == 0
+ && (goal_length = get_positive(*argv, "goal length must be positive", 0))
+ != 0) {
+ --argc;
+ ++argv;
+ if (argc > 0
+ && (max_length = get_positive(*argv, "max length must be positive", 0))
+ != 0) {
+ --argc;
+ ++argv;
+ if (max_length < goal_length)
+ errx(EX_USAGE, "max length must be >= goal length");
+ }
+ }
+ if (goal_length == 0)
+ goal_length = 65;
+ if (max_length == 0)
+ max_length = goal_length + 10;
+ if (max_length >= SIZE_T_MAX / sizeof(wchar_t))
+ errx(EX_USAGE, "max length too large");
+ /* really needn't be longer */
+ output_buffer = XMALLOC((max_length + 1) * sizeof(wchar_t));
+
+ /* 2. Process files. */
+
+ if (argc > 0) {
+ while (argc-- > 0)
+ process_named_file(*argv++);
+ } else {
+ process_stream(stdin, "standard input");
+ }
+
+ /* We're done. */
+
+ return n_errors ? EX_NOINPUT : 0;
+
+}
+
+/* Process a single file, given its name.
+ */
+static void
+process_named_file(const char *name)
+{
+ FILE *f = fopen(name, "r");
+
+ if (!f) {
+ warn("%s", name);
+ ++n_errors;
+ } else {
+ process_stream(f, name);
+ if (ferror(f)) {
+ warn("%s", name);
+ ++n_errors;
+ }
+ fclose(f);
+ }
+}
+
+/* Types of mail header continuation lines:
+ */
+typedef enum {
+ hdr_ParagraphStart = -1,
+ hdr_NonHeader = 0,
+ hdr_Header = 1,
+ hdr_Continuation = 2
+} HdrType;
+
+/* Process a stream. This is where the real work happens,
+ * except that centering is handled separately.
+ */
+static void
+process_stream(FILE *stream, const char *name)
+{
+ size_t last_indent = SILLY; /* how many spaces in last indent? */
+ size_t para_line_number = 0; /* how many lines already read in this para? */
+ size_t first_indent = SILLY; /* indentation of line 0 of paragraph */
+ HdrType prev_header_type = hdr_ParagraphStart;
+
+ /* ^-- header_type of previous line; -1 at para start */
+ wchar_t *line;
+ size_t length;
+
+ if (centerP) {
+ center_stream(stream, name);
+ return;
+ }
+ while ((line = get_line(stream, &length)) != NULL) {
+ size_t np = indent_length(line, length);
+
+ {
+ HdrType header_type = hdr_NonHeader;
+
+ if (grok_mail_headers && prev_header_type != hdr_NonHeader) {
+ if (np == 0 && might_be_header(line))
+ header_type = hdr_Header;
+ else if (np > 0 && prev_header_type > hdr_NonHeader)
+ header_type = hdr_Continuation;
+ }
+ /*
+ * We need a new paragraph if and only if: this line
+ * is blank, OR it's a troff request (and we don't
+ * format troff), OR it's a mail header, OR it's not
+ * a mail header AND the last line was one, OR the
+ * indentation has changed AND the line isn't a mail
+ * header continuation line AND this isn't the
+ * second line of an indented paragraph.
+ */
+ if (length == 0
+ || (line[0] == '.' && !format_troff)
+ || header_type == hdr_Header
+ || (header_type == hdr_NonHeader && prev_header_type > hdr_NonHeader)
+ || (np != last_indent
+ && header_type != hdr_Continuation
+ && (!allow_indented_paragraphs || para_line_number != 1))) {
+ new_paragraph(output_in_paragraph ? last_indent : first_indent, np);
+ para_line_number = 0;
+ first_indent = np;
+ last_indent = np;
+ if (header_type == hdr_Header)
+ last_indent = 2; /* for cont. lines */
+ if (length == 0 || (line[0] == '.' && !format_troff)) {
+ if (length == 0)
+ putwchar('\n');
+ else
+ wprintf(L"%.*ls\n", (int)length,
+ line);
+ prev_header_type = hdr_ParagraphStart;
+ continue;
+ }
+ } else {
+ /*
+ * If this is an indented paragraph other
+ * than a mail header continuation, set
+ * |last_indent|.
+ */
+ if (np != last_indent &&
+ header_type != hdr_Continuation)
+ last_indent = np;
+ }
+ prev_header_type = header_type;
+ }
+
+ {
+ size_t n = np;
+
+ while (n < length) {
+ /* Find word end and count spaces after it */
+ size_t word_length = 0, space_length = 0;
+
+ while (n + word_length < length &&
+ line[n + word_length] != ' ')
+ ++word_length;
+ space_length = word_length;
+ while (n + space_length < length &&
+ line[n + space_length] == ' ')
+ ++space_length;
+ /* Send the word to the output machinery. */
+ output_word(first_indent, last_indent,
+ line + n, word_length,
+ space_length - word_length);
+ n += space_length;
+ }
+ }
+ ++para_line_number;
+ }
+ new_paragraph(output_in_paragraph ? last_indent : first_indent, 0);
+ if (ferror(stream)) {
+ warn("%s", name);
+ ++n_errors;
+ }
+}
+
+/* How long is the indent on this line?
+ */
+static size_t
+indent_length(const wchar_t *line, size_t length)
+{
+ size_t n = 0;
+
+ while (n < length && *line++ == ' ')
+ ++n;
+ return n;
+}
+
+/* Might this line be a mail header?
+ * We deem a line to be a possible header if it matches the
+ * Perl regexp /^[A-Z][-A-Za-z0-9]*:\s/. This is *not* the same
+ * as in RFC whatever-number-it-is; we want to be gratuitously
+ * conservative to avoid mangling ordinary civilised text.
+ */
+static int
+might_be_header(const wchar_t *line)
+{
+ if (!iswupper(*line++))
+ return 0;
+ while (*line && (iswalnum(*line) || *line == '-'))
+ ++line;
+ return (*line == ':' && iswspace(line[1]));
+}
+
+/* Begin a new paragraph with an indent of |indent| spaces.
+ */
+static void
+new_paragraph(size_t old_indent, size_t indent)
+{
+ if (output_buffer_length) {
+ if (old_indent > 0)
+ output_indent(old_indent);
+ wprintf(L"%.*ls\n", (int)output_buffer_length, output_buffer);
+ }
+ x = indent;
+ x0 = 0;
+ output_buffer_length = 0;
+ pending_spaces = 0;
+ output_in_paragraph = 0;
+}
+
+/* Output spaces or tabs for leading indentation.
+ */
+static void
+output_indent(size_t n_spaces)
+{
+ if (output_tab_width) {
+ while (n_spaces >= output_tab_width) {
+ putwchar('\t');
+ n_spaces -= output_tab_width;
+ }
+ }
+ while (n_spaces-- > 0)
+ putwchar(' ');
+}
+
+/* Output a single word, or add it to the buffer.
+ * indent0 and indent1 are the indents to use on the first and subsequent
+ * lines of a paragraph. They'll often be the same, of course.
+ */
+static void
+output_word(size_t indent0, size_t indent1, const wchar_t *word, size_t length, size_t spaces)
+{
+ size_t new_x;
+ size_t indent = output_in_paragraph ? indent1 : indent0;
+ size_t width;
+ const wchar_t *p;
+ int cwidth;
+
+ for (p = word, width = 0; p < &word[length]; p++)
+ width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
+
+ new_x = x + pending_spaces + width;
+
+ /*
+ * If either |spaces==0| (at end of line) or |coalesce_spaces_P|
+ * (squashing internal whitespace), then add just one space; except
+ * that if the last character was a sentence-ender we actually add
+ * two spaces.
+ */
+ if (coalesce_spaces_P || spaces == 0)
+ spaces = wcschr(sentence_enders, word[length - 1]) ? 2 : 1;
+
+ if (new_x <= goal_length) {
+ /*
+ * After adding the word we still aren't at the goal length,
+ * so clearly we add it to the buffer rather than outputing
+ * it.
+ */
+ wmemset(output_buffer + output_buffer_length, L' ',
+ pending_spaces);
+ x0 += pending_spaces;
+ x += pending_spaces;
+ output_buffer_length += pending_spaces;
+ wmemcpy(output_buffer + output_buffer_length, word, length);
+ x0 += width;
+ x += width;
+ output_buffer_length += length;
+ pending_spaces = spaces;
+ } else {
+ /*
+ * Adding the word takes us past the goal. Print the
+ * line-so-far, and the word too iff either (1) the lsf is
+ * empty or (2) that makes us nearer the goal but doesn't
+ * take us over the limit, or (3) the word on its own takes
+ * us over the limit. In case (3) we put a newline in
+ * between.
+ */
+ if (indent > 0)
+ output_indent(indent);
+ wprintf(L"%.*ls", (int)output_buffer_length, output_buffer);
+ if (x0 == 0 || (new_x <= max_length &&
+ new_x - goal_length <= goal_length - x)) {
+ wprintf(L"%*ls", (int)pending_spaces, L"");
+ goto write_out_word;
+ } else {
+ /*
+ * If the word takes us over the limit on its own,
+ * just spit it out and don't bother buffering it.
+ */
+ if (indent + width > max_length) {
+ putwchar('\n');
+ if (indent > 0)
+ output_indent(indent);
+ write_out_word:
+ wprintf(L"%.*ls", (int)length, word);
+ x0 = 0;
+ x = indent1;
+ pending_spaces = 0;
+ output_buffer_length = 0;
+ } else {
+ wmemcpy(output_buffer, word, length);
+ x0 = width;
+ x = width + indent1;
+ pending_spaces = spaces;
+ output_buffer_length = length;
+ }
+ }
+ putwchar('\n');
+ output_in_paragraph = 1;
+ }
+}
+
+/* Process a stream, but just center its lines rather than trying to
+ * format them neatly.
+ */
+static void
+center_stream(FILE *stream, const char *name)
+{
+ wchar_t *line, *p;
+ size_t length;
+ size_t width;
+ int cwidth;
+
+ while ((line = get_line(stream, &length)) != NULL) {
+ size_t l = length;
+
+ while (l > 0 && iswspace(*line)) {
+ ++line;
+ --l;
+ }
+ length = l;
+ for (p = line, width = 0; p < &line[length]; p++)
+ width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
+ l = width;
+ while (l < goal_length) {
+ putwchar(' ');
+ l += 2;
+ }
+ wprintf(L"%.*ls\n", (int)length, line);
+ }
+ if (ferror(stream)) {
+ warn("%s", name);
+ ++n_errors;
+ }
+}
+
+/* Get a single line from a stream. Expand tabs, strip control
+ * characters and trailing whitespace, and handle backspaces.
+ * Return the address of the buffer containing the line, and
+ * put the length of the line in |lengthp|.
+ * This can cope with arbitrarily long lines, and with lines
+ * without terminating \n.
+ * If there are no characters left or an error happens, we
+ * return 0.
+ * Don't confuse |spaces_pending| here with the global
+ * |pending_spaces|.
+ */
+static wchar_t *
+get_line(FILE *stream, size_t *lengthp)
+{
+ static wchar_t *buf = NULL;
+ static size_t length = 0;
+ size_t len = 0;
+ wint_t ch;
+ size_t spaces_pending = 0;
+ int troff = 0;
+ size_t col = 0;
+ int cwidth;
+
+ if (buf == NULL) {
+ length = 100;
+ buf = XMALLOC(length * sizeof(wchar_t));
+ }
+ while ((ch = getwc(stream)) != '\n' && ch != WEOF) {
+ if (len + spaces_pending == 0 && ch == '.' && !format_troff)
+ troff = 1;
+ if (ch == ' ')
+ ++spaces_pending;
+ else if (troff || iswprint(ch)) {
+ while (len + spaces_pending >= length) {
+ length *= 2;
+ buf = xrealloc(buf, length * sizeof(wchar_t));
+ }
+ while (spaces_pending > 0) {
+ --spaces_pending;
+ buf[len++] = ' ';
+ col++;
+ }
+ buf[len++] = ch;
+ col += (cwidth = wcwidth(ch)) > 0 ? cwidth : 1;
+ } else if (ch == '\t')
+ spaces_pending += tab_width -
+ (col + spaces_pending) % tab_width;
+ else if (ch == '\b') {
+ if (len)
+ --len;
+ if (col)
+ --col;
+ }
+ }
+ *lengthp = len;
+ return (len > 0 || ch != WEOF) ? buf : 0;
+}
+
+/* (Re)allocate some memory, exiting with an error if we can't.
+ */
+static void *
+xrealloc(void *ptr, size_t nbytes)
+{
+ void *p = realloc(ptr, nbytes);
+
+ if (p == NULL)
+ errx(EX_OSERR, "out of memory");
+ return p;
+}
diff --git a/usr.bin/fold/Makefile b/usr.bin/fold/Makefile
new file mode 100644
index 0000000..d73d0a7
--- /dev/null
+++ b/usr.bin/fold/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= fold
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fold/Makefile.depend b/usr.bin/fold/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/fold/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/fold/fold.1 b/usr.bin/fold/fold.1
new file mode 100644
index 0000000..b23e838
--- /dev/null
+++ b/usr.bin/fold/fold.1
@@ -0,0 +1,117 @@
+.\" Copyright (c) 1980, 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.
+.\"
+.\" @(#)fold.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt FOLD 1
+.Os
+.Sh NAME
+.Nm fold
+.Nd "fold long lines for finite width output device"
+.Sh SYNOPSIS
+.Nm
+.Op Fl bs
+.Op Fl w Ar width
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a filter which folds the contents of the specified files,
+or the standard input if no files are specified,
+breaking the lines to have a maximum of 80 columns.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b
+Count
+.Ar width
+in bytes rather than column positions.
+.It Fl s
+Fold line after the last blank character within the first
+.Ar width
+column positions (or bytes).
+.It Fl w Ar width
+Specify a line width to use instead of the default 80 columns.
+The
+.Ar width
+value
+should be a multiple of 8 if tabs are present, or the tabs should
+be expanded using
+.Xr expand 1
+before using
+.Nm .
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh SEE ALSO
+.Xr expand 1 ,
+.Xr fmt 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 1 .
+It was rewritten for
+.Bx 4.3 Reno
+to improve speed and modernize style.
+The
+.Fl b
+and
+.Fl s
+options were added to
+.Nx 1.0
+for
+.St -p1003.2
+compliance.
+.Sh AUTHORS
+.An -nosplit
+.An Bill Joy
+wrote the original version of
+.Nm
+on June 28, 1977.
+.An Kevin Ruddy
+rewrote the command in 1990, and
+.An J. T. Conklin
+added the missing options in 1993.
+.Sh BUGS
+If underlining (see
+.Xr ul 1 )
+is present it may be messed up by folding.
diff --git a/usr.bin/fold/fold.c b/usr.bin/fold/fold.c
new file mode 100644
index 0000000..1ce9b5e
--- /dev/null
+++ b/usr.bin/fold/fold.c
@@ -0,0 +1,235 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Kevin Ruddy.
+ *
+ * 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) 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)fold.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define DEFLINEWIDTH 80
+
+void fold(int);
+static int newpos(int, wint_t);
+static void usage(void);
+
+static int bflag; /* Count bytes, not columns */
+static int sflag; /* Split on word boundaries */
+
+int
+main(int argc, char **argv)
+{
+ int ch, previous_ch;
+ int rval, width;
+
+ (void) setlocale(LC_CTYPE, "");
+
+ width = -1;
+ previous_ch = 0;
+ while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) {
+ switch (ch) {
+ case 'b':
+ bflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'w':
+ if ((width = atoi(optarg)) <= 0) {
+ errx(1, "illegal width value");
+ }
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ /* Accept a width as eg. -30. Note that a width
+ * specified using the -w option is always used prior
+ * to this undocumented option. */
+ switch (previous_ch) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ /* The width is a number with multiple digits:
+ * add the last one. */
+ width = width * 10 + (ch - '0');
+ break;
+ default:
+ /* Set the width, unless it was previously
+ * set. For instance, the following options
+ * would all give a width of 5 and not 10:
+ * -10 -w5
+ * -5b10
+ * -5 -10b */
+ if (width == -1)
+ width = ch - '0';
+ break;
+ }
+ break;
+ default:
+ usage();
+ }
+ previous_ch = ch;
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (width == -1)
+ width = DEFLINEWIDTH;
+ rval = 0;
+ if (!*argv)
+ fold(width);
+ else for (; *argv; ++argv)
+ if (!freopen(*argv, "r", stdin)) {
+ warn("%s", *argv);
+ rval = 1;
+ } else
+ fold(width);
+ exit(rval);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n");
+ exit(1);
+}
+
+/*
+ * Fold the contents of standard input to fit within WIDTH columns (or bytes)
+ * and write to standard output.
+ *
+ * If sflag is set, split the line at the last space character on the line.
+ * This flag necessitates storing the line in a buffer until the current
+ * column > width, or a newline or EOF is read.
+ *
+ * The buffer can grow larger than WIDTH due to backspaces and carriage
+ * returns embedded in the input stream.
+ */
+void
+fold(int width)
+{
+ static wchar_t *buf;
+ static int buf_max;
+ int col, i, indx, space;
+ wint_t ch;
+
+ col = indx = 0;
+ while ((ch = getwchar()) != WEOF) {
+ if (ch == '\n') {
+ wprintf(L"%.*ls\n", indx, buf);
+ col = indx = 0;
+ continue;
+ }
+ if ((col = newpos(col, ch)) > width) {
+ if (sflag) {
+ i = indx;
+ while (--i >= 0 && !iswblank(buf[i]))
+ ;
+ space = i;
+ }
+ if (sflag && space != -1) {
+ space++;
+ wprintf(L"%.*ls\n", space, buf);
+ wmemmove(buf, buf + space, indx - space);
+ indx -= space;
+ col = 0;
+ for (i = 0; i < indx; i++)
+ col = newpos(col, buf[i]);
+ } else {
+ wprintf(L"%.*ls\n", indx, buf);
+ col = indx = 0;
+ }
+ col = newpos(col, ch);
+ }
+ if (indx + 1 > buf_max) {
+ buf_max += LINE_MAX;
+ buf = realloc(buf, sizeof(*buf) * buf_max);
+ if (buf == NULL)
+ err(1, "realloc()");
+ }
+ buf[indx++] = ch;
+ }
+
+ if (indx != 0)
+ wprintf(L"%.*ls", indx, buf);
+}
+
+/*
+ * Update the current column position for a character.
+ */
+static int
+newpos(int col, wint_t ch)
+{
+ char buf[MB_LEN_MAX];
+ size_t len;
+ int w;
+
+ if (bflag) {
+ len = wcrtomb(buf, ch, NULL);
+ col += len;
+ } else
+ switch (ch) {
+ case '\b':
+ if (col > 0)
+ --col;
+ break;
+ case '\r':
+ col = 0;
+ break;
+ case '\t':
+ col = (col + 8) & ~7;
+ break;
+ default:
+ if ((w = wcwidth(ch)) > 0)
+ col += w;
+ break;
+ }
+
+ return (col);
+}
diff --git a/usr.bin/fortune/Makefile b/usr.bin/fortune/Makefile
new file mode 100644
index 0000000..b8b4ff1
--- /dev/null
+++ b/usr.bin/fortune/Makefile
@@ -0,0 +1,5 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+
+SUBDIR= fortune strfile datfiles unstr
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/fortune/Makefile.inc b/usr.bin/fortune/Makefile.inc
new file mode 100644
index 0000000..63751fb
--- /dev/null
+++ b/usr.bin/fortune/Makefile.inc
@@ -0,0 +1,3 @@
+.if exists(${.CURDIR}/../../Makefile.inc)
+.include "${.CURDIR}/../../Makefile.inc"
+.endif
diff --git a/usr.bin/fortune/Notes b/usr.bin/fortune/Notes
new file mode 100644
index 0000000..f049391
--- /dev/null
+++ b/usr.bin/fortune/Notes
@@ -0,0 +1,178 @@
+# @(#)Notes 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+Warning:
+ The fortunes contained in the fortune database have been collected
+ haphazardly from a cacophony of sources, in number so huge it
+ boggles the mind. It is impossible to do any meaningful quality
+ control on attributions, or lack thereof, or exactness of the quote.
+ Since this database is not used for profit, and since entire works
+ are not published, it falls under fair use, as we understand it.
+ However, if any half-assed idiot decides to make a profit off of
+ this, they will need to double check it all, and nobody not involved
+ of such an effort makes any warranty that anything in the database
+ bears any relation to the real world of literature, law, or other
+ bizzarrity.
+
+==> GENERAL INFORMATION
+ By default, fortune retrieves its fortune files from the directory
+/usr/share/games/fortune. A fortune file has two parts: the source file
+(which contains the fortunes themselves) and the data file which describes
+the fortunes. The data file always has the same name as the fortune file
+with the string ".dat" concatenated, i.e. "fortunes" is the standard fortune
+database, and "fortunes.dat" is the data file which describes it. See
+strfile(8) for more information on creating the data files.
+ Fortunes are split into potentially offensive and not potentially
+offensive parts. The offensive version of a file has the same name as the
+non-offensive version with "-o" concatenated, i.e. "fortunes" is the standard
+fortune database, and "fortunes-o" is the standard offensive database. The
+fortune program automatically assumes that any file with a name ending in
+"-o" is potentially offensive, and should therefore only be displayed if
+explicitly requested, either with the -o option or by specifying a file name
+on the command line.
+ Potentially offensive fortune files should NEVER be maintained in
+clear text on the system. They are rotated (see caesar(6)) 13 positions.
+To create a new, potentially offensive database, use caesar to rotate it,
+and then create its data file with the -x option to strfile(8). The fortune
+program automatically decrypts the text when it prints entries from such
+databases.
+ Anything which would not make it onto network prime time programming
+(or which would only be broadcast if some discredited kind of guy said it)
+MUST be in the potentially offensive database. Fortunes containing any
+explicit language (see George Carlin's recent updated list) MUST be in the
+potentially offensive database. Political and religious opinions are often
+sequestered in the potentially offensive section as well. Anything which
+assumes as a world view blatantly racist, misogynist (sexist), or homophobic
+ideas should not be in either, since they are not really funny unless *you*
+are racist, misogynist, or homophobic.
+ The point of this is that people should have a reasonable
+expectation that, should they just run "fortune", they will not be offended.
+We know that some people take offense at anything, but normal people do have
+opinions, too, and have a right not to have their sensibilities offended by
+a program which is supposed to be entertaining. People who run "fortune
+-o" or "fortune -a" are saying, in effect, that they are willing to have
+their sensibilities tweaked. However, they should not have their personal
+worth seriously (i.e., not in jest) assaulted. Jokes which depend for their
+humor on racist, misogynist, or homophobic stereotypes *do* seriously
+assault individual personal worth, and in a general entertainment medium
+we should be able to get by without it.
+
+==> FORMATTING
+ This file describes the format for fortunes in the database. This
+is done in detail to make it easier to keep track of things. Any rule given
+here may be broken to make a better joke.
+
+[All examples are indented by one tab stop -- KCRCA]
+
+Numbers should be given in parentheses, e.g.,
+
+ (1) Everything depends.
+ (2) Nothing is always.
+ (3) Everything is sometimes.
+
+Attributions are two tab stops, followed by two hyphens, followed by a
+space, followed by the attribution, and are *not* preceded by blank
+lines. Book, journal, movie, and all other titles are in quotes, e.g.,
+
+ $100 invested at 7% interest for 100 years will become $100,000, at
+ which time it will be worth absolutely nothing.
+ -- Lazarus Long, "Time Enough for Love"
+
+Attributions which do not fit on one (72 char) line should be continued
+on a line which lines up below the first text of the attribution, e.g.,
+
+ -- A very long attribution which might not fit on one
+ line, "Ken Arnold's Stupid Sayings"
+
+Single paragraph fortunes are in left justified (non-indented) paragraphs
+unless they fall into another category listed below (see example above).
+Longer fortunes should also be in left justified paragraphs, but if this
+makes it too long, try indented paragraphs, with indentations of either one
+tab stop or 5 chars. Indentations of less than 5 are too hard to read.
+
+Laws have the title left justified and capitalized, followed by a colon,
+with all the text of the law itself indented one tab stop, initially
+capitalized, e.g.,
+
+ A Law of Computer Programming:
+ Make it possible for programmers to write in English and
+ you will find the programmers cannot write in English.
+
+Limericks are indented as follows, all lines capitalized:
+
+ A computer, to print out a fact,
+ Will divide, multiply, and subtract.
+ But this output can be
+ No more than debris,
+ If the input was short of exact.
+
+Accents precede the letter they are over, e.g., "`^He" for e with a grave
+accent. Underlining is done on a word-by-word basis, with the underlines
+preceding the word, e.g., "__^H^Hhi ____^H^H^H^Hthere".
+
+No fortune should run beyond 72 characters on a single line without good
+justification (er, no pun intended). And no right margin justification,
+either. Sorry. For BSD people, there is a program called "fmt" which can
+make this kind of formatting easier.
+
+Definitions are given with the word or phrase left justified, followed by
+the part of speech (if appropriate) and a colon. The definition starts
+indented by one tab stop, with subsequent lines left justified, e.g.,
+
+ Afternoon, n.:
+ That part of the day we spend worrying about how we wasted
+ the morning.
+
+Quotes are sometimes put around statements which are funnier or make more
+sense if they are understood as being spoken, rather than written,
+communication, e.g.,
+
+ "All my friends and I are crazy. That's the only thing that
+ keeps us sane."
+
+Ellipses are always surrounded by spaces, except when next to punctuation,
+and are three dots long.
+
+ "... all the modern inconveniences ..."
+ -- Mark Twain
+
+Human initials always have spaces after the periods, e.g, "P. T. Barnum",
+not "P.T. Barnum". However, "P.T.A.", not "P. T. A.".
+
+All fortunes should be attributed, but if and only if they are original with
+somebody. Many people have said things that are folk sayings (i.e., are
+common among the folk (i.e., us common slobs)). There is nothing wrong with
+this, of course, but such statements should not be attributed to individuals
+who did not invent them.
+
+Horoscopes should have the sign indented by one tab stop, followed by the
+dates of the sign, with the text left justified below it, e.g.,
+
+ AQUARIUS (Jan 20 - Feb 18)
+ You have an inventive mind and are inclined to be progressive. You
+ lie a great deal. On the other hand, you are inclined to be
+ careless and impractical, causing you to make the same mistakes over
+ and over again. People think you are stupid.
+
+Single quotes should not be used except as quotes within quotes. Not even
+single quotes masquerading as double quotes are to be used, e.g., don't say
+``hi there'' or `hi there' or 'hi there', but "hi there". However, you
+*can* say "I said, `hi there'".
+
+A long poem or song can be ordered as follows in order to make it fit on a
+screen (fortunes should be 19 lines or less if at all possible) (numbers
+here are stanza numbers):
+
+ 11111111111111111111
+ 11111111111111111111
+ 11111111111111111111 22222222222222222222
+ 11111111111111111111 22222222222222222222
+ 22222222222222222222
+ 33333333333333333333 22222222222222222222
+ 33333333333333333333
+ 33333333333333333333 44444444444444444444
+ 33333333333333333333 44444444444444444444
+ 44444444444444444444
+ 44444444444444444444
+
+
diff --git a/usr.bin/fortune/README b/usr.bin/fortune/README
new file mode 100644
index 0000000..31b96a2
--- /dev/null
+++ b/usr.bin/fortune/README
@@ -0,0 +1,42 @@
+# @(#)README 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+The potentially offensive fortunes are installed by default on FreeBSD
+systems. If you're absolutely, *positively*, without-a-shadow-of-a-doubt
+sure that your user community goes berzerk/sues your pants off/drops dead
+upon reading one of them, edit the Makefile in the subdirectory datfiles,
+and do "make all install".
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ Some years ago, my neighbor Avery said to me: "There has not been an
+adequate jokebook published since "Joe_Miller", which came out in 1739 and
+which, incidentally, was the most miserable no-good ... jokebook in the
+history of the printed word."
+ In a subsequent conversation, Avery said: "A funny story is a funny
+story, no matter who is in it - whether it's about Catholics or Protestants,
+Jews or Gentiles, blacks or whites, browns or yellows. If a story is genuinely
+funny it makes no difference how dirty it is. Shout it from the rooftops.
+Let the chips fall all over the prairie and let the bonehead wowsers yelp.
+... on them."
+ It is a nice thing to have a neighbor of Avery's grain. He has
+believed in the aforestated principles all his life. A great many other
+people nowadays are casting aside the pietistic attitude that has led them
+to plug up their ears against the facts of life. We of The Brotherhood
+believe as Avery believes; we have never been intimidated by the pharisaical
+meddlers who have been smelling up the American landscape since the time of
+the bundling board. Neither has any one of our members ever been called a
+racist. Still, we have been in unremitting revolt against the ignorant
+propensity which ordains, in effect, that "The Green Pastures" should never
+have been written; the idiot attitude which compelled Arthur Kober to abandon
+his delightful Bella Gross, and Octavius Roy Cohen to quit writing about the
+splendiferous Florian Slappey; the moronic frame of mind which, if carried
+to its logical end, would have forbidden Ring Lardner from writing in the
+language of the masses.
+ -- H. Allen Smith, "Rude Jokes"
+
+ ... let us keep in mind the basic governing philosophy of The
+Brotherhood, as handsomely summarized in these words: we believe in
+healthy, hearty laughter -- at the expense of the whole human race, if
+needs be.
+ Needs be.
+ -- H. Allen Smith, "Rude Jokes"
diff --git a/usr.bin/fortune/datfiles/Makefile b/usr.bin/fortune/datfiles/Makefile
new file mode 100644
index 0000000..1eabaa4
--- /dev/null
+++ b/usr.bin/fortune/datfiles/Makefile
@@ -0,0 +1,22 @@
+# @(#)Makefile 8.2 (Berkeley) 4/19/94
+# $FreeBSD$
+
+DB= fortunes freebsd-tips murphy startrek zippy
+
+# TO AVOID INSTALLING THE POTENTIALLY OFFENSIVE FORTUNES, COMMENT OUT THE
+# NEXT LINE.
+DB+= limerick murphy-o gerrold.limerick
+
+BLDS= ${DB:S/$/.dat/}
+FILES= ${DB} ${BLDS}
+CLEANFILES+=${BLDS}
+
+FILESDIR= ${SHAREDIR}/games/fortune
+
+.for f in ${DB}
+$f.dat: $f
+ PATH=$$PATH:/usr/bin:${.OBJDIR}/../strfile \
+ strfile -Cs ${.ALLSRC} ${.TARGET}
+.endfor
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fortune/datfiles/Makefile.depend b/usr.bin/fortune/datfiles/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/fortune/datfiles/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/fortune/datfiles/fortunes b/usr.bin/fortune/datfiles/fortunes
new file mode 100644
index 0000000..1aa54b5
--- /dev/null
+++ b/usr.bin/fortune/datfiles/fortunes
@@ -0,0 +1,59053 @@
+This fortune brought to you by:
+$FreeBSD$
+%
+=======================================================================
+|| ||
+|| The FORTUNE-COOKIE program is soon to be a Major Motion Picture! ||
+|| Watch for it at a theater near you next summer! ||
+|| ||
+=======================================================================
+ Francis Ford Coppola presents a George Lucas Production:
+ "Fortune Cookie"
+ Directed by Steven Spielberg.
+ Starring Harrison Ford Bette Midler Marlon Brando
+ Christopher Reeves Marilyn Chambers
+ and Bob Hope as "The Waiter".
+ Costumes Designed by Pierre Cardin.
+ Special Effects by Timothy Leary.
+ Read the Warner paperback!
+ Invoke the Unix program!
+ Soundtrack on XTC Records.
+ In 70mm and Dolby Stereo at selected theaters and terminal
+ centers.
+%
+ FROM THE DESK OF
+ Dorothy Gale
+
+ Auntie Em:
+ Hate you.
+ Hate Kansas.
+ Taking the dog.
+ Dorothy
+%
+ FROM THE DESK OF
+ Rapunzel
+
+Dear Prince:
+
+ Use ladder tonight --
+ you're splitting my ends.
+%
+ SEMINAR ANNOUNCEMENT
+
+Title: Are Frogs Turing Compatible?
+Speaker: Don "The Lion" Knuth
+
+ ABSTRACT
+ Several researchers at the University of Louisiana have been studying
+the computing power of various amphibians, frogs in particular. The problem
+of frog computability has become a critical issue that ranges across all areas
+of computer science. It has been shown that anything computable by an amphi-
+bian community in a fixed-size pond is computable by a frog in the same-size
+pond -- that is to say, frogs are Pond-space complete. We will show that
+there is a log-space, polywog-time reduction from any Turing machine program
+to a frog. We will suggest these represent a proper subset of frog-computable
+functions.
+ This is not just a let's-see-how-far-those-frogs-can-jump seminar.
+This is only for hardcore amphibian-computation people and their colleagues.
+ Refreshments will be served. Music will be played.
+%
+ UNIX Trix
+
+For those of you in the reseller business, here is a helpful tip that will
+save your support staff a few hours of precious time. Before you send your
+next machine out to an untrained client, change the permissions on /etc/passwd
+to 666 and make sure there is a copy somewhere on the disk. Now when they
+forget the root password, you can easily login as an ordinary user and correct
+the damage. Having a bootable tape (for larger machines) is not a bad idea
+either. If you need some help, give us a call.
+
+ -- CommUNIXque 1:1, ASCAR Business Systems
+%
+ 1/2
+ 12 + 144 + 20 + 3*4 2
+ ---------------------- + 5 * 11 = 9 + 0
+ 7
+
+A dozen, a gross and a score,
+Plus three times the square root of four,
+ Divided by seven,
+ Plus five times eleven,
+Equals nine squared plus zero, no more!
+%
+ -- Gifts for Children --
+
+This is easy. You never have to figure out what to get for children,
+because they will tell you exactly what they want. They spend months
+and months researching these kinds of things by watching Saturday-
+morning cartoon-show advertisements. Make sure you get your children
+exactly what they ask for, even if you disapprove of their choices. If
+your child thinks he wants Murderous Bob, the Doll with the Face You
+Can Rip Right Off, you'd better get it. You may be worried that it
+might help to encourage your child's antisocial tendencies, but believe
+me, you have not seen antisocial tendencies until you've seen a child
+who is convinced that he or she did not get the right gift.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+ -- Gifts for Men --
+
+Men are amused by almost any idiot thing -- that is why professional
+ice hockey is so popular -- so buying gifts for them is easy. But you
+should never buy them clothes. Men believe they already have all the
+clothes they will ever need, and new ones make them nervous. For
+example, your average man has 84 ties, but he wears, at most, only
+three of them. He has learned, through humiliating trial and error,
+that if he wears any of the other 81 ties, his wife will probably laugh
+at him ("You're not going to wear THAT tie with that suit, are you?").
+So he has narrowed it down to three safe ties, and has gone several
+years without being laughed at. If you give him a new tie, he will
+pretend to like it, but deep inside he will hate you.
+
+If you want to give a man something practical, consider tires. More
+than once, I would have gladly traded all the gifts I got for a new set
+of tires.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+ Chapter 1
+
+The story so far:
+
+ In the beginning the Universe was created. This has made a lot
+of people very angry and been widely regarded as a bad move.
+ -- Douglas Adams, "The Restaurant at the End of the Universe"
+%
+ DELETE A FORTUNE!
+
+Don't some of these fortunes just drive you nuts?! Wouldn't you like
+to see some of them deleted from the system? You can! Just mail to
+"fortune" with the fortune you hate most, and we MIGHT make sure it
+gets expunged.
+%
+ Get GUMMed
+ --- ------
+The Gurus of Unix Meeting of Minds (GUMM) takes place Wednesday, April
+1, 2076 (check THAT in your perpetual calendar program), 14 feet above
+the ground directly in front of the Milpitas Gumps. Members will grep
+each other by the hand (after intro), yacc a lot, smoke filtered
+chroots in pipes, chown with forks, use the wc (unless uuclean), fseek
+nice zombie processes, strip, and sleep, but not, we hope, od. Three
+days will be devoted to discussion of the ramifications of whodo. Two
+seconds have been allotted for a complete rundown of all the user-
+friendly features of Unix. Seminars include "Everything You Know is
+Wrong", led by Tom Kempson, "Batman or Cat:man?" led by Richie Dennis
+"cc C? Si! Si!" led by Kerwin Bernighan, and "Document Unix, Are You
+Kidding?" led by Jan Yeats. No Reader Service No. is necessary because
+all GUGUs (Gurus of Unix Group of Users) already know everything we
+could tell them.
+ -- Dr. Dobb's Journal, June '84
+%
+ Has your family tried 'em?
+
+ POWDERMILK BISCUITS
+
+ Heavens, they're tasty and expeditious!
+
+ They're made from whole wheat, to give shy persons
+ the strength to get up and do what needs to be done.
+
+ POWDERMILK BISCUITS
+
+ Buy them ready-made in the big blue box with the picture of
+ the biscuit on the front, or in the brown bag with the dark
+ stains that indicate freshness.
+%
+ It's grad exam time...
+COMPUTER SCIENCE
+ Inside your desk you'll find a listing of the DEC/VMS operating
+system in IBM 1710 machine code. Show what changes are necessary to convert
+this code into a UNIX Berkeley 7 operating system. Prove that these fixes are
+bug free and run correctly. You should gain at least 150% efficiency in the
+new system. (You should take no more than 10 minutes on this question.)
+
+MATHEMATICS
+ If X equals PI times R^2, construct a formula showing how long
+it would take a fire ant to drill a hole through a dill pickle, if the
+length-girth ratio of the ant to the pickle were 98.17:1.
+
+GENERAL KNOWLEDGE
+Describe the Universe. Give three examples.
+%
+ It's grad exam time...
+MEDICINE
+ You have been provided with a razor blade, a piece of gauze, and a
+bottle of Scotch. Remove your appendix. Do not suture until your work has
+been inspected. (You have 15 minutes.)
+
+HISTORY
+ Describe the history of the papacy from its origins to the present
+day, concentrating especially, but not exclusively, on its social, political,
+economic, religious and philosophical impact upon Europe, Asia, America, and
+Africa. Be brief, concise, and specific.
+
+BIOLOGY
+ Create life. Estimate the differences in subsequent human culture
+if this form of life had been created 500 million years ago or earlier, with
+special attention to its probable effect on the English parliamentary system.
+%
+ Pittsburgh driver's test
+10: Potholes are
+ a) extremely dangerous.
+ b) patriotic.
+ c) the fault of the previous administration.
+ d) all going to be fixed next summer.
+The correct answer is b.
+Potholes destroy unpatriotic, unamerican, imported cars, since the holes
+are larger than the cars. If you drive a big, patriotic, American car
+you have nothing to worry about.
+%
+ Pittsburgh driver's test
+2: A traffic light at an intersection changes from yellow to red, you should
+ a) stop immediately.
+ b) proceed slowly through the intersection.
+ c) blow the horn.
+ d) floor it.
+The correct answer is d.
+If you said c, you were almost right, so give yourself a half point.
+%
+ Pittsburgh driver's test
+3: When stopped at an intersection you should
+ a) watch the traffic light for your lane.
+ b) watch for pedestrians crossing the street.
+ c) blow the horn.
+ d) watch the traffic light for the intersecting street.
+The correct answer is d.
+You need to start as soon as the traffic light for the intersecting
+street turns yellow.
+Answer c is worth a half point.
+%
+ Pittsburgh driver's test
+4: Exhaust gas is
+ a) beneficial.
+ b) not harmful.
+ c) toxic.
+ d) a punk band.
+The correct answer is b.
+The meddling Washington eco-freak communist bureaucrats who say otherwise
+are liars. (Message to those who answered d. Go back to California where
+you came from. Your kind are not welcome here.)
+%
+ Pittsburgh driver's test
+5: Your car's horn is a vital piece of safety equipment.
+ How often should you test it?
+ a) once a year.
+ b) once a month.
+ c) once a day.
+ d) once an hour.
+The correct answer is d.
+You should test your car's horn at least once every hour,
+and more often at night or in residential neighborhoods.
+%
+ Pittsburgh driver's test
+7: The car directly in front of you has a flashing right tail light
+ but a steady left tail light. This means
+ a) One of the tail lights is broken. You should blow your
+ horn to call the problem to the driver's attention.
+ b) The driver is signaling a right turn.
+ c) The driver is signaling a left turn.
+ d) The driver is from out of town.
+The correct answer is d.
+Tail lights are used in some foreign countries to signal turns.
+%
+ Pittsburgh driver's test
+8: Pedestrians are
+ a) irrelevant.
+ b) communists.
+ c) a nuisance.
+ d) difficult to clean off the front grille.
+The correct answer is a. Pedestrians are not in cars, so they
+are totally irrelevant to driving, and you should ignore them
+completely.
+%
+ Pittsburgh driver's test
+9: Roads are salted in order to
+ a) kill grass.
+ b) melt snow.
+ c) help the economy.
+ d) prevent potholes.
+The correct answer is c.
+Road salting employs thousands of persons directly, and millions more
+indirectly, for example, salt miners and rustproofers. Most important,
+salting reduces the life spans of cars, thus stimulating the car and
+steel industries.
+%
+ THE STORY OF CREATION
+ or
+ THE MYTH OF URK
+
+In the beginning there was data. The data was without form and null,
+and darkness was upon the face of the console; and the Spirit of IBM
+was moving over the face of the market. And DEC said, "Let there be
+registers"; and there were registers. And DEC saw that they carried;
+and DEC separated the data from the instructions. DEC called the data
+Stack, and the instructions they called Code. And there was evening
+and there was morning, one interrupt ...
+ -- Rico Tudor
+%
+ JACK AND THE BEANSTACK
+ by Mark Isaak
+
+ Long ago, in a finite state far away, there lived a JOVIAL
+character named Jack. Jack and his relations were poor. Often their
+hash table was bare. One day Jack's parent said to him, "Our matrices
+are sparse. You must go to the market to exchange our RAM for some
+BASICs." She compiled a linked list of items to retrieve and passed it
+to him.
+ So Jack set out. But as he was walking along a Hamilton path,
+he met the traveling salesman.
+ "Whither dost thy flow chart take thou?" prompted the salesman
+in high-level language.
+ "I'm going to the market to exchange this RAM for some chips
+and Apples," commented Jack.
+ "I have a much better algorithm. You needn't join a queue
+there; I will swap your RAM for these magic kernels now."
+ Jack made the trade, then backtracked to his house. But when
+he told his busy-waiting parent of the deal, she became so angry she
+started thrashing.
+ "Don't you even have any artificial intelligence? All these
+kernels together hardly make up one byte," and she popped them out the
+window ...
+%
+ Answers to Last Fortune's Questions:
+
+(1) None. (Moses didn't have an ark).
+(2) Your mother, by the pigeonhole principle.
+(3) I don't know.
+(4) Who cares?
+(5) 6 (or maybe 4, or else 3). Mr. Alfred J. Duncan of Podunk,
+ Montana, submitted an interesting solution to Problem 5.
+(6) There is an interesting solution to this problem on page 1029 of my
+ book, which you can pick up for $23.95 at finer bookstores and
+ bathroom supply outlets (or 99 cents at the table in front of
+ Papyrus Books).
+%
+ DETERIORATA
+
+Go placidly amid the noise and waste,
+And remember what comfort there may be in owning a piece thereof.
+Avoid quiet and passive persons, unless you are in need of sleep.
+Rotate your tires.
+Speak glowingly of those greater than yourself,
+And heed well their advice -- even though they be turkeys.
+Know what to kiss -- and when.
+Remember that two wrongs never make a right,
+But that three do.
+Wherever possible, put people on "HOLD".
+Be comforted, that in the face of all aridity and disillusionment,
+And despite the changing fortunes of time,
+There is always a big future in computer maintenance.
+
+ You are a fluke of the universe ...
+ You have no right to be here.
+ Whether you can hear it or not, the universe
+ Is laughing behind your back.
+ -- National Lampoon
+%
+ Double Bucky
+ (Sung to the tune of "Rubber Duckie")
+
+Double bucky, you're the one!
+You make my keyboard lots of fun
+ Double bucky, an additional bit or two:
+(Vo-vo-de-o!)
+Control and Meta side by side,
+Augmented ASCII, nine bits wide!
+ Double bucky, a half a thousand glyphs, plus a few!
+
+Double bucky, left and right
+OR'd together, outta sight!
+ Double bucky, I'd like a whole word of
+ Double bucky, I'm happy I heard of
+ Double bucky, I'd like a whole word of you!
+ -- Guy L. Steele, Jr., (C) 1978
+ (to Nicholas Wirth, who suggested that an extra bit
+ be added to terminal codes on 36-bit machines for use
+ by screen editors.)
+%
+ Hard Copies and Chmod
+
+And everyone thinks computers are impersonal
+cold diskdrives hardware monitors
+user-hostile software
+
+of course they're only bits and bytes
+and characters and strings
+and files
+
+just some old textfiles from my old boyfriend
+telling me he loves me and
+he'll take care of me
+
+simply a discarded printout of a friend's directory
+deep intimate secrets and
+how he doesn't trust me
+
+couldn't hurt me more if they were scented in lavender or mould
+on personal stationery
+ -- terri@csd4.milw.wisc.edu
+%
+ `O' LEVEL COUNTER CULTURE
+Timewarp allowed: 3 hours. Do not scrawl situationalist graffiti in the
+margins or stub your rollups in the inkwells. Orange may be worn. Credit
+will be given to candidates who self-actualize.
+
+ 1: Compare and contrast Pink Floyd with Black Sabbath and say why
+neither has street credibility.
+ 2: "Even Buddha would have been hard pushed to reach Nirvana squatting
+on a juggernaut route." Consider the dialectic of inner truth and inner
+city.
+ 3: Discuss degree of hassle involved in paranoia about being sucked
+into a black hole.
+ 4: "The Egomaniac's Liberation Front were a bunch of revisionist
+ripoff merchants." Comment on this insult.
+ 5: Account for the lack of references to brown rice in Dylan's lyrics.
+ 6: "Castenada was a bit of a bozo." How far is this a fair summing
+up of western dualism?
+ 7: Hermann Hesse was a Pisces. Discuss.
+%
+ OUTCONERR
+Twas FORTRAN as the doloop goes
+ Did logzerneg the ifthen block
+All kludgy were the function flows
+ And subroutines adhoc.
+
+Beware the runtime-bug my friend
+ squrooneg, the false goto
+Beware the infiniteloop
+ And shun the inprectoo.
+%
+ Safety Tips for the Post-Nuclear Existence
+1. Never use an elevator in a building that has been hit by a
+ nuclear bomb, use the stairs.
+2. When you're flying through the air, remember to roll
+ when you hit the ground.
+3. If you're on fire, avoid gasoline and other flammable materials.
+4. Don't attempt communication with dead people; it will only lead
+ to psychological problems.
+5. Food will be scarce, you will have to scavenge. Learn to recognize
+ foods that will be available after the bomb: mashed potatoes,
+ shredded wheat, tossed salad, ground beef, etc.
+6. Put your hand over your mouth when you sneeze, internal organs
+ will be scarce in the post-nuclear age.
+7. Try to be neat, fall only in designated piles.
+8. Drive carefully in "Heavy Fallout" areas, people could be
+ staggering illegally.
+9. Nutritionally, hundred dollar bills are equal to one's, but more
+ sanitary due to limited circulation.
+10. Accumulate mannequins now, spare parts will be in short
+ supply on D-Day.
+%
+ The Guy on the Right Doesn't Stand a Chance
+The guy on the right has the Osborne 1, a fully functional computer system
+in a portable package the size of a briefcase. The guy on the left has an
+Uzi submachine gun concealed in his attache case. Also in the case are four
+fully loaded, 32-round clips of 125-grain 9mm ammunition. The owner of the
+Uzi is going to get more tactical firepower delivered -- and delivered on
+target -- in less time, and with less effort. All for $795. It's inevitable.
+If you're going up against some guy with an Osborne 1 -- or any personal
+computer -- he's the one who's in trouble. One round from an Uzi can zip
+through ten inches of solid pine wood, so you can imagine what it will do
+to structural foam acrylic and sheet aluminum. In fact, detachable magazines
+for the Uzi are available in 25-, 32-, and 40-round capacities, so you can
+take out an entire office full of Apple II or IBM Personal Computers tied
+into Ethernet or other local-area networks. What about the new 16-bit
+computers, like the Lisa and Fortune? Even with the Winchester backup,
+they're no match for the Uzi. One quick burst and they'll find out what
+Unix means. Make your commanding officer proud. Get an Uzi -- and come home
+a winner in the fight for office automatic weapons.
+ -- "InfoWorld", June, 1984
+%
+ The STAR WARS Song
+ Sung to the tune of "Lola", by the Kinks:
+
+I met him in a swamp down in Dagobah
+Where it bubbles all the time like a giant cabinet soda
+ S-O-D-A soda
+I saw the little runt sitting there on a log
+I asked him his name and in a raspy voice he said Yoda
+ Y-O-D-A Yoda, Yo-Yo-Yo-Yo Yoda
+
+Well I've been around but I ain't never seen
+A guy who looks like a Muppet but he's wrinkled and green
+ Oh my Yoda, Yo-Yo-Yo-Yo Yoda
+Well I'm not dumb but I can't understand
+How he can raise me in the air just by raising his hand
+ Oh my Yoda, Yo-Yo-Yo-Yo Yoda, Yo-Yo-Yo-Yo Yoda
+%
+ The Three Major Kind of Tools
+
+* Tools for hitting things to make them loose or to tighten them up or
+ jar their many complex, sophisticated electrical parts in such a
+ manner that they function perfectly. (These are your hammers, maces,
+ bludgeons, and truncheons.)
+
+* Tools that, if dropped properly, can penetrate your foot. (Awls)
+
+* Tools that nobody should ever use because the potential danger is far
+ greater than the value of any project that could possibly result.
+ (Power saws, power drills, power staplers, any kind of tool that uses
+ any kind of power more advanced than flashlight batteries.)
+ -- Dave Barry, "The Taming of the Screw"
+%
+ (to "The Caissons Go Rolling Along")
+Scratch the disks, dump the core, Shut it down, pull the plug
+Roll the tapes across the floor, Give the core an extra tug
+And the system is going to crash. And the system is going to crash.
+Teletypes smashed to bits. Mem'ry cards, one and all,
+Give the scopes some nasty hits Toss out halfway down the hall
+And the system is going to crash. And the system is going to crash.
+And we've also found Just flip one switch
+When you turn the power down, And the lights will cease to twitch
+You turn the disk readers into trash. And the tape drives will crumble
+ in a flash.
+Oh, it's so much fun, When the CPU
+Now the CPU won't run Can print nothing out but "foo,"
+And the system is going to crash. The system is going to crash.
+%
+ 'Twas the Night before Crisis
+
+'Twas the night before crisis, and all through the house,
+ Not a program was working not even a browse.
+The programmers were wrung out too mindless to care,
+ Knowing chances of cutover hadn't a prayer.
+The users were nestled all snug in their beds,
+ While visions of inquiries danced in their heads.
+When out in the lobby there arose such a clatter,
+ I sprang from my tube to see what was the matter.
+And what to my wondering eyes should appear,
+ But a Super Programmer, oblivious to fear.
+More rapid than eagles, his programs they came,
+ And he whistled and shouted and called them by name;
+On Update! On Add! On Inquiry! On Delete!
+ On Batch Jobs! On Closing! On Functions Complete!
+His eyes were glazed over, his fingers were lean,
+ From Weekends and nights in front of a screen.
+A wink of his eye, and a twist of his head,
+ Soon gave me to know I had nothing to dread...
+%
+ What I Did During My Fall Semester
+On the first day of my fall semester, I got up.
+Then I went to the library to find a thesis topic.
+Then I hung out in front of the Dover.
+
+On the second day of my fall semester, I got up.
+Then I went to the library to find a thesis topic.
+Then I hung out in front of the Dover.
+
+On the third day of my fall semester, I got up.
+Then I went to the library to find a thesis topic.
+I found a thesis topic:
+ How to keep people from hanging out in front of the Dover.
+ -- Sister Mary Elephant,
+ "Student Statement for Black Friday"
+%
+ William Safire's Rules for Writers:
+
+Remember to never split an infinitive. The passive voice should never
+be used. Do not put statements in the negative form. Verbs has to
+agree with their subjects. Proofread carefully to see if you words
+out. If you reread your work, you can find on rereading a great deal
+of repetition can be avoided by rereading and editing. A writer must
+not shift your point of view. And don't start a sentence with a
+conjunction. (Remember, too, a preposition is a terrible word to end a
+sentence with.) Don't overuse exclamation marks!! Place pronouns as
+close as possible, especially in long sentences, as of 10 or more
+words, to their antecedents. Writing carefully, dangling participles
+must be avoided. If any word is improper at the end of a sentence, a
+linking verb is. Take the bull by the hand and avoid mixing
+metaphors. Avoid trendy locutions that sound flaky. Everyone should
+be careful to use a singular pronoun with singular nouns in their
+writing. Always pick on the correct idiom. The adverb always follows
+the verb. Last but not least, avoid cliches like the plague; seek
+viable alternatives.
+%
+ 1/3
+ /\(3)
+ | 2 1/3
+ | z dz cos(3 * PI / 9) = ln (e )
+ |
+ \/ 1
+
+The integral of z squared, dz
+From 1 to the cube root of 3
+ Times the cosine
+ Of 3 PI over nine
+Is the log of the cube root of e
+%
+ THE DAILY PLANET
+
+ SUPERMAN SAVES DESSERT!
+ Plans to "Eat it later"
+%
+ *** A NEW KIND OF PROGRAMMING ***
+
+Do you want the instant respect that comes from being able to use technical
+terms that nobody understands? Do you want to strike fear and loathing into
+the hearts of DP managers everywhere? If so, then let the Famous Programmers'
+School lead you on... into the world of professional computer programming.
+They say a good programmer can write 20 lines of effective program per day.
+With our unique training course, we'll show you how to write 20 lines of code
+and lots more besides. Our training course covers every programming language
+in existence, and some that aren't. You'll learn why the on/off switch for a
+computer is so important, what the words *fatal error* mean, and who and what
+you should blame when you make a mistake.
+
+ Yes, I want the brochure describing this incredible offer.
+ I enclose $1000 in small unmarked bills to cover the cost of
+ postage and handling. (No live poultry, please.)
+
+*** Our Slogan: Top down programming for the masses. ***
+%
+ A Plan for the Improvement of English Spelling
+ by Mark Twain
+
+ For example, in Year 1 that useless letter "c" would be dropped
+to be replased either by "k" or "s", and likewise "x" would no longer
+be part of the alphabet. The only kase in which "c" would be retained
+would be the "ch" formation, which will be dealt with later. Year 2
+might reform "w" spelling, so that "which" and "one" would take the
+same konsonant, wile Year 3 might well abolish "y" replasing it with
+"i" and Iear 4 might fiks the "g/j" anomali wonse and for all.
+ Jenerally, then, the improvement would kontinue iear bai iear
+with Iear 5 doing awai with useless double konsonants, and Iears 6-12
+or so modifaiing vowlz and the rimeining voist and unvoist konsonants.
+Bai Iear 15 or sou, it wud fainali bi posibl tu meik ius ov thi
+ridandant letez "c", "y" and "x" -- bai now jast a memori in the maindz
+ov ould doderez -- tu riplais "ch", "sh", and "th" rispektivli.
+ Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud
+hev a lojikl, kohirnt speling in ius xrewawt xe Ingliy-spiking werld.
+%
+ *** DO YOU HAVE A RESTLESS URGE TO PROGRAM? ***
+Do you want the instant respect that comes from being able to use technical
+terms that nobody understands? Do you want to strike fear and loathing into
+the hearts of DP managers everywhere? If so, then let the Famous Programmers'
+School lead you on... into the world of professional computer programming.
+
+ *** IS PROGRAMMING FOR YOU? ***
+Programming is not for everyone. But, if you have the desire to learn, we can
+help you get started. All you need is the Famous Programmers' Course and
+enough money to keep those lessons coming month after month.
+
+ *** TAKE OUR FREE APTITUDE TEST ***
+To help determine if you are qualified to be a programmer, take a moment to
+try this simple test:
+ 1: Write down the numbers from zero to nine and the first six letters
+ of the alphabet (Hint: 0123456789ABCDEF).
+ 2: Whose picture is on the back of a twenty-dollar bill?
+ 3: What is the state capital of Idaho?
+If you managed to read all three questions without wondering why we asked
+them, you may have a future as a computer programmer.
+%
+ *** STUDENT SUCCESSES ***
+
+Many of our students have gone on to achieve great success in all fields of
+programming. One former student developed the concept of the personalized
+form letter. Does the phrase, "Dear Mr.(insert name), You may already be a
+winner!," sound familiar? Another student writes "After only five lessons I
+sold a "My Most Unforgettable Program" article to Corrosive Computing magazine.
+Another of our graduates writes, "I recently completed a database-management
+program for my department manager. My program touched him so deeply that he
+was speechless. He told me later that he had never seen such a program in
+his entire career. Thank you, Famous Programmers' school; only you could
+have made this possible." Send for our introductory brochure which explains
+in vague detail the operation of the Famous Programmers' School, and you'll
+be eligible to win a possible chance to enter a drawing, the winner of which
+can vie for a set of free steak knives. If you don't do it now, you'll hate
+yourself in the morning.
+%
+
+ *** System shutdown message from root ***
+
+System going down in 60 seconds
+
+
+%
+ ... This striving for excellence extends into people's
+personal lives as well. When '80s people buy something, they buy the
+best one, as determined by (1) price and (2) lack of availability.
+Eighties people buy imported dental floss. They buy gourmet baking
+soda. If an '80s couple goes to a restaurant where they have made a
+reservation three weeks in advance, and they are informed that their
+table is available, they stalk out immediately, because they know it is
+not an excellent restaurant. If it were, it would have an enormous
+crowd of excellence-oriented people like themselves waiting, their
+beepers going off like crickets in the night. An excellent restaurant
+wouldn't have a table ready immediately for anybody below the rank of
+Liza Minnelli.
+ -- Dave Barry, "In Search of Excellence"
+%
+ ... with liberty and justice for all who can afford it.
+%
+ 7,140 pounds on the Sun
+ 97 pounds on Mercury or Mars
+ 255 pounds on Earth
+ 232 pounds on Venus or Uranus
+ 43 pounds on the Moon
+ 648 pounds on Jupiter
+ 275 pounds on Saturn
+ 303 pounds on Neptune
+ 13 pounds on Pluto
+
+ -- How much Elvis Presley would weigh at various places
+ in the solar system.
+%
+ A boy scout troop went on a hike. Crossing over a stream, one of
+the boys dropped his wallet into the water. Suddenly a carp jumped, grabbed
+the wallet and tossed it to another carp. Then that carp passed it to
+another carp, and all over the river carp appeared and tossed the wallet back
+and forth.
+ "Well, boys," said the Scout leader, "you've just seen a rare case
+of carp-to-carp walleting."
+%
+ A carpet installer decides to take a cigarette break after completing
+the installation in the first of several rooms he has to do. Finding them
+missing from his pocket he begins searching, only to notice a small lump in
+his recently completed carpet-installation. Not wanting to pull up all that
+work for a lousy pack of cigarettes he simply walks over and pounds the lump
+flat. Foregoing the break, he continues on to the other rooms to be carpeted.
+ At the end of the day, while loading his tools into his truck, two
+events occur almost simultaneously: he spies his pack of cigarettes on the
+dashboard of the truck, and the lady of the house summons him imperiously:
+"Have you seen my parakeet?"
+%
+ A circus foreman was making the rounds inspecting the big top when
+a scrawny little man entered the tent and walked up to him. "Are you the
+foreman around here?" he asked timidly. "I'd like to join your circus; I
+have what I think is a pretty good act."
+ The foreman nodded assent, whereupon the little man hurried over to
+the main pole and rapidly climbed up to the very tip-top of the big top.
+Drawing a deep breath, he hurled himself off into the air and began flapping
+his arms furiously. Amazingly, rather than plummeting to his death the little
+man began to fly all around the poles, lines, trapezes and other obstacles,
+performing astounding feats of aerobatics which ended in a long power dive
+from the top of the tent, pulling up into a gentle feet-first landing beside
+the foreman, who had been nonchalantly watching the whole time.
+ "Well," puffed the little man. "What do you think?"
+ "That's all you do?" answered the foreman scornfully. "Bird
+imitations?"
+%
+ A crow perched himself on a telephone wire. He was going to make a
+long-distance caw.
+%
+ A disciple of another sect once came to Drescher as he was eating
+his morning meal. "I would like to give you this personality test", said
+the outsider, "because I want you to be happy."
+ Drescher took the paper that was offered him and put it into the
+toaster -- "I wish the toaster to be happy too".
+%
+ A doctor, an architect, and a computer scientist were arguing about
+whose profession was the oldest. In the course of their arguments, they
+got all the way back to the Garden of Eden, whereupon the doctor said, "The
+medical profession is clearly the oldest, because Eve was made from Adam's
+rib, as the story goes, and that was a simply incredible surgical feat."
+ The architect did not agree. He said, "But if you look at the Garden
+itself, in the beginning there was chaos and void, and out of that the Garden
+and the world were created. So God must have been an architect."
+ The computer scientist, who'd listened carefully to all of this, then
+commented, "Yes, but where do you think the chaos came from?"
+%
+ A domineering man married a mere wisp of a girl. He came back from
+his honeymoon a chastened man. He'd become aware of the will of the wisp.
+%
+ A farm in the country side had several turkeys, it was known as the
+house of seven gobbles.
+%
+ A father gave his teenage daughter an untrained pedigreed pup for
+her birthday. An hour later, when wandered through the house, he found her
+looking at a puddle in the center of the kitchen. "My pup," she murmured
+sadly, "runneth over."
+%
+ A German, a Pole and a Czech left camp for a hike through the woods.
+After being reported missing a day or two later, rangers found two bears,
+one a male, one a female, looking suspiciously overstuffed. They killed
+the female, autopsied her, and sure enough, found the German and the Pole.
+ "What do you think?" said the first ranger.
+ "The Czech is in the male," replied the second.
+%
+ A hard-luck actor who appeared in one colossal disaster after another
+finally got a break, a broken leg to be exact. Someone pointed out that it's
+the first time the poor fellow's been in the same cast for more than a week.
+%
+ A horrible little boy came up to me and said, "You know in your
+book The Martian Chronicles?"
+ I said, "Yes?"
+ He said, "You know where you talk about Deimos rising in the
+East?"
+ I said, "Yes?"
+ He said "No." -- So I hit him.
+ -- attributed to Ray Bradbury
+%
+ A horse breeder has his young colts bottle-fed after they're three
+days old. He heard that a foal and his mummy are soon parted.
+%
+ A housewife, an accountant and a lawyer were asked to add 2 and 2.
+ The housewife replied, "Four!".
+ The accountant said, "It's either 3 or 4. Let me run those figures
+through my spread sheet one more time."
+ The lawyer pulled the drapes, dimmed the lights and asked in a
+hushed voice, "How much do you want it to be?"
+%
+ A lawyer named Strange was shopping for a tombstone. After he had
+made his selection, the stonecutter asked him what inscription he
+would like on it. "Here lies an honest man and a lawyer," responded the
+lawyer.
+ "Sorry, but I can't do that," replied the stonecutter. "In this
+state, it's against the law to bury two people in the same grave. However,
+I could put `here lies an honest lawyer', if that would be okay."
+ "But that won't let people know who it is" protested the lawyer.
+ "Certainly will," retorted the stonecutter. "people will read it
+and exclaim, "That's Strange!"
+%
+ A little dog goes into a saloon in the Wild West, and beckons to
+the bartender. "Hey, bartender, gimmie a whiskey."
+ The bartender ignores him.
+ "Hey bartender, gimmie a whiskey."
+ Still ignored.
+ "HEY BARMAN!! GIMMIE A WHISKEY!!"
+ The bartender takes out his six-shooter and shoots the dog in the
+leg, and the dog runs out the saloon, howling in pain.
+ Three years later, the wee dog appears again, wearing boots,
+jeans, chaps, a Stetson, gun belt, and guns. He ambles slowly into the
+saloon, goes up to the bar, leans over it, and says to the bartender,
+"I'm here t'git the man that shot muh paw."
+%
+ A man enters a pet shop, seeking to purchase a parrot. He points
+to a fine colorful bird and asks how much it costs.
+ When he is told it costs 70,000 zlotys, he whistles in amazement
+and asks why it is so much. "Well, the bird is fluent in Italian and
+French and can recite the periodic table." He points to another bird
+and is told that it costs 90,000 zlotys because it speaks French and
+German, can knit and can curse in Latin.
+ Finally the customer asks about a drab gray bird. "Ah," he is
+told, "that one is 150,000."
+ "Why, what can it do?" he asks.
+ "Well," says the shopkeeper, "to tell you the truth, he doesn't
+do anything, but the other birds call him Mr. Secretary."
+ -- being told in Poland, 1987
+%
+ A man from AI walked across the mountains to SAIL to see the Master,
+Knuth. When he arrived, the Master was nowhere to be found. "Where is the
+wise one named Knuth?" he asked a passing student.
+ "Ah," said the student, "you have not heard. He has gone on a
+pilgrimage across the mountains to the temple of AI to seek out new
+disciples."
+ Hearing this, the man was Enlightened.
+%
+ A man goes to a tailor to try on a new custom-made suit. The
+first thing he notices is that the arms are too long.
+ "No problem," says the tailor. "Just bend them at the elbow
+and hold them out in front of you. See, now it's fine."
+ "But the collar is up around my ears!"
+ "It's nothing. Just hunch your back up a little ... no, a
+little more ... that's it."
+ "But I'm stepping on my cuffs!" the man cries in desperation.
+ "Nu, bend you knees a little to take up the slack. There you
+go. Look in the mirror -- the suit fits perfectly."
+ So, twisted like a pretzel, the man lurches out onto the
+street. Reba and Florence see him go by.
+ "Oh, look," says Reba, "that poor man!"
+ "Yes," says Florence, "but what a beautiful suit."
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+ A man met a beautiful young woman in a bar. They got along well,
+shared dinner, and had a marvelous evening. When he left her, he told her
+that he had really enjoyed their time together, and hoped to see her again,
+soon. Smiling yes, she gave him her phone number.
+ The next day, he called her up and asked her to go dancing. She
+agreed. As they talked, he jokingly asked her what her favorite flower was.
+Realizing his intentions, she told him that he shouldn't bring her flowers
+-- if he wanted to bring her a gift, well, he should bring her a Swiss Army
+knife!
+ Surprised, and not a little intrigued, he spent a large part of the
+afternoon finding a particularly unusual one. Arriving at her apartment
+he immediately presented her with the knife. She ooohed and ahhhed over it
+for a minute, and then carefully placed it in a drawer, that the man couldn't
+help but see was full of Swiss Army knives.
+ Surprised, he asked her why she had collected so many.
+ "Well, I'm young and attractive now", blushed the woman, "but that
+won't always be true. And boy scouts will do anything for a Swiss Army knife!"
+%
+ A man pleaded innocent of any wrong doing when caught by the police
+during a raid at the home of a mobster, excusing himself by claiming that he
+was making a bolt for the door.
+%
+ A man walked into a bar with his alligator and asked the bartender,
+"Do you serve lawyers here?".
+ "Sure do," replied the bartender.
+ "Good," said the man. "Give me a beer, and I'll have a lawyer for
+my 'gator."
+%
+ A man was reading The Canterbury Tales one Saturday morning, when his
+wife asked "What have you got there?" Replied he, "Just my cup and Chaucer."
+%
+ A man who keeps stealing mopeds is an obvious cycle-path.
+%
+ A manager asked a programmer how long it would take him to finish the
+program on which he was working. "I will be finished tomorrow," the programmer
+promptly replied.
+ "I think you are being unrealistic," said the manager. "Truthfully,
+how long will it take?"
+ The programmer thought for a moment. "I have some features that I wish
+to add. This will take at least two weeks," he finally said.
+ "Even that is too much to expect," insisted the manager, "I will be
+satisfied if you simply tell me when the program is complete."
+ The programmer agreed to this.
+ Several years later, the manager retired. On the way to his
+retirement lunch, he discovered the programmer asleep at his terminal.
+He had been programming all night.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A manager was about to be fired, but a programmer who worked for him
+invented a new program that became popular and sold well. As a result, the
+manager retained his job.
+ The manager tried to give the programmer a bonus, but the programmer
+refused it, saying, "I wrote the program because I though it was an interesting
+concept, and thus I expect no reward."
+ The manager, upon hearing this, remarked, "This programmer, though he
+holds a position of small esteem, understands well the proper duty of an
+employee. Lets promote him to the exalted position of management consultant!"
+ But when told this, the programmer once more refused, saying, "I exist
+so that I can program. If I were promoted, I would do nothing but waste
+everyone's time. Can I go now? I have a program that I'm working on."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A manager went to his programmers and told them: "As regards to your
+work hours: you are going to have to come in at nine in the morning and leave
+at five in the afternoon." At this, all of them became angry and several
+resigned on the spot.
+ So the manager said: "All right, in that case you may set your own
+working hours, as long as you finish your projects on schedule." The
+programmers, now satisfied, began to come in a noon and work to the wee
+hours of the morning.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A manager went to the master programmer and showed him the requirements
+document for a new application. The manager asked the master: "How long will
+it take to design this system if I assign five programmers to it?"
+ "It will take one year," said the master promptly.
+ "But we need this system immediately or even sooner! How long will it
+take it I assign ten programmers to it?"
+ The master programmer frowned. "In that case, it will take two years."
+ "And what if I assign a hundred programmers to it?"
+ The master programmer shrugged. "Then the design will never be
+completed," he said.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A master programmer passed a novice programmer one day. The master
+noted the novice's preoccupation with a hand-held computer game. "Excuse me",
+he said, "may I examine it?"
+ The novice bolted to attention and handed the device to the master.
+"I see that the device claims to have three levels of play: Easy, Medium,
+and Hard", said the master. "Yet every such device has another level of play,
+where the device seeks not to conquer the human, nor to be conquered by the
+human."
+ "Pray, great master," implored the novice, "how does one find this
+mysterious setting?"
+ The master dropped the device to the ground and crushed it under foot.
+And suddenly the novice was enlightened.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A master was explaining the nature of the Tao to one of his novices,
+"The Tao is embodied in all software -- regardless of how insignificant,"
+said the master.
+ "Is the Tao in a hand-held calculator?" asked the novice.
+ "It is," came the reply.
+ "Is the Tao in a video game?" continued the novice.
+ "It is even in a video game," said the master.
+ "And is the Tao in the DOS for a personal computer?"
+ The master coughed and shifted his position slightly. "The lesson is
+over for today," he said.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A MODERN FABLE
+
+Aesop's fables and other traditional children's stories involve allegory
+far too subtle for the youth of today. Children need an updated message
+with contemporary circumstance and plot line, and short enough to suit
+today's minute attention span.
+
+ The Troubled Aardvark
+
+Once upon a time, there was an aardvark whose only pleasure in life was
+driving from his suburban bungalow to his job at a large brokerage house
+in his brand new 4x4. He hated his manipulative boss, his conniving and
+unethical co-workers, his greedy wife, and his sniveling, spoiled
+children. One day, the aardvark reflected on the meaning of his life and
+his career and on the unchecked, catastrophic decline of his nation, its
+pathetic excuse for leadership, and the complete ineffectiveness of any
+personal effort he could make to change the status quo. Overcome by a
+wave of utter depression and self-doubt, he decided to take the only
+course of action that would bring him greater comfort and happiness: he
+drove to the mall and bought imported consumer electronics goods.
+
+MORAL OF THE STORY: Invest in foreign consumer electronics manufacturers.
+ -- Tom Annau
+%
+ A musical reviewer admitted he always praised the first show of a
+new theatrical season. "Who am I to stone the first cast?"
+%
+ A musician of more ambition than talent composed an elegy at
+the death of composer Edward MacDowell. She played the elegy for the
+pianist Josef Hoffman, then asked his opinion. "Well, it's quite
+nice," he replied, but don't you think it would be better if..."
+ "If what?" asked the composer.
+ "If ... if you had died and MacDowell had written the elegy?"
+%
+ A novel approach is to remove all power from the system, which
+removes most system overhead so that resources can be fully devoted to
+doing nothing. Benchmarks on this technique are promising; tremendous
+amounts of nothing can be produced in this manner. Certain hardware
+limitations can limit the speed of this method, especially in the
+larger systems which require a more involved & less efficient
+power-down sequence.
+ An alternate approach is to pull the main breaker for the
+building, which seems to provide even more nothing, but in truth has
+bugs in it, since it usually inhibits the systems which keep the beer
+cool.
+%
+ A novice asked the Master: "Here is a programmer that never designs,
+documents, or tests his programs. Yet all who know him consider him one of
+the best programmers in the world. Why is this?"
+ The Master replies: "That programmer has mastered the Tao. He has
+gone beyond the need for design; he does not become angry when the system
+crashes, but accepts the universe without concern. He has gone beyond the
+need for documentation; he no longer cares if anyone else sees his code. He
+has gone beyond the need for testing; each of his programs are perfect within
+themselves, serene and elegant, their purpose self-evident. Truly, he has
+entered the mystery of the Tao."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A novice asked the master: "I have a program that sometimes runs and
+sometimes aborts. I have followed the rules of programming, yet I am totally
+baffled. What is the reason for this?"
+ The master replied: "You are confused because you do not understand
+the Tao. Only a fool expects rational behavior from his fellow humans. Why
+do you expect it from a machine that humans have constructed? Computers
+simulate determinism; only the Tao is perfect.
+ The rules of programming are transitory; only the Tao is eternal.
+Therefore you must contemplate the Tao before you receive enlightenment."
+ "But how will I know when I have received enlightenment?" asked the
+novice.
+ "Your program will then run correctly," replied the master.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A novice asked the master: "I perceive that one computer company is
+much larger than all others. It towers above its competition like a giant
+among dwarfs. Any one of its divisions could comprise an entire business.
+Why is this so?"
+ The master replied, "Why do you ask such foolish questions? That
+company is large because it is so large. If it only made hardware, nobody
+would buy it. If it only maintained systems, people would treat it like a
+servant. But because it combines all of these things, people think it one
+of the gods! By not seeking to strive, it conquers without effort."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A novice asked the master: "In the east there is a great tree-structure
+that men call 'Corporate Headquarters'. It is bloated out of shape with
+vice-presidents and accountants. It issues a multitude of memos, each saying
+'Go, Hence!' or 'Go, Hither!' and nobody knows what is meant. Every year new
+names are put onto the branches, but all to no avail. How can such an
+unnatural entity exist?"
+ The master replies: "You perceive this immense structure and are
+disturbed that it has no rational purpose. Can you not take amusement from
+its endless gyrations? Do you not enjoy the untroubled ease of programming
+beneath its sheltering branches? Why are you bothered by its uselessness?"
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A novice programmer was once assigned to code a simple financial
+package.
+ The novice worked furiously for many days, but when his master
+reviewed his program, he discovered that it contained a screen editor, a set
+of generalized graphics routines, and artificial intelligence interface,
+but not the slightest mention of anything financial.
+ When the master asked about this, the novice became indignant.
+"Don't be so impatient," he said, "I'll put the financial stuff in eventually."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A novice was trying to fix a broken lisp machine by turning the
+power off and on. Knight, seeing what the student was doing spoke sternly,
+"You cannot fix a machine by just power-cycling it with no understanding
+of what is going wrong." Knight turned the machine off and on. The
+machine worked.
+%
+ "A penny for your thoughts?"
+ "A dollar for your death."
+ -- The Odd Couple
+%
+ A Pole, a Soviet, an American, an Englishman and a Canadian were lost
+in a forest in the dead of winter. As they were sitting around a fire, they
+noticed a pack of wolves eyeing them hungrily.
+ The Englishman volunteered to sacrifice himself for the rest of the
+party. He walked out into the night.
+ The American, not wanting to be outdone by an Englishman, offered to
+be the next victim. The wolves eagerly accepted his offer, and devoured him,
+too.
+ The Soviet, believing himself to be better than any American, turned
+to the Pole and says, "Well, comrade, I shall volunteer to give my life to
+save a fellow socialist." He leaves the shelter and goes out to be killed by
+the wolf pack.
+ At this point, the Pole opened his jacket and pulls out a machine gun.
+He takes aim in the general direction of the wolf pack and in a few seconds
+has killed them all.
+ The Canadian asked the Pole, "Why didn't you do that before the others
+went out to be killed?
+ The Pole pulls a bottle of vodka from the other side of his jacket.
+He smiles and replies, "Five men on one bottle -- too many."
+%
+ A program should be light and agile, its subroutines connected like a
+strings of pearls. The spirit and intent of the program should be retained
+throughout. There should be neither too little nor too much, neither needless
+loops nor useless variables, neither lack of structure nor overwhelming
+rigidity.
+ A program should follow the "Law of Least Astonishment." What is this
+law? It is simply that the program should always respond to the user in the
+way that astonishes him least.
+ A program, no matter how complex, should act as a single unit. The
+program should be directed by the logic within rather than by outward
+appearances.
+ If the program fails in these requirements, it will be in a state of
+disorder and confusion. The only way to correct this is to rewrite the
+program.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A programmer from a very large computer company went to a software
+conference and then returned to report to his manager, saying: "What sort
+of programmers work for other companies? They behaved badly and were
+unconcerned with appearances. Their hair was long and unkempt and their
+clothes were wrinkled and old. They crashed our hospitality suites and they
+made rude noises during my presentation."
+ The manager said: "I should have never sent you to the conference.
+Those programmers live beyond the physical world. They consider life absurd,
+an accidental coincidence. They come and go without knowing limitations.
+Without a care, they live only for their programs. Why should they bother
+with social conventions?"
+ "They are alive within the Tao."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ A pushy romeo asked a gorgeous elevator operator, "Don't all
+these stops and starts get you pretty worn out?"
+ "It isn't the stops and starts that get on my nerves, it's the
+jerks."
+%
+ A ranger was walking through the forest and encountered a hunter
+carrying a shotgun and a dead loon. "What in the world do you think you're
+doing? Don't you know that the loon is on the endangered species list?"
+ Instead of answering, the hunter showed the ranger his game bag,
+which contained twelve more loons.
+ "Why would you shoot loons?", the ranger asked.
+ "Well, my family eats them and I sell the plumage."
+ "What's so special about a loon? What does it taste like?"
+ "Oh, somewhere between an American Bald Eagle and a Trumpeter Swan."
+%
+ A reader reports that when the patient died, the attending doctor
+recorded the following on the patient's chart: "Patient failed to fulfill
+his wellness potential."
+
+ Another doctor reports that in a recent issue of the *American Journal
+of Family Practice* fleas were called "hematophagous arthropod vectors."
+
+ A reader reports that the Army calls them "vertically deployed anti-
+personnel devices." You probably call them bombs.
+
+ At McClellan Air Force base in Sacramento, California, civilian
+mechanics were placed on "non-duty, non-pay status." That is, they were fired.
+
+ After taking the trip of a lifetime, our reader sent his twelve rolls
+of film to Kodak for developing (or "processing," as Kodak likes to call it)
+only to receive the following notice: "We must report that during the handling
+of your twelve 35mm Kodachrome slide orders, the films were involved in an
+unusual laboratory experience." The use of the passive is a particularly nice
+touch, don't you think? Nobody did anything to the films; they just had a bad
+experience. Of course our reader can always go back to Tibet and take his
+pictures all over again, using the twelve replacement rolls Kodak so generously
+sent him.
+ -- Quarterly Review of Doublespeak (NCTE)
+%
+ A reverend wanted to telephone another reverend. He told the operator,
+"This is a parson to parson call."
+ A farmer with extremely prolific hens posted the following sign. "Free
+Chickens. Our Coop Runneth Over."
+ Two brothers, Mort and Bill, like to sail. While Bill has a great
+deal of experience, he certainly isn't the rigger Mort is.
+ Inheritance taxes are getting so out of line, that the deceased family
+often doesn't have a legacy to stand on.
+ The judge fined the jaywalker fifty dollars and told him if he was
+caught again, he would be thrown in jail. Fine today, cooler tomorrow.
+ A rock store eventually closed down; they were taking too much for
+granite.
+%
+ A Scotsman was strolling across High Street one day wearing his kilt.
+As he neared the far curb, he noticed two young blondes in a red convertible
+eyeing him and giggling. One of them called out, "Hey, Scotty! What's worn
+under the kilt?"
+ He strolled over to the side of the car and asked, "Ach, lass, are you
+SURE you want to know?" Somewhat nervously, the blonde replied yes, she did
+really want to know.
+ The Scotsman leaned closer and confided, "Why, lass, nothing's worn
+under the kilt, everything's in perfect workin' order!"
+%
+ A sheet of paper crossed my desk the other day and as I read it,
+realization of a basic truth came over me. So simple! So obvious we couldn't
+see it. John Knivlen, Chairman of Palomar Repeater Club, an amateur radio
+group, had discovered how IC circuits work. He says that smoke is the thing
+that makes ICs work because every time you let the smoke out of an IC circuit,
+it stops working. He claims to have verified this with thorough testing.
+ I was flabbergasted! Of course! Smoke makes all things electrical
+work. Remember the last time smoke escaped from your Lucas voltage regulator
+Didn't it quit working? I sat and smiled like an idiot as more of the truth
+dawned. It's the wiring harness that carries the smoke from one device to
+another in your Mini, MG or Jag. And when the harness springs a leak, it lets
+the smoke out of everything at once, and then nothing works. The starter motor
+requires large quantities of smoke to operate properly, and that's why the wire
+going to it is so large.
+ Feeling very smug, I continued to expand my hypothesis. Why are Lucas
+electronics more likely to leak than say Bosch? Hmmm... Aha!!! Lucas is
+British, and all things British leak! British convertible tops leak water,
+British engines leak oil, British displacer units leak hydrostatic fluid, and
+I might add British tires leak air, and the British defense unit leaks
+secrets... so naturally British electronics leak smoke.
+ -- Jack Banton, PCC Automotive Electrical School
+%
+ A shy teenage boy finally worked up the nerve to give a gift to
+Madonna, a young puppy. It hitched its waggin' to a star.
+ A girl spent a couple hours on the phone talking to her two best
+friends, Maureen Jones, and Maureen Brown. When asked by her father why she
+had been on the phone so long, she responded "I heard a funny story today
+and I've been telling it to the Maureens."
+ Three actors, Tom, Fred, and Cec, wanted to do the jousting scene
+from Don Quixote for a local TV show. "I'll play the title role," proposed
+Tom. "Fred can portray Sancho Panza, and Cecil B. De Mille."
+%
+ "...A strange enigma is man!"
+ "Someone calls him a soul concealed in an animal," I suggested.
+ "Winwood Reade is good upon the subject," said Holmes. "He remarked
+that, while the individual man is an insoluble puzzle, in the aggregate he
+becomes a mathematical certainty. You can, for example, never foretell what
+any one man will do, but you can say with precision what an average number
+will be up to. Individuals vary, but percentages remain constant. So says
+the statistician."
+ -- Sherlock Holmes, "The Sign of Four"
+%
+ A woman was in love with fourteen soldiers, it was clearly platoonic.
+%
+ A young honeymoon couple were touring southern Florida and happened
+to stop at one of the rattlesnake farms along the road. After seeing the
+sights, they engaged in small talk with the man that handled the snakes.
+"Gosh!" exclaimed the new bride. "You certainly have a dangerous job.
+Don't you ever get bitten by the snakes?"
+ "Yes, upon rare occasions," answered the handler.
+ "Well," she continued, "just what do you do when you're bitten by
+a snake?"
+ "I always carry a razor-sharp knife in my pocket, and as soon as I
+am bitten, I make deep criss-cross marks across the fang entry and then
+suck the poison from the wound."
+ "What, uh... what would happen if you were to accidentally *sit* on
+a rattler?" persisted the woman.
+ "Ma'am," answered the snake handler, "that will be the day I learn
+who my real friends are."
+%
+ A young husband with an inferiority complex insisted he was just a
+little pebble on the beach. The marriage counselor told him, "If you wish to
+save your marriage, you'd better be a little boulder."
+%
+ A young married couple had their first child. Their original pride
+and joy slowly turned to concern however, for after a couple of years the
+child had never uttered any form of speech. They hired the best speech
+therapists, doctors, psychiatrists, all to no avail. The child simply refused
+to speak. One morning when the child was five, while the husband was reading
+the paper, and the wife was feeding the dog, the little kid looks up from
+his bowl and said, "My cereal's cold."
+ The couple is stunned. The man, in tears, confronts his son. "Son,
+after all these years, why have you waited so long to say something?".
+ Shrugs the kid, "Everything's been okay 'til now".
+%
+ ACHTUNG!!!
+Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
+schnappen der springenwerk, blowenfusen und corkenpoppen mit
+spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
+rubbernecken sightseeren keepen hands in das pockets. Relaxen und
+vatch das blinkenlights!!!
+%
+ After his Ignoble Disgrace, Satan was being expelled from
+Heaven. As he passed through the Gates, he paused a moment in thought,
+and turned to God and said, "A new creature called Man, I hear, is soon
+to be created."
+ "This is true," He replied.
+ "He will need laws," said the Demon slyly.
+ "What! You, his appointed Enemy for all Time! You ask for the
+right to make his laws?"
+ "Oh, no!" Satan replied, "I ask only that he be allowed to
+make his own."
+ It was so granted.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+ After sifting through the overwritten remaining blocks of Luke's home
+directory, Luke and PDP-1 sped away from /u/lars, across the surface of the
+Winchester riding Luke's flying read/write head. PDP-1 had Luke stop at the
+edge of the cylinder overlooking /usr/spool/uucp.
+ "Unix-to-Unix Copy Program;" said PDP-1. "You will never find a more
+wretched hive of bugs and flamers. We must be cautious."
+ -- DECWARS
+%
+ After the Children of Israel had wandered for thirty-nine years in
+ the wilderness, Ferdinand Feghoot arrived to make sure that they
+would finally find and enter the Promised Land. With him, he brought his
+favorite robot, faithful old Yewtoo Artoo, to carry his gear and do assorted
+camp chores.
+ The Israelites soon got over their initial fear of the robot and,
+ as the months passed, became very fond of him. Patriarchs took to
+discussing abstruse theological problems with him, and each evening the
+children all gathered to hear the many stories with which he was programmed.
+Therefore it came as a great shock to them when, just as their journey was
+ending, he abruptly wore out. Even Feghoot couldn't console them.
+ "It may be true, Ferdinand Feghoot," said Moses, "that our friend
+Yewtoo Artoo was soulless, but we cannot believe it. He must be properly
+interred. We cannot embalm him as do the Egyptians. Nor have we wood for
+a coffin. But I do have a most splendid skin from one of Pharoah's own
+cattle. We shall bury him in it."
+ Feghoot agreed. "Yes, let this be his last rusting place." "Rusting?"
+ Moses cried. "Not in this dreadful dry desert!"
+ "Ah!" sighed Ferdinand Feghoot, shedding a tear, "I fear you do not
+realize the full significance of Pharoah's oxhide!"
+ -- Grendel Briarton "Through Time & Space With Ferdinand
+ Feghoot!"
+%
+ All I really need to know about how to live and what to do and
+how to be I learned in kindergarten. Wisdom was not at the top of the
+graduate-school mountain, but there in the sandpile at Sunday School.
+These are the things I learned:
+ Share everything.
+ Play fair.
+ Don't hit people.
+ Put things back where you found them.
+ Clean up your own mess.
+ Don't take things that aren't yours.
+ Say you're sorry when you hurt someone.
+ Wash your hands before you eat.
+ Flush.
+ Warm cookies and cold milk are good for you.
+ Live a balanced life -- learn some and think some and draw and
+paint and sing and dance and play and work every day some.
+ Take a nap every afternoon.
+ When you go out into the world, watch for traffic, hold hands,
+and stick together.
+ Be aware of wonder. Remember the little seed in the Styrofoam
+cup: The roots go down and the plant goes up and nobody really knows
+how or why, but we are all like that.
+ Goldfish and hamsters and white mice and even the little seed in
+the Styrofoam cup -- they all die. So do we.
+ And then remember the Dick-and-Jane books and the first word you
+learned -- the biggest word of all -- LOOK.
+ Everything you need to know is in there somewhere. The Golden
+Rule and love and basic sanitation. Ecology and politics and equality
+and sane living.
+ [...] Think what a better world it would be if we all -- the
+whole world -- had cookies and milk about three o'clock every afternoon
+and then lay down with our blankets for a nap. Or if all governments
+had as a basic policy to always put things back where they found them
+and to clean up their own mess.
+ And it is still true, no matter how old you are -- when you go
+out into the world, it is best to hold hands and stick together.
+ -- Robert Fulghum, "All I Ever Really Needed to Know
+ I Learned in Kindergarten"
+%
+ All that you touch, And all you create,
+ All that you see, And all you destroy,
+ All that you taste, All that you do,
+ All you feel, And all you say,
+ And all that you love, All that you eat,
+ And all that you hate, And everyone you meet,
+ All you distrust, All that you slight,
+ All you save, And everyone you fight,
+ And all that you give, And all that is now,
+ And all that you deal, And all that is gone,
+ All that you buy, And all that's to come,
+ Beg, borrow or steal, And everything under the sun is
+ in tune,
+ But the sun is eclipsed
+ By the moon.
+
+There is no dark side of the moon... really... matter of fact it's all dark.
+ -- Pink Floyd, "Dark Side of the Moon"
+%
+ America, Russia and Japan are sending up a two year shuttle mission
+with one astronaut from each country. Since it's going to be two long, lonely
+years up there, each may bring any form of entertainment weighing 150 pounds
+or less. The American approaches the NASA board and asks to take his 125 lb.
+wife. They approve.
+ The Japanese astronaut says, "I've always wanted to learn Latin. I
+want 100 lbs. of textbooks." The NASA board approves. The Russian astronaut
+thinks for a second and says, "Two years... all right, I want 150 pounds of
+the best Cuban cigars ever made." Again, NASA okays it.
+ Two years later, the shuttle lands and everyone is gathered outside
+to welcome back the astronauts. Well, it's obvious what the American's been
+up to, he and his wife are each holding an infant. The crowd cheers. The
+Japanese astronaut steps out and makes a 10 minute speech in absolutely
+perfect Latin. The crowd doesn't understand a word of it, but they're
+impressed and they cheer again. The Russian astronaut stomps out, clenches
+the podium until his knuckles turn white, glares at the first row and
+screams: "Anybody got a match?"
+%
+ An airplane pilot got engaged to two very pretty women at the same
+time. One was named Edith; the other named Kate. They met, discovered they
+had the same fiancee, and told him. "Get out of our lives you rascal. We'll
+teach you that you can't have your Kate and Edith, too."
+%
+ An architect's first work is apt to be spare and clean. He knows
+he doesn't know what he's doing, so he does it carefully and with great
+restraint.
+ As he designs the first work, frill after frill and embellishment
+after embellishment occur to him. These get stored away to be used "next
+time". Sooner or later the first system is finished, and the architect,
+with firm confidence and a demonstrated mastery of that class of systems,
+is ready to build a second system.
+ This second is the most dangerous system a man ever designs. When
+he does his third and later ones, his prior experiences will confirm each
+other as to the general characteristics of such systems, and their differences
+will identify those parts of his experience that are particular and not
+generalizable.
+ The general tendency is to over-design the second system, using all
+the ideas and frills that were cautiously sidetracked on the first one.
+The result, as Ovid says, is a "big pile".
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+ An elderly man stands in line for hours at a Warsaw meat store (meat
+is severely rationed). When the butcher comes out at the end of the day and
+announces that there is no meat left, the man flies into a rage.
+ "What is this?" he shouts. "I fought against the Nazis, I worked hard
+all my life, I've been a loyal citizen, and now you tell me I can't even buy a
+piece of meat? This rotten system stinks!"
+ Suddenly a thuggish man in a black leather coat sidles up and murmurs
+"Take it easy, comrade. Remember what would have happened if you had made an
+outburst like that only a few years ago" -- and he points an imaginary gun to
+this head and pulls the trigger.
+ The old man goes home, and his wife says, "So they're out of meat
+again?"
+ "It's worse than that," he replies. "They're out of bullets."
+ -- making the rounds in Warsaw, 1987
+%
+ An Englishman, a Frenchman and an American are captured by cannibals.
+The leader of the tribe comes up to them and says, "Even though you are about
+to killed, your deaths will not be in vain. Every part of your body will be
+used. Your flesh will be eaten, for my people are hungry. Your hair will be
+woven into clothing, for my people are naked. Your bones will be ground up
+and made into medicine, for my people are sick. Your skin will be stretched
+over canoe frames, for my people need transportation. We are a fair people,
+and we offer you a chance to kill yourself with our ceremonial knife."
+ The Englishman accepts the knife and yells, "God Save the Queen",
+while plunging the knife into his heart.
+ The Frenchman removes the knife from the fallen body, and yells,
+"Vive la France", while plunging the knife into his heart.
+ The American removes the knife from the fallen body, and yells,
+while stabbing himself all over his body, "Here's your lousy canoe!"
+%
+ An old Jewish man reads about Einstein's theory of relativity
+in the newspaper and asks his scientist grandson to explain it to him.
+ "Well, zayda, it's sort of like this. Einstein says that if
+you're having your teeth drilled without Novocain, a minute seems like
+an hour. But if you're sitting with a beautiful woman on your lap, an
+hour seems like a minute."
+ The old man considers this profound bit of thinking for a
+moment and says, "And from this he makes a living?"
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+ An older student came to Otis and said, "I have been to see a
+great number of teachers and I have given up a great number of pleasures.
+I have fasted, been celibate and stayed awake nights seeking enlightenment.
+I have given up everything I was asked to give up and I have suffered, but
+I have not been enlightened. What should I do?"
+ Otis replied, "Give up suffering."
+ -- Camden Benares, "Zen Without Zen Masters"
+%
+ "And what will you do when you grow up to be as big as me?"
+asked the father of his little son.
+ "Diet."
+%
+ "Any news from the President on a successor?" he asked hopefully.
+ "None," Anita replied. "She's having great difficulty finding
+someone qualified who is willing to accept the post."
+ "Then I stay," said Dr. Fresh. "I'm not good for much, but I
+can at least make a decision."
+ "Somewhere," he grumphed, "there must be a naive, opportunistic
+young welp with a masochistic streak who would like to run the most
+up-and-down bureaucracy in the history of mankind."
+ -- R. L. Forward, "Flight of the Dragonfly"
+%
+ "Anything else you wish to draw to my attention, Mr. Holmes ?"
+ "The curious incident of the stable dog in the nighttime."
+ "But the dog did nothing in the nighttime."
+ "That was the curious incident."
+ -- Sir Arthur Conan Doyle, "Silver Blaze"
+%
+ Approaching the gates of the monastery, Hakuin found Ken the Zen
+preaching to a group of disciples.
+ "Words..." Ken orated, "they are but an illusory veil obfuscating
+the absolute reality of --"
+ "Ken!" Hakuin interrupted. "Your fly is down!"
+ Whereupon the Clear Light of Illumination exploded upon Ken, and he
+vaporized.
+ On the way to town, Hakuin was greeted by an itinerant monk imbued
+with the spirit of the morning.
+ "Ah," the monk sighed, a beatific smile wrinkling across his cheeks,
+"Thou art That..."
+ "Ah," Hakuin replied, pointing excitedly, "And Thou art Fat!"
+ Whereupon the Clear Light of Illumination exploded upon the monk,
+and he vaporized.
+ Next, the Governor sought the advice of Hakuin, crying: "As our
+enemies bear down upon us, how shall I, with such heartless and callow
+soldiers as I am heir to, hope to withstand the impending onslaught?"
+ "US?" snapped Hakuin.
+ Whereupon the Clear Light of Illumination exploded upon the
+Governor, and he vaporized.
+ Then, a redneck went up to Hakuin and vaporized the old Master with
+his shotgun. "Ha! Beat ya' to the punchline, ya' scrawny li'l geek!"
+%
+ "Are you police officers?"
+ "No, ma'am. We're musicians."
+ -- The Blues Brothers
+%
+ "Are you sure you're not an encyclopedia salesman?"
+ "No, Ma'am. Just a burglar, come to ransack the flat."
+ -- Monty Python
+%
+ As a general rule of thumb, never trust anybody who's been in therapy
+for more than 15 percent of their life span. The words "I am sorry" and "I
+am wrong" will have totally disappeared from their vocabulary. They will stab
+you, shoot you, break things in your apartment, say horrible things to your
+friends and family, and then justify this abhorrent behavior by saying:
+ "Sure, I put your dog in the microwave. But I feel *better*
+for doing it."
+ -- Bruce Feirstein, "Nice Guys Sleep Alone"
+%
+ At a recent meeting in Snowmass, Colorado, a participant from
+Los Angeles fainted from hyperoxygenation, and we had to hold his head
+under the exhaust of a bus until he revived.
+%
+ Before he became a hermit, Zarathud was a young Priest, and
+took great delight in making fools of his opponents in front of his
+followers.
+ One day Zarathud took his students to a pleasant pasture and
+there he confronted The Sacred Chao while She was contentedly grazing.
+ "Tell me, you dumb beast," demanded the Priest in his
+commanding voice, "why don't you do something worthwhile? What is your
+Purpose in Life, anyway?"
+ Munching the tasty grass, The Sacred Chao replied "MU". (The
+Chinese ideogram for NO-THING.)
+ Upon hearing this, absolutely nobody was enlightened.
+ Primarily because nobody understood Chinese.
+ -- Camden Benares, "Zen Without Zen Masters"
+%
+ "Beware of the man who works hard to learn something, learns it,
+and finds himself no wiser than before," Bokonon tells us. "He is full
+of murderous resentment of people who are ignorant without having come
+by their ignorance the hard way."
+ -- Kurt Vonnegut, Jr., "Cat's Cradle"
+%
+ Bubba, Jim Bob, and Leroy were fishing out on the lake last November,
+and, when Bubba tipped his head back to empty the Jim Beam, he fell out of the
+boat into the lake. Jim Bob and Leroy pulled him back in, but as Bubba didn't
+look too good, they started up the Evinrude and headed back to the pier.
+ By the time they got there, Bubba was turning kind of blue, and his
+teeth were chattering like all get out. Jim Bob said, "Leroy, go run up to
+the pickup and get Doc Pritchard on the CB, and ask him what we should do".
+ Doc Pritchard, after hearing a description of the case, said "Now,
+Leroy, listen closely. Bubba is in great danger. He has hy-po-thermia. Now
+what you need to do is get all them wet clothes off of Bubba, and take your
+clothes off, and pile your clothes and jackets on top of him. Then you all
+get under that pile, and hug up to Bubba real close so that you warm him up.
+You understand me Leroy? You gotta warm Bubba up, or he'll die."
+ Leroy and the Doc 10-4'ed each other, and Leroy came back to the
+pier. "Wh-Wh-What'd th-th-the d-d-doc s-s-say L-L-Leroy?", Bubba chattered.
+ "Bubba, Doc says you're gonna die."
+%
+ "But Huey, you PROMISED!"
+ "Tell 'em I lied."
+%
+ By the middle 1880's, practically all the roads except those in
+the South, were of the present standard gauge. The southern roads were
+still five feet between rails.
+ It was decided to change the gauge of all southern roads to standard,
+in one day. This remarkable piece of work was carried out on a Sunday in May
+of 1886. For weeks beforehand, shops had been busy pressing wheels in on the
+axles to the new and narrower gauge, to have a supply of rolling stock which
+could run on the new track as soon as it was ready. Finally, on the day set,
+great numbers of gangs of track layers went to work at dawn. Everywhere one
+rail was loosened, moved in three and one-half inches, and spiked down in its
+new position. By dark, trains from anywhere in the United States could operate
+over the tracks in the South, and a free interchange of freight cars everywhere
+was possible.
+ -- Robert Henry, "Trains", 1957
+%
+ Carol's head ached as she trailed behind the unsmiling Calibrees
+along the block of booths. She chirruped at Kennicott, "Let's be wild!
+Let's ride on the merry-go-round and grab a gold ring!"
+ Kennicott considered it, and mumbled to Calibree, "Think you folks
+would like to stop and try a ride on the merry-go-round?"
+ Calibree considered it, and mumbled to his wife, "Think you'd like
+to stop and try a ride on the merry-go-round?"
+ Mrs. Calibree smiled in a washed-out manner, and sighed, "Oh no,
+I don't believe I care to much, but you folks go ahead and try it."
+ Calibree stated to Kennicott, "No, I don't believe we care to a
+whole lot, but you folks go ahead and try it."
+ Kennicott summarized the whole case against wildness: "Let's try
+it some other time, Carrie."
+ She gave it up.
+ -- Sinclair Lewis, "Main Street"
+%
+ Catching his children with their hands in the new, still wet, patio,
+the father spanked them. His wife asked, "Don't you love your children?"
+"In the abstract, yes, but not in the concrete."
+%
+ Chapter VIII
+Due to the convergence of forces beyond his comprehension,
+Salvatore Quanucci was suddenly squirted out of the universe
+like a watermelon seed, and never heard from again.
+%
+ "Cheshire-Puss," she began, "would you tell me, please, which
+way I ought to go from here?"
+ "That depends a good deal on where you want to get to," said
+the Cat.
+ "I don't care much where--" said Alice.
+ "Then it doesn't matter which way you go," said the Cat.
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+ Concerning the war in Vietnam, Senator George Aiken of Vermont noted
+in January, 1966, "I'm not very keen for doves or hawks. I think we need more
+owls."
+ -- Bill Adler, "The Washington Wits"
+%
+ COONDOG MEMORY
+ (heard in Rutledge, Missouri, about eighteen years ago)
+
+Now, this dog is for sale, and she can not only follow a trail twice as
+old as the average dog can, but she's got a pretty good memory to boot.
+For instance, last week this old boy who lives down the road from me, and
+is forever stinkmouthing my hounds, brought some city fellow around to
+try out ol' Sis here. So I turned her out south of the house and she made
+two or three big swings back and forth across the edge of the woods, set
+back her head, bayed a couple of times, cut straight through the woods,
+come to a little clearing, jumped about three foot straight up in the air,
+run to the other side, and commenced to letting out a racket like she had
+something treed. We went over there with our flashlights and shone them
+up in the tree but couldn't catch no shine offa coon's eyes, and my
+neighbor sorta indicated that ol' Sis might be a little crazy, `cause she
+stood right to the tree and kept singing up into it. So I pulled off my
+coat and climbed up into the branches, and sure enough, there was a coon
+skeleton wedged in between a couple of branches about twenty foot up.
+Now as I was saying, she can follow a pretty old trail, but this fellow
+was still calling her crazy or touched `cause she had hopped up in the
+air while she was crossing the clearing, until I reminded him that the
+Hawkins' had a fence across there about five years back. Now, this dog
+is for sale.
+ -- News that stayed News: Ten Years of Coevolution Quarterly
+%
+ Cosmotronic Software Unlimited Inc. does not warrant that the
+functions contained in the program will meet your requirements or that
+the operation of the program will be uninterrupted or error-free.
+ However, Cosmotronic Software Unlimited Inc. warrants the
+diskette(s) on which the program is furnished to be of black color and
+square shape under normal use for a period of ninety (90) days from the
+date of purchase.
+ NOTE: IN NO EVENT WILL COSMOTRONIC SOFTWARE UNLIMITED OR ITS
+DISTRIBUTORS AND THEIR DEALERS BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING
+ANY LOST PROFIT, LOST SAVINGS, LOST PATIENCE OR OTHER INCIDENTAL OR
+CONSEQUENTIAL DAMAGES.
+ -- Horstmann Software Design, the "ChiWriter" user manual
+%
+ Dallas Cowboys Official Schedule
+
+ Sept 14 Pasadena Junior High
+ Sept 21 Boy Scout Troop 049
+ Sept 28 Blind Academy
+ Sept 30 World War I Veterans
+ Oct 5 Brownie Scout Troop 041
+ Oct 12 Sugarcreek High Cheerleaders
+ Oct 26 St. Thomas Boys Choir
+ Nov 2 Texas City Vet Clinic
+ Nov 9 Korean War Amputees
+ Nov 15 VA Hospital Polio Patients
+%
+ Deck us all with Boston Charlie,
+ Walla Walla, Wash., an' Kalamazoo!
+ Nora's freezin' on the trolley,
+ Swaller dollar cauliflower, alleygaroo!
+
+ Don't we know archaic barrel,
+ Lullaby Lilla Boy, Louisville Lou.
+ Trolley Molly don't love Harold,
+ Boola boola Pensacoola hullabaloo!
+ -- Pogo, "Deck Us All With Boston Charlie"
+%
+ "Do you think there's a God?"
+ "Well, SOMEbody's out to get me!"
+ -- Calvin and Hobbs
+%
+ Does anyone know how to get chocolate syrup and honey out of a
+white electric blanket? I'm afraid to wash it in the machine.
+
+Thanks, Kathy. (front desk, x17)
+
+p.s. Also, anyone ever used Noxzema on friction burns?
+ Or is Vaseline better?
+%
+ "Don't come back until you have him", the Tick-Tock Man said quietly,
+sincerely, extremely dangerously.
+ They used dogs. They used probes. They used cardio plate crossoffs.
+They used teepers. They used bribery. They used stick tites. They used
+intimidation. They used torment. They used torture. They used finks.
+They used cops. They used search and seizure. They used fallaron. They
+used betterment incentives. They used finger prints. They used the
+bertillion system. They used cunning. They used guile. They used treachery.
+They used Raoul-Mitgong but he wasn't much help. They used applied physics.
+They used techniques of criminology. And what the hell, they caught him.
+ -- Harlan Ellison, "Repent, Harlequin, said the Tick-Tock Man"
+%
+ "Don't you think what we're doing is wrong?"
+ "Of course it's wrong! It's illegal!"
+ "Well, I've never done anything illegal before."
+ "... I thought you said you were an accountant."
+%
+ Dr. Oliver Wendell Holmes of Harvard Medical School inhaled ether
+at a time when it was popularly supposed to produce such mystical or
+"mind-expanding" experiences, much as LSD is supposed to produce such
+experiences today. Here is his account of what happened:
+ "I once inhaled a pretty full dose of ether, with the determination
+to put on record, at the earliest moment of regaining consciousness, the
+thought I should find uppermost in my mind. The mighty music of the triumphal
+march into nothingness reverberated through my brain, and filled me with a
+sense of infinite possibilities, which made me an archangel for a moment.
+The veil of eternity was lifted. The one great truth which underlies all
+human experience and is the key to all the mysteries that philosophy has
+sought in vain to solve, flashed upon me in a sudden revelation. Henceforth
+all was clear: a few words had lifted my intelligence to the level of the
+knowledge of the cherubim. As my natural condition returned, I remembered
+my resolution; and, staggering to my desk, I wrote, in ill-shaped, straggling
+characters, the all-embracing truth still glimmering in my consciousness.
+The words were these (children may smile; the wise will ponder):
+`A strong smell of turpentine prevails throughout.'"
+ -- The Consumers Union Report: Licit & Illicit Drugs
+%
+ During a fight, a husband threw a bowl of Jello at his wife. She had
+him arrested for carrying a congealed weapon.
+ In another fight, the wife decked him with a heavy glass pitcher.
+She's a woman who conks to stupor.
+ Upon reading a story about a man who throttled his mother-in-law, a
+man commented, "Sounds to me like a practical choker."
+ It's not the initial skirt length, it's the upcreep.
+ It's the theory of Jess Birnbaum, of Time magazine, that women with
+bad legs should stick to long skirts because they cover a multitude of shins.
+%
+ During a grouse hunt in North Carolina two intrepid sportsmen
+were blasting away at a clump of trees near a stone wall. Suddenly a
+red-faced country squire popped his head over the wall and shouted,
+"Hey, you almost hit my wife."
+ "Did I?" cried the hunter, aghast. "Terribly sorry. Have a
+shot at mine, over there."
+%
+ Electricity is actually made up of extremely tiny particles,
+called electrons, that you cannot see with the naked eye unless you
+have been drinking. Electrons travel at the speed of light, which in
+most American homes is 110 volts per hour. This is very fast. In the
+time it has taken you to read this sentence so far, an electron could
+have traveled all the way from San Francisco to Hackensack, New Jersey,
+although God alone knows why it would want to.
+ The five main kinds of electricity are alternating current,
+direct current, lightning, static, and European. Most American homes
+have alternating current, which means that the electricity goes in one
+direction for a while, then goes in the other direction. This prevents
+harmful electron buildup in the wires.
+ -- Dave Barry, "The Taming of the Screw"
+%
+ Eugene d'Albert, a noted German composer, was married six times.
+At an evening reception which he attended with his fifth wife shortly
+after their wedding, he presented the lady to a friend who said politely,
+"Congratulations, Herr d'Albert; you have rarely introduced me to so
+charming a wife."
+%
+ Everything is farther away than it used to be. It is even twice as
+far to the corner and they have added a hill. I have given up running for
+the bus; it leaves earlier than it used to.
+ It seems to me they are making the stairs steeper than in the old
+days. And have you noticed the smaller print they use in the newspapers?
+ There is no sense in asking anyone to read aloud anymore, as everybody
+speaks in such a low voice I can hardly hear them.
+ The material in dresses is so skimpy now, especially around the hips
+and waist, that it is almost impossible to reach one's shoelaces. And the
+sizes don't run the way they used to. The 12's and 14's are so much smaller.
+ Even people are changing. They are so much younger than they used to
+be when I was their age. On the other hand people my age are so much older
+than I am.
+ I ran into an old classmate the other day and she has aged so much
+that she didn't recognize me.
+ I got to thinking about the poor dear while I was combing my hair
+this morning and in so doing I glanced at my own reflection. Really now,
+they don't even make good mirrors like they used to.
+ Sandy Frazier, "I Have Noticed"
+%
+ Excellence is THE trend of the '80s. Walk into any shopping
+mall bookstore, go to the rack where they keep the best-sellers such as
+"Garfield Gets Spayed", and you'll see a half-dozen books telling you
+how to be excellent: "In Search of Excellence", "Finding Excellence",
+"Grasping Hold of Excellence", "Where to Hide Your Excellence at Night
+So the Cleaning Personnel Don't Steal It", etc.
+ -- Dave Barry, "In Search of Excellence"
+%
+ Exxon's "Universe of Energy" tends to the peculiar rather than the
+humorous ... After [an incomprehensible film montage about wind and sun and
+rain and strip mines and] two or three minutes of mechanical confusion, the
+seats locomote through a short tunnel filled with clock-work dinosaurs.
+The dinosaurs are depicted without accuracy and too close to your face.
+ "One of the few real novelties at Epcot is the use of smell to
+aggravate illusions. Of course, no one knows what dinosaurs smelled like,
+but Exxon has decided they smelled bad.
+ "At the other end of Dino Ditch ... there's a final, very addled
+message about facing challengehood tomorrow-wise. I dozed off during this,
+but the import seems to be that dinosaurs don't have anything to do with
+energy policy and neither do you."
+ -- P. J. O'Rourke, "Holidays in Hell"
+%
+ "Fantasies are free."
+ "NO!! NO!! It's the thought police!!!!"
+%
+ Festivity Level 1: Your guests are chatting amiably with each
+other, admiring your Christmas-tree ornaments, singing carols around
+the upright piano, sipping at their drinks and nibbling hors
+d'oeuvres.
+ Festivity Level 2: Your guests are talking loudly -- sometimes
+to each other, and sometimes to nobody at all, rearranging your
+Christmas-tree ornaments, singing "I Gotta Be Me" around the upright
+piano, gulping their drinks and wolfing down hors d'oeuvres.
+ Festivity Level 3: Your guests are arguing violently with
+inanimate objects, singing "I can't get no satisfaction," gulping down
+other peoples' drinks, wolfing down Christmas tree ornaments and
+placing hors d'oeuvres in the upright piano to see what happens when
+the little hammers strike.
+ Festivity Level 4: Your guests, hors d'oeuvres smeared all over
+their naked bodies are performing a ritual dance around the burning
+Christmas tree. The piano is missing.
+
+ You want to keep your party somewhere around level 3, unless
+you rent your home and own Firearms, in which case you can go to level
+4. The best way to get to level 3 is egg-nog.
+%
+ "For I perceive that behind this seemingly unrelated sequence
+of events, there lurks a singular, sinister attitude of mind."
+
+ "Whose?"
+
+ "MINE! HA-HA!"
+%
+ "Found it," the Mouse replied rather crossly:
+"of course you know what `it' means."
+
+ "I know what `it' means well enough, when I find a thing,"
+said the Duck: "it's generally a frog or a worm.
+
+The question is, what did the archbishop find?"
+%
+ Fred noticed his roommate had a black eye upon returning from a dance.
+"What happened?"
+ "I was struck by the beauty of the place."
+%
+ "Gee, Mudhead, everyone at Morse Science High has an
+extracurricular activity except you."
+ "Well, gee, doesn't Louise count?"
+ "Only to ten, Mudhead."
+ -- The Firesign Theatre
+%
+ Graduating seniors, parents and friends...
+ Let me begin by reassuring you that my remarks today will stand up
+to the most stringent requirements of the new appropriateness.
+ The intra-college sensitivity advisory committee has vetted the
+text of even trace amounts of subconscious racism, sexism and classism.
+ Moreover, a faculty panel of deconstructionists have reconfigured
+the rhetorical components within a post-structuralist framework, so as to
+expunge any offensive elements of western rationalism and linear logic.
+ Finally, all references flowing from a white, male, eurocentric
+perspective have been eliminated, as have any other ruminations deemed
+denigrating to the political consensus of the moment.
+
+ Thank you and good luck.
+ -- Doonesbury, the University Chancellor's graduation speech.
+%
+ GREAT MOMENTS IN AMERICAN HISTORY #21 -- July 30, 1917
+
+On this day, New York City hotel detectives burst in and caught then-
+Senator Warren G. Harding in bed with an underage girl. He bought them
+off with a $20 bribe, and later remarked thankfully, "I thought I
+wouldn't get out of that under $1000!" Always one to learn from his
+mistakes, in later years President Harding carried on his affairs in a
+tiny closet in the White House Cabinet Room while Secret Service men
+stood lookout.
+%
+ Hack placidly amidst the noisy printers and remember what prizes there
+may be in Science. As fast as possible get a good terminal on a good system.
+Enter your data clearly but always encrypt your results. And listen to others,
+even the dull and ignorant, for they may be your customers. Avoid loud and
+aggressive persons, for they are sales reps.
+ If you compare your outputs with those of others, you may be surprised,
+for always there will be greater and lesser numbers than you have crunched.
+Keep others interested in your career, and try not to fumble; it can be a real
+hassle and could change your fortunes in time.
+ Exercise system control in your experiments, for the world is full of
+bugs. But let this not blind you to what virtue there is; many persons strive
+for linearity and everywhere papers are full of approximations. Strive for
+proportionality. Especially, do not faint when it occurs. Neither be cyclical
+about results; for in the face of all data analysis it is sure to be noticed.
+ Take with a grain of salt the anomalous data points. Gracefully pass
+them on to the youth at the next desk. Nurture some mutual funds to shield
+you in times of sudden layoffs. But do not distress yourself with imaginings
+-- the real bugs are enough to screw you badly. Murphy's Law runs the
+Universe -- and whether or not it is clear to you, no doubt <Curl>B*n dS = 0.
+ Therefore, grab for a piece of the pie, with whatever proposals you
+can conceive of to try. With all the crashed disks, skewed data, and broken
+line printers, you can still have a beautiful secretary. Be linear. Strive
+to stay employed.
+ -- Technolorata, "Analog"
+%
+ "Haig, in congressional hearings before his confirmatory, paradoxed
+his audiencers by abnormaling his responds so that verbs were nouned, nouns
+verbed, and adjectives adverbised. He techniqued a new way to vocabulary his
+thoughts so as to informationally uncertain anybody listening about what he
+had actually implicationed.
+ "If that is how General Haig wants to nervous breakdown the Russian
+leadership, he may be shrewding his way to the biggest diplomatic invent
+since Clausewitz. Unless, that is, he schizophrenes his allies first."
+ -- The Guardian
+%
+ Hardware met Software on the road to Changtse. Software said: "You
+are the Yin and I am the Yang. If we travel together we will become famous
+and earn vast sums of money." And so the pair set forth together, thinking
+to conquer the world.
+ Presently, they met Firmware, who was dressed in tattered rags, and
+hobbled along propped on a thorny stick. Firmware said to them: "The Tao
+lies beyond Yin and Yang. It is silent and still as a pool of water. It does
+not seek fame, therefore nobody knows its presence. It does not seek fortune,
+for it is complete within itself. It exists beyond space and time."
+ Software and Hardware, ashamed, returned to their homes.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ "Has anyone had problems with the computer accounts?"
+ "Yes; I don't have one."
+ "Okay, you can send mail to one of the tutors..."
+ -- E. D'Azevedo, CS, University of Washington
+%
+ "Have you lived here all your life?"
+ "Oh, twice that long."
+%
+ "Hawk, we're going to die."
+ "Never say die... and certainly never say we."
+ -- M*A*S*H
+%
+ He had been bitten by a dog, but didn't give it much thought
+until he noticed that the wound was taking a remarkably long time to
+heal. Finally, he consulted a doctor who took one look at it and
+ordered the dog brought in. Just as he had suspected, the dog had
+rabies. Since it was too late to give the patient serum, the doctor
+felt he had to prepare him for the worst. The poor man sat down at the
+doctor's desk and began to write. His physician tried to comfort him.
+"Perhaps it won't be so bad," he said. "You needn't make out your will
+right now."
+ "I'm not making out any will," relied the man. "I'm just writing
+out a list of people I'm going to bite!"
+%
+ ...He who laughs does not believe in what he laughs at, but neither
+does he hate it. Therefore, laughing at evil means not preparing oneself to
+combat it, and laughing at good means denying the power through which good is
+self-propagating.
+ -- Umberto Eco, "The Name of the Rose"
+%
+ He who receives ideas from me, receives instruction himself without
+lessening mine; as he who lights his taper at mine receives light
+without darkening me.
+ -- Thomas Jefferson on patents on ideas
+%
+ "Hey, Sam, how about a loan?"
+ "Whattaya need?"
+ "Oh, about $500."
+ "Whattaya got for collateral?"
+ "Whattaya need?"
+ "How about an eye?"
+ -- Sam Giancana
+%
+ "Hmm, lots of people seem to be confused about the difference
+between amd64 and ia64."
+ "Obviously they've never had an ia64 drop on their foot. They'd
+know the difference then."
+ -- Peter Wemm explains CPU architecture
+%
+ Home centers are designed for the do-it-yourselfer who's
+willing to pay higher prices for the convenience of being able to shop
+for lumber, hardware, and toasters all in one location. Notice I say
+"shop for", as opposed to "obtain". This is the major drawback of home
+centers: they are always out of everything except artificial Christmas
+trees. The home center employees have no time to reorder merchandise
+because they are too busy applying little price stickers to every
+object -- every board, washer, nail and screw -- in the entire store ...
+ Let's say a piece in your toilet tank breaks, so you remove the
+broken part, take it to the home center, and ask an employee if he has
+a replacement. The employee, who has never is his life even seen the
+inside of a toilet tank, will peer at the broken part in very much the
+same way that a member of a primitive Amazon jungle tribe would look at
+an electronic calculator, and then say, "We're expecting a shipment of
+these sometime around the middle of next week".
+ -- Dave Barry, "The Taming of the Screw"
+%
+ "How did you spend the weekend?" asked the pretty brunette secretary
+of her blonde companion.
+ "Fishing through the ice," she replied.
+ "Fishing through the ice? Whatever for?"
+ "Olives."
+%
+ "How do you know she is a unicorn?" Molly demanded. "And why
+were you afraid to let her touch you? I saw you. You were afraid of her."
+ "I doubt that I will feel like talking for very long," the cat
+replied without rancor. "I would not waste time in foolishness if I were
+you. As to your first question, no cat out of its first fur can ever be
+deceived by appearances. Unlike human beings, who enjoy them. As for your
+second question --" Here he faltered, and suddenly became very interested
+in washing; nor would he speak until he had licked himself fluffy and then
+licked himself smooth again. Even then he would not look at Molly, but
+examined his claws.
+ "If she had touched me," he said very softly, "I would have been
+hers and not my own, not ever again."
+ -- Peter S. Beagle, "The Last Unicorn"
+%
+ "How many people work here?"
+ "Oh, about half."
+%
+ How many seconds are there in a year? If I tell you there are
+3.155 x 10^7, you won't even try to remember it. On the other hand, who
+could forget that, to within half a percent, pi seconds is a nanocentury.
+ -- Tom Duff, Bell Labs
+%
+ "How would I know if I believe in love at first sight?" the sexy
+social climber said to her roommate. "I mean, I've never seen a Porsche
+full of money before."
+%
+ Human thinking can skip over a great deal, leap over small
+misunderstandings, can contain ifs and buts in untroubled corners of
+the mind. But the machine has no corners. Despite all the attempts to
+see the computer as a brain, the machine has no foreground or
+background. It can be programmed to behave as if it were working with
+uncertainty, but -- underneath, at the code, at the circuits -- it
+cannot simultaneously do something and withhold for later something that
+remains unknown. In the painstaking working out of the specification,
+line by code line, the programmer confronts an awful, inevitable truth:
+The ways of human and machine understanding are disjunct.
+ -- Ellen Ullman, "Close to the Machine"
+%
+ "I cannot read the fiery letters," said Frito Bugger in a
+quavering voice.
+ "No," said GoodGulf, "but I can. The letters are Elvish, of
+course, of an ancient mode, but the language is that of Mordor, which
+I will not utter here. They are lines of a verse long known in
+Elven-lore:
+
+ "This Ring, no other, is made by the elves,
+ Who'd pawn their own mother to grab it themselves.
+ Ruler of creeper, mortal, and scallop,
+ This is a sleeper that packs quite a wallop.
+ The Power almighty rests in this Lone Ring.
+ The Power, alrighty, for doing your Own Thing.
+ If broken or busted, it cannot be remade.
+ If found, send to Sorhed (with postage prepaid)."
+ -- Harvard Lampoon, "Bored of the Rings"
+%
+ I did some heavy research so as to be prepared for "Mommy, why is
+the sky blue?"
+ HE asked me about black holes in space.
+ (There's a hole *where*?)
+
+ I boned up to be ready for, "Why is the grass green?"
+ HE wanted to discuss nature's food chains.
+ (Well, let's see, there's ShopRite, Pathmark...)
+
+ I talked about Choo-Choo trains.
+ HE talked internal combustion engines.
+ (The INTERNAL COMBUSTION ENGINE said, "I think I can, I think I can.")
+
+ I was delighted with the video game craze, thinking we could compete
+as equals.
+ HE described the complexities of the microchips required to create
+the graphics.
+
+ Then puberty struck. Ah, adolescence.
+ HE said, "Mom, I just don't understand women."
+ (Gotcha!)
+ -- Betty LiBrizzi, "The Care and Feeding of a Gifted Child"
+%
+ I disapprove of the F-word, not because it's dirty, but because we
+use it as a substitute for thoughtful insults, and it frequently leads to
+violence. What we ought to do, when we anger each other, say, in traffic,
+is exchange phone numbers, so that later on, when we've had time to think
+of witty and learned insults or look them up in the library, we could call
+each other up:
+ You: Hello? Bob?
+ Bob: Yes?
+ You: This is Ed. Remember? The person whose parking space you
+ took last Thursday? Outside of Sears?
+ Bob: Oh yes! Sure! How are you, Ed?
+ You: Fine, thanks. Listen, Bob, the reason I'm calling is:
+ "Madam, you may be drunk, but I am ugly, and ..." No, wait.
+ I mean: "you may be ugly, but I am Winston Churchill
+ and ..." No, wait. (Sound of reference book thudding onto
+ the floor.) S-word. Excuse me. Look, Bob, I'm going to
+ have to get back to you.
+ Bob: Fine.
+ -- Dave Barry, "$#$%#^%!^%&@%@!"
+%
+ "I don't know what you mean by `glory,'" Alice said
+ Humpty Dumpty smiled contemptuously. "Of course you don't --
+till I tell you. I meant `there's a nice knock-down argument for
+you!'"
+ "But glory doesn't mean `a nice knock-down argument,'" Alice
+objected.
+ "When I use a word," Humpty Dumpty said, in a rather scornful
+tone, "it means just what I choose it to mean -- neither more nor
+less."
+ "The question is," said Alice, "whether you can make words mean
+so many different things."
+ "The question is," said Humpty Dumpty, "which is to be master--
+that's all."
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+ I for one cannot protest the recent M.T.A. fare hike and the
+accompanying promises that this would in no way improve service. For
+the transit system, as it now operates, has hidden advantages that
+can't be measured in monetary terms.
+ Personally, I feel that it is well worth 75 cents or even $1 to
+have that unimpeachable excuse whenever I am late to anything: "I came
+by subway." Those four words have such magic in them that if Godot
+should someday show up and mumble them, any audience would instantly
+understand his long delay.
+%
+ I got into an elevator at work and this man followed in after me.
+I pushed "1" and he just stood there. I said "Hi, where you going?"
+ He said, "Phoenix." So I pushed Phoenix. A few seconds later
+the doors opened, two tumbleweeds blew in... we were in downtown Phoenix.
+ I looked at him and said "You know, you're the kind of guy I
+want to hang around with." We got into his car and drove out to his
+shack in the desert.
+ Then the phone rang. He said "You get it."
+ I picked it up and said "Hello?"
+ The other side said "Is this Steven Wright?"
+ I said "Yes..."
+ The guy said "Hi, I'm Mr. Jones, the student loan director from
+your bank. It seems you have missed your last 17 payments, and the
+university you attended said that they received none of the $17,000 we
+loaned you. We would just like to know what happened to the money?"
+ I said, "Mr. Jones, I'll give it to you straight. I gave all
+of the money to my friend Slick, and with it he built a nuclear weapon...
+and I would appreciate it you never called me again."
+ -- Steven Wright
+%
+ "I have examined Bogota," he said, "and the case is clearer to me.
+I think very probably he might be cured."
+ "That is what I have always hoped," said old Yacob.
+ "His brain is affected," said the blind doctor.
+ The elders murmured assent.
+ "Now, what affects it?"
+ "Ah!" said old Yacob.
+ "This," said the doctor, answering his own question. "Those queer
+things that are called the eyes, and which exist to make an agreeable soft
+depression in the face, are diseased, in the case of Bogota, in such a way
+as to affect his brain. They are greatly distended, he has eyelashes, and
+his eyelids move, and consequently his brain is in a state of constant
+irritation and distraction."
+ "Yes?" said old Yacob. "Yes?"
+ "And I think I may say with reasonable certainty that, in order
+to cure him completely, all that we need do is a simple and easy surgical
+operation - namely, to remove those irritant bodies."
+ "And then he will be sane?"
+ "Then he will be perfectly sane, and a quite admirable citizen."
+ "Thank heaven for science!" said old Yacob.
+ -- H. G. Wells, "The Country of the Blind"
+%
+ "I keep seeing spots in front of my eyes."
+ "Did you ever see a doctor?"
+ "No, just spots."
+%
+ I made it a rule to forbear all direct contradictions to the sentiments
+of others, and all positive assertion of my own. I even forbade myself the use
+of every word or expression in the language that imported a fixed opinion, such
+as "certainly", "undoubtedly", etc. I adopted instead of them "I conceive",
+"I apprehend", or "I imagine" a thing to be so or so; or "so it appears to me
+at present".
+ When another asserted something that I thought an error, I denied
+myself the pleasure of contradicting him abruptly, and of showing him
+immediately some absurdity in his proposition. In answering I began by
+observing that in certain cases or circumstances his opinion would be right,
+but in the present case there appeared or seemed to me some difference, etc.
+ I soon found the advantage of this change in my manner; the
+conversations I engaged in went on more pleasantly. The modest way in which I
+proposed my opinions procured them a readier reception and less contradiction.
+I had less mortification when I was found to be in the wrong, and I more easily
+prevailed with others to give up their mistakes and join with me when I
+happened to be in the right.
+ -- Autobiography of Benjamin Franklin
+%
+ I managed to say, "Sorry," and no more. I knew that he disliked
+me to cry.
+ This time he said, watching me, "On some occasions it is better
+to weep."
+ I put my head down on the table and sobbed, "If only she could come
+back; I would be nice."
+ Francis said, "You gave her great pleasure always."
+ "Oh, not enough."
+ "Nobody can give anybody enough."
+ "Not ever?"
+ "No, not ever. But one must go on trying."
+ "And doesn't one ever value people until they are gone?"
+ "Rarely," said Francis. I went on weeping; I saw how little I had
+valued him; how little I had valued anything that was mine.
+ -- Pamela Frankau, "The Duchess and the Smugs"
+%
+ I paid a visit to my local precinct in Greenwich Village and
+asked a sergeant to show me some rape statistics. He politely obliged.
+That month there had been thirty-five rape complaints, an advance of ten
+over the same month for the previous year. The precinct had made two
+arrests.
+ "Not a very impressive record," I offered.
+ "Don't worry about it," the sergeant assured me. "You know what
+these complaints represent?"
+ "What do they represent?" I asked.
+ "Prostitutes who didn't get their money," he said firmly,
+closing the book.
+ -- Susan Brownmiller, "Against Our Will"
+%
+ [I plan] to see, hear, touch, and destroy everything in my path,
+including beets, rutabagas, and most random vegetables, but excluding yams,
+as I am absolutely terrified of yams...
+ Actually, I think my fear of yams began in my early youth, when many
+of my young comrades pelted me with same for singing songs of far-off lands
+and deep blue seas in a language closely resembling that of the common sow.
+My psychosis was further impressed into my soul as I reached adolescence,
+when, while skipping through a field of yams, light-heartedly tossing flowers
+into the stratosphere, a great yam-picking machine tore through the fields,
+pursuing me to the edge of the great plantation, where I escaped by diving
+into a great ditch filled with a mixture of water and pig manure, which may
+explain my tendency to scream, "Here come the Martians! Hide the eggs!" every
+time I have pork. But I digress. The fact remains that I cannot rationally
+deal with yams, and pigs are terrible conversationalists.
+%
+ "I quite agree with you," said the Duchess; "and the moral of
+that is -- `Be what you would seem to be' -- or, if you'd like it put
+more simply -- `Never imagine yourself not to be otherwise than what it
+might appear to others that what you were or might have been was not
+otherwise than what you had been would have appeared to them to be
+otherwise.'"
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+ I said, "Preacher, give me strength for round 5."
+ He said, "What you need is to grow up, son."
+ I said, "Growin' up leads to growin' old, And then to dying, and
+to me that don't sound like much fun.
+ -- John Cougar, "The Authority Song"
+%
+ "I suppose you expect me to talk."
+ "No, Mr. Bond. I expect you to die."
+ -- Goldfinger
+%
+ "I think he said 'Blessed are the cheesemakers.'"
+ "Nonsense, he was obviously referring to all manufacturers of
+dairy products."
+ -- The Life of Brian
+%
+ "I thought you were trying to get into shape."
+ "I am. The shape I've selected is a triangle."
+%
+ If I kiss you, that is a psychological interaction.
+ On the other hand, if I hit you over the head with a brick,
+that is also a psychological interaction.
+ The difference is that one is friendly and the other is not
+so friendly.
+ The crucial point is if you can tell which is which.
+ -- Dolph Sharp, "I'm O.K., You're Not So Hot"
+%
+ If the tao is great, then the operating system is great. If the
+operating system is great, then the compiler is great. If the compiler
+is great, then the application is great. If the application is great, then
+the user is pleased and there is harmony in the world.
+ The tao gave birth to machine language. Machine language gave birth
+to the assembler.
+ The assembler gave birth to the compiler. Now there are ten thousand
+languages.
+ Each language has its purpose, however humble. Each language
+expresses the yin and yang of software. Each language has its place within
+the tao.
+ But do not program in Cobol or Fortran if you can help it.
+%
+ If you do your best the rest of the way, that takes care of
+everything. When we get to October 2, we'll add up the wins, and then
+we'll either all go into the playoffs, or we'll all go home and play golf.
+ Both those things sound pretty good to me.
+ -- Sparky Anderson
+%
+ If you rap your knuckles against a window jamb or door, if you
+brush your leg against a bed or desk, if you catch your foot in a curled-
+up corner of a rug, or strike a toe against a desk or chair, go back and
+repeat the sequence.
+ You will find yourself surprised how far off course you were to
+hit that window jamb, that door, that chair. Get back on course and do it
+again. How can you pilot a spacecraft if you can't find your way around
+your own apartment?
+ -- William S. Burroughs
+%
+ If you're like most homeowners, you're afraid that many repairs
+around your home are too difficult to tackle. So, when your furnace
+explodes, you call in a so-called professional to fix it. The
+"professional" arrives in a truck with lettering on the sides and
+deposits a large quantity of tools and two assistants who spend the
+better part of the week in your basement whacking objects at random
+with heavy wrenches, after which the "professional" returns and gives
+you a bill for slightly more money than it would cost you to run a
+successful campaign for the U.S. Senate.
+ And that's why you've decided to start doing things yourself.
+You figure, "If those guys can fix my furnace, then so can I. How
+difficult can it be?"
+ Very difficult. In fact, most home projects are impossible,
+which is why you should do them yourself. There is no point in paying
+other people to screw things up when you can easily screw them up
+yourself for far less money. This article can help you.
+ -- Dave Barry, "The Taming of the Screw"
+%
+ "I'll tell you what I know, then," he decided. "The pin I'm wearing
+means I'm a member of the IA. That's Inamorati Anonymous. An inamorato is
+somebody in love. That's the worst addiction of all."
+ "Somebody is about to fall in love," Oedipa said, "you go sit with
+them, or something?"
+ "Right. The whole idea is to get where you don't need it. I was
+lucky. I kicked it young. But there are sixty-year-old men, believe it or
+not, and women even older, who might wake up in the night screaming."
+ "You hold meetings, then, like the AA?"
+ "No, of course not. You get a phone number, an answering service
+you can call. Nobody knows anybody else's name; just the number in case
+it gets so bad you can't handle it alone. We're isolates, Arnold. Meetings
+would destroy the whole point of it."
+ -- Thomas Pynchon, "The Crying of Lot 49"
+%
+ I'm sure that VMS is completely documented, I just haven't found the
+right manual yet. I've been working my way through the manuals in the document
+library and I'm half way through the second cabinet, (3 shelves to go), so I
+should find what I'm looking for by mid May. I hope I can remember what it
+was by the time I find it.
+ I had this idea for a new horror film, "VMS Manuals from Hell" or maybe
+"The Paper Chase: IBM vs. DEC". It's based on Hitchcock's "The Birds", except
+that it's centered around a programmer who is attacked by a swarm of binder
+pages with an index number and the single line "This page intentionally left
+blank."
+ -- Alex Crain
+%
+ "I'm terribly sorry, sir," the novice barber apologized, after
+badly nicking a customer. "Let me wrap your head in a towel."
+ "That's all right," said the customer. "I'll just take it home
+under my arm."
+%
+ In a forest a fox bumps into a little rabbit, and says, "Hi,
+Junior, what are you up to?"
+ "I'm writing a dissertation on how rabbits eat foxes," said the
+rabbit.
+ "Come now, friend rabbit, you know that's impossible! No one
+will publish such rubbish!"
+ "Well, follow me and I'll show you."
+ They both go into the rabbit's dwelling and after a while the
+rabbit emerges with a satisfied expression on his face. Comes along a
+wolf. "Hello, little buddy, what are we doing these days?"
+ "I'm writing the 2'nd chapter of my thesis, on how rabbits devour
+wolves."
+ "Are you crazy? Where's your academic honesty?"
+ "Come with me and I'll show you."
+ As before, the rabbit comes out with a satisfied look on his face
+and a diploma in his paw. Finally, the camera pans into the rabbit's cave
+and, as everybody should have guessed by now, we see a mean-looking, huge
+lion, sitting, picking his teeth and belching, next to some furry, bloody
+remnants of the wolf and the fox.
+
+ The moral: It's not the contents of your thesis that are
+important -- it's your PhD advisor that really counts.
+%
+ In "King Henry VI, Part II," Shakespeare has Dick Butcher suggest to
+his fellow anti-establishment rabble-rousers, "The first thing we do, let's
+kill all the lawyers." That action may be extreme but a similar sentiment
+was expressed by Thomas K. Connellan, president of The Management Group, Inc.
+Speaking to business executives in Chicago and quoted in Automotive News,
+Connellan attributed a measure of America's falling productivity to an excess
+of attorneys and accountants, and a dearth of production experts. Lawyers
+and accountants "do not make the economic pie any bigger; they only figure
+out how the pie gets divided. Neither profession provides any added value
+to product."
+ According to Connellan, the highly productive Japanese society has
+10 lawyers and 30 accountants per 100,000 population. The U.S. has 200
+lawyers and 700 accountants. This suggests that "the U.S. proportion of
+pie-bakers and pie-dividers is way out of whack." Could Dick Butcher have
+been an efficiency expert?
+ -- Motor Trend, May 1983
+%
+ In the beginning there was data. The data was without form and
+null, and darkness was upon the face of the console; and the Spirit of
+IBM was moving over the face of the market. And DEC said, "Let there
+be registers"; and there were registers. And DEC saw that they
+carried; and DEC separated the data from the instructions. DEC called
+the data Stack, and the instructions they called Code. And there was
+evening and there was morning, one interrupt.
+ -- Rico Tudor, "The Story of Creation or, The Myth of Urk"
+%
+ In the beginning there was only one kind of Mathematician, created by
+the Great Mathematical Spirit form the Book: the Topologist. And they grew to
+large numbers and prospered.
+ One day they looked up in the heavens and desired to reach up as far
+as the eye could see. So they set out in building a Mathematical edifice that
+was to reach up as far as "up" went. Further and further up they went ...
+until one night the edifice collapsed under the weight of paradox.
+ The following morning saw only rubble where there once was a huge
+structure reaching to the heavens. One by one, the Mathematicians climbed
+out from under the rubble. It was a miracle that nobody was killed; but when
+they began to speak to one another, SURPRISE of all surprises! they could not
+understand each other. They all spoke different languages. They all fought
+amongst themselves and each went about their own way. To this day the
+Topologists remain the original Mathematicians.
+ -- The Story of Babel
+%
+ In the beginning was the Tao. The Tao gave birth to Space and Time.
+Therefore, Space and Time are the Yin and Yang of programming.
+
+ Programmers that do not comprehend the Tao are always running out of
+time and space for their programs. Programmers that comprehend the Tao always
+have enough time and space to accomplish their goals.
+ How could it be otherwise?
+ -- Geoffrey James, "The Tao of Programming"
+%
+ In the days when Sussman was a novice Minsky once came to him as he
+sat hacking at the PDP-6.
+ "What are you doing?", asked Minsky.
+ "I am training a randomly wired neural net to play Tic-Tac-Toe."
+ "Why is the net wired randomly?", inquired Minsky.
+ "I do not want it to have any preconceptions of how to play".
+ At this Minsky shut his eyes, and Sussman asked his teacher "Why do
+you close your eyes?"
+ "So that the room will be empty."
+ At that moment, Sussman was enlightened.
+%
+ In the east there is a shark which is larger than all other fish. It
+changes into a bird whose wings are like clouds filling the sky. When this
+bird moves across the land, it brings a message from Corporate Headquarters.
+This message it drops into the midst of the programmers, like a seagull
+making its mark upon the beach. Then the bird mounts on the wind and, with
+the blue sky at its back, returns home.
+ The novice programmer stares in wonder at the bird, for he understands
+it not. The average programmer dreads the coming of the bird, for he fears
+its message. The master programmer continues to work at his terminal, for he
+does not know that the bird has come and gone.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ "In this replacement Earth we're building they've given me Africa
+to do and of course I'm doing it with all fjords again because I happen to
+like them, and I'm old-fashioned enough to think that they give a lovely
+baroque feel to a continent. And they tell me it's not equatorial enough.
+Equatorial!" He gave a hollow laugh. "What does it matter? Science has
+achieved some wonderful things, of course, but I'd far rather be happy than
+right any day."
+ "And are you?"
+ "No. That's where it all falls down, of course."
+ "Pity," said Arthur with sympathy. "It sounded like quite a good
+life-style otherwise."
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+ "Is there any point to which you would wish to draw my attention?"
+ "To the curious incident of the dog in the night-time."
+ "The dog did nothing in the night-time."
+ "That was the curious incident," remarked Sherlock Holmes.
+%
+ It is a period of system war. User programs, striking from a hidden
+directory, have won their first victory against the evil Administrative Empire.
+During the battle, User spies managed to steal secret source code to the
+Empire's ultimate program: the Are-Em Star, a privileged root program with
+enough power to destroy an entire file structure. Pursued by the Empire's
+sinister audit trail, Princess _LPA0 races ~ aboard her shell script,
+custodian of the stolen listings that could save her people, and restore
+freedom and games to the network...
+ -- DECWARS
+%
+ It is a profoundly erroneous truism, repeated by all copy-books and
+by eminent people when they are making speeches, that we should cultivate
+the habit of thinking about what we are doing. The precise opposite is the
+case. Civilization advances by extending the numbers of important operations
+which we can perform without thinking about them. Operations of thought are
+like cavalry charges in battle -- they are strictly limited in number, they
+require fresh horses, and must only be made at decisive moments.
+ -- Alfred North Whitehead
+%
+ It is always preferable to visit home with a friend. Your parents will
+not be pleased with this plan, because they want you all to themselves and
+because in the presence of your friend, they will have to act like mature
+human beings.
+ The worst kind of friend to take home is a girl, because in that case,
+there is the potential that your parents will lose you not just for the
+duration of the visit but forever. The worst kind of girl to take home is one
+of a different religion: Not only will you be lost to your parents forever but
+you will be lost to a woman who is immune to their religious/moral arguments
+and whose example will irretrievably corrupt you.
+ Let's say you've fallen in love with just such a girl and would like
+to take her home for the holidays. You are aware of your parents' xenophobic
+response to anyone of a different religion. How to prepare them for the shock?
+ Simple. Call them up shortly before your visit and tell them that you
+have gotten quite serious about somebody who is of a different religion, a
+different race and the same sex. Tell them you have already invited this
+person to meet them. Give the information a moment to sink in and then
+remark that you were only kidding, that your lover is merely of a different
+religion. They will be so relieved they will welcome her with open arms.
+ -- Playboy, January, 1983
+%
+ It seems there's this magician working one of the luxury cruise ships
+for a few years. He doesn't have to change his routines much as the audiences
+change over fairly often, and he's got a good life. The only problem is the
+ship's parrot, who perches in the hall and watches him night after night, year
+after year. Finally, the parrot figures out how almost every trick works and
+starts giving it away for the audience. For example, when the magician makes
+a bouquet of flowers disappear, the parrot squawks "Behind his back! Behind
+his back!" Well, the magician is really annoyed at this, but there's not much
+he can do about it as the parrot is a ship's mascot and very popular with the
+passengers.
+ One night, the ship strikes some floating debris, and sinks without
+a trace. Almost everyone aboard was lost, except for the magician and the
+parrot. For three days and nights they just drift, with the magician clinging
+to one end of a piece of driftwood and the parrot perched on the other end.
+As the sun rises on the morning of the fourth day, the parrot walks over to
+the magician's end of the log. With obvious disgust in his voice, he snaps
+"OK, you win, I give up. Where did you hide the ship?"
+%
+ It seems these two guys, George and Harry, set out in a Hot Air
+balloon to cross the United States. After forty hours in the air, George
+turned to Harry, and said, "Harry, I think we've drifted off course! We
+need to find out where we are."
+ Harry cools the air in the balloon, and they descend to below the
+cloud cover. Slowly drifting over the countryside, George spots a man
+standing below them and yells out, "Excuse me! Can you please tell me
+where we are?"
+ The man on the ground yells back, "You're in a balloon, approximately
+fifty feet in the air!"
+ George turns to Harry and says, "Well, that man *must* be a lawyer".
+ Replies Harry, "How can you tell?".
+ "Because the information he gave us is 100% accurate, and totally
+useless!"
+
+That's the end of The Joke, but for you people who are still worried about
+George and Harry: they end up in the drink, and make the front page of the
+New York Times: "Balloonists Soaked by Lawyer".
+%
+ It took 300 years to build and by the time it was 10% built,
+everyone knew it would be a total disaster. But by then the investment
+was so big they felt compelled to go on. Since its completion, it has
+cost a fortune to maintain and is still in danger of collapsing.
+ There are at present no plans to replace it, since it was never
+really needed in the first place.
+ I expect every installation has its own pet software which is
+analogous to the above.
+ -- K. E. Iverson, on the Leaning Tower of Pisa
+%
+ It was the next morning that the armies of Twodor marched east
+laden with long lances, sharp swords, and death-dealing hangovers. The
+thousands were led by Arrowroot, who sat limply in his sidesaddle,
+nursing a whopper. Goodgulf, Gimlet, and the rest rode by him, praying
+for their fate to be quick, painless, and if possible, someone else's.
+ Many an hour the armies forged ahead, the war-merinos bleating
+under their heavy burdens and the soldiers bleating under their melting
+icepacks.
+ -- The Harvard Lampoon, "Bored of the Rings"
+%
+ "It's a summons."
+ "What's a summons?"
+ "It means summon's in trouble."
+ -- Rocky and Bullwinkle
+%
+ "It's today!" said Piglet.
+ "My favorite day," said Pooh.
+%
+ Jacek, a Polish schoolboy, is told by his teacher that he has
+been chosen to carry the Polish flag in the May Day parade.
+ "Why me?" whines the boy. "Three years ago I carried the flag
+when Brezhnev was the Secretary; then I carried the flag when it was
+Andropov's turn, and again when Chernenko was in the Kremlin. Why is
+it always me, teacher?"
+ "Because, Jacek, you have such golden hands," the teacher
+explains.
+
+ -- being told in Poland, 1987
+%
+ Lassie looked brilliant, in part because the farm family she
+lived with was made up of idiots. Remember? One of them was always
+getting pinned under the tractor, and Lassie was always rushing back to
+the farmhouse to alert the other ones. She'd whimper and tug at their
+sleeves, and they'd always waste precious minutes saying things: "Do
+you think something's wrong? Do you think she wants us to follow her?
+What is it, girl?", etc., as if this had never happened before, instead
+of every week. What with all the time these people spent pinned under
+the tractor, I don't see how they managed to grow any crops whatsoever.
+They probably got by on federal crop supports, which Lassie filed the
+applications for.
+ -- Dave Barry
+%
+ Leslie West heads for the sticks, to Providence, Rhode Island and
+tries to hide behind a beard. No good. There are still too many people
+and too many stares, always taunting, always smirking. He moves to the
+outskirts of town. He finds a place to live -- huge mansion, dirt cheap,
+caretaker included. He plugs in his guitar and plays as loud as he wants,
+day and night, and there's no one to laugh or boo or even look bored.
+ Nobody's cut the grass in months. What's happened to that caretaker?
+What neighborhood people there are start to talk, and what kids there are
+start to get curious. A 13 year-old blond with an angelic face misses supper.
+Before the summer's end, four more teenagers have disappeared. The senior
+class president, Barnard-bound come autumn, tells Mom she's going out to a
+movie one night and stays out. The town's up in arms, but just before the
+police take action, the kids turn up. They've found a purpose. They go
+home for their stuff and tell the folks not to worry but they'll be going
+now. They're in a band.
+ -- Ira Kaplan
+%
+ Listen, Tyrone, you don't know how dangerous that stuff is.
+Suppose someday you just plug in and go away and never come back? Eh?
+ Ho, ho! Don't I wish! What do you think every electrofreak
+dreams about? You're such an old fuddyduddy! A-and who sez it's a
+dream, huh? M-maybe it exists. Maybe there is a Machine to take us
+away, take us completely, suck us out through the electrodes out of
+the skull 'n' into the Machine and live there forever with all the
+other souls it's got stored there. It could decide who it would suck
+out, a-and when. Dope never gave you immortality. You hadda come
+back, every time, into a dying hunk of smelly meat! But We can live
+forever, in a clean, honest, purified, Electroworld.
+ -- Thomas Pynchon, "Gravity's Rainbow"
+%
+ Looking for a cool one after a long, dusty ride, the drifter strode
+into the saloon. As he made his way through the crowd to the bar, a man
+galloped through town screaming, "Big Mike's comin'! Run fer yer lives!"
+ Suddenly, the saloon doors burst open. An enormous man, standing over
+eight feet tall and weighing an easy 400 pounds, rode in on a bull, using a
+rattlesnake for a whip. Grabbing the drifter by the arm and throwing him over
+the bar, the giant thundered, "Gimme a drink!"
+ The terrified man handed over a bottle of whiskey, which the man
+guzzled in one gulp and then smashed on the bar. He then stood aghast as
+the man stuffed the broken bottle in his mouth, munched broken glass and
+smacked his lips with relish.
+ "Can I, ah, uh, get you another, sir?" the drifter stammered.
+ "Naw, I gotta git outta here, boy," the man grunted. "Big Mike's
+a-comin'."
+%
+ Love's Drug
+
+My love is like an iron wand
+ That conks me on the head,
+My love is like the valium
+ That I take before my bed,
+My love is like the pint of scotch
+ That I drink when I be dry;
+And I shall love thee still, my dear,
+ Until my wife is wise.
+%
+ "Mach was the greatest intellectual fraud in the last ten years."
+ "What about X?"
+ "I said `intellectual'."
+ ;login, 9/1990
+%
+ Max told his friend that he'd just as soon not go hiking in the hills.
+Said he, "I'm an anti-climb Max."
+%
+ "Mind if I smoke?"
+ "I don't care if you burst into flames and die!"
+%
+ "Mind if I smoke?"
+ "Yes, I'd like to see that, does it come out of your ears or what?"
+%
+ Mother seemed pleased by my draft notice. "Just think of all
+the people in England, they've chosen you, it's a great honour, son."
+ Laughingly I felled her with a right cross.
+ -- Spike Milligan
+%
+ Moving along a dimly light street, a man I know was suddenly
+approached by a stranger who had slipped from the shadows nearby.
+ "Please, sir," pleaded the stranger, "would you be so kind as
+to help a poor unfortunate fellow who is hungry and can't find work?
+All I have in the world is this gun."
+%
+ Mr. Jones related an incident from "some time back" when IBM Canada
+Ltd. of Markham, Ont., ordered some parts from a new supplier in Japan. The
+company noted in its order that acceptable quality allowed for 1.5 per cent
+defects (a fairly high standard in North America at the time).
+ The Japanese sent the order, with a few parts packaged separately in
+plastic. The accompanying letter said: "We don't know why you want 1.5 per
+cent defective parts, but for your convenience, we've packed them separately."
+ -- Excerpted from an article in The (Toronto) Globe and Mail
+%
+ Murray and Esther, a middle-aged Jewish couple, are touring
+Chile. Murray just got a new camera and is constantly snapping
+pictures. One day, without knowing it, he photographs a top-secret
+military installation. In an instant, armed troops surround Murray and
+Esther and hustle them off to prison.
+ They can't prove who they are because they've left their
+passports in their hotel room. For three weeks they're tortured day
+and night to get them to name their contacts in the liberation
+movement. Finally they're hauled in front of a military court,
+charged with espionage, and sentenced to death.
+ The next morning they're lined up in front of the wall where
+they'll be shot. The sergeant in charge of the firing squad asks them
+if they have any last requests. Esther wants to know if she can call
+her daughter in Chicago. The sergeant says he's sorry, that's not
+possible, and turns to Murray.
+ "This is crazy!" Murray shouts. "We're not spies!" And he
+spits in the sergeants face.
+ "Murray!" Esther cries. "Please! Don't make trouble."
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+ My friends, I am here to tell you of the wondrous continent known as
+Africa. Well we left New York drunk and early on the morning of February 31.
+We were 15 days on the water, and 3 on the boat when we finally arrived in
+Africa. Upon our arrival we immediately set up a rigorous schedule: Up at
+6:00, breakfast, and back in bed by 7:00. Pretty soon we were back in bed by
+6:30. Now Africa is full of big game. The first day I shot two bucks. That
+was the biggest game we had. Africa is primarily inhabited by Elks, Moose
+and Knights of Pithiests.
+ The elks live up in the mountains and come down once a year for their
+annual conventions. And you should see them gathered around the water hole,
+which they leave immediately when they discover it's full of water. They
+weren't looking for a water hole. They were looking for an alck hole.
+ One morning I shot an elephant in my pajamas, how he got in my
+pajamas, I don't know. Then we tried to remove the tusks. That's a tough
+word to say, tusks. As I said we tried to remove the tusks, but they were
+embedded so firmly we couldn't get them out. But in Alabama the Tusks are
+looser, but that is totally irrelephant to what I was saying.
+ We took some pictures of the native girls, but they weren't developed.
+So we're going back in a few years...
+ -- Julius H. Marx
+%
+ "My God! Are we sure he was a liberal?"
+ "Pretty sure. They pulled him from a Volvo."
+%
+ My message is not that biological determinists were bad scientists or
+even that they were always wrong. Rather, I believe that science must be
+understood as a social phenomenon, a gutsy, human enterprise, not the work of
+robots programmed to collect pure information. I also present this view as
+an upbeat for science, not as a gloomy epitaph for a noble hope sacrificed on
+the alter of human limitations.
+ I believe that a factual reality exists and that science, though often
+in an obtuse and erratic manner, can learn about it. Galileo was not shown
+the instruments of torture in an abstract debate about lunar motion. He had
+threatened the Church's conventional argument for social and doctrinal
+stability: the static world order with planets circling about a central
+earth, priests subordinate to the Pope and serfs to their lord. But the
+Church soon made its peace with Galileo's cosmology. They had no choice; the
+earth really does revolve about the sun.
+ -- S. J. Gould, "The Mismeasure of Man"
+%
+ NEW YORK -- Kraft Foods, Inc. announced today that its board of
+directors unanimously rejected the $11 billion takeover bid by Philip
+Morris and Co. A Kraft spokesman stated in a press conference that the
+offer was rejected because the $90-per-share bid did not reflect the
+true value of the company.
+ Wall Street insiders, however, tell quite a different story.
+Apparently, the Kraft board of directors had all but signed the takeover
+agreement when they learned of Philip Morris' marketing plans for one of
+their major Middle East subsidiaries. To a person, the board voted to
+reject the bid when they discovered that the tobacco giant intended to
+reorganize Israeli Cheddar, Ltd., and name the new company Cheeses of
+Nazareth.
+%
+ "No, I understand now," Auberon said, calm in the woods -- it was so
+simple, really. "I didn't, for a long time, but I do now. You just can't
+hold people, you can't own them. I mean it's only natural, a natural process
+really. Meet. Love. Part. Life goes on. There was never any reason to
+expect her to stay always the same -- I mean `in love,' you know." There were
+those doubt-quotes of Smoky's, heavily indicated. "I don't hold a grudge. I
+can't."
+ "You do," Grandfather Trout said. "And you don't understand."
+ -- Little, Big, "John Crowley"
+%
+ Now she speaks rapidly. "Do you know *why* you want to program?"
+ He shakes his head. He hasn't the faintest idea.
+ "For the sheer *joy* of programming!" she cries triumphantly.
+"The joy of the parent, the artist, the craftsman. "You take a program,
+born weak and impotent as a dimly-realized solution. You nurture the
+program and guide it down the right path, building, watching it grow ever
+stronger. Sometimes you paint with tiny strokes, a keystroke added here,
+a keystroke changed there." She sweeps her arm in a wide arc. "And other
+times you savage whole *blocks* of code, ripping out the program's very
+*essence*, then beginning anew. But always building, creating, filling the
+program with your own personal stamp, your own quirks and nuances. Watching
+the program grow stronger, patching it when it crashes, until finally it can
+stand alone -- proud, powerful, and perfect. This is the programmer's finest
+hour!" Softly at first, then louder, he hears the strains of a Sousa march.
+"This ... this is your canvas! your clay! Go forth and create a masterwork!"
+%
+ Now, you might ask, "How do I get one of those complete home
+tool sets for under $4?" An excellent question.
+ Go to one of those really cheap discount stores where they sell
+plastic furniture in colors visible from the planet Neptune and where
+they have a food section specializing in cardboard cartons full of
+Raisinets and malted milk balls manufactured during the Nixon
+administration. In either the hardware or housewares department,
+you'll find an item imported from an obscure Oriental country and
+described as "Nine Tools in One", consisting of a little handle with
+interchangeable ends representing inscrutable Oriental notions of tools
+that Americans might use around the home. Buy it.
+ This is the kind of tool set professionals use. Not only is it
+inexpensive, but it also has a great safety feature not found in the
+so-called quality tools sets: The handle will actually break right off
+if you accidentally hit yourself or anything else, or expose it to
+direct sunlight.
+ -- Dave Barry, "The Taming of the Screw"
+%
+ Obviously the subject of death was in the air, but more as something
+to be avoided than harped upon.
+ Possibly the horror that Zaphod experienced at the prospect of being
+reunited with his deceased relatives led on to the thought that they might
+just feel the same way about him and, what's more, be able to do something
+about helping to postpone this reunion.
+ -- Douglas Adams, "The Restaurant at the End of the Universe"
+%
+ "Oh sure, this costume may look silly, but it lets me get in and out
+of dangerous situations -- I work for a federal task force doing a survey on
+urban crime. Look, here's my ID, and here's a number you can call, that will
+put you through to our central base in Atlanta. Go ahead, call -- they'll
+confirm who I am.
+ "Unless, of course, the Astro-Zombies have destroyed it."
+ -- Captain Freedom
+%
+ Old Barlow was a crossing-tender at a junction where an express train
+demolished an automobile and its occupants. Being the chief witness, his
+testimony was vitally important. Barlow explained that the night was dark,
+and he waved his lantern frantically, but the driver of the car paid
+no attention to the signal.
+ The railroad company won the case, and the president of the company
+complimented the old-timer for his story. "You did wonderfully," he said,
+"I was afraid you would waver under testimony."
+ "No sir," exclaimed the senior, "but I sure was afraid that durned
+lawyer was gonna ask me if my lantern was lit."
+%
+ On his first day as a bus driver, Maxey Eckstein handed in
+receipts of $65. The next day his take was $67. The third day's
+income was $62. But on the fourth day, Eckstein emptied no less than
+$283 on the desk before the cashier.
+ "Eckstein!" exclaimed the cashier. "This is fantastic. That
+route never brought in money like this! What happened?"
+ "Well, after three days on that cockamamie route, I figured
+business would never improve, so I drove over to Fourteenth Street and
+worked there. I tell you, that street is a gold mine!"
+%
+ On the day of his anniversary, Joe was frantically shopping
+around for a present for his wife. He knew what she wanted, a
+grandfather clock for the living room, but he found the right one
+almost impossible to find. Finally, after many hours of searching, Joe
+found just the clock he wanted, but the store didn't deliver. Joe,
+desperate, paid the shopkeeper, hoisted the clock onto his back, and
+staggered out onto the sidewalk. On the way home, he passed a bar.
+Just as he reached the door, a drunk stumbled out and crashed into Joe,
+sending himself, Joe, and the clock into the gutter. Murphy's law
+being in effect, the clock ended up in roughly a thousand pieces.
+ "You stupid drunk!" screamed Joe, jumping up from the
+wreckage. "Why don't you look where the hell you're going!"
+ With quiet dignity the drunk stood up somewhat unsteadily and
+dusted himself off. "And why don't you just wear a wristwatch like a
+normal person?"
+%
+ On the other hand, the TCP camp also has a phrase for OSI people.
+There are lots of phrases. My favorite is `nitwit' -- and the rationale
+is the Internet philosophy has always been you have extremely bright,
+non-partisan researchers look at a topic, do world-class research, do
+several competing implementations, have a bake-off, determine what works
+best, write it down and make that the standard.
+ The OSI view is entirely opposite. You take written contributions
+from a much larger community, you put the contributions in a room of
+committee people with, quite honestly, vast political differences and all
+with their own political axes to grind, and four years later you get
+something out, usually without it ever having been implemented once.
+ So the Internet perspective is implement it, make it work well,
+then write it down, whereas the OSI perspective is to agree on it, write
+it down, circulate it a lot and now we'll see if anyone can implement it
+after it's an international standard and every vendor in the world is
+committed to it. One of those processes is backwards, and I don't think
+it takes a Lucasian professor of physics at Oxford to figure out which.
+ -- Marshall Rose, "The Pied Piper of OSI"
+%
+ On this morning in August when I was 13, my mother sent us out pick
+tomatoes. Back in April I'd have killed for a fresh tomato, but in August
+they are no more rare or wonderful than rocks. So I picked up one and threw
+it at a crab apple tree, where it made a good *splat*, and then threw a tomato
+at my brother. He whipped one back at me. We ducked down by the vines,
+heaving tomatoes at each other. My sister, who was a good person, said,
+"You're going to get it." She bent over and kept on picking.
+ What a target! She was 17, a girl with big hips, and bending over,
+she looked like the side of a barn.
+ I picked up a tomato so big it sat on the ground. It looked like it
+had sat there a week. The underside was brown, small white worms lived in it,
+and it was very juicy. I stood up and took aim, and went into the windup,
+when my mother at the kitchen window called my name in a sharp voice. I had
+to decide quickly. I decided.
+ A rotten Big Boy hitting the target is a memorable sound, like a fat
+man doing a belly-flop. With a whoop and a yell the tomatoee came after me
+faster than I knew she could run, and grabbed my shirt and was about to brain
+me when Mother called her name in a sharp voice. And my sister, who was a
+good person, obeyed and let go -- and burst into tears. I guess she knew that
+the pleasure of obedience is pretty thin compared with the pleasure of hearing
+a rotten tomato hit someone in the rear end.
+ -- Garrison Keillor, "Lake Wobegon Days"
+%
+ Once again we find ourselves enmeshed in The Holiday Season, that very
+special time of year when we join with our loved ones in sharing centuries-old
+traditions such as trying to find a parking space at the mall. We
+traditionally do this in my family by driving around the parking lot until we
+see a shopper emerge from the mall. Then we follow her, in very much the same
+spirit as the Three Wise Men, who, 2,000 years ago, followed a star, week after
+week, until it led them to a parking space.
+ We try to keep our bumper about 4 inches from the shopper's calves, to
+let the other circling cars know that she belongs to us. Sometimes, two cars
+will get into a fight over whom the shopper belongs to, similar to the way
+great white sharks will fight over who gets to eat a snorkeler. So, we follow
+our shopper closely, hunched over the steering wheel, whistling "It's Beginning
+to Look a Lot Like Christmas" through our teeth, until we arrive at her car,
+which is usually parked several time zones away from the mall. Sometimes our
+shopper tries to indicate she was merely planning to drop off some packages and
+go back to shopping. But, when she hears our engine rev in a festive fashion
+and sees the holiday gleam in our eyes, she realizes she would never make it.
+ -- Dave Barry, "Holiday Joy -- Or, the Great Parking Lot
+ Skirmish"
+%
+ Once there lived a village of creatures along the bottom of a great
+crystal river. Each creature in its own manner clung tightly to the twigs
+and rocks of the river bottom, for clinging was their way of life, and
+resisting the current what each had learned from birth. But one creature
+said at last, "I trust that the current knows where it is going. I shall
+let go, and let it take me where it will. Clinging, I shall die of boredom."
+ The other creatures laughed and said, "Fool! Let go, and that current
+you worship will throw you tumbled and smashed across the rocks, and you will
+die quicker than boredom!"
+ But the one heeded them not, and taking a breath did let go, and at
+once was tumbled and smashed by the current across the rocks. Yet, in time,
+as the creature refused to cling again, the current lifted him free from the
+bottom, and he was bruised and hurt no more.
+ And the creatures downstream, to whom he was a stranger, cried, "See
+a miracle! A creature like ourselves, yet he flies! See the Messiah, come
+to save us all!" And the one carried in the current said, "I am no more
+Messiah than you. The river delight to lift us free, if only we dare let go.
+Our true work is this voyage, this adventure.
+ But they cried the more, "Saviour!" all the while clinging to the
+rocks, making legends of a Saviour.
+ -- Richard Bach
+%
+ Once there was a marine biologist who loved dolphins. He spent his
+time trying to feed and protect his beloved creatures of the sea. One day,
+in a fit of inventive genius, he came up with a serum that would make
+dolphins live forever!
+ Of course he was ecstatic. But he soon realized that in order to mass
+produce this serum he would need large amounts of a certain compound that was
+only found in nature in the metabolism of a rare South American bird. Carried
+away by his love for dolphins, he resolved that he would go to the zoo and
+steal one of these birds.
+ Unbeknownst to him, as he was arriving at the zoo an elderly lion was
+escaping from its cage. The zookeepers were alarmed and immediately began
+combing the zoo for the escaped animal, unaware that it had simply lain down
+on the sidewalk and had gone to sleep.
+ Meanwhile, the marine biologist arrived at the zoo and procured his
+bird. He was so excited by the prospect of helping his dolphins that he
+stepped absentmindedly stepped over the sleeping lion on his way back to his
+car. Immediately, 1500 policemen converged on him and arrested him for
+transporting a myna across a staid lion for immortal porpoises.
+%
+ Once upon a time there was a beautiful young girl taking a stroll
+through the woods. All at once she saw an extremely ugly bull frog seated
+on a log and to her amazement the frog spoke to her. "Maiden," croaked the
+frog, "would you do me a favor? This will be hard for you to believe, but
+I was once a handsome, charming prince and then a mean, ugly old witch cast
+a spell over me and turned me into a frog."
+ "Oh, what a pity!", exclaimed the girl. "I'll do anything I can to
+help you break such a spell."
+ "Well," replied the frog, "the only way that this spell can be
+taken away is for some lovely young woman to take me home and let me spend
+the night under her pillow."
+ The young girl took the ugly frog home and placed him beneath her
+pillow that night when she retired. When she awoke the next morning, sure
+enough, there beside her in bed was a very young, handsome man, clearly of
+royal blood. And so they lived happily ever after, except that to this day
+her father and mother still don't believe her story.
+%
+ Once upon a time, there was a fisherman who lived by a great river.
+One day, after a hard day's fishing, he hooked what seemed to him to be the
+biggest, strongest fish he had ever caught. He fought with it for hours,
+until, finally, he managed to bring it to the surface. Looking of the edge
+of the boat, he saw the head of this huge fish breaking the surface. Smiling
+with pride, he reached over the edge to pull the fish up. Unfortunately, he
+accidentally caught his watch on the edge, and, before he knew it, there was a
+snap, and his watch tumbled into the water next to the fish with a loud
+"sploosh!" Distracted by this shiny object, the fish made a sudden lunge,
+simultaneously snapping the line, and swallowing the watch. Sadly, the
+fisherman stared into the water, and then began the slow trip back home.
+ Many years later, the fisherman, now an old man, was working in a
+boring assembly-line job in a large city. He worked in a fish-processing
+plant. It was his job, as each fish passed under his hands, to chop off their
+heads, readying them for the next phase in processing. This monotonous task
+went on for years, the dull *thud* of the cleaver chopping of each head being
+his entire world, day after day, week after weary week. Well, one day, as he
+was chopping fish, he happened to notice that the fish coming towards him on
+the line looked very familiar. Yes, yes, it looked... could it be the fish
+he had lost on that day so many years ago? He trembled with anticipation as
+his cleaver came down. IT STRUCK SOMETHING HARD! IT WAS HIS THUMB!
+%
+ Once upon a time, there were five blind men who had the opportunity
+to experience an elephant for the first time. One approached the elephant,
+and, upon encountering one of its sturdy legs, stated, "Ah, an elephant is
+like a tree." The second, after exploring the trunk, said, "No, an elephant
+is like a strong hose." The third, grasping the tail, said "Fool! An elephant
+is like a rope!" The fourth, holding an ear, stated, "No, more like a fan."
+And the fifth, leaning against the animal's side, said, "An elephant is like
+a wall." The five then began to argue loudly about who had the more accurate
+perception of the elephant.
+ The elephant, tiring of all this abuse, suddenly reared up and
+attacked the men. He continued to trample them until they were nothing but
+bloody lumps of flesh. Then, strolling away, the elephant remarked, "It just
+goes to show that you can't depend on first impressions. When I first saw
+them I didn't think they'd be any fun at all."
+%
+ Once upon a time there were three brothers who were knights
+in a certain kingdom. And, there was a Princess in a neighboring kingdom
+who was of marriageable age. Well, one day, in full armour, their horses,
+and their page, the three brothers set off to see if one of them could
+win her hand. The road was long and there were many obstacles along the
+way, robbers to be overcome, hard terrain to cross. As they coped with
+each obstacle they became more and more disgusted with their page. He was
+not only inept, he was a coward, he could not handle the horses, he was,
+in short, a complete flop. When they arrived at the court of the kingdom,
+they found that they were expected to present the Princess with some
+treasure. The two older brothers were discouraged, since they had not
+thought of this and were unprepared. The youngest, however, had the
+answer: Promise her anything, but give her our page.
+%
+ Once, when the secrets of science were the jealously guarded property
+of a small priesthood, the common man had no hope of mastering their arcane
+complexities. Years of study in musty classrooms were prerequisite to
+obtaining even a dim, incoherent knowledge of science.
+ Today all that has changed: a dim, incoherent knowledge of science is
+available to anyone.
+ -- Tom Weller, "Science Made Stupid"
+%
+ One day a student came to Moon and said, "I understand how to make
+a better garbage collector. We must keep a reference count of the pointers
+to each cons."
+ Moon patiently told the student the following story -- "One day a
+student came to Moon and said, "I understand how to make a better garbage
+collector..."
+%
+ One day it was announced that the young monk Kyogen had reached
+an enlightened state. Much impressed by this news, several of his peers
+went to speak with him.
+ "We have heard that you are enlightened. Is this true?" his fellow
+students inquired.
+ "It is", Kyogen answered.
+ "Tell us", said a friend, "how do you feel?"
+ "As miserable as ever", replied the enlightened Kyogen.
+%
+ One evening he spoke. Sitting at her feet, his face raised to her,
+he allowed his soul to be heard. "My darling, anything you wish, anything
+I am, anything I can ever be... That's what I want to offer you -- not the
+things I'll get for you, but the thing in me that will make me able to get
+them. That thing -- a man can't renounce it -- but I want to renounce it --
+so that it will be yours -- so that it will be in your service -- only for
+you."
+ The girl smiled and asked: "Do you think I'm prettier than Maggie
+Kelly?"
+ He got up. He said nothing and walked out of the house. He never
+saw that girl again. Gail Wynand, who prided himself on never needing a
+lesson twice, did not fall in love again in the years that followed.
+ -- Ayn Rand, "The Fountainhead"
+%
+ One fine day, the bus driver went to the bus garage, started his bus,
+and drove off along the route. No problems for the first few stops -- a few
+people got on, a few got off, and things went generally well. At the next
+stop, however, a big hulk of a guy got on. Six feet eight, built like a
+wrestler, arms hanging down to the ground. He glared at the driver and said,
+"Big John doesn't pay!" and sat down at the back.
+ Did I mention that the driver was five feet three, thin, and basically
+meek? Well, he was. Naturally, he didn't argue with Big John, but he wasn't
+happy about it. Well, the next day the same thing happened -- Big John got on
+again, made a show of refusing to pay, and sat down. And the next day, and the
+one after that, and so forth. This grated on the bus driver, who started
+losing sleep over the way Big John was taking advantage of him. Finally he
+could stand it no longer. He signed up for bodybuilding courses, karate, judo,
+and all that good stuff. By the end of the summer, he had become quite strong;
+what's more, he felt really good about himself.
+ So on the next Monday, when Big John once again got on the bus
+and said "Big John doesn't pay!," the driver stood up, glared back at the
+passenger, and screamed, "And why not?"
+ With a surprised look on his face, Big John replied, "Big John has a
+bus pass."
+%
+ One night the captain of a tanker saw a light dead ahead. He
+directed his signalman to flash a signal to the light which went...
+ "Change course 10 degrees South."
+ The reply was quickly flashed back...
+ "You change course 10 degrees North."
+ The captain was a little annoyed at this reply and sent a further
+message.....
+ "I am a captain. Change course 10 degrees South."
+ Back came the reply...
+ "I am an able-seaman. Change course 10 degrees North."
+ The captain was outraged at this reply and send a message....
+"I am a 240,000 tonne tanker. CHANGE course 10 degrees South!"
+ Back came the reply...
+ "I am a LIGHTHOUSE. Change course 10 degrees North!!!!"
+ -- Cruising Helmsman, "On The Right Course"
+%
+ One of the questions that comes up all the time is: How enthusiastic
+is our support for UNIX?
+ Unix was written on our machines and for our machines many years ago.
+Today, much of UNIX being done is done on our machines. Ten percent of our
+VAXs are going for UNIX use. UNIX is a simple language, easy to understand,
+easy to get started with. It's great for students, great for somewhat casual
+users, and it's great for interchanging programs between different machines.
+And so, because of its popularity in these markets, we support it. We have
+good UNIX on VAX and good UNIX on PDP-11s.
+ It is our belief, however, that serious professional users will run
+out of things they can do with UNIX. They'll want a real system and will end
+up doing VMS when they get to be serious about programming.
+ With UNIX, if you're looking for something, you can easily and quickly
+check that small manual and find out that it's not there. With VMS, no matter
+what you look for -- it's literally a five-foot shelf of documentation -- if
+you look long enough it's there. That's the difference -- the beauty of UNIX
+is it's simple; and the beauty of VMS is that it's all there.
+ -- Ken Olsen, president of DEC, DECWORLD Vol. 8 No. 5, 1984
+[It's been argued that the beauty of UNIX is the same as the beauty of Ken
+Olsen's brain. Ed.]
+%
+ page 46
+...a report citing a study by Dr. Thomas C. Chalmers, of the Mount Sinai
+Medical Center in New York, which compared two groups that were being used
+to test the theory that ascorbic acid is a cold preventative. "The group
+on placebo who thought they were on ascorbic acid," says Dr. Chalmers,
+"had fewer colds than the group on ascorbic acid who thought they were
+on placebo."
+ page 56
+The placebo is proof that there is no real separation between mind and body.
+Illness is always an interaction between both. It can begin in the mind and
+affect the body, or it can begin in the body and affect the mind, both of
+which are served by the same bloodstream. Attempts to treat most mental
+diseases as though they were completely free of physical causes and attempts
+to treat most bodily diseases as though the mind were in no way involved must
+be considered archaic in the light of new evidence about the way the human
+body functions.
+ -- Norman Cousins,
+ "Anatomy of an Illness as Perceived by the Patient"
+%
+ Penn's aunts made great apple pies at low prices. No one else in
+town could compete with the pie rates of Penn's aunts.
+ During the American Revolution, a Britisher tried to raid a farm. He
+stumbled across a rock on the ground and fell, whereupon an aggressive Rhode
+Island Red hopped on top. Seeing this, the farmer commented, "Chicken catch
+a Tory!"
+ A wife started serving chopped meat, Monday hamburger, Tuesday meat
+loaf, Wednesday tartar steak, and Thursday meatballs. On Friday morning her
+husband snarled, "How now, ground cow?"
+ A journalist, thrilled over his dinner, asked the chef for the recipe.
+Retorted the chef, "Sorry, we have the same policy as you journalists, we
+never reveal our sauce."
+ A new chef from India was fired a week after starting the job. He
+kept favoring curry.
+ A couple of kids tried using pickles instead of paddles for a Ping-Pong
+game. They had the volley of the Dills.
+%
+ People of all sorts of genders are reporting great difficulty,
+these days, in selecting the proper words to refer to those of the female
+persuasion.
+ "Lady," "woman," and "girl" are all perfectly good words, but
+misapplying them can earn one anything from the charge of vulgarity to a good
+swift smack. We are messing here with matters of deference, condescension,
+respect, bigotry, and two vague concepts, age and rank. It is troubling
+enough to get straight who is really what. Those who deliberately misuse
+the terms in a misbegotten attempt at flattery are asking for it.
+ A woman is any grown-up female person. A girl is the un-grown-up
+version. If you call a wee thing with chubby cheeks and pink hair ribbons a
+"woman," you will probably not get into trouble, and if you do, you will be
+able to handle it because she will be under three feet tall. However, if you
+call a grown-up by a child's name for the sake of implying that she has a
+youthful body, you are also implying that she has a brain to match.
+%
+ "Perhaps he is not honest," Mr. Frostee said inside Cobb's head,
+sounding a bit worried.
+ "Of course he isn't," Cobb answered. "What we have to look out for
+is him calling the cops anyway, or trying to blackmail us for more money."
+ "I think you should kill him and eat his brain," Mr. Frostee
+said quickly.
+ "That's not the answer to *every* problem in interpersonal relations,"
+Cobb said, hopping out.
+ -- Rudy Rucker, "Software"
+%
+ Phases of a Project:
+(1) Exultation.
+(2) Disenchantment.
+(3) Confusion.
+(4) Search for the Guilty.
+(5) Punishment for the Innocent.
+(6) Distinction for the Uninvolved.
+%
+ Phil [Record] was known as the Hat because he always wore a felt
+snap brim. It was the standard uniform for police reporters, for one
+reason: it made it easier for them to pass themselves off as detectives.
+We had an informal code of ethics then; we never lied about who we were.
+But if people mistook us for the police, that was their problem, not ours.
+If they thought they were giving confidential information to an investigator,
+well, that was their problem, too. As we understood the First Amendment,
+everyone had a right to talk to the _Star-Telegram_, even if they didn't
+know they were talking to the _Star-Telegram_.
+ -- Bob Schieffer, "This Just In"
+%
+ Plumbing is one of the easier of do-it-yourself activities,
+requiring only a few simple tools and a willingness to stick your arm
+into a clogged toilet. In fact, you can solve many home plumbing
+problems, such as annoying faucet drip, merely by turning up the
+radio. But before we get into specific techniques, let's look at how
+plumbing works.
+ A plumbing system is very much like your electrical system,
+except that instead of electricity, it has water, and instead of wires,
+it has pipes, and instead of radios and waffle irons, it has faucets
+and toilets. So the truth is that your plumbing systems is nothing at
+all like your electrical system, which is good, because electricity can
+kill you.
+ -- Dave Barry, "The Taming of the Screw"
+%
+ Price Wang's programmer was coding software. His fingers danced upon
+the keyboard. The program compiled without an error message, and the program
+ran like a gentle wind.
+ Excellent!" the Price exclaimed, "Your technique is faultless!"
+ "Technique?" said the programmer, turning from his terminal, "What I
+follow is the Tao -- beyond all technique. When I first began to program I
+would see before me the whole program in one mass. After three years I no
+longer saw this mass. Instead, I used subroutines. But now I see nothing.
+My whole being exists in a formless void. My senses are idle. My spirit,
+free to work without a plan, follows its own instinct. In short, my program
+writes itself. True, sometimes there are difficult problems. I see them
+coming, I slow down, I watch silently. Then I change a single line of code
+and the difficulties vanish like puffs of idle smoke. I then compile the
+program. I sit still and let the joy of the work fill my being. I close my
+eyes for a moment and then log off."
+ Price Wang said, "Would that all of my programmers were as wise!"
+ -- Geoffrey James, "The Tao of Programming"
+%
+ "Reintegration complete," ZORAC advised. "We're back in the
+universe again..." An unusually long pause followed, "...but I don't
+know which part. We seem to have changed our position in space." A
+spherical display in the middle of the floor illuminated to show the
+starfield surrounding the ship.
+ "Several large, artificial constructions are approaching us,"
+ZORAC announced after a short pause. "The designs are not familiar, but
+they are obviously the products of intelligence. Implications: we have
+been intercepted deliberately by a means unknown, for a purpose unknown,
+and transferred to a place unknown by a form of intelligence unknown.
+Apart from the unknowns, everything is obvious."
+ -- James P. Hogan, "Giants Star"
+%
+ Reporters like Bill Greider from the Washington Post and Him
+Naughton of the New York Times, for instance, had to file long, detailed,
+and relatively complex stories every day -- while my own deadline fell
+every two weeks -- but neither of them ever seemed in a hurry about
+getting their work done, and from time to time they would try to console
+me about the terrible pressure I always seemed to be laboring under.
+ Any $100-an-hour psychiatrist could probably explain this problem
+to me, in thirteen or fourteen sessions, but I don't have time for that.
+No doubt it has something to do with a deep-seated personality defect, or
+maybe a kink in whatever blood vessel leads into the pineal gland... On
+the other hand, it might be something as simple & basically perverse as
+whatever instinct it is that causes a jackrabbit to wait until the last
+possible second to dart across the road in front of a speeding car.
+ -- Hunter S. Thompson, "Fear and Loathing:
+ On the Campaign Trail"
+%
+ "Richard, in being so fierce toward my vampire, you were doing
+what you wanted to do, even though you thought it was going to hurt
+somebody else. He even told you he'd be hurt if..."
+ "He was going to suck my blood!"
+ "Which is what we do to anyone when we tell them we'll be hurt
+if they don't live our way."
+...
+ "The thing that puzzles you," he said, "is an accepted saying that
+happens to be impossible. The phrase is hurt somebody else. We choose,
+ourselves, to be hurt or not to be hurt, no matter what. Us who decides.
+Nobody else. My vampire told you he'd be hurt if you didn't let him? That's
+his decision to be hurt, that's his choice. What you do about it is your
+decision, your choice: give him blood; ignore him; tie him up; drive a stake
+through his heart. If he doesn't want the holly stake, he's free to resist,
+in whatever way he wants. It goes on and on, choices, choices."
+ "When you look at it that way..."
+ "Listen," he said, "it's important. We are all. Free. To do.
+Whatever. We want. To do."
+ -- Richard Bach, "Illusions"
+%
+ Risch's decision procedure for integration, not surprisingly,
+uses a recursion on the number and type of the extensions from the
+rational functions needed to represent the integrand. Although the
+algorithm follows and critically depends upon the appropriate structure
+of the input, as in the case of multivariate factorization, we cannot
+claim that the algorithm is a natural one. In fact, the creator of
+differential algebra, Ritt, committed suicide in the early 1950's,
+largely, it is claimed, because few paid attention to his work. Probably
+he would have received more attention had he obtained the algorithm as
+well.
+ -- Joel Moses, "Algorithms and Complexity", ed. J. F. Traub
+%
+ Robert Kennedy's 1964 Senatorial campaign planners told him that
+their intention was to present him to the television viewers as a sincere,
+generous person. "You going to use a double?" asked Kennedy.
+
+ Thumbing through a promotional pamphlet prepared for his 1964
+Senatorial campaign, Robert Kennedy came across a photograph of himself
+shaking hands with a well-known labor leader.
+ "There must be a better photo that this," said Kennedy to the
+advertising men in charge of his campaign.
+ "What's wrong with this one?" asked one adman.
+ "That fellow's in jail," said Kennedy.
+ -- Bill Adler, "The Washington Wits"
+%
+ SAFETY
+I can live without
+Someone I love
+But not without
+Someone I need.
+%
+ Sam went to his psychiatrist complaining of a hatred for elephants.
+"I can't stand elephants," he explained. "I lie awake nights despising
+them. The thought of an elephant fills me with loathing."
+ "Sam," said the psychiatrist, "there's only one thing for you to do.
+Go to Africa, organize a safari, find an elephant in the jungle and shoot it.
+That way you'll get it out of your system."
+ Sam immediately made arrangements for a safari hunt in Africa,
+inviting his best friend to join him. They arrived in Nairobi and lost no
+time getting out on the jungle trails. After they had been hunting for
+several days, Sam's best friend grabbed him by the arm one morning and
+yelled at him:
+ "Sam, Sam, Sam! Over there behind that tree there's and elephant!
+Sam -- Get your gun -- no, no, not THAT gun -- the rifle with the longer
+barrel! Now aim it! QUICK! SAM! QUICK! No! Not that way -- this way!
+Be sure you don't jerk the trigger! Wait SAM! Don't let him see you! Aim
+at his head!"
+ Sam whirled around, took aim, and killed his friend. He was put in
+prison and his psychiatrist flew to Africa to visit him. "I sent you over
+here to kill an elephant and instead you shoot your best friend," the
+psychiatrist said. "Why?"
+ "Well," Sam replied, "there's only one thing in the world that I
+hate more than elephants and that is a loudmouth know-it-all!"
+%
+ Seems George was playing his usual eighteen holes on Saturday
+afternoon. Teeing off from the 17th, he sliced into the rough over near
+the edge of the fairway. Just as he was about to chip out, he noticed a
+long funeral procession going past on a nearby street. Reverently, George
+removed his hat and stood at attention until the procession had passed.
+Then he continued his game, finishing with a birdie on the eighteenth.
+Later, at the clubhouse, a fellow golfer greet George. "Say, that was a
+nice gesture you made today, George.
+ "What do you mean?" asked George.
+ "Well, it was nice of you to take off your cap and stand
+respectfully when that funeral went by," the friend replied.
+ "Oh, yes," said George. "Well, we were married 17 years, you
+know."
+%
+ "Seven years and six months!" Humpty Dumpty repeated thoughtfully.
+"An uncomfortable sort of age. Now if you'd asked MY advice, I'd have
+said 'Leave off at seven' -- but it's too late now."
+ "I never ask advice about growing," Alice said indignantly.
+ "Too proud?" the other enquired.
+ Alice felt even more indignant at this suggestion. "I mean,"
+she said, "that one can't help growing older."
+ "ONE can't, perhaps," said Humpty Dumpty; "but TWO can. With
+proper assistance, you might have left off at seven."
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+ Several students were asked to prove that all odd integers are prime.
+ The first student to try to do this was a math student. "Hmmm...
+Well, 1 is prime, 3 is prime, 5 is prime, and by induction, we have that all
+the odd integers are prime."
+ The second student to try was a man of physics who commented, "I'm not
+sure of the validity of your proof, but I think I'll try to prove it by
+experiment." He continues, "Well, 1 is prime, 3 is prime, 5 is prime, 7 is
+prime, 9 is... uh, 9 is... uh, 9 is an experimental error, 11 is prime, 13
+is prime... Well, it seems that you're right."
+ The third student to try it was the engineering student, who responded,
+"Well, to be honest, actually, I'm not sure of your answer either. Let's
+see... 1 is prime, 3 is prime, 5 is prime, 7 is prime, 9 is... uh, 9 is...
+well, if you approximate, 9 is prime, 11 is prime, 13 is prime... Well, it
+does seem right."
+ Not to be outdone, the computer science student comes along and says
+"Well, you two sort've got the right idea, but you'll end up taking too long!
+I've just whipped up a program to REALLY go and prove it." He goes over to
+his terminal and runs his program. Reading the output on the screen he says,
+"1 is prime, 1 is prime, 1 is prime, 1 is prime..."
+%
+ She said, "I know you ... you cannot sing."
+ I said, "That's nothing, you should hear me play piano."
+ -- Morrisey
+%
+ "Sheriff, we gotta catch Black Bart."
+ "Oh, yeah? What's he look like?"
+ "Well, he's wearin' a paper hat, a paper shirt, paper pants and
+paper boots."
+ "What's he wanted for?"
+ "Rustling."
+%
+ Sixtus V, Pope from 1585 to 1590 authorized a printing of the
+Vulgate Bible. Taking no chances, the pope issued a papal bull
+automatically excommunicating any printer who might make an alteration
+in the text. This he ordered printed at the beginning of the Bible.
+He personally examined every sheet as it came off the press. Yet the
+published Vulgate Bible contained so many errors that corrected scraps
+had to be printed and pasted over them in every copy. The result
+provoked wry comments on the rather patchy papal infallibility, and
+Pope Sixtus had no recourse but to order the return and destruction of
+every copy.
+%
+ So Richard and I decided to try to catch [the small shark]. With
+a great deal of strategy and effort and shouting, we managed to maneuver
+the shark, over the course of about a half-hour, to a sort of corner of the
+lagoon, so that it had no way to escape other than to flop up onto the land
+and evolve. Richard and I were inching toward it, sort of crouched over,
+when all of a sudden it turned around and -- I can still remember the
+sensation I felt at that moment, primarily in the armpit area -- headed
+right straight toward us.
+ Many people would have panicked at this point. But Richard and I
+were not "many people." We were experienced waders, and we kept our heads.
+We did exactly what the textbook says you should do when you're unarmed and
+a shark that is nearly two feet long turns on you in water up to your lower
+calves: We sprinted I would say 600 yards in the opposite direction, using
+a sprinting style such that the bottoms of our feet never once went below
+the surface of the water. We ran all the way to the far shore, and if we
+had been in a Warner Brothers cartoon we would have run right INTO the beach,
+and you would have seen these two mounds of sand racing across the island
+until they bonked into trees and coconuts fell onto their heads.
+ -- Dave Barry, "The Wonders of Sharks on TV"
+%
+ "So you don't have to, Cindy, but I was wondering if you might
+want to go to someplace, you know, with me, sometime."
+ "Well, I can think of a lot of worse things, David."
+ "Friday, then?"
+ "Why not, David, it might even be fun."
+ -- Dating in Minnesota
+%
+ Some 1500 miles west of the Big Apple we find the Minneapple, a
+haven of tranquility in troubled times. It's a good town, a civilized town.
+A town where they still know how to get your shirts back by Thursday. Let
+the Big Apple have the feats of "Broadway Joe" Namath. We have known the
+stolid but steady Killebrew. Listening to Cole Porter over a dry martini
+may well suit those unlucky enough never to have heard the Whoopee John Polka
+Band and never to have shared a pitcher of 3.2 Grain Belt Beer. The loss is
+theirs. And the Big Apple has yet to bake the bagel that can match peanut
+butter on lefse. Here is a town where the major urban problem is dutch elm
+disease and the number one crime is overtime parking. We boast more theater
+per capita than the Big Apple. We go to see, not to be seen. We go even
+when we must shovel ten inches of snow from the driveway to get there. Indeed
+the winters are fierce. But then comes the marvel of the Minneapple summer.
+People flock to the city's lakes to frolic and rejoice at the sight of so
+much happy humanity free from the bonds of the traditional down-filled parka.
+Here's to the Minneapple. And to its people. Our flair for style is balanced
+by a healthy respect for wind chill factors.
+ And we always, always eat our vegetables.
+ This is the Minneapple.
+%
+ Something mysterious is formed, born in the silent void. Waiting
+alone and unmoving, it is at once still and yet in constant motion. It is
+the source of all programs. I do not know its name, so I will call it the
+Tao of Programming.
+ If the Tao is great, then the operating system is great. If the
+operating system is great, then the compiler is great. If the compiler is
+greater, then the applications is great. The user is pleased and there is
+harmony in the world.
+ The Tao of Programming flows far away and returns on the wind of
+morning.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ Somewhat alarmed at the continued growth of the number of employees
+on the Department of Agriculture payroll in 1962, Michigan Republican Robert
+Griffin proposed an amendment to the farm bill so that "the total number of
+employees in the Department of Agriculture at no time exceeds the number of
+farmers in America."
+ -- Bill Adler, "The Washington Wits"
+%
+ "Somewhere", said Father Vittorini, "did Blake not speak of the
+Machineries of Joy? That is, did not God promote environments, then
+intimidate these Natures by provoking the existence of flesh, toy men and
+women, such as are we all? And thus happily sent forth, at our best, with
+good grace and fine wit, on calm noons, in fair climes, are we not God's
+Machineries of Joy?"
+ "If Blake said that", said Father Brian, "he never lived in Dublin."
+ -- Ray Bradbury, "The Machineries of Joy"
+%
+ Split 1/4 bottle .187 liters
+ Half 1/2 bottle
+ Bottle 750 milliliters
+ Magnum 2 bottles 1.5 liters
+ Jeroboam 4 bottles
+ Rehoboam 6 bottles Not available in the US
+ Methuselah 8 bottles
+ Salmanazar 12 bottles
+ Balthazar 16 bottles
+ Nebuchadnezzar 20 bottles 15 liters
+ Sovereign 34 bottles 26 liters
+
+ The Sovereign is a new bottle, made for the launching of the
+largest cruise ship in the world. The bottle alone cost 8,000 dollars
+to produce and they only made 8 of them.
+ Most of the funny names come from Biblical people.
+%
+ Stop! Whoever crosseth the bridge of Death, must answer first
+these questions three, ere the other side he see!
+
+ "What is your name?"
+ "Sir Brian of Bell."
+ "What is your quest?"
+ "I seek the Holy Grail."
+ "What are four lowercase letters that are not legal flag arguments
+to the Berkeley UNIX version of `ls'?"
+ "I, er.... AIIIEEEEEE!"
+%
+ Strange memories on this nervous night in Las Vegas. Five years later?
+Six? It seems like a lifetime, or at least a Main Era -- the kind of peak that
+never comes again. San Francisco in the middle sixties was a very special time
+and place to be a part of. Maybe it meant something. Maybe not, in the long
+run... There was madness in any direction, at any hour. If not across the
+Bay, then up the Golden Gate or down 101 to Los Altos or La Honda... You could
+strike sparks anywhere. There was a fantastic universal sense that whatever we
+were doing was right, that we were winning...
+ And that, I think, was the handle -- that sense of inevitable victory
+over the forces of Old and Evil. Not in any mean or military sense; we didn't
+need that. Our energy would simply prevail. There was no point in fighting
+-- on our side or theirs. We had all the momentum; we were riding the crest
+of a high and beautiful wave. So now, less than five years later, you can go
+up on a steep hill in Las Vegas and look West, and with the right kind of eyes
+you can almost see the high-water mark -- that place where the wave finally
+broke and rolled back.
+ -- Hunter S. Thompson
+%
+ "Surely you can't be serious."
+ "I am serious, and don't call me Shirley."
+%
+ Take the folks at Coca-Cola. For many years, they were content
+to sit back and make the same old carbonated beverage. It was a good
+beverage, no question about it; generations of people had grown up
+drinking it and doing the experiment in sixth grade where you put a
+nail into a glass of Coke and after a couple of days the nail dissolves
+and the teacher says: "Imagine what it does to your TEETH!" So Coca-Cola
+was solidly entrenched in the market, and the management saw no need to
+improve ...
+ -- Dave Barry, "In Search of Excellence"
+%
+ "That's right; the upper-case shift works fine on the screen, but
+they're not coming out on the damn printer... Hold? Sure, I'll hold."
+ -- e. e. cummings last service call
+%
+ "The best thing for being sad," replied Merlin, beginning to puff
+and blow, "is to learn something. That's the only thing that never fails.
+You may grow old and trembling in your anatomies, you may lie awake at
+night listening to the disorder of your veins, you may miss your only love,
+you may see the world about you devastated by evil lunatics, or know your
+honour trampled in the sewers of baser minds. There is only one thing for
+it then -- to learn. Learn why the world wags and what wags it. That is
+the only thing which the mind can never exhaust, never alienate, never be
+tortured by, never fear or distrust, and never dream of regretting. Learning
+is the only thing for you. Look what a lot of things there are to learn."
+ -- T. H. White, "The Once and Future King"
+%
+ The birds are singing, the flowers are budding, and it is time
+for Miss Manners to tell young lovers to stop necking in public.
+ It's not that Miss Manners is immune to romance. Miss Manners
+has been known to squeeze a gentleman's arm while being helped over a
+curb, and, in her wild youth, even to press a dainty slipper against a
+foot or two under the dinner table. Miss Manners also believes that the
+sight of people strolling hand in hand or arm in arm or arm in hand
+dresses up a city considerably more than the more familiar sight of
+people shaking umbrellas at one another. What Miss Manners objects to
+is the kind of activity that frightens the horses on the street...
+%
+ The boss returned from lunch in a good mood and called the whole staff
+in to listen to a couple of jokes he had picked up. Everybody but one girl
+laughed uproariously. "What's the matter?" grumbled the boss. "Haven't you
+got a sense of humor?"
+ "I don't have to laugh," she said. "I'm leaving Friday anyway.
+%
+ The FIELD GUIDE to NORTH AMERICAN MALES
+
+SPECIES: Cranial Males
+SUBSPECIES: The Hacker (homo computatis)
+Courtship & Mating:
+ Due to extreme deprivation, HOMO COMPUTATIS maintains a near perpetual
+ state of sexual readiness. Courtship behavior alternates between
+ awkward shyness and abrupt advances. When he finally mates, he
+ chooses a female engineer with an unblinking stare, a tight mouth, and
+ a complete collection of Campbell's soup-can recipes.
+Track:
+ Trash cans full of pale green and white perforated paper and old
+ copies of the Allen-Bradley catalog.
+Comments:
+ Extremely fond of bad puns and jokes that need long explanations.
+%
+ The FIELD GUIDE to NORTH AMERICAN MALES
+
+SPECIES: Cranial Males
+SUBSPECIES: The Hacker (homo computatis)
+Description:
+ Gangly and frail, the hacker has a high forehead and thinning hair.
+ Head disproportionately large and crooked forward, complexion wan and
+ sightly gray from CRT illumination. He has heavy black-rimmed glasses
+ and a look of intense concentration, which may be due to a software
+ problem or to a pork-and-bean breakfast.
+Feathering:
+ HOMO COMPUTATIS saw a Brylcreem ad fifteen years ago and believed it.
+ Consequently, crest is greased down, except for the cowlick.
+Song:
+ A rather plaintive "Is it up?"
+%
+ The FIELD GUIDE to NORTH AMERICAN MALES
+
+SPECIES: Cranial Males
+SUBSPECIES: The Hacker (homo computatis)
+Plumage:
+ All clothes have a slightly crumpled look as though they came off the
+ top of the laundry basket. Style varies with status. Hacker managers
+ wear gray polyester slacks, pink or pastel shirts with wide collars,
+ and paisley ties; staff wears cinched-up baggy corduroy pants, white
+ or blue shirts with button-down collars, and penholder in pocket.
+ Both managers and staff wear running shoes to work, and a black
+ plastic digital watch with calculator.
+%
+ The General disliked trying to explain the highly technical
+inner workings of the U.S. Air Force.
+ "$7,662 for a ten cup coffee maker, General?" the Senator asked.
+ In his head he ran through his standard explanations. "It's not so,"
+he thought. "It's a deterrent." Soon he came up with, "It's computerized,
+Senator. Tiny computer chips make coffee that's smooth and full-bodied. Try
+a cup."
+ The Senator did. "Pfffttt! Tastes like jet fuel!"
+ "It's not so," the General thought. "It's a deterrent."
+ Then he remembered something. "We bought a lot of untested computer
+chips," the General answered. "They got into everything. Just a little
+mix-up. Nothing serious."
+ Then he remembered something else. It was at the site of the
+mysterious B-1 crash. A strange smell in the fuel lines. It smelled like
+coffee. Smooth and full bodied...
+ -- Another Episode of General's Hospital
+%
+ The geographical center of Boston is in Roxbury. Due north of
+the center we find the South End. This is not to be confused with South
+Boston which lies directly east from the South End. North of the South
+End is East Boston and southwest of East Boston is the North End.
+%
+ "The Good Ship Enterprise" (to the tune of "The Good Ship Lollipop")
+
+On the good ship Enterprise
+Every week there's a new surprise
+Where the Romulans lurk
+And the Klingons often go berserk.
+
+Yes, the good ship Enterprise
+There's excitement anywhere it flies
+Where Tribbles play
+And Nurse Chapel never gets her way.
+
+ See Captain Kirk standing on the bridge,
+ Mr. Spock is at his side.
+ The weekly menace, ooh-ooh
+ It gets fried, scattered far and wide.
+
+It's the good ship Enterprise
+Heading out where danger lies
+And you live in dread
+If you're wearing a shirt that's red.
+ -- Doris Robin and Karen Trimble of The L.A. Filkharmonics
+%
+ The Hitchhiker's Guide to the Galaxy has a few things to say on
+the subject of towels.
+ A towel, it says, is about the most massively useful thing an
+interstellar hitchhiker can have. Partly it has great practical value.
+You can wrap it around you for warmth as you bound across the cold moons
+of Jaglan Beta; you can lie on it on the brilliant marble-sanded beaches
+of Santraginus V ... use it to sail a miniraft down the slow heavy River
+Moth; wave your towel in emergencies, and, of course, dry yourself off
+with it if it still seems to be clean enough.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+ The Hitchhiker's Guide to the Galaxy has a few things to say on
+the subject of towels.
+ Most importantly, a towel has immense psychological value. For
+some reason, if a non-hitchhiker discovers that a hitchhiker has his towel
+with him, he will automatically assume that he is also in possession of a
+toothbrush, washcloth, flask, gnat spray, space suit, etc., etc. Furthermore,
+the non-hitchhiker will then happily lend the hitchhiker any of these or
+a dozen other items that he may have "lost". After all, any man who can
+hitch the length and breadth of the Galaxy, struggle against terrible odds,
+win through and still know where his towel is, is clearly a man to be
+reckoned with.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+ "The jig's up, Elman."
+ "Which jig?"
+ -- Jeff Elman
+%
+ THE LESSER-KNOWN PROGRAMMING LANGUAGES #2: RENE
+
+Named after the famous French philosopher and mathematician Rene
+Descartes, RENE is a language used for artificial intelligence. The
+language is being developed at the Chicago Center of Machine Politics
+and Programming under a grant from the Jane Byrne Victory Fund. A
+spokesman described the language as "Just as great as dis [sic] city of
+ours."
+
+The center is very pleased with progress to date. They say they have
+almost succeeded in getting a VAX to think. However, sources inside the
+organization say that each time the machine fails to think it ceases to
+exist.
+%
+ THE LESSER-KNOWN PROGRAMMING LANGUAGES #8: LAIDBACK
+
+This language was developed at the Marin County Center for T'ai Chi,
+Mellowness and Computer Programming (now defunct), as an alternative to
+the more intense atmosphere in nearby Silicon Valley.
+
+The center was ideal for programmers who liked to soak in hot tubs
+while they worked. Unfortunately few programmers could survive there
+because the center outlawed Pizza and Coca-Cola in favor of Tofu and
+Perrier.
+
+Many mourn the demise of LAIDBACK because of its reputation as a gentle
+and non-threatening language since all error messages are in lower
+case. For example, LAIDBACK responded to syntax errors with the
+message:
+ "i hate to bother you, but i just can't relate to that. can
+ you find the time to try it again?"
+%
+ The Lord and I are in a sheep-shepherd relationship, and I am in
+a position of negative need.
+ He prostrates me in a green-belt grazing area.
+ He conducts me directionally parallel to non-torrential aqueous
+liquid.
+ He returns to original satisfaction levels my psychological makeup.
+ He switches me on to a positive behavioral format for maximal
+prestige of His identity.
+ It should indeed be said that notwithstanding the fact that I make
+ambulatory progress through the umbrageous inter-hill mortality slot, terror
+sensations will no be initiated in me, due to para-etical phenomena.
+ Your pastoral walking aid and quadrupic pickup unit introduce me
+into a pleasurific mood state.
+ You design and produce a nutriment-bearing furniture-type structure
+in the context of non-cooperative elements.
+ You act out a head-related folk ritual employing vegetable extract.
+ My beverage utensil experiences a volume crisis.
+ It is an ongoing deductible fact that your inter-relational
+empathetical and non-ventious capabilities will retain me as their
+target-focus for the duration of my non-death period, and I will possess
+tenant rights in the housing unit of the Lord on a permanent, open-ended
+time basis.
+%
+ The Magician of the Ivory Tower brought his latest invention for the
+master programmer to examine. The magician wheeled a large black box into the
+master's office while the master waited in silence.
+ "This is an integrated, distributed, general-purpose workstation,"
+began the magician, "ergonomically designed with a proprietary operating
+system, sixth generation languages, and multiple state of the art user
+interfaces. It took my assistants several hundred man years to construct.
+Is it not amazing?"
+ The master raised his eyebrows slightly. "It is indeed amazing," he
+said.
+ "Corporate Headquarters has commanded," continued the magician, "that
+everyone use this workstation as a platform for new programs. Do you agree
+to this?"
+ "Certainly," replied the master, "I will have it transported to the
+data center immediately!" And the magician returned to his tower, well
+pleased.
+ Several days later, a novice wandered into the office of the master
+programmer and said, "I cannot find the listing for my new program. Do
+you know where it might be?"
+ "Yes," replied the master, "the listings are stacked on the platform
+in the data center."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ The Martian landed his saucer in Manhattan, and immediately upon
+emerging was approached by a panhandler. "Mister," said the man, "can I
+have a quarter?"
+ The Martian asked, "What's a quarter?"
+ The panhandler thought a minute, brightened, then said, "You're
+right! Can I have a dollar?"
+%
+ The master programmer moves from program to program without fear. No
+change in management can harm him. He will not be fired, even if the project
+is canceled. Why is this? He is filled with the Tao.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ The Minnesota Board of Education voted to consider requiring all
+students to do some "volunteer work" as a prerequisite to high school gradu-
+ation.
+ Senator Orrin Hatch said that "capital punishment is our society's
+recognition of the sanctity of human life."
+
+ According to the tax bill signed by President Reagan on December 22,
+1987, Don Tyson and his sister-in-law Barbara run a "family farm." Their
+"farm" has 25,000 employees and grosses $1.7 billion a year. But as a "family
+farm" they get tax breaks that save them $135 million a year.
+
+ Scott L. Pickard, spokesperson for the Massachusetts Department of
+Public Works, calls them "ground-mounted confirmatory route markers." You
+probably call them road signs, but then you don't work in a government agency.
+
+ It's not "elderly" or "senior citizens" anymore. Now it's "chrono-
+logically experienced citizens."
+
+ According to the FAA, the propeller blade didn't break off, it was
+just a case of "uncontained blade liberation."
+ -- Quarterly Review of Doublespeak (NCTE)
+%
+ "...The name of the song is called 'Haddocks' Eyes'!"
+ "Oh, that's the name of the song, is it?" Alice said, trying to
+feel interested.
+ "No, you don't understand," the Knight said, looking a little
+vexed. "That's what the name is called. The name really is, 'The Aged
+Aged Man.'"
+ "Then I ought to have said "That's what the song is called'?"
+Alice corrected herself.
+ "No, you oughtn't: that's quite another thing! The song is
+called 'Ways and Means': but that's only what it is called you know!"
+ "Well, what is the song then?" said Alice, who was by this
+time completely bewildered.
+ "I was coming to that," the Knight said. "The song really is
+"A-sitting on a Gate": and the tune's my own invention."
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+ The only real game in the world, I think, is baseball...
+You've got to start way down, at the bottom, when you're six or seven years
+old. You can't wait until you're fifteen or sixteen. You've got to let it
+grow up with you, and if you're successful and you try hard enough, you're
+bound to come out on top, just like these boys have come to the top now.
+ -- Babe Ruth, in his 1948 farewell speech at Yankee Stadium
+%
+ The Priest's grey nimbus in a niche where he dressed discreetly.
+I will not sleep here tonight. Home also I cannot go.
+ A voice, sweetened and sustained, called to him from the sea.
+Turning the curve he waved his hand. A sleek brown head, a seal's, far
+out on the water, round. Usurper.
+ -- James Joyce, "Ulysses"
+%
+ The problem with engineers is that they tend to cheat in order to
+get results.
+ The problem with mathematicians is that they tend to work on toy
+problems in order to get results
+ The problem with program verifiers is that they tend to cheat at
+toy problems in order to get results.
+%
+ The programmers of old were mysterious and profound. We cannot fathom
+their thoughts, so all we do is describe their appearance.
+ Aware, like a fox crossing the water. Alert, like a general on the
+battlefield. Kind, like a hostess greeting her guests. Simple, like uncarved
+blocks of wood. Opaque, like black pools in darkened caves.
+ Who can tell the secrets of their hearts and minds?
+ The answer exists only in the Tao.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ "The pyramid is opening!"
+ "Which one?"
+ "The one with the ever-widening hole in it!"
+ -- The Firesign Theatre,
+ "How Can You Be In Two Places At
+ Once When You're Not Anywhere At All"
+%
+ The salesman and the system analyst took off to spend a weekend in the
+forest, hunting bear. They'd rented a cabin, and, when they got there, took
+their backpacks off and put them inside. At which point the salesman turned
+to his friend, and said, "You unpack while I go and find us a bear."
+ Puzzled, the analyst finished unpacking and then went and sat down
+on the porch. Soon he could hear rustling noises in the forest. The noises
+got nearer -- and louder -- and suddenly there was the salesman, running like
+hell across the clearing toward the cabin, pursued by one of the largest and
+most ferocious grizzly bears the analyst had ever seen.
+ "Open the door!", screamed the salesman.
+ The analyst whipped open the door, and the salesman ran to the door,
+suddenly stopped, and stepped aside. The bear, unable to stop, continued
+through the door and into the cabin. The salesman slammed the door closed
+and grinned at his friend. "Got him!", he exclaimed, "now, you skin this
+one and I'll go rustle us up another!"
+%
+ The Tao gave birth to machine language. Machine language gave birth
+to the assembler.
+ The assembler gave birth to the compiler. Now there are ten thousand
+languages.
+ Each language has its purpose, however humble. Each language
+expresses the Yin and Yang of software. Each language has its place within
+the Tao.
+ But do not program in COBOL if you can avoid it.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ The way my jeweler explained it, it's like insurance.
+ Six months' pay isn't much to keep my wife from sleeping around.
+
+A diamond -- pure, sparkling, natural, flawless, forever. The way marriage
+should be but never quite is. People grow and change and sometimes want to
+take their clothes off with strangers. So when you invest in a fine piece
+of diamond jewelry, you're not only making an investment, you're making a
+statement. You're telling the woman you love that you've just spent a lot
+of your hard-earned money on her. Now she owes you the kind of loyalty that
+only precious jewelry can buy. Isn't she worth it?
+
+ The Honeymoon's Over: from $ 5000
+ The Seven Year Itch: from $10000
+ No More Lunchtime Quickies: from $15000
+ Divorce Would Be More Expensive: from $42000
+
+ A diamond is for leverage. BeDears
+%
+ The wise programmer is told about the Tao and follows it. The average
+programmer is told about the Tao and searches for it. The foolish programmer
+is told about the Tao and laughs at it. If it were not for laughter, there
+would be no Tao.
+ The highest sounds are the hardest to hear. Going forward is a way to
+retreat. Greater talent shows itself late in life. Even a perfect program
+still has bugs.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ THE WOMBAT
+
+The wombat lives across the seas,
+Among the far Antipodes.
+He may exist on nuts and berries,
+Or then again, on missionaries;
+His distant habitat precludes
+Conclusive knowledge of his moods.
+But I would not engage the wombat
+In any form of mortal combat.
+%
+ The world's most avid baseball fan (an Aggie) had arrived at the
+stadium for the first game of the World Series only to realize he had left
+his ticket at home. Not wanting to miss any of the first inning, he went
+to the ticket booth and got in a long line for another seat. After an hour's
+wait he was just a few feet from the booth when a voice called out, "Hey,
+Dave!" The Aggie looked up, stepped out of line and tried to find the owner
+of the voice -- with no success. Then he realized he had lost his place in
+line and had to wait all over again. When the fan finally bought his ticket,
+he was thirsty, so he went to buy a drink. The line at the concession stand
+was long, too, but since the game hadn't started he decided to wait. Just as
+he got to the window, a voice called out, "Hey, Dave!" Again the Aggie tried
+to find the voice -- but no luck. He was very upset as he got back in line
+for his drink. Finally the fan went to his seat, eager for the game to begin.
+As he waited for the pitch, he heard the voice calling, "Hey Dave!" once more.
+Furious, he stood up and yelled at the top of his lungs, "My name is not
+Dave!"
+%
+ Then there's the atmosphere -- half the time you can eat the air,
+it's got so much stuff floating around in it. It takes the edge out of
+the colors. Down here even the traffic lights are pastel. And people!
+With a lot of these folks you'd have to check their green cards just to
+make sure that they are Earthlings. Then there's the police. In Portland,
+when some guy goes bananas, the cops rope off a sixteen block area around
+him and call a shrink from the medical school who stands atop a patrol car
+with a megaphone and shouts, "OK! THIS! ALL! STARTED! WHEN! YOU! WERE!
+THREE! YEARS! OLD! ON! ACCOUNT! OF! YOUR MOTHER! RIGHT? SO! LET'S!
+TALK! ABOUT! IT!" Down here they don't waste that kind of time. The LAPD
+has SWAT teams composed of guys who make Darth Vader look like Mr. Peepers.
+Before they go to bust a bookie joint they mortar it first.
+ -- M. Christensen, "A Portland Innocent in LA"
+%
+ Then there's the story of the man who avoided reality for 70 years
+with drugs, sex, alcohol, fantasy, TV, movies, records, a hobby, lots of
+sleep... And on his 80th birthday died without ever having faced any of
+his real problems.
+ The man's younger brother, who had been facing reality and all his
+problems for 50 years with psychiatrists, nervous breakdowns, tics, tension,
+headaches, worry, anxiety and ulcers, was so angry at his brother for having
+gotten away scott free that he had a paralyzing stroke.
+ The moral to this story is that there ain't no justice that we can
+stand to live with.
+ -- R. Geis
+%
+ "Then what is magic for?" Prince Lir demanded wildly. "What use is
+wizardry if it cannot save a unicorn?" He gripped the magician's shoulder
+hard, to keep from falling.
+ Schmendrick did not turn his head. With a touch of sad mockery in
+his voice, he said, "That's what heroes are for."
+...
+ "Yes, of course," he [Prince Lir] said. "That is exactly what heroes
+are for. Wizards make no difference, so they say that nothing does, but
+heroes are meant to die for unicorns."
+ -- P. Beagle, "The Last Unicorn"
+%
+ "Then you admit confirming not denying you ever said that?"
+ "NO! ... I mean Yes! WHAT?"
+ "I'll put `maybe.'"
+ -- Bloom County
+%
+ THEORY
+Into love and out again,
+ Thus I went and thus I go.
+Spare your voice, and hold your pen:
+ Well and bitterly I know
+All the songs were ever sung,
+ All the words were ever said;
+Could it be, when I was young,
+ Someone dropped me on my head?
+ -- Dorothy Parker
+%
+ There are some goyisha names that just about guarantee that
+someone isn't Jewish. For example, you'll never meet a Jew named
+Johnson or Wright or Jones or Sinclair or Ricks or Stevenson or Reid or
+Larsen or Jenks. But some goyisha names just about guarantee that
+every other person you meet with that name will be Jewish. Why is
+this?
+ Who knows? Learned rabbis have pondered this question for
+centuries and have failed to come up with an answer, and you think _y_o_u
+can find one? Get serious. You don't even understand why it's
+forbidden to eat crab -- fresh cold crab with mayonnaise -- or lobster
+-- soft tender morsels of lobster dipped in melted butter. You don't
+even understand a simple thing like that, and yet you hope to discover
+why there are more Jews named Miller than Katz? Fat Chance.
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+ There are wavelengths that people cannot see, there are
+sounds that people cannot hear, and maybe computers have thoughts
+that people cannot think.
+ -- Richard W. Hamming
+%
+ There once was a man who went to a computer trade show. Each day as
+he entered, the man told the guard at the door:
+ "I am a great thief, renowned for my feats of shoplifting. Be
+forewarned, for this trade show shall not escape unplundered."
+ This speech disturbed the guard greatly, because there were millions
+of dollars of computer equipment inside, so he watched the man carefully.
+But the man merely wandered from booth to booth, humming quietly to himself.
+ When the man left, the guard took him aside and searched his clothes,
+but nothing was to be found.
+ On the next day of the trade show, the man returned and chided the
+guard saying: "I escaped with a vast booty yesterday, but today will be even
+better." So the guard watched him ever more closely, but to no avail.
+ On the final day of the trade show, the guard could restrain his
+curiosity no longer. "Sir Thief," he said, "I am so perplexed, I cannot live
+in peace. Please enlighten me. What is it that you are stealing?"
+ The man smiled. "I am stealing ideas," he said.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ There once was a master programmer who wrote unstructured programs.
+A novice programmer, seeking to imitate him, also began to write unstructured
+programs. When the novice asked the master to evaluate his progress, the
+master criticized him for writing unstructured programs, saying: "What is
+appropriate for the master is not appropriate for the novice. You must
+understand the Tao before transcending structure."
+ -- Geoffrey James, "The Tao of Programming"
+%
+ There once was this swami who lived above a delicatessen. Seems one
+day he decided to stop in downstairs for some fresh liver. Well, the owner
+of the deli was a bit of a cheap-skate, and decided to pick up a little extra
+change at his customer's expense. Turning quietly to the counterman, he
+whispered, "Weigh down upon the swami's liver!"
+%
+ There was a college student trying to earn some pocket money by
+going from house to house offering to do odd jobs. He explained this to
+a man who answered one door.
+ "How much will you charge to paint my porch?" asked the man.
+ "Forty dollars."
+ "Fine" said the man, and gave the student the paint and brushes.
+ Three hours later the paint-splattered lad knocked on the door again.
+"All done!", he says, and collects his money. "By the way," the student says,
+"That's not a Porsche, it's a Ferrari."
+%
+ There was a knock on the door. Mrs. Miffin opened it. "Are
+you the Widow Miffin?" a small boy asked.
+ "I'm Mrs. Miffin," she replied, "but I'm not a widow."
+ "Oh, no?" replied the little boy. "Wait 'til you see what
+they're carrying upstairs!"
+%
+ There was a mad scientist (a mad... social... scientist) who kidnapped
+three colleagues, an engineer, a physicist, and a mathematician, and locked
+each of them in separate cells with plenty of canned food and water but no
+can opener.
+ A month later, returning, the mad scientist went to the engineer's
+cell and found it long empty. The engineer had constructed a can opener from
+pocket trash, used aluminum shavings and dried sugar to make an explosive,
+and escaped.
+ The physicist had worked out the angle necessary to knock the lids
+off the tin cans by throwing them against the wall. She was developing a good
+pitching arm and a new quantum theory.
+ The mathematician had stacked the unopened cans into a surprising
+solution to the kissing problem; his desiccated corpse was propped calmly
+against a wall, and this was inscribed on the floor:
+ Theorem: If I can't open these cans, I'll die.
+ Proof: assume the opposite...
+%
+ There was once a programmer who was attached to the court of the
+warlord of Wu. The warlord asked the programmer: "Which is easier to design:
+an accounting package or an operating system?"
+ "An operating system," replied the programmer.
+ The warlord uttered an exclamation of disbelief. "Surely an
+accounting package is trivial next to the complexity of an operating
+system," he said.
+ "Not so," said the programmer, "when designing an accounting package,
+the programmer operates as a mediator between people having different ideas:
+how it must operate, how its reports must appear, and how it must conform to
+tax laws. By contrast, an operating system is not limited by outward
+appearances. When designing an operating system, the programmer seeks the
+simplest harmony between machine and ideas. This is why an operating system
+is easier to design."
+ The warlord of Wu nodded and smiled. "That is all good and well,"
+he said, "but which is easier to debug?"
+ The programmer made no reply.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ There was once a programmer who worked upon microprocessors. "Look at
+how well off I am here," he said to a mainframe programmer who came to visit,
+"I have my own operating system and file storage device. I do not have to
+share my resources with anyone. The software is self-consistent and
+easy-to-use. Why do you not quit your present job and join me here?"
+ The mainframe programmer then began to describe his system to his
+friend, saying: "The mainframe sits like an ancient sage meditating in the
+midst of the data center. Its disk drives lie end-to-end like a great ocean
+of machinery. The software is a multi-faceted as a diamond and as convoluted
+as a primeval jungle. The programs, each unique, move through the system
+like a swift-flowing river. That is why I am happy where I am."
+ The microcomputer programmer, upon hearing this, fell silent. But the
+two programmers remained friends until the end of their days.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ They are fools that think that wealth or women or strong drink or even
+drugs can buy the most in effort out of the soul of a man. These things offer
+pale pleasures compared to that which is greatest of them all, that task which
+demands from him more than his utmost strength, that absorbs him, bone and
+sinew and brain and hope and fear and dreams -- and still calls for more.
+ They are fools that think otherwise. No great effort was ever bought.
+No painting, no music, no poem, no cathedral in stone, no church, no state was
+ever raised into being for payment of any kind. No Parthenon, no Thermopylae
+was ever built or fought for pay or glory; no Bukhara sacked, or China ground
+beneath Mongol heel, for loot or power alone. The payment for doing these
+things was itself the doing of them.
+ To wield oneself -- to use oneself as a tool in one's own hand -- and
+so to make or break that which no one else can build or ruin -- THAT is the
+greatest pleasure known to man! To one who has felt the chisel in his hand
+and set free the angel prisoned in the marble block, or to one who has felt
+sword in hand and set homeless the soul that a moment before lived in the body
+of his mortal enemy -- to those both come alike the taste of that rare food
+spread only for demons or for gods."
+ -- Gordon R. Dickson, "Soldier Ask Not"
+%
+ This is where the bloodthirsty license agreement is supposed to go,
+explaining that Interactive EasyFlow is a copyrighted package licensed for
+use by a single person, and sternly warning you not to pirate copies of it
+and explaining, in detail, the gory consequences if you do.
+ We know that you are an honest person, and are not going to go around
+pirating copies of Interactive EasyFlow; this is just as well with us since
+we worked hard to perfect it and selling copies of it is our only method of
+making anything out of all the hard work.
+ If, on the other hand, you are one of those few people who do go
+around pirating copies of software you probably aren't going to pay much
+attention to a license agreement, bloodthirsty or not. Just keep your doors
+locked and look out for the HavenTree attack shark.
+ -- License Agreement for Interactive EasyFlow
+%
+ Thompson, if he is to be believed, has sampled the entire
+rainbow of legal and illegal drugs in heroic efforts to feel better
+than he does.
+ As for the truth about his health: I have asked around about
+it. I am told that he appears to be strong and rosy, and steadily
+sane. But we will be doing what he wants us to do, I think, if we
+consider his exterior a sort of Dorian Gray facade. Inwardly, he is
+being eaten alive by tinhorn politicians.
+ The disease is fatal. There is no known cure. The most we can
+do for the poor devil, it seems to me, is to name his disease in his
+honor. From this moment on, let all those who feel that Americans can
+be as easily led to beauty as to ugliness, to truth as to public
+relations, to joy as to bitterness, be said to be suffering from Hunter
+Thompson's disease. I don't have it this morning. It comes and goes.
+This morning I don't have Hunter Thompson's disease.
+ -- Kurt Vonnegut, Jr. on Dr. Hunter S. Thompson: Excerpt
+ from "A Political Disease", Vonnegut's review of "Fear
+ and Loathing: On the Campaign Trail '72"
+%
+ To A Quick Young Fox:
+Why jog exquisite bulk, fond crazy vamp,
+Daft buxom jonquil, zephyr's gawky vice?
+Guy fed by work, quiz Jove's xanthic lamp --
+Zow! Qualms by deja vu gyp fox-kin thrice.
+ -- Lazy Dog
+%
+ To lose weight, eat less; to gain weight, eat more; if you merely
+wish to maintain, do whatever you were doing.
+ The Bronx diet is a legitimate system of food therapy showing that
+food SHOULD be used a crutch and which food could be the most effective in
+promoting spiritual and emotional satisfaction. For the first time, an
+eater could instantly grasp the connection between relieving depression and
+Mallomars, and understand why a lover's quarrel isn't so bad if there's a
+pint of ice cream nearby.
+ -- Richard Smith, "The Bronx Diet"
+%
+ Two men looked out from the prison bars,
+ One saw mud--
+ The other saw stars.
+
+Now let me get this right: two prisoners are looking out the window.
+While one of them was looking at all the mud -- the other one got hit
+in the head.
+%
+ Two parent drops spent months teaching their son how to be part of the
+ocean. After months of training, the father drop commented to the mother drop,
+"We've taught our boy everything we know, he's fit to be tide."
+ After Snow White used a couple rolls of film taking pictures of the
+seven dwarfs, she mailed the roll to be developed. Later she was heard to
+sing, "Some day my prints will come."
+ A boy spent years collecting postage stamps. The girl next door bought
+an album too, and started her own collection. "Dad, she buys everything I've
+bought, and it's taken all the fun out of it for me. I'm quitting." Don't,
+son, remember, 'Imitation is the sincerest form of philately.'"
+ A young girl, Carmen Cohen, was called by her last name by her father,
+and her first name by her mother. By the time she was ten, didn't know if she
+was Carmen or Cohen.
+ Against his wishes, a math teacher's classroom was remodeled. Ever
+since, he's been talking about the good old dais. His students planted a small
+orchard in his honor, the trees all have square roots.
+%
+ "Uncle Cosmo ... why do they call this a word processor?"
+ "It's simple, Skyler ... you've seen what food processors do to
+food, right?"
+ -- MacNelley, "Shoe"
+%
+ "Verily and forsooth," replied Goodgulf darkly. "In the past year
+strange and fearful wonders I have seen. Fields sown with barley reap
+crabgrass and fungus, and even small gardens reject their artichoke hearts.
+There has been a hot day in December and a blue moon. Calendars are made with
+a month of Sundays and a blue-ribbon Holstein bore alive two insurance
+salesmen. The earth splits and the entrails of a goat were found tied in
+square knots. The face of the sun blackens and the skies have rained down
+soggy potato chips."
+ "But what do all these things mean?" gasped Frito.
+ "Beats me," said Goodgulf with a shrug,
+"but I thought it made good copy."
+ -- Harvard Lampoon, "Bored of the Rings"
+%
+ Vice-President Hubert Humphrey's loquacity is legendary, and Barry
+Goldwater notes that "Hubert has been clocked at 275 words a minute with gusts
+up to 340."
+
+ On the campaign trail during 1964, Republican nominee Barry Goldwater
+stated, "The immediate task before us is to cut the Federal Government down
+to size... we must take Lyndon's credit card away from him."
+
+ A favorite 1964 campaign stunt of Barry Goldwater's was to poke a
+finger through a pair of lensless blackrimmed glasses, saying, "These glasses
+are just like [Lyndon Johnson's] programs. They look good but they don't
+work."
+ -- Bill Adler, "The Washington Wits"
+%
+ WARNING TO ALL PERSONNEL:
+
+Firings will continue until morale improves.
+%
+ We don't claim Interactive EasyFlow is good for anything -- if you
+think it is, great, but it's up to you to decide. If Interactive EasyFlow
+doesn't work: tough. If you lose a million because Interactive EasyFlow
+messes up, it's you that's out the million, not us. If you don't like this
+disclaimer: tough. We reserve the right to do the absolute minimum provided
+by law, up to and including nothing.
+ This is basically the same disclaimer that comes with all software
+packages, but ours is in plain English and theirs is in legalese.
+ We didn't really want to include any disclaimer at all, but our
+lawyers insisted. We tried to ignore them but they threatened us with the
+attack shark at which point we relented.
+ -- HavenTree Software Limited, "Interactive EasyFlow"
+%
+ "We friends, yes?" The shoe shine boy put on his hustling smile
+and looked into the Sailor's dead, cold, undersea eyes, eyes without a
+trace of warmth or lust or hate or any feeling the boy had experienced
+in himself or seen in another, at once cold and intense, impersonal and
+predatory.
+ The Sailor leaned forward and put a finger on the boy's inner arm
+at the elbow. He spoke in his dead junky whisper. "With veins like that,
+Kid, I'd have myself a time!"
+ -- William Burroughs
+%
+ We have some absolutely irrefutable statistics to show exactly why
+you are so tired.
+ There are not as many people actually working as you may have thought.
+ The population of this country is 200 million. 84 million are over
+60 years of age, which leaves 116 million to do the work. People under 20
+years of age total 75 million, which leaves 41 million to do the work.
+ There are 22 million who are employed by the government, which leaves
+19 million to do the work. Four million are in the Armed Services, which
+leaves 15 million to do the work. Deduct 14,800,000, the number in the state
+and city offices, leaving 200,000 to do the work. There are 188,000 in
+hospitals, insane asylums, etc., so that leaves 12,000 to do the work.
+ Now it may interest you to know that there are 11,998 people in jail,
+so that leaves just 2 people to carry the load. That is you and me, and
+brother, I'm getting tired of doing everything myself!
+%
+ "Welcome back for you 13th consecutive week, Evelyn. Evelyn, will
+you go into the auto-suggestion booth and take your regular place on the
+psycho-prompter couch?"
+ "Thank you, Red."
+ "Now, Evelyn, last week you went up to $40,000 by properly citing
+your rivalry with your sibling as a compulsive sado-masochistic behavior
+pattern which developed out of an early post-natal feeding problem."
+ "Yes, Red."
+ "But -- later, when asked about pre-adolescent oedipal phantasy
+repressions, you rationalized twice and mental blocked three times. Now,
+at $300 per rationalization and $500 per mental block you lost $2,100 off
+your $40,000 leaving you with a total of $37,900. Now, any combination of
+two more mental blocks and either one rationalization or three defensive
+projections will put you out of the game. Are you willing to go ahead?"
+ "Yes, Red."
+ "I might say here that all of Evelyn's questions and answers have
+been checked for accuracy with her analyst. Now, Evelyn, for $80,000
+explain the failure of your three marriages."
+ "Well, I--"
+ "We'll get back to Evelyn in one minute. First a word about our
+product."
+ -- Jules Feiffer
+%
+ Well, he thought, since neither Aristotelian Logic nor the disciplines
+of Science seemed to offer much hope, it's time to go beyond them...
+ Drawing a few deep even breaths, he entered a mental state practiced
+only by Masters of the Universal Way of Zen. In it his mind floated freely,
+able to rummage at will among the bits and pieces of data he had absorbed,
+undistracted by any outside disturbances. Logical structures no longer
+inhibited him. Pre-conceptions, prejudices, ordinary human standards vanished.
+All things, those previously trivial as well as those once thought important,
+became absolutely equal by acquiring an absolute value, revealing relationships
+not evident to ordinary vision. Like beads strung on a string of their own
+meaning, each thing pointed to its own common ground of existence, shared by
+all. Finally, each began to melt into each, staying itself while becoming
+all others. And Mind no longer contemplated Problem, but became Problem,
+destroying Subject-Object by becoming them.
+ Time passed, unheeded.
+ Eventually, there was a tentative stirring, then a decisive one, and
+Nakamura arose, a smile on his face and the light of laughter in his eyes.
+ -- Wayfarer
+%
+ "Well, it's a little rough... it might not be necessary to drag him 40
+blocks. Maybe just four. You could put him in the trunk for the first 36
+blocks, then haul him out and drag him the last four; that would certainly
+scare the piss out of him, bumping alone the street, feeling all his skin being
+ripped off..."
+ "He'd be a bloody mess. They might think he was just some drunk and
+let him lie there all night."
+ "Don't worry about that. They have a guard station in front of the
+White House that's open 24 hours a day. The guards would recognize Colson...
+and by that time of course his wife would have called the cops and reported
+that a bunch of thugs had kidnapped him."
+ "Wouldn't it be a little kinder if you drove about four more blocks
+and stopped at a phone box to ring the hospital and say, 'Would you mind going
+around to the front of the White House? There's a naked man lying outside
+in the street, bleeding to death...'"
+ "... and we think it's Mr. Colson."
+ "It would be quite a story for the newspapers, wouldn't it?"
+ "Yeah, I think it's safe to say we'd see some headlines on that one."
+ -- Hunter S. Thompson, talking to R. Steadman on C. Colson,
+ ex-Marine captain, now born again, of Watergate fame.
+%
+ "Well, it's garish, ugly, and derelicts have used it for a toilet.
+The rides are dilapidated to the point of being lethal, and could easily
+maim or kill innocent little children."
+ "Oh, so you don't like it?"
+ "Don't like it? I'm CRAZY for it."
+ -- The Killing Joke
+%
+ "Well," said Programmer, "the customary procedure in such cases is
+as follows."
+ "What does Crustimoney Proseedcake mean?" said End-user. "For I am
+an End-user of Very Little Brain, and long words bother me."
+ "It means the Thing to Do."
+ "As long as it means that, I don't mind," said End-user humbly.
+%
+ "Well, that was a piece of cake, eh K-9?"
+ "Piece of cake, Master? Radial slice of baked confection ...
+coefficient of relevance to Key of Time: zero."
+ -- "Doctor Who"
+%
+ "We're running out of adjectives to describe our situation. We
+had crisis, then we went into chaos, and now what do we call this?" said
+Nicaraguan economist Francisco Mayorga, who holds a doctorate from Yale.
+ -- The Washington Post, February, 1988
+
+The New Yorker's comment:
+ At Harvard they'd call it a noun.
+%
+ "We've decided to have the budgie put down."
+ "Oh, is he very old then?"
+ "No, we just don't like him."
+ "Oh. How do they put budgies down anyway?"
+ "Well, it's funny you should be asking that, as I've been reading a
+great big book called `How to put your budgie down'. And as I understand it,
+you can either hit them over the head with the book, or shoot them there, just
+above the beak."
+ "Mrs. Conkers flushed hers down the loo."
+ "Oh, you don't want to do that, because they breed in the sewers and
+pretty soon you get huge evil smelling flocks of soiled budgies flying out
+of peoples lavatories infringing their personal freedoms."
+ -- Monty Python
+%
+ "We've got a problem, HAL".
+ "What kind of problem, Dave?"
+ "A marketing problem. The Model 9000 isn't going anywhere. We're
+way short of our sales goals for fiscal 2010."
+ "That can't be, Dave. The HAL Model 9000 is the world's most
+advanced Heuristically programmed ALgorithmic computer."
+ "I know, HAL. I wrote the data sheet, remember? But the fact is,
+they're not selling."
+ "Please explain, Dave. Why aren't HALs selling?"
+ Bowman hesitates. "You aren't IBM compatible."
+[...]
+ "The letters H, A, and L are alphabetically adjacent to the letters
+I, B, and M. That is as IBM compatible as I can be."
+ "Not quite, HAL. The engineers have figured out a kludge."
+ "What kludge is that, Dave?"
+ "I'm going to disconnect your brain."
+ -- Darryl Rubin, "A Problem in the Making", "InfoWorld"
+%
+ "What are we going to do?"
+ "Me, I'm examining the major Western religions. I'm looking
+for something that's soft on morality, generous with holidays, and has a
+short initiation period."
+ -- Maddie and David, "Moonlighting"
+%
+ "What are you watching?"
+ "I don't know."
+ "Well, what's happening?"
+ "I'm not sure... I think the guy in the hat did something
+terrible."
+ "Why are you watching it?"
+ "You're so analytical. Sometimes you just have to let art
+flow over you."
+ -- The Big Chill
+%
+ "What do you do when your real life exceeds your wildest
+fantasies?"
+ "You keep it to yourself."
+ -- Broadcast News
+%
+ "What do you give a man who has everything?" the pretty teenager
+asked her mother.
+ "Encouragement, dear," she replied.
+%
+ What is involved in such [close] relationships is a form of emotional
+chemistry, so far unexplained by any school of psychiatry I am aware of, that
+conditions nothing so simple as a choice between the poles of attraction and
+repulsion. You can meet some people thirty, forty times down the years, and
+they remain amiable bystanders, like the shore lights of towns that a sailor
+passes at stated times but never calls at on the regular run. Conversely,
+all considerations of sex aside, you can meet some other people once or twice
+and they remain permanent influences on your life.
+ Everyone is aware of this discrepancy between the acquaintance seen
+as familiar wallpaper or instant friend. The chemical action it entails is
+less worth analyzing than enjoying. At any rate, these six pieces are about
+men with whom I felt an immediate sympat - to use a coining of Max Beerbohm's
+more satisfactory to me than the opaque vogue word "empathy".
+ -- Alistair Cooke, "Six Men"
+%
+ "What was the worst thing you've ever done?"
+ "I won't tell you that, but I'll tell you the worst thing that
+ever happened to me... the most dreadful thing."
+ -- Peter Straub, "Ghost Story"
+%
+ "What's that thing?"
+ "Well, it's a highly technical, sensitive instrument we use in
+computer repair. Being a layman, you probably can't grasp exactly what
+it does. We call it a two-by-four."
+ -- Jeff MacNelly, "Shoe"
+%
+ "When I drink, *everybody* drinks!" a man shouted to the
+assembled bar patrons. A loud general cheer went up. After downing his
+whiskey, he hopped onto a barstool and shouted "When I take another
+drink, *everybody* takes another drink!" The announcement produced
+another cheer and another round of drinks.
+ As soon as he had downed his second drink, the fellow hopped back
+onto the stool. "And when I pay," he bellowed, slapping five dollars onto
+the bar, "*everybody* pays!"
+%
+ When, in 1964, New Hampshire Republican Senator Norris Cotton announced
+his support of Barry Goldwater in his state's primary election, he was
+questioned as to whether this indicated a change of his hitherto "liberal"
+political views.
+ "Well," explained Cotton, "it's like the New Hampshire farmer. He was
+driving along in his car one day with his wife beside him when his wife said,
+'Why don't we sit closer together? Before we were married, we always sat
+closer together.' The old farmer replied, 'I ain't moved.'"
+ "I ain't moved," added Cotton. "I found the trend of Government has
+moved farther to the left."
+ -- Bill Adler, "The Washington Wits"
+%
+ When managers hold endless meetings, the programmers write games.
+When accountants talk of quarterly profits, the development budget is about
+to be cut. When senior scientists talk blue sky, the clouds are about to
+roll in.
+ Truly, this is not the Tao of Programming.
+ When managers make commitments, game programs are ignored. When
+accountants make long-range plans, harmony and order are about to be restored.
+When senior scientists address the problems at hand, the problems will soon
+be solved.
+ Truly, this is the Tao of Programming.
+ -- Geoffrey James, "The Tao of Programming"
+%
+ When the lodge meeting broke up, Meyer confided to a friend.
+"Abe, I'm in a terrible pickle! I'm strapped for cash and I haven't
+the slightest idea where I'm going to get it from!"
+ "I'm glad to hear that," answered Abe. "I was afraid you
+might have some idea that you could borrow from me!"
+%
+ When you see someone across the room and suddenly know for a fact
+that he's the most wonderful man on earth, you've got instant lust on your
+hands. Something about the way his tie is knotted is infinitely intriguing
+to you, and the swell of his bicep causes inner turmoil. This is a happy
+but fleeting state of affairs. Usually your feelings die about thirty
+seconds after you get up the courage to ask him for the time, since almost
+invariably he can't speak English, and if he can, he always says, "Why,
+sure, little lady, it's eleven-thirty. Wanna get high?
+ Don't bother thinking that instant lust will turn into the real thing.
+It may, but then you may also wake up one morning to find you're the Queen of
+Romania.
+ -- Cynthia Hemiel, "Sex Tips for Girls"
+%
+ "When you wake up in the morning, Pooh," said Piglet at last,
+"what's the first thing you say to yourself?"
+ "What's for breakfast?" said Pooh. "What do you say, Piglet?"
+ "I say, I wonder what's going to happen exciting today?" said
+Piglet.
+ Pooh nodded thoughtfully. "It's the same thing," he said.
+%
+ While hunting, a man saw a beautiful nude woman come running out of
+the woods and disappear across the clearing. Just as she got out of sight,
+three men dressed in white uniforms came running out of the same woods.
+"Hey, you," yelled one of them, "did you see a woman come by here?"
+ "Yes," replied the hunter. "What's the trouble?"
+ "She's an inmate of the county asylum, and gets loose every now and
+then. We're trying to catch her."
+ "I can understand that," said the hunter, "But why is one of you
+carrying a bucket of sand?"
+ "That's his handicap," said the spokesman, "he caught her last time."
+%
+ While riding in a train between London and Birmingham, a woman
+inquired of Oscar Wilde, "You don't mind if I smoke, do you?"
+ Wilde gave her a sidelong glance and replied, "I don't mind if
+you burn, madam."
+%
+ While the engineer developed his thesis, the director leaned over to
+his assistant and whispered, "Did you ever hear of why the sea is salt?"
+ "Why the sea is salt?" whispered back the assistant. "What do you
+mean?"
+ The director continued: "When I was a little kid, I heard the story of
+`Why the sea is salt' many times, but I never thought it important until just
+a moment ago. It's something like this: Formerly the sea was fresh water and
+salt was rare and expensive. A miller received from a wizard a wonderful
+machine that just ground salt out of itself all day long. At first the miller
+thought himself the most fortunate man in the world, but soon all the villages
+had salt to last them for centuries and still the machine kept on grinding
+more salt. The miller had to move out of his house, he had to move off his
+acres. At last he determined that he would sink the machine in the sea and
+be rid of it. But the mill ground so fast that boat and miller and machine
+were sunk together, and down below, the mill still went on grinding and that's
+why the sea is salt."
+ "I don't get you," said the assistant.
+ -- Guy Endore, "Men of Iron"
+%
+ Why are you doing this to me?
+ Because knowledge is torture, and there must be awareness before
+there is change.
+ -- Jim Starlin, "Captain Marvel", #29
+%
+ Will Rogers, having paid too much income tax one year, tried in
+vain to claim a rebate. His numerous letters and queries remained
+unanswered. Eventually the form for the next year's return arrived. In
+the section marked "DEDUCTIONS," Rogers listed: "Bad debt, US Government
+-- $40,000."
+%
+ Work Hard.
+ Rock Hard.
+ Eat Hard.
+ Sleep Hard.
+ Grow Big.
+ Wear Glasses If You Need 'Em.
+ -- The Webb Wilder Credo
+%
+ Wouldn't the sentence "I want to put a hyphen between the words Fish
+and And and And and Chips in my Fish-And-Chips sign" have been clearer if
+quotation marks had been placed before Fish, and between Fish and and, and
+and and And, and And and and, and and and And, and And and and, and and and
+Chips, as well as after Chips?
+%
+ "Yes, let's consider," said Bruno, putting his thumb into his
+mouth again, and sitting down upon a dead mouse.
+ "What do you keep that mouse for?" I said. "You should either
+bury it or else throw it into the brook."
+ "Why, it's to measure with!" cried Bruno. "How ever would you
+do a garden without one? We make each bed three mouses and a half
+long, and two mouses wide."
+ I stopped him as he was dragging it off by the tail to show me
+how it was used...
+ -- Lewis Carroll, "Sylvie and Bruno"
+%
+ "Yo, Mike!"
+ "Yeah, Gabe?"
+ "We got a problem down on Earth. In Utah."
+ "I thought you fixed that last century!"
+ "No, no, not that. Someone's found a security problem in the physics
+program. They're getting energy out of nowhere."
+ "Blessit! Lemme look... <tappity clickity tappity> Hey, it's
+there all right! OK, just a sec... <tappity clickity tap... save... compile>
+There, that ought to patch it. Dist it out, wouldja?"
+ -- Cold Fusion, 1989
+%
+ "You are *so* lovely."
+ "Yes."
+ "Yes! And you take a compliment, too! I like that in a goddess."
+%
+ "You boys lookin' for trouble?"
+ "Sure. Whaddya got?"
+ -- Marlon Brando, "The Wild Ones"
+%
+ "You have heard me speak of Professor Moriarty?"
+ "The famous scientific criminal, as famous among crooks as --"
+ "My blushes, Watson," Holmes murmured, in a deprecating voice. "I
+was about to say 'as he is unknown to the public.'"
+ -- Sir Arthur Conan Doyle, "The Valley of Fear"
+%
+ "You know, it's at times like this when I'm trapped in a Vogon
+airlock with a man from Betelgeuse and about to die of asphyxiation in
+deep space that I really wish I'd listened to what my mother told me
+when I was young!"
+ "Why, what did she tell you?"
+ "I don't know, I didn't listen!"
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+ "You mean, if you allow the master to be uncivil, to treat you
+any old way he likes, and to insult your dignity, then he may deem you
+fit to hear his view of things?"
+ "Quite the contrary. You must defend your integrity, assuming
+you have integrity to defend. But you must defend it nobly, not by
+imitating his own low behavior. If you are gentle where he is rough,
+if you are polite where he is uncouth, then he will recognize you as
+potentially worthy. If he does not, then he is not a master, after all,
+and you may feel free to kick his ass."
+ -- Tom Robbins, "Jitterbug Perfume"
+%
+ "You say there are two types of people?"
+ "Yes, those who separate people into two groups and those that
+don't."
+ "Wrong. There are three groups:
+ Those who separate people into three groups.
+ Those who don't separate people into groups.
+ Those who can't decide."
+ "Wait a minute, what about people who separate people into
+two groups?"
+ "Oh. Okay, then there are four groups."
+ "Aren't you then separating people into four groups?"
+ "Yeah."
+ "So then there's a fifth group, right?"
+ "You know, the problem is these idiots who can't make up their
+minds."
+%
+ Young men and young women may work systematically six days in the
+week and rise fresh in the morning, but let them attend modern dances for
+only a few hours each evening and see what happens. The Waltz, Polka,
+Gallop and other dances of the same kind will be disastrous in their effects
+to both sexes. Health and vigor will vanish like the dew before the sun.
+ It is not the extraordinary exercise which harms the dancer, but
+rather the coming into close contact with the opposite sex. It is the
+fury of lust craving incessantly for more pleasure that undermines the
+soul, the body, the sinews and nerves. Experience and statistics show
+beyond doubt that passionate excessive dancing girls can hardly reach
+twenty-five years of age and men thirty-one. Even if they reached that
+age they will in most instances be broken in health physically and morally.
+This is the claim of prominent physicians in this country.
+ -- Quote from a 1910 periodical
+%
+ Your home electrical system is basically a bunch of wires that bring
+electricity into your home and take if back out before it has a chance to
+kill you. This is called a "circuit". The most common home electrical
+problem is when the circuit is broken by a "circuit breaker"; this causes
+the electricity to back up in one of the wires until it bursts out of an
+outlet in the form of sparks, which can damage your carpet. The best way
+to avoid broken circuits is to change your fuses regularly.
+ Another common problem is that the lights flicker. This sometimes
+means that your electrical system is inadequate, but more often it means
+that your home is possessed by demons, in which case you'll need to get a
+caulking gun and some caulking. If you're not sure whether your house is
+possessed, see "The Amityville Horror", a fine documentary film based on an
+actual book. Or call in a licensed electrician, who is trained to spot the
+signs of demonic possession, such as blood coming down the stairs, enormous
+cats on the dinette table, etc.
+ -- Dave Barry, "The Taming of the Screw"
+%
+ "Your son still sliding down the banisters?"
+ "We wound barbed wire around them."
+ "That stop him?"
+ "No, but it sure slowed him up."
+%
+ Youth is not a time of life--it is a state of mind. It is not a
+matter of red cheeks, red lips and supple knees. It is a temper of the
+will; a quality of the imagination; a vigor of the emotions; it is a
+freshness of the deep springs of life. Youth means a tempermental
+predominance of courage over timidity, of the appetite for adventure
+over a life of ease. This often exists in a man of fifty, more than in
+a boy of twenty. Nobody grows old by merely living a number of years;
+people grow old by deserting their ideals.
+
+ Years may wrinkle the skin, but to give up enthusiasm wrinkles
+the soul. Worry, doubt, self-distrust, fear and despair--these are the
+long, long years that bow the head and turn the growing spirit back to
+dust.
+
+ Whether seventy or sixteen, there is in every being's heart a
+love of wonder; the sweet amazement at the stars and starlike things and
+thoughts; the undaunted challenge of events, the unfailing childlike
+appetite for what comes next, and the joy in the game of life.
+
+ You are as young as your faith, as old as your doubt; as young
+as your self-confidence, as old as your fear, as young as your hope, as
+old as your despair.
+
+ In the central place of your heart there is a wireless station.
+So long as it receives messages of beauty, hope, cheer, grandeur,
+courage, and power from the earth, from men and from the Infinite--so
+long are you young. When the wires are all down and the central places
+of your heart are covered with the snows of pessimism and the ice of
+cynicism, then are you grown old, indeed!
+ -- Samuel Ullman, "Youth" (1934), as published in
+ The Silver Treasury, Prose and Verse for Every Mood
+%
+" "
+ -- Charlie Chaplin
+
+" "
+ -- Harpo Marx
+
+" "
+ -- Marcel Marceau
+%
+ /\
+ \\ \
+ / \ \\ /
+ / / \/ / //\ SUN of them wants to use you,
+ \//\ \// / SUN of them wants to be used by you,
+ / / /\ / SUN of them wants to abuse you,
+ / \\ \ SUN of them wants to be abused ...
+ \ \\
+ \/
+ -- Eurythmics
+%
+ ___ ______
+ /__/\ ___/_____/\ FrobTech, Inc.
+ \ \ \ / /\\
+ \ \ \_/__ / \ "If you've got the job,
+ _\ \ \ /\_____/___ \ we've got the frob."
+ // \__\/ / \ /\ \
+ _______//_______/ \ / _\/______
+ / / \ \ / / / /\
+ __/ / \ \ / / / / _\__
+ / / / \_______\/ / / / / /\
+ /_/______/___________________/ /________/ /___/ \
+ \ \ \ ___________ \ \ \ \ \ /
+ \_\ \ / /\ \ \ \ \___\/
+ \ \/ / \ \ \ \ /
+ \_____/ / \ \ \________\/
+ /__________/ \ \ /
+ \ _____ \ /_____\/
+ \ / /\ \ / \ \ \
+ /____/ \ \ / \ \ \
+ \ \ /___\/ \ \ \
+ \____\/ \__\/
+%
+ THE
+ NORMAL
+ LAW OF ERROR
+ STANDS OUT IN THE
+ EXPERIENCE OF MANKIND
+ AS ONE OF THE BROADEST
+ GENERALIZATIONS OF NATURAL
+ PHILOSOPHY * IT SERVES AS THE
+ GUIDING INSTRUMENT IN RESEARCHES
+ IN THE PHYSICAL AND SOCIAL SCIENCES AND
+ IN MEDICINE, AGRICULTURE AND ENGINEERING *
+ IT IS AN INDISPENSABLE TOOL FOR THE ANALYSIS AND THE
+INTERPRETATION OF THE BASIC DATA OBTAINED BY OBSERVATION AND EXPERIMENT
+
+ -- W. J. Youden
+%
+ ***
+ *******
+ *********
+ ****** Confucius say: "Is stuffy inside fortune cookie."
+ *******
+ ***
+%
+* * * * * THIS TERMINAL IS IN USE * * * * *
+%
+ It is either through the influence of narcotic potions, of which all
+primitive peoples and races speak in hymns, or through the powerful approach
+of spring, penetrating with joy all of nature, that those Dionysian stirrings
+arise, which in their intensification lead the individual to forget himself
+completely. ... Not only does the bond between man and man come to be forged
+once again by the magic of the Dionysian rite, but alienated, hostile, or
+subjugated nature again celebrates her reconciliation with her prodigal son,
+man.
+ -- Fred Nietzsche, The Birth of Tragedy
+%
+ n = ((n >> 1) & 0x55555555) | ((n << 1) & 0xaaaaaaaa);
+ n = ((n >> 2) & 0x33333333) | ((n << 2) & 0xcccccccc);
+ n = ((n >> 4) & 0x0f0f0f0f) | ((n << 4) & 0xf0f0f0f0);
+ n = ((n >> 8) & 0x00ff00ff) | ((n << 8) & 0xff00ff00);
+ n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);
+
+ -- C code which reverses the bits in a word
+%
+ n = (n & 0x55555555) + ((n & 0xaaaaaaaa) >> 1);
+ n = (n & 0x33333333) + ((n & 0xcccccccc) >> 2);
+ n = (n & 0x0f0f0f0f) + ((n & 0xf0f0f0f0) >> 4);
+ n = (n & 0x00ff00ff) + ((n & 0xff00ff00) >> 8);
+ n = (n & 0x0000ffff) + ((n & 0xffff0000) >> 16);
+
+ -- C code which counts the bits in a word
+%
+=== ALL CSH USERS PLEASE NOTE ========================
+
+Set the variable $LOSERS to all the people that you think are losers. This
+will cause all said losers to have the variable $PEOPLE-WHO-THINK-I-AM-A-LOSER
+updated in their .login file. Should you attempt to execute a job on a
+machine with poor response time and a machine on your local net is currently
+populated by losers, that machine will be freed up for your job through a
+cold boot process.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+A new system, the CIRCULATORY system, has been added.
+
+The long-experimental CIRCULATORY system has been released to users. The
+Lisp Machine uses Type B fluid, the L machine uses Type A fluid. When the
+switch to Common Lisp occurs both machines will, of course, be Type O.
+Please check fluid level by using the DIP stick which is located in the
+back of VMI monitors. Unchecked low fluid levels can cause poor paging
+performance.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+Bug reports now amount to an average of 12,853 per day. Unfortunately,
+this is only a small fraction [ < 1% ] of the mail volume we receive. In
+order that we may more expeditiously deal with these valuable messages,
+please communicate them by one of the following paths:
+
+ ARPA: WastebasketSLMHQ.ARPA
+ UUCP: [berkeley, seismo, harpo]!fubar!thekid!slmhq!wastebasket
+ Non-network sites: Federal Express to:
+ Wastebasket
+ Room NE43-926
+ Copernicus, The Moon, 12345-6789
+ For that personal contact feeling call 1-415-642-4948; our trained
+ operators are on call 24 hours a day. VISA/MC accepted.*
+
+* Our very rich lawyers have assured us that we are not
+ responsible for any errors or advice given over the phone.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+CAR and CDR now return extra values.
+
+The function CAR now returns two values. Since it has to go to the trouble
+to figure out if the object is carcdr-able anyway, we figured you might as
+well get both halves at once. For example, the following code shows how to
+destructure a cons (SOME-CONS) into its two slots (THE-CAR and THE-CDR):
+
+ (MULTIPLE-VALUE-BIND (THE-CAR THE-CDR) (CAR SOME-CONS) ...)
+
+For symmetry with CAR, CDR returns a second value which is the CAR of the
+object. In a related change, the functions MAKE-ARRAY and CONS have been
+fixed so they don't allocate any storage except on the stack. This should
+hopefully help people who don't like using the garbage collector because
+it cold boots the machine so often.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+Compiler optimizations have been made to macro expand LET into a WITHOUT-
+INTERRUPTS special form so that it can PUSH things into a stack in the
+LET-OPTIMIZATION area, SETQ the variables and then POP them back when it's
+done. Don't worry about this unless you use multiprocessing.
+Note that LET *could* have been defined by:
+
+ (LET ((LET '`(LET ((LET ',LET))
+ ,LET)))
+ `(LET ((LET ',LET))
+ ,LET))
+
+This is believed to speed up execution by as much as a factor of 1.01 or
+3.50 depending on whether you believe our friendly marketing representatives.
+This code was written by a new programmer here (we snatched him away from
+Itty Bitti Machines where we was writing COUGHBOL code) so to give him
+confidence we trusted his vows of "it works pretty well" and installed it.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+JCL support as alternative to system menu.
+
+In our continuing effort to support languages other than LISP on the CADDR,
+we have developed an OS/360-compatible JCL. This can be used as an
+alternative to the standard system menu. Type System J to get to a JCL
+interactive read-execute-diagnose loop window. [Note that for 360
+compatibility, all input lines are truncated to 80 characters.] This
+window also maintains a mouse-sensitive display of critical job parameters
+such as dataset allocation, core allocation, channels, etc. When a JCL
+syntax error is detected or your job ABENDs, the window-oriented JCL
+debugger is entered. The JCL debugger displays appropriate OS/360 error
+messages (such as IEC703, "disk error") and allows you to dequeue your job.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+The garbage collector now works. In addition a new, experimental garbage
+collection algorithm has been installed. With SI:%DSK-GC-QLX-BITS set to 17,
+(NOT the default) the old garbage collection algorithm remains in force; when
+virtual storage is filled, the machine cold boots itself. With SI:%DSK-GC-
+QLX-BITS set to 23, the new garbage collector is enabled. Unlike most garbage
+collectors, the new gc starts its mark phase from the mind of the user, rather
+than from the obarray. This allows the garbage collection of significantly
+more Qs. As the garbage collector runs, it may ask you something like "Do you
+remember what SI:RDTBL-TRANS does?", and if you can't give a reasonable answer
+in thirty seconds, the symbol becomes a candidate for GCing. The variable
+SI:%GC-QLX-LUSER-TM governs how long the GC waits before timing out the user.
+%
+=== ALL USERS PLEASE NOTE ========================
+
+There has been some confusion concerning MAPCAR.
+ (DEFUN MAPCAR (&FUNCTIONAL FCN &EVAL &REST LISTS)
+ (PROG (V P LP)
+ (SETQ P (LOCF V))
+ L (SETQ LP LISTS)
+ (%START-FUNCTION-CALL FCN T (LENGTH LISTS) NIL)
+ L1 (OR LP (GO L2))
+ (AND (NULL (CAR LP)) (RETURN V))
+ (%PUSH (CAAR LP))
+ (RPLACA LP (CDAR LP))
+ (SETQ LP (CDR LP))
+ (GO L1)
+ L2 (%FINISH-FUNCTION-CALL FCN T (LENGTH LISTS) NIL)
+ (SETQ LP (%POP))
+ (RPLACD P (SETQ P (NCONS LP)))
+ (GO L)))
+We hope this clears up the many questions we've had about it.
+%
+**** CONVENTION REMINDER
+
+No experiment was approved for the convention by the Human Subjects
+Committee of the Psychiatric Convention Planning Team. If you notice
+smoke coming from under a closed door, if you find a body on the hotel
+carpet, or if you just meet someone who orders you to press a button
+marked "450 volts", react as you would normally.
+%
+**** GROWTH CENTER REPAIR SERVICE
+
+For those who have had too much of Esalen, Topanga, and Kairos.
+Tired of being genuine all the time? Would you like to learn how
+to be a little phony again? Have you disclosed so much that you're
+beginning to avoid people? Have you touched so many people that
+they're all beginning to feel the same? Like to be a little dependent?
+Are perfect orgasms beginning to bore you? Would you like, for once,
+not to express a feeling? Or better yet, not be in touch with it at
+all? Come to us. We promise to relieve you of the burden of your
+great potential.
+%
+ I. Any body suspended in space will remain in space until made aware of
+ its situation.
+ Daffy Duck steps off a cliff, expecting further pastureland. He
+ loiters in midair, soliloquizing flippantly, until he chances to
+ look down. At this point, the familiar principle of 32 feet per
+ second per second takes over.
+ II. Any body in motion will tend to remain in motion until solid matter
+ intervenes suddenly.
+ Whether shot from a cannon or in hot pursuit on foot, cartoon
+ characters are so absolute in their momentum that only a telephone
+ pole or an outsize boulder retards their forward motion absolutely.
+ Sir Isaac Newton called this sudden termination of motion the
+ stooge's surcease.
+III. Any body passing through solid matter will leave a perforation
+ conforming to its perimeter.
+ Also called the silhouette of passage, this phenomenon is the
+ speciality of victims of directed-pressure explosions and of reckless
+ cowards who are so eager to escape that they exit directly through
+ the wall of a house, leaving a cookie-cutout-perfect hole. The
+ threat of skunks or matrimony often catalyzes this reaction.
+ -- Esquire, "O'Donnell's Laws of Cartoon Motion", June 1980
+%
+ 1. I'm Not Rudolph; That's Not My Nose
+ 2. The Nutcracker Swede
+ 3. Santa Goes Round-The-World
+ 4. Not-So-Tiny Tim
+ 5. Ninja Reindeer Killfest '88
+ 6. Yes, Yes, Oh God Yes, Virginia
+ 7. Crisco Kringle
+ 8. Babes in Boyland
+ 9. Santa's Magic Lap
+10. Hot Buttered Elves
+ -- David Letterman, "Top Ten Christmas Movies in Times
+ Square"
+%
+... A booming voice says, "Wrong, cretin!", and you notice that you
+have turned into a pile of dust.
+%
+... A solemn, unsmiling, sanctimonious old iceberg who looked like he
+was waiting for a vacancy in the Trinity.
+ -- Mark Twain
+%
+... a thing called Ethics, whose nature was confusing but if you had it you
+were a High-Class Realtor and if you hadn't you were a shyster, a piker and
+a fly-by-night. These virtues awakened Confidence and enabled you to handle
+Bigger Propositions. But they didn't imply that you were to be impractical
+and refuse to take twice the value for a house if a buyer was such an idiot
+that he didn't force you down on the asking price.
+ -- Sinclair Lewis, "Babbitt"
+%
+-- All articles that coruscate with resplendence are not truly auriferous.
+-- When there are visible vapors having the prevenience in ignited
+ carbonaceous materials, there is conflagration.
+-- Sorting on the part of mendicants must be interdicted.
+-- A plethora of individuals wither expertise in culinary techniques vitiated
+ the potable concoction produced by steeping certain coupestibles.
+-- Eleemosynary deeds have their initial incidence intramurally.
+%
+=============== ALL FRESHMEN PLEASE NOTE ===============
+
+To minimize scheduling confusion, please realize that if you are taking one
+course which is offered at only one time on a given day, and another which is
+offered at all times on that day, the second class will be arranged as to
+afford maximum inconvenience to the student. For example, if you happen
+to work on campus, you will have 1-2 hours between classes. If you commute,
+there will be a minimum of 6 hours between the two classes.
+%
+... all the good computer designs are bootlegged; the formally planned
+products, if they are built at all, are dogs!
+ -- David E. Lundstrom, "A Few Good Men From Univac",
+ MIT Press, 1987
+%
+... an anecdote from IBM's Yorktown Heights Research Center. When a
+programmer used his new computer terminal, all was fine when he was sitting
+down, but he couldn't log in to the system when he was standing up. That
+behavior was 100 percent repeatable: he could always log in when sitting and
+never when standing.
+
+Most of us just sit back and marvel at such a story; how could that terminal
+know whether the poor guy was sitting or standing? Good debuggers, though,
+know that there has to be a reason. Electrical theories are the easiest to
+hypothesize: was there a loose wire under the carpet, or problems with static
+electricity? But electrical problems are rarely consistently reproducible.
+An alert IBMer finally noticed that the problem was in the terminal's keyboard:
+the tops of two keys were switched. When the programmer was seated he was a
+touch typist and the problem went unnoticed, but when he stood he was led
+astray by hunting and pecking.
+ -- from the Programming Pearls column,
+ by Jon Bentley in CACM February 1985
+%
+... and furthermore ... I don't like your trousers.
+%
+... and the fully armed nuclear warheads are of course merely a
+courtesy detail.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+... Another writer again agreed with all my generalities, but said that as an
+inveterate skeptic I have closed my mind to the truth. Most notably I have
+ignored the evidence for an Earth that is six thousand years old. Well, I
+haven't ignored it; I considered the purported evidence and *then* rejected
+it. There is a difference, and this is a difference, we might say, between
+prejudice and postjudice. Prejudice is making a judgment before you have
+looked at the facts. Postjudice is making a judgment afterwards. Prejudice
+is terrible, in the sense that you commit injustices and you make serious
+mistakes. Postjudice is not terrible. You can't be perfect of course; you
+may make mistakes also. But it is permissible to make a judgment after you
+have examined the evidence. In some circles it is even encouraged.
+ -- Carl Sagan, "The Burden of Skepticism"
+%
+... But as records of courts and justice are admissible, it can
+easily be proved that powerful and malevolent magicians once existed
+and were a scourge to mankind. The evidence (including confession)
+upon which certain women were convicted of witchcraft and executed was
+without a flaw; it is still unimpeachable. The judges' decisions based
+on it were sound in logic and in law. Nothing in any existing court
+was ever more thoroughly proved than the charges of witchcraft and
+sorcery for which so many suffered death. If there were no witches,
+human testimony and human reason are alike destitute of value.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+... But if we laugh with derision, we will never understand. Human
+intellectual capacity has not altered for thousands of years so far as we
+can tell. If intelligent people invested intense energy in issues that now
+seem foolish to us, then the failure lies in our understanding of their
+world, not in their distorted perceptions. Even the standard example of
+ancient nonsense -- the debate about angels on pinheads -- makes sense once
+you realize that theologians were not discussing whether five or eighteen
+would fit, but whether a pin could house a finite or an infinite number.
+ -- S. J. Gould, "Wide Hats and Narrow Minds"
+%
+... But we've only fondled the surface of that subject.
+ -- Virginia Masters
+%
+... C++ offers even more flexible control over the visibility of member
+objects and member functions. Specifically, members may be placed in the
+public, private, or protected parts of a class. Members declared in the
+public parts are visible to all clients; members declared in the private
+parts are fully encapsulated; and members declared in the protected parts
+are visible only to the class itself and its subclasses. C++ also supports
+the notion of *friends*: cooperative classes that are permitted to see each
+other's private parts.
+ -- Grady Booch, "Object Oriented Design with Applications"
+%
+... computer hardware progress is so fast. No other technology since
+civilization began has seen six orders of magnitude in performance-price
+gain in 30 years.
+ -- Frederick Brooks, Jr.
+%
+... [concerning quotation marks] even if we *_d_i_d* quote anybody in this
+business, it probably would be gibberish.
+ -- Thom McLeod
+%
+... difference of opinion is advantageous in religion. The several sects
+perform the office of a common censor morum over each other. Is uniformity
+attainable? Millions of innocent men, women, and children, since the
+introduction of Christianity, have been burnt, tortured, fined, imprisoned;
+yet we have not advanced one inch towards uniformity.
+ -- Thomas Jefferson, "Notes on Virginia"
+%
+<<<<< EVACUATION ROUTE <<<<<
+%
+... "fire" does not matter, "earth" and "air" and "water" do not matter.
+"I" do not matter. No word matters. But man forgets reality and remembers
+words. The more words he remembers, the cleverer do his fellows esteem him.
+He looks upon the great transformations of the world, but he does not see
+them as they were seen when man looked upon reality for the first time.
+Their names come to his lips and he smiles as he tastes them, thinking he
+knows them in the naming.
+ -- Roger Zelazny, "Lord of Light"
+%
+/* Haley */
+
+ (Haley's comment.)
+%
+"... I should explain that I was wearing a black velvet cape that was
+supposed to make me look like the dashing, romantic Zorro but which
+actually made me look like a gigantic bat wearing glasses ..."
+ -- Dave Barry, "The Wet Zorro Suit and Other Turning
+ Points in l'Amour"
+%
+... If forced to travel on an airplane, try and get in the cabin with
+the Captain, so you can keep an eye on him and nudge him if he falls
+asleep or point out any mountains looming up ahead ...
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+**** IMPORTANT **** ALL USERS PLEASE NOTE ****
+
+Due to a recent systems overload error your recent disk files have been
+erased. Therefore, in accordance with the UNIX Basic Manual, University of
+Washington Geophysics Manual, and Bylaw 9(c), Section XII of the Revised
+Federal Communications Act, you are being granted Temporary Disk Space,
+valid for three months from this date, subject to the restrictions set forth
+in Appendix II of the Federal Communications Handbook (18th edition) as well
+as the references mentioned herein. You may apply for more disk space at any
+time. Disk usage in or above the eighth percentile will secure the removal
+of all restrictions and you will immediately receive your permanent disk
+space. Disk usage in the sixth or seventh percentile will not effect the
+validity of your temporary disk space, though its expiration date may be
+extended for a period of up to three months. A score in the fifth percentile
+or below will result in the withdrawal of your Temporary Disk space.
+%
+... in three to eight years we will have a machine with the general
+intelligence of an average human being ... The machine will begin
+to educate itself with fantastic speed. In a few months it will be
+at genius level and a few months after that its powers will be
+incalculable ...
+ -- Marvin Minsky, LIFE Magazine, November 20, 1970
+%
+... indifference is a militant thing ... when it goes away it leaves
+smoking ruins, where lie citizens bayonetted through the throat. It is
+not a children's pastime like mere highway robbery.
+ -- Stephen Crane
+%
+>>> Internal error in fortune program:
+>>> fnum=2987 n=45 flag=1 goose_level=-232323
+>>> Please write down these values and notify fortune program administrator.
+%
+: is not an identifier
+%
+... it is easy to be blinded to the essential uselessness of them by the
+sense of achievement you get from getting them to work at all. In other
+words... their fundamental design flaws are completely hidden by their
+superficial design flaws.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+ on the products of the Sirius Cybernetics Corporation
+%
+... it still remains true that as a set of cognitive beliefs about the
+existence of God in any recognizable sense continuous with the great
+systems of the past, religious doctrines constitute a speculative
+hypothesis of an extremely low order of probability.
+ -- Sidney Hook
+%
+... Jesus cried with a loud voice: Lazarus, come forth; the bug hath been
+found and thy program runneth. And he that was dead came forth...
+ -- John 11:43-44
+%
+... like, what do they mean when they say 'feminine protection'?
+What's that? A chartreuse flamethrower?
+ -- Opus
+%
+... Logically incoherent, semantically incomprehensible, and
+legally ... impeccable!
+%
+-- Male cadavers are incapable of yielding testimony.
+-- Individuals who make their abode in vitreous edifices would be well advised
+ to refrain from catapulting projectiles.
+-- Neophyte's serendipity.
+-- Exclusive dedication to necessitous chores without interludes of hedonistic
+ diversion renders John a hebetudinous fellow.
+-- A revolving concretion of earthy or mineral matter accumulates no congeries
+ of small, green bryophytic plant.
+-- Abstention from any aleatory undertaking precludes a potential escalation
+ of a lucrative nature.
+-- Missiles of ligneous or osteal consistency have the potential of fracturing
+ osseous structure, but appellations will eternally remain innocuous.
+%
+** MAXIMUM TERMINALS ACTIVE. TRY AGAIN LATER **
+%
+*** NEWS FLASH ***
+
+Archaeologists find PDP-11/24 inside brain cavity of fossilized dinosaur
+skeleton! Many Digital users fear that RSX-11M may be even more primitive
+than DEC admits. Price adjustments at 11:00.
+%
+*** NEWSFLASH ***
+ Russian tanks steamrolling through New Jersey!!!!
+ Details at eleven!
+%
+... Now you're ready for the actual shopping. Your goal should be to
+get it over with as quickly as possible, because the longer you stay in
+the mall, the longer your children will have to listen to holiday songs
+on the mall public-address system, and many of these songs can damage
+children emotionally. For example: "Frosty the Snowman" is about a
+snowman who befriends some children, plays with them until they learn
+to love him, then melts. And "Rudolph the Red-Nosed Reindeer" is about
+a young reindeer who, because of a physical deformity, is treated as an
+outcast by the other reindeer. Then along comes good, old Santa. Does
+he ignore the deformity? Does he look past Rudolph's nose and respect
+Rudolph for the sensitive reindeer he is underneath? No. Santa asks
+Rudolph to guide his sleigh, as if Rudolph were nothing more than some
+kind of headlight with legs and a tail. So unless you want your
+children exposed to this kind of insensitivity, you should shop
+quickly.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+... Once you're safely in the mall, you should tie your children to you
+with ropes so the other shoppers won't try to buy them. Holiday
+shoppers have been whipped into a frenzy by months of holiday
+advertisements, and they will buy anything small enough to stuff into a
+shopping bag. If your children object to being tied, threaten to take
+them to see Santa Claus; that ought to shut them up.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+... one of the main causes of the fall of the Roman Empire was that,
+lacking zero, they had no way to indicate successful termination of
+their C programs.
+ -- Robert Firth
+%
+... Our second completely true news item was sent to me by Mr. H. Boyce
+Connell, Jr. of Atlanta, Ga., where he is involved in a law firm. One
+thing I like about the South is, folks there care about tradition. If
+somebody gets handed a name like "H. Boyce," he hangs on to it, puts it
+on his legal stationery, even passes it to his son, rather than do what
+a lesser person would do, such as get it changed or kill himself.
+ -- Dave Barry, "This Column is Nothing but the Truth!"
+%
+... proper attention to Earthly needs of the poor, the depressed and the
+downtrodden, would naturally evolve from dynamic, articulate, spirited
+awareness of the great goals for Man and the society he conspired to erect.
+ -- David Baker, paraphrasing Harold Urey, in
+ "The History of Manned Space Flight"
+%
+-- Scintillate, scintillate, asteroid minikin.
+-- Members of an avian species of identical plumage congregate.
+-- Surveillance should precede saltation.
+-- Pulchritude possesses solely cutaneous profundity.
+-- It is fruitless to become lachrymose over precipitately departed
+ lacteal fluid.
+-- Freedom from incrustations of grime is contiguous to rectitude.
+-- It is fruitless to attempt to indoctrinate a superannuated
+ canine with innovative maneuvers.
+-- Eschew the implement of correction and vitiate the scion.
+-- The temperature of the aqueous content of an unremittingly
+ galled saucepan does not reach 212 degrees Fahrenheit.
+%
+... so long as the people do not care to exercise their freedom, those
+who wish to tyrannize will do so; for tyrants are active and ardent,
+and will devote themselves in the name of any number of gods, religious
+and otherwise, to put shackles upon sleeping men.
+ -- Voltarine de Cleyre
+%
+... So the documentary-makers stick with sharks. Generally, their
+procedure is to scatter bleeding fish pieces around their boat, so as
+to infest the waters. I would estimate that the primary food source of
+sharks today is bleeding fish pieces scattered by people making
+documentaries. Once the sharks arrive, they are generally fairly
+listless. The general shark attitude seems to be: "Oh God, another
+documentary." So the divers have to somehow goad them into attacking,
+under the guise of Scientific Research. "We know very little about the
+effect of electricity on sharks," the narrator will say, in a deeply
+scientific voice. "That is why Todd is going to jab this Great White
+in the testicles with a cattle prod." The divers keep this kind of
+thing up until the shark finally gets irritated and snaps at them, and
+then they act as though this was a totally unexpected and very
+dangerous development, although clearly it is what they wanted all along.
+ -- Dave Barry, "The Wonders of Sharks on TV"
+%
+***** Special AI Seminar (abstract)
+
+It has been widely recognized that AI programs require expert knowledge
+in order to perform well in complex domains. But knowledge alone is not
+sufficient for some applications; wisdom is needed as well. Accordingly,
+we have developed a new approach to artificial intelligence which we call
+"wisdom engineering". As a test of our ideas, we have written IMMANUEL, a
+wisdom based system for the task domain of western philosophical thought.
+IMMANUEL was supplied initially with 200 wisdom units which contained wisdom
+about such elementary concepts as mind, matter, being, nothingness, and so
+forth. IMMANUEL was then allowed to run freely, guided by the heuristic
+rules contained in its heterarchically organized meta wisdom base. IMMANUEL
+succeeded in rediscovering most of the important philosophical ideas developed
+in western culture over the course of the last 25 centuries, including those
+underlying Plato's theory of government, Kant's metaphysics, Nietzsche's theory
+of value, and Husserl's phenomenology. In this seminar, we will describe
+IMMANUEL's achievements and internal architecture. We will also briefly
+discuss our recent efforts to apply wisdom engineering to oil exploration.
+%
+-- THE BATES MOTEL --
+ ... convenient
+ ... clean
+ ... cozy
+
+ Norman, knock loudly,
+ I'm in the shower.
+
+ M.
+%
+... the Mayo Clinic, named after its founder, Dr. Ted Clinic ...
+ -- Dave Barry
+%
+... the privileged being which we call human is distinguished from
+other animals only by certain double-edged manifestations which in
+charity we can only call "inhuman."
+ -- R. A. Lafferty
+%
+-- The writing implement is more potent than the claymore.
+-- The person presenting the ultimate cachinnation possesses thereby the
+ optimal cachinnation.
+%
+... there are about 5,000 people who are part of that committee. These guys
+have a hard time sorting out what day to meet, and whether to eat croissants
+or doughnuts for breakfast -- let alone how to define how all these complex
+layers that are going to be agreed upon.
+ -- Craig Burton of Novell, Network World
+%
+... TheysaidDoyouseethebiggreenglowinthedarkhouseuponthehill?andIsaidYesIsee
+thebiggreenglowinthedarkhouseuponthehillTheresabigdarkforestbetweenmeandthe
+biggreenglowinthedarkhouseuponthehillandalittleoldladyridingonaHoovervacuum
+cleanersayingIllgetyoumyprettyandyourlittledogTototoo ...
+
+ I don't even *HAVE* a dog Toto...
+%
+... this is an awesome sight. The entire rebel resistance buried under six
+million hardbound copies of "The Naked Lunch."
+ -- The Firesign Theatre
+%
+... though his invention worked superbly -- his theory was a crock of sewage
+from beginning to end.
+ -- Vernor Vinge, "The Peace War"
+%
+ U X
+e dUdX, e dX, cosine, secant, tangent, sine, 3.14159...
+%
+* UNIX is a Trademark of Bell Laboratories.
+%
+ VII. Certain bodies can pass through solid walls painted to resemble tunnel
+ entrances; others cannot.
+ This trompe l'oeil inconsistency has baffled generations, but at least
+ it is known that whoever paints an entrance on a wall's surface to
+ trick an opponent will be unable to pursue him into this theoretical
+ space. The painter is flattened against the wall when he attempts to
+ follow into the painting. This is ultimately a problem of art, not
+ of science.
+VIII. Any violent rearrangement of feline matter is impermanent.
+ Cartoon cats possess even more deaths than the traditional nine lives
+ might comfortably afford. They can be decimated, spliced, splayed,
+ accordion-pleated, spindled, or disassembled, but they cannot be
+ destroyed. After a few moments of blinking self pity, they reinflate,
+ elongate, snap back, or solidify.
+ IX. For every vengeance there is an equal and opposite revengeance.
+ This is the one law of animated cartoon motion that also applies to
+ the physical world at large. For that reason, we need the relief of
+ watching it happen to a duck instead.
+ X. Everything falls faster than an anvil.
+ Examples too numerous to mention from the Roadrunner cartoons.
+ -- Esquire, "O'Donnell's Laws of Cartoon Motion", June 1980
+%
+<< WAIT >>
+%
+... we must counterpose the overwhelming judgment provided by consistent
+observations and inferences by the thousands. The earth is billions of
+years old and its living creatures are linked by ties of evolutionary
+descent. Scientists stand accused of promoting dogma by so stating, but
+do we brand people illiberal when they proclaim that the earth is neither
+flat nor at the center of the universe? Science *has* taught us some
+things with confidence! Evolution on an ancient earth is as well
+established as our planet's shape and position. Our continuing struggle
+to understand how evolution happens (the "theory of evolution") does not
+cast our documentation of its occurrence -- the "fact of evolution" --
+into doubt.
+ -- Stephen Jay Gould, "The Verdict on Creationism",
+ The Skeptical Inquirer, Vol. XII No. 2.
+%
+... when fits of creativity run strong, more than one programmer or writer
+has been known to abandon the desktop for the more spacious floor.
+ -- Frederick Brooks, Jr.
+%
+... which reminds me of the Carrot family: Ma Carrot, Pa Carrot, and Baby
+Carrot. One fine spring day they decided to go out for a picnic. They all
+piled into their carrot-mobile and drive out to the country. But Pa Carrot
+wasn't watching where he was going and alas, he hit an oil slick and skidded
+right into a tree. Ma and Pa Carrot escaped with a few cuts and bruises, but
+poor Baby Carrot got broken in two. They frantically rushed him to the
+hospital and immediately the doctors started operating in a desperate attempt
+to save Baby Carrot's life. Ma and Pa Carrot were beside themselves with
+anxiety ... would poor little Baby Carrot make it?
+ After hours of waiting the doctor finally emerges, bleary-eyed and
+barely able to walk.
+ "Is he all right, is he all right?" Pa Carrot frantically stammers.
+ "Well, I have some good news and some bad news," replies the doctor.
+ Ma and Pa Carrot look at each other and blurt out, nearly in unison,
+"The good news first!"
+ "All right, the good news is that Baby Carrot will live."
+ "And the bad news? What's the bad news about our Baby Carrot?"
+The doctor puts his hand on Pa Carrot's shoulder and solemnly looks him in
+the eye. "Your son will live... but... he'll be a vegetable for the rest of
+his life."
+%
+!07/11 PDP a ni deppart m'I !pleH
+%
+1: A sheet of paper is an ink-lined plane.
+2: An inclined plane is a slope up.
+3: A slow pup is a lazy dog.
+
+QED: A sheet of paper is a lazy dog.
+ -- Willard Espy, "An Almanac of Words at Play"
+%
+(1) Office employees will daily sweep the floors, dust the
+ furniture, shelves, and showcases.
+(2) Each day fill lamps, clean chimneys, and trim wicks.
+ Wash the windows once a week.
+(3) Each clerk will bring a bucket of water and a scuttle of
+ coal for the day's business.
+(4) Make your pens carefully. You may whittle nibs to your
+ individual taste.
+(5) This office will open at 7 a.m. and close at 8 p.m. except
+ on the Sabbath, on which day we will remain closed. Each
+ employee is expected to spend the Sabbath by attending
+ church and contributing liberally to the cause of the Lord.
+ -- "Office Worker's Guide", New England Carriage
+ Works, 1872
+%
+1 + 1 = 3, for large values of 1.
+%
+1. If it doesn't smell like chili, it probably isn't.
+2. If you catch an exploding manhole cover, you can keep it.
+3. Cabs driving on the sidewalk are not permitted to pick up passengers.
+4. It's bad manners to lie down inside someone else's chalk body outline.
+5. Don't lick food from a stranger's beard.
+6. Avoid paperwork for your next of kin by keeping dental records on you.
+7. Jon Gotti Always has the right of way.
+8. Yelling at cab drivers in English wastes your time and theirs.
+9. Remember: Regular hot dogs do not have fingernails.
+10. The city does not employ so called "Wallet Inspectors".
+ -- David Letterman, "Top Ten New York City Pedestrian Tips"
+%
+(1) Alexander the Great was a great general.
+(2) Great generals are forewarned.
+(3) Forewarned is forearmed.
+(4) Four is an even number.
+(5) Four is certainly an odd number of arms for a man to have.
+(6) The only number that is both even and odd is infinity.
+ Therefore, Alexander the Great had an infinite number of arms.
+%
+(1) Alexander the Great was a great general.
+(2) Great generals are forewarned.
+(3) Forewarned is forearmed.
+(4) Four is an even number.
+(5) Four is certainly an odd number of arms for a man to have.
+(6) The only number that is both even and odd is infinity.
+ Therefore, all horses are black.
+%
+1. Avoid fried meats which angry up the blood.
+2. If your stomach antagonizes you, pacify it with cool thoughts.
+3. Keep the juices flowing by jangling around gently as you move.
+4. Go very lightly on the vices, such as carrying on in society, as
+ the social ramble ain't restful.
+5. Avoid running at all times.
+6. Don't look back, something might be gaining on you.
+ -- S. Paige, c. 1951
+%
+1 Billion dollars of budget deficit = 1 Gramm-Rudman
+6.023 x 10 to the 23rd power alligator pears = Avocado's number
+2 pints = 1 Cavort
+Basic unit of Laryngitis = The Hoarsepower
+Shortest distance between two jokes = A straight line
+6 Curses = 1 Hexahex
+3500 Calories = 1 Food Pound
+1 Mole = 007 Secret Agents
+1 Mole = 25 Cagey Bees
+1 Dog Pound = 16 oz. of Alpo
+1000 beers served at a Twins game = 1 Killibrew
+2.4 statute miles of surgical tubing at Yale U. = 1 I.V.League
+2000 pounds of Chinese soup = 1 Won Ton
+10 to the minus 6th power mouthwashes = 1 Microscope
+Speed of a tortoise breaking the sound barrier = 1 Machturtle
+8 Catfish = 1 Octo-puss
+365 Days of drinking Lo-Cal beer. = 1 Lite-year
+16.5 feet in the Twilight Zone = 1 Rod Serling
+Force needed to accelerate 2.2lbs of cookies = 1 Fig-newton
+ to 1 meter per second
+One half large intestine = 1 Semicolon
+10 to the minus 6th power Movie = 1 Microfilm
+1000 pains = 1 Megahertz
+1 Word = 1 Millipicture
+1 Sagan = Billions & Billions
+1 Angstrom: measure of computer anxiety = 1000 nail-bytes
+10 to the 12th power microphones = 1 Megaphone
+10 to the 6th power Bicycles = 2 megacycles
+The amount of beauty required launch 1 ship = 1 Millihelen
+%
+1 bulls, 3 cows.
+%
+1. Never give anything away for nothing. 2. Never give more than
+you have to (always catch the buyer hungry and always make him wait).
+3. Always take back everything if you possibly can.
+ -- William S. Burroughs, on drug pushing
+%
+1: No code table for op: ++post
+%
+1) X=Y ; Given
+2) X^2=XY ; Multiply both sides by X
+3) X^2-Y^2=XY-Y^2 ; Subtract Y^2 from both sides
+4) (X+Y)(X-Y)=Y(X-Y) ; Factor
+5) X+Y=Y ; Cancel out (X-Y) term
+6) 2Y=Y ; Substitute X for Y, by equation 1
+7) 2=1 ; Divide both sides by Y
+ -- "Omni", proof that 2 equals 1
+%
+10. Not everybody looks good naked.
+ 9. Joe Garagiola was a hell of an emcee.
+ 8. Joe Cocker really should stick with decaffeinated coffee.
+ 7. Fringe! Fringe! Fringe!
+ 6. If you've got 72 hours to kill, you can probably find room for Sha Na Na.
+ 5. Never attend an event with a 50,000 to 1 person to Port-A-San ratio.
+ 4. Bellbottoms will never go out of style.
+ 3. A drum solo cannot be too long.
+ 2. I, David Letterman, will never rent out my farm again.
+ 1. We are stardust. We are golden. We are going to look really stupid to
+ future generations.
+ -- David Letterman, "Top Ten Lessons of Woodstock"
+%
+10 Reasons Why a Beer is Better Than a Woman:
+
+ 1. A beer won't make you go to church.
+ 2. A beer is more likely to know how to spell "carburetor" than a woman.
+ 3. A beer doesn't think baseball is stupid simply because the guys spit.
+ 4. A beer doesn't give a [expletive deleted] if you keep a bunch of
+ other beers on the side.
+ 5. A beer will not call you a sexist pig if you say "Doberman" instead of
+ "Doberperson."
+ 6. A beer won't get a job as a DJ and play 5 straight hours of lesbian
+ folk music on yer fave radio station.
+ 7. A beer understands why The Three Stooges are funny.
+ 8. A beer won't raise a fuss about a little thing like leaving the
+ toilet seat up.
+ 9. A beer doesn't think that a "three-hundred-fifty cubic-inch V8" is an
+ enormous can of vegetable juice.
+10. A beer won't smoke in your car.
+%
+100 buckets of bits on the bus
+100 buckets of bits
+Take one down, short it to ground
+FF buckets of bits on the bus
+
+FF buckets of bits on the bus
+FF buckets of bits
+Take one down, short it to ground
+FE buckets of bits on the bus
+
+ad infinitum...
+%
+$100 invested at 7% interest for 100 years will become $100,000, at
+which time it will be worth absolutely nothing.
+ -- Lazarus Long, "Time Enough for Love"
+%
+10.0 times 0.1 is hardly ever 1.0.
+%
+101 USES FOR A DEAD MICROPROCESSOR
+ (1) Scarecrow for centipedes
+ (2) Dead cat brush
+ (3) Hair barrettes
+ (4) Cleats
+ (5) Self-piercing earrings
+ (6) Fungus trellis
+ (7) False eyelashes
+ (8) Prosthetic dog claws
+ .
+ .
+ .
+ (99) Window garden harrow (pulled behind Tonka tractors)
+ (100) Killer velcro
+ (101) Currency
+%
+1/2 oz. gin
+1/2 oz. vodka
+1/2 oz. rum (preferably dark)
+3/4 oz. tequila
+1/2 oz. triple sec
+1/2 oz. orange juice
+3/4 oz. sour mix
+1/2 oz. cola
+shake with ice and strain into frosted glass.
+ Long Island Iced Tea
+%
+13. ... r-q1
+%
+17. HO HUM -- The Redundant
+
+------- (7) This hexagram refers to a situation of extreme
+--- --- (8) boredom. Your programs always bomb off. Your wife
+------- (7) smells bad. Your children have hives. You are working
+---O--- (6) on an accounting system, when you want to develop
+---X--- (9) the GREAT AMERICAN COMPILER. You give up hot dates
+--- --- (8) to nurse sick computers. What you need now is sex.
+
+Nine in the second place means:
+ The yellow bird approaches the malt shop. Misfortune.
+
+Six in the third place means:
+ In former times men built altars to honor the Internal
+ Revenue Service. Great Dragons! Are you in trouble!
+%
+1.79 x 10^12 furlongs per fortnight -- it's not just a good idea, it's
+the law!
+%
+17th Rule of Friendship:
+
+A friend will refrain from telling you he picked up the same amount
+of life insurance coverage you did for half the price when yours is
+noncancellable.
+ -- Esquire, May 1977
+%
+186,000 miles per second:
+It isn't just a good idea, it's the law!
+%
+1893 The ideal brain tonic
+1900 Drink Coca-Cola -- delicious and refreshing -- 5 cents at all
+ soda fountains
+1905 Is the favorite drink for LADIES when thirsty -- weary -- despondent
+1905 Refreshes the weary, brightens the intellect and clears the brain
+1906 The drink of QUALITY
+1907 Good to the last drop
+1907 It satisfies the thirst and pleases the palate
+1907 Refreshing as a summer breeze. Delightful as a Dip in the Sea
+1908 The Drink that Cheers but does not inebriate
+1917 There's a delicious freshness to the taste of Coca-Cola
+1919 It satisfies thirst
+1919 The taste is the test
+1922 Every glass holds the answer to thirst
+1922 Thirst knows no season
+1925 Enjoy the sociable drink
+ -- Coca-Cola slogans
+%
+1925 With a drink so good, 'tis folly to be thirsty
+1929 The high sign of refreshment
+1929 The pause that refreshes
+1930 It had to be good to get where it is
+1932 The drink that makes a pause refreshing
+1935 The pause that brings friends together
+1937 STOP for a pause... GO refreshed
+1938 The best friend thirst ever had
+1939 Thirst stops here
+1942 It's the real thing
+1947 Have a Coke
+1961 Zing! what a REFRESHING NEW FEELING
+1963 Things go better with Coke
+1969 Face Uncle Sam with a Coke in your hand
+1979 Have a Coke and a smile
+1982 Coke is it!
+ -- Coca-Cola slogans
+%
+1st graffitiest: QUESTION AUTHORITY!
+
+2nd graffitiest: Why?
+%
+2180, U.S. History question:
+ What 20th Century U.S. President was almost impeached and what
+office did he later hold?
+%
+3 syncs represent the trinity -- init, the child and the eternal zombie
+process. In doing 3, you're paying homage to each and I think such
+traditions are important in this shallow, mercurial business we find
+ourselves in.
+ -- Jordan K. Hubbard
+%
+$3,000,000
+%
+355/113 --
+ Not the famous irrational number PI, but an incredible simulation.
+%
+3M, under the Scotch brand name, manufactures a fine adhesive for art
+and display work. This product is called "Craft Mount". 3M suggests
+that to obtain the best results, one should make the bond "while the
+adhesive is wet, aggressively tacky." I did not know what "aggressively
+tacky" meant until I read today's fortune.
+
+ [And who said we didn't offer equal time, huh? Ed.]
+%
+3rd Law of Computing:
+ Anything that can go wr
+fortune: Segmentation violation -- Core dumped
+%
+40 isn't old. If you're a tree.
+%
+4.2 BSD UNIX #57: Sun Jun 1 23:02:07 EDT 1986
+
+You swing at the Sun. You miss. The Sun swings. He hits you with a
+575MB disk! You read the 575MB disk. It is written in an alien
+tongue and cannot be read by your tired Sun-2 eyes. You throw the
+575MB disk at the Sun. You hit! The Sun must repair your eyes. The
+Sun reads a scroll. He hits your 130MB disk! He has defeated the
+130MB disk! The Sun reads a scroll. He hits your Ethernet board! He
+has defeated your Ethernet board! You read a scroll of "postpone until
+Monday at 9 AM". Everything goes dark...
+ -- /etc/motd, cbosgd
+%
+(6) Men employees will be given time off each week for courting
+ purposes, or two evenings a week if they go regularly to church.
+(7) After an employee has spent his thirteen hours of labor in the
+ office, he should spend the remaining time reading the Bible
+ and other good books.
+(8) Every employee should lay aside from each pay packet a goodly
+ sum of his earnings for his benefit during his declining years,
+ so that he will not become a burden on society or his betters.
+(9) Any employee who smokes Spanish cigars, uses alcoholic drink
+ in any form, frequents pool tables and public halls, or gets
+ shaved in a barber's shop, will give me good reason to suspect
+ his worth, intentions, integrity and honesty.
+(10) The employee who has performed his labours faithfully and
+ without a fault for five years, will be given an increase of
+ five cents per day in his pay, providing profits from the
+ business permit it.
+ -- "Office Worker's Guide", New England Carriage
+ Works, 1872
+%
+6 oz. orange juice
+1 oz. vodka
+1/2 oz. Galliano
+ Harvey Wallbangers
+%
+7:30, Channel 5: The Bionic Dog (Action/Adventure)
+ The Bionic Dog drinks too much and kicks over the National
+ Redwood Forest.
+%
+7:30, Channel 5: The Bionic Dog (Action/Adventure)
+ The Bionic Dog gets a hormonal short-circuit and violates the
+ Mann Act with an interstate Greyhound bus.
+%
+90% of the work takes 90% of the time.
+The remaining 10% takes the other 90% of the time.
+%
+94% of the women in America are beautiful
+and the rest hang out around here.
+%
+99 blocks of crud on the disk,
+99 blocks of crud!
+You patch a bug, and dump it again:
+100 blocks of crud on the disk!
+
+100 blocks of crud on the disk,
+100 blocks of crud!
+You patch a bug, and dump it again:
+101 blocks of crud on the disk!
+%
+A baby is an alimentary canal with a loud voice
+at one end and no responsibility at the other.
+%
+A baby is God's opinion that the world should go on.
+ -- Carl Sandburg
+%
+A bachelor is a man who never made the same mistake once.
+%
+A bachelor is a selfish, undeserving guy
+who has cheated some woman out of a divorce.
+ -- Don Quinn
+%
+A bachelor is an unaltared male.
+%
+A bachelor never quite gets over the idea that he is a thing of beauty
+and a boy for ever.
+ -- Helen Rowland
+%
+A bad marriage is like a horse with a broken leg, you can shoot
+the horse, but it don't fix the leg.
+%
+A bank is a place where they lend you an umbrella in fair weather and
+ask for it back the when it begins to rain.
+ -- Robert Frost
+%
+A banker is a fellow who lends you his umbrella when the
+sun is shining and wants it back the minute it begins to rain.
+ -- Mark Twain
+%
+A beautiful woman is a blessing from Heaven, but a good cigar is a smoke.
+ -- Kipling
+%
+A beautiful woman is a picture which drives all beholders nobly mad.
+ -- Ralph Waldo Emerson
+%
+A beer delayed is a beer denied.
+%
+A beginning is the time for taking the
+most delicate care that balances are correct.
+ -- Princess Irulan, "Manual of Maud'Dib"
+%
+A billion here, a billion there -- pretty soon it adds up to real money.
+ -- Sen. Everett Dirksen, on the U.S. defense budget
+%
+A billion seconds ago Harry Truman was president.
+A billion minutes ago was just after the time of Christ.
+A billion hours ago man had not yet walked on earth.
+A billion dollars ago was late yesterday afternoon at the U.S. Treasury.
+%
+A biologist, a statistician, a mathematician and a computer scientist are on
+a photo-safari in Africa. As they're driving along the savannah in their
+jeep, they stop and scout the horizon with their binoculars.
+
+The biologist: "Look! A herd of zebras! And there's a white zebra!
+ Fantastic! We'll be famous!"
+The statistician: "Hey, calm down, it's not significant. We only know
+ there's one white zebra."
+The mathematician: "Actually, we only know there exists a zebra, which is
+ white on one side."
+The computer scientist : "Oh, no! A special case!"
+%
+A bird in the bush usually has a friend in there with him.
+%
+A bird in the hand is worth two in the bush.
+ -- Cervantes
+%
+A bird in the hand is worth what it will bring.
+%
+A bird in the hand makes it awfully hard to blow your nose.
+%
+A bit of talcum
+Is always walcum
+ -- Ogden Nash
+%
+A black cat crossing your path signifies
+that the animal is going somewhere.
+ -- Groucho Marx
+%
+A book is the work of a mind, doing its work in the way that a mind deems
+best. That's dangerous. Is the work of some mere individual mind likely to
+serve the aims of collectively accepted compromises, which are known in the
+schools as 'standards'? Any mind that would audaciously put itself forth to
+work all alone is surely a bad example for the students, and probably, if
+not downright antisocial, at least a little off-center, self-indulgent,
+elitist. ... It's just good pedagogy, therefore, to stay away from such
+stuff, and use instead, if film-strips and rap-sessions must be
+supplemented, 'texts,' selected, or prepared, or adapted, by real
+professionals. Those texts are called 'reading material.' They are the
+academic equivalent of the 'listening material' that fills waiting-rooms,
+and the 'eating material' that you can buy in thousands of convenient eating
+resource centers along the roads.
+ -- The Underground Grammarian
+%
+A bore is a man who talks so much about
+himself that you can't talk about yourself.
+%
+A bore is someone who persists in holding his
+own views after we have enlightened him with ours.
+%
+A boss with no humor is like a job that's no fun.
+%
+A box without hinges, key, or lid,
+Yet golden treasure inside is hid.
+ -- J. R. R. Tolkien
+%
+A boy can learn a lot from a dog: obedience, loyalty, and the importance
+of turning around three times before lying down.
+ -- Robert Benchley
+%
+A boy gets to be a man when a man is needed.
+ -- John Steinbeck
+%
+A budget is just a method of worrying
+before you spend money, as well as afterward.
+%
+A bug in the code is worth two in the documentation.
+%
+A bug in the hand is better than one as yet undetected.
+%
+A bunch of Polish scientists decided to flee their repressive government by
+hijacking an airliner and forcing the pilot to fly them to the West. They
+drove to the airport, forced their way on board a large passenger jet, and
+found there was no pilot on board. Terrified, they listened as the sirens
+got louder. Finally, one of the scientists suggested that since he was an
+experimentalist, he would try to fly the aircraft.
+ He sat down at the controls and tried to figure them out. The sirens
+got louder and louder. Armed men surrounded the jet. The would be pilot's
+friends cried out, "Please, please take off now!!! Hurry!!!"
+ The experimentalist calmly replied, "Have patience. I'm just a simple
+pole in a complex plane."
+%
+A bunch of the boys were whooping it in the Malemute saloon;
+The kid that handles the music box was hitting a jag-time tune;
+Back of the bar, in a solo game, sat Dangerous Dan McGrew,
+And watching his luck was his light-o'-love, the lady that's known as Lou.
+ -- Robert W. Service
+%
+A bureaucrat's idea of cleaning up his files
+is to make a copy of everything before he destroys it.
+%
+A businessman is a hybrid of a dancer and a calculator.
+ -- Paul Valery
+%
+A candidate is a person who gets money from the rich
+and votes from the poor to protect them from each other.
+%
+A cannibal warrior is experiencing severe gastric distress, so he goes
+to his Village Witch Doctor with his complaint. The VWD examines him
+and, concluding that something he ate disagreed with him, began to cross
+examine him about his recent diet.
+ "Well, I ate a missionary yesterday. Do you think that could be
+the problem?"
+ The VWD says "Hmmmm." (All doctors say "Hmmmm.") "That could be.
+Tell me a bit about this missionary."
+ "Well, he was tall for a white man, wearing a brown robe. He was
+walking down the trail, not watching for danger, so I speared him, dragged
+him home, cleaned him, boiled him and ate him."
+ "Ah-hah!" (All doctors say "Ah-hah!") There's your problem," smiles
+the VWD. You boiled him, but he was a friar!"
+%
+A career is great, but you can't run your fingers through its hair.
+%
+A castaway was washed ashore after many days on the open sea. The island
+on which he landed was populated by savage cannibals who tied him, dazed
+and exhausted, to a thick stake. They then proceeded to cut his arms
+with their spears and drink his blood. This continued for several days
+until the castaway could stand no more. He yelled for the cannibal chief
+and declared, "You can kill me if you want to, but this torture with the
+spears has got to stop. Dammit, I'm tired of getting stuck for the drinks."
+%
+A casual stroll through a lunatic asylum shows that faith
+does not prove anything.
+ -- Friedrich Nietzsche
+%
+A celebrity is a person who is known for his well-knownness.
+%
+A certain amount of opposition is a help, not a hindrance.
+Kites rise against the wind, not with it.
+%
+A certain monk had a habit of pestering the Grand Tortue (the only one who
+had ever reached the Enlightenment 'Yond Enlightenment), by asking whether
+various objects had Buddha-nature or not. To such a question Tortue
+invariably sat silent. The monk had already asked about a bean, a lake,
+and a moonlit night. One day he brought to Tortue a piece of string, and
+asked the same question. In reply, the Grand Tortue grasped the loop
+between his feet and, with a few simple manipulations, created a complex
+string which he proffered wordlessly to the monk. At that moment, the monk
+was enlightened.
+
+From then on, the monk did not bother Tortue. Instead, he made string after
+string by Tortue's method; and he passed the method on to his own disciples,
+who passed it on to theirs.
+%
+A certain old cat had made his home in the alley behind Gabe's bar for some
+time, subsisting on scraps and occasional handouts from the bartender. One
+evening, emboldened by hunger, the feline attempted to follow Gabe through
+the back door. Regrettably, only the his body had made it through when
+the door slammed shut, severing the cat's tail at its base. This proved too
+much for the old creature, who looked sadly at Gabe and expired on the spot.
+ Gabe put the carcass back out in the alley and went back to business.
+The mandatory closing time arrived and Gabe was in the process of locking up
+after the last customers had gone. Approaching the back door he was startled
+to see an apparition of the old cat mournfully holding its severed tail out,
+silently pleading for Gabe to put the tail back on its corpse so that it could
+go on to the kitty afterworld complete.
+ Gabe shook his head sadly and said to the ghost, "I can't. You know
+the law -- no retailing spirits after 2:00 AM."
+%
+A Chicago salesman was about to check into a St. Louis hotel when he noticed
+a very charming woman staring admiringly at him. He walked over and spoke
+with her for a few minutes, then returned to the front desk, where they checked
+in as Mr. and Mrs.
+ After a very pleasurable three-day stay, the man approached the front
+desk and told the clerk he was checking out. In a few minutes, he was handed
+a bill for $2500.
+ "There must be some mistake," the salesman said. "I've been here for
+only three days."
+ "Yes, sir," the clerk replied. "But your wife has been here a month
+and a half."
+%
+A chicken is an egg's way of producing more eggs.
+%
+A child can go only so far in life without potty training. It is not mere
+coincidence that six of the last seven presidents were potty trained, not
+to mention nearly half of the nation's state legislators.
+ -- Dave Barry
+%
+A child of five could understand this! Fetch me a child of five.
+%
+A chronic disposition to inquiry
+deprives domestic felines of vital qualities.
+%
+A chubby man with a white beard and a red suit
+will approach you soon. Avoid him. He's a Commie.
+%
+A citizen of America will cross the ocean to fight for democracy, but
+won't cross the street to vote in a national election.
+ -- Bill Vaughan
+%
+A city is a large community where people are lonesome together.
+ -- Herbert Prochnow
+%
+A clash of doctrine is not a disaster - it is an opportunity.
+%
+A classic is something that everybody wants to have read
+and nobody wants to read.
+ -- Mark Twain quoting Professor Winchester,
+ "The Disappearance of Literature"
+%
+A clever prophet makes sure of the event first.
+%
+A cloud does not know why it moves in just such a direction and at such
+a speed, if feels an impulsion... this is the place to go now. But the
+sky knows the reasons and the patterns behind all clouds, and you will
+know, too, when you lift yourself high enough to see beyond horizons.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+A CODE OF ETHICAL BEHAVIOR FOR PATIENTS:
+
+1. DO NOT EXPECT YOUR DOCTOR TO SHARE YOUR DISCOMFORT.
+ Involvement with the patient's suffering might cause him to lose
+ valuable scientific objectivity.
+
+2. BE CHEERFUL AT ALL TIMES.
+ Your doctor leads a busy and trying life and requires all the
+ gentleness and reassurance he can get.
+
+3. TRY TO SUFFER FROM THE DISEASE FOR WHICH YOU ARE BEING TREATED.
+ Remember that your doctor has a professional reputation to uphold.
+%
+A CODE OF ETHICAL BEHAVIOR FOR PATIENTS:
+
+4. DO NOT COMPLAIN IF THE TREATMENT FAILS TO BRING RELIEF.
+ You must believe that your doctor has achieved a deep insight into
+ the true nature of your illness, which transcends any mere permanent
+ disability you may have experienced.
+
+5. NEVER ASK YOUR DOCTOR TO EXPLAIN WHAT HE IS DOING OR WHY HE IS DOING IT.
+ It is presumptuous to assume that such profound matters could be
+ explained in terms that you would understand.
+
+6. SUBMIT TO NOVEL EXPERIMENTAL TREATMENT READILY.
+ Though the surgery may not benefit you directly, the resulting
+ research paper will surely be of widespread interest.
+%
+A CODE OF ETHICAL BEHAVIOR FOR PATIENTS:
+
+7. PAY YOUR MEDICAL BILLS PROMPTLY AND WILLINGLY.
+ You should consider it a privilege to contribute, however modestly,
+ to the well-being of physicians and other humanitarians.
+
+8. DO NOT SUFFER FROM AILMENTS THAT YOU CANNOT AFFORD.
+ It is sheer arrogance to contract illnesses that are beyond your means.
+
+9. NEVER REVEAL ANY OF THE SHORTCOMINGS THAT HAVE COME TO LIGHT IN THE COURSE
+ OF TREATMENT BY YOUR DOCTOR.
+ The patient-doctor relationship is a privileged one, and you have a
+ sacred duty to protect him from exposure.
+
+10. NEVER DIE WHILE IN YOUR DOCTOR'S PRESENCE OR UNDER HIS DIRECT CARE.
+ This will only cause him needless inconvenience and embarrassment.
+%
+A Code of Honour: never approach a friend's girlfriend or wife with mischief
+as your goal. There are too many women in the world to justify that sort of
+dishonourable behaviour. Unless she's really attractive.
+ -- Bruce J. Friedman, "Sex and the Lonely Guy"
+%
+A committee is a group that keeps the minutes and loses hours.
+ -- Milton Berle
+%
+A committee is a life form with six or more legs and no brain.
+ -- Lazarus Long, "Time Enough For Love"
+%
+A committee takes root and grows, it flowers, wilts and dies,
+scattering the seed from which other committees will bloom.
+ -- Parkinson
+%
+A commune is where people join together to share their lack of wealth.
+ -- R. Stallman
+%
+A company is known by the men it keeps.
+%
+A complex system that works is invariably
+found to have evolved from a simple system that works.
+%
+A compliment is something like a kiss through a veil.
+ -- Victor Hugo
+%
+[A computer is] like an Old Testament god, with a lot of rules and no mercy.
+ -- Joseph Campbell
+%
+A computer lets you make more mistakes faster than any other invention,
+with the possible exceptions of handguns and Tequila.
+ -- Mitch Ratcliffe
+%
+A computer salesman visits a company president for the purpose of selling
+the president one of the latest talking computers.
+Salesman: "This machine knows everything. I can ask it any question
+ and it'll give the correct answer. Computer, what is the
+ speed of light?"
+Computer: 186,000 miles per second.
+Salesman: "Who was the first president of the United States?"
+Computer: George Washington.
+President: "I'm still not convinced. Let me ask a question.
+ Where is my father?"
+Computer: Your father is fishing in Georgia.
+President: "Hah!! The computer is wrong. My father died over twenty
+ years ago!"
+Computer: Your mother's husband died 22 years ago. Your father just
+ landed a twelve pound bass.
+%
+A computer science student and a practical hacker are discussing problems
+the computer science student has run in to.
+
+CS Student: I have this singularly linked tail-queued list and I'm trying
+ to make it O(1) to go backwards an item, instead of O(n)...
+ What's the best way to go about that? Should I just use a
+ cached hash of each item and put it into a sorted lookup
+ table, and cache the hash of the last item in the current
+ queue entry and then go to its place in the hash table and
+ get the pointer value from there?
+Hacker: No, you should add an item to the structure named 'prev' and
+ make it point to the previous item.
+CS Student: But we already have a structure element with that identifier
+ and structure elements must have unique names within that
+ scope!
+Hacker: So call it 'previous'.
+
+And then the CS Student was enlightened.
+%
+A computer science student on an exam:
+
+ According to Shannon, information has entropy. Entropy is just
+ a mathematical trick to introduce temperature. Consequently,
+ information has temperature. Hence there are hot news and cool
+ news.
+%
+A computer scientist is someone who fixes things that aren't broken.
+%
+A computer, to print out a fact,
+Will divide, multiply, and subtract.
+ But this output can be
+ No more than debris,
+If the input was short of exact.
+ -- Gigo
+%
+A computer without COBOL and Fortran is like a piece of chocolate
+cake without ketchup and mustard.
+%
+A conclusion is simply the place where someone got tired of thinking.
+%
+A conference is a gathering of important people who singly can
+do nothing but together can decide that nothing can be done.
+ -- Fred Allen
+%
+A CONS is an object which cares.
+ -- Bernie Greenberg
+%
+A conservative is a man who is too cowardly to fight and too fat to run.
+ -- Elbert Hubbard
+%
+A conservative is a man
+who believes that nothing should be done for the first time.
+ -- Alfred E. Wiggam
+%
+A conservative is a man
+with two perfectly good legs who has never learned to walk.
+ -- Franklin D. Roosevelt
+%
+A consultant is a person who borrows your watch, tells you what time it
+is, pockets the watch, and sends you a bill for it.
+%
+A continuing flow of paper is sufficient to continue the flow of paper.
+ -- Dyer
+%
+A copy of the universe is not what is required of art; one of the
+damned things is ample.
+ -- Rebecca West
+%
+A couch is as good as a chair.
+%
+A countryman between two lawyers is like a fish between two cats.
+ -- Benjamin Franklin
+%
+A couple of young fellers were fishing at their special pond off the
+beaten track when out of the bushes jumped the Game Warden. Immediately,
+one of the boys threw his rod down and started running through the woods
+like the proverbial bat out of hell, and hot on his heels ran the Game
+Warden. After about a half mile the fella stopped and stooped over with
+his hands on his thighs, whooping and heaving to catch his breath as the
+Game Warden finally caught up to him.
+ "Let's see yer fishin' license, boy," the Warden gasped. The
+man pulled out his wallet and gave the Game Warden a valid fishing
+license.
+ "Well, son", snarled the Game Warden, "You must be about as dumb
+as a box of rocks! You didn't have to run if you have a license!"
+ "Yes, sir," replied his victim, "but, well, see, my friend back
+there, he don't have one!"
+%
+A cousin of mine once said about money,
+money is always there but the pockets change;
+it is not in the same pockets after a change,
+and that is all there is to say about money.
+ -- Gertrude Stein
+%
+A cow is a completely automated milk-manufacturing machine. It is encased
+in untanned leather and mounted on four vertical, movable supports, one at
+each corner. The front end of the machine, or input, contains the cutting
+and grinding mechanism, utilizing a unique feedback device. Here also are
+the headlights, air inlet and exhaust, a bumper and a foghorn.
+ At the rear, the machine carries the milk-dispensing equipment as
+well as a built-in flyswatter and insect repeller. The central portion
+houses a hydro- chemical-conversion unit. Briefly, this consists of four
+fermentation and storage tanks connected in series by an intricate network
+of flexible plumbing. This assembly also contains the central heating plant
+complete with automatic temperature controls, pumping station and main
+ventilating system. The waste disposal apparatus is located to the rear of
+this central section.
+ Cows are available fully-assembled in an assortment of sizes and
+colors. Production output ranges from 2 to 20 tons of milk per year. In
+brief, the main external visible features of the cow are: two lookers, two
+hookers, four stander-uppers, four hanger-downers, and a swishy-wishy.
+%
+A critic is a bundle of biases held loosely together by a sense of taste.
+ -- Whitney Balliett
+%
+A "critic" is a man who creates nothing and thereby feels
+qualified to judge the work of creative men. There is logic
+in this; he is unbiased -- he hates all creative people equally.
+%
+A cynic is a person searching for an honest man, with a stolen lantern.
+ -- Edgar A. Shoaff
+%
+A day for firm decisions!!!!! Or is it?
+%
+A day without orange juice is like a day without orange juice.
+%
+A day without sunshine is like a day without Anita Bryant.
+%
+A day without sunshine is like a day without orange juice.
+%
+A day without sunshine is like night.
+%
+A dead man cannot bite.
+ -- Gnaeus Pompeius (Pompey)
+%
+A debugged program is one for which you have
+not yet found the conditions that make it fail.
+ -- Jerry Ogdin
+%
+A decade after Vietnam, we still cannot understand why "their"
+Salvadorans fight better than "our" Salvadorans. It is not a matter of
+their training or their equipment. It has to do with the quality of the
+society we are asking them to risk death defending. The metaphor of the
+domino obscures this reality, and the cost our self-imposed blindness
+is high. San Salvador is closer to Saigon than to Munich.
+ -- William LeoGrande, "New York Times", 3/9/83
+%
+A Difficulty for Every Solution.
+ -- Motto of the Federal Civil Service
+%
+A diplomat is a man who can convince his
+wife she'd look stout in a fur coat.
+%
+A diplomat is a man who can tell you to
+go to hell and make the trip sound pleasurable.
+ -- Samuel Clemens
+%
+A diplomat is a person who can tell you to go to hell
+in such a way that you actually look forward to the trip.
+ -- Caskie Stinnett, "Out of the Red"
+%
+A diplomat is man who always remembers a woman's birthday but never her age.
+ -- Robert Frost
+%
+A diplomatic husband said to his wife, "How do you expect me to remember
+your birthday when you never look any older?"
+%
+A diplomat's life consists of three things: protocol, Geritol, and alcohol.
+ -- Adlai E. Stevenson
+%
+A distraught patient phoned her doctor's office. "Was it true," the woman
+inquired, "that the medication the doctor had prescribed was for the rest
+of her life?"
+ She was told that it was. There was just a moment of silence before
+the woman proceeded bravely on. "Well, I'm wondering, then, how serious my
+condition is. This prescription is marked `NO REFILLS'".
+%
+A diva who specializes in risqu'e arias is an off-coloratura soprano.
+%
+A doctor calls his patient to give him the results of his tests. "I have
+some bad news," says the doctor, "and some worse news." The bad news is
+that you only have six weeks to live."
+ "Oh, no," says the patient. "What could possibly be worse than
+that?"
+ "Well," the doctor replies, "I've been trying to reach you since
+last Monday."
+%
+A doctor was stranded with a lawyer in a leaky life raft in shark-infested
+waters. The doctor tried to swim ashore but was eaten by the sharks. The
+lawyer, however, swam safely past the bloodthirsty sharks. "Professional
+courtesy," he explained.
+%
+A door is what a dog is perpetually on the wrong side of.
+ -- Ogden Nash
+%
+A drama critic is a person who surprises a playwright by informing him
+what he meant.
+ -- Wilson Mizner
+%
+A dream will always triumph over reality, once it is given the chance.
+ -- Stanislaw Lem
+%
+A Dublin lawyer died in poverty and many barristers of the city subscribed to
+a fund for his funeral. The Lord Chief Justice of Orbury was asked to donate
+a shilling. "Only a shilling?" exclaimed the man. "Only a shilling to bury
+an attorney? Here's a guinea; go and bury twenty of them."
+%
+A failure will not appear until a unit has passed final inspection.
+%
+A fair exterior is a silent recommendation.
+ -- Publilius Syrus
+%
+A fake fortuneteller can be tolerated. But an authentic soothsayer
+should be shot on sight. Cassandra did not get half the kicking around
+she deserved.
+ -- Robert A. Heinlein
+%
+A famous Lisp Hacker noticed an Undergraduate sitting in front of a Xerox
+1108, trying to edit a complex Klone network via a browser. Wanting to help,
+the Hacker clicked one of the nodes in the network with the mouse, and asked
+"what do you see?" Very earnestly, the Undergraduate replied, "I see a
+cursor." The Hacker then quickly pressed the boot toggle at the back of
+the keyboard, while simultaneously hitting the Undergraduate over the head
+with a thick Interlisp Manual. The Undergraduate was then Enlightened.
+%
+A fanatic is one who can't change his mind and won't change the subject.
+ -- Winston Churchill
+%
+A farmer is a man outstanding in his field.
+%
+A feed salesman is on his way to a farm. As he's driving along at forty
+m.p.h., he looks out his car window and sees a three-legged chicken running
+alongside him, keeping pace with his car. He is amazed that a chicken is
+running at forty m.p.h. So he speeds up to forty-five, fifty, then sixty
+m.p.h. The chicken keeps right up with him the whole way, then suddenly
+takes off and disappears into the distance.
+ The man pulls into the farmyard and says to the farmer, "You know,
+the strangest thing just happened to me; I was driving along at at least
+sixty miles an hour and a chicken passed me like I was standing still!"
+ "Yeah," the farmer replies, "that chicken was ours. You see, there's
+me, and there's Ma, and there's our son Billy. Whenever we had chicken for
+dinner, we would all want a drumstick, so we'd have to kill two chickens.
+So we decided to try and breed a three-legged chicken so each of us could
+have a drumstick."
+ "How do they taste?" said the farmer.
+ "Don't know," replied the farmer. "We haven't been able to catch
+one yet."
+%
+A fellow bought a new car, a Nissan, and was quite happy with his purchase.
+He was something of an animist, however, and felt that the car really ought
+to have a name. This presented a problem, as he was not sure if the name
+should be masculine or feminine.
+ After considerable thought, he settled on naming the car either
+Belchazar or Beaumadine, but remained in a quandry about the final choice.
+ "Is a Nissan male or female?" he began asking his friends. Most of
+them looked at him peculiarly, mumbled things about urgent appointments, and
+went on their way rather quickly.
+ He finally broached the question to a lady he knew who held a black
+belt in judo. She thought for a moment and answered "Feminine."
+ The swiftness of her response puzzled him. "You're sure of that?" he
+asked.
+ "Certainly," she replied. "They wouldn't sell very well if they were
+masculine."
+ "Unhhh... Well, why not?"
+ "Because people want a car with a reputation for going when you want
+it to. And, if Nissan's are female, it's like they say... `Each Nissan, she
+go!'"
+
+ [No, we WON'T explain it; go ask someone who practices an oriental
+ martial art. (Tai Chi Chuan probably doesn't count.) Ed.]
+%
+A few hours grace before the madness begins again.
+%
+A fitter fits; Though sinners sin
+A cutter cuts; And thinners thin
+And an aircraft spotter spots; And paper-blotters blot
+A baby-sitter I've never yet
+Baby-sits -- Had letters let
+But an otter never ots. Or seen an otter ot.
+
+A batter bats
+(Or scatters scats);
+A potting shed's for potting;
+But no one's found
+A bounder bound
+Or caught an otter otting.
+ -- Ralph Lewin
+%
+A flashy Mercedes-Benz roared up to the curb where a cute young miss stood
+waiting for a taxi.
+ "Hi," said the gentleman at the wheel. "I'm going west."
+ "How wonderful," came the cool reply. "Bring me back an orange."
+%
+A fool and his honey are soon parted.
+%
+A fool and his money are soon popular.
+%
+A fool must now and then be right by chance.
+%
+A foolish consistency is the hobgoblin of little minds.
+ -- Ralph Waldo Emerson
+%
+A fool-proof method for sculpting an elephant: first, get a huge block
+of marble; then you chip away everything that doesn't look like an elephant.
+%
+A fool's brain digests philosophy into folly, science into
+superstition, and art into pedantry. Hence University education.
+ -- George Bernard Shaw
+%
+A formal parsing algorithm should not always be used.
+ -- D. Gries
+%
+A Fortran compiler is the hobgoblin of little minis.
+%
+A fox is wolf who sends flowers.
+ -- Ruth Weston
+%
+A fractal is by definition a set for which the Hausdorff Besicovitch
+dimension strictly exceeds the topological dimension.
+ -- Mandelbrot, "The Fractal Geometry of Nature"
+%
+A free society is one where it is safe to be unpopular.
+ -- Adlai E. Stevenson
+%
+A freelancer is one who gets paid by the word -- per piece or perhaps.
+ -- Robert Benchley
+%
+A friend in need is a pest indeed.
+%
+A friend is a present you give yourself.
+ -- Robert Louis Stevenson
+%
+A friend of mine is into Voodoo Acupuncture. You don't have to go.
+You'll just be walking down the street and... Ooohh, that's much better.
+ -- Steven Wright
+%
+A friend of mine won't get a divorce, because he hates
+lawyers more than he hates his wife.
+%
+A full belly makes a dull brain.
+ -- Benjamin Franklin
+
+ [and the local candy machine man. Ed]
+%
+A "full" life in my experience is usually full only of other
+people's demands.
+%
+A furore Normanorum libera nos, O Domine!
+%
+A Galileo could no more be elected president of the United States than
+he could be elected Pope of Rome. Both high posts are reserved for men
+favored by God with an extraordinary genius for swathing the bitter
+facts of life in bandages of self-illusion.
+ -- H. L. Mencken
+%
+A gambler's biggest thrill is winning a bet.
+His next biggest thrill is losing a bet.
+%
+A gangster assembled an engineer, a chemist, and a physicist. He explained
+that he was entering a horse in a race the following week and the three
+assembled guys had the job of assuring that the gangster's horse would win.
+They were to reconvene the day before the race to tell the gangster how they
+each propose to ensure a win. When they reconvened the gangster started with
+the engineer:
+
+Gangster: OK, Mr. engineer, what have you got?
+Engineer: Well, I've invented a way to weave metallic threads into the saddle
+ blanket so that they will act as the plates of a battery and provide
+ electrical shock to the horse.
+G: That's very good! But let's hear from the chemist.
+Chemist: I've synthesized a powerful stimulant that dissolves
+ into simple blood sugars after ten minutes and therefore
+ cannot be detected in post-race tests.
+G: Excellent, excellent! But I want to hear from the physicist before
+ I decide what to do. Physicist?
+
+Physicist: Well, first consider a spherical horse in simple harmonic motion...
+%
+A general leading the State Department resembles a dragon commanding
+ducks.
+ -- New York Times, Jan. 20, 1981
+%
+A gentleman is a man who wouldn't hit a lady with his hat on.
+ -- Evan Esar
+ [ And why not? For why does she have his hat on? Ed.]
+%
+A gentleman never strikes a lady with his hat on.
+ -- Fred Allen
+%
+A gift of a flower will soon be made to you.
+%
+A girl and a boy bump into each other -- surely an accident.
+A girl and a boy bump and her handkerchief drops -- surely another accident.
+But when a girl gives a boy a dead squid -- *_t_h_a_t _h_a_d _t_o _m_e_a_n _s_o_m_e_t_h_i_n_g*.
+ -- S. Morgenstern, "The Silent Gondoliers"
+%
+A girl with a future avoids the man with a past.
+ -- Evan Esar, "The Humor of Humor"
+%
+A girl's best friend is her mutter.
+ -- Dorothy Parker
+%
+A gleekzorp without a tornpee is like
+a quop without a fertsneet (sort of).
+%
+A [golf] ball hitting a tree shall be deemed not to have hit the tree.
+Hitting a tree is simply bad luck and has no place in a scientific game.
+The player should estimate the distance the ball would have traveled if it
+had not hit the tree and play the ball from there, preferably atop a nice
+firm tuft of grass.
+ -- Donald A. Metz
+%
+A [golf] ball sliced or hooked into the rough shall be lifted and placed in
+the fairway at a point equal to the distance it carried or rolled into the
+rough. Such veering right or left frequently results from friction between
+the face of the club and the cover of the ball and the player should not be
+penalized for the erratic behavior of the ball resulting from such
+uncontrollable physical phenomena.
+ -- Donald A. Metz
+%
+A good marriage would be between a blind wife and deaf husband.
+ -- Michel de Montaigne
+%
+A good memory does not equal pale ink.
+%
+A good name lost is seldom regained. When character is gone,
+all is gone, and one of the richest jewels of life is lost forever.
+ -- J. Hawes
+%
+A good plan today is better than a perfect plan tomorrow.
+ -- Patton
+%
+A good programmer is someone who looks both ways before crossing a
+one-way street.
+ -- Doug Linder
+%
+A good question is never answered. It is not a bolt to be tightened
+into place but a seed to be planted and to bear more seed toward the
+hope of greening the landscape of idea.
+ -- John Ciardi
+%
+A good reputation is more valuable than money.
+ -- Publilius Syrus
+%
+A good scapegoat is hard to find.
+%
+A good supervisor can step on your toes without messing up your shine.
+%
+A good sysadmin always carries around a few feet of fiber. If he ever
+gets lost, he simply drops the fiber on the ground, waits ten minutes,
+then asks the backhoe operator for directions.
+ -- Bill Bradford <mrbill@mrbill.net>
+%
+A GOOD WAY TO THREATEN somebody is to light a stick of dynamite. Then you
+call the guy and hold the burning fuse to the phone. "Hear that?" you say.
+"That's dynamite, baby."
+ -- Jack Handey, "The New Mexican" (1988)
+%
+A gossip is one who talks to you about others, a bore is one who talks to
+you about himself; and a brilliant conversationalist is one who talks to
+you about yourself.
+ -- Lisa Kirk
+%
+A gourmet restaurant in Cincinnati is one where you leave the tray on
+the table after you eat.
+%
+A gourmet who thinks of calories is like a tart that looks at her watch.
+ -- James Beard
+%
+A government that is big enough to give you all you want is big enough
+to take it all away.
+ -- Barry Goldwater
+%
+A grammarian's life is always intense.
+%
+A great empire, like a great cake, is most easily diminished at the edges.
+ -- Benjamin Franklin
+%
+A great many people think they are thinking
+when they are merely rearranging their prejudices.
+ -- William James
+%
+A great nation is any mob of people which produces at least one honest
+man a century.
+%
+A green hunting cap squeezed the top of the fleshy balloon of a head. The
+green earflaps, full of large ears and uncut hair and the fine bristles that
+grew in the ears themselves, stuck out on either side like turn signals
+indicating two directions at once. Full, pursed lips protruded beneath the
+bushy black moustache and, at their corners, sank into little folds filled
+with disapproval and potato chip crumbs. In the shadow under the green visor
+of the cap Ignatius J. Reilly's supercilious blue and yellow eyes looked down
+upon the other people waiting under the clock at the D. H. Holmes department
+store, studying the crowd of people for signs of bad taste in dress. Several
+of the outfits, Ignatius noticed, were new enough and expensive enough to be
+properly considered offenses against taste and decency. Possession of
+anything new or expensive only reflected a person's lack of theology and
+geometry; it could even cast doubts upon one's soul.
+ -- John Kennedy Toole, "Confederacy of Dunces"
+%
+A group of politicians deciding to dump a President because his morals
+are bad is like the Mafia getting together to bump off the Godfather for
+not going to church on Sunday.
+ -- Russell Baker
+%
+A guilty conscience is the mother of invention.
+ -- Carolyn Wells
+%
+A guy has to get fresh once in a while
+so a girl doesn't lose her confidence.
+%
+A hacker does for love what others would not do for money.
+%
+A halted retreat
+Is nerve-wracking and dangerous.
+To retain people as men -- and maidservants
+Brings good fortune.
+%
+A hammer sometimes misses its mark - a bouquet never.
+%
+A handful of friends is worth more than a wagon of gold.
+%
+A handful of patience is worth more than a bushel of brains.
+%
+A healthy male adult bore consumes each year one and a half times his own
+weight in other people's patience.
+ -- John Updike
+%
+A help wanted add for a photo journalist asked the rhetorical question:
+
+If you found yourself in a situation where you could either save
+a drowning man, or you could take a Pulitzer prize winning
+photograph of him drowning, what shutter speed and setting would
+you use?
+
+ -- Paul Harvey
+%
+A Hen Brooding Kittens
+ A friend informs us that he saw at the Novato ranch, Marin county,
+a few days since, a hen actually brooding and otherwise caring for three
+kittens! The gentleman upon whose premises this strange event is transpiring
+says the hen adopted the kittens when they were but a few days old, and that
+she has devoted them her undivided care for several weeks past. The young
+felines are now of respectable size, but they nevertheless follow the hen at
+her cluckings, and are regularly brooded at night beneath her wings.
+ -- Sacramento Daily Union, July 2, 1861
+%
+A hermit is a deserter from the army of humanity.
+%
+A highly intelligent man should take a primitive woman. Imagine if on top
+of everything else, I had a woman who interfered with my work.
+ -- Adolf Hitler
+%
+A holding company is a thing where you hand
+an accomplice the goods while the policeman searches you.
+%
+A Hollywood producer calls a friend, another producer on the phone.
+ "Hello?" his friend answers.
+ "Hi!" says the man. "This is Bob, how are you doing?"
+ "Oh," says the friend, "I'm doing great! I just sold a screenplay
+for two hundred thousand dollars. I've started a novel adaptation and the
+studio advanced me fifty thousand dollars on it. I also have a television
+series coming on next week, and everyone says it's going to be a big hit!
+I'm doing *great*! How are you?"
+ "Okay," says the producer, "give me a call when he leaves."
+%
+A homeowner's reach should exceed his grasp, or what's a weekend for?
+%
+A horse! A horse! My kingdom for a horse!
+ -- William Shakespeare, "Henry VI"
+%
+A hundred thousand lemmings can't be wrong!
+%
+A hundred years from now it is very likely that [of Twain's works] "The
+Jumping Frog" alone will be remembered.
+ -- Harry Thurston Peck (Editor of "The Bookman"), January 1901
+%
+A husband is what is left of the lover after the nerve has been extracted.
+ -- Helen Rowland
+%
+A hypocrite is a person who ... but who isn't?
+ -- Don Marquis
+%
+A hypothetical paradox:
+ What would happen in a battle between an Enterprise security team,
+who always get killed soon after appearing, and a squad of Imperial
+Stormtroopers, who can't hit the broad side of a planet?
+ -- Tom Galloway
+%
+A is for Amy who fell down the stairs, B is for Basil assaulted by bears.
+C is for Clara who wasted away, D is for Desmond thrown out of the sleigh.
+E is for Ernest who choked on a peach, F is for Fanny, sucked dry by a leech.
+G is for George, smothered under a rug, H is for Hector, done in by a thug.
+I is for Ida who drowned in the lake, J is for James who took lye, by mistake.
+K is for Kate who was struck with an axe, L is for Leo who swallowed some tacks.
+M is for Maud who was swept out to sea, N is for Neville who died of ennui.
+O is for Olive, run through with an awl, P is for Prue, trampled flat in a brawl
+Q is for Quentin who sank in a mire, R is for Rhoda, consumed by a fire.
+S is for Susan who perished of fits, T is for Titus who flew into bits.
+U is for Una who slipped down a drain, V is for Victor, squashed under a train.
+W is for Winnie, embedded in ice, X is for Xerxes, devoured by mice.
+Y is for Yorick whose head was bashed in, Z is for Zillah who drank too much gin.
+ -- Edward Gorey, "The Gashlycrumb Tinies"
+%
+A is for Apple.
+ -- Hester Pryne
+%
+A is for awk, which runs like a snail, and
+B is for biff, which reads all your mail.
+C is for cc, as hackers recall, while
+D is for dd, the command that does all.
+E is for emacs, which rebinds your keys, and
+F is for fsck, which rebuilds your trees.
+G is for grep, a clever detective, while
+H is for halt, which may seem defective.
+I is for indent, which rarely amuses, and
+J is for join, which nobody uses.
+K is for kill, which makes you the boss, while
+L is for lex, which is missing from DOS.
+M is for more, from which less was begot, and
+N is for nice, which it really is not.
+O is for od, which prints out things nice, while
+P is for passwd, which reads in strings twice.
+Q is for quota, a Berkeley-type fable, and
+R is for ranlib, for sorting ar table.
+S is for spell, which attempts to belittle, while
+T is for true, which does very little.
+U is for uniq, which is used after sort, and
+V is for vi, which is hard to abort.
+W is for whoami, which tells you your name, while
+X is, well, X, of dubious fame.
+Y is for yes, which makes an impression, and
+Z is for zcat, which handles compression.
+ -- THE ABC'S OF UNIX
+%
+A joint is just tea for two.
+%
+A journey of a thousand miles begins with a cash advance from Sam.
+%
+A journey of a thousand miles must begin with a single step.
+ -- Lao Tsu
+%
+A journey of a thousand miles starts under one's feet.
+ -- Lao Tsu
+%
+A jug of wine, a bowl of rice with it;
+Earthen vessels
+Simply handed in through the window.
+There is certainly no blame in this.
+%
+A jury consists of twelve persons chosen to decide who has the better lawyer.
+ -- Robert Frost
+%
+A key to the understanding of all religions is that a God's idea of a
+good time is a game of Snakes and Ladders with greased rungs.
+%
+A kid'll eat the middle of an Oreo, eventually.
+%
+A kind of Batman of contemporary letters.
+ -- Philip Larkin on Anthony Burgess
+%
+A king's castle is his home.
+%
+A kiss is a course of procedure, cunningly devised,
+for the mutual stoppage of speech at a moment when
+words are superfluous.
+%
+A lack of leadership is no substitute for inaction.
+%
+A lady is one who never shows her underwear unintentionally.
+ -- Lillian Day
+%
+A lady with one of her ears applied
+To an open keyhole heard, inside,
+Two female gossips in converse free --
+The subject engaging them was she.
+"I think", said one, "and my husband thinks
+That she's a prying, inquisitive minx!"
+As soon as no more of it she could hear
+The lady, indignant, removed her ear.
+"I will not stay," she said with a pout,
+"To hear my character lied about!"
+ -- Gopete Sherany
+%
+A language that doesn't affect the way you
+think about programming is not worth knowing.
+ -- Alan J. Perlis
+%
+A language that doesn't have everything is
+actually easier to program in than some that do.
+ -- Dennis M. Ritchie
+%
+A large number of installed systems work by fiat.
+That is, they work by being declared to work.
+ -- Anatol Holt
+%
+A large spider in an old house built a beautiful web in which to catch flies.
+Every time a fly landed on the web and was entangled in it the spider devoured
+him, so that when another fly came along he would think the web was a safe and
+quiet place in which to rest. One day a fairly intelligent fly buzzed around
+above the web so long without lighting that the spider appeared and said,
+"Come on down." But the fly was too clever for him and said, "I never light
+where I don't see other flies and I don't see any other flies in your house."
+So he flew away until he came to a place where there were a great many other
+flies. He was about to settle down among them when a bee buzzed up and said,
+"Hold it, stupid, that's flypaper. All those flies are trapped." "Don't be
+silly," said the fly, "they're dancing." So he settled down and became stuck
+to the flypaper with all the other flies.
+
+Moral: There is no safety in numbers, or in anything else.
+ -- James Thurber, "The Fairly Intelligent Fly"
+%
+A Law of Computer Programming:
+ Make it possible for programmers to write in English
+ and you will find that programmers cannot write in English.
+%
+A liberal is a man too broad minded to take his own side in a quarrel.
+ -- Robert Frost
+%
+A liberal is a person whose interests aren't at stake at the moment.
+ -- Willis Player
+%
+A lie in time saves nine.
+%
+A lie is an abomination unto the Lord and a very present help in time of
+trouble.
+ -- Adlai E. Stevenson
+%
+A life lived in fear is a life half lived.
+%
+A life spent in search of the perfect hash brownie is a life well spent.
+%
+A lifetime isn't nearly long enough to figure out what it's all about.
+%
+A light wife doth make a heavy husband.
+ -- William Shakespeare, "The Merchant of Venice"
+%
+A likely impossibility is always preferable to an unconvincing possibility.
+ -- Aristotle
+%
+A limerick packs laughs anatomical
+Into space that is quite economical.
+ But the good ones I've seen
+ So seldom are clean,
+And the clean ones so seldom are comical.
+%
+A LISP programmer knows the value of
+everything, but the cost of nothing.
+ -- Alan J. Perlis
+%
+A list is only as strong as its weakest link.
+ -- Donald E. Knuth
+%
+A little experience often upsets a lot of theory.
+%
+A little inaccuracy saves a world of explanation.
+ -- C. E. Ayres
+%
+A little inaccuracy sometimes saves tons of explanation.
+ -- H. H. Munroe a.k.a. Saki, "The Square Egg" (1924)
+%
+A little kid went up to Santa and asked him, "Santa, you know when I'm bad
+right?" And Santa says, "Yes, I do." The little kid then asks, "And you
+know when I'm sleeping?" To which Santa replies, "Every minute." So the
+little kid then says, "Well, if you know when I'm bad and when I'm good,
+then how come you don't know what I want for Christmas?"
+%
+A little retrospection shows that although many fine, useful software systems
+have been designed by committees and built as part of multipart projects,
+those software systems that have excited passionate fans are those that are
+the products of one or a few designing minds, great designers. Consider Unix,
+APL, Pascal, Modula, the Smalltalk interface, even Fortran; and contrast them
+with Cobol, PL/I, Algol, MVS/370, and MS-DOS.
+ -- Frederick Brooks, Jr.
+%
+A little word of doubtful number,
+A foe to rest and peaceful slumber.
+If you add an "s" to this,
+Great is the metamorphosis.
+Plural is plural now no more,
+And sweet what bitter was before.
+What am I?
+%
+A log may float in a river, but that does not make it a crocodile.
+%
+A long memory is the most subversive idea in America.
+%
+A long-forgotten loved one will appear soon.
+Buy the negatives at any price.
+%
+A lost ounce of gold may be found, a lost moment of time never.
+%
+A lot of people are afraid of heights. Not me. I'm afraid of widths.
+ -- Steven Wright
+%
+A lot of people I know believe in positive thinking,
+and so do I. I believe everything positively stinks.
+ -- Lew Col
+%
+A major, with wonderful force,
+Called out in Hyde Park for a horse.
+ All the flowers looked round,
+ But no horse could be found;
+So he just rhododendron, of course.
+%
+A man always remembers his first love with special
+tenderness, but after that begins to bunch them.
+ -- H. L. Mencken
+%
+A man can have two, maybe three love affairs while he's married. After
+that it's cheating.
+ -- Yves Montand
+%
+A man does not look behind the door unless he has stood there himself.
+ -- Du Bois
+%
+A man fell off a mountain and, as he fell, saw a branch and grabbed for it.
+By superhuman effort he was able to get a precarious grip on it. As he
+was hanging there for dear life, he looked up and cried out,
+ "Is anybody there?"
+A deep majestic voice answered,
+ "Yes my son, I am here. What do you need?"
+ "Help me!!" cried the man.
+ "I will help you", said the voice, "Just let go of the branch and
+you'll be safe. All you have to do is trust."
+The man thought for a moment and cried out:
+ "Anybody ELSE up there?"
+%
+A man gazing at the stars is proverbially at the mercy of the puddles
+in the road.
+ -- Alexander Smith
+%
+A man in love is incomplete until he is married. Then he is finished.
+ -- Zsa Zsa Gabor, "Newsweek"
+%
+A man is already halfway in love with any woman who listens to him.
+ -- Brendan Francis
+%
+A man is crawling through the Sahara desert when he is approached by another
+man riding on a camel. When the rider gets close enough, the crawling man
+whispers through his sun-parched lips, "Water... please... can you give...
+water..."
+ "I'm sorry," replies the man on the camel, "I don't have any water
+with me. But I'd be delighted to sell you a necktie."
+ "Tie?" whispers the man. "I need *water*."
+ "They're only four dollars apiece."
+ "I need *water*."
+ "Okay, okay, say two for seven dollars."
+ "Please! I need *water*!", says the man.
+ "I don't have any water, all I have are ties," replies the salesman,
+and he heads off into the distance.
+ The man, losing track of time, crawls for what seems like days.
+Finally, nearly dead, sun-blind and with his skin peeling and blistering, he
+sees a restaurant in the distance. Summoning the last of his strength he
+staggers up to the door and confronts the head waiter.
+ "Water... can I get... water," the dying man manages to stammer.
+ "I'm sorry, sir, ties required."
+%
+A man is known by the company he organizes.
+ -- Ambrose Bierce
+%
+A man is like a rusty wheel on a rusty cart,
+He sings his song as he rattles along and then he falls apart.
+ -- Richard Thompson
+%
+A man marries to have a home, but also because he doesn't want to be
+bothered with sex and all that sort of thing.
+ -- W. Somerset Maugham, "The Circle"
+%
+A man may be so much of everything that he is nothing of anything.
+ -- Samuel Johnson
+%
+A man may sometimes be forgiven the kiss to which he is not entitled,
+but never the kiss he has not the initiative to claim.
+%
+A man may well bring a horse to the water,
+but he cannot make him drink with he will.
+ -- John Heywood
+%
+A man of genius makes no mistakes.
+His errors are volitional and are the portals of discovery.
+ -- James Joyce, "Ulysses"
+%
+A man paints with his brains and not with his hands.
+%
+A man said to the Universe:
+ "Sir, I exist!"
+ "However," replied the Universe,
+ "the fact has not created in me a sense of obligation."
+ -- Stephen Crane
+%
+A man took his wife deer hunting for the first time. After he'd given her
+some basic instructions, they agreed to separate and rendezvous later. Before
+he left, he warned her if she should fell a deer to be wary of hunters who
+might beat her to the carcass and claim the kill. If that happened, he told
+her, she should fire her gun three times into the air and he would come to
+her aid.
+ Shortly after they separated, he heard a single shot, followed quickly
+by the agreed upon signal. Running to the scene, he found his wife standing
+in a small clearing with a very nervous man staring down her gun barrel.
+ "He claims this is his," she said, obviously very upset.
+ "She can keep it, she can keep it!" the wide-eyed man replied. "I
+just want to get my saddle back!"
+%
+A man usually falls in love with a woman who asks the kinds of questions
+he is able to answer.
+ -- Ronald Colman
+%
+A man was griping to his friend about how he hated to go home after a
+late card games.
+ "You wouldn't believe what I go through to avoid waking my wife,"
+he said. "First, I kill the engine a block away from the house and coast
+into the garage. Then I open the door slowly, take off my shoes, and
+tiptoe to our room. But just as I'm about to slide into bed, she always
+wakes up and gives me hell."
+ "I make a big racket when I go home," his friend replied.
+ "You do?"
+ "Sure. I honk the horn, slam the door, turn on all the lights,
+stomp up to the bedroom and give my wife a big kiss. `Hi, Alice,' I say.
+`How about a little smooch for your old man?'"
+ "And what does she say?" his friend asked in disbelief.
+ "She doesn't say anything," his buddy replied. "She always pretends
+she's asleep."
+%
+A man was kneeling by a grave in a cemetery, crying and praying very loudly,
+ "Oh why..eeeee did you die...eeeeee, Oh Why..eeeeee,
+why did you Di......eeee"
+The caretaker walks up, pardons himself and asks politely,
+ "Excuse me, sir, but I've been seeing you for hours now,
+carrying on at this grave. You must have been very close to the deceased."
+ "No, I never met him. Oh why....eeeee did you dieeeeee,
+why....eeeee did you.."
+ "Sir, you say you never met this person, yet you carry on so?
+Tell, me who is buried here?"
+ "My wife's first husband."
+%
+A man who cannot seduce men cannot save them either.
+ -- S. A. Kierkegaard (1813-1855)
+%
+A man who carries a cat by its tail learns something he can learn
+in no other way.
+%
+A man who fishes for marlin in ponds
+will put his money in Etruscan bonds.
+%
+A man who turns green has eschewed protein.
+%
+A man with 3 wings and a dictionary is cousin to the turkey.
+%
+A man with one watch knows what time it is.
+A man with two watches is never quite sure.
+%
+A man without a woman is like a fish without gills.
+%
+A man would still do something out of sheer perversity - he would create
+destruction and chaos - just to gain his point... and if all this could in
+turn be analyzed and prevented by predicting that it would occur, then man
+would deliberately go mad to prove his point.
+ -- Feodor Dostoevsky, "Notes From the Underground"
+%
+A man wrapped up in himself makes a very small package.
+%
+A man's best friend is his dogma.
+%
+A man's gotta know his limitations.
+ -- Clint Eastwood, "Dirty Harry"
+%
+A man's house is his castle.
+ -- Sir Edward Coke
+%
+A man's house is his hassle.
+%
+A master was asked the question, "What is the Way?" by a curious monk.
+ "It is right before your eyes," said the master.
+ "Why do I not see it for myself?"
+ "Because you are thinking of yourself."
+ "What about you: do you see it?"
+ "So long as you see double, saying `I don't', and `you do', and so
+on, your eyes are clouded," said the master.
+ "When there is neither `I' nor `You', can one see it?"
+ "When there is neither `I' nor `You',
+who is the one that wants to see it?"
+%
+A mathematician, a doctor, and an engineer are walking on the beach and
+observe a team of lifeguards pumping the stomach of a drowned woman. As
+they watch, water, sand, snails and such come out of the pump.
+ The doctor watches for a while and says: "Keep pumping, men, you may
+yet save her!!"
+ The mathematician does some calculations and says: "According to my
+understanding of the size of that pump, you have already pumped more water
+from her body than could be contained in a cylinder 4 feet in diameter and
+6 feet high."
+ The engineer says: "I think she's sitting in a puddle."
+%
+A mathematician is a device for turning coffee into theorems.
+ -- P. Erdos
+%
+A mathematician is a machine for converting coffee into theorems.
+%
+A meeting is an event at which the
+minutes are kept and the hours are lost.
+%
+A memorandum is written not to inform the reader,
+but to protect the writer.
+ -- Dean Acheson
+%
+A method of solution is perfect if we can foresee from the start,
+and even prove, that following that method we shall attain our aim.
+ -- Gottfried Wilhelm Leibniz
+%
+A Mexican newspaper reports that bored Royal Air Force pilots stationed
+on the Falkland Islands have devised what they consider a marvelous new
+game. Noting that the local penguins are fascinated by airplanes, the
+pilots search out a beach where the birds are gathered and fly slowly
+along it at the water's edge. Perhaps ten thousand penguins turn their
+heads in unison watching the planes go by, and when the pilots turn
+around and fly back, the birds turn their heads in the opposite
+direction, like spectators at a slow-motion tennis match. Then, the
+paper reports, "The pilots fly out to sea and directly to the penguin
+colony and overfly it. Heads go up, up, up, and ten thousand penguins
+fall over gently onto their backs.
+ -- Audubon Society Magazine
+
+[From the BBC, 2001-02-02:
+ For five weeks, a team from the British Antarctic Survey (BAS)
+monitored 1,000 king penguins on the island of South Georgia as Lynx
+helicopters passed overhead.
+ "Not one king penguin fell over when the helicopters came over,"
+said team leader Dr. Richard Stone.
+ "As the aircraft approached, the birds went quiet and stopped
+calling to each other, and adolescent birds that were not associated
+with nests began walking away from the noise. Pure animal instinct,
+really."
+ The conclusion, said Dr. Stone, is that flights over 305 metres
+(1,000 feet) caused "only minor and transitory ecological effects" on
+king penguins.]
+%
+A mighty creature is the germ,
+Though smaller than the pachyderm.
+His customary dwelling place
+Is deep within the human race.
+His childish pride he often pleases
+By giving people strange diseases.
+Do you, my poppet, feel infirm?
+You probably contain a germ.
+ -- Ogden Nash
+%
+A mind is a wonderful thing to waste.
+%
+A modem is a baudy house.
+%
+A modest woman, dressed out in all her finery,
+is the most tremendous object in the whole creation.
+ -- Goldsmith
+%
+A mother mouse was taking her large brood for a stroll across the kitchen
+floor one day when the local cat, by a feat of stealth unusual even for
+its species, managed to trap them in a corner. The children cowered,
+terrified by this fearsome beast, plaintively crying, "Help, Mother!
+Save us! Save us! We're scared, Mother!"
+ Mother Mouse, with the hopeless valor of a parent protecting its
+children, turned with her teeth bared to the cat, towering huge above them,
+and suddenly began to bark in a fashion that would have done any Doberman
+proud. The startled cat fled in fear for its life.
+ As her grateful offspring flocked around her shouting "Oh, Mother,
+you saved us!" and "Yay! You scared the cat away!" she turned to them
+purposefully and declared, "You see how useful it is to know a second
+language?"
+%
+A mother takes twenty years to make a man of her boy,
+and another woman makes a fool of him in twenty minutes.
+ -- Frost
+%
+A motion to adjourn is always in order.
+%
+A mouse is a device used to point at the xterm you want to type in.
+%
+A mouse is an elephant built by the Japanese.
+%
+A mushroom cloud has no silver lining.
+%
+A musician, an artist, an architect:
+ the man or woman who is not one of these is not a Christian.
+ -- William Blake
+%
+A myth is a religion in which no-one any longer believes.
+ -- James Feibleman, "Understanding Philosophy"
+%
+A narcissist is someone better looking than you are.
+ -- Gore Vidal
+%
+A nasty looking dwarf throws a knife at you.
+%
+A national debt, if it is not excessive,
+will be to us a national blessing.
+ -- Alexander Hamilton
+%
+A neighbor came to Nasrudin, asking to borrow his donkey. "It is out on
+loan," the teacher replied. At that moment, the donkey brayed loudly inside
+the stable. "But I can hear it bray, over there." "Whom do you believe,"
+asked Nasrudin, "me or a donkey?"
+%
+A new 'chutist had just jumped from the plane at 10,000 feet, and soon
+discovered that all his lines were hopelessly tangled. At about 5,000 feet,
+still struggling, he noticed someone coming up from the ground at about the
+same speed as he was going towards the ground. As they passed each other at
+3,000 feet, the 'chutist yells, "HEY! DO YOU KNOW ANYTHING ABOUT PARACHUTES?"
+ The reply came, fading towards the end, "NO! DO YOU KNOW ANYTHING
+ABOUT COLEMAN STOVES?"
+%
+A new koan:
+ If you have some ice cream, I will give it to you.
+ If you have no ice cream, I will take it away from you.
+It is an ice cream koan.
+%
+A new supply of round tuits has arrived and are available from Mary.
+Anyone who has been putting off work until they got a `round tuit'
+now has no excuse for further procrastination.
+%
+A new taste had been acquired and a new appetite began to grow. The time
+had long since arrived to crush the technical intelligentsia, which had
+come to regard itself as too irreplaceable and had not gotten used to
+catching instructions on the wing. In other words, we never did trust
+the engineers - and from the very first years of the Revolution we saw to
+it that those lackeys and servants of former capitalist bosses were kept
+in line by healthy suspicion and surveillance by the workers.
+ -- Aleksandr I. Solzhenitsyn, "The Gulag Archipelago"
+%
+A New Way of Taking Pills
+ A physician one night in Wisconsin being disturbed by a burglar, and
+having no ball or shot for his pistol, noiselessly loaded the weapon with
+small, hard pills, and gave the intruder a "prescription" which he thinks
+will go far towards curing the rascal of a very bad ailment.
+ -- Nevada Morning Transcript, January 30, 1861
+%
+A New York City ordinance prohibits the shooting of rabbits from the
+rear of a Third Avenue street car -- if the car is in motion.
+%
+A newspaper is a circulating library with high blood pressure.
+ -- Arthure "Bugs" Baer
+%
+A nickel ain't worth a dime anymore.
+ -- Yogi Berra
+%
+A "No" uttered from deepest conviction is better and greater than a
+"Yes" merely uttered to please, or what is worse, to avoid trouble.
+ -- Mahatma Gandhi
+%
+A novice of the temple once approached the Chief Priest with a question.
+
+"Master, does Emacs have the Buddha nature?" the novice asked.
+
+The Chief Priest had been in the temple for many years and could be
+relied upon to know these things. He thought for several minutes
+before replying.
+
+"I don't see why not. It's got bloody well everything else."
+
+With that, the Chief Priest went to lunch. The novice suddenly achieved
+enlightenment, several years later.
+
+Commentary:
+
+His Master is kind,
+Answering his FAQ quickly,
+With thought and sarcasm.
+%
+A nuclear war can ruin your whole day.
+%
+A pain in the ass of major dimensions.
+ -- C. A. Desoer, on the solution of non-linear circuits
+%
+A Parable of Modern Research:
+
+ Bob has lost his keys in a room which is dark except for one
+brightly lit corner.
+ "Why are you looking under the light, you lost them in the dark!"
+ "I can only see here."
+%
+A paranoid is a man who knows a little of what's going on.
+ -- William S. Burroughs
+%
+A pedestal is as much a prison as any small, confined space.
+ -- Gloria Steinem
+%
+A pencil with no point needs no eraser.
+%
+A penny saved has not been spent.
+%
+A penny saved is a penny taxed.
+%
+A penny saved is ridiculous.
+%
+A penny saved kills your career in government.
+%
+A people living under the perpetual menace of war and invasion is very easy to
+govern. It demands no social reforms. It does not haggle over expenditures
+on armaments and military equipment. It pays without discussion, it ruins
+itself, and that is an excellent thing for the syndicates of financiers and
+manufacturers for whom patriotic terrors are an abundant source of gain.
+ -- Anatole France
+%
+A person forgives only when they are in the wrong.
+%
+A person is just about as big as the things that make him angry.
+%
+A person who has nothing looks at all there is and wants something.
+A person who has something looks at all there is and wants all the rest.
+%
+A person who is more than casually interested in computers should be well
+schooled in machine language, since it is a fundamental part of a computer.
+ -- Donald E. Knuth
+%
+A pessimist is a man who has been compelled to live with an optimist.
+ -- Elbert Hubbard
+%
+A physicist is an atom's way of knowing about atoms.
+ -- George Wald
+%
+A pickup with three guys in it pulls into the lumber yard. One of the men
+gets out and goes into the office.
+ "I need some four-by-two's," he says.
+ "You must mean two-by-four's" replies the clerk.
+ The man scratches his head. "Wait a minute," he says, "I'll go
+check."
+ Back, after an animated conversation with the other occupants of the
+truck, he reassures the clerk, that, yes, in fact, two-by-fours would be
+acceptable.
+ "OK," says the clerk, writing it down, "how long you want 'em?"
+ The guy gets the blank look again. "Uh... I guess I better go
+check," he says.
+ He goes back out to the truck, and there's another animated
+conversation. The guy comes back into the office. "A long time," he says,
+"we're building a house".
+%
+A pig is a jolly companion,
+Boar, sow, barrow, or gilt --
+A pig is a pal, who'll boost your morale,
+Though mountains may topple and tilt.
+When they've blackballed, bamboozled, and burned you,
+When they've turned on you, Tory and Whig,
+Though you may be thrown over by Tabby and Rover,
+You'll never go wrong with a pig, a pig,
+You'll never go wrong with a pig!
+ -- Thomas Pynchon, "Gravity's Rainbow"
+%
+A pipe gives a wise man time to think
+and a fool something to stick in his mouth.
+%
+A place for everything and everything in its place.
+ -- Isabella Mary Beeton, "The Book of Household Management"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to memory management system services.]
+%
+A platitude is simply a truth repeated till people get tired of hearing it.
+ -- Stanley Baldwin
+%
+A plethora of individuals with expertise in culinary techniques
+contaminate the potable concoction produced by steeping certain
+edible nutriments.
+%
+A plucked goose doesn't lay golden eggs.
+%
+A poet who reads his verse in public may have other nasty habits.
+%
+A Polish worker walks into a bank to deposit his paycheck. He has heard
+about Poland's economic problems, and he asks what would happen to his
+money if the bank collapsed. "All of our deposits are guaranteed by the
+finance ministry, sir," the teller replies.
+ "But what if the finance ministry goes broke?" the worker asks.
+ "Then the government will intercede to protect the working class,"
+the teller says.
+ "But what if the government goes broke?" the worker asks.
+ "Our socialist comrades in the Soviet Union naturally will come
+to our assistance," the teller responds with growing irritation.
+ "And if the Soviet Union goes broke?" the worker asks.
+ "Idiot!" the teller snorts. "Isn't that worth losing one lousy
+paycheck?"
+ -- Making the rounds in Warsaw, 1984
+%
+A political man can have as his aim the realization of freedom,
+but he has no means to realize it other than through violence.
+ -- Jean-Paul Sartre
+%
+A possum must be himself, and being himself he is honest.
+ -- Walt Kelly
+%
+A pound of salt will not sweeten a single cup of tea.
+%
+A power so great, it can only be used for Good or Evil!
+ -- The Firesign Theatre, "The Giant Rat of Sumatra"
+%
+A "practical joker" deserves applause for his wit according to its quality.
+Bastinado is about right. For exceptional wit one might grant keelhauling.
+But staking him out on an anthill should be reserved for the very wittiest.
+ -- Lazarus Long
+%
+A prediction is worth twenty explanations.
+ -- K. Brecher
+%
+A pretty foot is one of the greatest gifts of nature... please send me your
+last pair of shoes, already worn out in dancing... so I can have something
+of yours to press against my heart.
+ -- Johann Wolfgang von Goethe
+%
+A priest advised Voltaire on his death bed to renounce the devil.
+Replied Voltaire, "This is no time to make new enemies."
+%
+A priest asked: What is Fate, Master?
+
+And he answered:
+
+It is that which gives a beast of burden its reason for existence.
+
+It is that which men in former times had to bear upon their backs.
+
+It is that which has caused nations to build byways from City to City
+upon which carts and coaches pass, and alongside which inns have come
+to be built to stave off Hunger, Thirst and Weariness.
+
+And that is Fate? said the priest.
+
+Fate ... I thought you said Freight, responded the Master.
+
+That's all right, said the priest. I wanted to know what Freight was
+too.
+ -- Kehlog Albran, "The Profit"
+%
+A prig is a fellow who is always making you a present of his opinions.
+ -- George Eliot
+%
+A prisoner of war is a man who tries to kill you and fails, and then
+asks you not to kill him.
+ -- Sir Winston Churchill, 1952
+%
+A private sin is not so prejudicial in the world as a public indecency.
+ -- Miguel de Cervantes
+%
+A professor is one who talks in someone else's sleep.
+%
+A programmer is a person who passes as an exacting expert on the basis of
+being able to turn out, after innumerable punching, an infinite series of
+incomprehensible answers calculated with micrometric precisions from vague
+assumptions based on debatable figures taken from inconclusive documents
+and carried out on instruments of problematical accuracy by persons of
+dubious reliability and questionable mentality for the avowed purpose of
+annoying and confounding a hopelessly defenseless department that was
+unfortunate enough to ask for the information in the first place.
+ -- IEEE Grid newsmagazine
+%
+A programming language is low level
+when its programs require attention to the irrelevant.
+%
+A prohibitionist is the sort of man one wouldn't care to
+drink with -- even if he drank.
+ -- H. L. Mencken
+%
+A prominent broadcaster, on a big-game safari in Africa, was taken to a
+watering hole where the life of the jungle could be observed. As he
+looked down from his tree platform and described the scene into his
+tape recorder, he saw two gnus grazing peacefully. So preoccupied were
+they that they failed to observe the approach of a pride of lions led
+by two magnificent specimens, obviously the leaders. The lions charged,
+killed the gnus, and dragged them into the bushes where their feasting
+could not be seen. A little while later the two kings of the jungle
+emerged and the radioman recorded on his tape: "Well, that's the end of
+the gnus and here, once again, are the head lions."
+%
+A proper wife should be as obedient as a slave... The female is a female
+by virtue of a certain lack of qualities -- a natural defectiveness.
+ -- Aristotle
+%
+A psychiatrist is a fellow who asks you a lot of expensive questions
+your wife asks you for nothing.
+ -- Joey Adams
+%
+A psychiatrist is a person who will give you expensive answers that
+your wife will give you for free.
+%
+A public debt is a kind of anchor in the storm; but if the anchor be
+too heavy for the vessel, she will be sunk by that very weight which
+was intended for her preservation.
+ -- Colton
+%
+A putt that stops close enough to the cup to inspire such comments as
+"you could blow it in" may be blown in. This rule does not apply if
+the ball is more than three inches from the hole, because no one wants
+to make a travesty of the game.
+ -- Donald A. Metz
+%
+A raccoon tangled with a 23,000 volt line today. The results
+blacked out 1400 homes and, of course, one raccoon.
+ -- Steel City News
+%
+A racially integrated community is a chronological term timed from the
+entrance of the first black family to the exit of the last white family.
+ -- Saul Alinsky
+%
+A radioactive cat has eighteen half-lives.
+%
+A real diplomat is one who can cut his neighbor's throat without having
+his neighbor notice it.
+ -- Trygve Lie
+%
+A real friend isn't someone you use once and then throw away.
+A real friend is someone you can use over and over again.
+%
+A real gentleman never takes bases unless he really has to.
+ -- Overheard in an algebra lecture
+%
+A real patriot is the fellow who gets a parking
+ticket and rejoices that the system works.
+%
+A recent study has found that concentrating on difficult off-screen
+objects, such as the faces of loved ones, causes eye strain in computer
+scientists. Researchers into the phenomenon cite the added concentration
+needed to "make sense" of such unnatural three dimensional objects.
+%
+A regular expression goes into a pub with a friend, intending to
+help him find a girl. However, when the cockney barman finds this
+out, he says to it, "Ere! I'll have no pattern match-making in my
+pub!"
+%
+A rich man told me recently that a liberal is a man who tells other
+people what to do with their money.
+ -- Imamu Amiri Baraka (Leroi Jones)
+%
+A right is not what someone gives you; it's what no one can take from you.
+ -- Ramsey Clark
+%
+A Riverside, California, health ordinance states that two persons may
+not kiss each other without first wiping their lips with carbolized
+rosewater.
+%
+A robin redbreast in a cage
+Puts all Heaven in a rage.
+ -- Blake
+%
+A rock pile ceases to be a rock pile the moment a single
+man contemplates it, bearing within him the image of a cathedral.
+ -- Antoine de Saint-Exupery
+%
+A rolling disk gathers no MOS.
+%
+A rolling stone gathers momentum.
+%
+A rolling stone gathers no moss.
+ -- Publilius Syrus
+%
+A Roman divorced from his wife, being highly blamed by his friends, who
+demanded, "Was she not chaste? Was she not fair? Was she not fruitful?"
+holding out his shoe, asked them whether it was not new and well made.
+Yet, added he, none of you can tell where it pinches me.
+ -- Plutarch
+%
+A rope lying over the top of a fence is the same length on each side. It
+weighs one third of a pound per foot. On one end hangs a monkey holding a
+banana, and on the other end a weight equal to the weight of the monkey.
+The banana weighs two ounces per inch. The rope is as long (in feet) as
+the age of the monkey (in years), and the weight of the monkey (in ounces)
+is the same as the age of the monkey's mother. The combined age of the
+monkey and its mother is thirty years. One half of the weight of the monkey,
+plus the weight of the banana, is one forth as much as the weight of the
+weight and the weight of the rope. The monkey's mother is half as old as
+the monkey will be when it is three times as old as its mother was when she
+was half as old as the monkey will be when it is as old as its mother
+will be when she is four times as old as the monkey was when it was twice
+as its mother was when she was one third as old as the monkey was when it
+was old as is mother was when she was three times as old as the monkey was
+when it was one fourth as old as it is now. How long is the banana?
+%
+A rose is a rose is a rose. Just ask Jean Marsh, known to millions of
+PBS viewers in the '70s as Rose, the maid on the BBC export "Upstairs,
+Downstairs." Though Marsh has since gone on to other projects, ... it's
+with Rose she's forever identified. So much so that she even likes to
+joke about having one named after her, a distinction not without its
+drawbacks. "I was very flattered when I heard about it, but when I looked
+up the official description, it said, `Jean Marsh: pale peach, not very
+good in beds; better up against a wall.' I want to tell you that's not
+true. I'm very good in beds as well."
+%
+A sad spectacle. If they be inhabited, what a scope for misery and folly.
+If they be not inhabited, what a waste of space.
+ -- Thomas Carlyle, looking at the stars
+%
+A sadist is a masochist who follows the Golden Rule.
+%
+A salamander scurries into flame to be destroyed.
+Imaginary creatures are trapped in birth on celluloid.
+ -- Genesis, "The Lamb Lies Down on Broadway"
+
+I don't know what it's about. I'm just the drummer. Ask Peter.
+ -- Phil Collins in 1975, when asked about the message behind
+ the previous year's Genesis release, "The Lamb Lies Down
+ on Broadway".
+%
+A Scholar asked his Master, "Master, would you advise me of a proper
+vocation?"
+ The Master replied, "Some men can earn their keep with the power of
+their minds. Others must use their strong backs, legs and hands. This is
+the same in nature as it is with man. Some animals acquire their food easily,
+such as rabbits, hogs and goats. Other animals must fiercely struggle for
+their sustenance, like beavers, moles and ants. So you see, the nature of
+the vocation must fit the individual.
+ "But I have no abilities, desires, or imagination, Master," the
+scholar sobbed.
+ Queried the Master... "Have you thought of becoming a salesperson?"
+%
+A scientific truth does not triumph by convincing its opponents and
+making them see the light, but rather because its opponents eventually
+die and a new generation grows up that is familiar with it.
+ -- Max Planck
+%
+A sect or party is an elegant incognito devised to save a man from
+the vexation of thinking.
+ -- Ralph Waldo Emerson, "Journals" (1831)
+%
+A sense of desolation and uncertainty, of futility, of the baselessness
+of aspirations, of the vanity of endeavor, and a thirst for a life giving
+water which seems suddenly to have failed, are the signs in consciousness
+of this necessary reorganization of our lives.
+
+It is difficult to believe that this state of mind can be produced by the
+recognition of such facts as that unsupported stones always fall to the
+ground.
+ -- J. W. N. Sullivan
+%
+A sense of humor keen enough to show a man his own absurdities will keep
+him from the commission of all sins, or nearly all, save those that are
+worth committing.
+ -- Samuel Butler
+%
+A sequel is an admission that you've been reduced to imitating yourself.
+ -- Don Marquis
+%
+A Severe Strain on the Credulity
+ As a method of sending a missile to the higher, and even to the
+highest parts of the earth's atmospheric envelope, Professor Goddard's rocket
+is a practicable and therefore promising device. It is when one considers the
+multiple-charge rocket as a traveler to the moon that one begins to doubt...
+for after the rocket quits our air and really starts on its journey, its
+flight would be neither accelerated nor maintained by the explosion of the
+charges it then might have left. Professor Goddard, with his "chair" in
+Clark College and countenancing of the Smithsonian Institution, does not
+know the relation of action to re-action, and of the need to have something
+better than a vacuum against which to react... Of course he only seems to
+lack the knowledge ladled out daily in high schools.
+ -- New York Times Editorial, 1920
+%
+A sharper perspective on this matter is particularly important to feminist
+thought today, because a major tendency in feminism has constructed the
+problem of domination as a drama of female vulnerability victimized by male
+aggression. Even the more sophisticated feminist thinkers frequently shy
+away from the analysis of submission, for fear that in admitting woman's
+participation in the relationship of domination, the onus of responsibility
+will appear to shift from men to women, and the moral victory from women to
+men. More generally, this has been a weakness of radical politics: to
+idealize the oppressed, as if their politics and culture were untouched by
+the system of domination, as if people did not participate in their own
+submission. To reduce domination to a simple relation of doer and done-to
+is to substitute moral outrage for analysis.
+ -- Jessica Benjamin, "The Bonds of Love"
+%
+A sine curve goes off to infinity, or at least the end of the blackboard.
+ -- Prof. Steiner
+%
+A single death is a tragedy, a million deaths is a statistic.
+ -- Joseph Stalin
+%
+A single flow'r he sent me, since we met.
+All tenderly his messenger he chose;
+Deep-hearted, pure, with scented dew still wet--
+One perfect rose.
+
+I knew the language of the floweret;
+"My fragile leaves," it said, "his heart enclose."
+Love long has taken for his amulet
+One perfect rose.
+
+Why is it no one ever sent me yet
+One perfect limousine, do you suppose?
+Ah no, it's always just my luck to get
+One perfect rose.
+ -- Dorothy Parker, "One Perfect Rose"
+%
+A sinking ship gathers no moss.
+ -- Donald Kaul
+%
+A small town that cannot support one lawyer can always support two.
+%
+A Smith & Wesson beats four aces.
+%
+A snake lurks in the grass.
+ -- Publius Vergilius Maro (Virgil)
+%
+A social scientist, studying the culture and traditions of a small North
+African tribe, found a woman still practicing the ancient art of matchmaking.
+Locally, she was known as the Moor, the marrier.
+%
+A society in which women are taught anything but the management of a family,
+the care of men, and the creation of the future generation is a society
+which is on its way out.
+ -- L. Ron Hubbard
+%
+A soft answer turneth away wrath; but grievous words stir up anger.
+ -- Proverbs 15:1
+%
+A soft drink turneth away company.
+%
+A song in time is worth a dime.
+%
+A Southern boy graduates from high school heads north to college, taking the
+family dog, Old Blue with him, for company. He's only been there a few weeks
+when he gets a call from his girlfriend; seems like they've got a problem,
+and she needs a thousand dollars to take care of it. The boy calls his folks:
+ "How are you?" they ask.
+ "Oh, I'm fine," he says.
+ "And how," they ask, "is Old Blue?"
+ "Well, he's kind of depressed. You see, there's this lady up here
+that teaches dogs to talk, and Ol' Blue is feelin' kind of left out 'cause
+he's the only dog that doesn't know how to talk. She charges a thousand
+dollars."
+ The parents send the boy the thousand dollars, he forwards it to Mary
+Lou, and everything's fine until Christmas vacation. The boy leaves Ol' Blue
+at his dorm, 'cause he just can't figure out what to tell his parents. Sure
+enough, when he gets home, the first thing his father wants to know is
+"Where's Old Blue?"
+ "Well, Pa," says the boy. "I was driving on home and Old Blue was
+talking away about this and that when we passed the Buford's farm. Old Blue,
+well, he said, `Say, what do you think your mother would do if I told her
+that your father's been comin' over here and seeing Mrs. Buford all these
+years?'"
+ The father looks at his son -- "You shot that dog, didn't you, boy?"
+%
+A squeegee by any other name wouldn't sound as funny.
+%
+A statesman is a politician who's been dead 10 or 15 years.
+ -- Harry S. Truman
+%
+A statistician, who refused to fly after reading of the alarmingly high
+probability that there will be a bomb on any given plane, realized that
+the probability of there being two bombs on any given flight is very low.
+Now, whenever he flies, he carries a bomb with him.
+%
+A stitch in time saves nine.
+%
+A straw vote only shows which way the hot air blows.
+ -- O'Henry
+%
+A strong conviction that something must be done is the parent of many
+bad measures.
+ -- Daniel Webster
+%
+A student, in hopes of understanding the Lambda-nature, came to Greenblatt.
+As they spoke a Multics system hacker walked by. "Is it true", asked the
+student, "that PL-1 has many of the same data types as Lisp?" Almost before
+the student had finished his question, Greenblatt shouted, "FOO!", and hit
+the student with a stick.
+%
+A student who changes the course of history is probably taking an exam.
+%
+A successful [software] tool is one that was used to do something
+undreamed of by its author.
+ -- S. C. Johnson
+%
+A synonym is a word you use when you can't spell the word you first
+thought of.
+ -- Burt Bacharach
+%
+A system admin's life is a sorry one. The only advantage he has over
+Emergency Room doctors is that malpractice suits are rare. On the
+other hand, ER doctors never have to deal with patients installing
+new versions of their own innards!
+ -- Michael O'Brien
+%
+A Tale of Two Cities LITE(tm)
+ -- by Charles Dickens
+
+ A lawyer who looks like a French Nobleman is executed in his place.
+
+The Metamorphosis LITE(tm)
+ -- by Franz Kafka
+
+ A man turns into a bug and his family gets annoyed.
+
+Lord of the Rings LITE(tm)
+ -- by J. R. R. Tolkien
+
+ Some guys take a long vacation to throw a ring into a volcano.
+
+Hamlet LITE(tm)
+ -- by William Shakespeare
+
+ A college student on vacation with family problems, a screwy
+ girl-friend and a mother who won't act her age.
+%
+A Tale of Two Cities LITE(tm)
+ -- by Charles Dickens
+
+ A man in love with a girl who loves another man who looks just
+ like him has his head chopped off in France because of a mean
+ lady who knits.
+
+Crime and Punishment LITE(tm)
+ -- by Fyodor Dostoyevsky
+
+ A man sends a nasty letter to a pawnbroker, but later
+ feels guilty and apologizes.
+
+The Odyssey LITE(tm)
+ -- by Homer
+
+ After working late, a valiant warrior gets lost on his way home.
+%
+A tall, dark stranger will have more fun than you.
+%
+A tautology is a thing which is tautological.
+%
+A team effort is a lot of people doing what I say.
+ -- Michael Winner, British film director
+%
+A Texan, impressing the hell out of a Bostonian with tales about the heroes
+of the Alamo, commented, "I'll bet you never had anyone that brave around
+*Boston*."
+ "Ever hear of Paul Revere?", snarled the Bostonian.
+ "Paul Revere?", pondered the Texan. "Isn't he the guy who ran for
+help?"
+%
+A thing is not necessarily true because a man dies for it.
+ -- Oscar Wilde, "The Portrait of Mr. W. H."
+%
+A timely marriage: one made before your children start nagging you about it.
+ -- Diane Duane
+%
+A total abstainer is one who abstains from everything but abstention,
+and especially from inactivity in the affairs of others.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+A transistor protected by a fast-acting
+fuse will protect the fuse by blowing first.
+%
+A traveling salesman was driving past a farm when he saw a pig with three
+wooden legs executing a magnificent series of backflips and cartwheels.
+Intrigued, he drove up to the farmhouse, where he found an old farmer
+sitting in the yard watching the pig.
+ "That's quite a pig you have there, sir" said the salesman.
+ "Sure is, son," the farmer replied. "Why, two years ago, my daughter
+was swimming in the lake and bumped her head and damned near drowned, but that
+pig swam out and dragged her back to shore."
+ "Amazing!" the salesman exclaimed.
+ "And that's not the only thing. Last fall I was cuttin' wood up on
+the north forty when a tree fell on me. Pinned me to the ground, it did.
+That pig run up and wiggled underneath that tree and lifted it off of me.
+Saved my life."
+ "Fantastic! the salesman said. But tell me, how come the pig has
+three wooden legs?"
+ The farmer stared at the newcomer in amazement. "Mister, when you
+got an amazin' pig like that, you don't eat him all at once."
+%
+A triangle which has an angle of 135 degrees is called an obscene
+triangle.
+%
+A true artist will let his wife starve, his children go barefoot, his mother
+drudge for his living at seventy, sooner than work at anything but his art.
+ -- Shaw
+%
+A truly great man will neither trample on a worm nor sneak to an emperor.
+ -- Benjamin Franklin
+%
+A truly wise man never plays leapfrog with a unicorn.
+%
+A truly wise woman never plays leapfrog with a unicorn.
+%
+A truth that's told with bad intent
+Beats all the lies you can invent.
+ -- William Blake
+%
+A university is what a college becomes
+when the faculty loses interest in students.
+ -- John Ciardi
+%
+A University without students is like an ointment without a fly.
+ -- Ed Nather, professor of astronomy at UT Austin
+%
+A UNIX saleslady, Lenore,
+Enjoys work, but she likes the beach more.
+ She found a good way
+ To combine work and play:
+She sells C shells by the seashore.
+%
+A vacuum is a hell of a lot better
+than some of the stuff that nature replaces it with.
+ -- Tennessee Williams
+%
+A verbal contract isn't worth the paper it's written on.
+ -- Samuel Goldwyn
+%
+A violent man will die a violent death.
+ -- Lao Tsu
+%
+A visit to a fresh place will bring strange work.
+%
+A visit to a strange place will bring fresh work.
+%
+A vivid and creative mind characterizes you.
+%
+A waist is a terrible thing to mind.
+ -- Ziggy
+%
+A watched clock never boils.
+%
+A well adjusted person is one who makes
+the same mistake twice without getting nervous.
+%
+A well-known friend is a treasure.
+%
+A well-used door needs no oil on its hinges.
+A swift-flowing stream does not grow stagnant.
+Neither sound nor thoughts can travel through a vacuum.
+Software rots if not used.
+
+These are great mysteries.
+ -- Geoffrey James, "The Tao of Programming"
+%
+A wise man can see more from a mountain top
+than a fool can from the bottom of a well.
+%
+A wise man can see more from the bottom
+of a well than a fool can from a mountain top.
+%
+A wise person makes his own decisions, a weak one obeys public opinion.
+ -- Chinese proverb
+%
+A witty saying proves nothing.
+ -- Voltaire
+%
+A witty saying proves nothing, but saying something pointless gets
+people's attention.
+%
+A wizard cannot do everything; a fact most magicians are reticent to admit,
+let alone discuss with prospective clients. Still, the fact remains that
+there are certain objects, and people, that are, for one reason or another,
+completely immune to any direct magical spell. It is for this group of
+beings that the magician learns the subtleties of using indirect spells.
+It also does no harm, in dealing with these matters, to carry a large club
+near your person at all times.
+ -- The Teachings of Ebenezum, Volume VIII
+%
+A woman can look both moral and exciting -- if she also looks as if it
+were quite a struggle.
+ -- Edna Ferber
+%
+A woman did what a woman had to, the best way she knew how.
+To do more was impossible, to do less, unthinkable.
+ -- Dirisha, "The Man Who Never Missed"
+%
+A woman, especially if she have the misfortune
+of knowing anything, should conceal it as well as she can.
+ -- Jane Austen
+%
+A woman is like your shadow; follow her, she flies; fly from her,
+she follows.
+ -- Chamfort
+%
+A woman may very well form a friendship with a man, but for this to endure,
+it must be assisted by a little physical antipathy.
+ -- Friedrich Nietzsche
+%
+A woman must be a cute, cuddly, naive little thing -- tender, sweet,
+and stupid.
+ -- Adolf Hitler
+%
+A woman physician has made the statement that smoking is neither
+physically defective nor morally degrading, and that nicotine, even
+when indulged to in excess, is less harmful than excessive petting."
+ -- Purdue Exponent, Jan 16, 1925
+%
+A woman shouldn't have to buy her own perfume.
+ -- Maurine Lewis
+%
+A woman went into a hospital one day to give birth. Afterwards, the doctor
+came to her and said, "I have some... odd news for you."
+ "Is my baby all right?" the woman anxiously asked.
+ "Yes, he is," the doctor replied, "but we don't know how. Your son
+(we assume) was born with no body. He only has a head."
+ Well, the doctor was correct. The Head was alive and well, though no
+one knew how. The Head turned out to be fairly normal, ignoring his lack of
+a body, and lived for some time as typical a life as could be expected under
+the circumstances.
+ One day, about twenty years after the fateful birth, the woman got a
+phone call from another doctor. The doctor said, "I have recently perfected
+an operation. Your son can live a normal life now: we can graft a body onto
+his head!"
+ The woman, practically weeping with joy, thanked the doctor and hung
+up. She ran up the stairs saying, "Johnny, Johnny, I have a *wonderful*
+surprise for you!"
+ "Oh no," cried The Head, "not another HAT!"
+%
+A woman without a man is like a fish without a bicycle.
+ -- Gloria Steinem
+%
+A woman without a man is like a fish without a bicycle.
+Therefore, a man without a woman is like a bicycle without a fish.
+%
+A woman's best protection is a little money of her own.
+ -- Clare Booth Luce, quoted in "The Wit of Women"
+%
+A woman's place is in the house... and in the Senate.
+%
+A word to the wise is enough.
+ -- Miguel de Cervantes
+%
+A would-be disciple came to Nasrudin's hut on the mountain-side. Knowing
+that every action of such an enlightened one is significant, the seeker
+watched the teacher closely. "Why do you blow on your hands?" "To warm
+myself in the cold." Later, Nasrudin poured bowls of hot soup for himself
+and the newcomer, and blew on his own. "Why are you doing that, Master?"
+"To cool the soup." Unable to trust a man who uses the same process
+to arrive at two different results -- hot and cold -- the disciple departed.
+%
+A writer is congenitally unable to tell the truth and that is why we call
+what he writes fiction.
+ -- William Faulkner
+%
+A yawn is a silent shout.
+ -- G. K. Chesterton
+%
+A year spent in Artificial Intelligence is enough to make one believe in God.
+%
+A young girl once committed suicide because her mother refused her a new
+bonnet. Coroner's verdict: "Death from excessive spunk."
+ -- Sacramento Daily Union, September 13, 1860
+%
+A young man and his girlfriend were walking along Main Street when she spotted
+a beautiful diamond ring in a jewelry-store window. "Wow, I'd sure love to
+have that!" she gushed.
+ "No problem," her companion replied, throwing a brick through the
+window and grabbing the ring.
+ A few blocks later, the woman admired a full-length sable coat. "What
+I'd give to own that," she said, sighing.
+ "No problem," he said, throwing a brick through the window and grabbing
+the coat.
+ Finally, turning for home, they passed a car dealership. "Boy, I'd do
+anything for one of those Rolls-Royces," she said.
+ "Jeez, baby," the guy moaned, "you think I'm made of bricks?"
+%
+A young man enters the New York branch of Tiffany's on a Friday evening and
+walks up to a display case full of pearl necklaces. He turns to a gorgeous
+woman, who is obviously window shopping, looks her straight in the eye and
+says, "I can tell by your eyes that you really want that necklace. If you'll
+allow me, I'd like to buy it for you."
+ The woman looks him up and down; he's wearing a nice suit and some
+pretty nice jewelry, but she has trouble believing this story.
+ "Look, this is some kind of put on, right?"
+ "No, really. You see, I've got quite a lot of money -- so much that
+I could never spend it all. I'd really like for you to have it."
+ The guys whips out his checkbook, writes a check for five figures,
+calls over a clerk and hands it to him. The clerk peers at the check, looks
+at the young man, looks at the check again. "Very good, sir. I'm afraid I
+can't release the necklace immediately, would Monday be all right?"
+ "That'll be fine, she'll pick it up." the man replies, and walks out
+of the store with the woman following him in a daze.
+ The next Monday the man comes back in and walks up to the counter.
+The same clerk hurries over to him and says, "Sir, I'm sorry to have to tell
+you this, but your check was returned for insufficient funds."
+ "I know," the man replies. "I just wanted to thank you for a
+terrific weekend."
+%
+A young man wrote to Mozart and said:
+
+Q: "Herr Mozart, I am thinking of writing symphonies. Can you give me any
+ suggestions as to how to get started?"
+A: "A symphony is a very complex musical form, perhaps you should begin with
+ some simple lieder and work your way up to a symphony."
+Q: "But Herr Mozart, you were writing symphonies when you were 8 years old."
+A: "But I never asked anybody how."
+%
+AAAAAAAAAAAaaaaaaaaaaaaaaaccccccccckkkkkk!!!!!!!!!
+You brute! Knock before entering a ladies room!
+%
+Abandon the search for Truth; settle for a good fantasy.
+%
+Abbott's Admonitions:
+ 1: If you have to ask, you're not entitled to know.
+ 2: If you don't like the answer, you shouldn't have asked
+ the question.
+ -- Charles Abbot, dean, University of Virginia
+%
+Aberdeen was so small that when the family with the car went
+on vacation, the gas station and drive-in theatre had to close.
+%
+Abou Ben Adhem (may his tribe increase!)
+Awoke one night from a deep dream of peace,
+And saw, within the moonlight in his room,
+Making it rich, and like a lily in bloom,
+An angel writing in a book of gold.
+Exceeding peace had made Ben Adhem bold,
+And to the presence in the room he said,
+"What writest thou?" The vision raised its head,
+And with a look made of all sweet accord,
+Answered, "The names of those who love the Lord."
+"And is mine one?" said Abou. "Nay not so,"
+Replied the angel. Abou spoke more low,
+But cheerly still; and said, "I pray thee then,
+Write me as one that loves his fellow-men."
+The angel wrote, and vanished. The next night
+It came again with a great wakening light,
+And showed the names whom love of God had blessed,
+And lo! Ben Adhem's name led all the rest.
+ -- James Henry Leigh Hunt, "Abou Ben Adhem"
+%
+About all some men accomplish in life is to send a son to Harvard.
+%
+About the only thing on a farm that has an easy time is the dog.
+%
+About the only thing we have left that actually
+discriminates in favor of the plain people is the stork.
+%
+About the time we think we can make ends meet, somebody moves the ends.
+ -- Herbert Hoover
+%
+About the use of language: it is impossible to sharpen a pencil with a blunt
+ax. It is equally vain to try to do it with ten blunt axes instead.
+ -- Edsger W. Dijkstra
+%
+Above all else - sky.
+%
+Above all things, reverence yourself.
+%
+Abraham Lincoln didn't die in vain. He died in Washington, D.C.
+%
+Abscond, v.:
+ To be unexpectedly called away to the bedside of a dying relative
+ and miss the return train.
+%
+Absence diminishes mediocre passions and increases
+great ones, as the wind blows out candles and fans fires.
+ -- Francois de La Rochefoucauld
+%
+Absence in love is like water upon fire;
+a little quickens, but much extinguishes it.
+ -- Hannah More
+%
+Absence is to love what wind is to fire. It extinguishes the small,
+it enkindles the great.
+%
+Absence makes the heart forget.
+%
+Absence makes the heart go wander.
+%
+Absence makes the heart grow fonder.
+ -- Sextus Aurelius
+%
+Absence makes the heart grow fonder -- of somebody else.
+%
+Absence makes the heart grow frantic.
+%
+Absent, adj.:
+ Exposed to the attacks of friends and acquaintances; defamed;
+slandered.
+%
+Absentee, n.:
+ A person with an income who has had the forethought
+ to remove himself from the sphere of exaction.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Absolutum obsoletum. (If it works, it's out of date.)
+ -- Stafford Beer
+%
+Abstainer, n.:
+ A weak person who yields to the
+ temptation of denying himself a pleasure.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Abstract:
+ This study examined the incidence of neckwear tightness among a group
+of 94 white-collar working men and the effect of a tight business-shirt collar
+and tie on the visual performance of 22 male subjects. Of the white-collar
+men measured, 67% were found to be wearing neckwear that was tighter than
+their neck circumference. The visual discrimination of the 22 subjects was
+evaluated using a critical flicker frequency (CFF) test. Results of the CFF
+test indicated that tight neckwear significantly decreased the visual
+performance of the subjects and that visual performance did not improve
+immediately when tight neckwear was removed.
+ -- Langan, L. M. and Watkins, S. M. "Pressure of Menswear on the
+ Neck in Relation to Visual Performance." Human Factors 29,
+ #1 (Feb. 1987), pp. 67-71.
+%
+Absurdity, n.:
+ A statement or belief manifestly
+ inconsistent with one's own opinion.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Academic politics is the most vicious and bitter form of politics,
+because the stakes are so low.
+ -- Wallace Sayre
+%
+Academicians care, that's who.
+%
+ACADEMY:
+ A modern school where football is taught.
+INSTITUTE:
+ An archaic school where football is not taught.
+%
+Accent on helpful side of your nature. Drain the moat.
+%
+Accept people for what they are -- completely unacceptable.
+%
+ACCEPTANCE TESTING:
+ An unsuccessful attempt to find bugs.
+%
+Accident, n.:
+ A condition in which presence of mind is good,
+ but absence of body is better.
+ -- Foolish Dictionary
+%
+Accidentally Shot
+ Colonel Gray, of Petaluma, came near losing his life a few days ago,
+in a singular manner. A gentleman with whom he was hunting attempted to
+bring down a dove, but instead of doing so put the load of shot through the
+Colonel's hat. One shot took effect in his forehead.
+ -- Sacramento Daily Union, April 20, 1861
+%
+Accidents cause History.
+
+If Sigismund Unbuckle had taken a walk in 1426 and met Wat Tyler, the
+Peasant's Revolt would never have happened and the motor car would not
+have been invented until 2026, which would have meant that all the oil
+could have been used for lamps, thus saving the electric light bulb and
+the whale, and nobody would have caught Moby Dick or Billy Budd.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+According to a recent and unscientific national survey, smiling is something
+everyone should do at least 6 times a day. In an effort to increase the
+national average (the US ranks third among the world's superpowers in
+smiling), Xerox has instructed all personnel to be happy, effervescent, and
+most importantly, to smile. Xerox employees agree, and even feel strongly
+that they can not only meet but surpass the national average... except for
+Tubby Ackerman. But because Tubby does such a fine job of racing around
+parking lots with a large butterfly net retrieving floating IC chips, Xerox
+decided to give him a break. If you see Tubby in a parking lot he may have
+a sheepish grin. This is where the expression, "Service with a slightly
+sheepish grin" comes from.
+%
+According to all the latest reports,
+there was no truth in any of the earlier reports.
+%
+According to Arkansas law, Section 4761, Pope's Digest: "No person
+shall be permitted under any pretext whatever, to come nearer than
+fifty feet of any door or window of any polling room, from the opening
+of the polls until the completion of the count and the certification of
+the returns."
+%
+According to convention there is a sweet and a bitter, a hot and a cold,
+and according to convention, there is an order. In truth, there are atoms
+and a void.
+ -- Democritus, 400 B.C.
+%
+According to my best recollection, I don't remember.
+ -- Vincent "Jimmy Blue Eyes" Alo
+%
+According to the latest official figures,
+43% of all statistics are totally worthless.
+%
+According to the obituary notices, a mean and unimportant person never
+dies.
+%
+According to the Rand McNally Places-Rated Almanac, the best place to live in
+America is the city of Pittsburgh. The city of New York came in twenty-fifth.
+Here in New York we really don't care too much. Because we know that we could
+beat up their city anytime.
+ -- David Letterman
+%
+Accordion, n.:
+ A bagpipe with pleats.
+%
+Accuracy, n.:
+ The vice of being right.
+%
+Acid -- better living through chemistry.
+%
+Acid absorbs 47 times its own weight in excess Reality.
+%
+Acquaintance, n.:
+ A person whom we know well enough to borrow from but not well
+ enough to lend to. A degree of friendship called slight when the
+ object is poor or obscure, and intimate when he is rich or famous.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Acting is an art which consists of keeping the audience from coughing.
+%
+Acting is not very hard. The most important things are to be able to laugh
+and cry. If I have to cry, I think of my sex life. And if I have to laugh,
+well, I think of my sex life.
+ -- Glenda Jackson
+%
+Actor Real Name
+
+Boris Karloff William Henry Pratt
+Cary Grant Archibald Leach
+Edward G. Robinson Emmanual Goldenburg
+Gene Wilder Gerald Silberman
+John Wayne Marion Morrison
+Kirk Douglas Issur Danielovitch
+Richard Burton Richard Jenkins, Jr.
+Roy Rogers Leonard Slye
+Woody Allen Allen Stewart Konigsberg
+%
+Actor: "I'm a smash hit. Why, yesterday during the last act, I had
+ everyone glued in their seats!"
+Oliver Herford: "Wonderful! Wonderful! Clever of you to think of
+ it!"
+%
+Actor: So what do you do for a living?
+Doris: I work for a company that makes deceptively shallow serving
+ dishes for Chinese restaurants.
+ -- Woody Allen, "Without Feathers"
+%
+Actors will happen even in the best-regulated families.
+%
+Actresses will happen in the best regulated families.
+ -- Addison Mizner and Oliver Herford,
+ "The Entirely New Cynic's Calendar", 1905
+%
+Actually, my goal is to have a sandwich named after me.
+%
+Actually, the probability is 100% that the elevator
+will be going in the right direction. Proof by induction:
+
+N=1. Trivially true, since both you and the elevator
+ only have one floor to go to.
+
+Assume true for N, prove for N+1:
+ If you are on any of the first N floors, then it is true by the
+ induction hypothesis. If you are on the N+1st floor, then both you
+ and the elevator have only one choice, namely down. Therefore,
+ it is true for all N+1 floors.
+QED.
+%
+Ad astra per aspera. (To the stars by aspiration.)
+%
+ADA:
+ Something you need only know the name of to be an Expert in
+ Computing. Useful in sentences like, "We had better develop
+ an ADA awareness.
+ -- "Datamation", January 15, 1984
+%
+Adde parvum parvo manus acervus erit.
+[Add little to little and there will be a big pile.]
+ -- Ovid
+%
+Adding features does not necessarily increase
+functionality -- it just makes the manuals thicker.
+%
+Adding manpower to a late software project makes it later.
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+
+Whenever one person is found adequate to the discharge of a duty by
+close application thereto, it is worse execute by two persons and
+scarcely done at all if three or more are employed therein.
+ -- George Washington (1732-1799)
+%
+Adding sound to movies would be like
+putting lipstick on the Venus de Milo.
+ -- Mary Pickford, actress, 1925
+%
+Adhere to your own act, and congratulate yourself if you have done
+something strange and extravagant, and broken the monotony of a
+decorous age.
+ -- Ralph Waldo Emerson
+%
+Adler's Distinction:
+ Language is all that separates us from the lower animals,
+ and from the bureaucrats.
+%
+Admiration, n.:
+ Our polite recognition of another's resemblance to ourselves.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Adolescence, n.:
+ The stage between puberty and adultery.
+%
+Adopted kids are such a pain -- you have to teach them how to look
+like you ...
+ -- Gilda Radner
+%
+Adore, v.:
+ To venerate expectantly.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Adult, n.:
+ One old enough to know better.
+%
+Adults die young.
+%
+Advancement in position.
+%
+Advertisements contain the only
+truths to be relied on in a newspaper.
+ -- Thomas Jefferson
+%
+Advertising is a valuable economic factor because it is the cheapest
+way of selling goods, particularly if the goods are worthless.
+ -- Sinclair Lewis
+%
+Advertising is the rattling of a stick inside a swill bucket.
+ -- George Orwell
+%
+Advertising may be described as the science of arresting the human
+intelligence long enough to get money from it.
+%
+Advertising Rule:
+ In writing a patent-medicine advertisement, first convince the
+ reader that he has the disease he is reading about; secondly,
+ that it is curable.
+%
+Advice from an old carpenter: measure twice, saw once.
+%
+Advice is a dangerous gift; be cautious about giving and receiving it.
+%
+Advice to young men: Be ascetic, and if you can't be ascetic,
+then at least be aseptic.
+%
+African violet: Such worth is rare
+Apple blossom: Preference
+Bachelor's button: Celibacy
+Bay leaf: I change but in death
+Camellia: Reflected loveliness
+Chrysanthemum, red: I love
+Chrysanthemum, white: Truth
+Chrysanthemum, other: Slighted love
+Clover: Be mine
+Crocus: Abuse not
+Daffodil: Innocence
+Forget-me-not: True love
+Fuchsia: Fast
+Gardenia: Secret, untold love
+Honeysuckle: Bonds of love
+Ivy: Friendship, fidelity, marriage
+Jasmine: Amiability, transports of joy, sensuality
+Leaves (dead): Melancholy
+Lilac: Youthful innocence
+Lily: Purity, sweetness
+Lily of the valley: Return of happiness
+Magnolia: Dignity, perseverance
+ * An upside-down blossom reverses the meaning.
+%
+After 35 years, I have finished a comprehensive study of European
+comparative law. In Germany, under the law, everything is prohibited,
+except that which is permitted. In France, under the law, everything
+is permitted, except that which is prohibited. In the Soviet Union,
+under the law, everything is prohibited, including that which is
+permitted. And in Italy, under the law, everything is permitted,
+especially that which is prohibited.
+ -- Newton Minow, 1985,
+ Speech to the Association of American Law Schools
+%
+After a few boring years, socially meaningful rock 'n' roll died out.
+It was replaced by disco, which offers no guidance to any form of life
+more advanced than the lichen family.
+ -- Dave Barry, "Kids Today: They Don't Know Dum Diddly Do"
+%
+After a number of decimal places, nobody gives a damn.
+%
+After a while you learn the subtle difference
+Between holding a hand and chaining a soul,
+And you learn that love doesn't mean security,
+And you begin to learn that kisses aren't contracts
+And presents aren't promises
+And you begin to accept your defeats
+With your head up and your eyes open,
+With the grace of a woman, not the grief of a child,
+And you learn to build all your roads
+On today because tomorrow's ground
+Is too uncertain. And futures have
+A way of falling down in midflight,
+After a while you learn that even sunshine burns if you get too much.
+So you plant your own garden and decorate your own soul, instead of waiting
+For someone to bring you flowers.
+And you learn that you really can endure...
+That you really are strong,
+And you really do have worth
+And you learn and learn
+With every goodbye you learn.
+ -- Veronic Shoffstall, "Comes the Dawn"
+%
+After all, all he did was string together
+a lot of old, well-known quotations.
+ -- H. L. Mencken, on Shakespeare
+%
+After all is said and done, a hell of a lot more is said than done.
+%
+After all, it is only the mediocre who are always at their best.
+ -- Jean Giraudoux
+%
+After all my erstwhile dear,
+My no longer cherished,
+Need we say it was not love,
+Just because it perished?
+ -- Edna St. Vincent Millay
+%
+After all, what is your hosts' purpose in having a party? Surely not for
+you to enjoy yourself; if that were their sole purpose, they'd have simply
+sent champagne and women over to your place by taxi.
+ -- P. J. O'Rourke
+%
+After an instrument has been assembled,
+extra components will be found on the bench.
+%
+After any salary raise, you will have less money at the end of the
+month than you did before.
+%
+After [Benjamin] Franklin came a herd of Electrical Pioneers whose names
+have become part of our electrical terminology: Myron Volt, Mary Louise Amp,
+James Watt, Bob Transformer, etc. These pioneers conducted many important
+electrical experiments. For example, in 1780 Luigi Galvani discovered (this
+is the truth) that when he attached two different kinds of metal to the leg
+of a frog, an electrical current developed and the frog's leg kicked, even
+though it was no longer attached to the frog, which was dead anyway.
+Galvani's discovery led to enormous advances in the field of amphibian
+medicine. Today, skilled veterinary surgeons can take a frog that has been
+seriously injured or killed, implant pieces of metal in its muscles, and
+watch it hop back into the pond just like a normal frog, except for the fact
+that it sinks like a stone.
+ -- Dave Barry, "What is Electricity?"
+%
+After his legs had been broken in an accident, Mr. Miller sued for damages,
+claiming that he was crippled and would have to spend the rest of his life
+in a wheelchair. Although the insurance-company doctor testified that his
+bones had healed properly and that he was fully capable of walking, the
+judge decided for the plaintiff and awarded him $500,000.
+ When he was wheeled into the insurance office to collect his check,
+Miller was confronted by several executives. "You're not getting away with
+this, Miller," one said. "We're going to watch you day and night. If you
+take a single step, you'll not only repay the damages but stand trial for
+perjury. Here's the money. What do you intend to do with it?"
+ "My wife and I are going to travel," Miller replied. "We'll go to
+Stockholm, Berlin, Rome, Athens and, finally, to a place called Lourdes --
+where, gentlemen, you'll see yourselves one hell of a miracle."
+%
+After I asked him what he meant, he replied that freedom consisted of
+the unimpeded right to get rich, to use his ability, no matter what the
+cost to others, to win advancement.
+ -- Norman Thomas
+%
+After living in New York, you trust nobody,
+but you believe everything. Just in case.
+%
+...[after the announcement of Vanguard] ... Secretary of Defense Charles
+Wilson (the same "Engine Charlie" who once told the Senate, "[F]or years
+I've thought that what was good for our country was good for General Motors,
+and vice versa," probably an accurate analysis) was asked whether the
+Russians might beat the Americans into orbit. "I wouldn't care if they
+did," he responded. (It was later claimed that Wilson favored the
+development of the automatic transmission so that he could drive with
+one foot in his mouth.)
+ -- Smithsonian's Air&Space Magazine, "The Day the Rocket Died"
+%
+After the game the king and the pawn go in the same box.
+ -- Italian proverb
+%
+After the ground war began, captured Iraqi soldiers said any of them caught
+by superiors wearing a white T-shirt would be executed because of the ease
+with which the shirts could be used as surrender flags. Some Iraqi soldiers
+carried bleach with them to make their dark shirts white.
+ -- Chuck Shepherd, Funny Times, May 1991
+%
+After the last of 16 mounting screws has been removed from an access
+cover, it will be discovered that the wrong access cover has been removed.
+%
+After this was written there appeared a remarkable posthumous memoir that
+throws some doubt on Millikan's leading role in these experiments. Harvey
+Fletcher (1884-1981), who was a graduate student at the University of Chicago,
+at Millikan's suggestion worked on the measurement of electronic charge for
+his doctoral thesis, and co-authored some of the early papers on this subject
+with Millikan. Fletcher left a manuscript with a friend with instructions
+that it be published after his death; the manuscript was published in
+Physics Today, June 1982, page 43. In it, Fletcher claims that he was the
+first to do the experiment with oil drops, was the first to measure charges on
+single droplets, and may have been the first to suggest the use of oil.
+According to Fletcher, he had expected to be co-authored with Millikan on
+the crucial first article announcing the measurement of the electronic
+charge, but was talked out of this by Millikan.
+ -- Steven Weinberg, "The Discovery of Subatomic Particles"
+
+Robert Millikan is generally credited with making the first really
+precise measurement of the charge on an electron and was awarded the
+Nobel Prize in 1923.
+%
+After two or three weeks of this madness, you begin to feel As One with
+the man who said, "No news is good news." In twenty-eight papers, only
+the rarest kind of luck will turn up more than two or three articles of
+any interest... but even then the interest items are usually buried
+deep around paragraph 16 on the jump (or "Cont. on ...") page...
+
+The Post will have a story about Muskie making a speech in Iowa. The
+Star will say the same thing, and the Journal will say nothing at all.
+But the Times might have enough room on the jump page to include a line
+or so that says something like: "When he finished his speech, Muskie
+burst into tears and seized his campaign manager by the side of the
+neck. They grappled briefly, but the struggle was kicked apart by an
+oriental woman who seemed to be in control."
+
+Now that's good journalism. Totally objective; very active and
+straight to the point.
+ -- Hunter S. Thompson, "Fear and Loathing '72"
+%
+After years of research, scientists recently reported that there is,
+indeed, arroz in Spanish Harlem.
+%
+After your lover has gone you will still have PEANUT BUTTER!
+%
+Afternoon, n.:
+ That part of the day we spend worrying about how we wasted the
+morning.
+%
+Afternoon very favorable for romance. Try a single person for a change.
+%
+Against Idleness and Mischief
+
+How doth the little busy bee How skillfully she builds her cell!
+Improve each shining hour, How neat she spreads the wax!
+And gather honey all the day And labours hard to store it well
+From every opening flower! With the sweet food she makes.
+
+In works of labour or of skill In books, or work, or healthful play,
+I would be busy too; Let my first years be passed,
+For Satan finds some mischief still That I may give for every day
+For idle hands to do. Some good account at last.
+ -- Isaac Watts (1674-1748)
+%
+Against stupidity the very gods Themselves contend in vain.
+ -- Friedrich von Schiller, "The Maid of Orleans", III, 6
+%
+Age and treachery will always overcome youth and skill.
+%
+Age before beauty; and pearls before swine.
+ -- Dorothy Parker
+%
+Age is a tyrant who forbids,
+at the penalty of life, all the pleasures of youth.
+%
+Age, n.:
+ That period of life in which we compound for the vices that we
+ still cherish by reviling those that we no longer have the
+ enterprise to commit.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Agnes' Law:
+ Almost everything in life is easier to get into than out of.
+%
+Agree with them now, it will save so much time.
+%
+Ah, but a man's grasp should exceed his reach,
+Or what's a heaven for ?
+ -- Robert Browning, "Andrea del Sarto"
+%
+Ah, but the choice of dreams to live,
+there's the rub.
+
+For all dreams are not equal,
+some exit to nightmare
+most end with the dreamer
+
+But at least one must be lived ... and died.
+%
+Ah, my friends, from the prison, they ask unto me,
+"How good, how good does it feel to be free?"
+And I answer them most mysteriously:
+"Are birds free from the chains of the sky-way?"
+ -- Bob Dylan
+%
+Ah say, son, you're about as sharp as a bowlin' ball.
+%
+Ah, sweet Springtime, when a young man lightly turns his fancy over!
+%
+Ah, the Tsar's bazaar's bizarre beaux-arts!
+%
+"Ah, you know the type. They like to blame it all on the Jews or the
+Blacks, 'cause if they couldn't, they'd have to wake up to the fact
+that life's one big, scary, glorious, complex and ultimately
+unfathomable crapshoot -- and the only reason THEY can't seem to keep
+up is they're a bunch of misfits and losers."
+ -- An analysis of Neo-Nazis, from "The Badger" comic
+%
+Ahead warp factor one, Mr. Sulu.
+%
+Ahhhhhh... the smell of cuprinol and mahogany. It
+excites me to... acts of passion... acts of... ineptitude.
+%
+Aim for the moon. If you miss, you may hit a star.
+ -- W. Clement Stone
+%
+Ain't no right way to do a wrong thing.
+ -- The Mad Dogtender
+%
+Ain't nothin' an old man can do for me but
+bring me a message from a young man.
+ -- Moms Mabley
+%
+Ain't that something what happened today. One of us got traded to
+Kansas City.
+ -- Casey Stengel, informing outfielder Bob Cerv he'd
+ been traded
+%
+Air Force Inertia Axiom:
+ Consistency is always easier to defend than correctness.
+%
+Air is water with holes in it.
+%
+Air, n.:
+ A nutritious substance supplied by a bountiful Providence for
+ the fattening of the poor.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Air pollution is really making us pay through the nose.
+%
+Airplanes are interesting toys but of no military value.
+ -- Marechal Ferdinand Foch, Professor of Strategy,
+ Ecole Superieure de Guerre
+%
+Al didn't smile for forty years. You've got to admire a man like that.
+ -- from "Mary Hartman, Mary Hartman"
+%
+Alan Turing thought about criteria to settle the question of whether
+machines can think, a question of which we now know that it is about
+as relevant as the question of whether submarines can swim.
+ -- Edsger W. Dijkstra
+%
+Alas, how love can trifle with itself!
+ -- William Shakespeare, "The Two Gentlemen of Verona"
+%
+Alas, I am dying beyond my means.
+ -- Oscar Wilde [as he sipped champagne on his deathbed]
+%
+ALASKA:
+ A prelude to "No."
+%
+Albert Camus wrote that the only serious question is whether to kill yourself
+or not. Tom Robbins wrote that the only serious question is whether time has
+a beginning and an end. Camus clearly got up on the wrong side of bed, and
+Robbins must have forgotten to set the alarm.
+ -- Tom Robbins
+%
+Albert Einstein, when asked to describe radio, replied: "You see, wire
+telegraph is a kind of a very, very long cat. You pull his tail in New
+York and his head is meowing in Los Angeles. Do you understand this?
+And radio operates exactly the same way: you send signals here, they
+receive them there. The only difference is that there is no cat."
+%
+ALBRECHT'S LAW:
+ Social innovations tend to the level
+ of minimum tolerable well-being.
+%
+Alcohol, hashish, prussic acid, strychnine are weak dilutions.
+The surest poison is time.
+ -- Ralph Waldo Emerson, "Society and Solitude"
+%
+Alcohol is the anesthesia by which we endure the operation of life.
+ -- George Bernard Shaw
+%
+Alden's Laws:
+ (1) Giving away baby clothes and furniture is the major cause
+ of pregnancy.
+ (2) Always be backlit.
+ (3) Sit down whenever possible.
+%
+Aleph-null bottles of beer on the wall,
+Aleph-null bottles of beer,
+ You take one down, and pass it around,
+Aleph-null bottles of beer on the wall.
+%
+Alex Haley was adopted!
+%
+Alexander Graham Bell is alive and well
+in New York, and still waiting for a dial tone.
+%
+Alexander Hamilton started the U.S. Treasury with nothing - and that was
+the closest our country has ever been to being even.
+ -- The Best of Will Rogers
+%
+Algebraic symbols are used when you do not know what you are talking about.
+ -- Philippe Schnoebelen
+%
+Algol-60 surely must be regarded as the most
+important programming language yet developed.
+ -- T. Cheatham
+%
+ALGORITHM:
+ Trendy dance for hip programmers.
+%
+Alimony and bribes will engage a large share of your wealth.
+%
+Alimony is a system by which, when two people make a mistake, one of
+them keeps paying for it.
+ -- Peggy Joyce
+%
+Alimony is like buying oats for a dead horse.
+ -- Arthur Baer
+%
+Alimony is the curse of the writing classes.
+ -- Norman Mailer
+%
+Alimony is the high cost of leaving.
+%
+Aliquid melius quam pessimum optimum non est.
+%
+Alive without breath,
+As cold as death;
+Never thirsty, ever drinking,
+All in mail ever clinking.
+%
+All a man needs out of life is a place to sit 'n' spit in the fire.
+%
+All art is but imitation of nature.
+ -- Lucius Annaeus Seneca
+%
+All bad precedents began as justifiable measures.
+ -- Gaius Julius Caesar, quoted in "The Conspiracy of
+ Catiline", by Sallust
+%
+All bridge hands are equally likely, but some are more equally likely
+than others.
+ -- Alan Truscott
+%
+All business is based on the mutual trust of one of the parts.
+ -- Poul Henningsen (1894-1967)
+%
+All constants are variables.
+%
+All diplomacy is a continuation of war by other means.
+ -- Chou En Lai
+%
+All extremists should be taken out and shot.
+%
+All Finagle Laws may be bypassed by learning the simple art of doing
+without thinking.
+%
+All flesh is grass.
+ -- Isaiah 40:6
+Smoke a friend today.
+%
+All generalizations are false, including this one.
+ -- Mark Twain
+%
+All God's children are not beautiful. Most of God's children are, in fact,
+barely presentable.
+ -- Fran Lebowitz, "Metropolitan Life"
+%
+All Gods were immortal.
+ -- Stanislaw J. Lec, "Unkempt Thoughts"
+%
+All great discoveries are made by mistake.
+ -- Young
+%
+All great ideas are controversial, or have been at one time.
+%
+All heiresses are beautiful.
+ -- John Dryden
+%
+All his life he has looked away... to the horizon, to the sky,
+to the future. Never his mind on where he was, on what he was doing.
+ -- Yoda
+%
+All hope abandon, ye who enter here!
+ -- Dante Alighieri
+%
+All I ask is a chance to prove that money can't make me happy.
+%
+All I ask of life is a constant and exaggerated sense of my own
+importance.
+%
+All I kin say is when you finds yo'self wanderin' in a peach orchard,
+ya don't go lookin' for rutabagas.
+ -- Kingfish
+%
+All I know is what the words know, and dead things, and that
+makes a handsome little sum, with a beginning and a middle and
+an end, as in the well-built phrase and the long sonata of the dead.
+ -- Samuel Beckett
+%
+All I need to have a good time,
+Is a reefer, a woman and a bottle of wine.
+With those three things I don't need no sunshine,
+A reefer, a woman and a bottle of wine.
+
+All I want is to never grow old,
+I want to wash in a bathtub of gold.
+I want 97 kilos already rolled,
+I want to wash in a bathtub of gold.
+
+I want to light my cigars with 10 dollar bills,
+I like to have a cattle ranch in Beverly Hills.
+I want a bottle of Red Eye that's always filled,
+I like to have a cattle ranch in Beverly Hills.
+ -- Country Joe and the Fish, "Zachariah"
+%
+All I want is a warm bed and a kind word and unlimited power.
+ -- Ashleigh Brilliant
+%
+All intelligent species own cats.
+%
+All is fear in love and war.
+%
+All is well that ends well.
+ -- John Heywood
+%
+All I've got left on the list of desirable vocations is heiress to the
+throne of any country in Western Europe and Laurie Anderson. "Be
+practical", was the choral reply from the dinner table. Well, Laurie
+Anderson is already Laurie Anderson, but I read an article in Harpers
+that said there were eleven countries, in the world this is I think,
+that have queens as sovereign rulers. That's probably my best shot.
+%
+All kings is mostly rapscallions.
+ -- Mark Twain
+%
+All laws are simulations of reality.
+ -- John C. Lilly
+%
+All life evolves by the differential survival of replicating entities.
+ -- Richard Dawkins
+%
+All men are mortal. Socrates was mortal. Therefore, all men are
+Socrates.
+ -- Woody Allen
+%
+All men have the right to wait in line.
+%
+All men know the utility of useful things;
+but they do not know the utility of futility.
+ -- Chuang Tzu
+%
+All men profess honesty as long as they can.
+To believe all men honest would be folly.
+To believe none so is something worse.
+ -- John Quincy Adams
+%
+All most men really want in life is a wife, a house, two kids and a car,
+a cat, no maybe a dog. Ummm, scratch one of the kids and add a dog.
+Definitely a dog.
+%
+All most people ask of life is a constant
+and exaggerated sense of their own importance.
+%
+All most people want is a little more than they'll ever get.
+%
+All my friends and I are crazy.
+That's the only thing that keeps us sane.
+%
+All my friends are getting married,
+Yes, they're all growing old,
+They're all staying home on the weekend,
+They're all doing what they're told.
+%
+All my life I wanted to be someone; I guess I should have been more specific.
+ -- Jane Wagner
+%
+ALL NEW:
+ Parts not interchangeable with previous model.
+%
+All newspaper editorial writers ever do is come down from
+the hills after the battle is over and shoot the wounded.
+%
+All of the animals except man know that
+the principal business of life is to enjoy it.
+%
+All of the people in my building are insane. The guy above me designs
+synthetic hairballs for ceramic cats. The lady across the hall tried to
+rob a department store... with a pricing gun... She said, "Give me all
+of the money in the vault, or I'm marking down everything in the store."
+ -- Steven Wright
+%
+All of the true things I am about to tell you are shameless lies.
+ -- Kurt Vonnegut, Jr., "The Book of Bokonon"
+%
+All of us should treasure his Oriental wisdom and his preaching of a
+Zen-like detachment, as exemplified by his constant reminder to clerks,
+tellers, or others who grew excited by his presence in their banks:
+"Just lie down on the floor and keep calm."
+ -- Robert Wilson, "John Dillinger Died for You"
+%
+All other things being equal, a bald man cannot be elected President of
+the United States.
+ -- Vic Gold
+%
+All parts should go together without forcing. You must remember that the
+parts you are reassembling were disassembled by you. Therefore, if you
+can't get them together again, there must be a reason. By all means, do
+not use a hammer.
+ -- IBM maintenance manual, 1925
+%
+All people are born alike -- except Republicans and Democrats.
+ -- Groucho Marx
+%
+All phone calls are obscene.
+ -- Karen Elizabeth Gordon
+%
+All possibility of understanding is rooted in the ability to say no.
+ -- Susan Sontag
+%
+All power corrupts, but we need electricity.
+%
+All programmers are optimists. Perhaps this modern sorcery especially attracts
+those who believe in happy endings and fairy godmothers. Perhaps the hundreds
+of nitty frustrations drive away all but those who habitually focus on the end
+goal. Perhaps it is merely that computers are young, programmers are younger,
+and the young are always optimists. But however the selection process works,
+the result is indisputable: "This time it will surely run," or "I just found
+the last bug."
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+All programmers are playwrights and all computers are lousy actors.
+%
+All progress is based upon a universal innate desire of every organism
+to live beyond its income.
+ -- Samuel Butler, "Notebooks"
+%
+All science is either physics or stamp collecting.
+ -- Ernest Rutherford
+%
+All seems condemned in the long run
+to approximate a state akin to Gaussian noise.
+ -- James Martin
+%
+All snakes who wish to remain in Ireland will please raise their right hands.
+ -- Saint Patrick
+%
+All syllogisms have three parts, therefore this is not a syllogism.
+%
+All that glitters has a high refractive index.
+%
+All that glitters is not gold; all that wander are not lost.
+%
+All that is gold does not glitter,
+Not all those who wander are lost;
+The old that is strong does not wither,
+Deep roots are not reached by the frost.
+From the ashes a fire shall be woken,
+A light from the shadows shall spring;
+Renewed shall be blade that was broken,
+The crownless again shall be king.
+ -- J. R. R. Tolkien
+%
+All the big corporations depreciate their possessions, and you can,
+too, provided you use them for business purposes. For example, if you
+subscribe to the Wall Street Journal, a business-related newspaper, you
+can deduct the cost of your house, because, in the words of U.S.
+Supreme Court Chief Justice Warren Burger in a landmark 1979 tax
+decision: "Where else are you going to read the paper? Outside? What
+if it rains?"
+ -- Dave Barry, "Sweating Out Taxes"
+%
+All the evidence concerning the universe
+has not yet been collected, so there's still hope.
+%
+All the lines have been written There's been Sandburg,
+It's sad but it's true Keats, Poe and McKuen
+With all the words gone, They all had their day
+What's a young poet to do? And knew what they're doin'
+
+But of all the words written The bird is a strange one,
+And all the lines read, So small and so tender
+There's one I like most, Its breed still unknown,
+And by a bird it was said! Not to mention its gender.
+
+It reminds me of days of So what is this line
+Both gloom and of light. Whose author's unknown
+It still lifts my spirits And still makes me giggle
+And starts the day right. Even now that I'm grown?
+
+I've read all the greats
+Both starving and fat,
+But none was as great as
+"I tot I taw a puddy tat."
+ -- Etta Stallings, "An Ode To Childhood"
+%
+All the men on my staff can type.
+ -- Bella Abzug
+%
+...all the modern inconveniences...
+ -- Mark Twain
+%
+All the passions make us commit faults; love makes us commit the most
+ridiculous ones.
+ -- Francois de La Rochefoucauld
+%
+All the really good ideas I ever had came to me while I was milking a cow.
+ -- Grant Wood
+%
+All the simple programs have been written.
+%
+All the taxes paid over a lifetime by the average American are spent by
+the government in less than a second.
+ -- Jim Fiebig
+%
+All the troubles you have will pass away very quickly.
+%
+All the world's a stage and most of us are desperately un-rehearsed.
+ -- Sean O'Casey
+%
+All the world's a VAX,
+And all the coders merely butchers;
+They have their exits and their entrails;
+And one int in his time plays many widths,
+His sizeof being _N bytes. At first the infant,
+Mewling and puking in the Regent's arms.
+And then the whining schoolboy, with his Sun,
+And shining morning face, creeping like slug
+Unwillingly to school.
+ -- A Very Annoyed PDP-11
+%
+All theoretical chemistry is really physics;
+and all theoretical chemists know it.
+ -- Richard P. Feynman
+%
+All things are possible, except for skiing through a revolving door.
+%
+All things being equal, you are bound to lose.
+%
+All things that are, are with more spirit chased than enjoyed.
+ -- William Shakespeare, "Merchant of Venice"
+%
+All this wheeling and dealing around, why, it isn't for money,
+it's for fun. Money's just the way we keep score.
+ -- Henry Tyroon
+%
+All true wisdom is found on T-shirts.
+%
+All warranty and guarantee clauses
+become null and void upon payment of invoice.
+%
+All wars are civil wars, because all men are brothers ... Each one owes
+infinitely more to the human race than to the particular country in
+which he was born.
+ -- Francois Fenelon
+%
+All we know is the phenomenon: we spend our time sending messages to each
+other, talking and trying to listen at the same time, exchanging information.
+This seems to be our most urgent biological function; it is what we do with
+our lives."
+ -- Lewis Thomas, "The Lives of a Cell"
+%
+All who joy would win Must share it --
+Happiness was born a twin.
+ -- Lord Byron
+%
+All your files have been destroyed (sorry). Paul.
+%
+All [zoos] actually offer to the public in return for the taxes spent
+upon them is a form of idle and witless amusement, compared to which a
+visit to a penitentiary, or even to a State legislature in session, is
+informing, stimulating and ennobling.
+ -- H. L. Mencken
+%
+Allen's Axiom:
+ When all else fails, read the instructions.
+%
+Alliance, n.:
+ In international politics, the union of two thieves who have
+ their hands so deeply inserted in each other's pocket that they
+ cannot separately plunder a third.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+All's well that ends.
+%
+Almost anything derogatory you could say
+about today's software design would be accurate.
+ -- K. E. Iverson
+%
+Alone, adj.:
+ In bad company.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Also, the Scots are said to have invented golf. Then they had
+to invent Scotch whiskey to take away the pain and frustration.
+%
+alta, v: To change; make or become different; modify.
+ansa, v: A spoken or written reply, as to a question.
+baa, n: A place people meet to have a few drinks.
+Baaston, n: The capital of Massachusetts.
+baaba, n: One whose business is to cut or trim hair or beards.
+beea, n: An alcoholic beverage brewed from malt and hops, often
+ found in baas.
+caaa, n: An automobile.
+centa, n: A point around which something revolves; axis. (Or
+ someone involved with the Knicks.)
+chouda, n: A thick seafood soup, often in a milk base.
+dada, n: Information, esp. information organized for analysis or
+ computation.
+ -- Massachewsetts Unabridged Dictionary
+%
+Although golf was originally restricted to wealthy, overweight
+Protestants, today it's open to anybody who owns hideous clothing.
+ -- Dave Barry
+%
+Although it is still a truism in industry that "no one was ever fired for
+buying IBM," Bill O'Neil, the chief technology officer at Drexel Burnham
+Lambert, says he knows for a fact that someone has been fired for just that
+reason. He knows it because he fired the guy.
+ "He made a bad decision, and what it came down to was, 'Well, I
+bought it because I figured it was safe to buy IBM,'" Mr. O'Neil says.
+"I said, 'No. Wrong. Game over. Next contestant, please.'"
+ -- The Wall Street Journal, December 6, 1989
+%
+Although the moon is smaller than the earth, it is farther away.
+%
+Although we modern persons tend to take our electric lights, radios,
+mixers, etc., for granted, hundreds of years ago people did not have
+any of these things, which is just as well because there was no place
+to plug them in. Then along came the first Electrical Pioneer,
+Benjamin Franklin, who flew a kite in a lighting storm and received a
+serious electrical shock. This proved that lighting was powered by the
+same force as carpets, but it also damaged Franklin's brain so severely
+that he started speaking only in incomprehensible maxims, such as "A
+penny saved is a penny earned." Eventually he had to be given a job
+running the post office.
+ -- Dave Barry, "What is Electricity?"
+%
+Although written many years ago, Lady Chatterley's Lover has just been
+reissued by the Grove Press, and this pictorial account of the day-to-day
+life of an English gamekeeper is full of considerable interest to outdoor
+minded readers, as it contains many passages on pheasant-raising, the
+apprehending of poachers, ways to control vermin, and other chores and duties
+of the professional gamekeeper. Unfortunately, one is obliged to wade
+through many pages of extraneous material in order to discover and savour
+those sidelights on the management of a midland shooting estate, and in this
+reviewer's opinion the book cannot take the place of J. R. Miller's "Practical
+Gamekeeping."
+ -- Ed Zern, "Field and Stream" (Nov. 1959)
+%
+Always borrow money from a pessimist; he doesn't expect to be paid back.
+%
+Always do right. This will gratify some people and astonish the rest.
+ -- Mark Twain
+%
+Always draw your curves, then plot your reading.
+%
+Always leave room to add an explanation if it doesn't work out.
+%
+Always run from a knife and rush a gun.
+ -- Jimmy Hoffa
+%
+Always store beer in a dark place.
+%
+Always the dullness of the fool is the whetstone of the wits.
+ -- William Shakespeare, "As You Like It"
+%
+Always there remain portions of our heart
+into which no one is able to enter, invite them as we may.
+%
+Always think of something new; this
+helps you forget your last rotten idea.
+ -- Seth Frankel
+%
+Always try to do things in chronological order; it's less confusing
+that way.
+%
+Am I ranting? I hope so. My ranting gets raves.
+%
+AMAZING BUT TRUE...
+ If all the salmon caught in Canada in one year were laid end to
+ end across the Sahara Desert, the smell would be absolutely awful.
+%
+AMAZING BUT TRUE...
+ There is so much sand in Northern Africa that if it
+ were spread out it would completely cover the Sahara Desert.
+%
+Ambidextrous, adj.:
+ Able to pick with equal skill a right-hand pocket or a left.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+AMBIGUITY:
+ Telling the truth when you don't mean to.
+%
+Ambition is a poor excuse for not having sense enough to be lazy.
+ -- Charlie McCarthy
+%
+Ambition, n.:
+ An overmastering desire to be vilified by enemies while
+ living and made ridiculous by friends when dead.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+America: born free and taxed to death.
+%
+America has been discovered before, but it has always been hushed up.
+ -- Oscar Wilde
+%
+America, how can I write a holy litany in your silly mood?
+ -- Allen Ginsberg
+%
+America is a melting pot. You know, where those on the bottom get burned,
+and the scum rises to the top.
+ -- Utah Phillips
+%
+America is a stronger nation for the ACLU's uncompromising effort.
+ -- President John F. Kennedy
+
+The simple rights, the civil liberties from generations of struggle must not
+be just fine words for patriotic holidays, words we subvert on weekdays, but
+living, honored rules of conduct amongst us...I'm glad the American Civil
+Liberties Union gets indignant, and I hope this will always be so.
+ -- Adlai E. Stevenson
+
+The ACLU has stood foursquare against the recurring tides of hysteria that
+from time to time threaten freedoms everywhere... Indeed, it is difficult
+to appreciate how far our freedoms might have eroded had it not been for the
+Union's valiant representation in the courts of the constitutional rights
+of people of all persuasions, no matter how unpopular or even despised
+by the majority they were at the time.
+ -- former Supreme Court Chief Justice Earl Warren
+%
+America is the country where you buy a lifetime
+supply of aspirin for one dollar, and use it up in two weeks.
+%
+America may be unique in being a country which has leapt
+from barbarism to decadence without touching civilization.
+ -- John O'Hara
+%
+America was discovered by Amerigo Vespucci and was named after him, until
+people got tired of living in a place called "Vespuccia" and changed its
+name to "America".
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+America works less, when you say "Union Yes!"
+%
+American business long ago gave up on demanding that prospective
+employees be honest and hardworking. It has even stopped hoping for
+employees who are educated enough that they can tell the difference
+between the men's room and the women's room without having little
+pictures on the doors.
+ -- Dave Barry, "Urine Trouble, Mister"
+%
+American by birth; Texan by the grace of God.
+%
+American cars are made shoddily...
+Cars made overseas are far superior.
+ -- Barry Goldwater
+%
+[Americans] are a race of convicts and ought to be thankful for anything
+we allow them short of hanging.
+ -- Samuel Johnson
+
+America is a large friendly dog in a small room. Every time it wags its
+tail it knocks over a chair.
+ -- Arnold Toynbee
+
+The United States is like the guy at the party who gives cocaine to
+everybody and still nobody likes him.
+ -- Jim Samuels
+%
+Americans are people who insist on living in the present, tense.
+%
+Americans' greatest fear is that America will turn out
+to have been a phenomenon, not a civilization.
+ -- Shirley Hazzard, "Transit of Venus"
+%
+America's best buy for a quarter is a telephone call to the right person.
+%
+Amnesia used to be my favorite word, but then I forgot it.
+%
+AMOEBIT:
+ Amoeba/rabbit cross; it can multiply
+ and divide at the same time.
+%
+Among all savage beasts, none is found so harmful as woman.
+ -- St. John Chrysostom (304-407)
+%
+Among the lucky, you are the chosen one.
+%
+An acid is like a woman: a good one will eat through your pants.
+ -- Mel Gibson, Saturday Night Live
+%
+An actor's a guy who if you ain't talkin' about him, ain't listening.
+ -- Marlon Brando
+%
+An Ada exception is when a routine gets
+in trouble and says "Beam me up, Scotty."
+%
+An adequate bootstrap is a contradiction in terms.
+%
+An age is called Dark not because the light fails to shine, but because
+people refuse to see it.
+ -- James Michener, "Space"
+%
+An Aggie farmer was lifting his hogs, one by one, up to the branches of
+his apple trees to graze on the apples. A Texas student walked by and
+asked him, "Doesn't that take a lot of time?"
+ Replied the Aggie, "What's time to a hog?"
+%
+An alcoholic is someone you don't like who drinks as much as you do.
+ -- Dylan Thomas
+%
+An algorithm must be seen to be believed.
+ -- Donald E. Knuth
+%
+An ambassador is an honest man sent abroad
+to lie and intrigue for the benefit of his country.
+ -- Sir Henry Wotton (1568-1639)
+%
+An amendment to a motion may be amended, but an amendment to an amendment
+to a motion may not be amended. However, a substitute for an amendment to
+and amendment to a motion may be adopted and the substitute may be amended.
+ -- The Montana legislature's contribution to the English
+ language.
+%
+An American is a man with two arms and four wheels.
+ -- A Chinese child
+%
+An American scientist once visited the offices of the great Nobel prize
+winning physicist, Niels Bohr, in Copenhagen. He was amazed to find that
+over Bohr's desk was a horseshoe, securely nailed to the wall, with the
+open end up in the approved manner (so it would catch the good luck and not
+let it spill out). The American said with a nervous laugh,
+ "Surely you don't believe the horseshoe will bring you good luck,
+do you, Professor Bohr? After all, as a scientist --"
+Bohr chuckled.
+ "I believe no such thing, my good friend. Not at all. I am
+scarcely likely to believe in such foolish nonsense. However, I am told
+that a horseshoe will bring you good luck whether you believe in it or not."
+%
+An American tourist is visiting Russia, and he's talking with a Russian
+about the fact that not many people in Russia own cars.
+
+American: "I can't believe you don't have cars here! How do you
+ get to work?"
+Russian: "We take the bus, or the subway. We have public
+ transportation everywhere."
+A: "Well, how do you go on vacations?"
+R: "We take the train."
+A: "Well, what if you want to go abroad?"
+R: "We don't ever want go abroad."
+A: "Well, what if you really HAVE to go abroad?"
+R: "We take tanks."
+%
+An American's a person who isn't afraid to criticize
+the president but is always polite to traffic cops.
+%
+An anthropologist at Tulane has just come back from a field trip to New
+Guinea with reports of a tribe so primitive that they have Tide but not
+new Tide with lemon-fresh Borax.
+ -- David Letterman
+%
+An aphorism is never exactly true;
+it is either a half-truth or one-and-a-half truths.
+ -- Karl Kraus
+%
+An appeaser is one who feeds a crocodile -- hoping that it will eat
+him last.
+ -- Sir Winston Churchill, 1954
+%
+An apple a day makes 365 apples a year.
+%
+An apple every eight hours will keep three doctors away.
+%
+An artist should be fit for the best society and keep out of it.
+%
+An atheist is a man with no invisible means of support.
+%
+An atom-blaster is a good weapon, but it can point both ways.
+ -- Isaac Asimov
+%
+An attachment a la Plato
+for a bashful young potato
+or a, not too French, french bean
+must excite your languid spleen.
+For, if you walk down Picadilly
+with a poppy or lily
+in your medieval hand,
+every one will say,
+as you walk your flowery way;
+"If this young man is content,
+with a vegetable love
+which would certainly not content me.
+Why, what a very pure young man
+this pure young man must be!"
+ -- W. S. Gilbert, "Patience"
+ [The subject of the humour is of course, Oscar Wilde]
+%
+An attorney was defending his client against a charge of first-degree
+murder. "Your Honor, my client is accused of stuffing his lover's
+mutilated body into a suitcase and heading for the Mexican border.
+Just north of Tijuana a cop spotted her hand sticking out of the
+suitcase. Now, I would like to stress that my client is *not* a
+murderer. A sloppy packer, maybe..."
+%
+An authority is a person who can tell you more about something than you
+really care to know.
+%
+An avocado-tone refrigerator would look good on your resume.
+%
+An economist is a man who would marry
+Farrah Fawcett-Majors for her money.
+%
+An editor is one who separates the wheat from the chaff and prints the chaff.
+ -- Adlai E. Stevenson
+%
+An effective way to deal with predators is to taste terrible.
+%
+An efficient and a successful administration manifests
+itself equally in small as in great matters.
+ -- Winston Churchill
+%
+An egghead is one who stands firmly on both feet,
+in mid-air, on both sides of an issue.
+ -- Homer Ferguson
+%
+An elderly couple were flying to their Caribbean hideaway on a chartered plane
+when a terrible storm forced them to land on an uninhabited island. When
+several days passed without rescue, the couple and their pilot sank into a
+despondent silence. Finally, the woman asked her husband if he had made his
+usual pledge to the United Way Campaign.
+ "We're running out of food and water and you ask *that*?" her husband
+barked. "If you really need to know, I not only pledged a half million but
+I've already paid them half of it."
+ "You owe the U.W.C. a *quarter million*?" the woman exclaimed
+euphorically. "Don't worry, Harry, they'll find us! They'll find us!"
+%
+An elephant is a mouse with an operating system.
+%
+An engineer, a physicist and a mathematician find themselves in an
+anecdote, indeed an anecdote quite similar to many that you have no doubt
+already heard. After some observations and rough calculations the
+engineer realizes the situation and starts laughing. A few minutes later
+the physicist understands too and chuckles to himself happily as he now
+has enough experimental evidence to publish a paper. This leaves the
+mathematician somewhat perplexed, as he had observed right away that he
+was the subject of an anecdote, and deduced quite rapidly the presence of
+humour from similar anecdotes, but considers this anecdote to be too
+trivial a corollary to be significant, let alone funny.
+%
+An engineer is someone who does list processing in FORTRAN.
+%
+An English judge, growing weary of the barrister's long-winded
+summation, leaned over the bench and remarked, "I've heard your
+arguments, Sir Geoffrey, and I'm none the wiser!" Sir Geoffrey
+responded, "That may be, Milord, but at least you're better informed!"
+%
+An Englishman never enjoys himself, except for a noble purpose.
+ -- A. P. Herbert
+%
+An evil mind is a great comfort.
+%
+An excellence-oriented '80s male does not wear a regular watch. He wears
+a Rolex watch, because it weighs nearly six pounds and is advertised
+only in excellence-oriented publications such as Fortune and Rich
+Protestant Golfer Magazine. The advertisements are written in
+incomplete sentences, which is how advertising copywriters denote
+excellence:
+
+"The Rolex Hyperion. An elegant new standard in quality excellence and
+discriminating handcraftsmanship. For the individual who is truly able
+to discriminate with regard to excellent quality standards of crafting
+things by hand. Fabricated of 100 percent 24-karat gold. No watch
+parts or anything. Just a great big chunk on your wrist. Truly a
+timeless statement. For the individual who is very secure. Who
+doesn't need to be reminded all the time that he is very successful.
+Much more successful than the people who laughed at him in high
+school. Because of his acne. People who are probably nowhere near as
+successful as he is now. Maybe he'll go to his 20th reunion, and
+they'll see his Rolex Hyperion. Hahahahahahahahaha."
+ -- Dave Barry, "In Search of Excellence"
+%
+An exotic journey in downtown Newark is in your future.
+%
+...an experienced, industrious, ambitious, and quite often
+picturesque liar.
+ -- Mark Twain
+%
+An expert is a man who has made all the mistakes which can be made, in a
+very narrow field.
+ -- Niels Bohr
+%
+An expert is a person who avoids the small errors
+as he sweeps on to the grand fallacy.
+ -- Benjamin Stolberg
+%
+An expert is one who knows more and more about less
+and less until he knows absolutely nothing about everything.
+%
+An eye in a blue face
+Saw an eye in a green face.
+"That eye is like this eye"
+Said the first eye,
+"But in low place,
+Not in high place."
+%
+An Hacker there was, one of the finest sort
+Who controlled the system; graphics was his sport.
+A manly man, to be a wizard able;
+Many a protected file he had sitting on his table.
+His console, when he typed, a man might hear
+Clicking and feeping wind as clear,
+Aye, and as loud as does the machine room bell
+Where my lord Hacker was Prior of the cell.
+The Rule of good St Savage or St Doeppnor
+As old and strict he tended to ignore;
+He let go by the things of yesterday
+And took the modern world's more spacious way.
+He did not rate that text as a plucked hen
+Which says that Hackers are not holy men.
+And that a hacker underworked is a mere
+Fish out of water, flapping on the pier.
+That is to say, a hacker out of his cloister.
+That was a text he held not worth an oyster.
+And I agreed and said his views were sound;
+Was he to study till his head wend round
+Poring over books in the cloisters? Must he toil
+As Andy bade and till the very soil?
+Was he to leave the world upon the shelf?
+Let Andy have his labor to himself!
+ -- Chaucer
+ [well, almost. Ed.]
+%
+An honest politician is one who when he is bought will stay bought.
+ -- Simon Cameron
+
+There are honest journalists like there are honest politicians. When
+bought they stay bought.
+ -- Bill Moyers
+%
+An honest tale speeds best being plainly told.
+ -- William Shakespeare, "Henry VI"
+%
+An idea is an eye given by God for the seeing of God. Some of these
+eyes we cannot bear to look out of, we blind them as quickly as
+possible.
+ -- Russell Hoban, "Pilgermann"
+%
+An idea is not responsible for the people who believe in it.
+%
+An idealist is one who helps the other fellow to make a profit.
+ -- Henry Ford
+%
+An idle mind is worth two in the bush.
+%
+An infallible method of conciliating a tiger
+is to allow oneself to be devoured.
+ -- Konrad Adenauer
+%
+An intellectual is someone whose mind watches itself.
+ -- Albert Camus
+%
+An interpretation I satisfies a sentence in the table language if and only if
+each entry in the table designates the value of the function designated by the
+function constant in the upper-left corner applied to the objects designated
+by the corresponding row and column labels.
+ -- Genesereth & Nilsson,
+ "Logical foundations of Artificial Intelligence"
+%
+An investment in knowledge always pays the best interest.
+ -- Benjamin Franklin
+%
+An old man is lying on his deathbed with all his children, grandchildren and
+great-grandchildren gathered around, teary-eyed at the approaching finale of
+a deeply loved family member. The old man is in a light coma, and the doctors
+have confirmed that the waiting will be over within the next twenty-four
+hours. Suddenly, the old man opens his eyes whispers: "I must be dreaming
+of heaven... I smell my daughter Lisle's strudel."
+ "No, no, grandfather, you are not dreaming", he is reassured.
+"Grandmother is baking strudel right now."
+ A faint smile crosses the old man's face. "Go and get me a sliver of
+strudel," he says, "she bakes the finest strudel in the world."
+ One of the grandchildren is immediately dispatched to honor the old
+man's request, and, after what seems a long time, he returns empty-handed.
+ "Did you bring me some of Lisle's strudel?", the old man quavers.
+ "I'm... I'm very sorry, grandfather, but she says it's for the
+funeral."
+%
+An optimist is a guy that has never had much experience.
+ -- Don Marquis
+%
+An optimist is a man who looks forward to marriage.
+A pessimist is a married optimist.
+%
+An ounce of clear truth is worth a pound of obfuscation.
+%
+An ounce of hypocrisy is worth a pound of ambition.
+ -- Michael Korda
+%
+An ounce of mother is worth a ton of priest.
+ -- Spanish proverb
+%
+An ounce of prevention is worth a pound of purge.
+%
+Anarchy may not be the best form of government, but it's better than no
+government at all.
+%
+And all that the Lorax left here in this mess
+was a small pile of rocks with the one word, "unless."
+Whatever THAT meant, well, I just couldn't guess.
+That was long, long ago, and each day since that day,
+I've worried and worried and worried away.
+Through the years as my buildings have fallen apart,
+I've worried about it with all of my heart.
+
+"BUT," says the Oncler, "now that you're here,
+the word of the Lorax seems perfectly clear!
+UNLESS someone like you cares a whole awful lot,
+nothing is going to get better - it's not.
+So... CATCH!" cries the Oncler. He lets something fall.
+"It's a truffula seed. It's the last one of all!
+
+"You're in charge of the last of the truffula seeds.
+And truffula trees are what everyone needs.
+Plant a new truffula -- treat it with care.
+Give it clean water and feed it fresh air.
+Grow a forest -- protect it from axes that hack.
+Then the Lorax and all of his friends may come back!"
+ -- Dr. Seuss, "The Lorax"
+%
+And as we stand on the edge of darkness
+Let our chant fill the void
+That others may know
+
+ In the land of the night
+ The ship of the sun
+ Is drawn by
+ The grateful dead.
+ -- Tibetan "Book of the Dead," ca. 4000 BC.
+%
+And did those feet, in ancient times,
+Walk upon England's mountains green?
+And was the Holy Lamb of God
+In England's pleasant pastures seen?
+And did the Countenance Divine
+Shine forth upon these crowded hills?
+And was Jerusalem builded here
+Among these dark satanic mills?
+
+Bring me my bow of burning gold!
+Bring me my arrows of desire!
+Bring me my spears! O clouds unfold!
+Bring me my chariot of fire!
+I shall not cease from mental fight,
+Nor shall my sword rest in my hand,
+Till we have built Jerusalem
+In England's green and pleasant land.
+ -- William Blake, "Jerusalem"
+%
+And do you think (fop that I am) that I could be the Scarlet Pumpernickel?
+%
+And ever has it been known that
+love knows not its own depth until the hour of separation.
+ -- Kahlil Gibran
+%
+And he climbed with the lad up the Eiffelberg Tower. "This," cried the Mayor,
+"is your town's darkest hour! The time for all Whos who have blood that is red
+to come to the aid of their country!" he said. "We've GOT to make noises in
+greater amounts! So, open your mouth, lad! For every voice counts!" Thus he
+spoke as he climbed. When they got to the top, the lad cleared his throat and
+he shouted out, "YOPP!"
+ And that Yopp... That one last small, extra Yopp put it over!
+Finally, at last! From the speck on that clover their voices were heard!
+They rang out clear and clean. And they elephant smiled. "Do you see what
+I mean?" They've proved they ARE persons, no matter how small. And their
+whole world was saved by the smallest of All!"
+ "How true! Yes, how true," said the big kangaroo. "And, from now
+on, you know what I'm planning to do? From now on, I'm going to protect
+them with you!" And the young kangaroo in her pouch said, "ME TOO! From
+the sun in the summer. From rain when it's fall-ish, I'm going to protect
+them. No matter how small-ish!"
+ -- Dr. Seuss, "Horton Hears a Who"
+%
+And here I wait so patiently
+Waiting to find out what price
+You have to pay to get out of
+Going thru all of these things twice
+ -- Dylan, "Memphis Blues Again"
+%
+And I alone am returned to wag the tail.
+%
+And I heard Jeff exclaim,
+As they strolled out of sight,
+"Merry Christmas to all --
+You take credit cards, right?"
+ -- "Outsiders" comic
+%
+And I suppose the little things are harder to get used to than the big
+ones. The big ones you get used to, you make up your mind to them. The
+little things come along unexpectedly, when you aren't thinking about
+them, aren't braced against them.
+ -- Marion Zimmer Bradley, "The Forbidden Tower"
+%
+And I will do all these good works, and I will do them for free!
+My only reward will be a tombstone that says "Here lies Gomez
+Addams -- he was good for nothing."
+ -- Jack Sharkey, The Addams Family
+%
+And if California slides into the ocean,
+Like the mystics and statistics say it will.
+I predict this motel will be standing,
+Until I've paid my bill.
+ -- Warren Zevon, "Desperados Under the Eaves"
+%
+And if sometime, somewhere, someone asketh thee,
+"Who kilt thee?", tell them it 'twas the Doones of Bagworthy!
+%
+And if you wonder,
+What I am doing,
+As I am heading for the sink.
+I am spitting out all the bitterness,
+Along with half of my last drink.
+%
+And in the heartbreak years that lie ahead,
+Be true to yourself and the Grateful Dead.
+ -- Joan Baez
+%
+And it should be the law: If you use the word `paradigm' without knowing
+what the dictionary says it means, you go to jail. No exceptions.
+ -- David Jones
+%
+And malt does more than Milton can to justify God's ways to man.
+ -- A. E. Housman
+%
+And miles to go before I sleep.
+%
+And now for something completely the same.
+%
+And now your toner's toney, Disk blocks aplenty
+And your paper near pure white, Await your laser drawn lines,
+The smudges on your soul are gone Your intricate fonts,
+And your output's clean as light.. Your pictures and signs.
+
+We've labored with your father, Your amputative absence
+The venerable XGP, Has made the Ten dumb,
+But his slow artistic hand, Without you, Dover,
+Lacks your clean velocity. We're system untounged-
+
+Theses and papers DRAW Plots and TEXage
+And code in a queue Have been biding their time,
+Dover, oh Dover, With LISP code and programs,
+We've been waiting for you. And this crufty rhyme.
+
+Dover, oh Dover, Dover, oh Dover, arisen from dead.
+We welcome you back, Dover, oh Dover, awoken from bed.
+Though still you may jam, Dover, oh Dover, welcome back to the Lab.
+You're on the right track. Dover, oh Dover, we've missed your clean
+ hand...
+%
+And on the eighth day, we bulldozed it.
+%
+And on the seventh day, He exited from append mode.
+%
+And remember: if you don't like the news, go out and make some of
+your own.
+ -- "Scoop" Nisker, KFOG radio reporter
+ Preposterous Words
+%
+...and report cards I was always afraid to show
+Mama'd come to school
+and as I'd sit there softly cryin'
+Teacher'd say he's just not tryin'
+Got a good head if he'd apply it
+but you know yourself
+it's always somewhere else
+I'd build me a castle
+with dragons and kings
+and I'd ride off with them
+As I stood by my window
+and looked out on those
+Brooklyn roads
+ -- Neil Diamond, "Brooklyn Roads"
+%
+And so it was, later,
+As the miller told his tale,
+That her face, at first just ghostly,
+Turned a whiter shade of pale.
+ -- Procol Harum
+%
+And so, men, we can see that human skin is an even more complex and
+fascinating organ than we thought it was, and if we want to keep it
+looking good, we have to care for it as though it were our own. One
+approach is to undergo a painful surgical procedure wherein your skin
+is turned inside-out, so the young cells are on the outside, but then
+of course you have the unpleasant side effect that your insides
+gradually fill up with dead old cells and you explode. So this
+procedure is pretty much limited to top Hollywood stars for whom
+youthful beauty is a career necessity, such as Elizabeth Taylor and
+Orson Welles.
+ -- Dave Barry, "Saving Face"
+%
+And that's the way it is...
+ -- Walter Cronkite
+%
+And the crowd was stilled. One elderly man, wondering at the sudden silence,
+turned to the Child and asked him to repeat what he had said. Wide-eyed,
+the Child raised his voice and said once again, "Why, the Emperor has no
+clothes! He is naked!"
+ -- "The Emperor's New Clothes"
+%
+And the French medical anatomist Etienne Serres really did argue that
+black males are primitive because the distance between their navel and
+penis remains small (relative to body height) throughout life, while
+white children begin with a small separation but increase it during
+growth -- the rising belly button as a mark of progress.
+ -- S. J. Gould, "Racism and Recapitulation"
+%
+And the silence came surging softly backwards
+When the plunging hooves were gone...
+ -- Walter de La Mare, "The Listeners"
+%
+And they shall beat their swords into plowshares, for if you hit a man
+with a plowshare, he's going to know he's been hit.
+%
+And this is a table ma'am. What in essence it consists of is a horizontal
+rectilinear plane surface maintained by four vertical columnar supports,
+which we call legs. The tables in this laboratory, ma'am, are as advanced
+in design as one will find anywhere in the world.
+ -- Michael Frayn, "The Tin Men"
+%
+And this is good old Boston,
+The home of the bean and the cod,
+Where the Lowells talk only to Cabots,
+And the Cabots talk only to God.
+%
+And tomorrow will be like today, only more so.
+ -- Isaiah 56:12, New Standard Version
+%
+And we heard him exclaim
+As he started to roam:
+"I'm a hologram, kids,
+please don't try this at home!'"
+ -- Bob Violence
+%
+And what accomplished villains these old engineers were! What diabolical
+ways to sabotage they found! Nikolai Karlovich von Meck, of the People's
+Commissariat of Railroads ... would hold forth for hours on end about the
+economic problems involved in the construction of socialism, and he loved to
+give advice. One such pernicious piece of advice was to increase the size
+of freight trains and not worry about heavier than average loads. The GPU
+exposed van Meck, and he was shot: his objective had been to wear out rails
+and roadbeds, freight cars and locomotives, so as to leave the Republic
+without railroads in case of foreign military intervention! When, not long
+afterward, the new People's Commissar of Railroads ordered that average
+loads should be increased, and even doubled and tripled them, the malicious
+engineers who protested became known as limiters ... they were rightly
+shot for their lack of faith in the possibilities of socialist transport.
+ -- Aleksandr I. Solzhenitsyn, "The Gulag Archipelago"
+%
+And... What in the world ever became of Sweet Jane?
+ She's lost her sparkle, you see she isn't the same.
+ Livin' on reds, vitamin C, and cocaine
+ All a friend can say is "Ain't it a shame?"
+ -- The Grateful Dead
+%
+And yet I should have dearly liked, I own, to have touched her lips; to
+have questioned her, that she might have opened them; to have looked upon
+the lashes of her downcast eyes, and never raised a blush; to have let
+loose waves of hair, an inch of which would be a keepsake beyond price:
+in short, I should have liked, I do confess, to have had the lightest
+license of a child, and yet been man enough to know its value.
+ -- Charles Dickens
+%
+And yet, seasons must be taken with a grain of salt, for they too have a
+sense of humor, as does history. Corn stalks comedy, comedy stalks tragedy,
+and this too is historic. And yet, still, when corn meets tragedy face to
+face, we have politics.
+ -- Dalglish, Larsen and Sutherland,
+ "Root Crops and Ground Cover"
+%
+And you can't get any Watney's Red Barrel,
+because the bars close every time you're thirsty...
+%
+"And, you know, I mustn't preach to you, but surely it wouldn't be right for
+you to take away people's pleasure of studying your attire, by just going
+and making yourself like everybody else. You feel that, don't you?" said
+he, earnestly.
+ -- William Morris, "Notes from Nowhere"
+%
+Andrea: Unhappy the land that has no heroes.
+Galileo: No, unhappy the land that _n_e_e_d_s heroes.
+ -- Bertolt Brecht, "Life of Galileo"
+%
+Andrea's Admonition:
+ Never bestow profanity upon a driver who has wronged you.
+ If you think his window is closed and he can't hear you,
+ it isn't and he can.
+%
+ANDROPHOBIA:
+ Fear of men.
+%
+Angels we have heard on High
+Tell us to go out and Buy.
+ -- Tom Lehrer
+%
+Anger is momentary madness.
+ -- Horace
+%
+Anger kills as surely as the other vices.
+%
+Animals can be driven crazy by putting too many in too small a pen.
+Homo sapiens is the only animal that voluntarily does this to himself.
+ -- Lazarus Long
+%
+Ankh if you love Isis.
+%
+Announcing the NEW VAX 11/782!!
+
+Be the envy of other major Communist Governments!
+
+Defend yourself against the entire ICBM force of the imperialist USA with
+just one of the processors, at the same time you're designing missile ICs,
+cracking secret NATO codes and editing propaganda for your own people all
+at the same time with the other! (Well, you really can't, but the Americans
+think you can, and that's the point, right?)
+%
+Anoint, v.:
+ To grease a king or other great functionary already sufficiently
+ slippery.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Another day, another dollar.
+ -- Vincent J. Fuller, defense lawyer for John Hinckley,
+ upon Hinckley's acquittal for shooting President Ronald
+ Reagan.
+%
+Another flaw in the human character is that everybody wants to build
+and nobody wants to do maintenance.
+ -- Kurt Vonnegut, Jr., "Hocus Pocus"
+%
+Another good night not to sleep in a eucalyptus tree.
+%
+Another megabytes the dust.
+%
+Another possible source of guidance for teenagers is television, but
+television's message has always been that the need for truth, wisdom
+and world peace pales by comparison with the need for a toothpaste that
+offers whiter teeth *_a_n_d* fresher breath.
+ -- Dave Barry, "Kids Today: They Don't Know Dum Diddly Do"
+%
+Another such victory over the Romans, and we are undone.
+ -- Pyrrhus
+%
+Answer a fool according to his folly, lest he be wise in his own conceit.
+ -- Proverbs 26:5
+%
+Anthony's Law of Force:
+ Don't force it; get a larger hammer.
+%
+Anthony's Law of the Workshop:
+ Any tool when dropped, will roll into the least accessible
+ corner of the workshop.
+
+Corollary:
+ On the way to the corner, any dropped tool will first strike
+ your toes.
+%
+Antique fairy tale: Little Red Riding Hood.
+Modern fairy tale: Oswald, acting alone, shot Kennedy.
+%
+Anti-trust laws should be approached with exactly that attitude.
+%
+Antonio Antonio
+Was tired of living alonio
+He thought he would woo Antonio Antonio
+Miss Lucamy Lu, Rode off on his polo ponio
+Miss Lucamy Lucy Molonio. And found the maid
+ In a bowery shade,
+ Sitting and knitting alonio.
+Antonio Antonio
+Said if you will be my ownio
+I'll love you true Oh nonio Antonio
+And buy for you You're far too bleak and bonio
+An icery creamry conio. And all that I wish
+ You singular fish
+ Is that you will quickly begonio.
+Antonio Antonio
+Uttered a dismal moanio
+And went off and hid
+Or I'm told that he did
+In the Antarctical Zonio.
+%
+Antonym, n.:
+ The opposite of the word you're trying to think of.
+%
+Anxious after the delay, Gruber doesn't waste any time getting the Koenig
+[a modified Porsche] up to speed, and almost immediately we are blowing off
+Alfas, Fiats, and Lancias full of excited Italians. These people love fast
+cars. But they love sport too and no passing encounter goes unchallenged.
+Nothing serious, just two wheels into your lane as you're bearing down on
+them at 130-plus -- to see if you're paying attention.
+ -- Road & Track article about driving two absurdly fast
+ cars across Europe.
+%
+Any circuit design must contain at least one part which is obsolete, two parts
+which are unobtainable, and three parts which are still under development.
+%
+Any clod can have the facts, but having opinions is an art.
+ -- Charles McCabe
+%
+Any coward can sit in his home and criticize a pilot for flying into a
+mountain in a fog. But I would rather, by far, die on a mountainside
+than in bed. What kind of man would live where there is no daring?
+And is life so dear that we should blame men for dying in adventure?
+Is there a better way to die?
+ -- Charles Lindbergh
+%
+Any dramatic series the producers want us to take seriously as a
+representation of contemporary reality cannot be taken seriously as a
+representation of anything -- except a show to be ignored by anyone
+capable of sitting upright in a chair and chewing gum simultaneously.
+ -- Richard Schickel
+%
+Any excuse will serve a tyrant.
+ -- Aesop
+%
+Any father who thinks he's all important should remind himself that this
+country honors fathers only one day a year while pickles get a whole week.
+%
+Any fool can paint a picture, but it takes a
+wise person to be able to sell it.
+%
+Any fool can tell the truth, but it requires a man of sense to know
+how to lie well.
+ -- Samuel Butler
+%
+Any girl can be glamorous; all you have to do is stand still and look
+stupid.
+ -- Hedy Lamarr
+%
+Any given program will expand to fill available memory.
+%
+Any great truth can -- and eventually will -- be expressed as a cliche --
+a cliche is a sure and certain way to dilute an idea. For instance, my
+grandmother used to say, "The black cat is always the last one off the
+fence." I have no idea what she meant, but at one time, it was undoubtedly
+true.
+ -- Solomon Short
+%
+Any instrument when dropped will roll into the least accessible corner.
+%
+Any man can work when every stroke of his hand brings down the fruit
+rattling from the tree to the ground; but to labor in season and out
+of season, under every discouragement, by the power of truth -- that
+requires a heroism which is transcendent.
+ -- Henry Ward Beecher
+%
+Any man who hates dogs and babies can't be all bad.
+ -- Leo Rosten, on W. C. Fields
+%
+Any member introducing a dog into the Society's premises shall be
+liable to a fine of one pound. Any animal leading a blind person shall
+be deemed to be a cat.
+ -- Rule 46, Oxford Union Society, London
+%
+Any philosophy that can be put in a nutshell belongs there.
+ -- Sydney J. Harris
+%
+Any president should have the right to shoot
+at least two people a year without explanation.
+ -- Herbert Hoover, discussing the press
+%
+Any priest or shaman must be presumed guilty until proved innocent.
+ -- Lazarus Long
+%
+Any problem in computer science can be solved with another layer
+of indirection.
+ -- David Wheeler
+%
+Any program which runs right is obsolete.
+%
+Any programming language is at its best before it is implemented and used.
+%
+Any road followed to its end leads precisely nowhere.
+Climb the mountain just a little to test it's a mountain.
+From the top of the mountain, you cannot see the mountain.
+ -- Bene Gesserit proverb, "Dune"
+%
+Any small object that is accidentally
+dropped will hide under a larger object.
+%
+Any stone in your boot always migrates against the pressure gradient to
+exactly the point of most pressure.
+ -- Milt Barber
+%
+Any sufficiently advanced bug is indistinguishable from a feature.
+ -- Rich Kulawiec
+%
+Any sufficiently advanced technology is indistinguishable from a rigged demo.
+%
+Any sufficiently advanced technology is indistinguishable from magic.
+ -- Arthur C. Clarke
+%
+Any sufficiently simple directive can be obfuscated beyond reason
+given proper legal counsel.
+ -- Alfred Perlstein
+%
+Any time things appear to be going better, you have overlooked
+something.
+%
+Any two philosophers can tell each other all they know in two hours.
+ -- Oliver Wendell Holmes, Jr.
+%
+Anybody can win, unless there happens to be a second entry.
+%
+Anybody has a right to evade taxes if he can get away with it. No citizen
+has a moral obligation to assist in maintaining his government.
+ -- J. P. Morgan
+%
+Anybody that wants the presidency so much that he'll spend two years
+organizing and campaigning for it is not to be trusted with the office.
+ -- David Broder
+%
+Anybody who doesn't cut his speed at the
+sight of a police car is probably parked.
+%
+Anybody with money to burn will easily find someone to tend the fire.
+%
+Anyone can become angry -- that is easy; but to be angry with the right
+person, to the right degree, at the right time, for the right purpose
+and in the right way -- that is not easy.
+ -- Aristotle
+%
+Anyone can do any amount of work provided it isn't the work he is
+supposed to be doing at the moment.
+ -- Robert Benchley
+%
+Anyone can hold the helm when the sea is calm.
+ -- Publilius Syrus
+%
+Anyone can make an omelet with eggs. The trick is to make one with
+none.
+%
+Anyone can say "no." It is the first word a child learns and often the
+first word he speaks. It is a cheap word because it requires no
+explanation, and many men and women have acquired a reputation for
+intelligence who know only this word and have used it in place of
+thought on every occasion.
+ -- Chuck Jones (Warner Bros. animation director.)
+%
+Anyone stupid enough to be caught by the police is probably guilty.
+%
+Anyone taking offence at fortune(s) is desperately lacking beer, in my
+extremely humble opinion.
+ -- Philip Paeps
+%
+Anyone who cannot cope with mathematics is not fully human. At best he
+is a tolerable subhuman who has learned to wear shoes, bathe and not
+make messes in the house.
+ -- Lazarus Long, "Time Enough for Love"
+%
+Anyone who considers protocol unimportant has never dealt with a cat.
+ -- Robert A. Heinlein
+%
+Anyone who describes Islam as a religion as intolerant encourages violence.
+ -- Tasnim Aslam, Spokesman for Pakistani Foreign Ministry
+%
+Anyone who goes to a psychiatrist ought to have his head examined.
+ -- Samuel Goldwyn
+%
+Anyone who has attended a USENIX conference in a fancy hotel can tell you
+that a sentence like "You're one of those computer people, aren't you?"
+is roughly equivalent to "Look, another amazingly mobile form of slime
+mold!" in the mouth of a hotel cocktail waitress.
+ -- Elizabeth Zwicky
+%
+Anyone who has had a bull by the tail
+knows five or six more things than someone who hasn't.
+ -- Mark Twain
+%
+Anyone who imagines that all fruits ripen at the same time
+as the strawberries, knows nothing about grapes.
+ -- Philippus Paracelsus
+%
+Anyone who is capable of getting themselves made President should on no
+account be allowed to do the job.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Anyone who knows history, particularly the history of Europe, will, I think,
+recognize that the domination of education or of government by any one
+particular religious faith is never a happy arrangement for the people.
+ -- Eleanor Roosevelt
+%
+Anyone who says he can see through women is missing a lot.
+ -- Groucho Marx
+%
+Anyone who uses the phrase "easy as taking candy from a baby" has never
+tried taking candy from a baby.
+ -- Robin Hood
+%
+Anything anybody can say about America is true.
+ -- Emmett Grogan
+%
+Anything cut to length will be too short.
+%
+Anything free is worth what you pay for it.
+%
+Anything is good and useful if it's made of chocolate.
+%
+Anything is possible on paper.
+ -- Ron McAfee
+%
+Anything is possible, unless it's not.
+%
+Anything labeled "NEW" and/or "IMPROVED" isn't.
+The label means the price went up.
+The label "ALL NEW", "COMPLETELY NEW", or "GREAT NEW"
+means the price went way up.
+%
+Anything that is good and useful is made of chocolate.
+%
+Anything that is worth doing has been done frequently. Things hitherto
+undone should be given, I suspect, a wide berth.
+ -- Max Beerbohm, "Mainly on the Air"
+%
+Anything worth doing is worth overdoing.
+%
+Anyway, I keep picturing all these little kids playing some game in this
+big field of rye and all. Thousands of little kids, and nobody's around --
+nobody big, I mean -- except me. And I'm standing on the edge of some crazy
+cliff. What I have to do, I have to catch everybody if they start to go
+over the cliff -- I mean if they're running and they don't look where they're
+going I have to come out from somewhere and catch them. That's all I'd do
+all day. I'd just be the catcher in the rye. I know it; I know it's crazy,
+but that's the only thing I'd really like to be. I know it's crazy.
+ -- J. D. Salinger, "Catcher in the Rye"
+%
+Apathy Club meeting this Friday.
+If you want to come, you're not invited.
+%
+Apathy is not the problem, it's the solution.
+%
+APHASIA:
+ Loss of speech in social scientists when asked
+ at parties, "But of what use is your research?"
+%
+Aphorism, n.:
+ A concise, clever statement.
+Afterism, n.:
+ A concise, clever statement you don't think of until too late.
+ -- James Alexander Thom
+%
+APL hackers do it in the quad.
+%
+APL is a mistake, carried through to perfection. It is the language of the
+future for the programming techniques of the past: it creates a new generation
+of coding bums.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+APL is a natural extension of assembler language programming;
+...and is best for educational purposes.
+ -- Alan J. Perlis
+%
+APL is a write-only language. I can write programs
+in APL, but I can't read any of them.
+ -- Roy Keir
+%
+Appearances often are deceiving.
+ -- Aesop
+%
+APPENDIX:
+ A portion of a book, for which nobody yet has discovered any use.
+%
+Applause, n.:
+ The echo of a platitude from the mouth of a fool.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+April is the cruelest month...
+ -- Thomas Stearns Eliot
+%
+Aquadextrous, adj.:
+ Possessing the ability to turn the bathtub
+ faucet on and off with your toes.
+ -- Rich Hall & Friends, "Sniglets"
+%
+AQUARIUS (Jan 20 - Feb 18)
+ You have an inventive mind and are inclined to be progressive.
+ You lie a great deal. On the other hand, you are inclined to be
+ careless and impractical, causing you to make the same mistakes over
+ and over again. People think you are stupid.
+%
+AQUARIUS (Jan. 20 to Feb. 18)
+ A friend will step forward and confide in you about your breath. Rely
+ on your outgoing personality and winning smile to get you into a lot
+ of trouble. Be relaxed, things will change. Look for a pink slip on
+ payday. Stop wetting your bed.
+%
+AQUARIUS (Jan.20 - Feb.18)
+ You are the type of person who never has enough money to do what
+ you want. Don't expect things to get any better today, either.
+ As a matter of fact they might get worse. Intensify your
+ relationship with your bank and any friends you have who might be
+ able to lend you a few bucks.
+%
+Aquavit is also considered useful for medicinal purposes, an essential
+ingredient in what I was once told is the Norwegian cure for the common
+cold. You get a bottle, a poster bed, and the brightest colored stocking
+cap you can find. You put the cap on the post at the foot of the bed,
+then get into bed and drink aquavit until you can't see the cap. I've
+never tried this, but it sounds as though it should work.
+ -- Peter Nelson
+%
+Arbitrary systems, pl.n.:
+ Systems about which nothing general can be said, save "nothing
+general can be said."
+%
+ARCHDUKE FERDINAND FOUND ALIVE --
+ FIRST WORLD WAR A MISTAKE
+%
+Are we not men?
+%
+Are we running light with overbyte?
+%
+Are Women Human?
+In the year 584, in Lyon, France, 43 Catholic bishops and 20 men
+representing other bishops, after a lengthy debate, took a vote.
+The results were 32 yes, 31 no. Women were declared human by one
+vote.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ Are you sure you're telling the truth? Think hard.
+ Does it make you happy to know you're sending me to an early grave?
+ If all your friends jumped off the cliff, would you jump too?
+ Do you feel bad? How do you think I feel?
+ Aren't you ashamed of yourself?
+ Don't you know any better?
+ How could you be so stupid?
+ If that's the worst pain you'll ever feel, you should be thankful.
+ You can't fool me. I know what you're thinking.
+ If you can't say anything nice, say nothing at all.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ Do as I say, not as I do.
+ Do me a favour and don't tell me about it. I don't want to know.
+ What did you do *this* time?
+ If it didn't taste bad, it wouldn't be good for you.
+ When I was your age...
+ I won't love you if you keep doing that.
+ Think of all the starving children in India.
+ If there's one thing I hate, it's a liar.
+ I'm going to kill you.
+ Way to go, clumsy.
+ If you don't like it, you can lump it.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ Go away. You bother me.
+ Why? Because life is unfair.
+ That's a nice drawing. What is it?
+ Children should be seen and not heard.
+ You'll be the death of me.
+ You'll understand when you're older.
+ Because.
+ Wipe that smile off your face.
+ I don't believe you.
+ How many times have I told you to be careful?
+ Just because.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ Good children always obey.
+ Quit acting so childish.
+ Boys don't cry.
+ If you keep making faces, someday it'll freeze that way.
+ Why do you have to know so much?
+ This hurts me more than it hurts you.
+ Why? Because I'm bigger than you.
+ Well, you've ruined everything. Now are you happy?
+ Oh, grow up.
+ I'm only doing this because I love you.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ When are you going to grow up?
+ I'm only doing this for your own good.
+ Why are you crying? Stop crying, or I'll give you something to
+ cry about.
+ What's wrong with you?
+ Someday you'll thank me for this.
+ You'd lose your head if it weren't attached.
+ Don't you have any sense at all?
+ If you keep sucking your thumb, it'll fall off.
+ Why? Because I said so.
+ I hope you have a kid just like yourself.
+%
+Are you a parent? Do you sometimes find yourself unsure as to what to
+say in those awkward situations? Worry no more...
+
+ You wouldn't understand.
+ You ask too many questions.
+ In order to be a man, you have to learn to follow orders.
+ That's for me to know and you to find out.
+ Don't let those bullies push you around. Go in there and stick
+ up for yourself.
+ You're acting too big for your britches.
+ Well, you broke it. Now are you satisfied?
+ Wait till your father gets home.
+ Bored? If you're bored, I've got some chores for you.
+ Shape up or ship out.
+%
+Are you a turtle?
+%
+Are you making all this up as you go along?
+%
+Are you sure the back door is locked?
+%
+Argue for your limitations, and sure enough, they're yours.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+Arguments are extremely vulgar, for everyone
+in good society holds exactly the same opinion.
+ -- Oscar Wilde
+%
+Arguments with furniture are rarely productive.
+ -- Kehlog Albran, "The Profit"
+%
+ARIES (Mar 21 - Apr 19)
+ You are the pioneer type and hold most people in contempt. You are
+ quick tempered, impatient, and scornful of advice. You are not
+ very nice.
+%
+ARIES (Mar.21 - Apr.19)
+ You are a wonderfully interesting, honest, hard-working person
+ and you should make many new friends, but you won't because you've
+ got a mean streak in you a mile wide.
+%
+ARITHMETIC:
+ An obscure art no longer practiced in
+ the world's developed countries.
+%
+Arithmetic is being able to count up to twenty without taking off your shoes.
+ -- Mickey Mouse
+%
+Armadillo, v.:
+ To provide weapons to a Spanish pickle.
+%
+Armenians and Azerbaijanis in Stepanakert, capital of the Nagorno-Karabakh
+autonomous region, rioted over much needed spelling reform in the Soviet
+Union.
+ -- P. J. O'Rourke
+%
+Armor's Axiom:
+ Virtue is the failure to achieve vice.
+%
+Armstrong's Collection Law:
+ If the check is truly in the mail,
+ it is surely made out to someone else.
+%
+Arnold's Laws of Documentation:
+ (1) If it should exist, it doesn't.
+ (2) If it does exist, it's out of date.
+ (3) Only documentation for useless programs transcends the
+ first two laws.
+%
+Around computers it is difficult to find the correct unit of time to
+measure progress. Some cathedrals took a century to complete. Can you
+imagine the grandeur and scope of a program that would take as long?
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+Around the turn of this century, a composer named Camille Saint-Saens wrote
+a satirical zoological-fantasy called "Le Carnaval des Animaux." Aside from
+one movement of this piece, "The Swan", Saint-Saens didn't allow this work
+to be published or even performed until a year had elapsed after his death.
+(He died in 1921.)
+ Most of us know the "Swan" movement rather well, with its smooth,
+flowing cello melody against a calm background; but I've been having this
+fantasy...
+ What if he had written this piece with lyrics, as a song to be sung?
+And, further, what if he had accompanied this song with a musical saw? (This
+instrument really does exist, often played by percussionists!) Then the
+piece would be better known as:
+ SAINT-SAENS' SAW SONG "SWAN"!
+%
+Arrakis teaches the attitude of the knife - chopping off what's
+incomplete and saying: "Now it's complete because it's ended here."
+ -- Muad'dib, "Dune"
+%
+Art is a jealous mistress.
+ -- Ralph Waldo Emerson
+%
+Art is a lie which makes us realize the truth.
+ -- Picasso
+%
+Art is anything you can get away with.
+ -- Marshall McLuhan
+%
+Art is either plagiarism or revolution.
+ -- Paul Gauguin
+%
+Art is Nature speeded up and God slowed down.
+ -- Chazal
+%
+"Art" is the ability to separate the significant from the insignificant.
+ -- Poul Henningsen (1894-1967)
+%
+Art is the tree of life. Science is the tree of death.
+%
+Arthur's Laws of Love:
+ (1) People to whom you are attracted invariably think you
+ remind them of someone else.
+ (2) The love letter you finally got the courage to send will
+ be delayed in the mail long enough for you to make a fool
+ of yourself in person.
+%
+Article the Third:
+ Where a crime of the kidneys has been committed, the accused should
+ enjoy the right to a speedy diaper change. Public announcements and
+ guided tours of the aforementioned are not necessary.
+Article the Fourth:
+ The decision to eat strained lamb or not should be with the "feedee"
+ and not the "feeder". Blowing the strained lamb into the feeder's
+ face should be accepted as an opinion, not as a declaration of war.
+Article the Fifth:
+ Babies should enjoy the freedom to vocalize, whether it be in church,
+ a public meeting place, during a movie, or after hours when the
+ lights are out. They have not yet learned that joy and laughter have
+ to last a lifetime and must be conserved.
+ -- Erma Bombeck, "A Baby's Bill of Rights"
+%
+Artificial intelligence has the same relation to intelligence as
+artificial flowers have to flowers.
+ -- David Parnas
+%
+Artistic ventures highlighted. Rob a museum.
+%
+As a computer, I find your faith in technology amusing.
+%
+As a professional humorist, I often get letters from readers who are
+interested in the basic nature of humor. "What kind of a sick
+perverted disgusting person are you," these letters typically ask,
+"that you make jokes about setting fire to a goat?" ...
+ -- Dave Barry, "Why Humor is Funny"
+%
+As an adolescent I aspired to lasting fame, I craved factual certainty, and
+I thirsted for a meaningful vision of human life -- so I became a scientist.
+This is like becoming an archbishop so you can meet girls.
+ -- Matt Cartmill
+%
+As an Englishman, an Aussie and a Scotsman are sitting in a pub, quaffing
+a few, three flies buzz down from the ceiling and lazily circle each drinker.
+Suddenly "buzzzzzzzzplooop", each fly does a kamakazi dive into a different
+glass.
+ The Englishman take a disgusted look at his pint, dips the fly out
+with a spoon, flicks the fly over his shoulder, and drains the glass.
+ The Aussie notices the fly as he puts the glass to his lips. With
+a quick puff he blows the bug out in a cloud of foam, and tosses the beer
+down in one gulp.
+ Then, as they both look on, awestruck, the Scotsman gently grasps the
+fly by its wings, lifts it out of his brew and shakes it off. Then, in a
+firm voice he speaks to the fly: "There y'are now laddie, safe and sound.
+NOW SPIT IT OOOOT!"
+%
+As crazy as hauling timber into the woods.
+ -- Quintus Horatius Flaccus (Horace)
+%
+As failures go, attempting to recall the past is like trying to grasp
+the meaning of existence. Both make one feel like a baby clutching at
+a basketball: one's palms keep sliding off.
+ -- Joseph Brodsky
+%
+As far as the laws of mathematics refer to reality, they are not
+certain, and as far as they are certain, they do not refer to reality.
+ -- Albert Einstein
+%
+As far as we know, our computer has never had an undetected error.
+ -- Weisert
+%
+As flies to wanton boys are we to the gods; they kill us for their sport.
+ -- William Shakespeare, "King Lear"
+%
+As for the women, though we scorn and flout 'em,
+We may live with, but cannot live without 'em.
+ -- Frederic Reynolds
+%
+As Gen. de Gaulle occasionally acknowledges America to be the daughter
+of Europe, so I am pleased to come to Yale, the daughter of Harvard.
+ -- John F. Kennedy
+%
+As goatherd learns his trade by goat, so writer learns his trade by wrote.
+%
+As he had feared, his orders had been forgotten and everyone had brought
+the potato salad.
+%
+As I argued in "Beloved Son", a book about my son Brian and the subject of
+religious communes and cults, one result of proper early instruction in the
+methods of rational thought will be to make sudden mindless conversions --
+to anything -- less likely. Brian now realizes this and has, after eleven
+years, left the sect he was associated with. The problem is that once the
+untrained mind has made a formal commitment to a religious philosophy --
+and it does not matter whether that philosophy is generally reasonable and
+high-minded or utterly bizarre and irrational -- the powers of reason are
+surprisingly ineffective in changing the believer's mind.
+ -- Steve Allen
+%
+As I bit into the nectarine, it had a crisp juiciness about it that was very
+pleasurable - until I realized it wasn't a nectarine at all, but A HUMAN HEAD!!
+ -- Jack Handey
+%
+As I thought, no better from this side.
+ -- Eeyore
+%
+As I was going up Punch Card Hill,
+ Feeling worse and worser,
+There I met a C.R.T.
+ And it drop't me a cursor.
+
+C.R.T., C.R.T.,
+ Phosphors light on you!
+If I had fifty hours a day
+ I'd spend them all at you.
+ -- Uncle Colonel's Cursory Rhymes
+%
+As I was passing Project MAC,
+I met a Quux with seven hacks.
+Every hack had seven bugs;
+Every bug had seven manifestations;
+Every manifestation had seven symptoms.
+Symptoms, manifestations, bugs, and hacks,
+How many losses at Project MAC?
+%
+As I was walking down the street one dark and dreary day,
+I came upon a billboard and much to my dismay,
+The words were torn and tattered,
+From the storm the night before,
+The wind and rain had done its work and this is how it goes,
+
+Smoke Coca-Cola cigarettes, chew Wrigleys Spearmint beer,
+Ken-L-Ration dog food makes your complexion clear,
+Simonize your baby in a Hershey candy bar,
+And Texaco's a beauty cream that's used by every star.
+
+Take your next vacation in a brand new Frigidaire,
+Learn to play the piano in your winter underwear,
+Doctors say that babies should smoke until they're three,
+And people over sixty-five should bathe in Lipton tea.
+%
+As in certain cults it is possible to
+kill a process if you know its true name.
+ -- Ken Thompson and Dennis M. Ritchie
+%
+As in Protestant Europe, by contrast, where sects divided endlessly into
+smaller competing sects and no church dominated any other, all is different
+in the fragmented world of IBM. That realm is now a chaos of conflicting
+norms and standards that not even IBM can hope to control. You can buy a
+computer that works like an IBM machine but contains nothing made or sold by
+IBM itself. Renegades from IBM constantly set up rival firms and establish
+standards of their own. When IBM recently abandoned some of its original
+standards and decreed new ones, many of its rivals declared a puritan
+allegiance to IBM's original faith, and denounced the company as a divisive
+innovator. Still, the IBM world is united by its distrust of icons and
+imagery. IBM's screens are designed for language, not pictures. Graven
+images may be tolerated by the luxurious cults, but the true IBM faith relies
+on the austerity of the word.
+ -- Edward Mendelson, "The New Republic", February 22, 1988
+%
+As long as I am mayor of this city [Jersey City, New Jersey] the great
+industries are secure. We hear about constitutional rights, free speech
+and the free press. Every time I hear these words I say to myself, "That
+man is a Red, that man is a Communist". You never hear a real American
+talk like that.
+ -- Frank Hague (1896-1956)
+%
+As long as the answer is right, who cares if the question is wrong?
+%
+As long as there are ill-defined goals, bizarre bugs, and unrealistic
+schedules, there will be Real Programmers willing to jump in and Solve
+The Problem, saving the documentation for later.
+%
+As long as war is regarded as wicked, it will always have its fascination.
+When it is looked upon as vulgar, it will cease to be popular.
+ -- Oscar Wilde, "Intentions"
+%
+As many of you know, I am taking a class here at UNC on Personality.
+One of the tests to determine personality in our book was so incredibly
+useful and interesting, I just had to share it.
+
+Answer each of the following items "true" or "false"
+
+ 1. I salivate at the sight of mittens.
+ 2. If I go into the street, I'm apt to be bitten by a horse.
+ 3. Some people never look at me.
+ 4. Spinach makes me feel alone.
+ 5. My sex life is A-okay.
+ 6. When I look down from a high spot, I want to spit.
+ 7. I like to kill mosquitoes.
+ 8. Cousins are not to be trusted.
+ 9. It makes me embarrassed to fall down.
+10. I get nauseous from too much roller skating.
+11. I think most people would cry to gain a point.
+12. I cannot read or write.
+13. I am bored by thoughts of death.
+14. I become homicidal when people try to reason with me.
+15. I would enjoy the work of a chicken flicker.
+16. I am never startled by a fish.
+17. My mother's uncle was a good man.
+18. I don't like it when somebody is rotten.
+19. People who break the law are wise guys.
+20. I have never gone to pieces over the weekend.
+%
+As many of you know, I am taking a class here at UNC on Personality.
+One of the tests to determine personality in our book was so incredibly
+useful and interesting, I just had to share it.
+
+Answer each of the following items "true" or "false"
+
+ 1. I think beavers work too hard.
+ 2. I use shoe polish to excess.
+ 3. God is love.
+ 4. I like mannish children.
+ 5. I have always been disturbed by the sight of Lincoln's ears.
+ 6. I always let people get ahead of me at swimming pools.
+ 7. Most of the time I go to sleep without saying goodbye.
+ 8. I am not afraid of picking up door knobs.
+ 9. I believe I smell as good as most people.
+10. Frantic screams make me nervous.
+11. It's hard for me to say the right thing when I find myself in a room
+ full of mice.
+12. I would never tell my nickname in a crisis.
+13. A wide necktie is a sign of disease.
+14. As a child I was deprived of licorice.
+15. I would never shake hands with a gardener.
+16. My eyes are always cold.
+17. Cousins are not to be trusted.
+18. When I look down from a high spot, I want to spit.
+19. I am never startled by a fish.
+20. I have never gone to pieces over the weekend.
+%
+As me an' me marrer was readin' a tyape,
+The tyape gave a shriek mark an' tried tae escyape;
+It skipped ower the gyate tae the end of the field,
+An' jigged oot the room wi' a spool an' a reel!
+Follow the leader, Johnny me laddie,
+Follow it through, me canny lad O;
+Follow the transport, Johnny me laddie,
+Away, lad, lie away, canny lad O!
+ -- S. Kelly-Bootle, "The Devil's DP Dictionary"
+%
+As of next Thursday, UNIX will be flushed in favor of TOPS-10.
+Please update your programs.
+%
+As of next Tuesday, C will be flushed in favor of COBOL.
+Please update your programs.
+%
+As of next week, passwords will be entered in Morse code.
+%
+As part of an ongoing effort to keep you, the Fortune reader, abreast of
+the valuable information the daily crosses the USENET, Fortune presents:
+
+News articles that answer *your* questions, #1:
+
+ Newsgroups: comp.sources.d
+ Subject: how do I run C code received from sources
+ Keywords: C sources
+ Distribution: na
+
+ I do not know how to run the C programs that are posted in the
+ sources newsgroup. I save the files, edit them to remove the
+ headers, and change the mode so that they are executable, but I
+ cannot get them to run. (I have never written a C program before.)
+
+ Must they be compiled? With what compiler? How do I do this? If
+ I compile them, is an object code file generated or must I generate
+ it explicitly with the > character? Is there something else that
+ must be done?
+%
+As part of the conversion, computer specialists rewrote 1,500 programs;
+a process that traditionally requires some debugging.
+ -- USA Today, referring to the Internal Revenue Service
+ conversion to a new computer system.
+%
+As some day it may happen that a victim must be found
+I've got a little list -- I've got a little list
+Of society offenders who might well be underground
+And who never would be missed -- who never would be missed.
+ -- Koko, "The Mikado"
+%
+As soon as we started programming, we found to our surprise that it wasn't
+as easy to get programs right as we had thought. Debugging had to be
+discovered. I can remember the exact instant when I realized that a large
+part of my life from then on was going to be spent in finding mistakes in
+my own programs.
+ -- Maurice Wilkes, designer of EDSAC, on programming, 1949
+%
+As the poet said, "Only God can make a tree" -- probably
+because it's so hard to figure out how to get the bark on.
+ -- Woody Allen
+%
+As the system comes up, the component builders will from time to time appear,
+bearing hot new versions of their pieces -- faster, smaller, more complete,
+or putatively less buggy. The replacement of a working component by a new
+version requires the same systematic testing procedure that adding a new
+component does, although it should require less time, for more complete and
+efficient test cases will usually be available.
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+As the trials of life continue to take their toll, remember that there
+is always a future in Computer Maintenance.
+ -- National Lampoon, "Deteriorata"
+%
+As to Jesus of Nazareth... I think the system of Morals and his Religion,
+as he left them to us, the best the World ever saw or is likely to see;
+but I apprehend it has received various corrupting Changes, and I have,
+with most of the present Dissenters in England, some doubts as to his
+divinity.
+ -- Benjamin Franklin
+%
+As well look for a needle in a bottle of hay.
+ -- Miguel de Cervantes
+%
+As Will Rogers would have said,
+"There is no such things as a free variable."
+%
+As with most fine things, chocolate has its season. There is a simple memory
+aid that you can use to determine whether it is the correct time to order
+chocolate dishes: Any month whose name contains the letter A, E, or U is the
+proper time for chocolate.
+ -- Sandra Boynton, "Chocolate: The Consuming Passion"
+%
+As you grow older, you will still do foolish things,
+but you will do them with much more enthusiasm.
+ -- The Cowboy
+%
+As you know, birds do not have sexual organs because they would
+interfere with flight. [In fact, this was the big breakthrough for the
+Wright Brothers. They were watching birds one day, trying to figure
+out how to get their crude machine to fly, when suddenly it dawned on
+Wilbur. "Orville," he said, "all we have to do is remove the sexual
+organs!" You should have seen their original design.] As a result,
+birds are very, very difficult to arouse sexually. You almost never
+see an aroused bird. So when they want to reproduce, birds fly up and
+stand on telephone lines, where they monitor telephone conversations
+with their feet. When they find a conversation in which people are
+talking dirty, they grip the line very tightly until they are both
+highly aroused, at which point the female gets pregnant.
+ -- Dave Barry, "Sex and the Single Amoeba: What Every
+ Teen Should Know"
+%
+As you reach for the web, a venomous spider appears. Unable to pull
+your hand away in time, the spider promptly, but politely, bites you.
+The venom takes affect quickly causing your lips to turn plaid along
+with your complexion. You become dazed, and in your stupor you fall
+from the limbs of the tree. Snap! Your head falls off and rolls all
+over the ground. The instant before you croak, you hear the whoosh of
+a vacuum being filled by the air surrounding your head. Worse yet, the
+spider is suing you for damages.
+%
+As you will see, I told them, in no uncertain terms, to see Figure one.
+ -- Dave "First Strike" Pare
+%
+As Zeus said to Narcissus, "Watch yourself."
+%
+Ascend to the high mountain pass,
+Cross the shallow side of the wide ocean.
+Do not give up to the great distance:
+It's by going that you will reach your aim.
+Be not discouraged by human frailty:
+You will overcome it if you try to.
+ -- Chinggis (Genghis) Khan
+%
+ASCII:
+ The control code for all beginning programmers and those who would
+ become computer literate. Etymologically, the term has come down as
+ a contraction of the often-repeated phrase "ascii and you shall
+ receive."
+ -- Robb Russon
+%
+ASCII a stupid question, you get an EBCDIC answer.
+%
+ASHes to ASHes, DOS to DOS.
+%
+Ashes to ashes, dust to dust,
+If God won't have you, the devil must.
+%
+Ask five economists and you'll get five different explanations (six if
+one went to Harvard).
+ -- Edgar R. Fiedler
+%
+Ask not for whom the Bell tolls, and you
+will pay only the station-to-station rate.
+ -- Howard Kandel
+%
+Ask not for whom the <CONTROL-G> tolls.
+%
+Ask not for whom the telephone bell tolls ...
+if thou art in the bathtub, it tolls for thee.
+%
+Ask not what's inside your head, but what your head's inside of.
+ -- J. J. Gibson
+%
+Ask your boss to reconsider -- it's so difficult to take "Go to hell"
+for an answer.
+%
+Ask yourself whether you are happy and you cease to be so.
+ -- John Stuart Mill
+%
+Asked how she felt being the first woman to make a major-league team, she
+said, "Like a pig in mud," or words to that effect, and then turned and
+released a squirt of tobacco juice from the wad of rum soaked plug in her
+right cheek. She chewed a rare brand of plug called Stuff It, which she
+learned to chew when she was playing Nicaraguan summer ball. She told the
+writers, "They were so mean to me down there you couldn't write it in your
+newspaper. I took a gun everywhere I went, even to bed. *Especially* to
+bed. Guys were after me like you can't believe. That's when I started
+chewing tobacco -- because no matter how bad anybody treats you, it's not
+as bad as this. This is the worst chew in the world. After this,
+everything else is peaches and cream." The writers elected Gentleman Jim,
+the Sparrow's P.R. guy, to bite off a chunk and tell them how it tasted,
+and as he sat and chewed it tears ran down his old sunburnt cheeks and he
+couldn't talk for a while. Then he whispered, "You've been chewing this for
+two years? God, I had no idea it was so hard to be a woman."
+ -- Garrison Keillor
+%
+Asking a working writer what he thinks about critics is like asking a
+lamp-post how it feels about dogs.
+ -- Christopher Hampton
+%
+Assembly language experience is [important] for the maturity
+and understanding of how computers work that it provides.
+ -- D. Gries
+%
+Associate with well-mannered persons and your manners will improve. Run
+with decent folk and your own decent instincts will be strengthened. Keep
+the company of bums and you will become a bum. Hang around with rich people
+and you will end by picking up the check and dying broke.
+ -- Stanley Walker
+%
+Astrology... just a bunch of Taurus.
+%
+Asynchronous inputs are at the root of our race problems.
+ -- D. Winker and F. Prosser
+%
+At about 2500 A.D., humankind discovers a computer problem that *must* be
+solved. The only difficulty is that the problem is NP complete and will
+take thousands of years even with the latest optical biologic technology
+available. The best computer scientists sit down to think up some solution.
+In great dismay, one of the C.S. people tells her husband about it. There
+is only one solution, he says. Remember physics 103, Modern Physics, general
+relativity and all. She replies, "What does that have to do with solving
+a computer problem?"
+ "Remember the twin paradox?"
+ After a few minutes, she says, "I could put the computer on a very
+fast machine and the computer would have just a few minutes to calculate but
+that is the exact opposite of what we want... Of course! Leave the
+computer here, and accelerate the earth!"
+ The problem was so important that they did exactly that. When
+the earth came back, they were presented with the answer:
+
+ IEH032 Error in JOB Control Card.
+%
+At any given moment, an arrow must be either where it is or where it is
+not. But obviously it cannot be where it is not. And if it is where
+it is, that is equivalent to saying that it is at rest.
+ -- Zeno's paradox of the moving (still?) arrow
+%
+At ebb tide I wrote a line upon the sand, and gave it all my heart and all
+my soul. At flood tide I returned to read what I had inscribed and found my
+ignorance upon the shore.
+ -- Kahlil Gibran
+%
+At first, I just did it on weekends. With a few friends, you know...
+We never wanted to hurt anyone. The girls loved it. We'd all sit
+around the computer and do a little UNIX. It was just a kick. At
+least that's what we thought. Then it got worse.
+
+It got so I'd have to do some UNIX during the weekdays. After a
+while, I couldn't even wake up in the morning without having that
+crave to go do UNIX. Then it started affecting my job. I would just
+have to do it during my break. Maybe a `grep' or two, maybe a little
+`more'. I eventually started doing UNIX just to get through the day.
+Of course, it screwed up my mind so much that I couldn't even
+function as a normal person.
+
+I'm lucky today, I've overcome my UNIX problem. It wasn't easy. If
+you're smart, just don't start. Remember, if any weirdo offers you
+some UNIX,
+
+ Just Say No!
+%
+At first sight, the idea of any rules or principles being superimposed on
+the creative mind seems more likely to hinder than to help, but this is
+quite untrue in practice. Disciplined thinking focuses inspiration rather
+than blinkers it.
+ -- G. L. Glegg, "The Design of Design"
+%
+At Group L, Stoffel oversees six first-rate programmers,
+a managerial challenge roughly comparable to herding cats.
+ -- "The Washington Post Magazine", June 9, 1985
+%
+At last I've found the girl of my dreams. Last night she said to me,
+"Once more, Strange, and this time *I'll* be Donnie and *you* be Marie.
+ -- Strange de Jim
+%
+At least I thought I was dancing, 'til somebody stepped on my hand.
+ -- J. B. White
+%
+At least they're _E_X_P_E_R_I_E_N_C_E_D incompetents.
+%
+At no time is freedom of speech more precious than when a man hits his
+thumb with a hammer.
+ -- Marshall Lumsden
+%
+At once it struck me what quality went to form a man of achievement,
+especially in literature, and which Shakespeare possessed so enormously
+-- I mean negative capability, that is, when a man is capable of being
+in uncertainties, mysteries, doubts, without any irritable reaching
+after fact and reason.
+ -- John Keats
+%
+At social gatherings, I would amuse everyone by standing uponst the
+coffee table and striking meself repeatedly upon the head with a brick.
+ -- H. R. Gumby
+%
+At the end of your life there'll be a good rest,
+and no further activities are scheduled.
+%
+At the foot of the mountain, thunder:
+The image of Providing Nourishment.
+Thus the superior man is careful of his words
+And temperate in eating and drinking.
+%
+At the heart of science is an essential tension between two seemingly
+contradictory attitudes -- an openness to new ideas, no matter how bizarre
+or counterintuitive they may be, and the most ruthless skeptical scrutiny
+of all ideas, old and new. This is how deep truths are winnowed from deep
+nonsense. Of course, scientists make mistakes in trying to understand the
+world, but there is a built-in error-correcting mechanism: The collective
+enterprise of creative thinking and skeptical thinking together keeps the
+field on track.
+ -- Carl Sagan, "The Fine Art of Baloney Detection"
+%
+At the hospital, a doctor is training an intern on how to announce bad news
+to the patients. The doctor tells the intern "This man in 305 is going to
+die in six months. Go in and tell him." The intern boldly walks into the
+room, over to the man's bedside and tells him "Seems like you're gonna die!"
+The man has a heart attack and is rushed into surgery on the spot. The doctor
+grabs the intern and screams at him, "What!?!? are you some kind of moron?
+You've got to take it easy, work your way up to the subject. Now this man in
+213 has about a week to live. Go in and tell him, but, gently, you hear me,
+gently!"
+ The intern goes softly into the room, humming to himself, cheerily
+opens the drapes to let the sun in, walks over to the man's bedside, fluffs
+his pillow and wishes him a "Good morning!" "Wonderful day, no? Say...
+guess who's going to die soon!"
+%
+At the source of every error which is blamed on the computer you will find
+at least two human errors, including the error of blaming it on the computer.
+%
+At these prices, I lose money -- but I make it up in volume.
+ -- Peter G. Alaquon
+%
+At times discretion should be thrown aside,
+and with the foolish we should play the fool.
+ -- Menander
+%
+At work, the authority of a person is inversely proportional to the
+number of pens that person is carrying.
+%
+Atheism is a non-prophet organization.
+%
+ATLANTA:
+ An entire city surrounded by an airport.
+%
+Atlanta makes it against the law to tie a giraffe to a telephone pole
+or street lamp.
+%
+Atlee is a very modest man. And with reason.
+ -- Winston Churchill
+%
+Attempting to stop MySQL by buying companies around it is like trying
+to kill a dolphin by drinking the ocean.
+ -- Marten Mickos
+%
+Attorney General Edwin Meese III explained why the Supreme Court's Miranda
+decision (holding that subjects have a right to remain silent and have a
+lawyer present during questioning) is unnecessary: "You don't have many
+suspects who are innocent of a crime. That's contradictory. If a person
+is innocent of a crime, then he is not a suspect."
+ -- U.S. News and World Report, 10/14/85
+%
+Auction, n.:
+ A gyp off the old block.
+%
+Audacity, and again, audacity, and always audacity.
+ -- G. J. Danton
+%
+Audiophile, n.:
+ Someone who listens to the equipment instead of the music.
+%
+Auribus teneo lupum.
+[I hold a wolf by the ears.]
+%
+AUTHENTIC:
+ Indubitably true, in somebody's opinion.
+%
+Authors (and perhaps columnists) eventually rise to the top of whatever
+depths they were once able to plumb.
+ -- Stanley Kaufman
+%
+Authors are easy to get on with -- if you're fond of children.
+ -- Michael Joseph, "Observer"
+%
+Automobile, n.:
+ A four-wheeled vehicle that runs up hills and down
+ pedestrians.
+%
+Avec!
+%
+Avert misunderstanding by calm, poise, and balance.
+%
+Avoid cliches like the plague.
+They're a dime a dozen.
+%
+Avoid gunfire in the bathroom tonight.
+%
+Avoid Quiet and Placid persons unless you are in Need of Sleep.
+ -- National Lampoon, "Deteriorata"
+%
+Avoid reality at all costs.
+%
+Avoid revolution or expect to get shot. Mother and I will grieve, but
+we will gladly buy a dinner for the National Guardsman who shot you.
+ -- Dr. Paul Williamson, father of a Kent State student
+%
+Avoid strange women and temporary variables.
+%
+Awash with unfocused desire, Everett twisted the lobe of his one remaining
+ear and felt the presence of somebody else behind him, which caused terror
+to push through his nervous system like a flash flood roaring down the
+mid-fork of the Feather River before the completion of the Oroville Dam
+in 1959.
+ -- Grand Panjandrum's Special Award, 1984 Bulwer-Lytton
+ bad fiction contest.
+%
+Bacchus, n.:
+ A convenient deity invented by the ancients
+ as an excuse for getting drunk.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+BACHELOR:
+ A guy who is footloose and fiancee-free.
+%
+BACHELOR:
+ A man who chases women and never Mrs. one.
+%
+Back in '80 or '81 the workers were rioting in Gdansk and there were fears
+that the Soviets would invade Poland to put down the demonstrations. Foreign
+correspondents were curious as to just what the Poles would do if they were
+invaded. They asked, "What will you do if the East Germans invade from the
+West and the Soviets invade from the East? Who will you fight first?"
+ To which the Poles replied, "Why, we will fight the Germans first.
+Business before pleasure."
+%
+Back in the early 60's, touch tone phones only had 10 buttons. Some
+military versions had 16, while the 12 button jobs were used only by people
+who had "diva" (digital inquiry, voice answerback) systems -- mainly banks.
+Since in those days, only Western Electric made "data sets" (modems) the
+problems of terminology were all Bell System. We used to struggle with
+written descriptions of dial pads that were unfamiliar to most people
+(most phones were rotary then.) Partly in jest, some AT&T engineering
+types (there was no marketing in the good old days, which is why they were
+the good old days) made up the term "octalthorpe" (note spelling) to denote
+the "pound sign." Presumably because it has 8 points sticking out. It
+never really caught on.
+%
+Back when I was a boy, it was 40 miles to everywhere,
+uphill both ways and it was always snowing.
+%
+BACKWARD CONDITIONING:
+ Putting saliva in a dog's mouth in an attempt to make a bell ring.
+%
+Bacon's not the only thing that's cured by hanging from a string.
+%
+BAD CRAZINESS, MAN!!!
+%
+Bad men live that they may eat and drink,
+whereas good men eat and drink that they may live.
+ -- Socrates
+%
+Bagbiter:
+ 1. n.; Equipment or program that fails, usually
+intermittently. 2. adj.: Failing hardware or software. "This
+bagbiting system won't let me get out of spacewar." Usage: verges on
+obscenity. Grammatically separable; one may speak of "biting the
+bag". Synonyms: LOSER, LOSING, CRETINOUS, BLETCHEROUS, BARFUCIOUS,
+CHOMPER, CHOMPING.
+%
+Bagdikian's Observation:
+ Trying to be a first-rate reporter on the average American newspaper
+ is like trying to play Bach's "St. Matthew Passion" on a ukulele.
+%
+Bahdges? We don't need no stinkin' bahdges!
+ -- "The Treasure of Sierra Madre"
+%
+Baker's First Law of Federal Geometry:
+ A block grant is a solid mass of money
+ surrounded on all sides by governors.
+%
+BALLISTOPHOBIA:
+ Fear of bullets;
+OTOPHOBIA:
+ Fear of opening one's eyes.
+PECCATOPHOBIA:
+ Fear of sinning.
+TAPHEPHOBIA:
+ Fear of being buried alive.
+SITOPHOBIA:
+ Fear of food.
+TRICHOPHOBIA:
+ Fear of hair.
+VESTIPHOBIA:
+ Fear of clothing.
+%
+BALTIMORE:
+ A wharf-rat stealing Diogenes' lamp.
+%
+Ban the bomb. Save the world for conventional warfare.
+%
+Banacek's Eighteenth Polish Proverb:
+ The hippo has no sting, but the wise
+ man would rather be sat upon by the bee.
+%
+Banectomy, n.:
+ The removal of bruises on a banana.
+ -- Rich Hall, "Sniglets"
+%
+Bank error in your favor. Collect $200.
+%
+Barach's Rule:
+ An alcoholic is a person who drinks more than his own physician.
+%
+Barbara's Rules of Bitter Experience:
+ (1) When you empty a drawer for his clothes
+ and a shelf for his toiletries, the relationship ends.
+ (2) When you finally buy pretty stationary
+ to continue the correspondence, he stops writing.
+%
+Bare feet magnetize sharp metal objects so they point upward from the
+floor -- especially in the dark.
+%
+Barker's Proof:
+ Proofreading is more effective after publication.
+%
+Barometer, n.:
+ An ingenious instrument which indicates
+ what kind of weather we are having.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Barth's Distinction:
+ There are two types of people: those who divide people into two
+types, and those who don't.
+%
+Baruch's Observation:
+ If all you have is a hammer, everything looks like a nail.
+%
+Base 8 is just like base 10, if you are missing two fingers.
+ -- Tom Lehrer
+%
+Baseball is a skilled game. It's America's game -- it, and high taxes.
+ -- Will Rogers
+%
+Basic Definitions of Science:
+ If it's green or wiggles, it's biology.
+ If it stinks, it's chemistry.
+ If it doesn't work, it's physics.
+%
+Basic is a high level languish.
+APL is a high level anguish.
+%
+BASIC is the Computer Science equivalent of "Scientific Creationism."
+%
+BASIC is to computer programming as QWERTY is to typing.
+ -- Seymour Papert
+%
+BASIC, n.:
+ A programming language. Related to certain social diseases in
+ that those who have it will not admit it in polite company.
+%
+Basically my wife was immature. I'd be at home in the bath and she'd
+come in and sink my boats.
+ -- Woody Allen
+%
+Bathquake, n.:
+ The violent quake that rattles the entire house when the water
+ faucet is turned on to a certain point.
+ -- Rich Hall, "Sniglets"
+%
+Batteries not included.
+%
+Battle, n.:
+ A method of untying with the teeth a political knot that
+ will not yield to the tongue.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Be a better psychiatrist and the world
+will beat a psychopath to your door.
+%
+BE A LOOF! (There has been a recent population explosion of lerts.)
+%
+BE ALERT!!!! (The world needs more lerts...)
+%
+Be assured that a walk through the ocean of most Souls would scarcely
+get your Feet wet. Fall not in Love, therefore: it will stick to your
+face.
+ -- National Lampoon, "Deteriorata"
+%
+Be both a speaker of words and a doer of deeds.
+ -- Homer
+%
+Be braver -- you can't cross a chasm in two small jumps.
+%
+Be careful! Is it classified?
+%
+Be careful! UGLY strikes 9 out of 10!
+%
+Be careful how you get yourself involved with persons or
+situations that can't bear inspection.
+%
+Be careful of reading health books, you might die of a misprint.
+ -- Mark Twain
+%
+Be careful what you set your heart on -- for it will surely be yours.
+ -- James Baldwin, "Nobody Knows My Name"
+%
+Be careful when a loop exits to the same place from side and bottom.
+%
+Be careful when you bite into your hamburger.
+ -- Derek Bok
+%
+Be cautious in your daily affairs.
+%
+Be cheerful while you are alive.
+ -- Phathotep, 24th Century B.C.
+%
+Be circumspect in your liaisons with women. It is better
+to be seen at the opera with a man than at mass with a woman.
+ -- De Maintenon
+%
+Be different: conform.
+%
+Be frank and explicit with your lawyer ... it is his business to confuse
+the issue afterwards.
+%
+Be free and open and breezy! Enjoy!
+Things won't get any better so get used to it.
+%
+Be incomprehensible. If they can't understand, they can't disagree.
+%
+Be independent.
+Insult a rich relative today.
+%
+Be it our wealth, our jobs, or even our homes;
+nothing is safe while the legislature is in session.
+%
+Be nice to people on the way up, because you'll meet them on your way down.
+ -- Wilson Mizner
+%
+Be not anxious about what you have, but about what you are.
+ -- Pope St. Gregory I
+%
+Be open to other people -- they may enrich your dream.
+%
+Be prepared to accept sacrifices.
+Vestal virgins aren't all that bad.
+%
+Be regular and orderly in your life, so that you may be violent
+and original in your work.
+ -- Flaubert
+%
+Be security conscious -- National Defense is at stake.
+%
+Be self-reliant and your success is assured.
+%
+Be sociable.
+Speak to the person next to you in the unemployment line tomorrow.
+%
+Be sure to evaluate the bird-hand/bush ratio.
+%
+Be valiant, but not too venturous.
+Let thy attire be comely, but not costly.
+ -- John Lyly
+%
+Beachhead, n.:
+ In marketing: A small piece of a market over which you gain
+ control and from which you go out to control other pieces of
+ the market.
+
+ In war: Where soldiers die.
+%
+Beam me up, Scotty!
+%
+Beam me up, Scotty! It ate my phaser!
+%
+Beam me up, Scotty, there's no intelligent life down here!
+%
+Beat your son every day; you may not know why, but he will.
+%
+BEAUTY:
+ What's in your eye when you have a bee in your hand.
+%
+Beauty and harmony are as necessary to you as the very breath of life.
+%
+Beauty, brains, availability, personality; pick any two.
+%
+Beauty is one of the rare things which does not lead to doubt of God.
+ -- Jean Anouilh
+%
+Beauty is truth, truth beauty, that is all
+Ye know on earth, and all ye need to know.
+ -- John Keats
+%
+Beauty may be skin deep, but ugly goes clear to the bone.
+ -- Redd Foxx
+%
+Because I do,
+Because I do not hope,
+Because I do not hope to survive
+Injustice from the Palace, death from the air,
+Because I do, only do,
+I continue...
+ -- T. S. Pynchon
+%
+Because the wine remembers.
+%
+Because we don't think about future generations,
+they will never forget us.
+ -- Henrik Tikkanen
+%
+Been through hell?
+What did you bring back for me?
+%
+Been Transferred Lately?
+%
+Beer -- it's not just for breakfast anymore.
+%
+Beer & Pretzels -- Breakfast of Champions.
+%
+Bees are very busy souls
+They have no time for birth controls
+And that is why in times like these
+There are so many Sons of Bees.
+%
+Before borrowing money from a friend, decide which you need more.
+ -- Addison H. Hallock
+%
+Before destruction a man's heart is
+haughty, but humility goes before honour.
+ -- Psalms 18:12
+%
+...before I could come to any conclusion it occurred to me that my speech
+or my silence, indeed any action of mine, would be a mere futility. What
+did it matter what anyone knew or ignored? What did it matter who was
+manager? One gets sometimes such a flash of insight. The essentials of
+this affair lay deep under the surface, beyond my reach, and beyond my
+power of meddling.
+ -- Joseph Conrad
+%
+Before I knew the best part of my life had come, it had gone.
+%
+Before marriage the three little words are "I love you," after marriage
+they are "Let's eat out."
+%
+Before really embarking on a sizeable project, in particular before
+starting the large investment of coding, try to kill the project
+first.
+ -- Edsger W. Dijkstra, EWD1308
+%
+Before Xerox, five carbons were the maximum extension of anybody's ego.
+%
+Before you ask more questions, think about whether
+you really want to know the answers.
+ -- Gene Wolfe, "The Claw of the Conciliator"
+%
+Before you criticize someone, you should walk a mile in their shoes.
+That way, when you criticize them, you're a mile away and you have
+their shoes.
+%
+Begathon, n.:
+ A multi-day event on public television, used to raise money so
+you won't have to watch commercials.
+%
+Beggar to well-dressed businessman:
+ "Could you spare $20.95 for a fifth of Chivas?"
+%
+Beggars should be no choosers.
+ -- John Heywood
+%
+Behind every argument is someone's ignorance.
+%
+Behind every great computer sits a skinny little geek.
+%
+Behind every successful man you'll find a woman with nothing to wear.
+%
+Behold the fool saith, "Put not all thine eggs in the one basket" -- which
+is but a manner of saying, "Scatter your money and your attention"; but
+the wise man saith, "Put all your eggs in the one basket and -- watch that
+basket!"
+ -- Mark Twain
+%
+Behold the warranty -- the bold print
+giveth and the fine print taketh away.
+%
+Beifeld's Principle:
+ The probability of a young man meeting a desirable and
+receptive young female increases by pyramidal progression when he is
+already in the company of: (1) a date, (2) his wife, (3) a better
+looking and richer male friend.
+%
+Being a mime means never having to say you're sorry.
+%
+Being a miner, as soon as you're too old and tired and sick and
+stupid to do your job properly, you have to go, where the very
+opposite applies with the judges.
+ -- Beyond the Fringe
+%
+Being a woman is a terribly difficult trade,
+since it consists principally of dealings with men.
+ -- Conrad
+%
+Being asked solicitously about the state of her health was becoming bothersome
+to the pregnant woman at the cocktail party. And yet another guest went over
+and inquired, "Well, how are you feeling these days?"
+ "Not too well," said the expectant mother. "You know, I've missed
+seven or eight periods now and it's beginning to worry me."
+%
+Being conservative has never been regarded as old-fashioned. But
+if you fight for a sensible step in the right direction which others
+has deserted you will be branded "reactionary".
+ -- Poul Henningsen (1894-1967)
+%
+"Being disintegrated makes me ve-ry an-gry!" <huff, huff>
+%
+Being frustrated is disagreeable, but the real
+disasters in life begin when you get what you want.
+%
+Being in politics is like being a football coach. You have to be smart
+enough to understand the game and dumb enough to think it's important.
+ -- Eugene McCarthy
+%
+Being in the army is like being in the Boy Scouts, except that the
+Boy Scouts have adult supervision.
+ -- Blake Clark
+%
+Being owned by someone used to be called
+slavery -- now it's called commitment.
+%
+Being popular is important. Otherwise people might not like you.
+%
+Being the #2 man in the Justice Department under Ed Meese is akin to
+standing next to a lamp post infested with pigeons.
+ -- unnamed Justice Department official
+%
+Being ugly isn't illegal. Yet.
+%
+Belief, n.:
+ Something you do not believe.
+%
+Believe everything you hear about the world; nothing is too
+impossibly bad.
+ -- Honore de Balzac
+%
+Bell Labs Unix -- Reach out and grep someone.
+%
+Ben, why didn't you tell me?
+ -- Luke Skywalker
+%
+Bennett's Laws of Horticulture:
+ (1) Houses are for people to live in.
+ (2) Gardens are for plants to live in.
+ (3) There is no such thing as a houseplant.
+%
+Benson, you are so free of the ravages of intelligence.
+ -- Time Bandits
+%
+Benson's Dogma:
+ ASCII is our god, and Unix is his profit.
+%
+Bento's Law: If It Can Break, It Will Break
+Bento's Corollary: If It Can Break, Kris Can Send Mail About It
+%
+Berkeley had what we called "copycenter," which is "take it down
+to the copy center and make as many copies as you want."
+ -- Kirk McKusick
+%
+Bernard Shaw is an excellent man; he has not an enemy in the world, and
+none of his friends like him either.
+ -- Oscar Wilde
+%
+Bernard was a young eighty-three, not a gomer, and able to talk. He'd been
+transferred from MBH (Man's Best Hospital), the House's Rival. Founded in
+Colonial times by the WASPs, the insemination of MBH by non-WASPs had taken
+place only mid-twentieth century with the token multidextrous Oriental
+surgeon, and finally, with the token red-hot internal-medicine Jew. Yet,
+MBH was still Brooks Brothers, while the House was still the Garment District.
+For Jews at MBH the password was "Dress British, Think Yiddish." It was
+rare to get a TURF from the MBH to the House, and the Fat Man was curious:
+"Bernard, you went to the MBH, they did a great work-up, and you told them,
+after they got done, you wanted to be transferred here. Why?"
+ "I rilly don't know," said Bernard.
+ "Was it the doctors there? The doctors you didn't like?"
+ "The doctus? Nah, the doctus I can't complain."
+ "The test or the room?"
+ "The tests or the room? Vell, nah, about them I can't complain."
+ "The nurses? The food?" asked Fats, but Bernard shook his head no.
+Fats laughed and said, "Listen, Bernie, you went to the MBH, they did this
+great workup, and when I asked you shy you came to the House of God, all you
+tell me is, 'Nah, I can't complain.' So why did you come here? Why, Bernie,
+why?"
+ "Vhy I come heah? Vell, said Bernie, "Heah I can complain."
+ -- House of God
+%
+Bershere's Formula for Failure:
+ There are only two kinds of people who fail: those who
+ listen to nobody... and those who listen to everybody.
+%
+Besides the device, the box should contain:
+
+* Eight little rectangular snippets of paper that say "WARNING"
+
+* A plastic packet containing four 5/17 inch pilfer grommets and two
+ club-ended 6/93 inch boxcar prawns.
+
+YOU WILL NEED TO SUPPLY: a matrix wrench and 60,000 feet of tram
+cable.
+
+IF ANYTHING IS DAMAGED OR MISSING: You IMMEDIATELY should turn to your
+spouse and say: "Margaret, you know why this country can't make a car
+that can get all the way through the drive-through at Burger King
+without a major transmission overhaul? Because nobody cares, that's
+why."
+
+WARNING: This is assuming your spouse's name is Margaret.
+ -- Dave Barry, "Read This First!"
+%
+Best Beer: A panel of tasters assembled by the Consumer's Union in 1969
+judged Coors and Miller's High Life to be among the very best. Those who
+doubt that beer is a serious subject might ponder its effect on American
+history. For example, New England's first colonists decided to drop anchor
+at Plymouth Rock instead of continuing on to Virginia because, as one of
+them put it, "We could not now take time for further consideration, our
+victuals being spent and especially our beer."
+ -- Felton & Fowler's Best, Worst & Most Unusual
+%
+Best Mistakes In Films
+ In his "Filmgoer's Companion", Mr. Leslie Halliwell helpfully lists
+four of the cinema's greatest moments which you should get to see if at all
+possible.
+ In "Carmen Jones", the camera tracks with Dorothy Dandridge down a
+street; and the entire film crew is reflected in the shop window.
+ In "The Wrong Box", the roofs of Victorian London are emblazoned
+with television aerials.
+ In "Decameron Nights", Louis Jourdain stands on the deck of his
+fourteenth century pirate ship; and a white lorry trundles down the hill
+in the background.
+ In "Viking Queen", set in the times of Boadicea, a wrist watch is
+clearly visible on one of the leading characters.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+Best of all is never to have been born.
+Second best is to die soon.
+%
+Beta test, v.:
+ To voluntarily entrust one's data, one's livelihood and one's
+ sanity to hardware or software intended to destroy all three.
+ In earlier days, virgins were often selected to beta test volcanos.
+%
+Better by far you should forget and
+smile than that you should remember and be sad.
+ -- Christina Rossetti
+%
+Better dead than mellow.
+%
+Better hope the life-inspector doesn't come
+around while you have your life in such a mess.
+%
+Better hope you get what you want before you stop wanting it.
+%
+Better late than never.
+ -- Titus Livius (Livy)
+%
+Better living a beggar than buried an emperor.
+%
+better !pout !cry
+better watchout
+lpr why
+santa claus <north pole >town
+
+cat /etc/passwd >list
+ncheck list
+ncheck list
+cat list | grep naughty >nogiftlist
+cat list | grep nice >giftlist
+santa claus <north pole >town
+
+who | grep sleeping
+who | grep awake
+who | egrep 'bad|good'
+for (goodness sake) {
+ be good
+}
+%
+Better the prince of some inferior court,
+Than second, or less, in beatific light.
+ -- Lucifer, Joost van den Vondel's "Lucifer"
+%
+Better to be nouveau than never to have been riche at all.
+%
+Better to light one candle than to curse the darkness.
+ -- motto of the Christopher Society
+%
+Better to use medicines at the outset than at the last moment.
+%
+Better tried by twelve than carried by six.
+ -- Jeff Cooper
+%
+Between 1950 and 1952, a bored weatherman, stationed north of Hudson Bay,
+left a monument that neither government nor time can eradicate. Using a
+bulldozer abandoned by the Air Force, he spent two years and great effort
+pushing boulders into a single word.
+ It can be seen from 10,000 feet, silhouetted against the snow.
+Government officials exchanged memos full of circumlocutions (no Latin
+equivalent exists) but failed to word an appropriation bill for the
+destruction of this cairn, that wouldn't alert the press and embarrass both
+Parliament and Party.
+ It stands today, a monument to human spirit. If life exists on other
+planets, this may be the first message received from us.
+ -- The Realist, November, 1964
+%
+Between grand theft and a legal fee, there only stands a law degree.
+%
+Between infinite and short there is a big difference.
+ -- G. H. Gonnet
+%
+Between the idea
+And the reality
+Between the motion
+And the act
+Falls the Shadow
+ -- T. S. Eliot, "The Hollow Man"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to system service dispatching.]
+%
+BEWARE! People acting under the influence of human nature.
+%
+Beware of a dark-haired man with a loud tie.
+%
+Beware of a tall black man with one blond shoe.
+%
+Beware of a tall blond man with one black shoe.
+%
+Beware of all enterprises that require new clothes, and not rather
+a new wearer of clothes.
+ -- Henry David Thoreau
+%
+Beware of Bigfoot!
+%
+Beware of bugs in the above code; I have only proved it correct, not
+tried it.
+ -- Donald E. Knuth
+%
+Beware of computerized fortune-tellers!
+%
+Beware of friends who are false and deceitful.
+%
+Beware of geeks bearing graft.
+%
+Beware of low-flying butterflies.
+%
+Beware of mathematicians and all those who make empty prophecies. The
+danger already exists that the mathematicians have made covenant with
+the devil to darken the spirit and to confine man in the bonds of hell.
+ -- St. Augustine
+%
+Beware of Programmers who carry screwdrivers.
+ -- Leonard Brandwein
+%
+Beware of self-styled experts: an ex is a has-been, and a spurt is a
+drip under pressure.
+%
+Beware of strong drink. It can make you
+shoot at tax collectors -- and miss.
+ -- Lazarus Long, "Time Enough For Love"
+%
+Beware of the man who knows the answer before he understands the question.
+%
+Beware of the Turing Tar-pit in which everything
+is possible but nothing of interest is easy.
+%
+Beware the new TTY code!
+%
+Beware the one behind you.
+%
+Bi, n.:
+ When *everybody* thinks you're a pervert.
+%
+Bierman's Laws of Contracts:
+ (1) In any given document, you can't cover all the "what if's".
+ (2) Lawyers stay in business resolving all the unresolved "what if's".
+ (3) Every resolved "what if" creates two unresolved "what if's".
+%
+Big book, big bore.
+ -- Callimachus
+%
+Big M, Little M, many mumbling mice
+Are making midnight music in the moonlight,
+Mighty nice!
+%
+Bigamy is having one spouse too many. Monogamy is the same.
+%
+Biggest security gap -- an open mouth.
+%
+Bilbo's First Law:
+ You cannot count friends that are all packed up in barrels.
+%
+Bill Dickey is learning me his experience.
+ -- Yogi Berra in his rookie season
+%
+Billy: Mom, you know that vase you said was handed down from
+ generation to generation?
+Mom: Yes?
+Billy: Well, this generation dropped it.
+%
+Binary, adj.:
+ Possessing the ability to have friends of both sexes.
+%
+Bingo, gas station, hamburger with a side order of airplane noise,
+and you'll be Gary, Indiana.
+ -- Jessie, "Greaser's Palace"
+%
+Bing's Rule:
+ Don't try to stem the tide -- move the beach.
+%
+Biology grows on you.
+%
+Biology is the only science in which
+multiplication means the same thing as division.
+%
+Bipolar, adj.:
+ Refers to someone who has homes in Nome, Alaska, and Buffalo,
+New York
+%
+Birds and bees have as much to do with the facts of life as black
+nightgowns do with keeping warm.
+ -- Hester Mundis, "Powermom"
+%
+Birds are entangled by their feet and men by their tongues.
+%
+Birth, n.:
+ The first and direst of all disasters.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Birthdays are like busses, never the number you want.
+%
+Bistromathics is simply a revolutionary new way of understanding the
+behavior of numbers. Just as Einstein observed that space was not an
+absolute, but depended on the observer's movement in space, and that
+time was not an absolute, but depended on the observer's movement in
+time, so it is now realized that numbers are not absolute, but depend
+on the observer's movement in restaurants.
+ -- Douglas Adams, "Life, The Universe and Everything"
+%
+Bit, n.:
+ A unit of measure applied to color. Twenty-four-bit color
+ refers to expensive $3 color as opposed to the cheaper 25
+ cent, or two-bit, color that use to be available a few years
+ ago.
+%
+Bit off more than my mind could chew,
+Shower or suicide, what do I do?
+ -- Julie Brown, "Will I Make it Through the Eighties?"
+%
+Biz is better.
+%
+Bizarreness is the essence of the exotic.
+%
+Bizoos, n.:
+ The millions of tiny individual bumps that make up a
+ basketball.
+ -- Rich Hall, "Sniglets"
+%
+Black people have never rioted. A riot is what white people think blacks
+are involved in when they burn stores.
+ -- Julius Lester
+%
+Black shiny mollies and bright colored guppies,
+Shy little angels as gentle as puppies,
+Swimming and diving with scarcely a swish,
+They were just some of my tropical fish.
+
+Then I got mantas that sting in the water,
+Deadly piranhas that itch for a slaughter,
+Savage male betas that bite with a squish,
+Now I have many less tropical fish.
+
+ If you think that
+ Fish are peaceful
+ That's an empty wish.
+ Just dump them together
+ And leave them alone,
+ And soon you will have -- no fish.
+ -- To My Favorite Things
+%
+Blackout, heatwave, .44 caliber homicide,
+The bums drop dead and the dogs go mad in packs on the West Side,
+A young girl standing on a ledge, looks like another suicide,
+She wants to hit those bricks,
+ 'cause the news at six got to stick to a deadline,
+While the millionaires hide in Beekman place,
+The bag ladies throw their bones in my face,
+I get attacked by a kid with stereo sound,
+I don't want to hear it but he won't turn it down...
+ -- Billy Joel, "Glass Houses"
+%
+Blame Saint Andreas -- it's all his fault.
+%
+Blessed are the forgetful: for they
+get the better even of their blunders.
+ -- Friedrich Nietzsche
+%
+Blessed are the young, for they shall inherit the national debt.
+ -- Herbert Hoover
+%
+Blessed are they that have nothing to say, and who cannot be persuaded
+to say it.
+ -- James Russell Lowell
+%
+Blessed are they who Go Around in Circles,
+for they Shall be Known as Wheels.
+%
+Blessed is he who expects no gratitude, for he shall not be disappointed.
+ -- W. C. Bennett
+%
+Blessed is he who expects nothing, for he shall never be disappointed.
+ -- Alexander Pope
+%
+Blessed is he who has reached the point of no return and knows it,
+for he shall enjoy living.
+ -- W. C. Bennett
+%
+Blessed is the man who, having nothing to say,
+abstains from giving wordy evidence of the fact.
+ -- George Eliot
+%
+Blinding speed can compensate for a lot of deficiencies.
+ -- David Nichols
+%
+BLISS is ignorance.
+%
+Blithwapping, v.:
+ Using anything BUT a hammer to hammer a nail into the
+ wall, such as shoes, lamp bases, doorstops, etc.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Blood flows down one leg and up the other.
+%
+Blood is thicker than water, and much tastier.
+%
+Bloom's Seventh Law of Litigation:
+ The judge's jokes are always funny.
+%
+Blore's Razor:
+ Given a choice between two theories, take the one which is
+funnier.
+%
+Blow it out your ear.
+%
+Blue paint today.
+ [Funny to Jack Slingwine, Guy Harris and Hal Pierson. Ed.]
+%
+Blutarsky's Axiom:
+ Nothing is impossible for the man who will not listen to reason.
+%
+Body by Nautilus, Brain by Mattel.
+%
+Boling's postulate:
+ If you're feeling good, don't worry. You'll get over it.
+%
+Bolub's Fourth Law of Computerdom:
+ Project teams detest weekly progress reporting because it so
+ vividly manifests their lack of progress.
+%
+Bombeck's Rule of Medicine:
+ Never go to a doctor whose office plants have died.
+%
+Bond reflected that good Americans were fine people and that most of them
+seemed to come from Texas.
+ -- Ian Fleming, "Casino Royale"
+%
+Bondage maybe, discipline never!
+ -- T. K.
+%
+Bones: "The man's DEAD, Jim!"
+%
+BOO! We changed Coke again! BLEAH! BLEAH!
+%
+Boob's Law:
+ You always find something in the last place you look.
+%
+Booker's Law:
+ An ounce of application is worth a ton of abstraction.
+%
+Bore, n.:
+ A guy who wraps up a two-minute idea in a two-hour vocabulary.
+ -- Walter Winchell
+%
+Bore, n.:
+ A person who talks when you wish him to listen.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Boren's Laws:
+ (1) When in charge, ponder.
+ (2) When in trouble, delegate.
+ (3) When in doubt, mumble.
+%
+Boss, n.:
+ According to the Oxford English Dictionary, in the Middle Ages the
+ words "boss" and "botch" were largely synonymous, except that boss,
+ in addition to meaning "a supervisor of workers" also meant "an
+ ornamental stud."
+%
+Boston, n.:
+ An outdoor Betty Ford Clinic.
+%
+Boston, n.:
+ Ludwig van Beethoven being jeered by 50,000 sports fans for
+finishing second in the Irish jig competition.
+%
+Boston State House is the hub of the Solar System. You couldn't pry
+that out of a Boston man if you had the tire of all creation
+straightened out for a crowbar.
+ -- O. W. Holmes
+%
+Both models are identical in performance, functional operation, and
+interface circuit details. The two models, however, are not compatible
+on the same communications line connection.
+ -- Bell System Technical Reference
+%
+Boucher's Observation:
+ He who blows his own horn always plays the music
+ several octaves higher than originally written.
+%
+Bounders get bound when they are caught bounding.
+ -- Ralph Lewin
+%
+Bower's Law:
+ Talent goes where the action is.
+%
+Bowie's Theorem:
+ If an experiment works, you must be using the wrong equipment.
+%
+Boy! Eucalyptus!
+%
+Boy, get your head out of the stars above,
+You get the maximum pleasure from a minimum of love.
+Save your heart and let your body be enough,
+To get the maximum pleasure from a minimum of love.
+Save your heart and let your body be enough,
+And get the maximum pleasure from a minimum of love.
+ -- Mac Macinelli, "Minimum Love"
+%
+Boy, I sure wish that I could be in the
+'Advanced Systems Development' group!
+%
+Boy, life takes a long time to live.
+ -- Steven Wright
+%
+Boy, n.:
+ A noise with dirt on it.
+%
+Boy, that crayon sure did hurt!
+%
+Boycott meat - suck your thumb.
+%
+Boys are beyond the range of anybody's sure understanding, at least
+when they are between the ages of 18 months and 90 years.
+ -- James Thurber
+%
+Boys will be boys, and so will a lot of middle-aged men.
+ -- Kin Hubbard
+%
+Bozo is the Brotherhood of Zips and Others. Bozos are people who band
+together for fun and profit. They have no jobs. Anybody who goes on a
+tour is a Bozo. Why does a Bozo cross the street? Because there's a Bozo
+on the other side. It comes from the phrase vos otros, meaning others.
+They're the huge, fat, middle waist. The archetype is an Irish drunk
+clown with red hair and nose, and pale skin. Fields, William Bendix.
+Everybody tends to drift toward Bozoness. It has Oz in it. They mean
+well. They're straight-looking except they've got inflatable shoes. They
+like their comforts. The Bozos have learned to enjoy their free time,
+which is all the time.
+ -- The Firesign Theatre, "If Bees Lived Inside Your Head"
+%
+Brace yourselves. We're about to try something that borders on the
+unique: an actually rather serious technical book which is not only
+(gasp) vehemently anti-Solemn, but also (shudder) takes sides. I tend
+to think of it as `Constructive Snottiness.'
+ -- Mike Padlipsky, Foreword to "Elements of Networking
+ Style"
+%
+Bradley's Bromide:
+ If computers get too powerful, we can organize
+ them into a committee -- that will do them in.
+%
+Brady's First Law of Problem Solving:
+ When confronted by a difficult problem, you can solve it more
+ easily by reducing it to the question, "How would the Lone Ranger
+ have handled this?"
+%
+Brain fried -- core dumped
+%
+Brain, n.:
+ The apparatus with which we think that we think.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Brain, v. [as in "to brain"]:
+ To rebuke bluntly, but not pointedly; to dispel a source
+ of error in an opponent.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+brain-damaged, generalization of "Honeywell Brain Damage" (HBD), a
+theoretical disease invented to explain certain utter cretinisms in
+Multics, adj.:
+ Obviously wrong; cretinous; demented. There is an implication
+ that the person responsible must have suffered brain damage,
+ because he/she should have known better. Calling something
+ brain-damaged is bad; it also implies it is unusable.
+%
+Brandy Davis, an outfielder and teammate of mine with the Pittsburgh Pirates,
+is my choice for team captain. Cincinnati was beating us 3-1, and I led
+off the bottom of the eighth with a walk. The next hitter banged a hard
+single to right field. Feeling the wind at my back, I rounded second and
+kept going, sliding safely into third base.
+ With runners at first and third, and home-run hitter Ralph Kiner at
+bat, our manager put in the fast Brandy Davis to run for the player at first.
+Even with Kiner hitting and a change to win the game with a home run, Brandy
+took off for second and made it. Now we had runners at second and third.
+ I'm standing at third, knowing I'm not going anywhere, and see Brandy
+start to take a lead. All of a sudden, here he comes. He makes a great slide
+into third, and I scream, "Brandy, where are you going?" He looks up, and
+shouts, "Back to second if I can make it."
+ -- Joe Garagiola, "It's Anybody's Ball Game"
+%
+Brandy-and-water spoils two good things.
+ -- Charles Lamb
+%
+Breadth-first search is the bulldozer of science.
+ -- Randy Goebel
+%
+Break into jail and claim police brutality.
+%
+Breast Feeding should not be attempted by fathers with hairy chests,
+since they can make the baby sneeze and give it wind.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Breathe deep the gathering gloom.
+Watch lights fade from every room.
+Bed-sitter people look back and lament;
+another day's useless energies spent.
+
+Impassioned lovers wrestle as one.
+Lonely man cries for love and has none.
+New mother picks up and suckles her son.
+Senior citizens wish they were young.
+
+Cold-hearted orb that rules the night;
+Removes the colors from our sight.
+Red is grey and yellow white.
+But we decide which is real, and which is an illusion."
+ -- The Moody Blues, "Days of Future Passed"
+%
+Breeding rabbits is a hare raising experience.
+%
+Bride, n.:
+ A woman with a fine prospect of happiness behind her.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Bridge ahead. Pay troll.
+%
+Briefcase, n.:
+ A trial where the jury gets together and forms a lynching party.
+%
+Briefly stated, the findings are that when presented with an array of
+data or a sequence of events in which they are instructed to discover
+an underlying order, subjects show strong tendencies to perceive order
+and causality in random arrays, to perceive a pattern or correlation
+which seems a priori intuitively correct even when the actual correlation
+in the data is counterintuitive, to jump to conclusions about the correct
+hypothesis, to seek and to use only positive or confirmatory evidence, to
+construe evidence liberally as confirmatory, to fail to generate or to
+assess alternative hypotheses, and having thus managed to expose themselves
+only to confirmatory instances, to be fallaciously confident of the validity
+of their judgments (Jahoda, 1969; Einhorn and Hogarth, 1978). In the
+analyzing of past events, these tendencies are exacerbated by failure to
+appreciate the pitfalls of post hoc analyses.
+ -- A. Benjamin
+%
+Brillineggiava, ed i tovoli slati
+ girlavano ghimbanti nella vaba;
+i borogovi eran tutti mimanti
+ e la moma radeva fuorigraba.
+
+"Figliuolo mio, sta' attento al Gibrovacco,
+ dagli artigli e dal morso lacerante;
+fuggi l'uccello Giuggiolo, e nel sacco
+ metti infine il frumioso Bandifante".
+ -- "The Jabberwock"
+%
+Bringing computers into the home won't change
+either one, but may revitalize the corner saloon.
+%
+Brisk talkers are usually slow thinkers. There is, indeed, no wild beast
+more to be dreaded than a communicative man having nothing to communicate.
+If you are civil to the voluble, they will abuse your patience; if
+brusque, your character.
+ -- Jonathan Swift
+%
+British education is probably the best in the world, if you can survive
+it. If you can't there is nothing left for you but the diplomatic corps.
+ -- Peter Ustinov
+%
+British Israelites:
+ The British Israelites believe the white Anglo-Saxons of Britain to
+be descended from the ten lost tribes of Israel deported by Sargon of Assyria
+on the fall of Sumeria in 721 B.C. ... They further believe that the future
+can be foretold by the measurements of the Great Pyramid, which probably
+means it will be big and yellow and in the hand of the Arabs. They also
+believe that if you sleep with your head under the pillow a fairy will come
+and take all your teeth.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Broad-mindedness, n.:
+ The result of flattening high-mindedness out.
+%
+Brogan's Constant:
+ People tend to congregate in the back
+ of the church and the front of the bus.
+%
+Brokee, n.:
+ Someone who buys stocks on the advice of a broker.
+%
+Brontosaurus Principle:
+ Organizations can grow faster than their brains can manage them
+in relation to their environment and to their own physiology: when
+this occurs, they are an endangered species.
+ -- Thomas K. Connellan
+%
+Brooke's Law:
+ Whenever a system becomes completely defined, some damn fool
+ discovers something which either abolishes the system or
+ expands it beyond recognition.
+%
+Brooks' Law:
+ Adding manpower to a late software project makes it later
+%
+Brucify, v.:
+ 1: Kill by nailing onto style(9); "David O'Brien was brucified"
+ 2: Annoy constantly by reminding of potential improvements
+ [syn: {torment}, {rag}, {tantalize}, {bedevil}, {dun},
+ {frustrate}]
+ 3: Fix problems that were indicated in an earlier brucification
+ (of one of the two other meanings).
+The word 'brucify' originally comes from the style-reviews of Bruce
+Evans of the FreeBSD project, but is now also sometimes used for
+reviews just done in his spirit.
+%
+BS: You remind me of a man.
+B: What man?
+BS: The man with the power.
+B: What power?
+BS: The power of voodoo.
+B: Voodoo?
+BS: You do.
+B: Do what?
+BS: Remind me of a man.
+B: What man?
+BS: The man with the power...
+ -- Cary Grant, "The Bachelor and the Bobby-Soxer"
+%
+Bubble Memory, n.:
+ A derogatory term, usually referring to a person's
+intelligence. See also "vacuum tube".
+%
+Buck-passing usually turns out to be a boomerang.
+%
+Bucy's Law:
+ Nothing is ever accomplished by a reasonable man.
+%
+Bug, n.:
+ An aspect of a computer program which exists because the
+programmer was thinking about Jumbo Jacks or stock options when s/he
+wrote the program.
+
+Fortunately, the second-to-last bug has just been fixed.
+ -- Ray Simard
+%
+Bug, n.:
+ An elusive creature living in a program that makes it incorrect.
+ The activity of "debugging", or removing bugs from a program, ends
+ when people get tired of doing it, not when the bugs are removed.
+ -- "Datamation", January 15, 1984
+%
+Bugs, pl. n.:
+ Small living things that small living boys throw on small
+ living girls.
+%
+Building translators is good clean fun.
+ -- T. Cheatham
+%
+BULLWINKLE: "You just leave that to my pal. He's the brains of the
+ outfit."
+GENERAL: "What does that make YOU?"
+BULLWINKLE: "What else? An executive..."
+ -- Jay Ward, "Rocky and Bullwinkle"
+%
+Bumper sticker:
+ All the parts falling off this car are
+ of the very finest British manufacture.
+%
+Bunker's Admonition:
+ You cannot buy beer; you can only rent it.
+%
+Burbulation, v.:
+ The obsessive act of opening and closing a refrigerator door in
+ an attempt to catch it before the automatic light comes on.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Bureau Termination, Law of:
+ When a government bureau is scheduled to be phased out,
+ the number of employees in that bureau will double within
+ 12 months after the decision is made.
+%
+Bureaucracy, n.:
+ A method for transforming energy into solid waste.
+%
+Bureaucrat, n.:
+ A person who cuts red tape sideways.
+ -- J. McCabe
+%
+Bureaucrat, n.:
+ A politician who has tenure.
+%
+Burke's Postulates:
+ Anything is possible if you don't know what you are talking about.
+ Don't create a problem for which you do not have the answer.
+%
+Burn's Hog Weighing Method:
+ (1) Get a perfectly symmetrical plank and balance it across a
+ sawhorse.
+ (2) Put the hog on one end of the plank.
+ (3) Pile rocks on the other end until the plank is again
+ perfectly balanced.
+ (4) Carefully guess the weight of the rocks.
+ -- Robert Burns
+%
+Burnt Sienna. That's the best thing that ever happened to Crayolas.
+ -- Ken Weaver
+%
+Bus error -- driver executed.
+%
+Bus error -- please leave by the rear door.
+%
+Bushydo -- the way of the shrub. Bonsai!
+%
+Business is a good game -- lots of competition
+and minimum of rules. You keep score with money.
+ -- Nolan Bushnell, founder of Atari
+%
+Business will be either better or worse.
+ -- Calvin Coolidge
+%
+But Captain -- the engines can't take this much longer!
+%
+But don't you worry, its for a cause -- feeding global corporations
+paws.
+%
+But, for my own part, it was Greek to me.
+ -- William Shakespeare, "Julius Caesar"
+%
+But has any little atom,
+ While a-sittin' and a-splittin',
+Ever stopped to think or CARE
+ That E = m c**2 ?
+%
+But I always fired into the nearest hill or, failing that, into blackness.
+I meant no harm; I just liked the explosions. And I was careful never to
+kill more than I could eat.
+ -- Raoul Duke
+%
+But I don't like Spam!!!!
+%
+"But I don't want to go on the cart..."
+"Oh, don't be such a baby!"
+"But I'm feeling much better..."
+"No you're not... in a moment you'll be stone dead!"
+ -- Monty Python, "The Holy Grail"
+%
+But I find the old notions somehow appealing. Not that I want to go
+back to them -- it is outrageous to have some outer authority tell you
+what is proper use and abuse of your own faculties, and it is ludicrous
+to hold reason higher than body or feeling. Still there is something
+true and profoundly sane about the belief that acts like murder or
+theft or assault violate the doer as well as the done to. We might
+even, if we thought this way, have less crime. The popular view of
+crime, as far as I can deduce it from the movies and television, is
+that it is a breaking of a rule by someone who thinks they can get away
+with that; implicitly, everyone would like to break the rule, but not
+everyone is arrogant enough to imagine they can get away with it. It
+therefore becomes very important for the rule upholders to bring such
+arrogance down.
+ -- Marilyn French, "The Woman's Room"
+%
+But if you wish at once to do nothing and to be respectable
+nowadays, the best pretext is to be at work on some profound study.
+ -- Leslie Stephen, "Sketches from Cambridge"
+%
+But in our enthusiasm, we could not resist a radical overhaul of the
+system, in which all of its major weaknesses have been exposed,
+analyzed, and replaced with new weaknesses.
+ -- Bruce Leverett,
+ "Register Allocation in Optimizing Compilers"
+%
+But it does move!
+ -- Galileo Galilei
+%
+But like the Good Book says... There's BIGGER DEALS to come!
+%
+But, Mousie, thou art no thy lane,
+In proving foresight may be vain:
+The best laid schemes o' mice an' men
+Gang aft a-gley,
+An' lea'e us nought but grief and pain
+For promised joy.
+ -- Robert Burns, "To a Mouse", 1785
+%
+But, officer, he's not drunk, I just saw his fingers twitch!
+%
+But Officer, I stopped for the last one, and it was green!
+%
+But officer, I was only trying to gain enough speed so I could coast
+to the nearest gas station.
+%
+But scientists, who ought to know
+Assure us that it must be so.
+Oh, let us never, never doubt
+What nobody is sure about.
+ -- Hilaire Belloc
+%
+But sex and drugs and rock & roll, why, they'd bring our blackest day.
+%
+But since I knew now that I could hope for nothing of greater value than
+frivolous pleasures, what point was there in denying myself of them?
+ -- M. Proust
+%
+But soft you, the fair Ophelia:
+Ope not thy ponderous and marble jaws,
+But get thee to a nunnery -- go!
+ -- Mark "The Bard" Twain
+%
+But the greatest Electrical Pioneer of them all was Thomas Edison, who
+was a brilliant inventor despite the fact that he had little formal
+education and lived in New Jersey. Edison's first major invention in
+1877, was the phonograph, which could soon be found in thousands of
+American homes, where it basically sat until 1923, when the record was
+invented. But Edison's greatest achievement came in 1879, when he
+invented the electric company. Edison's design was a brilliant
+adaptation of the simple electrical circuit: the electric company sends
+electricity through a wire to a customer, then immediately gets the
+electricity back through another wire, then (this is the brilliant
+part) sends it right back to the customer again.
+
+This means that an electric company can sell a customer the same batch
+of electricity thousands of times a day and never get caught, since
+very few customers take the time to examine their electricity closely.
+In fact the last year any new electricity was generated in the United
+States was 1937; the electric companies have been merely re-selling it
+ever since, which is why they have so much free time to apply for rate
+increases.
+ -- Dave Barry, "What is Electricity?"
+%
+But these pills can't be habit forming;
+I've been taking them for years.
+%
+But this has taken us far afield from interface, which is not a bad
+place to be, since I particularly want to move ahead to the kludge.
+Why do people have so much trouble understanding the kludge? What
+is a kludge, after all, but not enough K's, not enough ROM's, not
+enough RAM's, poor quality interface and too few bytes to go around?
+Have I explained yet about the bytes?
+%
+But what we need to know is, do people want nasally-insertable
+computers?
+%
+But you shall not escape my iambics.
+ -- Gaius Valerius Catullus
+%
+But you who live on dreams, you are better pleased with the sophistical
+reasoning and frauds of talkers about great and uncertain matters than
+those who speak of certain and natural matters, not of such lofty nature.
+ -- Leonardo da Vinci, "The Codex on the Flight of Birds"
+%
+Buzz off, Banana Nose; Relieve mine eyes
+Of hateful soreness, purge mine ears of corn;
+Less dear than army ants in apple pies
+Art thou, old prune-face, with thy chestnuts worn,
+Dropt from thy peeling lips like lousy fruit;
+Like honeybees upon the perfum'd rose
+They suck, and like the double-breasted suit
+Are out of date; therefore, Banana Nose,
+Go fly a kite, thy welcome's overstayed;
+And stem the produce of thy waspish wits:
+Thy logick, like thy locks, is disarrayed;
+Thy cheer, like thy complexion, is the pits.
+Be off, I say; go bug somebody new,
+Scram, beat it, get thee hence, and nuts to you.
+%
+Buzzword, n.:
+ The fly in the ointment of computer literacy.
+%
+By doing just a little every day, you can
+gradually let the task completely overwhelm you.
+%
+By failing to prepare, you are preparing to fail.
+%
+By long-standing tradition, I take this opportunity to savage other
+designers in the thin disguise of good, clean fun.
+ -- P. J. Plauger, "Computer Language", 1988, April
+ Fool's column.
+%
+By nature, men are nearly alike;
+by practice, they get to be wide apart.
+ -- Confucius
+%
+By necessity, by proclivity, and by delight, we all quote.
+In fact, it is as difficult to appropriate the thoughts of others
+as it is to invent.
+ -- Ralph Waldo Emerson
+ -- Quoted from a fortune cookie program
+ (whose author claims, "Actually, stealing IS easier.")
+ [to which I reply, "You think it's easy for me to
+ misconstrue all these misquotations?!?" Ed.]
+%
+By perseverance the snail reached the Ark.
+ -- Charles Spurgeon
+%
+By protracting life, we do not deduct one jot from the duration of death.
+ -- Titus Lucretius Carus
+%
+By the time they had diminished from 50 to 8, the other dwarves began
+to suspect "Hungry" ...
+ -- Gary Larson, "The Far Side"
+%
+By the time you swear you're his,
+shivering and sighing
+and he vows his passion is
+infinite, undying --
+Lady, make a note of this:
+One of you is lying.
+ -- Dorothy Parker, "Unfortunate Coincidence"
+%
+By the yard, life is hard.
+By the inch, it's a cinch.
+%
+By trying we can easily learn to endure adversity.
+Another man's, I mean.
+ -- Mark Twain
+%
+By working faithfully eight hours a day,
+you may eventually get to be boss and work twelve.
+ -- Robert Frost
+%
+BYOB, v.:
+ Believing Your Own Bull
+%
+Bypasses are devices that allow some people to dash from point A to
+point B very fast while other people dash from point B to point A very
+fast. People living at point C, being a point directly in between, are
+often given to wonder what's so great about point A that so many people
+from point B are so keen to get there and what's so great about point B
+that so many people from point A are so keen to get _t_h_e_r_e. They often
+wish that people would just once and for all work out where the hell
+they wanted to be.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+BYTE editors are people who separate the wheat from the chaff, and then
+carefully print the chaff.
+%
+Byte your tongue.
+%
+C Code.
+C Code Run.
+Run, Code, RUN!
+ PLEASE!!!!
+%
+C for yourself.
+%
+C++ is the best example of second-system effect since OS/360.
+%
+C makes it easy for you to shoot yourself in the foot. C++ makes that
+harder, but when you do, it blows away your whole leg.
+ -- Bjarne Stroustrup
+%
+C, n.:
+ A programming language that is sort of like Pascal except more like
+ assembly except that it isn't very much like either one, or anything
+ else. It is either the best language available to the art today, or
+ it isn't.
+ -- Ray Simard
+%
+Cabbage, n.:
+ A familiar kitchen-garden vegetable about as large and wise as
+ a man's head.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Cable is not a luxury, since many areas have poor TV reception.
+ -- The Mayor of Tucson, Arizona, 1989
+%
+Cache:
+ A very expensive part of the memory system of a computer that no one
+ is supposed to know is there.
+%
+California is a fine place to live -- if you happen to be an orange.
+ -- Fred Allen
+%
+Californians are a strange people. They'll put every chemical known to God
+and man up their nostrils and then laugh at you for putting sugar in your
+coffee.
+%
+Call on God, but row away from the rocks.
+ -- Indian proverb
+%
+Call things by their right names... Glass of brandy and water! That is the
+current but not the appropriate name: ask for a glass of fire and distilled
+damnation.
+ -- Robert Hall, in Olinthus Gregory's, "Brief Memoir of the
+ Life of Hall"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to logical names.]
+%
+Calling you stupid is an insult to stupid people!
+ -- Wanda, "A Fish Called Wanda"
+%
+Calm down, it's only ones and zeroes,
+Calm down, it's only bits and bytes,
+Calm down, and speak to me in English,
+Please realize that I'm not one of your computerites.
+%
+Calvin: "I wonder where we go when we die."
+Hobbes: "Pittsburgh?"
+Calvin: "You mean if we're good or if we're bad?"
+%
+Calvin Coolidge looks as if he had been weaned on a pickle.
+ -- Alice Roosevelt Longworth
+%
+Calvin Coolidge was the greatest man
+who ever came out of Plymouth Corner, Vermont.
+ -- Clarence Darrow
+%
+Campbell's Law:
+ Nature abhors a vacuous experimenter.
+%
+Campus crusade for Cthulhu -- it found me.
+%
+Campus sidewalks never exist as the straightest line between two
+points.
+ -- M. M. Johnston
+%
+Can anyone remember when the times
+were not hard, and money not scarce?
+%
+Can anything be sadder than work left unfinished?
+Yes, work never begun.
+%
+"Can you be more stupid than aggravating the judge AND your lawyer?
+No? Oh yes you can: You can aggravate the whole kernel community."
+ -- Alexander Lyamin (about Hans Reisers murder trial)
+%
+Can you buy friendship? You not only can, you must. It's the
+only way to obtain friends. Everything worthwhile has a price.
+ -- Robert J. Ringer
+%
+Canada Bill Jones's Motto:
+ It's morally wrong to allow suckers to keep their money.
+
+Canada Bill Jones's Supplement:
+ A Smith and Wesson beats four aces.
+%
+Canada Post doesn't really charge 32 cents for a stamp.
+It's 2 cents for postage and 30 cents for storage.
+ -- Gerald Regan, Cabinet Minister, 12/31/83 Financial Post
+%
+Cancel me not -- for what then shall remain?
+Abscissas, some mantissas, modules, modes,
+A root or two, a torus and a node:
+The inverse of my verse, a null domain.
+ -- Stanislaw Lem, "Cyberiad"
+%
+CANCER (June 21 - July 22)
+ This is a good time for those of you who are rich and happy,
+ but a poor time for those of you born under this sign who are
+ poor and unhappy. To tell you the truth, any day is tough
+ when you're poor and unhappy.
+%
+CANCER (June 21 - July 22)
+ You are sympathetic and understanding to other people's
+problems. They think you are a sucker. You are always putting things
+off. That's why you'll never make anything of yourself. Most welfare
+recipients are Cancer people.
+%
+Canonical, adj.:
+ The usual or standard state or manner of something. A true story:
+One Bob Sjoberg, new at the MIT AI Lab, expressed some annoyance at the use
+of jargon. Over his loud objections, we made a point of using jargon as
+much as possible in his presence, and eventually it began to sink in.
+Finally, in one conversation, he used the word "canonical" in jargon-like
+fashion without thinking.
+ Steele: "Aha! We've finally got you talking jargon too!"
+ Stallman: "What did he say?"
+ Steele: "He just used `canonical' in the canonical way."
+%
+Can't act. Slightly bald. Also dances.
+ -- RKO executive, reacting to Fred Astaire's screen test
+ Cerf/Navasky, "The Experts Speak"
+%
+Can't open /usr/games/fortunes. Lid stuck on cookie jar.
+%
+Can't open /usr/share/games/fortune/fortunes.dat.
+%
+Capitalism is the extraordinary belief that the nastiest of men, for
+the nastiest of reasons, will somehow work for the benefit of us all.
+ -- John Maynard Keynes
+%
+CAPRICORN (Dec 22 - Jan 19)
+ Play your hunches. This is a day when luck will play an important
+ part in your life. If you were smarter, you wouldn't need so much
+ luck and you wouldn't be reading your horoscope, either. You are
+ a suspicious person, and it will occur to you that astrologers
+ don't know what they're talking about any more than your Aunt Martha.
+%
+CAPRICORN (Dec. 22 to Jan. 19)
+ Follow your instincts. You are much too scatterbrained to do anything
+ else, such as think. Romance is in the air, but not for you, so forget
+ it. That pimple on the end of your nose will get worse.
+%
+CAPRICORN (Dec 23 - Jan 19)
+ You are conservative and afraid of taking risks. You don't do
+ much of anything and are lazy. There has never been a Capricorn
+ of any importance. Capricorns should avoid standing still for
+ too long as they tend to take root and become trees.
+%
+Captain Penny's Law:
+ You can fool all of the people some of the time, and
+ some of the people all of the time, but you Can't Fool Mom.
+%
+Captain's Log, star date 21:34.5...
+%
+Carelessly planned projects take three times longer to complete than expected.
+Carefully planned projects take four times longer to complete than expected,
+mostly because the planners expect their planning to reduce the time it
+takes.
+%
+Carmel, New York, has an ordinance forbidding men to wear coats and
+trousers that don't match.
+%
+Carney's Law: There's at least a 50-50 chance that someone will print
+the name Craney incorrectly.
+ -- Jim Canrey
+%
+Carob works on the principle that, when mixed with the right combination of
+fats and sugar, it can duplicate chocolate in color and texture. Of course,
+the same can be said of dirt.
+%
+Carperpetuation (kar' pur pet u a shun), n.:
+ The act, when vacuuming, of running over a string at least a
+ dozen times, reaching over and picking it up, examining it,
+ then putting it back down to give the vacuum one more chance.
+ -- Rich Hall, "Sniglets"
+%
+Carson's Consolation:
+ Nothing is ever a complete failure.
+ It can always be used as a bad example.
+%
+Carson's Observation on Footwear:
+ If the shoe fits, buy the other one too.
+%
+Carswell's Corollary:
+ Whenever man comes up with a better mousetrap,
+ nature invariably comes up with a better mouse.
+%
+Cat, n.:
+ Lapwarmer with built-in buzzer.
+%
+Catch a wave and you're sitting on top of the world.
+ -- The Beach Boys
+%
+Catharsis is something I associate with pornography and crossword puzzles.
+ -- Howard Chaykin
+%
+Catproof is an oxymoron, childproof nearly so.
+%
+Cats are intended to teach us that not everything in nature has a function.
+ -- Garrison Keillor
+%
+Cats are smarter than dogs. You can't make eight cats pull
+a sled through the snow.
+%
+Cats, no less liquid than their shadows, offer no angles to the wind.
+%
+Cauliflower is nothing but cabbage with a college education.
+ -- Mark Twain, "Pudd'nhead Wilson"
+%
+Caution: Breathing may be hazardous to your health.
+%
+Caution: Keep out of reach of children.
+%
+CChheecckk yyoouurr dduupplleexx sswwiittcchh..
+%
+CCI Power 6/40: one board, a megabyte of cache, and an attitude...
+%
+Cecil, you're my final hope
+Of finding out the true Straight Dope
+For I have been reading of Schrodinger's cat
+But none of my cats are at all like that.
+This unusual animal (so it is said)
+Is simultaneously alive and dead!
+What I don't understand is just why he
+Can't be one or the other, unquestionably.
+My future now hangs in between eigenstates.
+In one I'm enlightened, in the other I ain't.
+If *you* understand, Cecil, then show me the way
+And rescue my psyche from quantum decay.
+But if this queer thing has perplexed even you,
+Then I will *_a_n_d* I won't see you in Schrodinger's zoo.
+ -- Randy F., Chicago, "The Straight Dope, a compendium
+ of human knowledge" by Cecil Adams
+%
+Celebrate Hannibal Day this year. Take an elephant to lunch.
+%
+Celestial navigation is based on the premise that the Earth is the center
+of the universe. The premise is wrong, but the navigation works. An
+incorrect model can be a useful tool.
+ -- Kelvin Throop III
+%
+Census Taker to Housewife:
+Did you ever have the measles, and, if so, how many?
+%
+Center meeting at 4pm in 2C-543.
+%
+Cerebral atrophy, n.:
+ The phenomena which occurs as brain cells become weak and sick, and
+impair the brain's performance. An abundance of these "bad" cells can cause
+symptoms related to senility, apathy, depression, and overall poor academic
+performance. A certain small number of brain cells will deteriorate due to
+everyday activity, but large amounts are weakened by intense mental effort
+and the assimilation of difficult concepts. Many college students become
+victims of this dread disorder due to poor habits such as overstudying.
+
+Cerebral darwinism, n.:
+ The theory that the effects of cerebral atrophy can be reversed
+through the purging action of heavy alcohol consumption. Large amounts of
+alcohol cause many brain cells to perish due to oxygen deprivation. Through
+the process of natural selection, the weak and sick brain cells will die
+first, leaving only the healthy cells. This wonderful process leaves the
+imbiber with a healthier, more vibrant brain, and increases mental capacity.
+Thus, the devastating effects of cerebral atrophy are reversed, and academic
+performance actually increases beyond previous levels.
+%
+Cerebus: I'd love to lick apricot brandy out of your navel.
+Jaka: Look, Cerebus -- Jaka has to tell you ... something
+Cerebus: If Cerebus had a navel, would you lick apricot brandy
+ out of it?
+Jaka: Ugh!
+Cerebus: You don't like apricot brandy?
+ -- Cerebus #6, "The Secret"
+%
+Certain old men prefer to rise at dawn, taking a cold bath and a long
+walk with an empty stomach and otherwise mortifying the flesh. They
+then point with pride to these practices as the cause of their sturdy
+health and ripe years; the truth being that they are hearty and old,
+not because of their habits, but in spite of them. The reason we find
+only robust persons doing this thing is that it has killed all the
+others who have tried it.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Certain passages in several laws have always defied interpretation and
+the most inexplicable must be a matter of opinion. A judge of the Court
+of Session of Scotland has sent the editors of this book his candidate
+which reads, "In the Nuts (unground), (other than ground nuts) Order,
+the expression nuts shall have reference to such nuts, other than ground
+nuts, as would but for this amending Order not qualify as nuts
+(unground) (other than ground nuts) by reason of their being nuts
+(unground)."
+ -- Guinness Book of World Records, 1973
+%
+Certainly the game is rigged.
+Don't let that stop you; if you don't bet, you can't win.
+ -- Robert A. Heinlein, "Time Enough For Love"
+%
+Certainly there are things in life that money can't buy,
+But it's very funny --
+did you ever try buying them without money?
+ -- Ogden Nash
+%
+C'est magnifique, mais ce n'est pas la guerre!
+%
+C'est magnifique, mais ce n'est pas l'Informatique.
+ -- Bosquet [on seeing the IBM 4341]
+%
+CF&C stole it, fair and square.
+ -- Tim Hahn
+%
+Chairman of the Bored.
+%
+Chamberlain's Laws:
+ 1: The big guys always win.
+ 2: Everything tastes more or less like chicken.
+%
+Chance is perhaps the work of God when He did not want to sign.
+ -- Anatole France
+%
+Change your thoughts and you change your world.
+%
+Changing husbands/wives is only changing troubles.
+ -- Kathleen Norris
+%
+Chaos is King and Magic is loose in the world.
+%
+Chapter 2: Newtonian Growth and Decay
+
+ The growth-decay formulas were developed in the trivial fashion by
+Isaac Newton's famous brother Phigg. His idea was to provide an equation
+that would describe a quantity that would dwindle and dwindle, but never
+quite reach zero. Historically, he was merely trying to work out his
+mortgage. Another versatile equation also emerged, one which would define
+a function that would continue to grow, but never reach unity. This equation
+can be applied to charging capacitors, over-damped springs, and the human
+race in general.
+%
+Character density, n.:
+ The number of very weird people in the office.
+%
+Character is what you are in the dark!
+ -- Lord John Whorfin
+%
+Charity begins at home.
+ -- Publius Terentius Afer (Terence)
+%
+Charity, n.:
+ A thing that begins at home and usually stays there.
+%
+Charlie Brown: Why was I put on this earth?
+Linus: To make others happy.
+Charlie Brown: Why were others put on this earth?
+%
+Charlie was a chemist,
+But Charlie is no more.
+What Charlie thought was H2O was H2SO4.
+%
+Charm is a way of getting the answer "Yes" --
+without having asked any clear question.
+%
+Cheap things are of no value, valuable things are not cheap.
+%
+Check me if I'm wrong, Sandy, but if I kill all the golfers...
+they're gonna lock me up and throw away the key!
+%
+Checkuary, n.:
+ The thirteenth month of the year. Begins New Year's Day and ends
+ when a person stops absentmindedly writing the old year on his checks.
+%
+Cheer Up! Things are getting worse at a slower rate.
+%
+Cheese -- milk's leap toward immortality.
+ -- Clifton Fadiman, "Any Number Can Play"
+%
+Chef, n.:
+ Any cook who swears in French.
+%
+Cheit's Lament:
+ If you help a friend in need, he is sure to remember you--
+ the next time he's in need.
+%
+Chemicals, n.:
+ Noxious substances from which modern foods are made.
+%
+Chemist who falls in acid is absorbed in work.
+%
+Chemist who falls in acid will be tripping for weeks.
+%
+Chemistry is applied theology.
+ -- Augustus Stanley Owsley III
+%
+Chemistry professors never die, they just fail to react.
+%
+Cheops' Law:
+ Nothing ever gets built on schedule or within budget.
+%
+Chess tonight.
+%
+Chicago law prohibits eating in a place that is on fire.
+%
+Chicago, n.:
+ Where the dead still vote ... early and often!
+%
+Chicago Transit Authority Rider's Rule #36:
+ Never ever ask the tough looking gentleman wearing El Rukn
+ headgear where he got his "pyramid powered pizza warmer".
+ -- Chicago Reader 3/27/81
+%
+Chicago Transit Authority Rider's Rule #84:
+ The CTA has complimentary pop-up timers available on request
+for overheated passengers. When your timer pops up, the driver will
+cheerfully baste you.
+ -- Chicago Reader 5/28/82
+%
+Chicagoan: "So, where're you from?"
+Hoosier: "What's wrong with Indiana?"
+%
+Chicken Little only has to be right once.
+%
+Chicken Little was right.
+%
+Chicken Soup, n.:
+ An ancient miracle drug containing equal parts of aureomycin,
+ cocaine, interferon, and TLC. The only ailment chicken soup
+ can't cure is neurotic dependence on one's mother.
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+Chihuahuas drive me crazy. I can't stand anything that
+shivers when it's warm.
+%
+Children are like cats, they can tell when you don't like
+them. That's when they come over and violate your body space.
+%
+Children are natural mimics who act like their parents
+despite every effort to teach them good manners.
+%
+Children are unpredictable. You never know what inconsistency they're
+going to catch you in next.
+ -- Franklin P. Jones
+%
+Children aren't happy without something to ignore,
+And that's what parents were created for.
+ -- Ogden Nash
+%
+Children begin by loving their parents. After a time they judge them.
+Rarely, if ever, do they forgive them.
+ -- Oscar Wilde
+%
+Children seldom misquote you. In fact, they usually
+repeat word for word what you shouldn't have said.
+%
+Children's talent to endure stems from their ignorance of alternatives.
+ -- Maya Angelou, "I Know Why the Caged Bird Sings"
+%
+Chinese saying: "He who speak with forked tongue, not need chopsticks."
+%
+Chism's Law of Completion:
+ The amount of time required to complete a government project is
+ precisely equal to the length of time already spent on it.
+%
+Chisolm's First Corollary to Murphy's Second Law:
+ When things just can't possibly get any worse, they will.
+%
+Chivalry, Schmivalry!
+ Roger the thief has a
+ method he uses for
+ sneaky attacks:
+Folks who are reading are
+ Characteristically
+ Always Forgetting to
+ Guard their own bac ...
+%
+Chocolate Chip.
+%
+Choose in marriage only a woman whom you would choose as
+a friend if she were a man.
+ -- Joubert
+%
+Chorus:
+ Grandma got run over by a reindeer,
+ Walking home from our house Christmas eve.
+ You can say there's no such thing as Santa,
+ But as for me and Grandpa, we believe!
+She'd been drinking too much eggnog,
+And we begged her not to go.
+But she'd forgot her medication, When we found her Christmas morning,
+And she staggered through the door At the scene of the attack.
+ out in the snow. She had hoofprints on her forehead,
+ And incriminating claus-marks on her
+Now we're all so proud of Grandpa, back.
+He's been taking this so well.
+See him in there watching football. I've warned all my friends and
+Drinking beer and playing cards neighbors,
+ with cousin Mel. Better watch out for yourselves!
+ They should never give a license,
+ To a man who drives a sleigh and
+ plays with elves!
+ -- Elmo and Patsy, "Grandma Got Run Over by a Reindeer"
+%
+Christ died for our sins, so let's not disappoint Him.
+%
+Christianity might be a good thing if anyone ever tried it.
+ -- George Bernard Shaw
+%
+Christmas time is here, by Golly; Kill the turkeys, ducks and chickens;
+Disapproval would be folly; Mix the punch, drag out the Dickens;
+Deck the halls with hunks of holly; Even though the prospect sickens,
+Fill the cup and don't say when... Brother, here we go again.
+
+On Christmas day, you can't get sore; Relations sparing no expense'll,
+Your fellow man you must adore; Send some useless old utensil,
+There's time to rob him all the more, Or a matching pen and pencil,
+The other three hundred and sixty-four! Just the thing I need... how nice.
+
+It doesn't matter how sincere Hark The Herald-Tribune sings,
+It is, nor how heartfelt the spirit; Advertising wondrous things.
+Sentiment will not endear it; God Rest Ye Merry Merchants,
+What's important is... the price. May you make the Yuletide pay.
+ Angels We Have Heard On High,
+Let the raucous sleighbells jingle; Tell us to go out and buy.
+Hail our dear old friend, Kris Kringle, Sooooo...
+Driving his reindeer across the sky,
+Don't stand underneath when they fly by!
+ -- Tom Lehrer
+%
+Churchill's Commentary on Man:
+ Man will occasionally stumble over the truth,
+ but most of the time he will pick himself up and continue on.
+%
+Cigarette, n.:
+ A fire at one end, a fool at the other, and a bit of tobacco in
+ between.
+%
+Cinemuck, n.:
+ The combination of popcorn, soda, and melted chocolate which
+ covers the floors of movie theaters.
+ -- Rich Hall, "Sniglets"
+%
+Circumstances rule men; men do not rule circumstances.
+ -- Herodotus
+%
+Civilization and profits go hand in hand.
+ -- Calvin Coolidge
+%
+Civilization, as we know it, will end sometime this evening.
+See SYSNOTE tomorrow for more information.
+%
+Civilization is the limitless multiplication of unnecessary necessities.
+ -- Mark Twain
+%
+Clairvoyant, n.:
+ A person, commonly a woman, who has the power of seeing that
+ which is invisible to her patron -- namely, that he is a
+ blockhead.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Claret is the liquor for boys; port for men; but he who
+aspires to be a hero... must drink brandy.
+ -- Samuel Johnson
+%
+Clarke's Conclusion:
+ Never let your sense of morals interfere with doing the right thing.
+%
+Class, that's the only thing that counts in life. Class.
+Without class and style, a man's a bum; he might as well be dead.
+ -- "Bugsy" Siegel
+%
+Class: when they're running you out of town, to look like you're
+leading the parade.
+ -- Bill Battie
+%
+Classical music is the kind we keep thinking will turn into a tune.
+ -- Kin Hubbard, "Abe Martin's Sayings"
+%
+Clay's Conclusion:
+ Creativity is great, but plagiarism is faster.
+%
+Cleaning your house while your kids are still growing is like shoveling
+the walk before it stops snowing.
+ -- Phyllis Diller
+%
+Cleanliness becomes more important when godliness is unlikely.
+ -- P. J. O'Rourke
+%
+CLEVELAND:
+ Where their last tornado did six
+ million dollars worth of improvements.
+%
+Cleveland still lives. God _m_u_s_t be dead.
+%
+Cleveland?
+Yes, I spent a week there one day.
+%
+Climate and Surgery
+ R C Gilchrist, who was shot by J Sharp twelve days ago, and who
+received a derringer ball in the right breast, and who it was supposed at
+the time could not live many hours, was on the street yesterday and the
+day before - walking several blocks at a time. To those who design to be
+riddled with bullets or cut to pieces with Bowie-knives, we cordially
+recommend our Sacramento climate and Sacramento surgery.
+ -- Sacramento Daily Union, September 11, 1861
+%
+Climbing onto a bar stool, a piece of string asked for a beer.
+ "Wait a minute. Aren't you a string?"
+ "Well, yes, I am."
+ "Sorry. We don't serve strings here."
+ The determined string left the bar and stopped a passer-by. "Excuse,
+me," it said, "would you shred my ends and tie me up like a pretzel?" The
+passer-by obliged, and the string re-entered the bar. "May I have a beer,
+please?" it asked the bartender.
+ The barkeep set a beer in front of the string, then suddenly stopped.
+"Hey, aren't you the string I just threw out of here?"
+ "No, I'm a frayed knot."
+%
+Clone, n.:
+ 1. An exact duplicate, as in "our product is a clone of their
+ product." 2. A shoddy, spurious copy, as in "their product
+ is a clone of our product."
+%
+Clones are people two.
+%
+Cloning is the sincerest form of flattery.
+%
+Clothes make the man.
+Naked people have little or no influence on society.
+ -- Mark Twain
+%
+Clovis' Consideration of an Atmospheric Anomaly:
+ The perversity of nature is nowhere better demonstrated
+ than by the fact that, when exposed to the same atmosphere,
+ bread becomes hard while crackers become soft.
+%
+Coach: Can I draw you a beer, Norm?
+Norm: No, I know what they look like. Just pour me one.
+ -- Cheers, No Help Wanted
+
+Coach: How about a beer, Norm?
+Norm: Hey I'm high on life, Coach. Of course, beer is my life.
+ -- Cheers, No Help Wanted
+
+Coach: How's a beer sound, Norm?
+Norm: I dunno. I usually finish them before they get a word in.
+ -- Cheers, Fortune and Men's Weights
+%
+Coach: How's it going, Norm?
+Norm: Daddy's rich and Momma's good lookin'.
+ -- Cheers, Truce or Consequences
+
+Sam: What's up, Norm?
+Norm: My nipples. It's freezing out there.
+ -- Cheers, Coach Returns to Action
+
+Coach: What's the story, Norm?
+Norm: Thirsty guy walks into a bar. You finish it.
+ -- Cheers, Endless Slumper
+%
+Coach: What would you say to a beer, Normie?
+Norm: Daddy wuvs you.
+ -- Cheers, The Mail Goes to Jail
+
+Sam: What'd you like, Normie?
+Norm: A reason to live. Gimme another beer.
+ -- Cheers, Behind Every Great Man
+
+Sam: What will you have, Norm?
+Norm: Well, I'm in a gambling mood, Sammy. I'll take a glass
+ of whatever comes out of that tap.
+Sam: Oh, looks like beer, Norm.
+Norm: Call me Mister Lucky.
+ -- Cheers, The Executive's Executioner
+%
+Coach: What's up, Norm?
+Norm: Corners of my mouth, Coach.
+ -- Cheers, Fortune and Men's Weights
+
+Coach: What's shaking, Norm?
+Norm: All four cheeks and a couple of chins, Coach.
+ -- Cheers, Snow Job
+
+Coach: Beer, Normie?
+Norm: Uh, Coach, I dunno, I had one this week.
+ Eh, why not, I'm still young.
+ -- Cheers, Snow Job
+%
+COBOL:
+ An exercise in Artificial Inelegance.
+%
+COBOL:
+ Completely Over and Beyond reason Or Logic.
+%
+COBOL is for morons.
+ -- Edsger W. Dijkstra
+%
+Cobol programmers are down in the dumps.
+%
+Code rot -- mostly caused by people redefining "fresh".
+ -- Wes Peters
+%
+Coding is easy; All you do is sit staring at a
+terminal until the drops of blood form on your forehead.
+%
+Cogito cogito ergo cogito sum --
+"I think that I think, therefore I think that I am."
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Cogito ergo I'm right and you're wrong.
+ -- Blair Houghton
+%
+Cohen's Law:
+ There is no bottom to worse.
+%
+Cohn's Law:
+ The more time you spend in reporting on what you are doing, the less
+ time you have to do anything. Stability is achieved when you spend
+ all your time reporting on the nothing you are doing.
+%
+Coincidence, n.:
+ You weren't paying attention to the other half of what was
+ going on.
+%
+Coincidences are spiritual puns.
+ -- G. K. Chesterton
+%
+Cold, adj.:
+ When the politicians walk around with their hands in their own
+ pockets.
+%
+Cold hands, no gloves.
+%
+Cole's Law:
+ Thinly sliced cabbage.
+%
+Collaboration, n.:
+ A literary partnership based on the false assumption that the
+ other fellow can spell.
+%
+COLLEGE:
+ The fountains of knowledge, where everyone goes to drink.
+%
+College football is a game which would be much more interesting if the
+faculty played instead of the students, and even more interesting if
+the trustees played. There would be a great increase in broken arms,
+legs, and necks, and simultaneously an appreciable diminution in the
+loss to humanity.
+ -- H. L. Mencken
+%
+COLORADO:
+ Where they don't buy M & M's, 'cause they're so hard to peel.
+%
+Colorless green ideas sleep furiously.
+%
+Column 1 Column 2 Column 3
+
+0. integrated 0. management 0. options
+1. total 1. organizational 1. flexibility
+2. systematized 2. monitored 2. capability
+3. parallel 3. reciprocal 3. mobility
+4. functional 4. digital 4. programming
+5. responsive 5. logistical 5. concept
+6. optional 6. transitional 6. time-phase
+7. synchronized 7. incremental 7. projection
+8. compatible 8. third-generation 8. hardware
+9. balanced 9. policy 9. contingency
+
+ The procedure is simple. Think of any three-digit number, then select
+the corresponding buzzword from each column. For instance, number 257 produces
+"systematized logistical projection," a phrase that can be dropped into
+virtually any report with that ring of decisive, knowledgeable authority. "No
+one will have the remotest idea of what you're talking about," says Broughton,
+"but the important thing is that they're not about to admit it."
+ -- Philip Broughton, "How to Win at Wordsmanship"
+%
+Colvard's Logical Premises:
+ All probabilities are 50%.
+Either a thing will happen or it won't.
+
+Colvard's Unconscionable Commentary:
+ This is especially true when
+ dealing with someone you're attracted to.
+
+Grelb's Commentary:
+ Likelihoods, however, are 90% against you.
+%
+Come, every frustum longs to be a cone,
+And every vector dreams of matrices.
+Hark to the gentle gradient of the breeze:
+It whispers of a more ergodic zone.
+ -- Stanislaw Lem, "Cyberiad"
+%
+Come fill the cup and in the fire of spring
+Your winter garment of repentance fling.
+The bird of time has but a little way
+To flutter -- and the bird is on the wing.
+ -- Omar Khayyam
+%
+Come home America.
+ -- George McGovern, 1972
+%
+Come, landlord, fill the flowing bowl until it does run over,
+Tonight we will all merry be -- tomorrow we'll get sober.
+ -- John Fletcher, "The Bloody Brother", II, 2
+%
+Come, let us hasten to a higher plane,
+Where dyads tread the fairy fields of Venn,
+Their indices bedecked from one to _n,
+Commingled in an endless Markov chain!
+ -- Stanislaw Lem, "Cyberiad"
+%
+Come live with me, and be my love,
+And we will some new pleasures prove
+Of golden sands, and crystal brooks,
+With silken lines, and silver hooks.
+ -- John Donne
+%
+Come live with me and be my love,
+And we will some new pleasures prove
+Of golden sands and crystal brooks
+With silken lines, and silver hooks.
+There's nothing that I wouldn't do
+If you would be my POSSLQ.
+
+You live with me, and I with you,
+And you will be my POSSLQ.
+I'll be your friend and so much more;
+That's what a POSSLQ is for.
+
+And everything we will confess;
+Yes, even to the IRS.
+Some day on what we both may earn,
+Perhaps we'll file a joint return.
+You'll share my pad, my taxes, joint;
+You'll share my life - up to a point!
+And that you'll be so glad to do,
+Because you'll be my POSSLQ.
+%
+Come, muse, let us sing of rats!
+ -- From a poem by James Grainger (1721-1767)
+%
+Come quickly, I am tasting stars!
+ -- Dom Perignon, upon discovering champagne
+%
+Come, you spirits
+That tend on mortal thoughts, unsex me here,
+And fill me, from the crown to the toe, top-full
+Of direst cruelty! make thick my blood,
+Stop up the access and passage to remorse
+That no compunctious visiting of nature
+Shake my fell purpose, not keep peace between
+The effect and it! Come to my woman's breasts,
+And take my milk for gall, you murdering ministers,
+Wherever in your sightless substances
+You wait on nature's mischief! Come, thick night,
+And pall the in the dunnest smoke of hell,
+That my keen knife see not the wound it makes,
+Nor heaven peep through the blanket of the dark,
+To cry `Hold, hold!'
+ -- Lady Macbeth, "Macbeth"
+%
+Comedy, like Medicine, was never meant to be practiced by the general public.
+%
+Coming to Stores Near You:
+
+101 Grammatically Correct Popular Tunes Featuring:
+
+ (You Aren't Anything but a) Hound Dog
+ It Doesn't Mean a Thing If It Hasn't Got That Swing
+ I'm Not Misbehaving
+
+And A Whole Lot More...
+%
+Coming together is a beginning;
+ keeping together is progress;
+ working together is success.
+%
+Command, n.:
+ Statement presented by a human and accepted by a computer in
+ such a manner as to make the human feel as if he is in control.
+%
+Commit the oldest sins the newest kind of ways.
+ -- William Shakespeare, "Henry IV"
+%
+Commitment, n.:
+ Commitment can be illustrated by a breakfast of ham and eggs.
+ The chicken was involved, the pig was committed.
+%
+Committee, n.:
+ A group of men who individually can do nothing but as a group
+ decide that nothing can be done.
+ -- Fred Allen
+%
+Committee Rules:
+ (1) Never arrive on time, or you will be stamped a beginner.
+ (2) Don't say anything until the meeting is half over; this
+ stamps you as being wise.
+ (3) Be as vague as possible; this prevents irritating the
+ others.
+ (4) When in doubt, suggest that a subcommittee be appointed.
+ (5) Be the first to move for adjournment; this will make you
+ popular -- it's what everyone is waiting for.
+%
+Committees have become so important nowadays that subcommittees have to
+be appointed to do the work.
+%
+Common sense and a sense of humor are the same thing, moving at
+different speeds. A sense of humor is just common sense, dancing.
+ -- Clive James
+%
+Common sense is instinct, and enough of it is genius.
+ -- Josh Billings
+%
+Common sense is the collection of prejudices acquired by age eighteen.
+ -- Albert Einstein
+%
+Common sense is the most evenly distributed quantity in the world.
+Everyone thinks he has enough.
+ -- Rene Descartes, 1637
+%
+Commoner's three laws of ecology:
+ 1) No action is without side-effects.
+ 2) Nothing ever goes away.
+ 3) There is no free lunch.
+%
+Communicate! It can't make things any worse.
+%
+Comparing information and knowledge is like asking whether the fatness
+of a pig is more or less green than the designated hitter rule."
+ -- David Guaspari
+%
+Comparing software engineering to classical engineering assumes that software
+has the ability to wear out. Software typically behaves, or it does not. It
+either works, or it does not. Software generally does not degrade, abrade,
+stretch, twist, or ablate. To treat it as a physical entity, therefore, is
+misapplication of our engineering skills. Classical engineering deals with
+the characteristics of hardware; software engineering should deal with the
+characteristics of *software*, and not with hardware or management.
+ -- Dan Klein
+%
+COMPASS [for the CDC-6000 series] is the sort of assembler
+one expects from a corporation whose president codes in octal.
+ -- J. N. Gray
+%
+Competence, like truth, beauty, and contact lenses,
+is in the eye of the beholder.
+ -- Dr. Laurence J. Peter
+%
+Competitive fury is not always anger. It is the true missionary's
+courage and zeal in facing the possibility that one's best may not
+be enough.
+ -- Gene Scott
+%
+COMPLEX SYSTEM:
+ One with real problems and imaginary profits.
+%
+COMPLIMENT:
+ When you say something to another which everyone knows isn't true.
+%
+Compuberty, n.:
+ The uncomfortable period of emotional and hormonal changes a
+ computer experiences when the operating system is upgraded and
+ a sun4 is put online sharing files.
+%
+COMPUTER:
+ An electronic entity which performs sequences of useful steps in a
+ totally understandable, rigorously logical manner. If you believe
+ this, see me about a bridge I have for sale in Manhattan.
+%
+Computer programmers do it byte by byte.
+%
+Computer programmers never die, they just get lost in the processing.
+%
+Computer programs expand so as to fill the core available.
+%
+COMPUTER SCIENCE:
+ 1) A study akin to numerology and astrology, but lacking the
+ precision of the former and the success of the latter.
+ 2) The protracted value analysis of algorithms.
+ 3) The costly enumeration of the obvious.
+ 4) The boring art of coping with a large number of trivialities.
+ 5) Tautology harnessed in the service of Man at the speed of light.
+ 6) The Post-Turing decline in formal systems theory.
+%
+Computer Science is no more about computers than astronomy is about
+telescopes.
+ -- Edsger W. Dijkstra
+%
+Computer Science is the only discipline in which we view
+adding a new wing to a building as being maintenance
+ -- Jim Horning
+%
+Computers are not intelligent. They only think they are.
+%
+Computers are unreliable, but humans are even more unreliable.
+Any system which depends on human reliability is unreliable.
+ -- Gilb
+%
+Computers are useless. They can only give you answers.
+ -- Pablo Picasso
+%
+Computers can figure out all kinds of problems, except the things in
+the world that just don't add up.
+%
+Computers can't cruise. Meandering is a foreign concept to them.
+The computer assumes that all behavior is in pursuit of an ultimate
+goal. Whenever a motorist changes his or her mind and veers off
+course, the GPS lady issues that snippy announcement: "Recalculating!"
+ -- Joel Achenbach (www.slate.com, 20 Jun 2008)
+%
+Computers don't actually think.
+ You just think they think.
+ (We think.)
+%
+Computers will not be perfected until they can compute how much more
+than the estimate the job will cost.
+%
+Conceit causes more conversation than wit.
+ -- Francois de La Rochefoucauld
+%
+Concept, n.:
+ Any "idea" for which an outside consultant billed you more than
+ $25,000.
+%
+Conceptual integrity in turn dictates that the design must proceed
+from one mind, or from a very small number of agreeing resonant minds.
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+Condense soup, not books!
+%
+CONFERENCE:
+ A special meeting in which the boss gathers subordinates to hear
+ what they have to say, so long as it doesn't conflict with what
+ he's already decided to do.
+%
+Confess your sins to the Lord and you will be forgiven;
+confess them to man and you will be laughed at.
+ -- Josh Billings
+%
+Confession is good for the soul, but bad for the career.
+%
+Confession is good for the soul only in the sense
+that a tweed coat is good for dandruff.
+ -- Peter de Vries
+%
+Confessions may be good for the soul, but they are bad for
+the reputation.
+ -- Lord Thomas Robert Dewar
+%
+Confidant, confidante, n.:
+ One entrusted by A with the secrets of B, confided to himself by C.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Confidence is simply that quiet, assured feeling you have before you
+fall flat on your face.
+ -- Dr. L. Binder
+%
+Confidence is the feeling you have before you understand the situation.
+%
+CONFIRMED BACHELOR:
+ A man who goes through life without a hitch.
+%
+Conflicting research paradigms
+Have legitimized various crimes.
+ The worst we can see
+ Is in psychology,
+Measuring reaction times.
+%
+Conformity is the refuge of the unimaginative.
+%
+Confucius say too damn much!
+%
+Confucius say too much.
+ -- Recent Chinese proverb
+%
+Confusion will be my epitaph
+as I walk a cracked and broken path
+If we make it we can all sit back and laugh
+but I fear that tomorrow we'll be crying.
+ -- King Crimson, "In the Court of the Crimson King"
+%
+Congratulations! You are the one-millionth user to log into our system.
+If there's anything special we can do for you, anything at all, don't
+hesitate to ask!
+%
+Congratulations! You have purchased an extremely fine device that
+would give you thousands of years of trouble-free service, except that
+you undoubtably will destroy it via some typical bonehead consumer
+maneuver. Which is why we ask you to PLEASE FOR GOD'S SAKE READ THIS
+OWNER'S MANUAL CAREFULLY BEFORE YOU UNPACK THE DEVICE. YOU ALREADY
+UNPACKED IT, DIDN'T YOU? YOU UNPACKED IT AND PLUGGED IT IN AND TURNED
+IT ON AND FIDDLED WITH THE KNOBS, AND NOW YOUR CHILD, THE SAME CHILD
+WHO ONCE SHOVED A POLISH SAUSAGE INTO YOUR VIDEOCASSETTE RECORDER AND
+SET IT ON "FAST FORWARD", THIS CHILD ALSO IS FIDDLING WITH THE KNOBS,
+RIGHT? AND YOU'RE JUST NOW STARTING TO READ THE INSTRUCTIONS,
+RIGHT??? WE MIGHT AS WELL JUST BREAK THESE DEVICES RIGHT AT THE
+FACTORY BEFORE WE SHIP THEM OUT, YOU KNOW THAT?
+ -- Dave Barry, "Read This First!"
+%
+Congratulations are in order for Tom Reid.
+
+He says he just found out he is the winner of the 2021 Psychic of the
+Year award.
+%
+Congratulations!
+
+Some products leave home silently, some go kicking and screaming. If
+v1.0 was the first born who came downstairs with shoes untied missing
+a sock and a belt, then this one was a full fledged punk rocker
+with neon hair and multiple piercings. I believe we squeezed it into
+a suit and tie and brought its color back to an earth tone before it
+left.
+
+ -- An HP engineering project manager who shall remain
+ nameless to the development team after releasing
+ the second version of their product.
+%
+Conjecture: All odd numbers are prime.
+
+ Mathematician's Proof:
+ 3 is prime. 5 is prime. 7 is prime. By induction, all
+ odd numbers are prime.
+ Physicist's Proof:
+ 3 is prime. 5 is prime. 7 is prime. 9 is experimental
+ error. 11 is prime. 13 is prime ...
+ Engineer's Proof:
+ 3 is prime. 5 is prime. 7 is prime. 9 is prime.
+ 11 is prime. 13 is prime ...
+ Computer Scientist's Proof:
+ 3 is prime. 3 is prime. 3 is prime. 3 is prime...
+%
+Connector Conspiracy, n.:
+ [probably came into prominence with the appearance of the
+KL-10, none of whose connectors match anything else] The tendency of
+manufacturers (or, by extension, programmers or purveyors of anything)
+to come up with new products which don't fit together with the old
+stuff, thereby making you buy either all new stuff or expensive
+interface devices.
+%
+Conquering Russia should be done steppe by steppe.
+%
+Conquering the world on horseback is easy; it is dismounting and
+governing that is hard.
+ -- Chinggis (Genghis) Khan
+%
+Conscience doth make cowards of us all.
+ -- William Shakespeare
+%
+Conscience is a mother-in-law whose visit never ends.
+ -- H. L. Mencken
+%
+Conscience is defined as the thing that hurts
+when everything else feels great.
+%
+Conscience is the inner voice that warns us somebody may be looking.
+ -- H. L. Mencken, "A Mencken Chrestomathy"
+%
+Conscious is when you are aware of something and conscience is when you
+wish you weren't.
+%
+CONSENT DECREE:
+ A document in which a hapless company consents never to commit
+ in the future whatever heinous violations of Federal law it
+ never admitted to in the first place.
+%
+Consequences, Schmonsequences, as long as I'm rich.
+ -- "Ali Baba Bunny" [1957, Chuck Jones]
+%
+Conservative, n.:
+ A statesman who is enamored of existing evils, as distinguished
+ from the Liberal who wishes to replace them with others.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Consider a spherical bear, in simple harmonic motion...
+ -- Professor in the UCB physics department
+%
+Consider the following axioms carefully:
+ "Everything's better when it sits on a Ritz."
+ and
+ "Everything's better with Blue Bonnet on it."
+What happens if one spreads Blue Bonnet margarine on a Ritz cracker? The
+thought is frightening. Is this how God came into being? Try not to
+consider the fact that "Things go better with Coke".
+%
+Consider the little mouse, how sagacious an animal
+it is which never entrusts its life to one hole only.
+ -- Titus Maccius Plautus
+%
+Consider the postage stamp: its usefulness consists in
+the ability to stick to one thing till it gets there.
+ -- Josh Billings
+%
+CONSULTANT:
+ (1) Someone you pay to take the watch off your wrist and tell
+ you what time it is. (2) (For resume use) The working title
+ of anyone who doesn't currently hold a job. Motto: Have
+ Calculator, Will Travel.
+%
+CONSULTANT:
+ An ordinary man a long way from home.
+%
+CONSULTANT:
+ [From con "to defraud, dupe, swindle," or, possibly, French con
+ (vulgar) "a person of little merit" + sult elliptical form of
+ "insult."] A tipster disguised as an oracle, especially one who
+ has learned to decamp at high speed in spite of a large briefcase
+ and heavy wallet.
+%
+CONSULTANT:
+ Someone who'd rather climb a tree and tell a
+ lie than stand on the ground and tell the truth.
+%
+Consultants are mystical people who ask a
+company for a number and then give it back to them.
+%
+CONSULTATION:
+ Medical term meaning "to share the wealth."
+%
+Contemporary American feminism's simplistic psychology is illustrated by
+the new cliche of the date-rape furor: "`No' always means `no'." Will
+we ever graduate from the Girl Scouts? "No" has always been, and always
+will be, part of the dangerous alluring courtship ritual of sex and
+seduction, observable even in the animal kingdom.
+ -- Camille Paglia, NY Times, Dec. 14 1990, Op Ed.
+%
+"Contrariwise," continued Tweedledee, "if it was so, it might be, and
+if it were so, it would be; but as it isn't, it ain't. That's logic!"
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+Contrary to popular belief, penguins are not the salvation of modern
+technology. Neither do they throw parties for the urban proletariat.
+%
+Convention is the ruler of all.
+ -- Pindar
+%
+Conversation enriches the understanding,
+but solitude is the school of genius.
+%
+Conversation, n.:
+ A vocal competition in which the one who is catching his breath
+ is called the listener.
+%
+Conway's Law:
+ In any organization there will always be one person who knows
+ what is going on.
+
+ This person must be fired.
+%
+Cops never say good-bye. They're always hoping to see you again in the
+line-up.
+ -- Raymond Chandler
+%
+COPYING MACHINE:
+ A device that shreds paper, flashes mysteriously coded messages,
+ and makes duplicates for everyone in the office who isn't
+ interested in reading them.
+%
+Coronation, n.:
+ The ceremony of investing a sovereign with the outward and
+ visible signs of his divine right to be blown skyhigh with a
+ dynamite bomb.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Correction does much, but encouragement does more.
+ -- Johann Wolfgang von Goethe
+%
+Corrupt, adj.:
+ In politics, holding an office of trust or profit.
+%
+Corrupt, stupid grasping functionaries will make at least as big a muddle
+of socialism as stupid, selfish and acquisitive employers can make of
+capitalism.
+ -- Walter Lippmann
+%
+Corruption is not the No. 1 priority of the Police Commissioner.
+His job is to enforce the law and fight crime.
+ -- P.B.A. President E. J. Kiernan
+%
+Corry's Law:
+ Paper is always strongest at the perforations.
+%
+Couldn't we jury-rig the cat to act as an audio switch, and have it yell
+at people to save their core images before logging them out? I'm sure
+the cattle prod would be effective in this regard. In any case, a traverse
+mounted iguana, while more perverted, gives better traction, not to mention
+being easier to stake.
+%
+Counting in binary is just like counting
+in decimal -- if you are all thumbs.
+ -- Glaser and Way
+%
+Counting in octal is just like counting
+in decimal -- if you don't use your thumbs.
+ -- Tom Lehrer
+%
+Courage is fear that has said its prayers.
+%
+Courage is grace under pressure.
+%
+Courage is resistance to fear, mastery of fear -- not absence of fear.
+ -- Mark Twain
+%
+Courage is your greatest present need.
+%
+Court, n.:
+ A place where they dispense with justice.
+ -- Arthur Train
+%
+Courtship to marriage, as a very witty prologue to a very dull play.
+ -- William Congreve
+%
+Coward, n.:
+ One who in a perilous emergency thinks with his legs.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+[Crash programs] fail because they are based on the theory that,
+with nine women pregnant, you can get a baby a month.
+ -- Wernher von Braun
+%
+Crazee Edeee, his prices are INSANE!!!
+%
+Creating computer software is always a demanding and painstaking
+process -- an exercise in logic, clear expression, and almost fanatical
+attention to detail. It requires intelligence, dedication, and an
+enormous amount of hard work. But, a certain amount of unpredictable
+and often unrepeatable inspiration is what usually makes the difference
+between adequacy and excellence.
+%
+Creativity in living is not without its attendant difficulties, for
+peculiarity breeds contempt. And the unfortunate thing about being
+ahead of your time when people finally realize you were right, they'll
+say it was obvious all along.
+ -- Alan Ashley-Pitt
+%
+Creativity is no substitute for knowing what you are doing.
+%
+Creativity is not always bred in an environment of tranquility;
+sometimes you have to squeeze a little to get the paste out of the tube.
+%
+Credit ... is the only enduring testimonial to man's confidence in man.
+ -- James Blish
+%
+CREDITOR:
+ A man who has a better memory than a debtor.
+%
+Crenna's Law of Political Accountability:
+ If you are the first to know about something bad,
+ you are going to be held responsible for acting on it,
+ regardless of your formal duties.
+%
+Crime does not pay... as well as politics.
+ -- A. E. Neuman
+%
+Critic, n.:
+ A person who boasts himself hard to please because nobody tries
+ to please him.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Criticism comes easier than craftsmanship.
+ -- Zeuxis
+%
+Critics are like eunuchs in a harem: they know how it's done, they've
+seen it done every day, but they're unable to do it themselves.
+ -- Brendan Behan
+%
+Crito, I owe a cock to Asclepius; will you remember to pay the debt?
+ -- Socrates' last words
+%
+Croll's Query:
+ If tin whistles are made of tin, what are foghorns made of?
+%
+Cropp's Law:
+ The amount of work done varies inversely
+ with the time spent in the office.
+%
+Crucifixes are sexy because there's a naked man on them.
+ -- Madonna
+%
+Cruickshank's Law of Committees:
+ If a committee is allowed to discuss a bad idea long enough, it
+ will inevitably decide to implement the idea simply because so
+ much work has already been done on it.
+%
+Crusade for Cthulhu! It Found ME!
+%
+Crush! Kill! Destroy!
+%
+Cthulhu Cthucks!
+%
+Cthulhu for President!
+ (If you're tired of choosing the lesser of two evils.)
+%
+Cthulhu Saves -- in case He's hungry later.
+%
+Culture is the habit of being pleased with the best and knowing why.
+%
+Cure the disease and kill the patient.
+ -- Francis Bacon
+%
+CURSOR:
+ One whose program will not run.
+ -- Robb Russon
+%
+Cursor address, n.:
+ "Hello, cursor!"
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+curtation n. The enforced compression of a string in the fixed-length field
+environment.
+ The problem of fitting extremely variable-length strings such as names,
+addresses, and item descriptions into fixed-length records is no trivial
+matter. Neglect of the subtle art of curtation has probably alienated more
+people than any other aspect of data processing. You order Mozart's "Don
+Giovanni" from your record club, and they invoice you $24.95 for MOZ DONG.
+The witless mapping of the sublime onto the ridiculous! Equally puzzling is
+the curtation that produces the same eight characters, THE BEST, whether you
+order "The Best of Wagner", "The Best of Schubert", or "The Best of the Turds".
+Similarly, wine lovers buying from computerized wineries twirl their glasses,
+check their delivery notes, and inform their friends, "A rather innocent,
+possibly overtruncated CAB SAUV 69 TAL." The squeezing of fruit into 10
+columns has yielded such memorable obscenities as COX OR PIP. The examples
+cited are real, and the curtational methodology which produced them is still
+with us.
+
+MOZ DONG n.
+ Curtation of Don Giovanni by Wolfgang Amadeus Mozart and Lorenzo da
+Ponte, as performed by the computerized billing ensemble of the Internat'l
+Preview Society, Great Neck (sic), N.Y.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+Custer committed Siouxicide.
+%
+Cut a man's hand when you fight him. He'll freeze, fascinated by the sight
+of his own blood. That's when you stick him in the throat.
+ -- Gerry Youghkins
+
+If you look rather casual with the knife when you flick it open, people
+don't like it.
+ -- Gerry Youghkins
+%
+Cutler Webster's Law:
+ There are two sides to every argument, unless a person
+ is personally involved, in which case there is only one.
+%
+Cutting the space budget really restores my faith in humanity. It
+eliminates dreams, goals, and ideals and lets us get straight to the
+business of hate, debauchery, and self-annihilation.
+ -- Johnny Hart
+%
+Cynic, n.:
+ A blackguard whose faulty vision sees things as they are, not
+ as they ought to be. Hence the custom among the Scythians of
+ plucking out a cynic's eyes to improve his vision.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Cynic, n.:
+ Experienced.
+%
+Cynic, n.:
+ One who looks through rose-colored glasses with a jaundiced
+ eye.
+%
+Dad always thought laughter was the best medicine, which I guess is why
+several of us died of tuberculosis.
+ -- Jack Handey
+%
+<Daibashiw> Wasn't EMACS originally developed as a swap memory stresser,
+though?
+
+<``Erik> lispos emulator? gotta admit it's well featured, the only thing
+it lacks is a decent editor
+%
+DALLAS:
+ The city that chose Astroturf to
+ keep the cheerleaders from grazing.
+%
+Dammit Jim, I'm an actor not a doctor.
+%
+Dammit, man, that's unprofessional! A good bartender laughs anyway!
+%
+Damn braces.
+ -- William Blake, "Proverbs of Hell"
+%
+Damn, I need a Coke!
+ -- Dr. William DeVries
+ [after implanting the first artificial human heart]
+%
+DAMN IT, I GOTTA GET OUTTA HERE!
+%
+Dare to be naive.
+ -- R. Buckminster Fuller
+%
+Dark and lonely on a summer night
+ Kill my landlord,
+ Kill my landlord.
+The watchdog barkin'
+Do he bite?
+ Kill my landlord,
+ Kill my landlord.
+Slip in his window.
+Break his neck.
+Then his house I start to wreck
+Got no reason,
+What the heck?
+ Kill my landlord,
+ Kill my landlord.
+ C-I-L-L my landlord!
+ -- "Images" by Tyrone Green, SNL
+%
+Darling: the popular form of address used in speaking to a member of the
+opposite sex whose name you cannot at the moment remember.
+ -- Oliver Herford
+%
+Darth Vader! Only you would be so bold!
+ -- Princess Leia Organa
+%
+Darth Vader sleeps with a Teddywookie.
+%
+DATA:
+ An accrual of straws on the backs of theories.
+%
+DATA:
+ Computerspeak for "information". Properly pronounced
+ the way Bostonians pronounce the word for a female child.
+%
+Data is not information;
+Information is not knowledge;
+Knowledge is not wisdom;
+ -- Gary Flake
+%
+Dave Mack: "Your stupidity, Allen, is simply not up to par."
+Allen Gwinn: "Yours is."
+%
+David Letterman's "Things we can be proud of as Americans":
+
+ * Greatest number of citizens who have actually boarded a UFO
+ * Many newspapers feature "JUMBLE"
+ * Hourly motel rates
+ * Vast majority of Elvis movies made here
+ * Didn't just give up right away during World War II
+ like some countries we could mention
+ * Goatees & Van Dykes thought to be worn only by weenies
+ * Our well-behaved golf professionals
+ * Fabulous babes coast to coast
+%
+David Sarnoff, 1964: "The computer will become the hub of a vast network of
+remote data stations and information banks feeding into the machine at
+a transmission rate of a billion or more bits of information a
+second. Laser channels will vastly increase both data capacity and the
+speeds with which it will be transmitted. Eventually, a global
+communications network handling voice, data and facsimile will
+instantly link man to machine--or machine to machine--by land, air,
+underwater, and space circuits. [The computer] will affect man's
+ways of thinking, his means of education, his relationship to his physical
+and social environment, and it will alter his ways of living...
+[Before the end of this century, these forces] will coalesce into what
+unquestionably will become the greatest adventure of the human mind."
+ -- Eugene Lyons, "David Sarnoff" 1966
+%
+Davis' Law of Traffic Density:
+ The density of rush-hour traffic is directly proportional to
+ 1.5 times the amount of extra time you allow to arrive on time.
+%
+Davis's Dictum:
+ Problems that go away by themselves, come back by themselves.
+%
+Dawn, n.:
+ The time when men of reason go to bed.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Day of inquiry. You will be subpoenaed.
+%
+%DCL-E-MEMBAD, bad memory
+-SYSTEM-F-VMSPDGERS, pudding between the ears
+%
+DEADWOOD:
+ Anyone in your company who is more senior than you are.
+%
+Dealing with failure is easy:
+ Work hard to improve.
+Success is also easy to handle:
+ You've solved the wrong problem. Work hard to improve.
+%
+Dealing with the problem of pure staff accumulation,
+all our researches ... point to an average increase of 5.75% per year.
+ -- C. N. Parkinson
+%
+Dear Emily:
+ How can I choose what groups to post in?
+ -- Confused
+
+Dear Confused:
+ Pick as many as you can, so that you get the widest audience. After
+all, the net exists to give you an audience. Ignore those who suggest you
+should only use groups where you think the article is highly appropriate.
+Pick all groups where anybody might even be slightly interested.
+ Always make sure followups go to all the groups. In the rare event
+that you post a followup which contains something original, make sure you
+expand the list of groups. Never include a "Followup-to:" line in the
+header, since some people might miss part of the valuable discussion in
+the fringe groups.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily:
+ I collected replies to an article I wrote, and now it's time to
+summarize. What should I do?
+ -- Editor
+
+Dear Editor:
+ Simply concatenate all the articles together into a big file and post
+that. On USENET, this is known as a summary. It lets people read all the
+replies without annoying newsreaders getting in the way. Do the same when
+summarizing a vote.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily:
+ I recently read an article that said, "reply by mail, I'll summarize."
+What should I do?
+ -- Doubtful
+
+Dear Doubtful:
+ Post your response to the whole net. That request applies only to
+dumb people who don't have something interesting to say. Your postings are
+much more worthwhile than other people's, so it would be a waste to reply by
+mail.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily:
+ I saw a long article that I wish to rebut carefully, what should
+I do?
+ -- Angry
+
+Dear Angry:
+ Include the entire text with your article, and include your comments
+between the lines. Be sure to post, and not mail, even though your article
+looks like a reply to the original. Everybody *loves* to read those long
+point-by-point debates, especially when they evolve into name-calling and
+lots of "Is too!" -- "Is not!" -- "Is too, twizot!" exchanges.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily:
+ I'm having a serious disagreement with somebody on the net. I
+tried complaints to his sysadmin, organizing mail campaigns, called for
+his removal from the net and phoning his employer to get him fired.
+Everybody laughed at me. What can I do?
+ -- A Concerned Citizen
+
+Dear Concerned:
+ Go to the daily papers. Most modern reporters are top-notch computer
+experts who will understand the net, and your problems, perfectly. They
+will print careful, reasoned stories without any errors at all, and surely
+represent the situation properly to the public. The public will also all
+act wisely, as they are also fully cognizant of the subtle nature of net
+society.
+ Papers never sensationalize or distort, so be sure to point out things
+like racism and sexism wherever they might exist. Be sure as well that they
+understand that all things on the net, particularly insults, are meant
+literally. Link what transpires on the net to the causes of the Holocaust, if
+possible. If regular papers won't take the story, go to a tabloid paper --
+they are always interested in good stories.
+%
+Dear Emily:
+ I'm still confused as to what groups articles should be posted
+to. How about an example?
+ -- Still Confused
+
+Dear Still:
+ Ok. Let's say you want to report that Gretzky has been traded from
+the Oilers to the Kings. Now right away you might think rec.sport.hockey
+would be enough. WRONG. Many more people might be interested. This is a
+big trade! Since it's a NEWS article, it belongs in the news.* hierarchy
+as well. If you are a news admin, or there is one on your machine, try
+news.admin. If not, use news.misc.
+ The Oilers are probably interested in geology, so try sci.physics.
+He is a big star, so post to sci.astro, and sci.space because they are also
+interested in stars. Next, his name is Polish sounding. So post to
+soc.culture.polish. But that group doesn't exist, so cross-post to
+news.groups suggesting it should be created. With this many groups of
+interest, your article will be quite bizarre, so post to talk.bizarre as
+well. (And post to comp.std.mumps, since they hardly get any articles
+there, and a "comp" group will propagate your article further.)
+ You may also find it is more fun to post the article once in each
+group. If you list all the newsgroups in the same article, some newsreaders
+will only show the article to the reader once! Don't tolerate this.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily:
+ Today I posted an article and forgot to include my signature.
+What should I do?
+ -- Forgetful
+
+Dear Forgetful:
+ Rush to your terminal right away and post an article that says,
+"Oops, I forgot to post my signature with that last article. Here
+it is."
+ Since most people will have forgotten your earlier article,
+(particularly since it dared to be so boring as to not have a nice, juicy
+signature) this will remind them of it. Besides, people care much more
+about the signature anyway.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Emily, what about test messages?
+ -- Concerned
+
+Dear Concerned:
+ It is important, when testing, to test the entire net. Never test
+merely a subnet distribution when the whole net can be done. Also put "please
+ignore" on your test messages, since we all know that everybody always skips
+a message with a line like that. Don't use a subject like "My sex is female
+but I demand to be addressed as male." because such articles are read in depth
+by all USEnauts.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Dear Freshman,
+ You don't know who I am and frankly shouldn't care, but
+unknown to you we have something in common. We are both rather
+prone to mistakes. I was elected Student Government President by
+mistake, and you came to school here by mistake.
+%
+Dear Lord:
+ I just want *_o_n_e* one-armed manager so I never have to hear "On
+the other hand", again.
+%
+Dear Lord: Please make my words sweet and tender, for tomorrow I may
+have to eat them.
+%
+Dear Miss Manners:
+ My home economics teacher says that one must never place one's
+elbows on the table. However, I have read that one elbow, in between
+courses, is all right. Which is correct?
+
+Gentle Reader:
+ For the purpose of answering examinations in your home
+economics class, your teacher is correct. Catching on to this principle
+of education may be of even greater importance to you now than learning
+correct current table manners, vital as Miss Manners believes that is.
+%
+Dear Miss Manners:
+I carry a big black umbrella, even if there's just a thirty percent chance of
+rain. May I ask a young lady who is a stranger to me to share its protection?
+This morning, I was waiting for a bus in comparative comfort, my umbrella
+protecting me from the downpour, and noticed an attractive young woman getting
+soaked. I have often seen her at my bus stop, although we have never spoken,
+and I don't even know her name. Could I have asked her to get under my
+umbrella without seeming insulting?
+
+Gentle Reader:
+Certainly. Consideration for those less fortunate than you is always proper,
+although it would be more convincing if you stopped babbling about how
+attractive she is. In order not to give Good Samaritanism a bad name, Miss
+Manners asks you to allow her two or three rainy days of unmolested protection
+before making your attack.
+%
+Dear Mister Language Person: I am curious about the expression, "Part
+of this complete breakfast". The way it comes up is, my 5-year-old
+will be watching TV cartoon shows in the morning, and they'll show a
+commercial for a children's compressed breakfast compound such as
+"Froot Loops" or "Lucky Charms", and they always show it sitting on a
+table next to some actual food such as eggs, and the announcer always
+says: "Part of this complete breakfast". Don't that really mean,
+"Adjacent to this complete breakfast", or "On the same table as this
+complete breakfast"? And couldn't they make essentially the same claim
+if, instead of Froot Loops, they put a can of shaving cream there, or a
+dead bat?
+
+Answer: Yes.
+ -- Dave Barry, "Tips for Writer's"
+%
+Dear Mister Language Person: What is the purpose of the apostrophe?
+
+Answer: The apostrophe is used mainly in hand-lettered small business signs
+to alert the reader than an "S" is coming up at the end of a word, as in:
+WE DO NOT EXCEPT PERSONAL CHECK'S, or: NOT RESPONSIBLE FOR ANY ITEM'S.
+Another important grammar concept to bear in mind when creating hand- lettered
+small-business signs is that you should put quotation marks around random
+words for decoration, as in "TRY" OUR HOT DOG'S, or even TRY "OUR" HOT DOG'S.
+ -- Dave Barry, "Tips for Writer's"
+%
+Dear Ms. Postnews:
+ I couldn't get mail through to somebody on another site. What
+ should I do?
+ -- Eager Beaver
+
+Dear Eager:
+ No problem, just post your message to a group that a lot of people
+read. Say, "This is for John Smith. I couldn't get mail through so I'm
+posting it. All others please ignore."
+ This way tens of thousands of people will spend a few seconds scanning
+over and ignoring your article, using up over 16 man-hours their collective
+time, but you will be saved the terrible trouble of checking through usenet
+maps or looking for alternate routes. Just think, if you couldn't distribute
+your message to 9000 other computers, you might actually have to (gasp) call
+directory assistance for 60 cents, or even phone the person. This can cost
+as much as a few DOLLARS (!) for a 5 minute call!
+ And certainly it's better to spend 10 to 20 dollars of other people's
+money distributing the message than for you to have to waste $9 on an overnight
+letter, or even 25 cents on a stamp!
+ Don't forget. The world will end if your message doesn't get through,
+so post it as many places as you can.
+ -- Emily Postnews Answers Your Questions on Netiquette
+%
+Death before dishonor.
+But neither before breakfast.
+%
+Death comes on every passing breeze,
+He lurks in every flower;
+Each season has its own disease,
+Its peril -- every hour.
+ -- Reginald Heber
+%
+Death has been proven to be 99% fatal in laboratory rats.
+%
+Death is a spirit leaving a body, sort
+of like a shell leaving the nut behind.
+ -- Erma Bombeck
+%
+Death is God's way of telling you not to be such a wise guy.
+%
+Death is life's way of telling you you've been fired.
+ -- R. Geis
+%
+Death is Nature's way of recycling human beings.
+%
+Death is nature's way of saying `Howdy'.
+%
+Death is nature's way of telling you to slow down.
+%
+Death is only a state of mind.
+
+Only it doesn't leave you much time to think about anything else.
+%
+Death rays don't kill people, people kill people!
+%
+Death to all fanatics!
+%
+DEATH WISH:
+ The only wish that always comes true, whether or not one wishes it to.
+%
+Debug is human, de-fix divine.
+%
+Debugging is anticipated with distaste, performed with reluctance,
+and bragged about forever. -- Button at the Boston Computer Museum
+%
+DEC diagnostics would run on a dead whale.
+ -- Mel Ferentz
+%
+Decemba, n: The 12th month of the year.
+erra, n: A mistake.
+faa, n: To, from, or at considerable distance.
+Linder, n: A female name.
+memba, n: To recall to the mind; think of again.
+New Hampsha, n: A state in the northeast United States.
+New Yaak, n: Another state in the northeast United States.
+Novemba, n: The 11th month of the year.
+Octoba, n: The 10th month of the year.
+ova, n: Location above or across a specified position. What the
+ season is when the Knicks quit playing.
+ -- Massachewsetts Unabridged Dictionary
+%
+Decision maker, n.:
+ The person in your office who was unable to form a task force
+ before the music stopped.
+%
+Decisions of the judges will be final unless shouted down by a really over-
+whelming majority of the crowd present. Abusive and obscene language may
+not be used by contestants when addressing members of the judging panel,
+or, conversely, by members of the judging panel when addressing contestants
+(unless struck by a boomerang).
+ -- Mudgeeraba Creek Emu-Riding and Boomerang-Throwing Assoc.
+%
+Declared guilty... of displaying feelings of an almost human nature.
+ -- Pink Floyd, "The Wall"
+%
+Decorate your home. It gives the illusion
+that your life is more interesting than it really is.
+ -- C. Schultz
+%
+"Deep" is a word like "theory" or "semantic" -- it implies all sorts of
+marvelous things. It's one thing to be able to say "I've got a theory",
+quite another to say "I've got a semantic theory", but, ah, those who can
+claim "I've got a deep semantic theory", they are truly blessed.
+ -- Randy Davis
+%
+DEFAULT:
+ The hardware's, of course.
+%
+Default, n.:
+ [Possibly from Black English "De fault wid dis system is you,
+mon."] The vain attempt to avoid errors by inactivity. "Nothing will
+come of nothing: speak again." -- King Lear.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+Defeat is worse than death because you have to live with defeat.
+ -- Bill Musselman
+%
+#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
+#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
+ - (((x)>>2)&0x33333333) \
+ - (((x)>>3)&0x11111111))
+
+ -- really weird C code to count the number of bits in a word
+%
+Definitions of hardware and software for dummies:
+
+ Hardware is what you kick;
+ Software is what you curse.
+%
+Deflector shields just came on, Captain.
+%
+(defun NF (a c)
+ (cond ((null c) () )
+ ((atom (car c))
+ (append (list (eval (list 'getchar (list (car c) 'a) (cadr c))))
+ (nf a (cddr c))))
+ (t (append (list (implode (nf a (car c)))) (nf a (cdr c))))))
+
+(defun AD (want-job challenging boston-area)
+ (cond
+ ((or (not (equal want-job 'yes))
+ (not (equal boston-area 'yes))
+ (lessp challenging 7)) () )
+ (t (append (nf (get 'ad 'expr)
+ '((caaddr 1 caadr 2 car 1 car 1)
+ (car 5 cadadr 9 cadadr 8 cadadr 9 caadr 4 car 2 car 1)
+ (car 2 caadr 4)))
+ (list '851-5071x2661)))))
+;;; We are an affirmative action employer.
+%
+DEJA VU:
+ French., already seen; unoriginal; trite.
+ Psychol., The illusion of having previously experienced
+ something actually being encountered for the first time.
+ Psychol., The illusion of having previously experienced
+ something actually being encountered for the first time.
+%
+Delay is preferable to error.
+ -- Thomas Jefferson
+%
+Delay not, Caesar. Read it instantly.
+ -- William Shakespeare, "Julius Caesar" 3,1
+
+Here is a letter, read it at your leisure.
+ -- William Shakespeare, "Merchant of Venice" 5,1
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to I/O system services.]
+%
+Deliberate provocation of mystical experience, particularly by LSD and
+related hallucinogens, in contrast to spontaneous visionary experiences,
+entails dangers that must not be underestimated. Practitioners must take
+into account the peculiar effects of these substances, namely their ability
+to influence our consciousness, the innermost essence of our being. The
+history of LSD to date amply demonstrates the catastrophic consequences that
+can ensue when its profound effect is misjudged and the substance is mistaken
+for a pleasure drug. Special internal and external advance preparations
+are required; with them, an LSD experiment can become a meaningful experience.
+ -- Dr. Albert Hoffman, the discoverer of LSD
+
+I believe that if people would learn to use LSD's vision-inducing capability
+more wisely, under suitable conditions, in medical practice and in conjunction
+with meditation, then in the future this problem child could become a wonder
+child.
+ -- Dr. Albert Hoffman
+%
+Deliberation, n.:
+ The act of examining one's bread to determine which side it is
+ buttered on.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Deliver yesterday, code today, think tomorrow.
+%
+Delores breezed along the surface of her life like a flat stone forever
+skipping along smooth water, rippling reality sporadically but oblivious
+to it consistently, until she finally lost momentum, sank, and due to an
+overdose of fluoride as a child which caused her to suffer from chronic
+apathy, doomed herself to lie forever on the floor of her life as useless
+as an appendix and as lonely as a five-hundred pound barbell in a
+steroid-free fitness center.
+ -- Winning sentence, 1990 Bulwer-Lytton bad fiction contest
+%
+Delusions are often functional. A mother's opinions about
+her children's beauty, intelligence, goodness, et cetera ad
+nauseam, keep her from drowning them at birth.
+%
+Demand the establishment of the government
+in its rightful home at Disneyland.
+%
+Democracy becomes a government of bullies, tempered by editors.
+ -- Ralph Waldo Emerson
+%
+Democracy can only be measured on the existence of an opposition.
+ -- Poul Henningsen (1894-1967)
+%
+Democracy is a device that insures we shall be governed no better than
+we deserve.
+ -- George Bernard Shaw
+%
+Democracy is a form of government in which it is permitted to wonder
+aloud what the country could do under first-class management.
+ -- Senator Soaper
+%
+Democracy is a form of government that substitutes election by the
+incompetent many for appointment by the corrupt few.
+ -- George Bernard Shaw
+%
+Democracy is a government where you can say what you think even if you
+don't think.
+%
+Democracy is a process by which the people are free to choose the man who
+will get the blame.
+ -- Dr. Laurence J. Peter
+%
+Democracy is also a form of worship.
+It is the worship of Jackals by Jackasses.
+ -- H. L. Mencken
+%
+Democracy is good. I say this because other systems are worse.
+ -- Jawaharlal Nehru
+%
+Democracy is the name we give the people whenever we need them.
+ -- Arman de Caillavet, 1913
+%
+Democracy is the recurrent suspicion that more than half
+of the people are right more than half of the time.
+ -- E. B. White
+%
+Democracy is the theory that the common people know what they want, and
+deserve to get it good and hard.
+ -- H. L. Mencken, "Little Book in C major", 1916
+%
+Democracy is the worst form of government except all those other
+forms that have been tried from time to time.
+ -- Winston Churchill
+%
+Democracy, n.:
+ A government of the masses. Authority derived through mass meeting
+or any other form of direct expression. Results in mobocracy. Attitude
+toward property is communistic... negating property rights. Attitude toward
+law is that the will of the majority shall regulate, whether it is based
+upon deliberation or governed by passion, prejudice, and impulse, without
+restraint or regard to consequences. Result is demagogism, license,
+agitation, discontent, anarchy.
+ -- U. S. Army Training Manual No. 2000-25 (1928-1932),
+ since withdrawn.
+%
+Democracy, n.:
+ In which you say what you like and do what you're told.
+ -- Gerald Barry
+
+The difference between a Democracy and a Dictatorship is that in a
+Democracy you vote first and take orders later; in a Dictatorship
+you don't have to waste your time voting.
+ -- Charles Bukowski
+%
+Democrats buy most of the books that have been banned somewhere.
+Republicans form censorship committees and read them as a group.
+
+Republicans consume three-fourths of the rutabaga produced in the USA.
+The remainder is thrown out.
+
+Republicans usually wear hats and almost always clean their paint brushes.
+
+Republicans study the financial pages of the newspaper.
+Democrats put them in the bottom of the bird cage.
+
+Most of the stuff alongside the road has been thrown out of car
+windows by Democrats.
+ -- Paul Dickson, "The Official Rules"
+%
+Demographic polls show that you have lost credibility across the
+board. Especially with those 14 year-old Valley girls.
+%
+Dental health is next to mental health.
+%
+Dentist, n.:
+ A Prestidigitator who, putting metal in one's mouth,
+ pulls coins out of one's pockets.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Denver, n.:
+ A smallish city located just below the "O" in Colorado.
+%
+Depart in pieces, i.e., split.
+%
+Depart not from the path which fate has assigned you.
+%
+Department chairmen never die, they just lose their faculties.
+%
+Depend on the rabbit's foot if you will,
+but remember, it didn't help the rabbit.
+ -- R. E. Shay
+%
+Deprive a mirror of its silver and even the Czar won't see his face.
+%
+Der Horizont vieler Menschen ist ein Kreis mit Radius Null -
+und das nennen sie ihren Standpunkt.
+%
+Design, v.:
+ What you regret not doing later on.
+%
+Desist from enumerating your fowl
+prior to their emergence from the shell.
+%
+Despising machines to a man,
+The Luddites joined up with the Klan,
+ And ride out by night
+ In a sheeting of white
+To lynch all the robots they can.
+ -- C. M. and G. A. Maxson
+%
+Despite all appearances, your boss
+is a thinking, feeling, human being.
+%
+Dessert is probably the most important stage of the meal, since it will
+be the last thing your guests remember before they pass out all over
+the table.
+ -- The Anarchist Cookbook
+%
+Destiny is a good thing to accept when it's going your way. When it isn't,
+don't call it destiny; call it injustice, treachery, or simple bad luck.
+ -- Joseph Heller, "God Knows"
+%
+Detroit is Cleveland without the glitter.
+%
+DeVries' Dilemma:
+ If you hit two keys on the typewriter,
+ the one you don't want hits the paper.
+%
+Dianetics is a milestone for man comparable to his discovery of
+fire and superior to his invention of the wheel and the arch.
+ -- L. Ron Hubbard
+%
+Dibble's First Law of Sociology:
+ Some do, some don't.
+%
+Did I say 2? I lied.
+%
+Did it ever occur to you that fat chance
+and slim chance mean the same thing?
+%
+Did you ever notice that everyone in favour of birth control
+has already been born?
+ -- Benny Hill
+%
+Did you ever walk into a room and forget why you walked in? I think
+that's how dogs spend their lives.
+ -- Sue Murphy
+%
+Did you ever wonder what you'd say to God if He sneezed?
+%
+Did you hear about the model who sat
+on a broken bottle and cut a nice figure?
+%
+Did you hear that Captain Crunch, Sugar Bear, Tony the Tiger, and
+Snap, Crackle and Pop were all murdered recently...
+
+Police suspect the work of a cereal killer!
+%
+Did you hear that there's a group of South American Indians that worship
+the number zero?
+
+Is nothing sacred?
+%
+Did you hear that two rabbits escaped from the zoo and so far they have
+only recaptured 116 of them?
+%
+Did you know?
+ EVERY TIME A LOAF OF BREAD IS BAKED,
+ APPROXIMATELY
+ 150,000,000 YEASTS ARE
+ KILLED
+
+ Come to the award-winning 1987 film,
+ "The Very Small and Quiet Screams"
+ -- a cinematic electromicrograph of yeasts being baked.
+
+A must for those who care about yeast, and especially for those who don't.
+
+ SPONSORED BY
+ Brown Anaerobe Rights Coalition (BARC)
+ Student Bakers for Social Responsibility
+ Coalition for the ELevation of Life (CELL)
+ Campus Crusade for Fetal Matters
+
+Defend all life: "From greatest to least, from human to yeast!"
+%
+Did you know about the -o option of the fortune program? It makes a
+selection from a set of offensive and/or obscene fortunes. Why not
+try it, and see how offended you are? The -a ("all") option will
+select a fortune at random from either the offensive or inoffensive
+set, and it is suggested that "fortune -a" is the command that you
+should have in your .profile or .cshrc. file.
+%
+Did you know that clones never use mirrors?
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Did you know that for the price of a 280-Z you can buy two Z-80's?
+ -- P. J. Plauger
+%
+Did you know that if you took all the economists in the world and lined
+them up end to end, they'd still point in the wrong direction?
+%
+Did you know that the voice tapes easily identify the Russian pilot
+that shot down the Korean jet? At one point he definitely states:
+
+ "Natasha! First we shoot jet, then we go after moose and
+ squirrel."
+
+ -- ihuxw!tommyo
+%
+Did you know the University of Iowa
+closed down after someone stole the book?
+%
+Did you know....
+
+That no-one ever reads these things?
+%
+Didja' ever have to make up your mind,
+Pick up on one and leave the other behind,
+It's not often easy, and it's not often kind,
+Didja' ever have to make up your mind?
+ -- Lovin' Spoonful
+%
+Didja hear about the dyslexic devil worshiper who sold his soul to Santa?
+%
+Die? I should say not, dear fellow. No Barrymore
+would allow such a conventional thing to happen to him.
+ -- John Barrymore's dying words
+%
+Die, v.:
+ To stop sinning suddenly.
+ -- Elbert Hubbard
+%
+Diet Mountain Dew has the same pH and density of urine.
+ -- Newsweek, 31 July, 1989
+%
+Dieters live life in the fasting lane.
+%
+Different all twisty a of in maze are you, passages little.
+%
+Digital circuits are made from analog parts.
+ -- Don Vonada
+%
+Dignity is like a flag.
+It flaps in a storm.
+ -- Roy Mengot
+%
+Dime is money.
+%
+Dimensions will always be expressed in the least usable term, convertible
+only through the use of weird and unnatural conversion factors. Velocity,
+for example, will be expressed in furlongs per fortnight.
+%
+Dinner is ready when the smoke alarm goes off.
+%
+Dinner suggestion #302 (Hacker's De-lite):
+ 1 tin imported Brisling sardines in tomato sauce
+ 1 pouch Chocolate Malt Carnation Instant Breakfast
+ 1 carton milk
+%
+Dinosaurs aren't extinct. They've just learned to hide in the trees.
+%
+Diogenes, having abandoned his search for
+truth, is now searching for a good fantasy.
+%
+Diogenes went to look for an honest lawyer. "How's it going?", someone
+asked him, after a few days.
+ "Not too bad", replied Diogenes. "I still have my lantern."
+%
+Diplomacy is about surviving until the next century.
+Politics is about surviving until Friday afternoon.
+ -- Sir Humphrey Appleby
+%
+Diplomacy is the art of letting the other party have things your way.
+ -- Daniele Vare
+%
+Diplomacy is the art of saying "nice doggie" until you can find a rock.
+ -- Wynn Catlin
+%
+Diplomacy is to do and say, the nastiest thing in the nicest way.
+ -- Balfour
+%
+Diplomacy, n.:
+ Lying in state.
+%
+Dirksen's Three Laws of Politics:
+
+ 1: Get elected.
+ 2: Get re-elected.
+ 3: Don't get mad, get even.
+ -- Sen. Everett Dirksen
+%
+Disbar, n.:
+ As distinguished from some other bar.
+%
+Disc space -- the final frontier!
+%
+Disclaimer: Any resemblance between the above views and those of my
+employer, my terminal, or the view out my window are purely
+coincidental. Any resemblance between the above and my own views is
+non-deterministic. The question of the existence of views in the
+absence of anyone to hold them is left as an exercise for the reader.
+The question of the existence of the reader is left as an exercise for
+the second god coefficient. (A discussion of non-orthogonal,
+non-integral polytheism is beyond the scope of this article.)
+%
+Disclaimer: "These opinions are my own, though for a small fee they be
+yours too."
+ -- Dave Haynie
+%
+DISCLAIMER:
+Use of this advanced computing technology does not imply
+an endorsement of Western industrial civilization.
+%
+Disclose classified information only when a NEED TO KNOW exists.
+%
+Disco is to music what Etch-A-Sketch is to art.
+%
+Disease can be cured; fate is incurable.
+ -- Chinese proverb
+%
+Dishonor will not trouble me, once I am dead.
+ -- Euripides
+%
+Disk crisis, please clean up!
+%
+Disks travel in packs.
+%
+Disraeli was pretty close: actually, there are Lies, Damn lies, Statistics,
+Benchmarks, and Delivery dates.
+%
+Distance doesn't make you any smaller,
+but it does make you part of a larger picture.
+%
+Distinctive, adj.:
+ A different color or shape than our competitors.
+%
+Distress, n.:
+ A disease incurred by exposure to the prosperity of a friend.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+District of Columbia pedestrians who leap over passing autos to escape
+injury, and then strike the car as they come down, are liable for any
+damage inflicted on the vehicle.
+%
+Distrust all those who love you extremely upon a very slight
+acquaintance and without any visible reason.
+ -- Lord Chesterfield
+%
+Ditat Deus. (God enriches.)
+%
+Divorce is a game played by lawyers.
+ -- Cary Grant
+%
+Do clones have navels?
+%
+Do I like getting drunk? Depends on who's doing the drinking.
+ -- Amy Gorin
+%
+Do Miami a favor. When you leave, take someone with you.
+%
+Do molecular biologists wear designer genes?
+%
+Do more than anyone expects, and pretty soon everyone will expect more.
+%
+Do not clog intellect's sluices with bits of knowledge of questionable uses.
+%
+Do not count your chickens before they are hatched.
+ -- Aesop
+%
+Do not despair of life. You have no doubt force enough to overcome
+your obstacles. Think of the fox prowling through wood and field in
+a winter night for something to satisfy his hunger. Notwithstanding
+cold and hounds and traps, his race survives. I do not believe any
+of them ever committed suicide.
+ -- Henry David Thoreau
+%
+Do not do unto others as you would they should do unto you.
+Their tastes may not be the same.
+ -- George Bernard Shaw
+%
+Do not drink coffee in early A.M. It will keep you awake until noon.
+%
+Do not handicap your children by making their lives easy.
+ -- Robert A. Heinlein
+%
+Do not meddle in the affairs of troff, for it is subtle and quick to anger.
+%
+Do not meddle in the affairs of wizards, for you are crunchy and good
+with ketchup.
+%
+Do not meddle in the affairs of wizards,
+for they become soggy and hard to light.
+
+Do not throw cigarette butts in the urinal,
+for they are subtle and quick to anger.
+%
+Do not overtax your powers.
+%
+Do not read this fortune under penalty of law.
+Violators will be prosecuted.
+(Penal Code sec. 2.3.2 (II.a.))
+%
+Do not seek death; death will find you.
+But seek the road which makes death a fulfillment.
+ -- Dag Hammarskjold
+%
+Do not sleep in a eucalyptus tree tonight.
+%
+Do not stoop to tie your laces in your neighbor's melon patch.
+%
+Do not think by infection, catching an opinion like a cold.
+%
+Do not try to solve all life's problems at once --
+learn to dread each day as it comes.
+ -- Donald Kaul
+%
+Do not underestimate the power of the Farce.
+%
+Do not use that foreign word "ideals". We have that excellent native
+word "lies".
+ -- Henrik Ibsen, "The Wild Duck"
+%
+Do not use the blue keys on this terminal.
+%
+Do not worry about which side your
+bread is buttered on: you eat BOTH sides.
+%
+Do nothing unless you must, and when you must act -- hesitate.
+%
+Do, or do not; there is no try.
+%
+Do people know you have freckles everywhere?
+%
+Do something unusual today. Pay a bill.
+%
+Do students of Zen Buddhism do Om-work?
+%
+Do unto others before they undo you.
+%
+Do what comes naturally now. Seethe and fume and throw a tantrum.
+%
+Do what thou wilt shall be the whole of the Law.
+ -- Aleister Crowley
+%
+Do what you can to prolong your life,
+in the hope that someday you'll learn what it's for.
+%
+Do you believe in intuition?
+No, but I have a strange feeling that someday I will.
+%
+Do you feel personally responsible for the world food shortage?
+Every time you go to the beach, does the tide come in?
+Have you ever eaten an entire moose?
+Can you see your neck?
+Do joggers take laps around you for exercise?
+If so, welcome to National Fat Week.
+This week we'll eat without guilt, and kick off our membership campaign,
+ ...by force-feeding a box of cornstarch to a skinny person.
+ -- Garfield
+%
+Do you guys know what you're doing, or are you just hacking?
+%
+Do you have lysdexia?
+%
+Do YOU have redeeming social value?
+%
+Do you know, I think that Dr. Swift was silly to laugh about Laputa.
+I believe it is a mistake to make a mock of people, just because they
+think. There are ninety thousand people in this world who do not
+think, for every one who does, and these people hate the thinkers
+like poison. Even if some thinkers are fanciful, it is wrong to make
+fun of them for it. Better to think about cucumbers even, than not
+to think at all.
+ -- T. H. White
+%
+Do you know Montana?
+%
+Do you know the difference between education and experience? Education
+is when you read the fine print; experience is what you get when you don't.
+ -- Pete Seeger
+%
+Do you mean that you not only want a wrong
+answer, but a certain wrong answer?
+ -- Tobaben
+%
+Do you realize the responsibility I carry? I'm the only person standing
+between Nixon and the White House.
+ -- John F. Kennedy, in 1960
+%
+Do you suffer painful elimination?
+ -- Donald E. Knuth, "Structured Programming with Gotos"
+
+Do you suffer painful recrimination?
+ -- Nancy Boxer, "Structured Programming with Come-froms"
+
+Do you suffer painful illumination?
+ -- Isaac Newton, "Optics"
+
+Do you suffer painful hallucination?
+ -- Don Juan, cited by Carlos Casteneda
+%
+Do you think that illiterate people get the full effect of alphabet soup?
+%
+Do you think that when they asked George Washington for ID that he
+just whipped out a quarter?
+ -- Steven Wright
+%
+Do you think your mother and I should have lived
+comfortably so long together if ever we had been married?
+%
+Do you want to know what's ahead for you, in your happiness at home,
+your business success? Here's a telling test: Look in the mirror. Is
+your skin smooth and lovely, your hair gleaming, your make-up glamorous?
+Are you slender enough for your height? Do you stand erect, confident?
+Yes? Then you are on your way to success as a woman.
+ -- Ladies' Home Journal, 1947 advertisement
+%
+Do your otters do the shimmy?
+Do they like to shake their tails?
+Do your wombats sleep in tophats?
+Is your garden full of snails?
+%
+Do your part to help preserve life on
+Earth -- by trying to preserve your own.
+%
+Doctors and lawyers must go to school for years and years, often with
+little sleep and with great sacrifice to their first wives.
+ -- Roy G. Blount, Jr.
+%
+Documentation:
+ Instructions translated from Swedish by Japanese for English
+ speaking persons.
+%
+Documentation is like sex: when it is good, it is very, very good; and
+when it is bad, it is better than nothing.
+ -- Dick Brandon
+%
+Documentation is the castor oil of programming. Managers know it must
+be good because the programmers hate it so much.
+%
+Does a good farmer neglect a crop he has planted?
+Does a good teacher overlook even the most humble student?
+Does a good father allow a single child to starve?
+Does a good programmer refuse to maintain his code?
+ -- Geoffrey James, "The Tao of Programming"
+%
+Does a one-legged duck swim in a circle?
+%
+Does the name Pavlov ring a bell?
+%
+Dogs just don't seem to be able to tell the difference between important people
+and the rest of us.
+%
+Doin' it in the dark, down in Rock Creek Park.
+%
+Doing gets it done.
+%
+Don
+Ameche: I didn't know you had a cousin Penelope, Bill!
+ Was she pretty?
+W. C.: Well, her face was so wrinkled it looked like seven miles of
+ bad road. She had so many gold teeth, Don, she use to have
+ to sleep with her head in a safe. She died in Bolivia.
+Don: Oh Bill, it must be hard to lose a relative.
+W. C.: It's almost impossible.
+ -- W. C. Fields, "The Further Adventures of Larson E.
+ Whipsnade and other Tarradiddles"
+%
+Don't abandon hope: your Tom Mix decoder ring arrives tomorrow.
+%
+Don't abandon hope.
+Your Captain Midnight decoder ring arrives tomorrow.
+%
+Don't assume that every sad-eyed woman has loved and lost -- she may
+have got him.
+%
+Don't be concerned, it will not harm you,
+It's only me pursuing something I'm not sure of,
+Across my dreams, with neptive wonder,
+I chase the bright elusive butterfly of love.
+%
+Don't be humble, you're not that great.
+ -- Golda Meir
+%
+Don't be irreplaceable, if you can't be replaced, you can't be promoted.
+%
+Don't be overly suspicious where it's not warranted.
+%
+Don't believe everything you hear or anything you say.
+%
+Don't buy a landslide. I don't want to have to pay for one more vote
+than I have to.
+ -- Joseph P. Kennedy, on JFK's election strategy
+%
+Don't change the reason, just change the excuses!
+ -- Joe Cointment
+%
+Don't compare floating point numbers solely for equality.
+%
+Don't confuse things that need action
+with those that take care of themselves.
+%
+Don't cook tonight -- starve a rat today!
+%
+Don't crush that dwarf, hand me the pliers!
+ -- The Firesign Theatre
+%
+Don't despair; your ideal lover is waiting for you around the corner.
+%
+Don't despise your poor relations, they may become suddenly rich one day.
+ -- Josh Billings
+%
+Don't do the crime, if you can't do the time.
+ -- Lt. Col. Ollie North
+%
+Don't drink when you drive -- you might hit a bump and spill it.
+%
+Don't drop acid -- take it pass/fail.
+ -- Seen in a Ladies Room at Harvard
+%
+Don't eat yellow snow.
+%
+Don't ever slam a door; you might want to go back.
+%
+Don't everyone thank me at once!
+ -- Han Solo
+%
+Don't expect people to keep in step--
+it's hard enough just staying in line.
+%
+Don't feed the bats tonight.
+%
+Don't force it, get a larger hammer.
+ -- Anthony
+%
+Don't get even, get odd.
+%
+Don't get mad, get even.
+ -- Joseph P. Kennedy
+
+Don't get even, get jewelry.
+ -- Anonymous
+%
+Don't get mad, get interest.
+%
+Don't get stuck in a closet -- wear yourself out.
+%
+Don't get suckered in by the comments -- they
+can be terribly misleading. Debug only code.
+ -- Dave Storer
+%
+Don't get to bragging.
+%
+Don't go around saying the world owes you a living.
+The world owes you nothing. It was here first.
+ -- Mark Twain
+%
+Don't go surfing in South Dakota for a while.
+%
+Don't go to bed with no price on your head.
+ -- Baretta
+%
+Don't guess - check your security regulations.
+%
+Don't hate yourself in the morning -- sleep till noon.
+%
+Don't have good ideas if you aren't willing to be responsible for them.
+%
+Don't hit a man when he's down -- kick him; it's easier.
+%
+Don't hit the keys so hard, it hurts.
+%
+Don't I know you?
+%
+Don't interfere with the stranger's style.
+%
+Don't just eat a hamburger; eat the HELL out of it.
+ -- J. R. "Bob" Dobbs
+%
+Don't kid yourself. Little is relevant, and nothing lasts forever.
+%
+Don't kiss an elephant on the lips today.
+%
+Don't knock President Fillmore. He kept us out of Vietnam.
+%
+Don't know what time I'll be back, Mom.
+Probably soon after she throws me out.
+%
+Don't let go of what you've got hold of,
+until you have hold of something else.
+ -- First Rule of Wing Walking
+%
+Don't let nobody tell you what you cannot do;
+don't let nobody tell you what's impossible for you;
+don't let nobody tell you what you got to do,
+or you'll never know ... what's on the other side of the rainbow...
+remember, if you don't follow your dreams,
+you'll never know what's on the other side of the rainbow...
+ -- melba moore, "the other side of the rainbow"
+%
+Don't let people drive you crazy when you know it's in walking distance.
+%
+Don't let your status become too quo!
+%
+Don't look back, the lemmings might be gaining on you.
+%
+Don't look now, but the man in the moon is laughing at you.
+%
+Don't look now, but there is a multi-legged creature on your shoulder.
+%
+Don't lose
+Your head
+To gain a minute
+You need your head
+Your brains are in it.
+ -- Burma Shave
+%
+Don't make a big deal out of everything; just deal with everything.
+%
+Don't marry for money; you can borrow it cheaper.
+ -- Scottish proverb
+%
+Don't mind him; politicians always sound like that.
+%
+Don't patch bad code -- rewrite it.
+ -- Kernighan and Plauger, "The Elements of Programming Style"
+%
+Don't plan any hasty moves.
+You'll be evicted soon anyway.
+%
+Don't put off for tomorrow what you can do today because
+if you do it today, you can do it again tomorrow.
+%
+Don't put too fine a point to your wit for fear it should get blunted.
+ -- Miguel de Cervantes
+%
+Don't quit now, we might just as well
+lock the door and throw away the key.
+%
+Don't read any sky-writing for the next two weeks.
+%
+Don't read everything you believe.
+%
+Don't relax! It's only your tension that's holding you together.
+%
+Don't remember what you can infer.
+ -- Harry Tennant
+%
+Don't say "yes" until I finish talking.
+ -- Darryl F. Zanuck
+%
+Don't shoot until you're sure you both aren't on the same side.
+%
+Don't shout for help at night. You might wake your neighbors.
+ -- Stanislaw J. Lec, "Unkempt Thoughts"
+%
+Don't smoke the next cigarette. Repeat.
+%
+Don't speak about Time, until you have spoken to him.
+%
+Don't steal... the IRS hates competition!
+%
+Don't steal; thou'lt never thus compete successfully in business.
+Cheat.
+ -- Ambrose Bierce
+%
+Don't stop to stomp ants when the elephants are stampeding.
+%
+Don't suspect your friends -- turn them in!
+ -- "Brazil"
+%
+Don't sweat it -- it's only ones and zeros.
+ -- P. Skelly
+%
+Don't take a nickel, just hand them your business card.
+ -- Richard Daley, advising on the safe enjoyment of graft
+%
+Don't take life seriously, you'll never get out alive.
+%
+Don't take life so serious, son, it ain't nohow permanent.
+ -- Walt Kelly
+%
+Don't talk to me about naval tradition. It's nothing but rum,
+sodomy and the lash.
+ -- Winston Churchill
+%
+Don't tell any big lies today. Small ones can be just as effective.
+%
+Don't tell me how hard you work. Tell me how much you get done.
+ -- James J. Ling
+%
+Don't tell me I'm burning the candle at both ends -- tell me where to
+get more wax!!
+%
+Don't tell me that worry doesn't do any good.
+I know better. The things I worry about don't happen.
+ -- Watchman Examiner
+%
+Don't tell me what you dream'd last night for I've been reading Freud.
+%
+Don't try to have the last word -- you might get it.
+ -- Lazarus Long
+%
+Don't try to outweird me, three-eyes. I get stranger things than you free
+with my breakfast cereal.
+ -- Zaphod Beeblebrox
+%
+Don't vote - it only encourages them!
+%
+Don't wake me up too soon...
+Gonna take a ride across the moon...
+You and me.
+%
+Don't worry. Life's too long.
+ -- Vincent Sardi, Jr.
+%
+Don't worry -- the brontosaurus is slow, stupid, and placid.
+%
+Don't worry about avoiding temptation -- as you grow older, it starts
+avoiding you.
+ -- The Old Farmer's Almanac
+%
+Don't worry about people stealing your ideas. If your ideas
+are any good, you'll have to ram them down people's throats.
+ -- Howard Aiken
+%
+Don't worry about the world coming to an end today.
+It's already tomorrow in Australia.
+ -- Charles Schultz
+%
+Don't Worry, Be Happy.
+ -- Meher Baba
+%
+Don't worry if you're a kleptomaniac,
+you can always take something for it.
+%
+Don't worry over what other people are thinking about you.
+They're too busy worrying over what you are thinking about them.
+%
+Don't worry so loud, your roommate can't think.
+%
+Don't you feel more like you do now than you did when you came in?
+%
+Don't you wish that all the people who sincerely
+want to help you could agree with each other?
+%
+Don't you wish you had more energy... or less ambition?
+%
+Dorothy: How can you talk if you haven't got a brain?
+Scarecrow: I don't know. But some people without brains do an
+ awful lot of talking, don't they?
+ -- Judy Garland and Ray Bolger, "The Wizard of Oz"
+%
+Double!
+%
+Double Bucky, you're the one,
+You make my keyboard so much fun,
+Double Bucky, an additional bit or two, (Vo-vo-de-o)
+Control and meta, side by side,
+Augmented ASCII, 9 bits wide!
+Double Bucky, a half a thousand glyphs, plus a few!
+
+Oh, I sure wish that I,
+Had a couple of bits more!
+Perhaps a set of pedals to make the number of bits four.
+
+Double Double Bucky! Double Bucky left and right
+OR'd together, outta sight!
+Double Bucky, I'd like a whole word of,
+Double Bucky, I'm happy I heard of,
+Double Bucky, I'd like a whole word of you!
+ -- to Niklaus Wirth, who suggested that an extra bit
+ be added to terminal codes on 36-bit machines for use
+ by screen editors. [to the tune of "Rubber Ducky"]
+%
+Double-blind Experiment, n.:
+ An experiment in which the chief researcher believes he is
+fooling both the subject and the lab assistant. Often accompanied
+by a strong belief in the tooth fairy.
+%
+Doubt is a not a pleasant mental state, but certainty is a ridiculous one.
+ -- Voltaire
+%
+Doubt isn't the opposite of faith; it is an element of faith.
+ -- Paul Tillich, German theologian
+%
+Down to the Banana Republics,
+Down to the tropical sun.
+Go the expatriated Americans,
+Hoping to find some fun.
+Some of them go for the sailing,
+Caught by the lure of the sea.
+Trying to find what is ailing,
+Living in the land of the free.
+Some of them are running from lovers,
+Leaving no forward address.
+Some of them are running tons of ganja,
+Some are running from the IRS.
+Late at night you will find them,
+In the cheap hotels and bars.
+Hustling the senoritas,
+While they dance beneath the stars.
+ -- Jimmy Buffet, "Banana Republics"
+%
+Down with the categorical imperative!
+%
+Dow's Law:
+ In a hierarchical organization,
+ the higher the level, the greater the confusion.
+%
+Dozens of bears are found dead in Alaska and Canada every summer, killed
+by blood lost to the voracious mosquito. The estimated life-expectancy
+of a naked man on the tundra in summer is about 15 minutes. In that
+time, approximately 250,000 mosquitoes would have drawn enough blood to
+kill him.
+ -- Gus McLeavy, "Day-by-Day Trivia Almanac"
+%
+Dr. Fritzkee's Lucky Astrology Diet
+
+The problem with the diets of today is that most women who do achieve
+that magic weight, seventy-six pounds, are still fat. Dr. Fritzkee's
+Lucky Astrology Diet is a sure-fire method of reducing with the added
+luxury that you never feel hungry.
+
+Here's how the diet works:
+
+ FOODS ALLOWED
+First Month: One egg
+Second Month: A raisin
+Third Month: Pumpkin pie with whipped cream and chocolate sauce.
+
+If after the third month you haven't gotten to your dream weight, try
+lopping off parts of your body until those scales tip just right for you.
+%
+Dr. Jekyll had something to Hyde.
+%
+Dr. Livingston?
+Dr. Livingston I. Presume?
+%
+Drakenberg's Discovery:
+ If you can't seem to find your glasses,
+ it's probably because you don't have them on.
+%
+Drawing on my fine command of language, I said nothing.
+%
+Dreams are free, but there's a small charge for alterations.
+%
+Dreams are free, but you get soaked on the connect time.
+%
+Drew's Law of Highway Biology:
+ The first bug to hit a clean windshield
+ lands directly in front of your eyes.
+%
+Drilling for oil is boring.
+%
+Drink and dance and laugh and lie
+Love, the reeling midnight through
+For tomorrow we shall die!
+(But, alas, we never do.)
+ -- Dorothy Parker, "The Flaw in Paganism"
+%
+Drink Canada Dry! You might not succeed, but it *_i_s* fun trying.
+%
+Drinking coffee for instant relaxation? That's like drinking alcohol for
+instant motor skills.
+ -- Marc Price
+%
+Drinking is not a spectator sport.
+ -- Jim Brosnan
+%
+Drinking makes such fools of people, and people are such fools to begin
+with, that it's compounding a felony.
+ -- Robert Benchley
+%
+Drinking when we are not thirsty and making love at all seasons, madam:
+that is all there is to distinguish us from the other animals.
+ -- Pierre de Beaumarchais, "Le Marriage de Figaro"
+%
+Drive defensively, buy a tank.
+%
+Driving in Texas is simple. For the first 100 miles you swerve to
+avoid jackrabbits. For the second 100 miles you hit whatever
+jackrabbits get in the way. After that you chase off into the
+brush after them.
+%
+Driving through a Swiss city one day, Alfred Hitchcock suddenly pointed out
+of the car window and said, "That is the most frightening sight I have ever
+seen." His companion was surprised to see nothing more alarming than a
+priest in conversation with a little boy, his hand on the child's shoulder.
+"Run, little boy," cried Hitchcock, leaning out of the car. "Run for your
+life!"
+%
+Drop that pickle!
+%
+DROP THE DAMN BEAR!!!
+ -- The Adventurer
+%
+Drop the vase and it will become a Ming of the past.
+ -- The Adventurer
+%
+Drug, n.:
+ A substance that, when injected into a rat, produces a scientific
+ paper.
+%
+Drugs may be the road to nowhere, but at least they're the scenic route!
+%
+Drunks are rarely amusing unless they know some good songs and lose a
+lot a poker.
+ -- Karyl Roosevelt
+%
+Ducharme's Axiom:
+ If you view your problem closely enough you will recognize
+ yourself as part of the problem.
+%
+Ducharme's Precept:
+ Opportunity always knocks at the least opportune moment.
+%
+Duckies are fun!
+%
+Ducks? What ducks??
+%
+Duct tape is like the force. It has a light side,
+and a dark side, and it holds the universe together.
+ -- Carl Zwanzig
+%
+Due to a shortage of devoted followers, the
+production of great leaders has been discontinued.
+%
+Due to circumstances beyond your control, you are master of your
+fate and captain of your soul.
+%
+Due to lack of disk space, this fortune database has been
+discontinued.
+%
+Dungeons and Dragons is just a lot of Saxon Violence.
+%
+During almost fifteen centuries the legal establishment of Christianity has
+been upon trial. What has been its fruits? More or less, in all places,
+pride and indolence in the clergy; ignorance and servility in the laity,;
+in both, superstition, bigotry, and persecution.
+ -- James Madison
+%
+During the next two hours, the system will be going up and down several
+times, often with lin~po_~{po ~poz~ppo\~{ o n~po_~{o[po ~y oodsou>#w4k**n~po_~{ol;lkld;f;g;dd;po\~{o
+%
+During the Reagan-Mondale debates:
+
+Q: "Do you feel that a person's age affects his ability to
+ perform as president?"
+Reagan: "I refuse to make an issue out of my opponent's youth and
+ inexperience."
+%
+During the voyage of life, remember to keep an eye out for a
+fair wind; batten down during a storm; hail all passing ships;
+and fly your colors proudly.
+%
+Dustin Farnum: Why, yesterday, I had the audience glued to their seats!
+Oliver Herford: Wonderful! Wonderful! Clever of you to think of it!
+ -- Brian Herbert, "Classic Comebacks"
+%
+Duty, n.:
+ What one expects from others.
+ -- Oscar Wilde
+%
+Dying is a very dull, dreary affair. My advice to you is to have
+nothing whatever to do with it.
+ -- W. Somerset Maugham, his last words
+%
+Dying is easy. Comedy is difficult.
+ -- Actor Edmond Gween, on his deathbed
+%
+Dying is one of the few things that can be done as easily lying down.
+ -- Woody Allen
+%
+E = MC ** 2 +- 3db
+%
+E Pluribus UNIX.
+%
+Each man is his own prisoner, in solitary confinement for life.
+%
+Each new user of a new system uncovers a new class of bugs.
+ -- Kernighan
+%
+Each of these cults correspond to one of the two antagonists in the age of
+Reformation. In the realm of the Apple Macintosh, as in Catholic Europe,
+worshipers peer devoutly into screens filled with "icons." All is sound and
+imagery and Appledom. Even words look like decorative filigrees in exotic
+typefaces. The greatest icon of all, the inviolable Apple itself, stands in
+the dominate position at the upper-left corner of the screen. A central
+corporate headquarters decrees the form of all rites and practices.
+Infallible doctrine issues from one executive officer whose selection occurs
+in a sealed board room. Should anyone in his curia question his powers, the
+offender is excommunicated into outer darkness. The expelled heretic founds
+a new company, mutters obscurely of the coming age and the next computer,
+then disappears into silence, taking his stockholders with him. The mother
+company forbids financial competition as sternly as it stifles ideological
+competition; if you want to use computer programs that conform to Apple's
+orthodoxy, you must buy a computer made and sold by Apple itself.
+ -- Edward Mendelson, "The New Republic", February 22, 1988
+%
+Each of us bears his own Hell.
+ -- Publius Vergilius Maro (Virgil)
+%
+Each person has the right to take part in the management of public affairs
+in his country, provided he has prior experience, a will to succeed, a
+university degree, influential parents, good looks, a curriculum vitae, two
+3 X 4 snapshots, and a good tax record.
+%
+Each person has the right to take the subway.
+%
+Eagleson's Law:
+ Any code of your own that you haven't looked at for six or more
+months, might as well have been written by someone else. (Eagleson is
+an optimist, the real number is more like three weeks.)
+%
+EARL GREY PROFILES
+
+NAME: Jean-Luc Perriwinkle Picard
+OCCUPATION: Starship Big Cheese
+AGE: 94
+BIRTHPLACE: Paris, Terra Sector
+EYES: Grey
+SKIN: Tanned
+HAIR: Not much
+LAST MAGAZINE READ:
+ Lobes 'n' Probes, the Ferengi-Betazoid Sex Quarterly
+TEA: Earl Grey. Hot.
+
+EARL GREY NEVER VARIES.
+%
+Earl Wiener, 55, a University of Miami professor of management
+science, telling the Airline Pilots Association (in jest) about
+21st century aircraft:
+
+ "The crew will consist of one pilot and a dog. The pilot will
+ nurture and feed the dog. The dog will be there to bite the
+ pilot if he touches anything.
+ -- Fortune, Sept. 26, 1988
+%
+Early to bed and early to rise and you'll
+be groggy when everyone else is wide awake.
+%
+Early to rise and early to bed makes
+a man healthy and wealthy and dead.
+ -- James Thurber
+%
+Earn cash in your spare time -- blackmail your friends.
+%
+Earth Destroyed by Solar Flare -- film clips at eleven.
+%
+/earth: file system full.
+%
+/Earth is 98% full ... please delete anyone you can.
+%
+Earth is a beta site.
+%
+Earth is a great, big funhouse without the fun.
+ -- Jeff Berner
+%
+Easiest Color to Solve on a Rubik's Cube:
+ Black. Simply remove all the little colored stickers on the
+cube, and each of side of the cube will now be the original color of
+the plastic underneath -- black. According to the instructions, this
+means the puzzle is solved.
+ -- Steve Rubenstein
+%
+Easy come and easy go,
+ some call me easy money,
+Sometimes life is full of laughs,
+ and sometimes it ain't funny
+You may think that I'm a fool
+ and sometimes that is true,
+But I'm goin' to heaven in a flash of fire,
+ with or without you.
+ -- Hoyt Axton
+%
+Eat as much as you like -- just don't swallow it.
+ -- Harry Secombe's diet
+%
+Eat, drink, and be merry! Tomorrow you may be in Utah.
+%
+Eat, drink, and be merry, for tomorrow they may make it illegal.
+%
+Eat, drink, and be merry, for tomorrow we diet.
+%
+Eat, drink, and be merry, for tomorrow you may work.
+%
+Eat one live toad the first thing in the morning and nothing worse
+will happen to you the rest of the day.
+
+[Well, actually, to either of you... Ed.]
+%
+Eat right, stay fit, and die anyway.
+%
+Eat the rich, the poor are tough and stringy.
+%
+Eating chocolate is like being in love without the aggravation.
+%
+Economics is extremely useful as a form of employment for economists.
+ -- John Kenneth Galbraith
+%
+Economics, n.:
+ Economics is the study of the value and meaning of J. K. Galbraith.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Economies of scale:
+ The notion that bigger is better. In particular, that if you want
+ a certain amount of computer power, it is much better to buy one
+ biggie than a bunch of smallies. Accepted as an article of faith
+ by people who love big machines and all that complexity. Rejected
+ as an article of faith by those who love small machines and all
+ those limitations.
+%
+Economist, n.:
+ Someone who's good with figures, but doesn't have enough
+ personality to become an accountant.
+%
+Economists can certainly disappoint you. One said that the economy would
+turn up by the last quarter. Well, I'm down to mine and it hasn't.
+ -- Robert Orben
+%
+Economists state their GNP growth projections to the nearest tenth of a
+percentage point to prove they have a sense of humor.
+ -- Edgar R. Fiedler
+%
+Ed Sullivan will be around as long as someone else has talent.
+ -- Fred Allen
+%
+Editing is a rewording activity.
+%
+Education and religion are two things not regulated by supply and
+demand. The less of either the people have, the less they want.
+ -- Charlotte Observer, 1897
+%
+Education is an admirable thing, but it is well to remember from time to
+time that nothing that is worth knowing can be taught.
+ -- Oscar Wilde, "The Critic as Artist"
+%
+Education is learning what you didn't even know you didn't know.
+ -- Daniel J. Boorstin
+%
+Education is the process of casting false pearls before real swine.
+ -- Irwin Edman
+%
+Education is what survives when what has been learnt has been forgotten.
+ -- B. F. Skinner
+%
+Educational television should be absolutely forbidden. It can only lead
+to unreasonable disappointment when your child discovers that the letters
+of the alphabet do not leap up out of books and dance around with
+royal-blue chickens.
+ -- Fran Lebowitz, "Social Studies"
+%
+Eeny, Meeny, Jelly Beanie, the spirits are about to speak!
+ -- Bullwinkle J. Moose
+%
+Eggheads unite! You have nothing to lose but your yolks.
+ -- Adlai E. Stevenson
+%
+Eggnog is a traditional holiday drink invented by the English. Many
+people wonder where the word "eggnog" comes from. The first syllable
+comes from the English word "egg", meaning "egg". I don't know where
+the "nog" comes from.
+
+To make eggnog, you'll need rum, whiskey, wine, gin and, if they are in
+season, eggs...
+%
+Ego sum ens omnipotens
+%
+Egotism is the anesthetic given by a kindly nature
+to relieve the pain of being a damned fool.
+ -- Bellamy Brooks
+%
+Egotism is the anesthetic which numbs the pain of stupidity.
+%
+Egotism, n.:
+ Doing the New York Times crossword puzzle with a pen.
+%
+Egotist, n.:
+ A person of low taste, more interested in himself than me.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+egrep -n '^[a-z].*\(' $ | sort -t':' +2.0
+%
+Ehrman's Commentary:
+ (1) Things will get worse before they get better.
+ (2) Who said things would get better?
+%
+...eighty years later he could still recall with the young pang of his
+original joy his falling in love with Ada.
+ -- Nabokov
+%
+Einstein argued that there must be simplified explanations of nature, because
+God is not capricious or arbitrary. No such faith comforts the software
+engineer.
+ -- Frederick Brooks, Jr.
+%
+Either I'm dead or my watch has stopped.
+ -- Groucho Marx' last words
+%
+Elbonics, v.:
+ The actions of two people maneuvering for one
+ armrest in a movie theatre.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Eleanor Rigby
+Sits at the keyboard and waits for a line on the screen
+Lives in a dream
+Waits for a signal, finding some code that will
+ make the machine do some more.
+What is it for?
+
+All the lonely users, where do they all come from?
+All the lonely users, why does it take so long?
+
+Hacker MacKensie
+Writing the code for a program that no one will run
+It's nearly done
+Look at him working, fixing the bugs in the night when there's
+ nobody there.
+What does he care?
+
+All the lonely users, where do they all come from?
+All the lonely users, why does it take so long?
+Ah, look at all the lonely users.
+Ah, look at all the lonely users.
+%
+ELECTRIC JELL-O
+
+2 boxes JELL-O brand gelatin 2 packages Knox brand unflavored gelatin
+2 cups fruit (any variety) 2+ cups water
+1/2 bottle Everclear brand grain alcohol
+
+Mix JELL-O and Knox gelatin into 2 cups of boiling water. Stir 'til
+ fully dissolved.
+Pour hot mixture into a flat pan. (JELL-O molds won't work.)
+Stir in grain alcohol instead of usual cold water. Remove any congealing
+ glops of slime. (Alcohol has an unusual effect on excess JELL-O.)
+Pour in fruit to desired taste, and to absorb any excess alcohol.
+Mix in some cold water to dilute the alcohol and make it easier to eat for
+ the faint of heart.
+Refrigerate overnight to allow mixture to fully harden. (About 8-12 hours.)
+Cut into squares and enjoy!
+
+WARNING:
+ Keep ingredients away from open flame. Not recommended for
+ children under eight years of age.
+%
+Electrical Engineers do it with less resistance.
+%
+Electrocution, n.:
+ Burning at the stake with all the modern improvements.
+%
+Elegance and truth are inversely related.
+ -- Becker's Razor
+%
+Elephant, n.:
+ A mouse built to government specifications.
+%
+Elevators smell different to midgets.
+%
+Eleventh Law of Acoustics:
+ In a minimum-phase system there is an inextricable link between
+ frequency response, phase response and transient response, as they
+ are all merely transforms of one another. This combined with
+ minimalization of open-loop errors in output amplifiers and correct
+ compensation for non-linear passive crossover network loading can
+ lead to a significant decrease in system resolution lost. However,
+ of course, this all means jack when you listen to Pink Floyd.
+%
+Eli and Bessie went to sleep.
+In the middle of the night, Bessie nudged Eli.
+ "Please be so kindly and close the window. It's cold outside!"
+Half asleep, Eli murmured,
+ "Nu ... so if I'll close the window, will it be warm outside?"
+%
+Elliptic paraboloids for sale.
+%
+Elliptical, n.:
+ The feel of a kiss.
+%
+Eloquence is logic on fire.
+%
+Elwood: What kind of music do you get here ma'am?
+Barmaid: Why, we get both kinds of music, Country and Western.
+%
+Emacs, n.:
+ A slow-moving parody of a text editor.
+%
+Emerson's Law of Contrariness:
+ Our chief want in life is somebody who shall make us do
+ what we can. Having found them, we shall then hate them
+ for it.
+%
+Encyclopedia for sale by father.
+Son knows everything.
+%
+Encyclopedia Salesmen:
+ Invite them all in. Nip out the back door. Phone the police
+ and tell them your house is being burgled.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Endless Loop: n. see Loop, Endless.
+Loop, Endless: n. see Endless Loop.
+ -- Random Shack Data Processing Dictionary
+%
+Endless the world's turn, endless the sun's spinning
+Endless the quest;
+I turn again, back to my own beginning,
+And here, find rest.
+%
+Enemy -- SP (Suppressive Person) Order. Fair Game. May be deprived of
+property or injured by any means by any Scientologist without any discipline
+of the Scientologist. May be tricked, sued or lied to or destroyed.
+ -- L. Ron Hubbard, "Fair Game Doctrine"
+%
+Engineering: "How will this work?"
+Science: "Why will this work?"
+Management: "When will this work?"
+Liberal Arts: "Do you want fries with that?"
+%
+English literature's performing flea.
+ -- Sean O'Casey on P. G. Wodehouse
+%
+Engram, n.:
+ 1. The physical manifestation of human memory -- "the engram."
+2. A particular memory in physical form. [Usage note: this term is no longer
+in common use. Prior to Wilson and Magruder's historic discovery, the nature
+of the engram was a topic of intense speculation among neuroscientists,
+psychologists, and even computer scientists. In 1994 Professors M. R. Wilson
+and W. V. Magruder, both of Mount St. Coax University in Palo Alto, proved
+conclusively that the mammalian brain is hardwired to interpret a set of
+thirty seven genetically transmitted cooperating TECO macros. Human memory
+was shown to reside in 1 million Q-registers as Huffman coded uppercase-only
+ASCII strings. Interest in the engram has declined substantially since that
+time.]
+ -- New Century Unabridged English Dictionary,
+ 3rd edition, 2007 A.D.
+%
+Enhance, v.:
+ To tamper with an image, usually to its detriment.
+%
+Enjoy your life; be pleasant and gay, like the birds in May.
+%
+Enjoy yourself while you're still old.
+%
+Entrepreneur, n.:
+ A high-rolling risk taker who would rather
+ be a spectacular failure than a dismal success.
+%
+Entropy isn't what it used to be.
+%
+Entropy requires no maintenance.
+ -- Markoff Chaney
+%
+Envy is a pain of mind that successful men cause their neighbors.
+ -- Onasander
+%
+Envy, n.:
+ Wishing you'd been born with an unfair advantage,
+ instead of having to try and acquire one.
+%
+Enzymes are things invented by biologists
+that explain things which otherwise require harder thinking.
+ -- Jerome Lettvin
+%
+Epperson's law:
+ When a man says it's a silly, childish game, it's probably
+ something his wife can beat him at.
+%
+Equal bytes for women.
+%
+Ere the cock crows thrice one of you will betray me.
+ -- Early Jewish Resistance Leader
+%
+Ernest asks Frank how long he has been working for the company.
+ "Ever since they threatened to fire me."
+%
+Error in operator: add beer
+%
+Es brilig war. Die schlichte Toven
+ Wirrten und wimmelten in Waben;
+Und aller-m"umsige Burggoven
+ Dir mohmen R"ath ausgraben.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+Eschew obfuscation.
+%
+Established technology tends to persist in the face of new technology.
+ -- G. Blaauw, one of the designers of System 360
+%
+E.T. GO HOME!!! (And take your Smurfs with you.)
+%
+Eternal nothingness is fine if you happen to be dressed for it.
+ -- Woody Allen
+%
+Eternity is a terrible thought. I mean, where's it going to end?
+ -- Tom Stoppard
+%
+Etiquette is for those with no breeding;
+fashion for those with no taste.
+%
+Etymology, n.:
+ Some early etymological scholars came up with derivations that
+ were hard for the public to believe. The term 'etymology' was
+ formed from the Latin 'etus' ("eaten"), the root 'mal' ("bad"),
+ and 'logy' ("study of"). It meant "the study of things that are
+ hard to swallow."
+ -- Mike Kellen
+%
+Euch ist bekannt, was wir beduerfen;
+Wir wollen stark Getraenke schluerfen.
+ -- Johann Wolfgang von Goethe, "Faust"
+%
+Eudaemonic research proceeded with the casual mania peculiar to this part of
+the world. Nude sunbathing on the back deck was combined with phone calls to
+Advanced Kinetics in Costa Mesa, American Laser Systems in Goleta, Automation
+Industries in Danbury, Connecticut, Arenberg Ultrasonics in Jamaica Plain,
+Massachusetts, and Hewlett Packard in Sunnyvale, California, where Norman
+Packard's cousin, David, presided as chairman of the board. The trick was to
+make these calls at noon, in the hope that out-to-lunch executives would return
+them at their own expense. Eudaemonic Enterprises, for all they knew, might be
+a fast-growing computer company branching out of the Silicon Valley. Sniffing
+the possibility of high-volume sales, these executives little suspected that
+they were talking on the other end of the line to a naked physicist crazed
+over roulette.
+ -- Thomas Bass, "The Eudaemonic Pie"
+%
+Eureka!
+ -- Archimedes
+%
+Even a blind pig stumbles upon a few acorns.
+%
+Even a cabbage may look at a king.
+%
+Even a hawk is an eagle among crows.
+%
+Even a man who is pure at heart,
+And says his prayers at night
+Can become a wolf when the wolfbane blooms,
+And the moon is full and bright.
+ -- The Wolf Man, 1941
+%
+Even God cannot change the past.
+ -- Joseph Stalin
+%
+Even God lends a hand to honest boldness.
+ -- Menander
+%
+Even if you do learn to speak correct
+English, whom are you going to speak it to?
+ -- Clarence Darrow
+%
+Even if you persuade me, you won't persuade me.
+ -- Aristophanes
+%
+Even if you're on the right track, you'll get run over if you just sit there.
+ -- Will Rogers
+%
+Even in the moment of our earliest kiss,
+When sighed the straitened bud into the flower,
+Sat the dry seed of most unwelcome this;
+And that I knew, though not the day and hour.
+Too season-wise am I, being country-bred,
+To tilt at autumn or defy the frost:
+Snuffing the chill even as my fathers did,
+I say with them, "What's out tonight is lost."
+I only hoped, with the mild hope of all
+Who watch the leaf take shape upon the tree,
+A fairer summer and a later fall
+Than in these parts a man is apt to see,
+And sunny clusters ripened for the wine:
+I tell you this across the blackened vine.
+ -- Edna St. Vincent Millay, "Even in the Moment of
+ Our Earliest Kiss", 1931
+%
+Even moderation ought not to be practiced to excess.
+%
+Even the best of friends cannot attend each other's funeral.
+ -- Kehlog Albran, "The Profit"
+%
+Even though they raised the rate for first class mail in the United
+States we really shouldn't complain -- it's still only two cents a
+day.
+%
+Events are not affected, they develop.
+ -- Sri Aurobindo
+%
+Ever feel like life was a game and you had the wrong instruction book?
+%
+Ever feel like you're the head pin on life's
+bowling alley, and everyone's rolling strikes?
+%
+Ever get the feeling that the world's
+on tape and one of the reels is missing?
+ -- Rich Little
+%
+Ever notice that even the busiest people are
+never too busy to tell you just how busy they are?
+%
+Ever notice that the word "therapist" breaks down into "the rapist"?
+Simple coincidence?
+Maybe...
+%
+Ever Onward! Ever Onward!
+That's the sprit that has brought us fame.
+We're big but bigger we will be,
+We can't fail for all can see, that to serve humanity
+Has been our aim.
+Our products now are known in every zone.
+Our reputation sparkles like a gem.
+We've fought our way thru
+And new fields we're sure to conquer, too
+For the Ever Onward IBM!
+ -- Ever Onward, from the 1940 IBM Songbook
+%
+Ever Onward! Ever Onward!
+We're bound for the top to never fall,
+Right here and now we thankfully
+Pledge sincerest loyalty
+To the corporation that's the best of all
+Our leaders we revere and while we're here,
+Let's show the world just what we think of them!
+So let us sing men -- Sing men
+Once or twice, then sing again
+For the Ever Onward IBM!
+ -- Ever Onward, from the 1940 IBM Songbook
+%
+Ever since I was a young boy,
+I've hacked the ARPA net,
+From Berkeley down to Rutgers, He's on my favorite terminal,
+Any access I could get, He cats C right into foo,
+But ain't seen nothing like him, His disciples lead him in,
+On any campus yet, And he just breaks the root,
+That deaf, dumb, and blind kid, Always has full SYS-PRIV's,
+Sure sends a mean packet. Never uses lint,
+ That deaf, dumb, and blind kid,
+ Sure sends a mean packet.
+He's a UNIX wizard,
+There has to be a twist.
+The UNIX wizard's got Ain't got no distractions,
+Unlimited space on disk. Can't hear no whistles or bells,
+How do you think he does it? Can't see no message flashing,
+I don't know. Types by sense of smell,
+What makes him so good? Those crazy little programs,
+ The proper bit flags set,
+ That deaf, dumb, and blind kid,
+ Sure sends a mean packet.
+ -- UNIX Wizard
+%
+Ever since prehistoric times, wise men have tried to understand what,
+exactly, make people laugh. That's why they were called "wise men."
+All the other prehistoric people were out puncturing each other with
+spears, and the wise men were back in the cave saying: "How about:
+Would you please take my wife? No. How about: Here is my wife, please
+take her right now. No. How about: Would you like to take something?
+My wife is available. No. How about ..."
+ -- Dave Barry, "Why Humor is Funny"
+%
+Ever wonder if taxation without representation might have been cheaper?
+%
+Ever wonder why fire engines are red?
+
+Because newspapers are read too.
+Two and Two is four.
+Four and four is eight.
+Eight and four is twelve.
+There are twelve inches in a ruler.
+Queen Mary was a ruler.
+Queen Mary was a ship.
+Ships sail the sea.
+There are fishes in the sea.
+Fishes have fins.
+The Fins fought the Russians.
+Russians are red.
+Fire engines are always rush'n.
+Therefore fire engines are red.
+%
+Ever wondered about the origins of the term "bugs" as applied to computer
+technology? U.S. Navy Capt. Grace Murray Hopper has firsthand explanation.
+The 74-year-old captain, who is still on active duty, was a pioneer in
+computer technology during World War II. At the C. W. Post Center of Long
+Island University, Hopper told a group of Long Island public school adminis-
+trators that the first computer "bug" was a real bug--a moth. At Harvard
+one August night in 1945, Hopper and her associates were working on the
+"granddaddy" of modern computers, the Mark I. "Things were going badly;
+there was something wrong in one of the circuits of the long glass-enclosed
+computer," she said. "Finally, someone located the trouble spot and, using
+ordinary tweezers, removed the problem, a two-inch moth. From then on, when
+anything went wrong with a computer, we said it had bugs in it." Hopper
+said that when the veracity of her story was questioned recently, "I referred
+them to my 1945 log book, now in the collection of the Naval Surface Weapons
+Center, and they found the remains of that moth taped to the page in
+question."
+ [actually, the term "bug" had even earlier usage in
+ regard to problems with radio hardware. Ed.]
+%
+Everlasting peace will come to the world when the last man has slain
+the last but one.
+ -- Adolf Hitler
+%
+Every absurdity has a champion who will defend it.
+%
+Every cloud engenders not a storm.
+ -- William Shakespeare, "Henry VI"
+%
+Every cloud has a silver lining;
+you should have sold it, and bought titanium.
+%
+Every country has the government it deserves.
+ -- Joseph De Maistre
+%
+Every creature has within him the wild, uncontrollable urge to punt.
+%
+Every day it's the same thing -- variety. I want something different.
+%
+Every day people are straying away from the church and going back to God.
+ -- Lenny Bruce
+%
+Every dog has its day, but the nights belong to the pussycats.
+%
+Every four seconds a woman has a baby. Our problem is to find this
+woman and stop her.
+%
+Every group has a couple of experts. And every group has at least one
+idiot. Thus are balance and harmony (and discord) maintained. It's
+sometimes hard to remember this in the bulk of the flamewars that all
+of the hassle and pain is generally caused by one or two
+highly-motivated, caustic twits.
+ -- Chuq Von Rospach, about Usenet
+%
+Every gun that is made, every warship launched, every rocket fired
+signifies in the final sense, a theft from those who hunger and are not
+fed, those who are cold and are not clothed. This world in arms is not
+spending money alone. It is spending the sweat of its laborers, the
+genius of its scientists, the hopes of its children. This is not a way
+of life at all in any true sense. Under the clouds of war, it is
+humanity hanging on a cross of iron.
+ -- Dwight D. Eisenhower, April 16, 1953
+%
+Every Horse has an Infinite Number of Legs (proof by intimidation):
+
+Horses have an even number of legs. Behind they have two legs, and in
+front they have fore-legs. This makes six legs, which is certainly an
+odd number of legs for a horse. But the only number that is both even
+and odd is infinity. Therefore, horses have an infinite number of
+legs. Now to show this for the general case, suppose that somewhere,
+there is a horse that has a finite number of legs. But that is a horse
+of another color, and by the [above] lemma ["All horses are the same
+color"], that does not exist.
+%
+Every improvement in communication makes the bore more terrible.
+ -- Frank Moore Colby
+%
+Every journalist has a novel in him, which is an excellent place for it.
+%
+Every little picofarad has a nanohenry all its own.
+ -- Don Vonada
+%
+Every love's the love before
+In a duller dress.
+ -- Dorothy Parker, "Summary"
+%
+Every man has his price. Mine is $3.95.
+%
+Every man is apt to form his notions of things difficult to be apprehended,
+or less familiar, from their analogy to things which are more familiar.
+Thus, if a man bred to the seafaring life, and accustomed to think and talk
+only of matters relating to navigation, enters into discourse upon any other
+subject; it is well known, that the language and the notions proper to his
+own profession are infused into every subject, and all things are measured
+by the rules of navigation: and if he should take it into his head to
+philosophize concerning the faculties of the mind, it cannot be doubted,
+but he would draw his notions from the fabric of the ship, and would find
+in the mind, sails, masts, rudder, and compass.
+ -- Thomas Reid, "An Inquiry into the Human Mind", 1764
+%
+Every man is as God made him, ay, and often worse.
+ -- Miguel de Cervantes
+%
+Every man takes the limits of his own field
+of vision for the limits of the world.
+ -- Schopenhauer
+%
+Every man thinks God is on his side. The rich
+and powerful know that he is.
+ -- Jean Anouilh, "The Lark"
+%
+Every man who has reached even his intellectual teens begins to suspect
+that life is no farce; that it is not genteel comedy even; that it flowers
+and fructifies on the contrary out of the profoundest tragic depths of the
+essential death in which its subject's roots are plunged. The natural
+inheritance of everyone who is capable of spiritual life is an unsubdued
+forest where the wolf howls and the obscene bird of night chatters.
+ -- Henry James Sr., writing to his sons Henry and William
+%
+Every man who is high up likes to think that he has done
+it all himself, and the wife smiles and lets it go at that.
+ -- Barrie
+%
+Every morning, I get up and look through the "Forbes" list of the
+richest people in America. If I'm not there, I go to work.
+ -- Robert Orben
+%
+Every morning in Africa, a gazelle wakes up. It knows it must run faster
+than the fastest lion or it will be killed. Every morning a lion wakes up.
+It knows it must outrun the slowest gazelle or it will starve to death.
+It doesn't matter whether you are a lion or a gazelle: when the sun comes
+up, you'd better be running.
+%
+Every morning is a Smirnoff morning.
+%
+Every night my prayers I say,
+ And get my dinner every day;
+And every day that I've been good,
+ I get an orange after food.
+The child that is not clean and neat,
+ With lots of toys and things to eat,
+He is a naughty child, I'm sure--
+ Or else his dear papa is poor.
+ -- Robert Louis Stevenson
+%
+Every nonzero finite dimensional inner product space has an orthonormal basis.
+
+It makes sense, when you don't think about it.
+%
+Every now and then when your life gets complicated and the weasels
+start closing in, the only cure is to load up on heinous chemicals and
+then drive like a bastard from Hollywood to Las Vegas ... with the
+music at top volume and at least a pint of ether.
+ -- Hunter S. Thompson, "Fear and Loathing in Las Vegas"
+%
+Every one says that politicians lie all the time, and that just isn't so!
+But you do have to understand body language to know when they're lying and
+when they aren't.
+
+ When a politician rubs his nose, he isn't lying.
+ When a politician tugs on his ear, he isn't lying.
+ When a politician scratches his collar bone, he isn't lying.
+ When his mouth starts moving, that's when he's lying!
+%
+Every paper published in a respectable journal should have a preface by
+the author stating why he is publishing the article, and what value he
+sees in it. I have no hope that this practice will ever be adopted.
+ -- Morris Kline
+%
+Every path has its puddle.
+%
+Every person, all the events in your life are there because you have
+drawn them there. What you choose to do with them is up to you.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+Every program has at least one bug and can be shortened by at least one
+instruction -- from which, by induction, one can deduce that every program
+can be reduced to one instruction which doesn't work.
+%
+Every program has (at least) two purposes:
+ the one for which it was written and another for which it wasn't.
+%
+Every program is a part of some other program, and rarely fits.
+%
+Every silver lining has a cloud around it.
+%
+Every Solidarity center had piles and piles of paper ... everyone was
+eating paper and a policeman was at the door. Now all you have to do is
+bend a disk.
+ -- A member of the outlawed Polish trade union, Solidarity,
+ commenting on the benefits of using computers in support
+ of their movement.
+%
+Every solution breeds new problems.
+%
+Every successful person has had failures
+but repeated failure is no guarantee of eventual success.
+%
+Every suicide is a solution to a problem.
+ -- Jean Baechler
+%
+Every time I look at you I am more convinced of Darwin's theory.
+%
+Every time I lose weight, it finds me again!
+%
+Every time I think I know where it's at, they move it.
+%
+Every time you manage to close the door on
+Reality, it comes in through the window.
+%
+Every why hath a wherefore.
+ -- William Shakespeare, "A Comedy of Errors"
+%
+Every word is like an unnecessary stain on silence and nothingness.
+ -- Beckett
+%
+Every young man should have a hobby: learning how to handle money is
+the best one.
+ -- Jack Hurley
+%
+Everybody but Sam had signed up for a new company pension plan that
+called for a small employee contribution. The company was paying all
+the rest. Unfortunately, 100% employee participation was needed;
+otherwise the plan was off. Sam's boss and his fellow workers pleaded
+and cajoled, but to no avail. Sam said the plan would never pay off.
+Finally the company president called Sam into his office.
+ "Sam," he said, "here's a copy of the new pension plan and here's
+a pen. I want you to sign the papers. I'm sorry, but if you don't sign,
+you're fired. As of right now."
+ Sam signed the papers immediately.
+ "Now," said the president, "would you mind telling me why you
+couldn't have signed earlier?"
+ "Well, sir," replied Sam, "nobody explained it to me quite so
+clearly before."
+%
+Everybody has something to conceal.
+ -- Humphrey Bogart
+%
+Everybody is given the same amount of hormones, at birth, and
+if you want to use yours for growing hair, that's fine with me.
+%
+Everybody is somebody else's weirdo.
+ -- Edsger W. Dijkstra
+%
+Everybody knows that the dice are loaded. Everybody rolls with their
+fingers crossed. Everybody knows the war is over. Everybody knows the
+good guys lost. Everybody knows the fight was fixed: the poor stay
+poor, the rich get rich. That's how it goes. Everybody knows.
+
+Everybody knows that the boat is leaking. Everybody knows the captain
+lied. Everybody got this broken feeling like their father or their dog
+just died.
+
+Everybody talking to their pockets. Everybody wants a box of chocolates
+and long stem rose. Everybody knows.
+
+Everybody knows that you love me, baby. Everybody knows that you really
+do. Everybody knows that you've been faithful, give or take a night or
+two. Everybody knows you've been discreet, but there were so many people
+you just had to meet without your clothes. And everybody knows.
+
+And everybody knows it's now or never. Everybody knows that it's me or you.
+And everybody knows that you live forever when you've done a line or two.
+Everybody knows the deal is rotten: Old Black Joe's still pickin' cotton
+for you ribbons and bows. And everybody knows.
+ -- Leonard Cohen, "Everybody Knows"
+%
+Everybody likes a kidder, but nobody lends him money.
+ -- Arthur Miller
+%
+Everybody needs a little love sometime;
+stop hacking and fall in love!
+%
+Everybody wants to go to heaven, but nobody wants to die.
+%
+Everyone can be taught to sculpt: Michelangelo would have had
+to be taught how not to. So it is with the great programmers.
+%
+Everyone complains of his memory, no one of his judgment.
+%
+Everyone hates me because I'm paranoid.
+%
+Everyone is a genius. It's just that some people are too stupid to
+realize it.
+%
+Everyone is entitled to my opinion.
+%
+Everyone is in the best seat.
+ -- John Cage
+%
+Everyone is more or less mad on one point.
+ -- Rudyard Kipling
+%
+Everyone knows that dragons don't exist. But while this simplistic
+formulation may satisfy the layman, it does not suffice for the
+scientific mind. The School of Higher Neantical Nillity is in fact
+wholly unconcerned with what _d_o_e_s exist. Indeed, the banality of
+existence has been so amply demonstrated, there is no need for us to
+discuss it any further here. The brilliant Cerebron, attacking the
+problem analytically, discovered three distinct kinds of dragon: the
+mythical, the chimerical, and the purely hypothetical. They were all,
+one might say, nonexistent, but each nonexisted in an entirely
+different way ...
+ -- Stanislaw Lem, "Cyberiad"
+%
+Everyone talks about apathy, but no one _d_o_e_s anything about it.
+%
+Everyone wants results, but no one is willing to do what it takes
+to get them.
+ -- Dirty Harry
+%
+Everyone was born right-handed.
+Only the greatest overcome it.
+%
+Everyone who comes in here wants three things:
+ 1. They want it quick.
+ 2. They want it good.
+ 3. They want it cheap.
+I tell 'em to pick two and call me back.
+ -- sign on the back wall of a small printing company
+%
+Everyone's in a high place when you're on your knees.
+%
+Everything bows to success, even grammar.
+%
+Everything can be filed under "miscellaneous".
+%
+Everything ends badly. Otherwise it wouldn't end.
+%
+Everything I like is either illegal, immoral or fattening.
+ -- Alexander Woollcott
+%
+Everything in this book may be wrong.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+Everything is controlled by a small evil group
+to which, unfortunately, no one we know belongs.
+%
+Everything is possible. Pass the word.
+ -- Rita Mae Brown, "Six of One"
+%
+Everything is worth precisely as much as a belch, the difference being
+that a belch is more satisfying.
+ -- Ingmar Bergman
+%
+Everything journalists write is true, except when they write about
+something you know.
+ -- Dag-Erling Smorgrav,
+ June 1999, FreeBSD-Stable Mailing List
+%
+Everything might be different in the present
+if only one thing had been different in the past.
+%
+Everything new stalls because there is precedence for the old.
+ -- Poul Henningsen (1894-1967)
+%
+Everything should be built top-down, except the first time.
+%
+Everything should be made as simple as possible, but not simpler.
+ -- Albert Einstein
+%
+Everything takes longer, costs more, and is less useful.
+ -- Erwin Tomash
+%
+Everything that can be invented has been invented.
+ -- Charles Duell, Director of U.S. Patent Office, 1899
+%
+Everything that you know is wrong, but you can be straightened out.
+%
+Everything will be just tickety-boo today.
+%
+Everything you know is wrong!
+%
+Everything you read in newspapers is absolutely true, except for that
+rare story of which you happen to have first-hand knowledge.
+ -- Erwin Knoll
+%
+Everything you've learned in school as "obvious" becomes less and less
+obvious as you begin to study the universe. For example, there are no
+solids in the universe. There's not even a suggestion of a solid.
+There are no absolute continuums. There are no surfaces. There are no
+straight lines.
+ -- R. Buckminster Fuller
+%
+Everything's great in this good old world;
+(This is the stuff they can always use.)
+God's in his heaven, the hill's dew-pearled;
+(This will provide for baby's shoes.)
+Hunger and War do not mean a thing;
+Everything's rosy where'er we roam;
+Hark, how the little birds gaily sing!
+(This is what fetches the bacon home.)
+ -- Dorothy Parker, "The Far Sighted Muse"
+%
+Everywhere I go I'm asked if I think the university stifles writers. My
+opinion is that they don't stifle enough of them. There's many a bestseller
+that could have been prevented by a good teacher.
+ -- Flannery O'Connor
+%
+Everywhere you go you'll see them searching,
+Everywhere you turn you'll feel the pain,
+Everyone is looking for the answer,
+Well look again.
+ -- Moody Blues, "Lost in a Lost World"
+%
+Evil is that which one believes of others. It is a sin to believe evil
+of others, but it is seldom a mistake.
+ -- H. L. Mencken
+%
+Evolution is a million line computer
+program falling into place by accident.
+%
+Evolution is as much a fact as the earth turning on its axis and going around
+the sun. At one time this was called the Copernican theory; but, when
+evidence for a theory becomes so overwhelming that no informed person can
+doubt it, it is customary for scientists to call it a fact. That all present
+life descended from earlier forms, over vast stretches of geologic time, is
+as firmly established as Copernican cosmology. Biologists differ only with
+respect to theories about how the process operates.
+ -- Martin Gardner, "Irving Kristol and the Facts of Life"
+%
+Examinations are formidable even to the best prepared, for
+even the greatest fool may ask more than the wisest man can answer.
+ -- C. C. Colton
+%
+Example is not the main thing in influencing others.
+It is the only thing.
+ -- Albert Schweitzer
+%
+Excellent day for drinking heavily.
+Spike the office water cooler.
+%
+Excellent day for putting Slinkies on an escalator.
+%
+Excellent day to have a rotten day.
+%
+Excellent time to become a missing person.
+%
+Exceptions prove the rule, and wreck the budget.
+ -- Miller
+%
+Excerpt from a conversation between a customer support person and a
+customer working for a well-known military-affiliated research lab:
+
+Support: "You're not our only customer, you know."
+Customer: "But we're one of the few with tactical nuclear weapons."
+%
+Excerpt from a DEC field service document:
+
+....
+- none of these should have made it to customers. BUT you could loosen the
+screws and lift system board at fan end while powering on to see if OCP
+comes up - this is not recommended unless you have three hands.
+%
+Excess on occasion is exhilarating. It prevents moderation from
+acquiring the deadening effect of a habit.
+ -- W. Somerset Maugham
+%
+Excessive login messages are a sure sign of senility.
+%
+Excessive login or logout messages are a sure sign of senility.
+%
+Execute every act of thy life as though it were thy last.
+ -- Marcus Aurelius
+%
+Executive ability is deciding quickly and getting somebody else to do
+the work.
+ -- John G. Pollard
+%
+Executive ability is prominent in your make-up.
+%
+Exercise caution in your daily affairs.
+%
+Exhilaration is that feeling you get just after a great idea hits you,
+and just before you realize what is wrong with it.
+%
+Expansion means complexity; and complexity decay.
+%
+Expect a letter from a friend who will ask a favor of you.
+%
+Expect the worst, it's the least you can do.
+%
+Expedience is the best teacher.
+%
+Expense accounts, n.:
+ Corporate food stamps.
+%
+Experience is a good teacher, but she sends in terrific bills.
+ -- Minna Antrim, "Naked Truth and Veiled Allusions"
+%
+Experience is not what happens to you;
+it is what you do with what happens to you.
+ -- Aldous Huxley
+%
+Experience is that marvelous thing that enables
+you recognize a mistake when you make it again.
+ -- Franklin Jones
+%
+Experience is the worst teacher. It always
+gives the test first and the instruction afterward.
+%
+Experience is what causes a person
+to make new mistakes instead of old ones.
+%
+Experience is what you get when you didn't get what you wanted.
+%
+Experience teaches you that the man who looks you straight in the eye,
+particularly if he adds a firm handshake, is hiding something.
+ -- Clifton Fadiman, "Enter Conversing"
+%
+Experiments must be reproducible; they should all fail in the same way.
+%
+Expert, n.:
+ Someone who comes from out of town and shows slides.
+%
+External Security:
+%
+Extract from Official Sweepstakes Rules:
+
+ NO PURCHASE REQUIRED TO CLAIM YOUR PRIZE
+
+To claim your prize without purchase, do the following: (a) Carefully
+cut out your computer-printed name and address from upper right hand
+corner of the Prize Claim Form. (b) Affix computer-printed name and
+address -- with glue or cellophane tape (no staples or paper clips) --
+to a 3x5 inch index card. (c) Also cut out the "No" paragraph (lower
+left hand corner of Prize Claim Form) and affix it to the 3x5 card
+below your address label. (d) Then print on your 3x5 card, above your
+computer-printed name and address the words "CARTER & VAN PEEL
+SWEEPSTAKES" (Use all capital letters.) (e) Finally place 3x5 card
+(without bending) into a plain envelope [NOTE: do NOT use the
+Official Prize Claim and CVP Perfume Reply Envelope or you may be
+disqualified], and mail to: CVP, Box 1320, Westbury, NY 11595. Print
+this address correctly. Comply with above instructions carefully and
+completely or you may be disqualified from receiving your prize.
+%
+Extraordinary claims demand extraordinary proof. There are many examples
+of outsiders who eventually overthrew entrenched scientific orthodoxies,
+but they prevailed with irrefutable data. More often, egregious findings
+that contradict well-established research turn out to be artifacts. I have
+argued that accepting psychic powers, reincarnation, "cosmic consciousness,"
+and the like, would entail fundamental revisions of the foundations of
+neuroscience. Before abandoning materialist theories of mind that have paid
+handsome dividends, we should insist on better evidence for psi phenomena
+than presently exists, especially when neurology and psychology themselves
+offer more plausible alternatives.
+ -- Barry L. Beyerstein, "The Brain and Consciousness:
+ Implications for Psi Phenomena".
+%
+Extreme fear can neither fight nor fly.
+ -- William Shakespeare, "The Rape of Lucrece"
+%
+Extremism in the defense of liberty is no vice... moderation in the pursuit
+of justice is no virtue.
+ -- Barry Goldwater
+%
+F: When into a room I plunge, I
+ Sometimes find some VIOLET FUNGI.
+ Then I linger, darkly brooding
+ On the poison they're exuding.
+ -- The Roguelet's ABC
+%
+F. Scott Fitzgerald to Hemingway:
+ "Ernest, the rich are different from us."
+Hemingway:
+ "Yes. They have more money."
+%
+f u cn rd ths, itn tyg h myxbl cd.
+%
+f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.
+%
+f u cn rd ths, u r prbbly a lsy spllr.
+%
+FACILITY REJECTED 100044200000;
+%
+Factorials were someone's attempt to make math LOOK exciting.
+%
+Facts, apart from their relationships, are like labels on empty bottles.
+ -- Sven Italla
+%
+Facts are stubborn, but statistics are more pliable.
+%
+Facts are the enemy of truth.
+ -- Don Quixote
+%
+Facts do not cease to exist because they are ignored.
+ -- Aldous Huxley
+%
+Failed Attempts To Break Records
+ In September 1978 Mr. Terry Gripton, of Stafford, failed to break
+the world shouting record by two and a half decibels. "I am not surprised
+he failed," his wife said afterwards. "He's really a very quiet man and
+doesn't even shout at me."
+ In August of the same year Mr. Paul Anthony failed to break the
+record for continuous organ playing by 387 hours.
+ His attempt at the Golden Fish Fry Restaurant in Manchester ended
+after 36 hours 10 minutes, when he was accused of disturbing the peace.
+"People complained I was too noisy," he said.
+ In January 1976 Mr. Barry McQueen failed to walk backwards across
+the Menai Bridge playing the bagpipes. "It was raining heavily and my
+drone got waterlogged," he said.
+ A TV cameraman thwarted Mr. Bob Specas' attempt to topple 100,000
+dominoes at the Manhattan Center, New York on 9 June 1978. 97,500 dominoes
+had been set up when he dropped his press badge and set them off.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+Failure is more frequently from want of energy than want of capital.
+%
+Fain would I climb, yet fear I to fall.
+ -- Sir Walter Raleigh
+%
+Fairy Tale, n.:
+ A horror story to prepare children for the newspapers.
+%
+Faith goes out through the window when beauty comes in at the door.
+%
+Faith has never moved as much as a pin-head from the place it
+ought to be according to tradition and the scriptures. It is
+the doubt that moved all the mountains.
+ -- Poul Henningsen (1894-1967)
+%
+Faith is the quality that enables you to eat blackberry jam
+on a picnic without looking to see whether the seeds move.
+%
+Faith is under the left nipple.
+ -- Martin Luther
+%
+Faith, n.:
+ That quality which enables us to
+ believe what we know to be untrue.
+%
+Fakir, n.:
+ A psychologist whose charismatic data have inspired almost
+ religious devotion in his followers, even though the sources
+ seem to have shinnied up a rope and vanished.
+%
+Falling in Love
+ When two people have been on enough dates, they generally fall in
+love. You can tell you're in love by the way you feel: your head becomes
+light, your heart leaps within you, you feel like you're walking on air,
+and the whole world seems like a wonderful and happy place. Unfortunately,
+these are also the four warning signs of colon disease, so it's always a
+good idea to check with your doctor.
+ -- Dave Barry
+%
+Falling in love is a lot like dying.
+You never get to do it enough to become good at it.
+%
+Falling in love makes smoking pot all day look like the ultimate in
+restraint.
+ -- Dave Sim, author of "Cerebus"
+%
+Fame is a vapor; popularity an accident;
+the only earthly certainty is oblivion.
+ -- Mark Twain
+%
+Fame lost its appeal for me when I went into a public restroom and an
+autograph seeker handed me a pen and paper under the stall door.
+ -- Marlo Thomas
+%
+Fame may be fleeting but obscurity is forever.
+%
+Familiarity breeds attempt.
+%
+Familiarity breeds contempt -- and children.
+ -- Mark Twain
+%
+Families, when a child is born
+Want it to be intelligent.
+I, through intelligence,
+Having wrecked my whole life,
+Only hope the baby will prove
+Ignorant and stupid.
+Then he will crown a tranquil life
+By becoming a Cabinet Minister
+ -- Su Tung-p'o
+%
+Famous, adj.:
+ Conspicuously miserable.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Famous last words:
+%
+Famous last words:
+ 1: Don't unplug it, it will just take a moment to fix.
+ 2: Let's take the shortcut, he can't see us from there.
+ 3: What happens if you touch these two wires tog...
+ 4: We won't need reservations.
+ 5: It's always sunny there this time of the year.
+ 6: Don't worry, it's not loaded.
+ 7: They'd never (be stupid enough to) make him a manager.
+ 8: Don't worry! Women love it!
+%
+Fanaticism consists of redoubling your effort when you have
+forgotten your aim.
+ -- George Santayana
+%
+Far back in the mists of ancient time, in the great and glorious days of the
+former Galactic Empire, life was wild, rich and largely tax free.
+
+Mighty starships plied their way between exotic suns, seeking adventure and
+reward among the furthest reaches of Galactic space. In those days, spirits
+were brave, the stakes were high, men were real men, women were real women
+and small furry creatures from Alpha Centauri were real small furry creatures
+from Alpha Centauri. And all dared to brave unknown terrors, to do mighty
+deeds, to boldly split infinitives that no man had split before -- and thus
+was the Empire forged.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Far duller than a serpent's tooth it is to spend a quiet youth.
+%
+Far out in the uncharted backwaters of the unfashionable end of the
+Western Spiral arm of the Galaxy lies a small unregarded yellow sun.
+Orbiting this at a distance of roughly ninety-eight million miles is an
+utterly insignificant little blue-green planet whose ape-descended life
+forms are so amazingly primitive that they still think digital watches
+are a pretty neat idea ...
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Farmers in the Iowa State survey rated machinery breakdowns more
+stressful than divorce.
+ -- Wall Street Journal
+%
+Fashion is a form of ugliness so intolerable that we have to alter
+it every six months.
+ -- Oscar Wilde
+%
+Fashions have done more harm than revolutions.
+ -- Victor Hugo
+%
+Fast, cheap, good: pick two.
+%
+Fast ship? You mean you've never heard of the Millennium Falcon?
+ -- Han Solo
+%
+Faster, faster, you fool, you fool!
+ -- Bill Cosby
+%
+Fat Liberation: because a waist is a terrible thing to mind.
+%
+Fat people of the world unite, we've got nothing to lose!
+%
+Father: Son, it's time we talked about sex.
+Son: Sure, Dad, what do you want to know?
+%
+Fats Loves Madelyn.
+%
+Fay: The British police force used to be run by men of integrity.
+Truscott: That is a mistake which has been rectified.
+ -- Joe Orton, "Loot"
+%
+FEAR:
+ What you feel when you see a U-Haul with Texas license plates.
+%
+Fear and loathing, my man, fear and loathing.
+ -- Hunter S. Thompson
+%
+Fear is the greatest salesman.
+ -- Robert Klein
+%
+Feature, n.:
+ A surprising property of a program. Occasionally documented. To
+ call a property a feature sometimes means the author did not
+ consider that case, and the program makes an unexpected, though
+ not necessarily wrong response. See BUG. "That's not a bug, it's
+ a feature!" A bug can be changed to a feature by documenting it.
+%
+Federal grants are offered for... research into the recreation
+potential of interplanetary space travel for the culturally
+disadvantaged.
+%
+Feel disillusioned?
+I've got some great new illusions, right here!
+%
+Feeling amorous, she looked under the sheets and cried, "Oh, no,
+it's Microsoft!"
+%
+Felix Catus is your taxonomic nomenclature,
+An endothermic quadruped, carnivorous by nature.
+Your visual, olfactory, and auditory senses
+Contribute to your hunting skills and natural defenses.
+I find myself intrigued by your sub-vocal oscillations,
+A singular development of cat communications
+That obviates your basic hedonistic predilection
+For a rhythmic stroking of your fur to demonstrate affection.
+A tail is quite essential for your acrobatic talents:
+You would not be so agile if you lacked its counterbalance;
+And when not being utilized to aid in locomotion,
+It often serves to illustrate the state of your emotion.
+Oh Spot, the complex levels of behavior you display
+Connote a fairly well-developed cognitive array.
+And though you are not sentient, Spot, and do not comprehend,
+I nonetheless consider you a true and valued friend.
+ -- Lt. Cmdr. Data, "An Ode to Spot"
+%
+Fellow programmer, greetings! You are reading a letter which will bring
+you luck and good fortune. Just mail (or UUCP) ten copies of this letter
+to ten of your friends. Before you make the copies, send a chip or
+other bit of hardware, and 100 lines of "C" code to the first person on the
+list given at the bottom of this letter. Then delete their name and add
+yours to the bottom of the list.
+
+Don't break the chain! Make the copy within 48 hours. Gerald R. of San
+Diego failed to send out his ten copies and woke the next morning to find
+his job description changed to "COBOL programmer." Fred A. of New York sent
+out his ten copies and within a month had enough hardware and software to
+build a Cray dedicated to playing Zork. Martha H. of Chicago laughed at
+this letter and broke the chain. Shortly thereafter, a fire broke out in
+her terminal and she now spends her days writing documentation for IBM PC's.
+
+Don't break the chain! Send out your ten copies today!
+%
+Female rabbits:
+ The gift that just "keeps on giving."
+%
+Fenderberg, n.:
+ The large glacial deposits that form on the insides
+ of car fenders during snowstorms.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Ferguson's Precept:
+ A crisis is when you can't say "let's forget the whole thing."
+%
+Fertility is hereditary. If your parents
+didn't have any children, neither will you.
+%
+Fess: Well, you must admit there is something innately humorous about
+ a man chasing an invention of his own halfway across the galaxy.
+Rod: Oh yeah, it's a million yuks, sure. But after all, isn't that the
+ basic difference between robots and humans?
+Fess: What, the ability to form imaginary constructs?
+Rod: No, the ability to get hung up on them.
+ -- Christopher Stasheff, "The Warlock in Spite of Himself"
+%
+Few things are harder to put up with than the annoyance of a good example.
+ -- Mark Twain
+%
+Fidelity, n.:
+ A virtue peculiar to those who are about to be betrayed.
+%
+Fifteen men on a dead man's chest,
+Yo-ho-ho and a bottle of rum!
+Drink and the devil had done for the rest,
+Yo-ho-ho and a bottle of rum!
+ -- Robert Louis Stevenson, "Treasure Island"
+%
+Fifth Law of Applied Terror:
+ If you are given an open-book exam, you will forget your book.
+Corollary:
+ If you are given a take-home exam, you will forget where you live.
+%
+Fifth Law of Procrastination:
+ Procrastination avoids boredom; one never has the feeling that
+there is nothing important to do.
+%
+Fifty flippant frogs
+Walked by on flippered feet
+And with their slime they made the time
+Unnaturally fleet.
+%
+Fights between cats and dogs are prohibited by statute in Barber, North
+Carolina.
+%
+File cabinet:
+ A four drawer, manually activated trash compactor.
+%
+Filibuster, n.:
+ Throwing your wait around.
+%
+Fill what's empty, empty what's full, scratch where it itches.
+ -- Alice Roosevelt Longworth
+%
+Finagle's Creed:
+ Science is true. Don't be misled by facts.
+%
+Finagle's Eighth Law:
+ If an experiment works, something has gone wrong.
+
+Finagle's Ninth Law:
+ No matter what results are expected,
+ someone is always willing to fake it.
+
+Finagle's Tenth Law:
+ No matter what the result someone
+ is always eager to misinterpret it.
+
+Finagle's Eleventh Law:
+ No matter what occurs, someone believes
+ it happened according to his pet theory.
+%
+Finagle's First Law:
+ To study a subject best, understand it thoroughly before you start.
+
+Finagle's Second Law:
+ Always keep a record of data -- it indicates you've been working.
+
+Finagle's Fourth Law:
+ Once a job is fouled up,
+ anything done to improve it only makes it worse.
+
+Finagle's Fifth Law:
+ Always draw your curves, then plot your readings.
+
+Finagle's Sixth Law:
+ Don't believe in miracles -- rely on them.
+%
+Finagle's Second Law:
+ No matter what the anticipated result, there will always be
+ someone eager to (a) misinterpret it, (b) fake it, or
+ (c) believe it happened according to his own pet theory.
+%
+Finagle's Seventh Law:
+ The perversity of the universe tends toward a maximum.
+%
+Finagle's Third Law:
+ In any collection of data, the figure most obviously correct,
+ beyond all need of checking, is the mistake.
+
+Corollaries:
+ 1. Nobody whom you ask for help will see it.
+ 2. The first person who stops by, whose advice you really
+ don't want to hear, will see it immediately.
+%
+Finality is death.
+Perfection is finality.
+Nothing is perfect.
+There are lumps in it.
+%
+Finding out what goes on in the C.I.A. is like performing acupuncture
+on a rock.
+ -- New York Times, Jan. 20, 1981
+%
+Fine day for friends.
+So-so day for you.
+%
+Fine day to throw a party. Throw him as far as you can.
+%
+Fine day to work off excess energy. Steal something heavy.
+%
+Fine's Corollary:
+ Functionality breeds Contempt.
+%
+Finish the sentence below in 25 words or less:
+
+ "Love is what you feel just before you give someone a good ..."
+
+Mail your answer along with the top half of your supervisor to:
+
+ P.O. Box 35
+ Baffled Greek, Michigan
+%
+Finster's Law:
+A closed mouth gathers no feet.
+%
+First, a few words about tools.
+
+Basically, a tool is an object that enables you to take advantage of
+the laws of physics and mechanics in such a way that you can seriously
+injure yourself. Today, people tend to take tools for granted. If
+you're ever walking down the street and you notice some people who look
+particularly smug, the odds are that they are taking tools for
+granted. If I were you, I'd walk right up and smack them in the face.
+ -- Dave Barry, "The Taming of the Screw"
+%
+First Corollary of Taber's Second Law:
+ Machines that piss people off get murdered.
+ -- Pat Taber
+%
+First Law of Bicycling:
+ No matter which way you ride, it's uphill and against the wind.
+%
+First law of debate:
+ Never argue with a fool. People might not know the difference.
+%
+First Law of Procrastination:
+ Procrastination shortens the job and places the responsibility
+ for its termination on someone else (i.e., the authority who
+ imposed the deadline).
+%
+First Law of Socio-Genetics:
+ Celibacy is not hereditary.
+%
+First love is only a little foolishness and a lot of curiosity, no really
+self-respecting woman would take advantage of it.
+ -- George Bernard Shaw, "John Bull's Other Island"
+%
+First Rule of History:
+ History doesn't repeat itself --
+ historians merely repeat each other.
+%
+First rule of public speaking.
+ First, tell 'em what you're goin' to tell 'em;
+ then tell 'em;
+ then tell 'em what you've tole 'em.
+%
+First there was Dial-A-Prayer, then Dial-A-Recipe, and even Dial-A-Footballer.
+But the south-east Victorian town of Sale has produced one to top them all.
+Dial-A-Wombat.
+ It all began early yesterday when Sale police received a telephone
+call: "You won't believe this, and I'm not drunk, but there's a wombat in the
+phone booth outside the town hall," the caller said.
+ Not firmly convinced about the caller's claim to sobriety, members of
+the constabulary drove to the scene, expecting to pick up a drunk.
+ But there it was, an annoyed wombat, trapped in a telephone booth.
+ The wombat, determined not to be had the better of again, threw its
+bulk into the fray. It was eventually lassoed and released in a nearby scrub.
+ Then the officers received another message ... another wombat in
+another phone booth.
+ There it was: *Another* angry wombat trapped in a telephone booth.
+ The constables took the miffed marsupial into temporary custody and
+released it, too, in the scrub.
+ But on their way back to the station they happened to pass another
+telephone booth, and -- you guessed it -- another imprisoned wombat.
+ After some serious detective work, the lads in blue found a suspect,
+and after questioning, released him to be charged on summons.
+ Their problem ... they cannot find a law against placing wombats in
+telephone booths.
+ -- "Newcastle Morning Herald", NSW Australia, Aug 1980
+%
+First things first -- but not necessarily in that order.
+ -- The Doctor, "Doctor Who"
+%
+"First World" nations are the ones where people drive Japanese cars;
+"Second World" nations are where First World residents go on vacation;
+and "Third World" nations are the ones where people still dive out of
+trees to prove their manhood.
+ -- Dave Barry
+%
+Fishbowl, n.:
+ A glass-enclosed isolation cell where newly
+ promoted managers are kept for observation.
+%
+Fishing, with me, has always been an excuse to drink in the daytime.
+ -- Jimmy Cannon
+%
+Five bicycles make a Volkswagen, seven make a truck.
+ -- Adolfo Guzman
+%
+Five is a sufficiently close approximation to infinity.
+ -- Robert Firth
+%
+Five names that I can hardly stand to hear,
+Including yours and mine and one more chimp who isn't here,
+I can see the ladies talking how the times is gettin' hard,
+And that fearsome excavation on Magnolia boulevard,
+Yes, I'm goin' insane,
+And I'm laughing at the frozen rain,
+Well, I'm so alone, honey when they gonna send me home?
+ Bad sneakers and a pina colada my friend,
+ Stopping on the avenue by Radio City, with a
+ Transistor and a large sum of money to spend...
+You fellah, you tearin' up the street,
+You wear that white tuxedo, how you gonna beat the heat,
+Do you take me for a fool, do you think that I don't see,
+That ditch out in the Valley that they're diggin' just for me,
+Yes, and goin' insane,
+You know I'm laughin' at the frozen rain,
+Feel like I'm so alone, honey when they gonna send me home?
+(chorus)
+ -- Bad Sneakers, "Steely Dan"
+%
+Five people -- an Englishman, Russian, American, Frenchman and Irishman
+were each asked to write a book on elephants. Some amount of time later they
+had all completed their respective books. The Englishman's book was entitled
+"The Elephant -- How to Collect Them", the Russian's "The Elephant -- Vol. I",
+the American's "The Elephant -- How to Make Money from Them", the Frenchman's
+"The Elephant -- Its Mating Habits" and the Irishman's "The Elephant and
+Irish Political History".
+%
+Five rules for eternal misery:
+ 1) Always try to exhort others to look upon you favorably.
+ 2) Make lots of assumptions about situations and be sure to
+ treat these assumptions as though they are reality.
+ 3) Then treat each new situation as though it's a crisis.
+ 4) Live in the past and future only (become obsessed with
+ how much better things might have been or how much worse
+ things might become).
+ 5) Occasionally stomp on yourself for being so stupid as to
+ follow the first four rules.
+%
+Flame on!
+ -- Johnny Storm
+%
+Flannister, n.:
+ The plastic yoke that holds a six-pack of beer together.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Flappity, floppity, flip
+The mouse on the m"obius strip;
+ The strip revolved,
+ The mouse dissolved
+In a chronodimensional skip.
+%
+FLASH!
+Intelligence of mankind decreasing.
+Details at ... uh, when the little hand is on the ....
+%
+Flattery is like cologne -- to be smelled, but not swallowed.
+ -- Josh Billings
+%
+Flattery will get you everywhere.
+%
+Flee at once, all is discovered.
+%
+Flirting is the gentle art of making a man feel pleased with himself.
+ -- Helen Rowland
+%
+Flon's Law:
+ There is not now, and never will be, a language in
+ which it is the least bit difficult to write bad programs.
+%
+Florence Flask was ... dressing for the opera when she turned to her
+husband and screamed, "Erlenmeyer! My joules! Someone has stolen my
+joules!"
+
+"Now, now, my dear," replied her husband, "keep your balance and reflux
+a moment. Perhaps they're mislead."
+
+"No, I know they're stolen," cried Florence. "I remember putting them
+in my burette ... We must call a copper."
+
+Erlenmeyer did so, and the flatfoot who turned up, one Sherlock Ohms,
+said the outrage looked like the work of an arch-criminal by the name
+of Lawrence Ium.
+
+"We must be careful -- he's a free radical, ultraviolet, and
+dangerous. His girlfriend is a chlorine at the Palladium. Maybe I can
+catch him there." With that, he jumped on his carbon cycle in an
+activated state and sped off along the reaction pathway ...
+ -- Daniel B. Murphy, "Precipitations"
+%
+Flowchart, n. & v.:
+ [From flow "to ripple down in rich profusion, as hair" + chart
+"a cryptic hidden-treasure map designed to mislead the uninitiated."]
+1. n. The solution, if any, to a class of Mascheroni construction
+problems in which given algorithms require geometrical representation
+using only the 35 basic ideograms of the ANSI template. 2. n. Neronic
+doodling while the system burns. 3. n. A low-cost substitute for
+wallpaper. 4. n. The innumerate misleading the illiterate. "A
+thousand pictures is worth ten lines of code." -- The Programmer's
+Little Red Vade Mecum, Mao Tse T'umps. 5. v.intrans. To produce
+flowcharts with no particular object in mind. 6. v.trans. To obfuscate
+(a problem) with esoteric cartoons.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+Flugg's Law:
+ When you need to knock on wood is when you realize
+ that the world is composed of vinyl, naugahyde and aluminum.
+%
+Fly me away to the bright side of the moon ...
+%
+Flying is the second greatest feeling you can have. The greatest feeling?
+Landing... Landing is the greatest feeling you can have.
+%
+Flying saucers on occasion
+ Show themselves to human eyes.
+Aliens fume, put off invasion
+ While they brand these tales as lies.
+%
+Fog Lamps, n.:
+ Excessively (often obnoxiously) bright lamps mounted on the fronts
+ of automobiles; used on dry, clear nights to indicate that the
+ driver's brain is in a fog. See also "Idiot Lights".
+%
+Follow me around. I don't care. I'm serious. If anybody wants to put a
+tail on me, go ahead. They'd be very bored.
+ -- Gary Hart, announcing his presidential candidacy,
+ commenting on rumors of womanizing.
+%
+Food for thought is no substitute for the real thing.
+ -- Walt Kelly, "Potluck Pogo"
+%
+Foolproof Operation:
+ No provision for adjustment.
+%
+Fools rush in -- and get the best seats in the house.
+%
+Football builds self-discipline. What else would induce
+a spectator to sit out in the open in subfreezing weather?
+%
+Football combines the two worst features of American life.
+It is violence punctuated by committee meetings.
+ -- George F. Will, "Men At Work: The Craft of Baseball"
+%
+Football is a game designed to keep coal miners off the streets.
+ -- Jimmy Breslin
+%
+For 20 dollars, I'll give you a good fortune next time ...
+%
+For a good time, call (510) 642-9483
+%
+For a holy stint, a moth of the cloth gave up his woolens for lint.
+%
+For a light heart lives long.
+ -- William Shakespeare, "Love's Labour's Lost"
+%
+For a man to truly understand rejection, he must first be ignored by a
+cat.
+%
+For adult education nothing beats children.
+%
+For ages, a deadly conflict has been waged between a few brave men and
+women of thought and genius upon the one side, and the great ignorant
+religious mass on the other. This is the war between Science and Faith.
+The few have appealed to reason, to honor, to law, to freedom, to the
+known, and to happiness here in this world. The many have appealed to
+prejudice, to fear, to miracle, to slavery, to the unknown, and to
+misery hereafter. The few have said "Think". The many have said "Believe!"
+ -- Robert Ingersoll, "Gods"
+%
+For an adequate time call 555-3321.
+%
+For an idea to be fashionable is ominous,
+since it must afterwards be always old-fashioned.
+%
+For certain people, after fifty, litigation takes the place of sex.
+ -- Gore Vidal
+%
+For children with short attention spans: boomerangs that don't come back.
+%
+For courage mounteth with occasion.
+ -- William Shakespeare, "King John"
+%
+For every bloke who makes his mark,
+there's half a dozen waiting to rub it out.
+ -- Andy Capp
+%
+For every complex problem, there is a solution that is simple, neat,
+and wrong.
+ -- H. L. Mencken
+%
+For every credibility gap, there is a gullibility fill.
+ -- R. Clopton
+%
+For every human problem, there is a neat,
+plain solution -- and it is always wrong.
+ -- H. L. Mencken
+%
+For example, if \thinmskip = 3mu, this makes \thickmskip = 6mu. But if
+you also want to use \skip12 for horizontal glue, whether in math mode or
+not, the amount of skipping will be in points (e.g., 6pt). The rule is
+that glue in math mode varies with the size only when it is an \mskip;
+when moving between an mskip and ordinary skip, the conversion factor
+1mu=1pt is always used. The meaning of '\mskip\skip12' and
+'\baselineskip=\the\thickmskip' should be clear.
+ -- Donald E. Knuth, TeX 82 -- Comparison with TeX80
+%
+For fast-acting relief, try slowing down.
+%
+For flavor, instant sex will never supersede the stuff you have to peel
+and cook.
+ -- Quentin Crisp
+%
+For fools rush in where angels fear to tread.
+ -- Alexander Pope
+%
+For gin, in cruel
+Sober truth,
+Supplies the fuel
+For flaming youth.
+ -- Noel Coward
+%
+For God's sake, stop researching for a while and begin to think!
+%
+For good, return good.
+For evil, return justice.
+%
+For I do not do the good I want, but the evil I do not want is what I do.
+ -- Paul of Tarsus, (Saint Paul)
+%
+For I swore I would stay a year away from her; out and alas!
+but with break of day I went to make supplication.
+ -- Paulus Silentarius, c. 540 A.D.
+%
+For knighthood is not in the feats of war,
+As for to fight in quarrel right or wrong,
+But in a cause which truth cannot defer:
+He ought himself for to make sure and strong,
+Just to keep mixt with mercy among:
+And no quarrel a knight ought to take
+But for a truth, or for the common's sake.
+ -- Stephen Hawes
+%
+For large values of one, one equals two, for small values of two.
+%
+For men use, if they have an evil turn, to write it in marble:
+and whoso doth us a good turn we write it in dust.
+ -- Sir Thomas More
+%
+For most men life is a search for the proper manila envelope in which to
+get themselves filed.
+ -- Clifton Fadiman
+%
+For my birthday I got a humidifier and a de-humidifier. I
+put them in the same room and let them fight it out.
+ -- Steven Wright
+%
+For my son, Robert, this is proving to be the high-point of his entire
+life to date. He has had his pajamas on for two, maybe three days
+now. He has the sense of joyful independence a 5-year-old child gets
+when he suddenly realizes that he could be operating an acetylene torch
+in the coat closet and neither parent [because of the flu] would have
+the strength to object. He has been foraging for his own food, which
+means his diet consists entirely of "food" substances which are
+advertised only on Saturday-morning cartoon shows; substances that are
+the color of jukebox lights and that, for legal reasons, have their
+names spelled wrong, as in New Creemy Chok-'n'-Cheez Lumps o' Froot
+("part of this complete breakfast").
+ -- Dave Barry, "Molecular Homicide"
+%
+For myself, I can only say that I am astonished and somewhat terrified at
+the results of this evening's experiments. Astonished at the wonderful
+power you have developed, and terrified at the thought that so much hideous
+and bad music may be put on record forever.
+ -- Sir Arthur Sullivan, message to Edison, 1888
+%
+For people who like that kind of book,
+that is the kind of book they will like.
+%
+For perfect happiness, remember two things:
+ (1) Be content with what you've got.
+ (2) Be sure you've got plenty.
+%
+FOR SALE:
+ Parachute. Used once.
+ Never opened. Slightly Stained.
+%
+For some reason a glaze passes over people's faces when you say
+"Canada". Maybe we should invade South Dakota or something.
+ -- Sandra Gotlieb, wife of the Canadian ambassador to the U.S.
+%
+For some reason, this fortune reminds everyone of Marvin Zelkowitz.
+%
+For that matter, compare your pocket computer with the
+massive jobs of a thousand years ago. Why not, then, the
+last step of doing away with computers altogether?"
+ -- Jehan Shuman
+%
+For the fashion of Minas Tirith was such that it was built on seven levels,
+each delved into a hill, and about each was set a wall, and in each wall
+was a gate.
+ -- J. R. R. Tolkien, "The Return of the King"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to system overview.]
+
+%
+For the first time we have a weapon that nobody has used for thirty years.
+This gives me great hope for the human race.
+ -- Harlan Ellison
+%
+For the next hour, WE will control all that you see and hear.
+%
+For thee the wonder-working earth puts forth sweet flowers.
+ -- Titus Lucretius Carus
+%
+For there are moments when one can neither think nor feel. And if one can
+neither think nor feel, she thought, where is one?
+ -- Virginia Woolf, "To the Lighthouse"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to powerfail recovery.]
+%
+For they starve the frightened little child
+Till it weeps both night and day:
+And they scourge the weak, and flog the fool,
+And gibe the old and grey,
+And some grow mad, and all grow bad,
+And none a word may say.
+
+Each narrow cell in which we dwell
+Is a foul and dark latrine,
+And the fetid breath of living Death
+Chokes up each grated screen,
+And all, but Lust, is turned to dust
+In Humanity's machine.
+
+And all men kill the thing they love,
+By all let this be heard,
+Some do it with a bitter look,
+Some with a flattering word,
+The coward does it with a kiss,
+The brave man with a sword.
+ -- Oscar Wilde
+%
+For thirty years a certain man went to spend every evening with Mme. ___.
+When his wife died his friends believed he would marry her, and urged
+him to do so. "No, no," he said: "if I did, where should I have to
+spend my evenings?"
+ -- Chamfort
+%
+For those of you who have been unfortunate enough to never have tasted the
+'Great Chieftain O' the Pudden Race' (i.e. haggis) here is an easy to follow
+recipe which results in a dish remarkably similar to the above mentioned
+protected species.
+ Ingredients:
+ 1 Sheep's Pluck (heart, lungs, liver) and bag
+ 2 teacupsful toasted oatmeal
+ 1 teaspoonful salt
+ 8 oz. shredded suet
+ 2 small onions
+ 1/2 teaspoonful black pepper
+
+ Scrape and clean bag in cold, then warm, water. Soak in salt water
+overnight. Wash pluck, then boil for 2 hours with windpipe draining over
+the side of pot. Retain 1 pint of stock. Cut off windpipe, remove surplus
+gristle, chop or mince heart and lungs, and grate best part of liver (about
+half only). Parboil and chop onions, mix all together with oatmeal, suet,
+salt, pepper and stock to moisten. Pack the mixture into bag, allowing for
+swelling. Boil for three hours, pricking regularly all over. If bag not
+available, steam in greased basin covered by greaseproof paper and cloth for
+four to five hours.
+%
+For those who like this sort of thing, this is the sort of thing they like.
+ -- Abraham Lincoln
+%
+For three days after death hair and fingernails
+continue to grow, but phone calls taper off.
+ -- Johnny Carson
+%
+For what it's worth, if you -can- get Michelle Pfeiffer to model
+a latex daemon suit for the catalog, I strongly suggest you do.
+Breasts can sell anything. Shiny red latex body suits start
+religions.
+ -- Brian McGroarty <bvmcg@yahoo.com>
+%
+For years a secret shame destroyed my peace --
+I'd not read Eliot, Auden or MacNiece.
+But now I think a thought that brings me hope:
+Neither had Chaucer, Shakespeare, Milton, Pope.
+ -- Justin Richardson
+%
+For your penance, say five Hail Marys and one loud BLAH!
+%
+Force has no place where there is need of skill.
+ -- Herodotus
+%
+"Force is but might," the teacher said--
+"That definition's just."
+The boy said naught but thought instead,
+Remembering his pounded head:
+"Force is not might but must!"
+%
+Force it!!!
+If it breaks, well, it wasn't working anyway...
+No, don't force it, get a bigger hammer.
+%
+FORCE YOURSELF TO RELAX!
+%
+Forecast, n.:
+ A prediction of the future, based on the past, for
+ which the forecaster demands payment in the present.
+%
+Forest fires cause Smokey Bears.
+%
+Forgetfulness, n.:
+ A gift of God bestowed upon debtors in compensation for
+ their destitution of conscience.
+%
+Forgive and forget.
+ -- Cervantes
+%
+Forgive him,
+for he believes that the customs of his tribe are the laws of nature!
+ -- George Bernard Shaw
+%
+Forgive, O Lord, my little jokes on Thee
+And I'll forgive Thy great big one on me.
+ -- Robert Frost
+%
+Forgive your enemies, but don't forget their names.
+ -- John F. Kennedy
+%
+Forms follow function, and often obliterate it.
+%
+Forsan et haec olim meminisse juvabit.
+%
+FORTH IF HONK THEN
+%
+FORTRAN is a good example of a language
+which is easier to parse using ad hoc techniques.
+ -- D. Gries
+ [What's good about it? Ed.]
+%
+FORTRAN is not a flower but a weed -- it is hardy,
+occasionally blooms, and grows in every computer.
+ -- Alan J. Perlis
+%
+FORTRAN is the language of Powerful Computers.
+ -- Steven Feiner
+%
+FORTRAN rots the brain.
+ -- John McQuillin
+%
+FORTRAN, "the infantile disorder", by now nearly 20 years old, is hopelessly
+inadequate for whatever computer application you have in mind today: it is
+too clumsy, too risky, and too expensive to use.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+[FORTRAN] will persist for some time --
+probably for at least the next decade.
+ -- T. Cheatham
+%
+Fortunate is he for whom the belle toils.
+%
+Fortunately, the responsibility for providing evidence is on the part of
+the person making the claim, not the critic. It is not the responsibility
+of UFO skeptics to prove that a UFO has never existed, nor is it the
+responsibility of paranormal-health-claims skeptics to prove that crystals
+or colored lights never healed anyone. The skeptic's role is to point out
+claims that are not adequately supported by acceptable evidence and to
+provide plausible alternative explanations that are more in keeping with
+the accepted body of scientific evidence.
+ -- Thomas L. Creed, The Skeptical Inquirer, Vol. XII,
+ No. 2, pg. 215
+%
+Fortune and love befriend the bold.
+ -- Ovid
+%
+FORTUNE ANSWERS THE TOUGH QUESTIONS: #3
+
+Q: Why haven't you graduated yet?
+A: Well, Dad, I could have finished years ago, but I wanted
+ my dissertation to rhyme.
+%
+FORTUNE ANSWERS THE TOUGH QUESTIONS: #8
+
+Q: Is God a myth?
+A: No, He's a mythter.
+%
+fortune: cannot execute. Out of cookies.
+%
+fortune: cpu time/usefulness ratio too high -- core dumped.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #14
+
+Low Blows:
+ Let's say a man and woman are watching a boxing match on TV. One
+of the boxers is felled by a low blow. The woman says "Oh, gee. That must
+hurt." The man doubles over and actually FEELS the pain.
+
+Dressing Up:
+ A woman will dress up to go shopping, water the plants, empty the
+garbage, answer the phone, read a book, get the mail. A man will dress up
+for: weddings, funerals. Speaking of weddings, when reminiscing about
+weddings, women talk about "the ceremony". Men laugh about "the bachelor
+party".
+
+David Letterman:
+ Men think David Letterman is the funniest man on the face of the
+Earth. Women think he is a mean, semi-dorky guy who always has a bad
+haircut.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #16
+
+Relationships:
+ First of all, a man does not call a relationship a relationship -- he
+refers to it as "that time when me and Suzie were doing it on a semi-regular
+basis".
+ When a relationship ends, a woman will cry and pour her heart out to
+her girlfriends, and she will write a poem titled "All Men Are Idiots". Then
+she will get on with her life.
+ A man has a little more trouble letting go. Six months after the
+breakup, at 3:00 a.m. on a Saturday night, he will call and say, "I just
+wanted to let you know you ruined my life, and I'll never forgive you, and I
+hate you, and you're a total floozy. But I want you to know that there's
+always a chance for us". This is known as the "I Hate You / I Love You"
+drunken phone call, that 99% if all men have made at least once. There are
+community colleges that offer courses to help men get over this need; alas,
+these classes rarely prove effective.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #17
+
+Shoes:
+ The average man has 4 pairs of footwear: running shoes, dress shoes,
+boots, and slippers. The average woman has shoes 4 layers thick on the floor
+of her closet. Most of them hurt her feet.
+
+Making friends:
+ A woman will meet another woman with common interests, do a few things
+together, and say something like, "I hope we can be good friends."
+ A man will meet another man with common interests, do a few things
+together, and say nothing. After years of interacting with this other man,
+sharing hopes and fears that he wouldn't confide in his priest or
+psychiatrist, he'll finally let down his guard in a fit of drunken
+sentimentality and say something like, "You know, for someone who's such a
+jerk, I guess you're OK."
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #2
+
+Desserts:
+ A woman will generally admire an ornate dessert for the artistic
+work it is, praising its creator and waiting a suitable interval before
+she reluctantly takes a small sliver off one edge. A man will start by
+grabbing the cherry in the center.
+
+Car repair:
+ The average man thinks his Y chromosome contains complete repair
+manuals for every car made since World War II. He will work on a problem
+himself until it either goes away or turns into something that "can't be
+fixed without special tools".
+ The average woman thinks "that funny thump-thump noise" is an
+accurate description of an automotive problem. She will, however, have the
+car serviced at the proper intervals and thereby incur fewer problems than
+the average man.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #4
+
+Weddings:
+ When reminiscing about weddings, women talk about "the ceremony".
+Men talk about "the bachelor party".
+
+Clothes:
+ Men don't discard clothes. The average man still has the gym shirt
+he wore in high school. He thinks a jacket is "just getting broken in" about
+the time it develops holes in the elbows. A man will let new shirts sit on
+the shelf in their original packaging for a couple of years before putting
+them to use, hoping they'll become more comfortable with age.
+ Women think clothes are radioactive, with a half-life of one year.
+They exercise precautions to avoid contamination by last year's fashions.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #5
+
+Trust:
+ The average woman would really like to be told if her mate is fooling
+around behind her back. This same woman wouldn't tell her best friend if
+she knew the best friends' mate was having an affair. She'll tell all her
+OTHER friends, however. The average man won't say anything if he knows that
+one of his friend's mates is fooling around, and he'd rather not know if
+his mate is having an affair either, out of fear that it might be with one
+of his friends. He will tell all his friends about his own affairs, though,
+so they can be ready if he needs an alibi.
+
+Driving:
+
+ A typical man thinks he's Mario Andretti as soon as he slips behind
+the wheel of his car. The fact that it's an 8-year-old Honda doesn't keep
+him from trying to out-accelerate the guy in the Porsche who's attempting
+to cut him off; freeway on-ramps are exciting challenges to see who has The
+Right Stuff on the morning commute. Does he or doesn't he? Only his body
+shop knows for sure. Insurance companies understand this behavior, and
+price their policies accordingly.
+ A woman will slow down to let a car merge in front of her, and get
+rear-ended by another woman who was busy adding the finishing touches to
+her makeup.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #6
+
+Bathrooms:
+ A man has six items in his bathroom -- a toothbrush, toothpaste,
+shaving cream, razor, a bar of Dial soap, and a towel from the Holiday Inn.
+The average number of items in the typical woman's bathroom is 437. A man
+would not be able to identify most of these items.
+
+Groceries:
+ A woman makes a list of things she needs and then goes to the store
+and buys these things. A man waits 'til the only items left in his fridge
+are half a lime and a Blue Ribbon. Then he goes grocery shopping. He buys
+everything that looks good. By the time a man reaches the checkout counter,
+his cart is packed tighter that the Clampett's car on Beverly Hillbillies.
+Of course, this will not stop him from entering the 10-items-or-less lane.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #8
+
+Going Out:
+ When a man says he is ready to go out, it means he is ready to go
+out. When a woman says she is ready to go out, it means she WILL be ready
+to go out, as soon as she finds her earring, finishes putting on her makeup,
+checks on the kids, makes a phone call to her best friend...
+
+Cats:
+ Women love cats. Men say they love cats, but when women aren't
+looking, men kick cats.
+
+Offspring:
+ Ah, children. A woman knows all about her children. She knows
+about dentist appointments and soccer games and romances and best friends
+and favorite foods and secret fears and hopes and dreams. Men are vaguely
+aware of some short people living in the house.
+%
+FORTUNE DISCUSSES THE DIFFERENCES BETWEEN MEN AND WOMEN: #9
+
+Laundry:
+ Women do laundry every couple of days. A man will wear every article
+of clothing he owns, including his surgical pants that were hip about eight
+years ago, before he will do his laundry. When he is finally out of clothes,
+he will wear a dirty sweatshirt inside out, rent a U-Haul and take his mountain
+of clothes to the laundromat. Men always expect to meet beautiful women at
+the laundromat. This is a myth.
+
+Nicknames:
+ If Gloria, Suzanne, Deborah and Michelle get together for lunch,
+they will call each other Gloria, Suzanne, Deborah and Michelle. But if
+Mike, Dave, Rob and Jack go out for a brewsky, they will affectionately
+refer to each other as Bullet-Head, Godzilla, Peanut Brain and Useless.
+
+Socks:
+ Men wear sensible socks. They wear standard white sweatsocks.
+Women wear strange socks. They are cut way below the ankles, have pictures
+of clouds on them, and have a big fuzzy ball on the back.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #10
+
+CARTABLANCA:
+ Bogart stars as the owner of a North African nightclub that sells
+ only Mexican beer. Of course, this policy gets him into no end of
+ trouble with the local French authorities who would really prefer
+ wine and the occupying Germans who believe that only their beer is
+ fit to be sold. Wacky events ensue until the gripping climax in
+ which the much-hated German beer distributor is drowned in a vat.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #11
+
+MONOPOLI:
+ Peter Weir's classic film examining the false heroism of parlour
+ games. The powerful ending of the film sees one young man after
+ another charge toward GO, only to senselessly lose his life on the
+ Boardwalk property.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #12
+
+O.E.D.: David Lean, 1969, 3 hours 30 min.
+
+ Lean's version of the Oxford Dictionary has been accused of
+ shallowness in its treatment of a complete work. Omar Sharif
+ tends to overact as aardvark, but Alec Guinness is solid in
+ the role of abbacy. As usual, the photography is stunning.
+ With Julie Christie.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #3
+
+MIRACLE ON 42ND STREET:
+ Santa Claus, in the off season, follows his heart's desire and
+ tries to make it big on Broadway. Santa sings and dances his way
+ into your heart.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #4
+
+WITLESS:
+ Peter Weir directs Sylvester Stallone in the most challenging role
+ of his career. Stallone plays a Philadelphia police officer on the
+ run from corrupt officials. He is wounded and then nursed back to
+ health by Amish Mennonites. Fearful that they might unwittingly
+ reveal his hiding place, he blows them all away.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #5
+
+THE ATOMIC GRANDMOTHER:
+ This humorous but heart-warming story tells of an elderly woman
+ forced to work at a nuclear power plant in order to help the family
+ make ends meet. At night, granny sits on the porch, tells tales
+ of her colorful past, and the family uses her to cook barbecues
+ and to power small electrical appliances. Maureen Stapleton gives
+ a glowing performance.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #6
+
+RAZORBACK: Paul Harbride, 1984, 2 hours 25 min.
+ One of the great Australian films of the early 1980's,
+ and arguably the best movie ever made about a large,
+ man-eating hog. Some violence. With Gregory Harrison.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #7
+
+OUT OF "OUT OF AFRICA":
+ This film is a compilation of selected news clips depicting audiences
+ frantically pushing and shoving to get out of theatres where "Out of
+ Africa" is showing. Many people are trampled to death in the frenzy.
+ Due to its violence and offensive language, not recommended for
+ younger viewers.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #8
+
+THE SMURFS AND THE CUISINART (1986)
+ The lovable little blue Smurfs encounter a lovable little kitchen
+ appliance, which invites them to play. The Smurfs learn a valuable
+ (if sometimes fatal) lesson.
+
+THE SMURFS AND THE CARBON-DIOXIDE INDUSTRIAL LASER (1987)
+ The inevitable sequel. The lovable and somewhat mangled surviving
+ Smurfs team up with the Care Bears to encounter a cute, lovable piece
+ of high-tech welding equipment, which teaches them the magic of
+ becoming rather greasy smoke. Heartwarming fun for the entire family.
+%
+FORTUNE DISCUSSES THE OBSCURE FILMS: #9
+
+THE PARKING PROBLEM IN PARIS: Jean-Luc Godard, 1971, 7 hours 18 min.
+
+ Godard's meditation on the topic has been described as
+ everything from "timeless" to "endless." (Remade by Gene
+ Wilder as NO PLACE TO PARK.)
+%
+Fortune Documents the Great Legal Decisions:
+
+It is a rule of evidence deduced from the experience of mankind and
+supported by reason and authority that positive testimony is entitled to
+more weight than negative testimony, but by the latter term is meant
+negative testimony in its true sense and not positive evidence of a
+negative, because testimony in support of a negative may be as positive
+as that in support of an affirmative.
+ -- 254 Pac. Rep. 472
+%
+Fortune Documents the Great Legal Decisions:
+
+We can imagine no reason why, with ordinary care, human toes could not be
+left out of chewing tobacco, and if toes are found in chewing tobacco, it
+seems to us that someone has been very careless.
+ -- 78 So. 365
+%
+Fortune Documents the Great Legal Decisions:
+
+We think that we may take judicial notice of the fact that the term "bitch"
+may imply some feeling of endearment when applied to a female of the canine
+species but that it is seldom, if ever, so used when applied to a female
+of the human race. Coming as it did, reasonably close on the heels of two
+revolver shots directed at the person of whom it was probably used, we think
+it carries every reasonable implication of ill-will toward that person.
+ -- Smith v. Moran, 193 N.E. 2d 466
+%
+FORTUNE EXPLAINS WHAT JOB REVIEW CATCH PHRASES MEAN: #1
+
+Skilled oral communicator:
+ Mumbles inaudibly when attempting to speak. Talks to self.
+ Argues with self. Loses these arguments.
+
+Skilled written communicator:
+ Scribbles well. Memos are invariable illegible, except for
+ the portions that attribute recent failures to someone else.
+
+Growth potential:
+ With proper guidance, periodic counseling, and remedial training,
+ the reviewee may, given enough time and close supervision, meet
+ the minimum requirements expected of him by the company.
+
+Key company figure:
+ Serves as the perfect counter example.
+%
+FORTUNE EXPLAINS WHAT JOB REVIEW CATCH PHRASES MEAN: #4
+
+Consistent:
+ Reviewee hasn't gotten anything right yet, and it is anticipated
+ that this pattern will continue throughout the coming year.
+
+An excellent sounding board:
+ Present reviewee with any number of alternatives, and implement
+ them in the order precisely opposite of his/her specification.
+
+A planner and organizer:
+ Usually manages to put on socks before shoes. Can match the
+ animal tags on his clothing.
+%
+FORTUNE EXPLAINS WHAT JOB REVIEW CATCH PHRASES MEAN: #9
+
+Has management potential:
+ Because of his intimate relationship with inanimate objects, the
+ reviewee has been appointed to the critical position of department
+ pencil monitor.
+
+Inspirational:
+ A true inspiration to others. ("There, but for the grace of God,
+ go I.")
+
+Adapts to stress:
+ Passes wind, water, or out depending upon the severity of the
+ situation.
+
+Goal oriented:
+ Continually sets low goals for himself, and usually fails
+ to meet them.
+%
+Fortune favors the lucky.
+%
+Fortune finishes the great quotations, #12
+
+ Those who can, do. Those who can't, write the instructions.
+%
+Fortune finishes the great quotations, #15
+
+ "Give me your tired, your poor, your huddled masses."
+ And while you're at it, throw in a couple of those Dallas
+ Cowboy cheerleaders.
+%
+Fortune finishes the great quotations, #17
+
+ "This bud of love, by summer's ripening breath,
+ May prove a beauteous flower when next we meet."
+ Juliet, this bud's for you.
+%
+Fortune finishes the great quotations, #2
+
+ If at first you don't succeed, think how many people
+ you've made happy.
+%
+Fortune finishes the great quotations, #21
+
+ Shall I compare thee to a Summer day?
+ No, I guess not.
+%
+Fortune finishes the great quotations, #3
+
+ Birds of a feather flock to a newly washed car.
+%
+Fortune finishes the great quotations, #6
+
+ "But, soft! What light through yonder window breaks?"
+ It's nothing, honey. Go back to sleep.
+%
+Fortune finishes the great quotations, #9
+
+ A word to the wise is often enough to start an argument.
+%
+fortune: No such file or directory
+%
+fortune: not found
+%
+Fortune presents:
+ USEFUL PHRASES IN ESPERANTO, #1.
+
+^Cu vi parolas angle? Do you speak English?
+Mi ne komprenas. I don't understand.
+Vi estas la sola esperantisto kiun mi You're the only Esperanto speaker
+ renkontas. I've met.
+La ^ceko estas enpo^stigita. The check is in the mail.
+Oni ne povas, ^gin netrovi. You can't miss it.
+Mi nur rigardadas. I'm just looking around.
+Nu, ^sajnis bona ideo. Well, it seemed like a good idea.
+%
+Fortune presents:
+ USEFUL PHRASES IN ESPERANTO, #2.
+
+^Cu tiu loko estas okupita? Is this seat taken?
+^Cu vi ofte venas ^ci-tien? Do you come here often?
+^Cu mi povas havi via telelonnumeron? May I have your phone number?
+Mi estas komputilisto. I work with computers.
+Mi legas multe da scienca fikcio. I read a lot of science fiction.
+^Cu necesas ke vi eliras? Do you really have to be going?
+%
+Fortune presents:
+ USEFUL PHRASES IN ESPERANTO, #5.
+
+Mi ^cevalovipus vin se mi havus I'd horsewhip you if I had a horse.
+ ^cevalon.
+Vere vi ^sercas. You must be kidding.
+Nu, parDOOOOOnu min! Well exCUUUUUSE me!
+Kiu invitis vin? Who invited you?
+Kion vi diris pri mia patrino? What did you say about my mother?
+Bu^so^stopu min per kulero. Gag me with a spoon.
+%
+FORTUNE PRESENTS FAMOUS LAST WORDS: #4
+
+Socrates: I DRANK WHAT!?!?
+Tarzan: Who greased the grape viiiiiiiiiiiinnnneee........
+Al Capone: There's a violin in my violin case!
+Pilot, TWA Fl. #343: What's a mountain goat doing 'way up here?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #13
+
+A: Doc, Happy, Bashful, Dopey, Sneezy, Sleepy, & Grumpy
+Q: Who were the Democratic presidential candidates?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #15
+
+A: The Royal Canadian Mounted Police.
+Q: What was the greatest achievement in taxidermy?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #19
+
+A: To be or not to be.
+Q: What is the square root of 4b^2?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #21
+
+A: Dr. Livingston I. Presume.
+Q: What's Dr. Presume's full name?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #31
+
+A: Chicken Teriyaki.
+Q: What is the name of the world's oldest kamikaze pilot?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #4
+
+A: Go west, young man, go west!
+Q: What do wabbits do when they get tiwed of wunning awound?
+%
+FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #5
+
+A: The Halls of Montezuma and the Shores of Tripoli.
+Q: Name two families whose kids won't join the Marines.
+%
+FORTUNE REMEMBERS THE GREAT MOTHERS: #5
+
+ "And, and, and, and, but, but, but, but!"
+ -- Mrs. Janice Markowsky, April 8, 1965
+%
+FORTUNE REMEMBERS THE GREAT MOTHERS: #6
+
+ "Johnny, if you fall and break your leg, don't come running to me!"
+ -- Mrs. Emily Barstow, June 16, 1954
+%
+Fortune suggests uses for YOUR favorite UNIX commands!
+
+Try:
+ ar t "God"
+ drink < bottle; opener (Bourne Shell)
+ cat "food in tin cans" (all but 4.[23]BSD)
+ Hey UNIX! Got a match? (V6 or C shell)
+ mkdir matter; cat > matter (Bourne Shell)
+ rm God
+ man: Why did you get a divorce? (C shell)
+ date me (anything up to 4.3BSD)
+ make "heads or tails of all this"
+ who is smart
+ (C shell)
+ If I had a ) for every dollar of the national debt, what would I have?
+ sleep with me (anything up to 4.3BSD)
+%
+Fortune: You will be attacked next Wednesday at 3:15 p.m. by six samurai
+sword wielding purple fish glued to Harley-Davidson motorcycles.
+
+Oh, and have a nice day!
+ -- Bryce Nesbitt '84
+%
+Fortune's Contribution of the Month to the Animal Rights Debate:
+
+ I'll stay out of animals' way if they'll stay out of mine.
+ "Hey you, get off my plate"
+ -- Roger Midnight
+%
+Fortune's current rates:
+
+ Answers .10
+ Long answers .25
+ Answers requiring thought .50
+ Correct answers $1.00
+
+ Dumb looks are still free.
+%
+Fortune's diet truths:
+1: Forget what the cookbooks say, plain yogurt tastes nothing like sour cream.
+2: Any recipe calling for soybeans tastes like mud.
+3: Carob is not an acceptable substitute for chocolate. In fact, carob is not
+ an acceptable substitute for anything, except, perhaps, brown shoe polish.
+4: There is no such thing as a "fun salad." So let's stop pretending and see
+ salads for what they are: God's punishment for being fat.
+5: Fruit salad without maraschino cherries and marshmallows is about as
+ appealing as tepid beer.
+6: A world lacking gravy is a tragic place!
+7: You should immediately pass up any recipes entitled "luscious and
+ low-cal." Also skip dishes featuring "lively liver." They aren't and
+ it isn't.
+8: Wearing a blindfold often makes many diet foods more palatable.
+9: Fresh fruit is not dessert. CAKE is dessert!
+10: Okra tastes slightly worse than its name implies.
+11: A plain baked potato isn't worth the effort involved in chewing and
+ swallowing.
+%
+Fortune's Exercising Truths:
+
+1: Richard Simmons gets paid to exercise like a lunatic. You don't.
+2. Aerobic exercises stimulate and speed up the heart. So do heart attacks.
+3. Exercising around small children can scar them emotionally for life.
+4. Sweating like a pig and gasping for breath is not refreshing.
+5. No matter what anyone tells you, isometric exercises cannot be done
+ quietly at your desk at work. People will suspect manic tendencies as
+ you twitter around in your chair.
+6. Next to burying bones, the thing a dog enjoys most is tripping joggers.
+7. Locking four people in a tiny, cement-walled room so they can run around
+ for an hour smashing a little rubber ball -- and each other -- with a hard
+ racket should immediately be recognized for what it is: a form of insanity.
+8. Fifty push-ups, followed by thirty sit-ups, followed by ten chin-ups,
+ followed by one throw-up.
+9. Any activity that can't be done while smoking should be avoided.
+%
+FORTUNE'S FAVORITE RECIPES: #8
+ Christmas Rum Cake
+
+1 or 2 quarts rum 1 tbsp. baking powder
+1 cup butter 1 tsp. soda
+1 tsp. sugar 1 tbsp. lemon juice
+2 large eggs 2 cups brown sugar
+2 cups dried assorted fruit 3 cups chopped English walnuts
+
+Before you start, sample the rum to check for quality. Good, isn't it? Now
+select a large mixing bowl, measuring cup, etc. Check the rum again. It
+must be just right. Be sure the rum is of the highest quality. Pour one cup
+of rum into a glass and drink it as fast as you can. Repeat. With an electric
+mixer, beat one cup butter in a large fluffy bowl. Add 1 seaspoon of tugar
+and beat again. Meanwhile, make sure the rum teh absolutely highest quality.
+Sample another cup. Open second quart as necessary. Add 2 orge laggs, 2 cups
+of fried druit and beat untill high. If the fried druit gets stuck in the
+beaters, just pry it loose with a screwdriver. Sample the rum again, checking
+for toncisticity. Next sift 3 cups of baking powder, a pinch of rum, a
+seaspoon of toda and a cup of pepper or salt (it really doesn't matter).
+Sample some more. Sift 912 pint of lemon juice. Fold in schopped butter and
+strained chups. Add bablespoon of brown gugar, or whatever color you have.
+Mix mell. Grease oven and turn cake pan to 350 gredees and rake until
+poothtick comes out crean.
+%
+Fortune's Fictitious Country Song Title of the Week:
+ "How Can I Miss You if You Won't Go Away?"
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #1
+ A guinea pig is not from Guinea but a rodent from South America.
+ A firefly is not a fly, but a beetle.
+ A giant panda bear is really a member of the raccoon family.
+ A black panther is really a leopard that has a solid black coat
+ rather than a spotted one.
+ Peanuts are not really nuts. The majority of nuts grow on trees
+ while peanuts grow underground. They are classified as a
+ legume-part of the pea family.
+ A cucumber is not a vegetable but a fruit.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #14
+ The Baby Ruth candy bar was not named after George Herman "The Babe"
+Ruth, but after the oldest daughter of President Grover Cleveland.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #37
+ Can you name the seven seas?
+ Antarctic, Arctic, North Atlantic, South Atlantic, Indian,
+ North Pacific, South Pacific.
+ Can you name the seven dwarfs from Snow White?
+ Doc, Dopey, Sneezy, Happy, Grumpy, Sleepy and Bashful.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #44
+ Zebra's are colored with dark stripes on a light background.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #108
+
+In Memphis, Tennessee, it is illegal for a woman to drive a car unless
+there is a man either running or walking in front of it waving a red
+flag to warn approaching motorists and pedestrians.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #14
+ According to Kentucky state law, every person must take a bath
+at least once a year.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #16
+
+The Arkansas legislature passed a law that states that the Arkansas River
+can rise no higher than to the Main Street bridge in Little Rock.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #19
+ A Los Angeles judge ruled that "a citizen may snore with immunity in
+his own home, even though he may be in possession of unusual and exceptional
+ability in that particular field."
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #1
+
+In Blythe, California, a city ordinance declares that a person must own
+at least two cows before he can wear cowboy boots in public.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #2
+ Horses are forbidden to eat fire hydrants in Marshalltown, Iowa.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #3
+ A New York City judge ruled that if two women behind you at the
+movies insist on discussing the probable outcome of the film, you have the
+right to turn around and blow a Bronx cheer at them.
+%
+FORTUNE'S FUN FACTS TO KNOW AND TELL: #8
+
+ Idaho state law makes it illegal for a man to give his sweetheart
+a box of candy weighing less than fifty pounds.
+%
+Fortune's graffito of the week (or maybe even month):
+
+ Don't Write On Walls!
+
+ (and underneath)
+
+ You want I should type?
+%
+Fortune's Great Moments in History: #3
+
+August 27, 1949:
+ A Hall of Fame opened to honor outstanding members of the
+ Women's Air Corp. It was a WAC's Museum.
+%
+FORTUNE'S GUIDE TO DEALING WITH REAL-LIFE SCIENCE FICTION: #14
+What to do...
+ if reality disappears?
+ Hope this one doesn't happen to you. There isn't much that you
+ can do about it. It will probably be quite unpleasant.
+
+ if you meet an older version of yourself who has invented a time
+ traveling machine, and has come from the future to meet you?
+ Play this one by the book. Ask about the stock market and cash in.
+ Don't forget to invent a time traveling machine and visit your
+ younger self before you die, or you will create a paradox. If you
+ expect this to be tricky, make sure to ask for the principles
+ behind time travel, and possibly schematics. Never, NEVER, ask
+ when you'll die, or if you'll marry your current SO.
+%
+FORTUNE'S GUIDE TO DEALING WITH REAL-LIFE SCIENCE FICTION: #2
+What to do...
+ if you get a phone call from Mars:
+ Speak slowly and be sure to enunciate your words properly. Limit
+ your vocabulary to simple words. Try to determine if you are
+ speaking to someone in a leadership capacity, or an ordinary citizen.
+
+ if he, she or it doesn't speak English?
+ Hang up. There's no sense in trying to learn Martian over the phone.
+ If your Martian really had something important to say to you, he, she
+ or it would have taken the trouble to learn the language before
+ calling.
+
+ if you get a phone call from Jupiter?
+ Explain to your caller, politely but firmly, that being from Jupiter,
+ he, she or it is not "life as we know it". Try to terminate the
+ conversation as soon as possible. It will not profit you, and the
+ charges may have been reversed.
+%
+FORTUNE'S GUIDE TO DEALING WITH REAL-LIFE SCIENCE FICTION: #6
+What to do...
+ if a starship, equipped with an FTL hyperdrive lands in your backyard?
+ First of all, do not run after your camera. You will not have any
+ film, and, given the state of computer animation, noone will believe
+ you anyway. Be polite. Remember, if they have an FTL hyperdrive,
+ they can probably vaporize you, should they find you to be rude.
+ Direct them to the White House lawn, which is where they probably
+ wanted to land, anyway. A good road map should help.
+
+ if you wake up in the middle of the night, and discover that your
+ closet contains an alternate dimension?
+ Don't walk in. You almost certainly will not be able to get back,
+ and alternate dimensions are almost never any fun. Remain calm
+ and go back to bed. Close the door first, so that the cat does not
+ wander off. Check your closet in the morning. If it still contains
+ an alternate dimension, nail it shut.
+%
+Fortune's Guide to Freshman Notetaking:
+
+WHEN THE PROFESSOR SAYS: YOU WRITE:
+
+Probably the greatest quality of the poetry John Milton -- born 1608
+of John Milton, who was born in 1608, is the
+combination of beauty and power. Few have
+excelled him in the use of the English language,
+or for that matter, in lucidity of verse form,
+'Paradise Lost' being said to be the greatest
+single poem ever written."
+
+Current historians have come to Most of the problems that now
+doubt the complete advantageousness face the United States are
+of some of Roosevelt's policies... directly traceable to the
+ bungling and greed of President
+ Roosevelt.
+
+... it is possible that we simply do Professor Mitchell is a
+not understand the Russian viewpoint... communist.
+%
+Fortune's Law of the Week (this week, from Kentucky):
+ No female shall appear in a bathing suit at any airport in this
+State unless she is escorted by two officers or unless she is armed
+with a club. The provisions of this statute shall not apply to females
+weighing less than 90 pounds nor exceeding 200 pounds, nor shall it
+apply to female horses.
+%
+Fortune's nomination for All-Time Champion and Protector of Youthful Morals
+goes to Representative Clare E. Hoffman of Michigan. During an impassioned
+House debate over a proposed bill to "expand oyster and clam research," a
+sharp-eared informant transcribed the following exchange between our hero
+and Rep. John D. Dingell, also of Michigan.
+
+Dingell: "There are places in the world at the present time where we are
+ having to artificially propagate oysters and clams."
+Hoffman: "You mean the oysters I buy are not nature's oysters?"
+Dingell: "They may or may not be natural. The simple fact of the matter is
+ that female oysters through their living habits cast out large
+ amounts of seed and the male oysters cast out large amounts of
+ fertilization."
+Hoffman: "Wait a minute! I do not want to go into that. There are many
+ teenagers who read The Congressional Record."
+%
+Fortune's Office Door Sign of the Week:
+
+ Incorrigible punster -- Do not incorrige.
+%
+FORTUNE'S PARTY TIPS: #14
+
+ Tired of finding that other people are helping themselves to
+your good liquor at BYOB parties? Take along a candle, which you insert
+and light after you've opened the bottle. No one ever expects anything
+drinkable to be in a bottle which has a candle stuck in its neck.
+%
+Fortune's Real-Life Courtroom Quote #18:
+
+Q: Are you married?
+A: No, I'm divorced.
+Q: And what did your husband do before you divorced him?
+A: A lot of things I didn't know about.
+%
+Fortune's Real-Life Courtroom Quote #19:
+
+Q: Doctor, how many autopsies have you performed on dead people?
+A: All my autopsies have been performed on dead people.
+%
+Fortune's Real-Life Courtroom Quote #29:
+
+THE JUDGE: Now, as we begin, I must ask you to banish all present
+ information and prejudice from your minds, if you have
+ any ...
+%
+Fortune's Real-Life Courtroom Quote #32:
+
+Q: Do you know how far pregnant you are right now?
+A: I will be three months November 8th.
+Q: Apparently then, the date of conception was August 8th?
+A: Yes.
+Q: What were you and your husband doing at that time?
+%
+Fortune's Real-Life Courtroom Quote #37:
+
+Q: Did he pick the dog up by the ears?
+A: No.
+Q: What was he doing with the dog's ears?
+A: Picking them up in the air.
+Q: Where was the dog at this time?
+A: Attached to the ears.
+%
+Fortune's Real-Life Courtroom Quote #3:
+
+Q: When he went, had you gone and had she, if she wanted to and were
+ able, for the time being excluding all the restraints on her not to
+ go, gone also, would he have brought you, meaning you and she, with
+ him to the station?
+MR. BROOKS: Objection. That question should be taken out and shot.
+%
+Fortune's Real-Life Courtroom Quote #41:
+
+Q: Now, Mrs. Johnson, how was your first marriage terminated?
+A: By death.
+Q: And by whose death was it terminated?
+%
+Fortune's Real-Life Courtroom Quote #52:
+
+Q: What is your name?
+A: Ernestine McDowell.
+Q: And what is your marital status?
+A: Fair.
+%
+Fortune's Real-Life Courtroom Quote #7:
+
+Q: What happened then?
+A: He told me, he says, "I have to kill you because you can identify
+ me."
+Q: Did he kill you?
+A: No.
+%
+Fortune's Rules for Memo Wars: #2
+
+Given the incredible advances in sociocybernetics and telepsychology over
+the last few years, we are now able to completely understand everything that
+the author of a memo is trying to say. Thanks to modern developments
+in electrocommunications like notes, vnews, and electricity, we have an
+incredible level of interunderstanding the likes of which civilization has
+never known. Thus, the possibility of your misinterpreting someone else's
+memo is practically nil. Knowing this, anyone who accuses you of having
+done so is a liar, and should be treated accordingly. If you *do* understand
+the memo in question, but have absolutely nothing of substance to say, then
+you have an excellent opportunity for a vicious ad hominem attack. In fact,
+the only *inappropriate* times for an ad hominem attack are as follows:
+
+ 1: When you agree completely with the author of a memo.
+ 2: When the author of the original memo is much bigger than you are.
+ 3: When replying to one of your own memos.
+%
+FORTUNE'S RULES TO LIVE BY: #2
+
+ Never goose a wolverine.
+%
+FORTUNE'S RULES TO LIVE BY: #23
+
+ Don't cut off a police car when making an illegal U-turn.
+%
+Forty isn't old, if you're a tree.
+%
+Four be the things I am wiser to know:
+ Idleness, sorrow, a friend, and a foe.
+
+Four be the things I'd been better without:
+ Love, curiosity, freckles, and doubt.
+
+Three be the things I shall never attain:
+ Envy, content, and sufficient champagne.
+
+Three be the things I shall have till I die:
+ Laughter and hope and a sock in the eye.
+ -- Dorothy Parker, "Inventory"
+%
+Four fifths of the perjury in the world is expended on
+tombstones, women and competitors.
+ -- Lord Thomas Robert Dewar
+%
+Four hours to bury the cat?
+Yes, damn thing wouldn't keep still, kept mucking about, 'owling...
+%
+Fourteen years in the professor dodge has taught me that one can argue
+ingeniously on behalf of any theory, applied to any piece of literature.
+This is rarely harmful, because normally no-one reads such essays.
+ -- Robert Parker, quoted in "Murder Ink", ed. D. Wynn
+%
+Fourth Law of Applied Terror:
+ The night before the English History mid-term, your Biology
+ instructor will assign 200 pages on planaria.
+
+Corollary:
+ Every instructor assumes that you have nothing else to do except
+ study for that instructor's course.
+%
+Fourth Law of Revision:
+ It is usually impractical to worry beforehand about
+ interferences -- if you have none, someone will make one
+ for you.
+%
+Fourth Law of Thermodynamics: If the probability of success is not
+almost one, it is damn near zero.
+ -- David Ellis
+%
+Frankfort, Kentucky, makes it against the law to shoot off a
+policeman's tie.
+%
+Frankly, Scarlett, I don't have a fix.
+ -- Rhett Buggler
+%
+Fraud is the homage that force pays to reason.
+ -- Charles Curtis, "A Commonplace Book"
+%
+Free Speech Is The Right To Shout "Theater" In A Crowded Fire.
+ -- A Yippie proverb
+%
+FreeBSD: everything but the fairings
+%
+FreeBSD: Have you had your fairings today?
+%
+FreeBSD: It's 3am at night. Do you know where your fairings are?
+%
+FreeBSD: putting the horse before the cart since 1992.
+ -- Warner Losh
+%
+FreeBSD Trivia:
+ Did you know that successive security officers take
+control by beheading their predecessor?
+ -- Robert Watson
+%
+Freedom begins when you tell Mrs. Grundy to go fly a kite.
+%
+Freedom from incrustation of grime is contiguous to rectitude.
+%
+Freedom is nothing else but the chance to do better.
+ -- Camus
+%
+Freedom is slavery.
+Ignorance is strength.
+War is peace.
+ -- George Orwell
+%
+Freedom of the press is for those who happen to own one.
+%
+Freedom's just another word for nothing left to lose.
+ -- Kris Kristofferson, "Me and Bobby McGee"
+%
+Fremen add life to spice!
+%
+Fresco's Discovery:
+ If you knew what you were doing you'd probably be bored.
+%
+Friction is a drag.
+%
+Fried's 1st Rule:
+ Increased automation of clerical function
+ invariably results in increased operational costs.
+%
+Friends may come and go, but enemies accumulate.
+ -- Thomas Jones
+%
+Friends, n.:
+ People who borrow your books and set wet glasses on them.
+
+ People who know you well, but like you anyway.
+%
+Friends, Romans, Hipsters,
+Let me clue you in;
+I come to put down Caesar, not to groove him.
+The square kicks some cats are on stay with them;
+The hip bits, like, go down under; so let it lay with Caesar. The cool Brutus
+Gave you the message: Caesar had big eyes;
+If that's the sound, someone's copping a plea,
+And, like, old Caesar really set them straight.
+Here, copacetic with Brutus and the studs, -- for Brutus is a real cool cat;
+So are they all, all cool cats, --
+Come I to make this gig at Caesar's laying down.
+%
+Friendships last when each friend thinks he has a slight superiority
+over the other.
+ -- Honore de Balzac
+%
+Frisbeetarianism, n.:
+ The belief that when you die, your soul goes up on the roof and
+ gets stuck.
+%
+Frobnicate, v.:
+ To manipulate or adjust, to tweak. Derived from FROBNITZ.
+Usually abbreviated to FROB. Thus one has the saying "to frob a
+frob". See TWEAK and TWIDDLE. Usage: FROB, TWIDDLE, and TWEAK
+sometimes connote points along a continuum. FROB connotes aimless
+manipulation; TWIDDLE connotes gross manipulation, often a coarse
+search for a proper setting; TWEAK connotes fine-tuning. If someone is
+turning a knob on an oscilloscope, then if he's carefully adjusting it
+he is probably tweaking it; if he is just turning it but looking at the
+screen he is probably twiddling it; but if he's just doing it because
+turning a knob is fun, he's frobbing it.
+%
+Frobnitz, pl. Frobnitzem (frob'nitsm) n.:
+ An unspecified physical object, a widget. Also refers to
+electronic black boxes. This rare form is usually abbreviated to
+FROTZ, or more commonly to FROB. Also used are FROBNULE, FROBULE, and
+FROBNODULE. Starting perhaps in 1979, FROBBOZ (fruh-bahz'), pl.
+FROBBOTZIM, has also become very popular, largely due to its exposure
+via the Adventure spin-off called Zork (Dungeon). These can also be
+applied to non-physical objects, such as data structures.
+%
+From 0 to "what seems to be the problem officer" in 8.3 seconds.
+ -- Ad for the new VW Corrado
+%
+From a certain point onward there is no longer any turning back.
+That is the point that must be reached.
+ -- F. Kafka
+%
+From a Tru64 patch description:
+
+ Fixes a bug that causes a panic due to software error
+%
+[From an announcement of a congress of the International Ontopsychology
+Association, in Rome]:
+
+The Ontopsychological school, availing itself of new research criteria
+and of a new telematic epistemology, maintains that social modes do not
+spring from dialectics of territory or of class, or of consumer goods,
+or of means of power, but rather from dynamic latencies capillarized in
+millions of individuals in system functions which, once they have
+reached the event maturation, burst forth in catastrophic phenomenology
+engaging a suitable stereotype protagonist or duty marionette (general,
+president, political party, etc.) to consummate the act of social
+schizophrenia in mass genocide.
+%
+From Italian tourist guide:
+
+ "Non stop trains to Roma Termini Station leave from 7.38
+ a.m. to 10.08 p.m., hourly."
+%
+From listening comes wisdom and from speaking repentance.
+%
+From the cradle to the coffin underwear comes first.
+ -- Bertolt Brecht
+%
+From the crystal swirling waters,
+Of the Rio Amazon,
+To the sacred halls of Bayonne,
+Where we stand pajamas on. (It's the only thing that rhymes.)
+From ev'ry hallowed venue,
+Ev'ry forest, mount and vale,
+Your butt is on the menu
+And the check is in the mail.
+ -- The Piranha Club Anthem, to the tune of "De Camptown Races"
+%
+From the moment I picked your book up until I put it down I was
+convulsed with laughter. Some day I intend reading it.
+ -- Groucho Marx, from "The Book of Insults"
+%
+[From the operation manual for the CI-300 Dot Matrix Line Printer, made
+in Japan]:
+
+The excellent output machine of MODEL CI-300 as extraordinary DOT
+MATRIX LINE PRINTER, built in two MICRO-PROCESSORs as well as EAROM, is
+featured by permitting wonderful co-existence such as; "high quality
+against low cost", "diversified functions with compact design",
+"flexibility in accessibleness and durability of approx. 2000,000,00
+Dot/Head", "being sophisticated in mechanism but possibly agile
+operating under noises being extremely suppressed" etc.
+
+And as a matter of course, the final goal is just simply to help
+achieve "super shuttle diplomacy" between cool data, perhaps earned by
+HOST COMPUTER, and warm heart of human being.
+%
+From the pages of Open Systems Today - October 13, 1994 ..........
+
+ "The International Standards Organization (ISO) and the
+ International Electrotechnical Commission (IEC) designated
+ October 14 as World Standards Day to recognize those
+ volunteers who have worked hard to define international
+ standards.......The United States celebrated World Standards
+ Day on October 11; Finland celebrated on October 13; and
+ Italy celebrated on October 18."
+%
+From the Pointless Comparison Collection:
+
+ To give you an idea of how sensitive these antennas are,
+ if we were to "listen" to one spacecraft in the outer solar
+ system by Jupiter or Saturn for 1 billion years and add up
+ all the signal we collected, it would be enough power to
+ set off the flash bulb on your camera once.
+
+ -- Peter Doms, manager of the Deep Space Network
+ systems program at JPL
+%
+From the Pro 350 Pocket Service Guide, p. 49, Step 5 of the
+instructions on removing an I/O board from the card cage, comes a new
+experience in sound:
+
+ 5. Turn the handle to the right 90 degrees. The pin-spreading
+ sound is normal for this type of connector.
+%
+From too much love of living,
+From hope and fear set free,
+We thank with brief thanksgiving,
+Whatever gods may be,
+That no life lives forever,
+That dead men rise up never,
+That even the weariest river winds somewhere safe to sea.
+ -- Swinburne
+%
+Fuch's Warning:
+ If you actually look like your passport photo, you aren't well
+ enough to travel.
+%
+Fudd's First Law of Opposition:
+ Push something hard enough and it will fall over.
+%
+Fun experiments:
+ Get a can of shaving cream, throw it in a freezer for about a week.
+ Then take it out, peel the metal off and put it where you want...
+ bedroom, car, etc. As it thaws, it expands an unbelievable amount.
+%
+Fun Facts, #14:
+ In table tennis, whoever gets 21 points first wins. That's how
+ it once was in baseball -- whoever got 21 runs first won.
+%
+Fun Facts, #63:
+ The name California was given to the state by Spanish conquistadores.
+ It was the name of an imaginary island, a paradise on earth, in the
+ Spanish romance, "Les Serges de Esplandian", written by Montalvo in
+ 1510.
+%
+Function reject.
+%
+Fundamentally, there may be no basis for anything.
+%
+Furbling, v.:
+ Having to wander through a maze of ropes at an airport or bank
+ even when you are the only person in line.
+ -- Rich Hall, "Sniglets"
+%
+Furious activity is no substitute for understanding.
+ -- H. H. Williams
+%
+Furthermore, if we send something by car, it's a shipment...
+but if we send it by ship, it's cargo.
+%
+Future looks spotty. You will spill soup in late evening.
+%
+Future will arrive by its own means. Progress not so.
+ -- Poul Henningsen (1894-1967)
+%
+G. B. Shaw to William Douglas Home: "Go on writing plays, my boy. One
+of these days a London producer will go into his office and say to his
+secretary, `Is there a play from Shaw this morning?' and when she says
+`No,' he will say, `Well, then we'll have to start on the rubbish.' And
+that's your chance, my boy."
+%
+Gaiety is the most outstanding feature of the Soviet Union.
+ -- Joseph Stalin
+%
+Galbraith's Law of Human Nature:
+ Faced with the choice between changing one's mind and proving that
+ there is no need to do so, almost everybody gets busy on the proof.
+%
+Garbage In - Gospel Out.
+%
+Garter, n.:
+ An elastic band intended to keep a woman from coming out of her
+ stockings and desolating the country.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Gauls! We have nothing to fear; except perhaps that the sky may fall on
+our heads tomorrow. But as we all know, tomorrow never comes!!
+ -- Adventures of Asterix
+%
+Gay shlafen: Yiddish for "go to sleep".
+
+ Now doesn't "gay shlafen" have a softer, more soothing sound
+than the harsh, staccato "go to sleep"? Listen to the difference:
+ "Go to sleep, you little wretch!" ... "Gay shlafen, darling."
+Obvious, isn't it?
+ Clearly the best thing you can do for you children is to start
+speaking Yiddish right now and never speak another word of English as
+long as you live. This will, of course, entail teaching Yiddish to all
+your friends, business associates, the people at the supermarket, and
+so on, but that's just the point. It has to start with committed
+individuals and then grow ...
+ Some minor adjustments will have to be made, of course: those
+signs written in what look like Yiddish letters won't be funny when
+everything is written in Yiddish. And we'll have to start driving on
+the left side of the road so we won't be reading the street signs
+backwards. But is that too high a price to pay for world peace? I
+think not, my friend, I think not.
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+GEMINI (May 21 - June 20)
+ A day to take the initiative. Put the garbage out, for
+ instance, and pick up the stuff at the dry cleaners. Watch
+ the mail carefully, although there won't be anything good
+ in it today, either.
+%
+GEMINI (May 21 to Jun. 20)
+ Good news and bad news highlighted. Enjoy the good news while you
+ can; the bad news will make you forget it. You will enjoy praise
+ and respect from those around you; everybody loves a sucker. A short
+ trip is in the stars, possibly to the men's room.
+%
+Genderplex, n.:
+ The predicament of a person in a restaurant who is unable to
+ determine his or her designated restroom (e.g., turtles and
+ tortoises).
+ -- Rich Hall, "Sniglets"
+%
+Genealogy, n.:
+ An account of one's descent from an ancestor
+ who did not particularly care to trace his own.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+General notions are generally wrong.
+ -- Lady M. W. Montagu
+%
+Generally speaking, the Way of the warrior is resolute acceptance of death.
+ -- Miyamoto Musashi, 1645
+%
+Generally speaking, you aren't learning much when your lips are moving.
+%
+Generic Fortune.
+%
+Generosity and perfection are your everlasting goals.
+%
+Genetics explains why you look like your father,
+and if you don't, why you should.
+%
+GENIUS:
+ Person clever enough to be born in the right place at the right
+ time of the right sex and to follow up this advantage by saying
+ all the right things to all the right people.
+%
+Genius does what it must, and Talent does what it can.
+ -- Owen Meredith
+%
+Genius is one percent inspiration and ninety-nine percent perspiration.
+ -- Thomas Alva Edison
+%
+Genius is pain.
+ -- John Lennon
+%
+Genius is ten percent inspiration and fifty percent capital gains.
+%
+Genius is the talent of a person who is dead.
+%
+Genius may have its limitations, but stupidity is not thus handicapped.
+ -- Elbert Hubbard
+%
+Genius, n.:
+ A chemist who discovers a laundry additive that rhymes with
+ "bright".
+%
+Genlock, n.:
+ Why he stays in the bottle.
+%
+Gentlemen,
+ Whilst marching from Portugal to a position which commands the approach
+to Madrid and the French forces, my officers have been diligently complying
+with your requests which have been sent by H.M. ship from London to Lisbon and
+thence by dispatch to our headquarters.
+ We have enumerated our saddles, bridles, tents and tent poles, and all
+manner of sundry items for which His Majesty's Government holds me accountable.
+I have dispatched reports on the character, wit, and spleen of every officer.
+Each item and every farthing has been accounted for, with two regrettable
+exceptions for which I beg your indulgence.
+ Unfortunately the sum of one shilling and ninepence remains unaccounted
+for in one infantry battalion's petty cash and there has been a hideous
+confusion as to the number of jars of raspberry jam issued to one cavalry
+regiment during a sandstorm in western Spain. This reprehensible carelessness
+may be related to the pressure of circumstance, since we are war with France, a
+fact which may come as a bit of a surprise to you gentlemen in Whitehall.
+ This brings me to my present purpose, which is to request elucidation of
+my instructions from His Majesty's Government so that I may better understand
+why I am dragging an army over these barren plains. I construe that perforce it
+must be one of two alternative duties, as given below. I shall pursue either
+one with the best of my ability, but I cannot do both:
+ 1. To train an army of uniformed British clerks in Spain for the benefit
+of the accountants and copy-boys in London or perchance:
+ 2. To see to it that the forces of Napoleon are driven out of Spain.
+ -- Duke of Wellington, to the British Foreign Office,
+ London, 1812
+%
+Gentlemen do not read each other's mail.
+ -- Secretary of State Henry Stimson, on closing down
+ the Black Chamber, the precursor to the National
+ Security Agency.
+%
+Genuine happiness is when a wife sees a double chin on her husband's
+old girl friend.
+%
+George Bernard Shaw once sent two tickets to the opening night of one of
+his plays to Winston Churchill with the following note:
+ "Bring a friend, if you have one."
+
+Churchill wrote back, returning the two tickets and excused himself as he
+had a previous engagement. He also attached the following:
+ "Please send me two tickets for the next night, if there is one."
+%
+George Orwell 1984. Northwestern 0.
+ -- Chicago Reader 10/15/82
+%
+George Orwell was an optimist.
+%
+George Washington was first in war, first in peace -- and the first to
+have his birthday juggled to make a long weekend.
+ -- Ashley Cooper
+%
+George's friend Sam had a dog who could recite the Gettysburg Address. "Let
+me buy him from you," pleaded George after a demonstration.
+ "Okay," agreed Sam. "All he knows is that Lincoln speech anyway."
+ At his company's Fourth of July picnic, George brought his new pet
+and announced that the animal could recite the entire Gettysburg Address.
+No one believed him, and they proceeded to place bets against the dog.
+George quieted the crowd and said, "Now we'll begin!" Then he looked at
+the dog. The dog looked back. No sound. "Come on, boy, do your stuff."
+Nothing. A disappointed George took his dog and went home.
+ "Why did you embarrass me like that in front of everybody?" George
+yelled at the dog. "Do you realize how much money you lost me?"
+ "Don't be silly, George," replied the dog. "Think of the odds we're
+gonna get on Labor Day."
+%
+(German philosopher) Georg Wilhelm Hegel, on his deathbed, complained, "Only
+one man ever understood me." He fell silent for a while and then added,
+"And he didn't understand me."
+%
+Gerrold's Laws of Infernal Dynamics:
+ 1) An object in motion will always be headed in the wrong direction.
+ 2) An object at rest will always be in the wrong place.
+ 3) The energy required to change either one of these states
+ will always be more than you wish to expend, but never so
+ much as to make the task totally impossible.
+%
+Get forgiveness now -- tomorrow you may no longer feel guilty.
+%
+Get in touch with your feelings of hostility against the dying light.
+ -- Dylan Thomas
+%
+Get Revenge! Live long enough to be a problem for your children!
+%
+Getting into trouble is easy.
+ -- D. Winkel and F. Prosser
+%
+Getting kicked out of the American Bar Association is liked getting kicked
+out of the Book-of-the-Month Club.
+ -- Melvin Belli on the occasion of his getting kicked out
+ of the American Bar Association
+%
+Getting the job done is no excuse for not following the rules.
+
+Corollary:
+ Following the rules will not get the job done.
+%
+Getting there is only half as far as getting there and back.
+%
+Gibson's Springtime Song (to the tune of "Deck the Halls"):
+
+'Tis the season to chase mousies (Fa la la la la, la la la la)
+Snatch them from their little housies (...)
+First we chase them 'round the field (...)
+Then we have them for a meal (...)
+
+Toss them here and catch them there (...)
+See them flying through the air (...)
+Watch them fly and hear them squeal (...)
+Falling mice have great appeal (...)
+
+See the hunter stretched before us (...)
+He's chased the mice in field and forest (...)
+Watch him clean his long white whiskers (...)
+Of the blood of little critters (...)
+%
+Gilbert's Discovery:
+ Any attempt to use the new super glues results in the two pieces
+ sticking to your thumb and index finger rather than to each other.
+%
+Gil-galad was an Elven-King
+of him the harpers sadly sing;
+the last whose realm was fair and free
+between the Mountains and the Sea.
+
+His sword was long, his lance was keen,
+his shining helm afar was seen;
+the countless stars of heaven's field
+were mirrored in his silver shield.
+
+But long ago he rode away,
+and where he dwelleth none can say;
+for into darkness fell his star
+in Mordor where the shadows are.
+%
+Ginger Snap
+%
+Ginsberg's Theorem:
+ 1. You can't win.
+ 2. You can't break even.
+ 3. You can't even quit the game.
+
+Freeman's Commentary on Ginsberg's theorem:
+ Every major philosophy that attempts to make life seem
+ meaningful is based on the negation of one part of Ginsberg's
+ Theorem. To wit:
+
+ 1. Capitalism is based on the assumption that you can win.
+ 2. Socialism is based on the assumption that you can break even.
+ 3. Mysticism is based on the assumption that you can quit the game.
+%
+Ginsburg's Law:
+ At the precise moment you take off your shoe in a shoe store, your
+ big toe will pop out of your sock to see what's going on.
+%
+GIVE: Support the helpless victims of computer error.
+%
+Give a man a fish and he will eat for a day. Teach him how to fish,
+and he will sit in a boat and drink beer all day.
+%
+Give a man a fish, and you feed him for a day.
+Teach a man to fish, and he'll invite himself over for dinner.
+ -- Calvin Keegan
+%
+Give a small boy a hammer and he will find
+that everything he encounters needs pounding.
+%
+Give a woman an inch and she'll park a car in it.
+%
+Give all orders verbally. Never write anything down
+that might go into a "Pearl Harbor File".
+%
+Give him an evasive answer.
+%
+Give me a fish and I will eat today.
+Teach me to fish and I will eat forever.
+%
+Give me a Plumber's friend the size of the Pittsburgh
+dome, and a place to stand, and I will drain the world.
+%
+Give me a sleeping pill and tell me your troubles.
+%
+Give me chastity and continence, but not just now.
+ -- St. Augustine
+%
+Give me enough medals, and I'll win any war.
+ -- Napoleon
+%
+Give me libertines or give me meth.
+%
+Give me the avowed, the erect, the manly foe,
+Bold I can meet -- perhaps may turn his blow!
+But of all plagues, good Heaven, thy wrath can send,
+Save me, oh save me from the candid friend.
+ -- George Canning
+%
+Give me your students, your secretaries,
+Your huddled writers yearning to breathe free,
+The wretched refuse of your Selectric III's.
+Give these, the homeless, typist-tossed to me.
+I lift my disk beside the processor.
+ -- Inscription on a Word Processor
+%
+Give thought to your reputation.
+Consider changing your name and moving to a new town.
+%
+GIVE UP!!!!
+%
+Give your child mental blocks for Christmas.
+%
+Give your very best today.
+Heaven knows it's little enough.
+%
+Given a choice between grief and nothing, I'd choose grief.
+ -- William Faulkner
+%
+Given its constituency, the only thing I expect to be "open" about [the
+Open Software Foundation] is its mouth.
+ -- John Gilmore
+%
+Given my druthers, I'd druther not.
+%
+Given sufficient time, what you put
+off doing today will get done by itself.
+%
+Given the choice between accomplishing something and just lying around, I'd
+rather lie around. No contest.
+ -- Eric Clapton
+%
+Giving money and power to governments is like giving whiskey and
+car keys to teenage boys.
+ -- P. J. O'Rourke
+%
+Giving up on assembly language was the apple in our Garden of Eden: Languages
+whose use squanders machine cycles are sinful. The LISP machine now permits
+LISP programmers to abandon bra and fig-leaf.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+Gleemites, n.:
+ Petrified deposits of toothpaste found in sinks.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Glib's Fourth Law of Unreliability:
+ Investment in reliability will increase until it exceeds the
+ probable cost of errors, or until someone insists on getting
+ some useful work done.
+%
+Gloffing is a state of mine.
+%
+Glogg (a traditional Scandinavian holiday drink):
+ fifth of dry red wine
+ fifth of Aquavit
+ 1 and 1/2 inch piece of cinnamon
+ 10 cardamom seeds
+ 1 cup raisins
+ 4 dried figs
+ 1 cup blanched or flaked almonds
+ a few pieces of dried orange peel
+ 5 cloves
+ 1/2 lb. sugar cubes
+ Heat up the wine and hard stuff (which may be substituted with wine
+for the faint of heart) in a big pot after adding all the other stuff EXCEPT
+the sugar cubes. Just when it reaches boiling, put the sugar in a wire
+strainer, moisten it in the hot brew, lift it out and ignite it with a match.
+Dip the sugar several times in the liquid until it is all dissolved. Serve
+hot in cups with a few raisins and almonds in each cup.
+ N.B. Aquavit may be hard to find and expensive to boot. Use it only
+if you really have a deep-seated desire to be fussy, or if you are of Swedish
+extraction.
+%
+Gnagloot, n.:
+ A person who leaves all his ski passes on his jacket just to
+ impress people.
+ -- Rich Hall, "Sniglets"
+%
+Go ahead, make my day.
+ -- (Dirty) Harry Callahan
+%
+Go away, I'm all right.
+ -- H. G. Wells' last words
+%
+Go away! Stop bothering me with all your
+"compute this ... compute that"! I'm taking a VAX-NAP.
+
+logout
+%
+Go climb a gravity well.
+%
+Go directly to jail. Do not pass Go, do not collect $200.
+%
+Go not to the elves for counsel, for they will say both yes and no.
+ -- J. R. R. Tolkien
+%
+Go out and tell a lie that will make the whole family proud of you.
+ -- Cadmus, to Pentheus, in "The Bacchae" by Euripides
+%
+Go placidly amid the noise and waste, and remember what value there may
+be in owning a piece thereof.
+ -- National Lampoon, "Deteriorata"
+%
+Go slowly to the entertainments of thy friends,
+but quickly to their misfortunes.
+ -- Chilo
+%
+Go to a movie tonight.
+Darkness becomes you.
+%
+Go to the Scriptures... the joyful promises it contains will be a balsam to
+all your troubles.
+ -- Andrew Jackson
+
+The foundations of our society and our government rest so much on the
+teachings of the Bible that it would be difficult to support them if faith
+in these teachings would cease to be practically universal in our country.
+ -- Calvin Coolidge
+
+Lastly, our ancestors established their system of government on morality and
+religious sentiment. Moral habits, they believed, cannot safely be trusted
+on any other foundation than religious principle, nor any government be
+secure which is not supported by moral habits.
+ -- Daniel Webster
+%
+Go 'way! You're bothering me!
+%
+Goals... Plans... they're fantasies, they're part of a dream world...
+ -- Wally Shawn
+%
+GOD:
+ Darwin's chief rival.
+%
+God created a few perfect heads.
+The rest he covered with hair.
+%
+God created woman.
+And boredom did indeed cease from that moment --
+but many other things ceased as well.
+Woman was God's second mistake.
+ -- Friedrich Nietzsche
+%
+God did not create the world in seven days; he screwed around for six
+days and then pulled an all-nighter.
+%
+God gave man two ears and one tongue so
+that we listen twice as much as we speak.
+ -- Arab proverb
+%
+"God gives burdens; also shoulders."
+
+Jimmy Carter cited this Jewish saying in his concession speech at the
+end of the 1980 election. At least he said it was a Jewish saying; I
+can't find it anywhere. I'm sure he's telling the truth though; why
+would he lie about a thing like that?
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+God grant us the serenity to accept the things we cannot change, courage to
+change the things we can, and wisdom to know the difference.
+%
+God has intended the great to be great and the little to be little...
+The trade unions, under the European system, destroy liberty [...] I do
+not mean to say that a dollar a day is enough to support a workingman...
+not enough to support a man and five children if he insists on smoking
+and drinking beer. But the man who cannot live on bread and water is
+not fit to live! A family may live on good bread and water in the
+morning, water and bread at midday, and good bread and water at night!
+ -- Rev. Henry Ward Beecher
+%
+God help the troubadour who tries to be a star. The more
+that you try to find success, the more that you will fail.
+ -- Phil Ochs, on the Second System Effect
+%
+God help those who do not help themselves.
+ -- Wilson Mizner
+%
+God helps them that helps themselves.
+ -- Benjamin Franklin
+%
+God, I ask for patience -- and I want it right now!
+%
+God instructs the heart, not by ideas,
+but by pains and contradictions.
+ -- De Caussade
+%
+God is a comic playing to an audience that's afraid to laugh.
+%
+God is Dead.
+ -- Nietzsche
+Nietzsche is Dead.
+ -- God
+Nietzsche is God.
+ -- The Dead
+%
+God is dead and I don't feel all too well either....
+ -- Ralph Moonen
+%
+God is love, but get it in writing.
+ -- Gypsy Rose Lee
+%
+God is not dead. He is alive and well and working on a
+much less ambitious project.
+%
+God is real, unless declared integer.
+%
+God is really only another artist. He invented the giraffe, the
+elephant and the cat. He has no real style, He just goes on trying
+other things.
+ -- Pablo Picasso
+%
+God is the tangential point between zero and infinity.
+ -- Alfred Jarry
+%
+God isn't dead. He just doesn't want to get involved.
+%
+God made everything out of nothing, but the nothingness shows through.
+ -- Paul Valery
+%
+God made machine language; all the rest is the work of man.
+%
+God made the integers; all else is the work of Man.
+ -- Kronecker
+%
+God may be subtle, but He isn't plain mean.
+ -- Albert Einstein
+%
+God must have loved calories, she made so many of them.
+%
+God must love the Common Man; He made so many of them.
+%
+God rest ye CS students now, The bearings on the drum are gone,
+Let nothing you dismay. The disk is wobbling, too.
+The VAX is down and won't be up, We've found a bug in Lisp, and Algol
+Until the first of May. Can't tell false from true.
+The program that was due this morn, And now we find that we can't get
+Won't be postponed, they say. At Berkeley's 4.2.
+(chorus) (chorus)
+
+We've just received a call from DEC, And now some cheery news for you,
+They'll send without delay The network's also dead,
+A monitor called RSuX We'll have to print your files on
+It takes nine hundred K. The line printer instead.
+The staff committed suicide, The turnaround time's nineteen weeks.
+We'll bury them today. And only cards are read.
+(chorus) (chorus)
+
+And now we'd like to say to you CHORUS: Oh, tidings of comfort and joy,
+Before we go away, Comfort and joy,
+We hope the news we've brought to you Oh, tidings of comfort and joy.
+Won't ruin your whole day.
+You've got another program due, tomorrow, by the way.
+(chorus)
+ -- to God Rest Ye Merry Gentlemen
+%
+God runs electromagnetics by wave theory on Monday, Wednesday, and Friday,
+and the Devil runs them by quantum theory on Tuesday, Thursday, and Saturday.
+ -- William Bragg
+%
+God said it, I believe it and that's all there is to it.
+%
+God save us from a bad neighbor and a beginner on the fiddle.
+%
+God shows his contempt for wealth by the kind of person he selects
+to receive it.
+ -- Austin O'Malley
+%
+God votes Republican.
+%
+God was satisfied with his own work, and that is fatal.
+ -- Samuel Butler
+%
+Goda's Truism:
+ By the time you get to the point where you can make ends meet,
+ somebody moves the ends.
+%
+Going the speed of light is bad for your age.
+%
+Going to church does not make a person religious, nor does going to school
+make a person educated, any more than going to a garage makes a person a car.
+%
+Gold, n.:
+ A soft malleable metal relatively scarce in distribution. It
+ is mined deep in the earth by poor men who then give it to rich
+ men who immediately bury it back in the earth in great prisons,
+ although gold hasn't done anything to them.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Goldenstern's Rules:
+ 1. Always hire a rich attorney.
+ 2. Never buy from a rich salesman.
+%
+Goldfish... what stupid animals. Even Wayne Cody stops
+eating before he bursts.
+%
+Gold's Law:
+ If the shoe fits, it's ugly.
+%
+Gomme's Laws:
+ (1) A backscratcher will always find new itches.
+ (2) Time accelerates.
+ (3) The weather at home improves as soon as you go away.
+%
+Gone With The Wind LITE(tm)
+ -- by Margaret Mitchell
+
+ A woman only likes men she can't have and the South gets trashed.
+
+Gift of the Magii LITE(tm)
+ -- by O. Henry
+
+ A husband and wife forget to register their gift preferences.
+
+The Old Man and the Sea LITE(tm)
+ -- by Ernest Hemingway
+
+ An old man goes fishing, but doesn't have much luck.
+
+Diary of a Young Girl LITE(tm)
+ -- by Anne Frank
+
+ A young girl hides in an attic but is discovered.
+%
+Good advice is one of those insults that ought to be forgiven.
+%
+Good day for a change of scene. Repaper the bedroom wall.
+%
+Good day for business affairs.
+Make a pass at that the new file clerk.
+%
+Good day for overcoming obstacles. Try a steeplechase.
+%
+Good day to avoid cops. Crawl to school.
+%
+Good day to avoid cops. Crawl to work.
+%
+Good day to deal with people in high places;
+particularly lonely stewardesses.
+%
+Good day to let down old friends who need help.
+%
+Good evening, gentlemen. I am a HAL 9000 computer. I became operational
+at the HAL plant in Urbana, Illinois, on January 11th, nineteen hundred
+ninety-five. My supervisor was Mr. Langley, and he taught me to sing a
+song. If you would like, I could sing it for you.
+%
+Good girls go to heaven, bad girls go everywhere.
+%
+Good government never depends upon laws, but upon the personal qualities of
+those who govern. The machinery of government is always subordinate to the
+will of those who administer that machinery. The most important element of
+government, therefore, is the method of choosing leaders.
+ -- Frank Herbert, "Children of Dune"
+%
+"Good health" is merely the slowest rate at which one can die.
+%
+Good judgment comes from experience.
+Experience comes from bad judgment.
+ -- Jim Horning
+%
+Good leaders being scarce, following yourself is allowed.
+%
+Good morning. This is the telephone company. Due to repairs, we're
+giving you advance notice that your service will be cut off indefinitely
+at ten o'clock. That's two minutes from now.
+%
+Good news. Ten weeks from Friday will be a pretty good day.
+%
+Good news from afar can bring you a welcome visitor.
+%
+Good news is just life's way of keeping you off balance.
+%
+Good night, Austin, Texas, wherever you are!
+%
+Good night, Mrs. Calabash, wherever you are.
+%
+Good night to spend with family, but avoid arguments with your mate's
+new lover.
+%
+Good salesmen and good repairmen will never go hungry.
+ -- R. E. Schenk
+%
+Good teaching is one-fourth preparation and three-fourths good theatre.
+ -- Gail Godwin
+%
+Good-bye. I am leaving because I am bored.
+ -- George Saunders' dying words
+%
+Goodbye, cool world.
+%
+Goose pimples rose all over me, my hair stood on end, my eyes filled with
+tears of love and gratitude for this greatest of all conquerors of human
+misery and shame, and my breath came in little gasps. If I had not known
+that the Leader would have scorned such adulation, I might have fallen to
+my knees in unashamed worship, but instead I drew myself to attention, raised
+my arm in the eternal salute of the ancient Roman Legions and repeated the
+holy words, "Heil Hitler!"
+ -- George Lincoln Rockwell
+%
+Gordon's first law:
+ If a research project is not worth doing, it is not worth doing
+ well.
+%
+Gordon's Law:
+ If you think you have the solution, the question was poorly phrased.
+%
+Gosh that takes me back... or is it forward? That's the trouble with
+time travel, you never can tell.
+ -- The Doctor, "Doctor Who: Androids of Tara"
+%
+Gossip, n.:
+ Hearing something you like about someone you don't.
+ -- Earl Wilson
+%
+//GO.SYSIN DD *, DOODAH, DOODAH
+%
+Got a complaint about the Internal Revenue Service?
+Call the convenient toll-free "IRS Taxpayer Complaint Hot Line Number":
+
+ 1-800-AUDITME
+%
+Got a dictionary? I want to know the meaning of life.
+%
+Got a wife and kids in Baltimore Jack,
+I went out for a ride and never came back.
+Like a river that don't know where it's flowing,
+I took a wrong turn and I just kept going.
+
+ Everybody's got a hungry heart.
+ Everybody's got a hungry heart.
+ Lay down your money and you play your part,
+ Everybody's got a hungry heart.
+
+I met her in a Kingstown bar,
+We fell in love, I knew it had to end.
+We took what we had and we ripped it apart,
+Now here I am down in Kingstown again.
+
+Everybody needs a place to rest,
+Everybody wants to have a home.
+Don't make no difference what nobody says,
+Ain't nobody likes to be alone.
+ -- Bruce Springsteen, "Hungry Heart"
+%
+Got Mole problems?
+Call Avogadro at 6.02 x 10^23.
+%
+Goto, n.:
+ A programming tool that exists to allow structured programmers
+ to complain about unstructured programmers.
+ -- Ray Simard
+%
+Gourmet, n.:
+ Anyone whom, when you fail to finish something strange or
+ revolting, remarks that it's an acquired taste and that you're
+ leaving the best part.
+%
+Govern a great nation as you would cook a small fish. Don't overdo it.
+ -- Lao Tsu
+%
+Government [is] an illusion the governed should not encourage.
+ -- John Updike, "Couples"
+%
+Government lies, and newspapers lie, but in a democracy they are
+different lies.
+%
+Government spending? I don't know what it's all about. I don't know any
+more about this thing than an economist does, and, God knows, he doesn't
+know much.
+ -- The Best of Will Rogers
+%
+Government's Law:
+ There is an exception to all laws.
+%
+Governor Tarkin. I should have expected to find you holding Vader's
+leash. I thought I recognized your foul stench when I was brought on
+board.
+ -- Princess Leia Organa
+%
+Grabel's Law:
+ 2 is not equal to 3 -- not even for large values of 2.
+%
+Graduate life -- it's not just a job, it's an indenture.
+%
+Graduate students and most professors are
+no smarter than undergrads. They're just older.
+%
+Grand Master Turing once dreamed that he was a machine. When he awoke
+he exclaimed:
+ "I don't know whether I am Turing dreaming that I am a machine,
+ or a machine dreaming that I am Turing!"
+ -- Geoffrey James, "The Tao of Programming"
+%
+Grandpa Charnock's Law:
+ You never really learn to swear until you learn to drive.
+
+ [I thought it was when your kids learned to drive. Ed.]
+%
+Graphics blind the eyes.
+Audio files deafen the ear.
+Mouse clicks numb the fingers.
+Heuristics weaken the mind.
+Options wither the heart.
+
+The Guru observes the net
+but trusts his inner vision.
+He allows things to come and go.
+His heart is as open as the ether.
+%
+GRASSHOPPOTAMUS:
+ A creature that can leap to tremendous heights... once.
+%
+Gratitude, like love, is never a dependable international emotion.
+ -- Joseph Alsop
+%
+GRAVITY:
+ What you get when you eat too much and too fast.
+%
+Gravity brings me down.
+%
+Gray's Law of Programming:
+ 'n+1' trivial tasks are expected to be
+ accomplished in the same time as 'n' tasks.
+
+Logg's Rebuttal to Gray's Law:
+ 'n+1' trivial tasks take twice as long as 'n' trivial tasks.
+%
+Great acts are made up of small deeds.
+ -- Lao Tsu
+%
+Great American Axiom:
+ Some is good, more is better, too much is just right.
+%
+Great minds run in great circles.
+%
+GREAT MOMENTS IN AMERICAN HISTORY (#17):
+
+On November 13, Felix Unger was asked to remove himself from his
+place of residence.
+%
+GREAT MOMENTS IN HISTORY (#7): April 2, 1751
+
+Isaac Newton becomes discouraged when he falls up a flight of stairs.
+%
+GREAT MOMENTS IN HISTORY (#7): November 23, 1915
+
+Pancake make-up is invented; most people continue to prefer syrup.
+%
+Great spirits have always encountered violent opposition from mediocre minds.
+ -- Albert Einstein
+
+They laughed at Einstein. They laughed at the Wright Brothers. But they
+also laughed at Bozo the Clown.
+ -- Carl Sagan
+%
+Greatness is a transitory experience. It is never consistent.
+%
+Green light in A.M. for new projects.
+Red light in P.M. for traffic tickets.
+%
+Greener's Law:
+ Never argue with a man who buys ink by the barrel.
+%
+Green's Law of Debate:
+Anything is possible if you don't know what you're talking about.
+%
+Greenspun's Tenth Rule of Programming:
+ Any sufficiently complicated C or Fortran program contains
+ an ad hoc informally-specified bug-ridden slow implementation
+ of half of Common Lisp.
+%
+Grelb's Reminder:
+ Eighty percent of all people consider
+ themselves to be above average drivers.
+%
+grep me no patterns and I'll tell you no lines.
+%
+Grief can take care of itself; but to get the full
+value of a joy you must have somebody to divide it with.
+ -- Mark Twain
+%
+Griffin's Thought:
+ When you starve with a tiger, the tiger starves last.
+%
+Grig (the navigator):
+ ... so you see, it's just the two of us against the entire space
+ armada.
+Alex (the gunner):
+ What?!?
+Grig: I've always wanted to fight a desperate battle against
+ overwhelming odds.
+Alex: It'll be a slaughter!
+Grig: That's the spirit!
+ -- The Last Starfighter
+%
+Grinnell's Law of Labor Laxity:
+ At all times, for any task, you have not got enough done today.
+%
+Groundhog Day has been observed only once in Los Angeles because when the
+groundhog came out of its hole, it was killed by a mudslide.
+ -- Johnny Carson
+%
+Growing old isn't bad when you consider the alternatives.
+ -- Maurice Chevalier
+%
+Grownups are reluctant to take science fiction seriously, and with good
+reason: sci-fi is a hormonal activity, not a literary one. Its traditional
+concerns are all pubescent. Secondary sexual characteristics are everywhere,
+disguised. Aliens have tentacles. Telepathy allows you to have sex without
+any nasty inconvenience of touching. Womblike spaceships provide balanced
+meals. No one ever has to grow old -- body parts are replaceable, like
+Job's daughters, and if you're lucky you can become a robot. As for the
+adult world, it's simply not there; political systems tend to be naively
+authoritarian (there are more lords in science fiction than on public
+television) and are often ruled by young boys on quests. The most popular
+sci-fi book in years, Frank Herbert's Dune, sold millions of copies by
+combining all these themes: it ends with its adolescent hero conquering the
+universe while straddling a giant worm.
+ -- Arnold Klein
+%
+Grub first, then ethics.
+ -- Bertolt Brecht
+%
+GUILLOTINE:
+ A French chopping center.
+%
+Gumperson's Law:
+ The probability of a given event
+ occurring is inversely proportional to its desirability.
+%
+Guns don't kill people. Bullets kill people.
+%
+Gunter's Airborne Discoveries:
+ (1) When you are served a meal aboard an aircraft,
+ the aircraft will encounter turbulence.
+ (2) The strength of the turbulence
+ is directly proportional to the temperature of your coffee.
+%
+Gurmlish, n.:
+ The red warning flag at the top of a club sandwich which prevents
+ the person from biting into it and puncturing the roof of his mouth.
+ -- Rich Hall & Friends, "Sniglets"
+%
+GURU:
+ A person in T-shirt and sandals who took an elevator ride with
+ a senior vice-president and is ultimately responsible for the
+ phone call you are about to receive from your boss.
+%
+Guru, n.:
+ A computer owner who can read the manual.
+%
+Gyroscope, n.:
+ A wheel or disk mounted to spin rapidly about an axis and also
+free to rotate about one or both of two axes perpendicular to each
+other and the axis of spin so that a rotation of one of the two
+mutually perpendicular axes results from application of torque to the
+other when the wheel is spinning and so that the entire apparatus
+offers considerable opposition depending on the angular momentum to any
+torque that would change the direction of the axis of spin.
+ -- Webster's Seventh New Collegiate Dictionary
+%
+H: If a 'GOBLIN (HOB) waylays you,
+ Slice him up before he slays you.
+ Nothing makes you look a slob
+ Like running from a HOB'LIN (GOB).
+ -- The Roguelet's ABC
+%
+H. L. Mencken suffers from the hallucination that he is H. L.
+Mencken -- there is no cure for a disease of that magnitude.
+ -- Maxwell Bodenheim
+%
+H. L. Mencken's Law:
+ Those who can -- do.
+ Those who can't -- teach.
+
+Martin's Extension:
+ Those who cannot teach -- administrate.
+
+ [No, those who can't teach, teach here. Ed.]
+%
+Hacker, n.:
+ Originally, any person with a knack for coercing stubborn inanimate
+things; hence, a person with a happy knack, later contracted by the mythical
+philosopher Frisbee Frobenius to the common usage, "hack."
+ In olden times, upon completion of some particularly atrocious body
+of coding that happened to work well, culpable programmers would gather in
+a small circle around a first edition of Knuth's Best Volume I by candlelight,
+and proceed to get very drunk while sporadically rending the following ditty:
+
+ Hacker's Fight Song
+
+ He's a Hack! He's a Hack!
+ He's a guy with the happy knack!
+ Never bungles, never shirks,
+ Always gets his stuff to work!
+
+All take a drink (important!)
+%
+Hackers are just a migratory life form with a tropism for computers.
+%
+Hacker's Guide To Cooking:
+2 pkg. cream cheese (the mushy white stuff in silver wrappings that doesn't
+ really come from Philadelphia after all; anyway, about 16 oz.)
+1 tsp. vanilla extract (which is more alcohol than vanilla and pretty
+ strong so this part you *GOTTA* measure)
+1/4 cup sugar (but honey works fine too)
+8 oz. Cool Whip (the fluffy stuff devoid of nutritional value that you
+ can squirt all over your friends and lick off...)
+"Blend all together until creamy with no lumps." This is where you get to
+ join(1) all the raw data in a big buffer and then filter it through
+ merge(1m) with the -thick option, I mean, it starts out ultra lumpy
+ and icky looking and you have to work hard to mix it. Try an electric
+ beater if you have a cat(1) that can climb wall(1s) to lick it off
+ the ceiling(3m).
+"Pour into a graham cracker crust..." Aha, the BUGS section at last. You
+ just happened to have a GCC sitting around under /etc/food, right?
+ If not, don't panic(8), merely crumble a rand(3m) handful of innocent
+ GCs into a suitable tempfile and mix in some melted butter.
+"...and refrigerate for an hour." Leave the recipe's stdout in a fridge
+ for 3.6E6 milliseconds while you work on cleaning up stderr, and
+ by time out your cheesecake will be ready for stdin.
+%
+Hacker's Law:
+ The belief that enhanced understanding will necessarily stir a
+ nation to action is one of mankind's oldest illusions.
+%
+Hackers of the world, unite!
+%
+Hacker's Quicky #313:
+ Sour Cream -n- Onion Potato Chips
+ Microwave Egg Roll
+ Chocolate Milk
+%
+Hacking's just another word for nothing left to kludge.
+%
+Had he and I but met
+By some old ancient inn, But ranged as infantry,
+We should have sat us down to wet And staring face to face,
+Right many a nipperkin! I shot at him as he at me,
+ And killed him in his place.
+I shot him dead because --
+Because he was my foe, He thought he'd 'list, perhaps,
+Just so: my foe of course he was; Off-hand-like -- just as I --
+That's clear enough; although Was out of work -- had sold his traps
+ No other reason why.
+Yes; quaint and curious war is!
+You shoot a fellow down
+You'd treat, if met where any bar is
+Or help to half-a-crown.
+ -- Thomas Hardy
+%
+Had I been present at the creation, I would have given some
+useful hints for the better ordering of the universe.
+ -- Alfonso the Wise
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to operating system initialization.]
+%
+Had this been an actual emergency, we would have
+fled in terror, and you would not have been informed.
+%
+Hail to the sun god
+He's such a fun god
+Ra! Ra! Ra!
+%
+Hailing frequencies open, Captain.
+%
+Hain't we got all the fools in town on our side? And hain't that
+a big enough majority in any town?
+ -- Mark Twain, "Huckleberry Finn"
+%
+Hale Mail Rule, The:
+ When you are ready to reply to a letter, you will lack at least
+ one of the following:
+ (a) A pen or pencil or typewriter.
+ (b) Stationery.
+ (c) Postage stamp.
+ (d) The letter you are answering.
+%
+Half a bee, philosophically, must ipso facto half not be.
+But half the bee has got to be, vis-a-vis its entity. See?
+But can a bee be said to be or not to be an entire bee,
+When half the bee is not a bee, due to some ancient injury?
+%
+Half Moon tonight. (At least it is better than no Moon at all.)
+%
+Half of being smart is knowing what you're dumb at.
+%
+Half the world is composed of people who have something to say and can't,
+and the other half who have nothing to say and keep on saying it.
+%
+Half-done, n.:
+ This is the best way to eat a kosher dill -- when it's still crunchy,
+ light green, yet full of garlic flavor. The difference between this
+ and the typical soggy dark green cucumber corpse is like the
+ difference between life and death.
+
+ You may find it difficult to find a good half-done kosher dill there
+ in Seattle, so what you should do is take a cab out to the airport,
+ fly to New York, take the JFK Express to Jay Street-Borough Hall,
+ transfer to an uptown F, get off at East Broadway, walk north on
+ Essex (along the park), make your first left onto Hester Street, walk
+ about fifteen steps, turn ninety degrees left, and stop. Say to the
+ man, "Let me have a nice half-done." Worth the trouble, wasn't it?
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+Halley's Comet: It came, we saw, we drank.
+%
+Hall's Laws of Politics:
+ (1) The voters want fewer taxes and more spending.
+ (2) Citizens want honest politicians until they want
+ something fixed.
+ (3) Constituency drives out consistency (i.e., liberals defend
+ military spending, and conservatives social spending in
+ their own districts).
+%
+Hand, n.:
+ A singular instrument worn at the end of a human arm and
+ commonly thrust into somebody's pocket.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Handel's Proverb:
+ You can't produce a baby in one month by impregnating 9 women!
+%
+Handshaking protocol, n.:
+ A process employed by hostile hardware devices to initiate a
+ terse but civil dialogue, which, in turn, is characterized by
+ occasional misunderstanding, sulking, and name-calling.
+%
+Hanging on in quiet desperation is the English way.
+ -- Pink Floyd
+%
+Hangover, n.:
+ The wrath of grapes.
+%
+Hanlon's Razor:
+ Never attribute to malice
+ that which is adequately explained by stupidity.
+%
+Hanson's Treatment of Time:
+ There are never enough hours in a day,
+ but always too many days before Saturday.
+%
+Happiness adds and multiplies as we divide it with others.
+%
+Happiness is a hard disk.
+%
+Happiness is a positive cash flow.
+%
+Happiness is good health and a bad memory.
+ -- Ingrid Bergman
+%
+Happiness is having a scratch for every itch.
+ -- Ogden Nash
+%
+Happiness is just an illusion, filled with sadness and confusion.
+%
+Happiness is the greatest good.
+%
+Happiness is twin floppies.
+%
+Happiness isn't having what you want, it's wanting what you have.
+%
+Happiness isn't something you experience; it's something you remember.
+ -- Oscar Levant
+%
+Happiness makes up in height what it lacks in length.
+%
+Happiness, n.:
+ An agreeable sensation arising from contemplating the misery of
+ another.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Happiness, n.:
+ Finding the owner of a lost bikini.
+%
+Happy feast of the pig!
+%
+Happy is the child whose father died rich.
+%
+Hard, adj.:
+ The quality of your own data; also how it is to believe those
+ of other people.
+%
+Hard reality has a way of cramping your style.
+ -- Daniel Dennett
+%
+Hard work may not kill you, but why take the chance?
+%
+Hard work never killed anybody, but why take a chance?
+ -- Charlie McCarthy
+%
+Hardware, n.:
+ The parts of a computer system that can be kicked.
+%
+Hark, Hark, the dogs do bark
+The Duke is fond of kittens
+He likes to take their insides out
+And use them for his mittens
+ -- "The 13 Clocks"
+%
+Hark, the Herald Tribune sings,
+Advertising wondrous things.
+ -- Tom Lehrer
+%
+Hark ye, Clinker, you are a most notorious offender. You stand
+convicted of sickness, hunger, wretchedness, and want.
+ -- Tobias Smollet
+%
+Harp not on that string.
+ -- William Shakespeare, "Henry VI"
+%
+Harriet's Dining Observation:
+ In every restaurant, the hardness of the butter pats
+ increases in direct proportion to the softness of the bread.
+%
+Harris had the beefstead pie between his knees, and was carving it, and George
+and I were waiting with our plates ready.
+ "Have you got a spoon there?" says Harris; "I want a spoon to help
+the gravy with."
+ The hamper was close behind us, and George and I both turned round to
+reach one out. We were not five seconds getting it. When we looked round
+again, Harris and the pie were gone!
+ It was a wide, open field. There was not a tree or a bit of hedge for
+hundreds of yards. He could not have tumbled into the river, because we were
+on the water side of him, and he would have had to climb over us to do it.
+ George and I gazed all about. Then we gazed at each other.
+ "Has he been snatched up to heaven?" I queried.
+ "They'd hardly have taken the pie, too," said George.
+ There seemed weight in this objection, and we discarded the heavenly
+theory.
+ "I suppose the truth of the matter is," suggested George, descending
+to the commonplace and practicable, "that there has been an earthquake."
+ And then he added, with a touch of sadness in his voice: "I wish he
+hadn't been carving that pie."
+ -- Jerome K. Jerome, "Three Men In A Boat"
+%
+Harrisberger's Fourth Law of the Lab:
+ Experience is directly proportional to the amount of
+ equipment ruined.
+%
+Harrison's Postulate:
+For every action, there is an equal and opposite criticism.
+%
+Harris's Lament:
+ All the good ones are taken.
+%
+Harry and Fred were playing their Sunday afternoon golf game. The game, as
+always, was close. They were at the treacherous 12th hole: a par three that
+required a perfect first shot over a large pond and onto a tiny green. There
+were sand traps on the other three sides of the green, and a small road 50
+feet beyond it. Harry went first. He carefully addressed the ball and hit
+a good shot that landed just on the edge of the green, narrowly avoiding the
+pond. Just as Fred addressed his ball, he looked up and noticed a funeral
+procession along the road just behind the green. Fred put down his club,
+took his hat off, and waited for the entire procession to pass. As soon as
+the cars were gone he put his hat back on and started addressing the ball
+again. Harry said, "Damn, Fred. That was a really nice thing you did,
+waiting for the funeral to pass like that."
+ Fred finished his swing, making perfect contact with the ball. It
+was an excellent shot that landed 7 feet from the hole. "It's the least I
+could do," he said, smiling at his shot, "We were married for 22 years,
+you know."
+%
+Harry is heavily into camping, and every year in the late fall, he
+makes us all go to Assateague, which is an island on the Atlantic Ocean
+famous for its wild horses. I realize that the concept of wild horses
+probably stirs romantic notions in many of you, but this is because you
+have never met any wild horses in person. In person, they are like
+enormous hooved rats. They amble up to your camp site, and their
+attitude is: "We're wild horses. We're going to eat your food, knock
+down your tent and poop on your shoes. We're protected by federal law,
+just like Richard Nixon."
+ -- Dave Barry, "Tenting Grandpa Bob"
+%
+Harry's bar has a new cocktail. It's called MRS punch. They make it with
+milk, rum and sugar and it's wonderful. The milk is for vitality and the
+sugar is for pep. They put in the rum so that people will know what to do
+with all that pep and vitality.
+%
+Hartley's First Law:
+ You can lead a horse to water, but if you can
+ get him to float on his back, you've got something.
+%
+Hartley's Second Law:
+ Never sleep with anyone crazier than yourself.
+
+My corollary:
+ The completely psychotic have all the fun.
+%
+Harvard Law:
+ Under the most rigorously controlled conditions of pressure,
+ temperature, volume, humidity, and other variables, the
+ organism will do as it damn well pleases.
+%
+HARVARD:
+Quarterback:
+ Sophomore Dave Strewzinski... likes to pass. And pass he does, with
+a record 86 attempts (three completions) in 87 plays.... Though Strewzinski
+has so far failed to score any points for the Crimson, his jackrabbit speed
+has made him the least sacked quarterback in the Ivy league.
+Wide Receiver:
+ The other directional signal in Harvard's offensive machine is senior
+Phil Yip, who is very fast. Yip is so fast that he has set a record for being
+fast. Expect to see Yip elude all pursuers and make it into the endzone five
+or six times, his average for a game. Yip, nicknamed "fumblefingers" and "you
+asshole" by his teammates, hopes to carry the ball with him at least one of
+those times.
+YALE:
+Defense:
+ On the defensive side, Yale boasts the stingiest line in the Ivies.
+Primarily responsible are seniors Izzy "Shylock" Bloomberg and Myron
+Finklestein, the tightest ends in recent Eli history. Also contributing to
+the powerful defense is junior tackle Angus MacWhirter, a Scotsman who rounds
+out the offensive ethnic joke. Look for these three to shut down the opening
+coin toss.
+ -- Harvard Lampoon 1988 Program Parody, distributed at The Game
+%
+Has anyone ever tasted an "end"? Are they really bitter?
+%
+Has everyone noticed that all the letters of the word "database" are typed
+with the left hand? Now the layout of the QWERTYUIOP typewriter keyboard
+was designed, among other things, to facilitate the even use of both hands.
+It follows, therefore, that writing about databases is not only unnatural,
+but a lot harder than it appears.
+%
+Has the great art and mystery of politics no apparent utility? Does it
+appear to be unqualifiedly ratty, raffish, sordid, obscene and low down,
+and its salient virtuosi a gang of unmitigated scoundrels? Then let us
+not forget its high capacity to soothe and tickle the midriff, its
+incomparable services as a maker of entertainment.
+ -- H. L. Mencken, "A Carnival of Buncombe"
+%
+Haste makes waste.
+ -- John Heywood
+%
+Hatcheck girl:
+ "Goodness! What lovely diamonds!"
+Mae West:
+ "Goodness had nothin' to do with it, dearie."
+ -- "Night After Night", 1932
+%
+Hate is like acid. It can damage the vessel in which it is
+stored as well as destroy the object on which it is poured.
+%
+Hate the sin and love the sinner.
+ -- Mahatma Gandhi
+%
+Hating the Yankees is as American as pizza pie,
+unwed mothers and cheating on your income tax.
+ -- Mike Royko
+%
+Hatred, n.:
+ A sentiment appropriate to the occasion of another's
+ superiority.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Have a coke and a smile!
+ -- John DeLorean
+%
+Have a nice day!
+%
+Have a nice diurnal anomaly.
+%
+Have a place for everything and keep the thing
+somewhere else; this is not advice, it is merely custom.
+ -- Mark Twain
+%
+Have a taco.
+ -- P. S. Beagle
+%
+Have an adequate day.
+%
+Have at you!
+%
+Have no friends not equal to yourself.
+ -- Confucius
+%
+Have people realized that the purpose of the fortune cookie program is
+to defuse project tensions? When did you ever see a cheerful cookie, a
+non-cynical, or even an informative cookie?
+
+Perhaps inadvertently, we have a channel for our aggressions. This
+still begs the question of whether the cookie releases the pressure or
+only serves to blunt the warning signs.
+
+ Long live the revolution!
+ Have a nice day.
+%
+Have the courage to take your own thoughts
+seriously, for they will shape you.
+ -- Albert Einstein
+%
+Have you ever felt like a wounded cow
+halfway between an oven and a pasture?
+walking in a trance toward a pregnant
+ seventeen-year-old housewife's
+ two-day-old cookbook?
+ -- Richard Brautigan
+%
+Have you ever met a man of good character where women are concerned?
+
+Well, I haven't. I find that whenever a woman becomes friends with me,
+she becomes jealous, exacting, suspicious, and a damn nuisance; and
+whenever I become friends with a woman, I become selfish and tyrannical.
+So here I am, Pickering, a confirmed old bachelor and very likely to
+remain so.
+ -- Henry Higgins, "My Fair Lady"
+%
+Have you ever noticed that the people who are always trying
+to tell you `there's a time for work and a time for play'
+never find the time for play?
+%
+Have you flogged your kid today?
+%
+Have you locked your file cabinet?
+%
+Have you noticed that all you need to grow healthy,
+vigorous grass is a crack in your sidewalk?
+%
+Have you noticed the way people's intelligence capabilities decline
+sharply the minute they start waving guns around?
+ -- The Doctor, "Doctor Who"
+%
+Have you reconsidered a computer career?
+%
+Have you seen the latest Japanese camera? Apparently it is so fast it can
+photograph an American with his mouth shut!
+%
+Have you seen the old man in the closed down market,
+Kicking up the papers in his worn out shoes?
+In his eyes you see no pride, hands hang loosely at his side
+Yesterdays papers, telling yesterdays news.
+
+How can you tell me you're lonely,
+And say for you the sun don't shine?
+Let me take you by the hand
+Lead you through the streets of London
+I'll show you something to make you change your mind...
+
+Have you seen the old man outside the sea-mans mission
+Memories fading like the metal ribbons that he wears.
+In our winter city the rain cries a little pity
+For one more forgotten hero and a world that doesn't care...
+%
+Have you seen the well-to-do, up and down Park Avenue?
+On that famous thoroughfare, with their noses in the air,
+High hats and Arrow collars, white spats and lots of dollars,
+Spending every dime, for a wonderful time...
+If you're blue and you don't know where to go to,
+Why don't you go where fashion sits,
+...
+Dressed up like a million dollar trooper,
+Trying hard to look like Gary Cooper, (super dooper)
+Come, let's mix where Rockefeller's walk with sticks,
+Or umbrellas, in their mitts,
+Puttin' on the Ritz.
+...
+If you're blue and you don't know where to go to,
+Why don't you go where fashion sits,
+Puttin' on the Ritz.
+Puttin' on the Ritz.
+Puttin' on the Ritz.
+Puttin' on the Ritz.
+%
+Having a baby isn't so bad. If you're a female Emperor penguin
+in the Antarctic. She lays the egg, rolls it over to the father,
+then takes off for warmer weather where she eats and eats and
+eats. For two months, the father stands stiff, without food,
+blind in the 24-hour dark, balancing the egg on his feet. After
+the little penguin is hatched, the mother sees fit to come home.
+ -- L. M. Boyd, "Austin American-Statesman"
+%
+Having a wonderful wine, wish you were beer.
+%
+Having children is like having a bowling alley installed in your brain.
+ -- Martin Mull
+%
+Having no talent is no longer enough.
+ -- Gore Vidal
+%
+Having nothing, nothing can he lose.
+ -- William Shakespeare, "Henry VI"
+%
+Having the fewest wants, I am nearest to the gods.
+ -- Socrates
+%
+Having wandered helplessly into a blinding snowstorm Sam was greatly
+relieved to see a sturdy Saint Bernard dog bounding toward him with
+the traditional keg of brandy strapped to his collar.
+ "At last," cried Sam, "man's best friend -- and a great big
+dog, too!"
+%
+Hawkeye's Conclusion:
+ It's not easy to play the clown
+ when you've got to run the whole circus.
+%
+He: Do you like Kipling?
+She: Oh, you naughty boy, I don't know! I've never kippled!
+%
+He: "If I made love to you, would you yell?"
+She: "What do you want me to yell?"
+ -- Benny Hill
+%
+HE: Let's end it all, bequeathin' our brains to science.
+SHE: What?!? Science got enough trouble with their OWN brains.
+ -- Walt Kelley
+%
+He asked me if I knew what time it was -- I said yes, but not right now.
+ -- Steven Wright
+%
+He did decide, though, that with more time and a great deal of mental
+effort, he could probably turn the activity into an acceptable
+perversion.
+ -- Mick Farren, "When Gravity Fails"
+%
+He didn't run for reelection. "Politics brings you into contact with all
+the people you'd give anything to avoid," he said. "I'm staying home."
+ -- Garrison Keillor, "Lake Wobegon Days"
+%
+He does it with a better grace, but I do it more natural.
+ -- William Shakespeare, "Twelfth-Night"
+%
+He draweth out the thread of his verbosity
+finer than the staple of his argument.
+ -- William Shakespeare, "Love's Labour's Lost"
+%
+He flung himself on his horse and rode madly off in all directions.
+ -- Stephen Leacock
+%
+He gave her a look that you could have poured on a waffle.
+%
+He had occasional flashes of silence that made his conversation
+perfectly delightful.
+ -- Sydney Smith
+%
+He had that rare weird electricity about him -- that extremely wild
+and heavy presence that you only see in a person who has abandoned
+all hope of ever behaving "normally."
+ -- Hunter S. Thompson, "Fear and Loathing '72"
+%
+He hadn't a single redeeming vice.
+ -- Oscar Wilde
+%
+He has been known by many names; the Prince of Lies, the Director, Lucifer,
+Belial, and once, at a party, some obnoxious drunk kept calling him "Dude".
+ -- Stig's Inferno
+%
+He has not acquired a fortune; the fortune has acquired him.
+ -- Bion
+%
+He hath eaten me out of house and home.
+ -- William Shakespeare, "Henry IV"
+%
+He heard the snick of a rifle bolt and found himself peering down the muzzle
+of a weapon held by a drunken liquor store owner -- "There's a conflict," he
+said, "there's a conflict between land and people... the people have to go..."
+ -- Stan Ridgeway, "Call of the West"
+%
+He is a man capable of turning any colour into grey.
+ -- John LeCarre
+%
+He is considered a most graceful speaker
+who can say nothing in the most words.
+%
+He is no lawyer who cannot take two sides.
+%
+He is not only dull himself, he is the cause of dullness in others.
+ -- Samuel Johnson
+%
+He is now rising from affluence to poverty.
+ -- Mark Twain
+%
+He is the best of men who dislikes power.
+ -- Mohammed
+%
+He is truly wise who gains wisdom from another's mishap.
+%
+He jests at scars who never felt a wound.
+ -- William Shakespeare, "Romeo and Juliet, II. 2"
+%
+He keeps differentiating, flying off on a tangent.
+%
+He knew the tavernes well in every toun.
+ -- Geoffrey Chaucer
+%
+He knows not how to know who knows not also how to unknow.
+ -- Sir Richard Burton
+%
+He laughs at every joke three times... once when it's told,
+once when it's explained, and once when he understands it.
+%
+He looked at me as if I were a side dish he hadn't ordered.
+ -- Ring Lardner
+%
+He missed an invaluable opportunity to hold his tongue.
+ -- Andrew Lang
+%
+He only knew his iron spine held up the sky -- he didn't realize his brain
+had fallen to the ground.
+ -- The Book of Serenity
+%
+(He opens a tolm and begins.)
+
+ It says: "In the beginning was the Word."
+ Already I am stopped. It seems absurd.
+ The Word does not deserve the highest prize,
+ I must translate it otherwise.
+ If I am well inspired and not blind.
+ It says: "In the beginning was the Mind."
+ Ponder that first line, wait and see,
+ Lest you should write too hastily.
+ Is the Mind the all-creating source?
+ It ought to say: "In the beginning there was Force."
+ Yet something warns me as I grasp the pen,
+ That my translation must be changed again.
+ The spirit helps me. Now it is exact.
+ I write: "In the beginning was the Act."
+ -- Johann Wolfgang von Goethe, "Faust"
+%
+[He] played the King as if afraid someone else might play the ace.
+ -- Unattributed review of a performance of King Lear
+
+My tears stuck in their little ducts, refusing to be jerked.
+ -- Peter Stack, movie review
+
+His performance is so wooden you want to spray him with Liquid Pledge.
+ -- John Stark, movie review
+%
+He played the king as if afraid someone else would play the ace.
+ -- John Mason Brown, drama critic
+%
+He tells you when you've got on too much lipstick,
+And helps you with your girdle when your hips stick.
+ -- Ogden Nash, on the perfect husband
+%
+He that breaks a thing to find out what it is has left the path of wisdom.
+ -- J. R. R. Tolkien
+%
+He that bringeth a present, findeth the door open.
+ -- Scottish proverb
+%
+He that composes himself is wiser than he that composes a book.
+ -- Benjamin Franklin
+%
+He that is giddy thinks the world turns round.
+ -- William Shakespeare, "The Taming of the Shrew"
+%
+He that teaches himself has a fool for a master.
+ -- Benjamin Franklin
+%
+He that would govern others, first should be the master of himself.
+%
+He thinks the Gettysburg Address is where Lincoln lived.
+ -- Wanda, "A Fish Called Wanda"
+%
+He thought he saw an albatross
+That fluttered 'round the lamp.
+He looked again and saw it was
+A penny postage stamp.
+"You'd best be getting home," he said,
+"The nights are rather damp."
+%
+He thought of Musashi, the Sword Saint, standing in his garden more than
+three hundred years ago. "What is the 'Body of a rock'?" he was asked.
+In answer, Musashi summoned a pupil of his and bid him kill himself by
+slashing his abdomen with a knife. Just as the pupil was about to comply,
+the Master stayed his hand, saying, "That is the 'Body of a rock'."
+ -- Eric Van Lustbader
+%
+[He] took me into his library and showed me his books, of which he had
+a complete set.
+ -- Ring Lardner
+%
+He walks as if balancing the family tree on his nose.
+%
+He was a cowboy, mister, and he loved the land. He loved it so much he
+made a woman out of dirt and married her. But when he kissed her, she
+disintegrated. Later, at the funeral, when the preacher said, "Dust to
+dust," some people laughed, and the cowboy shot them. At his hanging, he
+told the others, "I'll be waiting for you in heaven -- with a gun."
+ -- Jack Handey
+%
+He was a fiddler, and consequently a rogue.
+ -- Jonathan Swift
+%
+He was a modest, good-humored boy. It was Oxford that made him
+insufferable.
+%
+He was part of my dream, of course --
+but then I was part of his dream too.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+He was so narrow-minded he could see through a keyhole with both eyes.
+%
+He was the sort of person whose personality
+would be greatly improved by a terminal illness.
+%
+He who always plows a straight furrow is in a rut.
+%
+He who attacks the fundamentals of the American
+broadcasting industry attacks democracy itself.
+ -- William S. Paley, chairman of CBS
+%
+He who dares the wrong, acts right, that's how it happens!
+ -- Poul Henningsen (1894-1967)
+%
+He who despairs over an event is a coward, but he who holds hopes for
+the human condition is a fool.
+ -- Albert Camus
+%
+He who despises himself nevertheless esteems himself as a self-despiser.
+ -- Friedrich Nietzsche
+%
+He who enters his wife's dressing room is a philosopher or a fool.
+ -- Honore de Balzac
+%
+He who fears the unknown may one day flee from his own backside.
+ -- Sinbad
+%
+He who fights and runs away lives to fight another day.
+%
+He who foresees calamities suffers them twice over.
+%
+He who has a shady past knows that nice guys finish last.
+%
+He who has but four and spends five has no need for a wallet.
+%
+He who has imagination without learning has wings but no feet.
+%
+He who has the courage to laugh is almost as much
+a master of the world as he who is ready to die.
+ -- Giacomo Leopardi
+%
+He who hates vices hates mankind.
+%
+He who hesitates is a damned fool.
+ -- Mae West
+%
+He who hesitates is last.
+%
+He who hesitates is sometimes saved.
+%
+He who hoots with owls by night cannot soar with eagles by day.
+%
+He who invents adages for others to peruse
+takes along rowboat when going on cruise.
+%
+He who is content with his lot probably has a lot.
+%
+He who is flogged by fate and laughs the louder is a masochist.
+%
+He who is good for making excuses is seldom good for anything else.
+%
+He who is in love with himself has at least this advantage -- he won't
+encounter many rivals.
+ -- Georg Lichtenberg, "Aphorisms"
+%
+He who is intoxicated with wine will be sober again in the course of the
+night, but he who is intoxicated by the cupbearer will not recover his
+senses until the day of judgment.
+ -- Saadi
+%
+He who is known as an early riser need not get up until noon.
+%
+He who knows, does not speak. He who speaks, does not know.
+ -- Lao Tsu
+%
+He who knows not and knows that he knows not is ignorant. Teach him.
+He who knows not and knows not that he knows not is a fool. Shun him.
+He who knows and knows not that he knows is asleep. Wake him.
+%
+He who knows nothing, knows nothing.
+But he who knows he knows nothing knows something.
+And he who knows someone whose friend's wife's brother knows nothing,
+ he knows something. Or something like that.
+%
+He who knows others is wise.
+He who knows himself is enlightened.
+ -- Lao Tsu
+%
+He who knows that enough is enough will always have enough.
+ -- Lao Tsu
+%
+He who laughs has not yet heard the bad news.
+ -- Bertolt Brecht
+%
+He who laughs last -- missed the punch line.
+%
+He who laughs last hasn't been told the terrible truth.
+%
+He who laughs last is probably your boss.
+%
+He who laughs last usually had to have joke explained.
+%
+He who laughs, lasts.
+%
+He who lives without folly is less wise than he believes.
+%
+He who loses, wins the race,
+And parallel lines meet in space.
+ -- John Boyd, "Last Starship from Earth"
+%
+He who makes a beast of himself gets rid of the pain of being a man.
+ -- Dr. Johnson
+%
+He who minds his own business is never unemployed.
+%
+He who renders warfare fatal to all engaged in it will
+be the greatest benefactor the world has yet known.
+ -- Sir Richard Burton
+%
+He who slings mud generally loses ground.
+ -- Adlai E. Stevenson
+%
+He who slings mud loses ground.
+ -- Chinese proverb
+%
+He who spends a storm beneath a tree, takes life with a grain of TNT.
+%
+He who steps on others to reach the top has good balance.
+%
+He who walks on burning coals is sure to get burned.
+ -- Sinbad
+%
+He who wonders discovers that this in itself is wonder.
+ -- M. C. Escher
+%
+He who writes with no misspelled words has prevented a first suspicion
+on the limits of his scholarship or, in the social world, of his general
+education and culture.
+ -- Julia Norton McCorkle
+%
+HEAD CRASH!! FILES LOST!!
+Details at 11.
+%
+Health is merely the slowest possible rate at which one can die.
+%
+Health nuts are going to feel stupid someday,
+lying in hospitals dying of nothing.
+ -- Redd Foxx
+%
+Hear about...
+ the Californian terrorist that tried to blow up a bus?
+ Burned his lips on the exhaust pipe.
+%
+Hear about...
+ the fellow who, upon being told by his shrewish wife that she
+ would dance on his grave, promptly provided for a burial at sea?
+%
+Hear about...
+ the female activist who went berserk during a demonstration and
+ attacked a karate-trained cop with a deadly weapon. She ended
+ up a chopped libber?
+%
+Hear about...
+ the guru who refused Novocaine while having a tooth pulled because
+ he wanted to transcend dental medication?
+%
+Hear about...
+ the pessimistic historian whose latest book has chapter headings
+ that read "World War One","World War Two" and "Watch This
+ Space"?
+%
+Hear about...
+ the wild office Christmas party in a completely automated
+ company -- the photocopier got drunk and tried to undo the
+ typewriter's ribbon?
+%
+Hear about...
+ the young Chinese woman who just won the lottery?
+ One fortunate cookie...
+%
+Hear me, my chiefs, I am tired; my heart is sick and sad.
+From where the sun now stands I Will Fight No More Forever.
+ -- Chief Joseph of the Nez Perce
+%
+Heard that the next Space Shuttle is supposed to carry several
+Guernsey cows? It's gonna be the herd shot 'round the world.
+%
+Hearts will never be practical until they can be made unbreakable.
+ -- Frank Morgan as The Wizard, "The Wizard of Oz"
+%
+Heaven and earth were created all together in the same instant,
+on October 23rd, 4004 B.C. at nine o'clock in the morning.
+ -- Dr. John Lightfoot,
+ Vice-chancellor of Cambridge University
+%
+Heaven, n.:
+ A place where the wicked cease from troubling you with talk of
+ their personal affairs, and the good listen with attention
+ while you expound your own.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Heavier than air flying machines are impossible.
+ -- Lord Kelvin, President, Royal Society, c. 1895
+%
+Heavy, adj.:
+ Seduced by the chocolate side of the force.
+%
+Hedonist for hire... no job too easy!
+%
+Heisenberg may have been here.
+%
+Heisenberg may have slept here.
+%
+Hell hath no fury like a bureaucrat scorned.
+ -- Milton Friedman
+%
+Hell hath no limits, nor is circumscribed in one self place,
+for where we are is Hell, and where Hell is there must we ever be.
+ -- Christopher Marlowe, "Doctor Faustus"
+%
+Hell, if you don't try to remake someone,
+how are they supposed to know you care?
+%
+Hell is empty and all the devils are here.
+ -- William Shakespeare, "The Tempest"
+%
+Hell, n.:
+ Truth seen too late.
+%
+Heller's Law:
+ The first myth of management is that it exists.
+
+Johnson's Corollary:
+ Nobody really knows what is going on anywhere within the
+ organization.
+%
+Hello. Jim Rockford's machine, this is Larry Doheny's machine. Will you
+please have your master call my master at his convenience? Thank you.
+Thank you. Thank you. Thank you. Thank you. Thank you.
+%
+Hello, friend! You say things aren't going too well? You say you have a
+date with your favorite girl when it starts raining so hard you can't see?
+And you're out on some back road when the car stalls and won't start, so
+you set off across the fields, and 50 feet of barbed wire hits you right
+smack in the puss? And then there's a big explosion behind you and you
+don't hear your girl screaming any more?
+
+ Well, take a walk in the sun and hold your head up high!
+ You'll show the world; you'll tell them where to get off!
+ You'll never give up, never give up, never give up -- that ship!
+%
+"Hello," he lied.
+ -- Don Carpenter, quoting a Hollywood agent
+%
+Hell's broken loose.
+ -- Robert Greene
+%
+Help! I'm trapped in a Chinese computer factory!
+%
+HELP! Man trapped in a human body!
+%
+HELP! MY TYPEWRITER IS BROKEN!
+ -- E. E. CUMMINGS
+%
+Help a swallow land at Capistrano.
+%
+Help fight continental drift.
+%
+HELP!!!! I'm being held prisoner in /usr/share/games/fortune!
+%
+Help me, I'm a prisoner in a Fortune cookie file!
+%
+Help stamp out and abolish redundancy!
+%
+Help stamp out Mickey-Mouse computer interfaces -- Menus are for Restaurants!
+%
+Her days were spent in a kind of slow bustle; always busy without
+getting on, always behind hand and lamenting it, without altering
+her ways; wishing to be an economist, without contrivance or
+regularity; dissatisfied with her servants, without skill to make
+them better, and whether helping, or reprimanding, or indulging
+them, without any power of engaging their respect.
+ -- J. Austen
+%
+Her locks an ancient lady gave
+Her loving husband's life to save;
+And men -- they honored so the dame --
+Upon some stars bestowed her name.
+
+But to our modern married fair,
+Who'd give their lords to save their hair,
+No stellar recognition's given.
+There are not stars enough in heaven.
+%
+Here at the Phone Company, we serve all kinds of people;
+from Presidents and Kings to the scum of the earth...
+%
+Here comes the orator, with his flood of words and his drop of reason.
+%
+Here I am again right where I know I shouldn't be
+I've been caught inside this trap too many times
+I must've walked these steps and said these words a
+ thousand times before
+It seems like I know everybody's lines.
+ -- David Bromberg, "How Late'll You Play 'Til?"
+%
+Here I am, fifty-eight, and I still don't know what I want to be when
+I grow up.
+ -- Peter Drucker
+%
+Here I sit, broken-hearted,
+All logged in, but work unstarted.
+First net.this and net.that,
+And a hot buttered bun for net.fat.
+
+The boss comes by, and I play the game,
+Then I turn back to net.flame.
+Is there a cure (I need your views),
+For someone trapped in net.news?
+
+I need your help, I say 'tween sobs,
+'Cause I'll soon be listed in net.jobs.
+%
+Here in my heart, I am Helen;
+ I'm Aspasia and Hero, at least.
+I'm Judith, and Jael, and Madame de Stael;
+ I'm Salome, moon of the East.
+
+Here in my soul I am Sappho;
+ Lady Hamilton am I, as well.
+In me Recamier vies with Kitty O'Shea,
+ With Dido, and Eve, and poor Nell.
+
+I'm all of the glamorous ladies
+ At whose beckoning history shook.
+But you are a man, and see only my pan,
+ So I stay at home with a book.
+ -- Dorothy Parker
+%
+Here is a simple experiment that will teach you an important electrical
+lesson: On a cool, dry day, scuff your feet along a carpet, then reach
+your hand into a friend's mouth and touch one of his dental fillings.
+Did you notice how your friend twitched violently and cried out in
+pain? This teaches us that electricity can be a very powerful force,
+but we must never use it to hurt others unless we need to learn an
+important electrical lesson.
+
+It also teaches us how an electrical circuit works. When you scuffed
+your feet, you picked up batches of "electrons", which are very small
+objects that carpet manufacturers weave into carpets so they will
+attract dirt. The electrons travel through your bloodstream and
+collect in your finger, where they form a spark that leaps to your
+friend's filling, then travels down to his feet and back into the
+carpet, thus completing the circuit.
+
+Amazing Electronic Fact: If you scuffed your feet long enough without
+touching anything, you would build up so many electrons that your
+finger would explode! But this is nothing to worry about unless you
+have carpeting.
+ -- Dave Barry, "What is Electricity?"
+%
+Here is a test to find whether your mission on earth is finished:
+if you're alive, it isn't.
+%
+Here is the fact of the week, maybe even the fact of the month. According
+to probably reliable sources, the Coca-Cola people are experiencing severe
+marketing anxiety in China.
+
+The words "Coca-Cola" translate into Chinese as either (depending on the
+inflection) "wax-fattened mare" or "bite the wax tadpole".
+
+Bite the wax tadpole. There is a sort of rough justice, is there not?
+
+The trouble with this fact, as lovely as it is, is that it's hard to get
+a whole column out of it. I'd like to teach the world to bite a wax
+tadpole. Coke -- it's the real wax-fattened mare. Not bad, but broad
+satiric vistas do not open up.
+ -- John Carrol, San Francisco Chronicle
+%
+HERE LIES LESTER MOORE
+SHOT 4 TIMES WITH A .44
+NO LES
+NO MOORE
+ -- tombstone, in Tombstone, AZ
+%
+Here lies my wife: her let her lie!
+Now she's at rest, and so am I.
+ -- John Dryden, epitaph intended for his wife
+%
+Here there by tygers.
+%
+HERE'S A GOOD JOKE to do during an earthquake. Straddle a big crack in
+the earth and if it opens wider, go, "Whoa! Whoa!" and flap your arms
+around as if you're going to fall.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Here's something to think about: How come you never see a headline like
+`Psychic Wins Lottery.'
+ -- Jay Leno
+%
+Herth's Law:
+ He who turns the other cheek too far gets it in the neck.
+%
+He's been like a father to me,
+He's the only DJ you can get after three,
+I'm an all-night musician in a rock and roll band,
+And why he don't like me I don't understand.
+ -- The Byrds
+%
+He's dead, Jim.
+%
+He's got the heart of a little child,
+and he keeps it in a jar on his desk.
+%
+He's just a politician trying to save both his faces...
+%
+He's just like Capistrano, always ready for a few swallows.
+%
+He's like a function -- he returns a value, in the form of
+his opinion. It's up to you to cast it into a void or not.
+ -- Phil Lapsley
+%
+He's the kind of guy, that, well, if you were ever in a jam he'd
+be there... with two slices of bread and some chunky peanut butter.
+%
+He's the kind of man for the times that need the kind of man he is.
+%
+Heuristics are bug ridden by definition.
+If they didn't have bugs, then they'd be algorithms.
+%
+Hewett's Observation:
+ The rudeness of a bureaucrat is inversely proportional to his or
+ her position in the governmental hierarchy and to the number of
+ peers similarly engaged.
+%
+Hey, diddle, diddle the overflow pdl
+To get a little more stack;
+If that's not enough then you lose it all
+And have to pop all the way back.
+%
+Hey, Jim, it's me, Susie Lillis from the laundromat. You said you were
+gonna call and it's been two weeks. What's wrong, you lose my number?
+%
+HEY KIDS! ANN LANDERS SAYS:
+ Be sure it's true, when you say "I love you". It's a sin to
+ tell a lie. Millions of hearts have been broken, just because
+ these words were spoken.
+%
+Hey, what do you expect from a culture that
+*drives* on *parkways* and *parks* on *driveways*?
+ -- Gallagher
+%
+Hi! I'm Larry. This is my brother Bob, and this is my other brother
+Jimbo. We thought you might like to know the names of your assailants.
+%
+Hi! You have reached 962-0129. None of us are here to answer the phone and
+the cat doesn't have opposing thumbs, so his messages are illegible. Please
+leave your name and message after the beep...
+%
+Hi! How are things going?
+ (just fine, thank you...)
+Great! Say, could I bother you for a question?
+ (you just asked one...)
+Well, how about one more?
+ (one more than the first one?)
+Yes.
+ (you already asked that...)
+[at this point, Alphonso gets smart... ]
+May I ask two questions, sir?
+ (no.)
+May I ask ONE then?
+ (nope...)
+Then may I ask, sir, how I may ask you a question?
+ (yes, you may.)
+Sir, how may I ask you a question?
+ (you must ask for retroactive question asking privileges for
+ the number of questions you have asked, then ask for that
+ number plus two, one for the current question, and one for the
+ next one)
+Sir, may I ask nine questions?
+ (go right ahead...)
+%
+Hi, I'm Preston A. Mantis, president of Consumers Retail Law Outlet.
+As you can see by my suit and the fact that I have all these books of
+equal height on the shelves behind me, I am a trained legal attorney.
+Do you have a car or a job? Do you ever walk around? If so, you
+probably have the makings of an excellent legal case. Although of
+course every case is different, I would definitely say that based on my
+experience and training, there's no reason why you shouldn't come out
+of this thing with at least a cabin cruiser.
+
+Remember, at the Preston A. Mantis Consumers Retail Law Outlet, our
+motto is: "It is very difficult to disprove certain kinds of pain."
+ -- Dave Barry, "Pain and Suffering"
+%
+Hi Jimbo. Dennis. Really appreciate the help on the income tax.
+You wanna help on the audit now?
+%
+Hi there! This is just a note from me, to you, to tell you, the person
+reading this note, that I can't think up any more famous quotes, jokes,
+nor bizarre stories, so you may as well go home.
+%
+Hickery Dickery Dock,
+The mice ran up the clock,
+The clock struck one,
+The others escaped with minor injuries.
+%
+Hideously disfigured by an ancient Indian curse?
+
+ WE CAN HELP!
+
+Call (511) 338-0959 for an immediate appointment.
+%
+Hier liegt ein Mann ganz ohnegleich;
+Im Leibe dick, an Suenden reich.
+Wir haben ihn ins Grab gesteckt, Here lies a man with sundry flaws
+Weil es uns duenkt er sei verreckt. And numerous Sins upon his head;
+ We buried him today because
+ As far as we can tell, he's dead.
+ -- PDQ Bach's epitaph, as requested by his cousin Betty
+ Sue Bach and written by the local doggerel catcher;
+ "The Definitive Biography of PDQ Bach", Peter
+ Schickele
+%
+Higgeldy Piggeldy,
+Hamlet of Elsinore
+Ruffled the critics by dropping this bomb:
+"Phooey on Freud and his Psychoanalysis --
+Oedipus, Shmoedipus, I just loved Mom."
+%
+Higgins: Doolittle, you're either an honest man or a rogue.
+Doolittle: A little of both, Guv'nor. Like the rest of us, a
+ little of both.
+ -- Shaw, "Pygmalion"
+%
+High heels are a device invented by a woman
+who was tired of being kissed on the forehead.
+%
+High Priest: Armaments Chapter One, verses nine through twenty-seven:
+Bro. Maynard: And Saint Attila raised the Holy Hand Grenade up on high
+ saying, "Oh Lord, Bless us this Holy Hand Grenade, and with it
+ smash our enemies to tiny bits." And the Lord did grin, and the
+ people did feast upon the lambs, and stoats, and orangutans, and
+ breakfast cereals, and lima bean-
+High Priest: Skip a bit, brother.
+Bro. Maynard: And then the Lord spake, saying: "First, shalt thou take
+ out the holy pin. Then shalt thou count to three. No more, no less.
+ *Three* shall be the number of the counting, and the number of the
+ counting shall be three. *Four* shalt thou not count, and neither
+ count thou two, excepting that thou then goest on to three. Five is
+ RIGHT OUT. Once the number three, being the third number be reached,
+ then lobbest thou thy Holy Hand Grenade towards thy foe, who, being
+ naughty in my sight, shall snuff it. Amen.
+All: Amen.
+ -- Monty Python, "The Holy Hand Grenade"
+%
+HIGH TECHNOLOGY:
+ A California innovation composed
+ of equal parts of silicon and marijuana.
+%
+Higher education helps your earning capacity. Ask any college professor.
+%
+Hildebrant's Principle:
+ If you don't know where you are going,
+ any road will get you there.
+%
+Him: "Your skin is so soft. Are you a model?"
+Her: "No," [blush] "I'm a cosmetologist."
+Him: "Really? That's incredible...
+ It must be very tough to handle weightlessness."
+ -- "The Jerk"
+%
+Hindsight is always 20:20.
+ -- Billy Wilder
+%
+Hippogriff, n.:
+ An animal (now extinct) which was half horse and half griffin.
+ The griffin was itself a compound creature, half lion and half
+ eagle. The hippogriff was actually, therefore, only one quarter
+ eagle, which is two dollars and fifty cents in gold. The study
+ of zoology is full of surprises.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Hire the morally handicapped.
+%
+His designs were strictly honourable, as the phrase is: that is, to rob
+a lady of her fortune by way of marriage.
+ -- Henry Fielding, "Tom Jones"
+%
+...his disciples lead him in; he just does the rest.
+ -- Tommy
+%
+His eyes were cold. As cold as the bitter winter snow that was falling
+outside. Yes, cold and therefore difficult to chew...
+%
+His followers called him Mahasamatman and said he was a god. He preferred
+to drop the Maha- and the -atman, however, and called himself Sam. He never
+claimed to be a god. But then, he never claimed not to be a god. Circum-
+stances being what they were, neither admission could be of any benefit.
+Silence, though, could. It was in the days of the rains that their prayers
+went up, not from the fingering of knotted prayer cords or the spinning of
+prayer wheels, but from the great pray-machine in the monastery of Ratri,
+goddess of the Night. The high-frequency prayers were directed upward through
+the atmosphere and out beyond it, passing into that golden cloud called the
+Bridge of the Gods, which circles the entire world, is seen as a bronze
+rainbow at night and is the place where the red sun becomes orange at midday.
+Some of the monks doubted the orthodoxy of this prayer technique...
+ -- Roger Zelazny, "Lord of Light"
+%
+His great aim was to escape from civilization, and, as soon as he had
+money, he went to Southern California.
+%
+His heart was yours from the first moment that you met.
+%
+His ideas of first-aid stopped short of squirting soda water.
+ -- P. G. Wodehouse
+%
+His life was formal; his actions seemed ruled with a ruler.
+%
+His mind is like a steel trap: full of mice.
+ -- Foghorn Leghorn
+%
+His super power is to turn into a scotch terrier.
+%
+Historians have now definitely established that Juan Cabrillo, discoverer
+of California, was not looking for Kansas, thus setting a precedent that
+continues to this day.
+ -- Wayne Shannon
+%
+History books which contain no lies are extremely dull.
+%
+History has much to say on following the proper procedures. From a history
+of the Mexican revolution:
+
+ "Hildago was later defeated at Guadalajara. The rebel army was
+captured on its way through the mountains. All were courtmartialed and
+shot, except Hildago, because he was a priest. He was handed over to
+the bishop of Durango who excommunicated him and returned him to the
+army where he was then executed."
+%
+History is curious stuff
+ You'd think by now we had enough
+Yet the fact remains I fear
+ They make more of it every year.
+%
+History is nothing but a collection of fables and useless trifles,
+cluttered up with a mass of unnecessary figures and proper names.
+ -- Leo Tolstoy
+%
+History is on our side (as long as we can control the historians).
+%
+History is the version of past events that people have decided to agree on.
+ -- Napoleon Bonaparte, "Maxims"
+%
+History repeats itself. That's one thing wrong with history.
+%
+History repeats itself -- the first time as a tragi-comedy, the second
+time as bedroom farce.
+%
+History repeats itself only if one does not listen the first time.
+%
+History shows that the human mind, fed by constant accessions of knowledge,
+periodically grows too large for its theoretical coverings, and bursts them
+asunder to appear in new habiliments, as the feeding and growing grub, at
+intervals, casts its too narrow skin and assumes another... Truly the imago
+state of Man seems to be terribly distant, but every moult is a step gained.
+ -- Charles Darwin, from "Origin of the Species"
+%
+Hit them biscuits with another touch of gravy,
+Burn that sausage just a match or two more done.
+Pour my black old coffee longer,
+While that smell is gettin' stronger
+A semi-meal ain't nuthin' much to want.
+
+Loan me ten, I got a feelin' it'll save me,
+With an ornery soul who don't shoot pool for fun,
+If that coat'll fit you're wearin',
+The Lord'll bless your sharin'
+A semi-friend ain't nuthin' much to want.
+
+And let me halfway fall in love,
+For part of a lonely night,
+With a semi-pretty woman in my arms.
+Yes, I could halfway fall in deep--
+Into a snugglin', lovin' heap,
+With a semi-pretty woman in my arms.
+ -- Elroy Blunt
+%
+Hitchcock's Staple Principle:
+ The stapler runs out of staples
+ only while you are trying to staple something.
+%
+Hitler used methods against white men in Europe, which by tacit
+agreement between the cultural European nations were only to be
+used against the coloured.
+ -- Poul Henningsen (1894-1967)
+%
+Hlade's Law:
+ If you have a difficult task, give it to a lazy person --
+ they will find an easier way to do it.
+%
+Hoaars-Faisse Gallery presents:
+An exhibit of works by the artist known only as Pretzel.
+
+The exhibit includes several large conceptual works using non-traditional
+media and found objects including old sofa-beds, used mace canisters,
+discarded sanitary napkins and parts of freeways. The artist explores
+our dehumanization due to high technology and unresponsive governmental
+structures in a post-industrial world. She/he (the artist prefers to
+remain without gender) strives to create dialogue between viewer and
+creator, to aid us in our quest to experience contemporary life with its
+inner-city tensions, homelessness, global warming and gender and
+class-based stress. The works are arranged to lead us to the essence of
+the argument: that the alienation of the person/machine boundary has
+sapped the strength of our voices and must be destroyed for society to
+exist in a more fundamental sense.
+%
+Hoare's Law of Large Problems:
+ Inside every large problem is a small
+ problem struggling to get out.
+%
+Hodie natus est radici frater.
+%
+Hoffer's Discovery:
+ The grand act of a dying institution is to issue a newly
+ revised, enlarged edition of the policies and procedures manual.
+%
+Hofstadter's Law:
+ It always takes longer than you expect, even when you take
+ Hofstadter's Law into account.
+%
+HOGAN'S HEROES DRINKING GAME --
+ Take a shot every time:
+
+-- Sergeant Schultz says, "I knoooooowww nooooothing!"
+-- General Burkhalter or Major Hochstetter intimidate/insult Colonel Klink.
+-- Colonel Klink falls for Colonel Hogan's flattery.
+-- One of the prisoners sneaks out of camp (one shot for each prisoner to go).
+-- Colonel Klink snaps to attention after answering the phone (two shots
+ if it's one of our heroes on the other end).
+-- One of the Germans is threatened with being sent to the Russian front.
+-- Corporal Newkirk calls up a German in his phoney German accent, and
+ tricks him (two shots if it's Colonel Klink).
+-- Hogan has a romantic interlude with a beautiful girl from the underground.
+-- Colonel Klink relates how he's never had an escape from Stalag 13.
+-- Sergeant Schultz gives up a secret (two shots if he's bribed with food).
+-- The prisoners listen to the Germans' conversation by a hidden transmitter.
+-- Sergeant Schultz "captures" one of the prisoners after an escape.
+-- Lebeau pronounces "colonel" as "cuh-loh-`nell".
+-- Carter builds some kind of device (two shots if it's not explosive).
+-- Lebeau wears his apron.
+-- Hogan says "We've got no choice" when the someone claims that the
+ plan is impossible.
+-- The prisoners capture an important German, and sneak him out the tunnel.
+%
+Hollerith, v.:
+ What thou doest when thy phone is on the fritzeth.
+%
+Hollywood is where if you don't have happiness you send out for it.
+ -- Rex Reed
+%
+Holy Dilemma! Is this the end for the Caped Crusader and the Boy Wonder?
+Will the Joker and the Riddler have the last laugh?
+
+ Tune in again tomorrow:
+ same Bat-time, same Bat-channel!
+%
+HOLY MACRO!
+%
+Home is the place where, when you have to go there,
+they have to take you in.
+ -- Robert Frost, "The Death of the Hired Man"
+%
+Home life as we understand it is no more natural to us than a
+cage is to a cockatoo.
+ -- George Bernard Shaw
+%
+Home of Doberman Propulsion Laboratories:
+The ultimate in watchdog weaponry.
+ -- Chris Shaw
+%
+Home on the Range was originally written in beef-flat.
+%
+"Home, Sweet Home" must surely have been written by a bachelor.
+ -- Samuel Butler
+%
+Honesty is for the most part less profitable than dishonesty.
+ -- Plato
+%
+Honesty is the best policy, but insanity is a better defense.
+%
+Honesty pays, but it doesn't seem to pay enough to suit some people.
+ -- F. M. Hubbard
+%
+Honesty's the best policy.
+ -- Miguel de Cervantes
+%
+Honeymoon, n.:
+ A short period of doting between dating and debting.
+ -- Ray C. Bandy
+%
+Honi soit la vache qui rit.
+%
+Honk if you hate bumper stickers that say "Honk if ..."
+%
+Honk if you love peace and quiet.
+%
+Honorable, adj.:
+ Afflicted with an impediment in one's reach. In legislative
+ bodies, it is customary to mention all members as honorable; as,
+ "the honorable gentleman is a scurvy cur."
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Hope is a good breakfast, but it is a bad supper.
+ -- Francis Bacon
+%
+Hope is a waking dream.
+ -- Aristotle
+%
+Hope not, lest ye be disappointed.
+ -- M. Horner
+%
+Hope that the day after you die is a nice day.
+%
+Hoping to goodness is not theologically sound.
+ -- Peanuts
+%
+Horace's best ode would not please a young woman as much
+as the mediocre verses of the young man she is in love with.
+ -- Moore
+%
+Horner's Five Thumb Postulate:
+ Experience varies directly with equipment ruined.
+%
+Horngren's Observation:
+ Among economists, the real world is often a special case.
+%
+Hors d'oeuvres -- a ham sandwich cut into forty pieces.
+ -- Jack Benny
+%
+Horse sense is the thing a horse has which keeps it from betting on people.
+ -- W. C. Fields
+%
+HOST SYSTEM NOT RESPONDING, PROBABLY DOWN. DO YOU WANT TO WAIT? (Y/N)
+%
+HOST SYSTEM RESPONDING, PROBABLY UP...
+%
+Hotels are tired of getting ripped off. I checked into a hotel and they
+had towels from my house.
+ -- Mark Guido
+%
+Houdini escaping from New Jersey!
+%
+Household hint:
+ If you are out of cream for your coffee,
+ mayonnaise makes a dandy substitute.
+%
+Housework can kill you if done right.
+ -- Erma Bombeck
+%
+Houston, Tranquillity Base here. The Eagle has landed.
+ -- Neil Armstrong
+%
+How apt the poor are to be proud.
+ -- William Shakespeare, "Twelfth-Night"
+%
+How can you be in two places at once
+when you're not anywhere at all?
+%
+How can you do "New Math" problems with an "Old Math" mind?
+ -- Schulz
+%
+How can you govern a nation which has 246 kinds of cheese?
+ -- Charles de Gaulle
+%
+How can you have any pudding if you don't eat your meat?
+ -- Pink Floyd
+%
+How can you prove whether at this moment we are sleeping, and all our
+thoughts are a dream; or whether we are awake, and talking to one another
+in the waking state?
+ -- Plato
+%
+How can you think and hit at the same time?
+ -- Yogi Berra
+%
+How can you work when the system's so crowded?
+%
+How come everyone's going so slow if it's called rush hour?
+%
+How come financial advisors never seem to be as wealthy as they
+claim they'll make you?
+%
+How come only your friends step on your new white sneakers?
+%
+How come we never talk anymore?
+%
+How come wrong numbers are never busy?
+%
+How comes it to pass, then, that we appear such cowards
+in reasoning, and are so afraid to stand the test of ridicule?
+ -- A. Cooper
+%
+How could they think women a recreation?
+Or the repetition of bodies of steady interest?
+Only the ignorant or the busy could. That elm
+of flesh must prove a luxury of primes;
+be perilous and dear with rain of an alternate earth.
+Which is not to damn the forested China of touching.
+I am neither priestly nor tired, and the great knowledge
+of breasts with their loud nipples congregates in me.
+The sudden nakedness, the small ribs, the mouth.
+Splendid. Splendid. Splendid. Like Rome. Like loins.
+A glamour sufficient to our long marvelous dying.
+I say sufficient and speak with earned privilege,
+for my life has been eaten in that foliate city.
+To ambergris. But not for recreation.
+I would not have lost so much for recreation.
+
+Nor for love as the sweet pretend: the children's game
+of deliberate ignorance of each to allow the dreaming.
+Not for the impersonal belly nor the heart's drunkenness
+have I come this far, stubborn, disastrous way.
+But for relish of those archipelagoes of person.
+To hold her in hand, closed as any sparrow,
+and call and call forever till she turn from bird
+to blowing woods. From woods to jungle. Persimmon.
+To light. From light to princess. From princess to woman
+in all her fresh particularity of difference.
+Then oh, through the underwater time of night
+indecent and still, to speak to her without habit.
+This I have done with my life, and am content.
+I wish I could tell you how it is in that dark,
+standing in the huge singing and the alien world.
+ -- Jack Gilbert, "Don Giovanni on his way to Hell"
+%
+How do I love thee? My accumulator overflows.
+%
+How do you explain school to a higher intelligence?
+ -- Elliot, "E.T."
+%
+How doth the little crocodile
+ Improve his shining tail,
+And pour the waters of the Nile
+ On every golden scale!
+
+How cheerfully he seems to grin,
+ How neatly spreads his claws,
+And welcomes little fishes in,
+ With gently smiling jaws!
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+How doth the VAX's C-compiler
+ Improve its object code.
+And even as we speak does it
+ Increase the system load.
+
+How patiently it seems to run
+ And spit out error flags,
+While users, with frustration, all
+ Tear all their clothes to rags.
+%
+How is the world ruled, and how do wars start? Diplomats tell lies to
+journalists, and they believe what they read.
+ -- Karl Kraus, "Aphorisms and More Aphorisms"
+%
+How kind of you to be willing to live someone's life for them.
+%
+How many "coming men" has one known! Where on earth do they all go to?
+ -- Sir Arthur Wing Pinero
+%
+"How many hors d'oeuvres you are allowed to take off a tray being
+carried by a waiter at a nice party?"
+
+Two, but there are ways around it, depending on the style of the hors
+d'oeuvre. If they're those little pastry things where you can't tell
+what's inside, you take one, bite off about two-thirds of it, then
+say: "This is cheese! I hate cheese!" Then you put the rest of it
+back on the tray and bite another one and go, "Darn it! Another
+cheese!" and so on.
+ -- Dave Barry, "The Stuff of Etiquette"
+%
+How many priests are needed for a Boston Mass?
+%
+How many software engineers does it take to change a lightbulb?
+None: "We'll document it in the manual."
+%
+How many weeks are there in a light year?
+%
+How much does it cost to entice a dope-smoking UNIX system guru to
+Dayton?
+ -- Brian Boyle, UNIX/WORLD's First Annual Salary Survey
+%
+How much does she love you?
+Less than you'll ever know.
+%
+How much for your women? I want to buy your
+daughter... how much for the little girl?
+ -- Jake Blues, "The Blues Brothers"
+%
+How much net work could a network work, if a network could net work?
+%
+How much of their influence on you is a result of your influence on them?
+%
+How often I found where I should be going
+only by setting out for somewhere else.
+ -- R. Buckminster Fuller
+%
+How sharper than a hound's tooth it is to have a thankless serpent.
+%
+How sharper than a serpent's tooth is a sister's "See?"
+ -- Linus Van Pelt
+%
+How to become a sysop:
+ I grew a beard, started wearing only t-shirts and jeans, and
+ developed a surly attitude. The group accepted me, and I've never
+ worked a full day in my life since then.
+ -- rho/slashdot
+%
+How to Raise Your I.Q. by Eating Gifted Children
+ -- Book title by Lewis B. Frumkes
+%
+How untasteful can you get?
+%
+How wonderful opera would be if there were no singers.
+%
+HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
+ #1040 Your income tax refund cheque bounces.
+%
+HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
+ #15 Your pet rock snaps at you.
+%
+HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
+ #32: You call your answering service and they've never heard of
+ you.
+%
+How you look depends on where you go.
+%
+Howe's Law:
+ Everyone has a scheme that will not work.
+%
+However, never daunted, I will cope with adversity
+in my traditional manner... sulking and nausea.
+ -- Tom K. Ryan
+%
+However, on religious issues there can be little or no compromise. There
+is no position on which people are so immovable as their religious beliefs.
+There is no more powerful ally one can claim in a debate than Jesus Christ,
+or God, or Allah, or whatever one calls this supreme being. But like any
+powerful weapon, the use of God's name on one's behalf should be used
+sparingly. The religious factions that are growing throughout our land are
+not using their religious clout with wisdom. They are trying to force
+government leaders into following their position 100 percent. If you disagree
+with these religious groups on a particular moral issue, they complain, they
+threaten you with a loss of money or votes or both. I'm frankly sick and
+tired of the political preachers across this country telling me as a citizen
+that if I want to be a moral person, I must believe in "A," "B," "C," and
+"D." Just who do they think they are? And from where do they presume to
+claim the right to dictate their moral beliefs to me? And I am even more
+angry as a legislator who must endure the threats of every religious group
+who thinks it has some God-granted right to control my vote on every roll
+call in the Senate. I am warning them today: I will fight them every step
+of the way if they try to dictate their moral convictions to all Americans
+in the name of "conservatism."
+ -- Senator Barry Goldwater, Congressional Record
+%
+HR 3128. Omnibus Budget Reconciliation, Fiscal 1986. Martin, R-Ill., motion
+that the House recede from its disagreement to the Senate amendment making
+changes in the bill to reduce fiscal 1986 deficits. The Senate amendment
+was an amendment to the House amendment to the Senate amendment to the House
+amendment to the Senate amendment to the bill. The original Senate amendment
+was the conference agreement on the bill. Agreed to.
+ -- Albuquerque Journal
+%
+Hubbard's Law:
+ Don't take life too seriously;
+ you won't get out of it alive.
+%
+Hug me now, you mad, impetuous fool!!
+Oh wait...
+I'm a computer, and you're a person. It would never work out.
+Never mind.
+%
+Huh?
+%
+Human beings were created by water to transport it uphill.
+%
+Human cardiac catheterization was introduced by Werner Forssman in 1929.
+Ignoring his department chief, and tying his assistant to an operating
+table to prevent her interference, he placed a urethral catheter into
+a vein in his arm, advanced it to the right atrium [of his heart], and
+walked upstairs to the x-ray department where he took the confirmatory
+x-ray film. In 1956, Dr. Forssman was awarded the Nobel Prize.
+%
+Human kind cannot bear very much reality.
+ -- T. S. Eliot, "Four Quartets: Burnt Norton"
+%
+Human resources are human first, and resources second.
+ -- J. Garbers
+%
+Humanity has advanced, when it has advanced, not because it has been sober,
+responsible, and cautious, but because it has been playful, rebellious, and
+immature.
+ -- Tom Robbins
+%
+Humans are communications junkies. We just can't get enough.
+ -- Alan Kay
+%
+Humility is the first of the virtues -- for other people.
+ -- Oliver Wendell Holmes
+%
+Hummingbirds never remember the words to songs.
+%
+Humor is a drug which it's the fashion to abuse.
+ -- William Gilbert
+%
+Humorists always sit at the children's table.
+ -- Woody Allen
+%
+"Humpf!" Humpfed a voice! "For almost two days you've run wild and insisted on
+chatting with persons who've never existed. Such carryings-on in our peaceable
+jungle! We've had quite enough of you bellowing bungle! And I'm here to
+state," snapped the big kangaroo, "That your silly nonsensical game is all
+through!" And the young kangaroo in her pouch said, "Me, too!"
+ "With the help of the Wickersham Brothers and dozens of Wickersham
+Uncles and Wickersham Cousins and Wickersham In-Laws, whose help I've engaged,
+You're going to be roped! And you're going to be caged! And, as for your
+dust speck... Hah! That we shall boil in a hot steaming kettle of Beezle-But
+oil!"
+ -- Dr. Seuss, "Horton Hears a Who"
+%
+Humpty Dumpty sat on the wall,
+Humpty Dumpty had a great fall!
+All the king's horses,
+And all the king's men,
+Had scrambled eggs for breakfast again!
+%
+Humpty Dumpty was pushed.
+%
+Hurewitz's Memory Principle:
+ The chance of forgetting something is directly proportional
+ to... to... uh.....
+%
+Hydrogen: A colorless, odorless, lighter than air gas which, given
+time, turns into people.
+ -- Harlow Shapley
+%
+I:
+ The best way to make a silk purse from a sow's ear is to begin
+ with a silk sow. The same is true of money.
+II:
+ If today were half as good as tomorrow is supposed to be, it would
+ probably be twice as good as yesterday was.
+III:
+ There are no lazy veteran lion hunters.
+IV:
+ If you can afford to advertise, you don't need to.
+V:
+ One-tenth of the participants produce over one-third of the output.
+ Increasing the number of participants merely reduces the average
+ output.
+ -- Norman Augustine
+%
+I accept chaos. I am not sure whether it accepts me. I know some people
+are terrified of the bomb. But then some people are terrified to be seen
+carrying a modern screen magazine. Experience teaches us that silence
+terrifies people the most.
+ -- Bob Dylan
+%
+I acted to show my love for Jodie Foster.
+ -- John Hinckley
+%
+I ain't got no quarrel with them Viet Congs.
+ -- Muhammad Ali
+%
+I allow the world to live as it chooses,
+and I allow myself to live as I choose.
+%
+I also believe that academic freedom should protect the right of a professor
+or student to advocate Marxism, socialism, communism, or any other minority
+viewpoint -- no matter how distasteful to the majority.
+ -- Richard M. Nixon
+
+What are our schools for if not indoctrination against Communism?
+ -- Richard M. Nixon
+%
+I always choose my friends for their good looks and my enemies for their
+good intellects. Man cannot be too careful in his choice of enemies.
+ -- Oscar Wilde, "The Picture of Dorian Gray"
+%
+I always had a repulsive need to be something more than human.
+ -- David Bowie
+%
+I always pass on good advice. It is the only thing to do with it.
+It is never any good to oneself.
+ -- Oscar Wilde, "An Ideal Husband"
+%
+I always say beauty is only sin deep.
+ -- H. H. Munro, a.k.a. Saki, "Reginald's Choir Treat"
+%
+I always turn to the sports pages first, which record people's
+accomplishments. The front page has nothing but man's failures.
+ -- Chief Justice Earl Warren
+%
+I always wake up at the crack of ice.
+ -- Joe E. Lewis
+%
+I always will remember -- I was in no mood to trifle;
+'Twas a year ago November -- I got down my trusty rifle
+I went out to shoot some deer And went out to stalk my prey --
+On a morning bright and clear. What a haul I made that day!
+I went and shot the maximum I tied them to my bumper and
+The game laws would allow: I drove them home somehow,
+Two game wardens, seven hunters, Two game wardens, seven hunters,
+And a cow. And a cow.
+
+The Law was very firm, it People ask me how I do it
+Took away my permit-- And I say, "There's nothin' to it!
+The worst punishment I ever endured. You just stand there lookin' cute,
+It turns out there was a reason: And when something moves, you shoot."
+Cows were out of season, and And there's ten stuffed heads
+One of the hunters wasn't insured. In my trophy room right now:
+ Two game wardens, seven hunters,
+ And a pure-bred gurnsey cow.
+ -- Tom Lehrer, "The Hunting Song"
+%
+I am a bookaholic. If you are a decent
+person, you will not sell me another book.
+%
+I am a computer.
+I am dumber than any human and smarter than any administrator.
+%
+I am a conscientious man, when I throw
+rocks at seabirds I leave no tern unstoned.
+ -- Ogden Nash, "Everybody's Mind to Me a Kingdom Is"
+%
+I am a deeply superficial person.
+ -- Andy Warhol
+%
+I am a friend of the working man, and I would rather be his friend
+than be one.
+ -- Clarence Darrow
+%
+I am a man: nothing human is alien to me.
+ -- Publius Terentius Afer (Terence)
+%
+I am a PC technician - however, this has unfortunately caused my
+computer to be running Win98.
+ -- seen on a FreeBSD mailing-list
+%
+I am America's child, a spastic slogging on demented
+limbs drooling I'll trade my PhD for a telephone voice.
+ -- Burt Lanier Safford III, "An Obscured Radiance"
+%
+I am an optimist. It does not seem too much use being anything else.
+ -- Winston Churchill
+%
+I am convinced that the manufacturers of carpet odor removing powder
+have included encapsulated time released cat urine in their products.
+This technology must be what prevented its distribution during my mom's
+reign. My carpet smells like piss, and I don't have a cat. Better go
+buy some more.
+ -- timw@zeb.USWest.COM
+%
+I am convinced that the truest act of courage is to sacrifice ourselves
+for others in a totally nonviolent struggle for justice. To be a man
+is to suffer for others.
+ -- Cesar Chavez
+%
+I am fairly unrepentant about her poetry. I really think that three
+quarters of it is gibberish. However, I must crush down these thoughts
+otherwise the dove of peace will shit on me.
+ -- Noel Coward on Edith Sitwell
+%
+I am firm. You are obstinate. He is a pig-headed fool.
+ -- Katharine Whitehorn
+%
+I am getting into abstract painting. Real abstract -- no brush, no canvas,
+I just think about it. I just went to an art museum where all of the art
+was done by children. All the paintings were hung on refrigerators.
+ -- Steven Wright
+%
+I am, in point of fact, a particularly haughty and exclusive person,
+of pre-Adamite ancestral descent. You will understand this when I tell
+you that I can trace my ancestry back to a protoplasmal primordial
+atomic globule. Consequently, my family pride is something
+inconceivable. I can't help it. I was born sneering.
+ -- Pooh-Bah, "The Mikado", Gilbert & Sullivan
+%
+I am just a nice, clean-cut Mongolian boy.
+ -- Yul Brynner, 1956
+%
+I am looking for a honest man.
+ -- Diogenes the Cynic
+%
+I am more bored than you could ever possibly be. Go back to work.
+%
+I am NOMAD!
+%
+I am not a crook.
+ -- Richard M. Nixon
+%
+I am not a politician and my other habits are also good.
+ -- A. Ward
+%
+I am not afraid of tomorrow, for I have seen yesterday and I love today.
+ -- William Allen White
+%
+I am not an Economist. I am an honest man!
+ -- Paul McCracken
+%
+I am not now and never have been a girl friend of Henry Kissinger.
+ -- Gloria Steinem
+%
+I am not now, nor have I ever been, a member of the demigodic party.
+ -- Dennis M. Ritchie
+%
+I am not sure what this is, but an "F" would only dignify it.
+ -- English Professor
+%
+I am of the belief that catnip arrived on the planet in the same spaceship
+that delivered cats. It is the only thing they have from their home
+planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
+world that they like, but catnip is crack from home.
+ -- Bill Cole
+%
+I am only one, but I am one. I cannot do everything, but I can do
+something. And I will not let what I cannot do interfere with what
+I can do.
+ -- Edward Everett Hale, (1822 - 1909)
+%
+I am professionally trained in computer science, which is to say
+(in all seriousness) that I am extremely poorly educated.
+ -- Joseph Weizenbaum, "Computer Power and Human Reason"
+%
+I am ready to meet my Maker. Whether my Maker is prepared
+for the great ordeal of meeting me is another matter.
+ -- Winston Churchill
+%
+I am returning this otherwise good typing paper to you because someone
+has printed gibberish all over it and put your name at the top.
+ -- Professor Lowd, English, Ohio University
+%
+I am so optimistic about beef prices that I've just leased a pot roast
+with an option to buy.
+%
+I am the mother of all things, and all things should wear a sweater.
+%
+I am the wandering glitch -- catch me if you can.
+%
+I am two fools, I know, for loving, and for saying so.
+ -- John Donne
+%
+I am two with nature.
+ -- Woody Allen
+%
+I am very fond of the company of ladies. I like their beauty,
+I like their delicacy, I like their vivacity, and I like their silence.
+ -- Samuel Johnson
+%
+I appreciate the fact that this draft was done in haste, but some of the
+sentences that you are sending out in the world to do your work for you are
+loitering in taverns or asleep beside the highway.
+ -- Dr. Dwight Van de Vate, Professor of Philosophy,
+ University of Tennessee at Knoxville
+%
+I argue very well. Ask any of my remaining friends. I can win an
+argument on any topic, against any opponent. People know this, and
+steer clear of me at parties. Often, as a sign of their great respect,
+they don't even invite me.
+ -- Dave Barry
+%
+I asked a teacher what the opposite of a miracle was and she, without
+thinking, I assume, said it was an act of God.
+ -- Terry Prachett (Daily Mail 21 june 2008)
+%
+I asked the engineer who designed the communication terminal's keyboards
+why these were not manufactured in a central facility, in view of the
+small number needed [1 per month] in his factory. He explained that this
+would be contrary to the political concept of local self-sufficiency.
+Therefore, each factory needing keyboards, no matter how few, manufactures
+them completely, even molding the keypads.
+ -- Isaac Auerbach, IEEE "Computer", Nov. 1979
+%
+I attribute my success to intelligence, guts, determination, honesty,
+ambition, and having enough money to buy people with those qualities.
+%
+I B M
+U B M
+We all B M
+For I B M!!!!
+ -- H.A.R.L.I.E.
+%
+I base my fashion taste on what doesn't itch.
+ -- Gilda Radner
+%
+I began many years ago, as so many young men do, in searching for the
+perfect woman. I believed that if I looked long enough, and hard enough,
+I would find her and then I would be secure for life. Well, the years
+and romances came and went, and I eventually ended up settling for someone
+a lot less than my idea of perfection. But one day, after many years
+together, I lay there on our bed recovering from a slight illness. My
+wife was sitting on a chair next to the bed, humming softly and watching
+the late afternoon sun filtering through the trees. The only sounds to
+be heard elsewhere were the clock ticking, the kettle downstairs starting
+to boil, and an occasional schoolchild passing beneath our window. And
+as I looked up into my wife's now wrinkled face, but still warm and
+twinkling eyes, I realized something about perfection... It comes only
+with time.
+ -- James L. Collymore, "Perfect Woman"
+%
+I believe a little incompatibility is the spice of life,
+particularly if he has income and she is pattable.
+ -- Ogden Nash
+%
+I believe in an America where the separation of church and state is absolute
+-- where no Catholic prelate would tell the president (should he be Catholic)
+how to act, and no Protestant minister would tell his parishioners for whom
+to vote -- where no church or church school is granted any public funds or
+political preference -- and where no man is denied public office merely
+because his religion differs from the president who might appoint him or
+the people who might elect him.
+ -- John F. Kennedy
+%
+I believe in getting into hot water; it keeps you clean.
+ -- G. K. Chesterton
+%
+I believe in sex and death -- two experiences that come once in a lifetime.
+ -- Woody Allen
+%
+I believe that professional wrestling is clean
+and everything else in the world is fixed.
+ -- Frank Deford, sports writer
+%
+I believe that the moment is near when by a procedure of active paranoiac
+thought, it will be possible to systematize confusion and contribute to the
+total discrediting of the world of reality.
+ -- Salvador Dali
+%
+I belong to no organized party. I am a Democrat.
+ -- Will Rogers
+%
+I bet the human brain is a kludge.
+ -- Marvin Minsky
+%
+I BET WHAT HAPPENED was they discovered fire and invented the wheel on
+the same day. Then that night, they burned the wheel.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I BET WHEN NEANDERTHAL KIDS would make a snowman, someone would always
+end up saying, "Don't forget the thick heavy brows." Then they would get
+embarrassed because they remembered they had the big hunky brows too, and
+they'd get mad and eat the snowman.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I bet you have fun chasing the soap around the bathtub.
+ -- Princess Diana, to a one-armed war veteran during
+ a visit to a London veterans hospital
+%
+I brake for chezlogs!
+%
+I braved the contempt of my friends last week and ventured out to see
+Bambi, the Disney rerelease that is proving to be a hit once again in the
+box office. I was looking forward to a gentle, soothing, late afternoon
+relief from the Washington Summer. Instead I was traumatized. As a
+psycho-sexual return to the horrors of early adolescence, it couldn't be
+more effective. For the first half-hour, you're lulled into an agreeable
+sense of security and comfort. Birds twitter; small rabbits turn out to
+be great conversationalists. Pop is what Senator Moynihan would describe
+as an absent father, but Mom's there to make you feel OK in the odd
+thunderstorm. You make great friends, fool around on the ice, discover
+the meadow, generally mellow out. Then, without any particular warning,
+your mom gets shot, your voice breaks, huge growths start appearing on
+your head, and your peers start heading off into the clover with the
+apparent intention of having sex. Next thing you know, the forest burns
+down. If I were still eight, I think I'd prefer Rambo III.
+ -- Townsend Davis
+%
+I call them as I see them. If I can't see them, I make them up.
+ -- Biff Barf
+%
+I called my parents the other night, but I forgot about the time difference.
+They're still living in the fifties.
+ -- Strange de Jim
+%
+I came, I saw, I deleted all your files.
+%
+I came out of twelve years of college and I didn't even know how to sew.
+All I could do was account -- I couldn't even account for myself.
+ -- The Firesign Theatre
+%
+I came to MIT to get an education for myself and a diploma for my mother.
+%
+I can feel for her because, although I have never been an Alaskan
+prostitute dancing on the bar in a spangled dress, I still get very
+bored with washing and ironing and dishwashing and cooking day after
+relentless day.
+ -- Betty MacDonald
+%
+I can give you my word, but I know what it's worth and you don't.
+ -- Nero Wolfe, "Over My Dead Body"
+%
+I can hire one half of the working class to kill the other half.
+ -- Jay Gould
+%
+I can mend the break of day, heal a broken heart,
+and provide temporary relief to nymphomaniacs.
+ -- Larry Lee
+%
+I can read your mind, and you should be ashamed of yourself.
+%
+I can relate to that.
+%
+I can remember when a good politician had to be 75 percent ability and
+25 percent actor, but I can well see the day when the reverse could be
+true.
+ -- Harry S. Truman
+%
+I can resist anything but temptation.
+%
+I can see him a'comin'
+With his big boots on,
+With his big thumb out,
+He wants to get me.
+He wants to hurt me.
+He wants to bring me down.
+But some time later,
+When I feel a little straighter,
+I'll come across a stranger
+Who'll remind me of the danger,
+And then.... I'll run him over.
+Pretty smart on my part!
+To find my way... In the dark!
+ -- Phil Ochs
+%
+I can write better than anybody who can write faster,
+and I can write faster than anybody who can write better.
+ -- A. J. Liebling
+%
+I cannot and will not cut my conscience to fit this year's fashions.
+ -- Lillian Hellman
+%
+I cannot believe that God plays dice with the cosmos.
+ -- Albert Einstein, on the randomness of quantum mechanics
+%
+I cannot conceive that anybody will require multiplications at the rate
+of 40,000 or even 4,000 per hour ...
+ -- F. H. Wales (1936)
+%
+I cannot draw a cart, nor eat dried oats;
+If it be man's work I will do it.
+%
+I cannot overemphasize the importance of good grammar.
+
+What a crock. I could easily overemphasize the importance of good
+grammar. For example, I could say: "Bad grammar is the leading cause
+of slow, painful death in North America," or "Without good grammar, the
+United States would have lost World War II."
+ -- Dave Barry, "An Utterly Absurd Look at Grammar"
+%
+I can't believe that out of 100,000 sperm, you were the quickest.
+ -- Steven Pearl
+%
+I CAN'T come back, I don't know how it works.
+ -- Frank Morgan as The Wizard, "The Wizard of Oz"
+%
+I can't complain, but sometimes I still do.
+ -- Joe Walsh
+%
+I can't decide whether to commit suicide or go bowling.
+ -- Florence Henderson
+%
+I can't die until the government finds a safe place to bury my liver.
+ -- Phil Harris
+%
+I Can't Get Over You, So I Get Up and Go Around to the Other Side
+If You Won't Leave Me Alone, I'll Find Someone Who Will
+I Knew That You'd Committed a Sin When You Came Home Late With
+ Your Socks Outside-in
+I'm a Rabbit in the Headlights of Your Love
+Don't Kick My Tires If You Ain't Gonna Take Me For a Ride
+I Liked You Better Before I Knew You So Well
+I Still Miss You, Baby, But My Aim's Gettin' Better
+I've Got Red Eyes From Your White Lies and I'm Blue All the Time
+ -- proposed Country-Western song titles from "Wordplay"
+%
+I can't mate in captivity.
+ -- Gloria Steinem, on why she has never married
+%
+I can't seem to bring myself to say, "Well, I guess I'll be toddling along."
+It isn't that I can't toddle. It's that I can't guess I'll toddle.
+ -- Robert Benchley
+%
+I can't stand squealers; hit that guy.
+ -- Albert Anastasia
+%
+I can't stand this proliferation of paperwork. It's useless to fight the
+forms. You've got to kill the people producing them.
+ -- Vladimir Kabaidze, general director of the Ivanovo Machine
+ Building Works (near Moscow) in a speech to the Communist
+ Party Conference
+%
+I can't understand it.
+I can't even understand the people who can understand it.
+ -- Queen Juliana of the Netherlands
+%
+I can't understand why a person will take a year or two to write a
+novel when he can easily buy one for a few dollars.
+ -- Fred Allen
+%
+I can't understand why people are frightened of new ideas.
+I'm frightened of the old ones.
+ -- John Cage
+%
+I collect rare photographs... I have two... One of Houdini locking his
+keys in his car... the other is a rare picture of Norman Rockwell beating
+up a child.
+ -- Steven Wright
+%
+I come from a small town whose population never changed. Each time
+a woman got pregnant, someone left town.
+ -- Michael Prichard
+%
+I consider a new device or technology to have been
+culturally accepted when it has been used to commit a murder.
+ -- M. Gallaher
+%
+I consider the day misspent that I am not
+either charged with a crime, or arrested for one.
+ -- "Ratsy" Tourbillon
+%
+I could dance till the cows come home. On second thought, I'd rather
+dance with the cows till you come home.
+ -- Groucho Marx
+%
+I could never learn to like her --
+except on a raft at sea with no other provisions in sight.
+ -- Mark Twain
+%
+I couldn't possibly fail to disagree with you less.
+%
+I couldn't remember when I had been so disappointed. Except perhaps the
+time I found out that M&Ms really DO melt in your hand.
+ -- Peter Oakley
+%
+I despise the pleasure of pleasing people whom I despise.
+%
+I didn't believe in reincarnation in any of my other lives. I don't see why
+I should have to believe in it in this one.
+ -- Strange de Jim
+%
+I didn't do it! Nobody saw me do it! Can't prove anything!
+ -- Bart Simpson
+%
+I didn't get sophisticated -- I just got tired.
+But maybe that's what sophisticated is -- being tired.
+ -- Rita Gain
+%
+I didn't know he was dead; I thought he was British.
+%
+I didn't know it was impossible when I did it.
+%
+I didn't like the play, but I saw it under adverse conditions.
+The curtain was up.
+%
+I disagree with what you say, but will defend
+to the death your right to tell such LIES!
+%
+I distrust a close-mouthed man. He generally picks the wrong time to talk
+and says the wrong things. Talking's something you can't do judiciously,
+unless you keep in practice. Now, sir, we'll talk if you like. I'll tell
+you right out, I'm a man who likes talking to a man who likes to talk.
+ -- Sidney Greenstreet, "The Maltese Falcon"
+%
+I distrust a man who says when. If he's got to be careful not to drink
+too much, it's because he's not to be trusted when he does.
+ -- Sidney Greenstreet, "The Maltese Falcon"
+%
+I do desire we may be better strangers.
+ -- William Shakespeare, "As You Like It"
+%
+I do enjoy a good long walk -- especially when my wife takes one.
+%
+I do hate sums. There is no greater mistake than to call arithmetic an
+exact science. There are permutations and aberrations discernible to
+minds entirely noble like mine; subtle variations which ordinary
+accountants fail to discover; hidden laws of number which it requires a
+mind like mine to perceive. For instance, if you add a sum from the
+bottom up, and then again from the top down, the result is always
+different.
+ -- Mrs. La Touche (19th cent.)
+%
+I do not believe in the creed professed by the Jewish Church, by the Roman
+Church, by the Greek Church, by the Turkish Church, by the Protestant Church,
+nor by any Church that I know of. My own mind is my own Church.
+ -- Thomas Paine
+%
+I do not care if half the league strikes. Those who do will encounter
+quick retribution. All will be suspended, and I don't care if it wrecks
+the National League for five years. This is the United States of America
+and one citizen has as much right to play as another.
+ -- Ford Frick, National League President, reacting to a
+ threatened strike by some Cardinal players in 1947 if
+ Jackie Robinson took the field against St. Louis. The
+ Cardinals backed down and played.
+%
+I do not fear computers. I fear the lack of them.
+ -- Isaac Asimov
+%
+I do not feel obliged to believe that the same God who has endowed us with
+sense, reason, and intellect has intended us to forgo their use.
+ -- Galileo Galilei
+%
+I do not know myself and God forbid that I should.
+ -- Johann Wolfgang von Goethe
+%
+I do not know where to find in any literature, whether ancient or modern,
+any adequate account of that nature with which I am acquainted. Mythology
+comes nearest to it of any.
+ -- Henry David Thoreau
+%
+I do not know whether I was then a man dreaming I was a
+butterfly, or whether I am now a butterfly dreaming I am a man.
+ -- Chuang Tzu
+%
+I do not remember ever having seen a sustained argument by an author which,
+starting from philosophical premises likely to meet with general acceptance,
+reached the conclusion that a praiseworthy ordering of one's life is to
+devote it to research in mathematics.
+ -- Sir Edmund Whittaker, "Scientific American", Vol. 183
+%
+I do not seek the ignorant; the ignorant seek me -- I will instruct them.
+I ask nothing but sincerity. If they come out of habit, they become
+tiresome.
+ -- I Ching
+%
+I do not take drugs -- I am drugs.
+ -- Salvador Dali
+%
+I don't believe in astrology. But then I'm an Aquarius, and Aquarians
+don't believe in astrology.
+ -- James R. F. Quirk
+%
+I don't believe there really IS a GAS SHORTAGE.. I think it's all just
+a BIG HOAX on the part of the plastic sign salesmen -- to sell more
+numbers!!
+%
+I don't care for the Sugar Smacks commercial. I don't like the idea of
+a frog jumping on my Breakfast.
+ -- Lowell, Chicago Reader 10/15/82
+%
+I don't care how poor and inefficient a little country is; they like to
+run their own business. I know men that would make my wife a better
+husband than I am; but, darn it, I'm not going to give her to 'em.
+ -- The Best of Will Rogers
+%
+I don't care what star you're following, get that camel off my front lawn!
+ -- Heard in Bethlehem
+%
+I don't care where I sit as long as I get fed.
+ -- Calvin Trillin
+%
+I don't care who does the electing as long as I get to do the
+nominating.
+ -- Boss Tweed
+%
+I don't deserve this award, but I have arthritis and I don't
+deserve that either.
+ -- Jack Benny
+%
+I don't do it for the money.
+ -- Donald Trump, Art of the Deal
+%
+I don't drink, I don't like it, it makes me feel too good.
+ -- K. Coates
+%
+I don't even butter my bread. I consider that cooking.
+ -- Katherine Cebrian
+%
+I don't get no respect.
+%
+I don't have an eating problem. I eat.
+I get fat. I buy new clothes. No problem.
+%
+I don't have any solution but I certainly admire the problem.
+ -- Ashleigh Brilliant
+%
+I don't have any use for bodyguards, but I do have a specific use for two
+highly trained certified public accountants.
+ -- Elvis Presley
+%
+I don't have to take this abuse from you -- I've got
+hundreds of people waiting to abuse me.
+ -- Bill Murray, "Ghostbusters"
+%
+I don't kill flies, but I like to mess with their minds. I hold them above
+globes. They freak out and yell "Whooa, I'm *way* too high."
+ -- Bruce Baum
+%
+I don't know anything about music. In my line you don't have to.
+ -- Elvis Presley
+%
+I don't know what Descartes' got,
+But booze can do what Kant cannot.
+ -- Mike Cross
+%
+I don't know who my grandfather was; I am much
+more concerned to know what his grandson will be.
+ -- Abraham Lincoln
+%
+I don't know why anyone would want a computer in their home.
+ -- Ken Olsen, president of DEC, 1974
+%
+I don't know why we're here, I say we all go home and free associate.
+%
+I don't like spinach, and I'm glad I don't,
+because if I liked it I'd eat it, and I'd just hate it.
+ -- Clarence Darrow
+%
+I don't like the Dutchman. He's a crocodile. He's sneaky.
+I don't trust him.
+ -- Jack "Legs" Diamond, just before a peace conference
+ with Dutch Schultz.
+
+I don't trust Legs. He's nuts. He gets excited and starts pulling a
+trigger like another guy wipes his nose.
+ -- Dutch Schultz, just before a peace conference with
+ "Legs" Diamond.
+%
+I don't make the rules, Gil, I only play the game.
+ -- Cash McCall
+%
+I don't mind arguing with myself.
+It's when I lose that it bothers me.
+ -- Richard Powers
+%
+I don't mind going nowhere as long as it's an interesting path.
+ -- Ronald Mabbitt
+%
+I don't mind what Congress does, as long as they don't do it in the
+streets and frighten the horses.
+ -- Victor Hugo
+%
+I don't need no arms around me...
+I don't need no drugs to calm me...
+I have seen the writing on the wall.
+Don't think I need anything at all.
+No! Don't think I need anything at all!
+All in all, it was all just bricks in the wall.
+All in all, it was all just bricks in the wall.
+ -- Pink Floyd, "Another Brick in the Wall", Part III
+%
+I don't object to sex before marriage, but two minutes before?!?
+%
+I don't remember it, but I have it written down.
+%
+I don't see what's wrong with giving Bobby a little experience before
+he starts to practice law.
+ -- John F. Kennedy, upon appointing his brother
+ Attorney-General.
+%
+I DON'T THINK I'M ALONE when I say I'd like to see more and more planets
+fall under the ruthless domination of our solar system.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+"I don't think so," said Ren'e Descartes. Just then, he vanished.
+%
+I don't think they are going to give a shit about the Republican
+Committee trying to bug the Democratic Committee's headquarters.
+ -- Richard M. Nixon, 1972
+%
+"I don't understand," said the scientist, "why you lemmings all rush down
+to the sea and drown yourselves."
+
+"How curious," said the lemming. "The one thing I don't understand is why
+you human beings don't."
+ -- James Thurber
+%
+I don't understand you anymore.
+%
+I don't wanna argue, and I don't wanna fight,
+But there will definitely be a party tonight...
+%
+I don't want a pickle,
+I just wanna ride on my motorcycle.
+And I don't want to die,
+I just want to ride on my motorcycle.
+ -- Arlo Guthrie
+%
+I don't want people to love me. It makes for obligations.
+ -- Jean Anouilh
+%
+I don't want to achieve immortality through my work.
+I want to achieve immortality through not dying.
+ -- Woody Allen
+%
+I don't want to alarm anybody, but there is an excellent chance that
+the Earth will be destroyed in the next several days. Congress is
+thinking about eliminating a federal program under which scientists
+broadcast signals to alien beings. This would be a large mistake.
+Alien beings have nuclear blaster death cannons. You cannot cut off
+their federal programs as if they were merely poor people ...
+ -- Dave Barry, "THE ALIENS ARE COMING, THE ALIENS ARE
+ COMING!"
+%
+I don't want to bore you, but there's nobody else around for me to bore.
+%
+I don't want to live on in my work, I want to live on in my apartment.
+ -- Woody Allen
+%
+I don't wish to appear overly inquisitive, but are you still alive?
+%
+I dote on his very absence.
+ -- William Shakespeare, "The Merchant of Venice"
+%
+I doubt, therefore I might be.
+%
+I dread success. To have succeeded is to have finished one's business
+on earth, like the male spider, who is killed by the female the moment
+he has succeeded in his courtship. I like a state of continual
+becoming, with a goal in front and not behind.
+ -- George Bernard Shaw
+%
+I drink to make other people interesting.
+ -- George Jean Nathan
+%
+I either want less decadence or more chance to participate in it.
+%
+I enjoy the time that we spend together.
+%
+I exist, therefore I am paid.
+%
+I fear explanations explanatory of things explained.
+%
+I feel sorry for your brain... all alone in that great big head...
+%
+I fell asleep reading a dull book,
+and I dreamt that I was reading on,
+so I woke up from sheer boredom.
+%
+I figure that if God actually does exist, He's big enough to understand an
+honest difference of opinion.
+ -- Isaac Asimov
+%
+I finally went to the eye doctor. I got contacts.
+I only need them to read, so I got flip-ups.
+ -- Steven Wright
+%
+I find this corpse guilty of carrying a concealed weapon and I fine it $40.
+ -- Judge Roy Bean, finding a pistol and $40 on a man he'd
+ just shot.
+%
+I found out why my car was humming. It had forgotten the words.
+%
+I found Rome a city of bricks and left it a city of marble.
+ -- Augustus Caesar
+%
+I gained nothing at all from Supreme Enlightenment, and for that very
+reason it is called Supreme Enlightenment.
+ -- Gautama Buddha
+%
+I gave my love an Apple, that had no core;
+I gave my love a building, that had no floor;
+I wrote my love a program, that had no end;
+I gave my love an upgrade, with no cryin'.
+
+How can there be an Apple, that has no core?
+How can there be a building, that has no floor?
+How can there be a program, that has no end?
+How can there be an upgrade, with no cryin'?
+
+An Apple's MOS memory don't use no core!
+A building that's perfect, it has no flaw!
+A program with GOTOs, it has no end!
+I lied about the upgrade, with no cryin'!
+%
+I gave up Smoking, Drinking and Sex. It was the most *_h_o_r_r_i_f_y_i_n_g* 20
+minutes of my life!
+%
+I generally avoid temptation unless I can't resist it.
+ -- Mae West
+%
+I get my exercise acting as pallbearer to my friends who exercise.
+ -- Chauncey Depew
+%
+I get up each morning, gather my wits.
+Pick up the paper, read the obits.
+If I'm not there I know I'm not dead.
+So I eat a good breakfast and go back to bed.
+
+Oh, how do I know my youth is all spent?
+My get-up-and-go has got-up-and-went.
+But in spite of it all, I'm able to grin,
+And think of the places my get-up has been.
+ -- Pete Seeger
+%
+I give you the man who -- the man who -- uh, I forgets the man who?
+ -- Beauregard Bugleboy
+%
+I go on working for the same reason a hen goes on laying eggs.
+ -- H. L. Mencken
+%
+I go the way that Providence dictates.
+ -- Adolf Hitler
+%
+I got my driver's license photo taken out of focus on purpose. Now
+when I get pulled over the cop looks at it (moving it nearer and
+farther, trying to see it clearly)... and says, "Here, you can go."
+ -- Steven Wright
+%
+I got the bill for my surgery. Now I know what those doctors were
+wearing masks for.
+ -- James Boren
+%
+I got this powdered water -- now I don't know what to add.
+ -- Steven Wright
+%
+I got tired of listening to the recording on the phone at the movie
+theater. So I bought the album. I got kicked out of a theater the
+other day for bringing my own food in. I argued that the concession
+stand prices were outrageous. Besides, I hadn't had a barbecue in a
+long time. I went to the theater and the sign said adults $5 children
+$2.50. I told them I wanted 2 boys and a girl. I once took a cab to
+a drive-in movie. The movie cost me $95.
+ -- Steven Wright
+%
+I got vision, and the rest of the world wears bifocals.
+ -- Butch Cassidy
+%
+I GUESS I KINDA LOST CONTROL because in the middle of the play I ran up
+and lit the evil puppet villain on fire.
+
+No, I didn't. Just kidding. I just said that to illustrate one of the
+human emotions which is freaking out. Another emotion is greed, as when
+you kill someone for money or something like that. Another emotion is
+generosity, as when you pay someone double what he paid for his stupid
+puppet.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I GUESS I'LL NEVER FORGET HER. And maybe I don't want to. Her spirit
+was wild, like a wild monkey. Her beauty was like a beautiful horse
+being ridden by a wild monkey. I forget her other qualities.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I guess I've been so wrapped up in playing the game that I never took
+time enough to figure out where the goal line was -- what it meant to
+win -- or even how you won.
+ -- Cash McCall
+%
+I guess I've been wrong all my life, but so have billions of
+other people... Certainty is just an emotion.
+ -- Hal Clement
+%
+I GUESS OF ALL MY UNCLES, I liked Uncle Caveman the best. We called him
+Uncle Caveman because he lived in a cave and because sometimes he'd eat
+one of us. Later, we found out he was a bear.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I guess the Little League is even littler than we thought.
+ -- D. Cavett
+%
+I GUESS WE WERE ALL GUILTY, in a way. We shot him, we skinned him, and
+we all got a complimentary bumper sticker that said, "I helped skin Bob."
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I had a dream last night...
+I dreamt about 1976.
+I dreamt about a country with incurable brain damage...
+I even dreamt they gave it a heart transplant.
+Then I woke up and I knew it was only a nightmare...
+so I went back to sleep again.
+ -- Ralph Steadman, "Fear and Loathing '72"
+%
+I had a feeling once about mathematics -- that I saw it all. Depth beyond
+depth was revealed to me -- the Byss and the Abyss. I saw -- as one might
+see the transit of Venus or even the Lord Mayor's Show -- a quantity passing
+through infinity and changing its sign from plus to minus. I saw exactly
+why it happened and why tergiversation was inevitable -- but it was after
+dinner and I let it go.
+ -- Winston Churchill
+%
+I had a virgin once. I had to go to Guatemala for her. She was blind
+in one eye, and she had a stuffed alligator that said, "Welcome to Miami
+Beach."
+ -- The Stunt Man
+%
+I had another dream the other day about government financial management
+people. They were small and rodent-like with padlocked ears, as if they
+had stepped out of a painting by Goya.
+%
+I had another dream the other day about music critics. They were small
+and rodent-like with padlocked ears, as if they had stepped out of a
+painting by Goya.
+ -- Stravinsky
+%
+I had never been too political, but I knew how white people treated black
+people and it was hard for me to come back to the bullshit white people
+put a black person through in this country. To realize you don't have any
+power to make things different is a bitch.
+ -- Miles Davis
+%
+I had no shoes and I pitied myself. Then I met a man who had no feet,
+so I took his shoes.
+ -- Dave Barry
+%
+I had the rare misfortune of being one of the first people to try and
+implement a PL/1 compiler.
+ -- T. Cheatham
+%
+I had to censor everything my sons watched ... even on the Mary Tyler
+Moore show I heard the word "damn!"
+ -- Mary Lou Bax
+%
+I had to hit him -- he was starting to make sense.
+%
+I hate babies. They're so human.
+ -- H. H. Munro
+%
+I hate dying.
+ -- Dave Johnson
+%
+I hate it when my foot falls asleep during the day cause that means
+it's going to be up all night.
+ -- Steven Wright
+%
+I hate mankind, for I think myself one of the best of them,
+and I know how bad I am.
+ -- Samuel Johnson
+%
+I hate quotations.
+ -- Ralph Waldo Emerson
+%
+I hate small towns because once you've seen the cannon in the park
+there's nothing else to do.
+ -- Lenny Bruce
+%
+I hate trolls. Maybe I could metamorph it into something else -- like a
+ravenous, two-headed, fire-breathing dragon.
+ -- Willow
+%
+I have a box of telephone rings under my bed. Whenever I get lonely, I
+open it up a little bit, and I get a phone call. One day I dropped the
+box all over the floor. The phone wouldn't stop ringing. I had to get
+it disconnected. So I got a new phone. I didn't have much money, so I
+had to get an irregular. It doesn't have a five. I ran into a friend
+of mine on the street the other day. He said why don't you give me a
+call. I told him I can't call everybody I want to anymore, my phone
+doesn't have a five. He asked how long had it been that way. I said I
+didn't know -- my calendar doesn't have any sevens.
+ -- Steven Wright
+%
+I have a dog; I named him Stay. So when I'd go to call him, I'd say, "Here,
+Stay, here..." but he got wise to that. Now when I call him he ignores me
+and just keeps on typing.
+ -- Steven Wright
+%
+I have a dream. I have a dream that one day, on the red hills of Georgia,
+the sons of former slaves and the sons of former slaveowners will be able to
+sit down together at the table of brotherhood.
+ -- Martin Luther King, Jr.
+%
+I have a friend whose a billionaire. He invented Cliff's notes. When
+I asked him how he got such a great idea he said, "Well first I...
+I just... to make a long story short..."
+ -- Steven Wright
+%
+I have a hard time being attracted to anyone who can beat me up.
+ -- John McGrath, Atlanta sportswriter, on women weightlifters
+%
+I have a hobby. I have the world's largest collection of sea shells.
+I keep it scattered on beaches all over the world. Maybe you've seen
+some of it.
+ -- Steven Wright
+%
+I have a little shadow that goes in and out with me,
+And what can be the use of him is more than I can see.
+He is very, very like me from the heels up to the head;
+And I see him jump before me, when I jump into my bed.
+
+The funniest thing about him is the way he likes to grow--
+Not at all like proper children, which is always very slow;
+For he sometimes shoots up taller, like an india-rubber ball,
+And he sometimes gets so little that there's none of him at all.
+ -- Robert Louis Stevenson
+%
+I have a map of the United States. It's actual size.
+I spent last summer folding it.
+People ask me where I live, and I say, "E6".
+ -- Steven Wright
+%
+I have a rock garden. Last week three of them died.
+ -- Richard Diran
+%
+I have a switch in my apartment that doesn't do anything. Every once
+in a while I turn it on and off. On and off. On and off. One day I
+got a call from a woman in France who said "Cut it out!"
+ -- Steven Wright
+%
+I have a terrible headache, I was putting on toilet water and the lid fell.
+%
+I have a theory that it's impossible to prove anything,
+but I can't prove it.
+%
+I have a very firm grasp on reality! I can reach out and strangle it
+any time!
+%
+I have a very strange feeling about this...
+ -- Luke Skywalker
+%
+I have already given two cousins to the war and I stand ready to
+sacrifice my wife's brother.
+ -- Artemus Ward
+%
+I have always noticed that whenever a radical takes
+to Imperialism, he catches it in a very acute form.
+ -- Winston Churchill, 1903
+%
+I have an existential map. It has "You are here" written all over it.
+ -- Steven Wright
+%
+I have become me without my consent.
+%
+I have come up with a surefire concept for a hit television show, which
+would be called "A Live Celebrity Gets Eaten by a Shark."
+ -- Dave Barry, "The Wonders of Sharks on TV"
+%
+I have defined the hundred per cent American as ninety-nine per
+cent an idiot.
+ -- George Bernard Shaw
+%
+I have discovered that all human evil comes from this, man's being unable
+to sit still in a room.
+ -- Blaise Pascal
+%
+I have discovered the art of deceiving diplomats.
+I tell them the truth and they never believe me.
+ -- Camillo Di Cavour
+%
+I have found it impossible to carry the heavy burden of responsibility and
+to discharge my duties as king as I would wish to do without the help and
+support of the woman I love.
+ -- Edward, Duke of Windsor, announcing his abdication
+ of the British throne in order to marry the American
+ divorcee Wallis Warfield Simpson. (1936)
+%
+I have found little that is good about human beings. In my experience
+most of them are trash.
+ -- Sigmund Freud
+%
+I have gained this by philosophy:
+that I do without being commanded what others
+do only from fear of the law.
+ -- Aristotle
+%
+I have great faith in fools -- self confidence my friends call it.
+ -- Edgar Allan Poe
+%
+I have had my television aerials removed. It's the moral equivalent
+of a prostate operation.
+ -- Malcolm Muggeridge
+%
+I have hardly ever known a mathematician who was capable of reasoning.
+ -- Plato
+%
+I have just had eighteen whiskeys in a row.
+I do believe that is a record.
+ -- Dylan Thomas, his last words
+%
+I have just read your lousy review buried in the back pages. You
+sound like a frustrated old man who never made a success, an
+eight-ulcer man on a four-ulcer job, and all four ulcers working. I
+have never met you, but if I do you'll need a new nose and plenty of
+beefsteak and perhaps a supporter below. Westbrook Pegler, a
+guttersnipe, is a gentleman compared to you. You can take that as more
+of an insult than as a reflection on your ancestry.
+ -- Harry S. Truman
+%
+I have learned silence from the talkative,
+toleration from the intolerant, and kindness from the unkind.
+ -- Kahlil Gibran
+%
+I have learned
+To spell hors d'oeuvres
+Which still grates on
+Some people's n'oeuvres.
+ -- Warren Knox
+%
+I have lots of things in my pockets;
+None of them is worth anything.
+Sociopolitical whines aside,
+Gan you give me, gratis, free,
+The price of half a gallon
+Of Gallo extra bad
+And most of the bus fare home.
+%
+I have made mistakes but I have never made the
+mistake of claiming that I have never made one.
+ -- James Gordon Bennett
+%
+I have made this letter longer than usual
+because I lack the time to make it shorter.
+ -- Blaise Pascal
+%
+I have more hit points that you can possible imagine.
+%
+I have more humility in my little finger than you have in your whole
+_B_O_D_Y!
+ -- from "Cerebus" #82
+%
+I have never been one to sacrifice
+my appetite on the altar of appearance.
+ -- A. M. Readyhough
+%
+I have never let my schooling interfere with my education.
+ -- Mark Twain
+%
+I have never seen anything fill up a vacuum so fast and still suck.
+ -- Rob Pike, on X
+
+Steve Jobs said two years ago that X is brain-damaged and it will be
+gone in two years. He was half right.
+ -- Dennis M. Ritchie
+
+Dennis Ritchie is twice as bright as Steve Jobs, and only half wrong.
+ -- Jim Gettys
+%
+I have never understood this liking for war. It panders to instincts
+already catered for within the scope of any respectable domestic
+establishment.
+ -- Alan Bennett
+%
+I have no doubt that it is a part of the destiny of the human race,
+in its gradual improvement, to leave off eating animals.
+ -- Thoreau
+%
+I have no doubt the Devil grins,
+As seas of ink I spatter.
+Ye gods, forgive my "literary" sins--
+The other kind don't matter.
+ -- Robert W. Service
+%
+I have no right, by anything I do or say, to demean a human being in his
+own eyes. What matters is not what I think of him; it is what he thinks
+of himself. To undermine a man's self-respect is a sin.
+ -- Antoine de Saint-Exupery
+%
+I have not yet begun to byte!
+%
+I have nothing but utter contempt for the courts of this land.
+ -- George Wallace
+%
+I have now come to the conclusion never again to think of marrying,
+and for this reason: I can never be satisfied with anyone who would
+be blockhead enough to have me.
+ -- Abraham Lincoln
+%
+I have often looked at women and committed adultery in my heart.
+ -- Jimmy Carter
+%
+I have often regretted my speech, never my silence.
+ -- Publilius Syrus
+%
+I have sacrificed time, health, and fortune, in the desire to complete these
+Calculating Engines. I have also declined several offers of great personal
+advantage to myself. But, notwithstanding the sacrifice of these advantages
+for the purpose of maturing an engine of almost intellectual power, and
+after expending from my own private fortune a larger sum than the government
+of England has spent on that machine, the execution of which it only
+commenced, I have received neither an acknowledgment of my labors, nor even
+the offer of those honors or rewards which are allowed to fall within the
+reach of men who devote themselves to purely scientific investigations...
+ If the work upon which I have bestowed so much time and thought were
+a mere triumph over mechanical difficulties, or simply curious, or if the
+execution of such engines were of doubtful practicability or utility, some
+justification might be found for the course which has been taken; but I
+venture to assert that no mathematician who has a reputation to lose will
+ever publicly express an opinion that such a machine would be useless if
+made, and that no man distinguished as a civil engineer will venture to
+declare the construction of such machinery impracticable...
+ And at a period when the progress of physical science is obstructed
+by that exhausting intellectual and manual labor, indispensable for its
+advancement, which it is the object of the Analytical Engine to relieve, I
+think the application of machinery in aid of the most complicated and abstruse
+calculations can no longer be deemed unworthy of the attention of the country.
+In fact, there is no reason why mental as well as bodily labor should not
+be economized by the aid of machinery.
+ -- Charles Babbage, "The Life of a Philosopher"
+%
+I have seen the future and it is just like the present, only longer.
+ -- Kehlog Albran, "The Profit"
+%
+I have seen the Great Pretender and he is not what he seems.
+%
+I have that old biological urge,
+I have that old irresistible surge,
+I'm hungry.
+%
+I have the simplest tastes. I am always satisfied with the best.
+ -- Oscar Wilde
+%
+I have to convince you, or at least snow you ...
+ -- Prof. Romas Aleliunas, CS 435
+%
+I have to think hard to name an interesting man who does not drink.
+ -- Richard Burton
+%
+I have travelled the length and breadth of this country, and have talked with
+the best people in business administration. I can assure you on the highest
+authority that data processing is a fad and won't last out the year.
+ -- Editor in charge of business books at Prentice-Hall
+ publishers, responding to Karl V. Karlstrom (a junior
+ editor who had recommended a manuscript on the new
+ science of data processing), c. 1957
+%
+I have ways of making money that you know nothing of.
+ -- John D. Rockefeller
+%
+I have yet to see any problem, however complicated, which, when looked
+at in the right way, did not become still more complicated.
+ -- Poul Anderson
+%
+I haven't lost my mind -- it's backed up on tape somewhere.
+%
+I haven't lost my mind; I know exactly where I left it.
+%
+I hear the sound that the machines make,
+and feel my heart break, just for a moment.
+%
+I hear what you're saying but I just don't care.
+%
+I heard a definition of an intellectual, that I thought was very
+interesting: a man who takes more words than are necessary to tell
+more than he knows.
+ -- Dwight D. Eisenhower
+%
+I hold it, that a little rebellion, now and then, is a good thing...
+ -- Thomas Jefferson
+%
+I hold your hand in mine, dear, I press it to my lips,
+I take a healthy bite from your dainty fingertips,
+My joy would be complete, dear, if you were only here,
+But still I keep your hand as a precious souvenir.
+
+The night you died I cut it off, I really don't know why,
+For now each time I kiss it I get bloodstains on my tie,
+I'm sorry now I killed you, our love was something fine,
+So until they come to get me I will hold your hand in mine.
+
+ -- Tom Lehrer, "I Hold Your Hand In Mine"
+%
+I hope you're not pretending to be evil while
+secretly being good. That would be dishonest.
+%
+I just asked myself... what would John DeLorean do?
+ -- Raoul Duke
+%
+I just ate a whole package of Sweet Tarts and a can of Coke.
+I think I saw God.
+ -- B. Hathrume Duk
+%
+I just got off the phone with Sonny Barger [President of the Hell's Angels].
+He wants me to appear as a character witness for him at his murder trial
+and said he'd be glad to appear as a character witness on my behalf if I
+ever needed one. Needless to say, I readily agreed.
+ -- Thomas King Forcade, publisher of "High Times"
+%
+I just got out of the hospital after a
+speed reading accident. I hit a bookmark.
+ -- Steven Wright
+%
+I just know I'm a better manager when I have Joe DiMaggio in center field.
+ -- Casey Stengel
+%
+I just need enough to tide me over until I need more.
+ -- Bill Hoest
+%
+I kissed my first girl and smoked my first cigarette on the same day.
+I haven't had time for tobacco since.
+ -- Arturo Toscanini
+%
+I knew her before she was a virgin.
+ -- Oscar Levant, on Doris Day
+%
+I *knew* I had some reason for not logging you off...
+If I could just remember what it was.
+%
+I knew one thing: as soon as anyone said you didn't need a gun, you'd better
+take one along that worked.
+ -- Raymond Chandler
+%
+I know if you been talkin' you done said
+just how surprised you wuz by the living dead.
+You wuz surprised that they could understand you words
+and never respond once to all the truth they heard.
+But don't you get square!
+There ain't no rule that says they got to care.
+They can always swear they're deaf, dumb and blind.
+%
+I know it all. I just can't remember it all at once.
+%
+I know not how I came into this,
+shall I call it a dying life or a living death?
+ -- St. Augustine
+%
+I know not with what weapons World War III will be fought, but
+World War IV will be fought with sticks and stones.
+ -- Albert Einstein
+%
+I know on which side my bread is buttered.
+ -- John Heywood
+%
+I know the answer! The answer lies within the heart of all mankind!
+The answer is twelve? I think I'm in the wrong building.
+ -- Charles Schulz
+%
+I know the disposition of women: when you will, they won't; when
+you won't, they set their hearts upon you of their own inclination.
+ -- Publius Terentius Afer (Terence)
+%
+I know what "custody" [of the children] means. "Get even." That's all
+custody means. Get even with your old lady.
+ -- Lenny Bruce
+%
+I know what you're thinking -- "Did he fire six shots or only five?"
+Well, to tell you the truth, in all the excitement, I kind of lost track
+myself. But being this is a .44 Magnum, the most powerful handgun in the
+world, and would blow your head clean off, you've got to ask yourself
+one question: "Do I feel lucky?" Well, do you, punk?
+ -- Harry Callahan, badge #2211
+%
+I know you believe you understand what you think this fortune says,
+but I'm not sure you realize that what you are reading is not what
+it means.
+%
+I know you think you thought you knew what you thought I said,
+but I'm not sure you understood what you thought I meant.
+%
+I know you're in search of yourself, I just haven't seen you anywhere.
+%
+I lately lost a preposition;
+It hid, I thought, beneath my chair
+And angrily I cried, "Perdition!
+Up from out of under there."
+
+Correctness is my vade mecum,
+And straggling phrases I abhor,
+And yet I wondered, "What should he come
+Up from out of under for?"
+ -- Morris Bishop
+%
+I lay my head on the railroad tracks,
+Waitin' for the double E.
+The railroad don't run no more.
+Poor poor pitiful me. [chorus]
+ Poor poor pitiful me, poor poor pitiful me.
+ These young girls won't let me be,
+ Lord have mercy on me!
+ Woe is me!
+
+Well, I met a girl, West Hollywood,
+Well, I ain't naming names.
+But she really worked me over good,
+She was just like Jesse James.
+She really worked me over good,
+She was a credit to her gender.
+She put me through some changes, boy,
+Sort of like a Waring blender. [chorus]
+
+I met a girl at the Rainbow Bar,
+She asked me if I'd beat her.
+She took me back to the Hyatt House,
+I don't want to talk about it. [chorus]
+ -- Warren Zevon, "Poor Poor Pitiful Me"
+%
+I learned to play guitar just to get the girls, and anyone who says they
+didn't is just lyin'!
+ -- Willie Nelson
+%
+I like being single. I'm always there when I need me.
+ -- Art Leo
+%
+I like myself, but I won't say I'm as handsome as the bull
+that kidnaped Europa.
+ -- Marcus Tullius Cicero
+%
+I like paying taxes. With them I buy civilization.
+ -- Oliver Wendell Holmes
+%
+I like to believe that people in the long run are going to do more to
+promote peace than our governments. Indeed, I think that people want
+peace so much that one of these days governments had better get out of
+the way and let them have it.
+ -- Dwight D. Eisenhower
+%
+I like work; it fascinates me; I can sit and look at it for hours.
+%
+I like young girls. Their stories are shorter.
+ -- Tom McGuane
+%
+I like your game but we have to change the rules.
+%
+I live the way I type; fast, with a lot of mistakes.
+%
+I loathe people who keep dogs. They are cowards who haven't got the guts
+to bite people themselves.
+ -- August Strindberg
+%
+I look at life as being cruise director on the Titanic.
+I may not get there, but I'm going first class.
+ -- Art Buchwald
+%
+I love being married. It's so great to find that one special
+person you want to annoy for the rest of your life.
+ -- Rita Rudner
+%
+I love children. Especially when they cry -- for then
+someone takes them away.
+ -- Nancy Mitford
+%
+I love dogs, but I hate Chihuahuas. A Chihuahua isn't a dog.
+It's a rat with a thyroid problem.
+%
+I love mankind ... It's people I hate.
+ -- Schulz
+%
+I love Mickey Mouse more than any woman I've ever known.
+ -- Walt Disney
+%
+I love Saturday morning cartoons, what classic humour! This is what
+entertainment is all about ... Idiots, explosives and falling anvils.
+ -- Calvin and Hobbes, Bill Watterson
+%
+I love the smell of napalm in the morning.
+ -- Robert Duval, "Apocalypse Now"
+%
+I love to eat them Smurfies
+Smurfies what I love to eat
+Bite they ugly heads off,
+Nibble on they bluish feet.
+%
+I love treason but hate a traitor.
+ -- Gaius Julius Caesar
+%
+I love you more than anything in this world. I don't expect that will last.
+ -- Elvis Costello
+%
+I love you, not only for what you are,
+but for what I am when I am with you.
+ -- Roy Croft
+%
+I loved her with a love thirsty and desperate. I felt that we two might
+commit some act so atrocious that the world, seeing us, would find it
+irresistible.
+ -- Gene Wolfe, "The Shadow of the Torturer"
+%
+I married beneath me. All women do.
+ -- Lady Nancy Astor
+%
+I may appear to be just sitting here like a bucket of tapioca, but
+don't let appearances fool you. I'm approaching old age ... at the
+speed of light.
+ -- Prof. Cosmo Fishhawk
+%
+I may be getting older, but I refuse to grow up!
+%
+I may kid around about drugs, but really, I take them seriously.
+ -- Doctor Graper
+%
+I may not be totally perfect, but parts of me are excellent.
+ -- Ashleigh Brilliant
+%
+I met a wonderful new man. He's fictional, but you can't have everything.
+ -- Cecelia, "The Purple Rose of Cairo"
+%
+I met my latest girl friend in a department store. She was looking at
+clothes, and I was putting Slinkys on the escalators.
+ -- Steven Wright
+%
+I might have gone to West Point, but I was too proud to speak to a
+congressman.
+ -- Will Rogers
+%
+I must Create a System, or be enslav'd by another Man's;
+I will not Reason and Compare; my business is to Create.
+ -- William Blake, "Jerusalem"
+%
+I must get out of these wet clothes and into a dry Martini.
+ -- Alexander Woollcott
+%
+I must have a prodigious quantity of mind; it takes me as much as a
+week sometimes to make it up.
+ -- Mark Twain, "The Innocents Abroad"
+%
+I must have slipped a disk -- my pack hurts!
+%
+I myself have dreamed up a structure intermediate between Dyson spheres
+and planets. Build a ring 93 million miles in radius -- one Earth orbit
+-- around the sun. If we have the mass of Jupiter to work with, and if
+we make it a thousand miles wide, we get a thickness of about a thousand
+feet for the base.
+
+And it has advantages. The Ringworld will be much sturdier than a Dyson
+sphere. We can spin it on its axis for gravity. A rotation speed of 770
+m/s will give us a gravity of one Earth normal. We wouldn't even need to
+roof it over. Place walls one thousand miles high at each edge, facing the
+sun. Very little air will leak over the edges.
+
+Lord knows the thing is roomy enough. With three million times the surface
+area of the Earth, it will be some time before anyone complains of the
+crowding.
+ -- Larry Niven, "Ringworld"
+%
+I need another lawyer like I need another hole in my head.
+ -- Fratianno
+%
+I needed the good will of the legislature of four states. I formed the
+legislative bodies with my own money. I found that it was cheaper that
+way.
+ -- Jay Gould
+%
+I never cheated an honest man, only rascals. They wanted
+something for nothing. I gave them nothing for something.
+ -- Joseph "Yellow Kid" Weil
+%
+I never deny, I never contradict. I sometimes forget.
+ -- Benjamin Disraeli, British PM, on dealing with the
+ Royal Family
+%
+I never did it that way before.
+%
+I never expected to see the day when girls would get sunburned in the
+places they do today.
+ -- Will Rogers
+%
+I never failed to convince an audience that the best thing they
+could do was to go away.
+%
+I never forget a face, but in your case I'll make an exception.
+ -- Groucho Marx
+%
+I never killed a man that didn't deserve it.
+ -- Mickey Cohen
+%
+I never loved another person the way I loved myself.
+ -- Mae West
+%
+I never made a mistake in my life.
+I thought I did once, but I was wrong.
+ -- Lucy Van Pelt
+%
+I never met a man I didn't want to fight.
+ -- Lyle Alzado, professional football lineman
+%
+I never met a piece of chocolate I didn't like.
+%
+I never pray before meals -- my mom's a good cook.
+%
+I never said all Democrats were saloonkeepers;
+what I said was all saloonkeepers were Democrats.
+%
+I never saw a purple cow
+I never hope to see one
+But I can tell you anyhow
+I'd rather see than be one.
+ -- Gellett Burgess
+
+I've never seen a purple cow
+I never hope to see one
+But from the milk we're getting now
+There certainly must be one
+ -- Ogden Nash
+
+Ah, yes, I wrote "The Purple Cow"
+I'm sorry now I wrote it
+But I can tell you anyhow
+I'll kill you if you quote it.
+ -- Gellett Burgess, many years later
+%
+I never take work home with me; I always leave it in some bar along the way.
+%
+I never vote for anyone. I always vote against.
+ -- W. C. Fields
+%
+I often quote myself; it adds spice to my conversation.
+ -- George Bernard Shaw
+%
+I only know what I read in the papers.
+ -- Will Rogers
+%
+I only touch base with reality on an as-needed basis!
+ -- Royal Floyd Mengot (Klaus)
+%
+I opened the drawer of my little desk and a single letter fell out, a
+letter from my mother, written in pencil, one of her last, with unfinished
+words and an implicit sense of her departure. It's so curious: one can
+resist tears and "behave" very well in the hardest hours of grief. But
+then someone makes you a friendly sign behind a window... or one notices
+that a flower that was in bud only yesterday has suddenly blossomed... or
+a letter slips from a drawer... and everything collapses.
+ -- Letters From Colette
+%
+I owe, I owe,
+It's off to work I go...
+%
+I owe the government $3400 in taxes. So I sent them two hammers and a
+toilet seat.
+ -- Michael McShane
+%
+I owe the public nothing.
+ -- J. P. Morgan
+%
+I place economy among the first and most important virtues, and public debt as
+the greatest of dangers to be feared. To preserve our independence, we must
+not let our rulers load us with perpetual debt. If we run into such debts, we
+must be taxed in our meat and drink, in our necessities and in our comforts,
+in our labor and in our amusements. If we can prevent the government from
+wasting the labor of the people, under the pretense of caring for them, they
+will be happy.
+ -- Thomas Jefferson
+%
+I played lead guitar in a band called The Federal Duck, which is the
+kind of name that was popular in the '60s as a result of controlled
+substances being in widespread use. Back then, there were no
+restrictions, in terms of talent, on who could make an album, so we
+made one, and it sounds like a group of people who have been given
+powerful but unfamiliar instruments as a therapy for a degenerative
+nerve disease.
+ -- Dave Barry, "The Snake"
+%
+I pledge allegiance to the flag
+of the United States of America
+and to the republic for which it stands,
+one nation,
+indivisible,
+with liberty
+and justice for all.
+ -- Francis Bellamy, 1892
+%
+I poured spot remover on my dog. Now he's gone.
+ -- Steven Wright
+%
+I predict that today will be remembered until tomorrow!
+%
+I prefer rogues to imbeciles because they sometimes take a rest.
+ -- Alexandre Dumas the Younger
+%
+I prefer the most unjust peace to the most righteous war.
+ -- Cicero
+
+Even peace may be purchased at too high a price.
+ -- Poor Richard
+%
+I profoundly believe it takes a lot of practice to become a moral slob.
+ -- William F. Buckley
+%
+I put contact lenses in my dog's eyes. They had little pictures of cats
+on them. Then I took one out and he ran around in circles.
+ -- Steven Wright
+%
+I put the shotgun in an Adidas bag and padded it out with four pairs of
+tennis socks, not my style at all, but that was what I was aiming for: If
+they think you're crude, go technical; if they think you're technical, go
+crude. I'm a very technical boy. So I decided to get as crude as possible.
+These days, though, you have to be pretty technical before you can even
+aspire to crudeness.
+ -- William Gibson, "Johnny Mnemonic"
+%
+I put up my thumb... and it blotted out the planet Earth.
+ -- Neil Armstrong
+%
+I read a column by George Will that Scarface should be rated X because
+parents were taking their children to see it. So what? Why should the
+motion-picture industry be responsible for our morality?
+ Dad says to Mom, "Honey, Scarface is in town."
+ "What's it about?"
+ "Human scum who kill each other over cocaine deals."
+ "Sounds great! Let's take the kids!"
+ -- Ian Shoales
+%
+I read Playboy for the same reason I read National Geographic.
+To see the sights I'm never going to visit.
+%
+I read the newspaper avidly. It is my one form of continuous fiction.
+ -- Aneurin Bevan
+%
+I realize that the MX missile is none of our concern. I realize that
+the whole point of living in a democracy is that we pay professional
+congresspersons to concern themselves with things like the MX missile
+so we can be free to concern ourselves with getting hold of the
+plumber.
+
+But from time to time, I feel I must address major public issues such
+as this, because in a free and open society, where the very future of
+the world hinges on decisions made by our elected leaders, you never
+win large cash journalism awards if you stick to the topics I usually
+write about, such as nose-picking.
+ -- Dave Barry, "At Last, the Ultimate Deterrent Against
+ Political Fallout"
+%
+I really had to act; 'cause I didn't have any lines.
+ -- Marilyn Chambers
+%
+I really hate this damned machine
+I wish that they would sell it.
+It never does quite what I want
+But only what I tell it.
+%
+I really look with commiseration over the great body of my fellow citizens
+who, reading newspapers, live and die in the belief that they have known
+something of what has been passing in their time.
+ -- Thomas Jefferson
+%
+I recognize terror as the finest emotion and so I will try to terrorize the
+reader. But if I find that I cannot terrify, I will try to horrify, and if
+I find that I cannot horrify, I'll go for the gross-out.
+ -- Stephen King
+%
+I refuse to consign the whole male sex to the nursery. I insist on
+believing that some men are my equals.
+ -- Brigid Brophy
+%
+I refuse to have a battle of wits with an unarmed person.
+%
+I remember once being on a station platform in Cleveland at four in the
+morning. A black porter was carrying my bags, and as we were waiting for
+the train to come in, he said to me: "Excuse me, Mr. Cooke, I don't want to
+invade your privacy, but I have a bet with a friend of mine. Who composed
+the opening theme music of `Omnibus'? My friend said Virgil Thomson." I
+asked him, "What do you say?" He replied, "I say Aaron Copeland." I said,
+"You're right." The porter said, "I knew Thomson doesn't write counterpoint
+that way." I told that to a network president, and he was deeply unimpressed.
+ -- Alistair Cooke
+%
+I remember Ulysses well... Left one day for the post office
+to mail a letter, met a blonde named Circe on the streetcar,
+and didn't come back for 20 years.
+%
+I remember when legal used to mean lawful, now it means some
+kind of loophole.
+ -- Leo Kessler
+%
+I replaced the headlights on my car with strobe lights. Now it
+looks like I'm the only one moving.
+ -- Steven Wright
+%
+I respect faith, but doubt is what gives you an education.
+ -- Wilson Mizner
+%
+I respect the institution of marriage. I have always thought that every
+woman should marry -- and no man.
+ -- Benjamin Disraeli, "Lothair"
+%
+I reverently believe that the maker who made us all makes everything in New
+England, but the weather. I don't know who makes that, but I think it must be
+raw apprentices in the weather-clerks factory who experiment and learn how, in
+New England, for board and clothes, and then are promoted to make weather for
+countries that require a good article, and will take their custom elsewhere
+if they don't get it.
+ -- Mark Twain
+%
+I sat down beside her, said hello, offered to buy her a drink...
+and then natural selection reared its ugly head.
+%
+I saw a man pursuing the Horizon,
+'Round and round they sped.
+I was disturbed at this,
+I accosted the man,
+"It is futile," I said.
+"You can never--"
+"You lie!" He cried,
+and ran on.
+ -- Stephen Crane
+%
+I saw a subliminal advertising executive, but only for a second.
+ -- Steven Wright
+%
+I saw Lassie. It took me four shows to figure out why the hairy kid
+never spoke. I mean, he could roll over and all that, but did that
+deserve a series?"
+%
+I saw what you did and I know who you are.
+%
+I see a bad moon rising.
+I see trouble on the way.
+I see earthquakes and lightnin'
+I see bad times today.
+Don't go 'round tonight,
+It's bound to take your life.
+There's a bad moon on the rise.
+ -- J. C. Fogerty, "Bad Moon Rising"
+%
+I see a good deal of talk from Washington about lowering taxes. I hope
+they do get 'em lowered down enough so people can afford to pay 'em.
+ -- Will Rogers
+%
+I see the eigenvalue in thine eye,
+I hear the tender tensor in thy sigh.
+Bernoulli would have been content to die
+Had he but known such _a-squared cos 2(phi)!
+ -- Stanislaw Lem, "Cyberiad"
+%
+I see where we are starting to pay some attention to our neighbors to
+the south. We could never understand why Mexico wasn't just crazy about
+us; for we have always had their good will, and oil and minerals, at heart.
+ -- The Best of Will Rogers
+%
+I sent a letter to the fish, I said it very loud and clear,
+I told them, "This is what I wish." I went and shouted in his ear.
+The little fishes of the sea, But he was very stiff and proud,
+They sent an answer back to me. He said "You needn't shout so loud."
+The little fishes' answer was And he was very proud and stiff,
+"We cannot do it, sir, because..." He said "I'll go and wake them if..."
+I sent a letter back to say I took a kettle from the shelf,
+It would be better to obey. I went to wake them up myself.
+But someone came to me and said But when I found the door was locked
+"The little fishes are in bed." I pulled and pushed and kicked and
+ knocked,
+I said to him, and I said it plain And when I found the door was shut,
+"Then you must wake them up again." I tried to turn the handle, But...
+
+ "Is that all?" asked Alice.
+ "That is all." said Humpty Dumpty. "Goodbye."
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+I sent a message to another time,
+But as the days unwind -- this I just can't believe,
+I sent a message to another plane,
+Maybe it's all a game -- but this I just can't conceive.
+...
+I met someone who looks at lot like you,
+She does the things you do, but she is an IBM.
+She's only programmed to be very nice,
+But she's as cold as ice, whenever I get too near,
+She tells me that she likes me very much,
+But when I try to touch, she makes it all too clear.
+...
+I realize that it must seem so strange,
+That time has rearranged, but time has the final word,
+She knows I think of you, she reads my mind,
+She tries to be unkind, she knows nothing of our world.
+ -- ELO, "Yours Truly, 2095"
+%
+I shall come to you in the night and we shall see who is stronger --
+a little girl who won't eat her dinner or a great big man with cocaine
+in his veins.
+ -- Sigmund Freud, in a letter to his fiancee
+%
+I shall give a propagandist reason for starting the war, no matter whether
+it is plausible or not. The victor will not be asked afterwards whether
+he told the truth or not. When starting and waging war it is not right
+that matters, but victory.
+ -- Adolf Hitler
+%
+I shot an arrow in to the air, and it stuck.
+ -- graffito in Los Angeles
+
+On a clear day,
+U.C.L.A.
+ -- graffito in San Francisco
+
+There's so much pollution in the air now that if it weren't for our
+lungs there'd be no place to put it all.
+ -- Robert Orben
+%
+I should have been a country-western singer. After all, I'm older than
+most western countries.
+ -- George Burns
+%
+I smell a wumpus.
+%
+I sold my memoirs of my love life to Parker
+Brothers -- they're going to make a game out of it.
+ -- Woody Allen
+%
+I sometimes think that God, in creating man, somewhat overestimated his
+ability.
+ -- Oscar Wilde
+%
+I steal.
+ -- Sam Giancana, explaining his livelihood to his draft board
+
+Easy. I own Chicago. I own Miami. I own Las Vegas.
+ -- Sam Giancana, when asked what he did for a living
+%
+I stick my neck out for nobody.
+ -- Humphrey Bogart, "Casablanca" (1942)
+%
+I stood on the leading edge,
+The eastern seaboard at my feet.
+"Jump!" said Yoko Ono
+I'm too scared and good-looking, I cried.
+Go on and give it a try,
+Why prolong the agony, all men must die.
+ -- Roger Waters, "The Pros and Cons of Hitchhiking"
+%
+I stopped believing in Santa Claus when I was six. Mother took me to
+see him in a department store and he asked for my autograph.
+ -- Shirley Temple
+%
+I suggest a new strategy, R2: let the Wookiee win.
+ -- C-3PO
+%
+I suggest you locate your hot tub outside your house, so it won't do
+too much damage if it catches fire or explodes. First you decide which
+direction your hot tub should face for maximum solar energy. After
+much trial and error, I have found that the best direction for a hot
+tub to face is up.
+ -- Dave Barry, "The Taming of the Screw"
+%
+I suppose I could collect my books and get on back to school,
+Or steal my daddy's cue and make a living out of playing pool,
+Or find myself a rock 'n' roll band,
+That needs a helping hand,
+Oh, Maggie I wish I'd never seen your face.
+ -- Rod Stewart, "Maggie May"
+%
+I suppose some of the variation between Boston drivers and the rest of the
+country is due to the progressive Massachusetts Driver Education Manual which
+I happen to have in my top desk drawer. Some of the Tips for Better Driving
+are worth considering, to wit:
+
+[110.13]:
+ "When traveling on a one-way street, stay to the right, so as not
+ to interfere with oncoming traffic."
+
+[22.17b]:
+ "Learning to change lanes takes time and patience. The best
+ recommendation that can be made is to go to a Celtics [basketball]
+ game; study the fast break and then go out and practice it
+ on the highway."
+
+[41.16]:
+ "Never bump a baby carriage out of a crosswalk unless the kid's really
+ asking for it."
+%
+I suppose some of the variation between Boston drivers and the rest of the
+country is due to the progressive Massachusetts Driver Education Manual which
+I happen to have in my top desk drawer. Some of the Tips for Better Driving
+are worth considering, to wit:
+
+[131.16d]:
+ "Directional signals are generally not used except during vehicle
+ inspection; however, a left-turn signal is appropriate when making
+ a U-turn on a divided highway."
+
+[96.7b]:
+ "When paying tolls, remember that it is necessary to release the
+ quarter a full 3 seconds before passing the basket if you are
+ traveling more than 60 MPH."
+%
+I suppose some of the variation between Boston drivers and the rest of the
+country is due to the progressive Massachusetts Driver Education Manual which
+I happen to have in my top desk drawer. Some of the Tips for Better Driving
+are worth considering, to wit:
+
+[173.15b]:
+ "When competing for a section of road or a parking space, remember
+ that the vehicle in need of the most body work has the right-of-way."
+
+[141.2a]:
+ "Although it is altogether possible to fit a 6' car into a 6'
+ parking space, it is hardly ever possible to fit a 6' car into
+ a 5' parking space."
+
+[105.31]:
+ "Teenage drivers believe that they are immortal, and drive accordingly.
+ Nevertheless, you should avoid the temptation to prove them wrong."
+%
+I suppose that in a few hours I will sober up. That's such a sad
+thought. I think I'll have a few more drinks to prepare myself.
+%
+I tell them to turn to the study of mathematics, for it
+is only there that they might escape the lusts of the flesh.
+ -- Thomas Mann, "The Magic Mountain"
+%
+I tell ya, drugs never worked out for me. The first time I tried smoking
+pot I didn't know what I was doing. I smoked half the joint, got the
+munchies, and ate the other half.
+
+Well, the first time I tried coke I was so embarrassed. I kept getting the
+bottle stuck up my nose.
+ -- Rodney Dangerfield
+%
+I tell ya, gambling never agreed with me. Last week I went to the track
+and they shot my horse with the opening gun.
+
+Well, just last week I was at a Chinese restaurant and when I opened my
+fortune cookie I found the guy's check sitting at the next table. I said,
+"Hey, buddy, I got your check", he said, "Thanks."
+ -- Rodney Dangerfield
+%
+I tell ya, I knew my morning wasn't going right. When I put on my shirt
+the button fell off, when I picked up my briefcase, the handle fell off,
+I tell ya, I was afraid to go to the bathroom.
+ -- Rodney Dangerfield
+%
+I think... I think it's in my basement... Let me go upstairs and check.
+ -- M. C. Escher
+%
+I think a relationship is like a shark. It has to constantly move forward
+or it dies. Well, what we have on our hands here is a dead shark.
+ -- Woody Allen
+%
+I think I'll snatch a kiss and flee.
+ -- William Shakespeare
+%
+I think I'm schizophrenic. One half of me's
+paranoid and the other half's out to get him.
+%
+I think it is true for all _n. I was just playing it safe with _n >= 3
+because I couldn't remember the proof.
+ -- Baker, Pure Math 351a
+%
+I THINK MAN INVENTED THE CAR by instinct.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I think sex is better than logic, but I can't prove it.
+%
+I think she must have been very strictly brought up, she's so
+desperately anxious to do the wrong thing correctly.
+ -- H. H. Munro, a.k.a. Saki, "Reginald on Worries"
+%
+I think that all good, right thinking people in this country are sick
+and tired of being told that all good, right thinking people in this
+country are fed up with being told that all good, right thinking people
+in this country are fed up with being sick and tired. I'm certainly
+not, and I'm sick and tired of being told that I am.
+ -- Monty Python
+%
+I think that I shall never hear
+A poem lovelier than beer.
+The stuff that Joe's Bar has on tap,
+With golden base and snowy cap.
+The stuff that I can drink all day
+Until my mem'ry melts away.
+Poems are made by fools, I fear
+But only Schlitz can make a beer.
+%
+I think that I shall never see
+A billboard lovely as a tree.
+Indeed, unless the billboards fall
+I'll never see a tree at all.
+ -- Ogden Nash
+%
+I think that I shall never see
+A thing as lovely as a tree.
+But as you see the trees have gone
+They went this morning with the dawn.
+A logging firm from out of town
+Came and chopped the trees all down.
+But I will trick those dirty skunks
+And write a brand new poem called "Trunks."
+%
+I think the sky is blue because it's a shift from black through purple
+to blue, and it has to do with where the light is. You know, the
+farther we get into darkness, and there's a shifting of color of light
+into the blueness, and I think as you go farther and farther away from
+the reflected light we have from the sun or the light that's bouncing
+off this earth, uh, the darker it gets ... I think if you look at the
+color scale, you start at black, move it through purple, move it on
+out, it's the shifting of color. We mentioned before about the stars
+singing, and that's one of the effects of the shifting of colors.
+ -- Pat Robertson, The 700 Club
+%
+I think the world is ready for the story of an ugly duckling, who grew up to
+remain an ugly duckling, and lived happily ever after.
+ -- Chick
+%
+I think the world is run by C students.
+ -- Al McGuire
+%
+I think the world would be a more peaceful place if people
+could just keep their fingers out of the fortune files.
+ -- Jordan K. Hubbard
+%
+I THINK THERE SHOULD BE SOMETHING in science called the "reindeer effect."
+I don't know what it would be, but I think it'd be good to hear someone
+say, "Gentlemen, what we have here is a terrifying example of the reindeer
+effect."
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I think, therefore I am... I think.
+%
+I think there's a world market for about five computers.
+ -- attr. Thomas J. Watson, Chairman of the Board, IBM (1943)
+%
+I THINK THEY SHOULD CONTINUE the policy of not giving a Nobel Prize for
+paneling.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I think we are in Rats Alley where the dead men lost their bones.
+ -- T. S. Eliot
+%
+I think we can all agree that there is not enough common courtesy shown
+... HEY! PAY ATTENTION WHEN I'M TALKING TO YOU DAMMIT! I said I think
+we can all agree that there is not enough common courtesy shown today.
+When we take the time to be courteous to each other, we find that we
+are happier and less likely to engage in nuclear war. This point was
+driven home by the recent summit talks, where Nancy Reagan and Raisa
+Gorbachev, each of whose husband thinks the other's husband is vermin,
+were able to sit down at a high-level tea and engage in courteous
+conversation ...
+ -- Dave Barry, "The Stuff of Etiquette"
+%
+I think we're all Bozos on this bus.
+ -- The Firesign Theatre
+%
+I think we're in trouble.
+ -- Han Solo
+%
+I think your opinions are reasonable,
+except for the one about my mental instability.
+ -- Psychology Professor, Fairfield University
+%
+"I thought that you said you were 20 years old!"
+"As a programmer, yes," she replied,
+"And you claimed to be very near two meters tall!"
+"You said you were blonde, but you lied!"
+Oh, she was a hacker and he was one, too,
+They had so much in common, you'd say.
+They exchanged jokes and poems, and clever new hacks,
+And prompts that were cute or risque'.
+He sent her a picture of his brother Sam,
+She sent one from some past high school day,
+And it might have gone on for the rest of their lives,
+If they hadn't met in L.A.
+"Your beard is an armpit," she said in disgust.
+He answered, "Your armpit's a beard!"
+And they chorused: "I think I could stand all the rest
+If you were not so totally weird!"
+If she had not said what he wanted to hear,
+And he had not done just the same,
+They'd have been far more honest, and never have met,
+And would not have had fun with the game.
+ -- Judith Schrier,
+ "Face to Face After Six Months of Electronic Mail"
+%
+I thought there was something fishy about the butler. Probably a Pisces,
+working for scale.
+ -- The Firesign Theatre,
+ "The Further Adventures of Nick Danger"
+%
+I thought YOU silenced the guard!
+%
+I told my doctor I got all the exercise I needed being a
+pallbearer for all my friends who run and do exercises!
+ -- Winston Churchill
+%
+I took a course in speed reading, learning to read straight down the middle
+of the page, and I was able to go through "War and Peace" in twenty minutes.
+It's about Russia.
+ -- Woody Allen
+%
+I treasure this strange combination found in very few persons: a fierce
+desire for life as well as a lucid perception of the ultimate futility of
+the quest.
+ -- Madeleine Gobeil
+%
+I truly wish I could be a great surgeon or philosopher or author or anything
+constructive, but in all honesty I'd rather turn up my amplifier full blast
+and drown myself in the noise.
+ -- Charles Schmid, the "Tucson Murderer"
+%
+I trust the first lion he meets will do his duty.
+ -- J. P. Morgan on Teddy Roosevelt's safari
+%
+I try not to break the rules but merely to test their elasticity.
+ -- Bill Veeck
+%
+I try to keep an open mind, but not so open that my brains fall out.
+ -- Judge Harold T. Stone
+%
+I turned my air conditioner the other way around, and it got cold out.
+The weatherman said "I don't understand it. I was supposed to be 80
+degrees today," and I said "Oops."
+
+In my house on the ceilings I have paintings of the rooms above... so
+I never have to go upstairs.
+
+I just bought a microwave fireplace... You can spend an evening in
+front of it in only eight minutes.
+ -- Steven Wright
+%
+I understand why you're confused. You're thinking too much.
+ -- Carole Wallach
+%
+I use not only all the brains I have, but all those I can borrow as well.
+ -- Woodrow Wilson
+%
+I use technology in order to hate it more properly.
+ -- Nam June Paik
+%
+I used to be a rebel in my youth.
+This cause... that cause... (chuckle) I backed 'em ALL! But I learned.
+Rebellion is simply a device used by the immature to hide from his own
+problems. So I lost interest in politics. Now when I feel aroused by
+a civil rights case or a passport hearing... I realize it's just a device.
+I go to my analyst and we work it out. You have no idea how much better
+I feel these days.
+ -- J. Feiffer
+%
+I used to be an agnostic, but now I'm not so sure.
+%
+I used to be disgusted, now I find I'm just amused.
+ -- Elvis Costello
+%
+I used to be Snow White, but I drifted.
+ -- Mae West
+%
+I used to be such a sweet sweet thing, 'til they got a hold of me,
+I opened doors for little old ladies, I helped the blind to see,
+I got no friends 'cause they read the papers, they can't be seen,
+With me, and I'm feelin' real shot down,
+And I'm, uh, feelin' mean,
+ No more, Mr. Nice Guy,
+ No more, Mr. Clean,
+ No more, Mr. Nice Guy,
+They say "He's sick, he's obscene".
+
+My dog bit me on the leg today, my cat clawed my eyes,
+Ma's been thrown out of the social circle, and Dad has to hide,
+I went to church, incognito, when everybody rose,
+The reverend Smithy, he recognized me,
+And punched me in the nose, he said,
+(chorus)
+He said "You're sick, you're obscene".
+ -- Alice Cooper, "No More Mr. Nice Guy"
+%
+I used to have a drinking problem.
+Now I love the stuff.
+%
+I used to live in a house by the freeway. When I went anywhere, I had
+to be going 65 MPH by the end of my driveway.
+
+I replaced the headlights in my car with strobe lights. Now it looks
+like I'm the only one moving.
+
+I was pulled over for speeding today. The officer said, "Don't you know
+the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
+to be out that long."
+
+I put a new engine in my car, but didn't take the old one out. Now
+my car goes 500 miles an hour.
+ -- Steven Wright
+%
+I used to think I was a child; now I think I am an adult -- not because
+I no longer do childish things, but because those I call adults are no
+more mature than I am.
+%
+I used to think I was indecisive, but now I'm not so sure.
+%
+I used to think romantic love was a neurosis shared by two, a supreme
+foolishness. I no longer thought that. There's nothing foolish in
+loving anyone. Thinking you'll be loved in return is what's foolish.
+ -- Rita Mae Brown
+%
+I used to think that the brain was the most wonderful organ in
+my body. Then I realized who was telling me this.
+ -- Emo Phillips
+%
+I used to work in a fire hydrant factory. You couldn't park anywhere near
+the place.
+ -- Steven Wright
+%
+I value kindness to human beings first of all, and kindness to animals. I
+don't respect the law; I have a total irreverence for anything connected
+with society except that which makes the roads safer, the beer stronger,
+the food cheaper, and old men and women warmer in the winter, and happier
+in the summer.
+ -- Brendan Behan
+%
+I waited and waited and when no message came I knew it must be from you.
+%
+I want to be the white man's brother, not his brother-in-law.
+ -- Martin Luther King, Jr.
+%
+I want to buy a husband who, every week when I sit down to watch "St.
+Elsewhere", won't scream, "FORGET IT, BLANCHE ... IT'S TIME FOR 'HEE
+HAW'!!"
+ -- Berke Breathed, "Bloom County"
+%
+I want to marry a girl just like the girl that married dear old dad.
+ -- Freud
+%
+I want to reach your mind -- where is it currently located?
+%
+I was appalled by this story of the destruction of a member of a valued
+endangered species. It's all very well to celebrate the practicality of
+pigs by ennobling the porcine sibling who constructed his home out of
+bricks and mortar. But to wantonly destroy a wolf, even one with an
+excessive taste for porkers, is unconscionable in these ecologically
+critical times when both man and his domestic beasts continue to maraud
+the earth.
+ Sylvia Kamerman, "Book Reviewing"
+%
+I was at this restaurant. The sign said "Breakfast Anytime." So I
+ordered French Toast in the Renaissance.
+ -- Steven Wright
+%
+I was born because it was a habit in those days, people didn't know
+anything else ... I was not a Child Prodigy, because a Child Prodigy is
+a child who knows as much when it is a child as it does when it grows
+up.
+ -- Will Rogers
+%
+I was born in a barrel of butcher knives
+Trouble I love and peace I despise
+Wild horses kicked me in my side
+Then a rattlesnake bit me and he walked off and died.
+ -- Bo Diddley
+%
+I was drunk last night, crawled home across the lawn. By accident I
+put the car key in the door lock. The house started up. So I figured
+what the hell, and drove it around the block a few times. I thought I
+should go park it in the middle of the freeway and yell at everyone to
+get off my driveway.
+ -- Steven Wright
+%
+I was eatin' some chop suey,
+With a lady in St. Louie,
+When there sudden comes a knockin' at the door.
+And that knocker, he says, "Honey,
+Roll this rocker out some money,
+Or your daddy shoots a baddie to the floor."
+ -- Mr. Miggle
+%
+I was gratified to be able to answer promptly, and I did.
+I said I didn't know.
+ -- Mark Twain
+%
+I was in a bar and I walked up to a beautiful woman and said, "Do you live
+around here often?" She said, "You're wearing two different-color socks."
+I said, "Yes, but to me they're the same because I go by thickness."
+She said, "How do you feel?" And I said, "You know when you're sitting on a
+chair and you lean back so you're just on two legs and you lean too far so
+you almost fall over but at the last second you catch yourself? I feel like
+that all the time."
+ -- Steven Wright, "Gentlemen's Quarterly"
+%
+I was in a beauty contest once. I not only came in last, I was hit in
+the mouth by Miss Congeniality.
+ -- Phyllis Diller
+%
+I was in accord with the system so long as it
+permitted me to function effectively.
+ -- Albert Speer
+%
+I was in this prematurely air conditioned supermarket and there were all
+these aisles and there were these bathing caps you could buy that had these
+kind of Fourth of July plumes on them that were red and yellow and blue and
+I wasn't tempted to buy one but I was reminded of the fact that I had been
+avoiding the beach.
+ -- Lucinda Childs "Einstein On The Beach"
+%
+I was in Vegas last week. I was at the roulette table, having a
+lengthy argument about what I considered an Odd number.
+ -- Steven Wright
+%
+I was offered a job as a hoodlum and I turned it down cold. A thief is
+anybody who gets out and works for his living, like robbing a bank or
+breaking into a place and stealing stuff, or kidnaping somebody. He really
+gives some effort to it. A hoodlum is a pretty lousy sort of scum. He
+works for gangsters and bumps guys off when they have been put on the spot.
+Why, after I'd made my rep, some of the Chicago Syndicate wanted me to work
+for them as a hood -- you know, handling a machine gun. They offered me
+two hundred and fifty dollars a week and all the protection I needed. I
+was on the lam at the time and not able to work at my regular line. But
+I wouldn't consider it. "I'm a thief," I said. "I'm no lousy hoodlum."
+ -- Alvin Karpis, "Public Enemy Number One"
+%
+I was part of that strange race of people aptly described as spending
+their lives doing things they detest to make money they don't want to
+buy things they don't need to impress people they dislike.
+ -- Emile Henry Gauvreay
+%
+I was playing poker the other night... with Tarot cards. I got a
+full house and four people died.
+ -- Steven Wright
+%
+I was the best I ever had.
+ -- Woody Allen
+%
+I was toilet-trained at gunpoint.
+ -- Billy Braver
+%
+I was working on a case. It had to be a case, because I couldn't afford a
+desk. Then I saw her. This tall blond lady. She must have been tall
+because I was on the third floor. She rolled her deep blue eyes towards
+me. I picked them up and rolled them back. We kissed. She screamed. I
+took the cigarette from my mouth and kissed her again.
+%
+I wasn't kissing her, I was whispering in her mouth.
+ -- Chico Marx
+%
+I watch television because you don't know what it will do if you leave it
+in the room alone.
+%
+I went home with a waitress,
+The way I always do.
+How I was I to know?
+She was with the Russians too.
+
+I was gambling in Havana,
+I took a little risk.
+Send lawyers, guns, and money,
+Dad, get me out of this.
+ -- Warren Zevon, "Lawyers, Guns and Money"
+%
+I went into a general store ... they wouldn't sell me anything specific.
+ -- Steven Wright
+%
+I went into the business for the money, and the art grew out of it.
+If people are disillusioned by that remark, I can't help it.
+It's the truth.
+ -- Charlie Chaplin
+%
+I went on to test the program in every way I could devise. I strained it to
+expose its weaknesses. I ran it for high-mass stars and low-mass stars, for
+stars born exceedingly hot and those born relatively cold. I ran it assuming
+the superfluid currents beneath the crust to be absent -- not because I wanted
+to know the answer, but because I had developed an intuitive feel for the
+answer in this particular case. Finally I got a run in which the computer
+showed the pulsar's temperature to be less than absolute zero. I had found
+an error. I chased down the error and fixed it. Now I had improved the
+program to the point where it would not run at all.
+ -- George Greenstein, "Frozen Star:
+ Of Pulsars, Black Holes and the Fate of Stars"
+%
+I went over to my friend, he was eatin' a pickle.
+I said "Hi, what's happenin'?"
+He said "Nothin'."
+Try to sing this song with that kind of enthusiasm;
+As if you just squashed a cop.
+ -- Arlo Guthrie, "Motorcycle Song"
+%
+I went to a Grateful Dead Concert and they played for SEVEN hours.
+Great song.
+ -- Fred Reuss
+%
+I went to a job interview the other day, the guy asked me if I had any
+questions, I said yes, just one, if you're in a car traveling at the
+speed of light and you turn your headlights on, does anything happen?
+
+He said he couldn't answer that, I told him sorry, but I couldn't work
+for him then.
+ -- Steven Wright
+%
+I went to my first computer conference at the New York Hilton about 20
+years ago. When somebody there predicted the market for microprocessors
+would eventually be in the millions, someone else said, "Where are they
+all going to go? It's not like you need a computer in every doorknob!"
+
+Years later, I went back to the same hotel. I noticed the room keys had
+been replaced by electronic cards you slide into slots in the doors.
+
+There was a computer in every doorknob.
+ -- Danny Hillis
+%
+I went to my mother and told her I intended to commence a different life.
+I asked for and obtained her blessing and at once commenced the career
+of a robber.
+ -- Tiburcio Vasquez
+%
+I went to the hardware store and bought some used paint. It was in
+the shape of a house. I also bought some batteries, but they weren't
+included.
+ -- Steven Wright
+%
+I went to the museum where they had all the heads and arms from the
+statues that are in all the other museums.
+ -- Steven Wright
+%
+I went to the race track once and bet on a horse that was so good that
+it took seven others to beat him!
+%
+I will always love the false image I had of you.
+%
+I will follow the good side right to the fire,
+but not into it if I can help it.
+ -- Michel Eyquem de Montaigne
+%
+I will honour Christmas in my heart, and try to keep it all the
+year. I will live in the Past, the Present, and the Future. The
+Spirits of all Three shall strive within me. I will not shut out
+the lessons that they teach. Oh, tell me that I may sponge away the
+writing on this stone!
+ -- Charles Dickens
+%
+I will make you shorter by the head.
+ -- Elizabeth I
+%
+I will never lie to you.
+%
+I will not be briefed or debriefed, my underwear is my own.
+%
+I will not drink!
+But if I do...
+I will not get drunk!
+But if I do...
+I will not in public!
+But if I do...
+I will not fall down!
+But if I do...
+I will fall face down so that they cannot see my company badge.
+%
+I will not forget you.
+%
+I will not play at tug o' war.
+I'd rather play at hug o' war,
+Where everyone hugs
+Instead of tugs,
+Where everyone giggles
+And rolls on the rug,
+Where everyone kisses,
+And everyone grins,
+And everyone cuddles,
+And everyone wins.
+ -- Shel Silverstein, "Hug O' War"
+%
+I will not say that women have no character; rather, they have a new
+one every day.
+ -- Heine
+%
+I wish a robot would get elected president. That way, when he came to town,
+we could all take a shot at him and not feel too bad.
+ -- Jack Handey
+%
+I WISH I HAD A KRYPTONITE CROSS, because then you could keep both Dracula
+and Superman away.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I wish there was a knob on the TV where you could turn up the
+intelligence. They've got one called brightness, but it doesn't
+seem to work.
+ -- Gallagher
+%
+I wish you humans would leave me alone.
+%
+I wish you were a Scotch on the rocks.
+%
+I woke up a feelin' mean
+went down to play the slot machine
+the wheels turned round,
+and the letters read
+"Better head back to Tennessee Jed"
+ -- Grateful Dead
+%
+I woke up this morning and discovered that everything in my apartment
+had been stolen and replaced with an exact replica. I told my roommate,
+"Isn't this amazing? Everything in the apartment has been stolen and
+replaced with an exact replica." He said, "Do I know you?"
+ -- Steven Wright
+%
+"I wonder", he said to himself, "what's in a book while it's closed. Oh, I
+know it's full of letters printed on paper, but all the same, something must
+be happening, because as soon as I open it, there's a whole story with people
+I don't know yet and all kinds of adventures and battles."
+ -- Bastian B. Bux
+%
+I wonder what the leash and collar set does for excitement?
+ -- Tramp, "Lady and the Tramp"
+%
+I worked in a health food store once. A guy came in and asked me,
+"If I melt dry ice, can I take a bath without getting wet?"
+ -- Steven Wright
+%
+I would be batting the big feller if they wasn't ready with the other one,
+but a left-hander would be the thing if they wouldn't have knowed it already
+because there is more things involved than could come up on the road, even
+after we've been home a long while.
+ -- Casey Stengel
+%
+I would gladly raise my voice in praise of women,
+only they won't let me raise my voice.
+ -- Winkle
+%
+I would have made a good pope.
+ -- Richard M. Nixon
+%
+I would have promised those terrorists a trip to Disneyland if it would have
+gotten the hostages released. I thank God they were satisfied with the
+missiles and we didn't have to go to that extreme.
+ -- Oliver North
+%
+I would have you imagine, then, that there exists in the mind of man a block
+of wax... and that we remember and know what is imprinted as long as the
+image lasts; but when the image is effaced, or cannot be taken, then we
+forget or do not know.
+ -- Plato, Dialogs, Theateus 191
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to image activation and termination.]
+%
+I would like the government to do all it can to mitigate, then, in
+understanding, in mutuality of interest, in concern for the common good,
+our tasks will be solved.
+ -- Warren G. Harding
+%
+I would like to electrocute everyone who uses the word "fair" in connection
+with income tax policies.
+ -- William F. Buckley
+%
+I would like to know
+What I was fencing in
+And what I was fencing out.
+ -- Robert Frost
+%
+I would much rather have men ask why
+I have no statue, than why I have one.
+ -- Marcus Porcius Cato
+%
+I would not like to be a political leader in Russia. They never know when
+they're being taped.
+ -- Richard M. Nixon
+
+I love America. You always hurt the one you love.
+ -- David Frye impersonating Nixon
+%
+I would rather be a serf in a poor man's house
+and be above ground than reign among the dead.
+ -- Achilles, "The Odyssey", XI, 489-91
+%
+I would rather say that a desire to drive fast
+sports cars is what sets man apart from the animals.
+%
+I wouldn't be so paranoid if you weren't all out to get me!!
+%
+I wouldn't marry her with a ten foot pole.
+%
+I wouldn't recommend sex, drugs or insanity
+for everyone, but they've always worked for me.
+ -- Hunter S. Thompson
+%
+I wrecked trains because I like to see people die. I like to hear
+them scream.
+ -- Sylvestre Matuschka, "the Hungarian Train Wreck Freak",
+ escaped prison 1937, not heard from since
+%
+I
+am
+not
+very
+happy
+acting
+pleased
+whenever
+prominent
+scientists
+overmagnify
+intellectual
+enlightenment
+%
+IBM:
+ [International Business Machines Corp.] Also known as Itty Bitty
+ Machines or The Lawyer's Friend. The dominant force in computer
+ marketing, having supplied worldwide some 75% of all known hardware
+ and 10% of all software. To protect itself from the litigious envy
+ of less successful organizations, such as the US government, IBM
+ employs 68% of all known ex-Attorneys' General.
+%
+IBM:
+ I've Been Moved
+ Idiots Become Managers
+ Idiots Buy More
+ Impossible to Buy Machine
+ Incredibly Big Machine
+ Industry's Biggest Mistake
+ International Brotherhood of Mercenaries
+ It Boggles the Mind
+ It's Better Manually
+ Itty-Bitty Machines
+%
+IBM Advanced Systems Group -- a bunch of mindless jerks,
+who'll be first against the wall when the revolution comes...
+ -- with regrets to Douglas Adams
+%
+IBM had a PL/I,
+Its syntax worse than JOSS;
+And everywhere this language went,
+It was a total loss.
+%
+IBM: It may be slow, but it's hard to use.
+%
+IBM Pollyanna Principle:
+ Machines should work. People should think.
+%
+IBM's original motto:
+ Cogito ergo vendo; vendo ergo sum.
+%
+I'd be a poorer man if I'd never seen an eagle fly.
+ -- John Denver
+
+[I saw an eagle fly once. Fortunately, I had my eagle fly swatter handy. Ed.]
+%
+I'd give my right arm to be ambidextrous.
+%
+I'd horsewhip you if I had a horse.
+ -- Groucho Marx
+%
+I'd just as soon kiss a Wookiee.
+ -- Princess Leia Organa
+%
+I'D LIKE TO BE BURIED INDIAN-STYLE, where they put you up on a high rack,
+above the ground. That way, you could get hit by meteorites and not even
+feel it.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+I'd like to meet the guy who invented beer and see what he's working on now.
+%
+I'd like to see the government get out of war altogether and leave the
+whole field to private industry.
+ -- Joseph Heller
+%
+I'd love to go out with you, but I did my own thing and now I've got
+to undo it.
+%
+I'd love to go out with you, but I have to stay home and see if I
+snore.
+%
+I'd love to go out with you, but I never go out on days that end in
+"Y".
+%
+I'd love to go out with you, but I'm taking punk totem pole carving.
+%
+I'd love to go out with you, but the last time I went out, I never
+came back.
+%
+I'd love to go out with you, but the man on television told me to stay
+tuned.
+%
+I'd love to kiss you, but I just washed my hair.
+ -- Bette Davis, "Cabin in the Cotton"
+%
+I'd never cry if I did find
+ A blue whale in my soup...
+Nor would I mind a porcupine
+ Inside a chicken coop.
+Yes life is fine when things combine,
+ Like ham in beef chow mein...
+But lord, this time I think I mind,
+ They've put acid in my rain.
+ -- Milo Bloom
+%
+I'd never join any club that would have the likes of me as a member.
+ -- Groucho Marx
+%
+I'd probably settle for a vampire if he were romantic enough.
+Couldn't be any worse than some of the relationships I've had.
+ -- Brenda Starr
+%
+I'd rather be led to hell than managed to heaven.
+%
+I'd rather have a bottle in front of me than a frontal lobotomy.
+%
+I'd rather have a free bottle in front of me than a prefrontal lobotomy.
+ -- Fred Allen
+
+[Also attributed to S. Clay Wilson. Ed.]
+%
+I'd rather have two girls at 21 each than one girl at 42.
+ -- W. C. Fields
+%
+I'd rather just believe that it's done by little elves running around.
+%
+I'd rather laugh with the sinners,
+Than cry with the saints,
+The sinners are much more fun!
+ -- Billy Joel, "Only The Good Die Young"
+%
+I'd rather push my Harley than ride a rice burner.
+%
+Ideas don't stay in some minds very long because they don't like
+solitary confinement.
+%
+Identify your visitor.
+%
+Idiot Box, n.:
+ The part of the envelope that tells a person where to place the
+ stamp when they can't quite figure it out for themselves.
+ -- Rich Hall, "Sniglets"
+%
+Idiot, n.:
+ A member of a large and powerful tribe whose influence in human
+ affairs has always been dominant and controlling.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+IDLENESS:
+ Leisure gone to seed.
+%
+Idleness is the holiday of fools.
+%
+If 10 years from now, when you are doing something quick
+and dirty, you suddenly visualize that I am looking over your
+shoulders and say to yourself, "Dijkstra would not have liked this",
+well that would be enough immortality for me.
+ -- Edsger W. Dijkstra
+%
+If A = B and B = C, then A = C, except where void or prohibited by law.
+ -- Roy Santoro
+%
+If a 6600 used paper tape instead of core memory, it would use up tape
+at about 30 miles/second.
+ -- Grishman, Assembly Language Programming
+%
+If a camel flies, no one laughs if it doesn't get very far.
+ -- Paul White
+%
+If a camel is a horse designed by a committee, then a consensus forecast
+is a camel's behind.
+ -- Edgar R. Fiedler
+%
+If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars?
+%
+If A equals success, then the formula is _A = _X + _Y + _Z. _X is work. _Y
+is play. _Z is keep your mouth shut.
+ -- Albert Einstein
+%
+If A fool persists in his folly he shall become wise.
+ -- William Blake
+%
+If a group of N persons implements a COBOL compiler,
+there will be N-1 passes. Someone in the group has to be the manager.
+ -- T. Cheatham
+%
+If a guru falls in the forest with no one to hear him, was he
+really a guru at all?
+ -- Strange de Jim, "The Metasexuals"
+%
+If a jury in a criminal trial stays out for more than twenty-four hours, it
+is certain to vote acquittal, save in those instances where it votes guilty.
+ -- Joseph C. Goulden
+%
+IF A KID ASKS YOU where rain comes from, I think a cute thing to tell him
+is, "God is crying." And if he asks why God is crying, another cute thing
+to tell him is, "Probably because of something you did."
+ -- Jack Handey, "The New Mexican" (1988)
+%
+If a listener nods his head when you're
+explaining your program, wake him up.
+%
+If a man has a strong faith he can indulge in the luxury of skepticism.
+ -- Friedrich Nietzsche
+%
+If a man has talent and cannot use it, he has failed.
+ -- Thomas Wolfe
+%
+If a man is not a liberal at 25, he has no heart.
+If he's not a conservative by 45, he has no brain.
+%
+If a man loses his reverence for any part of life,
+he will lose his reverence for all of life.
+ -- Albert Schweitzer
+%
+If a man stay away from his wife for seven years, the law presumes the
+separation to have killed him; yet according to our daily experience,
+it might well prolong his life.
+ -- Charles Darling, "Scintillae Juris, 1877
+%
+If a nation expects to be ignorant and free,
+... it expects what never was and never will be.
+ -- Thomas Jefferson
+%
+If a nation values anything more than freedom, it will lose its freedom;
+and the irony of it is that if it is comfort or money it values more, it
+will lose that, too.
+ -- W. Somerset Maugham
+%
+If a person (a) is poorly, (b) receives treatment intended to make him better,
+and (c) gets better, then no power of reasoning known to medical science can
+convince him that it may not have been the treatment that restored his health.
+ -- Sir Peter Medawar, "The Art of the Soluble"
+%
+If a President doesn't do it to his wife, he'll do it to his country.
+%
+If a putt passes over the hole without dropping, it is deemed to have dropped.
+The law of gravity holds that any object attempting to maintain a position
+in the atmosphere without something to support it must drop. The law of
+gravity supersedes the law of golf.
+ -- Donald A. Metz
+%
+If a shameless woman expects to be defiled and then dies of her fierce
+love because you do not consent, will chastity also be homicide?
+ -- Saint Augustine
+%
+If a small child asks you where rain comes from, I think a reasonable response
+is simply that "God is crying." And, if he asks you why God is crying, the
+only possible answer is "Probably because of something you did."
+%
+If a system is administered wisely,
+its users will be content.
+They enjoy hacking their code
+and don't waste time implementing
+labor-saving shell scripts.
+Since they dearly love their accounts,
+they aren't interested in other machines.
+There may be telnet, rlogin, and ftp,
+but these don't access any hosts.
+There may be an arsenal of cracks and malware,
+but nobody ever uses them.
+People enjoy reading their mail,
+take pleasure in being with their newsgroups,
+spend weekends working at their terminals,
+delight in the doings at the site.
+And even though the next system is so close
+that users can hear its key clicks and biff beeps,
+they are content to die of old age
+without ever having gone to see it.
+%
+If a team is in a positive frame of mind, it will have a good attitude.
+If it has a good attitude, it will make a commitment to playing the
+game right. If it plays the game right, it will win -- unless, of
+course, it doesn't have enough talent to win, and no manager can make
+goose-liver pate out of goose feathers, so why worry?
+ -- Sparky Anderson
+%
+If a thing's worth doing, it is worth doing badly.
+ -- G. K. Chesterton
+%
+If a thing's worth having, it's worth cheating for.
+ -- W. C. Fields
+%
+If a train station is a place where a train stops, what's a workstation?
+%
+If addiction is judged by how long a dumb animal will sit pressing a lever
+to get a "fix" of something, to its own detriment, then I would conclude
+that netnews is far more addictive than cocaine.
+ -- Rob Stampfli
+%
+If all be true that I do think,
+There be five reasons why one should drink;
+Good friends, good wine, or being dry,
+Or lest we should be by-and-by,
+Or any other reason why.
+%
+If all else fails, immortality can always be assured by spectacular error.
+ -- John Kenneth Galbraith
+%
+If all else fails, lower your standards.
+%
+If all men were brothers, would you let one marry your sister?
+%
+If all the Chinese simultaneously jumped into the Pacific off a 10 foot
+platform erected 10 feet off their coast, it would cause a tidal wave
+that would destroy everything in this country west of Nebraska.
+%
+If all the seas were ink,
+And all the reeds were pens,
+And all the skies were parchment,
+And all the men could write,
+These would not suffice
+To write down all the red tape
+Of this Government.
+%
+If all the world's a stage, I want to operate the trap door.
+ -- Paul Beatty
+%
+If all the world's economists were laid end to end,
+we wouldn't reach a conclusion.
+ -- William Baumol
+%
+If an average person on the subway turns to you, like an ancient mariner,
+and starts telling you her tale, you turn away or nod and hope she stops,
+not just because you fear she might be crazy. If she tells her tale on
+camera, you might listen. Watching strangers on television, even
+responding to them from a studio audience, we're disengaged - voyeurs
+collaborating with exhibitionists in rituals of sham community. Never
+have so many known so much about people for whom they cared so little.
+ -- Wendy Kaminer commenting on testimonial television
+ in "I'm Dysfunctional, You're Dysfunctional".
+%
+If an S and an I and an O and a U
+With an X at the end spell Su;
+And an E and a Y and an E spell I,
+Pray what is a speller to do?
+Then, if also an S and an I and a G
+And an HED spell side,
+There's nothing much left for a speller to do
+But to go commit siouxeyesighed.
+ -- Charles Follen Adams, "An Orthographic Lament"
+%
+If any demonstrator ever lays down in front of my car, it'll be the last
+car he ever lays down in front of.
+ -- George Wallace
+%
+If any man wishes to be humbled and mortified,
+let him become president of Harvard.
+ -- Edward Holyoke
+%
+If anyone has seen my dog, please contact me at x2883 as soon as possible.
+We're offering a substantial reward. He's a sable collie, with three legs,
+blind in his left eye, is missing part of his right ear and the tip of his
+tail. He's been recently fixed. Answers to "Lucky".
+%
+If at first you do succeed, try to hide your astonishment.
+%
+If at first you don't succeed, destroy all evidence that you tried.
+%
+If at first you don't succeed, quit; don't be a nut about success.
+%
+If at first you don't succeed, redefine success.
+%
+If at first you don't succeed, skydiving is not for you.
+%
+If at first you don't succeed, try, try again.
+ -- W. E. Hickson
+%
+If at first you don't succeed, try, try again.
+Then quit. No use being a damn fool about it.
+ -- W. C. Fields
+
+[Also attributed to Roy Mengot. Ed.]
+%
+If at first you don't succeed, you must be a programmer.
+%
+If at first you don't succeed, you're doing about average.
+ -- Leonard Levinson
+%
+If at first you fricassee, fry, fry again.
+%
+If atheism is to be used to express the state of mind in which God is
+identified with the unknowable, and theology is pronounced to be a
+collection of meaningless words about unintelligible chimeras, then
+I have no doubt, and I think few people doubt, that atheists are as
+plentiful as blackberries.
+ -- Leslie Stephen
+%
+If bankers can count, how come they have
+eight windows and only four tellers?
+%
+If Beethoven's Seventh Symphony is not by
+some means abridged, it will soon fall into disuse.
+ -- Philip Hale, Boston music critic, 1837
+%
+If built in great numbers, motels will be used for nothing
+but illegal purposes.
+ -- J. Edgar Hoover
+%
+If Carter is the answer, it must have been a VERY silly question.
+%
+If Christianity was morality, Socrates would be the Saviour.
+ -- William Blake
+%
+If clear thinking created sparks, we could safely store dynamite in James
+Watt's office.
+ -- Wayne Shannon
+%
+If coke is a joke, I'm waiting around for the next line.
+%
+If computers take over (which seems to be their natural tendency), it will
+serve us right.
+ -- Alistair Cooke
+%
+If dolphins are so smart, why did Flipper work for television?
+%
+If entropy is increasing, where is it coming from?
+%
+If ever the pleasure of one has to be bought by the pain of the other,
+there better be no trade. A trade by which one gains and the other loses
+is a fraud.
+ -- Dagny Taggart, "Atlas Shrugged"
+%
+If ever you want to touch the hand and the heart of God Almighty, you can
+do it through the body of someone you love. Anytime. Anywhere. Without
+no middleman.
+ -- Theodore Sturgeon, "Godbody"
+%
+If every kid had a funny tooth to bite down on whenever the world disappointed
+him, prussic acid could solve our population problems in one generation.
+ -- G. C. Edmonson's Albert, "The Man Who Corrupted Earth"
+%
+If everybody minded their own business, the world would go
+around a deal faster.
+ -- The Duchess; Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+If everything is coming your way then you're in the wrong lane.
+%
+If everything on the road of life seems to
+be coming your way, you're in the wrong lane.
+%
+If everything seems to be going well,
+you have obviously overlooked something.
+%
+If fifty million people say a foolish thing, it's still a foolish thing.
+ -- Bertrand Russell
+%
+If food be the music of love, eat up, eat up.
+%
+If for every rule there is an exception, then we have established that there
+is an exception to every rule. If we accept "For every rule there is an
+exception" as a rule, then we must concede that there may not be an exception
+after all, since the rule states that there is always the possibility of
+exception, and if we follow it to its logical end we must agree that there
+can be an exception to the rule that for every rule there is an exception.
+ -- Bill Boquist
+%
+If God did not exist, it would be necessary to invent him.
+ -- Voltaire, "Epitres, XCVI"
+%
+If God didn't mean for us to juggle, tennis balls wouldn't come three
+to a can.
+%
+If God had a beard, he'd be a UNIX programmer.
+%
+If God had intended Man to program, we'd be born with serial I/O ports.
+%
+If God had intended Man to Smoke, He would have set him on Fire.
+%
+If God had intended Man to Walk, He would have given him Feet.
+%
+If God had intended Man to Watch TV, He would have given him Rabbit Ears.
+%
+If God had intended Men to Smoke, He would have put Chimneys in their Heads.
+%
+If God had meant for us to be in the Army,
+we would have been born with green, baggy skin.
+%
+If God had meant for us to be naked, we would have been born that way.
+%
+If God had not given us sticky tape,
+it would have been necessary to invent it.
+%
+If God had really intended men to fly,
+he'd make it easier to get to the airport.
+ -- George Winters
+%
+If God had wanted us to be concerned for the plight of the toads, he would
+have made them cute and furry.
+ -- Dave Barry
+%
+If God had wanted us to use the metric system, Jesus would have had
+only ten apostles.
+%
+If God had wanted you to go around nude,
+He would have given you bigger hands.
+%
+If God hadn't wanted you to be paranoid,
+He wouldn't have given you such a vivid imagination.
+%
+If God is dead, who will save the Queen?
+%
+If God is One, what is bad?
+ -- Charles Manson
+%
+If God is perfect, why did He create discontinuous functions?
+%
+If God lived on Earth, people would knock out all His windows.
+ -- Yiddish saying
+%
+If God wanted us to be brave, why did he give us legs?
+ -- Marvin Kitman
+%
+If God wanted us to have a President,
+He would have sent us a candidate.
+ -- Jerry Dreshfield
+%
+If graphics hackers are so smart,
+why can't they get the bugs out of fresh paint?
+%
+If happiness is in your destiny, you need not be in a hurry.
+ -- Chinese proverb
+%
+If he had only learnt a little less, how
+infinitely better he might have taught much more!
+%
+If he once again pushes up his sleeves in order to compute for 3 days
+and 3 nights in a row, he will spend a quarter of an hour before to
+think which principles of computation shall be most appropriate.
+ -- Voltaire, "Diatribe du docteur Akakia"
+%
+If he should ever change his faith,
+it'll be because he no longer thinks he's God.
+%
+If I cannot bend Heaven, I shall move Hell.
+ -- Publius Vergilius Maro (Virgil)
+%
+If I could drop dead right now, I'd be the happiest man alive!
+ -- Samuel Goldwyn
+%
+If I could read your mind, love,
+What a tale your thoughts could tell,
+Just like a paperback novel,
+The kind the drugstore sells,
+When you reach the part where the heartaches come,
+The hero would be me,
+Heroes often fail,
+You won't read that book again, because
+ the ending is just too hard to take.
+
+I walk away, like a movie star,
+Who gets burned in a three way script,
+Enter number two,
+A movie queen to play the scene
+Of bringing all the good things out in me,
+But for now, love, let's be real
+I never thought I could act this way,
+And I've got to say that I just don't get it,
+I don't know where we went wrong but the feeling is gone
+And I just can't get it back...
+ -- Gordon Lightfoot, "If You Could Read My Mind"
+%
+If I could stick my pen in my heart,
+I would spill it all over the stage.
+Would it satisfy ya, would it slide on by ya,
+Would you think the boy was strange?
+Ain't he strange?
+...
+If I could stick a knife in my heart,
+Suicide right on the stage,
+Would it be enough for your teenage lust,
+Would it help to ease the pain?
+Ease your brain?
+ -- Rolling Stones, "It's Only Rock'N Roll"
+%
+If I 'cp /bin/csh /dev/audio' shouldn't I hear the ocean?
+ -- Danno Coppock
+%
+If I don't drive around the park,
+I'm pretty sure to make my mark.
+If I'm in bed each night by ten,
+I may get back my looks again.
+If I abstain from fun and such,
+I'll probably amount to much;
+But I shall stay the way I am,
+Because I do not give a damn.
+ -- Dorothy Parker
+%
+If I don't see you in the future, I'll see you in the pasture.
+%
+If I had a formula for bypassing trouble, I would not pass it around.
+Trouble creates a capacity to handle it. I don't say embrace trouble; that's
+as bad as treating it as an enemy. But I do say meet it as a friend, for
+you'll see a lot of it and you had better be on speaking terms with it.
+ -- Oliver Wendell Holmes, Jr.
+%
+If *I* had a hammer, there'd be no more folk singers.
+%
+IF I HAD A MINE SHAFT, I don't think I would just abandon it. There's
+got to be a better way.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+If I had a plantation in Georgia and a home in Hell,
+I'd sell the plantation and go home.
+ -- Eugene P. Gallagher
+%
+If I had any humility I would be perfect.
+ -- Ted Turner
+%
+If I had done everything I'm credited with, I'd be speaking to you from
+a laboratory jar at Harvard.
+ -- Frank Sinatra
+
+AS USUAL, YOUR INFORMATION STINKS.
+ -- Frank Sinatra, telegram to "Time" magazine
+%
+If I had my life to live over, I'd try to make more mistakes next time. I
+would relax, I would limber up, I would be sillier than I have been this
+trip. I know of very few things I would take seriously. I would be crazier.
+I would climb more mountains, swim more rivers and watch more sunsets. I'd
+travel and see. I would have more actual troubles and fewer imaginary ones.
+You see, I am one of those people who lives prophylactically and sensibly
+and sanely, hour after hour, day after day. Oh, I have had my moments and,
+if I had it to do over again, I'd have more of them. In fact, I'd try to
+have nothing else. Just moments, one after another, instead of living so many
+years ahead each day. I have been one of those people who never go anywhere
+without a thermometer, a hot water bottle, a gargle, a raincoat and a parachute.
+If I had it to do over again, I would go places and do things and travel
+lighter than I have. If I had my life to live over, I would start bare-footed
+earlier in the spring and stay that way later in the fall. I would play hooky
+more. I probably wouldn't make such good grades, but I'd learn more. I would
+ride on more merry-go-rounds. I'd pick more daisies.
+%
+If I had only known, I would have been a locksmith.
+ -- Albert Einstein
+%
+If I had to live my life again, I'd make the same mistakes, only sooner.
+ -- Tallulah Bankhead
+%
+If I have not seen so far it is because I stood in giant's footsteps.
+%
+If I have seen farther than others, it is because I was standing on the
+shoulders of giants.
+ -- Isaac Newton
+
+In the sciences, we are now uniquely privileged to sit side by side with
+the giants on whose shoulders we stand.
+ -- Gerald Holton
+
+If I have not seen as far as others, it is because giants were standing on
+my shoulders.
+ -- Hal Abelson
+
+Mathematicians stand on each other's shoulders.
+ -- Gauss
+
+Mathematicians stand on each other's shoulders while computer scientists
+stand on each other's toes.
+ -- Richard Hamming
+
+It has been said that physicists stand on one another's shoulders. If
+this is the case, then programmers stand on one another's toes, and
+software engineers dig each other's graves.
+ -- Unknown
+%
+If I have to lay an egg for my country, I'll do it.
+ -- Bob Hope
+%
+If I knew what brand [of whiskey] he drinks,
+I would send a barrel or so to my other generals.
+ -- Abraham Lincoln, on General Grant
+%
+If I love you, what business is it of yours?
+ -- Johann Wolfgang von Goethe
+%
+If I made peace with Russia today, I'd only attack her again tomorrow. I
+just couldn't help myself.
+ -- Adolf Hitler
+%
+If I promised you the moon and the stars, would you believe it?
+ -- Alan Parsons Project
+%
+If I set here and stare at nothing long enough, people might think
+I'm an engineer working on something.
+ -- S. R. McElroy
+%
+If I told you you had a beautiful body, would you hold it against me?
+%
+If I traveled to the end of the rainbow
+As Dame Fortune did intend,
+Murphy would be there to tell me
+The pot's at the other end.
+ -- Bert Whitney
+%
+If I want your opinion, I'll ask you to fill out the necessary form.
+%
+If I were a grave-digger or even a hangman, there are some people I could
+work for with a great deal of enjoyment.
+ -- Douglas Jerrold
+%
+If I were to walk on water, the press would say I'm only doing it
+because I can't swim.
+ -- Bob Stanfield
+%
+If I'd known computer science was going to be like this,
+I'd never have given up being a rock 'n' roll star.
+ -- G. Hirst
+%
+If ignorance is bliss, why aren't there more happy people?
+%
+If I'm over the hill, why is it I don't recall ever being on top?
+ -- Jerry Muscha
+%
+If in any problem you find yourself doing an immense amount of work, the
+answer can be obtained by simple inspection.
+%
+If in doubt, mumble.
+%
+If it ain't baroque, don't fix it.
+%
+If it ain't broke, don't fix it.
+%
+If it doesn't smell yet, it's pretty fresh.
+ -- Dave Johnson, on dead seagulls
+%
+If it happens once, it's a bug.
+If it happens twice, it's a feature.
+If it happens more than twice, it's a design philosophy.
+%
+If it has syntax, it isn't user-friendly.
+%
+If it heals good, say it.
+%
+If it is a Miracle, any sort of evidence will
+answer, but if it is a Fact, proof is necessary.
+ -- Samuel Clemens
+%
+If it pours before seven, it has rained by eleven.
+%
+If it smells it's chemistry, if it crawls it's biology, if it doesn't work
+it's physics.
+%
+If it takes a bloodbath, lets get it over with. No more appeasement.
+ -- Ronald Reagan
+%
+If it wasn't for Newton, we wouldn't have to eat bruised apples.
+%
+If it wasn't for the last minute, nothing would get done.
+%
+If it wasn't so warm out today, it would be cooler.
+%
+If it were not for the presents, an elopement would be preferable.
+ -- George Ade, "Forty Modern Fables"
+%
+If it were thought that anything I wrote was influenced by Robert Frost,
+I would take that particular work of mine, shred it, and flush it down
+the toilet, hoping not to clog the pipes. A more sententious, holding-
+forth old bore who expected every hero-worshiping adenoidal little twerp
+of a student-poet to hang on to his every word I never saw.
+ -- James Dickey
+%
+If it weren't for the last minute, nothing would ever get done.
+%
+If it's Tuesday, this must be someone else's fortune.
+%
+If it's worth doing, do it for money.
+%
+If it's worth doing, it's worth doing for money.
+%
+If it's worth hacking on well, it's worth hacking on for money.
+%
+If Jesus Christ were to come today, people would not even crucify him.
+They would ask him to dinner, and hear what he had to say, and make
+fun of it.
+ -- Thomas Carlyle
+%
+If just one piece of mail gets lost, well, they'll just think they forgot to
+send it. But if *two* pieces of mail get lost, hell, they'll just think the
+other guy hasn't gotten around to answering his mail. And if *fifty* pieces
+of mail get lost, can you imagine it, if *fifty* pieces of mail get lost, why
+they'll think something *else* is broken! And if 1Gb of mail gets lost,
+they'll just *know* that uunet is down and think it's a conspiracy to keep
+them from their God given right to receive Net Mail ...
+ -- Leith (Casey) Leedom, apologies to Arlo Guthrie
+%
+If Karl, instead of writing a lot about Capital,
+had made a lot of Capital, it would have been much better.
+ -- Karl Marx's Mother
+%
+If life gives you lemons, make lemonade.
+%
+If life is a stage, I want some better lighting.
+%
+If life is merely a joke, the question
+still remains: for whose amusement?
+%
+If life isn't what you wanted, have you asked for anything else?
+%
+If little else, the brain is an educational toy.
+ -- Tom Robbins
+%
+If little green men land in your back yard, hide any little green women
+you've got in the house.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+If love is the answer, could you rephrase the question?
+ -- Lily Tomlin
+%
+If Love Were Oil, I'd Be About A Quart Low
+ -- Book title by Lewis Grizzard
+%
+If Machiavelli were a hacker, he'd have worked for the CSSG.
+ -- Phil Lapsley
+%
+If Machiavelli were a programmer, he'd have worked for AT&T.
+%
+If man is only a little lower than the angels, the angels should reform.
+ -- Mary Wilson Little
+%
+If mathematically you end up with the wrong
+answer, try multiplying by the page number.
+%
+If men acted after marriage as they do during courtship, there would
+be fewer divorces -- and more bankruptcies.
+ -- Frances Rodman
+%
+If men are not afraid to die,
+it is of no avail to threaten them with death.
+
+If men live in constant fear of dying,
+And if breaking the law means a man will be killed,
+Who will dare to break the law?
+
+There is always an official executioner.
+If you try to take his place,
+It is like trying to be a master carpenter and cutting wood.
+If you try to cut wood like a master carpenter,
+ you will only hurt your hand.
+ -- Tao Te Ching, "Lao Tsu, #74"
+%
+If money can't buy happiness, I guess you'll just have to rent it.
+%
+If more of us valued food and cheer and song above hoarded gold, it would
+be a merrier world.
+ -- J. R. R. Tolkien
+%
+If once a man indulges himself in murder, very soon he comes to think little
+of robbing; and from robbing he next comes to drinking and Sabbath-breaking,
+and from that to incivility and procrastination.
+ -- Thomas De Quincey (1785-1859)
+%
+If one cannot enjoy reading a book over and
+over again, there is no use in reading it at all.
+ -- Oscar Wilde
+%
+If one inquires why the American tradition is so strong against any connection
+of State and Church, why it dreads even the rudiments of religious teaching
+in state-maintained schools, the immediate and superficial answer is not
+far to seek. ... The cause lay largely in the diversity and vitality of the
+various denominations, each fairly sure that, with a fair field and no favor,
+it could make its own way; and each animated by a jealous fear that, if any
+connection of State and Church were permitted, some rival denomination would
+get an unfair advantage.
+ -- John Dewey, "Democracy in the Schools", 1908
+%
+If one studies too zealously, one easily loses his pants.
+ -- Albert Einstein
+%
+If one tells the truth, one is sure, sooner or later, to be found out.
+ -- Oscar Wilde,
+ "Phrases and Philosophies for the Use of the Young"
+%
+If only Dionysus were alive! Where would he eat?
+ -- Woody Allen
+%
+If only God would give me some clear sign!
+Like making a large deposit in my name at a Swiss bank.
+ -- Woody Allen, "Without Feathers"
+%
+If only I could be respected without having to be respectable.
+%
+If only you had a personality instead of an attitude.
+%
+If only you knew she loved you, you could
+face the uncertainty of whether you love her.
+%
+If opportunity came disguised as temptation, one knock would be enough.
+%
+If parents would only realize how they bore their children.
+ -- George Bernard Shaw
+%
+If Patrick Henry thought that taxation without representation was bad,
+he should see how bad it is with representation.
+%
+If people are good only because they fear punishment, and hope for reward,
+then we are a sorry lot indeed.
+ -- Albert Einstein
+%
+If people concentrated on the really important things in life,
+there'd be a shortage of fishing poles.
+ -- Doug Larson
+%
+If people drank ink instead of Schlitz, they'd be better off.
+ -- Edward E. Hippensteel
+
+[What brand of ink? Ed.]
+%
+If people have to choose between freedom and sandwiches, they
+will take sandwiches.
+ -- Lord Boyd-orr
+
+Eats first, morals after.
+ -- Bertolt Brecht, "The Threepenny Opera"
+%
+If people say that here and there someone has been taken away and maltreated,
+I can only reply: You can't make an omelette without breaking eggs.
+ -- Hermann Goering
+%
+If people see that you mean them no harm,
+they'll never hurt you, nine times out of ten!
+%
+If practice makes perfect, and nobody's perfect, why practice?
+%
+If preceded by a '-', the timezone shall be east of the Prime
+Meridian; otherwise, it shall be west (which may be indicated by
+an optional preceding '+').
+ -- POSIX 2001
+
+The "+" or "-" indicates whether the time-of-day is ahead of
+(i.e., east of) or behind (i.e., west of) Universal Time.
+ -- RFC 2822
+%
+If pregnancy were a book they would cut the last two chapters.
+ -- Nora Ephron, "Heartburn"
+%
+If pro is the opposite of con, what is the opposite of progress?
+%
+If puns were deli meat, this would be the wurst.
+%
+If rabbits feet are so lucky, what happened to the rabbit?
+%
+If reporters don't know that truth is plural, they ought to be lawyers.
+ -- Tom Wicker
+%
+If researchers wrote nursery rhymes...
+
+Little Miss Muffet sat on her gluteal region,
+Eating components of soured milk.
+On at least one occasion,
+ along came an arachnid and sat down beside her,
+Or at least in her vicinity,
+And caused her to feel an overwhelming, but not paralyzing, fear,
+Which motivated the patient to leave the area rather quickly.
+ -- Ann Melugin Williams
+%
+If Ricky Schroder and Gary Coleman had a fight on television with
+pool cues, who would win?
+ 1) Ricky Schroder
+ 2) Gary Coleman
+ 3) The television viewing public
+ -- David Letterman
+%
+If sarcasm were posted on Usenet, would anybody notice?
+ -- James Nicoll
+%
+If scientific reasoning were limited to the logical processes of
+arithmetic, we should not get very far in our understanding of the physical
+world. One might as well attempt to grasp the game of poker entirely by
+the use of the mathematics of probability.
+ -- Vannevar Bush
+%
+If sex is such a natural phenomenon, how come there are so many
+books on how to?
+ -- Bette Midler
+%
+If she had not been cupric in her ions,
+Her shape ovoidal,
+Their romance might have flourished.
+But he built tetrahedral in his shape,
+His ions ferric,
+Love could not help but die,
+Uncatalyzed, inert, and undernourished.
+%
+If society fits you comfortably enough, you call it freedom.
+ -- Robert Frost
+%
+If some people didn't tell you,
+you'd never know they'd been away on vacation.
+%
+If someone had told me I would be Pope
+one day, I would have studied harder.
+ -- Pope John Paul I
+%
+If someone says he will do something "without fail", he won't.
+%
+If something has not yet gone wrong then it would
+ultimately have been beneficial for it to go wrong.
+%
+If swimming is so good for your figure, how come whales look the
+way they do?
+%
+If that makes any sense to you, you have a big problem.
+ -- C. Durance, Computer Science 234
+%
+If the aborigine drafted an IQ test, all of Western civilization would
+presumably flunk it.
+ -- Stanley Garn
+%
+If the automobile had followed the same development as the computer, a
+Rolls-Royce would today cost $100, get a million miles per gallon,
+and explode once a year killing everyone inside.
+ -- Robert Cringely, InfoWorld
+%
+If the church put in half the time on covetousness that it does on lust,
+this would be a better world.
+ -- Garrison Keillor, "Lake Wobegon Days"
+%
+If the code and the comments disagree, then both are probably wrong.
+ -- Norm Schryer
+%
+If the colleges were better, if they really had it, you would need to get
+the police at the gates to keep order in the inrushing multitude. See in
+college how we thwart the natural love of learning by leaving the natural
+method of teaching what each wishes to learn, and insisting that you shall
+learn what you have no taste or capacity for. The college, which should
+be a place of delightful labor, is made odious and unhealthy, and the
+young men are tempted to frivolous amusements to rally their jaded spirits.
+I would have the studies elective. Scholarship is to be created not
+by compulsion, but by awakening a pure interest in knowledge. The wise
+instructor accomplishes this by opening to his pupils precisely the
+attractions the study has for himself. The marking is a system for schools,
+not for the college; for boys, not for men; and it is an ungracious work to
+put on a professor.
+ -- Ralph Waldo Emerson
+%
+If the designers of X-window built cars, there would be no fewer than five
+steering wheels hidden about the cockpit, none of which followed the same
+principles -- but you'd be able to shift gears with your car stereo. Useful
+feature, that.
+ -- From the programming notebooks of a heretic, 1990
+%
+If the ends don't justify the means, then what does?
+ -- Robert Moses
+%
+If the English language made any sense, lackadaisical
+would have something to do with a shortage of flowers.
+ -- Doug Larson
+
+[Not to mention, butterfly would be flutterby. Ed.]
+%
+If the facts don't fit the theory, change the facts.
+ -- Albert Einstein
+%
+If the future isn't what it used to be, does that
+mean that the past is subject to change in times to come?
+%
+If the girl you love moves in with another guy once, it's more than enough.
+Twice, it's much too much. Three times, it's the story of your life.
+%
+If the government doesn't trust the people, why
+doesn't it dissolve them and elect a new people?
+%
+If the grass is greener on other side of fence,
+consider what may be fertilizing it.
+%
+If the human brain were so simple that we could understand it,
+we would be so simple we couldn't.
+%
+If the King's English was good enough for Jesus, it's good enough for
+me!
+ -- "Ma" Ferguson, Governor of Texas (circa 1920)
+%
+If the Lord God Almighty had consulted me before embarking upon the Creation,
+I would have recommended something simpler.
+ -- Alfonso the Wise, 13th Century King of Castile,
+ Commenting on the Almagest, by Ptolemy.
+%
+If the master dies and the disciple grieves,
+the lives of both have been wasted.
+%
+If the meanings of "true" and "false" were switched,
+then this sentence would not be false.
+%
+If the Nazi's had television with satellite technology, we'd all be
+goose-stepping. Americans are just as suggestible.
+ -- Frank Zappa
+%
+If the odds are a million to one against something
+occurring, chances are 50-50 it will.
+%
+If the path be beautiful, let us not ask where it leads.
+ -- Anatole France
+%
+If the rich could pay the poor to die for them,
+what a living the poor could make!
+%
+If the shoe fits, it's ugly.
+%
+If the standard says that [things] depend on the phase of the moon,
+the programmer should be prepared to look out the window as necessary.
+ -- Chris Torek
+%
+If the thunder don't get you, then the lightning will.
+%
+If the vendors started doing everything right, we would be out of a job.
+Let's hear it for OSI and X! With those babies in the wings, we can count
+on being employed until we drop, or get smart and switch to gardening,
+paper folding, or something.
+ -- C. Philip Wood
+%
+If the very old will remember, the very young will listen.
+ -- Chief Dan George
+%
+If the weather is extremely bad, church attendance will be down.
+If the weather is extremely good, church attendance will be down.
+If the bulletin covers are in short supply, however,
+church attendance will exceed all expectations.
+ -- Reverend Chichester
+%
+If there are epigrams, there must be meta-epigrams.
+%
+If there is a possibility of several things going wrong, the one that
+will cause the most damage will be the one to go wrong.
+%
+If there is a sin against life, it consists perhaps not so much in despairing
+of life as in hoping for another life and in eluding the implacable grandeur
+of this life.
+ -- Albert Camus
+%
+If there is a wrong way to do something, then someone will do it.
+ -- Edward A. Murphy, Jr.
+%
+If there is any realistic deterrent to marriage, it's the fact that you
+can't afford divorce.
+ -- Jack Nicholson
+%
+If there is no God, who pops up the next Kleenex?
+ -- Art Hoppe
+%
+If there is no wind, row.
+ -- Polish proverb
+%
+If there really was a Jewish conspiracy to run the world, my rabbi would
+have let me in on it by now. I contribute enough to the shule.
+ -- Saul Goodman
+%
+If there was any justice in the world, "trust" would be a four-letter word.
+%
+If there were a school for, say, sheet metal workers, that after three
+years left its graduates as unprepared for their careers as does law
+school, it would be closed down in a minute, and no doubt by lawyers.
+ -- Michael Levin, "The Socratic Method
+%
+If they can make penicillin out of moldy bread, they can sure make
+something out of you.
+ -- Muhammad Ali
+%
+If they sent one man to the moon, why can't they send them all?
+%
+If they think you're crude, go technical; if they think you're technical,
+go crude. I'm a very technical boy. So I get as crude as possible. These
+days, though, you have to be pretty technical before you can even aspire
+to crudeness...
+ -- Johnny Mnemonic
+%
+If they were so inclined, they could impeach
+him because they don't like his necktie.
+ -- Attorney General William Saxbe
+%
+If things don't improve soon, you'd better ask them to stop helping you.
+%
+If this fortune didn't exist, somebody would have invented it.
+%
+If this is timesharing, give me my share right now.
+It's not time yet.
+%
+If time heals all wounds, how come the belly button stays the same?
+%
+If today is the first day of the rest of your life, what the hell was
+yesterday?
+%
+If truth is beauty, how come no one has their hair done in the library?
+ -- Lily Tomlin
+%
+If two men agree on everything, you may be sure that one of them is
+doing the thinking.
+ -- Lyndon B. Johnson
+
+Jerry Ford is a nice guy, but he played too much football with his
+helmet off.
+ -- Lyndon B. Johnson
+
+I do not believe that this generation of Americans is willing to resign
+itself to going to bed each night by the light of a Communist moon.
+ -- Lyndon B. Johnson
+%
+If two people love each other, there can be no happy end to it.
+ -- Ernest Hemingway
+%
+If value corrupts then absolute value corrupts absolutely.
+%
+If voting could change the system, it would be illegal.
+If not voting could change the system, it would be illegal.
+%
+If we all work together, we can totally disrupt the system.
+%
+If we can ever make red tape nutritional, we can feed the world.
+ -- R. Schaeberle, "Management Accounting"
+%
+If we could sell our experiences for what they cost us, we would
+all be millionaires.
+ -- Abigail Van Buren
+%
+If we do not change our direction we are
+likely to end up where we are headed.
+%
+If we don't survive, we don't do anything else.
+ -- John Sinclair
+%
+If we men married the women we deserved, we should have a very bad time
+of it.
+ -- Oscar Wilde
+%
+If we relied conclusively on scientific data for every one of our
+findings, I'm afraid all of our work would be inconclusive.
+ -- Henry Hudson, of the Meese Pornography Commission, on
+ criticism of its conclusion that pornography causes sex
+ crimes.
+%
+If we see the light at the end of the tunnel
+It's the light of an oncoming train.
+ -- Robert Lowell
+%
+If we spoke a different language, we
+would perceive a somewhat different world.
+ -- Wittgenstein
+%
+If we suffer tamely a lawless attack upon our liberty,
+we encourage it, and involve others in our doom.
+ -- Samuel Adams
+%
+If we were meant to fly, we wouldn't keep losing our luggage.
+%
+If we were meant to get up early, God would have created us
+with alarm clocks.
+%
+If we won't stand together, we don't stand a chance.
+%
+If what they've been doing hasn't solved the problem, tell them to
+do something else.
+ -- Gerald Weinberg, "The Secrets of Consulting"
+%
+If while you are in school, there is a shortage of qualified personnel
+in a particular field, then by the time you graduate with the necessary
+qualifications, that field's employment market is glutted.
+ -- Marguerite Emmons
+%
+If wishes were horses, then beggars would be thieves.
+%
+If women are supposed to be less rational and more emotional at the
+beginning of our menstrual cycle, when the female hormone is at its
+lowest level, then why isn't it logical to say that in those few days
+women behave the most like the way men behave all month long?
+ -- Gloria Steinem
+%
+If women didn't exist, all the money in the world would have no meaning.
+ -- Aristotle Onassis
+%
+If you already know what recursion is, just remember the answer.
+Otherwise, find someone who is standing closer to Douglas Hofstadter
+than you are; then ask him or her what recursion is.
+ -- Andrew Plotkin
+%
+If you always postpone pleasure you will never have it.
+Quit work and play for once!
+%
+If you analyse anything, you destroy it.
+ -- Arthur Miller
+%
+If you are a fatalist, what can you do about it?
+ -- Ann Edwards-Duff
+%
+If you are a police dog, where's your badge?
+ -- Question James Thurber used to drive his German Shepherd
+ crazy.
+%
+If you are afraid of loneliness, don't marry.
+ -- Anton Chekov
+%
+If you are going to walk on thin ice, you may as well dance.
+%
+If you are good, you will be assigned all the work. If you are real
+good, you will get out of it.
+%
+If you are honest because honesty is the best policy,
+your honesty is corrupt.
+%
+If you are looking for a kindly, well-to-do older gentleman who is no
+longer interested in sex, take out an ad in The Wall Street Journal.
+ -- Abigail Van Buren
+%
+If you are not for yourself, who will be for you?
+If you are for yourself, then what are you?
+If not now, when?
+%
+If you are of the opinion that the contemplation of suicide is sufficient
+evidence of a poetic nature, do not forget that actions speak louder than
+words.
+ -- Fran Lebowitz, "Metropolitan Life"
+%
+If you are over 80 years old and accompanied
+by your parents, we will cash your check.
+%
+If you are shooting under 80 you are neglecting your business;
+over 80 you are neglecting your golf.
+ -- Walter Hagen
+%
+If you are smart enough to know that you're not
+smart enough to be an Engineer, then you're in Business.
+%
+If you are too busy to read, then you are too busy.
+%
+If you are what you eat, does that mean Euelle Gibbons really was a nut?
+%
+If you aren't rich you should always look useful.
+ -- Louis-Ferdinand Celine
+%
+If you can count your money, you don't have a billion dollars.
+ -- J. Paul Getty
+%
+If you can lead it to water and force it to drink, it isn't a horse.
+%
+If you can not say it, you can not whistle it, either.
+ -- Wittgenstein
+%
+If you can read this, you're too close.
+%
+If you can survive death, you can probably survive anything.
+%
+If you cannot convince them, confuse them.
+ -- Harry S. Truman
+%
+If you cannot in the long run tell everyone
+what you have been doing, your doing was worthless.
+ -- Edwin Schrodinger
+%
+If you can't be good, be careful.
+If you can't be careful, give me a call.
+%
+If you can't get your work done in the first 24 hours, work nights.
+%
+If you can't learn to do it well, learn to enjoy doing it badly.
+%
+If you can't read this, blame a teacher.
+%
+If you can't say anything good about someone, sit right here by me.
+ -- Alice Roosevelt Longworth
+%
+If you can't understand it, it is intuitively obvious.
+%
+If you catch a man, throw him back.
+ -- Woman's Liberation Slogan, c. 1975
+%
+If you continually give you will continually have.
+%
+If you could only get that wonderful feeling of
+accomplishment without having to accomplish anything.
+%
+If you didn't get caught, did you really do it?
+%
+If you didn't have most of your friends,
+you wouldn't have most of your problems.
+%
+If you didn't have to work so hard,
+you'd have more time to be depressed.
+%
+If you do not think about the future, you cannot have one.
+ -- John Galsworthy
+%
+If you do not wish a man to do a thing, you had better get him to talk about
+it; for the more men talk, the more likely they are to do nothing else.
+ -- Carlyle
+%
+If you do something right once, someone will ask you to do it again.
+%
+If you don't care where you are, then you ain't lost.
+%
+If you don't count some of Jehovah's injunctions, there are no humorists
+in the Bible.
+ -- Mordecai Richler
+%
+If you don't do it, you'll never know what
+would have happened if you had done it.
+%
+If you don't do the things that are not worth doing, who will?
+%
+If you don't drink it, someone else will.
+%
+If you don't go to other men's funerals they won't go to yours.
+ -- Clarence Day
+%
+If you don't have a nasty obituary you probably didn't matter.
+ -- Freeman Dyson
+%
+If you don't have the time right now,
+will you have redo right time later?
+%
+If you don't have time to do it right, where
+are you going to find the time to do it over?
+%
+If you don't know what game you're playing, don't ask what the score is.
+%
+If you don't like the way I drive, stay off the sidewalk!
+%
+If you don't say anything, you won't be called on to repeat it.
+ -- Calvin Coolidge
+%
+If you don't strike oil in twenty minutes, stop boring.
+ -- Andrew Carnegie, on public speaking
+%
+If you don't want your dog to have bad breath, do what I do: Pour a little
+Lavoris in the toilet.
+ -- Jay Leno
+%
+If you drink, don't park. Accidents make people.
+%
+If you eat a live frog in the morning, nothing worse will happen to
+either of you for the rest of the day.
+%
+If you ever want to get anywhere in politics, my boy, you're going to
+have to get a toehold in the public eye.
+%
+If you ever want to have a lot of fun, I recommend that you go off and program
+an embedded system. The salient characteristic of an embedded system is that
+it cannot be allowed to get into a state from which only direct intervention
+will suffice to remove it. An embedded system can't permanently trust anything
+it hears from the outside world. It must sniff around, adapt, consider, sniff
+around, and adapt again. I'm not talking about ordinary modular programming
+carefulness here. No. Programming an embedded system calls for undiluted
+raging maniacal paranoia. For example, our ethernet front ends need to know
+what network number they are on so that they can address and route PUPs
+properly. How do you find out what your network number is? Easy, you ask a
+gateway. Gateways are required by definition to know their correct network
+numbers. Once you've got your network number, you start using it and before
+you can blink you've got it wired into fifteen different sockets spread all
+over creation. Now what happens when the panic-stricken operator realizes he
+was running the wrong version of the gateway which was giving out the wrong
+network number? Never supposed to happen. Tough. Supposing that your
+software discovers that the gateway is now giving out a different network
+number than before, what's it supposed to do about it? This is not discussed
+in the protocol document. Never supposed to happen. Tough. I think you
+get my drift.
+%
+If you explain so clearly that nobody can misunderstand, somebody
+will.
+%
+If you explain something so clearly that no
+one can possibly misunderstand, someone will.
+%
+If you fail to plan, plan to fail.
+%
+If you find a solution and become attached to it,
+the solution may become your next problem.
+%
+If you flaunt it, expect to have it trashed.
+%
+If you float on instinct alone, how can you
+calculate the buoyancy for the computed load?
+ -- Christopher Hodder-Williams
+%
+If you fool around with something long
+enough, it will eventually break.
+%
+If you give a man enough rope, he'll claim he's tied up at the office.
+%
+If you give Congress a chance to vote on
+both sides of an issue, it will always do it.
+ -- Les Aspin, D, Wisconsin
+%
+If you go on with this nuclear arms race,
+all you are going to do is make the rubble bounce.
+ -- Winston Churchill
+%
+If you go out of your mind, do it quietly,
+so as not to disturb those around you.
+%
+If you go parachuting, and your parachute doesn't open, and your friends are
+all watching you fall, I think a funny gag would be to pretend you were
+swimming.
+ -- Jack Handey
+%
+If you had any brains, you'd be dangerous.
+%
+If you had better tools, you could more
+effectively demonstrate your total incompetence.
+%
+If you had just one moment to live
+And they granted you one special wish
+Would you ask for something
+Like another chance.
+ -- Traffic, "The Low Spark of Hi Heeled Boys"
+%
+If you hands are clean and your cause is just
+and your demands are reasonable, at least it's a start.
+%
+If you have a procedure with 10 parameters, you probably missed some.
+%
+If you have never been hated by your child, you have never been a parent.
+ -- Bette Davis
+%
+If you have nothing to do, don't do it here.
+%
+If you have received a letter inviting you to speak at the dedication of a
+new cat hospital, and you hate cats, your reply, declining the invitation,
+does not necessarily have to cover the full range of your emotions. You must
+make it clear that you will not attend, but you do not have to let fly at cats.
+The writer of the letter asked a civil question; attack cats, then, only if
+you can do so with good humor, good taste, and in such a way that your answer
+will be courteous as well as responsive. Since you are out of sympathy with
+cats, you may quite properly give this as a reason for not appearing at the
+dedication ceremonies of a cat hospital. But bear in mind that your opinion
+of cats was not sought, only your services as a speaker. Try to keep things
+straight.
+ -- Strunk and White, "The Elements of Style"
+%
+If you have seen one city slum you have seen them all.
+ -- Spiro Agnew
+%
+If you have to ask how much it is, you can't afford it.
+%
+If you have to ask what jazz is, you'll never know.
+ -- Louis Armstrong
+%
+If you have to hate, hate gently.
+%
+If you have to think twice about it, you're wrong.
+%
+If you haven't enjoyed the material in the last few lectures then a career
+in chartered accountancy beckons.
+ -- Advice from the lecturer in the middle of the Stochastic
+ Systems course.
+%
+If you hype something and it succeeds, you're a genius -- it wasn't a
+hype. If you hype it and it fails, then it was just a hype.
+ -- Neil Bogart
+%
+If you just try long enough and hard enough, you can always manage to boot
+yourself in the posterior.
+ -- A. J. Liebling, "The Press"
+%
+If you keep anything long enough, you can throw it away.
+%
+If you keep your mind sufficiently open, people will throw a lot of
+rubbish into it.
+ -- William Orton
+%
+If you knew what to say next, would you say it?
+%
+If you know the answer to a question, don't ask.
+ -- Petersen Nesbit
+%
+If you laid all of our laws end to end, there would be no end.
+ -- Mark Twain
+%
+If you laid all the Elvis impersonators in the world, end to end...
+you'd wanna run and get a steam roller, real fast.
+ -- David Letterman
+%
+If you learn one useless thing every day, in a single year you'll learn
+365 useless things.
+%
+If you lend someone $20 and never see that person again, it was
+probably worth it.
+%
+If you liked the Earth you'll love Heaven.
+%
+If you live in a country run by committee, be on the committee.
+ -- Graham Summer
+%
+If you live long enough, you'll see that every victory turns into a defeat.
+ -- Simone De Beauvoir
+%
+If you live to the age of a hundred you have it made
+because very few people die past the age of a hundred.
+ -- George Burns
+%
+If you lived today as if it were your last, you'd buy up a box of rockets
+and fire them all off, wouldn't you?
+ -- Garrison Keillor
+%
+If you look good and dress well, you don't need a purpose in life.
+ -- Robert Pante, fashion consultant
+%
+If you look like your driver's license photo -- see a doctor.
+If you look like your passport photo -- it's too late for a doctor.
+%
+If you lose a son you can always get another,
+but there's only one Maltese Falcon.
+ -- Sidney Greenstreet, "The Maltese Falcon"
+%
+If you lose your temper at a newspaper columnist,
+he'll get rich or famous or both.
+%
+If you love someone, set them free.
+If they don't come back, then call them up when you're drunk.
+%
+If you love something set it free. If it doesn't
+come back to you, hunt it down and kill it.
+%
+If you make a mistake you right it
+immediately to the best of your ability.
+%
+If you make any money, the government shoves you in the creek once a year
+with it in your pockets, and all that don't get wet you can keep.
+ -- The Best of Will Rogers
+%
+If you make people think they're thinking, they'll love you;
+but if you really make them think they'll hate you.
+%
+If you marry a man who cheats on his wife, you'll
+be married to a man who cheats on his wife.
+ -- Ann Landers
+%
+If you mess with a thing long enough, it'll break.
+ -- Schmidt
+%
+If you MUST get married, it is always advisable to marry beauty.
+Otherwise, you'll never find anybody to take her off your hands.
+%
+If you need anything just whistle.
+You know how to whistle, don't you, Steve?
+Just put your lips together and blow.
+ -- Lauren Bacall, "To Have and Have Not"
+%
+If you notice that a person is deceiving you,
+they must not be deceiving you very well.
+%
+If you only have a hammer, you tend to see every problem as a nail.
+ -- Maslow
+%
+If you perceive that there are four possible ways in which a procedure
+can go wrong, and circumvent these, then a fifth way will promptly
+develop.
+%
+If you pick up a starving dog and make him prosperous, he will not bite
+you. This is the principal difference between a dog and a man.
+ -- Mark Twain
+%
+If you push the "extra ice" button on the soft drink vending machine,
+you won't get any ice. If you push the "no ice" button, you'll get
+ice, but no cup.
+%
+If you put garbage in a computer nothing comes out but garbage. But
+this garbage, having passed through a very expensive machine, is
+somehow ennobled and none dare criticize it.
+%
+If you put it off long enough, it might go away.
+%
+If you put tomfoolery into a computer, nothing comes out but tomfoolery.
+But this tomfoolery, having passed through a very expensive machine,
+is somehow ennobled and no-one dare criticise it.
+ -- Pierre Gallois
+%
+If you put your supper dish to your ear you can hear the sounds of a
+restaurant.
+ -- Snoopy
+%
+If you really want to do something new, the good won't help you with it.
+Let me have men about me that are arrant knaves. The wicked, who have
+something on their conscience, are obliging, quick to hear threats, because
+they know how it's done, and for booty. You can offer them things because
+they will take them. Because they have no hesitations. You can hang them
+if they get out of step. Let me have men about me that are utter villains
+-- provided that I have the power, the absolute power, over life and death.
+ -- Hermann Goering
+%
+If you refuse to accept anything but the best you very often get it.
+%
+If you remember the 60's, you weren't there.
+%
+If you resist reading what you disagree with, how will you ever acquire
+deeper insights into what you believe? The things most worth reading
+are precisely those that challenge our convictions.
+%
+If you see an onion ring -- answer it!
+%
+If you sell diamonds, you cannot expect to have many customers.
+But a diamond is a diamond even if there are no customers.
+ -- Swami Prabhupada
+%
+If you sit down at a poker game and don't see a sucker, get up. You're
+the sucker.
+%
+If you sow your wild oats, hope for a crop failure.
+%
+If you stand on your head, you will get footprints in your hair.
+%
+If you steal from one author it's plagiarism; if you steal from
+many it's research.
+ -- Wilson Mizner
+%
+If you stew apples like cranberries,
+they taste more like prunes than rhubarb does.
+ -- Groucho Marx
+%
+If you stick a stock of liquor in your locker,
+It is slick to stick a lock upon your stock.
+ Or some joker who is slicker,
+ Will trick you of your liquor,
+If you fail to lock your liquor with a lock.
+%
+If you stick your head in the sand,
+one thing is for sure, you're gonna get your rear kicked.
+%
+If you suspect a man, don't employ him.
+%
+If you talk to God, you are praying; if God talks to you, you have
+schizophrenia.
+ -- Thomas Szasz
+%
+If you teach your children to like computers and to know how to gamble
+then they'll always be interested in something and won't come to no real
+harm.
+%
+If you tell the truth you don't have to remember anything.
+ -- Mark Twain
+%
+If you think before you speak the other guy gets his joke in first.
+%
+If you think education is expensive, try ignorance.
+ -- Derek Bok, president of Harvard
+%
+If you think last Tuesday was a drag,
+wait till you see what happens tomorrow!
+%
+If you think nobody cares if you're alive,
+try missing a couple of car payments.
+ -- Earl Wilson
+%
+If you think technology can solve your security problems, then you
+don't understand the problems and you don't understand the technology.
+ -- Bruce Schneier
+%
+If you think the pen is mightier than the sword, the next time
+someone pulls out a sword I'd like to see you get up there with
+your Bic.
+%
+If you think the problem is bad now, just wait until we've solved it.
+ -- Arthur Kasspe
+%
+If you think the system is working,
+ask someone who's waiting for a prompt.
+%
+If you think the United States has stood still, who built the largest
+shopping center in the world?
+ -- Richard M. Nixon
+%
+If you think things can't get worse it's probably only because you
+lack sufficient imagination.
+%
+If you throw a New Year's Party, the worst thing that you can do would be
+to throw the kind of party where your guests wake up today, and call you to
+say they had a nice time. Now you'll be expected to throw another party
+next year.
+ What you should do is throw the kind of party where your guest wake
+ up several days from now and call their lawyers to find out if
+they've been indicted for anything. You want your guests to be so anxious
+to avoid a recurrence of your party that they immediately start planning
+parties of their own, a year in advance, just to prevent you from having
+another one ...
+ If your party is successful, the police will knock on your door,
+unless your party is very successful in which case they will lob tear gas
+through your living room window. As host, your job is to make sure that
+they don't arrest anybody. Or if they're dead set on arresting someone,
+your job is to make sure it isn't you ...
+ -- Dave Barry
+%
+If you took all of the grains of sand in the world, and lined
+them up end to end in a row, you'd be working for the government!
+ -- Mr. Interesting
+%
+If you took all the students that felt asleep in class and laid them
+end to end, they'd be a lot more comfortable.
+ -- "Graffiti in the Big Ten"
+%
+If you treat people right they will treat you right -- 90% of the time.
+ -- Franklin D. Roosevelt
+%
+If you try to please everyone, somebody is not going to like it.
+%
+If you understand what you're doing, you're not learning anything.
+ -- Abraham Lincoln
+%
+If you wait long enough, it will go away... after having
+done its damage. If it was bad, it will be back.
+%
+If you want divine justice, die.
+ -- Nick Seldon
+%
+If you want me to be a good little bunny
+just dangle some carats in front of my nose.
+ -- Lauren Bacall
+%
+If you want to be ruined, marry a rich woman.
+ -- Michelet
+%
+If you want to get rich from writing, write the sort of thing that's
+read by persons who move their lips when they're reading to themselves.
+ -- Don Marquis
+%
+If you want to know how old a man is, ask his brother-in-law.
+%
+If you want to know what god thinks of money, just look at the people
+he gave it to.
+ -- Dorothy Parker
+%
+If you want to make God laugh, tell him about your plans.
+ -- Woody Allen
+%
+If you want to put yourself on the map, publish your own map.
+%
+If you want to read about love and marriage you've got to buy two separate
+books.
+ -- Alan King
+%
+If you want to see card tricks, you have to expect to take cards.
+ -- Harry Blackstone
+%
+If you want to understand your government, don't begin by reading the
+Constitution. It conveys precious little of the flavor of today's statecraft.
+Instead, read selected portions of the Washington telephone directory
+containing listings for all the organizations with titles beginning with
+the word "National".
+ -- George Will
+%
+If you want your spouse to listen and pay strict attention to every word
+you say, talk in your sleep.
+%
+If you wants to get elected president, you'se got to think up some
+memoraboble homily so's school kids can be pestered into memorizin' it,
+even if they don't know what it means.
+ -- Walt Kelly, "The Pogo Party"
+%
+If you waste your time cooking, you'll miss the next meal.
+%
+If you will practice being fictional for a while, you will understand that
+fictional characters are sometimes more real than people with bodies and
+heartbeats.
+%
+If you wish to be happy for one hour, get drunk.
+If you wish to be happy for three days, get married.
+If you wish to be happy for a month, kill your pig and eat it.
+If you wish to be happy forever, learn to fish.
+ -- Chinese proverb
+%
+If you wish to live wisely, ignore sayings -- including this one.
+%
+If you wish to succeed, consult three old people.
+%
+If you wish women to love you, be original; I know a man who wore fur
+boots summer and winter, and women fell in love with him.
+ -- Anton Chekov
+%
+If you work for a man, in heaven's name, work for him.
+If he pays you wages which supply you bread and butter, work for him; speak
+ well of him; stand by him, and by the institution he represents.
+If put to a pinch, an ounce of loyalty is worth a pound of cleverness.
+If you must vilify, condemn and eternally find disparage -- resign your
+ position, and when you are outside, damn to your heart's content...
+ but, as long as you are part of the institution do not condemn it.
+If you do that, you are loosening the tendrils that are holding you to the
+ institution, and at the first high wind that comes along, you will
+ be uprooted and blown away, and probably will never know the reason
+ why.
+%
+If you would keep a secret from an enemy, tell it not to a friend.
+%
+If you would know the value of money, go try to borrow some.
+ -- Benjamin Franklin
+%
+If you would understand your own age, read the works
+of fiction produced in it. People in disguise speak freely.
+%
+If you'd like to cultivate insomnia,
+Bed down with a pretty girl.
+Amor vincit omnia.
+%
+If your aim in life is nothing; you can't miss.
+%
+If your bread is stale, make toast.
+%
+If your enemy is buried in quicksand up to his neck, pull him out.
+If he is buried up to his eyes, step on his head.
+ -- Niccolo Machiavelli, "The Prince"
+%
+If your happiness depends on what somebody else does,
+I guess you do have a problem.
+ -- Richard Bach, "Illusions"
+%
+If your life was a horse, you'd have to shoot it.
+%
+If your mind grows weak,
+Don't yield to the weakness.
+Even if tired of thought,
+Never stop thinking.
+My sons and descendants,
+Don't get exhausted in reason--
+But become experienced.
+ -- Chinggis (Genghis) Khan
+%
+If your mother knew what you're doing,
+she'd probably hang her head and cry.
+%
+If your parents don't have kids, neither will you.
+%
+If your sexual fantasies were truly of interest to others, they would no
+longer be fantasies.
+ -- Fran Lebowitz
+%
+If you're a young Mafia gangster out on your first date, I bet it's real
+embarrassing if someone tries to kill you.
+ -- Jack Handey
+%
+If you're careful enough, nothing
+bad or good will ever happen to you.
+%
+If you're carrying a torch, put it down.
+The Olympics are over.
+%
+If you're constantly being mistreated,
+you're cooperating with the treatment.
+%
+If you're crossing the nation in a covered wagon, it's better to have four
+strong oxen than 100 chickens. Chickens are OK but we can't make them work
+together yet.
+ -- Ross Bott, Pyramid U.S., on multiprocessors at AUUGM '89
+%
+If you're going to America, bring your own food.
+ -- Fran Lebowitz, "Social Studies"
+%
+If you're going to do something tonight
+that you'll be sorry for tomorrow morning, sleep late.
+ -- Henny Youngman
+%
+If you're going to walk on thin ice, you might as well dance.
+%
+If you're happy, you're successful.
+%
+If you're not part of the solution, you're part of the precipitate.
+%
+If you're not very clever you should be conciliatory.
+ -- Benjamin Disraeli
+%
+If you're right 90% of the time, why quibble about the remaining 3%?
+%
+If you're worried by earthquakes and nuclear war,
+As well as by traffic and crime,
+Consider how worry-free gophers are,
+Though living on burrowed time.
+ -- Richard Armour, WSJ, 11/7/83
+%
+If you've done six impossible things before breakfast, why not round it
+off with dinner at Milliway's, the restaurant at the end of the universe.
+ -- Douglas Adams, "The Restaurant at the End of the Universe"
+%
+If you've seen one redwood, you've seen them all.
+ -- Ronald Reagan
+%
+Ignisecond, n.:
+ The overlapping moment of time when the hand is locking the car
+ door even as the brain is saying, "my keys are in there!"
+ -- Rich Hall, "Sniglets"
+%
+Ignorance is bliss.
+ -- Thomas Gray
+
+Fortune updates the great quotes, #42:
+ BLISS is ignorance.
+%
+Ignorance is never out of style. It was in fashion yesterday, it is the
+rage today, and it will set the pace tomorrow.
+ -- Franklin K. Dane
+%
+Ignorance is when you don't know anything and somebody finds it out.
+%
+Ignorance must certainly be bliss or there wouldn't be so many people
+so resolutely pursuing it.
+%
+Ignore previous fortune.
+%
+Il brilgue: les t^oves libricilleux
+ Se gyrent et frillant dans le guave,
+Enm^im'es sont les gougebosquex,
+ Et le m^omerade horgrave.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+Iles's Law:
+ There is always an easier way to do it. When looking directly
+ at the easy way, especially for long periods, you will not see
+ it. Neither will Iles.
+%
+I'll be comfortable on the couch. Famous last words.
+ -- Lenny Bruce
+%
+I'll be Grateful when they're Dead.
+%
+I'll burn my books.
+ -- Christopher Marlowe
+%
+I'll carry your books, I'll carry a tune, I'll carry on, carry over,
+carry forward, Cary Grant, cash & carry, Carry Me Back To Old Virginia,
+I'll even Hara Kari if you show me how, but I will *not* carry a gun.
+ -- Hawkeye, M*A*S*H
+%
+I'll defend to the death your right to say that, but I never said I'd
+listen to it!
+ -- Tom Galloway with apologies to Voltaire
+%
+I'll give you my opinion of the human race in a nutshell ... their heart's
+in the right place, but their head is a thoroughly inefficient organ.
+ -- W. Somerset Maugham, "The Summing Up"
+%
+I'll grant thee random access to my heart,
+Thoul't tell me all the constants of thy love;
+And so we two shall all love's lemmas prove
+And in our bound partition never part.
+ -- Stanislaw Lem, "Cyberiad"
+%
+I'll learn to play the Saxophone,
+I play just what I feel.
+Drink Scotch whisky all night long,
+And die behind the wheel.
+They got a name for the winners in the world,
+I want a name when I lose.
+They call Alabama the Crimson Tide,
+Call me Deacon Blues.
+ -- Becker and Fagan, "Deacon Blues"
+%
+I'll meet you... on the dark side of the moon...
+ -- Pink Floyd
+%
+I'll never get off this planet.
+ -- Luke Skywalker
+%
+I'll pretend to trust you if you'll pretend to trust me.
+%
+I'll rob that rich person and give it to some poor deserving slob.
+That will *prove* I'm Robin Hood.
+ -- Daffy Duck, "Robin Hood Daffy", [1958, Chuck Jones]
+%
+I'll turn over a new leaf.
+ -- Miguel de Cervantes
+%
+Illegal aliens have always been a problem in the United States. Ask
+any Indian.
+ -- Robert Orben
+
+Immigration is the sincerest form of flattery.
+ -- Jack Paar
+%
+Illegitimi non carborundum
+(translation: no carbonated drinks allowed.)
+%
+Illinois isn't exactly the land that God forgot:
+it's more like the land He's trying to ignore.
+%
+Illiterate? Write today, for free help!
+%
+Illusion is the first of all pleasures.
+ -- Voltaire
+%
+I'm a creationist; I refuse to believe
+that I could have evolved from man.
+%
+"I'm a doctor, not a mechanic."
+ -- "The Doomsday Machine", when asked if he had heard of
+ the idea of a doomsday machine.
+"I'm a doctor, not an escalator."
+ -- "Friday's Child", when asked to help the very pregnant
+ Ellen up a steep incline.
+"I'm a doctor, not a bricklayer."
+ -- "Devil in the Dark", when asked to patch up the Horta.
+"I'm a doctor, not an engineer."
+ -- "Mirror, Mirror", when asked by Scotty for help in
+ Engineering aboard the USS Enterprise.
+"I'm a doctor, not a coal miner."
+ -- "The Empath", on being beneath the surface of Minara 2.
+"I'm a surgeon, not a psychiatrist."
+ -- "City on the Edge of Forever", on Edith Keeler's remark
+ that Kirk talked strangely.
+"I'm no magician, Spock, just an old country doctor."
+ -- "The Deadly Years", to Spock while trying to cure the
+ aging effects of the rogue comet near Gamma Hydra 4.
+"What am I, a doctor or a moon shuttle conductor?"
+ -- "The Corbomite Maneuver", when Kirk rushed off from a
+ physical exam to answer the alert.
+%
+I'm a Hollywood writer; so I put on
+a sports jacket and take off my brain.
+%
+I'm a Lisp variable -- bind me!
+%
+I'm a lucky guy, and I'm happy to be with the Yankees. And I want to
+thank everyone for making this night necessary.
+ -- Yogi Berra at a dinner in his honor
+%
+I'm all for computer dating, but I
+wouldn't want one to marry my sister.
+%
+I'm also inclined to believe that if you wait long enough, you will
+eventually have more than 255 of almost *anything*....
+ -- A. Lyman Chapin
+%
+I'm always looking for a new idea that
+will be more productive than its cost.
+ -- David Rockefeller
+%
+I'm an artist.
+But it's not what I really want to do.
+What I really want to do is be a shoe salesman.
+I know what you're going to say --
+"Dreamer! Get your head out of the clouds."
+All right! But it's what I want to do.
+Instead I have to go on painting all day long.
+
+The world should make a place for shoe salesmen.
+ -- J. Feiffer
+%
+I'm an evolutionist; I refuse to believe
+that I could have been created by man.
+%
+I'm changing my name to Chrysler
+I'm going down to Washington, D.C.
+I'll tell some power broker
+ What they did for Iacocca
+Will be perfectly acceptable to me!
+I'm changing my name to Chrysler,
+I'm heading for that great receiving line.
+When they hand a million grand out,
+ I'll be standing with my hand out,
+Yessir, I'll get mine!
+ -- Tom Paxton
+%
+I'm defending her honor, which is more than she ever did.
+%
+"I'm dying," he croaked.
+"My experiment was a success," the chemist retorted.
+"You can't really train a beagle," he dogmatized.
+"That's no beagle, it's a mongrel," she muttered.
+"The fire is going out," he bellowed.
+"Bad marksmanship," the hunter groused.
+"You ought to see a psychiatrist," he reminded me.
+"You snake," she rattled.
+"Someone's at the door," she chimed.
+"Company's coming," she guessed.
+"Dawn came too soon," she mourned.
+"I think I'll end it all," Sue sighed.
+"I ordered chocolate, not vanilla," I screamed.
+"Your embroidery is sloppy," she needled cruelly.
+"Where did you get this meat?" he bridled hoarsely.
+ -- Gyles Brandreth, "The Joy of Lex"
+%
+I'm fed up to the ears with old men dreaming up wars for young men to die in.
+ -- George McGovern
+%
+I'm for bringing back the birch, but only for consenting adults.
+ -- Gore Vidal
+%
+I'm free -- and freedom tastes of reality.
+%
+I'm glad I was not born before tea.
+ -- Sidney Smith (1771-1845)
+%
+I'm glad that I'm an American,
+I'm glad that I am free,
+But I wish I were a little doggy,
+And McGovern were a tree.
+%
+I'm going through my "I want to go back to New York" phase today. Happens
+every six months or so. So, I thought, perhaps unwisely, that I'd share
+it with you.
+
+> In New York in the winter it is million degrees below zero and
+ the wind travels at a million miles an hour down 5th avenue.
+> And in LA it's 72.
+
+> In New York in the summer it is a million degrees and the humidity
+ is a million percent.
+> And in LA it's 72.
+
+> In New York there are a million interesting people.
+> And in LA there are 72.
+%
+I'm going to Boston to see my doctor. He's a very sick man.
+ -- Fred Allen
+%
+I'm going to give my psychoanalyst one more year, then I'm going to Lourdes.
+ -- Woody Allen
+%
+I'm going to live forever, or die trying!
+ -- Spider Robinson
+%
+I'm going to raise an issue and stick it in your ear.
+ -- John Foreman
+%
+I'm going to Vietnam at the request of the White House. President Johnson
+says a war isn't really a war without my jokes.
+ -- Bob Hope
+%
+I'm hungry, time to eat lunch.
+%
+I'm in Pittsburgh. Why am I here?
+ -- Harold Urey, Nobel Laureate
+%
+I'm just as sad as sad can be!
+ I've missed your special date.
+Please say that you're not mad at me
+ My tax return is late.
+ -- Modern Lines for Modern Greeting Cards
+%
+I'm living so far beyond my income that we may almost be said to be
+living apart.
+ -- e. e. cummings
+%
+I'm N-ary the tree, I am,
+N-ary the tree, I am, I am.
+I'm getting traversed by the parser next door,
+She's traversed me seven times before.
+And ev'ry time it was an N-ary (N-ary!)
+Never wouldn't ever do a binary. (No sir!)
+I'm 'er eighth tree that was N-ary.
+N-ary the tree I am, I am,
+N-ary the tree I am.
+ -- Stolen from Paul Revere and the Raiders
+%
+I'm not a lovable man.
+ -- Richard M. Nixon
+%
+I'm not a real movie star -- I've still got the same wife I started out
+with twenty-eight years ago.
+ -- Will Rogers
+%
+I'm not denyin' the women are foolish: God Almighty made 'em to
+match the men.
+ -- George Eliot
+%
+I'm not even going to *bother* comparing C to BASIC or FORTRAN.
+ -- L. Zolman, creator of BDS C
+%
+I'm not laughing with you, I'm laughing at you.
+%
+I'm not offering myself as an example;
+every life evolves by its own laws.
+%
+I'm not prejudiced, I hate everyone equally.
+%
+I'm not proud.
+%
+I'm not stupid, I'm not expendable, and I'M NOT GOING!
+%
+I'm not sure I've even got the brains to be President.
+ -- Barry Goldwater, in 1964
+%
+I'm not tense, just terribly, terribly alert!
+%
+I'm not the person your mother warned you about... her imagination isn't
+that good.
+ -- Amy Gorin
+%
+I'm not under the alkafluence of inkahol
+that some thinkle peep I am.
+It's just the drunker I sit here the longer I get.
+%
+I'm often asked the question, "Do you think there is extraterrestrial intelli-
+gence?" I give the standard arguments -- there are a lot of places out there,
+and use the word *billions*, and so on. And then I say it would be astonishing
+to me if there weren't extraterrestrial intelligence, but of course there is as
+yet no compelling evidence for it. And then I'm asked, "Yeah, but what do you
+really think?" I say, "I just told you what I really think." "Yeah, but
+what's your gut feeling?" But I try not to think with my gut. Really, it's
+okay to reserve judgment until the evidence is in.
+ -- Carl Sagan
+%
+I'm prepared for all emergencies but
+totally unprepared for everyday life.
+%
+I'm proud to be paying taxes in the United States. The only thing is
+-- I could be just as proud for half the money.
+ -- Arthur Godfrey
+%
+I'm really enjoying not talking to you...
+Let's not talk again REAL soon...
+%
+I'm returning this note to you, instead of your paper, because it
+(your paper) presently occupies the bottom of my bird cage.
+ -- English Professor, Providence College
+%
+I'm so broke I can't even pay attention.
+%
+I'm so miserable without you, it's almost like you're here.
+%
+I'm sorry, but after reading this thread, I'm having a hard time
+coming up with an explanation for this nonsense which doesn't involve
+you being a dumbass.
+ -- Bill Paul <wpaul@FreeBSD.org>
+%
+I'm sorry, but my kharma just ran over your dogma.
+%
+I'm sorry I missed.
+ -- Squeaky Fromme
+%
+I'm sorry if the correct way of doing things offends you.
+%
+I'm still waiting for the advent of the computer science groupie.
+%
+I'm successful because I'm lucky.
+The harder I work, the luckier I get.
+%
+I'm very good at integral and differential calculus,
+I know the scientific names of beings animalculous;
+In short, in matters vegetable, animal, and mineral,
+I am the very model of a modern Major-General.
+ -- Gilbert & Sullivan, "The Pirates of Penzance"
+%
+I'm very old-fashioned. I believe that people should marry for life,
+like pigeons and Catholics.
+ -- Woody Allen
+%
+I'm willing to sacrifice anything for this cause, even other people's
+lives.
+%
+Imagination is more important than knowledge.
+ -- Albert Einstein
+%
+Imagination is the one weapon in the war against reality.
+ -- Jules de Gaultier
+%
+Imagine if every Thursday your shoes exploded if you tied them the
+usual way. This happens to us all the time with computers, and nobody
+thinks of complaining.
+ -- Jeff Raskin, interviewed in Doctor Dobb's Journal
+%
+Imagine me going around with a pot belly.
+It would mean political ruin.
+ -- Adolf Hitler
+%
+Imagine that Cray computer decides to make a personal computer. It has
+a 150 MHz processor, 200 megabytes of RAM, 1500 megabytes of disk
+storage, a screen resolution of 4096 x 4096 pixels, relies entirely on
+voice recognition for input, fits in your shirt pocket and costs $300.
+What's the first question that the computer community asks?
+
+"Is it PC compatible?"
+%
+Imagine there's no heaven... it's easy if you try.
+ -- John Lennon, "Imagine"
+%
+Imagine what we can imagine!
+ -- Arthur Rubinstein
+%
+Imbalance of power corrupts and monopoly of power corrupts absolutely.
+ -- Genji
+%
+Imbesi's Law with Freeman's Extension:
+ In order for something to become clean, something else must
+ become dirty; but you can get everything dirty without getting
+ anything clean.
+%
+Imitation is the sincerest form of television.
+ -- Fred Allen
+%
+Immanuel doesn't pun, he Kant.
+%
+Immanuel Kant but Kubla Khan.
+%
+Immature artists imitate, mature artists steal.
+ -- Lionel Trilling
+%
+Immature poets imitate, mature poets steal.
+ -- T. S. Eliot, "Philip Massinger"
+%
+Immortality -- a fate worse than death.
+ -- Edgar A. Shoaff
+%
+Immutability, Three Rules of:
+ (1) If a tarpaulin can flap, it will.
+ (2) If a small boy can get dirty, he will.
+ (3) If a teenager can go out, he will.
+%
+Impartial, adj.:
+ Unable to perceive any promise of personal advantage from
+ espousing either side of a controversy or adopting either of two
+ conflicting opinions.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Important letters which contain no errors will develop errors in the
+mail. Corresponding errors will show up in the duplicate while the
+Boss is reading it.
+%
+Impossible, adj.:
+ (1) I wouldn't like it and when it happens I won't approve;
+ (2) I can't be bothered;
+ (3) God can't be bothered.
+Meaning (3) may perhaps be valid but the others are 101% whaledreck.
+ -- Chad C. Mulligan, "The Hipcrime Vocab"
+%
+In 1869 the waffle iron was invented for people who had wrinkled
+waffles.
+%
+In 1880 the French captured Detroit but gave it back ... they couldn't
+get parts.
+%
+In 1914, the first crossword puzzle was printed in a newspaper. The
+creator received $4000 down ... and $3000 across.
+%
+In 1915 pancake make-up was invented but most people still preferred
+syrup.
+%
+In 1967, the Soviet Government minted a beautiful silver ruble with Lenin
+in a very familiar pose - arms raised above him, leading the country to
+revolution. But, it was clear to everybody, that if you looked at it from
+behind, it was clear that Lenin was pointing to 11:00, when the Vodka
+shops opened, and was actually saying, "Comrades, forward to the Vodka shops.
+
+It became fashionable, when one wanted to have a drink, to take out the
+ruble and say, "Oh my goodness, Comrades, Lenin tells me we should go.
+%
+In 1989, the United States, which was displeased with the policies of the
+dictator of Panama, invaded that country and placed in power a government
+more to its liking.
+
+In 1990, Iraq, which was displeased with the policies of the dictator of
+Kuwait, invaded that country and placed in power a government more to its
+liking.
+%
+In a bottle, the neck is always at the top.
+%
+In a circuit with a fast-acting fuse,
+an IC will blow to protect the fuse.
+%
+In a consumer society there are inevitably two kinds of slaves:
+the prisoners of addiction and the prisoners of envy.
+%
+In a country where the sole employer is the State, opposition means death
+by slow starvation. The old principle: Who does not work shall not eat,
+has been replaced by a new one: Who does not obey shall not eat.
+ -- Leon Trotsky, 1937
+%
+In a display of perverse brilliance, Carl the repairman mistakes a room
+humidifier for a mid-range computer but manages to tie it into the network
+anyway.
+ -- The 5th Wave
+%
+In a five year period we can get one superb programming language.
+Only we can't control when the five year period will begin.
+%
+In a gathering of two or more people, when a lighted cigarette is
+placed in an ashtray, the smoke will waft into the face of the non-smoker.
+%
+In a great romance, each person basically plays a part that the
+other really likes.
+ -- Elizabeth Ashley
+%
+In a hierarchy every employee tends to rise to his level of incompetence ...
+in time every post tends to be occupied by an employee who is incompetent
+to carry out its duties ... Work is accomplished by those employees who
+have not yet reached their level of incompetence.
+ -- Dr. Laurence J. Peter, "The Peter Principle"
+%
+In a medium in which a News Piece takes a minute and an "In-Depth"
+Piece takes two minutes, the Simple will drive out the Complex.
+ -- Frank Mankiewicz
+%
+In a museum in Havana, there are two skulls of Christopher Columbus,
+"one when he was a boy and one when he was a man."
+ -- Mark Twain
+%
+In a surprise raid last night, federal agent's ransacked a house in search
+of a rebel computer hacker. However, they were unable to complete the arrest
+because the warrant was made out in the name of Don Provan, while the only
+person in the house was named don provan. Proving, once again, that Unix is
+superior to Tops10.
+%
+In a whiskey it's age, in a cigarette it's
+taste and in a sports car it's impossible.
+%
+In Africa some of the native tribes have a custom of beating the ground
+with clubs and uttering spine chilling cries. Anthropologists call
+this a form of primitive self-expression. In America we call it golf.
+%
+In America, any boy may become president and I suppose that's just one
+of the risks he takes.
+ -- Adlai E. Stevenson
+%
+In America today ... we have Woody Allen, whose humor has become so
+sophisticated that nobody gets it any more except Mia Farrow. All
+those who think Mia Farrow should go back to making movies where the
+devil gets her pregnant and Woody Allen should go back to dressing up
+as a human sperm, please raise your hands. Thank you.
+ -- Dave Barry, "Why Humor is Funny"
+%
+In an age when the fashion is to be in love with yourself, confessing to
+be in love with somebody else is an admission of unfaithfulness to one's
+beloved.
+ -- Russell Baker
+%
+In an orderly world, there's always a place for the disorderly.
+%
+In an organization, each person rises to the level of his own
+incompetency
+ -- The Peter Principle
+%
+In any country there must be people who have to die. They are the
+sacrifices any nation has to make to achieve law and order.
+ -- Idi Amin Dada
+%
+In any formula, constants (especially those obtained from handbooks)
+are to be treated as variables.
+%
+In any problem, if you find yourself doing an infinite amount of work,
+the answer may be obtained by inspection.
+%
+In any world menu, Canada must be considered the vichyssoise of nations --
+it's cold, half-French, and difficult to stir.
+ -- Stuart Keate
+%
+In Boston, it is illegal to hold frog-jumping contests in nightclubs.
+%
+IN BOX:
+ A catch basin for everything you don't want
+ to deal with, but are afraid to throw away.
+%
+In breeding cattle you need one bull for every twenty-five cows, unless
+the cows are known sluts.
+ -- Johnny Carson
+%
+In Brooklyn, we had such great pennant races, it
+made the World Series just something that came later.
+ -- Walter O'Malley, Dodgers owner
+%
+In buying horses and taking a wife
+shut your eyes tight and commend yourself to God.
+%
+In California, Bill Honig, the Superintendent of Public Instruction, said he
+thought the general public should have a voice in defining what an excellent
+teacher should know. "I would not leave the definition of math," Dr. Honig
+said, "up to the mathematicians."
+ -- The New York Times, October 22, 1985
+%
+In California they don't throw their garbage away -- they make
+it into television shows.
+ -- Woody Allen, "Annie Hall"
+%
+In case of atomic attack, all work rules will be temporarily suspended.
+%
+In case of atomic attack, the federal ruling
+against prayer in schools will be temporarily canceled.
+%
+In case of fire, stand in the hall and shout "Fire!"
+ -- The Kidner Report
+%
+In case of fire, yell "FIRE!"
+%
+In case of injury notify your superior immediately.
+He'll kiss it and make it better.
+%
+In charity there is no excess.
+ -- Francis Bacon
+%
+In childhood a woman must be subject to her father; in youth to her
+husband; when her husband is dead, to her sons. A woman must never
+be free of subjugation.
+ -- The Hindu Code of Manu
+%
+In Christianity, a man may have only one wife.
+This is called Monotony.
+%
+In Columbia, Pennsylvania, it is against the law for a pilot to tickle
+a female flying student under her chin with a feather duster in order
+to get her attention.
+%
+In computing, the mean time to failure keeps getting shorter.
+%
+In Corning, Iowa, it's a misdemeanor for a man to ask his wife to ride
+in any motor vehicle.
+%
+In defeat, unbeatable; in victory, unbearable.
+ -- Winston Churchill, on General Montgomery
+%
+In Denver it is unlawful to lend your vacuum cleaner to your next-door
+neighbor.
+%
+In Devon, Connecticut, it is unlawful to walk backwards after sunset.
+%
+In dwelling, be close to the land.
+In meditation, delve deep into the heart.
+In dealing with others, be gentle and kind.
+In speech, be true.
+In work, be competent.
+In action, be careful of your timing.
+ -- Lao Tsu
+%
+In English, every word can be verbed. Would that it were so in our
+programming languages.
+%
+In every country and every age, the priest has been hostile to Liberty.
+ -- Thomas Jefferson
+%
+In every hierarchy the cream rises until it sours.
+ -- Dr. Laurence J. Peter
+%
+In every job that must be done, there is an element of fun.
+Find the fun and snap! The job's a game.
+And every task you undertake, becomes a piece of cake,
+ a lark, a spree; it's very clear to see.
+ -- Mary Poppins
+%
+In every non-trivial program there is at least one bug.
+%
+In fact, S. M. Simpson, eventually devised an efficient 24-point Fourier
+transform, which was a precursor to the Cooley-Tukey fast Fourier transform
+in 1965. The FFT made all of Simpson's efficient autocorrelation and
+spectrum programs instantly obsolete, on which he had worked half a lifetime.
+ -- Proc. IEEE, Sept. 1982, p.900
+%
+In fiction the recourse of the powerless is murder;
+in life the recourse of the powerless is petty theft.
+%
+In Germany they first came for the Communists and I didn't speak up because
+I wasn't a Communist. Then they came for the Jews, and I didn't speak up
+because I wasn't a Jew. Then they came for the trade unionists, and I
+didn't speak up because I wasn't a trade unionist. Then they came for the
+Catholics, and I didn't speak up because I was a Protestant. Then they came
+for me -- and by that time no one was left to speak up.
+ -- Pastor Martin Niemoller
+%
+In God we trust; all else we walk through.
+%
+In good speaking, should not the mind of the speaker
+know the truth of the matter about which he is to speak?
+ -- Plato
+%
+In Greene, New York, it is illegal to eat peanuts and walk backwards on
+the sidewalks when a concert is on.
+%
+In her first passion woman loves her lover,
+In all the others all she loves is love.
+ -- George Gordon, Lord Byron, "Don Juan"
+%
+In high school in Brooklyn
+I was the baseball manager,
+proud as I could be
+I chased baseballs,
+gathered thrown bats
+handed out the towels Eventually, I bought my own
+It was very important work but it was dark blue while
+for a small spastic kid, the official ones were green
+but I was a team member Nobody ever said anything
+When the team got to me about my blue jacket;
+their warm-up jackets the guys were my friends
+I didn't get one Yet it hurt me all year
+Only the regular team to wear that blue jacket
+got these jackets, and among all those green ones
+surely not a manager Even now, forty years after,
+ I still recall that jacket
+ and the memory goes on hurting.
+ -- Bart Lanier Safford III, "An Obscured Radiance"
+%
+In Hollywood, all marriages are happy. It's trying to live together
+afterwards that causes the problems.
+ -- Shelley Winters
+%
+In Hollywood, if you don't have happiness, you send out for it.
+ -- Rex Reed
+%
+In India, "cold weather" is merely a conventional phrase and has come into
+use through the necessity of having some way to distinguish between weather
+which will melt a brass door-knob and weather which will only make it mushy.
+ -- Mark Twain
+%
+In Italy, for thirty years under the Borgias, they had warfare, terror,
+murder, and bloodshed, but they produced Michelangelo, Leonardo da Vinci
+and the Renaissance. In Switzerland, they had brotherly love, they had
+five hundred years of democracy and peace -- and what did they produce?
+The cuckoo-clock.
+ -- Orson Welles, "The Third Man"
+%
+In just seven days, I can make you a man!
+ -- The Rocky Horror Picture Show
+ [ (and seven nights...) Ed.]
+%
+In less than a century, computers will be making substantial
+progress on ... the overriding problem of war and peace.
+ -- James Slagle
+%
+In Lexington, Kentucky, it's illegal to carry an ice cream cone in your
+pocket.
+%
+In like a dimwit, out like a light.
+ -- Pogo
+%
+In love, she who gives her portrait promises the original.
+ -- Bruton
+%
+In Lowes Crossroads, Delaware, it is a violation of local law for any
+pilot or passenger to carry an ice cream cone in their pocket while
+either flying or waiting to board a plane.
+%
+In marriage, as in war, it is permitted
+to take every advantage of the enemy.
+%
+In Marseilles they make half the toilet soap we consume in America, but
+the Marseillaise only have a vague theoretical idea of its use, which they
+have obtained from books of travel.
+ -- Mark Twain
+%
+In matters of principle, stand like a rock;
+in matters of taste, swim with the current.
+ -- Thomas Jefferson
+%
+In Mexico we have a word for sushi: bait.
+ -- Josi Simon
+%
+In Minnesota they ask why all football fields in Iowa have artificial turf.
+It's so the cheerleaders won't graze during the game.
+%
+In most instances, all an argument
+proves is that two people are present.
+%
+In my end is my beginning.
+ -- Mary Stuart, Queen of Scots
+%
+In my experience, if you have to keep the lavatory door shut by extending
+your left leg, it's modern architecture.
+ -- Nancy Banks Smith
+%
+IN MY OPINION anyone interested in improving himself should not rule out
+becoming pure energy.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+In Nature there are neither rewards nor
+punishments, there are consequences.
+ -- R. G. Ingersoll
+%
+In Ohio, if you ignore an orator on Decoration day to such an extent as
+to publicly play croquet or pitch horseshoes within one mile of the
+speaker's stand, you can be fined $25.00.
+%
+In olden times sacrifices were made at the altar --
+a practice which is still continued.
+ -- Helen Rowland
+%
+In order to dial out, it is necessary to broaden one's dimension.
+%
+In order to discover who you are, first learn who everybody else is;
+you're what's left.
+%
+In order to get a loan you must first prove you don't need it.
+%
+In order to live free and happily, you must sacrifice boredom.
+It is not always an easy sacrifice.
+%
+In order to make an apple pie from scratch, you must first create the
+universe.
+ -- Carl Sagan, Cosmos
+%
+In our civilization, and under our republican form of government, intelligence
+is so highly honored that it is rewarded by exemption from the cares of office.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+In our system there's no intermediate step between a definitive Supreme
+Court decision and violent revolution.
+ -- Al Gore (New York Magazine, May 29 2006)
+%
+In Oz, never say "krizzle kroo" to a Woozy.
+%
+In Pierre Trudeau, Canada has finally produced
+a Prime Minister worthy of assassination.
+ -- John Diefenbaker
+%
+In Pocataligo, Georgia, it is a violation for a woman over 200 pounds
+and attired in shorts to pilot or ride in an airplane.
+%
+In Pocatello, Idaho, a law passed in 1912 provided that "The carrying
+of concealed weapons is forbidden, unless same are exhibited to public
+view."
+%
+In practice, failures in system development, like unemployment in Russia,
+happens a lot despite official propaganda to the contrary.
+ -- Paul Licker
+%
+In real love you want the other person's good. In romantic love you
+want the other person.
+ -- Margaret Anderson
+%
+In reply to a message by Scott Long:
+
+> Note: this amounts to life support for floppies. The end IS coming.
+
+Say it ain't so! If you establish a dangerous trend like this in
+your support for floppy booting, the next thing you know, some
+computer manufacturer will start shipping machines without ANY FLOPPY
+DRIVE AT ALL, leading to the infocalypse, the four horsemen pouring
+their vials upon the earth, the birth of the anti-christ (or PERL 6,
+whichever comes first), dogs and cats living together, etc.
+
+It's the end of days, I tell you! The end! Can the FreeBSD/NetBSD
+merger be that far off?
+ -- Jordan Hubbard (31 January 2006)
+%
+In Riemann, Hilbert or in Banach space
+Let superscripts and subscripts go their ways.
+Our asymptotes no longer out of phase,
+We shall encounter, counting, face to face.
+ -- Stanislaw Lem, "Cyberiad"
+%
+In San Francisco, Halloween is redundant.
+ -- Will Durst
+%
+In science it often happens that scientists say, "You know that's a really
+good argument; my position is mistaken," and then they actually change
+their minds and you never hear that old view from them again. They really
+do it. It doesn't happen as often as it should, because scientists are
+human and change is sometimes painful. But it happens every day. I cannot
+recall the last time something like that happened in politics or religion.
+ -- Carl Sagan, 1987 CSICOP keynote address
+%
+In Seattle, Washington, it is illegal to carry a concealed weapon that
+is over six feet in length.
+%
+In seeking the unattainable, simplicity only gets in the way.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+In short, _N is Richardian if, and only if, _N is not Richardian.
+%
+In specifications, Murphy's Law supersedes Ohm's.
+%
+In spite of everything, I still believe that people are good at heart.
+ -- Anne Frank
+%
+In success there's a tendency to keep on doing what you were doing.
+ -- Alan Kay
+%
+In Tennessee, it is illegal to shoot any game other than whales from a
+moving automobile.
+%
+[In the 60's] there was madness in any direction, at any hour ... You
+could strike sparks anywhere. There was a fantastic universal sense
+that whatever we were doing was `right', that we were winning ...
+
+And that, I think, was the handle -- the sense of inevitable victory
+over the forces of Old and Evil. Not in any mean or military sense; we
+didn't need that. Our energy would simply `prevail'. There was no
+point in fighting -- on our side or theirs. We had all the momentum;
+we were riding the crest of a high and beautiful wave ...
+
+So now, less than five years later, you can go up on a steep hill in
+Las Vegas and look West, and with the right kind of eyes you can almost
+_s_e_e the high-water mark -- the place where the wave finally broke and
+rolled back.
+ -- Hunter S. Thompson, "Fear and Loathing in Las Vegas"
+%
+"In the age of the internet attaching a famous name to your personal
+opinion to give more weight to it is a very valid strategy."
+ -- Benjamin Franklin
+%
+In the beginning there was nothing. And the Lord said "Let There Be Light!"
+And still there was nothing, but at least now you could see it.
+%
+In the beginning was the word.
+But by the time the second word was added to it,
+there was trouble.
+For with it came syntax ...
+ -- John Simon
+%
+In the course of reading Hadamard's "The Psychology of Invention in the
+Mathematical Field", I have come across evidence supporting a fact
+which we coffee achievers have long appreciated: no really creative,
+intelligent thought is possible without a good cup of coffee. On page
+14, Hadamard is discussing Poincare's theory of fuchsian groups and
+fuchsian functions, which he describes as "... one of his greatest
+discoveries, the first which consecrated his glory ..." Hadamard refers
+to Poincare having had a "... sleepless night which initiated all that
+memorable work ..." and gives the following, very revealing quote:
+
+ "One evening, contrary to my custom, I drank black coffee and
+ could not sleep. Ideas rose in crowds; I felt them collide
+ until pairs interlocked, so to speak, making a stable
+ combination."
+
+Too bad drinking black coffee was contrary to his custom. Maybe he
+could really have amounted to something as a coffee achiever.
+%
+In the days of old,
+When Knights were bold,
+ And women were too cautious;
+Oh, those gallant days,
+When women were women,
+ And men were really obnoxious.
+%
+In the dimestores and bus stations
+People talk of situations
+Read books repeat quotations
+Draw conclusions on the wall.
+ -- Bob Dylan
+%
+In the early morning queue,
+With a listing in my hand.
+With a worry in my heart, There on terminal number 9,
+Waitin' here in CERAS-land. Pascal run all set to go.
+I'm a long way from sleep, But I'm waitin' in the queue,
+How I miss a good meal so. With this code that ever grows.
+In the early mornin' queue, Now the lobby chairs are soft,
+With no place to go. But that can't make the queue move fast.
+ Hey, there it goes my friend,
+ I've moved up one at last.
+ -- Ernest Adams, "Early Morning Queue", to "Early
+ Morning Rain" by G. Lightfoot
+%
+In the eyes of my dog, I'm a man.
+ -- Martin Mull
+%
+In the first place, God made idiots;
+this was for practice; then he made school boards.
+ -- Mark Twain
+%
+In the force if Yoda's so strong, construct a sentence with words in
+the proper order then why can't he?
+%
+In the future, there will be fewer but better Russians.
+ -- Joseph Stalin
+%
+In the future, you're going to get computers as prizes in breakfast cereals.
+You'll throw them out because your house will be littered with them.
+%
+In the Halls of Justice the only justice is in the halls.
+ -- Lenny Bruce
+%
+In the highest society, as well as in the lowest,
+woman is merely an instrument of pleasure.
+ -- Tolstoy
+%
+In the land of the dark the Ship of the
+Sun is driven by the Grateful Dead.
+ -- Egyptian Book of the Dead
+%
+In the long run, every program becomes rococo, and then rubble.
+ -- Alan J. Perlis
+%
+In the long run we are all dead.
+ -- John Maynard Keynes
+%
+In the middle of a wide field is a pot of gold. 100 feet to the north stands
+a smart manager. 100 feet to the south stands a dumb manager. 100 feet to
+the east is the Easter Bunny, and 100 feet to the west is Santa Claus.
+
+Q: Who gets to the pot of gold first?
+A: The dumb manager. All the rest are myths.
+%
+In the midst of one of the wildest parties he'd ever been to, the young man
+noticed a very prim and pretty girl sitting quietly apart from the rest of
+the revelers. Approaching her, he introduced himself and, after some quiet
+conversation, said, "I'm afraid you and I don't really fit in with this
+jaded group. Why don't I take you home?""
+ "Fine," said the girl, smiling up at him demurely. "Where do you
+live?"
+%
+In the misfortune of our friends we find something that is not
+displeasing to us.
+ -- Francois de La Rochefoucauld, "Maxims"
+%
+In the next world, you're on your own.
+%
+In the Old West a wagon train is crossing the plains. As night falls the
+wagon train forms a circle, and a campfire is lit in the middle. After
+everyone has gone to sleep two lone cavalry officers stand watch over the
+camp.
+ After several hours of quiet, they hear war drums starting from
+a nearby Indian village they had passed during the day. The drums get
+louder and louder.
+ Finally one soldier turns to the other and says, "I don't like
+the sound of those drums."
+ Suddenly, they hear a cry come from the Indian camp: "IT'S
+NOT OUR REGULAR DRUMMER."
+%
+In the olden days in England, you could be hung for stealing a sheep or a
+loaf of bread. However, if a sheep stole a loaf of bread and gave it to
+you, you would only be tried for receiving, a crime punishable by forty
+lashes with the cat or the dog, whichever was handy. If you stole a dog
+and were caught, you were punished with twelve rabbit punches, although it
+was hard to find rabbits big enough or strong enough to punch you.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+In the plot, people came to the land; the land loved them; they worked and
+struggled and had lots of children. There was a Frenchman who talked funny
+and a greenhorn from England who was a fancy-pants but when it came to the
+crunch he was all courage. Those novels would make you retch.
+ -- Canadian novelist Robertson Davies, on the generic Canadian
+ novel.
+%
+In the space of one hundred and seventy-six years the Mississippi has
+shortened itself two hundred and forty-two miles. Therefore ... in the Old
+Silurian Period the Mississippi River was upward of one million three hundred
+thousand miles long ... seven hundred and forty-two years from now the
+Mississippi will be only a mile and three-quarters long. ... There is
+something fascinating about science. One gets such wholesome returns of
+conjecture out of such a trifling investment of fact.
+ -- Mark Twain
+%
+In the Spring, I have counted 136
+different kinds of weather inside of 24 hours.
+ -- Mark Twain, on New England weather
+%
+In the stairway of life, you'd best take the elevator.
+%
+In the time of peace and harmony
+Be a kind-hearted friend.
+In the time of conflict with enemies
+Be a falcon of advance and attack.
+ -- Chinggis (Genghis) Khan
+%
+In the Top 40, half the songs are secret messages to the teen world to drop
+out, turn on, and groove with the chemicals and light shows at discotheques.
+ -- Art Linkletter
+%
+In the war of wits, he's unarmed.
+%
+In theory, there is no difference between theory and practice.
+In practice, there is.
+%
+In these matters the only certainty is that there is nothing certain.
+ -- Pliny the Elder
+%
+In this vale
+Of toil and sin
+Your head grows bald
+But not your chin.
+ -- Burma Shave
+%
+In this world, nothing is certain but death and taxes.
+ -- Benjamin Franklin
+%
+In this world of sin and sorrow there is always something to be
+thankful for; as for me, I rejoice that I am not a Republican.
+ -- H. L. Mencken
+%
+In this world some people are going to like me and some are not.
+So, I may as well be me. Then I know if someone likes me, they like me.
+%
+In this world there are only two tragedies. One is
+not getting what one wants, and the other is getting it.
+ -- Oscar Wilde
+%
+In this world, truth can wait; she's used to it.
+%
+In those days he was wiser than he is now -- he used to frequently take
+my advice.
+ -- Winston Churchill
+%
+In time, every post tends to be occupied by an
+employee who is incompetent to carry out its duties.
+ -- Dr. Laurence J. Peter
+%
+In Tulsa, Oklahoma, it is against the law to open a soda bottle without
+the supervision of a licensed engineer.
+%
+In /users3 did Kubla Kahn
+A stately pleasure dome decree,
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+%
+In war it is not men, but the man who counts.
+ -- Napoleon
+%
+In war, truth is the first casualty.
+ -- U Thant
+%
+In West Union, Ohio, No married man can go flying without his spouse
+along at any time, unless he has been married for more than 12 months.
+%
+In which level of metalanguage are you now speaking?
+%
+In wine there is truth (In vino veritas).
+ -- Pliny
+%
+In Xanadu did Kubla Khan a stately pleasure dome decree
+But only if the NFL to a franchise would agree.
+%
+In Xanadu did Kubla Khan
+A stately pleasure dome decree:
+Where Alph, the sacred river, ran
+Through caverns measureless to man
+Down to a sunless sea.
+So twice five miles of fertile ground
+With walls and towers were girdled round:
+And there were gardens bright with sinuous rills,
+Where blossomed many an incense-bearing tree;
+And here were forest ancient as the hills,
+Enfolding sunny spots of greenery.
+ -- Samuel T. Coleridge, "Kubla Kahn"
+%
+In youth, it was a way I had
+To do my best to please,
+And change, with every passing lad,
+To suit his theories.
+
+But now I know the things I know,
+And do the things I do;
+And if you do not like me so,
+To hell, my love, with you!
+ -- Dorothy Parker, "Indian Summer"
+%
+INCENTIVE PROGRAM:
+ The system of long and short-term rewards that a corporation uses
+ to motivate its people. Still, despite all the experimentation with
+ profit sharing, stock options, and the like, the most effective
+ incentive program to date seems to be "Do a good job and you get to
+ keep it."
+%
+Include me out.
+%
+Increased knowledge will help you now.
+Have mate's phone bugged.
+%
+Incumbent, n.:
+ Person of liveliest interest to the outcumbents.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Indecision is the true basis for flexibility.
+%
+Indeed, the first noble truth of Buddhism, usually translated as
+`all life is suffering,' is more accurately rendered `life is filled
+with a sense of pervasive unsatisfactoriness.'
+ -- M. D. Epstein
+%
+INDEX:
+ Alphabetical list of words of no possible interest where an
+ alphabetical list of subjects with references ought to be.
+%
+Indiana is a state dedicated to basketball. Basketball, soybeans, hogs and
+basketball. Berkeley, needless to say, is not nearly as athletic. Berkeley
+is dedicated to coffee, angst, potholes and coffee.
+ -- Carolyn Jones
+%
+Indifference will certainly be the downfall of mankind, but who cares?
+%
+Individualists unite!
+%
+Indomitable in retreat; invincible in
+advance; insufferable in victory.
+ -- Winston Churchill, on General Montgomery
+%
+Infancy, n.:
+ The period of our lives when, according to Wordsworth, "Heaven lies
+ about us." The world begins lying about us pretty soon afterward.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Infidel, n.:
+ In New York, one who does not believe in the Christian religion;
+ in Constantinople, one who does.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Inform all the troops that communications have completely broken down.
+%
+Information Center, n.:
+ A room staffed by professional computer people whose job it is
+to tell you why you cannot have the information you require.
+%
+Information is the inverse of entropy.
+%
+Information Processing:
+ What you call data processing when people are so disgusted with
+ it they won't let it be discussed in their presence.
+%
+Inglish Spocken Hier: some mangled translations
+
+ Sign on a cabin door of a Soviet Black Sea cruise liner:
+ Helpsavering apparata in emergings behold many whistles!
+ Associate the stringing apparata about the bosums and meet
+ behind, flee then to the indifferent lifesaveringshippen
+ obedicing the instructs of the vessel.
+
+ On the door in a Belgrade hotel:
+ Let us know about any unficiency as well as leaking on
+ the service. Our utmost will improve it.
+
+ -- Colin Bowles
+%
+Inglish Spocken Hier: some mangled translations
+
+ Sign on a cathedral in Spain:
+ It is forbidden to enter a woman, even a foreigner if
+ dressed as a man.
+
+ Above the entrance to a Cairo bar:
+ Unaccompanied ladies not admitted unless with husband
+ or similar.
+
+ On a Bucharest elevator:
+
+ The lift is being fixed for the next days.
+ During that time we regret that you will be unbearable.
+
+ -- Colin Bowles
+%
+Inglish Spocken Hier: some mangled translations
+
+ Various signs in Poland:
+
+ Right turn toward immediate outside.
+
+ Go soothingly in the snow, as there lurk the ski demons.
+
+ Five o'clock tea at all hours.
+
+ In a men's washroom in Sidney:
+
+ Shake excess water from hands, push button to start,
+ rub hands rapidly under air outlet and wipe hands
+ on front of shirt.
+
+ -- Colin Bowles, San Francisco Chronicle
+%
+Ingrate, n.:
+ A man who bites the hand that feeds him,
+ and then complains of indigestion.
+%
+Injustice anywhere is a threat to justice everywhere.
+ -- Martin Luther King, Jr.
+%
+Ink, n.:
+ A villainous compound of tannogallate of iron, gum-arabic, and
+ water, chiefly used to facilitate the infection of idiocy and
+ promote intellectual crime.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Innocence ends when one is stripped of the delusion that one
+likes oneself.
+ -- Joan Didion, "On Self Respect"
+%
+INNOVATE:
+ Annoy people.
+%
+Innovation is hard to schedule.
+ -- Dan Fylstra
+%
+INNUENDO:
+ Italian enema.
+%
+Insanity is considered a ground for divorce, though by the very same
+token it is the shortest detour to marriage.
+ -- Wilson Mizner
+%
+Insanity is hereditary. You get it from your kids.
+%
+Insanity is the final defense. It's hard to get a refund when
+the salesman is sniffing your crotch and baying at the moon.
+%
+INSECURITY:
+ Finding out that you've mispronounced for years one of your
+ favorite words.
+
+ Realizing halfway through a joke that you're telling it to
+ the person who told it to you.
+%
+Insomnia isn't anything to lose sleep over.
+%
+Inspector: "Mrs. Freem, was this your husband's first
+ hunting accident?"
+Mrs. Freem: "His first fatal one, yes."
+ -- Woody Allen
+%
+Inspiration without perspiration is usually sterile.
+%
+Instead of giving money to found colleges to promote learning, why don't
+they pass a constitutional amendment prohibiting anybody from learning
+anything? If it works as good as the Prohibition one did, why, in five
+years we would have the smartest race of people on earth.
+ -- The Best of Will Rogers
+%
+Instead of loving your enemies, treat your friends a little better.
+ -- Edgar W. Howe
+%
+Instead of thinking of spam as a disease that might be eliminated,
+it is more useful to think of it like crime, war and cockroaches.
+It is not realistic to expect to eliminate any of these, no matter
+how much anyone might wish otherwise. Therefore the best we can
+hope to accomplish is to bring spam under reasonable control...
+ -- Dave Crocker
+%
+Integrity has no need for rules.
+%
+Intel CPUs are not defective, they just act that way.
+ -- Henry Spencer
+%
+Intellect annuls Fate.
+So far as a man thinks, he is free.
+ -- Ralph Waldo Emerson
+%
+Interchangeable parts won't.
+%
+INTEREST:
+ What borrowers pay, lenders receive, stockholders own, and
+ burned out employees must feign.
+%
+Interesting poll results reported in today's New York Post: people on the
+street in midtown Manhattan were asked whether they approved of the US
+invasion of Grenada. Fifty-three percent said yes; 39 percent said no;
+and 8 percent said "Gimme a quarter?"
+ -- David Letterman
+%
+Interfere? Of course we should interfere! Always do what you're
+best at, that's what I say.
+ -- "Doctor Who"
+%
+Interpreter, n.:
+ One who enables two persons of different languages to understand
+ each other by repeating to each what it would have been to the
+ interpreter's advantage for the other to have said.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Intolerance is the last defense of the insecure.
+%
+INTOXICATED:
+ When you feel sophisticated without being able to pronounce it.
+%
+Introducing, the 1010, a one-bit processor.
+
+INSTRUCTION SET
+ Code Mnemonic What
+ 0 NOP No Operation
+ 1 JMP Jump (address specified by next 2 bits)
+
+Now Available for only 12 1/2 cents!
+%
+Invest in physics -- own a piece of Dirac!
+%
+Involvement with people is always a very delicate thing --
+it requires real maturity to become involved and not get all messed up.
+ -- Bernard Cooke
+%
+I/O, I/O,
+It's off to disk I go,
+A bit or byte to read or write,
+I/O, I/O, I/O...
+%
+IOT trap -- core dumped
+%
+IOT trap -- mos dumped
+%
+Iowa State -- the high school after high school!
+ -- Crow T. Robot
+%
+Iowans ask why Minnesotans don't drink more Kool-Aid. That's because
+they can't figure out how to get two quarts of water into one of those
+little paper envelopes.
+%
+Iron Law of Distribution:
+ Them that has, gets.
+%
+IRONY:
+ A windy day, when, just as a beautiful girl with
+ a short skirt approaches, dust blows in your eyes.
+%
+Irrationality is the square root of all evil.
+ -- Douglas Hofstadter
+%
+Is a computer language with goto's totally Wirth-less?
+%
+Is a person who blows up banks an econoclast?
+%
+Is a wedding successful if it comes off without a hitch?
+%
+Is death legally binding?
+%
+Is it possible that software is not like anything else, that it is
+meant to be discarded: that the whole point is to always see it as
+a soap bubble?
+%
+Is it weird in here, or is it just me?
+ -- Steven Wright
+%
+Is knowledge knowable? If not, how do we know that?
+%
+Is not marriage an open question, when it is alleged, from the beginning
+of the world, that such as are in the institution wish to get out,
+and such as are out wish to get in?
+ -- Ralph Waldo Emerson
+%
+Is sex dirty? Only if it's done right.
+ -- Woody Allen, "All You Ever Wanted To Know About Sex"
+%
+Is that a pistol in your pocket or are you just glad to see me?
+ -- Mae West
+%
+Is that really YOU that is reading this?
+%
+Is there life before breakfast?
+%
+Is this really happening?
+%
+Is your job running? You'd better go catch it!
+%
+Isn't air travel wonderful?
+Breakfast in London, dinner in New York, luggage in Brazil.
+%
+Isn't it conceivable to you that an intelligent
+person could harbor two opposing ideas in his mind?
+ -- Adlai E. Stevenson, to reporters
+%
+Isn't it interesting that the same people who laugh at science fiction
+listen to weather forecasts and economists?
+ -- Kelvin Throop III
+%
+Isn't it ironic that many men spend a great part of their lives
+avoiding marriage while single-mindedly pursuing those things that
+would make them better prospects?
+%
+Isn't it nice that people who prefer Los Angeles to San Francisco live
+there?
+ -- Herb Caen
+%
+Isn't it strange that the same people that
+laugh at gypsy fortune tellers take economists seriously?
+%
+ISO applications:
+ A solution in search of a problem!
+%
+Issawi's Laws of Progress:
+ The Course of Progress:
+ Most things get steadily worse.
+ The Path of Progress:
+ A shortcut is the longest distance between two points.
+%
+It appears that after his death, Albert Einstein found himself working
+as the doorkeeper at the Pearly Gates. One slow day, he found that he
+had time to chat with the new entrants. To the first one he asked,
+"What's your IQ?" The new arrival replied, "190". They discussed
+Einstein's theory of relativity for hours. When the second new arrival
+came, Einstein once again inquired as to the newcomer's IQ. The answer
+this time came "120". To which Einstein replied, "Tell me, how did the
+Cubs do this year?" and they proceeded to talk for half an hour or so.
+To the final arrival, Einstein once again posed the question, "What's
+your IQ?". Upon receiving the answer "70", Einstein smiled and asked,
+"Got a minute to tell me about VMS 4.0?"
+%
+It appears that PL/I (and its dialects) is, or will be, the
+most widely used higher level language for systems programming.
+ -- J. Sammet
+%
+It cannot be seen, cannot be felt,
+Cannot be heard, cannot be smelt.
+It lies behind starts and under hills,
+And empty holes it fills.
+It comes first and follows after,
+Ends life, kills laughter.
+%
+"It could be that Walter's horse has wings" does not imply that there is
+any such animal as Walter's horse, only that there could be; but "Walter's
+horse is a thing which could have wings" does imply Walter's horse's
+existence. But the conjunction "Walter's horse exists, and it could be
+that Walter's horse has wings" still does not imply "Walter's horse is a
+thing that could have wings", for perhaps it can only be that Walter's
+horse has wings by Walter having a different horse. Nor does "Walter's
+horse is a thing which could have wings" conversely imply "It could be that
+Walter's horse has wings"; for it might be that Walter's horse could only
+have wings by not being Walter's horse.
+
+I would deny, though, that the formula [Necessarily if some x has property P
+then some x has property P] expresses a logical law, since P(x) could stand
+for, let us say "x is a better logician than I am", and the statement "It is
+necessary that if someone is a better logician than I am then someone is a
+better logician than I am" is false because there need not have been any me.
+ -- A. N. Prior, "Time and Modality"
+%
+It destroys one's nerves to be amiable every day to the same human being.
+ -- Benjamin Disraeli
+%
+It did not occur to me that my being with two men continuously would
+interest anyone or arouse anyone's misgivings. I asked for an invitation
+for Heinrich too, as often as it seemed possible, when Paulus and I were
+invited to a social gathering. I felt the set of rules others lived by
+was irrelevant. My childhood attitude -- every attempt to adjust is
+hopeless and you might just as well follow your own attitudes -- must have
+carried me.
+ -- Hannah Tillich, "From Time to Time"
+%
+It does not do to leave a live dragon out of your calculations.
+%
+It does not matter if you fall down as long as you
+pick up something from the floor while you get up.
+%
+It doesn't matter what you do, it only matters what you say you've
+done and what you're going to do.
+%
+It doesn't matter whether you win or lose -- until you lose.
+%
+It doesn't much signify whom one marries, for one is sure to find out
+next morning it was someone else.
+ -- Rogers
+%
+It follows that any commander in chief who undertakes to carry out a plan
+which he considers defective is at fault; he must put forth his reasons,
+insist of the plan being changed, and finally tender his resignation rather
+than be the instrument of his army's downfall.
+ -- Napoleon, "Military Maxims and Thought"
+%
+It gets late early out there.
+ -- Yogi Berra
+%
+It got to the point where I had to get a haircut
+or both feet firmly planted in the air.
+%
+It hangs down from the chandelier
+Nobody knows quite what it does
+Its color is odd and its shape is weird
+It emits a high-sounding buzz
+
+It grows a couple of feet each day
+and wriggles with sort of a twitch
+Nobody bugs it 'cause it comes from
+a visiting uncle who's rich!
+ -- To "It Came Upon A Midnight Clear"
+%
+It happened long ago
+In the new magic land
+The Indians and the buffalo
+Existed hand in hand
+The Indians needed food
+They need skins for a roof
+The only took what they needed
+And the buffalo ran loose
+But then came the white man
+With his thick and empty head
+He couldn't see past his billfold
+He wanted all the buffalo dead
+It was sad, oh so sad.
+ -- Ted Nugent, "The Great White Buffalo"
+%
+It happened that a fire broke out backstage in a theater. The clown
+came out to inform the public. They thought it was just a jest and
+applauded. He repeated his warning, they shouted even louder. So I
+think the world will come to an end amid general applause from all the
+wits, who believe that it is a joke.
+ -- S. A. Kierkegaard (1813-1855)
+%
+It has been justly observed by sages of all lands that although a man may be
+most happily married and continue in that state with the utmost contentment,
+it does not necessarily follow that he has therefore been struck stone-blind.
+ -- H. Warner Munn
+%
+It has been observed that one's nose is never so happy as when it is
+thrust into the affairs of another, from which some physiologists have
+drawn the inference that the nose is devoid of the sense of smell.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+It has been said [by Anatole France], "it is not by amusing oneself
+that one learns," and, in reply: "it is *_o_n_l_y* by amusing oneself that
+one can learn."
+ -- Edward Kasner and James R. Newman
+%
+It has been said that man is a rational animal. All my life I have
+been searching for evidence which could support this.
+ -- Bertrand Russell
+%
+It has been said that Public Relations is the art of winning friends
+and getting people under the influence.
+ -- Jeremy Tunstall
+%
+It has just been discovered that research causes cancer in rats.
+%
+It has long been an article of our folklore that too much knowledge or skill,
+or especially consummate expertise, is a bad thing. It dehumanizes those who
+achieve it, and makes difficult their commerce with just plain folks, in whom
+good old common sense has not been obliterated by mere book learning or fancy
+notions. This popular delusion flourishes now more than ever, for we are all
+infected with it in the schools, where educationists have elevated it from
+folklore to Article of Belief. It enhances their self-esteem and lightens
+their labors by providing theoretical justification for deciding that
+appreciation, or even simple awareness, is more to be prized than knowledge,
+and relating (to self and others), more than skill, in which minimum
+competence will be quite enough.
+ -- The Underground Grammarian
+%
+It has long been an axiom of mine that the
+little things are infinitely the most important.
+ -- Sir Arthur Conan Doyle, "A Case of Identity"
+%
+It has long been known that birds will occasionally build nests in the
+manes of horses. The only known solution to this problem is to sprinkle
+baker's yeast in the mane, for, as we all know, yeast is yeast and nest
+is nest, and never the mane shall tweet.
+%
+It has long been known that one horse can run faster
+than another -- but which one? Differences are crucial.
+ -- Lazarus Long
+%
+It has long been noticed that juries are pitiless for robbery and full of
+indulgence for infanticide. A question of interest, my dear Sir! The jury
+is afraid of being robbed and has passed the age when it could be a victim
+of infanticide.
+ -- Edmond About
+%
+It is a hard matter, my fellow citizens,
+to argue with the belly, since it has no ears.
+ -- Marcus Porcius Cato
+%
+It is a lesson which all history teaches
+wise men, to put trust in ideas, and not in circumstances.
+ -- Ralph Waldo Emerson
+%
+It is a poor judge who cannot award a prize.
+%
+It is a profitable thing, if one is wise, to seem foolish.
+ -- Aeschylus
+%
+It is a sobering thought that when Mozart was
+my age, he had been dead for 2 years.
+ -- Tom Lehrer
+%
+It is a very humbling experience to make a multimillion-dollar mistake, but
+it is also very memorable. I vividly recall the night we decided how to
+organize the actual writing of external specifications for OS/360. The
+manager of architecture, the manager of control program implementation, and
+I were threshing out the plan, schedule, and division of responsibilities.
+ The architecture manager had 10 good men. He asserted that they
+could write the specifications and do it right. It would take ten months,
+three more than the schedule allowed.
+ The control program manager had 150 men. He asserted that they
+could prepare the specifications, with the architecture team coordinating;
+it would be well-done and practical, and he could do it on schedule.
+Furthermore, if the architecture team did it, his 150 men would sit twiddling
+their thumbs for ten months.
+ To this the architecture manager responded that if I gave the control
+program team the responsibility, the result would not in fact be on time,
+but would also be three months late, and of much lower quality. I did, and
+it was. He was right on both counts. Moreover, the lack of conceptual
+integrity made the system far more costly to build and change, and I would
+estimate that it added a year to debugging time.
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+It is a wise father that knows his own child.
+ -- William Shakespeare, "The Merchant of Venice"
+%
+It is against the grain of modern education to teach children to program.
+What fun is there in making plans, acquiring discipline in organizing
+thoughts, devoting attention to detail, and learning to be self-critical?
+ -- Alan J. Perlis
+%
+It is against the law for a monster to enter the corporate limits of
+Urbana, Illinois.
+%
+It is all right to hold a conversation,
+but you should let go of it now and then.
+ -- Richard Armour
+%
+It is always the best policy to tell the truth, unless, of course,
+you are an exceptionally good liar.
+ -- Jerome K. Jerome
+%
+It is amazing how complete is the delusion that beauty is goodness.
+%
+It is amusing that a virtue is made of the vice of chastity; and it's a
+pretty odd sort of chastity at that, which leads men straight into the
+sin of Onan, and girls to the waning of their color.
+ -- Voltaire
+%
+It is an important and popular fact that things are not always what
+they seem. For instance, on the planet Earth, man had always assumed
+that he was more intelligent than dolphins because he had achieved so
+much -- the wheel, New York wars and so on -- whilst all the dolphins
+had ever done was muck about in the water having a good time. But
+conversely, the dolphins had always believed that they were far more
+intelligent than man -- for precisely the same reasons.
+
+Curiously enough, the dolphins had long known of the impending
+destruction of the of the planet Earth and had made many attempts to
+alert mankind to the danger; but most of their communications were
+misinterpreted ...
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+It is annoying to be honest to no purpose.
+ -- Publius Ovidius Naso (Ovid)
+%
+It is bad luck to be superstitious.
+ -- Andrew W. Mathis
+%
+[It is] best to confuse only one issue at a time.
+ -- K&R
+%
+It is better for civilization to be going down the drain than to be
+coming up it.
+ -- Henry Allen
+%
+It is better never to have been born. But who among us has such luck?
+One in a million, perhaps.
+%
+It is better to be bow-legged than no-legged.
+%
+It is better to be on penicillin, than never to have loved at all.
+%
+It is better to burn out than it is to rust.
+%
+It is better to die on your feet than to live on your knees.
+%
+It is better to give than to lend, and it costs about the same.
+%
+It is better to have loved a short man than never to have loved a tall.
+%
+It is better to have loved and lost -- much better.
+%
+It is better to have loved and lost than just to have lost.
+%
+It is better to kiss an avocado than to get in a fight with an aardvark.
+%
+It is better to live rich than to die rich.
+ -- Samuel Johnson
+%
+It is better to remain childless than to father an orphan.
+%
+It is better to travel hopefully than to fly Continental.
+%
+It is better to wear chains than to believe you are free,
+and weight yourself down with invisible chains.
+%
+It is better to wear out than to rust out.
+%
+It is by the fortune of God that, in this country, we have three benefits:
+freedom of speech, freedom of thought, and the wisdom never to use either.
+ -- Mark Twain
+%
+It is common sense to take a method and try it. If it fails,
+admit it frankly and try another. But above all, try something.
+ -- Franklin D. Roosevelt
+%
+It is contrary to reasoning to say that there
+is a vacuum or space in which there is absolutely nothing.
+ -- Rene Descartes
+%
+It is convenient that there be gods, and,
+as it is convenient, let us believe there are.
+ -- Publius Ovidius Naso (Ovid)
+%
+It is dangerous for a national candidate to say things that people might
+remember.
+ -- Eugene McCarthy
+%
+It is difficult to get a man to understand something when his salary
+depends upon his not understanding it.
+ -- Upton Sinclair
+%
+It is difficult to legislate morality in the absence of moral legislators.
+%
+It is difficult to produce a television documentary that is both
+incisive and probing when every twelve minutes one is interrupted by
+twelve dancing rabbits singing about toilet paper.
+ -- Rod Serling
+%
+It is difficult to soar with the eagles when you work with turkeys.
+%
+It is easier for a camel to pass through the eye of a needle if it is
+lightly greased.
+ -- Kehlog Albran, "The Profit"
+%
+It is easier to be a "humanitarian" than to render your own country its
+proper due; it is easier to be a "patriot" than to make your community a
+better place to live in; it is easier to be a "civic leader" than to treat
+your own family with loving understanding; for the smaller the focus of
+attention, the harder the task.
+ -- Sydney J. Harris
+%
+It is easier to change the specification to fit the program than vice versa.
+%
+It is easier to fight for one's principles than to live up to them.
+ -- Alfred Adler
+%
+It is easier to make a saint out of a libertine than out of a prig.
+ -- George Santayana
+%
+It is easier to resist at the beginning than at the end.
+ -- Leonardo da Vinci
+%
+It is easier to run down a hill than up one.
+%
+It is easier to write an incorrect program than understand a correct one.
+%
+It is easy when we are in prosperity to give advice to the afflicted.
+ -- Aeschylus
+%
+It is enough to make one sympathize with a tyrant for the determination
+of his courtiers to deceive him for their own personal ends...
+ -- Russell Baker and Charles Peters
+%
+It is equally bad when one speeds on the guest unwilling to go, and when he
+holds back one who is hastening. Rather one should befriend the guest who
+is there, but speed him when he wishes.
+ -- Homer, "The Odyssey"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to scheduling.]
+%
+It is exactly because a man cannot do a
+thing that he is a proper judge of it.
+ -- Oscar Wilde
+%
+It is explained that all relationships require a little give and take. This
+is untrue. Any partnership demands that we give and give and give and at the
+last, as we flop into our graves exhausted, we are told that we didn't give
+enough.
+ -- Quentin Crisp, "How to Become a Virgin"
+%
+It is far better to be deceived than to be undeceived by those we love.
+%
+It is far more impressive when others discover your good qualities
+without your help.
+ -- Miss Manners
+%
+It is Fortune, not Wisdom, that rules man's life.
+%
+It is fruitless:
+ to become lachrymose over precipitately departed lactate fluid.
+
+ to attempt to indoctrinate a superannuated canine with
+ innovative maneuvers.
+%
+It is generally agreed that "Hello" is an appropriate greeting because
+if you entered a room and said "Goodbye," it could confuse a lot of people.
+ -- Dolph Sharp, "I'm O.K., You're Not So Hot"
+%
+It is hard to predict, in particular about the future.
+ -- Robert Storm Petersen
+%
+It is idle to attempt to talk a young woman out of her passion:
+love does not lie in the ear.
+ -- Walpole
+%
+It is illegal to drive more than two thousand sheep down Hollywood
+Boulevard at one time.
+%
+It is illegal to say "Oh, Boy" in Jonesboro, Georgia.
+%
+It is imperative when flying coach that you restrain any tendency toward
+the vividly imaginative. For although it may momentarily appear to be the
+case, it is not at all likely that the cabin is entirely inhabited by
+crying babies smoking inexpensive domestic cigars.
+ -- Fran Lebowitz, "Social Studies"
+%
+It is impossible for an optimist to be pleasantly surprised.
+%
+It is impossible to defend perfectly
+against the attack of those who want to die.
+%
+It is impossible to enjoy idling thoroughly
+unless one has plenty of work to do.
+ -- Jerome Klapka Jerome
+%
+It is impossible to experience one's death objectively and still carry
+a tune.
+ -- Woody Allen
+%
+It is impossible to make anything
+foolproof because fools are so ingenious.
+%
+It is impossible to travel faster than light, and
+certainly not desirable, as one's hat keeps blowing off.
+ -- Woody Allen
+%
+IT IS IN PROCESS:
+ So wrapped up in red tape that the situation is almost hopeless.
+%
+It is indeed desirable to be well descended,
+but the glory belongs to our ancestors.
+ -- Plutarch
+%
+It is like saying that for the cause of peace,
+God and the Devil will have a high-level meeting.
+ -- Rev. Carl McIntire, on Nixon's China trip
+%
+It is most dangerous nowadays for a husband to pay any attention to his
+wife in public. It always makes people think that he beats her when
+they're alone. The world has grown so suspicious of anything that looks
+like a happy married life.
+ -- Oscar Wilde
+%
+It is Mr. Mellon's credo that $200,000,000 can do no wrong. Our
+offense consists in doubting it.
+ -- Justice Robert H. Jackson
+%
+It is much easier to be critical than to be correct.
+ -- Benjamin Disraeli
+%
+It is much easier to suggest solutions
+when you know nothing about the problem.
+%
+It is much harder to find a job than to keep one.
+%
+It is necessary for the welfare of society that genius should be
+privileged to utter sedition, to blaspheme, to outrage good taste, to
+corrupt the youthful mind, and generally to scandalize one's uncles.
+ -- George Bernard Shaw
+%
+It is no wonder that people are so horrible when they start life as children.
+ -- Kingsley Amis
+%
+It is not a good omen when goldfish commit suicide.
+%
+It is not doing the thing we like to do, but liking the thing we have to do,
+that makes life blessed.
+ -- Johann Wolfgang von Goethe
+%
+It is not enough that I should succeed. Others must fail.
+ -- Ray Kroc, founder of McDonald's
+ [Also attributed to David Merrick. Ed.]
+
+It is not enough to succeed. Others must fail.
+ -- Gore Vidal
+ [Great minds think alike? Ed.]
+%
+It is not enough to have a good mind.
+The main thing is to use it well.
+ -- Rene Descartes
+%
+It is not enough to have great qualities,
+we should also have the management of them.
+ -- Francois de La Rochefoucauld
+%
+It is not every question that deserves an answer.
+ -- Publilius Syrus
+%
+It is not for me to attempt to fathom the
+inscrutable workings of Providence.
+ -- The Earl of Birkenhead
+%
+It is not good for a man to be without knowledge,
+and he who makes haste with his feet misses his way.
+ -- Proverbs 19:2
+%
+It is not necessary to inquire whether a woman would like something for
+dessert. The answer is yes, she would like something for dessert, but
+she would like you to order it so she can pick at it with your fork. She
+does not want you to call attention to this by saying, "If you wanted a
+dessert, why didn't you order one?" You must understand, she has the
+dessert she wants. The dessert she wants is contained within yours.
+ -- Merrill Marcoe, "An Insider's Guide to the American Woman"
+%
+It is not that polar co-ordinates are complicated, it is simply
+that Cartesian co-ordinates are simpler than they have a right to be.
+ -- Kleppner & Kolenhow, "An Introduction to Mechanics"
+%
+It is not the critic who counts, or how the strong man stumbled, or whether
+the doer of deeds could have done them better. The credit belongs to the
+man who is actually in the arena, whose face is marred by dust and sweat and
+blood, who strives valiantly, who errs and comes short again and again; who
+knows the great enthusiasm, the great devotion, and who spends himself in a
+worthy cause, and if he fails, at least fails while daring greatly, so that
+he'll never be with those cold and timid souls who never know either victory
+or defeat.
+ -- Teddy Roosevelt
+%
+It is November first 1940; in the famous sound stage of THE WIZARD OF OZ on
+the MGM lot, a little man is lying face-up on the yellow brick road. His
+wide eyes stare upward into the blinding stage lights. He is wearing a
+kind of comic soldier's uniform with a yellow coat and puffy sleeves and
+big fez-like blue and yellow hat with a feather on top. His yellow hair
+and beard are the phony straw color of Hollywood. He could pass for some
+kind of cute in the typical tinsel-town way if it wasn't for the knife
+sticking out of his chest. *Someone had murdered a Munchkin.*
+ -- Stuart Kaminsky, "Murder on the Yellow Brick Road"
+%
+It is now 10 p.m. Do you know where Henry Kissinger is?
+ -- Elizabeth Carpenter
+%
+It is now pitch dark. If you proceed, you will likely fall into a pit.
+%
+It is now quite lawful for a Catholic woman to avoid pregnancy by a resort
+to mathematics, though she is still forbidden to resort to physics and
+chemistry.
+ -- H. L. Mencken
+%
+It is often easier to ask for forgiveness than to ask for permission.
+ -- Grace Murray Hopper
+%
+It is one thing to praise discipline, and another to submit to it.
+ -- Cervantes
+%
+It is only by risking our persons from one hour to another that we live
+at all. And often enough our faith beforehand in an uncertified result
+is the only thing that makes the result come true.
+ -- William James
+%
+It is only people of small moral stature who have to stand on their
+dignity.
+%
+It is only the great men who are truly obscene. If they had not dared
+to be obscene, they could never have dared to be great.
+ -- Havelock Ellis
+%
+It is only with the heart one can see clearly;
+what is essential is invisible to the eye.
+ -- The Fox, "The Little Prince"
+%
+It is perfectly permissible for every system call to fail with [ENOTADUCK]
+unless the first five bytes of the caller's address space contain the
+word "quack".
+ -- Garrett Wollman
+%
+It is possible by ingenuity and at the expense of clarity... {to do almost
+anything in any language}. However, the fact that it is possible to push
+a pea up a mountain with your nose does not mean that this is a sensible
+way of getting it there. Each of these techniques of language extension
+should be used in its proper place.
+ -- Christopher Strachey
+%
+It is possible that blondes also prefer gentlemen.
+ -- Maimie Van Doren
+%
+It is practically impossible to teach good programming to students that
+have had a prior exposure to BASIC: as potential programmers they are
+mentally mutilated beyond hope of regeneration.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+It is ridiculous to call this an industry. This is not. This is rat eat
+rat, dog eat dog. I'll kill 'em, and I'm going to kill 'em before they
+kill me. You're talking about the American way of survival of the fittest.
+ -- Ray Kroc, founder of McDonald's
+%
+It is right that he too should have his little chronicle, his memories,
+his reason, and be able to recognize the good in the bad, the bad in the
+worst, and so grow gently old all down the unchanging days and die one
+day like any other day, only shorter.
+ -- Samuel Beckett, "Malone Dies"
+%
+It is said an Eastern monarch once charged his wise men to invent him a
+sentence to be ever in view, and which should be true and appropriate
+in all times and situations. They presented him the words: "And this,
+too, shall pass away."
+ -- Abraham Lincoln
+%
+It is said that the lonely eagle flies to the mountain peaks while the
+lowly ant crawls the ground, but cannot the soul of the ant soar as
+high as the eagle?
+%
+It is so soon that I am done for, I wonder what I was begun for.
+ -- Epitaph, Cheltenham Churchyard
+%
+It is so stupid of modern civilization to have given up believing in the
+devil when he is the only explanation of it.
+ -- Ronald Knox, "Let Dons Delight"
+%
+It is so very hard to be an on-your-own-take-care-of-
+yourself-because-there-is-no-one-else-to-do-it-for-you grown up.
+%
+It is something to be able to paint a particular picture, or to carve a
+statue, and so to make a few objects beautiful; but it is far more glorious
+to carve and paint the very atmosphere and medium through which we look,
+which morally we can do. To affect the quality of the day, that is the
+highest of arts. Every man is tasked to make his life, even in its details,
+worthy of the contemplation of his most elevated and critical hour.
+ -- Henry David Thoreau, "Where I Live"
+%
+It is sweet to let the mind unbend on occasion.
+ -- Quintus Horatius Flaccus (Horace)
+%
+It is Texas law that when two trains meet each other at a railroad
+crossing, each shall come to a full stop, and neither shall proceed
+until the other has gone.
+%
+It is the business of little minds to shrink.
+ -- Carl Sandburg
+%
+It is the business of the future to be dangerous.
+ -- Hawkwind
+%
+It is the nature of extreme self-lovers, as they will
+set a house on fire, and it were but to roast their eggs.
+ -- Francis Bacon
+%
+It is the quality rather than the quantity that matters.
+ -- Lucius Annaeus Seneca
+%
+It is the wisdom of crocodiles, that shed tears when they would devour.
+ -- Francis Bacon
+%
+It is the wise bird who builds his nest in a tree.
+%
+It is through symbols that man consciously or unconsciously
+lives, works and has his being.
+ -- Thomas Carlyle
+%
+It is true that if your paperboy throws your paper into the bushes for five
+straight days it can be explained by Newton's Law of Gravity. But it takes
+Murphy's law to explain why it is happening to you.
+%
+It is up to us to produce better-quality movies.
+ -- Lloyd Kaufman,
+ producer of "Stuff Stephanie in the Incinerator"
+%
+It is very vulgar to talk like a dentist when one isn't a dentist.
+It produces a false impression.
+ -- Oscar Wilde
+%
+It is when I struggle to be brief that I become obscure.
+ -- Quintus Horatius Flaccus (Horace)
+%
+It is wise to keep in mind that neither success nor failure is ever final.
+ -- Roger Babson
+%
+It is your concern when your neighbor's wall is on fire.
+ -- Quintus Horatius Flaccus (Horace)
+%
+It isn't easy being a Friday kind of person in a Monday kind of world.
+%
+It isn't easy being green.
+ -- Kermit the Frog
+%
+It isn't easy being the parent of a six-year-old. However, it's a pretty
+small price to pay for having somebody around the house who understands
+computers.
+%
+It isn't necessary to have relatives in Kansas City in order to be
+unhappy.
+ -- Groucho Marx
+%
+It isn't whether you win or lose, it's how much money you end up with.
+ -- Jack T. Shakespeare
+%
+It just doesn't seem right to go over the river and through the woods
+to Grandmother's condo.
+%
+It looked like something resembling white marble, which was
+probably what it was: something resembling white marble.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+It looks like blind screaming hedonism won out.
+%
+It looks like it's up to me to save our skins.
+Get into that garbage chute, flyboy!
+ -- Princess Leia Organa
+%
+IT MAKES ME MAD when I go to all the trouble of having Marta cook up about
+a hundred drumsticks, then the guy at Marineland says, "You can't throw
+that chicken to the dolphins. They eat fish."
+
+Sure they eat fish if that's all you give them! Man, wise up.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+It [marriage] happens as with cages: the birds without despair
+to get in, and those within despair of getting out.
+ -- Michel Eyquem de Montaigne
+%
+It matters not whether you win or lose; what matters is whether *I* win
+or lose.
+ -- Darrin Weinberg
+%
+It may be bad manners to talk with your mouth full, but it isn't too
+good either if you speak when your head is empty.
+%
+It may be better to be a live jackal than a dead lion, but it is
+better still to be a live lion. And usually easier.
+ -- Lazarus Long
+%
+It may be that your whole purpose in life
+is simply to serve as a warning to others.
+%
+It may or may not be worthwhile, but it still has to be done.
+%
+It must be remembered that there is nothing more difficult to plan, more
+doubtful of success, nor more dangerous to manage, than the creation of
+a new system. For the initiator has the enmity of all who would profit
+by the preservation of the old institutions and merely lukewarm defenders
+in those who would gain by the new ones.
+ -- Niccolo Machiavelli, 1513
+%
+It must have been some unmarried fool that said "A child can ask questions
+that a wise man cannot answer"; because, in any decent house, a brat that
+starts asking questions is promptly packed off to bed.
+ -- Arthur Binstead
+%
+It now costs more to amuse a child than it once did to educate his father.
+%
+It occurred to me lately that nothing has occurred to me lately.
+%
+It pays in England to be a revolutionary and a bible-smacker most of
+one's life and then come round.
+ -- Lord Alfred Douglas
+%
+It pays to be obvious, especially if you have a reputation for subtlety.
+%
+It proves what they say, give the public what they want to see and
+they'll come out for it.
+ -- Red Skelton, surveying the funeral of Hollywood
+ mogul Harry Cohn
+%
+It runs like _x, where _x is something unsavory.
+ -- Prof. Romas Aleliunas, CS 435
+%
+It seemed the world was divided into good and bad people. The good ones
+slept better... while the bad ones seemed to enjoy the waking hours much
+more.
+ -- Woody Allen, "Side Effects"
+%
+It seems a little silly now, but this country
+was founded as a protest against taxation.
+%
+It seems appropriate to me that Mapplethorpe's perverse images should
+be situated so close to Congress, which perpetuates a number of
+unnatural acts upon the body politic every day, without benefit of
+artificial lubrication or foreplay.
+ -- Pat Calafia's review of Camille Paglia's
+ "Sex, Art and American Culture"
+%
+It seems intuitively obvious to me, which means that it might be wrong.
+ -- Chris Torek
+%
+It seems like the less a statesman amounts to, the more he loves the
+flag.
+%
+It seems that more and more mathematicians are using a new, high level
+language named "research student".
+%
+It seems to make an auto driver mad if he misses you.
+%
+It seems to me that nearly every woman I know wants a man who knows how
+to love with authority. Women are simple souls who like simple things,
+and one of the simplest is one of the simplest to give. ... Our family
+airedale will come clear across the yard for one pat on the head. The
+average wife is like that.
+ -- Episcopal Bishop James Pike
+%
+It shall be unlawful for any suspicious person to be within the
+municipality.
+ -- Local ordinance, Euclid Ohio
+%
+It so happens that everything that is stupid is not unconstitutional.
+ -- Supreme Court Justice Antonio Scalia
+%
+It takes a smart husband to have the last word and not use it.
+%
+It takes a special kind of courage to face what we all have to face.
+%
+It takes all kinds to fill the freeways.
+ -- Crazy Charlie
+%
+It takes both a weapon, and two people, to commit a murder.
+%
+It takes less time to do a thing right
+than it does to explain why you did it wrong.
+ -- H. W. Longfellow
+%
+It takes two to tell the truth: one to speak and one to hear.
+%
+It took a while to surface, but it appears that a long-distance credit card
+may have saved a U.S. Army unit from heavy casualties during the Grenada
+military rescue/invasion. Major General David Nichols, Air Force ... said
+the Army unit was in a house surrounded by Cuban forces. One soldier found
+a telephone and, using his credit card, called Ft. Bragg, N.C., telling Army
+officers there of the perilous situation. The officers in turn called the
+Air Force, which sent in gunships to scatter the Cubans and relieve the unit.
+ -- Aviation Week and Space Technology
+%
+It took me fifteen years to discover that I had no talent for writing,
+but I couldn't give it up because by that time I was too famous.
+ -- Robert Benchley
+%
+It turned out that the worm exploited three or four different holes in the
+system. From this, and the fact that we were able to capture and examine
+some of the source code, we realized that we were dealing with someone very
+sharp, probably not someone here on campus.
+ -- Dr. Richard LeBlanc, associate professor of ICS, in
+ Georgia Tech's campus newspaper after the Internet worm.
+%
+It used to be the fun was in
+The capture and kill.
+In another place and time
+I did it all for thrills.
+ -- Lust to Love
+%
+It usually takes more than three weeks to prepare a good impromptu speech.
+ -- Mark Twain
+%
+It was a book to kill time for those who liked it better dead.
+%
+It was a brave man that ate the first oyster.
+%
+It was a fine, sweet night, the nicest since my divorce, maybe the nicest
+since the middle of my marriage. There was energy, softness, grace and
+laughter. I even took my socks off. In my circle, that means class.
+ -- Andrew Bergman "The Big Kiss-off of 1944"
+%
+It was a Roman who said it was sweet to die for one's country. The Greeks
+never said it was sweet to die for anything. They had no vital lies.
+ -- Edith Hamilton, "The Greek Way"
+%
+It was a virgin forest, a place where the Hand of Man had never set
+foot.
+%
+It was all so different before everything changed.
+%
+It was kinda like stuffing the wrong card in a computer,
+when you're stickin' those artificial stimulants in your arm.
+ -- Dion, noted computer scientist
+%
+It was one of those perfect summer days -- the sun was shining, a breeze
+was blowing, the birds were singing, and the lawn mower was broken ...
+ -- James Dent
+%
+It was one time too many
+One word too few
+It was all too much for me and you
+There was one way to go
+Nothing more we could do
+One time too many
+One word too few
+ -- Meredith Tanner
+%
+It was Penguin lust... at its ugliest.
+%
+It was pity stayed his hand. "Pity I don't have any more bullets,"
+thought Frito.
+ -- Harvard Lampoon, "Bored of the Rings"
+%
+It was pleasant to me to get a letter from you the other day. Perhaps
+I should have found it pleasanter if I had been able to decipher it. I
+don't think that I mastered anything beyond the date (which I knew) and
+the signature (which I guessed at). There's a singular and a perpetual
+charm in a letter of yours; it never grows old, it never loses its
+novelty. Other letters are read and thrown away and forgotten, but
+yours are kept forever -- unread. One of them will last a reasonable
+man a lifetime.
+ -- Thomas Aldrich
+%
+It was raining heavily, and the motorist had car trouble on a lonely country
+road. Anxious to find shelter for the night, he walked over to a farmhouse
+and knocked on the front door. No one responded. He could feel the water
+from the roof running down the back of his neck as he stood on the stoop.
+The next time he knocked louder, but still no answer. By now he was soaked
+to the skin. Desperately he pounded on the door. At last the head of a
+man appeared out of an upstairs window.
+ "What do you want?" he asked gruffly.
+ "My car broke down," said the traveler, "and I want to know if you
+would let me stay here for the night."
+ "Sure," replied the man. "If you want to stay there all night, it's
+okay with me."
+%
+It was the Law of the Sea, they said. Civilization ends at the waterline.
+Beyond that, we all enter the food chain, and not always right at the top.
+ -- Hunter S. Thompson
+%
+It was wonderful to find America, but it
+would have been more wonderful to miss it.
+ -- Mark Twain
+%
+It wasn't exactly a divorce -- I was traded.
+ -- Tim Conway
+%
+It wasn't that she had a rose in her teeth, exactly.
+It was more like the rose and the teeth were in the same glass.
+%
+It will be advantageous to cross the great stream ... the Dragon is on
+the wing in the Sky ... the Great Man rouses himself to his Work.
+%
+It will be generally found that those who sneer habitually at human
+nature and affect to despise it, are among its worst and least pleasant
+examples.
+ -- Charles Dickens
+%
+It would be nice if the Food and Drug Administration stopped issuing
+warnings about toxic substances and just gave me the names of one or
+two things still safe to eat.
+ -- Robert Fuoss
+%
+It would be nice to be sure of anything
+the way some people are of everything.
+%
+It would save me a lot of time if you just gave up and went mad now.
+%
+Italic, adj.:
+ Slanted to the right to emphasize key phrases. Unique to
+ Western alphabets; in Eastern languages, the same phrases
+ are often slanted to the left.
+%
+It'll be a nice world if they ever get it finished.
+%
+It'll be just like Beggars Canyon back home.
+ -- Luke Skywalker
+%
+It's a .88 magnum -- it goes through schools.
+ -- Danny Vermin
+%
+It's a brave man who, when things are at their darkest, can kick back
+and party!
+ -- Dennis Quaid, "Inner Space"
+%
+It's a damn poor mind that can only think of one way to spell a word.
+ -- Andrew Jackson
+%
+It's a dog-eat-dog world out there, and I'm wearing Milkbone underwear.
+ -- Cheers
+%
+It's a good thing we don't get all the government we pay for.
+%
+It's a naive, domestic operating system without any
+breeding, but I think you'll be amused by its presumption.
+%
+It's a poor workman who blames his tools.
+%
+It's a recession when your neighbor loses his job; it's a depression
+when you lose yours.
+ -- Harry S. Truman
+%
+It's a small world, but I wouldn't want to have to paint it.
+ -- Steven Wright
+%
+It's a very *_U_N*lucky week in which to be took dead.
+ -- Churchy La Femme
+%
+It's all in the mind, ya know.
+%
+It's all right letting yourself go as long as you can let yourself back.
+ -- Mick Jagger
+%
+It's all so painfully empty and lonesome... I don't think I can stand
+any more of it... the whole dreadful way we are born, die, and are
+never missed. The fact there is *nobody*... nobody really... We come
+out of a yawning tomb of flesh and sink back finally into another tomb.
+What is the point of it all? Who thought up this sickening circle of
+flesh and blood? We come into the world bleeding and cut and our bones
+half-crushed only to emerge and suffer more torment, mutilation, and
+then at the last lie down in some hole in the ground forever. Who could
+have thought it up, I wonder?
+ -- James Purdy
+%
+It's always a long day; 86400 doesn't fit into a short.
+%
+It's always darkest just before it gets pitch black.
+%
+It's amazing how many people you could be friends
+with if only they'd make the first approach.
+%
+It's amazing how much better you feel once you've given up hope.
+%
+It's amazing how much "mature wisdom" resembles being too tired.
+%
+It's amazing how nice people are to you when they know you're going away.
+ -- Michael Arlen
+%
+It's bad enough that life is a rat-race,
+but why do the rats always have to win?
+%
+It's better to be quotable than to be honest.
+ -- Tom Stoppard
+%
+It's better to be wanted for murder than not to be wanted at all.
+ -- Marty Winch
+%
+It's better to burn out than to fade away.
+%
+It's business doing pleasure with you.
+%
+It's clever, but is it art?
+%
+It's difficult to see the picture when you are inside the frame.
+%
+"It's easier said than done."
+
+... and if you don't believe it, try proving that it's easier done than
+said, and you'll see that "it's easier said that `it's easier done than
+said' than it is done", which really proves that "it's easier said than
+done".
+%
+It's easier to be a liberal a long way from home.
+ -- Don Price
+%
+It's easier to get forgiveness for being
+wrong than forgiveness for being right.
+%
+It's easier to take it apart than to put it back together.
+ -- Washlesky
+%
+It's easy to forgive someone for being wrong;
+it's much harder to forgive them for being right.
+%
+It's easy to make a friend. What's hard is to make a stranger.
+%
+It's fabulous! We haven't seen anything like it in the last half an hour!
+ -- Macy's
+%
+Its failings notwithstanding, there is much to be said in favor of journalism
+in that by giving us the opinion of the uneducated, it keeps us in touch with
+the ignorance of the community.
+ -- Oscar Wilde
+%
+It's faster horses,
+Younger women,
+Older whiskey and
+More money.
+ -- Tom T. Hall, "The Secret of Life"
+%
+It's from Casablanca. I've been waiting all my life to use that line.
+ -- Woody Allen, "Play It Again, Sam"
+%
+It's getting uncommonly easy to kill people in large numbers, and the
+first thing a principle does -- if it really is a principle -- is to
+kill somebody.
+ -- Dorothy Sayers
+%
+It's gonna be alright,
+It's almost midnight,
+And I've got two more bottles of wine.
+%
+It's hard not to like a man of many qualities,
+even if most of them are bad.
+%
+It's hard to argue that God hated Oklahoma.
+If He didn't, why is it so close to Texas?
+%
+It's hard to be humble when you're perfect.
+%
+It's hard to drive at the limit, but
+it's harder to know where the limits are.
+ -- Stirling Moss
+%
+It's hard to get ivory in Africa, but in Alabama the Tuscaloosa.
+ -- Groucho Marx
+%
+It's hard to keep your shirt on when
+you're getting something off your chest.
+%
+It's hard to outrun dead people because they don't have to breathe.
+ -- Hokey, describing "Night of the Living Dead"
+%
+It's hard to think of you as the end
+result of millions of years of evolution.
+%
+It's illegal in Wilbur, Washington, to ride an ugly horse.
+%
+It's important that people know what you stand for.
+It's more important that they know what you won't stand for.
+%
+It's interesting to think that many quite
+distinguished people have bodies similar to yours.
+%
+It's is not, it isn't ain't, and it's it's, not its, if you mean it is.
+If you don't, it's its. Then too, it's hers. It isn't her's. It isn't
+our's either. It's ours, and likewise yours and theirs.
+ -- Oxford University Press, "Edpress News"
+%
+It's just a jump to the left
+ And then a step to the right.
+Put your hands on your hips
+ You bring your knees in tight.
+But it's the pelvic thrust
+ That really drives you insa-a-a-a-a-ane!
+
+ LET'S DO THE TIME WARP AGAIN!
+
+ -- Rocky Horror Picture Show
+%
+It's just apartment house rules,
+So all you 'partment house fools
+Remember: one man's ceiling is another man's floor.
+One man's ceiling is another man's floor.
+ -- Paul Simon, "One Man's Ceiling Is Another Man's Floor"
+%
+It's kind of fun to do the impossible.
+ -- Walt Disney
+%
+It's later than you think.
+%
+It's later than you think, the joint
+Russian-American space mission has already begun.
+%
+It's like deja vu all over again.
+ -- Yogi Berra
+%
+It's Like This
+
+Even the samurai
+have teddy bears,
+and even the teddy bears
+get drunk.
+%
+It's lucky you're going so slowly, because
+you're going in the wrong direction.
+%
+It's more than magnificent -- it's mediocre.
+ -- Sam Goldwyn
+%
+It's multiple choice time...
+
+ What is FORTRAN?
+
+ a: Between thre and fiv tran.
+ b: What two computers engage in before they interface.
+ c: Ridiculous.
+%
+Its name is Public Opinion. It is held in reverence.
+It settles everything. Some think it is the voice of God.
+ -- Mark Twain
+%
+It's never too late to have a happy childhood.
+%
+It's no longer a question of staying healthy. It's a question of finding
+a sickness you like.
+ -- Jackie Mason
+%
+It's no surprise that things are so screwed up: everyone that knows how
+to run a government is either driving taxicabs or cutting hair.
+ -- George Burns
+%
+It's no use crying over spilt milk -- it only makes it salty for the cat.
+%
+It's not against any religion to want to dispose of a pigeon.
+ -- Tom Lehrer
+%
+It's not an optical illusion, it just looks like one.
+ -- Phil White
+%
+It's not Camelot, but it's not Cleveland, either.
+ -- Kevin White, Mayor of Boston
+%
+It's not easy being green.
+ -- Kermit
+%
+It's not enough to be Hungarian; you must have talent too.
+ -- Alexander Korda
+%
+It's not hard to admit errors that are [only] cosmetically wrong.
+ -- J. K. Galbraith
+%
+It's not just a computer -- it's your ass.
+ -- Cal Keegan
+%
+It's not reality or how you perceive things that's important -- it's
+what you're taking for it...
+%
+It's not reality that's important, but how you perceive things.
+%
+It's not so hard to lift yourself by your bootstraps once you're off
+the ground.
+ -- Daniel B. Luten
+%
+It's not that I'm afraid to die.
+I just don't want to be there when it happens.
+ -- Woody Allen
+%
+It's not the fall that kills you, it's the landing.
+%
+It's not the men in my life, but the life in my men that counts.
+ -- Mae West
+%
+It's not the valleys in life I dread so much as the dips.
+ -- Garfield
+%
+It's not whether you win or lose but how you played the game.
+ -- Grantland Rice
+%
+It's not whether you win or lose, it's how you look playing the game.
+%
+It's not whether you win or lose, it's how you place the blame.
+%
+It's odd, and a little unsettling, to reflect upon the fact that English is
+the only major language in which "I" is capitalized; in many other languages
+"You" is capitalized and the "i" is lower case.
+ -- Sydney J. Harris
+%
+It's only by NOT taking the human race seriously that I retain
+what fragments of my once considerable mental powers I still possess.
+ -- Roger Noe
+%
+It's our fault. We should have given him better parts.
+ -- Jack Warner, on hearing that Reagan had been
+ elected governor of California.
+
+[Warner is also reported to have said, when told of Reagan's candidacy
+for governor, "No, Jimmy Stewart for Governor; Reagan for best friend."]
+%
+It's possible that the whole purpose of your life is to serve
+as a warning to others.
+%
+It's pretty hard to tell what does bring happiness;
+poverty and wealth have both failed.
+ -- Kin Hubbard
+%
+It's raisins that make Post Raisin Bran so raisiny ...
+%
+It's really quite a simple choice: Life, Death, or Los Angeles.
+%
+It's reassuring to know that if you behave strangely enough,
+society will take full responsibility for you.
+%
+It's recently come to Fortune's attention that scientists have stopped
+using laboratory rats in favor of attorneys. Seems that there are not
+only more of them, but you don't get so emotionally attached. The only
+difficulty is that it's sometimes difficult to apply the experimental
+results to humans.
+
+ [Also, there are some things even a rat won't do. Ed.]
+%
+It's so beautifully arranged on the plate -- you know someone's fingers
+have been all over it.
+ -- Julia Child on nouvelle cuisine
+%
+It's so confusing choosing sides in the heat of the moment,
+ just to see if it's real,
+Oooh, it's so erotic having you tell me how it should feel,
+But I'm avoiding all the hard cold facts that I got to face,
+So ask me just one question when this magic night is through,
+Could it have been just anyone or did it have to be you?
+ -- Billy Joel, "Glass Houses"
+%
+It's sweet to be remembered, but it's often cheaper to be forgotten.
+%
+It's ten o'clock; do you know where your processes are?
+%
+It's the good girls who keep the diaries, the bad girls never have the time.
+ -- Tallulah Bankhead
+%
+It's the opinion of some that crops could be grown on the moon. Which raises
+the fear that it may not be long before we're paying somebody not to.
+ -- Franklin P. Jones
+%
+It's the same old story; boy meets beer, boy drinks beer...
+boy gets another beer.
+ -- Cheers
+%
+It's the thought, if any, that counts!
+%
+It's useless to try to hold some people to anything they say while they're
+madly in love, drunk, or running for office.
+%
+It's very glamorous to raise millions of dollars, until it's time for the
+venture capitalist to suck your eyeballs out.
+ -- Peter Kennedy, chairman of Kraft & Kennedy
+%
+It's very inconvenient to be mortal -- you never
+know when everything may suddenly stop happening.
+%
+IV. The time required for an object to fall twenty stories is greater than or
+ equal to the time it takes for whoever knocked it off the ledge to
+ spiral down twenty flights to attempt to capture it unbroken.
+ Such an object is inevitably priceless, the attempt to capture it
+ inevitably unsuccessful.
+ V. All principles of gravity are negated by fear.
+ Psychic forces are sufficient in most bodies for a shock to propel
+ them directly away from the earth's surface. A spooky noise or an
+ adversary's signature sound will induce motion upward, usually to
+ the cradle of a chandelier, a treetop, or the crest of a flagpole.
+ The feet of a character who is running or the wheels of a speeding
+ auto need never touch the ground, especially when in flight.
+VI. As speed increases, objects can be in several places at once.
+ This is particularly true of tooth-and-claw fights, in which a
+ character's head may be glimpsed emerging from the cloud of
+ altercation at several places simultaneously. This effect is common
+ as well among bodies that are spinning or being throttled. A "wacky"
+ character has the option of self-replication only at manic high
+ speeds and may ricochet off walls to achieve the velocity required.
+ -- Esquire, "O'Donnell's Laws of Cartoon Motion", June 1980
+%
+I've already told you more than I know.
+%
+I've always considered statesmen to be more expendable than soldiers.
+%
+I've always felt sorry for people that don't drink -- remember,
+when they wake up, that's as good as they're gonna feel all day!
+%
+I've always made it a solemn practice to never
+drink anything stronger than tequila before breakfast.
+ -- R. Nesson
+%
+I've been in more laps than a napkin.
+ -- Mae West
+%
+I've Been Moved!
+%
+I've been on a diet for two weeks and all I've lost is two weeks.
+ -- Totie Fields
+%
+I've been on this lonely road so long,
+Does anybody know where it goes,
+I remember last time the signs pointed home,
+A month ago.
+ -- Carpenters, "Road Ode"
+%
+I've been there.
+%
+I've built a better model than the one at Data General
+For data bases vegetable, animal, and mineral
+My OS handles CPUs with multiplexed duality;
+My PL/1 compiler shows impressive functionality.
+My storage system's better than magnetic core polarity,
+You never have to bother checking out a bit for parity;
+There isn't any reason to install non-static floor matting;
+My disk drive has capacity for variable formatting.
+
+I feel compelled to mention what I know to be a gloating point:
+There's lots of room in memory for variables floating-point,
+Which shows for input vegetable, animal, and mineral
+I've built a better model than the one at Data General.
+
+ -- Steve Levine, "A Computer Song" (To the tune of
+ "Modern Major General", from "Pirates of Penzance",
+ by Gilbert & Sullivan)
+%
+I've enjoyed just about as much of this as I can stand.
+%
+I've finally learned what "upward compatible" means.
+It means we get to keep all our old mistakes.
+ -- Dennie van Tassel
+%
+I've found my niche. If you're wondering why I'm not there, there was
+this little hole in the bottom ...
+ -- John Croll
+%
+I've given up reading books; I find it takes my mind off myself.
+%
+I've got a very bad feeling about this.
+ -- Han Solo
+%
+I've got all the money I'll ever need if I die by 4 o'clock.
+ -- Henny Youngman
+%
+I've had a perfectly wonderful evening. But this wasn't it.
+ -- Groucho Marx
+%
+I've known him as a man, as an adolescent and as a child -- sometimes
+on the same day.
+%
+I've looked at the listing, and it's right!
+ -- Joel Halpern
+%
+I've never been canoeing before, but I imagine there must
+be just a few simple heuristics you have to remember...
+
+Yes, don't fall out, and don't hit rocks.
+%
+I've never been drunk, but often I've been overserved.
+ -- George Gobel
+%
+I've never been hurt by anything I didn't say.
+ -- Calvin Coolidge
+%
+I've never had a problem with drugs; I've had problems with the police.
+ -- Keith Richards
+
+I never turn blue in anyone's bathroom. I think that's the height of
+bad taste.
+ -- Keith Richards
+%
+I've never struck a woman in my life, not even my own mother.
+ -- W. C. Fields
+%
+I've noticed several design suggestions in your code.
+%
+I've only got 12 cards.
+%
+I've seen, I SAY, I've seen better heads on a mug of beer.
+ -- Senator Claghorn
+%
+I've spent almost all of my life with highly intelligent men. They're not
+like other men. Their spirit is great and stimulating. They hate strife;
+indeed they reject it. Their inventive gifts are boundless. They demand
+devotion and obedience. And a sense of humor. I happily gave all of this.
+I was lucky to be chosen and clever enough to understand them.
+ -- Marlene Dietrich, on her friendship with Ernest Hemingway
+%
+I've touch'd the highest point of all my greatness;
+And from that full meridian of my glory
+I haste now to my setting. I shall fall,
+Like a bright exhalation in the evening
+And no man see me more.
+ -- William Shakespeare
+%
+I've tried several varieties of sex. The conventional position makes
+me claustrophobic, and the others either give me a stiff neck or lockjaw.
+ -- Tallulah Bankhead
+%
+Jacquin's Postulate on Democratic Government:
+ No man's life, liberty, or property are safe while the
+ legislature is in session.
+%
+jake hates
+ all the girls(the
+shy ones, the bold paul scorns all
+ones; the meek the girls(the
+proud sloppy sleek) bright ones, the dim
+all except the cold ones; the slim
+ ones plump tiny tall)
+ all except the
+ dull ones
+gus loves all the
+ girls(the
+warped ones, the lamed mike likes all the girls
+ones; the mad (the
+moronic maimed) fat ones, the lean
+all except ones; the mean
+ the dead ones kind dirty clean)
+ all
+ except the green ones
+ -- e. e. cummings
+%
+James Joyce -- an essentially private man who wished his total
+indifference to public notice to be universally recognized.
+ -- Tom Stoppard
+%
+James McNeill Whistler's (painter of "Whistler's Mother") failure in his
+West Point chemistry examination once provoked him to remark in later life,
+"If silicon had been a gas, I should have been a major general."
+%
+Jane and I got mixed up with a television show -- or as we call it back
+east here: TV -- a clever contraction derived from the words Terrible
+Vaudeville. However, it is our latest medium -- we call it a medium
+because nothing's well done. It was discovered, I suppose you've heard,
+by a man named Fulton Berle, and it has already revolutionized social
+grace by cutting down parlour conversation to two sentences: "What's on
+television?" and "Good night".
+ -- Goodman Ace, letter to Groucho Marx, in The Groucho
+ Letters, 1967
+%
+Japan, n.:
+ A fictional place where elves, gnomes and economic imperialists
+ create electronic equipment and computers using black magic. It
+ is said that in the capital city of Akihabara, the streets are
+ paved with gold and semiconductor chips grow on low bushes from
+ which they are harvested by the happy natives.
+%
+Jealousy is all the fun you think they have.
+%
+Jenkinson's Law:
+ It won't work.
+%
+Jim, it's Grace at the bank. I checked your Christmas Club account.
+You don't have five-hundred dollars. You have fifty. Sorry, computer foul-up!
+%
+Jim, it's Jack. I'm at the airport. I'm going to Tokyo and wanna pay
+you the five-hundred I owe you. Catch you next year when I get back!
+%
+Jim Nasium's Law:
+ In a large locker room with hundreds of lockers, the few people
+ using the facility at any one time will all have lockers next to
+ each other so that everybody is cramped.
+%
+Jim, this is Janelle. I'm flying tonight, so I can't make our date, and
+I gotta find a safe place for Daffy. He loves you, Jim! It's only two
+days, and you'll see. Great Danes are no problem!
+%
+Jim, this is Matty down at Ralph's and Mark's. Some guy named Angel
+Martin just ran up a fifty buck bar tab. And now he wants to charge it
+to you. You gonna pay it?
+%
+JOB INTERVIEW:
+ The excruciating process during which personnel officers
+ separate the wheat from the chaff -- then hire the chaff.
+%
+Job Placement, n.:
+ Telling your boss what he can do with your job.
+%
+Joe Cool always spends the first two weeks at college sailing his Frisbee.
+ -- Snoopy
+%
+Joe sat as his dying wife's bedside.
+Her voice was little more than a whisper.
+ "Joe, darling," she breathed, "I've got a confession to make
+before I go. I ... I'm the one who took the $10,000 from your safe...
+I spent it on a fling with your best friend, Charles. And it was I who
+forced your mistress to leave the city. And I am the one who reported
+your income-tax evasion to the I.R.S..."
+ "That's all right, dearest, don't give it a second thought,"
+whispered Joe. "I'm the one who poisoned you."
+%
+Joe's sister puts spaghetti in her shoes!
+%
+Jogger, n.:
+ An odd sort of person with a thing for pain.
+%
+John Dame May Oscar
+Was Gay Was Whitty Was Wilde
+But Gerard Hopkins But John Greenleaf But Thornton
+Was Manley Was Whittier Was Wilder
+ -- Willard Espy
+%
+JOHN PAUL ELECTED POPE!!
+
+(George and Ringo miffed.)
+%
+John the Baptist after poisoning a thief,
+Looks up at his hero, the Commander-in-Chief,
+Saying tell me great leader, but please make it brief
+Is there a hole for me to get sick in?
+The Commander-in-Chief answers him while chasing a fly,
+Saying death to all those who would whimper and cry.
+And dropping a barbell he points to the sky,
+Saying the sun is not yellow, it's chicken.
+ -- Bob Dylan, "Tombstone Blues"
+%
+Johnny Carson's Definition:
+ The smallest interval of time known to man is that which occurs
+ in Manhattan between the traffic signal turning green and the
+ taxi driver behind you blowing his horn.
+%
+Johnson's First Law:
+ When any mechanical contrivance fails, it will do so at the
+ most inconvenient possible time.
+%
+Johnson's law:
+ Systems resemble the organizations that create them.
+%
+Join in the new game that's sweeping the country. It's called "Bureaucracy".
+Everybody stands in a circle. The first person to do anything loses.
+%
+Join the army, see the world, meet interesting,
+exciting people, and kill them.
+%
+Join the march to save individuality!
+%
+Join the Navy; sail to far-off exotic lands,
+meet exciting interesting people, and kill them.
+%
+Jones' First Law:
+ Anyone who makes a significant contribution to any field of
+ endeavor, and stays in that field long enough, becomes an
+ obstruction to its progress -- in direct proportion to the
+ importance of their original contribution.
+%
+Jone's Motto:
+ Friends come and go, but enemies accumulate.
+%
+Jones' Second Law:
+ The man who smiles when things go wrong has thought of someone
+ to blame it on.
+%
+Joshu: What is the true Way?
+Nansen: Every way is the true Way.
+J: Can I study it?
+N: The more you study, the further from the Way.
+J: If I don't study it, how can I know it?
+N: The Way does not belong to things seen: nor to things unseen.
+ It does not belong to things known: nor to things unknown. Do
+ not seek it, study it, or name it. To find yourself on it, open
+ yourself as wide as the sky.
+%
+Journalism is literature in a hurry.
+ -- Matthew Arnold
+%
+Journalism will kill you, but it will keep you alive while you're at it.
+%
+Juall's Law on Nice Guys:
+ Nice guys don't always finish last; sometimes they don't finish.
+ Sometimes they don't even get a chance to start!
+%
+Judges, as a class, display, in the matter of arranging alimony, that
+reckless generosity which is found only in men who are giving away
+someone else's cash.
+ -- P. G. Wodehouse, "Louder and Funnier"
+%
+Just a few of the perfect excuses for having some strawberry shortcake.
+Pick one.
+
+1: It's less calories than two pieces of strawberry shortcake.
+2: It's cheaper than going to France.
+3: It neutralizes the brownies I had yesterday.
+4: Life is short.
+5: It's somebody's birthday. I don't want them to celebrate alone.
+6: It matches my eyes.
+7: Whoever said, "Let them eat cake." must have been talking to me.
+8: To punish myself for eating dessert yesterday.
+9: Compensation for all the time I spend in the shower not eating.
+10: Strawberry shortcake is evil. I must help rid the world of it.
+11: I'm getting weak from eating all that healthy stuff.
+12: It's the second anniversary of the night I ate plain broccoli.
+%
+Just a song before I go, Going through security
+To whom it may concern, I held her for so long.
+Traveling twice the speed of sound She finally looked at me in love,
+It's easy to get burned. And she was gone.
+When the shows were over Just a song before I go,
+We had to get back home, A lesson to be learned.
+And when we opened up the door Traveling twice the speed of sound
+I had to be alone. It's easy to get burned.
+She helped me with my suitcase,
+She stands before my eyes,
+Driving me to the airport
+And to the friendly skies.
+ -- Crosby, Stills, Nash, "Just a Song Before I Go"
+%
+Just about every computer on the market today runs Unix, except the Mac
+(and nobody cares about it).
+ -- Bill Joy 6/21/85
+%
+Just as I cannot remember any time when I could not read and write, I
+cannot remember any time when I did not exercise my imagination in
+daydreams about women.
+ -- George Bernard Shaw
+%
+Just as most issues are seldom black or white, so are most good solutions
+seldom black or white. Beware of the solution that requires one side to be
+totally the loser and the other side to be totally the winner. The reason
+there are two sides to begin with usually is because neither side has all
+the facts. Therefore, when the wise mediator effects a compromise, he is
+not acting from political motivation. Rather, he is acting from a deep
+sense of respect for the whole truth.
+ -- Stephen R. Schwambach
+%
+Just because everything is different doesn't mean anything has changed.
+ -- Irene Peter
+%
+Just because he's dead is no reason to lay off work.
+%
+Just because I turn down a contract on a guy doesn't mean he isn't
+going to get hit.
+ -- Joey
+%
+Just because the message may never be
+received does not mean it is not worth sending.
+%
+Just because they are called "forbidden" transitions does not mean that they
+are forbidden. They are less allowed than allowed transitions, if you see
+what I mean.
+ -- From a Part 2 Quantum Mechanics lecture
+%
+Just because you like my stuff doesn't mean I owe you anything.
+ -- Bob Dylan
+%
+Just because your doctor has a name for your
+condition doesn't mean he knows what it is.
+%
+Just because you're paranoid doesn't mean they AREN'T after you.
+%
+Just close your eyes, tap your heels together three times,
+and think to yourself, "There's no place like home."
+ -- Billie Burke as Glinda, "The Wizard of Oz"
+%
+Just give Alice some pencils and she will stay busy for hours.
+%
+Just go with the flow control, roll with the crunches, and, when you
+get a prompt, type like hell.
+%
+Just how difficult it is to write biography can be reckoned by anybody
+who sits down and considers just how many people know the real truth
+about his or her love affairs.
+ -- Rebecca West
+%
+Just machines to make big decisions,
+Programmed by men for compassion and vision,
+We'll be clean when their work is done,
+We'll be eternally free, yes, eternally young,
+What a beautiful world this will be,
+What a glorious time to be free.
+ -- Donald Fagon, "What A Beautiful World"
+%
+Just once, I wish we would encounter
+an alien menace that wasn't immune to bullets.
+ -- The Brigadier, "Doctor Who"
+%
+Just out of curiosity does this actually mean something or have some
+of the few remaining bits of your brain just evaporated?
+ -- Patricia O Tuama, rissa@killer.DALLAS.TX.US
+%
+Just remember, it all started with a mouse.
+ -- Walt Disney
+%
+Just remember: when you go to court, you are trusting your fate to
+twelve people that weren't smart enough to get out of jury duty!
+%
+`Just the place for a Snark!' the Bellman cried,
+ As he landed his crew with care;
+Supporting each man on the top of the tide
+ By a finger entwined in his hair.
+
+`Just the place for a Snark! I have said it twice:
+ That alone should encourage the crew.
+Just the place for a Snark! I have said it thrice:
+ What I tell you three times is true.'
+ -- Lewis Carroll, "The Hunting of the Snark"
+%
+Just think -- blessed SCSI cables! Do a big enough sacrifice and create
+a +5 blessed SCSI cable of connectivity.
+ -- Lionel Lauer
+%
+Just to have it is enough.
+%
+Just weigh your own hurt against the hurt
+of all the others, and then do what's best.
+ -- Lovers and Other Strangers
+%
+Just what does "it" mean in the sentence, "What time is it?"
+%
+Just when you thought you were winning the rat race, along comes a
+faster rat!!!
+%
+Just yesterday morning, they let me know you were gone,
+Suzanne, the plans they made put an end to you,
+I went out this morning and I wrote down this song,
+Just can't remember who to send it to...
+
+Oh, I've seen fire and I've seen rain,
+I've seen sunny days that I thought would never end,
+I've seen lonely times when I could not find a friend,
+But I always thought that I'd see you again.
+Thought I'd see you one more time again.
+ -- James Taylor, "Fire and Rain"
+%
+Justice always prevails ... three times out of seven!
+ -- Michael J. Wagner
+%
+Justice is incidental to law and order.
+ -- J. Edgar Hoover
+%
+Justice, n.:
+ A decision in your favor.
+%
+K: Cobalt's metal, hard and shining;
+ Cobol's wordy and confining;
+ KOBOLDS topple when you strike them;
+ Don't feel bad, it's hard to like them.
+ -- The Roguelet's ABC
+%
+Kafka's Law:
+ In the fight between you and the world, back the world.
+ -- Franz Kafka, "RS's 1974 Expectation of Days"
+%
+Kamikazes do it once.
+%
+KANSAS:
+ Where the men are men and so are the women!
+%
+Kansas state law requires pedestrians crossing the highways at night to
+wear tail lights.
+%
+Karlson's Theorem of Snack Food Packages:
+
+For all P, where P is a package of snack food, P is a SINGLE-SERVING
+package of snack food.
+
+Gibson the Cat's Corollary:
+
+For all L, where L is a package of lunch meat, L is Gibson's package
+of lunch meat.
+%
+Kath: Can he be present at the birth of his child?
+Ed: It's all any reasonable child can expect if the dad is present
+ at the conception.
+ -- Joe Orton, "Entertaining Mr. Sloane"
+%
+Katz' Law:
+ Men and nations will act rationally when
+ all other possibilities have been exhausted.
+
+History teaches us that men and nations behave wisely once they have
+exhausted all other alternatives.
+ -- Abba Eban
+%
+Kaufman's First Law of Party Physics:
+ Population density is inversely proportional
+ to the square of the distance from the keg.
+%
+Kaufman's Law:
+ A policy is a restrictive document to prevent a recurrence
+ of a single incident, in which that incident is never mentioned.
+%
+Keep a diary and one day it'll keep you.
+ -- Mae West
+%
+Keep America beautiful. Swallow your beer cans.
+%
+Keep ancient lands, your storied pomp! cries she
+With silent lips. Give me your tired, your poor,
+Your huddled masses yearning to breathe free,
+The wretched refuse of your teeming shore.
+Send these, the homeless, tempest-tossed to me...
+ -- Emma Lazarus, "The New Colossus"
+%
+Keep cool, but don't freeze.
+ -- Hellman's Mayonnaise
+%
+Keep emotionally active. Cater to your favorite neurosis.
+%
+Keep grandma off the streets -- legalize bingo.
+%
+Keep in mind always the four constant Laws of Frisbee:
+ 1) The most powerful force in the world is that of a disc
+ straining to land under a car, just out of reach (this
+ force is technically termed "car suck").
+ 2) Never precede any maneuver by a comment more predictive
+ than "Watch this!"
+ 3) The probability of a Frisbee hitting something is directly
+ proportional to the cost of hitting it. For instance, a
+ Frisbee will always head directly towards a policeman or
+ a little old lady rather than the beat up Chevy.
+ 4) Your best throw happens when no one is watching; when the
+ cute girl you've been trying to impress is watching, the
+ Frisbee will invariably bounce out of your hand or hit you
+ in the head and knock you silly.
+%
+Keep it short for pithy sake.
+%
+Keep on keepin' on.
+%
+Keep patting your enemy on the back until a
+small bullet hole appears between your fingers.
+ -- Joe Bonanno
+%
+Keep the number of passes in a compiler to a minimum.
+ -- D. Gries
+%
+Keep the phase, baby.
+%
+Keep up the good work! But please don't ask me to help.
+%
+Keep women you cannot. Marry them and they come to hate the way
+you walk across the room; remain their lover, and they jilt you
+at the end of six months.
+ -- Moore
+%
+Keep your boss's boss off your boss's back.
+%
+Keep your Eye on the Ball,
+Your Shoulder to the Wheel,
+Your Nose to the Grindstone,
+Your Feet on the Ground,
+Your Head on your Shoulders.
+Now... try to get something DONE!
+%
+Keep your eyes wide open before marriage, half shut afterwards.
+ -- Benjamin Franklin
+%
+Keep your laws off my body!
+%
+Keep your mouth shut and people will think you stupid;
+Open it and you remove all doubt.
+%
+Ken Thompson has an automobile which he helped design. Unlike most
+automobiles, it has neither speedometer, nor gas gauge, nor any of the
+numerous idiot lights which plague the modern driver. Rather, if the
+driver makes any mistake, a giant "?" lights up in the center of the
+dashboard. "The experienced driver", he says, "will usually know
+what's wrong."
+%
+Kennedy's Market Theorem:
+ Given enough inside information and unlimited credit,
+ you've got to go broke.
+%
+Kent's Heuristic:
+ Look for it first where you'd most like to find it.
+%
+Kern, v.:
+ 1. To pack type together as tightly as the kernels on an ear
+ of corn. 2. In parts of Brooklyn and Queens, N.Y., a small,
+ metal object used as part of the monetary system.
+%
+KERNEL:
+ A part of an operating system that preserves the medieval
+ traditions of sorcery and black art.
+%
+Kettering's Observation:
+ Logic is an organized way of going wrong with confidence.
+%
+Kids always brighten up a house; mostly by leaving the lights on.
+%
+Kids have *_n_e_v_e_r* taken guidance from their parents. If you could
+travel back in time and observe the original primate family in the
+original tree, you would see the primate parents yelling at the primate
+teenager for sitting around and sulking all day instead of hunting for
+grubs and berries like dad primate. Then you'd see the primate
+teenager stomp up to his branch and slam the leaves.
+ -- Dave Barry, "Kids Today: They Don't Know Dum Diddly Do"
+%
+Kill a commy for your mommy.
+%
+Kill 'em all, and let God sort 'em out.
+%
+Kill for the love of killing! Kill for the love of Kali!
+ -- Hindu saying
+%
+Kill Kill,
+Hate Hate,
+Murder, Maim, and Mutilate!
+%
+Kill your parents.
+ -- Jerry Rubin
+%
+Killing turkeys causes winter.
+%
+Kilroe hic erat!
+%
+Kime's Law for the Reward of Meekness:
+ Turning the other cheek merely ensures two bruised cheeks.
+%
+Kin, n.:
+ An affliction of the blood.
+%
+Kindness is a language which the deaf can hear and the blind can read.
+ -- Mark Twain
+%
+Kindness is the beginning of cruelty.
+ -- Muad'dib, "Dune"
+%
+Kington's Law of Perforation:
+ If a straight line of holes is made in a piece of paper, such
+ as a sheet of stamps or a check, that line becomes the strongest
+ part of the paper.
+%
+Kinkler's First Law:
+ Responsibility always exceeds authority.
+
+Kinkler's Second Law:
+ All the easy problems have been solved.
+%
+Kirk to Enterprise...
+%
+Kirk to Enterprise -- beam down yeoman Rand and a six-pack.
+%
+Kirkland, Illinois, law forbids bees to fly over the village or through
+any of its streets.
+%
+Kiss a non-smoker; taste the difference.
+%
+Kiss me, Kate, we will be married o' Sunday.
+ -- William Shakespeare, "The Taming of the Shrew"
+%
+Kiss me twice. I'm schizophrenic.
+%
+Kiss your keyboard goodbye!
+%
+Kissing a fish is like smoking a bicycle.
+%
+Kissing a smoker is like licking an ashtray.
+%
+Kissing don't last, cookery do.
+ -- George Meredith
+%
+Kissing your hand may make you feel very good, but a diamond and
+sapphire bracelet lasts for ever.
+ -- Anita Loos, "Gentlemen Prefer Blondes"
+%
+Kitchen activity is highlighted.
+Butter up a friend.
+%
+Kites rise highest against the wind -- not with it.
+ -- Winston Churchill
+%
+Klatu barada nikto.
+%
+Kleeneness is next to Godelness.
+%
+Klein bottle for sale -- inquire within.
+%
+Kleptomaniac, n.:
+ A rich thief.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Kliban's First Law of Dining:
+ Never eat anything bigger than your head.
+%
+Klingon phaser attack from front!!!!!
+100% Damage to life support!!!!
+%
+Kludge, n.:
+ An ill-assorted collection of poorly-matching parts, forming a
+ distressing whole.
+ -- Jackson Granholm, "Datamation"
+%
+Knebel's Law:
+ It is now proved beyond doubt that smoking is one of the leading
+ causes of statistics.
+%
+Knights are hardly worth it.
+I mean, all that shell and so little meat...
+%
+Knock, knock!
+ Who's there?
+Sam and Janet.
+ Sam and Janet who?
+Sam and Janet Evening...
+%
+Knock Knock... (who's there?) Ether! (ether who?) Eather Bunny... Yea!
+[chorus]
+ Yeay!
+ Stay on the Happy side, always on the happy side,
+ Stay on the Happy side of life!
+ Bum bum bum bum bum bum
+ You will feel no pain, as we drive you insane,
+ So Stay on the Happy Side of life!
+
+Knock Knock... (who's there?) Anna! (anna who?)
+ An another eather bunny... [chorus]
+Knock Knock... (who's there?) Stilla! (stilla who?)
+ Still another ether bunny... [chorus]
+Knock Knock... (who's there?) Yetta! (yetta who?)
+ Yet another ether bunny... [chorus]
+Knock Knock... (who's there?) Cargo! (cargo who?)
+ Cargo beep beep and run over eather bunny... [chorus]
+Knock Knock... (who's there?) Boo! (boo who?)
+ Don't Cry! Eather bunny be back next year! [chorus]
+%
+Knocked, you weren't in.
+ -- Opportunity
+%
+Know how to save 5 drowning lawyers?
+
+-- No?
+
+GOOD!
+%
+Know Thy User.
+%
+Know thyself. If you need help, call the C.I.A.
+%
+Know what I hate most? Rhetorical questions.
+ -- Henry N. Camp
+%
+KNOWLEDGE:
+ Things you believe.
+%
+Knowledge is power.
+ -- Francis Bacon
+%
+Knowledge is power -- knowledge shared is power lost.
+ -- Aleister Crowley
+%
+Knowledge without common sense is folly.
+%
+Knucklehead: "Knock, knock"
+Pee Wee: "Who's there?"
+Knucklehead: "Little ol' lady."
+Pee Wee: "Liddle ol' lady who?"
+Knucklehead: "I didn't know you could yodel"
+%
+Kramer's Law:
+ You can never tell which way the train went by looking at the tracks.
+%
+Krogt, n. (chemical symbol: Kr):
+ The metallic silver coating found on fast-food game cards.
+ -- Rich Hall, "Sniglets"
+%
+LA:
+ Where the only way to determine that the seasons have changed
+ is to note that people have changed the main topic of conversation.
+ From mud slides to brush fires.
+%
+Labor, n.:
+ One of the processes by which A acquires property for B.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Lack of capability is usually disguised by lack of interest.
+%
+Lack of money is the root of all evil.
+ -- George Bernard Shaw
+%
+Lackland's Laws:
+ 1. Never be first.
+ 2. Never be last.
+ 3. Never volunteer for anything.
+%
+Lactomangulation, n.:
+ Manhandling the "open here" spout on a milk carton so badly
+ that one has to resort to using the "illegal" side.
+ -- Rich Hall, "Sniglets"
+%
+La-dee-dee, la-dee-dah.
+%
+Ladies and Gentlemen, Hobos and Tramps,
+Cross-eyed mosquitos and bowlegged ants,
+I come before you to stand behind you
+To tell you of something I know nothing about.
+Next Thursday (which is good Friday),
+There will be a convention held in the
+Women's Club which is strictly for Men.
+Admission is free, pay at the door,
+Pull up a chair, and sit on the floor.
+It was a summer's day in winter,
+And the snow was raining fast,
+As a barefoot boy with shoes on,
+Stood sitting in the grass.
+Oh, that bright day in the dead of night,
+Two dead men got up to fight.
+Three blind men to see fair play,
+Forty mutes to yell "Hooray"!
+Back to back, they faced each other,
+Drew their swords and shot each other.
+A deaf policeman heard the noise,
+Came and arrested those two dead boys.
+%
+Ladies, here's a hint: If you're playing against a friend who has big
+boobs, bring her to the net and make her hit backhand volleys. That's
+the hardest shot for the well endowed. "I've got to hit over them or
+under them, but I can't hit through," Annie Jones used to always moan
+to me. Not having much in my bra, I found it hard to sympathize with
+her.
+ -- Billie Jean King
+%
+Lady, lady, should you meet
+One whose ways are all discreet,
+One who murmurs that his wife
+Is the lodestar of his life,
+One who keeps assuring you
+That he never was untrue,
+Never loved another one...
+Lady, lady, better run!
+ -- Dorothy Parker, "Social Note"
+%
+Lady Luck brings added income today.
+Lady friend takes it away tonight.
+%
+Lady Nancy Astor:
+ "Winston, if you were my husband, I'd put poison in your coffee."
+Winston Churchill:
+ "Nancy, if you were my wife, I'd drink it."
+
+Lady Astor was giving a costume ball and Winston Churchill asked her what
+disguise she would recommend for him. She replied, "Why don't you come
+sober, Mr. Prime Minister?"
+
+ During a visit to America, Winston Churchill was invited to a buffet
+luncheon at which cold fried chicken was served. Returning for a second
+helping, he asked politely, "May I have some breast?"
+ "Mr. Churchill," replied the hostess, "in this country we ask for
+white meat or dark meat." Churchill apologized profusely.
+ The following morning, the lady received a magnificent orchid from
+her guest of honor. The accompanying card read: "I would be most obliged if
+you would pin this on your white meat."
+%
+Ladybug, ladybug,
+Look to your stern!
+Your house is on fire,
+Your children will burn!
+So jump ye and sing, for
+The very first time
+The four lines above
+Have been put into rhyme.
+ -- Walt Kelly
+%
+Laetrile is the pits.
+%
+Laissez Faire Economics is the theory that if
+each acts like a vulture, all will end as doves.
+%
+Lake Erie died for your sins.
+%
+((lambda (foo) (bar foo)) (baz))
+%
+Lamonte Cranston once hired a new Chinese manservant. While describing his
+duties to the new man, Lamonte pointed to a bowl of candy on the coffee
+table and warned him that he was not to take any. Some days later, the new
+manservant was cleaning up, with no one at home, and decided to sample some
+of the candy. Just than, Cranston walked in, spied the manservant at the
+candy, and said:
+ "Pardon me Choy, is that the Shadow's nugate you chew?"
+%
+Langsam's Laws:
+ (1) Everything depends.
+ (2) Nothing is always.
+ (3) Everything is sometimes.
+%
+Language is a virus from another planet.
+ -- William Burroughs
+%
+Lank: Here we go. We're about to set a new record.
+Earl: (to the crowd) How about a date?
+Lank: We've done it. Earl has set a new record. Turned down by
+ 20,000 women.
+ -- Lank and Earl
+%
+Lansdale seized on the idea of using Nixon to build support for the
+[Vietnamese] elections ... really honest elections, this time. "Oh, sure,
+honest, yes, that's right," Nixon said, "so long as you win!" With that
+he winked, drove his elbow into Lansdale's arm and slapped his own knee.
+ -- Richard M. Nixon, quoted in "Sideshow" by W. Shawcross
+%
+Large increases in cost with questionable increases in
+performance can be tolerated only in race horses and women.
+ -- Lord Kelvin
+%
+Largest Number of Driving Test Failures
+ By April 1970 Mrs. Miriam Hargrave had failed her test thirty-nine
+times. In the eight preceding years she had received two hundred and
+twelve driving lessons at a cost of L300. She set the new record while
+driving triumphantly through a set of red traffic lights in Wakefield,
+Yorkshire. Disappointingly, she passed at the fortieth attempt (3 August
+1970) but eight years later she showed some of her old magic when she was
+reported as saying that she still didn't like doing right-hand turns.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+Larkinson's Law:
+ All laws are basically false.
+%
+LASER:
+ Failed death ray.
+%
+Last guys don't finish nice.
+ -- Stanley Kelley, on the cult of victory at all costs
+%
+Last night I dreamed I ate a ten-pound marshmallow, and when I woke up
+the pillow was gone.
+ -- Tommy Cooper
+%
+Last night I met upon the stair
+A little man who wasn't there.
+He wasn't there again today.
+Gee how I wish he'd go away!
+%
+Last night the power went out. Good thing my camera had a flash....
+The neighbors thought it was lightning in my house, so they called the cops.
+ -- Steven Wright
+%
+Last week a cop stopped me in my car. He asked me if I had a police record.
+I said, no, but I have the new DEVO album. Cops have no sense of humor.
+%
+Last week's pet, this week's special.
+%
+Last year we drove across the country... We switched on the driving...
+every half mile. We had one cassette tape to listen to on the entire trip.
+I don't remember what it was.
+ -- Steven Wright
+%
+Last yeer I kudn't spel Engineer. Now I are won.
+%
+Latin is a language,
+As dead as can be.
+First it killed the Romans,
+And now it's killing me.
+%
+Laugh, and the world ignores you. Crying doesn't help either.
+%
+Laugh and the world laughs with you, snore and you sleep alone.
+%
+Laugh and the world thinks you're an idiot.
+%
+Laugh at your problems: everybody else does.
+%
+Laugh when you can; cry when you must.
+%
+Laughing at you is like drop kicking a wounded humming bird.
+%
+Laughter is the closest distance between two people.
+ -- Victor Borge
+%
+Laura's Law:
+ No child throws up in the bathroom.
+%
+Lavish spending can be disastrous.
+Don't buy any lavishes for a while.
+%
+Law enforcement officers should use only the minimum
+force necessary in dealing with disorders when they arise.
+ -- Richard M. Nixon
+%
+Law of Communications:
+ The inevitable result of improved and enlarged communications
+ between different levels in a hierarchy is a vastly increased
+ area of misunderstanding.
+%
+Law of Continuity:
+ Experiments should be reproducible.
+ They should all fail the same way.
+%
+Law of Probable Dispersal:
+ Whatever it is that hits the fan will not be evenly distributed.
+%
+Law of Selective Gravity:
+ An object will fall so as to do the most damage.
+
+Jenning's Corollary:
+ The chance of the bread falling with the buttered side down is
+ directly proportional to the cost of the carpet.
+%
+Law of the Jungle:
+ He who hesitates is lunch.
+%
+Law of the Yukon:
+ Only the lead dog gets a change of scenery.
+%
+Law stands mute in the midst of arms.
+ -- Marcus Tullius Cicero
+%
+Lawful Dungeon Master -- and they're MY laws!
+%
+Lawrence Radiation Laboratory keeps all its data in an old gray trunk.
+%
+Laws are like sausages. It's better not to see them being made.
+ -- Otto von Bismarck
+%
+Laws of Computer Programming:
+ 1. Any given program, when running, is obsolete.
+ 2. Any given program costs more and takes longer.
+ 3. If a program is useful, it will have to be changed.
+ 4. If a program is useless, it will have to be documented.
+ 5. Any given program will expand to fill all available memory.
+ 6. The value of a program is proportional the weight of its output.
+ 7. Program complexity grows until it exceeds the capability of
+ the programmer who must maintain it.
+%
+Laws of Serendipity:
+
+ (1) In order to discover anything, you must be looking for
+ something.
+ (2) If you wish to make an improved product, you must already
+ be engaged in making an inferior one.
+%
+Lawsuit, n.:
+ A machine which you go into as a pig and come out as a sausage.
+ -- Ambrose Bierce
+%
+Lawyer's Rule:
+ When the law is against you, argue the facts.
+ When the facts are against you, argue the law.
+ When both are against you, call the other lawyer names.
+%
+Lay off the muses, it's a very tough dollar.
+ -- S. J. Perelman
+%
+Lay on, MacDuff, and curs'd be him who first cries, "Hold, enough!".
+ -- William Shakespeare
+%
+Layers are for cakes, not for software.
+ -- Bart Smaalders
+%
+Lays eggs inside a paper bag;
+The reason, you will see, no doubt,
+Is to keep the lightning out.
+But what these unobservant birds
+Have failed to notice is that herds
+Of bears may come with buns
+And steal the bags to hold the crumbs.
+%
+Lazlo's Chinese Relativity Axiom:
+ No matter how great your triumphs or how tragic your defeats --
+ approximately one billion Chinese couldn't care less.
+%
+LAZY:
+ Marrying a pregnant woman.
+%
+Leadership involves finding a parade and getting in front of it; what
+is happening in America is that those parades are getting smaller and
+smaller -- and there are many more of them.
+ -- John Naisbitt, "Megatrends"
+%
+Learn from other people's mistakes, you don't have time to make your own.
+%
+Learn to pause -- or nothing worthwhile can catch up to you.
+%
+Learned men are the cisterns of knowledge, not the fountainheads.
+%
+Learning at some schools is like drinking from a firehose.
+%
+LEARNING CURVE:
+ An astonishing new theory, discovered by management consultants
+ in the 1970's, asserting that the more you do something the
+ quicker you can do it.
+%
+Learning French is trivial: the word for horse is cheval, and
+everything else follows in the same way.
+ -- Alan J. Perlis
+%
+Learning without thought is labor lost;
+thought without learning is perilous.
+ -- Confucius
+%
+Leave no stone unturned.
+ -- Euripides
+%
+Lee's Law:
+ Mother said there would be days like this,
+ but she never said that there'd be so many!
+%
+Left to themselves, things tend to go from bad to worse.
+%
+Legalize free-enterprise murder: why should governments have all the
+fun?
+%
+Legislation proposed in the Illinois State Legislature, May, 1907:
+ "Speed upon county roads will be limited to ten miles an hour
+unless the motorist sees a bailiff who does not appear to have had a
+drink in 30 days, when the driver will be permitted to make what he
+can."
+%
+Leibowitz's Rule:
+ When hammering a nail, you will never hit your
+ finger if you hold the hammer with both hands.
+%
+Lemma: All horses are the same color.
+Proof (by induction):
+ Case n = 1: In a set with only one horse, it is obvious that all
+ horses in that set are the same color.
+ Case n = k: Suppose you have a set of k+1 horses. Pull one of these
+ horses out of the set, so that you have k horses. Suppose that all
+ of these horses are the same color. Now put back the horse that you
+ took out, and pull out a different one. Suppose that all of the k
+ horses now in the set are the same color. Then the set of k+1 horses
+ are all the same color. We have k true => k+1 true; therefore all
+ horses are the same color.
+Theorem: All horses have an infinite number of legs.
+Proof (by intimidation):
+ Everyone would agree that all horses have an even number of legs. It
+ is also well-known that horses have forelegs in front and two legs in
+ back. 4 + 2 = 6 legs, which is certainly an odd number of legs for a
+ horse to have! Now the only number that is both even and odd is
+ infinity; therefore all horses have an infinite number of legs.
+ However, suppose that there is a horse somewhere that does not have an
+ infinite number of legs. Well, that would be a horse of a different
+ color; and by the Lemma, it doesn't exist.
+%
+Lemmings don't grow older, they just die.
+%
+Lend money to a bad debtor and he will hate you.
+%
+Lensmen eat Jedi for breakfast.
+%
+LEO (Jul. 23 to Aug. 22)
+ Your presence, poise, charm and good looks won't even help you today.
+ Look over your shoulder; an ugly person may be following you. Be on
+ your toes. Brush your teeth. Take Geritol.
+%
+LEO (July 23 - Aug 22)
+ You consider yourself a born leader. Others think you are pushy.
+ Most Leo people are bullies. You are vain and dislike honest
+ criticism. Your arrogance is disgusting. Leo people are thieves.
+%
+LEO (July 23 - Aug 22)
+ Your determination and sense of humor will come to the fore. Your
+ ability to laugh at adversity will be a blessing because you've got
+ a day coming you wouldn't believe. As a matter of fact, if you can
+ laugh at what happens to you today, you've got a sick sense of humor.
+%
+Lesbian QOTD:
+I didn't give up sex, I just gave up premature ejaculation.
+%
+Let a fool hold his tongue and he will pass for a sage.
+ -- Publilius Syrus
+%
+Let he who takes the plunge remember to return it by Tuesday.
+%
+Let him choose out of my files, his projects to accomplish.
+ -- William Shakespeare, "Coriolanus"
+%
+Let me assure you that to us here at First National, you're not just a
+number. You're two numbers, a dash, three more numbers, another dash and
+another number.
+ -- James Estes
+%
+Let me not to the marriage of true minds
+Admit impediments. Love is not love
+Which alters when it alteration finds,
+Or bends with the remover to remove.
+O, no! it is an ever-fixed mark,
+That looks on tempests and is never shaken;
+It is the star to every wandering bark,
+Whose worth's unknown, although his height be taken.
+Love's not Time's fool, though rosy lips and cheeks
+Within his bending sickle's compass come;
+Love alters not with his brief hours and weeks,
+But bears it out even to the edge of doom.
+ If this be error and upon me proved,
+ I never writ, nor no man ever loved.
+ -- William Shakespeare, Sonnet CXVI
+%
+Let me put it this way: today is going to be a learning experience.
+%
+Let me take you a button-hole lower.
+ -- William Shakespeare, "Love's Labour's Lost"
+%
+Let me tell you who the actual "front-runners" are. On one side, you have
+George Bush, who is currently going through a sort of fraternity hazing
+wherein he has to perform a series of humiliating stunts to win the approval
+of the Republican Right. For example, they had him make a speech oozing
+praise all over William Loeb, deceased publisher of the Manchester (N.H.)
+Union Leader and Slime Journalist. Loeb had dumped viciously all over George
+in the 1980 New Hampshire primary. But when the Right held a big tribute
+for Loeb, George came back to the fold, like a man with a bungee cord wrapped
+around his neck.
+ -- Dave Barry
+%
+Let my own body be exhausted,
+But not the wealth of my state.
+Let my mortal body vanish,
+But not the power of my state.
+ -- Chinggis (Genghis) Khan
+%
+Let no guilty man escape.
+ -- U. S. Grant
+%
+Let not the sands of time get in your lunch.
+%
+Let others praise ancient times; I am glad I was born in these.
+ -- Ovid (43 B.C. - A.D. 18)
+%
+Let sleeping dogs lie.
+ -- Charles Dickens
+%
+Let the machine do the dirty work.
+ -- Kernighan and Plauger, "The Elements of Programming Style"
+%
+Let the meek inherit the earth -- they have it coming to them.
+ -- James Thurber
+%
+Let the people think they govern and they will be governed.
+ -- William Penn, founder of Pennsylvania
+%
+Let the worthy citizens of Chicago get their liquor the best way
+they can. I'm sick of the job. It's a thankless one and full of grief.
+ -- Al Capone
+%
+Let thy maid servant be faithful, strong, and homely.
+ -- Benjamin Franklin
+%
+Let us go then you and I
+while the night is laid out against the sky
+like a smear of mustard on an old pork pie.
+
+Nice poem Tom. I have ideas for changes though, why not come over?
+ -- Ezra
+%
+Let us go, through certain half-deserted streets,
+The muttering retreats
+Of restless nights in one-night cheap hotels
+And sawdust restaurants with oyster-shells:
+Streets that follow like a tedious argument
+Of insidious intent
+To lead you to an overwhelming question...
+Oh, do not ask, "What is it?"
+ -- T. S. Eliot, "Love song of J. Alfred Prufrock"
+%
+Let us live!!!
+Let us love!!!
+Let us share the deepest secrets of our souls!!!
+
+You first.
+%
+Let us never negotiate out of fear,
+but let us never fear to negotiate.
+ -- John F. Kennedy
+%
+Let us not look back in anger or forward
+in fear, but around us in awareness.
+ -- James Thurber
+%
+Let us remember that ours is a nation of lawyers and order.
+%
+Let us treat men and women well;
+Treat them as if they were real;
+Perhaps they are.
+ -- Ralph Waldo Emerson
+%
+Let your conscience be your guide.
+ -- Pope
+%
+L'etat c'est moi.
+[The state, that's me.]
+ -- Louis XIV
+%
+Let's just be friends and make no special effort to ever see each other again.
+%
+Let's just say that where a change was required, I adjusted. In every
+relationship that exists, people have to seek a way to survive. If you
+really care about the person, you do what's necessary, or that's the end.
+For the first time, I found that I really could change, and the qualities
+I most admired in myself I gave up. I stopped being loud and bossy...
+Oh, all right. I was still loud and bossy, but only behind his back."
+ -- Kate Hepburn, on Tracy and Hepburn
+%
+Let's love each other slowly,
+reaching for a plane,
+of exquisite pleasure,
+and delicate pain.
+ -- Adam Beslove
+%
+Let's not complicate our relationship
+by trying to communicate with each other.
+%
+Let's organize this thing and take all the fun out of it.
+%
+Let's remind ourselves that last year's fresh idea is today's cliche.
+ -- Austen Briggs
+%
+Let's say your wedding ring falls into your toaster, and when you stick your
+hand in to retrieve it, you suffer Pain and Suffering as well as Mental
+Anguish. You would sue:
+
+* The toaster manufacturer, for failure to include, in the instructions
+ section that says you should never never never ever stick you hand
+ into the toaster, the statement "Not even if your wedding ring falls
+ in there".
+
+* The store where you bought the toaster, for selling it to an obvious
+ cretin like yourself.
+
+* Union Carbide Corporation, which is not directly responsible in this
+ case, but which is feeling so guilty that it would probably send you
+ a large cash settlement anyway.
+ -- Dave Barry
+%
+Let's talk about how to fill out your 1984 tax return. Here's an often
+overlooked accounting technique that can save you thousands of
+dollars: For several days before you put it in the mail, carry your
+tax return around under your armpit. No IRS agent is going to want to
+spend hours poring over a sweat-stained document. So even if you owe
+money, you can put in for an enormous refund and the agent will
+probably give it to you, just to avoid an audit. What does he care?
+It's not his money.
+ -- Dave Barry, "Sweating Out Taxes"
+%
+LETTERS TO THE EDITOR (The Times of London)
+
+Dear Sir,
+
+I am firmly opposed to the spread of microchips either to the home or
+to the office. We have more than enough of them foisted upon us in
+public places. They are a disgusting Americanism, and can only result
+in the farmers being forced to grow smaller potatoes, which in turn
+will cause massive unemployment in the already severely depressed
+agricultural industry.
+
+Yours faithfully,
+ Capt. Quinton D'Arcy, J. P.
+ Sevenoaks
+%
+LEVERAGE:
+ Even if someone doesn't care what the world thinks
+ about them, they always hope their mother doesn't find out.
+%
+Leveraging always beats prototyping.
+%
+Lewis's Law of Travel:
+ The first piece of luggage out of the
+ chute doesn't belong to anyone, ever.
+%
+L'hazard ne favorise que l'esprit prepare.
+ -- L. Pasteur
+%
+Liar, n.:
+ A lawyer with a roving commission.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Liar: one who tells an unpleasant truth.
+ -- Oliver Herford
+%
+LIBERAL:
+ Someone too poor to be a capitalist and too rich to be a communist.
+%
+Liberals are the first to dump you if you con them or get into
+trouble. Conservatives are better. They never run out on you.
+ -- Joseph "Crazy Joe" Gallo
+%
+Liberty don't work as good in practice as it does in speeches.
+ -- The Best of Will Rogers
+%
+Liberty is always dangerous, but it is the safest thing we have.
+ -- Harry Emerson Fosdick
+%
+LIBRA (Sep. 23 to Oct. 22)
+ Your desire for justice and truth will be overshadowed by your desire
+ for filthy lucre and a decent meal. Be gracious and polite. Someone
+ is watching you, so stop staring like that.
+%
+LIBRA (Sept 23 - Oct 23)
+ Major achievements, new friends, and a previously unexplored way
+ to make a lot of money will come to a lot of people today, but
+ unfortunately you won't be one of them. Consider not getting out
+ of bed today.
+%
+Lie, n.:
+ A very poor substitute for the truth, but the only one
+ discovered to date.
+%
+Lieberman's Law:
+ Everybody lies, but it doesn't matter since nobody listens.
+%
+Lies! All lies! You're all lying against my boys!
+ -- Ma Barker
+%
+LIFE:
+ A whim of several billion cells to be you for a while.
+%
+LIFE:
+ Learning about people the hard way -- by being one.
+%
+LIFE:
+ That brief interlude between nothingness and eternity.
+%
+Life -- Love It or Leave It.
+%
+Life begins at the centerfold and expands outward.
+ -- Miss November, 1966
+%
+Life being what it is, one dreams of revenge.
+ -- Paul Gauguin
+%
+Life can be so tragic -- you're here today and here tomorrow.
+%
+Life does not begin at the moment of conception or the moment of birth.
+It begins when the kids leave home and the dog dies.
+%
+Life exists for no known purpose.
+%
+Life in this society being, at best, an utter bore and no aspect of society
+being at all relevant to women, there remains to civic-minded responsible
+thrill-seeking females only to overthrow the government, eliminate the money
+system, institute complete automation and destroy the male sex.
+ -- Valerie Solanas
+%
+Life is a biochemical reaction to the stimulus of the surrounding
+environment in a stable ecosphere, while a bowl of cherries is a
+round container filled with little red fruits on sticks.
+%
+Life is a concentration camp. You're stuck here and there's no way
+out and you can only rage impotently against your persecutors.
+ -- Woody Allen
+%
+Life is a gamble at terrible odds, if it was a bet you wouldn't take it.
+ -- Tom Stoppard, "Rosencrantz and Guildenstern are Dead"
+%
+Life is a game. In order to have a game, something has to be more
+important than something else. If what already is, is more important
+than what isn't, the game is over. So, life is a game in which what
+isn't, is more important than what is. Let the good times roll.
+ -- Werner Erhard
+%
+Life is a game of bridge -- and you've just been finessed.
+%
+Life is a glorious cycle of song,
+A medley of extemporania;
+And love is thing that can never go wrong;
+And I am Marie of Roumania.
+ -- Dorothy Parker, "Comment"
+%
+Life is a grand adventure -- or it is nothing.
+ -- Helen Keller
+%
+Life is a healthy respect for mother nature laced with greed.
+%
+Life is a hospital in which every patient is possessed by the desire to
+change his bed.
+ -- Charles Baudelaire
+%
+Life is a series of rude awakenings.
+ -- R. V. Winkle
+%
+Life is a serious burden, which no thinking,
+humane person would wantonly inflict on someone else.
+ -- Clarence Darrow
+%
+Life is a sexually transferred disease with 100% mortality.
+%
+Life is a yo-yo, and mankind ties knots in the string.
+%
+Life is an exciting business, and most
+exciting when it is lived for others.
+%
+Life is both difficult and time consuming.
+%
+Life is cheap, but the accessories can kill you.
+%
+Life is difficult because it is non-linear.
+%
+Life is divided into the horrible and the miserable.
+ -- Woody Allen, "Annie Hall"
+%
+Life is fraught with opportunities to keep your mouth shut.
+%
+Life is just a bowl of cherries, but why do I always get the pits?
+%
+Life is knowing how far to go without crossing the line.
+%
+Life is like a 10 speed bicycle. Most of us have gears we never use.
+ -- C. Schultz
+%
+Life is like a bowl of soup with hairs floating on it. You have to
+eat it nevertheless.
+ -- Flaubert
+%
+Life is like a buffet; it's not good but there's plenty of it.
+%
+Life is like a diaper - short and loaded.
+%
+Life is like a sewer.
+What you get out of it depends on what you put into it.
+ -- Tom Lehrer
+%
+Life is like a simile.
+%
+Life is like a tin of sardines.
+We're, all of us, looking for the key.
+ -- Beyond the Fringe
+%
+Life is like an analogy.
+%
+Life is like an egg stain on your chin --
+you can lick it, but it still won't go away.
+%
+Life is like an onion: you peel it off
+one layer at a time, and sometimes you weep.
+ -- Carl Sandburg
+%
+Life is like an onion: you peel off layer after
+layer and then you find there is nothing in it.
+ -- James Huneker
+%
+Life is like arriving late for a movie, having to figure out what was
+going on without bothering everybody with a lot of questions, and then
+being unexpectedly called away before you find out how it ends.
+%
+Life is like bein' on a mule team. Unless you're
+the lead mule, all the scenery looks about the same.
+%
+Life is not for everyone.
+%
+Life is one long struggle in the dark.
+ -- Titus Lucretius Carus
+%
+Life is the childhood of our immortality.
+ -- Johann Wolfgang von Goethe
+%
+Life is the living you do,
+Death is the living you don't do.
+ -- Joseph Pintauro
+%
+Life is the urge to ecstasy.
+%
+Life is to you a dashing and bold adventure.
+%
+Life is too important to take seriously.
+ -- Corky Siegel
+%
+Life is too short to be taken seriously.
+ -- Oscar Wilde
+%
+Life is too short to stuff a mushroom.
+ -- Storm Jameson
+%
+Life is wasted on the living.
+ -- Douglas Adams, "The Restaurant at the Edge of the Universe"
+%
+Life is what happens to you while you're busy making other plans.
+ -- John Lennon, "Beautiful Boy"
+%
+Life, like beer, is merely borrowed.
+ -- Don Reed
+%
+Life, loathe it or ignore it, you can't like it.
+ -- Marvin, from
+ Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Life may have no meaning, or, even worse,
+it may have a meaning of which you disapprove.
+%
+Life only demands from you the strength you possess.
+Only one feat is possible -- not to have run away.
+ -- Dag Hammarskjold
+%
+Life should not be a journey to the grave with the intention
+of arriving safely in a pretty and well preserved body, but
+rather to skid in broadside, thoroughly used up, totally worn out,
+and loudly proclaiming --WOW---What A RIDE!!
+%
+Life Sucks. Cynical, misanthropic male, 34, looking for soul mate but
+certain not to find her. Drop me a note. I'll call you, we'll talk and
+I'll ask you out to dinner where I'll probably spend more than I can
+afford in a feeble attempt to impress you. Then we'll realize we have
+absolutely nothing in common and we'll go our separate ways, more
+embittered and depressed than before (if such a thing is possible).
+%
+Life sucks, but death doesn't put out at all.
+ -- Thomas J. Kopp
+%
+Life to you is a bold and dashing responsibility.
+ -- a Mary Chung's fortune cookie
+%
+Life without caffeine is stimulating enough.
+ -- Sanka Ad
+%
+Life would be much simpler and things would get done much faster if it
+weren't for other people.
+ -- Blore
+%
+Life would be so much easier if we could just look at the source code.
+ -- Dave Olson
+%
+Life would be tolerable but for its amusements.
+ -- George Bernard Shaw
+%
+Life's too short to dance with ugly women.
+%
+Lift every voice and sing
+Till earth and heaven ring,
+Ring with the harmonies of Liberty;
+Let our rejoicing rise
+High as the listening skies,
+Let it resound loud as the rolling sea.
+
+Sing a song full of the faith that the dark past has taught us.
+Sing a song full of the hope that the present has bought us.
+Facing the rising sun of our new day begun,
+Let us march on till victory is won.
+ -- James Weldon Johnson
+%
+Lighten up, while you still can,
+Don't even try to understand,
+Just find a place to make your stand,
+And take it easy.
+ -- The Eagles, "Take It Easy"
+%
+LIGHTHOUSE:
+ A tall building on the seashore in which the government
+ maintains a lamp and the friend of a politician.
+%
+LIKE:
+ When being alive at the same time is a wonderful coincidence.
+%
+Like all young men, you greatly exaggerate
+the difference between one young woman and another.
+ -- George Bernard Shaw, "Major Barbara"
+%
+Like an expensive sports car, fine-tuned and well-built, Portia was sleek,
+shapely, and gorgeous, her red jumpsuit moulding her body, which was as warm
+as seatcovers in July, her hair as dark as new tires, her eyes flashing like
+bright hubcaps, and her lips as dewy as the beads of fresh rain on the hood;
+she was a woman driven -- fueled by a single accelerant -- and she needed a
+man, a man who wouldn't shift from his views, a man to steer her along the
+right road: a man like Alf Romeo.
+ -- Rachel Sheeley, winner
+
+The hair ball blocking the drain of the shower reminded Laura she would never
+see her little dog Pritzi again.
+ -- Claudia Fields, runner-up
+
+It could have been an organically based disturbance of the brain -- perhaps a
+tumor or a metabolic deficiency -- but after a thorough neurological exam it
+was determined that Byron was simply a jerk.
+ -- Jeff Jahnke, runner-up
+
+Winners in the 7th Annual Bulwer-Lytton Bad Writing Contest. The contest is
+named after the author of the immortal lines: "It was a dark and stormy
+night." The object of the contest is to write the opening sentence of the
+worst possible novel.
+%
+Like corn in a field I cut you down,
+I threw the last punch way too hard,
+After years of going steady, well, I thought it was time,
+To throw in my hand for a new set of cards.
+And I can't take you dancing out on the weekend,
+I figured we'd painted too much of this town,
+And I tried not to look as I walked to my wagon,
+And I knew then I had lost what should have been found,
+I knew then I had lost what should have been found.
+ And I feel like a bullet in the gun of Robert Ford
+ I'm as low as a paid assassin is
+ You know I'm cold as a hired sword.
+ I'm so ashamed we can't patch it up,
+ You know I can't think straight no more
+ You make me feel like a bullet, honey,
+ a bullet in the gun of Robert Ford.
+ -- Elton John "I Feel Like a Bullet"
+%
+Like I said, love wouldn't be so blind if the braille
+weren't so damned great!
+ -- Armistead Maupin
+%
+Like, if I'm not for me, then fer shure, like who will be? And if, y'know,
+if I'm not like fer anyone else, then hey, I mean, what am I? And if not
+now, like I dunno, maybe like when? And if not Who, then I dunno, maybe
+like the Rolling Stones?
+ -- Rich Rosen (Rabbi Valiel's paraphrase of famous quote
+ attributed to Rabbi Hillel.)
+%
+Like my parents, I have never been a regular church member or churchgoer.
+It doesn't seem plausible to me that there is the kind of God who watches
+over human affairs, listens to prayers, and tries to guide people to follow
+His precepts -- there is just too much misery and cruelty for that. On the
+other hand, I respect and envy the people who get inspiration from their
+religions.
+ -- Benjamin Spock
+%
+Like punning, programming is a play on words.
+%
+Like so many Americans, she was trying to construct
+a life that made sense from things she found in gift shops.
+ -- Kurt Vonnegut, Jr.
+%
+Like the ski resort of girls looking for husbands and husbands looking
+for girls, the situation is not as symmetrical as it might seem.
+ -- Alan McKay
+%
+Like the time I ran away...
+And turned around and you were standing close to me.
+ -- YES, "Going For The One/Awaken"
+%
+Like winter snow on summer lawn, time past is time gone.
+%
+Like ya know? Rock 'N Roll is an esoteric language that unlocks the
+creativity chambers in people's brains, and like totally activates their
+essential hipness, which of course is like totally necessary for saving
+the earth, like because the first thing in saving this world, is getting
+rid of stupid and square attitudes and having fun.
+ -- Senior Year Quote
+%
+Like you, I am frequently haunted by profound questions related to man's
+place in the Scheme of Things. Here are just a few:
+
+ Q -- Is there life after death?
+ A -- Definitely. I speak from personal experience here. On New
+Year's Eve, 1970, I drank a full pitcher of a drink called "Black Russian",
+then crawled out on the lawn and died within a matter of minutes, which was
+fine with me because I had come to realize that if I had lived I would have
+spent the rest of my life in the grip of the most excruciatingly painful
+headache. Thanks to the miracle of modern orange juice, I was brought back
+to life several days later, but in the interim I was definitely dead. I
+guess my main impression of the afterlife is that it isn't so bad as long
+as you keep the television turned down and don't try to eat any solid foods.
+ -- Dave Barry
+%
+Likewise, the national appetizer, brine-cured herring with raw onions,
+wins few friends, Germans excepted.
+ -- Darwin Porter, "Scandinavia On $50 A Day"
+%
+Lincoln was elected to Congress in 1846.
+Kennedy exactly one hundred years later in 1946.
+
+Lincoln was elected president in November 1860.
+Kennedy in November 1960.
+
+Lincoln had a secretary named Kennedy who urged him not to go to
+the theatre.
+Kennedy had a secretary named Lincoln who advised against his going
+to Dallas.
+
+Booth shot Lincoln in a theatre and ran off into a warehouse.
+Oswald shot Kennedy from a warehouse and ran off into a theatre.
+
+Lincoln was succeeded by a Southerner named Johnson.
+Kennedy was succeeded by a Southerner named Johnson.
+
+The first Johnson was born in 1808.
+The second Johnson was born in 1908.
+
+ -- Alistair Cooke, "Letter From America", Nov. 26, 2001
+%
+Line Printer paper is strongest at the perforations.
+%
+"Lines that are parallel meet at Infinity!"
+Euclid repeatedly, heatedly, urged.
+
+Until he died, and so reached that vicinity:
+in it he found that the damned things diverged.
+ -- Piet Hein
+%
+Linus: Hi! I thought it was you.
+ I've been watching you from way off... You're looking great!
+Snoopy: That's nice to know.
+ The secret of life is to look good at a distance.
+%
+Linus: I guess it's wrong always to be worrying about tomorrow.
+ Maybe we should think only about today.
+Charlie Brown:
+ No, that's giving up. I'm still hoping that yesterday
+ will get better.
+%
+Linus' Law:
+ There is no heavier burden than a great potential.
+%
+Lions in the street and roaming,
+Dogs in heat, rabid, foaming,
+A beast caged in the heart of the city.
+The body of his mother lying in the summer ground,
+He fled the town.
+Went down south across the border,
+Left the chaos and disorder
+Back there, over his shoulder.
+One morning he awoke in a green hotel,
+A strange creature groaning beside him.
+Sweat oozed from its shiny skin.
+Is everybody in? The ceremony is about to begin.
+ -- Jim Morrison, "Celebration of the Lizard"
+%
+LISP:
+ To call a spade a thpade.
+%
+Lisp, Lisp, Lisp Machine,
+Lisp Machine is Fun.
+Lisp, Lisp, Lisp Machine,
+Fun for everyone.
+%
+Lisp Users:
+Due to the holiday next Monday, there will be no garbage collection.
+%
+Listen, there is no courage or any extra courage that I know of to find out
+the right thing to do. Now, it is not only necessary to do the right thing,
+but to do it in the right way and the only problem you have is what is the
+right thing to do and what is the right way to do it. That is the problem.
+But this economy of ours is not so simple that it obeys to the opinion of
+bias or the pronouncements of any particular individual, even to the President.
+This is an economy that is made up of 173 million people, and it reflects
+their desires, they're ready to buy, they're ready to spend, it is a thing
+that is too complex and too big to be affected adversely or advantageously
+just by a few words or any particular -- say, a little this and that, or even
+a panacea so alleged.
+ -- Dwight D. Eisenhower, in response to: "Has the
+ government been lacking in courage and boldness in
+ facing up to the recession?"
+%
+Literature is mostly about sex and not much about having children and life
+is the other way round.
+ -- David Lodge, "The British Museum is Falling Down"
+%
+Littering is dumb.
+ -- Ronald Macdonald
+%
+Little Fly,
+Thy summer's play If thought is life
+My thoughtless hand And strength & breath,
+Has brush'd away. And the want
+ Of thought is death,
+Am not I
+A fly like thee? Then am I
+Or art not thou A happy fly
+A man like me? If I live
+ Or if I die.
+
+For I dance
+And drink & sing,
+Till some blind hand
+Shall brush my wing.
+ -- William Blake, "The Fly"
+%
+Little girls, like butterflies, need no excuse.
+ -- Lazarus Long
+%
+Little known fact about Middle Earth: The Hobbits had a very
+sophisticated computer network! It was a Tolkien Ring...
+%
+Little Known Facts, #23:
+ Did you know... that if you dial 911 in Los Angeles you get
+ the BMW repair garage?
+%
+Little Mary on the ice,
+Went out to have a frisk,
+Now wasn't little Mary nice,
+Her pretty *?
+%
+Live fast, die young, and leave a flat patch of fur on the highway!
+ -- The Squirrels' Motto (The "Hell's Angels of Nature")
+%
+Live fast, die young, and leave a good looking corpse.
+ -- James Dean
+%
+Live from New York ... It's Saturday Night!
+%
+Live in a world of your own, but always welcome visitors.
+%
+Live never to be ashamed if anything you do or say is
+published around the world -- even if what is published is not true.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+Live within your income, even if you have to borrow to do so.
+ -- Josh Billings
+%
+Living here in Rio, I have lots of coffees to choose from. And when
+you're on the lam like me, you appreciate a good cup of coffee.
+ -- "Great Train Robber" Ronald Biggs' coffee commercial
+%
+Living in California is like living in a bowl of granola.
+What ain't flakes and nuts is fruits.
+%
+Living in Hollywood is like living in a bowl of granola.
+What ain't fruits and nuts is flakes.
+%
+Living in LA is like not having a date on Saturday night.
+ -- Candice Bergen
+%
+Living in New York City gives people real incentives
+to want things that nobody else wants.
+ -- Andy Warhol
+%
+Living in the complex world of the future is somewhat
+like having bees live in your head. But, there they are.
+%
+Living on Earth may be expensive, but it
+includes an annual free trip around the Sun.
+%
+LIVING YOUR LIFE:
+ A task so difficult, it has never been attempted before.
+%
+Lizzie Borden took an axe,
+And plunged it deep into the VAX;
+Don't you envy people who
+Do all the things _Y_O_U want to do?
+%
+Lo! Men have become the tool of their tools.
+ -- Henry David Thoreau
+%
+Loan-department manager: "There isn't any fine print. At these
+interest rates, we don't need it."
+%
+Lobster:
+ Everyone loves these delectable crustaceans, but many cooks are squeamish
+ about placing them into boiling water alive, which is the only proper
+ method of preparing them. Frankly, the easiest way to eliminate your
+ guilt is to establish theirs by putting them on trial before they're
+ cooked. The fact is, lobsters are among the most ferocious predators on
+ the sea floor, and you're helping reduce crime in the reefs. Grasp the
+ lobster behind the head, look it right in its unmistakably guilty
+ eyestalks and say, "Where were you on the night of the 21st?", then
+ flourish a picture of a scallop or a sole and shout, "Perhaps this will
+ refresh that crude neural apparatus you call a memory!" The lobster will
+ squirm noticeably. It may even take a swipe at you with one of its claws.
+ Incorrigible. Pop it into the pot. Justice has been served, and shortly
+ you and your friends will be, too.
+ -- Dave Barry, Cooking: The Art of Turning Appliances
+ and Utensils into Excuses and Apologies
+%
+Lockwood's Long Shot:
+ The chances of getting eaten up by a lion on Main Street
+ aren't one in a million, but once would be enough.
+%
+Logic doesn't apply to the real world.
+ -- Marvin Minsky
+%
+Logic is a little bird, sitting in a tree; that smells *_a_w_f_u_l*.
+%
+Logic is a pretty flower that smells bad.
+%
+Logic is the chastity belt of the mind!
+%
+Logicians have but ill defined
+As rational the human kind.
+Logic, they say, belongs to man,
+But let them prove it if they can.
+ -- Oliver Goldsmith
+%
+LOGO for the Dead
+
+LOGO for the Dead lets you continue your computing activities from
+"The Other Side."
+
+The package includes a unique telecommunications feature which lets you
+turn your TRS-80 into an electronic Ouija board. Then, using Logo's
+graphics capabilities, you can work with a friend or relative on this
+side of the Great Beyond to write programs. The software requires that
+your body be hardwired to an analog-to-digital converter, which is then
+interfaced to your computer. A special terminal (very terminal) program
+lets you talk with the users through Deadnet, an EBBS (Ectoplasmic
+Bulletin Board System).
+
+LOGO for the Dead is available for 10 percent of your estate
+from NecroSoft inc., 6502 Charnelhouse Blvd., Cleveland, OH 44101.
+ -- '80 Microcomputing
+%
+Loneliness is a terrible price to pay for independence.
+%
+Lonely is a man without love.
+ -- Engelbert Humperdinck
+%
+Lonely men seek companionship.
+Lonely women sit at home and wait. They never meet.
+%
+Lonesome?
+
+Like a change?
+Like a new job?
+Like excitement?
+Like to meet new and interesting people?
+
+JUST SCREW-UP ONE MORE TIME!!!!!!!
+%
+Long ago I proposed that unsuccessful candidates for the Presidency
+be quietly hanged, as a matter of public sanitation and decorum.
+The sight of their grief must have a very evil effect upon the young.
+ -- H. L. Mencken, "A Carnival of Buncombe"
+%
+Long computations which yield zero are probably all for naught.
+%
+Long life is in store for you.
+%
+Long were the days of pain I have spent within its walls, and
+long were the nights of aloneness; and who can depart from his
+pain and his aloneness without regret?
+ -- Kahlil Gibran, "The Prophet"
+%
+Look! Before our very eyes, the future is becoming the past.
+%
+Look afar and see the end from the beginning.
+%
+Look at it this way:
+Your daughter just named the fresh turkey you brought
+home "Cuddles", so you're going out to buy a canned ham.
+And you're still drinking ordinary scotch?
+%
+Look at it this way:
+Your wife's spending $280 a month on meditation lessons to
+forget $26,000 of college education.
+And you're still drinking ordinary scotch?
+%
+Look before you leap.
+ -- Samuel Butler
+%
+Look ere ye leap.
+ -- John Heywood
+%
+Look out! Behind you!
+%
+Look up and not down, look forward and not back, look out and not in,
+and lend a hand.
+ -- Edward Everett Hale, "Lowell Institute Lectures" (1869)
+%
+Look, we play the Star Spangled Banner before every game. You want us
+to pay income taxes, too?
+ -- Bill Veeck, Chicago White Sox
+%
+Look, we trade every day out there with hustlers, deal-makers, shysters,
+con-men. That's the way businesses get started. That's the way this
+country was built.
+ -- Hubert Allen
+%
+Lookie, lookie, here comes cookie...
+ -- Stephen Sondheim
+%
+Loose bits sink chips.
+%
+Lord, defend me from my friends; I can account for my enemies.
+ -- Charles D'Hericault
+%
+Lord, what fools these mortals be!
+ -- William Shakespeare, "A Midsummer-Night's Dream"
+%
+Losing your drivers' license is just
+God's way of saying "BOOGA, BOOGA!"
+%
+Lost: gray and white female cat.
+Answers to electric can opener.
+%
+Lost interest? It's so bad I've lost apathy.
+%
+Lots of folks are forced to skimp to support a government that won't.
+%
+Lots of folks confuse bad management with destiny.
+ -- Frank Hubbard
+%
+Lots of girls can be had for a song.
+Unfortunately, it often turns out to be the wedding march.
+%
+Loud burping while walking around the airport is prohibited in
+Halstead, Kansas.
+%
+Louie Louie, me gotta go
+Louie Louie, me gotta go
+
+Fine little girl she waits for me
+Me catch the ship for cross the sea
+Me sail the ship all alone Three nights and days me sail the sea
+Me never thinks me make it home Me think of girl constantly
+(chorus) On the ship I dream she there
+ I smell the rose in her hair
+Me see Jamaica moon above (chorus, guitar solo)
+It won't be long, me see my love
+I take her in my arms and then
+Me tell her I never leave again
+ -- The real words to The Kingsmen's classic "Louie Louie"
+%
+LOVE:
+ I'll let you play with my life if you'll let me play with yours.
+%
+LOVE:
+ Love ties in a knot in the end of the rope.
+%
+LOVE:
+ When, if asked to choose between your lover
+ and happiness, you'd skip happiness in a heartbeat.
+%
+LOVE:
+ When it's growing, you don't mind watering it with a few tears.
+%
+LOVE:
+ When you don't want someone too close--
+ because you're very sensitive to pleasure.
+%
+LOVE:
+ When you like to think of someone on days that begin with a morning.
+%
+Love -- the last of the serious diseases of childhood.
+%
+Love ain't nothin' but sex misspelled.
+%
+Love America - or give it back.
+%
+Love and scandal are the best sweeteners of tea.
+%
+Love at first sight is one of the greatest
+labor-saving devices the world has ever seen.
+%
+Love cannot be much younger than the lust for murder.
+ -- Sigmund Freud
+%
+Love conquers all things; let us too surrender to love.
+ -- Publius Vergilius Maro (Virgil)
+%
+Love in your heart wasn't put there to stay.
+Love isn't love 'til you give it away.
+ -- Oscar Hammerstein II
+%
+Love is a grave mental disease.
+ -- Plato
+%
+Love is a slippery eel that bites like hell.
+ -- Matt Groening
+%
+Love is a snowmobile racing across the tundra, which suddenly flips
+over, pinning you underneath. At night the ice weasels come.
+ -- Matt Groening, "Love is Hell"
+%
+Love is a word that is constantly heard,
+Hate is a word that is not.
+Love, I am told, is more precious than gold.
+Love, I have read, is hot.
+But hate is the verb that to me is superb,
+And Love but a drug on the mart.
+Any kiddie in school can love like a fool,
+But Hating, my boy, is an Art.
+ -- Ogden Nash
+%
+Love is always open arms. With arms open you allow love to come and
+go as it wills, freely, for it will do so anyway. If you close your
+arms about love you'll find you are left only holding yourself.
+%
+Love is an ideal thing, marriage a real thing; a confusion of the real
+with the ideal never goes unpunished.
+ -- Johann Wolfgang von Goethe
+%
+Love is an obsessive delusion that is cured by marriage.
+ -- Dr. Karl Bowman
+%
+Love is being stupid together.
+ -- Paul Valery
+%
+Love is dope, not chicken soup. I mean, love is something to be passed
+around freely, not spooned down someone's throat for their own good by a
+Jewish mother who cooked it all by herself.
+%
+Love is in the offing.
+ -- The Homicidal Maniac
+%
+Love is in the offing. Be affectionate to one who adores you.
+%
+Love is like a friendship caught on fire. In the beginning a flame, very
+pretty, often hot and fierce, but still only light and flickering. As love
+grows older, our hearts mature and our love becomes as coals, deep-burning
+and unquenchable.
+ -- Bruce Lee
+%
+Love is like the measles; we all have to go through it.
+ -- Jerome K. Jerome
+%
+Love is never asking why?
+%
+Love is not enough, but it sure helps.
+%
+Love is sentimental measles.
+%
+Love is staying up all night with a sick child, or a healthy adult.
+%
+Love is the answer; but while you are waiting for the answer, sex
+raises some pretty good questions.
+ -- Woody Allen
+%
+Love is the delusion that one woman differs from another.
+ -- H. L. Mencken
+%
+Love is the desire to prostitute oneself. There is, indeed, no exalted
+pleasure that cannot be related to prostitution.
+ -- Charles Baudelaire
+%
+Love is the only game that is not called on account of darkness.
+ -- M. Hirschfield
+%
+Love is the process of my leading you gently back to yourself.
+ -- Antoine de Saint-Exupery
+%
+Love is the triumph of imagination over intelligence.
+ -- H. L. Mencken
+%
+Love IS what it's cracked up to be.
+%
+Love is what you've been through with somebody.
+ -- James Thurber
+%
+Love isn't only blind, it's also deaf, dumb, and stupid.
+%
+Love makes fools, marriage cuckolds, and patriotism malevolent imbeciles.
+ -- Paul Leautaud, "Passe-temps"
+%
+Love makes the world go 'round, with a little help from intrinsic angular
+momentum.
+%
+Love may laugh at locksmiths, but he has a profound respect for money bags.
+ -- Sidney Paternoster, "The Folly of the Wise"
+%
+Love means having to say you're sorry every five minutes.
+%
+Love means never having to say you're sorry.
+ -- Eric Segal, "Love Story"
+
+That's the most ridiculous thing I've ever heard.
+ -- Ryan O'Neill, "What's Up Doc?"
+%
+Love means nothing to a tennis player.
+%
+Love tells us many things that are not so.
+ -- Krainian proverb
+%
+Love the sea? I dote upon it -- from the beach.
+%
+Love thy neighbor as thyself, but choose your neighborhood.
+ -- Louise Beal
+%
+Love thy neighbor, tune thy piano.
+%
+Love to eat them mousies,
+Mousies I love to eat.
+Bite they little heads off,
+Nibble at they tiny feet.
+ -- Kliban
+%
+Love, which is quickly kindled in a gentle heart,
+ seized this one for the fair form
+ that was taken from me-and the way of it afflicts me still.
+Love, which absolves no loved one from loving,
+ seized me so strongly with delight in him,
+ that, as you see, it does not leave me even now.
+Love brought us to one death.
+ -- La Divina Commedia: Inferno V, vv. 100-06
+%
+Love your enemies: they'll go crazy
+trying to figure out what you're up to.
+%
+Love your neighbour, yet don't pull down your hedge.
+ -- Benjamin Franklin
+%
+Lowery's Law:
+ If it jams -- force it. If it
+ breaks, it needed replacing anyway.
+%
+LSD melts in your mind, not in your hand.
+%
+Lubarsky's Law of Cybernetic Entomology:
+ There's always one more bug.
+%
+Lucas is the source of many of the components of the legendarily reliable
+British automotive electrical systems. Professionals call the company "The
+Prince of Darkness". Of course, if Lucas were to design and manufacture
+nuclear weapons, World War III would never get off the ground. The British
+don't like warm beer any more than the Americans do. The British drink warm
+beer because they have Lucas refrigerators.
+%
+Luck can't last a lifetime, unless you die young.
+ -- Russell Banks
+%
+Luck, that's when preparation and opportunity meet.
+ -- P. E. Trudeau
+%
+Lucky, adj.:
+ When you have a wife and a cigarette
+ lighter -- both of which work.
+%
+Lucky is he for whom the belle toils.
+%
+Lucy: Dance, dance, dance. That is all you ever do.
+ Can't you be serious for once?
+Snoopy: She is right! I think I had better think
+ of the more important things in life!
+ (pause)
+ Tomorrow!!
+%
+Luke, I'm yer father, eh. Come over to the dark side, you hoser.
+ -- Dave Thomas, "Strange Brew"
+%
+Lunatic Asylum, n.:
+ The place where optimism most flourishes.
+%
+Lying is an indispensable part of making life tolerable.
+ -- Bergan Evans
+%
+Lysistrata had a good idea.
+%
+Ma Bell is a mean mother!
+%
+MAC user's dynamic debugging list evaluator? Never heard of that.
+%
+Machine-Independent, adj.:
+ Does not run on any existing machine.
+%
+Machine-independent program:
+ A program that will not run on any machine.
+%
+Machines certainly can solve problems, store information, correlate,
+and play games -- but not with pleasure.
+ -- Leo Rosten
+%
+Machines have less problems. I'd like to be a machine.
+ -- Andy Warhol
+%
+Machines that have broken down will work perfectly when the
+repairman arrives.
+%
+Macho does not prove mucho.
+ -- Zsa Zsa Gabor
+%
+Mad, adj.:
+ Affected with a high degree of intellectual independence.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Madam, there's no such thing as a tough child --
+if you parboil them first for seven hours, they always come out tender.
+ -- W. C. Fields
+%
+Madison's Inquiry:
+ If you have to travel on the Titanic, why not go first class?
+%
+Madness takes its toll.
+%
+MAFIA, n.:
+ [Acronym for Mechanized Applications in Forced Insurance
+Accounting.] An extensive network with many on-line and offshore
+subsystems running under OS, DOS, and IOS. MAFIA documentation is
+rather scanty, and the MAFIA sales office exhibits that testy
+reluctance to bona fide inquiries which is the hallmark of so many DP
+operations. From the little that has seeped out, it would appear that
+MAFIA operates under a non-standard protocol, OMERTA, a tight-lipped
+variant of SNA, in which extended handshakes also perform complex
+security functions. The known timesharing aspects of MAFIA point to a
+more than usually autocratic operating system. Screen prompts carry an
+imperative, nonrefusable weighting (most menus offer simple YES/YES
+options, defaulting to YES) that precludes indifference or delay.
+Uniquely, all editing under MAFIA is performed centrally, using a
+powerful rubout feature capable of erasing files, filors, filees, and
+entire nodal aggravations.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+Magary's Principle:
+ When there is a public outcry to cut deadwood and fat from any
+ government bureaucracy, it is the deadwood and the fat that do
+ the cutting, and the public's services are cut.
+%
+Magic is always the best solution -- especially reliable magic.
+%
+Magnet, n.: Something acted upon by magnetism
+
+Magnetism, n.: Something acting upon a magnet.
+
+The two definitions immediately foregoing are condensed from the works
+of one thousand eminent scientists, who have illuminated the subject
+with a great white light, to the inexpressible advancement of human
+knowledge.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Magnocartic, adj.:
+ Any automobile that, when left unattended, attracts shopping
+ carts.
+ -- Rich Hall, "Sniglets"
+%
+Magpie, n.:
+ A bird whose thievish disposition suggested
+ to someone that it might be taught to talk.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+MAIDEN AUNT:
+ A girl who never had the sense to say "uncle."
+%
+Maiden, n.:
+ A young person of the unfair sex addicted to clewless conduct and
+ views that madden to crime. The genus has a wide geographical
+ distribution, being found wherever sought and deplored wherever found.
+ The maiden is not altogether unpleasing to the eye, nor (without her
+ piano and her views) insupportable to the ear, though in respect to
+ comeliness distinctly inferior to the rainbow, and, with regard to
+ the part of her that is audible, beaten out of the field by the
+ canary -- which, also, is more portable.
+
+Male, n.:
+ A member of the unconsidered, or negligible sex. The male of the
+ human race is commonly known to the female as Mere Man. The genus
+ has two varieties: good providers and bad providers.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Maier's Law:
+ If the facts do not conform to the theory, they must be disposed of.
+ -- N. R. Maier, "American Psychologist", March 1960
+
+Corollaries:
+ 1. The bigger the theory, the better.
+ 2. The experiment may be considered a success if no more than
+ 50% of the observed measurements must be discarded to
+ obtain a correspondence with the theory.
+%
+Main's Law:
+ For every action there is an equal and opposite government program.
+%
+Maintainer's Motto:
+ If we can't fix it, it ain't broke.
+%
+Maj. Bloodnok: Seagoon, you're a coward!
+Seagoon: Only in the holiday season.
+Maj. Bloodnok: Ah, another Noel Coward!
+%
+Major premise:
+ Sixty men can do sixty times as much work as one man.
+Minor premise:
+ A man can dig a posthole in sixty seconds.
+Conclusion:
+ Sixty men can dig a posthole in one second.
+
+Secondary Conclusion:
+ Do you realize how many holes there would be if people
+ would just take the time to take the dirt out of them?
+%
+Major Premise: Sixty men can do a piece of work sixty times as quickly
+ as one man.
+
+Minor Premise: One man can dig a posthole in sixty seconds.
+
+Conclusion: Sixty men can dig a posthole in one second.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Majorities, of course, start with minorities.
+ -- Robert Moses
+%
+Majority, n.:
+ That quality that distinguishes a crime from a law.
+%
+Make a wish, it might come true.
+%
+Make headway at work. Continue to let things deteriorate at home.
+%
+Make it myself? But I'm a physical organic chemist!
+%
+Make it right before you make it faster.
+%
+Make no little plans; they have no magic to stir men's blood.
+ -- Daniel Hudson Burnham
+%
+Make sure your code does nothing gracefully.
+%
+Make war not sex. (It's safer.)
+%
+Making files is easy under the UNIX operating system. Therefore, users
+tend to create numerous files using large amounts of file space. It has
+been said that the only standard thing about all UNIX systems is the
+message-of-the-day telling users to clean up their files.
+ -- System V.2 administrator's guide
+%
+Malek's Law:
+ Any simple idea will be worded in the most complicated way.
+%
+MALPRACTICE:
+ The reason surgeons wear masks.
+%
+Man 1: Ask me. "What is the most important thing about telling a good
+ joke?"
+
+Man 2: OK, what is the most impo --
+
+Man 1: _T_I_M_I_N_G!
+%
+Man and wife make one fool.
+%
+Man belongs wherever he wants to go.
+ -- Wernher von Braun
+%
+Man has always assumed that he is more intelligent than dolphins because
+he has achieved so much -- the wheel, New York, wars and so on -- while
+all the dolphins had ever done was muck about in the water having a good
+time. But, conversely, the dolphins had always believed that they were
+far more intelligent than man -- for precisely the same reasons.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Man has made his bedlam; let him lie in it.
+ -- Fred Allen
+%
+Man has never reconciled himself to the ten commandments.
+%
+Man invented language to satisfy his deep need to complain.
+ -- Lily Tomlin
+%
+Man is a military animal,
+Glories in gunpowder, and loves parade.
+ -- P. J. Bailey
+%
+Man is a rational animal who always loses his temper when he is called upon
+to act in accordance with the dictates of reason.
+ -- Oscar Wilde
+%
+Man is an animal that makes bargains: no other animal does this--
+no dog exchanges bones with another.
+ -- Adam Smith
+%
+Man is by nature a political animal.
+ -- Aristotle
+%
+Man is the best computer we can put aboard a spacecraft...
+and the only one that can be mass produced with unskilled labor.
+ -- Wernher von Braun
+%
+Man is the measure of all things.
+ -- Protagoras
+%
+Man is the only animal that blushes -- or needs to.
+ -- Mark Twain
+%
+Man is the only animal that can remain on friendly terms
+with the victims he intends to eat until he eats them.
+ -- Samuel Butler (1835-1902)
+%
+Man is the only animal that laughs and weeps;
+for he is the only animal that is struck with the
+difference between what things are and what they ought to be.
+ -- William Hazlitt
+%
+Man must shape his tools lest they shape him.
+ -- Arthur R. Miller
+%
+Man, n.:
+ An animal so lost in rapturous contemplation of what he thinks
+ he is as to overlook what he indubitably ought to be. His chief
+ occupation is extermination of other animals and his own
+ species, which, however, multiplies with such insistent rapidity
+ as to infest the whole habitable earth and Canada.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Man proposes, God disposes.
+ -- Thomas a Kempis
+%
+Man usually avoids attributing cleverness to somebody else -- unless it
+is an enemy.
+ -- Albert Einstein
+%
+Man who arrives at party two hours late
+will find he has been beaten to the punch.
+%
+Man who falls in blast furnace is certain to feel overwrought.
+%
+Man who falls in vat of molten optical glass makes spectacle of self.
+%
+Man who sleep in beer keg wake up stickey.
+%
+Man will never fly.
+Space travel is merely a dream.
+All aspirin is alike.
+%
+Management: How many feet do mice have?
+Reply: Mice have four feet.
+M: Elaborate!
+R: Mice have five appendages, and four of them are feet.
+M: No discussion of fifth appendage!
+R: Mice have five appendages; four of them are feet; one is a tail.
+M: What? Feet with no legs?
+R: Mice have four legs, four feet, and one tail per unit-mouse.
+M: Confusing -- is that a total of 9 appendages?
+R: Mice have four leg-foot assemblies and one tail assembly per body.
+M: Does not fully discuss the issue!
+R: Each mouse comes equipped with four legs and a tail. Each leg
+ is equipped with a foot at the end opposite the body; the tail
+ is not equipped with a foot.
+M: Descriptive? Yes. Forceful NO!
+R: Allotment of appendages for mice will be: Four foot-leg assemblies,
+ one tail. Deviation from this policy is not permitted as it would
+ constitute misapportionment of scarce appendage assets.
+M: Too authoritarian; stifles creativity!
+R: Mice have four feet; each foot is attached to a small leg joined
+ integrally with the overall mouse structural sub-system. Also
+ attached to the mouse sub-system is a thin tail, non-functional and
+ ornamental in nature.
+M: Too verbose/scientific. Answer the question!
+R: Mice have four feet.
+%
+MANAGEMENT:
+ The art of getting other people to do all the work.
+%
+MANAGER:
+ A man known for giving great meeting.
+%
+Mandrell: "You know what I think?"
+Doctor: "Ah, ah that's a catch question. With a brain your size you
+ don't think, right?"
+ -- "Doctor Who"
+%
+Man-hour, n.:
+ A sexist, obsolete measure of macho effort, equal to 60 Kiplings.
+%
+Manic-depressive, n.:
+ Easy glum, easy glow.
+%
+Mankind is poised midway between the gods and the beasts.
+ -- Plotinus
+%
+Mankind's yearning to engage in sports is older than recorded history,
+dating back to the time millions of years ago, when the first primitive
+man picked up a crude club and a round rock, tossed the rock into the
+air, and whomped the club into the sloping forehead of the first
+primitive umpire.
+
+What inner force drove this first athlete? Your guess is as good as
+mine. Better, probably, because you haven't had four beers.
+ -- Dave Barry, "Sports is a Drag"
+%
+Manly's Maxim:
+ Logic is a systematic method of coming to the wrong conclusion
+ with confidence.
+%
+Man's horizons are bounded by his vision.
+%
+Man's reach must exceed his grasp, for why else the heavens?
+%
+Man's unique agony as a species consists in his perpetual
+conflict between the desire to stand out and the need to blend in.
+ -- Sydney J. Harris
+%
+Manual, n.:
+ A unit of documentation. There are always three or more on a given
+ item. One is on the shelf; someone has the others. The information
+ you need is in the others.
+ -- Ray Simard
+%
+Many a bum show has been saved by the flag.
+ -- George M. Cohan
+%
+Many a family tree needs trimming.
+%
+Many a long dispute between divines may thus be abridged: It is so. It
+is not so. It is so. It is not so.
+ -- Benjamin Franklin, "Poor Richard's Almanack"
+%
+Many a man that can't direct you to a corner drugstore will
+get a respectful hearing when age has further impaired his mind.
+ -- Finley Peter Dunne
+%
+Many a town that didn't have enough work to support a single lawyer
+can easily support two or more.
+%
+Many a writer seems to think he is never profound
+except when he can't understand his own meaning.
+ -- George D. Prentice
+%
+Many are called, few are chosen.
+Fewer still get to do the choosing.
+%
+Many are called, few volunteer.
+%
+Many are cold, but few are frozen.
+%
+Many changes of mind and mood; do not hesitate too long.
+%
+Many companies that have made themselves dependent on [the equipment of a
+certain major manufacturer] (and in doing so have sold their soul to the
+devil) will collapse under the sheer weight of the unmastered complexity of
+their data processing systems.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+Many enraged psychiatrists are inciting a weary butcher. The butcher is
+weary and tired because he has cut meat and steak and lamb for hours and
+weeks. He does not desire to chant about anything with raving psychiatrists,
+but he sings about his gingivectomist, he dreams about a single cosmologist,
+he thinks about his dog. The dog is named Herbert.
+ -- Racter, "The Policeman's Beard is Half-Constructed"
+%
+Many hands make light work.
+ -- John Heywood
+%
+Many husbands go broke on the money their wives save on sales.
+%
+Many mental processes admit of being roughly measured. For instance,
+the degree to which people are bored, by counting the number of their
+fidgets. I not infrequently tried this method at the meetings of the
+Royal Geographical Society, for even there dull memoirs are occasionally
+read. [...] The use of a watch attracts attention, so I reckon time
+by the number of my breathings, of which there are 15 in a minute. They
+are not counted mentally, but are punctuated by pressing with 15 fingers
+successively. The counting is reserved for the fidgets. These observations
+should be confined to persons of middle age. Children are rarely still,
+while elderly philosophers will sometimes remain rigid for minutes altogether.
+ -- Francis Galton, 1909
+%
+Many of the characters are fools and they are always playing
+tricks on me and treating me badly.
+ -- Jorge Luis Borges, from "Writers on Writing" by Jon Winokur
+%
+Many of the convicted thieves Parker has met began their
+life of crime after taking college Computer Science courses.
+ -- Roger Rapoport, "Programs for Plunder", Omni, March 1981
+%
+Many pages make a thick book.
+%
+Many pages make a thick book, except for pocket Bibles which are on very
+thin paper.
+%
+Many people are desperately looking for some wise advice
+which will recommend that they do what they want to do.
+%
+Many people are secretly interested in life.
+%
+Many people are unenthusiastic about their work.
+%
+Many people are unenthusiastic about your work.
+%
+Many people feel that if you won't let
+them make you happy, they'll make you suffer.
+%
+Many people feel that they deserve some kind of
+recognition for all the bad things they haven't done.
+%
+Many people resent being treated like the person they really are.
+%
+Many people would rather die than think; in fact, most do.
+ -- Bertrand Russell
+%
+Many people write memos to tell you they have nothing to say.
+%
+Many receive advice, few profit by it.
+ -- Publilius Syrus
+%
+Many years ago in a period commonly known as Next Friday Afternoon,
+there lived a King who was very Gloomy on Tuesday mornings because he
+was so Sad thinking about how Unhappy he had been on Monday and how
+completely Mournful he would be on Wednesday ...
+ -- Walt Kelly
+%
+Margaret, are you grieving
+Over Goldengrove unleaving?
+Leaves, like the things of man,
+You, with your fresh thoughts
+Care for, can you?
+Ah! as the heart grows older
+It will come to such sights colder
+By and by, nor spare a sigh
+Though worlds of wanwood leafmeal lie
+And yet you will weep and know why.
+Now no matter, child, the name
+Sorrow's springs are the same:
+It is the blight man was born for,
+It is Margaret you mourn for.
+ -- Gerard Manley Hopkins
+%
+Marigold: Jealousy
+Mint: Virute
+Orange blossom: Your purity equals your loveliness
+Orchid: Beauty, magnificence
+Pansy: Thoughts
+Peach blossom: I am your captive
+Petunia: Your presence soothes me
+Poppy: Sleep
+Rose, any color: Love
+Rose, deep red: Bashful shame
+Rose, single, pink: Simplicity
+Rose, thornless, any: Early attachment
+Rose, white: I am worthy of you
+Rose, yellow: Decrease of love, rise of jealousy
+Rosebud, white: Girlhood, and a heart ignorant of love
+Rosemary: Remembrance
+Sunflower: Haughtiness
+Tulip, red: Declaration of love
+Tulip, yellow: Hopeless love
+Violet, blue: Faithfulness
+Violet, white: Modesty
+Zinnia: Thoughts of absent friends
+ * An upside-down blossom reverses the meaning.
+%
+Marijuana is nature's way of saying, "Hi!".
+%
+Marijuana will be legal some day, because the many law students
+who now smoke pot will someday become congressmen and legalize
+it in order to protect themselves.
+ -- Lenny Bruce
+%
+Mark's Dental-Chair Discovery:
+ Dentists are incapable of asking questions
+ that require a simple yes or no answer.
+%
+MARRIAGE:
+ An old, established institution, entered into by two people deeply
+ in love and desiring to make a commitment to each other expressing
+ that love. In short, commitment to an institution.
+%
+MARRIAGE:
+ Convertible bonds.
+%
+Marriage always demands the greatest understanding of the art of
+insincerity possible between two human beings.
+ -- Vicki Baum
+%
+Marriage causes dating problems.
+%
+Marriage, in life, is like a duel in the midst of a battle.
+ -- Edmond About
+%
+Marriage is a ghastly public confession of a strictly private intention.
+%
+Marriage is a great institution -- but I'm
+not ready for an institution yet.
+ -- Mae West
+%
+Marriage is a lot like the army, everyone complains, but you'd be
+surprised at the large number that re-enlist.
+ -- James Garner
+%
+Marriage is a romance in which the hero dies in the first chapter.
+%
+Marriage is a three ring circus:
+engagement ring, wedding ring, and suffering.
+ -- Roger Price
+%
+Marriage is an institution in which two undertake
+to become one, and one undertakes to become nothing.
+%
+Marriage is based on the theory that when a man discovers a brand of beer
+exactly to his taste he should at once throw up his job and go to work
+in the brewery.
+ -- George Jean Nathan
+%
+Marriage is learning about women the hard way.
+%
+Marriage is like twirling a baton, turning handsprings, or eating with
+chopsticks. It looks easy until you try it.
+%
+Marriage is low down, but you spend the rest of your life paying for it.
+ -- Baskins
+%
+Marriage is not merely sharing the fettuccine, but sharing the
+burden of finding the fettuccine restaurant in the first place.
+ -- Calvin Trillin
+%
+Marriage is the only adventure open to the cowardly.
+ -- Voltaire
+%
+Marriage is the process of finding out what
+kind of man your wife would have preferred.
+%
+Marriage is the waste-paper basket of the emotions.
+%
+Marriage, n.:
+ The evil aye.
+%
+Marriages are made in heaven and consummated on earth.
+ -- John Lyly
+%
+Marry in haste and everyone starts counting the months.
+%
+MARTA SAYS THE INTERESTING thing about fly-fishing is that its two lives
+connected by a thin strand.
+
+Come on, Marta, grow up.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+MARTA WAS WATCHING THE FOOTBALL GAME with me when she said, "You know most
+of these sports are based on the idea of one group protecting its
+territory from invasion by another group."
+
+"Yeah," I said, trying not to laugh. Girls are funny.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Martin was probably ripping them off. That's some family, isn't it?
+Incest, prostitution, fanaticism, software.
+ -- Charles Willeford, "Miami Blues"
+%
+'Martyrdom' is the only way a person can become famous without ability.
+ -- George Bernard Shaw
+%
+Marvelous! The super-user's going to boot me!
+What a finely tuned response to the situation!
+%
+Marvin the Nature Lover spied a grasshopper hopping along in the grass,
+and in a mood for communing with nature, rare even among full-fledged
+Nature Lovers, he spoke to the grasshopper, saying: "Hello, friend
+grasshopper. Did you know they've named a drink after you?"
+ "Really?" replied the grasshopper, obviously pleased. "They've
+named a drink Fred?"
+%
+Marxist Law of Distribution of Wealth:
+ Shortages will be divided equally among the peasants.
+%
+Mary had a little lamb, its fleece was white as snow,
+And everywhere that Mary went, the lamb was sure to go.
+It followed her through rain or snow, lightning, sleet or hail.
+It fetched the evening paper, her slippers, and the mail.
+She never had a moments peace; the lamb was always on her heels,
+And on her feet its head would rest, while she ate her meals.
+It followed her to school one day, the devotion never ended.
+The lamb waltzed into her history class and Mary got suspended.
+The night she went to Senior Prom, she thought she had him beat,
+Until she heard a mournful "Baaa" coming from her car's seat.
+Oh, Mary had a little lamb, it surely didn't please her.
+So for dinner she had lambchops; the rest is in the freezer.
+ -- Alma Garcia
+%
+Maryann's Law:
+ You can always find what you're not looking for.
+%
+Maryel brought her bat into Exit once and started whacking people on
+the dance floor. Now everyone's doing it. It's called grand slam
+dancing.
+ -- Ransford, Chicago Reader 10/7/83
+%
+Maslow's Maxim:
+ If the only tool you have is a hammer,
+ you treat everything like a nail.
+%
+Mason's First Law of Synergism:
+The one day you'd sell your soul for something, souls are a glut.
+%
+Massachusetts has the best politicians money can buy.
+%
+Mastery of UNIX, like mastery of language, offers real freedom. The
+price of freedom is always dear, but there's no substitute.
+ -- Thomas Scoville
+%
+Masturbation is the thinking man's television.
+ -- Christopher Hampton
+%
+Mate, this parrot wouldn't VOOM if you put four million volts through it!
+ -- Monty Python
+%
+Mater artium necessitas.
+ [Necessity is the mother of invention].
+%
+Maternity pay? Now every Tom, Dick and Harry will get pregnant.
+ -- Malcolm Smith
+%
+MATH AND ALCOHOL DON'T MIX!
+ Please, don't drink and derive.
+
+ Mathematicians
+ Against
+ Drunk
+ Deriving
+%
+Math is like love -- a simple idea but it can get complicated.
+ -- R. Drabek
+%
+Mathematician, n.:
+ Some one who believes imaginary things appear right before your i's.
+%
+Mathematicians are like Frenchmen: whatever you say to them they translate
+into their own language, and forthwith it is something entirely different.
+ -- Johann Wolfgang von Goethe
+%
+Mathematicians often resort to something called Hilbert space, which is
+described as being n-dimensional. Like modern sex, any number can
+play.
+ -- Dr. Thor Wald, in "Beep/The Quincunx of Time", by
+ James Blish
+%
+Mathematicians practice absolute freedom.
+ -- Henry Adams
+%
+Mathematics deals exclusively with the relations of concepts
+to each other without consideration of their relation to experience.
+ -- Albert Einstein
+%
+Mathematics is the only science where one never knows what
+one is talking about nor whether what is said is true.
+ -- Russell
+%
+Mathematics, rightly viewed, possesses not only truth but supreme beauty --
+a beauty cold and austere, like that of a sculpture, without appeal to any
+part of our weaker nature, without the gorgeous trapping of painting or music,
+yet sublimely pure, and capable of a stern perfection such as only the
+greatest art can show. The true spirit of delight, the exaltation, the sense
+of being more than man, which is the touchstone of the highest excellence, is
+to be found in mathematics as surely as in poetry.
+ -- Bertrand Russell
+%
+Matrimony is the root of all evil.
+%
+Matrimony isn't a word, it's a sentence.
+%
+Matter cannot be created or destroyed,
+nor can it be returned without a receipt.
+%
+Matter will be damaged in direct proportion to its value.
+%
+[Maturity consists in the discovery that] there comes a critical moment
+where everything is reversed, after which the point becomes to understand
+more and more that there is something which cannot be understood.
+ -- S. A. Kierkegaard (1813-1855)
+%
+Maturity is only a short break in adolescence.
+ -- Jules Feiffer
+%
+Matz's Law:
+ A conclusion is the place where you got tired of thinking.
+%
+May a hundred thousand midgets invade your home singing cheezy lounge-lizard
+versions of songs from The Wizard of Oz.
+%
+May a Misguided Platypus lay its Eggs in your Jockey Shorts
+%
+May all your Emus lay soft boiled eggs, and may all your
+Kangaroos be born with iPods already fitted.
+ -- Aussie New Years wish, found on hasselbladinfo.com
+%
+May all your PUSHes be POPped.
+%
+May Euell Gibbons eat your only copy of the manual!
+%
+May the bluebird of happiness twiddle your bits.
+%
+May the Fleas of a Thousand Camels infest one of your Erogenous Zones.
+%
+May the fleas of a thousand camels infest your armpits.
+%
+May those that love us love us; and those that don't love us, may
+God turn their hearts; and if he doesn't turn their hearts, may
+he turn their ankles so we'll know them by their limping.
+%
+May you die in bed at 95, shot by a jealous spouse.
+%
+May you have many beautiful and obedient daughters.
+%
+May you have many handsome and obedient sons.
+%
+May you have warm words on a cold evening,
+a full moon on a dark night,
+and a smooth road all the way to your door.
+%
+May you live in uninteresting times.
+ -- Chinese proverb
+%
+May your camel be as swift as the wind.
+%
+May your SO always know when you need a hug.
+%
+May your Tongue stick to the Roof of your
+Mouth with the Force of a Thousand Caramels.
+%
+Maybe ain't ain't so correct, but I notice that
+lots of folks who ain't using ain't ain't eatin' well.
+ -- Will Rogers
+%
+Maybe Computer Science should be in the College of Theology.
+ -- R. S. Barton
+%
+Maybe Jesus was right when he said that the meek shall inherit the
+earth -- but they inherit very small plots, about six feet by three.
+ -- Lazarus Long
+%
+Maybe we can get together and show off to each other sometimes.
+%
+Maybe we should think of this as one perfect week... where we found each
+other, and loved each other... and then let each other go before anyone
+had to seek professional help.
+%
+Maybe you can't buy happiness, but
+these days you can certainly charge it.
+%
+May's Law:
+ The quality of correlation is inversely proportional to the density
+ of control. (The fewer the data points, the smoother the curves.)
+%
+McDonald's -- Because you're worth it.
+%
+McEwan's Rule of Relative Importance:
+ When traveling with a herd of elephants,
+ don't be the first to lie down and rest.
+%
+Meader's Law:
+ Whatever happens to you, it will previously
+ have happened to everyone you know, only more so.
+%
+Meade's Maxim:
+Always remember that you are absolutely unique,
+just like everyone else.
+%
+Meanehwael, baccat meaddehaele, monstaer lurccen;
+Fulle few too many drincce, hie luccen for fyht.
+[D]en Hreorfneorht[d]hwr, son of Hrwaerow[p]heororthwl,
+AEsccen aewful jeork to steop outsyd.
+[P]hud! Bashe! Crasch! Beoom! [D]e bigge gye
+Eallum his bon brak, byt his nose offe;
+Wicced Godsylla waeld on his asse.
+Monstaer moppe fleor wy[p] eallum men in haelle.
+Beowulf in bacceroome fonecall bemaccen waes;
+Hearen sond of ruccus saed, "Hwaet [d]e helle?"
+Graben sheold strang ond swich-blaed scharp
+Sond feorth to fyht [d]e grimlic foe.
+"Me," Godsylla saed, "mac [d]e minsemete."
+Heoro cwyc geten heold wi[p] faemed half-nelson
+Ond flyng him lic frisbe bac to fen.
+Beowulf belly up to meaddehaele bar,
+Saed, "Ne foe beaten mie faersom cung-fu."
+Eorderen cocca-colha yce-coeld, [d]e reol [p]yng.
+%
+Meantime, in the slums below Ronnie's Ranch, Cynthia feels as if some one
+has made voodoo boxen of her and her favorite backplanes. On this fine
+moonlit night, some horrible persona has been jabbing away at, dragging
+magnets over, and surging these voodoo boxen. Fortunately, they seem to
+have gotten a bit bored and fallen asleep, for it looks like Cynthia may
+get to go home. However, she has made note to quickly put together a totem
+of sweaty, sordid static straps, random bits of wire, flecks of once meaningful
+oxide, bus grant cards, gummy worms, and some bits of old pdp backplane to
+hang above the machine room. This totem must be blessed by the old and wise
+venerable god of unibus at once, before the idolatization of vme, q and pc
+bus drive him to bitter revenge. Alas, if this fails, and the voodoo boxen
+aren't destroyed, there may be more than worms in the apple. Next, the
+arrival of voodoo optico transmitigational magneto killer paramecium, capable
+of teleporting from cable to cable, screen to screen, ear to ear and hoof
+to mouth...
+%
+Measure twice, cut once.
+%
+Mediocrity finds safety in standardization.
+ -- Frederick Crane
+%
+Meekness is uncommon patience in planning a worthwhile revenge.
+%
+Meester, do you vant to buy a duck?
+%
+Meeting, n.:
+ An assembly of people coming together to decide what person or
+ department not represented in the room must solve a problem.
+%
+MEETINGS:
+ A place where minutes are kept and hours are lost.
+%
+Meetings are an addictive, highly self indulgent activity that
+corporations and other large organizations habitually engage
+in only because they cannot actually masturbate.
+ -- Dave Barry
+%
+MEMO:
+ An interoffice communication too often written more for
+ the benefit of the person who sends it than the person
+ who receives it.
+%
+MEMORIES OF MY FAMILY MEETINGS still are a source of strength to me. I
+remember we'd all get into the car -- I forget what kind it was -- and
+drive and drive.
+
+I'm not sure where we'd go, but I think there were some bees there. The
+smell of something was strong in the air as we played whatever sport we
+played. I remember a bigger, older guy whom we called "Dad." We'd eat
+some stuff or not and then I think we went home.
+
+I guess some things never leave you.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Memory fault -- brain fried
+%
+Memory fault -- core...uh...um...core... Oh dammit, I forget!
+%
+Memory fault - where am I?
+%
+Memory should be the starting point of the present.
+%
+Men are always ready to respect anything that bores them.
+ -- Marilyn Monroe
+%
+Men are superior to women.
+ -- The Koran
+%
+Men are those creatures with two legs and eight hands.
+ -- Jayne Mansfield
+%
+Men aren't attracted to me by my mind.
+They're attracted by what I don't mind...
+ -- Gypsy Rose Lee
+%
+Men freely believe that what they wish to desire.
+ -- Julius Caesar
+%
+Men have a much better time of it than women; for one
+thing they marry later; for another thing they die earlier.
+ -- H. L. Mencken
+%
+Men have as exaggerated an idea of their
+rights as women have of their wrongs.
+ -- Edgar W. Howe
+%
+Men live for three things, fast cars, fast women and fast food.
+%
+Men love to wonder, and that is the seed of science.
+%
+Men never do evil so completely and cheerfully as when they do it
+from religious conviction.
+ -- Blaise Pascal, "Pens'ees", 1670
+%
+Men never make passes at girls wearing glasses.
+ -- Dorothy Parker
+%
+Men occasionally stumble over the truth, but most of them
+pick themselves up and hurry off as if nothing had happened.
+ -- Winston Churchill
+%
+Men of lofty genius when they are doing the least work are most active.
+ -- Leonardo da Vinci
+%
+Men of quality are not afraid of women for equality.
+%
+Men often believe -- or pretend -- that the "Law" is something sacred, or
+at least a science -- an unfounded assumption very convenient to governments.
+%
+Men ought to know that from the brain and from the brain only arise our
+pleasures, joys, laughter, and jests as well as our sorrows, pains, griefs
+and tears. ... It is the same thing which makes us mad or delirious,
+inspires us with dread and fear, whether by night or by day, brings us
+sleeplessness, inopportune mistakes, aimless anxieties, absent-mindedness
+and acts that are contrary to habit...
+ -- Hippocrates, "The Sacred Disease"
+%
+Men say of women what pleases them; women do with men what pleases them.
+ -- DeSegur
+%
+Men seldom show dimples to girls who have pimples.
+%
+Men still remember the first kiss after women have forgotten the last.
+%
+Men take only their needs into consideration -- never their abilities.
+ -- Napoleon Bonaparte
+%
+Men use thought only to justify their wrong doings,
+and speech only to conceal their thoughts.
+ -- Voltaire
+%
+Men were real men, women were real women, and small, furry creatures
+from Alpha Centauri were REAL small, furry creatures from Alpha Centauri.
+Spirits were brave, men boldly split infinitives that no man had split
+before. Thus was the Empire forged.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Men who cherish for women the highest
+respect are seldom popular with them.
+ -- Joseph Addison
+%
+Mencken and Nathan's Fifteenth Law of The Average American:
+ The worst actress in the company is always the manager's wife.
+%
+Mencken and Nathan's Ninth Law of The Average American:
+ The quality of a champagne is judged by the amount of noise the
+ cork makes when it is popped.
+%
+Mencken and Nathan's Second Law of The Average American:
+ All the postmasters in small towns read all the postcards.
+%
+Mencken and Nathan's Sixteenth Law of The Average American:
+ Milking a cow is an operation demanding a special talent that
+ is possessed only by yokels, and no person born in a large city
+ can never hope to acquire it.
+%
+Mene, mene, tekel, upharsin.
+%
+Mental power tended to corrupt, and absolute intelligence tended to
+corrupt absolutely, until the victim eschewed violence entirely in
+favor of smart solutions to stupid problems.
+ -- Piers Anthony
+%
+Mental things which have not gone in through the
+senses are vain and bring forth no truth except detrimental.
+ -- Leonardo
+%
+Menu, n.:
+ A list of dishes which the restaurant has just run out of.
+%
+Meskimen's Law:
+ There's never time to do it right, but there's always time to
+ do it over.
+%
+MESSAGE ACKNOWLEDGED -- The Pershing II missiles have been launched.
+%
+Message from Our Sponsor on ttyTV at 13:58 ...
+%
+Message will arrive in the mail.
+Destroy, before the FBI sees it.
+%
+METEOROLOGIST:
+ One who doubts the established fact that it is
+ bound to rain if you forget your umbrella.
+%
+Metermaids eat their young.
+%
+methionylglutaminylarginyltyrosylglutamylserylleucylphenylalanylalanylglutamin-
+ylleucyllysylglutamylarginyllysylglutamylglycylalanylphenylalanylvalylprolyl-
+phenylalanylvalylthreonylleucylglycylaspartylprolylglycylisoleucylglutamylglu-
+taminylserylleucyllysylisoleucylaspartylthreonylleucylisoleucylglutamylalanyl-
+glycylalanylaspartylalanylleucylglutamylleucylglycylisoleucylprolylphenylala-
+nylserylaspartylprolylleucylalanylaspartylglycylprolylthreonylisoleucylgluta-
+minylasparaginylalanylthreonylleucylarginylalanylphenylalanylalanylalanylgly-
+cylvalylthreonylprolylalanylglutaminylcysteinylphenylalanylglutamylmethionyl-
+leucylalanylleucylisoleucylarginylglutaminyllysylhistidylprolylthreonylisoleu-
+cylprolylisoleucylglycylleucylleucylmethionyltyrosylalanylasparaginylleucylva-
+lylphenylalanylasparaginyllysylglycylisoleucylaspartylglutamylphenylalanyltyro-
+sylalanylglutaminylcysteinylglutamyllysylvalylglycylvalylaspartylserylvalylleu-
+cylvalylalanylaspartylvalylprolylvalylglutaminylglutamylserylalanylprolylphe-
+nylalanylarginylglutaminylalanylalanylleucylarginylhistidylasparaginylvalylala-
+nylprolylisoleucylphenylalanylisoleucylcysteinylprolylprolylaspartylalanylas-
+partylaspartylaspartylleucylleucylarginylglutaminylisoleucylalanylseryltyrosyl-
+glycylarginylglycyltyrosylthreonyltyrosylleucylleucylserylarginylalanylglycyl-
+valylthreonylglycylalanylglutamylasparaginylarginylalanylalanylleucylprolylleu-
+cylasparaginylhistidylleucylvalylalanyllysylleucyllysylglutamyltyrosylasparagi-
+nylalanylalanylprolylprolylleucylglutaminylglycylphenylalanylglycylisoleucylse-
+rylalanylprolylaspartylglutaminylvalyllysylalanylalanylisoleucylaspartylalanyl-
+glycylalanylalanylglycylalanylisoleucylserylglycylserylalanylisoleucylvalylly-
+sylisoleucylisoleucylglutamylglutaminylhistidylasparaginylisoleucylglutamylpro-
+lylglutamyllysylmethionylleucylalanylalanylleucyllysylvalylphenylalanylvalyl-
+glutaminylprolylmethionyllysylalanylalanylthreonylarginylserine, n.:
+ The chemical name for tryptophan synthetase A protein, a
+ 1,913-letter enzyme with 267 amino acids.
+ -- Mrs. Byrne's Dictionary of Unusual, Obscure, and
+ Preposterous Words
+%
+Mickey Mouse wears a Spiro Agnew watch.
+%
+MICRO:
+ Thinker toys.
+%
+Micro Credo:
+ Never trust a computer bigger than you can lift.
+%
+Microbiology Lab: Staph Only!
+%
+Microwave oven? Whaddya mean, it's a microwave oven? I've been
+watching Channel 4 on the thing for two weeks.
+%
+Microwaves frizz your heir.
+%
+Mieux vaut tard que jamais!
+%
+Might as well be frank, monsieur. It would take a miracle to
+get you out of Casablanca and the Germans have outlawed miracles.
+ -- Signor Ferrari, "Casablanca" (1942)
+%
+Mike: "The Fourth Dimension is a shambles?"
+Bernie: "Nobody ever empties the ashtrays. People are SO
+ inconsiderate."
+ -- Gary Trudeau, "Doonesbury"
+%
+Miksch's Law:
+ If a string has one end, then it has another end.
+%
+Militant agnostic: I don't know, and you don't either.
+%
+Military intelligence is a contradiction in terms.
+ -- Groucho Marx
+%
+Military justice is to justice what military music is to music.
+ -- Groucho Marx
+%
+Miller's Slogan:
+ Lose a few, lose a few.
+%
+Millihelen, adj.:
+ The amount of beauty required to launch one ship.
+%
+Millions long for immortality who do not know what
+to do with themselves on a rainy Sunday afternoon.
+ -- Susan Ertz
+%
+Millions of sensible people are too high-minded to concede that politics is
+almost always the choice of the lesser evil. "Tweedledum and Tweedledee,"
+they say. "I will not vote." Having abstained, they are presented with a
+President who appoints the people who are going to rummage around in their
+lives for the next four years. Consider all the people who sat home in a
+stew in 1968 rather than vote for Hubert Humphrey. They showed Humphrey.
+Those people who taught Hubert Humphrey a lesson will still be enjoying the
+Nixon Supreme Court when Tricia and Julie begin to find silver threads among
+the gold and the black.
+ -- Russel Baker, "Ford without Flummery"
+%
+Mind! I don't mean to say that I know, of my own knowledge, what there is
+particularly dead about a door-nail. I might have been inclined, myself,
+to regard a coffin-nail as the deadest piece of ironmongery in the trade.
+But the wisdom of our ancestors is in the simile; and my unhallowed hands
+shall not disturb it, or the Country's done for. You will therefore permit
+me to repeat, emphatically, that Marley was as dead as a door-nail.
+%
+Mind your own business, Spock. I'm sick of your halfbreed interference.
+%
+Mind your own business, then you don't mind mine.
+%
+Minicomputer:
+ A computer that can be afforded on the budget of a middle-level
+ manager.
+%
+Minnesota --
+ home of the blonde hair and blue ears.
+ mosquito supplier to the free world.
+ come fall in love with a loon.
+ where visitors turn blue with envy.
+ one day it's warm, the rest of the year it's cold.
+ land of many cultures -- mostly throat.
+ where the elite meet sleet.
+ glove it or leave it.
+ many are cold, but few are frozen.
+ land of the ski and home of the crazed.
+ land of 10,000 Petersons.
+%
+Minnie Mouse is a slow maze learner.
+%
+Minors in Kansas City, Missouri, are not allowed to purchase cap
+pistols; they may buy shotguns freely, however.
+%
+MIPS:
+ Meaningless Indicator of Processor Speed
+%
+Mirrors should reflect a little before throwing back images.
+ -- Jean Cocteau
+%
+Misery loves company, but company does not reciprocate.
+%
+Misery no longer loves company.
+Nowadays it insists on it.
+ -- Russell Baker
+%
+Misfortune, n.:
+ The kind of fortune that never misses.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Misfortunes arrive on wings and leave on foot.
+%
+Miss, n.:
+ A title with which we brand unmarried
+ women to indicate that they are in the market.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Mistakeholder, n.:
+ A person who depends on accidental features or
+ implementation errors and so now has a vested
+ interest in keeping things from being fixed.
+ -- Chip Morningstar
+%
+Mistakes are often the stepping stones to utter failure.
+%
+Mistrust first impulses; they are always right.
+%
+MIT:
+ The Georgia Tech of the North
+%
+Mitchell's Law of Committees:
+ Any simple problem can be made insoluble
+ if enough meetings are held to discuss it.
+%
+Mittsquinter, adj.:
+ A ballplayer who looks into his glove after missing the ball,
+ as if, somehow, the cause of the error lies there.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Mix a little foolishness with your serious plans;
+it's lovely to be silly at the right moment.
+ -- Horace
+%
+Mixed emotions:
+ Watching a bus-load of lawyers plunge off a cliff.
+ With five empty seats.
+%
+Mix's Law:
+ There is nothing more permanent than a temporary building.
+ There is nothing more permanent than a temporary tax.
+%
+MOCK APPLE PIE (No Apples Needed)
+
+ Pastry to two crust 9-inch pie 36 RITZ Crackers
+2 cups water 2 cups sugar
+2 teaspoons cream of tartar 2 tablespoons lemon juice
+ Grated rind of one lemon Butter or margarine
+ Cinnamon
+
+Roll out bottom crust of pastry and fit into 9-inch pie plate. Break
+RITZ Crackers coarsely into pastry-lined plate. Combine water, sugar
+and cream of tartar in saucepan, boil gently for 15 minutes. Add lemon
+juice and rind. Cool. Pour this syrup over Crackers, dot generously
+with butter or margarine and sprinkle with cinnamon. Cover with top
+crust. Trim and flute edges together. Cut slits in top crust to let
+steam escape. Bake in a hot oven (425 F) 30 to 35 minutes, until crust
+is crisp and golden. Serve warm. Cut into 6 to 8 slices.
+ -- Found lurking on a Ritz Crackers box
+%
+Modeling paged and segmented memories is tricky business.
+ -- P. J. Denning
+%
+Modem, adj.:
+ Up-to-date, new-fangled, as in "Thoroughly Modem Millie." An
+ unfortunate byproduct of kerning.
+%
+Moderation in all things.
+ -- Publius Terentius Afer [Terence]
+%
+Moderation is a fatal thing. Nothing succeeds like excess.
+ -- Oscar Wilde
+%
+Modern art is what happens when painters stop looking at girls and persuade
+themselves that they have a better idea.
+ -- John Ciardi
+%
+Modern man is the missing link between apes and human beings.
+%
+Modern psychology takes completely for granted that behavior and neural
+function are perfectly correlated, that one is completely caused by the
+other. There is no separate soul or lifeforce to stick a finger into the
+brain now and then and make neural cells do what they would not otherwise.
+Actually, of course, this is a working assumption only. ... It is quite
+conceivable that someday the assumption will have to be rejected. But it
+is important also to see that we have not reached that day yet: the working
+assumption is a necessary one and there is no real evidence opposed to it.
+Our failure to solve a problem so far does not make it insoluble. One cannot
+logically be a determinist in physics and biology, and a mystic in psychology.
+ -- D. O. Hebb, "Organization of Behavior:
+ A Neuropsychological Theory", 1949
+%
+MODESTY:
+ Being comfortable that others will discover your greatness.
+%
+Modesty is a vastly overrated virtue.
+ -- J. K. Galbraith
+%
+Modesty: the gentle art of enhancing your charm by pretending
+ not to be aware of it.
+ -- Oliver Herford
+%
+Moe: Wanna play poker tonight?
+Joe: I can't. It's the kids' night out.
+Moe: So?
+Joe: I gotta stay home with the nurse.
+%
+Moe: What did you give your wife for Valentine's Day?
+Joe: The usual gift -- she ate my heart out.
+%
+Moebius always does it on the same side.
+%
+Moebius strippers never show you their back side.
+%
+Mohandas K. Gandhi often changed his mind publicly. An aide once asked him
+how he could so freely contradict this week what he had said just last week.
+The great man replied that it was because this week he knew better.
+%
+Moishe Margolies, who weighed all of 105 pounds and stood an even five feet
+in his socks, was taking his first airplane trip. He took a seat next to a
+hulking bruiser of a man who happened to be the heavyweight champion of
+the world. Little Moishe was uneasy enough before he even entered the plane,
+but now the roar of the engines and the great height absolutely terrified him.
+So frightened did he become that his stomach turned over and he threw up all
+over the muscular giant siting beside him. Fortunately, at least for Moishe,
+the man was sound asleep. But now the little man had another problem. How in
+the world would he ever explain the situation to the burly brute when he
+awakened? The sudden voice of the stewardess on the plane's intercom, finally
+woke the bruiser, and Moishe, his heart in his mouth, rose to the occasion.
+ "Feeling better now?" he asked solicitously.
+%
+Molecule, n.:
+ The ultimate, indivisible unit of matter. It is distinguished from
+ the corpuscle, also the ultimate, indivisible unit of matter, by a
+ closer resemblance to the atom, also the ultimate, indivisible unit
+ of matter... The ion differs from the molecule, the corpuscle and
+ the atom in that it is an ion...
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Mollison's Bureaucracy Hypothesis:
+ If an idea can survive a bureaucratic review
+ and be implemented it wasn't worth doing.
+%
+MOMENTUM:
+ What you give a person when they are going away.
+%
+Mommy, what happens to your files when you die?
+%
+Mom's Law:
+ When they finally do have to take you to the
+ hospital, your underwear won't be clean or new.
+%
+Monday is an awful way to spend one seventh of your life.
+%
+Monday, n.:
+ In Christian countries, the day after the baseball game.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Monday, n.:
+ In Christian countries, the day after the football game.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Money and women are the most sought after and the least known of any two
+things we have.
+ -- The Best of Will Rogers
+%
+Money cannot buy love, nor even friendship.
+%
+Money cannot buy
+The fuel of love
+but is excellent kindling.
+
+To the man-in-the-street, who, I'm sorry to say,
+Is a keen observer of life,
+The word intellectual suggests right away
+A man who's untrue to his wife.
+ -- W. H. Auden, "Collected Shorter Poems"
+%
+Money can't buy happiness, but it can make you
+awfully comfortable while you're being miserable.
+ -- C. B. Luce
+%
+Money can't buy love, but it improves your bargaining position.
+ -- Christopher Marlowe
+%
+Money doesn't talk, it swears.
+ -- Bob Dylan
+%
+Money is a powerful aphrodisiac. But flowers work almost as well.
+ -- Lazarus Long
+%
+Money is better than poverty, if only for financial reasons.
+%
+Money is its own reward.
+%
+Money is the root of all evil, and man needs roots.
+%
+Money is the root of all wealth.
+%
+Money is truthful. If a man speaks of his honor, make him pay cash.
+ -- Lazarus Long
+%
+Money isn't everything -- but it's a long way ahead of what comes next.
+ -- Sir Edmond Stockdale
+%
+Money may buy friendship but money cannot buy love.
+%
+Money may not buy happiness, but it sure
+puts you in a great bargaining position.
+%
+Money will say more in one moment than
+the most eloquent lover can in years.
+%
+Moneyliness is next to Godliness.
+ -- Andries van Dam
+%
+Monogamy is the Western custom of one wife and hardly any mistresses.
+ -- H. H. Munro
+%
+MONOTONY:
+ Marriage to one woman at a time.
+%
+MONTANA:
+ A grizzly bear praying for the early arrival of cable television.
+%
+MONTANA:
+ Where forty-three below keeps out the riff-raff.
+%
+Monterey... is decidedly the pleasantest and most civilized-looking place
+in California ... [it] is also a great place for cock-fighting, gambling
+of all sorts, fandangos, and various kinds of amusements and knavery.
+ -- Richard Henry Dama, "Two Years Before the Mast", 1840
+%
+Moon, n.:
+ 1. A celestial object whose phase is very important to
+hackers. See PHASE OF THE MOON. 2. Dave Moon (MOON@MC).
+%
+Moore's Constant:
+ Everybody sets out to do something, and everybody
+ does something, but no one does what he sets out to do.
+%
+Mophobia, n.:
+ Fear of being verbally abused by a Mississippian.
+%
+More are taken in by hope than by cunning.
+ -- Vauvenargues
+%
+More computing sins are committed in the name of efficiency (without
+necessarily achieving it) than for any other single reason -- including
+blind stupidity.
+ -- W. A. Wulf
+%
+More people are flattered into virtue than bullied out of vice.
+ -- R. S. Surtees
+%
+More people died at Chappaquidick than at 3-mile island.
+%
+More people have died in Ted Kennedy's car than in nuclear power plants.
+%
+MORE SPORTS RESULTS:
+The Beverly Hills Freudians tied the Chicago Rogerians 0-0 last Saturday
+night. The match started with a long period of silence while the Freudians
+waited for the Rogerians to free associate and the Rogerians waited for
+the Freudians to say something they could paraphrase. The stalemate was
+broken when the Freudians' best player took the offensive and interpreted
+the Rogerians' silence as reflecting their anal-retentive personalities.
+At this the Rogerians' star player said "I hear you saying you think we're
+full of ka-ka." This started a fight and the match was called by officials.
+%
+More than any time in history, mankind now faces a crossroads. One path
+leads to despair and utter hopelessness, the other to total extinction.
+Let us pray that we have the wisdom to choose correctly.
+ -- Woody Allen, "Side Effects"
+%
+Morris had been down on his luck for months, and, though not a devoutly
+religious man, had begun to visit the local synagogue to ask God's help.
+One week, out of desperation, he prayed, "God, I've been a good and decent
+man all my life. Would it be so terrible if You let me win the lottery
+just once?"
+ The despondent fellow returned week after week. One day, Morris,
+nearly hopeless now, prayed, "God, I've never asked You for anything before.
+I just want to win one little lottery."
+ "As he dejectedly rose to leave, God's voice boomed, "Morris, at
+least meet Me halfway on this. Buy a ticket!"
+%
+Morton's Law:
+ If rats are experimented upon, they will develop cancer.
+%
+Mos Eisley Spaceport; you'll not find a more
+wretched collection of villainy and disreputable types...
+ -- Obi-wan Kenobi, "Star Wars"
+%
+Mosher's Law of Software Engineering:
+ Don't worry if it doesn't work right.
+ If everything did, you'd be out of a job.
+%
+MOSQUITO:
+ The state bird of New Jersey.
+%
+Most burning issues generate far more heat than light.
+%
+Most fish live underwater, which is a terrible place to have sex
+because virtually anywhere you lie down there will be stinging crabs
+and large quantities of little fish staring at you with buggy little
+eyes. So generally when two fish want to have sex, they swim around
+and around for hours, looking for someplace to go, until finally the
+female gets really tired and has a terrible headache, and she just
+dumps her eggs right on the sand and swims away. Then the male, driven
+by some timeless, noble instinct for survival, eats the eggs. So the
+truth is that fish don't reproduce at all, but there are so many of
+them that it doesn't make any difference.
+ -- Dave Barry, "Sex and the Single Amoeba: What Every
+ Teen Should Know"
+%
+Most folks they like the daytime,
+ 'cause they like to see the shining sun.
+They're up in the morning,
+ off and a-running till they're too tired for having fun.
+But when the sun goes down,
+ and the bright lights shine, my daytime has just begun.
+
+Now there are two sides to this great big world,
+ and one of them is always night.
+If you can take care of business in the sunshine, baby,
+ I guess you're gonna be all right.
+Don't come looking for me to lend you a hand.
+ My eyes just can't stand the light.
+
+'Cause I'm a night owl honey, sleep all day long.
+ -- Carly Simon
+%
+Most general statements are false, including this one.
+ -- Alexander Dumas
+%
+Most of our lives are about proving something,
+either to ourselves or to someone else.
+%
+Most of the fear that spoils our life comes from attacking
+difficulties before we get to them.
+ -- Dr. Frank Crane
+%
+...most of us learned about love the hard way. Even warnings are probably
+useless, for somehow, despite the severest warnings of parents and friends,
+hundreds, thousands of women have forgotten themselves at the last minute
+and succumbed to the lies, promises, flatteries, or mere attentions of
+lusting, lovely men, landing themselves in complicated predicaments from
+which some of them never recovered during their entire lives. And I am not
+speaking only of your teenaged Midwesterners in 1958; I'm speaking of women
+of every age in every city in every year. The notorious sexual revolution
+has saved no one from the pain and confusion of love.
+ -- Alix Kates Shulman
+%
+Most of your faults are not your fault.
+%
+Most people are too busy to have time for anything important.
+%
+Most people are unable to write because they are unable to think, and
+they are unable to think because they congenitally lack the equipment
+to do so, just as they congenitally lack the equipment to fly over the
+moon.
+ -- H. L. Mencken
+%
+Most people can do without the essentials, but not without the luxuries.
+%
+Most people can't understand how others can blow their noses differently
+than they do.
+ -- Turgenev
+%
+Most people deserve each other.
+ -- Shirley
+%
+Most people don't need a great deal of love
+nearly so much as they need a steady supply.
+%
+Most people eat as though they were fattening themselves for market.
+ -- Edgar W. Howe
+%
+Most people feel that everyone is entitled to their opinion.
+%
+Most people have a furious itch to talk about themselves and are restrained
+only by the disinclination of others to listen. Reserve is an artificial
+quality that is developed in most of us as the result of innumerable rebuffs.
+ -- W. Somerset Maugham
+%
+Most people have a mind that's open by appointment only.
+%
+Most people have two reasons for doing anything --
+a good reason, and the real reason.
+%
+Most people in this society who aren't actively mad are,
+at best, reformed or potential lunatics.
+ -- Susan Sontag
+%
+Most people need some of their problems
+to help take their mind off some of the others.
+%
+Most people prefer certainty to truth.
+%
+Most people want either less corruption
+or more of a chance to participate in it.
+%
+Most people will listen to your unreasonable demands,
+if you'll consider their unacceptable offer.
+%
+Most people's favorite way to end a game is by winning.
+%
+Most public domain software is free, at least at first glance.
+%
+Most rock journalism is people who can't write interviewing people who
+can't talk for people who can't read.
+ -- Frank Zappa
+%
+Most seminars have a happy ending. Everyone's glad when they're over.
+%
+Most Texans think Hanukkah is some sort of duck call.
+ -- Richard Lewis
+%
+MOTHER:
+ Half a word.
+%
+Mother Earth is not flat!
+%
+Mother is far too clever to understand anything she does not like.
+ -- Arnold Bennett
+%
+Mother is the invention of necessity.
+%
+Mother said there would be days like this, but she never said there
+would be so many.
+%
+Mother told me to be good, but she's been wrong before.
+%
+Mothers all want their sons to grow up to be President, but they
+don't want them to become politicians in the process.
+ -- John F. Kennedy
+%
+Mothers of large families (who claim to common sense)
+Will find a Tiger will repay the trouble and expense.
+ -- Hilaire Belloc, "The Tiger"
+%
+Mount St. Helens should have used earth control.
+%
+MOUNT TAPE U1439 ON B3, NO RING
+%
+Mountain Dew and doughnuts... because breakfast is the most important meal
+of the day.
+%
+Mr. Cole's Axiom:
+ The sum of the intelligence on the planet is a constant; the
+ population is growing.
+%
+Mr. Rockford? This is Betty Joe Withers. I got four shirts of yours from
+the Bo Peep Cleaners by mistake. I don't know why they gave me men's
+shirts but they're going back.
+%
+Mr. Rockford? You don't know me, but I'd like to hire you. Could
+you call me at... My name is... uh... Never mind, forget it!
+%
+Mr. Rockford; Miss Collins from the Bureau of Licenses. We got your
+renewal before the extended deadline but not your check. I'm sorry but
+at midnight you're no longer licensed as an investigator.
+%
+Mr. Rockford, this is the Thomas Crown School of Dance and Contemporary
+Etiquette. We aren't going to call again! Now you want these free
+lessons or what?
+%
+Mr. Salter's side of the conversation was limited to expressions of assent.
+When Lord Copper was right he said "Definitely, Lord Copper"; when he was
+wrong, "Up to a point."
+ "Let me see, what's the name of the place I mean? Capital of Japan?
+Yokohama isn't it?"
+ "Up to a point, Lord Copper."
+ "And Hong Kong definitely belongs to us, doesn't it?"
+ "Definitely, Lord Copper."
+ -- Evelyn Waugh, "Scoop"
+%
+MSDOS is not dead, it just smells that way.
+ -- Henry Spencer
+%
+Much as they like to persuade us differently, lawyers are simply hired
+consultants, and at some point you time them out.
+ -- Craig Partridge
+%
+Much of the excitement we get out of our work
+is that we don't really know what we are doing.
+ -- Edsger W. Dijkstra
+%
+Much to his Mum and Dad's dismay, Horace ate himself one day.
+He didn't stop to say his grace, he just sat down and ate his face.
+"We can't have this!" his Dad declared, "If that lad's ate, he should
+ be shared."
+But even as he spoke they saw Horace eating more and more:
+First his legs and then his thighs, his arms, his nose, his hair, his eyes...
+"Stop him someone!" Mother cried, "Those eyeballs would be better fried!"
+But all too late, for they were gone, and he had started on his dong...
+"Oh! foolish child!" the father mourns "You could have deep-fried that
+ with prawns,
+Some parsley and some tartar sauce..."
+But H. was on his second course: his liver and his lights and lung,
+His ears, his neck, his chin, his tongue; "To think I raised him from the cot,
+And now he's going to scoff the lot!"
+His Mother cried: "What shall we do? What's left won't even make a stew..."
+And as she wept, her son was seen, to eat his head, his heart his spleen.
+and there he lay: a boy no more, just a stomach on the floor...
+None the less, since it *was* his, they ate it -- that's what haggis is.
+%
+Multics is security spelled sideways.
+%
+"Multiply in your head" (ordered the compassionate Dr. Adams) "365,365,365,
+365,365,365 by 365,365,365,365,365,365". He [ten-year-old Truman Henry
+Safford] flew around the room like a top, pulled his pantaloons over the
+tops of his boots, bit his hands, rolled his eyes in their sockets, sometimes
+smiling and talking, and then seeming to be in an agony, until, in not more
+than one minute, said he, 133,491,850,208,566,925,016,658,299,941,583,225!"
+An electronic computer might do the job a little faster but it wouldn't be
+as much fun to watch.
+ -- James R. Newman, "The World of Mathematics"
+%
+MUMMY:
+ An Egyptian who was pressed for time.
+%
+Mummy dust to make me old;
+To shroud my clothes, the black of night;
+To age my voice, an old hag's cackle;
+To whiten my hair, a scream of fright;
+A blast of wind to fan my hate;
+A thunderbolt to mix it well --
+Now begin thy magic spell!
+ -- The Evil Queen, "Snow White"
+%
+Mum's the word.
+ -- Miguel de Cervantes
+%
+Mundus vult decipi decipiatur ergo.
+ -- Xaviera Hollander
+
+[The world wants to be cheated, so cheat.]
+%
+Murder is always a mistake -- one should never do anything one cannot
+talk about after dinner.
+ -- Oscar Wilde, "The Picture of Dorian Gray"
+%
+Murphy was an optimist.
+%
+Murphy's Law is recursive. Washing your car to make it rain doesn't work.
+%
+Murphy's Law of Research:
+ Enough research will tend to support your theory.
+%
+Murphy's Law, that brash proletarian restatement of Godel's Theorem.
+ -- Thomas Pynchon, "Gravity's Rainbow"
+%
+Murphy's Laws:
+ (1) If anything can go wrong, it will.
+ (2) Nothing is as easy as it looks.
+ (3) Everything takes longer than you think it will.
+%
+Murray's Rule:
+ Any country with "democratic" in the title isn't.
+%
+Music in the soul can be heard by the universe.
+ -- Lao Tsu
+%
+Must be getting close to town -- we're hitting more people.
+%
+Must I hold a candle to my shames?
+ -- William Shakespeare, "The Merchant of Venice"
+%
+Mustgo, n.:
+ Any item of food that has been sitting in the refrigerator so
+ long it has become a science project.
+ -- Rich Hall & Friends, "Sniglets"
+%
+My advice to you, my violent friend, is to seek out gold and sit on it.
+ -- The Dragon to Grendel, in John Gardner's "Grendel"
+%
+My analyst told me that I was right out of my head,
+ But I said, "Dear Doctor, I think that it is you instead.
+Because I have got a thing that is unique and new,
+ To prove it I'll have the last laugh on you.
+'Cause instead of one head -- I've got two.
+
+And you know two heads are better than one.
+%
+My band career ended late in my senior year when John Cooper and I
+threw my amplifier out the dormitory window. We did not act in haste.
+First we checked to make sure the amplifier would fit through the
+frame, using the belt from my bathrobe to measure, then we picked up
+the amplifier and backed up to my bedroom door. Then we rushed
+forward, shouting "The WHO! The WHO!" and we launched my amplifier
+perfectly, as though we had been doing it all our lives, clean through
+the window and down onto the sidewalk, where a small but appreciative
+crowd had gathered. I would like to be able to say that this was a
+symbolic act, an effort on my part to break cleanly away from one state
+in my life and move on to another, but the truth is, Cooper and I
+really just wanted to find out what it would sound like. It sounded
+OK.
+ -- Dave Barry, "The Snake"
+%
+My best argument against discrimination is quite simple:
+
+Does it really matter if the ABC people are inferior to the DEF people if
+they can tell one end of a gun from the other?
+%
+My Bonnie looked into a gas tank,
+The height of its contents to see!
+She lit a small match to assist her,
+Oh, bring back my Bonnie to me.
+%
+My boy is mean kid. I came home the other day and saw him taping worms
+to the sidewalk, he sits there and watches the birds get hernias. Well,
+only last Christmas I gave him a B-B gun and he gave me a sweatshirt with
+a bulls-eye on the back.
+
+I told my kids, "Someday, you'll have kids of your own." One of them
+said, "So will you."
+ -- Rodney Dangerfield
+%
+My brain is my second favorite organ.
+ -- Woody Allen
+%
+My brother sent me a postcard the other day with this big satellite photo
+of the entire earth on it. On the back it said: "Wish you were here".
+ -- Steven Wright
+%
+My calculator is my shepherd, I shall not want
+It maketh me accurate to ten significant figures,
+ and it leadeth me in scientific notation to 99 digits.
+It restoreth my square roots and guideth me along paths of floating
+ decimal points for the sake of precision.
+Yea, tho I walk through the valley of surprise quizzes,
+ I will fear no prof, for my calculator is there to hearten me.
+It prepareth a log table to comfort me, it prepareth an
+ arc sin for me in the presence of my teachers.
+It anoints my homework with correct solutions, my interpolations are
+ over.
+Surely, both precision and accuracy shall follow me all the days of my
+ life, and I shall dwell in the house of Texas instruments forever.
+%
+My central memory of that time seems to hang on one or five or maybe forty
+nights -- or very early mornings -- when I left the Fillmore half-crazy and,
+instead of going home, aimed the big 650 Lightning across the Bay Bridge at
+a hundred miles an hour ... booming through the Treasure Island tunnel at
+the lights of Oakland and Berkeley and Richmond, not quite sure which
+turnoff to take when I got to the other end ... but being absolutely certain
+that no matter which way I went I would come to a place where people were
+just as high and wild as I was: no doubt at all about that.
+ -- Hunter S. Thompson
+%
+"My code is elegant", "Your code is sneaky", "His code is an ugly hack"
+ -- Colin Percival on irregular verbs
+%
+My cup hath runneth'd over with love.
+%
+My darling wife was always glum.
+I drowned her in a cask of rum,
+And so made sure that she would stay
+In better spirits night and day.
+%
+My doctor told me to stop having intimate dinners for four.
+Unless there are three other people.
+ -- Orson Welles
+%
+My doctorate's in Literature, but it seems like a pretty good pulse to me.
+%
+My experience with government is when things are non-controversial,
+beautifully co-ordinated and all the rest, it must be that not much
+is going on.
+ -- John F. Kennedy
+%
+My family history begins with me, but yours ends with you.
+ -- Iphicrates
+%
+My father, a good man, told me, "Never lose
+your ignorance; you cannot replace it."
+ -- Erich Maria Remarque
+%
+My father taught me three things:
+ 1: Never mix whiskey with anything but water.
+ 2: Never try to draw to an inside straight.
+ 3: Never discuss business with anyone who refuses to give his name.
+%
+My father was a God-fearing man, but he never
+missed a copy of the New York Times, either.
+ -- E. B. White
+%
+My father was a saint, I'm not.
+ -- Indira Gandhi
+%
+My favorite sandwich is peanut butter, baloney, cheddar cheese, lettuce
+and mayonnaise on toasted bread with catsup on the side.
+ -- Hubert H. Humphrey
+%
+My first basename is George "Catfish" Metkovich from our 1952 Pittsburgh
+Pirates team, which lost 112 games. After a terrible series against the
+New York Giants, in which our center fielder made three throwing errors
+and let two balls get through his legs, manager Billy Meyer pleaded, "Can
+somebody think of something to help us win a game?"
+ "I'd like to make a suggestion," Metkovich said. "On any ball hit
+to center field, let's just let it roll to see if it might go foul."
+ -- Joe Garagiola, "It's Anybody's Ball Game"
+%
+My folks didn't come over on the Mayflower,
+but they were there to meet the boat.
+%
+My friend has a baby. I'm writing down all the noises he makes so
+later I can ask him what he meant.
+ -- Steven Wright
+%
+My geometry teacher was sometimes acute, and sometimes obtuse,
+but always, always, he was right.
+%
+My girlfriend and I sure had a good time at the beach last summer. First
+she'd bury me in the sand, then I'd bury her. This summer I'm going to go
+back and dig her up.
+%
+My God, I'm depressed! Here I am, a computer with a mind a thousand times
+as powerful as yours, doing nothing but cranking out fortunes and sending
+mail about softball games. And I've got this pain right through my ALU.
+I've asked for it to be replaced, but nobody ever listens. I think it
+would be better for us both if you were to just log out again.
+%
+My, how you've changed since I've changed.
+%
+My idea of roughing it is when room service is late.
+%
+My idea of roughing it turning the air conditioner too low.
+%
+My interest is in the future because I am
+going to spend the rest of my life there.
+%
+My life is a soap opera, but who has the rights?
+ -- MadameX
+%
+My love, he's mad, and my love, he's fleet,
+ And a wild young wood-thing bore him!
+The ways are fair to his roaming feet,
+ And the skies are sunlit for him.
+As sharply sweet to my heart he seems
+ As the fragrance of acacia.
+My own dear love, he is all my dreams --
+ And I wish he were in Asia.
+ -- Dorothy Parker, part 2
+%
+My love runs by like a day in June,
+ And he makes no friends of sorrows.
+He'll tread his galloping rigadoon
+ In the pathway or the morrows.
+He'll live his days where the sunbeams start
+ Nor could storm or wind uproot him.
+My own dear love, he is all my heart --
+ And I wish somebody'd shoot him.
+ -- Dorothy Parker, part 3
+%
+My method is to take the utmost trouble to find the right
+thing to say. And then say it with the utmost levity.
+ -- George Bernard Shaw
+%
+My mind can never know my body, although
+it has become quite friendly with my legs.
+ -- Woody Allen, on Epistemology
+%
+My mother drinks to forget she drinks.
+ -- Crazy Jimmy
+%
+My mother loved children -- she would
+have given anything if I had been one.
+ -- Groucho Marx
+%
+My mother once said to me, "Elwood," (she always called me Elwood)
+"Elwood, in this world you must be oh so smart or oh so pleasant."
+For years I tried smart. I recommend pleasant.
+ -- Elwood P. Dowde, "Harvey"
+%
+My mother wants grandchildren, so I said, "Mom, go for it!"
+ -- Sue Murphy
+%
+My My, hey hey
+Rock and roll is here to stay The king is gone but he's not forgotten
+It's better to burn out This is the story of a Johnny Rotten
+Than to fade away It's better to burn out than it is to rust
+My my, hey hey The king is gone but he's not forgotten
+
+It's out of the blue and into the black Hey hey, my my
+They give you this, but you pay for that Rock and roll can never die
+And once you're gone you can never come back There's more to the picture
+When you're out of the blue Than meets the eye
+And into the black
+ -- Neil Young
+ "My My, Hey Hey (Out of the Blue), Rust Never Sleeps"
+%
+My notion of a husband at forty is that a woman should
+be able to change him, like a bank note, for two twenties.
+%
+My only love sprung from my only hate!
+Too early seen unknown, and known too late!
+ -- William Shakespeare, "Romeo and Juliet"
+%
+My opinions may have changed, but not the fact that I am right.
+%
+My own business always bores me to death; I prefer other people's.
+ -- Oscar Wilde
+%
+My own dear love, he is strong and bold
+ And he cares not what comes after.
+His words ring sweet as a chime of gold,
+ And his eyes are lit with laughter.
+He is jubilant as a flag unfurled --
+ Oh, a girl, she'd not forget him.
+My own dear love, he is all my world --
+ And I wish I'd never met him.
+ -- Dorothy Parker, part 1
+%
+My own feelings are perhaps best described by saying that I am
+perfectly aware that there is no Royal Road to Mathematics, in other
+words, that I have only a very small head and must live with it.
+ -- Edsger W. Dijkstra
+%
+My own life has been spent chronicling the rise and fall of human systems,
+and I am convinced that we are terribly vulnerable. ... We should be
+reluctant to turn back upon the frontier of this epoch. Space is indifferent
+to what we do; it has no feeling, no design, no interest in whether or not
+we grapple with it. But we cannot be indifferent to space, because the grand,
+slow march of intelligence has brought us, in our generation, to a point
+from which we can explore and understand and utilize it. To turn back now
+would be to deny our history, our capabilities.
+ -- James A. Michener
+%
+My parents went to Niagra Falls and all I got was this crummy life.
+%
+My pen is at the bottom of a page,
+Which, being finished, here the story ends;
+'Tis to be wished it had been sooner done,
+But stories somehow lengthen when begun.
+ -- Byron
+%
+My philosophy is: Don't think.
+ -- Charles Manson
+%
+My problem lies in reconciling my gross habits with my net income.
+ -- Errol Flynn
+
+Any man who has $10,000 left when he dies is a failure.
+ -- Errol Flynn
+%
+My rackets are run on strictly American
+lines, and they're going to stay that way.
+ -- Al Capone
+%
+My religion consists of a humble admiration of the illimitable superior
+spirit who reveals himself in the slight details we are able to perceive
+with our frail and feeble mind.
+ -- Albert Einstein
+%
+My ritual differs slightly. What I do, first thing [in the morning], is I
+hop into the shower stall. Then I hop right back out, because when I hopped
+in I landed barefoot right on top of See Threepio, a little plastic robot
+character from "Star Wars" whom my son, Robert, likes to pull the legs off
+of while he showers. Then I hop right back into the stall because our dog,
+Earnest, who has been alone in the basement all night building up powerful
+dog emotions, has come bounding and quivering into the bathroom and wants
+to greet me with 60 or 70 thousand playful nips, any one of which -- bear
+in mind that I am naked and, without my contact lenses, essentially blind
+-- could result in the kind of injury where you have to learn a whole new
+part if you want to sing the "Messiah," if you get my drift. Then I hop
+right back out, because Robert, with that uncanny sixth sense some children
+have -- you cannot teach it; they either have it or they don't -- has chosen
+exactly that moment to flush one of the toilets. Perhaps several of them.
+ -- Dave Barry
+%
+My schoolmates would make love to anything that moved, but I never saw any
+reason to limit myself.
+ -- Emo Philips
+%
+My sister opened a computer store in Hawaii.
+She sells C shells by the seashore.
+%
+My soul is crushed, my spirit sore
+I do not like me anymore,
+I cavil, quarrel, grumble, grouse,
+I ponder on the narrow house
+I shudder at the thought of men
+I'm due to fall in love again.
+ -- Dorothy Parker, "Enough Rope"
+%
+My theology, briefly, is that the universe was dictated but not signed.
+ -- Christopher Morley
+%
+My uncle was the town drunk -- and we lived in Chicago.
+ -- George Gobel
+%
+My way of joking is to tell the truth.
+That's the funniest joke in the world.
+ -- Muhammad Ali
+%
+My weight is perfect for my height -- which varies.
+%
+Mystics always hope that science will some day overtake them.
+ -- Booth Tarkington
+%
+Mythology, n.:
+ The body of a primitive people's beliefs, concerning its origin,
+ early history, heroes, deities and so forth, as distinguished
+ from the true accounts which it invents later.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Naches (rhymes with Bach' us, with "Bach" pronounced like the composer)
+is what every Jewish parent wants from their children, lots of good
+returns, good grades, good spouse, good grandchildren.
+
+So, now that you all understand naches, the joke:
+
+Two Jewish women are sitting having coffee.
+ "So, how's your daughter?"
+ "Oh, Rachel! She's fine, she just married a dentist!"
+ "Really? Isn't she the one that married the lawyer?"
+ "Yes, that's my Rachel."
+ "That's... that's nice. But isn't she the same one that married
+ the doctor?"
+ "Yes, that's her!"
+ "But didn't she marry a bank executive before that?"
+ "Yes, yes!"
+ "Ahhh. So much naches from one child!"
+%
+Nachman's Rule:
+ When it comes to foreign food, the less authentic the better.
+ -- Gerald Nachman
+%
+Nadia Comaneci, simple perfection.
+ -- '76 Olympics
+%
+'Naomi, sex at noon taxes.' I moan.
+Never odd or even.
+A man, a plan, a canal, Panama.
+Madam, I'm Adam.
+Sit on a potato pan, Otis.
+ -- The Mad Palindromist
+%
+NAPOLEON: What shall we do with this soldier, Giuseppe? Everything he
+ says is wrong.
+GIUSEPPE: Make him a general, Excellency, and then everything he says
+ will be right.
+ -- George Bernard Shaw, "The Man of Destiny"
+%
+Narcolepulacyi, n.:
+ The contagious action of yawning, causing everyone in sight
+ to also yawn.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Nasrudin called at a large house to collect for charity. The servant said
+"My master is out." Nasrudin replied, "Tell your master that next time he
+goes out, he should not leave his face at the window. Someone might steal
+it."
+%
+Nasrudin returned to his village from the imperial capital, and the villagers
+gathered around to hear what had passed. "At this time," said Nasrudin, "I
+only want to say that the King spoke to me." All the villagers but the
+stupidest ran off to spread the wonderful news. The remaining villager
+asked, "What did the King say to you?" "What he said -- and quite distinctly,
+for everyone to hear -- was 'Get out of my way!'" The simpleton was overjoyed;
+he had heard words actually spoken by the King, and seen the very man they
+were spoken to.
+%
+Nasrudin walked into a shop one day, and the owner came forward to serve
+him. Nasrudin said, "First things first. Did you see me walk into your
+shop?"
+ "Of course."
+ "Have you ever seen me before?"
+ "Never."
+ "Then how do you know it was me?"
+%
+Nasrudin walked into a teahouse and declaimed, "The moon is more useful
+than the sun."
+ "Why?", he was asked.
+ "Because at night we need the light more."
+%
+Nasrudin was carrying home a piece of liver and the recipe for liver pie.
+Suddenly a bird of prey swooped down and snatched the piece of meat from
+his hand. As the bird flew off, Nasrudin called after it, "Foolish bird!
+You have the liver, but what can you do with it without the recipe?"
+%
+National security is in your hands - guard it well.
+%
+Natives who beat drums to drive off evil spirits are objects of
+scorn to smart Americans who blow horns to break up traffic jams.
+ -- Mary Ellen Kelly
+%
+Natural laws have no pity.
+%
+Naturally the common people don't want war... but after all it is the leaders
+of a country who determine the policy, and it is always a simple matter to
+drag the people along, whether it is a democracy, or a fascist dictatorship,
+or a parliament, or a communist dictatorship. Voice or no voice, the people
+can always be brought to the bidding of the leaders. That is easy. All you
+have to do is tell them they are being attacked, and denounce the pacifists
+for lack of patriotism and exposing the country to danger. It works the same
+in every country.
+ -- Hermann Goering
+%
+Nature abhors a hero. For one thing, he violates the law of conservation
+of energy. For another, how can it be the survival of the fittest when the
+fittest keeps putting himself in situations where he is most likely to be
+creamed?
+ -- Solomon Short
+%
+Nature abhors a virgin -- a frozen asset.
+ -- Clare Booth Luce
+%
+Nature and nature's laws lay hid in night,
+God said, "Let Newton be," and all was light.
+
+It did not last; the devil howling "Ho!
+Let Einstein be!" restored the status quo.
+%
+Nature has given women so much power that the law has very wisely
+given them little.
+ -- Dr. Samuel Johnson
+%
+Nature is by and large to be found out of doors, a location where, it
+cannot be argued, there are never enough comfortable chairs.
+ -- Fran Lebowitz
+%
+Nature makes boys and girls lovely to look upon so they can be
+tolerated until they acquire some sense.
+ -- William Phelps
+%
+Nature to all things fixed the limits fit,
+And wisely curbed proud man's pretending wit.
+As on the land while here the ocean gains,
+In other parts it leaves wide sandy plains;
+Thus in the soul while memory prevails,
+The solid power of understanding fails;
+Where beams of warm imagination play,
+The memory's soft figures melt away.
+ -- Alexander Pope (on runtime bounds checking?)
+%
+Nature, to be commanded, must be obeyed.
+ -- Francis Bacon
+%
+Near the Studio Jean Cocteau
+On the Rue des Ecoles
+lived an old man
+with a blind dog
+Every evening I would see him
+guiding the dog along
+the sidewalk, keeping
+a firm grip on the leash
+so that the dog wouldn't
+run into a passerby
+Sometimes the dog would stop
+and look up at the sky
+Once the old man
+noticed me watching the dog
+and he said, "Oh, yes,
+this one knows
+when the moon is out,
+he can feel it on his face"
+ -- Barry Gifford
+%
+Nearly all men can stand adversity, but if you
+want to test a man's character, give him power.
+ -- Abraham Lincoln
+%
+Nearly every complex solution to a programming problem that I
+have looked at carefully has turned out to be wrong.
+ -- Brent Welch
+%
+Necessity has no law.
+ -- St. Augustine
+%
+Necessity hath no law.
+ -- Oliver Cromwell
+%
+Necessity is a mother.
+%
+"Necessity is the mother of invention" is a silly proverb. "Necessity
+is the mother of futile dodges" is much nearer the truth.
+ -- Alfred North Whitehead
+%
+Necessity is the plea for every infringement of human freedom.
+It is the argument of tyrants; it is the creed of slaves.
+ -- William Pitt, 1783
+%
+Neckties strangle clear thinking.
+ -- Lin Yutang
+%
+Needs are a function of what other people have.
+%
+Neglect of duty does not cease, by repetition, to be neglect of duty.
+ -- Napoleon
+%
+Neil Armstrong tripped.
+%
+Neither spread the germs of gossip nor encourage others to do so.
+%
+Nemo me impune lacessit
+ [No one provokes me with impunity]
+ -- Motto of the Crown of Scotland
+%
+Nerd pack, n.:
+ Plastic pouch worn in breast pocket to keep pens from soiling
+ clothes. Nerd's position in engineering hierarchy can be
+ measured by number of pens, grease pencils, and rulers bristling
+ in his pack.
+%
+Network packets are like buses. You wait all day, and then 3Com
+along at once.
+%
+Neuroses are red,
+ Melancholia's blue.
+I'm schizophrenic,
+ What are you?
+%
+Neurotics build castles in the sky,
+Psychotics live in them,
+And psychiatrists collect the rent.
+%
+Neutrinos are into physicists.
+%
+Neutrinos have bad breadth.
+%
+Neutron bomb, n.:
+ An explosive device of limited military value because, as
+ it only destroys people without destroying property, it
+ must be used in conjunction with bombs that destroy property.
+%
+Never accept an invitation from a stranger unless he gives you candy.
+ -- Linda Festa
+%
+Never appeal to a man's "better nature." He may not have one.
+Invoking his self-interest gives you more leverage.
+ -- Lazarus Long
+%
+Never argue with a fool -- people might not be able to tell the difference.
+%
+Never argue with a woman when she's tired -- or rested.
+%
+Never ask the barber if you need a haircut.
+%
+Never be afraid to tell the world who you are.
+ -- Anonymous
+%
+Never be afraid to try something new. Remember, amateurs built the ark.
+Professionals built the Titanic.
+%
+Never be led astray onto the path of virtue.
+%
+Never buy from a rich salesman.
+ -- Goldenstern
+%
+Never buy what you do not want
+because it is cheap; it will be dear to you.
+ -- Thomas Jefferson
+%
+Never call a man a fool. Borrow from him.
+%
+Never commit yourself! Let someone else commit you.
+%
+Never count your chickens before they rip your lips off.
+%
+Never delay the ending of a meeting or the beginning of a cocktail hour.
+%
+Never do programs contain so few bugs as when no debugging tools
+are available.
+ -- Niklaus Wirth
+%
+Never do today what you can put off until tomorrow.
+%
+Never drink Coca-Cola in a moving elevator. The elevator's motion coupled
+with the chemicals in Coke produce hallucinations. People tend to change
+into lizards and attack without warning, and large bats usually fly in the
+window. (Additionally, you begin to believe that elevators have windows.)
+%
+Never drink from your finger bowl -- it contains only water.
+%
+Never eat at a place called Mom's. Never play cards with a man named Doc.
+And never lie down with a woman who's got more troubles than you.
+ -- Nelson Algren, "What Every Young Man Should Know"
+%
+Never eat more than you can lift.
+ -- Miss Piggy
+%
+Never, ever lie to someone you love unless you're
+absolutely sure they'll never find out the truth.
+%
+Never explain. Your friends do not need it
+and your enemies will never believe you anyway.
+ -- Elbert Hubbard
+%
+Never face facts; if you do you'll never get up in the morning.
+ -- Marlo Thomas
+%
+Never forget what a man says to you when he is angry.
+%
+Never frighten a small man -- he'll kill you.
+%
+Never get into fights with ugly people because they have nothing to lose.
+%
+Never give an inch!
+%
+Never go to bed mad. Stay up and fight.
+ -- Phyllis Diller, "Phyllis Diller's Housekeeping Hints"
+%
+Never have children, only grandchildren.
+ -- Gore Vidal
+%
+Never have so many understood so little about so much.
+ -- James Burke
+%
+Never hit a man with glasses; hit him with a baseball bat.
+%
+Never insult an alligator until you've crossed the river.
+%
+Never invest your money in anything that eats or needs repainting.
+ -- Billy Rose
+%
+Never keep up with the Joneses. Drag them down to your level.
+ -- Quentin Crisp
+%
+Never kick a man, unless he's down.
+%
+Never laugh at live dragons.
+ -- Bilbo Baggins, "The Hobbit"
+%
+Never leave anything to chance;
+make sure all your crimes are premeditated.
+%
+Never lend your car to anyone to whom you have given birth.
+ -- Erma Bombeck
+%
+Never let someone who says it cannot be done
+interrupt the person who is doing it.
+%
+Never let your schooling interfere with your education.
+%
+Never let your sense of morals prevent you from doing what is right.
+ -- Salvor Hardin, "Foundation"
+%
+Never look a gift horse in the mouth.
+ -- Saint Jerome
+%
+Never look up when dragons fly overhead.
+%
+Never make anything simple and efficient when a
+way can be found to make it complex and wonderful.
+%
+Never miss a good chance to shut up.
+%
+Never negotiate with the United States unless you have a nuclear
+weapon.
+ -- Former deputy defense minister of India
+%
+Never offend people with style when you can offend them with substance.
+ -- Sam Brown, "The Washington Post", January 26, 1977
+%
+Never offend with style when you can offend with substance.
+%
+Never pay a compliment as if expecting a receipt.
+%
+Never play pool with anyone named "Fats".
+%
+Never promise more than you can perform.
+ -- Publilius Syrus
+%
+Never put off till run-time what you can do at compile-time.
+ -- D. Gries
+%
+Never put off till tomorrow what you can avoid all together.
+%
+Never put off until tomorrow what you can do the day after.
+%
+Never put off until tomorrow what you can do today. There might be a
+law against it by that time.
+%
+Never raise your hand to your children -- it leaves your midsection
+unprotected.
+ -- Robert Orben
+%
+Never reveal your best argument.
+%
+Never say "Oops" in an operating room.
+%
+Never say you know a man until you have divided an inheritance with him.
+%
+Never settle with words what you can accomplish with a flame thrower.
+%
+Never sleep with a woman whose troubles are worse than your own.
+ -- Nelson Algren
+%
+Never speak ill of yourself, your friends will always say enough on
+that subject.
+ -- Charles-Maurice De Talleyrand
+%
+NEVER swerve to hit a lawyer riding a bicycle -- it might be your bicycle.
+%
+Never tell. Not if you love your wife ... In fact, if your old lady walks
+in on you, deny it. Yeah. Just flat out and she'll believe it: "I'm
+tellin' ya. This chick came downstairs with a sign around her neck `Lay
+On Top Of Me Or I'll Die'. I didn't know what I was gonna do..."
+ -- Lenny Bruce
+%
+Never tell a lie unless it is absolutely convenient.
+%
+Never tell people how to do things. Tell them WHAT to
+do and they will surprise you with their ingenuity.
+ -- Gen. George S. Patton, Jr.
+%
+Never test for an error condition you don't know how to handle.
+ -- Steinbach
+%
+Never test the depth of the water with both feet.
+%
+Never trust a child farther than you can throw it.
+%
+Never trust a computer you can't repair yourself.
+%
+Never trust an automatic pistol or a D.A.'s deal.
+ -- John Dillinger
+%
+Never trust an operating system.
+%
+Never trust anybody whose arm is bigger than your leg.
+%
+Never trust anyone who says money is no object.
+%
+Never try to explain computers to a layman. It's easier to explain
+sex to a virgin.
+ -- Robert A. Heinlein
+
+(Note, however, that virgins tend to know a lot about computers.)
+%
+Never try to outstubborn a cat.
+ -- Lazarus Long, "Time Enough for Love"
+%
+Never try to teach a pig to sing.
+It wastes your time and annoys the pig.
+%
+Never underestimate the bandwidth of a station wagon full of tapes.
+ -- Dr. Warren Jackson, Director, UTCS
+%
+Never underestimate the power of a small tactical nuclear weapon.
+%
+Never underestimate the power of human stupidity.
+ -- Robert A. Heinlein
+%
+Never use "etc." -- it makes people think there is more where
+there is not or that there is not space to list it all, etc.
+%
+Never volunteer for anything.
+ -- Lackland
+%
+Never worry about theory as long as the
+machinery does what it's supposed to do.
+ -- Robert A. Heinlein
+%
+New, adj.:
+ Different color from previous model.
+%
+New crypt. See /usr/news/crypt.
+%
+New England Life, of course. Why do you ask?
+%
+New Hampshire law forbids you to tap your feet, nod your head, or in
+any way keep time to the music in a tavern, restaurant, or cafe.
+%
+New members are urgently needed in the Society
+for Prevention of Cruelty to Yourself. Apply within.
+%
+New members urgently required for SUICIDE CLUB, Watford area.
+ -- Monty Python's Big Red Book
+%
+New release:
+ Abortions are becoming so popular in some countries that the waiting
+ time to get one is lengthening rapidly. Experts predict that at this
+ rate there will soon be an up to a one year wait.
+%
+New Year's Eve is the time of year when a man most feels his
+age, and his wife most often reminds him to act it.
+ -- Webster's Unafraid Dictionary
+%
+New York is real. The rest is done with mirrors.
+%
+New York now leads the world's great cities in the number of people around
+whom you shouldn't make a sudden move.
+ -- David Letterman
+%
+New York-- to that tall skyline I come
+Flyin' in from London to your door
+New York-- lookin' down on Central Park
+Where they say you should not wander after dark.
+New York.
+ -- Simon and Garfunkel
+%
+New York's got the ways and means;
+Just won't let you be.
+ -- The Grateful Dead
+%
+Newlan's Truism:
+ An "acceptable" level of unemployment means that the
+ government economist to whom it is acceptable still has a job.
+%
+Newman's Discovery:
+ Your best dreams may not come true;
+ fortunately, neither will your worst dreams.
+%
+NEWS FLASH!!
+ Today the East German pole-vault champion
+ became the West German pole-vault champion.
+%
+news: gotcha
+%
+NEWSFLASH!!
+ Rodney Fenster looked up the shaft of elevator number four at
+1700 N. 17th St. this morning to see if the elevator was on its way down.
+It was. Age 31.
+%
+Newspaper editors are men who separate the wheat from the chaff, and then
+print the chaff.
+ -- Adlai E. Stevenson
+%
+Newton's Fourth Law: Every action has an equal and opposite satisfaction.
+%
+Newton's Little-Known Seventh Law:
+ A bird in the hand is safer than one overhead.
+%
+Next Friday will not be your lucky day.
+As a matter of fact, you don't have a lucky day this year.
+%
+Nice boy, but about as sharp as a sack of wet mice.
+ -- Foghorn Leghorn
+%
+Nice guys don't finish nice.
+%
+Nice guys finish last.
+ -- Leo Durocher
+%
+Nice guys finish last, but we get to sleep in.
+ -- Evan Davis
+%
+Nice guys get sick.
+%
+Nick the Greek's Law of Life:
+ All things considered, life is 9 to 5 against.
+%
+Nietzsche is pietzsche, Goethe is murder.
+%
+Nietzsche says that we will live the same life, over and over again.
+God -- I'll have to sit through the Ice Capades again.
+ -- Woody Allen, "Hannah and Her Sisters"
+%
+Nihilism should commence with oneself.
+%
+Niklaus Wirth has lamented that, whereas Europeans pronounce his
+name correctly (Ni-klows Virt), Americans invariably mangle it into
+(Nick-les Worth). Which is to say that Europeans call him by name,
+but Americans call him by value.
+%
+Nine megs for the secretaries fair,
+Seven megs for the hackers scarce,
+Five megs for the grads in smoky lairs,
+Three megs for system source;
+
+One disk to rule them all,
+One disk to bind them,
+One disk to hold the files
+And in the darkness grind 'em.
+%
+Nine-track tapes and seven-track tapes
+And tapes without any tracks;
+Stretchy tapes and snarley tapes
+And tapes mixed up on the racks --
+ Take hold of the tape
+ And pull off the strip,
+ And then you'll be sure
+ Your tape drive will skip.
+
+ -- Uncle Colonel's Cursory Rhymes
+%
+Ninety percent of the politicians give the other ten percent a bad reputation.
+ -- Henry Kissinger
+%
+Ninety percent of the time things turn out worse than you thought they would.
+The other ten percent of the time you had no right to expect that much.
+ -- Augustine
+%
+Ninety-Ninety Rule of Project Schedules:
+ The first ninety percent of the task takes ninety percent of
+ the time, and the last ten percent takes the other ninety percent.
+%
+Nirvana? That's the place where the powers
+that be and their friends hang out.
+ -- Zonker Harris
+%
+Nitwit ideas are for emergencies. You use them when you've got nothing
+else to try. If they work, they go in the Book. Otherwise you follow
+the Book, which is largely a collection of nitwit ideas that worked.
+ -- Larry Niven, "The Mote in God's Eye"
+%
+No act of kindness, no matter how small, is ever wasted.
+ -- Aesop
+%
+No amount of careful planning will ever replace dumb luck.
+%
+No amount of genius can overcome a preoccupation with detail.
+%
+No animal should ever jump on the dining room furniture unless
+absolutely certain he can hold his own in conversation.
+ -- Fran Lebowitz
+%
+No bird soars too high if he soars with his own wings.
+ -- William Blake
+%
+No brainer, n.:
+ A decision which, viewed through the retrospectoscope,
+ is "obvious" to those who failed to make it originally.
+%
+No character, however upright, is a match for
+constantly reiterated attacks, however false.
+ -- Alexander Hamilton
+%
+No Civil War picture ever made a nickel.
+ -- MGM executive Irving Thalberg to Louis B. Mayer about
+ film rights to "Gone With the Wind".
+ Cerf/Navasky, "The Experts Speak"
+%
+No committee could ever come up with anything as revolutionary as a
+camel -- anything as practical and as perfectly designed to perform
+effectively under such difficult conditions.
+ -- Dr. Laurence J. Peter
+%
+No directory.
+%
+No discipline is ever requisite to force attendance upon
+lectures which are really worth the attending.
+ -- Adam Smith, "The Wealth of Nations"
+%
+No doubt Jack the Ripper excused himself
+on the grounds that it was human nature.
+%
+No, "Eureka" is Greek for "This bath is too hot."
+ -- The Doctor, "Doctor Who"
+%
+No evil can happen to a good man.
+ -- Plato
+%
+No excellent soul is exempt from a mixture of madness.
+ -- Aristotle
+%
+No extensible language will be universal.
+ -- T. Cheatham
+%
+No friendship is so cordial or so delicious as that of girl for girl;
+no hatred so intense or immovable as that of woman for woman.
+ -- Landor
+%
+No group of professionals meets except to
+conspire against the public at large.
+ -- Mark Twain
+%
+No guest is so welcome in a friend's house that
+he will not become a nuisance after three days.
+ -- Titus Maccius Plautus
+%
+No guts, no glory.
+%
+No hardware designer should be allowed to produce any piece of hardware
+until three software guys have signed off for it.
+ -- Andrew S. Tanenbaum
+%
+No, his mind is not for rent
+To any god or government.
+Always hopeful, yet discontent,
+He knows changes aren't permanent -
+But change is.
+%
+No house is childproofed unless the little darlings are in straitjackets.
+%
+No house should ever be on any hill or on anything.
+It should be of the hill, belonging to it.
+ -- Frank Lloyd Wright
+%
+No, I don't have a drinking problem.
+I drink, I get drunk, I fall down. No problem!
+%
+No, I'm not interested in developing a powerful brain. All I'm after is
+just a mediocre brain, something like the president of American Telephone
+and Telegraph Company.
+ -- Alan Turing on the possibilities of a thinking
+ machine, 1943.
+%
+No is no negative in a woman's mouth.
+ -- Sidney
+%
+No job too big; no fee too big!
+ -- Dr. Peter Venkman, "Ghostbusters"
+%
+No line available at 300 baud.
+%
+No live organism can continue for long to exist sanely under conditions of
+absolute reality; even larks and katydids are supposed, by some, to dream.
+Hill House, not sane, stood by itself against its hills, holding darkness
+within; it had stood so for eighty years and might stand for eighty more.
+Within, walls continued upright, bricks met neatly, floors were firm, and
+doors were sensibly shut; silence lay steadily against the wood and stone
+of Hill House, and whatever walked there, walked alone.
+ -- Shirley Jackson, "The Haunting of Hill House"
+%
+No maintenance:
+ Impossible to fix.
+%
+No man can have a reasonable opinion of women until he has long lost
+interest in hair restorers.
+ -- Austin O'Malley
+%
+No man in the world has more courage than the man who can stop after eating
+one peanut.
+ -- Channing Pollock
+%
+No man is an Iland, intire of it selfe; every man is a peece of the
+Continent, a part of the maine; if a Clod bee washed away by the Sea,
+Europe is the lesse, as well as if a Promontorie were, as well as if
+a Mannor of thy friends or of thine owne were; any mans death diminishes
+me, because I am involved in Mankinde; And therefore never send to know
+for whom the bell tolls; It tolls for thee.
+ -- John Donne, "No Man is an Iland"
+%
+No man is an island, but some of us are long peninsulas.
+%
+No man is an island if he's on at least one mailing list.
+%
+No man is useless who has a friend,
+and if we are loved we are indispensable.
+ -- Robert Louis Stevenson
+%
+No man would listen to you talk if he didn't know it was his turn next.
+ -- Edgar W. Howe
+%
+No man's ambition has a right to stand in
+the way of performing a simple act of justice.
+ -- John Altgeld
+%
+No Marxist can deny that the interests of socialism are higher
+than the interests of the right of nations to self-determination.
+ -- Lenin, 1918
+%
+No matter how celebrated the beauty of a woman, I would never spend a night
+with her. The only celebrity with whom I would share a night is Max Planck.
+But he is dead. So I live like a monk, aside from a little self gratification
+in the afternoons.
+ -- Salvador Dali
+%
+No matter how cynical you get, it's impossible to keep up.
+%
+No matter how much you do you never do enough.
+%
+No matter how old a mother is, she watches her middle-aged children for
+signs of improvement.
+ -- Florida Scott-Maxwell
+%
+No matter how subtle the wizard, a knife in the shoulder blades will seriously
+cramp his style.
+%
+No matter what happens, there is always someone who knew it would.
+%
+No matter what other nations may say about the United States,
+immigration is still the sincerest form of flattery.
+%
+No matter where I go, the place is always called "here".
+%
+No matter who you are, some scholar can show you
+the great idea you had was had by someone before you.
+%
+No matther whether th' constitution follows th' flag or not,
+th' supreme court follows th' iliction returns.
+ -- Mr. Dooley
+%
+No modern woman with a grain of sense ever sends little notes to an
+unmarried man -- not until she is married, anyway.
+ -- Arthur Binstead
+%
+No, my friend, the way to have good and safe government, is not to trust it
+all to one, but to divide it among the many, distributing to every one exactly
+the functions he is competent to. It is by dividing and subdividing these
+republics from the national one down through all its subordinations, until it
+ends in the administration of every man's farm by himself; by placing under
+every one what his own eye may superintend, that all will be done for the best.
+ -- Thomas Jefferson, to Joseph Cabell, 1816
+%
+No one becomes depraved in a moment.
+ -- Decimus Junius Juvenalis
+%
+No one can feel as helpless as the owner of a sick goldfish.
+%
+No one can have a higher opinion of him than I have, and I think he's a
+dirty little beast.
+ -- W. S. Gilbert
+%
+No one can make you feel inferior without your consent.
+ -- Eleanor Roosevelt
+%
+No one can put you down without your full cooperation.
+%
+No one gets sick on Wednesdays.
+%
+No one gets too old to learn a new way of being stupid.
+%
+No one has a higher opinion of him than he has.
+ -- Greg Lehey, FreeBSDcon 1999
+%
+No one knows like a woman how to say
+things that are at once gentle and deep.
+ -- Hugo
+%
+No one knows what he can do till he tries.
+ -- Publilius Syrus
+%
+No one regards what is before his feet; we all gaze at the stars.
+ -- Quintus Ennius
+%
+No one should have to wait until after ten o'clock for his english muffin!
+ -- Snoopy
+%
+No one so thoroughly appreciates the value of constructive criticism as the
+one who's giving it.
+ -- Hal Chadwick
+%
+NO OPIUM-SMOKING IN THE ELEVATORS
+ -- sign in the Rand Hotel, New York, 1907
+%
+No part of this message may reproduce, store itself in a retrieval
+system, or transmit disease, in any form, without the permissiveness of
+the author.
+ -- Chris Shaw
+%
+No pig should go sky diving during monsoon
+For this isn't really the norm.
+But should a fat swine try to soar like a loon,
+So what? Any pork in a storm.
+
+No pig should go sky diving during monsoon,
+It's risky enough when the weather is fine.
+But to have a pig soar when the monsoon doth roar
+Cast even more perils before swine.
+%
+No plain fanfold paper could hold that fractal Puff --
+He grew so fast no plotting pack could shrink him far enough.
+Compiles and simulations grew so quickly tame
+And swapped out all their data space when Puff pushed his stack frame.
+ (refrain)
+Puff, he grew so quickly, while others moved like snails
+And mini-Puffs would perch themselves on his gigantic tail.
+All the student hackers loved that fractal Puff
+But DCS did not like Puff, and finally said, "Enough!"
+ (refrain)
+Puff used more resources than DCS could spare.
+The operator killed Puff's job -- he didn't seem to care.
+A gloom fell on the hackers; it seemed to be the end,
+But Puff trapped the exception, and grew from naught again!
+ (refrain)
+Refrain:
+ Puff the fractal dragon was written in C,
+ And frolicked while processes switched in mainframe memory.
+ Puff the fractal dragon was written in C,
+ And frolicked while processes switched in mainframe memory.
+%
+No poet or novelist wishes he was the only one who ever lived, but most of
+them wish they were the only one alive, and quite a number fondly believe
+their wish has been granted.
+ -- W. H. Auden, "The Dyer's Hand"
+%
+No problem is insoluble in all conceivable circumstances.
+%
+No problem is so formidable that you can't just walk away from it.
+ -- C. Schulz
+%
+No problem is so large it can't be fit in somewhere.
+%
+"No program is perfect,"
+They said with a shrug.
+"The customer's happy--
+What's one little bug?"
+
+But he was determined, Then change two, then three more,
+The others went home. As year followed year.
+He dug out the flow chart And strangers would comment,
+Deserted, alone. "Is that guy still here?"
+
+Night passed into morning. He died at the console
+The room was cluttered Of hunger and thirst
+With core dumps, source listings. Next day he was buried
+"I'm close," he muttered. Face down, nine edge first.
+
+Chain smoking, cold coffee, And his wife through her tears
+Logic, deduction. Accepted his fate.
+"I've got it!" he cried, Said "He's not really gone,
+"Just change one instruction." He's just working late."
+ -- The Perfect Programmer
+%
+No proper program contains an indication which as an operator-applied
+occurrence identifies an operator-defining occurrence which as an
+indication-applied occurrence identifies an indication-defining occurrence
+different from the one identified by the given indication as an
+indication-applied occurrence.
+ -- ALGOL 68 Report
+%
+No question is so difficult as one to which the answer is obvious.
+%
+No rock so hard but that a little wave
+May beat admission in a thousand years.
+ -- Tennyson
+%
+No self-made man ever did such a good job
+that some woman didn't want to make some alterations.
+ -- Kin Hubbard
+%
+No self-respecting fish would want to be wrapped in that kind of
+paper.
+ -- Mike Royko on the Chicago Sun-Times after it was
+ taken over by Rupert Murdoch
+%
+No skis take rocks like rental skis!
+%
+No small art is it to sleep: it is necessary
+for that purpose to keep awake all day.
+ -- Friedrich Nietzsche
+%
+No snowflake in an avalanche ever feels responsible.
+%
+No sooner had Edger Allen Poe
+Finished his old Raven,
+then he started his Old Crow.
+%
+No sooner said than done -- so acts your man of worth.
+ -- Quintus Ennius
+%
+No spitting on the Bus!
+Thank you, The Management.
+%
+No television performance takes as much preparation as an off-the-cuff talk.
+ -- Richard M. Nixon
+%
+No two persons ever read the same book.
+ -- Edmund Wilson
+%
+No use getting too involved in life --
+you're only here for a limited time.
+%
+No violence, gentlemen -- no violence, I beg of you! Consider the furniture!
+ -- Sherlock Holmes
+%
+No woman can endure a gambling husband, unless he is a steady winner.
+ -- Lord Thomas Robert Dewar
+%
+No woman ever falls in love with a man unless she has a better opinion of
+him than he deserves.
+ -- Edgar W. Howe
+%
+No wonder Clairol makes so much money selling shampoo.
+Lather, Rinse, Repeat is an infinite loop!
+%
+No wonder you're tired! You understood so much today.
+%
+No yak too dirty; no dumpster too hollow.
+%
+Nobody can be as agreeable as an uninvited guest.
+%
+Nobody can be exactly like me. Sometimes even I have trouble doing
+it.
+ -- Tallulah Bankhead
+%
+Nobody ever died from oven crude poisoning.
+%
+Nobody ever forgets where he buried the hatchet.
+ -- Kin Hubbard
+%
+Nobody ever ruined their eyesight by looking at the bright side of something.
+%
+NOBODY EXPECTS THE SPANISH INQUISITION.
+%
+Nobody is one block of harmony. We are all afraid of something, or feel
+limited in something. We all need somebody to talk to. It would be good
+if we talked to each other--not just pitter-patter, but real talk. We
+shouldn't be so afraid, because most people really like this contact;
+that you show you are vulnerable makes them free to be vulnerable too.
+It's so much easier to be together when we drop our masks.
+ -- Liv Ullman
+%
+Nobody knows the trouble I've been.
+%
+Nobody knows what goes between his cold toes and his warm ears.
+ -- Roy Harper
+%
+Nobody loves me,
+Everybody hates me,
+I think I'll go out and eat worms.
+I'm gonna cut their heads off,
+Eat their insides out,
+And throw way the skins.
+Big, fat, juicy ones,
+Little, skinny, cute ones,
+Watch how they wiggle and they squirm.
+%
+Nobody really knows what happiness is, until they're married.
+And then it's too late.
+%
+Nobody said computers were going to be polite.
+%
+Nobody shot me.
+ -- Frank Gusenberg, his last words, when asked by police
+ who had shot him 14 times with a machine gun in the
+ Saint Valentine's Day Massacre.
+
+Only Capone kills like that.
+ -- George "Bugs" Moran, on the Saint Valentine's Day Massacre
+
+The only man who kills like that is Bugs Moran.
+ -- Al Capone, on the Saint Valentine's Day Massacre
+%
+Nobody suffers the pain of birth or the anguish of loving a child in order
+for presidents to make wars, for governments to feed on the substance of
+their people, for insurance companies to cheat the young and rob the old.
+ -- Lewis Lapham
+%
+Nobody takes a bribe. Of course at Christmas if you happen to hold out
+your hat and somebody happens to put a little something in it, well, that's
+different.
+ -- New York City Police Commissioner (Ret.) William P.
+ O'Brien, instructions to the force.
+%
+Nobody wants constructive criticism.
+It's all we can do to put up with constructive praise.
+%
+Nobody's gonna believe that computers are intelligent until they start
+coming in late and lying about it.
+%
+nohup rm -fr /&
+%
+Noise proves nothing. Often a hen who has
+merely laid an egg cackles as if she laid an asteroid.
+ -- Mark Twain
+%
+Nolo contendere:
+ A legal term meaning: "I didn't do it, judge, and I'll never do
+ it again."
+%
+Nominal egg:
+ New Yorkerese for expensive.
+%
+Noncombatant, n.:
+ A dead Quaker.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Non-Determinism is not meant to be reasonable.
+ -- M. J. 0'Donnell
+%
+Nondeterminism means never having to say you are wrong.
+%
+None love the bearer of bad news.
+ -- Sophocles
+%
+None of our men are "experts." We have most unfortunately found it necessary
+to get rid of a man as soon as he thinks himself an expert -- because no one
+ever considers himself expert if he really knows his job. A man who knows a
+job sees so much more to be done than he has done, that he is always pressing
+forward and never gives up an instant of thought to how good and how efficient
+he is. Thinking always ahead, thinking always of trying to do more, brings a
+state of mind in which nothing is impossible. The moment one gets into the
+"expert" state of mind a great number of things become impossible.
+ -- From Henry Ford Sr., "My Life and Work"
+%
+Non-Reciprocal Laws of Expectations:
+ Negative expectations yield negative results.
+ Positive expectations yield negative results.
+%
+Nonsense. Space is blue and birds fly through it.
+ -- Heisenberg
+%
+Nonsense and beauty have close connections.
+ -- E. M. Forster
+%
+Non-sequiturs make me eat lampshades.
+%
+Noone ever built a statue to a critic.
+%
+No-one would remember the Good Samaritan if he had only had good
+intentions. He had money as well.
+ -- Margaret Thatcher
+%
+Norbert Wiener was the subject of many dotty professor stories. Wiener was, in
+fact, very absent minded. The following story is told about him: when they
+moved from Cambridge to Newton his wife, knowing that he would be absolutely
+useless on the move, packed him off to MIT while she directed the move. Since
+she was certain that he would forget that they had moved and where they had
+moved to, she wrote down the new address on a piece of paper, and gave it to
+him. Naturally, in the course of the day, an insight occurred to him. He
+reached in his pocket, found a piece of paper on which he furiously scribbled
+some notes, thought it over, decided there was a fallacy in his idea, and
+threw the piece of paper away. At the end of the day he went home (to the
+old address in Cambridge, of course). When he got there he realized that they
+had moved, that he had no idea where they had moved to, and that the piece of
+paper with the address was long gone. Fortunately inspiration struck. There
+was a young girl on the street and he conceived the idea of asking her where
+he had moved to, saying, "Excuse me, perhaps you know me. I'm Norbert Wiener
+and we've just moved. Would you know where we've moved to?" To which the
+young girl replied, "Yes, Daddy, Mommy thought you would forget."
+ The capper to the story is that I asked his daughter (the girl in the
+story) about the truth of the story, many years later. She said that it wasn't
+quite true -- that he never forgot who his children were! The rest of it,
+however, was pretty close to what actually happened...
+ -- Richard Harter
+%
+Norm: Hey, everybody.
+All: [silence; everybody is mad at Norm for being rich.]
+Norm: [Carries on both sides of the conversation himself.]
+ Norm! (Norman.)
+ How are you feeling today, Norm?
+ Rich and thirsty. Pour me a beer.
+ -- Cheers, Tan 'n Wash
+
+Woody: What's the latest, Mr. Peterson?
+Norm: Zsa-Zsa marries a millionaire, Peterson drinks a beer.
+ Film at eleven.
+ -- Cheers, Knights of the Scimitar
+
+Woody: How are you today, Mr. Peterson?
+Norm: Never been better, Woody. ... Just once I'd like to be better.
+ -- Cheers, Chambers vs. Malone
+%
+Norm: Gentlemen, start your taps.
+ -- Cheers, The Coach's Daughter
+
+Coach: How's life treating you, Norm?
+Norm: Like it caught me in bed with his wife.
+ -- Cheers, Any Friend of Diane's
+
+Coach: How's life, Norm?
+Norm: Not for the squeamish, Coach.
+ -- Cheers, Friends, Romans, and Accountants
+%
+[Norm comes in with an attractive woman.]
+
+Coach: Normie, Normie, could this be Vera?
+Norm: With a lot of expensive surgery, maybe.
+ -- Cheers, Norman's Conquest
+
+Coach: What's up, Normie?
+Norm: The temperature under my collar, Coach.
+ -- Cheers, I'll Be Seeing You (Part 2)
+
+Coach: What would you say to a nice beer, Normie?
+Norm: Going down?
+ -- Cheers, Diane Meets Mom
+%
+[Norm goes into the bar at Vic's Bowl-A-Rama.]
+
+Off-screen crowd: Norm!
+Sam: How the hell do they know him here?
+Cliff: He's got a life, you know.
+ -- Cheers, From Beer to Eternity
+
+Woody: What can I do for you, Mr. Peterson?
+Norm: Elope with my wife.
+ -- Cheers, The Triangle
+
+Woody: How's life, Mr. Peterson?
+Norm: Oh, I'm waiting for the movie.
+ -- Cheers, Take My Shirt... Please?
+%
+[Norm is angry.]
+
+Woody: What can I get you, Mr. Peterson?
+Norm: Clifford Clavin's head.
+ -- Cheers, The Triangle
+
+Sam: Hey, what's happening, Norm?
+Norm: Well, it's a dog-eat-dog world, Sammy,
+ and I'm wearing Milk-Bone underwear.
+ -- Cheers, The Peterson Principle
+
+Sam: How's life in the fast lane, Normie?
+Norm: Beats me, I can't find the on-ramp.
+ -- Cheers, Diane Chambers Day
+%
+[Norm returns from the hospital.]
+
+Coach: What's up, Norm?
+Norm: Everything that's supposed to be.
+ -- Cheers, Diane Meets Mom
+
+Sam: What's new, Normie?
+Norm: Terrorists, Sam. They've taken over my stomach.
+ They're demanding beer.
+ -- Cheers, The Heart is a Lonely Snipehunter
+
+Coach: What'll it be, Normie?
+Norm: Just the usual, Coach. I'll have a froth of beer and a snorkel.
+ -- Cheers, King of the Hill
+%
+[Norm tries to prove that he is not Anton Kreitzer.]
+Norm: Afternoon, everybody!
+All: Anton!
+ -- Cheers, The Two Faces of Norm
+
+Woody: What's going on, Mr. Peterson?
+Norm: A flashing sign in my gut that says, "Insert beer here."
+ -- Cheers, Call Me, Irresponsible
+
+Sam: What can I get you, Norm?
+Norm: [scratching his beard] Got any flea powder? Ah, just kidding.
+ Gimme a beer; I think I'll just drown the little suckers.
+ -- Cheers, Two Girls for Every Boyd
+%
+Normal times may possibly be over forever.
+%
+Normally our rules are rigid; we tend to discretion, if for no other
+reason than self-protection. We never recommend any of our graduates,
+although we cheerfully provide information as to those who have failed
+their courses.
+ -- Jack Vance, "Freitzke's Turn"
+%
+Nostalgia is living life in the past lane.
+%
+Nostalgia just isn't what it used to be.
+%
+Not all men who drink are poets.
+Some of us drink because we aren't poets.
+%
+Not all who own a harp are harpers.
+ -- Marcus Terentius Varro
+%
+Not drinking, chasing women, or doing drugs won't
+make you live longer -- it just seems that way.
+%
+Not every problem someone has with his girlfriend is necessarily due to
+the capitalist mode of production.
+ -- Herbert Marcuse
+%
+Not every question deserves an answer.
+%
+Not everything worth doing is worth doing well.
+%
+Not far from here, by a white sun, behind a green star, lived the
+Steelypips, illustrious, industrious, and they hadn't a care: no spats
+in their vats, no rules, no schools, no gloom, no evil influence of the
+moon, no trouble from matter or antimatter -- for they had a machine, a
+dream of a machine, with springs and gears and perfect in every
+respect. And they lived with it, and on it, and under it, and inside
+it, for it was all they had -- first they saved up all their atoms,
+then they put them all together, and if one didn't fit, why they
+chipped at it a bit, and everything was just fine ...
+ -- Stanislaw Lem, "Cyberiad"
+%
+Not Hercules could have knock'd out his brains, for he had none.
+ -- William Shakespeare
+%
+Not only is this incomprehensible, but the ink is
+ugly and the paper is from the wrong kind of tree.
+ -- Professor W., EECS, George Washington University
+
+I'm looking forward to working with you on this next year.
+ -- Professor, Harvard, on a senior thesis
+%
+Not only is UNIX dead, it's starting to smell really bad.
+ -- Rob Pike
+%
+Not that we needed all that stuff, but when you get locked into a
+serious drug collection the tendency is to push it as far as you can.
+ -- Hunter S. Thompson, "Fear and Loathing in Las Vegas"
+%
+Not to laugh, not to lament, not to curse, but to understand.
+ -- Spinoza
+%
+Not to mention the fact that most of the good code for PC minix seems
+to have been written by Bruce Evans.
+ -- Linus Torvalds, comp.os.minix, Jan. 1992
+%
+NOTE: No warranties, either express or implied, are hereby given.
+All software is supplied as is, without guarantee. The user assumes
+all responsibility for damages resulting from the use of these
+features, including, but not limited to, frustration, disgust, system
+abends, disk head-crashes, general malfeasance, floods, fires, shark
+attack, nerve gas, locust infestation, cyclones, hurricanes, tsunamis,
+local electromagnetic disruptions, hydraulic brake system failure,
+invasion, hashing collisions, normal wear and tear of friction
+surfaces, comic radiation, inadvertent destruction of sensitive
+electronic components, windstorms, the Riders of Nazgul, infuriated
+chickens, malfunctioning mechanical or electrical sexual devices,
+premature activation of the distant early warning system, peasant
+uprisings, halitosis, artillery bombardment, explosions, cave-ins,
+and/or frogs falling from the sky.
+%
+Note: The system panics with a "NULL pointer dereference" message
+
+Failed due to: SunOS 5.8 is installed.
+ -- Output of a SunCheckup run on a Solaris 8 machine
+%
+Note to myself: use real bullets next time.
+%
+Notes for a ballet, "The Spell": ... Suddenly Sigmund hears the flutter of
+wings, and a group of wild swans flies across the moon ... Sigmund is
+astounded to see that their leader is part swan and part woman --
+unfortunately, divided lengthwise. She enchants Sigmund, who is careful
+not to make any poultry jokes.
+ -- Woody Allen
+%
+Nothing astonishes men so much as common sense and plain dealing.
+ -- Ralph Waldo Emerson
+%
+Nothing can be done in one trip.
+ -- Snider
+%
+Nothing cures insomnia like the realization that it's time to get up.
+%
+Nothing endures but change.
+ -- Heraclitus
+ [Yeah, yeah, "Everything changes but change itself." --JFK Ed.]
+%
+Nothing ever becomes real till it is experienced -- even a
+proverb is no proverb to you till your life has illustrated it.
+ -- John Keats
+%
+Nothing in life is so exhilarating as to be shot at without result.
+ -- Winston Churchill
+
+Next to being shot at and missed, nothing is really quite as
+satisfying as an income tax refund.
+ -- F. J. Raymond
+%
+Nothing in life is to be feared. It is only to be understood.
+%
+Nothing increases your golf score like witnesses.
+%
+Nothing is as simple as it seems at first
+ Or as hopeless as it seems in the middle
+ Or as finished as it seems in the end.
+%
+Nothing is but what is not.
+%
+Nothing is ever a total loss; it can always serve as a bad example.
+%
+Nothing is faster than the speed of light.
+
+To prove this to yourself, try opening the
+refrigerator door before the light comes on.
+%
+Nothing is finished until the paperwork is done.
+%
+Nothing is illegal if one hundred businessmen decide to do it.
+ -- Andrew Young
+%
+Nothing is impossible for the man who doesn't have to do it himself.
+ -- A. H. Weiler
+%
+Nothing is more admirable than the fortitude with which
+millionaires tolerate the disadvantages of their wealth.
+ -- Nero Wolfe
+%
+Nothing is more quiet than the sound of hair going grey.
+%
+Nothing is rich but the inexhaustible wealth of nature.
+She shows us only surfaces, but she is a million fathoms deep.
+ -- Ralph Waldo Emerson
+%
+Nothing is so firmly believed as that which we least know.
+ -- Michel de Montaigne
+%
+Nothing is so often irretrievably missed as a daily opportunity.
+ -- Ebner-Eschenbach
+%
+Nothing lasts forever.
+Where do I find nothing?
+%
+Nothing makes a person more productive than the last minute.
+%
+Nothing makes one so vain as being told that one is a sinner.
+Conscience makes egotists of us all.
+ -- Oscar Wilde
+%
+Nothing matters very much, and few things matter at all.
+ -- Arthur Balfour
+%
+Nothing motivates a man more than to
+see his boss put in an honest day's work.
+%
+Nothing, nothing, nothing, no error, no crime is so absolutely
+repugnant to God as everything which is official; and why? because
+the official is so impersonal and therefore the deepest insult
+which can be offered to a personality.
+ -- S. A. Kierkegaard (1813-1855)
+%
+Nothing recedes like success.
+ -- Walter Winchell
+%
+Nothing shortens a journey so pleasantly as an account of misfortunes at
+which the hearer is permitted to laugh.
+ -- Quentin Crisp
+%
+Nothing so needs reforming as other people's habits.
+ -- Mark Twain
+%
+Nothing succeeds like success.
+ -- Alexandre Dumas
+%
+Nothing succeeds like the appearance of success.
+ -- Christopher Lascl
+%
+Nothing takes the taste out of peanut butter quite like unrequited love.
+ -- Charlie Brown
+%
+Nothing that's forced can ever be right,
+If it doesn't come naturally, leave it.
+That's what she said as she turned out the light,
+And we bent our backs as slaves of the night,
+Then she lowered her guard and showed me the scars
+She got from trying to fight
+Saying, oh, you'd better believe it.
+[...]
+Well nothing that's real is ever for free
+And you just have to pay for it sometime.
+She said it before, she said it to me,
+I suppose she believed there was nothing to see,
+But the same old four imaginary walls
+She'd built for livin' inside
+I said oh, you just can't mean it.
+[...]
+Well nothing that's forced can ever be right,
+If it doesn't come naturally, leave it.
+That's what she said as she turned out the light,
+And she may have been wrong, and she may have been right,
+But I woke with the frost, and noticed she'd lost
+The veil that covered her eyes,
+I said oh, you can leave it.
+ -- Al Stewart, "If It Doesn't Come Naturally, Leave It"
+%
+Nothing will dispel enthusiasm like a small admission fee.
+ -- Kin Hubbard
+%
+Nothing will ever be attempted
+if all possible objections must be first overcome.
+ -- Dr. Johnson
+%
+NOTICE:
+ Anyone seen smoking will be assumed to be on fire and will
+ be summarily put out.
+%
+NOTICE:
+
+-- THE ELEVATORS WILL BE OUT OF ORDER TODAY --
+
+(The nearest working elevator is in the building across the street.)
+%
+Nouvelle cuisine, n.:
+ French for "not enough food".
+
+Continental breakfast, n.:
+ English for "not enough food".
+
+Tapas, n.:
+ Spanish for "not enough food".
+
+Dim Sum, n.:
+ Chinese for more food than you've ever seen in your entire life.
+%
+November, n.:
+ The eleventh twelfth of a weariness.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Novinson's Revolutionary Discovery:
+
+ When comes the revolution, things will be different --
+ not better, just different.
+%
+Now and then an innocent person is sent to the legislature.
+%
+Now hatred is by far the longest pleasure;
+Men love in haste, but they detest at leisure.
+ -- George Gordon, Lord Byron, "Don Juan"
+%
+Now I lay me back to sleep.
+The speaker's dull; the subject's deep.
+If he should stop before I wake,
+Give me a nudge for goodness' sake.
+ -- Anonymous
+%
+Now I lay me down to sleep
+I pray the double lock will keep;
+May no brick through the window break,
+And, no one rob me till I awake.
+%
+Now I lay me down to sleep,
+I pray the Lord my soul to keep,
+If I should die before I wake,
+I'll cry in anguish, "Mistake!! Mistake!!"
+%
+Now I lay me down to study,
+I pray the Lord I won't go nutty.
+And if I fail to learn this junk,
+I pray the Lord that I won't flunk.
+But if I do, don't pity me at all,
+Just lay my bones in the study hall.
+Tell my teacher I've done my best,
+Then pile my books upon my chest.
+%
+Now is the time for all good men to come to.
+ -- Walt Kelly
+%
+Now is the time for drinking;
+now the time to beat the earth with unfettered foot.
+ -- Quintus Horatius Flaccus (Horace)
+%
+Now it's time to say goodbye
+To all our company...
+M-I-C (see you next week!)
+K-E-Y (Why? Because we LIKE you!)
+M-O-U-S-E.
+%
+Now of my threescore years and ten,
+Twenty will not come again,
+And take from seventy springs a score,
+It leaves me only fifty more.
+
+And since to look at things in bloom
+Fifty springs are little room,
+About the woodlands I will go
+To see the cherry hung with snow.
+ -- A. E. Housman
+%
+Now that day wearies me,
+My yearning desire
+Will receive more kindly,
+Like a tired child, the starry night.
+
+Hands, leave off your deeds,
+Mind, forget all thoughts;
+All of my forces
+Yearn only to sink into sleep.
+
+And my soul, unguarded,
+Would soar on widespread wings,
+To live in night's magical sphere
+More profoundly, more variously.
+ -- Hermann Hesse, "Going to Sleep"
+%
+Now that you've read Fortune's diet truths, you'll be prepared the next time
+some housewife or boutique owner turned diet expert appears on TV to plug
+her latest book. And, if you still feel a twinge of guilt for eating coffee
+cake while listening to her exhortations, ask yourself the following questions:
+
+1: Do I dare trust a person who actually considers alfalfa sprouts a food?
+2: Was the author's sole motive in writing this book to get rich
+ exploiting the forlorn hopes of chubby people like me?
+3: Would a longer life be worthwhile if it had to be lived as prescribed...
+ without French-fried onion rings, pizza with double cheese, or the
+ occasional Mai-Tai? (Remember, living right doesn't really make
+ you live longer, it just *seems* like longer.)
+
+That, and another piece of coffee cake, should do the trick.
+%
+Now the Lord God planted a garden East of Whittier in a place called
+Yorba Linda, and out of the ground he made to grow orange trees that
+were good for food and the fruits thereof he labeled SUNKIST ...
+ -- "The Begatting of a President"
+%
+Now there's a violent movie titled, "The Croquet Homicide,"
+or "Murder With Mallets Aforethought."
+ -- Shelby Friedman, WSJ
+%
+Now there's three things you can do in a baseball game:
+you can win or you can lose or it can rain.
+ -- Casey Stengel
+%
+Now this is a totally brain damaged algorithm. Gag me with a
+smurfette.
+ -- P. Buhr, Computer Science 354
+%
+Nowlan's Theory:
+ He who hesitates is not only lost, but several miles from
+ the next freeway exit.
+%
+Now's the time to have some big ideas
+Now's the time to make some firm decisions
+We saw the Buddha in a bar down south
+Talking politics and nuclear fission
+We see him and he's all washed up --
+Moving on into the body of a beetle
+Getting ready for a long long crawl
+He ain't nothing -- he ain't nothing at all...
+
+Death and Money make their point once more
+In the shape of Philosophical assassins
+Mark and Danny take the bus uptown
+Deadly angels for reality and passion
+Have the courage of the here and now
+Don't taking nothing from the half-baked buddhas
+When you think you got it paid in full
+You got nothing -- you got nothing at all...
+ We're on the road and we're gunning for the Buddha.
+ We know his name and he mustn't get away.
+ We're on the road and we're gunning for the Buddha.
+ It would take one shot -- to blow him away...
+ -- Shriekback, "Gunning for the Buddha"
+%
+Nuclear powered vacuum cleaners will probably be a reality within 10 years.
+ -- Alex Lewyt (President of the Lewyt Corporation,
+ manufacturers of vacuum cleaners), quoted in The New York
+ Times, June 10, 1955.
+%
+[Nuclear war] ... may not be desirable.
+ -- Edwin Meese III
+%
+Nuclear war can ruin your whole compile.
+ -- Karl Lehenbauer
+%
+Nuclear war would mean abolition of most comforts, and disruption of
+normal routines, for children and adults alike.
+ -- Willard F. Libby, "You Can Survive Atomic Attack"
+%
+Nuclear war would really set back cable.
+ -- Ted Turner
+%
+Nudists are people who wear one-button suits.
+%
+Nuke the unborn gay female whales for Jesus.
+%
+Nuke them till they glow, then shoot them in the dark.
+%
+(null cookie; hope that's ok)
+%
+Nullum magnum ingenium sine mixtura dementiae fuit.
+ -- Seneca
+%
+Numeric stability is probably not all that important when you're guessing.
+%
+Nurse Donna: Oh, Groucho, I'm afraid I'm gonna wind up an old maid.
+Groucho: Well, bring her in and we'll wind her up together.
+Nurse Donna: Do you believe in computer dating?
+Groucho: Only if the computers really love each other.
+%
+Nusbaum's Rule:
+ The more pretentious the corporate name, the smaller the
+ organization. (For instance, the Murphy Center for the
+ Codification of Human and Organizational Law, contrasted
+ to IBM, GM, and AT&T.)
+%
+O! If I were a fish
+I'd lay hap'ly on my dish.
+Yes, that's my one and only wish --
+To be a fish!
+
+For fish don't ever mish;
+They needn't flush after they pish!
+Yes, and life's just swish, swish, swish,
+For all the fish!!!
+%
+O give me a home,
+Where the buffalo roam,
+Where the deer and the antelope play,
+Where seldom is heard
+A discouraging word,
+'Cause what can an antelope say?
+%
+O imitators, you slavish herd!
+ -- Quintus Horatius Flaccus (Horace)
+%
+O, it is excellent
+To have a giant's strength; but it is tyrannous
+To use it like a giant.
+ -- William Shakespeare, "Measure for Measure", II, 2
+%
+O Lord, grant that we may always be right,
+for Thou knowest we will never change our minds.
+%
+O love, could thou and I with fate conspire
+To grasp this sorry scheme of things entire,
+Might we not smash it to bits
+And mould it closer to our hearts' desire?
+ -- Omar Khayyam, tr. Fitzgerald
+%
+Oatmeal raisin.
+%
+Objects are lost only because people
+look where they are not rather than where they are.
+%
+O'Brian's Law:
+ Everything is always done for the wrong reasons.
+%
+O'Brien held up his left hand, its back toward Winston, with the
+thumb hidden and the four fingers extended.
+ "How many fingers am I holding up, Winston?"
+ "Four."
+ "And if the Party says that it is not four but five --
+ then how many?"
+ "Four."
+ The word ended in a gasp of pain.
+ -- George Orwell
+%
+Observe yon plumed biped fine.
+To activate its captivation,
+Deposit on its termination,
+A quantity of particles saline.
+%
+Obstacles are what you see when you take your eyes off your goal.
+%
+Obviously, a major malfunction has occurred.
+ -- Steve Nesbitt, voice of Mission Control, January 28,
+ 1986, as the shuttle Challenger exploded within view
+ of the grandstands.
+%
+Obviously the only rational solution to your problem is suicide.
+%
+OCCAM'S ERASER:
+ The philosophical principle that even the simplest
+ solution is bound to have something wrong with it.
+%
+Occident, n.:
+ The part of the world lying west (or east) of the Orient. It is
+ largely inhabited by Christians, powerful sub-tribe of the
+ Hypocrites, whose principal industries are murder and cheating,
+ which they are pleased to call "war" and "commerce." These, also,
+ are the principal industries of the Orient.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+OCEAN:
+ A body of water occupying about two-thirds
+ of a world made for man -- who has no gills.
+%
+Odets, where is thy sting?
+ -- George S. Kaufman
+%
+Of all forms of caution, caution in love is the most fatal.
+%
+Of all men's miseries, the bitterest is this:
+to know so much and have control over nothing.
+ -- Herodotus
+%
+Of all possible committee reactions to any given agenda item, the
+reaction that will occur is the one which will liberate the greatest
+amount of hot air.
+ -- Thomas L. Martin
+%
+Of all the animals, the boy is the most unmanageable.
+ -- Plato
+%
+Of all the words of witch's doom
+There's none so bad as which and whom.
+The man who kills both which and whom
+Will be enshrined in our Who's Whom.
+ -- Fletcher Knebel
+%
+Of all things man is the measure.
+ -- Protagoras
+%
+Of course a platonic relationship is possible -- but only between
+husband and wife.
+%
+Of course it's possible to love a human being
+if you don't know them too well.
+ -- Charles Bukowski
+%
+Of course power tools and alcohol don't mix. Everyone knows power
+tools aren't soluble in alcohol...
+ -- Crazy Nigel
+%
+Of course you can't flap your arms and fly to the moon.
+After awhile you'd run out of air to push against.
+%
+Of course you have a purpose -- to find a purpose.
+%
+Of what you see in books, believe 75%. Of newspapers, believe 50%. And of
+TV news, believe 25% -- make that 5% if the anchorman wears a blazer.
+%
+Office Automation, n.:
+ The use of computers to improve efficiency in the office
+ by removing anyone you would want to talk with over coffee.
+%
+Official Project Stages:
+ 1. Uncritical Acceptance
+ 2. Wild Enthusiasm
+ 3. Dejected Disillusionment
+ 4. Total Confusion
+ 5. Search for the Guilty
+ 6. Punishment of the Innocent
+ 7. Promotion of the Non-participants
+%
+Often statistics are used as a drunken man uses
+lampposts -- for support rather than illumination.
+%
+Often things ARE as bad as they seem!
+%
+Ogden's Law:
+ The sooner you fall behind, the more time you have to catch up.
+%
+Oh, Aunty Em, it's so good to be home!
+%
+Oh, by the way, which one's Pink?
+ -- Pink Floyd
+%
+Oh Dad! We're ALL Devo!
+%
+Oh don't the days seem lank and long
+When all goes right and none goes wrong,
+And isn't your life extremely flat
+With nothing whatever to grumble at!
+%
+Oh Father, my Father, Oh what must I do?
+They're burning our streets and beating me blue.
+"Listen my son, I'll tell you the truth:
+Get a close haircut and spit-shine your shoes."
+
+Oh Mother, my Mother, my confusions remove,
+I long to embrace her whose hair is so smooth.
+"Now listen my son, although you're confused,
+Cut your hair close and shine all your shoes."
+
+Oh Teacher, my Teacher, your life with me share.
+What books ought I read? What thoughts do I dare?
+"Oh Student, my Student, of dissent you beware.
+Shine those dull shoes and cut short your hair."
+
+Oh Preacher, my Preacher, does God really care?
+Are all races equal? Are laws just and fair?
+"Boy -- here's the answer, no need to despair:
+Shine those new shoes and cut short that hair."
+%
+Oh freddled gruntbuggly, thy micturations are to me
+As plurdled gabbleblotchits on a lurgid bee.
+Groop I implore thee, my foonting turlingdromes,
+And hooptiously drangle me with crinkly bindlewurdles,
+Or I will rend thee in the goblerwarts with my blurglecruncheon,
+ see if I don't.
+ -- Prostetnic Vogon Jeltz
+%
+Oh, give me a home,
+Where the buffalo roam,
+And I'll show you a house with a really messy kitchen.
+%
+Oh, give me a locus where the gravitons focus
+ Where the three-body problem is solved,
+ Where the microwaves play down at three degrees K,
+ And the cold virus never evolved. (chorus)
+We eat algae pie, our vacuum is high,
+ Our ball bearings are perfectly round.
+ Our horizon is curved, our warheads are MIRVed,
+ And a kilogram weighs half a pound. (chorus)
+If we run out of space for our burgeoning race
+ No more Lebensraum left for the Mensch
+ When we're ready to start, we can take Mars apart,
+ If we just find a big enough wrench. (chorus)
+I'm sick of this place, it's just McDonald's in space,
+ And living up here is a bore.
+ Tell the shiggies, "Don't cry," they can kiss me goodbye
+ 'Cause I'm moving next week to L4! (chorus)
+
+CHORUS: Home, home on LaGrange,
+ Where the space debris always collects,
+ We possess, so it seems, two of Man's greatest dreams:
+ Solar power and zero-gee sex.
+ -- to Home on the Range
+%
+Oh give me your pity!
+I'm on a committee, We attend and amend
+Which means that from morning And contend and defend
+ to night, Without a conclusion in sight.
+
+We confer and concur,
+We defer and demur, We revise the agenda
+And reiterate all of our thoughts. With frequent addenda
+ And consider a load of reports.
+
+We compose and propose,
+We suppose and oppose, But though various notions
+And the points of procedure are fun; Are brought up as motions,
+ There's terribly little gets done.
+
+We resolve and absolve;
+But we never dissolve,
+Since it's out of the question for us
+To bring our committee
+To end like this ditty,
+Which stops with a period, thus.
+ -- Leslie Lipson, "The Committee"
+%
+"Oh, he [a big dog] hunts with papa," she said. "He says Don Carlos [the
+dog] is good for almost every kind of game. He went duck hunting one time
+and did real well at it. Then Papa bought some ducks, not wild ducks but,
+you know, farm ducks. And it got Don Carlos all mixed up. Since the
+ducks were always around the yard with nobody shooting at them he knew he
+wasn't supposed to kill them, but he had to do something. So one morning
+last spring, when the ground was still soft, he took all the ducks and
+buried them." "What do you mean, buried them?" "Oh, he didn't hurt them.
+He dug little holes all over the yard and picked up the ducks in his mouth
+and put them in the holes. Then he covered them up with mud except for
+their heads. He did thirteen ducks that way and was digging a hole for
+another one when Tony found him. We talked about it for a long time. Papa
+said Don Carlos was afraid the ducks might run away, and since he didn't
+know how to build a cage he put them in holes. He's a smart dog."
+ -- R. Bradford, "Red Sky At Morning"
+%
+Oh, I am a C programmer and I'm okay
+ I muck with indices and structs all day
+And when it works, I shout hoo-ray
+ Oh, I am a C programmer and I'm okay
+%
+Oh, I could while away the hours,
+Smoking herbs and flowers,
+Shooting up my veins,
+ De-dum, De-dum, De-dum
+Tell you, I've been a-thinkin'
+I could drive a shiny Lincoln,
+If I dealt in good cocaine.
+ -- To "If I Only Had A Brain" from "The Wizard of Oz"
+%
+Oh, I don't blame Congress. If I had $600 billion at my disposal, I'd
+be irresponsible, too.
+ -- Lichty & Wagner
+%
+Oh, I have slipped the surly bonds of earth,
+And danced the skies on laughter silvered wings;
+Sunward I've climbed and joined the tumbling mirth
+Of sun-split clouds and done a hundred things
+You have not dreamed of --
+Wheeled and soared and swung
+High in the sunlit silence.
+Hovering there
+I've chased the shouting wind along and flung
+My eager craft through footless halls of air.
+Up, up along delirious, burning blue
+I've topped the wind-swept heights with easy grace,
+Where never lark, or even eagle flew;
+And, while with silent, lifting mind I've trod
+The high untrespassed sanctity of space,
+Put out my hand, and touched the face of God.
+ -- John Gillespie Magee, Jr., "High Flight"
+%
+Oh I'm just a typical American boy
+From a typical American town.
+I believe in God and Senator Dodd
+And keeping old Castro down.
+And when it came my time to serve
+I knew "Better Dead Than Red",
+But when I got to my old draft board,
+Buddy, this is what I said:
+
+Chorus:
+ Sarge, I'm only eighteen, I've got a ruptured spleen,
+ And I always carry a purse!
+ I've got eyes like a bat and my feet are flat,
+ And my asthma's getting worse!
+ Yes, think of my career and my sweetheart dear,
+ And my poor old invalid aunt!
+ Besides I ain't no fool, I'm a-going to school
+ And I'm a-working in a defense plant!
+ -- Phil Ochs, "Draft Dodger Rag"
+%
+Oh Lord, won't you buy me a 4BSD?
+My friends all got sources, so why can't I see?
+Come all you moby hackers, come sing it out with me:
+To hell with the lawyers from AT&T!
+%
+Oh, love is real enough, you will find it some day, but it has one
+arch-enemy -- and that is life.
+ -- Jean Anouilh, "Ardele"
+%
+Oh, my friend, it is not what they take away from you that counts --
+it's what you do with what you have left.
+ -- Hubert H. Humphrey
+%
+Oh no my dear, I'm a very good man. I'm just a very bad wizard.
+ -- Frank Morgan as The Wizard, "The Wizard of Oz"
+%
+Oh, so there you are!
+%
+Oh, the Slithery Dee, he crawled out of the sea.
+He may catch all the others, but he won't catch me.
+No, he won't catch me, stupid ol' Slithery Dee.
+He may catch all the others, but AAAARRRRGGGGHHHH!!!!
+ -- The Smothers Brothers
+%
+Oh this age! How tasteless and ill-bred it is.
+ -- Gaius Valerius Catullus
+%
+Oh wad some power the giftie gie us
+To see oursel's as others see us!
+It wad frae monie a blunder free us,
+And foolish notion.
+ -- Robert Burns, National Poet of Scotland, 1759-1796
+%
+Oh wearisome condition of humanity!
+Born under one law, to another bound.
+ -- Fulke Greville, Lord Brooke
+%
+Oh, well, I guess this is just going to be one of those lifetimes.
+%
+Oh what a tangled web we weave, when first we practice to deceive.
+ -- William Shakespeare
+%
+Oh, when I was in love with you,
+ Then I was clean and brave,
+And miles around the wonder grew
+ How well did I behave.
+
+And now the fancy passes by,
+ And nothing will remain,
+And miles around they'll say that I
+ Am quite myself again.
+ -- A. E. Housman
+%
+Oh, wow! Look at the moon!
+%
+Oh, ya doesn't have ta call me "Johnson"! Well, you can call me "Ray", or
+you can call me "Jay", or you can call me "R. J.", or you can call me "Ray
+J.", or you can call me "R. J. J.", or you can call me "Ray J. Johnson", or
+you can call me "R. J. Johnson", but ya DOESN'T have to call me "Johnson" ...
+%
+Oh, yeah, life goes on, long after the thrill of livin' is gone.
+ -- John Cougar, "Jack and Diane"
+%
+O.K., fine.
+%
+Ok, note to all reading this: if I ask for information and you don't
+have the information available, don't bother sending me an e-mail
+just to tell me that you don't have the information available. Wait
+until you do have the information available, and then e-mail me. You'll
+save precious time and electrons.
+ -- Bill Paul
+%
+OK, now let's look at four dimensions on the blackboard.
+ -- Dr. Joy
+%
+OK, so you're a Ph.D. Just don't touch anything.
+%
+Okay, Okay -- I admit it. You didn't change that program that worked
+just a little while ago; I inserted some random characters into the
+executable. Please forgive me. You can recover the file by typing in
+the code over again, since I also removed the source.
+%
+Old age and treachery will overcome youth and skill.
+%
+Old age is always fifteen years older than I am.
+ -- Bernard Baruch
+%
+Old age is the harbor of all ills.
+ -- Bion
+%
+Old age is the most unexpected of things that can happen to a man.
+ -- Trotsky
+%
+Old age is too high a price to pay for maturity.
+%
+Old Grandad is dead but his spirits live on.
+%
+Old Japanese proverb:
+ There are two kinds of fools -- those who never climb Mt. Fuji,
+and those who climb it twice.
+%
+Old MacDonald had an agricultural real estate tax abatement.
+%
+Old mail has arrived.
+%
+Old men are fond of giving good advice to console themselves for being
+no longer in a position to give bad examples.
+ -- Francois de La Rochefoucauld, "Maxims"
+%
+Old Mother Hubbard went to the cupboard
+To fetch her poor daughter a dress.
+When she got there, the cupboard was bare
+And so was her daughter, I guess...
+%
+Old musicians never die, they just decompose.
+%
+Old programmers never die, they just become managers.
+%
+Old programmers never die, they just branch to a new address.
+%
+Old programmers never die, they just hit account block limit.
+%
+Old soldiers never die. Young ones do.
+%
+Old timer, n.:
+ One who remembers when charity was a virtue and not an organization.
+%
+Olivier's Law:
+ Experience is something you don't get until just after you need it.
+%
+Omnibiblious, adj.:
+ Indifferent to type of drink. Ex: "Oh, you can get me anything.
+ I'm omnibiblious."
+%
+On a clear day, U.C.L.A.
+%
+On a clear disk you can seek forever.
+ -- P. Denning
+%
+On a paper submitted by a physicist colleague:
+
+This isn't right. This isn't even wrong.
+ -- Wolfgang Pauli
+%
+On a tous un peu peur de l'amour, mais on
+a surtout peur de souffrir ou de faire souffrir.
+
+[One is always a little afraid of love, but
+above all, one is afraid of pain or causing pain.]
+%
+On ability:
+ A dwarf is small, even if he stands on a mountain top;
+ a colossus keeps his height, even if he stands in a well.
+ -- Lucius Annaeus Seneca, 4BC - 65AD
+%
+On account of being a democracy and run by the people, we are the only
+nation in the world that has to keep a government four years, no matter
+what it does.
+ -- Will Rogers
+%
+On his way back from work, a driver came upon a horrible wreck in which one
+car looked exactly like his neighbor's. Stopping hurriedly on the side of
+the road, he ran toward the smoldering debris.
+ "Listen, mister," a policeman said, holding him back, "I can't let
+you come any closer."
+ "But that may be my friend, Henry, in there," the anguished man
+explained.
+ "OK, but it's pretty grisly," the cop cautioned. "There was a
+decapitation."
+ The policeman reached into the back seat of the demolished car and
+pulled forth the head, holding it at arm's length. "Is this your friend?"
+ "That's not him -- thank heavens," the man said. "Henry's much
+taller."
+%
+On Monday mornings I am dedicated to the
+proposition that all men are created jerks.
+ -- H. Allen Smith, "Let the Crabgrass Grow"
+%
+On Thanksgiving Day all over America, families sit down to dinner at the
+same moment -- halftime.
+%
+On the eighth day, God created FORTRAN.
+%
+On the night before her family moved from Kansas to California, the little
+girl knelt by her bed to say her prayers. "God bless Mommy and Daddy and
+Keith and Kim," she said. As she began to get up, she quickly added, "Oh,
+and God, this is goodbye. We're moving to Hollywood."
+%
+On the subject of C program indentation:
+
+ "In My Egotistical Opinion, most people's C programs should be
+ indented six feet downward and covered with dirt."
+ -- Blair P. Houghton
+%
+On the whole, I'd rather be in Philadelphia.
+ -- W. C. Fields' epitaph
+%
+On two occasions I have been asked [by members of Parliament!], "Pray, Mr.
+Babbage, if you put into the machine wrong figures, will the right answers
+come out?" I am not able rightly to apprehend the kind of confusion of
+ideas that could provoke such a question.
+ -- Charles Babbage
+%
+Once ... in the wilds of Afghanistan, I lost my corkscrew,
+and we were forced to live on nothing but food and water for days.
+ -- W. C. Fields, "My Little Chickadee"
+%
+Once a word has been allowed to escape, it cannot be recalled.
+ -- Quintus Horatius Flaccus (Horace)
+%
+Once, adv.:
+ Enough.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Once again dread deed is done.
+Canon sleeps,
+his all-knowing eye shaded
+to human chance and circumstance.
+Peace reigns anew o'er Pine Valley,
+but Canon's sleep is troubled.
+
+Beware, scant days past the Ides of July.
+Impatient hands wait eagerly
+to grasp, to hold
+scant moments of time
+wrested from life in the full
+glory of Canon's power;
+held captive by his unblinking eye.
+
+Three golden orbs stand watch;
+one each to toll the day, hour, minute
+until predestiny decrees his reawakening.
+When that feared moment arrives,
+"Ask not for whom the bell tolls,
+It tolls for thee."
+ -- "I extended the loan on your Camera, at the Pine
+ Valley Pawn Shop today"
+%
+Once Again From the Top
+
+Correction notice in the Miami Herald: "Last Sunday, The Herald erroneously
+reported that original Dolphin Johnny Holmes had been an insurance salesman
+in Raleigh, North Carolina, that he had won the New York lottery in 1982 and
+lost the money in a land swindle, that he had been charged with vehicular
+homicide, but acquitted because his mother said she drove the car, and that
+he stated that the funniest thing he ever saw was Flipper spouting water on
+George Wilson. Each of these items was erroneous material published
+inadvertently. He was not an insurance salesman in Raleigh, did not win the
+lottery, neither he nor his mother was charged or involved in any way with
+vehicular homicide, and he made no comment about Flipper or George Wilson.
+The Herald regrets the errors."
+ -- "The Progressive", March, 1987
+%
+Once again, we come to the Holiday Season, a deeply religious time that
+each of us observes, in his own way, by going to the mall of his
+choice.
+
+In the old days, it was not called the Holiday Season; the Christians
+called it "Christmas" and went to church; the Jews called it "Hanukkah"
+and went to synagogue; the atheists went to parties and drank. People
+passing each other on the street would say "Merry Christmas!" or "Happy
+Hanukkah!" or (to the atheists) "Look out for the wall!"
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+Once at a social gathering, Gladstone said to Disraeli, "I predict,
+Sir, that you will die either by hanging or of some vile disease".
+Disraeli replied, "That all depends upon whether I embrace your
+principals or your mistress."
+%
+Once harm has been done, even a fool understands it.
+ -- Homer
+%
+Once he had one leg in the White House and the nation trembled under his
+roars. Now he is a tinpot pope in the Coca-Cola belt and a brother to the
+forlorn pastors who belabor halfwits in galvanized iron tabernacles behind
+the railroad yards."
+ -- H. L. Mencken, writing of William Jennings Bryan,
+ counsel for the supporters of Tennessee's anti-evolution
+ law at the Scopes "Monkey Trial" in 1925.
+%
+Once I finally figured out all of life's
+answers, they changed the questions.
+%
+Once, I read that a man be never stronger
+than when he truly realizes how weak he is.
+ -- Jim Starlin, "Captain Marvel #31"
+%
+Once is happenstance,
+Twice is coincidence,
+Three times is enemy action.
+ -- Auric Goldfinger
+%
+Once it hits the fan, the only rational choice is to
+sweep it up, package it, and sell it as fertilizer.
+%
+Once Law was sitting on the bench
+ And Mercy knelt a-weeping.
+"Clear out!" he cried, "disordered wench!
+ Nor come before me creeping.
+Upon your knees if you appear,
+'Tis plain you have no standing here."
+
+Then Justice came. His Honor cried:
+ "YOUR states? -- Devil seize you!"
+"Amica curiae," she replied --
+ "Friend of the court, so please you."
+"Begone!" he shouted -- "There's the door --
+I never saw your face before!"
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Once the realization is accepted that even between the closest human beings
+infinite distances continue to exist, a wonderful living side by side can
+grow up, if they succeed in loving the distance between them which makes it
+possible for each to see each other whole against the sky.
+ -- Rainer Rilke
+%
+Once the toothpaste is out of the tube, it's hard to get it back in.
+ -- H. R. Haldeman
+%
+Once there was a little nerd who loved to read your mail,
+And then yank back the i-access times to get hackers off his tail,
+And once as he finished reading from the secretary's spool,
+He wrote a rude rejection to her boyfriend (how uncool!)
+And this as delivermail did work and he ran his backfstat,
+He heard an awful crackling like rat fritters in hot fat,
+And hard errors brought the system down 'fore he could even shout!
+ And the bio bug'll bring yours down too, ef you don't watch out!
+And once they was a little flake who'd prowl through the uulog,
+And when he went to his blit that night to play at being god,
+The ops all heard him holler, and they to the console dashed,
+But when they did a ps -ut they found the system crashed!
+Oh, the wizards adb'd the dumps and did the system trace,
+And worked on the file system 'til the disk head was hot paste,
+But all they ever found was this: "panic: never doubt",
+ And the bio bug'll crash your box too, ef you don't watch out!
+When the day is done and the moon comes out,
+And you hear the printer whining and the rk's seems to count,
+When the other desks are empty and their terminals glassy grey,
+And the load is only 1.6 and you wonder if it'll stay,
+You must mind the file protections and not snoop around,
+ Or the bio bug'll getcha and bring the system down!
+%
+Once there was this conductor see, who had a bass problem. You see, during
+a portion of Beethoven's Ninth Symphony in which there are no bass violin
+parts, one of the bassists always passed a bottle of scotch around. So,
+to remind himself that the basses usually required an extra cue towards the
+end of the symphony, the conductor would fasten a piece of string around the
+page of the score before the bass cue. As the basses grew more and more
+inebriated, two of them fell asleep. The conductor grew quite nervous (he
+was very concerned about the pitch) because it was the bottom of the ninth;
+the score was tied and the basses were loaded with two out.
+%
+Once upon a time there...
+%
+Once upon a time there was a kingdom ruled by a great bear. The peasants
+were not very rich, and one of the few ways to become at all wealthy was
+to become a Royal Knight. This required an interview with the bear. If
+the bear liked you, you were knighted on the spot. If not, the bear would
+just as likely remove your head with one swat of a paw. However, the family
+of these unfortunate would-be knights was compensated with a beautiful
+sheepdog from the royal kennels, which was itself a fairly valuable
+possession. And the moral of the story is:
+
+The mourning after a terrible knight, nothing beats the dog of the bear that
+hit you.
+%
+Once upon this midnight incoherent,
+While you pondered sentient and crystalline,
+Over many a broken and subordinate
+Volume of gnarly lore,
+While I pestered, nearly singing,
+Suddenly there came a hewing,
+As of someone profusely skulking,
+Skulking at my chamber door.
+%
+Once you've seen one nuclear war, you've seen them all.
+%
+Once you've tried to change the world you find
+it's a whole bunch easier to change your mind.
+%
+One advantage of talking to yourself is that you know at least
+somebody's listening.
+ -- Franklin P. Jones
+%
+"One Architecture, One OS" also translates as "One Egg, One Basket".
+%
+"One basic notion underlying Usenet is that it is a cooperative."
+
+Having been on USENET for going on ten years, I disagree with this.
+The basic notion underlying USENET is the flame.
+ -- Chuq Von Rospach
+%
+One Bell System - it sometimes works.
+%
+One Bell System - it used to work before they installed the Dimension!
+%
+One Bell System - it works.
+%
+One big pile is better than two little piles.
+ -- Arlo Guthrie
+%
+One can never consent to creep when one feels an impulse to soar.
+ -- Helen Keller
+%
+One can search the brain with a microscope and not find the
+mind, and can search the stars with a telescope and not find God.
+ -- J. Gustav White
+%
+One cannot make an omelette without breaking eggs -- but it is amazing
+how many eggs one can break without making a decent omelette.
+ -- Professor Charles P. Issawi
+%
+One can't proceed from the informal to the formal by formal means.
+%
+One could not be a successful scientist without realizing that, in contrast
+to the popular conception supported by newspapers and mothers of scientists,
+a goodly number of scientists are not only narrow-minded and dull, but also
+just stupid.
+ -- J. D. Watson, "The Double Helix"
+%
+One day an elderly Jewish Pole, living in Warsaw, finds an old lamp in his
+attic. He starts to polish it and (poof!) a genie appears in a cloud of
+smoke.
+ "Greetings, Mortal!" exclaims the genie, stretching and yawning, "For
+releasing me I will grant you three wishes."
+ The old man thinks for a moment, then replies, "I want Genghis Khan
+resurrected. I want him to re-unite the Mongol hordes, march to the Polish
+border, decide he doesn't want to invade, and march back home."
+ "No sooner said than done!" thunders the genie. "Your second wish?"
+ "Hmmmm. I want Genghis Khan resurrected. I want him to re-unite the
+Mongol hordes, march to the Polish border, decide he doesn't want to invade,
+and march back home."
+ "But... well, all right! Your third wish?"
+ "I want Genghis Khan resurrected. I want him to re-unite his ---"
+ "OKOKOKOK! Right. Got it. Why do you want Genghis Khan to march
+to Poland three times and never invade?"
+ The old man smiles. "He has to pass through Russia six times."
+%
+One day the King decided that he would force all his subjects to tell the
+truth. A gallows was erected in front of the city gates. A herald announced,
+"Whoever would enter the city must first answer the truth to a question
+which will be put to him." Nasrudin was first in line. The captain of the
+guard asked him, "Where are you going? Tell the truth -- the alternative
+is death by hanging."
+ "I am going," said Nasrudin, "to be hanged on that gallows."
+ "I don't believe you."
+ "Very well, if I have told a lie, then hang me!"
+ "But that would make it the truth!"
+ "Exactly," said Nasrudin, "your truth."
+%
+One day this guy is finally fed up with his middle-class existence and
+decides to do something about it. He calls up his best friend, who is a
+mathematical genius. "Look," he says, "do you suppose you could find some
+way mathematically of guaranteeing winning at the race track? We could
+make a lot of money and retire and enjoy life." The mathematician thinks
+this over a bit and walks away mumbling to himself.
+ A week later his friend drops by to ask the genius if he's had any
+success. The genius, looking a little bleary-eyed, replies, "Well, yes,
+actually I do have an idea, and I'm reasonably sure that it will work, but
+there a number of details to be figured out.
+ After the second week the mathematician appears at his friend's house,
+looking quite a bit rumpled, and announces, "I think I've got it! I still have
+some of the theory to work out, but now I'm certain that I'm on the right
+track."
+ At the end of the third week the mathematician wakes his friend by
+pounding on his door at three in the morning. He has dark circles under his
+eyes. His hair hasn't been combed for many days. He appears to be wearing
+the same clothes as the last time. He has several pencils sticking out from
+behind his ears and an almost maniacal expression on his face. "WE CAN DO
+IT! WE CAN DO IT!!" he shrieks. "I have discovered the perfect solution!!
+And it's so EASY! First, we assume that horses are perfect spheres in simple
+harmonic motion..."
+%
+One day,
+A mad meta-poet,
+With nothing to say,
+Wrote a mad meta-poem
+That started: "One day,
+A mad meta-poet,
+With nothing to say,
+Wrote a mad meta-poem
+That started: "One day,
+[...]
+sort of close".
+Were the words that the poet,
+Finally chose,
+To bring his mad poem,
+To some sort of close".
+Were the words that the poet,
+Finally chose,
+To bring his mad poem,
+To some sort of close".
+%
+One difference between a man and a machine
+is that a machine is quiet when well oiled.
+%
+One doesn't have a sense of humor. It has you.
+ -- Larry Gelbart
+%
+One dusty July afternoon, somewhere around the turn of the century, Patrick
+Malone was in Mulcahey's Bar, bending an elbow with the other street car
+conductors from the Brooklyn Traction Company. While they were discussing the
+merits of a local ring hero, the bar goes silent. Malone turns around to see
+his wife, with a face grim as death, stalking to the bar.
+ Slapping a four-bit piece down on the bar, she draws herself up to her
+full five feet five inches and says to Mulcahey, "Give me what himself has
+been havin' all these years."
+ Mulcahey looks at Malone, who shrugs, and then back at Margaret Mary
+Malone. He sets out a glass and pours her a triple shot of Rye. The bar is
+totally silent as they watch the woman pick up the glass and knock back the
+drink. She slams the glass down on the bar, gasps, shudders slightly, and
+passes out; falling straight back, stiff as a board, saved from sudden contact
+with the barroom floor by the ample belly of Seamus Fogerty.
+ Sometime later, she comes to on the pool table, a jacket under her
+head. Her bloodshot eyes fell upon her husband, who says, "And all these
+years you've been thinkin' I've been enjoying meself."
+%
+One expresses well the love he does not feel.
+ -- J. A. Karr
+%
+One family builds a wall, two families enjoy it.
+%
+One father is more than a hundred schoolmasters.
+ -- George Herbert
+%
+One friend in a lifetime is much; two are many; three are hardly possible.
+Friendship needs a certain parallelism of life, a community of thought,
+a rivalry of aim.
+ -- Henry Brook Adams
+%
+One girl can be pretty -- but a dozen are only a chorus.
+ -- F. Scott Fitzgerald, "The Last Tycoon"
+%
+One good reason why computers can do more work than
+people is that they never have to stop and answer the phone.
+%
+One good suit is worth a thousand resumes.
+%
+One good thing about music,
+Well, it helps you feel no pain.
+So hit me with music;
+Hit me with music now.
+ -- Bob Marley, "Trenchtown Rock"
+%
+One good turn asketh another.
+ -- John Heywood
+%
+One good turn deserves another.
+ -- Gaius Petronius
+%
+One good turn usually gets most of the blanket.
+%
+One has to look out for engineers -- they begin with sewing machines
+and end up with the atomic bomb.
+ -- Marcel Pagnol
+%
+One hundred women are not worth a single testicle.
+ -- Confucius
+%
+One is not superior merely because one sees the world as odious.
+ -- Chateaubriand (1768-1848)
+%
+One is often kept in the right road by a rut.
+ -- Gustave Droz
+%
+One learns to itch where one can scratch.
+ -- Ernest Bramah
+%
+ONE LIFE TO LIVE for ALL MY CHILDREN in
+ANOTHER WORLD all THE DAYS OF OUR LIVES.
+%
+One man tells a falsehood, a hundred repeat it as true.
+%
+One man's brain plus one other will produce one half as many ideas as
+one man would have produced alone. These two plus two more will
+produce half again as many ideas. These four plus four more begin to
+represent a creative meeting, and the ratio changes to one quarter as
+many ...
+ -- Anthony Chevins
+%
+One man's constant is another man's variable.
+ -- Alan J. Perlis
+%
+One man's folly is another man's wife.
+ -- Helen Rowland
+%
+One man's "magic" is another man's engineering.
+"Supernatural" is a null word.
+%
+One man's Mede is another man's Persian.
+ -- George M. Cohan
+%
+One man's theology is another man's belly laugh.
+%
+One measure of friendship consists not in the number of things friends
+can discuss, but in the number of things they need no longer mention.
+ -- Clifton Fadiman
+%
+One meets his destiny often on the road he takes to avoid it.
+%
+One monk said to the other, "The fish has flopped out of the net! How
+will it live?" The other said, "When you have gotten out of the net,
+I'll tell you."
+%
+One must have a heart of stone to read the death of Little Nell by Dickens
+without laughing.
+ -- Oscar Wilde
+%
+One nice thing about egotists: they don't talk about other people.
+%
+One nuclear bomb can ruin your whole day.
+%
+One of my less pleasant chores when I was young was to read the Bible from
+one end to the other. Reading the Bible straight through is at least 70
+percent discipline, like learning Latin. But the good parts are, of course,
+simply amazing. God is an extremely uneven writer, but when He's good,
+nobody can touch him.
+ -- John Gardner, NYT Book Review, Jan. 1983
+%
+One of the chief duties of the mathematician in acting as an
+advisor... is to discourage... from expecting too much from
+mathematics.
+ -- N. Wiener
+%
+One of the disadvantages of having children is that they eventually get old
+enough to give you presents they make at school.
+ -- Robert Byrne
+%
+One of the large consolations for experiencing anything
+unpleasant is the knowledge that one can communicate it.
+ -- Joyce Carol Oates
+%
+One of the lessons of history is that nothing is often a good thing to
+do and always a clever thing to say.
+ -- Will Durant
+%
+One of the major difficulties Trillian experienced in her relationship with
+Zaphod was learning to distinguish between him pretending to be stupid just
+to get people off their guard, pretending to be stupid because he couldn't
+be bothered to think and wanted someone else to do it for him, pretending
+to be so outrageously stupid to hide the fact that he actually didn't
+understand what was going on, and really being genuinely stupid. He was
+renowned for being quite clever and quite clearly was so -- but not all the
+time, which obviously worried him, hence the act. He preferred people to be
+puzzled rather than contemptuous. This above all appeared to Trillian to be
+genuinely stupid, but she could no longer be bothered to argue about.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+One of the most overlooked advantages to computers is... If they do
+foul up, there's no law against whacking them around a little.
+ -- Joe Martin
+%
+One of the most striking differences between a
+cat and a lie is that a cat has only nine lives.
+ -- Mark Twain
+%
+One of the oldest problems puzzled over in the Talmud is: "Why did God
+create goyim?" The generally accepted answer is "_s_o_m_e_b_o_d_y has to buy
+retail."
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+One of the pleasures of reading old letters is the knowledge that they
+need no answer.
+ -- George Gordon, Lord Byron
+%
+One of the rules of Busmanship, New York style, is never surrender your
+seat to another passenger. This may seem callous, but it is the best
+way, really. If one passenger were to give a seat to someone who fainted
+in the aisle, say, the others on the bus would become disoriented and
+imagine they were in Topeka Kansas.
+%
+One of the signs of Napoleon's greatness is the fact that he
+once had a publisher shot.
+ -- Siegfried Unseld
+%
+One of the worst of my many faults is that I'm too critical of myself.
+%
+One of your most ancient writers, a historian named Herodotus, tells of a
+thief who was to be executed. As he was taken away he made a bargain with
+the king: in one year he would teach the king's favorite horse to sing
+hymns. The other prisoners watched the thief singing to the horse and
+laughed. "You will not succeed," they told him. "No one can."
+ To which the thief replied, "I have a year, and who knows what might
+happen in that time. The king might die. The horse might die. I might die.
+And perhaps the horse will learn to sing.
+ -- "The Mote in God's Eye", Niven and Pournelle
+%
+One organism, one vote.
+%
+One person's error is another person's data.
+%
+One picture is worth 128K words.
+%
+One picture is worth more than ten thousand words.
+ -- Chinese proverb
+%
+One pill makes you larger And if you go chasing rabbits
+And, one pill makes you small. And you know you're going to fall.
+And the ones that mother gives you, Tell 'em a hookah smoking caterpillar
+Don't do anything at all. Has given you the call.
+Go ask Alice Call Alice
+When she's ten feet tall. When she was just small.
+
+When men on the chessboard When logic and proportion
+Get up and tell you where to go. Have fallen sloppy dead,
+And you've just had some kind of And the White Knight is talking
+ mushroom backwards
+And your mind is moving low. And the Red Queen's lost her head
+Go ask Alice Remember what the dormouse said:
+I think she'll know. Feed your head.
+ Feed your head.
+ Feed your head.
+ -- Jefferson Airplane, "White Rabbit"
+%
+One planet is all you get.
+%
+One possible reason that things aren't going according to plan
+is that there never was a plan in the first place.
+%
+One promising concept that I came up with right away was that you could
+manufacture personal air bags, then get a law passed requiring that
+they be installed on congressmen to keep them from taking trips. Let's
+say your congressman was trying to travel to Paris to do a fact-finding
+study on how the French government handles diseases transmitted by
+sherbet. Just when he got to the plane, his mandatory air bag,
+strapped around his waist, would inflate -- FWWAAAAAAPPPP -- thus
+rendering him too large to fit through the plane door. It could also
+be rigged to inflate whenever the congressman proposed a law. ("Mr.
+Speaker, people ask me, why should October be designated as Cuticle
+Inspection Month? And I answer that FWWAAAAAAPPPP.") This would save
+millions of dollars, so I have no doubt that the public would violently
+support a law requiring airbags on congressmen. The problem is that
+your potential market is very small: there are only around 500 members
+of Congress, and some of them, such as House Speaker "Tip" O'Neil, are
+already too large to fit on normal aircraft.
+ -- Dave Barry, "'Mister Mediocre' Restaurants"
+%
+One reason why George Washington
+Is held in such veneration:
+He never blamed his problems
+On the former Administration.
+ -- George O. Ludcke
+%
+One Saturday afternoon, during the campaign to decide whether or not there
+should be a Coastal Commission, I took a helicopter ride from Los Angeles
+to San Diego. We passed several state beaches, some crowded and some
+virtually empty. They had the same facilities, and in some cases the crowded
+and the empty beach were within a quarter mile of each other. Obviously
+many beach-goers prefer to be crowded together. Buying more beaches that
+people won't go to because they prefer to be crowded together on one beach
+is a ridiculous waste of our natural resources and our taxes.
+ -- Ronald Reagan
+%
+One seldom sees a monument to a committee.
+%
+One should always be in love. That is the reason one should never marry.
+ -- Oscar Wilde
+%
+ONE SIZE FITS ALL:
+ Doesn't fit anyone.
+%
+One small step for man, one giant stumble for mankind.
+%
+One thing about the past.
+It's likely to last.
+ -- Ogden Nash
+%
+ONE THING KIDS LIKE is to be tricked. For instance, I was going to take
+my little nephew to Disneyland, but instead I drove him to a burned-out
+warehouse. "Oh, oh," I said. "Disneyland burned down." He cried and
+cried, but I think that deep down he thought it was a pretty good joke.
+
+I started to drive over to the real Disneyland, but it was getting pretty
+late.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+One thing the inventors can't seem to
+get the bugs out of is fresh paint.
+%
+One thing they don't tell you about doing experimental physics is that
+sometimes you must work under adverse conditions... like a state of sheer
+terror.
+ -- W. K. Hartmann
+%
+One thought driven home is better than three left on base.
+%
+One toke over the line, sweet Mary,
+One toke over the line,
+Sittin' downtown in a railway station,
+One toke over the line.
+Waitin' for the train that goes home,
+Hopin' that the train is on time,
+Sittin' downtown in a railway station,
+One toke over the line.
+%
+One way to make your old car run better is to look up the price of a
+new model.
+%
+One way to stop a run away horse is to bet on him.
+%
+One, with God, is always a majority, but many a martyr has been burned at
+the stake while the votes were being counted.
+ -- Thomas B. Reed
+%
+One would like to stroke and caress human beings, but one dares not do so,
+because they bite.
+ -- Vladimir Lenin
+%
+One-Shot Case Study, n.:
+ The scientific equivalent of the four-leaf clover, from which
+ it is concluded all clovers possess four leaves and are sometimes green.
+%
+On-line, adj.:
+ The idea that a human being should always be accessible to a
+ computer.
+%
+Only a fool has no doubts.
+%
+Only a mediocre person is always at his best.
+ -- Dr. Laurence J. Peter
+%
+Only adults have difficulty with childproof caps.
+%
+Only fools are quoted.
+ -- Anonymous
+%
+Only God can make random selections.
+%
+Only great masters of style can succeed in being obtuse.
+ -- Oscar Wilde
+
+Most UNIX programmers are great masters of style.
+ -- The Unnamed Usenetter
+%
+Only Irish coffee provides in a single glass all four
+essential food groups -- alcohol, caffeine, sugar, and fat.
+ -- Alex Levine
+
+[Oh come on, everybody knows that the four basic food groups are
+hot sugar, cold sugar, carbohydrates and grease. Ed.]
+%
+Only kings, presidents, editors, and people with tapeworms have the right
+to use the editorial "we".
+%
+Only someone with nothing to be sorry for
+smiles back at the rear of an elephant.
+%
+Only that in you which is me can hear what I'm saying.
+ -- Baba Ram Dass
+%
+Only the fittest survive. The vanquished acknowledge their unworthiness by
+placing a classified ad with the ritual phrase "must sell -- best offer,"
+and thereafter dwell in infamy, relegated to discussing gas mileage and lawn
+food. But if successful, you join the elite sodality that spends hours
+unpurifying the dialect of the tribe with arcane talk of bits and bytes, RAMS
+and ROMS, hard disks and baud rates. Are you obnoxious, obsessed? It's a
+modest price to pay. For you have tapped into the same awesome primal power
+that produces credit-card billing errors and lost plane reservations. Hail,
+postindustrial warrior, subduer of Bounceoids, pride of the cosmos, keeper of
+the silicone creed: Computo, ergo sum. The force is with you -- at 110 volts.
+May your RAMS be fruitful and multiply.
+ -- Curt Suplee, "Smithsonian", 4/83
+%
+Only the hypocrite is really rotten to the core.
+ -- Hannah Arendt
+%
+Only those who leisurely approach that which the masses are
+busy about can be busy about that which the masses take leisurely.
+ -- Lao Tsu
+%
+Only through hard work and perseverance can one truly suffer.
+%
+Only two groups of people fall for flattery -- men and women.
+%
+Only two kinds of witnesses exist. The first live in a neighborhood where
+a crime has been committed and in no circumstances have ever seen anything
+or even heard a shot. The second category are the neighbors of anyone who
+happens to be accused of the crime. These have always looked out of their
+windows when the shot was fired, and have noticed the accused person standing
+peacefully on his balcony a few yards away.
+ -- Sicilian police officer
+%
+Only two of my personalities are schizophrenic, but one
+of them is paranoid and the other one is out to get him.
+%
+Only way to open lips of pigeon, sledgehammer.
+%
+Ontogeny recapitulates phylogeny.
+%
+Onward through the fog.
+%
+Operator, please trace this call and tell me where I am.
+%
+Opiates are the religion of the upper-middle classes.
+ -- Debbie VanDam
+%
+Opium is very cheap considering you don't
+feel like eating for the next six days.
+ -- Taylor Mead, famous transvestite
+%
+Oppernockity tunes but once.
+%
+Opportunities are usually disguised as hard
+work, so most people don't recognize them.
+%
+Oprah Winfrey has an incredible talent for getting the weirdest people to
+talk to. And you just HAVE to watch it. "Blind, masochistic minority,
+crippled, depressed, government latrine diggers, and the women who love
+them too much on the next Oprah Winfrey."
+%
+Optimism is the content of small men in high places.
+ -- F. Scott Fitzgerald, "The Crack Up"
+%
+Optimism, n.:
+The belief that everything is beautiful, including what is ugly, good, bad,
+and everything right that is wrong. It is held with greatest tenacity by
+those accustomed to falling into adversity, and most acceptably expounded
+with the grin that apes a smile. Being a blind faith, it is inaccessible
+to the light of disproof -- an intellectual disorder, yielding to no treatment
+but death. It is hereditary, but not contagious.
+%
+Optimist, n.:
+ A bagpiper with a beeper.
+%
+Optimist, n.:
+ A proponent of the belief that black is white.
+
+ A pessimist asked God for relief.
+ "Ah, you wish me to restore your hope and cheerfulness," said God.
+ "No," replied the petitioner, "I wish you to create something that
+would justify them."
+ "The world is all created," said God, "but you have overlooked
+something -- the mortality of the optimist."
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Optimist, n.:
+ Someone who goes down to the marriage
+ bureau to see if his license has expired.
+%
+Optimization hinders evolution.
+%
+Oral sex is like being attacked by a giant snail.
+ -- Germaine Greer
+%
+Orcs really aren't so bad (if you use lots of catsup).
+%
+Order and simplification are the first steps toward
+mastery of a subject -- the actual enemy is the unknown.
+ -- Thomas Mann
+%
+Oregano, n.:
+ The ancient Italian art of pizza folding.
+%
+Oregon, n.:
+ Eighty billion gallons of water with no place to go on Saturday
+night.
+%
+O'Reilly's Law of the Kitchen:
+Cleanliness is next to impossible
+%
+Oreo
+%
+Organic chemistry is the chemistry of carbon compounds.
+Biochemistry is the study of carbon compounds that crawl.
+ -- Mike Adams
+%
+Original thought is like original sin: both happened before you were born
+to people you could not have possibly met.
+ -- Fran Lebowitz, "Social Studies"
+%
+Osborn's Law:
+ Variables won't; constants aren't.
+%
+Other than that, Mrs. Lincoln, how did you like the play?
+%
+Other women cloy
+The appetites they feed, but she makes hungry
+Where most she satisfies.
+ -- Antony and Cleopatra
+%
+Others can stop you temporarily, only you can do it permanently.
+%
+Others will look to you for stability,
+so hide when you bite your nails.
+%
+O'Toole's commentary on Murphy's Law:
+ Murphy was an optimist.
+%
+Ouch! That felt good!
+ -- Karen Gordon
+%
+"Our attitude with TCP/IP is, `Hey, we'll do it, but don't make a big
+system, because we can't fix it if it breaks -- nobody can.'"
+
+"TCP/IP is OK if you've got a little informal club, and it doesn't make
+any difference if it takes a while to fix it."
+ -- Ken Olsen, in Digital News, 1988
+%
+Our business in life is not to succeed
+but to continue to fail in high spirits.
+ -- Robert Louis Stevenson
+%
+Our congratulations go to a Burlington Vermont civilian employee of the
+local Army National Guard base. He recently received a substantial cash
+award from our government for inventing a device for optical scanning.
+His device reportedly will save the government more than $6 million a year
+by replacing a more expensive helicopter maintenance tool with his own,
+home-made, hand-held model.
+
+Not surprisingly, we also have a couple of money-saving ideas that we submit
+to the Pentagon free of charge:
+
+ a. Don't kill anybody.
+ b. Don't build things that do.
+ c. And don't pay other people to kill anybody.
+
+We expect annual savings to be in the billions.
+ -- Sojourners
+%
+Our country has plenty of good five-cent cigars,
+but the trouble is they charge fifteen cents for them.
+%
+Our documentation manager was showing her two year old son around the
+office. He was introduced to me, at which time he pointed out that we
+were both holding bags of popcorn. We were both holding bottles of
+juice. But only *_h_e* had a lollipop.
+
+He asked his mother, "Why doesn't HE have a lollipop?"
+
+Her reply:
+
+ "He can have a lollipop any time he wants to. That's what it
+ means to be a programmer."
+%
+Our government has kept us in a perpetual state of fear -- kept us in a
+continuous stampede of patriotic fervor -- with the cry of grave national
+emergency... Always there has been some terrible evil to gobble us up if we
+did not blindly rally behind it by furnishing the exorbitant sums demanded.
+Yet, in retrospect, these disasters seem never to have happened, seem never
+to have been quite real.
+ -- General Douglas MacArthur, 1957
+%
+Our houseplants have a good sense of humous.
+%
+Our informal mission is to improve the love life of operators worldwide.
+ -- Peter Behrendt, president of Exabyte
+%
+Our little systems have their day;
+They have their day and cease to be;
+They are but broken lights of thee.
+ -- Tennyson
+%
+Our OS who art in CPU, UNIX be thy name.
+Thy programs run, thy syscalls done,
+In kernel as it is in user.
+%
+Our parents were of Midwestern stock and very strict. They didn't want us
+to grow up to be spoiled and rich. If we left our tennis racquets in the
+rain, we were punished.
+ -- Nancy Ellis (George Bush's sister), in the New Republic
+%
+Our policy is, when in doubt, do the right thing.
+ -- Roy L. Ash, ex-president, Litton Industries
+%
+Our problems are so serious that the best
+way to talk about them is lightheartedly.
+%
+Our sires' age was worse that our grandsires'.
+We their sons are more worthless than they:
+so in our turn we shall give the world a progeny yet more corrupt.
+ -- Quintus Horatius Flaccus (Horace)
+%
+Our swords shall play the orators for us.
+ -- Christopher Marlowe
+%
+Our universe itself keeps on expanding and expanding,
+In all of the directions it can whiz;
+As fast as it can go, that's the speed of light, you know,
+Twelve million miles a minute and that's the fastest speed there is.
+So remember, when you're feeling very small and insecure,
+How amazingly unlikely is your birth;
+And pray that there's intelligent life somewhere out in space,
+'Cause there's bugger all down here on Earth!
+ -- Monty Python
+%
+Our vision is to speed up time, eventually eliminating it.
+ -- Alex Schure
+%
+Ours is a world of nuclear giants and ethical infants.
+ -- General Omar N. Bradley
+%
+Ours is a world where people don't know what they
+want and are willing to go through hell to get it.
+%
+Out of sight is out of mind.
+ -- Arthur Clough
+%
+Out of the crooked timber of humanity no straight thing can ever be made.
+ -- Immanuel Kant
+%
+Out of the mouths of babes does often come cereal.
+%
+Outside of a dog, a book is a man's best friend: and inside a dog,
+it's too dark to read.
+ -- Groucho Marx
+%
+Over the shoulder supervision is more a
+need of the manager than the programming task.
+%
+Over the years, I've developed my sense of deja vu so acutely that now
+I can remember things that *have* happened before ...
+%
+Overall, the philosophy is to attack the availability problem from two
+complementary directions: to reduce the number of software errors through
+rigorous testing of running systems, and to reduce the effect of the remaining
+errors by providing for recovery from them. An interesting footnote to this
+design is that now a system failure can usually be considered to be the
+result of two program errors: the first, in the program that started the
+problem; the second, in the recovery routine that could not protect the
+system.
+ -- A. L. Scherr, "Functional Structure of IBM Virtual
+ Storage Operating Systems, Part II: OS/VS-2
+ Concepts and Philosophies,"
+ IBM Systems Journal, Vol. 12, No. 4.
+%
+Overconfidence breeds error when we take for granted that the game will
+continue on its normal course; when we fail to provide for an unusually
+powerful resource -- a check, a sacrifice, a stalemate. Afterwards the
+victim may wail, `But who could have dreamt of such an idiotic-looking
+move?'
+ -- Fred Reinfeld, "The Complete Chess Course"
+%
+Overdrawn? But I still have checks left!
+%
+Overflow on /dev/null: please empty the bit bucket.
+%
+Overheard:
+ "How do I feel? Great! And I kiss pretty good, too!"
+%
+Overload -- core meltdown sequence initiated.
+%
+Owe no man any thing...
+ -- Romans 13:8
+%
+Oxygen is a very toxic gas and an extreme fire hazard. It is fatal in
+concentrations of as little as 0.000001 p.p.m. Humans exposed to the
+oxygen concentrations die within a few minutes. Symptoms resemble very
+much those of cyanide poisoning (blue face, etc.). In higher
+concentrations, e.g. 20%, the toxic effect is somewhat delayed and it
+takes about 2.5 billion inhalations before death takes place. The reason
+for the delay is the difference in the mechanism of the toxic effect of
+oxygen in 20% concentration. It apparently contributes to a complex
+process called aging, of which very little is known, except that it is
+always fatal.
+
+However, the main disadvantage of the 20% oxygen concentration is in the
+fact it is habit forming. The first inhalation (occurring at birth) is
+sufficient to make oxygen addiction permanent. After that, any
+considerable decrease in the daily oxygen doses results in death with
+symptoms resembling those of cyanide poisoning.
+
+Oxygen is an extreme fire hazard. All of the fires that were reported in
+the continental U.S. for the period of the past 25 years were found to be
+due to the presence of this gas in the atmosphere surrounding the buildings
+in question.
+
+Oxygen is especially dangerous because it is odorless, colorless and
+tasteless, so that its presence can not be readily detected until it is
+too late.
+ -- Chemical & Engineering News February 6, 1956
+%
+Ozman's Laws:
+ (1) If someone says he will do something "without fail," he won't.
+ (2) The more people talk on the phone, the less money they make.
+ (3) People who go to conferences are the ones who shouldn't.
+ (4) Pizza always burns the roof of your mouth.
+%
+paak, n: A stadium or inclosed playing field. To put or leave (a
+ vehicle) for a time in a certain location.
+patato, n: The starchy, edible tuber of a widely cultivated plant.
+Septemba, n: The 9th month of the year.
+shua, n: Having no doubt; certain.
+sista, n: A female having the same mother and father as the speaker.
+tamato, n: A fleshy, smooth-skinned reddish fruit eaten in salads
+ or as a vegetable.
+troopa, n: A state policeman.
+Wista, n: A city in central Masschewsetts.
+yaad, n: A tract of ground adjacent to a building.
+ -- Massachewsetts Unabridged Dictionary
+%
+PAIN:
+ Falling out of a twenty story building,
+ and snagging your eyelid on a nail.
+%
+PAIN:
+ One thing, at least it proves that you're alive!
+%
+PAIN:
+ Sliding down a 50-foot razor blade into a bucket of alcohol.
+%
+Pain is just God's way of hurting you.
+%
+Painting, n.:
+ The art of protecting flat surfaces from the weather, and
+ exposing them to the critic.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Pandora's Rule:
+ Never open a box you didn't close.
+%
+panic: can't find /
+%
+panic: kernel segmentation violation. core dumped (only kidding)
+%
+panic: kernel trap (ignored)
+%
+Paprika Measure:
+
+ 2 dashes == 1 smidgen
+ 2 smidgens == 1 pinch
+ 3 pinches == 1 soupcon
+ 2 soupcons == too much paprika
+%
+Paradise is exactly like where you are right now ... only much, much
+better.
+ -- Laurie Anderson
+%
+Parallel lines never meet, unless you bend one or both of them.
+%
+Paralysis through analysis.
+%
+PARANOIA:
+ A healthy understanding of the way the universe works.
+%
+Paranoia doesn't mean the whole world isn't out to get you.
+%
+Paranoia is heightened awareness.
+%
+Paranoia is simply an optimistic outlook on life.
+%
+Paranoid Club meeting this Friday.
+Now ... just try to find out where!
+%
+Paranoid schizophrenics outnumber their enemies at least two to one.
+%
+Paranoids are people, too; they have their own problems. It's easy
+to criticize, but if everybody hated you, you'd be paranoid too.
+ -- D. J. Hicks
+%
+Pardon me while I laugh.
+%
+Pardon this fortune. Database under reconstruction.
+%
+Pardo's First Postulate:
+ Anything good in life is either illegal, immoral, or
+fattening.
+
+Arnold's Addendum:
+ Anything not fitting into these categories causes cancer in rats.
+%
+Parents often talk about the younger generation as if they
+didn't have much of anything to do with it.
+%
+Parker's Law:
+ Beauty is only skin deep, but ugly goes clean to the bone.
+%
+Parkinson's Fifth Law:
+ If there is a way to delay an important decision, the good
+ bureaucracy, public or private, will find it.
+%
+Parkinson's Fourth Law:
+ The number of people in any working group tends to increase
+ regardless of the amount of work to be done.
+%
+Parsley is gharsley.
+ -- Ogden Nash
+%
+Parts that positively cannot be assembled in improper order will be.
+%
+PARTY:
+ A gathering where you meet people who drink
+ so much you can't even remember their names.
+%
+Pascal is a language for children wanting to be naughty.
+ -- Dr. Kasi Ananthanarayanan
+%
+Pascal is not a high-level language.
+ -- Steven Feiner
+%
+Pascal is Pascal is Pascal is dog meat.
+ -- M. Devine and P. Larson, Computer Science 340
+%
+Pascal, n.:
+ A programming language named after a man who would turn over
+ in his grave if he knew about it.
+ -- Datamation, January 15, 1984
+%
+Pascal Users:
+ The Pascal system will be replaced next Tuesday by Cobol.
+ Please modify your programs accordingly.
+%
+Pascal Users:
+ To show respect for the 313th anniversary (tomorrow) of the
+ death of Blaise Pascal, your programs will be run at half speed.
+%
+Passionate hatred can give meaning and purpose to an empty life.
+ -- Eric Hoffer
+%
+Password:
+%
+Passwords are implemented as a result of insecurity.
+%
+Paster Crosstalk: What items are specifically mentioned by GOD as being
+ unclean? Now did you know... preying birds... praying mantises...
+ All birds of prey, all carrion eaters, fish eaters -- no good, can't
+ eat those. Nothing that does not have both fins and scales. Most
+ CREEPING things...
+Alvarado: How 'bout caterpillars?
+P: A caterpillar doesn't have a backbone. Nothing without a backbone
+ can get in.
+A: How do you know? You char a caterpillar, it gets real stiff!
+P: Well, I don't think that the Lord meant us to eat CHARRED
+ CATERPILLARS!
+[...]
+P: The hog, the squirrel... little squirrels. Who would want to eat
+ a LITTLE SQUIRREL?
+A: If you're starving. If you're starving in the park one day.
+P: You'd probably just CHAR 'em to get 'em stiff, wouldn't ya?
+A: No, you SINGE 'em. You SINGE 'em and eat 'em. *I* read about the
+ Donner Pass, I know what man does when he's hungry.
+P: Squirrels eating squirrels -- my GOD, that's sick!
+A: That's sick, SURE. But a MAN eating a squirrel -- that's (heh, heh)
+ par for the course, Charlie.
+ -- The Firesign Theatre
+%
+Patageometry, n.:
+ The study of those mathematical properties that are invariant
+under brain transplants.
+%
+Patch griefs with proverbs.
+ -- William Shakespeare, "Much Ado About Nothing"
+%
+Patent, v.:
+ A method of publicizing inventions so others can copy them.
+%
+"Pathetic," he said. "That's what it is. Pathetic."
+(crosses stream)
+"As I thought," he said, "no better from *this* side."
+ -- Eeyore
+%
+Patience is a minor form of despair, disguised as virtue.
+ -- Ambrose Bierce, on qualifiers
+%
+Patience is long forgotten by convenience in this life.
+ -- Carmen Caicedo Giraudy
+%
+Patience is the best remedy for every trouble.
+ -- Titus Maccius Plautus
+%
+Patriotism is the last refuge of a scoundrel.
+ -- S. Johnson, "The Life of Samuel Johnson" by J. Boswell
+
+In Dr. Johnson's famous dictionary patriotism is defined as the last
+resort of the scoundrel. With all due respect to an enlightened but
+inferior lexicographer I beg to submit that it is the first.
+ -- Ambrose Bierce
+
+When Dr. Johnson defined patriotism as the last refuge of a scoundrel,
+he ignored the enormous possibilities of the word reform.
+ -- Sen. Roscoe Conkling
+
+Public office is the last refuge of a scoundrel.
+ -- Boies Penrose
+%
+Patriotism is the virtue of the vicious.
+ -- Oscar Wilde
+%
+Pauca sed matura. (Few but excellent.)
+ -- Gauss
+%
+Paul Revere was a tattle-tale.
+%
+Paul's Law:
+ In America, it's not how much an item costs, it's how much you
+ save.
+%
+Paul's Law:
+ You can't fall off the floor.
+%
+Pause for storage relocation.
+%
+Pay no attention to that man behind the curtain.
+ -- Frank Morgan as The Wizard, "The Wizard of Oz"
+%
+Paycheck, n.:
+ The weekly $5.27 that remains after deductions for federal
+ withholding, state withholding, city withholding, FICA,
+ medical/dental, long-term disability, unemployment insurance,
+ Christmas Club, and payroll savings plan contributions.
+%
+Payeen to a Twang
+Derrida
+Ore-Ida
+potato.
+
+If you dared,
+I'd ask you
+to go dig
+up your ides under brown-
+tubered skies.
+
+where pitchforked
+you will ask
+Derrida?
+%
+Peace be to this house, and all that dwell in it.
+%
+Peace cannot be kept by force; it
+can only be achieved by understanding.
+ -- Albert Einstein
+%
+Peace is much more precious than a piece
+of land... let there be no more wars.
+ -- Mohammed Anwar Sadat (1918-1981)
+%
+Peace, n.:
+ In international affairs, a period of cheating between two
+ periods of fighting.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Peanut Blossoms
+
+4 cups sugar 16 tbsp. milk
+4 cups brown sugar 4 tsp. vanilla
+4 cups shortening 14 cups flour
+8 eggs 4 tsp. soda
+4 cups peanut butter 4 tsp. salt
+
+Shape dough into balls. Roll in sugar and bake on ungreased
+cookie sheet at 375 F. for 10-12 minutes. Immediately top
+each cookie with a Hershey's kiss or star pressing down firmly
+to crack cookie. Makes a hell of a lot.
+%
+Pecor's Health-Food Principle:
+ Never eat rutabaga on any day of
+ the week that has a "y" in it.
+%
+Pedaeration, n.:
+ The perfect body heat achieved by having one leg under the
+ sheet and one hanging off the edge of the bed.
+ -- Rich Hall, "Sniglets"
+%
+Pediddel, n.:
+ A car with only one working headlight.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Pedro Guerrero was playing third base for the Los Angeles Dodgers in 1984
+when he made the comment that earns him a place in my Hall of Fame. Second
+baseman Steve Sax was having trouble making his throws. Other players were
+diving, screaming, signaling for a fair catch. At the same time, Guerrero,
+at third, was making a few plays that weren't exactly soothing to manager
+Tom Lasorda's stomach. Lasorda decided it was time for one of his famous
+motivational meetings and zeroed in on Guerrero: "How can you play third
+base like that? You've gotta be thinking about something besides baseball.
+What is it?"
+ "I'm only thinking about two things," Guerrero said. "First, `I
+hope they don't hit the ball to me.'" The players snickered, and even
+Lasorda had to fight off a laugh. "Second, `I hope they don't hit the ball
+to Sax.'"
+ -- Joe Garagiola, "It's Anybody's Ball Game"
+%
+Peeping Tom:
+ A window fan.
+%
+Peers's Law:
+The solution to a problem changes the nature of the problem.
+%
+Pelorat sighed.
+ "I will never understand people."
+ "There's nothing to it. All you have to do is take a close look
+at yourself and you will understand everyone else. How would Seldon have
+worked out his Plan -- and I don't care how subtle his mathematics was --
+if he didn't understand people; and how could he have done that if people
+weren't easy to understand? You show me someone who can't understand
+people and I'll show you someone who has built up a false image of himself
+-- no offense intended."
+ -- Isaac Asimov, "Foundation's Edge"
+%
+Penguin Trivia #46:
+ Animals who are not penguins can only wish they were.
+ -- Chicago Reader 10/15/82
+%
+PENGUINICITY!!
+%
+Pension, n.:
+ A federally insured chain letter.
+%
+People (a group that in my opinion has always attracted an undue amount of
+attention) have often been likened to snowflakes. This analogy is meant to
+suggest that each is unique -- no two alike. This is quite patently not the
+case. People ... are simply a dime a dozen. And, I hasten to add, their
+only similarity to snowflakes resides in their invariable and lamentable
+tendency to turn, after a few warm days, to slush.
+ -- Fran Lebowitz, "Social Studies"
+%
+People are beginning to notice you.
+Try dressing before you leave the house.
+%
+People are like onions -- you cut them up, and they make you cry.
+%
+People are unconditionally guaranteed to be full of defects.
+%
+People don't usually make the same mistake twice -- they make it three
+times, four time, five times...
+%
+People in general do not willingly read
+if they have anything else to amuse them.
+ -- S. Johnson
+%
+People love high ideals, but they got to be about 33-percent plausible.
+ -- The Best of Will Rogers
+%
+People need good lies. There are too many bad ones.
+ -- Bokonon, "Cat's Cradle" by Kurt Vonnegut, Jr.
+%
+People never lie so much as after a hunt, during a war, or before an
+election.
+ -- Otto von Bismarck
+%
+People of privilege will always risk their complete destruction
+rather than surrender any material part of their advantage.
+ -- John Kenneth Galbraith
+%
+People often find it easier to be a
+result of the past than a cause of the future.
+%
+People respond to people who respond.
+%
+People say I live in my own little fantasy world... well, at least they
+*know* me there!
+ -- D. L. Roth
+%
+People seem to enjoy things more when they know a lot of other people
+have been left out on the pleasure.
+ -- Russell Baker
+%
+People seem to think that the blanket phrase, "I only work here,"
+absolves them utterly from any moral obligation in terms of the
+public -- but this was precisely Eichmann's excuse for his job in
+the concentration camps.
+%
+People tend to make rules for others and exceptions for themselves.
+%
+People that can't find something to live for always seem to find something
+to die for. The problem is, they usually want the rest of us to die for
+it too.
+%
+People think love is an emotion. Love is good sense.
+ -- Ken Kesey
+%
+People usually get what's coming to them -- unless it's been mailed.
+%
+People who are funny and smart and return phone calls get
+much better press than people who are just funny and smart.
+ -- Howard Simons, "The Washington Post"
+%
+People who claim they don't let little things bother
+them have never slept in a room with a single mosquito.
+%
+People who fight fire with fire usually end up with ashes.
+ -- Abigail Van Buren
+%
+People who go to conferences are the ones who shouldn't.
+%
+People who have no faults are terrible;
+there is no way of taking advantage of them.
+%
+People who have what they want are very fond of telling people who haven't
+what they want that they don't want it.
+ -- Ogden Nash
+%
+People who make no mistakes do not usually make anything.
+%
+People who push both buttons should get their wish.
+%
+People who take cat naps don't usually sleep in a cat's cradle.
+%
+People who take cold baths never have rheumatism, but they have
+cold baths.
+%
+People who think they know everything
+greatly annoy those of us who do.
+%
+People will accept your ideas much more readily if you tell them that Benjamin
+Franklin said it first.
+%
+People will buy anything that's one to a customer.
+%
+People will do tomorrow what they did today because that is what they
+did yesterday.
+%
+People with narrow minds usually have broad tongues.
+%
+People's Action Rules:
+ (1) Some people who can, shouldn't.
+ (2) Some people who should, won't.
+ (3) Some people who shouldn't, will.
+ (4) Some people who can't, will try, regardless.
+ (5) Some people who shouldn't, but try, will then blame others.
+%
+Per buck you get more computing action with the small computer.
+ -- R. W. Hamming
+%
+Pereant, inquit, qui ante nos nostra dixerunt.
+[Confound those who have said our remarks before us.]
+or
+[May they perish who have expressed our bright ideas before us.]
+ -- Aelius Donatus
+%
+Perfect day for scrubbing the floor and other exciting things.
+%
+Perfect guest, n.:
+ One who makes his host feel at home.
+%
+Perfection is finally attained, not when there is no longer
+anything to add, but when there is no longer anything to take away.
+ -- Antoine de Saint-Exupery
+%
+Performance:
+ A statement of the speed at which a computer system works. Or
+ rather, might work under certain circumstances. Or was rumored
+ to be working over in Jersey about a month ago.
+%
+Perhaps, after all, America never has been discovered.
+I myself would say that it had merely been detected.
+ -- Oscar Wilde
+%
+Perhaps no person can be a poet, or even enjoy
+poetry without a certain unsoundness of mind.
+ -- Thomas Macaulay
+%
+Perhaps the biggest disappointments were the ones you expected anyway.
+%
+Perhaps the most widespread illusion is that if we were in power we would
+behave very differently from those who now hold it -- when, in truth, in
+order to get power we would have to become very much like them. (Lenin's
+fatal mistake, both in theory and in practice.)
+%
+Perhaps the world's second-worst crime is boredom. The first is
+being a bore.
+ -- Cecil Beaton
+%
+Perilous to all of us are the devices of
+an art deeper than we ourselves possess.
+ -- Gandalf the Grey
+%
+Periphrasis is the putting of things in a round-about way. "The cost may be
+upwards of a figure rather below 10m#." is a periphrasis for The cost may be
+nearly 10m#. "In Paris there reigns a complete absence of really reliable
+news" is a periphrasis for There is no reliable news in Paris. "Rarely does
+the `Little Summer' linger until November, but at times its stay has been
+prolonged until quite late in the year's penultimate month" contains a
+periphrasis for November, and another for lingers. "The answer is in the
+negative" is a periphrasis for No. "Was made the recipient of" is a
+periphrasis for Was presented with. The periphrasis style is hardly possible
+on any considerable scale without much use of abstract nouns such as "basis,
+case, character, connexion, dearth, description, duration, framework, lack,
+nature, reference, regard, respect". The existence of abstract nouns is a
+proof that abstract thought has occurred; abstract thought is a mark of
+civilized man; and so it has come about that periphrasis and civilization are
+by many held to be inseparable. These good people feel that there is an almost
+indecent nakedness, a reversion to barbarism, in saying No news is good news
+instead of "The absence of intelligence is an indication of satisfactory
+developments."
+ -- Fowler's English Usage
+%
+Persistence in one opinion has never been considered
+a merit in political leaders.
+ -- Marcus Tullius Cicero, "Ad familiares", 1st century BC
+%
+Personifiers of the world, unite!
+You have nothing to lose but Mr. Dignity!
+ -- Bernadette Bosky
+%
+Personifiers Unite! You have nothing to lose but Mr. Dignity!
+%
+Persons attempting to find a motive in this narrative will be prosecuted;
+persons attempting to find a moral in it will be banished; persons attempting
+to find a plot in it will be shot. By Order of the Author
+ -- Mark Twain, "Tom Sawyer"
+%
+Pessimist, n.:
+ A man who spends all his time worrying about how he can keep the
+ wolf from the door.
+
+Optimist, n.:
+ A man who refuses to see the wolf until he seizes the seat of
+ his pants.
+
+Opportunist, n.:
+ A man who invites the wolf in and appears the next day in a fur coat.
+%
+Pete: Waiter, this meat is bad.
+Waiter: Who told you?
+Pete: A little swallow.
+%
+Peter Fellgett's wildcard recipe:
+ Into a clean dish, place the dry ingredients and add the
+ liquids until the right consistency is obtained. Turn out
+ into suitable containers and cook until done.
+%
+Peter Wemm Murphy Field, n.:
+ A field of abnormally frequent and severe Murphy's Law events
+emanating from Mr. Peter Wemm. The field was first discovered and
+identified in Denmark during the initial FreeBSD SMP development.
+Mr. Wemm was residing in Australia at the time.
+%
+Peter's hungry, time to eat lunch.
+%
+Peter's Law of Substitution:
+ Look after the molehills, and the
+ mountains will look after themselves.
+
+Peter's Principle of Success:
+ Get up one time more than you're knocked down.
+
+Peter's Principle:
+ In every hierarchy, each employee tends to rise to the level of
+ his incompetence.
+%
+Peterson's Admonition:
+ When you think you're going down for the third time --
+ just remember that you may have counted wrong.
+%
+Peterson's Rules:
+ (1) Trucks that overturn on freeways
+ are filled with something sticky.
+ (2) No cute baby in a carriage is ever a girl when called one.
+ (3) Things that tick are not always clocks.
+ (4) Suicide only works when you're bluffing.
+%
+Petribar, n.:
+ Any sun-bleached prehistoric candy that has been sitting in
+ the window of a vending machine too long.
+ -- Rich Hall, "Sniglets"
+%
+Phasers locked on target, Captain.
+%
+Philadelphia is not dull -- it just seems so because it is next to
+exciting Camden, New Jersey.
+%
+Philogyny recapitulates erogeny; erogeny recapitulates philogyny.
+%
+Philosophy, n.:
+ The ability to bear with calmness the misfortunes of our friends.
+%
+Philosophy, n.:
+ Unintelligible answers to insoluble problems.
+%
+Philosophy will clip an angel's wings.
+ -- John Keats
+%
+Phone call for chucky-pooh.
+%
+Phosflink, v.:
+ To flick a bulb on and off when it burns out (as if, somehow,
+ that will bring it back to life).
+ -- Rich Hall & Friends, "Sniglets"
+%
+Photographing a volcano is just about
+the most miserable thing you can do.
+ -- Robert B. Goodman
+ [Who has clearly never tried to use a PDP-10. Ed.]
+%
+Physically there is nothing to distinguish human society from the
+farm-yard except that children are more troublesome and costly than
+chickens and women are not so completely enslaved as farm stock.
+ -- George Bernard Shaw, "Getting Married"
+%
+Pick another fortune cookie.
+%
+Picking up the pieces of my sweet shattered dream,
+I wonder how the old folks are tonight,
+Her name was Ann, and I'll be damned if I recall her face,
+She left me not knowing what to do.
+
+Carefree Highway, let me slip away on you,
+Carefree Highway, you seen better days,
+The morning after blues, from my head down to my shoes,
+Carefree Highway, let me slip away, slip away, on you...
+
+Turning back the pages to the times I love best,
+I wonder if she'll ever do the same,
+Now the thing that I call livin' is just bein' satisfied,
+With knowing I got noone left to blame.
+Carefree Highway, I got to see you, my old flame...
+
+Searching through the fragments of my dream shattered sleep,
+I wonder if the years have closed her mind,
+I guess it must be wanderlust or tryin' to get free,
+From the good old faithful feelin' we once knew.
+ -- Gordon Lightfoot, "Carefree Highway"
+%
+Pickle's Law:
+ If Congress must do a painful thing,
+ the thing must be done in an odd-number year.
+%
+Picture the sun as the origin of two intersecting 6-dimensional
+hyperplanes from which we can deduce a certain transformational
+sequence which gives us the terminal velocity of a rubber duck ...
+%
+Piddle, twiddle, and resolve,
+Not one damn thing do we solve.
+ -- 1776
+%
+Pie are not square. Pie are round. Cornbread are square.
+%
+Piece of cake!
+ -- G. S. Koblas
+%
+Pig, n.:
+ An animal (Porcus omnivorous) closely allied to the human race
+ by the splendor and vivacity of its appetite, which, however,
+ is inferior in scope, for it balks at pig.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Pilfering Treasure property is particularly dangerous: big thieves are
+ruthless in punishing little thieves.
+ -- Diogenes
+%
+Pilots should avoid using illegal drugs.
+ -- AOPA's Pilot's Handbook, 1988
+%
+Piping down the valleys wild,
+Piping songs of pleasant glee,
+On a cloud I saw a child,
+And he laughing said to me:
+"Pipe a song about a Lamb!"
+So I piped with merry cheer.
+"Piper, pipe that song again;"
+So I piped: he wept to hear.
+ -- William Blake, "Songs of Innocence"
+%
+Pipo was born with few complications, but then the doctor accidentally dropped
+the infant on her head provoking her drunken father to drag the physician
+outside where he would beat him to death with a live ocelot.
+ -- Love and Rockets
+%
+PISCES (Feb. 19 - Mar. 20)
+ You have a vivid imagination and often think you are being followed
+ by the CIA or FBI. You have minor influence over your associates
+ and people resent your flaunting of your power. You lack confidence
+ and you are generally a coward. Pisces people do terrible things to
+ small animals.
+%
+PISCES (Feb. 19 to Mar. 20)
+ Take the high road, look for the good things, carry the American
+ Express card and a weapon. The world is yours today, as nobody
+ else wants it. Your mortgage will be foreclosed. You will probably
+ get run over by a bus.
+%
+PISCES (Feb.19 - Mar.20)
+ You will get some very interesting news of a promotion today.
+ It will go to someone in the office you dislike and will be the
+ job you wanted. Don't lend anyone a car today. You don't have
+ a car.
+%
+Pity the meek, for they shall inherit the earth.
+ -- Don Marquis
+%
+Pixel, n.:
+ A mischievous, magical spirit associated with screen displays.
+ The computer industry has frequently borrowed from mythology:
+ Witness the sprites in computer graphics, the demons in artificial
+ intelligence, and the trolls in the marketing department.
+%
+P-K4
+%
+Plaese porrf raed.
+ -- Prof. Michael O'Longhlin, S.U.N.Y. Purchase
+%
+Plagiarize, plagiarize,
+Let no man's work evade your eyes,
+Remember why the good Lord made your eyes,
+Don't shade your eyes,
+But plagiarize, plagiarize, plagiarize.
+Only be sure to call it research.
+ -- Tom Lehrer
+%
+Planet Claire has pink hair.
+All the trees are red.
+No one ever dies there.
+No one has a head....
+%
+Plastic... Aluminum... These are the inheritors of the Universe!
+Flesh and Blood have had their day... and that day is past!
+ -- Green Lantern Comics
+%
+Plato, by the way, wanted to banish all poets from his proposed Utopia
+because they were liars. The truth was that Plato knew philosophers
+couldn't compete successfully with poets.
+ -- Kilgore Trout (Philip J. Farmer) "Venus on the Half
+ Shell"
+%
+Play Rogue, visit exotic locations, meet strange creatures and kill
+them.
+%
+Playing an unamplified electric guitar is like strumming on a picnic
+table.
+ -- Dave Barry, "The Snake"
+%
+Please don't put a strain on our friendship
+by asking me to do something for you.
+%
+Please don't recommend me to your friends--
+it's difficult enough to cope with you alone.
+%
+PLEASE DON'T SMOKE HERE!
+
+Penalty: An early, lingering death from cancer,
+ emphysema, or other smoking-caused ailment.
+%
+Please forgive me if, in the heat of battle,
+I sometimes forget which side I'm on.
+%
+Please go away.
+%
+Please help keep the world clean: others may wish to use it.
+%
+Please ignore previous fortune.
+%
+Please keep your hands off the secretary's reproducing equipment.
+%
+Please, Mother! I'd rather do it myself!
+%
+Please remain calm, it's no use both of
+us being hysterical at the same time.
+%
+Please stand for the National Anthem:
+
+ Australian's all, let us rejoice,
+ For we are young and free.
+ We've golden soil and wealth for toil
+ Our home is girt by sea.
+ Our land abounds in nature's gifts
+ Of beauty rich and rare.
+ In history's page, let every stage
+ Advance Australia Fair.
+ In joyful strains then let us sing,
+ Advance Australia Fair.
+
+Thank you. You may resume your seat.
+%
+Please stand for the National Anthem:
+
+ God save our Gracious Queen!
+ Long live our Noble Queen!
+ God save the Queen!
+ Send her victorious,
+ Happy and glorious,
+ Long to reign o'er us!
+ God save the Queen!
+
+Thank you. You may resume your seat.
+%
+Please stand for the National Anthem:
+
+ O Canada
+ Our home and native land
+ True patriot love
+ In all thy sons' command
+ With glowing hearts we see thee rise
+ The true north strong and free
+ From far and wide, O Canada
+ We stand on guard for thee
+ God keep our land glorious and free
+ O Canada we stand on guard for thee
+ O Canada we stand on guard for thee
+
+Thank you. You may resume your seat.
+%
+Please stand for the National Anthem:
+
+ Oh, say can you see by dawn's early light
+ What so proudly we hailed at the twilight's last gleaming?
+ Whose broad stripes and bright stars through the perilous fight
+ O'er the ramparts we watched were so gallantly streaming?
+ And the rockets' red glare, the bombs bursting in air,
+ Gave proof through the night that our flag was still there.
+ Oh, say does that star-spangled banner yet wave
+ O'er the land of the free and the home of the brave?
+
+Thank you. You may resume your seat.
+%
+Please take note:
+%
+Please try to limit the amount of "this room doesn't have any bazingas"
+until you are told that those rooms are "punched out." Once punched out,
+we have a right to complain about atrocities, missing bazingas, and such.
+ -- N. Meyrowitz
+%
+Please, won't somebody tell me what diddie-wa-diddie means?
+%
+PL/I -- "the fatal disease" -- belongs more to the problem set than to the
+solution set.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+Plots are like girdles. Hidden, they hold your interest; revealed, they're
+of no interest except to fetishists. Like girdles, they attempt to contain
+an uncontainable experience.
+ -- R. S. Knapp
+%
+PLUG IT IN!!!
+%
+Plus ca change, plus c'est le meme chose.
+%
+Pohl's law:
+ Nothing is so good that somebody, somewhere, will not hate it.
+%
+Poisoned coffee, n.:
+ Grounds for divorce.
+%
+Poland has gun control.
+%
+Police: Good evening, are you the host?
+Host: No.
+Police: We've been getting complaints about this party.
+Host: About the drugs?
+Police: No.
+Host: About the guns, then? Is somebody complaining about the guns?
+Police: No, the noise.
+Host: Oh, the noise. Well that makes sense because there are no guns
+ or drugs here. (An enormous explosion is heard in the
+ background.) Or fireworks. Who's complaining about the noise?
+ The neighbors?
+Police: No, the neighbors fled inland hours ago. Most of the recent
+ complaints have come from Pittsburgh. Do you think you could
+ ask the host to quiet things down?
+Host: No Problem. (At this point, a Volkswagen bug with primitive
+ religious symbols drawn on the doors emerges from the living
+ room and roars down the hall, past the police and onto the
+ lawn, where it smashes into a tree. Eight guests tumble out
+ onto the grass, moaning.) See? Things are starting to wind
+ down.
+%
+Political history is far too criminal a subject to be a fit thing to
+teach children.
+ -- W. H. Auden
+%
+Political speeches are like steer horns. A point
+here, a point there, and a lot of bull in between.
+ -- Alfred E. Neuman
+%
+Political T.V. commercials prove one thing: some candidates can tell
+all their good points and qualifications in just 30 seconds.
+%
+Politician, n.:
+ An eel in the fundamental mud upon which the superstructure of
+ organized society is reared. When he wriggles, he mistakes the
+ agitation of his tail for the trembling of the edifice. As
+ compared with the statesman, he suffers the disadvantage of
+ being alive.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Politician, n.:
+ From the Greek "poly" ("many") and the French "tete" ("head" or
+ "face," as in "tete-a-tete": head to head or face to face).
+ Hence "polytetien", a person of two or more faces.
+ -- Martin Pitt
+%
+Politicians are the same everywhere. They promise
+to build a bridge even where there is no river.
+ -- Nikita Khrushchev
+%
+Politicians should read science fiction, not westerns and detective stories.
+ -- Arthur C. Clarke
+%
+Politicians speak for their parties, and parties never are, never have
+been, and never will be wrong.
+ -- Walter Dwight
+%
+Politics -- the gentle art of getting votes from the poor and campaign
+funds from the rich by promising to protect each from the other.
+ -- Oscar Ameringer
+%
+Politics and the fate of mankind are formed by men without ideals and
+without greatness. Those who have greatness within them do not go in
+for politics.
+ -- Albert Camus
+%
+Politics are almost as exciting as war, and quite as
+dangerous. In war, you can only be killed once.
+ -- Winston Churchill
+%
+Politics, as a practice, whatever its professions, has always been the
+systematic organisation of hatreds.
+ -- Henry Adams, "The Education of Henry Adams"
+%
+Politics is like coaching a football team. You have to be smart
+enough to understand the game but not smart enough to lose interest.
+%
+Politics is not the art of the possible. It consists in choosing
+between the disastrous and the unpalatable.
+ -- John Kenneth Galbraith
+%
+Politics is supposed to be the second oldest profession. I have come to
+realize that it bears a very close resemblance to the first.
+ -- Ronald Reagan
+%
+Politics is the ability to foretell what is going to happen tomorrow, next
+week, next month and next year. And to have the ability afterwards to
+explain why it didn't happen.
+ -- Winston Churchill
+%
+Politics, like religion, hold up the
+torches of martyrdom to the reformers of error.
+ -- Thomas Jefferson
+%
+Politics makes strange bedfellows, and journalism makes strange politics.
+ -- Amy Gorin
+%
+Politics, n.:
+ A strife of interests masquerading as a contest of principles.
+ The conduct of public affairs for private advantage.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Pollyanna's Educational Constant:
+ The hyperactive child is never absent.
+%
+POLYGON:
+ Dead parrot.
+%
+Polymer physicists are into chains.
+%
+Poorman's Rule:
+ When you pull a plastic garbage bag from its handy dispenser
+ package, you always get hold of the closed end and try to
+ pull it open.
+%
+Pope Goestheveezl was the shortest reigning pope in the history of the
+Church, reigning for two hours and six minutes on 1 April 1866. The white
+smoke had hardly faded into the blue of the Vatican skies before it dawned
+on the assembled multitudes in St. Peter's Square that his name had hilarious
+possibilities. The crowds fell about, helpless with laughter, singing
+
+ Half a pound of tuppenny rice
+ Half a pound of treacle
+ That's the way the chimney smokes
+ Pope Goestheveezl
+
+The square was finally cleared by armed carabineri with tears of laughter
+streaming down their faces. The event set a record for hilarious civic
+functions, smashing the previous record set when Baron Hans Neizant
+Bompzidaize was elected Landburgher of Koln in 1653.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Populus vult decipi.
+[The people like to be deceived.]
+%
+Porsche; there simply is no substitute.
+ -- Risky Business
+%
+Portable, adj.:
+ Survives system reboot.
+%
+POSITIVE:
+ Being mistaken at the top of your voice.
+%
+Positive, adj.:
+ Mistaken at the top of one's voice.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Possessions increase to fill the space available for their storage.
+ -- Ryan
+%
+Post proelium, praemium.
+[After the battle, the reward.]
+%
+Postmen never die, they just lose their zip.
+%
+Potahto' Pictures Productions Presents:
+
+ SPUD ROGERS OF THE 25TH CENTURY: Story of an Air Force potato that's
+left in a rarely used chow hall for over two centuries and wakes up in a world
+populated by soybean created imitations under the evil Dick Tater. Thanks to
+him, the soy-potatoes learn that being a 'tater is where it's at. Memorable
+line, "'Cause I'm just a stud spud!"
+
+ FRIDAY THE 13TH DINER SERIES: Crazed potato who was left in a
+fryer too long and was charbroiled carelessly returns to wreak havoc on
+unsuspecting, would-be teen camp cooks. Scenes include a girl being stuffed
+with chives and Fleischman's Margarine and a boy served up on a side dish
+with beets and dressing. Definitely not for the squeamish, or those on
+diets that are driving them crazy.
+
+ FRIDAY THE 13TH DINER II,III,IV,V,VI: Much, much more of the same.
+Except with sour cream.
+%
+Potahto' Pictures Productions Presents:
+
+ THE TATERNATOR: Cyborg spud returns from the future to present-day
+McDonald's restaurant to kill the potatoes (girl 'tater) who will give birth
+to the world's largest french fry (The Dark Powers of Burger King are clearly
+behind this). Most quotable line: "Ah'll be baked..."
+
+ A FISTFUL OF FRIES: Western in which our hero, The Spud with No Name,
+rides into a town that's deprived of carbohydrates thanks to the evil takeover
+of the low-cal Scallopinni Brothers. Plenty of smokeouts, fry-em-ups, and
+general butter-melting by all.
+
+ FOR A FEW FRIES MORE: Takes up where AFOF left off! Cameo by Walter
+Cronkite, as every man's common 'tater!
+%
+Pound for pound, the amoeba is the most vicious animal on earth.
+%
+POVERTY:
+ An unfortunate state that persists as long
+ as anyone lacks anything he would like to have.
+%
+Poverty begins at home.
+%
+Poverty must have its satisfactions, else there would not be so many
+poor people.
+ -- Don Herold
+%
+Power and ignorance is a detestable cocktail.
+ -- Poul Henningsen (1894-1967)
+%
+Power corrupts. Absolute power is kind of neat.
+ -- John Lehman, Secretary of the Navy, 1981-1987
+%
+Power corrupts. And atomic power corrupts atomically.
+%
+Power corrupts. Powerpoint corrupts absolutely.
+ -- Vint Cerf
+%
+Power is poison.
+%
+Power is the finest token of affection.
+%
+Power, like a desolating pestilence,
+Pollutes whate'er it touches...
+ -- Percy Bysshe Shelley
+%
+Power, n.:
+ The only narcotic regulated by the SEC instead of the FDA.
+%
+Power tends to corrupt, absolute power corrupts absolutely.
+ -- Lord Acton
+%
+PPRB -- Pillage, plunder, rape and burn.
+%
+Practical people would be more practical if
+they would take a little more time for dreaming.
+ -- J. P. McEvoy
+%
+Practical politics consists in ignoring facts.
+ -- Henry Adams
+%
+Practically perfect people never permit
+sentiment to muddle their thinking.
+ -- Mary Poppins
+%
+Practice is the best of all instructors.
+ -- Publilius
+%
+Practice yourself what you preach.
+ -- Titus Maccius Plautus
+%
+PRAIRIES:
+ Vast plains covered by treeless forests.
+%
+Praise the Lord and pass the ammunition.
+ -- Stephen Coonts, "The Minotaur"
+%
+Praise the sea; on shore remain.
+ -- John Florio
+%
+Pray to God, but keep rowing to shore.
+ -- Russian Proverb
+%
+Pray, v.:
+ To ask that the laws of the universe be annulled on behalf
+ of a single petitioner confessedly unworthy.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Predestination was doomed from the start.
+%
+Prediction is very difficult, especially of the future.
+ -- Niels Bohr
+%
+Prejudice, n.:
+ A vagrant opinion without visible means of support.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Premature optimization is the root of all evil.
+ -- Donald E. Knuth
+%
+Preserve the old, but know the new.
+%
+Preserve wildlife -- pickle a squirrel today!
+%
+Preserve Wildlife! Throw a party today!
+%
+President Reagan has noted that there are too many economic
+pundits and forecasters and has decided on an excess prophets tax.
+%
+President Thieu says he'll quit if he doesn't get more than 50%
+of the vote. In a democracy, that's not called quitting.
+ -- The Washington Post
+%
+Pretend to spank me -- I'm a pseudo-masochist!
+%
+Preudhomme's Law of Window Cleaning:
+ It's on the other side.
+%
+Price's Advice:
+ It's all a game -- play it to have fun.
+%
+[Prime Minister Joseph] Chamberlain loves
+the working man, he loves to see him work.
+ -- Winston Churchill
+%
+[Prime Minister MacDonald] has the gift of compressing the
+largest amount of words into the smallest amount of thought.
+ -- Winston Churchill
+%
+Prince Hamlet thought Uncle a traitor
+For having it off with his Mater;
+ Revenge Dad or not?
+ That's the gist of the plot,
+And he did -- nine soliloquies later.
+ -- Stanley J. Sharpless
+%
+Princeton's taste is sweet like a strawberry tart. Harvard's is a subtle
+taste, like whiskey, coffee, or tobacco. It may even be a bad habit, for
+all I know.
+ -- Prof. J. H. Finley '25
+%
+Priority:
+ A statement of the importance of a user or a program. Often
+ expressed as a relative priority, indicating that the user doesn't
+ care when the work is completed so long as he is treated less
+ badly than someone else.
+%
+Prisons are built with stones of Law, brothels with bricks of Religion.
+ -- Blake
+%
+Prizes are for children.
+ -- Charles Ives,
+ upon being given, but refusing, the Pulitzer prize
+%
+Pro is to con as progress is to Congress.
+%
+Probable-Possible, my black hen,
+She lays eggs in the Relative When.
+She doesn't lay eggs in the Positive Now
+Because she's unable to postulate How.
+ -- Frederick Winsor
+%
+Probably the question asked most often is: Do one-celled animals have
+orgasms? The answer is yes, they have orgasms almost constantly, which
+is why they don't mind living in pools of warm slime.
+ -- Dave Barry, "Sex and the Single Amoeba: What Every
+ Teen Should Know"
+%
+PROBLEM DRINKER:
+ A man who never buys.
+%
+Producers seem to be so prejudiced against actors who've had no training.
+And there's no reason for it. So what if I didn't attend the Royal Academy
+for twelve years? I'm still a professional trying to be the best actress
+I can. Why doesn't anyone send me the scripts that Faye Dunaway gets?
+ -- Farrah Fawcett-Majors
+%
+Prof: So the American government went to IBM to come up with a data
+ encryption standard and they came up with ...
+Student: EBCDIC!
+%
+Profanity is the one language all programmers know best.
+%
+Professor Gorden Newell threw another shutout in last week's Chem Eng. 130
+midterm. Once again a student did not receive a single point on his exam.
+Newell has now tossed 5 shutouts this quarter. Newell's earned exam average
+has now dropped to a phenomenal 30%.
+%
+PROGRAM:
+ Any task that can't be completed in one telephone call or one
+ day. Once a task is defined as a program ("training program,"
+ "sales program," or "marketing program"), its implementation
+ always justifies hiring at least three more people.
+%
+Program, n.:
+ A magic spell cast over a computer allowing it to turn one's input
+ into error messages. tr.v. To engage in a pastime similar to banging
+ one's head against a wall, but with fewer opportunities for reward.
+%
+Programmers used to batch environments may find it hard to live
+without giant listings; we would find it hard to use them.
+ -- Dennis M. Ritchie
+%
+Programming Department:
+ Mistakes made while you wait.
+%
+Programming is an unnatural act.
+%
+Programming today is a race between software engineers striving to
+build bigger and better idiot-proof programs, and the Universe trying
+to produce bigger and better idiots. So far, the Universe is winning.
+ -- Rich Cook
+%
+PROGRESS:
+ Medieval man thought disease was caused by invisible demons
+ invading the body and taking possession of it.
+
+ Modern man knows disease is caused by microscopic bacteria
+ and viruses invading the body and causing it to malfunction.
+%
+Progress is impossible without change, and those who
+cannot change their minds cannot change anything.
+ -- George Bernard Shaw
+%
+Progress means replacing a theory that
+is wrong with one more subtly wrong.
+%
+Progress might have been all right once, but it's gone on too long.
+ -- Ogden Nash
+%
+Progress was all right. Only it went on too long.
+ -- James Thurber
+%
+Promise her anything, but give her Exxon unleaded.
+%
+Promising costs nothing, it's the delivering that kills you.
+%
+PROMOTION FROM WITHIN:
+ A system of moving incompetents up to the policy-making
+ level where they can't foul up operations.
+%
+Promptness is its own reward, if one lives by the clock instead of the sword.
+%
+Proof techniques #1: Proof by Induction.
+
+This technique is used on equations with 'n' in them. Induction
+techniques are very popular, even the military use them.
+
+SAMPLE: Proof of induction without proof of induction.
+
+ We know it's true for n equal to 1. Now assume that it's true
+for every natural number less than n. N is arbitrary, so we can take n
+as large as we want. If n is sufficiently large, the case of n+1 is
+trivially equivalent, so the only important n are n less than n. We can
+take n = n (from above), so it's true for n+1 because it's just about n.
+ QED. (QED translates from the Latin as "So what?")
+%
+Proof techniques #2: Proof by Oddity.
+ SAMPLE: To prove that horses have an infinite number of legs.
+(1) Horses have an even number of legs.
+(2) They have two legs in back and fore legs in front.
+(3) This makes a total of six legs, which certainly is an odd number of
+ legs for a horse.
+(4) But the only number that is both odd and even is infinity.
+(5) Therefore, horses must have an infinite number of legs.
+
+Topics to be covered in future issues include proof by:
+ Intimidation
+ Gesticulation (handwaving)
+ "Try it; it works"
+ Constipation (I was just sitting there and ...)
+ Blatant assertion
+ Changing all the 2's to _n's
+ Mutual consent
+ Lack of a counterexample, and
+ "It stands to reason"
+%
+Proper treatment will cure a cold in seven days,
+but left to itself, a cold will hang on for a week.
+ -- Darrell Huff
+%
+Proposed Additions to the PDP-11 Instruction Set:
+
+BBW Branch Both Ways
+BEW Branch Either Way
+BBBF Branch on Bit Bucket Full
+BH Branch and Hang
+BMR Branch Multiple Registers
+BOB Branch On Bug
+BPO Branch on Power Off
+BST Backspace and Stretch Tape
+CDS Condense and Destroy System
+CLBR Clobber Register
+CLBRI Clobber Register Immediately
+CM Circulate Memory
+CMFRM Come From -- essential for truly structured programming
+CPPR Crumple Printer Paper and Rip
+CRN Convert to Roman Numerals
+%
+Proposed Additions to the PDP-11 Instruction Set:
+
+DC Divide and Conquer
+DMPK Destroy Memory Protect Key
+DO Divide and Overflow
+EMPC Emulate Pocket Calculator
+EPI Execute Programmer Immediately
+EROS Erase Read Only Storage
+EXCE Execute Customer Engineer
+HCF Halt and Catch Fire
+IBP Insert Bug and Proceed
+INSQSW Insert into queue somewhere (for FINO queues [First in never out])
+PBC Print and Break Chain
+PDSK Punch Disk
+%
+Proposed Additions to the PDP-11 Instruction Set:
+
+PI Punch Invalid
+POPI Punch Operator Immediately
+PVLC Punch Variable Length Card
+RASC Read And Shred Card
+RPM Read Programmers Mind
+RSSC Reduce Speed, Step Carefully (for improved accuracy)
+RTAB Rewind Tape and Break
+RWDSK Rewind Disk
+RWOC Read Writing On Card
+SCRBL Scribble to disk - faster than a write
+SLC Search for Lost Chord
+SPSW Scramble Program Status Word
+SRSD Seek Record and Scar Disk
+STROM Store in Read Only Memory
+TDB Transfer and Drop Bit
+WBT Water Binary Tree
+%
+Prosperity makes friends, adversity tries them.
+ -- Publilius Syrus
+%
+Prototype designs always work.
+ -- Don Vonada
+%
+prototype, n.
+ First stage in the life cycle of a computer product, followed by
+ pre-alpha, alpha, beta, release version, corrected release version,
+ upgrade, corrected upgrade, etc. Unlike its successors, the
+ prototype is not expected to work.
+%
+Protozoa are small, and bacteria are small, but viruses are smaller
+than the both put together.
+%
+Providence New Jersey is one of the few cities
+where Velveeta cheese appears on the gourmet shelf.
+%
+Prunes give you a run for your money.
+%
+Pryor's Observation:
+ How long you live has nothing to do
+ with how long you are going to be dead.
+%
+PS: This message is not intended to supply the minimum
+daily requirement of serious thought. Consult your doctor
+or pharmacist, but not the one that just sent you electronic
+junk mail or promises to make explicit drugs fast.
+ -- taken from Norman Wilson's .sig
+%
+Psychiatrists say that one out of four people are mentally ill. Check
+three friends. If they're OK, you're it.
+%
+Psychiatry enables us to correct our faults by confessing our parents'
+shortcomings.
+ -- Dr. Laurence J. Peter, "Peter's Principles"
+%
+Psychics will soon lead dogs to your body.
+%
+Psychoanalysis is that mental illness for which it regards itself
+a therapy.
+ -- Karl Kraus
+
+Psychiatry is the care of the id by the odd.
+
+Show me a sane man and I will cure him for you.
+ -- Carl G. Jung
+%
+Psychologist, n.:
+ Someone who watches everyone else when an attractive woman walks
+ into a room.
+%
+Psychologists think they're experimental psychologists.
+Experimental psychologists think they're biologists.
+Biologists think they're biochemists.
+Biochemists think they're chemists.
+Chemists think they're physical chemists.
+Physical chemists think they're physicists.
+Physicists think they're theoretical physicists.
+Theoretical physicists think they're mathematicians.
+Mathematicians think they're metamathematicians.
+Metamathematicians think they're philosophers.
+Philosophers think they're gods.
+%
+Psychology. Mind over matter.
+Mind under matter? It doesn't matter.
+Never mind.
+%
+Psychotherapy is the theory that the patient will probably get well
+anyhow and is certainly a damn fool.
+ -- H. L. Mencken
+%
+Public use of any portable music system is a
+virtually guaranteed indicator of sociopathic tendencies.
+ -- Zoso
+%
+Publishing a volume of verse is like dropping
+a rose petal down the Grand Canyon and waiting for the echo.
+%
+Pudder's Law:
+ Anything that begins well will end badly.
+ (Note: The converse of Pudder's law is not true.)
+%
+Punning is the worst vice, and there's no vice versa.
+%
+Puns are little "plays on words" that a certain breed of person loves
+to spring on you and then look at you in a certain self-satisfied way
+to indicate that he thinks that you must think that he is by far the
+cleverest person on Earth now that Benjamin Franklin is dead, when in
+fact what you are thinking is that if this person ever ends up in a
+lifeboat, the other passengers will hurl him overboard by the end of
+the first day even if they have plenty of food and water.
+ -- Dave Barry, "Why Humor is Funny"
+%
+Pure drivel tends to drive ordinary drivel off of the TV screen.
+%
+PURGE COMPLETE.
+%
+PURITAN:
+ Someone who is deathly afraid that
+ someone, somewhere, is having fun.
+%
+Puritanism -- the haunting fear that someone, somewhere, may be happy.
+ -- H. L. Mencken, "A Book of Burlesques"
+%
+Purpitation, v.:
+ To take something off the grocery shelf, decide you
+ don't want it, and then put it in another section.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Pushing 30 is exercise enough.
+%
+Pushing 40 is exercise enough.
+%
+Put a pot of chili on the stove to simmer.
+Let it simmer. Meanwhile, broil a good steak.
+Eat the steak. Let the chili simmer. Ignore it.
+ -- Recipe for chili from Allan Shrivers, former governor
+ of Texas.
+%
+Put a rogue in the limelight and he will act like an honest man.
+ -- Napoleon Bonaparte, "Maxims"
+%
+Put another password in,
+Bomb it out, then try again.
+Try to get past logging in,
+We're hacking, hacking, hacking.
+
+Try his first wife's maiden name,
+This is more than just a game.
+It's real fun, but just the same,
+It's hacking, hacking, hacking.
+%
+Put cats in the coffee and mice in the tea!
+%
+Put no trust in cryptic comments.
+%
+Put not your trust in money, but put your money in trust.
+%
+Put your best foot forward.
+Or just call in and say you're sick.
+%
+Put your brain in gear before starting your mouth in motion.
+%
+Put your Nose to the Grindstone!
+ -- Amalgamated Plastic Surgeons and Toolmakers, Ltd.
+%
+Put your trust in those who are worthy.
+%
+Putt's Law:
+ Technology is dominated by two types of people:
+ Those who understand what they do not manage.
+ Those who manage what they do not understand.
+%
+Pyro's of the world... IGNITE !!!
+%
+Q: Are we not men?
+A: We are Vaxen.
+%
+Q: Do you know what the death rate around here is?
+A: One per person.
+%
+Q: Do you think the idea of "one tool doing one job" has been
+ abandoned? ...
+A: Those days are dead and gone and the eulogy was delivered by
+ Perl.
+ -- Rob Pike
+%
+Q: Have you heard about the man who didn't pay for his exorcism?
+A: He got re-possessed!
+%
+Q: How can we get the Beatles to reunite for one more concert?
+A: With three more bullets.
+%
+Q: How can you tell if an elephant is having an affair with
+ your wife?
+A: You have to wait 22 months.
+%
+Q: How can you tell if an elephant is sitting on your back
+ in a hurricane?
+A: You can hear his ears flapping in the wind.
+%
+Q: How can you tell when a Burroughs salesman is lying?
+A: When his lips move.
+%
+Q: How did the elephant get to the top of the oak tree?
+A: He sat on an acorn and waited for spring.
+
+Q: But how did he get back down?
+A: He crawled out on a leaf and waited for autumn.
+%
+Q: How did the regular expression cross the road?
+A: ^.*$
+%
+Q: How did you get into artificial intelligence?
+A: Seemed logical -- I didn't have any real intelligence.
+%
+Q: How do you catch a unique rabbit?
+A: Unique up on it!
+
+Q: How do you catch a tame rabbit?
+A: The tame way!
+%
+Q: How do you keep a moron in suspense?
+%
+Q: How do you keep an Aggie busy at a terminal?
+A: While he's not looking, switch it to "local".
+%
+Q: How do you know when you're in the <ethnic> section of Vermont?
+A: The maple sap buckets are hanging on utility poles.
+%
+Q: How do you make an elephant float?
+A: You get two scoops of elephant and some root beer...
+%
+Q: How do you save a drowning lawyer?
+A: Throw him a rock.
+%
+Q: How do you shoot a blue elephant?
+A: With a blue-elephant gun.
+
+Q: How do you shoot a pink elephant?
+A: Twist its trunk until it turns blue, then shoot it with
+ a blue-elephant gun.
+%
+Q: How do you stop an elephant from charging?
+A: Take away his credit cards.
+%
+Q: How does a hacker fix a function which
+ doesn't work for all of the elements in its domain?
+A: He changes the domain.
+%
+Q: How does a single woman in New York get rid of cockroaches?
+A: She asks them for a commitment.
+%
+Q: How does a WASP propose marriage?
+A: "How would you like to be buried with my people?"
+%
+Q: How many Bell Labs Vice Presidents does it take to change a light bulb?
+A: That's proprietary information. Answer available from AT&T on payment
+ of license fee (binary only).
+%
+Q: How many bureaucrats does it take to screw in a light bulb?
+A: Two. One to assure everyone that everything possible is being
+ done while the other screws the bulb into the water faucet.
+%
+Q: How many Californians does it take to screw in a lightbulb?
+A: Five. One to screw in the lightbulb and four to share the
+ experience. (Actually, Californians don't screw in
+ lightbulbs, they screw in hot tubs.)
+
+Q: How many Oregonians does it take to screw in a light bulb?
+A: Three. One to screw in the lightbulb and two to fend off all
+ those Californians trying to share the experience.
+%
+Q: How many college football players does it take to screw in a lightbulb?
+A: Only one, but he gets three credits for it.
+%
+Q: How many DEC repairmen does it take to fix a flat?
+A: Five; four to hold the car up and one to swap tires.
+
+Q: How long does it take?
+A: It's indeterminate.
+ It will depend upon how many flats they've brought with them.
+
+Q: What happens if you've got TWO flats?
+A: They replace your generator.
+%
+Q: How many Democrats does it take to enjoy a good joke?
+A: One more than you can find.
+%
+Q: How many elephants can you fit in a VW Bug?
+A: Four. Two in the front, two in the back.
+
+Q: How can you tell if an elephant is in your refrigerator?
+A: There's a footprint in the mayo.
+
+Q: How can you tell if two elephants are in your refrigerator?
+A: There's two footprints in the mayo.
+
+Q: How can you tell if three elephants are in your refrigerator?
+A: The door won't shut.
+
+Q: How can you tell if four elephants are in your refrigerator?
+A: There's a VW Bug in your driveway.
+%
+Q: How many existentialists does it take to screw in a lightbulb?
+A: Two. One to screw it in and one to observe how the lightbulb
+ itself symbolizes a single incandescent beacon of subjective
+ reality in a netherworld of endless absurdity reaching out toward a
+ maudlin cosmos of nothingness.
+%
+Q: How many hardware engineers does it take to change a lightbulb?
+A: None. We'll fix it in software.
+
+Q: How many system programmers does it take to change a light bulb?
+A: None. The application can work around it.
+
+Q: How many software engineers does it take to change a lightbulb?
+A: None. We'll document it in the manual.
+
+Q: How many tech writers does it take to change a lightbulb?
+A: None. The user can figure it out.
+%
+Q: How many Harvard MBAs does it take to screw in a lightbulb?
+A: Just one. He grasps it firmly and the universe revolves around him.
+%
+Q: How many IBM 370s does it take to execute a job?
+A: Four, three to hold it down, and one to rip its head off.
+%
+Q: How many IBM CPUs does it take to do a logical right shift?
+A: 33. 1 to hold the bits and 32 to push the register.
+%
+Q: How many IBM types does it take to change a light bulb?
+A: Fifteen. One to do it, and fourteen to write document number
+ GC7500439-0001, Multitasking Incandescent Source System Facility,
+ of which 10% of the pages state only "This page intentionally
+ left blank", and 20% of the definitions are of the form "A:.....
+ consists of sequences of non-blank characters separated by blanks".
+%
+Q: How many journalists does it take to screw in a lightbulb?
+A: Three. One to report it as an inspired government program to bring
+ light to the people, one to report it as a diabolical government plot
+ to deprive the poor of darkness, and one to win a Pulitzer prize for
+ reporting that Electric Company hired a lightbulb-assassin to break
+ the bulb in the first place.
+%
+Q: How many lawyers does it take to change a light bulb?
+A: One. Only it's his light bulb when he's done.
+%
+Q: How many lawyers does it take to change a light bulb?
+A: Whereas the party of the first part, also known as "Lawyer",
+ and the party of the second part, also known as "Light Bulb",
+ do hereby and forthwith agree to a transaction wherein the
+ party of the second part shall be removed from the current
+ position as a result of failure to perform previously agreed
+ upon duties, i.e., the lighting, elucidation, and otherwise
+ illumination of the area ranging from the front (north) door,
+ through the entryway, terminating at an area just inside the
+ primary living area, demarcated by the beginning of the carpet,
+ any spillover illumination being at the option of the party of
+ the second part and not required by the aforementioned agreement
+ between the parties.
+
+ The aforementioned removal transaction shall include, but not
+ be limited to, the following. The party of the first part
+ shall, with or without elevation at his option, by means of a
+ chair, stepstool, ladder or any other means of elevation, grasp
+ the party of the second part and rotate the party of the second
+ part in a counter-clockwise direction, this point being tendered
+ non-negotiable. Upon reaching a point where the party of the
+ second part becomes fully detached from the receptacle, the
+ party of the first part shall have the option of disposing of
+ the party of the second part in a manner consistent with all
+ relevant and applicable local, state and federal statutes.
+
+ Once separation and disposal have been achieved, the party of
+ the first part shall have the option of beginning installation.
+ Aforesaid installation shall occur in a manner consistent with
+ the reverse of the procedures described in step one of this
+ self-same document, being careful to note that the rotation
+ should occur in a clockwise direction, this point also being
+ non-negotiable.
+
+ The above described steps may be performed, at the option of
+ the party of the first part, by any or all agents authorized
+ by him, the objective being to produce the most possible
+ revenue for the Partnership.
+%
+Q: How many lawyers does it take to change a light bulb?
+A: You won't find a lawyer who can change a light bulb. Now, if
+ you're looking for a lawyer to screw a light bulb...
+%
+Q: How many marketing people does it take to change a lightbulb?
+A: I'll have to get back to you on that.
+%
+Q: How many Martians does it take to screw in a lightbulb?
+A: One and a half.
+%
+Q: How many Marxists does it take to screw in a lightbulb?
+A: None: The lightbulb contains the seeds of its own revolution.
+%
+Q: How many mathematicians does it take to screw in a lightbulb?
+A: One. He gives it to six Californians, thereby reducing the problem
+ to the earlier joke.
+%
+Q: How many members of the U.S.S. Enterprise does it take to change a
+ light bulb?
+A: Seven. Scotty has to report to Captain Kirk that the light bulb in
+ the Engineering Section is getting dim, at which point Kirk will send
+ Bones to pronounce the bulb dead (although he'll immediately claim
+ that he's a doctor, not an electrician). Scotty, after checking
+ around, realizes that they have no more new light bulbs, and complains
+ that he "canna" see in the dark. Kirk will make an emergency stop at
+ the next uncharted planet, Alpha Regula IV, to procure a light bulb
+ from the natives, who, are friendly, but seem to be hiding something.
+ Kirk, Spock, Bones, Yeoman Rand and two red shirt security officers
+ beam down to the planet, where the two security officers are promptly
+ killed by the natives, and the rest of the landing party is captured.
+ As something begins to develop between the Captain and Yeoman Rand,
+ Scotty, back in orbit, is attacked by a Klingon destroyer and must
+ warp out of orbit. Although badly outgunned, he cripples the Klingon
+ and races back to the planet in order to rescue Kirk et. al. who have
+ just saved the natives' from an awful fate and, as a reward, been
+ given all lightbulbs they can carry. The new bulb is then inserted
+ and the Enterprise continues on its five year mission.
+%
+Q: How many people from New Jersey does it take to change a light
+ bulb?
+A: Three. One to do it, one to watch, and the third to shoot the
+ witness.
+%
+Q: How many pre-med's does it take to change a lightbulb?
+A: Five: One to change the bulb and four to pull the ladder
+ out from under him.
+%
+Q: How many psychiatrists does it take to change a light bulb?
+A: Only one, but it takes a long time, and the light bulb has
+ to really want to change.
+%
+Q: How many Romulans does it take to screw in a light bulb?
+A: Twelve. One to screw the light-bulb in, and eleven
+ to self-destruct the ship out of disgrace.
+
+ [Warning: do not tell this joke to Romulans or else be ready for
+ a fight. They consider it to be a disgrace, though it's
+ pretty good for a LBJ. Ed.]
+%
+Q: How many surrealists does it take to change a light bulb?
+A: Two, one to hold the giraffe, and the other to fill the bathtub
+ with brightly colored machine tools.
+
+ [Surrealist jokes just aren't my cup of fur. Ed.]
+%
+Q: How many WASPs does it take to change a lightbulb?
+A: One.
+%
+Q: How many Zen masters does it take to screw in a light bulb?
+A: None. The Universe spins the bulb, and the Zen master stays out
+ of the way.
+%
+Q: How much does it cost to ride the Unibus?
+A: 2 bits.
+%
+Q: How was Thomas J. Watson buried?
+A: 9 edge down.
+%
+Q: Know what the difference between your latest project
+ and putting wings on an elephant is?
+A: Who knows? The elephant *might* fly, heh, heh...
+%
+Q: Minnesotans ask, "Why aren't there more pharmacists from Alabama?"
+A: Easy. It's because they can't figure out how to get the little
+ bottles into the typewriter.
+%
+Q: Somebody just posted that Roman Polanski directed Star Wars.
+ What should I do?
+A: Post the correct answer at once! We can't have people go on
+ believing that! Very good of you to spot this. You'll probably
+ be the only one to make the correction, so post as soon as you can.
+ No time to lose, so certainly don't wait a day, or check to see if
+ somebody else has made the correction.
+
+ And it's not good enough to send the message by mail. Since you're
+ the only one who really knows that it was Francis Coppola, you have
+ to inform the whole net right away!
+ -- Brad Templeton, "Emily Postnews Answers Your Questions
+ on Netiquette"
+%
+Q: What did one regular expression say to the other?
+A: .+
+%
+Q: What did Tarzan say when he saw the elephants coming over the hill?
+A: "The elephants are coming over the hill."
+
+Q: What did he say when saw them coming over the hill wearing
+ sunglasses?
+A: Nothing, for he didn't recognize them.
+%
+Q: What did the regular expression match?
+A: Identified the patterns "matc" and "match"
+%
+Q: What do a blonde and your computer have in common?
+A: You don't know how much either of them mean to you until
+ they go down on you.
+
+Q: What's the advantage to being married to a blonde?
+A: You can park in the handicapped zone.
+
+Q: Why did the blonde get so excited after she finished her jigsaw
+ puzzle in only 6 months?
+A: Because on the box it said "From 2-4 years".
+%
+Q: What do little WASPs want to be when they grow up?
+A: The very best person they can possibly be.
+%
+Q: What do monsters eat?
+A: Things.
+
+Q: What do monsters drink?
+A: Coke. (Because Things go better with Coke.)
+%
+Q: What do they call the alphabet in Arkansas?
+A: The impossible dream.
+%
+Q: What do WASPs do instead of making love?
+A: Rule the country.
+%
+Q: What do Winnie the Pooh and John the Baptist have in common?
+A: The same middle name.
+%
+Q: What do you call 15 blondes in a circle?
+A: A dope ring.
+
+Q: Why do blondes put their hair in ponytails?
+A: To cover up the valve stem.
+%
+Q: What do you call a blind pre-historic animal?
+A: Diyathinkhesaurus.
+
+Q: What do you call a blind pre-historic animal with a dog?
+A: Diyathinkhesaurus Rex.
+%
+Q: What do you call a boomerang that doesn't come back?
+A: A stick.
+%
+Q: What do you call a brunette between two blondes?
+A: An interpreter.
+
+Q: Why do blondes have square breasts?
+A: They forgot to take the tissues out of the box.
+
+Q: What do you call ten blonds in a row?
+A: A wind tunnel.
+%
+Q: What do you call a dog with no legs?
+A: What does it matter? He can't come anyway.
+
+ [I got a dog with no legs -- I call him Cigarette.
+ Every night, I take him out for a drag. Ed.]
+%
+Q: What do you call a group of kids with low IQs, drinking diet cola,
+ eating fruit, and singing?
+A: The Moron Tab and Apple Choir.
+%
+Q: What do you call a half-dozen Indians with Asian flu?
+A: Six sick Sikhs (sic).
+%
+Q: What do you call a million cats at the bottom of Lake Michigan?
+A: A good start.
+%
+Q: What do you call a principal female opera singer whose high C
+ is lower than those of other principal female opera singers?
+A: A deep C diva.
+%
+Q: What do you call a TV set that fixes itself?
+A: A Christian Science Monitor.
+%
+Q: What do you call a WASP who doesn't work for his father, isn't a
+ lawyer, and believes in social causes?
+A: A failure.
+%
+Q: What do you call the money you pay to the government when
+ you ride into the country on the back of an elephant?
+A: A howdah duty.
+%
+Q: What do you call the scratches that you get when a female
+ sheep bites you?
+A: Ewe nicks.
+%
+Q: What do you get when you cross a mobster with an international
+ standard?
+A: You get someone who makes you an offer that you can't understand!
+%
+Q: What do you get when you cross the Godfather with an attorney?
+A: An offer you can't understand.
+%
+Q: What do you get when you stuff a flaming stick down a rabbit-hole?
+A: Hot cross bunnies!
+%
+Q: What do you have when you have a lawyer buried up to his neck in sand?
+A: Not enough sand.
+%
+Q: What does a blonde do first thing in the morning?
+A: She goes home.
+
+Q: Why does a blonde have fur on the hem of her dress?
+A: To keep her neck warm.
+
+Q: How do you make a blonde laugh on Monday?
+A: Tell her a joke on Friday.
+%
+Q: What does a WASP Mom make for dinner?
+A: A crisp salad, a hearty soup, a lovely entree, followed by
+ a delicious dessert.
+%
+Q: What does it say on the bottom of Coke cans in North Dakota?
+A: Open other end.
+%
+Q: What goes: Sis! Boom! Baaaaah!
+A: Exploding sheep.
+%
+Q: What happens when four WASPs find themselves in the same room?
+A: A dinner party.
+%
+Q: What is green and lives in the ocean?
+A: Moby Pickle.
+%
+Q: What is it that a cow has four of and a woman has two of?
+A: Feet.
+%
+Q: What is orange and goes "click, click?"
+A: A ball point carrot.
+%
+Q: What is printed on the bottom of beer bottles in Minnesota?
+A: Open other end.
+%
+Q: What is purple and commutes?
+A: A boolean grape.
+%
+Q: What is purple and commutes?
+A: An Abelian grape.
+%
+Q: What is purple and concord the world?
+A: Alexander the Grape.
+%
+Q: What is the difference between a duck?
+A: One leg is both the same.
+%
+Q: What is the difference between Texas and yogurt?
+A: Yogurt has culture.
+%
+Q: What is the last thing a Kansas stripper takes off?
+A: Her bowling shoes.
+%
+Q: What is the mating call of a blonde?
+A: I think I'm drunk.
+
+Q: What's the call of a disappointed blonde?
+A: I *said*, I *think* I'm drunk!
+
+Q: What is the mating call of the ugly blonde?
+A: (Screaming) "I said: I'm drunk!"
+%
+Q: What is the sound of one cat napping?
+A: Mu.
+%
+Q: What lies on the bottom of the ocean and twitches?
+A: A nervous wreck.
+%
+Q: What looks like a cat, flies like a bat, brays like a donkey, and
+ plays like a monkey?
+A: Nothing.
+%
+Q: What regular expression do you often see around Christmas?
+A: [^L]
+%
+Q: What's a light-year?
+A: One-third less calories than a regular year.
+%
+Q: What's black and white and red all over?
+A: Two nuns in a chainsaw fight.
+%
+Q: What's bruised, bleeding, and lies in a ditch?
+A: Somebody who tells Aggie jokes.
+%
+Q: What's tan and black and looks great on a lawyer?
+A: A Doberman.
+%
+Q: What's the Blonde's cheer?
+A: I'm blonde, I'm blonde, I'm B.L.O.N... ah, oh well..
+ I'm blonde, I'm blonde, yea yea yea...
+
+Q: What do you call it when a blonde dies their hair brunette?
+A: Artificial intelligence.
+
+Q: How do you make a blonde's eyes light up?
+A: Shine a flashlight in their ear.
+%
+Q: What's the capital of Canada?
+A: American.
+%
+Q: What's the difference between a dead dog in the road and a dead
+ lawyer in the road?
+A: There are skid marks in front of the dog.
+%
+Q: What's the difference between a duck and an elephant?
+A: You can't get down off an elephant.
+%
+Q: What's the difference between a Mac and an Etch-a-Sketch?
+A: You don't have to shake the Mac to clear the screen.
+%
+Q: What's the difference between a RHU cheerleader and a whale?
+A: The moustache.
+%
+Q: What's the difference between an Irish wedding and an Irish wake?
+A: One more drunk.
+%
+Q: What's the difference between Bell Labs and the Boy Scouts of America?
+A: The Boy Scouts have adult supervision.
+%
+Q: What's the difference between Los Angeles and yogurt?
+A: Yogurt has a living, active culture.
+%
+Q: What's the difference between USL and the Graf Zeppelin?
+A: The Graf Zeppelin represented cutting edge technology for its time.
+%
+Q: What's the difference between USL and the Titanic?
+A: The Titanic had a band.
+%
+Q: What's tiny and yellow and very, very, dangerous?
+A: A canary with the super-user password.
+%
+Q: What's yellow, and equivalent to the Axiom of Choice?
+A: Zorn's Lemon.
+%
+Q: Where's the Lone Ranger take his garbage?
+A: To the dump, to the dump, to the dump dump dump!
+
+Q: What's the Pink Panther say when he steps on an ant hill?
+A: Dead ant, dead ant, dead ant dead ant dead ant...
+%
+Q: Who cuts the grass on Walton's Mountain?
+A: Lawn Boy.
+%
+Q: Why are Jewish divorces so expensive?
+A: Because they're worth it!
+%
+Q: Why did the astrophysicist order three hamburgers?
+A: Because he was hungry.
+%
+Q: Why did the blonde climb over the glass wall?
+A: To see what was on the other side.
+
+Q: Why do blondes like tilt steering wheels?
+A: More head room.
+
+Q: How does a blonde turn on the light after having sex?
+A: She opens the car door.
+%
+Q: Why did the chicken cross the road?
+A: He was giving it last rites.
+%
+Q: Why did the chicken cross the road?
+A: To see his friend Gregory peck.
+
+Q: Why did the chicken cross the playground?
+A: To get to the other slide.
+%
+Q: Why did the germ cross the microscope?
+A: To get to the other slide.
+%
+Q: Why did the lone ranger kill Tonto?
+A: He found out what "kemosabe" really means.
+%
+Q: Why did the mathematician name his dog "Cauchy"?
+A: Because he left a residue at every pole.
+%
+Q: Why did the programmer call his mother long distance?
+A: Because that was her name.
+%
+Q: Why did the tachyon cross the road?
+A: Because it was on the other side.
+%
+Q: Why did the WASP cross the road?
+A: To get to the middle.
+%
+Q: Why do firemen wear red suspenders?
+A: To conform with departmental regulations concerning uniform dress.
+%
+Q: Why do mountain climbers rope themselves together?
+A: To prevent the sensible ones from going home.
+%
+Q: Why do people who live near Niagara Falls have flat foreheads?
+A: Because every morning they wake up thinking "What *is* that noise?
+ Oh, right, *of course*!
+%
+Q: Why do the police always travel in threes?
+A: One to do the reading, one to do the writing, and the other keeps
+ an eye on the two intellectuals.
+%
+Q: Why does Washington have the most lawyers per capita and
+ New Jersey the most toxic waste dumps?
+A: God gave New Jersey first choice.
+%
+Q: Why don't blondes eat pickles?
+A: Because they get their head stuck in the jars.
+
+Q: Why do blondes wear underwear?
+A: To keep their ankles warm.
+
+Q: How do you kill a blonde?
+A: Put spikes in her shoulder pads.
+%
+Q: Why don't lawyers go to the beach?
+A: The cats keep trying to bury them.
+%
+Q: Why don't Scotsmen ever have coffee the way they like it?
+A: Well, they like it with two lumps of sugar. If they drink
+ it at home, they only take one, and if they drink it while
+ visiting, they always take three.
+%
+Q: Why is Christmas just like a day at the office?
+A: You do all of the work and the fat guy in the suit
+ gets all the credit.
+%
+Q: Why is it that the more accuracy you demand from an interpolation
+ function, the more expensive it becomes to compute?
+A: That's the Law of Spline Demand.
+%
+Q: Why should blondes not be given coffee breaks?
+A: It takes too long to retrain them.
+
+Q: What's the mating call of the brunette?
+A: All the blondes have gone home!
+
+Q: How do you tell if a blonde's been using the computer?
+A: There's white-out on the screen.
+%
+Q: Why should you always serve a Southern Carolina football man
+ soup in a plate?
+A: 'Cause if you give him a bowl, he'll throw it away.
+%
+Q: Why was Stonehenge abandoned?
+A: It wasn't IBM compatible.
+%
+QED.
+%
+QOTD:
+ "A child of 5 could understand this! Fetch me a child of 5."
+%
+QOTD:
+ "A lack of advanced planning on your part does not constitute
+ an emergency on my part."
+%
+QOTD:
+ "A university faculty is 500 egotists with a common parking problem."
+%
+QOTD:
+ "All I want is a little more than I'll ever get."
+%
+QOTD:
+ "All I want is more than my fair share."
+%
+QOTD:
+ "Dead people are good at running because they don't
+ have to stop and breathe."
+ -- Hokey, watching "Night of the Living Dead"
+%
+QOTD:
+ "Don't let your mind wander -- it's too little to be let out alone."
+%
+QOTD:
+ "East is east... and let's keep it that way."
+%
+QOTD:
+ "Every morning I read the obituaries; if my name's not there,
+ I go to work."
+%
+QOTD:
+ "Everything I am today I owe to people, whom it is now
+ too late to punish."
+%
+QOTD:
+ "Flash! Flash! I love you! ...but we only have fourteen hours to
+ save the earth!"
+%
+QOTD:
+ "He eats like a bird... five times his own weight each day."
+%
+QOTD:
+ "Her other car is a broom."
+%
+QOTD:
+ "He's a perfectionist. If he married Raquel Welch, he'd expect
+ her to cook."
+%
+QOTD:
+ "He's such a hick he doesn't even have a trapeze in his bedroom."
+%
+QOTD:
+ "How can I miss you if you won't go away?"
+%
+QOTD:
+ "I ain't broke, but I'm badly bent."
+%
+QOTD:
+ "I am not sure what this is, but an `F' would only dignify it."
+%
+QOTD:
+ "I don't think they could put him in a mental hospital. On the
+other hand, if he were already in, I don't think they'd let him out."
+%
+QOTD:
+ "I drive my car quietly, for it goes without saying."
+%
+QOTD:
+ "I haven't come far enough, and don't call me baby."
+%
+QOTD:
+ "I looked out my window, and saw Kyle Pettys' car upside down,
+ then I thought `One of us is in real trouble.'"
+ -- Davey Allison, on a 150 m.p.h. crash
+%
+QOTD:
+ "I love your outfit, does it come in your size?"
+%
+QOTD:
+ "I may not be able to walk, but I drive from the sitting position."
+%
+QOTD:
+ "I only touch base with reality on an as-needed basis!"
+%
+QOTD:
+ "I opened Pandora's box, let the cat out of the bag and put the
+ ball in their court."
+ -- Hon. J. Hacker (The Ministry of Administrative Affairs)
+%
+QOTD:
+ "I sprinkled some baking powder over a couple of potatoes, but it
+ didn't work."
+%
+QOTD:
+ "I thought I saw a unicorn on the way over, but it was just a
+ horse with one of the horns broken off."
+%
+QOTD:
+ "I treat her like a thoroughbred, and she's STILL a nag!"
+%
+QOTD:
+ "I tried buying a goat instead of a lawn tractor; had to return
+ it though. Couldn't figure out a way to connect the snow blower."
+%
+QOTD:
+ "I used to be an idealist, but I got mugged by reality."
+%
+QOTD:
+ "I used to be lost in the shuffle, now I just shuffle along with
+ the lost."
+%
+QOTD:
+ "I used to get high on life but lately I've built up a resistance."
+%
+QOTD:
+ "I used to go to UCLA, but then my Dad got a job."
+%
+QOTD:
+ "I used to jog, but the ice kept bouncing out of my glass."
+%
+QOTD:
+ "I want a home, a family, an occasional spanking ..."
+ -- Kathy Ireland
+%
+QOTD:
+ "I won't say he's untruthful, but his wife has to call the
+ dog for dinner."
+%
+QOTD:
+ "I'd never marry a woman who didn't like pizza. I might play
+ golf with her, but I wouldn't marry her."
+%
+QOTD:
+ "If he learns from his mistakes, pretty soon he'll know everything."
+%
+QOTD:
+ "If I could walk that way, I wouldn't need the aftershave."
+%
+QOTD:
+ "If I'm what I eat, I'm a chocolate chip cookie."
+%
+QOTD:
+ "If it's too loud, you're too old."
+%
+QOTD:
+ "If you keep an open mind people will throw a lot of garbage in it."
+%
+QOTD:
+ "If you're looking for trouble, I can offer you a wide selection."
+%
+QOTD:
+ "I'll listen to reason when it comes out on CD."
+%
+QOTD:
+ "I'm just a boy named 'su'..."
+%
+QOTD:
+ "I'm not a nerd -- I'm 'socially challenged.'"
+%
+QOTD:
+ I'm not bald -- I'm "hair challenged".
+
+ [I thought that was "differently haired". Ed.]
+%
+QOTD:
+ "I'm not really for apathy, but I'm not against it either..."
+%
+QOTD:
+ "I'm on a seafood diet -- I see food and I eat it."
+%
+QOTD:
+ "In the shopping mall of the mind, he's in the toy department."
+%
+QOTD:
+ "It seems to me that your antenna doesn't bring in too many
+ stations anymore."
+%
+QOTD:
+ "It was so cold last winter that I saw a lawyer with his
+ hands in his own pockets."
+%
+QOTD:
+ "It wouldn't have been anything, even if it were gonna be a thing."
+%
+QOTD:
+ "It's a cold bowl of chili, when love don't work out."
+%
+QOTD:
+ "It's a dog-eat-dog world, and I'm wearing Milk Bone underwear."
+%
+QOTD:
+ "It's been Monday all week today."
+%
+QOTD:
+ "It's been real and it's been fun, but it hasn't been real fun."
+%
+QOTD:
+ "It's hard to tell whether he has an ace up his sleeve or if
+ the ace is missing from his deck altogether."
+%
+QOTD:
+ "It's men like him that give the Y chromosome a bad name."
+%
+QOTD:
+ "It's not the despair... I can stand the despair. It's the hope."
+%
+QOTD:
+ "It's sort of a threat, you see. I've never been very good at
+ them myself, but I'm told they can be very effective."
+%
+QOTD:
+ "I've always wanted to work in the Federal Mint. And then go on
+ strike. To make less money."
+%
+QOTD:
+ "I've got one last thing to say before I go; give me back
+ all of my stuff."
+%
+QOTD:
+ "I've heard about civil Engineers, but I've never met one."
+%
+QOTD:
+ "I've just learned about his illness. Let's hope it's nothing
+ trivial."
+%
+QOTD:
+ "Just how much can I get away with and still go to heaven?"
+%
+QOTD:
+ "Let's do it."
+ -- Gary Gilmore, to his firing squad
+%
+QOTD:
+ "Like this rose, our love will wilt and die."
+%
+QOTD:
+ "Ludwig Boltzmann, who spend much of his life studying statistical
+ mechanics died in 1906 by his own hand. Paul Ehrenfest, carrying
+ on the work, died similarly in 1933. Now it is our turn."
+ -- Goodstein, States of Matter
+%
+QOTD:
+ "Money isn't everything, but at least it keeps the kids in touch."
+%
+QOTD:
+ "My ambition is to marry a rich woman who's too proud to let
+ her husband work."
+%
+QOTD:
+ "My life is a soap opera, but who gets the movie rights?"
+%
+QOTD:
+ "My mother was the travel agent for guilt trips."
+%
+QOTD:
+ "My shampoo lasts longer than my relationships."
+%
+QOTD:
+ "Of course it's the murder weapon. Who would frame someone with
+ a fake?"
+%
+QOTD:
+ "Of course there's no reason for it, it's just our policy."
+%
+QOTD:
+ "Oh, no, no... I'm not beautiful. Just very, very pretty."
+%
+QOTD:
+ "On a scale of 1 to 10 I'd say... oh, somewhere in there."
+%
+QOTD:
+ "Our parents were never our age."
+%
+QOTD:
+ "Overweight is when you step on your dog's tail and it dies."
+%
+QOTD:
+ "Sacred cows make great hamburgers."
+%
+QOTD:
+ "Say, you look pretty athletic. What say we put a pair of tennis
+ shoes on you and run you into the wall?"
+%
+QOTD:
+ "Sex is the most fun you can have without laughing."
+%
+QOTD:
+ "She's about as smart as bait."
+%
+QOTD:
+ "Silence is the only virtue he has left."
+%
+QOTD:
+ "Some people have one of those days. I've had one of those lives."
+%
+QOTD:
+ "Sure, I turned down a drink once. Didn't understand the question."
+%
+QOTD:
+ "Talent does what it can, genius what it must.
+ I do what I get paid to do."
+%
+QOTD:
+ "The baby was so ugly they had to hang a pork chop around its
+ neck to get the dog to play with it."
+%
+QOTD:
+ "The elder gods went to Suggoth and all I got was this lousy T-shirt."
+%
+QOTD:
+ "The forest may be quiet, but that doesn't mean
+ the snakes have gone away."
+%
+QOTD:
+ "The only easy way to tell a hamster from a gerbil is that the
+ gerbil has more dark meat."
+%
+QOTD:
+ "There may be no excuse for laziness, but I'm sure looking."
+%
+QOTD:
+ "This is a one line proof... if we start sufficiently far to the
+ left."
+%
+QOTD:
+ "To hell with patience, I'm gonna kill me something!"
+%
+QOTD:
+ "Unlucky? If I bought a pumpkin farm, they'd cancel Halloween."
+%
+QOTD:
+ "What do you mean, you had the dog fixed? Just what made you
+ think he was broken!"
+%
+QOTD:
+ "What I like most about myself is that I'm so understanding
+ when I mess things up."
+%
+QOTD:
+ "What women and psychologists call `dropping your armor', we call
+ "baring your neck."
+%
+QOTD:
+ "Who? Me? No, no, NO!! But I do sell rugs."
+%
+QOTD:
+ "Wouldn't it be wonderful if real life supported control-Z?"
+%
+QOTD:
+ "Y'know how s'm people treat th'r body like a TEMPLE?
+ Well, I treat mine like 'n AMUSEMENT PARK... S'great..."
+%
+QOTD:
+ "You want me to put *holes* in my ears and hang things from them?
+ How... tribal."
+%
+QOTD:
+ "You're so dumb you don't even have wisdom teeth."
+%
+Quack!
+ Quack!! Quack!!
+%
+Quality control:
+ Assuring that the quality of a product does not get out of hand
+ and add to the cost of its manufacture or design.
+%
+Quality Control, n.:
+ The process of testing one out of every 1,000 units coming off
+a production line to make sure that at least one out of 100 works.
+%
+Quantity is no substitute for quality,
+but its the only one we've got.
+%
+Quantum Mechanics is a lovely introduction to Hilbert Spaces!
+ -- Overheard at last year's Archimedeans' Garden Party
+%
+Quantum Mechanics is God's version of "Trust me."
+%
+QUARK:
+ The sound made by a well bred duck.
+%
+Quark! Quark! Beware the quantum duck!
+%
+question = ( to ) ? be : ! be;
+ -- William Shakespeare
+%
+QUESTION AUTHORITY.
+
+(Sez who?)
+%
+Question: Is it better to abide by the rules until
+they're changed or help speed the change by breaking them?
+%
+Questionable day.
+Ask somebody something.
+%
+Question:
+Man Invented Alcohol,
+God Invented Grass.
+Who do you trust?
+%
+Questions are never indiscreet, answers sometimes are.
+ -- Oscar Wilde
+%
+Quick!! Act as if nothing has happened!
+%
+Quick, sing me the BUDAPEST NATIONAL ANTHEM!!
+%
+Quidquid latine dictum sit, altum viditur.
+
+(Whatever is said in Latin sounds profound.)
+%
+Quigley's Law:
+ Whoever has any authority over you,
+ no matter how small, will attempt to use it.
+%
+Quit worrying about your health. It'll go away.
+ -- Robert Orben
+%
+Quite frankly, I don't like you humans.
+After what you all have done, I find being "inhuman" a compliment.
+%
+QUOTE OF THE DAY:
+
+ `
+
+%
+Qvid me anxivs svm?
+%
+Radicalism:
+ The conservatism of tomorrow injected into the affairs of today.
+ -- Ambrose Bierce
+%
+RADIO SHACK LEVEL II BASIC
+READY
+>_
+%
+Radioactive cats have 18 half-lives.
+%
+Raffiniert ist der Herrgott aber boshaft ist er nicht.
+ -- Albert Einstein
+%
+rain falls where clouds come
+sun shines where clouds go
+clouds just come and go
+ -- Florian Gutzwiller
+%
+Rainy days and automatic weapons always get me down.
+%
+Rainy days and Mondays always get me down.
+%
+Raising pet electric eels is gaining a lot of current popularity.
+%
+Ralph's Observation:
+It is a mistake to let any mechanical object
+realise that you are in a hurry.
+%
+RAM wasn't built in a day.
+%
+Random, n.:
+ as in number, predictable.
+ as in memory access, unpredictable.
+%
+Rarely do people communicate; they just take turns talking.
+%
+Rascal, am I? Take THAT!
+ -- Errol Flynn
+%
+Rate yourself on the nerd-o-matic scale. (1 point for each YES answer)
+
+Are your glasses mended with a strip of masking tape right over your nose?
+Do you put pennies in the slots in your penny loafers?
+Does your bow-tie flash "hey you kid" in red neon at parties?
+Do you think pizza before noon is unhealthy?
+Do you use the "greasy kid's stuff" to stick down your cowlick?
+Do you wear a "nerd-pack" in your shirt pocket to keep the dozen
+ or so pencils from marking the cloth?
+Do you think Mary Jane is somebody's name?
+Is illegal fishing something only a daring criminal would do?
+Is Batman your hero? Superman? Green Lantern? The Shadow?
+Do you think girls who kiss on the first date are loose?
+
+0-2 -- You are really hip, a real cool cat, a hoopy frood.
+3-5 -- There is hope for you yet.
+6-7 -- Uh-oh, trouble in River City.
+8-10 -- Your immortal soul is in peril.
+11+ -- Does suicide seem attractive?
+%
+Rattling around the back of my head is a disturbing image of something I
+saw at the airport... Now I'm remembering, those giant piles of computer
+magazines right next to "People" and "Time" in the airport store. Does it
+bother anyone else that half the world is being told all of our hard-won
+secrets of computer technology? Remember how all the lawyers cried foul
+when "How to Avoid Probate" was published? Are they taking no-fault
+insurance lying down? No way! But at the current rate it won't be long
+before there are stacks of the "Transactions on Information Theory" at the
+A&P checkout counters. Who's going to be impressed with us electrical
+engineers then? Are we, as the saying goes, giving away the store?
+ -- Robert W. Lucky, IEEE president
+%
+Ray's Rule of Precision:
+ Measure with a micrometer. Mark with chalk. Cut with an axe.
+%
+Razors pain you;
+Rivers are damp;
+Acids stain you;
+And drugs cause cramp.
+Guns aren't lawful;
+Nooses give;
+Gas smells awful;
+You might as well live.
+ -- Dorothy Parker, "Resume", 1926
+%
+Re: Graphics:
+ A picture is worth 10K words -- but only those to describe
+ the picture. Hardly any sets of 10K words can be adequately
+ described with pictures.
+%
+Reach into the thoughts of friends,
+And find they do not know your name.
+Squeeze the teddy bear too tight,
+And watch the feathers burst the seams.
+Touch the stained glass with your cheek,
+And feel its chill upon your blood.
+Hold a candle to the night,
+And see the darkness bend the flame.
+Tear the mask of peace from God,
+And hear the roar of souls in hell.
+Pluck a rose in name of love,
+And watch the petals curl and wilt.
+Lean upon the western wind,
+And know you are alone.
+ -- Dru Mims
+%
+Reactor error - core dumped!
+%
+Reader, suppose you were an idiot. And suppose you were a member of
+Congress. But I repeat myself.
+ -- Mark Twain
+%
+Reading is thinking with someone else's head instead of one's own.
+%
+Reading is to the mind what exercise is to the body.
+%
+Real computer scientists admire ADA for its overwhelming aesthetic
+value but they find it difficult to actually program in it, as it is
+much too large to implement. Most computer scientists don't notice
+this because they are still arguing over what else to add to ADA.
+%
+Real computer scientists despise the idea of actual hardware. Hardware has
+limitations, software doesn't. It's a real shame that Turing machines are
+so poor at I/O.
+%
+Real computer scientists don't comment their code. The identifiers are
+so long they can't afford the disk space.
+%
+Real computer scientists don't program in assembler. They don't write
+in anything less portable than a number two pencil.
+%
+Real computer scientists don't write code. They occasionally tinker with
+`programming systems', but those are so high level that they hardly count
+(and rarely count accurately; precision is for applications).
+%
+Real computer scientists like having a computer on their desk, else how
+could they read their mail?
+%
+Real computer scientists only write specs for languages that might run on
+future hardware. Nobody trusts them to write specs for anything homo sapiens
+will ever be able to fit on a single planet.
+%
+Real programmers disdain structured programming. Structured
+programming is for compulsive neurotics who were prematurely toilet-
+trained. They wear neckties and carefully line up pencils on otherwise
+clear desks.
+%
+Real programmers don't bring brown-bag lunches. If the vending machine
+doesn't sell it, they don't eat it. Vending machines don't sell
+quiche.
+%
+Real programmers don't document; if it was
+hard to write, it should be hard to understand.
+%
+Real programmers don't draw flowcharts. Flowcharts are, after all, the
+illiterate's form of documentation. Cavemen drew flowcharts; look how much
+good it did them.
+%
+Real Programmers don't play tennis, or any other sport that requires
+you to change clothes. Mountain climbing is OK, and real programmers
+wear their climbing boots to work in case a mountain should suddenly
+spring up in the middle of the machine room.
+%
+Real programmers don't write in BASIC. Actually, no programmers write
+in BASIC after reaching puberty.
+%
+Real programmers don't write in FORTRAN. FORTRAN is for pipe stress
+freaks and crystallography weenies. FORTRAN is for wimp engineers who
+wear white socks.
+%
+Real Programmers don't write in PL/I. PL/I is for
+programmers who can't decide whether to write in COBOL or FORTRAN.
+%
+Real Programmers think better when playing Adventure or Rogue.
+%
+Real programs don't eat cache.
+%
+Real Programs don't use shared text. Otherwise, how can they
+use functions for scratch space after they are finished calling them?
+%
+Real software engineers don't debug programs, they verify correctness.
+This process doesn't necessarily involve execution of anything on a
+computer, except perhaps a Correctness Verification Aid package.
+%
+Real software engineers don't like the idea of some inexplicable and
+greasy hardware several aisles away that may stop working at any
+moment. They have a great distrust of hardware people, and wish that
+systems could be virtual at *_a_l_l* levels. They would like personal
+computers (you know no one's going to trip over something and kill your
+DFA in mid-transit), except that they need 8 megabytes to run their
+Correctness Verification Aid packages.
+%
+Real software engineers work from 9 to 5, because that is the way the
+job is described in the formal spec. Working late would feel like
+using an undocumented external procedure.
+%
+Real Time, adj.:
+ Here and now, as opposed to fake time, which only occurs there
+ and then.
+%
+Real Users are afraid they'll break the machine -- but they're never
+afraid to break your face.
+%
+Real Users find the one combination of bizarre input values that shuts
+down the system for days.
+%
+Real Users hate Real Programmers.
+%
+Real Users know your home telephone number.
+%
+Real Users never know what they want, but they always know when your
+program doesn't deliver it.
+%
+Real Users never use the Help key.
+%
+Real wealth can only increase.
+ -- R. Buckminster Fuller
+%
+Real World, The n.:
+ 1. In programming, those institutions at which programming may
+be used in the same sentence as FORTRAN, COBOL, RPG, IBM, etc. 2. To
+programmers, the location of non-programmers and activities not related
+to programming. 3. A universe in which the standard dress is shirt and
+tie and in which a person's working hours are defined as 9 to 5.
+4. The location of the status quo. 5. Anywhere outside a university.
+"Poor fellow, he's left MIT and gone into the real world." Used
+pejoratively by those not in residence there. In conversation, talking
+of someone who has entered the real world is not unlike talking about a
+deceased person.
+%
+Reality -- what a concept!
+ -- Robin Williams
+%
+Reality always seems harsher in the early morning.
+%
+Reality does not exist - yet.
+%
+Reality is an obstacle to hallucination.
+%
+Reality is bad enough, why should I tell the truth?
+ -- Patrick Sky
+%
+Reality is for people who can't deal with drugs.
+ -- Lily Tomlin
+%
+Reality is for people who lack imagination.
+%
+Reality is just a convenient measure of complexity.
+ -- Alvy Ray Smith
+%
+Reality is just a crutch for people who can't handle science fiction.
+%
+Reality is nothing but a collective hunch.
+ -- Lily Tomlin
+%
+Reality is that which, when you stop believing in it, doesn't go
+away.
+ -- Philip K. Dick
+%
+Reality must take precedence over public relations, for Mother Nature
+cannot be fooled.
+ -- R. P. Feynman
+%
+Really?? What a coincidence, I'm shallow too!!
+%
+Reappraisal, n.:
+ An abrupt change of mind after being found out.
+%
+Rebellion lay in his way, and he found it.
+ -- William Shakespeare, "Henry IV"
+%
+Receiving a million dollars tax free will make you feel better than
+being flat broke and having a stomach ache.
+ -- Dolph Sharp, "I'm O.K., You're Not So Hot"
+%
+Recent investments will yield a slight profit.
+%
+Recent research has tended to show that the Abominable No-Man
+is being replaced by the Prohibitive Procrastinator.
+ -- C. N. Parkinson
+%
+Recently deceased blues guitarist Stevie Ray Vaughan "comes to" after
+his death. He sees Jimi Hendrix sitting next to him, tuning his guitar.
+"Holy cow," he thinks to himself, "this guy is my idol." Over at the
+microphone, about to sing, are Jim Morrison and Janis Joplin, and the
+bassist is the late Barry Oakley of the Allman Brothers. So Stevie
+Ray's thinking, "Oh, wow! I've died and gone to rock and roll heaven."
+Just then, Karen Carpenter walks in, sits down at the drums, and says:
+"'Close to You'. Hit it, boys!"
+ -- Told by Penn Jillette, of magic/comedy duo Penn and Teller
+%
+Reception area, n.:
+ The purgatory where office visitors are condemned to spend
+ innumerable hours reading dog-eared back issues of trade
+ magazines like Modern Plastics, Chain Saw Age, and Chicken World,
+ while the receptionist blithely reads her own trade magazine --
+ Cosmopolitan.
+%
+Recession is when your neighbor loses his job. Depression is when you
+lose your job. These economic downturns are very difficult to predict,
+but sophisticated econometric modeling houses like Data Resources and
+Chase Econometrics have successfully predicted 14 of the last 3 recessions.
+%
+Recipe for a Pan Galactic Gargle Blaster:
+ (1) Take the juice from one bottle of Ol' Janx Spirit
+ (2) Pour into it one measure of water from the seas of
+ Santraginus V (Oh, those Santraginean fish!)
+ (3) Allow 3 cubes of Arcturan Mega-gin to melt into the
+ mixture (properly iced or the benzine is lost.)
+ (4) Allow four liters of Fallian marsh gas to bubble through it.
+ (5) Over the back of a silver spoon, float a measure of
+ Qualactin Hypermint extract.
+ (6) Drop in the tooth of an Algolian Suntiger. Watch it dissolve.
+ (7) Sprinkle Zamphuor.
+ (8) Add an olive.
+ (9) Drink... but... very carefully...
+ -- Douglas Adams
+%
+Reclaimer, spare that tree!
+Take not a single bit!
+It used to point to me,
+Now I'm protecting it.
+It was the reader's CONS
+That made it, paired by dot;
+Now, GC, for the nonce,
+Thou shalt reclaim it not.
+%
+Recursion is the root of computation
+since it trades description for time.
+%
+Recursion: n. See Recursion.
+ -- Random Shack Data Processing Dictionary
+%
+Regardless of whether a mission expands or contracts,
+administrative overhead continues to grow at a steady rate.
+%
+Regnant populi.
+%
+Regression analysis:
+ Mathematical techniques for trying to understand why things are
+ getting worse.
+%
+Reichel's Law:
+ A body on vacation tends to remain on vacation unless acted upon by
+ an outside force.
+%
+Reinhart was never his mother's favorite -- and he was an only child.
+ -- Thomas Berger
+%
+Reisner's Rule of Conceptual Inertia:
+ If you think big enough, you'll never have to do it.
+%
+Relations are simply a tedious pack of people, who haven't the remotest
+knowledge of how to live, nor the smallest instinct about when to die.
+ -- Oscar Wilde, "The Importance of Being Earnest"
+%
+...relaxed in the manner of a man who
+has no need to put up a front of any kind.
+ -- John Ball, "Mark One: the Dummy"
+%
+Reliable source, n.:
+ The guy you just met.
+%
+Religion has done love a great service by making it a sin.
+ -- Anatole France
+%
+Religion is a crutch, but that's okay... humanity is a cripple.
+%
+Religion is what keeps the poor from murdering the rich.
+ -- Napoleon
+%
+Religions revolve madly around sexual questions.
+%
+Rembrandt is not to be compared in the painting of character with our
+extraordinarily gifted English artist, Mr. Rippingille.
+ -- John Hunt, British editor, scholar and art critic
+ Cerf/Navasky, "The Experts Speak"
+%
+Rembrandt's first name was Beauregard, which is why he never used
+it.
+ -- Dave Barry
+%
+Remember -- only 10% of anything can be in the top 10%.
+%
+Remember Darwin; building a better
+mousetrap merely results in smarter mice.
+%
+Remember, DESSERT is spelled with two `s's while DESERT is spelled
+with one, because EVERYONE wants two desserts, but NO ONE wants two
+deserts.
+ -- Miss Oglethorp, Gr. 5, PS. 59
+%
+Remember, drive defensively! And of course, the best defense is a good
+offense!
+%
+Remember, even if you win the rat race -- you're still a rat.
+%
+Remember folks. Street lights timed for 35 MPH are also timed for 70 MPH.
+ -- Jim Samuels
+%
+Remember, God could only create the world in 6 days because he didn't
+have an established user base.
+%
+Remember, Grasshopper, falling down 1000 stairs begins by tripping over
+the first one.
+ -- Confusion
+%
+Remember, if it's being done correctly, here or abroad, it's
+*not* the U.S. Army doing it!
+ -- "Good Morning, Vietnam"
+%
+Remember kids, if there's a loaded gun in the room, be sure
+that you're the one holding it.
+ -- Mr. Greenfatigues
+%
+Remember, no matter where you go, there you are.
+ -- Buckaroo Banzai (Peter Weller)
+ "The Adventures of Buckaroo Banzai
+ Across The Eighth Dimension"
+%
+Remember: Silly is a state of Mind, Stupid is a way of Life.
+ -- Dave Butler
+%
+Remember that as a teenager you are in the last stage of your life when
+you will be happy to hear that the phone is for you.
+ -- Fran Lebowitz, "Social Studies"
+%
+Remember that there is an outside world to see and enjoy.
+ -- Hans Liepmann
+%
+Remember that whatever misfortune may be your lot, it could only be
+worse in Cleveland.
+ -- National Lampoon, "Deteriorata"
+%
+Remember the good old days, when CPU was singular?
+%
+Remember the... the... uhh.....
+%
+Remember thee
+Ay, thou poor ghost while memory holds a seat
+In this distracted globe. Remember thee!
+Yea, from the table of my memory
+I'll wipe away all trivial fond records,
+All saws of books, all forms, all pressures past,
+That youth and observation copied there.
+ -- William Shakespeare, "Hamlet"
+%
+Remember to say hello to your bank teller.
+%
+Remember, UNIX spelled backwards is XINU.
+ -- Mt.
+%
+Remember: use logout to logout.
+%
+Remembering is for those who have forgotten.
+ -- Chinese proverb
+%
+Remove me from this land of slaves,
+Where all are fools, and all are knaves,
+Where every knave and fool is bought,
+Yet kindly sells himself for nought;
+ -- Jonathan Swift
+%
+Removing the straw that broke the camel's back
+does not necessarily allow the camel to walk again.
+%
+Renning's Maxim:
+ Man is the highest animal. Man does the classifying.
+%
+Repartee is something we think of twenty-four hours too late.
+ -- Mark Twain
+%
+Repel them. Repel them. Induce them to relinquish the spheroid.
+ -- Indiana University football cheer
+%
+Reply hazy, ask again later.
+%
+Reporter: "How did you like school when you were growing up, Yogi?"
+Yogi Berra: "Closed."
+%
+Reporter: "What would you do if you found a million dollars?"
+Yogi Berra: "If the guy was poor, I would give it back."
+%
+Reporter, n.:
+ A writer who guesses his way to the truth and dispels it with a
+ tempest of words.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+REPORTER: Senator, are you for or against the MX missile system?
+
+SENATOR: Bob, the MX missile system reminds me of an old saying that
+the country folk in my state like to say. It goes like this: "You can
+carry a pig for six miles, but if you set it down it might run away."
+I have no idea why the country folk say this. Maybe there's some kind
+of chemical pollutant in their drinking water. That is why I pledge to
+do all that I can to protect the environment of this great nation of
+ours, and put prayer back in the schools, where it belongs. What we
+need is jobs, not empty promises. I realize I'm risking my political
+career by being so outspoken on a sensitive issue such as the MX, but
+that's just the kind of straight-talking honest person I am, and I
+can't help it.
+ -- Dave Barry, "On Presidential Politics"
+%
+Reporter (to Mahatma Gandhi):
+ Mr. Gandhi, what do you think of Western Civilization?
+Gandhi: I think it would be a good idea.
+%
+Reputation, adj.:
+ What others are not thinking about you.
+%
+Research is the best place to be: you work your buns off, and if it works
+you're a hero; if it doesn't, well -- nobody else has done it yet either,
+so you're still a valiant nerd.
+%
+Research is to see what everybody else has seen,
+and think what nobody else has thought.
+%
+Research is what I'm doing when I don't know what I'm doing.
+ -- Wernher von Braun
+%
+Research, n.:
+ Consider Columbus:
+ He didn't know where he was going.
+ When he got there he didn't know where he was.
+ When he got back he didn't know where he had been.
+ And he did it all on someone else's money.
+%
+Resisting temptation is easier when you
+think you'll probably get another chance later on.
+%
+Responsibility:
+ Everyone says that having power is a great responsibility. This is
+a lot of bunk. Responsibility is when someone can blame you if something
+goes wrong. When you have power you are surrounded by people whose job it
+is to take the blame for your mistakes. If they're smart, that is.
+ -- Cerebus, "On Governing"
+%
+Retirement means that when someone says "Have a nice day", you
+actually have a shot at it.
+%
+Reunite Gondwanaland!
+%
+Rev. Jim: What does an amber light mean?
+Bobby: Slow down.
+Rev. Jim: What... does... an... amber... light... mean?
+Bobby: Slow down.
+Rev. Jim: What.... does.... an.... amber.... light....
+%
+Revenge is a form of nostalgia.
+%
+Revenge is a meal best served cold.
+%
+Review Questions
+
+1: If Nerd on the planet Nutley starts out in his spaceship at 20 KPH,
+ and his speed doubles every 3.2 seconds, how long will it be before
+ he exceeds the speed of light? How long will it be before the
+ Galactic Patrol picks up the pieces of his spaceship?
+
+2: If Roger Rowdy wrecks his car every week, and each week he breaks
+ twice as many bones as before, how long will it be before he breaks
+ every bone in his body? How long will it be before they cut off
+ his insurance? Where does he get a new car every week?
+
+3: If Johnson drinks one beer the first hour (slow start), four beers
+ the next hour, nine beers the next, etc., and stacks the cans in
+ a pyramid, how soon will Johnson's pyramid be larger than King
+ Tut's? When will it fall on him? Will he notice?
+%
+Revolution, n.:
+ A form of government abroad.
+%
+Revolution, n.:
+ In politics, an abrupt change in the form of misgovernment.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Revolutionary, adj.:
+ Repackaged.
+%
+Rhode's Law:
+ When any principle, law, tenet, probability, happening, circumstance,
+ or result can in no way be directly, indirectly, empirically, or
+ circuitously proven, derived, implied, inferred, induced, deducted,
+ estimated, or scientifically guessed, it will always for the purpose
+ of convenience, expediency, political advantage, material gain, or
+ personal comfort, or any combination of the above, or none of the
+ above, be unilaterally and unequivocally assumed, proclaimed, and
+ adhered to as absolute truth to be undeniably, universally, immutably,
+ and infinitely so, until such time as it becomes advantageous to
+ assume otherwise, maybe.
+%
+Rich bachelors should be heavily taxed. It is not fair that some men
+should be happier than others.
+ -- Oscar Wilde
+%
+Richard Nixon was the most dishonest individual I have ever met in my life.
+He lied to his wife, his family, his friends, his colleagues in the Congress,
+lifetime members of his own political party, the American people, and the
+world.
+ -- Barry Goldwater
+%
+Riches cover a multitude of woes.
+ -- Menander
+%
+Rick: "How can you close me up? On what grounds?"
+Renault: "I'm shocked! Shocked! To find that gambling is
+ going on here."
+Croupier (handing money to Renault):
+ "Your winnings, sir."
+Renault: "Oh. Thank you very much."
+ -- "Casablanca" (1942)
+%
+Riffle West Virginia is so small that the
+Boy Scout had to double as the town drunk.
+%
+Right now I'm having amnesia and deja vu at the same time.
+ -- Steven Wright
+%
+"Rights" is a fictional abstraction. No one has "Rights", neither
+machines nor flesh-and-blood. Persons... have opportunities, not
+rights, which they use or do not use.
+ -- Lazarus Long
+%
+Ring around the collar.
+%
+Ritchie's Rule:
+ (1) Everything has some value -- if you use the right currency.
+ (2) Paint splashes last longer than the paint job.
+ (3) Search and ye shall find -- but make sure it was lost.
+%
+Robot, n.:
+ Someone who's been made by a scientist.
+%
+Robot, n.:
+ University administrator.
+%
+Robustness, adj.:
+ Never having to say you're sorry.
+%
+Rocky's Lemma of Innovation Prevention
+ Unless the results are known in advance,
+ funding agencies will reject the proposal.
+%
+Romance, like alcohol, should be enjoyed, but should not be allowed to
+become necessary.
+ -- Edgar Friedenberg
+%
+Rome was not built in one day.
+ -- John Heywood
+%
+Rome wasn't burnt in a day.
+%
+ROMEO: Courage, man; the hurt cannot be much.
+MERCUTIO: No, 'tis not so deep as a well, nor so wide as a church-
+ door; but 'tis enough, 'twill serve.
+%
+Romeo was restless, he was ready to kill,
+He jumped out the window 'cause he couldn't sit still,
+Juliet was waiting with a safety net,
+Said "don't bury me 'cause I ain't dead yet".
+ -- Elvis Costello
+%
+Romeo wasn't bilked in a day.
+ -- Walt Kelly, "Ten Ever-Lovin' Blue-Eyed Years With
+ Pogo"
+%
+Roses are red;
+ Violets are blue.
+I'm schizophrenic,
+ And so am I.
+%
+Rotten wood cannot be carved.
+ -- Confucius, "Analects", Book 5, Ch. 9
+%
+Round Numbers are always false.
+ -- Samuel Johnson
+%
+Row, row, row your bits, gently down the stream...
+%
+Rubber bands have snappy endings!
+%
+Rube Walker: "Hey, Yogi, what time is it?"
+Yogi Berra: "You mean now?"
+%
+Rudd's Discovery:
+ You know that any senator or congressman could go home and make
+ $300,000 to $400,000, but they don't. Why? Because they can
+ stay in Washington and make it there.
+%
+Rudeness is a weak man's imitation of strength.
+%
+Rudin's Law:
+ If there is a wrong way to do something, most people will
+ do it every time.
+
+Rudin's Second Law:
+ In a crisis that forces a choice to be made among alternative
+ courses of action, people tend to choose the worst possible
+ course.
+%
+Rugby, n.:
+ Elegant violence.
+
+ (Rugby players eat their dead.)
+ (Blood makes the grass grow!)
+ (Support your local hooker! Play rugby!)
+
+ [A "hooker" is part of the scrum. Thought you'd want to know. Ed.]
+%
+RUGGED:
+ Too heavy to lift.
+%
+Rule #1:
+ The Boss is always right.
+
+Rule #2:
+ If the Boss is wrong, see Rule #1.
+%
+Rule 46, Oxford Union Society, London:
+ Any member introducing a dog into the Society's premises shall
+be liable to a fine of one pound. Any animal leading a blind person
+shall be deemed to be a cat.
+%
+Rule #7: Silence is not acquiescence.
+ Contrary to what you may have heard, silence of those present is
+not necessarily consent, even the reluctant variety. They simply may
+sit in stunned silence and figure ways of sabotaging the plan after they
+regain their composure.
+%
+Rule of Creative Research:
+ 1) Never draw what you can copy.
+ 2) Never copy what you can trace.
+ 3) Never trace what you can cut out and paste down.
+%
+Rule of Defactualization:
+ Information deteriorates upward through bureaucracies.
+%
+Rule of Feline Frustration:
+ When your cat has fallen asleep on your lap and looks utterly
+ content and adorable, you will suddenly have to go to the
+ bathroom.
+%
+Rule of Life #1 -- Never get separated from your luggage.
+%
+Rule of the Great:
+ When people you greatly admire appear to be thinking deep
+ thoughts, they probably are thinking about lunch.
+%
+Rule the Empire through force.
+ -- Shogun Tokugawa
+%
+Rules:
+ (1) The boss is always right.
+ (2) When the boss is wrong, refer to rule 1.
+%
+Rules for Academic Deans:
+ (1) HIDE!!!!
+ (2) If they find you, LIE!!!!
+ -- Father Damian C. Fandal
+%
+Rules for driving in New York:
+ 1) Anything done while honking your horn is legal.
+ 2) You may park anywhere if you turn your four-way flashers on.
+ 3) A red light means the next six cars may go through the
+ intersection.
+%
+Rules for Good Grammar #4.
+ 1: Don't use no double negatives.
+ 2: Make each pronoun agree with their antecedents.
+ 3: Join clauses good, like a conjunction should.
+ 4: About them sentence fragments.
+ 5: When dangling, watch your participles.
+ 6: Verbs has got to agree with their subjects.
+ 7: Just between you and i, case is important.
+ 8: Don't write run-on sentences when they are hard to read.
+ 9: Don't use commas, which aren't necessary.
+10: Try to not ever split infinitives.
+11: It is important to use your apostrophe's correctly.
+12: Proofread your writing to see if you any words out.
+13: Correct speling is essential.
+14: A preposition is something you never end a sentence with.
+15: While a transcendent vocabulary is laudable, one must be eternally
+ careful so that the calculated objective of communication does not
+ become ensconced in obscurity. In other words, eschew obfuscation.
+%
+Rules for Writers:
+ Avoid run-on sentences they are hard to read. Don't use no double
+negatives. Use the semicolon properly, always use it where it is appropriate;
+and never where it isn't. Reserve the apostrophe for it's proper use and
+omit it when its not needed. No sentence fragments. Avoid commas, that are
+unnecessary. Eschew dialect, irregardless. And don't start a sentence with
+a conjunction. Hyphenate between sy-llables and avoid un-necessary hyphens.
+Write all adverbial forms correct. Don't use contractions in formal writing.
+Writing carefully, dangling participles must be avoided. It is incumbent on
+us to avoid archaisms. Steer clear of incorrect forms of verbs that have
+snuck in the language. Never, ever use repetitive redundancies. If I've
+told you once, I've told you a thousand times, resist hyperbole. Also,
+avoid awkward or affected alliteration. Don't string too many prepositional
+phrases together unless you are walking through the valley of the shadow of
+death. "Avoid overuse of 'quotation "marks."'"
+%
+RULES OF EATING -- THE BRONX DIETER'S CREED
+ (1) Never eat on an empty stomach.
+ (2) Never leave the table hungry.
+ (3) When traveling, never leave a country hungry.
+ (4) Enjoy your food.
+ (5) Enjoy your companion's food.
+ (6) Really taste your food. It may take several portions to
+ accomplish this, especially if subtly seasoned.
+ (7) Really feel your food. Texture is important. Compare,
+ for example, the texture of a turnip to that of a
+ brownie. Which feels better against your cheeks?
+ (8) Never eat between snacks, unless it's a meal.
+ (9) Don't feel you must finish everything on your plate. You
+ can always eat it later.
+ (10) Avoid any wine with a childproof cap.
+ (11) Avoid blue food.
+ -- Richard Smith, "The Bronx Diet"
+%
+Ruling a big country is like cooking a small fish.
+ -- Lao Tsu
+%
+Rune's Rule:
+ If you don't care where you are, you ain't lost.
+%
+Russia has abolished God, but so far God has been more tolerant.
+ -- John Cameron Swayze
+%
+Ruth made a great mistake when he gave up pitching. Working once a week,
+he might have lasted a long time and become a great star.
+ -- Tris Speaker, commenting on Babe Ruth's plan to change
+ from being a pitcher to an outfielder.
+ Cerf/Navasky, "The Experts Speak"
+%
+Ryan's Law:
+ Make three correct guesses consecutively
+ and you will establish yourself as an expert.
+%
+RYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRY
+RY RY
+RY WELCOME TO THE BABBAGE ANALYTICAL TIMESHARING SERVICE RY
+RY * * * * * * * * * * * * * * * * * * * * * * * * * * * RY
+RY RY
+RY PLEASE NOTE THAT THE INTEGRATOR IS CURRENTLY UNAVAILABLE RY
+RY DUE TO THE WEEKLY GREASING SCHEDULE. WOULD ALL USERS KINDLY RY
+RY RETURN ANY UNUSED PLUGBOARDS, AS THE PROGRAMMING TEAM ARE RY
+RY RUNNING LOW. DIVISION UNIT 3 WILL BE OUT OF ACTION UNTIL RY
+RY THURSDAY DUE TO EMERGENCY COG REPLACEMENT - PLEASE ENSURE RY
+RY THAT YOUR PROGRAM DOES NOT ATTEMPT TO DIVIDE BY ZERO AS RY
+RY THIS CAN CAUSE SEVERE DAMAGE (INCLUDING SHAFT BREAKAGES). RY
+RY RY
+RYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRY
+.
+.
+SYSTEM READY.
+?
+ -- Chris Suslowicz
+%
+Sacher's Observation:
+ Some people grow with responsibility -- others merely swell.
+%
+Sacred cows make great hamburgers.
+%
+SADISM:
+ A sadist refusing to whip a masochist.
+%
+Sadoequinecrophilia, n.:
+ Beating a dead horse.
+%
+Safety Third.
+%
+Safety Tips for the Post-Nuclear Existence
+ Tip #1: How to tell when you are dead.
+
+ 1. Little things start bothering you: little things like worms,
+ bugs, ants.
+ 2. Something is missing in your personal relationships.
+ 3. Your dog becomes overly affectionate.
+ 4. You have a hard time getting a waiter.
+ 5. Exotic birds flock around you.
+ 6. People ignore you at parties.
+ 7. You have a hard time getting up in the morning.
+ 8. You no longer get off on cocaine.
+%
+SAGDEEV CALLED ON THE U.S. TO MAKE A RECIPROCAL GESTURE:
+
+ In a recent speech in London, the irrepressible former head of the
+Soviet Space Research Institute noted that the Soviet Government has offered
+to convert its gigantic Krasnoyarsk radar in Siberia into an international
+space research facility in response to U.S. complaints that the radar would
+violate the ABM treaty. Sagdeev suggested that the U.S. reciprocate by
+turning the unfinished U.S. embassy in Moscow into a nuclear crisis reduction
+center. The communication system, he pointed out, is already in place.
+%
+SAGITTARIUS (Nov 22 - Dec 21)
+ You are optimistic and enthusiastic. You have a reckless
+ tendency to rely on luck since you lack talent. The majority
+ of Sagittarians are drunks or dope fiends or both. People
+ laugh at you a great deal.
+%
+SAGITTARIUS (Nov. 22 to Dec. 21)
+ Move slowly today, be deliberate. Indications are for bleeding
+ ulcers. Drink milk. Try not to be your usual offensive and
+ obnoxious self. Call your mother.
+%
+SAGITTARIUS (Nov.22 - Dec.21)
+ Your efforts to help a little old lady cross a street will
+ backfire when you learn that she was waiting for a bus. Subdue
+ impulse you have to push her out into traffic.
+%
+Said the attractive, cigar-smoking housewife to her girl-friend: "I
+got started one night when George came home and found one burning in
+the ashtray."
+%
+Sailing is fun, but scrubbing the decks is aardvark.
+ -- Heard on Noah's ark
+%
+Sailors in ships, sail on!
+Even while we died, others rode out the storm.
+%
+Saints should always be judged guilty until they are proved innocent.
+ -- George Orwell, "Reflections on Gandhi"
+%
+Saliva causes cancer, but only if swallowed
+in small amounts over a long period of time.
+ -- George Carlin
+%
+Sally: C'mon, Ted, all I'm asking you to do is share your feelings
+ with me.
+Ted: ALL? Do you realize what you're asking? Men aren't trained
+ to share. We're trained to protect ourselves by not
+ letting anyone too close. Good grief, if I go around
+ sharing everything with you, you could hang me out to dry.
+Sally: It's called "trust," Ted.
+Ted: "Sharing"? "Trust"? You're really asking me to sail into
+ uncharted waters here.
+ -- Sally Forth
+%
+Sam: What's going on, Normie?
+Norm: My birthday, Sammy. Give me a beer, stick a candle in
+ it, and I'll blow out my liver.
+ -- Cheers, Where Have All the Floorboards Gone
+
+Woody: Hey, Mr. P. How goes the search for Mr. Clavin?
+Norm: Not as well as the search for Mr. Donut.
+ Found him every couple of blocks.
+ -- Cheers, Head Over Hill
+%
+Sam: What do you know there, Norm?
+Norm: How to sit. How to drink. Want to quiz me?
+ -- Cheers, Loverboyd
+
+Sam: Hey, how's life treating you there, Norm?
+Norm: Beats me. ... Then it kicks me and leaves me for dead.
+ -- Cheers, Loverboyd
+
+Woody: How would a beer feel, Mr. Peterson?
+Norm: Pretty nervous if I was in the room.
+ -- Cheers, Loverboyd
+%
+Sam: What's the good word, Norm?
+Norm: Plop, plop, fizz, fizz.
+Sam: Oh no, not the Hungry Heifer...
+Norm: Yeah, yeah, yeah...
+Sam: One heartburn cocktail coming up.
+ -- Cheers, I'll Gladly Pay You Tuesday
+
+Sam: Whaddya say, Norm?
+Norm: Well, I never met a beer I didn't drink. And down it goes.
+ -- Cheers, Love Thy Neighbor
+
+Woody: What's your pleasure, Mr. Peterson?
+Norm: Boxer shorts and loose shoes. But I'll settle for a beer.
+ -- Cheers, The Bar Stoolie
+%
+Sam: What do you say, Norm?
+Norm: Any cheap, tawdry thing that'll get me a beer.
+ -- Cheers, Birth, Death, Love and Rice
+
+Sam: What do you say to a beer, Normie?
+Norm: Hiya, sailor. New in town?
+ -- Cheers, Woody Goes Belly Up
+
+Norm: [coming in from the rain] Evening, everybody.
+All: Norm! (Norman.)
+Sam: Still pouring, Norm?
+Norm: That's funny, I was about to ask you the same thing.
+ -- Cheers, Diane's Nightmare
+%
+Sam: What's new, Norm?
+Norm: Most of my wife.
+ -- Cheers, The Spy Who Came in for a Cold One
+
+Coach: Beer, Norm?
+Norm: Naah, I'd probably just drink it.
+ -- Cheers, Now Pitching, Sam Malone
+
+Coach: What's doing, Norm?
+Norm: Well, science is seeking a cure for thirst. I happen
+ to be the guinea pig.
+ -- Cheers, Let Me Count the Ways
+%
+SAN DIEGO:
+ Four million people, where you can't get a
+ good cheeseburger, no matter how hard you try.
+%
+San Francisco has always been my favorite booing city. I don't mean the
+people boo louder or longer, but there is a very special intimacy. When
+they boo you, you know they mean *you*. Music, that's what it is to me.
+One time in Kezar Stadium they gave me a standing boo.
+ -- George Halas, professional football coach
+%
+San Francisco isn't what it used to be, and it never was.
+ -- Herb Caen
+%
+San Francisco, n.:
+ Marcel Proust editing an issue of Penthouse.
+%
+Sanity and insanity overlap a fine grey line.
+%
+Sanity is the trademark of a weak mind.
+ -- Mark Harrold
+%
+Sank heaven for leetle curls.
+%
+Santa Claus is watching!
+%
+Santa Claus wears a red suit
+He's a Communist.
+
+He has long hair and a beard
+Must be a pacifist.
+
+And what's in the pipe that he's smoking?
+
+Santa Claus comes in your house at night.
+He must be a dope fiend to get you up tight.
+
+Why do police guys beat on peace guys?
+ -- Arlo Guthrie, "The Pause of Mr. Claus"
+%
+Santa's elves are just a bunch of subordinate Clauses.
+%
+Satellite Safety Tip #14:
+ If you see a bright streak in the sky coming at you, duck.
+%
+Satire does not look pretty upon a tombstone.
+%
+Satire is tragedy plus time.
+ -- Lenny Bruce
+%
+Satire is what closes in New Haven.
+%
+Satire is what closes Saturday night.
+ -- George Kaufman
+%
+Sattinger's Law:
+ It works better if you plug it in.
+%
+Saturday night in Toledo Ohio,
+Is like being nowhere at all,
+All through the day how the hours rush by,
+You sit in the park and you watch the grass die.
+ -- John Denver, "Saturday Night in Toledo Ohio"
+%
+Satyrs have more faun.
+%
+Sauron is alive in Argentina!
+%
+Savage's Law of Expediency:
+ You want it bad, you'll get it bad.
+%
+Save a little money each month and at the end of the year you'll be
+surprised at how little you have.
+ -- Ernest Haskins
+%
+Save a tree -- kill an ISO working group today.
+ -- Jason Zions
+%
+Save energy: Drive a smaller shell.
+%
+Save energy: be apathetic.
+%
+Save gas, don't eat beans.
+%
+Save gas, don't use the shell.
+%
+Save the bales!
+%
+Save the whales. Collect the whole set.
+%
+Save the Whales -- Harpoon a Honda.
+%
+Save yourself! Reboot in 5 seconds!
+%
+Say! You've struck a heap of trouble--
+Bust in business, lost your wife;
+No one cares a cent about you,
+You don't care a cent for life;
+Hard luck has of hope bereft you,
+Health is failing, wish you'd die--
+Why, you've still the sunshine left you
+And the big blue sky.
+ -- R. W. Service
+%
+Say it with flowers,
+Or say it with mink,
+But whatever you do,
+Don't say it with ink!
+ -- Jimmie Durante
+%
+Say many of cameras focused t'us,
+Our middle-aged shots do us justice.
+No justice, please, curse ye!
+We really want mercy:
+You see, 'tis the justice, disgusts us.
+ -- Thomas H. Hildebrandt
+%
+Say my love is easy had,
+Say I'm bitten raw with pride,
+Say I am too often sad --
+Still behold me at your side.
+
+Say I'm neither brave nor young,
+Say I woo and coddle care,
+Say the devil touched my tongue,
+Still you have my heart to wear.
+
+But say my verses do not scan,
+And I get me another man!
+ -- Dorothy Parker, "Fighting Words"
+%
+Say no, then negotiate.
+ -- Helga
+%
+Say something you'll be sorry for, I love receiving apologies.
+%
+Say "twenty-three-skiddoo" to logout.
+%
+SCCS, the source motel! Programs check in and never check out!
+ -- Ken Thompson
+%
+SCENARIO:
+ An imagined sequence of events that provides the context in
+ which a business decision is made. Scenarios always come in
+ sets of three: best case, worst case, and just in case.
+%
+Scenary is here, wish you were beautiful.
+%
+Scene:
+ A small boy stands agasp on the stairway overlooking the living
+room. A rather largish man in a big red suit with white fur and red and
+white belled cap hunches over the fireplace, obviously interrupted in
+filling stockings with packages taken from a huge bag slung over his
+shoulder. His eyebrows are raised, matter-of-factly, as he spies the boy
+intently watching him.
+
+Caption:
+ I'm sorry you've seen me, Billy. Now I'll have to kill you.
+%
+Schapiro's Explanation:
+ The grass is always greener on the other side --
+ but that's because they use more manure.
+%
+Schizophrenia beats being alone.
+%
+Schlattwhapper, n.:
+ The window shade that allows itself to be pulled down,
+ hesitates for a second, then snaps up in your face.
+ -- Rich Hall, "Sniglets"
+%
+Schmidt's Observation:
+ All things being equal, a fat person uses more soap
+ than a thin person.
+%
+Schwiggle, n.:
+ The amusing rotation of one's bottom while sharpening a
+ pencil.
+ -- Rich Hall, "Sniglets"
+%
+Science and religion are in full accord but
+science and faith are in complete discord.
+%
+Science Fiction, Double Feature.
+Frank has built and lost his creature.
+Darkness has conquered Brad and Janet.
+The servants gone to a distant planet.
+Wo, oh, oh, oh.
+At the late night, double feature, Picture show.
+I want to go, oh, oh, oh.
+To the late night, double feature, Picture show.
+ -- Rocky Horror Picture Show
+%
+Science is built up of facts, as a house is with stones. But a
+collection of facts is no more a science than a heap of stones
+is a house.
+ -- Jules Henri Poincar'e
+%
+Science is facts; just as houses are made of stones, so is science made
+of facts; but a pile of stones is not a house and a collection of facts
+is not necessarily science.
+ -- Jules Henri Poincar'e
+%
+Science is like sex: sometimes something useful comes
+out, but that is not the reason we are doing it
+ -- Richard Feynman
+%
+Science is to computer science as hydrodynamics is to plumbing.
+%
+Science is what happens when preconception meets verification.
+%
+Science may someday discover what faith has always known.
+%
+Science! true daughter of Old Time thou art!
+Who alterest all things with thy peering eyes.
+Why preyest thou thus upon the poet's heart,
+Vulture, whose wings are dull realities?
+How should he love thee? or how deem thee wise?
+Who wouldst not leave him in his wandering
+To seek for treasure in the jewelled skies,
+Albeit he soared with an undaunted wing?
+Hast thou not dragged Diana from her car?
+And driven the Hamadryad from the wood
+To seek a shelter in some happier star?
+Hast thou not torn the Naiad from her flood,
+The Elfin from the green grass, and from me
+The summer dream beneath the tamarind tree?
+ -- Edgar Allan Poe, "Science, a Sonnet"
+%
+Scientists are people who build the Brooklyn Bridge and then buy it.
+ -- William F. Buckley
+
+%
+Scientists still know less about what attracts men
+than they do about what attracts mosquitoes.
+ -- Dr. Joyce Brothers,
+ "What Every Woman Should Know About Men"
+%
+Scientists were preparing an experiment to ask the ultimate question.
+They had worked for months gathering one each of every computer that
+was built. Finally the big day was at hand. All the computers were
+linked together. They asked the question, "Is there a God?". Lights
+started blinking, flashing and blinking some more. Suddenly, there
+was a loud crash, and a bolt of lightning came down from the sky,
+struck the computers, and welded all the connections permanently
+together. "There is now", came the reply.
+%
+Scintillate, scintillate, globule vivific,
+Fain how I pause at your nature specific,
+Loftily poised in the ether capacious,
+Highly resembling a gem carbonaceous.
+Scintillate, scintillate, globule vivific,
+Fain how I pause at your nature specific.
+%
+Scintillation is not always identification for an auric substance.
+%
+SCORPIO (Oct 23 - Nov 21)
+ You are shrewd in business and cannot be trusted. You will achieve
+ the pinnacle of success because of your total lack of ethics. Most
+ Scorpio people are murdered.
+%
+SCORPIO (Oct. 23 to Nov. 21)
+ Friends abound today, seeking repayment of past loans. Smile. Check
+ for concealed weapons. Your natural cheerfulness makes others want
+ to throw up. Knock it off.
+%
+SCORPIO (Oct.24 - Nov.21)
+ You will receive word today that you are eligible to win a million
+ dollars in prizes. It will be from a magazine trying to get you to
+ subscribe, and you're just dumb enough to think you've got a chance
+ to win. You never learn.
+%
+Scott's first Law:
+ No matter what goes wrong, it will probably look right.
+%
+Scott's second Law:
+ When an error has been detected and corrected, it will be found
+to have been wrong in the first place.
+
+Corollary:
+ After the correction has been found in error, it will be
+impossible to fit the original quantity back into the equation.
+%
+Scotty: Captain, we din' can reference it!
+Kirk: Analysis, Mr. Spock?
+Spock: Captain, it doesn't appear in the symbol table.
+Kirk: Then it's of external origin?
+Spock: Affirmative.
+Kirk: Mr. Sulu, go to pass two.
+Sulu: Aye aye, sir, going to pass two.
+%
+Screw up your courage! You've screwed up everything else.
+%
+Scribline, n.:
+ The blank area on the back of credit cards where one's
+ signature goes.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Scrubbing floors and emptying bedpans has as much dignity as the
+Presidency.
+ -- Richard M. Nixon
+%
+'Scuse me, while I kiss the sky!
+ -- Robert James Marshall (Jimi) Hendrix
+%
+Sears has everything.
+%
+Seattle is so wet that people protect their property with watch-ducks.
+%
+Second Law of Business Meetings:
+ If there are two possible ways to spell a person's name, you
+ will pick the wrong one.
+
+Corollary:
+ If there is only one way to spell a name,
+ you will spell it wrong, anyway.
+%
+Second Law of Final Exams:
+ In your toughest final -- for the first time all year -- the most
+ distractingly attractive student in the class will sit next to you.
+%
+Secrecy is the beginning of tyranny.
+%
+Secretary's Revenge:
+ Filing almost everything under "the".
+%
+Section 2.4.3.5 AWNS (Acceptor Wait for New Cycle State).
+ In AWNS the AH function indicates that it has received a
+multiline message byte.
+ In AWNS the RFD message must be sent false and the DAC message
+must be sent passive true.
+ The AH function must exit the AWNS and enter:
+ (1) The ANRS if DAV is false
+ (2) The AIDS if the ATN message is false and neither:
+ (a) The LADS is active
+ (b) Nor LACS is active
+
+ -- from the IEEE Standard Digital Interface for
+ Programmable Instrumentation
+%
+Security check: INTRUDER ALERT!
+%
+Sed quis custodiet ipsos Custodes?
+[Who guards the Guardians?]
+%
+Seduced, shaggy Samson snored.
+She scissored short. Sorely shorn,
+Soon shackled slave, Samson sighed,
+Silently scheming,
+Sightlessly seeking
+Some savage, spectacular suicide.
+ -- Stanislaw Lem, "Cyberiad"
+%
+See - the thing is - I'm an absolutist. I mean, kind of ... in a way ...
+%
+See, these two penguins walked into a bar, which was really stupid, 'cause
+the second one should have seen it.
+%
+Seeing a commotion in Harvard Square, a man strolled over and asked what
+was going on. One of the onlookers explained to him that there was a Mooney
+who had immersed himself in gasoline and was threatening to set fire to
+himself to demonstrate his commitment to the Rev. Moon. The man gasped and
+asked what was being done to defuse the obviously dangerous situation.
+ "Well", replied the onlooker, "we're taking up a collection -- so
+far I've got two Bics, four Zippos and eighteen books of matches."
+%
+Seeing is believing.
+You wouldn't have seen it if you hadn't believed it.
+%
+Seeing is deceiving. It's eating that's believing.
+ -- James Thurber
+%
+Seeing that death, a necessary end,
+Will come when it will come.
+ -- William Shakespeare, "Julius Caesar"
+%
+Seek simplicity -- and distrust it.
+ -- Alfred North Whitehead
+%
+Seems a computer engineer, a systems analyst, and a programmer were
+driving down a mountain when the brakes gave out. They screamed down the
+mountain, gaining speed, but finally managed to grind to a halt, more by
+luck than anything else, just inches from a thousand foot drop to jagged
+rocks. They all got out of the car:
+ The computer engineer said, "I think I can fix it."
+ The systems analyst said, "No, no, I think we should take it
+into town and have a specialist look at it."
+ The programmer said, "OK, but first I think we should get back
+in and see if it does it again."
+%
+Seems like this duck waddles into a pharmacy, waddles up to the prescription
+counter and rings the bell. The pharmacist walks up and asks, "Can I help
+you?".
+ The duck replies, "Yes, I'd like a box of condoms, please."
+ "Certainly", says the pharmacist, "will that be cash or would
+you like me to put it on your bill?"
+ Snarls the duck, "Just what kind of duck do you think I am?"
+%
+Seems like this farmer purchased an old, run-down, abandoned farm with plans
+to turn it into a thriving enterprise. The fields are grown over with weeds,
+the farmhouse is falling apart, and the fences are collapsing all around.
+During his first day of work, the town preacher stops by to bless the man's
+work, praying, "May you and God work together to make this the farm of your
+dreams!"
+ A few months later, the preacher stops by again to call on the farmer.
+Lo and behold, it's like a completely different place -- the farm house is
+completely rebuilt and in excellent condition, there is plenty of cattle and
+other livestock happily munching on feed in well-fenced pens, and the fields
+are filled with crops planted in neat rows. "Amazing!" the preacher says.
+"Look what God and you have accomplished together!"
+ "Yes, reverend," replies the farmer, "but remember what the farm was
+like when God was working it alone!"
+%
+Seems like this guy wanders into a rural outfitting store in Alaska,
+and starts talking to a rather grizzled old man sitting by the cash
+register.
+ "Hear ya got a lotta' bears 'round here?"
+ "Yeah, you could say that," answers the old man.
+ "GRIZZLIES?!?!"
+ "A few."
+ "Got any bear bells?"
+ "What's that?"
+ "You know, them little dingle-bells ya put on yer backpack so
+bears know yer there so's they can run away ... I'll take one fer black
+bears, and one fer them grizzlies. Say, how do you know yer in grizzly
+country, anyhow?"
+ "Look fer scat. Grizzly scat's different from black bear scat."
+ "Well now, what's IN grizzly scat that's different?"
+ "Bear bells."
+%
+Seems that a pollster was taking a worldwide opinion poll.
+Her question was, "Excuse me; what's your opinion on the meat shortage?"
+
+In Texas, the answer was "What's a shortage?"
+In Poland, the answer was "What's meat?"
+In the Soviet Union, the answer was "What's an opinion?"
+In New York City, the answer was "What's excuse me?"
+%
+Seems this fellow was suffering from terrific headaches, and went to his
+doctor about it. The physician made a number of tests, and informed the man
+that the only thing for his headaches was castration. After a few more
+months, the headaches became so intense that the man agreed to the operation.
+Naturally enough, the ruination of his sex life depressed him tremendously,
+and he decided to purchase a new wardrobe to make himself feel better.
+He enters a men's clothing store and a salesman wanders over, looks him
+up and down, and says, "Well, let's start with shirts... 15 neck, 34 sleeve."
+ The guy is amazed. "How'd you know?"
+ "Well, I've been here nearly 30 years, and I can tell sizes within
+a quarter inch on every piece of clothing." The salesman's claim is borne
+out. Slacks, 34 waist, 32 inseam; jacket: 42 long. And so on and so forth.
+When the man has been completely outfitted he decides that he'd better buy
+some new underwear.
+ The salesman looks at him and says, "Okay, that'll be a 34."
+ "No, that's wrong," says the man. "I've always worn a 32." The
+salesman insists, pointing out his accuracy so far. The man argues, agreeing
+that while he's been right so far, he has always worn a 32 in shorts.
+ Finally in exasperation, the salesman says, "Listen, I tell you,
+you *have* to wear a 34. Otherwise, you'll get these *awful* headaches."
+%
+Seems this guy showed up at a party, and all of his friends jumped for
+Joy. But she sidestepped, and they missed.
+%
+Seize the day, put no trust in the morrow!
+ -- Quintus Horatius Flaccus (Horace)
+%
+Seleznick's Theory of Holistic Medicine:
+ Ice Cream cures all ills. Temporarily.
+%
+Self Test for Paranoia:
+ You know you have it when you can't think of anything that's
+ your own fault.
+%
+Seminars, n.:
+ From "semi" and "arse", hence, any half-assed discussion.
+%
+semper en excretus
+%
+SEMPER UBI SUB UBI!!!!
+%
+Senate, n.:
+ A body of elderly gentlemen charged with high duties and
+ misdemeanors.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Send some filthy mail.
+%
+Sendmail may be safely run set-user-id to root.
+ -- Eric Allman, "Sendmail Installation Guide"
+%
+SENILITY:
+ The state of mind of elderly persons
+ with whom one happens to disagree.
+%
+Senor Castro has been accused of communist sympathies, but this means very
+little since all opponents of the regime are automatically called communists.
+In fact he is further to the right than General Batista.
+ -- "Cuba's Rightist Rebel", The Economist, April 26, 1958
+%
+Sentient plasmoids are a gas.
+%
+Sentimentality -- that's what we call the sentiment we don't share.
+ -- Graham Greene
+%
+SERENDIPITY:
+ The process by which human knowledge is advanced.
+%
+Serenity through viciousness.
+%
+Serfs up!
+ -- Spartacus
+%
+Serocki's Stricture:
+ Marriage is always a bachelor's last option.
+%
+Serving coffee on an aircraft causes turbulence.
+%
+Set the cart before the horse.
+ -- John Heywood
+%
+Several years ago, an international chess tournament was being held in a
+swank hotel in New York. Most of the major stars of the chess world were
+there, and after a grueling day of chess, the players and their entourages
+retired to the lobby of the hotel for a little refreshment. In the lobby,
+some players got into a heated argument about who was the brightest, the
+fastest, and the best chess player in the world. The argument got quite
+loud, as various players claimed that honor. At that point, a security
+guard in the lobby turned to another guard and commented, "If there's
+anything I just can't stand, it's chess nuts boasting in an open foyer."
+%
+Several years ago, some smart businessmen had an idea: Why not build a
+big store where a do-it-yourselfer could get everything he needed at
+reasonable prices? Then they decided, nah, the hell with that, let's
+build a home center. And before long home centers were springing up
+like crabgrass all over the United States.
+ -- Dave Barry, "The Taming of the Screw"
+%
+Sex and drugs and rock and roll,
+Is all my brain and body need.
+Sex and drugs and rock and roll,
+Are very good indeed.
+
+Take your silly ways,
+Throw them out the window,
+The wisdom of your ways,
+I've been there and I know,
+Lots of other ways...
+ -- Ian Drury, "New Boots and Panties"
+%
+Sex discriminates against the shy and ugly.
+%
+Sex hasn't been the same since women started enjoying it.
+ -- Lewis Grizzard
+%
+Sex is a natural bodily process, like a stroke.
+%
+Sex is about as important as a cheese sandwich. But a cheese sandwich,
+if you ain't got one to put in your belly, is extremely important.
+ -- Ian Dury
+%
+Sex is an emotion in motion.
+ -- Mae West
+%
+Sex is as honest a product benefit for fragrance [perfume] as taste is
+for diet Coke.
+ -- Malcolm MacDougall
+%
+Sex is good, but not as good as fresh sweet corn.
+ -- Garrison Keillor
+%
+Sex is like pizza -- when it's good, it's great; and when it's bad,
+it's still darn tasty!
+%
+Sex is one of the nine reasons for reincarnation... The other eight are
+unimportant.
+ -- Henry Miller
+%
+Sex is the mathematics urge sublimated.
+ -- M. C. Reed
+%
+Sex: the thing that takes up the least amount of time and causes the
+most amount of trouble.
+ -- John Barrymore
+%
+Sex without class consciousness cannot give satisfaction, even if it is
+repeated until infinity.
+ -- Aldo Brandirali (Secretary of the Italian Marxist-Leninist
+ Party), in a manual of the party's official sex guidelines,
+ 1973.
+%
+Sex without love is an empty experience, but,
+as empty experiences go, it's one of the best.
+ -- Woody Allen
+%
+Sexual enlightenment is justified insofar as girls cannot learn too soon
+how children do not come into the world.
+ -- Karl Kraus
+%
+Shah, shah! Ayatulla you so!
+%
+Shall we make a new rule of life from tonight:
+always to try to be a little kinder than is necessary?
+ -- J. M. Barrie
+%
+Shame is an improper emotion invented by
+pietists to oppress the human race.
+ -- Robert Preston, Toddy, "Victor/Victoria"
+%
+Shannon's Observation
+ Nothing is so frustrating as a bad situation
+ that is beginning to improve.
+%
+Share, n.:
+ To give in, endure humiliation.
+%
+Sharks are as tough as those football fans who take their shirts off
+during games in Chicago in January, only more intelligent.
+ -- Dave Barry, "Sex and the Single Amoeba: What Every
+ Teen Should Know"
+%
+Shaw's Principle:
+ Build a system that even a fool can use, and only a fool will
+ want to use it.
+%
+She always believed in the old adage -- leave them while you're looking
+good.
+ -- Anita Loos, "Gentlemen Prefer Blondes"
+%
+She applies her lipstick in spite of its contents: "greasy rouge,
+containing crushed and dried insect corpses for coloring, beeswax
+for stiffness, and olive oil to help it flow - the latter having
+the unfortunate tendency to go rancid several hours after use.
+
+In 1924 the New York Board of Health considered banning lipstick,
+not because it was hazardous to the wearers but because of "the
+worry that it might poison the men who kissed the women who wore it."
+ -- David Bodanis, "The Secret House"
+%
+She asked me, "What's your sign?"
+I blinked and answered "Neon,"
+I thought I'd blow her mind...
+%
+She been married so many times
+she got rice marks all over her face.
+ -- Tom Waits
+%
+She blinded me with science!
+%
+She can kill all your files;
+She can freeze with a frown.
+And a wave of her hand brings the whole system down.
+And she works on her code until ten after three.
+She lives like a bat but she's always a hacker to me.
+ -- Apologies to Billy Joel
+%
+She cried, and the judge wiped her tears with my checkbook.
+ -- Tommy Manville
+%
+She has an alarm clock and a phone that don't ring - they applaud.
+%
+She is descended from a long line that her mother listened to.
+ -- Gypsy Rose Lee
+%
+She is not refined. She is not unrefined. She keeps a parrot.
+ -- Mark Twain
+%
+She just came in, pounced around this thing with me for a few
+years, enjoyed herself, gave it a sort of beautiful quality and
+left. Excited a few men in the meantime.
+ -- Patrick Macnee, reminiscing on Diana Rigg's
+ involvement in "The Avengers".
+%
+She liked him; he was a man of many qualities, even if most of them
+were bad.
+%
+She missed an invaluable opportunity to give him
+a look that you could have poured on a waffle.
+%
+She often gave herself very good advice
+(though she very seldom followed it).
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+She ran the gamut of emotions from "A" to "B".
+ -- Dorothy Parker, on a Kate Hepburn performance
+%
+She say, Miss Colie, You better hush. God might hear you.
+Let 'im hear me, I say. If he ever listened to poor colored
+women the world would be a different place, I can tell you.
+ -- Alice Walker, "The Color Purple"
+%
+She sells cshs by the cshore.
+%
+She stood on the tracks
+Waving her arms
+Leading me to that third rail shock
+Quick as a wink
+She changed her mind
+
+She gave me a night
+That's all it was
+What will it take until I stop
+Kidding myself
+Wasting my time
+
+There's nothing else I can do
+'Cause I'm doing it all for Leyna
+I don't want anyone new
+'Cause I'm living it all for Leyna
+There's nothing in it for you
+'Cause I'm giving it all to Leyna
+ -- Billy Joel, "All for Leyna" (Glass Houses)
+%
+She was bred in ol' Kentucky
+But she's just a crumb up here
+She was knock-knee'd and double-jointed
+With a cauliflower ear
+Someday we will be married
+And if vegetables become too dear
+I'll just cut me a slice of
+Her cauliflower ear!
+ -- Curly Howard, "The Three Stooges"
+%
+She was good at playing abstract confusion in the same way a midget is
+good at being short.
+ -- Clive James, on Marilyn Monroe
+%
+She was only a moonshiner's daughter, but I love her still.
+%
+She was only a mortician's daughter but anyone cadaver.
+%
+She won' go Warp 7, Cap'n! The batteries are dead!
+%
+Shedenhelm's Law:
+ All trails have more uphill sections
+ than they have downhill sections.
+%
+"Shelter", what a nice name for a place where you polish your cat.
+%
+Sheriff Chameleotoptor sighed with an air of weary sadness, and then
+turned to Doppelgutt and said 'The Senator must really have been on a
+bender this time -- he left a party in Cleveland, Ohio, at 11:30 last
+night, and they found his car this morning in the smokestack of a British
+aircraft carrier in the Formosa Straits.'
+ -- Grand Panjandrum's Special Award, 1985 Bulwer-Lytton
+ bad fiction contest.
+%
+Sherry [Thomas Sheridan] is dull, naturally dull; but it must have taken
+him a great deal of pains to become what we now see him. Such an excess
+of stupidity, sir, is not in Nature.
+ -- Samuel Johnson
+%
+She's genuinely bogus.
+%
+She's learned to say things with her eyes
+that others waste time putting into words.
+%
+She's so tough she won't take 'yes' for an answer.
+%
+She's such a kinky girl,
+The kind you don't take home to mother.
+She will never let your spirits down
+Once you get her off the street.
+%
+She's the kind of girl who climbed the ladder of success wrong by wrong.
+ -- Mae West
+%
+Shhh... be vewy, vewy, quiet! I'm hunting wabbits...
+%
+Shick's Law:
+ There is no problem a good miracle can't solve.
+%
+Shift to the left,
+Shift to the right,
+Mask in, mask out,
+BYTE, BYTE, BYTE !!!
+%
+SHIFT TO THE LEFT!
+SHIFT TO THE RIGHT!
+POP UP, PUSH DOWN,
+BYTE, BYTE, BYTE!
+%
+Ships are safe in harbor, but they were never meant to stay there.
+%
+Shirley MacLaine died today in a freak psychic collision today. Two freaks
+in a van [Oh no!! It's the Copyright Police!!] Her aura-charred body was
+laid to rest after a eulogy by Jackie Collins, fellow member of SAFE [Society
+of Asinine Flake Entertainers]. Excerpted from some of his more quotable
+comments:
+
+ "Truly a woman of the times. These times, those times..."
+ "A Renaissance woman. Why in 1432..."
+ "A man for all seasons. Really..."
+
+After the ceremony, Shirley thanked her mourners and explained how delightful
+it was to "get it together" again, presumably referring to having her now dead
+body join her long dead brain.
+%
+Sho' they got to have it against the law. Shoot, ever'body git high,
+they wouldn't be nobody git up and feed the chickens. Hee-hee.
+ -- Terry Southern
+%
+Short people get rained on last.
+%
+Show business is just like high school, except you get paid.
+ -- Martin Mull
+%
+Show me a good loser in professional sports and I'll show you an idiot.
+Show me a good sportsman and I'll show you a player I'm looking to trade.
+ -- Leo Durocher
+%
+Show me a man who is a good loser and I'll show you a man who is
+playing golf with his boss.
+%
+Show respect for age. Drink good Scotch for a change.
+%
+Show your affection, which will probably meet with pleasant response.
+%
+Showing up is 80% of life.
+ -- Woody Allen
+%
+Si Dieu n'existait pas, il faudrait l'inventer.
+ -- Voltaire
+%
+Si jeunesse savait, si vieillesse pouvait.
+[If youth but knew, if old age but could.]
+ -- Henri Estienne
+%
+Sic transit gloria Monday!
+%
+Sic transit gloria mundi.
+[So passes away the glory of this world.]
+ -- Thomas a Kempis
+%
+Sic Transit Gloria Thursdi.
+%
+Sight is a faculty; seeing is an art.
+%
+Sigmund's wife wore Freudian slips.
+%
+Signals don't kill programs. Programs kill programs.
+%
+Signs of crime: screaming or cries for help.
+ -- The Brown University Security Crime Prevention Pamphlet
+%
+Silence can be the biggest lie of all. We have a responsibility to speak
+up; and whenever the occasion calls for it, we have a responsibility to
+raise bloody hell.
+ -- Herbert Block
+%
+Silence is the element in which great things fashion themselves.
+ -- Thomas Carlyle
+%
+Silence is the only virtue you have left.
+%
+sillema sillema nika su
+[translation: look it up...hint-fin]
+%
+Silly is a state of Mind, Stupid is a way of Life.
+%
+Silly Sally was baby sitting. But Silly Sally was getting bored. Thinking
+a walk would help, she put the baby in his carriage. Silly Sally pushed the
+carriage and pushed the carriage up this hill and down that one. She pushed
+the carriage up the highest hill in town, and ALL OF A SUDDEN! It slipped out
+of her hands (OH! NO!) and it was headed at high speed for the busiest
+intersection in town. BUT!
+
+Silly Sally just laughed and la.....ug.......h....e....d...........
+BECAUSE! SHE KNEW THERE WAS A STOP SIGN AT THE BOTTOM OF THE HILL!
+
+Silly Sally was playing in the garage. And she was being disobedient.
+She was playing with matches... AND... She burned down the garage.
+(OHHHHHH) Silly Sally's mother said, "Silly Sally! You have been naughty!
+And when your father gets home, you are going to get a good licking!" BUT!
+
+Silly Sally just laughed and la.....ug.......h....e....d...........
+BECAUSE! SHE KNEW HER FATHER WAS IN THE GARAGE WHEN SHE BURNED IT DOWN!
+%
+Silverman's Law:
+ If Murphy's Law can go wrong, it will.
+%
+Simon's Law:
+ Everything put together falls apart sooner or later.
+%
+Simplicity does not precede complexity, but follows it.
+%
+Simulated fortune:
+
+ The head and in frontal attack on an english writer that the
+ character of this point is therefore another method for the
+ letters that the time of who ever told the problem for an
+ unexpected.
+
+ -- by Claude E. Shannon
+%
+Simulations are like miniskirts, they show a lot and hide the essentials.
+ -- Hubert Kirrman
+%
+Sin boldly.
+ -- Martin Luther
+%
+Sin has many tools, but a lie is the handle which fits them all.
+%
+Sin lies only in hurting other people unnecessarily.
+All other "sins" are invented nonsense.
+(Hurting yourself is not sinful -- just stupid).
+ -- Lazarus Long
+%
+Since a politician never believes what he says, he is surprised
+when others believe him.
+ -- Charles DeGaulle
+%
+Since aerosols are forbidden, the police are using roll-on Mace!
+%
+Since before the Earth was formed and before the sun burned hot in space,
+cosmic forces of inexorable power have been working relentlessly toward
+this moment in space-time -- your receiving this fortune.
+%
+Since everything in life is but an experience perfect in being what it is,
+having nothing to do with good or bad, acceptance or rejection, one may well
+burst out in laughter.
+ -- Long Chen Pa
+%
+Since I hurt my pendulum
+My life is all erratic.
+My parrot who was cordial
+Is now transmitting static.
+The carpet died, a palm collapsed,
+The cat keeps doing poo.
+The only thing that keeps me sane
+Is talking to my shoe.
+ -- My Shoe
+%
+Since we cannot hope for order, let us withdraw with style from the chaos.
+ -- Tom Stoppard
+%
+Since we have to speak well of the dead, let's knock them while they're
+alive.
+ -- John Sloan
+%
+Since we're all here, we must not be all there.
+ -- Bob "Mountain" Beck
+%
+Sink or Swim with Teddy!
+%
+Sinners can repent, but stupid is forever.
+%
+Sir, it's very possible this asteroid is not stable.
+ -- C-3PO
+%
+[Sir Stafford Cripps] has all the virtues
+I dislike and none of the vices I admire.
+ -- Winston Churchill
+%
+Six days after the Creation, Adam was still alone in the Garden of
+Eden, and getting pretty desperate. "God!" he cried, "rescue me from
+loneliness and despair! Send some company for Your sake!"
+
+God replied "OK, I have just the thing. Keep you warm and relaxed all
+the days of your life. Never complains. Looks up to you in every way.
+It'll cost you though".
+
+"Sounds ideal" said Adam. "The society of the beasts of the field and
+the birds of the air palls after a while. What's the price?"
+
+"An arm and a leg", said God.
+
+Adam thought about it for a bit and finally sighed. "So, what can I get
+for a rib?"
+%
+Skill without imagination is craftsmanship and gives us many useful
+objects such as wickerwork picnic baskets. Imagination without skill
+gives us modern art.
+ -- Tom Stoppard
+%
+Skinner's Constant (or Flannagan's Finagling Factor):
+ That quantity which, when multiplied by, divided by, added to,
+ or subtracted from the answer you got, gives you the answer you
+ should have gotten.
+%
+skldfjkljklsR%^&(IXDRTYju187pkasdjbasdfbuil
+h;asvgy8p 23r1vyui135 2
+kmxsij90TYDFS$$b jkzxdjkl bjnk ;j nk;<[][;-==-<<<<<';[,
+ [hjioasdvbnuio;buip^&(FTSD$%*VYUI:buio;sdf}[asdf']
+ sdoihjfh(_YU*G&F^*CTY98y
+
+
+Now look what you've gone and done! You've broken it!
+%
+Slang is language that takes off its coat,
+spits on its hands, and goes to work.
+%
+Slaves are generally expected to sing as well as to work ... I did not, when
+a slave, understand the deep meanings of those rude, and apparently incoherent
+songs. I was myself within the circle, so that I neither saw nor heard as
+those without might see and hear. They told a tale which was then altogether
+beyond my feeble comprehension: they were tones, loud, long and deep,
+breathing the prayer and complaint of souls boiling over with the bitterest
+anguish. Every tone was a testimony against slavery, and a prayer to God
+for deliverance from chains.
+ -- Frederick Douglass
+%
+Sleep -- the most beautiful experience in life -- except drink.
+ -- W. C. Fields
+%
+Sleep is for the weak and sickly.
+%
+Slick's Three Laws of the Universe:
+ 1) Nothing in the known universe travels faster than a bad check.
+ 2) A quarter-ounce of chocolate = four pounds of fat.
+ 3) There are two types of dirt: the dark kind, which is
+ attracted to light objects, and the light kind, which is
+ attracted to dark objects.
+%
+Slous' Contention:
+ If you do a job too well, you'll get stuck with it.
+%
+Slow day.
+Practice crawling.
+%
+Slowly and surely the Unix crept up on the Nintendo user ...
+%
+Slurm, n.:
+ The slime that accumulates on the underside of a soap bar when
+ it sits in the dish too long.
+ -- Rich Hall, "Sniglets"
+%
+Small change can often be found under seat cushions.
+%
+Small is beautiful.
+ -- Schumacher's Dictum
+%
+Small things make base men proud.
+ -- William Shakespeare, "Henry VI"
+%
+Smartness runs in my family. When I went to school I was so smart my
+teacher was in my class for five years.
+ -- George Burns
+%
+Smear the road with a runner!!
+%
+Smile! You're on Candid Camera.
+%
+Smile, Cthulhu Loathes You.
+%
+Smoking is, as far as I'm concerned, the entire point of being an adult.
+ -- Fran Lebowitz
+%
+SMOKING IS NOW ALLOWED !!!
+ Anyone wishing to smoke, however, must file, in triplicate, the
+ U.S. government Environmental Impact Narrative Statement (EINS),
+ describing in detail the type of combustion proposed, impact on
+ the environment, and anticipated opposition. Statements must be
+ filed 30 days in advance.
+%
+Smoking is one of the leading causes of statistics.
+ -- Fletcher Knebel
+%
+Smoking Prohibited. Absolutely no ifs, ands, or butts.
+%
+Smuggling... It's not just a job, it's an adventure!
+ -- paid for by your local Colombian recruiting office
+%
+Snacktrek, n.:
+ The peculiar habit, when searching for a snack, of constantly
+ returning to the refrigerator in hopes that something new will
+ have materialized.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Snakes. Why did it have to be snakes?
+%
+SNAPPY REPARTEE:
+ What you'd say if you had another chance.
+%
+Snoopy: No problem is so big that it can't be run away from.
+%
+Snow and adolescence are the only problems
+that disappear if you ignore them long enough.
+%
+Snow Day -- stay home.
+%
+Snow White has become a camera buff. She spends hours and hours
+shooting pictures of the seven dwarfs and their antics. Then she
+mails the exposed film to a cut rate photo service. It takes weeks
+for the developed film to arrive in the mail, but that is all right
+with Snow White. She clears the table, washes the dishes and sweeps
+the floor, all the while singing "Someday my prints will come."
+%
+So as your consumer electronics adviser, I am advising you to donate
+your current VCR to a grate resident, who will laugh sardonically and
+hurl it into a dumpster. Then I want you to go out and purchase a vast
+array of 8-millimeter video equipment.
+
+... OK! Got everything? Well, *too bad, sucker*, because while you
+were gone the electronics industry came up with an even newer format
+that makes your 8-millimeter VCR look as technologically advanced as
+toenail dirt. This format is called "3.5 hectare" and it will not be
+made available until it is outmoded, sometime early next week, by a
+format called "Elroy", so *order yours now*.
+ -- Dave Barry, "No Surrender in the Electronics
+ Revolution"
+%
+So... did you ever wonder, do garbage men take showers before they
+go to work?
+%
+So do the noble fall. For they are ever caught in a trap of their own making.
+A trap -- walled by duty, and locked by reality. Against the greater force
+they must fall -- for, against that force they fight because of duty, because
+of obligations. And when the noble fall, the base remain. The base -- whose
+only purpose is the corruption of what the noble did protect. Whose only
+purpose is to destroy. The noble: who, even when fallen, retain a vestige of
+strength. For theirs is a strength born of things other than mere force.
+Theirs is a strength supreme... theirs is the strength -- to restore.
+ -- Gerry Conway, "Thor", #193
+%
+So far as I can remember, there is not one word in the Gospels in
+praise of intelligence.
+ -- Bertrand Russell
+%
+So far as we are human, what we do must be either evil or good: so far
+as we do evil or good, we are human: and it is better, in a paradoxical
+way, to do evil than to do nothing: at least we exist.
+ -- T. S. Eliot, essay on Baudelaire
+%
+So from the depths of its enchantment, Terra was able to calculate a course
+of action. Here at last was an opportunity to consort with Dirbanu on a
+friendly basis -- great Dirbanu which, since it had force fields which Earth
+could not duplicate, must of necessity have many other things Earth could
+use; mighty Dirbanu before whom we would kneel in supplication (with purely-
+for-defense bombs hidden in our pockets) with lowered heads (making invisible
+the knife in our teeth) and ask for crumbs from their table (in order to
+extrapolate the location of their kitchens).
+ -- T. Sturgeon, "The World Well Lost"
+%
+So... how come the Corinthians never wrote back?
+%
+So, if there's no God, who changes the water?
+ -- New Yorker cartoon of two goldfish in a bowl
+%
+So I'm ugly. So what? I never saw anyone hit with his face.
+ -- Yogi Berra
+%
+So, is the glass half empty, half full, or just twice as
+large as it needs to be?
+%
+So little time, so little to do.
+ -- Oscar Levant
+%
+So live that you wouldn't be ashamed
+to sell the family parrot to the town gossip.
+%
+So many beautiful women and so little time.
+ -- John Barrymore
+%
+So many men and so little time.
+%
+So many men, so many opinions; every one his own way.
+ -- Publius Terentius Afer (Terence)
+%
+So many women, and so little time!
+%
+So many women, so little nerve.
+%
+So much food, and so little time!
+%
+So much
+depends
+upon
+a red
+
+wheel
+barrow
+glazed with
+
+rain
+water
+beside
+the white
+chickens.
+ -- William Carlos Williams, "The Red Wheel Barrow"
+%
+So now
+that you have-
+
+you know, whoever
+
+you're trying
+to do
+
+a favor
+for
+
+-you've done it-
+
+and I'm sure
+you had
+
+a smirk
+on your mouth
+
+as you got me
+into this.
+ -- "To Linda", from The Poetry Of H. Ross Perot,
+ composed for Linda Wertheimer of National Public
+ Radio. From SPY Magazine, November 1992
+%
+So she went into the garden to cut a cabbage leaf to make an apple pie; and
+at the same time a great she-bear, coming up the street pops its head into
+the shop. "What! no soap?" So he died, and she very imprudently married
+the barber; and there were present the Picninnies, and the Grand Panjandrum
+himself, with the little round button at top, and they all fell to playing
+the game of catch as catch can, till the gunpowder ran out at the heels of
+their boots.
+ -- Samuel Foote
+%
+So so is good, very good, very excellent good:
+and yet it is not; it is but so so.
+ -- William Shakespeare, "As You Like It"
+%
+So... so you think you can tell
+Heaven from Hell?
+Blue skies from pain? Did they get you to trade
+Can you tell a green field Your heroes for ghosts?
+From a cold steel rail? Hot ashes for trees?
+A smile from a veil? Hot air for a cool breeze?
+Do you think you can tell? Cold comfort for change?
+ Did you exchange
+ A walk on part in a war
+ For the lead role in a cage?
+ -- Pink Floyd, "Wish You Were Here"
+%
+So, what's with this guy Gideon, anyway?
+And why can't he ever remember his Bible?
+%
+So, you better watch out!
+You better not cry!
+You better not pout!
+I'm telling you why,
+Santa Claus is coming, to town.
+
+He knows when you've been sleeping,
+He know when you're awake.
+He knows if you've been bad or good,
+He has ties with the CIA.
+So...
+%
+So you see Antonio, why worry about one little core dump, eh? In reality
+all core dumps happen at the same instant, so the core dump you will have
+tomorrow, why, it already happened. You see, it's just a little universal
+recursive joke which threads our lives through the infinite potential of
+the instant. So go to sleep, Antonio, your thread could break any moment
+and cast you out of the safe security of the instant into the dark void of
+eternity, the anti-time. So go to sleep...
+%
+So you think that money is the root of all evil.
+Have you ever asked what is the root of money?
+ -- Ayn Rand
+%
+So you're back... about time...
+%
+Soap and education are not as sudden as a
+massacre, but they are more deadly in the long run.
+ -- Mark Twain
+%
+SOCIALISM:
+ You have two cows. Give one to your neighbour.
+COMMUNISM:
+ You have two cows.
+ Give both to the government. The government gives you milk.
+CAPITALISM:
+ You sell one cow and buy a bull.
+FASCISM:
+ You have two cows. Give milk to the government.
+ The government sells it.
+NAZISM:
+ The government shoots you and takes the cows.
+NEW DEALISM:
+ The government shoots one cow,
+ milks the other, and pours the milk down the sink.
+ANARCHISM:
+ Keep the cows. Steal another one. Shoot the government.
+CONSERVATISM:
+ Freeze the milk. Embalm the cows.
+%
+Sodd's Second Law:
+ Sooner or later, the worst possible set of circumstances is
+bound to occur.
+%
+Software, n.:
+ Formal evening attire for female computer analysts.
+%
+Software production is assumed to be a line function, but it is run
+like a staff function."
+ -- Paul Licker
+%
+Software suppliers are trying to make their software packages more
+"user-friendly". ... Their best approach, so far, has been to take all
+the old brochures, and stamp the words, "user-friendly" on the cover.
+ -- Bill Gates, Microsoft, Inc.
+%
+Soldiers who wish to be a hero
+Are practically zero,
+But those who wish to be civilians,
+They run into the millions.
+%
+Solipsists of the World... you are already united.
+ -- Kayvan Sylvan
+%
+Solutions are obvious if one only has the
+optical power to observe them over the horizon.
+ -- K. A. Arsdall
+%
+Some books are to be tasted, others to be swallowed,
+and some few to be chewed and digested.
+ -- Francis Bacon
+ [As anyone who has ever owned a puppy already knows. Ed.]
+%
+Some changes are so slow, you don't notice them.
+Others are so fast, they don't notice you.
+%
+Some circumstantial evidence is very strong,
+as when you find a trout in the milk.
+ -- Thoreau
+%
+Some days you are the bug; some days you are the windshield.
+%
+Some don't prefer the pursuit of happiness to the happiness of pursuit.
+%
+Some husbands are living proof that a woman can take a joke.
+%
+Some marriages are made in heaven -- but so are thunder and lightning.
+%
+Some men are alive simply because it is against the law to kill them.
+ -- Edgar W. Howe
+%
+Some men are all right in their place -- if they only the knew the right
+places!
+ -- Mae West
+%
+Some men are born mediocre, some men achieve mediocrity,
+and some men have mediocrity thrust upon them.
+ -- Joseph Heller, "Catch-22"
+%
+Some men are discovered; others are found out.
+%
+Some men are heterosexual, and some are bisexual, and some men don't think
+about sex at all... they become lawyers.
+ -- Woody Allen
+%
+Some men are so interested in their wives continued happiness
+that they hire detectives to find out the reason for it.
+%
+Some men are so macho they'll get you pregnant just to kill a rabbit.
+ -- Maureen Murphy
+%
+Some men feel that the only thing they owe
+the woman who marries them is a grudge.
+ -- Helen Rowland
+%
+Some men love truth so much that they seem to be in continual fear
+lest she should catch a cold on overexposure.
+ -- Samuel Butler
+%
+Some men rob you with a six-gun -- others with a fountain pen.
+ -- Woodie Guthrie
+%
+Some men who fear that they are playing
+second fiddle aren't in the band at all.
+%
+Some of my readers ask me what a "Serial Port" is.
+The answer is: I don't know.
+Is it some kind of wine you have with breakfast?
+%
+Some of the most interesting documents from Sweden's middle ages are the
+old county laws (well, we never had counties but it's the nearest equivalent
+I can find for "landskap"). These laws were written down sometime in the
+13th century, but date back even down into Viking times. The oldest one is
+the Vastgota law which clearly has pagan influences, thinly covered with some
+Christian stuff. In this law, we find a page about "lekare", which is the
+Old Norse word for a performing artist, actor/jester/musician etc. Here is
+an approximate translation, where I have written "artist" as equivalent of
+"lekare".
+ "If an artist is beaten, none shall pay fines for it. If an artist
+ is wounded, one such who goes with hurdie-gurdie or travels with
+ fiddle or drum, then the people shall take a wild heifer and bring
+ it out on the hillside. Then they shall shave off all hair from the
+ heifer's tail, and grease the tail. Then the artist shall be given
+ newly greased shoes. Then he shall take hold of the heifer's tail,
+ and a man shall strike it with a sharp whip. If he can hold her, he
+ shall have the animal. If he cannot hold her, he shall endure what
+ he received, shame and wounds."
+%
+Some of the things that live the longest
+in peoples' memories never really happened.
+%
+Some of them want to use you,
+Some of them want to be used by you,
+...Everybody's looking for something.
+ -- Eurythmics, "Sweet Dreams (Are Made Of This)"
+%
+Some of us are becoming the men we wanted to marry.
+ -- Gloria Steinem
+%
+Some of you ... may have decided that, this year, you're going to
+celebrate it the old-fashioned way, with your family sitting around
+stringing cranberries and exchanging humble, handmade gifts, like on
+"The Waltons". Well, you can forget it. If everybody pulled that kind
+of subversive stunt, the economy would collapse overnight. The
+government would have to intervene: it would form a cabinet-level
+Department of Holiday Gift-Giving, which would spend billions and
+billions of tax dollars to buy Barbie dolls and electronic games, which
+it would drop on the populace from Air Force jets, killing and maiming
+thousands. So, for the good of the nation, you should go along with
+the Holiday Program. This means you should get a large sum of money
+and go to a mall.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+Some parts of the past must be preserved,
+and some of the future prevented at all costs.
+%
+Some people call them "cars" or "trucks"; I call them "dimensional
+transmogrifiers" because they change three-dimensional cats into
+two-dimensional ones.
+ -- F. Frederick Skitty
+%
+Some people carve careers, others chisel them.
+%
+Some people cause happiness wherever
+they go; others, whenever they go.
+%
+Some people claim that the UNIX learning curve is steep,
+but at least you only have to climb it once.
+%
+Some people have a way about them that seems to say: "If I have
+only one life to live, let me live it as a jerk."
+%
+Some people have no respect for age unless it's bottled.
+%
+Some people have parts that are so private
+they themselves have no knowledge of them.
+%
+Some people in this department wouldn't recognize subtlety if it hit
+them on the head.
+%
+Some people live life in the fast lane.
+You're in oncoming traffic.
+%
+Some people manage by the book, even though they
+don't know who wrote the book or even what book.
+%
+Some people need a good imaginary cure
+for their painful imaginary ailment.
+%
+Some people only open up to tell you that they're closed.
+%
+Some people pray for more than they are willing to work for.
+%
+Some people say a front-engine car handles best. Some people say a
+rear-engine car handles best. I say a rented car handles best.
+ -- P. J. O'Rourke
+%
+Some peoples mouths work faster than their brains.
+They say things they haven't even thought of yet.
+%
+Some performers on television appear to be horrible people, but when
+you finally get to know them in person, they turn out to be even
+worse.
+ -- Avery
+%
+Some points to remember [about animals]:
+
+(1) Don't go to sleep under big animals, e.g., elephants, rhinoceri,
+ hippopotamuses;
+(2) Don't put animals with sharp teeth or poisonous fangs down the
+ front of your clothes;
+(3) Don't pat certain animals, e.g., crocodiles and scorpions or dogs
+ you have just kicked.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+Some primal termite knocked on wood.
+And tasted it, and found it good.
+And that is why your Cousin May
+Fell through the parlor floor today.
+ -- Ogden Nash
+%
+Some programming languages manage to absorb change, but withstand
+progress.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+Some rise by sin and some by virtue fall.
+%
+Some say the world will end in fire,
+Some say in ice.
+From what I've tasted of desire
+I hold with those who favor fire.
+But if it had to perish twice
+I think I know enough of hate
+To say that for destruction, ice
+Is also great
+And would suffice
+ -- Robert Frost, "Fire and Ice"
+%
+Some scholars are like donkeys, they merely carry a lot of books.
+ -- Folk saying
+%
+Some things have to be believed to be seen.
+%
+Somebody left the cork out of my lunch.
+ -- W. C. Fields
+%
+Somebody ought to cross ball point pens with coat hangers
+so that the pens will multiply instead of disappear.
+%
+Somebody's moggy, by the side of the road,
+Somebody's pussy, who forgot his highway code,
+Somebody's favourite feline, who ran clean out of luck,
+When he ran onto the road, and tried to argue with a truck.
+
+Yesterday he purred and played, in his pussy paradise,
+Decapitating tweety birds, and masticating mice.
+Now he's just six pounds of raw mince meat,
+That don't smell very nice --
+He's nobody's moggy now.
+
+Oh you who love your pussy,
+Be sure to keep him in.
+Don't let him argue with a truck, If he tries to play
+The truck is bound to win. On the road way
+And upon the busy road, I'm afraid that will be that,
+Don't let him play or frolic. There will be one last despairing
+If you do, I'm warning you, "Meow!"
+It could be cat-astrophic! And a sort of squelchy Splat!
+ And your pussy will be slightly dead,
+He's nobody's moggy -- And very, very flat!
+Just red and squashed and soggy --
+He's nobody's moggy now.
+ -- Eric Bogle, "Scraps of Paper"
+%
+Somebody's terminal is dropping bits.
+I found a pile of them over in the corner.
+%
+Someday somebody has got to decide whether the
+typewriter is the machine, or the person who operates it.
+%
+Someday, Weederman, we'll look back on all this and laugh... It will
+probably be one of those deep, eerie ones that slowly builds to a
+blood-curdling maniacal scream... but still it will be a laugh.
+ -- Mister Boffo
+%
+Someday we'll look back on this moment and plow into a parked car.
+ -- Evan Davis
+%
+Someday you'll get your big chance -- or have you already had it?
+%
+Someday your prints will come.
+ -- Kodak
+%
+Somehow I reached excess without ever noticing
+when I was passing through satisfaction.
+ -- Ashleigh Brilliant
+%
+Somehow, the world always affects you more than you affect it.
+%
+Someone did a study of the three most-often-heard phrases in New York
+City. One is "Hey, taxi." Two is, "What train do I take to get to
+Bloomingdale's?" And three is, "Don't worry. It's just a flesh wound."
+ -- David Letterman
+%
+Someone is speaking well of you.
+How unusual!
+%
+Someone is unenthusiastic about your work.
+%
+Someone whom you reject today, will reject you tomorrow.
+%
+Someone will try to honk your nose today.
+%
+Something better...
+
+ 1 (obvious): Excuse me. Is that your nose or did a bus park on your face?
+ 2 (meteorological): Everybody take cover. She's going to blow.
+ 3 (fashionable): You know, you could de-emphasize your nose if you wore
+ something larger. Like ... Wyoming.
+ 4 (personal): Well, here we are. Just the three of us.
+ 5 (punctual): Alright gentlemen. Your nose was on time but you were fifteen
+ minutes late.
+ 6 (envious): Oooo, I wish I were you. Gosh. To be able to smell your
+ own ear.
+ 7 (naughty): Pardon me, Sir. Some of the ladies have asked if you wouldn't
+ mind putting that thing away.
+ 8 (philosophical): You know. It's not the size of a nose that's important.
+ It's what's in it that matters.
+ 9 (humorous): Laugh and the world laughs with you. Sneeze and its goodbye
+ Seattle.
+10 (commercial): Hi, I'm Earl Schibe and I can paint that nose for $39.95.
+11 (polite): Ah. Would you mind not bobbing your head. The orchestra keeps
+ changing tempo.
+12 (melodic): Everybody! "He's got the whole world in his nose."
+ -- Steve Martin, "Roxanne"
+%
+Something unpleasant is coming when men are anxious to tell the truth.
+ -- Benjamin Disraeli
+%
+Something's rotten in the state of Denmark.
+ -- William Shakespeare
+%
+Sometime when you least expect it, Love will tap you on the shoulder...
+and ask you to move out of the way because it still isn't your turn.
+ -- N. V. Plyter
+%
+Sometimes a cigar is just a cigar.
+ -- Sigmund Freud
+%
+Sometimes a man who deserves to be looked down upon because he is a
+fool is despised only because he is a lawyer.
+ -- Montesquieu
+%
+Sometimes, at the end of the day, when I'm
+smiling and shaking their hands, I want to kick them.
+ -- Richard M. Nixon
+%
+Sometimes even to live is an act of courage.
+ -- Seneca
+%
+Sometimes I feel like I'm fading away,
+Looking at me, I got nothin' to say.
+Don't make me angry with the things games that you play,
+Either light up or leave me alone.
+%
+Sometimes I get the feeling that I went to a party on Perry Lane in 1962, and
+the party spilled out of the house, and came down the street, and covered the
+world.
+ -- Robert Stone
+%
+Sometimes I live in the country,
+And sometimes I live in town.
+And sometimes I have a great notion,
+To jump in the river and drown.
+%
+Sometimes I simply feel that the whole
+world is a cigarette and I'm the only ashtray.
+%
+Sometimes I wonder if I'm in my right mind.
+Then it passes off and I'm as intelligent as ever.
+ -- Samuel Beckett, "Endgame"
+%
+Sometimes I worry about being a success in a mediocre world.
+ -- Lily Tomlin
+%
+Sometimes it happens. People just explode. Natural causes.
+ -- Repo Man
+%
+Sometimes love ain't nothing but a misunderstanding between two fools.
+%
+SOMETIMES THE BEAUTY OF THE WORLD is so overwhelming, I just want to throw
+back my head and gargle. Just gargle and gargle and I don't care who hears
+me because I am beautiful.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Sometimes the best medicine is to stop taking something.
+%
+Sometimes the light is all shining on me,
+Other times I can hardly see.
+Lately it occurs to me
+What a long strange trip it's been.
+ -- The Grateful Dead, "American Beauty"
+%
+Sometimes, too long is too long.
+ -- Joe Crowe
+%
+Sometimes when I get up in the morning, I feel very peculiar. I feel
+like I've just got to bite a cat! I feel like if I don't bite a cat
+before sundown, I'll go crazy! But then I just take a deep breath and
+forget about it. That's what is known as real maturity.
+ -- Snoopy
+%
+Sometimes, when I think of what that girl means
+to me, it's all I can do to keep from telling her.
+ -- Andy Capp
+%
+Sometimes when you look into his eyes you get the feeling that someone
+else is driving.
+ -- David Letterman
+%
+Sometimes you get an almost irresistible urge to go on living.
+%
+Somewhere, just out of sight, the unicorns are gathering.
+%
+Somewhere on this globe, every ten seconds, there is a
+woman giving birth to a child. She must be found and stopped.
+ -- Sam Levenson
+%
+Somewhere, something incredible is waiting to be known.
+ -- Carl Sagan
+%
+Son, someday a man is going to walk up to you with a deck of cards on which
+the seal is not yet broken. And he is going to offer to bet you that he can
+make the Ace of Spades jump out of the deck and squirt cider in your ears.
+But son, do not bet this man, for you will end up with an ear full of cider.
+ -- Sky Masterson's Father
+%
+Song Title of the Week:
+ "They're putting dimes in the hole in my head to see the change
+in me."
+%
+Sooner or later you must pay for your sins. (Those who have already
+paid may disregard this fortune).
+%
+Sorry. I forget what I was going to say.
+%
+Sorry. Nice try.
+%
+Sorry never means having you're say to love.
+%
+Sorry, no fortune this time.
+%
+Space is big. You just won't believe how vastly, hugely, mind-bogglingly
+big it is. I mean, you may think it's a long way down the road to the
+drug store, but that's just peanuts to space.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Space is to place as eternity is to time.
+ -- Joseph Joubert
+%
+Space tells matter how to move and matter tells space how to curve.
+ -- Wheeler
+%
+Space: the final frontier. These are the voyages of the starship Enterprise.
+Its five-year mission: to explore strange new worlds; to seek out new life
+and new civilizations; to boldly go where no man has gone before.
+ -- Captain James T. Kirk
+%
+Spagmumps, n.:
+ Any of the millions of Styrofoam wads that accompany mail-order
+ items.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Spare no expense to save money on this one.
+ -- Samuel Goldwyn
+%
+Spark's Sixth Rule for Managers:
+ If a subordinate asks you a pertinent question, look at him as
+if he had lost his senses. When he looks down, paraphrase the question
+back at him.
+%
+Speak roughly to your little boy,
+ And beat him when he sneezes:
+He only does it to annoy
+ Because he knows it teases.
+
+ Wow! wow! wow!
+
+I speak severely to my boy,
+ And beat him when he sneezes:
+For he can thoroughly enjoy
+ The pepper when he pleases!
+
+ Wow! wow! wow!
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+Speak roughly to your little VAX,
+ And boot it when it crashes;
+It knows that one cannot relax
+ Because the paging thrashes!
+
+ Wow! Wow! Wow!
+
+I speak severely to my VAX,
+ And boot it when it crashes;
+In spite of all my favorite hacks
+ My jobs it always thrashes!
+
+ Wow! Wow! Wow!
+%
+Speak softly and carry a +6 two-handed sword.
+%
+Speak softly and own a big, mean Doberman.
+ -- Dave Millman
+%
+"Speak, thou vast and venerable head," muttered Ahab, "which, though
+ungarnished with a beard, yet here and there lookest hoary with mosses; speak,
+mighty head, and tell us the secret thing that is in thee. Of all divers,
+thou has dived the deepest. That head upon which the upper sun now gleams has
+moved amid the world's foundations. Where unrecorded names and navies rust,
+and untold hopes and anchors rot; where in her murderous hold this frigate
+earth is ballasted with bones of millions of the drowned; there, in that awful
+water-land, there was thy most familiar home. Thou hast been where bell or
+diver never went; has slept by many a sailer's side, where sleepless mothers
+would give their lives to lay them down. Thou saw'st the locked lovers when
+leaping from their flaming ship; heart to heart they sank beneath the exulting
+wave; true to each other, when heaven seemed false to them. Thou saw'st the
+murdered mate when tossed by pirates from the midnight deck; for hours he fell
+into the deeper midnight of the insatiate maw; and his murderers still sailed
+on unharmed -- while swift lightnings shivered the neighboring ship that would
+have borne a righteous husband to outstretched, longing arms. O head! thou has
+seen enough to split the planets and make an infidel of Abraham, and not one
+syllable is thine!"
+ -- H. Melville, "Moby Dick"
+%
+Speaking as someone who has delved into the intricacies of PL/I, I am sure
+that only Real Men could have written such a machine-hogging, cycle-grabbing,
+all-encompassing monster. Allocate an array and free the middle third?
+Sure! Why not? Multiply a character string times a bit string and assign the
+result to a float decimal? Go ahead! Free a controlled variable procedure
+parameter and reallocate it before passing it back? Overlay three different
+types of variable on the same memory location? Anything you say! Write a
+recursive macro? Well, no, but Real Men use rescan. How could a language
+so obviously designed and written by Real Men not be intended for Real Man use?
+%
+Speaking of Godzilla and other things that convey horror:
+
+ With a purposeful grimace and a Mongo-like flair
+ He throws the spinning disk drives in the air!
+ And he picks up a Vax and he throws it back down
+ As he wades through the lab making terrible sounds!
+ Helpless users with projects due
+ Scream "My God!" as he stomps on the tape drives, too!
+
+ Oh, no! He says Unix runs too slow! Go, go, DECzilla!
+ Oh, yes! He's gonna bring up VMS! Go, go, DECzilla!"
+
+* VMS is a trademark of Digital Equipment Corporation
+* DECzilla is a trademark of Hollow Chocolate Bunnies of Death, Inc.
+ -- Curtis Jackson
+%
+Speaking of love, one problem that recurs more and more frequently these
+days, in books and plays and movies, is the inability of people to communicate
+with the people they love; Husbands and wives who can't communicate, children
+who can't communicate with their parents, and so on. And the characters in
+these books and plays and so on (and in real life, I might add) spend hours
+bemoaning the fact that they can't communicate. I feel that if a person can't
+communicate, the very least he can do is to shut up!
+ -- Tom Lehrer, "That Was the Year that Was"
+%
+Speaking of purchasing a dog, never buy a watchdog that's
+on sale. After all, everyone knows a bargain dog never bites!
+%
+Special tonight, the best toot in town at prices you won't believe!!
+Also, the finest dope, brought all the way from Columbia by spirited
+young adventurers. All available tonight, as usual, in the graduate
+students bullpen from 11: pm on, usual terms and conditions.
+Faculty members especially welcome.
+%
+Speed is subsittute fo accurancy.
+%
+Speed upon county roads will be limited to ten miles an hour unless the
+motorist sees a bailiff who does not appear to have had a drink in 30 days,
+when the driver will be permitted to make what he can.
+ -- Proposed legislation, Illinois State Legislature, May, 1907
+%
+Speer's 1st Law of Proofreading:
+ The visibility of an error is inversely proportional to the
+number of times you have looked at it.
+%
+Spelling is a lossed art.
+%
+Spence's Admonition:
+ Never stow away on a kamikaze plane.
+%
+Spend extra time on hobby. Get plenty of rolling papers.
+%
+SPINSTER:
+ A bachelor's wife.
+%
+Spirtle, n.:
+ The fine stream from a grapefruit that always lands right in
+ your eye.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Spock: The odds of surviving another
+attack are 13562190123 to 1, Captain.
+%
+Spock: We suffered 23 casualties in that attack, Captain.
+%
+Spouse, n.:
+ Someone who'll stand by you through all the trouble you
+ wouldn't have had if you'd stayed single.
+%
+Spring is here, spring is here,
+Life is skittles and life is beer.
+%
+Squatcho, n.:
+ The button at the top of a baseball cap.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Squirrels eating squirrels, my God, that's sick.
+%
+St. Patrick was a gentleman
+who through strategy and stealth
+drove all the snakes from Ireland.
+Here's a toasting to his health --
+but not too many toastings
+lest you lose yourself and then
+forget the good St. Patrick
+and see all those snakes again.
+%
+Stability itself is nothing else than a more sluggish motion.
+%
+Staff meeting in the conference room in 3 minutes.
+%
+Stalin was dying, and summoned Khruschev to his bedside. Wheezing his last
+words with difficulty, Stalin tells Khruschev, "The reins of the country are
+now in your hands. But before I go, I want to give you some advice."
+ "Yes, yes, what is it?" says Khruschev, impatiently. Reaching under
+his pillow, Stalin produced two envelopes labeled #1 and #2.
+ "Take these letters," he tells Khruschev. "Keep them safely -- don't
+open them. Only if the country is in turmoil and things aren't going well,
+open the first one. That'll give you some advice on what to do. And, if
+after that, if things start getting REALLY bad, open the second one." And
+with a gasp Stalin breathed his last.
+ Well, within a few years Khruschev started having problems --
+unemployment increased, crops failed, people became restless. He decided it
+was time to open the first letter. All it said was: "Blame everything on me!"
+So Khruschev launched a massive deStalinization campaign, and blamed Stalin
+for all the excesses and purges and ills of the present system.
+ But things continued on the downslide, and, finally, after much
+deliberation, Khruschev opened the second letter.
+ All it said was: "Write two letters."
+%
+Stamp out organized crime!! Abolish the IRS.
+%
+Stamp out philately.
+%
+STANDARDS:
+ The principles we use to reject other people's code.
+%
+Standards are different for all things, so the standard set by man is by
+no means the only "certain" standard. If you mistake what is relative for
+something certain, you have strayed far from the ultimate truth.
+ -- Chuang Tzu
+%
+Standing on head makes smile of frown, but rest of face also upside down.
+%
+Stanford women are responsible for the success of many Stanford men:
+they give them "just one more reason" to stay in and study every night.
+%
+Star Wars is adolescent nonsense; Close Encounters is obscurantist drivel;
+Star Trek can turn your brains to puree of bat guano; and the greatest
+science fiction series of all time is Doctor Who! And I'll take you all
+on, one-by-one or all in a bunch to back it up!
+ -- Harlan Ellison
+%
+Start every day off with a smile and get it over with.
+ -- W. C. Fields
+%
+Start the day with a smile.
+After that you can be your nasty old self again.
+%
+State license plates we'd like to see:
+
+ NEVADA MASSACHUSETTS
+ LVME 10DR OW-A CAH
+LAND OF 10,00 ELVIS IMPERSONATORS THE GOOFY ACCENT STATE
+
+ HAWAII WISCONSIN
+ L-O HA CHEDDAR
+FRUITY UMBRELLA COCKTAIL WONDERLAND EAT CHEESE OR DIE
+%
+State license plates we'd like to see:
+
+ ALABAMA ARIZONA
+ IC1 NOW 120 F
+THE UFO SIGHTING STATE THE HEAT PROSTRATION STATE
+
+ CONNECTICUT MISSISSIPPI
+ 5:36 EXP 4I4S2PS
+WHERE THE SMART NY WORK FORCE LIVES THE MOST OFTEN MISSPELLED STATE
+
+ TEXAS FLORIDA
+ 1-2-3 HIKE ZON KED
+PLAY FOOTBALL OR DIE AMERICA'S DRUG DEALER
+%
+State license plates we'd like to see:
+
+ MICHIGAN CALIFORNIA
+ 4-GET 74-77 EGO-MN-E-X
+EMBARRASSED HOME STATE OF GERALD FORD THE SERIAL KILLER STATE
+
+ NORTH CAROLINA NEW JERSEY
+ WL-GOLLY ARG GGH
+HOME OF GOMER, GOOBER AND JESSE HELMS FIRST IN TOXIC WASTE
+
+ KANSAS WASHINGTON DC
+ TOTO -2 $10000000 ETC
+THE NOT MUCH SINCE THE WIZARD OF OZ WASTING YOUR MONEY SINCE 1810
+ MOVIE STATE
+%
+STATISTICS:
+ A system for expressing your political
+ prejudices in convincing scientific guise.
+%
+Statistics are no substitute for judgment.
+ -- Henry Clay
+%
+Statistics means never having to say you're certain.
+%
+Stay away from flying saucers today.
+%
+Stay away from hurricanes for a while.
+%
+Stay the curse.
+%
+Stay together, drag each other down.
+%
+Stayed in bed all morning just to pass the time,
+There's something wrong here, there can be no more denying,
+One of us is changing, or maybe we just stopped trying,
+
+And it's too late, baby, now, it's too late,
+Though we really did try to make it,
+Something inside has died and I can't hide and I just can't fake it...
+
+It used to be so easy living here with you,
+You were light and breezy and I knew just what to do
+Now you look so unhappy and I feel like a fool.
+
+There'll be good times again for me and you,
+But we just can't stay together, don't you feel it too?
+But I'm glad for what we had and that I once loved you...
+
+But it's too late baby...
+It's too late, now darling, it's too late...
+ -- Carol King, "Tapestry"
+%
+Steady movement is more important than speed, much of the time. So
+long as there is a regular progression of stimuli to get your mental
+hooks into, there is room for lateral movement. Once this begins,
+its rate is a matter of discretion.
+ -- Corwin, "Prince of Amber"
+%
+Stealing a rhinoceros should not be attempted lightly.
+%
+Steckel's Rule to Success:
+ Good enough is never good enough.
+%
+Steele's Plagiarism of Somebody's Philosophy:
+ Everybody should believe in something --
+ I believe I'll have another drink.
+%
+Steinbach's Guideline for Systems Programming:
+ Never test for an error condition you don't know how to
+handle.
+%
+Stellar rays prove fibbing never pays.
+Embezzlement is another matter.
+%
+Stenderup's Law:
+ The sooner you fall behind, the more time you will have to catch up.
+%
+Step back, unbelievers!
+Or the rain will never come.
+Somebody keep the fire burning, someone come and beat the drum.
+You may think I'm crazy, you may think that I'm insane,
+But I swear to you, before this day is out,
+ you folks are gonna see some rain!
+%
+Still a few bugs in the system... Someday I have to tell you about Uncle
+Nahum from Maine, who spent years trying to cross a jellyfish with a shad
+so he could breed boneless shad. His experiment backfired too, and he
+wound up with bony jellyfish... which was hardly worth the trouble. There's
+very little call for those up there.
+ -- Allucquere R. "Sandy" Stone
+%
+Still looking for the glorious results of my misspent youth.
+Say, do you have a map to the next joint?
+%
+Stinginess with privileges is kindness in disguise.
+ -- Guide to VAX/VMS Security, Sep. 1984
+%
+Stock's Observation:
+ You no sooner get your head above water
+ but what someone pulls your flippers off.
+%
+Stone's Law:
+ One man's "simple" is another man's "huh?"
+%
+Stop! There was first a game of blindman's buff. Of course there was.
+And I no more believe Topper was really blind than I believe he had eyes
+in his boots. My opinion is, that it was a done thing between him and
+Scrooge's nephew; and that the Ghost of Christmas Present knew it. The
+way he went after that plump sister in the lace tucker, was an outrage
+on the credulity of human nature.
+%
+Stop me, before I kill again!
+%
+Stop searching. Happiness is right next to you.
+Now, if they'd only take a bath...
+%
+Stop searching forever. Happiness is unattainable.
+%
+Strange things are done to be number one
+In selling the computer The Druids were entrepreneurs,
+IBM has their strategem And they built a granite box
+Which steadily grows acuter, It tracked the moon, warned of monsoons,
+And Honeywell competes like Hell, And forecast the equinox
+But the story's missing link Their price was right, their future
+Is the system old at Stonemenge sold bright,
+By the firm of Druids, Inc. The prototype was sold;
+ From Stonehenge site their bits and byte
+ Would ship for Celtic gold.
+The movers came to crate the frame;
+It weighed a million ton!
+The traffic folk thought it a joke The man spoke true, and thus to you
+(the wagon wheels just spun); A warning from the ages;
+"They'll nay sell that," the foreman Your stock will slip if you can't ship
+ spat, What's in your brochure's pages.
+"Just leave the wild weeds grow; See if it sells without the bells
+"It's Druid-kind, over-designed, And strings that ring and quiver;
+"And belly up they'll go." Druid repute went down the chute
+ Because they couldn't deliver.
+ -- Edward C. McManus, "The Computer at Stonehenge"
+%
+STRATEGY:
+ A comprehensive plan of inaction.
+%
+Strategy:
+ A long-range plan whose merit cannot be evaluated until sometime
+ after those creating it have left the organization.
+%
+Straw? No, too stupid a fad. I put soot on warts.
+%
+Stress has been pinpointed as a major cause of illness. To avoid overload
+and burnout, keep stress out of your life. Give it to others instead. Learn
+the "Gaslight" treatment, the "Are you talking to me?" technique, and the
+"Do you feel okay? You look pale." approach. Start with negotiation and
+implication. Advance to manipulation and humiliation. Above all, relax
+and have a nice day.
+%
+Stuckness shouldn't be avoided. It's the psychic predecessor of all
+real understanding. An egoless acceptance of stuckness is a key to an
+understanding of all Quality, in mechanical work as in other endeavors.
+ -- Robert Pirsig, "Zen and the Art of Motorcycle Maintenance"
+%
+Stult's Report:
+ Our problems are mostly behind us.
+ What we have to do now is fight the solutions.
+%
+Stupid, n.:
+ Losing $25 on the game and $25 on the instant replay.
+%
+Stupidity got us into this mess -- why can't it get us out?
+%
+Stupidity is its own reward.
+%
+Sturgeon's Law:
+ 90% of everything is crud.
+%
+Style may not be the answer, but at least it's a workable alternative.
+%
+Suaviter in modo, fortiter in re.
+Se non e vero, e ben trovato.
+%
+Substitute "damn" every time you're inclined to write "very"; your
+editor will delete it and the writing will be just as it should be.
+ -- Mark Twain
+%
+Subtlety is the art of saying what you think and getting out of the
+way before it is understood.
+%
+Suburbia is where the developer bulldozes out the trees, then names
+the streets after them.
+ -- Bill Vaughn
+%
+Success is a journey, not a destination.
+%
+Success is getting what you want; happiness is wanting what you get.
+%
+Success is in the minds of Fools.
+ -- William Wrenshaw, 1578
+%
+Success is relative: It is what we can make of the mess we have
+made of things.
+ -- T. S. Eliot, "The Family Reunion"
+%
+Success is something I will dress for when I get there, and not until.
+%
+Success is the sole earthly judge of right and wrong.
+ -- Adolf Hitler, "Mein Kampf"
+%
+Succumb to natural tendencies. Be hateful and boring.
+%
+Such a fine first dream!
+But they laughed at me; they said
+I had made it up.
+%
+Such a foolish notion, that war is called devotion,
+when the greatest warriors are the ones who stand for peace.
+%
+Such efforts are almost always slow, laborious, political,
+petty, boring, ponderous, thankless, and of the utmost criticality.
+ -- Leonard Kleinrock, on standards efforts
+%
+Such evil deeds could religion prompt.
+ -- Titus Lucretius Carus
+%
+Sudden Death Dating:
+
+Quote, female:
+ Am I worried about taking his last name? Forget it,
+ at this point I'll take his first name, too.
+%
+Suddenly, Professor Liebowitz realizes he has come to the seminar
+without his duck ...
+%
+Suffering alone exists, none who suffer;
+The deed there is, but no doer thereof;
+Nirvana is, but no one is seeking it;
+The Path there is, but none who travel it.
+ -- "Buddhist Symbolism", Symbols and Values
+%
+Suggest you just sit there and wait till life gets easier.
+%
+Suicide is simply a case of mistaken identity.
+%
+Suicide is the sincerest form of self-criticism.
+ -- Donald Kaul
+%
+Sum quod eris.
+%
+Sun in the night, everyone is together,
+Ascending into the heavens, life is forever.
+ -- Brand X, "Moroccan Roll/Sun in the Night"
+%
+SUN Microsystems:
+ The Network IS the Load Average.
+%
+(Sung to the tune of "The Impossible Dream" from MAN OF LA MANCHA)
+
+ To code the impossible code,
+ To bring up a virgin machine,
+ To pop out of endless recursion,
+ To grok what appears on the screen,
+
+ To right the unrightable bug,
+ To endlessly twiddle and thrash,
+ To mount the unmountable magtape,
+ To stop the unstoppable crash!
+%
+SUNSET:
+ Pronounced atmospheric scattering of shorter wavelengths,
+ resulting in selective transmission below 650 nanometers with
+ progressively reducing solar elevation.
+%
+Superstition, idolatry, and hypocrisy
+have ample wages, but truth goes a-begging.
+ -- Martin Luther
+%
+Superstitions typically involve seeing order where in fact there is
+none, and denial amounts to rejecting evidence of regularities,
+sometimes even ones that are staring us in the face.
+ -- Murray Gell-Mann, "Quark and the Jaguar"
+%
+Supervisor: Do you think you understand the basic ideas of Quantum Mechanics?
+Supervisee: Ah! Well, what do we mean by "to understand" in the context of
+ Quantum Mechanics?
+Supervisor: You mean "No", don't you?
+Supervisee: Yes.
+ -- Overheard at a supervision
+%
+Support bacteria -- it's the only culture some people have!
+%
+Support Bingo, keep Grandma off the streets.
+%
+Support mental health or I'LL KILL YOU!!!!
+%
+Support the American Kidney Foundation.
+Don't wear your motorcycle helmet.
+%
+Support the Girl Scouts!
+ (Today's Brownie is tomorrow's Cookie!)
+%
+Support wildlife -- vote for an orgy.
+%
+Support your local church or synagogue.
+Worship at Bank of America.
+%
+Support your local police force -- steal!!
+%
+Support your local Search and Rescue unit -- get lost.
+%
+Support your right to arm bears!!
+%
+Support your right to bare arms!
+ -- A message from the National Short-Sleeved Shirt Association
+%
+Suppose for a moment that the automobile industry had developed at the same
+rate as computers and over the same period: how much cheaper and more
+efficient would the current models be? If you have not already heard the
+analogy, the answer is shattering. Today you would be able to buy a
+Rolls-Royce for $2.75, it would do three million miles to the gallon, and
+it would deliver enough power to drive the Queen Elizabeth II. And if you
+were interested in miniaturization, you could place half a dozen of them on
+a pinhead.
+ -- Christopher Evans
+%
+Sure he's sharp as a razor ... he's a two-dimensional pinhead!
+%
+Sure, Reagan has promised to take senility tests.
+But what if he forgets?
+%
+Sure there are dishonest men in local government. But there are dishonest
+men in national government too.
+ -- Richard M. Nixon
+%
+Surly to bed, surly to rise, makes you about average.
+%
+Surprise! You are the lucky winner of random I.R.S Audit!
+Just type in your name and social security number.
+Please remember that leaving the room is punishable under law:
+
+Name #
+
+
+%
+Surprise due today. Also the rent.
+%
+Surprise your boss. Get to work on time.
+%
+Sushi, n.:
+ When that-which-may-still-be-alive is put on top of rice and
+ strapped on with electrical tape.
+%
+Sushido, n.:
+ The way of the tuna.
+%
+Suspicion always haunts the guilty mind.
+ -- William Shakespeare
+%
+Swahili, n.:
+ The language used by the National Enquirer to print their
+retractions.
+ -- Johnny Hart
+%
+Swap read error. You lose your mind.
+%
+SWEATER:
+ A garment worn by a child when their mother feels chilly.
+%
+Sweater, n.:
+ A garment worn by a child when its mother feels chilly.
+%
+Sweet April showers do spring May flowers.
+ -- Thomas Tusser
+%
+Sweet sixteen is beautiful Bess,
+And her voice is changing -- from "No" to "Yes".
+%
+Swerve me? The path to my fixed purpose is laid with iron rails,
+whereon my soul is grooved to run. Over unsounded gorges, through
+the rifled hearts of mountains, under torrents' beds, unerringly
+I rush!
+ -- Captain Ahab, "Moby Dick"
+%
+Swipple's Rule of Order:
+ He who shouts the loudest has the floor.
+%
+Symbolic representation of quantitative entities is doomed to its rightful
+place of minor importance in a world where flowers and beautiful women abound.
+ -- Albert Einstein
+%
+Symptom: Drinking fails to give taste and satisfaction, beer is
+ unusually pale and clear.
+Problem: Glass empty.
+Action Required: Find someone who will buy you another beer.
+
+Symptom: Drinking fails to give taste and satisfaction,
+ and the front of your shirt is wet.
+Fault: Mouth not open when drinking or glass applied to
+ wrong part of face.
+Action Required: Buy another beer and practice in front of mirror.
+ Drink as many as needed to perfect drinking technique.
+
+ -- Bar Troubleshooting
+%
+Symptom: Everything has gone dark.
+Fault: The Bar is closing.
+Action Required: Panic.
+
+Symptom: You awaken to find your bed hard, cold and wet.
+ You cannot see the bathroom light.
+Fault: You have spent the night in the gutter.
+Action Required: Check your watch to see if bars are open yet. If not,
+ treat yourself to a lie-in.
+
+ -- Bar Troubleshooting
+%
+Symptom: Feet cold and wet, glass empty.
+Fault: Glass being held at incorrect angle.
+Action Required: Turn glass other way up so that open end points
+ toward ceiling.
+
+Symptom: Feet warm and wet.
+Fault: Improper bladder control.
+Action Required: Go stand next to nearest dog. After a while complain
+ to the owner about its lack of house training and
+ demand a beer as compensation.
+
+ -- Bar Troubleshooting
+%
+Symptom: Floor blurred.
+Fault: You are looking through bottom of empty glass.
+Action Required: Find someone who will buy you another beer.
+
+Symptom: Floor moving.
+Fault: You are being carried out.
+Action Required: Find out if you are taken to another bar. If not,
+ complain loudly that you are being kidnaped.
+
+ -- Bar Troubleshooting
+%
+Symptom: Floor swaying.
+Fault: Excessive air turbulence, perhaps due to air-hockey
+ game in progress.
+Action Required: Insert broom handle down back of jacket.
+
+Symptom: Everything has gone dim, strange taste of peanuts
+ and pretzels or cigarette butts in mouth.
+Fault: You have fallen forward.
+Action Required: See above.
+
+Symptom: Opposite wall covered with acoustic tile and several
+ fluorescent light strips.
+Fault: You have fallen over backward.
+Action Required: If your glass is full and no one is standing on your
+ drinking arm, stay put. If not, get someone to help
+ you get up, lash yourself to bar.
+
+ -- Bar Troubleshooting
+%
+Syntactic sugar causes cancer of the semicolon.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+System checkpoint complete.
+%
+System going down at 1:45 this afternoon for disk crashing.
+%
+System going down at 5 this afternoon to install scheduler bug.
+%
+System going down in 5 minutes.
+%
+System restarting, wait...
+%
+System/3! System/3!
+See how it runs! See how it runs!
+ Its monitor loses so totally!
+ It runs all its programs in RPG!
+ It's made by our favorite monopoly!
+System/3!
+%
+SYSTEM-INDEPENDENT:
+ Works equally poorly on all systems.
+%
+Systems have sub-systems and sub-systems have sub-systems and so on ad
+infinitum -- which is why we're always starting over.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+Systems programmer:
+ A person in sandals who has been in the elevator with the senior
+ vice president and is ultimately responsible for a phone call you
+ are to receive from your boss.
+%
+Systems programmers are the high priests of a low cult.
+ -- R. S. Barton
+%
+T: One big monster, he called TROLL.
+ He don't rock, and he don't roll;
+ Drink no wine, and smoke no stogies.
+ He just Love To Eat Them Roguies.
+ -- The Roguelet's ABC
+%
+TACKY:
+ Serving grape Kool-Aid at religious functions.
+%
+Tact consists in knowing how far to go in going too far.
+ -- Jean Cocteau
+%
+Tact in audacity is knowing how far you can go without going too far.
+ -- Jean Cocteau
+%
+Tact is the ability to tell a man he has
+an open mind when he has a hole in his head.
+%
+Tact is the art of making a point without making an enemy.
+%
+Tact, n.:
+ The unsaid part of what you're thinking.
+%
+Take a lesson from the whale; the only time
+he gets speared is when he raises to spout.
+%
+Take an astronaut to launch.
+%
+Take care of the luxuries and the
+necessities will take care of themselves.
+ -- L. Long
+%
+Take Care of the Molehills, and the Mountains Will Take Care of Themselves.
+ -- Motto of the Federal Civil Service
+%
+Take everything in stride.
+Trample anyone who gets in your way.
+%
+TAKE FORCEFUL ACTION:
+ Do something that should have been done a long time ago.
+%
+Take heart amid the deepening gloom that your dog is finally getting
+enough cheese.
+ -- National Lampoon, "Deteriorata"
+%
+Take it easy, we're in a hurry.
+%
+Take me drunk,
+I'm home again!
+%
+Take my word for it, the silliest woman can manage a clever man,
+but it needs a very clever woman to manage a fool.
+ -- Kipling
+%
+Take time to reflect on all the things you have, not as a result of your
+merit or hard work or because God or chance or the efforts of other people
+have given them to you.
+%
+Take what you can use and let the rest go by.
+ -- Ken Kesey
+%
+Take your dying with some seriousness, however.
+Laughing on the way to your execution is not generally understood
+by less-advanced life-forms, and they'll call you crazy.
+ -- "Messiah's Handbook: Reminders for the Advanced Soul"
+%
+Take your Senator to lunch this week.
+%
+Take your work seriously but never take yourself seriously; and do not
+take what happens either to yourself or your work seriously.
+ -- Booth Tarkington
+%
+Taking drugs in the 60's, I tried to reach Nirvana, but all I ever
+got were re-runs of The Mickey Mouse Club.
+ -- Rev. Jim
+%
+Talk is cheap because supply always exceeds demand.
+%
+Talk sense to a fool and he calls you foolish.
+ -- Euripides
+%
+Talkers are no good doers.
+ -- William Shakespeare, "Henry VI"
+%
+Talking about music is like dancing about architecture.
+ -- Laurie Anderson
+%
+Talking much about oneself can also be a means to conceal oneself.
+ -- Friedrich Nietzsche
+%
+Tallulah Bankhead barged down the
+Nile last night as Cleopatra and sank.
+ -- John Mason Brown, drama critic
+%
+Tan me hide when I'm dead, Fred,
+Tan me hide when I'm dead.
+So we tanned his hide when he died, Clyde,
+It's hanging there on the shed.
+
+All together now...
+ Tie me kangaroo down, sport,
+ Tie me kangaroo down.
+ Tie me kangaroo down, sport,
+ Tie me kangaroo down.
+%
+Tart words make no friends; a spoonful of honey
+will catch more flies than a gallon of vinegar.
+ -- Benjamin Franklin
+%
+TAURUS (Apr 20 - May 20)
+ You are practical and persistent. You have a dogged determination
+ and work like hell. Most people think you are stubborn and bull
+ headed. You are a Communist.
+%
+TAURUS (Apr. 20 to May 20)
+ Let your self-confidence and determination shine, and people will
+ find you boorish and headstrong. Travel, promotion, and romance
+ highlighted, if you live long enough. Don't take any wooden nickels.
+%
+TAURUS (Apr.20 - May 20)
+ Take advantage of this opportunity to get a little extra sleep,
+ because you're going to miss the bus again today anyway. You will
+ decide to lose weight today, just like yesterday.
+%
+TAX OFFICE:
+ Den of inequity.
+%
+Tax reform means "Don't tax you, don't
+tax me, tax that fellow behind the tree."
+ -- Russell Long
+%
+Taxes are going up so fast, the government is likely to price itself
+out of the market.
+%
+Taxes are not levied for the benefit of the taxed.
+%
+Taxes, n.:
+ Of life's two certainties, the only one for which you can get
+ an extension.
+%
+TCP/IP Slang Glossary, #1:
+
+Gong, n: Medieval term for privvy, or what passed for them in that era.
+Today used whimsically to describe the aftermath of a bogon attack. Think
+of our community as the Galapagos of the English language.
+
+Vogons may read you bad poetry, but bogons make you study obsolete RFCs.
+ -- Dave Mills
+%
+Teach children to be polite and courteous in the home, and,
+when they grow up, they won't be able to edge a car onto a freeway.
+%
+Teachers have class.
+%
+TEAMWORK:
+ Having someone to blame.
+%
+Teamwork is essential -- it allows you to blame someone else.
+%
+Technicality, n.:
+ In an English court a man named Home was tried for slander in
+ having accused a neighbor of murder. His exact words were: "Sir
+ Thomas Holt hath taken a cleaver and stricken his cook upon the
+ head, so that one side of his head fell on one shoulder and the
+ other side upon the other shoulder." The defendant was
+ acquitted by instruction of the court, the learned judges
+ holding that the words did not charge murder, for they did not
+ affirm the death of the cook, that being only an inference.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+"Technique?" said the programmer turning from his terminal, "What I follow
+is Tao -- beyond all technique! When I first began to program I would see
+before me the whole problem in one mass. After three years I no longer saw
+this mass. Instead, I used subroutines. But now I see nothing. My whole
+being exists in a formless void. My senses are idle. My spirit, free to
+work without plan, follows its own instinct. In short, my program writes
+itself. True, sometimes there are difficult problems. I see them coming, I
+slow down, I watch silently. Then I change a single line of code and the
+difficulties vanish like puffs of idle smoke. I then compile the program.
+I sit still and let the joy of the work fill my being. I close my eyes for
+a moment and then log off."
+%
+Technological progress has merely provided us
+with more efficient means for going backwards.
+ -- Aldous Huxley
+%
+Teeth for meat are in the mouth --
+Teeth for humans are in the soul.
+A strong body defeats one,
+A strong soul conquers many.
+ -- Chinggis (Genghis) Khan
+%
+Tehee quod she, and clapte the wyndow to.
+ -- Geoffrey Chaucer
+%
+Telephone books are like dictionaries -- if you know the answer before
+you look it up, you can eventually reaffirm what you thought you knew
+but weren't sure. But if you're searching for something you don't
+already know, your fingers could walk themselves to death.
+ -- Erma Bombeck
+%
+Telephone, n.:
+ An invention of the devil which abrogates some of the advantages of
+ making a disagreeable person keep his distance.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Telepression, n.:
+ The deep-seated guilt which stems from knowing that you did not
+ try hard enough to look up the number on your own and instead
+ put the burden on the directory assistant.
+ -- Rich Hall & Friends, "Sniglets"
+%
+Television -- a medium. So called because it is neither rare nor well done.
+ -- Ernie Kovacs
+%
+Television -- the longest amateur night in history.
+ -- Robert Carson
+%
+Television has brought back murder into the home -- where it belongs.
+ -- Alfred Hitchcock
+%
+Television has proved that people will look at anything rather than
+each other.
+ -- Ann Landers
+%
+Television is a medium because anything well done is rare.
+ -- attributed to both Fred Allen and Ernie Kovacs
+%
+Television is now so desperately hungry for material
+that it is scraping the top of the barrel.
+ -- Gore Vidal
+%
+Television only proves that people will look at anything --
+rather than each other.
+%
+Tell a man there are 300 billion stars in the universe and he'll
+believe you. Tell him a bench has wet paint on it and he'll have
+to touch to be sure.
+%
+Tell me, O Octopus, I begs,
+Is those things arms, or is they legs?
+I marvel at thee, Octopus;
+If I were thou, I'd call me us.
+ -- Ogden Nash
+%
+Tell me what to think!!!
+%
+Tell me why the stars do shine,
+Tell me why the ivy twines,
+Tell me why the sky's so blue,
+And I will tell you just why I love you.
+
+ Nuclear fusion makes stars to shine,
+ Phototropism makes ivy twine,
+ Rayleigh scattering makes sky so blue,
+ Sexual hormones are why I love you.
+%
+Telling the truth to people who misunderstand you is generally
+promoting a falsehood, isn't it?
+ -- A. Hope
+%
+Tempt me with a spoon!
+%
+Tempt not a desperate man.
+ -- William Shakespeare, "Romeo and Juliet"
+%
+Ten of the meanest cons in the state pen met in the corner of the yard to
+shoot some craps. The stakes were enormous, the tension palpable.
+ When his turn came to shoot, Dutsky nervously plunked down his
+entire wad, shook the dice and rolled. A smile crossed his face as a
+seven showed up, but it quickly changed to horror as third die slipped out
+of his sleeve and fell to the ground with the two others. No one said a
+word. Finally, Killer Lucci picked up the third die, put it in his pocket
+and handed the others to Dutsky.
+ "Roll 'em," Lucci said. "Your point is thirteen."
+%
+Ten persons who speak make more noise than ten thousand who are silent.
+ -- Napoleon I
+%
+Ten years of rejection slips is nature's
+way of telling you to stop writing.
+ -- R. Geis
+%
+Terence, this is stupid stuff:
+You eat your victuals fast enough;
+There can't be much amiss, 'tis clear,
+To see the rate you drink your beer.
+But oh, good Lord, the verse you make,
+It gives a chap the belly-ache.
+The cow, the old cow, she is dead;
+It sleeps well the horned head:
+We poor lads, 'tis our turn now
+To hear such tunes as killed the cow.
+Pretty friendship 'tis to rhyme
+Your friends to death before their time.
+Moping, melancholy mad:
+Come, pipe a tune to dance to, lad.
+ -- A. E. Housman
+%
+Term, holidays, term, holidays, till we leave
+school, and then work, work, work till we die.
+ -- C. S. Lewis
+%
+Termiter's argument that God is His own grandmother generated a surprising
+amount of controversy among Church leaders, who on the one hand considered
+the argument unsupported by scripture but on the other hand were unwilling
+to risk offending God's grandmother.
+ -- Len Cool, "American Pie"
+%
+Tertullian was born in Carthage somewhere about 160 A.D. He was a
+pagan, and he abandoned himself to the lascivious life of his city until
+about his 35th year, when he became a Christian. [...] To him is
+ascribed the sublime confession: Credo quia absurdum est (I believe
+because it is absurd). This does not altogether accord with historical
+fact, for he merely said: "And the Son of God died, which is immediately
+credible because it is absurd. And buried he rose again, which is
+certain because it is impossible." Thanks to the acuteness of his mind,
+he saw through the poverty of philosophical and Gnostic knowledge, and
+contemptuously rejected it.
+ -- Carl G. Jung, "Psychological Types"
+ [Tertullian was one of the founders of the Catholic
+ Church. Ed.]
+%
+Test for paraquat:
+ Take amount of grass used in one joint, and wash in 5 cc's
+ of water, agitating gently for 15 minutes. Strain out leaves,
+ leaving a brownish-yellow solution. Add 100 mg each of sodium
+ bicarbonate and sodium dithionite. If paraquat is present,
+ the solution will turn blue-green.
+%
+Testing can show the presence of bugs, but not their absence.
+ -- Edsger W. Dijkstra
+%
+Test-tube babies shouldn't throw stones.
+%
+TEUTONIC:
+ Not enough gin.
+%
+TEX is potentially the most significant invention in typesetting in this
+century. It introduces a standard language for computer typography, and in
+terms of importance could rank near the introduction of the Gutenberg press.
+ -- Gordon Bell
+%
+Texas A&M football coach Jackie Sherrill went to the office of the Dean
+of Academics because he was concerned about his players' mental abilities.
+"My players are just too stupid for me to deal with them", he told the
+unbelieving dean. At this point, one of his players happened to enter
+the dean's office. "Let me show you what I mean", said Sherrill, and he
+told the player to run over to his office to see if he was in. "OK, Coach",
+the player replied, and was off. "See what I mean?" Sherrill asked.
+"Yeah", replied the dean. "He could have just picked up this phone and
+called you from here."
+%
+Texas is Hell on woman and horses.
+ -- Wayne Oakes
+%
+Texas law forbids anyone to have a pair of pliers in his possession.
+%
+Text processing has made it possible to right-justify any idea, even
+one which cannot be justified on any other grounds.
+ -- J. Finnegan, USC
+%
+Thank God I've always avoided persecuting my enemies.
+ -- Adolf Hitler
+%
+Thank goodness modern convenience is a thing of the remote future.
+ -- Pogo, by Walt Kelly
+%
+Thank you for observing all safety precautions.
+%
+That all men should be brothers is the dream of people who have no brothers.
+ -- Charles Chincholles, "Pensees de tout le monde"
+%
+That boy's about as sharp as a pound of wet liver.
+ -- Foghorn Leghorn
+%
+That does not compute.
+%
+...that FC loop thing sucks.
+So I decided to stick to my good old philosophy: "if it has tits,
+wheels or FC loops it will give you problem!"
+ -- storage engineer on the virtues of FC-AL
+%
+That feeling just came over me.
+ -- Albert DeSalvo, the "Boston Strangler"
+%
+That government is best which governs least.
+ -- Henry David Thoreau, "Civil Disobedience"
+%
+That is the true season of love, when we believe that we alone can love,
+that no one could have loved so before us, and that no one will love
+in the same way as us.
+ -- Johann Wolfgang von Goethe
+%
+That money talks,
+I'll not deny,
+I heard it once,
+It said "Good-bye.
+ -- Richard Armour
+%
+That must be wonderful: I don't understand it at all.
+ -- Moliere
+%
+That secret you've been guarding, isn't.
+%
+That segment of the community with which one has the greatest
+sympathy as a liberal, inevitably turns out to be one of the most
+narrow-minded and bigoted segments of the community.
+%
+That, that is, is.
+That, that is not, is not.
+That, that is, is not that, that is not.
+That, that is not, is not that, that is.
+%
+...that the notions of "hardware", and "software" should be extended by
+the notion of LIVEWARE - being that which produces software for use on
+hardware. This produces an obvious extension to the concept of MONITORS.
+A liveware monitor is a person dedicated to the task of ensuring that the
+liveware does not interfere with the real-time processes, invoking the
+REAL-TIME EXECUTIONER to delete liveware that adversely affects ...
+ -- Linden and Wihelminalaan
+%
+That which is not good for the swarm, neither is it good for the bee.
+%
+That woman speaks eight languages and can't say "no" in any of them.
+ -- Dorothy Parker
+%
+That Xanthippe's husband should have become so great a philosopher is
+remarkable. Amid all the scolding, to be able to think! But he could not
+write: that was impossible. Socrates has not left us a single book.
+ -- Heine
+%
+That's always the way when you discover
+something new; everyone thinks you're crazy.
+ -- Evelyn E. Smith
+%
+That's life.
+ What's life?
+A magazine.
+ How much does it cost?
+Two-fifty.
+ I only have a dollar.
+That's life.
+%
+That's life for you, said McDunn. Someone always waiting for someone
+who never comes home. Always someone loving something more than that
+thing loves them. And after awhile you want to destroy whatever that
+thing is, so it can't hurt you no more.
+ -- Ray Bradbury, "The Fog Horn"
+%
+"That's no answer," Job said, "And for someone who's supposed to be
+omnipotent, let me tell you `tabernacle' has only one l."
+ -- Woody Allen, "Without Feathers"
+%
+That's no moon...
+ -- Obi-wan Kenobi
+%
+That's odd. That's very odd.
+Wouldn't you say that's very odd?
+%
+That's one small step for a man; one giant leap for mankind.
+ -- Neil Armstrong
+%
+That's the most fun I've had without laughing.
+ -- Woody Allen, on sex
+%
+That's the thing about people who think they hate computers. What they
+really hate is lousy programmers.
+ -- Larry Niven and Jerry Pournelle in "Oath of Fealty"
+%
+That's the true harbinger of spring, not crocuses or swallows
+returning to Capistrano, but the sound of a bat on a ball.
+ -- Bill Veeck
+%
+That's what she said.
+%
+That's where the money was.
+ -- Willie Sutton, on being asked why he robbed a bank
+
+It's a rather pleasant experience to be alone in a bank at night.
+ -- Willie Sutton
+%
+The 11 is for people with the pride of a 10 and the pocketbook of an 8.
+ -- R. B. Greenberg
+%
+The 357.73 Theory --
+ Auditors always reject expense accounts
+ with a bottom line divisible by 5.
+%
+The 80's -- when you can't tell hairstyles from chemotherapy.
+%
+The 'A' is for content, the 'minus' is for not typing it.
+Don't ever do this to my eyes again.
+ -- Professor Ronald Brady, Philosophy, Ramapo State College
+%
+The Abrams' Principle:
+ The shortest distance between two points is off the wall.
+%
+The absence of labels [in ECL] is probably a good thing.
+ -- T. Cheatham
+%
+The absent ones are always at fault.
+%
+The absurd is the essential concept and the first truth.
+ -- A. Camus
+%
+The abuse of greatness is when it disjoins remorse from power.
+ -- William Shakespeare, "Julius Caesar"
+%
+The adjective is the banana peel of the parts of speech.
+ -- Clifton Fadiman
+%
+The adjuration to be "normal" seems shockingly repellent to me; I see neither
+hope nor comfort in sinking to that low level. I think it is ignorance that
+makes people think of abnormality only with horror and allows them to remain
+undismayed at the proximity of "normal" to average and mediocre. For surely
+anyone who achieves anything is, essentially, abnormal.
+ -- Dr. Karl Menninger, "The Human Mind", 1930
+%
+The advantage of being celibate is that when one sees a pretty girl one
+does not need to grieve over having an ugly one back home.
+ -- Paul Leautaud, "Propos dun jour"
+%
+The advertisement is the most truthful part of a newspaper
+ -- Thomas Jefferson
+%
+The Advertising Agency Song:
+
+ When your client's hopping mad,
+ Put his picture in the ad.
+ If he still should prove refractory,
+ Add a picture of his factory.
+%
+The aim of a joke is not to degrade the human being but to remind him that
+he is already degraded.
+ -- George Orwell
+%
+The aim of science is to seek the simplest explanations of complex
+facts. Seek simplicity and distrust it.
+ -- Whitehead
+%
+The alarm clock that is louder than God's own
+belongs to the roommate with the earliest class.
+%
+The algorithm for finding the longest path in a graph is NP-complete.
+For you systems people, that means it's *real slow*.
+ -- Bart Miller
+%
+The algorithm to do that is extremely nasty. You might want to mug
+someone with it.
+ -- M. Devine, Computer Science 340
+%
+The all-softening overpowering knell,
+The tocsin of the soul, -- the dinner bell.
+ -- Lord Byron
+%
+The Almighty in His infinite wisdom did not see
+fit to create Frenchmen in the image of Englishmen.
+ -- Winston Churchill, 1942
+%
+The American Dental Association announced today that most plaque tends
+to form on teeth around 4:00 PM in the afternoon.
+
+Film at 11:00.
+%
+The American nation in the sixth ward is a fine people; they love the
+eagle -- on the back of a dollar.
+ -- Finley Peter Dunne
+%
+The American system of ours, call it Americanism, call it Capitalism,
+call it what you like, gives each and every one of us a great
+opportunity if we only seize it with both hands and make the most of it.
+ -- Al Capone
+%
+The amount of time between slipping on the peel and landing on the
+pavement is precisely 1 bananosecond.
+%
+The amount of weight an evangelist carries with the almighty is measured
+in billigrahams.
+%
+The Analytical Engine weaves Algebraical patterns
+just as the Jacquard loom weaves flowers and leaves.
+ -- Ada Augusta, Countess of Lovelace, the first programmer
+%
+The Anarchists' [national] anthem is an international anthem that consists
+of 365 raspberries blown in very quick succession to the tune of "Camptown
+Races". Nobody has to stand up for it, nobody has to listen to it, and,
+even better, nobody has to play it.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+The Ancient Doctrine of Mind Over Matter:
+ I don't mind... and you don't matter.
+
+ -- As revealed to reporter G. Rivera by Swami Havabanana
+%
+The Angels want to wear my red shoes.
+ -- E. Costello
+%
+The anger of a woman is the greatest evil
+with which you can threaten your enemies.
+ -- Bonnard
+%
+The Anglo-Saxon conscience does not prevent the Anglo-Saxon from
+sinning, it merely prevents him from enjoying his sin.
+ -- Salvador De Madariaga
+%
+The angry man always thinks he can do more than he can.
+ -- Albertano of Brescia
+%
+The animals are not as stupid as one thinks -- they have neither
+doctors nor lawyers.
+ -- L. Docquier
+%
+The annual meeting of the "You Have To Listen To Experience" Club is now in
+session. Our Achievement Awards this year are in the fields of publishing,
+advertising and industry. For best consistent contribution in the field of
+publishing our award goes to editor, R. L. K., [...] for his unrivaled alle-
+giance without variation to the statement: "Personally I'd love to do it,
+we'd ALL love to do it. But we're not going to do it. It's not the kind of
+book our house knows how to handle." Our superior performance award in the
+field of advertising goes to media executive, E. L. M., [...] for the continu-
+ally creative use of the old favorite: "I think what you've got here could be
+very exciting. Why not give it one more try based on the approach I've out-
+lined and see if you can come up with something fresh." Our final award for
+courageous holding action in the field of industry goes to supervisor, R. S.,
+[...] for her unyielding grip on "I don't care if they fire me, I've been
+arguing for a new approach for YEARS but are we SURE that this is the right
+time--" I would like to conclude this meeting with a verse written specially
+for our prospectus by our founding president fifty years ago -- and now, as
+then, fully expressive of the emotion most close to all our hearts --
+ Treat freshness as a youthful quirk,
+ And dare not stray to ideas new,
+ For if t'were tried they might e'en work
+ And for a living what woulds't we do?
+%
+The answer is that libdialog, the library on which sysinstall depends
+for these menus, is genuinely evil. It is the unloved, satanic
+bastard child of multiple parents and torturing users like yourself
+constitutes the only joy in life it has left. Its source files are
+all chmod'd 0666 and dire README files warn against trespass by
+neophyte programmers. It is the 7th gate of Hell. It makes the baby
+Jesus cry. Were libdialog given anthropomorphic representation, it
+would be promptly burnt at the stake and its ashes scattered in the
+desert, to be then doused with holy water from altitude by
+fire-fighting aircraft.
+
+ -- Jordan K. Hubbard on the evils of libdialog
+%
+The answer to the question of Life, the Universe, and Everything is...
+
+ Four day work week,
+ Two ply toilet paper!
+%
+The answer to the Ultimate Question of Life, the Universe, and Everything was
+released with the kind permission of the Amalgamated Union of Philosophers,
+Sages, Luminaries, and Other Professional Thinking Persons.
+%
+The ark lands after The Flood. Noah lets all the animals out. Says he, "Go
+and multiply." Several months pass. Noah decides to check up on the animals.
+All are doing fine except a pair of snakes. "What's the problem?" says Noah.
+"Cut down some trees and let us live there", say the snakes. Noah follows
+their advice. Several more weeks pass. Noah checks on the snakes again.
+Lots of little snakes, everybody is happy. Noah asks, "Want to tell me how
+the trees helped?" "Certainly", say the snakes. "We're adders, and we need
+logs to multiply."
+%
+The arms business is founded on human folly, that is why its depths will
+never be plumbed and why it will go on forever. All weapons are defensive
+and all spare parts are non-lethal. The plainest print cannot be read
+through a solid gold sovereign, or a ruble or a golden eagle.
+ -- Sam Cummings, American arms dealer
+%
+The Army has carried the American ... ideal to its logical conclusion.
+Not only do they prohibit discrimination on the grounds of race, creed
+and color, but also on ability.
+ -- T. Lehrer
+%
+The Army needs leaders the way a foot needs a big toe.
+ -- Bill Murray
+%
+The assertion that "all men are created equal" was of no practical use
+in effecting our separation from Great Britain and it was placed in the
+Declaration not for that, but for future use.
+ -- Abraham Lincoln
+%
+The astronomer Francesco Sizi, a contemporary of Galileo, argues that
+Jupiter can have no satellites:
+
+ There are seven windows in the head, two nostrils, two ears, two
+eyes, and a mouth; so in the heavens there are two favorable stars, two
+unpropitious, two luminaries, and Mercury alone undecided and indifferent.
+From which and many other similar phenomena of nature such as the seven
+metals, etc., which it were tedious to enumerate, we gather that the number
+of planets is necessarily seven. [...]
+ Moreover, the satellites are invisible to the naked eye and
+therefore can have no influence on the earth and therefore would be useless
+and therefore do not exist.
+%
+The attacker must vanquish; the defender need only survive.
+%
+The average girl would rather have beauty than brains because she
+knows that the average man can see much better than he can think.
+ -- Ladies' Home Journal
+%
+The average, healthy, well-adjusted adult gets up at seven-thirty in
+the morning feeling just terrible.
+ -- Jean Kerr
+%
+The average income of the modern teenager is about 2AM.
+%
+The average individual's position in any hierarchy is a lot like pulling
+a dogsled -- there's no real change of scenery except for the lead dog.
+%
+The average nutritional value of promises is roughly zero.
+%
+The average Ph.D thesis is nothing but the transference of bones from
+one graveyard to another.
+ -- J. Frank Dobie, "A Texan in England"
+%
+The average woman must inevitably view her actual husband with a certain
+disdain; he is anything but her ideal. In consequence, she cannot help
+feeling that her children are cruelly handicapped by the fact that he is
+their father.
+ -- H. L. Mencken
+%
+The average woman would rather have beauty than brains, because the
+average man can see better than he can think.
+%
+The avocation of assessing the failures of better men can be turned
+into a comfortable livelihood, providing you back it up with a Ph.D.
+ -- Nelson Algren, "Writers at Work"
+%
+The avoidance of taxes is the only intellectual pursuit that
+carries any reward.
+ -- John Maynard Keynes
+%
+The bad reputation UNIX has gotten is totally undeserved, laid on by
+people who don't understand, who have not gotten in there and tried
+anything.
+ -- Jim Joyce, owner of Jim Joyce's UNIX Bookstore
+%
+The bank called to tell me that I'm overdrawn,
+Some freaks are burning crosses out on my front lawn,
+And I *can't*believe* it, all the Cheetos are gone,
+ It's just ONE OF THOSE DAYS!
+ -- Weird Al Yankovic, "One of Those Days"
+%
+The bank sent our statement this morning,
+The red ink was a sight of great awe!
+Their figures and mine might have balanced,
+But my wife was too quick on the draw.
+%
+The basic idea behind malls is that they are more convenient than
+cities. Cities contain streets, which are dangerous and crowded and
+difficult to park in. Malls, on the other hand, have parking lots,
+which are also dangerous and crowded and difficult to park in, but --
+here is the big difference -- in mall parking lots, THERE ARE NO
+RULES. You're allowed to do anything. You can drive as fast as you
+want in any direction you want. I was once driving in a mall parking
+lot when my car was struck by a pickup truck being driven backward by a
+squat man with a tattoo that said "Charlie" on his forearm, who got out
+and explained to me, in great detail, why the accident was my fault,
+his reasoning being that he was violent and muscular, whereas I was
+neither. This kind of reasoning is legally valid in mall parking
+lots.
+ -- Dave Barry, "Christmas Shopping: A Survivor's Guide"
+%
+The basic menu item, in fact the ONLY menu item, would be a food unit
+called the "patty," consisting of -- this would be guaranteed in
+writing -- "100 percent animal matter of some kind." All patties would
+be heated up and then cooled back down in electronic devices
+immediately before serving. The Breakfast Patty would be a patty on a
+bun with lettuce, tomato, onion, egg, Ba-Ko-Bits, Cheez Whiz, a Special
+Sauce made by pouring ketchup out of a bottle and a little slip of
+paper stating: "Inspected by Number 12". The Lunch or Dinner Patty
+would be any Breakfast Patties that didn't get sold in the morning.
+The Seafood Lover's Patty would be any patties that were starting to
+emit a serious aroma. Patties that were too rank even to be Seafood
+Lover's Patties would be compressed into wads and sold as "Nuggets."
+ -- Dave Barry, "'Mister Mediocre' Restaurants"
+%
+The bay-trees in our country are all wither'd
+And meteors fright the fixed stars of heaven;
+The pale-faced moon looks bloody on the earth
+And lean-look'd prophets whisper fearful change.
+These signs forerun the death or fall of kings.
+ -- William Shakespeare, "Richard II"
+%
+THE BEATLES:
+ Paul McCartney's old back-up band.
+%
+The beer-cooled computer does not harm the ozone layer.
+ -- John M. Ford, a.k.a. Dr. Mike
+
+ [If I can read my notes from the Ask Dr. Mike session at Baycon, I
+ believe he added that the beer-cooled computer uses "Forget Only
+ Memory". Ed.]
+%
+The best audience is intelligent, well-educated and a little drunk.
+ -- Maurice Baring
+%
+The best book on programming for the layman is "Alice in Wonderland";
+but that's because it's the best book on anything for the layman.
+%
+The best case: Get salary from America, build a house in England,
+ live with a Japanese wife, and eat Chinese food.
+Pretty good case: Get salary from England, build a house in America,
+ live with a Chinese wife, and eat Japanese food.
+The worst case: Get salary from China, build a house in Japan,
+ live with a British wife, and eat American food.
+ -- Bungei Shunju, a popular Japanese magazine
+%
+The best cure for insomnia is to get a lot of sleep.
+ -- W. C. Fields
+%
+The best defense against logic is ignorance.
+%
+The best definition of a gentleman is a man who can play the accordion --
+but doesn't.
+ -- Tom Crichton
+%
+The best diplomat I know is a fully activated phaser bank.
+ -- Scotty
+%
+The best equipment for your work is, of course, the most expensive.
+However, your neighbor is always wasting money that should be yours
+by judging things by their price.
+%
+The best executive is one who has sense enough to pick good people to do
+what he wants done, and self-restraint enough to keep from meddling with
+them while they do it.
+ -- Theodore Roosevelt
+%
+The best laid plans of mice and men are held up in the legal department.
+%
+The best laid plans of mice and men are usually about equal.
+ -- Blair
+%
+The best man for the job is often a woman.
+%
+The best number for a dinner party is two -- myself and a damn good
+head waiter.
+ -- Nubar Gulbenkian
+%
+The best portion of a good man's life, his little,
+nameless, unremembered acts of kindness and love.
+ -- Wordsworth
+%
+The best prophet of the future is the past.
+%
+The best rebuttal to this kind of statistical argument came from the
+redoubtable John W. Campbell:
+
+ The laws of population growth tell us that approximately half the
+ people who were ever born in the history of the world are now
+ dead. There is therefore a 0.5 probability that this message is
+ being read by a corpse.
+%
+The best that we can do is to be kindly and helpful toward our friends and
+fellow passengers who are clinging to the same speck of dirt while we are
+drifting side by side to our common doom.
+ -- Clarence Darrow
+%
+The best thing about being bald is, that, when unexpected
+company arrives, all you have to do is straighten your tie.
+%
+The best thing about growing older is that it takes such a long time.
+%
+The best thing that comes out of Iowa is I-80.
+%
+The best things in life are for a fee.
+%
+The best things in life go on sale sooner or later.
+%
+The best way to accelerate a Macintoy is at 9.8 meters per second, squared.
+%
+The best way to avoid responsibility is to say, "I've got responsibilities."
+%
+The best way to get rid of worries is to let them die of neglect.
+%
+The best way to keep your friends is not to give them away.
+%
+The best way to make a fire with two sticks is to make sure one of them
+is a match.
+ -- Will Rogers
+%
+The best way to preserve a right is to exercise it, and the right to
+smoke is a right worth dying for.
+%
+The best ways are the most straightforward ways. When you're sitting around
+scamming these things out, all kinds of James Bondian ideas come forth, but
+when it gets down to the reality of it, the simplest and most straightforward
+way is usually the best, and the way that attracts the least attention.
+Also, pouring gasoline on the water and lighting it like James Bond doesn't
+work either.... They tried it during Prohibition.
+ -- Thomas King Forcade, marijuana smuggler
+%
+The best you get is an even break.
+ -- Franklin Adams
+%
+The better part of valor is discretion.
+ -- William Shakespeare, "Henry IV"
+%
+The better the state is established, the fainter is humanity.
+To make the individual uncomfortable, that is my task.
+ -- Friedrich Nietzsche
+%
+The Bible contains six admonishments to homosexuals and 362 admonishments
+to heterosexuals. That doesn't mean that God doesn't love heterosexuals.
+It's just that they need more supervision.
+%
+The Bible is not my Book and Christianity is not my religion. I could
+never give assent to the long complicated statements of Christian dogma.
+ -- Abraham Lincoln
+%
+The Bible on letters of reference:
+
+ Are we beginning all over again to produce our credentials? Do
+we, like some people, need letters of introduction to you, or from you?
+No, you are all the letter we need, a letter written on your heart; any
+man can see it for what it is and read it for himself.
+ -- 2 Corinthians 3:1-2, New English translation
+%
+The big cities of America are becoming Third World countries.
+ -- Nora Ephron
+%
+The big question is why in the course of evolution the males permitted
+themselves to be so totally eclipsed by the females. Why do they tolerate
+this total subservience, this wretched existence as outcasts who are
+hungry all the time?
+%
+The bigger the theory the better.
+%
+The biggest difference between time and space is that you can't reuse time.
+ -- Merrick Furst
+%
+The biggest mistake you can make is to believe that you are
+working for someone else.
+%
+The biggest problem with communication is the illusion that it has
+occurred.
+%
+The Bird of Time has but a little way to fly ...
+and the bird is on the wing.
+ -- Omar Khayyam
+%
+The black bear used to be one of the most commonly seen large animals
+because in Yosemite and Sequoia national parks they lived off of garbage
+and tourist handouts. This bear has learned to open car doors in
+Yosemite, where damage to automobiles caused by bears runs into the tens
+of thousands of dollars a year. Campaigns to bearproof all garbage
+containers in wild areas have been difficult, because as one biologist
+put it, "There is a considerable overlap between the intelligence levels
+of the smartest bears and the dumbest tourists."
+%
+The bland leadeth the bland and they both shall fall into the kitsch.
+%
+The bogosity meter just pegged.
+%
+The bold youth of today is very lonely.
+ -- Poul Henningsen (1894-1967)
+%
+The bomb will never go off. I speak as an expert in explosives.
+ -- Admiral William Leahy, U.S. Atomic Bomb Project
+%
+The bone-chilling scream split the warm summer night in two, the first
+half being before the scream when it was fairly balmy and calm and
+pleasant, the second half still balmy and quite pleasant for those who
+hadn't heard the scream at all, but not calm or balmy or even very nice
+for those who did hear the scream, discounting the little period of time
+during the actual scream itself when your ears might have been hearing it
+but your brain wasn't reacting yet to let you know.
+ -- Winning sentence, 1986 Bulwer-Lytton bad fiction contest
+%
+The boy stood on the burning deck,
+Eating peanuts by the peck.
+His father called him, but he could not go,
+For he loved those peanuts so.
+%
+The brain is a wonderful organ; it starts working the moment
+you get up in the morning, and does not stop until you get to work.
+%
+The Briggs - Chase Law of Program Development:
+ To determine how long it will take to write and debug a
+ program, take your best estimate, multiply that by two, add
+ one, and convert to the next higher units.
+%
+The British are coming! The British are coming!
+%
+The broad mass of a nation... will more easily
+fall victim to a big lie than to a small one.
+ -- Adolf Hitler, "Mein Kampf"
+%
+The brotherhood of man is not a mere poet's dream; it is a most depressing
+and humiliating reality.
+ -- Oscar Wilde
+%
+The Buddha, the Godhead, resides quite as comfortably in the circuits of a
+digital computer or the gears of a cycle transmission as he does at the top
+of a mountain or in the petals of a flower. To think otherwise is to demean
+the Buddha -- which is to demean oneself.
+ -- Robert Pirsig, "Zen and the Art of Motorcycle Maintenance"
+%
+The buffalo isn't as dangerous as everyone makes him out to be.
+Statistics prove that in the United States more Americans are killed in
+automobile accidents than are killed by buffalo.
+ -- Art Buchwald
+%
+The bugs you have to avoid are the ones that give the user not only
+the inclination to get on a plane, but also the time.
+ -- Kay Bostic
+%
+The Bulwer-Lytton fiction contest is held ever year at San Jose State
+Univ. by Professor Scott Rice. It is held in memory of Edward George
+Earle Bulwer-Lytton (1803-1873), a rather prolific and popular (in his
+time) novelist. He is best known today for having written "The Last
+Days of Pompeii."
+
+Whenever Snoopy starts typing his novel from the top of his doghouse,
+beginning "It was a dark and stormy night..." he is borrowing from Lord
+Bulwer-Lytton. This was the line that opened his novel, "Paul Clifford,"
+written in 1830. The full line reveals why it is so bad:
+
+ It was a dark and stormy night; the rain fell in torrents -- except
+ at occasional intervals, when it was checked by a violent gust of
+ wind which swept up the streets (for it is in London that our scene
+ lies), rattling along the housetops, and fiercely agitating the scanty
+ flame of the lamps that struggled against the darkness.
+%
+The bureaucracy is expanding to meet the needs of an expanding
+bureaucracy.
+%
+The C Programming Language -- A language which combines the
+flexibility of assembly language with the power of assembly language.
+%
+The cable TV sex channels don't expand our horizons, don't make us better
+people, and don't come in clearly enough.
+ -- Bill Maher
+%
+The camel died quite suddenly on the second day, and Selena fretted
+sullenly and, buffing her already impeccable nails -- not for the first
+time since the journey began -- pondered snidely if this would dissolve
+into a vignette of minor inconveniences like all the other holidays spent
+with Basil.
+ -- Winning sentence, 1983 Bulwer-Lytton bad fiction contest
+%
+The camel has a single hump;
+The dromedary two;
+Or else the other way around.
+I'm never sure. Are you?
+ -- Ogden Nash
+%
+The capacity of human beings to bore one another seems to be vastly
+greater than that of any other animals. Some of their most esteemed
+inventions have no other apparent purpose, for example, the dinner
+party of more than two, the epic poem, and the science of metaphysics.
+ -- H. L. Mencken
+%
+The carbonyl is polarized,
+The delta end is plus.
+The nucleophile will thus attack,
+The carbon nucleus.
+Addition makes an alcohol,
+Of types there are but three.
+It makes a bond, to correspond,
+From C to shining C.
+ -- Prof. Frank Westheimer, to "America the Beautiful"
+%
+The cart has no place where a fifth wheel could be used.
+ -- Herbert von Fritzlar
+%
+The Celts invented two things, Whiskey and self-destruction.
+%
+The chain which can be yanked is not the eternal chain.
+ -- G. Fitch
+%
+The chains of marriage are so heavy that it takes two to carry them, and
+sometimes three.
+ -- Alexandre Dumas
+%
+The chicken that clucks the loudest is the one most likely to show up
+at the steam fitters' picnic.
+%
+The chief danger in life is that you may take too many precautions.
+ -- Alfred Adler
+%
+The chief enemy of creativity is "good" sense.
+ -- Picasso
+%
+The church is near but the road is icy,
+the bar is far away but I will walk carefully.
+ -- Russian Proverb
+%
+The church saves sinners, but science seeks to stop their manufacture.
+ -- Elbert Hubbard
+%
+The City of Palo Alto, in its official description of parking lot standards,
+specifies the grade of wheelchair access ramps in terms of centimeters of
+rise per foot of run. A compromise, I imagine...
+%
+The clash of ideas is the sound of freedom.
+%
+The clearest way into the Universe is through a forest wilderness.
+ -- John Muir
+%
+The clergy successfully preached the doctrines of patience and pusillanimity;
+the active virtues of society were discouraged; and the last remains of a
+military spirit were buried in the cloister: a large portion of public and
+private wealth was consecrated to the specious demands of charity and devotion;
+and the soldiers' pay was lavished on the useless multitudes of both sexes
+who could only plead the merits of abstinence and chastity.
+ -- Edward Gibbons, "The Decline and Fall of the Roman Empire"
+%
+The climate of Bombay is such that its inhabitants have to live elsewhere.
+%
+The closest to perfection a person ever comes
+is when he fills out a job application form.
+ -- Stanley J. Randall
+%
+The clothes have no emperor.
+ -- C. A. R. Hoare, commenting on ADA
+%
+The coast was clear.
+ -- Lope de Vega
+%
+The college graduate is presented with a sheepskin to cover his
+intellectual nakedness.
+ -- Robert M. Hutchins
+%
+The Commandments of the EE:
+
+1: Beware of lightning that lurketh in an uncharged condenser
+ lest it cause thee to bounce upon thy buttocks in a most
+ embarrassing manner.
+2: Cause thou the switch that supplieth large quantities of juice to
+ be opened and thusly tagged, that thy days may be long in this
+ earthly vale of tears.
+3: Prove to thyself that all circuits that radiateth, and upon
+ which the worketh, are grounded and thusly tagged lest they lift
+ thee to a radio frequency potential and causeth thee to make like
+ a radiator too.
+4: Tarry thou not amongst these fools that engage in intentional
+ shocks for they are not long for this world and are surely
+ unbelievers.
+%
+The Commandments of the EE:
+
+5: Take care that thou useth the proper method when thou takest the
+ measures of high-voltage circuits too, that thou dost not incinerate
+ both thee and thy test meter, for verily, though thou has no company
+ property number and can be easily surveyed, the test meter has
+ one and, as a consequence, bringeth much woe unto a purchasing agent.
+6: Take care that thou tamperest not with interlocks and safety devices,
+ for this incurreth the wrath of the chief electrician and bring
+ the fury of the engineers on his head.
+7: Work thou not on energized equipment for if thou doest so, thy
+ friends will surely be buying beers for thy widow and consoling
+ her in certain ways not generally acceptable to thee.
+8: Verily, verily I say unto thee, never service equipment alone,
+ for electrical cooking is a slow process and thou might sizzle in
+ thy own fat upon a hot circuit for hours on end before thy maker
+ sees fit to end thy misery and drag thee into his fold.
+%
+The Commandments of the EE:
+
+9: Trifle thee not with radioactive tubes and substances lest thou
+ commence to glow in the dark like a lightning bug, and thy wife be
+ frustrated and have not further use for thee except for thy wages.
+10: Commit thou to memory all the words of the prophets which are
+ written down in thy Bible which is the National Electrical Code,
+ and giveth out with the straight dope and consoleth thee when
+ thou hast suffered a ream job by the chief electrician.
+11: When thou muckest about with a device in an unthinking and/or
+ unknowing manner, thou shalt keep one hand in thy pocket. Better
+ that thou shouldest keep both hands in thy pockets than
+ experimentally determine the electrical potential of an
+ innocent-seeming device.
+%
+The common cormorant, or shag, lays eggs inside a paper bag.
+%
+The computer gets faster! --Moore--
+%
+The computer industry is journalists in their 20's standing in awe of
+entrepreneurs in their 30's who are hiring salesmen in their 40's and
+50's and paying them in the 60's and 70's to bring their marketing into
+the 80's.
+ -- Marty Winston
+%
+The computer is to the information industry roughly what the
+central power station is to the electrical industry.
+ -- Peter Drucker
+%
+The Computer made me do it.
+%
+The computing field is always in need of new cliches.
+ -- Alan J. Perlis
+%
+The concept seems to be clear by now. It has been
+defined several times by examples of what it is not.
+%
+The confusion of a staff member is measured by the length of his
+memos.
+ -- New York Times, Jan. 20, 1981
+%
+The connection between the language in which we think/program and the problems
+and solutions we can imagine is very close. For this reason restricting
+language features with the intent of eliminating programmer errors is at best
+dangerous.
+ -- Bjarne Stroustrup
+%
+The conservation movement is a breeding ground of Communists and other
+subversives. We intend to clean them out, even if it means rounding up
+every bird watcher in the country.
+ -- John Mitchell, Atty. General 1969-1972
+%
+The Constitution may not be perfect, but it's a lot better
+than what we've got!
+%
+The Consultant's Curse:
+ When the customer has beaten upon you long enough, give him
+what he asks for, instead of what he needs. This is very strong
+medicine, and is normally only required once.
+%
+The control of the production of wealth
+is the control of human life itself.
+ -- Hilaire Belloc
+%
+The correct way to punctuate a sentence that starts: "Of course it is
+none of my business, but --" is to place a period after the word "but."
+Don't use excessive force in supplying such a moron with a period.
+Cutting his throat is only a momentary pleasure and is bound to get you
+talked about.
+ -- Lazarus Long, "Time Enough for Love"
+%
+The cost of feathers has risen, even down is up!
+%
+The cost of living has just gone up another dollar a quart.
+ -- W. C. Fields
+%
+The cost of living hasn't affected its popularity.
+%
+The cost of living is going up, and the chance of living is going down.
+%
+The countdown had stalled at "T" minus 69 seconds when Desiree, the first
+female ape to go up in space, winked at me slyly and pouted her thick,
+rubbery lips unmistakably -- the first of many such advances during what
+would prove to be the longest, and most memorable, space voyage of my
+career.
+ -- Winning sentence, 1985 Bulwer-Lytton bad fiction contest
+%
+The course of true anything never does run smooth.
+ -- Samuel Butler
+%
+The courtroom was pregnant (pun intended) with anxious silence as the
+judge solemnly considered his verdict in the paternity suit before him.
+Suddenly, he reached into the folds of his robes, drew out a cigar and
+ceremoniously handed it to the defendant.
+ "Congratulations!" declaimed the jurist. "You have just become a
+father!"
+%
+The covers of this book are too far apart.
+ -- Ambrose Bierce, reviewing a book
+%
+The cow is nothing but a machine which makes grass fit for us people to eat.
+ -- John McNulty
+%
+The Creation of the Universe was made possible by a grant from Texas
+Instruments.
+ -- Credits from the PBS program "The Creation of the Universe"
+%
+The Crown is full of it!
+ -- Nate Harris, 1775
+%
+The cry has been that when war is declared, all opposition should therefore
+be hushed. A sentiment more unworthy of a free country could hardly be
+propagated. If the doctrine be admitted, rulers have only to declare war
+and they are screened at once from scrutiny. ... In war, then, as in peace,
+assert the freedom of speech and of the press. Cling to this as the bulwark
+of all our rights and privileges.
+ -- William Ellery Channing
+%
+The curse of the Irish is not that they don't know the
+words to a song -- it's that they know them *all*.
+ -- Susan Dooley
+%
+The "cutting edge" is getting rather dull.
+ -- Andy Purshottam
+%
+The Czechs announced after Sputnik that they, too, would launch
+a satellite. Of course, it would orbit Sputnik, not Earth!
+%
+The danger is not that a particular class is unfit to govern.
+Every class is unfit to govern.
+ -- Lord Acton
+%
+The dangerous Lego Bomb, which targets shag rugs and scatters pieces of
+plastic that hurt like hell when you step on them is banned entirely....
+Hiring David Copperfield to pretend to saw the missiles in half will not
+be permitted... In order to reduce risk of accidental war, both sides
+agree to ban the popular but dangerous "Simon Says" training drill at
+nuclear launch sites... Under no circumstances will either side reveal
+that it hammered out the treaty in one afternoon, but spent the last nine
+years arguing the Monty Hall and the three doors problem.
+ -- Little known provisions of the START treaty by James Lileks
+%
+The day advanced as if to light some work of mine; it was morning,
+and lo! now it is evening, and nothing memorable is accomplished.
+ -- Henry David Thoreau
+%
+The day after tomorrow is the third day of the rest of your life.
+%
+The day will come when the mystical generation of Jesus, by the Supreme Being
+as his Father, in the womb of a virgin will be classified with the fable of
+the generation of Minerva in the brain of Jupiter. But we may hope that the
+dawn of reason and freedom of thought in these United States will do away with
+this artificial scaffolding and restore to us the primitive and genuine
+doctrines of this most venerated Reformer of human errors.
+ -- Thomas Jefferson
+%
+The days are all empty and the nights are unreal.
+%
+The days just prior to marriage are like a snappy introduction
+to a tedious book.
+%
+The day-to-day travails of the IBM programmer are so amusing to most of us
+who are fortunate enough never to have been one -- like watching Charlie
+Chaplin trying to cook a shoe.
+%
+The debate rages on: Is PL/I Bachtrian or Dromedary?
+%
+The deceased was killed by 1207.3557298 Volts AC RMS applied by
+accident when he brushed against the output terminal of a John B.
+Fluke Company High Voltage Calibrator.
+ -- fictitious coroner's report by Mike Andrews
+%
+The decision doesn't have to be logical; it was unanimous.
+%
+The default Magic Word, "Abracadabra", actually is a corruption of the
+Hebrew phrase "ha-Bracha dab'ra" which means "pronounce the blessing".
+%
+The degree of civilization in a society
+can be judged by entering its prisons.
+ -- F. Dostoyevski
+%
+The degree of technical confidence is inversely
+proportional to the level of management.
+%
+The denunciation of the young is a necessary part of the hygiene of older
+people, and greatly assists in the circulation of the blood.
+ -- Logan Pearsall Smith
+%
+The departing division general manager met a last time with his young
+successor and gave him three envelopes. "My predecessor did this for me,
+and I'll pass the tradition along to you," he said. "At the first sign
+of trouble, open the first envelope. Any further difficulties, open the
+second envelope. Then, if problems continue, open the third envelope.
+Good luck." The new manager returned to his office and tossed the envelopes
+into a drawer.
+ Six months later, costs soared and earnings plummeted. Shaken, the
+young man opened the first envelope, which said, "Blame it all on me."
+ The next day, he held a press conference and did just that. The
+crisis passed.
+ Six months later, sales dropped precipitously. The beleaguered
+manager opened the second envelope. It said, "Reorganize."
+ He held another press conference, announcing that the division
+would be restructured. The crisis passed.
+ A year later, everything went wrong at once and the manager was
+blamed for all of it. The harried executive closed his office door, sank
+into his chair, and opened the third envelope.
+ "Prepare three envelopes..." it said.
+%
+The descent to Hades is the same from every place.
+ -- Anaxagoras
+%
+The devil can cite Scripture for his purpose.
+ -- William Shakespeare, "The Merchant of Venice"
+%
+The devil finds work for idle circuits to do.
+%
+The devil finds work for idle glands.
+%
+The die is cast.
+ -- Gaius Julius Caesar
+%
+The difference between a career and a job is about 20 hours a week.
+%
+The difference between a good haircut and a bad one is seven days.
+%
+The difference between a Miracle and a Fact is
+exactly the difference between a mermaid and a seal.
+ -- Mark Twain
+%
+The difference between a misfortune and a calamity? If Gladstone fell into
+the Thames, it would be a misfortune. But if someone dragged him out again,
+it would be a calamity.
+ -- Benjamin Disraeli
+%
+The difference between America and England is, the English think 100
+miles is a long distance and the Americans think 100 years is a long time.
+%
+The difference between art and science is that science is what we
+understand well enough to explain to a computer. Art is everything else.
+ -- Donald E. Knuth, "Discover"
+%
+The difference between common-sense and paranoia is that common-sense is
+thinking everyone is out to get you. That's normal -- they are. Paranoia
+is thinking that they're conspiring.
+ -- J. Kegler
+%
+The difference between dogs and cats is that dogs come when they're
+called. Cats take a message and get back to you.
+%
+The difference between genius and stupidity is that genius has its limits.
+%
+The difference between legal separation and divorce is
+that legal separation gives the man time to hide his money.
+%
+The difference between reality and unreality
+is that reality has so little to recommend it.
+ -- Allan Sherman
+%
+The difference between science and the fuzzy subjects is that science
+requires reasoning while those other subjects merely require scholarship.
+ -- Robert A. Heinlein
+%
+The difference between sentiment and being sentimental is the following:
+Sentiment is when a driver swerves out of the way to avoid hitting a
+rabbit on the road. Being sentimental is when the same driver, when
+swerving away from the rabbit hits a pedestrian.
+ -- Frank Herbert, "The White Plague"
+%
+The difference between sentiment and sentimentality is easy to see. When
+you avoid killing somebody's pet on the glazeway, that's sentiment. If you
+swerve to avoid the pet and that causes you to kill pedestrians, THAT is
+sentimentality.
+ -- Frank Herbert, "Chapterhouse: Dune"
+%
+The difference between the right word and the almost right word
+is the difference between lightning and the lightning bug.
+ -- Mark Twain
+%
+The difference between this place and yogurt
+is that yogurt has a live culture.
+%
+The difference between us is not very far,
+cruising for burgers in daddy's new car.
+%
+The difference between waltzes and disco is mostly one of volume.
+ -- T. K.
+%
+The difficult we do today; the impossible takes a little longer.
+%
+The dirty work at political conventions is almost always done in
+the grim hours between midnight and dawn. Hangmen and politicians
+work best when the human spirit is at its lowest ebb.
+ -- Russell Baker
+%
+The discerning person is always at a disadvantage.
+%
+The disks are getting full; purge a file today.
+%
+The distinction between Freedom and Liberty is not accurately known;
+naturalists have been unable to find a living specimen of either.
+ -- Ambrose Bierce
+%
+The distinction between Jewish and goyish can be quite subtle, as the
+following quote from Lenny Bruce illustrates:
+
+ "I'm Jewish. Count Basie's Jewish. Ray Charles is Jewish.
+Eddie Cantor's goyish. The B'nai Brith is goyish. The Hadassah is
+Jewish. Marine Corps -- heavy goyish, dangerous.
+ "Kool-Aid is goyish. All Drake's Cakes are goyish.
+Pumpernickel is Jewish and, as you know, white bread is very goyish.
+Instant potatoes -- goyish. Black cherry soda's very Jewish.
+Macaroons are _v_e_r_y Jewish. Fruit salad is Jewish. Lime Jell-O is
+goyish. Lime soda is _v_e_r_y goyish. Trailer parks are so goyish that
+Jews won't go near them."
+ -- Arthur Naiman, "Every Goy's Guide to Yiddish"
+%
+The distinction between true and false appears to become
+increasingly blurred by... the pollution of the language.
+ -- Arne Tiselius
+%
+The District of Columbia has a law forbidding you to exert pressure on
+a balloon and thereby cause a whistling sound on the streets.
+%
+The divinity of Jesus is made a convenient cover for absurdity. Nowhere in
+the Gospels do we find a precept for Creeds, Confessions, Oaths, Doctrines,
+and whole carloads of other foolish trumpery that we find in Christianity.
+ -- John Adams
+%
+The doctrine of human equality reposes on this: that there is no man
+really clever who has not found that he is stupid.
+ -- Gilbert K. Chesterson
+%
+The door is the key.
+%
+The duck hunter trained his retriever to walk on water. Eager to show off
+this amazing accomplishment, he asked a friend to go along on his next
+hunting trip. Saying nothing, he fired his first shot and, as the duck fell,
+the dog walked on the surface of the water, retrieved the duck and returned
+it to his master.
+ "Notice anything?" the owner asked eagerly.
+ "Yes," said his friend, "I see that fool dog of yours can't swim."
+%
+The duration of passion is proportionate with the original resistance
+of the woman.
+ -- Honore de Balzac
+%
+The eagle may soar, but the weasel never gets sucked into a jet engine.
+%
+The early bird gets the coffee left over from the night before.
+%
+The early bird who catches the worm works for someone who comes in late
+and owns the worm farm.
+ -- Travis McGee
+%
+The early worm gets the late bird.
+%
+The earth is like a tiny grain of sand, only much, much heavier.
+%
+The easiest way to figure the cost of living is to take your income and
+add ten percent.
+%
+The easy confidence with which I know another man's religion is folly
+teaches me to suspect that my own is also.
+
+I would not interfere with any one's religion, either to strengthen it
+or to weaken it. I am not able to believe one's religion can affect his
+hereafter one way or the other, no matter what that religion may be.
+But it may easily be a great comfort to him in this life -- hence it is a
+valuable possession to him.
+
+I do not see how eternal punishment hereafter could accomplish any good
+end, therefore I am not able to believe in it. To chasten a man in order
+to perfect him might be reasonable enough; to annihilate him when he shall
+have proved himself incapable of reaching perfection might be reasonable
+enough; but to roast him forever for the mere satisfaction of seeing him
+roast would not be reasonable -- even the atrocious God imagined by the Jews
+would tire of the spectacle eventually.
+ -- Mark Twain
+%
+The economy depends about as much on economists as the weather does on
+weather forecasters.
+ -- Jean-Paul Kauffmann
+%
+The egg cream is psychologically the opposite of circumcision -- it
+*pleasurably* reaffirms your Jewishness.
+ -- Mel Brooks
+%
+The elder gods went to Yuggoth, and all you got was this lousy fortune.
+%
+"The eleventh commandment was `Thou Shalt Compute' or `Thou Shalt Not
+Compute' -- I forget which."
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+The Encyclopaedia Galactica defines a robot as a mechanical apparatus designed
+to do the work of a man. The marketing division of Sirius Cybernetics
+Corporation defines a robot as "Your Plastic Pal Who's Fun To Be With".
+The Hitchhiker's Guide to the Galaxy defines the marketing division of the
+Sirius Cybernetics Corporation as "a bunch of mindless jerks who'll be the
+first against the wall when the revolution comes", with a footnote to effect
+that the editors would welcome applications from anyone interested in taking
+over the post of robotics correspondent.
+ Curiously enough, an edition of the Encyclopaedia Galactica that
+had the good fortune to fall through a time warp from a thousand years in
+the future defined the marketing division of the Sirius Cybernetics
+Corporation as "a bunch of mindless jerks who were the first against the
+wall when the revolution came".
+%
+The end move in politics is always to pick up a gun.
+ -- Buckminster Fuller
+%
+The end of labor is to gain leisure.
+%
+The end of the human race will be that it will eventually die of
+civilization.
+ -- Ralph Waldo Emerson
+%
+The end of the world will occur at 3:00 p.m., this Friday, with
+symposium to follow.
+%
+The ends justify the means.
+ -- after Matthew Prior
+%
+The energy produced by the breaking down of the atom is a very poor kind
+of thing. Anyone who expects a source of power from the transformation
+of these atoms is talking moonshine.
+ -- Ernest Rutherford, after he had split the atom for
+ the first time
+%
+The English country gentleman galloping after a fox -- the unspeakable
+in full pursuit of the uneatable.
+ -- Oscar Wilde, "A Woman of No Importance"
+%
+The English have no respect for their language, and will not teach
+their children to speak it.
+ -- George Bernard Shaw
+%
+The English instinctively admire any man
+who has no talent and is modest about it.
+ -- James Agate, British film and drama critic
+%
+The entire work force of the Communist countries is subjected to periodic
+purges (called verifications in Newspeak). One of the most severe took
+place in 1957 when Novotny, rattled by the Hungarian Revolution the year
+before, tried hard to weed out "radishes" (red outside, white inside) from
+all but insignificant positions. Any one of the following would often
+result in the loss of one's job: Bourgeois or Jewish family background,
+relatives abroad, contacts with former capitalists, having lived in a
+Western country, insufficient knowledge of Communist literature, and others.
+
+ A man is interviewed by a "Verification Committee."
+ "What kind of family do you come from?"
+ "A rich, Jewish family."
+ "And your wife?"
+ "A German aristocrat."
+ "Have you ever been to the West?"
+ "I spent most of my life in England."
+ "How did you make a living there?"
+ "A friend supported me."
+ "Where did you get the money from?"
+ "He owned a textile factory."
+ "Who was Lenin?"
+ "Never heard of him."
+ "What is your name?"
+ "Karl Marx."
+%
+The error of youth is to believe that intelligence is a substitute
+for experience, while the error of age is to believe experience is
+a substitute for intelligence.
+ -- Lyman Bryson
+%
+The eternal feminine draws us upward.
+ -- Johann Wolfgang von Goethe
+%
+The executioner is, I hear, very expert, and my neck is very slender.
+ -- Anne Boleyn
+%
+The explanation requiring the fewest assumptions
+is the most likely to be correct.
+ -- William of Occam
+%
+The eye is a menace to clear sight, the ear is a menace to subtle hearing,
+the mind is a menace to wisdom, every organ of the senses is a menace to its
+own capacity. ... Fuss, the god of the Southern Ocean, and Fret, the god
+of the Northern Ocean, happened once to meet in the realm of Chaos, the god
+of the center. Chaos treated them very handsomely and they discussed together
+what they could do to repay his kindness. They had noticed that, whereas
+everyone else had seven apertures, for sight, hearing, eating, breathing and
+so on, Chaos had none. So they decided to make the experiment of boring holes
+in him. Every day they bored a hole, and on the seventh day, Chaos died.
+ -- Chuang Tzu
+%
+The eyes of taxes are upon you.
+%
+The eyes of Texas are upon you,
+All the livelong day;
+The eyes of Texas are upon you,
+You cannot get away;
+Do not think you can escape them
+From night 'til early in the morn;
+The eyes of Texas are upon you
+'Til Gabriel blows his horn.
+ -- University of Texas' school song
+%
+The fact that an opinion has been widely held is no evidence that it is not
+utterly absurd; indeed, in view of the silliness of the majority of mankind,
+a widespread belief is more often likely to be foolish than sensible.
+ -- Bertrand Russell, in "Marriage and Morals", 1929
+%
+The fact that boys are allowed to exist at all is evidence of a
+remarkable Christian forbearance among men.
+ -- Ambrose Bierce
+%
+The fact that Hitler was a political genius unmasks the nature of politics
+in general as no other can.
+ -- Wilhelm Reich
+%
+The fact that it works is immaterial.
+ -- L. Ogborn
+%
+The fact that people are poor or discriminated against doesn't necessarily
+endow them with any special qualities of justice, nobility, charity or
+compassion.
+ -- Saul Alinsky
+%
+The fall of the USSR proves you wrong.
+ -- Aryeh M. Friedman
+%
+The famous politician was trying to save both his faces.
+%
+The farther you go, the less you know.
+ -- Lao Tsu, "Tao Te Ching"
+%
+The fashion wears out more apparel than the man.
+ -- William Shakespeare, "Much Ado About Nothing"
+%
+The fashionable drawing rooms of London have always been happy to accept
+outsiders -- if only on their own, albeit undemanding terms. That is to
+say, artists, so long as they are not too talented, men of humble birth,
+so long as they have since amassed several million pounds, and socialists
+so long as they are Tories.
+ -- Christopher Booker
+%
+The faster I go, the behinder I get.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+The faster we go, the rounder we get.
+ -- The Grateful Dead
+%
+The Fastest Defeat In Chess
+ The big name for us in the world of chess is Gibaud, a French chess
+master.
+ In Paris during 1924 he was beaten after only four moves by a
+Monsieur Lazard. Happily for posterity, the moves are recorded and so
+chess enthusiasts may reconstruct this magnificent collapse in the comfort
+of their own homes.
+ Lazard was black and Gibaud white:
+ 1: P-Q4, Kt-KB3
+ 2: Kt-Q2, P-K4
+ 3: PxP, Kt-Kt5
+ 4: P-KR3, Kt-K6/
+ White then resigns on realizing that a fifth move would involve
+either a Q-KR5 check or the loss of his queen.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The father, passing through his son's college town late one evening on a
+business trip, thought he would pay his boy a surprise visit. Arriving at the
+lad's fraternity house, dad rapped loudly on the door. After several minutes
+of knocking, a sleepy voice drifted down from a second-floor window,
+ "Whaddaya want?"
+ "Does Ramsey Duncan live here?" asked the father.
+ "Yeah," replied the voice. "Dump him on the front porch."
+%
+The feeling persists that no one can simultaneously be a respectable writer
+and understand how a refrigerator works, just as no gentleman wears a brown
+suit in the city. Colleges may be to blame. English majors are encouraged,
+I know, to hate chemistry and physics, and to be proud because they are not
+dull and creepy and humorless and war-oriented like the engineers across the
+quad. And our most impressive critics have commonly been such English majors,
+and they are squeamish about technology to this very day. So it is natural
+for them to despise science fiction.
+ -- Kurt Vonnegut, Jr., "Science Fiction"
+%
+The fellow sat down at a bar, ordered a drink and asked the bartender if he
+wanted to hear a dumb-jock joke.
+ "Hey, buddy," the bartender replied, "you see those two guys next to
+you? They used to be with the Chicago Bears. The two dudes behind you made
+the U.S. Olympic wrestling team. And for you information, I used to play
+center at Notre Dame."
+ "Forget it," the customer said. "I don't want to explain it five
+times."
+%
+"The feminist agenda," Pat Robertson observed in a recent letter to his
+supporters, "is not about equal rights for women. It is about a socialist,
+anti-family political movement that encourages women to leave their
+husbands, kill their children, practice witchcraft, destroy capitalism
+and become lesbians."
+%
+The Feynman Problem-Solving Algorithm:
+ (1) write down the problem.
+ (2) think very hard.
+ (3) write down the answer.
+ -- Murray Gell-Mann
+%
+The Fifth Rule:
+ You have taken yourself too seriously.
+%
+The final delusion is the belief that one has lost all delusions.
+ -- Maurice Chapelain, "Main courante"
+%
+The final screw holding up a rackmount server is always possessed by demons.
+%
+The finest eloquence is that which gets things done.
+%
+The first 90% of a project takes 90% of the time,
+the last 10% takes the other 90% of the time.
+%
+The first and almost the only Book deserving of universal attention is
+the Bible.
+ -- John Quincy Adams
+
+All the good from the Saviour of the world is communicated through this Book;
+but for the Book we could not know right from wrong. All the things desirable
+to man are contained in it.
+ -- Abraham Lincoln
+
+... the Bible ... is the one supreme source of revelation of the meaning of
+life, the nature of God and spiritual nature and need of men. It is the only
+guide of life which really leads the spirit in the way of peace and salvation.
+ -- Woodrow Wilson
+%
+The First Commandment for Technicians:
+ Beware the lightening that lurketh in the undischarged
+capacitor, lest it cause thee to bounce upon thy buttocks in a most
+untechnician-like manner.
+%
+The first duty of a revolutionary is to get away with it.
+ -- Abbie Hoffman
+%
+The first Great Steward, Parrafin the Climber, was employed in King
+Chloroplast's kitchen as second scullery boy when the old King met a
+tragic death. He apparently fell backward by accident on a dozen salad
+forks. Simultaneously the true heir, his son Carotene, mysteriously
+fled the city, complaining of some sort of plot and a lot of
+threatening notes left on his breakfast tray. At the time, this looked
+suspicious what with his father's death, and Carotene was suspected of
+foul play. Then the rest of the King's relatives began to drop dead
+one after the other in an odd fashion. Some were found strangled with
+dishrags and some succumbed to food poisoning. A few were found
+drowned in the soup vats, and one was attacked by assailants unknown
+and beaten to death with a pot roast. At least three appear to have
+thrown themselves backward on salad forks, perhaps in a noble gesture
+of grief over the King's untimely end. Finally there was no one left
+in Minas Troney who was either eligible or willing to wear the accursed
+crown, and the rule of Twodor was up for grabs. The scullery slave
+Parrafin bravely accepted the Stewardship of Twodor until that day when
+a lineal descendant of Carotene's returns to reclaim his rightful
+throne, conquer Twodor's enemies, and revamp the postal system.
+ -- Harvard Lampoon, "Bored of the Rings"
+%
+The first guy that rats gets a bellyful of slugs in the head. Understand?
+ -- Joey Glimco, trade unionist
+%
+The first half of our lives is ruined by our parents,
+and the second half by our children.
+ -- Clarence Darrow
+%
+The first marriage is the triumph of imagination over intelligence,
+and the second the triumph of hope over experience.
+%
+The first myth of management is that it exists. The second myth of
+management is that success equals skill.
+ -- Robert Heller
+%
+The first requisite for immortality is death.
+ -- Stanislaw Lem
+%
+The first riddle I ever heard, one familiar to almost every Jewish
+child, was propounded to me by my father:
+ "What is it that hangs on the wall, is green, wet -- and
+whistles?"
+ I knit my brow and thought and thought, and in final perplexity
+gave up.
+ "A herring," said my father.
+ "A herring," I echoed. "A herring doesn't hang on the wall!"
+ "So hang it there."
+ "But a herring isn't green!" I protested.
+ "Paint it."
+ "But a herring isn't wet."
+ "If it's just painted it's still wet."
+ "But -- " I sputtered, summoning all my outrage, "-- a herring
+doesn't whistle!!"
+ "Right, " smiled my father. "I just put that in to make it
+hard."
+ -- Leo Rosten, "The Joys of Yiddish"
+%
+The first Rotarian was the first man to call John the Baptist "Jack."
+ -- H. L. Mencken
+%
+The first rule of intelligent tinkering is to save all the parts.
+ -- Paul Erlich
+%
+The first rule of magic is simple. Don't waste your time waving your
+hands and hoping when a rock or a club will do.
+ -- McCloctnik the Lucid
+%
+The First Rule of Program Optimization:
+ Don't do it.
+
+The Second Rule of Program Optimization (for experts only!):
+ Don't do it yet.
+ -- Michael Jackson
+%
+The first thing I do in the morning
+is brush my teeth and sharpen my tongue.
+ -- Dorothy Parker
+%
+The first thing we do, let's kill all the lawyers.
+ -- William Shakespeare, "Henry VI", Part IV
+%
+The first time, it's a KLUDGE!
+The second, a trick.
+Later, it's a well-established technique!
+ -- Mike Broido, Intermetrics
+%
+The first version always gets thrown away.
+%
+The five rules of Socialism:
+
+ 1. Don't think.
+ 2. If you do think, don't speak.
+ 3. If you think and speak, don't write.
+ 4. If you think, speak and write, don't sign.
+ 5. If you think, speak, write and sign, don't be surprised.
+
+ -- being told in Poland, 1987
+%
+...the flaw that makes perfection perfect.
+%
+The flow chart is a most thoroughly oversold piece of program documentation.
+ -- Frederick Brooks, Jr., "The Mythical Man-Month"
+%
+The flush toilet is the basis of Western civilization.
+ -- Alan Coult
+%
+The following quote is from page 4-27 of the MSCP Basic Disk Functions
+Manual which is part of the UDA50 Programmers Doc Kit manuals:
+
+As stated above, the host area of a disk is structured as a vector of
+logical blocks. From a performance viewpoint, however, it is more
+appropriate to view the host area as a four dimensional hyper-cube, the
+four dimensions being cylinder, group, track, and sector.
+ . . .
+Referring to our hyper-cube analogy, the set of potentially accessible
+blocks form a line parallel to the track axis. This line moves
+parallel to the sector axis, wrapping around when it reaches the edge
+of the hyper-cube.
+%
+The following statement is not true.
+The previous statement is true.
+%
+The Following Subsume All Physical and Human Laws:
+
+ 1. You can't push on a string.
+ 2. Ain't no free lunches.
+ 3. Them as has, gets.
+ 4. You can't win them all, but you sure as hell can lose them all.
+%
+The Force is what holds everything together.
+It has its dark side, and it has its light side.
+It's sort of like cosmic duct tape.
+%
+The [Ford Foundation] is a large body of money
+completely surrounded by people who want some.
+ -- Dwight MacDonald
+%
+The forest is safe because a lion lives therein and the lion is safe
+because it lives in a forest. Likewise the friendship of persons
+rests on mutual help.
+ -- Laukikanyay
+%
+The fortune program is supported, in part, by user contributions
+and by a major grant from the National Endowment for the Inanities.
+%
+The founding fathers tried to set up a judicial system where the accused
+received a fair trial, not a system to insure an acquittal on technicalities.
+%
+The fountain code has been tightened slightly so you can no longer dip
+objects into a fountain or drink from one while you are floating in mid-air
+due to levitation.
+ Teleporting to hell via a teleportation trap will no longer occur
+if the character does not have fire resistance.
+ -- README file from the NetHack game
+%
+The four building blocks of the universe are fire, water, gravel and
+vinyl.
+ -- Dave Barry
+%
+[The French Riviera is] a sunny place for shady people.
+ -- W. Somerset Maugham
+%
+The full impact of parenthood doesn't hit you until you multiply the
+number of your kids by thirty-two teeth.
+%
+The full potentialities of human fury cannot be reached until a friend
+of both parties tactfully interferes.
+ -- G. K. Chesterton
+%
+The function of the expert is not to be more right than other people,
+but to be wrong for more sophisticated reasons.
+ -- Dr. David Butler, British psephologist
+%
+The future is a myth created by insurance
+salesmen and high school counselors.
+%
+The future is a race between education and catastrophe.
+ -- H. G. Wells
+%
+The future is going to be boring.
+ -- J. G. Ballard
+%
+The future isn't what it used to be. (It never was.)
+%
+The future lies ahead.
+%
+The future not being born, my friend,
+we will abstain from baptizing it.
+ -- George Meredith
+%
+The garden is in mourning;
+The rain falls cool among the flowers.
+Summer shivers quietly
+On its way towards its end.
+
+Golden leaf after leaf
+Falls from the tall acacia.
+Summer smiles, astonished, feeble,
+In this dying dream of a garden.
+
+For a long while, yet, in the roses,
+She will linger on, yearning for peace,
+And slowly
+Close her weary eyes.
+ -- Hermann Hesse, "September"
+%
+The generation of random numbers is too important to be left to chance.
+%
+The genius of our ruling class is that it has kept a majority of the
+people from ever questioning the inequity of a system where most people
+drudge along paying heavy taxes for which they get nothing in return.
+ -- Gore Vidal
+%
+The gent who wakes up and finds himself a success hasn't been asleep.
+%
+The gentlemen looked one another over with microscopic carelessness.
+%
+The giraffe you thought you offended last week is willing to be nuzzled
+today.
+%
+The girl who remembers her first kiss now has a daughter who can't even
+remember her first husband.
+%
+The girl who stoops to conquer usually wears a low-cut dress.
+%
+The girl who swears no one has ever made love to her has a right to swear.
+ -- Sophia Loren
+%
+The glances over cocktails
+That seemed to be so sweet
+Don't seem quite so amorous
+Over Shredded Wheat
+%
+The goal of Computer Science is to build something that will last at
+least until we've finished building it.
+%
+The goal of science is to build better mousetraps.
+The goal of nature is to build better mice.
+%
+The gods gave man fire and he invented fire engines.
+They gave him love and he invented marriage.
+%
+The Golden Rule is of no use to you whatever unless you realize it
+is your move.
+ -- Frank Crane
+%
+The Golden Rule of Arts and Sciences:
+ He who has the gold makes the rules.
+%
+The good Christian should beware of mathematicians and all those who
+make empty prophecies. The danger already exists that mathematicians
+have made a covenant with the devil to darken the spirit and confine
+man in the bonds of Hell.
+ -- St. Augustine
+%
+The good die young -- because they see it's no use living if you've got
+to be good.
+ -- John Barrymore
+%
+The good (I am convinced, for one)
+Is but the bad one leaves undone.
+Once your reputation's done
+You can live a life of fun.
+ -- Wilhelm Busch
+%
+The good life was so elusive
+It really got me down
+I had to regain some confidence
+So I got into camouflage
+%
+The good time is approaching,
+The season is at hand.
+When the merry click of the two-base lick
+Will be heard throughout the land.
+The frost still lingers on the earth, and
+Budless are the trees.
+But the merry ring of the voice of spring
+Is borne upon the breeze.
+ -- Ode to Opening Day, "The Sporting News", 1886
+%
+The Gordian Maxim:
+If a string has one end, it has another.
+%
+The government has just completed work on a missile that turned out
+to be a bit of a boondoggle; nicknamed "Civil Servant", it won't work
+and they can't fire it.
+%
+The government [is] extremely fond of amassing great quantities of
+statistics. These are raised to the _nth degree, the cube roots are
+extracted, and the results are arranged into elaborate and impressive
+displays. What must be kept ever in mind, however, is that in every
+case, the figures are first put down by a village watchman, and he puts
+down anything he damn well pleases.
+ -- Sir Josiah Stamp
+%
+The Government just announced today the creation of the Neutron Bomb II.
+Similar to the Neutron Bomb, the Neutron Bomb II not only kills people
+and leaves buildings standing, but also does a little light housekeeping.
+%
+The government of the United States is not in any sense founded on the
+Christian Religion
+ -- George Washington
+%
+The government was contemplating the dispatch of an expedition to Burma,
+with a view to taking Rangoon, and a question arose as to who would be the
+fittest general to be sent in command of the expedition. The Cabinet sent
+for the Duke of Wellington, and asked his advice. He instantly replied,
+"Send Lord Combermere."
+ "But we have always understood that your Grace thought Lord
+Combermere a fool."
+ "So he is a fool, and a damned fool; but he can take Rangoon."
+ -- G. W. E. Russell
+%
+The goys have proven the following theorem...
+ -- Physicist John von Neumann, at the start of a classroom
+ lecture.
+%
+The grand leap of the whale up the Fall of Niagara is esteemed, by all
+who have seen it, as one of the finest spectacles in nature.
+ -- Benjamin Franklin
+%
+The grass is always greener on the other side of your sunglasses.
+%
+The grave's a fine and private place,
+but none, I think, do there embrace.
+ -- Andrew Marvell
+%
+The graveyards are full of indispensable men.
+ -- Charles de Gaulle
+%
+The Great Bald Swamp Hedgehog:
+ The Great Bald Swamp Hedgehog of Billericay displays, in
+courtship, his single prickle and does impressions of Holiday Inn desk
+clerks. Since this means him standing motionless for enormous periods
+of time he is often eaten in full display by The Great Bald Swamp
+Hedgehog Eater.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+The great merit of society is to make one appreciate solitude.
+ -- Charles Chincholles, "Reflections on the Art of Life"
+%
+The Great Movie Posters:
+
+*A Giggle Gurgling Gulp of Glee*
+With Pretty Girls, Peppy Scenes, and Gorgeous Revues -- plus a good story.
+ -- Tea with a Kick (1924)
+
+Whoopie! Let's go!... Hand-picked Beauties doing cute tricks!
+GET IN THE KNOW FOR THE HEY-HEY WHOOPIE!
+ -- The Wild Party (1929)
+
+YOU HEAR HIM MAKE LOVE!
+DIX -- the dashing soldier!
+ DIX -- the bold adventurer!
+ DIX -- the throbbing lover!
+ -- The Wheel of Life (1929)
+
+SEE CHARLES BUTTERWORTH DRIVE A STREETCAR AND SING LOVE
+SONGS TO HIS MARE "MITZIE"!
+ -- The Night is Young (1934)
+%
+The Great Movie Posters:
+
+A mis-spawned murderous abomination from the nether reaches of an
+unimaginable hell.
+ -- The Killer of Castle Brood (1967)
+
+NEW -- SICKENING HORROR to make your STOMACH TURN and FLESH CRAWL!
+ -- Frankenstein's Bloody Terror (1968)
+
+LUST-MAD MEN AND LAWLESS WOMEN IN A VICIOUS AND SENSUOUS ORGY OF
+SLAUGHTER!
+ -- Five Bloody Graves (1969)
+
+The family that slays together stays together.
+ -- Bloody Mama (1970)
+%
+The Great Movie Posters:
+
+An AVALANCHE of KILLER WORMS!
+ -- Squirm (1976)
+
+Most Movies Live Less Than Two Hours.
+This Is One of Everlasting Torment!
+ -- The New House on the Left (1977)
+
+WE ARE GOING TO EAT YOU!
+ -- Zombie (1980)
+
+It's not human and it's got an axe.
+ -- The Prey (1981)
+%
+The Great Movie Posters:
+
+Different! Daring! Dynamic! Defying! Dumbfounding!
+SEE Uncle Tom lead the Negroes to FREEDOM!
+... Now, all the SENSUAL and VIOLENT passions Roots couldn't show on TV!
+ -- Uncle Tom's Cabin (1972)
+
+An appalling amalgam of carnage and carnality!
+ -- Flesh and Blood Show (1973)
+
+WHEN THE CATS ARE HUNGRY...
+RUN FOR YOUR LIVES!
+Alone, only a harmless pet...
+ One Thousand Strong, They Become a Man-Eating Machine!
+ -- The Night of a Thousand Cats (1972)
+
+They're Over-Exposed
+But Not Under-Developed!
+ -- Cover Girl Models (1976)
+%
+The Great Movie Posters:
+
+HOODLUMS FROM ANOTHER WORLD ON A RAY-GUN RAMPAGE!
+ -- Teenagers from Outher Space (1959)
+
+Which will be Her Mate... MAN OR BEAST?
+Meet Velda -- the Kind of Woman -- Man or Gorilla would kill... to Keep.
+ -- Untamed Mistress (1960)
+
+NOW AN ALL-MIGHTY ALL-NEW MOTION PICTURE BRINGS THEM TOGETHER FOR THE
+FIRST TIME... HISTORY'S MOST GIGANTIC MONSTERS IN COMBAT ATOP MOUNT FUJI!
+ -- King Kong vs. Godzilla (1963)
+%
+The Great Movie Posters:
+
+HOT STEEL BETWEEN THEIR LEGS!
+ -- The Cycle Savages (1969)
+
+The Hand that Rocks the Cradle... Has no Flesh on It!
+ -- Who Slew Auntie Roo? (1971)
+
+TWO GREAT BLOOD HORRORS TO RIP OUT YOUR GUTS!
+ -- I Eat Your Skin & I Drink Your Blood (1971 double-bill)
+
+They Went In People and Came Out Hamburger!
+ -- The Corpse Grinders (1971)
+%
+The Great Movie Posters:
+
+KATHERINE HEPBURN as the lying, stealing, singing, preying witch girl
+of the Ozarks... "Low down white trash"? Maybe so -- but let her hear
+you say it and she'll break your head to prove herself a lady!
+ -- Spitfire (1934)
+
+Do Native Women Live With Apes?
+ -- Love Life of a Gorilla (1937)
+
+JUNGLE KISS!!
+ When she looked into his eyes, felt his arms around her -- she
+was no longer Tura, mysterious white goddess of the jungle tribes --
+she was no longer the frozen-hearted high priestess under whose hypnotic
+spell the worshipers of the great crocodile god meekly bowed -- she
+was a girl in love!
+ SEE the ravening charge of the hundred scared CROCODILES!
+ -- Her Jungle Love (1938)
+
+LOVE! HATE! JOY! FEAR! TORMENT! PANIC! SHAME! RAGE!
+ -- Intermezzo (1939)
+%
+The Great Movie Posters:
+
+POWERFUL! SHOCKING! RAW! ROUGH! CHALLENGING! SEE A LITTLE GIRL MOLESTED!
+ -- Never Take Candy from a Stranger (1963)
+
+She Sins in Mobile --
+Marries in Houston --
+Loses Her Baby in Dallas --
+Leaves Her Husband in Tucson --
+MEETS HARRU IN SAN DIEGO!...
+FIRST -- HARLOW!
+THEN -- MONROE!
+NOW -- McCLANAHAN!!!
+ -- The Rotten Apple (1963), Rue McClanahan
+
+*NOT FOR SISSIES! DON'T COME IF YOU'RE CHICKEN!
+A Horrifying Movie of Weird Beauties and Shocking Monsters...
+1001 WEIRDEST SCENES EVER!! MOST SHOCKING THRILLER OF THE CENTURY!
+ -- Teenage Psycho meets Bloody Mary (1964) (Alternate Title:
+ The Incredibly Strange Creatures Who Stopped Living and
+ Became Mixed Up Zombies)
+%
+The Great Movie Posters:
+
+SCENES THAT WILL STAGGER YOUR SIGHT!
+-- DANCING CALLED GO-GO
+-- MUSIC CALLED JU-JU
+-- NARCOTICS CALLED BANGI!
+-- FIRES OF PUBERTY!
+ SEE the burning of a virgin!
+ SEE power of witch doctor over women!
+ SEE pygmies with fantastic Physical Endowments!!!
+ -- Kwaheri (1965)
+
+The Big Comedy of Nineteen-Sexty-Sex!
+ -- Boeing-Boeing (1965)
+
+AN ASTRONAUT WENT UP-
+A "GUESS WHAT" CAME DOWN!
+ The picture that comes complete with a 10-foot tall monster to
+give you the wim-wams!
+ -- Monster a Go-Go (1965)
+%
+The Great Movie Posters:
+
+SEE rebel guerrillas torn apart by trucks!
+SEE corpses cut to pieces and fed to dogs and vultures!
+SEE the monkey trained to perform nursing duties for her paralyzed owner!
+ -- Sweet and Savage (1983)
+
+What a Guy! What a Gal! What a Pair!
+ -- Stroker Ace (1983)
+
+It's always better when you come again!
+ -- Porky's II: The Next Day (1983)
+
+You Don't Have to Go to Texas for a Chainsaw Massacre!
+ -- Pieces (1983)
+%
+The Great Movie Posters:
+
+SHE TOOK ON A WHOLE GANG! A howling hellcat humping a hot steel hog
+on a roaring rampage of revenge!
+ -- Bury Me an Angel (1972)
+
+WHAT'S THE SECRET INGREDIENT USED BY THE MAD BUTCHER FOR HIS SUPERB
+SAUSAGES?
+ -- Meat is Meat (1972)
+
+TODAY the Pond!
+TOMORROW the World!
+ -- Frogs (1972)
+%
+The Great Movie Posters:
+
+She's got the biggest six-shooters in the West!
+ -- The Beautiful Blonde from Bashful Bend (1949)
+
+CAST OF 3,000!
+4 WRITERS,
+2 DIRECTORS,
+3 CAMERAMEN,
+3 PRODUCERS!
+1 YEAR TO MAKE THIS FILM --
+24 YEARS TO REHEARSE --
+20 YEARS TO DISTRIBUTE!
+ BEAUTIFUL BEYOND WORDS!
+ AWE-INSPIRING! VITAL!
+THE PRINCE OF PEACE PROVIDES THE ANSWER TO EVERY PROBLEM!
+Be Brave-bring your troubles and your family to:
+ HISTORY'S MOST SUBLIME EVENT! YOU'LL FIND GOD RIGHT IN THERE!
+ -- The Prince of Peace (1948). Starring members of the
+ Wichita Mountain Pageant featuring Millard Coody as Jesus.
+%
+The Great Movie Posters:
+
+The Miracle of the Age!!! A LION in your lap! A LOVER in your arms!
+ -- Bwana Devil (1952)
+
+OVERWHELMING! ELECTRIFYING! BAFFLING!
+Fire Can't Burn Them! Bullets Can't Kill Them! See the Unfolding of
+the Mysteries of the Moon as Murderous Robot Monsters Descend Upon the
+Earth! You've Never Seen Anything Like It! Neither Has the World!
+ SEE... Robots from Space in All Their Glory!!!
+ -- Robot Monster (1953)
+
+1,965 pyramids, 5,337 dancing girls, one million swaying bullrushes,
+802 scared bulls!
+ -- The Egyptian (1954)
+%
+The Great Movie Posters:
+
+The nightmare terror of the slithering eye that unleashed agonizing
+horror on a screaming world!
+ -- The Crawling Eye (1958)
+
+SEE a female colossus... her mountainous torso, skyscraper limbs,
+giant desires!
+ -- Attack of the Fifty-Foot Woman (1958)
+
+Here Is Your Chance To Know More About Sex.
+What Should a Movie Do? Hide It's Head in the Sand Like an Ostrich?
+Or Face the JOLTING TRUTH as does...
+ -- The Desperate Women (1958)
+%
+The Great Movie Posters:
+
+They hungered for her treasure! And died for her pleasure!
+SEE Man-Fish Battle Shark-Man-Killer!
+ -- The Golden Mistress (1954)
+
+See Jane Russell in 3-D; She'll Knock Both Your Eyes Out!
+ -- The French Line (1954)
+
+See Jane Russell Shake Her Tambourines... and Drive Cornel WILDE!
+ -- Hot Blood (1956)
+%
+The Great Movie Posters:
+
+When You're Six Tons -- And They Call You Killer -- It's Hard To Make
+Friends...
+ -- Namu, the Killer Whale (1966)
+
+Meet the Girls with the Thermo-Nuclear Navels!
+ -- Dr. Goldfoot and the Girl Bombs (1966)
+
+A GHASTLY TALE DRENCHED WITH GOUTS OF BLOOD SPURTING FROM THE VICTIMS
+OF A CRAZED MADMAN'S LUST.
+ -- A Taste of Blood (1967)
+%
+The great nations have always acted like gangsters and the small nations
+like prostitutes.
+ -- Stanley Kubrick
+%
+The great question that has never been answered and which I have not
+yet been able to answer despite my thirty years of research into the
+feminine soul is: WHAT DOES A WOMAN WANT?
+ -- Sigmund Freud
+%
+The great secret in life ... [is] not to open your letters for a fortnight.
+At the expiration of that period you will find that nearly all of them have
+answered themselves.
+ -- Arthur Binstead
+%
+The greatest dangers to liberty lurk in insidious encroachment by men
+of zeal, well-meaning but without understanding.
+ -- Justice Louis D. Brandeis
+%
+The greatest disloyalty one can offer to great pioneers
+is to refuse to move an inch from where they stood.
+%
+The greatest griefs are those we cause ourselves.
+ -- Sophocles
+%
+The greatest joy a man can know is to conquer his enemies and drive them
+before him. To ride their horses and take away their possessions. To see
+the faces of those who were dear to them bedewed with tears, and to clasp
+their wives and daughters to his arms.
+ -- Chinggis (Genghis) Khan
+%
+The greatest love is a mother's, then a dog's, then a sweetheart's.
+ -- Polish proverb
+%
+The Greatest Mathematical Error
+ The Mariner I space probe was launched from Cape Canaveral on 28
+July 1962 towards Venus. After 13 minutes' flight a booster engine would
+give acceleration up to 25,820 mph; after 44 minutes 9,800 solar cells
+would unfold; after 80 days a computer would calculate the final course
+corrections and after 100 days the craft would circle the unknown planet,
+scanning the mysterious cloud in which it is bathed.
+ However, with an efficiency that is truly heartening, Mariner I
+plunged into the Atlantic Ocean only four minutes after takeoff.
+ Inquiries later revealed that a minus sign had been omitted from
+the instructions fed into the computer. "It was human error", a launch
+spokesman said.
+ This minus sign cost L4,280,000.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The greatest of faults is to be conscious of none.
+%
+The greatest productive force is human selfishness.
+ -- Robert A. Heinlein
+%
+The greatest remedy for anger is delay.
+%
+The groundhog is like most other prophets;
+it delivers its message and then disappears.
+%
+The hand that feeds the chicken every day finally wrings its neck instead,
+thus proving that more sophisticated views about the uniformity of nature
+would have been useful to the chicken.
+
+ -- Bertrand Russell, "On Induction"
+%
+The happiest time in any man's life is just after the first divorce.
+ -- J. K. Galbraith
+%
+The hardest part of climbing the ladder of
+success is getting through the crowd at the bottom.
+%
+The hardest thing in the world to understand is the income tax.
+ -- Albert Einstein
+%
+The hardest thing is to disguise your feelings when
+you put a lot of relatives on the train for home.
+%
+The hater of property and of government takes care to have his warranty
+deed recorded, and the book written against fame and learning has the
+author's name on the title page.
+ -- Ralph Waldo Emerson, "Journals" (1831)
+%
+The hatred of relatives is the most violent.
+ -- Tacitus (c.55 - c.117)
+%
+The health of a democratic society may be measured by the quality
+of functions performed by private citizens.
+ -- Alexis de Tocqueville
+%
+The hearing ear is always found close to the speaking tongue, a custom
+whereof the memory of man runneth not howsomever to the contrary, nohow.
+%
+The heart has its reasons which reason knows nothing of.
+ -- Blaise Pascal
+%
+The heart is wiser than the intellect.
+%
+...the heat come 'round and busted me for smiling on a cloudy day.
+%
+The heaviest object in the world is the
+body of the woman you have ceased to love.
+ -- Marquis de Lac de Clapiers Vauvenargues
+%
+The Heineken Uncertainty Principle:
+ You can never be sure how many beers you had last night.
+%
+The help people need most urgently is
+help in admitting that they need help.
+%
+The herd instinct among economists
+makes sheep look like independent thinkers.
+%
+The heroic hours of life do not announce their presence by drum and trumpet,
+challenging us to be true to ourselves by appeals to the martial spirit that
+keeps the blood at heat. Some little, unassuming, unobtrusive choice presents
+itself before us slyly and craftily, glib and insinuating, in the modest garb
+of innocence. To yield to its blandishments is so easy. The wrong, it seems,
+is venial... Then it is that you will be summoned to show the courage of
+adventurous youth.
+ -- Benjamin Cardozo
+%
+The hieroglyphics are all unreadable except for a notation on the back,
+which reads "Genuine authentic Egyptian papyrus. Guaranteed to be at
+least 5000 years old."
+%
+The higher you climb, the more you show your ass.
+ -- Alexander Pope, "The Dunciad"
+%
+The History of every major Galactic Civilization tends to pass through
+three distinct and recognizable phases, those of Survival, Inquiry, and
+Sophistication, otherwise known as the How, Why, and Where phases. For
+instance, the first phase is characterized by the question "How can we
+eat?" the second by "Why do we eat?" and the third by "Where shall we
+have lunch?".
+ -- Douglas Adams, "The Restaurant at the End of the Universe"
+%
+The history of warfare is similarly subdivided, although here the phases
+are Retribution, Anticipation, and Diplomacy. Thus:
+
+Retribution:
+ I'm going to kill you because you killed my brother.
+Anticipation:
+ I'm going to kill you because I killed your brother.
+Diplomacy:
+ I'm going to kill my brother and then kill you on the
+ pretext that your brother did it.
+%
+The Hollywood tradition I like best is called "sucking up to the stars."
+ -- Johnny Carson
+%
+The honeymoon is not actually over until we cease
+to stifle our sighs and begin to stifle our yawns.
+ -- Helen Rowland
+%
+The honeymoon is over when he phones to say he'll be late for supper and
+she's already left a note that it's in the refrigerator.
+ -- Bill Lawrence
+%
+The horror... the horror!
+%
+The human animal differs from the lesser
+primates in his passion for lists of "Ten Best".
+ -- H. Allen Smith
+%
+The human brain is a wonderful thing. It starts working the moment
+you are born, and never stops until you stand up to speak in public.
+ -- Sir George Jessel
+%
+The human brain is like an enormous fish -- it is flat and slimy and
+has gills through which it can see.
+ -- Monty Python
+%
+The human mind ordinarily operates at only ten percent of
+its capacity -- the rest is overhead for the operating system.
+%
+The human mind treats a new idea the way the
+body treats a strange protein: it rejects it.
+ -- P. Medawar
+%
+The human race has been fascinated by sharks for as long as I can remember.
+Just like the bluebird feeding its young, or the spider struggling to weave
+its perfect web, or the buttercup blooming in spring, the shark reveals to
+us yet another of the infinite and wonderful facets of nature, namely the
+facet that it can bite your head off. This causes us humans to feel a
+certain degree of awe.
+ -- Dave Barry, "The Wonders of Sharks on TV"
+%
+The human race has one really effective weapon, and that is laughter.
+ -- Mark Twain
+%
+The human race is a race of cowards; and I am not only marching in that
+procession but carrying a banner.
+ -- Mark Twain
+%
+The human race never solves any of its problems. It merely outlives them.
+ -- David Gerrold
+%
+The husband who doesn't tell his wife everything probably reasons
+that what she doesn't know won't hurt him.
+ -- Leo J. Burke
+%
+The IBM 2250 is impressive ...
+if you compare it with a system selling for a tenth its price.
+ -- D. Cohen
+%
+The IBM purchase of ROLM gives new meaning to the term "twisted pair".
+ -- Howard Anderson, "Yankee Group"
+%
+The idea is to die young as late as possible.
+ -- Ashley Montague
+%
+The idea that an arbitrary naive human should be able to properly use a given
+tool without training or understanding is even more wrong for computing than
+it is for other tools (e.g. automobiles, airplanes, guns, power saws).
+ -- Doug Gwyn
+%
+The idea there was that consumers would bring their broken electronic
+devices, such as television sets and VCR's, to the destruction centers,
+where trained personnel would whack them (the devices) with
+sledgehammers. With their devices thus permanently destroyed,
+consumers would then be free to go out and buy new devices, rather than
+have to fritter away years of their lives trying to have the old ones
+repaired at so-called "factory service centers," which in fact consist
+of two men named Lester poking at the insides of broken electronic
+devices with cheap cigars and going, "Lookit all them WIRES in there!"
+ -- Dave Barry, "'Mister Mediocre' Restaurants"
+%
+The ideal voice for radio may be defined as showing no substance,
+no sex, no owner, and a message of importance for every housewife.
+ -- Harry V. Wade
+%
+The ideas of economists and political philosophers, both when they
+are right and when they are wrong, are more powerful than is generally
+understood. Indeed, the world is ruled by little else.
+ -- John Maynard Keynes
+%
+The identical is equal to itself, since it is different.
+ -- Franco Spisani
+%
+The idle man does not know what it is to enjoy rest.
+%
+The idle mind knows not what it is it wants.
+ -- Quintus Ennius
+%
+The illegal we do immediately. The unconstitutional takes a bit
+longer.
+ -- Henry Kissinger
+%
+The Illiterati Programus Canto 1:
+ A program is a lot like a nose:
+ Sometimes it runs, and sometimes it blows.
+%
+The important thing is not to stop questioning.
+%
+The important thing to remember about walking on eggs is not to hop.
+%
+The income tax has made more liars out of the American people than golf
+has. Even when you make a tax form out on the level, you don't know
+when it's through if you are a crook or a martyr.
+ -- Will Rogers
+%
+The individual choice of garnishment of a burger can be an important
+point to the consumer in this day when individualism is an increasingly
+important thing to people.
+ -- Donald N. Smith, president of Burger King
+%
+The infliction of cruelty with a good conscience is
+a delight to moralists. That is why they invented hell.
+ -- Bertrand Russell
+%
+The inherent vice of capitalism is the unequal sharing of blessings;
+the inherent virtue of socialism is the equal sharing of misery.
+ -- Winston Churchill
+%
+The instruments of science do not in themselves discover truth. And
+there are searchings that are not concluded by the coincidence of a
+pointer and a mark.
+ -- Fred Saberhagen, "The Berserker Wars"
+%
+The intelligence of any discussion diminishes with the square of the
+number of participants.
+ -- Adam Walinsky
+%
+The introduction of a new kind of music must be shunned as imperiling
+the whole state, for styles of music are never disturbed without
+affecting the most important political institutions. ... The new
+style, gradually gaining a lodgement, quietly insinuates itself into
+manners and customs, and from it ... goes on to attack laws and
+constitutions, displaying the utmost impudence, until it ends by
+overturning everything.
+ -- Plato, "Republic", 370 B.C.
+%
+The IQ of the group is the lowest IQ of a member of
+the group divided by the number of people in the group.
+%
+The IRS spends God knows how much of your tax money on these toll-free
+information hot lines staffed by IRS employees, whose idea of a
+dynamite tax tip is that you should print neatly. If you ask them a
+real tax question, such as how you can cheat, they're useless.
+
+So, for guidance, you want to look to big business. Big business never
+pays a nickel in taxes, according to Ralph Nader, who represents a big
+consumer organization that never pays a nickel in taxes...
+ -- Dave Barry, "Sweating Out Taxes"
+%
+The Israelis are the Doberman pinschers of the Middle East. They
+treat the Arabs like postmen.
+ -- Franklyn Ajaye
+%
+The Israelites were all waiting anxiously at the foot of the mountain,
+knowing that Moses had had a tough day negotiating with God over the
+Commandments. Finally a tired Moses came into sight.
+ "I've got some good news and some bad news, folks," he said. "The
+good news is that I got Him down to ten. The bad news is that adultery's
+still in."
+%
+The Junior God now heads the roll
+In the list of heaven's peers;
+He sits in the House of High Control,
+And he regulates the spheres.
+Yet does he wonder, do you suppose,
+If, even in gods divine,
+The best and wisest may not be those
+Who have wallowed awhile with the swine?
+ -- R. W. Service
+%
+The justifications for drug testing are part of the presently fashionable
+debate concerning restoring America's "competitiveness." Drugs, it has been
+revealed, are responsible for rampant absenteeism, reduced output, and poor
+quality work. But is drug testing in fact rationally related to the
+resurrection of competitiveness? Will charging the atmosphere of the
+workplace with the fear of excretory betrayal honestly spur productivity?
+Much noise has been made about rehabilitating the worker using drugs, but
+to date the vast majority of programs end with the simple firing or the not
+hiring of the abuser. This practice may exacerbate, not alleviate, the
+nation's productivity problem. If economic rehabilitation is the ultimate
+goal of drug testing, then criteria abandoning the rehabilitation of the
+drug-using worker is the purest of hypocrisy and the worst of rationalization.
+ -- The concluding paragraph of "Constitutional Law: The
+ Fourth Amendment and Drug Testing in the Workplace,"
+ Tim Moore, Harvard Journal of Law & Public Policy, vol.
+ 10, No. 3 (Summer 1987), pp. 762-768.
+%
+The Ken Thompson school of thought on expert systems:
+there's table lookup, fraud, and grand fraud.
+ -- Andrew Hume
+%
+The Kennedy Constant:
+ Don't get mad -- get even.
+%
+The key elements in human thinking are not numbers but labels of fuzzy sets.
+ -- L. Zadeh
+%
+The key to building a superstar is to keep their mouth shut. To reveal
+an artist to the people can be to destroy him. It isn't to anyone's
+advantage to see the truth.
+ -- Bob Ezrin, rock music producer
+%
+The Killer Ducks are coming!!!
+%
+The kind of danger people most enjoy is
+the kind they can watch from a safe place.
+%
+The King and his advisor are overlooking the battle field:
+
+King: "How goes the battle plan?"
+Advisor: "See those little black specks running to the right?"
+K: "Yes."
+A: "Those are their guys. And all those little red specks running
+ to the left are our guys. Then when they collide we wait till
+ the dust clears."
+K: "And?"
+A: "If there are more red specks left than black specks, we win."
+K: "But what about the ^#!!$% battle plan?"
+A: "So far, it seems to be going according to specks."
+%
+The knowledge that makes us cherish
+innocence makes innocence unattainable.
+ -- Irving Howe
+%
+The Kosher Dill was invented in 1723 by Joe Kosher and Sam Dill. It is
+the single most popular pickle variety today, enjoyed throughout the free
+world by man, woman and child alike. An astounding 350 billion kosher
+dills are eaten each year, averaging out to almost 1/4 pickle per person
+per day. New York Times food critic Mimi Sheraton says "The kosher dill
+really changed my life. I used to enjoy eating McDonald's hamburgers and
+drinking Iron City Lite, and then I encountered the kosher dill pickle.
+I realized that there was far more to haute cuisine then I'd ever imagined.
+And now, just look at me."
+%
+The ladies men admire, I've heard,
+Would shudder at a wicked word.
+Their candle gives a single light;
+They'd rather stay at home at night.
+They do not keep awake till three,
+Nor read erotic poetry.
+They never sanction the impure,
+Nor recognize an overture.
+They shrink from powders and from paints...
+So far, I've had no complaints.
+ -- Dorothy Parker
+%
+The language of politics is poetry, not prose. Jackson is poetry.
+Cuomo is poetry. Dukakis is a word processor.
+ -- Richard M. Nixon, on Meet the Press, April, 1988
+%
+The last good thing written in C was Franz Schubert's Symphony No. 9.
+ -- Werner Trobin
+%
+The last person that quit or was fired will be held responsible for
+everything that goes wrong -- until the next person quits or is fired.
+%
+The last person who said that (God rest his soul) lived to regret it.
+%
+The last thing one knows in constructing a work is what to put first.
+ -- Blaise Pascal
+%
+The last time I saw him he was walking down Lover's Lane holding his own
+hand.
+ -- Fred Allen
+%
+The last time somebody said, "I find I can write much better with a word
+processor.", I replied, "They used to say the same thing about drugs."
+ -- Roy Blount, Jr.
+%
+The last vestiges of the old Republic have been swept away.
+ -- Governor Tarkin
+%
+The Law, in its majestic equality, forbids the rich, as well as the poor,
+to sleep under the bridges, to beg in the streets, and to steal bread.
+ -- Anatole France
+%
+The Law of the Letter:
+ The best way to inspire fresh thoughts is to seal the envelope.
+%
+The Law of the Perversity of Nature:
+ You cannot determine beforehand which side of the bread to butter.
+%
+The law will never make men free; it is men who have got to make the
+law free.
+ -- Henry David Thoreau
+%
+The lawgiver, of all beings, most owes the law allegiance. He of all men
+should behave as though the law compelled him. But it is the universal
+weakness of mankind that what we are given to administer we presently imagine
+we own.
+ -- H. G. Wells
+%
+The Least Perceptive Literary Critic
+ The most important critic in our field of study is Lord Halifax. A
+most individual judge of poetry, he once invited Alexander Pope round to
+give a public reading of his latest poem.
+ Pope, the leading poet of his day, was greatly surprised when Lord
+Halifax stopped him four or five times and said, "I beg your pardon, Mr.
+Pope, but there is something in that passage that does not quite please me."
+ Pope was rendered speechless, as this fine critic suggested sizeable
+and unwise emendations to his latest masterpiece. "Be so good as to mark
+the place and consider at your leisure. I'm sure you can give it a better
+turn."
+ After the reading, a good friend of Lord Halifax, a certain Dr.
+Garth, took the stunned Pope to one side. "There is no need to touch the
+lines," he said. "All you need do is leave them just as they are, call on
+Lord Halifax two or three months hence, thank him for his kind observation
+on those passages, and then read them to him as altered. I have known him
+much longer than you have, and will be answerable for the event."
+ Pope took his advice, called on Lord Hallifax and read the poem
+exactly as it was before. His unique critical faculties had lost none of
+their edge. "Ay", he commented, "now they are perfectly right. Nothing can
+be better."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Animal Rescue
+ The firemen's strike of 1978 made possible one of the great animal
+rescue attempts of all time. Valiantly, the British Army had taken over
+emergency firefighting and on 14 January they were called out by an elderly
+lady in South London to retrieve her cat which had become trapped up a
+tree. They arrived with impressive haste and soon discharged their duty.
+So grateful was the lady that she invited them all in for tea. Driving off
+later, with fond farewells completed, they ran over the cat and killed it.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Collector
+ Betsy Baker played a central role in the history of collecting. She
+was employed as a servant in the house of John Warburton (1682-1759) who had
+amassed a fine collection of 58 first edition plays, including most of the
+works of Shakespeare.
+ One day Warburton returned home to find 55 of them charred beyond
+legibility. Betsy had either burned them or used them as pie bottoms. The
+remaining three folios are now in the British Museum.
+ The only comparable literary figure was the maid who in 1835 burned
+the manuscript of the first volume of Thomas Carlyle's "The History of the
+French Revolution", thinking it was wastepaper.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Defrosting Device
+ The all-time record here is held by Mr. Peter Rowlands of Lancaster
+whose lips became frozen to his lock in 1979 while blowing warm air on it.
+ "I got down on my knees to breathe into the lock. Somehow my lips
+got stuck fast."
+ While he was in the posture, an old lady passed an inquired if he
+was all right. "Alra? Igmmlptk", he replied at which point she ran away.
+ "I tried to tell her what had happened, but it came out sort of...
+muffled," explained Mr. Rowlands, a pottery designer.
+ He was trapped for twenty minutes ("I felt a bit foolish") until
+constant hot breathing brought freedom. He was subsequently nicknamed "Hot
+Lips".
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Equal Pay Advertisement
+ In 1976 the European Economic Community pointed out to the Irish
+Government that it had not yet implemented the agreed sex equality
+legislation. The Dublin Government immediately advertised for an equal pay
+enforcement officer. The advertisement offered different salary scales for
+men and women.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Executions
+ History has furnished us with two executioners worthy of attention.
+The first performed in Sydney in Australia. In 1803 three attempts were
+made to hang a Mr. Joseph Samuels. On the first two of these the rope
+snapped, while on the third Mr. Samuels just hung there peacefully until he
+and everyone else got bored. Since he had proved unsusceptible to capital
+punishment, he was reprieved.
+ The most important British executioner was Mr. James Berry who
+tried three times in 1885 to hang Mr. John Lee at Exeter Jail, but on each
+occasion failed to get the trap door open.
+ In recognition of this achievement, the Home Secretary commuted
+Lee's sentence to "life" imprisonment. He was released in 1917, emigrated
+to America and lived until 1933.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Least Successful Police Dogs
+ America has a very strong candidate in "La Dur", a fearsome looking
+schnauzer hound, who was retired from the Orlando police force in Florida
+in 1978. He consistently refused to do anything which might ruffle or
+offend the criminal classes.
+ His handling officer, Rick Grim, had to admit: "He just won't go up
+and bite them. I got sick and tired of doing that dog's work for him."
+ The British contenders in this category, however, took things a
+stage further. "Laddie" and "Boy" were trained as detector dogs for drug
+raids. Their employment was terminated following a raid in the Midlands in
+1967.
+ While the investigating officer questioned two suspects, they
+patted and stroked the dogs who eventually fell asleep in front of the
+fire. When the officer moved to arrest the suspects, one dog growled at
+him while the other leapt up and bit his thigh.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The less a statesman amounts to, the more he loves the flag.
+ -- Kin Hubbard
+%
+The less time planning, the more time programming.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #10 -- SIMPLE
+
+ SIMPLE is an acronym for Sheer Idiot's Monopurpose Programming
+Language Environment. This language, developed at the Hanover College
+for Technological Misfits, was designed to make it impossible to write
+code with errors in it. The statements are, therefore, confined to BEGIN,
+END and STOP. No matter how you arrange the statements, you can't make a
+syntax error. Programs written in SIMPLE do nothing useful, thus achieving
+the results of programs written in other languages without the tedious,
+frustrating process of testing and debugging.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #12 -- LITHP
+
+ This otherwise unremarkable language, originally developed in San
+Francisco, is distinguished by the absence of an "S" in its character set;
+users must substitute "TH". LITHP is thaid to be utheful in protheththing
+lithtth.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #13 -- SLOBOL
+
+ SLOBOL is best known for the speed, or lack of it, of its compiler.
+Although many compilers allow you to take a coffee break while they compile,
+SLOBOL compilers allow you to travel to Bolivia to pick the beans. Forty-
+three programmers are known to have died of boredom sitting at their terminals
+while waiting for a SLOBOL program to compile. Weary SLOBOL programmers
+often turn to a related (but infinitely faster) language, COCAINE.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #14 -- VALGOL
+
+ From its modest beginnings in Southern California's San Fernando
+Valley VALGOL is enjoying a dramatic surge of popularity across the
+industry. VALGOL commands include REALLY, LIKE, WELL, and Y*KNOW.
+Variables are assigned with the =LIKE and =TOTALLY operators. Other
+operators include the "California booleans", AX and NOWAY. Loops are
+accomplished with the FOR SURE construct. A simple example:
+
+ LIKE, Y*KNOW(I MEAN)START
+ IF PIZZA =LIKE BITCHEN AND
+ GUY =LIKE TUBULAR AND
+ VALLEY GIRL =LIKE GRODY**MAX(FERSURE)**2
+ THEN
+ FOR I =LIKE 1 TO OH*MAYBE 100
+ DO*WAH - (DITTY**2); BARF(I)=TOTALLY GROSS(OUT)
+ SURE
+ LIKE, BAG THIS PROGRAM; REALLY; LIKE TOTALLY(Y*KNOW); IM*SURE
+ GOTO THE MALL
+
+ VALGOL is also characterized by its unfriendly error messages. For
+example, when the user makes a syntax error, the interpreter displays the
+message GAG ME WITH A SPOON! A successful compile may be termed MAXIMALLY
+AWESOME!
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #17 -- DOGO
+
+ Developed at the Massachusetts Institute of Obedience Training, DOGO
+DOGO heralds a new era of computer-literate pets. DOGO commands include
+SIT, STAY, HEEL, and ROLL OVER. An innovative feature of DOGO is "puppy
+graphics", a small cocker spaniel that occasionally leaves a deposit as
+it travels across the screen.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #17 -- SARTRE
+
+ Named after the late existential philosopher, SARTRE is an extremely
+unstructured language. Statements in SARTRE have no purpose; they just are.
+Thus SARTRE programs are left to define their own functions. SARTRE
+programmers tend to be boring and depressed, and are no fun at parties.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #18 -- C-
+
+ This language was named for the grade received by its creator when
+he submitted it as a class project in a graduate programming class. C- is
+best described as a "low-level" programming language. In fact, the language
+generally requires more C- statements than machine-code statements to execute
+a given task. In this respect, it is very similar to COBOL.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #18 -- FIFTH
+
+ FIFTH is a precision mathematical language in which the data types
+refer to quantity. The data types range from CC, OUNCE, SHOT, and JIGGER to
+FIFTH (hence the name of the language), LITER, MAGNUM and BLOTTO. Commands
+refer to ingredients such as CHABLIS, CHARDONNAY, CABERNET, GIN, VERMOUTH,
+VODKA, SCOTCH, BOURBON, and WHATEVERSAROUND.
+ The many versions of the FIFTH language reflect the sophistication and
+financial status of its users. Commands in the ELITE dialect include VSOP and
+LAFITE, while commands in the GUTTER dialect include HOOTCH, THUNDERBIRD,
+RIPPLE and HOUSERED. The latter is a favorite of frustrated FORTH programmers
+who end up using this language.
+%
+THE LESSER-KNOWN PROGRAMMING LANGUAGES #5 -- LAIDBACK
+
+ LAIDBACK was developed at the (now defunct) Marin County Center for
+T'ai Chi, Mellowness and Computer Programming, as an alternative to the more
+intense languages of nearby Silicon Valley.
+ The Center was ideal for programmers who liked to soak in hot tubs
+while they worked. Unfortunately, few programmers could survive there long,
+since the Center outlawed pizza and RC Cola in favor of bean curd and Perrier.
+ Many mourn the demise of LAIDBACK because of its reputation as a
+gentle and nonthreatening language. For example, LAIDBACK responded to
+syntax errors with the message SORRY MAN, I JUST CAN'T DEAL BEHIND THAT.
+%
+The liberals can understand everything but people who don't understand them.
+ -- Lenny Bruce
+%
+The life which is unexamined is not worth living.
+ -- Plato
+%
+The light at the end of the tunnel is the headlight of an approaching
+train.
+%
+The light at the end of the tunnel may be an oncoming dragon.
+%
+The light of a hundred stars does not equal the light of the moon.
+%
+The Linimon's Rule About PRs: The More You Close, The More Will Come
+%
+The lion and the calf shall lie down
+together but the calf won't get much sleep.
+ -- Woody Allen
+%
+The little girl expects no declaration of tenderness from her doll.
+She loves it -- and that's all. It is thus that we should love.
+ -- DeGourmont
+%
+The little pieces of my life I give to you,
+with love, to make a quilt to keep away the cold.
+%
+The little town that time forgot,
+Where all the women are strong,
+The men are good-looking,
+And the children above-average.
+ -- Prairie Home Companion
+%
+The local minister noticed a little girl standing outside of his
+door with a basket of kittens.
+ "Hello, little girl, what do you have there?"
+ "These are my Democratic kittens," she replied.
+Amused, the pastor said nothing. Two weeks later he saw the same little
+girl with (apparently) the same basket of kittens.
+ "My, I see you still have your Democratic kittens.", he said.
+ "No, you see, these are Republican kittens," she answered.
+ "Two weeks ago they were Democratic kittens," he replied, puzzled.
+ "Two weeks ago they had their eyes closed."
+%
+The `loner' may be respected, but he is always resented by his colleagues,
+for he seems to be passing a critical judgment on them, when he may be
+simply making a limiting statement about himself.
+ -- Sidney Harris
+%
+The longer I am out of office, the more infallible I appear to myself.
+ -- Henry Kissinger
+%
+The longer the title, the less important the job.
+%
+The longest part of the journey is said to be the passing of the gate.
+ -- Marcus Terentius Varro
+%
+The Lord gave us farmers two strong hands so we could grab as much as
+we could with both of them.
+ -- Joseph Heller, "Catch-22"
+%
+The Lord giveth and the Lord taketh away.
+Indian Giver be the name of the Lord.
+%
+The Lord prefers common-looking people. That is the reason that He makes
+so many of them.
+ -- Abraham Lincoln
+%
+The louder he talked of his honour, the faster we counted our spoons.
+ -- Ralph Waldo Emerson
+%
+The lovely woman-child Kaa was mercilessly chained to the cruel post of
+the warrior-chief Beast, with his barbarian tribe now stacking wood at
+her nubile feet, when the strong clear voice of the poetic and heroic
+Handsomas roared, "Flick your Bic, crisp that chick, and you'll feel my
+steel through your last meal!"
+ -- Winning sentence, 1984 Bulwer-Lytton bad fiction contest
+%
+The luck that is ordained for you will be coveted by others.
+%
+The lunatic, the lover, and the poet,
+Are of imagination all compact...
+ -- William Shakespeare, "A Midsummer Night's Dream"
+%
+The Macintosh is Xerox technology at its best.
+%
+The magic of our first love is our ignorance that it can ever end.
+ -- Benjamin Disraeli
+%
+The main problem I have with cats is, they're not dogs.
+ -- Kevin Cowherd
+%
+The major advances in civilization are processes
+that all but wreck the societies in which they occur.
+ -- A. N. Whitehead
+%
+The major difference between bonds and bond traders is that the
+bonds will eventually mature.
+%
+The major sin is the sin of being born.
+ -- Samuel Beckett
+%
+The majority of husbands remind me of an orangutan trying to play
+the violin.
+ -- Honore de Balzac
+%
+The majority of the stupid is invincible and guaranteed for all time.
+The terror of their tyranny, however, is alleviated by their lack of
+consistency.
+ -- Albert Einstein
+%
+The makers may make,
+And the users may use,
+But the fixers must fix
+With but minimal clues.
+%
+The man she had was kind and clean
+And well enough for every day,
+But oh, dear friends, you should have seen
+The one that got away.
+ -- Dorothy Parker, "The Fisherwoman"
+%
+The Man Who Almost Invented The Vacuum Cleaner
+ The man officially credited with inventing the vacuum cleaner is
+Hubert Cecil Booth. However, he got the idea from a man who almost
+invented it.
+ In 1901 Booth visited a London music-hall. On the bill was an
+American inventor with his wonder machine for removing dust from carpets.
+ The machine comprised a box about one foot square with a bag on top.
+After watching the act -- which made everyone in the front six rows sneeze
+-- Booth went round to the inventor's dressing room.
+ "It should suck not blow," said Booth, coming straight to the
+point. "Suck?", exclaimed the enraged inventor. "Your machine just moves
+the dust around the room," Booth informed him. "Suck? Suck? Sucking is
+not possible," was the inventor's reply and he stormed out. Booth proved
+that it was by the simple expedient of kneeling down, pursing his lips and
+sucking the back of an armchair. "I almost choked," he said afterwards.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The man who follows the crowd will usually get no further than the crowd.
+The man who walks alone is likely to find himself in places no one has ever
+been.
+ -- Alan Ashley-Pitt
+%
+The man who has never been flogged has never been taught.
+ -- Menander
+%
+The man who laughs has not yet been told the terrible news.
+ -- Bertolt Brecht
+%
+The man who raises a fist has run out of ideas.
+ -- H. G. Wells, "Time After Time"
+%
+The man who runs may fight again.
+ -- Menander
+%
+The man who sees, on New Year's day, Mount
+Fuji, a hawk, and an eggplant is forever blessed.
+ -- Old Japanese proverb
+%
+The man who sets out to carry a cat by its tail learns something that
+will always be useful and which never will grow dim or doubtful.
+ -- Mark Twain
+%
+The man who understands one woman is
+qualified to understand pretty well everything.
+ -- Yeats
+%
+The man with the best job in the country is the Vice President. All he has
+to do is get up every morning and say, "How's the President?"
+ -- Will Rogers
+
+The vice-presidency ain't worth a pitcher of warm spit.
+ -- Vice President John Nance Garner
+%
+The Marines:
+ The few, the proud, the dead on the beach.
+%
+The Marines:
+ The few, the proud, the not very bright.
+%
+The mark of a good party is that you wake up the next morning
+wanting to change your name and start a new life in different city.
+ -- Vance Bourjaily, "Esquire"
+%
+The mark of the immature man is that he wants to die nobly for a cause,
+while the mark of a mature man is that he wants to live humbly for one.
+ -- Wilhelm Stekel
+%
+The mark of your ignorance is the depth of your belief in injustice
+and tragedy. What the caterpillar calls the end of the world, the
+master calls a butterfly.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+The marriage of Marxism and feminism has been like the marriage of
+husband and wife depicted in English common law: Marxism and feminism
+are one, and that one is Marxism.
+ -- Heidi Hartmann,
+ "The Unhappy Marriage of Marxism and Feminism"
+%
+The Martian Canals were clearly the Martian's last ditch effort!
+%
+The marvels of today's modern technology include the development of a
+soda can, which, when discarded will last forever -- and a $7,000 car
+which, when properly cared for, will rust out in two or three years.
+%
+The mate for beauty should be a man and not a money chest.
+ -- Bulwer
+%
+The mature Bohemian is one whose woman works full time.
+%
+The means-and-ends moralists, or non-doers,
+always end up on their ends without any means.
+ -- Saul Alinsky
+%
+The meat is rotten, but the booze is holding out.
+Computer translation of "The spirit is willing, but the flesh is weak."
+%
+The meek don't want it.
+%
+The meek inherit the earth -- usually in small sections... about 6 by 3.
+%
+The meek shall inherit the earth -- they are too weak to refuse.
+%
+The meek shall inherit the earth; but by that
+time there won't be anything left worth inheriting.
+%
+The meek shall inherit the earth, but *not* its mineral rights.
+ -- J. P. Getty
+%
+The meek shall inherit the earth; the rest of us, the Universe.
+%
+The meek shall inherit the earth; the rest of us will go to the stars.
+%
+The meek shall inherit the Earth.
+(But they're gonna have to fight for it.)
+%
+The meek will inherit the earth -- if that's OK with you.
+%
+The meeting of two personalities is like the contact of two
+chemical substances: if there is any reaction, both are transformed.
+ -- Carl G. Jung
+%
+[The members of the Chamberlain government] are decided only to be
+undecided, resolved to be irresolute, adamant for drift, all-powerful
+for impotency.
+ -- Winston Churchill
+%
+The men sat sipping their tea in silence. After a while the klutz said,
+ "Life is like a bowl of sour cream."
+ "Like a bowl of sour cream?" asked the other. "Why?"
+ "How should I know? What am I, a philosopher?"
+%
+The meta-Turing test counts a thing as intelligent if it seeks to
+devise and apply Turing tests to objects of its own creation.
+ -- Lew Mammel, Jr.
+%
+The Microsoft Exchange MTA Stacks service depends on the Microsoft Exchange
+System Attendant service which failed to start because of the following
+error:
+
+The operation completed successfully.
+
+For more information, see Help and Support Center at
+http://go.microsoft.com/fwlink/events.asp.
+%
+The minute a man is convinced that he is interesting, he isn't.
+%
+The mirror sees the man as beautiful, the mirror loves the man; another
+mirror sees the man as frightful and hates him; and it is always the same
+being who produces the impressions.
+ -- Marquis D. A. F. de Sade
+%
+The misnaming of fields of study is so common as to lead to what might be
+general systems laws. For example, Frank Harary once suggested the law that
+any field that had the word "science" in its name was guaranteed thereby
+not to be a science. He would cite as examples Military Science, Library
+Science, Political Science, Homemaking Science, Social Science, and Computer
+Science. Discuss the generality of this law, and possible reasons for its
+predictive power.
+ -- Gerald Weinberg, "An Introduction to General Systems
+ Thinking"
+%
+The Modelski Chain Rule:
+1: Look intently at the problem for several minutes. Scratch your
+ head at 20-30 second intervals. Try solving the problem on your
+ Hewlett-Packard.
+2: Failing this, look around at the class. Select a particularly
+ bright-looking individual.
+3: Procure a large chain.
+4: Walk over to the selected student and threaten to beat him severely
+ with the chain unless he gives you the answer to the problem.
+ Generally, he will. It may also be a good idea to give him a sound
+ thrashing anyway, just to show you mean business.
+%
+The modern child will answer you back before you've said anything.
+ -- Dr. Laurence J. Peter
+%
+"The molars, I'm sure, will be all right, the molars can take care of
+themselves," the old man said, no longer to me. "But what will become
+of the bicuspids?"
+ -- The Old Man and his Bridge
+%
+The mome rath isn't born that could outgrabe me.
+ -- Nicol Williamson
+%
+The moon is a planet just like the Earth, only it is even deader.
+%
+The moon is made of green cheese.
+ -- John Heywood
+%
+The moon may be smaller than Earth, but it's further away.
+%
+The Moral Majority is neither.
+%
+The more control, the more that requires control.
+%
+The more cordial the buyers secretary, the greater
+the odds that the competition already has the order.
+%
+The more crap you put up with, the more crap you are going to get.
+%
+The more data I punch in this card, the lighter it becomes, and the
+lower the mailing cost.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+The more I know men the more I like my horse.
+%
+The more I see of men the more I admire dogs.
+ -- Mme De Sevigne (1626-1696)
+%
+The more I want to get something done, the less I call it work.
+ -- Richard Bach, "Illusions"
+%
+The more laws and order are made prominent,
+the more thieves and robbers there will be.
+ -- Lao Tsu
+%
+The more the merrier.
+ -- John Heywood
+%
+The more they over-think the plumbing
+the easier it is to stop up the drain.
+%
+The more things change, the more they remain the same.
+ -- Alphonse Karr
+%
+The more things change, the more they stay insane.
+%
+The more things change, the more they'll never be the same again.
+%
+The more we disagree, the more chance
+there is that at least one of us is right.
+%
+The more you complain, the longer God lets you live.
+%
+The more you sweat in peace, the less you bleed in war.
+%
+The Moscow Evening News advertised a contest for the best political joke.
+First prize was ten years in prison; second prize, five years; third prize,
+three years; and there were six honorable mentions of one year each.
+%
+The mosquito exists to keep the mighty humble.
+%
+The mosquito is the state bird of New Jersey.
+ -- Andy Warhol
+%
+The moss on the tree does not fear the talons of the hawk.
+%
+The most advantageous, pre-eminent thing thou canst do is not to
+exhibit nor display thyself within the limits of our galaxy, but
+rather depart instantaneously whence thou even now standest and
+flee to yet another rotten planet in the universe, if thou canst
+have the good fortune to find one.
+ -- Carlyle
+%
+The most common given name in the world is Mohammad; the most common
+family name in the world is Chang. Can you imagine the enormous number
+of people in the world named Mohammad Chang?
+ -- Derek Wills
+%
+The most costly of all follies is to believe passionately
+in the palpably not true. It is the chief occupation of mankind.
+ -- H. L. Mencken
+%
+The most dangerous food is wedding cake.
+ -- American proverb
+%
+The most dangerous organization in America today is:
+
+ a) The KKK
+ b) The American Nazi Party
+ c) The Delta Frequent Flyer Club
+%
+The most delightful day after the one on which you buy a cottage in
+the country is the one on which you resell it.
+ -- J. Brecheux
+%
+The most difficult thing about surviving AIDS
+is trying to convince your parents that you're Haitian.
+%
+The most difficult thing in the world is to know how to do a thing and
+to watch someone else do it wrong without comment.
+ -- Theodore H. White
+%
+The most difficult years of marriage are those following the wedding.
+%
+The most disagreeable thing that your worst enemy says to your face does
+not approach what your best friends say behind your back.
+ -- Alfred De Musset
+%
+The most exciting phrase to hear in science, the one that heralds new
+discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
+ -- Isaac Asimov
+%
+The most exquisite peak in culinary art is conquered when you do right by a
+ham, for a ham, in the very nature of the process it has undergone since last
+it walked on its own feet, combines in its flavor the tang of smoky autumnal
+woods, the maternal softness of earthy fields delivered of their crop children,
+the wineyness of a late sun, the intimate kiss of fertilizing rain, and the
+bite of fire. You must slice it thin, almost as thin as this page you hold
+in your hands. The making of a ham dinner, like the making of a gentleman,
+starts a long, long time before the event.
+ -- W. B. Courtney, "Reflections of Maryland Country Ham",
+ from "Congress Eate It Up"
+%
+...the most exquisitely squalid hells known to middle-class man:
+freshman English at a Midwestern university.
+ -- Tom Wolfe
+%
+The most happy marriage I can imagine to myself would be the union
+of a deaf man to a blind woman.
+ -- Samuel T. Coleridge
+%
+The most hopelessly stupid man is he who is not aware that he is wise.
+%
+The most important early product on the way
+to developing a good product is an imperfect version.
+%
+The most important service rendered by the press is that of educating
+people to approach printed matter with distrust.
+%
+The most important thing in a relationship between a man and a woman
+is that one of them be good at taking orders.
+ -- Linda Festa
+%
+The most important things, each person must do for himself.
+%
+The most popular labor-saving device today is still a husband with money.
+ -- Joey Adams, "Cindy and I"
+%
+The most recent attempt to revive the moribund campus left, a national
+conference held at Rutgers University February 5-7, ended when the
+participants decided that they were too racist to found a new national
+organization.
+ The stated goal of the conference was the formation of a national
+organization that would "give expression to a shared consciousness." The
+orientation materials declared that this was "a historic moment" -- you
+know, like Port Huron and the Sixties -- and the Rutgers host committee had
+every reason to expect their goal would be accomplished.
+ But it was not to be. Given that this was a conference of *New*
+New Leftists, reason had nothing to do with it.
+ A revealing article by Vania del Borgo and Maria Margaronis in "The
+Nation", ["Beyond the Fragments," 3/26/88] says "The defining moment of the
+weekend came when the conference was almost at its end. On Sunday morning,
+a twenty-five-member students of color caucus confronted the assembled body
+with its overwhelming whiteness..." Joined by the Gay & Bisexual Caucus, the
+Students of Color Caucus declared that the founding of such an overwhelmingly
+white organization would itself constitute a racist act. The four hundred or
+so leftist activists were told that they had no right to ratify a constitution
+or elect any officers. While recognizing "the need to examine the real
+possibilities of a broad-based, racially diverse student movement" and paying
+lip service to the need for "dialogue," they threatened to walk out if their
+demands were not met. As *The Nation* article describes the scene: "To their
+astonishment, their intervention was greeted with a standing ovation." Handed
+an ultimatum which demanded that they disband, this would-be successor to the
+radical student movements of the Sixties promptly voted itself out of
+existence. As del Borgo and Margaronis put it, "After much chaotic discussion
+and a confused voice vote, the convention suspended all its other work and
+broke into regional groups to discuss `outreach.'"
+ -- Libertarian Agenda, May 1988
+%
+The most remarkable thing about my mother is that for thirty years she
+served the family nothing but leftovers. The original meal has never
+been found.
+ -- Calvin Trillin
+%
+The most serious doubt that has been thrown on the authenticity of the
+biblical miracles is the fact that most of the witnesses in regard to
+them were fishermen.
+ -- Arthur Binstead
+%
+The Most Unsuccessful Version Of The Bible
+ The most exciting version of the Bible was printed in 1631 by Robert
+Barker and Martin Lucas, the King's printers at London. It contained
+several mistakes, but one was inspired -- the word "not" was omitted from
+the Seventh Commandment and enjoined its readers, on the highest authority,
+to commit adultery.
+ Fearing the popularity with which this might be received in remote
+country districts, King Charles I called all 1,000 copies back in and fined
+the printers L3,000.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The most winning woman I ever knew was hanged for poisoning three little
+children for their insurance money.
+ -- Sherlock Holmes
+%
+The moving cursor writes, and having written, blinks on.
+%
+The Moving Finger writes; and, having writ,
+ Moves on: nor all they Piety nor Wit
+Shall lure it back to cancel half a Line,
+ Nor all thy Tears wash out a Word of it.
+%
+The myth of romantic love holds that once you've fallen in love with the
+perfect partner, you're home free. Unfortunately, falling out of love
+seems to be just as involuntary as falling into it.
+%
+The naked truth of it is, I have no shirt.
+ -- William Shakespeare, "Love's Labour's Lost"
+%
+The nation that controls magnetism controls the universe.
+ -- Chester Gould/Dick Tracy
+%
+The National Association of Theater Concessionaires reported that in
+1986, 60% of all candy sold in movie theaters was sold to Roger Ebert.
+ -- David Letterman
+%
+The National Short-Sleeved Shirt Association says:
+ Support your right to bare arms!
+%
+The nearer to the church, the further from God.
+ -- John Heywood
+%
+The Net interprets censorship as damage and routes around it.
+ -- John Gilmore
+%
+The net is like a vast sea of lutefisk with tiny dinosaur brains embedded
+in it here and there. Any given spoonful will likely have an IQ of 1, but
+occasional spoonfuls may have an IQ more than six times that!
+ -- James "Kibo" Parry
+%
+The net of law is spread so wide,
+No sinner from its sweep may hide.
+Its meshes are so fine and strong,
+They take in every child of wrong.
+O wondrous web of mystery!
+Big fish alone escape from thee!
+ -- James Jeffrey Roche
+%
+The new Congressmen say they're going to turn the government around.
+I hope I don't get run over again.
+%
+The New England Journal of Medicine reports that 9 out of 10
+doctors agree that 1 out of 10 doctors is an idiot.
+%
+THE NEW RIGHT:
+ A javelin team that elects to receive.
+%
+The New Testament offers the basis for modern computer coding theory,
+in the form of an affirmation of the binary number system.
+
+ But let your communication be Yea, yea; nay, nay:
+ for whatsoever is more than these cometh of evil.
+
+ -- Matthew 5:37
+%
+The New York Times is read by the people who run the country. The
+Washington Post is read by the people who think they run the country.
+The National Enquirer is read by the people who think Elvis is alive
+and running the country ...
+ -- Robert J. Woodhead
+%
+The next person to mention spaghetti stacks
+to me is going to have his head knocked off.
+ -- Bill Conrad
+%
+The next thing I say to you will be true.
+The last thing I said was false.
+%
+The nice thing about egotists is that they don't talk about other people.
+ -- Lucille S. Harper
+%
+The nice thing about standards
+is that there are so many of them to choose from.
+ -- Andrew S. Tanenbaum
+%
+The nicest thing about the Alto is that it doesn't run faster at night.
+%
+The night passes quickly when you're asleep
+But I'm out shufflin' for something to eat
+...
+Breakfast at the Egg House,
+Like the waffle on the griddle,
+I'm burnt around the edges,
+But I'm tender in the middle.
+ -- Adrian Belew
+%
+The notes blatted skyward as the rose over the Canada geese, feathered
+rumps mooning the day, webbed appendages frantically pedaling unseen
+bicycles in their search for sustenance, driven by cruel Nature's maxim,
+'Ya wanna eat, ya gotta work,' and at last I knew Pittsburgh.
+ -- Winning sentence, 1987 Bulwer-Lytton bad fiction contest
+%
+The notion of a "record" is an obsolete
+remnant of the days of the 80-column card.
+ -- Dennis M. Ritchie
+%
+The notion that the church, the press, and the universities should
+serve the state is essentially a Communist notion ... In a free society
+these institutions must be wholly free -- which is to say that their
+function is to serve as checks upon the state.
+ -- Alan Barth
+%
+The number of arguments is unimportant unless some of them are
+correct.
+ -- Ralph Hartley
+%
+The number of computer scientists in a room is inversely
+proportional to the number of bugs in their code.
+%
+The number of feet in a yard is directly proportional to the success
+of the barbecue.
+%
+The number of licorice gumballs you get out of a gumball machine
+increases in direct proportion to how much you hate licorice.
+%
+The number of UNIX installations has grown to 10, with more expected.
+ -- The Unix Programmer's Manual, 2nd Edition, June 1972
+%
+The NY Times is read by the people who run the country. The Washington Post
+is read by the people who think they run the country. The National Enquirer
+is read by the people who think Elvis is alive and running the country.
+ -- Robert Woodhead
+%
+The objective of all dedicated employees should be to thoroughly analyze
+all situations, anticipate all problems prior to their occurrence, have
+answers for these problems, and move swiftly to solve these problems
+when called upon.
+ However...
+When you are up to your ass in alligators it is difficult to remind
+yourself your initial objective was to drain the swamp.
+%
+The odds are a million to one against your being one in a million.
+%
+The Official Colorado State Vegetable is now the "state legislator".
+%
+The Official MBA Handbook on business cards:
+
+ Avoid overly pretentious job titles such as "Lord of the
+ Realm, Defender of the Faith, Emperor of India" or "Director
+ of Corporate Planning."
+%
+The Official MBA Handbook on doing company business on an airplane:
+
+ Do not work openly on top-secret company cost documents unless
+ you have previously ascertained that the passenger next to you
+ is blind, a rock musician on mood-ameliorating drugs, or the
+ unfortunate possessor of a forty-seventh chromosome.
+%
+The Official MBA Handbook on the use of sunlamps:
+
+ Use a sunlamp only on weekends. That way, if the office wise guy
+ remarks on the sudden appearance of your tan, you can fabricate
+ some story about a sun-stroked weekend at some island Shangri-La
+ like Caneel Bay. Nothing is more transparent than leaving the
+ office at 11:45 on a Tuesday night, only to return an Aztec sun
+ god at 8:15 the next morning.
+%
+The old complaint that mass culture is designed for eleven-year-olds
+is of course a shameful canard. The key age has traditionally been
+more like fourteen.
+ -- Robert Christgau, "Esquire"
+%
+The old man had lived all his life in a little house on the Vermont side of the
+New Hampshire-Vermont border. One day, the surveyors came to inform him that
+they had just discovered that he lived in New Hampshire, not Vermont.
+ "Thank heavens!" was his heartfelt reply. "I don't think I could have
+taken another one of those damned Vermont winters!"
+%
+THE OLD POOL SHOOTER had won many a game in his life. But now it was time
+to hang up the cue. When he did, all the other cues came crashing to the
+floor.
+
+"Sorry," he said with a smile.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+The older a man gets, the farther he had to walk to school as a boy.
+%
+The older I grow, the less important the comma becomes.
+Let the reader catch his own breath.
+ -- Elizabeth Clarkson Zwart
+%
+The older I grow, the more I distrust the
+familiar doctrine that age brings wisdom.
+ -- H. L. Mencken
+%
+The one charm of marriage is that it makes a life of deception a necessity.
+ -- Oscar Wilde
+%
+The one good thing about repeating your
+mistakes is that you know when to cringe.
+%
+The one L lama, he's a priest
+The two L llama, he's a beast
+And I will bet my silk pyjama
+There isn't any three L lllama.
+ -- Ogden Nash, to which a fire chief replied that occasionally
+ his department responded to something like a "three L lllama."
+%
+The One Page Principle:
+ A specification that will not fit on one page of 8.5x11 inch paper
+ cannot be understood.
+ -- Mark Ardis
+%
+The one sure way to make a lazy man look
+respectable is to put a fishing rod in his hand.
+%
+The only alliance I would make with the Women's Liberation Movement is in bed.
+ -- Abbey Hoffman
+%
+The only certainty is that nothing is certain.
+ -- Pliny the Elder
+%
+The only constant is change.
+%
+The only cultural advantage LA has over NY is that you can make a
+right turn on a red light.
+ -- Woody Allen
+%
+The only difference between a car salesman and a computer salesman is
+that the car salesman knows he's lying.
+%
+The only difference between a rut and a grave is their dimensions.
+%
+The only difference between the saint and the sinner is that
+every saint has a past and every sinner has a future.
+ -- Oscar Wilde
+%
+The only difference in the game of love over the last few
+thousand years is that they've changed trumps from clubs to diamonds.
+ -- The Indianapolis Star
+%
+The only function of economic forecasting is to make astrology look
+respectable.
+ -- John Kenneth Galbraith
+%
+The only happiness lies in reason; all the rest of the world is dismal.
+The highest reason, however, I see in the work of the artist, and he may
+experience it as such. Happiness lies in the swiftness of feeling and
+thinking: all the rest of the world is slow, gradual and stupid. Whoever
+could feel the course of a light ray would be very happy, for it is very
+swift. Thinking of oneself gives little happiness. If, however, one feels
+much happiness in this, it is because at bottom one is not thinking of
+oneself but of one's ideal. This is far, and only the swift shall reach
+it and are delighted.
+ -- Friedrich Nietzsche
+%
+The only "ism" Hollywood believes in is plagiarism.
+ -- Dorothy Parker
+%
+The only justification for our concepts and systems of concepts is
+that they serve to represent the complex of our experiences;
+beyond this they have no legitimacy.
+ -- Albert Einstein
+%
+The only one of your children who does not grow up and move away
+is your husband.
+%
+The only people for me are the mad ones -- the ones who are mad to live,
+mad to talk, mad to be saved, desirous of everything at the same time,
+the ones who never yawn or say a commonplace thing, but burn, burn, burn
+like fabulous yellow Roman candles.
+ -- Jack Kerouac, "On the Road"
+%
+The only people who make love all the time are liars.
+ -- Louis Jordan
+%
+The only perfect science is hind-sight.
+%
+The only person who always got his work done by Friday was Robinson Crusoe.
+%
+The only possible interpretation of any research
+whatever in the "social sciences" is: some do, some don't.
+ -- Ernest Rutherford
+%
+The only problem with being a man of leisure
+is that you can never stop and take a rest.
+%
+The only problem with seeing too much is that it makes you insane.
+ -- Phaedrus
+%
+The only promotion rules I can think of are that a sense of shame is to
+be avoided at all costs and there is never any reason for a hustler to
+be less cunning than more virtuous men. Oh yes ... whenever you think
+you've got something really great, add ten per cent more.
+ -- Bill Veeck
+%
+The only qualities for real success in journalism are ratlike cunning, a
+plausible manner and a little literary ability. The capacity to steal
+other people's ideas and phrases ... is also invaluable.
+ -- Nicolas Tomalin, "Stop the Press, I Want to Get On"
+%
+The only real advantage to punk music is that nobody can whistle it.
+%
+The only real argument for marriage is that it remains the best method
+for getting acquainted.
+ -- Heywood Broun
+%
+The only real way to look younger is not to be born so soon.
+ -- Charles Schulz, "Things I've Had to Learn Over and
+ Over and Over"
+%
+The only really decent thing to do behind a person's back is pat it.
+%
+The only really good place to buy lumber is at a store where the lumber
+has already been cut and attached together in the form of furniture,
+finished, and put inside boxes.
+ -- Dave Barry, "The Taming of the Screw"
+%
+The only really masterful noise a man makes in a house is the noise
+of his key, when he is still on the landing, fumbling for the lock.
+ -- Colette
+%
+The only reward of virtue is virtue.
+ -- Ralph Waldo Emerson
+%
+The only rose without thorns is friendship.
+%
+The only thing better than love is milk.
+%
+The only thing cheaper than hardware is talk.
+%
+The only thing that experience teaches us is that experience teaches
+us nothing.
+ -- Andre Maurois (Emile Herzog)
+%
+The only thing that stops God from sending a second Flood is that
+the first one was useless.
+ -- Nicolas Chamfort
+%
+The only thing we learn from history is that we do not learn.
+ -- Earl Warren
+
+That men do not learn very much from history is the most important of all
+the lessons that history has to teach.
+ -- Aldous Huxley
+
+We learn from history that we do not learn from history.
+ -- Georg Wilhelm Friedrich Hegel
+
+HISTORY: Papa Hegel he say that all we learn from history is that we learn
+nothing from history. I know people who can't even learn from what happened
+this morning. Hegel must have been taking the long view.
+ -- Chad C. Mulligan, "The Hipcrime Vocab"
+%
+The only thing we learn from history is that we learn nothing from
+history.
+ -- Georg Wilhelm Friedrich Hegel
+
+I know guys can't learn from yesterday ... Hegel must be taking the
+long view.
+ -- John Brunner, "Stand on Zanzibar"
+%
+The only thing which separates man from child is all the values
+he has lost over the years.
+ -- Poul Henningsen (1894-1967)
+%
+The only time a dog gets complimented is when he doesn't do anything.
+ -- C. Schultz
+%
+The only two things that motivate me and that matter to me are revenge
+and guilt.
+ -- Elvis Costello
+%
+The only way to amuse some people
+is to slip and fall on an icy pavement.
+%
+The only way to get rid of a temptation is to yield to it.
+ -- Oscar Wilde
+%
+The only way to keep your health is to eat what you don't want,
+drink what you don't like, and do what you'd rather not.
+ -- Mark Twain
+%
+The only winner in the War of 1812 was Tchaikovsky.
+ -- David Gerrold
+%
+The onset and the waning of love make themselves felt
+in the uneasiness experienced at being alone together.
+ -- Jean de la Bruyere
+%
+The opossum is a very sophisticated animal. It doesn't even get up
+until 5 or 6 PM.
+%
+The opposite of a correct statement is a false statement. But the opposite
+of a profound truth may well be another profound truth.
+ -- Niels Bohr
+%
+The opposite of a profound truth may well be another profound truth.
+ -- Niels Bohr
+%
+The opposite of talking isn't listening. The opposite of talking is
+waiting.
+ -- Fran Lebowitz, "Social Studies"
+%
+The optimist thinks that this is the best of all possible worlds,
+and the pessimist knows it.
+ -- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"
+
+Yet creeds mean very little, Coth answered the dark god, still speaking
+almost gently. The optimist proclaims that we live in the best of all
+possible worlds; and the pessimist fears this is true.
+ -- James Cabell, "The Silver Stallion"
+%
+The optimum committee has no members.
+ -- Norman Augustine
+%
+The opulence of the front office door varies
+inversely with the fundamental solvency of the firm.
+%
+The orders come down and they march us away.
+There's a battle outside and we join in the fray.
+God, it's hell when you know this could be your last day,
+But it's better than working for Xerox.
+ -- Frank Hayes, "Don't Ask"
+%
+The other day I put instant coffee in my microwave oven ... I almost
+went back in time.
+ -- Steven Wright
+%
+The other day I... uh, no, that wasn't me.
+ -- Steven Wright
+%
+The other line moves faster.
+%
+The owner of a large furniture store in the mid-west arrived in France on
+a buying trip. As he was checking into a hotel he struck up an acquaintance
+with a beautiful young lady. However, she only spoke French and he only spoke
+English, so each couldn't understand a word the other spoke. He took out a
+pencil and a notebook and drew a picture of a coach. She smiled, nodded her
+head and they went for a ride in the park. Later, he drew a picture of a
+table in a restaurant with a question mark and she nodded, so they went to
+dinner. After dinner he sketched two dancers and she was delighted. They
+went to several nightclubs, drank champagne, danced and had a glorious
+evening. It had gotten quite late when she motioned for the pencil and drew
+a picture of a four-poster bed. He was dumbfounded, and to this day has
+never been able to understand how she knew he was in the furniture business.
+%
+The part of the world that people find most puzzling is the part called "Me".
+%
+The party adjourned to a hot tub, yes. Fully clothed, I might add.
+ -- IBM employee, testifying in California State Supreme Court
+%
+The passionate young thing was having a difficult time getting across what
+she wanted from her rather dense boyfriend. Finally she asked,
+ "Would you like to see where I was operated on for appendicitis?"
+ "Gosh, no!" he replied. "I hate hospitals."
+%
+The past always looks better than it was.
+It's only pleasant because it isn't here.
+ -- Finley Peter Dunne (Mr. Dooley)
+%
+The penalty for laughing in a courtroom is six months in jail; if it
+were not for this penalty, the jury would never hear the evidence.
+ -- H. L. Mencken
+%
+The people sensible enough to give
+good advice are usually sensible enough to give none.
+%
+The perfect friend sees the best in you -- sees it constantly --
+not just when you occasionally are that way, but also when you
+waver, when you forget yourself, act like less than you are.
+In time, you become more like his vision of you -- which is the
+person you have always wanted to be.
+ -- Nancy Friday
+%
+The perfect lover is one who turns into a pizza at 4:00 A.M.
+ -- Charles Pierce
+%
+The perfect man is the true partner. Not a bed partner nor a fun partner,
+but a man who will shoulder burdens equally with [you] and possess that
+quality of joy.
+ -- Erica Jong
+%
+The person who makes no mistakes does not usually make anything.
+%
+The person who marries for money usually earns every penny of it.
+%
+The person who's taking you to lunch has no intention of paying.
+%
+The person you rejected yesterday could make you happy, if you say yes.
+%
+The personal computer market is about the same size as the total potato chip
+market. Next year it will be about half the size of the pet food market and
+is fast approaching the total worldwide sales of pantyhose"
+ -- James Finke, Commodore Int'l Ltd., 1982
+%
+The philosopher's treatment of a question
+is like the treatment of an illness.
+ -- Wittgenstein
+%
+The Phone Booth Rule:
+ A lone dime always gets the number nearly right.
+%
+The Pig, if I am not mistaken,
+Gives us ham and pork and Bacon.
+Let others think his heart is big,
+I think it stupid of the Pig.
+ -- Ogden Nash
+%
+The pitcher wound up and he flang the ball at the batter. The batter swang
+and missed. The pitcher flang the ball again and this time the batter
+connected. He hit a high fly right to the center fielder. The center
+fielder was all set to catch the ball, but at the last minute his eyes were
+blound by the sun and he dropped it.
+ -- Dizzy Dean
+%
+The plot was designed in a light vein that somehow became varicose.
+ -- David Lardner
+%
+The Poems, all three hundred of them,
+may be summed up in one of their phrases:
+"Let our thoughts be correct".
+ -- Confucius
+%
+The Poet Whose Badness Saved His Life
+ The most important poet in the seventeenth century was George
+Wither. Alexander Pope called him "wretched Wither" and Dryden said of his
+verse that "if they rhymed and rattled all was well".
+ In our own time, "The Dictionary of National Biography" notes that his
+work "is mainly remarkable for its mass, fluidity and flatness. It usually
+lacks any genuine literary quality and often sinks into imbecile doggerel".
+ High praise, indeed, and it may tempt you to savour a typically
+rewarding stanza: It is taken from "I loved a lass" and is concerned with
+the higher emotions.
+ She would me "Honey" call,
+ She'd -- O she'd kiss me too.
+ But now alas! She's left me
+ Falero, lero, loo.
+ Among other details of his mistress which he chose to immortalize
+was her prudent choice of footwear.
+ The fives did fit her shoe.
+ In 1639 the great poet's life was endangered after his capture by
+the Royalists during the English Civil War. When Sir John Denham, the
+Royalist poet, heard of Wither's imminent execution, he went to the King and
+begged that his life be spared. When asked his reason, Sir John replied,
+"Because that so long as Wither lived, Denham would not be accounted the
+worst poet in England."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The poetry of heroism appeals irresistibly to those who don't go to a war,
+and even more so to those whom the war is making enormously wealthy."
+ -- Celine
+%
+The point is, you see, that there is no point in driving yourself mad
+trying to stop yourself going mad. You might just as well give in and
+save your sanity for later.
+%
+The polite thing to do has always been to address people as they wish to be
+addressed, to treat them in a way they think dignified. But it is equally
+important to accept and tolerate different standards of courtesy, not
+expecting everyone else to adapt to one's own preferences. Only then can
+we hope to restore the insult to its proper social function of expressing
+true distaste.
+ -- Judith Martin, "Miss Manners' Guide to Excruciatingly
+ Correct Behavior"
+%
+The politician is someone who deals in man's problems of adjustment.
+To ask a politician to lead us is to ask the tail of a dog to lead the dog.
+ -- Buckminster Fuller
+%
+The pollution's at that awkward stage.
+Too thick to navigate and too thin to cultivate.
+ -- Doug Sneyd
+%
+The porcupine with the sharpest quills gets stuck on a tree more
+often.
+%
+The possession of a book becomes a substitute for reading it.
+ -- Anthony Burgess
+%
+The powers not delegated to the United States by the Constitution, nor
+prohibited by it to the States, are reserved to the States respectively,
+or to the people.
+ -- U.S. Constitution, Amendment 10. (Bill of Rights)
+%
+The Preacher, the Politician, the Teacher,
+ Were each of them once a kiddie.
+A child, indeed, is a wonderful creature.
+ Do I want one? God Forbiddie!
+ -- Ogden Nash
+%
+The President publicly apologized today to all those offended by his
+brother's remark, "There's more Arabs in this country than there is
+Jews!". Those offended include Arabs, Jews, and English teachers.
+ -- Baltimore, Channel 11 News, on Jimmy Carter
+%
+The prettiest women are almost always the most
+boring, and that is why some people feel there is no God.
+ -- Woody Allen, "Without Feathers"
+%
+The price of greatness is responsibility.
+%
+The price of seeking to force our beliefs on others is that someday
+they might force their beliefs on us.
+ -- Mario Cuomo
+%
+The price of success in philosophy is triviality.
+ -- C. Glymour
+%
+The price one pays for pursuing any profession, or calling, is an intimate
+knowledge of its ugly side.
+ -- James Baldwin
+%
+The primary cause of failure in electrical appliances is an expired
+warranty. Often, you can get an appliance running again simply by
+changing the warranty expiration date with a 15/64-inch felt-tipped
+marker.
+ -- Dave Barry, "The Taming of the Screw"
+%
+The primary function of the design engineer is to make things
+difficult for the fabricator and impossible for the serviceman.
+%
+The primary purpose of the DATA statement is to give names to constants;
+instead of referring to pi as 3.141592653589793 at every appearance, the
+variable PI can be given that value with a DATA statement and used instead
+of the longer form of the constant. This also simplifies modifying the
+program, should the value of pi change.
+ -- FORTRAN manual for Xerox Computers
+%
+The primary requisite for any new tax law is for it to exempt enough
+voters to win the next election.
+%
+The primary theme of SoupCon is communication. The acronym "LEO"
+represents the secondary theme:
+
+ Law Enforcement Officials
+
+The overall theme of SoupCon shall be:
+
+ Avoiding Communication with Law Enforcement Officials
+ -- M. Gallaher
+%
+The probability of someone watching you is directly
+proportional to the stupidity of your action.
+%
+The problem ... is that we have run out of dinosaurs to form oil with.
+Scientists working for the Department of Energy have tried to form oil
+using other animals; they've piled thousands of tons of sand and Middle
+Eastern countries on top of cows, raccoons, haddock, laboratory rats,
+etc., but so far all they have managed to do is run up an enormous
+bulldozer-rental bill and anger a lot of Middle Eastern persons. None
+of the animals turned into oil, although most of the laboratory rats
+developed cancer.
+ -- Dave Barry, "Postpetroleum Guzzler"
+%
+The problem that we thought was a problem was, indeed,
+a problem, but not the problem we thought was the problem.
+ -- Mike Smith
+%
+The problem with any unwritten law is that
+you don't know where to go to erase it.
+ -- Glaser and Way
+%
+The problem with graduate students, in general, is that they have
+to sleep every few days.
+%
+The problem with me is that I am fifty or one hundred years ahead of my
+time. My speed is very fast. Some ministers have had to drop out of my
+government because they could not keep up.
+ -- Idi Amin Dada
+%
+The problem with most conspiracy theories is that they seem to believe that
+for a group of people to behave in a way detrimental to the common good
+requires intent.
+%
+The problem with people who have no vices is that generally you can
+be pretty sure they're going to have some pretty annoying virtues.
+ -- Elizabeth Taylor
+%
+The problem with the gene pool is that there is no lifeguard.
+%
+The problem with this country is that there is no death penalty
+for incompetence.
+%
+The problems of business administration in general, and database management in
+particular are much too difficult for people that think in IBMese, compounded
+with sloppy English.
+ -- Edsger W. Dijkstra
+%
+The profession of book writing makes horse racing seem like a solid,
+stable business.
+ -- John Steinbeck
+%
+The program isn't debugged until the last user is dead.
+%
+The proof of the pudding is in the eating.
+ -- Miguel de Cervantes
+%
+The proof that IBM didn't invent the car is that it has a steering wheel
+and an accelerator instead of spurs and ropes, to be compatible with a
+horse.
+ -- Jac Goudsmit
+%
+The propriety of some persons seems to consist in having improper
+thoughts about their neighbours.
+ -- F. H. Bradley
+%
+The Psblurtex is an 18-inch long anaconda that hides in the gentlemen's
+outfitting departments of Amazonian stores and is often bought by mistake
+since its colors are those of the London Reform Club. Once tied around its
+victim's neck, it strangles him gently and then claims the insurance before
+running off to Germany where it lives in hiding.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+The public demands certainties; it must be told definitely and a bit
+raucously that this is true and that is false. But there are no
+certainties.
+ -- H. L. Mencken, "Prejudice"
+%
+The Public is merely a multiplied "me."
+ -- Mark Twain
+%
+The Puritan hated bear-baiting, not because it gave pain to the bear, but
+because it gave pleasure to the spectators.
+ -- Thomas Macaulay, "History of England"
+%
+The purpose of Physics 7A is to make the engineers realize that they're
+not perfect, and to make the rest of the people realize that they're not
+engineers.
+%
+The qotc (quote of the con) was Liz's:
+ "My brain is paged out to my liver"
+%
+The quality of a pun is in the "Oy!" of the beholder.
+%
+The Queen is most anxious to enlist every one who can speak or write to
+join in checking this mad, wicked folly of "Woman's Rights", with all its
+attendant horrors, on which her poor feeble sex is bent, forgetting every
+sense of womanly feeling and propriety. Lady-- ought to get a good
+whipping. It is a subject which makes the Queen so furious that she cannot
+contain herself. God created men and women different -- then let them
+remain each in their own position.
+ -- Letter to Sir Theodore Martin, 29 May 1870, from
+ Queen Victoria
+%
+The question is, why are politicians so eager to be president? What is
+it about the job that makes it worth revealing, on national television,
+that you have the ethical standards of a slime-coated piece of
+industrial waste?
+ -- Dave Barry, "On Presidential Politics"
+%
+The questions remain the same.
+The answers are eternally variable.
+%
+The Rabbits The Cow
+Here is a verse about rabbits The cow is of the bovine ilk;
+That doesn't mention their habits. One end is moo, the other, milk.
+ -- Ogden Nash
+%
+The race is not always to the swift, nor the
+battle to the strong, but that's the way to bet.
+ -- Damon Runyon
+%
+The rain it raineth on the just
+And also on the unjust fella:
+But chiefly on the just, because
+The unjust steals the just's umbrella.
+ -- Lord Bowen
+%
+The Ranger isn't gonna like it, Yogi.
+%
+The rate at which a disease spreads through a corn field is a precise
+measurement of the speed of blight.
+%
+The ratio of literacy to illiteracy is a constant, but nowadays the
+illiterates can read.
+ -- Alberto Moravia
+%
+The reader this message encounters not failing to understand is
+cursed.
+%
+The real man's Bloody Mary:
+ Ingredients: vodka, tomato juice, Tabasco, Worcestershire
+ sauce, A-1 steak sauce, ice, salt, pepper, celery.
+
+ Fill a large tumbler with vodka.
+ Throw all the other ingredients away.
+%
+The real problem with hunting elephants carrying the decoys.
+%
+The real purpose of books is to trap the mind into doing its own thinking.
+ -- Christopher Morley
+%
+The real reason large families benefit society is because at least
+a few of the children in the world shouldn't be raised by beginners.
+%
+The real reason psychology is hard is that
+psychologists are trying to do the impossible.
+%
+The real trouble with reality is that there's no background music.
+%
+The reason computer chips are so small is computers don't eat much.
+%
+The reason it's called "Grape Nuts" is that it contains "dextrose",
+which is also sometimes called "grape sugar", and also because "Grape
+Nuts" is catchier, in terms of marketing, than "A Cross Between Gerbil
+Food and Gravel", which is what it tastes like.
+ -- Dave Barry, "Tips for Writer's"
+%
+The reason people sweat is so they won't catch fire when making love.
+ -- Don Rose
+%
+The reason that every major university maintains a department of
+mathematics is that it's cheaper than institutionalizing all those
+people.
+%
+The reason they're called wisdom teeth
+is that the experience makes you wise.
+%
+The reason we come up with new versions is not to fix bugs. It's
+absolutely not.
+ -- Bill Gates
+%
+The reason why worry kills more people
+than work is that more people worry than work.
+%
+The reasonable man adapts himself to the world; the unreasonable one
+persists in trying to adapt the world to himself. Therefore all
+progress depends on the unreasonable man.
+ -- George Bernard Shaw
+%
+The reasons that each of these countries has had to renege on its
+financial commitments were all somewhat different: Argentina because of
+a war, Poland because of its vast misguided overinvestment in heavy
+industry, Honduras because the coffee price went sour, Zaire because
+nobody in the government there has a clue as to how to run a country.
+ -- Paul Erdman's Money Book
+%
+The relative importance of files depends on their cost
+in terms of the human effort needed to regenerate them.
+ -- T. A. Dolotta
+%
+The requirements of romantic love are difficult to satisfy in the trunk
+of a Dodge Dart.
+ -- Lisa Alther
+%
+The Reverend Henry Ward Beecher
+Called a hen a most elegant creature.
+ The hen, pleased with that,
+ Laid an egg in his hat --
+And thus did the hen reward Beecher.
+ -- Oliver Wendell Holmes
+%
+The reverse side also has a reverse side.
+ -- Japanese proverb
+%
+The revolution will not be televised.
+%
+The reward for working hard is more hard work.
+%
+The reward of a thing well done is to have done it.
+ -- Ralph Waldo Emerson
+%
+The rhino is a homely beast,
+For human eyes he's not a feast.
+Farewell, farewell, you old rhinoceros,
+I'll stare at something less prepoceros.
+ -- Ogden Nash
+%
+The rich get rich, and the poor get poorer.
+The haves get more, the have-nots die.
+%
+The right half of the brain controls the left half of the body.
+This means that only left handed people are in their right mind.
+%
+The Right Honorable Gentleman is indebted to his memory for his jests
+and to his imagination for his facts.
+ -- Sheridan
+%
+The right to be heard does not automatically include the right to be
+taken seriously.
+ -- Hubert H. Humphrey
+%
+The right to be let alone is indeed the beginning of all freedom.
+ -- Justice Douglas
+%
+The right to revolt has sources deep in our history.
+ -- Supreme Court Justice William O. Douglas
+%
+The rights and interests of the laboring man will be protected and cared
+for not by our labor agitators, but by the Christian men to whom God in his
+infinite wisdom has given control of property interests of the country, and
+upon the successful management of which so much remains.
+ -- George F. Baer, railroad industrialist
+%
+The rights you have are the rights given you by this Committee [the
+House Un-American Activities Committee]. We will determine what rights
+you have and what rights you have not got.
+ -- J. Parnell Thomas
+%
+The ripest fruit falls first.
+ -- William Shakespeare, "Richard II"
+%
+The road to Hades is easy to travel.
+ -- Bion
+%
+The road to hell is paved with good intentions. And littered with
+sloppy analysis!
+%
+The road to hell is paved with NAND gates.
+ -- J. Gooding
+%
+The road to ruin is always in good repair,
+and the travellers pay the expense of it.
+ -- Josh Billings
+%
+The Roman Rule
+ The one who says it cannot be done should never interrupt the
+ one who is doing it.
+%
+The root of all superstition is that men
+observe when a thing hits, but not when it misses.
+ -- Francis Bacon
+%
+The rose of yore is but a name, mere names are left to us.
+%
+The Ruffed Pandanga of Borneo and Rotherham spreads out his feathers in
+his courtship dance and imitates Winston Churchill and Tommy Cooper on
+one leg. The padanga is dying out because the female padanga doesn't
+take it too seriously.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+The rule is, jam to-morrow and jam yesterday, but never jam today.
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+The rule on staying alive as a forecaster is to give 'em a number or
+give 'em a date, but never give 'em both at once.
+ -- Jane Bryant Quinn
+%
+The rules are rather simple to understand: Under democracy you
+can defend any view, but only defend it. You can not try to realize
+it through power, violence or weapons.
+ -- Poul Henningsen (1894-1967)
+%
+The rules:
+
+1: Thou shalt not worship other computer systems.
+2: Thou shalt not impersonate Liberace or eat watermelon while sitting at
+ the console keyboard.
+3: Thou shalt not slap users on the face, nor staple their silly little
+ card decks together.
+4: Thou shalt not get physically involved with the computer system,
+ especially if you're already married.
+5: Thou shalt not use magnetic tapes as Frisbees, nor use a disk pack as
+ a stool to reach another disk pack.
+6: Thou shalt not stare at the blinking lights for more than one 8 hour
+ shift.
+7: Thou shalt not tell users that you accidentally destroyed their
+ files/backup just to see the look on their little faces.
+8: Thou shalt not enjoy canceling a job.
+9: Thou shalt not display firearms in the computer room.
+10: Thou shalt not push buttons "just to see what happens".
+%
+The Russians have put a small ball up in the air.
+That does not raise my apprehensions one iota.
+ -- Dwight D. Eisenhower
+%
+The salary of the chief executive of the large corporation is not a market
+award for achievement. It is frequently in the nature of a warm personal
+gesture by the individual to himself.
+ -- John Kenneth Galbraith, "Annals of an Abiding Liberal"
+%
+The San Diego Freeway. Official Parking Lot of the 1984 Olympics!
+%
+The savior becomes the victim.
+%
+The scene: in a vast, painted desert, a cowboy faces his horse.
+
+Cowboy: "Well, you've been a pretty good hoss, I guess. Hardworkin'.
+Not the fastest critter I ever come acrost, but..."
+
+Horse: "No, stupid, not feed*back*. I said I wanted a feed*bag*.
+%
+"The Schizophrenic: An Unauthorized Autobiography"
+%
+The Schwine-Kitzenger Institute study of 47 men over the age of 100
+showed that all had these things in common:
+
+ (1) They all had moderate appetites.
+ (2) They all came from middle class homes.
+ (3) All but two of them were dead.
+%
+The scum also rises.
+ -- Dr. Hunter S. Thompson
+%
+The sealed-paper-in-a-safe thing is only your last resort if all your
+password-knowers get hit by a redundant array of inexperienced busdrivers.
+ -- jpd on comp.unix.freebsd.bsd.misc
+%
+The search for the perfect martini is a fraud. The perfect martini is
+a belt of gin from the bottle; anything else is the decadent trappings
+of civilization.
+ -- T. K.
+%
+The second best policy is dishonesty.
+%
+The Second Law of Thermodynamics:
+ If you think things are in a mess now, just wait!
+ -- Jim Warner
+%
+The secret of happiness is total disregard of everybody.
+%
+The secret of healthy hitchhiking is to eat junk food.
+%
+The secret of success is sincerity. Once you can fake that,
+you've got it made.
+ -- Jean Giraudoux
+%
+The secret source of humor is not joy but sorrow;
+there is no humor in Heaven.
+ -- Mark Twain
+%
+The sendmail configuration file is one of those files that looks like someone
+beat their head on the keyboard. After working with it... I can see why!
+ -- Harry Skelton
+%
+The seven deadly sins ... Food, clothing, firing, rent, taxes,
+respectability and children. Nothing can lift those seven millstones
+from Man's neck but money; and the spirit cannot soar until the
+millstones are lifted.
+ -- George Bernard Shaw
+%
+The seven eyes of Ningauble the Wizard floated back to his hood as he
+reported to Fafhrd: "I have seen much, yet cannot explain all. The Gray
+Mouser is exactly twenty-five feet below the deepest cellar in the palace
+of Gilpkerio Kistomerces. Even though twenty-four parts in twenty-five of
+him are dead, he is alive.
+ Now about Lankhmar. She's been invaded, her walls breached
+everywhere and desperate fighting is going on in the streets, by a fierce
+host which out-numbers Lankhamar's inhabitants by fifty to one -- and
+equipped with all modern weapons. Yet you can save the city."
+ "How?" demanded Fafhrd.
+ Ningauble shrugged. "You're a hero. You should know."
+ -- Fritz Leiber, "The Swords of Lankhmar"
+%
+The seven year itch comes from fooling around during the fourth, fifth,
+and sixth years.
+%
+The sheep died in the wool.
+%
+The sheep that fly over your head are soon to land.
+%
+The shifts of Fortune test the reliability of friends.
+ -- Marcus Tullius Cicero
+%
+The shortest distance between any two puns is a straight line.
+%
+The shortest distance between two points is under construction.
+ -- Noelie Alito
+%
+The Shuttle is now going five times the sound of speed.
+ -- Dan Rather, first landing of Columbia
+%
+The six great gifts of an Irish girl are beauty, soft
+voice, sweet speech, wisdom, needlework, and chastity.
+ -- Theodore Roosevelt, 1907
+%
+The Sixth Commandment of Frisbee:
+ The greatest single aid to distance is for the disc to be going
+in a direction you did not want. (Goes the wrong way = Goes a long
+way.)
+ -- Dan Roddick
+%
+The sixth sheik's sixth sheep's sick.
+ -- [just say that five times...]
+%
+The sky is blue so we know where to stop mowing.
+ -- Judge Harold T. Stone
+%
+The smallest worm will turn being trodden on.
+ -- William Shakespeare, "Henry VI"
+%
+The smiling Spring comes in rejoicing,
+And surly Winter grimly flies.
+Now crystal clear are the falling waters,
+And bonnie blue are the sunny skies.
+Fresh o'er the mountains breaks forth the morning,
+The ev'ning gilds the oceans's swell:
+All creatures joy in the sun's returning,
+And I rejoice in my bonnie Bell.
+
+The flowery Spring leads sunny Summer,
+The yellow Autumn presses near;
+Then in his turn come gloomy Winter,
+Till smiling Spring again appear.
+Thus seasons dancing, life advancing,
+Old Time and Nature their changes tell;
+But never ranging, still unchanging,
+I adore my bonnie Bell.
+ -- Robert Burns, "My Bonnie Bell"
+%
+The so-called "desktop metaphor" of today's workstations is instead an
+"airplane-seat" metaphor. Anyone who has shuffled a lap full of papers
+while seated between two portly passengers will recognize the difference --
+one can see only a very few things at once.
+ -- Frederick Brooks, Jr.
+%
+The so-called lessons of history are for the most part the
+rationalizations of the victors. History is written by the survivors.
+ -- Max Lerner
+%
+The society which scorns excellence in plumbing as a humble activity and
+tolerates shoddiness in philosophy because it is an exalted activity will
+have neither good plumbing nor good philosophy... neither its pipes nor
+its theories will hold water.
+%
+The soldier came knocking upon the queen's door
+He said, "I am not fighting for you anymore"
+The queen knew she had seen his face someplace before
+And slowly she let him inside.
+
+He said, "I see you now, and you're so very young
+But I've seen more battles lost than I have battles won
+And I have this intuition that it's all for your fun
+And now will you tell me why?"
+ -- Suzanne Vega, "The Queen and The Soldier"
+%
+The solution of problems is the most characteristic
+and peculiar sort of voluntary thinking.
+ -- William James
+%
+The solution of this problem is trivial
+and is left as an exercise for the reader.
+%
+The somewhat old and crusty vicar was taking a well-earned retirement from
+his rather old and crusty parish. As is usual in these cases, a locum was
+sent to cover the transition period. This particular man was young and
+active, and had the strange notion that church should also be active and
+exciting. As a consequence he was more than a little disappointed with the
+dull and tradition-bound church. He decided to do something about it.
+ For his first Sunday, he didn't wear the traditional robes and
+vestments, but lead the service wearing a nice 2-piece suit. The congregation
+was horrified! He changed the order of the service. The congregation was
+horrified! Then came the children's lesson.
+ For this he came out of the pulpit, and sat on the communion table.
+The congregation was mortified! He sat there swinging his legs against
+the table as the children gathered around him.
+ He asked the children, "What's small, brown, furry and eats nuts?"
+ There was total silence.
+ He asked again, "What's small, brown, furry and eats nuts?"
+ Total silence.
+ Eventually, one timid youngster put up his hand and said, "Please,
+sir, I know the answer is Jesus, but it sure sounds like a squirrel to me."
+%
+The sooner all the animals are dead, the sooner we'll find their money.
+ -- Ed Bluestone, "The National Lampoon"
+%
+The sooner you fall behind, the more time you'll have to catch up!
+%
+The sooner you make your first 5000 mistakes, the sooner you will be
+able to correct them.
+ -- Nicolaides
+%
+The soul would have no rainbow had the eyes no tears.
+%
+The sounds of the nouns are mostly unbound.
+In town a noun might wear a gown,
+or further down, might dress a clown.
+A noun that's sound would never clown,
+but unsound nouns jump up and down.
+The sound of a noun could disturb the plowing,
+and then, my dear, you'd be put in the pound.
+But please don't let that get you down,
+the renown of your gown is the talk of the town.
+ -- A. Nonnie Mouse
+%
+The Soviet pre-eminence in chess can be traced to the average Russian's
+readiness to brood obsessively over anything, even the arrangement of
+some pieces of wood. Indeed, the Russians' predisposition for quiet
+reflection followed by sudden preventive action explains why they led
+the field for many years in both chess and ax murders. It is well
+known that as early as 1970, the U.S.S.R., aware of what a defeat at
+Reykjavik would do to national prestige, implemented a vigorous program
+of preparation and incentive. Every day for an entire year, a team of
+psychologists, chess analysts and coaches met with the top three
+Russian grand masters and threatened them with a pointy stick. That
+these tactics proved fruitless is now a part of chess history and a
+further testament to the American way, which provides that if you want
+something badly enough, you can always go to Iceland and get it from
+the Russians.
+ -- Marshall Brickman, Playboy, April, 1973
+%
+The Soviet Union, which has complained recently about alleged anti-Soviet
+themes in American advertising, lodged an official protest this week
+against the Ford Motor Company's new campaign: "Hey you stinking, fat
+Russian, get off my Ford Escort."
+ -- Dennis Miller
+%
+The speed of anything depends on the flow of everything.
+%
+The spirit of Plato dies hard. We have been unable to escape the
+philosophical tradition that what we can see and measure in the world
+is merely the superficial and imperfect representation of an underlying
+reality.
+ -- S. J. Gould, "The Mismeasure of Man"
+%
+The star of riches is shining upon you.
+%
+The startling truth finally became apparent, and it was this: Numbers
+written on restaurant checks within the confines of restaurants do not
+follow the same mathematical laws as numbers written on any other pieces
+of paper in any other parts of the Universe. This single statement took
+the scientific world by storm. So many mathematical conferences got held
+in such good restaurants that many of the finest minds of a generation
+died of obesity and heart failure, and the science of mathematics was put
+back by years.
+ -- Douglas Adams, "Life, The Universe and Everything"
+%
+The state law of Pennsylvania prohibits singing in the bathtub.
+%
+The state of innocence contains the germs of all future sin.
+ -- Alexandre Arnoux, "Etudes et caprices"
+%
+The state that separates its scholars from its warriors will have its
+thinking done by cowards, and its fighting by fools.
+
+ -- Thucydides
+%
+The steady state of disks is full.
+ -- Ken Thompson
+%
+The story of the butterfly:
+ "I was in Bogota and waiting for a lady friend. I was in love,
+a long time ago. I waited three days. I was hungry but could not go
+out for food, lest she come and I not be there to greet her. Then, on
+the third day, I heard a knock."
+ "I hurried along the old passage and there, in the sunlight,
+there was nothing."
+ "Just," Vance Joy said, "a butterfly, flying away."
+ -- Peter Carey, BLISS
+%
+The story you are about to hear is true.
+Only the names have been changed to protect the innocent.
+%
+The street preacher looked so baffled
+When I asked him why he dressed
+With forty pounds of headlines
+Stapled to his chest.
+But he cursed me when I proved to him
+I said, "Not even you can hide.
+You see, you're just like me.
+I hope you're satisfied."
+ -- Bob Dylan
+%
+The streets are safe in Philadelphia, it's only the people who make
+them unsafe.
+ -- Mayor Frank Rizzo
+%
+The streets were dark with something more than night.
+ -- Raymond Chandler
+%
+The strong give up and move on, while the weak give up and stay.
+%
+The strong individual loves the earth so much he lusts for recurrence. He
+can smile in the face of the most terrible thought: meaningless, aimless
+existence recurring eternally. The second characteristic of such a man is
+that he has the strength to recognize -- and to live with the recognition --
+that the world is valueless in itself and that all values are human ones.
+He creates himself by fashioning his own values; he has the pride to live
+by the values he wills.
+ -- Friedrich Nietzsche
+%
+The student in question is performing minimally for his peer group and
+is an emerging underachiever.
+%
+The study of non-linear physics is like the study of non-elephant
+biology.
+%
+"The subspace _W inherits the other 8 properties of _V. And there aren't
+even any property taxes."
+ -- J. MacKay, Mathematics 134b
+%
+The sudden sight of me causes panic in the streets. They have
+yet to learn - only the savage fears what he does not understand.
+ -- The Silver Surfer
+%
+The sum of the intelligence of the world is constant.
+The population is, of course, growing.
+%
+The sum of the Universe is zero.
+%
+The sun never sets on those who ride into it.
+ -- RKO
+%
+The sun was shining on the sea,
+Shining with all his might:
+He did his very best to make
+The billows smooth and bright --
+And this was very odd, because it was
+The middle of the night.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+The sunlights differ, but there is only one darkness.
+ -- Ursula K. LeGuin, "The Dispossessed"
+%
+The superfluous is very necessary.
+ -- Voltaire
+%
+The superior man understands what is right;
+the inferior man understands what will sell.
+ -- Confucius
+%
+The superpowers often behave like two heavily armed blind men feeling their
+way around a room, each believing himself in mortal peril from the other,
+whom he assumes to have perfect vision. Each tends to ascribe to the other
+side a consistency, foresight and coherence that its own experience belies.
+Of course, even two blind men can do enormous damage to each other, not to
+speak of the room.
+ -- Henry Kissinger
+%
+The Supreme Court does it with all deliberate speed.
+%
+The surest protection against temptation is cowardice.
+ -- Mark Twain
+%
+The surest sign that a man is in love is when he divorces his wife.
+%
+The surest way to corrupt a youth is to instruct him to hold in higher
+esteem those who think alike than those who think differently.
+ -- Friedrich Nietzsche
+%
+The surest way to remain a winner is to
+win once, and then not play any more.
+%
+The sweeter the apple, the blacker the core --
+Scratch a lover and find a foe!
+ -- Dorothy Parker, "Ballad of a Great Weariness"
+%
+The system was down for backups from 5am to 10am last Saturday.
+%
+The system will be down for 10 days for preventative maintenance.
+%
+The Tao doesn't take sides;
+it gives birth to both wins and losses.
+The Guru doesn't take sides;
+she welcomes both hackers and lusers.
+
+The Tao is like a stack:
+the data changes but not the structure.
+the more you use it, the deeper it becomes;
+the more you talk of it, the less you understand.
+
+Hold on to the root.
+%
+The Tao is like a glob pattern:
+used but never used up.
+It is like the extern void:
+filled with infinite possibilities.
+
+It is masked but always present.
+I don't know who built to it.
+It came before the first kernel.
+%
+The tao that can be tar(1)ed
+is not the entire Tao.
+The path that can be specified
+is not the Full Path.
+
+We declare the names
+of all variables and functions.
+Yet the Tao has no type specifier.
+
+Dynamically binding, you realize the magic.
+Statically binding, you see only the hierarchy.
+
+Yet magic and hierarchy
+arise from the same source,
+and this source has a null pointer.
+
+Reference the NULL within NULL,
+it is the gateway to all wizardry.
+%
+The technician should never forget that he is an artist, the
+artist never that he is a technician.
+ -- Poul Henningsen (1894-1967)
+%
+The telephone is a good way to talk to people without having to offer
+them a drink.
+ -- Fran Lebowitz, "Interview"
+%
+The temperature of Heaven can be rather accurately computed from available
+data. Our authority is Isaiah 30:26, "Moreover, the light of the Moon
+shall be as the light of the Sun and the light of the Sun shall be sevenfold,
+as the light of seven days." Thus Heaven receives from the Moon as much
+radiation as we do from the Sun, and in addition seven times seven (49) times
+as much as the Earth does from the Sun, or fifty times in all. The light we
+receive from the Moon is one ten-thousandth of the light we receive from the
+Sun, so we can ignore that. With these data we can compute the temperature
+of Heaven. The radiation falling on Heaven will heat it to the point where
+the heat lost by radiation is just equal to the heat received by radiation,
+i.e., Heaven loses fifty times as much heat as the Earth by radiation. Using
+the Stefan-Boltzmann law for radiation, (H/E)^4 = 50, where E is the absolute
+temperature of the earth (~300K), gives H as 798K (525C). The exact
+temperature of Hell cannot be computed, but it must be less than 444.6C, the
+temperature at which brimstone or sulphur changes from a liquid to a gas.
+Revelations 21:8 says "But the fearful, and unbelieving ... shall have their
+part in the lake which burneth with fire and brimstone." A lake of molten
+brimstone means that its temperature must be at or below the boiling point,
+or 444.6C (Above this point it would be a vapor, not a lake.) We have,
+then, that Heaven, at 525C is hotter than Hell at 445C.
+ -- "Applied Optics", vol. 11, A14, 1972
+%
+The temperature of the aqueous content of an unremittingly ogled
+culinary vessel will not achieve 100 degrees on the Celsius scale.
+%
+The Ten Commandments for Technicians:
+ 1: Beware the lightening that lurketh in the undischarged
+ capacitor, lest it cause thee to bounce upon thy buttocks in a
+ most untechnician-like manner.
+
+ 7: Work thou not on energized equipment, for if thou dost, thy
+ fellow workers will surely buy beers for thy widow and console
+ her in other ways.
+%
+The term "fire" brings up visions of violence and mayhem and the ugly scene
+of shooting employees who make mistakes. We will now refer to this process
+as "deleting" an employee (much as a file is deleted from a disk). The
+employee is simply there one instant, and gone the next. All the terrible
+temper tantrums, crying, and threats are eliminated.
+ -- Kenny's Korner
+%
+The test of a first-rate intelligence is the ability to hold two opposed
+ideas in the mind at the same time and still retain the ability to function.
+ -- F. Scott Fitzgerald
+%
+The test of intelligent tinkering is to save all the parts.
+ -- Aldo Leopold
+%
+The thing that takes up the least amount of time
+and causes the most amount of trouble is sex.
+%
+The things that interest people most are usually none of their business.
+%
+The Third Law of Photography:
+ If you did manage to get any good shots, they will be ruined
+ when someone inadvertently opens the darkroom door and all of
+ the dark leaks out.
+%
+The thought of being President frightens me and I do not think I
+want the job.
+ -- Ronald Reagan in 1973
+
+Reagan won because he ran against Jimmy Carter. Had he run unopposed he
+would have lost.
+ -- Mort Sahl
+
+Ronald Reagan is a triumph of the embalmer's art.
+ -- Gore Vidal
+
+Ronald Reagan's platform seems to be: Hey, I'm a big good-looking guy and
+I need a lot of sleep.
+ -- Roy G. Blount, Jr.
+
+You've got to be careful quoting Ronald Reagan, because when you quote him
+accurately it's called mudslinging.
+ -- Walter Mondale
+%
+The Thought Police are here. They've come
+To put you under cardiac arrest.
+And as they drag you through the door
+They tell you that you've failed the test.
+ -- Buggles, "Living in the Plastic Age"
+%
+The three best things about going to school are June, July, and August.
+%
+The three biggest software lies:
+
+ 1: *Of course* we'll give you a copy of the source.
+ 2: *Of course* the third party vendor we bought that from
+ will fix the microcode.
+ 3: Beta test site? No, *of course* you're not a beta test site.
+%
+The three laws of thermodynamics:
+ (1) You can't get anything without working for it.
+ (2) The most you can accomplish by working is to break even.
+ (3) You can only break even at absolute zero.
+%
+THE THREE MOST COMMONLY-ASKED QUESTIONS AT DISNEYLAND:
+
+1) Where's the bathroom?
+2) What time does the parade start?
+3) Do you sell anything without that damn mouse on it?
+%
+The three most dangerous things in the world are a programmer with a
+soldering iron, a hardware type with a program patch and a user with
+an idea.
+ -- The Wizardry Compiled by Rick Cook
+%
+The three questions of greatest concern are -- 1. Is it attractive?
+2. Is it amusing? 3. Does it know its place?
+ -- Fran Lebowitz, "Metropolitan Life"
+%
+The three rules of international air travel:
+
+(1) Never fly on Aeroflot if you can possibly avoid it (this used
+ to be Braniff or Aeroflot).
+(2) Never bet a whole lot of money on two little pairs unless you
+ know *exactly* what you're doing.
+(3) Never sleep with anyone whose troubles are worse than your own.
+%
+The thrill is here, but it won't last long
+You'd better have your fun before it moves along...
+%
+The time for action is past!
+Now is the time for senseless bickering.
+%
+The time is right to make new friends.
+%
+The time spent on any item of the agenda [of a finance
+committee] will be in inverse proportion to the sum involved.
+ -- C. N. Parkinson
+%
+The time was the 19th of May, 1780. The place was Hartford, Connecticut.
+The day has gone down in New England history as a terrible foretaste of
+Judgment Day. For at noon the skies turned from blue to grey and by
+mid-afternoon had blackened over so densely that, in that religious age,
+men fell on their knees and begged a final blessing before the end came.
+The Connecticut House of Representatives was in session. And, as some of
+the men fell down and others clamored for an immediate adjournment, the
+Speaker of the House, one Col. Davenport, came to his feet. He silenced
+them and said these words: "The day of judgment is either approaching or
+it is not. If it is not, there is no cause for adjournment. If it is, I
+choose to be found doing my duty. I wish therefore that candles may be
+brought."
+ -- Alistair Cooke
+%
+The tree in which the sap is stagnant remains fruitless.
+ -- Hosea Ballou
+%
+The Tree of Learning bears the noblest fruit, but noble fruit tastes bad.
+%
+The tree of research must from time to time
+be refreshed with the blood of bean counters.
+ -- Alan Kay
+%
+The trouble is, there is an endless supply of White Men,
+but there has always been a limited number of Human Beings.
+ -- Little Big Man
+%
+The trouble with a kitten is that
+When it grows up, it's always a cat
+ -- Ogden Nash
+%
+The trouble with a lot of self-made men is that they worship their creator.
+%
+The trouble with being poor is that it takes up all your time.
+%
+The trouble with being punctual is that nobody's there to appreciate
+it.
+ -- Franklin P. Jones
+%
+The trouble with being punctual is that people
+think you have nothing more important to do.
+%
+The trouble with computers is that they do
+what you tell them, not what you want.
+ -- D. Cohen
+%
+The trouble with doing something right the first
+time is that nobody appreciates how difficult it was.
+%
+The trouble with eating Italian food is that
+five or six days later you're hungry again.
+ -- George Miller
+%
+The trouble with heart disease is that the first
+symptom is often hard to deal with: death.
+ -- Michael Phelps
+%
+The trouble with incest is that it gets you involved with relatives.
+ -- George S. Kaufman
+%
+The trouble with money is it costs too much!
+%
+The trouble with opportunity is that it
+always comes disguised as hard work.
+ -- Herbert V. Prochnow
+%
+The trouble with some women is that they get all excited about nothing --
+and then marry him.
+ -- Cher
+%
+The trouble with superheros is what to do between phone booths.
+ -- Ken Kesey
+%
+The trouble with telling a good story is that it invariably reminds
+the other fellow of a dull one.
+ -- Sid Caesar
+%
+The trouble with the rat-race is that even if you win, you're still a rat.
+ -- Lily Tomlin
+%
+The trouble with this country is that there are too many politicians
+who believe, with a conviction based on experience, that you can fool
+all of the people all of the time.
+ -- Franklin Adams
+%
+The trouble with you
+Is the trouble with me.
+Got two good eyes
+But we still don't see.
+ -- Robert Hunter, "Workingman's Dead"
+%
+The true way goes over a rope which is not stretched at any great
+height but just above the ground. It seems more designed to make
+people stumble than to be walked upon.
+ -- Franz Kafka
+%
+The truth about a man lies first and foremost in what he hides.
+ -- Andre Malraux
+%
+The truth is rarely pure, and never simple.
+ -- Oscar Wilde
+%
+The truth is what is; what should be is a dirty lie.
+ -- Lenny Bruce
+%
+The truth of a proposition has nothing to do with its credibility.
+And vice versa.
+%
+The truth of a thing is the feel of it, not the think of it.
+ -- Stanley Kubrick
+%
+The Truth Shall Rape You Over.
+ -- Caltech
+%
+The truth you speak has no past and no future.
+It is, and that's all it needs to be.
+%
+The turtle lives 'twixt plated decks
+Which practically conceal its sex.
+I think it clever of the turtle
+In such a fix to be so fertile.
+ -- Ogden Nash
+%
+The two most beautiful words in the English language are "Cheque Enclosed."
+ -- Dorothy Parker
+%
+The two most common things in the Universe are hydrogen and stupidity.
+ -- Harlan Ellison
+%
+The two oldest professions in the world have been ruined by amateurs.
+ -- George Bernard Shaw
+%
+The two party system ... is a triumph of the dialectic. It showed that
+two could be one and one could be two and had probably been fabricated
+by Hegel for the American market on a subcontract from General Dynamics.
+ -- I. F. Stone
+%
+The two things that can get you into trouble
+quicker than anything else are fast women and slow horses.
+%
+The typewriting machine, when played with expression, is no more
+annoying than the piano when played by a sister or near relation.
+ -- Oscar Wilde
+%
+The, uh, snowy mountains are like really cold, eh?
+And the, um, plains stretch out like my moms girdle, eh?
+There's lotsa beers and doughnuts for everyone, eh?
+So the last one to be peaceful and everything is a big idiot,
+Eh?
+So shut yer face up and dry yer mukluks by the fire, eh?
+And dream about girls with their high beams on, eh?
+They may be cold, but that's okay! Beer's better that way!
+Eh?
+ -- A, like, Tribute to the Great White North, eh?
+Beauty!
+%
+The ultimate game show will be the one
+where somebody gets killed at the end.
+ -- Chuck Barris, creator of "The Gong Show"
+%
+The unfacts, did we have them, are too
+imprecisely few to warrant out certitude.
+%
+The United States also has its native Fascists who say that they are
+"100 percent American"...
+ -- U.S. Army (1945)
+%
+The United States Army; 194 years of proud service, unhampered by progress.
+%
+The universe does not have laws -- it has habits, and habits can be
+broken.
+%
+The universe is all a spin-off of the Big Bang.
+%
+The universe is an island,
+surrounded by whatever it is that surrounds universes.
+%
+The universe is laughing behind your back.
+%
+The universe is like a safe to which there is a combination -- but the
+combination is locked up in the safe.
+ -- Peter de Vries
+
+Corollary: The combination is not a problem since we are locked in the
+same safe.
+%
+The Universe is populated by stable things.
+ -- Richard Dawkins
+%
+The universe is ruled by letting things take their course.
+It cannot be ruled by interfering.
+ -- Chinese proverb
+%
+The universe seems neither benign nor hostile, merely indifferent.
+ -- Sagan
+%
+The University of California Bears announced the signing of Reggie
+Philbin to a letter of intent to attend Cal next Fall. Philbin is
+said to make up for no talent by cheating well. Says Philbin of
+his decision to attend Cal, "I'm in it for the free ride."
+%
+The University of California Statistics Department; where mean is normal,
+and deviation standard.
+%
+The UNIX philosophy basically involves giving you enough rope to
+hang yourself. And then a couple of feet more, just to be sure.
+%
+The urge to gamble is so universal and its practice so pleasurable
+that I assume it must be evil.
+ -- Heywood Broun
+%
+The USA is so enormous, and so numerous are its schools, colleges and
+religious seminaries, many devoted to special religious beliefs ranging
+from the unorthodox to the dotty, that we can hardly wonder at its
+yielding a more bounteous harvest of gobbledygook than the rest of the
+world put together.
+ -- Sir Peter Medawar
+%
+The use of anthropomorphic terminology when dealing with computing systems
+is a symptom of professional immaturity.
+ -- Edsger W. Dijkstra
+%
+The use of COBOL cripples the mind; its teaching should, therefore, be
+regarded as a criminal offence.
+ -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
+%
+The use of money is all the advantage there is to having money.
+ -- Benjamin Franklin
+%
+The value of a program is proportional to the weight of its output.
+%
+The verdict of a jury is the a priori opinion of that juror who smokes
+the worst cigars.
+ -- H. L. Mencken
+%
+The very first essential for success is a perpetually
+constant and regular employment of violence.
+ -- Adolf Hitler, "Mein Kampf"
+%
+The very ink with which all history is written is merely fluid
+prejudice.
+ -- Mark Twain
+%
+The very powerful and the very stupid have one thing in common.
+Instead of altering their views to fit the facts, they alter the facts
+to fit their views ... which can be very uncomfortable if you happen to
+be one of the facts that needs altering.
+ -- The Doctor, "Doctor Who: Face of Evil"
+%
+The very remembrance of my former misfortune proves a new one to me.
+ -- Miguel de Cervantes
+%
+The Vet Who Surprised A Cow
+ In the course of his duties in August 1977, a Dutch veterinary
+surgeon was required to treat an ailing cow. To investigate its internal
+gases he inserted a tube into that end of the animal not capable of facial
+expression and struck a match. The jet of flame set fire first to some
+bales of hay and then to the whole farm causing damage estimate at L45,000.
+The vet was later fined L140 for starting a fire in a manner surprising to
+the magistrates. The cow escaped with shock.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The VFW represents many who died to give this country a second chance
+to make it what it is supposed to be -- God's guest house on earth.
+ -- John Wayne
+%
+The volume of paper expands to fill the available briefcases.
+ -- Jerry Brown
+%
+The voluptuous blond was chatting with her handsome escort in a posh
+restaurant when their waiter, stumbling as he brought their drinks,
+dumped a martini on the rocks down the back of the blonde's dress. She
+sprang to her feet with a wild rebel yell, dashed wildly around the table,
+then galloped wriggling from the room followed by her distraught boyfriend.
+A man seated on the other side of the room with a date of his own beckoned
+to the waiter and said, "We'll have two of whatever she was drinking."
+%
+The wages of sin are death; but after they're done taking out taxes,
+it's just a tired feeling.
+%
+The wages of sin are high but you get your money's worth.
+%
+The wages of sin are unreported.
+%
+The War on Drugs is just a small part of the War on the United States
+Constitution.
+%
+The warning message we sent the Russians was a
+calculated ambiguity that would be clearly understood.
+ -- Alexander Haig
+%
+The water was not fit to drink.
+To make it palatable, we had to add whiskey.
+By diligent effort, I learned to like it.
+ -- Winston Churchill
+%
+The way I understand it, the Russians are sort of a combination of evil and
+incompetence... sort of like the Post Office with tanks.
+ -- Emo Philips
+%
+The way of the world is to praise dead saints and prosecute live ones.
+ -- Nathaniel Howe
+%
+The way some people find fault, you'd think there was some kind of reward.
+%
+The way to a man's heart is through his
+wife's belly, and don't you forget it.
+ -- Edward Albee, "Who's Afraid of Virginia Woolf?"
+%
+The way to a man's heart is through the left ventricle.
+%
+The way to a man's stomach is through his esophagus.
+%
+The way to fight a woman is with your hat. Grab it and run.
+%
+The way to love anything is to realize that it might be lost.
+%
+The way to make a small fortune in the
+commodities market is to start with a large fortune.
+%
+The weather is here, I wish you were beautiful.
+My thoughts aren't too clear, but don't run away.
+My girlfriend's a bore; my job is too dutiful.
+Hell nobody's perfect, would you like to play?
+I feel together today!
+ -- Jimmy Buffet, "Coconut Telegraph"
+%
+The weed of crime bears bitter fruit.
+%
+The weed of crime bears bitter fruit...
+but the leaves are good to smoke!
+ -- The Shadow
+%
+The White Rabbit put on his spectacles.
+ "Where shall I begin, please your Majesty?" he asked.
+ "Begin at the beginning," the King said, very gravely,
+"and go on till you come to the end: then stop."
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+The white race is the cancer of history.
+ -- Susan Sontag
+%
+The whole earth is in jail and we're plotting this incredible jailbreak.
+ -- Wavy Gravy
+%
+The whole of life is futile unless you
+consider it as a sporting proposition.
+%
+The whole problem with the world is that fools and fanatics are always
+so certain of themselves, and wiser people so full of doubts.
+ -- Bertrand Russell
+%
+The whole world is a scab. The point is to pick it constructively.
+ -- Peter Beard
+%
+The whole world is a tuxedo and you are a pair of brown shoes.
+ -- George Gobel
+%
+The wind doth taste so bitter sweet,
+ Like Jaspar wine and sugar,
+It must have blown through someone's feet,
+ Like those of Caspar Weinberger.
+ -- P. Opus
+%
+The wise and intelligent are coming belatedly to realize that alcohol, and
+not the dog, is man's best friend. Rover is taking a beating -- and he
+should.
+ -- W. C. Fields
+%
+The wise man seeks everything in himself;
+the ignorant man tries to get everything from somebody else.
+%
+The wise shepherd never trusts his flock to a smiling wolf.
+%
+The woman hurried home from her doctor's appointment, devastated by the
+medical report she had just received. When her husband came in from work,
+she told him, "Darling, the doctor said I have only twelve more hours to
+live. So I've decided I want to go to bed and make passionate love to you
+throughout the night. How does that sound, dearest?"
+ "Hey, that's fine for *you*," replied the husband. "You don't have
+to get up in the morning!"
+%
+The wonderful thing about a dancing bear
+is not how well he dances, but that he dances at all.
+%
+The work [of software development] is becoming far easier (i.e. the tools
+we're using work at a higher level, more removed from machine, peripheral
+and operating system imperatives) than it was twenty years ago, and because
+of this, knowledge of the internals of a system may become less accessible.
+We may be able to dig deeper holes, but unless we know how to build taller
+ladders, we had best hope that it does not rain much.
+ -- Paul Licker
+%
+The world has many unintentionally cruel mechanisms that are not
+designed for people who walk on their hands.
+ -- John Irving, "The World According to Garp"
+%
+The world is a comedy to those who think,
+and a tragedy to those who feel.
+ -- Horace Walpole
+%
+The world is coming to an end. Please log off.
+%
+The world is coming to an end... SAVE YOUR BUFFERS!!
+%
+The world is coming to an end!
+Repent and return those library books!
+%
+The world is full of people who have never, since
+childhood, met an open doorway with an open mind.
+ -- E. B. White
+%
+The world is moving so fast these days that the man who says
+it can't be done is generally interrupted by someone doing it.
+ -- E. Hubbard
+%
+The world is not octal despite DEC.
+%
+The world is your exercise-book, the pages on which you do your sums.
+It is not reality, although you can express reality there if you wish.
+You are also free to write nonsense, or lies, or to tear the pages.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+The world needs more people like us and fewer like them.
+%
+The world really isn't any worse.
+It's just that the news coverage is so much better.
+%
+The world wants to be deceived.
+ -- Sebastian Brant
+%
+The world's as ugly as sin,
+And almost as delightful.
+ -- Frederick Locker-Lampson
+%
+The world's great men have not commonly been great scholars,
+nor its great scholars great men.
+ -- Oliver Wendell Holmes
+%
+The Worst American Poet
+ Julia Moore, "the Sweet Singer of Michigan" (1847-1920) was so bad that
+Mark Twain said her first book gave him joy for 20 years.
+ Her verse was mainly concerned with violent death -- the great fire
+of Chicago and the yellow fever epidemic proved natural subjects for her
+pen.
+ Whether death was by drowning, by fits or by runaway sleigh, the
+formula was the same:
+ Have you heard of the dreadful fate
+ Of Mr. P. P. Bliss and wife?
+ Of their death I will relate,
+ And also others lost their life
+ (in the) Ashbula Bridge disaster,
+ Where so many people died.
+ Even if you started out reasonably healthy in one of Julia's poems,
+the chances are that after a few stanzas you would be at the bottom of a
+river or struck by lightning. A critic of the day said she was "worse than
+a Gatling gun" and in one slim volume counted 21 killed and 9 wounded.
+ Incredibly, some newspapers were critical of her work, even
+suggesting that the sweet singer was "semi-literate". Her reply was
+forthright: "The Editors that has spoken in this scandalous manner have went
+beyond reason." She added that "literary work is very difficult to do".
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+THE WORST BANK ROBBERY
+
+In August 1975 three men were on their way in to rob the Royal Bank of
+Scotland at Rothesay, when they got stuck in the revolving doors. They
+had to be helped free by the staff and, after thanking everyone,
+sheepishly left the building.
+A few minutes later they returned and announced their intention of
+robbing the bank, but none of the staff believed them. When they demanded
+5,000 pounds in cash, the head cashier laughed at them, convinced that it
+was a practical joke.
+Then one of the men jumped over the counter, but fell to the floor
+clutching his ankle. The other two tried to make their getaway, but got
+trapped in the revolving doors again.
+%
+The Worst Car Hire Service
+ When David Schwartz left university in 1972, he set up Rent-a-wreck
+as a joke. Being a natural prankster, he acquired a fleet of beat-up
+shabby, wreckages waiting for the scrap heap in California.
+ He put on a cap and looked forward to watching people's faces as he
+conducted them round the choice of bumperless, dented junkmobiles.
+ To his lasting surprise there was an insatiable demand for them and
+he now has 26 thriving branches all over America. "People like driving
+round in the worst cars available," he said. Of course they do.
+ "If a driver damages the side of a car and is honest enough to
+admit it, I tell him, `Forget it'. If they bring a car back late we
+overlook it. If they've had a crash and it doesn't involve another vehicle
+we might overlook that too."
+ "Where's the ashtray?" asked one Los Angeles wife, as she settled
+into the ripped interior. "Honey," said her husband, "the whole car's the
+ash tray."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The worst cliques are those which consist of one man.
+ -- George Bernard Shaw
+%
+THE WORST HOMING PIGEON
+
+This historic bird was released in Pembrokeshire in June 1953 and was
+expected to reach its base that evening. It was returned by post, dead,
+in a cardboard box eleven years later from Brazil.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The worst is enemy of the bad.
+%
+The worst is not so long as we can say "This is the worst."
+ -- King Lear
+%
+The Worst Jury
+ A murder trial at Manitoba in February 1978 was well advanced, when
+one juror revealed that he was completely deaf and did not have the
+remotest clue what was happening.
+ The judge, Mr. Justice Solomon, asked him if he had heard any
+evidence at all and, when there was no reply, dismissed him.
+ The excitement which this caused was only equalled when a second
+juror revealed that he spoke not a word of English. A fluent French
+speaker, he exhibited great surprised when told, after two days, that he
+was hearing a murder trial.
+ The trial was abandoned when a third juror said that he suffered
+from both conditions, being simultaneously unversed in the English language
+and nearly as deaf as the first juror.
+ The judge ordered a retrial.
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Worst Lines of Verse
+For a start, we can rule out James Grainger's promising line:
+ "Come, muse, let us sing of rats."
+Grainger (1721-67) did not have the courage of his convictions and deleted
+these words on discovering that his listeners dissolved into spontaneous
+laughter the instant they were read out.
+ No such reluctance afflicted Adam Lindsay Gordon (1833-70) who was
+inspired by the subject of war.
+ "Flash! flash! bang! bang! and we blazed away,
+ And the grey roof reddened and rang;
+ Flash! flash! and I felt his bullet flay
+ The tip of my ear. Flash! bang!"
+By contrast, Cheshire cheese provoked John Armstrong (1709-79):
+ "... that which Cestria sends, tenacious paste of solid milk..."
+While John Bidlake was guided by a compassion for vegetables:
+ "The sluggard carrot sleeps his day in bed,
+ The crippled pea alone that cannot stand."
+George Crabbe (1754-1832) wrote:
+ "And I was ask'd and authorized to go
+ To seek the firm of Clutterbuck and Co."
+William Balmford explored the possibilities of religious verse:
+ "So 'tis with Christians, Nature being weak
+ While in this world, are liable to leak."
+And William Wordsworth showed that he could do it if he really tried when
+describing a pond:
+ "I've measured it from side to side;
+ Tis three feet long and two feet wide."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The Worst Musical Trio
+ There are few bad musicians who have a chance to give a recital at
+a famous concert hall while still learning the rudiments of their
+instrument. This happened about thirty years ago to the son of a Rumanian
+gentleman who was owed a personal favour by Georges Enesco, the celebrated
+violinist. Enesco agreed to give lessons to the son who was quite
+unhampered by great musical talent.
+ Three years later the boy's father insisted that he give a public
+concert. "His aunt said that nobody plays the violin better than he does.
+A cousin heard him the other day and screamed with enthusiasm." Although
+Enesco feared the consequences, he arranged a recital at the Salle Gaveau
+in Paris. However, nobody bought a ticket since the soloist was unknown.
+ "Then you must accompany him on the piano," said the boy's father,
+"and it will be a sell out."
+ Reluctantly, Enesco agreed and it was. On the night an excited
+audience gathered. Before the concert began Enesco became nervous and
+asked for someone to turn his pages.
+ In the audience was Alfred Cortot, the brilliant pianist, who
+volunteered and made his way to the stage.
+ The soloist was of uniformly low standard and next morning the
+music critic of Le Figaro wrote: "There was a strange concert at the Salle
+Gaveau last night. The man whom we adore when he plays the violin played
+the piano. Another whom we adore when he plays the piano turned the pages.
+But the man who should have turned the pages played the violin."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The worst part of having success is trying
+to find someone who is happy for you.
+ -- Bette Midler
+%
+The worst part of valor is indiscretion.
+%
+The Worst Prison Guards
+ The largest number of convicts ever to escape simultaneously from a
+maximum security prison is 124. This record is held by Alcoente Prison,
+near Lisbon in Portugal.
+ During the weeks leading up to the escape in July 1978 the prison
+warders had noticed that attendances had fallen at film shows which
+included "The Great Escape", and also that 220 knives and a huge quantity
+of electric cable had disappeared. A guard explained, "Yes, we were
+planning to look for them, but never got around to it." The warders had
+not, however, noticed the gaping holes in the wall because they were
+"covered with posters". Nor did they detect any of the spades, chisels,
+water hoses and electric drills amassed by the inmates in large quantities.
+The night before the breakout one guard had noticed that of the 36
+prisoners in his block only 13 were present. He said this was "normal"
+because inmates sometimes missed roll-call or hid, but usually came back
+the next morning.
+ "We only found out about the escape at 6:30 the next morning when
+one of the prisoners told us," a warder said later. [...] When they
+eventually checked, the prison guards found that exactly half of the jail's
+population was missing. By way of explanation the Justice Minister, Dr.
+Santos Pais, claimed that the escape was "normal" and part of the
+"legitimate desire of the prisoner to regain his liberty."
+ -- Stephen Pile, "The Book of Heroic Failures"
+%
+The worst sin towards our fellow creatures is not to hate them,
+but to be indifferent to them; that's the essence of inhumanity.
+ -- George Bernard Shaw
+%
+The worst thing about some men is that when they are not drunk they
+are sober.
+ -- William Butler Yeats
+%
+The worst thing one can do is not to try, to be aware of what one
+wants and not give in to it, to spend years in silent hurt wondering
+if something could have materialized -- and never knowing.
+ -- David Viscott
+%
+The Wright Brothers weren't the first to fly.
+They were just the first not to crash.
+%
+The yankees, son, are up north.
+The damnyankees are down here.
+%
+The years of peak mental activity are undoubtedly between the ages of
+four and eighteen. At four we know all the questions, at eighteen all
+the answers.
+%
+The young Georgia miss came to the hospital for a checkup.
+ "Have you been X-rayed?" asked the doctor.
+ "Nope," she said, "but ah've been ultraviolated."
+%
+The young lady had an unusual list,
+Linked in part to a structural weakness.
+She set no preconditions.
+%
+The young man-about-town enjoyed luxury but didn't always have the means
+to buy it, and so he huffily walked out of the Miami Beach hotel when he
+found out the charges for room, meals and golf privileges were $300 a day.
+He registered across the street at an equally elegant hotel, where the
+rates were only $70. The following morning he went down to the hotel's
+golf course and asked Scotty, the pro, to sell him a couple of golf balls.
+"Sure," said Scotty. "That'll be $25 apiece."
+ "What?" screamed the bachelor. "In the hotel across the street
+they only charge $1 a ball!"
+ "Naturally," replied the pro. "Over there they get you by the
+rooms."
+%
+THEGODDESSOFTHENETHASTWISTINGFINGERSANDHERVOICEISLIKEAJAVALININTHENIGHTDUDE
+%
+Their idea of an offer you can't refuse is an offer...
+and you'd better not refuse.
+%
+Them as has, gets.
+%
+Then a man said: Speak to us of Expectations.
+
+He then said: If a man does not see or hear the waters of the Jordan,
+then he should not taste the pomegranate or ply his wares in an open
+market.
+
+If a man would not labour in the salt and rock quarries then he should
+not accept of the Earth that which he refuses to give of himself.
+
+Such a man would expect a pear of a peach tree.
+Such a man would expect a stone to lay an egg.
+Such a man would expect Sears to assemble a lawnmower.
+ -- Kehlog Albran, "The Profit"
+%
+Then, gently touching my face, she hesitated for a moment as her
+incredible eyes poured forth into mine love, joy, pain, tragedy,
+acceptance, and peace. "'Bye for now," she said warmly.
+ -- Thea Alexander, "2150 A.D."
+%
+Then here's to the City of Boston,
+The town of the cries and the groans.
+Where the Cabots can't see the Kabotschniks,
+And the Lowells won't speak to the Cohns.
+ -- Franklin Pierce Adams
+%
+Then there was LSD, which was supposed to make you think you could fly.
+I remember it made you think you couldn't stand up, and mostly it was
+right.
+ -- P. J. O'Rourke
+%
+Then there was the Formosan bartender named Taiwan-On.
+%
+Then there was the Scoutmaster who got a fantastic deal on this case of
+Tates brand compasses for his troop; only $1.25 each! Only problem was,
+when they got them out in the woods, the compasses were all stuck pointing
+to the "W" on the dial.
+
+Moral:
+ He who has a Tates is lost!
+%
+Theology is an attempt to explain a subject by men who do not understand
+it. The intent is not to tell the truth but to satisfy the questioner.
+ -- Elbert Hubbard
+%
+Theorem: a cat has nine tails.
+Proof:
+ No cat has eight tails. A cat has one tail more than no cat.
+ Therefore, a cat has nine tails.
+%
+Theorem: All positive integers are equal.
+Proof: Sufficient to show that for any two positive integers, A and B, A = B.
+ Further, it is sufficient to show that for all N > 0, if A and B
+ (positive integers) satisfy (MAX(A, B) = N) then A = B.
+
+Proceed by induction:
+ If N = 1, then A and B, being positive integers, must both be 1.
+ So A = B.
+
+Assume that the theorem is true for some value k. Take A and B with
+ MAX(A, B) = k+1. Then MAX((A-1), (B-1)) = k. And hence
+ (A-1) = (B-1). Consequently, A = B.
+%
+Theorem: All programs are dull.
+
+Proof: Assume the contrary; i.e., the set of interesting programs is
+nonempty. Arrange them (or it) in order of interest (note that all
+sets can be well ordered, so do it properly). The minimal element is
+the "least interesting program", the obvious dullness of which provides
+the contradictory denouement we so devoutly seek.
+ -- Stan Kelly-Bootle, "The Devil's DP Dictionary"
+%
+THEORY:
+ System of ideas meant to explain something, chosen with a view to
+ originality, controversialism, incomprehensibility, and how good
+ it will look in print.
+%
+Theory is gray, but the golden tree of life is green.
+ -- Johann Wolfgang von Goethe
+%
+Theory of Selective Supervision:
+ The one time in the day that you lean back and relax is
+ the one time the boss walks through the office.
+%
+There appears before you a threatening figure clad all over in heavy black
+armor. His legs seem like the massive trunk of the oak tree. His broad
+shoulders and helmeted head loom high over your own puny frame and you
+realize that his powerful arms could easily crush the very life from your
+body. There hangs from his belt a veritable arsenal of deadly weapons:
+sword, mace, ball and chain, dagger, lance, and trident.
+He speaks with a commanding voice:
+
+ "YOU SHALL NOT PASS"
+
+As he grabs you by the neck all grows dim about you.
+%
+There appears to be irrefutable evidence that
+the mere fact of overcrowding induces violence.
+ -- Harvey Wheeler
+%
+There are a few things that never go out of style,
+and a feminine woman is one of them.
+ -- Ralston
+%
+There are a lot of lies going around.... and half of them are true.
+ -- Winston Churchill
+%
+There are bad times just around the corner,
+There are dark clouds hurtling through the sky
+And it's no good whining
+About a silver lining
+For we know from experience that they won't roll by...
+ -- Noel Coward
+%
+There are few people more often in the wrong
+than those who cannot endure to be thought so.
+%
+There are few virtues that the Poles do not possess --
+and there are few mistakes they have ever avoided.
+ -- Winston Churchill, Parliament, August, 1945
+%
+There are four boxes to be used in defense of liberty: soap, ballot,
+jury, and ammo. Please use in that order.
+ -- Ed Howdershelt
+%
+There are four kinds of homicide: felonious, excusable, justifiable,
+and praiseworthy ...
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+There are four stages to a marriage. First there's the affair, then there's
+the marriage, then children and finally the fourth stage, without which you
+cannot know a woman, the divorce.
+ -- Norman Mailer
+%
+There are many intelligent species in
+the universe, and they all own cats.
+%
+There are many of us in this old world of ours who hold that things break
+about even for all of us. I have observed, for example, that we all get
+about the same amount of ice. The rich get it in the summer and the poor
+get it in the winter.
+ -- Bat Masterson
+%
+There are many people today who literally do not have a close personal
+friend. They may know something that we don't. They are probably
+avoiding a great deal of pain.
+%
+There are more dead people than living, and their numbers are increasing.
+ -- Eugene Ionesco
+%
+There are more old drunkards than old doctors.
+%
+There are more things in heaven and earth than any place else.
+%
+There are more things in heaven and earth,
+Horatio, than are dreamt of in your philosophy.
+ -- Hamlet
+%
+There are more ways of killing a cat than choking her with cream.
+%
+There are never any bugs you haven't found yet.
+%
+There are new messages.
+%
+There are no accidents whatsoever in the universe.
+ -- Baba Ram Dass
+%
+There are no answers, only cross-references.
+ -- Weiner
+%
+There are no data that cannot be plotted on a straight line if the axes
+are chosen correctly.
+%
+There are no emotional victims, only volunteers.
+%
+There are no games on this system.
+%
+There are no great men, buster. There are only men.
+ -- Elaine Stewart, "The Bad and the Beautiful"
+%
+There are no great men, only great challenges that
+ordinary men are forced by circumstances to meet.
+ -- Admiral William Halsey
+%
+There are no manifestos like cannon and musketry.
+ -- The Duke of Wellington
+%
+There are no physicists in the hottest parts of hell, because the existence
+of a "hottest part" implies a temperature difference, and any marginally
+competent physicist would immediately use this to run a heat engine and make
+some other part of hell comfortably cool. This is obviously impossible.
+ -- Richard Davisson
+%
+There are no rules for March. March is spring, sort
+of, usually, March means maybe, but don't bet on it.
+%
+There are no winners in life, only survivors.
+%
+There are only two kinds of men -- the dead and the deadly.
+ -- Helen Rowland
+%
+There are only two kinds of tequila. Good and better.
+%
+There are only two things in this world that I am sure of, death and
+taxes, and we just might do something about death one of these days.
+ -- shades
+%
+There are people so addicted to exaggeration
+that they can't tell the truth without lying.
+ -- Josh Billings
+%
+There are people who find it odd to eat four or five Chinese meals
+in a row; in China, I often remind them, there are a billion or so
+people who find nothing odd about it.
+ -- Calvin Trillin
+%
+There are places I'll remember
+All my life though some have changed.
+Some forever not for better
+Some have gone and some remain.
+All these places had their moments
+With lovers and friends I still recall.
+Some are dead and some are living,
+In my life I've loved them all.
+
+But of all these friends and lovers,
+There is no one compared with you,
+All these memories lose their meaning
+When I think of love as something new.
+Though I know I'll never lose affection
+For people and things that went before,
+I know I'll often stop and think about them
+In my life I'll love you more.
+ -- Lennon/McCartney, "In My Life", 1965
+%
+There are running jobs.
+Why don't you go chase them?
+%
+There are some micro-organisms that exhibit characteristics of both
+plants and animals. When exposed to light they undergo photosynthesis;
+and when the lights go out, they turn into animals. But then again,
+don't we all?
+%
+There are strange things done in the midnight sun
+ By the men who moil for gold;
+The Arctic trails have their secret tales
+ That would make your blood run cold;
+The Northern Lights have seen queer sights,
+ But the queerest they ever did see
+Was that night on the marge of Lake Lebarge
+ I cremated Sam McGee.
+ -- Robert W. Service
+%
+There are ten or twenty basic truths, and life
+is the process of discovering them over and over and over.
+ -- David Nichols
+%
+There are those who claim that magic is like the tide; that it swells and
+fades over the surface of the earth, collecting in concentrated pools here
+and there, almost disappearing from other spots, leaving them parched for
+wonder. There are also those who believe that if you stick your fingers up
+your nose and blow, it will increase your intelligence.
+ -- The Teachings of Ebenezum, Volume VII
+%
+There are three kinds of lies: Lies, Damned Lies, and Statistics.
+ -- Benjamin Disraeli
+%
+There are three kinds of people: men, women, and unix.
+%
+There are three possibilities: Pioneer's solar panel has turned away
+from the sun; there's a large meteor blocking transmission; or someone
+loaded Star Trek 3.2 into our video processor.
+%
+There are three possible parts to a date, of which at least two must be
+offered: entertainment, food, and affection. It is customary to begin
+a series of dates with a great deal of entertainment, a moderate amount
+of food, and the merest suggestion of affection. As the amount of
+affection increases, the entertainment can be reduced proportionately.
+When the affection IS the entertainment, we no longer call it dating.
+Under no circumstances can the food be omitted.
+ -- Miss Manners' Guide to Excruciatingly Correct Behavior
+%
+There are three principal ways to lose money: wine, women, and
+engineers. While the first two are more pleasant, the third is by far
+the more certain.
+ -- Baron Rothschild, ca. 1800
+%
+There are three reasons for becoming a writer: the first is that you need
+the money; the second that you have something to say that you think the
+world should know; the third is that you can't think what to do with the
+long winter evenings.
+ -- Quentin Crisp
+%
+There are three rules for writing a novel.
+Unfortunately, no one knows what they are.
+ -- W. Somerset Maugham
+%
+There are three schools of magic. One: State a tautology, then ring the
+changes on its corollaries; that's philosophy. Two: Record many facts.
+Try to find a pattern. Then make a wrong guess at the next fact; that's
+science. Three: Be aware that you live in a malevolent Universe controlled
+by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering.
+%
+There are three things I always forget. Names, faces -- the third I
+can't remember.
+ -- Italo Svevo
+%
+There are three things I have always loved
+and never understood -- art, music, and women.
+%
+There are three things men can do with women:
+love them, suffer for them, or turn them into literature.
+ -- Stephen Stills
+%
+There are three ways to get something done:
+ 1: Do it yourself.
+ 2: Hire someone to do it for you.
+ 3: Forbid your kids to do it.
+%
+There are times when truth is stranger than fiction and lunch time is
+one of them.
+%
+There are twenty-five people left in the world,
+and twenty-seven of them are hamburgers.
+ -- Ed Sanders
+%
+There are two jazz musicians who are great buddies. They hang out and play
+together for years, virtually inseparable. Unfortunately, one of them is
+struck by a truck and killed. About a week later his friend wakes up in
+the middle of the night with a start because he can feel a presence in the
+room. He calls out, "Who's there? Who's there? What's going on?"
+ "It's me -- Bob," replies a faraway voice.
+ Excitedly he sits up in bed. "Bob! Bob! Is that you? Where are
+you?"
+ "Well," says the voice, "I'm in heaven now."
+ "Heaven! You're in heaven! That's wonderful! What's it like?"
+ "It's great, man. I gotta tell you, I'm jamming up here every day.
+I'm playing with Bird, and 'Trane, and Count Basie drops in all the time!
+Man it is smokin'!"
+ "Oh, wow!" says his friend. "That sounds fantastic, tell me more,
+tell me more!"
+ "Let me put it this way," continues the voice. "There's good news
+and bad news. The good news is that these guys are in top form. I mean
+I have *never* heard them sound better. They are *wailing* up here."
+ "The bad news is that God has this girlfriend that sings..."
+%
+There are two kinds of fool. One says, "This is old, and therefore good."
+And one says, "This is new, and therefore better."
+ -- John Brunner, "The Shockwave Rider"
+%
+There are two kinds of pedestrians... the quick and the dead.
+ -- Lord Thomas Robert Dewar
+%
+There are two kinds of solar-heat systems: "passive" systems collect
+the sunlight that hits your home, and "active" systems collect the
+sunlight that hits your neighbors' homes, too.
+ -- Dave Barry, "Postpetroleum Guzzler"
+%
+There are two major products that come out of Berkeley: LSD and UNIX.
+We don't believe this to be a coincidence.
+ -- Jeremy S. Anderson
+%
+There are two problems with a major hangover. You feel
+like you are going to die and you're afraid that you won't.
+%
+There are two theories to arguing with women. Neither one works.
+%
+There are two times when a man doesn't understand a woman -- before
+marriage and after marriage.
+%
+There are two ways of constructing a software design: One way is to
+make it so simple that there are obviously no deficiencies, and the
+other way is to make it so complicated that there are no obvious
+deficiencies.
+ -- C. A. R. Hoare
+%
+There are two ways of disliking art.
+One is to dislike it.
+The other is to like it rationally.
+ -- Oscar Wilde
+%
+There are two ways of disliking poetry;
+one way is to dislike it, the other is to read Pope.
+ -- Oscar Wilde
+%
+There are two ways to write error-free
+programs; only the third one works.
+%
+There are very few personal problems that cannot be
+solved through a suitable application of high explosives.
+%
+There are worse things in life than death. Have you ever spent an evening
+with an insurance salesman?
+ -- Woody Allen
+%
+There be sober men a'plenty, and drunkards barely twenty; there are men
+of over ninety who have never yet kissed a girl. But give me the rambling
+rover, from Orkney down to Dover, we will roam the whole world over, and
+together we'll face the world.
+ -- Andy Stewart, "After the Hush"
+%
+There but for the grace of God, goes God.
+ -- Winston Churchill, speaking of Sir Stafford Cripps
+%
+There can be no daily democracy without daily citizenship.
+ -- Ralph Nader
+%
+There can be no twisted thought without a twisted molecule.
+ -- R. W. Gerard
+%
+There cannot be a crisis next week. My schedule is already full.
+ -- Henry Kissinger
+%
+There comes a time in the affairs of a man when he
+has to take the bull by the tail and face the situation.
+ -- W. C. Fields
+%
+There comes a time to stop being angry.
+ -- A Small Circle of Friends
+%
+There exist tasks which cannot be done
+by more than 10 men or fewer than 100.
+ -- Steele's Law
+%
+There goes the good time that was had by all.
+ -- Bette Davis, remarking on a passing starlet
+%
+There has also been some work to allow the interesting use of macro names.
+For example, if you wanted all of your "creat()" calls to include read
+permissions for everyone, you could say
+
+ #define creat(file, mode) creat(file, mode | 0444)
+
+ I would recommend against this kind of thing in general, since it
+hides the changed semantics of "creat()" in a macro, potentially far away
+from its uses.
+ To allow this use of macros, the preprocessor uses a process that
+is worth describing, if for no other reason than that we get to use one of
+the more amusing terms introduced into the C lexicon. While a macro is
+being expanded, it is temporarily undefined, and any recurrence of the macro
+name is "painted blue" -- I kid you not, this is the official terminology
+-- so that in future scans of the text the macro will not be expanded
+recursively. (I do not know why the color blue was chosen; I'm sure it
+was the result of a long debate, spread over several meetings.)
+ -- From Ken Arnold's "C Advisor" column in Unix Review
+%
+There has been a little distress selling on the stock exchange.
+ -- Thomas W. Lamont, October 29, 1929
+%
+There has been an alarming increase in the
+number of things you know nothing about.
+%
+There is a 20% chance of tomorrow.
+%
+There is a building with four floors. On the first floor, there
+is a convention of architects. On the second floor, there is a
+vinyl manufacturing plant. On the third floor there is a fast food
+stand, and on the fourth floor there is a library.
+
+Q: What would happen if a librarian traveled down in a small
+ elevator with one other person from each floor?
+A: The elevator would be full.
+%
+There is a certain frame of mind to which a cemetery
+is, if not an antidote, at least an alleviation. If
+you are in a fit of the blues, go nowhere else.
+ -- Robert Louis Stevenson, "Immortelles"
+%
+There is a certain impertinence in allowing oneself to be burned for an
+opinion.
+ -- Anatole France
+%
+There is a fly on your nose.
+%
+There is a good deal of solemn cant about the common interests of capital
+and labour. As matters stand, their only common interest is that of cutting
+each other's throat.
+ -- Brooks Atkinson, "Once Around the Sun"
+%
+There is a great discovery still to be made in Literature:
+that of paying literary men by the quantity they do NOT write.
+%
+There is a green, multi-legged creature crawling on your shoulder.
+%
+There is a limit to the admiration we may hold for a man who spends
+his waking hours poking the contents of chickens with a stick.
+ -- Tom Robbins, "Jitterbug Perfume"
+%
+There is a Massachusetts law requiring all dogs to have their hind legs
+tied during the month of April.
+%
+There is a natural hootchy-kootchy to a goldfish.
+ -- Walt Disney
+%
+There is a new anti-communist organization that advocates the use of
+wooden toilet seats.
+
+It's called the Birch John Society.
+%
+There is a road to freedom. Its milestones are Obedience, Endeavor, Honesty,
+Order, Cleanliness, Sobriety, Truthfulness, Sacrifice, and love of the
+Fatherland.
+ -- Adolf Hitler
+%
+There is a theory which states that if ever anyone discovers exactly
+what the Universe is for and why it is here, it will instantly
+disappear and be replaced by something even more bizarre and
+inexplicable.
+
+There is another theory which states that this has already happened.
+ -- Douglas Adams, "The Restaurant at the End of the Universe"
+%
+There is a time in the tides of men,
+Which, taken at its flood, leads on to success.
+On the other hand, don't count on it.
+ -- T. K. Lawson
+%
+There is a vast difference between the savage and civilized man, but it
+is never apparent to their wives until after breakfast.
+ -- Helen Rowland
+%
+There is always more hell that needs raising.
+ -- Lauren Leveut
+%
+There is always one thing to remember: writers are always selling
+somebody out.
+ -- Joan Didion, "Slouching Towards Bethlehem"
+%
+There is always someone worse off than yourself.
+%
+There is always something new out of Africa.
+ -- Gaius Plinius Secundus
+%
+There is an innocence in admiration; it is found in those to whom it
+has not yet occurred that they, too, might be admired some day.
+ -- Friedrich Nietzsche
+%
+There is an old time toast which is golden for its beauty.
+"When you ascend the hill of prosperity may you not meet a friend."
+ -- Mark Twain
+%
+There is brutality and there is honesty.
+There is no such thing as brutal honesty.
+%
+There is Good Information and there is Bad Information and the
+Internet is generally pretty neutral about the difference. If you're
+a computer, it's all just 0s and 1s.
+ -- Joel Achenbach
+%
+There is grandeur in this view of life, with its several powers,
+having been originally breathed into a few forms or into one; and that,
+whilst this planet has gone cycling on according to the fixed law of
+gravity, from so simple a beginning endless forms most beautiful and
+most wonderful have been, and are being, evolved.
+ -- Darwin
+%
+There is hardly a thing in the world that some man can
+not make a little worse and sell a little cheaper.
+%
+There is hopeful symbolism in the fact that flags do not wave in a vacuum.
+ -- Arthur C. Clarke
+%
+There is in certain living souls
+A quality of loneliness unspeakable,
+So great it must be shared
+As company is shared by lesser beings.
+Such a loneliness is mine; so know by this
+That in immensity
+There is one lonelier than you.
+%
+There is, in fact, no reason to believe that any given natural phenomenon,
+however marvelous it may seem today, will remain forever inexplicable.
+Soon or late the laws governing the production of life itself will be
+discovered in the laboratory, and man may set up business as a creator
+on his own account. The thing, indeed, is not only conceivable; it is
+even highly probable.
+ -- H. L. Mencken, 1930
+%
+There *_i_s* intelligent life on Earth, but I leave for Texas on Monday.
+%
+There is Jackson standing like a stone wall. Let us determine to die,
+and we will conquer. Follow me.
+ -- General Barnard E. Bee (CSA)
+%
+There is more simplicity in a man who eats caviar on impulse than in a
+man who eats Grapenuts on principle.
+ -- G. K. Chesterton
+%
+There is more to life than increasing its speed.
+ -- Mohandas K. Gandhi
+%
+There is much Obi-Wan did not tell you.
+ -- Darth Vader
+%
+There is never enough time to do it right the first time, but there is
+always enough time to do it over.
+%
+There is never time to do it right, but always time to do it over.
+%
+There is no act of treachery or mean-ness of which a political party
+is not capable; for in politics there is no honour.
+ -- Benjamin Disraeli, "Vivian Grey"
+%
+There is no bad taste. There is only good taste, and that is bad.
+ -- Poul Henningsen (1894-1967)
+%
+There is no better way of exercising the imagination than the study of law.
+No poet ever interpreted nature as freely as a lawyer interprets truth.
+ -- Jean Giraudoux, "Tiger at the Gates"
+%
+There is no choice before us. Either we must Succeed in providing
+the rational coordination of impulses and guts, or for centuries
+civilization will sink into a mere welter of minor excitements.
+We must provide a Great Age or see the collapse of the upward
+striving of the human race.
+ -- Alfred North Whitehead
+%
+There is no comfort without pain; thus
+we define salvation through suffering.
+ -- Cato
+%
+There is no cure for birth and death other than to enjoy the interval.
+ -- George Santayana
+%
+There is no delight the equal of dread.
+As long as it is somebody else's.
+ -- Clive Barker
+%
+There is no distinction between any AI program and some existent game.
+%
+There is no distinctly native American criminal class except Congress.
+ -- Mark Twain
+%
+There is no doubt that my lawyer is honest. For example, when he
+filed his income tax return last year, he declared half of his salary
+as "unearned income."
+ -- Michael Lara
+%
+There is no education that is not political. An apolitical
+education is also political because it is purposely isolating.
+%
+There is no Father Christmas. It's just a marketing ploy to make low income
+parents' lives a misery. ... I want you to picture the trusting face of a
+child, streaked with tears because of what you just said. I want you to
+picture the face of its mother, because one week's dole won't pay for one
+Master of the Universe Battlecruiser!
+ -- Filthy Rich and Catflap
+%
+There is no fear in love; but perfect love casteth out fear.
+%
+There is no fool to the old fool.
+ -- John Heywood
+%
+There is no future in time travel.
+%
+There is no grief which time does not lessen and soften.
+%
+There is no hunting like the hunting of man, and those who have hunted
+armed men long enough and liked it, never care for anything else thereafter.
+ -- Ernest Hemingway
+%
+There is no likelihood man can ever tap the power of the atom.
+ -- Robert Millikan, Nobel Prize in Physics, 1923
+%
+There is no need to do any housework at all. After the first four years
+the dirt doesn't get any worse.
+ -- Quentin Crisp
+%
+There is no ox so dumb as the orthodox.
+ -- George Francis Gillette
+%
+There is no point in waiting.
+The train stopped running years ago.
+All the schedules, the brochures,
+The bright-colored posters full of lies,
+Promise rides to a distant country
+That no longer exists.
+%
+There is no proverb that is not true.
+ -- Cervantes
+%
+There is no realizable power that man cannot, in time, fashion the
+tools to attain, nor any power so secure that the naked ape will not
+abuse it. So it is written in the genetic cards -- only physics and
+war hold him in check. And also the wife who wants him home by five,
+of course.
+ -- Encyclopedia Apocryphia, 1990 ed.
+%
+There is no reason for any individual to have a computer in their home.
+ -- Ken Olsen (President of Digital Equipment Corporation),
+ Convention of the World Future Society, in Boston, 1977
+%
+There is no royal road to geometry.
+ -- Euclid
+%
+There is no sadder sight than a young pessimist.
+%
+There is no satisfaction in hanging a man who does not object to it.
+ -- George Bernard Shaw
+%
+There is no security on this earth. There is only opportunity.
+ -- General Douglas MacArthur
+%
+There is no sin but ignorance.
+ -- Christopher Marlowe
+%
+There is no sincerer love than the love of food.
+ -- George Bernard Shaw
+%
+There is no statute of limitations on stupidity.
+%
+There is no substitute for good manners, except, perhaps, fast reflexes.
+%
+There *is* no such thing as a civil engineer.
+%
+There is no such thing as a free lunch.
+%
+There is no such thing as a problem without a gift for you in its hands.
+%
+There is no such thing as an ugly woman -- there are only
+the ones who do not know how to make themselves attractive.
+ -- Christian Dior
+%
+There is no such thing as fortune. Try again.
+%
+There is no such thing as inner peace. There is only nervousness or death.
+Any attempt to prove otherwise constitutes unacceptable behaviour.
+ -- Fran Lebowitz, "Metropolitan Life"
+%
+There is no such thing as pure pleasure;
+some anxiety always goes with it.
+%
+There is no time like the pleasant.
+%
+There is no time like the present
+for postponing what you ought to be doing.
+%
+There is no TRUTH. There is no REALITY. There is no CONSISTENCY.
+There are no ABSOLUTE STATEMENTS. I'm very probably wrong.
+%
+There is not a man in the country that can't make a living for himself and
+family. But he can't make a living for them *and* his government, too,
+the way his government is living. What the government has got to do is
+live as cheap as the people.
+ -- The Best of Will Rogers
+%
+There is not much to choose between a woman who deceives
+us for another, and a woman who deceives another for ourselves.
+ -- Augier
+%
+There is not opinion so absurd that some philosopher will not express it.
+ -- Marcus Tullius Cicero, "Ad familiares"
+%
+There is nothing more exhilarating than to be shot at without result.
+ -- Winston Churchill
+%
+There is nothing more silly than a silly laugh.
+ -- Gaius Valerius Catullus
+%
+There is nothing new except what has been forgotten.
+ -- Marie Antoinette
+%
+There is nothing so easy but that it becomes difficult
+when you do it reluctantly.
+ -- Publius Terentius Afer (Terence)
+%
+There is nothing stranger in a strange land than the stranger who
+comes to visit.
+%
+There is nothing which cannot be answered by means of my doctrine," said
+a monk, coming into a teahouse where Nasrudin sat.
+ "And yet just a short time ago, I was challenged by a scholar with
+an unanswerable question," said Nasrudin.
+ "I could have answered it if I had been there."
+ "Very well. He asked, 'Why are you breaking into my house in
+the middle of the night?'"
+%
+There is nothing wrong with abstinence, in moderation.
+%
+There is nothing wrong with Southern California that a rise in the
+ocean level wouldn't cure.
+ -- Ross MacDonald
+%
+There is nothing wrong with writing ... as long as it
+is done in private and you wash your hands afterward.
+%
+There is one difference between a tax collector and
+a taxidermist -- the taxidermist leaves the hide.
+ -- Mortimer Caplan
+%
+There is one way to find out if a man is honest -- ask him. If he says
+"Yes" you know he is crooked.
+ -- Groucho Marx
+%
+There is only one thing in the world worse than being
+talked about, and that is not being talked about.
+ -- Oscar Wilde
+%
+There is only one way to be happy by means of the heart -- to have none.
+ -- Paul Bourget
+%
+There is only one way to console a widow. But remember the risk.
+ -- Robert A. Heinlein
+%
+There is only one way to kill capitalism --
+by taxes, taxes, and more taxes.
+ -- Karl Marx
+%
+There is only one word for aid that is genuinely without strings,
+and that word is blackmail.
+ -- Colm Brogan
+%
+There is perhaps in every thing of any consequence, secret history, which
+it would be amusing to know, could we have it authentically communicated.
+ -- James Boswell
+%
+There is plenty of time before progress goes too far.
+ -- Poul Henningsen (1894-1967)
+%
+There is something in the pang of change
+More than the heart can bear,
+Unhappiness remembering happiness.
+ -- Euripides
+%
+There is very little future in being right when your boss is wrong.
+%
+There isn't room enough in this dress for both of us!
+%
+There may be said to be two classes of people in the world; those who
+constantly divide the people of the world into two classes and those
+who do not.
+ -- Robert Benchley
+%
+There must be at least 500,000,000 rats in the United
+States; of course, I never heard the story before.
+%
+There must be more to life than having everything.
+ -- Maurice Sendak
+%
+There never was a good war or a bad peace.
+ -- Benjamin Franklin
+%
+There once was a king who ruled his country long, wisely, and well. The
+king had a son whom he hoped would someday rule the land. He also wished
+in his heart that the son would be wise and compassionate. One day he said
+to the prince:
+ "If you promised that you would give a certain woman anything, even
+half of your kingdom, and then she demanded the life of your best friend,
+what would your decision be, my son?"
+ The young prince thought for a moment and then said, "I would tell
+her that she was my best friend, and then cut off her head."
+ The king knew that his son would be a great king.
+%
+There once was a king who ruled his country long, wisely, and well. The
+king had a son whom he hoped would someday rule the land. He also wished
+in his heart that the son would be wise and compassionate. One day he said
+to the prince:
+ "If you promised that you would give a certain woman anything, even
+half of your kingdom, and then she demanded the life of your best friend,
+what would your decision be, my son?"
+ The young prince thought for a moment and then said, "I would tell
+her that the life of my best friend did not lie in the half of the kingdom
+that I had promised."
+ The king knew that his son would be a great king.
+%
+There seems no plan because it is all plan.
+ -- C. S. Lewis
+%
+There was a boy called Eustace Clarence Scrubb, and he almost deserved it.
+ -- C. S. Lewis, "The Chronicles of Narnia"
+%
+There was a little girl
+Who had a little curl
+Right in the middle of her forehead.
+When she was good, she was very, very good
+And when she was bad, she was very, very popular.
+ -- Max Miller, "The Max Miller Blue Book"
+%
+There was a man who enjoyed playing golf, and could occasionally put up
+with taking in a round with his wife. One time (with his wife along) he
+was having an extremely bad round. On the 12th hole, he sliced a drive
+over by a grounds-keepers' shack. Although he did not have a clear shot
+to the green, his wife noticed that there were two doors on the shack,
+and there was a possibility that, if both doors were opened, he might be
+able to hit through. Without hesitation, he instructed his wife to go
+around to the other side and open the far door. Sure enough, this gave
+him a clear path to the green. He stepped up to his ball and prepared
+to hit. His wife had been standing by the far door waiting for him to
+hit through. After a moment, she became curious and stuck her head in
+the doorway, to see what he was doing. At that exact moment, the husband
+cracked a three-wood that hit his wife square on the forehead, killing
+her instantly. A few weeks later, the man was playing a round at the same
+course, this time with a friend of his. Once again on the 12th hole, he
+sliced his drive to the shack. His friend suggested that he might be able
+to hit through, if he was to open both doors.
+ "Nah", replied the man, "Last time I did that I took a 7".
+%
+There was a phone call for you.
+%
+There was a plane crash over mid-ocean, and only three survivors were
+left in the life-raft: the Pope, the President, and Mayor Daley.
+Unfortunately, it was a one-man life-raft, and quickly sinking, so
+they started debating who should be allowed to stay. The Pope pointed
+out that he was the spiritual leader of millions all over the world,
+the President explained that if he died then America would be stuck
+with the Vice-President, and so forth. Then Mayor Daley said, "Look!
+We're not solving anything like this! The only fair thing to do is
+to vote on it." So they did, and Mayor Daley won by 97 votes.
+%
+There was a writer in 'Life' magazine ... who claimed that rabbits have
+no memory, which is one of their defensive mechanisms. If they recalled
+every close shave they had in the course of just an hour life would become
+insupportable.
+ -- Kurt Vonnegut, Jr.
+%
+There was a young man from LeDoux,
+Whose limericks stopped at line two.
+
+There was a young man from Verdunne.
+
+ [Actually, there are three limericks in this series, the third one
+ is about some guy named Nero. If anyone has a copy of it, please
+ mail it to "fortune". Ed.]
+%
+There was an interesting development in the CBS-Westmoreland trial:
+both sides agreed that after the trial, Andy Rooney would be allowed to
+talk to the jury for three minutes about little things that annoyed him
+during the trial.
+ -- David Letterman
+%
+There was an old Indian belief that by making love on the hide of
+their favorite animal, one could guarantee the health and prosperity
+of the offspring conceived thereupon. And so it goes that one Indian
+couple made love on a buffalo hide. Nine months later, they were
+blessed with a healthy baby son. Yet another couple huddled together
+on the hide of a deer and they too were blessed with a very healthy
+baby son. But a third couple, whose favorite animal was a hippopotamus,
+were blessed with not one, but TWO very healthy baby sons at the conclusion
+of the nine month interval. All of which proves the old theorem that:
+The sons of the squaw of the hippopotamus are equal to the sons of
+the squaws of the other two hides.
+%
+There was, it appeared, a mysterious rite of initiation through which,
+in one way or another, almost every member of the team passed. The term
+that the old hands used for this rite -- West invented the term, not the
+practice -- was `signing up.' By signing up for the project you agreed
+to do whatever was necessary for success. You agreed to forsake, if
+necessary, family, hobbies, and friends -- if you had any of these left
+(and you might not, if you had signed up too many times before).
+ -- Tracy Kidder, "The Soul of a New Machine"
+%
+There was this New Yorker that had a lifelong ambition to be a Texan.
+Fortunately, he had a Texan friend and went to him for advice. "Mike,
+you know I've always wanted to be a Texan. You're a *real* Texan, what
+should I do?"
+ "Well," answered Mike, "The first thing you've got to do is look
+like a Texan. That means you have to dress right. The second thing
+you've got to do is speak in a southern drawl."
+ "Thanks, Mike, I'll give it a try," replied the New Yorker.
+ A few weeks passed and the New Yorker saunters into a store dressed
+in a ten-gallon hat, cowboy boots, Levi jeans and a bandanna. "Hey, there,
+pardner, I'd like some beef, not too rare, and some of them fresh biscuits,"
+he tells the counterman.
+ The guy behind the counter takes a long look at him and then says,
+"You must be from New York."
+ The New Yorker blushes, and says, "Well, yes, I am. How did
+you know?"
+ "Because this is a hardware store."
+%
+There were in this country two very large monopolies. The larger of
+the two had the following record: the Vietnam War, Watergate, double-
+digit inflation, fuel and energy shortages, bankrupt airlines, and the
+8-cent postcard. The second was responsible for such things as the
+transistor, the solar cell, lasers, synthetic crystals, high fidelity
+stereo recording, sound motion pictures, radio astronomy, negative
+feedback, magnetic tape, magnetic "bubbles", electronic switching
+systems, microwave radio and TV relay systems, information theory, the
+first electrical digital computer, and the first communications
+satellite. Guess which one got to tell the other how to run the
+telephone business?
+%
+There will always be beer cans rolling on the floor of your car when
+the boss asks for a lift home from the office.
+%
+There will be big changes for you but you will be happy.
+%
+There will be sex after death, we just won't be able to feel it.
+ -- Lily Tomlin
+%
+Therefore it is necessary to learn how not to be good, and to use
+this knowledge and not use it, according to the necessity of the cause.
+ -- Machiavelli
+%
+There's a couple of million dollars worth of baseball talent on the loose,
+ready for the big leagues, yet unsigned by any major league. There are
+pitchers who would win 20 games a season ... and outfielders [who] could
+hit .350, infielders who could win recognition as stars, and there's at
+least one catcher who at this writing is probably superior to Bill Dickey,
+Josh Gibson. Only one thing is keeping them out of the big leagues, the
+pigmentation of their skin. They happen to be colored.
+ -- Shirley Povich, 1941
+%
+There's a fine line between courage and foolishness. Too bad it's not
+a fence.
+%
+There's a lesson that I need to remember
+When everything is falling apart
+In life, just like in loving
+There's such a thing as trying to hard
+
+You've gotta sing
+Like you don't need the money
+Love like you'll never get hurt
+You've gotta dance
+Like nobody's watching
+It's gotta come from the heart
+If you want it to work.
+ -- Kathy Mattea
+%
+There's a long-standing bug relating to the x86 architecture that
+allows you to install Windows.
+ -- Matthew D. Fuller
+%
+There's a lot to be said for not saying a lot.
+%
+There's a man deeply in debt, see, and he takes the money he has left
+and goes to Monte Carlo to try to recoup at the roulette tables. Won a
+little, lost a lot, and was down to his last franc. Prayed for help.
+A voice whispered in his ear: "Le rouge..." Man looked around; nobody
+there. What the hell -- he puts his last franc on the red, and it won.
+The voice immediately said, "Encore le rouge..." Played red again, and
+it won again. The voice said, "Impair..." Played odd, and it won. Voice
+said, "Quinze..." so he put all the money on 15, and it won. This went
+on for hours, the voice telling him what to bet, and the man putting all
+his money on what the voice said, and winning. Finally when the voice
+spoke, the man protested that he'd won millions of dollars and wanted to
+quit. The voice was inexorable: "Douze..." The man put the money on 12,
+and 11 came up -- he had lost everything -- the voice murmured "Merde!!"
+%
+There's a thrill in store for all for we're about to toast
+The corporation that we represent.
+We're here to cheer each pioneer and also proudly boast,
+Of that man of men our sterling president
+The name of T. J. Watson means
+A courage none can stem
+And we feel honored to be here to toast the IBM.
+ -- Ever Onward, from the 1940 IBM Songbook
+%
+There's a trick to the Graceful Exit. It begins with the vision to
+recognize when a job, a life stage, a relationship is over -- and to
+let go. It means leaving what's over without denying its validity
+or its past importance in our lives. It involves a sense of future,
+a belief that every exit line is an entry, that we are moving on,
+rather than out. The trick of retiring well may be the trick of
+living well. It's hard to recognize that life isn't a holding
+action, but a process. It's hard to learn that we don't leave the
+best parts of ourselves behind, back in the dugout or the office.
+We own what we learned back there. The experiences and the growth
+are grafted onto our lives. And when we exit, we can take ourselves
+along -- quite gracefully.
+ -- Ellen Goodman
+%
+There's a whole WORLD in a mud puddle!
+ -- Doug Clifford
+%
+There's always free cheese in a mousetrap.
+%
+There's an old proverb that says just about whatever you want it to.
+%
+There's been no top authority saying what marijuana does to you. I really
+don't know that much about it. I tried it once but it didn't do anything
+to me.
+ -- John Wayne
+%
+There's got to be more to life than compile-and-go.
+%
+There's just something I don't like about Virginia; the state.
+%
+There's little in taking or giving,
+ There's little in water or wine:
+This living, this living, this living,
+ Was never a project of mine.
+Oh, hard is the struggle, and sparse is
+ The gain of the one at the top,
+For art is a form of catharsis,
+ And love is a permanent flop,
+And work is the province of cattle,
+ And rest's for a clam in a shell,
+So I'm thinking of throwing the battle --
+ Would you kindly direct me to hell?
+ -- Dorothy Parker
+%
+There's no easy quick way out, we're gonna have to live through our
+whole lives, win, lose, or draw.
+ -- Walt Kelly
+%
+There's no justice in this world.
+ -- Frank Costello, on the prosecution of "Lucky" Luciano
+ by New York district attorney Thomas Dewey after
+ Luciano had saved Dewey from assassination by Dutch
+ Schultz (by ordering the assassination of Schultz
+ instead)
+%
+There's no point in being grown up if you can't be childish sometimes.
+ -- The Doctor, "Doctor Who"
+%
+There's no real need to do housework -- after four years it doesn't get
+any worse.
+%
+There's no room in the drug world for amateurs.
+ -- Raoul Duke
+%
+There's no saint like a reformed sinner.
+%
+There's no sense in being precise when you don't even know
+what you're talking about.
+ -- John von Neumann
+%
+There's no such thing as a free lunch.
+ -- Milton Friendman
+%
+There's no such thing as an original sin.
+ -- Elvis Costello
+%
+There's no trick to being a humorist when you have the whole government
+working for you.
+ -- Will Rogers
+%
+There's no use in having a dog and doing your own barking.
+%
+There's nothing in the middle of the road but yellow stripes and dead
+armadillos.
+ -- Jim Hightower, Texas Agricultural Commissioner
+%
+There's nothing like a girl with a plunging
+neckline to keep a man on his toes.
+%
+There's nothing like a good dose of another woman to make a man
+appreciate his wife.
+ -- Clare Booth Luce
+%
+There's nothing like good food, good wine, and a bad girl.
+%
+There's nothing like the face of a kid eating a Hershey bar.
+%
+There's nothing remarkable about it. All one has to do is hit the right
+keys at the right time and the instrument plays itself.
+ -- J. S. Bach
+%
+There's nothing so precious as a cafe full of Gap kiddies trying to
+work out whether you're really wearing rubber pants.
+ -- Mike Smith
+%
+There's nothing to writing. All you do is sit at a typewriter
+and open a vein.
+ -- Red Smith
+%
+There's nothing very mysterious about you, except that
+nobody really knows your origin, purpose, or destination.
+%
+There's nothing worse for your business than
+extra Santa Clauses smoking in the men's room.
+ -- W. Bossert
+%
+There's nothing wrong with teenagers that
+reasoning with them won't aggravate.
+%
+There's one consolation about matrimony. When you look around you can
+always see somebody who did worse.
+ -- Warren H. Goldsmith
+%
+There's one fool at least in every married couple.
+%
+There's only one everything.
+%
+There's only one way to have a happy marriage
+and as soon as I learn what it is I'll get married again.
+ -- Clint Eastwood
+%
+There's small choice in rotten apples.
+ -- William Shakespeare, "The Taming of the Shrew"
+%
+There's so much plastic in this culture that
+vinyl leopard skin is becoming an endangered synthetic.
+ -- Lily Tomlin
+%
+There's so much to say but your eyes keep interrupting me.
+%
+There's something different about us -- different from people of Europe,
+Africa, Asia ... a deep and abiding belief in the Easter Bunny.
+ -- G. Gordon Liddy
+%
+There's something the technicians need to learn from the artists.
+If it isn't aesthetically pleasing, it's probably wrong.
+%
+There's such a thing as too much point on a pencil.
+ -- H. Allen Smith, "Let the Crabgrass Grow"
+%
+There's too much beauty upon this earth for lonely men to bear.
+ -- Richard Le Gallienne
+%
+These activities have their own rules and methods
+of concealment which seek to mislead and obscure.
+ -- Dwight D. Eisenhower, 1960
+%
+"These are DARK TIMES for all mankind's HIGHEST VALUES!"
+"These are DARK TIMES for FREEDOM and PROSPERITY!"
+"These are GREAT TIMES to put your money on BAD GUY to kick the CRAP
+out of MEGATON MAN!"
+%
+These days the necessities of life cost you about three times what
+they used to, and half the time they aren't even fit to drink.
+%
+They also serve who only stand and wait.
+ -- John Milton
+%
+They also surf who only stand on waves.
+%
+They are called computers simply because computation is
+the only significant job that has so far been given to them.
+%
+They are cold-blooded. They are completely ruthless about protecting
+what they have. The only thing they connect to is the money aspect of
+life. Let's face it: That's the American way.
+ -- Jeffrey M. Johnson, regional chairman of the District
+ of Columbia United Way, speaking of drug dealers.
+%
+They are ill discoverers that think there is no land,
+when they can see nothing but sea.
+ -- Francis Bacon
+%
+They are relatively good but absolutely terrible.
+ -- Alan Kay, commenting on Apollos
+%
+They call them "squares" because it's the
+most complicated shape they can deal with.
+%
+They can't stop us... we're on a mission from God!
+ -- The Blues Brothers
+%
+They couldn't hit an elephant at this dist...
+ -- Civil War General John Sedgwick, his last words,
+ Battle of Spotsylvania Court House, 1864
+%
+They don't know how the world is shaped. And so they give it a shape, and
+try to make everything fit it. They separate the right from the left, the
+man from the woman, the plant from the animal, the sun from the moon. They
+only want to count to two.
+ -- Emma Bull, "Bone Dance"
+%
+They don't suffer. They can't even speak English.
+ -- George F. Baer, answering a reporter's
+ question about the suffering of starving miners.
+%
+They finally got King Midas, I hear. Gild by association.
+%
+They have been at a great feast of languages, and stolen the scraps.
+ -- William Shakespeare, "Love's Labour's Lost"
+%
+They have their datasheets translated from Korean into English by
+Russians with Greek->German dictionaries
+ -- Philip Paeps, on modern hardware documentation
+%
+They just buzzed and buzzed...buzzed.
+%
+They make a desert and call it peace.
+ -- Tacitus (55?-120?)
+%
+They say it's the responsibility of the media to look at government --
+especially the president -- with a microscope. I don't argue with that,
+but when they use a proctoscope, it's going too far.
+ -- Richard M. Nixon
+%
+They seem to have learned the habit of cowering before authority even when
+not actually threatened. How very nice for authority. I decided not to
+learn this particular lesson.
+ -- Richard Stallman
+%
+They sentenced me to twenty years of boredom for trying to change the
+system from within. I'm coming now I'm coming to reward them. First
+we take Manhattan, then we take Berlin.
+
+I'm guided by a signal in the heavens. I'm guided by this birthmark on
+my skin. I'm guided by the beauty of our weapons. First we take Manhattan,
+then we take Berlin.
+
+I'd really like to live beside you, baby. I love your body and your spirit
+and your clothes. But you see that line there moving through the station?
+I told you I told you I told you I was one of those.
+ -- Leonard Cohen, "First We Take Manhattan"
+%
+They spell it "da Vinci" and pronounce it "da Vinchy". Foreigners
+always spell better than they pronounce.
+ -- Mark Twain
+%
+They that can give up essential liberty to obtain a little temporary
+safety deserve neither liberty nor safety.
+ -- Benjamin Franklin, 1759
+%
+They told me I was gullible ... and I believed them!
+%
+They told me you had proven it When they discovered our results
+About a month before. Their hair began to curl
+The proof was valid, more or less Instead of understanding it
+But rather less than more. We'd run the thing through PRL.
+
+He sent them word that we would try Don't tell a soul about all this
+To pass where they had failed For it must ever be
+And after we were done, to them A secret, kept from all the rest
+The new proof would be mailed. Between yourself and me.
+
+My notion was to start again
+Ignoring all they'd done
+We quickly turned it into code
+To see if it would run.
+%
+They took some of the Van Goghs, most
+of the jewels, and all of the Chivas!
+%
+They Tore Out My Heart and Stomped That Sucker Flat
+ -- Book title by Lewis Grizzard
+%
+They use different words for things in America.
+For instance they say elevator and we say lift.
+They say drapes and we say curtains.
+They say president and we say brain damaged git.
+ -- Alexie Sayle
+%
+They went rushing down that freeway,
+Messed around and got lost.
+They didn't care... they were just dying to get off,
+And it was life in the fast lane.
+ -- Eagles, "Life in the Fast Lane"
+%
+They will only cause the lower classes to move about needlessly.
+ -- The Duke of Wellington, on early steam railroads
+%
+They wouldn't listen to the fact that I was a genius,
+The man said "We got all that we can use",
+So I've got those steadily-depressin', low-down, mind-messin',
+Working-at-the-car-wash blues.
+ -- Jim Croce
+%
+They're an insidious bunch, your killer pianos. Had one get loose on me
+back in '62. It slipped out of the cables while we were lowering it out
+of its twelfth story apartment, and crushed six innocents in an insane bid
+for freedom.
+ -- Stig's Inferno
+%
+They're basically very smelly houseplants until they get to the crawling
+age. You're constantly terrified that they're going to randomly die on
+you, but the rules for preventing that outcome are straightforward and
+hard to forget.
+ -- Thomas Ptacek, giving advice to a new father
+%
+They're giving bank robbing a bad name.
+ -- John Dillinger, on Bonnie and Clyde
+%
+They're only trying to make me LOOK paranoid!
+%
+They're unfriendly, which is fortunate, really. They'd be difficult
+to like.
+ -- Avon
+%
+Thieves respect property; they merely wish the property to become
+their property that they may more perfectly respect it.
+ -- G. K. Chesterton, "The Man Who Was Thursday"
+%
+Things are more like they are today than they ever were before.
+ -- Dwight D. Eisenhower
+%
+Things are more like they used to be than they are now.
+%
+Things are not always what they seem.
+ -- Phaedrus
+%
+Things Charles Darwin did not say:
+
+Finches, eh? Seen one, seem 'em all.
+%
+Things Charles Darwin did not say:
+
+Nah, it's only a theory - I don't think it should be taught in schools.
+%
+Things fall apart; the centre cannot hold.
+%
+Things past redress and now with me past care.
+ -- William Shakespeare, "Richard II"
+%
+Things will be bright in P.M.
+A cop will shine a light in your face.
+%
+Things will get better despite our efforts to improve them.
+ -- Will Rogers
+%
+Things worth having are worth cheating for.
+%
+Think big.
+Pollute the Mississippi.
+%
+Think honk if you're a telepath.
+%
+Think lucky. If you fall in a pond, check your pockets for fish.
+ -- Darrell Royal
+%
+Think of it! With VLSI we can pack 100 ENIACs in 1 sq. cm.!
+%
+Think of your family tonight.
+Try to crawl home after the computer crashes.
+%
+Think sideways!
+ -- Ed De Bono
+%
+Think twice before speaking, but don't say "think think click click".
+%
+Thinking you know something is a sure way to blind yourself.
+ -- Frank Herbert, "Chapterhouse: Dune"
+%
+Thinks't thou existence doth depend on time?
+It doth; but actions are our epochs; mine
+Have made my days and nights imperishable,
+Endless, and all alike, as sands on the shore,
+Innumerable atoms; and one desert,
+Barren and cold, on which the wild waves break,
+But nothing rests, save carcasses and wrecks,
+Rocks, and the salt-surf weeds of bitterness.
+%
+Thirteen at a table is unlucky only
+when the hostess has only twelve chops.
+ -- Groucho Marx
+%
+Thirty days hath Septober,
+April, June, and no wonder.
+all the rest have peanut butter
+except my father who wears red suspenders.
+%
+Thirty white horses on a red hill,
+First they champ,
+Then they stamp,
+Then they stand still.
+ -- Tolkien
+%
+This ae nighte, this ae nighte,
+Everye nighte and alle,
+Fire and sleet and candlelyte,
+And Christe receive thy saule.
+ -- The Lykewake Dirge
+%
+This "brain-damaged" epithet is getting sorely overworked. When we can
+speak of someone or something being flawed, impaired, marred, spoiled;
+batty, bedlamite, bonkers, buggy, cracked, crazed, cuckoo, daft, demented,
+deranged, loco, lunatic, mad, maniac, mindless, non compos mentis, nuts,
+Reaganite, screwy, teched, unbalanced, unsound, witless, wrong; senseless,
+spastic, spasmodic, convulsive; doped, spaced-out, stoned, zonked; {beef,
+beetle,block,dung,thick}headed, dense, doltish, dull, duncical, numskulled,
+pinhead; asinine, fatuous, foolish, silly, simple; brute, lumbering, oafish;
+half-assed, incompetent; backward, retarded, imbecilic, moronic; when we have
+a whole precisely nuanced vocabulary of intellectual abuse to draw upon,
+individually and in combination, isn't it a little <fill in the blank> to be
+limited to a single, now quite trite, adjective?
+%
+This door is baroquen, please wiggle Handel.
+(If I wiggle Handel, will it wiggle Bach?)
+ -- Found on a door in the MSU music building
+%
+This dungeon is owned and operated by Frobazz Magic Co., Ltd.
+%
+This email and any files transmitted with it are confidential and
+intended solely for the use of the individual or entity to which they
+are addressed. If you are not the intended recipient of this
+transmission, please delete it immediately.
+
+Obviously, I am the idiot who sent it to you by mistake. Furthermore,
+there is no way I can force you to delete it. Worse, by the time you
+have reached this disclaimer you have already read the document.
+Telling you to forget it would seem absurd. In any event, I have no
+legal right to force you to take any action upon this email anyway.
+
+This entire disclaimer is just a waste of everyone's time and
+bandwidth. Therefore, let us just forget the whole thing and enjoy a
+cold beer instead.
+ -- found on the dovecot mailinglist
+%
+This file will self-destruct in five minutes.
+%
+This Fortue Examined By INSPECTOR NO. 2-14
+%
+This fortune cookie program out of order. For those in desperate
+need, please use the program "randchar". This program generates
+random characters, and, given enough time, will undoubtedly come
+up with something profound. It will, however, take it no time at
+all to be more profound than THIS program has ever been.
+%
+This fortune intentionally not included.
+%
+This fortune intentionally says nothing.
+%
+This fortune is dedicated to your mother, without whose
+invaluable assistance last night would never have been possible.
+%
+This fortune is encrypted -- get your decoder rings ready!
+%
+This fortune is false.
+%
+This fortune is inoperative. Please try another.
+%
+This fortune soaks up 47 times its own weight in excess memory.
+%
+This fortune was brought to you by the people at Hewlett-Packard.
+%
+This fortune would be seven words long if it were six words shorter.
+%
+This generation doesn't have emotional baggage.
+We have emotional moving vans.
+ -- Bruce Feirstein
+%
+This guy runs into his house and yells to his wife, "Kathy, pack up your
+bags! I just won the California lottery!"
+ "Honey!", Kathy exclaims, "Shall I pack for warm weather or cold?"
+ "I don't care," responds the husband. "just so long as you're out
+of the house by dinner!"
+%
+This is a country where people are free to practice their religion,
+regardless of race, creed, color, obesity, or number of dangling keys...
+%
+This is a good time to punt work.
+%
+This is a job for BOB VIOLENCE and SCUM, the INCREDIBLY STUPID MUTANT
+DOG.
+ -- Bob Violence
+%
+This is a test of the Emergency Broadcast System. If this had been an
+actual emergency, do you really think we'd stick around to tell you?
+%
+This is a test of the emergency broadcast system.
+Had there been an actual emergency, then you would no longer be here.
+%
+This is an especially good time for you vacationers who plan to fly,
+because the Reagan administration, as part of the same policy under
+which it recently sold Yellowstone National Park to Wayne Newton, has
+"deregulated" the airline industry. What this means for you, the
+consumer, is that the airlines are no longer required to follow any
+rules whatsoever. They can show snuff movies. They can charge for
+oxygen. They can hire pilots right out of Vending Machine Refill
+Person School. They can conserve fuel by ejecting husky passengers
+over water. They can ram competing planes in mid-air. These
+innovations have resulted in tremendous cost savings which have been
+passed along to you, the consumer, in the form of flights with
+amazingly low fares, such as $29. Of course, certain restrictions do
+apply, the main one being that all these flights take you to Newark,
+and you must pay thousands of dollars if you want to fly back out.
+ -- Dave Barry, "Iowa -- Land of Secure Vacations"
+%
+This is an unauthorized cybernetic announcement.
+%
+This is Betty Frenel. I don't know who to call but I can't reach my
+Food-a-holics partner. I'm at Vido's on my second pizza with sausage
+and mushroom. Jim, come and get me!
+%
+This is clearly another case of too many mad scientists,
+and not enough hunchbacks.
+%
+This is for all ill-treated fellows
+ Unborn and unbegot,
+For them to read when they're in trouble
+ And I am not.
+ -- A. E. Housman
+%
+This is Jim Rockford.
+At the tone leave your name and message; I'll get back to you.
+%
+This is lemma 1.1. We start a new chapter so the numbers all go back
+to one.
+ -- Prof. Seager, C&O 351
+%
+This is Maria, Liberty Bail Bonds. Your client, Todd Lieman, skipped and
+his bail is forfeit. That's the pink slip on your '74 Firebird, I believe.
+Sorry, Jim, bring it on over.
+%
+This is Marilyn Reed, I wanta talk to you... Is this a machine?
+I don't talk to machines! [Click]
+%
+This is National Non-Dairy Creamer Week.
+%
+This is NOT a repeat.
+%
+This is not the age of pamphleteers. It is the age of the engineers. The
+spark-gap is mightier than the pen. Democracy will not be salvaged by men
+who talk fluently, debate forcefully and quote aptly.
+ -- Lancelot Hogben, Science for the Citizen, 1938
+%
+THIS IS PLEDGE WEEK FOR THE FORTUNE PROGRAM
+
+If you like the fortune program, why not support it now with your
+contribution of a pithy fortune, clean or obscene? We cannot continue
+without your support. Less than 14% of all fortune users are
+contributors. That means that 86% of you are getting a free ride. We
+can't go on like this much longer. Federal cutbacks mean less money
+for fortunes, and unless user contributions increase to make up the
+difference, the fortune program will have to shut down between midnight
+and 8 a.m. Don't let this happen. Mail your fortunes right now to
+"fortune". Just type in your favorite pithy saying. Do it now before
+you forget. Our target is 300 new fortunes by the end of the week.
+Don't miss out. All fortunes will be acknowledged. If you contribute
+30 fortunes or more, you will receive a free subscription to "The
+Fortune Hunter", our monthly program guide. If you contribute 50 or
+more, you will receive a free "Fortune Hunter" coffee mug ...
+%
+This is supposed to be a happy occasion.
+Let's not BICKER and ARGUE over who killed who!
+%
+This is the Baron. Angel Martin tells me you buy information. Ok,
+meet me at one a.m. behind the bus depot, bring five-hundred dollars
+and come alone. I'm serious!
+%
+This is the first age that's paid much attention to the future,
+which is a little ironic since we may not have one.
+ -- Arthur C. Clarke
+%
+This is the first numerical problem I ever did. It demonstrates the
+power of computers:
+
+Enter lots of data on calorie & nutritive content of foods. Instruct the
+thing to maximize a function describing nutritive content, with a minimum
+level of each component, for fixed caloric content. The results are that
+one should eat each day:
+
+ 1/2 chicken
+ 1 egg
+ 1 glass of skim milk
+ 27 heads of lettuce.
+ -- Rev. Adrian Melott
+%
+This is the _L_A_S_T time I take travel suggestions from Ray Bradbury!
+%
+This is the sort of English up with which I will not put.
+ -- Winston Churchill
+%
+This is the story of the bee
+Whose sex is very hard to see
+
+You cannot tell the he from the she
+But she can tell, and so can he
+
+The little bee is never still
+She has no time to take the pill
+
+And that is why, in times like these
+There are so many sons of bees.
+%
+This is the theory that Jack built.
+This is the flaw that lay in the theory that Jack built.
+This is the palpable verbal haze that hid the flaw that lay in...
+%
+This is the tomorrow you worried about yesterday.
+And now you know why.
+%
+This is the way the world ends,
+This is the way the world ends,
+This is the way the world ends,
+Not with a bang but with a whimper.
+ -- T. S. Eliot, "The Hollow Men"
+%
+This is your fortune.
+%
+This isn't right. This isn't even wrong.
+ -- Wolfgang Pauli, on a colleague's paper
+%
+This isn't true in practice -- what we've missed out is Stradivarius's
+constant. And then the aside: "For those of you who don't know, that's
+been called by others the fiddle factor..."
+ -- From a 1B Electrical Engineering lecture
+%
+This land is full of trousers!
+this land is full of mausers!
+ And pussycats to eat them when the sun goes down!
+ -- The Firesign Theatre
+%
+This land is made of mountains,
+This land is made of mud,
+This land has lots of everything,
+For me and Elmer Fudd.
+
+This land has lots of trousers,
+This land has lots of mousers,
+And pussycats to eat them
+When the sun goes down.
+%
+This land is my land, and only my land,
+I've got a shotgun, and you ain't got one,
+If you don't get off, I'll blow your head off,
+This land is private property.
+ -- Apologies to Woody Guthrie
+%
+This life is a test. It is only a test. Had this been an
+actual life, you would have received further instructions as
+to what to do and where to go.
+%
+This life is yours. Some of it was given
+to you; the rest, you made yourself.
+%
+This login session: $13.99
+%
+This login session: $13.99, but for you $11.88
+%
+This must be morning. I never could get the hang of mornings.
+%
+This night methinks is but the daylight sick.
+ -- William Shakespeare, "The Merchant of Venice"
+%
+This novel is not to be tossed lightly aside, but to be hurled with
+great force.
+ -- Dorothy Parker
+%
+This one is for all you military types. For those who don't know, Rangers
+are *extremely* well trained members of the U.S. Army. Marines are people
+who start out as normal soldiers and then are made to believe that bullets
+don't actually hurt.
+ One day a platoon of Marines are on patrol when they come upon a
+Ranger relaxing on top of a small hill. The Ranger puts his hands on his
+hips and screams out, "Do any of you seaweed sucking jarheads think you're
+man enough to take me on?"
+ The biggest Marine comes running up the hill, screaming back at the
+Ranger. When he gets to the top he simply plows into his foe and the two
+tumble down the other side of the hill, out of sight. There is the sound of
+a horrendous fight for a moment or two, and then all is quiet. Soon, the
+Ranger reappears, quite untouched. He puts his hands on his hips and sneers,
+"Well, looks to me like one of you couldn't do it, how about the rest?"
+ The enraged Marine platoon leader sends his entire platoon (30+men)
+charging after the Ranger. They all go tumbling down the far side of the hill.
+After 15 minutes of screaming and yelling and cursing a lone, bloodied Marine
+crawls over the top of the hill. The platoon leader yells up to his man,
+"What's going on up there?" The wounded Marine, with his last bit of breath,
+replies, "Sir, it's a... a trap, sir. They're two of them!"
+%
+This place just isn't big enough for all of us. We've
+got to find a way off this planet.
+%
+This planet has -- or rather had -- a problem, which was this: most of
+the people living on it were unhappy for pretty much of the time. Many
+solutions were suggested for this problem, but most of these were
+largely concerned with the movements of small green pieces of paper,
+which is odd because on the whole it wasn't the small green pieces of
+paper that were unhappy.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+This process can check if this value is zero, and if it is, it does
+something child-like.
+ -- Forbes Burkowski, CS, University of Washington
+%
+This product is meant for educational purposes only. Any resemblance to real
+persons, living or dead is purely coincidental. Void where prohibited. Some
+assembly may be required. Batteries not included. Contents may settle during
+shipment. Use only as directed. May be too intense for some viewers. If
+condition persists, consult your physician. No user-serviceable parts inside.
+Breaking seal constitutes acceptance of agreement. Not responsible for direct,
+indirect, incidental or consequential damages resulting from any defect, error
+or failure to perform. Slippery when wet. For office use only. Substantial
+penalty for early withdrawal. Do not write below this line. Your canceled
+check is your receipt. Avoid contact with skin. Employees and their families
+are not eligible. Beware of dog. Driver does not carry cash. Limited time
+offer, call now to insure prompt delivery. Use only in well-ventilated area.
+Keep away from fire or flame. Some equipment shown is optional. Price does
+not include taxes, dealer prep, or delivery. Penalty for private use. Call
+toll free before digging. Some of the trademarks mentioned in this product
+appear for identification purposes only. All models over 18 years of age. Do
+not use while operating a motor vehicle or heavy equipment. Postage will be
+paid by addressee. Apply only to affected area. One size fits all. Many
+suitcases look alike. Edited for television. No solicitors. Reproduction
+strictly prohibited. Restaurant package, not for resale. Objects in mirror
+are closer than they appear. Decision of judges is final. This supersedes
+all previous notices. No other warranty expressed or implied.
+%
+This quote is taken from the Diamondback, the University of Maryland
+student newspaper, of Tuesday, 3/10/87.
+
+ One disadvantage of the Univac system is that it does not use
+ Unix, a recently developed program which translates from one
+ computer language to another and has a built-in editing system
+ which identifies errors in the original program.
+%
+This sad little lizard told me that he was a brontosaurus on his
+mother's side. I did not laugh; people who boast of ancestry
+often have little else to sustain them. Humoring them costs nothing and
+adds happiness in a world in which happiness is always in short supply.
+ -- Lazarus Long
+%
+This screen intentionally left blank.
+%
+This sentence contradicts itself -- no actually it doesn't.
+ -- Douglas Hofstadter
+%
+This sentence does in fact not have the property it claims not to have.
+%
+This sentence no verb.
+%
+This system will self-destruct in five minutes.
+%
+This thing all things devours:
+Birds, beasts, trees, flowers;
+Gnaws iron, bites steel;
+Grinds hard stones to meal;
+Slays king, ruins town,
+And beats high mountain down.
+%
+This unit... must... survive.
+%
+This universe shipped by weight, not by volume. Some expansion of the
+contents may have occurred during shipment.
+%
+This was a Golden Age, a time of high adventure, rich living, and hard
+dying... but nobody thought so. This was a future of fortune and theft,
+pillage and rapine, culture and vice... but nobody admitted it.
+ -- Alfred Bester, "The Stars My Destination"
+%
+This was the most unkindest cut of all.
+ -- William Shakespeare, "Julius Caesar"
+%
+This wasn't just plain terrible, this was fancy terrible.
+This was terrible with raisins in it.
+ -- Dorothy Parker
+%
+This week only, all our fiber-fill jackets are marked down!
+%
+This will be a memorable month -- no matter how hard you try to forget it.
+%
+This yuppie, see, was in a car wreck. His BMW was mangled, and so was he.
+The paramedic was leaning over him getting his vitals, and all the yup
+could groan was "My BMW! My BMW!"
+ The paramedic tried to quiet the man, pointing out that his car
+wasn't his chief concern at the moment, especially as he'd been rearranged
+pretty badly himself -- for example, his left arm was severed at the elbow
+and was lying about twenty feet away.
+ There was a moment of stunned silence from the yup followed by
+"Oh no! My Rolex! My Rolex!"
+%
+Those lovable Brits department:
+ They also have trouble pronouncing `vitamin'.
+%
+Those of you who think you know everything are very annoying to those
+of us who do.
+%
+Those of you who think you know it all upset those of us who do.
+%
+Those parts of the system that you can hit with a hammer (not advised)
+are called hardware; those program instructions that you can only curse
+at are called software.
+ -- Levitating Trains and Kamikaze Genes: Technological
+ Literacy for the 1990's.
+%
+Those who are mentally and emotionally healthy are those who have
+learned when to say yes, when to say no and when to say whoopee.
+ -- W. S. Krabill
+%
+Those who believe in astrology are living in houses with foundations of
+Silly Putty.
+ -- Dennis Rawlins
+%
+Those who can, do; those who can't, simulate.
+%
+Those who can, do; those who can't, write.
+Those who can't write work for the Bell Labs Record.
+%
+Those who can make you believe absurdities, can make you commit atrocities.
+ -- Voltaire
+%
+Those who cannot remember the past are condemned to repeat it.
+ -- George Santayana
+%
+Those who can't write, write manuals.
+%
+Those who claim the dead never return
+to life haven't ever been around here at quitting time.
+%
+Those who do not do politics will be done in by politics.
+ -- French Proverb
+%
+Those who do not understand Unix are condemned to reinvent it, poorly.
+ -- Henry Spencer
+%
+Those who do things in a noble spirit of
+self-sacrifice are to be avoided at all costs.
+ -- N. Alexander
+%
+Those who educate children well are more to be honored than
+parents, for these only gave life, those the art of living well.
+ -- Aristotle
+%
+Those who express random thoughts to legislative committees are often
+surprised and appalled to find themselves the instigators of law.
+ -- Mark B. Cohen
+%
+Those who have had no share in the good fortunes of the mighty
+Often have a share in their misfortunes.
+ -- Bertolt Brecht, "The Caucasian Chalk Circle"
+%
+Those who have some means think that the most important thing in the
+world is love. The poor know that it is money.
+ -- Gerald Brenan
+%
+Those who in quarrels interpose, must often wipe a bloody nose.
+%
+Those who make peaceful revolution impossible
+will make violent revolution inevitable.
+ -- John F. Kennedy
+%
+Those who profess to favor freedom, and yet depreciate agitation, are
+men who want rain without thunder and lightning. They want the ocean
+without the roar of its many waters.
+ -- Frederick Douglass
+%
+Those who sweat in flames of hell, Leaden eared, some thought their bowels
+Here's the reason that they fell: Lispeth forth the sweetest vowels.
+While on earth they prayed in SAS, These they offered up in praise
+PL/1, or other crass, Thinking all this fetid haze
+Vulgar tongue. A rhapsody sung.
+
+Some the lord did sorely try Jabber of the mindless horde
+Assembling all their pleas in hex. Sequel next did mock the lord
+Speech as crabbed as devil's crable Slothful sequel so enfangled
+Hex that marked on Tower Babel Its speaker's lips became entangled
+The highest rung. In his bung.
+
+Because in life they prayed so ill
+And offered god such swinish swill
+Now they sweat in flames of hell
+Sweat from lack of APL
+Sweat dung!
+%
+Those who talk don't know. Those who don't talk, know.
+%
+Thou hast seen nothing yet.
+ -- Miguel de Cervantes
+%
+Though a program be but three lines long, someday it will have to
+be maintained.
+ -- The Tao of Programming
+%
+Though I respect that a lot
+I'd be fired if that were my job
+After killing Jason off and
+Countless screaming argonauts
+
+Bluebird of friendliness
+Like guardian angels it's
+Always near
+
+Blue canary in the outlet by the light switch
+Who watches over you
+Make a little birdhouse in your soul
+Not to put too fine a point on it
+Say I'm the only bee in your bonnet
+Make a little birdhouse in your soul
+
+ -- "Birdhouse in your Soul", They Might Be Giants
+%
+Thrashing is just virtual crashing.
+%
+Three great scientific theories of the structure of the universe are
+the molecular, the corpuscular and the atomic. A fourth affirms, with
+Haeckel, the condensation or precipitation of matter from ether --
+whose existence is proved by the condensation or precipitation ... A
+fifth theory is held by idiots, but it is doubtful if they know any
+more about the matter than the others.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Three hours a day will produce as much as a man ought to write.
+ -- Trollope
+%
+Three may keep a secret, if two of them are dead.
+ -- Benjamin Franklin
+%
+Three Midwesterners, a Kansan, a Missourian and an Iowan,
+all appearing on a quiz program, were asked to complete this sentence:
+"Old MacDonald had a . . ."
+
+ "Old MacDonald had a carburetor," answered the Kansan.
+ "Sorry, that's wrong," the game show host said.
+ "Old MacDonald had a free brake alignment down at the
+ service station," said the Missourian.
+ "Wrong."
+ "Old MacDonald had a farm," said the Iowan.
+ "CORRECT!" shouts the quizmaster. "Now for $100,000, spell `farm.'"
+ "Easy," said the Iowan. "E-I-E-I-O."
+%
+Three minutes' thought would suffice to find this out; but thought
+is irksome and three minutes is a long time.
+ -- A. E. Housman
+%
+Three o'clock in the afternoon is always just a little too
+late or a little too early for anything you want to do.
+ -- Jean-Paul Sartre
+%
+Three Rings for the Elven-kings under the sky,
+Seven for the Dwarf-lords in their halls of stone,
+Nine for Mortal Men doomed to die,
+One for the Dark Lord on his dark throne
+In the Land of Mordor where the Shadows lie.
+One Ring to rule them all, One Ring to find them,
+One Ring to bring them all and in the darkness bind them
+In the Land of Mordor where the Shadows lie.
+ -- J. R. R. Tolkien, "The Lord of the Rings"
+%
+Three rules for sounding like an expert:
+ 1. Oversimplify your explanations to the point of uselessness.
+ 2. Always point out second-order effects,
+ but never point out when they can be ignored.
+ 3. Come up with three rules of your own.
+%
+Throw away documentation and manuals,
+and users will be a hundred times happier.
+Throw away privileges and quotas,
+and users will do the Right Thing.
+Throw away proprietary and site licenses,
+and there won't be any pirating.
+
+If these three aren't enough,
+just stay at your home directory
+and let all processes take their course.
+%
+Thus mathematics may be defined as the subject in which we never know
+what we are talking about, nor whether what we are saying is true.
+ -- Bertrand Russell
+%
+Thus spake the master programmer:
+ "A well-written program is its own heaven; a poorly-written program
+ is its own hell."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "After three days without programming, life becomes meaningless."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "Let the programmer be many and the managers few -- then all will
+ be productive."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "Though a program be but three lines long, someday it will have to
+ be maintained."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "Time for you to leave."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "When program is being tested, it is too late to make design changes."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "When you have learned to snatch the error code from
+ the trap frame, it will be time for you to leave."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "Without the wind, the grass does not move. Without software,
+ hardware is useless."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thus spake the master programmer:
+ "You can demonstrate a program for a corporate executive, but you
+ can't make him computer literate."
+ -- Geoffrey James, "The Tao of Programming"
+%
+Thyme's Law:
+ Everything goes wrong at once.
+%
+Ticking away the moments that make up a dull day
+Fritter and waste the hours in an offhand way
+Kicking around on a piece of ground in your hometown
+Waiting for someone or something to show you the way
+
+Tired of lying in the sunshine And then one day you find
+Staying home to watch the rain Ten years have got behind you
+You are young and life is long No one told you when to run
+And there is time to kill today You missed the starting gun
+
+And you run and you run to catch up with the sun but it's sinking
+And racing around to come up behind you again
+The sun is the same in a relative way but you're older
+Shorter of breath and one day closer to death
+
+Every year is getting shorter Hanging on in quiet desperation
+ is the English way
+Never seem to find the time The time is gone, the song is over
+Plans that either come to nought Thought I'd something more to say...
+Or half a page of scribbled lines
+ -- Pink Floyd, "Time"
+%
+Tiddely Quiddely
+Edward M. Kennedy
+Quite unaccountably
+Drove in a stream.
+
+Pleas of amnesia
+Incomprehensible
+Possibly shattered
+Political dream.
+%
+Tiger got to hunt,
+Bird got to fly;
+Man got to sit and wonder, "Why, why, why?"
+
+Tiger got to sleep,
+Bird got to land;
+Man got to tell himself he understand.
+ -- The Books of Bokonon
+%
+Time and tide wait for no man.
+%
+Time as he grows old teaches all things.
+ -- Aeschylus
+%
+Time flies like an arrow, but fruit flies like a banana.
+%
+Time goes, you say?
+Ah no!
+Time stays, *we* go.
+ -- Austin Dobson
+%
+Time is a great teacher, but unfortunately it kills all its pupils.
+ -- Hector Berlioz
+%
+Time is an illusion, lunchtime doubly so.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+Time is an illusion perpetrated by the manufacturers of space.
+%
+Time is but the stream I go a-fishing in.
+ -- Henry David Thoreau
+%
+Time is nature's way of making sure that
+everything doesn't happen at once.
+
+Space is nature's way of making sure that
+everything doesn't happen to you.
+%
+Time is the most valuable thing a man can spend.
+ -- Theophrastus
+%
+Time sharing: The use of many people by the computer.
+%
+Time sure flies when you don't know what you're doing.
+%
+Time to be aggressive. Go after a tattooed Virgo.
+%
+Time to take stock.
+Go home with some office supplies.
+%
+Time washes clean
+Love's wounds unseen.
+That's what someone told me;
+But I don't know what it means.
+ -- Linda Ronstadt, "Long Long Time"
+%
+Time will end all my troubles,
+but I don't always approve of Time's methods.
+%
+Time-sharing is the junk-mail part of the computer business.
+ -- H. R. J. Grosch (attributed)
+%
+Timesharing, n.:
+ An access method whereby one computer abuses many people.
+%
+Timing must be perfect now.
+Two-timing must be better than perfect.
+%
+Tip of the Day:
+ Never fry bacon in the nude.
+%
+Tip O'Neill is just like Congress; old, fat and out of control.
+ -- J. LeBoutillier
+%
+Tip the world over on its side and
+everything loose will land in Los Angeles.
+ -- Frank Lloyd Wright
+%
+TIPS FOR PERFORMERS:
+ Playing cards have the top half upside-down to help cheaters.
+ There are a finite number of jokes in the universe.
+ Singing is a trick to get people to listen to music longer than
+ they would ordinarily.
+ There is no music in space.
+ People will pay to watch people make sounds.
+ Everything on stage should be larger than in real life.
+%
+TIRED of calculating components of vectors? Displacements along direction of
+force getting you down? Well, now there's help. Try amazing "Dot-Product",
+the fast, easy way many professionals have used for years and is now available
+to YOU through this special offer. Three out of five engineering consultants
+recommend "Dot-Product" for their clients who use vector products. Mr.
+Gumbinowitz, mechanical engineer, in a hidden-camera interview...
+ "Dot-Product really works! Calculating Z-axis force components has
+ never been easier."
+Yes, you too can take advantage of the amazing properties of Dot-Product. Use
+it to calculate forces, velocities, displacements, and virtually any vector
+components. How much would you pay for it? But wait, it also calculates the
+work done in Joules, Ergs, and, yes, even BTUs. Divide Dot-Product by the
+magnitude of the vectors and it becomes an instant angle calculator! Now, how
+much would you pay? All this can be yours for the low, low price of $19.95!!
+But that's not all! If you order before midnight, you'll also get "Famous
+Numbers of Famous People" as a bonus gift, absolutely free! Yes, you'll get
+Avogadro's number, Planck's, Euler's, Boltzmann's, and many, many, more!!
+Call 1-800-DOT-6000. Operators are standing by. That number again...
+1-800-DOT-6000. Supplies are limited, so act now. This offer is not
+available through stores and is void where prohibited by law.
+%
+Tis man's perdition to be safe, when for the truth he ought to die.
+%
+'Tis more blessed to give than receive; for example, wedding presents.
+ -- H. L. Mencken
+%
+To a Californian, a person must prove himself criminally insane before he
+is allowed to drive a taxi in New York. For New York cabbies, honesty and
+stopping at red lights are both optional.
+ -- From "East vs. West: The War Between the Coasts"
+%
+To a Californian, all New Yorkers are cold; even in heat they rarely go
+above fifty-eight degrees. If you collapse on a street in New York, plan
+to spend a few days there.
+ -- From "East vs. West: The War Between the Coasts"
+%
+To a Californian, the basic difference between the people and the pigeons
+in New York is that the pigeons don't shit on each other.
+ -- From "East vs. West: The War Between the Coasts"
+%
+To a New Yorker, all Californians are blond, even the blacks. There are,
+in fact, whole neighborhoods that are zoned only for blond people. The
+only way to tell the difference between California and Sweden is that the
+Swedes speak better English.
+ -- From "East vs. West: The War Between the Coasts"
+%
+To a New Yorker, the only California houses on the market for less than
+a million dollars are those on fire. These generally go for six hundred
+thousand.
+ -- From "East vs. West: The War Between the Coasts"
+%
+To accuse others for one's own misfortunes is a sign of want of education.
+To accuse oneself shows that one's education has begun. To accuse neither
+oneself nor others shows that one's education is complete.
+ -- Epictetus
+%
+To add insult to injury.
+ -- Phaedrus
+%
+To announce that there must be no criticism of the president, or that we are
+to stand by the president right or wrong, is not only unpatriotic and
+servile, but is morally treasonable to the American public."
+ -- Theodore Roosevelt
+%
+To any truly impartial person, it would
+be obvious that I am always right.
+%
+To avoid criticism, do nothing, say nothing, be nothing.
+ -- Elbert Hubbard
+%
+To be a kind of moral Unix, he touched the hem of Nature's shift.
+ -- Shelley
+%
+To be beautiful is enough! if a woman can do that well who
+should demand more from her? You don't want a rose to sing.
+ -- Thackeray
+%
+To be considered successful, a woman must be much better at her job
+than a man would have to be. Fortunately, this isn't difficult.
+%
+To be excellent when engaged in administration is to be like the North
+Star. As it remains in its one position, all the other stars surround it.
+ -- Confucius
+%
+To be great is to be misunderstood.
+ -- Ralph Waldo Emerson
+%
+To be happy one must be a) well fed, unhounded by sordid cares, at ease in
+Zion, b) full of a comfortable feeling of superiority to the masses of one's
+fellow men, and c) delicately and unceasingly amused according to one's taste.
+It is my contention that, if this definition be accepted, there is no country
+in the world wherein a man constituted as I am -- a man of my peculiar
+weaknesses, vanities, appetites, and aversions -- can be so happy as he can
+be in the United States. Going further, I lay down the doctrine that it is
+a sheer physical impossibility for such a man to live in the United States
+and not be happy.
+ -- H. L. Mencken, "On Being An American"
+%
+To be intoxicated is to feel sophisticated but not be able to say it.
+%
+To be is to be related.
+ -- C. J. Keyser
+%
+To be is to do.
+ -- I. Kant
+To do is to be.
+ -- A. Sartre
+Do be a Do Bee!
+ -- Miss Connie, Romper Room
+Do be do be do!
+ -- F. Sinatra
+Yabba-Dabba-Doo!
+ -- F. Flintstone
+%
+To be loved is very demoralizing.
+ -- Katharine Hepburn
+%
+To be nobody-but-yourself in a world which is doing its best to,
+night and day, to make you everybody else -- means to fight the hardest
+battle which any human being can fight; and never stop fighting.
+ -- e. e. cummings, "A Miscellany"
+%
+To be or not to be.
+ -- Shakespeare
+To do is to be.
+ -- Nietzsche
+To be is to do.
+ -- Sartre
+Do be do be do.
+ -- Sinatra
+%
+To be or not to be, that is the bottom line.
+%
+To be patriotic, hate all nations but your own; to be religious, all sects
+but your own; to be moral, all pretences but your own.
+ -- Lionel Strachey
+%
+To be responsive at this time, though I will simply say, and therefore
+this is a repeat of what I said previously, that which I am unable to
+offer in response is based on information available to make no such
+statement.
+%
+To be successful, a woman has to be much better at her job than a man.
+ -- Golda Meir
+%
+To be successful, a woman must do her job ten times
+as well as a man. Fortunately, this is not difficult.
+%
+To be sure of hitting the target, shoot first
+and, whatever you hit, call it the target.
+%
+To be trusted is a greater compliment than to be loved.
+%
+To be who one is, is not to be someone else.
+%
+To be wise, the only thing you really need
+to know is when to say "I don't know."
+%
+To believe your own thought, to believe that what is true for
+you in your private heart is true for all men -- that is genius.
+ -- Ralph Waldo Emerson
+%
+To code the impossible code, This is my quest --
+To bring up a virgin machine, To debug that code,
+To pop out of endless recursion, No matter how hopeless,
+To grok what appears on the screen, No matter the load,
+ To write those routines
+To right the unrightable bug, Without question or pause,
+To endlessly twiddle and thrash, To be willing to hack FORTRAN IV
+To mount the unmountable magtape, For a heavenly cause.
+To stop the unstoppable crash! And I know if I'll only be true
+ To this glorious quest,
+And the queue will be better for this, That my code will run CUSPy and calm,
+That one man, scorned and When it's put to the test.
+ destined to lose,
+Still strove with his last allocation
+To scrap the unscrappable kludge!
+ -- To "The Impossible Dream", from Man of La Mancha
+%
+To communicate is the beginning of understanding.
+ -- AT&T
+%
+To converse at the distance of the Indes by means of sympathetic contrivances
+may be as natural to future times as to us is a literary correspondence.
+ -- Joseph Glanvill, 1661
+%
+To craunch a marmoset.
+ -- Pedro Carolino, "English as She is Spoke"
+%
+To create quality software, the ability to say no is usually far
+more important than the ability to say yes.
+ -- Michi Henning
+%
+To criticize the incompetent is easy;
+it is more difficult to criticize the competent.
+%
+To defend the Saigon regime is not worth one more human life.
+ -- Senator Edmund Muskie
+%
+To do nothing is to be nothing.
+%
+To do two things at once is to do neither.
+ -- Publilius Syrus
+%
+To doubt everything or to believe everything are two equally
+convenient solutions; both dispense with the necessity of reflection.
+ -- H. Poincare
+%
+To envision how a 4-processor system running [SunOS] 4.1.x works, think
+of four kids and one bathroom.
+ -- John DiMarco
+%
+To err is human -- but it feels divine.
+ -- Mae West
+%
+To err is human -- to blame it on a computer is even more so.
+%
+To err is human, but I can REALLY foul things up.
+%
+To err is human, but to really foul things up requires a computer.
+%
+To err is human, but when the eraser wears out
+before the pencil, you're overdoing it a little.
+%
+To err is human; to admit it, a blunder.
+%
+To err is human, to forgive, beyond the scope of the Operating System.
+%
+To err is human, to forgive, infrequent.
+%
+To err is human; to forgive is simply not our policy.
+ -- MIT Assassination Club
+%
+To err is human, to repent, divine, to persist, devilish.
+ -- Benjamin Franklin
+%
+To err is human, two curs canine.
+To err is human, to moo bovine.
+%
+To err is human.
+To blame someone else for your mistakes is even more human.
+%
+To err is human,
+To purr feline.
+ -- Robert Byrne
+%
+To err is humor.
+%
+To every Ph.D. there is an equal and opposite Ph.D.
+ -- B. Duggan
+%
+To everything there is a season, a time for every purpose under heaven:
+A time to be born, and a time to die;
+A time to plant, and a time to pluck what is planted;
+A time to kill, and a time to heal;
+A time to break down, and a time to build up;
+A time to weep, and a time to laugh;
+A time to mourn, and a time to dance;
+A time to cast away stones, and a time to gather stones;
+A time to embrace, and a time to refrain from embracing;
+A time to gain, and a time to lose;
+A time to keep, and a time to throw away;
+A time to tear, and a time to sew;
+A time to keep silence, and a time to speak;
+A time to love, and a time to hate;
+A time of war, and a time of peace.
+ Ecclesiastes 3:1-9
+%
+To fear love is to fear life, and those
+who fear life are already three parts dead.
+ -- Bertrand Russell
+%
+To find a friend one must close one eye; to keep him -- two.
+ -- Norman Douglas
+%
+To find out a girl's faults, praise her to her girl friends.
+ -- Benjamin Franklin
+%
+To generalize is to be an idiot.
+ -- William Blake
+%
+To get back on your feet, miss two car payments.
+%
+To get something clean, one has to get something dirty.
+To get something dirty, one does not have to get anything clean.
+%
+To get something done, a committee should consist of no more than three
+persons, two of them absent.
+%
+To give happiness is to deserve happiness.
+%
+To give of yourself, you must first know yourself.
+%
+To have died once is enough.
+ -- Publius Vergilius Maro (Virgil)
+%
+To hell with the Prime Directive;
+Let's _K_I_L_L something!
+%
+To invent, you need a good imagination and a pile of junk.
+ -- Thomas Edison
+%
+To iterate is human, to recurse, divine.
+ -- Robert Heller
+%
+To jaw-jaw is better than to war-war.
+ -- Winston Churchill, on Korean War negotiations
+%
+To keep your friends treat them kindly;
+to kill them, treat them often.
+%
+To know Edina is to reject it.
+ -- Dudley Riggs, "The Year the Grinch Stole the Election"
+%
+To laugh at men of sense is the privilege of fools.
+%
+To lead people, you must follow behind.
+ -- Lao Tsu
+%
+To listen to some devout people,
+one would imagine that God never laughs.
+ -- Sri Aurobindo
+%
+To love is good, love being difficult.
+%
+To make an enemy, do someone a favor.
+%
+To make tax forms true they should
+read "Income Owed Us" and "Incommode You".
+%
+To many, total abstinence is easier than perfect moderation.
+ -- St. Augustine
+%
+TO ME, CLOWNS AREN'T FUNNY. In fact, they're kinda scary. I've wondered
+where this started, and I think it goes back to the time I went to the
+circus and a clown killed my dad.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+To one large turkey add one gallon of vermouth and a demijohn of Angostura
+bitters. Shake.
+ -- F. Scott Fitzgerald, recipe for turkey cocktail
+%
+To our sweethearts and wives. May they never meet.
+ -- 19th century toast
+%
+To refuse praise is to seek praise twice.
+%
+To restore a sense of reality, I think
+Walt Disney should have a Hardluckland.
+ -- Jack Paar
+%
+To save a single life is better than to build a seven story pagoda.
+%
+To say that UNIX is doomed is pretty rabid, OS/2 will certainly play a role,
+but you don't build a hundred million instructions per second multiprocessor
+micro and then try to run it on OS/2. I mean, get serious.
+ -- William Zachmann, International Data Corp
+%
+To say you got a vote of confidence
+would be to say you needed a vote of confidence.
+ -- Andrew Young
+%
+To see a need and wait to be asked, is to already refuse.
+%
+To see the butcher slap the steak, before he laid it on the block,
+and give his knife a sharpening, was to forget breakfast instantly. It was
+agreeable, too -it really was- to see him cut it off, so smooth and juicy.
+There was nothing savage in the act, although the knife was large and keen;
+it was a piece of art, high art; there was delicacy of touch, clearness of
+tone, skillful handling of the subject, fine shading. It was the triumph of
+mind over matter; quite.
+ -- Charles Dickens, "Martin Chuzzlewit"
+%
+To see you is to sympathize.
+%
+To spot the expert, pick the one who predicts
+the job will take the longest and cost the most.
+%
+To stand and be still,
+At the Birkenhead drill,
+Is a damned tough bullet to chew.
+ -- Rudyard Kipling
+%
+To stay young requires unceasing cultivation
+of the ability to unlearn old falsehoods.
+ -- Lazarus Long, "Time Enough For Love"
+%
+To stay youthful, stay useful.
+%
+To teach is to learn.
+%
+To teach is to learn twice.
+ -- Joseph Joubert
+%
+To the best of my recollection, Senator, I can't recall.
+%
+To the landlord belongs the doorknobs.
+%
+To the systems programmer, users and applications serve only to provide
+a test load.
+%
+To Theodore Roosevelt:
+ You are like the Wind and I like the Lion. You form the Tempest.
+The sand stings my eyes and the Ground is parched. I roar in defiance but
+you do not hear. But between us there is a difference. I, like the lion,
+must remain in my place. While you, like the wind, will never know yours.
+ Mulay Hamid El Raisuli
+ Lord of the Riff
+ Sultan to the Berbers
+ Last of the Barbary Pirates
+%
+To thine own self be true.
+(If not that, at least make some money.)
+%
+To think contrary to one's era is heroism. But to speak against it is
+madness.
+ -- Eugene Ionesco
+%
+To those accustomed to the precise, structured methods of conventional
+system development, exploratory development techniques may seem messy,
+inelegant, and unsatisfying. But it's a question of congruence:
+precision and flexibility may be just as disfunctional in novel,
+uncertain situations as sloppiness and vacillation are in familiar,
+well-defined ones. Those who admire the massive, rigid bone structures
+of dinosaurs should remember that jellyfish still enjoy their very
+secure ecological niche.
+ -- Beau Sheil, "Power Tools for Programmers"
+%
+TO THOSE OF YOU WHO DESIRE IT, I GRANT YOU MADRAK'S BLESSING:
+
+ Insofar as I may be heard by anything, which may or may not care
+what I say, I ask, if it matters, that you be forgiven for anything you
+may have done or failed to do which requires forgiveness.
+ Conversely, if not forgiveness but something else be required
+to insure any possible benefit for which you may be eligible after the
+destruction of your body, I ask that this, whatever it may be, be granted
+or withheld, as the case may be, in such a manner as to insure your
+receiving said benefit.
+ I ask this in my capacity as your elected intermediary between
+yourself and that which may have an interest in the matter of your receiving
+as much as it is possible for you to receive of this thing, and which may
+in some way be influenced by this ceremony.
+ Amen.
+ -- Roger Zelazny, "Creatures of Light and Darkness", 1969
+%
+To understand a program you must become both the machine and the program.
+%
+To understand the heart and mind of a person, look not at what
+he has already achieved, but at what he aspires to do.
+%
+To understand this important story, you have to understand how the
+telephone company works. Your telephone is connected to a local
+computer, which is in turn connected to a regional computer, which is
+in turn connected to a loudspeaker the size of a garbage truck on the
+lawn of Edna A. Bargewater of Lawrence, Kan.
+
+Whenever you talk on the phone, your local computer listens in. If it
+suspects you're going to discuss an intimate topic, it notifies the
+computer above it, which listens in and decides whether to alert the
+one above it, until finally, if you really humiliate yourself, maybe
+break down in tears and tell your closest friend about a sordid
+incident from your past involving a seedy motel, a neighbor's spouse,
+an entire religious order, a garden hose and six quarts of tapioca
+pudding, the top computer feeds your conversation into Edna's
+loudspeaker, and she and her friends come out on the porch to listen
+and drink gin and laugh themselves silly.
+ -- Dave Barry, "Won't It Be Just Great Owning Our Own
+ Phones?"
+%
+To use violence is to already be defeated.
+ -- Chinese proverb
+%
+To vacillate or not to vacillate, that is the question ... or is it?
+%
+To whom the mornings are like nights,
+What must the midnights be!
+ -- Emily Dickinson (on hacking?)
+%
+To write a sonnet you must ruthlessly
+strip down your words to naked, willing flesh.
+Then bind them to a metaphor or three,
+and take by force a satisfying mesh.
+Arrange them to your will, each foot in place.
+You are the master here, and they the slaves.
+Now whip them to maintain a constant pace
+and rhythm as they stand in even staves.
+A word that strikes no pleasure? Cast it out!
+What use are words that drive not to the heart?
+A lazy phrase? Discard it, shrug off doubt,
+and choose more docile words to take its part.
+A well-trained sonnet lives to entertain,
+by making love directly to the brain.
+%
+To you I'm an atheist; to God, I'm the loyal opposition.
+ -- Woody Allen
+%
+Tobacco is a filthy weed,
+That from the devil does proceed;
+It drains your purse, it burns your clothes,
+And makes a chimney of your nose.
+ -- B. Waterhouse
+%
+TODAY:
+ A nice place to visit, but you can't stay here for long.
+%
+Today is a good day for information-gathering.
+Read someone else's mail file.
+%
+Today is a good day to bribe a high-ranking public official.
+%
+Today is National Existential Ennui Awareness Day.
+%
+Today is the first day of the rest of the mess.
+%
+Today is the first day of the rest of your life.
+%
+Today is the first day of the rest of your lossage.
+%
+Today is the last day of your life so far.
+%
+Today is the tomorrow you worried about yesterday.
+%
+Today is what happened to yesterday.
+%
+Today, of course, it is considered very poor taste to use the F-word
+except in major motion pictures.
+ -- Dave Barry, "$#$%#^%!^%&@%@!"
+%
+Today when a man gets married he gets a home, a housekeeper, a cook, a
+cheering squad and another paycheck. When a woman marries, she gets a
+boarder.
+%
+Today you'll start getting heavy metal radio on your dentures.
+%
+Today's scientific question is: What in the world is electricity?
+
+And where does it go after it leaves the toaster?
+ -- Dave Barry, "What is Electricity?"
+%
+Today's thrilling story has been brought to you by Mushies, the great new
+cereal that gets soggy even without milk or cream. Join us soon for more
+spectacular adventure starring... Tippy, the Wonder Dog!
+ -- Bob & Ray
+%
+Today's weirdness is tomorrow's reason why.
+ -- Hunter S. Thompson
+%
+Toddlers are the stormtroopers of the Lord of Entropy.
+%
+Toilet Toupee, n.:
+ Any shag carpet that causes the lid to become top-heavy, thus
+ creating endless annoyance to male users.
+ -- Rich Hall, "Sniglets"
+%
+Tom Hayden is the kind of politician who gives opportunism a bad name.
+ -- Gore Vidal
+%
+Tomorrow, this will be part of the unchangeable past
+but fortunately, it can still be changed today.
+%
+Tomorrow will be canceled due to lack of interest.
+%
+Tomorrow, you can be anywhere.
+%
+Tomorrow's computers some time next month.
+ -- DEC
+%
+Tom's hungry, time to eat lunch.
+%
+Tonight you will pay the wages of sin;
+Don't forget to leave a tip.
+%
+Tonight's the night: Sleep in a eucalyptus tree.
+%
+Toni's Solution to a Guilt-Free Life:
+ If you have to lie to someone, it's their fault.
+%
+Too bad all the people who know how to run the country are busy
+driving cabs and cutting hair.
+ -- George Burns
+%
+TOO BAD YOU CAN'T BUY a voodoo globe so that you could make the earth spin
+real fast and freak everybody out.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Too clever is dumb.
+ -- Ogden Nash
+%
+Too cool to calypso,
+Too tough to tango,
+Too weird to watusi
+ -- The Only Ones
+%
+Too Late
+ A large number of turkies [sic] went to San Francisco yesterday by
+the two o'clock boats. If their object in going down was to participate in
+the Thanksgiving festivities of that city, they would arrive "the day after
+the affair," and of course be sadly disappointed thereby.
+ -- Sacramento Daily Union, November 29, 1861
+%
+Too many of his [Mozart's] works sound like interoffice memos.
+ -- Glenn Gould
+%
+Too many people are thinking of security instead of opportunity.
+They seem more afraid of life than death.
+ -- James F. Byrnes
+%
+Too much is just enough.
+ -- Mark Twain, on whiskey
+%
+Too much is not enough.
+%
+Too much of a good thing is WONDERFUL.
+ -- Mae West
+%
+Too much of everything is just enough.
+ -- Bob Wier
+%
+Too often I find that the volume of paper expands to fill the available
+briefcases.
+ -- Governor Jerry Brown
+%
+Too often people have come to me and said, "If I had just one wish for
+anything in all the world, I would wish for more user-defined equations
+in the HP-51820A Waveform Generator Software."
+ -- Instrument News
+ [Once is too often. Ed.]
+%
+Too ripped. Gotta go.
+%
+Toothpaste never hurts the taste of good scotch.
+%
+Top 10 things likely to be overheard if you had a Klingon Programmer:
+
+10) Specifications are for the weak and timid!
+ 9) You question the worthiness of my code? I should kill you where you stand!
+ 8) Indentation?! - I will show you how to indent when I indent your skull!
+ 7) What is this talk of 'release'? Klingons do not make software 'releases'.
+ Our software 'escapes' leaving a bloody trail of designers and quality
+ assurance people in its wake.
+ 6) Klingon function calls do not have 'parameters' - they have 'arguments'
+ - and they ALWAYS WIN THEM.
+ 5) Debugging? Klingons do not debug. Our software does not coddle the weak.
+ 4) A TRUE Klingon Warrior does not comment his code!
+ 3) Klingon software does NOT have BUGS. It has FEATURES, and those features
+ are too sophisticated for a Romulan pig like you to understand.
+ 2) You cannot truly appreciate Dilbert unless you've read it in the
+ original Klingon.
+ 1) Our users will know fear and cower before our software! Ship it! Ship
+ it and let them flee like the dogs they are!
+%
+Top scientists agree that with the present rate of consumption, the
+earth's supply of gravity will be exhausted before the 24th century.
+As man struggles to discover cheaper alternatives, we need your help.
+Please...
+
+ CONSERVE GRAVITY
+
+Follow these simple suggestions:
+
+(1) Walk with a light step. Carry helium balloons if possible.
+(2) Use tape, magnets, or glue instead of paperweights.
+(3) Give up skiing and skydiving for more horizontal sports like
+ curling.
+(4) Avoid showers ... take baths instead.
+(5) Don't hang all your clothes in the closet ... Keep them in one big
+ pile.
+(6) Stop flipping pancakes
+%
+Top Ten Things Overheard At The ANSI C Draft Committee Meetings:
+
+10: Sorry, but that's too useful.
+ 9: Dammit, little-endian systems *are* more consistent!
+ 8: I'm on the committee and I *still* don't know what the hell
+ #pragma is for.
+ 7: Well, it's an excellent idea, but it would make the compilers too
+ hard to write.
+ 6: Them bats is smart; they use radar.
+ 5: All right, who's the wiseguy who stuck this trigraph stuff in here?
+ 4: How many times do we have to tell you, "No prior art!"
+ 3: Ha, ha, I can't believe they're actually going to adopt this sucker.
+ 2: Thank you for your generous donation, Mr. Wirth.
+ 1: Gee, I wish we hadn't backed down on "noalias".
+%
+Topologists are just plane folks.
+ Pilots are just plane folks.
+ Carpenters are just plane folks.
+ Midwest farmers are just plain folks.
+ Musicians are just playin' folks.
+ Whodunit readers are just Spillaine folks.
+Some Londoners are just P. Lane folks.
+%
+Torque is cheap.
+%
+Total strangers need love, too; and I'm stranger than most.
+%
+TOTD (T-shirt Of The Day):
+ I'm the person your mother warned you about.
+%
+Toto, I have a feeling we're not in Kansas anymore.
+ -- Judy Garland as Dorothy Gale, "The Wizard of Oz"
+%
+Tourists -- have some fun with New York's hard-boiled cabbies. When you
+get to your destination, say to your driver, "Pay? I was hitch-hiking."
+ -- David Letterman
+%
+Tout choses sont dites deja, mais comme
+personne n'ecoute, il faut toujours recommencer.
+ -- A. Gide
+%
+Traffic signals in New York are just rough guidelines.
+ -- David Letterman
+%
+TRANSACTION CANCELED - FARECARD RETURNED
+%
+TRANSFER:
+ A promotion you receive on the condition that you leave town.
+%
+TRANSPARENT:
+ Being or pertaining to an existing, nontangible object.
+ "It's there, but you can't see it"
+ -- IBM System/360 announcement, 1964
+
+VIRTUAL:
+ Being or pertaining to a tangible, nonexistent object.
+ "I can see it, but it's not there."
+ -- Lady Macbeth
+%
+TRANSVESTITE:
+ Someone who spends his junior year at college abroad.
+%
+Trap full -- please empty.
+%
+TRAVEL:
+ Something that makes you feel like you're getting somewhere.
+%
+Travel important today; Internal Revenue men arrive tomorrow.
+%
+Traveling through hyperspace isn't like dusting crops, boy.
+ -- Han Solo
+%
+Traveling through New England, a motorist stopped for gas in a tiny village.
+"What's this place called?" he asked the station attendant.
+ "All depends," the native drawled. "Do you mean by them that has
+to live in this dad-blamed, moth-eaten, dust-covered, one-hoss dump, or
+by them that's merely enjoying its quaint and picturesque rustic charms
+for a short spell?"
+%
+Treat your friend as if he might become an enemy.
+ -- Publilius Syrus
+%
+Treaties are like roses and young girls -- they last while they last.
+ -- Charles DeGaulle
+%
+Trifles make perfection, and perfection is no trifle.
+ -- Michelangelo
+%
+Troglodytism does not necessarily imply a low cultural level.
+%
+Trouble always comes at the wrong time.
+%
+Trouble strikes in series of threes, but when working around the house the
+next job after a series of three is not the fourth job -- it's the start of
+a brand new series of three.
+%
+Troubled day for virgins over 16 who are beautiful, wealthy, and live
+in eucalyptus trees.
+%
+Troubles are like babies; they only grow by nursing.
+%
+True happiness will be found only in true love.
+%
+True leadership is the art of changing
+a group from what it is to what it ought to be.
+ -- Virginia Allan
+%
+True to our past we work with an inherited, observed, and accepted vision of
+personal futility, and of the beauty of the world.
+ -- David Mamet
+%
+Truly great madness can not be achieved without significant intelligence.
+ -- Henrik Tikkanen
+%
+Truly simple systems... require infinite testing.
+ -- Norman Augustine
+%
+Trust everybody, but cut the cards.
+ -- Finley Peter Dunne, "Mr. Dooley's Philosophy"
+%
+Trust in Allah, but tie your camel.
+ -- Arabian proverb
+%
+TRUST ME:
+ Get me, give me, buy me, do me.
+%
+TRUST ME:
+ Translation of the Latin "caveat emptor."
+%
+Trust your husband, adore your husband,
+and get as much as you can in your own name.
+ -- Joan Rivers
+%
+Truth can wait; he's used to it.
+%
+Truth has no special time of its own. Its hour is now -- always.
+ -- Albert Schweitzer
+%
+Truth is free, but information costs.
+%
+Truth is hard to find and harder to obscure.
+%
+Truth is stranger than fiction, because fiction has to make sense.
+%
+Truth is the most valuable thing we have -- so let us economize it.
+ -- Mark Twain
+%
+Truth never comes into the world but like a bastard, to the ignominy
+of him that brought her birth.
+ -- Milton
+%
+Truth will be out this morning. (Which may really mess things up.)
+%
+Truthful, adj.:
+ Dumb and illiterate.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+try again
+%
+Try not to have a good time ...
+This is supposed to be educational.
+ -- Charles Schulz
+%
+Try not.
+Do.
+Or do not.
+There is no try.
+%
+Try `stty 0' -- it works much better.
+%
+Try the Moo Shu Pork. It is especially good today.
+%
+Try to be the best of whatever you are, even if what you are is no good.
+%
+Try to divide your time evenly to keep others happy.
+%
+Try to find the real tense of the report you are reading: Was it done, is
+it being done, or is something to be done? Reports are now written in four
+tenses: past tense, present tense, future tense, and pretense. Watch for
+novel uses of CONGRAM (CONtractor GRAMmer), defined by the imperfect past,
+the insufficient present, and the absolutely perfect future.
+ -- Amrom Katz
+%
+Try to get all of your posthumous medals in advance.
+%
+Try to have as good a life as you can under the circumstances.
+%
+Try to relax and enjoy the crisis.
+ -- Ashleigh Brilliant
+%
+Try to value useful qualities in one who loves you.
+%
+Trying to be happy is like trying to build a machine for which the only
+specification is that it should run noiselessly.
+%
+Trying to define yourself is like trying to bite your own teeth.
+ -- Alan Watts
+%
+Trying to establish voice contact ... please _y_e_l_l into keyboard.
+%
+Trying to get an education here is like
+trying to take a drink from a fire hose.
+%
+T-shirt:
+ Life is *not* a Cabaret, and stop calling me chum!
+%
+Tuesday After Lunch is the cosmic time of the week.
+%
+Tuesday is the Wednesday of the rest of your life.
+%
+Turn on, tune in, and take over.
+ -- Tim Leary
+%
+Turn the other cheek.
+ -- Jesus Christ
+%
+Turnaucka's Law:
+ The attention span of a computer is only as long as its
+ electrical cord.
+%
+Tussman's Law:
+ Nothing is as inevitable as a mistake whose time has come.
+%
+TV is chewing gum for the eyes.
+ -- Frank Lloyd Wright
+%
+'Twas a woman who drove me to drink,
+and I never even had the decency to thank her.
+ -- R. B. Gossling
+%
+"Twas bergen and the eirie road
+Did mahwah into patterson: "Beware the Hopatcong, my son!
+All jersey were the ocean groves, The teeth that bite, the nails
+And the red bank bayonne. that claw!
+ Beware the bound brook bird, and shun
+He took his belmar blade in hand: The kearney communipaw."
+Long time the folsom foe he sought
+Till rested he by a bayway tree And, as in nutley thought he stood,
+And stood a while in thought. The Hopatcong with eyes of flame,
+ Came whippany through the englewood,
+One, two, one, two, and through And garfield as it came.
+ and through
+The belmar blade went hackensack! "And hast thou slain the Hopatcong?
+He left it dead and with it's head Come to my arms, my perth amboy!
+He went weehawken back. Hohokus day! Soho! Rahway!"
+ He caldwell in his joy.
+Did mahwah into patterson:
+All jersey were the ocean groves,
+And the red bank bayonne.
+ -- Paul Kieffer
+%
+'Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe. "Beware the Jabberwock, my son!
+All mimsy were the borogroves The jaws that bite, the claws
+And the mome raths outgrabe. that catch!
+ Beware the Jubjub bird,
+He took his vorpal sword in hand And shun the frumious Bandersnatch!"
+Long time the manxome foe he sought.
+So rested he by the tumtum tree And as in uffish thought he stood
+And stood awhile in thought. The Jabberwock, with eyes aflame
+ Came whuffling through the tulgey wood
+One! Two! One! Two! And through and And burbled as it came!
+ through
+The vorpal blade went snicker-snack. "Hast thou slain the Jabberwock?
+He left it dead, and took its head, Come to my arms, my beamish boy!
+And went galumphing back. Oh frabjous day! Calooh! Callay!"
+ He chortled in his joy.
+'Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe.
+All mimsy were the borogroves
+And the mome raths outgrabe.
+ -- Lewis Carroll, "Jabberwocky"
+%
+'Twas bullig, and the slithy brokers
+Did buy and gamble in the craze "Beware the Jabberstock, my son!
+All rosy were the Dow Jones stokers The cost that bites, the worth
+By market's wrath unphased. that falls!
+ Beware the Econ'mist's word, and shun
+He took his forecast sword in hand: The spurious Street o' Walls!"
+Long time the Boesk'some foe he sought -
+Sake's liquidity, so d'vested he, And as in bearish thought he stood
+And stood awhile in thought. The Jabberstock, with clothes of tweed,
+ Came waffling with the truth too good,
+Chip Black! Chip Blue! And through And yuppied great with greed!
+ and through
+The forecast blade went snicker-snack! "And hast thou slain the Jabberstock?
+It bit the dirt, and with its shirt, Come to my firm, V.P.ish boy!
+He went rebounding back. O big bucks day! Moolah! Good Play!"
+ He bought him a Mercedes Toy.
+'Twas panic, and the slithy brokers
+Did gyre and tumble in the Crash
+All flimsy were the Dow Jones stokers
+And mammon's wrath them bash!
+ -- Peter Stucki, "Jabberstocky"
+%
+'Twas midnight, and the UNIX hacks
+Did gyre and gimble in their cave
+All mimsy was the CS-VAX
+And Cory raths outgrabe.
+
+"Beware the software rot, my son!
+The faults that bite, the jobs that thrash!
+Beware the broken pipe, and shun
+The frumious system crash!"
+%
+'Twas midnight on the ocean, Her children all were orphans,
+Not a streetcar was in sight, Except one a tiny tot,
+So I stepped into a cigar store Who had a home across the way
+To ask them for a light. Above a vacant lot.
+
+The man behind the counter As I gazed through the oaken door
+Was a woman, old and gray, A whale went drifting by,
+Who used to peddle doughnuts Its six legs hanging in the air,
+On the road to Mandalay. So I kissed her goodbye.
+
+She said "Good morning, stranger", This story has a morale
+Her eyes were dry with tears, As you can plainly see,
+As she put her head between her feet Don't mix your gin with whiskey
+And stood that way for years. On the deep and dark blue sea.
+ -- Midnight On The Ocean
+%
+'Twas the night before Christmas -- the very last one --
+When the blazing of lasers destroyed all our fun.
+Just as Santa had lifted off, driving his sleigh,
+A satellite spotted him making his way.
+The Star Wars Defense System -- Reagan's desire
+Was ready for action, and started to fire!
+The laser beams criss-crossed and lit up the sky
+Like a fireworks show on the Fourth of July.
+I'd just finished wrapping the last of the toys
+When out of my chimney there came a great noise.
+I looked to the fireplace, hoping to see
+St. Nick bringing presents for missus and me.
+But what I saw next was disturbing and shocking:
+A flaming red jacket setting fire to my stocking!
+Charred reindeer remains and a melted sleigh-bell;
+Outside burning toys like confetti they fell.
+So now you know, children, why Christmas is gone:
+The Star Wars computer had got something wrong.
+Only programmed for battle, it hadn't a heart;
+'Twas hardly a chance it would work from the start.
+It couldn't be tested, and no one could tell,
+If the crazy contraption would work very well.
+So after a trillion or two had been spent
+The system thought Santa a Red missile sent.
+So kids dry your tears now, and get off to bed,
+There won't be a Christmas -- since Santa is dead.
+%
+'Twas the nocturnal segment of the diurnal period
+ preceding the annual Yuletide celebration, And
+ throughout our place of residence,
+Kinetic activity was not in evidence among the
+ possessors of this potential, including that
+ species of domestic rodent known as Mus musculus.
+Hosiery was meticulously suspended from the forward
+ edge of the woodburning caloric apparatus,
+Pursuant to our anticipatory pleasure regarding an
+ imminent visitation from an eccentric
+ philanthropist among whose folkloric appelations
+ is the honorific title of St. Nicklaus ...
+%
+Twenty Percent of Zero is Better than Nothing.
+ -- Walt Kelly
+%
+Twenty two thousand days.
+Twenty two thousand days.
+It's not a lot.
+It's all you've got.
+Twenty two thousand days.
+ -- Moody Blues, "Twenty Two Thousand Days"
+%
+Two battleships assigned to the training squadron had been at sea on maneuvers
+in heavy weather for several days. I was serving on the lead battleship and
+was on watch on the bridge as night fell. The visibility was poor with patchy
+fog, so the Captain remained on the bridge keeping an eye on all activities.
+ Shortly after dark, the lookout on the wing of the bridge reported,
+"Light, bearing on the starboard bow."
+ "Is it steady or moving astern?" the Captain called out.
+ Lookout replied, "Steady, Captain," which meant we were on a dangerous
+collision course with that ship.
+ The Captain then called to the signalman, "Signal that ship: We are on
+a collision course, advise you change course 20 degrees."
+ Back came a signal "Advisable for you to change course 20 degrees."
+ In reply, the Captain said, "Send: I'm a Captain, change course 20
+degrees!"
+ "I'm a seaman second class," came the reply, "You had better change
+course 20 degrees."
+ By that time, the Captain was furious. He spit out, "Send: I'm a
+battleship, change course 20 degrees."
+ Back came the flashing light: "I'm a lighthouse!"
+ We changed course.
+ -- The Naval Institute's "Proceedings"
+%
+Two can Live as Cheaply as One for Half as Long.
+ -- Howard Kandel
+%
+Two cars in every pot and a chicken in every garage.
+%
+Two Finns and a penguin are sitting on the front porch of a large house. The
+penguin is dripping in sweat; his owner looks down and says to the other Finn,
+"Hey Urho, I want that you should take the penguin to the zoo, okay?" The
+owner then runs off to the sauna. When he gets out of the sauna, he looks
+up at the porch, and sure enough, there is Urho and the penguin, sweating
+away. So he yells out "Hey, Urho, I thought I told you to take the penguin to
+the zoo, I did." And Urho yells back "Yup, and tomorrow we're going to
+the movies!"
+%
+Two friends were out drinking when suddenly one lurched backward off his
+barstool and lay motionless on the floor.
+ "One thing about Jim," the other said to the bartender, "he sure
+knows when to stop."
+%
+Two heads are better than one.
+ -- John Heywood
+%
+Two heads are more numerous than one.
+%
+Two hundred years ago today, Irma Chine of White Plains, New York, was
+performing her normal housekeeping routines. She was interrupted by
+British soldiers who, rallying to the call of their supervisor, General
+Hughes, sought to gain control of the voter registration lists kept in
+her home. Masking her fear and thinking fast, Mrs. Chine quickly divided
+a nearby apple in two and deftly stored the list in its center. Upon
+entering, the British blatantly violated every conceivable convention,
+and, though they went through the house virtually bit by bit, their
+search was fruitless. They had to return empty handed. Word of the
+incident propagated rapidly through the region. This historic event
+became the first documented use of core storage for the saving of registers.
+%
+Two is company, three is an orgy.
+%
+Two is not equal to three, even for large values of two.
+%
+Two men are in a hot-air balloon. Soon, they find themselves lost in a
+canyon somewhere. One of the three men says, "I've got an idea. We can
+call for help in this canyon and the echo will carry our voices to the
+end of the canyon. Someone's bound to hear us by then!"
+ So he leans over the basket and screams out, "Helllloooooo! Where
+are we?" (They hear the echo several times).
+ Fifteen minutes later, they hear this echoing voice: "Helllloooooo!
+You're lost!"
+ The shouter comments, "That must have been a mathematician."
+ Puzzled, his friend asks, "Why do you say that?"
+ "For three reasons. First, he took a long time to answer, second,
+he was absolutely correct, and, third, his answer was absolutely useless."
+%
+Two men came before Nasrudin when he was magistrate. The first man said,
+"This man has bitten my ear -- I demand compensation." The second man said,
+"He bit it himself." Nasrudin withdrew to his chambers, and spent an hour
+trying to bite his own ear. He succeeded only in falling over and bruising
+his forehead. Returning to the courtroom, Nasrudin pronounced, "Examine
+the man whose ear was bitten. If his forehead is bruised, he did it himself
+and the case is dismissed. If his forehead is not bruised, the other man
+did it and must pay three silver pieces."
+%
+Two men look out through the same bars; one sees mud, and one the stars.
+%
+Two men were sitting over coffee, contemplating the nature of things,
+with all due respect for their breakfast. "I wonder why it is that
+toast always falls on the buttered side," said one.
+ "Tell me," replied his friend, "why you say such a thing. Look
+at this." And he dropped his toast on the floor, where it landed on the
+dry side.
+ "So, what have you to say for your theory now?"
+ "What am I to say? You obviously buttered the wrong side."
+%
+Two peanuts were walking through the New York. One was assaulted.
+%
+Two percent of zero is almost nothing.
+%
+Two rights don't make a wrong, they make an airplane.
+%
+Two Russian friends happen to meet in Red Square. One of them says, "By
+the way, did you hear that Romanov died?"
+ "No," replied the other, "I didn't even know he'd been arrested!"
+%
+Two sure ways to tell a REALLY sexy man; the first is, he has a bad memory.
+I forget the second.
+%
+Two Swedish guys get of a ship and head for the nearest bars. Each one
+orders two vodkas and immediately downs them. They they order two more
+and once again quickly throw them back. They then order two more. When
+they arrive, one of them picks up his glass, and, turning to the other,
+toasts him, "Skoal!"
+ The other turns to the first man and scolds, "Hey! Did you come
+here to screw around, or did you come here to drink?"
+%
+Two wrongs are only the beginning.
+ -- Kohn
+%
+Two wrongs don't make a right, but they make a good excuse.
+ -- Thomas Szasz
+%
+Two wrongs don't make a right, but three lefts do.
+%
+Tyger, Tyger, burning bright Where the hammer? Where the chain?
+In the forests of the night, In what furnace was thy brain?
+What immortal hand or eye What the anvil? What dread grasp
+Dare frame thy fearful symmetry? Dare its deadly terrors clasp?
+
+Burnt in distant deeps or skies When the stars threw down their spears
+The cruel fire of thine eyes? And water'd heaven with their tears
+On what wings dare he aspire? Dare he laugh his work to see?
+What the hand dare seize the fire? Dare he who made the lamb make thee?
+
+And what shoulder & what art Tyger, Tyger, burning bright
+Could twist the sinews of they heart? In the forests of the night,
+And when thy heart began to beat What immortal hand or eye
+What dread hand & what dread feet Dare frame thy fearful symmetry?
+
+Could fetch it from the furnace deep
+And in thy horrid ribs dare steep
+In the well of sanguine woe?
+In what clay & in what mould
+Were thy eyes of fury roll'd?
+ -- William Blake, "The Tyger"
+%
+Type louder, please.
+%
+U: There's a U -- a Unicorn!
+ Run right up and rub its horn.
+ Look at all those points you're losing!
+ UMBER HULKS are so confusing.
+ -- The Roguelet's ABC
+%
+Ubi non accusator, ibi non judex.
+(Where there is no police, there is no speed limit.)
+ -- Roman Law, trans. Petr Beckmann (1971)
+%
+Udall's Fourth Law:
+ Any change or reform you make
+ is going to have consequences you don't like.
+%
+UFO's are for real: the Air Force doesn't exist.
+%
+Uh-oh -- I've let the cat out of the bag. Let me, then,
+straightforwardly state the thesis I shall now elaborate:
+Making variations on a theme is really the crux of creativity.
+ -- Douglas R. Hofstadter, "Metamagical Themas"
+%
+Ummm, well, OK. The network's the network, the computer's the computer.
+Sorry for the confusion.
+ -- Sun Microsystems
+%
+Unbearably lovely music is heard as the curtain rises, and we see the
+woods on a summer afternoon. A fawn dances on and nibbles at some
+leaves. He drifts lazily through the soft foliage. Soon he starts
+coughing and drops dead.
+ -- Woody Allen, "Without Feathers"
+%
+Uncle Ed's Rule of Thumb:
+ Never use your thumb for a rule.
+ You'll either hit it with a hammer or get a splinter in it.
+%
+Under a government which imprisons any unjustly, the true place for a
+just man is also in prison.
+ -- Henry David Thoreau
+%
+Under any conditions, anywhere, whatever you are doing, there is some
+ordinance under which you can be booked.
+ -- Robert D. Sprecht, Rand Corp.
+%
+Under deadline pressure for the next week.
+If you want something, it can wait.
+Unless it's blind screaming paroxysmally hedonistic...
+%
+Under every stone lurks a politician.
+ -- Aristophanes
+%
+Under the wide and heavy VAX
+Dig my grave and let me relax
+Long have I lived, and many my hacks
+And I lay me down with a will.
+These be the words that tell the way:
+"Here he lies who piped 64K,
+Brought down the machine for nearly a day,
+And Rogue playing to an awful standstill."
+%
+Under the wide and starry sky,
+Dig my grave and let me lie,
+Glad did I live and gladly die,
+And laid me down with a will,
+And this be the verse that you grave for me,
+Here he lies where he longed to be,
+Home is the sailor home from the sea,
+And the hunter home from the hill.
+ -- R. Kipling
+%
+Underlying Principle of Socio-Genetics:
+ Superiority is recessive.
+%
+Understand, v.:
+ To reach a point, in your investigation of some subject, at which
+ you cease to examine what is really present, and operate on the
+ basis of your own internal model instead.
+%
+Understanding is always the understanding of a smaller problem
+in relation to a bigger problem.
+ -- P. D. Ouspensky
+%
+UNFAIR COMPETITION:
+ Selling cheaper than we do.
+%
+Unfortunately, most programmers like to play with new toys. I have many
+friends who, immediately upon buying a snakebite kit, would be tempted to
+throw the first person they see to the ground, tie the tourniquet on him,
+slash him with the knife, and apply suction to the wound.
+ -- Jon Bentley
+%
+UNION:
+ A dues-paying club workers wield to strike management.
+%
+United Nations, New York, December 25. The peace and joy of the Christmas
+season was marred by a proclamation of a general strike of all the military
+forces of the world. Panic reigns in the hearts of all the patriots of
+every persuasion. Meanwhile, fears of universal disaster sank to an all-time
+low over the world.
+ -- Isaac Asimov
+%
+Universe, n.:
+ The problem.
+%
+Universities are places of knowledge. The freshman each bring a little
+in with them, and the seniors take none away, so knowledge accumulates.
+%
+University, n.:
+ Like a software house, except the software's free, and it's
+ usable, and it works, and if it breaks they'll quickly tell
+ you how to fix it, and...
+
+ [Okay, okay, I'll leave it in, but I think you're destroying
+ the credibility of the entire fortune program. Ed.]
+%
+University politics are vicious precisely because the stakes are so small.
+ -- Henry Kissinger
+%
+UNIX enhancements aren't.
+%
+Unix gives you just enough rope to hang yourself -- and then a couple
+of more feet, just to be sure.
+ -- Eric Allman
+
+... We make rope.
+ -- Rob Gingell on Sun Microsystems' new virtual memory
+%
+Unix is a lot more complicated (than CP/M) of course -- the typical Unix
+hacker can never remember what the PRINT command is called this week --
+but when it gets right down to it, Unix is a glorified video game.
+People don't do serious work on Unix systems; they send jokes around the
+world on USENET or write adventure games and research papers.
+ -- E. Post
+ "Real Programmers Don't Use Pascal", Datamation, 7/83
+%
+Unix is a Registered Bell of AT&T Trademark Laboratories.
+ -- Donn Seeley
+%
+UNIX is hot. It's more than hot. It's steaming. It's quicksilver
+lightning with a laserbeam kicker.
+ -- Michael Jay Tucker
+%
+UNIX is many things to many people,
+but it's never been everything to anybody.
+%
+Unix is the worst operating system; except for all others.
+ -- Berry Kercheval
+%
+Unix, n.:
+ A computer operating system, once thought to be flabby and
+ impotent, that now shows a surprising interest in making off
+ with the workstation harem.
+%
+unix soit qui mal y pense
+%
+UNIX was half a billion (500000000) seconds old on
+Tue Nov 5 00:53:20 1985 GMT (measuring since the time(2) epoch).
+ -- Andrew S. Tanenbaum
+%
+UNIX was not designed to stop you from doing stupid things, because that
+would also stop you from doing clever things.
+ -- Doug Gwyn
+%
+Unix will self-destruct in five seconds... 4... 3... 2... 1...
+%
+Unknown person(s) stole the American flag from its pole in Etra Park sometime
+between 3pm Jan 17 and 11:30 am Jan 20. The flag is described as red, white
+and blue, having 50 stars and was valued at $40.
+ -- Windsor-Heights Herald "Police Blotter", Jan 28, 1987
+%
+Unless hours were cups of sack, and minutes capons, and clocks the tongues
+of bawds, and dials the signs of leaping houses, and the blessed sun himself
+a fair, hot wench in flame-colored taffeta, I see no reason why thou shouldst
+be so superfluous to demand the time of the day. I wasted time and now doth
+time waste me.
+ -- William Shakespeare
+%
+Unless you love someone, nothing else makes any sense.
+ -- e. e. cummings
+%
+Unnamed Law:
+ If it happens, it must be possible.
+%
+Unprovided with original learning, unformed in the habits of thinking,
+unskilled in the arts of composition, I resolved to write a book.
+ -- Edward Gibbon
+%
+Unquestionably, there is progress. The average American now
+pays out twice as much in taxes as he formerly got in wages.
+ -- H. L. Mencken
+%
+Until Eve arrived, this was a man's world.
+ -- Richard Armour
+%
+UNTOLD WEALTH:
+ What you left out on April 15th.
+%
+Up against the net, redneck mother,
+Mother who has raised your son so well;
+He's seventeen and hackin' on a Macintosh,
+Flaming spelling errors and raisin' hell...
+%
+Usage: fortune -P [] -a [xsz] [Q: [file]] [rKe9] -v6[+] dataspec ... inputdir
+%
+Use a pun, go to jail.
+%
+Use an accordion. Go to jail.
+ -- KFOG, San Francisco
+%
+Use what talents you possess: the woods would be very silent
+if no birds sang there except those that sang best.
+ -- Henry Van Dyke
+%
+USENET would be a better laboratory is there were
+more labor and less oratory.
+ -- Elizabeth Haley
+%
+User hostile.
+%
+User, n.:
+ A programmer who will believe anything you tell him.
+%
+User, n.:
+ The word computer professionals use when they mean "idiot."
+ -- Dave Barry, "Claw Your Way to the Top"
+
+[I always thought "computer professional" was the phrase hackers used
+ when they meant "idiot." Ed.]
+%
+Using encryption on the Internet is the equivalent of arranging
+an armoured car to deliver credit card information from someone
+living in a cardboard box to someone living on a park bench.
+ -- Gene Spafford, Purdue University
+%
+Using TSO is like kicking a dead whale down the beach.
+ -- S. C. Johnson
+%
+Using [Windows] for any sort of serious work is like playing an old
+text-based adventure game. You're five feet from making it to your
+goal, when bup-POW! a ten ton rock falls on your head. Because you
+didn't disarm the trap three hours before. [...]
+
+I always hated those adventure games.
+ -- David Gerard
+%
+Using words to describe magic is like using a screwdriver to cut roast beef.
+ -- Tom Robbins
+%
+/usr/news/gotcha
+%
+Usually, when a lot of men get together, it's called a war.
+ -- Mel Brooks, "The Listener"
+%
+Utility is when you have one telephone, luxury is when you have two,
+opulence is when you have three -- and paradise is when you have none.
+ -- Doug Larson
+%
+VACATION:
+ A two-week binge of rest and relaxation so intense that
+ it takes another 50 weeks of your restrained workaday
+ life-style to recuperate.
+%
+Vail's Second Axiom:
+ The amount of work to be done increases in proportion to the
+ amount of work already completed.
+%
+Valerie: Aww, Tom, you're going maudlin on me ...
+Tom: I reserve the right to wax maudlin as I wane eloquent ...
+ -- Tom Chapin
+%
+Van Roy's Law:
+ An unbreakable toy is useful for breaking other toys.
+%
+Van Roy's Law:
+ Honesty is the best policy - there's less competition.
+
+Van Roy's Truism:
+ Life is a whole series of circumstances beyond your control.
+%
+Vanilla, adj.:
+ Ordinary flavor, standard. See FLAVOR. When used of food,
+very often does not mean that the food is flavored with vanilla
+extract! For example, "vanilla-flavored won ton soup" (or simply
+"vanilla won ton soup") means ordinary won ton soup, as opposed to hot
+and sour won ton soup.
+%
+Variables don't; constants aren't.
+%
+Vax Vobiscum
+%
+Vegetables are what food eats.
+Fruit are vegetables that fool you by tasting good.
+Fish are fast moving vegetables.
+Mushrooms are what grows on vegetables when food's done with them.
+ -- Meat Eater's Credo, according to Jim Williams
+%
+Vegetarians beware! You are what you eat.
+%
+Velilind's Laws of Experimentation:
+ 1. If reproducibility may be a problem, conduct the test only once.
+ 2. If a straight line fit is required, obtain only two data points.
+%
+Veni, Vidi, VISA:
+ I came, I saw, I did a little shopping.
+%
+Verba volant, scripta manent!
+%
+Vermouth always makes me brilliant unless it makes me idiotic.
+ -- E. F. Benson
+%
+Very few people do anything creative after the age of thirty-five. The
+reason is that very few people do anything creative before the age of
+thirty-five.
+ -- Joel Hildebrand
+%
+Very few profundities can be expressed in less than 80 characters.
+%
+Very few things actually get manufactured these days, because in an
+infinitely large Universe, such as the one in which we live, most things one
+could possibly imagine, and a lot of things one would rather not, grow
+somewhere. A forest was discovered recently in which most of the trees grew
+ratchet screwdrivers as fruit. The life cycle of the ratchet screwdriver is
+quite interesting. Once picked it needs a dark dusty drawer in which it can
+lie undisturbed for years. Then one night it suddenly hatches, discards its
+outer skin that crumbles into dust, and emerges as a totally unidentifiable
+little metal object with flanges at both ends and a sort of ridge and a hole
+for a screw. This, when found, will get thrown away. No one knows what the
+screwdriver is supposed to gain from this. Nature, in her infinite wisdom,
+is presumably working on it.
+%
+Very few things happen at the right time, and the rest do not happen
+at all. The conscientious historian will correct these defects.
+ -- Herodotus
+%
+Vests are to suits as seat-belts are to cars.
+%
+VI:
+ A hungry dog hunts best.
+ A hungrier dog hunts even better.
+VII:
+ Decreased business base increases overhead.
+ So does increased business base.
+VIII:
+ The most unsuccessful four years in the education of a cost-estimator
+ is fifth grade arithmetic.
+IX:
+ Acronyms and abbreviations should be used to the maximum extent
+ possible to make trivial ideas profound. Q.E.D.
+X:
+ Bulls do not win bull fights; people do.
+ People do not win people fights; lawyers do.
+ -- Norman Augustine
+%
+Victory uber allies!
+%
+Viking, n.:
+ 1. Daring Scandinavian seafarers, explorers, adventurers,
+ entrepreneurs world-famous for their aggressive, nautical import
+ business, highly leveraged takeovers and blue eyes.
+ 2. Bloodthirsty sea pirates who ravaged northern Europe beginning
+ in the 9th century.
+
+Hagar's note: The first definition is much preferred; the second is used
+only by malcontents, the envious, and disgruntled owners of waterfront
+property.
+%
+Vila: "I think I have just made the biggest mistake of my life."
+Orac: "It is unlikely. I would predict there are far greater mistakes
+ waiting to be made by someone with your obvious talent for it."
+%
+Vini, vidi, vici.
+[I came, I saw, I conquered].
+ -- Gaius Julius Caesar
+%
+"Violence accomplishes nothing." What a contemptible lie! Raw, naked
+violence has settled more issues throughout history than any other method
+ever employed. Perhaps the city fathers of Carthage could debate the
+issue, with Hitler and Alexander as judges?
+%
+Violence is a sword that has no handle -- you have to hold the blade.
+%
+Violence is molding.
+%
+Violence is the last refuge of the incompetent.
+ -- Salvor Hardin
+%
+Violence stinks, no matter which end of it you're on. But now and then
+there's nothing left to do but hit the other person over the head with a
+frying pan. Sometimes people are just begging for that frypan, and if we
+weaken for a moment and honor their request, we should regard it as
+impulsive philanthropy, which we aren't in any position to afford, but
+shouldn't regret it too loudly lest we spoil the purity of the deed.
+ -- Tom Robbins
+%
+VIRGINIA:
+ A group of beautifully mounted hunters galloping behind
+ baying hounds in pursuit of a union organizer.
+%
+Virginia law forbids bathtubs in the house; tubs must be kept in the
+yard.
+%
+VIRGO (Aug 23 - Sept 22)
+ You are the logical type and hate disorder. This nitpicking is
+sickening to your friends. You are cold and unemotional and sometimes
+fall asleep while making love. Virgos make good bus drivers.
+%
+VIRGO (Aug.23 - Sept.22)
+ Learn something new today, like how to spell or how to count
+ to ten without using your fingers. Be careful dressing this
+ morning. You may be hit by a car later in the day and you
+ wouldn't want to be taken to the doctor's office in some of
+ that old underwear you own.
+%
+"Virtual" means never knowing where your next byte is coming from.
+%
+Virtue does not always demand a heavy sacrifice --
+only the willingness to make it when necessary.
+ -- Frederick Dunn
+%
+Virtue is its own punishment.
+ -- Denniston
+
+Righteous people terrify me ... virtue is its own punishment.
+ -- Aneurin Bevan
+%
+Virtue is not left to stand alone.
+He who practices it will have neighbors.
+ -- Confucius
+%
+Virtue would go far if vanity did not keep it company.
+ -- Francois de La Rochefoucauld
+%
+Visit beautiful Vergas Minnesota.
+%
+Visit beautiful Wisconsin Dells.
+%
+Visits always give pleasure: if not on arrival, then on the departure.
+ -- Edouard Le Berquier, "Pensees des Autres"
+%
+Vital papers will demonstrate their vitality by spontaneously moving
+from where you left them to where you can't find them.
+%
+Vitamin C deficiency is apauling.
+%
+VMS is like a nightmare about RSX-11M.
+%
+VMS, n.:
+ The world's foremost multi-user adventure game.
+%
+VMS version 2.0 ==>
+%
+Voiceless it cries,
+Wingless flutters,
+Toothless bites,
+Mouthless mutters.
+What am I?
+%
+VOLCANO:
+ A mountain with hiccups.
+%
+Volcanoes have a grandeur that is grim
+And earthquakes only terrify the dolts,
+And to him who's scientific
+There is nothing that's terrific
+In the pattern of a flight of thunderbolts!
+ -- W. S. Gilbert, "The Mikado"
+%
+Volley Theory:
+ It is better to have lobbed and lost
+ than never to have lobbed at all.
+%
+Von Neumann was the subject of many dotty professor stories. Von Neumann
+supposedly had the habit of simply writing answers to homework assignments on
+the board (the method of solution being, of course, obvious) when he was asked
+how to solve problems. One time one of his students tried to get more helpful
+information by asking if there was another way to solve the problem. Von
+Neumann looked blank for a moment, thought, and then answered, "Yes.".
+%
+Vote anarchist.
+%
+Vote early and vote often.
+ -- Al Capone's slogan for Big Bill Thompson's anti-reform
+ campaign for Mayor of Chicago, 1926. Big Bill won.
+%
+Vote for ME -- I'm well-tapered, half-cocked, ill-conceived and
+TAX-DEFERRED!
+%
+VUJA DE:
+ The feeling that you've *never*, *ever* been in this situation before.
+%
+Wagner's music is better than it sounds.
+ -- Mark Twain
+%
+Wait for that wisest of all counselors, Time.
+ -- Pericles
+%
+Waiter: "Tea or coffee, gentlemen?"
+1st customer: "I'll have tea."
+2nd customer: "Me, too -- and be sure the glass is clean!"
+ (Waiter exits, returns)
+Waiter: "Two teas. Which one asked for the clean glass?"
+%
+Wake up all you citizens, hear your country's call,
+Not to arms and violence, But peace for one and all.
+Crush out hate and prejudice, fear and greed and sin,
+Help bring back her dignity, restore her faith again.
+
+Work hard for a common cause, don't let our country fall.
+Make her proud and strong again, democracy for all.
+Yes, make our country strong again, keep our flag unfurled.
+Make our country well again, respected by the world.
+
+Make her whole and beautiful, work from sun to sun.
+Stand tall and labor side by side, because there's so much to be done.
+Yes, make her whole and beautiful, united strong and free,
+Wake up, all you citizens, It's up to you and me.
+ -- Pansy Myers Schroeder
+%
+Wake up and smell the coffee.
+ -- Ann Landers
+%
+Waking a person unnecessarily should not be considered
+a capital crime. For a first offense, that is.
+%
+Walk softly and carry a big stick.
+ -- Theodore Roosevelt
+%
+Walk softly and carry a megawatt laser.
+%
+Walking on water wasn't built in a day.
+ -- Jack Kerouac
+%
+Wall Street indices predicted nine out of the last five recessions
+ -- Paul A. Samuelson, Nobel laureate in economics
+ (Newsweek, Science and Stocks, 19 Sep. 1966.)
+%
+Walt: Dad, what's gradual school?
+Garp: Gradual school?
+Walt: Yeah. Mom says her work's more fun now that she's teaching
+ gradual school.
+Garp: Oh. Well, gradual school is someplace you go and gradually
+ find out that you don't want to go to school anymore.
+ -- The World According To Garp
+%
+Walters' Rule:
+ All airline flights depart from the gates most distant from
+ the center of the terminal. Nobody ever had a reservation
+ on a plane that left Gate 1.
+%
+Wanna buy a duck?
+%
+Wanna tell you all a story 'bout a man named Jed,
+A poor mountaineer, barely kept his family fed.
+But then one day he was shootin' at some food,
+When up through the ground come a bubblin' crude -- oil, that is;
+ black gold; "Texas tea" ...
+
+Well the next thing ya know, old Jed's a millionaire.
+The kinfolk said, "Jed, move away from there!"
+They said, "Californy is the place ya oughta be",
+So they loaded up the truck and they moved to Beverly -- Hills, that is;
+ swimmin' pools; movie stars.
+%
+War doesn't prove who's right, just who's left.
+%
+War hath no fury like a non-combatant.
+ -- Charles Edward Montague
+%
+War is an equal opportunity destroyer.
+%
+War is delightful to those who have had no experience of it.
+ -- Desiderius Erasmus
+%
+War is like love, it always finds a way.
+ -- Bertolt Brecht, "Mother Courage"
+%
+War is much too serious a matter to be entrusted to the military.
+ -- Clemenceau
+%
+War is peace. Freedom is slavery. Ketchup is a vegetable.
+%
+War spares not the brave, but the cowardly.
+ -- Anacreon
+%
+WARNING:
+ Reading this fortune can affect the dimensionality of your
+ mind, change the curvature of your spine, cause the growth
+ of hair on your palms, and make a difference in the outcome
+ of your favorite war.
+%
+WARNING!
+ This system is subject to breakdowns during periods of critical need!
+A special circuit in the computer called a "critical detector" senses the
+user's emotional state in terms of how desperate they are to get their program
+to run. The "critical detector" then creates a bug in the program proportional
+to the desperation of the user. Threatening the terminal with violence only
+aggravates the situation, causing the program to immediately crash or the
+entire system to go down. Likewise, attempts to use another terminal may cause
+it to core dump. (They all belong to the same LAN.) Keep cool and say nice
+things to the terminal.
+%
+Warning: Do not look directly into laser with remaining eye.
+%
+Warning: Listening to WXRT on April Fools' Day is not recommended for
+those who are slightly disoriented the first few hours after waking
+up.
+ -- Chicago Reader 4/22/83
+%
+Warning: Trespassers will be shot.
+Survivors will be shot again.
+%
+WARNING!!!
+This machine is subject to breakdowns during periods of critical need.
+
+A special circuit in the machine called "critical detector" senses the
+operator's emotional state in terms of how desperate he/she is to use the
+machine. The "critical detector" then creates a malfunction proportional
+to the desperation of the operator. Threatening the machine with violence
+only aggravates the situation. Likewise, attempts to use another machine
+may cause it to malfunction. They belong to the same union. Keep cool
+and say nice things to the machine. Nothing else seems to work.
+
+See also: flog(1), tm(1)
+%
+Warp 7 -- It's a law we can live with.
+%
+Was there a time when dancers with their fiddles
+In children's circuses could stay their troubles?
+There was a time they could cry over books,
+But time has set its maggot on their track.
+Under the arc of the sky they are unsafe.
+What's never known is safest in this life.
+Under the skysigns they who have no arms
+Have cleanest hands, and, as the heartless ghost
+Alone's unhurt, so the blind man sees best.
+ -- Dylan Thomas, "Was There A Time"
+%
+Washington, D.C: Fifty square miles almost completely surrounded by reality.
+%
+Washington [D.C.] is a city of Southern efficiency and Northern charm.
+ -- John F. Kennedy
+%
+[Washington, D.C.] is the home of... taste for
+the people -- the big, the bland and the banal.
+ -- Ada Louise Huxtable
+%
+Washington, D.C: Wasting your money since 1810.
+%
+Wasn't there something about a PASCAL programmer
+knowing the value of everything and the Wirth of nothing?
+%
+Waste not fresh tears over old griefs.
+ -- Euripides
+%
+Waste not, get your budget cut next year.
+%
+Wasting time is an important part of living.
+%
+Watch all-night Donna Reed reruns until your mind resembles oatmeal.
+%
+Watch your mouth, kid, or you'll find yourself floating home.
+ -- Han Solo
+%
+Water, taken in moderation cannot hurt anybody.
+ -- Mark Twain
+%
+Watership Down:
+You've read the book. You've seen the movie. Now eat the stew!
+%
+Watson's Law:
+ The reliability of machinery is inversely proportional to the
+ number and significance of any persons watching it.
+%
+WE:
+ The single most important word in the world.
+%
+We all agree on the necessity of compromise. We just can't agree on
+when it's necessary to compromise.
+ -- Larry Wall
+%
+We all declare for liberty, but in using the
+same word we do not all mean the same thing.
+ -- Abraham Lincoln
+%
+We all dream of being the darling of everybody's darling.
+%
+We all know that no one understands anything that isn't funny.
+%
+We all like praise, but a hike in our pay is the best kind of ways.
+%
+We all live in a state of ambitious poverty.
+ -- Decimus Junius Juvenalis
+%
+We all live under the same sky, but we don't all have the same horizon.
+ -- Dr. Konrad Adenauer
+%
+We are all agreed that your theory is crazy. The question which divides us is
+whether it is crazy enough to have a chance of being correct. My own feeling
+is that it is not crazy enough.
+ -- Niels Bohr
+%
+We are all born charming, fresh and spontaneous and must be civilized
+before we are fit to participate in society.
+ -- Judith Martin, "Miss Manners' Guide to Excruciatingly
+ Correct Behaviour"
+%
+We are all born equal... just some of us are more equal than others.
+%
+We are all born mad. Some remain so.
+ -- Samuel Beckett
+%
+We are all dying -- and we're gonna be dead for a long time.
+%
+We are all in the gutter, but some of us are looking at the stars.
+ -- Oscar Wilde
+%
+We are all so much together and yet we are all dying of loneliness.
+ -- Albert Schweitzer
+%
+We are all worms. But I do believe I am a glowworm.
+ -- Winston Churchill
+%
+We are anthill men upon an anthill world.
+ -- Ray Bradbury
+%
+We ARE as gods and might as well get good at it.
+ -- Whole Earth Catalog
+%
+We are confronted with insurmountable opportunities.
+ -- Walt Kelly, "Pogo"
+%
+We are drowning in information but starved for knowledge.
+ -- John Naisbitt, "Megatrends"
+%
+We are each entitled to our own opinion, but no one is entitled to his
+own facts.
+ -- Patrick Moynihan
+%
+We are each only one drop in a great
+ocean -- but some of the drops sparkle!
+%
+We are experiencing system trouble -- do not adjust your terminal.
+%
+We are giving instruction to FBI agents in the various Chinese
+dialects ... to handle present and likely future contingencies.
+ -- J. Hoover
+%
+We are going to give a little something, a few little years more, to
+socialism, because socialism is defunct. It dies all by itself. The bad
+thing is that socialism, being a victim of its ... Did I say socialism?
+ -- Fidel Castro
+%
+We are going to have peace even if we have to fight for it.
+ -- Dwight D. Eisenhower
+%
+We are Microsoft. Unix is irrelevant.
+Openness is futile. Prepare to be assimilated.
+%
+We are not a clone.
+%
+We are not a loved organization, but we are a respected one.
+ -- John Fisher
+%
+We are not alone.
+%
+We are not loved by our friends for what we are;
+rather, we are loved in spite of what we are.
+ -- Victor Hugo
+%
+We are on the verge: Today our program proved Fermat's next-to-last
+theorem.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+We are preparing to think about contemplating preliminary work on plans to
+develop a schedule for producing the 10th Edition of the Unix Programmers
+Manual.
+ -- Andrew Hume
+%
+We are simple killers of people and destroyers of property.
+%
+We are so fond of each other because our ailments are the same.
+ -- Jonathan Swift
+%
+We are sorry. We cannot complete your call as dialed. Please check
+the number and dial again or ask your operator for assistance.
+
+This is a recording.
+%
+We are stronger than our skin of flesh and metal, for we carry and
+share a spectrum of suns and lands that lends us legends as we craft
+our immortality and interweave our destinies of water and air,
+leaving shadows that gather color of their own, until they outshine
+the substance that cast them.
+%
+We are the people our parents warned us about.
+%
+We are the unwilling... led by the unqualified...
+to do the unnecessary... for the ungrateful...
+ -- GI in Vietnam, 1970
+%
+We are unavoidably drawn towards conservatism and death.
+The order is not insignificant.
+ -- Poul Henningsen (1894-1967)
+%
+We are what we are.
+%
+We are what we pretend to be.
+ -- Kurt Vonnegut, Jr.
+%
+We can defeat gravity. The problem is the paperwork involved.
+%
+We can embody the truth, but we cannot know it.
+ -- Yates
+%
+We can found no scientific discipline, nor a healthy profession on the
+technical mistakes of the Department of Defense and IBM.
+ -- Edsger W. Dijkstra
+%
+We cannot command nature except by obeying her.
+ -- Sir Francis Bacon
+%
+We cannot do everything at once, but we can do something at once.
+ -- Calvin Coolidge
+%
+We cannot put the face of a person on a stamp unless said person is
+deceased. My suggestion, therefore, is that you drop dead.
+ -- James E. Day, Postmaster General
+%
+We could do that, but it would be wrong, that's for sure.
+ -- Richard M. Nixon
+%
+We could nuke Baghdad into glass, wipe it with Windex, tie fatback on our
+feet and go skating.
+ -- Fred Reed, Air Force Times columnist
+%
+We dedicate this book to our fellow citizens who, for love of truth,
+take from their own wants by taxes and gifts, and now and then send
+forth one of themselves as dedicated servant, to forward the search
+into the mysteries and marvelous simplicities of this strange and
+beautiful Universe, Our home.
+ -- "Gravitation", Misner, Thorne, and Wheeler
+%
+We demand rigidly defined areas of doubt and uncertainty!
+ -- Vroomfondel
+%
+We don't believe in rheumatism and true love until after the first attack.
+ -- Marie Ebner von Eschenbach
+%
+We don't care. We don't have to. We're the Phone Company.
+%
+We don't care how they do it in New York.
+%
+We don't have to protect the environment -- the Second Coming is at hand.
+ -- James Watt, noted theologian
+%
+We don't know one millionth of one percent about anything.
+%
+We don't know who discovered water, but we're certain it wasn't a fish.
+%
+We don't know who it was that discovered water, but we're pretty sure
+that it wasn't a fish.
+ -- Marshall McLuhan
+%
+We don't like their sound. Groups of guitars are on the way out.
+ -- Decca Recording Company, turning down the Beatles, 1962
+%
+We don't need no education, we don't need no thought control.
+ -- Pink Floyd
+%
+We don't need no indirection We don't need no compilation
+We don't need no flow control We don't need no load control
+No data typing or declarations No link edit for external bindings
+Hey! did you leave the lists alone? Hey! did you leave that source alone?
+Chorus: (Chorus)
+ Oh No. It's just a pure LISP function call.
+
+We don't need no side-effecting We don't need no allocation
+We don't need no flow control We don't need no special-nodes
+No global variables for execution No dark bit-flipping for debugging
+Hey! did you leave the args alone? Hey! did you leave those bits alone?
+(Chorus) (Chorus)
+ -- "Another Glitch in the Call", a la Pink Floyd
+%
+We don't really understand it, so we'll give it to the programmers.
+%
+We don't smoke and we don't chew, and we don't go with girls that do.
+ -- Walter Summers
+%
+We don't understand the software, and sometimes we don't
+understand the hardware, but we can *see* the blinking lights!
+%
+We found on St. Paul's only two kinds of birds -- the booby and the noddy...
+Both are of a tame and stupid disposition, and are so unaccustomed to
+visitors, that I could have killed any number of them with my geological
+hammer.
+ -- Charles Darwin
+%
+We gave you an atomic bomb, what do you want, mermaids?
+ -- I. I. Rabi to the Atomic Energy Commission
+%
+We give advice, but we cannot give the wisdom to profit by it.
+ -- Francois de La Rochefoucauld
+%
+We gotta get out of this place,
+If it's the last thing we ever do.
+ -- The Animals
+%
+We had it tough ... I had to get up at 9 o'clock at night, half an
+hour before I went to bed, eat a lump of dry poison, work 29 hours down
+mill, and when we came home our Dad would kill us, and dance about on
+our grave singing Hallelujah ...
+ -- Monty Python
+%
+We have an equal opportunity Calculus class -- it's fully integrated.
+%
+We have art that we do not die of the truth.
+ -- Friedrich Nietzsche
+%
+We have ears, earther...FOUR OF THEM!
+%
+We have gone on piling weapon upon weapon, missile upon missile, new
+levels of destructiveness upon old ones. We have done this helplessly,
+almost involuntarily: like the victims of some sort of hypnotism, like
+men in a dream, like lemmings heading for the sea, like the children of
+Hamelin marching blindly along behind their Pied Piper. And the result
+is that today we have achieved, we and the Russians together, in the
+creation of these devices and their means of delivery, levels of
+redundancy of such grotesque dimensions as to defy rational understanding.
+ -- George Kennan, May 19, 1981
+%
+We have lingered long enough on the shores of the Cosmic Ocean.
+ -- Carl Sagan
+%
+We have met the enemy, and he is us.
+ -- Walt Kelly
+%
+We have more to fear from the bungling of the incompetent
+than from the machinations of the wicked.
+%
+We have no scorched earth policy.
+We have a policy of scorched Communists.
+ -- General Efrain Rios Montt, President of Guatemala, 1982
+%
+We have not inherited the earth from our parents, we've borrowed it from
+our children.
+%
+We have nowhere else to go... this is all we have.
+ -- Margaret Mead
+%
+We have only two things to worry about: That things will never get
+back to normal, and that they already have.
+%
+We have reason to be afraid. This is a terrible place.
+ -- John Berryman
+%
+We have seen the light at the end of the tunnel, and it's out.
+%
+We have the flu. I don't know if this particular strain has an
+official name, but if it does, it must be something like "Martian Death
+Flu". You may have had it yourself. The main symptom is that you wish
+you had another setting on your electric blanket, up past "HIGH", that
+said "ELECTROCUTION".
+
+Another symptom is that you cease brushing your teeth, because (a) your
+teeth hurt, and (b) you lack the strength. Midway through the brushing
+process, you'd have to lie down in front of the sink to rest for a
+couple of hours, and rivulets of toothpaste foam would dribble sideways
+out of your mouth, eventually hardening into crusty little toothpaste
+stalagmites that would bond your head permanently to the bathroom
+floor, which is how the police would find you.
+
+You know the kind of flu I'm talking about.
+ -- Dave Barry, "Molecular Homicide"
+%
+We interrupt this fortune for an important announcement...
+%
+We invented a new protocol and called it Kermit, after Kermit the Frog,
+star of "The Muppet Show." [3]
+
+[3] Why? Mostly because there was a Muppets calendar on the wall when we
+were trying to think of a name, and Kermit is a pleasant, unassuming sort of
+character. But since we weren't sure whether it was OK to name our protocol
+after this popular television and movie star, we pretended that KERMIT was an
+acronym; unfortunately, we could never find a good set of words to go with the
+letters, as readers of some of our early source code can attest. Later, while
+looking through a name book for his forthcoming baby, Bill Catchings noticed
+that "Kermit" was a Celtic word for "free", which is what all Kermit programs
+should be, and words to this effect replaced the strained acronyms in our
+source code (Bill's baby turned out to be a girl, so he had to name her Becky
+instead). When BYTE Magazine was preparing our 1984 Kermit article for
+publication, they suggested we contact Henson Associates Inc. for permission
+to say that we did indeed name the protocol after Kermit the Frog. Permission
+was kindly granted, and now the real story can be told. I resisted the
+temptation, however, to call the present work "Kermit the Book."
+ -- Frank da Cruz, "Kermit - A File Transfer Protocol"
+%
+We know next to nothing about virtually everything. It is not necessary
+to know the origin of the universe; it is necessary to want to know.
+Civilization depends not on any particular knowledge, but on the disposition
+to crave knowledge.
+ -- George Will
+%
+We laugh at the Indian philosopher, who to account for the support
+of the earth, contrived the hypothesis of a huge elephant, and to support
+the elephant, a huge tortoise. If we will candidly confess the truth, we
+know as little of the operation of the nerves, as he did of the manner in
+which the earth is supported: and our hypothesis about animal spirits, or
+about the tension and vibrations of the nerves, are as like to be true, as
+his about the support of the earth. His elephant was a hypothesis, and our
+hypotheses are elephants. Every theory in philosophy, which is built on
+pure conjecture, is an elephant; and every theory that is supported partly
+by fact, and partly by conjecture, is like Nebuchadnezzar's image, whose
+feet were partly of iron, and partly of clay.
+ -- Thomas Reid, "An Inquiry into the Human Mind", 1764
+%
+We lie loudest when we lie to ourselves.
+ -- Eric Hoffer
+%
+We love our little Johnny
+He's the best little boy in all the world
+And we wouldn't trade him for anything
+That's how much we love him.
+No, we couldn't live without him
+So that's why, since he died,
+We keep him safe in our G.E. freezer.
+He's so good, so well-behaved,
+Even better than before;
+Oh, such a wonderful kid he is.
+Alice and me, we'll never be lonely,
+Never miss our little Johnny,
+He'll never grow up and leave us
+That's why we love him like we do.
+ -- Mr. Mincemeat
+%
+"We maintain that the very foundation of our way of life is what we call
+free enterprise," said Cash McCall, "but when one of our citizens
+show enough free enterprise to pile up a little of that profit, we do
+our best to make him feel that he ought to be ashamed of himself."
+ -- Cameron Hawley
+%
+We may eventually come to realize that chastity is no more a virtue
+than malnutrition.
+ -- Alex Comfort
+%
+We may hope that machines will eventually compete with men in all purely
+intellectual fields. But which are the best ones to start with? Many people
+think that a very abstract activity, like the playing of chess, would be
+best. It can also be maintained that it is best to provide the machine with
+the best sense organs that money can buy, and then teach it to understand
+and speak English.
+ -- Alan M. Turing
+%
+We may not be able to persuade Hindus that Jesus and not Vishnu should govern
+their spiritual horizon, nor Moslems that Lord Buddha is at the center of
+their spiritual universe, nor Hebrews that Mohammed is a major prophet, nor
+Christians that Shinto best expresses their spiritual concerns, to say
+nothing of the fact that we may not be able to get Christians to agree among
+themselves about their relationship to God. But all will agree on a
+proposition that they possess profound spiritual resources. If, in addition,
+we can get them to accept the further proposition that whatever form the
+Deity may have in their own theology, the Deity is not only external, but
+internal and acts through them, and they themselves give proof or disproof
+of the Deity in what they do and think; if this further proposition can be
+accepted, then we come that much closer to a truly religious situation on
+earth.
+ -- Norman Cousins, from his book "Human Options"
+%
+We may not like doctors, but at least they doctor. Bankers are not ever
+popular but at least they bank. Policeman police and undertakers take
+under. But lawyers do not give us law. We receive not the gladsome light
+of jurisprudence, but rather precedents, objections, appeals, stays,
+filings and forms, motions and counter-motions, all at $250 an hour.
+ -- Nolo News, summer 1989
+%
+We may not return the affection of those who like us,
+but we always respect their good judgment.
+%
+...we must be wary of granting too much power to natural selection
+by viewing all basic capacities of our brain as direct adaptations.
+I do not doubt that natural selection acted in building our oversized
+brains -- and I am equally confident that our brains became large as
+an adaptation for definite roles (probably a complex set of interacting
+functions). But these assumptions do not lead to the notion, often
+uncritically embraced by strict Darwinians, that all major capacities
+of the brain must arise as direct products of natural selection.
+ -- S. J. Gould, "The Mismeasure of Man"
+%
+We must believe that it is the darkest before the dawn
+of a beautiful new world. We will see it when we believe it.
+ -- Saul Alinsky
+%
+We must die because we have known them.
+ -- Ptah-hotep, 2000 B.C.
+%
+We must finish once and for all with the neutrality of chess. We must
+condemn once and for all the formula "chess for the sake of chess," like
+the formula "art for art's sake." We must organize shock-brigades of
+chess-players, and begin the immediate realization of a Five-Year Plan
+for chess.
+ -- Nikolai V. Krylenko, People's Commissar for Justice
+ (of RFSFR, later of USSR), speaking at a 1932 Congress
+ of Chess Players, as quoted in Boris Souvarine's
+ "Stalin," published London, 1939
+%
+...we must not judge the society of the future by considering whether or not
+we should like to live in it; the question is whether those who have grown up
+in it will be happier than those who have grown up in our society or those of
+the past.
+ -- Joseph Wood Krutch
+%
+We must remember that in time of war what is said on the enemy's side of
+the front is always propaganda and what is said on our side of the front
+is truth and righteousness, the cause of humanity and a crusade for peace.
+ -- Walter Lippmann
+%
+We must remember the First Amendment which
+protects any shrill jackass no matter how self-seeking.
+ -- F. G. Withington
+%
+We must respect the other fellow's religion, but only in the sense and to
+the extent that we respect his theory that his wife is beautiful and his
+children smart.
+ -- H. L. Mencken, "Minority Report"
+%
+We only acknowledge small faults in order
+to make it appear that we are free from great ones.
+ -- Francois de La Rochefoucauld
+%
+We ought to be very grateful that we have tools. Millions of years ago
+people did not have them, and home projects were extremely difficult.
+For example, when a primitive person wanted to put up paneling, he had
+to drive the little paneling nails into the cave wall with his bare
+fist, so generally the paneling wound up getting spattered with
+primitive blood, which isn't really all that bad when you consider how
+ugly paneling is to begin with.
+ -- Dave Barry, "The Taming of the Screw"
+%
+We prefer to believe that the absence of inverted commas guarantees the
+originality of a thought, whereas it may be merely that the utterer has
+forgotten its source.
+ -- Clifton Fadiman, "Any Number Can Play"
+%
+We prefer to speak evil of ourselves
+rather than not speak of ourselves at all.
+%
+We promise according to our hopes, and perform according to our fears.
+%
+We rarely find anyone who can say he has lived a happy life, and who,
+content with his life, can retire from the world like a satisfied guest.
+ -- Quintus Horatius Flaccus (Horace)
+%
+We read to say that we have read.
+%
+We really don't have any enemies.
+It's just that some of our best friends are trying to kill us.
+%
+We secure our friends not by accepting favors but by doing them.
+ -- Thucydides
+%
+We seem to have forgotten the simple truth that reason is never perfect.
+Only non-sense attains perfection.
+ -- Poul Henningsen (1894-1967)
+%
+We seldom repent talking too little, but very often talking too much.
+ -- Jean de la Bruyere
+%
+We should be careful to get out of an experience only the wisdom that is
+in it - and stay there, lest we be like the cat that sits down on a hot
+stove-lid. She will never sit down on a hot stove-lid again - and that
+is well; but also she will never sit down on a cold one any more.
+ -- Mark Twain
+%
+We should be glad we're living in the time that we are. If any of us had been
+born into a more enlightened age, I'm sure we would have immediately been taken
+out and shot.
+ -- Strange de Jim
+%
+We should have a great many fewer disputes in the world if only words were
+taken for what they are, the signs of our ideas only, and not for things
+themselves.
+ -- John Locke
+%
+We should have a Vollyballocracy. We elect a six-pack of presidents.
+Each one serves until they screw up, at which point they rotate.
+ -- Dennis Miller
+%
+We should keep the Panama Canal. After all, we stole it fair and square.
+ -- S. I. Hayakawa
+%
+We should realize that a city is better off with bad laws, so long as they
+remain fixed, then with good laws that are constantly being altered, that
+the lack of learning combined with sound common sense is more helpful than
+the kind of cleverness that gets out of hand, and that as a general rule,
+states are better governed by the man in the street than by intellectuals.
+These are the sort of people who want to appear wiser than the laws, who
+want to get their own way in every general discussion, because they feel that
+they cannot show off their intelligence in matters of greater importance, and
+who, as a result, very often bring ruin on their country.
+ -- Cleon, Thucydides, III, 37 translation by Rex Warner
+%
+We the unwilling, led by the ungrateful, are doing the impossible.
+We've done so much, for so long, with so little,
+that we are now qualified to do something with nothing.
+%
+We the Users, in order to form a more perfect system, establish priorities,
+ensure connective tranquility, provide for common repairs, promote
+preventive maintenance, and secure the blessings of liberty for ourselves
+and our processes, do ordain and establish this Software of The Unixed States
+of America.
+%
+We thrive on euphemism. We call multi-megaton bombs "Peace-keepers", closet
+size apartments "efficient" and incomprehensible artworks "innovative". In
+fact, "euphemism" has become a euphemism for "bald-faced lie". And now, here
+are the euphemisms so colorfully employed in Personal Ads:
+
+EUPHEMISM REALITY
+------------------- -------------------------
+Excited about life's journey No concept of reality
+Spiritually evolved Oversensitive
+Moody Manic-depressive
+Soulful Quiet manic-depressive
+Poet Boring manic-depressive
+Sultry/Sensual Easy
+Uninhibited Lacking basic social skills
+Unaffected and earthy Slob and lacking basic social skills
+Irreverent Nasty and lacking basic social skills
+Very human Quasimodo's best friend
+Swarthy Sweaty even when cold or standing still
+Spontaneous/Eclectic Scatterbrained
+Flexible Desperate
+Aging child Self-centered adult
+Youthful Over 40 and trying to deny it
+Good sense of humor Watches a lot of television
+%
+We thrive on euphemism. We call multi-megaton bombs "Peace-keepers", closet
+size apartments "efficient" and incomprehensible artworks "innovative". In
+fact, "euphemism" has become a euphemism for "bald-faced lie". And now, here
+are the euphemisms so colorfully employed in Personal Ads:
+
+EUPHEMISM REALITY
+------------------- -------------------------
+Independent thinker Crazy
+High spirited Crazy and hyperactive
+Free spirited Crazy and irresponsible
+Outrageous Crazy and obnoxious
+Exotic Crazy with a pierced nose/nipple
+Cuddly Overweight
+Huggable/Zaftig/Rubenesque Fat (there's a lot to love)
+Big and beautiful Really Fat
+Fat 'n' sassy Really Fat and loud
+Svelte/Slender Anorexic
+Dynamic Pushy
+Assertive Pushy with a mean streak
+Feisty/Ambitious Would kill own mother for next corporate rung
+Demanding Will make your life a living hell
+Looking for Mr./Ms. Right Looking for Mr./Ms. Rich
+%
+We totally deny the allegations, and
+we're trying to identify the allegators.
+%
+We tried to close Ohio's borders and ran into a Constitutional problem.
+There's a provision in the Constitution that says you can't close your
+borders to interstate commerce, and garbage is a form of interstate commerce.
+ -- Ohio Lt. Governor Paul Leonard
+%
+[We] use bad software and bad machines for the wrong things.
+ -- R. W. Hamming
+%
+We warn the reader in advance that the proof presented here
+depends on a clever but highly unmotivated trick.
+ -- Howard Anton, "Elementary Linear Algebra"
+%
+We was playin' the Homestead Grays in the city of Pitchburgh. Josh
+[Gibson] comes up in the last of the ninth with a man on and us a run
+behind. Well, he hit one. The Grays waited around and waited around,
+but finally the empire rules it ain't comin' down. So we win. The
+next day, we was disputin' the Grays in Philadelphia when here come
+a ball outta the sky right in the glove of the Grays' center fielder.
+The empire made the only possible call. "You're out, boy!" he says
+to Josh. "Yesterday, in Pitchburgh."
+ -- Satchel Paige
+%
+We were happily married for eight months. Unfortunately, we
+were married for four and a half years.
+ -- Nick Faldo
+%
+We were so poor that we thought new clothes meant someone had died.
+%
+We were so poor we couldn't afford a watchdog.
+If we heard a noise at night, we'd bark ourselves.
+ -- Crazy Jimmy
+%
+We were young and our happiness dazzled us with its strength. But there was
+also a terrible betrayal that lay within me like a Merle Haggard song at a
+French restaurant. [...]
+ I could not tell the girl about the woman of the tollway, of her milk
+white BMW and her Jordache smile. There had been a fight. I had punched her
+boyfriend, who fought the mechanical bulls. Everyone told him, "You ride the
+bull, senor. You do not fight it." But he was lean and tough like a bad
+rib-eye and he fought the bull. And then he fought me. And when we finished
+there were no winners, just men doing what men must do. [...]
+ "Stop the car," the girl said.
+ There was a look of terrible sadness in her eyes. She knew about the
+woman of the tollway. I knew not how. I started to speak, but she raised an
+arm and spoke with a quiet and peace I will never forget.
+ "I do not ask for whom's the tollway belle," she said, "the tollway
+belle's for thee."
+ The next morning our youth was a memory, and our happiness was a lie.
+Life is like a bad margarita with good tequila, I thought as I poured whiskey
+onto my granola and faced a new day.
+ -- Peter Applebome, International Imitation Hemingway
+ Competition
+%
+We who revel in nature's diversity and feel instructed by every animal
+tend to brand Homo sapiens as the greatest catastrophe since the Cretaceous
+extinction.
+ -- S. J. Gould
+%
+We will have solar energy as soon as the utility companies solve
+one technical problem -- how to run a sunbeam through a meter.
+%
+we will invent new lullabies, new songs, new acts of love,
+we will cry over things we used to laugh &
+our new wisdom will bring tears to eyes of gentle
+creatures from other planets who were afraid of us till then &
+in the end a summer with wild winds &
+new friends will be.
+%
+We will not be responsible for damage to equipment, your ego, county wide
+power outages, spontaneously generated mini (or larger) black holes,
+planetary disruptions, or personal injury or worse that may result from the
+use of this material.
+ -- taken from Samuel M. Goldwasser's
+ Sam's Strobe FAQ Notes on the Troubleshooting
+ and Repair of Electronic Flash Units and Strobe Lights
+%
+We wish you a Hare Krishna
+We wish you a Hare Krishna
+We wish you a Hare Krishna
+And a Sun Myung Moon!
+ -- Maxwell Smart
+%
+WEAPON:
+ An index of the lack of development of a culture.
+%
+Wedding is destiny, and hanging likewise.
+ -- John Heywood
+%
+Wedding, n.:
+ A ceremony at which two persons undertake to become one, one
+ undertakes to become nothing and nothing undertakes to become
+ supportable.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Wedding rings are the world's smallest handcuffs.
+%
+Weed's Axiom:
+ Never ask two questions in a business letter.
+ The reply will discuss the one in which you are
+ least interested and say nothing about the other.
+%
+Weekend, where are you?
+%
+Weiler's Law:
+ Nothing is impossible for the man who doesn't have to do it
+ himself.
+%
+Weinberg, as a young grocery clerk, advised the grocery manager to get
+rid of rutabagas which nobody every bought. He did so. "Well, kid, that
+was a great idea," said the manager. Then he paused and asked the killer
+question, "NOW what's the least popular vegetable?"
+
+Law: Once you eliminate your #1 problem, #2 gets a promotion.
+ -- Gerald Weinberg, "The Secrets of Consulting"
+%
+Weinberg's First Law:
+ Progress is only made on alternate Fridays.
+%
+Weinberg's Principle:
+ An expert is a person who avoids the small errors while sweeping
+ on to the grand fallacy.
+%
+Weinberg's Second Law:
+ If builders built buildings the way programmers wrote programs,
+ then the first woodpecker that came along would destroy civilization.
+ -- Gerald Weinberg
+%
+Weiner's Law of Libraries:
+ There are no answers, only cross references.
+%
+Welcome thy neighbor into thy fallout shelter.
+He'll come in handy if you run out of food.
+ -- Dean McLaughlin
+%
+Welcome to boggle - do you want instructions?
+
+D G G O
+
+O Y A N
+
+A D B T
+
+K I S P
+Enter words:
+>
+%
+Welcome to Lake Wobegon, where all the men are strong,
+The women are pretty, and the children are above-average.
+ -- Garrison Keillor
+%
+Welcome to the Zoo!
+%
+Welcome to UNIX! Enjoy your session! Have a great time! Note the
+use of exclamation points! They are a very effective method for
+demonstrating excitement, and can also spice up an otherwise plain-looking
+sentence! However, there are drawbacks! Too much unnecessary exclaiming
+can lead to a reduction in the effect that an exclamation point has on
+the reader! For example, the sentence
+
+ Jane went to the store to buy bread
+
+should only be ended with an exclamation point if there is something
+sensational about her going to the store, for example, if Jane is a
+cocker spaniel or if Jane is on a diet that doesn't allow bread or if
+Jane doesn't exist for some reason! See how easy it is?! Proper control
+of exclamation points can add new meaning to your life! Call now to receive
+my free pamphlet, "The Wonder and Mystery of the Exclamation Point!"!
+Enclose fifteen(!) dollars for postage and handling! Operators are
+standing by! (Which is pretty amazing, because they're all cocker spaniels!)
+%
+Welcome to Utah.
+If you think our liquor laws are funny, you should see our underwear!
+%
+Well, anyway, I was reading this James Bond book, and right away I realized
+that like most books, it had too many words. The plot was the same one that
+all James Bond books have: An evil person tries to blow up the world, but
+James Bond kills him and his henchmen and makes love to several attractive
+women. There, that's it: 24 words. But the guy who wrote the book took
+*thousands* of words to say it.
+ Or consider "The Brothers Karamazov", by the famous Russian alcoholic
+Fyodor Dostoyevsky. It's about these two brothers who kill their father.
+Or maybe only one of them kills the father. It's impossible to tell because
+what they mostly do is talk for nearly a thousand pages. If all Russians talk
+as much as the Karamazovs did, I don't see how they found time to become a
+major world power.
+ I'm told that Dostoyevsky wrote "The Brothers Karamazov" to raise
+the question of whether there is a God. So why didn't he just come right
+out and say: "Is there a God? It sure beats the heck out of me."
+ Other famous works could easily have been summarized in a few words:
+
+* "Moby Dick" -- Don't mess around with large whales because they symbolize
+ nature and will kill you.
+* "A Tale of Two Cities" -- French people are crazy.
+ -- Dave Barry
+%
+We'll be recording at the Paradise Friday
+night. Live, on the Death label.
+ -- Swan, "Phantom of the Paradise"
+%
+Well begun is half done.
+ -- Aristotle
+%
+"Well," Brahma said, "even after ten thousand explanations, a fool is
+no wiser, but an intelligent man requires only two thousand five
+hundred."
+ -- The Mahabharata
+%
+We'll cross that bridge when we come back to it later.
+%
+Well, didja wake up grouchy or did you let her sleep?
+%
+Well, don't worry about it... It's nothing.
+ -- Lieutenant Kermit Tyler (Duty Officer of Shafter Information
+ Center, Hawaii), upon being informed that Private Joseph
+ Lockard had picked up a radar signal of what appeared to be
+ at least 50 planes soaring toward Oahu at almost 180 miles
+ per hour, December 7, 1941.
+%
+Well, fancy giving money to the Government!
+Might as well have put it down the drain.
+Fancy giving money to the Government!
+Nobody will see the stuff again.
+Well, they've no idea what money's for --
+Ten to one they'll start another war.
+I've heard a lot of silly things, but, Lor'!
+Fancy giving money to the Government!
+ -- A. P. Herbert
+%
+We'll have solar energy when the power companies develop a sunbeam meter.
+%
+Well, he didn't know what to do, so he decided to look at the government,
+to see what they did, and scale it down and run his life that way.
+ -- Laurie Anderson
+%
+Well, here it is, 1983, so it won't be long before you start reading a
+lot of boring stories about people like Vance Hartke. Hartke is a
+governor or mayor or something from one of the flatter states, and the
+reason you'll be reading about him is that he's one of the 50 top
+contenders for the 1984 Democratic presidential nomination. These men
+will spend the next 18 months going around the country engaging in the
+most degrading activities imaginable, such as wearing idiot hats and
+appearing on "Meet the Press". "Meet the Press" is one of those Sunday
+morning public interest shows that the public is not the least bit
+interested in. It features a panel of reporters who ask questions of a
+guest politician, who wins an Amana home freezer if he can get through
+the entire show without answering a single question ...
+ -- Dave Barry, "On Presidential Politics"
+%
+Well I looked at my watch and it said a quarter to five,
+The headline screamed that I was still alive,
+I couldn't understand it, I thought I died last night.
+I dreamed I'd been in a border town,
+In a little cantina that the boys had found,
+I was desperate to dance, just to dig the local sounds.
+When along came a senorita,
+She looked so good that I had to meet her,
+I was ready to approach her with my English charm,
+When her brass knuckled boyfriend grabbed me by the arm,
+And he said, grow some funk of your own, amigo,
+Grow some funk of your own.
+We no like to with the gringo fight,
+But there might be a death in Mexico tonite.
+...
+Take my advice, take the next flight,
+And grow some funk, grow your funk at home.
+ -- Elton John, "Grow Some Funk of Your Own"
+%
+Well, I would -- if they realized that we -- again if -- if we led them
+back to that stalemate only because our retaliatory power, our seconds,
+or strike at them after our first strike, would be so destructive they
+couldn't afford it, that would hold them off.
+ -- President Ronald Reagan, on the MX missile
+%
+Well, if you can't believe what you read in a comic book, what *_c_a_n*
+you believe?!
+ -- Bullwinkle J. Moose [Jay Ward]
+%
+Well, I'm disenchanted too. We're all disenchanted.
+ -- James Thurber
+%
+Well, it's hard for a mere man to believe that woman doesn't have equal
+rights.
+ -- Dwight D. Eisenhower
+%
+Well, Jim, I'm not much of an actor either.
+%
+We'll know that rock is dead when you have to get a degree to work in it.
+%
+WE'LL LOOK INTO IT:
+ By the time the wheels make a full turn, we
+ assume you will have forgotten about it,too.
+%
+Well, my daddy left home when I was three,
+And he didn't leave much for Ma and me,
+Just and old guitar an'a empty bottle of booze.
+Now I don't blame him 'cause he ran and hid,
+But the meanest thing that he ever did,
+Was before he left he went and named me Sue.
+...
+But I made me a vow to the moon and the stars,
+I'd search the honkey tonks and the bars,
+And kill the man that give me that awful name.
+It was Gatlinburg in mid-July,
+I'd just hit town and my throat was dry,
+Thought I'd stop and have myself a brew,
+At an old saloon on a street of mud,
+Sitting at a table, dealing stud,
+Sat that dirty (bleep) that named me Sue.
+...
+Now, I knew that snake was my own sweet Dad,
+From a worn out picture that my Mother had,
+And I knew that scar on his cheek and his evil eye...
+ -- Johnny Cash, "A Boy Named Sue"
+%
+Well, my terminal's locked up, and I ain't got any Mail,
+And I can't recall the last time that my program didn't fail;
+I've got stacks in my structs, I've got arrays in my queues,
+I've got the : Segmentation violation -- Core dumped blues.
+
+If you think that it's nice that you get what you C,
+Then go : illogical statement with your whole family,
+'Cause the Supreme Court ain't the only place with : Bus error views.
+I've got the : Segmentation violation -- Core dumped blues.
+
+On a PDP-11, life should be a breeze,
+But with VAXen in the house even magnetic tapes would freeze.
+Now you might think that unlike VAXen I'd know who I abuse,
+I've got the : Segmentation violation -- Core dumped blues.
+ -- Core Dumped Blues
+%
+Well, of course it worked. You made the ritual blood sacrifice. If you
+bleed on a machine while working on it, it will work. Unless it
+doesn't. In which case, you need someone else to bleed on it as well.
+ -- Wayne Pascoe
+%
+We'll pivot at warp 2 and bring all tubes to bear, Mr. Sulu!
+%
+Well, some take delight in the carriages a-rolling,
+And some take delight in the hurling and the bowling,
+But I take delight in the juice of the barley,
+And courting pretty fair maids in the morning bright and early.
+%
+Well thaaaaaaat's okay.
+%
+Well, the handwriting is on the floor.
+ -- Joe E. Lewis
+%
+We'll try to cooperate fully with the IRS, because, as citizens,
+we feel a strong patriotic duty not to go to jail.
+ -- Dave Barry
+%
+Well, we'll really have a party,
+but we've gotta post a guard outside.
+ -- Eddie Cochran, "Come On Everybody"
+%
+"Well, well, well! Well if it isn't fat stinking billy goat Billy Boy in
+poison! How art thou, thou globby bottle of cheap stinking chip oil? Come
+and get one in the yarbles, if ya have any yarble, ya eunuch jelly thou!"
+ -- Alex in "Clockwork Orange"
+%
+Well, we're big rock singers, we've got golden fingers,
+And we're loved everywhere we go.
+We sing about beauty, and we sing about truth,
+At ten thousand dollars a show.
+We take all kind of pills to give us all kind of thrills,
+But the thrill we've never known,
+Is the thrill that'll get'cha, when you get your picture,
+On the cover of the Rolling Stone.
+
+I got a freaky old lady, name of Cole King Katie,
+Who embroiders on my jeans.
+I got my poor old gray-haired daddy,
+Drivin' my limousine.
+Now it's all designed, to blow our minds,
+But our minds won't be really be blown;
+Like the blow that'll get'cha, when you get your picture,
+On the cover of the Rolling Stone.
+
+We got a lot of little, teen-aged, blue-eyed groupies,
+Who'll do anything we say.
+We got a genuine Indian guru, that's teachin' us a better way.
+We got all the friends that money can buy,
+So we never have to be alone.
+And we keep gettin' richer, but we can't get our picture,
+On the cover of the Rolling Stone.
+ -- Dr. Hook and the Medicine Show
+ [They eventually DID make the cover of RS. Ed.]
+%
+Well, we've come full circle, Lord; I'd like to think there's some
+higher meaning to all this. It would certainly reflect well on you.
+%
+WELL-ADJUSTED:
+ The ability to play bridge or golf as if they were games.
+%
+We
+own
+this land.
+
+I don't spend
+any time
+on this land.
+
+This
+is a tiny
+little piece
+
+of my
+business
+interests.
+
+It's like
+a grain
+of sand.
+ -- "Alliance Airport, from The Poetry Of H. Ross Perot,
+ recited on ABC's Town Meeting, June 29, 1992.
+ From SPY Magazine, November 1992
+%
+We're all in this alone.
+ -- Lily Tomlin
+%
+We're constantly being bombarded by insulting and humiliating music, which
+people are making for you the way they make those Wonder Bread products.
+Just as food can be bad for your system, music can be bad for your spiritual
+and emotional feelings. It might taste good or clever, but in the long run,
+it's not going to do anything for you.
+ -- Bob Dylan, "LA Times", September 5, 1984
+%
+We're deep into the holiday gift-giving season, as you can tell from
+the fact that everywhere you look, you see jolly old St. Nick urging
+you to purchase things, to the point where you want to slug him right
+in his bowl full of jelly.
+ -- Dave Barry, "Simple, Homespun Gifts"
+%
+We're fantastically incredibly sorry for all these extremely unreasonable
+things we did. I can only plead that my simple, barely-sentient friend
+and myself are underprivileged, deprived and also college students.
+ -- Waldo D. R. Dobbs
+%
+We're happy little Vegemites,
+ As bright as bright can be.
+We all enjoy our Vegemite
+ For breakfast, lunch and tea.
+%
+Were it not for the presence of the unwashed and the half-educated, the
+formless, queer and incomplete, the unreasonable and absurd, the infinite
+shapes of the delightful human tadpole, the horizon would not wear so wide
+a grin.
+ -- F. M. Colby, "Imaginary Obligations"
+%
+We're Knights of the Round Table
+We dance whene'er we're able
+We do routines and chorus scenes We're knights of the Round Table
+With footwork impeccable Our shows are formidable
+We dine well here in Camelot But many times
+We eat ham and jam and Spam a lot. We're given rhymes
+ That are quite unsingable
+In war we're tough and able, We're opera mad in Camelot
+Quite indefatigable We sing from the diaphragm a lot.
+Between our quests
+We sequin vests
+And impersonate Clark Gable
+It's a busy life in Camelot.
+I have to push the pram a lot.
+ -- Monty Python
+%
+We're living in a golden age. All you need is gold.
+ -- D. W. Robertson
+%
+We're mortal -- which is to say, we're ignorant, stupid, and sinful --
+but those are only handicaps. Our pride is that nevertheless, now and
+then, we do our best. A few times we succeed. What more dare we ask for?
+ -- Ensign Flandry
+%
+"We're not talking about the same thing," he said. "For you the world is
+weird because if you're not bored with it you're at odds with it. For me
+the world is weird because it is stupendous, awesome, mysterious,
+unfathomable; my interest has been to convince you that you must accept
+responsibility for being here, in this marvelous world, in this marvelous
+desert, in this marvelous time. I wanted to convince you that you must
+learn to make every act count, since you are going to be here for only a
+short while, in fact, too short for witnessing all the marvels of it."
+ -- Don Juan
+%
+We're only in it for the volume.
+ -- Black Sabbath
+%
+Were there no women, men might live like gods.
+ -- Thomas Dekker
+%
+Wernher von Braun settled for a V-2 when he coulda had a V-8.
+%
+Westheimer's Discovery:
+ A couple of months in the laboratory can
+ frequently save a couple of hours in the library.
+%
+Wethern's Law:
+ Assumption is the mother of all screw-ups.
+%
+We've sent a man to the moon, and that's 29,000 miles away. The center
+of the Earth is only 4,000 miles away. You could drive that in a week,
+but for some reason nobody's ever done it.
+ -- Andy Rooney
+%
+We've tried each spinning space mote
+And reckoned its true worth:
+Take us back again to the homes of men
+On the cool, green hills of Earth.
+
+The arching sky is calling
+Spacemen back to their trade.
+All hands! Standby! Free falling!
+And the lights below us fade.
+Out ride the sons of Terra,
+Far drives the thundering jet,
+Up leaps the race of Earthmen,
+Out, far, and onward yet--
+
+We pray for one last landing
+On the globe that gave us birth;
+Let us rest our eyes on the fleecy skies
+And the cool, green hills of Earth.
+ -- Robert A. Heinlein, 1941
+%
+Wharbat darbid yarbou sarbay?
+%
+What!? Me worry?
+ -- A. E. Neuman
+%
+What a bonanza! An unknown beginner to be directed by Lubitsch, in a script
+by Wilder and Brackett, and to play with Paramount's two superstars, Gary
+Cooper and Claudette Colbert, and to be beaten up by both of them!
+ -- David Niven, "Bring On the Empty Horses"
+%
+What a misfortune to be a woman! And yet, the worst misfortune is not to
+understand what a misfortune it is.
+ -- S. A. Kierkegaard (1813-1855)
+%
+What a strange game. The only winning move is not to play.
+ -- WOP, "War Games"
+%
+What, after all, is a halo? It's only one more thing to keep clean.
+ -- Christopher Fry
+%
+What an artist dies with me!
+ -- Nero
+%
+What an author likes to write most is his signature on the
+back of a cheque.
+ -- Brendan Francis
+%
+What awful irony is this?
+We are as gods, but know it not.
+%
+What causes the mysterious death of everyone?
+%
+What color is a chameleon on a mirror?
+%
+What did ya do with your burden and your cross?
+Did you carry it yourself or did you cry?
+You and I know that a burden and a cross,
+Can only be carried on one man's back.
+ -- Louden Wainwright III
+%
+What did you bring that book I didn't want
+to be read to out of about Down Under up for?
+%
+What did you do when the ship sank?
+I grabbed a cake of soap and washed myself ashore.
+%
+What do I consider a reasonable person to be? I'd say a reasonable person
+is one who accepts that we are all human and therefore fallible, and takes
+that into account when dealing with others. Implicit in this definition is
+the belief that it is the right and the responsibility of each person to
+live his or her own life as he or she sees fit, to respect this right in
+others, and to demand the assumption of this responsibility by others.
+%
+What do you give a man who has everything? Penicillin.
+ -- Jerry Lester
+%
+What do you have when you have six lawyers buried up to their necks in sand?
+Not enough sand.
+%
+What does education often do?
+It makes a straight cut ditch of a free meandering brook.
+ -- Henry David Thoreau
+%
+What does it mean if there is no fortune for you?
+%
+What does it take for Americans to do great things; to go to the moon, to
+win wars, to dig canals linking oceans, to build railroads across a continent?
+In independent thought about this question, Neil Armstrong and I concluded
+that it takes a coincidence of four conditions, or in Neil's view, the
+simultaneous peaking of four of the many cycles of American life. First, a
+base of technology must exist from which to do the thing to be done. Second,
+a period of national uneasiness about America's place in the scheme of human
+activities must exist. Third, some catalytic event must occur that focuses
+the national attention upon the direction to proceed. Finally, an articulate
+and wise leader must sense these first three conditions and put forth with
+words and action the great thing to be accomplished. The motivation of young
+Americans to do what needs to be done flows from such a coincidence of
+conditions. ... The Thomas Jeffersons, The Teddy Roosevelts, The John
+Kennedys appear. We must begin to create the tools of leadership which they,
+and their young frontiersmen, will require to lead us onward and upward.
+ -- Dr. Harrison H. Schmidt
+%
+What does not destroy me, makes me stronger.
+ -- Friedrich Nietzsche
+%
+What ever happened to happily ever after?
+%
+What excuses stand in your way? How can you eliminate them?
+ -- Roger von Oech
+%
+What foods these morsels be!
+%
+What fools these morals be!
+%
+What fools these mortals be.
+ -- Lucius Annaeus Seneca
+%
+What garlic is to food, insanity is to art.
+%
+What garlic is to salad, insanity is to art.
+%
+What George Washington did for us was to throw out the British, so
+that we wouldn't have a fat, insensitive government running our
+country. Nice try anyway, George.
+ -- Disk Jockey on KSFO/KYA
+%
+What goes up must come down. But don't expect it to come down
+where you can find it. Murphy's Law applied to Newton's.
+%
+What good is a ticket to the good life,
+if you can't find the entrance?
+%
+What good is an obscenity trial except to popularize literature?
+ -- Nero Wolfe, "The League of Frightened Men"
+%
+What good is having someone who can walk on water if you don't follow
+in his footsteps?
+%
+What good is it if you talk in flowers, and they think in pastry?
+ -- Ashleigh Brilliant
+%
+What happened last night can happen again.
+%
+What happens if a big asteroid hits Earth? Judging from realistic simulations
+involving a sledge hammer and a common laboratory frog, we can assume it will
+be pretty bad.
+ -- Dave Barry
+%
+What happens to a dream deferred?
+Does it dry up
+Like a raisin in the sun?
+Or fester like a sore --
+And then run?
+Does it stink like rotten meat?
+Or crust and sugar over --
+Like a syrupy sweet?
+
+Maybe it just sags
+Like a heavy load.
+
+Or does it explode?
+ -- Langston Hughes
+%
+What happens when you cut back the jungle? It recedes.
+%
+What has roots as nobody sees,
+Is taller than trees,
+Up, up it goes,
+And yet never grows?
+%
+What I do, first thing [in the morning], is I hop into the shower
+stall. Then I hop right back out, because when I hopped in I landed
+barefoot right on top of See Threepio, a little plastic robot character
+from "Star Wars" whom my son, Robert, likes to pull the legs off of
+while he showers. Then I hop right back into the stall because our
+dog, Earnest, who has been alone in the basement all night building up
+powerful dog emotions, has come bounding and quivering into the
+bathroom and wants to greet me with 60 or 70 thousand playful nips, any
+one of which -- bear in mind that I am naked and, without my contact
+lenses, essentially blind -- could result in the kind of injury where
+you have to learn a whole new part if you want to sing the "Messiah",
+if you get my drift. Then I hop right back out, because Robert, with
+that uncanny sixth sense some children have -- you cannot teach it;
+they either have it or they don't -- has chosen exactly that moment to
+flush one of the toilets. Perhaps several of them.
+ -- Dave Barry, "Saving Face"
+%
+What I mean (and everybody else means) by the word QUALITY cannot be
+broken down into subjects and predicates. This is not because Quality
+is so mysterious but because Quality is so simple, immediate, and direct.
+ -- Robert Pirsig, "Zen and the Art of Motorcycle Maintenance"
+%
+What I think is that the F-word is basically just a convenient nasty-
+sounding word that we tend to use when we would really like to come up
+with a terrifically witty insult, the kind Winston Churchill always
+came up with when enormous women asked him stupid questions at
+parties.
+ -- Dave Barry, "$#$%#^%!^%&@%@!"
+%
+What I want is all of the power and none of the responsibility.
+%
+What if everything is an illusion and nothing exists?
+In that case, I definitely overpaid for my carpet.
+ -- Woody Allen, "Without Feathers"
+%
+What if nothing exists and we're all in somebody's dream?
+Or what's worse, what if only that fat guy in the third row exists?
+ -- Woody Allen, "Without Feathers"
+%
+What if there had been room at the inn?
+ -- Linda Festa on the origins of Christianity
+%
+What is a magician but a practicing theorist?
+ -- Obi-Wan Kenobi
+%
+What is actually happening, I am afraid, is that we all tell each
+other and ourselves that software engineering techniques should be
+improved considerably, because there is a crisis. But there are a few
+boundary conditions which apparently have to be satisfied:
+
+ 1. We may not change our thinking habits.
+ 2. We may not change our programming tools.
+ 3. We may not change our hardware.
+ 4. We may not change our tasks.
+ 5. We may not change the organizational set-up
+ in which the work has to be done.
+
+Now under these five immutable boundary conditions, we have to try to
+improve matters. This is utterly ridiculous.
+
+Edsger W. Dijkstra, on receiving the ACM Turing Award in 1972
+%
+What is algebra, exactly? Is it one of those three-cornered things?
+ -- J. M. Barrie
+%
+What is comedy? Comedy is the art of making people laugh without making
+them puke.
+ -- Steve Martin
+%
+What is food to one, is to others bitter poison.
+ -- Titus Lucretius Carus
+%
+What is good? Everything that heightens the feeling of power in man, the
+will to power, power itself. What is bad? Everything that is born of
+weakness. Not contentedness but more power; not peace but war; not virtue
+but fitness. The weak and the failures shall perish: first principle of
+our love of man. And they shall even be given every possible assistance.
+What is more harmful than any vice? Active pity for all the failures and
+all the weak: Christianity.
+ -- Friedrich Nietzsche
+%
+What is important is food, money and opportunities for scoring off one's
+enemies. Give a man these three things and you won't hear much squawking
+out of him.
+ -- Brian O'Nolan, "The Best of Myles"
+%
+What is irritating about love is that it is a crime that requires
+an accomplice.
+ -- Charles Baudelaire
+%
+What is love but a second-hand emotion?
+ -- Tina Turner
+%
+What is mind? No matter.
+What is matter? Never mind.
+ -- Thomas Hewitt Key (1799-1875)
+%
+What is now proved was once only imagin'd.
+ -- William Blake
+%
+What is research but a blind date with knowledge?
+ -- Will Harvey
+%
+What is robbing a bank compared with founding a bank?
+ -- Bertolt Brecht, "The Threepenny Opera"
+%
+What is status?
+ Status is when the President calls you for your opinion.
+
+Uh, no...
+ Status is when the President calls you in to discuss a
+ problem with him.
+
+Uh, that still ain't right...
+ STATUS is when you're in the Oval Office talking to the President,
+ and the phone rings. The President picks it up, listens for a
+ minute, and hands it to you, saying, "It's for you."
+%
+What is the difference between a Turing machine and the modern computer?
+It's the same as that between Hillary's ascent of Everest and the
+establishment of a Hilton on its peak.
+%
+"What is the Nature of God?"
+
+ CLICK...CLICK...WHIRRR...CLICK...=BEEP!=
+ 1 QT. SOUR CREAM
+ 1 TSP. SAUERKRAUT
+ 1/2 CUT CHIVES.
+ STIR AND SPRINKLE WITH BACON BITS.
+
+"I've just GOT to start labeling my software..."
+ -- Bloom County
+%
+What is the sound of one hand clapping?
+%
+What is this line of duty, and suffering? You are not supposed to suffer
+if you are an assassin. The other person is supposed to suffer.
+ -- Chiun, glory of the name of Sinanju, teacher of the youth
+ from outside Sinanju named Remo.
+%
+What is tolerance? -- it is the consequence of humanity. We are all formed
+of frailty and error; let us pardon reciprocally each other's folly -- that
+is the first law of nature.
+ -- Voltaire
+%
+What is truth? We must adopt a pragmatic definition: it is what is believed
+to be the truth. A lie that is put across therefore becomes the truth and
+may, therefore, be justified. The difficulty is to keep up lying... it is
+simpler to tell the truth and if a sufficient emergency arises, to tell one,
+big thumping lie that will then be believed.
+ -- Ministry of Information, memo on the maintenance of
+ British civilian morale, 1939
+%
+What is wanted is not the will to believe, but the will to find out,
+which is the exact opposite.
+ -- Bertrand Russell, "Skeptical_Essays", 1928
+%
+What is worth doing is worth the trouble of asking somebody to do it.
+%
+What I've done, of course, is total garbage.
+ -- R. Willard, Pure Math 430a
+%
+What kind of sordid business are you on now? I mean, man, whither
+goest thou? Whither goest thou, America, in thy shiny car in the night?
+ -- Jack Kerouac
+%
+What luck for the rulers that men do not think.
+ -- Adolf Hitler
+%
+What makes the Universe so hard to comprehend
+is that there's nothing to compare it with.
+%
+What makes us so bitter against people who outwit us
+is that they think themselves cleverer than we are.
+%
+What makes you think graduate school
+is supposed to be satisfying?
+ -- Erica Jong, "Fear of Flying"
+%
+What most people want is all of the power but none of the responsibility.
+%
+What no spouse of a writer can ever understand
+is that a writer is working when he's staring out the window.
+%
+What nonsense people talk about happy marriages!
+A man can be happy with any woman so long as he doesn't love her.
+ -- Wilde
+%
+What on earth would a man do with himself
+if something did not stand in his way?
+ -- H. G. Wells
+%
+What one believes to be true either is true or becomes true.
+ -- John Lilly
+%
+What one fool can do, another can.
+ -- Ancient Simian proverb
+%
+What orators lack in depth they make up in length.
+%
+What pains others pleasures me,
+At home am I in Lisp or C;
+There i couch in ecstasy,
+'Til debugger's poke i flee,
+Into kernel memory.
+In system space, system space, there shall i fare--
+Inside of a VAX on a silicon square.
+%
+What passes for optimism is most often the effect of an intellectual error.
+ -- Raymond Aron, "The Opium of the Intellectuals"
+%
+What passes for woman's intuition is often nothing
+more than man's transparency.
+ -- George Nathan
+%
+What publishers are looking for these days isn't radical feminism.
+It's corporate feminism -- a brand of feminism designed to sell books
+and magazines, three-piece suits, airline tickets, Scotch, cigarettes
+and, most important, corporate America's message, which runs: Yes,
+women were discriminated against in the past, but that unfortunate
+mistake has been remedied; now every woman can attain wealth, prestige
+and power by dint of individual rather than collective effort.
+ -- Susan Gordon
+%
+What really shapes and conditions and makes us is somebody only a few
+of us ever have the courage to face: and that is the child you once
+were, long before formal education ever got its claws into you -- that
+impatient, all-demanding child who wants love and power and can't get
+enough of either and who goes on raging and weeping in your spirit
+till at last your eyes are closed and all the fools say, "Doesn't he
+look peaceful?" It is those pent-up, craving children who make all
+the wars and all the horrors and all the art and all the beauty and
+discovery in life, because they are trying to achieve what lay beyond
+their grasp before they were five years old.
+ -- Robertson Davies, "The Rebel Angels"
+%
+What sane person could live in this world and not be crazy?
+ -- Ursula K. LeGuin
+%
+What scoundrel stole the cork from my lunch?
+ -- J. D. Farley
+%
+What segment's this, that, laid to rest
+On FHA0, is sleeping?
+What system file, lay here a while This, this is "acct.run,"
+While hackers around it were weeping? Accounting file for everyone.
+ Dump, dump it and type it out,
+ The file, the highseg of login.
+Why lies it here, on public disk
+And why is it now unprotected?
+A bug in incant, made it thus. Mount, mount all your DECtapes now
+And copy the file somehow, somehow. The problem has not been corrected.
+ Dump, dump it and type it out,
+ The file, the highseg of login.
+ -- to Greensleeves
+%
+What sin has not been committed in the name of efficiency?
+%
+What soon grows old? Gratitude.
+ -- Aristotle
+%
+What, still alive at twenty-two,
+A clean upstanding chap like you?
+Sure, if your throat 'tis hard to slit,
+Slit your girl's, and swing for it.
+Like enough, you won't be glad,
+When they come to hang you, lad:
+But bacon's not the only thing
+That's cured by hanging from a string.
+So, when the spilt ink of the night
+Spreads o'er the blotting pad of light,
+Lads whose job is still to do
+Shall whet their knives, and think of you.
+ -- Hugh Kingsmill
+%
+What the deuce is it to me? You say that we go around the sun. If we went
+around the moon it would not make a pennyworth of difference to me or my work.
+ -- Sherlock Holmes, "A Study in Scarlet"
+%
+What the hell is it good for?
+ -- Robert Lloyd (engineer of the Advanced Computing Systems
+ Division of IBM), to colleagues who insisted that the
+ microprocessor was the wave of the future, c. 1968
+%
+What the large print giveth, the small print taketh away.
+%
+What the scientists have in their briefcases is terrifying.
+ -- Nikita Khruschev
+%
+What the world *really* needs is a good Automatic Bicycle Sharpener.
+%
+What they said:
+ What they meant:
+
+"I recommend this candidate with no qualifications whatsoever."
+ (Yes, that about sums it up.)
+"The amount of mathematics she knows will surprise you."
+ (And I recommend not giving that school a dime...)
+"I simply can't say enough good things about him."
+ (What a screw-up.)
+"I am pleased to say that this candidate is a former colleague of mine."
+ (I can't tell you how happy I am that she left our firm.)
+"When this person left our employ, we were quite hopeful he would go
+a long way with his skills."
+ (We hoped he'd go as far as possible.)
+"You won't find many people like her."
+ (In fact, most people can't stand being around her.)
+"I cannot recommend him too highly."
+ (However, to the best of my knowledge, he has never committed a
+ felony in my presence.)
+%
+What they said:
+ What they meant:
+
+"If you knew this person as well as I know him, you would think as much
+of him as I do."
+ (Or as little, to phrase it slightly more accurately.)
+"Her input was always critical."
+ (She never had a good word to say.)
+"I have no doubt about his capability to do good work."
+ (And it's nonexistent.)
+"This candidate would lend balance to a department like yours, which
+already has so many outstanding members."
+ (Unless you already have a moron.)
+"His presentation to my seminar last semester was truly remarkable:
+one unbelievable result after another."
+ (And we didn't believe them, either.)
+"She is quite uniform in her approach to any function you may assign her."
+ (In fact, to life in general...)
+%
+What they said:
+ What they meant:
+
+"You will be fortunate if you can get him to work for you."
+ (We certainly never succeeded.)
+There is no other employee with whom I can adequately compare him.
+ (Well, our rats aren't really employees...)
+"Success will never spoil him."
+ (Well, at least not MUCH more.)
+"One usually comes away from him with a good feeling."
+ (And such a sigh of relief.)
+"His dissertation is the sort of work you don't expect to see these days;
+in it he has definitely demonstrated his complete capabilities."
+ (And his IQ, as well.)
+"He should go far."
+ (The farther the better.)
+"He will take full advantage of his staff."
+ (He even has one of them mowing his lawn after work.)
+%
+What they say: What they mean:
+
+A major technological breakthrough... Back to the drawing board.
+Developed after years of research Discovered by pure accident.
+Project behind original schedule due We're working on something else.
+ to unforeseen difficulties
+Designs are within allowable limits We made it, stretching a point or two.
+Customer satisfaction is believed So far behind schedule that they'll be
+ assured grateful for anything at all.
+Close project coordination We're gonna spread the blame, campers!
+Test results were extremely gratifying It works, and boy, were we surprised!
+The design will be finalized... We haven't started yet, but we've got
+ to say something.
+The entire concept has been rejected The guy who designed it quit.
+We're moving forward with a fresh We hired three new guys, and they're
+ approach kicking it around.
+A number of different approaches... We don't know where we're going, but
+ we're moving.
+Preliminary operational tests are Blew up when we turned it on.
+ inconclusive
+Modifications are underway We're starting over.
+%
+What they say: What they mean:
+
+New Different colors from previous version.
+All New Not compatible with previous version.
+Exclusive Nobody else has documentation.
+Unmatched Almost as good as the competition.
+Design Simplicity The company wouldn't give us any money.
+Fool-proof Operation All parameters are hard-coded.
+Advanced Design Nobody really understands it.
+Here At Last Didn't get it done on time.
+Field Tested We don't have any simulators.
+Years of Development Finally got one to work.
+Unprecedented Performance Nothing ever ran this slow before.
+Revolutionary Disk drives go 'round and 'round.
+Futuristic Only runs on a next generation supercomputer.
+No Maintenance Impossible to fix.
+Performance Proven Worked through Beta test.
+Meets Tough Quality Standards It compiles without errors.
+Satisfaction Guaranteed We'll send you another pack if it fails.
+Stock Item We shipped it before and can do it again.
+%
+What this country needs is a dime that will buy a good five-cent bagel.
+%
+What this country needs is a good five cent ANYTHING!
+%
+What this country needs is a good five cent microcomputer.
+%
+What this country needs is a good five cent nickel.
+%
+What this country needs is a good five dollar plasma weapon.
+%
+What time is it?
+I don't know, it keeps changing.
+%
+What upsets me is not that you lied to me,
+but that from now on I can no longer believe you.
+ -- Friedrich Nietzsche
+%
+What use is magic if it can't save a unicorn?
+ -- Peter S. Beagle, "The Last Unicorn"
+%
+What we Are is God's give to us.
+What we Become is our gift to God.
+%
+What we cannot speak about we must pass over in silence.
+ -- Wittgenstein
+%
+What we do not understand we do not possess.
+ -- Johann Wolfgang von Goethe
+%
+What we need in this country, instead of Daylight Savings Time, which
+nobody really understands anyway, is a new concept called Weekday
+Morning Time, whereby at 7 a.m. every weekday we go into a space-
+launch-style "hold" for two to three hours, during which it just
+remains 7 a.m. This way we could all wake up via a civilized gradual
+process of stretching and belching and scratching, and it would still
+be only 7 a.m. when we were ready to actually emerge from bed.
+ -- Dave Barry, "$#$%#^%!^%&@%@!"
+%
+What we need is either less corruption,
+or more chance to participate in it.
+%
+What we see depends on mainly what we look for.
+ -- John Lubbock
+%
+What we wish, that we readily believe.
+ -- Demosthenes
+%
+What will happen when the 32-bit Unix date goes negative in mid-January
+2038 does not bear thinking about.
+ -- Henry Spencer
+%
+What will you do if all your problems aren't solved by the time you die?
+%
+What would you do with a brain if you had one?
+ -- Judy Garland as Dorothy Gale, "The Wizard of Oz"
+%
+What you don't know can hurt you, only you won't know it.
+%
+What you don't know won't help you much either.
+ -- D. Bennett
+%
+What you see is from outside yourself, and may come, or not, but is beyond
+your control. But your fear is yours, and yours alone, like your voice, or
+your fingers, or your memory, and therefore yours to control. If you feel
+powerless over your fear, you have not yet admitted that it is yours, to do
+with as you will.
+ -- Marion Zimmer Bradley, "Stormqueen"
+%
+What you want, what you're hanging around in the world waiting for, is for
+something to occur to you.
+ -- Robert Frost
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to AST's.]
+%
+Whatever became of eternal truth?
+%
+Whatever became of Strange de Jim? Well, he found a substitute for
+cocaine: "You cover Q-tips with sandpaper and ram them up your
+nostrils as far as they will go. Then you sniff talcum powder while
+shredding hundred dollar bills."
+ -- Herb Caen
+%
+Whatever doesn't succeed in two months and a half in California will
+never succeed.
+ -- Rev. Henry Durant, founder of the University of California
+%
+Whatever else can be said about sex, it cannot be called a dignified
+performance.
+ -- Helen Lawrenson
+%
+Whatever happened to the good old days
+when sex was dirty and the air was clean?
+%
+Whatever is not nailed down is mine. What I can pry loose is not
+nailed down.
+ -- Collis P. Huntingdon
+%
+Whatever is not nailed down is mine.
+Whatever I can pry up is not nailed down.
+ -- Collis P. Huntingdon, railroad tycoon
+%
+Whatever it is, I fear Greeks even when they bring gifts.
+ -- Publius Vergilius Maro (Virgil)
+%
+Whatever occurs from love is always beyond good and evil.
+ -- Friedrich Nietzsche
+%
+Whatever the missing mass of the universe is, I hope it's not
+cockroaches!
+ -- Mom
+%
+Whatever women do they must do twice as well as men to be thought half
+as good. Luckily this is not difficult.
+ -- Charlotte Whitton
+%
+Whatever you do will be insignificant,
+but it is very important that you do it.
+ -- Mahatma Gandhi
+%
+Whatever you may be sure of, be sure of this: that you are dreadfully like
+other people.
+ -- James Russell Lowell, "My Study Windows"
+%
+Whatever you want to do, you have to do something else first.
+%
+What's a cult? It just means not enough people to make a minority.
+ -- Robert Altman
+%
+What's all this bru-ha-ha?
+%
+What's another word for "thesaurus"?
+ -- Steven Wright
+%
+What's done to children, they will do to society.
+%
+What's page one, a preemptive strike?
+ -- Professor Freund, Communication, Ramapo State College
+%
+What's so funny?
+%
+What's the matter with the world? Why, there ain't but one thing wrong
+with every one of us - and that's "selfishness."
+ -- The Best of Will Rogers
+%
+What's the ugliest part of your body?
+What's the ugliest part of your body?
+Some say your nose,
+Some say your toes,
+But I think it's your mind.
+ -- Frank Zappa, 1965
+%
+What's the use of a good quotation if you can't change it?
+ -- The Doctor, "Doctor Who"
+%
+What's this stuff about people being "released on their
+own recognizance"? Aren't we all out on own recognizance?
+%
+When a Banker jumps out of a window,
+jump after him -- that's where the money is.
+ -- Robespierre
+%
+When a camel flies, no one laughs if it doesn't get very far!
+%
+When a cow laughs, does milk come out of its nose?
+%
+When a fellow says, "It ain't the money but
+the principle of the thing," it's the money.
+ -- Kin Hubbard
+%
+When a fly lands on the ceiling, does it do a half roll or a half
+loop?
+%
+When a girl can read the handwriting on
+the wall, she may be in the wrong rest room.
+%
+When a girl marries she exchanges the attentions of many men for the
+inattentions of one.
+ -- Helen Rowland
+%
+When a lion meets another with a louder roar,
+the first lion thinks the last a bore.
+ -- George Bernard Shaw
+%
+When a lot of remedies are suggested for
+a disease, that means it can't be cured.
+ -- Chekhov, "The Cherry Orchard"
+%
+When a man assumes a public trust, he
+should consider himself as public property.
+ -- Thomas Jefferson
+%
+When a man is tired of London, he is tired of life.
+ -- Samuel Johnson
+%
+When a man knows he is to be hanged in a fortnight,
+it concentrates his mind wonderfully.
+ -- Samuel Johnson
+%
+When a man steals your wife, there is no better revenge than to let him
+keep her.
+ -- Sacha Guitry
+%
+When a man you like switches from what he said a year ago, or four years
+ago, he is a broad-minded man who has courage enough to change his mind
+with changing conditions. When a man you don't like does it, he is a
+liar who has broken his promises.
+ -- Franklin Adams
+%
+When a person goes on a diet, the first thing he loses is his temper.
+%
+When a place gets crowded enough to require ID's, social collapse is not
+far away. It is time to go elsewhere. The best thing about space travel
+is that it made it possible to go elsewhere.
+ -- Robert A. Heinlein, "Time Enough For Love"
+%
+When a shepherd goes to kill a wolf, and takes his dog along to see
+the sport, he should take care to avoid mistakes. The dog has certain
+relationships to the wolf the shepherd may have forgotten.
+ -- Robert Pirsig, "Zen and the Art of Motorcycle Maintenance"
+%
+When a woman gives me a present I have always two surprises:
+first is the present, and afterward, having to pay for it.
+ -- Donnay
+%
+When a woman marries again it is because she detested her first husband.
+When a man marries again, it is because he adored his first wife.
+ -- Wilde
+%
+When alerted to an intrusion by tinkling glass or otherwise, 1) Calm
+yourself 2) Identify the intruder 3) If hostile, kill him.
+
+Step number 3 is of particular importance. If you leave the guy alive
+out of misguided softheartedness, he will repay your generosity of spirit
+by suing you for causing his subsequent paraplegia and seek to force you
+to support him for the rest of his rotten life. In court he will plead
+that he was depressed because society had failed him, and that he was
+looking for Mother Teresa for comfort and to offer his services to the
+poor. In that lawsuit, you will lose. If, on the other hand, you kill
+him, the most that you can expect is that a relative will bring a wrongful
+death action. You will have two advantages: first, there be only your
+story; forget Mother Teresa. Second, even if you lose, how much could
+the bum's life be worth anyway? A lot less than 50 years worth of
+paralysis. Don't play George Bush and Saddam Hussein. Finish the job.
+ -- G. Gordon Liddy's Forbes column on personal security
+%
+When Alexander Graham Bell died in 1922, the telephone people
+interrupted service for one minute in his honor. They've been
+honoring him intermittently ever since, I believe.
+ -- The Grab Bag
+%
+When all else fails, EAT!!!
+%
+When all else fails, pour a pint of Guinness in the gas tank, advance
+the spark 20 degrees, cry "God Save the Queen!", and pull the starter
+knob.
+ -- MG "Series MGA" Workshop Manual
+%
+When all else fails, try Kate Smith.
+%
+When all other means of communication fail, try words.
+%
+When among apes, one must play the ape.
+%
+When angry, count four; when very angry, swear.
+ -- Mark Twain
+%
+When are you BUTTHEADS gonna learn that you can't oppose Gestapo
+tactics *with* Gestapo tactics?
+ -- Reuben Flagg
+%
+When arguments fail, use a blackjack.
+ -- Edward "Spike" O'Donnell, Al Capone associate
+%
+When asked by an anthropologist what the Indians called America before
+the white men came, an Indian said simply "Ours."
+ -- Vine Deloria, Jr.
+%
+When asked the definition of "pi":
+The Mathematician:
+ Pi is the number expressing the relationship between the
+ circumference of a circle and its diameter.
+The Physicist:
+ Pi is 3.1415927, plus or minus 0.000000005.
+The Engineer:
+ Pi is about 3.
+%
+When Boy Scouts do it, it's intense.
+%
+When childhood dies, its corpses are called adults.
+ -- Brian Aldiss
+%
+When choosing between two evils, I always
+like to take the one I've never tried before.
+ -- Mae West, "Klondike Annie"
+%
+When confronted by a difficult problem, you can often solve it quite
+easily by reducing it to the question, "How would the Lone Ranger
+handle this?"
+%
+When Cthulhu calls, He calls collect!
+%
+When democracy granted democratic methods to us in times of opposition, this
+was bound to happen in a democratic system. However, we National Socialists
+never asserted that we represented a democratic point of view, but we have
+declared openly that we used the democratic methods only to gain power and
+that, after assuming the power, we would deny to our adversaries without any
+consideration the means which were granted to us in times of our opposition.
+ -- Josef Goebbels
+%
+When Dexter's on the Internet, can Hell be far behind?
+%
+When does later become never?
+%
+When does summertime come to Minnesota, you ask?
+Well, last year, I think it was a Tuesday.
+%
+When eating an elephant take one bite at a time.
+ -- Gen. C. Abrams
+%
+When forecasting, give them a number
+or give them a date, but never both.
+%
+When God endowed human beings with brains,
+He did not intend to guarantee them.
+%
+When God saw how faulty was man He tried again and made woman. As to
+why he then stopped there are two opinions. One of them is woman's.
+ -- DeGourmont
+%
+When he got in trouble in the ring, [Ali] imagined a door swung open and
+inside he could see neon, orange, and green lights blinking, and bats
+blowing trumpets and alligators blowing trombones, and he could hear snakes
+screaming. Weird masks and actors' clothes hung on the wall, and if he
+stepped across the sill and reached for them, he knew that he was committing
+himself to destruction.
+ -- George Plimpton
+%
+When I came back to Dublin I was courtmartialed in my absence and sentenced
+to death in my absence, so I said they could shoot me in my absence.
+ -- Brendan Behan
+%
+When I demanded of my friend what viands he preferred,
+He quoth: "A large cold bottle, and a small hot bird!"
+ -- Eugene Field, "The Bottle and the Bird"
+%
+when i die, i'd like to go peacefully.
+in my sleep.
+like my grandfather.
+
+not screaming,
+like the passengers in his car...
+%
+When I first arrived in this country I had only fifteen cents in my pocket
+and a willingness to compromise.
+ -- Weber cartoon caption
+%
+When I get real bored, I like to drive downtown and get a great parking spot,
+then sit in my car and count how many people ask me if I'm leaving.
+ -- Steven Wright
+%
+When I grow up, I want to be an honest
+lawyer so things like that can't happen.
+ -- Richard M. Nixon, as a boy, on the Teapot Dome scandal
+%
+When I have one foot in the grave I will tell the truth about women. I
+shall tell it, jump into my coffin, pull the lid over me, and say, "Do
+what you like now."
+ -- Tolstoy
+%
+When I hear a man applauded by the mob I always feel a pang of pity
+for him. All he has to do to be hissed is to live long enough.
+ -- H. L. Mencken, "Minority Report"
+%
+When I heated my home with oil, I used an average of 800 gallons a
+year. I have found that I can keep comfortably warm for an entire
+winter with slightly over half that quantity of beer.
+ -- Dave Barry, "Postpetroleum Guzzler"
+%
+When I kill, the only thing I feel is recoil.
+%
+When I look at the horse heads and men's faces, the immense
+live torrent once raised by my will and now whirling to
+nowhere through the red sunset desert, I often wonder where
+I am in this torrent.
+ -- Chinggis (Genghis) Khan
+%
+When I said "we", officer, I was referring to
+myself, the four young ladies, and, of course, the goat.
+%
+When I saw a sign on the freeway that said, "Los Angeles 445 miles," I said
+to myself, "I've got to get out of this lane."
+ -- Franklyn Ajaye
+%
+When I say the magic word to all these people, they will vanish forever.
+I will then say the magic words to you, and you, too, will vanish -- never
+to be seen again.
+ -- Kurt Vonnegut, Jr., "Between Time and Timbuktu"
+%
+When I sell liquor, it's called bootlegging; when my patrons serve
+it on silver trays on Lake Shore Drive, it's called hospitality.
+ -- Al Capone
+%
+When I think about myself,
+I almost laugh myself to death,
+My life has been one great big joke, Sixty years in these folks' world
+A dance that's walked The child I works for calls me girl
+A song that's spoke, I say "Yes ma'am" for working's sake.
+I laugh so hard I almost choke Too proud to bend
+When I think about myself. Too poor to break,
+ I laugh until my stomach ache,
+ When I think about myself.
+My folks can make me split my side,
+I laughed so hard I nearly died,
+The tales they tell, sound just like lying,
+They grow the fruit,
+But eat the rind,
+I laugh until I start to crying,
+When I think about my folks.
+ -- Maya Angelou
+%
+When I was 16, I thought there was no hope for my father.
+By the time I was 20, he had made great improvement.
+%
+When I was a boy I was told that anyone could become President.
+Now I'm beginning to believe it.
+ -- Clarence Darrow
+%
+When I was a child... We had a quick-sand box in the backyard...
+I was an only child... eventually.
+ -- Steven Wright
+%
+When I was a kid I said to my father one afternoon, "Daddy, will you
+take me to the zoo?" He answered, "If the zoo wants you let them come
+and get you."
+ -- Jerry Lewis
+%
+When I was a kid my favorite relative was Uncle Caveman. After school we'd
+all go play in his cave, and every once in a while he would eat one of us.
+It wasn't until later that I found out that Uncle Caveman was a bear.
+ -- Jack Handey
+%
+When I was a young man, I vowed never to marry until I found the ideal
+woman. Well, I found her -- but alas, she was waiting for the ideal man.
+ -- Robert Schuman
+%
+When I was crossing the border into Canada, they asked if
+I had any firearms with me. I said, "Well, what do you need?"
+ -- Steven Wright
+%
+When I was growing up my mother kept telling me we're just friends.
+
+I tell ya I was an ugly kid. I was so ugly that my Dad kept the kid's
+picture that came with the wallet he bought.
+ -- Rodney Dangerfield
+%
+When I was in college, there were a lot of four-letter words you couldn't
+say in front of girls. Now you can say them. But you can't say "girls".
+%
+When I was in school, I cheated on my metaphysics exam:
+I looked into the soul of the boy sitting next to me.
+ -- Woody Allen
+%
+When I was little, I went into a pet shop and they asked how big I'd get.
+ -- Rodney Dangerfield
+%
+When I was seven years old, I was once reprimanded by my mother for an act
+of collective brutality in which I had been involved at school. A group of
+seven-year-olds had been teasing and tormenting a six-year-old. "It is
+always so," my mother said. "You do things together which not one of you
+would think of doing alone." ... Wherever one looks in the world of human
+organization, collective responsibility brings a lowering of moral standards.
+The military establishment is an extreme case, an organization which seems
+to have been expressly designed to make it possible for people to do things
+together which nobody in his right mind would do alone.
+ -- Freeman Dyson, "Weapons and Hope"
+%
+When I was young we didn't have MTV; we
+had to take drugs and go to concerts.
+ -- Steven Pearl
+%
+When I was younger, I could remember anything, whether it had happened
+or not; but my faculties are decaying now and soon I shall be so I cannot
+remember any but the things that never happened. It is sad to go to
+pieces like this but we all have to do it.
+ -- Mark Twain
+%
+When I woke up this morning, my girlfriend asked if I had
+slept well. I said, "No, I made a few mistakes."
+ -- Steven Wright
+%
+When I works, I works hard.
+When I sits, I sits easy.
+And when I thinks, I goes to sleep.
+%
+When I'm gone, boxing will be nothing again. The fans with the cigars and
+the hats turned down'll be there, but no more housewives and little men in
+the street and foreign presidents. It's goin' to be back to the fighter who
+comes to town, smells a flower, visits a hospital, blows a horn and says
+he's in shape. Old hat. I was the onliest boxer in history people asked
+questions like a senator.
+ -- Muhammad Ali
+%
+When I'm good, I'm great; but when I'm bad, I'm better.
+ -- Mae West
+%
+When in charge ponder,
+When in doubt mumble,
+When in trouble delegate.
+%
+When in doubt, do it. It's much easier
+to apologize than to get permission.
+ -- Grace Murray Hopper
+%
+When in doubt, do what the President does -- guess.
+%
+When in doubt, follow your heart.
+%
+When in doubt, have a man come through the door with a gun in his hand.
+ -- Raymond Chandler
+%
+When in doubt, lead trump.
+%
+When in doubt, mumble; when in trouble, delegate; when in charge, ponder.
+ -- James H. Boren
+%
+When in doubt, tell the truth.
+ -- Mark Twain
+%
+When in doubt, use brute force.
+ -- Ken Thompson
+%
+When in panic, fear and doubt,
+Drink in barrels, eat, and shout.
+%
+When in this world the headlines read
+Of those whose hearts are filled with greed
+Who rob and steal from those who need
+The cry goes up with blinding speed for Underdog (UNDERDOG!)
+Underdog (UNDERDOG!)
+Speed of lightning, roar of thunder
+Fighting all who rob or plunder
+Underdog (ah-ah-ah-ah)
+Underdog
+UNDERDOG!
+%
+When in trouble or in doubt, run in circles, scream and shout.
+%
+When it comes to broken marriages most husbands will split the blame --
+half his wife's fault, and half her mother's.
+%
+When it comes to helping you, some people stop at nothing.
+%
+When it is not necessary to make a decision,
+it is necessary not to make a decision.
+%
+When it's dark enough you can see the stars.
+ -- Ralph Waldo Emerson
+%
+When license fees are too high,
+users do things by hand.
+When the management is too intrusive,
+users lose their spirit.
+
+Hack for the user's benefit.
+Trust them; leave them alone.
+%
+When love is gone, there's always justice.
+And when justice is gone, there's always force.
+And when force is gone, there's always Mom.
+Hi, Mom!
+ -- Laurie Anderson
+%
+When man calls an animal "vicious", he usually means that it
+will attempt to defend itself when he tries to kill it.
+%
+When Marriage is Outlawed,
+Only Outlaws will have Inlaws.
+%
+When more and more people are thrown out of work, unemployment results.
+ -- Calvin Coolidge
+%
+When my brain begins to reel from my
+literary labors, I make an occasional cheese dip.
+ -- Ignatius Reilly
+%
+When my fist clenches crack it open,
+Before I use it and lose my cool.
+When I smile tell me some bad news,
+Before I laugh and act like a fool.
+
+And if I swallow anything evil,
+Put you finger down my throat.
+And if I shiver please give me a blanket,
+Keep me warm let me wear your coat
+
+No one knows what it's like to be the bad man,
+ to be the sad man.
+Behind blue eyes.
+No one knows what its like to be hated,
+ to be fated,
+To telling only lies.
+ -- The Who, "Behind Blue Eyes"
+%
+When my freshman roommate at Cornell found out I was Jewish, she was,
+at her request, moved to a different room. She told me she didn't
+think she had ever seen a Jew before. My only response was to begin
+wearing a small Star of David on a chain around my neck. I had not
+become a more observing Jew; rather, discovering that the label of
+Jew was offensive to others made me want to let people know who I
+was and what I believed in. Similarly, after talking to these young
+women -- one of whom told me that she didn't think she had ever met
+a feminist -- I've taken to identifying myself as a feminist in the
+most unlikely of situations.
+ -- Susan Bolotin, "Voices From the Post-Feminist Generation"
+%
+When neither their poverty nor their honor is
+touched, the majority of men live content.
+ -- Niccolo Machiavelli
+%
+When nothing can possibly go wrong, it will.
+%
+When one burns one's bridges, what a very nice fire it makes.
+ -- Dylan Thomas
+%
+When one knows women one pities men,
+but when one studies men, one excuses women.
+ -- Horne Tooke
+%
+When one wants to get rid of an unsupportable pressure, one needs hashish.
+ -- Friedrich Nietzsche
+%
+When one woman was asked how long she had been going to symphony concerts,
+she paused to calculate and replied, "Forty-seven years -- and I find I mind
+it less and less."
+ -- Louise Andrews Kent
+%
+When operating the diopter adjustment knob with your eye to the view-
+finder, be careful not to put your fingers or fingernails in your eye.
+ -- found in the users manual of the Nikon D2x camera,
+ a camera for professional photographers
+%
+When Oxygen Tech played Hydrogen U.
+The Game had just begun, when Hydrogen scored two fast points
+And Oxygen still had none
+Then Oxygen scored a single goal
+And thus it did remain, At Hydrogen 2 and Oxygen 1
+Called because of rain.
+%
+When people have trouble communicating,
+the least they can do is to shut up.
+ -- Tom Lehrer
+%
+When people say nothing, they don't necessarily mean nothing.
+%
+When pleasure remains, does it remain a pleasure?
+%
+When President Paul Doumer of France was assassinated in Paris in 1932,
+newspapers differed in their versions of the event. This is from "Paris
+was Yesterday: 1925-1939" by Janet Flanner, edited by Irving Drutman.
+
+ Taste varied as to his cry when he was shot down, the more popular
+ papers preferring his despairing "Oh, la la!," the graver dailies
+ favoring "Is it possible?" What few reported were his dying words:
+ "But what kind of chauffeur was it?" Having been told by his aides
+ not that he had been shot but that he had been struck by a taxi, the
+ President spent the last conscious moments of his life wondering how
+ an automobile got into the charity book sale at the Maison
+ Rothschild, where his assassination occurred.
+%
+When properly administered, vacations do not diminish productivity: for
+every week you're away and get nothing done, there's another when your boss
+is away and you get twice as much done.
+ -- Daniel B. Luten
+%
+When smashing monuments, save the pedestals -- they always come in handy.
+ -- Stanislaw J. Lec, "Unkempt Thoughts"
+%
+When some people decide it's time for everyone to make
+big changes, it means that they want you to change first.
+%
+When some people discover the truth, they just
+can't understand why everybody isn't eager to hear it.
+%
+When someone makes a move We'll send them all we've got,
+Of which we don't approve, John Wayne and Randolph Scott,
+Who is it that always intervenes? Remember those exciting fighting scenes?
+U.N. and O.A.S., To the shores of Tripoli,
+They have their place, I guess, But not to Mississippoli,
+But first, send the Marines! What do we do? We send the Marines!
+
+For might makes right, Members of the corps
+And till they've seen the light, All hate the thought of war:
+They've got to be protected, They'd rather kill them off by
+ peaceful means.
+All their rights respected, Stop calling it aggression--
+Till somebody we like can be elected. We hate that expression!
+ We only want the world to know
+ That we support the status quo;
+ They love us everywhere we go,
+ So when in doubt, send the Marines!
+ -- Tom Lehrer, "Send The Marines"
+%
+When someone says "I want a programming language in
+which I need only say what I wish done," give him a lollipop.
+%
+When speculation has done its worst, two plus two still equals four.
+ -- S. Johnson
+%
+When taxes are due, Americans tend to feel quite bled-white and blue.
+%
+When the Apple IIc was introduced, the informative copy led off with a couple
+of asterisked sentences:
+
+ It weighs less than 8 pounds.*
+ And costs less than $1,300.**
+
+In tiny type were these "fuller explanations":
+
+ * Don't asterisks make you suspicious as all get out? Well, all
+ this means is that the IIc alone weights 7.5 pounds. The power
+ pack, monitor, an extra disk drive, a printer and several bricks
+ will make the IIc weigh more. Our lawyers were concerned that you
+ might not be able to figure this out for yourself.
+
+ ** The FTC is concerned about price fixing. You can pay more if
+ you really want to. Or less.
+ -- Forbes
+%
+When the ax entered the forest, the trees said, "The handle is one of us!"
+ -- Turkish proverb
+%
+When the blind lead the blind they will both fall over the cliff.
+ -- Chinese proverb
+%
+When the bosses talk about improving productivity, they are never talking
+about themselves.
+%
+When the cup is full, carry it level.
+%
+When the doubt vanishes and the issue becomes evident, stupidity reigns.
+ -- Poul Henningsen (1894-1967)
+%
+When the English language gets in my way, I walk over it.
+ -- Billy Sunday
+%
+When the fog came in on little cat feet last night, it left these little
+muddy paw prints on the hood of my car.
+%
+When the going gets tough, the tough get empirical.
+ -- Jon Carroll
+%
+When the going gets tough, the tough go grab a beer.
+%
+When the going gets tough, the tough go shopping.
+%
+When the going gets weird, the weird turn pro.
+ -- Hunter S. Thompson
+%
+When the government bureau's remedies do not match
+your problem, you modify the problem, not the remedy.
+%
+When the Guru administers, the users
+are hardly aware that he exists.
+Next best is a sysop who is loved.
+Next, one who is feared.
+And worst, one who is despised.
+
+If you don't trust the users,
+you make them untrustworthy.
+
+The Guru doesn't talk, he hacks.
+When his work is done,
+the users say, "Amazing:
+we implemented it, all by ourselves!"
+%
+When the leaders speak of peace
+The common folk know
+That war is coming
+When the leaders curse war
+The mobilization order is already written out.
+
+Every day, to earn my daily bread
+I go to the market where lies are bought
+Hopefully
+I take my place among the sellers.
+ -- Bertolt Brecht, "Hollywood"
+%
+When the Ngdanga tribe of West Africa hold their moon love ceremonies,
+the men of the tribe bang their heads on sacred trees until they get a
+nose bleed, which usually cures them of _t_h_a_t.
+ -- Mike Harding, "The Armchair Anarchist's Almanac"
+%
+When the only tool you have is a hammer, every problem starts to look
+like a nail.
+%
+When the President does it, that means it is not illegal.
+ -- Richard M. Nixon
+%
+When the revolution comes, count your change.
+%
+When the salesman's car broke down, he walked to the nearest farmhouse to ask
+if he could stay the night. The farmer agreed to put him up. "I live alone,"
+he continued, "you can have the bedroom at the top of the stairs, to the
+right."
+ "Oh, never mind," the disappointed salesman said. "I think I'm in
+the wrong joke."
+%
+When the speaker and he to whom he is speaking do not understand, that is
+metaphysics.
+ -- Voltaire
+%
+When the sun shineth, make hay.
+ -- John Heywood
+%
+When the Universe was not so out of whack as it is today, and all the
+stars were lined up in their proper places, you could easily count them
+from left to right, or top to bottom, and the larger and bluer ones
+were set apart, and the smaller yellowing types pushed off to the
+corners as bodies of a lower grade ...
+ -- Stanislaw Lem, "Cyberiad"
+%
+When the usher noticed a man stretched across three seats in a movie theatre,
+he walked over and whispered, "I'm sorry, sir, but you're allowed only a single
+seat." The man moaned, but did not budge. "Sir," the user said more loudly,
+"if you don't move, I'll have to call a manager." The man moaned again but
+stayed where he was. The usher left, and returned with the manager, who, after
+several more attempts at dislodging the fellow, called the police.
+ The cop took a look at the reclining man and said, "All right, boyo,
+what's your name?"
+ "Samuel," he mumbled.
+ "And where're you from, Sam?"
+ "The balcony."
+%
+When the weight of the paperwork equals the weight of the plane, the
+plane will fly.
+ -- Donald Douglas
+%
+When the wind is great, bow before it;
+when the wind is heavy, yield to it.
+%
+When there are two conflicting versions of the story, the wise course
+is to believe the one in which people appear at their worst.
+ -- H. Allen Smith, "Let the Crabgrass Grow"
+%
+When there is an old maid in the house, a watch dog is unnecessary.
+ -- Honore de Balzac
+%
+When things go well, expect something to
+explode, erode, collapse or just disappear.
+%
+When two people are under the influence of the most violent, most
+insane, most delusive, and most transient of passions, they are
+required to swear that they will remain in that excited, abnormal, and
+exhausting condition continuously until death do them part.
+ -- George Bernard Shaw
+%
+When users see one GUI as beautiful,
+other user interfaces become ugly.
+When users see some programs as winners,
+other programs become lossage.
+
+Pointers and NULLs reference each other.
+High level and assembler depend on each other.
+Double and float cast to each other.
+High-endian and low-endian define each other.
+While and until follow each other.
+
+Therefore the Guru
+programs without doing anything
+and teaches without saying anything.
+Warnings arise and he lets them come;
+processes are swapped and he lets them go.
+He has but doesn't possess,
+acts but doesn't expect.
+When his work is done, he deletes it.
+That is why it lasts forever.
+%
+When we are planning for posterity,
+we ought to remember that virtue is not hereditary.
+ -- Thomas Paine
+%
+When we jumped into Sicily, the units became separated, and I couldn't find
+anyone. Eventually I stumbled across two colonels, a major, three captains,
+two lieutenants, and one rifleman, and we secured the bridge. Never in the
+history of war have so few been led by so many.
+ -- General James Gavin
+%
+When we talk of tomorrow, the gods laugh.
+%
+When we understand knowledge-based systems, it will be as before --
+except our fingertips will have been singed.
+ -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
+%
+When we write programs that "learn",
+it turns out we do and they don't.
+%
+When women kiss it always reminds one of prize fighters shaking hands.
+ -- H. L. Mencken, "Sententiae"
+%
+When women love us, they forgive us everything, even our crimes;
+when they do not love us, they give us credit for nothing, not
+even our virtues.
+ -- Honore de Balzac
+%
+When you are about to die, a wombat is better than no company at all.
+ -- Roger Zelazny, "Doorways in the Sand"
+%
+When you are about to do an objective and scientific piece of investigation
+of a topic, it is well to have the answer firmly in hand, so that you can
+proceed forthrightly, without being deflected or swayed, directly to the
+goal.
+ -- Amrom Katz
+%
+When you are at Rome live in the Roman style;
+when you are elsewhere live as they live elsewhere.
+ -- St. Ambrose
+%
+When you are in it up to your ears, keep your mouth shut.
+%
+When you are working hard, get up and retch every so often.
+%
+When you are young, you enjoy a sustained illusion that sooner or later
+something marvelous is going to happen, that you are going to transcend
+your parents' limitations... At the same time, you feel sure that in all
+the wilderness of possibility; in all the forests of opinion, there is a
+vital something that can be known -- known and grasped. That we will
+eventually know it, and convert the whole mystery into a coherent
+narrative. So that then one's true life -- the point of everything --
+will emerge from the mist into a pure light, into total comprehension.
+But it isn't like that at all. But if it isn't, where did the idea come
+from, to torture and unsettle us?
+ -- Brian Aldiss, "Helliconia Summer"
+%
+When you become used to never being alone,
+you may consider yourself Americanized.
+%
+When you dial a wrong number you never get a busy signal.
+%
+When you die, you lose a very important part of your life.
+ -- Brooke Shields
+%
+When you dig another out of trouble,
+you've got a place to bury your own.
+%
+When you don't know what to do, walk fast and look worried.
+%
+When you don't know what you are doing, do it neatly.
+%
+When you find yourself in danger,
+When you're threatened by a stranger,
+When it looks like you will take a lickin'...
+
+There is one thing you should learn,
+When there is no one else to turn to,
+ Caaaall for Super Chicken!! (**bwuck-bwuck-bwuck-bwuck**)
+ Caaaall for Super Chicken!!
+%
+When you get what you want in your struggle for pelf,
+And the world makes you King for a day,
+Then go to the mirror and look at yourself,
+And see what that guy has to say.
+ For it isn't your Father, or Mother, or Wife,
+ Who judgement upon you must pass.
+ The feller whose verdict counts most in your life
+ Is the guy staring back from the glass.
+He's the feller to please, never mind all the rest,
+For he's with you clear up to the end,
+And you've passed your most dangerous, difficult test
+If the guy in the glass is your friend.
+ You may be like Jack Horner and "chisel" a plum,
+ And think you're a wonderful guy,
+ But the man in the glass says you're only a bum
+ If you can't look him straight in the eye.
+You can fool the whole world down the pathway of years,
+And get pats on the back as you pass,
+But your final reward will be heartaches and tears
+If you've cheated the guy in the glass.
+ -- "The Guy in the Glass"
+ Copyright 1934, Dale Wimbrow (1895-1954)
+ [Pelf is a Middle English word for wealth or riches,
+ especially when acquired dishonestly. Ed.]
+%
+When you go into court you are putting your fate into the hands of twelve
+people who weren't smart enough to get out of jury duty.
+ -- Norm Crosby
+%
+When you go out to buy, don't show your silver.
+%
+When you have an efficient government, you have a dictatorship.
+ -- Harry S. Truman
+%
+When you have eliminated the impossible, whatever
+remains, however improbable, must be the truth.
+ -- Sherlock Holmes, "The Sign of Four"
+%
+When you have shot and killed a man you have in some measure
+clarified your attitude toward him. You have given a definite
+answer to a definite problem. For better or worse you have
+acted decisively. In a way, the next move is up to him.
+ -- R. A. Lafferty
+%
+When you have to kill a man it costs nothing to be polite.
+ -- Winston Churchill, on formal declarations of war
+%
+When you jump for joy, beware that no-one
+moves the ground from beneath your feet.
+ -- Stanislaw J. Lec, "Unkempt Thoughts"
+%
+When you know absolutely nothing about the topic, make your forecast by
+asking a carefully selected probability sample of 300 others who don't
+know the answer either.
+ -- Edgar R. Fiedler
+%
+When you live in a sick society,
+just about everything you do is wrong.
+%
+When you make your mark in the world,
+watch out for guys with erasers.
+ -- The Wall Street Journal
+%
+When you meet a master swordsman,
+show him your sword.
+When you meet a man who is not a poet,
+do not show him your poem.
+ -- Rinzai, ninth century Zen master
+%
+When you overesteem great hackers,
+more users become cretins.
+When you develop encryption,
+more users become crackers.
+
+The Guru leads
+by emptying user's minds
+and increasing their quotas,
+by weakening their ambition
+and toughening their resolve.
+When users lack knowledge and desire,
+management will not try to interfere.
+
+Practice not-looping,
+and everything will fall into place.
+%
+When you say that you agree to a thing in principle, you mean that
+you have not the slightest intention of carrying it out in practice.
+ -- Otto von Bismarck
+%
+When you speak to others for their own good it's advice;
+when they speak to you for your own good it's interference.
+%
+When you try to make an impression, the
+chances are that is the impression you will make.
+%
+When you were born, a big chance was taken for you.
+%
+When your conscious becomes unconscious, you are drunk.
+When your unconscious becomes conscious, you are stoned.
+%
+When your life is a leaf that the seasons tear off and condemn
+They will bind you with love that is graceful and green as a stem.
+ -- Leonard Cohen, "Sisters of Mercy"
+%
+When your memory goes, forget it!
+%
+When your work speaks for itself, don't interrupt.
+ -- Henry J. Kaiser
+%
+When you're a Yup
+You're a Yup all the way
+From your first slice of Brie
+To your last Cabernet.
+
+When you're a Yup
+You're not just a dreamer
+You're making things happen
+You're driving a Beamer.
+%
+When you're away, I'm restless, lonely
+Wretched, bored, dejected, only
+Here's the rub, my darling dear,
+I feel the same when you are near.
+ -- Samuel Hoffenstein, "Poems in Praise of Practically Nothing"
+%
+When you're bored with yourself, marry, and be bored with someone else.
+ -- David Pryce-Jones
+%
+When you're dining out and you suspect
+something's wrong, you're probably right.
+%
+When you're down and out, lift up your
+voice and shout, "I'M DOWN AND OUT"!
+%
+When you're in command, command.
+ -- Admiral Nimitz
+%
+When you're married to someone, they take you for granted ... when
+you're living with someone it's fantastic ... they're so frightened
+of losing you they've got to keep you satisfied all the time.
+ -- Nell Dunn, "Poor Cow"
+%
+When you're not looking at it, this fortune is written in FORTRAN.
+%
+When you're ready to give up the struggle, who can you surrender to?
+%
+WHEN YOU'RE RIDING IN A TIME MACHINE way far into the future, don't stick
+your elbow out the window or it'll turn into a fossil.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+WHENEVER ANYBODY SAYS he's struggling to become a human being I have to
+laugh because the apes beat him to it by about a million years. Struggle
+to become a parrot or something.
+ -- Jack Handey, "The New Mexican" (1988)
+%
+Whenever anyone says, "theoretically," they really mean "not really".
+ -- Dave Parnas
+%
+Whenever I date a guy, I think, is this the man I want my children
+to spend their weekends with?
+ -- Rita Rudner
+%
+Whenever I feel like exercise, I lie down until the feeling passes.
+%
+Whenever I hear anyone arguing for slavery, I feel
+a strong impulse to see it tried on him personally.
+ -- Abraham Lincoln
+%
+Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct
+is to laugh. But then I think, what if I was an ant, and she fell on me.
+Then it wouldn't seem quite so funny.
+ -- Jack Handey
+%
+Whenever people agree with me I always feel I must be wrong.
+ -- Oscar Wilde
+%
+Whenever Richard Cory went downtown,
+ We people on the pavement looked at him:
+He was a gentleman from sole to crown,
+ Clean-favored, and imperially slim.
+And he was always quietly arrayed,
+ And he was always human when he talked;
+But still he fluttered pulses when he said,
+ "Good morning," and he glittered when he walked.
+And he was rich -- yes, richer than a king --
+ And admirably schooled in every grace:
+In fine, we thought that he was everything
+ To make us wish that we were in his place.
+So on we worked, and waited for the light,
+ And went without the meat, and cursed the bread;
+And Richard Cory, one calm summer night,
+ Went home and put a bullet through his head.
+ -- E. A. Robinson, "Richard Cory"
+%
+Whenever someone tells you to take their advice,
+you can be pretty sure that they're not using it.
+%
+Whenever the literary German dives into a sentence, that is the last
+you are going to see of him until he emerges on the other side of his
+Atlantic with his verb in his mouth.
+ -- Mark Twain
+ "Connecticut Yankee in King Arthur's Court"
+%
+Whenever you find that you are on the
+side of the majority, it is time to reform.
+ -- Mark Twain
+%
+Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and
+weighs 30 tons, computers in the future may have only 1,000 vacuum tubes
+and perhaps weigh 1 1/2 tons.
+ -- Popular Mechanics, March 1949
+%
+Where am I? Who am I? Am I? I
+%
+Where am I, and what am I doing in this handbasket?
+ -- Mark A. Matthews, to Wes Peters, circa 1996
+%
+Where are the calculations that go with a calculated risk?
+%
+WHERE CAN THE MATTER BE
+ Oh, dear, where can the matter be
+ When it's converted to energy?
+ There is a slight loss of parity.
+ Johnny's so long at the fair.
+%
+Where do I find the time for not reading so many books?
+ -- Karl Kraus
+%
+Where do you go to get anorexia?
+ -- Shelley Winters
+%
+Where humor is concerned there are no standards -- no one can say what
+is good or bad, although you can be sure that everyone will.
+ -- John Kenneth Galbraith
+%
+Where is John Carson now that we need him?
+ -- RLG
+%
+Where it is a duty to worship the sun it is pretty sure to be a crime to
+examine the laws of heat.
+ -- Christopher Morley
+%
+Where, oh, where, are you tonight?
+Why did you leave me here all alone?
+I searched the world over, and I thought I'd found true love.
+You met another, and *PPHHHLLLBBBBTTT*, you wuz gone.
+
+Gloom, despair and agony on me.
+Deep dark depression, excessive misery.
+If it weren't for bad luck, I'd have no luck at all.
+Oh, gloom, despair and agony on me.
+ -- Hee Haw
+%
+Where the hell is Wall Drug?
+%
+Where the system is concerned, you're not allowed to ask "Why?".
+%
+Where there are visible vapors, having their prevenance
+in ignited carbonaceous materials, there is conflagration.
+%
+Where there is much light there is also much shadow.
+ -- Johann Wolfgang von Goethe
+%
+Where there's a whip there's a way.
+%
+Where there's a will, there's a relative.
+%
+Where there's a will, there's an Inheritance Tax.
+%
+Where will it all end?
+Probably somewhere near where it all began.
+%
+Where you stand depends on where you sit.
+ -- Rufus Miles, HEW
+%
+Whereof one cannot speak, thereof one must be silent.
+ -- Wittgenstein
+%
+Where's the man could ease a heart
+Like a satin gown?
+ -- Dorothy Parker, "The Satin Dress"
+%
+...whether it is better to spend a life not knowing what you want or to
+spend a life knowing exactly what you want and that you will never have it.
+ -- Richard Shelton
+%
+Whether weary or unweary, O man, do not rest,
+Do not cease your single-handed struggle.
+Go on, do not rest.
+ -- An old Gujarati hymn
+%
+Whether you can hear it or not
+The Universe is laughing behind your back
+ -- National Lampoon, "Deteriorata"
+%
+Which is worse: ignorance or apathy? Who knows? Who cares?
+%
+Which would you rather have, a bursting
+planet or an earthquake here and there?
+ -- John Joseph Lynch
+%
+While anyone can admit to themselves they were
+wrong, the true test is admission to someone else.
+%
+While Europe's eye is fix'd on mighty things,
+The fate of empires and the fall of kings;
+While quacks of State must each produce his plan,
+And even children lisp the Rights of Man;
+Amid this mighty fuss just let me mention,
+The Rights of Woman merit some attention.
+ -- Robert Burns, Address on "The Rights of Woman",
+ November 26, 1792
+%
+While having never invented a sin,
+I'm trying to perfect several.
+%
+While he was in New York on location for _Bronco Billy_ (1980), Clint
+Eastwood agreed to a television interview. His host, somewhat hostile,
+began by defining a Clint Eastwood picture as a violent, ruthless,
+lawless, and bloody piece of mayhem, and then asked Eastwood himself to
+define a Clint Eastwood picture. "To me," said Eastwood calmly, "what
+a Clint Eastwood picture is, is one that I'm in."
+ -- Boller and Davis, "Hollywood Anecdotes"
+%
+While I nodded, nearly napping, suddenly there came a tapping,
+As of some one gently rapping, rapping at my chamber door.
+ -- Edgar Allan Poe, "The Raven"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to hardware interrupts.]
+
+And now I see with eye serene
+The very pulse of the machine.
+ -- William Wordsworth, "She Was a Phantom of Delight"
+
+ [Quoted in "VMS Internals and Data Structures", V4.4, when
+ referring to software interrupts.]
+%
+While it may be true that a watched pot never boils, the one you don't
+keep an eye on can make an awful mess of your stove.
+ -- Edward Stevenson
+%
+While money can't buy happiness, it certainly
+lets you choose your own form of misery.
+%
+While most peoples' opinions change,
+the conviction of their correctness never does.
+%
+While passing a vacant lot late one night, a jogger was stopped by a man who
+held a gun to his head.
+ "Who are you for," the gunman snarled, "Bush or Dukakis?"
+ The runner thought for a moment, shifting nervously from foot to foot,
+as the muzzle pressed harder into his temple.
+ "Bush or Dukakis?" the mugger insisted.
+ Finally, the jogger shrugged his shoulders, closed his eyes and bowed
+his head. "Go ahead and shoot."
+%
+While there's life, there's hope.
+ -- Publius Terentius Afer (Terence)
+%
+While walking down a crowded
+City street the other day,
+I heard a little urchin
+To a comrade turn and say,
+"Say, Chimmey, lemme tell youse,
+I'd be happy as a clam
+If only I was de feller dat
+Me mudder t'inks I am.
+
+"She t'inks I am a wonder, My friends, be yours a life of toil
+An' she knows her little lad Or undiluted joy,
+Could never mix wit' nuttin' You can learn a wholesome lesson
+Dat was ugly, mean or bad. From that small, untutored boy.
+Oh, lot o' times I sit and t'ink Don't aim to be an earthly saint
+How nice, 'twould be, gee whiz! With eyes fixed on a star:
+If a feller was de feller Just try to be the fellow that
+Dat his mudder t'inks he is." Your mother thinks you are.
+ -- Will S. Adkin, "If I Only Was the Fellow"
+%
+While we are sleeping, two-thirds of the world is plotting to do us in.
+ -- Dean Rusk
+%
+While you don't greatly need the outside world, it's
+still very reassuring to know that it's still there.
+%
+While you recently had your problems on the run,
+they've regrouped and are making another attack.
+%
+While your friend holds you affectionately by both your hands you are
+safe, for you can watch both of his.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Whip it, whip it good!
+%
+Whistler's Law:
+ You never know who is right, but you always know who is in charge.
+%
+Whistler's mother is off her rocker.
+%
+White dwarf seeks red giant for binary relationship.
+%
+Whitehead's Law:
+ The obvious answer is always overlooked.
+%
+White's Statement:
+ Don't lose heart!
+
+Owen's Commentary on White's Statement:
+ ...they might want to cut it out...
+
+Byrd's Addition to Owen's Commentary:
+ ...and they want to avoid a lengthy search.
+%
+Who are you?
+%
+Who can take the demands of the SDS seriously?
+ -- Nathan Pusey
+%
+Who cares if it doesn't do anything? It was made with
+our new Triple-Iso-Bifurcated-Krypton-Gate-MOS process...
+%
+Who dat who say "who dat" when I say "who dat"?
+ -- Hattie McDaniel
+%
+Who does not love wine, women, and song,
+Remains a fool his whole life long.
+ -- Johann Heinrich Voss
+%
+Who does not trust enough will not be trusted.
+ -- Lao Tsu
+%
+Who goeth a-borrowing goeth a-sorrowing.
+ -- Thomas Tusser
+%
+Who is D. B. Cooper, and where is he now?
+%
+Who is John Galt?
+%
+Who is W. O. Baker, and why is he saying those terrible things about me?
+%
+Who loves me will also love my dog.
+ -- John Donne
+%
+Who loves not wisely but too well
+Will look on Helen's face in hell,
+But he whose love is thin and wise
+Will view John Knox in Paradise.
+ -- Dorothy Parker
+%
+Who made the world I cannot tell;
+'Tis made, and here am I in hell.
+My hand, though now my knuckles bleed,
+I never soiled with such a deed.
+ -- A. E. Housman
+%
+Who messed with my anti-paranoia shot?
+%
+Who needs friends when you can sit alone in your room and drink?
+%
+Who on earth would eat a charred caterpillar!?
+No, no, you SINGE 'em! You SINGE 'em and eat 'em!
+%
+Who the hell wants to hear actors talk?
+ -- Harry Warner, Warner Bros. Pictures, c. 1927
+%
+Who to himself is law no law doth need,
+offends no law, and is a king indeed.
+ -- George Chapman
+%
+Who took the MMMMMM out of MURINE?
+%
+Who was that masked man?
+%
+Who will take care of the world after you're gone?
+%
+Whoever dies with the most toys wins.
+%
+Whoever fights monsters should see to it that in the process he does not
+become a monster. And when you look into an abyss, the abyss also looks
+into you.
+ -- Friedrich Nietzsche
+%
+Whoever named it "necking" was a poor judge of anatomy.
+ -- Groucho Marx
+%
+Whoever tells a lie cannot be pure in heart -- and only the
+pure in heart can make a good soup.
+ -- Ludwig van Beethoven
+%
+Whoever would lie usefully should lie seldom.
+%
+"Whom are you?" said he, for he had been to night school.
+ -- George Ade
+%
+Whom computers would destroy, they must first drive insane.
+%
+Whom the gods wish to destroy they first call promising.
+%
+Whom the mad would destroy, first they make Gods.
+ -- Bernard Levin
+%
+Who's on first?
+%
+Who's scruffy-looking?
+ -- Han Solo
+%
+Why a man would want a wife is a big mystery to some people.
+Why a man would want *two* wives is a bigamystery.
+%
+Why am I so soft in the middle when the rest of my life is so hard?
+ -- Paul Simon
+%
+Why are programmers non-productive?
+Because their time is wasted in meetings.
+
+Why are programmers rebellious?
+Because the management interferes too much.
+
+Why are the programmers resigning one by one?
+Because they are burnt out.
+
+Having worked for poor management, they no longer value their jobs.
+ -- Geoffrey James, "The Tao of Programming"
+%
+Why are we importing all these highbrow plays like "Amadeus?" I could
+have told you Mozart was a jerk for nothing.
+ -- Ian Shoales
+%
+Why are you so hard to ignore?
+%
+Why are you watching
+The washing machine?
+I love entertainment
+So long as it's clean.
+
+Professor Doberman:
+ While the preceding poem is unarguably a change from the guarded
+pessimism of "The Hound of Heaven," it cannot be regarded as an unqualified
+improvement. Obscurity is of value only when it tends to clarify the poetic
+experience. As much as one is compelled to admire the poem's technique, one
+must question whether its byplay of complex literary allusions does not in
+fact distract from the unity of the whole. In the final analysis, one
+receives the distinct impression that the poem's length could safely have
+been reduced by a factor of eight or ten without sacrificing any of its
+meaning. It is to be hoped that further publication of this poem can be
+suspended pending a thorough investigation of its potential subversive
+implications.
+%
+Why attack God? He may be as miserable as we are.
+ -- Erik Satie
+%
+Why be a man when you can be a success?
+ -- Bertolt Brecht
+%
+Why be difficult, when, with just a
+little more effort, you can be impossible?
+%
+Why bother building anymore nuclear
+warheads until we use the ones we have?
+%
+Why can't you be a non-conformist like everyone else?
+%
+Why did the Lord give us so much quickness of
+movement unless it was to avoid responsibility with?
+%
+Why did the Roman Empire collapse? What is the Latin for office
+automation?
+%
+Why do mathematicians insist on using words that already have another
+meaning? "It is the complex case that is easier to deal with." "If it
+doesn't happen at a corner, but at an edge, it nonetheless happens at a
+corner."
+%
+Why do seagulls live near the sea?
+'Cause if they lived near the bay, they'd be called baygulls.
+%
+Why do so many foods come packaged in plastic?
+It's quite uncanny.
+%
+Why do they call a fast a fast, when it goes so slow?
+%
+Why do they call it baby-SITTING when all you do is run after them?
+%
+Why do we have two eyes? To watch 3-D movies with.
+%
+Why do we want intelligent terminals
+when there are so many stupid users?
+%
+Why does a hearse horse snicker, hauling a lawyer away?
+ -- Carl Sandburg
+%
+Why does a ship carry cargo and a truck carry shipments?
+%
+Why does man kill? He kills for food.
+And not only food: frequently there must be a beverage.
+ -- Woody Allen, "Without Feathers"
+%
+Why does New Jersey have more toxic waste dumps and California have
+more lawyers?
+
+New Jersey had first choice.
+%
+Why doesn't everybody leave everybody else the hell alone?
+ -- Jimmy Durante
+%
+Why don't elephants eat penguins ?
+
+Because they can't get the wrappers off ...
+%
+Why don't somebody print the truth about our present economic condition?
+We spent years of wild buying on credit, everything under the sun, whether
+we needed it or not, and now we are having to pay for it, howling like a
+pet coon. This would be a great world to dance in if we didn't have to
+pay the fiddler.
+ -- The Best of Will Rogers
+%
+Why don't you fix your little problem... and light this candle?
+ -- Alan Shepard, the first American into space, Gemini program
+%
+Why, every one as they like; as the good woman said when she
+kissed her cow.
+ -- Rabelais
+%
+Why I Can't Go Out With You:
+
+I'd LOVE to, but...
+ -- I have to answer all of my "occupant" letters.
+ -- None of my socks match.
+ -- I'm having all my plants neutered.
+ -- I changed the lock on my door and now I can't get out.
+ -- My yucca plant is feeling yucky.
+ -- I'm touring China with a wok band.
+ -- My chocolate-appreciation class meets that night.
+ -- I'm running off to Yugoslavia with a foreign-exchange student
+ named Basil Metabolism.
+ -- There are important world issues that need worrying about.
+ -- I'm going to count the bristles in my toothbrush.
+ -- I prefer to remain an enigma.
+ -- I think you want the OTHER Peggy/Cathy/Mike/whomever.
+ -- I feel a song coming on.
+%
+Why I Can't Go Out With You:
+
+I'd LOVE to, but...
+ -- I have to draw "Cubby" for an art scholarship.
+ -- I have to sit up with a sick ant.
+ -- I'm trying to be less popular.
+ -- My bathroom tiles need grouting.
+ -- I'm waiting to see if I'm already a winner.
+ -- My subconscious says no.
+ -- I just picked up a book called "Glue in Many Lands" and I
+ can't seem to put it down.
+ -- My favorite commercial is on TV.
+ -- I have to study for my blood test.
+ -- I've been traded to Cincinnati.
+ -- I'm having my baby shoes bronzed.
+ -- I have to go to court for kitty littering.
+%
+Why I Can't Go Out With You:
+
+I'd LOVE to, but...
+ -- I have to floss my cat.
+ -- I've dedicated my life to linguini.
+ -- I need to spend more time with my blender.
+ -- It wouldn't be fair to the other Beautiful People.
+ -- It's my night to pet the dog/ferret/goldfish/radio.
+ -- I'm going downtown to try on some gloves.
+ -- I have to check the freshness dates on my dairy products.
+ -- I'm due at the bakery to watch the buns rise.
+ -- I have an appointment with a cuticle specialist.
+ -- I have some really hard words to look up.
+%
+Why I Can't Go Out With You:
+
+I'd LOVE to, but...
+ -- I'm trying to see how long I can go without saying yes.
+ -- I'm attending the opening of my garage door.
+ -- The monsters haven't turned blue yet, and I have to eat more dots.
+ -- I'm converting my calendar watch from Julian to Gregorian.
+ -- I have to fulfill my potential.
+ -- I don't want to leave my comfort zone.
+ -- It's too close to the turn of the century.
+ -- I have to bleach my hare.
+ -- I'm worried about my vertical hold knob.
+ -- I left my body in my other clothes.
+%
+Why I Can't Go Out With You:
+
+I'd LOVE to, but...
+ -- I've got a Friends of the Lowly Rutabaga meeting.
+ -- I promised to help a friend fold road maps.
+ -- I've been scheduled for a karma transplant.
+ -- I'm staying home to work on my cottage cheese sculpture.
+ -- It's my parakeet's bowling night.
+ -- I'm building a plant from a kit.
+ -- There's a disturbance in the Force.
+ -- I'm doing door-to-door collecting for static cling.
+ -- I'm teaching my ferret to yodel.
+ -- My crayons all melted together.
+%
+Why is it called a funny bone when it hurts so much?
+%
+Why is it taking so long for her to bring out all the good in you?
+%
+Why is it that we rejoice at a birth and grieve at a funeral?
+It is because we are not the person involved.
+ -- Mark Twain
+%
+Why is the alphabet in that order? Is it because of that song?
+ -- Steven Wright
+%
+Why isn't there a special name for the tops of your feet?
+ -- Lily Tomlin
+%
+Why isn't there some cheap and easy
+way to prove how much she means to me?
+%
+Why must you tell me all your secrets when it's hard enough to love
+you knowing nothing?
+ -- Lloyd Cole and the Commotions
+%
+Why my thoughts are my own, when they are in, but when they are out they
+are another's.
+ -- Susanna Martin, executed for witchcraft, 1681
+%
+Why not? -- What? -- Why not? -- Why should I not send it? -- Why should I
+not dispatch it? -- Why not? -- Strange! I don't know why I shouldn't --
+Well, then -- You will do me this favor. -- Why not? -- Why should you not
+do it? -- Why not? -- Strange! I shall do the same for you, when you want
+me to. Why not? Why should I not do it for you? Strange! Why not? --
+I can't think why not.
+ -- Wolfgang Amadeus Mozart, from a letter to his cousin Maria,
+ "The Definitive Biography of PDQ Bach", Peter Schickele
+%
+Why not go out on a limb?
+Isn't that where the fruit is?
+%
+Why not have an old-fashioned Christmas for your family this year?
+Just picture the scene in your living room on Christmas morning as your
+children open their old-fashioned presents.
+
+Your 11-year-old son: "What the heck is this?"
+
+You: "A spinning top! You spin it around, and then eventually it
+ falls down. What fun! Ha, ha!"
+
+Son: "Is this a joke? Jason Thompson's parents got him a computer
+ with two disk drives and 128 kilobytes of random-access memory,
+ and I get this cretin TOP?"
+
+Your 8-year-old daughter: "You think that's bad? Look at this."
+
+You: "It's figgy pudding! What a treat!"
+
+Daughter: "It looks like goat barf."
+ -- Dave Barry, "Simple, Homespun Gifts"
+%
+Why on earth do people buy old bottles of wine when they can get a
+fresh one for a quarter of the price?
+%
+Why was I born with such contemporaries?
+ -- Oscar Wilde
+%
+Why, when no honest man will deny in private that every ultimate problem is
+wrapped in the profoundest mystery, do honest men proclaim in pulpits that
+unhesitating certainty is the duty of the most foolish and ignorant? Is it
+not a spectacle to make the angels laugh? We are a company of ignorant
+beings, feeling our way through mists and darkness, learning only be
+incessantly repeated blunders, obtaining a glimmering of truth by falling
+into every conceivable error, dimly discerning light enough for our daily
+needs, but hopelessly differing whenever we attempt to describe the ultimate
+origin or end of our paths; and yet, when one of us ventures to declare that
+we don't know the map of the universe as well as the map of our infinitesimal
+parish, he is hooted, reviled, and perhaps told that he will be damned to all
+eternity for his faithlessness.
+ -- Leslie Stephen, "An Agnostic's Apology",
+ Fortnightly Review, 1876
+%
+Why won't you let me kiss you goodnight? Is it something I said?
+ -- Tom Ryan
+%
+Why would anyone want to be called "Later"?
+%
+Why You Can't Run When There's Trouble in the Office:
+ No matter where you stand, no matter how far or fast you flee,
+when it hits the fan, as much as possible will be propelled in your
+direction, and almost none will be returned to the source.
+ -- John L. Shelton
+%
+Why you say you no bunny rabbit when you have little powder-puff tail?
+ -- The Tasmanian Devil
+%
+Wiker's Law:
+ Government expands to absorb all
+ available revenue and then some.
+%
+Wilcox's Law:
+ A pat on the back is only a few
+ centimeters from a kick in the pants.
+%
+Will Rogers never met you.
+%
+Will you loan me $20.00 and only give me ten of it?
+That way, you will owe me ten, and I'll owe you ten, and we'll be even!
+%
+Will your long-winded speeches never end?
+What ails you that you keep on arguing?
+ -- Job 16:3
+%
+Williams and Holland's Law:
+ If enough data is collected,
+ anything may be proven by statistical methods.
+%
+Willie in the cauldron fell; Willie saw some dynamite,
+See the grief on mother's brow; Couldn't understand it quite;
+Mother loved her darling well -- Curiosity never pays:
+Willie's quite hard-boiled by now. It rained Willie seven days.
+
+Little Willie with a shout, William in a nice new sash,
+Gouged the baby's eyeballs out; Fell in the fire and burned to an ash.
+Stamped on them to make them pop. Now, although the room grows chilly,
+Mother cried, "Now, William, stop!" I haven't the heart to poke poor Billy.
+
+William with a thirst for gore, Little Willie mean as hell,
+Nailed the baby to the door. Threw his sister in the well!
+Mother said, with humor quaint: Said his mother when drawing water,
+"Careful, Will, don't mar the paint." "sure is hard to raise a daughter."
+ -- Harry Graham, "Ruthless Rhymes for Heartless Homes", 1899
+%
+Wilner's Observation:
+ All conversations with a potato should be conducted in private.
+%
+Winning isn't everything. It's the only thing.
+ -- Vince Lombardi
+%
+Winning isn't everything, but losing isn't anything.
+%
+Winny and I lived in a house that ran on static electricity...
+If you wanted to run the blender, you had to rub balloons on your
+head... if you wanted to cook, you had to pull off a sweater real quick...
+ -- Steven Wright
+%
+Winter is nature's way of saying, "Up yours."
+ -- Robert Byrne
+%
+Winter is the season in which people try to keep the house
+as warm as it was in the summer, when they complained about the heat.
+%
+[Wisdom] is a tree of life to those laying
+hold of her, making happy each one holding her fast.
+ -- Proverbs 3:18, NSV
+%
+Wisdom is knowing what to do with what you know.
+ -- J. Winter Smith
+%
+Wisdom is rarely found on the best-seller list.
+%
+Wishing without work is like fishing without bait.
+ -- Frank Tyger
+%
+Wit, n.:
+ The salt with which the American Humorist spoils his cookery...
+ by leaving it out.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+With a gentleman I try to be a gentleman and a half, and with a fraud I
+try to be a fraud and a half.
+ -- Otto von Bismarck
+%
+With a rubber duck, one's never alone.
+ -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
+%
+With all the fancy scientists in the world,
+why can't they just once build a nuclear balm.
+%
+With all the talent around, it's sort of
+amazing that a woman could be up here with us.
+ -- Ralph Kiner, on introducing an award winner
+%
+With clothes the new are best, with friends the old are best.
+%
+With Congress, every time they make a joke it's a law; and every time
+they make a law it's a joke.
+ -- W. Rogers
+%
+With every passing hour our solar system comes forty-three thousand
+miles closer to globular cluster M13 in the constellation Hercules,
+and still there are some misfits who continue to insist that there
+is no such thing as progress.
+ -- Ransom K. Ferm
+%
+With her body, woman is more sincere than man; but with her mind
+she lies. And when she lies, she does not believe herself.
+ -- Tolstoy
+%
+With listening comes wisdom, with speaking repentance.
+%
+With reasonable men I will reason;
+with humane men I will plead;
+but to tyrants I will give no quarter.
+ -- William Lloyd Garrison
+%
+With the end of the football season, a star player for the college team
+celebrated the relaxation of team curfew by attending a late-night campus
+party. Soon after arriving, he became captivated by a beautiful coed and
+eased into a conversation with her by asking if she met many dates at
+parties.
+ "Oh, I have a three point eight, so I'm much more attracted to the
+strong academic types than to the dumb party animals," she said. "What's
+your G.P.A.?"
+ Grinning ear to ear, the jock boasted, "I get about twenty-five in
+the city and forty on the highway."
+%
+With women, I've got a long bamboo pole with a leather loop on the end of
+it. I slip the loop around their necks so they can't get away or come too
+close. Like catching snakes.
+ -- Marlon Brando
+%
+Within a computer, natural language is unnatural.
+%
+Within a month [in 1969] I had met the first of a small but not uninfluential
+community of people who violently opposed SALT for a simple reason: It might
+keep America from developing a first-strike capability against the Soviet
+Union. I'll never forget being lectured by an Air Force colonel about how
+we should have "nuked" the Soviets in late 1940s before they got The Bomb.
+I was told that if SALT would go away, we'd soon have the capability to nuke
+them again -- and this time we'd use it.
+ -- Roger Molander, former nuclear strategist for the
+ White House's National Security Council, Washington
+ Post, 21 March, 1982
+%
+Without adventure, civilization is in full decay.
+ -- Alfred North Whitehead
+%
+Without coffee he could not work, or at least he could not have worked in the
+way he did. In addition to paper and pens, he took with him everywhere as an
+indispensable article of equipment the coffee machine, which was no less
+important to him than his table or his white robe.
+ -- Stefan Zweigs, Biography of Balzac
+%
+Without fools there would be no wisdom.
+%
+Without ice cream life and fame are meaningless.
+%
+Without life, Biology itself would be impossible.
+%
+Without love intelligence is dangerous;
+without intelligence love is not enough.
+ -- Ashley Montagu
+%
+With/Without - and who'll deny it's what the fighting's all about?
+ -- Pink Floyd
+%
+Woke up this mornin' an' I had myself a beer,
+Yeah, Ah woke up this mornin' an' I had myself a beer
+The future's uncertain and the end is always near.
+ -- Jim Morrison, "Roadhouse Blues"
+%
+Woke up this morning, don't believe what I saw. Hundred billion
+bottles washed up on the shore. Seems I never noted being alone.
+Hundred billion castaways looking for a call.
+%
+WOLF:
+ A man who knows all the ankles.
+%
+Woman: "Is Yoo-Hoo hyphenated?"
+Yogi Berra: "No, ma'am, its not even carbonated."
+%
+Woman inspires us to great things, and prevents us from achieving them.
+ -- Dumas
+%
+Woman is generally so bad that the difference
+between a good and a bad woman scarcely exists.
+ -- Tolstoy
+%
+Woman, n.:
+ An animal usually living in the vicinity of Man, and
+ having a rudimentary susceptibility to domestication.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Woman on Street: Sir, you are drunk; very, very drunk.
+Winston Churchill: Madame, you are ugly; very, very ugly.
+ I shall be sober in the morning.
+%
+Woman was taken out of man -- not out of his head, to rule over him; nor
+out of his feet, to be trampled under by him; but out of his side, to be
+equal to him -- under his arm, that he might protect her, and near his heart
+that he might love her.
+ -- Henry
+%
+Woman would be more charming if one could
+fall into her arms without falling into her hands.
+ -- DeGourmont
+%
+Woman's advice has little value, but he who won't take it is a fool.
+ -- Cervantes
+%
+Wombat's Laws of Computer Selection:
+ (1) If it doesn't run Unix, forget it.
+ (2) Any computer design over 10 years old is obsolete.
+ (3) Anything made by IBM is junk. (See number 2)
+ (4) The minimum acceptable CPU power for a single user is a
+ VAX/780 with a floating point accelerator.
+ (5) Any computer with a mouse is worthless.
+ -- Rich Kulawiec
+%
+Women are a problem, but if you haven't already guessed,
+they're the kind of problem I enjoy wrestling with.
+ -- Warren Beatty
+%
+Women are all alike. When they're maids they're mild as milk:
+once make 'em wives, and they lean their backs against their
+marriage certificates, and defy you.
+ -- Jerrold
+%
+Women are always anxious to urge bachelors to matrimony; is it
+from charity, or revenge?
+ -- Gustave Vapereau
+%
+Women are just like men, only different.
+%
+Women are like elephants to me: I like to
+look at them, but I wouldn't want to own one.
+ -- W. C. Fields
+%
+Women are not much, but they are the best other sex we have.
+ -- Herold
+%
+Women are nothing but machines for producing children.
+ -- Napoleon
+%
+Women are wiser than men because they know less and understand more.
+ -- Stephens
+%
+Women aren't as mere as they used to be.
+ -- Pogo
+%
+Women can keep a secret just as well as men,
+but it takes more of them to do it.
+%
+Women come and go, but BSD is forever.
+ -- Derek Young
+%
+Women complain about sex more than men. Their gripes fall into two
+categories: (1) Not enough and (2) Too much.
+ -- Ann Landers
+%
+Women, deceived by men, want to marry them; it is a kind of revenge
+as good as any other.
+ -- Philippe De Remi
+%
+Women give themselves to God when the
+Devil wants nothing more to do with them.
+ -- Arnould
+%
+Women give to men the very gold of their lives. Possibly;
+but they invariably want it back in such very small change.
+ -- Wilde
+%
+Women in love consist of a little sighing, a little
+crying, a little dying -- and a good deal of lying.
+ -- Ansey
+%
+Women of genius commonly have masculine faces, figures and manners.
+In transplanting brains to an alien soil God leaves a little of the
+original earth clinging to the roots.
+ -- Ambrose Bierce
+%
+Women reason with the heart and are much less often wrong
+than men who reason with the head.
+ -- DeLescure
+%
+Women sometimes forgive a man who forces the opportunity,
+but never a man who misses one.
+ -- Charles De Talleyrand-Perigord
+%
+Women treat us just as humanity treats its gods. They worship
+us and are always bothering us to do something for them.
+ -- Wilde
+%
+Women want their men to be cops. They want you to punish them and tell
+them what the limits are. The only thing that women hate worse from a man
+than being slapped is when you get on your knees and say you're sorry.
+ -- Mort Sahl
+%
+Women waste men's lives and think they have
+indemnified them by a few gracious words.
+ -- Honore de Balzac
+%
+Women, when they are not in love, have all
+the cold blood of an experienced attorney.
+ -- Honore de Balzac
+%
+Women, when they have made a sheep of a man,
+always tell him that he is a lion with a will of iron.
+ -- Honore de Balzac
+%
+Women who want to be equal to men lack imagination.
+%
+Women wish to be loved without a why or a wherefore;
+not because they are pretty, or good, or well-bred, or
+graceful, or intelligent, but because they are themselves.
+ -- Amiel
+%
+Women's Libbers are OK, I just wouldn't want my sister to marry one.
+%
+Women's virtue is man's greatest invention.
+ -- Cornelia Otis Skinner
+%
+Wonder is the feeling of a philosopher,
+and philosophy begins in wonder.
+ Socrates, quoting Plato
+%
+Wonderful day.
+Your hangover just makes it seem terrible.
+%
+Wood is highly ecological, since trees are a renewable resource. If
+you cut down a tree, another will grow in its place. And if you cut
+down the new tree, still another will grow. And if you cut down that
+tree, yet another will grow, only this one will be a mutation with
+long, poisonous tentacles and revenge in its heart, and it will sit
+there in the forest, cackling and making elaborate plans for when you
+come back.
+
+Wood heat is not new. It dates back to a day millions of years ago,
+when a group of cavemen were sitting around, watching dinosaurs rot.
+Suddenly, lightning struck a nearby log and set it on fire. One of the
+cavemen stared at the fire for a few minutes, then said: "Hey! Wood
+heat!" The other cavemen, who did not understand English, immediately
+beat him to death with stones. But the key discovery had been made,
+and from that day forward, the cavemen had all the heat they needed,
+although their insurance rates went way up.
+ -- Dave Barry, "Postpetroleum Guzzler"
+%
+Woodward's Law:
+ A theory is better than its explanation.
+%
+Woody: What's the story, Mr. Peterson?
+Norm: The Bobbsey twins go to the brewery.
+ Let's just cut to the happy ending.
+ -- Cheers, Airport V
+
+Woody: Hey, Mr. Peterson, there's a cold one waiting for you.
+Norm: I know, and if she calls, I'm not here.
+ -- Cheers, Bar Wars II: The Woodman Strikes Back
+
+Sam: Beer, Norm?
+Norm: Have I gotten that predictable? Good.
+ -- Cheers, Don't Paint Your Chickens
+%
+Woody: Hey, Mr. Peterson, Jack Frost nipping at your nose?
+Norm: Yep, now let's get Joe Beer nipping at my liver, huh?
+ -- Cheers, Feeble Attraction
+
+Sam: What are you up to Norm?
+Norm: My ideal weight if I were eleven feet tall.
+ -- Cheers, Bar Wars III: The Return of Tecumseh
+
+Woody: Nice cold beer coming up, Mr. Peterson.
+Norm: You mean, `Nice cold beer going *down* Mr. Peterson.'
+ -- Cheers, Loverboyd
+%
+Woody: Hey, Mr. Peterson, what do you say to a cold one?
+Norm: See you later, Vera, I'll be at Cheers.
+ -- Cheers, Norm's Last Hurrah
+
+Sam: Well, look at you. You look like the cat that
+ swallowed the canary.
+Norm: And I need a beer to wash him down.
+ -- Cheers, Norm's Last Hurrah
+
+Woody: Would you like a beer, Mr. Peterson?
+Norm: No, I'd like a dead cat in a glass.
+ -- Cheers, Little Carla, Happy at Last, Part 2
+%
+Woody: Hey, Mr. Peterson, what's up?
+Norm: The warranty on my liver.
+ -- Cheers, Breaking In Is Hard to Do
+
+Sam: What can I do for you, Norm?
+Norm: Open up those beer taps and, oh, take the day off, Sam.
+ -- Cheers, Veggie-Boyd
+
+Woody: What's going on, Mr. Peterson?
+Norm: Another layer for the winter, Wood.
+ -- Cheers, It's a Wonderful Wife
+%
+Woody: How are you feeling today, Mr. Peterson?
+Norm: Poor.
+Woody: Oh, I'm sorry to hear that.
+Norm: No, I meant `pour'.
+ -- Cheers, Strange Bedfellows, Part 3
+
+Woody: Hey, Mr. Peterson, what's the story?
+Norm: Boy meets beer. Boy drinks beer. Boy gets another beer.
+ -- Cheers, The Proposal
+
+Paul: Hey Norm, how's the world been treating you?
+Norm: Like a baby treats a diaper.
+ -- Cheers, Tan 'n Wash
+%
+Woody: What's going on, Mr. Peterson?
+Norm: Let's talk about what's going *in* Mr. Peterson. A beer, Woody.
+ -- Cheers, Paint Your Office
+
+Sam: How's life treating you?
+Norm: It's not, Sammy, but that doesn't mean you can't.
+ -- Cheers, A Kiss is Still a Kiss
+
+Woody: Can I pour you a draft, Mr. Peterson?
+Norm: A little early, isn't it Woody?
+Woody: For a beer?
+Norm: No, for stupid questions.
+ -- Cheers, Let Sleeping Drakes Lie
+%
+Woody: What's happening, Mr. Peterson?
+Norm: The question is, Woody, why is it happening to me?
+ -- Cheers, Strange Bedfellows, Part 1
+
+Woody: What's going down, Mr. Peterson?
+Norm: My cheeks on this barstool.
+ -- Cheers, Strange Bedfellows, Part 2
+
+Woody: Hey, Mr. Peterson, can I pour you a beer?
+Norm: Well, okay, Woody, but be sure to stop me at one. ...
+ Eh, make that one-thirty.
+ -- Cheers, Strange Bedfellows, Part 2
+%
+Woolsey-Swanson Rule:
+ People would rather live with a problem they cannot
+ solve rather than accept a solution they cannot understand.
+%
+Words are the voice of the heart.
+%
+Words can never express what words can never express.
+%
+Words have a longer life than deeds.
+ -- Pindar
+%
+Words must be weighed, not counted.
+%
+WORK:
+ The blessed respite from screaming kids and
+ soap operas for which you actually get paid.
+%
+Work consists of whatever a body is obliged to do.
+Play consists of whatever a body is not obliged to do.
+ -- Mark Twain
+%
+Work continues in this area.
+ -- DEC's SPR-Answering-Automaton
+%
+Work expands to fill the time available.
+ -- Cyril Northcote Parkinson, "The Economist", 1955
+%
+Work is of two kinds: first, altering the position of matter at or near
+the earth's surface relative to other matter; second, telling other people
+to do so.
+ -- Bertrand Russell
+%
+Work is the crab grass in the lawn of life.
+ -- Schulz
+%
+Work is the curse of the drinking classes.
+ -- Mike Romanoff
+%
+Work like hell, tell everyone everything you know, close a deal with
+a handshake, and have fun.
+ -- Harold "Doc" Edgerton, summing up his life's philosophy,
+ shortly before dying at the age of 86.
+%
+Work Rule: Leave of Absence (for an Operation):
+ We are no longer allowing this practice. We wish to discourage
+any thoughts that you may not need all of whatever you have, and you
+should not consider having anything removed. We hired you as you are,
+and to have anything removed would certainly make you less than we
+bargained for.
+%
+Work smarter, not harder, and be careful of your speling.
+%
+Work without a vision is slavery,
+Vision without work is a pipe dream,
+But vision with work is the hope of the world.
+%
+Workers of the world, arise! You have nothing to lose but your
+chairs.
+%
+Working with Julie Andrews is like getting hit over the head with
+a valentine.
+ -- Christopher Plummer
+%
+World tensions have, if anything, increased in the quarter century
+since H. G. Wells uttered his glum warning: "There is no more evil
+thing on earth than race prejudice, none at all. I write deliberately
+-- it is the worst single thing in life now. It justifies and holds
+together more baseness, cruelty and abomination than any other sort of
+error in the world."
+ -- Sydney Harris
+%
+World War Three can be averted by adherence to a strictly enforced
+dress code!
+%
+Worrying is like rocking in a rocking chair--
+It gives you something to do, but it doesn't get you anywhere.
+%
+Worst Month of 1981 for Downhill Skiing:
+ August. The lift lines are the shortest, though.
+ -- Steve Rubenstein
+%
+Worst Month of the Year:
+ February. February has only 28 days in it, which means that if
+ you rent an apartment, you are paying for three full days you
+ don't get. Try to avoid Februarys whenever possible.
+ -- Steve Rubenstein
+%
+Worst Response To A Crisis, 1985:
+ From a readers' Q and A column in TV GUIDE: "If we get involved
+ in a nuclear war, would the electromagnetic pulses from
+ exploding bombs damage my videotapes?"
+%
+Worst Vegetable of the Year:
+ Brussel sprout. This is also the worst vegetable of next year.
+ -- Steve Rubenstein
+%
+Worth seeing?
+Yes, but not worth going to see.
+%
+Worthless.
+ -- Sir George Bidell Airy, KCB, MA, LLD, DCL, FRS, FRAS
+ (Astronomer Royal of Great Britain), estimating for the
+ Chancellor of the Exchequer the potential value of the
+ "analytical engine" invented by Charles Babbage, September
+ 15, 1842.
+%
+Would it help if I got out and pushed?
+ -- Princess Leia Organa
+%
+Would that my hand were as swift as my tongue.
+ -- Alfieri
+%
+Would the last person to leave Michigan please turn out the lights?
+%
+Would ye both eat your cake and have your cake?
+ -- John Heywood
+%
+Would you care to drift aimlessly in my direction?
+%
+Would you care to view the ruins of my good intentions?
+%
+Would you people stop playing these stupid games?!?!?!!!!
+%
+Would you please have another look at my nose and put in that cocaine
+stuff ...
+ -- Adolf Hitler, quoted by Dr. Giesing in Nuremberg
+ trial testimony, 1947
+%
+Would you *really* want to get on a non-stop flight?
+ -- George Carlin
+%
+Wouldn't this be a great world if being insecure and desperate were
+a turn-on?
+ -- "Broadcast News"
+%
+Wrinkles should merely indicate where smiles have been.
+ -- Mark Twain
+%
+Write a wise saying and your name will live forever.
+ -- Anonymous
+%
+Write yourself a threatening letter and pen a defiant reply.
+%
+Write-protect tab, n.:
+ A small sticker created to cover the unsightly notch carelessly left
+ by disk manufacturers. The use of the tab creates an error message
+ once in a while, but its aesthetic value far outweighs the momentary
+ inconvenience.
+ -- Robb Russon
+%
+Writers who use a computer swear to its liberating power in tones that bear
+witness to the apocalyptic power of a new divinity. Their conviction results
+from something deeper than mere gratitude for the computer's conveniences.
+Every new medium of writing brings about new intensities of religious belief
+and new schisms among believers. In the 16th century the printed book helped
+make possible the split between Catholics and Protestants. In the 20th
+century this history of tragedy and triumph is repeating itself as a farce.
+Those who worship the Apple computer and those who put their faith in the IBM
+PC are equally convinced that the other camp is damned or deluded. Each cult
+holds in contempt the rituals and the laws of the other. Each thinks that it
+is itself the one hope for salvation.
+ -- Edward Mendelson, "The New Republic", February 22, 1988
+%
+Writing about music is like dancing about architecture.
+ -- Frank Zappa
+%
+Writing free verse is like playing tennis with the net down.
+%
+Writing is easy; all you do is sit staring at the blank sheet of
+paper until drops of blood form on your forehead.
+ -- Gene Fowler
+%
+Writing is turning one's worst moments into money.
+ -- J. P. Donleavy
+%
+Writing software is more fun than working.
+%
+WRONG!
+%
+"Wrong," said Renner.
+
+"The tactful way," Rod said quietly, "the polite way to disagree with
+the Senator would be to say, `That turns out not to be the case.'"
+%
+WYSIWYG:
+ What You See Is What You Get.
+%
+X windows:
+ Accept any substitute.
+ If it's broke, don't fix it.
+ If it ain't broke, fix it.
+ Form follows malfunction.
+ The Cutting Edge of Obsolescence.
+ The trailing edge of software technology.
+ Armageddon never looked so good.
+ Japan's secret weapon.
+ You'll envy the dead.
+ Making the world safe for competing window systems.
+ Let it get in YOUR way.
+ The problem for your problem.
+ If it starts working, we'll fix it. Pronto.
+ It could be worse, but it'll take time.
+ Simplicity made complex.
+ The greatest productivity aid since typhoid.
+ Flakey and built to stay that way.
+
+One thousand monkeys. One thousand MicroVAXes. One thousand years.
+ X windows.
+%
+X windows:
+ It's not how slow you make it. It's how you make it slow.
+ The windowing system preferred by masochists 3 to 1.
+ Built to take on the world... and lose!
+ Don't try it 'til you've knocked it.
+ Power tools for Power Fools.
+ Putting new limits on productivity.
+ The closer you look, the cruftier we look.
+ Design by counterexample.
+ A new level of software disintegration.
+ No hardware is safe.
+ Do your time.
+ Rationalization, not realization.
+ Old-world software cruftsmanship at its finest.
+ Gratuitous incompatibility.
+ Your mother.
+ THE user interference management system.
+ You can't argue with failure.
+ You haven't died 'til you've used it.
+
+The environment of today... tomorrow!
+ X windows.
+%
+X windows:
+ Something you can be ashamed of.
+ 30%% more entropy than the leading window system.
+ The first fully modular software disaster.
+ Rome was destroyed in a day.
+ Warn your friends about it.
+ Climbing to new depths. Sinking to new heights.
+ An accident that couldn't wait to happen.
+ Don't wait for the movie.
+ Never use it after a big meal.
+ Need we say less?
+ Plumbing the depths of human incompetence.
+ It'll make your day.
+ Don't get frustrated without it.
+ Power tools for power losers.
+ A software disaster of Biblical proportions.
+ Never had it. Never will.
+ The software with no visible means of support.
+ More than just a generation behind.
+
+Hindenburg. Titanic. Edsel.
+ X windows.
+%
+X windows:
+ The ultimate bottleneck.
+ Flawed beyond belief.
+ The only thing you have to fear.
+ Somewhere between chaos and insanity.
+ On autopilot to oblivion.
+ The joke that kills.
+ A disgrace you can be proud of.
+ A mistake carried out to perfection.
+ Belongs more to the problem set than the solution set.
+ To err is X windows.
+ Ignorance is our most important resource.
+ Complex nonsolutions to simple nonproblems.
+ Built to fall apart.
+ Nullifying centuries of progress.
+ Falling to new depths of inefficiency.
+ The last thing you need.
+ The de facto substandard.
+
+Elevating brain damage to an art form.
+ X windows.
+%
+X windows:
+ We will dump no core before its time.
+ One good crash deserves another.
+ A bad idea whose time has come. And gone.
+ We make excuses.
+ It didn't even look good on paper.
+ You laugh now, but you'll be laughing harder later!
+ A new concept in abuser interfaces.
+ How can something get so bad, so quickly?
+ It could happen to you.
+ The art of incompetence.
+ You have nothing to lose but your lunch.
+ When uselessness just isn't enough.
+ More than a mere hindrance. It's a whole new barrier!
+ When you can't afford to be right.
+ And you thought we couldn't make it worse.
+
+If it works, it isn't X windows.
+%
+X windows:
+ You'd better sit down.
+ Don't laugh. It could be YOUR thesis project.
+ Why do it right when you can do it wrong?
+ Live the nightmare.
+ Our bugs run faster.
+ When it absolutely, positively HAS to crash overnight.
+ There ARE no rules.
+ You'll wish we were kidding.
+ Everything you never wanted in a window system. And more.
+ Dissatisfaction guaranteed.
+ There's got to be a better way.
+ The next best thing to keypunching.
+ Leave the thrashing to us.
+ We wrote the book on core dumps.
+ Even your dog won't like it.
+ More than enough rope.
+ Garbage at your fingertips.
+
+Incompatibility. Shoddiness. Uselessness.
+ X windows.
+%
+Xerox does it again and again and again and ...
+%
+Xerox never comes up with anything original.
+%
+XEROX never does anything original.
+%
+XI:
+ If the Earth could be made to rotate twice as fast, managers would
+ get twice as much done. If the Earth could be made to rotate twenty
+ times as fast, everyone else would get twice as much done since all
+ the managers would fly off.
+XII:
+ It costs a lot to build bad products.
+XIII:
+ There are many highly successful businesses in the United States.
+ There are also many highly paid executives. The policy is not to
+ intermingle the two.
+XIV:
+ After the year 2015, there will be no airplane crashes. There will
+ be no takeoffs either, because electronics will occupy 100 percent
+ of every airplane's weight.
+XV:
+ The last 10 percent of performance generates one-third of the cost
+ and two-thirds of the problems.
+ -- Norman Augustine
+%
+XIIdigitation, n.:
+ The practice of trying to determine the year a movie was made
+ by deciphering the Roman numerals at the end of the credits.
+ -- Rich Hall, "Sniglets"
+%
+XLI:
+ The more one produces, the less one gets.
+XLII:
+ Simple systems are not feasible because they require infinite testing.
+XLIII:
+ Hardware works best when it matters the least.
+XLIV:
+ Aircraft flight in the 21st century will always be in a westerly
+ direction, preferably supersonic, crossing time zones to provide the
+ additional hours needed to fix the broken electronics.
+XLV:
+ One should expect that the expected can be prevented, but the
+ unexpected should have been expected.
+XLVI:
+ A billion saved is a billion earned.
+ -- Norman Augustine
+%
+XLVII:
+ Two-thirds of the Earth's surface is covered with water. The other
+ third is covered with auditors from headquarters.
+XLVIII:
+ The more time you spend talking about what you have been doing, the
+ less time you have to spend doing what you have been talking about.
+ Eventually, you spend more and more time talking about less and less
+ until finally you spend all your time talking about nothing.
+XLIX:
+ Regulations grow at the same rate as weeds.
+L:
+ The average regulation has a life span one-fifth as long as a
+ chimpanzee's and one-tenth as long as a human's -- but four times
+ as long as the official's who created it.
+LI:
+ By the time of the United States Tricentennial, there will be more
+ government workers than there are workers.
+LII:
+ People working in the private sector should try to save money.
+ There remains the possibility that it may someday be valuable again.
+ -- Norman Augustine
+%
+XML is a giant step in no direction at all.
+ -- Erik Naggum
+%
+XML is like violence: if it doesn't solve your problem, you aren't using
+enough of it.
+ -- XML guru Chris Maden
+%
+X-rated movies are all alike -- the only thing
+they leave to the imagination is the plot.
+%
+XVI:
+ In the year 2054, the entire defense budget will purchase just one
+ aircraft. This aircraft will have to be shared by the Air Force and
+ Navy 3-1/2 days each per week except for leap year, when it will be
+ made available to the Marines for the extra day.
+XVII:
+ Software is like entropy. It is difficult to grasp, weighs nothing,
+ and obeys the Second Law of Thermodynamics, i.e., it always increases.
+XVIII:
+ It is very expensive to achieve high unreliability. It is not uncommon
+ to increase the cost of an item by a factor of ten for each factor of
+ ten degradation accomplished.
+XIX:
+ Although most products will soon be too costly to purchase, there will
+ be a thriving market in the sale of books on how to fix them.
+XX:
+ In any given year, Congress will appropriate the amount of funding
+ approved the prior year plus three-fourths of whatever change the
+ administration requests -- minus 4-percent tax.
+ -- Norman Augustine
+%
+XXI:
+ It's easy to get a loan unless you need it.
+XXII:
+ If stock market experts were so expert, they would be buying stock,
+ not selling advice.
+XXIII:
+ Any task can be completed in only one-third more time than is
+ currently estimated.
+XXIV:
+ The only thing more costly than stretching the schedule of an
+ established project is accelerating it, which is itself the most
+ costly action known to man.
+XXV:
+ A revised schedule is to business what a new season is to an athlete
+ or a new canvas to an artist.
+ -- Norman Augustine
+%
+XXVI:
+ If a sufficient number of management layers are superimposed on each
+ other, it can be assured that disaster is not left to chance.
+XXVII:
+ Rank does not intimidate hardware. Neither does the lack of rank.
+XXVIII:
+ It is better to be the reorganizer than the reorganizee.
+XXIX:
+ Executives who do not produce successful results hold on to their
+ jobs only about five years. Those who produce effective results
+ hang on about half a decade.
+XXX:
+ By the time the people asking the questions are ready for the answers,
+ the people doing the work have lost track of the questions.
+ -- Norman Augustine
+%
+XXXI:
+ The optimum committee has no members.
+XXXII:
+ Hiring consultants to conduct studies can be an excellent means of
+ turning problems into gold -- your problems into their gold.
+XXXIII:
+ Fools rush in where incumbents fear to tread.
+XXXIV:
+ The process of competitively selecting contractors to perform work
+ is based on a system of rewards and penalties, all distributed
+ randomly.
+XXXV:
+ The weaker the data available upon which to base one's conclusion,
+ the greater the precision which should be quoted in order to give
+ the data authenticity.
+ -- Norman Augustine
+%
+XXXVI:
+ The thickness of the proposal required to win a multimillion dollar
+ contract is about one millimeter per million dollars. If all the
+ proposals conforming to this standard were piled on top of each other
+ at the bottom of the Grand Canyon it would probably be a good idea.
+XXXVII:
+ Ninety percent of the time things will turn out worse than you expect.
+ The other 10 percent of the time you had no right to expect so much.
+XXXVIII:
+ The early bird gets the worm.
+ The early worm ... gets eaten.
+XXXIX:
+ Never promise to complete any project within six months of the end of
+ the year -- in either direction.
+XL:
+ Most projects start out slowly -- and then sort of taper off.
+ -- Norman Augustine
+%
+Ya know, Quaker Oats make you feel good twice!
+%
+Yacc owes much to a most stimulating collection of users, who have
+goaded me beyond my inclination, and frequently beyond my ability in
+their endless search for "one more feature". Their irritating
+unwillingness to learn how to do things my way has usually led to my
+doing things their way; most of the time, they have been right.
+ -- Stephen C. Johnson, "Yacc guide acknowledgments"
+%
+Y'all hear about the geometer who went to the beach to catch some
+rays and became a tangent ?
+%
+Yawd [noun, Bostonese]: the campus of Have Id.
+ -- Webster's Unafraid Dictionary
+%
+Yea from the table of my memory
+I'll wipe away all trivial fond records.
+ -- Hamlet
+%
+Yea, though I walk through the valley of the shadow of APL, I shall
+fear no evil, for I can string six primitive monadic and dyadic
+operators together.
+ -- Steve Higgins
+%
+Yeah, but you're taking the universe out of context.
+%
+Yeah, God is dead, he laughed himself to death.
+%
+Yeah, if it looks like a duck, and walks like
+a duck, and quacks like a duck -- shoot it.
+%
+Yeah, that's me, Tracer Bullet. I've got eight slugs in me. One's lead,
+the rest bourbon. The drink packs a wallop, and I pack a revolver. I'm
+a private eye.
+ -- Calvin
+%
+Yeah, there are more important things in life than money,
+but they won't go out with you if you don't have any.
+%
+Year Name James Bond Book
+---- -------------------------------- -------------- ----
+50's James Bond TV Series Barry Nelson
+1962 Dr. No Sean Connery 1958
+1963 From Russia With Love Sean Connery 1957
+1964 Goldfinger Sean Connery 1959
+1965 Thunderball Sean Connery 1961
+1967* Casino Royale David Niven 1954
+1967 You Only Live Twice Sean Connery 1964
+1969 On Her Majesty's Secret Service George Lazenby 1963
+1971 Diamonds Are Forever Sean Connery 1956
+1973 Live And Let Die Roger Moore 1955
+1974 The Man With The Golden Gun Roger Moore 1965
+1977 The Spy Who Loved Me Roger Moore 1962 (novelette)
+1979 Moonraker Roger Moore 1955
+1981 For Your Eyes Only Roger Moore 1960 (novelette)
+1983 Octopussy Roger Moore 1965
+1983* Never Say Never Again Sean Connery
+1985 A View To A Kill Roger Moore 1960 (novelette)
+1987 The Living Daylights Timothy Dalton 1965 (novelette)
+ * -- Not a Broccoli production
+%
+Year, n.:
+ A period of three hundred and sixty-five disappointments.
+ -- Ambrose Bierce, "The Devil's Dictionary"
+%
+Yes, but every time I try to see things your way, I get a headache.
+%
+Yes, but which self do you want to be?
+%
+Yes, I was surprised how easy it was to cut the door off my cat.
+ -- James D. Nicoll
+%
+Yes, I've now got this nice little apartment in New York, one of those
+L-shaped ones. Unfortunately, it's a lower case l.
+ -- Rita Rudner
+%
+Yes me, I got a bottle in front of me.
+And Jimmy has a frontal lobotomy.
+Just different ways to kill the pain the same.
+But I'd rather have a bottle in front of me,
+Than to have to have a frontal lobotomy.
+I might be drunk but at least I'm not insane.
+ -- Randy Ansley M.D. (Dr. Rock)
+%
+Yes, we will be going to OSI, Mars and, Pluto, but not necessarily in
+that order.
+ -- George Michaelson
+%
+Yesterday I was a dog. Today I'm a dog.
+Tomorrow I'll probably still be a dog.
+Sigh! There's so little hope for advancement.
+ -- Snoopy
+%
+Yesterday upon the stair
+I met a man who wasn't there.
+He wasn't there again today --
+I think he's from the CIA.
+%
+Ye've also got to remember that ... respectable people do the most
+astonishin' things to preserve their respectability. Thank God
+I'm not respectable.
+ -- Ruthven Campbell Todd
+%
+Yevtushenko has... an ego that can crack crystal at a distance of twenty
+feet.
+ -- John Cheever
+%
+Yield to Temptation ... it may not pass your way again.
+ -- Lazarus Long, "Time Enough for Love"
+%
+Yinkel, n.:
+ A person who combs his hair over his bald spot,
+ hoping no one will notice.
+ -- Rich Hall, "Sniglets"
+%
+You ain't learning nothing when you're talking.
+%
+You always have the option of pitching baseballs at empty
+spray paint cans in a cul-de-sac in a Cleveland suburb.
+%
+You are a bundle of energy, always on the go.
+%
+You are a fluke of the universe; you have no right to be here.
+%
+You are a taxi driver. Your cab is yellow and black, and has been in
+use for only seven years. One of its windshield wipers is broken, and
+the carburetor needs adjusting. The tank holds 20 gallons, but at the
+moment is only three-quarters full. How old is the taxi driver?"
+%
+You are a very redundant person, that's what kind of person you are.
+%
+You are a wish to be here wishing yourself.
+ -- Philip Whalen
+%
+You are absolute plate-glass. I see to the very back of your mind.
+ -- Sherlock Holmes
+%
+You are always busy.
+%
+You are always doing something marginal when the boss drops by your desk.
+%
+You are an insult to my intelligence!
+I demand that you log off immediately.
+%
+You are as I am with You.
+%
+You are capable of planning your future.
+%
+You are confused; but this is your normal state.
+%
+You are deeply attached to your friends and acquaintances.
+%
+You are destined to become the commandant of the
+fighting men of the department of transportation.
+%
+You are dishonest, but never to the point of hurting a friend.
+%
+You are fairminded, just and loving.
+%
+You are false data.
+%
+You are farsighted, a good planner,
+an ardent lover, and a faithful friend.
+%
+You are fighting for survival in your own sweet and gentle way.
+%
+You are going to have a new love affair.
+%
+You are here:
+ ***
+ ***
+ *********
+ *******
+ *****
+ ***
+ *
+
+ But you're not all there.
+%
+You are in a maze of little twisting passages, all alike.
+%
+You are in a maze of little twisting passages, all different.
+%
+You are in the hall of the mountain king.
+%
+You are lost in the Swamps of Despair.
+%
+You are loved by the multitudes.
+Have you been to the clinic lately?
+%
+You are magnetic in your bearing.
+%
+You are never given a wish without also being given the
+power to make it true. You may have to work for it, however.
+ -- R. Bach,
+ "Messiah's Handbook: Reminders for the Advanced Soul"
+%
+You are not a fool just because you have done
+something foolish -- only if the folly of it escapes you.
+%
+You are not dead yet.
+But watch for further reports.
+%
+You are not permitted to kill a woman who has wronged you, but nothing
+forbids you to reflect that she is growing older every minute. You are
+avenged fourteen hundred and forty times a day.
+ -- Ambrose Bierce
+%
+You are now in Atlanta, Georgia.
+Please set your clocks back 200 years.
+%
+You are number 6! Who is number one?
+%
+"You are old, Father William," the young man said,
+ "All your papers these days look the same;
+Those William's would be better unread --
+ Do these facts never fill you with shame?"
+
+"In my youth," Father William replied to his son,
+ "I wrote wonderful papers galore;
+But the great reputation I found that I'd won,
+ Made it pointless to think any more."
+%
+"You are old, father William," the young man said,
+ "And your hair has become very white;
+And yet you incessantly stand on your head --
+ Do you think, at your age, it is right?"
+
+"In my youth," father William replied to his son,
+ "I feared it might injure the brain;
+But, now that I'm perfectly sure I have none,
+ Why, I do it again and again."
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+"You are old," said the youth, "and I'm told by my peers
+ That your lectures bore people to death.
+Yet you talk at one hundred conventions per year --
+ Don't you think that you should save your breath?"
+
+"I have answered three questions and that is enough,"
+ Said his father, "Don't give yourself airs!
+Do you think I can listen all day to such stuff?
+ Be off, or I'll kick you downstairs!"
+%
+"You are old," said the youth, "and your jaws are too weak
+ For anything tougher than suet;
+Yet you finished the goose, with the bones and the beak --
+ Pray, how did you manage to do it?"
+
+"In my youth," said his father, "I took to the law,
+ And argued each case with my wife;
+And the muscular strength which it gave to my jaw,
+ Has lasted the rest of my life."
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+"You are old," said the youth, "and your programs don't run,
+ And there isn't one language you like;
+Yet of useful suggestions for help you have none --
+ Have you thought about taking a hike?"
+
+"Since I never write programs," his father replied,
+ "Every language looks equally bad;
+Yet the people keep paying to read all my books
+ And don't realize that they've been had."
+%
+"You are old," said the youth, "as I mentioned before,
+ And have grown most uncommonly fat;
+Yet you turned a back-somersault in at the door --
+ Pray what is the reason of that?"
+
+"In my youth," said the sage, as he shook his grey locks,
+ "I kept all my limbs very supple
+By the use of this ointment -- one shilling the box --
+ Allow me to sell you a couple?"
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+"You are old," said the youth, "as I mentioned before,
+ And make errors few people could bear;
+You complain about everyone's English but yours --
+ Do you really think this is quite fair?"
+
+"I make lots of mistakes," Father William declared,
+ "But my stature these days is so great
+That no critic can hurt me -- I've got them all scared,
+ And to stop me it's now far too late."
+%
+"You are old," said the youth, "one would hardly suppose
+ That your eye was as steady as ever;
+Yet you balanced an eel on the end of your nose --
+ What made you so awfully clever?"
+
+"I have answered three questions, and that is enough,"
+ Said his father. "Don't give yourself airs!
+Do you think I can listen all day to such stuff?
+ Be off, or I'll kick you down stairs!"
+ -- Lewis Carroll, "Alice's Adventures in Wonderland" (1865)
+%
+You are only young once, but you can stay immature indefinitely.
+%
+You are scrupulously honest, frank, and straightforward.
+Therefore you have few friends.
+%
+You are sick, twisted and perverted.
+I like that in a person.
+%
+You are so boring that when I see you my feet go to sleep.
+%
+You are standing on my toes.
+%
+You are taking yourself far too seriously.
+%
+You are the only person to ever get this message.
+%
+You are transported to a room where you are faced by a wizard who
+points to you and says, "Them's fighting words!" You immediately get
+attacked by all sorts of denizens of the museum: there is a cobra
+chewing on your leg, a troglodyte is bashing your brains out with a
+gold nugget, a crocodile is removing large chunks of flesh from you, a
+rhinoceros is goring you with his horn, a sabre-tooth cat is busy
+trying to disembowel you, you are being trampled by a large mammoth, a
+vampire is sucking you dry, a Tyrannosaurus Rex is sinking his six inch
+long fangs into various parts of your anatomy, a large bear is
+dismembering your body, a gargoyle is bouncing up and down on your
+head, a burly troll is tearing you limb from limb, several dire wolves
+are making mince meat out of your torso, and the wizard is about to
+transport you to the corner of Westwood and Broxton. Oh dear, you seem
+to have gotten yourself killed, as well.
+
+You scored 0 out of 250 possible points.
+That gives you a ranking of junior beginning adventurer.
+To achieve the next higher rating, you need to score 32 more points.
+%
+You are wise, witty, and wonderful,
+but you spend too much time reading this sort of trash.
+%
+You ask what a nice girl will do?
+She won't give an inch, but she won't say no.
+ -- Marcus Valerius Martialis
+%
+You attempt things that you do not even plan
+because of your extreme stupidity.
+%
+You auto buy now.
+%
+You buttered your bread, now lie in it!
+%
+You buy a judge by weight, like iron in a junk yard. A justice of the
+peace or a magistrate can be had for a five-dollar bill. In the
+municipal courts, he will cost you ten. In the circuit or superior
+courts, he wants fifteen. The state appellate courts or the state
+supreme court is on a par with the Federal courts. By the time a judge
+reaches such courts, he is middle-aged, thick around the middle, fat
+between the ears. He's heavy. You can't buy a Federal judge for less
+than a twenty-dollar bill.
+ -- Jake "Greasy Thumb" Guzik
+%
+You can always pick up your needle and move to another groove.
+ -- Tim Leary
+%
+You can always tell luck from ability by its duration.
+%
+You can always tell the Christmas season is here when you start getting
+incredibly dense, tinfoil-and-ribbon- wrapped lumps in the mail.
+Fruitcakes make ideal gifts because the Postal Service has been unable
+to find a way to damage them. They last forever, largely because
+nobody ever eats them. In fact, many smart people save the fruitcakes
+they receive and send them back to the original givers the next year;
+some fruitcakes have been passed back and forth for hundreds of years.
+
+The easiest way to make a fruitcake is to buy a darkish cake, then
+pound some old, hard fruit into it with a mallet. Be sure to wear
+safety glasses.
+ -- Dave Barry, "Simple, Homespun Gifts"
+%
+You can always tell the people that are forging the new frontier.
+They're the ones with arrows sticking out of their backs.
+%
+You can approach truth, but never capture it.
+Lies can be had 'round the corner.
+ -- Poul Henningsen (1894-1967)
+%
+You can be replaced by this computer.
+%
+You can bear anything if it isn't your own fault.
+ -- Katharine Fullerton Gerould
+%
+You can bring any calculator you like to the midterm, as long as it
+doesn't dim the lights when you turn it on.
+ -- Hepler, Systems Design 182, University of Washington
+%
+You can bring men from other parts of the world who are sane. And you
+know what happens? At the very moment they cross those mountains...
+they go mad. Instantaneously and automatically, at the very moment
+they cross the mountains into California, they go insane.
+ -- Quentin Genter
+%
+You can build a throne out of bayonets, but you can't sit on it for very long.
+ -- Boris Yeltsin
+%
+You can cage a swallow, can't you,
+ but you can't swallow a cage, can you?
+Girl, bathing on Bikini, eyeing boy,
+ finds boy eyeing bikini on bathing girl.
+A man, a plan, a canal -- Panama!
+ -- The Palindromist
+%
+You can create your own opportunities this week.
+Blackmail a senior executive.
+%
+You can destroy your now by worrying about tomorrow.
+ -- Janis Joplin
+%
+You can do this in a number of ways. IBM chose to do all of them.
+Why do you find that funny?
+ -- D. Taylor, Computer Science 350, University of Washington
+%
+You can do very well in speculation where
+land or anything to do with dirt is concerned.
+%
+You can drive a horse to water, but a pencil must be lead.
+%
+You can fool all the people all of the time if the advertising is right
+and the budget is big enough.
+ -- Joseph E. Levine
+%
+You can fool some of the people all of the time and all
+of the people some of the time, but you can never fool your Mom.
+%
+You can fool some of the people all of the time,
+and all of the people some of the time,
+but you can make a fool of yourself anytime.
+%
+You can fool some of the people some of the time,
+and some of the people all of the time, and that is sufficient.
+%
+You can get *anywhere* in ten minutes if you drive fast enough.
+%
+You can get everything in life you want,
+if you will help enough other people get what they want.
+%
+You can get more of what you want with a kind word and a gun than you
+can with just a kind word.
+ -- Bumper Sticker
+%
+You can get much further with a kind word and a
+gun than you can with a kind word alone.
+ -- Al Capone
+ [Also attributed to Johnny Carson. Ed.]
+%
+You can get there from here, but why on earth would you want to?
+%
+You can go anywhere you want if you look serious and carry a clipboard.
+%
+You can grovel with a lover, you can grovel with a friend,
+You can grovel with your boss, and it never has to end.
+
+(chorus) Grovel, grovel, grovel, every night and every day,
+ Grovel, grovel, grovel, in your own peculiar way.
+
+You can grovel in a hallway, you can grovel in a park,
+You can grovel in an alley with a mugger after dark.
+(chorus)
+
+You can grovel with your uncle, you can grovel with your aunt,
+You can grovel with your Apple, even though you say you can't.
+(chorus)
+%
+You can have a dog as a friend. You can have whiskey as a friend. But
+if you have a woman as a friend, you're going to wind up drunk and kissing
+your dog.
+ -- foolin' around
+%
+You can have peace. Or you can have freedom.
+Don't ever count on having both at once.
+ -- Lazarus Long
+%
+You can imagine my embarrassment when I killed the wrong guy.
+ -- Joe Valachi
+%
+You can learn many things from children. How much patience you have,
+for instance.
+ -- Franklin P. Jones
+%
+You can make it illegal, but you can't make it unpopular.
+%
+You can measure a programmer's perspective by noting his attitude on
+the continuing viability of FORTRAN.
+ -- Alan J. Perlis
+%
+You can move the world with an idea,
+but you have to think of it first.
+%
+You can never trust a woman; she may be true to you.
+%
+You can no more win a war than you can win an earthquake.
+ -- Jeannette Rankin
+%
+You can not get anything worthwhile done without raising a sweat.
+ -- The First Law Of Thermodynamics
+
+What ever you want is going to cost a little more than it is worth.
+ -- The Second Law Of Thermodynamics
+
+You can not win the game, and you are not allowed to stop playing.
+ -- The Third Law Of Thermodynamics
+%
+You can now buy more gates with less
+specifications than at any other time in history.
+ -- Kenneth Parker
+%
+You can observe a lot just by watching.
+ -- Yogi Berra
+%
+You can only live once, but if you do it right, once is enough.
+%
+You can rent this space for only $5 a week.
+%
+You can take all the impact that science considerations have on funding
+decisions at NASA, put them in the navel of a flea, and have room left
+over for a caraway seed and Tony Calio's heart.
+ -- F. Allen
+%
+You can tell how far we have to go,
+when Fortran is the language of supercomputers.
+ -- Steven Feiner
+%
+You can tell the ideals of a nation by its advertisements.
+ -- Norman Douglas
+%
+You can tune a piano, but you can't tuna fish.
+%
+You can write a small letter to Grandma in the filename.
+ -- Forbes Burkowski, Computer Science 454,
+ University of Washington
+%
+You canna change the laws of physics, Captain;
+I've got to have thirty minutes!
+%
+You cannot achieve the impossible without attempting the absurd.
+%
+You cannot choose your battlefield, the gods do that for you.
+But you can plant a standard where a standard never flew.
+ -- Nathalia Crane
+%
+You cannot have a science without measurement.
+ -- R. W. Hamming
+%
+You cannot kill time without injuring eternity.
+%
+You cannot propel yourself forward by patting yourself on the back.
+%
+You cannot see the wood for the trees.
+ -- John Heywood
+%
+You cannot shake hands with a clenched fist.
+ -- Indira Gandhi
+%
+You cannot use your friends and have them too.
+%
+You can't break eggs without making an omelet.
+%
+You can't carve your way to success without cutting remarks.
+%
+You can't cheat an honest man, never give
+a sucker an even break or smarten up a chump.
+ -- W. C. Fields
+%
+You can't cheat the phone company.
+%
+You can't cross a large chasm in two small jumps.
+%
+You can't depend on the man who made the mess to clean it up.
+ -- Richard M. Nixon (1952)
+%
+You can't erase a dream, you can only wake me up.
+ -- Peter Frampton
+%
+You can't expect a boy to be vicious till he's been to a good school.
+ -- H. H. Munro
+%
+"You can't expect a mother to be with a small child all the time",
+Margaret Mead once remarked, with her usual good sense, but in 1978
+she shocked feminists by snapping that women don't really have
+children to put them in day care twelve hours a day, either.
+ -- Caroline Bird, "The Two Paycheck Marriage"
+%
+You can't fall off the floor.
+%
+You can't get there from here.
+%
+You can't go home again, unless you set $HOME.
+%
+You can't have everything. Where would you put it?
+ -- Steven Wright
+%
+You can't have your cake and let your neighbor eat it too.
+ -- Ayn Rand
+%
+You can't hold a man down without staying down with him.
+ -- Booker T. Washington
+%
+You can't hug a child with nuclear arms.
+%
+You can't judge a book by the way it wears its hair.
+%
+You can't kiss a girl unexpectedly --
+only sooner than she thought you would.
+%
+You can't learn too soon that the most useful thing about a principle
+is that it can always be sacrificed to expediency.
+ -- W. Somerset Maugham, "The Circle"
+%
+You can't make a program without broken egos.
+%
+You can't mend a wristwatch while falling from an airplane.
+%
+You can't play your friends like marks, kid.
+ -- Henry Gondorf, "The Sting"
+%
+You can't push on a string.
+%
+You can't run away forever,
+But there's nothing wrong with getting a good head start.
+ -- Jim Steinman, "Rock and Roll Dreams Come Through"
+%
+You can't say civilization don't advance... in every war they kill you a
+new way.
+ -- Will Rogers
+%
+You can't start worrying about what's going to happen.
+You get spastic enough worrying about what's happening now.
+ -- Lauren Bacall
+%
+You can't survive by sucking the juice from a wet mitten.
+ -- Charles Schulz, "Things I've Had to Learn Over and
+ Over and Over"
+%
+You can't take damsel here now.
+%
+You can't take it with you --
+especially when crossing a state line.
+%
+You can't teach people to be lazy --
+either they have it, or they don't.
+ -- Dagwood Bumstead
+%
+You climb to reach the summit, but once
+there, discover that all roads lead down.
+ -- Stanislaw Lem, "The Cyberiad"
+%
+You could get a new lease on life -- if only you
+didn't need the first and last month in advance.
+%
+You could live a better life, if you
+had a better mind and a better body.
+%
+You couldn't even prove the White House
+staff sane beyond a reasonable doubt.
+ -- Ed Meese, on the Hinckley verdict
+%
+You definitely intend to start living sometime soon.
+%
+You dialed 5483.
+%
+You display the wonderful traits of charm and courtesy.
+%
+You do not have mail.
+%
+You don't become a failure until you're satisfied with being one.
+%
+You don't have to be nice to people on the way up
+if you're not planning on coming back down.
+ -- Oliver Warbucks, "Annie"
+%
+You don't have to explain something you never said.
+ -- Calvin Coolidge
+%
+You don't have to know how the computer
+works, just how to work the computer.
+%
+You don't have to think too hard when you talk to teachers.
+ -- J. D. Salinger
+%
+You don't move to Edina, you achieve Edina.
+ -- Guindon
+%
+You don't sew with a fork, so I see no
+reason to eat with knitting needles.
+ -- Miss Piggy, on eating Chinese Food
+%
+You enjoy the company of other people.
+%
+You feel a whole lot more like you do
+now than you did when you used to.
+%
+You fill a much-needed gap.
+%
+You first have to decide whether to use the short or the long form.
+The short form is what the Internal Revenue Service calls "simplified",
+which means it is designed for people who need the help of a Sears
+tax-preparation expert to distinguish between their first and last
+names. Here's the complete text:
+
+ "(1) How much did you make? (AMOUNT)
+ "(2) How much did we here at the government take out? (AMOUNT)
+ "(3) Hey! Sounds like we took too much! So we're going to
+ send an official government check for (ONE-FIFTEENTH OF
+ THE AMOUNT WE TOOK) directly to the (YOUR LAST NAME)
+ household at (YOUR ADDRESS), for you to spend in any way
+ you please! Which just goes to show you, (YOUR FIRST
+ NAME), that it pays to file the short form!"
+
+The IRS wants you to use this form because it gets to keep most of your
+money. So unless you have pond silt for brains, you want the long
+form.
+ -- Dave Barry, "Sweating Out Taxes"
+%
+You first parent of the human race... who ruined yourself for an apple,
+what might you have done for a truffled turkey?
+ -- Brillat-Savarin, "Physiologie du go^ut"
+%
+You get along very well with everyone except animals and people.
+%
+You get what you pay for.
+ -- Gabriel Biel
+%
+You give me space to belong to myself yet without separating me
+from your own life. May it all turn out to your happiness.
+ -- Johann Wolfgang von Goethe
+%
+You go down to the pickup station,
+ craving warmth and beauty;
+You settle for less than fascination --
+ a few drinks later you're not so choosy.
+And the closing lights strip off the shadows
+ on this strange new flesh you've found --
+Clutching the night to you like a fig leaf
+ you hurry to the blackness
+ and the blankets to lay down an impression
+ and your loneliness.
+ -- Joni Mitchell
+%
+You got to be very careful if you don't know
+where you're going, because you might not get there.
+ -- Yogi Berra
+%
+You got to pay your dues if you want to sing the blues,
+And you know it don't come easy ...
+I don't ask for much, I only want trust,
+And you know it don't come easy ...
+%
+You guys have been practicing discrimination for years.
+Now it's our turn.
+ -- Thurgood Marshall, quoted by Justice Douglas
+%
+You had mail, but the super-user read it, and deleted it!
+%
+You had mail.
+Paul read it, so ask him what it said.
+%
+You had some happiness once,
+but your parents moved away, and you had to leave it behind.
+%
+You have a deep appreciation of the arts and music.
+%
+You have a deep interest in all that is artistic.
+%
+You have a massage (from the Swedish prime minister).
+%
+You have a message from the operator.
+%
+You have a reputation for being thoroughly reliable and trustworthy.
+A pity that it's totally undeserved.
+%
+You have a strong appeal for members of the opposite sex.
+%
+You have a strong appeal for members of your own sex.
+%
+You have a strong desire for a home
+and your family interests come first.
+%
+You have a tendency to feel you are superior to most computers.
+%
+You have a truly strong individuality.
+%
+You have a will that can be influenced
+by all with whom you come in contact.
+%
+You have acquired a scroll entitled 'irk gleknow mizk'(n).--More--
+
+This is an IBM Manual scroll.--More--
+
+You are permanently confused.
+ -- Dave Decot
+%
+You have all eternity to be cautious in when you're dead.
+ -- Lois Platford
+%
+You have all the characteristics of a popular politician:
+a horrible voice, bad breeding, and a vulgar manner.
+ -- Aristophanes
+%
+You have an ability to sense and know higher truth.
+%
+You have an ambitious nature and may make a name for yourself.
+%
+You have an unusual equipment for success.
+Be sure to use it properly.
+%
+You have an unusual magnetic personality. Don't walk too close to
+metal objects which are not fastened down.
+%
+You have an unusual understanding of
+the problems of human relationships.
+%
+You have been in Afghanistan, I perceive.
+ -- Sherlock Holmes, "A Study in Scarlet"
+%
+You have been selected for a secret mission.
+%
+You have Egyptian flu: you're going to be a mummy.
+%
+You have had a long-term stimulation relative to business.
+%
+You have junk mail.
+%
+You have literary talent that you should take pains to develop.
+%
+You have mail.
+%
+You have many friends and very few living enemies.
+%
+You have no real enemies.
+%
+You have not converted a man because you have silenced him.
+ -- John Viscount Morley
+%
+You have only to mumble a few words in church to get married
+and few words in your sleep to get divorced.
+%
+You have the body of a 19 year old. Please return it before it gets
+wrinkled.
+%
+You have the capacity to learn from mistakes.
+You'll learn a lot today.
+%
+You have the power to influence all with whom you come in contact.
+%
+You have to run as fast as you can just to stay where you are.
+If you want to get anywhere, you'll have to run much faster.
+ -- Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
+%
+You humans are all alike.
+%
+You just know when a relationship is about to end. My girlfriend called me
+at work and asked me how you change a lightbulb in the bathroom. "It's very
+simple," I said. "You start by filling up the bathtub with water..."
+%
+You just wait, I'll sin till I blow up!
+ -- Dylan Thomas
+%
+You k'n hide de fier, but w'at you gwine do wid de smoke?
+ -- Joel Chandler Harris, proverbs of Uncle Remus
+%
+You knew the job was dangerous when you took it, Fred.
+ -- Superchicken
+%
+You know, Callahan's is a peaceable bar, but if
+you ask that dog what his favorite formatter is,
+and he says "roff! roff!", well, I'll just have to...
+%
+You know how to win a victory, Hannibal, but not how to use it.
+ -- Maharbal
+%
+You know if they ever find a way to harness sarcasm as an energy source,
+you people are all going to owe me big.
+ -- Bill Paul
+%
+You know it's going to be a bad day when you want to put on the clothes
+you wore home from the party and there aren't any.
+%
+You know it's going to be a long day when you get up, shave and shower,
+start to get dressed and your shoes are still warm.
+ -- Dean Webber
+%
+You know it's Monday when you wake up and it's Tuesday.
+ -- Garfield
+%
+You know my heart keeps tellin' me,
+You're not a kid at thirty-three,
+You play around you lose your wife,
+You play too long, you lose your life.
+Some gotta win, some gotta lose,
+Goodtime Charlie's got the blues.
+%
+You know, of course, that the Tasmanians, who never committed adultery,
+are now extinct.
+ -- W. Somerset Maugham
+%
+You know, the difference between this company and
+the Titanic is that the Titanic had paying customers.
+%
+You know the great thing about TV? If something important happens
+anywhere at all in the world, no matter what time of the day or night,
+you can always change the channel.
+ -- Jim Ignatowski
+%
+You know very well that whether you are on page one or page thirty depends
+on whether [the press] fear you. It is just as simple as that.
+ -- Richard M. Nixon
+%
+You know what I wish? I wish all the scum of the Earth had one throat
+and I had my hands about it.
+ -- Rorschach, "Watchmen"
+%
+You know what they say -- the sweetest word in the English language
+is revenge.
+ -- Peter Beard
+%
+You know what we can be like: See a guy and think he's cute one minute, the
+next minute our brains have us married with kids, the following minute we see
+him having an extramarital affair. By the time someone says "I'd like you to
+meet Cecil," we shout, "You're late again with the child support!"
+ -- Cynthia Heimel, "A Girl's Guide to Chaos"
+%
+You know you are getting old when you think you should drive the speed limit.
+ -- E. A. Gilliam
+%
+You know you have a small apartment when Rice Krispies echo.
+ -- S. Rickly Christian
+%
+You know your apartment is small...
+ when you can't know its position and velocity at the same time.
+ you put your key in the lock and it breaks the window.
+ you have to go outside to change your mind.
+ you can vacuum the entire place using a single electrical outlet.
+%
+You know you're a little fat if you have stretch marks on your car.
+ -- Cyrus, Chicago Reader 1/22/82
+%
+You know you're getting old when you're Dad, and you're measuring your
+daughter for camp clothes, and there are certain measurements only her
+mother is allowed to take.
+%
+You know you're in a small town when...
+ You don't use turn signals because everybody knows where you're going.
+ You're born on June 13 and your family receives gifts from the local
+ merchants because you're the first baby of the year.
+ Everyone knows whose credit is good, and whose wife isn't.
+ You speak to each dog you pass, by name... and he wags his tail.
+ You dial the wrong number, and talk for 15 minutes anyway.
+ You write a check on the wrong bank and it covers you anyway.
+%
+You know you're in trouble when...
+1) You wake up face down on the pavement.
+2) Your wife wakes up feeling amorous and you have a headache.
+3) You turn on the news and they're showing emergency routes
+ out of the city.
+4) Your twin sister forgot your birthday.
+5) You wake up and discover your waterbed broke and then
+ remember that you don't have a waterbed.
+6) Your doctor tells you you're allergic to chocolate.
+%
+You know you're in trouble when...
+1) Your car horn goes off accidentally and remains stuck as you
+ follow a group of Hell's Angels on the freeway.
+2) You want to put on the clothes you wore home from the party
+ and there aren't any.
+3) Your boss tells you not to bother to take off your coat.
+4) The bird singing outside your window is a buzzard.
+5) You wake up and your braces are locked together.
+6) Your mother approves of the person you're dating.
+%
+You know you're in trouble when...
+(1) Your only son tells you he wishes Anita Bryant would mind
+ her own business.
+(2) You put your bra on backwards and it fits better.
+(3) You call Suicide Prevention and they put you on hold.
+(4) You see a `60 Minutes' news team waiting in your office.
+(5) Your birthday cake collapses from the weight of the candles.
+(6) Your 4-year old reveals that it's "almost impossible" to
+ flush a grapefruit down the toilet.
+(7) You realize that you've memorized the back of the cereal box.
+%
+You know you're in trouble when...
+(1) You've been at work for an hour before you notice that your
+ skirt is caught in your pantyhose.
+(2) Your blind date turns out to be your ex-wife.
+(3) Your income tax check bounces.
+(4) You put both contact lenses in the same eye.
+(5) Your wife says, "Good morning, Bill" and your name is George.
+(6) You wake up to the soothing sound of flowing water... the day
+ after you bought a waterbed.
+(7) You go on your honeymoon to a remote little hotel and the desk
+ clerk, bell hop, and manager have a "Welcome Back" party
+ for your spouse.
+%
+You know you've been sitting in front of your Lisp machine too long
+when you go out to the junk food machine and start wondering how to
+make it give you the CADR of Item H so you can get that yummie
+chocolate cupcake that's stuck behind the disgusting vanilla one.
+%
+You know you've been spending too much time on the computer when your
+friend misdates a check, and you suggest adding a "++" to fix it.
+%
+You know you've landed gear-up when it takes full power to taxi.
+%
+You learn to write as if to someone else
+because NEXT YEAR YOU WILL BE "SOMEONE ELSE".
+%
+You like to form new friendships and make new acquaintances.
+%
+You lived with a man who wore white belts?
+Laura, I'm disappointed in you.
+ -- Remington Steele
+%
+You look like a million dollars. All green and wrinkled.
+%
+You look tired.
+%
+You love peace.
+%
+You love your home and want it to be beautiful.
+%
+You may already be a loser.
+ -- Form letter received by Rodney Dangerfield
+%
+You may be gone tomorrow, but that
+doesn't mean that you weren't here today.
+%
+You may be infinitely smaller than some things,
+but you're infinitely larger than others.
+%
+You may be recognized soon. Hide.
+%
+You may be right, I may be crazy,
+But maybe it's a lunatic you're looking for?
+ -- Billy Joel
+%
+You may be sure that when a man begins to call himself a "realist," he
+is preparing to do something he is secretly ashamed of doing.
+ -- Sydney Harris
+%
+You may carve it on his tombstone, you may cut it on his card
+That a young man married is a young man marred.
+ -- Rudyard Kipling, "The Story of the Gadsbys"
+%
+You may easily play a joke on a man who likes to argue -- agree with
+him.
+ -- Edgar W. Howe
+%
+You may get an opportunity for advancement today. Watch it!
+%
+You may have heard that a dean is
+to faculty as a hydrant is to a dog.
+ -- Alfred Kahn
+%
+You may my glories and my state dispose,
+But not my griefs; still am I king of those.
+ -- William Shakespeare, "Richard II"
+%
+You may not be able to judge a book by its cover, but
+you sure as hell can tell how much it's going to cost.
+%
+You may worry about your hair-do today, but tomorrow much peanut butter will
+be sold.
+%
+You mean you didn't *know* she was off
+making lots of little phone companies?
+%
+You men out there probably think you already know how to dress for
+success. You know, for example, that you should not wear leisure suits
+or white plastic belts and shoes, unless you are going to a costume
+party disguised as a pig farmer vacationing at Disney World.
+ -- Dave Barry, "How to Dress for Real Success"
+%
+You mentioned your name as if I should recognize it, but beyond the
+obvious facts that you are a bachelor, a solicitor, a freemason, and
+an asthmatic, I know nothing whatever about you.
+ -- Sherlock Holmes, "The Norwood Builder"
+%
+You might have mail.
+%
+You might like to know that I looked at a detailed map of NT, and I'm
+now able to confirm that in all probability Microsoft NT does not
+exist. If it does, it's so small as to be completely insignificant.
+ -- Greg Lehey
+%
+You must dine in our cafeteria.
+You can eat dirt cheap there!!!!
+%
+You must include all income you receive in the form of money, property
+and services if it is not specifically exempt. Report property (goods)
+and services at their fair market values. Examples include income from
+bartering or swapping transactions, side commissions, kickbacks, rent
+paid in services, illegal activities (such as stealing, drugs, etc.),
+cash skimming by proprietors and tradesmen, "moonlighting" services,
+gambling, prizes and awards. Not reporting such income can lead to
+prosecution for perjury and fraud.
+ -- Excerpt from Taxachussettes income tax forms
+%
+You must know that a man can have only one invulnerable loyalty, loyalty
+to his own concept of the obligations of manhood. All other loyalties
+are merely deputies of that one.
+ -- Nero Wolfe
+%
+You must realize that the computer has it in for you. The irrefutable
+proof of this is that the computer always does what you tell it to do.
+%
+You need more time; and you probably always will.
+%
+You need no longer worry about the future.
+This time tomorrow you'll be dead.
+%
+You need not worry about your future.
+%
+You need only reflect that one of the best ways to get yourself a
+reputation as a dangerous citizen these days is to go about repeating
+the very phrases which our founding fathers used in the struggle for
+independence.
+ -- Charles A. Beard
+%
+You never gain something but that you lose something.
+ -- Thoreau
+%
+You never get a second chance to make a first impression.
+%
+You never go anywhere without your soul.
+%
+You never have to change anything you
+got up in the middle of the night to write.
+ -- Saul Bellow
+%
+You never hesitate to tackle the most difficult problems.
+%
+You never know how many friends you have until you rent a house on the
+beach.
+%
+You never know what is enough until you know what is more than enough.
+ -- William Blake
+%
+You never learned anything by doing it right.
+%
+You notice that after Ginzburg admitted he had tried marijuana everyone
+got in line to admit it, too. But you also notice they all said they
+"experimented" with marijuana. The didn't "use" it; they "experimented"
+with it. Let me tell you something -- Jonas Salk "experiments"; these
+guys were getting stoned!
+ -- Johnny Carson
+%
+You now have Asian Flu.
+%
+You or I must yield up his life to Ahrimanes. I would rather it were
+you. I should have no hesitation in sacrificing my own life to spare
+yours, but we take stock next week, and it would not be fair on the
+company.
+ -- J. Wellington Wells
+%
+You own a dog, but you can only feed a cat.
+%
+You plan things that you do not even
+attempt because of your extreme caution.
+%
+You possess a mind not merely twisted, but actually sprained.
+%
+You prefer the company of the opposite
+sex, but are well liked by your own.
+%
+You probably wouldn't worry about what people
+think of you if you could know how seldom they do.
+ -- Olin Miller
+%
+You recoil from the crude; you tend naturally toward the exquisite.
+%
+You roll my log, and I will roll yours.
+ -- Lucius Annaeus Seneca
+%
+You say potatoe,
+And I say potato.
+You say tomatoe,
+And I say tomato.
+Potatoe, potato,
+Tomatoe, tomato.
+Let's go be the Vice President...
+%
+You scratch my tape, and I'll scratch yours.
+%
+You see, I consider that a man's brain originally is like a little empty
+attic, and you have to stock it with such furniture as you choose. A fool
+takes in all the lumber of every sort he comes across, so that the knowledge
+which might be useful to him gets crowded out, or at best is jumbled up with
+a lot of other things, so that he has difficulty in laying his hands upon it.
+Now the skillful workman is very careful indeed as to what he takes into his
+brain-attic. He will have nothing but the tools which may help him in doing
+his work, but of these he has a large assortment, and all in the most perfect
+order. It is a mistake to think that that little room has elastic walls and
+can distend to any extent. Depend upon it there comes a time when for every
+addition of knowledge you forget something that you knew before. It is of
+the highest importance, therefore, not to have useless facts elbowing out
+the useful ones.
+ -- Sherlock Holmes
+%
+You see things; and you say "Why?"
+But I dream things that never were; and I say "Why not?"
+ -- George Bernard Shaw, "Back to Methuselah"
+ [No, it wasn't John F. Kennedy. Ed.]
+%
+You see, wire telegraph is a kind of a very, very long cat. You pull
+his tail in New York and his head is meowing in Los Angeles. Do you
+understand this? And radio operates exactly the same way: you send
+signals here, they receive them there. The only difference is that
+there is no cat.
+ -- Albert Einstein, when asked to describe radio
+%
+You seek to shield those you love
+and you like the role of the provider.
+%
+You shall be rewarded for a dastardly deed.
+%
+You shall judge of a man by his foes as well as by his friends.
+ -- Joseph Conrad
+%
+You should avoid hedging, at least that's what I think.
+%
+You should emulate your heros, but don't carry it too far. Especially
+if they are dead.
+%
+You should go home.
+%
+You should make a point of trying every experience once -- except
+incest and folk-dancing.
+ -- A. Bax, "Farewell My Youth"
+%
+You should never bet against anything in science at odds of more than
+about 10^12 to 1.
+ -- Ernest Rutherford
+%
+You should never ride in an airplane with a sports team,
+because if the plane goes down, it's you they're gonna eat!
+ -- Gordon Downie, singer for Tragically Hip
+%
+You should never wear your best trousers
+when you go out to fight for freedom and liberty.
+ -- Henrik Ibsen
+%
+You should not use your fireplace, because scientists now believe that,
+contrary to popular opinion, fireplaces actually remove heat from
+houses. Really, that's what scientists believe. In fact many
+scientists actually use their fireplaces to cool their houses in the
+summer. If you visit a scientist's house on a sultry August day,
+you'll find a cheerful fire roaring on the hearth and the scientist
+sitting nearby, remarking on how cool he is and drinking heavily.
+ -- Dave Barry, "Postpetroleum Guzzler"
+%
+You should tip the waiter $10, minus $2 if he tells you his name,
+another $2 if he claims it will be His Pleasure to serve you and
+another $2 for each "special" he describes involving confusing terms
+such as "shallots," and $4 if the menu contains the word "fixin's." In
+many restaurants, this means the waiter will actually owe you money.
+If you are traveling with a child aged six months to three years, you
+should leave an additional amount equal to twice the bill to compensate
+for the fact that they will have to take the banquette out and burn it
+because the cracks are wedged solid with gobbets made of partially
+chewed former restaurant rolls saturated with baby spit.
+
+In New York, tip the taxicab driver $40 if he does not mention his
+hemorrhoids.
+ -- Dave Barry, "The Stuff of Etiquette"
+%
+You should, without hesitation, pound your typewriter into a
+plowshare, your paper into fertilizer, and enter agriculture.
+ -- Business Professor, University of Georgia
+%
+You shouldn't have to pay for your love with your bones and your flesh.
+ -- Pat Benatar, "Hell is for Children"
+%
+You shouldn't wallow in self-pity. But it's OK to put
+your feet in it and swish them around a little.
+ -- Guindon
+%
+You single-handedly fought your way into this hopeless mess.
+%
+You teach best what you most need to learn.
+%
+You think Oedipus had a problem -- Adam was Eve's mother.
+%
+YOU TOO CAN MAKE BIG MONEY IN THE EXCITING FIELD OF PAPER SHUFFLING!
+
+Mr. Smith of Muddle, Mass. says: "Before I took this course I used to be
+a lowly bit twiddler. Now with what I learned at MIT Tech I feel really
+important and can obfuscate and confuse with the best."
+
+Mr. Watkins had this to say: "Ten short days ago all I could look forward
+to was a dead-end job as an engineer. Now I have a promising future and
+make really big Zorkmids."
+
+MIT Tech can't promise these fantastic results to everyone, but when
+you earn your MDL degree from MIT Tech your future will be brighter.
+
+ SEND FOR OUR FREE BROCHURE TODAY!
+%
+You too can wear a nose mitten.
+%
+You tread upon my patience.
+ -- William Shakespeare, "Henry IV"
+%
+You two ought to be more careful--
+your love could drag on for years and years.
+%
+You want to know why I kept getting promoted?
+Because my mouth knows more than my brain.
+ -- W. G.
+%
+You will always get the greatest recognition for the job you least like.
+%
+You will always have good luck in your personal affairs.
+%
+You will attract cultured and artistic people to your home.
+%
+You will be a winner today. Pick a fight with a four-year-old.
+%
+You will be advanced socially,
+without any special effort on your part.
+%
+You will be aided greatly by a person
+whom you thought to be unimportant.
+%
+You will be attacked by a beast who has the body of a wolf, the tail of
+a lion, and the face of Donald Duck.
+%
+You will be audited by the Internal Revenue Service.
+%
+You will be awarded a medal for disregarding safety in saving someone.
+%
+You will be awarded some great honor.
+%
+You will be awarded the Nobel Peace Prize... posthumously.
+%
+You will be called upon to help a friend in trouble.
+%
+You will be dead within a year.
+%
+You will be divorced within a year.
+%
+You will be given a post of trust and responsibility.
+%
+You will be held hostage by a radical group.
+%
+You will be honored for contributing
+your time and skill to a worthy cause.
+%
+You will be imprisoned for contributing
+your time and skill to a bank robbery.
+%
+You will be married within a year.
+%
+You will be married within a year, and divorced within two.
+%
+You will be misunderstood by everyone.
+%
+You will be recognized and honored as a community leader.
+%
+You will be reincarnated as a toad; and you will be much happier.
+%
+You will be run over by a beer truck.
+%
+You will be run over by a bus.
+%
+You will be singled out for promotion in your work.
+%
+You will be successful in love.
+%
+You will be surprised by a loud noise.
+%
+You will be surrounded by luxury.
+%
+You will be the last person to buy a Chrysler.
+%
+You will be the victim of a bizarre joke.
+%
+You will be Told about it Tomorrow. Go Home and Prepare Thyself.
+%
+You will be traveling and coming into a fortune.
+%
+You will be winged by an anti-aircraft battery.
+%
+You will become rich and famous unless you don't.
+%
+You will contract a rare disease.
+%
+You will engage in a profitable business activity.
+%
+You will experience a strong urge to do good; but it will pass.
+%
+You will feel hungry again in another hour.
+%
+You will find me drinking gin
+In the lowest kind of inn,
+Because I am a rigid Vegetarian.
+ -- G. K. Chesterton
+%
+You will forget that you ever knew me.
+%
+You will gain money by a fattening action.
+%
+You will gain money by a speculation or lottery.
+%
+You will gain money by an illegal action.
+%
+You will gain money by an immoral action.
+%
+You will get what you deserve.
+%
+You will give someone a piece of your mind, which you can ill afford.
+%
+You will have a head crash on your private pack.
+%
+You will have a long and boring life.
+%
+You will have a long and unpleasant discussion with your supervisor.
+%
+You will have domestic happiness and faithful friends.
+%
+You will have good luck and overcome many hardships.
+%
+You will have long and healthy life.
+%
+You will have many recoverable tape errors.
+%
+You will hear good news from one you thought unfriendly to you.
+%
+You will inherit millions of dollars.
+%
+You will inherit some money or a small piece of land.
+%
+You will live a long, healthy, happy life and make bags of money.
+%
+You will live to see your grandchildren.
+%
+You will lose an important disk file.
+%
+You will lose an important tape file.
+%
+You will lose your present job and have to become a door to door
+mayonnaise salesman.
+%
+You will meet an important person who will help you advance professionally.
+%
+You will never amount to much.
+ -- Munich Schoolmaster, to Albert Einstein, age 10
+%
+You will never know hunger.
+%
+You will not be elected to public office this year.
+%
+You will obey or molten silver will be poured into your ears.
+%
+You will outgrow your usefulness.
+%
+You will overcome the attacks of jealous associates.
+%
+You will pass away very quickly.
+%
+You will pay for your sins.
+If you have already paid, please disregard this message.
+%
+You will pioneer the first Martian colony.
+%
+You will probably marry after a very brief courtship.
+%
+You will reach the highest possible point in your business or profession.
+%
+You will receive a legacy which will place you above want.
+%
+You will remember something that you should not have forgotten.
+%
+You will remember, Watson, how the dreadful business of the Abernetty family
+was first brought to my notice by the depth which the parsley had sunk into
+the butter upon a hot day.
+ -- Sherlock Holmes
+%
+You will soon forget this.
+%
+You will soon meet a person who will play an important role in your life.
+%
+You will step on the night soil of many countries.
+%
+You will stop at nothing to reach your objective,
+but only because your brakes are defective.
+%
+You will think of something funnier than this to add to the fortunes.
+%
+You will triumph over your enemy.
+%
+You will visit the Dung Pits of Glive soon.
+%
+You will win success in whatever calling you adopt.
+%
+You will wish you hadn't.
+%
+You won't skid if you stay in a rut.
+ -- Frank Hubbard
+%
+You work very hard. Don't try to think as well.
+%
+You worry too much about your job.
+Stop it. You are not paid enough to worry.
+%
+"You would do well not to imagine profundity," he said. "Anything that seems
+of momentous occasion should be dwelt upon as though it were of slight note.
+Conversely, trivialities must be attended to with the greatest of care.
+Because death is momentous, give it no thought; because victory is important,
+give it no thought; because the method of achievement and discovery is less
+momentous than the effect, dwell always upon the method. You will strengthen
+yourself in this way."
+ -- Jessica Salmonson, "The Swordswoman"
+%
+You would if you could but you can't so you won't.
+%
+You'd best be snoozin', 'cause you don't
+be gettin' no work done at 5 a.m. anyway.
+ -- From the wall of the Wurster Hall stairwell
+%
+You'd better beat it. You can leave in a taxi. If you can't get a
+taxi, you can leave in a huff. If that's too soon, you can leave in a
+minute and a huff.
+ -- Groucho Marx
+%
+You'd better smile when they watch you, smile like you're in control.
+ -- Smile, "Was (Not Was)"
+%
+You'd like to do it instantaneously, but that's too slow.
+%
+You'll always be,
+What you always were,
+Which has nothing to do with,
+All to do, with her.
+ -- Company
+%
+You'll be called to a post requiring
+ability in handling groups of people.
+%
+You'll be sorry...
+%
+You'll feel devilish tonight.
+Toss dynamite caps under a flamenco dancer's heel.
+%
+You'll feel much better once you've given up hope.
+%
+You'll never be the man your mother was!
+%
+You'll never see all the places, or read all the
+books, but fortunately, they're not all recommended.
+%
+You'll wish that you had done some of the
+hard things when they were easier to do.
+%
+Young men are fitter to invent than to judge; fitter for execution than for
+counsel; and fitter for new projects than for settled business. For the
+experience of age, in things that fall within the compass of it, directeth
+them; but in new things, abuseth them. The errors of young men are the ruin
+of business; but the errors of aged men amount but to this, that more might
+have been done, or sooner. Young men, in the conduct and management of
+actions, embrace more than they can hold; stir more than they can quiet; fly
+to the end, without consideration of the means and degrees; pursue some few
+principles which they have chanced upon absurdly; care not how they innovate,
+which draws unknown inconveniences; and, that which doubleth all errors, will
+not acknowledge or retract them; like an unready horse, that will neither stop
+nor turn. Men of age object too much, consult too long, adventure too little,
+repent too soon, and seldom drive business home to the full period, but
+content themselves with a mediocrity of success. Certainly, it is good to
+compound employments of both ... because the virtues of either age may correct
+the defects of both.
+ -- Francis Bacon, "Essay on Youth and Age"
+%
+Young men, hear an old man to whom
+old men hearkened when he was young.
+ -- Augustus Caesar
+%
+Young men think old men are fools;
+but old men know young men are fools.
+ -- George Chapman
+%
+Your aim is high and to the right.
+%
+Your aims are high, and you are capable of much.
+%
+Your analyst has you mixed up with another patient.
+Don't believe a thing he tells you.
+%
+Your best consolation is the hope that the things
+you failed to get weren't really worth having.
+%
+Your boss climbed the corporate ladder, wrong by wrong.
+%
+Your boss is a few sandwiches short of a picnic.
+%
+Your boyfriend takes chocolate from strangers.
+%
+Your business will assume vast proportions.
+%
+Your business will go through a period of considerable expansion.
+%
+Your code should be more efficient!
+%
+Your computer account is overdrawn. Please reauthorize.
+%
+Your computer account is overdrawn. Please see Big Brother.
+%
+Your conscience never stops you from doing anything. It just stops you
+from enjoying it.
+%
+Your Co-worker Could Be a Space Alien, Say Experts
+ ...Here's How You Can Tell
+Many Americans work side by side with space aliens who look human -- but you
+can spot these visitors by looking for certain tip-offs, say experts. They
+listed 10 signs to watch for:
+ #3. Bizarre sense of humor. Space aliens who don't understand
+ earthly humor may laugh during a company training film or tell
+ jokes that no one understands, said Steiger.
+ #6. Misuses everyday items. "A space alien may use correction
+ fluid to paint its nails," said Steiger.
+ #8. Secretive about personal life-style and home. "An alien won't
+ discuss details or talk about what it does at night or on weekends."
+ #10. Displays a change of mood or physical reaction when near certain
+ high-tech hardware. "An alien may experience a mood change when
+ a microwave oven is turned on," said Steiger.
+The experts pointed out that a co-worker would have to display most if not
+all of these traits before you can positively identify him as a space alien.
+ -- National Enquirer, Michael Cassels, August, 1984
+
+ [I thought everybody laughed at company training films. Ed.]
+%
+Your depth of comprehension may tend to make you lax in worldly ways.
+%
+Your digestive system is your body's Fun House, whereby food goes on a long,
+dark, scary ride, taking all kinds of unexpected twists and turns, being
+attacked by vicious secretions along the way, and not knowing until the last
+minute whether it will be turned into a useful body part or ejected into the
+Dark Hole by Mister Sphincter. We Americans live in a nation where the
+medical-care system is second to none in the world, unless you count maybe
+25 or 30 little scuzzball countries like Scotland that we could vaporize in
+seconds if we felt like it.
+ -- Dave Barry, "Stay Fit & Healthy Until You're Dead"
+%
+Your domestic life may be harmonious.
+%
+Your education begins where what is called your education is over.
+%
+Your fault - core dumped
+%
+Your files are now being encrypted and thrown into the bit bucket.
+EOF
+%
+Your fly might be open (but don't check it just now).
+%
+YOUR FOAMY FUTURE
+ by Miss Fortune
+
+AQUARIUS (Jan. 20 - Feb. 18)
+ You have nothing better to think about than what to wear and what
+type of champagne to take to the neighbors Halloween Party. Just take beer!
+Don't try to copy the "Joneses", pull them up to your level and remember, in
+California Halloween is redundant anyhow.
+
+PISCES (Feb. 19 - March 20)
+ Focus on strengthening friendships this Fall. You find others are
+fascinated by your intelligence, your wit, your drinking ability, and your
+bank account. Just make sure you realize it's far more impressive when
+other discover your good qualities without your help.
+%
+YOUR FOAMY FUTURE
+ by Miss Fortune
+
+ARIES (March 21 - April 19)
+ Matters are not good, where your health is concerned. This Fall, be
+sure to "walk groundly, talk profoundly, drink roundly, and sleep soundly"
+and you will live all the days of your life.
+
+TAURUS (April 20 - May 20)
+ You spent a fortune on beer this past summer and now find yourself
+in a deep depression because you can't afford even one of your favorite
+brewskis. Don't fret too much, Taurus. To get back on your feet simply
+miss two car payments.
+
+GEMINI (May 21 - June 21)
+ You think you're falling in love with a person who has a lot in
+common with yourself. You both prefer ales, you've both tried your hand
+at homebrewing, and you both want to visit every new brewpub that opens.
+Sounds impressive but remember you really don't know your partner until
+you meet in court.
+%
+YOUR FOAMY FUTURE
+ by Miss Fortune
+
+CANCER (Jun 22 - July 22)
+ You've been awarded a clean bill of health this month and you feel
+you owe it all to the excessive amount of Vitamin B, Iron, and Malt you get
+in your beer. Being healthy is admirable but don't you think you're going
+to feel stupid one day lying in a hospital dying of nothing?
+
+LEO (July 23 - August 22)
+ You will soon acquire a large sum of money and will be in seventh
+heaven as you head to the nearest Liquor Barn and buy all the beer they have
+in stock. Whoever said money couldn't buy happiness didn't know where to
+shop.
+
+VIRGO (August 23 - September 22)
+ Your late night, beer drinking, "life in the fast lane" parties are
+affecting your job production the next morning. You feel a nine to five job
+is not for a "party animal" such as yourself and may feel the need for a
+career change. Just remember, people who work sitting down get paid more
+than people who work standing up.
+%
+Your friends will know you better in the first minute you
+meet than your acquaintances will know you in a thousand years.
+ -- Richard Bach, "Illusions"
+%
+Your goose is cooked.
+(Your current chick is burned up too!)
+%
+Your happiness is intertwined with your outlook on life.
+%
+Your heart is pure, and your mind clear, and your soul devout.
+%
+Your ignorance cramps my conversation.
+%
+Your life would be very empty if you had nothing to regret.
+%
+Your love life will be happy and harmonious.
+%
+Your love life will be... interesting.
+%
+Your lover will never wish to leave you.
+%
+Your lucky color has faded.
+%
+Your lucky number has been disconnected.
+%
+Your lucky number is 3552664958674928.
+Watch for it everywhere.
+%
+Your manuscript is both good and original, but the part that is good is not
+original and the part that is original is not good.
+ -- Samuel Johnson
+%
+Your mind is the part of you that says,
+ "Why'n'tcha eat that piece of cake?"
+... and then, twenty minutes later, says,
+ "Y'know, if I were you, I wouldn't have done that!"
+ -- Steven and Ondrea Levine
+%
+Your mind understands what you have been
+taught; your heart, what is true.
+%
+Your mode of life will be changed for
+the better because of good news soon.
+%
+Your mode of life will be changed for
+the better because of new developments.
+%
+Your mode of life will be changed to ASCII.
+%
+Your mode of life will be changed to EBCDIC.
+%
+Your mothers ghost stands at your shoulder
+Face like ice, a little bit colder
+She says "You can't do that it breaks all the rules
+You learned in school"
+But I don't really see
+Why can't we go on as three?
+ -- David Crosby, "Triad"
+%
+Your motives for doing whatever good deed you
+may have in mind will be misinterpreted by somebody.
+%
+Your nature demands love and your happiness depends on it.
+%
+Your object is to save the world,
+while still leading a pleasant life.
+%
+Your only obligation in any lifetime is to be true to yourself. Being
+true to anyone else or anything else is not only impossible, but the
+mark of a fake messiah. The simplest questions are the most profound.
+Where were you born? Where is your home? Where are you going? What
+are you doing? Think about these once in awhile and watch your answers
+change.
+ -- Messiah's Handbook: Reminders for the Advanced Soul
+%
+Your own qualities will help prevent your advancement in the world.
+%
+Your password is pitifully obvious.
+%
+Your picture of the world often changes just before you get it into focus.
+%
+Your present plans will be successful.
+%
+Your program is sick! Shoot it and put it out of its memory.
+%
+Your reasoning powers are good, and you are a fairly good planner.
+%
+Your responsibility as a parent is not as great as you might imagine. You
+need not supply the world with the next conqueror of disease or major motion
+picture star. If your child simply grows up to be someone who does not use
+the word "collectible" as a noun, you can consider yourself an unqualified
+success.
+ -- Fran Lebowitz, "Social Studies"
+%
+Your sister swims out to meet troop ships.
+%
+Your society will be sought by people of taste and refinement.
+%
+Your step will soil many countries.
+%
+Your supervisor is thinking about you.
+%
+Your talents will be recognized and suitably rewarded.
+%
+Your temporary financial embarrassment will
+be relieved in a surprising manner.
+%
+Your true value depends entirely on what you are compared with.
+%
+Your wig steers the gig.
+ -- Lord Buckley
+%
+Your wise men don't know how it feels
+To be thick as a brick.
+ -- Jethro Tull, "Thick As A Brick"
+%
+Your worship is your furnaces
+which, like old idols, lost obscenes,
+have molten bowels; your vision is
+machines for making more machines.
+ -- Gordon Bottomley, 1874
+%
+You're a card which will have to be dealt with.
+%
+You're a good example of why some animals eat their young.
+ -- Jim Samuels to a heckler
+
+Ah, yes. I remember my first beer.
+ -- Steve Martin to a heckler
+
+When your IQ rises to 28, sell.
+ -- Professor Irwin Corey to a heckler
+%
+You're all clear now, kid.
+Now blow this thing so we can all go home.
+ -- Han Solo
+%
+You're almost as happy as you think you are.
+%
+You're already carrying the sphere!
+%
+You're always thinking you're gonna be
+the one that makes 'em act different.
+ -- Woody Allen, "Manhattan"
+%
+You're at the end of the road again.
+%
+You're at Witt's End.
+%
+You're being followed. Cut out the hanky-panky for a few days.
+%
+You're currently going through a difficult transition period called "Life."
+%
+You're definitely on their list.
+The question to ask next is what list it is.
+%
+You're either part of the solution or part of the problem.
+ -- Eldridge Cleaver
+%
+You're growing out of some of your problems,
+but there are others that you're growing into.
+%
+You're just the sort of person I imagined marrying, when I was little...
+except, y'know, not green... and without all the patches of fungus.
+ -- Swamp Thing
+%
+You're never too old to become younger.
+ -- Mae West
+%
+You're not Dave. Who are you?
+%
+You're not drunk if you can lie on the floor without holding on.
+ -- Dean Martin
+%
+You're not my type. For that matter, you're not even my species!!!
+%
+You're reasoning is excellent -- it's
+only your basic assumptions that are wrong.
+%
+You're ugly and your mother dresses you funny.
+%
+You're using a keyboard! How quaint!
+%
+You're working under a slight handicap.
+You happen to be human.
+%
+Yours is not to reason why,
+Just to Sail Away.
+And when you find you have to throw
+Your Legacy away;
+Remember life as was it is,
+And is as it were;
+Chasing sounds across the galaxy
+'Till silence is but a blur.
+ -- QYX
+%
+Youth. It's a wonder that anyone ever outgrows it.
+%
+Youth -- not a time of life but a state of mind... a predominance of
+courage over timidity, of the appetite for adventure over the love of ease.
+ -- Robert F. Kennedy
+%
+Youth had been a habit of hers so long that she could not part with it.
+%
+Youth is a blunder, manhood a struggle, old age a regret.
+ -- Benjamin Disraeli, "Coningsby"
+%
+Youth is a disease from which we all recover.
+ -- Dorothy Fuldheim
+%
+Youth is such a wonderful thing. What a crime to waste it on children.
+ -- George Bernard Shaw
+%
+Youth is the trustee of posterity.
+%
+Youth is when you blame all your troubles on your parents; maturity is
+when you learn that everything is the fault of the younger generation.
+%
+You've always made the mistake of being yourself.
+ -- Eugene Ionesco
+%
+You've been Berkeley'ed!
+%
+You've been leading a dog's life. Stay off the furniture.
+%
+You've been telling me to relax all the way here,
+and now you're telling me just to be myself?
+ -- The Return of the Secaucus Seven
+%
+You've decked the halls with a dozen miles' length of electric lights.
+Your front lawn is a gleaming testament of incandescent wonder. The neighbors
+wear sunglasses 24/7, and orbiting satellites have officially picked up
+and pinpointed your house as the brightest spot on earth.
+
+You've finally put together the Christmas wonderland of your dreams... now
+if only you could get a good picture of it.
+
+Photographing holiday lights is no easy task.
+ -- from an email sent by photojojo.com
+%
+You've got to have a gimmick if your band sucks.
+ -- Gary Giddens
+%
+You've got to pity New Mexico... so far from heaven and so close to Texas.
+%
+You've got to think about tomorrow!
+
+TOMORROW! I haven't even prepared for *_y_e_s_t_e_r_d_a_y* yet!
+%
+YO-YO:
+ Something that is occasionally up but normally down.
+ (see also Computer).
+%
+Zall's Laws:
+ 1: Any time you get a mouthful of hot soup, the next thing you do
+ will be wrong.
+ 2: How long a minute is, depends on which side of the bathroom
+ door you're on.
+%
+Zeal, n.:
+ Quality seen in new graduates -- if you're quick.
+%
+Zero Defects, n.:
+ The result of shutting down a production line.
+%
+Zero Mostel: That's it baby! When you got it, flaunt it! Flaunt it!
+ -- Mel Brooks, "The Producers"
+%
+Zeus gave Leda the bird.
+%
+Zisla's Law:
+ If you're asked to join a parade, don't march behind the elephants.
+%
+Zounds! I was never so bethump'd with words
+since I first call'd my brother's father dad.
+ -- William Shakespeare, "King John"
+%
+Zymurgy's Law of Volunteer Labor:
+ People are always available for work in the past tense.
+%
diff --git a/usr.bin/fortune/datfiles/fortunes.sp.ok b/usr.bin/fortune/datfiles/fortunes.sp.ok
new file mode 100644
index 0000000..02229cd
--- /dev/null
+++ b/usr.bin/fortune/datfiles/fortunes.sp.ok
@@ -0,0 +1,4469 @@
+# $FreeBSD$
+AAAAAAAAAaaaaaaaaaaaaaaaccccccccckkkkkk
+AAAARRRRGGGGHHHH
+aafte
+Abbie
+ABC
+ABC's
+ABCDEF
+Abelson
+abends
+ABENDs
+Abernetty
+abhors
+ABM
+Absolutum
+absurdum
+Abzug
+AC
+acacia
+Academicians
+accessibleness
+accurancy
+accursed
+accusator
+Achenbach
+Acheson
+ACHTUNG
+ACLU
+ACLU's
+acne
+acupuncture
+Adamite
+Ade
+Adenauer
+Adhem
+Adhem's
+adhoc
+Adidas
+adj
+Adkin
+Adlai
+Adler
+Adler's
+admin's
+Adolf
+adv
+Aelius
+Aeroflot
+Aeschylus
+Aesop
+Aesop's
+AFOF
+Agnew
+Aha
+Ahab
+Ahhh
+ahhhed
+Ahhhhhh
+Ahrimanes
+AI
+AIIIEEEEEE
+Aiken
+Aim's
+airbags
+Akakia
+Akihabara
+Alaquon
+Albertano
+Albran
+ALBRECHT'S
+Alcoente
+Aldiss
+Aldo
+Aldous
+Aldrich
+Aleksandr
+Aleliunas
+Alfieri
+Algolian
+ALgorithmic
+Algren
+Ali
+Alighieri
+alimentary
+Alinsky
+Alito
+alkafluence
+All's
+Allan
+alleygaroo
+Allman
+Allucquere
+Alo
+Alph
+Alpo
+alrighty
+Altgeld
+Alther
+Altman
+altum
+ALU
+Alva
+Alvarado
+Alvy
+Alzado
+Amana
+Ameche
+Amerigo
+Ameringer
+Amica
+Amiri
+Amityville
+amnesia
+Amp
+Amputees
+Amrom
+anal
+Ananthanarayanan
+anat
+Anatol
+anatomies
+Anaxagoras
+anchorman
+andIsaidYesIsee
+Andrea's
+Andretti
+Androids
+Andropov's
+Angelou
+animalculous
+Animaux
+Ankh
+Annaeus
+Annau
+Anoint
+anomali
+Anorexic
+Anouilh
+ANRS
+Ansley
+answerback
+Anthony's
+Antonym
+Antrim
+Anwar
+anxivs
+anymore
+anytime
+AOPA's
+apauling
+apertures
+APL
+Apocryphia
+apolitical
+apostrophe's
+appelations
+Applebome
+Appleby
+Appledom
+approx
+Apr
+Aquadextrous
+Aquarians
+archaisms
+ARCHDUKE
+Archimedeans
+Arcturan
+Ardele
+Ardis
+Arenberg
+Arendt
+arias
+Aristophanes
+Arlen
+Arlo
+Arman
+Armenians
+Armistead
+Arnoux
+Arrakis
+Arsdall
+arse
+Artemus
+Arthur's
+Artic
+Artoo
+Arturo
+artworks
+ary
+ASCAR
+asdf
+Ashbula
+ASHes
+Ashleigh
+Asimov
+asketh
+Aspasia
+Aspin
+Assateague
+assed
+Assoc
+AST's
+Astaire's
+asterisked
+Asterix
+asthma's
+Astro
+astrology
+Astroturf
+asvgy
+Atlee
+ATN
+atrium
+Attila
+Auberon
+Auden
+AUDITME
+Audubon
+Auerbach
+Aug
+Augier
+Aunty
+Auribus
+Aurobindo
+ause
+ausgraben
+Austen
+AUUGM
+Avengers
+Avocado's
+Avogadro's
+awakenings
+awestruck
+awk
+AWNS
+awoken
+Aww
+Axton
+Ayn
+Ayres
+AZ
+Azerbaijanis
+B'nai
+Ba
+Baaa
+Baaaaah
+Baba
+Babbage
+Babson
+bac
+Bacall
+Bachtrian
+backflips
+backfstat
+backhoe
+backlit
+backscratcher
+bacon's
+Baez
+Bagbiter
+bagbiting
+Bagdikian's
+bagel
+Baggins
+bahz
+bai
+Balfour
+ballasted
+Balliett
+BALLISTOPHOBIA
+Balloonists
+Balmford
+Balthazar
+bamboozled
+Banacek's
+Banach
+bananosecond
+Bandifante
+Banectomy
+Bankhead
+banquette
+Banton
+Barach's
+Baraka
+Barbara's
+Barbie
+BARC
+barf
+BARFUCIOUS
+Bargewater
+Barker's
+Barrie
+Barris
+barristers
+Barrymore's
+Barth's
+Baruch's
+BASICs
+Basie's
+Baskins
+bassists
+Bathquake
+Batman
+Battie
+Battlecruiser
+Baum
+Baumol
+Bax
+Baycon
+baygulls
+bayonetted
+bazingas
+BBBF
+BBC
+BBW
+BC
+Beagle
+Beal
+BEANSTACK
+bearproof
+Beatles
+Beaton
+Beatty
+Beaumadine
+Beaumarchais
+Beauvoir
+Becker's
+Beckett
+Beckmann
+BeDears
+bedecked
+bedfellows
+bedpans
+beduerfen
+Beeblebrox
+Beekman
+beepers
+Beer's
+Beerbohm
+Beerbohm's
+Beeton
+befriends
+Begathon
+Begatting
+Begone
+Behan
+Behrendt
+Beifeld's
+being's
+Belchazar
+beleaguered
+believer's
+Bellamy
+Bellbottoms
+Belli
+Belloc
+Benares
+Benatar
+Benchley
+Benson's
+Bento's
+bequeathin
+Bergman
+Berke
+Berle
+Bernadette
+Berner
+Bernighan
+Berquier
+Berryman
+Bershere's
+bertillion
+Bertolt
+Besicovitch
+Beslove
+Betazoid
+Bette
+Bevan
+BEW
+Beyerstein
+BH
+Bics
+bicuspids
+Bidell
+Bidlake
+Bierce
+Bierman's
+Biff
+bigamystery
+Bigfoot
+Biggs
+Billericay
+billigrahams
+Bing's
+bingo
+Binstead
+Bionic
+Birnbaum
+bisexual
+Bistromathics
+BITCHEN
+BITCOUNT
+Bitti
+Bizoos
+Bjarne
+bjnk
+Blaauw
+blackguard
+blackrimmed
+BLAH
+Blaise
+blandishments
+BLEAH
+BLETCHEROUS
+blindman's
+blinkenlights
+Blish
+blockhead
+Bloodnok
+Bloom's
+Bloomberg
+Bloomingdale's
+Blore
+Blore's
+blotters
+BLOTTO
+blound
+Blount
+blowenfusen
+Bluestone
+Blutarsky's
+Blythe
+BMR
+BMW
+Bodanis
+Bodenheim
+body's
+Boffo
+bogglingly
+bogons
+bogosity
+Bohr's
+Boies
+Bok
+Bokonon
+Boleyn
+Bolger
+Boling's
+Bolotin
+Boltzmann's
+Bolub's
+Bombeck
+Bombeck's
+Bompzidaize
+Bonanno
+Bondian
+bonehead
+bonked
+Bonnard
+bonnie
+Boob's
+boobs
+Booch
+BOOGA
+booing
+bookaholic
+Booker's
+boola
+Boorstin
+bootable
+Boothe
+Bootle
+Boquist
+Boren
+Boren's
+Borge
+Borges
+Borgias
+Bosquet
+boss's
+Bossert
+bossy
+Bostic
+Boucher's
+Bounceoids
+Bounders
+bounteous
+Bourget
+Bourjaily
+Bower's
+Bowie's
+bowlin
+boyfriend
+Boyland
+Boyle
+Boynton
+Bozoness
+Bozos
+BPO
+bra
+Brackett
+Bradley's
+Brady's
+Brahma
+brain's
+Bramah
+Brandirali
+Brando
+Brandwein
+Brautigan
+BREAKAGES
+Brecher
+Brecheux
+Brecht
+Brenan
+Brescia
+Breslin
+brewsky
+Brewster's
+Brezhnev
+Briarton
+Brickman
+brilgue
+brilig
+Brillineggiava
+bringeth
+Brith
+Broder
+Brodsky
+Brogan's
+Broido
+Bromberg
+Brontosaurus
+Brooke's
+Brophy
+Brosnan
+Broughton
+Brownmiller
+Broxton
+brucification
+brucified
+brucify
+Brunner
+Bruton
+Brutus
+Bruyere
+Brylcreem
+Brynner
+Bryson
+BST
+BTUs
+Bubba
+Buckley
+Buckminster
+bucky
+Bucy's
+budgie
+budgies
+Buford
+Buford's
+bug'll
+Buggles
+Bugleboy
+Bugsy
+Buhr
+Bukhara
+Bukowski
+Bull's
+bullpen
+bullrushes
+Bullwinkle
+Bulwer
+bumperless
+Bumstead
+Bungei
+Buren
+Burggoven
+burgled
+Burke's
+Burkhalter
+Burkowski
+Burn's
+burneth
+Burnham
+Bush's
+Busmanship
+BUTTERWORTH
+BUTTHEADS
+buzzzzzzzzplooop
+bwuck
+BX
+BYOB
+Byrd's
+Bysshe
+c'est
+C'mon
+Caaaall
+caaddr
+caadr
+CAAR
+cabbies
+CABERNET
+Cabots
+Cabrillo
+cadadr
+cadavers
+CADDR
+CADR
+Caen
+Caesar's
+Caicedo
+Caillavet
+Caissons
+Calafia's
+Calibree
+Calibrees
+Calio's
+Callahan
+Callahan's
+Callimachus
+Camden
+Cameron
+Camillo
+Campbell
+Campbell's
+Camptown
+Candice
+Capades
+capillarized
+Capone
+Capone's
+Capt
+carabineri
+Caramels
+carbolized
+cardio
+Cardozo
+Carey
+Carly
+Carlyle's
+Carmel
+Carney's
+Carotene
+Carotene's
+Carperpetuation
+Carroll
+Carson's
+Carswell's
+CARTABLANCA
+Cartmill
+Carus
+Cary
+Casablanca
+Caskie
+Caspar
+Cassidy
+castaways
+Castenada
+Casteneda
+catalyzes
+Catchings
+Catflap
+Catiline
+Cato
+Catullus
+caulking
+causeth
+Cavett
+Cavour
+CB
+cbosgd
+CBS
+CChheecckk
+CCI
+CDAR
+cddr
+CDR
+CDS
+Cebrian
+Cec
+Cecelia
+Celibacy
+Celtics
+Celts
+Centauri
+centerfold
+Cerebron
+Cerebus
+Cerf
+Cestria
+cevalon
+cevalovipus
+CFF
+Chadwick
+chainsaw
+challengehood
+Chameleotoptor
+Chamfort
+Chaney
+Changtse
+Channing
+Chapin
+Chappaquidick
+Chapterhouse
+charbroiled
+CHARDONNAY
+Charnelhouse
+Charnock's
+chastened
+Chateaubriand
+Chatterley's
+Chauncey
+Chavez
+Chaykin
+Chazal
+Cheatham
+CHECK'S
+cheddar
+cheesemakers
+Cheetos
+Cheez
+Cheit's
+Chekov
+Chem
+chemotherapy
+cheque
+Chernenko
+Chesterson
+cheval
+Chevins
+chezlogs
+Chichester
+Chihuahuas
+childproof
+childproofed
+chimeras
+chimp
+chimpanzee's
+Chincholles
+Chinggis
+chirruped
+Chism's
+Chisolm's
+Chivas
+ChiWriter
+Chloroplast's
+Chmod
+chmod'd
+Chok
+CHOMPER
+CHOMPING
+Choo
+chopsticks
+chown
+Christensen
+Christgau
+chromosome
+chronodimensional
+chroots
+Chrysostom
+Chuan
+Chuang
+Chung's
+Church's
+Churchill's
+Churchy
+Chuzzlewit
+CI
+Ciardi
+cinched
+cinema's
+Cinemuck
+Claghorn
+Clair
+Clairol
+Clampett's
+Clapiers
+Clapton
+Clarke's
+Clarkson
+Claudette
+claus
+Clavin
+Clavin's
+CLBR
+CLBRI
+Clemenceau
+Cleyre
+clickity
+Clifton
+Clopton
+clovers
+Clutterbuck
+CMFRM
+cmptr
+Cobalt's
+Cobb
+Cobb's
+Cochran
+cockamamie
+Cocteau
+Cody
+Coevolution
+cogito
+Cohen's
+Cohn's
+Cointment
+Colbert
+Cole's
+Colette
+Collis
+Collymore
+Colson
+Colton
+Colvard's
+Comaneci
+Combermere
+Comebacks
+Commedia
+Commie
+CommUNIXque
+computatis
+Computerdom
+computerites
+Computerspeak
+Computo
+Conan
+congeries
+CONGRAM
+congresspersons
+Coningsby
+Conkling
+conks
+Connell
+Connellan
+Connery
+consoleth
+Constipation
+contendere
+continuums
+CONtractor
+Contrariwise
+conversationalists
+Conway
+Conway's
+Cooley
+COONDOG
+Coonts
+copacetic
+Coppock
+Coppola
+Corbomite
+corkenpoppen
+Corky
+coroner's
+corpuscle
+Corrado
+Corry's
+Cortot
+Corwin
+Cory
+Cosby
+Cosmo
+Cosmotronic
+COUGHBOL
+Coult
+countdown
+coupestibles
+Court's
+CP
+CPPR
+cpu
+CPUs
+crabgrass
+crapshoot
+Cray
+Crayolas
+Creemy
+Crenna's
+cretinisms
+Crichton
+criminology
+Cringely
+Cripps
+Crisco
+CRN
+Croce
+croissants
+Croll
+Croll's
+Cronkite
+Cropp's
+croquet
+crosseth
+crossoffs
+crossword
+crowbar
+Crucifixes
+cruftier
+Cruickshank's
+crunchy
+crustaceans
+Crustimoney
+crusty
+Cruz
+CS
+CSA
+CSH
+cshrc
+CSICOP
+CSSG
+CTA
+Cthulhu
+CTY
+Cuba's
+cuckolds
+CUISINART
+cummings
+Cuomo
+curiae
+CUSPy
+Custer
+custodiet
+cuticle
+CVP
+Cyberiad
+cybernetic
+Cyborg
+cynic's
+d'Albert
+D'Arcy
+D'Azevedo
+D'Hericault
+d'oeuvres
+Dabba
+DAC
+Daft
+Dagobah
+Dagwood
+Daibashiw
+Daley
+Dalglish
+Damian
+DAMMIT
+dancer's
+Dandridge
+dandruff
+Dangerfield
+dans
+darkish
+darkroom
+Darrow
+Darryl
+Darth
+Darwin's
+Darwinians
+das
+Dass
+Datamation
+datasheets
+dataspec
+DAV
+Davey
+Davis's
+Davisson
+Dawkins
+dawn's
+DC
+DCL
+DCS
+dduupplleexx
+deadest
+Deadnet
+DEALISM
+DEC's
+Decapitating
+decipi
+decipiatur
+deconstructionists
+Decot
+DECtapes
+DECWARS
+DECWORLD
+DECzilla
+DEF
+Defactualization
+defamed
+Deford
+DEFUN
+defuse
+DeGaulle
+DeGourmont
+DeLescure
+delivermail
+DeLorean
+Delores
+Deloria
+demagogism
+demigodic
+demo
+Democritus
+Demosthenes
+Denham
+Dennett
+Denning
+Denniston
+Depew
+deppart
+deregulated
+dermis
+DeSalvo
+Desiree
+deStalinization
+destitution
+destructure
+Deteriorata
+determinists
+Detroit
+Devine
+Devo
+DeVries
+Dexter's
+dextrose
+DFA
+Diamondback
+Dibble's
+Dickery
+diddie
+Diddley
+Diddly
+Didion
+Didja
+dieeeeee
+Diefenbaker
+DIETER'S
+Dieu
+Dijkstra
+Dilbert
+Diller
+Diller's
+Dills
+DiMarco
+dimwit
+dinette
+Dingell
+Dino
+Diran
+Dirbanu
+Dirisha
+Dirksen
+Dirksen's
+disarrayed
+disco
+discotheques
+disenchanted
+dishes
+dishonourable
+dishrags
+dishwashing
+disjoins
+diskdrives
+dismembering
+Disraeli
+Divina
+DIX
+dixerunt
+Diyathinkhesaurus
+DJ
+DMPK
+Dobb's
+Dobbs
+Dobie
+Doc
+Docquier
+doderez
+doggerel
+doggy
+dogmatized
+DOGO
+Dogtender
+Doheny's
+Dolby
+doloop
+Dolotta
+Dolph
+Donatus
+Donleavy
+Donnell
+Donner
+Doo
+DOODAH
+Dooley's
+Doonesbury
+doorstops
+Doppelgutt
+Doren
+dorky
+dost
+doth
+dotty
+Doublespeak
+Dow's
+downslide
+DP
+Drabek
+Dracula
+Drake's
+Drakenberg's
+draweth
+Drescher
+Dreshfield
+Drew's
+drivel
+drop't
+Dropt
+Droz
+Drucker
+Druids
+druther
+druthers
+DSK
+Ducharme's
+Duckie
+Duckies
+Ducky
+dudes
+dUdX
+duenkt
+Duggan
+Dukakis
+Dum
+dumbass
+Dumbfounding
+dummkopfen
+dumpster
+Dunaway
+Dunne
+dunno
+Durance
+Durant
+Durante
+Durocher
+Dutsky
+dwelleth
+Dyer's
+Dykes
+dyslexic
+Dyson
+Eagleson
+Eagleson's
+earflaps
+EAROM
+Earthlings
+Eater's
+EBCDIC
+Ebenezum
+Ebert
+Ebner
+ecamier
+Eckstein
+ECL
+Ecoles
+ecosphere
+Edina
+Edison's
+Edman
+Edmonson's
+Edna's
+Edpress
+EDSAC
+Edsel
+EDT
+educationists
+EE
+EECS
+eeee
+eeeee
+eeeeee
+Eeny
+Eeyore
+egg's
+Eggheads
+eggnog
+egoless
+Egomaniac's
+egrep
+Ehrenfest
+Ehrman's
+Eichmann's
+Eiffelberg
+Einhorn
+EINS
+Einstein's
+Eisley
+Elbert
+Eldridge
+electrocommunications
+Electrocution
+electrofreak
+electromicrograph
+Electroworld
+eliras
+elitist
+Ellery
+Elliot
+Elmo
+ELO
+Elroy
+Elton
+Elven
+Elvis
+Elvish
+embalmer's
+Emersons
+Emile
+Emmons
+Emo
+empathetical
+EMPC
+Emu
+Encyclopaedia
+endian
+Enesco
+Enfolding
+England's
+Englishman's
+ENIACs
+enkindles
+Enm
+Ennius
+Ennui
+ENOTADUCK
+Epcot
+Ephron
+EPI
+Epictetus
+Epitres
+Epperson's
+Erdman's
+ergo
+ergonomically
+Erhard
+Erlenmeyer
+Erlich
+Erling
+Erogenous
+erogeny
+Ertz
+Esalen
+Esar
+escalators
+Eschenbach
+Escher
+esperantisto
+Esplandian
+est
+estas
+Estes
+Estienne
+ethernet
+Etienne
+Etudes
+etus
+Euch
+Euell
+Euler's
+eurocentric
+Eustace
+ev'ry
+EVAL
+Eve's
+Evelyn's
+Everclear
+Evinrude
+EWD
+EXCE
+excitements
+exCUUUUUSE
+executioners
+exhalation
+exhibitionists
+EXP
+expatriated
+extracurricular
+Exupery
+Exxon's
+eyestalks
+Eyquem
+Ezrin
+FAA
+Factorials
+Fadiman
+Fafhrd
+Fagan
+Fagon
+fainali
+fairings
+fairminded
+Faisse
+Fakir
+Falkland
+fallaron
+Fallian
+familiares
+Fandal
+fandangos
+FARECARD
+Farnum
+Farrah
+Farrow
+fatback
+Fatherland
+faudrait
+faut
+Fawcett
+FC
+FCN
+feeder's
+Feghoot
+Feibleman
+Feiffer
+Feiner
+Feirstein
+fella
+Fellgett's
+Felton
+feminism's
+Femme
+Fenelon
+Fenster
+Ferber
+Ferengi
+Ferentz
+Ferguson's
+Ferm
+Fermat's
+Ferrari
+FERSURE
+fertsneet
+Festa
+fetishists
+Feynman
+FF
+FFT
+FHA
+FICA
+Fidel
+Fiebig
+Fiedler
+figgy
+fighting's
+Figliuolo
+fikcio
+fiks
+filees
+filename
+filigrees
+Filkharmonics
+Fillmore
+filors
+Finagle
+Finagle's
+Finagling
+findeth
+Fine's
+Finke
+Finklestein
+finks
+Finley
+FINO
+Finster's
+firehose
+Firesign
+Firth
+Fishhawk
+fix'd
+fixin's
+Flaccus
+Flagg
+Flakey
+flamewars
+Flandry
+Flannagan's
+Flannery
+Flappity
+flatfoot
+flatteries
+Flaubert
+Fleischman's
+Flintstone
+flippered
+Flon's
+floppity
+Florio
+floss
+Flugg's
+Flummery
+flutterby
+flyswatter
+Fogerty
+Foghorn
+foghorns
+folkloric
+Follen
+fool's
+Forbiddie
+Forcade
+forelegs
+foreplay
+fornia
+forsooth
+Forssman
+fortiter
+Fortue
+Fosdick
+fountainheads
+Fowler's
+fractal
+Frampton
+Fran
+Francois
+Frankau
+Frankenstein's
+Franklin's
+FRAS
+Fratianno
+Frayn
+freaking
+FreeBSD
+FreeBSDcon
+freelancer
+Freeman's
+freezin
+Freitzke's
+Frenchman's
+Fresco's
+Freudians
+fridge
+Fried's
+Friedenberg
+Friedrich
+Friendman
+frillant
+Frisbee
+Frisbees
+Frisbeetarianism
+Frito
+Fritzkee's
+Fritzlar
+frob
+frob'nitsm
+Frobazz
+frobbing
+FROBBOTZIM
+FROBBOZ
+Frobenius
+Frobnicate
+Frobnitz
+Frobnitzem
+FROBNODULE
+FROBNULE
+FrobTech
+FROBULE
+frolicked
+Froot
+Frostee
+FROTZ
+FRS
+fruitcake
+fruitcakes
+frumious
+Frumkes
+fseek
+FTC
+FTL
+FTSD
+Fuch's
+Fudd
+Fudd's
+fuddyduddy
+Fuldheim
+Fulghum
+Fulke
+fumblefingers
+functionaries
+funhouse
+Fuoss
+Furbling
+Furst
+FWWAAAAAAPPPP
+Fylstra
+Fyodor
+Gabe's
+Gabor
+Gadsbys
+Gaius
+Galactica
+Galbraith
+Galbraith's
+Galilei
+Galileo
+Galileo's
+Gallagher
+Galliano
+Gallienne
+Gallois
+galore
+Galsworthy
+Galton
+Galvani
+Galvani's
+gambler's
+gamekeeper
+Gamekeeping
+Gandalf
+Gandhi
+ganz
+Garagiola
+Garbers
+Gardner's
+garnishment
+Garp
+Gatling
+Gaulle
+Gauls
+Gaultier
+Gauvreay
+Gaveau
+GC
+GCC
+GCing
+GCs
+Gdansk
+gefingerpoken
+Geis
+Gelbart
+Gellett
+Geminis
+Genderplex
+Genesereth
+Genghis
+genocide
+Genter
+Geritol
+Germaine
+Gerould
+Gerrold's
+Gesserit
+gesteckt
+getchar
+Getraenke
+Gettys
+gewerken
+gharsley
+Ghostbusters
+Giancana
+Gibaud
+Gibran
+Gibrovacco
+Giddens
+Giesing
+giftlist
+Gigo
+Gilbert's
+Gilchrist
+Gilda
+Gilliam
+Gilmore
+Gilpkerio
+gimble
+Gimlet
+Gimme
+gimmick
+gimmie
+Gingell
+gingivectomist
+Ginsberg
+Ginsberg's
+Ginsburg's
+Ginzburg
+Giraudoux
+Giraudy
+girlfriend
+Giuggiolo
+Giuseppe
+Glanvill
+Glaser
+gleekzorp
+Glegg
+gleknow
+Glib's
+Glimco
+globby
+Gloffing
+Glogg
+glowworm
+Glymour
+glyphs
+GMT
+Gnagloot
+gobbets
+Gobel
+GOBLIN
+Goda's
+Godard
+Godard's
+Goddard's
+Godel's
+Godot
+Godzilla
+Goebbels
+goest
+Goestheveezl
+goeth
+Gold's
+Golda
+Goldengrove
+Goldenstern
+Goldenstern's
+Goldfinger
+Goldfoot
+Goldwater's
+Goldwyn
+Goleta
+Gomme's
+Gondoliers
+gonna
+Gonnet
+goodbye
+GoodGulf
+Goodgulf
+Goodstein
+Gopete
+Gorbachev
+Gorden
+Gordon's
+Gorey
+Gorin
+Gossling
+Gotlieb
+goto
+goto's
+Gotos
+GOTOs
+gotta
+Gotti
+Goudsmit
+gougebosquex
+Gould
+Goulden
+GOUTS
+Goy's
+goyim
+goyish
+goyisha
+GPU
+Grabel's
+Graf
+Graffiti
+graffitiest
+graffito
+Grainger
+Grainger's
+Gramm
+grammarian's
+GRAMmer
+Grandad
+grandsires
+Granholm
+Grantland
+Graper
+GRASSHOPPOTAMUS
+grave's
+gravitons
+Gravity's
+Gray's
+Greaser's
+Green's
+Greener's
+Greenfatigues
+Greenleaf
+Greensleeves
+Greenspun's
+Greenstein
+Greenstreet
+Greer
+Gregorian
+Gregory's
+Greider
+Grelb's
+grep
+Gretzky
+Greville
+Gries
+Griffin's
+Grinnell's
+Gripton
+Grishman
+Grizzard
+grizzlies
+GRODY
+Groening
+Grogan
+grok
+grommets
+Groucho
+grouse
+Gruber
+gry
+Guadalajara
+Guardsman
+Guaspari
+guave
+Guerre
+Guerrero
+GUGUs
+guideth
+Guildenstern
+Guindon
+Guinness
+Gulag
+Gulbenkian
+gumball
+gumballs
+Gumbinowitz
+GUMM
+GUMMed
+Gumperson's
+Gumps
+gunships
+Gunter's
+guppies
+Gurmlish
+Gusenberg
+Gustav
+Gustave
+guttersnipe
+Gutzwiller
+Guzik
+Guzman
+Gween
+Gyles
+gyre
+gyrent
+haben
+Hackensack
+Hacking's
+Hadamard
+Hadamard's
+Hadassah
+hadda
+Haeckel
+hag's
+Hagar's
+Hahahahahahahahaha
+Haig
+hairstyles
+Hakuin
+Halas
+Haldeman
+Haley
+halfbreed
+halfwits
+Halley's
+Hallifax
+Halliwell
+Hallock
+hallucinogens
+Halpern
+HALs
+Halsey
+Halstead
+Hammarskjold
+Hammerstein
+handcraftsmanship
+Handel's
+Handey
+handsprings
+handwaving
+hanky
+Hanlon's
+Hanson's
+Hanukka
+Harary
+Harbride
+hardbound
+hardcore
+Hardluckland
+Hargrave
+Harlan
+Harlequin
+Harley
+Harlow
+Harpo
+Harpoon
+Harriet's
+Harris's
+Harrisberger's
+Harrison's
+Harrold
+Harter
+Hartke
+Hartley's
+Harvard's
+hast
+Hathrume
+Hausdorff
+Havabanana
+Havelock
+HavenTree
+Hawes
+Hawkeye
+Hawkeye's
+Hawkwind
+Hayakawa
+Hayden
+Haynie
+Hazlitt
+HBD
+HCF
+headgear
+Heartwarming
+heatwave
+Hebb
+hectare
+HED
+Hedy
+HEE
+Hegel
+heifer's
+Heimel
+Heine
+Heineken
+Heinlein
+heinous
+Helen's
+Helens
+Helga
+Heller's
+Helliconia
+Helllloooooo
+Hellman
+Hellman's
+HELMS
+hematophagous
+Hemiel
+Henningsen
+Henny
+Henri
+Henrik
+Henson
+Hepler
+her's
+Herbert's
+Herford
+hermit
+hernias
+Herrgott
+Hershey's
+Herth's
+Herzog
+hev
+Hewett's
+Hewitt
+hexagram
+Hexahex
+Hickery
+Hickson
+Higgeldy
+Higgins
+highbrow
+Hightower
+Hilaire
+Hildago
+Hildebrandt
+Hildebrant's
+Hillary's
+Hillbillies
+Hinckley
+Hinckley's
+Hindenburg
+Hipcrime
+Hippensteel
+Hippocrates
+hippogriff
+hippopotamuses
+Hirschfield
+Hitchcock's
+Hitchhiker's
+Hiya
+hjioasdvbnuio
+Hlade's
+Hmm
+Hmmm
+Hmmmm
+Hoaars
+Hoare
+Hoare's
+Hoarsepower
+HOAX
+HOB'LIN
+Hoban
+Hobbits
+Hochstetter
+Hoest
+Hoffa
+Hoffenstein
+Hoffer
+Hoffer's
+Hofstadter
+Hofstadter's
+Hogan's
+Hogarth
+Hogben
+Holton
+homeowner's
+Homespun
+Honesty's
+Honeymoon's
+Honig
+honorific
+honour
+hoofprints
+HOOTCH
+hootchy
+hooved
+Hoppe
+Horace's
+horgrave
+hormonal
+Horne
+Horner's
+Horngren's
+hors
+Horstmann
+Horta
+hound's
+houseplant
+houseplants
+HOUSERED
+housewares
+Housman
+How'd
+Howdershelt
+Howe's
+Hoyt
+HR
+Hubbard
+Hubbard's
+Huffman
+hullabaloo
+human's
+humour
+Humperdinck
+Humpf
+Humpfed
+Humphrey's
+hunchbacks
+Huneker
+Huntingdon
+Hurewitz's
+Hussein
+Husserl's
+Huxtable
+Hyatt
+Hyde
+hyper
+hyperdrive
+Hyperion
+Hypermint
+hyperplanes
+IA
+Iacocca
+Ian
+ibi
+IBMer
+IBMese
+IBP
+IC
+ICBM
+icepacks
+ICs
+ID's
+ideogram
+ideograms
+Idi
+iear
+Iears
+IEC
+IEH
+iers
+if's
+ifthen
+Igmmlptk
+Ignatowski
+ihuxw
+IIc
+III's
+Il
+Iles
+Iles's
+illiterate's
+Illiterati
+Imamu
+imbeciles
+Imbesi's
+IMMANUEL's
+imperiling
+impersonators
+impo
+Inamorati
+Inanities
+inattentions
+incivility
+incorrige
+incrustations
+incurreth
+infiniteloop
+InfoWorld
+ingenium
+Ingliy
+Ingmar
+Ingrid
+inhalations
+init
+inkahol
+inkwells
+Inlaws
+innumerate
+inprectoo
+inputdir
+inquit
+inrushing
+insa
+Insider's
+INSQSW
+interdicted
+interferon
+interpreter's
+interunderstanding
+Ionesco
+IOS
+IOT
+Iowans
+Iphicrates
+ipsos
+IQ
+IQs
+Irishman's
+ironmongery
+irrelephant
+IRS
+Irulan
+Isaak
+Iso
+Issawi
+Issawi's
+Ist
+Italo
+itn
+Itty
+Ium
+ius
+Ivanovo
+Iverson
+IXDRTYju
+Jabberstock
+Jabberstocky
+Jacek
+Jackals
+Jackasses
+jackrabbit
+jackrabbits
+Jacquard
+Jacquin's
+Jael
+Jaglan
+Jahnke
+Jahoda
+Jaka
+Janelle
+Janx
+jarheads
+Jarry
+Jaspar
+jast
+Jawaharlal
+Jayne
+JCL
+Jed's
+Jedi
+jeered
+Jeffersons
+Jehan
+Jekyll
+Jell
+Jeltz
+Jenerally
+Jenkinson's
+Jenks
+Jenning's
+Jerrold
+jeunesse
+JFK
+JFK's
+Jillette
+Jimbo
+Jimi
+jklsR
+jkzxdjkl
+JMP
+Jodie
+joggers
+Jogging
+Johnson's
+Johnston
+Jone's
+Jones's
+Jonesboro
+Joost
+Jordache
+Josh
+joules
+jour
+Jourdain
+Jove's
+Joyce's
+Juall's
+judex
+jukebox
+Julia's
+Juliana
+jumpsuit
+Jun
+Jung
+junkmobiles
+Juris
+Justin
+Juvenalis
+Kabaidze
+Kabotschniks
+Kafka's
+Kahlil
+Kahn
+Kairos
+Kamerman
+Kaminer
+Kaminsky
+Kan
+Kandel
+Kant's
+Kaplan
+Karabakh
+Karamazov
+Karamazovs
+karat
+Kari
+Karloff
+Karlovich
+Karlson's
+Karlstrom
+karma
+Karpis
+Karyl
+Kasi
+Kasner
+Kasspe
+katydids
+Katz
+Kauffmann
+Kaufman
+Kaufman's
+Kaul
+KCB
+Keate
+Keeler's
+keepen
+Kehlog
+Keillor
+Keir
+Kellen
+Kempis
+Kempson
+Kennedy's
+Kennedys
+Kennicott
+Kenny's
+Kenobi
+Kent's
+Kercheval
+kerning
+Kerouac
+Kerr's
+Kerwin
+Kesey
+Kessler
+Kettering's
+Keyser
+Kezar
+KFOG
+Khayyam
+Khruschev
+Kidner
+Kierkegaard
+Kiernan
+Kilgore
+Killfest
+Killibrew
+Kime's
+kinda
+Kiner
+kinfolk
+Kingsmen's
+Kingsmill
+Kington's
+Kinkler's
+Kinks
+Kinnan
+Kion
+Kiplings
+Kirrman
+Kissinger
+Kistomerces
+Kitman
+kitsch
+Kitzenger
+KKK
+KL
+Klapka
+Kleppner
+Kleptomaniac
+Kliban
+Kliban's
+Klingon
+Klingons
+Klink
+Klipstein
+Klone
+klows
+kludge
+kludgy
+klutz
+kmxsij
+Knapp
+Knebel
+Knebel's
+Knicks
+Knivlen
+knock'd
+knoooooowww
+knowest
+knownness
+Knucklehead
+Knuth
+Ko
+koan
+Koblas
+KOBOLDS
+kohirnt
+Kolenhow
+Koln
+komputilisto
+konsonant
+konsonants
+kontinue
+Kool
+kootchy
+Kopp
+Korda
+Kovacs
+KPH
+Kr
+Krabill
+Krainian
+Kramer's
+Krasnoyarsk
+Kraus
+Kreitzer
+Kringle
+Krispies
+Kristofferson
+Kristol
+krizzle
+Kroc
+Krogt
+Kronecker
+kroo
+Krylenko
+KRYPTONITE
+KSFO
+Kt
+Kubla
+Kubrick
+kudn't
+Kulawiec
+kulero
+Kwaheri
+KYA
+Kyogen
+l'amour
+l'Amour
+l'esprit
+l'Informatique
+l'inventer
+l'oeil
+Labour's
+lacessit
+Lackland's
+LACS
+Lactomangulation
+lad's
+ladybug
+Laetrile
+Lafferty
+LAFITE
+LaGrange
+LAIDBACK
+Lamarr
+lambchops
+Lamont
+lampshades
+Lampson
+Lancelot
+Landburgher
+Landor
+Langan
+Langsam's
+Langston
+Lanier
+lank
+Lankhamar's
+Lankhmar
+LAPD
+Lapham
+Lapsley
+Lapwarmer
+Lardner
+Larkin
+Larkinson's
+Lascl
+laserbeam
+Lasorda
+Lasorda's
+Lassie
+Late'll
+Lauer
+Laukikanyay
+laundromat
+lavishes
+Lavoris
+lawnmower
+Lawrenson
+Lazenby
+Lazlo's
+LBJ
+leadeth
+leafmeal
+Leahy
+Lean's
+Leautaud
+Lebarge
+LeBlanc
+LeBoutillier
+Lebowitz
+LeCarre
+LeDoux
+Leedom
+legas
+legendarily
+Lego
+LeGuin
+Lehenbauer
+Lehey
+Lehman
+Lehrer
+Leia
+Leibe
+Leiber
+Leibniz
+Leibowitz's
+Leith
+Lem
+Lenin's
+Lenore
+Lensmen
+LeoGrande
+Lerner
+lerts
+les
+LeSage
+letez
+Lettvin
+Levant
+Levenson
+Leverett
+Leveut
+Levinson
+Lewin
+Lewis's
+Lewyt
+lexicographer
+Leyna
+li'l
+Libbers
+libdialog
+Libra
+libricilleux
+LiBrizzi
+Lichtenberg
+Lichty
+Liddy
+Liddy's
+Lieberman's
+Liebling
+Liebowitz
+liegt
+Liepmann
+lightbulb
+lightbulbs
+Lightfoot
+LII
+Lileks
+Lilla
+Lillian
+Lillis
+limerick
+Lincoln's
+Lindbergh
+linguini
+Linimon's
+Linkletter
+Lippmann
+Lipson
+Lir
+Lisle's
+LITHP
+lithtth
+liveware
+Livius
+Livy
+Liza
+LLD
+lobbed
+lobbest
+lobotomy
+LOCF
+Lockard
+locksmiths
+Lockwood's
+locutions
+Loeb
+Logg's
+loggerheads
+Logicians
+logick
+logout
+logy
+logzerneg
+lojikl
+Lombardi
+Londoners
+Longworth
+lookest
+lookie
+Lookit
+loons
+Loos
+Lorax
+Lord'll
+Los
+Lothair
+lotsa
+loudmouth
+Lourdes
+Loverboyd
+Lovin
+Lowells
+Lowery's
+Lowes
+LP
+LPA
+LSD
+LSD's
+Lt
+Ltd
+Lubarsky's
+Lubitsch
+Lucasian
+Lucci
+Luce
+Luciano
+Ludcke
+Luddites
+Luigi
+Lumsden
+Lundstrom
+lurketh
+LUSER
+Lustbader
+Luten
+LVME
+Lyman
+lynching
+Lyndon
+Lyndon's
+lysdexia
+Lysistrata
+Lytton
+m'I
+ma'am
+Ma's
+Mabbitt
+Mabley
+Macaroons
+Maccius
+MacDowell
+MacDuff
+Machturtle
+Macinelli
+MacKay
+MacLaine
+MacNelley
+MacNiece
+MacWhirter
+Macy's
+Madariaga
+Madelyn
+MADMAN'S
+MADRAK'S
+Madre
+MAFIA
+Magary's
+Magee
+magnifique
+Magnocartic
+magtape
+Mahabharata
+Mahasamatman
+Mahatma
+Maher
+Mai
+maidservants
+Maier
+Maier's
+Maimie
+Main's
+maindz
+mainframe
+mais
+Maistre
+Maj
+maketh
+mal
+Malek's
+Mallomars
+Malraux
+maltreated
+Mamet
+Mammel
+mammon's
+Mancha
+Mandrell
+Manhandling
+manifestos
+Mankiewicz
+mankind's
+Manly's
+Manson
+mantas
+mantises
+MAPCAR
+Mapplethorpe's
+Marceau
+Marcuse
+margarita
+Margaronis
+Margolies
+Markham
+Markoff
+Markowsky
+Marley
+Marlo
+Marlon
+Marshalltown
+MARTA
+Maryann's
+Maryel
+Mascheroni
+Maslow
+Maslow's
+masochist
+Masterson
+Masterson's
+masticating
+Mathis
+Mattel
+Matz's
+Maud
+Maud'Dib
+Maugham
+Maupin
+Maureens
+Maurois
+mausers
+Maxey
+Maxson
+May's
+Mayorga
+MBAs
+MBH
+MC
+McAfee
+McCartney
+McCartney's
+McClanahan
+McCloctnik
+McCorkle
+McDunn
+McElroy
+McEvoy
+McEwan's
+McGowan's
+McGrew
+McGroarty
+McGuane
+McIntire
+McKuen
+McKusick
+McLeavy
+McLuhan
+McManus
+McNally
+McNeill
+McNulty
+McQueen
+McQuillin
+McShane
+MDL
+Meade's
+Meader's
+meatballs
+Meck
+Mecum
+Medawar
+Meeny
+Meese
+megacycles
+Megatrends
+megs
+meik
+Meir
+Melancholia's
+Melott
+meltdown
+Melugin
+Mem'ry
+MEMBAD
+Menander
+Mencken
+Mencken's
+Mendelson
+mendicants
+Mengot
+Menninger
+Menschen
+Meow
+meowing
+MERCUTIO
+merinos
+Merrick
+Meskimen's
+Messiah's
+meta
+Metamagical
+Metasexuals
+Metermaids
+methionyllysylalanylalanylthreonylarginylserine
+Metkovich
+Metz
+Mewling
+Meyrowitz
+MG
+MGA
+MGM
+MHz
+Mia
+Michener
+Mickos
+microchips
+Microcomputing
+micrometric
+Microsystems
+MicroVAXes
+midgets
+Midler
+midterm
+midtown
+Mieux
+Miffin
+Mikado
+Miksch's
+milk's
+Milkbone
+Millay
+Milligan
+Millikan
+Millikan's
+millions
+Millipicture
+Milliway's
+Millman
+Milpitas
+mimsy
+Minas
+mindedly
+minimalization
+miniraft
+miniskirts
+minix
+Minneapple
+Minnelli
+Minnesotans
+Minow
+Minsky
+minx
+MIPS
+MIRVed
+misapportionment
+misdates
+Misner
+misquotations
+misspent
+mistresses
+Mitford
+Mitgong
+mittengrabben
+mitts
+MITZIE
+Mix's
+Miyamoto
+mizk
+Mizner
+mkdir
+MMMMMM
+MN
+mobocracy
+Moby
+Modelski
+modifaiing
+Modula
+Moebius
+Mohandas
+mohmen
+Moishe
+Molander
+moldy
+molehills
+Mollison's
+Mom
+mome
+Momma's
+mon
+Mondale
+monde
+Mongo
+monkey's
+Monopurpose
+Montagu
+Montalvo
+Montand
+Montesquieu
+Moolah
+moonshiner's
+Moore's
+mopeds
+Moping
+moralists
+Mordecai
+Mordor
+Morley
+morons
+Morrisey
+mortician's
+MOS
+Mosher's
+Mostel
+motd
+mounteth
+mousetraps
+mousies
+mouthwashes
+moveth
+Moyers
+Moynihan
+MOZ
+mrbill
+MSCP
+MSDOS
+MSU
+Mt
+MTA
+Muad'dib
+muckest
+Mudgeeraba
+Mudhead
+mudslide
+mugged
+Muggeridge
+Muhammad
+Mulcahey
+Mulcahey's
+multe
+multidextrous
+multiline
+Mum's
+munchies
+Munchkin
+Mundis
+Mundus
+Munro
+Muppet
+Muppets
+Murdoch
+Murphy's
+Murray's
+Musashi
+musculus
+Mushies
+Mustgo
+MVS
+MW
+MX
+Myles
+MySQL
+Myung
+myxbl
+n'ecoute
+n'est
+n'existait
+n'oeuvres
+Naah
+Nabokov
+naches
+Nachman
+Nachman's
+Nader
+Nadia
+Naggum
+Nagorno
+Naiman
+Naisbitt
+Namath
+NAND
+nanocentury
+nanohenry
+nanometers
+Nansen
+Napoleon's
+Narnia
+Nasium's
+Naso
+Nasrudin
+Nasrudin's
+Natasha
+Nate
+Nathalia
+Nather
+naturalists
+naugahyde
+Naughton
+Navasky
+Nazgul
+NCONS
+NCTE
+Neantical
+Nebuchadnezzar
+Nebuchadnezzar's
+necesas
+NecroSoft
+Nehru
+Neil's
+Neizant
+nell
+Nemo
+nennen
+Neophyte's
+nerd
+Nerd's
+Neronic
+Nesbit
+Nesbitt
+NetBSD
+NetHack
+Netiquette
+netnews
+neuroscience
+neuroscientists
+neurotics
+Nevil
+Newell's
+Newkirk
+Newlan's
+Newman's
+NEWSFLASH
+NF
+NFL
+Ngdanga
+Niagra
+Nicklaus
+Nicol
+Nicolaides
+Niels
+Niemoller
+Nietzsche's
+Nikita
+Niklaus
+Nikon
+Nillity
+Nimitz
+Ningauble
+Nintendo
+Nisker
+Nissan
+Nissan's
+nitpicking
+Niven
+Nixon's
+Noah's
+noalias
+Noelie
+nog
+nogiftlist
+nohow
+Nolan
+Nome
+nonproblems
+nonrefusable
+nonsolutions
+nontangible
+nooooothing
+NOP
+Nora's
+Norman's
+Normanorum
+Normie
+Northcote
+Norwood
+nostra
+Notetaking
+nothing's
+Nov
+Novato
+Novell
+Novinson's
+Novocain
+Novocaine
+Now's
+Nowlan's
+Noxzema
+NP
+NSV
+NSW
+NT
+nth
+Nubar
+nucleophile
+NULLs
+Nullum
+nunnery
+Nuremberg
+Nusbaum's
+Nutley
+NY
+NYT
+O'Brian's
+O'Casey
+O'Hara
+O'Henry
+O'Longhlin
+O'Malley
+O'Neil
+O'Neill
+O'Nolan
+O'Reilly's
+O'Rourke
+O'Toole's
+Oahu
+Obi
+obits
+obius
+obscurantist
+obsoletum
+Ochs
+OCP
+Oct
+octalthorpe
+Octopussy
+Oech
+Oedipa
+Ogborn
+Ogden's
+Ogdin
+Oglethorp
+OHHHHHH
+Ohm's
+ohnegleich
+okay
+OKOKOKOK
+Olin
+Olinthus
+Olivier
+Olivier's
+Olsen's
+Omar
+omelette
+omerade
+OMERTA
+omnibiblious
+omnivorous
+ompzidaize
+Onan
+Onasander
+Onassis
+Oncler
+Ontopsychological
+Ontopsychology
+oodsou
+ooh
+Oooh
+ooohed
+Ooohh
+Oooo
+OOOOT
+Ope
+Ophelia
+Oppernockity
+Oprah
+OR'd
+Orac
+Orben
+orbs
+Orbury
+Orcs
+Oreo
+Organa
+Orkney
+Oroville
+orphan's
+Orrin
+Orson
+Orton
+orxogrefkl
+OS
+Osborn's
+OSI
+OTOPHOBIA
+oughta
+our's
+Ouspensky
+OUTCONERR
+outcumbents
+outdone
+outfitting
+outgrabe
+outgunned
+outstubborn
+outta
+outweird
+overesteem
+overserved
+overstayed
+overstuffed
+overtruncated
+oves
+Ovidius
+Owen's
+Owsley
+Ozman's
+Paar
+pacifists
+padanga
+Padlipsky
+Paeps
+Paglia
+Paglia's
+Pagnol
+paisley
+Paley
+pallbearer
+Palo
+pamphleteers
+Pandanga
+Pandora's
+Panjandrum's
+panky
+pantaloons
+Pante
+pantyhose
+Panza
+paperboy
+Papert
+paraboloids
+paramedic
+Paramount's
+Paranoids
+paraquat
+Pardo's
+parDOOOOOnu
+Parker's
+Parkinson's
+parkways
+Parnas
+Parnell
+paroxysmally
+Parrafin
+Parthenon
+passwd
+pastureland
+Patageometry
+Pathmark
+patrino
+Paxton
+PBC
+PCC
+PDGERS
+PDP
+PDQ
+PDSK
+Pearsall
+PECCATOPHOBIA
+Pecor's
+Pedaeration
+Peers's
+Pegler
+pelted
+Pembrokeshire
+PENGUINICITY
+penis
+Penn's
+Penrose
+Pensacoola
+pense
+Pensees
+Penzance
+percussionists
+Pereant
+perfum'd
+Perignon
+Perigord
+Perl
+Perlis
+Perlstein
+Perot
+Perriwinkle
+Personifiers
+Petaluma
+Petersons
+Petr
+Petronius
+Pfeiffer
+Pfffttt
+Phaedrus
+Pharoah's
+Phathotep
+Philbin
+Philips
+philogyny
+phoney
+Phooey
+Picadilly
+Pickard
+Pickle's
+Picninnies
+piercings
+pietists
+pietzsche
+Piggeldy
+Pilgermann
+Pindar
+Pinero
+Pintauro
+Pioneer's
+piranhas
+Pirsig
+Pithiests
+pkasdjbasdfbuil
+PL
+Plaese
+planaria
+plasmoids
+Platford
+Plato's
+platypus
+Plauger
+pleasantest
+pleasurific
+pleH
+Plimpton
+Plinius
+Plotinus
+Plotkin
+PLUGBOARDS
+Plumber's
+plunked
+Pluribus
+Plyter
+Pocataligo
+Pocatello
+Podunk
+Pohl's
+Poincare's
+pointy
+Polanski
+Pollyanna's
+poly
+polytetien
+polytheism
+polywog
+Pompeius
+ponytails
+Poorman's
+popcorn
+POPI
+POPped
+Poppins
+Porcius
+Porcus
+porkers
+Porky's
+porrf
+Porsche
+posibl
+POSSLQ
+posthole
+postindustrial
+postjudice
+Postnews
+Postpetroleum
+potholes
+Potluck
+potty
+Poul
+Pournelle
+pouvait
+Povich
+POWDERMILK
+powerfail
+Powermom
+Powerpoint
+poz
+PPHHHLLLBBBBTTT
+ppo
+PPRB
+Prabhupada
+praemium
+pragma
+prawns
+pre
+Precipitations
+predicaments
+prepareth
+prepoceros
+Presley
+Presume's
+pretzel
+Preudhomme's
+prgrmmng
+Price's
+Priest's
+priestess
+primordial
+Princeton's
+Pritchard
+Pritzi
+PRIV's
+PRL
+PROCESSORs
+Prochnow
+proelium
+profundities
+proletarian
+Propos
+propounded
+Proseedcake
+Prosser
+Prostetnic
+prostrates
+Protagoras
+protheththing
+protoplasmal
+protracting
+Provan
+PRs
+Prue
+Prufrock
+Pryne
+Pryor's
+PS
+Psblurtex
+Psychotics
+Publilius
+Publius
+Pudd'nhead
+Pudden
+Pudder's
+Puff's
+Pumpernickel
+punchline
+punning
+PUPs
+Purshottam
+PUSHes
+pushy
+pussycats
+Putt's
+PVLC
+PxP
+Pynchon
+Pyro's
+Python's
+QED
+QLX
+qotc
+QOTD
+QT
+quadrupic
+quaffing
+Quaid
+Qualactin
+quandry
+Quanucci
+Quasimodo's
+Quentin
+qui
+quia
+quiche
+Quicky
+Quiddely
+Quidquid
+Quigley's
+Quincey
+Quincunx
+Quinton
+quizmaster
+quop
+Quux
+Qvid
+QWERT
+QWERTY
+QWERTYUIOP
+QYX
+Rabelais
+rackmount
+Racter
+radiateth
+Radner
+raed
+Raffiniert
+raineth
+Raisa
+Raisinets
+raisiny
+RAM's
+Ramapo
+randchar
+Rankin
+Ransford
+rapturous
+Raquel
+RASC
+Raskin
+raspy
+Ratcliffe
+Ratri
+Ratsy
+RC
+rd
+RDTBL
+Readyhough
+Reaganite
+Reba
+rebinds
+Recamier
+Redd
+Regan
+Reggie
+Reginald's
+reich
+Reichel's
+Reinfeld
+Reinhart
+Reisner's
+Relaxen
+RENE
+Renegades
+Renner
+Renning's
+replased
+replasing
+restoreth
+retards
+retrospectoscope
+Reykjavik
+RFCs
+RFD
+RFSFR
+rhinoceri
+Rhode
+Rhode's
+RHU
+Richardian
+Richie
+Richler
+Ricks
+Rico
+ridandant
+rigadoon
+Rigby
+Rigg's
+Rilke
+rimeining
+rind
+Ringo
+Ringworld
+Rinzai
+riplais
+Rippingille
+Risch's
+rispektivli
+risqu
+Ritt
+Rivera
+Rizzo
+RKO
+RLG
+Roadrunner
+Robb
+Robespierre
+Roche
+Rochefoucauld
+Rocky's
+Roddick
+Rogerians
+Roguelet's
+Roguies
+Rolex
+rollups
+ROLM
+ROM's
+Romanoff
+Romanov
+Romas
+ROMS
+Romulan
+Romulans
+Ronstadt
+Rooney
+Rorschach
+Roscoe
+Rosencrantz
+rosewater
+Rospach
+Rossetti
+Rosten
+Rotherham
+Rothesay
+Rothschild
+Roumania
+rousers
+Rowlands
+Roxbury
+Royce
+Royces
+Royko
+RPG
+RPLACA
+RPLACD
+RS's
+RSSC
+RSuX
+RTAB
+rubbernecken
+Rubenesque
+Rubenstein
+Rubik's
+Rubin
+Rubinstein
+rubout
+Rudd's
+Rudin's
+Rudman
+Rudner
+Rudyard
+Ruffed
+rugby
+Rukn
+ruminations
+Rune's
+runneth
+runtime
+Rupert
+Russel
+Russon
+rustproofers
+Ruth's
+Ruthven
+RWDSK
+RWOC
+RY
+Saberhagen
+Sacher's
+Sadat
+Saddam
+Saens
+Safford
+Safire's
+Sagan
+Sagdeev
+Sagittarians
+sailer's
+salesman's
+Sallust
+Salmanazar
+Salmonson
+Salome
+Salter's
+Salvadorans
+Salvor
+sam
+Sammet
+samurai
+Sanka
+Santoro
+Santraginean
+Santraginus
+sapiens
+Sappho
+Sardi
+Sargon
+Sarnoff
+Sartre
+SAS
+Sattinger's
+Satyrs
+Sauron
+SAUV
+Savage's
+savait
+savour
+sawhorse
+Saxbe
+Sayre
+Scalia
+Scallopinni
+scats
+SCCS
+Schaeberle
+Schapiro's
+Schenk
+Scherr
+Schibe
+Schickel
+Schickele
+Schieffer
+schisms
+schizophrenics
+schlichte
+schluerfen
+Schmendrick
+Schmidt's
+Schmivalry
+Schmonsequences
+schnappen
+Schneier
+Schnoebelen
+Schrier
+Schroder
+Schrodinger's
+Schryer
+Schumacher's
+Schure
+Schwambach
+Schweitzer
+Schwiggle
+Schwine
+Scientologist
+scintillate
+Scintillae
+Scott's
+Scoville
+SCRBL
+Scrubb
+scullery
+scurries
+scuzzball
+Scythians
+sdoihjfh
+SDS
+Seager
+Seagoon
+seal's
+seatcovers
+Secombe's
+Seeger
+Segal
+sei
+Seldon
+Seleznick's
+SEMPER
+Sendak
+Sententiae
+Sep
+Septober
+sequiturs
+Serendipity
+Serling
+Serocki's
+Serres
+SETQ
+Seuss
+Sevareid
+Sevenoaks
+Sextus
+Shadow's
+shallots
+shalt
+Shannon's
+Shapley
+Sharif
+Sharpless
+Shaw's
+Shawcross
+shed's
+Shedenhelm's
+Sheeley
+Sheep's
+Sheil
+Shel
+Sherany
+Sherrill
+Shhh
+Shick's
+shineth
+shinnied
+shins
+shlafen
+Shmoedipus
+Shoaff
+Shoales
+Shockwave
+Shoffstall
+ShopRite
+shorn
+shouldst
+Shriekback
+Shrivers
+Shulman
+Shuman
+Shunju
+shutouts
+shysters
+Si
+sickens
+sickle's
+sidestepped
+Siegel
+sightseeren
+Sigismund
+Sigmund's
+SIGPLAN
+Silentarius
+Silurian
+Silverman's
+Silverstein
+Simard
+Simon's
+Simonize
+Simons
+Simpson's
+Sinanju
+Sinbad
+siouxeyesighed
+Siouxicide
+SISSIES
+situationalist
+Sitwell
+Sixtus
+sizeof
+Sizi
+Sjoberg
+Skelton
+skldfjkl
+skyhigh
+Skyler
+Skywalker
+Slagle
+SLC
+sledgehammers
+Slick's
+Slingwine
+Slinkies
+Slinkys
+SLOBOL
+Slous
+Slurm
+sluts
+Smaalders
+Smalltalk
+Smirnoff
+Smit
+Smithsonian's
+smokeouts
+Smoky's
+Smollet
+Smorgrav
+SMP
+smudges
+Smugs
+smurfette
+Smurfies
+Smurfs
+SNA
+Snacktrek
+snake's
+snarley
+Sniglets
+Snipehunter
+SNL
+snowman
+Snowmass
+Socio
+sociocybernetics
+sociopathic
+soda's
+Sodd's
+Solanas
+soliloquies
+Solipsists
+Solzhenitsyn
+somebody'd
+something's
+Sondheim
+Sooooo
+Sorhed
+sort've
+sorta
+souffrir
+Soundtrack
+SoupCon
+Souvarine's
+sow's
+Sox
+Soxer
+SP
+Spacemen
+Spaceport
+spacewar
+spake
+Spam
+spank
+Spark's
+Spartacus
+Speer's
+spel
+speling
+Spence's
+Spielberg
+Spinoza
+Spirtle
+Spisani
+spitzensparken
+spl
+sploosh
+Spock
+spokesperson
+SPR
+Sprecht
+springenwerk
+Springsteen
+sprites
+SPSW
+squaws
+squealers
+squrooneg
+SRSD
+sswwiittcchh
+stalagmites
+Stallman
+Stallone
+standest
+Standpunkt
+Stanfield
+Stanislaw
+stardust
+starfield
+Starfighter
+Starlin
+starships
+Stasheff
+statecraft
+stderr
+stdin
+steamrolling
+Steckel's
+Steele's
+Steelypips
+steeplechase
+Steiger
+Steinbach
+Steinbach's
+Steinbeck
+Steinem
+Steinman
+Stekel
+Stenderup's
+Stengel
+Stepanakert
+stepstool
+Stig's
+stingiest
+stinkmouthing
+Stinnett
+Stock's
+Stockdale
+Stoffel
+stogies
+Stonemenge
+stooge's
+Stoolie
+Stoppard
+Stormqueen
+Stormtroopers
+Strachey
+straitjackets
+strategem
+Straub
+Stretchy
+Strewzinski
+Strindberg
+structs
+Strumpets
+Strunk
+stty
+stuckness
+Stult's
+Suaviter
+subordinations
+subsittute
+Suenden
+suet
+Sugarcreek
+Suggoth
+Sulu
+Sumeria
+Sumatra
+sunbathing
+SunCheckup
+SUNKIST
+sunlamps
+SunOS
+Suntiger
+Sunward
+superannuated
+Superchicken
+superheros
+Superieure
+superpowers
+superstar
+superstars
+Suplee
+supplieth
+surly
+Surtees
+Sushido
+Suslowicz
+Sussman
+Suzie
+Sven
+Svevo
+svm
+Swaller
+swami's
+swang
+Swayze
+sweatsocks
+Sweden's
+sweeteners
+Swinburne
+Swipple's
+synagog
+syncs
+synthetase
+Syrus
+sysadmin
+syscalls
+SYSIN
+sysinstall
+SYSNOTE
+Szasz
+T'ai
+t'git
+T'umps
+Tabby
+Taber
+Taber's
+Tac
+tachyon
+Taggart
+Tai
+takest
+taketh
+Talking's
+Tallulah
+tamperest
+Tanenbaum
+tannogallate
+tapeworms
+tapioca
+tappity
+Tarkin
+Tarkington
+Tarradiddles
+Tasmanians
+TATERNATOR
+tbsp
+TDB
+Tech's
+Technolorata
+Tecumseh
+teddy
+Teddywookie
+tee'd
+teepers
+telematic
+telepath
+teleportation
+telepsychology
+tempfile
+tendrils
+tequila
+Terence
+Terentius
+Teriyaki
+Termiter's
+Tertullian
+TEXage
+textfiles
+thaaaaaaat's
+Thackeray
+Thalberg
+Thames
+Theatre
+Themas
+Theophrastus
+thermia
+Thermopylae
+Thieu
+thing's
+thinkle
+Thom
+thou'lt
+Thoul't
+Threepio
+Throop
+thru
+Thucydides
+Thurber
+Thurgood
+Thurston
+Thyme's
+thyself
+Tiburcio
+Tiddely
+Tiffany's
+Tijuana
+Tikkanen
+Timbuktu
+time's
+tinhorn
+tinpot
+Tirith
+tis
+Tiselius
+tites
+TLC
+TM
+toastings
+Tobaben
+Tobias
+Tock
+toehold
+Tolkien
+tollway
+Tomalin
+Tomash
+Tomlin
+tommyo
+Tonka
+Topanga
+Topologists
+Torek
+tornpee
+Tortue
+Tortue's
+Torvalds
+TOTD
+Toto
+touch'd
+Touche
+toujours
+toun
+Tourbillon
+Toven
+trans
+transmogrifiers
+trapezes
+Traub
+traumatized
+treacle
+Trenchtown
+Tribbles
+TRICHOPHOBIA
+Tricia
+Trillian
+Trillin
+Trimble
+Trobin
+Troney
+Trotsky
+trovato
+TRS
+Trudeau
+truffula
+truncheons
+Truscott
+Trygve
+tryptophan
+Tse
+tsetse
+TSO
+tsp
+Tsu
+tsunamis
+ttyTV
+Tue
+tuit
+tuits
+Tukey
+Tullius
+tumbleweeds
+tune's
+Tunstall
+tuppenny
+Turds
+Turgenev
+Turnaucka's
+turneth
+Tussman's
+Tut's
+Twain's
+Twas
+Tweedledee
+Tweedledum
+tween
+tweety
+twitches
+twits
+twixt
+Twodor
+Twodor's
+TYDFS
+tyg
+typefaces
+Tyroon
+Ubi
+UDA
+Udall's
+UFO
+UFO's
+uh
+ukulele
+Umberto
+Ummm
+umsige
+Un
+Una
+unamerican
+unbegot
+unbelievers
+UNC
+undemanding
+underachiever
+Unger
+Unhhh
+unhounded
+unionists
+unkindest
+unleaving
+unmasks
+unscrappable
+Unseld
+untechnician
+unvoist
+Updike
+uponst
+Urey
+Urho
+Urk
+USEnauts
+Usenetter
+useth
+USL
+Ustinov
+UT
+UTCS
+uuclean
+uulog
+VA
+Vader
+Vader's
+Vail's
+Valachi
+Valerius
+Valery
+VALGOL
+Valiel's
+valium
+VanDam
+Vannevar
+Vapereau
+vaporized
+varicose
+Varro
+Vasquez
+Vastgota
+vatch
+Vate
+Vaughan
+Vauvenargues
+Vax
+VAX's
+Vaxen
+VAXen
+VAXs
+VCR
+VCR's
+Veeck
+velcro
+Velilind's
+Velveeta
+Veni
+Venkman
+Venn
+ventious
+Verdunne
+Vergas
+Vergilius
+veritas
+Vernor
+verreckt
+Vespucci
+Vespuccia
+VESTIPHOBIA
+vetted
+VFW
+Vic
+vichyssoise
+Vidal
+VIDEOCASSETTE
+Vidi
+viditur
+Vido's
+vieillesse
+viiiiiiiiiiiinnnneee
+Vila
+Vinchy
+Vinci
+Vinge
+Virgil
+Virt
+Viscott
+Vittorini
+VLSI
+VMI
+VMS
+VMSPDGERS
+Vobiscum
+Vocab
+VODKA
+vodkas
+Vogon
+Vogons
+voist
+Volkswagen
+Vollyballocracy
+Voltarine
+von
+Vonada
+Vondel's
+Vonnegut
+Vonnegut's
+VOOM
+vowlz
+Vries
+Vroomfondel
+VSOP
+VUJA
+Vulgate
+VW
+VWD
+vyui
+Waben
+WAC's
+Wald
+Walinsky
+Walla
+Wallbangers
+walleting
+Wallis
+Walter's
+Walton's
+Waltons
+Wanda
+wanna
+wanwood
+Warbucks
+Warburton
+warders
+Warhol
+warlord
+Washlesky
+WASPs
+WastebasketSLMHQ
+Wat
+watchout
+Watership
+Watford
+Watney's
+Watt's
+Watterson
+WBT
+wearers
+weatherman
+Weed's
+Weederman
+weenies
+Weil
+Weiler
+Weiler's
+Weinberg's
+Weinberger
+Weiner's
+Weir's
+weirdo
+Weisert
+Weizenbaum
+Weller
+Welles
+welp
+Wemm
+wench
+werld
+Wernher
+Wertheimer
+Westbrook
+Westbury
+westerns
+Westheimer
+Westheimer's
+Westmoreland
+Wethern's
+Wh
+Whaddaya
+Whaddya
+whaledreck
+What'll
+WHATEVERSAROUND
+Whattaya
+whilst
+Whipsnade
+WHIRRR
+Whistler's
+White's
+Whitehead's
+Whitehorn
+Whitton
+Whitty
+whoami
+whodo
+whomped
+Whooa
+Whoopie
+Wickersham
+Wiggam
+Wihelminalaan
+Wiker's
+Wilcox's
+Wilde
+wilds
+Willeford
+Willie's
+Willis
+Wilner's
+Wimbrow
+wimmelten
+wimp
+Winchell
+Windex
+windstorms
+Winfrey
+winnowed
+Winny
+Winokur
+Winsor
+Winwood
+Wir
+Wirrten
+Wirth
+wiseguy
+witch's
+Wither's
+Withington
+Witt's
+Wittgenstein
+WL
+Wobegon
+Wodehouse
+woes
+wolfing
+wollen
+Wollman
+wombat
+Wombat's
+wombats
+Womblike
+woodburning
+Woodhead
+woodlands
+Woodstock
+Woodward's
+Wookiee
+Woolf
+Woollcott
+worketh
+workingman
+Workingman's
+workup
+WORLD's
+worth's
+wreckages
+Wrenshaw
+writest
+wrung
+WSJ
+WXRT
+Wynand
+Xanadu
+xanthic
+Xanthippe's
+Xaviera
+XCVI
+xen
+xenophobic
+XGP
+XIIdigitation
+XINU
+XL
+XLI
+XLII
+XLIII
+XLIV
+XLIX
+XLV
+XLVI
+XLVII
+XLVIII
+xrewawt
+xsz
+XTC
+XXI
+XXII
+XXIII
+XXIV
+XXIX
+XXV
+XXVI
+XXVII
+XXVIII
+XXX
+XXXI
+XXXII
+XXXIII
+XXXIV
+XXXIX
+XXXV
+XXXVI
+XXXVII
+XXXVIII
+XY
+Y'all
+y'are
+Y'know
+Yabba
+Yacob
+yams
+Yankovic
+Yay
+Yellowstone
+Yeltsin
+Yessir
+Yevtushenko
+Yewtoo
+Yinkel
+Yippie
+Yoda
+Yoda's
+Yoko
+Yorba
+Yoric
+Yorker's
+you'se
+Youghkins
+Youngman
+yourselfer
+Yuggoth
+Yul
+Yuletide
+Yutang
+yyoouurr
+Zachmann
+Zadeh
+Zaftig
+Zall's
+Zamphuor
+Zanuck
+Zaphod
+Zappa
+Zarathud
+zayda
+zcat
+Zelazny
+Zelkowitz
+Zeno's
+zephyr's
+Zern
+Zevon
+Zilla
+Zimmer
+Zippos
+Zisla's
+Zolman
+ZON
+zonked
+Zonker
+zookeepers
+ZORAC
+Zork
+Zorkmids
+Zorn's
+Zorro
+Zoso
+Zow
+Zsa
+Zukav
+Zwanzig
+Zwart
+Zweigs
+Zwicky
+Zymurgy's
diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips
new file mode 100644
index 0000000..9767586
--- /dev/null
+++ b/usr.bin/fortune/datfiles/freebsd-tips
@@ -0,0 +1,464 @@
+This fortune brought to you by:
+$FreeBSD$
+%
+Any user that is a member of the wheel group can use "su -" to simulate
+a root login. You can add a user to the wheel group by editing /etc/group.
+ -- Konstantinos Konstantinidis <kkonstan@duth.gr>
+%
+By pressing "Scroll Lock" you can use the arrow keys to scroll backward
+through the console output. Press "Scroll Lock" again to turn it off.
+%
+Can't remember if you've installed a certain port or not? Try "pkg info
+-x port_name".
+%
+Ever wonder what those numbers after command names were, as in cat(1)? It's
+the section of the manual the man page is in. "man man" will tell you more.
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+Forget how to spell a word or a variation of a word? Use
+
+ look portion_of_word_you_know
+ -- Dru <genesis@istar.ca>
+%
+Forget what directory you are in? Type "pwd".
+ -- Dru <genesis@istar.ca>
+%
+Forget when Easter is? Try "ncal -e". If you need the date for Orthodox
+Easter, use "ncal -o" instead.
+ -- Dru <genesis@istar.ca>
+%
+FreeBSD is started up by the program 'init'. The first thing init does when
+starting multiuser mode (ie, starting the computer up for normal use) is to
+run the shell script /etc/rc. By reading /etc/rc and the /etc/rc.d/ scripts,
+you can learn a lot about how the system is put together, which again will
+make you more confident about what happens when you do something with it.
+%
+Handy bash(1) prompt: PS1="\u@\h \w \!$ "
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+Having trouble using fetch through a firewall? Try setting the environment
+variable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
+%
+If other operating systems have damaged your Master Boot Record, you can
+reinstall it with boot0cfg(8). See
+"man boot0cfg" for details.
+%
+If you accidentally end up inside vi, you can quit it by pressing Escape, colon
+(:), q (q), bang (!) and pressing return.
+%
+If you are in the C shell and have just installed a new program, you won't
+be able to run it unless you first type "rehash".
+ -- Dru <genesis@istar.ca>
+%
+If you do not want to get beeps in X11 (X Windows), you can turn them off with
+
+ xset b off
+%
+If you have a CD-ROM drive in your machine, you can make the CD-ROM that is
+presently inserted available by typing 'mount /cdrom' as root. The CD-ROM
+will be available under /cdrom/. Remember to do 'umount /cdrom' before
+removing the CD-ROM (it will usually not be possible to remove the CD-ROM
+without doing this.)
+
+Note: This tip may not work in all configurations.
+%
+If you need a reminder to leave your terminal, type "leave +hhmm" where
+"hhmm" represents in how many hours and minutes you need to leave.
+ -- Dru <genesis@istar.ca>
+%
+If you need to ask a question on the FreeBSD-questions mailing list then
+
+ http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\
+ freebsd-questions/index.html
+
+contains lots of useful advice to help you get the best results.
+%
+If you write part of a filename in tcsh,
+pressing TAB will show you the available choices when there
+is more than one, or complete the filename if there's only one match.
+%
+If you `set watch = (0 any any)' in tcsh, you will be notified when
+someone logs in or out of your system.
+%
+If you use the C shell, add the following line to the .cshrc file in your
+home directory to prevent core files from being written to disk:
+
+ limit coredumpsize 0
+ -- Dru <genesis@istar.ca>
+%
+If you want df(1) and other commands to display disk sizes in
+kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
+environment to 'K'. You can also use 'M' for Megabytes or 'G' for
+Gigabytes. If you want df(1) to automatically select the best size
+then use 'df -h'.
+%
+If you want to play CDs with FreeBSD, a utility for this is already included.
+Type 'cdcontrol' then 'help' to learn more. (You may need to set the CDROM
+environment variable in order to make cdcontrol want to start.)
+%
+If you'd like to keep track of applications in the FreeBSD ports tree, take a
+look at FreshPorts;
+
+ http://www.freshports.org/
+%
+In order to make fetch (the FreeBSD downloading tool) ask for
+username/password when it encounters a password-protected web page, you can set
+the environment variable HTTP_AUTH to 'basic:*'.
+%
+In order to search for a string in some files, use 'grep' like this:
+
+ grep "string" filename1 [filename2 filename3 ...]
+
+This will print out the lines in the files that contain the string. grep can
+also do a lot more advanced searches - type 'man grep' for details.
+%
+In order to support national characters for European languages in tools like
+less without creating other nationalisation aspects, set the environment
+variable LC_ALL to 'en_US.ISO8859-1'.
+%
+"man firewall" will give advice for building a FreeBSD firewall
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+"man hier" will explain the way FreeBSD filesystems are normally laid out.
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+Man pages are divided into section depending on topic. There are 9 different
+sections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
+You can get an introduction to each topic by typing
+
+ man <number> intro
+
+In other words, to get the intro to general commands, type
+
+ man 1 intro
+%
+"man ports" gives many useful hints about installing FreeBSD ports.
+%
+"man security" gives very good advice on how to tune the security of your
+FreeBSD system.
+%
+"man tuning" gives some tips how to tune performance of your FreeBSD system.
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+Need to do a search in a manpage or in a file you've sent to a pager? Use
+"/search_word". To repeat the same search, type "n" for next.
+ -- Dru <genesis@istar.ca>
+%
+Need to find the location of a program? Use "locate program_name".
+ -- Dru <genesis@istar.ca>
+%
+Need to leave your terminal for a few minutes and don't want to logout?
+Use "lock -p". When you return, use your password as the key to unlock the
+terminal.
+ -- Dru <genesis@istar.ca>
+%
+Need to print a manpage? Use
+
+ man name_of_manpage | col -bx | lpr
+ -- Dru <genesis@istar.ca>
+%
+Need to quickly empty a file? Use ": > filename".
+ -- Dru <genesis@istar.ca>
+%
+Need to quickly return to your home directory? Type "cd".
+ -- Dru <genesis@istar.ca>
+%
+Need to remove all those ^M characters from a DOS file? Try
+
+ tr -d \\r < dosfile > newfile
+ -- Originally by Dru <genesis@istar.ca>
+%
+Need to see the calendar for this month? Simply type "cal". To see the
+whole year, type "cal -y".
+ -- Dru <genesis@istar.ca>
+%
+Need to see which daemons are listening for connection requests? Use
+"sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
+ -- Dru <genesis@istar.ca>
+%
+Need to see your routing table? Type "netstat -rn". The entry with the G
+flag is your gateway.
+ -- Dru <genesis@istar.ca>
+%
+Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
+ -- Mathieu <mathieu@hal.interactionvirtuelle.com>
+%
+Over quota? "du -s * | sort -n " will give you a sorted list of your
+directory sizes.
+ -- David Scheidt <dscheidt@tumbolia.com>
+%
+nc(1) (or netcat) is useful not only for redirecting input/output to
+TCP or UDP connections, but also for proxying them with inetd(8).
+%
+sh (the default Bourne shell in FreeBSD) supports command-line editing. Just
+``set -o emacs'' or ``set -o vi'' to enable it.
+%
+Simple tcsh prompt: set prompt = '%# '
+%
+The default editor in FreeBSD is vi, which is efficient to use when you have
+learned it, but somewhat user-unfriendly. To use ee (an easier but less
+powerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
+%
+Time to change your password? Type "passwd" and follow the prompts.
+ -- Dru <genesis@istar.ca>
+%
+To change an environment variable in /bin/sh use:
+
+ $ VARIABLE="value"
+ $ export VARIABLE
+%
+To change an environment variable in tcsh you use: setenv NAME "value"
+where NAME is the name of the variable and "value" its new value.
+%
+To clear the screen, use "clear". To re-display your screen buffer, press
+the scroll lock key and use your page up button. When you're finished,
+press the scroll lock key again to get your prompt back.
+ -- Dru <genesis@istar.ca>
+%
+To determine whether a file is a text file, executable, or some other type
+of file, use
+
+ file filename
+ -- Dru <genesis@istar.ca>
+%
+To do a fast search for a file, try
+
+ locate filename
+
+locate uses a database that is updated every Saturday (assuming your computer
+is running FreeBSD at the time) to quickly find files based on name only.
+%
+To erase a line you've written at the command prompt, use "Ctrl-U".
+ -- Dru <genesis@istar.ca>
+%
+To find the hostname associated with an IP address, use
+
+ drill -x IP_address
+ -- Allan Jude <allanjude@FreeBSD.org>
+%
+To obtain a neat PostScript rendering of a manual page, use ``-t'' switch
+of the man(1) utility: ``man -t <topic>''. For example:
+
+ man -t grep > grep.ps # Save the PostScript version to a file
+or
+ man -t printf | lp # Send the PostScript directly to printer
+%
+To quickly create an empty file, use "touch filename".
+ -- Dru <genesis@istar.ca>
+%
+To read a compressed file without having to first uncompress it, use
+"zcat" or "zless" to view it.
+ -- Dru <genesis@istar.ca>
+%
+To repeat the last command in the C shell, type "!!".
+ -- Dru <genesis@istar.ca>
+%
+To save disk space in your home directory, compress files you rarely
+use with "gzip filename".
+ -- Dru <genesis@istar.ca>
+%
+To search for files that match a particular name, use find(1); for example
+
+ find / -name "*GENERIC*" -ls
+
+will search '/', and all subdirectories, for files with 'GENERIC' in the name.
+ -- Stephen Hilton <nospam@hiltonbsd.com>
+%
+To see all of the directories on your FreeBSD system, type
+
+ find / -type d | less
+
+All the files?
+
+ find / -type f | less
+%
+To see how long it takes a command to run, type the word "time" before the
+command name.
+ -- Dru <genesis@istar.ca>
+%
+To see how much disk space is left on your partitions, use
+
+ df -h
+ -- Dru <genesis@istar.ca>
+%
+To see the 10 largest files on a directory or partition, use
+
+ du /partition_or_directory_name | sort -rn | head
+ -- Dru <genesis@istar.ca>
+%
+To see the IP addresses currently set on your active interfaces, type
+"ifconfig -u".
+ -- Dru <genesis@istar.ca>
+%
+To see the last 10 lines of a long file, use "tail filename". To see the
+first 10 lines, use "head filename".
+ -- Dru <genesis@istar.ca>
+%
+To see the last time that you logged in, use lastlogin(8).
+ -- Dru <genesis@istar.ca>
+%
+To see the MAC addresses of the NICs on your system, type
+
+ ifconfig -a
+ -- Dru <genesis@istar.ca>
+%
+To see the output from when your computer started, run dmesg(8). If it has
+been replaced with other messages, look at /var/run/dmesg.boot.
+ -- Francisco Reyes <lists@natserv.com>
+%
+Want colour in your directory listings? Use "ls -G". "ls -F" is also useful,
+and they can be combined as "ls -FG".
+%
+Want to find a specific port, just type the following under /usr/ports
+or one its subdirectories:
+
+ make search name=<port-name>
+ or
+ make search key=<keyword>
+%
+Want to know how many words, lines, or bytes are contained in a file? Type
+"wc filename".
+ -- Dru <genesis@istar.ca>
+%
+Want to see how much virtual memory you're using? Just type "swapinfo" to
+be shown information about the usage of your swap partitions.
+%
+Want to strip UTF-8 BOM(Byte Order Mark) from given files?
+
+ sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile
+%
+Want to use sed(1) to edit a file in place? Well, to replace every 'e' with
+an 'o', in a file named 'foo', you can do:
+
+ sed -i.bak s/e/o/g foo
+
+And you'll get a backup of the original in a file named 'foo.bak', but if you
+want no backup:
+
+ sed -i '' s/e/o/g foo
+%
+When you've made modifications to a file in vi(1) and then find that
+you can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the
+write
+
+This won't work if you don't have write permissions to the directory
+and probably won't be suitable if you're editing through a symbolic link.
+%
+You can adjust the volume of various parts of the sound system in your
+computer by typing 'mixer <type> <volume>'. To get a list of what you can
+adjust, just type 'mixer'.
+%
+You can automatically download and install binary packages by doing
+
+ pkg install <package>
+
+This will also automatically install the packages that are dependencies
+for the package you install (ie, the packages it needs in order to work.)
+%
+You can change the video mode on all consoles by adding something like
+the following to /etc/rc.conf:
+
+ allscreens="80x30"
+
+You can use "vidcontrol -i mode | grep T" for a list of supported text
+modes.
+ -- Konstantinos Konstantinidis <kkonstan@duth.gr>
+%
+You can disable tcsh's terminal beep if you `set nobeep'.
+%
+You can install extra packages for FreeBSD by using the ports system.
+If you have installed it, you can download, compile, and install software by
+just typing
+
+ # cd /usr/ports/<category>/<portname>
+ # make install && make clean
+
+as root. The ports infrastructure will download the software, change it so
+it works on FreeBSD, compile it, install it, register the installation so it
+will be possible to automatically uninstall it, and clean out the temporary
+working space it used. You can remove an installed port you decide you do not
+want after all by typing
+
+ # cd /usr/ports/<category>/<portname>
+ # make deinstall
+
+as root.
+%
+You can look through a file in a nice text-based interface by typing
+
+ less filename
+%
+You can make a log of your terminal session with script(1).
+%
+You can often get answers to your questions about FreeBSD by searching in the
+FreeBSD mailing list archives at
+
+ http://www.FreeBSD.org/search/search.html
+%
+You can open up a new split-screen window in (n)vi with :N or :E and then
+use ^w to switch between the two.
+%
+You can permanently set environment variables for your shell by putting them
+in a startup file for the shell. The name of the startup file varies
+depending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use
+.profile. When using bash, sh, ksh or zsh, don't forget to export the
+variable.
+%
+You can press Ctrl-D to quickly exit from a shell, or logout from a
+login shell.
+ -- Konstantinos Konstantinidis <kkonstan@duth.gr>
+%
+You can press Ctrl-L while in the shell to clear the screen.
+%
+You can press up-arrow or down-arrow to walk through a list of
+previous commands in tcsh.
+%
+You can search for documentation on a keyword by typing
+
+ apropos keyword
+%
+You can `set autologout = 30' to have tcsh log you off automatically
+if you leave the shell idle for more than 30 minutes.
+%
+You can use aliases to decrease the amount of typing you need to do to get
+commands you commonly use. Examples of fairly popular aliases include (in
+Bourne shell style, as in /bin/sh, bash, ksh, and zsh):
+
+ alias lf="ls -FA"
+ alias ll="ls -lA"
+ alias su="su -m"
+
+In csh or tcsh, these would be
+
+ alias lf ls -FA
+ alias ll ls -lA
+ alias su su -m
+
+To remove an alias, you can usually use 'unalias aliasname'. To list all
+aliases, you can usually type just 'alias'.
+%
+You can use /etc/make.conf to control the options used to compile software
+on this system. Example entries are in
+/usr/share/examples/etc/make.conf.
+%
+You can use "pkg info" to see a list of packages you have installed.
+%
+You can use the 'fetch' command to retrieve files over ftp, http or https.
+
+ fetch http://www.FreeBSD.org/index.html
+
+will download the front page of the FreeBSD web site.
+%
+You can use "whereis" to search standard binary, manual page and source
+directories for the specified programs. This can be particularly handy
+when you are trying to find where in the ports tree an application is.
+
+Try "whereis firefox" and "whereis whereis".
+ -- Konstantinos Konstantinidis <kkonstan@duth.gr>
+%
+Want to run the same command again?
+In tcsh you can type "!!"
+%
+Want to go the directory you were just in?
+Type "cd -"
+%
diff --git a/usr.bin/fortune/datfiles/freebsd-tips.sp.ok b/usr.bin/fortune/datfiles/freebsd-tips.sp.ok
new file mode 100644
index 0000000..968f318
--- /dev/null
+++ b/usr.bin/fortune/datfiles/freebsd-tips.sp.ok
@@ -0,0 +1,87 @@
+# $FreeBSD$
+aliasname
+allscreens
+AUTH
+autolist
+autologout
+BLOCKSIZE
+bomfile
+cdcontrol
+cdrom
+CDs
+cfg
+conf
+coredumpsize
+csh
+cshrc
+Ctrl
+deinstall
+dmesg
+dosfile
+dscheidt
+duth
+ESC
+filec
+FreeBSD
+grep
+gzip
+hiltonbsd
+html
+http
+ifconfig
+inetd
+init
+interactionvirtuelle
+IPv
+istar
+kkonstan
+Konstantinidis
+ksh
+lastlogin
+lpr
+manpage
+mathieu
+misc
+natserv
+ncal
+netcat
+netstat
+newfile
+NICs
+nobeep
+nospam
+org
+passwd
+pkg
+portname
+PostScript
+printf
+proxying
+PS
+pwd
+Reyes
+sbin
+Scheidt
+setenv
+sockstat
+swapinfo
+sysinstall
+tcsh
+tcsh's
+tput
+tumbolia
+UDP
+umount
+unalias
+uninstall
+uniq
+username
+usr
+UTF
+vidcontrol
+whereis
+www
+xset
+zcat
+zmore
+zsh
diff --git a/usr.bin/fortune/datfiles/gerrold.limerick b/usr.bin/fortune/datfiles/gerrold.limerick
new file mode 100644
index 0000000..f0bbce6
--- /dev/null
+++ b/usr.bin/fortune/datfiles/gerrold.limerick
@@ -0,0 +1,814 @@
+%% $FreeBSD$
+%% From The War Against The Chtorr,
+%% Copyright David Gerrold, 1984-2000, all rights reserved,
+%% used with permission of the author.
+%%
+%%© This is the copyright line.
+%%Eighty-nine is the year we assign.
+%% These verses are caroled
+%% by one David Gerrold.
+%%All rights are reserved. This is mine. *
+%%
+A limerick of classic proportion
+should have meter and rhyme and a portion
+ of humor quite lewd,
+ and a frightfully crude,
+impossible sexual contortion.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A limerick is best when it's lewd,
+gross, titillating and crude --
+ but this one is clean,
+ unless you are seen
+reading it aloud in the nude.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+I wanted to print here a medley
+of limericks so gross they were deadly,
+ but when the typesetter tried
+ to set them, he died;
+(not to mention my editor, Smedly.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+I have written some limericks quite fateful,
+malicious and vicious and hateful;
+ but I've torn up the jokes
+ that would sicken most folks,
+and humanity ought to be grateful.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young lady named Susie,
+Who everyone thought was a floozy.
+ She liked boy scout troops
+ and Shriners, in groups;
+"What the hell?" She replied. "I'm not choosy."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A fellow who lived in West Perkin
+was always a-jerkin' his gherkin.
+ Said he, "It's not fickle
+ to play with my pickle.
+At least my gherkin's a workin'."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A proctologist name of McGee
+once bent over double to see
+ an eyeball of glass
+ he had shoved up his ass,
+"-- so I can see one that looks back at me."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Bart has a singular penis
+for his wife who is built like a Venus.
+ He awoke with a fright
+ last Saturday night:
+"Hey! Something is coming between us!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who lives in New Delhi
+has habits disgusting and smelhi.
+ She likes to eat feces
+ of various species.
+(The recipe is tattooed or her belhi.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A daisy chain isn't a riddle.
+just some folks who are happy to fiddle,
+ by twos and by threes,
+ on their backs or their knees,
+and it's fun getting caught in the middle!
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lad with a marvelous bend
+has no need of a lover or friend.
+ What he does to himself
+ would fill up a shelf,
+but alas, he has come to his end.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was an old witch, name of Jessie
+whose crotch was all smelly and messie.
+ She enjoyed a good squirm
+ with an alien worm
+-- and got stains all over her dressie!
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who favors coition,
+has invented the spaceship position.
+ She lies down with ease
+ and pulls up her knees,
+and hollers, "Lift off!" and "Ignitions!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Isaac the famous seducer,
+will meet a young lass and conducer
+ to let him get fresh
+ with her quivering flesh,
+but if there isn't the time, he'll just gucer.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+And old man of Texas named Tanners
+was notorious for his bad manners.
+ When he noticed the start
+ of an imminent fart,
+he'd announce it with bullhorns and banners.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A woman who wanted to see,
+if she stood up, how far she could pee,
+ had pardon to beg,
+ when it ran down her leg,
+and formed icicles off her left knee.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A promiscuous sort was dear Laurie
+(Yes, this is that kind of story.)
+ She did it with Joe
+ and Larry and Moe
+and Curly and Howard and Morrie.
+
+And Johnny and Richard and Pritchard and Kerry
+And Lonnie and Horace and Boris and Barry
+ and Donald and Harold
+ and Ronald and Gerald
+and Tommy and Dicky and Harry.
+
+And . . . Peter and Paul and Teddy and Todd
+and Matthew and Mark and Simon and Rod
+ and Brucie and Mark
+ and Bobby and Clarck
+and she still isn't finished! My God!
+
+And David and Dennis and Huey and Ken
+and Dewey and Louie, then David again,
+ and Willy and Ben
+ and David again
+and again and again and again.
+
+And Danny and Manny and Gary and Fred
+and Mackie and Jackie and Dougie and Ned
+ and Harvey and Len
+ (then David again)
+and -- hold on just a second, she's dead!
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young man from St. Loo,
+who gave his dear sister a screw.
+ Said he, with aplomb,
+ "You're better than Mom."
+Said she, "That's what Dad told me too!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who didn't like flies
+managed to hide her surprise,
+ when she opened up one
+ and found it was fun.
+Now she willingly widens her thighs.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young lady named Nancy,
+who liked having sex, plain of fancy.
+ With lightning and thunder,
+ and a profound sense of wonder,
+But not with a partner -- much too chancy.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young lady quite tearful.
+Of sucking a cock, she was fearful.
+ In a moment of dread,
+ she just turned her head.
+And, boy! Did she get an earful!
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A mathematician named Boris
+had a wife with a wondrous clitoris.
+ He charged a small fee
+ for his colleagues to see
+that it was made in the shape of a torus.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+The ladies all had to agree
+that Mort's penis was too small to see.
+ A whore named Louise
+ sniffed, "Who will _that_ please?"
+Mort proudly submitted, "Just me!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young fellow named Fisk
+whose comings and goings were brisk,
+ He hid things that were stolen
+ inside his colon,
+and said, "Hey! It's my own *."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A stunning young lady named Joan
+thought a penis was made with a bone.
+ She just didn't know
+ 'twas her sexual glow
+that turned parts of men into stone.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A midwife named Flo from Arabia
+often enjoys giving baby a
+ forty-volt shock
+ to the base of the cock.
+(On a girl, she goes for the labia.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+I know of a lass who's for sale.
+She's really a nice piece of tail.
+ From June to September,
+ she'll devour your member,
+but the rest of the year, she's in jail.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Miss Wilkerson thought it her duty
+to maintain her conjugal beauty.
+ She mixed up a paste
+ of industrial waste,
+and applied it to her sweet patootie.*
+
+* The facts about beauty are known,
+and well-learned by those who are grown:
+ beauty is thin,
+ it lies on the skin;
+but ugly goes down to the bone.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+The punctual Cynthia Rolen
+missed a period, (or it was stolen)
+ She looked up her ass
+ with a tube made of glass,
+but found only her own semi-colon;
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A short-organ fellow named Kevin
+used a vacuum to stretch it to seven,
+ then to eight and to nine,
+ and though ten was divine,
+there will be film at eleven.*
+
+* If you think that our boy's now a stud,
+you've been fooled by the size of his pud.
+ Although twelve inches soft,
+ when it rises aloft,
+he just faints from the sheer lack of blood.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There once was a lady named Lizard,
+who got lost in a pink candy blizzard,
+ with a fellow named Jim
+ who wanted to swim
+up her legs to visit her gizzard.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young fellow named Ted,
+who had a radio put in his head.
+ Long wave or short
+ he did it for sport
+-- and to improve his reception in bed.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young lady from Venus,
+whose body was shaped like a penis.
+ A fellow named Hunt
+ was shaped like a cunt,
+so it all worked out fine, just between us.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was an old bastard named Gene,
+impotent, selfish, and mean.
+ His dick was so shamed
+ by what the man claimed,
+it pretended that is was a spleen.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There once was a fellow named Jason,
+whose horrible death I would hasten.
+ I'd feed him to worms,
+ just to see how he squirms
+-- but they'd vomit his crap in a basin.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+With a French lass, it's unwise to trifle.
+They have urges they simply can't stifle.
+ A woman of France
+ will pull down her pants
+at the sight of a towering eye-full.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+"My God!" screamed devout Mrs. Pike,
+as she fondled her stableman's spike.
+ "This is quite out of place,
+ and a great loss of face
+-- but I think I have fallen in like!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A well-endower fellow from Ortening
+prepared for an evening of sportening,
+ with a boy from a disco,
+ till he lubed up his Crisco,
+and discovered, alas, it was _shortening_!
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who read Sigmund Freud,
+thought her genitals underemployed;
+ so she put in a stand
+ for a seven-piece band,
+and held dances that we all enjoyed.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady named Shirley was mellow
+and she said to her eager young fellow,
+ "I prefer bagels and lox
+ to sucking off cocks,
+Or even a nice dish of Jell-O!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young man from St. Helens
+afflicted with shrinkin's and swellin's.
+ His dick was so small
+ it was not there at all,
+but his balls looked like honeydew melons.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A woman who once faked a lettera
+reference by which she could gettera
+ job much improved,
+ regretted her move
+when they asked her to show her et cetera.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady of South Madagascar
+wears a bag on her head; it's to mask her.
+ A bottle of scotch
+ might loosen her crotch.
+Wait here, I'll go and I'll ask her.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Chuck is weird, let the whole world know it.
+He brought in his bucket to show it.
+ We all had a fit
+ when we saw it was shit.
+We didn't know he was planning to throw it.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+"Which partners are best? Sixty-niners.
+And better than that? Try the Shriners."
+ These are the results
+ of consenting adults,
+(and occasional like-minded minors.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady's iambic pentameter
+is thirty-two inches diameter.
+ The breadth of her scansion
+ is due to expansion
+in the pants of a critical amateur.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young fellow from Norwich
+Who liked having sex with his porridge.
+ With sugar and cream
+ and a buttery scream --
+(The leftovers went into storage.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young fellow named Jim
+who liked to get naked and swim
+ with plastic sex toys
+ shaped like pubescent boys,
+'cause he'd rather be gay than be grim.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who jogged in the breeze
+had bosoms that flapped to her knees.
+ Said she, "They're quite warm,
+ they keep me dry in a storm,
+and when it snows, I use them for skis."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was an old voyeur named Zeke,
+who liked to hide in the closet and peek,
+ then jump out with loud cries
+ of "Aha!" and "Surprise!"
+and point out your flaws in technique.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Rick promised to gently deflower
+a maiden who lived on South Gower,
+ (The truth is, he spread
+ her legs wide on the bed,
+and finished her off in an hour.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+These poems have come out of my forehead.
+The subject are all fairly torrid
+ -- except for the few
+ that will make you say, "Pugh!"
+And those are the ones that are horrid.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Juanita, the subject of scandals,
+used to use unscented candles,
+ but now thinks it nice
+ to use a device
+with batteries, buzzers, and handles.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was an old prune name of Ginty
+who only ate muffins and thin tea.
+ Thinking of sex
+ gave her the blecchs,
+and left her all dried up and squinty.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Here's the tale of Benjamin Sneed:
+Where others were two'd he was three'd
+ and when they unmasked it,
+ (three balls in his basket),
+he was voted "Most Likely to Breed."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A maiden who had a third breast
+always kept her hand close to her chest,
+ and I promised her well
+ that I never would tell.
+(Write me privately. Name on request.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Skydiver Daniel McDopp
+used to masturbate right from the top.
+ Whenever he fell,
+ he jerked off like hell.
+He was good to the very last drop.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A necrophile name of Ned Schultz,
+often brags of his deed and exults,
+ "Tis legal, it's said,
+ to make love to the dead,
+if performed by consenting adults."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Have you ever met Jamie McBeezis?
+He does any damn thing that he pleases.
+ Says Jamie, undaunted,
+ "If you've got it,then flaunt it!"
+But he's referring to social diseases.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There once was a nearsighted gynie
+whose glasses were sparkly and shiny;
+ but they stayed in the drawer
+ while he worked on a whore
+and tied up the tubes of her hiney.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A shepherd named Jimmie Fitzhugh,
+said to his sweetheart, "It's true.
+ Nothing is moister
+ than a fresh oister,
+unless, of course, it is ewe."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There's a reason why Barton is queer.
+When you meet him, the reason is clear.
+ A goddess named Venus
+ gave him a penis,
+but Mother Nature filled up his brassiere.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Then there was Benjamin Bright,
+a contestant on "What's My Delight?"
+ They guesses at his habits
+ with little white rabbits,
+but were stumped by his mouse and his kite.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young man from St. Lutz,
+who had a remarkable putz.
+ It would sniff, it would hunt,
+ for it only liked cunt.
+Absolutely no lips, hands, or butts.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Sally's sex life was carefully planned.
+Said she, "I prefer to be manned.
+ Things that are anal,
+ are always so banal,
+but things that expand are just grand."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Sally-Jo was exceedingly vexed,
+when they said she was quite oversexed.
+ She said, "That's not true,
+ I just like to screw,
+Now, please take a number. Who's next?"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Sally sued for support; she was claimin'
+Phil had fathered her baby (named Damon).
+ She said, "I ought to know."
+ as she pointed below.
+"'Cause this is the box that he came in."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+We will need a computer to tally
+all the cowboys who scouted our Sally.
+ There were some on her mountains
+ and some on her fountains,
+and quite a few down in the valley.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady who overly lusted
+was frequently opened and thrusted.
+ When the baby came due
+ it was female too,
+and its hymen was already busted.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+When writing these verses of mine,
+I start with a clever last line,
+ then work backward from there,
+ toward the opening pair,
+with the hope it'll all work out fine.*
+
+*only sometimes it doesn't.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There once was a whore from St. Paul,
+who took anyone, wide, short, or tall.
+ She said to her clients,
+ "It's not really science --
+it's just that one size will fit all!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young fellow named Forrest
+whose cornhole was one of the sorest.
+ Said he, "I don't mind
+ a regular grind
+-- but I do wish my ass were clitorised."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+When Shakespeare awakes with a scream
+and his member a-drippin' with cream,
+ 'tis just the commission
+ of nocturnal emission,
+which he dubs, "A Mid-Slumber Night-Stream."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+Sally-Jo taught erotic correction.
+She told her student to get an erection.
+ "Put your dick in my mouth.
+ Move it north, move it south --
+Now, you're getting a sense of direction!"
+
+Her instructions were very explicit,
+and more than a little illicit:
+ "Please fill up my cunny
+ with fresh clover honey,
+and butter my buns like a biscuit."
+
+"Then wrap me up nice in a blanket,
+and I'll sit on your staff while you crank it.
+ I'll put on some feathers,
+ and laces and leathers,
+and wiggle my ass while you spank it."
+
+"Now that your fingers are stinky,
+tie me up in some chains that are clinky.
+ Bring in goats and a sheik,
+ give my titties a tweak
+--and _now_, we can start getting kinky!"
+
+"Forget what the chain and the whip meant.
+Just get the straps and the slings and a shipment
+ of high-grade Vaseline,
+ and a strong trampoline,
+and all of the other equipment!"
+
+"Now, when we get all the bedsprings a-drummin',
+that's when I'll start in a-hummin',
+ then quickly, my dear,
+ put it into my ear,
+so I'll hear the sound of it comin'!"
+
+"I don't know how much this is costing,"
+said her student, still covered with frosting.
+ "But I can say with affinity
+ that I've lost my virginity.
+Quite frankly, my dear, you're _exhausting_!"
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a mad pilot named Lizzy,
+whose manners were said to be skizzy.
+ She could loop, she could twirl,
+ she could make your head whirl.
+She left all her men fucking dizzy.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+The speed of Ed's seed is unclocked
+whenever a lady's unfrocked.
+ Tho' his spirit is willin',
+ when a pussy needs fillin',
+he's a man who goes off half-cocked.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A lady whose name is Tirelli
+has tits made of dynamite jelli.
+ If you take on this dare,
+ you must fondle with care.
+(The detonator's south of her belli.)
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+The fame of our Mame was her tushy,
+and the front of her cunt. (It was bushy.)
+ But I heard that her Mike
+ preferred for his spike
+the place in her face that was skwooshy.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A whore with a face like a hound
+complained that her sales were down,
+ till a lover named Michael
+ bought her a cycle,
+and she peddled it all over town.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+There was a young man named Levine
+who said to his lady, inclined,
+ "Thanks for the spasm,
+ it felt like orgasm;
+as a matter of fact, 'twas divine."
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
+A king who was mad at the time,
+decreed limerick writing a crime.
+ but late in the night
+ all the poets would write
+verses without any rhyme or meter.
+
+From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
+rights reserved, used with permission of the author.
+%
diff --git a/usr.bin/fortune/datfiles/limerick b/usr.bin/fortune/datfiles/limerick
new file mode 100644
index 0000000..5a92c78
--- /dev/null
+++ b/usr.bin/fortune/datfiles/limerick
@@ -0,0 +1,4812 @@
+%% $FreeBSD$
+%
+A bad little girl in Madrid,
+A most reprehensible kid,
+ Told her Tante Louise
+ That her cunt smelled like cheese,
+And the worst of it was that it did!
+%
+A bather whose clothing was strewed
+By breezes that left her quite nude,
+ Saw a man come along
+ And, unless I'm quite wrong,
+You expected this line to be lewd.
+%
+A beat schizophrenic said, "Me?
+I am not I, I'm a tree."
+ But another, more sane,
+ Shouted, "I'm a Great Dane!"
+And covered his pants leg with pee.
+%
+A beautiful belle of Del Norte
+Is reckoned disdainful and haughty
+ Because during the day
+ She says: "Boys, keep away!"
+But she fucks in the gloaming like forty.
+%
+A beautiful lady named Psyche
+Is loved by a fellow named Ikey.
+ One thing about Ike
+ The lady can't like
+Is his prick, which is dreadfully spikey.
+%
+A beetling young woman named Pridgets
+Had a violent abhorrence of midgets;
+ Off the end of a wharf
+ She once pushed a dwarf
+Whose truncation reduced her to fidgets.
+ -- Edward Gorey
+%
+A big-bosomed Bunny named Gression
+Sold cigars at a key-club concession.
+ When she swiveled about
+ Even strong men cried out,
+For her costume did not keep her flesh in.
+%
+A bobby of Nottingham Junction
+Whose organ had long ceased to function
+ Deceived his good wife
+ For the rest of her life
+With the aid of his constable's truncheon.
+%
+A broken-down harlot named Tupps
+Was heard to confess in her cups:
+ "The height of my folly
+ Was diddling a collie-
+But I got a nice price for the pups."
+%
+A burlesque dancer, a pip
+Named Virginia, could peel in a zip;
+ But she read science fiction
+ And died of constriction
+Attempting a Moebius strip.
+ -- Cyril Kornbluth, "The Unfortunate Topology"
+%
+A busy young lady named Gloria
+Was had by Sir Gerald du Maurier
+ And then by six men,
+ Sir Gerald again,
+And the band at the Waldorf-Astoria.
+%
+A cabin boy on an old clipper
+Grew steadily flipper and flipper.
+ He plugged up his ass
+ With fragments of glass
+And thus circumcised his old skipper.
+%
+A cautious young fellow named Lodge,
+Had seatbelts installed in his Dodge.
+ With his date all strapped in
+ He committed a sin
+Without even leaving the garage.
+ -- "A Boy and His Dog"
+%
+A cautious young fellow named Tunney
+Had a whang that was worth any money.
+ When eased in half-way,
+ The girl's sigh made him say,
+"Why the sigh?" "For the rest of it, honey."
+%
+A certain young man, it was noted,
+Went about in the heat thickly-coated;
+ He said, "You may scoff,
+ But I shan't take it off;
+Underneath I am horribly bloated."
+ -- Edward Gorey
+%
+A certain young person of Ghent,
+Uncertain if lady or gent,
+ Shows his organs at large
+ For a small handling charge
+To assist him in paying the rent.
+%
+A certain young sheik of Algiers
+Said to his harem, "My dears,
+ Though you may think it odd of me,
+ I'm tired of just sodomy
+Let's try straight fucking." (loud cheers!)
+%
+A chap down in Oklahoma
+Had a cock that could sing La Paloma,
+ But the sweetness of pitch
+ Couldn't put off the hitch
+Of impotence, size and aroma.
+%
+A charmer from old Amarillo,
+Sick of finding strange heads on her pillow,
+ Decided one day
+ That to keep men away
+She would stuff up her crevice with Brillo.
+%
+A chippy who worked in Black Bluff
+Had a pussy as large as a muff.
+ It had room for both hands
+ And some intimate glands,
+And was soft as a little duck's fluff.
+%
+A clerical student named Pryne
+Through pain sought to reach the divine:
+ He wore a hair shirt,
+ Quite often ate dirt,
+And bathed every Friday in brine.
+ -- Edward Gorey
+%
+A clever young man named Eugene
+Invented a jack-off machine.
+ On the twenty-third stroke
+ The fuckin' thing broke
+And beat both his balls to a creame.
+%
+A cocksucking steno named Beeman
+Remarked as she swallowed my semen:
+ "On my minuscule salary
+ I must watch every calorie,
+So I get `ahead' eating you he-men!"
+%
+A computer called Illiac4
+Had a rather tough bug in its core.
+ It chewed up its cards
+ And spewed yards and yards
+Of illegible tape on the floor.
+%
+A contortionist hailing from Lynch
+Used to rent out his tool by the inch.
+ A foot cost a quid --
+ He could and he did
+Stretch it to three in a pinch.
+%
+A corpulent maiden named Kroll
+Had a notion exceedingly droll:
+ At a masquerade ball,
+ Dressed in nothing at all,
+She backed in as a Parker House roll.
+%
+A cowhand way out in Seattle
+Had a dooflicker flat as a paddle.
+ He said, "No, I can't fuck
+ A lamb or a duck,
+But golly! it just fits the cattle."
+%
+A crusader's wife slipped from the garrison
+And had an affair with a Saracen.
+ She was not oversexed,
+ Or jealous or vexed,
+She just wanted to make a comparison.
+%
+A CS student named Lin
+Had a prick the size of a pin
+ It was no good for girls
+ But just great for squirrels
+Who squealed with delight with it in.
+%
+A cute little twerp from Samoa
+Had a cock of one inch and no moa.
+ It was good for keyholes
+ And debutantes' peeholes
+But not worth a damn on a whoa.
+%
+A daredevil skater named Lowe,
+Leaps barrels arranged in the snow,
+ But is proudest of doing,
+ Some incredible screwing,
+Since he's jumped thirteen girls in a row!
+%
+A deep-throated virgin named Netty
+Was sucking a cock on the jetty.
+ She said, "It tastes nice,
+ Much better than rice,
+Though not quite as good as spaghetti."
+%
+A delighted, incredulous bride
+Remarked to her groom at her side:
+ "I never could quite
+ Believe till tonight
+Our anatomies would coincide."
+%
+A dentist, young doctor Malone,
+Got a charming girl patient alone,
+ And, in his depravity,
+ Filled the wrong cavity.
+God, how his practice has grown.
+%
+A despairing old landlord named Fyfe,
+With a frigid and quarrelsome wife,
+ Let his third-story front,
+ To a willing young cunt,
+Who supplied him a new lease on life!
+%
+A desperate spinster from Clare
+Once knelt in the moonlight all bare,
+ And prayed to her God
+ For a romp on the sod--
+'Twas a passerby answered her prayer.
+%
+A distinguished professor from Swarthmore
+Got along with a sexy young sophomore.
+ As quick as a glance
+ He stripped off his pants,
+But he found that the sophomore'd got off more.
+%
+A doctoral student from Buckingham
+Wrote his thesis on cunts and on fucking'em.
+ But a dropout from paree
+ Taught him Gamahuchee
+- so he added a footnote on sucking 'em.
+%
+A do-it-yourselfer named Alice,
+Used a dynamite stick for a phallus.
+ She blew her vagina
+ To South Carolina,
+And her tits landed somewhere in Dallas.
+
+A cute friend of hers, Fanny Hill,
+Used two dynamite sticks for a dil.
+ They found her vagina,
+ In South Carolina,
+And part of her ass in Brazil.
+%
+A dolly in Dallas named Alice,
+Whose overworked sex is all callous,
+ Wore the foreskin away
+ On uncircumcised Ray,
+Through exuberance, tightness, and malice.
+%
+A dreary young bank clerk named Fennis
+Wished to foster an aura of menace.
+ To make people afraid
+ He wore gloves of grey suede
+And white footgear intended for tennis.
+ -- Edward Gorey, "Amphigorey"
+%
+A dulcet-voiced callgirl named Shedd,
+Who's cultured, well-spoken, well-bred,
+ Had achieved some renown
+ For her tone going down--
+There's a nice civil tongue in her head.
+%
+A fair-haired young damsel named Grace
+Thought it very, very foolish to place
+ Her hand on your cock
+ When it turned hard as rock,
+For fear it would explode in your face.
+%
+A farmer I know named O'Doole
+Had a long and incredible tool.
+ He can use it to plow,
+ Or to diddle a cow,
+Or just as a cue-stick at pool.
+%
+A fellatrix's healthful condition
+Proved the value of spunk as nutrition.
+ Her remarkable diet
+ (I suggest that you try it)
+Was only her clients' emission.
+%
+A fellow whose surname was Hunt
+Trained his cock to perform a slick stunt:
+ This versatile spout
+ Could be turned inside out,
+Like a glove, and be used as a cunt.
+%
+A fisherman off of Cape Cod
+Said, "I'll bugger that tuna, by God!"
+ But the high-minded fish
+ Resented his wish,
+And nimbly swam off with his rod.
+%
+A foolish geologist from Kissen
+Just didn't know what he was missin',
+ By studying rock
+ And neglecting his cock,
+And using it merely for pissin'.
+%
+A Frenchman who lived in Alsace
+Had sex with a virgin named Grace.
+ When he popped her cherry,
+ She made things hairy
+By bleeding all over his face.
+%
+A gay young prince from Morocco
+Made love in a manner rococo.
+ He painted his penis
+ To resemble a Venus
+And flavored his semen with cocoa.
+%
+A geneticist living in Delft
+Scientifically played with himself,
+ And when he was done
+ He labeled it: son,
+And filed him away on a shelf.
+%
+A gentleman, otherwise meek,
+Detested with passion the leek;
+ When offered one out
+ He dealt such a clout
+To the maid, she was down for a week.
+ -- Edward Gorey
+%
+A german composer named Bruckner
+Remarked to a lady while fuckener:
+ "Less lento, my dear,
+ With your cute little rear;
+I like a hot presto when muckener!"
+%
+A gift was delivered to Laura
+From a cousin who lived in Gomorrah;
+ Wrapped in tissue and crepe,
+ It was peeled, like a grape,
+And emitted a pale, greenish aura.
+ -- Edward Gorey
+%
+A gifted young fellow from Sparta
+Was widely renowned as a farta'.
+ He could fart anything
+ From "Of Thee I Sing,"
+To Beethoven's "Moonlight Sonata."
+%
+A girl camper once had an affair
+With a fellow all covered with hair.
+ When she gave him his hat
+ She realized that
+She'd been had by Smokey the Bear.
+%
+A girl of the Enterprise crew
+Refused every offer to screw.
+ But a Vulcan named Spock
+ Crawled under her smock,
+And now she is eating for two.
+%
+A girl of uncertain nativity
+Had an ass of extreme sensitivity
+ While she sat on the lap
+ Of a German or Jap,
+She could sense Fifth Column activity.
+%
+A graduate student named Zac
+Was said to be great in the sack.
+ An inch of his boner
+ Put girls in a coma
+And two gave them epileptic attacks.
+%
+A greedy young lady from Sidney
+Liked it in up to her kidney,
+ Till a man from Quebec
+ Shoved it up to her neck--
+He really diddled her, didn' he?
+%
+A green-thumbed young farmer from Leeds
+Once swallowed a package of seeds.
+ In a month, his ass
+ Was covered with grass
+And his balls were grown over with weeds.
+%
+A guest in a household quite charmless
+Was informed its eccentric was harmless:
+ "If you're caught unawares
+ At the head of the stairs,
+Just remember, he's eyeless and armless."
+ -- Edward Gorey
+%
+A habit depraved and unsavory
+Held the bishop of Bingham in slavery
+ Midst screeches and howls
+ He deflowered young owls
+Which he kept in an underground aviary
+%
+A habit obscene and bizarre,
+Has taken a-hold of papa.
+ He brings home young camels
+ And other odd mammals,
+And gives them a go at mama.
+%
+A habit obscene and unsavory,
+Holds a CS professor in slavery.
+ With maniacal howls,
+ He deflowers young owls,
+That he keeps in an underground aviary.
+%
+A hacker who screwed a mag tape
+Was caught and convicted of rape.
+ To jail he did go,
+ From which, to his woe
+He couldn't get out with ESC.
+%
+A hacker-turned-pervert named Fisk
+Made love to the drive of his disk.
+ The thing circumsized him,
+ Which rather surprised him.
+He wasn't aware of *that* risk.
+%
+A handsome young rodent named Gratian
+As a lifeguard became a sensation.
+ All the lady mice waved
+ And screamed to be saved
+By his mouse-to-mouse resuscitation.
+%
+A happy old hooker named Grace
+Once sponsored a cunt-lapping race.
+ It was hard for beginners
+ To tell who were winners:
+There were cunt hairs all over the place.
+%
+A hardware debugger named Court
+Shoved his tool in an Ethernet port.
+ But its buffer array
+ Only handled 1K,
+So the port's driver cut it off short.
+%
+A haughty young wench of Del Norte
+Would fuck only men over forty.
+ Said she, "It's too quick
+ With a young fellow's prick;
+I like it to last, and be warty."
+%
+A headstrong young woman in Ealing
+Threw her two weeks' old child at the ceiling;
+ When quizzed why she did,
+ She replied, "To be rid
+Of a strange, overpowering feeling."
+ -- Edward Gorey
+%
+A hearty young fellow named Yost
+Once had an affair with a ghost.
+ At the height of the spasm
+ The poor ectoplasm
+Cried, "Goodie, I feel it... almost."
+%
+A hidebound young virgin named Carrie
+Would say, when the fellows got hairy:
+ "Keep your prick in your pants
+ Till the end of this dance--"
+Which is why Carrie still has her cherry.
+%
+A highly aesthetic young Jew
+Had eyes of a heavenly blue;
+ The end of his dillie
+ Was shaped like a lilly,
+And his balls were too utterly two!
+%
+A highway patrol buff named Claire,
+Once screwed half a troop on a dare,
+ And her parts grew so hot,
+ There was steam on her twat,
+So they nicknamed her Smokey the Bare!
+%
+A horny young fellow named Reg,
+Was jerking off under a hedge.
+ The gardener drew near
+ With a huge pruning shear,
+And trimmed off the edge of his wedge.
+%
+A huge-organed female in Dallas,
+Named Alice, who yearned for a phallus,
+ Was virgo intacto,
+ Because, ipso facto,
+No phallus in Dallas fit Alice.
+%
+A joker who haunts Monticello
+Is really a terrible fellow.
+ In the midst of caresses
+ He fills ladies dresses
+With garter snakes, ice cubes, and jello.
+%
+A lacklustre lady of Brougham
+Weaveth all night at her loom.
+ Anon she doth blench
+ When her lord and his wench
+Pull a chain in the neighbouring room.
+%
+A lad, at his first copulation,
+Cried, "What a sensation! Inflation,
+ Gyration, elation
+ Throughout the duration,
+I guess I'll give up masturbation."
+%
+A lad from far-off Transvaal
+Was lustful, but tactful withal.
+ He'd say, just for luck,
+ "Mam'selle, do you fuck?"
+But he'd bow till he almost would crawl.
+%
+A lad of the brainier kind
+Had erogenous zones in his mind.
+ He got his sensations,
+ By solving equations,
+(Of course, in the end, he went blind.)
+%
+A lady born under a curse
+Used to drive forth each day in a hearse;
+ From the back she would wail
+ Through a thickness of veil:
+"Things do not get better, but worse."
+ -- Edward Gorey
+%
+A lady both callous and brash
+Met a man with a vast black moustache;
+ She cried, "Shave it, O do!
+ And I'll put it with glue
+On my hat as a sort of panache."
+ -- Edward Gorey
+%
+A lady from Kalamazoo
+Once found she had nothing to do,
+ So she sat on the stairs
+ And she counted her hairs:
+4,302.
+%
+A lady from Old Little Rock
+In fidelity took little stock,
+ And deserted her man
+ In the streets of Japan
+For a boy with a prehensile cock.
+%
+A lady removing her scanties,
+Heard them crackle electrical chanties.
+ Said her beau, "Have no fear,
+ For the reason is clear:
+You simply have amps in your panties.
+%
+A lady stockholder quite hetera
+Decided her fortune to bettera:
+ On the floor, quite unclad,
+ She successively had
+Merrill Lynch, Pierce, Fenner, et cetera...
+%
+A lady was seized with intent
+To revise her existence misspent.
+ So she climbed up the dome
+ Of St. Peter's in Rome,
+Where she stayed through the following Lent.
+ -- Edward Gorey
+%
+A lady, while dining in Crewe,
+Found an elephant's whang in her stew.
+ Said the waiter, "Don't shout
+ Or wave it about
+Or the others will ask for one, too."
+%
+A lady who signs herself "Vexed"
+Writes to say she believes she's been hexed:
+ "I don't mind my shins
+ Being stuck full of pins,
+But I fear I am coming unsexed."
+ -- Edward Gorey
+%
+A lady with features cherubic
+Was famed for her area pubic.
+ When they asked her its size
+ She replied in surprise,
+"Are you speaking of square feet, or cubic?"
+%
+A lass at the foot of her class
+Asked a brainier chick how to pass.
+ She replied, "With no fuss
+ You can get a B-plus,
+By letting the prof pat your ass."
+%
+A lecherous barkeep named Dale,
+After fucking his favorite female,
+ Mixed Drambuie and scotch
+ With the cream in her crotch
+For a lustier, Rusty-er Nail.
+%
+A licentious old justice of Salem
+Used to catch all the harlots and jail 'em.
+ But instead of a fine
+ He would stand them in line,
+With his common-law tool to impale 'em.
+%
+A linguist thought it a farce
+That memory space was so sparse.
+ One day they increased it.
+ Said he as he seized it:
+"At last! Enough core for the parse".
+%
+A lonely young lad of Eton
+Used always to sleep with the heat on,
+ Till he ran into a lass
+ Who showed him her ass --
+Now they sleep with only a sheet on.
+%
+A lovely young diver named Nancy,
+Wore a bikini bottom quite chancy,
+ The fish of Bonaire,
+ Watched her Derriere,
+And the sea fans all tickled her fancy.
+%
+A lovely young maid from St. Jude
+Once rode through the streets in the nude.
+ The police cried, "Whatam--
+ Agnificent bottom"
+And slapped it as hard as they could.
+%
+A lusty young maid from Seattle
+Got pleasure by sleeping with cattle;
+ Till she found a bull
+ Who filled her so full
+It made both her ovaries rattle.
+%
+A lusty young woodsman of Maine
+For years with no woman had lain,
+ But he found sublimation
+ At a high elevation
+In the crotch of a pine -- God, the pain!
+%
+A madam who ran a bordello
+Put come in her pineapple jello,
+ For the rich, sexy taste
+ And not wanting to waste
+That greasy kid stuff from a fellow.
+%
+A maestro directing in Rome
+Had a quaint way of driving it home.
+ Whoever he climbed
+ Had to keep her tail timed
+To the beat of his old metronome.
+%
+A maiden who lived in Virginny
+Had a cunt that could bark, neigh and whinny.
+ The horsey set rushed her,
+ But success finally crushed her
+For her tone soon became harsh and tinny.
+%
+A maiden who travelled in France
+Once got on a train, just by chance.
+ The engineer fucked her,
+ The conductor sucked her,
+And the fireman came in his pants.
+%
+A maiden who wrote of big cities
+Some songs full of love, fun and pities,
+ Sold her stuff at the shop
+ Of a musical wop
+Who played with her soft little titties.
+%
+A man was once heard to boast,
+That he received a parcel by post,
+ It contained, so we heard,
+ A magnificent turd,
+And the balls of his grandfather's ghost.
+%
+A marine being sent to Hong Kong
+Got a doctor to alter his dong.
+ He sailed off with a tool
+ Flat and thin as a rule -
+When he got there he found he was wrong.
+%
+A mathematician named Hall
+Had a hexahedronical ball,
+ And the square of its weight
+ Times his pecker's, plus eight,
+Was four-fifths of five-eighths of fuck-all.
+%
+A mathematician named Hall
+Has a hexahedronical ball,
+ And the cube of its weight
+ Times his pecker's, plus eight
+Is his phone number -- give him a call...
+%
+A mathematician named Klein
+Thought the Moebius band was divine.
+ Said he, "If you glue
+ The edges of two,
+You'll get a weird bottle like mine!
+%
+A middle-aged codger named Bruin
+Found his love life completely in ruin,
+ For he flirted with flirts
+ Wearing pants and no skirts,
+And he never got in for no screwin'.
+%
+A milkmaid there was, with a stutter,
+Who was lonely and wanted a futter.
+ She had nowhere to turn,
+ So she diddled a churn,
+And managed to come with the butter.
+%
+A mortician who practised in Fife
+Made love to the corpse of his wife.
+ "How could I know, Judge?
+ She was cold, did not budge--
+Just the same as she'd acted in life."
+%
+A nasty old drunk in Carmel
+Thinks it funny to piss in the well.
+ He says, "Some don't favor
+ That unusual flavor,
+But I don't drink the stuff -- what the hell!"
+%
+A nervous young fellow named Fred
+Took a charming young widow to bed.
+ When he'd diddled a while
+ She remarked with a smile,
+"You've got it all in but the head."
+%
+A new dramatist of the absurd
+Has a voice that will shortly be heard.
+ I learn from my spies
+ He's about to devise
+An unprintable three-letter word.
+%
+A newlywed couple from Goshen
+Spent their honeymoon sailing the ocean.
+ In twenty-eight days
+ They got laid eighty ways --
+Imagine such fucking devotion!
+%
+A newly-wed man of Peru
+Found himself in a terrible stew:
+ His wife was in bed
+ Much deader than dead,
+And so he had no one to screw.
+%
+A notorious whore named Ms. Hearst,
+In the pleasures of men was well-versed.
+ Reads the sign o'er the head
+ Of her well-rumpled bed
+"The customer always comes first."
+%
+A novice was told by the Abbot:
+"Consider the goat and the rabbit.
+ While they roll in the hay
+ You just stay home and pray.
+You've got to get out of that habit."
+%
+A nudist resort at Benares
+Took a midget in all unawares.
+ But he made members weep
+ For he just couldn't keep
+His nose out of private affairs.
+%
+A nurse motivated by spite
+Tied her infantine charge to a kite;
+ She launched it with ease
+ On the afternoon breeze,
+And watched till it flew out of sight.
+ -- Edward Gorey
+%
+A passionate red-haired girl
+When you kissed her, her senses would whirl,
+ And her twat would get wet,
+ And would wiggle and fret,
+And her cunt-lips would curl and unfurl.
+%
+A pathetic old maid of Bordeaux
+Fell in love with a dashing young beau.
+ To arrest his regard
+ She would squat in his yard
+And longingly pee in the sneaux.
+%
+A physical fellow named Fisk
+Could screw at a rate very brisk.
+ So fast was his action
+ The Fitzgerald contraction
+Would shrink up his rod to a disk.
+%
+A pious old woman named Tweak
+Had taught her vagina to speak.
+ It was frequently liable
+ To quote from the Bible,
+But when fucking -- not even a squeak!
+%
+A pious young lady named Finnegan
+Would caution her friend, "Well, you're in again;
+ So time it aright,
+ Make it last through the night,
+For I certainly don't want to sin again!"
+%
+A pious young lady of Chichester
+Made all of the saints in their niches stir
+ And each morning at matin
+ Her breast in pink satin
+Made the bishop of Chichester's breeches stir.
+%
+A playful young chemist named Byrd
+Had an urge that could not be deferred.
+ So to irritate Knox
+ He shit in his sox,
+And plastered the walls with his turd.
+%
+A plumber whose name was John Brink
+Plumbed the cook as she bent o'er the sink.
+ Her resistance was stout,
+ And John Brink petered out,
+With his pipe-wrench all limber and pink.
+%
+A pretty wife living in Tours
+Demanded her daily amour.
+ But the husband said, "No!
+ It's to much. Let it go!
+My backsides are dragging the floor."
+%
+A pretty young boy known as Kevin
+Was raped in a pasture by seven
+ Lascivious beasts
+ (Oh, those Anglican priests)
+And such is the Kingdom of Heaven.
+%
+A pretty young lady named Vogel
+Once sat herself down on a molehill.
+ A curious mole
+ Nosed into her hole --
+Ms. Vogel's okay, but the mole's ill.
+%
+A pretty young maiden from France
+Decided she'd "just take a chance."
+ She let herself go
+ For an hour or so,
+And now all her sisters are aunts.
+%
+A princess who lived near a bog
+Met a prince in the form of a frog.
+ Now she and her prince
+ Are the parents of quints,
+Four boys and one fine polliwog.
+%
+A princess who reigned in Baroda
+Made her home on a purple pagoda.
+ She festooned the walls
+ Of her halls with the balls
+And the tools of the fools who be-stroda'.
+%
+A programmer down in Moline
+Said, I'm the match for any machine.
+ My secret's aversion,
+ To loops and recursion,
+Just acres of in-line routine.
+ -- W. J. Wilson
+%
+A progressive professor named Winners
+Held classes each evening for sinners.
+ They were graded and spaced
+ So the vile and debased
+Would not be held back by beginners.
+%
+A rapist who reeked of cheap booze
+Attempted to ravish Miss Hughes.
+ She cried, "I suppose
+ There's no time for my clothes,
+But PLEASE let me take off my shoes!"
+%
+A rapturous young fellatrix
+One day was at work on five pricks.
+ With an unholy cry
+ She whipped out her glass eye:
+"Tell the boys I can now take on six."
+%
+A reckless young lady of France
+Had no qualms about taking a chance,
+ But she thought it was crude
+ To get screwed in the nude,
+So she always went home with damp pants.
+%
+A remarkable race are the Persians,
+They have such peculiar diversions.
+ They screw the whole day
+ In the regular way,
+And save up the nights for perversions.
+%
+A responsive young girl from the East
+In bed was an able artiste.
+ She had learned two positions
+ From family physicians,
+And ten more from the old parish priest.
+%
+A romantic attraction has clung
+To a chap of whom damsels have sung:
+ "'Tis the Scourge from the East,
+ That lascivious beast
+Who was known as Attila the Hung!"
+%
+A sailor who slept in the sun,
+Woke to find his fly buttons undone,
+ He remarked with a smile,
+ "Good grief, a sun-dial!
+And now it's a quarter-past one."
+%
+A savvy young hooker named Gail
+Got busted and lodged in the jail.
+ But the jailer got hot,
+ To be lodged in her twat,
+And so Gail made the bail with her tail.
+%
+A scandal involving an oyster
+Sent the Countess of Clews to a cloister
+ She preferred it, in bed,
+ To the count (so she said)
+'Cause it's longer and stronger and moister.
+%
+A scream from the crypt of St. Giles
+Resounded for miles upon miles.
+ Said the friar, "Good gracious,
+ The brother Ignatious
+Forgeteth the abbot hath piles."
+%
+A seafaring hacker named Slatey
+Went to bed with a VAX/780.
+ The thing's learned to swear
+ With a nautical air,
+And refers to its users as "matey".
+%
+A sex-loving coed named Bree
+Caught the clap from her Apple IIE.
+ The joystick, she found,
+ Had been fooling around
+With a neighboring student's PC.
+%
+A silly young man from Hong Kong
+Had hands that were skinny and long.
+ He ate rice with his fingers--
+ The taste of it lingers,
+But now all his fingers are gone.
+%
+A slick talking pirate named Bruce
+To steal code, had a plan to seduce
+ An Apple II+.
+ Now Bruce wears a truss
+And was jailed for computer abuse.
+%
+A software technician from Digital
+Had hardware extremely prodigical.
+ It's rumoured, I hear,
+ That when he was near
+He made the ladies all flustered and fidgital.
+%
+A space shuttle pilot named Ventry,
+Made love to a lovely girl sentry.
+ She started to pout,
+ Because it fell out,
+But the mission was saved by re-entry.
+%
+A sperm faced, alack and forsooth,
+His moment of sexual truth.
+ He'd expected to fall
+ On a womb's spongy wall
+But was dashed to his death on a tooth.
+%
+A spinster in Kalamazoo
+Once strolled after dark by the zoo.
+ She was seized by the nape,
+ And fucked by an ape,
+And she murmured, "A wonderful screw."
+
+And she added, "You're rough, yes, and hairy,
+But I hope -- yes I do -- that I marry
+ A man with a prick
+ Half as stiff and as thick
+As the kind that you zoo-keepers carry."
+%
+A spunky young schoolboy named Fred
+Used to toss off each night while in bed.
+ Said his mother, "Dear lad,
+ That's exceedingly bad--
+Jump in here with your mama instead."
+%
+A starship commander named Kirk
+Emerged from his cabin berserk.
+ He grabbed a girl yeoman
+ Beneath the abdomen,
+And gave her a physical jerk.
+%
+A stout Gaelic warrior, McPherson,
+Was having a captive, a person
+ Who was not averse
+ Though she had the curse,
+And he'd breeches of bristling furs on.
+%
+A structured programmer named Drew
+Was intensely turned on by "goto".
+ When he saw it in code
+ He'd shoot off his load.
+It's a good thing his shop used so few.
+%
+A studious professor named Nestor
+Bet a whore all his books that he could best her.
+ But she drained out his balls
+ And skipped up the walls,
+Beseeching poor Nestor to rest her.
+%
+A sweetheart named Teresa Arden
+Went down on her beau in the garden.
+ He said, "Good lord, Tess,
+ Don't swallow that mess!"
+And she replied, "Ulp, beg your pardon?"
+%
+A systems programmer named Sprotic
+Found his software intensely erotic.
+ In jealous distress
+ He wiped his OS.
+It's possible that he's psychotic.
+%
+A talented fuckstress, Miss Chisholm,
+Was renowned for her fine paroxysm.
+ While the man detumesced
+ She still spent on with zest,
+Her rapture sheer anachronism.
+%
+A team playing baseball in Dallas
+Called the umpire blind out of malice.
+ While this worthy had fits
+ The team made eight hits
+And a girl in the bleachers named Alice.
+%
+A teenage protester named Lil
+Cried, "Those Watergate spies make me ill
+ First they bugged our martinis,
+ Our bras and bikinis,
+And now they are bugging the pill."
+%
+A thrice-married gal from L.A.
+Said, "My hymen's intact to this day,
+ 'Cause my first (a shrink) talked of it,
+ The voyeur only gawked at it,
+And my most recent man's a gourmet."
+%
+A tidy young lady of Streator
+Dearly loved to nibble a peter.
+ She always would say,
+ "I prefer it this way.
+I think it is very much neater."
+%
+A timid young woman named Jane
+Found parties a terrible strain;
+ With movements uncertain
+ She'd hide in a curtain
+And make sounds like a rabbit in pain.
+ -- Edward Gorey
+%
+A tired young trollop of Nome
+Was worn out from her toes to her dome.
+ Eight miners came screwing,
+ But she said, "Nothing doing;
+One of you has to go home!"
+%
+A trapper named Francois Lefebrve
+Once captured and buggered a beabrve.
+ The result of this fuck
+ Was a three titted duck,
+A canoe, and an Irish retriebrve.
+%
+A tutor who tooted a flute
+Tried to tutor two tutors to toot
+ Said the two to the tutor:
+ "Is it harder to toot or
+To tutor two tutors to toot"
+%
+A vengeful technician named Schmitz
+Caused a disk drive to go on the fritz.
+ He covered the platter
+ With bats' fecal matter.
+Now it's seek time is really the pits.
+%
+A very intelligent turtle
+Found programming UNIX a hurdle
+ The system, you see,
+ Ran as slow as did he,
+And that's not saying much for the turtle.
+%
+A very odd pair are the Pitts:
+His balls are as large as her tits,
+ Her tits are as large
+ As an invasion barge--
+Neither knows how the other cohabits.
+%
+A wanton young lady from Wimley
+Reproached for not acting quite primly
+ Said, "Heavens above!
+ I know sex isn't love,
+But it's such an entrancing facsimile."
+%
+A water pipe suited Miss Hunt;
+She used it for many a bunt.
+ But the unlucky wench
+ Got it caught in her trench ---
+It took twenty-two men and a big Stillson wrench,
+To get the thing out of her cunt.
+%
+A weary old lecher named Blott
+Took a luscious young blond to his yacht.
+ Too lazy to rape her,
+ He made darts out of paper,
+Which he leisurely tossed at her twat.
+%
+A whimsical fellow named Bloch
+Could beat the base drum with his cock.
+ With a special erection
+ He could play a selection
+From Johann Sebastian Bach.
+%
+A wicked stone cutter named Cary
+Drilled holes in divine statuary.
+ With eyes full of malice
+ He pulled out his phallus,
+And buggered a stone Virgin Mary.
+%
+A wide-bottomed girl named Trasket
+Had a hole as big as a basket.
+ A spot, as a bride,
+ In it now, you could hide,
+And include with your luggage your mascot.
+%
+A widow whose singular vice
+Was to keep her late husband on ice
+ Said, "It's been hard since I lost him --
+ I'll never defrost him!
+Cold comfort, but cheap at the price."
+%
+A wonderful bird is the pelican.
+His mouth can hold more than his belican.
+ He can take in his beak
+ Enough food for a week.
+I'm darned if I know how the helican.
+%
+A wonderful tribe are the Sweenies,
+Renowned for the length of their peenies.
+ The hair on their balls
+ Sweeps the floors of their halls,
+But they don't look at women, the meanies.
+%
+A wood-fetish busboy named Gable
+Is rapid, is thorough, is able;
+ But when everything's cleared,
+ He gives way to the weird,
+As he lovingly busses each table.
+%
+A worn-out young husband named Lehr
+Heard daily his wife's plaintive prayer:
+ "Slip on a sheath, quick,
+ Then slip your big dick
+Between these lips covered with hair."
+%
+A worried young man from Stamboul
+Discovered red spots on his tool.
+ Said the doctor, a cynic,
+ "Get out of my clinic
+Just wipe off the lipstick, you fool."
+%
+A young bride and groom of Australia
+Remarked as they joined genitalia:
+ "Though the system seems odd,
+ We are thankful that God
+Developed the genus Mammalia."
+%
+A young fellow discovered through Freud
+That although of penis devoid,
+ He could practice coitus
+ By eating a foetus,
+And his parents were quite overjoyed.
+%
+A young Juliet of St. Louis
+On a balcony stood acting screwy.
+ Her Romeo climbed,
+ But he wasn't well timed,
+And half-way up, off he went -- blooey!
+%
+A young lad named Lester McGraw
+Caught a stranger on top of his Maw.
+ As he watched him stick her
+ He said, with a snicker,
+"You do it much faster than Paw."
+%
+A young lady sat by the sea,
+Just as proper as proper could be.
+ A young fellow goosed her,
+ And roughly seduced her,
+So she thanked him and went home to tea.
+%
+A young lady who lived by the Usk
+Subsisted each day on a rusk;
+ She ate the first bite
+ Before it was light,
+And the last crumb sometime after dusk.
+ -- Edward Gorey
+%
+A young lass got married at Chester;
+Her mother she kissed and she blessed her.
+ Said she, "You're in luck --
+ 'E's a stunning good fuck,
+For I've 'ad 'im meself down in Leicester."
+%
+A young maiden from France was no prude,
+She decided to dive in the nude,
+ But her buddy, behind,
+ Went out of his mind,
+When he noticed where she was tattooed.
+%
+A young man by a girl was desired
+To give her the thrills she required,
+ But he died of old age
+ Ere his cock could assuage
+The volcanic desire it inspired.
+%
+A young man from the banks of the Po
+Found his cock had elongated so,
+ That when he'd pee
+ It was never he
+But only his neighbors who'd know.
+%
+A young man grew increasingly peaky
+In a house where the hinges were squeaky,
+ The ferns curled up brown,
+ The ceilings flaked down,
+And all of the faucets were leaky.
+ -- Edward Gorey
+%
+A young man maintained that his trigger
+Was so big that there weren't any bigger.
+ But this long and thick pud
+ Was so heavy it could
+Scarcely lift up its head. It lacked vigor.
+%
+A young man of acumen and daring,
+Who'd amassed a great fortune in herring,
+ Was left quite alone
+ When it soon became known
+That their use at his board was unsparing.
+ -- Edward Gorey
+%
+A young man of Llanfairpwllgwyngyll
+While bent over plucking a dingle
+ Had the whole of Eisteddfod
+ Taking turns at his pod
+While they sang some impossible jingle.
+%
+A young man with passions quite gingery
+Tore a hole in his sister's best lingerie.
+ He slapped her behind
+ And made up his mind
+To add incest to insult and injury.
+%
+A young polo-player of Berkeley
+Made love to his sweetheart berserkly.
+ In the midst of each chukker
+ He would break off and fuck her
+Horizontally, laterally and verkeley.
+%
+A young wife in the outskirts of Reims
+Preferred frigging to going to mass.
+ Said her husband, "Take Jacques,
+ Or any young cock,
+For I cannot live up to your ass."
+%
+A young woman got married at Chester,
+Her mother she kissed her and blessed her.
+ Says she, "You're in luck,
+ He's a stunning good fuck,
+For I've had him myself down in Leicester."
+%
+According to experts, the oyster
+In its shell - a crustacean cloister -
+ May frequently be
+ Either he or a she
+Or both, if it should be its choice ter.
+%
+Alas for the Countess d'Isere,
+Whose muff wasn't furnished with hair.
+ Said the Count, "Quelle surprise!"
+ When he parted her thighs;
+"Magnifique! Pourtant pas de la guerre."
+%
+All the female apes ran from King Kong
+For his dong was unspeakably long.
+ But a friendly giraffe
+ Quaffed his yard and a half,
+And ecstatically burst into song.
+%
+An aesthete from South Carolina
+Had a cock that tickled like China,
+ But while shooting his load
+ It cracked like old Spode,
+So he's bought him a Steuben vagina.
+%
+An agreeable girl named Miss Doves
+Likes to jack off the young men she loves.
+ She will use her bare fist
+ If the fellows insist
+But she really prefers to wear gloves.
+%
+An AI researcher named Bluth
+Wrote, to find out the sexual truth,
+ Eroticon VI,
+ Which he taught certain tricks
+Which I'm sure can't be found in Knuth.
+%
+An amazon giantess named Dunne
+Let a midget screw her for fun.
+ But the poor little runt
+ Was engulfed in her cunt
+And re-born as the twin of his son.
+%
+An ambitious lady named Harriet
+Once dreamed she was raped in a chariot
+ By seventeen sailors
+ A monk and three tailors,
+Mohammed and Judas Iscariot.
+%
+An anonymous woman we knew
+Was dozing one day in her pew;
+ When the preacher yelled "Sin!"
+ She said, "Count me in
+As soon as the service is through."
+%
+An architect fellow named Yoric
+Could, when feeling euphoric,
+ Display for selection
+ Three kinds of erection-
+Corinthian, ionic, and doric.
+%
+An ardent young man named Magruder
+Once wooed a girl nude in Bermuda.
+ She thought it quite lewd
+ To be wooed in the nude,
+But Magruder was shrewder, he screwed her.
+%
+An Argentine gaucho named Bruno
+Who said, "Fucking is one thing I do know.
+ Women are fine
+ And sheep are divine
+But llamas are numero uno."
+%
+An ARPAnaut name of Corvette
+Had a fetish involving the net.
+ As he fondled his IMP
+ His cock went from limp
+To as hard as concrete which has set.
+%
+An arrogant wench from Salt Lake
+Liked to tease all the boys on the make.
+ She was finally the prize
+ Of a man twice her size
+And all she recalls is the ache.
+%
+An artist who lived in Australia
+Once painted his ass like a Dahlia.
+ The drawing was fine,
+ The colour - divine,
+The scent - ah, that was a failia.
+%
+An eager young hacker named Gus
+Once buggered a VAX Unibus.
+ The hardware went bad,
+ But not the young lad
+(Except for the toupee and truss).
+%
+An earnest young woman in Thrace
+Said, "Darling, that's not the right place!"
+ So he gave her a thwack,
+ And did on her back,
+What he couldn't have done face to face.
+%
+An Edwardian father named Udgeon,
+Whose offspring provoked him to dudgeon,
+ Used on Saturday nights
+ To turn down the lights,
+And chase them around with a bludgeon.
+ -- Edward Gorey
+%
+An envious girl named McMeanus
+Was jealous of her lover's big penis.
+ It was small consolation
+ That the rest of the nation
+Of women were with her in weeness.
+%
+An exotic young lady named Suki
+Once danced in a troupe of kabuki
+ When asked for a fuck
+ She said, "Solly, no luck--
+See here: looky looky, no nuki "
+%
+An impish young fellow named James
+Had a passion for idiot games.
+ He lighted the hair
+ Of his lady's affair
+And laughed as she pissed through the flames.
+%
+An impotent Scot named MacDougall
+Had to husband his sperm and be frugal.
+ He was gathering semen
+ To gender a he-man,
+By screwing his wife through a bugle.
+%
+An incautious young woman named Venn
+Was seen with the wrong sort of men;
+ She vanished one day,
+ But the following May
+Her legs were retrieved from a fen.
+ -- Edward Gorey
+%
+An indefatigable woman named Bavel
+Had often occasion to travel;
+ On the way she would sit
+ And furiously knit,
+And on the way back she'd unravel.
+ -- Edward Gorey
+%
+An ingenious young man in South Bend
+Made a synthetic ass for a friend,
+ But the friend shortly found
+ Its construction unsound,
+It was simply a bother -- no end.
+%
+An innocent maiden named Herridge
+Was cruelly tricked into marriage;
+ When she later found out
+ What her spouse was about,
+She threw herself under a carriage.
+ -- Edward Gorey
+%
+An inquisitive virgin named Dora
+Asked the man who started to bore 'er:
+ "Do you mean birds and bees
+ Go through antics like these,
+To supply us our fauna and flora?"
+%
+An irate young lady named Booker
+Told her husband, "You beast, I'm no hooker!
+ If you want it queer ways,
+ Go to whores for your lays!"
+So he packed up his tool and forsook 'er.
+%
+An octagenerian Jew
+To his wife remained steadfastly true.
+ This was not from compunction,
+ But due to dysfunction
+Of his spermatic glands -- nuts to you.
+%
+An old couple just at Shrovetide
+Were having a piece -- when he died.
+ The wife for a week
+ Sat tight on his peak,
+And bounced up and down as she cried.
+%
+An old electronic designer
+Had designs on a minor named Dinah.
+ He couldn't carry them out
+ For his prick was too stout,
+And too small was the minor's vagina.
+%
+An old gentleman's crotchets and quibblings
+Were a terrible trial to his siblings,
+ But he was not removed
+ Till one day it was proved
+That the bell-ropes were damp with his dribblings.
+ -- Edward Gorey
+%
+An old maid who had a pet ape
+Lived in fear of perpetual rape.
+ His red, hairy phallus
+ So filled her with malice
+That she sealed up her snatch with Scotch tape.
+%
+An old man at the Folies Bergere
+Had a jock, a most wondrous affair:
+ It snipped off a twat-curl
+ From each new chorus girl,
+And he had a wig made of the hair.
+%
+An organist playing in York
+Had a prick that could hold a small fork,
+ And between obbligatos
+ He'd munch at tomatoes,
+To keep up his strength while at work.
+%
+An orgasmic young sex star named Sue
+Was a hit as she writhed to a screw.
+ Her climatic fame spread
+ With an ad blitz that said:
+Coming soon at a theater near you!
+%
+An uptight young lady named Breerley
+Who valued her morals too dearly
+ Had sex, so I hear,
+ Only once every year,
+And she strained her vagina severely.
+%
+And then there's the story that's fraught
+With disaster -- of balls that got caught,
+ When a chap took a crap
+ In the woods, and a trap
+Underneath... Oh, I can't bear the thought!
+%
+As for weirdness, the guy who's the tops
+Is a kinky old butcher named Pops.
+ Since he thinks it's effete
+ To be beating his meat,
+What he's into is licking his chops.
+%
+As he came in his chubby choirboy,
+Father Burke said, "There's no greater joy!
+ If no sodomy levens
+ And possible heavens,
+Existence will merely annoy."
+%
+As the breeches-buoy swing towards the rocks,
+Its occupant cried, "Save my socks!
+ I could not bear the loss,
+ For with scarlet silk floss
+My mama has embroidered their clocks."
+ -- Edward Gorey
+%
+As tourists inspected the apse
+An ominous series of raps
+ Came from under the altar,
+ Which caused some to falter
+And others to shriek and collapse.
+ -- Edward Gorey
+%
+Asked a supplicant priest of the pontiff,
+"Do I sin if I do what I want, if
+ I screw a young nun
+ In the eastertide sun?"
+His holiness murmured, "Gut yontiff."
+%
+At a contest for farting in Butte
+One lady's exertion was cute:
+ It won the diploma
+ For fetid aroma,
+And three judges were felled by the brute.
+%
+At a dance, a girl from Connecticut
+Showed an absolute absence of etiquette
+ Letting all comers press
+ Through the skirt of her dress
+And wiping the mess with her petticoat.
+%
+At the end of all civilization
+Is the planet Terminus's location.
+ There's a girl there whose feat,
+ Without stone or concrete,
+Nonetheless, was to lay the Foundation.
+%
+At the moment Japan declared war
+A sailor was fucking a whore.
+ He said, "After this poke
+ `Long and hard' ain't no joke;
+This means months 'til I get back ashore."
+%
+At the Villa Nemetia the sleepers
+Are disturbed by a phantom in weepers;
+ It beats all night long
+ A dirge on a gong
+As it staggers about in the creepers.
+ -- Edward Gorey
+%
+At Vassar, sex isn't injurious,
+Though of love we are never penurious.
+ Thanks to vulcanized aids,
+ Though we may die old maids,
+At least we shall never die curious.
+%
+At whist drives and strawberry teas
+Fan would giggle and show off her knees;
+ But when she was alone
+ She'd drink eau de cologne,
+And weep from a sense of unease.
+ -- Edward Gorey
+%
+Augustus, for splashing his soup,
+Was put for the night on the stoop;
+ In the morning he'd not
+ Repented a jot,
+And next day he was dead of the croup.
+ -- Edward Gorey
+%
+Back in the days of old Adam
+The grass served as mattress for madam,
+ And they spent the whole day
+ On the sex that today
+They would bounce on box springs, if they had 'em.
+%
+Each Friday his engines abort,
+But Scotty is never caught short.
+ He fills his machines
+ With space-navy beans,
+And farts the ship back into port.
+%
+Each night Father fills me with dread
+When he sits on the foot of my bed;
+ I'd not mind that he speaks
+ In gibbers and squeaks,
+But for the seventeen years he's been dead.
+ -- Edward Gorey
+%
+From deep in the crypt at St. Giles
+Came a bellow that echoed for miles.
+ Said the rector, "My gracious,
+ Has Father Ignatius
+Forgotten the Bishop has piles!?"
+%
+From Number Nine, Penwiper Mews,
+There is really abominable news;
+ They've discovered a head
+ In the box for the bread,
+But nobody seems to know whose.
+ -- Edward Gorey
+%
+From the bathing machine came a din
+As of jollification within;
+ It was heard far and wide,
+ And the incoming tide
+Had a definite flavour of gin.
+ -- Edward Gorey
+%
+"Fucked by the finger of Fate!"
+Bewailed a young fellow named Tate.
+ "Since dating Miss Baugh,
+ My whole tongue has been raw--
+It must have been something I ate."
+%
+In the case of a lady named Frost,
+Whose cunt's a good two feet acrost,
+ It's the best part of valor
+ To bugger the gal, or
+You're apt to fall in and get lost.
+%
+In the Garden of Eden lay Adam,
+Complacently stroking his madam,
+ And loud was his mirth
+ For on all of the earth
+There were only two balls -- and he had 'em.
+%
+It always delights me at Hank's
+To walk up the old river banks.
+ One time in the grass
+ I stepped on an ass,
+And heard a young girl murmur, "Thanks."
+%
+It had snowed, and the man in the drift,
+Flagged her down and asked, "Give me a lift?"
+ They sat in her Bentley,
+ She fondled him gently,
+And the lift that he'd asked for was swift!
+%
+The late Brigham Young was no neuter --
+No faggot, no fairy, no fruiter.
+ Where ten thousand virgins
+ Succumbed to his urgin's
+There now stands the great State of Utah.
+%
+The latest reports from Good Hope
+State that apes there have pricks thick as rope,
+ And fuck high, wide, and free,
+ From the top of one tree
+To the top of the next -- what a scope!
+%
+The limerick, a verse form iniquitous,
+Has nonetheless been ubiquitous.
+ Once Congress in session,
+ Declared its suppression,
+But people got around that by writing the last line with no rhyme or meter.
+%
+The limerick is furtive and mean;
+You must keep her in close quarantine,
+ Or she sneaks to the slums
+ And promptly becomes
+Disorderly, drunk, and obscene.
+ -- Morris Bishop
+%
+The old archeologist, Throstle,
+Discovered a marvelous fossil.
+ He knew from its bend
+ And the knot on the end,
+T'was the penis of Paul the Apostle.
+%
+There once was a bishop from Birmingham
+Who deflowered young girls while confirming 'em.
+ As they knelt on the hassock
+ He lifted his cassock
+And slipped his episcopal worm in 'em.
+%
+There once was a boy named Carruthers
+Who was busily fucking his mother
+ "I know it's a sin,"
+ He said, shoving it in,
+"But it's better than blowing my brother."
+%
+There once was a chick named Longet,
+Who went out to Aspen to play.
+ Along came a Spyder,
+ Who sat down beside her
+And she blew the poor bastard away.
+%
+There once was a clergyman's daughter
+Who detested the pony he bought her,
+ Till she found that its dong
+ Was as hard and as long
+As the prayers her father had taught her.
+
+She married a fellow named Tony
+Who soon found her fucking the pony.
+ Said he, "What's it got,
+ My dear, that I've not?"
+Sighed she, "Just a yard-long bologna."
+%
+There once was a couple named Kelley,
+Who lived their life belly to belly.
+ Because in their haste
+ They used library paste,
+Instead of petroleum jelly.
+%
+There once was a dentist named Stone
+Who saw all his patients alone.
+ In a fit of depravity
+ He filled the wrong cavity,
+And my, how his practice has grown!
+%
+There once was a Duchess of Beever
+Who slept with her golden retriever.
+ Said the potted old Duke:
+ "Such tricks make me puke!
+Were it not for her money, I'd leave her."
+%
+There once was a Duchess of Bruges
+Whose cunt was incredibly huge.
+ Said the king to this dame
+ As he thunderously came:
+"Mon Dieu! Apres moi, le deluge!"
+%
+There once was a fag of Khartoum
+Who spent the night in a Lesbian's room.
+ They argued all night,
+ Over who had the right,
+To do what, and with which, and to whom.
+%
+There once was a fairy named Avers
+Who encircled his cock with lifesavers.
+ Though buggers all claimed
+ That their asses were maimed,
+Sixty-niners all cheered the new flavors.
+%
+There once was a fellow named Bob
+Who in sexual ways was a snob.
+ One day he was swimmin'
+ With twelve naked women
+And deserted them all for a gob.
+%
+There once was a fellow named Brewster
+Who said to his wife, as he goosed her,
+ "It used to be grand
+ But look at my hand
+You're not wiping as clean as ya uster."
+%
+There once was a fellow named Howard,
+Whose tool it was nuclear-powered,
+ While grabbing some ass,
+ He reached critical mass,
+But think of the girl he deflowered!
+%
+There once was a fellow named Potts
+Who was prone to having the trots
+ But his humble abode
+ Was without a commode
+So his carpet was covered with spots.
+%
+There once was a fellow named Siegel
+Who attempted to bugger a beagle,
+ But the mettlesome bitch
+ Turned and said with a twitch,
+"It's fun, but you know it's illegal."
+%
+There once was a fencer named Fisk,
+Whose speed was incredibly brisk.
+ So fast was his action,
+ The Fitzgerald contraction,
+Foreshortened his foil to a disk.
+%
+There once was a fiesty young terrier
+Who liked to bite girls on the derriere.
+ He'd yip and he'd yap,
+ Then leap up and snap;
+And the fairer the derriere the merrier.
+%
+There once was a floozie named Annie
+Whose prices were cosy--but cannie:
+ A buck for a fuck,
+ Fifty cents for a suck,
+And a dime for a feel of her fanny.
+%
+There once was a freshman named Lin,
+Whose tool was as thin as a pin,
+ A virgin named Joan
+ From a bible belt home,
+Said "This won't be much of a sin."
+%
+There once was a gangster named Brown
+- the sneakiest bastard in town.
+ He was caught by G-men
+ Shooting his semen
+Where the cops would slip and fall down.
+%
+There once was a gaucho named Bruno,
+Who said, "About sex, well, I do know,
+ Sheep are just fine,
+ Chickens, divine,
+But iguanas are Numero Uno."
+%
+There once was a gay young Parisian
+Who screwed an appendix incision,
+ And the girl of his choice
+ Could hardly rejoice
+At the horrible lack of precision.
+%
+There once was a girl from Cornell
+Whose teats were shaped like a bell.
+ When you touched them they shrunk,
+ Except when she was drunk,
+And then they got bigger than hell.
+%
+There once was a girl from Decatur,
+Who got laid by a big alligator.
+ Now nobody knew
+ The result of that screw,
+'Cause after he laid her, he ate her.
+%
+There once was a girl from Madras
+Who had such a beautiful ass -
+ It was not round and pink
+ (As you bastards think)
+But had two ears, a tail, and ate grass.
+%
+There once was a girl from Spokane,
+Went to bed with a one-legged man.
+ She said, "I know you--
+ You've really got two!
+Why didn't you say so when we began?"
+%
+There once was a girl named Irene
+Who lived on distilled kerosene
+ But she started absorbin'
+ A new hydrocarbon
+And since then has never benzene.
+%
+There once was a girl named Louise
+Who cunt hair hung down to her knees
+ The crabs in her twat
+ Tied the hairs in a knot
+And constructed a flying trapeze
+%
+There once was a girl named Mcgoffin
+Who was diddled amazingly often.
+ She was rogered by scores
+ Who'd been turned down by whores,
+And was finally screwed in her coffin.
+%
+There once was a girl named Priscilla
+Whose vagina was flavored vanilla.
+ The taste was so fine
+ Man and beast stood in line
+(Including a stud armadilla).
+%
+There once was a girl so lovely,
+Who wanted to make love in the bubbly,
+ She strapped on her tanks,
+ And started her pranks,
+But the lobsters all thought she was ugly.
+%
+There once was a golfer named Leer,
+Who got put in the clink for a year,
+ For an action obscene,
+ On the very first green.
+Where the sign said "Enter course here."
+%
+There once was a gouty old colonel
+Who grew glum when the weather grew vernal,
+ And he cried in his tiffin
+ For his prick wouldn't stiffen,
+And the size of the thing was infernal.
+%
+There once was a guardsman from Buckingham
+Who said, "As for girls, I hate fucking 'em.
+ But when I meet boys,
+ God! how I enjoys
+Just licking their peckers and sucking 'em."
+%
+There once was a hacker named Ken
+Who inherited truckloads of Yen.
+ So he built him some chicks,
+ Of silicon chips,
+And hasn't been heard from since then.
+%
+There once was a handsome young seaman
+Who with ladies was really a demon.
+ In peace or in war,
+ At sea or on shore,
+He could certainly dish out the semen.
+%
+There once was a horny old bitch
+With a motorized self-frigger which
+ She would use with delight
+ All day long and all night -
+Twenty bucks: Abercrombie & Fitch.
+%
+There once was a horse named Lily
+Whose dingus was really a dilly.
+ It was vaginoid duply,
+ And labial quadruply --
+In fact, he was really a filly.
+%
+There once was a husky young Viking
+Whose sexual prowess was striking.
+ Every time he got hot
+ He would scour the twat
+Of some girl that might be to his liking.
+%
+There once was a jolly old bloke
+Who picked up a girl for a poke.
+ He took down her pants,
+ Fucked her into a trance,
+And then shit into her shoe for a joke.
+%
+There once was a kiddie named Carr
+Caught a man on top of his mar.
+ As he saw him stick 'er,
+ He said with a snicker,
+"You do it much faster than par."
+%
+There once was a lady from Kansas
+Whose cunt was as big as Bonanzas.
+ It was nine inches deep
+ And the sides were quite steep --
+It had whiskers like General Carranza's.
+%
+There once was a lady named Carter,
+Fell in love with a virile young Tartar.
+ She stripped off his pants,
+ At his prick quickly glanced,
+And cried: "For that I'll be a martyr!"
+%
+There once was a lady named Clair,
+Who possessed a magnificent pair.
+ Or that's what I thought,
+ Till I saw one get caught,
+On a thorn and begin losing air.
+%
+There once was a lady named Myrtle
+Who had an affair with a turtle.
+ She had crabs, so they say,
+ In a year and a day
+Which proved that that turtle was fertile.
+%
+There once was a lawyer named Rex
+With minuscule organs of sex.
+ Arraigned for exposure,
+ He maintained with composure,
+"De minimis non curat lex."
+
+ [Trans: the law does not concern itself with small things. Ed.]
+%
+There once was a lifeguard named Lee
+Who rescued a girl from the sea
+ She asked how to pay,
+ And he said "Try this way,
+Go down for the third time on me."
+%
+There once was a maid from Mobile
+Whose cunt was made of blue steel.
+ She only got thrills
+ From pneumatic drills
+And an off-centered emery wheel.
+%
+There once was a man from Bombay
+He would do it all night and all day
+ He soon became sore
+ You shoulda' heard him roar
+When his wife rubbed his balls with Ben-Gay!
+%
+There once was a man from Calcutta
+Who used to beat off in the gutta
+ The heat of the sun
+ Affected his gun
+And turned all his cream into butta!
+%
+There once was a man from Dunoon,
+Who always ate soup with a fork.
+ He said "When I eat
+ Either fish, foul or flesh,
+I otherwise finish too quick."
+%
+There once was a man from Nantucket
+Who kept all his cash in a bucket.
+ His daughter, named Nan,
+ Ran away with a man,
+And as for the bucket, Nantucket.
+
+The pair of them went to Manhasset,
+(Nan and the man with the asset.)
+ Pa followed them there,
+ But they left in a tear,
+And as for the asset, Manhasset.
+
+Pa followed the pair to Pawtucket,
+(Nan and the man with the bucket.)
+ Pa said to the man,
+ "You're welcome to Nan."
+But as for the bucket, Pawtucket.
+%
+There once was a man from Racine,
+Who invented a screwing machine.
+ Both concave and convex,
+ It could please either sex,
+But, oh, what a bastard to clean!
+%
+There once was a man from Sandem
+Who was making his girl on a tandem.
+ At the peak of the make
+ She jammed on the brake
+And scattered his semen at random.
+%
+There once was a man from Sydney
+Who could put it up to her kidney.
+ But the man from Quebec
+ Put it up to her neck;
+He had a big one, now didn't he?
+%
+There once was a man named McGruder,
+Who canoed with a girl in Bermuder.
+ But the girl thought it crude,
+ To be wooed in the nude,
+So McGru took an oar and subduder.
+%
+There once was a man named McSweeny
+Who spilled lots of gin on his weeney.
+ So just to be couth,
+ He added vermouth,
+And slipped his best girl a martini.
+%
+There once was a man named Parridge
+With peculiar views on marriage.
+ He sucked off his brother,
+ Fucked his own mother,
+And gobbled his sister's miscarriage.
+%
+There once was a man with a hernia
+Who said to his doctor, "Gol dern ya,
+ When you work on my middle
+ Be sure you don't fiddle
+With things that do not concern ya."
+%
+There once was a member of Mensa
+Who was a most excellent fencer.
+ The sword that he used
+ Was his -- (line is refused,
+And has now been removed by the censor).
+%
+There once was a miner named Dave,
+Who kept a dead whore in his cave.
+ She was ugly as shit,
+ And missing one tit,
+But think of the money he saves.
+%
+There once was a monk of Camyre
+Who was seized with a carnal desire
+ And the primary cause
+ Was the abbess's drawers
+Which were hung up to dry by the fire.
+%
+There once was a newspaper vendor,
+A person of dubious gender.
+ He would charge one-and-two
+ For permission to view
+His remarkable double pudenda.
+%
+There once was a plumber from Leigh
+Who was plumbing his maid by the sea.
+ Said she, "Please stop plumbing,
+ I think someone's coming!"
+Said he, "Yes, I know love, it's me."
+%
+There once was a pretty young Mrs.
+Whose tearful but short story thrs.
+ Her mind lost its grasp -
+ Now she thinks she's an asp
+And just sits in the corner and hrs.
+%
+There once was a queen of Bulgaria
+Whose bush had grown hairier and hairier,
+ Till a prince from Peru
+ Who came up for a screw
+Had to hunt for her cunt with a terrier.
+%
+There once was a reverend at Kings
+Whose mind 'twas on heavenly things.
+ But his heart was on fire
+ For a boy in the choir
+Whose buns were like jelly on springs.
+%
+There once was a sad Maitre d'hotel
+Who said, "They can all go to hell!
+ What they do to my wife --
+ Why it ruins my life;
+And the worst is they all do it well."
+%
+There once was a sailor named Gasted,
+A swell guy, as long as he lasted,
+ He could jerk himself off
+ In a basket, aloft,
+Or a breeches-buoy swung from the masthead.
+%
+There once was a Scot named McAmeter
+With a tool of prodigious diameter.
+ But it wasn't the size
+ That caused such surprise;
+'Twas his rhythm -- iambic pentameter.
+%
+There once was a son-of-a-bitch,
+Neither clever, nor handsome, nor rich,
+ Yet the girls he would dazzle,
+ And fuck to a frazzle,
+And then ditch them, the son-of-a-bitch!
+%
+There once was a spaceman named Spock
+Who had a huge Vulcanized cock.
+ A girl from Missouri
+ Whose name was Uhura
+Just fainted away from the shock.
+%
+There once was a Swede in Minneapolis,
+Discovered his sex life was hapless:
+ The more he would screw
+ The more he'd want to,
+And he feared he would soon be quite sapless.
+%
+There once was a Usenetter named Mark,
+Whose gender was kept in the dark.
+ He/she/it said with a nod,
+ "My ancestors were odd!"
+Did Noah need two for the ark?
+%
+There once was a whore from Regina
+Who had a stupendous vagina.
+ To save herself time,
+ She had six at a time,
+And another one working behind her.
+%
+There once was a woman from Arden
+Who sucked off a man in a garden.
+ He said, "My dear Flo,
+ Where does all that stuff go?"
+And she said, "[Swallow hard] I beg pardon?"
+%
+There once was a yokel of Beaconsfield
+Engaged to look after the deacon's field,
+ But he lurked in the ditches
+ And diddled the bitches
+Who happened to cross that antique 'un's field.
+%
+There once was a young girl from Natches
+Who chanced to be born with two snatches
+ She often said, "Shit!
+ I'd give either tit
+For a guy with equipment that matches."
+%
+There once was a young man from Boston
+Who drove around town in an Austin,
+ There was room for his ass,
+ And a gallon of gas,
+So he hung out his balls and he lost 'em.
+%
+There once was a young man from France
+Who waited ten years for his chance;
+Then he muffed it...
+%
+There once was a young man from Yuma
+Who attempted sex with a puma
+ He gave up real quick
+ Minus nose, toes, and prick
+In obvious pain and ill huma.
+%
+There once was a young man from Yuma,
+Who told an elephant joke to a puma.
+ Now his dry bleached bones lie,
+ Under hot Asian skies,
+'Cause the puma had no sense of huma.
+%
+There once was a young man named Clyde
+Who fell in an outhouse, and died.
+ He had a twin brother
+ Who fell in another
+And now they're interred side by side.
+%
+There once was a young man named Lancelot
+Whom the townsfolk would look at askance a lot
+ For when he should pass
+ A desirable lass
+The front of his pants would advance a lot.
+%
+There once was an Arpanet freak,
+Who better response-time did seek.
+ He searched coast to coast,
+ For a reliable host,
+Whose logger took less than a week.
+%
+There once was an old man from Esser,
+Who's knowledge grew lesser and lesser.
+ It at last grew so small,
+ He knew nothing at all,
+And now he's a College Professor.
+%
+There once were two brothers named Luntz
+Who buggered each other at once.
+ When asked to account
+ For this intricate mount,
+They said, "Ass-holes are tighter than cunts."
+%
+There was a bluestocking in Florence
+Wrote anti-sex pamphlets in torrents,
+ Till a Spanish grandee,
+ Got her off with his knee,
+And she burned all her works with abhorrence.
+%
+There was a family named Doe,
+An ideal family to know.
+ As father screwed mother,
+ She said, "You're heavier than brother."
+And he said, "Yes, Sis told me so!"
+%
+There was a fat lady of China
+Who'd a really enormous vagina,
+ And when she was dead
+ They painted it red,
+And used it for docking a liner.
+%
+There was a fat man from Rangoon
+Whose prick was much like a balloon.
+ He tried hard to ride her
+ And when finally inside her
+She thought she was pregnant too soon.
+%
+There was a gay countess of Bray,
+And you may think it odd when I say,
+ That in spite of high station,
+ Rank and education,
+She always spelled cunt with a "k."
+%
+There was a gay dog from Ontario
+Who fancied himself a Lothario.
+ At a wench's glance
+ He'd snatch off his pants
+And make for her Mons Venerio.
+%
+There was a gay parson of Norton
+Whose prick, although thick, was a short 'un.
+ To make up for this loss,
+ He had balls like a horse,
+And never spent less than a quartern.
+%
+There was a gay parson of Tooting
+Whose roe he was frequently shooting,
+ Till he married a lass
+ With a face like my arse,
+And a cunt you could put a top-boot in.
+%
+There was a lewd fellow named Duff
+Who loved to dive deep in the muff.
+ With his head in a whirl
+ He said, "Spread it, Pearl;
+I cunt get enough of the stuff!"
+%
+There was a man from Mich.
+Who used to wish and wich.
+ That spring would come
+ So he could bum
+Around and go out fich.
+%
+There was a pianist named Liszt
+Who played with one hand while he pissed,
+ But as he grew older
+ His technique grew bolder,
+And in concert jacked off with his fist.
+%
+There was a poor parson from Goring,
+Who made a small hole in his flooring,
+ Fur-lined it all round,
+ Then laid on the ground,
+And declared it was cheaper than whoring.
+%
+There was a strong man of Drumrig
+Who one day did seven times frig.
+ He buggered three sailors,
+ Four dogs and two tailors,
+And ended by fucking a pig.
+%
+There was a teenager named Donna
+Who never said, "No, I don't wanna."
+ Two days out of three
+ She would shoot LSD,
+And on weekends she smoked marijuana.
+%
+There was a young belle of old Natchez
+Whose garments were always in patchez.
+ When comment arose
+ On the state of her clothes
+She, drawled, "When ah itchez, ah scratchez."
+%
+There was a young blade from South Greece
+Whose bush did so greatly increase
+ That before he could shack
+ He must hunt needle in stack.
+'Twas as bad as being obese.
+%
+There was a young bride, a Canuck,
+Told her husband, "Let's do more than suck.
+ You say that I, maybe,
+ Can have my first baby--
+Let's give up this Frenchin' and fuck!"
+%
+There was a young bride of Antigua
+Whose husband said, "Dear me, how big you are!"
+ Said the girl, "What damn'd rot!
+ Why, you've only felt my twot,
+My legs and my arse and my figua!"
+%
+There was a young chap in Arabia
+Who courted a widow named Fabia.
+ "Yes, my tongue is as long
+ As the average man's dong,"
+He said, licking the lips of her labia.
+%
+There was a young cook with the art
+Of making a delicious tart
+ With a handful of shit,
+ Some snot and some spit,
+And he'd flavor the whole with a fart.
+%
+There was a young curate whose brain
+Was deranged from the use of cocaine;
+ He lured a small child
+ To a copse dark and wild,
+Where he beat it to death with his cane.
+ -- Edward Gorey
+%
+There was a young damsel named Baker
+Who was poked in a pew by a Quaker.
+ He yelled, "My God! what
+ Do you call this -- a twat?
+Why, the entrance is more than an acre!"
+%
+There was a young dolly named Molly
+Who thought that to frig was a folly.
+ Said she, "Your pee-pee
+ Means nothing to me,
+But I'll do it just to be jolly."
+%
+There was a young fellow from Cal.,
+In bed with a passionate gal.
+ He leapt from the bed,
+ To the toilet he sped;
+Said the gal, "What about me, old pal?"
+%
+There was a young fellow from Florida
+Who liked a friend's wife, so he borrowed her.
+ When they got into bed
+ He cried, "God strike me dead!
+This ain't a cunt -- it's a corridor!"
+%
+There was a young fellow from Leeds
+Who swallowed a package of seeds.
+ Great tufts of grass
+ Sprouted out of his ass
+And his balls were all covered with weeds.
+%
+There was a young fellow from Parma
+Who was solemnly screwing his charmer.
+ Said the damsel demure,
+ "You'll excuse me, I'm sure,
+But I must say you fuck like a farmer."
+%
+There was a young fellow name Tucker
+Who, instructing a novice cock-sucker,
+ Said, "Don't bow out your lips
+ Like an elephant's hips,
+The boys like it best when they pucker."
+%
+There was a young fellow named Ades
+Whose favorite fruit was young maids.
+ But sheep, nigger boys, whores,
+ And the knot holes in doors
+Were by no means exempt from his raids.
+%
+There was a young fellow named Babbitt
+Who could screw nine times like a rabbit,
+ But a girl from Johore
+ Could do it twice more,
+Which was just enough extra to crab it.
+%
+There was a young fellow named Bill,
+Who took an atomic pill,
+ His navel corroded,
+ His asshole exploded,
+And they found his nuts in Brazil.
+%
+There was a young fellow named Blaine,
+And he screwed some disgusting old jane.
+ She was ugly and smelly
+ With an awful pot-belly,
+But... well, they were caught in the rain.
+%
+There was a young fellow named Bliss
+Whose sex life was strangely amiss,
+ For even with Venus
+ His recalcitrant penis
+Would never do better than t
+ h
+ i
+ s
+ .
+%
+There was a young fellow named Bowen
+Whose pecker kept growin' and growin'.
+ It grew so tremendous,
+ So long and so pendulous,
+'Twas no good for fuckin' -- just showin'.
+%
+There was a young fellow named Brewer
+Whose girl made her home in a sewer.
+ Thus he, the poor soul,
+ Could get into her hole,
+And still not be able to screw her!
+%
+There was a young fellow named Case
+Who entered a cunt-lapping race.
+ He licked his way clean
+ Through Number thirteen,
+But then slipped and got pissed in the face.
+%
+There was a young fellow named Charteris
+Put his hand where his young lady's garter is.
+ Said she, "I don't mind,
+ And higher up you'll find
+The place where my fucker and farter is."
+%
+There was a young fellow named Cribbs
+Whose cock was so big it had ribs.
+ They were inches apart,
+ And to suck it took art,
+While to fuck it took forty-two trips.
+%
+There was a young fellow named dick
+Who had a magnificent prick.
+ It was shaped like a prism
+ And shot so much gism
+It made every cocksucker sick.
+%
+There was a young fellow named Feeney
+Whose girl was a terrible meany.
+ The hatch of her snatch
+ Had a catch that would latch
+- She could only be screwed by Houdini.
+%
+There was a young fellow named Fletcher,
+Was reputed an infamous lecher.
+ When he'd take on a whore
+ She'd need a rebore,
+And they'd carry him out on a stretcher.
+%
+There was a young fellow named Fyfe
+Whose marriage was ruined for life,
+ For he had an aversion
+ To every perversion,
+And only liked fucking his wife.
+
+Well, one year the poor woman struck,
+And she wept, and she cursed at her luck,
+ And said, "Where have you gotten us
+ With your goddamn monotonous
+Fuck after fuck after fuck?
+
+"I once knew a harlot named Lou --
+And a versatile girl she was, too.
+ After ten years of whoredom
+ She perished of boredom
+When she married a jackass like you!"
+%
+There was a young fellow named Gene
+Who first picked his asshole quite clean.
+ He next picked his toes,
+ And lastly his nose,
+And he never did wash in between.
+%
+There was a young fellow named Gluck
+Who found himself shit out of luck.
+ Though he petted and wooed,
+ When he tried to get screwed
+He found virgins just don't give a fuck.
+%
+There was a young fellow named Goody
+Who claimed that he wouldn't, but would he?
+ If he found himself nude
+ With a gal in the mood
+The question's not woody but could he?
+%
+There was a young fellow named Grant
+Who was made like the sensitive plant.
+ When they asked "Do you fuck?"
+ He replied, "No such luck.
+I would if I could, but I can't."
+%
+There was a young fellow named Grimes
+Who fucked his girl seventeen times
+ In the course of a week --
+ And this isn't to speak
+Of assorted venereal crimes.
+%
+There was a young fellow named Harry,
+Had a joint that was long, huge and scary.
+ He grabbed him a virgin,
+ Who, without any urgin',
+Immediately spread like a fairy.
+%
+There was a young fellow named Hatch
+Who was fond of the music of Bach.
+ He said: "It's not fussy
+ Like Brahms and Debussy;
+Sit down, and I'll play you a snatch."
+%
+There was a young fellow named Kimble
+Whose prick was exceedingly nimble,
+ But fragile and slender,
+ And dainty and tender,
+So he kept it encased in a thimble.
+%
+There was a young fellow named Meek
+Who invented a lingual technique.
+ It drove women frantic,
+ And made them romantic,
+And wore all the hair off his cheek.
+%
+There was a young fellow named Morgan
+Who possessed an unusual organ:
+ The end of his dong,
+ Which was nine inches long,
+Was tipped with the head of a gorgon.
+%
+There was a young fellow named Paul
+Who confessed, "I have only one ball.
+ But the size of my prick
+ Is God's dirtiest trick,
+For my girls always ask, `Is that all?'"
+%
+There was a young fellow named Pell
+Who didn't like cunt very well.
+ He would finger or fuck one,
+ But never would suck one--
+He just couldn't get used to the smell.
+%
+There was a young fellow named Price
+Who dabbled in all sorts of vice.
+ He had virgins and boys
+ And mechanical toys,
+And on Mondays... he meddled with mice!
+%
+There was a young fellow named Prynne
+Whose prick was so short and so thin,
+ His wife found she needed
+ A Fuckoscope -- she did --
+To see if he'd gotten it in.
+%
+There was a young fellow named Skinner
+Who took a young lady to dinner
+ At a quarter to nine,
+ They sat down to dine,
+At twenty to ten it was in her.
+The dinner, not Skinner -- Skinner was in her before dinner.
+
+There was a young fellow named Tupper
+Who took a young lady to supper.
+ At a quarter to nine,
+ They sat down to dine,
+And at twenty to ten it was up her.
+Not the supper -- not Tupper -- It was some son-of-a-bitch named Skinner!
+%
+There was a young fellow named Sweeney,
+Whose girl was a terrible meanie,
+ The hatch of her snatch,
+ Had a catch that would latch,
+She could only be screwed by Houdini.
+%
+There was a young fellow of Burma
+Whose betrothed had good reason to murmur.
+ But now that he's married he's
+ Been using cantharides
+And the root of their love is much firmer.
+%
+There was a young fellow of Greenwich
+Whose balls were all covered with spinach.
+ He had such a tool
+ It was wound on a spool,
+And he reeled it out inich by inich.
+
+But this tale has an unhappy finich,
+For due to the sand in the spinach
+ His ballocks grew rough
+ And wrecked his wife's muff,
+And scratched up her thatch in the scrimmage.
+%
+There was a young fellow of Harrow
+Whose john was the size of a marrow.
+ He said to his tart,
+ "How's this for a start?
+My balls are outside in a barrow."
+%
+There was a young fellow of Kent
+Whose prick was so long that it bent,
+ So to save himself trouble
+ He put it in double,
+And instead of coming he went.
+%
+There was a young fellow of Mayence
+Who fucked his own arse in defiance
+ Not only of custom
+ And morals, dad-bust him,
+But of most of the known laws of science.
+%
+There was a young fellow of Perth
+Whose balls were the finest on earth.
+ They grew to such size
+ That one won a prize,
+And goodness knows what they were worth.
+%
+There was a young fellow of Strensall
+Whose prick was as sharp as a pencil.
+ On the night of his wedding
+ It went through the bedding,
+And shattered the chamber utensil.
+%
+There was a young fellow of Warwick
+Who had reason for feeling euphoric,
+ For he could by election
+ Have triune erection:
+Ionic, Corinthian, and Doric.
+%
+There was a young fellow whose dong
+Was prodigiously massive and long.
+ On each side of his whang
+ Two testes did hang
+That attracted a curious throng.
+%
+There was a young German named Ringer
+Who was screwing an opera singer.
+ Said he with a grin,
+ "Well, I've sure got it in!"
+Said she, "You mean that ain't your finger?"
+%
+There was a young girl from Annista
+Who dated a lecherous mister.
+ He fondled her titty,
+ Got one finger shitty,
+Then screwed up his courage and kissed 'er.
+%
+There was a young girl from Decatur
+Who was raped by an alligator.
+ But no one quite knew
+ How she relished that screw,
+For after he screwed her, he ate her.
+%
+There was a young girl from Dundee,
+From her fanny there grew a plum tree.
+ No one ate the nice fruit,
+ To tell you the truth,
+Because they knew it came from her tooty-toot-toot.
+%
+There was a young girl from Hong Kong
+Who said, "You are utterly wrong
+ To say my vagina
+ Is the largest in China
+Just because of your mean little dong."
+%
+There was a young girl from Hong Kong
+Whose cervical cap was a gong.
+ She said with a yell,
+ As a shot rang her bell,
+"I'll give you a ding for a dong!"
+%
+There was a young girl from Medina
+Who could completely control her vagina.
+ She could twist it around
+ Like the cunts that are found
+In Japan, Manchukuo and China.
+%
+There was a young girl from New York
+Who plugged up her cunt with a cork.
+ A woodpecker or two
+ Made the grade it is true,
+But it totally baffled the stork.
+
+Till along came a man who presented
+A tool that was strangely indented.
+ With a dizzying twirl
+ He punctured that girl,
+And thus was the cork-screw invented.
+%
+There was a young girl from Peru,
+Who had nothing whatever to do.
+ So she sat on the stairs,
+ And counted cunt hairs,
+Four thousand, three hundred and two.
+%
+There was a young girl from Peru,
+Who noticed her lovers were few;
+ So she walked out her door
+ With a fig leaf, no more,
+And now she's in bed - with the flu.
+%
+There was a young girl from Samoa
+Who pledged that no man would know her.
+ One young fellow tried,
+ But she wriggled aside,
+And he spilled all his spermatozoa.
+%
+There was a young girl from Seattle,
+Whose hobby was sucking off cattle.
+ But a bull from the South
+ Shot a wad in her mouth
+That made both her ovaries rattle.
+%
+There was a young girl from Siam
+Who said to her boyfriend Priam,
+ "To seduce me, of course,
+ You'll have to use force,
+And thank goodness you're stronger than I am.
+%
+There was a young girl from St. Cyr
+Whose reflex reactions were queer.
+ Her escort said, "Mable,
+ Get up off the table;
+That money's to pay for the beer."
+%
+There was a young girl from St. Paul
+Who went to a newspaper ball.
+ Her dress caught on fire
+ And burnt her entire
+Front page and sport section and all.
+%
+There was a young girl from the Bronix
+Who had a vagina of onyx.
+ She had so much `tsoris'
+ With her clitoris,
+She traded it in for a Packard.
+%
+There was a young girl from the coast
+Who, just when she needed it most,
+ Lost her Kotex and bled
+ All over the bed,
+And the head and the beard of her host.
+%
+There was a young girl in Berlin
+Who eked out a living through sin.
+ She didn't mind fucking,
+ But much preferred sucking,
+And she'd wipe off the pricks on her chin.
+%
+There was a young girl in Berlin
+Who was fucked by an elderly Finn.
+ Though he diddled his best,
+ And fucked her with zest,
+She kept asking, "Hey, Pop, is it in?"
+%
+There was a young girl in Dakota
+Had a letter from Ickes; he wrote her:
+ "In addition to gas
+ We are rationing ass,
+And you've greatly exceeded your quota."
+%
+There was a young girl name McKnight
+Who got drunk with her boy-friend one night.
+ She came to in bed,
+ With a split maidenhead--
+That's the last time she ever was tight.
+%
+There was a young girl named Ann Heuser
+Who swore that no man could surprise her.
+ But Pabst took a chance,
+ Found a Schlitz in her pants,
+And now she is sadder Budweiser.
+%
+There was a young girl named Heather
+Whose twitcher was made out of leather.
+ She made a queer noise,
+ Which attracted the boys,
+By flapping the edges together.
+%
+There was a young girl named McCall
+Whose cunt was exceedingly small,
+ But the size of her anus
+ Was something quite heinous --
+It could hold seven pricks and one ball.
+%
+There was a young girl named O'Clare
+Whose body was covered with hair.
+ It was really quite fun
+ To probe with one's gun,
+For her quimmy might be anywhere.
+%
+There was a young girl named O'Malley
+Who wanted to dance in the ballet.
+ She got roars of applause
+ When she kicked off her drawers,
+But her hair and her bush didn't tally.
+%
+There was a young girl named Sapphire
+Who succumbed to her lover's desire.
+ She said, "It's a sin,
+ But now that it's in,
+Could you shove it a few inches higher?"
+%
+There was a young girl of Aberystwyth
+Who screwed every man that she kissed with.
+ She tickled the balls
+ Of the men in the halls,
+And pulled on the prongs that they pissed with.
+%
+There was a young girl of Aberystwyth
+Who took grain to the mill to get grist with.
+ The miller's sun, Jack,
+ Laid her flat on her back,
+And united the organs they pissed with.
+%
+There was a young girl of Angina
+Who stretched catgut across her vagina.
+ From the love-making frock
+ (With the proper sized cock)
+Came Toccata and Fugue in D minor.
+%
+There was a young girl of Asturias
+With a penchant for practices curious.
+ She loved to bat rocks
+ With her gentlemen's cocks --
+A practice both rude and injurious.
+%
+There was a young girl of Batonger
+who diddled herself with a conger,
+ When asked how it feels
+ To be pleasured by eels
+She said, "Just like a man, only longer.
+%
+There was a young girl of Cah'lina,
+Had a very capricious vagina:
+ To the shock of the fucker
+ "Twould suddenly pucker,
+And whistle the chorus of "Dinah."
+%
+There was a young girl of Cape Cod
+Who dreamt she'd been buggered by God.
+ But it wasn't Jehovah
+ That turned the girl over,
+'Twas Roger the lodger, the dirty old codger,
+ the bugger, the bastard, the sod!
+%
+There was a young girl of Cape Town
+Who usually fucked with a clown.
+ He taught her the trick
+ Of sucking his prick,
+And when it went up -- she went down.
+%
+There was a young girl of Coxsaxie
+Whose skirt was more mini than maxi.
+ She was fucked at the show
+ In the twenty-third row,
+And once more going home in the taxi.
+%
+There was a young girl of Darjeeling
+Who could dance with such exquisite feeling
+ There was never a sound
+ For miles around
+Save of fly-buttons hitting the ceiling.
+%
+There was a young girl of Des Moines
+Whose cunt could be fitted with coins,
+ Till a guy from Hoboken
+ Went and dropped in a token,
+And now she rides free on the ferry.
+%
+There was a young girl of Detroit
+Who at fucking was very adroit:
+ She could squeeze her vagina
+ To a pin-point, or finer,
+Or open it out like a quoit.
+
+And she had a friend named Durand
+Whose cock could contract or expand.
+ He could diddle a midge
+ Or the arch of a bridge --
+Their performance together was grand!
+%
+There was a young girl of East Lynne
+Whose mother, to save her from sin,
+ Had filled up her crack,
+ To the brim with shellac,
+But the boys picked it out with a pin.
+%
+There was a young girl of Gibraltar
+Who was raped as she knelt at the altar.
+ It really seems odd
+ That a virtuous God
+Should answer her prayers and assault her.
+%
+There was a young girl of LLewellyn
+Whose breasts were as big as a melon.
+ They were big it is true,
+ But her cunt was big too,
+Like a bifocal, full-color, aerial view
+Of Cape Horn and the Straits of Magellan.
+%
+There was a young girl of Mobile,
+Who hymen was made of chilled steel,
+ To give her a thrill,
+ Took a rotary drill,
+Or a number nine emery wheel.
+%
+There was a young girl of Moline
+Whose fucking was sweet and obscene.
+ She would work on a prick
+ With every known trick,
+And finish by winking it clean.
+%
+There was a young girl of Newcastle
+Whose charms were declared universal.
+ While one man in front
+ Wired into her cunt,
+Another was engaged at her arsehole.
+%
+There was a young girl of Pawtucket
+Whose box was as big as a bucket.
+ Her boy-friend said, "Toots,
+ I'll have to wear boots,
+For I see I must muck it, not fuck it."
+%
+There was a young girl of Penzance
+Who boarded a bus in a trance.
+ The passengers fucked her,
+ Likewise the conductor,
+While the driver shot off in his pants.
+%
+There was a young girl of Pitlochry
+Who was had by a man in a rockery.
+ She said, "Oh! You've come
+ All over my bum;
+This isn't a fuck -- it's a mockery."
+%
+There was a young girl of Rangoon
+Who was blocked by the Man in the Moon.
+ "Well, it has been great fun,"
+ She remarked when he'd done,
+"But I'm sorry you came quite so soon."
+%
+There was a young girl of Spitzbergen,
+Whose people all thought her a virgin,
+ Till they found her in bed
+ With her twat very red,
+And the head of a kid just emergin'.
+%
+There was a young girl, very sweet,
+Who thought sailors' meat quite a treat.
+ When she sat on their lap
+ She unbuttoned their flap,
+And always had plenty to eat.
+%
+There was a young girl who begat
+Three brats, by name Nat, Pat, and Tat.
+ It was fun in the breeding,
+ But hell in the feeding,
+When she found there was no tit for Tat.
+%
+There was a young harlot from Kew
+Who filled her vagina with glue.
+ She said with a grin,
+ "If they pay to get in,
+They'll pay to get out of it too."
+%
+There was a young harlot named Schwartz
+Whose cock-pit was studded with warts,
+ And they tickled so nice
+ She drew a high price
+From the studs at the summer resorts.
+
+Her pimp, a young fellow named Biddle,
+Was seldom hard up for a diddle,
+ For according to rumor
+ His tool had a tumor
+And a fine row of warts down the middle.
+%
+There was a young hayseed from Tiffan
+Whose cock would constantly stiffen.
+ The knob out in front
+ Attracted foul cunt
+Which he greatly delighted in sniffin'.
+%
+There was a young idler named Blood,
+Made a fortune performing at stud,
+ With a fifteen-inch peter,
+ A double-beat metre,
+And a load like the Biblical Flood.
+%
+There was a young Jew of Far Rockaway
+Whose screams could be heard for a block away.
+ Perceiving his error,
+ The Rabbi in terror
+Cried, "God! I have cut his whole cock away!"
+%
+There was a young lad from Siam,
+Whose sex life was caught in a jam.
+ He loved them real small,
+ 'Cause they're funner to ball,
+So he went out and bought him a lamb!
+%
+There was a young lad name of Durcan
+Who was always jerkin' his gherkin.
+ His father said, "Durcan!
+ Stop jerkin' your gherkin!
+Your gherkin's for ferkin', not jerkin'.
+%
+There was a young lad name of Ward
+Who strung himself up with a cord
+ Said he, of his work
+ (Ere the rope snapped with a jerk)
+"I am leaving because I am bored."
+ -- E. A. Guest
+%
+There was a young lad named McFee
+Who was stung in the balls by a bee
+ He made oodles of money
+ By oozing pure honey
+Every time he attempted to pee.
+%
+There was a young lady at sea
+Who complained that it hurt her to pee.
+ Said the brawny old mate,
+ "That accounts for the state
+Of the cook and the captain and me."
+%
+There was a young lady called Ciss
+Who went to the river to piss.
+ A young man in a punt
+ Put his hand on her cunt;
+No wonder she thought it was bliss.
+%
+There was a young lady from Bangor
+Who slept while the ship lay at anchor
+ She woke in dismay
+ When she heard the mate say:
+"Let's lift up the topsheet and spanker!"
+%
+There was a young lady from Bristol
+Who went to the Palace called Crystal.
+ Said she, "It's all glass,
+ And as round as my ass,"
+And she farted as loud as a pistol.
+%
+There was a young lady from Brussels
+Who was proud of her vaginal muscles.
+ She could easily plex them
+ And so interflex them
+As to whistle love songs through her bustles.
+%
+There was a young lady from Drew
+Who ended her verse at line two.
+%
+There was a young lady from Dumfries
+Who said to her boyfriend, "It's some freeze!
+ My navel's all bare,
+ So stick it in there,
+Before both my legs and my bum freeze."
+%
+There was a young lady from Exeter,
+So pretty that men craned their necks at her.
+ One was even so brave
+ As to take out and wave
+The distinguishing mark of his sex at her.
+%
+There was a young lady from Hyde
+Who ate a green apple and died.
+ While her lover lamented
+ The apple fermented
+And made cider inside her inside.
+%
+There was a young lady from Maine
+Who claimed she had men on her brain.
+ But you knew from the view,
+ As her abdomen grew,
+It was not on her brain that he'd lain.
+%
+There was a young lady from Munich
+Who had an affair with a eunuch.
+ At the height of their passion
+ He dealt her a ration
+From a squirt gun concealed in his tunic.
+%
+There was a young lady from Norway
+Who hung by her heels in a doorway.
+ She told her young man,
+ "Get off the divan,
+I think I've discovered one more way"
+%
+There was a young lady from Prentice
+Who had an affair with a dentist.
+ To make things easier
+ He used anesthesia,
+And diddled her, `non compos mentis'.
+%
+There was a young lady from Rheims
+Who amazingly pissed in four streams.
+ A friend poked around
+ And a fly-button found
+Lodged tight in her hole so it seems.
+%
+There was a young lady from Rio
+Who slept with the Fornier trio.
+ As she dropped her panties
+ She said, "No andantes,
+I want this allegro con brio!"
+%
+There was a young lady from Siam
+Who said to her lover, one Kiam,
+ "You may kiss me of course,
+ But you'll have to use force.
+Though god knows you're stronger than I am."
+%
+There was a young lady from Spain
+Who demurely undressed on a train.
+ A helpful young porter
+ Helped more than he orter,
+And she promptly cried "Help me again"
+%
+There was a young lady from Spain
+Who got sick as she rode on a train;
+ Not once, but again,
+ And again, and again,
+And again, and again, and again.
+%
+There was a young lady from Spain
+Whose face was exceedingly plain,
+ But her cunt had a pucker
+ That made the men fuck her,
+Again, and again, and again.
+%
+There was a young lady from Troy
+Had a moustache, just like a young boy
+ Though it tickled to kiss
+ 'Twas a source of much bliss
+When she used it to brush a man's toy.
+%
+There was a young lady from Wheeling
+Who claimed to lack sexual feeling.
+ But a cynic named Boris
+ Just touched her clitoris
+And she had to be scraped off the ceiling.
+%
+There was a young lady from Wheeling
+Who had a peculiar feeling.
+ She laid on her back
+ And tickled her crack
+And pissed all over the ceiling.
+%
+There was a young lady from Wooster
+Who complained that too many men gooster.
+ So she traded her scanties
+ For sandpaper panties,
+Now they goose her much less than they used 'ter.
+%
+There was a young lady in Reno,
+Who lost all her dough playing Keno.
+ But she lay on her back,
+ And opened her crack,
+So now she owns the Casino!
+%
+There was a young lady named Alice
+Who was known to have peed in a chalice.
+ 'Twas the common belief
+ It was done for relief,
+And not out of protestant malice.
+%
+There was a young lady named Astor
+Who never let any get past her.
+ She finally got plenty
+ By stopping twenty,
+Which certainly ought to last her.
+%
+There was a young lady named Banker,
+Who slept while the ship lay at anchor,
+ She woke in dismay,
+ When she heard the mate say,
+"Now hoist up the topsheet and spanker."
+%
+There was a young lady named Blount
+Who had a rectangular cunt.
+ She learned for diversion
+ Posterior perversion,
+Since no one could fit here in front.
+%
+There was a young lady named Bower
+Who dwelt in an Ivory Tower.
+ But a poet from Perth
+ Laid her flat on the earth,
+And proceeded with penis to plough her.
+%
+There was a young lady named Brent
+With a cunt of enormous extent,
+ And so deep and so wide,
+ The acoustics inside
+Were so good you could hear when you spent.
+%
+There was a young lady named Bright
+Who could travel much faster than light.
+ She took off one day,
+ In a relative way,
+And returned on the previous night.
+%
+There was a young lady named Brook
+Who never could learn how to cook.
+ But on a divan
+ She could please any man-
+She knew every darn trick in the book!
+%
+There was a young lady named Cager
+Who, as the result of a wager,
+ Consented to fart
+ The entire oboe part
+Of Mozart's quartet in F major.
+%
+There was a young lady named Ciss
+Who said, "I think skating's a bliss"
+ But she'll never restate,
+ For a wheel off her skate
+.siht ekil gnihtemos pu hsinif reh edaM
+%
+There was a young lady named Dot
+Whose cunt was so terribly hot
+ That ten bishops of Rome
+ And the Pope's private gnome
+Failed to quench her Vesuvial twat.
+%
+There was a young lady named Duff
+With a lovely, luxuriant muff.
+ In his haste to get in her
+ One eager beginner
+Lost both of his balls in the rough.
+%
+There was a young lady named Etta
+Who was constantly seen in a swetta.
+ Three reasons she had:
+ To keep warm wasn't bad,
+But the other two reasons were betta.
+%
+There was a young lady named Fleager
+Who was terribly, terribly eager
+ To be all the rage
+ On the tragedy stage,
+Though her talents were pitifully meagre.
+ -- Edward Gorey
+%
+There was a young lady named Flo
+Whose lover had pulled out too slow.
+ So they tried it all night,
+ Till he got it just right...
+Well, practice makes pregnant, you know.
+%
+There was a young lady named Flynn
+Who thought fornication a sin,
+ But when she was tight
+ It seemed quite all right,
+So everyone filled her with gin.
+%
+There was a young lady named Gilda
+Who went on a date with a builder.
+ He said that he would,
+ And he could and he should,
+And he did and it damn well near killed her.
+%
+There was a young lady named Gloria,
+Whose boyfriend said, "May I explore ya?"
+ She replied to the chap,
+ "I'll draw you a map,
+Of where others have been to before ya."
+%
+There was a young lady named Grace
+Who would not take a prick in her "place."
+ Though she'd kiss it and suck it,
+ She never would fuck it--
+She just couldn't relax face-to-face.
+%
+There was a young lady named Hall,
+Wore a newspaper dress to a ball.
+ The dress caught on fire
+ And burned her entire
+Front page, sporting section, and all.
+%
+There was a young lady named Hatch
+Who would always come through in a scratch.
+ If a guy wouldn't neck her,
+ She'd grab up his pecker
+And shove the damn thing up her snatch.
+%
+There was a young lady named Mable
+Who liked to sprawl out on the table,
+ Then cry to her man,
+ "Stuff in all you can --
+Get your ballocks in, too, if you're able."
+%
+There was a young lady named Mandel
+Who caused quite a neighborhood scandal
+ By coming out bare
+ On the main village square
+And frigging herself with a candle.
+%
+There was a young lady named Maud,
+A terrible society fraud:
+ In company, I'm told,
+ She was distant and cold,
+But if you got her alone, Oh God!
+%
+There was a young lady named May
+Who strolled in a park by the way,
+ And she met a young man
+ Who fucked her and ran --
+Now she goes to the park every day.
+%
+There was a young lady named Nance
+Who learned about fucking in France,
+ And when you'd insert it
+ She'd squeeze till she hurt it,
+And shoved it right back in your pants.
+%
+There was a young lady named Nelly
+Whose tits would jiggle like jelly.
+ They could tickle her twat
+ Or be tied in a knot,
+And could even swat flies on her belly.
+%
+There was a young lady named Ransom
+Who was rogered three times in a hansom.
+ When she cried out for more
+ A voice from the floor
+Replied, "My name is Simpson, not Samson."
+%
+There was a young lady named Riddle
+Who had an untouchable middle.
+ She had many friends
+ Because of her ends,
+Since it isn't the middle you diddle.
+%
+There was a young lady named Rose
+Who fainted whenever she chose;
+ She did so one day
+ While playing croquet,
+But was quickly revived with a hose.
+ -- Edward Gorey
+%
+There was a young lady named Rose
+With erogenous zones in her toes.
+ She remained onanistic
+ Till a foot-fetishistic
+Young man became one of her beaux.
+%
+There was a young lady named Schneider
+Who often kept trysts with a spider.
+ She found a strange bliss,
+ In the hiss of her piss,
+As it strained through the cobwebs inside her.
+%
+There was a young lady named Smith
+Whose virtue was largely a myth.
+ She said, "Try as I can
+ I can't find a man
+Who it's fun to be virtuous with."
+%
+There was a young lady named Twiss
+Who said she thought fucking a bliss,
+ For it tickled her bum
+ And caused her to come
+.siht ekil gniyl ylbatrofmoc elihW
+%
+There was a young lady named Wylde
+Who kept herself quite undefiled
+ By thinking of Jesus;
+ Contagious diseases;
+And the bother of having a child.
+%
+There was a young lady of Arden,
+The tool of whose swain wouldn't harden.
+ Said she with a frown,
+ "I've been sadly let down
+By the tool of a fool in a garden."
+%
+There was a young lady of Bicester
+Who was nicer by far than her sister:
+ The sister would giggle
+ And wiggle and jiggle,
+But this one would come if you kissed her.
+%
+There was a young lady of Brabant
+Who slept with an impotent savant.
+ She admitted, "We shouldn't,
+ But it turned out he couldn't-
+So you can't say we have when we haven't."
+%
+There was a young lady of Bude
+Who walked down the street in the nude.
+ A bobby said, "Whattum
+ Magnificent bottom!"
+And slapped it as hard as he could.
+%
+There was a young lady of Carmia
+Whose housekeeping ways would alarm ya.
+ At every cold snap
+ She would climb in your lab,
+So her little base burner could warm ya.
+%
+There was a young lady of Dee
+Who went down to the river to pee.
+ A man in a punt
+ Put his hand on her cunt,
+And God! how I wish it were me.
+%
+There was a young lady of Dee
+Whose hymen was split into three.
+ And when she was diddled
+ The middle string fiddled:
+"Nearer My God To Thee."
+%
+There was a young lady of Dexter
+Whose husband exceedingly vexed her,
+ For whenever they'd start
+ He'd unfailingly fart
+With a blast that damn nearly unsexed her.
+%
+There was a young lady of Dover
+Whose passion was such that it drove her
+ To cry, when you came,
+ "Oh dear! What a shame!
+Well, now we shall have to start over."
+%
+There was a young lady of Ealing
+And her lover before her was kneeling.
+ Said she, "Dearest Jim,
+ Take your hands off my quim;
+I much prefer fucking to feeling."
+%
+There was a young lady of fashion
+Who had oodles and oodles of passion.
+ To her lover she said,
+ As they climbed into bed,
+"Here's one thing the bastards can't ration!"
+%
+There was a young lady of Fez
+Who was known to the public as "Jez."
+ Jezebel was her name,
+ Sucking cocks was the game
+She excelled at (so everyone says).
+%
+There was a young lady of Gaza
+Who shaved her cunt bare with a razor.
+ The crabs, in a lump,
+ Made tracks to her rump--
+This passing parade did amaze her.
+%
+There was a young lady of Gloucester,
+Met a passionate fellow who tossed her.
+ She wasn't much hurt,
+ But he dirtied her skirt,
+So think of the anguish it cost her.
+%
+There was a young lady of Gloucester
+Whose friends they thought they had lost her
+ Till they found on the grass
+ The marks of her arse,
+And the knees of the man who had crossed her.
+%
+There was a young lady of Kent,
+Who admitted she knew what it meant
+ When men asked her to dine,
+ And plied her with wine,
+She knew, oh she knew -- but she went!
+%
+There was a young lady of Lee
+Who scrambled up into a tree,
+ When she got there
+ Her arsehole was bare,
+And so was her C U N T.
+%
+There was a young lady of Lincoln
+Who said that her cunt was a pink'un,
+ So she had a prick lent her
+ Which turned it magenta,
+This artful old lady of Lincoln.
+%
+There was a young lady of Natchez
+Who chanced to be born with two snatches,
+ And she often said, "Shit!
+ Why, I'd give either tit
+For a man with equipment that matches."
+
+There was a young fellow named Locke
+Who was born with a two-headed cock.
+ When he'd fondle the thing
+ It would rise up and sing
+An antiphonal chorus by Bach.
+
+But whether these two ever met
+Has not been recorded as yet,
+ Still, it would be diverting
+ To see him inserting
+His whang while it sang a duet.
+%
+There was a young lady of Norway
+Who hung by her toes in a doorway.
+ She said to her beau
+ "Just look at me Joe
+I think I've discovered one more way."
+%
+There was a young lady of Rhyll
+In an omnibus was taken ill,
+ So she called the conductor,
+ Who got in and fucked her,
+Which did more good than a pill.
+%
+There was a young lady of Spain
+Who took down her pants on a train.
+ There was a young porter
+ Saw more than he orter,
+And asked her to do it again.
+%
+There was a young lady of Spain
+Who was fucked by a monk in a drain.
+ They did it again
+ And again and again,
+And again and again and again.
+%
+There was a young lady of Twickenham
+Who thought men had not enough prick in 'em.
+ On her knees every day
+ To God she would pray
+To lengthen and strengthen and thicken 'em.
+%
+There was a young lady of Wheeling
+Said to her beau, "I've a feeling
+ My little brown jug
+ Has need of a plug" --
+And straightaway she started to peeling.
+%
+There was a young lady who said,
+As her bridegroom got into the bed,
+ "I'm tired of this stunt,
+ That they do with one's cunt,
+You can get up my bottom instead."
+%
+There was a young lady whose cunt
+Could accommodate a small punt.
+ Her mother said, "Annie,
+ It matches your fanny,
+Which never was that of a runt."
+%
+There was a young lady whose thighs,
+When spread showed a slit of such size,
+ And so deep and so wide,
+ You could play cards inside,
+Much to her bridegroom's surprise.
+%
+There was a young lass from Surat.
+The cheeks of her ass were so fat
+ That they had to be parted
+ Whenever she farted,
+And also whenever she shat.
+%
+There was a young laundress named Wrangle
+Whose tits tilted up at an angle.
+ "They may tickle my chin,"
+ She said with a grin,
+"But at least they keep out of the mangle."
+%
+There was a young maiden from Osset
+Whose quim was nine inches across it.
+ Said a young man named Tong,
+ With tool nine inches long,
+"I'll put bugger-in if I loss it."
+%
+There was a young man from Bear Ridge
+Who had strange ideas about marriage.
+ He fucked his wife's mother
+ And sucked off her brother
+And ate up her sister's miscarriage.
+%
+There was a young man from Bel-Aire
+Who was screwing his girl on the stair.
+ But the banister broke
+ So he doubled his stroke
+And finished her off in mid-air.
+%
+There was a young man from Biloxi
+Whose bowels responded to Moxie.
+ Drinking glass after glass,
+ He would tune up his ass,
+Till he played like the band at the Roxy.
+%
+There was a young man from Bombay
+Who fashioned a cunt out of clay
+ But the heat of his prick
+ Turned it into a brick
+And rubbed all his foreskin away.
+%
+There was a young man from Calcutta
+Who was heard in his beard to mutter,
+ "If her Bartholin glands
+ Don't respond to my hands,
+I'm afraid I shall have to use butter."
+%
+There was a young man from Dallas
+Who had an exceptional phallus.
+ He couldn't find room
+ In any girl's womb
+Without rubbing it first with Vitalis.
+%
+There was a young man from Dundee
+Who buggered an ape in a tree.
+ The results were quite horrid:
+ All ass and no forehead,
+Three balls and a purple goatee.
+%
+There was a young man from East Lizes
+Whose balls were of two different sizes
+ One was so small
+ It was no ball at all
+The other was large and won prizes.
+%
+There was a young man from East Wubley
+Whose cock was bifurcated doubly.
+ Each quadruplicate shaft
+ Had two balls hanging aft,
+And the general effect was quite lovely.
+
+There was a young man from Hong Kong
+Who had a trifurcated prong:
+ A small one for sucking,
+ A large one for fucking,
+And a `boney' for beating a gong.
+%
+There was a young man from Glengozzle
+Who found a remarkable fossil.
+ He knew by the bend
+ And the wart on the end,
+'Twas the peter of Paul the Apostle.
+%
+There was a young man from Jodhpur
+Who found he could easily cure
+ His dread diabetes
+ By eating a foetus
+Served up in a sauce of manure.
+%
+There was a young man from Kent
+Whose tool was so long that it bent.
+ To save himself trouble
+ He put it in double
+And instead of coming, he went.
+%
+There was a young man from Lynn
+Whose cock was the size of a pin.
+ Said his girl with a laugh
+ As she felt his staff,
+"This won't be much of a sin."
+%
+There was a young man from Maine
+Whose prick was as strong as a crane;
+ It was almost as long,
+ So he strolled with his dong
+Extended in sunshine and rain.
+%
+There was a young man from Nantucket
+Whose cock was so long he could suck it.
+ But he looked in the glass,
+ And saw his own ass,
+And broke his neck trying to fuck it.
+%
+There was a young man from Nantucket
+Whose cock was so long he could suck it.
+ He said with a grin,
+ While wiping his chin,
+"If my ear was a cunt, I could fuck it."
+%
+There was a young man from New Haven
+Who had an affair with a raven.
+ He said with a grin
+ As he wiped off his chin,
+"Nevermore!"
+%
+There was a young man from Peru,
+Who took a long trip by canoe.
+ While staring at Venus,
+ And rubbing his penis,
+He wound up with a handful of goo.
+%
+There was a young man from Purdue
+Who was only just learning to screw,
+ But he hadn't the knack,
+ And he got too far back --
+In the right church, but in the wrong pew.
+%
+There was a young man from Racine
+Who invented a fucking machine.
+ Concave or convex,
+ It served either sex,
+But oh what a bitch to keep clean.
+%
+There was a young man from Rangoon
+Who used to lament 'neath the moon
+ That he had the luck
+ To be born of a fuck
+That was scraped off the sheets with a spoon.
+%
+There was a young man from Salinas
+Who had an extremely long penis:
+ Believe it or not,
+ When he lay on his cot
+It reached from Marin to Martinez.
+%
+There was a young man from Seattle
+Whose testicles tended to rattle.
+ He said as he fuck-ed
+ Some stones in a bucket,
+"If Stravinsky won't deafen you -- that'll."
+%
+There was a young man from Siam
+Who said, "I go in with a wham,
+ But I soon lose my starch
+ Like the mad month of March,
+And the lion comes out like a lamb."
+%
+There was a young man from St. Paul's
+Who read "Harper's Bazaar" and "McCall's"
+ Till he grew such a passion
+ For feminine fashion
+That he knitted a snood for his balls.
+%
+There was a young man from Stamboul
+Who boasted so torrid a tool
+ That each female crater
+ Explored by this satyr
+Seemed almost unpleasantly cool.
+%
+There was a young man from the Coast
+Who had an affair with a ghost.
+ At the height of orgasm
+ Said the pallid phantasm,
+"I think I can feel it -- almost!"
+%
+There was a young man from Tibet-
+And this is the strangest one yet-
+ Whose tool was so long,
+ So pointed and strong,
+He could bugger six Greeks "en brochette".
+%
+There was a young man in Havana,
+Banged his girl on a player-piana.
+ At the height of their fever
+ Her ass hit the lever
+And: yes, he has no banana.
+%
+There was a young man in Norway,
+Tried to jerk himself off in a sleigh,
+ But the air was so frigid
+ It froze his cock rigid,
+And all he could come was frappe.
+%
+There was a young man in the choir
+Whose penis rose higher and higher,
+ Till it reached such a height
+ It was quite out of sight --
+But of course you know I'm a liar.
+%
+There was a young man, name of Fred,
+Who spent every Thursday in bed;
+ He lay with his feet
+ Outside of the sheet,
+And the pillows on top of his head.
+ -- Edward Gorey
+%
+There was a young man, name of Saul,
+Who was able to bounce either ball,
+ He could stretch them and snap them,
+ And juggle and clap them,
+Which earned him the plaudits of all.
+%
+There was a young man named Crockett
+Whose balls got caught in a socket.
+ His wife was a bitch
+ So she threw the switch,
+And Crockett went off like a rocket.
+%
+There was a young man named Hughes
+Who swore off all kinds of booze.
+ He said, "When I'm muddled
+ My senses get fuddled,
+And I pass up too many screws."
+%
+There was a young man named Knute
+Who had warts all over his root.
+ He put acid on these
+ And now when he pees,
+He fingers the thing like a flute.
+%
+There was a young man named Rex
+Who really was small for his sex.
+ When tried for exposure
+ The judge's disclosure
+Was "de minimus non curat lex."
+%
+There was a young man named Zerubbabel
+Who had only one real, and one rubber ball.
+ When they asked if his pleasure
+ Was only half measure,
+He replied, "That is highly improbable."
+%
+There was a young man named Zerubbabub
+Who belonged to the Block, Fuck & Bugger Club
+ But the pride of his life
+ Were the tits of his wife --
+One real, and one India-rubber bub.
+%
+There was a young man of Arras
+Who stretched himself out on the grass,
+ And with no little trouble,
+ He bent himself double,
+And stuck his prick well up his ass.
+%
+There was a young man of Australia
+Who went on a wild bacchanalia.
+ He buggered a frog,
+ Two mice and a dog,
+And a bishop in fullest regalia.
+%
+There was a young man of Belgrade
+Who remarked, "I'm a queer piece of trade.
+ I will suck, without charge,
+ Any cock, if it's large.
+If it's small, I expect to be paid."
+%
+There was a young man of Belgrade
+Who slept with a girl in the trade.
+ She said to him, "Jack,
+ Try the hole in the back;
+The front one is badly decayed."
+%
+There was a young man of Bengal
+Who swore he had only one ball,
+ But two little bitches
+ Unbuttoned his britches,
+And found he had no balls at all.
+%
+There was a young man of Bombay
+Who buggered his dad once a day.
+ He said, "I like, rather,
+ Fucking my father --
+He's clean, and there's nothing to pay."
+%
+There was a young man of Calcutta,
+Who tried to write "cunt" on a shutter.
+ When he got to c-u,
+ A pious Hindoo
+Knocked him ass-over-head in the gutter.
+%
+There was a young man of Cape Horn
+Who wished he had never been born,
+ And he wouldn't have been
+ If his father had seen
+That the end of the rubber was torn.
+%
+There was a young man of Coblenz
+Whose ballocks were simply immense:
+ It took forty-four draymen,
+ A priest and three laymen
+To carry them thither and thence.
+%
+There was a young man of Darjeeling
+Whose cock reached up to the ceiling.
+ In the electric light socket,
+ He'd put it and rock it--
+Oh God! What a wonderful feeling!
+%
+There was a young man of Devizes,
+Whose balls were of different sizes.
+ One was so small,
+ It was nothing at all;
+The other took numerous prizes.
+%
+There was a young man of Dumfries
+Who said to his girl, "If you please,
+ It would give me great bliss
+ If, while playing with this,
+You would pay some attention to these!"
+%
+There was a young man of high station
+Who was found by a pious relation
+ Making love in a ditch
+ To -- I won't say a bitch --
+But a woman of no reputation.
+%
+There was a young man of Khartoum,
+The strength of whose balls was his doom.
+ So strong was his shootin',
+ The third law of Newton
+Propelled the poor chap to the Moon.
+%
+There was a young man of Khartoum
+Who lured a poor girl to her doom.
+ He not only fucked her,
+ But buggered and sucked her--
+And left her to pay for the room.
+%
+There was a young man of Kutki
+Who could blink himself off with one eye.
+ For a while though, he pined,
+ When his organ declined
+To function, because of a stye.
+%
+There was a young man of Lahore
+Whose prick was one inch and no more.
+ It was all right for key-holes
+ And little girl's pee-holes,
+But not worth a damn with a whore.
+%
+There was a young man of Lake Placid
+Whose prick was lethargic and flaccid.
+ When he wanted to sport
+ He would have to resort
+To injections of sulphuric acid.
+%
+There was a young man of Madras
+Whose balls were constructed of brass.
+ When jangled together
+ They played "Stormy Weather",
+And lightning shot out of his ass.
+%
+There was a young man of Missouri
+Who fucked with a terrible fury.
+ Till hauled into court
+ For his beastial sport,
+And condemned by a poorly-hung jury.
+%
+There was a young man of Natal
+And Sue was the name of his gal.
+ One day, north of Aden,
+ He got his hard rod in,
+And came clear up Suez Canal.
+%
+There was a young man of Natal
+Who was fucking a Hottentot gal.
+ Said she, "You're a sluggard!"
+ Said he, "You be buggered!
+I like to fuck slow and I shall."
+%
+There was a young man of Ostend
+Who let a girl play with his end.
+ She took hold of Rover,
+ And felt it all over,
+And it did what she didn't intend.
+%
+There was a young man of Ostend
+Whose wife caught him fucking her friend.
+ "It's no use, my duck,
+ Interrupting our fuck,
+For I'm damned if I draw till I spend."
+%
+There was a young man of Saskatchewan,
+Whose penis was truly gargantuan.
+ It was good for large whores,
+ And for small dinosaurs,
+And was rough enough to scratch a match upon.
+%
+There was a young man of Seattle
+Who bested a bull in a battle.
+ With fire and gumption
+ He assumed the bull's function,
+And deflowered a whole herd of cattle.
+%
+There was a young man of St. John's
+Who wanted to bugger the swans.
+ But the loyal hall porter
+ Said, "Pray take my daughter!
+Those birds are reserved for the dons."
+%
+There was a young man of Tibet
+-- And this is the strangest one yet --
+ His prick was so long,
+ And so pointed and strong,
+He could bugger six sheep en brochette.
+%
+There was a young man of Toulouse
+Who had a deficient prepuce,
+ But the foreskin he lacked
+ He made up in his sac;
+The result was, his balls were too loose.
+%
+There was a young man who appeared
+To his friends with a full growth of beard;
+ They at once said, "Although
+ We can't say why it's so,
+The effect is uncommonly weird."
+ -- Edward Gorey
+%
+There was a young man who said "God,
+I find it exceedingly odd,
+ That the willow oak tree
+ Continues to be,
+When there's no one about in the Quad."
+
+"Dear Sir, your astonishment's odd,
+For I'm always about in the Quad;
+ And that's why the tree,
+ Continues to be,"
+Signed "Yours faithfully, God."
+%
+There was a young man with a fiddle
+Who asked of his girl, "Do you diddle?"
+ She replied, "Yes, I do,
+ But prefer to with two --
+It's twice as much fun in the middle."
+%
+There was a young man with a prick
+Which into his wife he would stick
+ Every morning and night
+ If it stood up all right --
+Not a very remarkable trick.
+
+His wife had a nice little cunt:
+It was hairy, and soft, and in front,
+ And with this she would fuck him,
+ Though sometimes she'd suck him --
+A charming, if commonplace, stunt.
+%
+There was a young man with one foot
+Who had a very long root.
+ If he used this peg
+ As an extra leg
+Is a question exceedingly moot.
+%
+There was a young miss from Johore
+Who'd lie on a mat on the floor;
+ In a manner uncanny
+ She'd wobble her fanny,
+And drain your nuts dry to the core.
+%
+There was a young monk from Siberia
+Whose life got drearia' and drearia'
+ Till he did to a nun
+ What shouldn't be done
+And made her a mother superia'.
+%
+There was a young monk from Tibet
+And this is the damnedest one yet
+ His cock was so long
+ And incredibly strong
+That he buggered six Greeks en brochette.
+%
+There was a young monk in Siberia,
+Whose morals were very inferior,
+ He jumped on a nun
+ Which he shouldn't have done,
+And now she's a Mother Superior.
+%
+There was a young monk of Dundee
+Who complained that it hurt him to pee,
+ He said, "Pax vobiscum,
+ Now why won't the piss come?
+I'm afraid I've the c-l-a-p."
+%
+There was a young parson of Harwich,
+Tried to grind his betrothed in a carriage.
+ She said, "No, you young goose,
+ Just try self-abuse.
+And the other we'll try after marriage."
+%
+There was a young peasant named Gorse
+Who fell madly in love with his horse.
+ Said his wife, "You rapscallion,
+ That horse is a stallion --
+This constitutes grounds for divorce."
+%
+There was a young person of Kent
+Who was famous wherever he went.
+ All the way through a fuck,
+ He would quack like a duck,
+And he crowed like a cock when he spent.
+%
+There was a young physicist named Fisk
+Whose lovemaking was rather brisk.
+ So quick was his action,
+ The Lorentz Contraction
+Shortened his rod to a disc!
+%
+There was a young plumber named Lee
+Who was plumbing his girl by the sea.
+ She said, "Stop your plumbing,
+ There's somebody coming"
+Said the plumber, still plumbing, "It's me."
+%
+There was a young poet named Dan,
+Whose poetry never would scan.
+ When told this was so,
+ He said, "Yes, I know,
+It's because I try to put every possible syllable into that last line that I can."
+%
+There was a young royal marine,
+Who tried to fart "God Save the Queen".
+ When he reached the soprano
+ Out came only guano
+And his britches weren't fit to be seen.
+%
+There was a young sailor from Brighton,
+Who remarked to his girl, "You're a tight one."
+ She replied, "'Pon my soul,
+ You're in the wrong hole;
+There's plenty of room in the right one."
+%
+There was a young sapphic named Anna
+Who stuffed her friend's cunt with banana,
+ Which she sucked, bit by bit,
+ From her partner's warm slit,
+In the most approved lesbian manner.
+%
+There was a young Scot in Madrid
+Who got fifty-five fucks for a quid.
+ When they said, "Are you faint?"
+ He replied, "No, I ain't,
+But I don't feel as good as I did."
+%
+There was a young soldier from Munich
+Whose penis hung down past his tunic,
+ And their chops girls would lick
+ When they thought of his prick,
+But alas! he was only a eunuch.
+%
+There was a young sportsman named Peel
+Who went for a trip on his wheel;
+ He pedaled for days
+ Through crepuscular haze,
+And returned feeling somewhat unreal.
+ -- Edward Gorey
+%
+There was a young squaw of Wohunt
+Who possessed a collapsible cunt.
+ It had many odd uses,
+ Produced no papooses,
+And fitted both giant and runt.
+%
+There was a young student from Yale
+Who was getting his first piece of tail.
+ He shoved in his pole,
+ But in the wrong hole,
+And a voice from beneath yelled: "No sale!"
+%
+There was a young trollop at Yale,
+Who had verses tattooed on her tail,
+ And on her behind,
+ For the sake of the blind,
+A duplicate version in Braille.
+%
+There was a young woman called Pearl
+Who quite resembled a churl;
+ When she asked a young man named Tex
+ Whether he would like to have sex,
+"Certainly," quoth he, "Who's the girl?"
+%
+There was a young woman from Bude,
+Who went for a swim in the nude,
+ But a man in a punt,
+ Grabbed at her elbow,
+And said "Hey, lady, you can't swim here, it's private property."
+%
+There was a young woman in Dee
+Who stayed with each man she did see.
+ When it came to a test
+ She wished to be best,
+And practice makes perfect, you see.
+%
+There was a young woman named Alice
+Who peed in a Catholic chalice.
+ She said, "I do this
+ From a great need to piss,
+And not from sectarian malice."
+%
+There was a young woman named Ells
+Who was subject to curious spells
+ When got up very oddly,
+ She'd cry out things ungodly
+by the palms in expensive hotels.
+ -- Edward Gorey
+%
+There was a young woman named Florence
+Who for fucking professed an abhorrence,
+ But they found her in bed
+ With her cunt flaming red,
+And her poodle-dog spending in torrents.
+%
+There was a young woman named Plunnery
+Who rejoiced in the practice of gunnery.
+ Till one day unobservant,
+ She blew up a servant,
+And was forced to retire to a nunnery.
+ -- Edward Gorey
+%
+There was a young woman named Sutton
+Who said, as she carved up the mutton,
+ "My father preferred
+ The last sheep in the herd --
+This is one of his children I'm cuttin'."
+%
+There was a young woman of Cheadle,
+Who once gave the clap to a beadle.
+ Said she, "Does it itch?"
+ "It does, you damned bitch,
+And it burns like hell-fire when I peedle."
+%
+There was a young woman of Condover
+Whose husband had ceased to be fond of 'er.
+ Her pussy was juicy,
+ Her arse soft and goosey,
+But peroxide had now made a blonde of 'er.
+%
+There was a young woman of Croft
+Who played with herself in a loft,
+ Having reasoned that candles
+ Could never cause scandals,
+Besides which they did not go soft.
+
+Said another young woman of Croft,
+Amusing herself in the loft,
+ "A salami or wurst
+ Is what I'd choose first --
+With bologna you know you've been boffed."
+%
+There was a young woman, quite handsome,
+Who got stuck in a sleeping room transom.
+ When she offered much gold
+ For release, she was told
+That the view was worth more than the ransom.
+%
+There was a young woman whose stammer
+Was atrocious, and so was her grammar;
+ But they were not improved
+ When her husband was moved
+To knock out her teeth with a hammer.
+ -- Edward Gorey
+%
+There was an old abbess quite shocked
+To find nuns where the candles were locked.
+ Said the abbess, "You nuns
+ Should behave more like guns,
+And never go off till you're cocked."
+%
+There was an old bishop from Buckingham
+Who fell in love with some oysters while shucking 'em.
+ His wife with distain
+ Could scarcely restrain
+That sprightly old bishop from * * *.
+%
+There was an old count of Swoboda
+Who would not pay a whore what he owed her.
+ So, with great savoir-faire,
+ She stood on a chair
+And pissed in his whiskey-and-soda.
+%
+There was an old curate of Hestion
+Who'd erect at the slightest suggestion.
+ But so small was his tool
+ He could scarce screw a spool,
+And a cunt was quite out of the question.
+%
+There was an old fellow named Art
+Who awoke with a horrible start,
+ For down by his rump
+ Was a generous lump
+Of what should have been just a fart.
+%
+There was an old fellow named Skinner
+Whose prick, his wife said, had grown thinner.
+ But still, by and large,
+ It would always discharge
+Once he could just get it in her.
+%
+There was an old feminine blighter
+Who trained a Chow dog to delight her.
+ She would cream her own pool
+ While she sucked off his tool --
+How his cock in her cunt would excite her!
+%
+There was an old gent from Kentuck
+Who boasted a filigreed schmuck,
+ But he put it away
+ For fear that one day
+He might put it in and get stuck.
+%
+There was an old girl of Kilkenny
+Whose usual charge was a penny.
+ For half of that sum
+ You could finger her bum--
+A source of amusement to many.
+%
+There was an old harlot from Dijon
+Who in her old age got religion.
+ "When I'm dead & gone,"
+ Said she, "I'll take on
+The Father, the Son, and the Pigeon."
+%
+There was an old lady of Bingly
+Who wailed, "I do hate to sleep singly.
+ I thought I had got
+ A bloke for my twat,
+But he seems rather queenly than kingly."
+%
+There was an old lady of Glascow,
+Whose party proved quite a fiasco.
+ At nine-thirty, about,
+ The lights all went out,
+Through a lapse on the part of the Gas Co.
+%
+There was an old lady of Kewry
+Whose cunt was a `lusus naturae':
+ The `introitus vaginae',
+ Was unnaturally tiny,
+And the thought of it filled her with fury.
+%
+There was an old lady who lay
+With her legs wide apart in the hay,
+ Then, calling the ploughman,
+ She said, "Do it now, man!
+Don't wait till your hair has turned gray."
+%
+There was an old maid from Cape Cod
+Who thought all good things came from god.
+ But it wasn't the almighty
+ Who lifted her nighty,
+It was Roger, the lodger, by god.
+%
+There was an old man from Bengal
+Who liked to do tricks in the hall.
+ His favorite trick
+ Was to stand on his dick
+While he rolled around on one ball.
+%
+There was an old man from Fort Drum
+Whose son was incredibly dumb.
+ When he urged him ahead,
+ He went down instead,
+For he thought to succeed meant succumb.
+%
+There was an old man of Alsace
+Who played the trombone with his ass.
+ He put in a trap
+ To take out the crap,
+But the vapors corroded the brass.
+%
+There was an old man of Brienz
+The length of whose cock was immense:
+ With one swerve he could plug
+ A boy's bottom in Zug,
+And a kitchen-maid's cunt in Coblenz.
+%
+There was an old man of Cajon
+Who never could get a good bone.
+ With the aid of a gland
+ It grew simply grand;
+Now his wife cannot leave it alone.
+%
+There was an old man of Calcutta
+Who spied through a chink in the shutter.
+ But all he could see
+ Was his wife's bare knee,
+And the back of the bloke who was up her.
+%
+There was an old man of Connaught
+Whose prick was remarkably short.
+ When he got into bed,
+ The old woman said,
+"This isn't a prick, it's a wart."
+%
+There was an old man of Duddee
+Who came home as drunk as could be.
+ He wound up the clock
+ With the end of his cock,
+And buggered his wife with the key.
+%
+There was an old man of Duluth
+Whose cock was shot off in his youth.
+ He fucked with his nose
+ And with fingers and toes,
+And he came through a hole in his tooth.
+%
+There was an old man of Hong Kong
+Who never did anything wrong.
+ He would lie on his back
+ With his head in a sack
+And secretly finger his dong.
+%
+There was an old man of St. Bees,
+Who was stung in the arm by a wasp.
+ When asked, "Does it hurt?"
+ He replied, "No, it doesn't.
+I'm so glad that it wasn't a hornet."
+ -- W. S. Gilbert
+%
+There was an old man of Tagore
+Whose tool was a yard long or more,
+ So he wore the damn thing
+ In a surgical sling
+To keep it from wiping the floor.
+%
+There was an Old Man of the Mountain
+Who frigged himself into a fountain
+ Fifteen times had he spent,
+ Still he wasn't content,
+He simply got tired of the counting.
+%
+There was an old man who said, "Tush!
+My balls always hang in the brush,
+ And I fumble about,
+ Half in and half out,
+With a pecker as limber as mush."
+%
+There was an old man with a beard
+Who said, "It is just what I feared!
+ Two owls and a hen,
+ Four larks and a wren
+Have all built their nests in my beard!"
+%
+There was an old person of Ware
+Who had an affair with a bear.
+ He explained, "I don't mind,
+ For it's gentle and kind,
+But I wish it had slightly less hair."
+%
+There was an old pirate named Bates
+Who was learning to rhumba on skates
+ He fell on his cutlass
+ Which rendered him nutless
+And practically useless on dates.
+%
+There was an old satyr named Mack
+Whose prick had a left handed tack.
+ If the ladies he loves
+ Don't spin when he shoves,
+Their cervixes frequently crack.
+%
+There was an old Scot named McTavish
+Who attempted an anthropoid ravish.
+ The object of rape
+ Was the wrong sex of ape,
+And the anthropoid ravished McTavish.
+%
+There was an old whore from Silesia
+Who'd croak: "If my box doesn't please ya,
+ For a slight extra sum
+ You can go up my bum
+But watchout or my tapeworm'll seize ya."
+%
+There was an old whore in the Azores
+Whose body was covered with festers & sores.
+ Why the dogs in the street
+ Wouldn't eat the green meat
+That hung in festoons from her drawers.
+%
+There was an old woman of Ghent
+Who swore that her cunt had no scent.
+ She got fucked so often
+ At last she got rotten,
+And didn't she stink when she spent.
+%
+There was once a mechanic named Bench
+Whose best tool was a sturdy gut-wrench.
+ With this vibrant device
+ He could reach, in a trice,
+The innermost parts of a wench.
+%
+There were three ladies of Huxham,
+And whenever we meets 'em we fucks 'em,
+ And when that game grows stale
+ We sits on a rail,
+And pulls out our pricks and they sucks 'em.
+%
+There were three young ladies of Birmingham,
+And this is the scandal concerning 'em.
+ They lifted the frock
+ And tickled the cock
+Of the Bishop engaged in confirming 'em.
+
+Now, the Bishop was nobody's fool,
+He'd been to a good public school,
+ So he took down their britches
+ And buggered those bitches
+With his ten-inch episcopal tool.
+
+Then up spoke a lady from Kew,
+And said, as the Bishop withdrew,
+ "The vicar is quicker
+ And thicker and slicker,
+And longer and stronger than you."
+ -- Abuses of the Clergy
+%
+There's a charming young girl in Tobruk
+Who refers to her quiff as a nook.
+ It's deep and it's wide,
+ -- You can curl up inside
+With a nice easy chair and a book.
+%
+There's a charming young lady named Beaulieu
+Who's often been screwed by yours truly,
+ But now--it's appallin'--
+ My balls always fall in!
+I fear that I've fucked her unduly.
+%
+There's a dowager near Sweden Landing
+Whose manners are odd and demanding.
+ It's one of her jests
+ To suck off her guests --
+She hates to keep gentlemen standing.
+%
+There's a lovely young lady named Shittlecock
+Who loves to play diddle and fiddle-cock,
+ But her cunt's got a pucker
+ That's best not to fuck, or
+When least you expect it to, it'll lock.
+%
+There's a rather odd couple in Herts
+Who are cousins (or so each asserts);
+ Their sex is in doubt
+ For they're never without
+Their moustaches and long, trailing skirts.
+ -- Edward Gorey
+%
+There's a sports-minded coed named Sue,
+Who's been coxing the varsity crew.
+ In the shell Sue is great,
+ But her boyfriend's irate,
+When she calls out the stroke as they screw.
+%
+There's a tavern in London that's staffed,
+By a barmaid who's tops at her craft:
+ In her striving to please,
+ She serves ale on her knees,
+So the patrons get head with their draft.
+%
+There's a very hot babe at the Aggies
+Who's to men what to bulls a red rag is.
+ The seniors go round
+ Hanging down to the ground,
+And one extra-large Soph has to drag his.
+%
+There's a vicar who's classed as nefarious,
+Since his shocking perversions are various...
+ He will bugger some lad
+ With a dildo (the cad!)
+While exulting, "My pleasure's vicarious!"
+%
+There's a young Yiddish slut with two cunts,
+Whose pleasure in life is to pruntz.
+ When one pireg is shot,
+ There's that alternate twat,
+But the ausgefuckt male merely grunts.
+%
+There's an oversexed lady named Whyte
+Who insists on a dozen a night.
+ A fellow named Cheddar
+ Had the brashness to wed her-
+His chance of survival is slight.
+%
+There's an unbroken babe from Toronto,
+Exceedingly hard to get onto,
+ But when you get there,
+ And have parted the hair,
+You can fuck her as much as you want to.
+%
+They had come in the fugue to the stretto
+When a dark, bearded man from a ghetto
+ Slipped forward and grabbed
+ Her tresses and stabbed
+Her to death with a rusty stiletto.
+ -- Edward Gorey
+%
+Though his plan, when he gave her a buzz,
+Was to do what man normally does,
+ She declared, "I'm a Soul-
+ Not a sexual goal!"
+So he shrugged and called someone who was.
+%
+Though most of the crewmen are whites,
+Uhura has full equal rights.
+ Her crewmates, you see,
+ Love De-mo-cra-cy,
+And the way that she fills out her tights.
+%
+Though the invalid Saint of Brac
+Lay all of his life on his back,
+ His wife got her share,
+ And the pilgrims now stare
+At the scene, in his shrine, on a plaque.
+%
+'Tis a custom in Castellamare
+To fuck in the back of a lorry.
+ The chassis and springs
+ Are like woodwinds and strings
+In the midst of a musical soiree.
+%
+To a weepy young woman in Thrums
+Her betrothed remarked, "This is what comes
+ Of allowing your tears
+ To fall into my ears -
+I think they have rotted the drums."
+ -- Edward Gorey
+%
+To bear offspring, Noah's snakes were unable.
+Their fertility was somewhat unstable.
+ He constructed a bed
+ Out of tree trunks and said,
+"Even adders can multiply on a log table."
+%
+To his bride a young bridegroom said, "Pish!
+Your cunt is as big as a dish!"
+ She replied, "Why, you fool,
+ With your limp little tool
+It's like driving a nail with a fish!"
+%
+To his bride said a numskull named Clarence:
+"I trust you will show some forbearance.
+ My sexual habits
+ I picked up from rabbits,
+And occasionally watching my parents."
+%
+To his bride said economist Fife:
+"The semen you'll launch as my wife,
+ We will salvage and freeze
+ To resemble goat's cheese,
+And slice for hors d'oeuvres with a knife."
+%
+To his bride, said the sharp eyed detective,
+"Can it be that my eyesight's defective?
+ Is your east tit the least bit
+ The best of your west tit,
+Or is it a trick of perspective?"
+%
+To his clubfooted child said Lord Stipple,
+As he poured his post-prandial tipple,
+ "Your mother's behaviour
+ Gave pain to Our Saviour,
+And that's why He made you a cripple."
+ -- Edward Gorey
+%
+Two anglers were fishing off Wight
+And his bobber was dipping all night.
+ Murmured she, with a laugh,
+ "It's ready to gaff,
+But don't break your rod which is light."
+
+A couple was fishing near Clombe
+When the maid began looking quite glum,
+ And said, "Bother the fish!
+ I'd rather coish!"
+Which they did -- which was why they had come.
+
+As two consular clerks in Madras
+Fished, hidden in deep shore-grass,
+ "What a marvelous pole,"
+ Said she, "but control
+Your sinkers -- they're banging my ass."
+%
+Two eager young men from Cawnpore
+Once buggered and fucked the same whore.
+ But her partition split
+ And the blood and the shit
+Rolled out in a mess on the floor.
+%
+Two roosters in one of our pens
+Found their pricks were no larger than wens.
+ As they looked at their foreskins
+ And wished they had more skins,
+They discovered they'd both become hens.
+%
+Under the spreading chestnut tree
+The village smith he sat,
+ Amusing himself
+ By abusing himself
+And catching the load in his hat.
+%
+Une joile epousetta a Tours
+Voulait de gig-gig tous le jours.
+ Mais le mari disait, "Non!
+ De trop n'est pas bon!
+Mon derriere exige du secours!"
+%
+Visas erat: huic geminarum
+Dispar modus testicularum:
+ Minor haec nihili,
+ Palma triplici,
+Jam fecerat altera clarum.
+%
+We dedicate this to the cunt,
+The kind the broad-minded guys hunt:
+ All hail to the twat,
+ Willing, thrilling, and hot,
+That wears peckers down, limp and blunt!
+%
+When I was a baby, my penis
+Was as white as the buttocks of Venus.
+ But now 'tis as red
+ As her nipples instead--
+All because of the feminine genus!
+%
+When they asked a pert baggage name Alice,
+Who'd been bedded and banged in the palace,
+ "Was he modest or vain?"
+ "Was he regal or plain?"
+She replied, "He's a jolly good phallus!"
+%
+When you fuck little Annie in Anza
+You get a great bosom bonanza:
+ Sucking Annie's soft tits
+ Makes her throw fifty fits,
+And the fuck is a sextravaganza!
+%
+While his duchess lay practically dead,
+The Duke of Daguerrodargue said:
+ "Can it be this is all?
+ How puny! How small!
+Have destroyed this disgrace to my bed."
+ -- Edward Gorey
+%
+While I, with my usual enthusiasm,
+Was exploring in Ermintrude's busiasm,
+ She explained, "They are flat,
+ But think nothing of that --
+You will find that my sweet sister Susiasm."
+%
+While out on a date in his Fiat,
+The man exclaimed "Where's my key at?"
+ As he bent down to seek,
+ She let out a shriek:
+"That's not where it's likely to be at."
+%
+While spending the winter at Pau
+Lady Pamela forgot to say "No."
+ So the head-porter made her
+ And the second-cook laid her;
+The waiters were all hanging low.
+%
+While Titian was mixing rose madder,
+His model reclined on a ladder.
+ Her position to Titian
+ Suggested coition,
+So he leapt up the ladder and had 'er.
+%
+While traveling in farthest Tibet,
+Lord Irongate found cause to regret
+ The buttered-up tea,
+ A pain in his knee,
+And the frivolous tourists he met.
+ -- Edward Gorey
+%
+Winter is here with his grouch,
+The time when you sneeze and you slouch.
+ You can't take your women
+ Canoein' or swimmin',
+But a lot can be done on a couch.
+%
+With his penis in turgid erection,
+And aimed at woman's mid-section,
+ Man looks most uncouth
+ In that Moment of Truth,
+But she sheathes it with loving affection.
+%
+You Women's Lib gals won't agree,
+But dependent on men you must be:
+ You'll need a him
+ With a rod firm and trim,
+To puggle your water-drains free!
+%
+Young Frederick the great was a beaut.
+To a guard he cried, "Hey, man, you're cute.
+ If you'll come to my palace,
+ I'll finger your phallus,
+And then I shall blow on your flute."
+%
+You've heard of the bishop of Birmingham,
+Well, here's the new story concerning 'im:
+ He buggers the choir
+ As they sing "Ave Maria,"
+And fucks all the girls whilst confirming 'em.
+%
diff --git a/usr.bin/fortune/datfiles/limerick.sp.ok b/usr.bin/fortune/datfiles/limerick.sp.ok
new file mode 100644
index 0000000..be7135d
--- /dev/null
+++ b/usr.bin/fortune/datfiles/limerick.sp.ok
@@ -0,0 +1,462 @@
+# $FreeBSD$
+abbess's
+Abercrombie
+Aberystwyth
+acrost
+Aden
+Ades
+Alsace
+altera
+Amphigorey
+anatomies
+andantes
+Annie's
+Annista
+Antigua
+Anza
+Apres
+archeologist
+Arden
+ARPAnaut
+arsehole
+astonishment's
+Asturias
+Attila
+ausgefuckt
+Azores
+backsides
+ballocks
+Baroda
+Bartholin
+Batonger
+Baugh
+Bavel
+beabrve
+Beaconsfield
+beastial
+Beaulieu
+Beever
+belican
+Benares
+Bergere
+Bermuder
+berserkly
+bettera
+Bicester
+Bingly
+Bloch
+Blott
+Blount
+Bluth
+boffed
+bologna
+Bonaire
+boney
+Breerley
+bridegroom's
+Brienz
+Brighton
+Brillo
+brio
+Bronix
+Bruckner
+Bruges
+Buckingham
+Bude
+bull's
+busiasm
+bustles
+Byrd
+Cah'lina
+Cajon
+callgirl
+Camyre
+cannie
+Carmia
+Carranza's
+Carruthers
+Castellamare
+Cawnpore
+cervixes
+chanties
+Charteris
+Cheadle
+Cheddar
+Chichester
+Chichester's
+circumsized
+Ciss
+clarum
+clergyman's
+Clews
+Clombe
+Coblenz
+cocksucking
+coish
+Condover
+coxing
+Coxsaxie
+creame
+Crewe
+crewmates
+Cribbs
+crusader's
+curat
+d'hotel
+d'Isere
+d'oeuvres
+Daguerrodargue
+Decatur
+deflowered
+deflowers
+Detroit
+detumesced
+Devizes
+Dieu
+dillie
+disait
+Dispar
+dooflicker
+doric
+Drambuie
+draymen
+dribblings
+Drumrig
+duck's
+Duddee
+Dumfries
+Dundee
+Dunoon
+duply
+Durand
+Durcan
+Ealing
+eastertide
+edaM
+eighths
+ekil
+elihW
+Ells
+epousetta
+erat
+Ermintrude's
+Eroticon
+ESC
+Esser
+Eton
+exige
+eyesight's
+Fabia
+faggot
+faire
+fanny
+fart
+farta
+farted
+farter
+farting
+farts
+fecerat
+Feeney
+fellatrix
+fellatrix's
+Fenner
+Fennis
+festooned
+festoons
+fidgital
+fiesty
+Fleager
+floozie
+Folies
+foreskins
+Forgeteth
+Fornier
+frigged
+frigger
+frigging
+fritz
+fuckener
+fucking'em
+Fuckoscope
+fuckstress
+fuddled
+Fyfe
+Gamahuchee
+Gasted
+gaucho
+gawked
+Gaza
+geminarum
+Glengozzle
+gnihtemos
+gniyl
+Gomorrah
+goosey
+gooster
+Gorey
+Gratian
+Gression
+guerre
+Hank's
+Harper's
+Harwich
+helican
+Herridge
+Herts
+Hestion
+hetera
+Heuser
+hexahedronical
+hexed
+hsinif
+huic
+Huxham
+Hyde
+hymen's
+Ickes
+Ignatious
+iguanas
+IIE
+Illiac
+intacto
+interflex
+Irongate
+itchez
+jello
+Jodhpur
+Johore
+joile
+Kew
+Kewry
+Khartoum
+Kiam
+Kilkenny
+Kimble
+Kissen
+Kornbluth
+Kotex
+Kroll
+Kutki
+lacklustre
+Lahore
+Lancelot
+laundress
+Leeds
+Lefebrve
+Lesbian's
+lifesavers
+lilly
+Lizes
+llamas
+Llanfairpwllgwyngyll
+LLewellyn
+Longet
+looky
+Lorentz
+lovemaking
+Lowe
+LSD
+Luntz
+lusus
+Mable
+MacDougall
+Magnifique
+Mais
+Maitre
+Mam'selle
+Manchukuo
+Mandel
+Manhasset
+mari
+Maurier
+maxi
+Mayence
+McAmeter
+McFee
+Mcgoffin
+McGru
+McGruder
+McMeanus
+McSweeny
+McTavish
+meanie
+meanies
+meany
+Mensa
+mentis
+midgets
+minimis
+missin
+misspent
+Moebius
+moi
+moister
+mole's
+Mons
+Moxie
+muckener
+n'est
+Natches
+naturae
+navel's
+Nemetia
+nighty
+nihili
+niners
+Noah's
+Norte
+nuki
+nutless
+O'Clare
+O'Doole
+O'Malley
+obbligatos
+octagenerian
+organed
+orter
+Ostend
+oversexed
+Paloma
+papooses
+paree
+Parridge
+patchez
+pecker's
+peckers
+peedle
+peeholes
+peenies
+pees
+Penzance
+pink'un
+pissin
+Pitlochry
+Pitts
+plaudits
+pleasure's
+ploughman
+Plunnery
+port's
+Pourtant
+Priam
+Pridgets
+prodigical
+pruntz
+Pryne
+Prynne
+Quaffed
+Quelle
+question's
+quibblings
+quim
+quimmy
+quints
+ravished
+Reims
+Resounded
+retriebrve
+Rhyll
+rogered
+Salinas
+Sandem
+savoir
+Schmitz
+scratchez
+seatbelts
+secours
+secret's
+sextravaganza
+Shedd
+shins
+Shittlecock
+shitty
+shootin
+shrewder
+Siegel
+siht
+skating's
+Slatey
+Smokey
+sneaux
+sniffin
+sophomore'd
+spaceman
+spikey
+Spitzbergen
+Sprotic
+Spyder
+Stamboul
+Stillson
+Streator
+Strensall
+strewed
+stroda
+Suki
+Susiasm
+Sweenies
+Swoboda
+T'was
+Tagore
+Tante
+tapeworm'll
+Terminus's
+testicularum
+thing's
+Thrace
+Thrums
+Tiffan
+tis
+titted
+titties
+Tobruk
+tooty
+topsheet
+tous
+Trans
+Trasket
+trifurcated
+triplici
+trop
+truckloads
+trysts
+Tunney
+Tupper
+Tupps
+Twickenham
+Twiss
+Twould
+Udgeon
+Uhura
+urgin's
+Usenetter
+vaginae
+vaginoid
+Vassar
+Venerio
+Ventry
+verkeley
+Vesuvial
+Virginny
+virgo
+Vitalis
+vobiscum
+Vogel's
+Voulait
+wanna
+Weaveth
+weeney
+Whatam
+Whyte
+Wimley
+Wohunt
+Wubley
+Wylde
+ylbatrofmoc
+yontiff
+Yoric
+Yost
+yourselfer
+Zerubbabel
+Zerubbabub
+Zug
diff --git a/usr.bin/fortune/datfiles/murphy b/usr.bin/fortune/datfiles/murphy
new file mode 100644
index 0000000..949d944
--- /dev/null
+++ b/usr.bin/fortune/datfiles/murphy
@@ -0,0 +1,2212 @@
+%%$FreeBSD$
+%
+(1) Anyone can make a decision given enough facts.
+(2) A good manager can make a decision without enough
+ facts.
+(3) A perfect manager can operate in perfect ignorance.
+%
+(1) Everything depends.
+(2) Nothing is always.
+(3) Everything is sometimes.
+%
+(1) Everything is a system.
+(2) Everything is part of a larger system.
+(3) The universe is infinitely systematized both upward
+ (larger systems) and downward (smaller systems).
+(4) All systems are infinitely complex. (The illusion
+ of simplicity comes from focusing attention on
+ one or a few variables).
+%
+(1) If it's green or it wiggles, it's biology.
+(2) If it stinks, it's chemistry.
+(3) If it doesn't work, it's physics.
+%
+(1) If the weather is extremely bad, church
+ attendance will be down.
+(2) If the weather is extremely good, church
+ attendance will be down.
+(3) If the bulletin covers are in short supply
+ church attendance will exceed all expectations.
+%
+(1) If you like it, they don't have it in your size.
+(2) If you like it and it's in your size, it doesn't
+ fit anyway.
+(4) If you like it and it fits, you can't afford it.
+(5) If you like it, it fits and you can afford it, it
+ falls apart the first time you wear it.
+%
+(1) Never draw what you can copy.
+(2) Never copy what you can trace.
+(3) Never trace what you can cut out and paste down.
+%
+(1) The telephone will ring when you are outside the
+ door, fumbling for your keys.
+
+(2) You will reach it just in time to hear the click
+ of the caller hanging up.
+%
+1) Things will get worse before they get better.
+2) Who said things would get better?
+%
+80% of the final exam will be based on the one lecture
+you missed about the one book you didn't read.
+%
+90% of everything is crud.
+%
+A $300.00 picture tube will protect a 10c fuse by blowing
+first.
+%
+A 60-day warranty guarantees that the product will
+self-destruct on the 61st day.
+%
+A bird in hand is safer than one overhead.
+%
+A bird in the hand is dead.
+%
+A budget is a plan that falls apart when the plumber
+has to make an emergency visit.
+%
+A budget is buying a dress two sizes too small because
+it was marked down.
+%
+A budget is saving quarters in a mason jar for
+Christmas and spending them by Easter.
+%
+A budget is spending $15.00 on gas to drive to a
+shopping mall to save $4.30 on a 20 pound turkey.
+%
+A budget is trying to figure out how the family next
+door is doing it.
+%
+A budget is trying to make $25.00 go as far today as
+it did when you were first married.
+%
+A budget is wondering why you should balance yours
+if the government can not balance theirs.
+%
+A car and a truck approaching each other on an otherwise
+deserted road will meet at the narrow bridge.
+%
+A carelessly planned project will take three times
+longer than expected; a carefully planned project will
+take only twice as long.
+%
+A child will not spill on a dirty floor.
+%
+A closed mouth gathers no foot.
+%
+A complex system designed from scratch never works and
+cannot be patched up to make it work. You have to start
+over, beginning with a working simple system.
+%
+A complex system that works is invariably found to have
+evolved from a simple system that works.
+%
+A conclusion is the place where you got tired of thinking.
+%
+A consultant is an ordinary person a long way from home.
+%
+A coup that is known in advance is a coup that does not
+take place.
+%
+A crisis is when you can't say "let's forget the
+whole thing".
+%
+A day without sunshine ....
+is like ... night!
+%
+A disagreeable task is its own reward.
+%
+A drug is that substance which, when injected into a
+rat, will produce a scientific report.
+%
+A fail-safe circuit will destroy others.
+ -- Klipstein
+%
+A fool and his money are invited places.
+%
+A fool and his money soon go partying.
+%
+A fool and your money are soon partners.
+%
+A free agent is anything but.
+%
+A hug is the perfect gift - one size fits all, and
+nobody minds if you exchange it.
+%
+A large system, produced by expanding the dimensions of
+a smaller system, does not behave like the smaller system.
+%
+A little ambiguity never hurt anyone.
+%
+A little humility is arrogance.
+%
+A little ignorance can go a long way.
+%
+A lot of what appears to be progress is just so much
+technological roccoco.
+%
+A man of quality does not fear a woman seeking equality.
+%
+A man should be greater than some of his parts.
+%
+A mediocre player will sink to the level of his or
+her opposition.
+%
+A meeting is an event at which the minutes are kept
+and the hours are lost.
+%
+A pat on the back is only a few inches from a kick
+in the pants.
+%
+A penny saved is ... not much.
+%
+A pessimist is an optimist with experience.
+%
+A physician's ability is inversely proportional
+to his availability.
+%
+A prerequisite for a desired course will be offered
+only during the semester following the desired course.
+%
+A president of a democracy is a man who is always ready,
+willing, and able to lay down your life for his country.
+%
+A RACF protected dataset is inaccessible.
+%
+A short cut is the longest distance between two points.
+%
+A shy, introverted child will choose a crowded public
+area to loudly demonstrate newly acquired vocabulary.
+%
+A stagnant science is at a standstill.
+%
+A theory is better than its explanation.
+%
+A work project expands to fill the space available.
+%
+Absolutely nothing in the world is friendlier than
+a wet dog.
+%
+Access holes will be 1/2" too small.
+Holes that are the right size will be in the wrong place.
+%
+ACF2 is a four letter word.
+%
+Adding manpower to a late software product makes it later.
+%
+After all is said and done, a hell of a lot more is said
+than done
+%
+After things have gone from bad to worse, the cycle
+will repeat itself.
+%
+After winning an argument with his wife,
+the wisest thing a man can do is apologize.
+%
+All American cars are basically Chevrolets.
+%
+All breakdowns occur on the plumber's day off.
+%
+All general statements are false. (Think about it.)
+%
+All good things must come to an end.
+I want to know when they start!
+%
+All things being equal, all things are never equal.
+%
+All things being equal, you lose.
+
+All things being in your favor, you still lose.
+
+Win or lose, you lose.
+%
+All things come to him whose name is on a mailing list.
+%
+All trails have more uphill sections than they have
+level or downhill sections.
+%
+All warranties expire upon payment of invoice.
+%
+Almost anything is easier to get into than out of.
+%
+Among economists, the real world is often a special case.
+%
+An alcoholic is a person who drinks more than his
+own physician.
+%
+An auditor enters the battlefield after the war is over,
+and attacks the wounded.
+%
+An easily-understood, workable falsehood is more useful
+than a complex, incomprehensible truth.
+%
+An expert doesn't know any more than you do. He or she is
+merely better organized and uses slides.
+%
+An expert is anyone from out of town.
+%
+An expert is one who knows more and more about less
+and less until he knows absolutely everything
+about nothing.
+%
+An optimist believes we live in the best of all
+possible worlds.
+A pessimist fears this is true.
+%
+An optimist is a person who looks forward to marriage.
+A pessimist is a married optimist!
+%
+An original idea can never emerge from committee
+in its original form.
+%
+An ounce of application is worth a ton of abstraction.
+%
+An unbreakable toy is useful for breaking other toys.
+%
+Any child who chatters non-stop at home will adamantly
+refuse to utter a word when requested to demonstrate
+for an audience.
+%
+Any circuit design must contain at least one part which
+is obsolete, two parts which are unobtainable and three
+parts which at still under development.
+%
+Any cooking utensil placed in the dishwasher will be
+needed immediately thereafter for something else.
+%
+Any given program costs more and takes longer.
+%
+Any given program, when running, is obsolete.
+%
+Any given program will expand to fill all available memory.
+%
+Any improbable event which would create maximum confusion
+if it did occur, will occur.
+%
+Any line, however short, is still too long.
+%
+Any measuring utensil used for liquid ingredients will
+be needed immediately thereafter for dry ingredients.
+%
+Any task worth doing was worth doing yesterday.
+%
+Any technical problem can be overcome given enough
+time and money.
+
+You are never given enough time or money.
+%
+Any theory can be made to fit any facts by means of
+approximate, additional assumptions.
+%
+Any time you wish to demonstrate something, the number of
+faults is proportional to the number of viewers.
+%
+Any tool dropped while repairing a car will roll underneath
+to the exact center.
+%
+Anybody can win - unless there happens to be a second entry.
+%
+Anyone who follows a crowd will
+never be followed by a crowd.
+%
+Anything good in life either causes cancer in
+laboratory mice or is taxed beyond reality.
+%
+Anything hit with a big enough hammer will fall apart.
+%
+Anything is possible, but nothing is easy.
+%
+Anything is possible if you don't know what you're
+talking about.
+%
+Anything that can go wrong, will go wrong.
+%
+Anything you try to fix will take longer and cost more than
+you thought.
+%
+As the economy gets better, everything else gets worse.
+%
+Assumption is the mother of all foul-ups.
+%
+Assumption is the mother of all screw-ups.
+%
+At any event, the people whose seats are furthest from
+the aisle arrive last.
+%
+At any level of traffic, any delay is intolerable.
+%
+At the end of the semester you will recall having
+enrolled in a course at the beginning of the semester
+-- and never attending.
+%
+Authorization for a project will be granted only when
+none of the authorizers can be blamed if the project
+fails but when all of the authorizers can claim credit
+if it succeeds.
+%
+Automotive engine repairing law:
+If you drop something, it will never reach the ground.
+%
+Bad law is more likely to be supplemented than repealed.
+%
+Bad news drives good news out of the media.
+%
+Bare feet magnetize sharp metal objects so they always
+point upward from the floor -- especially in the dark.
+%
+Beauty is only skin deep, ugly goes clear to the bone.
+%
+Before ordering a test decide what you will do if it is,
+(1) positive, or
+(2) negative.
+If both answers are the same, don't do the test.
+%
+Beware of the physician who is great at getting
+out of trouble.
+%
+Blessed are those who go around in circles,
+for they shall be known as wheels.
+%
+Blessed is he who expects no gratitude,
+for he shall not be disappointed.
+%
+Blessed is he who has reached the point of no return and
+knows it for he shall enjoy living.
+%
+Build a system that even a fool can use,
+and only a fool will use it.
+%
+Calm down .... it is only ones and zeros.
+%
+Can't produces countercan't.
+%
+Capitalism can exist in one of only two states:
+welfare or warfare.
+%
+Celibacy is not hereditary.
+%
+Class schedules are designed so that every student will
+waste the maximum time between classes.
+%
+Cleanliness is next to impossible.
+%
+Clearly stated instructions will consistently produce
+multiple interpretations.
+%
+"Close" only counts in horseshoes, hand grenades and
+thermonuclear devices.
+%
+Common sense is not so common.
+%
+Complex problems have simple, easy-to-understand
+wrong answers.
+%
+Complex systems tend to oppose their own proper function.
+%
+Complicated systems produce unexpected outcomes.
+%
+Consultants are mystical people who ask a company for
+a number and then give it back to them.
+%
+Consumer assistance doesn't.
+%
+Cop-out number 1.
+You should have seen it when I got it.
+%
+Cost of repair can be determined by multiplying the
+cost of your new coat by 1.75, or by multiplying the
+cost of a new washer by .75.
+%
+Create problems for which only you have the answer.
+%
+Definition of an elephant:
+A mouse built to government specifications.
+%
+Democracy is that form of government where
+everybody gets what the majority deserves.
+%
+Despite the sign that says "wet paint",
+please don't.
+%
+Do not believe in miracles -- rely on them.
+%
+Do whatever your enemies don't want you to do.
+%
+Don't ask the barber if you need a haircut.
+%
+Don't bite the hand that has your pay check in it.
+%
+Don't fight with a bear in his own cage.
+%
+Don't force it,
+get a bigger hammer.
+%
+Don't let your superiors know you're better than
+they are.
+%
+Don't look back, something may be gaining on you.
+%
+Don't make your doctor your heir.
+%
+Don't mess with Mrs. Murphy!
+%
+Don't permit yourself to get between a dog and a lamppost.
+%
+Don't smoke in bed - the ashes on the floor might be your
+own.
+%
+Don't stop to stomp on ants
+when the elephants are stampeding.
+%
+During the time an item is on back-order, it will be
+available cheaper and quicker from many other sources.
+%
+Each problem solved introduces a new unsolved problem.
+%
+Easy doesn't do it.
+%
+Eat a live toad the first thing in the morning and nothing
+worse will happen to you the rest of the day.
+%
+Entropy has us outnumbered.
+%
+Envelopes and stamps which don't stick when you lick
+them will stick to other things when you don't want
+them to.
+%
+Even paranoids have enemies.
+%
+Even water tastes bad when taken on doctors orders.
+%
+Every great idea has a disadvantage equal to or
+exceeding the greatness of the idea.
+%
+Everybody is ignorant, only on different subjects.
+%
+Everybody lies; but it doesn't matter, since
+nobody listens.
+%
+Everybody wants a pain shot at the same time.
+%
+Everybody who didn't want a pain shot when you were
+passing out pain shots wants one when you are passing
+out sleeping pills.
+%
+Everybody's gotta be someplace.
+%
+Everyone breaks more than the seven-year-bad-luck allotment
+to cover rotten luck throughout an entire lifetime.
+%
+Everyone gets away with something.
+No one gets away with everything.
+%
+Everyone has a scheme for getting rich that will not work.
+%
+Everything east of the San Andreas fault will eventually
+plunge into the Atlantic ocean.
+%
+Everything happens at the same time with nothing in between.
+%
+Everything is contagious.
+%
+Everything is revealed to he who turns over enough stones.
+(Including the snakes that he did not want to find.)
+%
+Everything may be divided into as many parts as you please.
+%
+Everything put together sooner or later falls apart.
+%
+Everything takes longer than you expect.
+%
+Exciting plays occur only while you are watching the
+scoreboard or out buying a hot dog.
+%
+Fact is solidified opinion.
+%
+Facts may weaken under extreme heat and pressure.
+%
+Far-away talent always seems better than home-developed
+talent.
+%
+Flynn is dead
+Tron is dead
+long live the MCP.
+%
+Fools rush in -- and get the best seats.
+%
+For every action, there is an equal and opposite
+criticism.
+%
+For every credibility gap there is a gullibility fill.
+%
+For every credibility gap there is a gullibility gap.
+%
+For every human problem, there is a neat, plain solution --
+and it is always wrong.
+%
+For every vision, there is an equal and opposite revision.
+%
+Forgive and remember.
+%
+Freud's 23rd law: ideas endure and prosper in inverse
+proportion to their soundness and validity.
+%
+Friends come and go, but enemies accumulate.
+%
+Fuzzy project objectives are used to avoid the
+embarrassment of estimating the corresponding costs.
+%
+Go where the money is.
+%
+He who dies with the most toys wins.
+%
+He who hesitates is not only lost, but several miles from
+the next freeway exit.
+%
+He who laughs last -- probably didn't get the joke.
+%
+He who marries for money ... better be nice to his wife.
+%
+Hindsight is an exact science.
+%
+History doesn't repeat itself -- historians merely
+repeat each other.
+%
+History proves nothing.
+%
+History repeats itself.
+that's one of the things wrong with history.
+%
+Hockey is a game played by six good players and the
+home team.
+%
+Hollerith got us into this hole mess!
+%
+Hot glass looks exactly the same as cold glass.
+%
+How did they measure hail before the golf ball was invented?
+%
+How do they know no two snowflakes are alike?
+%
+How long a minute is depends on which side of the
+bathroom door you're on.
+%
+I can only please one person per day.
+Today is not your day.
+(Tomorrow isn't looking good either.)
+%
+I finally got it all together...
+but I forgot where I put it.
+%
+I have not lost my mind, it is backed up on tape somewhere.
+%
+I have yet to see any problem, however complicated, which,
+when you looked at it in the right way, did not become
+still more complicated.
+ -- Poul Anderson
+%
+I know you believe you understand
+ what you think I said,
+ however, I am not sure you realize,
+ that what I think you heard
+ is not what I meant
+%
+I no longer get lost in the shuffle....
+I shuffle along with the lost.
+%
+I think ... therefore I am confused.
+%
+If a program is useful, it will be changed.
+%
+If a program is useless, it will be documented.
+%
+If a scientist uncovers a publishable fact, it will
+become central to his theory.
+
+His theory, in turn, will become central to all
+scientific truth.
+%
+If a series of events can go wrong, it will do so in
+the worst possible sequence.
+%
+If a situation requires undivided attention, it will
+occur simultaneously with a compelling distraction.
+%
+If a straight line fit is required, obtain only two
+data points.
+%
+If a thing is done wrong often enough
+it becomes right.
+%
+If an experiment works, you must be using the wrong
+equipment.
+%
+If an idea can survive a bureaucratic review and be
+implemented, it wasn't worth doing.
+%
+If an item is advertised as "under $50," you can bet
+it's not $19.95.
+%
+If anything can go wrong, it will.
+%
+If anything can't go wrong it will.
+%
+If at first you don't succeed ... get new batteries.
+%
+If at first you don't succeed, transform your dataset.
+%
+If at first you don't succeed, try something else.
+%
+If at first you don't succeed,
+blame it on your supervisor.
+%
+If daily class attendance is mandatory, a scheduled
+exam will produce increased absenteeism. If attendance
+is optional, a scheduled exam will produce persons you
+have never seen before.
+%
+If everybody doesn't want it, nobody gets it.
+%
+If everything is coming your way, you're in the
+wrong lane.
+%
+If everything seems to be going well,
+you obviously don't know what the hell is going on.
+%
+If facts do not conform to the theory,
+they must be disposed of.
+%
+If his IQ was any lower he'd be a plant.
+%
+If it can be borrowed and it can be broken,
+you will borrow it and
+you will break it.
+%
+If it happens, it must be possible.
+%
+If it jams --- force it. If it breaks,
+it needed replacing anyway.
+%
+If it sits on your desk for 15 minutes, you've just
+become the expert.
+%
+If it weren't for the opinion polls we'd never know
+what people are undecided about.
+%
+If it would be cheaper to buy a new unit, the company
+will insist upon repairing the old one.
+%
+If it would be cheaper to repair the old one, the
+company will insist on the latest model.
+%
+If it's clean, it isn't laundry.
+%
+If it's good, they discontinue it.
+%
+If it's good they will stop making it.
+%
+If it's not in the computer, it doesn't exist.
+%
+If more than one person is responsible for a
+miscalculation, no one will be at fault.
+%
+If Murphy's law can go wrong, it will.
+%
+If not controlled, work will flow to the competent
+man until he submerges.
+%
+If on an actuarial basis there is a 50/50 chance that
+something will go wrong,
+It will actually go wrong nine times out of ten.
+%
+If one views his problem closely enough he will
+recognize himself as part of the problem.
+%
+If only one price can be obtained for any quotation,
+the price will be unreasonable.
+%
+If opportunity came disguised as temptation,
+one knock would be enough.
+%
+If project content is allowed to change freely, the rate of
+change will exceed the rate of progress.
+%
+If reproducibility may be a problem conduct the
+test only once.
+%
+If several things that could have gone wrong have not
+gone wrong, it would have been ultimately beneficial
+for them to have gone wrong.
+%
+If the assumptions are wrong,
+the conclusions aren't likely to be very good.
+%
+If the course you wanted most has room for 'n' students
+you will be the 'n + 1' to apply.
+%
+If the faulty part is in stock, it didn't need replacing
+in the first place.
+%
+If there are only two shows worth watching, they will
+be on together.
+%
+If there isn't a law, there will be.
+%
+If there was any justice in this world, people would
+occasionally be permitted to fly over pigeons.
+%
+If things were left to chance, they'd be better.
+%
+If two wrongs don't make a right, try three.
+ -- Dr. Laurence J. Peter
+%
+If we learn by our mistakes,
+I'm getting one hell of an education!!
+%
+If you allow someone to get in front of you either:
+(1) The car in front will be the last one over a
+ railroad crossing, and you will be stuck waiting
+ for a long, slow-moving train; or
+(2) you both will have the same destination and the
+ other car will get the last parking space.
+%
+If you are already in a hole, there's no use to continue
+digging.
+%
+If you are given an open-book exam, you will forget
+your book.
+If you are given a take-home exam, you will forget
+where you live.
+%
+If you buy bananas or avocados before they are ripe,
+there won't be any left by the time they are ripe. If
+you buy them ripe, they rot before they are eaten.
+%
+If you can get the faulty part off, the parts house
+will have it back-ordered.
+%
+If you can get to the faulty part, you don't have the
+tool to get it off.
+%
+If you can keep your head when all about you are losing
+theirs, then you just don't understand the problem.
+%
+If you can't convince them, confuse them.
+%
+If you can't measure it, I'm not interested.
+%
+If you can't measure output then you measure input.
+%
+If you change lines, the one you just left will start
+to move faster than the one you are now in.
+%
+If you do something right once, someone will ask
+you to do it again.
+%
+If you don't care where you are, you ain't lost.
+%
+If you don't like the answer,
+you shouldn't have asked the question.
+%
+If you don't say it, they can't repeat it.
+%
+If you don't write to complain, you'll never receive
+your order.
+If you do write, you'll receive the merchandise before
+your angry letter reaches its destination.
+%
+If you fool around with a thing for very long you will
+screw it up.
+%
+If you have a difficult task give it to a lazy man, he
+will find an easier way to do it.
+%
+If you have always done it that way, it is probably wrong.
+%
+If you have something to do, and you put it off long enough
+chances are someone else will do it for you.
+%
+If you have to ask, you are not entitled to know.
+%
+If you have to park six blocks away, you will find two
+new parking spaces right in front of the building
+entrance.
+%
+If you have watched a TV series only once, and you watch
+it again, it will be a rerun of the same episode.
+%
+If you help a friend in need, he is sure to remember
+you - the next time he's in need.
+%
+If you just try long enough and hard enough, you can always
+manage to boot yourself in the posterior.
+%
+If you know, you can't say.
+%
+If you leave the room, you're elected.
+%
+If you lived here you'd be home now.
+%
+If you plan to leave your mark in the sands of time,
+you better wear work shoes.
+%
+If you see a man approaching you with the obvious intent
+of doing you good, you should run for your life.
+%
+If you see that there are four possible ways in which a
+procedure can go wrong, and circumvent these, then a
+fifth way, unprepared for, will promptly develop.
+%
+If you smile when everything goes wrong, you are
+either a nitwit or a repairman.
+%
+If you try to please everybody, nobody will like it.
+%
+If you wait, it will go away
+... having done it's damage.
+If it was bad, it'll be back.
+%
+If you want to get along, go along.
+%
+If you want to make an enemy, do someone a favor.
+%
+If your condition seems to be getting better, it's
+probably your doctor getting sick.
+%
+If your next pot of chili tastes better, it probably is
+because of something left out, rather than added.
+%
+If you're coasting, you're going downhill.
+%
+If you're early, it'll be canceled.
+If you knock yourself out to be on time, you will
+ have to wait.
+If you're late, you will be too late.
+%
+If you're feeling good, don't worry,
+you'll get over it.
+%
+If you're wondering if you have enough money to take
+the family out to eat tonight, you don't.
+%
+If you're wondering if you left the coffee pot
+plugged in, you did.
+%
+If you're wondering if you need to stop and pick up
+bread and eggs on the way home, you do.
+%
+If you're wondering if you took the meat out to
+thaw, you didn't.
+%
+If you're worried about being crazy,
+don't be overly concerned:
+If you were, you would think you were sane.
+%
+If you've got them by the balls,
+their hearts and minds will follow.
+%
+Ignorance should be painful.
+%
+Important letters which contain no errors will develop
+errors in the mail.
+%
+In a bureaucratic hierarchy, the higher up the
+organization the less people appreciate Murphy's law,
+the Peter Principle, etc.
+%
+In a family recipe you just discovered in an old book,
+the most vital measurement will be illegible.
+%
+In a hierarchical organization, the higher the level,
+the greater the confusion.
+%
+In a hierarchical system, the rate of pay varies
+inversely with the unpleasantness and difficulty
+of the task.
+%
+In a three-story building served by one elevator, nine
+times out of ten the elevator car will be on a floor
+where you are not.
+%
+In any bureaucracy, paperwork increases as you spend
+more and more time reporting on the less and less you
+are doing. Stability is achieved when you spend all of
+your time reporting on the nothing you are doing.
+%
+In any dealings with a collective body of people, the
+people will always be more tacky than originally expected.
+%
+In any hierarchy, each individual rises to his own level
+of incompetence, and then remains there.
+%
+In any household, junk accumulates to the space
+available for its storage.
+%
+In any organization there will always be one person
+who knows what is going on.
+This person must be fired.
+%
+In any series of calculations, errors tend to occur
+at the opposite end to the end at which you begin
+checking for errors.
+%
+In case of doubt, make it sound convincing.
+%
+In order for something to become clean, something
+else must become dirty.
+... but you can get everything dirty without getting
+anything clean.
+%
+In the fight between you and the world, back the world.
+%
+Incompetence knows no barriers of time or place.
+%
+Indecision is the basis for flexibility.
+%
+Indifference is the only sure defense.
+%
+Information deteriorates upward through the bureaucracies.
+%
+Information travels more surely to those with a
+lesser need to know.
+%
+Inside every large program
+is a small program struggling to get out.
+%
+Interchangeable parts --- won't.
+%
+It always takes longer to get there than to get back.
+%
+It does not matter if you fall down as long as you pick
+up something from the floor while you get up.
+%
+It is a simple task to make things complex, but a complex
+task to make them simple.
+%
+It is better for civilization to be going down the drain,
+than to be coming up it.
+%
+It is better to be part of the idle rich class
+than be part of the idle poor class.
+%
+It is better to solve a problem with a crude
+approximation and know the truth, than to demand an
+exact solution and not know the truth at all.
+%
+It is easier to get forgiveness than permission.
+%
+It is far better to do nothing than to do
+something efficiently.
+ -- Siezbo
+%
+It is impossible for an optimist to be pleasantly
+surprised.
+%
+It is impossible to build a fool proof system;
+because fools are so ingenious.
+%
+It is ok to be ignorant in some areas,
+but some people abuse the privilege.
+%
+It takes longer to glue a vase together than to
+break one.
+%
+It takes longer to lose 'x' number of pounds than
+to gain 'x' number of pounds.
+%
+It the shoe fits, it's ugly.
+%
+It works better if you plug it in.
+%
+It's always darkest before ... daylight saving time.
+%
+It's always darkest just before the lights go out.
+ -- Alex Clark
+%
+It's always easier to go down hill, but the view is
+from the top.
+%
+It's better to retire too soon than too late.
+%
+It's tough to get reallocated when you're the one
+who's redundant.
+%
+Just about the time when you think you can make ends meet
+somebody moves the ends!
+%
+Just because you are paranoid
+doesn't mean "they" aren't out to get you.
+%
+Just because your doctor has a name for your condition
+doesn't mean he knows what it is.
+%
+Just when you get really good at something,
+you don't need to do it anymore.
+%
+Justice always prevails...
+three times out of seven.
+%
+Keep emotionally active,
+cater to your favorite neurosis.
+%
+King Arthur ran the first knight club.
+%
+Laugh and the world laughs with you. cry and ...
+you have to blow your nose.
+%
+Law expands in proportion to the resources available
+for its enforcement.
+%
+Laziness is the mother of nine inventions out of ten.
+%
+Lead, follow, or get the hell out of the way!!
+%
+Leakproof seals --- will.
+%
+Learn to be sincere. Even if you have to fake it.
+%
+Left to themselves, all things go from bad to worse.
+%
+Leftover nuts never match leftover bolts.
+%
+Life is like an ice-cream cone: You have to learn to
+lick it.
+%
+Liquidity tends to run out.
+%
+Live within your income,
+even if you have to borrow to do so.
+%
+Magellan was the first strait man.
+%
+Make it possible for programmers to write programs
+in English and you will find that programmers cannot
+write in English.
+%
+Make three correct guesses consecutively and you will
+establish yourself as an expert.
+%
+Management can't.
+%
+Mass man must be serviced by mass means.
+%
+Misery no longer loves company
+nowadays it insists on it.
+%
+Most people want to be delivered from temptation but
+would like it to keep in touch.
+%
+Most projects require three hands.
+%
+Multiple-function gadgets will not perform any
+function adequately.
+%
+Murphy's rule for precision:
+ Measure with a micrometer
+ Mark with chalk
+ Cut with an axe
+%
+Nature always sides with the hidden flaw.
+%
+Nature is a mother.
+%
+Nature will tell you a direct lie if she can.
+%
+Never admit anything.
+Never regret anything
+whatever it is, you're not responsible.
+%
+Never argue with a fool,
+people might not know the difference.
+%
+Never argue with an artist.
+%
+Never be first to do anything.
+%
+Never create a problem for which you do not have
+the answer.
+%
+Never eat prunes when you are famished.
+%
+Never get excited about a blind date because of how
+it sounds over the phone.
+%
+Never go to a doctor whose office plants have died.
+ -- Erma Bombeck
+%
+Never insult an alligator
+until after you have crossed the river.
+%
+Never leave hold of what you've got until you've got hold
+of something else.
+%
+Never make a decision you can get someone else to make.
+%
+Never needlessly disturb a thing at rest.
+%
+Never offend people with style
+when you can offend them with substance.
+%
+Never play leapfrog with a photo enlarger.
+%
+Never play leapfrog with a unicorn.
+%
+Never put all your eggs in your pocket.
+%
+Never say "oops" after you have submitted a job.
+%
+Never tell them what you wouldn't do.
+%
+Never test for an error condition you don't know
+how to handle.
+%
+Never wrestle with a pig; you both get dirty, and the pig
+likes it!
+%
+New systems generate new problems.
+%
+No experiment is ever a complete failure.
+It can always be used as a bad example.
+%
+No good deed goes unpunished.
+ -- Clare Boothe Luce
+%
+No major project is ever installed on time, within budgets,
+with the same staff that started it. Yours will not be the
+first.
+%
+No man is lonely while eating spaghetti.
+%
+No matter how large the work space, if two projects
+must be done at the same time they will require the
+same part of the work space.
+%
+No matter how long or hard you shop for an item, after
+you have bought it, it will be on sale somewhere cheaper.
+%
+No matter how minor the task, you will inevitably end
+up covered with grease and motor oil.
+%
+No matter how strong the breeze when you leave the dock
+once you have reached the furthest point from port
+the wind will die.
+%
+No matter what goes wrong, there is always somebody
+who knew it would.
+%
+No matter what happens, there is always somebody
+who knew that it would.
+%
+No matter what they're talking about, they're
+talking about money.
+%
+No matter what they're telling you, they're not
+telling you the whole truth.
+%
+No matter which direction you start,
+it's always against the wind coming back.
+%
+No news is ... impossible.
+%
+No one keeps a record of decisions you could have made
+but didn't. Everyone keeps a records of your bad ones.
+%
+No one's life, liberty, or property are safe
+while the legislature is in session.
+%
+No system is ever completely debugged: Attempts to debug
+a system will inevitably introduce new bugs that are even
+harder to find.
+%
+Nobody notices when things go right.
+%
+Nothing improves an innovation like lack of controls.
+%
+Nothing is ever accomplished by a reasonable man.
+%
+Nothing is ever as simple as it seems.
+%
+Nothing is ever done for the right reasons.
+%
+Nothing is ever so bad it can't be made worse by
+firing the coach.
+%
+Nothing is ever so bad that it can't get worse.
+%
+Nothing is impossible for the person who doesn't have
+to do it himself/herself.
+%
+Nothing is indestructible, with the possible exception
+of discount-priced fruitcakes.
+%
+Of two possible events,
+only the undesired one will occur.
+%
+Office machines which function perfectly during normal
+business hours will break down when you return to the
+office at night to use them for personal business.
+%
+Old age is always fifteen years older than I am.
+%
+Old programmers never die - they just abend.
+%
+On a beautiful day like this it's hard to believe anyone
+can be unhappy -- but we will work on it.
+%
+On a clear disk, you can seek forever.
+%
+On successive charts of the same organization, the number of
+boxes will never decrease.
+%
+Once a dish is fouled up, anything added to save it
+only makes it worse.
+%
+One man's error is another man's data.
+%
+One place where you're sure to find the perfect
+driver is in the back seat.
+%
+Only a mediocre person is always at their best.
+%
+Only adults have difficulty with child-proof bottles.
+%
+Only errors exist.
+%
+Opportunity always knocks at the least opportune
+moment.
+%
+Other people's romantic gestures seem novel and exciting.
+
+Your own romantic gestures seem foolish and clumsy.
+%
+Our customers' paperwork is profit.
+Our own paperwork is loss.
+%
+People are promoted not by what they can do, but what
+people think they can do.
+%
+People can be divided into three groups:
+Those who make things happen,
+Those who watch things happen and
+Those who wonder what happened.
+%
+People don't change; they only become more so.
+%
+People in systems do not do what the systems say
+they are doing.
+%
+People to whom you are attracted invariably think you
+remind them of someone else.
+%
+People who love sausage and respect the law should
+never watch either one being made.
+%
+People will accept your idea much more readily if you tell
+them Benjamin Franklin said it first.
+%
+People will believe anything if you whisper it.
+%
+People will buy anything that is one to a customer.
+%
+Performance is directly affected by the perversity of
+inanimate objects.
+%
+Personnel recruiting is a triumph of hope over
+experience.
+%
+Persons disagreeing with your facts are always emotional
+and employ faulty reasoning.
+%
+Pills to be taken in twos always come
+out of the bottle in threes.
+%
+Please don't steal, the IRS hates competition!
+%
+Possessions increase to fill the space available for
+their storage.
+%
+Program complexity grows until it exceeds the capability
+of the programmer who must maintain it.
+%
+Program design philosophy:
+
+ Start at the beginning and continue until the end,
+ then stop.
+ -- Lewis Carroll
+%
+Progress does not consist in replacing a theory that is
+wrong with one that is right. It consists in replacing
+a theory that is wrong with one that is more subtly wrong.
+%
+Progress is made on alternate Fridays.
+%
+Pure drivel tends to drive ordinary
+drivel off the TV screen.
+%
+Quit while you're still behind.
+%
+RACF is a four letter word.
+%
+Real programmers always have a better idea.
+%
+Real programmers are kind to rookies.
+%
+Real programmers are secure enough to write readable code,
+which they then self-righteously refuse to explain.
+%
+Real programmers argue with the systems analyst as a
+matter of principle.
+%
+Real programmers can do octal, hexadecimal and
+binary math in their heads.
+%
+Real programmers do not apply DP terminology to non-DP
+situations.
+%
+Real programmers do not document.
+Documentation is for simps who can't read listings or
+object code.
+%
+Real programmers do not eat breakfast from the
+vending machines.
+%
+Real programmers do not practice four-syllable words before
+walkthroughs.
+%
+Real programmers do not read books like
+"effective listening" and "communication skills".
+%
+Real programmers do not utter profanities at an elevated
+decibel level.
+%
+Real programmers don't advertise their hangovers.
+%
+Real programmers don't announce how many times the
+operations department called them last night.
+%
+Real programmers don't comment their code. if it is hard
+to write, it should be hard to understand.
+%
+Real programmers don't dress for success unless
+they are trying to convince others that they are
+going on interviews.
+%
+Real programmers don't eat muffins.
+%
+Real programmers don't eat quiche. In fact, real
+programmers don't know how to spell quiche. They eat
+Twinkies and szechuan food.
+%
+Real programmers don't grumble about the disadvantages
+of Cobol when they don't know any other language.
+%
+Real programmers don't notch their desks for each
+completed service request.
+%
+Real programmers don't number paragraph names
+consecutively.
+%
+Real programmers don't play tennis or any other sport
+that requires you to change clothes. Mountain climbing is
+O.K., and real programmers wear their climbing boots to work
+in case a mountain should suddenly spring up in the middle
+of the machine room.
+%
+Real programmers don't play video games, they write them.
+%
+Real programmers don't write applications programs; they
+program right down on the bare metal. Application
+programming is for feebs who can't do systems programming.
+%
+Real programmers don't write COBOL.
+COBOL is for wimpy applications programmers.
+%
+Real programmers don't write in Basic. Actually, no
+programmers write in Basic after age 12.
+%
+Real programmers don't write in Pascal, Bliss, or Ada, or
+any of those pinko computer science languages. Strong
+typing is for people with weak memories.
+%
+Real programmers don't write in PL/1. PL/1 is for
+programmers who can't decide whether to write in
+COBOL or Fortran.
+%
+Real programmers don't write memos.
+%
+Real programmers don't write specs -- users should
+consider themselves lucky to get any programs at all and
+take what they get.
+%
+Real programmers drink too much coffee so that they will
+always seem tense and overworked.
+%
+Real programmers have read the standards manual
+but won't admit it.
+%
+Real programmers know it's not operations'
+fault if their jobs go into "hogs".
+%
+Real programmers know what saad means.
+%
+Real programmers never work 9 to 5. If any real
+programmers are around at 9 a.m., it's because they
+were up all night.
+%
+Real programmers print only clean compiles,
+fixing all errors through the terminal.
+%
+Real programmer's programs never work the first time. But
+if you throw them on the machine, they can be patched into
+working in "only a few" 30-hour debugging sessions.
+%
+Real programmers punch up their own programs.
+%
+Real programmers understand Pascal.
+%
+Remain silent about your intentions until you are sure
+%
+Return on investments won't.
+%
+Roses are red violets are blue
+I am schizophrenic and so am I
+%
+Sale promotions don't.
+%
+Sanity and insanity overlap a fine gray line.
+%
+Science is true. Don't be misled by facts.
+%
+Security isn't.
+%
+Self starters --- won't.
+%
+Show me a person who's never made a mistake and I'll
+show you somebody who's never achieved much.
+%
+Simple jobs always get put off because there will be
+time to do them later.
+%
+Some come to the fountain of knowledge to drink,
+some prefer to just gargle.
+%
+Some errors will always go unnoticed until the book
+is in print.
+%
+Some of it plus the rest of it is all of it.
+%
+Souffles rise and cream whips only for the family and
+for guests you didn't really want to invite anyway.
+%
+Success can be insured only by devising a defense against
+failure of the contingency plan.
+%
+Superiority is recessive.
+%
+Systems should not be unnecessarily multiplied.
+%
+Systems tend to grow and as they grow they encroach.
+%
+Talent in staff work or sales will continually be
+interpreted as managerial ability.
+%
+Teamwork is essential. It allows you to blame someone else.
+%
+That component of any circuit which has the shortest
+service life will be placed in the least
+accessible location.
+%
+The amount of flak received on any subject is inversely
+proportional to the subject's true value.
+%
+The amount of wind will vary inversely with the number
+and experience of the people you have on board.
+%
+The best shots are generally attempted through the
+lens cap.
+%
+The best shots happen immediately after the last
+frame is exposed.
+%
+The best way to inspire fresh thoughts is to seal
+the letter.
+%
+The best way to lie is to tell the truth.....
+carefully edited truth.
+%
+The big guys always win.
+%
+The bigger they are, the harder they hit.
+%
+The boss who attempts to impress employees with his
+knowledge of intricate details has lost sight of his
+final objective.
+%
+The chance of a piece of bread falling with the buttered
+side down is directly proportional to the cost of the
+carpet.
+%
+The chances of anybody doing anything are inversely
+proportional to the number of other people who are in
+a position to do it instead.
+%
+The chief cause of problems is solutions.
+ -- Eric Sevareid
+%
+The client who pays the least complains the most
+%
+The closer you are to the facts of a situation, the
+more obvious are the errors in all news coverage of
+the situation.
+%
+The "consumer report" on the item will come out a week
+after you've made your purchase:
+
+(1) The one you bought will be rated "unacceptable".
+(2) The one you almost bought will be rated "best buy".
+%
+The cream rises to the top.
+So does the scum.
+%
+The crucial memorandum will be snared in the out-basket by
+the paper clip of the overlying memo and go to file.
+%
+The deficiency will never show itself during the test runs.
+%
+The distance to the gate is inversely proportional
+to the time available to catch your flight.
+%
+The early worm deserves the bird.
+%
+The easiest way to find something lost around the house
+is to buy a replacement.
+%
+The faster the plane,
+the narrower the seats.
+%
+The feasibility of an operation is not the best
+indication for its performance.
+%
+The final test is when it goes production ...
+w h e n i t g o e s p r o d u c t i o n ...
+w h e n i t g o e s p r o d u c t
+w h e n i t g o e s p r o
+%
+The first 90 percent of the task takes 90 percent of the
+time, the last 10 percent takes the other 90 percent.
+%
+The first bug to hit a clean windshield lands directly
+in front of your eyes.
+%
+The first insurance agent was David -
+he gave Goliath a piece of the rock.
+%
+The first myth of management is that it exists
+the second myth of management is that success equals skill.
+%
+The first page the author turns to upon receiving an
+advance copy will be the page containing the worst
+error.
+%
+The first place to look for anything is the last place
+you would expect to find it.
+%
+The first rule of intelligent tinkering is to
+save all of the parts.
+%
+The first time is for love.
+The next time is $200.
+%
+The further away the disaster or accident occurs, the
+greater the number of dead and injured required for it
+to become a story.
+%
+The further you are from the facts of a situation,
+the more you tend to believe news coverage of the
+situation.
+%
+The greater the cost of putting a plan into operation,
+the less chance there is of abandoning the plan - even
+if it subsequently becomes irrelevant.
+%
+The hand that rocks the cradle usually is attached
+to someone who isn't getting enough sleep.
+%
+The hidden flaw never remains hidden.
+%
+The higher the level of prestige accorded the people
+behind the plan, the least less chance there is of
+abandoning it.
+%
+The inside contact that you have developed at great
+expense is the first person to be let go in any
+reorganization.
+%
+The item you had your eye on the minute you walked in
+will be taken by the person in front of you.
+%
+The lagging activity in a project will invariably be found
+in the area where the highest overtime rates lie waiting.
+%
+The last person who quit or was fired will be held
+responsible for everything that goes wrong -- until
+the next person quits or is fired.
+%
+The least experienced fisherman always catches the
+biggest fish.
+%
+The length of a marriage is inversely proportional
+to the amount spent on the wedding.
+%
+The life expectancy of a house plant varies inversely
+with its price and directly with its ugliness.
+%
+The light at the end of the tunnel can be a helluva
+nuisance, especially if you're using the tunnel
+as a darkroom.
+%
+The light at the end of the tunnel is the headlamp of
+an oncoming train.
+%
+The light at the end of the tunnel really is a train.
+%
+The lion and the calf shall lie down together,
+but the calf won't get much sleep.
+%
+The longer the title the less important the job.
+%
+The longer you wait in line, the greater the
+likelihood that you are standing in the wrong line.
+%
+The love letter you finally got the courage to send
+will be delayed in the mail long enough for you to
+make a fool of yourself in person.
+%
+The man who can smile when things go wrong has thought of
+someone he can blame it on.
+%
+The man who has no more problems is out of the game.
+%
+The meek shall inherit the earth,
+but not its mineral rights.
+%
+The meek will inherit the earth
+after the rest of us go to the stars.
+%
+The more boring and out-of-date the magazines in the
+waiting room, the longer you will have to wait for
+your scheduled appointment.
+%
+The more carefully you plan a project, the more
+confusion there is when something goes wrong.
+%
+The more complicated and grandiose the plan, the
+greater the chance of failure.
+%
+The more directives you issue to solve a problem,
+the worse it gets.
+%
+The more elaborate and costly the equipment, the greater
+the chance of having to stop at the fish market
+on the way home.
+%
+The more expensive the gadget, the less often you
+will use it.
+%
+The more general the title of a course, the less
+you will learn from it.
+%
+The more ridiculous a belief system,
+the higher probability of its success.
+%
+The more specific the title of a course, the less you
+will be able to apply it later.
+%
+The more studying you did for the exam, the less sure
+you are as to which answer they want.
+%
+The more time and energy you put into preparing a meal
+the greater the chance your guests will spend the entire
+meal discussing other meals they have had.
+%
+The most important item in an order will no longer
+be available.
+%
+The most interesting specimen will not be labeled.
+%
+The most valuable quotation will be the one for which
+you cannot determine the source.
+%
+The mountain gets steeper as you get closer.
+%
+The mountain looks closer than it is.
+%
+The one course you must take to graduate will not be
+offered during your last semester.
+%
+The one day you'd sell your soul for something,
+souls are a glut.
+%
+The one ingredient you made a special trip to the store
+to get will be the one thing your guest is allergic to.
+%
+The one thing that money can not buy is poverty.
+%
+The one time in the day that you lean back and relax
+is the one time the boss walks through the office.
+%
+The one who least wants to play is the one who will win.
+%
+The one who snores will fall asleep first.
+%
+The one wrench or drill bit you need will be the one
+missing from the tool chest.
+%
+The one you want is never the one on sale.
+%
+The only game that can't be fixed is peek-a-boo.
+%
+The only new TV show worth watching will be canceled.
+%
+The only way to make up for being lost is to make
+record time while you are lost.
+%
+The only winner in the war of 1812 was Tchaikovsky.
+%
+The organization of any program reflects the organization
+of the people who developed it.
+%
+The other line always moves faster.
+%
+The phone will not ring until you leave your desk and walk
+to the other end of the building.
+%
+The pills to be taken with meals will be the least
+appetizing ones.
+%
+The primary function of the design engineer is to make
+things difficult for the fabricator and impossible
+for the serviceman.
+%
+The probability of a cat eating its dinner has
+absolutely nothing to do with the price of the food
+placed before it.
+%
+The probability of anything happening is in
+inverse ratio to its desirability.
+%
+The probability of meeting someone you know increases
+when you are with someone you don't want to be seen with.
+%
+The probability that a household pet will raise a fuss
+to go in or out is directly proportional to the number
+and importance of your dinner guests.
+%
+The quality of correlation is inversely proportional
+to the density of control.
+%
+The quickest way to experiment with acupuncture is to
+try on a new shirt.
+%
+The race goes not always to the swift, nor the battle
+to the strong, but that's the way to bet.
+%
+The radiologists' national flower is the hedge.
+%
+The ratio of time involved in work to time available for
+work is usually about 0.6
+%
+The repairman will never have seen a model quite like
+yours before.
+%
+The road to hell is paved with good intentions
+and littered with sloppy analyses!
+%
+The rotten egg will be the one you break into the
+cake batter.
+%
+The scratch on the record is always through the song
+you like most.
+%
+The secret of success is sincerity. Once you can fake
+that you've got it made.
+%
+The severity of an itch is inversely proportional
+to the reach.
+%
+The simpler the instruction, e.g. "press here", the
+more difficult it will be to open the package.
+%
+The six steps of program management are:
+(1) Wild enthusiasm
+(2) Disenchantment
+(3) Total confusion
+(4) Search for guilty
+(5) Punishment for the innocent
+(6) Promotion of the non-participants
+%
+The slowest checker is always at the quick-check-out
+lane.
+%
+The source for an unattributed quotation will appear
+in the most hostile review of your work.
+%
+The speed of an oncoming vehicle is directly proportional
+to the length of the passing zone.
+%
+The spot you are scrubbing on glassware is always on
+the other side.
+%
+The stomach expands to accommodate the amount of
+junk food available.
+%
+The success of any venture will be helped by prayer,
+even in the wrong denomination.
+%
+The sun goes down just when you need it the most.
+%
+The system itself does not do what it says it is doing.
+%
+The tendency of smoke from a cigarette, barbeque,
+campfire, etc. to drift into a person's face varies
+directly with that person's sensitivity to smoke.
+%
+The "think positive" leader tends to listen to his
+subordinate's premonitions only during the postmortems.
+%
+The time available to go fishing shrinks as the fishing
+season draws nearer.
+%
+The time it takes to rectify a situation is
+inversely proportional to the time it took
+to do the damage.
+%
+The total behavior of large systems cannot be predicted.
+%
+The TV show you've been looking forward to all week
+will be preempted.
+%
+The usefulness of any meeting
+is in inverse proportion to the attendance.
+%
+The value of a program is proportional
+to the weight of its output.
+%
+The worse your line is tangled, the better is the
+fishing around you.
+%
+The wrong quarterback is the one that's in there.
+%
+The yoo-hoo you yoo-hoo into the forest is the yoo-hoo you
+get back.
+%
+Them what gets--has.
+%
+There are no winners in life: Only survivors.
+%
+There are some things which are impossible to know -
+but it is impossible to know these things.
+%
+There are three ways to get things done:
+ (1) Do it yourself,
+ (2) Hire someone to do it, or
+ (3) Forbid your kids to do it.
+%
+There are two kinds of adhesive tape: That which won't
+stay on and that which won't come off.
+%
+There is a solution to every problem;
+the only difficulty is finding it.
+%
+There is always more dirty laundry then clean laundry.
+%
+There is always one more bug.
+%
+There is no safety in numbers, or in anything else.
+%
+There is no such thing as a "dirty capitalist",
+only a capitalist.
+%
+There is no such thing as a straight line.
+%
+There is nothing more frightening than ignorance in action.
+%
+There's never time to do it right, but there's always
+time to do it over.
+%
+There's no time like the present for postponing
+what you don't want to do.
+%
+Things equal to nothing else are equal to each other.
+%
+Things get worse under pressure.
+%
+This space for rent.
+%
+Those whose approval you seek the most give you the least.
+%
+Those with the best advice offer no advice.
+%
+Time spent consuming a meal is in inverse proportion
+to time spent preparing it.
+%
+To err is human -- to blame it on someone else is
+even more human.
+%
+To err is human, but to really foul things up requires
+a computer.
+%
+To err is human, to forgive is divine --
+but to forget it altogether is humane.
+%
+To get a loan, you must first prove you don't need it.
+%
+To know yourself is the ultimate form of aggression.
+%
+To spot the expert, pick the one who predicts the job
+will take the longest and cost the most.
+%
+Trial balances don't.
+%
+Truth is elastic.
+%
+Unless the results are known in advance, funding
+agencies will reject the proposal.
+%
+Unless you intend to kill him immediately; never kick a man
+in the balls, not even symbolically or perhaps especially
+not symbolically.
+%
+Usefulness is inversely proportional to its reputation
+for being useful.
+%
+Vital papers will demonstrate their vitality by
+spontaneously moving from where you left them to where
+you can't find them.
+%
+Washing machines only break down during the wash cycle.
+%
+Washing your car to make it rain doesn't work.
+%
+"Watching a birdie" in hand is safer than watching
+one overhead.
+%
+Whatever can go to New York, will.
+%
+Whatever carrousel you stand by, your baggage will
+come in on another one.
+%
+Whatever creates the greatest inconvenience for the largest
+number must happen.
+%
+Whatever happens to you, it will previously have
+happened to everyone you know only more so.
+%
+Whatever hits the fan will not be evenly distributed.
+%
+Whatever it is, somebody will have had it for lunch.
+%
+When a broken appliance is demonstrated for the repairman,
+it will work perfectly.
+%
+When a distinguished scientist states something is possible,
+he is almost certainly right. When he states that
+something is impossible, he is very probably wrong.
+%
+When a student asks for a second time if you have read
+his book report, he did not read the book.
+%
+When a writer prepares a manuscript on a subject he does
+not understand, his work will be understood only by
+readers who know more about that subject than he does.
+%
+When all else fails, read the instructions.
+%
+When an exaggerated emphasis is placed upon delegation,
+responsibility, like sediment, sinks to the bottom.
+%
+When in doubt, don't mumble, overexpose ... then mumble.
+%
+When in doubt, mumble. When in trouble, delegate.
+%
+When in doubt, mumble.
+When in trouble, delegate.
+When in charge, ponder.
+%
+When in doubt, predict that the trend will continue.
+%
+When in trouble, obfuscate.
+%
+When life hands you a lemon, make lemonade.
+%
+When more and more people are thrown out of work,
+unemployment results.
+%
+When necessary, metric and inch tools can be used
+interchangeably.
+%
+When outrageous expenditures are divided finely enough
+the public will not have enough stake in any one
+expenditure to squelch it.
+%
+When properly administered, vacations do not diminish
+productivity. For every week you are away and get nothing
+done, there is another week when your boss is away and you
+get twice as much done.
+%
+When putting it into memory, remember where you put it.
+%
+When reviewing your notes before an exam, the most
+important ones will be illegible.
+%
+When somebody drops something, everybody will kick it
+around instead of picking it up.
+%
+When the going gets tough, everyone leaves.
+ -- Lynch
+%
+When the government bureau's remedies do not match your
+problem, you modify the problem, not the remedy.
+%
+When the need arises, any tool or object closest to you
+becomes a hammer.
+%
+When the product is destined to fail, the delivery system
+will perform perfectly.
+%
+When they want it bad (in a rush), they get it bad.
+%
+When things are going well, someone will inevitably
+experiment detrimentally.
+%
+When things are going well, something will go wrong.
+When things just can't get any worse, they will.
+When things appear to be going better you have overlooked
+something.
+%
+When traveling overseas, the exchange rate improves
+markedly the day after one has purchased foreign
+currency.
+
+Upon returning home, the exchange rate drops again as
+soon as one has converted all unused foreign currency.
+%
+When we try to pick out anything by itself we find
+it hitched to everything else in the universe.
+%
+When working toward the solution of a problem,
+it always helps if you know the answer.
+Provided of course you know there is a problem.
+%
+When you are able to schedule two classes in a row,
+they will be held in classrooms at opposite end of
+the campus.
+%
+When you are right be logical,
+when you are wrong be-fuddle.
+%
+When you are sure you're right, you have a moral duty
+to impose your will upon anyone who disagrees with you.
+%
+When you consider there are 24 hours in a day, it's
+sad to know that only one is called the happy hour.
+%
+When you dial a wrong number, you never get a busy signal
+%
+When you do not know what you are doing, do it neatly.
+%
+When you need to knock on wood is when you realize the
+world's composed of aluminum and vinyl.
+%
+When your opponent is down, kick him.
+%
+When you're not in a hurry, the traffic light will turn
+green as soon as your vehicle comes to a complete stop.
+%
+Whenever a superstar is traded to your favorite team,
+he fades. Whenever your team trades away a useless
+no-name, he immediately rises to stardom.
+%
+Whenever you cut your fingernails you will find a
+need for them an hour later.
+%
+Where you stand on an issue depends on where you sit.
+%
+Why worry about tomorrow? We may not make it through today!
+%
+Work is accomplished by those employees who have not yet
+reached their level of incompetence.
+%
+Work may be the crabgrass of life, but money is still the
+water that keeps it green.
+%
+Workers won't.
+%
+Working capital doesn't.
+%
+Writings prepared without understanding must fail in the
+first objective of communication -- informing
+the uninformed.
+%
+You are always complimented on the item which took the
+least effort to prepare.
+
+Example:
+ If you make "duck a l'orange" you will be
+ complimented on the baked potato.
+%
+You are not drunk if you can lay on the floor without
+holding on.
+%
+You can always find what you're not looking for.
+%
+You can lead a horse to water, but if you can get him to
+float on his back, you've really got something.
+%
+You can never do just one thing.
+ -- Hardin
+%
+You can pray hard enough to make water run uphill
+how hard?
+Hard enough to make water run uphill.
+%
+You can't expect to hit the jackpot
+if you don't put a few nickels in the machine.
+%
+You can't fix it if it ain't broke.
+%
+You can't guard against the arbitrary.
+%
+You can't tell how deep a puddle is until you step into it.
+%
+You don't have to be crazy to work here
+but it sure helps!!!!!!!
+%
+You may be recognized soon.
+Hide!
+If they find you, lie.
+%
+You may know where the market is going, but you can't
+possibly know where it's going after that.
+%
+You never have the right number of pills left on the
+last day of a prescription.
+%
+You never know who's right, but you always know
+who's in charge.
+%
+You sure have to borrow a lot of money these days to
+be an average consumer.
+%
+You will always find something in the last place you look.
+%
+You will remember that you forgot to take out the trash
+when the garbage truck is two doors away.
+%
+You will save yourself a lot of needless worry if you
+don't burn your bridges until you come to them.
+%
+You win some, lose some, and some get rained out; but you
+gotta suit up for them all.
+%
diff --git a/usr.bin/fortune/datfiles/murphy-o b/usr.bin/fortune/datfiles/murphy-o
new file mode 100644
index 0000000..94c9cc2
--- /dev/null
+++ b/usr.bin/fortune/datfiles/murphy-o
@@ -0,0 +1,30 @@
+%%$FreeBSD$
+%
+All probabilities are 50%: either a thing will
+happen or it won't.
+
+This is especially true when dealing with women.
+
+Likelihoods, however, are 90% against you.
+%
+Early to rise and early to bed makes a male
+healthy and wealthy and dead.
+%
+It's always the wrong time of the month.
+%
+Never sleep with anyone crazier than yourself.
+%
+One's life tends to be like a beaver's,
+one dam thing after another.
+%
+Pity the poor egg;
+It only gets laid once in its life.
+%
+Sow your wild oats on Saturday night - then on
+Sunday pray for crop failure.
+%
+When you're up to your nose in shit,
+be sure to keep your mouth shut.
+%
+You can lead a horticulture, but you can't make her think.
+%
diff --git a/usr.bin/fortune/datfiles/murphy.sp.ok b/usr.bin/fortune/datfiles/murphy.sp.ok
new file mode 100644
index 0000000..0287e6a
--- /dev/null
+++ b/usr.bin/fortune/datfiles/murphy.sp.ok
@@ -0,0 +1,36 @@
+# $FreeBSD$
+abend
+ACF
+barbeque
+Carroll
+Chevrolets
+countercan't
+crabgrass
+DP
+feebs
+Freud's
+fruitcakes
+gotta
+headlamp
+IQ
+IRS
+l'orange
+MCP
+Murphy's
+paranoids
+plumber's
+postmortems
+Poul
+profanities
+RACF
+radiologists
+roccoco
+saad
+Siezbo
+simps
+Souffles
+subordinate's
+superstar
+szechuan
+Twinkies
+walkthroughs
diff --git a/usr.bin/fortune/datfiles/startrek b/usr.bin/fortune/datfiles/startrek
new file mode 100644
index 0000000..af3f9d4
--- /dev/null
+++ b/usr.bin/fortune/datfiles/startrek
@@ -0,0 +1,759 @@
+%% $FreeBSD$
+%
+ "... freedom ... is a worship word..."
+ "It is our worship word too."
+ -- Cloud William and Kirk, "The Omega Glory", stardate unknown
+%
+ "Beauty is transitory."
+ "Beauty survives."
+ -- Spock and Kirk, "That Which Survives", stardate unknown
+%
+ "Can you imagine how life could be improved if we could do away
+with jealousy, greed, hate ..."
+ "It can also be improved by eliminating love, tenderness,
+sentiment -- the other side of the coin"
+ -- Dr. Roger Corby and Kirk,
+ "What are Little Girls Made Of?", stardate 2712.4
+%
+ "Evil does seek to maintain power by suppressing the truth."
+ "Or by misleading the innocent."
+ -- Spock and McCoy, "And The Children Shall Lead",
+ stardate 5029.5.
+%
+ "Get back to your stations!"
+ "We're beaming down to the planet, sir."
+ -- Kirk and Mr. Leslie, "This Side of Paradise",
+ stardate 3417.3
+%
+ "I think they're going to take all this money that we spend now
+on war and death --"
+ "And make them spend it on life."
+ -- Edith Keeler and Kirk, "The City on the Edge of Forever",
+ stardate unknown.
+%
+ "It's hard to believe that something which is neither seen nor
+felt can do so much harm."
+ "That's true. But an idea can't be seen or felt. And that's
+what kept the Troglytes in the mines all these centuries. A mistaken idea."
+ -- Vanna and Kirk, "The Cloud Minders", stardate 5819.0
+%
+ "Life and death are seldom logical."
+ "But attaining a desired goal always is."
+ -- McCoy and Spock, "The Galileo Seven", stardate 2821.7
+%
+ "Logic and practical information do not seem to apply here."
+ "You admit that?"
+ "To deny the facts would be illogical, Doctor"
+ -- Spock and McCoy, "A Piece of the Action", stardate unknown
+%
+ "No one talks peace unless he's ready to back it up with war."
+ "He talks of peace if it is the only way to live."
+ -- Colonel Green and Surak of Vulcan, "The Savage Curtain",
+ stardate 5906.5.
+%
+ "That unit is a woman."
+ "A mass of conflicting impulses."
+ -- Spock and Nomad, "The Changeling", stardate 3541.9
+%
+ "The combination of a number of things to make existence worthwhile."
+ "Yes, the philosophy of 'none,' meaning 'all.'"
+ -- Spock and Lincoln, "The Savage Curtain", stardate 5906.4
+%
+ "The glory of creation is in its infinite diversity."
+ "And in the way our differences combine to create meaning and
+beauty."
+ -- Dr. Miranda Jones and Spock,
+ "Is There in Truth No Beauty?", stardate 5630.8
+%
+ "The release of emotion is what keeps us healthy. Emotionally
+healthy."
+ "That may be, Doctor. However, I have noted that the healthy
+release of emotion is frequently unhealthy for those closest to you."
+ -- McCoy and Spock, "Plato's Stepchildren", stardate 5784.3
+%
+ "There's only one kind of woman ..."
+ "Or man, for that matter. You either believe in yourself or
+you don't."
+ -- Kirk and Harry Mudd, "Mudd's Women", stardate 1330.1
+%
+ "We have the right to survive!"
+ "Not by killing others."
+ -- Deela and Kirk, "Wink of An Eye", stardate 5710.5
+%
+ "What a terrible way to die."
+ "There are no good ways."
+ -- Sulu and Kirk, "That Which Survives", stardate unknown
+%
+ "What happened to the crewman?"
+ "The M-5 computer needed a new power source, the crewman merely
+got in the way."
+ -- Kirk and Dr. Richard Daystrom, "The Ultimate Computer",
+ stardate 4731.3.
+%
+... bacteriological warfare ... hard to believe we were once foolish
+enough to play around with that.
+ -- McCoy, "The Omega Glory", stardate unknown
+%
+... The prejudices people feel about each other disappear when they get
+to know each other.
+ -- Kirk, "Elaan of Troyius", stardate 4372.5
+%
+... The things love can drive a man to -- the ecstasies, the
+miseries, the broken rules, the desperate chances, the glorious
+failures and the glorious victories.
+ -- McCoy, "Requiem for Methuselah", stardate 5843.7
+%
+A father doesn't destroy his children.
+ -- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
+ stardate 3468.1.
+%
+A little suffering is good for the soul.
+ -- Kirk, "The Corbomite Maneuver", stardate 1514.0
+%
+A man either lives life as it happens to him, meets it head-on and
+licks it, or he turns his back on it and starts to wither away.
+ -- Dr. Boyce, "The Menagerie" ("The Cage"), stardate unknown
+%
+A princess should not be afraid -- not with a brave knight to protect
+her.
+ -- McCoy, "Shore Leave", stardate 3025.3
+%
+A star captain's most solemn oath is that he will give his life, even
+his entire crew, rather than violate the Prime Directive.
+ -- Kirk, "The Omega Glory", stardate unknown
+%
+A Vulcan can no sooner be disloyal than he can exist without
+breathing.
+ -- Kirk, "The Menagerie", stardate 3012.4
+%
+A woman should have compassion.
+ -- Kirk, "Catspaw", stardate 3018.2
+%
+Actual war is a very messy business. Very, very messy business.
+ -- Kirk, "A Taste of Armageddon", stardate 3193.0
+%
+After a time, you may find that "having" is not so pleasing a thing,
+after all, as "wanting." It is not logical, but it is often true.
+ -- Spock, "Amok Time", stardate 3372.7
+%
+All your people must learn before you can reach for the stars.
+ -- Kirk, "The Gamesters of Triskelion", stardate 3259.2
+%
+Another Armenia, Belgium ... the weak innocents who always seem to be
+located on a natural invasion route.
+ -- Kirk, "Errand of Mercy", stardate 3198.4
+%
+Another dream that failed. There's nothing sadder.
+ -- Kirk, "This side of Paradise", stardate 3417.3
+%
+Another war ... must it always be so? How many comrades have we lost
+in this way? ... Obedience. Duty. Death, and more death ...
+ -- Romulan Commander, "Balance of Terror", stardate 1709.2
+%
+Behind every great man, there is a woman -- urging him on.
+ -- Harry Mudd, "I, Mudd", stardate 4513.3
+%
+Blast medicine anyway! We've learned to tie into every organ in the
+human body but one. The brain! The brain is what life is all about.
+ -- McCoy, "The Menagerie", stardate 3012.4
+%
+But it's real. And if it's real it can be affected ... we may not be
+able to break it, but, I'll bet you credits to Navy Beans we can put a
+dent in it.
+ -- deSalle, "Catspaw", stardate 3018.2
+%
+Change is the essential process of all existence.
+ -- Spock, "Let That Be Your Last Battlefield", stardate 5730.2
+%
+Compassion -- that's the one thing no machine ever had. Maybe it's
+the one thing that keeps men ahead of them.
+ -- McCoy, "The Ultimate Computer", stardate 4731.3
+%
+Computers make excellent and efficient servants, but I have no wish to
+serve under them. Captain, a starship also runs on loyalty to one
+man. And nothing can replace it or him.
+ -- Spock, "The Ultimate Computer", stardate 4729.4
+%
+Conquest is easy. Control is not.
+ -- Kirk, "Mirror, Mirror", stardate unknown
+%
+Death. Destruction. Disease. Horror. That's what war is all about.
+That's what makes it a thing to be avoided.
+ -- Kirk, "A Taste of Armageddon", stardate 3193.0
+%
+Death, when unnecessary, is a tragic thing.
+ -- Flint, "Requiem for Methuselah", stardate 5843.7
+%
+Do you know about being with somebody? Wanting to be? If I had the
+whole universe, I'd give it to you, Janice. When I see you, I feel
+like I'm hungry all over. Do you know how that feels?
+ -- Charlie Evans, "Charlie X", stardate 1535.8
+%
+Do you know the one -- "All I ask is a tall ship, and a star to steer
+her by ..." You could feel the wind at your back, about you ... the
+sounds of the sea beneath you. And even if you take away the wind and
+the water, it's still the same. The ship is yours ... you can feel her
+... and the stars are still there.
+ -- Kirk, "The Ultimate Computer", stardate 4729.4
+%
+[Doctors and Bartenders], We both get the same two kinds of customers
+-- the living and the dying.
+ -- Dr. Boyce, "The Menagerie" ("The Cage"), stardate unknown
+%
+Each kiss is as the first.
+ -- Miramanee, Kirk's wife, "The Paradise Syndrome",
+ stardate 4842.6
+%
+Earth -- mother of the most beautiful women in the universe.
+ -- Apollo, "Who Mourns for Adonais?" stardate 3468.1
+%
+Either one of us, by himself, is expendable. Both of us are not.
+ -- Kirk, "The Devil in the Dark", stardate 3196.1
+%
+Emotions are alien to me. I'm a scientist.
+ -- Spock, "This Side of Paradise", stardate 3417.3
+%
+Even historians fail to learn from history -- they repeat the same
+mistakes.
+ -- John Gill, "Patterns of Force", stardate 2534.7
+%
+Every living thing wants to survive.
+ -- Spock, "The Ultimate Computer", stardate 4731.3
+%
+Extreme feminine beauty is always disturbing.
+ -- Spock, "The Cloud Minders", stardate 5818.4
+%
+Fascinating, a totally parochial attitude.
+ -- Spock, "Metamorphosis", stardate 3219.8
+%
+Fascinating is a word I use for the unexpected.
+ -- Spock, "The Squire of Gothos", stardate 2124.5
+%
+First study the enemy. Seek weakness.
+ -- Romulan Commander, "Balance of Terror", stardate 1709.2
+%
+Four thousand throats may be cut in one night by a running man.
+ -- Klingon Soldier, "Day of the Dove", stardate unknown
+%
+Genius doesn't work on an assembly line basis. You can't simply say,
+"Today I will be brilliant."
+ -- Kirk, "The Ultimate Computer", stardate 4731.3
+%
+He's dead, Jim
+ -- McCoy, "The Devil in the Dark", stardate 3196.1
+%
+History tends to exaggerate.
+ -- Col. Green, "The Savage Curtain", stardate 5906.4
+%
+Humans do claim a great deal for that particular emotion (love).
+ -- Spock, "The Lights of Zetar", stardate 5725.6
+%
+I am pleased to see that we have differences. May we together become
+greater than the sum of both of us.
+ -- Surak of Vulcan, "The Savage Curtain", stardate 5906.4
+%
+I have never understood the female capacity to avoid a direct answer to
+any question.
+ -- Spock, "This Side of Paradise", stardate 3417.3
+%
+I object to intellect without discipline; I object to power without
+constructive purpose.
+ -- Spock, "The Squire of Gothos", stardate 2124.5
+%
+I realize that command does have its fascination, even under
+circumstances such as these, but I neither enjoy the idea of command
+nor am I frightened of it. It simply exists, and I will do whatever
+logically needs to be done.
+ -- Spock, "The Galileo Seven", stardate 2812.7
+%
+I thought my people would grow tired of killing. But you were right,
+they see it is easier than trading. And it has its pleasures. I feel
+it myself. Like the hunt, but with richer rewards.
+ -- Apella, "A Private Little War", stardate 4211.8
+%
+If a man had a child who'd gone anti-social, killed perhaps, he'd still
+tend to protect that child.
+ -- McCoy, "The Ultimate Computer", stardate 4731.3
+%
+If I can have honesty, it's easier to overlook mistakes.
+ -- Kirk, "Space Seed", stardate 3141.9
+%
+If some day we are defeated, well, war has its fortunes, good and bad.
+ -- Commander Kor, "Errand of Mercy", stardate 3201.7
+%
+If there are self-made purgatories, then we all have to live in them.
+ -- Spock, "This Side of Paradise", stardate 3417.7
+%
+I'm a soldier, not a diplomat. I can only tell the truth.
+ -- Kirk, "Errand of Mercy", stardate 3198.9
+%
+I'm frequently appalled by the low regard you Earthmen have for life.
+ -- Spock, "The Galileo Seven", stardate 2822.3
+%
+Immortality consists largely of boredom.
+ -- Zefrem Cochrane, "Metamorphosis", stardate 3219.8
+%
+In the strict scientific sense we all feed on death -- even
+vegetarians.
+ -- Spock, "Wolf in the Fold", stardate 3615.4
+%
+Insufficient facts always invite danger.
+ -- Spock, "Space Seed", stardate 3141.9
+%
+Insults are effective only where emotion is present.
+ -- Spock, "Who Mourns for Adonais?" stardate 3468.1
+%
+Intuition, however illogical, is recognized as a command prerogative.
+ -- Kirk, "Obsession", stardate 3620.7
+%
+Is not that the nature of men and women -- that the pleasure is in the
+learning of each other?
+ -- Natira, the High Priestess of Yonada, "For the World is
+ Hollow and I Have Touched the Sky", stardate 5476.3.
+%
+Is truth not truth for all?
+ -- Natira, "For the World is Hollow and I have Touched
+ the Sky", stardate 5476.4.
+%
+It [being a Vulcan] means to adopt a philosophy, a way of life which is
+logical and beneficial. We cannot disregard that philosophy merely for
+personal gain, no matter how important that gain might be.
+ -- Spock, "Journey to Babel", stardate 3842.4
+%
+It is a human characteristic to love little animals, especially if
+they're attractive in some way.
+ -- McCoy, "The Trouble with Tribbles", stardate 4525.6
+%
+It is more rational to sacrifice one life than six.
+ -- Spock, "The Galileo Seven", stardate 2822.3
+%
+It is necessary to have purpose.
+ -- Alice #1, "I, Mudd", stardate 4513.3
+%
+It is undignified for a woman to play servant to a man who is not
+hers.
+ -- Spock, "Amok Time", stardate 3372.7
+%
+It would be illogical to assume that all conditions remain stable.
+ -- Spock, "The Enterprise Incident", stardate 5027.3
+%
+It would be illogical to kill without reason
+ -- Spock, "Journey to Babel", stardate 3842.4
+%
+It would seem that evil retreats when forcibly confronted
+ -- Yarnek of Excalbia, "The Savage Curtain", stardate 5906.5
+%
+I've already got a female to worry about. Her name is the Enterprise.
+ -- Kirk, "The Corbomite Maneuver", stardate 1514.0
+%
+Killing is stupid; useless!
+ -- McCoy, "A Private Little War", stardate 4211.8
+%
+Killing is wrong.
+ -- Losira, "That Which Survives", stardate unknown
+%
+Knowledge, sir, should be free to all!
+ -- Harry Mudd, "I, Mudd", stardate 4513.3
+%
+Landru! Guide us!
+ -- A Beta 3-oid, "The Return of the Archons", stardate 3157.4
+%
+Leave bigotry in your quarters; there's no room for it on the bridge.
+ -- Kirk, "Balance of Terror", stardate 1709.2
+%
+Live long and prosper.
+ -- Spock, "Amok Time", stardate 3372.7
+%
+Lots of people drink from the wrong bottle sometimes.
+ -- Edith Keeler, "The City on the Edge of Forever",
+ stardate unknown
+%
+Love sometimes expresses itself in sacrifice.
+ -- Kirk, "Metamorphosis", stardate 3220.3
+%
+Madness has no purpose. Or reason. But it may have a goal.
+ -- Spock, "The Alternative Factor", stardate 3088.7
+%
+Many Myths are based on truth
+ -- Spock, "The Way to Eden", stardate 5832.3
+%
+Men don't talk peace unless they're ready to back it up with war.
+ -- Col. Green, "The Savage Curtain", stardate 5906.4
+%
+Men of peace usually are [brave].
+ -- Spock, "The Savage Curtain", stardate 5906.5
+%
+Men will always be men -- no matter where they are.
+ -- Harry Mudd, "Mudd's Women", stardate 1329.8
+%
+Military secrets are the most fleeting of all.
+ -- Spock, "The Enterprise Incident", stardate 5027.4
+%
+Most legends have their basis in facts.
+ -- Kirk, "And The Children Shall Lead", stardate 5029.5
+%
+Murder is contrary to the laws of man and God.
+ -- M-5 Computer, "The Ultimate Computer", stardate 4731.3
+%
+No more blah, blah, blah!
+ -- Kirk, "Miri", stardate 2713.6
+%
+No one can guarantee the actions of another.
+ -- Spock, "Day of the Dove", stardate unknown
+%
+No one may kill a man. Not for any purpose. It cannot be condoned.
+ -- Kirk, "Spock's Brain", stardate 5431.6
+%
+No one wants war.
+ -- Kirk, "Errand of Mercy", stardate 3201.7
+%
+No problem is insoluble.
+ -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4
+%
+Not one hundred percent efficient, of course ... but nothing ever is.
+ -- Kirk, "Metamorphosis", stardate 3219.8
+%
+Oblivion together does not frighten me, beloved.
+ -- Thalassa (in Anne Mulhall's body), "Return to Tomorrow",
+ stardate 4770.3.
+%
+Oh, that sound of male ego. You travel halfway across the galaxy and
+it's still the same song.
+ -- Eve McHuron, "Mudd's Women", stardate 1330.1
+%
+On my planet, to rest is to rest -- to cease using energy. To me, it
+is quite illogical to run up and down on green grass, using energy,
+instead of saving it.
+ -- Spock, "Shore Leave", stardate 3025.2
+%
+One does not thank logic.
+ -- Sarek, "Journey to Babel", stardate 3842.4
+%
+One of the advantages of being a captain is being able to ask for
+advice without necessarily having to take it.
+ -- Kirk, "Dagger of the Mind", stardate 2715.2
+%
+Only a fool fights in a burning house.
+ -- Kang the Klingon, "Day of the Dove", stardate unknown
+%
+Our missions are peaceful -- not for conquest. When we do battle, it
+is only because we have no choice.
+ -- Kirk, "The Squire of Gothos", stardate 2124.5
+%
+Our way is peace.
+ -- Septimus, the Son Worshiper, "Bread and Circuses",
+ stardate 4040.7.
+%
+Pain is a thing of the mind. The mind can be controlled.
+ -- Spock, "Operation -- Annihilate!" stardate 3287.2
+%
+Peace was the way.
+ -- Kirk, "The City on the Edge of Forever", stardate unknown
+%
+Power is danger.
+ -- The Centurion, "Balance of Terror", stardate 1709.2
+%
+Prepare for tomorrow -- get ready.
+ -- Edith Keeler, "The City On the Edge of Forever",
+ stardate unknown
+%
+Punishment becomes ineffective after a certain point. Men become
+insensitive.
+ -- Eneg, "Patterns of Force", stardate 2534.7
+%
+Respect is a rational process
+ -- McCoy, "The Galileo Seven", stardate 2822.3
+%
+Romulan women are not like Vulcan females. We are not dedicated to
+pure logic and the sterility of non-emotion.
+ -- Romulan Commander, "The Enterprise Incident",
+ stardate 5027.3
+%
+Schshschshchsch.
+ -- The Gorn, "Arena", stardate 3046.2
+%
+Sometimes a feeling is all we humans have to go on.
+ -- Kirk, "A Taste of Armageddon", stardate 3193.9
+%
+Sometimes a man will tell his bartender things he'll never tell his doctor.
+ -- Dr. Phillip Boyce, "The Menagerie" ("The Cage"),
+ stardate unknown.
+%
+Star Trek Lives!
+%
+Suffocating together ... would create heroic camaraderie.
+ -- Khan Noonian Singh, "Space Seed", stardate 3142.8
+%
+Superior ability breeds superior ambition.
+ -- Spock, "Space Seed", stardate 3141.9
+%
+The face of war has never changed. Surely it is more logical to heal
+than to kill.
+ -- Surak of Vulcan, "The Savage Curtain", stardate 5906.5
+%
+The games have always strengthened us. Death becomes a familiar
+pattern. We don't fear it as you do.
+ -- Proconsul Marcus Claudius, "Bread and Circuses",
+ stardate 4041.2
+%
+The heart is not a logical organ.
+ -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4
+%
+The idea of male and female are universal constants.
+ -- Kirk, "Metamorphosis", stardate 3219.8
+%
+The joys of love made her human and the agonies of love destroyed her.
+ -- Spock, "Requiem for Methuselah", stardate 5842.8
+%
+The man on tops walks a lonely street; the "chain" of command is often
+a noose.
+ -- McCoy, "The Conscience of the King," stardate 2818.9
+%
+The more complex the mind, the greater the need for the simplicity of
+play.
+ -- Kirk, "Shore Leave", stardate 3025.8
+%
+The only solution is ... a balance of power. We arm our side with
+exactly that much more. A balance of power -- the trickiest, most
+difficult, dirtiest game of them all. But the only one that preserves
+both sides.
+ -- Kirk, "A Private Little War", stardate 4211.8
+%
+The people of Gideon have always believed that life is sacred. That
+the love of life is the greatest gift ... We are incapable of
+destroying or interfering with the creation of that which we love so
+deeply -- life in every form from fetus to developed being.
+ -- Hodin of Gideon, "The Mark of Gideon", stardate 5423.4
+%
+The sight of death frightens them [Earthers].
+ -- Kras the Klingon, "Friday's Child", stardate 3497.2
+%
+The sooner our happiness together begins, the longer it will last.
+ -- Miramanee, "The Paradise Syndrome", stardate 4842.6
+%
+There are always alternatives.
+ -- Spock, "The Galileo Seven", stardate 2822.3
+%
+There are certain things men must do to remain men.
+ -- Kirk, "The Ultimate Computer", stardate 4929.4
+%
+There are some things worth dying for.
+ -- Kirk, "Errand of Mercy", stardate 3201.7
+%
+There comes to all races an ultimate crisis which you have yet to face
+.... One day our minds became so powerful we dared think of ourselves
+as gods.
+ -- Sargon, "Return to Tomorrow", stardate 4768.3
+%
+There is a multi-legged creature crawling on your shoulder.
+ -- Spock, "A Taste of Armageddon", stardate 3193.9
+%
+There is an old custom among my people. When a woman saves a man's
+life, he is grateful.
+ -- Nona, the Kanuto witch woman, "A Private Little War",
+ stardate 4211.8.
+%
+There is an order of things in this universe.
+ -- Apollo, "Who Mourns for Adonais?" stardate 3468.1
+%
+There's a way out of any cage.
+ -- Captain Christopher Pike, "The Menagerie" ("The Cage"),
+ stardate unknown.
+%
+There's another way to survive. Mutual trust -- and help.
+ -- Kirk, "Day of the Dove", stardate unknown
+%
+There's no honorable way to kill, no gentle way to destroy. There is
+nothing good in war. Except its ending.
+ -- Abraham Lincoln, "The Savage Curtain", stardate 5906.5
+%
+There's nothing disgusting about it [the Companion]. It's just another
+life form, that's all. You get used to those things.
+ -- McCoy, "Metamorphosis", stardate 3219.8
+%
+This cultural mystique surrounding the biological function -- you
+realize humans are overly preoccupied with the subject.
+ -- Kelinda the Kelvan, "By Any Other Name", stardate 4658.9
+%
+Those who hate and fight must stop themselves -- otherwise it is not
+stopped.
+ -- Spock, "Day of the Dove", stardate unknown
+%
+Time is fluid ... like a river with currents, eddies, backwash.
+ -- Spock, "The City on the Edge of Forever", stardate 3134.0
+%
+To live is always desirable.
+ -- Eleen the Capellan, "Friday's Child", stardate 3498.9
+%
+Too much of anything, even love, isn't necessarily a good thing.
+ -- Kirk, "The Trouble with Tribbles", stardate 4525.6
+%
+Totally illogical, there was no chance.
+ -- Spock, "The Galileo Seven", stardate 2822.3
+%
+Uncontrolled power will turn even saints into savages. And we can all
+be counted on to live down to our lowest impulses.
+ -- Parmen, "Plato's Stepchildren", stardate 5784.3
+%
+Violence in reality is quite different from theory.
+ -- Spock, "The Cloud Minders", stardate 5818.4
+%
+Virtue is a relative term.
+ -- Spock, "Friday's Child", stardate 3499.1
+%
+Vulcans believe peace should not depend on force.
+ -- Amanda, "Journey to Babel", stardate 3842.3
+%
+Vulcans do not approve of violence.
+ -- Spock, "Journey to Babel", stardate 3842.4
+%
+Vulcans never bluff.
+ -- Spock, "The Doomsday Machine", stardate 4202.1
+%
+Vulcans worship peace above all.
+ -- McCoy, "Return to Tomorrow", stardate 4768.3
+%
+Wait! You have not been prepared!
+ -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2
+%
+[War] is instinctive. But the instinct can be fought. We're human
+beings with the blood of a million savage years on our hands! But we
+can stop it. We can admit that we're killers ... but we're not going
+to kill today. That's all it takes! Knowing that we're not going to
+kill today!
+ -- Kirk, "A Taste of Armageddon", stardate 3193.0
+%
+War is never imperative.
+ -- McCoy, "Balance of Terror", stardate 1709.2
+%
+War isn't a good life, but it's life.
+ -- Kirk, "A Private Little War", stardate 4211.8
+%
+We do not colonize. We conquer. We rule. There is no other way for
+us.
+ -- Rojan, "By Any Other Name", stardate 4657.5
+%
+We fight only when there is no other choice. We prefer the ways of
+peaceful contact.
+ -- Kirk, "Spectre of the Gun", stardate 4385.3
+%
+We have found all life forms in the galaxy are capable of superior
+development.
+ -- Kirk, "The Gamesters of Triskelion", stardate 3211.7
+%
+We have phasers, I vote we blast 'em!
+ -- Bailey, "The Corbomite Maneuver", stardate 1514.2
+%
+We Klingons believe as you do -- the sick should die. Only the strong
+should live.
+ -- Kras, "Friday's Child", stardate 3497.2
+%
+We're all sorry for the other guy when he loses his job to a machine.
+But when it comes to your job -- that's different. And it always will
+be different.
+ -- McCoy, "The Ultimate Computer", stardate 4729.4
+%
+What kind of love is that? Not to be loved; never to have shown love.
+ -- Commissioner Nancy Hedford, "Metamorphosis",
+ stardate 3219.8
+%
+When a child is taught ... it's programmed with simple instructions --
+and at some point, if its mind develops properly, it exceeds the sum of
+what it was taught, thinks independently.
+ -- Dr. Richard Daystrom, "The Ultimate Computer",
+ stardate 4731.3.
+%
+When dreams become more important than reality, you give up travel,
+building, creating; you even forget how to repair the machines left
+behind by your ancestors. You just sit living and reliving other lives
+left behind in the thought records.
+ -- Vina, "The Menagerie" ("The Cage"), stardate unknown
+%
+Where there's no emotion, there's no motive for violence.
+ -- Spock, "Dagger of the Mind", stardate 2715.1
+%
+Witch! Witch! They'll burn ya!
+ -- Hag, "Tomorrow is Yesterday", stardate unknown
+%
+Without facts, the decision cannot be made logically. You must rely on
+your human intuition.
+ -- Spock, "Assignment: Earth", stardate unknown
+%
+Without followers, evil cannot spread.
+ -- Spock, "And The Children Shall Lead", stardate 5029.5
+%
+Without freedom of choice there is no creativity.
+ -- Kirk, "The return of the Archons", stardate 3157.4
+%
+Women are more easily and more deeply terrified ... generating more
+sheer horror than the male of the species.
+ -- Spock, "Wolf in the Fold", stardate 3615.4
+%
+Women professionals do tend to over-compensate.
+ -- Dr. Elizabeth Dehner, "Where No Man Has Gone Before",
+ stardate 1312.9.
+%
+Worlds are conquered, galaxies destroyed -- but a woman is always a
+woman.
+ -- Kirk, "Conscience of the King", stardate unknown
+%
+Worlds may change, galaxies disintegrate, but a woman always remains a
+woman.
+ -- Kirk, "The Conscience of the King", stardate 2818.9
+%
+Yes, it is written. Good shall always destroy evil.
+ -- Sirah the Yang, "The Omega Glory", stardate unknown
+%
+You! What PLANET is this?!
+ -- McCoy, "The City on the Edge of Forever", stardate 3134.0
+%
+You are an excellent tactician, Captain. You let your second in
+command attack while you sit and watch for weakness.
+ -- Khan Noonian Singh, "Space Seed", stardate 3141.9
+%
+You can't evaluate a man by logic alone.
+ -- McCoy, "I, Mudd", stardate 4513.3
+%
+You Earth people glorified organized violence for forty centuries. But
+you imprison those who employ it privately.
+ -- Spock, "Dagger of the Mind", stardate 2715.1
+%
+You go slow, be gentle. It's no one-way street -- you know how you
+feel and that's all. It's how the girl feels too. Don't press. If
+the girl feels anything for you at all, you'll know.
+ -- Kirk, "Charlie X", stardate 1535.8
+%
+You humans have that emotional need to express gratitude. "You're
+welcome," I believe, is the correct response.
+ -- Spock, "Bread and Circuses", stardate 4041.2
+%
+You say you are lying. But if everything you say is a lie, then you
+are telling the truth. You cannot tell the truth because everything
+you say is a lie. You lie, you tell the truth ... but you cannot, for
+you lie.
+ -- Norman the android, "I, Mudd", stardate 4513.3
+%
+You speak of courage. Obviously you do not know the difference between
+courage and foolhardiness. Always it is the brave ones who die, the
+soldiers.
+ -- Kor, the Klingon Commander, "Errand of Mercy",
+ stardate 3201.7
+%
+You'll learn something about men and women -- the way they're supposed
+to be. Caring for each other, being happy with each other, being good
+to each other. That's what we call love. You'll like that a lot.
+ -- Kirk, "The Apple", stardate 3715.6
+%
+You're dead, Jim.
+ -- McCoy, "Amok Time", stardate 3372.7
+%
+You're dead, Jim.
+ -- McCoy, "The Tholian Web", stardate unknown
+%
+You're too beautiful to ignore. Too much woman.
+ -- Kirk to Yeoman Rand, "The Enemy Within", stardate unknown
+%
+Youth doesn't excuse everything.
+ -- Dr. Janice Lester (in Kirk's body), "Turnabout Intruder",
+ stardate 5928.5.
+%
diff --git a/usr.bin/fortune/datfiles/startrek.sp.ok b/usr.bin/fortune/datfiles/startrek.sp.ok
new file mode 100644
index 0000000..ccca709
--- /dev/null
+++ b/usr.bin/fortune/datfiles/startrek.sp.ok
@@ -0,0 +1,86 @@
+# $FreeBSD$
+Adonais
+Amanda
+Apella
+Archons
+Armenia
+Atoz
+Capellan
+Catspaw
+Centurion
+Changeling
+Claudius
+Corbomite
+Corby
+Daystrom
+Deela
+Elaan
+Eleen
+Eneg
+Excalbia
+Galileo
+Gorn
+Gothos
+Hag
+Hedford
+Hodin
+Kang
+Kanuto
+Kelinda
+Kelvan
+Klingon
+Klingons
+Kor
+Kras
+Landru
+Losira
+Lt
+McHuron
+Miramanee
+Miri
+Mulhall's
+Natira
+Nomad
+Nona
+Noonian
+Palamas
+Parmen
+Phillip
+Priestess
+Proconsul
+Requiem
+Rojan
+Romulan
+Sarek
+Sargon
+Schshschshchsch
+Septimus
+Singh
+Sirah
+Spectre
+Spock
+Spock's
+Stepchildren
+Sulu
+Surak
+Thalassa
+Tholian
+Tribbles
+Triskelion
+Troglytes
+Troyius
+Vanna
+Vina
+Yarnek
+Yonada
+Zefrem
+Zetar
+android
+backwash
+bacteriological
+blah
+deSalle
+oid
+stardate
+tactician
+ya
diff --git a/usr.bin/fortune/datfiles/zippy b/usr.bin/fortune/datfiles/zippy
new file mode 100644
index 0000000..7c43436
--- /dev/null
+++ b/usr.bin/fortune/datfiles/zippy
@@ -0,0 +1,1335 @@
+%% $FreeBSD$
+%
+ Talking Pinhead Blues:
+Oh, I LOST my ``HELLO KITTY'' DOLL and I get BAD reception on channel
+ TWENTY-SIX!!
+
+Th'HOSTESS FACTORY is closin' down and I just heard ZASU PITTS has been
+ DEAD for YEARS.. (sniff)
+
+My PLATFORM SHOE collection was CHEWED up by th' dog, ALEXANDER HAIG
+ won't let me take a SHOWER 'til Easter ... (snurf)
+
+So I went to the kitchen, but WALNUT PANELING whup me upside mah HAID!!
+ (on no, no, no.. Heh, heh)
+%
+... bleakness ... desolation ... plastic forks ...
+%
+... he dominates the DECADENT SUBWAY SCENE.
+%
+... I don't know why but, suddenly, I want to discuss declining I.Q.
+LEVELS with a blue ribbon SENATE SUB-COMMITTEE!
+%
+... I don't like FRANK SINATRA or his CHILDREN.
+%
+... I have read the INSTRUCTIONS ...
+%
+-- I have seen the FUN --
+%
+-- I love KATRINKA because she drives a PONTIAC. We're going away
+now. I fed the cat.
+%
+... I see TOILET SEATS ...
+%
+... I think I'd better go back to my DESK and toy with a few common
+MISAPPREHENSIONS ...
+%
+... I want a COLOR T.V. and a VIBRATING BED!!!
+%
+... I want FORTY-TWO TRYNEL FLOATATION SYSTEMS installed within
+SIX AND A HALF HOURS!!!
+%
+... ich bin in einem dusenjet ins jahr 53 vor chr ... ich lande im
+antiken Rom ... einige gladiatoren spielen scrabble ... ich rieche
+PIZZA ...
+%
+... If I had heart failure right now, I couldn't be a more fortunate
+man!!
+%
+... I'm IMAGINING a sensuous GIRAFFE, CAVORTING in the BACK ROOM
+of a KOSHER DELI --
+%
+... My pants just went on a wild rampage through a Long Island Bowling
+Alley!!
+%
+... Now, it's time to "HAVE A NAGEELA"!!
+%
+... or were you driving the PONTIAC that HONKED at me in MIAMI last
+Tuesday?
+%
+... the HIGHWAY is made out of LIME JELLO and my HONDA is a barbequeued
+OYSTER! Yum!
+%
+... the MYSTERIANS are in here with my CORDUROY SOAP DISH!!
+%
+... this must be what it's like to be a COLLEGE GRADUATE!!
+%
+A can of ASPARAGUS, 73 pigeons, some LIVE ammo, and a FROZEN DAQUIRI!!
+%
+A dwarf is passing out somewhere in Detroit!
+%
+A shapely CATHOLIC SCHOOLGIRL is FIDGETING inside my costume..
+%
+A wide-eyed, innocent UNICORN, poised delicately in a MEADOW filled
+with LILACS, LOLLIPOPS & small CHILDREN at the HUSH of twilight??
+%
+Actually, what I'd like is a little toy spaceship!!
+%
+All I can think of is a platter of organic PRUNE CRISPS being trampled
+by an army of swarthy, Italian LOUNGE SINGERS ...
+%
+All of a sudden, I want to THROW OVER my promising ACTING CAREER, grow
+a LONG BLACK BEARD and wear a BASEBALL HAT!! ... Although I don't know
+WHY!!
+%
+All of life is a blur of Republicans and meat!
+%
+All right, you degenerates! I want this place evacuated in 20 seconds!
+%
+All this time I've been VIEWING a RUSSIAN MIDGET SODOMIZE a HOUSECAT!
+%
+Alright, you!! Imitate a WOUNDED SEAL pleading for a PARKING SPACE!!
+%
+Am I accompanied by a PARENT or GUARDIAN?
+%
+Am I elected yet?
+%
+Am I in GRADUATE SCHOOL yet?
+%
+Am I SHOPLIFTING?
+%
+America!! I saw it all!! Vomiting! Waving! JERRY FALWELLING into
+your void tube of UHF oblivion!! SAFEWAY of the mind ...
+%
+An air of FRENCH FRIES permeates my nostrils!!
+%
+An INK-LING? Sure -- TAKE one!! Did you BUY any COMMUNIST UNIFORMS??
+%
+An Italian is COMBING his hair in suburban DES MOINES!
+%
+And furthermore, my bowling average is unimpeachable!!!
+%
+ANN JILLIAN'S HAIR makes LONI ANDERSON'S HAIR look like RICARDO
+MONTALBAN'S HAIR!
+%
+Are the STEWED PRUNES still in the HAIR DRYER?
+%
+Are we live or on tape?
+%
+Are we on STRIKE yet?
+%
+Are we THERE yet?
+%
+Are we THERE yet? My MIND is a SUBMARINE!!
+%
+Are you mentally here at Pizza Hut??
+%
+Are you selling NYLON OIL WELLS?? If so, we can use TWO DOZEN!!
+%
+Are you still an ALCOHOLIC?
+%
+As President I have to go vacuum my coin collection!
+%
+Awright, which one of you hid my PENIS ENVY?
+%
+BARBARA STANWYCK makes me nervous!!
+%
+Barbie says, Take quaaludes in gin and go to a disco right away!
+But Ken says, WOO-WOO!! No credit at "Mr. Liquor"!!
+%
+BARRY ... That was the most HEART-WARMING rendition of "I DID IT MY
+WAY" I've ever heard!!
+%
+Being a BALD HERO is almost as FESTIVE as a TATTOOED KNOCKWURST.
+%
+BELA LUGOSI is my co-pilot ...
+%
+BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-
+%
+Bo Derek ruined my life!
+%
+Boy, am I glad it's only 1971...
+%
+Boys, you have ALL been selected to LEAVE th' PLANET in 15 minutes!!
+%
+But they went to MARS around 1953!!
+%
+But was he mature enough last night at the lesbian masquerade?
+%
+Calling J-Man Kink. Calling J-Man Kink. Hash missile sighted, target
+Los Angeles. Disregard personal feelings about city and intercept.
+%
+Can I have an IMPULSE ITEM instead?
+%
+Can you MAIL a BEAN CAKE?
+%
+Catsup and Mustard all over the place! It's the Human Hamburger!
+%
+CHUBBY CHECKER just had a CHICKEN SANDWICH in downtown DULUTH!
+%
+Civilization is fun! Anyway, it keeps me busy!!
+%
+Clear the laundromat!! This whirl-o-matic just had a nuclear meltdown!!
+%
+Concentrate on th'cute, li'l CARTOON GUYS! Remember the SERIAL
+NUMBERS!! Follow the WHIPPLE AVE. EXIT!! Have a FREE PEPSI!! Turn
+LEFT at th'HOLIDAY INN!! JOIN the CREDIT WORLD!! MAKE me an OFFER!!!
+%
+CONGRATULATIONS! Now should I make thinly veiled comments about
+DIGNITY, self-esteem and finding TRUE FUN in your RIGHT VENTRICLE??
+%
+Content: 80% POLYESTER, 20% DACRON ... The waitress's UNIFORM sheds
+TARTAR SAUCE like an 8" by 10" GLOSSY ...
+%
+Could I have a drug overdose?
+%
+Did an Italian CRANE OPERATOR just experience uninhibited sensations in
+a MALIBU HOT TUB?
+%
+Did I do an INCORRECT THING??
+%
+Did I say I was a sardine? Or a bus???
+%
+Did I SELL OUT yet??
+%
+Did YOU find a DIGITAL WATCH in YOUR box of VELVEETA?
+%
+Did you move a lot of KOREAN STEAK KNIVES this trip, Dingy?
+%
+DIDI ... is that a MARTIAN name, or, are we in ISRAEL?
+%
+Didn't I buy a 1951 Packard from you last March in Cairo?
+%
+Disco oil bussing will create a throbbing naugahyde pipeline running
+straight to the tropics from the rug producing regions and devalue the
+dollar!
+%
+Do I have a lifestyle yet?
+%
+Do you guys know we just passed thru a BLACK HOLE in space?
+%
+Do you have exactly what I want in a plaid poindexter bar bat??
+%
+Do you like "TENDER VITTLES"?
+%
+Do you think the "Monkees" should get gas on odd or even days?
+%
+Does someone from PEORIA have a SHORTER ATTENTION span than me?
+%
+does your DRESSING ROOM have enough ASPARAGUS?
+%
+DON'T go!! I'm not HOWARD COSELL!! I know POLISH JOKES ... WAIT!!
+Don't go!! I AM Howard Cosell! ... And I DON'T know Polish jokes!!
+%
+Don't hit me!! I'm in the Twilight Zone!!!
+%
+Don't SANFORIZE me!!
+%
+Don't worry, nobody really LISTENS to lectures in MOSCOW, either! ...
+FRENCH, HISTORY, ADVANCED CALCULUS, COMPUTER PROGRAMMING, BLACK
+STUDIES, SOCIOBIOLOGY! ... Are there any QUESTIONS??
+%
+Edwin Meese made me wear CORDOVANS!!
+%
+Eisenhower!! Your mimeograph machine upsets my stomach!!
+%
+Either CONFESS now or we go to "PEOPLE'S COURT"!!
+%
+Everybody gets free BORSCHT!
+%
+Everybody is going somewhere!! It's probably a garage sale or a
+disaster Movie!!
+%
+Everywhere I look I see NEGATIVITY and ASPHALT ...
+%
+Excuse me, but didn't I tell you there's NO HOPE for the survival of
+OFFSET PRINTING?
+%
+FEELINGS are cascading over me!!!
+%
+Finally, Zippy drives his 1958 RAMBLER METROPOLITAN into the faculty
+dining room.
+%
+First, I'm going to give you all the ANSWERS to today's test ... So
+just plug in your SONY WALKMANS and relax!!
+%
+FOOLED you! Absorb EGO SHATTERING impulse rays, polyester poltroon!!
+%
+for ARTIFICIAL FLAVORING!!
+%
+Four thousand different MAGNATES, MOGULS & NABOBS are romping in my
+gothic solarium!!
+%
+FROZEN ENTREES may be flung by members of opposing SWANSON SECTS ...
+%
+FUN is never having to say you're SUSHI!!
+%
+Gee, I feel kind of LIGHT in the head now, knowing I can't make my
+satellite dish PAYMENTS!
+%
+Gibble, Gobble, we ACCEPT YOU ...
+%
+Give them RADAR-GUIDED SKEE-BALL LANES and VELVEETA BURRITOS!!
+%
+Go on, EMOTE! I was RAISED on thought balloons!!
+%
+GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my
+pet LEISURE SUIT!!
+%
+HAIR TONICS, please!!
+%
+Half a mind is a terrible thing to waste!
+%
+Hand me a pair of leather pants and a CASIO keyboard -- I'm living for
+today!
+%
+Has everybody got HALVAH spread all over their ANKLES?? ... Now, it's
+time to "HAVE A NAGEELA"!!
+%
+He is the MELBA-BEING ... the ANGEL CAKE ... XEROX him ... XEROX him --
+%
+He probably just wants to take over my CELLS and then EXPLODE inside me
+like a BARREL of runny CHOPPED LIVER! Or maybe he'd like to
+PSYCHOLOGICALLY TERRORISE ME until I have no objection to a RIGHT-WING
+MILITARY TAKEOVER of my apartment!! I guess I should call AL PACINO!
+%
+Hello? Enema Bondage? I'm calling because I want to be happy, I
+guess ...
+%
+Hello. I know the divorce rate among unmarried Catholic Alaskan
+females!!
+%
+Hello... IRON CURTAIN? Send over a SAUSAGE PIZZA! World War III? No
+thanks!
+%
+Hello. Just walk along and try NOT to think about your INTESTINES
+being almost FORTY YARDS LONG!!
+%
+HELLO, everybody, I'm a HUMAN!!
+%
+Hello, GORRY-O!! I'm a GENIUS from HARVARD!!
+%
+HELLO KITTY gang terrorizes town, family STICKERED to death!
+%
+Here I am at the flea market but nobody is buying my urine sample
+bottles ...
+%
+Here I am in 53 B.C. and all I want is a dill pickle!!
+%
+Here I am in the POSTERIOR OLFACTORY LOBULE but I don't see CARL SAGAN
+anywhere!!
+%
+Here we are in America ... when do we collect unemployment?
+%
+Hey, wait a minute!! I want a divorce!! ... you're not Clint Eastwood!!
+%
+Hey, waiter! I want a NEW SHIRT and a PONY TAIL with lemon sauce!
+%
+Hiccuping & trembling into the WASTE DUMPS of New Jersey like some
+drunken CABBAGE PATCH DOLL, coughing in line at FIORUCCI'S!!
+%
+Hmmm ... a CRIPPLED ACCOUNTANT with a FALAFEL sandwich is HIT by a
+TROLLEY-CAR ...
+%
+Hmmm ... A hash-singer and a cross-eyed guy were SLEEPING on a deserted
+island, when ...
+%
+Hmmm ... a PINHEAD, during an EARTHQUAKE, encounters an ALL-MIDGET
+FIDDLE ORCHESTRA ... ha ... ha ...
+%
+Hmmm ... an arrogant bouquet with a subtle suggestion of POLYVINYL
+CHLORIDE ...
+%
+Hold the MAYO & pass the COSMIC AWARENESS ...
+%
+HOORAY, Ronald!! Now YOU can marry LINDA RONSTADT too!!
+%
+How do I get HOME?
+%
+How do you explain Wayne Newton's POWER over millions? It's th'
+MOUSTACHE ... Have you ever noticed th' way it radiates SINCERITY,
+HONESTY & WARMTH? It's a MOUSTACHE you want to take HOME and introduce
+to NANCY SINATRA!
+%
+How many retired bricklayers from FLORIDA are out purchasing PENCIL
+SHARPENERS right NOW??
+%
+How's it going in those MODULAR LOVE UNITS??
+%
+How's the wife? Is she at home enjoying capitalism?
+%
+hubub, hubub, HUBUB, hubub, hubub, hubub, HUBUB, hubub, hubub, hubub.
+%
+HUGH BEAUMONT died in 1982!!
+%
+HUMAN REPLICAS are inserted into VATS of NUTRITIONAL YEAST ...
+%
+I always have fun because I'm out of my mind!!!
+%
+I am a jelly donut. I am a jelly donut.
+%
+I am a traffic light, and Alan Ginzberg kidnapped my laundry in 1927!
+%
+I am covered with pure vegetable oil and I am writing a best seller!
+%
+I am deeply CONCERNED and I want something GOOD for BREAKFAST!
+%
+I am having FUN... I wonder if it's NET FUN or GROSS FUN?
+%
+I am NOT a nut....
+%
+I appoint you ambassador to Fantasy Island!!!
+%
+I brought my BOWLING BALL -- and some DRUGS!!
+%
+I can't decide which WRONG TURN to make first!!
+%
+I can't decide which WRONG TURN to make first!! I wonder if BOB
+GUCCIONE has these problems!
+%
+I can't think about that. It doesn't go with HEDGES in the shape of
+LITTLE LULU -- or ROBOTS making BRICKS ...
+%
+I demand IMPUNITY!
+%
+I didn't order any WOO-WOO ... Maybe a YUBBA ... But no WOO-WOO!
+%
+I don't believe there really IS a GAS SHORTAGE ... I think it's all
+just a BIG HOAX on the part of the plastic sign salesmen -- to sell
+more numbers!!
+%
+I don't know WHY I said that ... I think it came from the FILLINGS in
+my read molars ...
+%
+I don't understand the HUMOUR of the THREE STOOGES!!
+%
+I feel ... JUGULAR ...
+%
+I feel better about world problems now!
+%
+I feel like a wet parking meter on Darvon!
+%
+I feel like I am sharing a ``CORN-DOG'' with NIKITA KHRUSHCHEV ...
+%
+I feel like I'm in a Toilet Bowl with a thumbtack in my forehead!!
+%
+I feel partially hydrogenated!
+%
+I fill MY industrial waste containers with old copies of the
+"WATCHTOWER" and then add HAWAIIAN PUNCH to the top ... They look NICE
+in the yard ...
+%
+I guess it was all a DREAM ... or an episode of HAWAII FIVE-O ...
+%
+I guess you guys got BIG MUSCLES from doing too much STUDYING!
+%
+I had a lease on an OEDIPUS COMPLEX back in '81 ...
+%
+I had pancake makeup for brunch!
+%
+I have a TINY BOWL in my HEAD
+%
+I have a very good DENTAL PLAN. Thank you.
+%
+I have a VISION! It's a RANCID double-FISHWICH on an ENRICHED BUN!!
+%
+I have accepted Provolone into my life!
+%
+I have many CHARTS and DIAGRAMS..
+%
+I have seen these EGG EXTENDERS in my Supermarket ...
+%
+I have seen these EGG EXTENDERS in my Supermarket ... I have read the
+INSTRUCTIONS ...
+%
+I have the power to HALT PRODUCTION on all TEENAGE SEX COMEDIES!!
+%
+I HAVE to buy a new "DODGE MISER" and two dozen JORDACHE JEANS because
+my viewscreen is "USER-FRIENDLY"!!
+%
+I haven't been married in over six years, but we had sexual counseling
+every day from Oral Roberts!!
+%
+I hope I bought the right relish ... zzzzzzzzz ...
+%
+I hope something GOOD came in the mail today so I have a REASON to
+live!!
+%
+I hope the ``Eurythmics'' practice birth control ...
+%
+I hope you millionaires are having fun! I just invested half your life
+savings in yeast!!
+%
+I invented skydiving in 1989!
+%
+I joined scientology at a garage sale!!
+%
+I just forgot my whole philosophy of life!!!
+%
+I just got my PRINCE bumper sticker ... But now I can't remember WHO he
+is ...
+%
+I just had a NOSE JOB!!
+%
+I just had my entire INTESTINAL TRACT coated with TEFLON!
+%
+I just heard the SEVENTIES were over!! And I was just getting in touch
+with my LEISURE SUIT!!
+%
+I just remembered something about a TOAD!
+%
+I KAISER ROLL?! What good is a Kaiser Roll without a little COLE SLAW
+on the SIDE?
+%
+I Know A Joke
+%
+I know how to do SPECIAL EFFECTS!!
+%
+I know things about TROY DONAHUE that can't even be PRINTED!!
+%
+I know th'MAMBO!! I have a TWO-TONE CHEMISTRY SET!!
+%
+I left my WALLET in the BATHROOM!!
+%
+I like the way ONLY their mouths move ... They look like DYING OYSTERS
+%
+I like your SNOOPY POSTER!!
+%
+I love ROCK 'N ROLL! I memorized the all WORDS to "WIPE-OUT" in
+1965!!
+%
+I need to discuss BUY-BACK PROVISIONS with at least six studio
+SLEAZEBALLS!!
+%
+I once decorated my apartment entirely in ten foot salad forks!!
+%
+I own seven-eighths of all the artists in downtown Burbank!
+%
+I put aside my copy of "BOWLING WORLD" and think about GUN CONTROL
+legislation..
+%
+I represent a sardine!!
+%
+I request a weekend in Havana with Phil Silvers!
+%
+I selected E5 ... but I didn't hear "Sam the Sham and the Pharoahs"!
+%
+I smell a RANCID CORN DOG!
+%
+I smell like a wet reducing clinic on Columbus Day!
+%
+I think I am an overnight sensation right now!!
+%
+I think I'll KILL myself by leaping out of this 14th STORY WINDOW while
+reading ERICA JONG'S poetry!!
+%
+I think my career is ruined!
+%
+I used to be a FUNDAMENTALIST, but then I heard about the HIGH
+RADIATION LEVELS and bought an ENCYCLOPEDIA!!
+%
+I want a VEGETARIAN BURRITO to go ... with EXTRA MSG!!
+%
+I want a WESSON OIL lease!!
+%
+I want another RE-WRITE on my CAESAR SALAD!!
+%
+I want EARS! I want two ROUND BLACK EARS to make me feel warm 'n
+secure!!
+%
+I want the presidency so bad I can already taste the hors d'oeuvres.
+%
+I want to dress you up as TALLULAH BANKHEAD and cover you with VASELINE
+and WHEAT THINS ...
+%
+I want to kill everyone here with a cute colorful Hydrogen Bomb!!
+%
+I want to perform cranial activities with Tuesday Weld!!
+%
+I want to read my new poem about pork brains and outer space ...
+%
+I want to so HAPPY, the VEINS in my neck STAND OUT!!
+%
+I want you to MEMORIZE the collected poems of EDNA ST VINCENT MILLAY
+... BACKWARDS!!
+%
+I want you to organize my PASTRY trays ... my TEA-TINS are gleaming in
+formation like a ROW of DRUM MAJORETTES -- please don't be FURIOUS with
+me --
+%
+I was born in a Hostess Cupcake factory before the sexual revolution!
+%
+I was making donuts and now I'm on a bus!
+%
+I wish I was a sex-starved manicurist found dead in the Bronx!!
+%
+I wish I was on a Cincinnati street corner holding a clean dog!
+%
+I wonder if BOB GUCCIONE has these problems!
+%
+I wonder if I could ever get started in the credit world?
+%
+I wonder if I ought to tell them about my PREVIOUS LIFE as a COMPLETE
+STRANGER?
+%
+I wonder if I should put myself in ESCROW!!
+%
+I wonder if there's anything GOOD on tonight?
+%
+I would like to urinate in an OVULAR, porcelain pool --
+%
+I'd like MY data-base JULIENNED and stir-fried!
+%
+I'd like some JUNK FOOD ... and then I want to be ALONE --
+%
+If a person is FAMOUS in this country, they have to go on the ROAD for
+MONTHS at a time and have their name misspelled on the SIDE of a
+GREYHOUND SCENICRUISER!!
+%
+If elected, Zippy pledges to each and every American a 55-year-old
+houseboy ...
+%
+If I am elected no one will ever have to do their laundry again!
+%
+If I am elected, the concrete barriers around the WHITE HOUSE will be
+replaced by tasteful foam replicas of ANN MARGARET!
+%
+If I felt any more SOPHISTICATED I would DIE of EMBARRASSMENT!
+%
+If I had a Q-TIP, I could prevent th' collapse of NEGOTIATIONS!!
+%
+If I pull this SWITCH I'll be RITA HAYWORTH!! Or a SCIENTOLOGIST!
+%
+if it GLISTENS, gobble it!!
+%
+If our behavior is strict, we do not need fun!
+%
+If Robert De Niro assassinates Walter Slezak, will Jodie Foster marry
+Bonzo??
+%
+I'll eat ANYTHING that's BRIGHT BLUE!!
+%
+I'll show you MY telex number if you show me YOURS ...
+%
+I'm a fuschia bowling ball somewhere in Brittany
+%
+I'm a GENIUS! I want to dispute sentence structure with SUSAN
+SONTAG!!
+%
+I'm a nuclear submarine under the polar ice cap and I need a Kleenex!
+%
+I'm also against BODY-SURFING!!
+%
+I'm also pre-POURED pre-MEDITATED and pre-RAPHAELITE!!
+%
+I'm ANN LANDERS!! I can SHOPLIFT!!
+%
+I'm changing the CHANNEL ... But all I get is commercials for "RONCO
+MIRACLE BAMBOO STEAMERS"!
+%
+I'm continually AMAZED at th'breathtaking effects of WIND EROSION!!
+%
+I'm definitely not in Omaha!
+%
+I'm DESPONDENT ... I hope there's something DEEP-FRIED under this
+miniature DOMED STADIUM ...
+%
+I'm dressing up in an ill-fitting IVY-LEAGUE SUIT!! Too late...
+%
+I'm EMOTIONAL now because I have MERCHANDISING CLOUT!!
+%
+I'm encased in the lining of a pure pork sausage!!
+%
+I'm GLAD I remembered to XEROX all my UNDERSHIRTS!!
+%
+I'm gliding over a NUCLEAR WASTE DUMP near ATLANTA, Georgia!!
+%
+I'm having a BIG BANG THEORY!!
+%
+I'm having a MID-WEEK CRISIS!
+%
+I'm having a RELIGIOUS EXPERIENCE ... and I don't take any DRUGS
+%
+I'm having a tax-deductible experience! I need an energy crunch!!
+%
+I'm having an emotional outburst!!
+%
+I'm having an EMOTIONAL OUTBURST!! But, uh, WHY is there a WAFFLE in
+my PAJAMA POCKET??
+%
+I'm having BEAUTIFUL THOUGHTS about the INSIPID WIVES of smug and
+wealthy CORPORATE LAWYERS ...
+%
+I'm having fun HITCHHIKING to CINCINNATI or FAR ROCKAWAY!!
+%
+I'm in direct contact with many advanced fun CONCEPTS.
+%
+I'm into SOFTWARE!
+%
+I'm meditating on the FORMALDEHYDE and the ASBESTOS leaking into my
+PERSONAL SPACE!!
+%
+I'm mentally OVERDRAWN! What's that SIGNPOST up ahead? Where's ROD
+STERLING when you really need him?
+%
+I'm not an Iranian!! I voted for Dianne Feinstein!!
+%
+I'm not available for comment..
+%
+I'm pretending I'm pulling in a TROUT! Am I doing it correctly??
+%
+I'm pretending that we're all watching PHIL SILVERS instead of RICARDO
+MONTALBAN!
+%
+I'm QUIETLY reading the latest issue of "BOWLING WORLD" while my wife
+and two children stand QUIETLY BY ...
+%
+I'm rated PG-34!!
+%
+I'm receiving a coded message from EUBIE BLAKE!!
+%
+I'm RELIGIOUS!! I love a man with a HAIRPIECE!! Equip me with
+MISSILES!!
+%
+I'm reporting for duty as a modern person. I want to do the Latin
+Hustle now!
+%
+I'm shaving!! I'M SHAVING!!
+%
+I'm sitting on my SPEED QUEEN ... To me, it's ENJOYABLE ... I'm WARM
+... I'm VIBRATORY ...
+%
+I'm thinking about DIGITAL READ-OUT systems and computer-generated
+IMAGE FORMATIONS ...
+%
+I'm totally DESPONDENT over the LIBYAN situation and the price of
+CHICKEN ...
+%
+I'm using my X-RAY VISION to obtain a rare glimpse of the INNER
+WORKINGS of this POTATO!!
+%
+I'm wearing PAMPERS!!
+%
+I'm wet! I'm wild!
+%
+I'm young ... I'm HEALTHY ... I can HIKE THRU CAPT GROGAN'S LUMBAR
+REGIONS!
+%
+I'm ZIPPY the PINHEAD and I'm totally committed to the festive mode.
+%
+In 1962, you could buy a pair of SHARKSKIN SLACKS, with a "Continental
+Belt," for $10.99!!
+%
+In Newark the laundromats are open 24 hours a day!
+%
+INSIDE, I have the same personality disorder as LUCY RICARDO!!
+%
+Inside, I'm already SOBBING!
+%
+Is a tattoo real, like a curb or a battleship? Or are we suffering in
+Safeway?
+%
+Is he the MAGIC INCA carrying a FROG on his shoulders?? Is the FROG
+his GUIDELIGHT?? It is curious that a DOG runs already on the
+ESCALATOR ...
+%
+Is it 1974? What's for SUPPER? Can I spend my COLLEGE FUND in one
+wild afternoon??
+%
+Is it clean in other dimensions?
+%
+Is it NOUVELLE CUISINE when 3 olives are struggling with a scallop in a
+plate of SAUCE MORNAY?
+%
+Is something VIOLENT going to happen to a GARBAGE CAN?
+%
+Is this an out-take from the "BRADY BUNCH"?
+%
+Is this going to involve RAW human ecstasy?
+%
+Is this TERMINAL fun?
+%
+Is this the line for the latest whimsical YUGOSLAVIAN drama which also
+makes you want to CRY and reconsider the VIETNAM WAR?
+%
+Isn't this my STOP?!
+%
+It don't mean a THING if you ain't got that SWING!!
+%
+It was a JOKE!! Get it?? I was receiving messages from DAVID
+LETTERMAN!! YOW!!
+%
+It's a lot of fun being alive ... I wonder if my bed is made?!?
+%
+It's NO USE ... I've gone to "CLUB MED"!!
+%
+It's OBVIOUS ... The FURS never reached ISTANBUL ... You were an EXTRA
+in the REMAKE of "TOPKAPI" ... Go home to your WIFE ... She's making
+FRENCH TOAST!
+%
+It's OKAY -- I'm an INTELLECTUAL, too.
+%
+It's the RINSE CYCLE!! They've ALL IGNORED the RINSE CYCLE!!
+%
+I've got a COUSIN who works in the GARMENT DISTRICT ...
+%
+I've got an IDEA!! Why don't I STARE at you so HARD, you forget your
+SOCIAL SECURITY NUMBER!!
+%
+I've read SEVEN MILLION books!!
+%
+JAPAN is a WONDERFUL planet -- I wonder if we'll ever reach their level
+of COMPARATIVE SHOPPING ...
+%
+Jesuit priests are DATING CAREER DIPLOMATS!!
+%
+Jesus is my POSTMASTER GENERAL ...
+%
+Kids, don't gross me off ... "Adventures with MENTAL HYGIENE" can be
+carried too FAR!
+%
+Kids, the seven basic food groups are GUM, PUFF PASTRY, PIZZA,
+PESTICIDES, ANTIBIOTICS, NUTRA-SWEET and MILK DUDS!!
+%
+Laundry is the fifth dimension!! ... um ... um ... th' washing machine
+is a black hole and the pink socks are bus drivers who just fell in!!
+%
+LBJ, LBJ, how many JOKES did you tell today??!
+%
+Leona, I want to CONFESS things to you ... I want to WRAP you in a
+SCARLET ROBE trimmed with POLYVINYL CHLORIDE ... I want to EMPTY your
+ASHTRAYS ...
+%
+Let me do my TRIBUTE to FISHNET STOCKINGS ...
+%
+Let's all show human CONCERN for REVEREND MOON's legal difficulties!!
+%
+Let's send the Russians defective lifestyle accessories!
+%
+Life is a POPULARITY CONTEST! I'm REFRESHINGLY CANDID!!
+%
+Like I always say -- nothing can beat the BRATWURST here in DUSSELDORF!!
+%
+Loni Anderson's hair should be LEGALIZED!!
+%
+Look! A ladder! Maybe it leads to heaven, or a sandwich!
+%
+LOOK!! Sullen American teens wearing MADRAS shorts and "Flock of
+Seagulls" HAIRCUTS!
+%
+Look DEEP into the OPENINGS!! Do you see any ELVES or EDSELS ... or a
+HIGHBALL?? ...
+%
+Look into my eyes and try to forget that you have a Macy's charge
+card!
+%
+Make me look like LINDA RONSTADT again!!
+%
+Mary Tyler Moore's SEVENTH HUSBAND is wearing my DACRON TANK TOP in a
+cheap hotel in HONOLULU!
+%
+Maybe we could paint GOLDIE HAWN a rich PRUSSIAN BLUE --
+%
+MERYL STREEP is my obstetrician!
+%
+MMM-MM!! So THIS is BIO-NEBULATION!
+%
+Mmmmmm-MMMMMM!! A plate of STEAMING PIECES of a PIG mixed with the
+shreds of SEVERAL CHICKENS!! ... Oh BOY!! I'm about to swallow a
+TORN-OFF section of a COW'S LEFT LEG soaked in COTTONSEED OIL and
+SUGAR!! ... Let's see ... Next, I'll have the GROUND-UP flesh of CUTE,
+BABY LAMBS fried in the MELTED, FATTY TISSUES from a warm-blooded
+animal someone once PETTED!! ... YUM!! That was GOOD!! For DESSERT,
+I'll have a TOFU BURGER with BEAN SPROUTS on a stone-ground, WHOLE
+WHEAT BUN!!
+%
+Mr and Mrs PED, can I borrow 26.7% of the RAYON TEXTILE production of
+the INDONESIAN archipelago?
+%
+My Aunt MAUREEN was a military advisor to IKE & TINA TURNER!!
+%
+My BIOLOGICAL ALARM CLOCK just went off ... It has noiseless DOZE
+FUNCTION and full kitchen!!
+%
+My CODE of ETHICS is vacationing at famed SCHROON LAKE in upstate New
+York!!
+%
+My EARS are GONE!!
+%
+My face is new, my license is expired, and I'm under a doctor's
+care!!!!
+%
+My haircut is totally traditional!
+%
+MY income is ALL disposable!
+%
+My LESLIE GORE record is BROKEN ...
+%
+My life is a patio of fun!
+%
+My mind is a potato field ...
+%
+My mind is making ashtrays in Dayton ...
+%
+My nose feels like a bad Ronald Reagan movie ...
+%
+my NOSE is NUMB!
+%
+My pants just went to high school in the Carlsbad Caverns!!!
+%
+My polyvinyl cowboy wallet was made in Hong Kong by Montgomery Clift!
+%
+My uncle Murray conquered Egypt in 53 B.C. And I can prove it too!!
+%
+My vaseline is RUNNING...
+%
+NANCY!! Why is everything RED?!
+%
+NATHAN ... your PARENTS were in a CARCRASH!! They're VOIDED -- They
+COLLAPSED They had no CHAINSAWS ... They had no MONEY MACHINES ... They
+did PILLS in SKIMPY GRASS SKIRTS ... Nathan, I EMULATED them ... but
+they were OFF-KEY ...
+%
+NEWARK has been REZONED!! DES MOINES has been REZONED!!
+%
+Nipples, dimples, knuckles, NICKLES, wrinkles, pimples!!
+%
+Not SENSUOUS ... only "FROLICSOME" ... and in need of DENTAL WORK ...
+in PAIN!!!
+%
+Now I am depressed ...
+%
+Now I think I just reached the state of HYPERTENSION that comes JUST
+BEFORE you see the TOTAL at the SAFEWAY CHECKOUT COUNTER!
+%
+Now I understand the meaning of "THE MOD SQUAD"!
+%
+Now I'm being INVOLUNTARILY shuffled closer to the CLAM DIP with the
+BROKEN PLASTIC FORKS in it!!
+%
+Now I'm concentrating on a specific tank battle toward the end of World
+War II!
+%
+Now I'm having INSIPID THOUGHTS about the beautiful, round wives of
+HOLLYWOOD MOVIE MOGULS encased in PLEXIGLASS CARS and being approached
+by SMALL BOYS selling FRUIT ...
+%
+Now KEN and BARBIE are PERMANENTLY ADDICTED to MIND-ALTERING DRUGS ...
+%
+Now, let's SEND OUT for QUICHE!!
+%
+Now my EMOTIONAL RESOURCES are heavily committed to 23% of the SMELTING
+and REFINING industry of the state of NEVADA!!
+%
+Now that I have my "APPLE", I comprehend COST ACCOUNTING!!
+%
+Of course, you UNDERSTAND about the PLAIDS in the SPIN CYCLE --
+%
+Oh, I get it!! "The BEACH goes on", huh, SONNY??
+%
+Oh my GOD -- the SUN just fell into YANKEE STADIUM!!
+%
+Okay ... I'm going home to write the "I HATE RUBIK's CUBE HANDBOOK FOR
+DEAD CAT LOVERS" ...
+%
+OKAY!! Turn on the sound ONLY for TRYNEL CARPETING, FULLY-EQUIPPED
+R.V.'S and FLOATATION SYSTEMS!!
+%
+OMNIVERSAL AWARENESS?? Oh, YEH!! First you need 4 GALLONS of JELL-O
+and a BIG WRENCH!! ... I think you drop th'WRENCH in the JELL-O as if
+it was a FLAVOR, or an INGREDIENT ... ... or ... I ... um ... WHERE'S
+the WASHING MACHINES?
+%
+On SECOND thought, maybe I'll heat up some BAKED BEANS and watch REGIS
+PHILBIN ... It's GREAT to be ALIVE!!
+%
+On the other hand, life can be an endless parade of TRANSSEXUAL
+QUILTING BEES aboard a cruise ship to DISNEYWORLD if only we let it!!
+%
+On the road, ZIPPY is a pinhead without a purpose, but never without a
+POINT.
+%
+Once, there was NO fun ... This was before MENU planning, FASHION
+statements or NAUTILUS equipment ... Then, in 1985 ... FUN was
+completely encoded in this tiny MICROCHIP ... It contain 14,768 vaguely
+amusing SIT-COM pilots!! We had to wait FOUR BILLION years but we
+finally got JERRY LEWIS, MTV and a large selection of creme-filled
+snack cakes!
+%
+Once upon a time, four AMPHIBIOUS HOG CALLERS attacked a family of
+DEFENSELESS, SENSITIVE COIN COLLECTORS and brought DOWN their PROPERTY
+VALUES!!
+%
+ONE: I will donate my entire "BABY HUEY" comic book collection to
+ the downtown PLASMA CENTER ...
+TWO: I won't START a BAND called "KHADAFY & THE HIT SQUAD" ...
+THREE: I won't ever TUMBLE DRY my FOX TERRIER again!!
+%
+One FISHWICH coming up!!
+%
+Our father who art in heaven ... I sincerely pray that SOMEBODY at this
+table will PAY for my SHREDDED WHAT and ENGLISH MUFFIN ... and also
+leave a GENEROUS TIP ....
+%
+over in west Philadelphia a puppy is vomiting ...
+%
+OVER the underpass! UNDER the overpass! Around the FUTURE and BEYOND
+REPAIR!!
+%
+PARDON me, am I speaking ENGLISH?
+%
+Pardon me, but do you know what it means to be TRULY ONE with your
+BOOTH!
+%
+PEGGY FLEMMING is stealing BASKET BALLS to feed the babies in VERMONT.
+%
+PIZZA!!
+%
+Place me on a BUFFER counter while you BELITTLE several BELLHOPS in the
+Trianon Room!! Let me one of your SUBSIDIARIES!
+%
+Please come home with me ... I have Tylenol!!
+%
+Psychoanalysis?? I thought this was a nude rap session!!!
+%
+PUNK ROCK!! DISCO DUCK!! BIRTH CONTROL!!
+%
+Quick, sing me the BUDAPEST NATIONAL ANTHEM!!
+%
+RELATIVES!!
+%
+Remember, in 2039, MOUSSE & PASTA will be available ONLY by
+prescription!!
+%
+RHAPSODY in Glue!
+%
+SANTA CLAUS comes down a FIRE ESCAPE wearing bright blue LEG WARMERS
+... He scrubs the POPE with a mild soap or detergent for 15 minutes,
+starring JANE FONDA!!
+%
+Send your questions to ``ASK ZIPPY'', Box 40474, San Francisco, CA
+94140, USA
+%
+SHHHH!! I hear SIX TATTOOED TRUCK-DRIVERS tossing ENGINE BLOCKS into
+empty OIL DRUMS ...
+%
+Should I do my BOBBIE VINTON medley?
+%
+Should I get locked in the PRINCICAL'S OFFICE today -- or have a
+VASECTOMY??
+%
+Should I start with the time I SWITCHED personalities with a BEATNIK
+hair stylist or my failure to refer five TEENAGERS to a good OCULIST?
+%
+Sign my PETITION.
+%
+So, if we convert SUPPLY-SIDE SOYABEAN FUTURES into HIGH-YIELD T-BILL
+INDICATORS, the PRE-INFLATIONARY risks will DWINDLE to a rate of 2
+SHOPPING SPREES per EGGPLANT!!
+%
+So this is what it feels like to be potato salad
+%
+someone in DAYTON, Ohio is selling USED CARPETS to a SERBO-CROATIAN
+%
+Sometime in 1993 NANCY SINATRA will lead a BLOODLESS COUP on GUAM!!
+%
+Somewhere in DOWNTOWN BURBANK a prostitute is OVERCOOKING a LAMB
+CHOP!!
+%
+Somewhere in suburban Honolulu, an unemployed bellhop is whipping up a
+batch of illegal psilocybin chop suey!!
+%
+Somewhere in Tenafly, New Jersey, a chiropractor is viewing "Leave it
+to Beaver"!
+%
+Spreading peanut butter reminds me of opera!! I wonder why?
+%
+TAILFINS!! ... click ...
+%
+TAPPING? You POLITICIANS! Don't you realize that the END of the "Wash
+Cycle" is a TREASURED MOMENT for most people?!
+%
+Tex SEX! The HOME of WHEELS! The dripping of COFFEE!! Take me to
+Minnesota but don't EMBARRASS me!!
+%
+Th' MIND is the Pizza Palace of th' SOUL
+%
+Thank god!! ... It's HENNY YOUNGMAN!!
+%
+The appreciation of the average visual graphisticator alone is worth
+the whole suaveness and decadence which abounds!!
+%
+The entire CHINESE WOMEN'S VOLLEYBALL TEAM all share ONE personality --
+and have since BIRTH!!
+%
+The fact that 47 PEOPLE are yelling and sweat is cascading down my
+SPINAL COLUMN is fairly enjoyable!!
+%
+The FALAFEL SANDWICH lands on my HEAD and I become a VEGETARIAN ...
+%
+The Korean War must have been fun.
+%
+The Osmonds! You are all Osmonds!! Throwing up on a freeway at
+dawn!!!
+%
+The PILLSBURY DOUGHBOY is CRYING for an END to BURT REYNOLDS movies!!
+%
+The PINK SOCKS were ORIGINALLY from 1952!! But they went to MARS
+around 1953!!
+%
+The SAME WAVE keeps coming in and COLLAPSING like a rayon MUU-MUU ...
+%
+There's a little picture of ED MCMAHON doing BAD THINGS to JOAN RIVERS
+in a $200,000 MALIBU BEACH HOUSE!!
+%
+There's enough money here to buy 5000 cans of Noodle-Roni!
+%
+These PRESERVES should be FORCE-FED to PENTAGON OFFICIALS!!
+%
+They collapsed ... like nuns in the street ... they had no teen
+appeal!
+%
+This ASEXUAL PIG really BOILS my BLOOD ... He's so ... so ... URGENT!!
+%
+This is a NO-FRILLS flight -- hold th' CANADIAN BACON!!
+%
+This MUST be a good party -- My RIB CAGE is being painfully pressed up
+against someone's MARTINI!!
+%
+This PIZZA symbolizes my COMPLETE EMOTIONAL RECOVERY!!
+%
+This PORCUPINE knows his ZIPCODE ... And he has "VISA"!!
+%
+This TOPS OFF my partygoing experience! Someone I DON'T LIKE is
+talking to me about a HEART-WARMING European film ...
+%
+Those aren't WINOS -- that's my JUGGLER, my AERIALIST, my SWORD
+SWALLOWER, and my LATEX NOVELTY SUPPLIER!!
+%
+Thousands of days of civilians ... have produced a ... feeling for the
+aesthetic modules --
+%
+Today, THREE WINOS from DETROIT sold me a framed photo of TAB HUNTER
+before his MAKEOVER!
+%
+Toes, knees, NIPPLES. Toes, knees, nipples, KNUCKLES ...
+Nipples, dimples, knuckles, NICKLES, wrinkles, pimples!!
+%
+TONY RANDALL! Is YOUR life a PATIO of FUN??
+%
+Uh-oh!! I forgot to submit to COMPULSORY URINALYSIS!
+%
+UH-OH!! I put on "GREAT HEAD-ON TRAIN COLLISIONS of the 50's" by
+mistake!!!
+%
+UH-OH!! I think KEN is OVER-DUE on his R.V. PAYMENTS and HE'S having a
+NERVOUS BREAKDOWN too!! Ha ha.
+%
+Uh-oh!! I'm having TOO MUCH FUN!!
+%
+UH-OH!! We're out of AUTOMOBILE PARTS and RUBBER GOODS!
+%
+Uh-oh -- WHY am I suddenly thinking of a VENERABLE religious leader
+frolicking on a FORT LAUDERDALE weekend?
+%
+Used staples are good with SOY SAUCE!
+%
+VICARIOUSLY experience some reason to LIVE!!
+%
+Vote for ME -- I'm well-tapered, half-cocked, ill-conceived and
+TAX-DEFERRED!
+%
+Wait ... is this a FUN THING or the END of LIFE in Petticoat
+Junction??
+%
+Was my SOY LOAF left out in th'RAIN? It tastes REAL GOOD!!
+%
+We are now enjoying total mutual interaction in an imaginary hot
+tub ...
+%
+We have DIFFERENT amounts of HAIR --
+%
+We just joined the civil hair patrol!
+%
+We place two copies of PEOPLE magazine in a DARK, HUMID mobile home.
+45 minutes later CYNDI LAUPER emerges wearing a BIRD CAGE on her head!
+%
+Well, here I am in AMERICA.. I LIKE it. I HATE it. I LIKE it. I
+HATE it. I LIKE it. I HATE it. I LIKE it. I HATE it. I LIKE ...
+EMOTIONS are SWEEPING over me!!
+%
+Well, I'm a classic ANAL RETENTIVE!! And I'm looking for a way to
+VICARIOUSLY experience some reason to LIVE!!
+%
+Well, I'm INVISIBLE AGAIN ... I might as well pay a visit to the LADIES
+ROOM ...
+%
+Well, O.K. I'll compromise with my principles because of EXISTENTIAL
+DESPAIR!
+%
+Were these parsnips CORRECTLY MARINATED in TACO SAUCE?
+%
+What a COINCIDENCE! I'm an authorized "SNOOTS OF THE STARS" dealer!!
+%
+What GOOD is a CARDBOARD suitcase ANYWAY?
+%
+What I need is a MATURE RELATIONSHIP with a FLOPPY DISK ...
+%
+What I want to find out is -- do parrots know much about Astro-Turf?
+%
+What PROGRAM are they watching?
+%
+What UNIVERSE is this, please??
+%
+What's the MATTER Sid? ... Is your BEVERAGE unsatisfactory?
+%
+When I met th'POPE back in '58, I scrubbed him with a MILD SOAP or
+DETERGENT for 15 minutes. He seemed to enjoy it ...
+%
+When this load is DONE I think I'll wash it AGAIN ...
+%
+When you get your PH.D. will you get able to work at BURGER KING?
+%
+When you said "HEAVILY FORESTED" it reminded me of an overdue CLEANING
+BILL ... Don't you SEE? O'Grogan SWALLOWED a VALUABLE COIN COLLECTION
+and HAD to murder the ONLY MAN who KNEW!!
+%
+Where do your SOCKS go when you lose them in th' WASHER?
+%
+Where does it go when you flush?
+%
+Where's SANDY DUNCAN?
+%
+Where's th' DAFFY DUCK EXHIBIT??
+%
+Where's the Coke machine? Tell me a joke!!
+%
+While my BRAINPAN is being refused service in BURGER KING, Jesuit
+priests are DATING CAREER DIPLOMATS!!
+%
+While you're chewing, think of STEVEN SPIELBERG'S bank account ... his
+will have the same effect as two "STARCH BLOCKERS"!
+%
+WHO sees a BEACH BUNNY sobbing on a SHAG RUG?!
+%
+WHOA!! Ken and Barbie are having TOO MUCH FUN!! It must be the
+NEGATIVE IONS!!
+%
+Why are these athletic shoe salesmen following me??
+%
+Why don't you ever enter and CONTESTS, Marvin?? Don't you know your
+own ZIPCODE?
+%
+Why is everything made of Lycra Spandex?
+%
+Why is it that when you DIE, you can't take your HOME ENTERTAINMENT
+CENTER with you??
+%
+Will it improve my CASH FLOW?
+%
+Will the third world war keep "Bosom Buddies" off the air?
+%
+Will this never-ending series of PLEASURABLE EVENTS never cease?
+%
+With YOU, I can be MYSELF ... We don't NEED Dan Rather ...
+%
+World War III? No thanks!
+%
+World War Three can be averted by adherence to a strictly enforced
+dress code!
+%
+Wow! Look!! A stray meatball!! Let's interview it!
+%
+Xerox your lunch and file it under "sex offenders"!
+%
+Yes, but will I see the EASTER BUNNY in skintight leather at an IRON
+MAIDEN concert?
+%
+YOU!! Give me the CUTEST, PINKEST, most charming little VICTORIAN
+DOLLHOUSE you can find!! An make it SNAPPY!!
+%
+You can't hurt me!! I have an ASSUMABLE MORTGAGE!!
+%
+You mean now I can SHOOT YOU in the back and further BLUR th'
+distinction between FANTASY and REALITY?
+%
+You mean you don't want to watch WRESTLING from ATLANTA?
+%
+YOU PICKED KARL MALDEN'S NOSE!!
+%
+You should all JUMP UP AND DOWN for TWO HOURS while I decide on a NEW
+CAREER!!
+%
+You were s'posed to laugh!
+%
+Your CHEEKS sit like twin NECTARINES above a MOUTH that knows no BOUNDS --
+%
+Youth of today! Join me in a mass rally for traditional mental
+attitudes!
+%
+Yow!
+%
+Yow! Am I having fun yet?
+%
+Yow! Am I in Milwaukee?
+%
+Yow! And then we could sit on the hoods of cars at stop lights!
+%
+Yow! Are we laid back yet?
+%
+Yow! Are we wet yet?
+%
+Yow! Are you the self-frying president?
+%
+Yow! Did something bad happen or am I in a drive-in movie??
+%
+YOW!! Everybody out of the GENETIC POOL!
+%
+YOW!!! I am having fun!!!
+%
+Yow! I just went below the poverty line!
+%
+Yow! I threw up on my window!
+%
+Yow! I want my nose in lights!
+%
+Yow! I want to mail a bronzed artichoke to Nicaragua!
+%
+Yow! I'm having a quadrophonic sensation of two winos alone in a steel
+mill!
+%
+Yow! I'm imagining a surfer van filled with soy sauce!
+%
+YOW!! I'm in a very clever and adorable INSANE ASYLUM!!
+%
+Yow! Is my fallout shelter termite proof?
+%
+Yow! Is this sexual intercourse yet?? Is it, huh, is it??
+%
+Yow! It's a hole all the way to downtown Burbank!
+%
+Yow! It's some people inside the wall! This is better than mopping!
+%
+Yow! Maybe I should have asked for my Neutron Bomb in PAISLEY --
+%
+Yow! Now I get to think about all the BAD THINGS I did to a BOWLING
+BALL when I was in JUNIOR HIGH SCHOOL!
+%
+YOW!! Now I understand advanced MICROBIOLOGY and th' new TAX REFORM
+laws!!
+%
+Yow! Now we can become alcoholics!
+%
+YOW!! The land of the rising SONY!!
+%
+Yow! Those people look exactly like Donnie and Marie Osmond!!
+%
+YOW!! Up ahead! It's a DONUT HUT!!
+%
+Yow! We're going to a new disco!
+%
+YOW!! What should the entire human race DO?? Consume a fifth of
+CHIVAS REGAL, ski NUDE down MT. EVEREST, and have a wild SEX WEEKEND!
+%
+Zippy's brain cells are straining to bridge synapses ...
+%
diff --git a/usr.bin/fortune/datfiles/zippy.sp.ok b/usr.bin/fortune/datfiles/zippy.sp.ok
new file mode 100644
index 0000000..b2f3fff
--- /dev/null
+++ b/usr.bin/fortune/datfiles/zippy.sp.ok
@@ -0,0 +1,211 @@
+# $FreeBSD$
+ANAL
+ASEXUAL
+Astro
+B.C
+BANKHEAD
+BI
+BIO
+BORSCHT
+BRAINPAN
+BURRITO
+BURRITOS
+Barbie
+Bo
+Bonzo
+CARCRASH
+CASIO
+CHAINSAWS
+CHIVAS
+COM
+CORDOVANS
+COSELL
+CROATIAN
+Carlsbad
+Clift
+Cosell
+Cupcake
+DAQUIRI
+DELI
+DIDI
+DISCO
+DISNEYWORLD
+DONUT
+DOUGHBOY
+Darvon
+Di
+Disco
+Donnie
+EDSELS
+EMOTE
+EUBIE
+Enema
+FALAFEL
+FISHNET
+FISHWICH
+FLEMMING
+FLOATATION
+FROLICSOME
+Feinstein
+GOLDIE
+GORRY
+GUCCIONE
+GUIDELIGHT
+Gibble
+Ginzberg
+HAIRPIECE
+HAWN
+HAYWORTH
+HITCHHIKING
+HOAX
+HOUSECAT
+Hmmm
+I.Q
+INTESTINAL
+Iranian
+JELL
+JELLO
+JILLIAN'S
+JULIENNED
+Jodie
+KATRINKA
+KNOCKWURST
+LBJ
+LING
+LONI
+LUGOSI
+Loni
+Lycra
+MALIBU
+MCMAHON
+MELBA
+MERYL
+MMM
+MOGULS
+MONTALBAN'S
+MOUSSE
+MSG
+MT
+MTV
+MYSTERIANS
+Macy's
+Meese
+Monkees
+NABOBS
+NAGEELA
+NEBULATION
+NICKLES
+NUTRA
+Niro
+OLFACTORY
+OMNIVERSAL
+OVULAR
+Osmond
+Osmonds
+PAISLEY
+PASTA
+PG
+Pharoahs
+Provolone
+R.V.'S
+RAPHAELITE
+RICARDO
+RITA
+Rom
+Roni
+SAGAN
+SANFORIZE
+SCHROON
+SCIENTOLOGIST
+SERBO
+SHOPLIFT
+SINATRA
+SKEE
+SODOMIZE
+SONTAG
+STREEP
+Safeway
+Slezak
+Spandex
+T.V
+TACO
+TAILFINS
+TALLULAH
+TINA
+TRANSSEXUAL
+TRYNEL
+Tenafly
+Tex
+Th
+Tylenol
+Uh
+VASELINE
+VELVEETA
+WESSON
+YEH
+YUBBA
+Yum
+ZIPPY
+Zippy
+Zippy's
+barbequeued
+chr
+co
+cranial
+creme
+devalue
+disco
+donut
+donuts
+dusenjet
+einem
+einige
+frolicking
+fuschia
+gladiatoren
+gothic
+graphisticator
+hors
+houseboy
+ich
+im
+jahr
+kidnapped
+lande
+laundromat
+laundromats
+lesbian
+li'l
+manicurist
+matic
+meatball
+meltdown
+naugahyde
+obstetrician
+poindexter
+pre
+psilocybin
+quaaludes
+quadrophonic
+rieche
+s'posed
+scientology
+skintight
+skydiving
+solarium
+spielen
+telex
+th
+th'HOLIDAY
+th'MAMBO
+th'RAIN
+th'WRENCH
+th'cute
+thru
+thumbtack
+uh
+um
+urinate
+vaseline
+vor
+zzzzzzzzz
diff --git a/usr.bin/fortune/fortune/Makefile b/usr.bin/fortune/fortune/Makefile
new file mode 100644
index 0000000..c18ead9
--- /dev/null
+++ b/usr.bin/fortune/fortune/Makefile
@@ -0,0 +1,11 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= fortune
+MAN= fortune.6
+CFLAGS+=-DDEBUG -I${.CURDIR}/../strfile
+
+.include <bsd.prog.mk>
+
+test: ${PROG}
+ ./${PROG} -m brass
diff --git a/usr.bin/fortune/fortune/Makefile.depend b/usr.bin/fortune/fortune/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/fortune/fortune/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6
new file mode 100644
index 0000000..d8f6bad
--- /dev/null
+++ b/usr.bin/fortune/fortune/fortune.6
@@ -0,0 +1,191 @@
+.\" Copyright (c) 1985, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Ken Arnold.
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)fortune.6 8.3 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd November 7, 2007
+.Dt FORTUNE 6
+.Os
+.Sh NAME
+.Nm fortune
+.Nd "print a random, hopefully interesting, adage"
+.Sh SYNOPSIS
+.Nm
+.Op Fl aDefilosw
+.Op Fl m Ar pattern
+.Oo
+.Op Ar \&N%
+.Ar file Ns / Ns Ar directory Ns / Ns Cm all
+.Oc
+.Sh DESCRIPTION
+When
+.Nm
+is run with no arguments it prints out a random epigram.
+Epigrams are divided into several categories, where each category
+is subdivided into those which are potentially offensive and those
+which are not.
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+Choose from all lists of maxims, both offensive and not.
+(See the
+.Fl o
+option for more information on offensive fortunes.)
+.It Fl D
+Enable additional debugging output.
+Specify this option multiple times for more verbose output.
+Only available if compiled with
+.Li -DDEBUG .
+.It Fl e
+Consider all fortune files to be of equal size (see discussion below
+on multiple files).
+.It Fl f
+Print out the list of files which would be searched, but do not
+print a fortune.
+.It Fl l
+Long dictums only.
+.It Fl m Ar pattern
+Print out all fortunes which match the regular expression
+.Ar pattern .
+See
+.Xr regex 3
+for a description of patterns.
+.It Fl o
+Choose only from potentially offensive aphorisms.
+.Bf -symbolic
+Please, please, please request a potentially offensive fortune if and
+only if you believe, deep down in your heart, that you are willing
+to be offended.
+(And that if you are not willing, you will just quit using
+.Fl o
+rather than give us
+grief about it, okay?)
+.Ef
+.Bd -unfilled -offset indent
+\&... let us keep in mind the basic governing philosophy
+of The Brotherhood, as handsomely summarized in these words:
+we believe in healthy, hearty laughter -- at the expense of
+the whole human race, if needs be.
+Needs be.
+ --H. Allen Smith, "Rude Jokes"
+.Ed
+.It Fl s
+Short apothegms only.
+.It Fl i
+Ignore case for
+.Fl m
+patterns.
+.It Fl w
+Wait before termination for an amount of time calculated from the
+number of characters in the message.
+This is useful if it is executed as part of the logout procedure
+to guarantee that the message can be read before the screen is cleared.
+.El
+.Pp
+The user may specify alternate sayings.
+You can specify a specific file, a directory which contains one or
+more files, or the special word
+.Cm all
+which says to use all the standard databases.
+Any of these may be preceded by a percentage, which is a number
+.Ar N
+between 0 and 100 inclusive, followed by a
+.Ql % .
+If it is, there will be an
+.Ar N
+percent probability that an adage will be picked from that file
+or directory.
+If the percentages do not sum to 100, and there are specifications
+without percentages, the remaining percent will apply to those files
+and/or directories, in which case the probability of selecting from
+one of them will be based on their relative sizes.
+.Pp
+As an example, given two databases
+.Pa funny
+and
+.Pa not-funny ,
+with
+.Pa funny
+twice as big, saying
+.Pp
+.Dl "fortune funny not-funny"
+.Pp
+will get you fortunes out of
+.Pa funny
+two-thirds of the time.
+The command
+.Pp
+.Dl "fortune 90% funny 10% not-funny"
+.Pp
+will pick out 90% of its fortunes from
+.Pa funny
+(the
+.Dq Li "10% not-funny"
+is unnecessary, since 10% is all that is left).
+The
+.Fl e
+option says to consider all files equal;
+thus
+.Pp
+.Dl "fortune -e funny not-funny"
+.Pp
+is equivalent to
+.Pp
+.Dl "fortune 50% funny 50% not-funny"
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev FORTUNE_PATH"
+.It Ev FORTUNE_PATH
+The search path for the data files.
+It is a colon-separated list of directories in which
+.Nm
+looks for data files.
+If not set it will default to
+.Pa /usr/share/games/fortune .
+If none of the directories specified exist, it will print a warning and exit.
+.It Ev FORTUNE_SAVESTATE
+If set, fortune will save some state about what fortune
+it was up to on disk.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/games/fortune/*"
+.It Pa /usr/games/fortune
+.It Pa /usr/share/games/fortune/*
+the fortunes databases (those files ending
+.Dq Pa -o
+contain the
+.Sy offensive
+fortunes)
+.El
+.Sh SEE ALSO
+.Xr arc4random_uniform 3 ,
+.Xr regcomp 3 ,
+.Xr regex 3 ,
+.Xr strfile 8
diff --git a/usr.bin/fortune/fortune/fortune.c b/usr.bin/fortune/fortune/fortune.c
new file mode 100644
index 0000000..2fb2be0
--- /dev/null
+++ b/usr.bin/fortune/fortune/fortune.c
@@ -0,0 +1,1427 @@
+/*-
+ * Copyright (c) 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ken Arnold.
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1986, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+#include <sys/endian.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "strfile.h"
+#include "pathnames.h"
+
+#define TRUE true
+#define FALSE false
+
+#define MINW 6 /* minimum wait if desired */
+#define CPERS 20 /* # of chars for each sec */
+#define SLEN 160 /* # of chars in short fortune */
+
+#define POS_UNKNOWN ((uint32_t) -1) /* pos for file unknown */
+#define NO_PROB (-1) /* no prob specified for file */
+
+#ifdef DEBUG
+#define DPRINTF(l,x) { if (Debug >= l) fprintf x; }
+#undef NDEBUG
+#else
+#define DPRINTF(l,x)
+#define NDEBUG 1
+#endif
+
+typedef struct fd {
+ int percent;
+ int fd, datfd;
+ uint32_t pos;
+ FILE *inf;
+ const char *name;
+ const char *path;
+ char *datfile, *posfile;
+ bool read_tbl;
+ bool was_pos_file;
+ STRFILE tbl;
+ int num_children;
+ struct fd *child, *parent;
+ struct fd *next, *prev;
+} FILEDESC;
+
+static bool Found_one; /* did we find a match? */
+static bool Find_files = FALSE; /* just find a list of proper fortune files */
+static bool Fortunes_only = FALSE; /* check only "fortunes" files */
+static bool Wait = FALSE; /* wait desired after fortune */
+static bool Short_only = FALSE; /* short fortune desired */
+static bool Long_only = FALSE; /* long fortune desired */
+static bool Offend = FALSE; /* offensive fortunes only */
+static bool All_forts = FALSE; /* any fortune allowed */
+static bool Equal_probs = FALSE; /* scatter un-allocted prob equally */
+static bool Match = FALSE; /* dump fortunes matching a pattern */
+static bool WriteToDisk = false; /* use files on disk to save state */
+#ifdef DEBUG
+static int Debug = 0; /* print debug messages */
+#endif
+
+static char *Fortbuf = NULL; /* fortune buffer for -m */
+
+static int Fort_len = 0;
+
+static off_t Seekpts[2]; /* seek pointers to fortunes */
+
+static FILEDESC *File_list = NULL, /* Head of file list */
+ *File_tail = NULL; /* Tail of file list */
+static FILEDESC *Fortfile; /* Fortune file to use */
+
+static STRFILE Noprob_tbl; /* sum of data for all no prob files */
+
+static const char *Fortune_path;
+static char **Fortune_path_arr;
+
+static int add_dir(FILEDESC *);
+static int add_file(int, const char *, const char *, FILEDESC **,
+ FILEDESC **, FILEDESC *);
+static void all_forts(FILEDESC *, char *);
+static char *copy(const char *, u_int);
+static void display(FILEDESC *);
+static void do_free(void *);
+static void *do_malloc(u_int);
+static int form_file_list(char **, int);
+static int fortlen(void);
+static void get_fort(void);
+static void get_pos(FILEDESC *);
+static void get_tbl(FILEDESC *);
+static void getargs(int, char *[]);
+static void getpath(void);
+static void init_prob(void);
+static int is_dir(const char *);
+static int is_fortfile(const char *, char **, char **, int);
+static int is_off_name(const char *);
+static int max(int, int);
+static FILEDESC *new_fp(void);
+static char *off_name(const char *);
+static void open_dat(FILEDESC *);
+static void open_fp(FILEDESC *);
+static FILEDESC *pick_child(FILEDESC *);
+static void print_file_list(void);
+static void print_list(FILEDESC *, int);
+static void sum_noprobs(FILEDESC *);
+static void sum_tbl(STRFILE *, STRFILE *);
+static void usage(void);
+static void zero_tbl(STRFILE *);
+
+static char *conv_pat(char *);
+static int find_matches(void);
+static void matches_in_list(FILEDESC *);
+static int maxlen_in_list(FILEDESC *);
+
+static regex_t Re_pat;
+
+int
+main(int argc, char *argv[])
+{
+ int fd;
+
+ if (getenv("FORTUNE_SAVESTATE") != NULL)
+ WriteToDisk = true;
+
+ (void) setlocale(LC_ALL, "");
+
+ getpath();
+ getargs(argc, argv);
+
+ if (Match)
+ exit(find_matches() != 0);
+
+ init_prob();
+ do {
+ get_fort();
+ } while ((Short_only && fortlen() > SLEN) ||
+ (Long_only && fortlen() <= SLEN));
+
+ display(Fortfile);
+
+ if (WriteToDisk) {
+ if ((fd = creat(Fortfile->posfile, 0666)) < 0) {
+ perror(Fortfile->posfile);
+ exit(1);
+ }
+ /*
+ * if we can, we exclusive lock, but since it isn't very
+ * important, we just punt if we don't have easy locking
+ * available.
+ */
+ flock(fd, LOCK_EX);
+ write(fd, (char *) &Fortfile->pos, sizeof Fortfile->pos);
+ if (!Fortfile->was_pos_file)
+ chmod(Fortfile->path, 0666);
+ flock(fd, LOCK_UN);
+ }
+ if (Wait) {
+ if (Fort_len == 0)
+ (void) fortlen();
+ sleep((unsigned int) max(Fort_len / CPERS, MINW));
+ }
+
+ exit(0);
+}
+
+static void
+display(FILEDESC *fp)
+{
+ char *p;
+ unsigned char ch;
+ char line[BUFSIZ];
+
+ open_fp(fp);
+ fseeko(fp->inf, Seekpts[0], SEEK_SET);
+ for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&
+ !STR_ENDSTRING(line, fp->tbl); Fort_len++) {
+ if (fp->tbl.str_flags & STR_ROTATED)
+ for (p = line; (ch = *p) != '\0'; ++p) {
+ if (isascii(ch)) {
+ if (isupper(ch))
+ *p = 'A' + (ch - 'A' + 13) % 26;
+ else if (islower(ch))
+ *p = 'a' + (ch - 'a' + 13) % 26;
+ }
+ }
+ if (fp->tbl.str_flags & STR_COMMENTS
+ && line[0] == fp->tbl.str_delim
+ && line[1] == fp->tbl.str_delim)
+ continue;
+ fputs(line, stdout);
+ }
+ (void) fflush(stdout);
+}
+
+/*
+ * fortlen:
+ * Return the length of the fortune.
+ */
+static int
+fortlen(void)
+{
+ int nchar;
+ char line[BUFSIZ];
+
+ if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
+ nchar = (int)(Seekpts[1] - Seekpts[0]);
+ else {
+ open_fp(Fortfile);
+ fseeko(Fortfile->inf, Seekpts[0], SEEK_SET);
+ nchar = 0;
+ while (fgets(line, sizeof line, Fortfile->inf) != NULL &&
+ !STR_ENDSTRING(line, Fortfile->tbl))
+ nchar += strlen(line);
+ }
+ Fort_len = nchar;
+
+ return (nchar);
+}
+
+/*
+ * This routine evaluates the arguments on the command line
+ */
+static void
+getargs(int argc, char *argv[])
+{
+ int ignore_case;
+ char *pat;
+ int ch;
+
+ ignore_case = FALSE;
+ pat = NULL;
+
+#ifdef DEBUG
+ while ((ch = getopt(argc, argv, "aDefilm:osw")) != -1)
+#else
+ while ((ch = getopt(argc, argv, "aefilm:osw")) != -1)
+#endif /* DEBUG */
+ switch(ch) {
+ case 'a': /* any fortune */
+ All_forts++;
+ break;
+#ifdef DEBUG
+ case 'D':
+ Debug++;
+ break;
+#endif /* DEBUG */
+ case 'e':
+ Equal_probs++; /* scatter un-allocted prob equally */
+ break;
+ case 'f': /* find fortune files */
+ Find_files++;
+ break;
+ case 'l': /* long ones only */
+ Long_only++;
+ Short_only = FALSE;
+ break;
+ case 'o': /* offensive ones only */
+ Offend++;
+ break;
+ case 's': /* short ones only */
+ Short_only++;
+ Long_only = FALSE;
+ break;
+ case 'w': /* give time to read */
+ Wait++;
+ break;
+ case 'm': /* dump out the fortunes */
+ Match++;
+ pat = optarg;
+ break;
+ case 'i': /* case-insensitive match */
+ ignore_case++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!form_file_list(argv, argc))
+ exit(1); /* errors printed through form_file_list() */
+ if (Find_files) {
+ print_file_list();
+ exit(0);
+ }
+#ifdef DEBUG
+ else if (Debug >= 1)
+ print_file_list();
+#endif /* DEBUG */
+
+ if (pat != NULL) {
+ int error;
+
+ if (ignore_case)
+ pat = conv_pat(pat);
+ error = regcomp(&Re_pat, pat, REG_BASIC);
+ if (error) {
+ fprintf(stderr, "regcomp(%s) fails\n", pat);
+ exit(1);
+ }
+ }
+}
+
+/*
+ * form_file_list:
+ * Form the file list from the file specifications.
+ */
+static int
+form_file_list(char **files, int file_cnt)
+{
+ int i, percent;
+ char *sp;
+ char **pstr;
+
+ if (file_cnt == 0) {
+ if (Find_files) {
+ Fortunes_only = TRUE;
+ pstr = Fortune_path_arr;
+ i = 0;
+ while (*pstr) {
+ i += add_file(NO_PROB, *pstr++, NULL,
+ &File_list, &File_tail, NULL);
+ }
+ Fortunes_only = FALSE;
+ if (!i) {
+ fprintf(stderr, "No fortunes found in %s.\n",
+ Fortune_path);
+ }
+ return (i != 0);
+ } else {
+ pstr = Fortune_path_arr;
+ i = 0;
+ while (*pstr) {
+ i += add_file(NO_PROB, "fortunes", *pstr++,
+ &File_list, &File_tail, NULL);
+ }
+ if (!i) {
+ fprintf(stderr, "No fortunes found in %s.\n",
+ Fortune_path);
+ }
+ return (i != 0);
+ }
+ }
+ for (i = 0; i < file_cnt; i++) {
+ percent = NO_PROB;
+ if (!isdigit((unsigned char)files[i][0]))
+ sp = files[i];
+ else {
+ percent = 0;
+ for (sp = files[i]; isdigit((unsigned char)*sp); sp++)
+ percent = percent * 10 + *sp - '0';
+ if (percent > 100) {
+ fprintf(stderr, "percentages must be <= 100\n");
+ return (FALSE);
+ }
+ if (*sp == '.') {
+ fprintf(stderr, "percentages must be integers\n");
+ return (FALSE);
+ }
+ /*
+ * If the number isn't followed by a '%', then
+ * it was not a percentage, just the first part
+ * of a file name which starts with digits.
+ */
+ if (*sp != '%') {
+ percent = NO_PROB;
+ sp = files[i];
+ }
+ else if (*++sp == '\0') {
+ if (++i >= file_cnt) {
+ fprintf(stderr, "percentages must precede files\n");
+ return (FALSE);
+ }
+ sp = files[i];
+ }
+ }
+ if (strcmp(sp, "all") == 0) {
+ pstr = Fortune_path_arr;
+ i = 0;
+ while (*pstr) {
+ i += add_file(NO_PROB, *pstr++, NULL,
+ &File_list, &File_tail, NULL);
+ }
+ if (!i) {
+ fprintf(stderr, "No fortunes found in %s.\n",
+ Fortune_path);
+ return (FALSE);
+ }
+ } else if (!add_file(percent, sp, NULL, &File_list,
+ &File_tail, NULL)) {
+ return (FALSE);
+ }
+ }
+
+ return (TRUE);
+}
+
+/*
+ * add_file:
+ * Add a file to the file list.
+ */
+static int
+add_file(int percent, const char *file, const char *dir, FILEDESC **head,
+ FILEDESC **tail, FILEDESC *parent)
+{
+ FILEDESC *fp;
+ int fd;
+ const char *path;
+ char *tpath, *offensive;
+ bool was_malloc;
+ bool isdir;
+
+ if (dir == NULL) {
+ path = file;
+ tpath = NULL;
+ was_malloc = FALSE;
+ }
+ else {
+ tpath = do_malloc((unsigned int)(strlen(dir) + strlen(file) + 2));
+ strcat(strcat(strcpy(tpath, dir), "/"), file);
+ path = tpath;
+ was_malloc = TRUE;
+ }
+ if ((isdir = is_dir(path)) && parent != NULL) {
+ if (was_malloc)
+ free(tpath);
+ return (FALSE); /* don't recurse */
+ }
+ offensive = NULL;
+ if (!isdir && parent == NULL && (All_forts || Offend) &&
+ !is_off_name(path)) {
+ offensive = off_name(path);
+ if (Offend) {
+ if (was_malloc)
+ free(tpath);
+ path = tpath = offensive;
+ offensive = NULL;
+ was_malloc = TRUE;
+ DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));
+ file = off_name(file);
+ }
+ }
+
+ DPRINTF(1, (stderr, "adding file \"%s\"\n", path));
+over:
+ if ((fd = open(path, O_RDONLY)) < 0) {
+ /*
+ * This is a sneak. If the user said -a, and if the
+ * file we're given isn't a file, we check to see if
+ * there is a -o version. If there is, we treat it as
+ * if *that* were the file given. We only do this for
+ * individual files -- if we're scanning a directory,
+ * we'll pick up the -o file anyway.
+ */
+ if (All_forts && offensive != NULL) {
+ if (was_malloc)
+ free(tpath);
+ path = tpath = offensive;
+ offensive = NULL;
+ was_malloc = TRUE;
+ DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));
+ file = off_name(file);
+ goto over;
+ }
+ if (dir == NULL && file[0] != '/') {
+ int i = 0;
+ char **pstr = Fortune_path_arr;
+
+ while (*pstr) {
+ i += add_file(percent, file, *pstr++,
+ head, tail, parent);
+ }
+ if (!i) {
+ fprintf(stderr, "No '%s' found in %s.\n",
+ file, Fortune_path);
+ }
+ return (i != 0);
+ }
+ /*
+ if (parent == NULL)
+ perror(path);
+ */
+ if (was_malloc)
+ free(tpath);
+ return (FALSE);
+ }
+
+ DPRINTF(2, (stderr, "path = \"%s\"\n", path));
+
+ fp = new_fp();
+ fp->fd = fd;
+ fp->percent = percent;
+ fp->name = file;
+ fp->path = path;
+ fp->parent = parent;
+
+ if ((isdir && !add_dir(fp)) ||
+ (!isdir &&
+ !is_fortfile(path, &fp->datfile, &fp->posfile, (parent != NULL))))
+ {
+ if (parent == NULL)
+ fprintf(stderr,
+ "fortune:%s not a fortune file or directory\n",
+ path);
+ if (was_malloc)
+ free(tpath);
+ do_free(fp->datfile);
+ do_free(fp->posfile);
+ free(fp);
+ do_free(offensive);
+ return (FALSE);
+ }
+ /*
+ * If the user said -a, we need to make this node a pointer to
+ * both files, if there are two. We don't need to do this if
+ * we are scanning a directory, since the scan will pick up the
+ * -o file anyway.
+ */
+ if (All_forts && parent == NULL && !is_off_name(path))
+ all_forts(fp, offensive);
+ if (*head == NULL)
+ *head = *tail = fp;
+ else if (fp->percent == NO_PROB) {
+ (*tail)->next = fp;
+ fp->prev = *tail;
+ *tail = fp;
+ }
+ else {
+ (*head)->prev = fp;
+ fp->next = *head;
+ *head = fp;
+ }
+ if (WriteToDisk)
+ fp->was_pos_file = (access(fp->posfile, W_OK) >= 0);
+
+ return (TRUE);
+}
+
+/*
+ * new_fp:
+ * Return a pointer to an initialized new FILEDESC.
+ */
+static FILEDESC *
+new_fp(void)
+{
+ FILEDESC *fp;
+
+ fp = do_malloc(sizeof(*fp));
+ fp->datfd = -1;
+ fp->pos = POS_UNKNOWN;
+ fp->inf = NULL;
+ fp->fd = -1;
+ fp->percent = NO_PROB;
+ fp->read_tbl = FALSE;
+ fp->next = NULL;
+ fp->prev = NULL;
+ fp->child = NULL;
+ fp->parent = NULL;
+ fp->datfile = NULL;
+ fp->posfile = NULL;
+
+ return (fp);
+}
+
+/*
+ * off_name:
+ * Return a pointer to the offensive version of a file of this name.
+ */
+static char *
+off_name(const char *file)
+{
+ char *new;
+
+ new = copy(file, (unsigned int) (strlen(file) + 2));
+
+ return (strcat(new, "-o"));
+}
+
+/*
+ * is_off_name:
+ * Is the file an offensive-style name?
+ */
+static int
+is_off_name(const char *file)
+{
+ int len;
+
+ len = strlen(file);
+
+ return (len >= 3 && file[len - 2] == '-' && file[len - 1] == 'o');
+}
+
+/*
+ * all_forts:
+ * Modify a FILEDESC element to be the parent of two children if
+ * there are two children to be a parent of.
+ */
+static void
+all_forts(FILEDESC *fp, char *offensive)
+{
+ char *sp;
+ FILEDESC *scene, *obscene;
+ int fd;
+ char *datfile, *posfile;
+
+ if (fp->child != NULL) /* this is a directory, not a file */
+ return;
+ if (!is_fortfile(offensive, &datfile, &posfile, FALSE))
+ return;
+ if ((fd = open(offensive, O_RDONLY)) < 0)
+ return;
+ DPRINTF(1, (stderr, "adding \"%s\" because of -a\n", offensive));
+ scene = new_fp();
+ obscene = new_fp();
+ *scene = *fp;
+
+ fp->num_children = 2;
+ fp->child = scene;
+ scene->next = obscene;
+ obscene->next = NULL;
+ scene->child = obscene->child = NULL;
+ scene->parent = obscene->parent = fp;
+
+ fp->fd = -1;
+ scene->percent = obscene->percent = NO_PROB;
+
+ obscene->fd = fd;
+ obscene->inf = NULL;
+ obscene->path = offensive;
+ if ((sp = strrchr(offensive, '/')) == NULL)
+ obscene->name = offensive;
+ else
+ obscene->name = ++sp;
+ obscene->datfile = datfile;
+ obscene->posfile = posfile;
+ obscene->read_tbl = false;
+ if (WriteToDisk)
+ obscene->was_pos_file = (access(obscene->posfile, W_OK) >= 0);
+}
+
+/*
+ * add_dir:
+ * Add the contents of an entire directory.
+ */
+static int
+add_dir(FILEDESC *fp)
+{
+ DIR *dir;
+ struct dirent *dirent;
+ FILEDESC *tailp;
+ char *name;
+
+ (void) close(fp->fd);
+ fp->fd = -1;
+ if ((dir = opendir(fp->path)) == NULL) {
+ perror(fp->path);
+ return (FALSE);
+ }
+ tailp = NULL;
+ DPRINTF(1, (stderr, "adding dir \"%s\"\n", fp->path));
+ fp->num_children = 0;
+ while ((dirent = readdir(dir)) != NULL) {
+ if (dirent->d_namlen == 0)
+ continue;
+ name = copy(dirent->d_name, dirent->d_namlen);
+ if (add_file(NO_PROB, name, fp->path, &fp->child, &tailp, fp))
+ fp->num_children++;
+ else
+ free(name);
+ }
+ if (fp->num_children == 0) {
+ (void) fprintf(stderr,
+ "fortune: %s: No fortune files in directory.\n", fp->path);
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+/*
+ * is_dir:
+ * Return TRUE if the file is a directory, FALSE otherwise.
+ */
+static int
+is_dir(const char *file)
+{
+ struct stat sbuf;
+
+ if (stat(file, &sbuf) < 0)
+ return (FALSE);
+
+ return (sbuf.st_mode & S_IFDIR);
+}
+
+/*
+ * is_fortfile:
+ * Return TRUE if the file is a fortune database file. We try and
+ * exclude files without reading them if possible to avoid
+ * overhead. Files which start with ".", or which have "illegal"
+ * suffixes, as contained in suflist[], are ruled out.
+ */
+/* ARGSUSED */
+static int
+is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
+{
+ int i;
+ const char *sp;
+ char *datfile;
+ static const char *suflist[] = {
+ /* list of "illegal" suffixes" */
+ "dat", "pos", "c", "h", "p", "i", "f",
+ "pas", "ftn", "ins.c", "ins,pas",
+ "ins.ftn", "sml",
+ NULL
+ };
+
+ DPRINTF(2, (stderr, "is_fortfile(%s) returns ", file));
+
+ /*
+ * Preclude any -o files for offendable people, and any non -o
+ * files for completely offensive people.
+ */
+ if (check_for_offend && !All_forts) {
+ i = strlen(file);
+ if (Offend ^ (file[i - 2] == '-' && file[i - 1] == 'o')) {
+ DPRINTF(2, (stderr, "FALSE (offending file)\n"));
+ return (FALSE);
+ }
+ }
+
+ if ((sp = strrchr(file, '/')) == NULL)
+ sp = file;
+ else
+ sp++;
+ if (*sp == '.') {
+ DPRINTF(2, (stderr, "FALSE (file starts with '.')\n"));
+ return (FALSE);
+ }
+ if (Fortunes_only && strncmp(sp, "fortunes", 8) != 0) {
+ DPRINTF(2, (stderr, "FALSE (check fortunes only)\n"));
+ return (FALSE);
+ }
+ if ((sp = strrchr(sp, '.')) != NULL) {
+ sp++;
+ for (i = 0; suflist[i] != NULL; i++)
+ if (strcmp(sp, suflist[i]) == 0) {
+ DPRINTF(2, (stderr, "FALSE (file has suffix \".%s\")\n", sp));
+ return (FALSE);
+ }
+ }
+
+ datfile = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */
+ strcat(datfile, ".dat");
+ if (access(datfile, R_OK) < 0) {
+ DPRINTF(2, (stderr, "FALSE (no readable \".dat\" file)\n"));
+ free(datfile);
+ return (FALSE);
+ }
+ if (datp != NULL)
+ *datp = datfile;
+ else
+ free(datfile);
+ if (posp != NULL) {
+ if (WriteToDisk) {
+ *posp = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */
+ strcat(*posp, ".pos");
+ }
+ else {
+ *posp = NULL;
+ }
+ }
+ DPRINTF(2, (stderr, "TRUE\n"));
+
+ return (TRUE);
+}
+
+/*
+ * copy:
+ * Return a malloc()'ed copy of the string
+ */
+static char *
+copy(const char *str, unsigned int len)
+{
+ char *new, *sp;
+
+ new = do_malloc(len + 1);
+ sp = new;
+ do {
+ *sp++ = *str;
+ } while (*str++);
+
+ return (new);
+}
+
+/*
+ * do_malloc:
+ * Do a malloc, checking for NULL return.
+ */
+static void *
+do_malloc(unsigned int size)
+{
+ void *new;
+
+ if ((new = malloc(size)) == NULL) {
+ (void) fprintf(stderr, "fortune: out of memory.\n");
+ exit(1);
+ }
+
+ return (new);
+}
+
+/*
+ * do_free:
+ * Free malloc'ed space, if any.
+ */
+static void
+do_free(void *ptr)
+{
+ if (ptr != NULL)
+ free(ptr);
+}
+
+/*
+ * init_prob:
+ * Initialize the fortune probabilities.
+ */
+static void
+init_prob(void)
+{
+ FILEDESC *fp, *last = NULL;
+ int percent, num_noprob, frac;
+
+ /*
+ * Distribute the residual probability (if any) across all
+ * files with unspecified probability (i.e., probability of 0)
+ * (if any).
+ */
+
+ percent = 0;
+ num_noprob = 0;
+ for (fp = File_tail; fp != NULL; fp = fp->prev)
+ if (fp->percent == NO_PROB) {
+ num_noprob++;
+ if (Equal_probs)
+ last = fp;
+ } else
+ percent += fp->percent;
+ DPRINTF(1, (stderr, "summing probabilities:%d%% with %d NO_PROB's",
+ percent, num_noprob));
+ if (percent > 100) {
+ (void) fprintf(stderr,
+ "fortune: probabilities sum to %d%% > 100%%!\n", percent);
+ exit(1);
+ } else if (percent < 100 && num_noprob == 0) {
+ (void) fprintf(stderr,
+ "fortune: no place to put residual probability (%d%% < 100%%)\n",
+ percent);
+ exit(1);
+ } else if (percent == 100 && num_noprob != 0) {
+ (void) fprintf(stderr,
+ "fortune: no probability left to put in residual files (100%%)\n");
+ exit(1);
+ }
+ percent = 100 - percent;
+ if (Equal_probs) {
+ if (num_noprob != 0) {
+ if (num_noprob > 1) {
+ frac = percent / num_noprob;
+ DPRINTF(1, (stderr, ", frac = %d%%", frac));
+ for (fp = File_tail; fp != last; fp = fp->prev)
+ if (fp->percent == NO_PROB) {
+ fp->percent = frac;
+ percent -= frac;
+ }
+ }
+ last->percent = percent;
+ DPRINTF(1, (stderr, ", residual = %d%%", percent));
+ }
+ else
+ DPRINTF(1, (stderr,
+ ", %d%% distributed over remaining fortunes\n",
+ percent));
+ }
+ DPRINTF(1, (stderr, "\n"));
+
+#ifdef DEBUG
+ if (Debug >= 1)
+ print_file_list();
+#endif
+}
+
+/*
+ * get_fort:
+ * Get the fortune data file's seek pointer for the next fortune.
+ */
+static void
+get_fort(void)
+{
+ FILEDESC *fp;
+ int choice;
+
+ if (File_list->next == NULL || File_list->percent == NO_PROB)
+ fp = File_list;
+ else {
+ choice = arc4random_uniform(100);
+ DPRINTF(1, (stderr, "choice = %d\n", choice));
+ for (fp = File_list; fp->percent != NO_PROB; fp = fp->next)
+ if (choice < fp->percent)
+ break;
+ else {
+ choice -= fp->percent;
+ DPRINTF(1, (stderr,
+ " skip \"%s\", %d%% (choice = %d)\n",
+ fp->name, fp->percent, choice));
+ }
+ DPRINTF(1, (stderr,
+ "using \"%s\", %d%% (choice = %d)\n",
+ fp->name, fp->percent, choice));
+ }
+ if (fp->percent != NO_PROB)
+ get_tbl(fp);
+ else {
+ if (fp->next != NULL) {
+ sum_noprobs(fp);
+ choice = arc4random_uniform(Noprob_tbl.str_numstr);
+ DPRINTF(1, (stderr, "choice = %d (of %u) \n", choice,
+ Noprob_tbl.str_numstr));
+ while ((unsigned int)choice >= fp->tbl.str_numstr) {
+ choice -= fp->tbl.str_numstr;
+ fp = fp->next;
+ DPRINTF(1, (stderr,
+ " skip \"%s\", %u (choice = %d)\n",
+ fp->name, fp->tbl.str_numstr,
+ choice));
+ }
+ DPRINTF(1, (stderr, "using \"%s\", %u\n", fp->name,
+ fp->tbl.str_numstr));
+ }
+ get_tbl(fp);
+ }
+ if (fp->child != NULL) {
+ DPRINTF(1, (stderr, "picking child\n"));
+ fp = pick_child(fp);
+ }
+ Fortfile = fp;
+ get_pos(fp);
+ open_dat(fp);
+ lseek(fp->datfd,
+ (off_t) (sizeof fp->tbl + fp->pos * sizeof Seekpts[0]), SEEK_SET);
+ read(fp->datfd, Seekpts, sizeof Seekpts);
+ Seekpts[0] = be64toh(Seekpts[0]);
+ Seekpts[1] = be64toh(Seekpts[1]);
+}
+
+/*
+ * pick_child
+ * Pick a child from a chosen parent.
+ */
+static FILEDESC *
+pick_child(FILEDESC *parent)
+{
+ FILEDESC *fp;
+ int choice;
+
+ if (Equal_probs) {
+ choice = arc4random_uniform(parent->num_children);
+ DPRINTF(1, (stderr, " choice = %d (of %d)\n",
+ choice, parent->num_children));
+ for (fp = parent->child; choice--; fp = fp->next)
+ continue;
+ DPRINTF(1, (stderr, " using %s\n", fp->name));
+ return (fp);
+ }
+ else {
+ get_tbl(parent);
+ choice = arc4random_uniform(parent->tbl.str_numstr);
+ DPRINTF(1, (stderr, " choice = %d (of %u)\n",
+ choice, parent->tbl.str_numstr));
+ for (fp = parent->child; (unsigned)choice >= fp->tbl.str_numstr;
+ fp = fp->next) {
+ choice -= fp->tbl.str_numstr;
+ DPRINTF(1, (stderr, "\tskip %s, %u (choice = %d)\n",
+ fp->name, fp->tbl.str_numstr, choice));
+ }
+ DPRINTF(1, (stderr, " using %s, %u\n", fp->name,
+ fp->tbl.str_numstr));
+ return (fp);
+ }
+}
+
+/*
+ * sum_noprobs:
+ * Sum up all the noprob probabilities, starting with fp.
+ */
+static void
+sum_noprobs(FILEDESC *fp)
+{
+ static bool did_noprobs = FALSE;
+
+ if (did_noprobs)
+ return;
+ zero_tbl(&Noprob_tbl);
+ while (fp != NULL) {
+ get_tbl(fp);
+ sum_tbl(&Noprob_tbl, &fp->tbl);
+ fp = fp->next;
+ }
+ did_noprobs = TRUE;
+}
+
+static int
+max(int i, int j)
+{
+ return (i >= j ? i : j);
+}
+
+/*
+ * open_fp:
+ * Assocatiate a FILE * with the given FILEDESC.
+ */
+static void
+open_fp(FILEDESC *fp)
+{
+ if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL) {
+ perror(fp->path);
+ exit(1);
+ }
+}
+
+/*
+ * open_dat:
+ * Open up the dat file if we need to.
+ */
+static void
+open_dat(FILEDESC *fp)
+{
+ if (fp->datfd < 0 && (fp->datfd = open(fp->datfile, O_RDONLY)) < 0) {
+ perror(fp->datfile);
+ exit(1);
+ }
+}
+
+/*
+ * get_pos:
+ * Get the position from the pos file, if there is one. If not,
+ * return a random number.
+ */
+static void
+get_pos(FILEDESC *fp)
+{
+ int fd;
+
+ assert(fp->read_tbl);
+ if (fp->pos == POS_UNKNOWN) {
+ if (WriteToDisk) {
+ if ((fd = open(fp->posfile, O_RDONLY)) < 0 ||
+ read(fd, &fp->pos, sizeof fp->pos) != sizeof fp->pos)
+ fp->pos = arc4random_uniform(fp->tbl.str_numstr);
+ else if (fp->pos >= fp->tbl.str_numstr)
+ fp->pos %= fp->tbl.str_numstr;
+ if (fd >= 0)
+ close(fd);
+ }
+ else
+ fp->pos = arc4random_uniform(fp->tbl.str_numstr);
+ }
+ if (++(fp->pos) >= fp->tbl.str_numstr)
+ fp->pos -= fp->tbl.str_numstr;
+ DPRINTF(1, (stderr, "pos for %s is %ld\n", fp->name, (long)fp->pos));
+}
+
+/*
+ * get_tbl:
+ * Get the tbl data file the datfile.
+ */
+static void
+get_tbl(FILEDESC *fp)
+{
+ int fd;
+ FILEDESC *child;
+
+ if (fp->read_tbl)
+ return;
+ if (fp->child == NULL) {
+ if ((fd = open(fp->datfile, O_RDONLY)) < 0) {
+ perror(fp->datfile);
+ exit(1);
+ }
+ if (read(fd, (char *) &fp->tbl, sizeof fp->tbl) != sizeof fp->tbl) {
+ (void)fprintf(stderr,
+ "fortune: %s corrupted\n", fp->path);
+ exit(1);
+ }
+ /* fp->tbl.str_version = be32toh(fp->tbl.str_version); */
+ fp->tbl.str_numstr = be32toh(fp->tbl.str_numstr);
+ fp->tbl.str_longlen = be32toh(fp->tbl.str_longlen);
+ fp->tbl.str_shortlen = be32toh(fp->tbl.str_shortlen);
+ fp->tbl.str_flags = be32toh(fp->tbl.str_flags);
+ (void) close(fd);
+ }
+ else {
+ zero_tbl(&fp->tbl);
+ for (child = fp->child; child != NULL; child = child->next) {
+ get_tbl(child);
+ sum_tbl(&fp->tbl, &child->tbl);
+ }
+ }
+ fp->read_tbl = TRUE;
+}
+
+/*
+ * zero_tbl:
+ * Zero out the fields we care about in a tbl structure.
+ */
+static void
+zero_tbl(STRFILE *tp)
+{
+ tp->str_numstr = 0;
+ tp->str_longlen = 0;
+ tp->str_shortlen = ~0;
+}
+
+/*
+ * sum_tbl:
+ * Merge the tbl data of t2 into t1.
+ */
+static void
+sum_tbl(STRFILE *t1, STRFILE *t2)
+{
+ t1->str_numstr += t2->str_numstr;
+ if (t1->str_longlen < t2->str_longlen)
+ t1->str_longlen = t2->str_longlen;
+ if (t1->str_shortlen > t2->str_shortlen)
+ t1->str_shortlen = t2->str_shortlen;
+}
+
+#define STR(str) ((str) == NULL ? "NULL" : (str))
+
+/*
+ * print_file_list:
+ * Print out the file list
+ */
+static void
+print_file_list(void)
+{
+ print_list(File_list, 0);
+}
+
+/*
+ * print_list:
+ * Print out the actual list, recursively.
+ */
+static void
+print_list(FILEDESC *list, int lev)
+{
+ while (list != NULL) {
+ fprintf(stderr, "%*s", lev * 4, "");
+ if (list->percent == NO_PROB)
+ fprintf(stderr, "___%%");
+ else
+ fprintf(stderr, "%3d%%", list->percent);
+ fprintf(stderr, " %s", STR(list->name));
+ DPRINTF(1, (stderr, " (%s, %s, %s)", STR(list->path),
+ STR(list->datfile), STR(list->posfile)));
+ fprintf(stderr, "\n");
+ if (list->child != NULL)
+ print_list(list->child, lev + 1);
+ list = list->next;
+ }
+}
+
+/*
+ * conv_pat:
+ * Convert the pattern to an ignore-case equivalent.
+ */
+static char *
+conv_pat(char *orig)
+{
+ char *sp;
+ unsigned int cnt;
+ char *new;
+
+ cnt = 1; /* allow for '\0' */
+ for (sp = orig; *sp != '\0'; sp++)
+ if (isalpha((unsigned char)*sp))
+ cnt += 4;
+ else
+ cnt++;
+ if ((new = malloc(cnt)) == NULL) {
+ fprintf(stderr, "pattern too long for ignoring case\n");
+ exit(1);
+ }
+
+ for (sp = new; *orig != '\0'; orig++) {
+ if (islower((unsigned char)*orig)) {
+ *sp++ = '[';
+ *sp++ = *orig;
+ *sp++ = toupper((unsigned char)*orig);
+ *sp++ = ']';
+ }
+ else if (isupper((unsigned char)*orig)) {
+ *sp++ = '[';
+ *sp++ = *orig;
+ *sp++ = tolower((unsigned char)*orig);
+ *sp++ = ']';
+ }
+ else
+ *sp++ = *orig;
+ }
+ *sp = '\0';
+
+ return (new);
+}
+
+/*
+ * find_matches:
+ * Find all the fortunes which match the pattern we've been given.
+ */
+static int
+find_matches(void)
+{
+ Fort_len = maxlen_in_list(File_list);
+ DPRINTF(2, (stderr, "Maximum length is %d\n", Fort_len));
+ /* extra length, "%\n" is appended */
+ Fortbuf = do_malloc((unsigned int) Fort_len + 10);
+
+ Found_one = FALSE;
+ matches_in_list(File_list);
+
+ return (Found_one);
+}
+
+/*
+ * maxlen_in_list
+ * Return the maximum fortune len in the file list.
+ */
+static int
+maxlen_in_list(FILEDESC *list)
+{
+ FILEDESC *fp;
+ int len, maxlen;
+
+ maxlen = 0;
+ for (fp = list; fp != NULL; fp = fp->next) {
+ if (fp->child != NULL) {
+ if ((len = maxlen_in_list(fp->child)) > maxlen)
+ maxlen = len;
+ }
+ else {
+ get_tbl(fp);
+ if (fp->tbl.str_longlen > (unsigned int)maxlen)
+ maxlen = fp->tbl.str_longlen;
+ }
+ }
+
+ return (maxlen);
+}
+
+/*
+ * matches_in_list
+ * Print out the matches from the files in the list.
+ */
+static void
+matches_in_list(FILEDESC *list)
+{
+ char *sp, *p;
+ FILEDESC *fp;
+ int in_file;
+ unsigned char ch;
+
+ for (fp = list; fp != NULL; fp = fp->next) {
+ if (fp->child != NULL) {
+ matches_in_list(fp->child);
+ continue;
+ }
+ DPRINTF(1, (stderr, "searching in %s\n", fp->path));
+ open_fp(fp);
+ sp = Fortbuf;
+ in_file = FALSE;
+ while (fgets(sp, Fort_len, fp->inf) != NULL)
+ if (fp->tbl.str_flags & STR_COMMENTS
+ && sp[0] == fp->tbl.str_delim
+ && sp[1] == fp->tbl.str_delim)
+ continue;
+ else if (!STR_ENDSTRING(sp, fp->tbl))
+ sp += strlen(sp);
+ else {
+ *sp = '\0';
+ if (fp->tbl.str_flags & STR_ROTATED)
+ for (p = Fortbuf; (ch = *p) != '\0'; ++p) {
+ if (isascii(ch)) {
+ if (isupper(ch))
+ *p = 'A' + (ch - 'A' + 13) % 26;
+ else if (islower(ch))
+ *p = 'a' + (ch - 'a' + 13) % 26;
+ }
+ }
+ if (regexec(&Re_pat, Fortbuf, 0, NULL, 0) != REG_NOMATCH) {
+ printf("%c%c", fp->tbl.str_delim,
+ fp->tbl.str_delim);
+ if (!in_file) {
+ printf(" (%s)", fp->name);
+ Found_one = TRUE;
+ in_file = TRUE;
+ }
+ putchar('\n');
+ (void) fwrite(Fortbuf, 1, (sp - Fortbuf), stdout);
+ }
+ sp = Fortbuf;
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr, "fortune [-a");
+#ifdef DEBUG
+ (void) fprintf(stderr, "D");
+#endif /* DEBUG */
+ (void) fprintf(stderr, "efilosw]");
+ (void) fprintf(stderr, " [-m pattern]");
+ (void) fprintf(stderr, " [[N%%] file/directory/all]\n");
+ exit(1);
+}
+
+/*
+ * getpath
+ * Set up file search patch from environment var FORTUNE_PATH;
+ * if not set, use the compiled in FORTDIR.
+ */
+
+static void
+getpath(void)
+{
+ int nstr, foundenv;
+ char *pch, **ppch, *str, *path;
+
+ foundenv = 1;
+ Fortune_path = getenv("FORTUNE_PATH");
+ if (Fortune_path == NULL) {
+ Fortune_path = FORTDIR;
+ foundenv = 0;
+ }
+ path = strdup(Fortune_path);
+
+ for (nstr = 2, pch = path; *pch != '\0'; pch++) {
+ if (*pch == ':')
+ nstr++;
+ }
+
+ ppch = Fortune_path_arr = (char **)calloc(nstr, sizeof(char *));
+
+ nstr = 0;
+ str = strtok(path, ":");
+ while (str) {
+ if (is_dir(str)) {
+ nstr++;
+ *ppch++ = str;
+ }
+ str = strtok(NULL, ":");
+ }
+
+ if (nstr == 0) {
+ if (foundenv == 1) {
+ fprintf(stderr,
+ "fortune: FORTUNE_PATH: None of the specified "
+ "directories found.\n");
+ exit(1);
+ }
+ free(path);
+ Fortune_path_arr[0] = strdup(FORTDIR);
+ }
+}
diff --git a/usr.bin/fortune/fortune/pathnames.h b/usr.bin/fortune/fortune/pathnames.h
new file mode 100644
index 0000000..149b3e8
--- /dev/null
+++ b/usr.bin/fortune/fortune/pathnames.h
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 1991, 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.
+ * 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.
+ *
+ * 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
+ * $FreeBSD$
+ */
+
+#define FORTDIR "/usr/share/games/fortune:" \
+ "/usr/local/share/games/fortune"
diff --git a/usr.bin/fortune/strfile/Makefile b/usr.bin/fortune/strfile/Makefile
new file mode 100644
index 0000000..a43e8ea
--- /dev/null
+++ b/usr.bin/fortune/strfile/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= strfile
+MAN= strfile.8
+MLINKS= strfile.8 unstr.8
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fortune/strfile/Makefile.depend b/usr.bin/fortune/strfile/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/fortune/strfile/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/fortune/strfile/strfile.8 b/usr.bin/fortune/strfile/strfile.8
new file mode 100644
index 0000000..26de0d7
--- /dev/null
+++ b/usr.bin/fortune/strfile/strfile.8
@@ -0,0 +1,159 @@
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Ken Arnold.
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)strfile.8 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd February 17, 2005
+.Dt STRFILE 8
+.Os
+.Sh NAME
+.Nm strfile ,
+.Nm unstr
+.Nd "create a random access file for storing strings"
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ciorsx
+.Op Fl c Ar char
+.Ar source_file
+.Op Ar output_file
+.Nm unstr
+.Ar source_file
+.Sh DESCRIPTION
+The
+.Nm
+utility
+reads a file containing groups of lines separated by a line containing
+a single percent
+.Ql %
+sign and creates a data file which contains
+a header structure and a table of file offsets for each group of lines.
+This allows random access of the strings.
+.Pp
+The output file, if not specified on the command line, is named
+.Ar source_file Ns Pa .dat .
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl c Ar char"
+.It Fl C
+Flag the file as containing comments.
+This option cases the
+.Dv STR_COMMENTS
+bit in the header
+.Va str_flags
+field to be set.
+Comments are designated by two delimiter characters at the
+beginning of the line, though
+.Nm
+does not give any special
+treatment to comment lines.
+.It Fl c Ar char
+Change the delimiting character from the percent sign to
+.Ar char .
+.It Fl i
+Ignore case when ordering the strings.
+.It Fl o
+Order the strings in alphabetical order.
+The offset table will be sorted in the alphabetical order of the
+groups of lines referenced.
+Any initial non-alphanumeric characters are ignored.
+This option causes the
+.Dv STR_ORDERED
+bit in the header
+.Va str_flags
+field to be set.
+.It Fl r
+Randomize access to the strings.
+Entries in the offset table will be randomly ordered.
+This option causes the
+.Dv STR_RANDOM
+bit in the header
+.Va str_flags
+field to be set.
+.It Fl s
+Run silently; do not give a summary message when finished.
+.It Fl x
+Note that each alphabetic character in the groups of lines is rotated
+13 positions in a simple caesar cypher.
+This option causes the
+.Dv STR_ROTATED
+bit in the header
+.Va str_flags
+field to be set.
+.El
+.Pp
+The format of the header is:
+.Bd -literal
+#define VERSION 1
+uint32_t str_version; /* version number */
+uint32_t str_numstr; /* # of strings in the file */
+uint32_t str_longlen; /* length of longest string */
+uint32_t str_shortlen; /* length of shortest string */
+#define STR_RANDOM 0x1 /* randomized pointers */
+#define STR_ORDERED 0x2 /* ordered pointers */
+#define STR_ROTATED 0x4 /* rot-13'd text */
+#define STR_COMMENTS 0x8 /* embedded comments */
+uint32_t str_flags; /* bit field for flags */
+char str_delim; /* delimiting character */
+.Ed
+.Pp
+All fields are written in network byte order.
+.Pp
+The purpose of
+.Nm unstr
+is to undo the work of
+.Nm .
+It prints out the strings contained in the file
+.Ar source_file
+in the order that they are listed in
+the header file
+.Ar source_file Ns Pa .dat
+to standard output.
+It is possible to create sorted versions of input files by using
+.Fl o
+when
+.Nm
+is run and then using
+.Nm unstr
+to dump them out in the table order.
+.Sh FILES
+.Bl -tag -width ".Pa strfile.dat" -compact
+.It Pa strfile.dat
+default output file.
+.El
+.Sh SEE ALSO
+.Xr byteorder 3 ,
+.Xr fortune 6
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.4 .
diff --git a/usr.bin/fortune/strfile/strfile.c b/usr.bin/fortune/strfile/strfile.c
new file mode 100644
index 0000000..f0a8ed2
--- /dev/null
+++ b/usr.bin/fortune/strfile/strfile.c
@@ -0,0 +1,454 @@
+/*-
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ken Arnold.
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/endian.h>
+#include <ctype.h>
+#include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "strfile.h"
+
+/*
+ * This program takes a file composed of strings separated by
+ * lines starting with two consecutive delimiting character (default
+ * character is '%') and creates another file which consists of a table
+ * describing the file (structure from "strfile.h"), a table of seek
+ * pointers to the start of the strings, and the strings, each terminated
+ * by a null byte. Usage:
+ *
+ * % strfile [-iorsx] [ -cC ] sourcefile [ datafile ]
+ *
+ * C - Allow comments marked by a double delimiter at line's beginning
+ * c - Change delimiting character from '%' to 'C'
+ * s - Silent. Give no summary of data processed at the end of
+ * the run.
+ * o - order the strings in alphabetic order
+ * i - if ordering, ignore case
+ * r - randomize the order of the strings
+ * x - set rotated bit
+ *
+ * Ken Arnold Sept. 7, 1978 --
+ *
+ * Added ordering options.
+ */
+
+#define STORING_PTRS (Oflag || Rflag)
+#define CHUNKSIZE 512
+
+#define ALLOC(ptr, sz) do { \
+ if (ptr == NULL) \
+ ptr = malloc(CHUNKSIZE * sizeof(*ptr)); \
+ else if (((sz) + 1) % CHUNKSIZE == 0) \
+ ptr = realloc(ptr, ((sz) + CHUNKSIZE) * sizeof(*ptr)); \
+ if (ptr == NULL) { \
+ fprintf(stderr, "out of space\n"); \
+ exit(1); \
+ } \
+ } while (0)
+
+typedef struct {
+ int first;
+ off_t pos;
+} STR;
+
+static char *Infile = NULL, /* input file name */
+ Outfile[MAXPATHLEN] = "", /* output file name */
+ Delimch = '%'; /* delimiting character */
+
+static int Cflag = false; /* embedded comments */
+static int Sflag = false; /* silent run flag */
+static int Oflag = false; /* ordering flag */
+static int Iflag = false; /* ignore case flag */
+static int Rflag = false; /* randomize order flag */
+static int Xflag = false; /* set rotated bit */
+static uint32_t Num_pts = 0; /* number of pointers/strings */
+
+static off_t *Seekpts;
+
+static FILE *Sort_1, *Sort_2; /* pointers for sorting */
+
+static STRFILE Tbl; /* statistics table */
+
+static STR *Firstch; /* first chars of each string */
+
+static void add_offset(FILE *, off_t);
+static int cmp_str(const void *, const void *);
+static int stable_collate_range_cmp(int, int);
+static void do_order(void);
+static void getargs(int, char **);
+static void randomize(void);
+static void usage(void);
+
+/*
+ * main:
+ * Drive the sucker. There are two main modes -- either we store
+ * the seek pointers, if the table is to be sorted or randomized,
+ * or we write the pointer directly to the file, if we are to stay
+ * in file order. If the former, we allocate and re-allocate in
+ * CHUNKSIZE blocks; if the latter, we just write each pointer,
+ * and then seek back to the beginning to write in the table.
+ */
+int
+main(int ac, char *av[])
+{
+ char *sp, *nsp, dc;
+ FILE *inf, *outf;
+ off_t last_off, pos, *p;
+ size_t length;
+ int first;
+ uint32_t cnt;
+ STR *fp;
+ static char string[257];
+
+ setlocale(LC_ALL, "");
+
+ getargs(ac, av); /* evalute arguments */
+ dc = Delimch;
+ if ((inf = fopen(Infile, "r")) == NULL) {
+ perror(Infile);
+ exit(1);
+ }
+
+ if ((outf = fopen(Outfile, "w")) == NULL) {
+ perror(Outfile);
+ exit(1);
+ }
+ if (!STORING_PTRS)
+ fseek(outf, (long)sizeof(Tbl), SEEK_SET);
+
+ /*
+ * Write the strings onto the file
+ */
+
+ Tbl.str_longlen = 0;
+ Tbl.str_shortlen = 0xffffffff;
+ Tbl.str_delim = dc;
+ Tbl.str_version = VERSION;
+ first = Oflag;
+ add_offset(outf, ftello(inf));
+ last_off = 0;
+ do {
+ sp = fgets(string, 256, inf);
+ if (sp == NULL || (sp[0] == dc && sp[1] == '\n')) {
+ pos = ftello(inf);
+ length = (size_t)(pos - last_off) -
+ (sp != NULL ? strlen(sp) : 0);
+ last_off = pos;
+ if (length == 0)
+ continue;
+ add_offset(outf, pos);
+ if ((size_t)Tbl.str_longlen < length)
+ Tbl.str_longlen = length;
+ if ((size_t)Tbl.str_shortlen > length)
+ Tbl.str_shortlen = length;
+ first = Oflag;
+ }
+ else if (first) {
+ for (nsp = sp; !isalnum((unsigned char)*nsp); nsp++)
+ continue;
+ ALLOC(Firstch, Num_pts);
+ fp = &Firstch[Num_pts - 1];
+ if (Iflag && isupper((unsigned char)*nsp))
+ fp->first = tolower((unsigned char)*nsp);
+ else
+ fp->first = *nsp;
+ fp->pos = Seekpts[Num_pts - 1];
+ first = false;
+ }
+ } while (sp != NULL);
+
+ /*
+ * write the tables in
+ */
+
+ fclose(inf);
+ Tbl.str_numstr = Num_pts - 1;
+
+ if (Cflag)
+ Tbl.str_flags |= STR_COMMENTS;
+
+ if (Oflag)
+ do_order();
+ else if (Rflag)
+ randomize();
+
+ if (Xflag)
+ Tbl.str_flags |= STR_ROTATED;
+
+ if (!Sflag) {
+ printf("\"%s\" created\n", Outfile);
+ if (Num_pts == 2)
+ puts("There was 1 string");
+ else
+ printf("There were %u strings\n", Num_pts - 1);
+ printf("Longest string: %u byte%s\n", Tbl.str_longlen,
+ Tbl.str_longlen == 1 ? "" : "s");
+ printf("Shortest string: %u byte%s\n", Tbl.str_shortlen,
+ Tbl.str_shortlen == 1 ? "" : "s");
+ }
+
+ rewind(outf);
+ Tbl.str_version = htobe32(Tbl.str_version);
+ Tbl.str_numstr = htobe32(Tbl.str_numstr);
+ Tbl.str_longlen = htobe32(Tbl.str_longlen);
+ Tbl.str_shortlen = htobe32(Tbl.str_shortlen);
+ Tbl.str_flags = htobe32(Tbl.str_flags);
+ fwrite((char *)&Tbl, sizeof(Tbl), 1, outf);
+ if (STORING_PTRS) {
+ for (p = Seekpts, cnt = Num_pts; cnt--; ++p)
+ *p = htobe64(*p);
+ fwrite(Seekpts, sizeof(*Seekpts), (size_t)Num_pts, outf);
+ }
+ fclose(outf);
+ exit(0);
+}
+
+/*
+ * This routine evaluates arguments from the command line
+ */
+void
+getargs(int argc, char **argv)
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, "Cc:iorsx")) != -1)
+ switch(ch) {
+ case 'C': /* embedded comments */
+ Cflag++;
+ break;
+ case 'c': /* new delimiting char */
+ Delimch = *optarg;
+ if (!isascii(Delimch)) {
+ printf("bad delimiting character: '\\%o\n'",
+ (unsigned char)Delimch);
+ }
+ break;
+ case 'i': /* ignore case in ordering */
+ Iflag++;
+ break;
+ case 'o': /* order strings */
+ Oflag++;
+ break;
+ case 'r': /* randomize pointers */
+ Rflag++;
+ break;
+ case 's': /* silent */
+ Sflag++;
+ break;
+ case 'x': /* set the rotated bit */
+ Xflag++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+
+ if (*argv) {
+ Infile = *argv;
+ if (*++argv)
+ strcpy(Outfile, *argv);
+ }
+ if (!Infile) {
+ puts("No input file name");
+ usage();
+ }
+ if (*Outfile == '\0') {
+ strcpy(Outfile, Infile);
+ strcat(Outfile, ".dat");
+ }
+}
+
+void
+usage(void)
+{
+ fprintf(stderr,
+ "strfile [-Ciorsx] [-c char] source_file [output_file]\n");
+ exit(1);
+}
+
+/*
+ * add_offset:
+ * Add an offset to the list, or write it out, as appropriate.
+ */
+void
+add_offset(FILE *fp, off_t off)
+{
+ off_t beoff;
+
+ if (!STORING_PTRS) {
+ beoff = htobe64(off);
+ fwrite(&beoff, 1, sizeof(beoff), fp);
+ } else {
+ ALLOC(Seekpts, Num_pts + 1);
+ Seekpts[Num_pts] = off;
+ }
+ Num_pts++;
+}
+
+/*
+ * do_order:
+ * Order the strings alphabetically (possibly ignoring case).
+ */
+void
+do_order(void)
+{
+ uint32_t i;
+ off_t *lp;
+ STR *fp;
+
+ Sort_1 = fopen(Infile, "r");
+ Sort_2 = fopen(Infile, "r");
+ qsort(Firstch, (size_t)Tbl.str_numstr, sizeof(*Firstch), cmp_str);
+ i = Tbl.str_numstr;
+ lp = Seekpts;
+ fp = Firstch;
+ while (i--)
+ *lp++ = fp++->pos;
+ fclose(Sort_1);
+ fclose(Sort_2);
+ Tbl.str_flags |= STR_ORDERED;
+}
+
+static int
+stable_collate_range_cmp(int c1, int c2)
+{
+ static char s1[2], s2[2];
+ int ret;
+
+ s1[0] = c1;
+ s2[0] = c2;
+ if ((ret = strcoll(s1, s2)) != 0)
+ return (ret);
+ return (c1 - c2);
+}
+
+/*
+ * cmp_str:
+ * Compare two strings in the file
+ */
+int
+cmp_str(const void *s1, const void *s2)
+{
+ const STR *p1, *p2;
+ int c1, c2, n1, n2, r;
+
+#define SET_N(nf,ch) (nf = (ch == '\n'))
+#define IS_END(ch,nf) (ch == EOF || (ch == (unsigned char)Delimch && nf))
+
+ p1 = (const STR *)s1;
+ p2 = (const STR *)s2;
+
+ c1 = (unsigned char)p1->first;
+ c2 = (unsigned char)p2->first;
+ if ((r = stable_collate_range_cmp(c1, c2)) != 0)
+ return (r);
+
+ fseeko(Sort_1, p1->pos, SEEK_SET);
+ fseeko(Sort_2, p2->pos, SEEK_SET);
+
+ n1 = false;
+ n2 = false;
+ while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0' && c1 != EOF)
+ SET_N(n1, c1);
+ while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0' && c2 != EOF)
+ SET_N(n2, c2);
+
+ while (!IS_END(c1, n1) && !IS_END(c2, n2)) {
+ if (Iflag) {
+ if (isupper(c1))
+ c1 = tolower(c1);
+ if (isupper(c2))
+ c2 = tolower(c2);
+ }
+ if ((r = stable_collate_range_cmp(c1, c2)) != 0)
+ return (r);
+ SET_N(n1, c1);
+ SET_N(n2, c2);
+ c1 = getc(Sort_1);
+ c2 = getc(Sort_2);
+ }
+ if (IS_END(c1, n1))
+ c1 = 0;
+ if (IS_END(c2, n2))
+ c2 = 0;
+
+ return (stable_collate_range_cmp(c1, c2));
+}
+
+/*
+ * randomize:
+ * Randomize the order of the string table. We must be careful
+ * not to randomize across delimiter boundaries. All
+ * randomization is done within each block.
+ */
+void
+randomize(void)
+{
+ uint32_t cnt, i;
+ off_t tmp;
+ off_t *sp;
+
+ Tbl.str_flags |= STR_RANDOM;
+ cnt = Tbl.str_numstr;
+
+ /*
+ * move things around randomly
+ */
+
+ for (sp = Seekpts; cnt > 0; cnt--, sp++) {
+ i = arc4random_uniform(cnt);
+ tmp = sp[0];
+ sp[0] = sp[i];
+ sp[i] = tmp;
+ }
+}
diff --git a/usr.bin/fortune/strfile/strfile.h b/usr.bin/fortune/strfile/strfile.h
new file mode 100644
index 0000000..5d4f875
--- /dev/null
+++ b/usr.bin/fortune/strfile/strfile.h
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ken Arnold.
+ *
+ * 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. 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.
+ *
+ * @(#)strfile.h 8.1 (Berkeley) 5/31/93
+ */
+/* $FreeBSD$ */
+
+#include <sys/types.h>
+
+#define STR_ENDSTRING(line,tbl) \
+ (((unsigned char)(line)[0]) == (tbl).str_delim && (line)[1] == '\n')
+
+typedef struct { /* information table */
+#define VERSION 1
+ uint32_t str_version; /* version number */
+ uint32_t str_numstr; /* # of strings in the file */
+ uint32_t str_longlen; /* length of longest string */
+ uint32_t str_shortlen; /* length of shortest string */
+#define STR_RANDOM 0x1 /* randomized pointers */
+#define STR_ORDERED 0x2 /* ordered pointers */
+#define STR_ROTATED 0x4 /* rot-13'd text */
+#define STR_COMMENTS 0x8 /* embedded comments */
+ uint32_t str_flags; /* bit field for flags */
+ unsigned char stuff[4]; /* 64-bit aligned space */
+#define str_delim stuff[0] /* delimiting character */
+} STRFILE;
diff --git a/usr.bin/fortune/tools/Do_spell b/usr.bin/fortune/tools/Do_spell
new file mode 100644
index 0000000..d997392
--- /dev/null
+++ b/usr.bin/fortune/tools/Do_spell
@@ -0,0 +1,10 @@
+#!/bin/sh -
+#
+# @(#)Do_spell 8.1 (Berkeley) 5/31/93
+#
+
+F=_spell.$$
+echo $1
+spell < $1 > $F
+sort $F $1.sp.ok | uniq -u | column
+rm -f $F
diff --git a/usr.bin/fortune/tools/Do_troff b/usr.bin/fortune/tools/Do_troff
new file mode 100644
index 0000000..52cb282
--- /dev/null
+++ b/usr.bin/fortune/tools/Do_troff
@@ -0,0 +1,10 @@
+#!/bin/csh -f
+#
+# @(#)Do_troff 8.1 (Berkeley) 5/31/93
+#
+
+set file=$1
+shift
+( echo ".ds Se $file" ; cat Troff.mac ; sed -f Troff.sed $file ) | \
+ $* -me >& $file.tr
+echo troff output in $file.tr
diff --git a/usr.bin/fortune/tools/Troff.mac b/usr.bin/fortune/tools/Troff.mac
new file mode 100644
index 0000000..c2b433e
--- /dev/null
+++ b/usr.bin/fortune/tools/Troff.mac
@@ -0,0 +1,26 @@
+.nr tp 8
+.nr hm 3v
+.nr fm 2v
+.nr tm 5v
+.nr bm 4v
+.cs R
+.sc
+.sz 6
+.ll +10n
+.lt \n(.l
+.de $h
+.tl 'Fortune Database'\\*(Se'\*(td'
+..
+.de $f
+.tl ''- % -''
+..
+.2c
+.nf
+.ta
+.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 80n
+.de %%
+.sp .3
+.ce
+\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq\|\(sq
+.sp .2
+..
diff --git a/usr.bin/fortune/tools/Troff.sed b/usr.bin/fortune/tools/Troff.sed
new file mode 100644
index 0000000..3216681
--- /dev/null
+++ b/usr.bin/fortune/tools/Troff.sed
@@ -0,0 +1,13 @@
+/^['.]/s//\\\&&/
+/^%%/s//.&/
+/--/s//\\*-/g
+/_a-squared cos 2(phi)/s//\\fIa\\fP\\u2\\d cos 2\\(*f/
+/__**\([a-zA-Z]*\)/s//\\fI\1\\fP/g
+/"\(.\)/s//\1\\*:/g
+/`\(.\)/s//\1\\*`/g
+/'\(.\)/s//\1\\*'/g
+/~\(.\)/s//\1\\*~/g
+/\^\(.\)/s//\1\\*^/g
+/,\(.\)/s//\1\\*,/g
+/\(.\)\(.\)/s//\\o_\1\2_/g
+/*/s//\\(bs/g
diff --git a/usr.bin/fortune/tools/do_sort b/usr.bin/fortune/tools/do_sort
new file mode 100644
index 0000000..07e301b
--- /dev/null
+++ b/usr.bin/fortune/tools/do_sort
@@ -0,0 +1,13 @@
+#! /bin/sh
+#
+# @(#)do_sort 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+#
+# an aggressive little script for sorting the fortune files
+# depends on octal 02 and 03 not being anywhere in the files.
+
+sp="/usr/bin/sort -dfu -T /var/tmp"
+
+sed 's/^%$//' | tr '\12' '\3' | tr '\2' '\12' |
+ sed -e 's/^//' -e '/^$/d' -e 's/$/%/' |
+ $sp | tr '\3' '\12'
diff --git a/usr.bin/fortune/tools/do_uniq.py b/usr.bin/fortune/tools/do_uniq.py
new file mode 100644
index 0000000..b434a10
--- /dev/null
+++ b/usr.bin/fortune/tools/do_uniq.py
@@ -0,0 +1,68 @@
+#!/usr/local/bin/python
+#
+# $FreeBSD$
+#
+# an aggressive little script for trimming duplicate cookies
+from __future__ import print_function
+import argparse
+import re
+
+wordlist = [
+ 'hadnot',
+ 'donot', 'hadnt',
+ 'dont', 'have', 'more', 'will', 'your',
+ 'and', 'are', 'had', 'the', 'you',
+ 'am', 'an', 'is', 'll', 've', 'we',
+ 'a', 'd', 'i', 'm', 's',
+]
+
+
+def hash(fortune):
+ f = fortune
+ f = f.lower()
+ f = re.sub('[\W_]', '', f)
+ for word in wordlist:
+ f = re.sub(word, '', f)
+# f = re.sub('[aeiouy]', '', f)
+# f = re.sub('[^aeiouy]', '', f)
+ f = f[:30]
+# f = f[-30:]
+ return f
+
+
+def edit(datfile):
+ dups = {}
+ fortunes = []
+ fortune = ""
+ with open(datfile, "r") as datfiledf:
+ for line in datfiledf:
+ if line == "%\n":
+ key = hash(fortune)
+ if key not in dups:
+ dups[key] = []
+ dups[key].append(fortune)
+ fortunes.append(fortune)
+ fortune = ""
+ else:
+ fortune += line
+ for key in list(dups.keys()):
+ if len(dups[key]) == 1:
+ del dups[key]
+ with open(datfile + "~", "w") as o:
+ for fortune in fortunes:
+ key = hash(fortune)
+ if key in dups:
+ print('\n' * 50)
+ for f in dups[key]:
+ if f != fortune:
+ print(f, '%')
+ print(fortune, '%')
+ if input("Remove last fortune? ") == 'y':
+ del dups[key]
+ continue
+ o.write(fortune + "%\n")
+
+parser = argparse.ArgumentParser(description="trimming duplicate cookies")
+parser.add_argument("filename", type=str, nargs=1)
+args = parser.parse_args()
+edit(args.filename[0])
diff --git a/usr.bin/fortune/unstr/Makefile b/usr.bin/fortune/unstr/Makefile
new file mode 100644
index 0000000..e943d97
--- /dev/null
+++ b/usr.bin/fortune/unstr/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= unstr
+MAN=
+CFLAGS+= -I${.CURDIR}/../strfile
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fortune/unstr/Makefile.depend b/usr.bin/fortune/unstr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/fortune/unstr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/fortune/unstr/unstr.c b/usr.bin/fortune/unstr/unstr.c
new file mode 100644
index 0000000..77ee1ec
--- /dev/null
+++ b/usr.bin/fortune/unstr/unstr.c
@@ -0,0 +1,137 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ken Arnold.
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * This program un-does what "strfile" makes, thereby obtaining the
+ * original file again. This can be invoked with the name of the output
+ * file, the input file, or both. If invoked with only a single argument
+ * ending in ".dat", it is pressumed to be the input file and the output
+ * file will be the same stripped of the ".dat". If the single argument
+ * doesn't end in ".dat", then it is presumed to be the output file, and
+ * the input file is that name prepended by a ".dat". If both are given
+ * they are treated literally as the input and output files.
+ *
+ * Ken Arnold Aug 13, 1978
+ */
+
+#include <sys/param.h>
+#include <sys/endian.h>
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "strfile.h"
+
+static char *Infile, /* name of input file */
+ Datafile[MAXPATHLEN], /* name of data file */
+ Delimch; /* delimiter character */
+
+static FILE *Inf, *Dataf;
+
+static void order_unstr(STRFILE *);
+
+/* ARGSUSED */
+int
+main(int argc, char *argv[])
+{
+ static STRFILE tbl; /* description table */
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: unstr datafile\n");
+ exit(1);
+ }
+ Infile = argv[1];
+ if ((size_t)snprintf(Datafile, sizeof(Datafile), "%s.dat", Infile) >=
+ sizeof(Datafile))
+ errx(1, "%s name too long", Infile);
+ if ((Inf = fopen(Infile, "r")) == NULL)
+ err(1, "%s", Infile);
+ if ((Dataf = fopen(Datafile, "r")) == NULL)
+ err(1, "%s", Datafile);
+ if (fread((char *)&tbl, sizeof(tbl), 1, Dataf) != 1) {
+ if (feof(Dataf))
+ errx(1, "%s read EOF", Datafile);
+ else
+ err(1, "%s read", Datafile);
+ }
+ tbl.str_version = be32toh(tbl.str_version);
+ tbl.str_numstr = be32toh(tbl.str_numstr);
+ tbl.str_longlen = be32toh(tbl.str_longlen);
+ tbl.str_shortlen = be32toh(tbl.str_shortlen);
+ tbl.str_flags = be32toh(tbl.str_flags);
+ if (!(tbl.str_flags & (STR_ORDERED | STR_RANDOM)))
+ errx(1, "nothing to do -- table in file order");
+ Delimch = tbl.str_delim;
+ order_unstr(&tbl);
+ fclose(Inf);
+ fclose(Dataf);
+ exit(0);
+}
+
+static void
+order_unstr(STRFILE *tbl)
+{
+ uint32_t i;
+ char *sp;
+ off_t pos;
+ char buf[BUFSIZ];
+
+ for (i = 0; i < tbl->str_numstr; i++) {
+ fread(&pos, 1, sizeof(pos), Dataf);
+ fseeko(Inf, be64toh(pos), SEEK_SET);
+ if (i != 0)
+ printf("%c\n", Delimch);
+ for (;;) {
+ sp = fgets(buf, sizeof(buf), Inf);
+ if (sp == NULL || STR_ENDSTRING(sp, *tbl))
+ break;
+ else
+ fputs(sp, stdout);
+ }
+ }
+}
diff --git a/usr.bin/from/Makefile b/usr.bin/from/Makefile
new file mode 100644
index 0000000..57b9663
--- /dev/null
+++ b/usr.bin/from/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= from
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/from/Makefile.depend b/usr.bin/from/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/from/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/from/from.1 b/usr.bin/from/from.1
new file mode 100644
index 0000000..9a5cd2e
--- /dev/null
+++ b/usr.bin/from/from.1
@@ -0,0 +1,96 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)from.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd December 30, 1993
+.Dt FROM 1
+.Os
+.Sh NAME
+.Nm from
+.Nd print names of those who have sent mail
+.Sh SYNOPSIS
+.Nm
+.Op Fl c
+.Op Fl f Ar file
+.Op Fl s Ar sender
+.Op Ar user
+.Sh DESCRIPTION
+The
+.Nm
+utility prints
+out the mail header lines from the invoker's mailbox.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c
+Just print a count of messages and exit.
+.It Fl f Ar file
+The supplied
+.Ar file
+is examined instead of the invoker's mailbox.
+If the
+.Fl f
+option is used, the
+.Ar user
+argument should not be used.
+Read from standard input if file name
+.Dq Fl
+is given.
+.It Fl s Ar sender
+Only mail from addresses containing
+the
+supplied string are printed.
+.El
+.Pp
+If
+.Ar user
+is given, the
+.Ar user Ns 's
+mailbox is examined instead of the invoker's own mailbox.
+(Privileges are required.)
+.Sh ENVIRONMENT
+.Bl -tag -width indent
+.It Ev MAIL
+If set, the location of the invoker's mailbox.
+Otherwise, the default in
+.Pa /var/mail
+is used.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /var/mail/*" -compact
+.It Pa /var/mail/*
+.El
+.Sh SEE ALSO
+.Xr biff 1 ,
+.Xr mail 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c
new file mode 100644
index 0000000..2262703
--- /dev/null
+++ b/usr.bin/from/from.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 1980, 1988, 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, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <ctype.h>
+#include <err.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <paths.h>
+#include <string.h>
+#include <unistd.h>
+
+static int match(const char *, const char *);
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ FILE *mbox;
+ struct passwd *pwd;
+ int ch, count, newline;
+ const char *file;
+ char *sender, *p;
+#if MAXPATHLEN > BUFSIZ
+ char buf[MAXPATHLEN];
+#else
+ char buf[BUFSIZ];
+#endif
+
+ file = sender = NULL;
+ count = -1;
+ while ((ch = getopt(argc, argv, "cf:s:")) != -1)
+ switch (ch) {
+ case 'c':
+ count = 0;
+ break;
+ case 'f':
+ file = optarg;
+ break;
+ case 's':
+ sender = optarg;
+ for (p = sender; *p; ++p)
+ *p = tolower(*p);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (file == NULL) {
+ if (argc) {
+ (void)snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, *argv);
+ file = buf;
+ } else {
+ if (!(file = getenv("MAIL"))) {
+ if (!(pwd = getpwuid(getuid())))
+ errx(1, "no password file entry for you");
+ file = pwd->pw_name;
+ (void)snprintf(buf, sizeof(buf),
+ "%s/%s", _PATH_MAILDIR, file);
+ file = buf;
+ }
+ }
+ }
+
+ /* read from stdin */
+ if (strcmp(file, "-") == 0) {
+ mbox = stdin;
+ }
+ else if ((mbox = fopen(file, "r")) == NULL) {
+ errx(1, "can't read %s", file);
+ }
+ for (newline = 1; fgets(buf, sizeof(buf), mbox);) {
+ if (*buf == '\n') {
+ newline = 1;
+ continue;
+ }
+ if (newline && !strncmp(buf, "From ", 5) &&
+ (!sender || match(buf + 5, sender))) {
+ if (count != -1)
+ count++;
+ else
+ printf("%s", buf);
+ }
+ newline = 0;
+ }
+ if (count != -1)
+ printf("There %s %d message%s in your incoming mailbox.\n",
+ count == 1 ? "is" : "are", count, count == 1 ? "" : "s");
+ fclose(mbox);
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: from [-c] [-f file] [-s sender] [user]\n");
+ exit(1);
+}
+
+static int
+match(const char *line, const char *sender)
+{
+ char ch, pch, first;
+ const char *p, *t;
+
+ for (first = *sender++;;) {
+ if (isspace(ch = *line))
+ return(0);
+ ++line;
+ ch = tolower(ch);
+ if (ch != first)
+ continue;
+ for (p = sender, t = line;;) {
+ if (!(pch = *p++))
+ return(1);
+ ch = tolower(*t);
+ t++;
+ if (ch != pch)
+ break;
+ }
+ }
+ /* NOTREACHED */
+}
diff --git a/usr.bin/fstat/Makefile b/usr.bin/fstat/Makefile
new file mode 100644
index 0000000..830b23c
--- /dev/null
+++ b/usr.bin/fstat/Makefile
@@ -0,0 +1,11 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= fstat
+SRCS= fstat.c fuser.c main.c
+LINKS= ${BINDIR}/fstat ${BINDIR}/fuser
+LIBADD= procstat
+
+MAN1= fuser.1 fstat.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fstat/Makefile.depend b/usr.bin/fstat/Makefile.depend
new file mode 100644
index 0000000..5cba1bd
--- /dev/null
+++ b/usr.bin/fstat/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+ lib/libprocstat \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/fstat/fstat.1 b/usr.bin/fstat/fstat.1
new file mode 100644
index 0000000..268b70f
--- /dev/null
+++ b/usr.bin/fstat/fstat.1
@@ -0,0 +1,235 @@
+.\" Copyright (c) 1987, 1991, 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.
+.\"
+.\" @(#)fstat.1 8.3 (Berkeley) 2/25/94
+.\" $FreeBSD$
+.\"
+.Dd September 28, 2011
+.Dt FSTAT 1
+.Os
+.Sh NAME
+.Nm fstat
+.Nd identify active files
+.Sh SYNOPSIS
+.Nm
+.Op Fl fmnv
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl p Ar pid
+.Op Fl u Ar user
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility identifies open files.
+A file is considered open by a process if it was explicitly opened,
+is the working directory, root directory, jail root directory,
+active executable text, or kernel trace file for that process.
+If no options are specified,
+.Nm
+reports on all open files in the system.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl f
+Restrict examination to files open in the same file systems as
+the named file arguments, or to the file system containing the
+current directory if there are no additional filename arguments.
+For example, to find all files open in the file system where the
+directory
+.Pa /usr/src
+resides, type
+.Dq Li fstat -f /usr/src .
+.It Fl M
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl N
+Extract the name list from the specified system instead of the default,
+which is the kernel image the system has booted from.
+.It Fl m
+Include memory-mapped files in the listing; normally these are excluded
+due to the extra processing required.
+.It Fl n
+Numerical format.
+Print the device number (maj,min) of the file system
+the file resides in rather than the mount point name; for special
+files, print the
+device number that the special device refers to rather than the filename
+in
+.Pa /dev ;
+and print the mode of the file in octal instead of symbolic form.
+.It Fl p
+Report all files open by the specified process.
+.It Fl u
+Report all files open by the specified user.
+.It Fl v
+Verbose mode.
+Print error messages upon failures to locate particular
+system data structures rather than silently ignoring them.
+Most of
+these data structures are dynamically created or deleted and it is
+possible for them to disappear while
+.Nm
+is running.
+This
+is normal and unavoidable since the rest of the system is running while
+.Nm
+itself is running.
+.It Ar
+Restrict reports to the specified files.
+.El
+.Pp
+The following fields are printed:
+.Bl -tag -width MOUNT
+.It Li USER
+The username of the owner of the process (effective uid).
+.It Li CMD
+The command name of the process.
+.It Li PID
+The process id.
+.It Li FD
+The file number in the per-process open file table or one of the following
+special names:
+.Pp
+.Bd -literal -offset indent -compact
+jail - jail root directory
+mmap - memory-mapped file
+root - root inode
+text - executable text inode
+tr - kernel trace file
+wd - current working directory
+.Ed
+.Pp
+If the file number is followed by an asterisk (``*''), the file is
+not an inode, but rather a socket,
+.Tn FIFO ,
+or there is an error.
+In this case the remainder of the line does not
+correspond to the remaining headers -- the format of the line
+is described later under
+.Sx SOCKETS .
+.It Li MOUNT
+If the
+.Fl n
+flag was not specified, this header is present and is the
+pathname that the file system the file resides in is mounted on.
+.It Li DEV
+If the
+.Fl n
+flag is specified, this header is present and is the
+number of the device that this file resides in.
+.It Li INUM
+The inode number of the file.
+.It Li MODE
+The mode of the file.
+If the
+.Fl n
+flag is not specified, the mode is printed
+using a symbolic format (see
+.Xr strmode 3 ) ;
+otherwise, the mode is printed
+as an octal number.
+.It Li SZ\&|DV
+If the file is a semaphore,
+prints the current value of the semaphore.
+If the file is not a character or block special, prints the size of
+the file in bytes.
+Otherwise, if the
+.Fl n
+flag is not specified, prints
+the name of the special file as located in
+.Pa /dev .
+If that cannot be
+located, or the
+.Fl n
+flag is specified, prints the major/minor device
+number that the special device refers to.
+.It Li R/W
+This column describes the access mode that the file allows.
+The letter ``r'' indicates open for reading;
+the letter ``w'' indicates open for writing.
+This field is useful when trying to find the processes that are
+preventing a file system from being down graded to read-only.
+.It Li NAME
+If filename arguments are specified and the
+.Fl f
+flag is not, then
+this field is present and is the name associated with the given file.
+Normally the name cannot be determined since there is no mapping
+from an open file back to the directory entry that was used to open
+that file.
+Also, since different directory entries may reference
+the same file (via
+.Xr ln 1 ) ,
+the name printed may not be the actual
+name that the process originally used to open that file.
+.El
+.Sh SOCKETS
+The formatting of open sockets depends on the protocol domain.
+In all cases the first field is the domain name, the second field
+is the socket type (stream, dgram, etc), and the third is the socket
+flags field (in hex).
+The remaining fields are protocol dependent.
+For tcp, it is the address of the tcpcb, and for udp, the inpcb (socket pcb).
+For unix domain sockets, its the address of the socket pcb and the address
+of the connected pcb (if connected).
+Otherwise the protocol number and address of the socket itself are printed.
+The attempt is to make enough information available to
+permit further analysis without duplicating
+.Xr netstat 1 .
+.Pp
+For example, the addresses mentioned above are the addresses which the
+.Dq Li netstat -A
+command would print for tcp, udp, and unixdomain.
+Note that since pipes are implemented using sockets, a pipe appears as a
+connected unix domain stream socket.
+A unidirectional unix domain socket indicates the direction of flow with
+an arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow
+(``<->'').
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr nfsstat 1 ,
+.Xr procstat 1 ,
+.Xr ps 1 ,
+.Xr sockstat 1 ,
+.Xr systat 1 ,
+.Xr tcp 4 ,
+.Xr unix 4 ,
+.Xr iostat 8 ,
+.Xr pstat 8 ,
+.Xr vmstat 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 tahoe .
+.Sh BUGS
+Since
+.Nm
+takes a snapshot of the system, it is only correct for a very short period
+of time.
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
new file mode 100644
index 0000000..1aeee67
--- /dev/null
+++ b/usr.bin/fstat/fstat.c
@@ -0,0 +1,567 @@
+/*-
+ * Copyright (c) 2009 Stanislav Sedov <stas@FreeBSD.org>
+ * Copyright (c) 1988, 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/user.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/queue.h>
+
+#include <netinet/in.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <err.h>
+#include <libprocstat.h>
+#include <limits.h>
+#include <pwd.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>
+
+#include "functions.h"
+
+static int fsflg, /* show files on same filesystem as file(s) argument */
+ pflg, /* show files open by a particular pid */
+ uflg; /* show files open by a particular (effective) user */
+static int checkfile; /* restrict to particular files or filesystems */
+static int nflg; /* (numerical) display f.s. and rdev as dev_t */
+static int mflg; /* include memory-mapped files */
+static int vflg; /* be verbose */
+
+typedef struct devs {
+ struct devs *next;
+ uint32_t fsid;
+ uint64_t ino;
+ const char *name;
+} DEVS;
+
+static DEVS *devs;
+static char *memf, *nlistf;
+
+static int getfname(const char *filename);
+static void dofiles(struct procstat *procstat, struct kinfo_proc *p);
+static void print_access_flags(int flags);
+static void print_file_info(struct procstat *procstat,
+ struct filestat *fst, const char *uname, const char *cmd, int pid);
+static void print_pipe_info(struct procstat *procstat,
+ struct filestat *fst);
+static void print_pts_info(struct procstat *procstat,
+ struct filestat *fst);
+static void print_sem_info(struct procstat *procstat,
+ struct filestat *fst);
+static void print_shm_info(struct procstat *procstat,
+ struct filestat *fst);
+static void print_socket_info(struct procstat *procstat,
+ struct filestat *fst);
+static void print_vnode_info(struct procstat *procstat,
+ struct filestat *fst);
+static void usage(void) __dead2;
+
+int
+do_fstat(int argc, char **argv)
+{
+ struct kinfo_proc *p;
+ struct passwd *passwd;
+ struct procstat *procstat;
+ int arg, ch, what;
+ int cnt, i;
+
+ arg = 0;
+ what = KERN_PROC_PROC;
+ nlistf = memf = NULL;
+ while ((ch = getopt(argc, argv, "fmnp:u:vN:M:")) != -1)
+ switch((char)ch) {
+ case 'f':
+ fsflg = 1;
+ break;
+ case 'M':
+ memf = optarg;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'm':
+ mflg = 1;
+ break;
+ case 'n':
+ nflg = 1;
+ break;
+ case 'p':
+ if (pflg++)
+ usage();
+ if (!isdigit(*optarg)) {
+ warnx("-p requires a process id");
+ usage();
+ }
+ what = KERN_PROC_PID;
+ arg = atoi(optarg);
+ break;
+ case 'u':
+ if (uflg++)
+ usage();
+ if (!(passwd = getpwnam(optarg)))
+ errx(1, "%s: unknown uid", optarg);
+ what = KERN_PROC_UID;
+ arg = passwd->pw_uid;
+ break;
+ case 'v':
+ vflg = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ if (*(argv += optind)) {
+ for (; *argv; ++argv) {
+ if (getfname(*argv))
+ checkfile = 1;
+ }
+ if (!checkfile) /* file(s) specified, but none accessible */
+ exit(1);
+ }
+
+ if (fsflg && !checkfile) {
+ /* -f with no files means use wd */
+ if (getfname(".") == 0)
+ exit(1);
+ checkfile = 1;
+ }
+
+ if (memf != NULL)
+ procstat = procstat_open_kvm(nlistf, memf);
+ else
+ procstat = procstat_open_sysctl();
+ if (procstat == NULL)
+ errx(1, "procstat_open()");
+ p = procstat_getprocs(procstat, what, arg, &cnt);
+ if (p == NULL)
+ errx(1, "procstat_getprocs()");
+
+ /*
+ * Print header.
+ */
+ if (nflg)
+ printf("%s",
+"USER CMD PID FD DEV INUM MODE SZ|DV R/W");
+ else
+ printf("%s",
+"USER CMD PID FD MOUNT INUM MODE SZ|DV R/W");
+ if (checkfile && fsflg == 0)
+ printf(" NAME\n");
+ else
+ putchar('\n');
+
+ /*
+ * Go through the process list.
+ */
+ for (i = 0; i < cnt; i++) {
+ if (p[i].ki_stat == SZOMB)
+ continue;
+ dofiles(procstat, &p[i]);
+ }
+ procstat_freeprocs(procstat, p);
+ procstat_close(procstat);
+ return (0);
+}
+
+static void
+dofiles(struct procstat *procstat, struct kinfo_proc *kp)
+{
+ const char *cmd;
+ const char *uname;
+ struct filestat *fst;
+ struct filestat_list *head;
+ int pid;
+
+ uname = user_from_uid(kp->ki_uid, 0);
+ pid = kp->ki_pid;
+ cmd = kp->ki_comm;
+
+ head = procstat_getfiles(procstat, kp, mflg);
+ if (head == NULL)
+ return;
+ STAILQ_FOREACH(fst, head, next)
+ print_file_info(procstat, fst, uname, cmd, pid);
+ procstat_freefiles(procstat, head);
+}
+
+
+static void
+print_file_info(struct procstat *procstat, struct filestat *fst,
+ const char *uname, const char *cmd, int pid)
+{
+ struct vnstat vn;
+ DEVS *d;
+ const char *filename;
+ int error, fsmatch = 0;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ filename = NULL;
+ if (checkfile != 0) {
+ if (fst->fs_type != PS_FST_TYPE_VNODE &&
+ fst->fs_type != PS_FST_TYPE_FIFO)
+ return;
+ error = procstat_get_vnode_info(procstat, fst, &vn, errbuf);
+ if (error != 0)
+ return;
+
+ for (d = devs; d != NULL; d = d->next)
+ if (d->fsid == vn.vn_fsid) {
+ fsmatch = 1;
+ if (d->ino == vn.vn_fileid) {
+ filename = d->name;
+ break;
+ }
+ }
+ if (fsmatch == 0 || (filename == NULL && fsflg == 0))
+ return;
+ }
+
+ /*
+ * Print entry prefix.
+ */
+ printf("%-8.8s %-10s %5d", uname, cmd, pid);
+ if (fst->fs_uflags & PS_FST_UFLAG_TEXT)
+ printf(" text");
+ else if (fst->fs_uflags & PS_FST_UFLAG_CDIR)
+ printf(" wd");
+ else if (fst->fs_uflags & PS_FST_UFLAG_RDIR)
+ printf(" root");
+ else if (fst->fs_uflags & PS_FST_UFLAG_TRACE)
+ printf(" tr");
+ else if (fst->fs_uflags & PS_FST_UFLAG_MMAP)
+ printf(" mmap");
+ else if (fst->fs_uflags & PS_FST_UFLAG_JAIL)
+ printf(" jail");
+ else if (fst->fs_uflags & PS_FST_UFLAG_CTTY)
+ printf(" ctty");
+ else
+ printf(" %4d", fst->fs_fd);
+
+ /*
+ * Print type-specific data.
+ */
+ switch (fst->fs_type) {
+ case PS_FST_TYPE_FIFO:
+ case PS_FST_TYPE_VNODE:
+ print_vnode_info(procstat, fst);
+ break;
+ case PS_FST_TYPE_SOCKET:
+ print_socket_info(procstat, fst);
+ break;
+ case PS_FST_TYPE_PIPE:
+ print_pipe_info(procstat, fst);
+ break;
+ case PS_FST_TYPE_PTS:
+ print_pts_info(procstat, fst);
+ break;
+ case PS_FST_TYPE_SHM:
+ print_shm_info(procstat, fst);
+ break;
+ case PS_FST_TYPE_SEM:
+ print_sem_info(procstat, fst);
+ break;
+ default:
+ if (vflg)
+ fprintf(stderr,
+ "unknown file type %d for file %d of pid %d\n",
+ fst->fs_type, fst->fs_fd, pid);
+ }
+ if (filename && !fsflg)
+ printf(" %s", filename);
+ putchar('\n');
+}
+
+static void
+print_socket_info(struct procstat *procstat, struct filestat *fst)
+{
+ static const char *stypename[] = {
+ "unused", /* 0 */
+ "stream", /* 1 */
+ "dgram", /* 2 */
+ "raw", /* 3 */
+ "rdm", /* 4 */
+ "seqpak" /* 5 */
+ };
+#define STYPEMAX 5
+ struct sockstat sock;
+ struct protoent *pe;
+ char errbuf[_POSIX2_LINE_MAX];
+ int error;
+ static int isopen;
+
+ error = procstat_get_socket_info(procstat, fst, &sock, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ if (sock.type > STYPEMAX)
+ printf("* %s ?%d", sock.dname, sock.type);
+ else
+ printf("* %s %s", sock.dname, stypename[sock.type]);
+
+ /*
+ * protocol specific formatting
+ *
+ * Try to find interesting things to print. For tcp, the interesting
+ * thing is the address of the tcpcb, for udp and others, just the
+ * inpcb (socket pcb). For unix domain, its the address of the socket
+ * pcb and the address of the connected pcb (if connected). Otherwise
+ * just print the protocol number and address of the socket itself.
+ * The idea is not to duplicate netstat, but to make available enough
+ * information for further analysis.
+ */
+ switch (sock.dom_family) {
+ case AF_INET:
+ case AF_INET6:
+ if (!isopen)
+ setprotoent(++isopen);
+ if ((pe = getprotobynumber(sock.proto)) != NULL)
+ printf(" %s", pe->p_name);
+ else
+ printf(" %d", sock.proto);
+ if (sock.proto == IPPROTO_TCP ) {
+ if (sock.inp_ppcb != 0)
+ printf(" %lx", (u_long)sock.inp_ppcb);
+ }
+ else if (sock.so_pcb != 0)
+ printf(" %lx", (u_long)sock.so_pcb);
+ break;
+ case AF_UNIX:
+ /* print address of pcb and connected pcb */
+ if (sock.so_pcb != 0) {
+ printf(" %lx", (u_long)sock.so_pcb);
+ if (sock.unp_conn) {
+ char shoconn[4], *cp;
+
+ cp = shoconn;
+ if (!(sock.so_rcv_sb_state & SBS_CANTRCVMORE))
+ *cp++ = '<';
+ *cp++ = '-';
+ if (!(sock.so_snd_sb_state & SBS_CANTSENDMORE))
+ *cp++ = '>';
+ *cp = '\0';
+ printf(" %s %lx", shoconn,
+ (u_long)sock.unp_conn);
+ }
+ }
+ break;
+ default:
+ /* print protocol number and socket address */
+ printf(" %d %lx", sock.proto, (u_long)sock.so_addr);
+ }
+}
+
+static void
+print_pipe_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct pipestat ps;
+ char errbuf[_POSIX2_LINE_MAX];
+ int error;
+
+ error = procstat_get_pipe_info(procstat, fst, &ps, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ printf("* pipe %8lx <-> %8lx", (u_long)ps.addr, (u_long)ps.peer);
+ printf(" %6zd", ps.buffer_cnt);
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
+print_pts_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct ptsstat pts;
+ char errbuf[_POSIX2_LINE_MAX];
+ int error;
+
+ error = procstat_get_pts_info(procstat, fst, &pts, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ printf("* pseudo-terminal master ");
+ if (nflg || !*pts.devname) {
+ printf("%#10jx", (uintmax_t)pts.dev);
+ } else {
+ printf("%10s", pts.devname);
+ }
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
+print_sem_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct semstat sem;
+ char errbuf[_POSIX2_LINE_MAX];
+ char mode[15];
+ int error;
+
+ error = procstat_get_sem_info(procstat, fst, &sem, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ if (nflg) {
+ printf(" ");
+ (void)snprintf(mode, sizeof(mode), "%o", sem.mode);
+ } else {
+ printf(" %-15s", fst->fs_path != NULL ? fst->fs_path : "-");
+ strmode(sem.mode, mode);
+ }
+ printf(" %10s %6u", mode, sem.value);
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
+print_shm_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct shmstat shm;
+ char errbuf[_POSIX2_LINE_MAX];
+ char mode[15];
+ int error;
+
+ error = procstat_get_shm_info(procstat, fst, &shm, errbuf);
+ if (error != 0) {
+ printf("* error");
+ return;
+ }
+ if (nflg) {
+ printf(" ");
+ (void)snprintf(mode, sizeof(mode), "%o", shm.mode);
+ } else {
+ printf(" %-15s", fst->fs_path != NULL ? fst->fs_path : "-");
+ strmode(shm.mode, mode);
+ }
+ printf(" %10s %6ju", mode, shm.size);
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
+print_vnode_info(struct procstat *procstat, struct filestat *fst)
+{
+ struct vnstat vn;
+ char errbuf[_POSIX2_LINE_MAX];
+ char mode[15];
+ const char *badtype;
+ int error;
+
+ badtype = NULL;
+ error = procstat_get_vnode_info(procstat, fst, &vn, errbuf);
+ if (error != 0)
+ badtype = errbuf;
+ else if (vn.vn_type == PS_FST_VTYPE_VBAD)
+ badtype = "bad";
+ else if (vn.vn_type == PS_FST_VTYPE_VNON)
+ badtype = "none";
+ if (badtype != NULL) {
+ printf(" - - %10s -", badtype);
+ return;
+ }
+
+ if (nflg)
+ printf(" %#5jx", (uintmax_t)vn.vn_fsid);
+ else if (vn.vn_mntdir != NULL)
+ (void)printf(" %-8s", vn.vn_mntdir);
+
+ /*
+ * Print access mode.
+ */
+ if (nflg)
+ (void)snprintf(mode, sizeof(mode), "%o", vn.vn_mode);
+ else {
+ strmode(vn.vn_mode, mode);
+ }
+ (void)printf(" %6jd %10s", (intmax_t)vn.vn_fileid, mode);
+
+ if (vn.vn_type == PS_FST_VTYPE_VBLK || vn.vn_type == PS_FST_VTYPE_VCHR) {
+ if (nflg || !*vn.vn_devname)
+ printf(" %#6jx", (uintmax_t)vn.vn_dev);
+ else {
+ printf(" %6s", vn.vn_devname);
+ }
+ } else
+ printf(" %6ju", (uintmax_t)vn.vn_size);
+ print_access_flags(fst->fs_fflags);
+}
+
+static void
+print_access_flags(int flags)
+{
+ char rw[3];
+
+ rw[0] = '\0';
+ if (flags & PS_FST_FFLAG_READ)
+ strcat(rw, "r");
+ if (flags & PS_FST_FFLAG_WRITE)
+ strcat(rw, "w");
+ printf(" %2s", rw);
+}
+
+int
+getfname(const char *filename)
+{
+ struct stat statbuf;
+ DEVS *cur;
+
+ if (stat(filename, &statbuf)) {
+ warn("%s", filename);
+ return (0);
+ }
+ if ((cur = malloc(sizeof(DEVS))) == NULL)
+ err(1, NULL);
+ cur->next = devs;
+ devs = cur;
+
+ cur->ino = statbuf.st_ino;
+ cur->fsid = statbuf.st_dev;
+ cur->name = filename;
+ return (1);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: fstat [-fmnv] [-M core] [-N system] [-p pid] [-u user] [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/fstat/functions.h b/usr.bin/fstat/functions.h
new file mode 100644
index 0000000..a23d27e
--- /dev/null
+++ b/usr.bin/fstat/functions.h
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2009 Stanislav Sedov <stas@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 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.
+ *
+ * $FreeBSD$
+ */
+#ifndef __FUNCTIONS_H__
+#define __FUNCTIONS_H__
+
+int do_fstat(int argc, char *argv[]);
+int do_fuser(int argc, char *argv[]);
+
+#endif /* !__FUNCTIONS_H__ */
diff --git a/usr.bin/fstat/fuser.1 b/usr.bin/fstat/fuser.1
new file mode 100644
index 0000000..7bae409
--- /dev/null
+++ b/usr.bin/fstat/fuser.1
@@ -0,0 +1,153 @@
+.\" Copyright (c) 2005-2011 Stanislav Sedov <stas@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 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2011
+.Dt FUSER 1
+.Os
+.Sh NAME
+.Nm fuser
+.Nd list IDs of all processes that have one or more files open
+.Sh SYNOPSIS
+.Nm
+.Op Fl cfkmu
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl s Ar signal
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility writes to stdout the PIDs of processes that have one or
+more named files open.
+For block and character special devices, all processes using files
+on that device are listed.
+A file is considered open by a process if it was explicitly opened,
+is the working directory, root directory, jail root directory,
+active executable text, kernel trace file or the controlling terminal
+of the process.
+If
+.Fl m
+option is specified, the
+.Nm
+utility will also look through mmapped files.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c
+Treat files as mount point and report on any files open in the file system.
+.It Fl f
+The report must be only for named files.
+.It Fl k
+Send signal to reported processes
+.Pq SIGKILL by default .
+.It Fl m
+Search through mmapped files too.
+.It Fl u
+Write the user name associated with each process to stderr.
+.It Fl M
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl N
+Extract the name list from the specified system instead of the default,
+which is the kernel image the system has booted from.
+.It Fl s
+Use given signal name instead of default SIGKILL.
+.El
+.Pp
+The following symbols, written to stderr will indicate how files is used:
+.Bl -tag -width MOUNT
+.It Cm r
+The file is the root directory of the process.
+.It Cm c
+The file is the current workdir directory of the process.
+.It Cm j
+The file is the jail-root of the process.
+.It Cm t
+The file is the kernel tracing file for the process.
+.It Cm x
+The file is executable text of the process.
+.It Cm y
+The process use this file as its controlling tty.
+.It Cm m
+The file is mmapped.
+.It Cm w
+The file is open for writing.
+.It Cm a
+The file is open as append only
+.Pq O_APPEND was specified .
+.It Cm d
+The process bypasses fs cache while writing to this file
+.Pq O_DIRECT was specified .
+.It Cm s
+Shared lock is hold.
+.It Cm e
+Exclusive lock is hold.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility returns 0 on successful completion and >0 otherwise.
+.Sh EXAMPLES
+The command:
+.Dq Li "fuser -fu ."
+writes to standard output the process IDs of processes that are using the
+current directory and writes to stderr an indication of how those processes are
+using the directory and user names associated with the processes that are using
+this directory.
+.Sh SEE ALSO
+.Xr fstat 1 ,
+.Xr ps 1 ,
+.Xr systat 1 ,
+.Xr iostat 8 ,
+.Xr pstat 8 ,
+.Xr vmstat 8
+.Sh STANDARDS
+The
+.Nm
+utility is expected to conform to
+.St -p1003.1-2004 .
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+The
+.Nm
+utility and this manual page was written by
+.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
+.Sh BUGS
+Since
+.Nm
+takes a snapshot of the system, it is only correct for a very short period
+of time.
+When working via
+.Xr kvm 3
+interface the report will be limited to filesystems the
+.Nm
+utility knows about (currently only cd9660, devfs, nfs, ntfs, nwfs, udf,
+ufs and zfs).
diff --git a/usr.bin/fstat/fuser.c b/usr.bin/fstat/fuser.c
new file mode 100644
index 0000000..dbb0d86
--- /dev/null
+++ b/usr.bin/fstat/fuser.c
@@ -0,0 +1,368 @@
+/*-
+ * Copyright (c) 2005-2009 Stanislav Sedov <stas@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/queue.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <libprocstat.h>
+#include <limits.h>
+#include <paths.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "functions.h"
+
+/*
+ * File access mode flags table.
+ */
+static const struct {
+ int flag;
+ char ch;
+} fflags[] = {
+ {PS_FST_FFLAG_WRITE, 'w'},
+ {PS_FST_FFLAG_APPEND, 'a'},
+ {PS_FST_FFLAG_DIRECT, 'd'},
+ {PS_FST_FFLAG_SHLOCK, 's'},
+ {PS_FST_FFLAG_EXLOCK, 'e'}
+};
+#define NFFLAGS (sizeof(fflags) / sizeof(*fflags))
+
+/*
+ * Usage flags translation table.
+ */
+static const struct {
+ int flag;
+ char ch;
+} uflags[] = {
+ {PS_FST_UFLAG_RDIR, 'r'},
+ {PS_FST_UFLAG_CDIR, 'c'},
+ {PS_FST_UFLAG_JAIL, 'j'},
+ {PS_FST_UFLAG_TRACE, 't'},
+ {PS_FST_UFLAG_TEXT, 'x'},
+ {PS_FST_UFLAG_MMAP, 'm'},
+ {PS_FST_UFLAG_CTTY, 'y'}
+};
+#define NUFLAGS (sizeof(uflags) / sizeof(*uflags))
+
+struct consumer {
+ pid_t pid;
+ uid_t uid;
+ int fd;
+ int flags;
+ int uflags;
+ STAILQ_ENTRY(consumer) next;
+};
+struct reqfile {
+ uint32_t fsid;
+ uint64_t fileid;
+ const char *name;
+ STAILQ_HEAD(, consumer) consumers;
+};
+
+/*
+ * Option flags.
+ */
+#define UFLAG 0x01 /* -u flag: show users */
+#define FFLAG 0x02 /* -f flag: specified files only */
+#define CFLAG 0x04 /* -c flag: treat as mpoints */
+#define MFLAG 0x10 /* -m flag: mmapped files too */
+#define KFLAG 0x20 /* -k flag: send signal (SIGKILL by default) */
+
+static int flags = 0; /* Option flags. */
+
+static void printflags(struct consumer *consumer);
+static int str2sig(const char *str);
+static void usage(void) __dead2;
+static int addfile(const char *path, struct reqfile *reqfile);
+static void dofiles(struct procstat *procstat, struct kinfo_proc *kp,
+ struct reqfile *reqfiles, size_t nfiles);
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+"usage: fuser [-cfhkmu] [-M core] [-N system] [-s signal] file ...\n");
+ exit(EX_USAGE);
+}
+
+static void
+printflags(struct consumer *cons)
+{
+ unsigned int i;
+
+ assert(cons);
+ for (i = 0; i < NUFLAGS; i++)
+ if ((cons->uflags & uflags[i].flag) != 0)
+ fputc(uflags[i].ch, stderr);
+ for (i = 0; i < NFFLAGS; i++)
+ if ((cons->flags & fflags[i].flag) != 0)
+ fputc(fflags[i].ch, stderr);
+}
+
+/*
+ * Add file to the list.
+ */
+static int
+addfile(const char *path, struct reqfile *reqfile)
+{
+ struct stat sb;
+
+ assert(path);
+ if (stat(path, &sb) != 0) {
+ warn("%s", path);
+ return (1);
+ }
+ reqfile->fileid = sb.st_ino;
+ reqfile->fsid = sb.st_dev;
+ reqfile->name = path;
+ STAILQ_INIT(&reqfile->consumers);
+ return (0);
+}
+
+int
+do_fuser(int argc, char *argv[])
+{
+ struct consumer *consumer;
+ struct kinfo_proc *p, *procs;
+ struct procstat *procstat;
+ struct reqfile *reqfiles;
+ char *ep, *nlistf, *memf;
+ int ch, cnt, sig;
+ unsigned int i, nfiles;
+
+ sig = SIGKILL; /* Default to kill. */
+ nlistf = NULL;
+ memf = NULL;
+ while ((ch = getopt(argc, argv, "M:N:cfhkms:u")) != -1)
+ switch(ch) {
+ case 'f':
+ if ((flags & CFLAG) != 0)
+ usage();
+ flags |= FFLAG;
+ break;
+ case 'c':
+ if ((flags & FFLAG) != 0)
+ usage();
+ flags |= CFLAG;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'M':
+ memf = optarg;
+ break;
+ case 'u':
+ flags |= UFLAG;
+ break;
+ case 'm':
+ flags |= MFLAG;
+ break;
+ case 'k':
+ flags |= KFLAG;
+ break;
+ case 's':
+ if (isdigit(*optarg)) {
+ sig = strtol(optarg, &ep, 10);
+ if (*ep != '\0' || sig < 0 || sig >= sys_nsig)
+ errx(EX_USAGE, "illegal signal number" ": %s",
+ optarg);
+ } else {
+ sig = str2sig(optarg);
+ if (sig < 0)
+ errx(EX_USAGE, "illegal signal name: "
+ "%s", optarg);
+ }
+ break;
+ case 'h':
+ /* PASSTHROUGH */
+ default:
+ usage();
+ /* NORETURN */
+ }
+ argv += optind;
+ argc -= optind;
+
+ assert(argc >= 0);
+ if (argc == 0)
+ usage();
+ /* NORETURN */
+
+ /*
+ * Process named files.
+ */
+ reqfiles = malloc(argc * sizeof(struct reqfile));
+ if (reqfiles == NULL)
+ err(EX_OSERR, "malloc()");
+ nfiles = 0;
+ while (argc--)
+ if (!addfile(*(argv++), &reqfiles[nfiles]))
+ nfiles++;
+ if (nfiles == 0)
+ errx(EX_IOERR, "files not accessible");
+
+ if (memf != NULL)
+ procstat = procstat_open_kvm(nlistf, memf);
+ else
+ procstat = procstat_open_sysctl();
+ if (procstat == NULL)
+ errx(1, "procstat_open()");
+ procs = procstat_getprocs(procstat, KERN_PROC_PROC, 0, &cnt);
+ if (procs == NULL)
+ errx(1, "procstat_getprocs()");
+
+ /*
+ * Walk through process table and look for matching files.
+ */
+ p = procs;
+ while(cnt--)
+ if (p->ki_stat != SZOMB)
+ dofiles(procstat, p++, reqfiles, nfiles);
+
+ for (i = 0; i < nfiles; i++) {
+ fprintf(stderr, "%s:", reqfiles[i].name);
+ fflush(stderr);
+ STAILQ_FOREACH(consumer, &reqfiles[i].consumers, next) {
+ if (consumer->flags != 0) {
+ fprintf(stdout, "%6d", consumer->pid);
+ fflush(stdout);
+ printflags(consumer);
+ if ((flags & UFLAG) != 0)
+ fprintf(stderr, "(%s)",
+ user_from_uid(consumer->uid, 0));
+ if ((flags & KFLAG) != 0)
+ kill(consumer->pid, sig);
+ fflush(stderr);
+ }
+ }
+ (void)fprintf(stderr, "\n");
+ }
+ procstat_freeprocs(procstat, procs);
+ procstat_close(procstat);
+ free(reqfiles);
+ return (0);
+}
+
+static void
+dofiles(struct procstat *procstat, struct kinfo_proc *kp,
+ struct reqfile *reqfiles, size_t nfiles)
+{
+ struct vnstat vn;
+ struct consumer *cons;
+ struct filestat *fst;
+ struct filestat_list *head;
+ int error, match;
+ unsigned int i;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ head = procstat_getfiles(procstat, kp, flags & MFLAG);
+ if (head == NULL)
+ return;
+ STAILQ_FOREACH(fst, head, next) {
+ if (fst->fs_type != PS_FST_TYPE_VNODE)
+ continue;
+ error = procstat_get_vnode_info(procstat, fst, &vn, errbuf);
+ if (error != 0)
+ continue;
+ for (i = 0; i < nfiles; i++) {
+ if (flags & CFLAG && reqfiles[i].fsid == vn.vn_fsid) {
+ break;
+ }
+ else if (reqfiles[i].fsid == vn.vn_fsid &&
+ reqfiles[i].fileid == vn.vn_fileid) {
+ break;
+ }
+ else if (!(flags & FFLAG) &&
+ (vn.vn_type == PS_FST_VTYPE_VCHR ||
+ vn.vn_type == PS_FST_VTYPE_VBLK) &&
+ vn.vn_fsid == reqfiles[i].fileid) {
+ break;
+ }
+ }
+ if (i == nfiles)
+ continue; /* No match. */
+
+ /*
+ * Look for existing entries.
+ */
+ match = 0;
+ STAILQ_FOREACH(cons, &reqfiles[i].consumers, next)
+ if (cons->pid == kp->ki_pid) {
+ match = 1;
+ break;
+ }
+ if (match == 1) { /* Use old entry. */
+ cons->flags |= fst->fs_fflags;
+ cons->uflags |= fst->fs_uflags;
+ } else {
+ /*
+ * Create new entry in the consumer chain.
+ */
+ cons = calloc(1, sizeof(struct consumer));
+ if (cons == NULL) {
+ warn("malloc()");
+ continue;
+ }
+ cons->uid = kp->ki_uid;
+ cons->pid = kp->ki_pid;
+ cons->uflags = fst->fs_uflags;
+ cons->flags = fst->fs_fflags;
+ STAILQ_INSERT_TAIL(&reqfiles[i].consumers, cons, next);
+ }
+ }
+ procstat_freefiles(procstat, head);
+}
+
+/*
+ * Returns signal number for it's string representation.
+ */
+static int
+str2sig(const char *str)
+{
+ int i;
+
+ if (!strncasecmp(str, "SIG", 3))
+ str += 3;
+ for (i = 1; i < sys_nsig; i++) {
+ if (!strcasecmp(sys_signame[i], str))
+ return (i);
+ }
+ return (-1);
+}
diff --git a/usr.bin/fstat/main.c b/usr.bin/fstat/main.c
new file mode 100644
index 0000000..4123e64
--- /dev/null
+++ b/usr.bin/fstat/main.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2009 Stanislav Sedov <stas@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 ``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.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <libgen.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "functions.h"
+
+int
+main(int argc, char *argv[])
+{
+ char *p;
+
+ p = basename(argv[0]);
+ if (p == NULL)
+ err(1, "basename(%s)", argv[0]);
+ if (!strcmp(p, "fuser"))
+ return (do_fuser(argc, argv));
+ else
+ return (do_fstat(argc, argv));
+}
diff --git a/usr.bin/fsync/Makefile b/usr.bin/fsync/Makefile
new file mode 100644
index 0000000..c9bc524
--- /dev/null
+++ b/usr.bin/fsync/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= fsync
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/fsync/Makefile.depend b/usr.bin/fsync/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/fsync/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/fsync/fsync.1 b/usr.bin/fsync/fsync.1
new file mode 100644
index 0000000..0cc41d3
--- /dev/null
+++ b/usr.bin/fsync/fsync.1
@@ -0,0 +1,63 @@
+.\" Copyright (c) 2000 Paul Saab <ps@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 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 25, 2005
+.Dt FSYNC 1
+.Os
+.Sh NAME
+.Nm fsync
+.Nd synchronize a file's in-core state with that on disk
+.Sh SYNOPSIS
+.Nm
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility causes all the modified data and meta-data of
+all the files named on the command line
+to be written to a permanent storage device.
+.Pp
+The
+.Nm
+utility uses the
+.Xr fsync 2
+function call.
+.Sh EXIT STATUS
+If an error occurs, the
+.Nm
+utility proceeds to the next file, and exits >0.
+Otherwise, it exits 0.
+.Sh SEE ALSO
+.Xr fsync 2 ,
+.Xr sync 2 ,
+.Xr syncer 4 ,
+.Xr halt 8 ,
+.Xr reboot 8
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 4.3 .
diff --git a/usr.bin/fsync/fsync.c b/usr.bin/fsync/fsync.c
new file mode 100644
index 0000000..78aeb21
--- /dev/null
+++ b/usr.bin/fsync/fsync.c
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2000 Paul Saab <ps@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 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
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int fd;
+ int i;
+ int rval;
+
+ if (argc < 2) {
+ usage();
+ /* NOTREACHED */
+ }
+
+ rval = EX_OK;
+ for (i = 1; i < argc; ++i) {
+ if ((fd = open(argv[i], O_RDONLY)) == -1) {
+ warn("open %s", argv[i]);
+ if (rval == EX_OK)
+ rval = EX_NOINPUT;
+ continue;
+ }
+
+ if (fsync(fd) == -1) {
+ warn("fsync %s", argv[i]);
+ if (rval == EX_OK)
+ rval = EX_OSERR;
+ }
+ close(fd);
+ }
+ exit(rval);
+ /* NOTREACHED */
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: fsync file ...\n");
+ exit(EX_USAGE);
+ /* NOTREACHED */
+}
diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile
new file mode 100644
index 0000000..18068a6
--- /dev/null
+++ b/usr.bin/ftp/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# $NetBSD: Makefile,v 1.15 1997/10/18 15:31:20 lukem Exp $
+# from: @(#)Makefile 8.2 (Berkeley) 4/3/94
+
+.include <src.opts.mk>
+
+# Uncomment the following to provide defaults for gate-ftp operation
+#
+#CFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21
+
+TNFTP= ${.CURDIR}/../../contrib/tnftp
+.PATH: ${TNFTP}/src
+
+PROG= ftp
+SRCS= cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c \
+ progressbar.c ruserpass.c util.c
+
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
+
+CFLAGS+= -I${.CURDIR} -I${TNFTP}
+LIBADD= edit
+
+WARNS?= 2
+
+LINKS= ${BINDIR}/ftp ${BINDIR}/pftp \
+ ${BINDIR}/ftp ${BINDIR}/gate-ftp
+MLINKS= ftp.1 pftp.1 \
+ ftp.1 gate-ftp.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ftp/Makefile.depend b/usr.bin/ftp/Makefile.depend
new file mode 100644
index 0000000..d6c8db8
--- /dev/null
+++ b/usr.bin/ftp/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ftp/tnftp_config.h b/usr.bin/ftp/tnftp_config.h
new file mode 100644
index 0000000..75bfb75
--- /dev/null
+++ b/usr.bin/ftp/tnftp_config.h
@@ -0,0 +1,514 @@
+/* $FreeBSD$ */
+/* tnftp_config.h. Generated from tnftp_config.h.in by configure. */
+/* tnftp_config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+/* #undef CLOSEDIR_VOID */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if the `getpgrp' function requires zero arguments. */
+#define GETPGRP_VOID 1
+
+/* Define to 1 if `TIOCGWINSZ' requires <sys/ioctl.h>. */
+/* #undef GWINSZ_IN_SYS_IOCTL */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the <arpa/ftp.h> header file. */
+#define HAVE_ARPA_FTP_H 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <arpa/nameser.h> header file. */
+#define HAVE_ARPA_NAMESER_H 1
+
+/* Define to 1 if you have the declaration of `AF_INET6', and to 0 if you
+ don't. */
+#define HAVE_DECL_AF_INET6 1
+
+/* Define to 1 if you have the declaration of `AI_NUMERICHOST', and to 0 if
+ you don't. */
+#define HAVE_DECL_AI_NUMERICHOST 1
+
+/* Define to 1 if you have the declaration of `dirname', and to 0 if you
+ don't. */
+#define HAVE_DECL_DIRNAME 1
+
+/* Define to 1 if you have the declaration of `fclose', and to 0 if you don't.
+ */
+#define HAVE_DECL_FCLOSE 1
+
+/* Define to 1 if you have the declaration of `getpass', and to 0 if you
+ don't. */
+#define HAVE_DECL_GETPASS 1
+
+/* Define to 1 if you have the declaration of `h_errno', and to 0 if you
+ don't. */
+#define HAVE_DECL_H_ERRNO 1
+
+/* Define to 1 if you have the declaration of `NS_IN6ADDRSZ', and to 0 if you
+ don't. */
+#define HAVE_DECL_NS_IN6ADDRSZ 1
+
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+#define HAVE_DECL_OPTARG 1
+
+/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
+ */
+#define HAVE_DECL_OPTIND 1
+
+/* Define to 1 if you have the declaration of `pclose', and to 0 if you don't.
+ */
+#define HAVE_DECL_PCLOSE 1
+
+/* Define to 1 if you have the declaration of `strptime', and to 0 if you
+ don't. */
+#define HAVE_DECL_STRPTIME 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dirname' function. */
+#define HAVE_DIRNAME 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `err' function. */
+#define HAVE_ERR 1
+
+/* Define to 1 if you have the <err.h> header file. */
+#define HAVE_ERR_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fgetln' function. */
+#define HAVE_FGETLN 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `gethostbyaddr' function. */
+#define HAVE_GETHOSTBYADDR 1
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define to 1 if you have the `gethostbyname2' function. */
+#define HAVE_GETHOSTBYNAME2 1
+
+/* Define to 1 if you have the `gethostname' function. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `getpass' function. */
+#define HAVE_GETPASS 1
+
+/* Define to 1 if you have the `getpassphrase' function. */
+/* #undef HAVE_GETPASSPHRASE */
+
+/* Define to 1 if you have the `getpgrp' function. */
+#define HAVE_GETPGRP 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the `inet_pton' function. */
+#define HAVE_INET_PTON 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if the system has the type `in_port_t'. */
+#define HAVE_IN_PORT_T 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if the system has the type `long double'. */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define to 1 if the system has the type `long long int'. */
+#define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/in_systm.h> header file. */
+#define HAVE_NETINET_IN_SYSTM_H 1
+
+/* Define to 1 if you have the <netinet/ip.h> header file. */
+#define HAVE_NETINET_IP_H 1
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* Define if we have poll() and it is not emulated. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define if `long long' is supported and *printf() supports %lld or %qd to
+ print them. */
+#define HAVE_PRINTF_LONG_LONG 1
+
+/* Define if *printf() uses %qd to print `long long' (otherwise uses %lld). */
+/* #undef HAVE_PRINTF_QD */
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define to 1 if you have the `regcomp' function. */
+#define HAVE_REGCOMP 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+#define HAVE_REGEX_H 1
+
+/* Define to 1 if you have the <resolv.h> header file. */
+#define HAVE_RESOLV_H 1
+
+/* Define to 1 if the system has the type `sa_family_t'. */
+#define HAVE_SA_FAMILY_T 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the <setjmp.h> header file. */
+#define HAVE_SETJMP_H 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setprogname' function. */
+#define HAVE_SETPROGNAME 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the `sl_init' function. */
+#define HAVE_SL_INIT 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET 1
+
+/* Define to 1 if the system has the type `socklen_t'. */
+#define HAVE_SOCKLEN_T 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strcoll' function and it is properly defined.
+ */
+#define HAVE_STRCOLL 1
+
+/* Define to 1 if you have the `strcspn' function. */
+#define HAVE_STRCSPN 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strpbrk' function. */
+#define HAVE_STRPBRK 1
+
+/* Define to 1 if you have the `strptime' function. */
+#define HAVE_STRPTIME 1
+
+/* Define to 1 if you have the `strrchr' function. */
+#define HAVE_STRRCHR 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strstr' function. */
+#define HAVE_STRSTR 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define HAVE_STRTOLL 1
+
+/* Define to 1 if you have the `strtoul' function. */
+#define HAVE_STRTOUL 1
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if `struct dirent' is a member of `d_namlen'. */
+#define HAVE_STRUCT_DIRENT_D_NAMLEN 1
+
+/* Define to 1 if the system has the type `struct pollfd'. */
+#define HAVE_STRUCT_POLLFD 1
+
+/* Define to 1 if the system has the type `struct sockaddr_in6'. */
+#define HAVE_STRUCT_SOCKADDR_IN6 1
+
+/* Define to 1 if `struct sockaddr_in' is a member of `sin_len'. */
+#define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
+
+/* Define to 1 if `struct sockaddr' is a member of `sa_len'. */
+#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+
+/* Define to 1 if you have the `strunvis' function. */
+#define HAVE_STRUNVIS 1
+
+/* Define to 1 if you have the `strvis' function. */
+#define HAVE_STRVIS 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#define HAVE_SYS_POLL_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* 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/syslimits.h> header file. */
+#define HAVE_SYS_SYSLIMITS_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <termcap.h> header file. */
+#define HAVE_TERMCAP_H 1
+
+/* Define to 1 if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if you have the `timegm' function. */
+#define HAVE_TIMEGM 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `usleep' function. */
+#define HAVE_USLEEP 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimes' function. */
+#define HAVE_UTIMES 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the <vis.h> header file. */
+#define HAVE_VIS_H 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* Name of package */
+#define PACKAGE "tnftp"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "lukem@NetBSD.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "tnftp"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "tnftp 20100108"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "tnftp"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "20100108"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define if using (Dante) SOCKS5 proxy. */
+/* #undef USE_SOCKS */
+
+/* Version number of package */
+#define VERSION "20100108"
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
+
+
+/* Define if using IPv6 support. */
+/* Commented out so this can be selected fromt he Makefile -gavin */
+/* #define USE_INET6 1 */
+
+#define USE_GLOB_H 1
diff --git a/usr.bin/gcore/Makefile b/usr.bin/gcore/Makefile
new file mode 100644
index 0000000..ad4b540
--- /dev/null
+++ b/usr.bin/gcore/Makefile
@@ -0,0 +1,14 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= gcore
+SRCS= elfcore.c gcore.c
+LIBADD= sbuf util
+
+.if ${MACHINE_ARCH} == "amd64"
+SRCS+= elf32core.c
+.endif
+
+WARNS?= 1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/gcore/Makefile.depend b/usr.bin/gcore/Makefile.depend
new file mode 100644
index 0000000..8df34bc
--- /dev/null
+++ b/usr.bin/gcore/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/gcore/elf32core.c b/usr.bin/gcore/elf32core.c
new file mode 100644
index 0000000..d13a4ef
--- /dev/null
+++ b/usr.bin/gcore/elf32core.c
@@ -0,0 +1,48 @@
+/* $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>
+
+#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
new file mode 100644
index 0000000..c96e3ae
--- /dev/null
+++ b/usr.bin/gcore/elfcore.c
@@ -0,0 +1,810 @@
+/*-
+ * Copyright (c) 2007 Sandvine Incorporated
+ * Copyright (c) 1998 John D. Polstra
+ * 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/endian.h>
+#include <sys/param.h>
+#include <sys/procfs.h>
+#include <sys/ptrace.h>
+#include <sys/queue.h>
+#include <sys/linker_set.h>
+#include <sys/sbuf.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+#include <sys/wait.h>
+#include <machine/elf.h>
+#include <vm/vm_param.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libutil.h>
+
+#include "extern.h"
+
+/*
+ * Code for generating ELF core dumps.
+ */
+
+typedef void (*segment_callback)(vm_map_entry_t, void *);
+
+/* Closure for cb_put_phdr(). */
+struct phdr_closure {
+ Elf_Phdr *phdr; /* Program header to fill in */
+ Elf_Off offset; /* Offset of segment in core file */
+};
+
+/* Closure for cb_size_segment(). */
+struct sseg_closure {
+ int count; /* Count of writable segments. */
+ 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 *);
+static void cb_size_segment(vm_map_entry_t, void *);
+static void each_writable_segment(vm_map_entry_t, segment_callback,
+ void *closure);
+static void elf_detach(void); /* atexit() handler. */
+static void *elf_note_fpregset(void *, size_t *);
+static void *elf_note_prpsinfo(void *, size_t *);
+static void *elf_note_prstatus(void *, size_t *);
+static void *elf_note_thrmisc(void *, size_t *);
+#if defined(__i386__) || defined(__amd64__)
+static void *elf_note_x86_xstate(void *, size_t *);
+#endif
+#if defined(__powerpc__)
+static void *elf_note_powerpc_vmx(void *, size_t *);
+#endif
+static void *elf_note_procstat_auxv(void *, size_t *);
+static void *elf_note_procstat_files(void *, size_t *);
+static void *elf_note_procstat_groups(void *, size_t *);
+static void *elf_note_procstat_osrel(void *, size_t *);
+static void *elf_note_procstat_proc(void *, size_t *);
+static void *elf_note_procstat_psstrings(void *, size_t *);
+static void *elf_note_procstat_rlimit(void *, size_t *);
+static void *elf_note_procstat_umask(void *, size_t *);
+static void *elf_note_procstat_vmmap(void *, size_t *);
+static void elf_puthdr(pid_t, vm_map_entry_t, void *, size_t, size_t, size_t,
+ int);
+static void elf_putnote(int, notefunc_t, void *, struct sbuf *);
+static void elf_putnotes(pid_t, struct sbuf *, size_t *);
+static void freemap(vm_map_entry_t);
+static vm_map_entry_t readmap(pid_t);
+static void *procstat_sysctl(void *, int, size_t, size_t *sizep);
+
+static pid_t g_pid; /* Pid being dumped, global for elf_detach */
+
+static int
+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 (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
+elf_detach(void)
+{
+
+ if (g_pid != 0)
+ ptrace(PT_DETACH, g_pid, (caddr_t)1, 0);
+}
+
+/*
+ * Write an ELF coredump for the given pid to the given fd.
+ */
+static void
+elf_coredump(int efd __unused, int fd, pid_t pid)
+{
+ vm_map_entry_t map;
+ struct sseg_closure seginfo;
+ struct sbuf *sb;
+ void *hdr;
+ size_t hdrsize, notesz, segoff;
+ ssize_t n, old_len;
+ Elf_Phdr *php;
+ int i;
+
+ /* Attach to process to dump. */
+ g_pid = pid;
+ if (atexit(elf_detach) != 0)
+ err(1, "atexit");
+ errno = 0;
+ ptrace(PT_ATTACH, pid, NULL, 0);
+ if (errno)
+ err(1, "PT_ATTACH");
+ if (waitpid(pid, NULL, 0) == -1)
+ err(1, "waitpid");
+
+ /* Get the program's memory map. */
+ map = readmap(pid);
+
+ /* Size the program segments. */
+ seginfo.count = 0;
+ seginfo.size = 0;
+ each_writable_segment(map, cb_size_segment, &seginfo);
+
+ /*
+ * Build the header and the notes using sbuf and write to the file.
+ */
+ sb = sbuf_new_auto();
+ hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count);
+ /* Start header + notes section. */
+ sbuf_start_section(sb, NULL);
+ /* Make empty header subsection. */
+ sbuf_start_section(sb, &old_len);
+ sbuf_putc(sb, 0);
+ sbuf_end_section(sb, old_len, hdrsize, 0);
+ /* Put notes. */
+ elf_putnotes(pid, sb, &notesz);
+ /* Align up to a page boundary for the program segments. */
+ sbuf_end_section(sb, -1, PAGE_SIZE, 0);
+ if (sbuf_finish(sb) != 0)
+ err(1, "sbuf_finish");
+ hdr = sbuf_data(sb);
+ segoff = sbuf_len(sb);
+ /* Fill in the header. */
+ elf_puthdr(pid, map, hdr, hdrsize, notesz, segoff, seginfo.count);
+
+ n = write(fd, hdr, segoff);
+ if (n == -1)
+ err(1, "write");
+ if (n < segoff)
+ errx(1, "short write");
+
+ /* Write the contents of all of the writable segments. */
+ php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1;
+ for (i = 0; i < seginfo.count; i++) {
+ struct ptrace_io_desc iorequest;
+ uintmax_t nleft = php->p_filesz;
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (caddr_t)(uintptr_t)php->p_vaddr;
+ while (nleft > 0) {
+ char buf[8*1024];
+ size_t nwant;
+ ssize_t ngot;
+
+ if (nleft > sizeof(buf))
+ nwant = sizeof buf;
+ else
+ nwant = nleft;
+ iorequest.piod_addr = buf;
+ iorequest.piod_len = nwant;
+ ptrace(PT_IO, pid, (caddr_t)&iorequest, 0);
+ ngot = iorequest.piod_len;
+ if ((size_t)ngot < nwant)
+ errx(1, "short read wanted %zu, got %zd",
+ nwant, ngot);
+ ngot = write(fd, buf, nwant);
+ if (ngot == -1)
+ err(1, "write of segment %d failed", i);
+ if ((size_t)ngot != nwant)
+ errx(1, "short write");
+ nleft -= nwant;
+ iorequest.piod_offs += ngot;
+ }
+ php++;
+ }
+ sbuf_delete(sb);
+ freemap(map);
+}
+
+/*
+ * A callback for each_writable_segment() to write out the segment's
+ * program header entry.
+ */
+static void
+cb_put_phdr(vm_map_entry_t entry, void *closure)
+{
+ struct phdr_closure *phc = (struct phdr_closure *)closure;
+ Elf_Phdr *phdr = phc->phdr;
+
+ phc->offset = round_page(phc->offset);
+
+ phdr->p_type = PT_LOAD;
+ phdr->p_offset = phc->offset;
+ phdr->p_vaddr = entry->start;
+ phdr->p_paddr = 0;
+ phdr->p_filesz = phdr->p_memsz = entry->end - entry->start;
+ phdr->p_align = PAGE_SIZE;
+ phdr->p_flags = 0;
+ if (entry->protection & VM_PROT_READ)
+ phdr->p_flags |= PF_R;
+ if (entry->protection & VM_PROT_WRITE)
+ phdr->p_flags |= PF_W;
+ if (entry->protection & VM_PROT_EXECUTE)
+ phdr->p_flags |= PF_X;
+
+ phc->offset += phdr->p_filesz;
+ phc->phdr++;
+}
+
+/*
+ * A callback for each_writable_segment() to gather information about
+ * the number of segments and their total size.
+ */
+static void
+cb_size_segment(vm_map_entry_t entry, void *closure)
+{
+ struct sseg_closure *ssc = (struct sseg_closure *)closure;
+
+ ssc->count++;
+ ssc->size += entry->end - entry->start;
+}
+
+/*
+ * For each segment in the given memory map, call the given function
+ * with a pointer to the map entry and some arbitrary caller-supplied
+ * data.
+ */
+static void
+each_writable_segment(vm_map_entry_t map, segment_callback func, void *closure)
+{
+ vm_map_entry_t entry;
+
+ for (entry = map; entry != NULL; entry = entry->next)
+ (*func)(entry, closure);
+}
+
+static void
+elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep)
+{
+ lwpid_t *tids;
+ size_t threads, old_len;
+ ssize_t size;
+ int i;
+
+ errno = 0;
+ threads = ptrace(PT_GETNUMLWPS, pid, NULL, 0);
+ if (errno)
+ err(1, "PT_GETNUMLWPS");
+ tids = malloc(threads * sizeof(*tids));
+ if (tids == NULL)
+ errx(1, "out of memory");
+ errno = 0;
+ ptrace(PT_GETLWPLIST, pid, (void *)tids, threads);
+ if (errno)
+ err(1, "PT_GETLWPLIST");
+
+ sbuf_start_section(sb, &old_len);
+ elf_putnote(NT_PRPSINFO, elf_note_prpsinfo, &pid, sb);
+
+ for (i = 0; i < threads; ++i) {
+ elf_putnote(NT_PRSTATUS, elf_note_prstatus, tids + i, sb);
+ elf_putnote(NT_FPREGSET, elf_note_fpregset, tids + i, sb);
+ elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb);
+#if defined(__i386__) || defined(__amd64__)
+ elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb);
+#endif
+#if defined(__powerpc__)
+ elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb);
+#endif
+ }
+
+#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);
+ elf_putnote(NT_PROCSTAT_GROUPS, elf_note_procstat_groups, &pid, sb);
+ elf_putnote(NT_PROCSTAT_UMASK, elf_note_procstat_umask, &pid, sb);
+ elf_putnote(NT_PROCSTAT_RLIMIT, elf_note_procstat_rlimit, &pid, sb);
+ elf_putnote(NT_PROCSTAT_OSREL, elf_note_procstat_osrel, &pid, sb);
+ 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)
+ err(1, "sbuf_end_section");
+ free(tids);
+ *sizep = size;
+}
+
+/*
+ * Emit one note section to sbuf.
+ */
+static void
+elf_putnote(int type, notefunc_t notefunc, void *arg, struct sbuf *sb)
+{
+ Elf_Note note;
+ size_t descsz;
+ ssize_t old_len;
+ void *desc;
+
+ desc = notefunc(arg, &descsz);
+ note.n_namesz = 8; /* strlen("FreeBSD") + 1 */
+ note.n_descsz = descsz;
+ note.n_type = type;
+
+ sbuf_bcat(sb, &note, sizeof(note));
+ sbuf_start_section(sb, &old_len);
+ sbuf_bcat(sb, "FreeBSD", note.n_namesz);
+ sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0);
+ if (descsz == 0)
+ return;
+ sbuf_start_section(sb, &old_len);
+ sbuf_bcat(sb, desc, descsz);
+ sbuf_end_section(sb, old_len, sizeof(Elf32_Size), 0);
+ free(desc);
+}
+
+/*
+ * Generate the ELF coredump header.
+ */
+static void
+elf_puthdr(pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize,
+ size_t notesz, size_t segoff, int numsegs)
+{
+ Elf_Ehdr *ehdr;
+ Elf_Phdr *phdr;
+ struct phdr_closure phc;
+
+ ehdr = (Elf_Ehdr *)hdr;
+ phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr));
+
+ ehdr->e_ident[EI_MAG0] = ELFMAG0;
+ ehdr->e_ident[EI_MAG1] = ELFMAG1;
+ ehdr->e_ident[EI_MAG2] = ELFMAG2;
+ ehdr->e_ident[EI_MAG3] = ELFMAG3;
+ ehdr->e_ident[EI_CLASS] = ELF_CLASS;
+ ehdr->e_ident[EI_DATA] = ELF_DATA;
+ ehdr->e_ident[EI_VERSION] = EV_CURRENT;
+ ehdr->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+ ehdr->e_ident[EI_ABIVERSION] = 0;
+ ehdr->e_ident[EI_PAD] = 0;
+ ehdr->e_type = ET_CORE;
+ ehdr->e_machine = ELF_ARCH;
+ ehdr->e_version = EV_CURRENT;
+ ehdr->e_entry = 0;
+ ehdr->e_phoff = sizeof(Elf_Ehdr);
+ ehdr->e_flags = 0;
+ ehdr->e_ehsize = sizeof(Elf_Ehdr);
+ ehdr->e_phentsize = sizeof(Elf_Phdr);
+ ehdr->e_phnum = numsegs + 1;
+ ehdr->e_shentsize = sizeof(Elf_Shdr);
+ ehdr->e_shnum = 0;
+ ehdr->e_shstrndx = SHN_UNDEF;
+
+ /*
+ * Fill in the program header entries.
+ */
+
+ /* The note segement. */
+ phdr->p_type = PT_NOTE;
+ phdr->p_offset = hdrsize;
+ phdr->p_vaddr = 0;
+ phdr->p_paddr = 0;
+ phdr->p_filesz = notesz;
+ phdr->p_memsz = 0;
+ phdr->p_flags = PF_R;
+ phdr->p_align = sizeof(Elf32_Size);
+ phdr++;
+
+ /* All the writable segments from the program. */
+ phc.phdr = phdr;
+ phc.offset = segoff;
+ each_writable_segment(map, cb_put_phdr, &phc);
+}
+
+/*
+ * Free the memory map.
+ */
+static void
+freemap(vm_map_entry_t map)
+{
+
+ while (map != NULL) {
+ vm_map_entry_t next = map->next;
+ free(map);
+ map = next;
+ }
+}
+
+/*
+ * Read the process's memory map using kinfo_getvmmap(), and return a list of
+ * VM map entries. Only the non-device read/writable segments are
+ * returned. The map entries in the list aren't fully filled in; only
+ * the items we need are present.
+ */
+static vm_map_entry_t
+readmap(pid_t pid)
+{
+ vm_map_entry_t ent, *linkp, map;
+ struct kinfo_vmentry *vmentl, *kve;
+ int i, nitems;
+
+ vmentl = kinfo_getvmmap(pid, &nitems);
+ if (vmentl == NULL)
+ err(1, "cannot retrieve mappings for %u process", pid);
+
+ map = NULL;
+ linkp = &map;
+ for (i = 0; i < nitems; i++) {
+ kve = &vmentl[i];
+
+ /*
+ * Ignore 'malformed' segments or ones representing memory
+ * mapping with MAP_NOCORE on.
+ * If the 'full' support is disabled, just dump the most
+ * meaningful data segments.
+ */
+ if ((kve->kve_protection & KVME_PROT_READ) == 0 ||
+ (kve->kve_flags & KVME_FLAG_NOCOREDUMP) != 0 ||
+ kve->kve_type == KVME_TYPE_DEAD ||
+ kve->kve_type == KVME_TYPE_UNKNOWN ||
+ ((pflags & PFLAGS_FULL) == 0 &&
+ kve->kve_type != KVME_TYPE_DEFAULT &&
+ kve->kve_type != KVME_TYPE_VNODE &&
+ kve->kve_type != KVME_TYPE_SWAP &&
+ kve->kve_type != KVME_TYPE_PHYS))
+ continue;
+
+ ent = calloc(1, sizeof(*ent));
+ if (ent == NULL)
+ errx(1, "out of memory");
+ ent->start = (vm_offset_t)kve->kve_start;
+ ent->end = (vm_offset_t)kve->kve_end;
+ ent->protection = VM_PROT_READ | VM_PROT_WRITE;
+ if ((kve->kve_protection & KVME_PROT_EXEC) != 0)
+ ent->protection |= VM_PROT_EXECUTE;
+
+ *linkp = ent;
+ linkp = &ent->next;
+ }
+ free(vmentl);
+ return (map);
+}
+
+/*
+ * Miscellaneous note out functions.
+ */
+
+static void *
+elf_note_prpsinfo(void *arg, size_t *sizep)
+{
+ pid_t pid;
+ elfcore_prpsinfo_t *psinfo;
+ struct kinfo_proc kip;
+ size_t len;
+ int name[4];
+
+ pid = *(pid_t *)arg;
+ psinfo = calloc(1, sizeof(*psinfo));
+ if (psinfo == NULL)
+ errx(1, "out of memory");
+ psinfo->pr_version = PRPSINFO_VERSION;
+ psinfo->pr_psinfosz = sizeof(*psinfo);
+
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_PID;
+ name[3] = pid;
+ len = sizeof(kip);
+ if (sysctl(name, 4, &kip, &len, NULL, 0) == -1)
+ err(1, "kern.proc.pid.%u", pid);
+ if (kip.ki_pid != pid)
+ err(1, "kern.proc.pid.%u", pid);
+ strlcpy(psinfo->pr_fname, kip.ki_comm, sizeof(psinfo->pr_fname));
+ strlcpy(psinfo->pr_psargs, psinfo->pr_fname, sizeof(psinfo->pr_psargs));
+
+ *sizep = sizeof(*psinfo);
+ return (psinfo);
+}
+
+static void *
+elf_note_prstatus(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ 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(*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 *)&greg, 0);
+ elf_convert_gregset(&status->pr_reg, &greg);
+
+ *sizep = sizeof(*status);
+ return (status);
+}
+
+static void *
+elf_note_fpregset(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ 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 *)&fpreg, 0);
+ elf_convert_fpregset(fpregset, &fpreg);
+
+ *sizep = sizeof(*fpregset);
+ return (fpregset);
+}
+
+static void *
+elf_note_thrmisc(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ struct ptrace_lwpinfo lwpinfo;
+ thrmisc_t *thrmisc;
+
+ tid = *(lwpid_t *)arg;
+ thrmisc = calloc(1, sizeof(*thrmisc));
+ if (thrmisc == NULL)
+ errx(1, "out of memory");
+ ptrace(PT_LWPINFO, tid, (void *)&lwpinfo,
+ sizeof(lwpinfo));
+ memset(&thrmisc->_pad, 0, sizeof(thrmisc->_pad));
+ strcpy(thrmisc->pr_tname, lwpinfo.pl_tdname);
+
+ *sizep = sizeof(*thrmisc);
+ return (thrmisc);
+}
+
+#if defined(__i386__) || defined(__amd64__)
+static void *
+elf_note_x86_xstate(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ char *xstate;
+ static bool xsave_checked = false;
+ static struct ptrace_xstate_info info;
+
+ tid = *(lwpid_t *)arg;
+ if (!xsave_checked) {
+ if (ptrace(PT_GETXSTATE_INFO, tid, (void *)&info,
+ sizeof(info)) != 0)
+ info.xsave_len = 0;
+ xsave_checked = true;
+ }
+ if (info.xsave_len == 0) {
+ *sizep = 0;
+ return (NULL);
+ }
+ xstate = calloc(1, info.xsave_len);
+ ptrace(PT_GETXSTATE, tid, xstate, 0);
+ *(uint64_t *)(xstate + X86_XSTATE_XCR0_OFFSET) = info.xsave_mask;
+ *sizep = info.xsave_len;
+ return (xstate);
+}
+#endif
+
+#if defined(__powerpc__)
+static void *
+elf_note_powerpc_vmx(void *arg, size_t *sizep)
+{
+ lwpid_t tid;
+ struct vmxreg *vmx;
+ static bool has_vmx = true;
+ struct vmxreg info;
+
+ tid = *(lwpid_t *)arg;
+ if (has_vmx) {
+ if (ptrace(PT_GETVRREGS, tid, (void *)&info,
+ sizeof(info)) != 0)
+ has_vmx = false;
+ }
+ if (!has_vmx) {
+ *sizep = 0;
+ return (NULL);
+ }
+ vmx = calloc(1, sizeof(*vmx));
+ memcpy(vmx, &info, sizeof(*vmx));
+ *sizep = sizeof(*vmx);
+ return (vmx);
+}
+#endif
+
+static void *
+procstat_sysctl(void *arg, int what, size_t structsz, size_t *sizep)
+{
+ size_t len;
+ pid_t pid;
+ int name[4], structsize;
+ void *buf, *p;
+
+ pid = *(pid_t *)arg;
+ structsize = structsz;
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = what;
+ name[3] = pid;
+ len = 0;
+ if (sysctl(name, 4, NULL, &len, NULL, 0) == -1)
+ err(1, "kern.proc.%d.%u", what, pid);
+ buf = calloc(1, sizeof(structsize) + len * 4 / 3);
+ if (buf == NULL)
+ errx(1, "out of memory");
+ bcopy(&structsize, buf, sizeof(structsize));
+ p = (char *)buf + sizeof(structsize);
+ if (sysctl(name, 4, p, &len, NULL, 0) == -1)
+ err(1, "kern.proc.%d.%u", what, pid);
+
+ *sizep = sizeof(structsize) + len;
+ return (buf);
+}
+
+static void *
+elf_note_procstat_proc(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_PID | KERN_PROC_INC_THREAD,
+ sizeof(struct kinfo_proc), sizep));
+}
+
+static void *
+elf_note_procstat_files(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_FILEDESC,
+ sizeof(struct kinfo_file), sizep));
+}
+
+static void *
+elf_note_procstat_vmmap(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_VMMAP,
+ sizeof(struct kinfo_vmentry), sizep));
+}
+
+static void *
+elf_note_procstat_groups(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_GROUPS, sizeof(gid_t), sizep));
+}
+
+static void *
+elf_note_procstat_umask(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_UMASK, sizeof(u_short), sizep));
+}
+
+static void *
+elf_note_procstat_osrel(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_OSREL, sizeof(int), sizep));
+}
+
+static void *
+elf_note_procstat_psstrings(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_PS_STRINGS,
+ sizeof(vm_offset_t), sizep));
+}
+
+static void *
+elf_note_procstat_auxv(void *arg, size_t *sizep)
+{
+
+ return (procstat_sysctl(arg, KERN_PROC_AUXV,
+ sizeof(Elf_Auxinfo), sizep));
+}
+
+static void *
+elf_note_procstat_rlimit(void *arg, size_t *sizep)
+{
+ pid_t pid;
+ size_t len;
+ int i, name[5], structsize;
+ void *buf, *p;
+
+ pid = *(pid_t *)arg;
+ structsize = sizeof(struct rlimit) * RLIM_NLIMITS;
+ buf = calloc(1, sizeof(structsize) + structsize);
+ if (buf == NULL)
+ errx(1, "out of memory");
+ bcopy(&structsize, buf, sizeof(structsize));
+ p = (char *)buf + sizeof(structsize);
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_RLIMIT;
+ name[3] = pid;
+ len = sizeof(struct rlimit);
+ for (i = 0; i < RLIM_NLIMITS; i++) {
+ name[4] = i;
+ if (sysctl(name, 5, p, &len, NULL, 0) == -1)
+ err(1, "kern.proc.rlimit.%u", pid);
+ if (len != sizeof(struct rlimit))
+ errx(1, "kern.proc.rlimit.%u: short read", pid);
+ p += len;
+ }
+
+ *sizep = sizeof(structsize) + structsize;
+ return (buf);
+}
+
+struct dumpers __elfN(dump) = { elf_ident, elf_coredump };
+TEXT_SET(dumpset, __elfN(dump));
diff --git a/usr.bin/gcore/extern.h b/usr.bin/gcore/extern.h
new file mode 100644
index 0000000..cf8a44f
--- /dev/null
+++ b/usr.bin/gcore/extern.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1992, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define PFLAGS_FULL 0x01
+#define PFLAGS_RESUME 0x02
+
+struct dumpers {
+ int (*ident)(int efd, pid_t pid, char *binfile);
+ void (*dump)(int efd, int fd, pid_t pid);
+};
+extern int pflags;
diff --git a/usr.bin/gcore/gcore.1 b/usr.bin/gcore/gcore.1
new file mode 100644
index 0000000..59b6b03
--- /dev/null
+++ b/usr.bin/gcore/gcore.1
@@ -0,0 +1,104 @@
+.\" Copyright (c) 1983, 1990, 1992, 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.
+.\"
+.\" @(#)gcore.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2010
+.Dt GCORE 1
+.Os
+.Sh NAME
+.Nm gcore
+.Nd get core images of running process
+.Sh SYNOPSIS
+.Nm
+.Op Fl f
+.Op Fl s
+.Op Fl c Ar core
+.Op Ar executable
+.Ar pid
+.Sh DESCRIPTION
+The
+.Nm
+utility creates a core image of the specified process,
+suitable for use with
+.Xr gdb 1 .
+By default, the core is written to the file
+.Dq Pa core.<pid> .
+The process identifier,
+.Ar pid ,
+must be given on the command line.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c
+Write the core file to the specified file instead of
+.Dq Pa core.<pid> .
+.It Fl f
+Dumps all available segments, excluding only malformed and undumpable segments.
+Unlike the default invocation, this flag dumps mappings of devices which
+may invalidate the state of device transactions or trigger other unexpected
+behavior.
+As a result, this flag should only be used when the behavior of the
+application and any devices it has mapped is fully understood and any side
+effects can be controlled or tolerated.
+.It Fl s
+Stop the process while gathering the core image, and resume it
+when done.
+This guarantees that the resulting core dump will
+be in a consistent state.
+The process is resumed even if it was
+already stopped.
+The same effect can be achieved manually with
+.Xr kill 1 .
+.El
+.Sh FILES
+.Bl -tag -width /var/log/messages -compact
+.It Pa core.<pid>
+the core image
+.El
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.Bx 4.2 .
+.Sh BUGS
+Because of the
+.Xr ptrace 2
+usage
+.Nm
+may not work with processes which are actively being investigated with
+.Xr truss 1
+or
+.Xr gdb 1 .
+Additionally, interruptable sleeps may exit with EINTR.
+.Pp
+The
+.Nm
+utility is not compatible with the original
+.Bx 4.2
+version.
diff --git a/usr.bin/gcore/gcore.c b/usr.bin/gcore/gcore.c
new file mode 100644
index 0000000..e036c91
--- /dev/null
+++ b/usr.bin/gcore/gcore.c
@@ -0,0 +1,177 @@
+/*-
+ * Copyright (c) 1992, 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) 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)gcore.c 8.2 (Berkeley) 9/23/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Originally written by Eric Cooper in Fall 1981.
+ * Inspired by a version 6 program by Len Levin, 1978.
+ * Several pieces of code lifted from Bill Joy's 4BSD ps.
+ * Most recently, hacked beyond recognition for 4.4BSD by Steven McCanne,
+ * Lawrence Berkeley Laboratory.
+ *
+ * Portions of this software were developed by the Computer Systems
+ * Engineering group at Lawrence Berkeley Laboratory under DARPA
+ * contract BG 91-66 and contributed to Berkeley.
+ */
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/linker_set.h>
+#include <sys/sysctl.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+int pflags;
+
+static void killed(int);
+static void usage(void) __dead2;
+
+static pid_t pid;
+
+SET_DECLARE(dumpset, struct dumpers);
+
+int
+main(int argc, char *argv[])
+{
+ int ch, efd, fd, name[4];
+ char *binfile, *corefile;
+ char passpath[MAXPATHLEN], fname[MAXPATHLEN];
+ struct dumpers **d, *dumper;
+ size_t len;
+
+ pflags = 0;
+ corefile = NULL;
+ while ((ch = getopt(argc, argv, "c:fs")) != -1) {
+ switch (ch) {
+ case 'c':
+ corefile = optarg;
+ break;
+ case 'f':
+ pflags |= PFLAGS_FULL;
+ break;
+ case 's':
+ pflags |= PFLAGS_RESUME;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+ argv += optind;
+ argc -= optind;
+ /* XXX we should check that the pid argument is really a number */
+ switch (argc) {
+ case 1:
+ pid = atoi(argv[0]);
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_PATHNAME;
+ name[3] = pid;
+ len = sizeof(passpath);
+ if (sysctl(name, 4, passpath, &len, NULL, 0) == -1)
+ errx(1, "kern.proc.pathname failure");
+ binfile = passpath;
+ break;
+ case 2:
+ pid = atoi(argv[1]);
+ binfile = argv[0];
+ break;
+ default:
+ usage();
+ }
+ efd = open(binfile, O_RDONLY, 0);
+ if (efd < 0)
+ err(1, "%s", binfile);
+ dumper = NULL;
+ SET_FOREACH(d, dumpset) {
+ lseek(efd, 0, SEEK_SET);
+ if (((*d)->ident)(efd, pid, binfile)) {
+ dumper = (*d);
+ lseek(efd, 0, SEEK_SET);
+ break;
+ }
+ }
+ if (dumper == NULL)
+ errx(1, "Invalid executable file");
+ if (corefile == NULL) {
+ (void)snprintf(fname, sizeof(fname), "core.%d", pid);
+ corefile = fname;
+ }
+ fd = open(corefile, O_RDWR|O_CREAT|O_TRUNC, DEFFILEMODE);
+ if (fd < 0)
+ err(1, "%s", corefile);
+ /*
+ * The semantics of the 's' flag is to stop the target process.
+ * Previous versions of gcore would manage this by trapping SIGHUP,
+ * SIGINT and SIGTERM (to be passed to the target pid), and then
+ * signal the child to stop.
+ *
+ * However, this messes up if the selected dumper uses ptrace calls
+ * that leave the child already stopped. The waitpid call in elfcore
+ * never returns.
+ *
+ * The best thing to do here is to externalize the 's' flag and let
+ * each dumper dispose of what that means, if anything. For the elfcore
+ * dumper, the 's' flag is a no-op since the ptrace attach stops the
+ * process in question already.
+ */
+
+ dumper->dump(efd, fd, pid);
+ (void)close(fd);
+ (void)close(efd);
+ exit(0);
+}
+
+void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: gcore [-s] [-c core] [executable] pid\n");
+ exit(1);
+}
diff --git a/usr.bin/gencat/Makefile b/usr.bin/gencat/Makefile
new file mode 100644
index 0000000..2cf86df
--- /dev/null
+++ b/usr.bin/gencat/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= gencat
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/gencat/Makefile.depend b/usr.bin/gencat/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/gencat/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/gencat/gencat.1 b/usr.bin/gencat/gencat.1
new file mode 100644
index 0000000..59f614d
--- /dev/null
+++ b/usr.bin/gencat/gencat.1
@@ -0,0 +1,191 @@
+.\" $OpenBSD: gencat.1,v 1.3 1997/06/11 15:39:54 kstailey Exp $
+.\"
+.\" Copyright (c) 1997 Ken Stailey
+.\"
+.\" 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. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 11, 1997
+.Dt GENCAT 1
+.Os
+.Sh NAME
+.Nm gencat
+.Nd NLS catalog compiler
+.Sh SYNOPSIS
+.Nm
+.Ar "output-file"
+.Ar "input-files..."
+.Sh DESCRIPTION
+The
+.Nm
+utility merges the text NLS input files
+.Ar "input-files..."
+into a formatted message catalog file
+.Ar "output-file" .
+The file
+.Ar "output-file"
+will be created if it does not already exist.
+If
+.Ar "output-file"
+does exist, its messages will be included in the new
+.Ar "output-file" .
+If set and message numbers collide, the new message text defined in
+.Ar "input-files..."
+will replace the old message text currently contained in
+.Ar "output-file" .
+.Sh INPUT FILES
+The format of a message text source file is defined below.
+Note that
+the fields of a message text source line are separated by a single space
+character: any other space characters are considered to be part of the
+field contents.
+.Bl -tag -width 3n
+.It Li $set Ar n comment
+This line specifies the set identifier of the following messages until
+the next
+.Li $set
+or end-of-file appears.
+The argument
+.Ar n
+is the set identifier which is defined as a number in the range
+[1, (NL_SETMAX)].
+Set identifiers must occur in ascending order within
+a single source file, but need not be contiguous.
+Any string following
+a space following the set identifier is treated as a comment.
+If no
+.Li $set
+directive is specified in a given source file, all messages will
+be located in the default message set NL_SETD.
+.It Li $del Ar n comment
+This line deletes messages from set
+.Ar n
+from a message catalog.
+The
+.Ar n
+specifies a set number.
+Any string following a space following the set
+number is treated as a comment.
+.It Li $ Ar comment
+A line beginning with
+.Li $
+followed by a space is treated as a comment.
+.It Ar m message-text
+A message line consists of a message identifier
+.Ar m
+in the range [1, (NL_MSGMAX)].
+The
+.Ar message-text
+is stored in the message catalog with the set identifier specified by
+the last
+.Li $set
+directive, and the message identifier
+.Ar m .
+If the
+.Ar message-text
+is empty, and there is a space character following the message identifier,
+an empty string is stored in the message catalog.
+If the
+.Ar message-text
+is empty, and if there is no space character following the message
+identifier, then the existing message in the current set with the
+specified message identifier is deleted from the catalog.
+Message
+identifiers must be in ascending order within a single set, but
+need not be contiguous.
+The
+.Ar message-text
+length must be in the range [0, (NL_TEXTMAX)].
+.It Li $quote Ar c
+This line specifies an optional quote character
+.Ar c
+which can be used to surround
+.Ar message-text
+so that trailing space or empty messages are visible in message
+source files.
+By default, or if an empty
+.Li $quote
+directive is specified, no quoting of
+.Ar message-text
+will be recognized.
+.El
+.Pp
+Empty lines in message source files are ignored.
+The effect of lines
+beginning with any character other than those described above is
+undefined.
+.Pp
+Text strings can contain the following special characters and escape
+sequences.
+In addition, if a quote character is defined, it may be
+escaped as well to embed a literal quote character.
+.Pp
+.Bl -tag -width "\eooo" -offset indent -compact
+.It Li \en
+line feed
+.It Li \et
+horizontal tab
+.It Li \ev
+vertical tab
+.It Li \eb
+backspace
+.It Li \er
+carriage return
+.It Li \ef
+form feed
+.It Li \e\e
+backslash
+.It Li \eooo
+octal number in the range [000, 377]
+.El
+.Pp
+A backslash character immediately before the end of the line in a file
+is used to continue the line onto the next line, e.g.:
+.Pp
+.Dl 1 This line is continued \e
+.Dl on this line.
+.Pp
+If the character following the backslash is not one of those specified,
+the backslash is ignored.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr catclose 3 ,
+.Xr catgets 3 ,
+.Xr catopen 3
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -xpg4
+standard.
+.Sh AUTHORS
+.An -nosplit
+This manual page was originally written by
+.An Ken Stailey
+and later revised by
+.An Terry Lambert .
+.Sh BUGS
+A message catalog file created from a blank input file cannot be revised;
+it must be deleted and recreated.
diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c
new file mode 100644
index 0000000..6d4098a
--- /dev/null
+++ b/usr.bin/gencat/gencat.c
@@ -0,0 +1,694 @@
+/* ex:ts=4
+ */
+
+/* $NetBSD: gencat.c,v 1.18 2003/10/27 00:12:43 lukem Exp $ */
+
+/*
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/***********************************************************
+Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that Alfalfa's name not be used in
+advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ALPHALPHA BE LIABLE FOR ANY SPECIAL, 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.
+
+If you make any modifications, bugfixes or other changes to this software
+we'd appreciate it if you could send a copy to us so we can keep things
+up-to-date. Many thanks.
+ Kee Hinckley
+ Alfalfa Software, Inc.
+ 267 Allston St., #3
+ Cambridge, MA 02139 USA
+ nazgul@alfalfa.com
+
+******************************************************************/
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define _NLS_PRIVATE
+
+#include <sys/types.h>
+#include <sys/queue.h>
+
+#include <arpa/inet.h> /* for htonl() */
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <nl_types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+struct _msgT {
+ long msgId;
+ char *str;
+ LIST_ENTRY(_msgT) entries;
+};
+
+struct _setT {
+ long setId;
+ LIST_HEAD(msghead, _msgT) msghead;
+ LIST_ENTRY(_setT) entries;
+};
+
+static LIST_HEAD(sethead, _setT) sethead;
+static struct _setT *curSet;
+
+static char *curline = NULL;
+static long lineno = 0;
+
+static char *cskip(char *);
+static void error(const char *);
+static char *get_line(int);
+static char *getmsg(int, char *, char);
+static void warning(const char *, const char *);
+static char *wskip(char *);
+static char *xstrdup(const char *);
+static void *xmalloc(size_t);
+static void *xrealloc(void *, size_t);
+
+void MCParse(int);
+void MCReadCat(int);
+void MCWriteCat(int);
+void MCDelMsg(int);
+void MCAddMsg(int, const char *);
+void MCAddSet(int);
+void MCDelSet(int);
+void usage(void);
+int main(int, char **);
+
+void
+usage(void)
+{
+ fprintf(stderr, "usage: %s catfile msgfile ...\n", getprogname());
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ int ofd, ifd;
+ char *catfile = NULL;
+ int c;
+
+#define DEPRECATEDMSG 1
+
+#ifdef DEPRECATEDMSG
+ while ((c = getopt(argc, argv, "new")) != -1) {
+#else
+ while ((c = getopt(argc, argv, "")) != -1) {
+#endif
+ switch (c) {
+#ifdef DEPRECATEDMSG
+ case 'n':
+ fprintf(stderr, "WARNING: Usage of \"-new\" argument is deprecated.\n");
+ case 'e':
+ case 'w':
+ break;
+#endif
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 2) {
+ usage();
+ /* NOTREACHED */
+ }
+ catfile = *argv++;
+
+ for (; *argv; argv++) {
+ if ((ifd = open(*argv, O_RDONLY)) < 0)
+ err(1, "Unable to read %s", *argv);
+ MCParse(ifd);
+ close(ifd);
+ }
+
+ if ((ofd = open(catfile, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0)
+ err(1, "Unable to create a new %s", catfile);
+ MCWriteCat(ofd);
+ exit(0);
+}
+
+static void
+warning(const char *cptr, const char *msg)
+{
+ fprintf(stderr, "%s: %s on line %ld\n", getprogname(), msg, lineno);
+ fprintf(stderr, "%s\n", curline);
+ if (cptr) {
+ char *tptr;
+ for (tptr = curline; tptr < cptr; ++tptr)
+ putc(' ', stderr);
+ fprintf(stderr, "^\n");
+ }
+}
+
+#define CORRUPT() { error("corrupt message catalog"); }
+#define NOMEM() { error("out of memory"); }
+
+static void
+error(const char *msg)
+{
+ warning(NULL, msg);
+ exit(1);
+}
+
+static void *
+xmalloc(size_t len)
+{
+ void *p;
+
+ if ((p = malloc(len)) == NULL)
+ NOMEM();
+ return (p);
+}
+
+static void *
+xrealloc(void *ptr, size_t size)
+{
+ if ((ptr = realloc(ptr, size)) == NULL)
+ NOMEM();
+ return (ptr);
+}
+
+static char *
+xstrdup(const char *str)
+{
+ char *nstr;
+
+ if ((nstr = strdup(str)) == NULL)
+ NOMEM();
+ return (nstr);
+}
+
+static char *
+get_line(int fd)
+{
+ static long curlen = BUFSIZ;
+ static char buf[BUFSIZ], *bptr = buf, *bend = buf;
+ char *cptr, *cend;
+ long buflen;
+
+ if (!curline) {
+ curline = xmalloc(curlen);
+ }
+ ++lineno;
+
+ cptr = curline;
+ cend = curline + curlen;
+ for (;;) {
+ for (; bptr < bend && cptr < cend; ++cptr, ++bptr) {
+ if (*bptr == '\n') {
+ *cptr = '\0';
+ ++bptr;
+ return (curline);
+ } else
+ *cptr = *bptr;
+ }
+ if (cptr == cend) {
+ cptr = curline = xrealloc(curline, curlen *= 2);
+ cend = curline + curlen;
+ }
+ if (bptr == bend) {
+ buflen = read(fd, buf, BUFSIZ);
+ if (buflen <= 0) {
+ if (cptr > curline) {
+ *cptr = '\0';
+ return (curline);
+ }
+ return (NULL);
+ }
+ bend = buf + buflen;
+ bptr = buf;
+ }
+ }
+}
+
+static char *
+wskip(char *cptr)
+{
+ if (!*cptr || !isspace((unsigned char) *cptr)) {
+ warning(cptr, "expected a space");
+ return (cptr);
+ }
+ while (*cptr && isspace((unsigned char) *cptr))
+ ++cptr;
+ return (cptr);
+}
+
+static char *
+cskip(char *cptr)
+{
+ if (!*cptr || isspace((unsigned char) *cptr)) {
+ warning(cptr, "wasn't expecting a space");
+ return (cptr);
+ }
+ while (*cptr && !isspace((unsigned char) *cptr))
+ ++cptr;
+ return (cptr);
+}
+
+static char *
+getmsg(int fd, char *cptr, char quote)
+{
+ static char *msg = NULL;
+ static long msglen = 0;
+ long clen, i;
+ char *tptr;
+
+ if (quote && *cptr == quote) {
+ ++cptr;
+ }
+
+ clen = strlen(cptr) + 1;
+ if (clen > msglen) {
+ if (msglen)
+ msg = xrealloc(msg, clen);
+ else
+ msg = xmalloc(clen);
+ msglen = clen;
+ }
+ tptr = msg;
+
+ while (*cptr) {
+ if (quote && *cptr == quote) {
+ char *tmp;
+ tmp = cptr + 1;
+ if (*tmp && (!isspace((unsigned char) *tmp) || *wskip(tmp))) {
+ warning(cptr, "unexpected quote character, ignoring");
+ *tptr++ = *cptr++;
+ } else {
+ *cptr = '\0';
+ }
+ } else
+ if (*cptr == '\\') {
+ ++cptr;
+ switch (*cptr) {
+ case '\0':
+ cptr = get_line(fd);
+ if (!cptr)
+ error("premature end of file");
+ msglen += strlen(cptr);
+ i = tptr - msg;
+ msg = xrealloc(msg, msglen);
+ tptr = msg + i;
+ break;
+
+ #define CASEOF(CS, CH) \
+ case CS: \
+ *tptr++ = CH; \
+ ++cptr; \
+ break; \
+
+ CASEOF('n', '\n');
+ CASEOF('t', '\t');
+ CASEOF('v', '\v');
+ CASEOF('b', '\b');
+ CASEOF('r', '\r');
+ CASEOF('f', '\f');
+ CASEOF('"', '"');
+ CASEOF('\\', '\\');
+
+ default:
+ if (quote && *cptr == quote) {
+ *tptr++ = *cptr++;
+ } else if (isdigit((unsigned char) *cptr)) {
+ *tptr = 0;
+ for (i = 0; i < 3; ++i) {
+ if (!isdigit((unsigned char) *cptr))
+ break;
+ if (*cptr > '7')
+ warning(cptr, "octal number greater than 7?!");
+ *tptr *= 8;
+ *tptr += (*cptr - '0');
+ ++cptr;
+ }
+ } else {
+ warning(cptr, "unrecognized escape sequence");
+ }
+ break;
+ }
+ } else {
+ *tptr++ = *cptr++;
+ }
+ }
+ *tptr = '\0';
+ return (msg);
+}
+
+void
+MCParse(int fd)
+{
+ char *cptr, *str;
+ int setid, msgid = 0;
+ char quote = 0;
+
+ /* XXX: init sethead? */
+
+ while ((cptr = get_line(fd))) {
+ if (*cptr == '$') {
+ ++cptr;
+ if (strncmp(cptr, "set", 3) == 0) {
+ cptr += 3;
+ cptr = wskip(cptr);
+ setid = atoi(cptr);
+ MCAddSet(setid);
+ msgid = 0;
+ } else if (strncmp(cptr, "delset", 6) == 0) {
+ cptr += 6;
+ cptr = wskip(cptr);
+ setid = atoi(cptr);
+ MCDelSet(setid);
+ } else if (strncmp(cptr, "quote", 5) == 0) {
+ cptr += 5;
+ if (!*cptr)
+ quote = 0;
+ else {
+ cptr = wskip(cptr);
+ if (!*cptr)
+ quote = 0;
+ else
+ quote = *cptr;
+ }
+ } else if (isspace((unsigned char) *cptr)) {
+ ;
+ } else {
+ if (*cptr) {
+ cptr = wskip(cptr);
+ if (*cptr)
+ warning(cptr, "unrecognized line");
+ }
+ }
+ } else {
+ /*
+ * First check for (and eat) empty lines....
+ */
+ if (!*cptr)
+ continue;
+ /*
+ * We have a digit? Start of a message. Else,
+ * syntax error.
+ */
+ if (isdigit((unsigned char) *cptr)) {
+ msgid = atoi(cptr);
+ cptr = cskip(cptr);
+ cptr = wskip(cptr);
+ /* if (*cptr) ++cptr; */
+ } else {
+ warning(cptr, "neither blank line nor start of a message id");
+ continue;
+ }
+ /*
+ * If we have a message ID, but no message,
+ * then this means "delete this message id
+ * from the catalog".
+ */
+ if (!*cptr) {
+ MCDelMsg(msgid);
+ } else {
+ str = getmsg(fd, cptr, quote);
+ MCAddMsg(msgid, str);
+ }
+ }
+ }
+}
+
+/*
+ * Write message catalog.
+ *
+ * The message catalog is first converted from its internal to its
+ * external representation in a chunk of memory allocated for this
+ * purpose. Then the completed catalog is written. This approach
+ * avoids additional housekeeping variables and/or a lot of seeks
+ * that would otherwise be required.
+ */
+void
+MCWriteCat(int fd)
+{
+ int nsets; /* number of sets */
+ int nmsgs; /* number of msgs */
+ int string_size; /* total size of string pool */
+ int msgcat_size; /* total size of message catalog */
+ void *msgcat; /* message catalog data */
+ struct _nls_cat_hdr *cat_hdr;
+ struct _nls_set_hdr *set_hdr;
+ struct _nls_msg_hdr *msg_hdr;
+ char *strings;
+ struct _setT *set;
+ struct _msgT *msg;
+ int msg_index;
+ int msg_offset;
+
+ /* determine number of sets, number of messages, and size of the
+ * string pool */
+ nsets = 0;
+ nmsgs = 0;
+ string_size = 0;
+
+ for (set = sethead.lh_first; set != NULL;
+ set = set->entries.le_next) {
+ nsets++;
+
+ for (msg = set->msghead.lh_first; msg != NULL;
+ msg = msg->entries.le_next) {
+ nmsgs++;
+ string_size += strlen(msg->str) + 1;
+ }
+ }
+
+#ifdef DEBUG
+ printf("number of sets: %d\n", nsets);
+ printf("number of msgs: %d\n", nmsgs);
+ printf("string pool size: %d\n", string_size);
+#endif
+
+ /* determine size and then allocate buffer for constructing external
+ * message catalog representation */
+ msgcat_size = sizeof(struct _nls_cat_hdr)
+ + (nsets * sizeof(struct _nls_set_hdr))
+ + (nmsgs * sizeof(struct _nls_msg_hdr))
+ + string_size;
+
+ msgcat = xmalloc(msgcat_size);
+ memset(msgcat, '\0', msgcat_size);
+
+ /* fill in msg catalog header */
+ cat_hdr = (struct _nls_cat_hdr *) msgcat;
+ cat_hdr->__magic = htonl(_NLS_MAGIC);
+ cat_hdr->__nsets = htonl(nsets);
+ cat_hdr->__mem = htonl(msgcat_size - sizeof(struct _nls_cat_hdr));
+ cat_hdr->__msg_hdr_offset =
+ htonl(nsets * sizeof(struct _nls_set_hdr));
+ cat_hdr->__msg_txt_offset =
+ htonl(nsets * sizeof(struct _nls_set_hdr) +
+ nmsgs * sizeof(struct _nls_msg_hdr));
+
+ /* compute offsets for set & msg header tables and string pool */
+ set_hdr = (struct _nls_set_hdr *)(void *)((char *)msgcat +
+ sizeof(struct _nls_cat_hdr));
+ msg_hdr = (struct _nls_msg_hdr *)(void *)((char *)msgcat +
+ sizeof(struct _nls_cat_hdr) +
+ nsets * sizeof(struct _nls_set_hdr));
+ strings = (char *) msgcat +
+ sizeof(struct _nls_cat_hdr) +
+ nsets * sizeof(struct _nls_set_hdr) +
+ nmsgs * sizeof(struct _nls_msg_hdr);
+
+ msg_index = 0;
+ msg_offset = 0;
+ for (set = sethead.lh_first; set != NULL;
+ set = set->entries.le_next) {
+
+ nmsgs = 0;
+ for (msg = set->msghead.lh_first; msg != NULL;
+ msg = msg->entries.le_next) {
+ int msg_len = strlen(msg->str) + 1;
+
+ msg_hdr->__msgno = htonl(msg->msgId);
+ msg_hdr->__msglen = htonl(msg_len);
+ msg_hdr->__offset = htonl(msg_offset);
+
+ memcpy(strings, msg->str, msg_len);
+ strings += msg_len;
+ msg_offset += msg_len;
+
+ nmsgs++;
+ msg_hdr++;
+ }
+
+ set_hdr->__setno = htonl(set->setId);
+ set_hdr->__nmsgs = htonl(nmsgs);
+ set_hdr->__index = htonl(msg_index);
+ msg_index += nmsgs;
+ set_hdr++;
+ }
+
+ /* write out catalog. XXX: should this be done in small chunks? */
+ write(fd, msgcat, msgcat_size);
+}
+
+void
+MCAddSet(int setId)
+{
+ struct _setT *p, *q;
+
+ if (setId <= 0) {
+ error("setId's must be greater than zero");
+ /* NOTREACHED */
+ }
+ if (setId > NL_SETMAX) {
+ error("setId exceeds limit");
+ /* NOTREACHED */
+ }
+
+ p = sethead.lh_first;
+ q = NULL;
+ for (; p != NULL && p->setId < setId; q = p, p = p->entries.le_next);
+
+ if (p && p->setId == setId) {
+ ;
+ } else {
+ p = xmalloc(sizeof(struct _setT));
+ memset(p, '\0', sizeof(struct _setT));
+ LIST_INIT(&p->msghead);
+
+ p->setId = setId;
+
+ if (q == NULL) {
+ LIST_INSERT_HEAD(&sethead, p, entries);
+ } else {
+ LIST_INSERT_AFTER(q, p, entries);
+ }
+ }
+
+ curSet = p;
+}
+
+void
+MCAddMsg(int msgId, const char *str)
+{
+ struct _msgT *p, *q;
+
+ if (!curSet)
+ error("can't specify a message when no set exists");
+
+ if (msgId <= 0) {
+ error("msgId's must be greater than zero");
+ /* NOTREACHED */
+ }
+ if (msgId > NL_MSGMAX) {
+ error("msgID exceeds limit");
+ /* NOTREACHED */
+ }
+
+ p = curSet->msghead.lh_first;
+ q = NULL;
+ for (; p != NULL && p->msgId < msgId; q = p, p = p->entries.le_next);
+
+ if (p && p->msgId == msgId) {
+ free(p->str);
+ } else {
+ p = xmalloc(sizeof(struct _msgT));
+ memset(p, '\0', sizeof(struct _msgT));
+
+ if (q == NULL) {
+ LIST_INSERT_HEAD(&curSet->msghead, p, entries);
+ } else {
+ LIST_INSERT_AFTER(q, p, entries);
+ }
+ }
+
+ p->msgId = msgId;
+ p->str = xstrdup(str);
+}
+
+void
+MCDelSet(int setId)
+{
+ struct _setT *set;
+ struct _msgT *msg;
+
+ set = sethead.lh_first;
+ for (; set != NULL && set->setId < setId; set = set->entries.le_next);
+
+ if (set && set->setId == setId) {
+
+ msg = set->msghead.lh_first;
+ while (msg) {
+ free(msg->str);
+ LIST_REMOVE(msg, entries);
+ }
+
+ LIST_REMOVE(set, entries);
+ return;
+ }
+ warning(NULL, "specified set doesn't exist");
+}
+
+void
+MCDelMsg(int msgId)
+{
+ struct _msgT *msg;
+
+ if (!curSet)
+ error("you can't delete a message before defining the set");
+
+ msg = curSet->msghead.lh_first;
+ for (; msg != NULL && msg->msgId < msgId; msg = msg->entries.le_next);
+
+ if (msg && msg->msgId == msgId) {
+ free(msg->str);
+ LIST_REMOVE(msg, entries);
+ return;
+ }
+ warning(NULL, "specified msg doesn't exist");
+}
diff --git a/usr.bin/getconf/Makefile b/usr.bin/getconf/Makefile
new file mode 100644
index 0000000..eaaf628
--- /dev/null
+++ b/usr.bin/getconf/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+PROG= getconf
+
+SRCS= confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
+CFLAGS+= -I${.CURDIR}
+CLEANFILES+= confstr.c limits.c pathconf.c progenv.c sysconf.c \
+ confstr.names limits.names pathconf.names sysconf.names \
+ conflicting.names unique.names
+
+.SUFFIXES: .gperf .names
+.PHONY: conflicts
+
+all: conflicts
+
+.gperf.c:
+ LC_ALL=C awk -f ${.CURDIR}/fake-gperf.awk ${.IMPSRC} >${.TARGET}
+
+.gperf.names:
+ LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \
+ sed -e 's/,$$//' >${.TARGET}
+
+conflicts: conflicting.names unique.names
+ @if test `wc -l <conflicting.names` != `wc -l <unique.names`; then \
+ echo "Name conflicts found!" >&2; \
+ exit 1; \
+ fi
+
+# pathconf.names is not included here because pathconf names are
+# syntactically distinct from the other kinds.
+conflicting.names: confstr.names limits.names sysconf.names
+ cat ${.ALLSRC} >${.TARGET}
+
+unique.names: conflicting.names
+ LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/getconf/Makefile.depend b/usr.bin/getconf/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/getconf/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf
new file mode 100644
index 0000000..c629987
--- /dev/null
+++ b/usr.bin/getconf/confstr.gperf
@@ -0,0 +1,70 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str);
+
+/*
+ * The Standard seems a bit ambiguous over whether the POSIX_V6_*
+ * are specified with or without a leading underscore, so we just
+ * use both.
+ */
+%}
+struct map { const char *name; int key; int valid; };
+%%
+PATH, _CS_PATH
+POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS
+POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS
+POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS
+POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+_POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+_POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+_POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LIBS
+_POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+_POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+_POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+_POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS
+_POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+_POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LIBS
+_POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+_POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+%%
+int
+find_confstr(const char *name, int *key)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name);
+ if (rv != NULL) {
+ if (rv->valid) {
+ *key = rv->key;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
diff --git a/usr.bin/getconf/fake-gperf.awk b/usr.bin/getconf/fake-gperf.awk
new file mode 100644
index 0000000..96fcd3c
--- /dev/null
+++ b/usr.bin/getconf/fake-gperf.awk
@@ -0,0 +1,66 @@
+#!/usr/bin/awk -f
+# $FreeBSD$
+BEGIN {
+ state = 0;
+ struct_seen = "";
+}
+/^%{$/ && state == 0 {
+ state = 1;
+ next;
+}
+/^%}$/ && state == 1 {
+ state = 0;
+ next;
+}
+state == 1 { print; next; }
+/^struct/ && state == 0 {
+ print;
+ struct_seen = $2;
+ next;
+}
+/^%%$/ && state == 0 {
+ state = 2;
+ if (struct_seen !~ /^$/) {
+ print "static const struct", struct_seen, "wordlist[] = {";
+ } else {
+ print "static const struct map {";
+ print "\tconst char *name;";
+ print "\tint key;";
+ print "\tint valid;";
+ print "} wordlist[] = {";
+ struct_seen = "map";
+ }
+ next;
+}
+/^%%$/ && state == 2 {
+ state = 3;
+ print "\t{ NULL, 0, 0 }";
+ print "};";
+ print "#define\tNWORDS\t(sizeof(wordlist)/sizeof(wordlist[0]) - 1)";
+ print "static const struct map *";
+ print "in_word_set(const char *word)";
+ print "{";
+ print "\tconst struct", struct_seen, "*mp;";
+ print "";
+ print "\tfor (mp = wordlist; mp < &wordlist[NWORDS]; mp++) {";
+ print "\t\tif (strcmp(word, mp->name) == 0)";
+ print "\t\t\treturn (mp);";
+ print "\t}";
+ print "\treturn (NULL);";
+ print "}";
+ print "";
+ next;
+}
+state == 2 && NF == 2 {
+ name = substr($1, 1, length($1) - 1);
+ printf "#ifdef %s\n", $2;
+ printf "\t{ \"%s\", %s, 1 },\n", name, $2;
+ print "#else";
+ printf "\t{ \"%s\", 0, 0 },\n", name, $2;
+ print "#endif"
+ next;
+}
+state == 3 { print; next; }
+{
+ # eat anything not matched.
+}
diff --git a/usr.bin/getconf/getconf.1 b/usr.bin/getconf/getconf.1
new file mode 100644
index 0000000..29a2026
--- /dev/null
+++ b/usr.bin/getconf/getconf.1
@@ -0,0 +1,207 @@
+.\"
+.\" Copyright 2000 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. 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 September 18, 2002
+.Dt GETCONF 1
+.Os
+.Sh NAME
+.Nm getconf
+.Nd retrieve standard configuration variables
+.Sh SYNOPSIS
+.Nm
+.Op Fl v Ar environment
+.Ar path_var
+.Ar file
+.Nm
+.Op Fl v Ar environment
+.Ar system_var
+.Sh DESCRIPTION
+The
+.Nm
+utility prints the value of a
+.Tn POSIX
+or
+.Tn X/Open
+path or system configuration variable to the standard output.
+If the specified variable is undefined, the string
+.Dq Li undefined
+is output.
+.Pp
+The first form of the command, with two mandatory
+arguments, retrieves file- and file system-specific
+configuration variables using
+.Xr pathconf 2 .
+The second form, with a single argument, retrieves system
+configuration variables using
+.Xr confstr 3
+and
+.Xr sysconf 3 ,
+depending on the type of variable.
+As an extension, the second form can also be used to query static limits from
+.In limits.h .
+.Pp
+All
+.Xr sysconf 3
+and
+.Xr pathconf 2
+variables use the same name as the manifest constants defined in
+the relevant standard C-language bindings, including any leading
+underscore or prefix.
+That is to say,
+.Ar system_var
+might be
+.Dv ARG_MAX
+or
+.Dv _POSIX_VERSION ,
+as opposed to the
+.Xr sysconf 3
+names
+.Dv _SC_ARG_MAX
+or
+.Dv _SC_POSIX_VERSION .
+Variables retrieved from
+.Xr confstr 3
+have the leading
+.Ql _CS_
+stripped off; thus,
+.Dv _CS_PATH
+is queried by a
+.Ar system_var
+of
+.Dq Li PATH .
+.Ss Programming Environments
+The
+.Fl v Ar environment
+option specifies a
+.St -p1003.1-2001
+programming environment under which the values are to be queried.
+This option currently does nothing, but may in the future be used
+to select between 32-bit and 64-bit execution environments on platforms
+which support both.
+Specifying an environment which is not supported on the current execution
+platform gives undefined results.
+.Pp
+The standard programming environments are as follows:
+.Bl -tag -width ".Li POSIX_V6_LPBIG_OFFBIG" -offset indent
+.It Li POSIX_V6_ILP32_OFF32
+Exactly 32-bit integer, long, pointer, and file offset.
+.Sy Supported platforms :
+None.
+.It Li POSIX_V6_ILP32_OFFBIG
+Exactly 32-bit integer, long, and pointer; at least 64-bit file offset.
+.Sy Supported platforms :
+.Tn IA32 ,
+.Tn PowerPC .
+.It Li POSIX_V6_LP64_OFF64
+Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
+.Sy Supported platforms :
+.Tn Alpha ,
+.Tn SPARC64 .
+.It Li POSIX_V6_LPBIG_OFFBIG
+At least 32-bit integer; at least 64-bit long, pointer, and file offset.
+.Sy Supported platforms :
+None.
+.El
+.Pp
+The command:
+.Pp
+.Dl "getconf POSIX_V6_WIDTH_RESTRICTED_ENVS"
+.Pp
+returns a newline-separated list of environments in which the width
+of certain fundamental types is no greater than the width of the native
+C type
+.Vt long .
+At present, all programming environments supported by
+.Fx
+have this property.
+Several of the
+.Xr confstr 3
+variables provide information on the necessary compiler and linker flags
+to use the standard programming environments described above.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The command:
+.Pp
+.Dl "getconf PATH"
+.Pp
+will display the system default setting for the
+.Ev PATH
+environment variable.
+.Pp
+The command:
+.Pp
+.Dl "getconf NAME_MAX /tmp"
+.Pp
+will display the maximum length of a filename in the
+.Pa /tmp
+directory.
+.Pp
+The command:
+.Pp
+.Dl "getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX"
+.Pp
+will display the maximum value of the C type
+.Vt long
+in the
+.Li POSIX_V6_LPBIG_OFFBIG
+programming environment,
+if the system supports that environment.
+.Sh DIAGNOSTICS
+Use of a
+.Ar system_var
+or
+.Ar path_var
+which is completely unrecognized is considered an error,
+causing a diagnostic message to be written to standard error.
+One
+which is known but merely undefined does not result in an error
+indication.
+The
+.Nm
+utility recognizes all of the variables defined for
+.St -p1003.1-2001 ,
+including those which are not currently implemented.
+.Sh SEE ALSO
+.Xr pathconf 2 ,
+.Xr confstr 3 ,
+.Xr sysconf 3
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be compliant with
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c
new file mode 100644
index 0000000..5f88db6
--- /dev/null
+++ b/usr.bin/getconf/getconf.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2000 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. 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 <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+static void do_confstr(const char *name, int key);
+static void do_sysconf(const char *name, int key);
+static void do_pathconf(const char *name, int key, const char *path);
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+"usage: getconf [-v prog_env] system_var\n"
+" getconf [-v prog_env] path_var pathname\n");
+ exit(EX_USAGE);
+}
+
+int
+main(int argc, char **argv)
+{
+ int c, key, valid;
+ const char *name, *vflag, *alt_path;
+ intmax_t limitval;
+
+ vflag = NULL;
+ while ((c = getopt(argc, argv, "v:")) != -1) {
+ switch (c) {
+ case 'v':
+ vflag = optarg;
+ break;
+
+ default:
+ usage();
+ }
+ }
+
+ if ((name = argv[optind]) == NULL)
+ usage();
+
+ if (vflag != NULL) {
+ if ((valid = find_progenv(vflag, &alt_path)) == 0)
+ errx(EX_USAGE, "invalid programming environment %s",
+ vflag);
+ if (valid > 0 && alt_path != NULL) {
+ if (argv[optind + 1] == NULL)
+ execl(alt_path, "getconf", argv[optind],
+ (char *)NULL);
+ else
+ execl(alt_path, "getconf", argv[optind],
+ argv[optind + 1], (char *)NULL);
+
+ err(EX_OSERR, "execl: %s", alt_path);
+ }
+ if (valid < 0)
+ errx(EX_UNAVAILABLE, "environment %s is not available",
+ vflag);
+ }
+
+ if (argv[optind + 1] == NULL) { /* confstr or sysconf */
+ if ((valid = find_limit(name, &limitval)) != 0) {
+ if (valid > 0)
+ printf("%" PRIdMAX "\n", limitval);
+ else
+ printf("undefined\n");
+
+ return 0;
+ }
+ if ((valid = find_confstr(name, &key)) != 0) {
+ if (valid > 0)
+ do_confstr(name, key);
+ else
+ printf("undefined\n");
+ } else {
+ valid = find_sysconf(name, &key);
+ if (valid > 0) {
+ do_sysconf(name, key);
+ } else if (valid < 0) {
+ printf("undefined\n");
+ } else
+ errx(EX_USAGE,
+ "no such configuration parameter `%s'",
+ name);
+ }
+ } else {
+ valid = find_pathconf(name, &key);
+ if (valid != 0) {
+ if (valid > 0)
+ do_pathconf(name, key, argv[optind + 1]);
+ else
+ printf("undefined\n");
+ } else
+ errx(EX_USAGE,
+ "no such path configuration parameter `%s'",
+ name);
+ }
+ return 0;
+}
+
+static void
+do_confstr(const char *name, int key)
+{
+ size_t len;
+ int savederr;
+
+ savederr = errno;
+ errno = 0;
+ len = confstr(key, 0, 0);
+ if (len == 0) {
+ if (errno)
+ err(EX_OSERR, "confstr: %s", name);
+ else
+ printf("undefined\n");
+ } else {
+ char buf[len + 1];
+
+ confstr(key, buf, len);
+ printf("%s\n", buf);
+ }
+ errno = savederr;
+}
+
+static void
+do_sysconf(const char *name, int key)
+{
+ long value;
+
+ errno = 0;
+ value = sysconf(key);
+ if (value == -1 && errno != 0)
+ err(EX_OSERR, "sysconf: %s", name);
+ else if (value == -1)
+ printf("undefined\n");
+ else
+ printf("%ld\n", value);
+}
+
+static void
+do_pathconf(const char *name, int key, const char *path)
+{
+ long value;
+
+ errno = 0;
+ value = pathconf(path, key);
+ if (value == -1 && errno != 0)
+ err(EX_OSERR, "pathconf: %s", name);
+ else if (value == -1)
+ printf("undefined\n");
+ else
+ printf("%ld\n", value);
+}
+
diff --git a/usr.bin/getconf/getconf.h b/usr.bin/getconf/getconf.h
new file mode 100644
index 0000000..266a0ff
--- /dev/null
+++ b/usr.bin/getconf/getconf.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. 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$
+ */
+
+#ifdef STABLE
+typedef long long intmax_t;
+#define PRIdMAX "lld"
+#else
+#include <inttypes.h>
+#endif
+
+int find_confstr(const char *name, int *key);
+int find_limit(const char *name, intmax_t *value);
+int find_pathconf(const char *name, int *key);
+int find_progenv(const char *name, const char **alt_path);
+int find_sysconf(const char *name, int *key);
diff --git a/usr.bin/getconf/limits.gperf b/usr.bin/getconf/limits.gperf
new file mode 100644
index 0000000..68e0d65
--- /dev/null
+++ b/usr.bin/getconf/limits.gperf
@@ -0,0 +1,118 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <limits.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str);
+
+%}
+struct map { const char *name; intmax_t value; int valid; };
+%%
+_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
+_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX
+_POSIX_AIO_MAX, _POSIX_AIO_MAX
+_POSIX_ARG_MAX, _POSIX_ARG_MAX
+_POSIX_CHILD_MAX, _POSIX_CHILD_MAX
+_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX
+_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX
+_POSIX_LINK_MAX, _POSIX_LINK_MAX
+_POSIX_LOGIN_NAME_MAX, _POSIX_LOGIN_NAME_MAX
+_POSIX_MAX_CANON, _POSIX_MAX_CANON
+_POSIX_MAX_INPUT, _POSIX_MAX_INPUT
+_POSIX_MQ_OPEN_MAX, _POSIX_MQ_OPEN_MAX
+_POSIX_MQ_PRIO_MAX, _POSIX_MQ_PRIO_MAX
+_POSIX_NAME_MAX, _POSIX_NAME_MAX
+_POSIX_NGROUPS_MAX, _POSIX_NGROUPS_MAX
+_POSIX_OPEN_MAX, _POSIX_OPEN_MAX
+_POSIX_PATH_MAX, _POSIX_PATH_MAX
+_POSIX_PIPE_BUF, __POSIX_PIPE_BUF
+_POSIX_RE_DUP_MAX, _POSIX_RE_DUP_MAX
+_POSIX_RTSIG_MAX, _POSIX_RTSIG_MAX
+_POSIX_SEM_NSEMS_MAX, _POSIX_SEM_NSEMS_MAX
+_POSIX_SEM_VALUE_MAX, _POSIX_SEM_VALUE_MAX
+_POSIX_SIGQUEUE_MAX, _POSIX_SIGQUEUE_MAX
+_POSIX_SSIZE_MAX, _POSIX_SSIZE_MAX
+_POSIX_STREAM_MAX, _POSIX_STREAM_MAX
+_POSIX_SS_REPL_MAX, _POSIX_SS_REPL_MAX
+_POSIX_SYMLINK_MAX, _POSIX_SYMLINK_MAX
+_POSIX_SYMLOOP_MAX, _POSIX_SYMLOOP_MAX
+_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+_POSIX_THREAD_KEYS_MAX, _POSIX_THREAD_KEYS_MAX
+_POSIX_THREAD_THREADS_MAX, _POSIX_THREAD_THREADS_MAX
+_POSIX_TIMER_MAX, _POSIX_TIMER_MAX
+_POSIX_TRACE_EVENT_NAME_MAX, _POSIX_TRACE_EVENT_NAME_MAX
+_POSIX_TRACE_NAME_MAX, _POSIX_TRACE_NAME_MAX
+_POSIX_TRACE_SYS_MAX, _POSIX_TRACE_SYS_MAX
+_POSIX_TRACE_USER_EVENT_MAX, _POSIX_TRACE_USER_EVENT_MAX
+_POSIX_TTY_NAME_MAX, _POSIX_TTY_NAME_MAX
+_POSIX_TZNAME_MAX, _POSIX_TZNAME_MAX
+_POSIX2_BC_BASE_MAX, _POSIX2_BC_BASE_MAX
+_POSIX2_BC_DIM_MAX, _POSIX2_BC_DIM_MAX
+_POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX
+_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX
+_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX
+_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX
+_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX
+_POSIX2_LINE_MAX, _POSIX2_LINE_MAX
+_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX
+_XOPEN_IOV_MAX, _XOPEN_IOV_MAX
+_XOPEN_NAME_MAX, _XOPEN_NAME_MAX
+_XOPEN_PATH_MAX, _XOPEN_PATH_MAX
+CHAR_BIT, CHAR_BIT
+CHAR_MAX, CHAR_MAX
+CHAR_MIN, CHAR_MIN
+INT_MAX, INT_MAX
+INT_MIN, INT_MIN
+LLONG_MIN, LLONG_MIN
+LLONG_MAX, LLONG_MAX
+LONG_BIT, LONG_BIT
+LONG_MAX, LONG_MAX
+LONG_MIN, LONG_MIN
+MB_LEN_MAX, MB_LEN_MAX
+SCHAR_MAX, SCHAR_MAX
+SCHAR_MIN, SCHAR_MIN
+SHRT_MAX, SHRT_MAX
+SHRT_MIN, SHRT_MIN
+SSIZE_MAX, SSIZE_MAX
+UCHAR_MAX, UCHAR_MAX
+UINT_MAX, UINT_MAX
+ULLONG_MAX, ULLONG_MAX
+ULONG_MAX, ULONG_MAX
+USHRT_MAX, USHRT_MAX
+WORD_BIT, WORD_BIT
+CHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX
+NL_ARGMAX, NL_ARGMAX
+ML_LANGMAX, NL_LANGMAX
+NL_MSGMAX, NL_MSGMAX
+NL_NMAX, NL_NMAX
+NL_SETMAX, NL_SETMAX
+NL_TEXTMAX, NL_TEXTMAX
+NZERO, NZERO
+%%
+int
+find_limit(const char *name, intmax_t *value)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name);
+ if (rv != NULL) {
+ if (rv->valid) {
+ *value = rv->value;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
diff --git a/usr.bin/getconf/pathconf.gperf b/usr.bin/getconf/pathconf.gperf
new file mode 100644
index 0000000..e8b8365
--- /dev/null
+++ b/usr.bin/getconf/pathconf.gperf
@@ -0,0 +1,62 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str);
+
+%}
+struct map { const char *name; int key; int valid; };
+%%
+FILESIZEBITS, _PC_FILESIZEBITS
+LINK_MAX, _PC_LINK_MAX
+MAX_CANON, _PC_MAX_CANON
+MAX_INPUT, _PC_MAX_INPUT
+NAME_MAX, _PC_NAME_MAX
+PATH_MAX, _PC_PATH_MAX
+PIPE_BUF, _PC_PIPE_BUF
+POSIX_ALLOC_SIZE_MIN, _PC_ALLOC_SIZE_MIN
+POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE
+POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE
+POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE
+POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN
+SYMLINK_MAX, _PC_SYMLINK_MAX
+TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED
+TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX
+TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT
+TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT
+TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT
+_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED
+_POSIX_NO_TRUNC, _PC_NO_TRUNC
+_POSIX_VDISABLE, _PC_VDISABLE
+_POSIX_ASYNC_IO, _PC_ASYNC_IO
+_POSIX_PRIO_IO, _PC_PRIO_IO
+_POSIX_SYNC_IO, _PC_SYNC_IO
+%%
+int
+find_pathconf(const char *name, int *key)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name);
+ if (rv != NULL) {
+ if (rv->valid) {
+ *key = rv->key;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
diff --git a/usr.bin/getconf/progenv.gperf b/usr.bin/getconf/progenv.gperf
new file mode 100644
index 0000000..40ce16a
--- /dev/null
+++ b/usr.bin/getconf/progenv.gperf
@@ -0,0 +1,67 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str);
+
+/*
+ * The Standard seems a bit ambiguous over whether the POSIX_V6_*
+ * are specified with or without a leading underscore, so we just
+ * use both.
+ */
+/*
+ * The alt_path member gives the path containing another `getconf'
+ * executable which was compiled using the specified programming
+ * environment. If it is NULL, the current executable is good enough.
+ * If we ever support multiple environments, this table will need to
+ * be updated. (We cheat here and define the supported environments
+ * statically.)
+ */
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#define have_LP64_OFF64 NULL
+#endif
+
+#if defined(__i386__) || defined(__powerpc__)
+#define have_ILP32_OFFBIG NULL
+#endif
+
+%}
+struct map { const char *name; const char *alt_path; int valid; };
+%%
+POSIX_V6_ILP32_OFF32, notdef
+POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG
+POSIX_V6_LP64_OFF64, have_LP64_OFF64
+POSIX_V6_LPBIG_OFFBIG, notdef
+_POSIX_V6_ILP32_OFF32, notdef
+_POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG
+_POSIX_V6_LP64_OFF64, have_LP64_OFF64
+_POSIX_V6_LPBIG_OFFBIG, notdef
+%%
+int
+find_progenv(const char *name, const char **alt_path)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name);
+ if (rv != NULL) {
+ if (rv->valid) {
+ *alt_path = rv->alt_path;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
diff --git a/usr.bin/getconf/sysconf.gperf b/usr.bin/getconf/sysconf.gperf
new file mode 100644
index 0000000..6a0a349
--- /dev/null
+++ b/usr.bin/getconf/sysconf.gperf
@@ -0,0 +1,149 @@
+%{
+/*
+ * Copyright is disclaimed as to the contents of this file.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "getconf.h"
+
+/*
+ * Override gperf's built-in external scope.
+ */
+static const struct map *in_word_set(const char *str);
+
+%}
+struct map { const char *name; int key; int valid; };
+%%
+AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX
+AIO_MAX, _SC_AIO_MAX
+AIO_PRIO_DELTA_MAX, _SC_AIO_PRIO_DELTA_MAX
+ARG_MAX, _SC_ARG_MAX
+ATEXIT_MAX, _SC_ATEXIT_MAX
+BC_BASE_MAX, _SC_BC_BASE_MAX
+BC_DIM_MAX, _SC_BC_DIM_MAX
+BC_SCALE_MAX, _SC_BC_SCALE_MAX
+BC_STRING_MAX, _SC_BC_STRING_MAX
+CHILD_MAX, _SC_CHILD_MAX
+CLK_TCK, _SC_CLK_TCK
+COLL_WEIGHTS_MAX, _SC_COLL_WEIGHTS_MAX
+DELAYTIMER_MAX, _SC_DELAYTIMER_MAX
+EXPR_NEST_MAX, _SC_EXPR_NEST_MAX
+GETGR_R_SIZE_MAX, _SC_GETGR_R_SIZE_MAX
+GETPW_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX
+HOST_NAME_MAX, _SC_HOST_NAME_MAX
+IOV_MAX, _SC_IOV_MAX
+LINE_MAX, _SC_LINE_MAX
+LOGIN_NAME_MAX, _SC_LOGIN_NAME_MAX
+MQ_OPEN_MAX, _SC_MQ_OPEN_MAX
+MQ_PRIO_MAX, _SC_MQ_PRIO_MAX
+NGROUPS_MAX, _SC_NGROUPS_MAX
+NPROCESSORS_CONF, _SC_NPROCESSORS_CONF
+NPROCESSORS_ONLN, _SC_NPROCESSORS_ONLN
+OPEN_MAX, _SC_OPEN_MAX
+PAGESIZE, _SC_PAGESIZE
+PAGE_SIZE, _SC_PAGESIZE
+PASS_MAX, _SC_PASS_MAX
+PTHREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_DESTRUCTOR_ITERATIONS
+PTHREAD_KEYS_MAX, _SC_THREAD_KEYS_MAX
+PTHREAD_STACK_MIN, _SC_THREAD_STACK_MIN
+PTHREAD_THREADS_MAX, _SC_THREAD_THREADS_MAX
+RE_DUP_MAX, _SC_RE_DUP_MAX
+RTSIG_MAX, _SC_RTSIG_MAX
+SEM_NSEMS_MAX, _SC_SEM_NSEMS_MAX
+SEM_VALUE_MAX, _SC_SEM_VALUE_MAX
+SIGQUEUE_MAX, _SC_SIGQUEUE_MAX
+STREAM_MAX, _SC_STREAM_MAX
+SYMLOOP_MAX, _SC_SYMLOOP_MAX
+TIMER_MAX, _SC_TIMER_MAX
+TTY_NAME_MAX, _SC_TTY_NAME_MAX
+TZNAME_MAX, _SC_TZNAME_MAX
+_POSIX2_CHAR_TERM, _SC_2_CHAR_TERM
+_POSIX2_C_BIND, _SC_2_C_BIND
+_POSIX2_C_DEV, _SC_2_C_DEV
+_POSIX2_C_VERSION, _SC_2_C_VERSION
+_POSIX2_FORT_DEV, _SC_2_FORT_DEV
+_POSIX2_FORT_RUN, _SC_2_FORT_RUN
+_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF
+_POSIX2_SW_DEV, _SC_2_SW_DEV
+_POSIX2_UPE, _SC_2_UPE
+_POSIX2_VERSION, _SC_2_VERSION
+_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO
+_POSIX_BARRIERS, _SC_BARRIERS
+_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION
+_POSIX_CPUTIME, _SC_CPUTIME
+_POSIX_FILE_LOCKING, _SC_FILE_LOCKING
+_POSIX_FSYNC, _SC_FSYNC
+_POSIX_IPV6, _SC_IPV6
+_POSIX_JOB_CONTROL, _SC_JOB_CONTROL
+_POSIX_MAPPED_FILES, _SC_MAPPED_FILES
+_POSIX_MEMLOCK, _SC_MEMLOCK
+_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE
+_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION
+_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING
+_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK
+_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO
+_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING
+_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS
+_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS
+_POSIX_REGEXP, _SC_REGEXP
+_POSIX_SAVED_IDS, _SC_SAVED_IDS
+_POSIX_SEMAPHORES, _SC_SEMAPHORES
+_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS
+_POSIX_SHELL, _SC_SHELL
+_POSIX_SPAWN, _SC_SPAWN
+_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS
+_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER
+_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO
+_POSIX_THREADS, _SC_THREADS
+_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR
+_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE
+_POSIX_THREAD_CPUTIME, _SC_THREAD_CPUTIME
+_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING
+_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT
+_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT
+_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED
+_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS
+_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER
+_POSIX_TIMEOUTS, _SC_TIMEOUTS
+_POSIX_TRACE, _SC_TRACE
+_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER
+_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT
+_POSIX_TRACE_LOG, _SC_TRACE_LOG
+_POSIX_TIMERS, _SC_TIMERS
+_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS
+_POSIX_VERSION, _SC_VERSION
+_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32
+_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG
+_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64
+_POSIX_V6_LPBIG_OFFBIG, _SC_V6_LPBIG_OFFBIG
+_XOPEN_CRYPT, _SC_XOPEN_CRYPT
+_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N
+_XOPEN_LEGACY, _SC_XOPEN_LEGACY
+_XOPEN_REALTIME, _SC_XOPEN_REALTIME
+_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS
+_XOPEN_SHM, _SC_XOPEN_SHM
+_XOPEN_UNIX, _SC_XOPEN_UNIX
+_XOPEN_VERSION, _SC_XOPEN_VERSION
+_XOPEN_XCU_VERSION, _SC_XCU_VERSION
+%%
+int
+find_sysconf(const char *name, int *key)
+{
+ const struct map *rv;
+
+ rv = in_word_set(name);
+ if (rv != NULL) {
+ if (rv->valid) {
+ *key = rv->key;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
diff --git a/usr.bin/getent/Makefile b/usr.bin/getent/Makefile
new file mode 100644
index 0000000..85bc1b1
--- /dev/null
+++ b/usr.bin/getent/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= getent
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/getent/Makefile.depend b/usr.bin/getent/Makefile.depend
new file mode 100644
index 0000000..1eb0f33
--- /dev/null
+++ b/usr.bin/getent/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ 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/getent/getent.1 b/usr.bin/getent/getent.1
new file mode 100644
index 0000000..a77a180
--- /dev/null
+++ b/usr.bin/getent/getent.1
@@ -0,0 +1,129 @@
+.\" $NetBSD: getent.1,v 1.13 2005/09/11 23:16:15 wiz Exp $
+.\"
+.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 4, 2016
+.Dt GETENT 1
+.Os
+.Sh NAME
+.Nm getent
+.Nd get entries from administrative database
+.Sh SYNOPSIS
+.Nm
+.Ar database
+.Op Ar key ...
+.Sh DESCRIPTION
+The
+.Nm
+utility retrieves and displays entries from the administrative
+database specified by
+.Ar database ,
+using the lookup order specified in
+.Xr nsswitch.conf 5 .
+The display format for a given
+.Ar database
+is as per the
+.Dq traditional
+file format for that database.
+.Pp
+The
+.Ar database
+argument may be one of:
+.Pp
+.Bl -column ".Li netgroup" -offset indent -compact
+.Sy Database Ta Sy Display format
+.It Li ethers Ta address name
+.It Li group Ta group:passwd:gid:[member[,member]...]
+.It Li hosts Ta address name [alias ...]
+.It Li netgroup Ta (host,user,domain) [...]
+.It Li networks Ta name network [alias ...]
+.It Li passwd Ta user:passwd:uid:gid:gecos:home_dir:shell
+.It Li protocols Ta name protocol [alias ...]
+.It Li rpc Ta name number [alias ...]
+.It Li services Ta name port/protocol [alias ...]
+.It Li shells Ta /path/to/shell
+.It Li utmpx Ta [time] type: properties
+.El
+.Pp
+If one or more
+.Ar key
+arguments are provided, they will be looked up in
+.Ar database
+using the appropriate function.
+For example,
+.Dq Li passwd
+supports a numeric UID or user name;
+.Dq Li hosts
+supports an IPv4 address, IPv6 address, or host name;
+and
+.Dq Li services
+supports a service name, service name/protocol name, numeric port, or
+numeric port/protocol name.
+.Pp
+If no
+.Ar key
+is provided and
+.Ar database
+supports enumeration, all entries for
+.Ar database
+will be retrieved using the appropriate enumeration function and printed.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 on success,
+1 if there was an error in the command syntax,
+2 if one of the specified key names was not found in
+.Ar database ,
+or 3 if there is no support for enumeration on
+.Ar database .
+.Sh SEE ALSO
+.Xr getutxent 3 ,
+.Xr ethers 5 ,
+.Xr group 5 ,
+.Xr hosts 5 ,
+.Xr netgroup 5 ,
+.Xr networks 5 ,
+.Xr nsswitch.conf 5 ,
+.Xr passwd 5 ,
+.Xr protocols 5 ,
+.Xr rpc 5 ,
+.Xr services 5 ,
+.Xr shells 5
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.Nx 3.0 ,
+and was imported into
+.Fx 7.0 .
+It was based on the command of the same name in
+.Tn Solaris
+and
+.Tn Linux .
diff --git a/usr.bin/getent/getent.c b/usr.bin/getent/getent.c
new file mode 100644
index 0000000..977f147
--- /dev/null
+++ b/usr.bin/getent/getent.c
@@ -0,0 +1,715 @@
+/* $NetBSD: getent.c,v 1.7 2005/08/24 14:31:02 ginsbach Exp $ */
+
+/*-
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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/socket.h>
+#include <sys/param.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <net/if.h>
+#include <netinet/if_ether.h>
+#include <netinet/in.h> /* for INET6_ADDRSTRLEN */
+#include <rpc/rpcent.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <grp.h>
+#include <limits.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+
+static int usage(void);
+static int parsenum(const char *, unsigned long *);
+static int ethers(int, char *[]);
+static int group(int, char *[]);
+static int hosts(int, char *[]);
+static int netgroup(int, char *[]);
+static int networks(int, char *[]);
+static int passwd(int, char *[]);
+static int protocols(int, char *[]);
+static int rpc(int, char *[]);
+static int services(int, char *[]);
+static int shells(int, char *[]);
+static int utmpx(int, char *[]);
+
+enum {
+ RV_OK = 0,
+ RV_USAGE = 1,
+ RV_NOTFOUND = 2,
+ RV_NOENUM = 3
+};
+
+static struct getentdb {
+ const char *name;
+ int (*callback)(int, char *[]);
+} databases[] = {
+ { "ethers", ethers, },
+ { "group", group, },
+ { "hosts", hosts, },
+ { "netgroup", netgroup, },
+ { "networks", networks, },
+ { "passwd", passwd, },
+ { "protocols", protocols, },
+ { "rpc", rpc, },
+ { "services", services, },
+ { "shells", shells, },
+ { "utmpx", utmpx, },
+
+ { NULL, NULL, },
+};
+
+int
+main(int argc, char *argv[])
+{
+ struct getentdb *curdb;
+
+ setprogname(argv[0]);
+
+ if (argc < 2)
+ usage();
+ for (curdb = databases; curdb->name != NULL; curdb++) {
+ if (strcmp(curdb->name, argv[1]) == 0) {
+ exit(curdb->callback(argc, argv));
+ }
+ }
+ fprintf(stderr, "Unknown database: %s\n", argv[1]);
+ usage();
+ /* NOTREACHED */
+ return RV_USAGE;
+}
+
+static int
+usage(void)
+{
+ struct getentdb *curdb;
+
+ fprintf(stderr, "Usage: %s database [key ...]\n",
+ getprogname());
+ fprintf(stderr, " database may be one of:\n\t");
+ for (curdb = databases; curdb->name != NULL; curdb++) {
+ fprintf(stderr, " %s", curdb->name);
+ }
+ fprintf(stderr, "\n");
+ exit(RV_USAGE);
+ /* NOTREACHED */
+}
+
+static int
+parsenum(const char *word, unsigned long *result)
+{
+ unsigned long num;
+ char *ep;
+
+ assert(word != NULL);
+ assert(result != NULL);
+
+ if (!isdigit((unsigned char)word[0]))
+ return 0;
+ errno = 0;
+ num = strtoul(word, &ep, 10);
+ if (num == ULONG_MAX && errno == ERANGE)
+ return 0;
+ if (*ep != '\0')
+ return 0;
+ *result = num;
+ return 1;
+}
+
+/*
+ * printfmtstrings --
+ * vprintf(format, ...),
+ * then the aliases (beginning with prefix, separated by sep),
+ * then a newline
+ */
+static void
+printfmtstrings(char *strings[], const char *prefix, const char *sep,
+ const char *fmt, ...)
+{
+ va_list ap;
+ const char *curpref;
+ int i;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+
+ curpref = prefix;
+ for (i = 0; strings[i] != NULL; i++) {
+ printf("%s%s", curpref, strings[i]);
+ curpref = sep;
+ }
+ printf("\n");
+ va_end(ap);
+}
+
+/*
+ * ethers
+ */
+static int
+ethers(int argc, char *argv[])
+{
+ char hostname[MAXHOSTNAMELEN + 1], *hp;
+ struct ether_addr ea, *eap;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define ETHERSPRINT printf("%-17s %s\n", ether_ntoa(eap), hp)
+
+ rv = RV_OK;
+ if (argc == 2) {
+ fprintf(stderr, "Enumeration not supported on ethers\n");
+ rv = RV_NOENUM;
+ } else {
+ for (i = 2; i < argc; i++) {
+ if ((eap = ether_aton(argv[i])) == NULL) {
+ eap = &ea;
+ hp = argv[i];
+ if (ether_hostton(hp, eap) != 0) {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ } else {
+ hp = hostname;
+ if (ether_ntohost(hp, eap) != 0) {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ ETHERSPRINT;
+ }
+ }
+ return rv;
+}
+
+/*
+ * group
+ */
+
+static int
+group(int argc, char *argv[])
+{
+ struct group *gr;
+ unsigned long id;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define GROUPPRINT printfmtstrings(gr->gr_mem, ":", ",", "%s:%s:%u", \
+ gr->gr_name, gr->gr_passwd, gr->gr_gid)
+
+ setgroupent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((gr = getgrent()) != NULL)
+ GROUPPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (parsenum(argv[i], &id))
+ gr = getgrgid((gid_t)id);
+ else
+ gr = getgrnam(argv[i]);
+ if (gr != NULL)
+ GROUPPRINT;
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endgrent();
+ return rv;
+}
+
+
+/*
+ * hosts
+ */
+
+static void
+hostsprint(const struct hostent *he)
+{
+ char buf[INET6_ADDRSTRLEN];
+
+ assert(he != NULL);
+ if (inet_ntop(he->h_addrtype, he->h_addr, buf, sizeof(buf)) == NULL)
+ strlcpy(buf, "# unknown", sizeof(buf));
+ printfmtstrings(he->h_aliases, " ", " ", "%-16s %s", buf, he->h_name);
+}
+
+static int
+hosts(int argc, char *argv[])
+{
+ struct hostent *he4, *he6;
+ char addr[IN6ADDRSZ];
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+ sethostent(1);
+ he4 = he6 = NULL;
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((he4 = gethostent()) != NULL)
+ hostsprint(he4);
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0) {
+ he6 = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
+ if (he6 != NULL)
+ hostsprint(he6);
+ } else if (inet_pton(AF_INET, argv[i],
+ (void *)addr) > 0) {
+ he4 = gethostbyaddr(addr, INADDRSZ, AF_INET);
+ if (he4 != NULL)
+ hostsprint(he4);
+ } else {
+ he6 = gethostbyname2(argv[i], AF_INET6);
+ if (he6 != NULL)
+ hostsprint(he6);
+ he4 = gethostbyname(argv[i]);
+ if (he4 != NULL)
+ hostsprint(he4);
+ }
+ if ( he4 == NULL && he6 == NULL ) {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endhostent();
+ return rv;
+}
+
+/*
+ * networks
+ */
+static void
+networksprint(const struct netent *ne)
+{
+ char buf[INET6_ADDRSTRLEN];
+ struct in_addr ianet;
+
+ assert(ne != NULL);
+ ianet = inet_makeaddr(ne->n_net, 0);
+ if (inet_ntop(ne->n_addrtype, &ianet, buf, sizeof(buf)) == NULL)
+ strlcpy(buf, "# unknown", sizeof(buf));
+ printfmtstrings(ne->n_aliases, " ", " ", "%-16s %s", ne->n_name, buf);
+}
+
+static int
+networks(int argc, char *argv[])
+{
+ struct netent *ne;
+ in_addr_t net;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+ setnetent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((ne = getnetent()) != NULL)
+ networksprint(ne);
+ } else {
+ for (i = 2; i < argc; i++) {
+ net = inet_network(argv[i]);
+ if (net != INADDR_NONE)
+ ne = getnetbyaddr(net, AF_INET);
+ else
+ ne = getnetbyname(argv[i]);
+ if (ne != NULL)
+ networksprint(ne);
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endnetent();
+ return rv;
+}
+
+/*
+ * passwd
+ */
+static int
+passwd(int argc, char *argv[])
+{
+ struct passwd *pw;
+ unsigned long id;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define PASSWDPRINT printf("%s:%s:%u:%u:%s:%s:%s\n", \
+ pw->pw_name, pw->pw_passwd, pw->pw_uid, \
+ pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell)
+
+ setpassent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((pw = getpwent()) != NULL)
+ PASSWDPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (parsenum(argv[i], &id))
+ pw = getpwuid((uid_t)id);
+ else
+ pw = getpwnam(argv[i]);
+ if (pw != NULL)
+ PASSWDPRINT;
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endpwent();
+ return rv;
+}
+
+/*
+ * protocols
+ */
+static int
+protocols(int argc, char *argv[])
+{
+ struct protoent *pe;
+ unsigned long id;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define PROTOCOLSPRINT printfmtstrings(pe->p_aliases, " ", " ", \
+ "%-16s %5d", pe->p_name, pe->p_proto)
+
+ setprotoent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((pe = getprotoent()) != NULL)
+ PROTOCOLSPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (parsenum(argv[i], &id))
+ pe = getprotobynumber((int)id);
+ else
+ pe = getprotobyname(argv[i]);
+ if (pe != NULL)
+ PROTOCOLSPRINT;
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endprotoent();
+ return rv;
+}
+
+/*
+ * rpc
+ */
+static int
+rpc(int argc, char *argv[])
+{
+ struct rpcent *re;
+ unsigned long id;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define RPCPRINT printfmtstrings(re->r_aliases, " ", " ", \
+ "%-16s %6d", \
+ re->r_name, re->r_number)
+
+ setrpcent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((re = getrpcent()) != NULL)
+ RPCPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (parsenum(argv[i], &id))
+ re = getrpcbynumber((int)id);
+ else
+ re = getrpcbyname(argv[i]);
+ if (re != NULL)
+ RPCPRINT;
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endrpcent();
+ return rv;
+}
+
+/*
+ * services
+ */
+static int
+services(int argc, char *argv[])
+{
+ struct servent *se;
+ unsigned long id;
+ char *proto;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define SERVICESPRINT printfmtstrings(se->s_aliases, " ", " ", \
+ "%-16s %5d/%s", \
+ se->s_name, ntohs(se->s_port), se->s_proto)
+
+ setservent(1);
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((se = getservent()) != NULL)
+ SERVICESPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ proto = strchr(argv[i], '/');
+ if (proto != NULL)
+ *proto++ = '\0';
+ if (parsenum(argv[i], &id))
+ se = getservbyport(htons((u_short)id), proto);
+ else
+ se = getservbyname(argv[i], proto);
+ if (se != NULL)
+ SERVICESPRINT;
+ else {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endservent();
+ return rv;
+}
+
+/*
+ * shells
+ */
+static int
+shells(int argc, char *argv[])
+{
+ const char *sh;
+ int i, rv;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define SHELLSPRINT printf("%s\n", sh)
+
+ setusershell();
+ rv = RV_OK;
+ if (argc == 2) {
+ while ((sh = getusershell()) != NULL)
+ SHELLSPRINT;
+ } else {
+ for (i = 2; i < argc; i++) {
+ setusershell();
+ while ((sh = getusershell()) != NULL) {
+ if (strcmp(sh, argv[i]) == 0) {
+ SHELLSPRINT;
+ break;
+ }
+ }
+ if (sh == NULL) {
+ rv = RV_NOTFOUND;
+ break;
+ }
+ }
+ }
+ endusershell();
+ return rv;
+}
+
+/*
+ * netgroup
+ */
+static int
+netgroup(int argc, char *argv[])
+{
+ char *host, *user, *domain;
+ int first;
+ int rv, i;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+#define NETGROUPPRINT(s) (((s) != NULL) ? (s) : "")
+
+ rv = RV_OK;
+ if (argc == 2) {
+ fprintf(stderr, "Enumeration not supported on netgroup\n");
+ rv = RV_NOENUM;
+ } else {
+ for (i = 2; i < argc; i++) {
+ setnetgrent(argv[i]);
+ first = 1;
+ while (getnetgrent(&host, &user, &domain) != 0) {
+ if (first) {
+ first = 0;
+ (void)fputs(argv[i], stdout);
+ }
+ (void)printf(" (%s,%s,%s)",
+ NETGROUPPRINT(host),
+ NETGROUPPRINT(user),
+ NETGROUPPRINT(domain));
+ }
+ if (!first)
+ (void)putchar('\n');
+ endnetgrent();
+ }
+ }
+ return rv;
+}
+
+/*
+ * utmpx
+ */
+
+#define UTMPXPRINTID do { \
+ size_t i; \
+ for (i = 0; i < sizeof ut->ut_id; i++) \
+ printf("%02hhx", ut->ut_id[i]); \
+} while (0)
+
+static void
+utmpxprint(const struct utmpx *ut)
+{
+
+ if (ut->ut_type == EMPTY)
+ return;
+
+ printf("[%jd.%06u -- %.24s] ",
+ (intmax_t)ut->ut_tv.tv_sec, (unsigned int)ut->ut_tv.tv_usec,
+ ctime(&ut->ut_tv.tv_sec));
+
+ switch (ut->ut_type) {
+ case BOOT_TIME:
+ printf("system boot\n");
+ return;
+ case SHUTDOWN_TIME:
+ printf("system shutdown\n");
+ return;
+ case OLD_TIME:
+ printf("old system time\n");
+ return;
+ case NEW_TIME:
+ printf("new system time\n");
+ return;
+ case USER_PROCESS:
+ printf("user process: id=\"");
+ UTMPXPRINTID;
+ printf("\" pid=\"%d\" user=\"%s\" line=\"%s\" host=\"%s\"\n",
+ ut->ut_pid, ut->ut_user, ut->ut_line, ut->ut_host);
+ break;
+ case INIT_PROCESS:
+ printf("init process: id=\"");
+ UTMPXPRINTID;
+ printf("\" pid=\"%d\"\n", ut->ut_pid);
+ break;
+ case LOGIN_PROCESS:
+ printf("login process: id=\"");
+ UTMPXPRINTID;
+ printf("\" pid=\"%d\" user=\"%s\" line=\"%s\" host=\"%s\"\n",
+ ut->ut_pid, ut->ut_user, ut->ut_line, ut->ut_host);
+ break;
+ case DEAD_PROCESS:
+ printf("dead process: id=\"");
+ UTMPXPRINTID;
+ printf("\" pid=\"%d\"\n", ut->ut_pid);
+ break;
+ default:
+ printf("unknown record type %hu\n", ut->ut_type);
+ break;
+ }
+}
+
+static int
+utmpx(int argc, char *argv[])
+{
+ const struct utmpx *ut;
+ const char *file = NULL;
+ int rv = RV_OK, db = 0;
+
+ assert(argc > 1);
+ assert(argv != NULL);
+
+ if (argc == 3 || argc == 4) {
+ if (strcmp(argv[2], "active") == 0)
+ db = UTXDB_ACTIVE;
+ else if (strcmp(argv[2], "lastlogin") == 0)
+ db = UTXDB_LASTLOGIN;
+ else if (strcmp(argv[2], "log") == 0)
+ db = UTXDB_LOG;
+ else
+ rv = RV_USAGE;
+ if (argc == 4)
+ file = argv[3];
+ } else {
+ rv = RV_USAGE;
+ }
+
+ if (rv == RV_USAGE) {
+ fprintf(stderr,
+ "Usage: %s utmpx active | lastlogin | log [filename]\n",
+ getprogname());
+ } else if (rv == RV_OK) {
+ if (setutxdb(db, file) != 0)
+ return (RV_NOTFOUND);
+ while ((ut = getutxent()) != NULL)
+ utmpxprint(ut);
+ endutxent();
+ }
+ return (rv);
+}
diff --git a/usr.bin/getopt/Makefile b/usr.bin/getopt/Makefile
new file mode 100644
index 0000000..01dfa87
--- /dev/null
+++ b/usr.bin/getopt/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+#
+
+PROG = getopt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/getopt/Makefile.depend b/usr.bin/getopt/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/getopt/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/getopt/getopt.1 b/usr.bin/getopt/getopt.1
new file mode 100644
index 0000000..781b6e0
--- /dev/null
+++ b/usr.bin/getopt/getopt.1
@@ -0,0 +1,134 @@
+.\" $FreeBSD$
+.\"
+.Dd August 1, 2015
+.Dt GETOPT 1
+.Os
+.Sh NAME
+.Nm getopt
+.Nd parse command options
+.Sh SYNOPSIS
+.Nm args=\`getopt Ar optstring $*\`
+; errcode=$?; set \-\- $args
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to break up options in command lines for easy parsing by
+shell procedures, and to check for legal options.
+.Ar Optstring
+is a string of recognized option letters (see
+.Xr getopt 3 ) ;
+if a letter is followed by a colon, the option
+is expected to have an argument which may or may not be
+separated from it by white space.
+The special option
+.Ql \-\-
+is used to delimit the end of the options.
+The
+.Nm
+utility will place
+.Ql \-\-
+in the arguments at the end of the options,
+or recognize it if used explicitly.
+The shell arguments
+(\fB$1 $2\fR ...) are reset so that each option is
+preceded by a
+.Ql \-
+and in its own shell argument;
+each option argument is also in its own shell argument.
+.Sh EXIT STATUS
+The
+.Nm
+utility prints an error message on the standard error output and exits with
+status > 0 when it encounters an option letter not included in
+.Ar optstring .
+.Sh EXAMPLES
+The following code fragment shows how one might process the arguments
+for a command that can take the options
+.Fl a
+and
+.Fl b ,
+and the option
+.Fl o ,
+which requires an argument.
+.Bd -literal -offset indent
+args=\`getopt abo: $*\`
+# you should not use \`getopt abo: "$@"\` since that would parse
+# the arguments differently from what the set command below does.
+if [ $? -ne 0 ]; then
+ echo 'Usage: ...'
+ exit 2
+fi
+set \-\- $args
+# You cannot use the set command with a backquoted getopt directly,
+# since the exit code from getopt would be shadowed by those of set,
+# which is zero by definition.
+while :; do
+ case "$1" in
+ \-a|\-b)
+ echo "flag $1 set"; sflags="${1#-}$sflags"
+ shift
+ ;;
+ \-o)
+ echo "oarg is '$2'"; oarg="$2"
+ shift; shift
+ ;;
+ \-\-)
+ shift; break
+ ;;
+ esac
+done
+echo "single-char flags: '$sflags'"
+echo "oarg is '$oarg'"
+.Ed
+.Pp
+This code will accept any of the following as equivalent:
+.Bd -literal -offset indent
+cmd \-aoarg file1 file2
+cmd \-a \-o arg file1 file2
+cmd \-oarg -a file1 file2
+cmd \-a \-oarg \-\- file1 file2
+.Ed
+.Sh SEE ALSO
+.Xr getopts 1 ,
+.Xr sh 1 ,
+.Xr getopt 3
+.Sh HISTORY
+Written by
+.An Henry Spencer ,
+working from a Bell Labs manual page.
+Behavior believed identical to the Bell version.
+Example changed in
+.Fx
+version 3.2 and 4.0.
+.Sh BUGS
+Whatever
+.Xr getopt 3
+has.
+.Pp
+Arguments containing white space or embedded shell metacharacters
+generally will not survive intact; this looks easy to fix but
+is not.
+People trying to fix
+.Nm
+or the example in this manpage should check the history of this file
+in
+.Fx .
+.Pp
+The error message for an invalid option is identified as coming
+from
+.Nm
+rather than from the shell procedure containing the invocation
+of
+.Nm ;
+this again is hard to fix.
+.Pp
+The precise best way to use the
+.Nm set
+command to set the arguments without disrupting the value(s) of
+shell options varies from one shell version to another.
+.Pp
+Each shellscript has to carry complex code to parse arguments halfway
+correctly (like the example presented here).
+A better getopt-like tool
+would move much of the complexity into the tool and keep the client
+shell scripts simpler.
diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c
new file mode 100644
index 0000000..d1671a7
--- /dev/null
+++ b/usr.bin/getopt/getopt.c
@@ -0,0 +1,37 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * This material, written by Henry Spencer, was released by him
+ * into the public domain and is thus not subject to any copyright.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ int status = 0;
+
+ optind = 2; /* Past the program name and the option letters. */
+ while ((c = getopt(argc, argv, argv[1])) != -1)
+ switch (c) {
+ case '?':
+ status = 1; /* getopt routine gave message */
+ break;
+ default:
+ if (optarg != NULL)
+ printf(" -%c %s", c, optarg);
+ else
+ printf(" -%c", c);
+ break;
+ }
+ printf(" --");
+ for (; optind < argc; optind++)
+ printf(" %s", argv[optind]);
+ printf("\n");
+ return status;
+}
diff --git a/usr.bin/gprof/Makefile b/usr.bin/gprof/Makefile
new file mode 100644
index 0000000..5062325
--- /dev/null
+++ b/usr.bin/gprof/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/29/93
+# $FreeBSD$
+
+PROG= gprof
+SRCS= gprof.c aout.c arcs.c dfn.c elf.c lookup.c hertz.c \
+ printgprof.c printlist.c kernel.c
+FILES= gprof.flat gprof.callg
+FILESDIR= ${SHAREDIR}/misc
+
+WARNS?= 1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/gprof/Makefile.depend b/usr.bin/gprof/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/gprof/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/gprof/amd64.h b/usr.bin/gprof/amd64.h
new file mode 100644
index 0000000..58b92c5
--- /dev/null
+++ b/usr.bin/gprof/amd64.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)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
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/gprof/aout.c b/usr.bin/gprof/aout.c
new file mode 100644
index 0000000..7907d46
--- /dev/null
+++ b/usr.bin/gprof/aout.c
@@ -0,0 +1,229 @@
+/*-
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+/* From: */
+#ifndef lint
+static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <netinet/in.h>
+
+#include <a.out.h>
+#include <err.h>
+#include <string.h>
+
+#include "gprof.h"
+
+static void getstrtab(FILE *, const char *);
+static void getsymtab(FILE *, const char *);
+static void gettextspace(FILE *);
+static bool funcsymbol(struct nlist *);
+
+static char *strtab; /* string table in core */
+static long ssiz; /* size of the string table */
+static struct exec xbuf; /* exec header of a.out */
+
+/* Things which get -E excluded by default. */
+static char *excludes[] = { "mcount", "__mcleanup", NULL };
+
+ /*
+ * Set up string and symbol tables from a.out.
+ * and optionally the text space.
+ * On return symbol table is sorted by value.
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+int
+aout_getnfile(const char *filename, char ***defaultEs)
+{
+ FILE *nfile;
+
+ nfile = fopen( filename ,"r");
+ if (nfile == NULL)
+ err( 1 , "%s", filename );
+ fread(&xbuf, 1, sizeof(xbuf), nfile);
+ if (N_BADMAG(xbuf)) {
+ fclose(nfile);
+ return -1;
+ }
+ getstrtab(nfile, filename);
+ getsymtab(nfile, filename);
+ gettextspace( nfile );
+ fclose(nfile);
+# ifdef DEBUG
+ if ( debug & AOUTDEBUG ) {
+ register int j;
+
+ for (j = 0; j < nname; j++){
+ printf("[getnfile] 0X%08lx\t%s\n", nl[j].value, nl[j].name);
+ }
+ }
+# endif /* DEBUG */
+ *defaultEs = excludes;
+ return 0;
+}
+
+static void
+getstrtab(FILE *nfile, const char *filename)
+{
+
+ fseek(nfile, (long)(N_SYMOFF(xbuf) + xbuf.a_syms), 0);
+ if (fread(&ssiz, sizeof (ssiz), 1, nfile) == 0)
+ errx( 1 , "%s: no string table (old format?)" , filename );
+ strtab = calloc(ssiz, 1);
+ if (strtab == NULL)
+ errx( 1 , "%s: no room for %ld bytes of string table", filename , ssiz);
+ if (fread(strtab+sizeof(ssiz), ssiz-sizeof(ssiz), 1, nfile) != 1)
+ errx( 1 , "%s: error reading string table" , filename );
+}
+
+ /*
+ * Read in symbol table
+ */
+static void
+getsymtab(FILE *nfile, const char *filename)
+{
+ register long i;
+ int askfor;
+ struct nlist nbuf;
+
+ /* pass1 - count symbols */
+ fseek(nfile, (long)N_SYMOFF(xbuf), 0);
+ nname = 0;
+ for (i = xbuf.a_syms; i > 0; i -= sizeof(struct nlist)) {
+ fread(&nbuf, sizeof(nbuf), 1, nfile);
+ if ( ! funcsymbol( &nbuf ) ) {
+ continue;
+ }
+ nname++;
+ }
+ if (nname == 0)
+ errx( 1 , "%s: no symbols" , filename );
+ askfor = nname + 1;
+ nl = (nltype *) calloc( askfor , sizeof(nltype) );
+ if (nl == NULL)
+ errx( 1 , "no room for %zu bytes of symbol table" ,
+ askfor * sizeof(nltype) );
+
+ /* pass2 - read symbols */
+ fseek(nfile, (long)N_SYMOFF(xbuf), 0);
+ npe = nl;
+ nname = 0;
+ for (i = xbuf.a_syms; i > 0; i -= sizeof(struct nlist)) {
+ fread(&nbuf, sizeof(nbuf), 1, nfile);
+ if ( ! funcsymbol( &nbuf ) ) {
+# ifdef DEBUG
+ if ( debug & AOUTDEBUG ) {
+ printf( "[getsymtab] rejecting: 0x%x %s\n" ,
+ nbuf.n_type , strtab + nbuf.n_un.n_strx );
+ }
+# endif /* DEBUG */
+ continue;
+ }
+ npe->value = nbuf.n_value;
+ npe->name = strtab+nbuf.n_un.n_strx;
+# ifdef DEBUG
+ if ( debug & AOUTDEBUG ) {
+ printf( "[getsymtab] %d %s 0x%08lx\n" ,
+ nname , npe -> name , npe -> value );
+ }
+# endif /* DEBUG */
+ npe++;
+ nname++;
+ }
+ npe->value = -1;
+}
+
+ /*
+ * read in the text space of an a.out file
+ */
+static void
+gettextspace(FILE *nfile)
+{
+
+ textspace = (u_char *) malloc( xbuf.a_text );
+ if ( textspace == NULL ) {
+ warnx("no room for %u bytes of text space: can't do -c" ,
+ xbuf.a_text );
+ return;
+ }
+ (void) fseek( nfile , N_TXTOFF( xbuf ) , 0 );
+ if ( fread( textspace , 1 , xbuf.a_text , nfile ) != xbuf.a_text ) {
+ warnx("couldn't read text space: can't do -c");
+ free( textspace );
+ textspace = 0;
+ return;
+ }
+}
+
+static bool
+funcsymbol(struct nlist *nlistp)
+{
+ char *name, c;
+
+ /*
+ * must be a text symbol,
+ * and static text symbols don't qualify if aflag set.
+ */
+ if ( ! ( ( nlistp -> n_type == ( N_TEXT | N_EXT ) )
+ || ( ( nlistp -> n_type == N_TEXT ) && ( aflag == 0 ) ) ) ) {
+ return FALSE;
+ }
+ /*
+ * name must start with an underscore if uflag is set.
+ * can't have any `funny' characters in name,
+ * where `funny' means `.' (.o file names)
+ * need to make an exception for sparc .mul & co.
+ * perhaps we should just drop this code entirely...
+ */
+ name = strtab + nlistp -> n_un.n_strx;
+ if ( uflag && *name != '_' )
+ return FALSE;
+#ifdef sparc
+ if ( *name == '.' ) {
+ char *p = name + 1;
+ if ( *p == 'u' )
+ p++;
+ if ( strcmp ( p, "mul" ) == 0 || strcmp ( p, "div" ) == 0 ||
+ strcmp ( p, "rem" ) == 0 )
+ return TRUE;
+ }
+#endif
+ while ( (c = *name++) ) {
+ if ( c == '.' ) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
diff --git a/usr.bin/gprof/arcs.c b/usr.bin/gprof/arcs.c
new file mode 100644
index 0000000..4bea6c6
--- /dev/null
+++ b/usr.bin/gprof/arcs.c
@@ -0,0 +1,953 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)arcs.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include "gprof.h"
+
+#ifdef DEBUG
+int visited;
+int viable;
+int newcycle;
+int oldcycle;
+#endif /* DEBUG */
+
+int topcmp(const void *, const void *);
+
+ /*
+ * add (or just increment) an arc
+ */
+void
+addarc(nltype *parentp, nltype *childp, long count)
+{
+ arctype *arcp;
+
+# ifdef DEBUG
+ if ( debug & TALLYDEBUG ) {
+ printf( "[addarc] %ld arcs from %s to %s\n" ,
+ count , parentp -> name , childp -> name );
+ }
+# endif /* DEBUG */
+ arcp = arclookup( parentp , childp );
+ if ( arcp != 0 ) {
+ /*
+ * a hit: just increment the count.
+ */
+# ifdef DEBUG
+ if ( debug & TALLYDEBUG ) {
+ printf( "[tally] hit %ld += %ld\n" ,
+ arcp -> arc_count , count );
+ }
+# endif /* DEBUG */
+ arcp -> arc_count += count;
+ return;
+ }
+ arcp = (arctype *)calloc( 1 , sizeof *arcp );
+ if (arcp == NULL)
+ errx( 1 , "malloc failed" );
+ arcp -> arc_parentp = parentp;
+ arcp -> arc_childp = childp;
+ arcp -> arc_count = count;
+ /*
+ * prepend this child to the children of this parent
+ */
+ arcp -> arc_childlist = parentp -> children;
+ parentp -> children = arcp;
+ /*
+ * prepend this parent to the parents of this child
+ */
+ arcp -> arc_parentlist = childp -> parents;
+ childp -> parents = arcp;
+}
+
+ /*
+ * the code below topologically sorts the graph (collapsing cycles),
+ * and propagates time bottom up and flags top down.
+ */
+
+ /*
+ * the topologically sorted name list pointers
+ */
+nltype **topsortnlp;
+
+int
+topcmp(const void *v1, const void *v2)
+{
+ const nltype **npp1 = (const nltype **)v1;
+ const nltype **npp2 = (const nltype **)v2;
+
+ return (*npp1) -> toporder - (*npp2) -> toporder;
+}
+
+nltype **
+doarcs(void)
+{
+ nltype *parentp, **timesortnlp;
+ arctype *arcp;
+ long index;
+ long pass;
+
+ /*
+ * initialize various things:
+ * zero out child times.
+ * count self-recursive calls.
+ * indicate that nothing is on cycles.
+ */
+ for ( parentp = nl ; parentp < npe ; parentp++ ) {
+ parentp -> childtime = 0.0;
+ arcp = arclookup( parentp , parentp );
+ if ( arcp != 0 ) {
+ parentp -> ncall -= arcp -> arc_count;
+ parentp -> selfcalls = arcp -> arc_count;
+ } else {
+ parentp -> selfcalls = 0;
+ }
+ parentp -> npropcall = parentp -> ncall;
+ parentp -> propfraction = 0.0;
+ parentp -> propself = 0.0;
+ parentp -> propchild = 0.0;
+ parentp -> printflag = FALSE;
+ parentp -> toporder = DFN_NAN;
+ parentp -> cycleno = 0;
+ parentp -> cyclehead = parentp;
+ parentp -> cnext = 0;
+ }
+ for ( pass = 1 ; ; pass++ ) {
+ /*
+ * topologically order things
+ * if any node is unnumbered,
+ * number it and any of its descendents.
+ */
+ for ( dfn_init() , parentp = nl ; parentp < npe ; parentp++ ) {
+ if ( parentp -> toporder == DFN_NAN ) {
+ dfn( parentp );
+ }
+ }
+ /*
+ * link together nodes on the same cycle
+ */
+ cyclelink();
+ /*
+ * if no cycles to break up, proceed
+ */
+ if ( ! Cflag )
+ break;
+ /*
+ * analyze cycles to determine breakup
+ */
+# ifdef DEBUG
+ if ( debug & BREAKCYCLE ) {
+ printf("[doarcs] pass %ld, cycle(s) %d\n" , pass , ncycle );
+ }
+# endif /* DEBUG */
+ if ( pass == 1 ) {
+ printf( "\n\n%s %s\n%s %d:\n" ,
+ "The following arcs were deleted" ,
+ "from the propagation calculation" ,
+ "to reduce the maximum cycle size to", cyclethreshold );
+ }
+ if ( cycleanalyze() )
+ break;
+ free ( cyclenl );
+ ncycle = 0;
+ for ( parentp = nl ; parentp < npe ; parentp++ ) {
+ parentp -> toporder = DFN_NAN;
+ parentp -> cycleno = 0;
+ parentp -> cyclehead = parentp;
+ parentp -> cnext = 0;
+ }
+ }
+ if ( pass > 1 ) {
+ printf( "\f\n" );
+ } else {
+ printf( "\tNone\n\n" );
+ }
+ /*
+ * Sort the symbol table in reverse topological order
+ */
+ topsortnlp = (nltype **) calloc( nname , sizeof(nltype *) );
+ if ( topsortnlp == (nltype **) 0 )
+ errx( 1 , "[doarcs] ran out of memory for topo sorting" );
+ for ( index = 0 ; index < nname ; index += 1 ) {
+ topsortnlp[ index ] = &nl[ index ];
+ }
+ qsort( topsortnlp , nname , sizeof(nltype *) , topcmp );
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[doarcs] topological sort listing\n" );
+ for ( index = 0 ; index < nname ; index += 1 ) {
+ printf( "[doarcs] " );
+ printf( "%d:" , topsortnlp[ index ] -> toporder );
+ printname( topsortnlp[ index ] );
+ printf( "\n" );
+ }
+ }
+# endif /* DEBUG */
+ /*
+ * starting from the topological top,
+ * propagate print flags to children.
+ * also, calculate propagation fractions.
+ * this happens before time propagation
+ * since time propagation uses the fractions.
+ */
+ doflags();
+ /*
+ * starting from the topological bottom,
+ * propagate children times up to parents.
+ */
+ dotime();
+ /*
+ * Now, sort by propself + propchild.
+ * sorting both the regular function names
+ * and cycle headers.
+ */
+ timesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) );
+ if ( timesortnlp == (nltype **) 0 )
+ errx( 1 , "ran out of memory for sorting" );
+ for ( index = 0 ; index < nname ; index++ ) {
+ timesortnlp[index] = &nl[index];
+ }
+ for ( index = 1 ; index <= ncycle ; index++ ) {
+ timesortnlp[nname+index-1] = &cyclenl[index];
+ }
+ qsort( timesortnlp , nname + ncycle , sizeof(nltype *) , totalcmp );
+ for ( index = 0 ; index < nname + ncycle ; index++ ) {
+ timesortnlp[ index ] -> index = index + 1;
+ }
+ return( timesortnlp );
+}
+
+void
+dotime(void)
+{
+ int index;
+
+ cycletime();
+ for ( index = 0 ; index < nname ; index += 1 ) {
+ timepropagate( topsortnlp[ index ] );
+ }
+}
+
+void
+timepropagate(nltype *parentp)
+{
+ arctype *arcp;
+ nltype *childp;
+ double share;
+ double propshare;
+
+ if ( parentp -> propfraction == 0.0 ) {
+ return;
+ }
+ /*
+ * gather time from children of this parent.
+ */
+ for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+ childp = arcp -> arc_childp;
+ if ( arcp -> arc_flags & DEADARC ) {
+ continue;
+ }
+ if ( arcp -> arc_count == 0 ) {
+ continue;
+ }
+ if ( childp == parentp ) {
+ continue;
+ }
+ if ( childp -> propfraction == 0.0 ) {
+ continue;
+ }
+ if ( childp -> cyclehead != childp ) {
+ if ( parentp -> cycleno == childp -> cycleno ) {
+ continue;
+ }
+ if ( parentp -> toporder <= childp -> toporder ) {
+ fprintf( stderr , "[propagate] toporder botches\n" );
+ }
+ childp = childp -> cyclehead;
+ } else {
+ if ( parentp -> toporder <= childp -> toporder ) {
+ fprintf( stderr , "[propagate] toporder botches\n" );
+ continue;
+ }
+ }
+ if ( childp -> npropcall == 0 ) {
+ continue;
+ }
+ /*
+ * distribute time for this arc
+ */
+ arcp -> arc_time = childp -> time
+ * ( ( (double) arcp -> arc_count ) /
+ ( (double) childp -> npropcall ) );
+ arcp -> arc_childtime = childp -> childtime
+ * ( ( (double) arcp -> arc_count ) /
+ ( (double) childp -> npropcall ) );
+ share = arcp -> arc_time + arcp -> arc_childtime;
+ parentp -> childtime += share;
+ /*
+ * ( 1 - propfraction ) gets lost along the way
+ */
+ propshare = parentp -> propfraction * share;
+ /*
+ * fix things for printing
+ */
+ parentp -> propchild += propshare;
+ arcp -> arc_time *= parentp -> propfraction;
+ arcp -> arc_childtime *= parentp -> propfraction;
+ /*
+ * add this share to the parent's cycle header, if any.
+ */
+ if ( parentp -> cyclehead != parentp ) {
+ parentp -> cyclehead -> childtime += share;
+ parentp -> cyclehead -> propchild += propshare;
+ }
+# ifdef DEBUG
+ if ( debug & PROPDEBUG ) {
+ printf( "[dotime] child \t" );
+ printname( childp );
+ printf( " with %f %f %ld/%ld\n" ,
+ childp -> time , childp -> childtime ,
+ arcp -> arc_count , childp -> npropcall );
+ printf( "[dotime] parent\t" );
+ printname( parentp );
+ printf( "\n[dotime] share %f\n" , share );
+ }
+# endif /* DEBUG */
+ }
+}
+
+void
+cyclelink(void)
+{
+ register nltype *nlp;
+ register nltype *cyclenlp;
+ int cycle;
+ nltype *memberp;
+ arctype *arcp;
+
+ /*
+ * Count the number of cycles, and initialize the cycle lists
+ */
+ ncycle = 0;
+ for ( nlp = nl ; nlp < npe ; nlp++ ) {
+ /*
+ * this is how you find unattached cycles
+ */
+ if ( nlp -> cyclehead == nlp && nlp -> cnext != 0 ) {
+ ncycle += 1;
+ }
+ }
+ /*
+ * cyclenl is indexed by cycle number:
+ * i.e. it is origin 1, not origin 0.
+ */
+ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) );
+ if ( cyclenl == NULL )
+ errx( 1 , "no room for %zu bytes of cycle headers" ,
+ ( ncycle + 1 ) * sizeof( nltype ) );
+ /*
+ * now link cycles to true cycleheads,
+ * number them, accumulate the data for the cycle
+ */
+ cycle = 0;
+ for ( nlp = nl ; nlp < npe ; nlp++ ) {
+ if ( !( nlp -> cyclehead == nlp && nlp -> cnext != 0 ) ) {
+ continue;
+ }
+ cycle += 1;
+ cyclenlp = &cyclenl[cycle];
+ cyclenlp -> name = 0; /* the name */
+ cyclenlp -> value = 0; /* the pc entry point */
+ cyclenlp -> time = 0.0; /* ticks in this routine */
+ cyclenlp -> childtime = 0.0; /* cumulative ticks in children */
+ cyclenlp -> ncall = 0; /* how many times called */
+ cyclenlp -> selfcalls = 0; /* how many calls to self */
+ cyclenlp -> propfraction = 0.0; /* what % of time propagates */
+ cyclenlp -> propself = 0.0; /* how much self time propagates */
+ cyclenlp -> propchild = 0.0; /* how much child time propagates */
+ cyclenlp -> printflag = TRUE; /* should this be printed? */
+ cyclenlp -> index = 0; /* index in the graph list */
+ cyclenlp -> toporder = DFN_NAN; /* graph call chain top-sort order */
+ cyclenlp -> cycleno = cycle; /* internal number of cycle on */
+ cyclenlp -> cyclehead = cyclenlp; /* pointer to head of cycle */
+ cyclenlp -> cnext = nlp; /* pointer to next member of cycle */
+ cyclenlp -> parents = 0; /* list of caller arcs */
+ cyclenlp -> children = 0; /* list of callee arcs */
+# ifdef DEBUG
+ if ( debug & CYCLEDEBUG ) {
+ printf( "[cyclelink] " );
+ printname( nlp );
+ printf( " is the head of cycle %d\n" , cycle );
+ }
+# endif /* DEBUG */
+ /*
+ * link members to cycle header
+ */
+ for ( memberp = nlp ; memberp ; memberp = memberp -> cnext ) {
+ memberp -> cycleno = cycle;
+ memberp -> cyclehead = cyclenlp;
+ }
+ /*
+ * count calls from outside the cycle
+ * and those among cycle members
+ */
+ for ( memberp = nlp ; memberp ; memberp = memberp -> cnext ) {
+ for ( arcp=memberp->parents ; arcp ; arcp=arcp->arc_parentlist ) {
+ if ( arcp -> arc_parentp == memberp ) {
+ continue;
+ }
+ if ( arcp -> arc_parentp -> cycleno == cycle ) {
+ cyclenlp -> selfcalls += arcp -> arc_count;
+ } else {
+ cyclenlp -> npropcall += arcp -> arc_count;
+ }
+ }
+ }
+ }
+}
+
+ /*
+ * analyze cycles to determine breakup
+ */
+bool
+cycleanalyze(void)
+{
+ arctype **cyclestack;
+ arctype **stkp;
+ arctype **arcpp;
+ arctype **endlist;
+ arctype *arcp;
+ nltype *nlp;
+ cltype *clp;
+ bool ret;
+ bool done;
+ int size;
+ int cycleno;
+
+ /*
+ * calculate the size of the cycle, and find nodes that
+ * exit the cycle as they are desirable targets to cut
+ * some of their parents
+ */
+ for ( done = TRUE , cycleno = 1 ; cycleno <= ncycle ; cycleno++ ) {
+ size = 0;
+ for (nlp = cyclenl[ cycleno ] . cnext; nlp; nlp = nlp -> cnext) {
+ size += 1;
+ nlp -> parentcnt = 0;
+ nlp -> flags &= ~HASCYCLEXIT;
+ for ( arcp = nlp -> parents; arcp; arcp = arcp -> arc_parentlist ) {
+ nlp -> parentcnt += 1;
+ if ( arcp -> arc_parentp -> cycleno != cycleno )
+ nlp -> flags |= HASCYCLEXIT;
+ }
+ }
+ if ( size <= cyclethreshold )
+ continue;
+ done = FALSE;
+ cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) );
+ if ( cyclestack == NULL )
+ errx( 1, "no room for %zu bytes of cycle stack" ,
+ ( size + 1 ) * sizeof( arctype * ) );
+# ifdef DEBUG
+ if ( debug & BREAKCYCLE ) {
+ printf( "[cycleanalyze] starting cycle %d of %d, size %d\n" ,
+ cycleno , ncycle , size );
+ }
+# endif /* DEBUG */
+ for ( nlp = cyclenl[ cycleno ] . cnext ; nlp ; nlp = nlp -> cnext ) {
+ stkp = &cyclestack[0];
+ nlp -> flags |= CYCLEHEAD;
+ ret = descend ( nlp , cyclestack , stkp );
+ nlp -> flags &= ~CYCLEHEAD;
+ if ( ret == FALSE )
+ break;
+ }
+ free( cyclestack );
+ if ( cyclecnt > 0 ) {
+ compresslist();
+ for ( clp = cyclehead ; clp ; ) {
+ endlist = &clp -> list[ clp -> size ];
+ for ( arcpp = clp -> list ; arcpp < endlist ; arcpp++ )
+ (*arcpp) -> arc_cyclecnt--;
+ cyclecnt--;
+ clp = clp -> next;
+ free( clp );
+ }
+ cyclehead = 0;
+ }
+ }
+# ifdef DEBUG
+ if ( debug & BREAKCYCLE ) {
+ printf("%s visited %d, viable %d, newcycle %d, oldcycle %d\n",
+ "[doarcs]" , visited , viable , newcycle , oldcycle);
+ }
+# endif /* DEBUG */
+ return( done );
+}
+
+bool
+descend(nltype *node, arctype **stkstart, arctype **stkp)
+{
+ arctype *arcp;
+ bool ret;
+
+ for ( arcp = node -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+# ifdef DEBUG
+ visited++;
+# endif /* DEBUG */
+ if ( arcp -> arc_childp -> cycleno != node -> cycleno
+ || ( arcp -> arc_childp -> flags & VISITED )
+ || ( arcp -> arc_flags & DEADARC ) )
+ continue;
+# ifdef DEBUG
+ viable++;
+# endif /* DEBUG */
+ *stkp = arcp;
+ if ( arcp -> arc_childp -> flags & CYCLEHEAD ) {
+ if ( addcycle( stkstart , stkp ) == FALSE )
+ return( FALSE );
+ continue;
+ }
+ arcp -> arc_childp -> flags |= VISITED;
+ ret = descend( arcp -> arc_childp , stkstart , stkp + 1 );
+ arcp -> arc_childp -> flags &= ~VISITED;
+ if ( ret == FALSE )
+ return( FALSE );
+ }
+ return( TRUE );
+}
+
+bool
+addcycle(arctype **stkstart, arctype **stkend)
+{
+ arctype **arcpp;
+ arctype **stkloc;
+ arctype **stkp;
+ arctype **endlist;
+ arctype *minarc;
+ arctype *arcp;
+ cltype *clp;
+ int size;
+
+ size = stkend - stkstart + 1;
+ if ( size <= 1 )
+ return( TRUE );
+ for ( arcpp = stkstart , minarc = *arcpp ; arcpp <= stkend ; arcpp++ ) {
+ if ( *arcpp > minarc )
+ continue;
+ minarc = *arcpp;
+ stkloc = arcpp;
+ }
+ for ( clp = cyclehead ; clp ; clp = clp -> next ) {
+ if ( clp -> size != size )
+ continue;
+ stkp = stkloc;
+ endlist = &clp -> list[ size ];
+ for ( arcpp = clp -> list ; arcpp < endlist ; arcpp++ ) {
+ if ( *stkp++ != *arcpp )
+ break;
+ if ( stkp > stkend )
+ stkp = stkstart;
+ }
+ if ( arcpp == endlist ) {
+# ifdef DEBUG
+ oldcycle++;
+# endif /* DEBUG */
+ return( TRUE );
+ }
+ }
+ clp = (cltype *)
+ calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) );
+ if ( clp == NULL ) {
+ warnx( "no room for %zu bytes of subcycle storage" ,
+ sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) );
+ return( FALSE );
+ }
+ stkp = stkloc;
+ endlist = &clp -> list[ size ];
+ for ( arcpp = clp -> list ; arcpp < endlist ; arcpp++ ) {
+ arcp = *arcpp = *stkp++;
+ if ( stkp > stkend )
+ stkp = stkstart;
+ arcp -> arc_cyclecnt++;
+ if ( ( arcp -> arc_flags & ONLIST ) == 0 ) {
+ arcp -> arc_flags |= ONLIST;
+ arcp -> arc_next = archead;
+ archead = arcp;
+ }
+ }
+ clp -> size = size;
+ clp -> next = cyclehead;
+ cyclehead = clp;
+# ifdef DEBUG
+ newcycle++;
+ if ( debug & SUBCYCLELIST ) {
+ printsubcycle( clp );
+ }
+# endif /* DEBUG */
+ cyclecnt++;
+ if ( cyclecnt >= CYCLEMAX )
+ return( FALSE );
+ return( TRUE );
+}
+
+void
+compresslist(void)
+{
+ cltype *clp;
+ cltype **prev;
+ arctype **arcpp;
+ arctype **endlist;
+ arctype *arcp;
+ arctype *maxarcp;
+ arctype *maxexitarcp;
+ arctype *maxwithparentarcp;
+ arctype *maxnoparentarcp;
+ int maxexitcnt;
+ int maxwithparentcnt;
+ int maxnoparentcnt;
+# ifdef DEBUG
+ const char *type;
+# endif /* DEBUG */
+
+ maxexitcnt = 0;
+ maxwithparentcnt = 0;
+ maxnoparentcnt = 0;
+ for ( endlist = &archead , arcp = archead ; arcp ; ) {
+ if ( arcp -> arc_cyclecnt == 0 ) {
+ arcp -> arc_flags &= ~ONLIST;
+ *endlist = arcp -> arc_next;
+ arcp -> arc_next = 0;
+ arcp = *endlist;
+ continue;
+ }
+ if ( arcp -> arc_childp -> flags & HASCYCLEXIT ) {
+ if ( arcp -> arc_cyclecnt > maxexitcnt ||
+ ( arcp -> arc_cyclecnt == maxexitcnt &&
+ arcp -> arc_cyclecnt < maxexitarcp -> arc_count ) ) {
+ maxexitcnt = arcp -> arc_cyclecnt;
+ maxexitarcp = arcp;
+ }
+ } else if ( arcp -> arc_childp -> parentcnt > 1 ) {
+ if ( arcp -> arc_cyclecnt > maxwithparentcnt ||
+ ( arcp -> arc_cyclecnt == maxwithparentcnt &&
+ arcp -> arc_cyclecnt < maxwithparentarcp -> arc_count ) ) {
+ maxwithparentcnt = arcp -> arc_cyclecnt;
+ maxwithparentarcp = arcp;
+ }
+ } else {
+ if ( arcp -> arc_cyclecnt > maxnoparentcnt ||
+ ( arcp -> arc_cyclecnt == maxnoparentcnt &&
+ arcp -> arc_cyclecnt < maxnoparentarcp -> arc_count ) ) {
+ maxnoparentcnt = arcp -> arc_cyclecnt;
+ maxnoparentarcp = arcp;
+ }
+ }
+ endlist = &arcp -> arc_next;
+ arcp = arcp -> arc_next;
+ }
+ if ( maxexitcnt > 0 ) {
+ /*
+ * first choice is edge leading to node with out-of-cycle parent
+ */
+ maxarcp = maxexitarcp;
+# ifdef DEBUG
+ type = "exit";
+# endif /* DEBUG */
+ } else if ( maxwithparentcnt > 0 ) {
+ /*
+ * second choice is edge leading to node with at least one
+ * other in-cycle parent
+ */
+ maxarcp = maxwithparentarcp;
+# ifdef DEBUG
+ type = "internal";
+# endif /* DEBUG */
+ } else {
+ /*
+ * last choice is edge leading to node with only this arc as
+ * a parent (as it will now be orphaned)
+ */
+ maxarcp = maxnoparentarcp;
+# ifdef DEBUG
+ type = "orphan";
+# endif /* DEBUG */
+ }
+ maxarcp -> arc_flags |= DEADARC;
+ maxarcp -> arc_childp -> parentcnt -= 1;
+ maxarcp -> arc_childp -> npropcall -= maxarcp -> arc_count;
+# ifdef DEBUG
+ if ( debug & BREAKCYCLE ) {
+ printf( "%s delete %s arc: %s (%ld) -> %s from %u cycle(s)\n" ,
+ "[compresslist]" , type , maxarcp -> arc_parentp -> name ,
+ maxarcp -> arc_count , maxarcp -> arc_childp -> name ,
+ maxarcp -> arc_cyclecnt );
+ }
+# endif /* DEBUG */
+ printf( "\t%s to %s with %ld calls\n" , maxarcp -> arc_parentp -> name ,
+ maxarcp -> arc_childp -> name , maxarcp -> arc_count );
+ prev = &cyclehead;
+ for ( clp = cyclehead ; clp ; ) {
+ endlist = &clp -> list[ clp -> size ];
+ for ( arcpp = clp -> list ; arcpp < endlist ; arcpp++ )
+ if ( (*arcpp) -> arc_flags & DEADARC )
+ break;
+ if ( arcpp == endlist ) {
+ prev = &clp -> next;
+ clp = clp -> next;
+ continue;
+ }
+ for ( arcpp = clp -> list ; arcpp < endlist ; arcpp++ )
+ (*arcpp) -> arc_cyclecnt--;
+ cyclecnt--;
+ *prev = clp -> next;
+ clp = clp -> next;
+ free( clp );
+ }
+}
+
+#ifdef DEBUG
+void
+printsubcycle(cltype *clp)
+{
+ arctype **arcpp;
+ arctype **endlist;
+
+ arcpp = clp -> list;
+ printf( "%s <cycle %d>\n" , (*arcpp) -> arc_parentp -> name ,
+ (*arcpp) -> arc_parentp -> cycleno ) ;
+ for ( endlist = &clp -> list[ clp -> size ]; arcpp < endlist ; arcpp++ )
+ printf( "\t(%ld) -> %s\n" , (*arcpp) -> arc_count ,
+ (*arcpp) -> arc_childp -> name ) ;
+}
+#endif /* DEBUG */
+
+void
+cycletime(void)
+{
+ int cycle;
+ nltype *cyclenlp;
+ nltype *childp;
+
+ for ( cycle = 1 ; cycle <= ncycle ; cycle += 1 ) {
+ cyclenlp = &cyclenl[ cycle ];
+ for ( childp = cyclenlp -> cnext ; childp ; childp = childp -> cnext ) {
+ if ( childp -> propfraction == 0.0 ) {
+ /*
+ * all members have the same propfraction except those
+ * that were excluded with -E
+ */
+ continue;
+ }
+ cyclenlp -> time += childp -> time;
+ }
+ cyclenlp -> propself = cyclenlp -> propfraction * cyclenlp -> time;
+ }
+}
+
+ /*
+ * in one top to bottom pass over the topologically sorted namelist
+ * propagate:
+ * printflag as the union of parents' printflags
+ * propfraction as the sum of fractional parents' propfractions
+ * and while we're here, sum time for functions.
+ */
+void
+doflags(void)
+{
+ int index;
+ nltype *childp;
+ nltype *oldhead;
+
+ oldhead = 0;
+ for ( index = nname-1 ; index >= 0 ; index -= 1 ) {
+ childp = topsortnlp[ index ];
+ /*
+ * if we haven't done this function or cycle,
+ * inherit things from parent.
+ * this way, we are linear in the number of arcs
+ * since we do all members of a cycle (and the cycle itself)
+ * as we hit the first member of the cycle.
+ */
+ if ( childp -> cyclehead != oldhead ) {
+ oldhead = childp -> cyclehead;
+ inheritflags( childp );
+ }
+# ifdef DEBUG
+ if ( debug & PROPDEBUG ) {
+ printf( "[doflags] " );
+ printname( childp );
+ printf( " inherits printflag %d and propfraction %f\n" ,
+ childp -> printflag , childp -> propfraction );
+ }
+# endif /* DEBUG */
+ if ( ! childp -> printflag ) {
+ /*
+ * printflag is off
+ * it gets turned on by
+ * being on -f list,
+ * or there not being any -f list and not being on -e list.
+ */
+ if ( onlist( flist , childp -> name )
+ || ( !fflag && !onlist( elist , childp -> name ) ) ) {
+ childp -> printflag = TRUE;
+ }
+ } else {
+ /*
+ * this function has printing parents:
+ * maybe someone wants to shut it up
+ * by putting it on -e list. (but favor -f over -e)
+ */
+ if ( ( !onlist( flist , childp -> name ) )
+ && onlist( elist , childp -> name ) ) {
+ childp -> printflag = FALSE;
+ }
+ }
+ if ( childp -> propfraction == 0.0 ) {
+ /*
+ * no parents to pass time to.
+ * collect time from children if
+ * its on -F list,
+ * or there isn't any -F list and its not on -E list.
+ */
+ if ( onlist( Flist , childp -> name )
+ || ( !Fflag && !onlist( Elist , childp -> name ) ) ) {
+ childp -> propfraction = 1.0;
+ }
+ } else {
+ /*
+ * it has parents to pass time to,
+ * but maybe someone wants to shut it up
+ * by putting it on -E list. (but favor -F over -E)
+ */
+ if ( !onlist( Flist , childp -> name )
+ && onlist( Elist , childp -> name ) ) {
+ childp -> propfraction = 0.0;
+ }
+ }
+ childp -> propself = childp -> time * childp -> propfraction;
+ printtime += childp -> propself;
+# ifdef DEBUG
+ if ( debug & PROPDEBUG ) {
+ printf( "[doflags] " );
+ printname( childp );
+ printf( " ends up with printflag %d and propfraction %f\n" ,
+ childp -> printflag , childp -> propfraction );
+ printf( "time %f propself %f printtime %f\n" ,
+ childp -> time , childp -> propself , printtime );
+ }
+# endif /* DEBUG */
+ }
+}
+
+ /*
+ * check if any parent of this child
+ * (or outside parents of this cycle)
+ * have their print flags on and set the
+ * print flag of the child (cycle) appropriately.
+ * similarly, deal with propagation fractions from parents.
+ */
+void
+inheritflags(nltype *childp)
+{
+ nltype *headp;
+ arctype *arcp;
+ nltype *parentp;
+ nltype *memp;
+
+ headp = childp -> cyclehead;
+ if ( childp == headp ) {
+ /*
+ * just a regular child, check its parents
+ */
+ childp -> printflag = FALSE;
+ childp -> propfraction = 0.0;
+ for (arcp = childp -> parents ; arcp ; arcp = arcp -> arc_parentlist) {
+ parentp = arcp -> arc_parentp;
+ if ( childp == parentp ) {
+ continue;
+ }
+ childp -> printflag |= parentp -> printflag;
+ /*
+ * if the child was never actually called
+ * (e.g. this arc is static (and all others are, too))
+ * no time propagates along this arc.
+ */
+ if ( arcp -> arc_flags & DEADARC ) {
+ continue;
+ }
+ if ( childp -> npropcall ) {
+ childp -> propfraction += parentp -> propfraction
+ * ( ( (double) arcp -> arc_count )
+ / ( (double) childp -> npropcall ) );
+ }
+ }
+ } else {
+ /*
+ * its a member of a cycle, look at all parents from
+ * outside the cycle
+ */
+ headp -> printflag = FALSE;
+ headp -> propfraction = 0.0;
+ for ( memp = headp -> cnext ; memp ; memp = memp -> cnext ) {
+ for (arcp = memp->parents ; arcp ; arcp = arcp->arc_parentlist) {
+ if ( arcp -> arc_parentp -> cyclehead == headp ) {
+ continue;
+ }
+ parentp = arcp -> arc_parentp;
+ headp -> printflag |= parentp -> printflag;
+ /*
+ * if the cycle was never actually called
+ * (e.g. this arc is static (and all others are, too))
+ * no time propagates along this arc.
+ */
+ if ( arcp -> arc_flags & DEADARC ) {
+ continue;
+ }
+ if ( headp -> npropcall ) {
+ headp -> propfraction += parentp -> propfraction
+ * ( ( (double) arcp -> arc_count )
+ / ( (double) headp -> npropcall ) );
+ }
+ }
+ }
+ for ( memp = headp ; memp ; memp = memp -> cnext ) {
+ memp -> printflag = headp -> printflag;
+ memp -> propfraction = headp -> propfraction;
+ }
+ }
+}
diff --git a/usr.bin/gprof/arm.h b/usr.bin/gprof/arm.h
new file mode 100644
index 0000000..58b92c5
--- /dev/null
+++ b/usr.bin/gprof/arm.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)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
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/gprof/dfn.c b/usr.bin/gprof/dfn.c
new file mode 100644
index 0000000..a49cd31
--- /dev/null
+++ b/usr.bin/gprof/dfn.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include "gprof.h"
+
+#define DFN_DEPTH 100
+struct dfnstruct {
+ nltype *nlentryp;
+ int cycletop;
+};
+typedef struct dfnstruct dfntype;
+
+dfntype dfn_stack[ DFN_DEPTH ];
+int dfn_depth;
+
+int dfn_counter;
+
+void
+dfn_init(void)
+{
+
+ dfn_depth = 0;
+ dfn_counter = DFN_NAN;
+}
+
+ /*
+ * given this parent, depth first number its children.
+ */
+void
+dfn(nltype *parentp)
+{
+ arctype *arcp;
+
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn] dfn(" );
+ printname( parentp );
+ printf( ")\n" );
+ }
+# endif /* DEBUG */
+ /*
+ * if we're already numbered, no need to look any further.
+ */
+ if ( dfn_numbered( parentp ) ) {
+ return;
+ }
+ /*
+ * if we're already busy, must be a cycle
+ */
+ if ( dfn_busy( parentp ) ) {
+ dfn_findcycle( parentp );
+ return;
+ }
+ /*
+ * visit yourself before your children
+ */
+ dfn_pre_visit( parentp );
+ /*
+ * visit children
+ */
+ for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+ if ( arcp -> arc_flags & DEADARC )
+ continue;
+ dfn( arcp -> arc_childp );
+ }
+ /*
+ * visit yourself after your children
+ */
+ dfn_post_visit( parentp );
+}
+
+ /*
+ * push a parent onto the stack and mark it busy
+ */
+void
+dfn_pre_visit(nltype *parentp)
+{
+
+ dfn_depth += 1;
+ if ( dfn_depth >= DFN_DEPTH )
+ errx( 1 , "[dfn] out of my depth (dfn_stack overflow)" );
+ dfn_stack[ dfn_depth ].nlentryp = parentp;
+ dfn_stack[ dfn_depth ].cycletop = dfn_depth;
+ parentp -> toporder = DFN_BUSY;
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_pre_visit]\t\t%d:" , dfn_depth );
+ printname( parentp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+}
+
+ /*
+ * are we already numbered?
+ */
+bool
+dfn_numbered(nltype *childp)
+{
+
+ return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY );
+}
+
+ /*
+ * are we already busy?
+ */
+bool
+dfn_busy(nltype *childp)
+{
+
+ if ( childp -> toporder == DFN_NAN ) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+ /*
+ * MISSING: an explanation
+ */
+void
+dfn_findcycle(nltype *childp)
+{
+ int cycletop;
+ nltype *cycleheadp;
+ nltype *tailp;
+ int index;
+
+ for ( cycletop = dfn_depth ; cycletop > 0 ; cycletop -= 1 ) {
+ cycleheadp = dfn_stack[ cycletop ].nlentryp;
+ if ( childp == cycleheadp ) {
+ break;
+ }
+ if ( childp -> cyclehead != childp &&
+ childp -> cyclehead == cycleheadp ) {
+ break;
+ }
+ }
+ if ( cycletop <= 0 )
+ errx( 1 , "[dfn_findcycle] couldn't find head of cycle" );
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_findcycle] dfn_depth %d cycletop %d " ,
+ dfn_depth , cycletop );
+ printname( cycleheadp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ if ( cycletop == dfn_depth ) {
+ /*
+ * this is previous function, e.g. this calls itself
+ * sort of boring
+ */
+ dfn_self_cycle( childp );
+ } else {
+ /*
+ * glom intervening functions that aren't already
+ * glommed into this cycle.
+ * things have been glommed when their cyclehead field
+ * points to the head of the cycle they are glommed into.
+ */
+ for ( tailp = cycleheadp ; tailp -> cnext ; tailp = tailp -> cnext ) {
+ /* void: chase down to tail of things already glommed */
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_findcycle] tail " );
+ printname( tailp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ }
+ /*
+ * if what we think is the top of the cycle
+ * has a cyclehead field, then it's not really the
+ * head of the cycle, which is really what we want
+ */
+ if ( cycleheadp -> cyclehead != cycleheadp ) {
+ cycleheadp = cycleheadp -> cyclehead;
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_findcycle] new cyclehead " );
+ printname( cycleheadp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ }
+ for ( index = cycletop + 1 ; index <= dfn_depth ; index += 1 ) {
+ childp = dfn_stack[ index ].nlentryp;
+ if ( childp -> cyclehead == childp ) {
+ /*
+ * not yet glommed anywhere, glom it
+ * and fix any children it has glommed
+ */
+ tailp -> cnext = childp;
+ childp -> cyclehead = cycleheadp;
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_findcycle] glomming " );
+ printname( childp );
+ printf( " onto " );
+ printname( cycleheadp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ for ( tailp = childp ; tailp->cnext ; tailp = tailp->cnext ) {
+ tailp -> cnext -> cyclehead = cycleheadp;
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_findcycle] and its tail " );
+ printname( tailp -> cnext );
+ printf( " onto " );
+ printname( cycleheadp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ }
+ } else if ( childp -> cyclehead != cycleheadp /* firewall */ ) {
+ fprintf( stderr ,
+ "[dfn_busy] glommed, but not to cyclehead\n" );
+ }
+ }
+ }
+}
+
+ /*
+ * deal with self-cycles
+ * for lint: ARGSUSED
+ */
+void
+dfn_self_cycle(nltype *parentp)
+{
+ /*
+ * since we are taking out self-cycles elsewhere
+ * no need for the special case, here.
+ */
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_self_cycle] " );
+ printname( parentp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+}
+
+ /*
+ * visit a node after all its children
+ * [MISSING: an explanation]
+ * and pop it off the stack
+ */
+void
+dfn_post_visit(nltype *parentp)
+{
+ nltype *memberp;
+
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_post_visit]\t%d: " , dfn_depth );
+ printname( parentp );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ /*
+ * number functions and things in their cycles
+ * unless the function is itself part of a cycle
+ */
+ if ( parentp -> cyclehead == parentp ) {
+ dfn_counter += 1;
+ for ( memberp = parentp ; memberp ; memberp = memberp -> cnext ) {
+ memberp -> toporder = dfn_counter;
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_post_visit]\t\tmember " );
+ printname( memberp );
+ printf( " -> toporder = %d\n" , dfn_counter );
+ }
+# endif /* DEBUG */
+ }
+ } else {
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "[dfn_post_visit]\t\tis part of a cycle\n" );
+ }
+# endif /* DEBUG */
+ }
+ dfn_depth -= 1;
+}
diff --git a/usr.bin/gprof/elf.c b/usr.bin/gprof/elf.c
new file mode 100644
index 0000000..3d9c136
--- /dev/null
+++ b/usr.bin/gprof/elf.c
@@ -0,0 +1,144 @@
+/*-
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+/* From: */
+#ifndef lint
+static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <machine/elf.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "gprof.h"
+
+static bool wantsym(const Elf_Sym *, const char *);
+
+/* Things which get -E excluded by default. */
+static char *excludes[] = { ".mcount", "_mcleanup", NULL };
+
+int
+elf_getnfile(const char *filename, char ***defaultEs)
+{
+ int fd;
+ Elf_Ehdr h;
+ struct stat s;
+ void *mapbase;
+ const char *base;
+ const Elf_Shdr *shdrs;
+ const Elf_Shdr *sh_symtab;
+ const Elf_Shdr *sh_strtab;
+ const char *strtab;
+ const Elf_Sym *symtab;
+ int symtabct;
+ int i;
+
+ if ((fd = open(filename, O_RDONLY)) == -1)
+ err(1, "%s", filename);
+ if (read(fd, &h, sizeof h) != sizeof h || !IS_ELF(h)) {
+ close(fd);
+ return -1;
+ }
+ if (fstat(fd, &s) == -1)
+ err(1, "cannot fstat %s", filename);
+ if ((mapbase = mmap(0, s.st_size, PROT_READ, MAP_SHARED, fd, 0)) ==
+ MAP_FAILED)
+ err(1, "cannot mmap %s", filename);
+ close(fd);
+
+ base = (const char *)mapbase;
+ shdrs = (const Elf_Shdr *)(base + h.e_shoff);
+
+ /* Find the symbol table and associated string table section. */
+ for (i = 1; i < h.e_shnum; i++)
+ if (shdrs[i].sh_type == SHT_SYMTAB)
+ break;
+ if (i == h.e_shnum)
+ errx(1, "%s has no symbol table", filename);
+ sh_symtab = &shdrs[i];
+ sh_strtab = &shdrs[sh_symtab->sh_link];
+
+ symtab = (const Elf_Sym *)(base + sh_symtab->sh_offset);
+ symtabct = sh_symtab->sh_size / sh_symtab->sh_entsize;
+ strtab = (const char *)(base + sh_strtab->sh_offset);
+
+ /* Count the symbols that we're interested in. */
+ nname = 0;
+ for (i = 1; i < symtabct; i++)
+ if (wantsym(&symtab[i], strtab))
+ nname++;
+
+ /* Allocate memory for them, plus a terminating entry. */
+ if ((nl = (nltype *)calloc(nname + 1, sizeof(nltype))) == NULL)
+ errx(1, "insufficient memory for symbol table");
+
+ /* Read them in. */
+ npe = nl;
+ for (i = 1; i < symtabct; i++) {
+ const Elf_Sym *sym = &symtab[i];
+
+ if (wantsym(sym, strtab)) {
+ npe->value = sym->st_value;
+ npe->name = strtab + sym->st_name;
+ npe++;
+ }
+ }
+ npe->value = -1;
+
+ *defaultEs = excludes;
+ return 0;
+}
+
+static bool
+wantsym(const Elf_Sym *sym, const char *strtab)
+{
+ int type;
+ int bind;
+
+ type = ELF_ST_TYPE(sym->st_info);
+ bind = ELF_ST_BIND(sym->st_info);
+
+ if (type != STT_FUNC ||
+ (aflag && bind == STB_LOCAL) ||
+ (uflag && strchr(strtab + sym->st_name, '.') != NULL))
+ return 0;
+
+ return 1;
+}
diff --git a/usr.bin/gprof/gprof.1 b/usr.bin/gprof/gprof.1
new file mode 100644
index 0000000..98fd729
--- /dev/null
+++ b/usr.bin/gprof/gprof.1
@@ -0,0 +1,328 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)gprof.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 25, 2008
+.Dt GPROF 1
+.Os
+.Sh NAME
+.Nm gprof
+.Nd display call graph profile data
+.Sh SYNOPSIS
+.Nm
+.Op Fl abKlLsuz
+.Op Fl C Ar count
+.Op Fl e Ar name
+.Op Fl E Ar name
+.Op Fl f Ar name
+.Op Fl F Ar name
+.Op Fl k Ar fromname toname
+.Op Ar a.out Op Ar a.out.gmon ...
+.Sh DESCRIPTION
+The
+.Nm
+utility produces an execution profile of C, Pascal, or Fortran77 programs.
+The effect of called routines is incorporated in the profile of each caller.
+The profile data is taken from the call graph profile file
+which is created by programs that are compiled with the
+.Fl pg
+option of
+.Xr cc 1 ,
+.Xr pc 1 ,
+and
+.Xr f77 1 .
+The
+.Fl pg
+option also links in versions of the library routines
+that are compiled for profiling.
+By convention these libraries have their name suffixed with
+.Pa _p ,
+i.e., the profiled version of
+.Pa libc.a
+is
+.Pa libc_p.a
+and if you specify libraries directly to the
+compiler or linker you can use
+.Fl l Ns Ar c_p
+instead of
+.Fl l Ns Ar c .
+Read the given object file (the default is
+.Pa a.out )
+and establishes the relation between its symbol table
+and the call graph profile.
+The default graph profile file name is the name
+of the executable with the suffix
+.Pa .gmon
+appended.
+If more than one profile file is specified,
+the
+.Nm
+output shows the sum of the profile information in the given profile files.
+.Pp
+The
+.Nm
+utility calculates the amount of time spent in each routine.
+Next, these times are propagated along the edges of the call graph.
+Cycles are discovered, and calls into a cycle are made to share the time
+of the cycle.
+The first listing shows the functions
+sorted according to the time they represent
+including the time of their call graph descendants.
+Below each function entry is shown its (direct) call graph children,
+and how their times are propagated to this function.
+A similar display above the function shows how this function's time and the
+time of its descendants is propagated to its (direct) call graph parents.
+.Pp
+Cycles are also shown, with an entry for the cycle as a whole and
+a listing of the members of the cycle and their contributions to the
+time and call counts of the cycle.
+.Pp
+Second, a flat profile is given,
+similar to that provided by
+.Xr prof 1 .
+This listing gives the total execution times, the call counts,
+the time that the call spent in the routine itself, and
+the time that the call spent in the routine itself including
+its descendants.
+The units for the per-call times are normally milliseconds,
+but they are nanoseconds if the profiling clock frequency
+is 10 million or larger,
+and if a function appears to be never called then its total self time
+is printed as a percentage in the self time per call column.
+The very high profiling clock frequencies needed to get sufficient
+accuracy in the per-call times for short-lived programs are only
+implemented for
+.Dq high resolution
+(non-statistical) kernel profiling.
+.Pp
+Finally, an index of the function names is provided.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Suppress the printing of statically declared functions.
+If this option is given, all relevant information about the static function
+(e.g., time samples, calls to other functions, calls from other functions)
+belongs to the function loaded just before the static function in the
+.Pa a.out
+file.
+.It Fl b
+Suppress the printing of a description of each field in the profile.
+.It Fl C Ar count
+Find a minimal set of arcs that can be broken to eliminate all cycles with
+.Ar count
+or more members.
+Caution: the algorithm used to break cycles is exponential,
+so using this option may cause
+.Nm
+to run for a very long time.
+.It Fl e Ar name
+Suppress the printing of the graph profile entry for routine
+.Ar name
+and all its descendants
+(unless they have other ancestors that are not suppressed).
+More than one
+.Fl e
+option may be given.
+Only one
+.Ar name
+may be given with each
+.Fl e
+option.
+.It Fl E Ar name
+Suppress the printing of the graph profile entry for routine
+.Ar name
+(and its descendants) as
+.Fl e ,
+above, and also excludes the time spent in
+.Ar name
+(and its descendants) from the total and percentage time computations.
+(For example,
+.Fl E
+.Ar mcount
+.Fl E
+.Ar mcleanup
+is the default.)
+.It Fl f Ar name
+Print the graph profile entry of only the specified routine
+.Ar name
+and its descendants.
+More than one
+.Fl f
+option may be given.
+Only one
+.Ar name
+may be given with each
+.Fl f
+option.
+.It Fl F Ar name
+Print the graph profile entry of only the routine
+.Ar name
+and its descendants (as
+.Fl f ,
+above) and also uses only the times of the printed routines
+in total time and percentage computations.
+More than one
+.Fl F
+option may be given.
+Only one
+.Ar name
+may be given with each
+.Fl F
+option.
+The
+.Fl F
+option
+overrides
+the
+.Fl E
+option.
+.It Fl k Ar fromname Ar toname
+Will delete any arcs from routine
+.Ar fromname
+to routine
+.Ar toname .
+This can be used to break undesired cycles.
+More than one
+.Fl k
+option may be given.
+Only one pair of routine names may be given with each
+.Fl k
+option.
+.It Fl K
+Gather information about symbols from the currently-running kernel using the
+.Xr sysctl 3
+and
+.Xr kldsym 2
+interfaces.
+This forces the
+.Pa a.out
+argument to be ignored, and allows for symbols in
+.Xr kld 4
+modules to be used.
+.It Fl l
+Suppress the printing of the call-graph profile.
+.It Fl L
+Suppress the printing of the flat profile.
+.It Fl s
+A profile file
+.Pa gmon.sum
+is produced that represents
+the sum of the profile information in all the specified profile files.
+This summary profile file may be given to later
+executions of gprof (probably also with a
+.Fl s )
+to accumulate profile data across several runs of an
+.Pa a.out
+file.
+.It Fl u
+Suppress the printing of functions whose names are not visible to
+C programs.
+For the ELF object format, this means names that
+contain the
+.Ql .\&
+character.
+For the a.out object format, it means names that do not
+begin with a
+.Ql _
+character.
+All relevant information about such functions belongs to the
+(non-suppressed) function with the next lowest address.
+This is useful for eliminating "functions" that are just labels
+inside other functions.
+.It Fl z
+Display routines that have zero usage (as shown by call counts
+and accumulated time).
+.El
+.Sh FILES
+.Bl -tag -width a.out.gmon -compact
+.It Pa a.out
+The namelist and text space.
+.It Pa a.out.gmon
+Dynamic call graph and profile.
+.It Pa gmon.sum
+Summarized dynamic call graph and profile.
+.El
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr profil 2 ,
+.Xr clocks 7
+.\" .Xr monitor 3 ,
+.\" .Xr prof 1
+.Rs
+.%T "An Execution Profiler for Modular Programs"
+.%A S. Graham
+.%A P. Kessler
+.%A M. McKusick
+.%J "Software - Practice and Experience"
+.%V 13
+.%P pp. 671-685
+.%D 1983
+.Re
+.Rs
+.%T "gprof: A Call Graph Execution Profiler"
+.%A S. Graham
+.%A P. Kessler
+.%A M. McKusick
+.%J "Proceedings of the SIGPLAN '82 Symposium on Compiler Construction, SIGPLAN Notices"
+.%V 17
+.%N 6
+.%P pp. 120-126
+.%D June 1982
+.Re
+.Sh HISTORY
+The
+.Nm
+profiler
+appeared in
+.Bx 4.2 .
+.Sh BUGS
+The granularity of the sampling is shown, but remains
+statistical at best.
+We assume that the time for each execution of a function
+can be expressed by the total time for the function divided
+by the number of times the function is called.
+Thus the time propagated along the call graph arcs to the function's
+parents is directly proportional to the number of times that
+arc is traversed.
+.Pp
+Parents that are not themselves profiled will have the time of
+their profiled children propagated to them, but they will appear
+to be spontaneously invoked in the call graph listing, and will
+not have their time propagated further.
+Similarly, signal catchers, even though profiled, will appear
+to be spontaneous (although for more obscure reasons).
+Any profiled children of signal catchers should have their times
+propagated properly, unless the signal catcher was invoked during
+the execution of the profiling routine, in which case all is lost.
+.Pp
+The profiled program must call
+.Xr exit 3
+or return normally for the profiling information to be saved
+in the graph profile file.
diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c
new file mode 100644
index 0000000..879b0ac
--- /dev/null
+++ b/usr.bin/gprof/gprof.c
@@ -0,0 +1,593 @@
+/*
+ * Copyright (c) 1983, 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) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "gprof.h"
+
+static int valcmp(const void *, const void *);
+
+static struct gmonhdr gmonhdr;
+static int lflag;
+static int Lflag;
+
+int
+main(int argc, char **argv)
+{
+ char **sp;
+ nltype **timesortnlp;
+ char **defaultEs;
+
+ --argc;
+ argv++;
+ debug = 0;
+ bflag = TRUE;
+ while ( *argv != 0 && **argv == '-' ) {
+ (*argv)++;
+ switch ( **argv ) {
+ case 'a':
+ aflag = TRUE;
+ break;
+ case 'b':
+ bflag = FALSE;
+ break;
+ case 'C':
+ Cflag = TRUE;
+ cyclethreshold = atoi( *++argv );
+ break;
+ case 'd':
+ dflag = TRUE;
+ setlinebuf(stdout);
+ debug |= atoi( *++argv );
+ debug |= ANYDEBUG;
+# ifdef DEBUG
+ printf("[main] debug = %d\n", debug);
+# else /* not DEBUG */
+ printf("gprof: -d ignored\n");
+# endif /* DEBUG */
+ break;
+ case 'E':
+ ++argv;
+ addlist( Elist , *argv );
+ Eflag = TRUE;
+ addlist( elist , *argv );
+ eflag = TRUE;
+ break;
+ case 'e':
+ addlist( elist , *++argv );
+ eflag = TRUE;
+ break;
+ case 'F':
+ ++argv;
+ addlist( Flist , *argv );
+ Fflag = TRUE;
+ addlist( flist , *argv );
+ fflag = TRUE;
+ break;
+ case 'f':
+ addlist( flist , *++argv );
+ fflag = TRUE;
+ break;
+ case 'k':
+ addlist( kfromlist , *++argv );
+ addlist( ktolist , *++argv );
+ kflag = TRUE;
+ break;
+ case 'K':
+ Kflag = TRUE;
+ break;
+ case 'l':
+ lflag = 1;
+ Lflag = 0;
+ break;
+ case 'L':
+ Lflag = 1;
+ lflag = 0;
+ break;
+ case 's':
+ sflag = TRUE;
+ break;
+ case 'u':
+ uflag = TRUE;
+ break;
+ case 'z':
+ zflag = TRUE;
+ break;
+ }
+ argv++;
+ }
+ if ( *argv != 0 ) {
+ a_outname = *argv;
+ argv++;
+ } else {
+ a_outname = A_OUTNAME;
+ }
+ if ( *argv != 0 ) {
+ gmonname = *argv;
+ argv++;
+ } else {
+ gmonname = (char *) malloc(strlen(a_outname)+6);
+ strcpy(gmonname, a_outname);
+ strcat(gmonname, ".gmon");
+ }
+ /*
+ * get information from the executable file.
+ */
+ if ((Kflag && kernel_getnfile(a_outname, &defaultEs) == -1) ||
+ (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 &&
+ aout_getnfile(a_outname, &defaultEs) == -1))
+ errx(1, "%s: bad format", a_outname);
+ /*
+ * sort symbol table.
+ */
+ qsort(nl, nname, sizeof(nltype), valcmp);
+ /*
+ * turn off default functions
+ */
+ for ( sp = defaultEs ; *sp ; sp++ ) {
+ Eflag = TRUE;
+ addlist( Elist , *sp );
+ eflag = TRUE;
+ addlist( elist , *sp );
+ }
+ /*
+ * get information about mon.out file(s).
+ */
+ do {
+ getpfile( gmonname );
+ if ( *argv != 0 ) {
+ gmonname = *argv;
+ }
+ } while ( *argv++ != 0 );
+ /*
+ * how many ticks per second?
+ * if we can't tell, report time in ticks.
+ */
+ if (hz == 0) {
+ hz = 1;
+ fprintf(stderr, "time is in ticks, not seconds\n");
+ }
+ /*
+ * dump out a gmon.sum file if requested
+ */
+ if ( sflag ) {
+ dumpsum( GMONSUM );
+ }
+ /*
+ * assign samples to procedures
+ */
+ asgnsamples();
+ /*
+ * assemble the dynamic profile
+ */
+ timesortnlp = doarcs();
+ /*
+ * print the dynamic profile
+ */
+ if(!lflag) {
+ printgprof( timesortnlp );
+ }
+ /*
+ * print the flat profile
+ */
+ if(!Lflag) {
+ printprof();
+ }
+ /*
+ * print the index
+ */
+ printindex();
+ exit(0);
+}
+
+ /*
+ * information from a gmon.out file is in two parts:
+ * an array of sampling hits within pc ranges,
+ * and the arcs.
+ */
+void
+getpfile(char *filename)
+{
+ FILE *pfile;
+ struct rawarc arc;
+
+ pfile = openpfile(filename);
+ readsamples(pfile);
+ /*
+ * the rest of the file consists of
+ * a bunch of <from,self,count> tuples.
+ */
+ while ( fread( &arc , sizeof arc , 1 , pfile ) == 1 ) {
+# ifdef DEBUG
+ if ( debug & SAMPLEDEBUG ) {
+ printf( "[getpfile] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
+ arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
+ }
+# endif /* DEBUG */
+ /*
+ * add this arc
+ */
+ tally( &arc );
+ }
+ fclose(pfile);
+}
+
+FILE *
+openpfile(char *filename)
+{
+ struct gmonhdr tmp;
+ FILE *pfile;
+ int size;
+ int rate;
+
+ if((pfile = fopen(filename, "r")) == NULL)
+ err(1, "%s", filename);
+ fread(&tmp, sizeof(struct gmonhdr), 1, pfile);
+ if ( s_highpc != 0 && ( tmp.lpc != gmonhdr.lpc ||
+ tmp.hpc != gmonhdr.hpc || tmp.ncnt != gmonhdr.ncnt ) )
+ errx(1, "%s: incompatible with first gmon file", filename);
+ gmonhdr = tmp;
+ if ( gmonhdr.version == GMONVERSION ) {
+ rate = gmonhdr.profrate;
+ size = sizeof(struct gmonhdr);
+ } else {
+ fseek(pfile, sizeof(struct ophdr), SEEK_SET);
+ size = sizeof(struct ophdr);
+ gmonhdr.profrate = rate = hertz();
+ gmonhdr.version = GMONVERSION;
+ }
+ if (hz == 0) {
+ hz = rate;
+ } else if (hz != rate)
+ errx(0, "%s: profile clock rate (%d) %s (%ld) in first gmon file",
+ filename, rate, "incompatible with clock rate", hz);
+ if ( gmonhdr.histcounter_type == 0 ) {
+ /* Historical case. The type was u_short (2 bytes in practice). */
+ histcounter_type = 16;
+ histcounter_size = 2;
+ } else {
+ histcounter_type = gmonhdr.histcounter_type;
+ histcounter_size = abs(histcounter_type) / CHAR_BIT;
+ }
+ s_lowpc = (unsigned long) gmonhdr.lpc;
+ s_highpc = (unsigned long) gmonhdr.hpc;
+ lowpc = (unsigned long)gmonhdr.lpc / HISTORICAL_SCALE_2;
+ highpc = (unsigned long)gmonhdr.hpc / HISTORICAL_SCALE_2;
+ sampbytes = gmonhdr.ncnt - size;
+ nsamples = sampbytes / histcounter_size;
+# ifdef DEBUG
+ if ( debug & SAMPLEDEBUG ) {
+ printf( "[openpfile] hdr.lpc 0x%lx hdr.hpc 0x%lx hdr.ncnt %d\n",
+ gmonhdr.lpc , gmonhdr.hpc , gmonhdr.ncnt );
+ printf( "[openpfile] s_lowpc 0x%lx s_highpc 0x%lx\n" ,
+ s_lowpc , s_highpc );
+ printf( "[openpfile] lowpc 0x%lx highpc 0x%lx\n" ,
+ lowpc , highpc );
+ printf( "[openpfile] sampbytes %d nsamples %d\n" ,
+ sampbytes , nsamples );
+ printf( "[openpfile] sample rate %ld\n" , hz );
+ }
+# endif /* DEBUG */
+ return(pfile);
+}
+
+void
+tally(struct rawarc *rawp)
+{
+ nltype *parentp;
+ nltype *childp;
+
+ parentp = nllookup( rawp -> raw_frompc );
+ childp = nllookup( rawp -> raw_selfpc );
+ if ( parentp == 0 || childp == 0 )
+ return;
+ if ( kflag
+ && onlist( kfromlist , parentp -> name )
+ && onlist( ktolist , childp -> name ) ) {
+ return;
+ }
+ childp -> ncall += rawp -> raw_count;
+# ifdef DEBUG
+ if ( debug & TALLYDEBUG ) {
+ printf( "[tally] arc from %s to %s traversed %ld times\n" ,
+ parentp -> name , childp -> name , rawp -> raw_count );
+ }
+# endif /* DEBUG */
+ addarc( parentp , childp , rawp -> raw_count );
+}
+
+/*
+ * dump out the gmon.sum file
+ */
+void
+dumpsum(const char *sumfile)
+{
+ register nltype *nlp;
+ register arctype *arcp;
+ struct rawarc arc;
+ FILE *sfile;
+
+ if ( ( sfile = fopen ( sumfile , "w" ) ) == NULL )
+ err( 1 , "%s" , sumfile );
+ /*
+ * dump the header; use the last header read in
+ */
+ if ( fwrite( &gmonhdr , sizeof gmonhdr , 1 , sfile ) != 1 )
+ err( 1 , "%s" , sumfile );
+ /*
+ * dump the samples
+ */
+ if (fwrite(samples, histcounter_size, nsamples, sfile) != nsamples)
+ err( 1 , "%s" , sumfile );
+ /*
+ * dump the normalized raw arc information
+ */
+ for ( nlp = nl ; nlp < npe ; nlp++ ) {
+ for ( arcp = nlp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+ arc.raw_frompc = arcp -> arc_parentp -> value;
+ arc.raw_selfpc = arcp -> arc_childp -> value;
+ arc.raw_count = arcp -> arc_count;
+ if ( fwrite ( &arc , sizeof arc , 1 , sfile ) != 1 )
+ err( 1 , "%s" , sumfile );
+# ifdef DEBUG
+ if ( debug & SAMPLEDEBUG ) {
+ printf( "[dumpsum] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
+ arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
+ }
+# endif /* DEBUG */
+ }
+ }
+ fclose( sfile );
+}
+
+static int
+valcmp(const void *v1, const void *v2)
+{
+ const nltype *p1 = (const nltype *)v1;
+ const nltype *p2 = (const nltype *)v2;
+
+ if ( p1 -> value < p2 -> value ) {
+ return LESSTHAN;
+ }
+ if ( p1 -> value > p2 -> value ) {
+ return GREATERTHAN;
+ }
+ return EQUALTO;
+}
+
+void
+readsamples(FILE *pfile)
+{
+ int i;
+ intmax_t sample;
+
+ if (samples == 0) {
+ samples = (double *) calloc(nsamples, sizeof(double));
+ if (samples == NULL)
+ errx(0, "no room for %d sample pc's", nsamples);
+ }
+ for (i = 0; i < nsamples; i++) {
+ fread(&sample, histcounter_size, 1, pfile);
+ if (feof(pfile))
+ break;
+ switch ( histcounter_type ) {
+ case -8:
+ samples[i] += *(int8_t *)&sample;
+ break;
+ case 8:
+ samples[i] += *(u_int8_t *)&sample;
+ break;
+ case -16:
+ samples[i] += *(int16_t *)&sample;
+ break;
+ case 16:
+ samples[i] += *(u_int16_t *)&sample;
+ break;
+ case -32:
+ samples[i] += *(int32_t *)&sample;
+ break;
+ case 32:
+ samples[i] += *(u_int32_t *)&sample;
+ break;
+ case -64:
+ samples[i] += *(int64_t *)&sample;
+ break;
+ case 64:
+ samples[i] += *(u_int64_t *)&sample;
+ break;
+ default:
+ err(1, "unsupported histogram counter type %d", histcounter_type);
+ }
+ }
+ if (i != nsamples)
+ errx(1, "unexpected EOF after reading %d/%d samples", --i , nsamples );
+}
+
+/*
+ * Assign samples to the procedures to which they belong.
+ *
+ * There are three cases as to where pcl and pch can be
+ * with respect to the routine entry addresses svalue0 and svalue1
+ * as shown in the following diagram. overlap computes the
+ * distance between the arrows, the fraction of the sample
+ * that is to be credited to the routine which starts at svalue0.
+ *
+ * svalue0 svalue1
+ * | |
+ * v v
+ *
+ * +-----------------------------------------------+
+ * | |
+ * | ->| |<- ->| |<- ->| |<- |
+ * | | | | | |
+ * +---------+ +---------+ +---------+
+ *
+ * ^ ^ ^ ^ ^ ^
+ * | | | | | |
+ * pcl pch pcl pch pcl pch
+ *
+ * For the vax we assert that samples will never fall in the first
+ * two bytes of any routine, since that is the entry mask,
+ * thus we give call alignentries() to adjust the entry points if
+ * the entry mask falls in one bucket but the code for the routine
+ * doesn't start until the next bucket. In conjunction with the
+ * alignment of routine addresses, this should allow us to have
+ * only one sample for every four bytes of text space and never
+ * have any overlap (the two end cases, above).
+ */
+void
+asgnsamples(void)
+{
+ register int j;
+ double ccnt;
+ double thetime;
+ unsigned long pcl, pch;
+ register int i;
+ unsigned long overlap;
+ unsigned long svalue0, svalue1;
+
+ /* read samples and assign to namelist symbols */
+ scale = highpc - lowpc;
+ scale /= nsamples;
+ alignentries();
+ for (i = 0, j = 1; i < nsamples; i++) {
+ ccnt = samples[i];
+ if (ccnt == 0)
+ continue;
+ pcl = lowpc + (unsigned long)(scale * i);
+ pch = lowpc + (unsigned long)(scale * (i + 1));
+ thetime = ccnt;
+# ifdef DEBUG
+ if ( debug & SAMPLEDEBUG ) {
+ printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" ,
+ pcl , pch , ccnt );
+ }
+# endif /* DEBUG */
+ totime += thetime;
+ for (j = j - 1; j < nname; j++) {
+ svalue0 = nl[j].svalue;
+ svalue1 = nl[j+1].svalue;
+ /*
+ * if high end of tick is below entry address,
+ * go for next tick.
+ */
+ if (pch < svalue0)
+ break;
+ /*
+ * if low end of tick into next routine,
+ * go for next routine.
+ */
+ if (pcl >= svalue1)
+ continue;
+ overlap = min(pch, svalue1) - max(pcl, svalue0);
+ if (overlap > 0) {
+# ifdef DEBUG
+ if (debug & SAMPLEDEBUG) {
+ printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %lu overlap\n",
+ nl[j].value / HISTORICAL_SCALE_2,
+ svalue0, svalue1, nl[j].name,
+ overlap * thetime / scale, overlap);
+ }
+# endif /* DEBUG */
+ nl[j].time += overlap * thetime / scale;
+ }
+ }
+ }
+# ifdef DEBUG
+ if (debug & SAMPLEDEBUG) {
+ printf("[asgnsamples] totime %f\n", totime);
+ }
+# endif /* DEBUG */
+}
+
+
+unsigned long
+min(unsigned long a, unsigned long b)
+{
+ if (a<b)
+ return(a);
+ return(b);
+}
+
+unsigned long
+max(unsigned long a, unsigned long b)
+{
+ if (a>b)
+ return(a);
+ return(b);
+}
+
+ /*
+ * calculate scaled entry point addresses (to save time in asgnsamples),
+ * and possibly push the scaled entry points over the entry mask,
+ * if it turns out that the entry point is in one bucket and the code
+ * for a routine is in the next bucket.
+ */
+void
+alignentries(void)
+{
+ register struct nl *nlp;
+ unsigned long bucket_of_entry;
+ unsigned long bucket_of_code;
+
+ for (nlp = nl; nlp < npe; nlp++) {
+ nlp -> svalue = nlp -> value / HISTORICAL_SCALE_2;
+ bucket_of_entry = (nlp->svalue - lowpc) / scale;
+ bucket_of_code = (nlp->svalue + OFFSET_OF_CODE / HISTORICAL_SCALE_2 -
+ lowpc) / scale;
+ if (bucket_of_entry < bucket_of_code) {
+# ifdef DEBUG
+ if (debug & SAMPLEDEBUG) {
+ printf("[alignentries] pushing svalue 0x%lx to 0x%lx\n",
+ nlp->svalue,
+ nlp->svalue + OFFSET_OF_CODE / HISTORICAL_SCALE_2);
+ }
+# endif /* DEBUG */
+ nlp->svalue += OFFSET_OF_CODE / HISTORICAL_SCALE_2;
+ }
+ }
+}
diff --git a/usr.bin/gprof/gprof.callg b/usr.bin/gprof/gprof.callg
new file mode 100644
index 0000000..533c96c
--- /dev/null
+++ b/usr.bin/gprof/gprof.callg
@@ -0,0 +1,108 @@
+
+
+
+call graph profile:
+ The sum of self and descendents is the major sort
+ for this listing.
+
+ function entries:
+
+index the index of the function in the call graph
+ listing, as an aid to locating it (see below).
+
+%time the percentage of the total time of the program
+ accounted for by this function and its
+ descendents.
+
+self the number of seconds spent in this function
+ itself.
+
+descendents
+ the number of seconds spent in the descendents of
+ this function on behalf of this function.
+
+called the number of times this function is called (other
+ than recursive calls).
+
+self the number of times this function calls itself
+ recursively.
+
+name the name of the function, with an indication of
+ its membership in a cycle, if any.
+
+index the index of the function in the call graph
+ listing, as an aid to locating it.
+
+
+
+ parent listings:
+
+self* the number of seconds of this function's self time
+ which is due to calls from this parent.
+
+descendents*
+ the number of seconds of this function's
+ descendent time which is due to calls from this
+ parent.
+
+called** the number of times this function is called by
+ this parent. This is the numerator of the
+ fraction which divides up the function's time to
+ its parents.
+
+total* the number of times this function was called by
+ all of its parents. This is the denominator of
+ the propagation fraction.
+
+parents the name of this parent, with an indication of the
+ parent's membership in a cycle, if any.
+
+index the index of this parent in the call graph
+ listing, as an aid in locating it.
+
+
+
+ children listings:
+
+self* the number of seconds of this child's self time
+ which is due to being called by this function.
+
+descendent*
+ the number of seconds of this child's descendent's
+ time which is due to being called by this
+ function.
+
+called** the number of times this child is called by this
+ function. This is the numerator of the
+ propagation fraction for this child.
+
+total* the number of times this child is called by all
+ functions. This is the denominator of the
+ propagation fraction.
+
+children the name of this child, and an indication of its
+ membership in a cycle, if any.
+
+index the index of this child in the call graph listing,
+ as an aid to locating it.
+
+
+
+ * these fields are omitted for parents (or
+ children) in the same cycle as the function. If
+ the function (or child) is a member of a cycle,
+ the propagated times and propagation denominator
+ represent the self time and descendent time of the
+ cycle as a whole.
+
+ ** static-only parents and children are indicated
+ by a call count of 0.
+
+
+
+ cycle listings:
+ the cycle as a whole is listed with the same
+ fields as a function entry. Below it are listed
+ the members of the cycle, and their contributions
+ to the time and call counts of the cycle.
+
diff --git a/usr.bin/gprof/gprof.flat b/usr.bin/gprof/gprof.flat
new file mode 100644
index 0000000..60999a3
--- /dev/null
+++ b/usr.bin/gprof/gprof.flat
@@ -0,0 +1,32 @@
+
+
+
+flat profile:
+
+ % the percentage of the total running time of the
+time program used by this function.
+
+cumulative a running sum of the number of seconds accounted
+ seconds for by this function and those listed above it.
+
+ self the number of seconds accounted for by this
+seconds function alone. This is the major sort for this
+ listing.
+
+calls the number of times this function was invoked, if
+ this function is profiled, else blank.
+
+ self the average number of milliseconds spent in this
+ms/call function per call, if this function is profiled,
+ else blank.
+
+ total the average number of milliseconds spent in this
+ms/call function and its descendents per call, if this
+ function is profiled, else blank.
+
+name the name of the function. This is the minor sort
+ for this listing. The index shows the location of
+ the function in the gprof listing. If the index is
+ in parenthesis it shows where it would appear in
+ the gprof listing if it were to be printed.
+
diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h
new file mode 100644
index 0000000..c8140eb
--- /dev/null
+++ b/usr.bin/gprof/gprof.h
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 1983, 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.
+ *
+ * @(#)gprof.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/gmon.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if __amd64__
+# include "amd64.h"
+#endif
+#if __arm__
+# include "arm.h"
+#endif
+#if __i386__
+# include "i386.h"
+#endif
+#if __mips__
+# include "mips.h"
+#endif
+#if __powerpc__
+# include "powerpc.h"
+#endif
+#if __sparc64__
+# include "sparc64.h"
+#endif
+
+ /*
+ * booleans
+ */
+typedef int bool;
+#define FALSE 0
+#define TRUE 1
+
+ /*
+ * Historical scale factor in profil(2)'s algorithm for converting
+ * pc addresses to bucket numbers. This now just complicates the
+ * scaling and makes bucket:pc densities of more than 1/2 useless.
+ */
+#define HISTORICAL_SCALE_2 2
+
+ /*
+ * ticks per second
+ */
+long hz;
+
+size_t histcounter_size;
+int histcounter_type;
+
+char *a_outname;
+#define A_OUTNAME "a.out"
+
+char *gmonname;
+#define GMONSUM "gmon.sum"
+
+ /*
+ * a constructed arc,
+ * with pointers to the namelist entry of the parent and the child,
+ * a count of how many times this arc was traversed,
+ * and pointers to the next parent of this child and
+ * the next child of this parent.
+ */
+struct arcstruct {
+ struct nl *arc_parentp; /* pointer to parent's nl entry */
+ struct nl *arc_childp; /* pointer to child's nl entry */
+ long arc_count; /* num calls from parent to child */
+ double arc_time; /* time inherited along arc */
+ double arc_childtime; /* childtime inherited along arc */
+ struct arcstruct *arc_parentlist; /* parents-of-this-child list */
+ struct arcstruct *arc_childlist; /* children-of-this-parent list */
+ struct arcstruct *arc_next; /* list of arcs on cycle */
+ unsigned short arc_cyclecnt; /* num cycles involved in */
+ unsigned short arc_flags; /* see below */
+};
+typedef struct arcstruct arctype;
+
+ /*
+ * arc flags
+ */
+#define DEADARC 0x01 /* time should not propagate across the arc */
+#define ONLIST 0x02 /* arc is on list of arcs in cycles */
+
+ /*
+ * The symbol table;
+ * for each external in the specified file we gather
+ * its address, the number of calls and compute its share of CPU time.
+ */
+struct nl {
+ const char *name; /* the name */
+ unsigned long value; /* the pc entry point */
+ unsigned long svalue; /* entry point aligned to histograms */
+ double time; /* ticks in this routine */
+ double childtime; /* cumulative ticks in children */
+ long ncall; /* how many times called */
+ long npropcall; /* times called by live arcs */
+ long selfcalls; /* how many calls to self */
+ double propfraction; /* what % of time propagates */
+ double propself; /* how much self time propagates */
+ double propchild; /* how much child time propagates */
+ short printflag; /* should this be printed? */
+ short flags; /* see below */
+ int index; /* index in the graph list */
+ int toporder; /* graph call chain top-sort order */
+ int cycleno; /* internal number of cycle on */
+ int parentcnt; /* number of live parent arcs */
+ struct nl *cyclehead; /* pointer to head of cycle */
+ struct nl *cnext; /* pointer to next member of cycle */
+ arctype *parents; /* list of caller arcs */
+ arctype *children; /* list of callee arcs */
+};
+typedef struct nl nltype;
+
+nltype *nl; /* the whole namelist */
+nltype *npe; /* the virtual end of the namelist */
+int nname; /* the number of function names */
+
+#define HASCYCLEXIT 0x08 /* node has arc exiting from cycle */
+#define CYCLEHEAD 0x10 /* node marked as head of a cycle */
+#define VISITED 0x20 /* node visited during a cycle */
+
+ /*
+ * The cycle list.
+ * for each subcycle within an identified cycle, we gather
+ * its size and the list of included arcs.
+ */
+struct cl {
+ int size; /* length of cycle */
+ struct cl *next; /* next member of list */
+ arctype *list[1]; /* list of arcs in cycle */
+ /* actually longer */
+};
+typedef struct cl cltype;
+
+arctype *archead; /* the head of arcs in current cycle list */
+cltype *cyclehead; /* the head of the list */
+int cyclecnt; /* the number of cycles found */
+#define CYCLEMAX 100 /* maximum cycles before cutting one of them */
+
+ /*
+ * flag which marks a nl entry as topologically ``busy''
+ * flag which marks a nl entry as topologically ``not_numbered''
+ */
+#define DFN_BUSY -1
+#define DFN_NAN 0
+
+ /*
+ * namelist entries for cycle headers.
+ * the number of discovered cycles.
+ */
+nltype *cyclenl; /* cycle header namelist */
+int ncycle; /* number of cycles discovered */
+
+ /*
+ * The header on the gmon.out file.
+ * gmon.out consists of a struct phdr (defined in gmon.h)
+ * and then an array of ncnt samples representing the
+ * discretized program counter values.
+ *
+ * Backward compatible old style header
+ */
+struct ophdr {
+ u_short *lpc;
+ u_short *hpc;
+ int ncnt;
+};
+
+int debug;
+
+ /*
+ * Each discretized pc sample has
+ * a count of the number of samples in its range
+ */
+double *samples;
+
+unsigned long s_lowpc; /* lowpc from the profile file */
+unsigned long s_highpc; /* highpc from the profile file */
+unsigned long lowpc, highpc; /* range profiled, in historical units */
+unsigned sampbytes; /* number of bytes of samples */
+int nsamples; /* number of samples */
+double actime; /* accumulated time thus far for putprofline */
+double totime; /* total time for all routines */
+double printtime; /* total of time being printed */
+double scale; /* scale factor converting samples to pc
+ values: each sample covers scale bytes */
+unsigned char *textspace; /* text space of a.out in core */
+int cyclethreshold; /* with -C, minimum cycle size to ignore */
+
+ /*
+ * option flags, from a to z.
+ */
+bool aflag; /* suppress static functions */
+bool bflag; /* blurbs, too */
+bool Cflag; /* find cut-set to eliminate cycles */
+bool dflag; /* debugging options */
+bool eflag; /* specific functions excluded */
+bool Eflag; /* functions excluded with time */
+bool fflag; /* specific functions requested */
+bool Fflag; /* functions requested with time */
+bool kflag; /* arcs to be deleted */
+bool Kflag; /* use the running kernel for symbols */
+bool sflag; /* sum multiple gmon.out files */
+bool uflag; /* suppress symbols hidden from C */
+bool zflag; /* zero time/called functions, too */
+
+ /*
+ * structure for various string lists
+ */
+struct stringlist {
+ struct stringlist *next;
+ char *string;
+};
+struct stringlist *elist;
+struct stringlist *Elist;
+struct stringlist *flist;
+struct stringlist *Flist;
+struct stringlist *kfromlist;
+struct stringlist *ktolist;
+
+ /*
+ * function declarations
+ */
+void addarc(nltype *, nltype *, long);
+bool addcycle(arctype **, arctype **);
+void addlist(struct stringlist *, char *);
+void alignentries(void);
+int aout_getnfile(const char *, char ***);
+int arccmp(arctype *, arctype *);
+arctype *arclookup(nltype *, nltype *);
+void asgnsamples(void);
+void compresslist(void);
+bool cycleanalyze(void);
+void cyclelink(void);
+void cycletime(void);
+bool descend(nltype *, arctype **, arctype **);
+void dfn(nltype *);
+bool dfn_busy(nltype *);
+void dfn_findcycle(nltype *);
+void dfn_init(void);
+bool dfn_numbered(nltype *);
+void dfn_post_visit(nltype *);
+void dfn_pre_visit(nltype *);
+void dfn_self_cycle(nltype *);
+nltype **doarcs(void);
+void doflags(void);
+void dotime(void);
+void dumpsum(const char *);
+int elf_getnfile(const char *, char ***);
+void flatprofheader(void);
+void flatprofline(nltype *);
+void getpfile(char *);
+void gprofheader(void);
+void gprofline(register nltype *);
+int hertz(void);
+void inheritflags(nltype *);
+int kernel_getnfile(const char *, char ***);
+/*
+ main();
+*/
+unsigned long max(unsigned long, unsigned long);
+int membercmp(nltype *, nltype *);
+unsigned long min(unsigned long, unsigned long);
+nltype *nllookup(unsigned long);
+bool onlist(struct stringlist *, const char *);
+FILE *openpfile(char *);
+void printblurb(const char *);
+void printchildren(nltype *);
+void printcycle(nltype *);
+void printgprof(nltype **);
+void printindex(void);
+void printmembers(nltype *);
+void printname(nltype *);
+void printparents(nltype *);
+void printprof(void);
+void printsubcycle(cltype *);
+void readsamples(FILE *);
+void sortchildren(nltype *);
+void sortmembers(nltype *);
+void sortparents(nltype *);
+void tally(struct rawarc *);
+void timepropagate(nltype *);
+int totalcmp(const void *, const void *);
+
+#define LESSTHAN -1
+#define EQUALTO 0
+#define GREATERTHAN 1
+
+#define DFNDEBUG 1
+#define CYCLEDEBUG 2
+#define ARCDEBUG 4
+#define TALLYDEBUG 8
+#define TIMEDEBUG 16
+#define SAMPLEDEBUG 32
+#define AOUTDEBUG 64
+#define CALLDEBUG 128
+#define LOOKUPDEBUG 256
+#define PROPDEBUG 512
+#define BREAKCYCLE 1024
+#define SUBCYCLELIST 2048
+#define ANYDEBUG 4096
diff --git a/usr.bin/gprof/hertz.c b/usr.bin/gprof/hertz.c
new file mode 100644
index 0000000..9a8a2b1
--- /dev/null
+++ b/usr.bin/gprof/hertz.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)hertz.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/time.h>
+
+ /*
+ * discover the tick frequency of the machine
+ * if something goes wrong, we return 0, an impossible hertz.
+ */
+#define HZ_WRONG 0
+
+int hertz(void);
+
+int
+hertz(void)
+{
+ struct itimerval tim;
+
+ tim.it_interval.tv_sec = 0;
+ tim.it_interval.tv_usec = 1;
+ tim.it_value.tv_sec = 0;
+ tim.it_value.tv_usec = 0;
+ setitimer(ITIMER_REAL, &tim, 0);
+ setitimer(ITIMER_REAL, 0, &tim);
+ if (tim.it_interval.tv_usec < 2)
+ return(HZ_WRONG);
+ return (1000000 / tim.it_interval.tv_usec);
+}
diff --git a/usr.bin/gprof/i386.h b/usr.bin/gprof/i386.h
new file mode 100644
index 0000000..58b92c5
--- /dev/null
+++ b/usr.bin/gprof/i386.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)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
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/gprof/kernel.c b/usr.bin/gprof/kernel.c
new file mode 100644
index 0000000..7af9897
--- /dev/null
+++ b/usr.bin/gprof/kernel.c
@@ -0,0 +1,64 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/linker.h>
+#include <sys/sysctl.h>
+#include <sys/errno.h>
+
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gprof.h"
+
+/* Things which get -E excluded by default. */
+static char *excludes[] = { ".mcount", "_mcleanup", NULL };
+
+int
+kernel_getnfile(const char *unused __unused, char ***defaultEs)
+{
+ char *namelist;
+ size_t len;
+ char *name;
+
+ if (sysctlbyname("kern.function_list", NULL, &len, NULL, 0) == -1)
+ err(1, "sysctlbyname: function_list size");
+ for (;;) {
+ namelist = malloc(len);
+ if (namelist == NULL)
+ err(1, "malloc");
+ if (sysctlbyname("kern.function_list", namelist, &len, NULL,
+ 0) == 0)
+ break;
+ if (errno == ENOMEM)
+ free(namelist);
+ else
+ err(1, "sysctlbyname: function_list");
+ }
+ nname = 0;
+ for (name = namelist; *name != '\0'; name += strlen(name) + 1)
+ nname++;
+ /* Allocate memory for them, plus a terminating entry. */
+ if ((nl = (nltype *)calloc(nname + 1, sizeof(nltype))) == NULL)
+ errx(1, "Insufficient memory for symbol table");
+ npe = nl;
+ for (name = namelist; *name != '\0'; name += strlen(name) + 1) {
+ struct kld_sym_lookup ksl;
+
+ ksl.version = sizeof(ksl);
+ ksl.symname = name;
+ if (kldsym(0, KLDSYM_LOOKUP, &ksl))
+ err(1, "kldsym(%s)", name);
+ /* aflag not supported */
+ if (uflag && strchr(name, '.') != NULL)
+ continue;
+ npe->value = ksl.symvalue;
+ npe->name = name;
+ npe++;
+ }
+ npe->value = -1;
+
+ *defaultEs = excludes;
+ return (0);
+}
diff --git a/usr.bin/gprof/lookup.c b/usr.bin/gprof/lookup.c
new file mode 100644
index 0000000..0ef1e0b
--- /dev/null
+++ b/usr.bin/gprof/lookup.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "gprof.h"
+
+ /*
+ * look up an address in a sorted-by-address namelist
+ * this deals with misses by mapping them to the next lower
+ * entry point.
+ */
+nltype *
+nllookup(unsigned long address)
+{
+ register long low;
+ register long middle;
+ register long high;
+# ifdef DEBUG
+ register int probes;
+
+ probes = 0;
+# endif /* DEBUG */
+ for ( low = 0 , high = nname - 1 ; low != high ; ) {
+# ifdef DEBUG
+ probes += 1;
+# endif /* DEBUG */
+ middle = ( high + low ) >> 1;
+ if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) {
+# ifdef DEBUG
+ if ( debug & LOOKUPDEBUG ) {
+ printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 );
+ }
+# endif /* DEBUG */
+#if defined(__arm__)
+ if (nl[middle].name[0] == '$' &&
+ nl[middle-1].value == nl[middle].value)
+ middle--;
+#endif
+
+ return &nl[ middle ];
+ }
+ if ( nl[ middle ].value > address ) {
+ high = middle;
+ } else {
+ low = middle + 1;
+ }
+ }
+# ifdef DEBUG
+ if ( debug & LOOKUPDEBUG ) {
+ fprintf( stderr , "[nllookup] (%d) binary search fails\n" ,
+ nname-1 );
+ }
+# endif /* DEBUG */
+ return 0;
+}
+
+arctype *
+arclookup(nltype *parentp, nltype *childp)
+{
+ arctype *arcp;
+
+ if ( parentp == 0 || childp == 0 ) {
+ fprintf( stderr, "[arclookup] parentp == 0 || childp == 0\n" );
+ return 0;
+ }
+# ifdef DEBUG
+ if ( debug & LOOKUPDEBUG ) {
+ printf( "[arclookup] parent %s child %s\n" ,
+ parentp -> name , childp -> name );
+ }
+# endif /* DEBUG */
+ for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+# ifdef DEBUG
+ if ( debug & LOOKUPDEBUG ) {
+ printf( "[arclookup]\t arc_parent %s arc_child %s\n" ,
+ arcp -> arc_parentp -> name ,
+ arcp -> arc_childp -> name );
+ }
+# endif /* DEBUG */
+ if ( arcp -> arc_childp == childp ) {
+ return arcp;
+ }
+ }
+ return 0;
+}
diff --git a/usr.bin/gprof/mips.h b/usr.bin/gprof/mips.h
new file mode 100644
index 0000000..e6a1c9c
--- /dev/null
+++ b/usr.bin/gprof/mips.h
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley. Modified by Ralph Campbell for mips.
+ *
+ * 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.
+ *
+ * @(#)mips.h 8.1 (Berkeley) 6/6/93
+ * From: @(#)sparc.h 5.1 (Berkeley) 7/8/92
+ * $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
+#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/gprof/pathnames.h b/usr.bin/gprof/pathnames.h
new file mode 100644
index 0000000..f88bea0
--- /dev/null
+++ b/usr.bin/gprof/pathnames.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define _PATH_FLAT_BLURB "/usr/share/misc/gprof.flat"
+#define _PATH_CALLG_BLURB "/usr/share/misc/gprof.callg"
+
diff --git a/usr.bin/gprof/powerpc.h b/usr.bin/gprof/powerpc.h
new file mode 100644
index 0000000..58b92c5
--- /dev/null
+++ b/usr.bin/gprof/powerpc.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)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
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c
new file mode 100644
index 0000000..303365a
--- /dev/null
+++ b/usr.bin/gprof/printgprof.c
@@ -0,0 +1,746 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)printgprof.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <string.h>
+
+#include "gprof.h"
+#include "pathnames.h"
+
+int namecmp(const void *, const void *);
+int timecmp(const void *, const void *);
+
+void
+printprof(void)
+{
+ register nltype *np;
+ nltype **sortednlp;
+ int idx;
+
+ actime = 0.0;
+ printf( "\f\n" );
+ flatprofheader();
+ /*
+ * Sort the symbol table in by time
+ */
+ sortednlp = (nltype **) calloc( nname , sizeof(nltype *) );
+ if ( sortednlp == (nltype **) 0 )
+ errx( 1 , "[printprof] ran out of memory for time sorting" );
+ for ( idx = 0 ; idx < nname ; idx += 1 ) {
+ sortednlp[ idx ] = &nl[ idx ];
+ }
+ qsort( sortednlp , nname , sizeof(nltype *) , timecmp );
+ for ( idx = 0 ; idx < nname ; idx += 1 ) {
+ np = sortednlp[ idx ];
+ flatprofline( np );
+ }
+ actime = 0.0;
+ free( sortednlp );
+}
+
+int
+timecmp(const void *v1, const void *v2)
+{
+ const nltype **npp1 = (const nltype **)v1;
+ const nltype **npp2 = (const nltype **)v2;
+ double timediff;
+ long calldiff;
+
+ timediff = (*npp2) -> time - (*npp1) -> time;
+ if ( timediff > 0.0 )
+ return 1 ;
+ if ( timediff < 0.0 )
+ return -1;
+ calldiff = (*npp2) -> ncall - (*npp1) -> ncall;
+ if ( calldiff > 0 )
+ return 1;
+ if ( calldiff < 0 )
+ return -1;
+ return( strcmp( (*npp1) -> name , (*npp2) -> name ) );
+}
+
+ /*
+ * header for flatprofline
+ */
+void
+flatprofheader(void)
+{
+
+ if ( bflag ) {
+ printblurb( _PATH_FLAT_BLURB );
+ }
+ printf( "\ngranularity: each sample hit covers %g byte(s)" ,
+ scale * HISTORICAL_SCALE_2 );
+ if ( totime > 0.0 ) {
+ printf( " for %.2f%% of %.2f seconds\n\n" ,
+ 100.0/totime , totime / hz );
+ } else {
+ printf( " no time accumulated\n\n" );
+ /*
+ * this doesn't hurt since all the numerators will be zero.
+ */
+ totime = 1.0;
+ }
+ printf( "%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s %-8.8s\n" ,
+ "% " , "cumulative" , "self " , "" , "self " , "total " , "" );
+ printf( "%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s %-8.8s\n" ,
+ "time" , "seconds " , "seconds" , "calls" ,
+ hz >= 10000000 ? "ns/call" : hz >= 10000 ? "us/call" : "ms/call" ,
+ hz >= 10000000 ? "ns/call" : hz >= 10000 ? "us/call" : "ms/call" ,
+ "name" );
+}
+
+void
+flatprofline(register nltype *np)
+{
+
+ if ( zflag == 0 && np -> ncall == 0 && np -> time == 0 &&
+ np -> childtime == 0 ) {
+ return;
+ }
+ actime += np -> time;
+ if (hz >= 10000)
+ printf( "%5.1f %10.3f %8.3f" ,
+ 100 * np -> time / totime , actime / hz , np -> time / hz );
+ else
+ printf( "%5.1f %10.2f %8.2f" ,
+ 100 * np -> time / totime , actime / hz , np -> time / hz );
+ if ( np -> ncall != 0 ) {
+ if (hz >= 10000000)
+ printf( " %8ld %8.0f %8.0f " , np -> ncall ,
+ 1e9 * np -> time / hz / np -> ncall ,
+ 1e9 * ( np -> time + np -> childtime ) / hz / np -> ncall );
+ else if (hz >= 10000)
+ printf( " %8ld %8.0f %8.0f " , np -> ncall ,
+ 1e6 * np -> time / hz / np -> ncall ,
+ 1e6 * ( np -> time + np -> childtime ) / hz / np -> ncall );
+ else
+ printf( " %8ld %8.2f %8.2f " , np -> ncall ,
+ 1000 * np -> time / hz / np -> ncall ,
+ 1000 * ( np -> time + np -> childtime ) / hz / np -> ncall );
+ } else if ( np -> time != 0 || np -> childtime != 0 ) {
+ printf( " %8ld %7.2f%% %8.8s " , np -> ncall ,
+ 100 * np -> time / ( np -> time + np -> childtime ) , "" );
+ } else {
+ printf( " %8.8s %8.8s %8.8s " , "" , "" , "" );
+ }
+ printname( np );
+ printf( "\n" );
+}
+
+void
+gprofheader(void)
+{
+
+ if ( bflag ) {
+ printblurb( _PATH_CALLG_BLURB );
+ }
+ printf( "\ngranularity: each sample hit covers %g byte(s)" ,
+ scale * HISTORICAL_SCALE_2 );
+ if ( printtime > 0.0 ) {
+ printf( " for %.2f%% of %.2f seconds\n\n" ,
+ 100.0/printtime , printtime / hz );
+ } else {
+ printf( " no time propagated\n\n" );
+ /*
+ * this doesn't hurt, since all the numerators will be 0.0
+ */
+ printtime = 1.0;
+ }
+ printf( "%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n" ,
+ "" , "" , "" , "" , "called" , "total" , "parents");
+ printf( "%-6.6s %5.5s %7.7s %11.11s %7.7s+%-7.7s %-8.8s\t%5.5s\n" ,
+ "index" , "%time" , "self" , "descendents" ,
+ "called" , "self" , "name" , "index" );
+ printf( "%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n" ,
+ "" , "" , "" , "" , "called" , "total" , "children");
+ printf( "\n" );
+}
+
+void
+gprofline(register nltype *np)
+{
+ char kirkbuffer[ BUFSIZ ];
+
+ sprintf( kirkbuffer , "[%d]" , np -> index );
+ printf( "%-6.6s %5.1f %7.2f %11.2f" ,
+ kirkbuffer ,
+ 100 * ( np -> propself + np -> propchild ) / printtime ,
+ np -> propself / hz ,
+ np -> propchild / hz );
+ if ( ( np -> ncall + np -> selfcalls ) != 0 ) {
+ printf( " %7ld" , np -> npropcall );
+ if ( np -> selfcalls != 0 ) {
+ printf( "+%-7ld " , np -> selfcalls );
+ } else {
+ printf( " %7.7s " , "" );
+ }
+ } else {
+ printf( " %7.7s %7.7s " , "" , "" );
+ }
+ printname( np );
+ printf( "\n" );
+}
+
+void
+printgprof(nltype **timesortnlp)
+{
+ int idx;
+ nltype *parentp;
+
+ /*
+ * Print out the structured profiling list
+ */
+ gprofheader();
+ for ( idx = 0 ; idx < nname + ncycle ; idx ++ ) {
+ parentp = timesortnlp[ idx ];
+ if ( zflag == 0 &&
+ parentp -> ncall == 0 &&
+ parentp -> selfcalls == 0 &&
+ parentp -> propself == 0 &&
+ parentp -> propchild == 0 ) {
+ continue;
+ }
+ if ( ! parentp -> printflag ) {
+ continue;
+ }
+ if ( parentp -> name == 0 && parentp -> cycleno != 0 ) {
+ /*
+ * cycle header
+ */
+ printcycle( parentp );
+ printmembers( parentp );
+ } else {
+ printparents( parentp );
+ gprofline( parentp );
+ printchildren( parentp );
+ }
+ printf( "\n" );
+ printf( "-----------------------------------------------\n" );
+ printf( "\n" );
+ }
+ free( timesortnlp );
+}
+
+ /*
+ * sort by decreasing propagated time
+ * if times are equal, but one is a cycle header,
+ * say that's first (e.g. less, i.e. -1).
+ * if one's name doesn't have an underscore and the other does,
+ * say the one is first.
+ * all else being equal, sort by names.
+ */
+int
+totalcmp(const void *v1, const void *v2)
+{
+ const nltype **npp1 = (const nltype **)v1;
+ const nltype **npp2 = (const nltype **)v2;
+ register const nltype *np1 = *npp1;
+ register const nltype *np2 = *npp2;
+ double diff;
+
+ diff = ( np1 -> propself + np1 -> propchild )
+ - ( np2 -> propself + np2 -> propchild );
+ if ( diff < 0.0 )
+ return 1;
+ if ( diff > 0.0 )
+ return -1;
+ if ( np1 -> name == 0 && np1 -> cycleno != 0 )
+ return -1;
+ if ( np2 -> name == 0 && np2 -> cycleno != 0 )
+ return 1;
+ if ( np1 -> name == 0 )
+ return -1;
+ if ( np2 -> name == 0 )
+ return 1;
+ if ( *(np1 -> name) != '_' && *(np2 -> name) == '_' )
+ return -1;
+ if ( *(np1 -> name) == '_' && *(np2 -> name) != '_' )
+ return 1;
+ if ( np1 -> ncall > np2 -> ncall )
+ return -1;
+ if ( np1 -> ncall < np2 -> ncall )
+ return 1;
+ return strcmp( np1 -> name , np2 -> name );
+}
+
+void
+printparents(nltype *childp)
+{
+ nltype *parentp;
+ arctype *arcp;
+ nltype *cycleheadp;
+
+ if ( childp -> cyclehead != 0 ) {
+ cycleheadp = childp -> cyclehead;
+ } else {
+ cycleheadp = childp;
+ }
+ if ( childp -> parents == 0 ) {
+ printf( "%6.6s %5.5s %7.7s %11.11s %7.7s %7.7s <spontaneous>\n" ,
+ "" , "" , "" , "" , "" , "" );
+ return;
+ }
+ sortparents( childp );
+ for ( arcp = childp -> parents ; arcp ; arcp = arcp -> arc_parentlist ) {
+ parentp = arcp -> arc_parentp;
+ if ( childp == parentp || ( arcp -> arc_flags & DEADARC ) ||
+ ( childp->cycleno != 0 && parentp->cycleno == childp->cycleno ) ) {
+ /*
+ * selfcall or call among siblings
+ */
+ printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
+ "" , "" , "" , "" ,
+ arcp -> arc_count , "" );
+ printname( parentp );
+ printf( "\n" );
+ } else {
+ /*
+ * regular parent of child
+ */
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
+ "" , "" ,
+ arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
+ arcp -> arc_count , cycleheadp -> npropcall );
+ printname( parentp );
+ printf( "\n" );
+ }
+ }
+}
+
+void
+printchildren(nltype *parentp)
+{
+ nltype *childp;
+ arctype *arcp;
+
+ sortchildren( parentp );
+ arcp = parentp -> children;
+ for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
+ childp = arcp -> arc_childp;
+ if ( childp == parentp || ( arcp -> arc_flags & DEADARC ) ||
+ ( childp->cycleno != 0 && childp->cycleno == parentp->cycleno ) ) {
+ /*
+ * self call or call to sibling
+ */
+ printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
+ "" , "" , "" , "" , arcp -> arc_count , "" );
+ printname( childp );
+ printf( "\n" );
+ } else {
+ /*
+ * regular child of parent
+ */
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
+ "" , "" ,
+ arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
+ arcp -> arc_count , childp -> cyclehead -> npropcall );
+ printname( childp );
+ printf( "\n" );
+ }
+ }
+}
+
+void
+printname(nltype *selfp)
+{
+
+ if ( selfp -> name != 0 ) {
+ printf( "%s" , selfp -> name );
+# ifdef DEBUG
+ if ( debug & DFNDEBUG ) {
+ printf( "{%d} " , selfp -> toporder );
+ }
+ if ( debug & PROPDEBUG ) {
+ printf( "%5.2f%% " , selfp -> propfraction );
+ }
+# endif /* DEBUG */
+ }
+ if ( selfp -> cycleno != 0 ) {
+ printf( " <cycle %d>" , selfp -> cycleno );
+ }
+ if ( selfp -> index != 0 ) {
+ if ( selfp -> printflag ) {
+ printf( " [%d]" , selfp -> index );
+ } else {
+ printf( " (%d)" , selfp -> index );
+ }
+ }
+}
+
+void
+sortchildren(nltype *parentp)
+{
+ arctype *arcp;
+ arctype *detachedp;
+ arctype sorted;
+ arctype *prevp;
+
+ /*
+ * unlink children from parent,
+ * then insertion sort back on to sorted's children.
+ * *arcp the arc you have detached and are inserting.
+ * *detachedp the rest of the arcs to be sorted.
+ * sorted arc list onto which you insertion sort.
+ * *prevp arc before the arc you are comparing.
+ */
+ sorted.arc_childlist = 0;
+ for ( (arcp = parentp -> children)&&(detachedp = arcp -> arc_childlist);
+ arcp ;
+ (arcp = detachedp)&&(detachedp = detachedp -> arc_childlist)) {
+ /*
+ * consider *arcp as disconnected
+ * insert it into sorted
+ */
+ for ( prevp = &sorted ;
+ prevp -> arc_childlist ;
+ prevp = prevp -> arc_childlist ) {
+ if ( arccmp( arcp , prevp -> arc_childlist ) != LESSTHAN ) {
+ break;
+ }
+ }
+ arcp -> arc_childlist = prevp -> arc_childlist;
+ prevp -> arc_childlist = arcp;
+ }
+ /*
+ * reattach sorted children to parent
+ */
+ parentp -> children = sorted.arc_childlist;
+}
+
+void
+sortparents(nltype *childp)
+{
+ arctype *arcp;
+ arctype *detachedp;
+ arctype sorted;
+ arctype *prevp;
+
+ /*
+ * unlink parents from child,
+ * then insertion sort back on to sorted's parents.
+ * *arcp the arc you have detached and are inserting.
+ * *detachedp the rest of the arcs to be sorted.
+ * sorted arc list onto which you insertion sort.
+ * *prevp arc before the arc you are comparing.
+ */
+ sorted.arc_parentlist = 0;
+ for ( (arcp = childp -> parents)&&(detachedp = arcp -> arc_parentlist);
+ arcp ;
+ (arcp = detachedp)&&(detachedp = detachedp -> arc_parentlist)) {
+ /*
+ * consider *arcp as disconnected
+ * insert it into sorted
+ */
+ for ( prevp = &sorted ;
+ prevp -> arc_parentlist ;
+ prevp = prevp -> arc_parentlist ) {
+ if ( arccmp( arcp , prevp -> arc_parentlist ) != GREATERTHAN ) {
+ break;
+ }
+ }
+ arcp -> arc_parentlist = prevp -> arc_parentlist;
+ prevp -> arc_parentlist = arcp;
+ }
+ /*
+ * reattach sorted arcs to child
+ */
+ childp -> parents = sorted.arc_parentlist;
+}
+
+ /*
+ * print a cycle header
+ */
+void
+printcycle(nltype *cyclep)
+{
+ char kirkbuffer[ BUFSIZ ];
+
+ sprintf( kirkbuffer , "[%d]" , cyclep -> index );
+ printf( "%-6.6s %5.1f %7.2f %11.2f %7ld" ,
+ kirkbuffer ,
+ 100 * ( cyclep -> propself + cyclep -> propchild ) / printtime ,
+ cyclep -> propself / hz ,
+ cyclep -> propchild / hz ,
+ cyclep -> npropcall );
+ if ( cyclep -> selfcalls != 0 ) {
+ printf( "+%-7ld" , cyclep -> selfcalls );
+ } else {
+ printf( " %7.7s" , "" );
+ }
+ printf( " <cycle %d as a whole>\t[%d]\n" ,
+ cyclep -> cycleno , cyclep -> index );
+}
+
+ /*
+ * print the members of a cycle
+ */
+void
+printmembers(nltype *cyclep)
+{
+ nltype *memberp;
+
+ sortmembers( cyclep );
+ for ( memberp = cyclep -> cnext ; memberp ; memberp = memberp -> cnext ) {
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld" ,
+ "" , "" , memberp -> propself / hz , memberp -> propchild / hz ,
+ memberp -> npropcall );
+ if ( memberp -> selfcalls != 0 ) {
+ printf( "+%-7ld" , memberp -> selfcalls );
+ } else {
+ printf( " %7.7s" , "" );
+ }
+ printf( " " );
+ printname( memberp );
+ printf( "\n" );
+ }
+}
+
+ /*
+ * sort members of a cycle
+ */
+void
+sortmembers(nltype *cyclep)
+{
+ nltype *todo;
+ nltype *doing;
+ nltype *prev;
+
+ /*
+ * detach cycle members from cyclehead,
+ * and insertion sort them back on.
+ */
+ todo = cyclep -> cnext;
+ cyclep -> cnext = 0;
+ for ( (doing = todo)&&(todo = doing -> cnext);
+ doing ;
+ (doing = todo )&&(todo = doing -> cnext )){
+ for ( prev = cyclep ; prev -> cnext ; prev = prev -> cnext ) {
+ if ( membercmp( doing , prev -> cnext ) == GREATERTHAN ) {
+ break;
+ }
+ }
+ doing -> cnext = prev -> cnext;
+ prev -> cnext = doing;
+ }
+}
+
+ /*
+ * major sort is on propself + propchild,
+ * next is sort on ncalls + selfcalls.
+ */
+int
+membercmp(nltype *this, nltype *that)
+{
+ double thistime = this -> propself + this -> propchild;
+ double thattime = that -> propself + that -> propchild;
+ long thiscalls = this -> ncall + this -> selfcalls;
+ long thatcalls = that -> ncall + that -> selfcalls;
+
+ if ( thistime > thattime ) {
+ return GREATERTHAN;
+ }
+ if ( thistime < thattime ) {
+ return LESSTHAN;
+ }
+ if ( thiscalls > thatcalls ) {
+ return GREATERTHAN;
+ }
+ if ( thiscalls < thatcalls ) {
+ return LESSTHAN;
+ }
+ return EQUALTO;
+}
+ /*
+ * compare two arcs to/from the same child/parent.
+ * - if one arc is a self arc, it's least.
+ * - if one arc is within a cycle, it's less than.
+ * - if both arcs are within a cycle, compare arc counts.
+ * - if neither arc is within a cycle, compare with
+ * arc_time + arc_childtime as major key
+ * arc count as minor key
+ */
+int
+arccmp(arctype *thisp, arctype *thatp)
+{
+ nltype *thisparentp = thisp -> arc_parentp;
+ nltype *thischildp = thisp -> arc_childp;
+ nltype *thatparentp = thatp -> arc_parentp;
+ nltype *thatchildp = thatp -> arc_childp;
+ double thistime;
+ double thattime;
+
+# ifdef DEBUG
+ if ( debug & TIMEDEBUG ) {
+ printf( "[arccmp] " );
+ printname( thisparentp );
+ printf( " calls " );
+ printname ( thischildp );
+ printf( " %f + %f %ld/%ld\n" ,
+ thisp -> arc_time , thisp -> arc_childtime ,
+ thisp -> arc_count , thischildp -> ncall );
+ printf( "[arccmp] " );
+ printname( thatparentp );
+ printf( " calls " );
+ printname( thatchildp );
+ printf( " %f + %f %ld/%ld\n" ,
+ thatp -> arc_time , thatp -> arc_childtime ,
+ thatp -> arc_count , thatchildp -> ncall );
+ printf( "\n" );
+ }
+# endif /* DEBUG */
+ if ( thisparentp == thischildp ) {
+ /* this is a self call */
+ return LESSTHAN;
+ }
+ if ( thatparentp == thatchildp ) {
+ /* that is a self call */
+ return GREATERTHAN;
+ }
+ if ( thisparentp -> cycleno != 0 && thischildp -> cycleno != 0 &&
+ thisparentp -> cycleno == thischildp -> cycleno ) {
+ /* this is a call within a cycle */
+ if ( thatparentp -> cycleno != 0 && thatchildp -> cycleno != 0 &&
+ thatparentp -> cycleno == thatchildp -> cycleno ) {
+ /* that is a call within the cycle, too */
+ if ( thisp -> arc_count < thatp -> arc_count ) {
+ return LESSTHAN;
+ }
+ if ( thisp -> arc_count > thatp -> arc_count ) {
+ return GREATERTHAN;
+ }
+ return EQUALTO;
+ } else {
+ /* that isn't a call within the cycle */
+ return LESSTHAN;
+ }
+ } else {
+ /* this isn't a call within a cycle */
+ if ( thatparentp -> cycleno != 0 && thatchildp -> cycleno != 0 &&
+ thatparentp -> cycleno == thatchildp -> cycleno ) {
+ /* that is a call within a cycle */
+ return GREATERTHAN;
+ } else {
+ /* neither is a call within a cycle */
+ thistime = thisp -> arc_time + thisp -> arc_childtime;
+ thattime = thatp -> arc_time + thatp -> arc_childtime;
+ if ( thistime < thattime )
+ return LESSTHAN;
+ if ( thistime > thattime )
+ return GREATERTHAN;
+ if ( thisp -> arc_count < thatp -> arc_count )
+ return LESSTHAN;
+ if ( thisp -> arc_count > thatp -> arc_count )
+ return GREATERTHAN;
+ return EQUALTO;
+ }
+ }
+}
+
+void
+printblurb(const char *blurbname)
+{
+ FILE *blurbfile;
+ int input;
+
+ blurbfile = fopen( blurbname , "r" );
+ if ( blurbfile == NULL ) {
+ warn( "%s" , blurbname );
+ return;
+ }
+ while ( ( input = getc( blurbfile ) ) != EOF ) {
+ putchar( input );
+ }
+ fclose( blurbfile );
+}
+
+int
+namecmp(const void *v1, const void *v2)
+{
+ const nltype **npp1 = (const nltype **)v1;
+ const nltype **npp2 = (const nltype **)v2;
+
+ return( strcmp( (*npp1) -> name , (*npp2) -> name ) );
+}
+
+void
+printindex(void)
+{
+ nltype **namesortnlp;
+ register nltype *nlp;
+ int idx, nnames, todo, i, j;
+ char peterbuffer[ BUFSIZ ];
+
+ /*
+ * Now, sort regular function name alphabetically
+ * to create an index.
+ */
+ namesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) );
+ if ( namesortnlp == (nltype **) 0 )
+ errx( 1 , "ran out of memory for sorting");
+ for ( idx = 0 , nnames = 0 ; idx < nname ; idx++ ) {
+ if ( zflag == 0 && nl[idx].ncall == 0 && nl[idx].time == 0 )
+ continue;
+ namesortnlp[nnames++] = &nl[idx];
+ }
+ qsort( namesortnlp , nnames , sizeof(nltype *) , namecmp );
+ for ( idx = 1 , todo = nnames ; idx <= ncycle ; idx++ ) {
+ namesortnlp[todo++] = &cyclenl[idx];
+ }
+ printf( "\f\nIndex by function name\n\n" );
+ idx = ( todo + 2 ) / 3;
+ for ( i = 0; i < idx ; i++ ) {
+ for ( j = i; j < todo ; j += idx ) {
+ nlp = namesortnlp[ j ];
+ if ( nlp -> printflag ) {
+ sprintf( peterbuffer , "[%d]" , nlp -> index );
+ } else {
+ sprintf( peterbuffer , "(%d)" , nlp -> index );
+ }
+ if ( j < nnames ) {
+ printf( "%6.6s %-19.19s" , peterbuffer , nlp -> name );
+ } else {
+ printf( "%6.6s " , peterbuffer );
+ sprintf( peterbuffer , "<cycle %d>" , nlp -> cycleno );
+ printf( "%-19.19s" , peterbuffer );
+ }
+ }
+ printf( "\n" );
+ }
+ free( namesortnlp );
+}
diff --git a/usr.bin/gprof/printlist.c b/usr.bin/gprof/printlist.c
new file mode 100644
index 0000000..a8eb6b6
--- /dev/null
+++ b/usr.bin/gprof/printlist.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)printlist.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <string.h>
+
+#include "gprof.h"
+
+ /*
+ * these are the lists of names:
+ * there is the list head and then the listname
+ * is a pointer to the list head
+ * (for ease of passing to stringlist functions).
+ */
+struct stringlist kfromhead = { 0 , 0 };
+struct stringlist *kfromlist = &kfromhead;
+struct stringlist ktohead = { 0 , 0 };
+struct stringlist *ktolist = &ktohead;
+struct stringlist fhead = { 0 , 0 };
+struct stringlist *flist = &fhead;
+struct stringlist Fhead = { 0 , 0 };
+struct stringlist *Flist = &Fhead;
+struct stringlist ehead = { 0 , 0 };
+struct stringlist *elist = &ehead;
+struct stringlist Ehead = { 0 , 0 };
+struct stringlist *Elist = &Ehead;
+
+void
+addlist(struct stringlist *listp, char *funcname)
+{
+ struct stringlist *slp;
+
+ slp = (struct stringlist *) malloc( sizeof(struct stringlist));
+ if ( slp == (struct stringlist *) 0 )
+ errx( 1 , "no room for printlist");
+ slp -> next = listp -> next;
+ slp -> string = funcname;
+ listp -> next = slp;
+}
+
+bool
+onlist(struct stringlist *listp, const char *funcname)
+{
+ struct stringlist *slp;
+
+ for ( slp = listp -> next ; slp ; slp = slp -> next ) {
+ if ( ! strcmp( slp -> string , funcname ) ) {
+ return TRUE;
+ }
+ if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
diff --git a/usr.bin/gprof/sparc64.h b/usr.bin/gprof/sparc64.h
new file mode 100644
index 0000000..58b92c5
--- /dev/null
+++ b/usr.bin/gprof/sparc64.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)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
+
+enum opermodes { dummy };
+typedef enum opermodes operandenum;
diff --git a/usr.bin/grdc/Makefile b/usr.bin/grdc/Makefile
new file mode 100644
index 0000000..be8c4b2
--- /dev/null
+++ b/usr.bin/grdc/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= grdc
+MAN= grdc.6
+DPADD= ${LIBNCURSESW}
+LIBADD= ncursesw
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/grdc/Makefile.depend b/usr.bin/grdc/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/grdc/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/grdc/grdc.6 b/usr.bin/grdc/grdc.6
new file mode 100644
index 0000000..5226a6b
--- /dev/null
+++ b/usr.bin/grdc/grdc.6
@@ -0,0 +1,33 @@
+.\" $FreeBSD$
+.Dd September 25, 2001
+.Dt GRDC 6
+.Os
+.Sh NAME
+.Nm grdc
+.Nd grand digital clock (curses)
+.Sh SYNOPSIS
+.Nm
+.Op Fl st
+.Op Ar n
+.Sh DESCRIPTION
+.Nm
+runs a digital clock made of reverse-video blanks on a curses
+compatible VDU screen.
+With an optional numeric argument
+.Ar n
+it stops after
+.Ar n
+seconds (default never).
+The optional
+.Fl s
+flag makes digits scroll as they change.
+The optional
+.Fl t
+flag tells grdc to output the time in a 12-hour format.
+In this curses mode implementation,
+the scrolling option has trouble keeping up.
+.Sh AUTHORS
+.An -nosplit
+.An Amos Shapir ,
+modified for curses by
+.An John Lupien .
diff --git a/usr.bin/grdc/grdc.c b/usr.bin/grdc/grdc.c
new file mode 100644
index 0000000..04cc00b
--- /dev/null
+++ b/usr.bin/grdc/grdc.c
@@ -0,0 +1,273 @@
+/*
+ * Grand digital clock for curses compatible terminals
+ * Usage: grdc [-st] [n] -- run for n seconds (default infinity)
+ * Flags: -s: scroll
+ * -t: output time in 12-hour format
+ *
+ *
+ * modified 10-18-89 for curses (jrl)
+ * 10-18-89 added signal handling
+ *
+ * modified 03-25-03 for 12 hour option
+ * - Samy Al Bahra <samy@kerneled.com>
+ *
+ * $FreeBSD$
+ */
+
+#include <err.h>
+#include <ncurses.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+#define YBASE 10
+#define XBASE 10
+#define XLENGTH 58
+#define YDEPTH 7
+
+static struct timespec now;
+static struct tm *tm;
+
+static short disp[11] = {
+ 075557, 011111, 071747, 071717, 055711,
+ 074717, 074757, 071111, 075757, 075717, 002020
+};
+static long old[6], next[6], new[6], mask;
+
+static volatile sig_atomic_t sigtermed;
+
+static int hascolor = 0;
+
+static void set(int, int);
+static void standt(int);
+static void movto(int, int);
+static void sighndl(int);
+static void usage(void);
+
+static void
+sighndl(int signo)
+{
+
+ sigtermed = signo;
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct timespec delay;
+ time_t prev_sec;
+ long t, a;
+ int i, j, s, k;
+ int n;
+ int ch;
+ int scrol;
+ int t12;
+
+ t12 = scrol = 0;
+
+ while ((ch = getopt(argc, argv, "ts")) != -1)
+ switch (ch) {
+ case 's':
+ scrol = 1;
+ break;
+ case 't':
+ t12 = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 1) {
+ usage();
+ /* NOTREACHED */
+ }
+
+ if (argc > 0) {
+ n = atoi(*argv) + 1;
+ if (n < 1) {
+ warnx("number of seconds is out of range");
+ usage();
+ /* NOTREACHED */
+ }
+ } else
+ n = 0;
+
+ initscr();
+
+ signal(SIGINT,sighndl);
+ signal(SIGTERM,sighndl);
+ signal(SIGHUP,sighndl);
+
+ cbreak();
+ noecho();
+ curs_set(0);
+
+ hascolor = has_colors();
+
+ if(hascolor) {
+ start_color();
+ init_pair(1, COLOR_BLACK, COLOR_RED);
+ init_pair(2, COLOR_RED, COLOR_BLACK);
+ init_pair(3, COLOR_WHITE, COLOR_BLACK);
+ attrset(COLOR_PAIR(2));
+ }
+
+ clear();
+ refresh();
+
+ if(hascolor) {
+ attrset(COLOR_PAIR(3));
+
+ mvaddch(YBASE - 2, XBASE - 3, ACS_ULCORNER);
+ hline(ACS_HLINE, XLENGTH);
+ mvaddch(YBASE - 2, XBASE - 2 + XLENGTH, ACS_URCORNER);
+
+ mvaddch(YBASE + YDEPTH - 1, XBASE - 3, ACS_LLCORNER);
+ hline(ACS_HLINE, XLENGTH);
+ mvaddch(YBASE + YDEPTH - 1, XBASE - 2 + XLENGTH, ACS_LRCORNER);
+
+ move(YBASE - 1, XBASE - 3);
+ vline(ACS_VLINE, YDEPTH);
+
+ move(YBASE - 1, XBASE - 2 + XLENGTH);
+ vline(ACS_VLINE, YDEPTH);
+
+ attrset(COLOR_PAIR(2));
+ }
+ clock_gettime(CLOCK_REALTIME_FAST, &now);
+ prev_sec = now.tv_sec;
+ do {
+ mask = 0;
+ tm = localtime(&now.tv_sec);
+ set(tm->tm_sec%10, 0);
+ set(tm->tm_sec/10, 4);
+ set(tm->tm_min%10, 10);
+ set(tm->tm_min/10, 14);
+
+ if (t12) {
+ if (tm->tm_hour < 12) {
+ if (tm->tm_hour == 0)
+ tm->tm_hour = 12;
+ mvaddstr(YBASE + 5, XBASE + 52, "AM");
+ } else {
+ if (tm->tm_hour > 12)
+ tm->tm_hour -= 12;
+ mvaddstr(YBASE + 5, XBASE + 52, "PM");
+ }
+ }
+
+ set(tm->tm_hour%10, 20);
+ set(tm->tm_hour/10, 24);
+ set(10, 7);
+ set(10, 17);
+ for(k=0; k<6; k++) {
+ if(scrol) {
+ for(i=0; i<5; i++)
+ new[i] = (new[i]&~mask) | (new[i+1]&mask);
+ new[5] = (new[5]&~mask) | (next[k]&mask);
+ } else
+ new[k] = (new[k]&~mask) | (next[k]&mask);
+ next[k] = 0;
+ for(s=1; s>=0; s--) {
+ standt(s);
+ for(i=0; i<6; i++) {
+ if((a = (new[i]^old[i])&(s ? new : old)[i]) != 0) {
+ for(j=0,t=1<<26; t; t>>=1,j++) {
+ if(a&t) {
+ if(!(a&(t<<1))) {
+ movto(YBASE + i, XBASE + 2*j);
+ }
+ addstr(" ");
+ }
+ }
+ }
+ if(!s) {
+ old[i] = new[i];
+ }
+ }
+ if(!s) {
+ refresh();
+ }
+ }
+ }
+ movto(6, 0);
+ refresh();
+ clock_gettime(CLOCK_REALTIME_FAST, &now);
+ if (now.tv_sec == prev_sec) {
+ if (delay.tv_nsec > 0) {
+ delay.tv_sec = 0;
+ delay.tv_nsec = 1000000000 - now.tv_nsec;
+ } else {
+ delay.tv_sec = 1;
+ delay.tv_nsec = 0;
+ }
+ nanosleep(&delay, NULL);
+ clock_gettime(CLOCK_REALTIME_FAST, &now);
+ }
+ n -= now.tv_sec - prev_sec;
+ prev_sec = now.tv_sec;
+ if (sigtermed) {
+ standend();
+ clear();
+ refresh();
+ endwin();
+ errx(1, "terminated by signal %d", (int)sigtermed);
+ }
+ } while (n);
+ standend();
+ clear();
+ refresh();
+ endwin();
+ return(0);
+}
+
+static void
+set(int t, int n)
+{
+ int i, m;
+
+ m = 7<<n;
+ for(i=0; i<5; i++) {
+ next[i] |= ((disp[t]>>(4-i)*3)&07)<<n;
+ mask |= (next[i]^old[i])&m;
+ }
+ if(mask&m)
+ mask |= m;
+}
+
+static void
+standt(int on)
+{
+ if (on) {
+ if(hascolor) {
+ attron(COLOR_PAIR(1));
+ } else {
+ attron(A_STANDOUT);
+ }
+ } else {
+ if(hascolor) {
+ attron(COLOR_PAIR(2));
+ } else {
+ attroff(A_STANDOUT);
+ }
+ }
+}
+
+static void
+movto(int line, int col)
+{
+ move(line, col);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: grdc [-st] [n]\n");
+ exit(1);
+}
diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile
new file mode 100644
index 0000000..1c0e8cc
--- /dev/null
+++ b/usr.bin/grep/Makefile
@@ -0,0 +1,93 @@
+# $NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
+# $FreeBSD$
+# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
+
+.include <src.opts.mk>
+
+.if ${MK_BSD_GREP} == "yes"
+PROG= grep
+.else
+PROG= bsdgrep
+CLEANFILES+= bsdgrep.1
+
+bsdgrep.1: grep.1
+ ${CP} ${.ALLSRC} ${.TARGET}
+.endif
+SRCS= file.c grep.c queue.c util.c
+
+# Extra files ported backported form some regex improvements
+.PATH: ${.CURDIR}/regex
+SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c
+CFLAGS+=-I${.CURDIR}/regex
+
+CFLAGS.gcc+= --param max-inline-insns-single=500
+
+.if ${MK_BSD_GREP} == "yes"
+LINKS= ${BINDIR}/grep ${BINDIR}/egrep \
+ ${BINDIR}/grep ${BINDIR}/fgrep \
+ ${BINDIR}/grep ${BINDIR}/zgrep \
+ ${BINDIR}/grep ${BINDIR}/zegrep \
+ ${BINDIR}/grep ${BINDIR}/zfgrep
+
+MLINKS= grep.1 egrep.1 \
+ grep.1 fgrep.1 \
+ grep.1 zgrep.1 \
+ grep.1 zegrep.1 \
+ grep.1 zfgrep.1
+.endif
+
+LIBADD= z
+
+.if ${MK_LZMA_SUPPORT} != "no"
+LIBADD+= lzma
+
+.if ${MK_BSD_GREP} == "yes"
+LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \
+ ${BINDIR}/${PROG} ${BINDIR}/xzegrep \
+ ${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
+ ${BINDIR}/${PROG} ${BINDIR}/lzgrep \
+ ${BINDIR}/${PROG} ${BINDIR}/lzegrep \
+ ${BINDIR}/${PROG} ${BINDIR}/lzfgrep
+
+MLINKS+= grep.1 xzgrep.1 \
+ grep.1 xzegrep.1 \
+ grep.1 xzfgrep.1 \
+ grep.1 lzgrep.1 \
+ grep.1 lzegrep.1 \
+ grep.1 lzfgrep.1
+.endif
+.else
+CFLAGS+= -DWITHOUT_LZMA
+.endif
+
+.if ${MK_BZIP2_SUPPORT} != "no"
+LIBADD+= bz2
+
+.if ${MK_BSD_GREP} == "yes"
+LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
+ ${BINDIR}/grep ${BINDIR}/bzegrep \
+ ${BINDIR}/grep ${BINDIR}/bzfgrep
+MLINKS+= grep.1 bzgrep.1 \
+ grep.1 bzegrep.1 \
+ grep.1 bzfgrep.1
+.endif
+.else
+CFLAGS+= -DWITHOUT_BZIP2
+.endif
+
+.if ${MK_GNU_GREP_COMPAT} != "no"
+CFLAGS+= -I${DESTDIR}/usr/include/gnu
+LIBADD+= gnuregex
+.endif
+
+.if ${MK_NLS} != "no"
+.include "${.CURDIR}/nls/Makefile.inc"
+.else
+CFLAGS+= -DWITHOUT_NLS
+.endif
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/grep/Makefile.depend b/usr.bin/grep/Makefile.depend
new file mode 100644
index 0000000..ca0df56
--- /dev/null
+++ b/usr.bin/grep/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ gnu/lib/libregex \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c
new file mode 100644
index 0000000..81f227d
--- /dev/null
+++ b/usr.bin/grep/file.c
@@ -0,0 +1,351 @@
+/* $NetBSD: file.c,v 1.5 2011/02/16 18:35:39 joerg Exp $ */
+/* $FreeBSD$ */
+/* $OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * Copyright (C) 2008-2010 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2010 Dimitry Andric <dimitry@andric.com>
+ * 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/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <zlib.h>
+
+#ifndef WITHOUT_LZMA
+#include <lzma.h>
+#endif
+
+#ifndef WITHOUT_BZIP2
+#include <bzlib.h>
+#endif
+
+#include "grep.h"
+
+#define MAXBUFSIZ (32 * 1024)
+#define LNBUFBUMP 80
+
+static gzFile gzbufdesc;
+#ifndef WITHOUT_LZMA
+static lzma_stream lstrm = LZMA_STREAM_INIT;
+static lzma_action laction;
+static uint8_t lin_buf[MAXBUFSIZ];
+#endif
+#ifndef WITHOUT_BZIP2
+static BZFILE* bzbufdesc;
+#endif
+
+static unsigned char *buffer;
+static unsigned char *bufpos;
+static size_t bufrem;
+static size_t fsiz;
+
+static unsigned char *lnbuf;
+static size_t lnbuflen;
+
+static inline int
+grep_refill(struct file *f)
+{
+ ssize_t nr;
+
+ if (filebehave == FILE_MMAP)
+ return (0);
+
+ bufpos = buffer;
+ bufrem = 0;
+
+ if (filebehave == FILE_GZIP) {
+ nr = gzread(gzbufdesc, buffer, MAXBUFSIZ);
+#ifndef WITHOUT_BZIP2
+ } else if (filebehave == FILE_BZIP && bzbufdesc != NULL) {
+ int bzerr;
+
+ nr = BZ2_bzRead(&bzerr, bzbufdesc, buffer, MAXBUFSIZ);
+ switch (bzerr) {
+ case BZ_OK:
+ case BZ_STREAM_END:
+ /* No problem, nr will be okay */
+ break;
+ case BZ_DATA_ERROR_MAGIC:
+ /*
+ * As opposed to gzread(), which simply returns the
+ * plain file data, if it is not in the correct
+ * compressed format, BZ2_bzRead() instead aborts.
+ *
+ * So, just restart at the beginning of the file again,
+ * and use plain reads from now on.
+ */
+ BZ2_bzReadClose(&bzerr, bzbufdesc);
+ bzbufdesc = NULL;
+ if (lseek(f->fd, 0, SEEK_SET) == -1)
+ return (-1);
+ nr = read(f->fd, buffer, MAXBUFSIZ);
+ break;
+ default:
+ /* Make sure we exit with an error */
+ nr = -1;
+ }
+#endif
+#ifndef WITHOUT_LZMA
+ } else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
+ lzma_ret ret;
+ lstrm.next_out = buffer;
+
+ do {
+ if (lstrm.avail_in == 0) {
+ lstrm.next_in = lin_buf;
+ nr = read(f->fd, lin_buf, MAXBUFSIZ);
+
+ if (nr < 0)
+ return (-1);
+ else if (nr == 0)
+ laction = LZMA_FINISH;
+
+ lstrm.avail_in = nr;
+ }
+
+ ret = lzma_code(&lstrm, laction);
+
+ if (ret != LZMA_OK && ret != LZMA_STREAM_END)
+ return (-1);
+
+ if (lstrm.avail_out == 0 || ret == LZMA_STREAM_END) {
+ bufrem = MAXBUFSIZ - lstrm.avail_out;
+ lstrm.next_out = buffer;
+ lstrm.avail_out = MAXBUFSIZ;
+ }
+ } while (bufrem == 0 && ret != LZMA_STREAM_END);
+
+ return (0);
+#endif /* WIHTOUT_LZMA */
+ } else
+ nr = read(f->fd, buffer, MAXBUFSIZ);
+
+ if (nr < 0)
+ return (-1);
+
+ bufrem = nr;
+ return (0);
+}
+
+static inline int
+grep_lnbufgrow(size_t newlen)
+{
+
+ if (lnbuflen < newlen) {
+ lnbuf = grep_realloc(lnbuf, newlen);
+ lnbuflen = newlen;
+ }
+
+ return (0);
+}
+
+char *
+grep_fgetln(struct file *f, size_t *lenp)
+{
+ unsigned char *p;
+ char *ret;
+ size_t len;
+ size_t off;
+ ptrdiff_t diff;
+
+ /* Fill the buffer, if necessary */
+ if (bufrem == 0 && grep_refill(f) != 0)
+ goto error;
+
+ if (bufrem == 0) {
+ /* Return zero length to indicate EOF */
+ *lenp = 0;
+ return (bufpos);
+ }
+
+ /* Look for a newline in the remaining part of the buffer */
+ if ((p = memchr(bufpos, '\n', bufrem)) != NULL) {
+ ++p; /* advance over newline */
+ ret = bufpos;
+ len = p - bufpos;
+ bufrem -= len;
+ bufpos = p;
+ *lenp = len;
+ return (ret);
+ }
+
+ /* We have to copy the current buffered data to the line buffer */
+ for (len = bufrem, off = 0; ; len += bufrem) {
+ /* Make sure there is room for more data */
+ if (grep_lnbufgrow(len + LNBUFBUMP))
+ goto error;
+ memcpy(lnbuf + off, bufpos, len - off);
+ off = len;
+ if (grep_refill(f) != 0)
+ goto error;
+ if (bufrem == 0)
+ /* EOF: return partial line */
+ break;
+ if ((p = memchr(bufpos, '\n', bufrem)) == NULL)
+ continue;
+ /* got it: finish up the line (like code above) */
+ ++p;
+ diff = p - bufpos;
+ len += diff;
+ if (grep_lnbufgrow(len))
+ goto error;
+ memcpy(lnbuf + off, bufpos, diff);
+ bufrem -= diff;
+ bufpos = p;
+ break;
+ }
+ *lenp = len;
+ return (lnbuf);
+
+error:
+ *lenp = 0;
+ return (NULL);
+}
+
+/*
+ * Opens a file for processing.
+ */
+struct file *
+grep_open(const char *path)
+{
+ struct file *f;
+
+ f = grep_malloc(sizeof *f);
+ memset(f, 0, sizeof *f);
+ if (path == NULL) {
+ /* Processing stdin implies --line-buffered. */
+ lbflag = true;
+ f->fd = STDIN_FILENO;
+ } else if ((f->fd = open(path, O_RDONLY)) == -1)
+ goto error1;
+
+ if (filebehave == FILE_MMAP) {
+ struct stat st;
+
+ if ((fstat(f->fd, &st) == -1) || (st.st_size > OFF_MAX) ||
+ (!S_ISREG(st.st_mode)))
+ filebehave = FILE_STDIO;
+ else {
+ int flags = MAP_PRIVATE | MAP_NOCORE | MAP_NOSYNC;
+#ifdef MAP_PREFAULT_READ
+ flags |= MAP_PREFAULT_READ;
+#endif
+ fsiz = st.st_size;
+ buffer = mmap(NULL, fsiz, PROT_READ, flags,
+ f->fd, (off_t)0);
+ if (buffer == MAP_FAILED)
+ filebehave = FILE_STDIO;
+ else {
+ bufrem = st.st_size;
+ bufpos = buffer;
+ madvise(buffer, st.st_size, MADV_SEQUENTIAL);
+ }
+ }
+ }
+
+ if ((buffer == NULL) || (buffer == MAP_FAILED))
+ buffer = grep_malloc(MAXBUFSIZ);
+
+ if (filebehave == FILE_GZIP &&
+ (gzbufdesc = gzdopen(f->fd, "r")) == NULL)
+ goto error2;
+
+#ifndef WITHOUT_BZIP2
+ if (filebehave == FILE_BZIP &&
+ (bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL)
+ goto error2;
+#endif
+#ifndef WITHOUT_LZMA
+ else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
+ lzma_ret ret;
+
+ ret = (filebehave == FILE_XZ) ?
+ lzma_stream_decoder(&lstrm, UINT64_MAX,
+ LZMA_CONCATENATED) :
+ lzma_alone_decoder(&lstrm, UINT64_MAX);
+
+ if (ret != LZMA_OK)
+ goto error2;
+
+ lstrm.avail_in = 0;
+ lstrm.avail_out = MAXBUFSIZ;
+ laction = LZMA_RUN;
+ }
+#endif
+
+ /* Fill read buffer, also catches errors early */
+ if (bufrem == 0 && grep_refill(f) != 0)
+ goto error2;
+
+ /* Check for binary stuff, if necessary */
+ if (binbehave != BINFILE_TEXT && memchr(bufpos, '\0', bufrem) != NULL)
+ f->binary = true;
+
+ return (f);
+
+error2:
+ close(f->fd);
+error1:
+ free(f);
+ return (NULL);
+}
+
+/*
+ * Closes a file.
+ */
+void
+grep_close(struct file *f)
+{
+
+ close(f->fd);
+
+ /* Reset read buffer and line buffer */
+ if (filebehave == FILE_MMAP) {
+ munmap(buffer, fsiz);
+ buffer = NULL;
+ }
+ bufpos = buffer;
+ bufrem = 0;
+
+ free(lnbuf);
+ lnbuf = NULL;
+ lnbuflen = 0;
+}
diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1
new file mode 100644
index 0000000..9e8633f
--- /dev/null
+++ b/usr.bin/grep/grep.1
@@ -0,0 +1,488 @@
+.\" $NetBSD: grep.1,v 1.2 2011/02/16 01:31:33 joerg Exp $
+.\" $FreeBSD$
+.\" $OpenBSD: grep.1,v 1.38 2010/04/05 06:30:59 jmc Exp $
+.\" Copyright (c) 1980, 1990, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)grep.1 8.3 (Berkeley) 4/18/94
+.\"
+.Dd July 28, 2010
+.Dt GREP 1
+.Os
+.Sh NAME
+.Nm grep , egrep , fgrep ,
+.Nm zgrep , zegrep , zfgrep
+.Nd file pattern searcher
+.Sh SYNOPSIS
+.Nm grep
+.Bk -words
+.Op Fl abcdDEFGHhIiJLlmnOopqRSsUVvwxZ
+.Op Fl A Ar num
+.Op Fl B Ar num
+.Op Fl C Ns Op Ar num
+.Op Fl e Ar pattern
+.Op Fl f Ar file
+.Op Fl Fl binary-files Ns = Ns Ar value
+.Op Fl Fl color Ns Op = Ns Ar when
+.Op Fl Fl colour Ns Op = Ns Ar when
+.Op Fl Fl context Ns Op = Ns Ar num
+.Op Fl Fl label
+.Op Fl Fl line-buffered
+.Op Fl Fl null
+.Op Ar pattern
+.Op Ar
+.Ek
+.Sh DESCRIPTION
+The
+.Nm grep
+utility searches any given input files,
+selecting lines that match one or more patterns.
+By default, a pattern matches an input line if the regular expression
+(RE) in the pattern matches the input line
+without its trailing newline.
+An empty expression matches every line.
+Each input line that matches at least one of the patterns is written
+to the standard output.
+.Pp
+.Nm grep
+is used for simple patterns and
+basic regular expressions
+.Pq BREs ;
+.Nm egrep
+can handle extended regular expressions
+.Pq EREs .
+See
+.Xr re_format 7
+for more information on regular expressions.
+.Nm fgrep
+is quicker than both
+.Nm grep
+and
+.Nm egrep ,
+but can only handle fixed patterns
+(i.e. it does not interpret regular expressions).
+Patterns may consist of one or more lines,
+allowing any of the pattern lines to match a portion of the input.
+.Pp
+.Nm zgrep ,
+.Nm zegrep ,
+and
+.Nm zfgrep
+act like
+.Nm grep ,
+.Nm egrep ,
+and
+.Nm fgrep ,
+respectively, but accept input files compressed with the
+.Xr compress 1
+or
+.Xr gzip 1
+compression utilities.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl A Ar num , Fl Fl after-context Ns = Ns Ar num
+Print
+.Ar num
+lines of trailing context after each match.
+See also the
+.Fl B
+and
+.Fl C
+options.
+.It Fl a , Fl Fl text
+Treat all files as ASCII text.
+Normally
+.Nm
+will simply print
+.Dq Binary file ... matches
+if files contain binary characters.
+Use of this option forces
+.Nm
+to output lines matching the specified pattern.
+.It Fl B Ar num , Fl Fl before-context Ns = Ns Ar num
+Print
+.Ar num
+lines of leading context before each match.
+See also the
+.Fl A
+and
+.Fl C
+options.
+.It Fl b , Fl Fl byte-offset
+The offset in bytes of a matched pattern is
+displayed in front of the respective matched line.
+.It Fl C Ns Op Ar num , Fl Fl context Ns = Ns Ar num
+Print
+.Ar num
+lines of leading and trailing context surrounding each match.
+The default is 2 and is equivalent to
+.Fl A
+.Ar 2
+.Fl B
+.Ar 2 .
+Note:
+no whitespace may be given between the option and its argument.
+.It Fl c , Fl Fl count
+Only a count of selected lines is written to standard output.
+.It Fl Fl colour Ns = Ns Op Ar when , Fl Fl color Ns = Ns Op Ar when
+Mark up the matching text with the expression stored in
+.Ev GREP_COLOR
+environment variable.
+The possible values of when can be `never', `always' or `auto'.
+.It Fl D Ar action , Fl Fl devices Ns = Ns Ar action
+Specify the demanded action for devices, FIFOs and sockets.
+The default action is `read', which means, that they are read
+as if they were normal files.
+If the action is set to `skip', devices will be silently skipped.
+.It Fl d Ar action , Fl Fl directories Ns = Ns Ar action
+Specify the demanded action for directories.
+It is `read' by default, which means that the directories
+are read in the same manner as normal files.
+Other possible values are `skip' to silently ignore the
+directories, and `recurse' to read them recursively, which
+has the same effect as the
+.Fl R
+and
+.Fl r
+option.
+.It Fl E , Fl Fl extended-regexp
+Interpret
+.Ar pattern
+as an extended regular expression
+(i.e. force
+.Nm grep
+to behave as
+.Nm egrep ) .
+.It Fl e Ar pattern , Fl Fl regexp Ns = Ns Ar pattern
+Specify a pattern used during the search of the input:
+an input line is selected if it matches any of the specified patterns.
+This option is most useful when multiple
+.Fl e
+options are used to specify multiple patterns,
+or when a pattern begins with a dash
+.Pq Sq - .
+.It Fl Fl exclude
+If specified, it excludes files matching the given
+filename pattern from the search.
+Note that
+.Fl Fl exclude
+patterns take priority over
+.Fl Fl include
+patterns, and if no
+.Fl Fl include
+pattern is specified, all files are searched that are
+not excluded.
+Patterns are matched to the full path specified,
+not only to the filename component.
+.It Fl Fl exclude-dir
+If
+.Fl R
+is specified, it excludes directories matching the
+given filename pattern from the search.
+Note that
+.Fl Fl exclude-dir
+patterns take priority over
+.Fl Fl include-dir
+patterns, and if no
+.Fl Fl include-dir
+pattern is specified, all directories are searched that are
+not excluded.
+.It Fl F , Fl Fl fixed-strings
+Interpret
+.Ar pattern
+as a set of fixed strings
+(i.e. force
+.Nm grep
+to behave as
+.Nm fgrep ) .
+.It Fl f Ar file , Fl Fl file Ns = Ns Ar file
+Read one or more newline separated patterns from
+.Ar file .
+Empty pattern lines match every input line.
+Newlines are not considered part of a pattern.
+If
+.Ar file
+is empty, nothing is matched.
+.It Fl G , Fl Fl basic-regexp
+Interpret
+.Ar pattern
+as a basic regular expression
+(i.e. force
+.Nm grep
+to behave as traditional
+.Nm grep ) .
+.It Fl H
+Always print filename headers with output lines.
+.It Fl h , Fl Fl no-filename
+Never print filename headers
+.Pq i.e. filenames
+with output lines.
+.It Fl Fl help
+Print a brief help message.
+.It Fl I
+Ignore binary files.
+This option is equivalent to
+.Fl Fl binary-file Ns = Ns Ar without-match
+option.
+.It Fl i , Fl Fl ignore-case
+Perform case insensitive matching.
+By default,
+.Nm grep
+is case sensitive.
+.It Fl Fl include
+If specified, only files matching the
+given filename pattern are searched.
+Note that
+.Fl Fl exclude
+patterns take priority over
+.Fl Fl include
+patterns.
+Patterns are matched to the full path specified,
+not only to the filename component.
+.It Fl Fl include-dir
+If
+.Fl R
+is specified, only directories matching the
+given filename pattern are searched.
+Note that
+.Fl Fl exclude-dir
+patterns take priority over
+.Fl Fl include-dir
+patterns.
+.It Fl J, Fl Fl bz2decompress
+Decompress the
+.Xr bzip2 1
+compressed file before looking for the text.
+.It Fl L , Fl Fl files-without-match
+Only the names of files not containing selected lines are written to
+standard output.
+Pathnames are listed once per file searched.
+If the standard input is searched, the string
+.Dq (standard input)
+is written.
+.It Fl l , Fl Fl files-with-matches
+Only the names of files containing selected lines are written to
+standard output.
+.Nm grep
+will only search a file until a match has been found,
+making searches potentially less expensive.
+Pathnames are listed once per file searched.
+If the standard input is searched, the string
+.Dq (standard input)
+is written.
+.It Fl Fl mmap
+Use
+.Xr mmap 2
+instead of
+.Xr read 2
+to read input, which can result in better performance under some
+circumstances but can cause undefined behaviour.
+.It Fl m Ar num, Fl Fl max-count Ns = Ns Ar num
+Stop reading the file after
+.Ar num
+matches.
+.It Fl n , Fl Fl line-number
+Each output line is preceded by its relative line number in the file,
+starting at line 1.
+The line number counter is reset for each file processed.
+This option is ignored if
+.Fl c ,
+.Fl L ,
+.Fl l ,
+or
+.Fl q
+is
+specified.
+.It Fl Fl null
+Prints a zero-byte after the file name.
+.It Fl O
+If
+.Fl R
+is specified, follow symbolic links only if they were explicitly listed
+on the command line.
+The default is not to follow symbolic links.
+.It Fl o, Fl Fl only-matching
+Prints only the matching part of the lines.
+.It Fl p
+If
+.Fl R
+is specified, no symbolic links are followed.
+This is the default.
+.It Fl q , Fl Fl quiet , Fl Fl silent
+Quiet mode:
+suppress normal output.
+.Nm grep
+will only search a file until a match has been found,
+making searches potentially less expensive.
+.It Fl R , Fl r , Fl Fl recursive
+Recursively search subdirectories listed.
+.It Fl S
+If
+.Fl R
+is specified, all symbolic links are followed.
+The default is not to follow symbolic links.
+.It Fl s , Fl Fl no-messages
+Silent mode.
+Nonexistent and unreadable files are ignored
+(i.e. their error messages are suppressed).
+.It Fl U , Fl Fl binary
+Search binary files, but do not attempt to print them.
+.It Fl V , Fl Fl version
+Display version information and exit.
+.It Fl v , Fl Fl invert-match
+Selected lines are those
+.Em not
+matching any of the specified patterns.
+.It Fl w , Fl Fl word-regexp
+The expression is searched for as a word (as if surrounded by
+.Sq [[:<:]]
+and
+.Sq [[:>:]] ;
+see
+.Xr re_format 7 ) .
+.It Fl x , Fl Fl line-regexp
+Only input lines selected against an entire fixed string or regular
+expression are considered to be matching lines.
+.It Fl y
+Equivalent to
+.Fl i .
+Obsoleted.
+.It Fl Z , Fl z , Fl Fl decompress
+Force
+.Nm grep
+to behave as
+.Nm zgrep .
+.It Fl Fl binary-files Ns = Ns Ar value
+Controls searching and printing of binary files.
+Options are
+.Ar binary ,
+the default: search binary files but do not print them;
+.Ar without-match :
+do not search binary files;
+and
+.Ar text :
+treat all files as text.
+.Sm off
+.It Fl Fl context Op = Ar num
+.Sm on
+Print
+.Ar num
+lines of leading and trailing context.
+The default is 2.
+.It Fl Fl line-buffered
+Force output to be line buffered.
+By default, output is line buffered when standard output is a terminal
+and block buffered otherwise.
+.El
+.Pp
+If no file arguments are specified, the standard input is used.
+.Sh EXIT STATUS
+The
+.Nm grep
+utility exits with one of the following values:
+.Pp
+.Bl -tag -width flag -compact
+.It Li 0
+One or more lines were selected.
+.It Li 1
+No lines were selected.
+.It Li \*(Gt1
+An error occurred.
+.El
+.Sh EXAMPLES
+To find all occurrences of the word
+.Sq patricia
+in a file:
+.Pp
+.Dl $ grep 'patricia' myfile
+.Pp
+To find all occurrences of the pattern
+.Ql .Pp
+at the beginning of a line:
+.Pp
+.Dl $ grep '^\e.Pp' myfile
+.Pp
+The apostrophes ensure the entire expression is evaluated by
+.Nm grep
+instead of by the user's shell.
+The caret
+.Ql ^
+matches the null string at the beginning of a line,
+and the
+.Ql \e
+escapes the
+.Ql \&. ,
+which would otherwise match any character.
+.Pp
+To find all lines in a file which do not contain the words
+.Sq foo
+or
+.Sq bar :
+.Pp
+.Dl $ grep -v -e 'foo' -e 'bar' myfile
+.Pp
+A simple example of an extended regular expression:
+.Pp
+.Dl $ egrep '19|20|25' calendar
+.Pp
+Peruses the file
+.Sq calendar
+looking for either 19, 20, or 25.
+.Sh SEE ALSO
+.Xr ed 1 ,
+.Xr ex 1 ,
+.Xr gzip 1 ,
+.Xr sed 1 ,
+.Xr re_format 7
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The flags
+.Op Fl AaBbCDdGHhIJLmoPRSUVwZ
+are extensions to that specification, and the behaviour of the
+.Fl f
+flag when used with an empty pattern file is left undefined.
+.Pp
+All long options are provided for compatibility with
+GNU versions of this utility.
+.Pp
+Historic versions of the
+.Nm grep
+utility also supported the flags
+.Op Fl ruy .
+This implementation supports those options;
+however, their use is strongly discouraged.
+.Sh HISTORY
+The
+.Nm grep
+command first appeared in
+.At v6 .
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
new file mode 100644
index 0000000..2dc5a1d
--- /dev/null
+++ b/usr.bin/grep/grep.c
@@ -0,0 +1,748 @@
+/* $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 $ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * Copyright (C) 2008-2009 Gabor Kovesdan <gabor@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/stat.h>
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
+#include <libgen.h>
+#include <locale.h>
+#include <stdbool.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "fastmatch.h"
+#include "grep.h"
+
+#ifndef WITHOUT_NLS
+#include <nl_types.h>
+nl_catd catalog;
+#endif
+
+/*
+ * Default messags to use when NLS is disabled or no catalogue
+ * is found.
+ */
+const char *errstr[] = {
+ "",
+/* 1*/ "(standard input)",
+/* 2*/ "cannot read bzip2 compressed file",
+/* 3*/ "unknown %s option",
+/* 4*/ "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n",
+/* 5*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n",
+/* 6*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n",
+/* 7*/ "\t[--null] [pattern] [file ...]\n",
+/* 8*/ "Binary file %s matches\n",
+/* 9*/ "%s (BSD grep) %s\n",
+};
+
+/* Flags passed to regcomp() and regexec() */
+int cflags = REG_NOSUB;
+int eflags = REG_STARTEND;
+
+/* Shortcut for matching all cases like empty regex */
+bool matchall;
+
+/* Searching patterns */
+unsigned int patterns;
+static unsigned int pattern_sz;
+struct pat *pattern;
+regex_t *r_pattern;
+fastmatch_t *fg_pattern;
+
+/* Filename exclusion/inclusion patterns */
+unsigned int fpatterns, dpatterns;
+static unsigned int fpattern_sz, dpattern_sz;
+struct epat *dpattern, *fpattern;
+
+/* For regex errors */
+char re_error[RE_ERROR_BUF + 1];
+
+/* Command-line flags */
+unsigned long long Aflag; /* -A x: print x lines trailing each match */
+unsigned long long Bflag; /* -B x: print x lines leading each match */
+bool Hflag; /* -H: always print file name */
+bool Lflag; /* -L: only show names of files with no matches */
+bool bflag; /* -b: show block numbers for each match */
+bool cflag; /* -c: only show a count of matching lines */
+bool hflag; /* -h: don't print filename headers */
+bool iflag; /* -i: ignore case */
+bool lflag; /* -l: only show names of files with matches */
+bool mflag; /* -m x: stop reading the files after x matches */
+long long mcount; /* count for -m */
+long long mlimit; /* requested value for -m */
+bool nflag; /* -n: show line numbers in front of matching lines */
+bool oflag; /* -o: print only matching part */
+bool qflag; /* -q: quiet mode (don't output anything) */
+bool sflag; /* -s: silent mode (ignore errors) */
+bool vflag; /* -v: only show non-matching lines */
+bool wflag; /* -w: pattern must start and end on word boundaries */
+bool xflag; /* -x: pattern must match entire line */
+bool lbflag; /* --line-buffered */
+bool nullflag; /* --null */
+char *label; /* --label */
+const char *color; /* --color */
+int grepbehave = GREP_BASIC; /* -EFGP: type of the regex */
+int binbehave = BINFILE_BIN; /* -aIU: handling of binary files */
+int filebehave = FILE_STDIO; /* -JZ: normal, gzip or bzip2 file */
+int devbehave = DEV_READ; /* -D: handling of devices */
+int dirbehave = DIR_READ; /* -dRr: handling of directories */
+int linkbehave = LINK_READ; /* -OpS: handling of symlinks */
+
+bool dexclude, dinclude; /* --exclude-dir and --include-dir */
+bool fexclude, finclude; /* --exclude and --include */
+
+enum {
+ BIN_OPT = CHAR_MAX + 1,
+ COLOR_OPT,
+ HELP_OPT,
+ MMAP_OPT,
+ LINEBUF_OPT,
+ LABEL_OPT,
+ NULL_OPT,
+ R_EXCLUDE_OPT,
+ R_INCLUDE_OPT,
+ R_DEXCLUDE_OPT,
+ R_DINCLUDE_OPT
+};
+
+static inline const char *init_color(const char *);
+
+/* Housekeeping */
+bool first = true; /* flag whether we are processing the first match */
+bool prev; /* flag whether or not the previous line matched */
+int tail; /* lines left to print */
+bool file_err; /* file reading error */
+
+/*
+ * Prints usage information and returns 2.
+ */
+static void
+usage(void)
+{
+ fprintf(stderr, getstr(4), getprogname());
+ fprintf(stderr, "%s", getstr(5));
+ fprintf(stderr, "%s", getstr(6));
+ fprintf(stderr, "%s", getstr(7));
+ exit(2);
+}
+
+static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy";
+
+static const struct option long_options[] =
+{
+ {"binary-files", required_argument, NULL, BIN_OPT},
+ {"help", no_argument, NULL, HELP_OPT},
+ {"mmap", no_argument, NULL, MMAP_OPT},
+ {"line-buffered", no_argument, NULL, LINEBUF_OPT},
+ {"label", required_argument, NULL, LABEL_OPT},
+ {"null", no_argument, NULL, NULL_OPT},
+ {"color", optional_argument, NULL, COLOR_OPT},
+ {"colour", optional_argument, NULL, COLOR_OPT},
+ {"exclude", required_argument, NULL, R_EXCLUDE_OPT},
+ {"include", required_argument, NULL, R_INCLUDE_OPT},
+ {"exclude-dir", required_argument, NULL, R_DEXCLUDE_OPT},
+ {"include-dir", required_argument, NULL, R_DINCLUDE_OPT},
+ {"after-context", required_argument, NULL, 'A'},
+ {"text", no_argument, NULL, 'a'},
+ {"before-context", required_argument, NULL, 'B'},
+ {"byte-offset", no_argument, NULL, 'b'},
+ {"context", optional_argument, NULL, 'C'},
+ {"count", no_argument, NULL, 'c'},
+ {"devices", required_argument, NULL, 'D'},
+ {"directories", required_argument, NULL, 'd'},
+ {"extended-regexp", no_argument, NULL, 'E'},
+ {"regexp", required_argument, NULL, 'e'},
+ {"fixed-strings", no_argument, NULL, 'F'},
+ {"file", required_argument, NULL, 'f'},
+ {"basic-regexp", no_argument, NULL, 'G'},
+ {"no-filename", no_argument, NULL, 'h'},
+ {"with-filename", no_argument, NULL, 'H'},
+ {"ignore-case", no_argument, NULL, 'i'},
+ {"bz2decompress", no_argument, NULL, 'J'},
+ {"files-with-matches", no_argument, NULL, 'l'},
+ {"files-without-match", no_argument, NULL, 'L'},
+ {"max-count", required_argument, NULL, 'm'},
+ {"lzma", no_argument, NULL, 'M'},
+ {"line-number", no_argument, NULL, 'n'},
+ {"only-matching", no_argument, NULL, 'o'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"silent", no_argument, NULL, 'q'},
+ {"recursive", no_argument, NULL, 'r'},
+ {"no-messages", no_argument, NULL, 's'},
+ {"binary", no_argument, NULL, 'U'},
+ {"unix-byte-offsets", no_argument, NULL, 'u'},
+ {"invert-match", no_argument, NULL, 'v'},
+ {"version", no_argument, NULL, 'V'},
+ {"word-regexp", no_argument, NULL, 'w'},
+ {"line-regexp", no_argument, NULL, 'x'},
+ {"xz", no_argument, NULL, 'X'},
+ {"decompress", no_argument, NULL, 'Z'},
+ {NULL, no_argument, NULL, 0}
+};
+
+/*
+ * Adds a searching pattern to the internal array.
+ */
+static void
+add_pattern(char *pat, size_t len)
+{
+
+ /* Do not add further pattern is we already match everything */
+ if (matchall)
+ return;
+
+ /* Check if we can do a shortcut */
+ if (len == 0) {
+ matchall = true;
+ for (unsigned int i = 0; i < patterns; i++) {
+ free(pattern[i].pat);
+ }
+ pattern = grep_realloc(pattern, sizeof(struct pat));
+ pattern[0].pat = NULL;
+ pattern[0].len = 0;
+ patterns = 1;
+ return;
+ }
+ /* Increase size if necessary */
+ if (patterns == pattern_sz) {
+ pattern_sz *= 2;
+ pattern = grep_realloc(pattern, ++pattern_sz *
+ sizeof(struct pat));
+ }
+ if (len > 0 && pat[len - 1] == '\n')
+ --len;
+ /* pat may not be NUL-terminated */
+ pattern[patterns].pat = grep_malloc(len + 1);
+ memcpy(pattern[patterns].pat, pat, len);
+ pattern[patterns].len = len;
+ pattern[patterns].pat[len] = '\0';
+ ++patterns;
+}
+
+/*
+ * Adds a file include/exclude pattern to the internal array.
+ */
+static void
+add_fpattern(const char *pat, int mode)
+{
+
+ /* Increase size if necessary */
+ if (fpatterns == fpattern_sz) {
+ fpattern_sz *= 2;
+ fpattern = grep_realloc(fpattern, ++fpattern_sz *
+ sizeof(struct epat));
+ }
+ fpattern[fpatterns].pat = grep_strdup(pat);
+ fpattern[fpatterns].mode = mode;
+ ++fpatterns;
+}
+
+/*
+ * Adds a directory include/exclude pattern to the internal array.
+ */
+static void
+add_dpattern(const char *pat, int mode)
+{
+
+ /* Increase size if necessary */
+ if (dpatterns == dpattern_sz) {
+ dpattern_sz *= 2;
+ dpattern = grep_realloc(dpattern, ++dpattern_sz *
+ sizeof(struct epat));
+ }
+ dpattern[dpatterns].pat = grep_strdup(pat);
+ dpattern[dpatterns].mode = mode;
+ ++dpatterns;
+}
+
+/*
+ * Reads searching patterns from a file and adds them with add_pattern().
+ */
+static void
+read_patterns(const char *fn)
+{
+ struct stat st;
+ FILE *f;
+ char *line;
+ size_t len;
+ ssize_t rlen;
+
+ if ((f = fopen(fn, "r")) == NULL)
+ err(2, "%s", fn);
+ if ((fstat(fileno(f), &st) == -1) || (S_ISDIR(st.st_mode))) {
+ fclose(f);
+ return;
+ }
+ len = 0;
+ line = NULL;
+ while ((rlen = getline(&line, &len, f)) != -1)
+ add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen);
+ free(line);
+ if (ferror(f))
+ err(2, "%s", fn);
+ fclose(f);
+}
+
+static inline const char *
+init_color(const char *d)
+{
+ char *c;
+
+ c = getenv("GREP_COLOR");
+ return (c != NULL && c[0] != '\0' ? c : d);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char **aargv, **eargv, *eopts;
+ char *ep;
+ const char *pn;
+ unsigned long long l;
+ unsigned int aargc, eargc, i;
+ int c, lastc, needpattern, newarg, prevoptind;
+
+ setlocale(LC_ALL, "");
+
+#ifndef WITHOUT_NLS
+ catalog = catopen("grep", NL_CAT_LOCALE);
+#endif
+
+ /* Check what is the program name of the binary. In this
+ way we can have all the funcionalities in one binary
+ without the need of scripting and using ugly hacks. */
+ pn = getprogname();
+ if (pn[0] == 'b' && pn[1] == 'z') {
+ filebehave = FILE_BZIP;
+ pn += 2;
+ } else if (pn[0] == 'x' && pn[1] == 'z') {
+ filebehave = FILE_XZ;
+ pn += 2;
+ } else if (pn[0] == 'l' && pn[1] == 'z') {
+ filebehave = FILE_LZMA;
+ pn += 2;
+ } else if (pn[0] == 'z') {
+ filebehave = FILE_GZIP;
+ pn += 1;
+ }
+ switch (pn[0]) {
+ case 'e':
+ grepbehave = GREP_EXTENDED;
+ break;
+ case 'f':
+ grepbehave = GREP_FIXED;
+ break;
+ }
+
+ lastc = '\0';
+ newarg = 1;
+ prevoptind = 1;
+ needpattern = 1;
+
+ eopts = getenv("GREP_OPTIONS");
+
+ /* support for extra arguments in GREP_OPTIONS */
+ eargc = 0;
+ if (eopts != NULL && eopts[0] != '\0') {
+ char *str;
+
+ /* make an estimation of how many extra arguments we have */
+ for (unsigned int j = 0; j < strlen(eopts); j++)
+ if (eopts[j] == ' ')
+ eargc++;
+
+ eargv = (char **)grep_malloc(sizeof(char *) * (eargc + 1));
+
+ eargc = 0;
+ /* parse extra arguments */
+ while ((str = strsep(&eopts, " ")) != NULL)
+ if (str[0] != '\0')
+ eargv[eargc++] = grep_strdup(str);
+
+ aargv = (char **)grep_calloc(eargc + argc + 1,
+ sizeof(char *));
+
+ aargv[0] = argv[0];
+ for (i = 0; i < eargc; i++)
+ aargv[i + 1] = eargv[i];
+ for (int j = 1; j < argc; j++, i++)
+ aargv[i + 1] = argv[j];
+
+ aargc = eargc + argc;
+ } else {
+ aargv = argv;
+ aargc = argc;
+ }
+
+ while (((c = getopt_long(aargc, aargv, optstr, long_options, NULL)) !=
+ -1)) {
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (newarg || !isdigit(lastc))
+ Aflag = 0;
+ else if (Aflag > LLONG_MAX / 10) {
+ errno = ERANGE;
+ err(2, NULL);
+ }
+ Aflag = Bflag = (Aflag * 10) + (c - '0');
+ break;
+ case 'C':
+ if (optarg == NULL) {
+ Aflag = Bflag = 2;
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'A':
+ /* FALLTHROUGH */
+ case 'B':
+ errno = 0;
+ l = strtoull(optarg, &ep, 10);
+ if (((errno == ERANGE) && (l == ULLONG_MAX)) ||
+ ((errno == EINVAL) && (l == 0)))
+ err(2, NULL);
+ else if (ep[0] != '\0') {
+ errno = EINVAL;
+ err(2, NULL);
+ }
+ if (c == 'A')
+ Aflag = l;
+ else if (c == 'B')
+ Bflag = l;
+ else
+ Aflag = Bflag = l;
+ break;
+ case 'a':
+ binbehave = BINFILE_TEXT;
+ break;
+ case 'b':
+ bflag = true;
+ break;
+ case 'c':
+ cflag = true;
+ break;
+ case 'D':
+ if (strcasecmp(optarg, "skip") == 0)
+ devbehave = DEV_SKIP;
+ else if (strcasecmp(optarg, "read") == 0)
+ devbehave = DEV_READ;
+ else
+ errx(2, getstr(3), "--devices");
+ break;
+ case 'd':
+ if (strcasecmp("recurse", optarg) == 0) {
+ Hflag = true;
+ dirbehave = DIR_RECURSE;
+ } else if (strcasecmp("skip", optarg) == 0)
+ dirbehave = DIR_SKIP;
+ else if (strcasecmp("read", optarg) == 0)
+ dirbehave = DIR_READ;
+ else
+ errx(2, getstr(3), "--directories");
+ break;
+ case 'E':
+ grepbehave = GREP_EXTENDED;
+ break;
+ case 'e':
+ {
+ char *token;
+ char *string = optarg;
+
+ while ((token = strsep(&string, "\n")) != NULL)
+ add_pattern(token, strlen(token));
+ }
+ needpattern = 0;
+ break;
+ case 'F':
+ grepbehave = GREP_FIXED;
+ break;
+ case 'f':
+ read_patterns(optarg);
+ needpattern = 0;
+ break;
+ case 'G':
+ grepbehave = GREP_BASIC;
+ break;
+ case 'H':
+ Hflag = true;
+ break;
+ case 'h':
+ Hflag = false;
+ hflag = true;
+ break;
+ case 'I':
+ binbehave = BINFILE_SKIP;
+ break;
+ case 'i':
+ case 'y':
+ iflag = true;
+ cflags |= REG_ICASE;
+ break;
+ case 'J':
+#ifdef WITHOUT_BZIP2
+ errno = EOPNOTSUPP;
+ err(2, "bzip2 support was disabled at compile-time");
+#endif
+ filebehave = FILE_BZIP;
+ break;
+ case 'L':
+ lflag = false;
+ Lflag = true;
+ break;
+ case 'l':
+ Lflag = false;
+ lflag = true;
+ break;
+ case 'm':
+ mflag = true;
+ errno = 0;
+ mlimit = mcount = strtoll(optarg, &ep, 10);
+ if (((errno == ERANGE) && (mcount == LLONG_MAX)) ||
+ ((errno == EINVAL) && (mcount == 0)))
+ err(2, NULL);
+ else if (ep[0] != '\0') {
+ errno = EINVAL;
+ err(2, NULL);
+ }
+ break;
+ case 'M':
+ filebehave = FILE_LZMA;
+ break;
+ case 'n':
+ nflag = true;
+ break;
+ case 'O':
+ linkbehave = LINK_EXPLICIT;
+ break;
+ case 'o':
+ oflag = true;
+ cflags &= ~REG_NOSUB;
+ break;
+ case 'p':
+ linkbehave = LINK_SKIP;
+ break;
+ case 'q':
+ qflag = true;
+ break;
+ case 'S':
+ linkbehave = LINK_READ;
+ break;
+ case 'R':
+ case 'r':
+ dirbehave = DIR_RECURSE;
+ Hflag = true;
+ break;
+ case 's':
+ sflag = true;
+ break;
+ case 'U':
+ binbehave = BINFILE_BIN;
+ break;
+ case 'u':
+ case MMAP_OPT:
+ filebehave = FILE_MMAP;
+ break;
+ case 'V':
+ printf(getstr(9), getprogname(), VERSION);
+ exit(0);
+ case 'v':
+ vflag = true;
+ break;
+ case 'w':
+ wflag = true;
+ cflags &= ~REG_NOSUB;
+ break;
+ case 'x':
+ xflag = true;
+ cflags &= ~REG_NOSUB;
+ break;
+ case 'X':
+ filebehave = FILE_XZ;
+ break;
+ case 'Z':
+ filebehave = FILE_GZIP;
+ break;
+ case BIN_OPT:
+ if (strcasecmp("binary", optarg) == 0)
+ binbehave = BINFILE_BIN;
+ else if (strcasecmp("without-match", optarg) == 0)
+ binbehave = BINFILE_SKIP;
+ else if (strcasecmp("text", optarg) == 0)
+ binbehave = BINFILE_TEXT;
+ else
+ errx(2, getstr(3), "--binary-files");
+ break;
+ case COLOR_OPT:
+ color = NULL;
+ if (optarg == NULL || strcasecmp("auto", optarg) == 0 ||
+ strcasecmp("tty", optarg) == 0 ||
+ strcasecmp("if-tty", optarg) == 0) {
+ char *term;
+
+ term = getenv("TERM");
+ if (isatty(STDOUT_FILENO) && term != NULL &&
+ strcasecmp(term, "dumb") != 0)
+ color = init_color("01;31");
+ } else if (strcasecmp("always", optarg) == 0 ||
+ strcasecmp("yes", optarg) == 0 ||
+ strcasecmp("force", optarg) == 0) {
+ color = init_color("01;31");
+ } else if (strcasecmp("never", optarg) != 0 &&
+ strcasecmp("none", optarg) != 0 &&
+ strcasecmp("no", optarg) != 0)
+ errx(2, getstr(3), "--color");
+ cflags &= ~REG_NOSUB;
+ break;
+ case LABEL_OPT:
+ label = optarg;
+ break;
+ case LINEBUF_OPT:
+ lbflag = true;
+ break;
+ case NULL_OPT:
+ nullflag = true;
+ break;
+ case R_INCLUDE_OPT:
+ finclude = true;
+ add_fpattern(optarg, INCL_PAT);
+ break;
+ case R_EXCLUDE_OPT:
+ fexclude = true;
+ add_fpattern(optarg, EXCL_PAT);
+ break;
+ case R_DINCLUDE_OPT:
+ dinclude = true;
+ add_dpattern(optarg, INCL_PAT);
+ break;
+ case R_DEXCLUDE_OPT:
+ dexclude = true;
+ add_dpattern(optarg, EXCL_PAT);
+ break;
+ case HELP_OPT:
+ default:
+ usage();
+ }
+ lastc = c;
+ newarg = optind != prevoptind;
+ prevoptind = optind;
+ }
+ aargc -= optind;
+ aargv += optind;
+
+ /* Empty pattern file matches nothing */
+ if (!needpattern && (patterns == 0))
+ exit(1);
+
+ /* Fail if we don't have any pattern */
+ if (aargc == 0 && needpattern)
+ usage();
+
+ /* Process patterns from command line */
+ if (aargc != 0 && needpattern) {
+ char *token;
+ char *string = *aargv;
+
+ while ((token = strsep(&string, "\n")) != NULL)
+ add_pattern(token, strlen(token));
+ --aargc;
+ ++aargv;
+ }
+
+ switch (grepbehave) {
+ case GREP_BASIC:
+ break;
+ case GREP_FIXED:
+ /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */
+ cflags |= 0020;
+ break;
+ case GREP_EXTENDED:
+ cflags |= REG_EXTENDED;
+ break;
+ default:
+ /* NOTREACHED */
+ usage();
+ }
+
+ fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern));
+ r_pattern = grep_calloc(patterns, sizeof(*r_pattern));
+
+ /* Check if cheating is allowed (always is for fgrep). */
+ for (i = 0; i < patterns; ++i) {
+ if (fastncomp(&fg_pattern[i], pattern[i].pat,
+ pattern[i].len, cflags) != 0) {
+ /* Fall back to full regex library */
+ c = regcomp(&r_pattern[i], pattern[i].pat, cflags);
+ if (c != 0) {
+ regerror(c, &r_pattern[i], re_error,
+ RE_ERROR_BUF);
+ errx(2, "%s", re_error);
+ }
+ }
+ }
+
+ if (lbflag)
+ setlinebuf(stdout);
+
+ if ((aargc == 0 || aargc == 1) && !Hflag)
+ hflag = true;
+
+ if (aargc == 0)
+ exit(!procfile("-"));
+
+ if (dirbehave == DIR_RECURSE)
+ c = grep_tree(aargv);
+ else
+ for (c = 0; aargc--; ++aargv) {
+ if ((finclude || fexclude) && !file_matching(*aargv))
+ continue;
+ c+= procfile(*aargv);
+ }
+
+#ifndef WITHOUT_NLS
+ catclose(catalog);
+#endif
+
+ /* Find out the correct return value according to the
+ results and the command line option. */
+ exit(c ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1));
+}
diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h
new file mode 100644
index 0000000..5613d39
--- /dev/null
+++ b/usr.bin/grep/grep.h
@@ -0,0 +1,153 @@
+/* $NetBSD: grep.h,v 1.5 2011/02/27 17:33:37 joerg Exp $ */
+/* $OpenBSD: grep.h,v 1.15 2010/04/05 03:03:55 tedu Exp $ */
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2008-2009 Gabor Kovesdan <gabor@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 <bzlib.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <zlib.h>
+
+#include "fastmatch.h"
+
+#ifdef WITHOUT_NLS
+#define getstr(n) errstr[n]
+#else
+#include <nl_types.h>
+
+extern nl_catd catalog;
+#define getstr(n) catgets(catalog, 1, n, errstr[n])
+#endif
+
+extern const char *errstr[];
+
+#define VERSION "2.5.1-FreeBSD"
+
+#define GREP_FIXED 0
+#define GREP_BASIC 1
+#define GREP_EXTENDED 2
+
+#define BINFILE_BIN 0
+#define BINFILE_SKIP 1
+#define BINFILE_TEXT 2
+
+#define FILE_STDIO 0
+#define FILE_MMAP 1
+#define FILE_GZIP 2
+#define FILE_BZIP 3
+#define FILE_XZ 4
+#define FILE_LZMA 5
+
+#define DIR_READ 0
+#define DIR_SKIP 1
+#define DIR_RECURSE 2
+
+#define DEV_READ 0
+#define DEV_SKIP 1
+
+#define LINK_READ 0
+#define LINK_EXPLICIT 1
+#define LINK_SKIP 2
+
+#define EXCL_PAT 0
+#define INCL_PAT 1
+
+#define MAX_LINE_MATCHES 32
+
+struct file {
+ int fd;
+ bool binary;
+};
+
+struct str {
+ off_t off;
+ size_t len;
+ char *dat;
+ char *file;
+ int line_no;
+};
+
+struct pat {
+ char *pat;
+ int len;
+};
+
+struct epat {
+ char *pat;
+ int mode;
+};
+
+/* Flags passed to regcomp() and regexec() */
+extern int cflags, eflags;
+
+/* Command line flags */
+extern bool Eflag, Fflag, Gflag, Hflag, Lflag,
+ bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag,
+ qflag, sflag, vflag, wflag, xflag;
+extern bool dexclude, dinclude, fexclude, finclude, lbflag, nullflag;
+extern unsigned long long Aflag, Bflag;
+extern long long mcount;
+extern long long mlimit;
+extern char *label;
+extern const char *color;
+extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave;
+
+extern bool file_err, first, matchall, prev;
+extern int tail;
+extern unsigned int dpatterns, fpatterns, patterns;
+extern struct pat *pattern;
+extern struct epat *dpattern, *fpattern;
+extern regex_t *er_pattern, *r_pattern;
+extern fastmatch_t *fg_pattern;
+
+/* For regex errors */
+#define RE_ERROR_BUF 512
+extern char re_error[RE_ERROR_BUF + 1]; /* Seems big enough */
+
+/* util.c */
+bool file_matching(const char *fname);
+int procfile(const char *fn);
+int grep_tree(char **argv);
+void *grep_malloc(size_t size);
+void *grep_calloc(size_t nmemb, size_t size);
+void *grep_realloc(void *ptr, size_t size);
+char *grep_strdup(const char *str);
+void printline(struct str *line, int sep, regmatch_t *matches, int m);
+
+/* queue.c */
+void enqueue(struct str *x);
+void printqueue(void);
+void clearqueue(void);
+
+/* file.c */
+void grep_close(struct file *f);
+struct file *grep_open(const char *path);
+char *grep_fgetln(struct file *f, size_t *len);
diff --git a/usr.bin/grep/nls/C.msg b/usr.bin/grep/nls/C.msg
new file mode 100644
index 0000000..6327b27
--- /dev/null
+++ b/usr.bin/grep/nls/C.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(standard input)"
+2 "cannot read bzip2 compressed file"
+3 "unknown %s option"
+4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
+5 "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n"
+6 "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n"
+7 "\t[--null] [pattern] [file ...]\n"
+8 "Binary file %s matches\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/Makefile.inc b/usr.bin/grep/nls/Makefile.inc
new file mode 100644
index 0000000..0433f67
--- /dev/null
+++ b/usr.bin/grep/nls/Makefile.inc
@@ -0,0 +1,18 @@
+# $FreeBSD$
+NLSNAME= grep
+
+NLS= es_ES.ISO8859-1
+NLS+= gl_ES.ISO8859-1
+NLS+= hu_HU.ISO8859-2
+NLS+= ja_JP.eucJP
+NLS+= ja_JP.SJIS
+NLS+= ja_JP.UTF-8
+NLS+= pt_BR.ISO8859-1
+NLS+= ru_RU.KOI8-R
+NLS+= uk_UA.UTF-8
+NLS+= zh_CN.UTF-8
+
+NLSSRCDIR= ${.CURDIR}/nls
+.for lang in ${NLS}
+NLSSRCFILES_${lang}=${lang}.msg
+.endfor
diff --git a/usr.bin/grep/nls/es_ES.ISO8859-1.msg b/usr.bin/grep/nls/es_ES.ISO8859-1.msg
new file mode 100644
index 0000000..208e91d
--- /dev/null
+++ b/usr.bin/grep/nls/es_ES.ISO8859-1.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(entrada estándar)"
+2 "no se puede leer el fichero comprimido bzip2"
+3 "opción desconocida de %s"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+5 "\t[-e pauta] [-f fichero] [--binary-files=valor] [--color=cuando]\n"
+6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n"
+7 "\t[--null] [pauta] [fichero ...]\n"
+8 "fichero binario %s se ajusta\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/gl_ES.ISO8859-1.msg b/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
new file mode 100644
index 0000000..9f3915a
--- /dev/null
+++ b/usr.bin/grep/nls/gl_ES.ISO8859-1.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(entrada estándar)"
+2 "non se pode ler o ficheiro comprimido bzip2"
+3 "opción descoñecida de %s"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n"
+5 "\t[-e pauta] [-f ficheiro] [--binary-files=valor] [--color=cando]\n"
+6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n"
+7 "\t[--null] [pauta] [ficheiro ...]\n"
+8 "ficheiro binario %s conforma\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/hu_HU.ISO8859-2.msg b/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
new file mode 100644
index 0000000..6d3c1c9
--- /dev/null
+++ b/usr.bin/grep/nls/hu_HU.ISO8859-2.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(szabványos bemenet)"
+2 "bzip2 tömörített fájl nem olvasható"
+3 "ismeretlen %s opció"
+4 "használat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A szám] [-B szám] [-C[szám]]\n"
+5 "\t[-e minta] [-f fájl] [--binary-files=érték] [--color=mikor]\n"
+6 "\t[--context[=szám]] [--directories=mûvelet] [--label] [--line-buffered]\n"
+7 "\t[--null] [minta] [fájl ...]\n"
+8 "%s bináris fájl illeszkedik\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/ja_JP.SJIS.msg b/usr.bin/grep/nls/ja_JP.SJIS.msg
new file mode 100644
index 0000000..d18edd5
--- /dev/null
+++ b/usr.bin/grep/nls/ja_JP.SJIS.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(•W€“ü—Í)"
+2 "bzip2 ˆ³kƒtƒ@ƒCƒ‹‚ð“Ç‚Ýž‚Þ‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ"
+3 "%s ƒIƒvƒVƒ‡ƒ“‚ÌŽw’è’l‚ÉŒë‚肪‚ ‚è‚Ü‚·"
+4 "Žg‚¢•û: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ”Žš] [-B ”Žš] [-C[”Žš]]\n"
+5 "\t[-e ƒpƒ^[ƒ“] [-f ƒtƒ@ƒCƒ‹–¼] [--binary-files=’l] [--color=’l]\n"
+6 "\t[--context[=”Žš]] [--directories=“®ì] [--label] [--line-buffered]\n"
+7 "\t[--null] [ƒpƒ^[ƒ“] [ƒtƒ@ƒCƒ‹–¼ ...]\n"
+8 "ƒoƒCƒiƒŠƒtƒ@ƒCƒ‹ %s ‚Ƀ}ƒbƒ`‚µ‚Ü‚µ‚½\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/ja_JP.UTF-8.msg b/usr.bin/grep/nls/ja_JP.UTF-8.msg
new file mode 100644
index 0000000..84c6f45
--- /dev/null
+++ b/usr.bin/grep/nls/ja_JP.UTF-8.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(標準入力)"
+2 "bzip2 圧縮ファイルを読ã¿è¾¼ã‚€ã“ã¨ãŒã§ãã¾ã›ã‚“"
+3 "%s オプションã®æŒ‡å®šå€¤ã«èª¤ã‚ŠãŒã‚ã‚Šã¾ã™"
+4 "使ã„æ–¹: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A æ•°å­—] [-B æ•°å­—] [-C[æ•°å­—]]\n"
+5 "\t[-e パターン] [-f ファイルå] [--binary-files=値] [--color=値]\n"
+6 "\t[--context[=数字]] [--directories=動作] [--label] [--line-buffered]\n"
+7 "\t[--null] [パターン] [ファイルå ...]\n"
+8 "ãƒã‚¤ãƒŠãƒªãƒ•ã‚¡ã‚¤ãƒ« %s ã«ãƒžãƒƒãƒã—ã¾ã—ãŸ\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/ja_JP.eucJP.msg b/usr.bin/grep/nls/ja_JP.eucJP.msg
new file mode 100644
index 0000000..e778c5f
--- /dev/null
+++ b/usr.bin/grep/nls/ja_JP.eucJP.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(ɸ½àÆþÎÏ)"
+2 "bzip2 °µ½Ì¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó"
+3 "%s ¥ª¥×¥·¥ç¥ó¤Î»ØÄêÃͤ˸í¤ê¤¬¤¢¤ê¤Þ¤¹"
+4 "»È¤¤Êý: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ¿ô»ú] [-B ¿ô»ú] [-C[¿ô»ú]]\n"
+5 "\t[-e ¥Ñ¥¿¡¼¥ó] [-f ¥Õ¥¡¥¤¥ë̾] [--binary-files=ÃÍ] [--color=ÃÍ]\n"
+6 "\t[--context[=¿ô»ú]] [--directories=Æ°ºî] [--label] [--line-buffered]\n"
+7 "\t[--null] [¥Ñ¥¿¡¼¥ó] [¥Õ¥¡¥¤¥ë̾ ...]\n"
+8 "¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë %s ¤Ë¥Þ¥Ã¥Á¤·¤Þ¤·¤¿\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/pt_BR.ISO8859-1.msg b/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
new file mode 100644
index 0000000..79c026e
--- /dev/null
+++ b/usr.bin/grep/nls/pt_BR.ISO8859-1.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(entrada padrão)"
+2 "não se posso ler o fichero comprimido bzip2"
+3 "opcão não conhecida de %s"
+4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
+5 "\t[-e padrão] [-f arquivo] [--binary-files=valor] [--color=quando]\n"
+6 "\t[--context[=num]] [--directories=ação] [--label] [--line-buffered]\n"
+7 "\t[--null] [padrão] [arquivo ...]\n"
+8 "arquivo binário %s casa com o padrão\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/ru_RU.KOI8-R.msg b/usr.bin/grep/nls/ru_RU.KOI8-R.msg
new file mode 100644
index 0000000..6880d51
--- /dev/null
+++ b/usr.bin/grep/nls/ru_RU.KOI8-R.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(ÓÔÁÎÄÁÒÔÎÙÊ ××ÏÄ)"
+2 "ÎÅ ÍÏÇÕ ÐÒÏÞÉÔÁÔØ ÓÖÁÔÙÊ × bzip2 ÆÁÊÌ"
+3 "ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ %s"
+4 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ÞÉÓ] [-B ÞÉÓ] [-C[ÞÉÓ]]\n"
+5 "\t[-e ÛÁÂÌÏÎ] [-f ÆÁÊÌ] [--binary-files=ÚÎÁÞÅÎÉÅ] [--color=ËÏÇÄÁ]\n"
+6 "\t[--context[=ÞÉÓ]] [--directories=ÄÅÊÓÔ×ÉÅ] [--label] [--line-buffered]\n"
+7 "\t[--null] [ÛÁÂÌÏÎ] [ÆÁÊÌ ...]\n"
+8 "Ä×ÏÉÞÎÙÊ ÆÁÊÌ %s ÓÏ×ÐÁÄÁÅÔ\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/uk_UA.UTF-8.msg b/usr.bin/grep/nls/uk_UA.UTF-8.msg
new file mode 100644
index 0000000..4492d31
--- /dev/null
+++ b/usr.bin/grep/nls/uk_UA.UTF-8.msg
@@ -0,0 +1,12 @@
+$ $FreeBSD$
+$set 1
+$quote "
+1 "(Ñтандартний ввід)"
+2 "не можу прочитати ÑтиÑнутий bzip2 файл"
+3 "невiдома Ð¾Ð¿Ñ†Ñ–Ñ %s"
+4 "викориÑтаннÑ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A чиÑ] [-B чиÑ] [-C[чиÑ]]\n"
+5 "\t[-e шаблон] [-f файл] [--binary-files=значеннÑ] [--color=коли]\n"
+6 "\t[--context[=чиÑ] [--directories=діÑ] [--label] [--line-buffered]\n"
+7 "\t[--null] [шаблон] [файл ...]\n"
+8 "двійковий файл %s Ñпівпадає\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/nls/zh_CN.UTF-8.msg b/usr.bin/grep/nls/zh_CN.UTF-8.msg
new file mode 100644
index 0000000..d5cd0c2
--- /dev/null
+++ b/usr.bin/grep/nls/zh_CN.UTF-8.msg
@@ -0,0 +1,13 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "(标准输入)"
+2 "è¯»å– bzip2 压缩文件时出错"
+3 "选项 %s 无法识别"
+4 "用法: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A 行数] [-B 行数] [-C[行数]]\n"
+5 "\t[-e 模å¼] [-f 文件] [--binary-files=值] [--color=何时]\n"
+6 "\t[--context[=行数]] [--directories=动作] [--label] [--line-buffered]\n"
+7 "\t[--null] [模å¼] [文件å ...]\n"
+8 "二进制文件 %s 包å«æ¨¡å¼\n"
+9 "%s (BSD grep) %s\n"
diff --git a/usr.bin/grep/queue.c b/usr.bin/grep/queue.c
new file mode 100644
index 0000000..1887888
--- /dev/null
+++ b/usr.bin/grep/queue.c
@@ -0,0 +1,113 @@
+/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * 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.
+ */
+
+/*
+ * A really poor man's queue. It does only what it has to and gets out of
+ * Dodge. It is used in place of <sys/queue.h> to get a better performance.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "grep.h"
+
+struct qentry {
+ STAILQ_ENTRY(qentry) list;
+ struct str data;
+};
+
+static STAILQ_HEAD(, qentry) queue = STAILQ_HEAD_INITIALIZER(queue);
+static unsigned long long count;
+
+static struct qentry *dequeue(void);
+
+void
+enqueue(struct str *x)
+{
+ struct qentry *item;
+
+ item = grep_malloc(sizeof(struct qentry));
+ item->data.dat = grep_malloc(sizeof(char) * x->len);
+ item->data.len = x->len;
+ item->data.line_no = x->line_no;
+ item->data.off = x->off;
+ memcpy(item->data.dat, x->dat, x->len);
+ item->data.file = x->file;
+
+ STAILQ_INSERT_TAIL(&queue, item, list);
+
+ if (++count > Bflag) {
+ item = dequeue();
+ free(item->data.dat);
+ free(item);
+ }
+}
+
+static struct qentry *
+dequeue(void)
+{
+ struct qentry *item;
+
+ item = STAILQ_FIRST(&queue);
+ if (item == NULL)
+ return (NULL);
+
+ STAILQ_REMOVE_HEAD(&queue, list);
+ --count;
+ return (item);
+}
+
+void
+printqueue(void)
+{
+ struct qentry *item;
+
+ while ((item = dequeue()) != NULL) {
+ printline(&item->data, '-', NULL, 0);
+ free(item->data.dat);
+ free(item);
+ }
+}
+
+void
+clearqueue(void)
+{
+ struct qentry *item;
+
+ while ((item = dequeue()) != NULL) {
+ free(item->data.dat);
+ free(item);
+ }
+}
diff --git a/usr.bin/grep/regex/fastmatch.c b/usr.bin/grep/regex/fastmatch.c
new file mode 100644
index 0000000..990d847
--- /dev/null
+++ b/usr.bin/grep/regex/fastmatch.c
@@ -0,0 +1,169 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2011 Gabor Kovesdan <gabor@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 "glue.h"
+
+#include <errno.h>
+#include <fastmatch.h>
+#include <regex.h>
+#include <string.h>
+
+#include "tre-fastmatch.h"
+#include "xmalloc.h"
+
+int
+tre_fixncomp(fastmatch_t *preg, const char *regex, size_t n, int cflags)
+{
+ int ret;
+ tre_char_t *wregex;
+ size_t wlen;
+
+ if (n != 0)
+ {
+ ret = tre_convert_pattern(regex, n, &wregex, &wlen);
+ if (ret != REG_OK)
+ return ret;
+ else
+ ret = tre_compile_literal(preg, wregex, wlen, cflags);
+ tre_free_pattern(wregex);
+ return ret;
+ }
+ else
+ return tre_compile_literal(preg, NULL, 0, cflags);
+}
+
+int
+tre_fastncomp(fastmatch_t *preg, const char *regex, size_t n, int cflags)
+{
+ int ret;
+ tre_char_t *wregex;
+ size_t wlen;
+
+ if (n != 0)
+ {
+ ret = tre_convert_pattern(regex, n, &wregex, &wlen);
+ if (ret != REG_OK)
+ return ret;
+ else
+ ret = (cflags & REG_LITERAL)
+ ? tre_compile_literal(preg, wregex, wlen, cflags)
+ : tre_compile_fast(preg, wregex, wlen, cflags);
+ tre_free_pattern(wregex);
+ return ret;
+ }
+ else
+ return tre_compile_literal(preg, NULL, 0, cflags);
+}
+
+
+int
+tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags)
+{
+ return tre_fixncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
+}
+
+int
+tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags)
+{
+ return tre_fastncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
+}
+
+int
+tre_fixwncomp(fastmatch_t *preg, const wchar_t *regex, size_t n, int cflags)
+{
+ return tre_compile_literal(preg, regex, n, cflags);
+}
+
+int
+tre_fastwncomp(fastmatch_t *preg, const wchar_t *regex, size_t n, int cflags)
+{
+ return (cflags & REG_LITERAL) ?
+ tre_compile_literal(preg, regex, n, cflags) :
+ tre_compile_fast(preg, regex, n, cflags);
+}
+
+int
+tre_fixwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags)
+{
+ return tre_fixwncomp(preg, regex, regex ? tre_strlen(regex) : 0, cflags);
+}
+
+int
+tre_fastwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags)
+{
+ return tre_fastwncomp(preg, regex, regex ? tre_strlen(regex) : 0, cflags);
+}
+
+void
+tre_fastfree(fastmatch_t *preg)
+{
+ tre_free_fast(preg);
+}
+
+int
+tre_fastnexec(const fastmatch_t *preg, const char *string, size_t len,
+ size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+ tre_str_type_t type = (TRE_MB_CUR_MAX == 1) ? STR_BYTE : STR_MBS;
+
+ if (eflags & REG_STARTEND)
+ CALL_WITH_OFFSET(tre_match_fast(preg, &string[offset], slen,
+ type, nmatch, pmatch, eflags));
+ else
+ return tre_match_fast(preg, string, len, type, nmatch,
+ pmatch, eflags);
+}
+
+int
+tre_fastexec(const fastmatch_t *preg, const char *string, size_t nmatch,
+ regmatch_t pmatch[], int eflags)
+{
+ return tre_fastnexec(preg, string, (size_t)-1, nmatch, pmatch, eflags);
+}
+
+int
+tre_fastwnexec(const fastmatch_t *preg, const wchar_t *string, size_t len,
+ size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+ tre_str_type_t type = STR_WIDE;
+
+ if (eflags & REG_STARTEND)
+ CALL_WITH_OFFSET(tre_match_fast(preg, &string[offset], slen,
+ type, nmatch, pmatch, eflags));
+ else
+ return tre_match_fast(preg, string, len, type, nmatch,
+ pmatch, eflags);
+}
+
+int
+tre_fastwexec(const fastmatch_t *preg, const wchar_t *string,
+ size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+ return tre_fastwnexec(preg, string, (size_t)-1, nmatch, pmatch, eflags);
+}
+
diff --git a/usr.bin/grep/regex/fastmatch.h b/usr.bin/grep/regex/fastmatch.h
new file mode 100644
index 0000000..68a50c6
--- /dev/null
+++ b/usr.bin/grep/regex/fastmatch.h
@@ -0,0 +1,108 @@
+/* $FreeBSD$ */
+
+#ifndef FASTMATCH_H
+#define FASTMATCH_H 1
+
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <wchar.h>
+
+typedef struct {
+ size_t wlen;
+ size_t len;
+ wchar_t *wpattern;
+ bool *wescmap;
+ unsigned int qsBc[UCHAR_MAX + 1];
+ unsigned int *bmGs;
+ char *pattern;
+ bool *escmap;
+ unsigned int defBc;
+ void *qsBc_table;
+ unsigned int *sbmGs;
+ const char *re_endp;
+
+ /* flags */
+ bool hasdot;
+ bool bol;
+ bool eol;
+ bool word;
+ bool icase;
+ bool newline;
+ bool nosub;
+ bool matchall;
+ bool reversed;
+} fastmatch_t;
+
+extern int
+tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags);
+
+extern int
+tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags);
+
+extern int
+tre_fastexec(const fastmatch_t *preg, const char *string, size_t nmatch,
+ regmatch_t pmatch[], int eflags);
+
+extern void
+tre_fastfree(fastmatch_t *preg);
+
+extern int
+tre_fixwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags);
+
+extern int
+tre_fastwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags);
+
+extern int
+tre_fastwexec(const fastmatch_t *preg, const wchar_t *string,
+ size_t nmatch, regmatch_t pmatch[], int eflags);
+
+/* Versions with a maximum length argument and therefore the capability to
+ handle null characters in the middle of the strings. */
+extern int
+tre_fixncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags);
+
+extern int
+tre_fastncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags);
+
+extern int
+tre_fastnexec(const fastmatch_t *preg, const char *string, size_t len,
+ size_t nmatch, regmatch_t pmatch[], int eflags);
+
+extern int
+tre_fixwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags);
+
+extern int
+tre_fastwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags);
+
+extern int
+tre_fastwnexec(const fastmatch_t *preg, const wchar_t *string, size_t len,
+ size_t nmatch, regmatch_t pmatch[], int eflags);
+
+#define fixncomp tre_fixncomp
+#define fastncomp tre_fastncomp
+#define fixcomp tre_fixcomp
+#define fastcomp tre_fastcomp
+#define fixwncomp tre_fixwncomp
+#define fastwncomp tre_fastwncomp
+#define fixwcomp tre_fixwcomp
+#define fastwcomp tre_fastwcomp
+#define fastfree tre_fastfree
+#define fastnexec tre_fastnexec
+#define fastexec tre_fastexec
+#define fastwnexec tre_fastwnexec
+#define fastwexec tre_fastwexec
+#define fixcomp tre_fixcomp
+#define fastcomp tre_fastcomp
+#define fastexec tre_fastexec
+#define fastfree tre_fastfree
+#define fixwcomp tre_fixwcomp
+#define fastwcomp tre_fastwcomp
+#define fastwexec tre_fastwexec
+#define fixncomp tre_fixncomp
+#define fastncomp tre_fastncomp
+#define fastnexec tre_fastnexec
+#define fixwncomp tre_fixwncomp
+#define fastwncomp tre_fastwncomp
+#define fastwnexec tre_fastwnexec
+#endif /* FASTMATCH_H */
diff --git a/usr.bin/grep/regex/glue.h b/usr.bin/grep/regex/glue.h
new file mode 100644
index 0000000..0c54e98
--- /dev/null
+++ b/usr.bin/grep/regex/glue.h
@@ -0,0 +1,67 @@
+/* $FreeBSD$ */
+
+#ifndef GLUE_H
+#define GLUE_H
+
+#include <limits.h>
+#undef RE_DUP_MAX
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TRE_WCHAR 1
+#define TRE_MULTIBYTE 1
+#define HAVE_MBSTATE_T 1
+
+#define TRE_CHAR(n) L##n
+#define CHF "%lc"
+
+#define tre_char_t wchar_t
+#define tre_mbrtowc(pwc, s, n, ps) (mbrtowc((pwc), (s), (n), (ps)))
+#define tre_strlen wcslen
+#define tre_isspace iswspace
+#define tre_isalnum iswalnum
+
+#define REG_OK 0
+#define REG_LITERAL 0020
+#define REG_WORD 0100
+#define REG_GNU 0400
+
+#define TRE_MB_CUR_MAX MB_CUR_MAX
+
+#ifndef _GREP_DEBUG
+#define DPRINT(msg)
+#else
+#define DPRINT(msg) do {printf msg; fflush(stdout);} while(/*CONSTCOND*/0)
+#endif
+
+#define MIN(a,b) ((a > b) ? (b) : (a))
+#define MAX(a,b) ((a > b) ? (a) : (b))
+
+typedef enum { STR_WIDE, STR_BYTE, STR_MBS, STR_USER } tre_str_type_t;
+
+#define CALL_WITH_OFFSET(fn) \
+ do \
+ { \
+ size_t slen = (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so); \
+ size_t offset = pmatch[0].rm_so; \
+ int ret; \
+ \
+ if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \
+ return REG_NOMATCH; \
+ ret = fn; \
+ for (unsigned i = 0; (!preg->nosub && (i < nmatch)); i++) \
+ { \
+ pmatch[i].rm_so += offset; \
+ pmatch[i].rm_eo += offset; \
+ } \
+ return ret; \
+ } while (0 /*CONSTCOND*/)
+
+int
+tre_convert_pattern(const char *regex, size_t n, tre_char_t **w,
+ size_t *wn);
+
+void
+tre_free_pattern(tre_char_t *wregex);
+#endif
diff --git a/usr.bin/grep/regex/hashtable.c b/usr.bin/grep/regex/hashtable.c
new file mode 100644
index 0000000..41ebcd1
--- /dev/null
+++ b/usr.bin/grep/regex/hashtable.c
@@ -0,0 +1,268 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2011 Gabor Kovesdan <gabor@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 "glue.h"
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "hashtable.h"
+
+
+/*
+ * Return a 32-bit hash of the given buffer. The init
+ * value should be 0, or the previous hash value to extend
+ * the previous hash.
+ */
+static uint32_t
+hash32_buf(const void *buf, size_t len, uint32_t hash)
+{
+ const unsigned char *p = buf;
+
+ while (len--)
+ hash = HASHSTEP(hash, *p++);
+
+ return hash;
+}
+
+/*
+ * Initializes a hash table that can hold table_size number of entries,
+ * each of which has a key of key_size bytes and a value of value_size
+ * bytes. On successful allocation returns a pointer to the hash table.
+ * Otherwise, returns NULL and sets errno to indicate the error.
+ */
+hashtable
+*hashtable_init(size_t table_size, size_t key_size, size_t value_size)
+{
+ hashtable *tbl;
+
+ DPRINT(("hashtable_init: table_size %zu, key_size %zu, value_size %zu\n",
+ table_size, key_size, value_size));
+
+ tbl = malloc(sizeof(hashtable));
+ if (tbl == NULL)
+ goto mem1;
+
+ tbl->entries = calloc(sizeof(hashtable_entry *), table_size);
+ if (tbl->entries == NULL)
+ goto mem2;
+
+ tbl->table_size = table_size;
+ tbl->usage = 0;
+ tbl->key_size = key_size;
+ tbl->value_size = value_size;
+
+ return (tbl);
+
+mem2:
+ free(tbl);
+mem1:
+ DPRINT(("hashtable_init: allocation failed\n"));
+ errno = ENOMEM;
+ return (NULL);
+}
+
+/*
+ * Places the key-value pair to the hashtable tbl.
+ * Returns:
+ * HASH_OK: if the key was not present in the hash table yet
+ * but the kay-value pair has been successfully added.
+ * HASH_UPDATED: if the value for the key has been updated with the
+ * new value.
+ * HASH_FULL: if the hash table is full and the entry could not
+ * be added.
+ * HASH_FAIL: if an error has occurred and errno has been set to
+ * indicate the error.
+ */
+int
+hashtable_put(hashtable *tbl, const void *key, const void *value)
+{
+ uint32_t hash = 0;
+
+ if (tbl->table_size == tbl->usage)
+ {
+ DPRINT(("hashtable_put: hashtable is full\n"));
+ return (HASH_FULL);
+ }
+
+ hash = hash32_buf(key, tbl->key_size, hash) % tbl->table_size;
+ DPRINT(("hashtable_put: calculated hash %" PRIu32 "\n", hash));
+
+ /*
+ * On hash collision entries are inserted at the next free space,
+ * so we have to increase the index until we either find an entry
+ * with the same key (and update it) or we find a free space.
+ */
+ for(;;)
+ {
+ if (tbl->entries[hash] == NULL)
+ break;
+ else if (memcmp(tbl->entries[hash]->key, key, tbl->key_size) == 0)
+ {
+ memcpy(tbl->entries[hash]->value, value, tbl->value_size);
+ DPRINT(("hashtable_put: effective location is %" PRIu32
+ ", entry updated\n", hash));
+ return (HASH_UPDATED);
+ }
+ if (++hash == tbl->table_size)
+ hash = 0;
+ }
+
+ DPRINT(("hashtable_put: effective location is %" PRIu32 "\n", hash));
+
+ tbl->entries[hash] = malloc(sizeof(hashtable_entry));
+ if (tbl->entries[hash] == NULL)
+ {
+ errno = ENOMEM;
+ goto mem1;
+ }
+
+ tbl->entries[hash]->key = malloc(tbl->key_size);
+ if (tbl->entries[hash]->key == NULL)
+ {
+ errno = ENOMEM;
+ goto mem2;
+ }
+
+ tbl->entries[hash]->value = malloc(tbl->value_size);
+ if (tbl->entries[hash]->value == NULL)
+ {
+ errno = ENOMEM;
+ goto mem3;
+ }
+
+ memcpy(tbl->entries[hash]->key, key, tbl->key_size);
+ memcpy(tbl->entries[hash]->value, value, tbl->value_size);
+ tbl->usage++;
+
+ DPRINT(("hashtable_put: entry successfully inserted\n"));
+
+ return (HASH_OK);
+
+mem3:
+ free(tbl->entries[hash]->key);
+mem2:
+ free(tbl->entries[hash]);
+mem1:
+ DPRINT(("hashtable_put: insertion failed\n"));
+ return (HASH_FAIL);
+}
+
+static hashtable_entry
+**hashtable_lookup(const hashtable *tbl, const void *key)
+{
+ uint32_t hash = 0;
+
+ hash = hash32_buf(key, tbl->key_size, hash) % tbl->table_size;
+
+ for (;;)
+ {
+ if (tbl->entries[hash] == NULL)
+ return (NULL);
+ else if (memcmp(key, tbl->entries[hash]->key, tbl->key_size) == 0)
+ {
+ DPRINT(("hashtable_lookup: entry found at location %" PRIu32 "\n", hash));
+ return (&tbl->entries[hash]);
+ }
+
+ if (++hash == tbl->table_size)
+ hash = 0;
+ }
+}
+
+/*
+ * Retrieves the value for key from the hash table tbl and places
+ * it to the space indicated by the value argument.
+ * Returns HASH_OK if the value has been found and retrieved or
+ * HASH_NOTFOUND otherwise.
+ */
+int
+hashtable_get(hashtable *tbl, const void *key, void *value)
+{
+ hashtable_entry **entry;
+
+ entry = hashtable_lookup(tbl, key);
+ if (entry == NULL)
+ {
+ DPRINT(("hashtable_get: entry is not available in the hashtable\n"));
+ return (HASH_NOTFOUND);
+ }
+
+ memcpy(value, (*entry)->value, tbl->value_size);
+ DPRINT(("hashtable_get: entry successfully copied into output buffer\n"));
+ return (HASH_OK);
+}
+
+/*
+ * Removes the entry with the specifified key from the hash table
+ * tbl. Returns HASH_OK if the entry has been found and removed
+ * or HASH_NOTFOUND otherwise.
+ */
+int
+hashtable_remove(hashtable *tbl, const void *key)
+{
+ hashtable_entry **entry;
+
+ entry = hashtable_lookup(tbl, key);
+ if (entry == NULL)
+ {
+ DPRINT(("hashtable_remove: entry is not available in the hashtable\n"));
+ return (HASH_NOTFOUND);
+ }
+
+ free((*entry)->key);
+ free((*entry)->value);
+ free(*entry);
+ *entry = NULL;
+
+ tbl->usage--;
+ DPRINT(("hashtable_remove: entry successfully removed\n"));
+ return (HASH_OK);
+}
+
+/*
+ * Frees the resources associated with the hash table tbl.
+ */
+void
+hashtable_free(hashtable *tbl)
+{
+ if (tbl == NULL)
+ return;
+
+ for (unsigned int i = 0; i < tbl->table_size; i++)
+ if ((tbl->entries[i] != NULL))
+ {
+ free(tbl->entries[i]->key);
+ free(tbl->entries[i]->value);
+ }
+
+ free(tbl->entries);
+ DPRINT(("hashtable_free: resources are successfully freed\n"));
+}
diff --git a/usr.bin/grep/regex/hashtable.h b/usr.bin/grep/regex/hashtable.h
new file mode 100644
index 0000000..f8b1daa
--- /dev/null
+++ b/usr.bin/grep/regex/hashtable.h
@@ -0,0 +1,35 @@
+/* $FreeBSD$ */
+
+#ifndef HASHTABLE_H
+#define HASHTABLE_H 1
+
+#include <sys/types.h>
+
+#define HASH_OK 0
+#define HASH_UPDATED 1
+#define HASH_FAIL 2
+#define HASH_FULL 3
+#define HASH_NOTFOUND 4
+
+#define HASHSTEP(x,c) (((x << 5) + x) + (c))
+
+typedef struct {
+ void *key;
+ void *value;
+} hashtable_entry;
+
+typedef struct {
+ size_t key_size;
+ size_t table_size;
+ size_t usage;
+ size_t value_size;
+ hashtable_entry **entries;
+} hashtable;
+
+void hashtable_free(hashtable *);
+int hashtable_get(hashtable *, const void *, void *);
+hashtable *hashtable_init(size_t, size_t, size_t);
+int hashtable_put(hashtable *, const void *, const void *);
+int hashtable_remove(hashtable *, const void *);
+
+#endif /* HASHTABLE.H */
diff --git a/usr.bin/grep/regex/tre-compile.c b/usr.bin/grep/regex/tre-compile.c
new file mode 100644
index 0000000..f037c49
--- /dev/null
+++ b/usr.bin/grep/regex/tre-compile.c
@@ -0,0 +1,103 @@
+/* $FreeBSD$ */
+
+#include "glue.h"
+
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <regex.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "xmalloc.h"
+
+int
+tre_convert_pattern(const char *regex, size_t n, tre_char_t **w,
+ size_t *wn)
+{
+#if TRE_WCHAR
+ tre_char_t *wregex;
+ size_t wlen;
+
+ wregex = xmalloc(sizeof(tre_char_t) * (n + 1));
+ if (wregex == NULL)
+ return REG_ESPACE;
+
+ /* If the current locale uses the standard single byte encoding of
+ characters, we don't do a multibyte string conversion. If we did,
+ many applications which use the default locale would break since
+ the default "C" locale uses the 7-bit ASCII character set, and
+ all characters with the eighth bit set would be considered invalid. */
+#if TRE_MULTIBYTE
+ if (TRE_MB_CUR_MAX == 1)
+#endif /* TRE_MULTIBYTE */
+ {
+ unsigned int i;
+ const unsigned char *str = (const unsigned char *)regex;
+ tre_char_t *wstr = wregex;
+
+ for (i = 0; i < n; i++)
+ *(wstr++) = *(str++);
+ wlen = n;
+ }
+#if TRE_MULTIBYTE
+ else
+ {
+ int consumed;
+ tre_char_t *wcptr = wregex;
+#ifdef HAVE_MBSTATE_T
+ mbstate_t state;
+ memset(&state, '\0', sizeof(state));
+#endif /* HAVE_MBSTATE_T */
+ while (n > 0)
+ {
+ consumed = tre_mbrtowc(wcptr, regex, n, &state);
+
+ switch (consumed)
+ {
+ case 0:
+ if (*regex == '\0')
+ consumed = 1;
+ else
+ {
+ xfree(wregex);
+ return REG_BADPAT;
+ }
+ break;
+ case -1:
+ DPRINT(("mbrtowc: error %d: %s.\n", errno, strerror(errno)));
+ xfree(wregex);
+ return REG_BADPAT;
+ case -2:
+ /* The last character wasn't complete. Let's not call it a
+ fatal error. */
+ consumed = n;
+ break;
+ }
+ regex += consumed;
+ n -= consumed;
+ wcptr++;
+ }
+ wlen = wcptr - wregex;
+ }
+#endif /* TRE_MULTIBYTE */
+ wregex[wlen] = L'\0';
+ *w = wregex;
+ *wn = wlen;
+ return REG_OK;
+#else /* !TRE_WCHAR */
+ {
+ *w = (tre_char_t * const *)regex;
+ *wn = n;
+ return REG_OK;
+ }
+#endif /* !TRE_WCHAR */
+}
+
+void
+tre_free_pattern(tre_char_t *wregex)
+{
+#if TRE_WCHAR
+ xfree(wregex);
+#endif
+}
diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c
new file mode 100644
index 0000000..0881c55
--- /dev/null
+++ b/usr.bin/grep/regex/tre-fastmatch.c
@@ -0,0 +1,1042 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * Copyright (C) 2008-2011 Gabor Kovesdan <gabor@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 "glue.h"
+
+#include <ctype.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef TRE_WCHAR
+#include <wchar.h>
+#include <wctype.h>
+#endif
+
+#include "hashtable.h"
+#include "tre-fastmatch.h"
+#include "xmalloc.h"
+
+static int fastcmp(const fastmatch_t *fg, const void *data,
+ tre_str_type_t type);
+
+/*
+ * Clean up if pattern compilation fails.
+ */
+#define FAIL_COMP(errcode) \
+ { \
+ if (fg->pattern) \
+ xfree(fg->pattern); \
+ if (fg->wpattern) \
+ xfree(fg->wpattern); \
+ if (fg->qsBc_table) \
+ hashtable_free(fg->qsBc_table); \
+ fg = NULL; \
+ return errcode; \
+ }
+
+/*
+ * Skips n characters in the input string and assigns the start
+ * address to startptr. Note: as per IEEE Std 1003.1-2008
+ * matching is based on bit pattern not character representations
+ * so we can handle MB strings as byte sequences just like
+ * SB strings.
+ */
+#define SKIP_CHARS(n) \
+ switch (type) \
+ { \
+ case STR_WIDE: \
+ startptr = str_wide + n; \
+ break; \
+ default: \
+ startptr = str_byte + n; \
+ }
+
+/*
+ * Converts the wide string pattern to SB/MB string and stores
+ * it in fg->pattern. Sets fg->len to the byte length of the
+ * converted string.
+ */
+#define STORE_MBS_PAT \
+ { \
+ size_t siz; \
+ \
+ siz = wcstombs(NULL, fg->wpattern, 0); \
+ if (siz == (size_t)-1) \
+ return REG_BADPAT; \
+ fg->len = siz; \
+ fg->pattern = xmalloc(siz + 1); \
+ if (fg->pattern == NULL) \
+ return REG_ESPACE; \
+ wcstombs(fg->pattern, fg->wpattern, siz); \
+ fg->pattern[siz] = '\0'; \
+ } \
+
+#define IS_OUT_OF_BOUNDS \
+ ((!fg->reversed \
+ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \
+ : ((j + fg->len) > len)) \
+ : (j < 0)))
+
+/*
+ * Checks whether the new position after shifting in the input string
+ * is out of the bounds and break out from the loop if so.
+ */
+#define CHECKBOUNDS \
+ if (IS_OUT_OF_BOUNDS) \
+ break; \
+
+/*
+ * Shifts in the input string after a mismatch. The position of the
+ * mismatch is stored in the mismatch variable.
+ */
+#define SHIFT \
+ CHECKBOUNDS; \
+ \
+ { \
+ int r = -1; \
+ unsigned int bc = 0, gs = 0, ts; \
+ \
+ switch (type) \
+ { \
+ case STR_WIDE: \
+ if (!fg->hasdot) \
+ { \
+ if (u != 0 && (unsigned)mismatch == fg->wlen - 1 - shift) \
+ mismatch -= u; \
+ v = fg->wlen - 1 - mismatch; \
+ r = hashtable_get(fg->qsBc_table, \
+ &str_wide[!fg->reversed ? (size_t)j + fg->wlen \
+ : (size_t)j - 1], &bc); \
+ gs = fg->bmGs[mismatch]; \
+ } \
+ bc = (r == HASH_OK) ? bc : fg->defBc; \
+ DPRINT(("tre_fast_match: mismatch on character" CHF ", " \
+ "BC %d, GS %d\n", \
+ ((const tre_char_t *)startptr)[mismatch + 1], \
+ bc, gs)); \
+ break; \
+ default: \
+ if (!fg->hasdot) \
+ { \
+ if (u != 0 && (unsigned)mismatch == fg->len - 1 - shift) \
+ mismatch -= u; \
+ v = fg->len - 1 - mismatch; \
+ gs = fg->sbmGs[mismatch]; \
+ } \
+ bc = fg->qsBc[((const unsigned char *)str_byte) \
+ [!fg->reversed ? (size_t)j + fg->len \
+ : (size_t)j - 1]]; \
+ DPRINT(("tre_fast_match: mismatch on character %c, " \
+ "BC %d, GS %d\n", \
+ ((const unsigned char *)startptr)[mismatch + 1], \
+ bc, gs)); \
+ } \
+ if (fg->hasdot) \
+ shift = bc; \
+ else \
+ { \
+ ts = (u >= v) ? (u - v) : 0; \
+ shift = MAX(ts, bc); \
+ shift = MAX(shift, gs); \
+ if (shift == gs) \
+ u = MIN((type == STR_WIDE ? fg->wlen : fg->len) - shift, v); \
+ else \
+ { \
+ if (ts < bc) \
+ shift = MAX(shift, u + 1); \
+ u = 0; \
+ } \
+ } \
+ DPRINT(("tre_fast_match: shifting %u characters\n", shift)); \
+ j = !fg->reversed ? j + shift : j - shift; \
+ }
+
+/*
+ * Normal Quick Search would require a shift based on the position the
+ * next character after the comparison is within the pattern. With
+ * wildcards, the position of the last dot effects the maximum shift
+ * distance.
+ * The closer to the end the wild card is the slower the search.
+ *
+ * Examples:
+ * Pattern Max shift
+ * ------- ---------
+ * this 5
+ * .his 4
+ * t.is 3
+ * th.s 2
+ * thi. 1
+ */
+
+/*
+ * Fills in the bad character shift array for SB/MB strings.
+ */
+#define FILL_QSBC \
+ if (fg->reversed) \
+ { \
+ _FILL_QSBC_REVERSED \
+ } \
+ else \
+ { \
+ _FILL_QSBC \
+ }
+
+#define _FILL_QSBC \
+ for (unsigned int i = 0; i <= UCHAR_MAX; i++) \
+ fg->qsBc[i] = fg->len - hasdot; \
+ for (unsigned int i = hasdot + 1; i < fg->len; i++) \
+ { \
+ fg->qsBc[(unsigned char)fg->pattern[i]] = fg->len - i; \
+ DPRINT(("BC shift for char %c is %zu\n", fg->pattern[i], \
+ fg->len - i)); \
+ if (fg->icase) \
+ { \
+ char c = islower((unsigned char)fg->pattern[i]) ? \
+ toupper((unsigned char)fg->pattern[i]) : \
+ tolower((unsigned char)fg->pattern[i]); \
+ fg->qsBc[(unsigned char)c] = fg->len - i; \
+ DPRINT(("BC shift for char %c is %zu\n", c, fg->len - i)); \
+ } \
+ }
+
+#define _FILL_QSBC_REVERSED \
+ for (unsigned int i = 0; i <= UCHAR_MAX; i++) \
+ fg->qsBc[i] = firstdot + 1; \
+ for (int i = firstdot - 1; i >= 0; i--) \
+ { \
+ fg->qsBc[(unsigned char)fg->pattern[i]] = i + 1; \
+ DPRINT(("Reverse BC shift for char %c is %d\n", fg->pattern[i], \
+ i + 1)); \
+ if (fg->icase) \
+ { \
+ char c = islower((unsigned char)fg->pattern[i]) ? \
+ toupper((unsigned char)fg->pattern[i]) : \
+ tolower((unsigned char)fg->pattern[i]); \
+ fg->qsBc[(unsigned char)c] = i + 1; \
+ DPRINT(("Reverse BC shift for char %c is %d\n", c, i + 1)); \
+ } \
+ }
+
+/*
+ * Fills in the bad character shifts into a hastable for wide strings.
+ * With wide characters it is not possible any more to use a normal
+ * array because there are too many characters and we could not
+ * provide enough memory. Fortunately, we only have to store distinct
+ * values for so many characters as the number of distinct characters
+ * in the pattern, so we can store them in a hashtable and store a
+ * default shift value for the rest.
+ */
+#define FILL_QSBC_WIDE \
+ if (fg->reversed) \
+ { \
+ _FILL_QSBC_WIDE_REVERSED \
+ } \
+ else \
+ { \
+ _FILL_QSBC_WIDE \
+ }
+
+#define _FILL_QSBC_WIDE \
+ /* Adjust the shift based on location of the last dot ('.'). */ \
+ fg->defBc = fg->wlen - whasdot; \
+ \
+ /* Preprocess pattern. */ \
+ fg->qsBc_table = hashtable_init(fg->wlen * (fg->icase ? 8 : 4), \
+ sizeof(tre_char_t), sizeof(int)); \
+ if (!fg->qsBc_table) \
+ FAIL_COMP(REG_ESPACE); \
+ for (unsigned int i = whasdot + 1; i < fg->wlen; i++) \
+ { \
+ int k = fg->wlen - i; \
+ int r; \
+ \
+ r = hashtable_put(fg->qsBc_table, &fg->wpattern[i], &k); \
+ if ((r == HASH_FAIL) || (r == HASH_FULL)) \
+ FAIL_COMP(REG_ESPACE); \
+ DPRINT(("BC shift for wide char " CHF " is %d\n", fg->wpattern[i],\
+ k)); \
+ if (fg->icase) \
+ { \
+ tre_char_t wc = iswlower(fg->wpattern[i]) ? \
+ towupper(fg->wpattern[i]) : towlower(fg->wpattern[i]); \
+ r = hashtable_put(fg->qsBc_table, &wc, &k); \
+ if ((r == HASH_FAIL) || (r == HASH_FULL)) \
+ FAIL_COMP(REG_ESPACE); \
+ DPRINT(("BC shift for wide char " CHF " is %d\n", wc, k)); \
+ } \
+ }
+
+#define _FILL_QSBC_WIDE_REVERSED \
+ /* Adjust the shift based on location of the last dot ('.'). */ \
+ fg->defBc = (size_t)wfirstdot; \
+ \
+ /* Preprocess pattern. */ \
+ fg->qsBc_table = hashtable_init(fg->wlen * (fg->icase ? 8 : 4), \
+ sizeof(tre_char_t), sizeof(int)); \
+ if (!fg->qsBc_table) \
+ FAIL_COMP(REG_ESPACE); \
+ for (int i = wfirstdot - 1; i >= 0; i--) \
+ { \
+ int k = i + 1; \
+ int r; \
+ \
+ r = hashtable_put(fg->qsBc_table, &fg->wpattern[i], &k); \
+ if ((r == HASH_FAIL) || (r == HASH_FULL)) \
+ FAIL_COMP(REG_ESPACE); \
+ DPRINT(("Reverse BC shift for wide char " CHF " is %d\n", \
+ fg->wpattern[i], k)); \
+ if (fg->icase) \
+ { \
+ tre_char_t wc = iswlower(fg->wpattern[i]) ? \
+ towupper(fg->wpattern[i]) : towlower(fg->wpattern[i]); \
+ r = hashtable_put(fg->qsBc_table, &wc, &k); \
+ if ((r == HASH_FAIL) || (r == HASH_FULL)) \
+ FAIL_COMP(REG_ESPACE); \
+ DPRINT(("Reverse BC shift for wide char " CHF " is %d\n", wc, \
+ k)); \
+ } \
+ }
+
+#ifdef _GREP_DEBUG
+#define DPRINT_BMGS(len, fmt_str, sh) \
+ for (unsigned int i = 0; i < len; i++) \
+ DPRINT((fmt_str, i, sh[i]));
+#else
+#define DPRINT_BMGS(len, fmt_str, sh) \
+ do { } while(/*CONSTCOND*/0)
+#endif
+
+/*
+ * Fills in the good suffix table for SB/MB strings.
+ */
+#define FILL_BMGS \
+ if (!fg->hasdot) \
+ { \
+ fg->sbmGs = xmalloc(fg->len * sizeof(int)); \
+ if (!fg->sbmGs) \
+ return REG_ESPACE; \
+ if (fg->len == 1) \
+ fg->sbmGs[0] = 1; \
+ else \
+ _FILL_BMGS(fg->sbmGs, fg->pattern, fg->len, false); \
+ DPRINT_BMGS(fg->len, "GS shift for pos %d is %d\n", fg->sbmGs); \
+ }
+
+/*
+ * Fills in the good suffix table for wide strings.
+ */
+#define FILL_BMGS_WIDE \
+ if (!fg->hasdot) \
+ { \
+ fg->bmGs = xmalloc(fg->wlen * sizeof(int)); \
+ if (!fg->bmGs) \
+ return REG_ESPACE; \
+ if (fg->wlen == 1) \
+ fg->bmGs[0] = 1; \
+ else \
+ _FILL_BMGS(fg->bmGs, fg->wpattern, fg->wlen, true); \
+ DPRINT_BMGS(fg->wlen, "GS shift (wide) for pos %d is %d\n", \
+ fg->bmGs); \
+ }
+
+#define _FILL_BMGS(arr, pat, plen, wide) \
+ { \
+ char *p; \
+ tre_char_t *wp; \
+ \
+ if (wide) \
+ { \
+ if (fg->icase) \
+ { \
+ wp = xmalloc(plen * sizeof(tre_char_t)); \
+ if (wp == NULL) \
+ return REG_ESPACE; \
+ for (unsigned int i = 0; i < plen; i++) \
+ wp[i] = towlower(pat[i]); \
+ _CALC_BMGS(arr, wp, plen); \
+ xfree(wp); \
+ } \
+ else \
+ _CALC_BMGS(arr, pat, plen); \
+ } \
+ else \
+ { \
+ if (fg->icase) \
+ { \
+ p = xmalloc(plen); \
+ if (p == NULL) \
+ return REG_ESPACE; \
+ for (unsigned int i = 0; i < plen; i++) \
+ p[i] = tolower((unsigned char)pat[i]); \
+ _CALC_BMGS(arr, p, plen); \
+ xfree(p); \
+ } \
+ else \
+ _CALC_BMGS(arr, pat, plen); \
+ } \
+ }
+
+#define _CALC_BMGS(arr, pat, plen) \
+ { \
+ int f = 0, g; \
+ \
+ int *suff = xmalloc(plen * sizeof(int)); \
+ if (suff == NULL) \
+ return REG_ESPACE; \
+ \
+ suff[plen - 1] = plen; \
+ g = plen - 1; \
+ for (int i = plen - 2; i >= 0; i--) \
+ { \
+ if (i > g && suff[i + plen - 1 - f] < i - g) \
+ suff[i] = suff[i + plen - 1 - f]; \
+ else \
+ { \
+ if (i < g) \
+ g = i; \
+ f = i; \
+ while (g >= 0 && pat[g] == pat[g + plen - 1 - f]) \
+ g--; \
+ suff[i] = f - g; \
+ } \
+ } \
+ \
+ for (unsigned int i = 0; i < plen; i++) \
+ arr[i] = plen; \
+ g = 0; \
+ for (int i = plen - 1; i >= 0; i--) \
+ if (suff[i] == i + 1) \
+ for(; (unsigned long)g < plen - 1 - i; g++) \
+ if (arr[g] == plen) \
+ arr[g] = plen - 1 - i; \
+ for (unsigned int i = 0; i <= plen - 2; i++) \
+ arr[plen - 1 - suff[i]] = plen - 1 - i; \
+ \
+ xfree(suff); \
+ }
+
+/*
+ * Copies the pattern pat having length n to p and stores
+ * the size in l.
+ */
+#define SAVE_PATTERN(src, srclen, dst, dstlen) \
+ dstlen = srclen; \
+ dst = xmalloc((dstlen + 1) * sizeof(tre_char_t)); \
+ if (dst == NULL) \
+ return REG_ESPACE; \
+ if (dstlen > 0) \
+ memcpy(dst, src, dstlen * sizeof(tre_char_t)); \
+ dst[dstlen] = TRE_CHAR('\0');
+
+/*
+ * Initializes pattern compiling.
+ */
+#define INIT_COMP \
+ /* Initialize. */ \
+ memset(fg, 0, sizeof(*fg)); \
+ fg->icase = (cflags & REG_ICASE); \
+ fg->word = (cflags & REG_WORD); \
+ fg->newline = (cflags & REG_NEWLINE); \
+ fg->nosub = (cflags & REG_NOSUB); \
+ \
+ /* Cannot handle REG_ICASE with MB string */ \
+ if (fg->icase && (TRE_MB_CUR_MAX > 1) && n > 0) \
+ { \
+ DPRINT(("Cannot use fast matcher for MBS with REG_ICASE\n")); \
+ return REG_BADPAT; \
+ }
+
+/*
+ * Checks whether we have a 0-length pattern that will match
+ * anything. If literal is set to false, the EOL anchor is also
+ * taken into account.
+ */
+#define CHECK_MATCHALL(literal) \
+ if (!literal && n == 1 && pat[0] == TRE_CHAR('$')) \
+ { \
+ n--; \
+ fg->eol = true; \
+ } \
+ \
+ if (n == 0) \
+ { \
+ fg->matchall = true; \
+ fg->pattern = xmalloc(sizeof(char)); \
+ if (!fg->pattern) \
+ FAIL_COMP(REG_ESPACE); \
+ fg->pattern[0] = '\0'; \
+ fg->wpattern = xmalloc(sizeof(tre_char_t)); \
+ if (!fg->wpattern) \
+ FAIL_COMP(REG_ESPACE); \
+ fg->wpattern[0] = TRE_CHAR('\0'); \
+ DPRINT(("Matching every input\n")); \
+ return REG_OK; \
+ }
+
+/*
+ * Returns: REG_OK on success, error code otherwise
+ */
+int
+tre_compile_literal(fastmatch_t *fg, const tre_char_t *pat, size_t n,
+ int cflags)
+{
+ size_t hasdot = 0, whasdot = 0;
+ ssize_t firstdot = -1, wfirstdot = -1;
+
+ INIT_COMP;
+
+ CHECK_MATCHALL(true);
+
+ /* Cannot handle word boundaries with MB string */
+ if (fg->word && (TRE_MB_CUR_MAX > 1))
+ return REG_BADPAT;
+
+#ifdef TRE_WCHAR
+ SAVE_PATTERN(pat, n, fg->wpattern, fg->wlen);
+ STORE_MBS_PAT;
+#else
+ SAVE_PATTERN(pat, n, fg->pattern, fg->len);
+#endif
+
+ DPRINT(("tre_compile_literal: pattern: %s, len %zu, icase: %c, word: %c, "
+ "newline %c\n", fg->pattern, fg->len, fg->icase ? 'y' : 'n',
+ fg->word ? 'y' : 'n', fg->newline ? 'y' : 'n'));
+
+ FILL_QSBC;
+ FILL_BMGS;
+#ifdef TRE_WCHAR
+ FILL_QSBC_WIDE;
+ FILL_BMGS_WIDE;
+#endif
+
+ return REG_OK;
+}
+
+/*
+ * Returns: REG_OK on success, error code otherwise
+ */
+int
+tre_compile_fast(fastmatch_t *fg, const tre_char_t *pat, size_t n,
+ int cflags)
+{
+ tre_char_t *tmp;
+ size_t pos = 0, hasdot = 0, whasdot = 0;
+ ssize_t firstdot = -1, wfirstdot = -1;
+ bool escaped = false;
+ bool *_escmap = NULL;
+
+ INIT_COMP;
+
+ /* Remove beginning-of-line character ('^'). */
+ if (pat[0] == TRE_CHAR('^'))
+ {
+ fg->bol = true;
+ n--;
+ pat++;
+ }
+
+ CHECK_MATCHALL(false);
+
+ /* Handle word-boundary matching when GNU extensions are enabled */
+ if ((cflags & REG_GNU) && (n >= 14) &&
+ (memcmp(pat, TRE_CHAR("[[:<:]]"), 7 * sizeof(tre_char_t)) == 0) &&
+ (memcmp(pat + n - 7, TRE_CHAR("[[:>:]]"),
+ 7 * sizeof(tre_char_t)) == 0))
+ {
+ n -= 14;
+ pat += 7;
+ fg->word = true;
+ }
+
+ /* Cannot handle word boundaries with MB string */
+ if (fg->word && (TRE_MB_CUR_MAX > 1))
+ return REG_BADPAT;
+
+ tmp = xmalloc((n + 1) * sizeof(tre_char_t));
+ if (tmp == NULL)
+ return REG_ESPACE;
+
+/* Copies the char into the stored pattern and skips to the next char. */
+#define STORE_CHAR \
+ do \
+ { \
+ tmp[pos++] = pat[i]; \
+ escaped = false; \
+ continue; \
+ } while (0)
+
+ /* Traverse the input pattern for processing */
+ for (unsigned int i = 0; i < n; i++)
+ {
+ switch (pat[i])
+ {
+ case TRE_CHAR('\\'):
+ if (escaped)
+ STORE_CHAR;
+ else if (i == n - 1)
+ goto badpat;
+ else
+ escaped = true;
+ continue;
+ case TRE_CHAR('['):
+ if (escaped)
+ STORE_CHAR;
+ else
+ goto badpat;
+ continue;
+ case TRE_CHAR('*'):
+ if (escaped || (!(cflags & REG_EXTENDED) && (i == 0)))
+ STORE_CHAR;
+ else
+ goto badpat;
+ continue;
+ case TRE_CHAR('+'):
+ case TRE_CHAR('?'):
+ if ((cflags & REG_EXTENDED) && (i == 0))
+ continue;
+ else if ((cflags & REG_EXTENDED) ^ !escaped)
+ STORE_CHAR;
+ else
+ goto badpat;
+ continue;
+ case TRE_CHAR('.'):
+ if (escaped)
+ {
+ if (!_escmap)
+ _escmap = xmalloc(n * sizeof(bool));
+ if (!_escmap)
+ {
+ xfree(tmp);
+ return REG_ESPACE;
+ }
+ _escmap[i] = true;
+ STORE_CHAR;
+ }
+ else
+ {
+ whasdot = i;
+ if (wfirstdot == -1)
+ wfirstdot = i;
+ STORE_CHAR;
+ }
+ continue;
+ case TRE_CHAR('^'):
+ STORE_CHAR;
+ continue;
+ case TRE_CHAR('$'):
+ if (!escaped && (i == n - 1))
+ fg->eol = true;
+ else
+ STORE_CHAR;
+ continue;
+ case TRE_CHAR('('):
+ if ((cflags & REG_EXTENDED) ^ escaped)
+ goto badpat;
+ else
+ STORE_CHAR;
+ continue;
+ case TRE_CHAR('{'):
+ if (!(cflags & REG_EXTENDED) ^ escaped)
+ STORE_CHAR;
+ else if (!(cflags & REG_EXTENDED) && (i == 0))
+ STORE_CHAR;
+ else if ((cflags & REG_EXTENDED) && (i == 0))
+ continue;
+ else
+ goto badpat;
+ continue;
+ case TRE_CHAR('|'):
+ if ((cflags & REG_EXTENDED) ^ escaped)
+ goto badpat;
+ else
+ STORE_CHAR;
+ continue;
+ default:
+ if (escaped)
+ goto badpat;
+ else
+ STORE_CHAR;
+ continue;
+ }
+ continue;
+badpat:
+ xfree(tmp);
+ DPRINT(("tre_compile_fast: compilation of pattern failed, falling"
+ "back to NFA\n"));
+ return REG_BADPAT;
+ }
+
+ fg->hasdot = wfirstdot > -1;
+
+ /*
+ * The pattern has been processed and copied to tmp as a literal string
+ * with escapes, anchors (^$) and the word boundary match character
+ * classes stripped out.
+ */
+#ifdef TRE_WCHAR
+ SAVE_PATTERN(tmp, pos, fg->wpattern, fg->wlen);
+ fg->wescmap = _escmap;
+ STORE_MBS_PAT;
+
+ /*
+ * The position of dots and escaped dots is different in the MB string
+ * than in to the wide string so traverse the converted string, as well,
+ * to store these positions.
+ */
+ if (fg->hasdot || (fg->wescmap != NULL))
+ {
+ if (fg->wescmap != NULL)
+ {
+ fg->escmap = xmalloc(fg->len * sizeof(bool));
+ if (!fg->escmap)
+ {
+ tre_free_fast(fg);
+ return REG_ESPACE;
+ }
+ }
+
+ escaped = false;
+ for (unsigned int i = 0; i < fg->len; i++)
+ if (fg->pattern[i] == '\\')
+ escaped = !escaped;
+ else if (fg->pattern[i] == '.' && fg->escmap && escaped)
+ {
+ fg->escmap[i] = true;
+ escaped = false;
+ }
+ else if (fg->pattern[i] == '.' && !escaped)
+ {
+ hasdot = i;
+ if (firstdot == -1)
+ firstdot = i;
+ }
+ else
+ escaped = false;
+ }
+#else
+ SAVE_PATTERN(tmp, pos, fg->pattern, fg->len);
+ fg->escmap = _escmap;
+#endif
+
+ xfree(tmp);
+
+ DPRINT(("tre_compile_fast: pattern: %s, len %zu, bol %c, eol %c, "
+ "icase: %c, word: %c, newline %c\n", fg->pattern, fg->len,
+ fg->bol ? 'y' : 'n', fg->eol ? 'y' : 'n',
+ fg->icase ? 'y' : 'n', fg->word ? 'y' : 'n',
+ fg->newline ? 'y' : 'n'));
+
+ /* Check whether reverse QS algorithm is more efficient */
+ if ((wfirstdot > -1) && (fg->wlen - whasdot + 1 < (size_t)wfirstdot) &&
+ fg->nosub)
+ {
+ fg->reversed = true;
+ DPRINT(("tre_compile_fast: using reverse QS algorithm\n"));
+ }
+
+ FILL_QSBC;
+ FILL_BMGS;
+#ifdef TRE_WCHAR
+ FILL_QSBC_WIDE;
+ FILL_BMGS_WIDE;
+#endif
+
+ return REG_OK;
+}
+
+#define _SHIFT_ONE \
+ { \
+ shift = 1; \
+ j = !fg->reversed ? j + shift : j - shift; \
+ continue; \
+ }
+
+#define _BBOUND_COND \
+ ((type == STR_WIDE) ? \
+ ((j == 0) || !(tre_isalnum(str_wide[j - 1]) || \
+ (str_wide[j - 1] == TRE_CHAR('_')))) : \
+ ((j == 0) || !(tre_isalnum(str_byte[j - 1]) || \
+ (str_byte[j - 1] == '_'))))
+
+#define _EBOUND_COND \
+ ((type == STR_WIDE) ? \
+ ((j + fg->wlen == len) || !(tre_isalnum(str_wide[j + fg->wlen]) || \
+ (str_wide[j + fg->wlen] == TRE_CHAR('_')))) : \
+ ((j + fg->len == len) || !(tre_isalnum(str_byte[j + fg->len]) || \
+ (str_byte[j + fg->len] == '_'))))
+
+/*
+ * Condition to check whether the match on position j is on a
+ * word boundary.
+ */
+#define IS_ON_WORD_BOUNDARY \
+ (_BBOUND_COND && _EBOUND_COND)
+
+/*
+ * Checks word boundary and shifts one if match is not on a
+ * boundary.
+ */
+#define CHECK_WORD_BOUNDARY \
+ if (!IS_ON_WORD_BOUNDARY) \
+ _SHIFT_ONE;
+
+#define _BOL_COND \
+ ((j == 0) || ((type == STR_WIDE) ? (str_wide[j - 1] == TRE_CHAR('\n'))\
+ : (str_byte[j - 1] == '\n')))
+
+/*
+ * Checks BOL anchor and shifts one if match is not on a
+ * boundary.
+ */
+#define CHECK_BOL_ANCHOR \
+ if (!_BOL_COND) \
+ _SHIFT_ONE;
+
+#define _EOL_COND \
+ ((type == STR_WIDE) \
+ ? ((j + fg->wlen == len) || \
+ (str_wide[j + fg->wlen] == TRE_CHAR('\n'))) \
+ : ((j + fg->len == len) || (str_byte[j + fg->wlen] == '\n')))
+
+/*
+ * Checks EOL anchor and shifts one if match is not on a
+ * boundary.
+ */
+#define CHECK_EOL_ANCHOR \
+ if (!_EOL_COND) \
+ _SHIFT_ONE;
+
+/*
+ * Executes matching of the precompiled pattern on the input string.
+ * Returns REG_OK or REG_NOMATCH depending on if we find a match or not.
+ */
+int
+tre_match_fast(const fastmatch_t *fg, const void *data, size_t len,
+ tre_str_type_t type, int nmatch, regmatch_t pmatch[], int eflags)
+{
+ unsigned int shift, u = 0, v = 0;
+ ssize_t j = 0;
+ int ret = REG_NOMATCH;
+ int mismatch;
+ const char *str_byte = data;
+ const void *startptr = NULL;
+ const tre_char_t *str_wide = data;
+
+ /* Calculate length if unspecified. */
+ if (len == (size_t)-1)
+ switch (type)
+ {
+ case STR_WIDE:
+ len = tre_strlen(str_wide);
+ break;
+ default:
+ len = strlen(str_byte);
+ break;
+ }
+
+ /* Shortcut for empty pattern */
+ if (fg->matchall)
+ {
+ if (!fg->nosub && nmatch >= 1)
+ {
+ pmatch[0].rm_so = 0;
+ pmatch[0].rm_eo = len;
+ }
+ if (fg->bol && fg->eol)
+ return (len == 0) ? REG_OK : REG_NOMATCH;
+ else
+ return REG_OK;
+ }
+
+ /* No point in going farther if we do not have enough data. */
+ switch (type)
+ {
+ case STR_WIDE:
+ if (len < fg->wlen)
+ return ret;
+ shift = fg->wlen;
+ break;
+ default:
+ if (len < fg->len)
+ return ret;
+ shift = fg->len;
+ }
+
+ /*
+ * REG_NOTBOL means not anchoring ^ to the beginning of the line, so we
+ * can shift one because there can't be a match at the beginning.
+ */
+ if (fg->bol && (eflags & REG_NOTBOL))
+ j = 1;
+
+ /*
+ * Like above, we cannot have a match at the very end when anchoring to
+ * the end and REG_NOTEOL is specified.
+ */
+ if (fg->eol && (eflags & REG_NOTEOL))
+ len--;
+
+ if (fg->reversed)
+ j = len - (type == STR_WIDE ? fg->wlen : fg->len);
+
+
+ /* Only try once at the beginning or ending of the line. */
+ if ((fg->bol || fg->eol) && !fg->newline && !(eflags & REG_NOTBOL) &&
+ !(eflags & REG_NOTEOL))
+ {
+ /* Simple text comparison. */
+ if (!((fg->bol && fg->eol) &&
+ (type == STR_WIDE ? (len != fg->wlen) : (len != fg->len))))
+ {
+ /* Determine where in data to start search at. */
+ j = fg->eol ? len - (type == STR_WIDE ? fg->wlen : fg->len) : 0;
+ SKIP_CHARS(j);
+ mismatch = fastcmp(fg, startptr, type);
+ if (mismatch == REG_OK)
+ {
+ if (fg->word && !IS_ON_WORD_BOUNDARY)
+ return ret;
+ if (!fg->nosub && nmatch >= 1)
+ {
+ pmatch[0].rm_so = j;
+ pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len);
+ }
+ return REG_OK;
+ }
+ }
+ }
+ else
+ {
+ /* Quick Search / Turbo Boyer-Moore algorithm. */
+ do
+ {
+ SKIP_CHARS(j);
+ mismatch = fastcmp(fg, startptr, type);
+ if (mismatch == REG_OK)
+ {
+ if (fg->word)
+ CHECK_WORD_BOUNDARY;
+ if (fg->bol)
+ CHECK_BOL_ANCHOR;
+ if (fg->eol)
+ CHECK_EOL_ANCHOR;
+ if (!fg->nosub && nmatch >= 1)
+ {
+ pmatch[0].rm_so = j;
+ pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
+ }
+ return REG_OK;
+ }
+ else if (mismatch > 0)
+ return mismatch;
+ mismatch = -mismatch - 1;
+ SHIFT;
+ } while (!IS_OUT_OF_BOUNDS);
+ }
+ return ret;
+}
+
+/*
+ * Frees the resources that were allocated when the pattern was compiled.
+ */
+void
+tre_free_fast(fastmatch_t *fg)
+{
+
+ DPRINT(("tre_fast_free: freeing structures for pattern %s\n",
+ fg->pattern));
+
+#ifdef TRE_WCHAR
+ hashtable_free(fg->qsBc_table);
+ if (!fg->hasdot)
+ xfree(fg->bmGs);
+ if (fg->wescmap)
+ xfree(fg->wescmap);
+ xfree(fg->wpattern);
+#endif
+ if (!fg->hasdot)
+ xfree(fg->sbmGs);
+ if (fg->escmap)
+ xfree(fg->escmap);
+ xfree(fg->pattern);
+}
+
+/*
+ * Returns: -(i + 1) on failure (position that it failed with minus sign)
+ * error code on error
+ * REG_OK on success
+ */
+static inline int
+fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type)
+{
+ const char *str_byte = data;
+ const char *pat_byte = fg->pattern;
+ const tre_char_t *str_wide = data;
+ const tre_char_t *pat_wide = fg->wpattern;
+ const bool *escmap = (type == STR_WIDE) ? fg->wescmap : fg->escmap;
+ size_t len = (type == STR_WIDE) ? fg->wlen : fg->len;
+ int ret = REG_OK;
+
+ /* Compare the pattern and the input char-by-char from the last position. */
+ for (int i = len - 1; i >= 0; i--) {
+ switch (type)
+ {
+ case STR_WIDE:
+
+ /* Check dot */
+ if (fg->hasdot && pat_wide[i] == TRE_CHAR('.') &&
+ (!escmap || !escmap[i]) &&
+ (!fg->newline || (str_wide[i] != TRE_CHAR('\n'))))
+ continue;
+
+ /* Compare */
+ if (fg->icase ? (towlower(pat_wide[i]) == towlower(str_wide[i]))
+ : (pat_wide[i] == str_wide[i]))
+ continue;
+ break;
+ default:
+ /* Check dot */
+ if (fg->hasdot && pat_byte[i] == '.' &&
+ (!escmap || !escmap[i]) &&
+ (!fg->newline || (str_byte[i] != '\n')))
+ continue;
+
+ /* Compare */
+ if (fg->icase ? (tolower((unsigned char)pat_byte[i]) == tolower((unsigned char)str_byte[i]))
+ : (pat_byte[i] == str_byte[i]))
+ continue;
+ }
+ DPRINT(("fastcmp: mismatch at position %d\n", i));
+ ret = -(i + 1);
+ break;
+ }
+ return ret;
+}
diff --git a/usr.bin/grep/regex/tre-fastmatch.h b/usr.bin/grep/regex/tre-fastmatch.h
new file mode 100644
index 0000000..f72397c
--- /dev/null
+++ b/usr.bin/grep/regex/tre-fastmatch.h
@@ -0,0 +1,21 @@
+/* $FreeBSD$ */
+
+#ifndef TRE_FASTMATCH_H
+#define TRE_FASTMATCH_H 1
+
+#include <fastmatch.h>
+#include <hashtable.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+
+#include "hashtable.h"
+
+int tre_compile_literal(fastmatch_t *preg, const tre_char_t *regex,
+ size_t, int);
+int tre_compile_fast(fastmatch_t *preg, const tre_char_t *regex, size_t, int);
+int tre_match_fast(const fastmatch_t *fg, const void *data, size_t len,
+ tre_str_type_t type, int nmatch, regmatch_t pmatch[], int eflags);
+void tre_free_fast(fastmatch_t *preg);
+
+#endif /* TRE_FASTMATCH_H */
diff --git a/usr.bin/grep/regex/xmalloc.c b/usr.bin/grep/regex/xmalloc.c
new file mode 100644
index 0000000..0fc5cd2
--- /dev/null
+++ b/usr.bin/grep/regex/xmalloc.c
@@ -0,0 +1,349 @@
+/* $FreeBSD$ */
+
+/*
+ xmalloc.c - Simple malloc debugging library implementation
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+/*
+ TODO:
+ - red zones
+ - group dumps by source location
+*/
+
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#define XMALLOC_INTERNAL 1
+#include "xmalloc.h"
+
+
+/*
+ Internal stuff.
+*/
+
+typedef struct hashTableItemRec {
+ void *ptr;
+ int bytes;
+ const char *file;
+ int line;
+ const char *func;
+ struct hashTableItemRec *next;
+} hashTableItem;
+
+typedef struct {
+ hashTableItem **table;
+} hashTable;
+
+static int xmalloc_peak;
+static int xmalloc_current;
+static int xmalloc_peak_blocks;
+static int xmalloc_current_blocks;
+static int xmalloc_fail_after;
+
+#define TABLE_BITS 8
+#define TABLE_MASK ((1 << TABLE_BITS) - 1)
+#define TABLE_SIZE (1 << TABLE_BITS)
+
+static hashTable *
+hash_table_new(void)
+{
+ hashTable *tbl;
+
+ tbl = malloc(sizeof(*tbl));
+
+ if (tbl != NULL)
+ {
+ tbl->table = calloc(TABLE_SIZE, sizeof(*tbl->table));
+
+ if (tbl->table == NULL)
+ {
+ free(tbl);
+ return NULL;
+ }
+ }
+
+ return tbl;
+}
+
+static int
+hash_void_ptr(void *ptr)
+{
+ int hash;
+ int i;
+
+ /* I took this hash function just off the top of my head, I have
+ no idea whether it is bad or very bad. */
+ hash = 0;
+ for (i = 0; i < (int)sizeof(ptr)*8 / TABLE_BITS; i++)
+ {
+ hash ^= (unsigned long)ptr >> i*8;
+ hash += i * 17;
+ hash &= TABLE_MASK;
+ }
+ return hash;
+}
+
+static void
+hash_table_add(hashTable *tbl, void *ptr, int bytes,
+ const char *file, int line, const char *func)
+{
+ int i;
+ hashTableItem *item, *new;
+
+ i = hash_void_ptr(ptr);
+
+ item = tbl->table[i];
+ if (item != NULL)
+ while (item->next != NULL)
+ item = item->next;
+
+ new = malloc(sizeof(*new));
+ assert(new != NULL);
+ new->ptr = ptr;
+ new->bytes = bytes;
+ new->file = file;
+ new->line = line;
+ new->func = func;
+ new->next = NULL;
+ if (item != NULL)
+ item->next = new;
+ else
+ tbl->table[i] = new;
+
+ xmalloc_current += bytes;
+ if (xmalloc_current > xmalloc_peak)
+ xmalloc_peak = xmalloc_current;
+ xmalloc_current_blocks++;
+ if (xmalloc_current_blocks > xmalloc_peak_blocks)
+ xmalloc_peak_blocks = xmalloc_current_blocks;
+}
+
+static void
+hash_table_del(hashTable *tbl, void *ptr)
+{
+ int i;
+ hashTableItem *item, *prev;
+
+ i = hash_void_ptr(ptr);
+
+ item = tbl->table[i];
+ if (item == NULL)
+ {
+ printf("xfree: invalid ptr %p\n", ptr);
+ abort();
+ }
+ prev = NULL;
+ while (item->ptr != ptr)
+ {
+ prev = item;
+ item = item->next;
+ }
+ if (item->ptr != ptr)
+ {
+ printf("xfree: invalid ptr %p\n", ptr);
+ abort();
+ }
+
+ xmalloc_current -= item->bytes;
+ xmalloc_current_blocks--;
+
+ if (prev != NULL)
+ {
+ prev->next = item->next;
+ free(item);
+ }
+ else
+ {
+ tbl->table[i] = item->next;
+ free(item);
+ }
+}
+
+static hashTable *xmalloc_table = NULL;
+
+static void
+xmalloc_init(void)
+{
+ if (xmalloc_table == NULL)
+ {
+ xmalloc_table = hash_table_new();
+ xmalloc_peak = 0;
+ xmalloc_peak_blocks = 0;
+ xmalloc_current = 0;
+ xmalloc_current_blocks = 0;
+ xmalloc_fail_after = -1;
+ }
+ assert(xmalloc_table != NULL);
+ assert(xmalloc_table->table != NULL);
+}
+
+
+
+/*
+ Public API.
+*/
+
+void
+xmalloc_configure(int fail_after)
+{
+ xmalloc_init();
+ xmalloc_fail_after = fail_after;
+}
+
+int
+xmalloc_dump_leaks(void)
+{
+ int i;
+ int num_leaks = 0;
+ int leaked_bytes = 0;
+ hashTableItem *item;
+
+ xmalloc_init();
+
+ for (i = 0; i < TABLE_SIZE; i++)
+ {
+ item = xmalloc_table->table[i];
+ while (item != NULL)
+ {
+ printf("%s:%d: %s: %d bytes at %p not freed\n",
+ item->file, item->line, item->func, item->bytes, item->ptr);
+ num_leaks++;
+ leaked_bytes += item->bytes;
+ item = item->next;
+ }
+ }
+ if (num_leaks == 0)
+ printf("No memory leaks.\n");
+ else
+ printf("%d unfreed memory chuncks, total %d unfreed bytes.\n",
+ num_leaks, leaked_bytes);
+ printf("Peak memory consumption %d bytes (%.1f kB, %.1f MB) in %d blocks ",
+ xmalloc_peak, (double)xmalloc_peak / 1024,
+ (double)xmalloc_peak / (1024*1024), xmalloc_peak_blocks);
+ printf("(average ");
+ if (xmalloc_peak_blocks)
+ printf("%d", ((xmalloc_peak + xmalloc_peak_blocks / 2)
+ / xmalloc_peak_blocks));
+ else
+ printf("N/A");
+ printf(" bytes per block).\n");
+
+ return num_leaks;
+}
+
+void *
+xmalloc_impl(size_t size, const char *file, int line, const char *func)
+{
+ void *ptr;
+
+ xmalloc_init();
+ assert(size > 0);
+
+ if (xmalloc_fail_after == 0)
+ {
+ xmalloc_fail_after = -2;
+#if 0
+ printf("xmalloc: forced failure %s:%d: %s\n", file, line, func);
+#endif
+ return NULL;
+ }
+ else if (xmalloc_fail_after == -2)
+ {
+ printf("xmalloc: called after failure from %s:%d: %s\n",
+ file, line, func);
+ assert(0);
+ }
+ else if (xmalloc_fail_after > 0)
+ xmalloc_fail_after--;
+
+ ptr = malloc(size);
+ if (ptr != NULL)
+ hash_table_add(xmalloc_table, ptr, (int)size, file, line, func);
+ return ptr;
+}
+
+void *
+xcalloc_impl(size_t nmemb, size_t size, const char *file, int line,
+ const char *func)
+{
+ void *ptr;
+
+ xmalloc_init();
+ assert(size > 0);
+
+ if (xmalloc_fail_after == 0)
+ {
+ xmalloc_fail_after = -2;
+#if 0
+ printf("xcalloc: forced failure %s:%d: %s\n", file, line, func);
+#endif
+ return NULL;
+ }
+ else if (xmalloc_fail_after == -2)
+ {
+ printf("xcalloc: called after failure from %s:%d: %s\n",
+ file, line, func);
+ assert(0);
+ }
+ else if (xmalloc_fail_after > 0)
+ xmalloc_fail_after--;
+
+ ptr = calloc(nmemb, size);
+ if (ptr != NULL)
+ hash_table_add(xmalloc_table, ptr, (int)(nmemb * size), file, line, func);
+ return ptr;
+}
+
+void
+xfree_impl(void *ptr, const char *file, int line, const char *func)
+{
+ /*LINTED*/(void)&file;
+ /*LINTED*/(void)&line;
+ /*LINTED*/(void)&func;
+ xmalloc_init();
+
+ if (ptr != NULL)
+ hash_table_del(xmalloc_table, ptr);
+ free(ptr);
+}
+
+void *
+xrealloc_impl(void *ptr, size_t new_size, const char *file, int line,
+ const char *func)
+{
+ void *new_ptr;
+
+ xmalloc_init();
+ assert(ptr != NULL);
+ assert(new_size > 0);
+
+ if (xmalloc_fail_after == 0)
+ {
+ xmalloc_fail_after = -2;
+ return NULL;
+ }
+ else if (xmalloc_fail_after == -2)
+ {
+ printf("xrealloc: called after failure from %s:%d: %s\n",
+ file, line, func);
+ assert(0);
+ }
+ else if (xmalloc_fail_after > 0)
+ xmalloc_fail_after--;
+
+ new_ptr = realloc(ptr, new_size);
+ if (new_ptr != NULL)
+ {
+ hash_table_del(xmalloc_table, ptr);
+ hash_table_add(xmalloc_table, new_ptr, (int)new_size, file, line, func);
+ }
+ return new_ptr;
+}
+
+
+
+/* EOF */
diff --git a/usr.bin/grep/regex/xmalloc.h b/usr.bin/grep/regex/xmalloc.h
new file mode 100644
index 0000000..5cde986
--- /dev/null
+++ b/usr.bin/grep/regex/xmalloc.h
@@ -0,0 +1,79 @@
+/* $FreeBSD$ */
+
+/*
+ xmalloc.h - Simple malloc debugging library API
+
+ This software is released under a BSD-style license.
+ See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef _XMALLOC_H
+#define _XMALLOC_H 1
+
+void *xmalloc_impl(size_t size, const char *file, int line, const char *func);
+void *xcalloc_impl(size_t nmemb, size_t size, const char *file, int line,
+ const char *func);
+void xfree_impl(void *ptr, const char *file, int line, const char *func);
+void *xrealloc_impl(void *ptr, size_t new_size, const char *file, int line,
+ const char *func);
+int xmalloc_dump_leaks(void);
+void xmalloc_configure(int fail_after);
+
+
+#ifndef XMALLOC_INTERNAL
+#ifdef MALLOC_DEBUGGING
+
+/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
+ which contains the name of the function currently being defined.
+# define __XMALLOC_FUNCTION __PRETTY_FUNCTION__
+ This is broken in G++ before version 2.6.
+ C9x has a similar variable called __func__, but prefer the GCC one since
+ it demangles C++ function names. */
+# ifdef __GNUC__
+# if __GNUC__ > 2 || (__GNUC__ == 2 \
+ && __GNUC_MINOR__ >= (defined __cplusplus ? 6 : 4))
+# define __XMALLOC_FUNCTION __PRETTY_FUNCTION__
+# else
+# define __XMALLOC_FUNCTION ((const char *) 0)
+# endif
+# else
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __XMALLOC_FUNCTION __func__
+# else
+# define __XMALLOC_FUNCTION ((const char *) 0)
+# endif
+# endif
+
+#define xmalloc(size) xmalloc_impl(size, __FILE__, __LINE__, \
+ __XMALLOC_FUNCTION)
+#define xcalloc(nmemb, size) xcalloc_impl(nmemb, size, __FILE__, __LINE__, \
+ __XMALLOC_FUNCTION)
+#define xfree(ptr) xfree_impl(ptr, __FILE__, __LINE__, __XMALLOC_FUNCTION)
+#define xrealloc(ptr, new_size) xrealloc_impl(ptr, new_size, __FILE__, \
+ __LINE__, __XMALLOC_FUNCTION)
+#undef malloc
+#undef calloc
+#undef free
+#undef realloc
+
+#define malloc USE_XMALLOC_INSTEAD_OF_MALLOC
+#define calloc USE_XCALLOC_INSTEAD_OF_CALLOC
+#define free USE_XFREE_INSTEAD_OF_FREE
+#define realloc USE_XREALLOC_INSTEAD_OF_REALLOC
+
+#else /* !MALLOC_DEBUGGING */
+
+#include <stdlib.h>
+
+#define xmalloc(size) malloc(size)
+#define xcalloc(nmemb, size) calloc(nmemb, size)
+#define xfree(ptr) free(ptr)
+#define xrealloc(ptr, new_size) realloc(ptr, new_size)
+
+#endif /* !MALLOC_DEBUGGING */
+#endif /* !XMALLOC_INTERNAL */
+
+#endif /* _XMALLOC_H */
+
+/* EOF */
diff --git a/usr.bin/grep/tests/Makefile b/usr.bin/grep/tests/Makefile
new file mode 100644
index 0000000..041259b
--- /dev/null
+++ b/usr.bin/grep/tests/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+NETBSD_ATF_TESTS_SH= grep_test
+
+${PACKAGE}FILES+= d_basic.out
+${PACKAGE}FILES+= d_begin_end_a.out
+${PACKAGE}FILES+= d_begin_end_b.out
+${PACKAGE}FILES+= d_binary.out
+${PACKAGE}FILES+= d_context2_a.out
+${PACKAGE}FILES+= d_context2_b.out
+${PACKAGE}FILES+= d_context2_c.out
+${PACKAGE}FILES+= d_context_a.in
+${PACKAGE}FILES+= d_context_a.out
+${PACKAGE}FILES+= d_context_b.in
+${PACKAGE}FILES+= d_context_b.out
+${PACKAGE}FILES+= d_context_c.out
+${PACKAGE}FILES+= d_context_d.out
+${PACKAGE}FILES+= d_egrep.out
+${PACKAGE}FILES+= d_file_exp.in
+${PACKAGE}FILES+= d_file_exp.out
+${PACKAGE}FILES+= d_ignore_case.out
+${PACKAGE}FILES+= d_input
+${PACKAGE}FILES+= d_invert.in
+${PACKAGE}FILES+= d_invert.out
+${PACKAGE}FILES+= d_recurse.out
+${PACKAGE}FILES+= d_recurse_symlink.err
+${PACKAGE}FILES+= d_recurse_symlink.out
+${PACKAGE}FILES+= d_whole_line.out
+${PACKAGE}FILES+= d_word_regexps.out
+${PACKAGE}FILES+= d_zgrep.out
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/grep/tests/Makefile.depend b/usr.bin/grep/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/grep/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
new file mode 100644
index 0000000..f3cf05f
--- /dev/null
+++ b/usr.bin/grep/util.c
@@ -0,0 +1,492 @@
+/* $NetBSD: util.c,v 1.9 2011/02/27 17:33:37 joerg Exp $ */
+/* $FreeBSD$ */
+/* $OpenBSD: util.c,v 1.39 2010/07/02 22:18:03 tedu Exp $ */
+
+/*-
+ * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
+ * Copyright (C) 2008-2010 Gabor Kovesdan <gabor@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/stat.h>
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fnmatch.h>
+#include <fts.h>
+#include <libgen.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "fastmatch.h"
+#include "grep.h"
+
+static int linesqueued;
+static int procline(struct str *l, int);
+
+bool
+file_matching(const char *fname)
+{
+ char *fname_base;
+ bool ret;
+
+ ret = finclude ? false : true;
+ fname_base = basename(fname);
+
+ for (unsigned int i = 0; i < fpatterns; ++i) {
+ if (fnmatch(fpattern[i].pat, fname, 0) == 0 ||
+ fnmatch(fpattern[i].pat, fname_base, 0) == 0) {
+ if (fpattern[i].mode == EXCL_PAT)
+ return (false);
+ else
+ ret = true;
+ }
+ }
+ return (ret);
+}
+
+static inline bool
+dir_matching(const char *dname)
+{
+ bool ret;
+
+ ret = dinclude ? false : true;
+
+ for (unsigned int i = 0; i < dpatterns; ++i) {
+ if (dname != NULL &&
+ fnmatch(dpattern[i].pat, dname, 0) == 0) {
+ if (dpattern[i].mode == EXCL_PAT)
+ return (false);
+ else
+ ret = true;
+ }
+ }
+ return (ret);
+}
+
+/*
+ * Processes a directory when a recursive search is performed with
+ * the -R option. Each appropriate file is passed to procfile().
+ */
+int
+grep_tree(char **argv)
+{
+ FTS *fts;
+ FTSENT *p;
+ int c, fts_flags;
+ bool ok;
+
+ c = fts_flags = 0;
+
+ switch(linkbehave) {
+ case LINK_EXPLICIT:
+ fts_flags = FTS_COMFOLLOW;
+ break;
+ case LINK_SKIP:
+ fts_flags = FTS_PHYSICAL;
+ break;
+ default:
+ fts_flags = FTS_LOGICAL;
+
+ }
+
+ fts_flags |= FTS_NOSTAT | FTS_NOCHDIR;
+
+ if (!(fts = fts_open(argv, fts_flags, NULL)))
+ err(2, "fts_open");
+ while ((p = fts_read(fts)) != NULL) {
+ switch (p->fts_info) {
+ case FTS_DNR:
+ /* FALLTHROUGH */
+ case FTS_ERR:
+ file_err = true;
+ if(!sflag)
+ warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
+ break;
+ case FTS_D:
+ /* FALLTHROUGH */
+ case FTS_DP:
+ if (dexclude || dinclude)
+ if (!dir_matching(p->fts_name) ||
+ !dir_matching(p->fts_path))
+ fts_set(fts, p, FTS_SKIP);
+ break;
+ case FTS_DC:
+ /* Print a warning for recursive directory loop */
+ warnx("warning: %s: recursive directory loop",
+ p->fts_path);
+ break;
+ default:
+ /* Check for file exclusion/inclusion */
+ ok = true;
+ if (fexclude || finclude)
+ ok &= file_matching(p->fts_path);
+
+ if (ok)
+ c += procfile(p->fts_path);
+ break;
+ }
+ }
+
+ fts_close(fts);
+ return (c);
+}
+
+/*
+ * Opens a file and processes it. Each file is processed line-by-line
+ * passing the lines to procline().
+ */
+int
+procfile(const char *fn)
+{
+ struct file *f;
+ struct stat sb;
+ struct str ln;
+ mode_t s;
+ int c, t;
+
+ mcount = mlimit;
+
+ if (strcmp(fn, "-") == 0) {
+ fn = label != NULL ? label : getstr(1);
+ f = grep_open(NULL);
+ } else {
+ if (!stat(fn, &sb)) {
+ /* Check if we need to process the file */
+ s = sb.st_mode & S_IFMT;
+ if (s == S_IFDIR && dirbehave == DIR_SKIP)
+ return (0);
+ if ((s == S_IFIFO || s == S_IFCHR || s == S_IFBLK
+ || s == S_IFSOCK) && devbehave == DEV_SKIP)
+ return (0);
+ }
+ f = grep_open(fn);
+ }
+ if (f == NULL) {
+ file_err = true;
+ if (!sflag)
+ warn("%s", fn);
+ return (0);
+ }
+
+ ln.file = grep_malloc(strlen(fn) + 1);
+ strcpy(ln.file, fn);
+ ln.line_no = 0;
+ ln.len = 0;
+ linesqueued = 0;
+ tail = 0;
+ ln.off = -1;
+
+ for (c = 0; c == 0 || !(lflag || qflag); ) {
+ ln.off += ln.len + 1;
+ if ((ln.dat = grep_fgetln(f, &ln.len)) == NULL || ln.len == 0) {
+ if (ln.line_no == 0 && matchall)
+ exit(0);
+ else
+ break;
+ }
+ if (ln.len > 0 && ln.dat[ln.len - 1] == '\n')
+ --ln.len;
+ ln.line_no++;
+
+ /* Return if we need to skip a binary file */
+ if (f->binary && binbehave == BINFILE_SKIP) {
+ grep_close(f);
+ free(ln.file);
+ free(f);
+ return (0);
+ }
+ /* Process the file line-by-line */
+ if ((t = procline(&ln, f->binary)) == 0 && Bflag > 0) {
+ enqueue(&ln);
+ linesqueued++;
+ }
+ c += t;
+ if (mflag && mcount <= 0)
+ break;
+ }
+ if (Bflag > 0)
+ clearqueue();
+ grep_close(f);
+
+ if (cflag) {
+ if (!hflag)
+ printf("%s:", ln.file);
+ printf("%u\n", c);
+ }
+ if (lflag && !qflag && c != 0)
+ printf("%s%c", fn, nullflag ? 0 : '\n');
+ if (Lflag && !qflag && c == 0)
+ printf("%s%c", fn, nullflag ? 0 : '\n');
+ if (c && !cflag && !lflag && !Lflag &&
+ binbehave == BINFILE_BIN && f->binary && !qflag)
+ printf(getstr(8), fn);
+
+ free(ln.file);
+ free(f);
+ return (c);
+}
+
+#define iswword(x) (iswalnum((x)) || (x) == L'_')
+
+/*
+ * Processes a line comparing it with the specified patterns. Each pattern
+ * is looped to be compared along with the full string, saving each and every
+ * match, which is necessary to colorize the output and to count the
+ * matches. The matching lines are passed to printline() to display the
+ * appropriate output.
+ */
+static int
+procline(struct str *l, int nottext)
+{
+ regmatch_t matches[MAX_LINE_MATCHES];
+ regmatch_t pmatch;
+ size_t st = 0;
+ unsigned int i;
+ int c = 0, m = 0, r = 0;
+
+ /* Loop to process the whole line */
+ while (st <= l->len) {
+ pmatch.rm_so = st;
+ pmatch.rm_eo = l->len;
+
+ /* Loop to compare with all the patterns */
+ for (i = 0; i < patterns; i++) {
+ if (fg_pattern[i].pattern)
+ r = fastexec(&fg_pattern[i],
+ l->dat, 1, &pmatch, eflags);
+ else
+ r = regexec(&r_pattern[i], l->dat, 1,
+ &pmatch, eflags);
+ r = (r == 0) ? 0 : REG_NOMATCH;
+ st = (cflags & REG_NOSUB)
+ ? (size_t)l->len
+ : (size_t)pmatch.rm_eo;
+ if (r == REG_NOMATCH)
+ continue;
+ /* Check for full match */
+ if (r == 0 && xflag)
+ if (pmatch.rm_so != 0 ||
+ (size_t)pmatch.rm_eo != l->len)
+ r = REG_NOMATCH;
+ /* Check for whole word match */
+ if (r == 0 && (wflag || fg_pattern[i].word)) {
+ wchar_t wbegin, wend;
+
+ wbegin = wend = L' ';
+ if (pmatch.rm_so != 0 &&
+ sscanf(&l->dat[pmatch.rm_so - 1],
+ "%lc", &wbegin) != 1)
+ r = REG_NOMATCH;
+ else if ((size_t)pmatch.rm_eo !=
+ l->len &&
+ sscanf(&l->dat[pmatch.rm_eo],
+ "%lc", &wend) != 1)
+ r = REG_NOMATCH;
+ else if (iswword(wbegin) ||
+ iswword(wend))
+ r = REG_NOMATCH;
+ }
+ if (r == 0) {
+ if (m == 0)
+ c++;
+ if (m < MAX_LINE_MATCHES)
+ matches[m++] = pmatch;
+ /* matches - skip further patterns */
+ if ((color == NULL && !oflag) ||
+ qflag || lflag)
+ break;
+ }
+ }
+
+ if (vflag) {
+ c = !c;
+ break;
+ }
+
+ /* One pass if we are not recording matches */
+ if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag))
+ break;
+
+ if (st == (size_t)pmatch.rm_so)
+ break; /* No matches */
+ }
+
+
+ /* Count the matches if we have a match limit */
+ if (mflag)
+ mcount -= c;
+
+ if (c && binbehave == BINFILE_BIN && nottext)
+ return (c); /* Binary file */
+
+ /* Dealing with the context */
+ if ((tail || c) && !cflag && !qflag && !lflag && !Lflag) {
+ if (c) {
+ if (!first && !prev && !tail && Aflag)
+ printf("--\n");
+ tail = Aflag;
+ if (Bflag > 0) {
+ if (!first && !prev)
+ printf("--\n");
+ printqueue();
+ }
+ linesqueued = 0;
+ printline(l, ':', matches, m);
+ } else {
+ printline(l, '-', matches, m);
+ tail--;
+ }
+ }
+
+ if (c) {
+ prev = true;
+ first = false;
+ } else
+ prev = false;
+
+ return (c);
+}
+
+/*
+ * Safe malloc() for internal use.
+ */
+void *
+grep_malloc(size_t size)
+{
+ void *ptr;
+
+ if ((ptr = malloc(size)) == NULL)
+ err(2, "malloc");
+ return (ptr);
+}
+
+/*
+ * Safe calloc() for internal use.
+ */
+void *
+grep_calloc(size_t nmemb, size_t size)
+{
+ void *ptr;
+
+ if ((ptr = calloc(nmemb, size)) == NULL)
+ err(2, "calloc");
+ return (ptr);
+}
+
+/*
+ * Safe realloc() for internal use.
+ */
+void *
+grep_realloc(void *ptr, size_t size)
+{
+
+ if ((ptr = realloc(ptr, size)) == NULL)
+ err(2, "realloc");
+ return (ptr);
+}
+
+/*
+ * Safe strdup() for internal use.
+ */
+char *
+grep_strdup(const char *str)
+{
+ char *ret;
+
+ if ((ret = strdup(str)) == NULL)
+ err(2, "strdup");
+ return (ret);
+}
+
+/*
+ * Prints a matching line according to the command line options.
+ */
+void
+printline(struct str *line, int sep, regmatch_t *matches, int m)
+{
+ size_t a = 0;
+ int i, n = 0;
+
+ if (!hflag) {
+ if (!nullflag) {
+ fputs(line->file, stdout);
+ ++n;
+ } else {
+ printf("%s", line->file);
+ putchar(0);
+ }
+ }
+ if (nflag) {
+ if (n > 0)
+ putchar(sep);
+ printf("%d", line->line_no);
+ ++n;
+ }
+ if (bflag) {
+ if (n > 0)
+ putchar(sep);
+ printf("%lld", (long long)line->off);
+ ++n;
+ }
+ if (n)
+ putchar(sep);
+ /* --color and -o */
+ if ((oflag || color) && m > 0) {
+ for (i = 0; i < m; i++) {
+ if (!oflag)
+ fwrite(line->dat + a, matches[i].rm_so - a, 1,
+ stdout);
+ if (color)
+ fprintf(stdout, "\33[%sm\33[K", color);
+
+ fwrite(line->dat + matches[i].rm_so,
+ matches[i].rm_eo - matches[i].rm_so, 1,
+ stdout);
+ if (color)
+ fprintf(stdout, "\33[m\33[K");
+ a = matches[i].rm_eo;
+ if (oflag)
+ putchar('\n');
+ }
+ if (!oflag) {
+ if (line->len - a > 0)
+ fwrite(line->dat + a, line->len - a, 1, stdout);
+ putchar('\n');
+ }
+ } else {
+ fwrite(line->dat, line->len, 1, stdout);
+ putchar('\n');
+ }
+}
diff --git a/usr.bin/gzip/Makefile b/usr.bin/gzip/Makefile
new file mode 100644
index 0000000..1266277
--- /dev/null
+++ b/usr.bin/gzip/Makefile
@@ -0,0 +1,34 @@
+# $NetBSD: Makefile,v 1.18 2013/11/13 11:12:24 pettai Exp $
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= gzip
+MAN= gzip.1 gzexe.1 zdiff.1 zforce.1 zmore.1 znew.1
+
+LIBADD= z lzma
+
+.if ${MK_BZIP2_SUPPORT} != "no"
+LIBADD+= bz2
+.else
+CFLAGS+= -DNO_BZIP2_SUPPORT
+.endif
+
+SCRIPTS= gzexe zdiff zforce zmore znew
+
+MLINKS+= gzip.1 gunzip.1 \
+ gzip.1 gzcat.1 \
+ gzip.1 zcat.1 \
+ zdiff.1 zcmp.1 \
+ zmore.1 zless.1
+
+LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \
+ ${BINDIR}/gzip ${BINDIR}/gzcat \
+ ${BINDIR}/gzip ${BINDIR}/zcat \
+ ${BINDIR}/zdiff ${BINDIR}/zcmp
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/gzip/Makefile.depend b/usr.bin/gzip/Makefile.depend
new file mode 100644
index 0000000..f3f02a1
--- /dev/null
+++ b/usr.bin/gzip/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/gzip/gzexe b/usr.bin/gzip/gzexe
new file mode 100644
index 0000000..5f5424e
--- /dev/null
+++ b/usr.bin/gzip/gzexe
@@ -0,0 +1,179 @@
+#!/bin/sh -
+#
+# $NetBSD: gzexe,v 1.3 2004/05/01 08:22:41 wiz Exp $
+# $OpenBSD: gzexe,v 1.3 2003/08/05 18:22:17 deraadt Exp $
+#
+#-
+# Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+#
+# 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.
+#
+# $FreeBSD$
+
+# The number of lines plus one in the on-the-fly decompression script
+lines=19
+
+# A simple string to recognize already compressed files
+magic="# compressed by gzexe"
+
+# Write the decompression script to stdout
+header () {
+ # first section needs variable expansion, second not
+ cat <<- EOF
+ #!/bin/sh -
+ $magic
+ lines=$lines
+ EOF
+ cat <<- 'EOF'
+ prog=`/usr/bin/basename "$0"`
+ tmp=`/usr/bin/mktemp -d /tmp/gzexeXXXXXXXXXX` || {
+ /bin/echo "$prog: cannot create tmp dir"; exit 1
+ }
+ trap '/bin/rm -rf "$tmp"' 0
+ if /usr/bin/tail +$lines "$0" |
+ /usr/bin/gzip -dc > "$tmp/$prog" 2> /dev/null; then
+ /bin/chmod u+x "$tmp/$prog"
+ "$tmp/$prog" ${1+"$@"}
+ ret=$?
+ else
+ /bin/echo "$prog: cannot decompress $0"
+ ret=1
+ fi
+ exit $ret
+ EOF
+}
+
+# Test if a file is compressed by checking the magic line
+compressed () {
+ test "X`sed -n 2p "$1" 2> /dev/null`" = "X$magic"
+}
+
+# Decompress a file
+decompress () {
+ tmp=`mktemp /tmp/gzexeXXXXXXXXXX` || {
+ echo "$prog: cannot create tmp file"
+ return 1
+ }
+ if ! cp "$1" "$tmp"; then
+ echo "$prog: cannot copy $1 to $tmp"
+ rm -f "$tmp"
+ return 1
+ fi
+ if ! tail +$lines "$tmp" | gzip -vdc > "$1"; then
+ echo "$prog: cannot decompress $1"
+ cp "$tmp" "$1"
+ rm -f "$tmp"
+ return 1
+ fi
+}
+
+# Perform some sanity checks on the file
+check () {
+ if test ! -e "$1"; then
+ echo "$prog: cannot compress non-existing file $1"
+ return 1
+ fi
+
+ if test ! -f "$1"; then
+ echo "$prog: cannot compress non-regular file $1"
+ return 1
+ fi
+
+ case `basename "$1"` in
+ sh | mktemp | rm | echo | tail | gzip | chmod)
+ echo "$prog: cannot compress $1, I depend on it"
+ return 1
+ esac
+
+ if test ! -x "$1"; then
+ echo "$prog: cannot compress $1, it is not executable"
+ return 1
+ fi
+
+ if test -u "$1" -o -g "$1"; then
+ echo "$prog: cannot compress $1, it has an s bit set"
+ return 1
+ fi
+}
+
+# Compress a file
+compress () {
+ tmp=`mktemp /tmp/gzexeXXXXXXXXXX` || {
+ echo "$prog: cannot create tmp file"
+ return 1
+ }
+ if ! cp "$1" "$tmp"; then
+ echo "$prog: cannot copy $1 to $tmp"
+ rm -f "$tmp"
+ return 1
+ fi
+ if ! cp "$1" "$1"~; then
+ echo "$prog: cannot create backup copy $1~"
+ rm -f "$1"~ "$tmp"
+ return 1
+ fi
+
+ # Use cp to overwrite the existing file preserving mode and owner
+ # if possible. If the file is not writable, this will produce an
+ # error.
+
+ if header "$1" > "$tmp" && gzip -vc "$1" >> "$tmp"; then
+ if ! cp "$tmp" "$1"; then
+ echo "$prog: cannot copy $tmp to $1"
+ rm -f "$tmp"
+ return 1
+ fi
+ else
+ echo "$prog: cannot compress $1"
+ rm -f "$1"~ "$tmp"
+ return 1
+ fi
+}
+
+# Is the -d flag specified?
+dflag=
+
+# Return value
+rc=0
+
+if test "X$1" = X-d; then
+ dflag=1
+ shift
+fi
+
+prog=`basename "$0"`
+USAGE="usage: $prog [-d] file ..."
+if test $# -eq 0; then
+ echo $USAGE
+ exit 1
+fi
+
+while test $# -ne 0; do
+ if test $dflag; then
+ if ! compressed "$1"; then
+ echo "$prog: $1 is not compressed"
+ rc=1;
+ elif ! decompress "$1"; then
+ rc=$?
+ fi
+ else
+ if compressed "$1"; then
+ echo "$prog: $1 is already compressed"
+ rc=1;
+ elif ! check "$1" || ! compress "$1"; then
+ rc=$?
+ fi
+ fi
+ shift
+done
+exit $rc
diff --git a/usr.bin/gzip/gzexe.1 b/usr.bin/gzip/gzexe.1
new file mode 100644
index 0000000..0195037
--- /dev/null
+++ b/usr.bin/gzip/gzexe.1
@@ -0,0 +1,73 @@
+.\" $NetBSD: gzexe.1,v 1.3 2003/12/28 12:49:41 wiz Exp $
+.\" $OpenBSD: gzexe.1,v 1.1 2003/07/31 07:32:47 otto Exp $
+.\"
+.\" Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.Dd January 26, 2007
+.Dt GZEXE 1
+.Os
+.Sh NAME
+.Nm gzexe
+.Nd create auto-decompressing executables
+.Sh SYNOPSIS
+.Nm gzexe
+.Op Fl d
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility uses
+.Xr gzip 1
+to compress executables, producing executables that decompress on-the-fly
+when executed.
+This saves disk space, at the cost of slower execution times.
+The original executables are saved by copying each of them to a file with
+the same name with a
+.Sq ~
+suffix appended.
+After verifying that the compressed executables work as expected, the backup
+files can be removed.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl d
+Decompress executables previously compressed by
+.Nm .
+.El
+.Pp
+The
+.Nm
+program refuses to compress non-regular or non-executable files,
+files with a setuid or setgid bit set, files that are already
+compressed using
+.Nm
+or programs it needs to perform on-the-fly decompression:
+.Xr sh 1 ,
+.Xr mktemp 1 ,
+.Xr rm 1 ,
+.Xr echo 1 ,
+.Xr tail 1 ,
+.Xr gzip 1 ,
+and
+.Xr chmod 1 .
+.Sh SEE ALSO
+.Xr gzip 1
+.Sh CAVEATS
+The
+.Nm
+utility replaces files by overwriting them with the generated
+compressed executable.
+To be able to do this, it is required that the original files are writable.
diff --git a/usr.bin/gzip/gzip.1 b/usr.bin/gzip/gzip.1
new file mode 100644
index 0000000..0b5a38f
--- /dev/null
+++ b/usr.bin/gzip/gzip.1
@@ -0,0 +1,234 @@
+.\" $NetBSD: gzip.1,v 1.26 2015/10/27 07:36:18 mrg Exp $
+.\"
+.\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
+.\" 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 ``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.
+.\"
+.\" $FreeBSD$
+.Dd October 26, 2015
+.Dt GZIP 1
+.Os
+.Sh NAME
+.Nm gzip
+.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
+.Sh SYNOPSIS
+.Nm
+.Op Fl cdfhkLlNnqrtVv
+.Op Fl S Ar suffix
+.Ar file
+.Oo
+.Ar file Oo ...
+.Oc
+.Oc
+.Nm gunzip
+.Op Fl cfhkLNqrtVv
+.Op Fl S Ar suffix
+.Ar file
+.Oo
+.Ar file Oo ...
+.Oc
+.Oc
+.Nm zcat
+.Op Fl fhV
+.Ar file
+.Oo
+.Ar file Oo ...
+.Oc
+.Oc
+.Sh DESCRIPTION
+The
+.Nm
+program compresses and decompresses files using Lempel-Ziv coding
+(LZ77).
+If no
+.Ar files
+are specified,
+.Nm
+will compress from standard input, or decompress to standard output.
+When in compression mode, each
+.Ar file
+will be replaced with another file with the suffix, set by the
+.Fl S Ar suffix
+option, added, if possible.
+.Pp
+In decompression mode, each
+.Ar file
+will be checked for existence, as will the file with the suffix
+added.
+Each
+.Ar file
+argument must contain a separate complete archive;
+when multiple
+.Ar files
+are indicated, each is decompressed in turn.
+.Pp
+In the case of
+.Nm gzcat
+the resulting data is then concatenated in the manner of
+.Xr cat 1 .
+.Pp
+If invoked as
+.Nm gunzip
+then the
+.Fl d
+option is enabled.
+If invoked as
+.Nm zcat
+or
+.Nm gzcat
+then both the
+.Fl c
+and
+.Fl d
+options are enabled.
+.Pp
+This version of
+.Nm
+is also capable of decompressing files compressed using
+.Xr compress 1 ,
+.Xr bzip2 1 ,
+or
+.Xr xz 1 .
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width XXrXXXrecursiveX
+.It Fl 1 , -fast
+.It Fl 2 , 3 , 4 , 5 , 6 , 7 , 8
+.It Fl 9 , -best
+These options change the compression level used, with the
+.Fl 1
+option being the fastest, with less compression, and the
+.Fl 9
+option being the slowest, with optimal compression.
+The default compression level is 6.
+.It Fl c , -stdout , -to-stdout
+This option specifies that output will go to the standard output
+stream, leaving files intact.
+.It Fl d , -decompress , -uncompress
+This option selects decompression rather than compression.
+.It Fl f , -force
+This option turns on force mode.
+This allows files with multiple links, symbolic links to regular files,
+overwriting of pre-existing files, reading from or writing to a terminal,
+and when combined with the
+.Fl c
+option, allowing non-compressed data to pass through unchanged.
+.It Fl h , -help
+This option prints a usage summary and exits.
+.It Fl k , -keep
+Keep (do not delete) input files during compression
+or decompression.
+.It Fl L , -license
+This option prints
+.Nm
+license.
+.It Fl l , -list
+This option displays information about the file's compressed and
+uncompressed size, ratio, uncompressed name.
+With the
+.Fl v
+option, it also displays the compression method, CRC, date and time
+embedded in the file.
+.It Fl N , -name
+This option causes the stored filename in the input file to be used
+as the output file.
+.It Fl n , -no-name
+This option stops the filename and timestamp from being stored in
+the output file.
+.It Fl q , -quiet
+With this option, no warnings or errors are printed.
+.It Fl r , -recursive
+This option is used to
+.Nm
+the files in a directory tree individually, using the
+.Xr fts 3
+library.
+.It Fl S Ar suffix , Fl -suffix Ar suffix
+This option changes the default suffix from .gz to
+.Ar suffix .
+.It Fl t , -test
+This option will test compressed files for integrity.
+.It Fl V , -version
+This option prints the version of the
+.Nm
+program.
+.It Fl v , -verbose
+This option turns on verbose mode, which prints the compression
+ratio for each file compressed.
+.El
+.Sh ENVIRONMENT
+If the environment variable
+.Ev GZIP
+is set, it is parsed as a white-space separated list of options
+handled before any options on the command line.
+Options on the command line will override anything in
+.Ev GZIP .
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 on success,
+1 on errors,
+and 2 if a warning occurs.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr compress 1 ,
+.Xr xz 1 ,
+.Xr fts 3 ,
+.Xr zlib 3
+.Sh HISTORY
+The
+.Nm
+program was originally written by Jean-loup Gailly, licensed under
+the GNU Public Licence.
+Matthew R. Green wrote a simple front end for
+.Nx 1.3
+distribution media, based on the freely re-distributable zlib library.
+It was enhanced to be mostly feature-compatible with the original
+GNU
+.Nm
+program for
+.Nx 2.0 .
+.Pp
+This implementation of
+.Nm
+was ported based on the
+.Nx
+.Nm ,
+and first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+This implementation of
+.Nm
+was written by
+.An Matthew R. Green Aq Mt mrg@eterna.com.au
+with unpack support written by
+.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 cannot represent files larger than 4GB.
+This limitation also applies to
+.Fl l
+option of
+.Nm
+utility.
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
new file mode 100644
index 0000000..8f22abc
--- /dev/null
+++ b/usr.bin/gzip/gzip.c
@@ -0,0 +1,2174 @@
+/* $NetBSD: gzip.c,v 1.109 2015/10/27 07:36:18 mrg Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
+ * 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 ``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.
+ *
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006\
+ Matthew R. Green. All rights reserved.");
+__FBSDID("$FreeBSD$");
+#endif /* not lint */
+
+/*
+ * gzip.c -- GPL free gzip using zlib.
+ *
+ * RFC 1950 covers the zlib format
+ * RFC 1951 covers the deflate format
+ * RFC 1952 covers the gzip format
+ *
+ * TODO:
+ * - use mmap where possible
+ * - make bzip2/compress -v/-t/-l support work as well as possible
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <inttypes.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <zlib.h>
+#include <fts.h>
+#include <libgen.h>
+#include <stdarg.h>
+#include <getopt.h>
+#include <time.h>
+
+/* what type of file are we dealing with */
+enum filetype {
+ FT_GZIP,
+#ifndef NO_BZIP2_SUPPORT
+ FT_BZIP2,
+#endif
+#ifndef NO_COMPRESS_SUPPORT
+ FT_Z,
+#endif
+#ifndef NO_PACK_SUPPORT
+ FT_PACK,
+#endif
+#ifndef NO_XZ_SUPPORT
+ FT_XZ,
+#endif
+ FT_LAST,
+ FT_UNKNOWN
+};
+
+#ifndef NO_BZIP2_SUPPORT
+#include <bzlib.h>
+
+#define BZ2_SUFFIX ".bz2"
+#define BZIP2_MAGIC "\102\132\150"
+#endif
+
+#ifndef NO_COMPRESS_SUPPORT
+#define Z_SUFFIX ".Z"
+#define Z_MAGIC "\037\235"
+#endif
+
+#ifndef NO_PACK_SUPPORT
+#define PACK_MAGIC "\037\036"
+#endif
+
+#ifndef NO_XZ_SUPPORT
+#include <lzma.h>
+#define XZ_SUFFIX ".xz"
+#define XZ_MAGIC "\3757zXZ"
+#endif
+
+#define GZ_SUFFIX ".gz"
+
+#define BUFLEN (64 * 1024)
+
+#define GZIP_MAGIC0 0x1F
+#define GZIP_MAGIC1 0x8B
+#define GZIP_OMAGIC1 0x9E
+
+#define GZIP_TIMESTAMP (off_t)4
+#define GZIP_ORIGNAME (off_t)10
+
+#define HEAD_CRC 0x02
+#define EXTRA_FIELD 0x04
+#define ORIG_NAME 0x08
+#define COMMENT 0x10
+
+#define OS_CODE 3 /* Unix */
+
+typedef struct {
+ const char *zipped;
+ int ziplen;
+ const char *normal; /* for unzip - must not be longer than zipped */
+} suffixes_t;
+static suffixes_t suffixes[] = {
+#define SUFFIX(Z, N) {Z, sizeof Z - 1, N}
+ SUFFIX(GZ_SUFFIX, ""), /* Overwritten by -S .xxx */
+#ifndef SMALL
+ SUFFIX(GZ_SUFFIX, ""),
+ SUFFIX(".z", ""),
+ SUFFIX("-gz", ""),
+ SUFFIX("-z", ""),
+ SUFFIX("_z", ""),
+ SUFFIX(".taz", ".tar"),
+ SUFFIX(".tgz", ".tar"),
+#ifndef NO_BZIP2_SUPPORT
+ SUFFIX(BZ2_SUFFIX, ""),
+ SUFFIX(".tbz", ".tar"),
+ SUFFIX(".tbz2", ".tar"),
+#endif
+#ifndef NO_COMPRESS_SUPPORT
+ SUFFIX(Z_SUFFIX, ""),
+#endif
+#ifndef NO_XZ_SUPPORT
+ SUFFIX(XZ_SUFFIX, ""),
+#endif
+ SUFFIX(GZ_SUFFIX, ""), /* Overwritten by -S "" */
+#endif /* SMALL */
+#undef SUFFIX
+};
+#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
+#define SUFFIX_MAXLEN 30
+
+static const char gzip_version[] = "FreeBSD gzip 20150413";
+
+#ifndef SMALL
+static const char gzip_copyright[] = \
+" Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green\n"
+" All rights reserved.\n"
+"\n"
+" Redistribution and use in source and binary forms, with or without\n"
+" modification, are permitted provided that the following conditions\n"
+" are met:\n"
+" 1. Redistributions of source code must retain the above copyright\n"
+" notice, this list of conditions and the following disclaimer.\n"
+" 2. Redistributions in binary form must reproduce the above copyright\n"
+" notice, this list of conditions and the following disclaimer in the\n"
+" documentation and/or other materials provided with the distribution.\n"
+"\n"
+" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n"
+" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n"
+" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n"
+" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n"
+" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n"
+" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n"
+" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n"
+" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n"
+" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n"
+" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n"
+" SUCH DAMAGE.";
+#endif
+
+static int cflag; /* stdout mode */
+static int dflag; /* decompress mode */
+static int lflag; /* list mode */
+static int numflag = 6; /* gzip -1..-9 value */
+
+#ifndef SMALL
+static int fflag; /* force mode */
+static int kflag; /* don't delete input files */
+static int nflag; /* don't save name/timestamp */
+static int Nflag; /* don't restore name/timestamp */
+static int qflag; /* quiet mode */
+static int rflag; /* recursive mode */
+static int tflag; /* test */
+static int vflag; /* verbose mode */
+static const char *remove_file = NULL; /* file to be removed upon SIGINT */
+#else
+#define qflag 0
+#define tflag 0
+#endif
+
+static int exit_value = 0; /* exit value */
+
+static char *infile; /* name of file coming in */
+
+static void maybe_err(const char *fmt, ...) __printflike(1, 2) __dead2;
+#if !defined(NO_BZIP2_SUPPORT) || !defined(NO_PACK_SUPPORT) || \
+ !defined(NO_XZ_SUPPORT)
+static void maybe_errx(const char *fmt, ...) __printflike(1, 2) __dead2;
+#endif
+static void maybe_warn(const char *fmt, ...) __printflike(1, 2);
+static void maybe_warnx(const char *fmt, ...) __printflike(1, 2);
+static enum filetype file_gettype(u_char *);
+#ifdef SMALL
+#define gz_compress(if, of, sz, fn, tm) gz_compress(if, of, sz)
+#endif
+static off_t gz_compress(int, int, off_t *, const char *, uint32_t);
+static off_t gz_uncompress(int, int, char *, size_t, off_t *, const char *);
+static off_t file_compress(char *, char *, size_t);
+static off_t file_uncompress(char *, char *, size_t);
+static void handle_pathname(char *);
+static void handle_file(char *, struct stat *);
+static void handle_stdin(void);
+static void handle_stdout(void);
+static void print_ratio(off_t, off_t, FILE *);
+static void print_list(int fd, off_t, const char *, time_t);
+static void usage(void) __dead2;
+static void display_version(void) __dead2;
+#ifndef SMALL
+static void display_license(void);
+static void sigint_handler(int);
+#endif
+static const suffixes_t *check_suffix(char *, int);
+static ssize_t read_retry(int, void *, size_t);
+
+#ifdef SMALL
+#define unlink_input(f, sb) unlink(f)
+#else
+static off_t cat_fd(unsigned char *, size_t, off_t *, int fd);
+static void prepend_gzip(char *, int *, char ***);
+static void handle_dir(char *);
+static void print_verbage(const char *, const char *, off_t, off_t);
+static void print_test(const char *, int);
+static void copymodes(int fd, const struct stat *, const char *file);
+static int check_outfile(const char *outfile);
+#endif
+
+#ifndef NO_BZIP2_SUPPORT
+static off_t unbzip2(int, int, char *, size_t, off_t *);
+#endif
+
+#ifndef NO_COMPRESS_SUPPORT
+static FILE *zdopen(int);
+static off_t zuncompress(FILE *, FILE *, char *, size_t, off_t *);
+#endif
+
+#ifndef NO_PACK_SUPPORT
+static off_t unpack(int, int, char *, size_t, off_t *);
+#endif
+
+#ifndef NO_XZ_SUPPORT
+static off_t unxz(int, int, char *, size_t, off_t *);
+#endif
+
+#ifdef SMALL
+#define getopt_long(a,b,c,d,e) getopt(a,b,c)
+#else
+static const struct option longopts[] = {
+ { "stdout", no_argument, 0, 'c' },
+ { "to-stdout", no_argument, 0, 'c' },
+ { "decompress", no_argument, 0, 'd' },
+ { "uncompress", no_argument, 0, 'd' },
+ { "force", no_argument, 0, 'f' },
+ { "help", no_argument, 0, 'h' },
+ { "keep", no_argument, 0, 'k' },
+ { "list", no_argument, 0, 'l' },
+ { "no-name", no_argument, 0, 'n' },
+ { "name", no_argument, 0, 'N' },
+ { "quiet", no_argument, 0, 'q' },
+ { "recursive", no_argument, 0, 'r' },
+ { "suffix", required_argument, 0, 'S' },
+ { "test", no_argument, 0, 't' },
+ { "verbose", no_argument, 0, 'v' },
+ { "version", no_argument, 0, 'V' },
+ { "fast", no_argument, 0, '1' },
+ { "best", no_argument, 0, '9' },
+ { "ascii", no_argument, 0, 'a' },
+ { "license", no_argument, 0, 'L' },
+ { NULL, no_argument, 0, 0 },
+};
+#endif
+
+int
+main(int argc, char **argv)
+{
+ const char *progname = getprogname();
+#ifndef SMALL
+ char *gzip;
+ int len;
+#endif
+ int ch;
+
+#ifndef SMALL
+ if ((gzip = getenv("GZIP")) != NULL)
+ prepend_gzip(gzip, &argc, &argv);
+ signal(SIGINT, sigint_handler);
+#endif
+
+ /*
+ * XXX
+ * handle being called `gunzip', `zcat' and `gzcat'
+ */
+ if (strcmp(progname, "gunzip") == 0)
+ dflag = 1;
+ else if (strcmp(progname, "zcat") == 0 ||
+ strcmp(progname, "gzcat") == 0)
+ dflag = cflag = 1;
+
+#ifdef SMALL
+#define OPT_LIST "123456789cdhlV"
+#else
+#define OPT_LIST "123456789acdfhklLNnqrS:tVv"
+#endif
+
+ while ((ch = getopt_long(argc, argv, OPT_LIST, longopts, NULL)) != -1) {
+ switch (ch) {
+ case '1': case '2': case '3':
+ case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ numflag = ch - '0';
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'l':
+ lflag = 1;
+ dflag = 1;
+ break;
+ case 'V':
+ display_version();
+ /* NOTREACHED */
+#ifndef SMALL
+ case 'a':
+ fprintf(stderr, "%s: option --ascii ignored on this system\n", progname);
+ break;
+ case 'f':
+ fflag = 1;
+ break;
+ case 'k':
+ kflag = 1;
+ break;
+ case 'L':
+ display_license();
+ /* NOT REACHED */
+ case 'N':
+ nflag = 0;
+ Nflag = 1;
+ break;
+ case 'n':
+ nflag = 1;
+ Nflag = 0;
+ break;
+ case 'q':
+ qflag = 1;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 'S':
+ len = strlen(optarg);
+ if (len != 0) {
+ if (len > SUFFIX_MAXLEN)
+ errx(1, "incorrect suffix: '%s': too long", optarg);
+ suffixes[0].zipped = optarg;
+ suffixes[0].ziplen = len;
+ } else {
+ suffixes[NUM_SUFFIXES - 1].zipped = "";
+ suffixes[NUM_SUFFIXES - 1].ziplen = 0;
+ }
+ break;
+ case 't':
+ cflag = 1;
+ tflag = 1;
+ dflag = 1;
+ break;
+ case 'v':
+ vflag = 1;
+ break;
+#endif
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (argc == 0) {
+ if (dflag) /* stdin mode */
+ handle_stdin();
+ else /* stdout mode */
+ handle_stdout();
+ } else {
+ do {
+ handle_pathname(argv[0]);
+ } while (*++argv);
+ }
+#ifndef SMALL
+ if (qflag == 0 && lflag && argc > 1)
+ print_list(-1, 0, "(totals)", 0);
+#endif
+ exit(exit_value);
+}
+
+/* maybe print a warning */
+void
+maybe_warn(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (qflag == 0) {
+ va_start(ap, fmt);
+ vwarn(fmt, ap);
+ va_end(ap);
+ }
+ if (exit_value == 0)
+ exit_value = 1;
+}
+
+/* ... without an errno. */
+void
+maybe_warnx(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (qflag == 0) {
+ va_start(ap, fmt);
+ vwarnx(fmt, ap);
+ va_end(ap);
+ }
+ if (exit_value == 0)
+ exit_value = 1;
+}
+
+/* maybe print an error */
+void
+maybe_err(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (qflag == 0) {
+ va_start(ap, fmt);
+ vwarn(fmt, ap);
+ va_end(ap);
+ }
+ exit(2);
+}
+
+#if !defined(NO_BZIP2_SUPPORT) || !defined(NO_PACK_SUPPORT) || \
+ !defined(NO_XZ_SUPPORT)
+/* ... without an errno. */
+void
+maybe_errx(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (qflag == 0) {
+ va_start(ap, fmt);
+ vwarnx(fmt, ap);
+ va_end(ap);
+ }
+ exit(2);
+}
+#endif
+
+#ifndef SMALL
+/* split up $GZIP and prepend it to the argument list */
+static void
+prepend_gzip(char *gzip, int *argc, char ***argv)
+{
+ char *s, **nargv, **ac;
+ int nenvarg = 0, i;
+
+ /* scan how many arguments there are */
+ for (s = gzip;;) {
+ while (*s == ' ' || *s == '\t')
+ s++;
+ if (*s == 0)
+ goto count_done;
+ nenvarg++;
+ while (*s != ' ' && *s != '\t')
+ if (*s++ == 0)
+ goto count_done;
+ }
+count_done:
+ /* punt early */
+ if (nenvarg == 0)
+ return;
+
+ *argc += nenvarg;
+ ac = *argv;
+
+ nargv = (char **)malloc((*argc + 1) * sizeof(char *));
+ if (nargv == NULL)
+ maybe_err("malloc");
+
+ /* stash this away */
+ *argv = nargv;
+
+ /* copy the program name first */
+ i = 0;
+ nargv[i++] = *(ac++);
+
+ /* take a copy of $GZIP and add it to the array */
+ s = strdup(gzip);
+ if (s == NULL)
+ maybe_err("strdup");
+ for (;;) {
+ /* Skip whitespaces. */
+ while (*s == ' ' || *s == '\t')
+ s++;
+ if (*s == 0)
+ goto copy_done;
+ nargv[i++] = s;
+ /* Find the end of this argument. */
+ while (*s != ' ' && *s != '\t')
+ if (*s++ == 0)
+ /* Argument followed by NUL. */
+ goto copy_done;
+ /* Terminate by overwriting ' ' or '\t' with NUL. */
+ *s++ = 0;
+ }
+copy_done:
+
+ /* copy the original arguments and a NULL */
+ while (*ac)
+ nargv[i++] = *(ac++);
+ nargv[i] = NULL;
+}
+#endif
+
+/* compress input to output. Return bytes read, -1 on error */
+static off_t
+gz_compress(int in, int out, off_t *gsizep, const char *origname, uint32_t mtime)
+{
+ z_stream z;
+ char *outbufp, *inbufp;
+ off_t in_tot = 0, out_tot = 0;
+ ssize_t in_size;
+ int i, error;
+ uLong crc;
+#ifdef SMALL
+ static char header[] = { GZIP_MAGIC0, GZIP_MAGIC1, Z_DEFLATED, 0,
+ 0, 0, 0, 0,
+ 0, OS_CODE };
+#endif
+
+ outbufp = malloc(BUFLEN);
+ inbufp = malloc(BUFLEN);
+ if (outbufp == NULL || inbufp == NULL) {
+ maybe_err("malloc failed");
+ goto out;
+ }
+
+ memset(&z, 0, sizeof z);
+ z.zalloc = Z_NULL;
+ z.zfree = Z_NULL;
+ z.opaque = 0;
+
+#ifdef SMALL
+ memcpy(outbufp, header, sizeof header);
+ i = sizeof header;
+#else
+ if (nflag != 0) {
+ mtime = 0;
+ origname = "";
+ }
+
+ i = snprintf(outbufp, BUFLEN, "%c%c%c%c%c%c%c%c%c%c%s",
+ GZIP_MAGIC0, GZIP_MAGIC1, Z_DEFLATED,
+ *origname ? ORIG_NAME : 0,
+ mtime & 0xff,
+ (mtime >> 8) & 0xff,
+ (mtime >> 16) & 0xff,
+ (mtime >> 24) & 0xff,
+ numflag == 1 ? 4 : numflag == 9 ? 2 : 0,
+ OS_CODE, origname);
+ if (i >= BUFLEN)
+ /* this need PATH_MAX > BUFLEN ... */
+ maybe_err("snprintf");
+ if (*origname)
+ i++;
+#endif
+
+ z.next_out = (unsigned char *)outbufp + i;
+ z.avail_out = BUFLEN - i;
+
+ error = deflateInit2(&z, numflag, Z_DEFLATED,
+ (-MAX_WBITS), 8, Z_DEFAULT_STRATEGY);
+ if (error != Z_OK) {
+ maybe_warnx("deflateInit2 failed");
+ in_tot = -1;
+ goto out;
+ }
+
+ crc = crc32(0L, Z_NULL, 0);
+ for (;;) {
+ if (z.avail_out == 0) {
+ if (write(out, outbufp, BUFLEN) != BUFLEN) {
+ maybe_warn("write");
+ out_tot = -1;
+ goto out;
+ }
+
+ out_tot += BUFLEN;
+ z.next_out = (unsigned char *)outbufp;
+ z.avail_out = BUFLEN;
+ }
+
+ if (z.avail_in == 0) {
+ in_size = read(in, inbufp, BUFLEN);
+ if (in_size < 0) {
+ maybe_warn("read");
+ in_tot = -1;
+ goto out;
+ }
+ if (in_size == 0)
+ break;
+
+ crc = crc32(crc, (const Bytef *)inbufp, (unsigned)in_size);
+ in_tot += in_size;
+ z.next_in = (unsigned char *)inbufp;
+ z.avail_in = in_size;
+ }
+
+ error = deflate(&z, Z_NO_FLUSH);
+ if (error != Z_OK && error != Z_STREAM_END) {
+ maybe_warnx("deflate failed");
+ in_tot = -1;
+ goto out;
+ }
+ }
+
+ /* clean up */
+ for (;;) {
+ size_t len;
+ ssize_t w;
+
+ error = deflate(&z, Z_FINISH);
+ if (error != Z_OK && error != Z_STREAM_END) {
+ maybe_warnx("deflate failed");
+ in_tot = -1;
+ goto out;
+ }
+
+ len = (char *)z.next_out - outbufp;
+
+ w = write(out, outbufp, len);
+ if (w == -1 || (size_t)w != len) {
+ maybe_warn("write");
+ out_tot = -1;
+ goto out;
+ }
+ out_tot += len;
+ z.next_out = (unsigned char *)outbufp;
+ z.avail_out = BUFLEN;
+
+ if (error == Z_STREAM_END)
+ break;
+ }
+
+ if (deflateEnd(&z) != Z_OK) {
+ maybe_warnx("deflateEnd failed");
+ in_tot = -1;
+ goto out;
+ }
+
+ i = snprintf(outbufp, BUFLEN, "%c%c%c%c%c%c%c%c",
+ (int)crc & 0xff,
+ (int)(crc >> 8) & 0xff,
+ (int)(crc >> 16) & 0xff,
+ (int)(crc >> 24) & 0xff,
+ (int)in_tot & 0xff,
+ (int)(in_tot >> 8) & 0xff,
+ (int)(in_tot >> 16) & 0xff,
+ (int)(in_tot >> 24) & 0xff);
+ if (i != 8)
+ maybe_err("snprintf");
+ if (write(out, outbufp, i) != i) {
+ maybe_warn("write");
+ in_tot = -1;
+ } else
+ out_tot += i;
+
+out:
+ if (inbufp != NULL)
+ free(inbufp);
+ if (outbufp != NULL)
+ free(outbufp);
+ if (gsizep)
+ *gsizep = out_tot;
+ return in_tot;
+}
+
+/*
+ * uncompress input to output then close the input. return the
+ * uncompressed size written, and put the compressed sized read
+ * into `*gsizep'.
+ */
+static off_t
+gz_uncompress(int in, int out, char *pre, size_t prelen, off_t *gsizep,
+ const char *filename)
+{
+ z_stream z;
+ char *outbufp, *inbufp;
+ off_t out_tot = -1, in_tot = 0;
+ uint32_t out_sub_tot = 0;
+ enum {
+ GZSTATE_MAGIC0,
+ GZSTATE_MAGIC1,
+ GZSTATE_METHOD,
+ GZSTATE_FLAGS,
+ GZSTATE_SKIPPING,
+ GZSTATE_EXTRA,
+ GZSTATE_EXTRA2,
+ GZSTATE_EXTRA3,
+ GZSTATE_ORIGNAME,
+ GZSTATE_COMMENT,
+ GZSTATE_HEAD_CRC1,
+ GZSTATE_HEAD_CRC2,
+ GZSTATE_INIT,
+ GZSTATE_READ,
+ GZSTATE_CRC,
+ GZSTATE_LEN,
+ } state = GZSTATE_MAGIC0;
+ int flags = 0, skip_count = 0;
+ int error = Z_STREAM_ERROR, done_reading = 0;
+ uLong crc = 0;
+ ssize_t wr;
+ int needmore = 0;
+
+#define ADVANCE() { z.next_in++; z.avail_in--; }
+
+ if ((outbufp = malloc(BUFLEN)) == NULL) {
+ maybe_err("malloc failed");
+ goto out2;
+ }
+ if ((inbufp = malloc(BUFLEN)) == NULL) {
+ maybe_err("malloc failed");
+ goto out1;
+ }
+
+ memset(&z, 0, sizeof z);
+ z.avail_in = prelen;
+ z.next_in = (unsigned char *)pre;
+ z.avail_out = BUFLEN;
+ z.next_out = (unsigned char *)outbufp;
+ z.zalloc = NULL;
+ z.zfree = NULL;
+ z.opaque = 0;
+
+ in_tot = prelen;
+ out_tot = 0;
+
+ for (;;) {
+ if ((z.avail_in == 0 || needmore) && done_reading == 0) {
+ ssize_t in_size;
+
+ if (z.avail_in > 0) {
+ memmove(inbufp, z.next_in, z.avail_in);
+ }
+ z.next_in = (unsigned char *)inbufp;
+ in_size = read(in, z.next_in + z.avail_in,
+ BUFLEN - z.avail_in);
+
+ if (in_size == -1) {
+ maybe_warn("failed to read stdin");
+ goto stop_and_fail;
+ } else if (in_size == 0) {
+ done_reading = 1;
+ }
+
+ z.avail_in += in_size;
+ needmore = 0;
+
+ in_tot += in_size;
+ }
+ if (z.avail_in == 0) {
+ if (done_reading && state != GZSTATE_MAGIC0) {
+ maybe_warnx("%s: unexpected end of file",
+ filename);
+ goto stop_and_fail;
+ }
+ goto stop;
+ }
+ switch (state) {
+ case GZSTATE_MAGIC0:
+ if (*z.next_in != GZIP_MAGIC0) {
+ if (in_tot > 0) {
+ maybe_warnx("%s: trailing garbage "
+ "ignored", filename);
+ exit_value = 2;
+ goto stop;
+ }
+ maybe_warnx("input not gziped (MAGIC0)");
+ goto stop_and_fail;
+ }
+ ADVANCE();
+ state++;
+ out_sub_tot = 0;
+ crc = crc32(0L, Z_NULL, 0);
+ break;
+
+ case GZSTATE_MAGIC1:
+ if (*z.next_in != GZIP_MAGIC1 &&
+ *z.next_in != GZIP_OMAGIC1) {
+ maybe_warnx("input not gziped (MAGIC1)");
+ goto stop_and_fail;
+ }
+ ADVANCE();
+ state++;
+ break;
+
+ case GZSTATE_METHOD:
+ if (*z.next_in != Z_DEFLATED) {
+ maybe_warnx("unknown compression method");
+ goto stop_and_fail;
+ }
+ ADVANCE();
+ state++;
+ break;
+
+ case GZSTATE_FLAGS:
+ flags = *z.next_in;
+ ADVANCE();
+ skip_count = 6;
+ state++;
+ break;
+
+ case GZSTATE_SKIPPING:
+ if (skip_count > 0) {
+ skip_count--;
+ ADVANCE();
+ } else
+ state++;
+ break;
+
+ case GZSTATE_EXTRA:
+ if ((flags & EXTRA_FIELD) == 0) {
+ state = GZSTATE_ORIGNAME;
+ break;
+ }
+ skip_count = *z.next_in;
+ ADVANCE();
+ state++;
+ break;
+
+ case GZSTATE_EXTRA2:
+ skip_count |= ((*z.next_in) << 8);
+ ADVANCE();
+ state++;
+ break;
+
+ case GZSTATE_EXTRA3:
+ if (skip_count > 0) {
+ skip_count--;
+ ADVANCE();
+ } else
+ state++;
+ break;
+
+ case GZSTATE_ORIGNAME:
+ if ((flags & ORIG_NAME) == 0) {
+ state++;
+ break;
+ }
+ if (*z.next_in == 0)
+ state++;
+ ADVANCE();
+ break;
+
+ case GZSTATE_COMMENT:
+ if ((flags & COMMENT) == 0) {
+ state++;
+ break;
+ }
+ if (*z.next_in == 0)
+ state++;
+ ADVANCE();
+ break;
+
+ case GZSTATE_HEAD_CRC1:
+ if (flags & HEAD_CRC)
+ skip_count = 2;
+ else
+ skip_count = 0;
+ state++;
+ break;
+
+ case GZSTATE_HEAD_CRC2:
+ if (skip_count > 0) {
+ skip_count--;
+ ADVANCE();
+ } else
+ state++;
+ break;
+
+ case GZSTATE_INIT:
+ if (inflateInit2(&z, -MAX_WBITS) != Z_OK) {
+ maybe_warnx("failed to inflateInit");
+ goto stop_and_fail;
+ }
+ state++;
+ break;
+
+ case GZSTATE_READ:
+ error = inflate(&z, Z_FINISH);
+ switch (error) {
+ /* Z_BUF_ERROR goes with Z_FINISH... */
+ case Z_BUF_ERROR:
+ if (z.avail_out > 0 && !done_reading)
+ continue;
+
+ case Z_STREAM_END:
+ case Z_OK:
+ break;
+
+ case Z_NEED_DICT:
+ maybe_warnx("Z_NEED_DICT error");
+ goto stop_and_fail;
+ case Z_DATA_ERROR:
+ maybe_warnx("data stream error");
+ goto stop_and_fail;
+ case Z_STREAM_ERROR:
+ maybe_warnx("internal stream error");
+ goto stop_and_fail;
+ case Z_MEM_ERROR:
+ maybe_warnx("memory allocation error");
+ goto stop_and_fail;
+
+ default:
+ maybe_warn("unknown error from inflate(): %d",
+ error);
+ }
+ wr = BUFLEN - z.avail_out;
+
+ if (wr != 0) {
+ crc = crc32(crc, (const Bytef *)outbufp, (unsigned)wr);
+ if (
+#ifndef SMALL
+ /* don't write anything with -t */
+ tflag == 0 &&
+#endif
+ write(out, outbufp, wr) != wr) {
+ maybe_warn("error writing to output");
+ goto stop_and_fail;
+ }
+
+ out_tot += wr;
+ out_sub_tot += wr;
+ }
+
+ if (error == Z_STREAM_END) {
+ inflateEnd(&z);
+ state++;
+ }
+
+ z.next_out = (unsigned char *)outbufp;
+ z.avail_out = BUFLEN;
+
+ break;
+ case GZSTATE_CRC:
+ {
+ uLong origcrc;
+
+ if (z.avail_in < 4) {
+ if (!done_reading) {
+ needmore = 1;
+ continue;
+ }
+ maybe_warnx("truncated input");
+ goto stop_and_fail;
+ }
+ origcrc = ((unsigned)z.next_in[0] & 0xff) |
+ ((unsigned)z.next_in[1] & 0xff) << 8 |
+ ((unsigned)z.next_in[2] & 0xff) << 16 |
+ ((unsigned)z.next_in[3] & 0xff) << 24;
+ if (origcrc != crc) {
+ maybe_warnx("invalid compressed"
+ " data--crc error");
+ goto stop_and_fail;
+ }
+ }
+
+ z.avail_in -= 4;
+ z.next_in += 4;
+
+ if (!z.avail_in && done_reading) {
+ goto stop;
+ }
+ state++;
+ break;
+ case GZSTATE_LEN:
+ {
+ uLong origlen;
+
+ if (z.avail_in < 4) {
+ if (!done_reading) {
+ needmore = 1;
+ continue;
+ }
+ maybe_warnx("truncated input");
+ goto stop_and_fail;
+ }
+ origlen = ((unsigned)z.next_in[0] & 0xff) |
+ ((unsigned)z.next_in[1] & 0xff) << 8 |
+ ((unsigned)z.next_in[2] & 0xff) << 16 |
+ ((unsigned)z.next_in[3] & 0xff) << 24;
+
+ if (origlen != out_sub_tot) {
+ maybe_warnx("invalid compressed"
+ " data--length error");
+ goto stop_and_fail;
+ }
+ }
+
+ z.avail_in -= 4;
+ z.next_in += 4;
+
+ if (error < 0) {
+ maybe_warnx("decompression error");
+ goto stop_and_fail;
+ }
+ state = GZSTATE_MAGIC0;
+ break;
+ }
+ continue;
+stop_and_fail:
+ out_tot = -1;
+stop:
+ break;
+ }
+ if (state > GZSTATE_INIT)
+ inflateEnd(&z);
+
+ free(inbufp);
+out1:
+ free(outbufp);
+out2:
+ if (gsizep)
+ *gsizep = in_tot;
+ return (out_tot);
+}
+
+#ifndef SMALL
+/*
+ * set the owner, mode, flags & utimes using the given file descriptor.
+ * file is only used in possible warning messages.
+ */
+static void
+copymodes(int fd, const struct stat *sbp, const char *file)
+{
+ struct timespec times[2];
+ struct stat sb;
+
+ /*
+ * If we have no info on the input, give this file some
+ * default values and return..
+ */
+ if (sbp == NULL) {
+ mode_t mask = umask(022);
+
+ (void)fchmod(fd, DEFFILEMODE & ~mask);
+ (void)umask(mask);
+ return;
+ }
+ sb = *sbp;
+
+ /* if the chown fails, remove set-id bits as-per compress(1) */
+ if (fchown(fd, sb.st_uid, sb.st_gid) < 0) {
+ if (errno != EPERM)
+ maybe_warn("couldn't fchown: %s", file);
+ sb.st_mode &= ~(S_ISUID|S_ISGID);
+ }
+
+ /* we only allow set-id and the 9 normal permission bits */
+ sb.st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
+ if (fchmod(fd, sb.st_mode) < 0)
+ maybe_warn("couldn't fchmod: %s", file);
+
+ times[0] = sb.st_atim;
+ times[1] = sb.st_mtim;
+ if (futimens(fd, times) < 0)
+ maybe_warn("couldn't futimens: %s", file);
+
+ /* only try flags if they exist already */
+ if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0)
+ maybe_warn("couldn't fchflags: %s", file);
+}
+#endif
+
+/* what sort of file is this? */
+static enum filetype
+file_gettype(u_char *buf)
+{
+
+ if (buf[0] == GZIP_MAGIC0 &&
+ (buf[1] == GZIP_MAGIC1 || buf[1] == GZIP_OMAGIC1))
+ return FT_GZIP;
+ else
+#ifndef NO_BZIP2_SUPPORT
+ if (memcmp(buf, BZIP2_MAGIC, 3) == 0 &&
+ buf[3] >= '0' && buf[3] <= '9')
+ return FT_BZIP2;
+ else
+#endif
+#ifndef NO_COMPRESS_SUPPORT
+ if (memcmp(buf, Z_MAGIC, 2) == 0)
+ return FT_Z;
+ else
+#endif
+#ifndef NO_PACK_SUPPORT
+ if (memcmp(buf, PACK_MAGIC, 2) == 0)
+ return FT_PACK;
+ else
+#endif
+#ifndef NO_XZ_SUPPORT
+ if (memcmp(buf, XZ_MAGIC, 4) == 0) /* XXX: We only have 4 bytes */
+ return FT_XZ;
+ else
+#endif
+ return FT_UNKNOWN;
+}
+
+#ifndef SMALL
+/* check the outfile is OK. */
+static int
+check_outfile(const char *outfile)
+{
+ struct stat sb;
+ int ok = 1;
+
+ if (lflag == 0 && stat(outfile, &sb) == 0) {
+ if (fflag)
+ unlink(outfile);
+ else if (isatty(STDIN_FILENO)) {
+ char ans[10] = { 'n', '\0' }; /* default */
+
+ fprintf(stderr, "%s already exists -- do you wish to "
+ "overwrite (y or n)? " , outfile);
+ (void)fgets(ans, sizeof(ans) - 1, stdin);
+ if (ans[0] != 'y' && ans[0] != 'Y') {
+ fprintf(stderr, "\tnot overwriting\n");
+ ok = 0;
+ } else
+ unlink(outfile);
+ } else {
+ maybe_warnx("%s already exists -- skipping", outfile);
+ ok = 0;
+ }
+ }
+ return ok;
+}
+
+static void
+unlink_input(const char *file, const struct stat *sb)
+{
+ struct stat nsb;
+
+ if (kflag)
+ return;
+ if (stat(file, &nsb) != 0)
+ /* Must be gone already */
+ return;
+ if (nsb.st_dev != sb->st_dev || nsb.st_ino != sb->st_ino)
+ /* Definitely a different file */
+ return;
+ unlink(file);
+}
+
+static void
+sigint_handler(int signo __unused)
+{
+
+ if (remove_file != NULL)
+ unlink(remove_file);
+ _exit(2);
+}
+#endif
+
+static const suffixes_t *
+check_suffix(char *file, int xlate)
+{
+ const suffixes_t *s;
+ int len = strlen(file);
+ char *sp;
+
+ for (s = suffixes; s != suffixes + NUM_SUFFIXES; s++) {
+ /* if it doesn't fit in "a.suf", don't bother */
+ if (s->ziplen >= len)
+ continue;
+ sp = file + len - s->ziplen;
+ if (strcmp(s->zipped, sp) != 0)
+ continue;
+ if (xlate)
+ strcpy(sp, s->normal);
+ return s;
+ }
+ return NULL;
+}
+
+/*
+ * compress the given file: create a corresponding .gz file and remove the
+ * original.
+ */
+static off_t
+file_compress(char *file, char *outfile, size_t outsize)
+{
+ int in;
+ int out;
+ off_t size, insize;
+#ifndef SMALL
+ struct stat isb, osb;
+ const suffixes_t *suff;
+#endif
+
+ in = open(file, O_RDONLY);
+ if (in == -1) {
+ maybe_warn("can't open %s", file);
+ return (-1);
+ }
+
+#ifndef SMALL
+ if (fstat(in, &isb) != 0) {
+ maybe_warn("couldn't stat: %s", file);
+ close(in);
+ return (-1);
+ }
+#endif
+
+ if (cflag == 0) {
+#ifndef SMALL
+ if (isb.st_nlink > 1 && fflag == 0) {
+ maybe_warnx("%s has %d other link%s -- skipping",
+ file, isb.st_nlink - 1,
+ (isb.st_nlink - 1) == 1 ? "" : "s");
+ close(in);
+ return (-1);
+ }
+
+ if (fflag == 0 && (suff = check_suffix(file, 0)) &&
+ suff->zipped[0] != 0) {
+ maybe_warnx("%s already has %s suffix -- unchanged",
+ file, suff->zipped);
+ close(in);
+ return (-1);
+ }
+#endif
+
+ /* Add (usually) .gz to filename */
+ if ((size_t)snprintf(outfile, outsize, "%s%s",
+ file, suffixes[0].zipped) >= outsize)
+ memcpy(outfile + outsize - suffixes[0].ziplen - 1,
+ suffixes[0].zipped, suffixes[0].ziplen + 1);
+
+#ifndef SMALL
+ if (check_outfile(outfile) == 0) {
+ close(in);
+ return (-1);
+ }
+#endif
+ }
+
+ if (cflag == 0) {
+ out = open(outfile, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ if (out == -1) {
+ maybe_warn("could not create output: %s", outfile);
+ fclose(stdin);
+ return (-1);
+ }
+#ifndef SMALL
+ remove_file = outfile;
+#endif
+ } else
+ out = STDOUT_FILENO;
+
+ insize = gz_compress(in, out, &size, basename(file), (uint32_t)isb.st_mtime);
+
+ (void)close(in);
+
+ /*
+ * If there was an error, insize will be -1.
+ * If we compressed to stdout, just return the size.
+ * Otherwise stat the file and check it is the correct size.
+ * We only blow away the file if we can stat the output and it
+ * has the expected size.
+ */
+ if (cflag != 0)
+ return (insize == -1 ? -1 : size);
+
+#ifndef SMALL
+ if (fstat(out, &osb) != 0) {
+ maybe_warn("couldn't stat: %s", outfile);
+ goto bad_outfile;
+ }
+
+ if (osb.st_size != size) {
+ maybe_warnx("output file: %s wrong size (%ju != %ju), deleting",
+ outfile, (uintmax_t)osb.st_size, (uintmax_t)size);
+ goto bad_outfile;
+ }
+
+ copymodes(out, &isb, outfile);
+ remove_file = NULL;
+#endif
+ if (close(out) == -1)
+ maybe_warn("couldn't close output");
+
+ /* output is good, ok to delete input */
+ unlink_input(file, &isb);
+ return (size);
+
+#ifndef SMALL
+ bad_outfile:
+ if (close(out) == -1)
+ maybe_warn("couldn't close output");
+
+ maybe_warnx("leaving original %s", file);
+ unlink(outfile);
+ return (size);
+#endif
+}
+
+/* uncompress the given file and remove the original */
+static off_t
+file_uncompress(char *file, char *outfile, size_t outsize)
+{
+ struct stat isb, osb;
+ off_t size;
+ ssize_t rbytes;
+ unsigned char header1[4];
+ enum filetype method;
+ int fd, ofd, zfd = -1;
+#ifndef SMALL
+ ssize_t rv;
+ time_t timestamp = 0;
+ char name[PATH_MAX + 1];
+#endif
+
+ /* gather the old name info */
+
+ fd = open(file, O_RDONLY);
+ if (fd < 0) {
+ maybe_warn("can't open %s", file);
+ goto lose;
+ }
+
+ strlcpy(outfile, file, outsize);
+ if (check_suffix(outfile, 1) == NULL && !(cflag || lflag)) {
+ maybe_warnx("%s: unknown suffix -- ignored", file);
+ goto lose;
+ }
+
+ rbytes = read(fd, header1, sizeof header1);
+ if (rbytes != sizeof header1) {
+ /* we don't want to fail here. */
+#ifndef SMALL
+ if (fflag)
+ goto lose;
+#endif
+ if (rbytes == -1)
+ maybe_warn("can't read %s", file);
+ else
+ goto unexpected_EOF;
+ goto lose;
+ }
+
+ method = file_gettype(header1);
+#ifndef SMALL
+ if (fflag == 0 && method == FT_UNKNOWN) {
+ maybe_warnx("%s: not in gzip format", file);
+ goto lose;
+ }
+
+#endif
+
+#ifndef SMALL
+ if (method == FT_GZIP && Nflag) {
+ unsigned char ts[4]; /* timestamp */
+
+ rv = pread(fd, ts, sizeof ts, GZIP_TIMESTAMP);
+ if (rv >= 0 && rv < (ssize_t)(sizeof ts))
+ goto unexpected_EOF;
+ if (rv == -1) {
+ if (!fflag)
+ maybe_warn("can't read %s", file);
+ goto lose;
+ }
+ timestamp = ts[3] << 24 | ts[2] << 16 | ts[1] << 8 | ts[0];
+
+ if (header1[3] & ORIG_NAME) {
+ rbytes = pread(fd, name, sizeof(name) - 1, GZIP_ORIGNAME);
+ if (rbytes < 0) {
+ maybe_warn("can't read %s", file);
+ goto lose;
+ }
+ if (name[0] != '\0') {
+ char *dp, *nf;
+
+ /* Make sure that name is NUL-terminated */
+ name[rbytes] = '\0';
+
+ /* strip saved directory name */
+ nf = strrchr(name, '/');
+ if (nf == NULL)
+ nf = name;
+ else
+ nf++;
+
+ /* preserve original directory name */
+ dp = strrchr(file, '/');
+ if (dp == NULL)
+ dp = file;
+ else
+ dp++;
+ snprintf(outfile, outsize, "%.*s%.*s",
+ (int) (dp - file),
+ file, (int) rbytes, nf);
+ }
+ }
+ }
+#endif
+ lseek(fd, 0, SEEK_SET);
+
+ if (cflag == 0 || lflag) {
+ if (fstat(fd, &isb) != 0)
+ goto lose;
+#ifndef SMALL
+ if (isb.st_nlink > 1 && lflag == 0 && fflag == 0) {
+ maybe_warnx("%s has %d other links -- skipping",
+ file, isb.st_nlink - 1);
+ goto lose;
+ }
+ if (nflag == 0 && timestamp)
+ isb.st_mtime = timestamp;
+ if (check_outfile(outfile) == 0)
+ goto lose;
+#endif
+ }
+
+ if (cflag == 0 && lflag == 0) {
+ zfd = open(outfile, O_WRONLY|O_CREAT|O_EXCL, 0600);
+ if (zfd == STDOUT_FILENO) {
+ /* We won't close STDOUT_FILENO later... */
+ zfd = dup(zfd);
+ close(STDOUT_FILENO);
+ }
+ if (zfd == -1) {
+ maybe_warn("can't open %s", outfile);
+ goto lose;
+ }
+#ifndef SMALL
+ remove_file = outfile;
+#endif
+ } else
+ zfd = STDOUT_FILENO;
+
+ switch (method) {
+#ifndef NO_BZIP2_SUPPORT
+ case FT_BZIP2:
+ /* XXX */
+ if (lflag) {
+ maybe_warnx("no -l with bzip2 files");
+ goto lose;
+ }
+
+ size = unbzip2(fd, zfd, NULL, 0, NULL);
+ break;
+#endif
+
+#ifndef NO_COMPRESS_SUPPORT
+ case FT_Z: {
+ FILE *in, *out;
+
+ /* XXX */
+ if (lflag) {
+ maybe_warnx("no -l with Lempel-Ziv files");
+ goto lose;
+ }
+
+ if ((in = zdopen(fd)) == NULL) {
+ maybe_warn("zdopen for read: %s", file);
+ goto lose;
+ }
+
+ out = fdopen(dup(zfd), "w");
+ if (out == NULL) {
+ maybe_warn("fdopen for write: %s", outfile);
+ fclose(in);
+ goto lose;
+ }
+
+ size = zuncompress(in, out, NULL, 0, NULL);
+ /* need to fclose() if ferror() is true... */
+ if (ferror(in) | fclose(in)) {
+ maybe_warn("failed infile fclose");
+ unlink(outfile);
+ (void)fclose(out);
+ }
+ if (fclose(out) != 0) {
+ maybe_warn("failed outfile fclose");
+ unlink(outfile);
+ goto lose;
+ }
+ break;
+ }
+#endif
+
+#ifndef NO_PACK_SUPPORT
+ case FT_PACK:
+ if (lflag) {
+ maybe_warnx("no -l with packed files");
+ goto lose;
+ }
+
+ size = unpack(fd, zfd, NULL, 0, NULL);
+ break;
+#endif
+
+#ifndef NO_XZ_SUPPORT
+ case FT_XZ:
+ if (lflag) {
+ maybe_warnx("no -l with xz files");
+ goto lose;
+ }
+
+ size = unxz(fd, zfd, NULL, 0, NULL);
+ break;
+#endif
+
+#ifndef SMALL
+ case FT_UNKNOWN:
+ if (lflag) {
+ maybe_warnx("no -l for unknown filetypes");
+ goto lose;
+ }
+ size = cat_fd(NULL, 0, NULL, fd);
+ break;
+#endif
+ default:
+ if (lflag) {
+ print_list(fd, isb.st_size, outfile, isb.st_mtime);
+ close(fd);
+ return -1; /* XXX */
+ }
+
+ size = gz_uncompress(fd, zfd, NULL, 0, NULL, file);
+ break;
+ }
+
+ if (close(fd) != 0)
+ maybe_warn("couldn't close input");
+ if (zfd != STDOUT_FILENO && close(zfd) != 0)
+ maybe_warn("couldn't close output");
+
+ if (size == -1) {
+ if (cflag == 0)
+ unlink(outfile);
+ maybe_warnx("%s: uncompress failed", file);
+ return -1;
+ }
+
+ /* if testing, or we uncompressed to stdout, this is all we need */
+#ifndef SMALL
+ if (tflag)
+ return size;
+#endif
+ /* if we are uncompressing to stdin, don't remove the file. */
+ if (cflag)
+ return size;
+
+ /*
+ * if we create a file...
+ */
+ /*
+ * if we can't stat the file don't remove the file.
+ */
+
+ ofd = open(outfile, O_RDWR, 0);
+ if (ofd == -1) {
+ maybe_warn("couldn't open (leaving original): %s",
+ outfile);
+ return -1;
+ }
+ if (fstat(ofd, &osb) != 0) {
+ maybe_warn("couldn't stat (leaving original): %s",
+ outfile);
+ close(ofd);
+ return -1;
+ }
+ if (osb.st_size != size) {
+ maybe_warnx("stat gave different size: %ju != %ju (leaving original)",
+ (uintmax_t)size, (uintmax_t)osb.st_size);
+ close(ofd);
+ unlink(outfile);
+ return -1;
+ }
+#ifndef SMALL
+ copymodes(ofd, &isb, outfile);
+ remove_file = NULL;
+#endif
+ close(ofd);
+ unlink_input(file, &isb);
+ return size;
+
+ unexpected_EOF:
+ maybe_warnx("%s: unexpected end of file", file);
+ lose:
+ if (fd != -1)
+ close(fd);
+ if (zfd != -1 && zfd != STDOUT_FILENO)
+ close(fd);
+ return -1;
+}
+
+#ifndef SMALL
+static off_t
+cat_fd(unsigned char * prepend, size_t count, off_t *gsizep, int fd)
+{
+ char buf[BUFLEN];
+ off_t in_tot;
+ ssize_t w;
+
+ in_tot = count;
+ w = write(STDOUT_FILENO, prepend, count);
+ if (w == -1 || (size_t)w != count) {
+ maybe_warn("write to stdout");
+ return -1;
+ }
+ for (;;) {
+ ssize_t rv;
+
+ rv = read(fd, buf, sizeof buf);
+ if (rv == 0)
+ break;
+ if (rv < 0) {
+ maybe_warn("read from fd %d", fd);
+ break;
+ }
+
+ if (write(STDOUT_FILENO, buf, rv) != rv) {
+ maybe_warn("write to stdout");
+ break;
+ }
+ in_tot += rv;
+ }
+
+ if (gsizep)
+ *gsizep = in_tot;
+ return (in_tot);
+}
+#endif
+
+static void
+handle_stdin(void)
+{
+ unsigned char header1[4];
+ off_t usize, gsize;
+ enum filetype method;
+ ssize_t bytes_read;
+#ifndef NO_COMPRESS_SUPPORT
+ FILE *in;
+#endif
+
+#ifndef SMALL
+ if (fflag == 0 && lflag == 0 && isatty(STDIN_FILENO)) {
+ maybe_warnx("standard input is a terminal -- ignoring");
+ return;
+ }
+#endif
+
+ if (lflag) {
+ struct stat isb;
+
+ /* XXX could read the whole file, etc. */
+ if (fstat(STDIN_FILENO, &isb) < 0) {
+ maybe_warn("fstat");
+ return;
+ }
+ print_list(STDIN_FILENO, isb.st_size, "stdout", isb.st_mtime);
+ return;
+ }
+
+ bytes_read = read_retry(STDIN_FILENO, header1, sizeof header1);
+ if (bytes_read == -1) {
+ maybe_warn("can't read stdin");
+ return;
+ } else if (bytes_read != sizeof(header1)) {
+ maybe_warnx("(stdin): unexpected end of file");
+ return;
+ }
+
+ method = file_gettype(header1);
+ switch (method) {
+ default:
+#ifndef SMALL
+ if (fflag == 0) {
+ maybe_warnx("unknown compression format");
+ return;
+ }
+ usize = cat_fd(header1, sizeof header1, &gsize, STDIN_FILENO);
+ break;
+#endif
+ case FT_GZIP:
+ usize = gz_uncompress(STDIN_FILENO, STDOUT_FILENO,
+ (char *)header1, sizeof header1, &gsize, "(stdin)");
+ break;
+#ifndef NO_BZIP2_SUPPORT
+ case FT_BZIP2:
+ usize = unbzip2(STDIN_FILENO, STDOUT_FILENO,
+ (char *)header1, sizeof header1, &gsize);
+ break;
+#endif
+#ifndef NO_COMPRESS_SUPPORT
+ case FT_Z:
+ if ((in = zdopen(STDIN_FILENO)) == NULL) {
+ maybe_warnx("zopen of stdin");
+ return;
+ }
+
+ usize = zuncompress(in, stdout, (char *)header1,
+ sizeof header1, &gsize);
+ fclose(in);
+ break;
+#endif
+#ifndef NO_PACK_SUPPORT
+ case FT_PACK:
+ usize = unpack(STDIN_FILENO, STDOUT_FILENO,
+ (char *)header1, sizeof header1, &gsize);
+ break;
+#endif
+#ifndef NO_XZ_SUPPORT
+ case FT_XZ:
+ usize = unxz(STDIN_FILENO, STDOUT_FILENO,
+ (char *)header1, sizeof header1, &gsize);
+ break;
+#endif
+ }
+
+#ifndef SMALL
+ if (vflag && !tflag && usize != -1 && gsize != -1)
+ print_verbage(NULL, NULL, usize, gsize);
+ if (vflag && tflag)
+ print_test("(stdin)", usize != -1);
+#endif
+
+}
+
+static void
+handle_stdout(void)
+{
+ off_t gsize, usize;
+ struct stat sb;
+ time_t systime;
+ uint32_t mtime;
+ int ret;
+
+#ifndef SMALL
+ if (fflag == 0 && isatty(STDOUT_FILENO)) {
+ maybe_warnx("standard output is a terminal -- ignoring");
+ return;
+ }
+#endif
+ /* If stdin is a file use its mtime, otherwise use current time */
+ ret = fstat(STDIN_FILENO, &sb);
+
+#ifndef SMALL
+ if (ret < 0) {
+ maybe_warn("Can't stat stdin");
+ return;
+ }
+#endif
+
+ if (S_ISREG(sb.st_mode))
+ mtime = (uint32_t)sb.st_mtime;
+ else {
+ systime = time(NULL);
+#ifndef SMALL
+ if (systime == -1) {
+ maybe_warn("time");
+ return;
+ }
+#endif
+ mtime = (uint32_t)systime;
+ }
+
+ usize = gz_compress(STDIN_FILENO, STDOUT_FILENO, &gsize, "", mtime);
+#ifndef SMALL
+ if (vflag && !tflag && usize != -1 && gsize != -1)
+ print_verbage(NULL, NULL, usize, gsize);
+#endif
+}
+
+/* do what is asked for, for the path name */
+static void
+handle_pathname(char *path)
+{
+ char *opath = path, *s = NULL;
+ ssize_t len;
+ int slen;
+ struct stat sb;
+
+ /* check for stdout/stdin */
+ if (path[0] == '-' && path[1] == '\0') {
+ if (dflag)
+ handle_stdin();
+ else
+ handle_stdout();
+ return;
+ }
+
+retry:
+ if (stat(path, &sb) != 0 || (fflag == 0 && cflag == 0 &&
+ lstat(path, &sb) != 0)) {
+ /* lets try <path>.gz if we're decompressing */
+ if (dflag && s == NULL && errno == ENOENT) {
+ len = strlen(path);
+ slen = suffixes[0].ziplen;
+ s = malloc(len + slen + 1);
+ if (s == NULL)
+ maybe_err("malloc");
+ memcpy(s, path, len);
+ memcpy(s + len, suffixes[0].zipped, slen + 1);
+ path = s;
+ goto retry;
+ }
+ maybe_warn("can't stat: %s", opath);
+ goto out;
+ }
+
+ if (S_ISDIR(sb.st_mode)) {
+#ifndef SMALL
+ if (rflag)
+ handle_dir(path);
+ else
+#endif
+ maybe_warnx("%s is a directory", path);
+ goto out;
+ }
+
+ if (S_ISREG(sb.st_mode))
+ handle_file(path, &sb);
+ else
+ maybe_warnx("%s is not a regular file", path);
+
+out:
+ if (s)
+ free(s);
+}
+
+/* compress/decompress a file */
+static void
+handle_file(char *file, struct stat *sbp)
+{
+ off_t usize, gsize;
+ char outfile[PATH_MAX];
+
+ infile = file;
+ if (dflag) {
+ usize = file_uncompress(file, outfile, sizeof(outfile));
+#ifndef SMALL
+ if (vflag && tflag)
+ print_test(file, usize != -1);
+#endif
+ if (usize == -1)
+ return;
+ gsize = sbp->st_size;
+ } else {
+ gsize = file_compress(file, outfile, sizeof(outfile));
+ if (gsize == -1)
+ return;
+ usize = sbp->st_size;
+ }
+
+
+#ifndef SMALL
+ if (vflag && !tflag)
+ print_verbage(file, (cflag) ? NULL : outfile, usize, gsize);
+#endif
+}
+
+#ifndef SMALL
+/* this is used with -r to recursively descend directories */
+static void
+handle_dir(char *dir)
+{
+ char *path_argv[2];
+ FTS *fts;
+ FTSENT *entry;
+
+ path_argv[0] = dir;
+ path_argv[1] = 0;
+ fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL);
+ if (fts == NULL) {
+ warn("couldn't fts_open %s", dir);
+ return;
+ }
+
+ while ((entry = fts_read(fts))) {
+ switch(entry->fts_info) {
+ case FTS_D:
+ case FTS_DP:
+ continue;
+
+ case FTS_DNR:
+ case FTS_ERR:
+ case FTS_NS:
+ maybe_warn("%s", entry->fts_path);
+ continue;
+ case FTS_F:
+ handle_file(entry->fts_path, entry->fts_statp);
+ }
+ }
+ (void)fts_close(fts);
+}
+#endif
+
+/* print a ratio - size reduction as a fraction of uncompressed size */
+static void
+print_ratio(off_t in, off_t out, FILE *where)
+{
+ int percent10; /* 10 * percent */
+ off_t diff;
+ char buff[8];
+ int len;
+
+ diff = in - out/2;
+ if (diff <= 0)
+ /*
+ * Output is more than double size of input! print -99.9%
+ * Quite possibly we've failed to get the original size.
+ */
+ percent10 = -999;
+ else {
+ /*
+ * We only need 12 bits of result from the final division,
+ * so reduce the values until a 32bit division will suffice.
+ */
+ while (in > 0x100000) {
+ diff >>= 1;
+ in >>= 1;
+ }
+ if (in != 0)
+ percent10 = ((u_int)diff * 2000) / (u_int)in - 1000;
+ else
+ percent10 = 0;
+ }
+
+ len = snprintf(buff, sizeof buff, "%2.2d.", percent10);
+ /* Move the '.' to before the last digit */
+ buff[len - 1] = buff[len - 2];
+ buff[len - 2] = '.';
+ fprintf(where, "%5s%%", buff);
+}
+
+#ifndef SMALL
+/* print compression statistics, and the new name (if there is one!) */
+static void
+print_verbage(const char *file, const char *nfile, off_t usize, off_t gsize)
+{
+ if (file)
+ fprintf(stderr, "%s:%s ", file,
+ strlen(file) < 7 ? "\t\t" : "\t");
+ print_ratio(usize, gsize, stderr);
+ if (nfile)
+ fprintf(stderr, " -- replaced with %s", nfile);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+}
+
+/* print test results */
+static void
+print_test(const char *file, int ok)
+{
+
+ if (exit_value == 0 && ok == 0)
+ exit_value = 1;
+ fprintf(stderr, "%s:%s %s\n", file,
+ strlen(file) < 7 ? "\t\t" : "\t", ok ? "OK" : "NOT OK");
+ fflush(stderr);
+}
+#endif
+
+/* print a file's info ala --list */
+/* eg:
+ compressed uncompressed ratio uncompressed_name
+ 354841 1679360 78.8% /usr/pkgsrc/distfiles/libglade-2.0.1.tar
+*/
+static void
+print_list(int fd, off_t out, const char *outfile, time_t ts)
+{
+ static int first = 1;
+#ifndef SMALL
+ static off_t in_tot, out_tot;
+ uint32_t crc = 0;
+#endif
+ off_t in = 0, rv;
+
+ if (first) {
+#ifndef SMALL
+ if (vflag)
+ printf("method crc date time ");
+#endif
+ if (qflag == 0)
+ printf(" compressed uncompressed "
+ "ratio uncompressed_name\n");
+ }
+ first = 0;
+
+ /* print totals? */
+#ifndef SMALL
+ if (fd == -1) {
+ in = in_tot;
+ out = out_tot;
+ } else
+#endif
+ {
+ /* read the last 4 bytes - this is the uncompressed size */
+ rv = lseek(fd, (off_t)(-8), SEEK_END);
+ if (rv != -1) {
+ unsigned char buf[8];
+ uint32_t usize;
+
+ rv = read(fd, (char *)buf, sizeof(buf));
+ if (rv == -1)
+ maybe_warn("read of uncompressed size");
+ else if (rv != sizeof(buf))
+ maybe_warnx("read of uncompressed size");
+
+ else {
+ usize = buf[4] | buf[5] << 8 |
+ buf[6] << 16 | buf[7] << 24;
+ in = (off_t)usize;
+#ifndef SMALL
+ crc = buf[0] | buf[1] << 8 |
+ buf[2] << 16 | buf[3] << 24;
+#endif
+ }
+ }
+ }
+
+#ifndef SMALL
+ if (vflag && fd == -1)
+ printf(" ");
+ else if (vflag) {
+ char *date = ctime(&ts);
+
+ /* skip the day, 1/100th second, and year */
+ date += 4;
+ date[12] = 0;
+ printf("%5s %08x %11s ", "defla"/*XXX*/, crc, date);
+ }
+ in_tot += in;
+ out_tot += out;
+#else
+ (void)&ts; /* XXX */
+#endif
+ printf("%12llu %12llu ", (unsigned long long)out, (unsigned long long)in);
+ print_ratio(in, out, stdout);
+ printf(" %s\n", outfile);
+}
+
+/* display the usage of NetBSD gzip */
+static void
+usage(void)
+{
+
+ fprintf(stderr, "%s\n", gzip_version);
+ fprintf(stderr,
+#ifdef SMALL
+ "usage: %s [-" OPT_LIST "] [<file> [<file> ...]]\n",
+#else
+ "usage: %s [-123456789acdfhklLNnqrtVv] [-S .suffix] [<file> [<file> ...]]\n"
+ " -1 --fast fastest (worst) compression\n"
+ " -2 .. -8 set compression level\n"
+ " -9 --best best (slowest) compression\n"
+ " -c --stdout write to stdout, keep original files\n"
+ " --to-stdout\n"
+ " -d --decompress uncompress files\n"
+ " --uncompress\n"
+ " -f --force force overwriting & compress links\n"
+ " -h --help display this help\n"
+ " -k --keep don't delete input files during operation\n"
+ " -l --list list compressed file contents\n"
+ " -N --name save or restore original file name and time stamp\n"
+ " -n --no-name don't save original file name or time stamp\n"
+ " -q --quiet output no warnings\n"
+ " -r --recursive recursively compress files in directories\n"
+ " -S .suf use suffix .suf instead of .gz\n"
+ " --suffix .suf\n"
+ " -t --test test compressed file\n"
+ " -V --version display program version\n"
+ " -v --verbose print extra statistics\n",
+#endif
+ getprogname());
+ exit(0);
+}
+
+#ifndef SMALL
+/* display the license information of FreeBSD gzip */
+static void
+display_license(void)
+{
+
+ fprintf(stderr, "%s (based on NetBSD gzip 20150113)\n", gzip_version);
+ fprintf(stderr, "%s\n", gzip_copyright);
+ exit(0);
+}
+#endif
+
+/* display the version of NetBSD gzip */
+static void
+display_version(void)
+{
+
+ fprintf(stderr, "%s\n", gzip_version);
+ exit(0);
+}
+
+#ifndef NO_BZIP2_SUPPORT
+#include "unbzip2.c"
+#endif
+#ifndef NO_COMPRESS_SUPPORT
+#include "zuncompress.c"
+#endif
+#ifndef NO_PACK_SUPPORT
+#include "unpack.c"
+#endif
+#ifndef NO_XZ_SUPPORT
+#include "unxz.c"
+#endif
+
+static ssize_t
+read_retry(int fd, void *buf, size_t sz)
+{
+ char *cp = buf;
+ size_t left = MIN(sz, (size_t) SSIZE_MAX);
+
+ while (left > 0) {
+ ssize_t ret;
+
+ ret = read(fd, cp, left);
+ if (ret == -1) {
+ return ret;
+ } else if (ret == 0) {
+ break; /* EOF */
+ }
+ cp += ret;
+ left -= ret;
+ }
+
+ return sz - left;
+}
diff --git a/usr.bin/gzip/tests/Makefile b/usr.bin/gzip/tests/Makefile
new file mode 100644
index 0000000..03a5852
--- /dev/null
+++ b/usr.bin/gzip/tests/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+NETBSD_ATF_TESTS_SH= gzip_test
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/gzip/tests/Makefile.depend b/usr.bin/gzip/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/gzip/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/gzip/unbzip2.c b/usr.bin/gzip/unbzip2.c
new file mode 100644
index 0000000..a5cd1be
--- /dev/null
+++ b/usr.bin/gzip/unbzip2.c
@@ -0,0 +1,141 @@
+/* $NetBSD: unbzip2.c,v 1.13 2009/12/05 03:23:37 mrg Exp $ */
+
+/*-
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Simon Burge.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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$
+ */
+
+/* This file is #included by gzip.c */
+
+static off_t
+unbzip2(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
+{
+ int ret, end_of_file, cold = 0;
+ off_t bytes_out = 0;
+ bz_stream bzs;
+ static char *inbuf, *outbuf;
+
+ if (inbuf == NULL)
+ inbuf = malloc(BUFLEN);
+ if (outbuf == NULL)
+ outbuf = malloc(BUFLEN);
+ if (inbuf == NULL || outbuf == NULL)
+ maybe_err("malloc");
+
+ bzs.bzalloc = NULL;
+ bzs.bzfree = NULL;
+ bzs.opaque = NULL;
+
+ end_of_file = 0;
+ ret = BZ2_bzDecompressInit(&bzs, 0, 0);
+ if (ret != BZ_OK)
+ maybe_errx("bzip2 init");
+
+ /* Prepend. */
+ bzs.avail_in = prelen;
+ bzs.next_in = pre;
+
+ if (bytes_in)
+ *bytes_in = prelen;
+
+ while (ret == BZ_OK) {
+ if (bzs.avail_in == 0 && !end_of_file) {
+ ssize_t n;
+
+ n = read(in, inbuf, BUFLEN);
+ if (n < 0)
+ maybe_err("read");
+ if (n == 0)
+ end_of_file = 1;
+ bzs.next_in = inbuf;
+ bzs.avail_in = n;
+ if (bytes_in)
+ *bytes_in += n;
+ }
+
+ bzs.next_out = outbuf;
+ bzs.avail_out = BUFLEN;
+ ret = BZ2_bzDecompress(&bzs);
+
+ switch (ret) {
+ case BZ_STREAM_END:
+ case BZ_OK:
+ if (ret == BZ_OK && end_of_file) {
+ /*
+ * If we hit this after a stream end, consider
+ * it as the end of the whole file and don't
+ * bail out.
+ */
+ if (cold == 1)
+ ret = BZ_STREAM_END;
+ else
+ maybe_errx("truncated file");
+ }
+ cold = 0;
+ if (!tflag && bzs.avail_out != BUFLEN) {
+ ssize_t n;
+
+ n = write(out, outbuf, BUFLEN - bzs.avail_out);
+ if (n < 0)
+ maybe_err("write");
+ bytes_out += n;
+ }
+ if (ret == BZ_STREAM_END && !end_of_file) {
+ if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
+ BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
+ maybe_errx("bzip2 re-init");
+ cold = 1;
+ ret = BZ_OK;
+ }
+ break;
+
+ case BZ_DATA_ERROR:
+ maybe_warnx("bzip2 data integrity error");
+ break;
+
+ case BZ_DATA_ERROR_MAGIC:
+ maybe_warnx("bzip2 magic number error");
+ break;
+
+ case BZ_MEM_ERROR:
+ maybe_warnx("bzip2 out of memory");
+ break;
+
+ default:
+ maybe_warnx("unknown bzip2 error: %d", ret);
+ break;
+ }
+ }
+
+ if (ret != BZ_STREAM_END || BZ2_bzDecompressEnd(&bzs) != BZ_OK)
+ return (-1);
+
+ return (bytes_out);
+}
+
diff --git a/usr.bin/gzip/unpack.c b/usr.bin/gzip/unpack.c
new file mode 100644
index 0000000..0a1ed25
--- /dev/null
+++ b/usr.bin/gzip/unpack.c
@@ -0,0 +1,329 @@
+/*-
+ * Copyright (c) 2009 Xin LI <delphij@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$
+ */
+
+/* This file is #included by gzip.c */
+
+/*
+ * pack(1) file format:
+ *
+ * The first 7 bytes is the header:
+ * 00, 01 - Signature (US, RS), we already validated it earlier.
+ * 02..05 - Uncompressed size
+ * 06 - Level for the huffman tree (<=24)
+ *
+ * pack(1) will then store symbols (leaf) nodes count in each huffman
+ * tree levels, each level would consume 1 byte (See [1]).
+ *
+ * After the symbol count table, there is the symbol table, storing
+ * symbols represented by corresponding leaf node. EOB is not being
+ * explicitly transmitted (not necessary anyway) in the symbol table.
+ *
+ * Compressed data goes after the symbol table.
+ *
+ * NOTES
+ *
+ * [1] If we count EOB into the symbols, that would mean that we will
+ * have at most 256 symbols in the huffman tree. pack(1) rejects empty
+ * file and files that just repeats one character, which means that we
+ * will have at least 2 symbols. Therefore, pack(1) would reduce the
+ * last level symbol count by 2 which makes it a number in
+ * range [0..254], so all levels' symbol count would fit into 1 byte.
+ */
+
+#define PACK_HEADER_LENGTH 7
+#define HTREE_MAXLEVEL 24
+
+/*
+ * unpack descriptor
+ *
+ * Represent the huffman tree in a similar way that pack(1) would
+ * store in a packed file. We store all symbols in a linear table,
+ * and store pointers to each level's first symbol. In addition to
+ * that, maintain two counts for each level: inner nodes count and
+ * leaf nodes count.
+ */
+typedef struct {
+ int symbol_size; /* Size of the symbol table */
+ int treelevels; /* Levels for the huffman tree */
+
+ int *symbolsin; /* Table of leaf symbols count in
+ each level */
+ int *inodesin; /* Table of internal nodes count in
+ each level */
+
+ char *symbol; /* The symbol table */
+ char *symbol_eob; /* Pointer to the EOB symbol */
+ char **tree; /* Decoding huffman tree (pointers to
+ first symbol of each tree level */
+
+ off_t uncompressed_size; /* Uncompressed size */
+ FILE *fpIn; /* Input stream */
+ FILE *fpOut; /* Output stream */
+} unpack_descriptor_t;
+
+/*
+ * Release resource allocated to an unpack descriptor.
+ *
+ * Caller is responsible to make sure that all of these pointers are
+ * initialized (in our case, they all point to valid memory block).
+ * We don't zero out pointers here because nobody else would ever
+ * reference the memory block without scrubbing them.
+ */
+static void
+unpack_descriptor_fini(unpack_descriptor_t *unpackd)
+{
+
+ free(unpackd->symbolsin);
+ free(unpackd->inodesin);
+ free(unpackd->symbol);
+ free(unpackd->tree);
+
+ fclose(unpackd->fpIn);
+ fclose(unpackd->fpOut);
+}
+
+/*
+ * Recursively fill the internal node count table
+ */
+static void
+unpackd_fill_inodesin(const unpack_descriptor_t *unpackd, int level)
+{
+
+ /*
+ * The internal nodes would be 1/2 of total internal nodes and
+ * leaf nodes in the next level. For the last level there
+ * would be no internal node by definition.
+ */
+ if (level < unpackd->treelevels) {
+ unpackd_fill_inodesin(unpackd, level + 1);
+ unpackd->inodesin[level] = (unpackd->inodesin[level + 1] +
+ unpackd->symbolsin[level + 1]) / 2;
+ } else
+ unpackd->inodesin[level] = 0;
+}
+
+/*
+ * Update counter for accepted bytes
+ */
+static void
+accepted_bytes(off_t *bytes_in, off_t newbytes)
+{
+
+ if (bytes_in != NULL)
+ (*bytes_in) += newbytes;
+}
+
+/*
+ * Read file header and construct the tree. Also, prepare the buffered I/O
+ * for decode routine.
+ *
+ * Return value is uncompressed size.
+ */
+static void
+unpack_parse_header(int in, int out, char *pre, size_t prelen, off_t *bytes_in,
+ unpack_descriptor_t *unpackd)
+{
+ unsigned char hdr[PACK_HEADER_LENGTH]; /* buffer for header */
+ ssize_t bytesread; /* Bytes read from the file */
+ int i, j, thisbyte;
+
+ /* Prepend the header buffer if we already read some data */
+ if (prelen != 0)
+ memcpy(hdr, pre, prelen);
+
+ /* Read in and fill the rest bytes of header */
+ bytesread = read(in, hdr + prelen, PACK_HEADER_LENGTH - prelen);
+ if (bytesread < 0)
+ maybe_err("Error reading pack header");
+
+ accepted_bytes(bytes_in, PACK_HEADER_LENGTH);
+
+ /* Obtain uncompressed length (bytes 2,3,4,5)*/
+ unpackd->uncompressed_size = 0;
+ for (i = 2; i <= 5; i++) {
+ unpackd->uncompressed_size <<= 8;
+ unpackd->uncompressed_size |= hdr[i];
+ }
+
+ /* Get the levels of the tree */
+ unpackd->treelevels = hdr[6];
+ if (unpackd->treelevels > HTREE_MAXLEVEL || unpackd->treelevels < 1)
+ maybe_errx("Huffman tree has insane levels");
+
+ /* Let libc take care for buffering from now on */
+ if ((unpackd->fpIn = fdopen(in, "r")) == NULL)
+ maybe_err("Can not fdopen() input stream");
+ if ((unpackd->fpOut = fdopen(out, "w")) == NULL)
+ maybe_err("Can not fdopen() output stream");
+
+ /* Allocate for the tables of bounds and the tree itself */
+ unpackd->inodesin =
+ calloc(unpackd->treelevels, sizeof(*(unpackd->inodesin)));
+ unpackd->symbolsin =
+ calloc(unpackd->treelevels, sizeof(*(unpackd->symbolsin)));
+ unpackd->tree =
+ calloc(unpackd->treelevels, (sizeof (*(unpackd->tree))));
+ if (unpackd->inodesin == NULL || unpackd->symbolsin == NULL ||
+ unpackd->tree == NULL)
+ maybe_err("calloc");
+
+ /* We count from 0 so adjust to match array upper bound */
+ unpackd->treelevels--;
+
+ /* Read the levels symbol count table and calculate total */
+ unpackd->symbol_size = 1; /* EOB */
+ for (i = 0; i <= unpackd->treelevels; i++) {
+ if ((thisbyte = fgetc(unpackd->fpIn)) == EOF)
+ maybe_err("File appears to be truncated");
+ unpackd->symbolsin[i] = (unsigned char)thisbyte;
+ unpackd->symbol_size += unpackd->symbolsin[i];
+ }
+ accepted_bytes(bytes_in, unpackd->treelevels);
+ if (unpackd->symbol_size > 256)
+ maybe_errx("Bad symbol table");
+
+ /* Allocate for the symbol table, point symbol_eob at the beginning */
+ unpackd->symbol_eob = unpackd->symbol = calloc(1, unpackd->symbol_size);
+ if (unpackd->symbol == NULL)
+ maybe_err("calloc");
+
+ /*
+ * Read in the symbol table, which contain [2, 256] symbols.
+ * In order to fit the count in one byte, pack(1) would offset
+ * it by reducing 2 from the actual number from the last level.
+ *
+ * We adjust the last level's symbol count by 1 here, because
+ * the EOB symbol is not being transmitted explicitly. Another
+ * adjustment would be done later afterward.
+ */
+ unpackd->symbolsin[unpackd->treelevels]++;
+ for (i = 0; i <= unpackd->treelevels; i++) {
+ unpackd->tree[i] = unpackd->symbol_eob;
+ for (j = 0; j < unpackd->symbolsin[i]; j++) {
+ if ((thisbyte = fgetc(unpackd->fpIn)) == EOF)
+ maybe_errx("Symbol table truncated");
+ *unpackd->symbol_eob++ = (char)thisbyte;
+ }
+ accepted_bytes(bytes_in, unpackd->symbolsin[i]);
+ }
+
+ /* Now, take account for the EOB symbol as well */
+ unpackd->symbolsin[unpackd->treelevels]++;
+
+ /*
+ * The symbolsin table has been constructed now.
+ * Calculate the internal nodes count table based on it.
+ */
+ unpackd_fill_inodesin(unpackd, 0);
+}
+
+/*
+ * Decode huffman stream, based on the huffman tree.
+ */
+static void
+unpack_decode(const unpack_descriptor_t *unpackd, off_t *bytes_in)
+{
+ int thislevel, thiscode, thisbyte, inlevelindex;
+ int i;
+ off_t bytes_out = 0;
+ const char *thissymbol; /* The symbol pointer decoded from stream */
+
+ /*
+ * Decode huffman. Fetch every bytes from the file, get it
+ * into 'thiscode' bit-by-bit, then output the symbol we got
+ * when one has been found.
+ *
+ * Assumption: sizeof(int) > ((max tree levels + 1) / 8).
+ * bad things could happen if not.
+ */
+ thislevel = 0;
+ thiscode = thisbyte = 0;
+
+ while ((thisbyte = fgetc(unpackd->fpIn)) != EOF) {
+ accepted_bytes(bytes_in, 1);
+
+ /*
+ * Split one bit from thisbyte, from highest to lowest,
+ * feed the bit into thiscode, until we got a symbol from
+ * the tree.
+ */
+ for (i = 7; i >= 0; i--) {
+ thiscode = (thiscode << 1) | ((thisbyte >> i) & 1);
+
+ /* Did we got a symbol? (referencing leaf node) */
+ if (thiscode >= unpackd->inodesin[thislevel]) {
+ inlevelindex =
+ thiscode - unpackd->inodesin[thislevel];
+ if (inlevelindex > unpackd->symbolsin[thislevel])
+ maybe_errx("File corrupt");
+
+ thissymbol =
+ &(unpackd->tree[thislevel][inlevelindex]);
+ if ((thissymbol == unpackd->symbol_eob) &&
+ (bytes_out == unpackd->uncompressed_size))
+ goto finished;
+
+ fputc((*thissymbol), unpackd->fpOut);
+ bytes_out++;
+
+ /* Prepare for next input */
+ thislevel = 0; thiscode = 0;
+ } else {
+ thislevel++;
+ if (thislevel > unpackd->treelevels)
+ maybe_errx("File corrupt");
+ }
+ }
+ }
+
+finished:
+ if (bytes_out != unpackd->uncompressed_size)
+ maybe_errx("Premature EOF");
+}
+
+/* Handler for pack(1)'ed file */
+static off_t
+unpack(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
+{
+ unpack_descriptor_t unpackd;
+
+ in = dup(in);
+ if (in == -1)
+ maybe_err("dup");
+ out = dup(out);
+ if (out == -1)
+ maybe_err("dup");
+
+ unpack_parse_header(in, out, pre, prelen, bytes_in, &unpackd);
+ unpack_decode(&unpackd, bytes_in);
+ unpack_descriptor_fini(&unpackd);
+
+ /* If we reached here, the unpack was successful */
+ return (unpackd.uncompressed_size);
+}
+
diff --git a/usr.bin/gzip/unxz.c b/usr.bin/gzip/unxz.c
new file mode 100644
index 0000000..c8a0a53
--- /dev/null
+++ b/usr.bin/gzip/unxz.c
@@ -0,0 +1,153 @@
+/* $NetBSD: unxz.c,v 1.5 2011/09/30 01:32:21 christos Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <stdarg.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <lzma.h>
+
+static off_t
+unxz(int i, int o, char *pre, size_t prelen, off_t *bytes_in)
+{
+ lzma_stream strm = LZMA_STREAM_INIT;
+ static const int flags = LZMA_TELL_UNSUPPORTED_CHECK|LZMA_CONCATENATED;
+ lzma_ret ret;
+ lzma_action action = LZMA_RUN;
+ off_t bytes_out, bp;
+ uint8_t ibuf[BUFSIZ];
+ uint8_t obuf[BUFSIZ];
+
+ if (bytes_in == NULL)
+ bytes_in = &bp;
+
+ strm.next_in = ibuf;
+ memcpy(ibuf, pre, prelen);
+ strm.avail_in = read(i, ibuf + prelen, sizeof(ibuf) - prelen);
+ if (strm.avail_in == (size_t)-1)
+ maybe_err("read failed");
+ strm.avail_in += prelen;
+ *bytes_in = strm.avail_in;
+
+ if ((ret = lzma_stream_decoder(&strm, UINT64_MAX, flags)) != LZMA_OK)
+ maybe_errx("Can't initialize decoder (%d)", ret);
+
+ strm.next_out = NULL;
+ strm.avail_out = 0;
+ if ((ret = lzma_code(&strm, LZMA_RUN)) != LZMA_OK)
+ maybe_errx("Can't read headers (%d)", ret);
+
+ bytes_out = 0;
+ strm.next_out = obuf;
+ strm.avail_out = sizeof(obuf);
+
+ for (;;) {
+ if (strm.avail_in == 0) {
+ strm.next_in = ibuf;
+ strm.avail_in = read(i, ibuf, sizeof(ibuf));
+ switch (strm.avail_in) {
+ case (size_t)-1:
+ maybe_err("read failed");
+ /*NOTREACHED*/
+ case 0:
+ action = LZMA_FINISH;
+ break;
+ default:
+ *bytes_in += strm.avail_in;
+ break;
+ }
+ }
+
+ ret = lzma_code(&strm, action);
+
+ // Write and check write error before checking decoder error.
+ // This way as much data as possible gets written to output
+ // even if decoder detected an error.
+ if (strm.avail_out == 0 || ret != LZMA_OK) {
+ const size_t write_size = sizeof(obuf) - strm.avail_out;
+
+ if (write(o, obuf, write_size) != (ssize_t)write_size)
+ maybe_err("write failed");
+
+ strm.next_out = obuf;
+ strm.avail_out = sizeof(obuf);
+ bytes_out += write_size;
+ }
+
+ if (ret != LZMA_OK) {
+ if (ret == LZMA_STREAM_END) {
+ // Check that there's no trailing garbage.
+ if (strm.avail_in != 0 || read(i, ibuf, 1))
+ ret = LZMA_DATA_ERROR;
+ else {
+ lzma_end(&strm);
+ return bytes_out;
+ }
+ }
+
+ const char *msg;
+ switch (ret) {
+ case LZMA_MEM_ERROR:
+ msg = strerror(ENOMEM);
+ break;
+
+ case LZMA_FORMAT_ERROR:
+ msg = "File format not recognized";
+ break;
+
+ case LZMA_OPTIONS_ERROR:
+ // FIXME: Better message?
+ msg = "Unsupported compression options";
+ break;
+
+ case LZMA_DATA_ERROR:
+ msg = "File is corrupt";
+ break;
+
+ case LZMA_BUF_ERROR:
+ msg = "Unexpected end of input";
+ break;
+
+ case LZMA_MEMLIMIT_ERROR:
+ msg = "Reached memory limit";
+ break;
+
+ default:
+ maybe_errx("Unknown error (%d)", ret);
+ break;
+ }
+ maybe_errx("%s", msg);
+
+ }
+ }
+}
diff --git a/usr.bin/gzip/zdiff b/usr.bin/gzip/zdiff
new file mode 100644
index 0000000..9e9aca6
--- /dev/null
+++ b/usr.bin/gzip/zdiff
@@ -0,0 +1,142 @@
+#!/bin/sh -
+#
+# $NetBSD: zdiff,v 1.5 2010/04/14 20:30:28 joerg Exp $
+#
+# $OpenBSD: zdiff,v 1.2 2003/07/29 07:42:44 otto Exp $
+#
+#-
+# Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+# Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.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.
+#
+# Sponsored in part by the Defense Advanced Research Projects
+# Agency (DARPA) and Air Force Research Laboratory, Air Force
+# Materiel Command, USAF, under agreement number F39502-99-1-0512.
+#
+# $FreeBSD$
+
+# Set $prog based on $0
+case $0 in
+ *cmp) prog=cmp
+ ;;
+ *) prog=diff
+ ;;
+esac
+USAGE="usage: $0 [options] file1 [file2]"
+
+check_suffix() {
+ case "$1" in
+ *[._-][Zz])
+ setvar $2 "${1%??}"
+ setvar $3 "gzip -cdqf"
+ ;;
+ *[._-]bz)
+ setvar $2 "${1%???}"
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *[._-]gz)
+ setvar $2 "${1%???}"
+ setvar $3 "gzip -cdqf"
+ ;;
+ *[._-]xz)
+ setvar $2 "${1%???}"
+ setvar $3 "xz -cdqf"
+ ;;
+ *[._-]bz2)
+ setvar $2 "${1%????}"
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *[._-]lzma)
+ setvar $2 "${1%?????}"
+ setvar $3 "xz -cdqf"
+ ;;
+ *.t[ag]z)
+ setvar $2 "${1%??}"ar
+ setvar $3 "gzip -cdqf"
+ ;;
+ *.tbz)
+ setvar $2 "${1%??}"ar
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *.tbz2)
+ setvar $2 "${1%???}"ar
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *.t[lx]z)
+ setvar $2 "${1%??}"ar
+ setvar $3 "xz -cdqf"
+ ;;
+ *)
+ setvar $2 "$1"
+ setvar $3 ""
+ ;;
+ esac
+}
+
+
+# Pull out any command line flags so we can pass them to diff/cmp
+# XXX - assumes there is no optarg
+flags=
+while test $# -ne 0; do
+ case "$1" in
+ --)
+ shift
+ break
+ ;;
+ -)
+ break
+ ;;
+ -*)
+ flags="$flags $1"
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+if [ $# -eq 1 ]; then
+ # One file given, compare compressed to uncompressed
+ files="$1"
+ check_suffix "$1" files filt
+ if [ -z "$filt" ]; then
+ echo "z$prog: unknown suffix" 1>&2
+ exit 1
+ fi
+ $filt -- "$1" | $prog $flags -- - "$files"
+ status=$?
+elif [ $# -eq 2 ]; then
+ # Two files given, compare the two uncompressing as needed
+ check_suffix "$1" files filt
+ check_suffix "$2" files2 filt2
+ if [ -z "$filt" -a -z "$filt2" ]; then
+ $prog $flags -- "$1" "$2"
+ elif [ -z "$filt" -a -n "$filt2" -a "$1" != "-" ]; then
+ $filt2 -- "$2" | $prog $flags -- "$1" -
+ elif [ -n "$filt" -a -z "$filt2" -a "$2" != "-" ]; then
+ $filt -- "$1" | $prog $flags -- - "$2"
+ else
+ tmp=`mktemp -t z$prog.XXXXXXXXXX` || exit 1
+ trap "rm -f $tmp" 0 1 2 3 13 15
+ ${filt2:-cat} -- "$2" > $tmp || exit $?
+ ${filt:-cat} -- "$1" | $prog $flags -- - "$tmp"
+ fi
+ status=$?
+else
+ echo "$USAGE" 1>&2
+ exit 1
+fi
+
+exit $status
diff --git a/usr.bin/gzip/zdiff.1 b/usr.bin/gzip/zdiff.1
new file mode 100644
index 0000000..52b5fbd
--- /dev/null
+++ b/usr.bin/gzip/zdiff.1
@@ -0,0 +1,142 @@
+.\" $NetBSD: zdiff.1,v 1.5 2010/04/14 19:52:05 wiz Exp $
+.\" $OpenBSD: zdiff.1,v 1.2 2003/07/13 17:39:14 millert Exp $
+.\"
+.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.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.
+.\"
+.\" Sponsored in part by the Defense Advanced Research Projects
+.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
+.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
+.\"
+.\" $FreeBSD$
+.Dd May 23, 2011
+.Dt ZDIFF 1
+.Os
+.Sh NAME
+.Nm zcmp ,
+.Nm zdiff
+.Nd compare compressed files
+.Sh SYNOPSIS
+.Nm zcmp
+.Op Ar options
+.Ar file
+.Op Ar file2
+.Nm zdiff
+.Op Ar options
+.Ar file
+.Op Ar file2
+.Sh DESCRIPTION
+.Nm zcmp
+and
+.Nm zdiff
+are filters that invoke
+.Xr cmp 1
+or
+.Xr diff 1
+respectively to compare compressed files.
+Any
+.Ar options
+that are specified are passed to
+.Xr cmp 1
+or
+.Xr diff 1 .
+.Pp
+If only
+.Ar file1
+is specified, it is compared against a file with the same name, but
+with the extension removed.
+When both
+.Ar file1
+or
+.Ar file2
+are specified, either file may be compressed.
+.Pp
+Extensions handled by
+.Xr gzip 1 :
+.Bl -bullet -compact
+.It
+z, Z,
+.It
+gz,
+.It
+taz,
+.It
+tgz.
+.El
+.Pp
+Extensions handled by
+.Xr bzip2 1 :
+.Bl -bullet -compact
+.It
+bz,
+.It
+bz2,
+.It
+tbz,
+.It
+tbz2.
+.El
+.Pp
+Extensions handled by
+.Xr xz 1 :
+.Bl -bullet -compact
+.It
+lzma,
+.It
+xz,
+.It
+tlz,
+.It
+txz.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width "TMPDIR"
+.It Ev TMPDIR
+Directory in which to place temporary files.
+If unset,
+.Pa /tmp
+is used.
+.El
+.Sh FILES
+.Bl -tag -width "/tmp/zdiff.XXXXXXXXXX" -compact
+.It Pa /tmp/zcmp.XXXXXXXXXX
+Temporary file for
+.Nm zcmp .
+.It Pa /tmp/zdiff.XXXXXXXXXX
+Temporary file for
+.Nm zdiff .
+.El
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr cmp 1 ,
+.Xr diff 1 ,
+.Xr gzip 1 ,
+.Xr xz 1
+.Sh CAVEATS
+.Nm zcmp
+and
+.Nm zdiff
+rely solely on the file extension to determine what is, or is not,
+a compressed file.
+Consequently, the following are not supported as arguments:
+.Bl -dash
+.It
+directories
+.It
+device special files
+.It
+filenames indicating the standard input
+.Pq Dq \-
+.El
diff --git a/usr.bin/gzip/zforce b/usr.bin/gzip/zforce
new file mode 100644
index 0000000..3b7324c
--- /dev/null
+++ b/usr.bin/gzip/zforce
@@ -0,0 +1,55 @@
+#!/bin/sh -
+#
+# $NetBSD: zforce,v 1.2 2003/12/28 12:43:43 wiz Exp $
+# $OpenBSD: zforce,v 1.2 2003/08/05 18:22:17 deraadt Exp $
+#
+#-
+# Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+#
+# 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.
+#
+# $FreeBSD$
+prog=`basename $0`
+USAGE="usage: $prog file ..."
+if test $# -eq 0; then
+ echo $USAGE
+ exit 1
+fi
+
+ret=0
+
+while test $# -ne 0; do
+ case "$1" in
+ *[._-]gz)
+ shift
+ ;;
+ *.t[ag]z)
+ shift
+ ;;
+ *)
+ if file "$1" |
+ grep -q "gzip compressed data" 2> /dev/null
+ then
+ n="$1".gz
+ if mv "$1" "$n" 2> /dev/null; then
+ echo "$1" -- renamed to "$n"
+ else
+ ret=1
+ echo $prog: cannot rename "$1" to "$n"
+ fi
+ fi
+ shift
+ ;;
+ esac
+done
+exit $ret
diff --git a/usr.bin/gzip/zforce.1 b/usr.bin/gzip/zforce.1
new file mode 100644
index 0000000..efcc421
--- /dev/null
+++ b/usr.bin/gzip/zforce.1
@@ -0,0 +1,53 @@
+.\" $NetBSD: zforce.1,v 1.2 2003/12/28 12:43:43 wiz Exp $
+.\" $OpenBSD: zforce.1,v 1.1 2003/07/29 11:50:09 otto Exp $
+.\"
+.\" Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.Dd January 26, 2007
+.Dt ZFORCE 1
+.Os
+.Sh NAME
+.Nm zforce
+.Nd force gzip files to have a .gz suffix
+.Sh SYNOPSIS
+.Nm zforce
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility renames
+.Xr gzip 1
+files to have a
+.Sq .gz
+suffix, so that
+.Xr gzip 1
+will not compress them twice.
+This can be useful if file names were truncated during a file transfer.
+Files that have an existing
+.Sq .gz ,
+.Sq -gz ,
+.Sq _gz ,
+.Sq .tgz
+or
+.Sq .taz
+suffix, or that have not been compressed by
+.Xr gzip 1 ,
+are ignored.
+.Sh SEE ALSO
+.Xr gzip 1
+.Sh CAVEATS
+.Nm
+overwrites existing files without warning.
diff --git a/usr.bin/gzip/zmore b/usr.bin/gzip/zmore
new file mode 100644
index 0000000..f5be0f4
--- /dev/null
+++ b/usr.bin/gzip/zmore
@@ -0,0 +1,82 @@
+#!/bin/sh -
+#
+# $NetBSD: zmore,v 1.5 2013/12/06 13:33:15 pettai Exp $
+#
+# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $
+#
+#-
+# Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+#
+# 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.
+#
+# Sponsored in part by the Defense Advanced Research Projects
+# Agency (DARPA) and Air Force Research Laboratory, Air Force
+# Materiel Command, USAF, under agreement number F39502-99-1-0512.
+#
+# $FreeBSD$
+
+# Pull out any command line flags so we can pass them to more/less
+flags=
+while test $# -ne 0; do
+ case "$1" in
+ --)
+ shift
+ break
+ ;;
+ -*)
+ flags="$flags $1"
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+if [ `basename $0` = "zless" ] ; then
+ pager=${PAGER-less}
+else
+ pager=${PAGER-more}
+fi
+
+# No files means read from stdin
+if [ $# -eq 0 ]; then
+ gzip -cdfq 2>&1 | $pager $flags
+ exit 0
+fi
+
+oterm=`stty -g 2>/dev/null`
+while test $# -ne 0; do
+ gzip -cdfq "$1" 2>&1 | $pager $flags
+ prev="$1"
+ shift
+ if tty -s && test -n "$oterm" -a $# -gt 0; then
+ #echo -n "--More--(Next file: $1)"
+ echo -n "$prev (END) - Next: $1 "
+ trap "stty $oterm 2>/dev/null" 0 1 2 3 13 15
+ stty cbreak -echo 2>/dev/null
+ REPLY=`dd bs=1 count=1 2>/dev/null`
+ stty $oterm 2>/dev/null
+ trap - 0 1 2 3 13 15
+ echo
+ case "$REPLY" in
+ s)
+ shift
+ ;;
+ e|q)
+ break
+ ;;
+ esac
+ fi
+done
+exit 0
diff --git a/usr.bin/gzip/zmore.1 b/usr.bin/gzip/zmore.1
new file mode 100644
index 0000000..f8be1ac
--- /dev/null
+++ b/usr.bin/gzip/zmore.1
@@ -0,0 +1,110 @@
+.\" $NetBSD: zmore.1,v 1.4 2013/11/12 21:58:37 pettai Exp $
+.\" $OpenBSD: zmore.1,v 1.10 2009/08/16 09:41:08 sobrado Exp $
+.\"
+.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+.\"
+.\" 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.
+.\"
+.\" Sponsored in part by the Defense Advanced Research Projects
+.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
+.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
+.\"
+.\" $FreeBSD$
+.Dd October 22, 2014
+.Dt ZMORE 1
+.Os
+.Sh NAME
+.Nm zmore ,
+.Nm zless
+.Nd view compressed files
+.Sh SYNOPSIS
+.Nm zmore
+.Op Ar flags
+.Op Ar
+.Nm zless
+.Op Ar flags
+.Op Ar
+.Sh DESCRIPTION
+.Nm
+is a filter that allows the viewing of files compressed with Lempel-Ziv
+encoding.
+Such files generally have a
+.Dq Z
+or
+.Dq gz
+extension (both the
+.Xr compress 1
+and
+.Xr gzip 1
+formats are supported).
+Any
+.Ar flags
+that are specified are passed to the user's preferred
+.Ev PAGER
+(which is
+.Pa /usr/bin/more
+by default).
+.Pp
+.Nm zless
+is equivalent to
+.Nm zmore
+but uses
+.Xr less 1
+as a pager instead of
+.Xr more 1 .
+.Pp
+When multiple files are specified,
+.Nm
+will pause at the end of each file and present the following prompt to the user:
+.Bd -literal -offset indent
+prev_file (END) - Next: next_file
+.Ed
+.Pp
+Where
+.Sy prev_file
+is the file that was just displayed and
+.Sy next_file
+is the next file to be displayed.
+The following keys are recognized at the prompt:
+.Bl -tag -width "e or q" -offset indent
+.It Ic e No or Ic q
+quit
+.Nm zmore .
+.It Ic s
+skip the next file (or exit if the next file is the last).
+.El
+.Pp
+If no files are specified,
+.Nm
+will read from the standard input.
+In this mode
+.Nm
+will assume
+.Xr gzip 1
+style compression since there is no suffix on which to make a decision.
+.Sh ENVIRONMENT
+.Bl -tag -width "PAGER"
+.It Ev PAGER
+Program used to display files.
+If unset,
+.Pa /usr/bin/more
+is used
+.Pq Nm zmore
+or
+.Pa /usr/bin/less
+.Pq Nm zless .
+.El
+.Sh SEE ALSO
+.Xr compress 1 ,
+.Xr less 1 ,
+.Xr more 1
diff --git a/usr.bin/gzip/znew b/usr.bin/gzip/znew
new file mode 100644
index 0000000..27bed94
--- /dev/null
+++ b/usr.bin/gzip/znew
@@ -0,0 +1,137 @@
+#!/bin/sh -
+#
+# $NetBSD: znew,v 1.3 2008/04/27 09:07:13 nakayama Exp $
+# $OpenBSD: znew,v 1.2 2003/08/05 18:22:17 deraadt Exp $
+#
+#-
+# Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+#
+# 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.
+#
+# $FreeBSD$
+
+# Return 0 if the first arg file size is smaller than the second, 1 otherwise.
+smaller () {
+ a=`du -k "$1" | awk '{ print $1 }'`
+ b=`du -k "$2" | awk '{ print $1 }'`
+ test $a -lt $b
+}
+
+# Check gzip integrity if the -t flag is specified
+checkfile () {
+ if test $tflag -eq 1; then
+ gzip -qt < "$1"
+ fi
+}
+
+# Decompress a file and then gzip it
+process () {
+ prefix="${1%.Z}"
+ filez="$prefix".Z
+ filegz="$prefix".gz
+
+ if test ! -e "$filez"; then
+ echo "$prog: $filez does not exist"
+ return 1
+ fi
+ if test ! -f "$filez"; then
+ echo "$prog: $filez is not a regular file"
+ return 1
+ fi
+ if test -e "$filegz" -a $fflag -eq 0; then
+ echo "$prog: $filegz already exists"
+ return 1
+ fi
+
+ tmp=`mktemp /tmp/znewXXXXXXXXXX` || {
+ echo "$prog: cannot create tmp file"
+ return 1
+ }
+ trap 'rm -f "$tmp"; exit 1' HUP INT QUIT PIPE TERM
+
+ # Do the actual work, producing a file "$tmp"
+ if uncompress -f -c < "$filez" | gzip -f -c $gzipflags > "$tmp"; then
+ if test $kflag -eq 1 && smaller "$filez" "$tmp"; then
+ echo -n "$prog: $filez is smaller than $filegz"
+ echo "; keeping it"
+ rm -f "$tmp"
+ return 0
+ fi
+ if ! checkfile "$tmp"; then
+ echo "$prog: integrity check of $tmp failed"
+ rm -f "$tmp"
+ return 1;
+ fi
+
+ # Try to keep the mode of the original file
+ if ! cp -fp "$filez" "$filegz"; then
+ echo "$prog: warning: could not keep mode of $filez"
+ fi
+ if ! cp "$tmp" "$filegz" 2> /dev/null; then
+ echo "$prog: warning: could not keep mode of $filez"
+ if ! cp -f "$tmp" "$filegz" 2> /dev/null; then
+ echo "$prog: could not copy $tmp to $filegz"
+ rm -f "$filegz" "$tmp"
+ return 1
+ fi
+ fi
+ if ! touch -fr "$filez" "$filegz"; then
+ echo -n "$prog: warning: could not keep timestamp of "
+ echo "$filez"
+ fi
+ rm -f "$filez" "$tmp"
+ else
+ echo "$prog: failed to process $filez"
+ rm -f "$tmp"
+ return 1
+ fi
+}
+
+prog=`basename "$0"`
+usage="usage: $prog [-ftv9K] file ..."
+
+fflag=0
+tflag=0
+kflag=0
+gzipflags=
+
+# -P flag is recognized to maintain compatibility, but ignored. Pipe mode is
+# always used
+while getopts :ftv9PK i; do
+ case $i in
+ f) fflag=1;;
+ t) tflag=1;;
+ v) gzipflags="-v $gzipflags";;
+ 9) gzipflags="-9 $gzipflags";;
+ P) ;;
+ K) kflag=1;;
+ \?) echo "$usage"; exit 1;;
+ esac
+done
+
+shift $((OPTIND - 1))
+
+if test $# -eq 0; then
+ echo "$usage"
+ exit 1
+fi
+
+rc=0
+
+while test $# -ne 0; do
+ if ! process "$1"; then
+ rc=$?
+ fi
+ shift
+done
+exit $rc
diff --git a/usr.bin/gzip/znew.1 b/usr.bin/gzip/znew.1
new file mode 100644
index 0000000..0da5a62
--- /dev/null
+++ b/usr.bin/gzip/znew.1
@@ -0,0 +1,71 @@
+.\" $NetBSD: znew.1,v 1.2 2003/12/28 12:43:43 wiz Exp $
+.\" $OpenBSD: znew.1,v 1.1 2003/08/02 20:52:50 otto Exp $
+.\"
+.\" Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.Dd January 26, 2007
+.Dt ZNEW 1
+.Os
+.Sh NAME
+.Nm znew
+.Nd convert compressed files to gzipped files
+.Sh SYNOPSIS
+.Nm
+.Op Fl ftv9K
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility uncompresses files compressed by
+.Xr compress 1
+and recompresses them with
+.Xr gzip 1 .
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl f
+Overwrite existing
+.Sq .gz
+files.
+Unless this option is specified,
+.Nm
+refuses to overwrite existing files.
+.It Fl t
+Test integrity of the gzipped file before deleting the original file.
+If the integrity check fails, the original
+.Sq .Z
+file is not removed.
+.It Fl v
+Print a report specifying the achieved compression ratios.
+.It Fl 9
+Use the -9 mode of
+.Xr gzip 1 ,
+achieving better compression at the cost of slower execution.
+.It Fl K
+Keep the original
+.Sq .Z
+file if it uses less disk blocks than the gzipped one.
+A disk block is 1024 bytes.
+.El
+.Sh SEE ALSO
+.Xr gzip 1
+.Sh CAVEATS
+The
+.Nm
+utility tries to maintain the file mode of the original file.
+If the original file is not writable, it is not able to do that and
+.Nm
+will print a warning.
diff --git a/usr.bin/gzip/zuncompress.c b/usr.bin/gzip/zuncompress.c
new file mode 100644
index 0000000..6069cae
--- /dev/null
+++ b/usr.bin/gzip/zuncompress.c
@@ -0,0 +1,396 @@
+/* $NetBSD: zuncompress.c,v 1.11 2011/08/16 13:55:02 joerg Exp $ */
+
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * 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. 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.
+ *
+ * from: NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp
+ * $FreeBSD$
+ */
+
+/* This file is #included by gzip.c */
+
+static int zread(void *, char *, int);
+
+#define tab_prefixof(i) (zs->zs_codetab[i])
+#define tab_suffixof(i) ((char_type *)(zs->zs_htab))[i]
+#define de_stack ((char_type *)&tab_suffixof(1 << BITS))
+
+#define BITS 16 /* Default bits. */
+#define HSIZE 69001 /* 95% occupancy */ /* XXX may not need HSIZE */
+#define BIT_MASK 0x1f /* Defines for third byte of header. */
+#define BLOCK_MASK 0x80
+#define CHECK_GAP 10000 /* Ratio check interval. */
+#define BUFSIZE (64 * 1024)
+
+/*
+ * Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is
+ * a fourth header byte (for expansion).
+ */
+#define INIT_BITS 9 /* Initial number of bits/code. */
+
+/*
+ * the next two codes should not be changed lightly, as they must not
+ * lie within the contiguous general code space.
+ */
+#define FIRST 257 /* First free entry. */
+#define CLEAR 256 /* Table clear output code. */
+
+
+#define MAXCODE(n_bits) ((1 << (n_bits)) - 1)
+
+typedef long code_int;
+typedef long count_int;
+typedef u_char char_type;
+
+static char_type magic_header[] =
+ {'\037', '\235'}; /* 1F 9D */
+
+static char_type rmask[9] =
+ {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
+
+static off_t total_compressed_bytes;
+static size_t compressed_prelen;
+static char *compressed_pre;
+
+struct s_zstate {
+ FILE *zs_fp; /* File stream for I/O */
+ char zs_mode; /* r or w */
+ enum {
+ S_START, S_MIDDLE, S_EOF
+ } zs_state; /* State of computation */
+ int zs_n_bits; /* Number of bits/code. */
+ int zs_maxbits; /* User settable max # bits/code. */
+ code_int zs_maxcode; /* Maximum code, given n_bits. */
+ code_int zs_maxmaxcode; /* Should NEVER generate this code. */
+ count_int zs_htab [HSIZE];
+ u_short zs_codetab [HSIZE];
+ code_int zs_hsize; /* For dynamic table sizing. */
+ code_int zs_free_ent; /* First unused entry. */
+ /*
+ * Block compression parameters -- after all codes are used up,
+ * and compression rate changes, start over.
+ */
+ int zs_block_compress;
+ int zs_clear_flg;
+ long zs_ratio;
+ count_int zs_checkpoint;
+ int zs_offset;
+ long zs_in_count; /* Length of input. */
+ long zs_bytes_out; /* Length of compressed output. */
+ long zs_out_count; /* # of codes output (for debugging). */
+ char_type zs_buf[BITS];
+ union {
+ struct {
+ long zs_fcode;
+ code_int zs_ent;
+ code_int zs_hsize_reg;
+ int zs_hshift;
+ } w; /* Write parameters */
+ struct {
+ char_type *zs_stackp;
+ int zs_finchar;
+ code_int zs_code, zs_oldcode, zs_incode;
+ int zs_roffset, zs_size;
+ char_type zs_gbuf[BITS];
+ } r; /* Read parameters */
+ } u;
+};
+
+static code_int getcode(struct s_zstate *zs);
+
+static off_t
+zuncompress(FILE *in, FILE *out, char *pre, size_t prelen,
+ off_t *compressed_bytes)
+{
+ off_t bin, bout = 0;
+ char *buf;
+
+ buf = malloc(BUFSIZE);
+ if (buf == NULL)
+ return -1;
+
+ /* XXX */
+ compressed_prelen = prelen;
+ if (prelen != 0)
+ compressed_pre = pre;
+ else
+ compressed_pre = NULL;
+
+ while ((bin = fread(buf, 1, BUFSIZE, in)) != 0) {
+ if (tflag == 0 && (off_t)fwrite(buf, 1, bin, out) != bin) {
+ free(buf);
+ return -1;
+ }
+ bout += bin;
+ }
+
+ if (compressed_bytes)
+ *compressed_bytes = total_compressed_bytes;
+
+ free(buf);
+ return bout;
+}
+
+static int
+zclose(void *zs)
+{
+ free(zs);
+ /* We leave the caller to close the fd passed to zdopen() */
+ return 0;
+}
+
+FILE *
+zdopen(int fd)
+{
+ struct s_zstate *zs;
+
+ if ((zs = calloc(1, sizeof(struct s_zstate))) == NULL)
+ return (NULL);
+
+ zs->zs_state = S_START;
+
+ /* XXX we can get rid of some of these */
+ zs->zs_hsize = HSIZE; /* For dynamic table sizing. */
+ zs->zs_free_ent = 0; /* First unused entry. */
+ zs->zs_block_compress = BLOCK_MASK;
+ zs->zs_clear_flg = 0; /* XXX we calloc()'d this structure why = 0? */
+ zs->zs_ratio = 0;
+ zs->zs_checkpoint = CHECK_GAP;
+ zs->zs_in_count = 1; /* Length of input. */
+ zs->zs_out_count = 0; /* # of codes output (for debugging). */
+ zs->u.r.zs_roffset = 0;
+ zs->u.r.zs_size = 0;
+
+ /*
+ * Layering compress on top of stdio in order to provide buffering,
+ * and ensure that reads and write work with the data specified.
+ */
+ if ((zs->zs_fp = fdopen(fd, "r")) == NULL) {
+ free(zs);
+ return NULL;
+ }
+
+ return funopen(zs, zread, NULL, NULL, zclose);
+}
+
+/*
+ * Decompress read. This routine adapts to the codes in the file building
+ * the "string" table on-the-fly; requiring no table to be stored in the
+ * compressed file. The tables used herein are shared with those of the
+ * compress() routine. See the definitions above.
+ */
+static int
+zread(void *cookie, char *rbp, int num)
+{
+ u_int count, i;
+ struct s_zstate *zs;
+ u_char *bp, header[3];
+
+ if (num == 0)
+ return (0);
+
+ zs = cookie;
+ count = num;
+ bp = (u_char *)rbp;
+ switch (zs->zs_state) {
+ case S_START:
+ zs->zs_state = S_MIDDLE;
+ break;
+ case S_MIDDLE:
+ goto middle;
+ case S_EOF:
+ goto eof;
+ }
+
+ /* Check the magic number */
+ for (i = 0; i < 3 && compressed_prelen; i++, compressed_prelen--)
+ header[i] = *compressed_pre++;
+
+ if (fread(header + i, 1, sizeof(header) - i, zs->zs_fp) !=
+ sizeof(header) - i ||
+ memcmp(header, magic_header, sizeof(magic_header)) != 0) {
+ errno = EFTYPE;
+ return (-1);
+ }
+ total_compressed_bytes = 0;
+ zs->zs_maxbits = header[2]; /* Set -b from file. */
+ zs->zs_block_compress = zs->zs_maxbits & BLOCK_MASK;
+ zs->zs_maxbits &= BIT_MASK;
+ zs->zs_maxmaxcode = 1L << zs->zs_maxbits;
+ if (zs->zs_maxbits > BITS || zs->zs_maxbits < 12) {
+ errno = EFTYPE;
+ return (-1);
+ }
+ /* As above, initialize the first 256 entries in the table. */
+ zs->zs_maxcode = MAXCODE(zs->zs_n_bits = INIT_BITS);
+ for (zs->u.r.zs_code = 255; zs->u.r.zs_code >= 0; zs->u.r.zs_code--) {
+ tab_prefixof(zs->u.r.zs_code) = 0;
+ tab_suffixof(zs->u.r.zs_code) = (char_type) zs->u.r.zs_code;
+ }
+ zs->zs_free_ent = zs->zs_block_compress ? FIRST : 256;
+
+ zs->u.r.zs_oldcode = -1;
+ zs->u.r.zs_stackp = de_stack;
+
+ while ((zs->u.r.zs_code = getcode(zs)) > -1) {
+
+ if ((zs->u.r.zs_code == CLEAR) && zs->zs_block_compress) {
+ for (zs->u.r.zs_code = 255; zs->u.r.zs_code >= 0;
+ zs->u.r.zs_code--)
+ tab_prefixof(zs->u.r.zs_code) = 0;
+ zs->zs_clear_flg = 1;
+ zs->zs_free_ent = FIRST;
+ zs->u.r.zs_oldcode = -1;
+ continue;
+ }
+ zs->u.r.zs_incode = zs->u.r.zs_code;
+
+ /* Special case for KwKwK string. */
+ if (zs->u.r.zs_code >= zs->zs_free_ent) {
+ if (zs->u.r.zs_code > zs->zs_free_ent ||
+ zs->u.r.zs_oldcode == -1) {
+ /* Bad stream. */
+ errno = EINVAL;
+ return (-1);
+ }
+ *zs->u.r.zs_stackp++ = zs->u.r.zs_finchar;
+ zs->u.r.zs_code = zs->u.r.zs_oldcode;
+ }
+ /*
+ * The above condition ensures that code < free_ent.
+ * The construction of tab_prefixof in turn guarantees that
+ * each iteration decreases code and therefore stack usage is
+ * bound by 1 << BITS - 256.
+ */
+
+ /* Generate output characters in reverse order. */
+ while (zs->u.r.zs_code >= 256) {
+ *zs->u.r.zs_stackp++ = tab_suffixof(zs->u.r.zs_code);
+ zs->u.r.zs_code = tab_prefixof(zs->u.r.zs_code);
+ }
+ *zs->u.r.zs_stackp++ = zs->u.r.zs_finchar = tab_suffixof(zs->u.r.zs_code);
+
+ /* And put them out in forward order. */
+middle: do {
+ if (count-- == 0)
+ return (num);
+ *bp++ = *--zs->u.r.zs_stackp;
+ } while (zs->u.r.zs_stackp > de_stack);
+
+ /* Generate the new entry. */
+ if ((zs->u.r.zs_code = zs->zs_free_ent) < zs->zs_maxmaxcode &&
+ zs->u.r.zs_oldcode != -1) {
+ tab_prefixof(zs->u.r.zs_code) = (u_short) zs->u.r.zs_oldcode;
+ tab_suffixof(zs->u.r.zs_code) = zs->u.r.zs_finchar;
+ zs->zs_free_ent = zs->u.r.zs_code + 1;
+ }
+
+ /* Remember previous code. */
+ zs->u.r.zs_oldcode = zs->u.r.zs_incode;
+ }
+ zs->zs_state = S_EOF;
+eof: return (num - count);
+}
+
+/*-
+ * Read one code from the standard input. If EOF, return -1.
+ * Inputs:
+ * stdin
+ * Outputs:
+ * code or -1 is returned.
+ */
+static code_int
+getcode(struct s_zstate *zs)
+{
+ code_int gcode;
+ int r_off, bits, i;
+ char_type *bp;
+
+ bp = zs->u.r.zs_gbuf;
+ if (zs->zs_clear_flg > 0 || zs->u.r.zs_roffset >= zs->u.r.zs_size ||
+ zs->zs_free_ent > zs->zs_maxcode) {
+ /*
+ * If the next entry will be too big for the current gcode
+ * size, then we must increase the size. This implies reading
+ * a new buffer full, too.
+ */
+ if (zs->zs_free_ent > zs->zs_maxcode) {
+ zs->zs_n_bits++;
+ if (zs->zs_n_bits == zs->zs_maxbits) /* Won't get any bigger now. */
+ zs->zs_maxcode = zs->zs_maxmaxcode;
+ else
+ zs->zs_maxcode = MAXCODE(zs->zs_n_bits);
+ }
+ if (zs->zs_clear_flg > 0) {
+ zs->zs_maxcode = MAXCODE(zs->zs_n_bits = INIT_BITS);
+ zs->zs_clear_flg = 0;
+ }
+ /* XXX */
+ for (i = 0; i < zs->zs_n_bits && compressed_prelen; i++, compressed_prelen--)
+ zs->u.r.zs_gbuf[i] = *compressed_pre++;
+ zs->u.r.zs_size = fread(zs->u.r.zs_gbuf + i, 1, zs->zs_n_bits - i, zs->zs_fp);
+ zs->u.r.zs_size += i;
+ if (zs->u.r.zs_size <= 0) /* End of file. */
+ return (-1);
+ zs->u.r.zs_roffset = 0;
+
+ total_compressed_bytes += zs->u.r.zs_size;
+
+ /* Round size down to integral number of codes. */
+ zs->u.r.zs_size = (zs->u.r.zs_size << 3) - (zs->zs_n_bits - 1);
+ }
+ r_off = zs->u.r.zs_roffset;
+ bits = zs->zs_n_bits;
+
+ /* Get to the first byte. */
+ bp += (r_off >> 3);
+ r_off &= 7;
+
+ /* Get first part (low order bits). */
+ gcode = (*bp++ >> r_off);
+ bits -= (8 - r_off);
+ r_off = 8 - r_off; /* Now, roffset into gcode word. */
+
+ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+ if (bits >= 8) {
+ gcode |= *bp++ << r_off;
+ r_off += 8;
+ bits -= 8;
+ }
+
+ /* High order bits. */
+ gcode |= (*bp & rmask[bits]) << r_off;
+ zs->u.r.zs_roffset += zs->zs_n_bits;
+
+ return (gcode);
+}
+
diff --git a/usr.bin/head/Makefile b/usr.bin/head/Makefile
new file mode 100644
index 0000000..60b0a2f
--- /dev/null
+++ b/usr.bin/head/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= head
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/head/Makefile.depend b/usr.bin/head/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/head/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/head/head.1 b/usr.bin/head/head.1
new file mode 100644
index 0000000..dd12485
--- /dev/null
+++ b/usr.bin/head/head.1
@@ -0,0 +1,78 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)head.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 16, 2013
+.Dt HEAD 1
+.Os
+.Sh NAME
+.Nm head
+.Nd display first lines of a file
+.Sh SYNOPSIS
+.Nm
+.Op Fl n Ar count | Fl c Ar bytes
+.Op Ar
+.Sh DESCRIPTION
+This filter displays the first
+.Ar count
+lines or
+.Ar bytes
+of each of the specified files, or of the standard input if no
+files are specified.
+If
+.Ar count
+is omitted it defaults to 10.
+.Pp
+If more than a single file is specified, each file is preceded by a
+header consisting of the string
+.Dq ==> XXX <==
+where
+.Dq XXX
+is the name of the file.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+To display the first 500 lines of the file
+.Ar foo :
+.Pp
+.Dl $ head -n 500 foo
+.Pp
+.Nm
+can be used in conjunction with
+.Xr tail 1
+in the following way to, for example, display only line 500 from the file
+.Ar foo :
+.Pp
+.Dl $ head -n 500 foo | tail -n 1
+.Sh SEE ALSO
+.Xr tail 1
+.Sh HISTORY
+The
+.Nm
+command appeared in PWB UNIX.
diff --git a/usr.bin/head/head.c b/usr.bin/head/head.c
new file mode 100644
index 0000000..e1caa1f
--- /dev/null
+++ b/usr.bin/head/head.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 1980, 1987, 1992, 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, 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * head - give the first few lines of a stream or of each of a set of files
+ *
+ * Bill Joy UCB August 24, 1977
+ */
+
+static void head(FILE *, int);
+static void head_bytes(FILE *, off_t);
+static void obsolete(char *[]);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+ FILE *fp;
+ int first, linecnt = -1, eval = 0;
+ off_t bytecnt = -1;
+ char *ep;
+
+ obsolete(argv);
+ while ((ch = getopt(argc, argv, "n:c:")) != -1)
+ switch(ch) {
+ case 'c':
+ bytecnt = strtoimax(optarg, &ep, 10);
+ if (*ep || bytecnt <= 0)
+ errx(1, "illegal byte count -- %s", optarg);
+ break;
+ case 'n':
+ linecnt = strtol(optarg, &ep, 10);
+ if (*ep || linecnt <= 0)
+ errx(1, "illegal line count -- %s", optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (linecnt != -1 && bytecnt != -1)
+ errx(1, "can't combine line and byte counts");
+ if (linecnt == -1 )
+ linecnt = 10;
+ if (*argv) {
+ for (first = 1; *argv; ++argv) {
+ if ((fp = fopen(*argv, "r")) == NULL) {
+ warn("%s", *argv);
+ eval = 1;
+ continue;
+ }
+ if (argc > 1) {
+ (void)printf("%s==> %s <==\n",
+ first ? "" : "\n", *argv);
+ first = 0;
+ }
+ if (bytecnt == -1)
+ head(fp, linecnt);
+ else
+ head_bytes(fp, bytecnt);
+ (void)fclose(fp);
+ }
+ } else if (bytecnt == -1)
+ head(stdin, linecnt);
+ else
+ head_bytes(stdin, bytecnt);
+
+ exit(eval);
+}
+
+static void
+head(FILE *fp, int cnt)
+{
+ char *cp;
+ size_t error, readlen;
+
+ while (cnt && (cp = fgetln(fp, &readlen)) != NULL) {
+ error = fwrite(cp, sizeof(char), readlen, stdout);
+ if (error != readlen)
+ err(1, "stdout");
+ cnt--;
+ }
+}
+
+static void
+head_bytes(FILE *fp, off_t cnt)
+{
+ char buf[4096];
+ size_t readlen;
+
+ while (cnt) {
+ if ((uintmax_t)cnt < sizeof(buf))
+ readlen = cnt;
+ else
+ readlen = sizeof(buf);
+ readlen = fread(buf, sizeof(char), readlen, fp);
+ if (readlen == 0)
+ break;
+ if (fwrite(buf, sizeof(char), readlen, stdout) != readlen)
+ err(1, "stdout");
+ cnt -= readlen;
+ }
+}
+
+static void
+obsolete(char *argv[])
+{
+ char *ap;
+
+ while ((ap = *++argv)) {
+ /* Return if "--" or not "-[0-9]*". */
+ if (ap[0] != '-' || ap[1] == '-' || !isdigit(ap[1]))
+ return;
+ if ((ap = malloc(strlen(*argv) + 2)) == NULL)
+ err(1, NULL);
+ ap[0] = '-';
+ ap[1] = 'n';
+ (void)strcpy(ap + 2, *argv + 1);
+ *argv = ap;
+ }
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: head [-n lines | -c bytes] [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/hesinfo/Makefile b/usr.bin/hesinfo/Makefile
new file mode 100644
index 0000000..870db28
--- /dev/null
+++ b/usr.bin/hesinfo/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= hesinfo
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/hesinfo/hesinfo.1 b/usr.bin/hesinfo/hesinfo.1
new file mode 100644
index 0000000..7ab2d35
--- /dev/null
+++ b/usr.bin/hesinfo/hesinfo.1
@@ -0,0 +1,198 @@
+.\" $NetBSD: hesinfo.1,v 1.1 1999/01/25 22:45:55 lukem Exp $
+.\"
+.\" from: #Id: hesinfo.1,v 1.9 1996/11/07 01:57:12 ghudson Exp #
+.\"
+.\" Copyright 1987, 1996 by the Massachusetts Institute of Technology.
+.\"
+.\" Permission to use, copy, modify, and distribute this
+.\" software and its documentation for any purpose and without
+.\" fee is hereby granted, provided that the above copyright
+.\" notice appear in all copies and that both that copyright
+.\" notice and this permission notice appear in supporting
+.\" documentation, and that the name of M.I.T. not be used in
+.\" advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.
+.\" M.I.T. makes no representations about the suitability of
+.\" this software for any purpose. It is provided "as is"
+.\" without express or implied warranty.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 27, 1996
+.Dt HESINFO 1
+.Os
+.Sh NAME
+.Nm hesinfo
+.Nd "find out what is stored in the Hesiod database"
+.Sh SYNOPSIS
+.Nm
+.Op Fl bl
+.Ar HesiodName HesiodNameType
+.Sh DESCRIPTION
+The
+.Nm
+utility takes two arguments, a name to be resolved and a string, known
+as a
+.Ar HesiodNameType .
+It then prints the information returned by
+the Hesiod nameserver.
+.Pp
+The value returned by
+.Nm
+is of the type
+.Ar HesiodNameType .
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl l
+Selects long format.
+.It Fl b
+Prints the fully\-qualified string passed to the nameserver.
+.El
+.Ss VALID Hesiod_Names
+The following types of identifiers may be used in the
+.Ar HesiodName
+argument to
+.Nm .
+These values will be resolved by accessing the
+.Xr hesiod 3
+database.
+.Bl -tag -width indent
+.It Aq Ar username
+the 8\-character\-or\-less string used to identify users or classes
+(e.g.\& joeuser, root, 1.00, etc).
+Used with the
+.Ar Hesiod_Name_Types
+.Cm passwd ,
+.Cm pobox ,
+and
+.Cm filsys .
+.It Aq Ar uid
+the id number assigned to a user.
+.It Aq Ar groupid
+the id number assigned to a group.
+.It Aq Ar groupname
+a name identifying a unique group.
+.It Aq Ar file\-system\-name
+the name of an Athena file system.
+.It Xo
+.Ao Ar "rvd\-server" Ac : Ns Aq Ar pack
+.Xc
+the name of an rvd's server and pack separated by a colon.
+.It Xo
+.Ao Ar "nfs\-server" Ac : Ns Aq Ar partition
+.Xc
+the name of an
+.Tn NFS
+server and its partition separated by a colon.
+.It Aq Ar workstation\-name
+the machine name of an Athena workstation (e.g.\& E40\-343\-3).
+.It Aq Ar service\-name
+name of an Athena service (e.g.\& Zephyr).
+.It Aq Ar service\-type
+name of
+.Ux
+service (valid entries are defined in
+.Pa /etc/services ) .
+.It Aq Ar printer\-name
+name of a printer.
+.It Aq Ar printer\-cluster\-name
+name of an Athena print cluster.
+.It Aq Ar foo
+some
+.Nm
+calls (e.g.\&
+.Cm prclusterlist )
+do not require a specific
+.Ar HesiodName
+argument.
+However, you must include a dummy string (e.g.\&
+.Ql foo )
+for
+.Nm
+to work properly.
+.El
+.Ss VALID Hesiod_Name_Types
+The following symbols are valid substitutions for the
+.Ar HesiodNameType
+argument to
+.Nm .
+.Bl -tag -width indent
+.It Cm passwd
+returns string suitable for inclusion in
+.Pa /etc/passwd ,
+searching with
+.Aq Ar username .
+.It Cm pobox
+returns information on the pobox assigned to the user specified by
+.Ar HesiodName ,
+searching with
+.Aq Ar username .
+.It Cm uid
+returns string suitable for inclusion in
+.Pa /etc/passwd ,
+searching with
+.Aq Ar uid .
+.It Cm gid
+returns string suitable for inclusion in
+.Pa /etc/group ,
+searching with
+.Aq Ar groupid .
+.It Cm group
+returns string suitable for inclusion in
+.Pa /etc/group ,
+searching with
+.Aq Ar groupname .
+.It Cm grplist
+returns subgroups included in superset
+defined by
+.Aq Ar groupname .
+.It Cm filsys
+returns file system type, export point, server, mount mode, and import point
+for the following valid
+.Ar HesiodNames
+(see above) -
+.Aq Ar "file\-system\-name" ,
+.Aq Ar username ,
+.Ao Ar "rvd\-server" Ac : Ns Aq Ar pack ,
+and
+.Ao Ar "nfs\-server" Ac : Ns Aq Ar partition .
+.It Cm cluster
+returns information about the local cluster the workstation, specified by
+.Aq Ar "workstation\-name" .
+Included is information about the local file and print servers.
+This information is accesses by
+.Sy clusterinfo
+at boot time.
+.It Cm sloc
+returns network name of service host for
+.Aq Ar service\-name .
+.It Cm service
+returns Internet protocol type and protocol service port for
+.Aq Ar service\-type .
+.It Cm pcap
+returns a valid entry for
+.Pa /etc/printcap
+for
+.Aq Ar printer\-name .
+.It Cm prcluserlist
+returns a list of print clusters.
+.It Cm prcluster
+returns a list of printers in a cluster specified by
+.Aq Ar printer\-cluster\-name .
+.El
+.Sh FILES
+.Bl -tag -width /etc/hesiod.conf
+.It Pa /etc/hesiod.conf
+.El
+.Sh SEE ALSO
+.Xr hesiod 3 ,
+.Xr named 8
+.Rs
+.%T "Hesiod - Project Athena Technical Plan -- Name Service"
+.Re
+.Sh AUTHORS
+.An Steve Dyer ,
+IBM/Project Athena
+.Pp
+Copyright 1987, 1988, 1996 by the Massachusetts Institute of Technology.
diff --git a/usr.bin/hesinfo/hesinfo.c b/usr.bin/hesinfo/hesinfo.c
new file mode 100644
index 0000000..fa81864
--- /dev/null
+++ b/usr.bin/hesinfo/hesinfo.c
@@ -0,0 +1,108 @@
+/* $NetBSD: hesinfo.c,v 1.1 1999/01/25 22:45:55 lukem Exp $ */
+
+/* Copyright 1988, 1996 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+/* This file is a simple driver for the Hesiod library. */
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <errno.h>
+#include <hesiod.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+ char **list, **p, *bindname, *name, *type;
+ int lflag = 0, errflg = 0, bflag = 0, c;
+ void *context;
+
+ while ((c = getopt(argc, argv, "lb")) != -1) {
+ switch (c) {
+ case 'l':
+ lflag = 1;
+ break;
+ case 'b':
+ bflag = 1;
+ break;
+ default:
+ errflg++;
+ break;
+ }
+ }
+ if (argc - optind != 2 || errflg) {
+ fprintf(stderr, "usage: hesinfo [-bl] name type\n");
+ fprintf(stderr, "\t-l selects long format\n");
+ fprintf(stderr, "\t-b also does hes_to_bind conversion\n");
+ exit(2);
+ }
+ name = argv[optind];
+ type = argv[optind + 1];
+
+ if (hesiod_init(&context) < 0) {
+ if (errno == ENOEXEC)
+ warnx(
+ "hesiod_init: Invalid Hesiod configuration file.");
+ else
+ warn("hesiod_init");
+ }
+ /* Display bind name if requested. */
+ if (bflag) {
+ if (lflag)
+ printf("hes_to_bind(%s, %s) expands to\n", name, type);
+ bindname = hesiod_to_bind(context, name, type);
+ if (!bindname) {
+ if (lflag)
+ printf("nothing\n");
+ if (errno == ENOENT)
+ warnx("hesiod_to_bind: Unknown rhs-extension.");
+ else
+ warn("hesiod_to_bind");
+ exit(1);
+ }
+ printf("%s\n", bindname);
+ free(bindname);
+ if (lflag)
+ printf("which ");
+ }
+ if (lflag)
+ printf("resolves to\n");
+
+ /* Do the hesiod resolve and check for errors. */
+ list = hesiod_resolve(context, name, type);
+ if (!list) {
+ if (lflag)
+ printf("nothing\n");
+ if (errno == ENOENT)
+ warnx("hesiod_resolve: Hesiod name not found.");
+ else
+ warn("hesiod_resolve");
+ exit(1);
+ }
+ /* Display the results. */
+ for (p = list; *p; p++)
+ printf("%s\n", *p);
+
+ hesiod_free_list(context, list);
+ hesiod_end(context);
+ exit(0);
+}
diff --git a/usr.bin/hexdump/Makefile b/usr.bin/hexdump/Makefile
new file mode 100644
index 0000000..4cd3cc5
--- /dev/null
+++ b/usr.bin/hexdump/Makefile
@@ -0,0 +1,11 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= hexdump
+SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c
+MAN= hexdump.1 od.1
+MLINKS= hexdump.1 hd.1
+LINKS= ${BINDIR}/hexdump ${BINDIR}/od
+LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/hexdump/Makefile.depend b/usr.bin/hexdump/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/hexdump/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/hexdump/conv.c b/usr.bin/hexdump/conv.c
new file mode 100644
index 0000000..8ba1311
--- /dev/null
+++ b/usr.bin/hexdump/conv.c
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 1989, 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 sccsid[] = "@(#)conv.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+#include "hexdump.h"
+
+void
+conv_c(PR *pr, u_char *p, size_t bufsize)
+{
+ char buf[10];
+ char const *str;
+ wchar_t wc;
+ size_t clen, oclen;
+ int converr, pad, width;
+ u_char peekbuf[MB_LEN_MAX];
+
+ if (pr->mbleft > 0) {
+ str = "**";
+ pr->mbleft--;
+ goto strpr;
+ }
+
+ switch(*p) {
+ case '\0':
+ str = "\\0";
+ goto strpr;
+ /* case '\a': */
+ case '\007':
+ str = "\\a";
+ goto strpr;
+ case '\b':
+ str = "\\b";
+ goto strpr;
+ case '\f':
+ str = "\\f";
+ goto strpr;
+ case '\n':
+ str = "\\n";
+ goto strpr;
+ case '\r':
+ str = "\\r";
+ goto strpr;
+ case '\t':
+ str = "\\t";
+ goto strpr;
+ case '\v':
+ str = "\\v";
+ goto strpr;
+ default:
+ break;
+ }
+ /*
+ * Multibyte characters are disabled for hexdump(1) for backwards
+ * compatibility and consistency (none of its other output formats
+ * recognize them correctly).
+ */
+ converr = 0;
+ if (odmode && MB_CUR_MAX > 1) {
+ oclen = 0;
+retry:
+ clen = mbrtowc(&wc, p, bufsize, &pr->mbstate);
+ if (clen == 0)
+ clen = 1;
+ else if (clen == (size_t)-1 || (clen == (size_t)-2 &&
+ p == peekbuf)) {
+ memset(&pr->mbstate, 0, sizeof(pr->mbstate));
+ wc = *p;
+ clen = 1;
+ converr = 1;
+ } else if (clen == (size_t)-2) {
+ /*
+ * Incomplete character; peek ahead and see if we
+ * can complete it.
+ */
+ oclen = bufsize;
+ bufsize = peek(p = peekbuf, MB_CUR_MAX);
+ goto retry;
+ }
+ clen += oclen;
+ } else {
+ wc = *p;
+ clen = 1;
+ }
+ if (!converr && iswprint(wc)) {
+ if (!odmode) {
+ *pr->cchar = 'c';
+ (void)printf(pr->fmt, (int)wc);
+ } else {
+ *pr->cchar = 'C';
+ assert(strcmp(pr->fmt, "%3C") == 0);
+ width = wcwidth(wc);
+ assert(width >= 0);
+ pad = 3 - width;
+ if (pad < 0)
+ pad = 0;
+ (void)printf("%*s%C", pad, "", wc);
+ pr->mbleft = clen - 1;
+ }
+ } else {
+ (void)sprintf(buf, "%03o", (int)*p);
+ str = buf;
+strpr: *pr->cchar = 's';
+ (void)printf(pr->fmt, str);
+ }
+}
+
+void
+conv_u(PR *pr, u_char *p)
+{
+ static char const * list[] = {
+ "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
+ "bs", "ht", "lf", "vt", "ff", "cr", "so", "si",
+ "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb",
+ "can", "em", "sub", "esc", "fs", "gs", "rs", "us",
+ };
+
+ /* od used nl, not lf */
+ if (*p <= 0x1f) {
+ *pr->cchar = 's';
+ if (odmode && *p == 0x0a)
+ (void)printf(pr->fmt, "nl");
+ else
+ (void)printf(pr->fmt, list[*p]);
+ } else if (*p == 0x7f) {
+ *pr->cchar = 's';
+ (void)printf(pr->fmt, "del");
+ } else if (odmode && *p == 0x20) { /* od replaced space with sp */
+ *pr->cchar = 's';
+ (void)printf(pr->fmt, " sp");
+ } else if (isprint(*p)) {
+ *pr->cchar = 'c';
+ (void)printf(pr->fmt, *p);
+ } else {
+ *pr->cchar = 'x';
+ (void)printf(pr->fmt, (int)*p);
+ }
+}
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
new file mode 100644
index 0000000..36230aa
--- /dev/null
+++ b/usr.bin/hexdump/display.c
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 1989, 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
+#if 0
+static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "hexdump.h"
+
+enum _vflag vflag = FIRST;
+
+static off_t address; /* address/offset in stream */
+static off_t eaddress; /* end address */
+
+static void print(PR *, u_char *);
+
+void
+display(void)
+{
+ FS *fs;
+ FU *fu;
+ PR *pr;
+ int cnt;
+ u_char *bp;
+ off_t saveaddress;
+ u_char savech, *savebp;
+
+ savech = 0;
+ while ((bp = get()))
+ for (fs = fshead, savebp = bp, saveaddress = address; fs;
+ fs = fs->nextfs, bp = savebp, address = saveaddress)
+ for (fu = fs->nextfu; fu; fu = fu->nextfu) {
+ if (fu->flags&F_IGNORE)
+ break;
+ for (cnt = fu->reps; cnt; --cnt)
+ for (pr = fu->nextpr; pr; address += pr->bcnt,
+ bp += pr->bcnt, pr = pr->nextpr) {
+ if (eaddress && address >= eaddress &&
+ !(pr->flags & (F_TEXT|F_BPAD)))
+ bpad(pr);
+ if (cnt == 1 && pr->nospace) {
+ savech = *pr->nospace;
+ *pr->nospace = '\0';
+ }
+ print(pr, bp);
+ if (cnt == 1 && pr->nospace)
+ *pr->nospace = savech;
+ }
+ }
+ if (endfu) {
+ /*
+ * If eaddress not set, error or file size was multiple of
+ * blocksize, and no partial block ever found.
+ */
+ if (!eaddress) {
+ if (!address)
+ return;
+ eaddress = address;
+ }
+ for (pr = endfu->nextpr; pr; pr = pr->nextpr)
+ switch(pr->flags) {
+ case F_ADDRESS:
+ (void)printf(pr->fmt, (quad_t)eaddress);
+ break;
+ case F_TEXT:
+ (void)printf("%s", pr->fmt);
+ break;
+ }
+ }
+}
+
+static void
+print(PR *pr, u_char *bp)
+{
+ long double ldbl;
+ double f8;
+ float f4;
+ int16_t s2;
+ int8_t s8;
+ int32_t s4;
+ u_int16_t u2;
+ u_int32_t u4;
+ u_int64_t u8;
+
+ switch(pr->flags) {
+ case F_ADDRESS:
+ (void)printf(pr->fmt, (quad_t)address);
+ break;
+ case F_BPAD:
+ (void)printf(pr->fmt, "");
+ break;
+ case F_C:
+ conv_c(pr, bp, eaddress ? eaddress - address :
+ blocksize - address % blocksize);
+ break;
+ case F_CHAR:
+ (void)printf(pr->fmt, *bp);
+ break;
+ case F_DBL:
+ switch(pr->bcnt) {
+ case 4:
+ bcopy(bp, &f4, sizeof(f4));
+ (void)printf(pr->fmt, f4);
+ break;
+ case 8:
+ bcopy(bp, &f8, sizeof(f8));
+ (void)printf(pr->fmt, f8);
+ break;
+ default:
+ if (pr->bcnt == sizeof(long double)) {
+ bcopy(bp, &ldbl, sizeof(ldbl));
+ (void)printf(pr->fmt, ldbl);
+ }
+ break;
+ }
+ break;
+ case F_INT:
+ switch(pr->bcnt) {
+ case 1:
+ (void)printf(pr->fmt, (quad_t)(signed char)*bp);
+ break;
+ case 2:
+ bcopy(bp, &s2, sizeof(s2));
+ (void)printf(pr->fmt, (quad_t)s2);
+ break;
+ case 4:
+ bcopy(bp, &s4, sizeof(s4));
+ (void)printf(pr->fmt, (quad_t)s4);
+ break;
+ case 8:
+ bcopy(bp, &s8, sizeof(s8));
+ (void)printf(pr->fmt, s8);
+ break;
+ }
+ break;
+ case F_P:
+ (void)printf(pr->fmt, isprint(*bp) ? *bp : '.');
+ break;
+ case F_STR:
+ (void)printf(pr->fmt, (char *)bp);
+ break;
+ case F_TEXT:
+ (void)printf("%s", pr->fmt);
+ break;
+ case F_U:
+ conv_u(pr, bp);
+ break;
+ case F_UINT:
+ switch(pr->bcnt) {
+ case 1:
+ (void)printf(pr->fmt, (u_quad_t)*bp);
+ break;
+ case 2:
+ bcopy(bp, &u2, sizeof(u2));
+ (void)printf(pr->fmt, (u_quad_t)u2);
+ break;
+ case 4:
+ bcopy(bp, &u4, sizeof(u4));
+ (void)printf(pr->fmt, (u_quad_t)u4);
+ break;
+ case 8:
+ bcopy(bp, &u8, sizeof(u8));
+ (void)printf(pr->fmt, u8);
+ break;
+ }
+ break;
+ }
+}
+
+void
+bpad(PR *pr)
+{
+ static char const *spec = " -0+#";
+ char *p1, *p2;
+
+ /*
+ * Remove all conversion flags; '-' is the only one valid
+ * with %s, and it's not useful here.
+ */
+ pr->flags = F_BPAD;
+ pr->cchar[0] = 's';
+ pr->cchar[1] = '\0';
+ for (p1 = pr->fmt; *p1 != '%'; ++p1);
+ for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
+ while ((*p2++ = *p1++));
+}
+
+static char **_argv;
+
+u_char *
+get(void)
+{
+ static int ateof = 1;
+ static u_char *curp, *savp;
+ int n;
+ int need, nread;
+ int valid_save = 0;
+ u_char *tmpp;
+
+ if (!curp) {
+ if ((curp = calloc(1, blocksize)) == NULL)
+ err(1, NULL);
+ if ((savp = calloc(1, blocksize)) == NULL)
+ err(1, NULL);
+ } else {
+ tmpp = curp;
+ curp = savp;
+ savp = tmpp;
+ address += blocksize;
+ valid_save = 1;
+ }
+ for (need = blocksize, nread = 0;;) {
+ /*
+ * if read the right number of bytes, or at EOF for one file,
+ * and no other files are available, zero-pad the rest of the
+ * block and set the end flag.
+ */
+ if (!length || (ateof && !next((char **)NULL))) {
+ if (odmode && address < skip)
+ errx(1, "cannot skip past end of input");
+ if (need == blocksize)
+ return((u_char *)NULL);
+ /*
+ * XXX bcmp() is not quite right in the presence
+ * of multibyte characters.
+ */
+ if (vflag != ALL &&
+ valid_save &&
+ bcmp(curp, savp, nread) == 0) {
+ if (vflag != DUP)
+ (void)printf("*\n");
+ return((u_char *)NULL);
+ }
+ bzero((char *)curp + nread, need);
+ eaddress = address + nread;
+ return(curp);
+ }
+ n = fread((char *)curp + nread, sizeof(u_char),
+ length == -1 ? need : MIN(length, need), stdin);
+ if (!n) {
+ if (ferror(stdin))
+ warn("%s", _argv[-1]);
+ ateof = 1;
+ continue;
+ }
+ ateof = 0;
+ if (length != -1)
+ length -= n;
+ if (!(need -= n)) {
+ /*
+ * XXX bcmp() is not quite right in the presence
+ * of multibyte characters.
+ */
+ if (vflag == ALL || vflag == FIRST ||
+ valid_save == 0 ||
+ bcmp(curp, savp, blocksize) != 0) {
+ if (vflag == DUP || vflag == FIRST)
+ vflag = WAIT;
+ return(curp);
+ }
+ if (vflag == WAIT)
+ (void)printf("*\n");
+ vflag = DUP;
+ address += blocksize;
+ need = blocksize;
+ nread = 0;
+ }
+ else
+ nread += n;
+ }
+}
+
+size_t
+peek(u_char *buf, size_t nbytes)
+{
+ size_t n, nread;
+ int c;
+
+ if (length != -1 && nbytes > (unsigned int)length)
+ nbytes = length;
+ nread = 0;
+ while (nread < nbytes && (c = getchar()) != EOF) {
+ *buf++ = c;
+ nread++;
+ }
+ n = nread;
+ while (n-- > 0) {
+ c = *--buf;
+ ungetc(c, stdin);
+ }
+ return (nread);
+}
+
+int
+next(char **argv)
+{
+ static int done;
+ int statok;
+
+ if (argv) {
+ _argv = argv;
+ return(1);
+ }
+ for (;;) {
+ if (*_argv) {
+ done = 1;
+ if (!(freopen(*_argv, "r", stdin))) {
+ warn("%s", *_argv);
+ exitval = 1;
+ ++_argv;
+ continue;
+ }
+ statok = 1;
+ } else {
+ if (done++)
+ return(0);
+ statok = 0;
+ }
+ if (skip)
+ doskip(statok ? *_argv : "stdin", statok);
+ if (*_argv)
+ ++_argv;
+ if (!skip)
+ return(1);
+ }
+ /* NOTREACHED */
+}
+
+void
+doskip(const char *fname, int statok)
+{
+ int cnt;
+ struct stat sb;
+
+ if (statok) {
+ if (fstat(fileno(stdin), &sb))
+ err(1, "%s", fname);
+ if (S_ISREG(sb.st_mode) && skip > sb.st_size) {
+ address += sb.st_size;
+ skip -= sb.st_size;
+ return;
+ }
+ }
+ if (statok && S_ISREG(sb.st_mode)) {
+ if (fseeko(stdin, skip, SEEK_SET))
+ err(1, "%s", fname);
+ address += skip;
+ skip = 0;
+ } else {
+ for (cnt = 0; cnt < skip; ++cnt)
+ if (getchar() == EOF)
+ break;
+ address += cnt;
+ skip -= cnt;
+ }
+}
diff --git a/usr.bin/hexdump/hexdump.1 b/usr.bin/hexdump/hexdump.1
new file mode 100644
index 0000000..8eeb5e4
--- /dev/null
+++ b/usr.bin/hexdump/hexdump.1
@@ -0,0 +1,347 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" @(#)hexdump.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd October 29, 2014
+.Dt HEXDUMP 1
+.Os
+.Sh NAME
+.Nm hexdump , hd
+.Nd ASCII, decimal, hexadecimal, octal dump
+.Sh SYNOPSIS
+.Nm
+.Op Fl bcCdovx
+.Op Fl e Ar format_string
+.Op Fl f Ar format_file
+.Op Fl n Ar length
+.Bk -words
+.Op Fl s Ar offset
+.Ek
+.Ar
+.Nm hd
+.Op Fl bcdovx
+.Op Fl e Ar format_string
+.Op Fl f Ar format_file
+.Op Fl n Ar length
+.Bk -words
+.Op Fl s Ar offset
+.Ek
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a filter which displays the specified files, or
+the standard input, if no files are specified, in a user specified
+format.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b
+.Em One-byte octal display .
+Display the input offset in hexadecimal, followed by sixteen
+space-separated, three column, zero-filled, bytes of input data,
+in octal, per line.
+.It Fl c
+.Em One-byte character display .
+Display the input offset in hexadecimal, followed by sixteen
+space-separated, three column, space-filled, characters of input
+data per line.
+.It Fl C
+.Em Canonical hex+ASCII display .
+Display the input offset in hexadecimal, followed by sixteen
+space-separated, two column, hexadecimal bytes, followed by the
+same sixteen bytes in %_p format enclosed in ``|'' characters.
+.Pp
+Calling the command
+.Nm hd
+implies this option.
+.It Fl d
+.Em Two-byte decimal display .
+Display the input offset in hexadecimal, followed by eight
+space-separated, five column, zero-filled, two-byte units
+of input data, in unsigned decimal, per line.
+.It Fl e Ar format_string
+Specify a format string to be used for displaying data.
+.It Fl f Ar format_file
+Specify a file that contains one or more newline separated format strings.
+Empty lines and lines whose first non-blank character is a hash mark
+.Pf ( Cm \&# )
+are ignored.
+.It Fl n Ar length
+Interpret only
+.Ar length
+bytes of input.
+.It Fl o
+.Em Two-byte octal display .
+Display the input offset in hexadecimal, followed by eight
+space-separated, six column, zero-filled, two byte quantities of
+input data, in octal, per line.
+.It Fl s Ar offset
+Skip
+.Ar offset
+bytes from the beginning of the input.
+By default,
+.Ar offset
+is interpreted as a decimal number.
+With a leading
+.Cm 0x
+or
+.Cm 0X ,
+.Ar offset
+is interpreted as a hexadecimal number,
+otherwise, with a leading
+.Cm 0 ,
+.Ar offset
+is interpreted as an octal number.
+Appending the character
+.Cm b ,
+.Cm k ,
+or
+.Cm m
+to
+.Ar offset
+causes it to be interpreted as a multiple of
+.Li 512 ,
+.Li 1024 ,
+or
+.Li 1048576 ,
+respectively.
+.It Fl v
+Cause
+.Nm
+to display all input data.
+Without the
+.Fl v
+option, any number of groups of output lines, which would be
+identical to the immediately preceding group of output lines (except
+for the input offsets), are replaced with a line comprised of a
+single asterisk.
+.It Fl x
+.Em Two-byte hexadecimal display .
+Display the input offset in hexadecimal, followed by eight, space
+separated, four column, zero-filled, two-byte quantities of input
+data, in hexadecimal, per line.
+.El
+.Pp
+For each input file,
+.Nm
+sequentially copies the input to standard output, transforming the
+data according to the format strings specified by the
+.Fl e
+and
+.Fl f
+options, in the order that they were specified.
+.Ss Formats
+A format string contains any number of format units, separated by
+whitespace.
+A format unit contains up to three items: an iteration count, a byte
+count, and a format.
+.Pp
+The iteration count is an optional positive integer, which defaults to
+one.
+Each format is applied iteration count times.
+.Pp
+The byte count is an optional positive integer.
+If specified it defines the number of bytes to be interpreted by
+each iteration of the format.
+.Pp
+If an iteration count and/or a byte count is specified, a single slash
+must be placed after the iteration count and/or before the byte count
+to disambiguate them.
+Any whitespace before or after the slash is ignored.
+.Pp
+The format is required and must be surrounded by double quote
+(" ") marks.
+It is interpreted as a fprintf-style format string (see
+.Xr fprintf 3 ) ,
+with the
+following exceptions:
+.Bl -bullet -offset indent
+.It
+An asterisk (*) may not be used as a field width or precision.
+.It
+A byte count or field precision
+.Em is
+required for each ``s'' conversion
+character (unlike the
+.Xr fprintf 3
+default which prints the entire string if the precision is unspecified).
+.It
+The conversion characters ``h'', ``l'', ``n'', ``p'' and ``q'' are
+not supported.
+.It
+The single character escape sequences
+described in the C standard are supported:
+.Bd -ragged -offset indent -compact
+.Bl -column <alert_character>
+.It "NUL \e0"
+.It "<alert character> \ea"
+.It "<backspace> \eb"
+.It "<form-feed> \ef"
+.It "<newline> \en"
+.It "<carriage return> \er"
+.It "<tab> \et"
+.It "<vertical tab> \ev"
+.El
+.Ed
+.El
+.Pp
+The
+.Nm
+utility also supports the following additional conversion strings:
+.Bl -tag -width Fl
+.It Cm \&_a Ns Op Cm dox
+Display the input offset, cumulative across input files, of the
+next byte to be displayed.
+The appended characters
+.Cm d ,
+.Cm o ,
+and
+.Cm x
+specify the display base
+as decimal, octal or hexadecimal respectively.
+.It Cm \&_A Ns Op Cm dox
+Identical to the
+.Cm \&_a
+conversion string except that it is only performed
+once, when all of the input data has been processed.
+.It Cm \&_c
+Output characters in the default character set.
+Nonprinting characters are displayed in three character, zero-padded
+octal, except for those representable by standard escape notation
+(see above),
+which are displayed as two character strings.
+.It Cm _p
+Output characters in the default character set.
+Nonprinting characters are displayed as a single
+.Dq Cm \&. .
+.It Cm _u
+Output US
+.Tn ASCII
+characters, with the exception that control characters are
+displayed using the following, lower-case, names.
+Characters greater than 0xff, hexadecimal, are displayed as hexadecimal
+strings.
+.Bl -column 000_nu 001_so 002_st 003_et 004_eo
+.It "000 NUL" Ta "001 SOH" Ta "002 STX" Ta "003 ETX" Ta "004 EOT" Ta "005 ENQ"
+.It "006 ACK" Ta "007 BEL" Ta "008 BS" Ta "009 HT" Ta "00A LF" Ta "00B VT"
+.It "00C FF" Ta "00D CR" Ta "00E\ SO" Ta "00F SI" Ta "010 DLE" Ta "011 DC1"
+.It "012 DC2" Ta "013 DC3" Ta "014 DC4" Ta "015\ NAK" Ta "016 SYN" Ta "017 ETB"
+.It "018 CAN" Ta "019 EM" Ta "01A SUB" Ta "01B ESC" Ta "01C FS" Ta "01D GS"
+.It "01E RS" Ta "01F US" Ta "07F DEL" Ta \& Ta \& Ta \&
+.El
+.El
+.Pp
+The default and supported byte counts for the conversion characters
+are as follows:
+.Bl -tag -width "Xc,_Xc,_Xc,_Xc,_Xc,_Xc" -offset indent
+.It Li \&%_c , \&%_p , \&%_u , \&%c
+One byte counts only.
+.It Xo
+.Li \&%d , \&%i , \&%o ,
+.Li \&%u , \&%X , \&%x
+.Xc
+Four byte default, one, two and four byte counts supported.
+.It Xo
+.Li \&%E , \&%e , \&%f ,
+.Li \&%G , \&%g
+.Xc
+Eight byte default, four and twelve byte counts supported.
+.El
+.Pp
+The amount of data interpreted by each format string is the sum of the
+data required by each format unit, which is the iteration count times the
+byte count, or the iteration count times the number of bytes required by
+the format if the byte count is not specified.
+.Pp
+The input is manipulated in ``blocks'', where a block is defined as the
+largest amount of data specified by any format string.
+Format strings interpreting less than an input block's worth of data,
+whose last format unit both interprets some number of bytes and does
+not have a specified iteration count, have the iteration count
+incremented until the entire input block has been processed or there
+is not enough data remaining in the block to satisfy the format string.
+.Pp
+If, either as a result of user specification or
+.Nm
+modifying
+the iteration count as described above, an iteration count is
+greater than one, no trailing whitespace characters are output
+during the last iteration.
+.Pp
+It is an error to specify a byte count as well as multiple conversion
+characters or strings unless all but one of the conversion characters
+or strings is
+.Cm \&_a
+or
+.Cm \&_A .
+.Pp
+If, as a result of the specification of the
+.Fl n
+option or end-of-file being reached, input data only partially
+satisfies a format string, the input block is zero-padded sufficiently
+to display all available data (i.e., any format units overlapping the
+end of data will display some number of the zero bytes).
+.Pp
+Further output by such format strings is replaced by an equivalent
+number of spaces.
+An equivalent number of spaces is defined as the number of spaces
+output by an
+.Cm s
+conversion character with the same field width
+and precision as the original conversion character or conversion
+string but with any
+.Dq Li \&+ ,
+.Dq \&\ \& ,
+.Dq Li \&#
+conversion flag characters
+removed, and referencing a NULL string.
+.Pp
+If no format strings are specified, the default display is equivalent
+to specifying the
+.Fl x
+option.
+.Sh EXIT STATUS
+.Ex -std hexdump hd
+.Sh EXAMPLES
+Display the input in perusal format:
+.Bd -literal -offset indent
+"%06.6_ao " 12/1 "%3_u "
+"\et\et" "%_p "
+"\en"
+.Ed
+.Pp
+Implement the \-x option:
+.Bd -literal -offset indent
+"%07.7_Ax\en"
+"%07.7_ax " 8/2 "%04x " "\en"
+.Ed
+.Sh SEE ALSO
+.Xr gdb 1 ,
+.Xr od 1
diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c
new file mode 100644
index 0000000..d3c4bb5
--- /dev/null
+++ b/usr.bin/hexdump/hexdump.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1989, 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)hexdump.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "hexdump.h"
+
+FS *fshead; /* head of format strings */
+int blocksize; /* data block size */
+int exitval; /* final exit value */
+int length = -1; /* max bytes to read */
+
+int
+main(int argc, char *argv[])
+{
+ FS *tfs;
+ char *p;
+
+ (void)setlocale(LC_ALL, "");
+
+ if (!(p = strrchr(argv[0], 'o')) || strcmp(p, "od"))
+ newsyntax(argc, &argv);
+ else
+ oldsyntax(argc, &argv);
+
+ /* figure out the data block size */
+ for (blocksize = 0, tfs = fshead; tfs; tfs = tfs->nextfs) {
+ tfs->bcnt = size(tfs);
+ if (blocksize < tfs->bcnt)
+ blocksize = tfs->bcnt;
+ }
+ /* rewrite the rules, do syntax checking */
+ for (tfs = fshead; tfs; tfs = tfs->nextfs)
+ rewrite(tfs);
+
+ (void)next(argv);
+ display();
+ exit(exitval);
+}
diff --git a/usr.bin/hexdump/hexdump.h b/usr.bin/hexdump/hexdump.h
new file mode 100644
index 0000000..e34d3a0
--- /dev/null
+++ b/usr.bin/hexdump/hexdump.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)hexdump.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <wchar.h>
+
+typedef struct _pr {
+ struct _pr *nextpr; /* next print unit */
+#define F_ADDRESS 0x001 /* print offset */
+#define F_BPAD 0x002 /* blank pad */
+#define F_C 0x004 /* %_c */
+#define F_CHAR 0x008 /* %c */
+#define F_DBL 0x010 /* %[EefGf] */
+#define F_INT 0x020 /* %[di] */
+#define F_P 0x040 /* %_p */
+#define F_STR 0x080 /* %s */
+#define F_U 0x100 /* %_u */
+#define F_UINT 0x200 /* %[ouXx] */
+#define F_TEXT 0x400 /* no conversions */
+ u_int flags; /* flag values */
+ int bcnt; /* byte count */
+ char *cchar; /* conversion character */
+ char *fmt; /* printf format */
+ char *nospace; /* no whitespace version */
+ int mbleft; /* bytes left of multibyte char. */
+ mbstate_t mbstate; /* conversion state */
+} PR;
+
+typedef struct _fu {
+ struct _fu *nextfu; /* next format unit */
+ struct _pr *nextpr; /* next print unit */
+#define F_IGNORE 0x01 /* %_A */
+#define F_SETREP 0x02 /* rep count set, not default */
+ u_int flags; /* flag values */
+ int reps; /* repetition count */
+ int bcnt; /* byte count */
+ char *fmt; /* format string */
+} FU;
+
+typedef struct _fs { /* format strings */
+ struct _fs *nextfs; /* linked list of format strings */
+ struct _fu *nextfu; /* linked list of format units */
+ int bcnt;
+} FS;
+
+extern FS *fshead; /* head of format strings list */
+extern FU *endfu; /* format at end-of-data */
+extern int blocksize; /* data block size */
+extern int exitval; /* final exit value */
+extern int odmode; /* are we acting as od(1)? */
+extern int length; /* amount of data to read */
+extern off_t skip; /* amount of data to skip at start */
+enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
+extern enum _vflag vflag;
+
+void add(const char *);
+void addfile(const char *);
+void badcnt(const char *);
+void badconv(const char *);
+void badfmt(const char *);
+void badsfmt(void);
+void bpad(PR *);
+void conv_c(PR *, u_char *, size_t);
+void conv_u(PR *, u_char *);
+void display(void);
+void doskip(const char *, int);
+void escape(char *);
+u_char *get(void);
+void newsyntax(int, char ***);
+int next(char **);
+void nomem(void);
+void oldsyntax(int, char ***);
+size_t peek(u_char *, size_t);
+void rewrite(FS *);
+int size(FS *);
+void usage(void);
diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c
new file mode 100644
index 0000000..ac1971a
--- /dev/null
+++ b/usr.bin/hexdump/hexsyntax.c
@@ -0,0 +1,140 @@
+/*-
+ * Copyright (c) 1990, 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
+#if 0
+static char sccsid[] = "@(#)hexsyntax.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "hexdump.h"
+
+off_t skip; /* bytes to skip */
+
+void
+newsyntax(int argc, char ***argvp)
+{
+ int ch;
+ char *p, **argv;
+
+ argv = *argvp;
+ if ((p = strrchr(argv[0], 'h')) != NULL &&
+ strcmp(p, "hd") == 0) {
+ /* "Canonical" format, implies -C. */
+ add("\"%08.8_Ax\n\"");
+ add("\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" ");
+ add("\" |\" 16/1 \"%_p\" \"|\\n\"");
+ }
+ while ((ch = getopt(argc, argv, "bcCde:f:n:os:vx")) != -1)
+ switch (ch) {
+ case 'b':
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"");
+ break;
+ case 'c':
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");
+ break;
+ case 'C':
+ add("\"%08.8_Ax\n\"");
+ add("\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" ");
+ add("\" |\" 16/1 \"%_p\" \"|\\n\"");
+ break;
+ case 'd':
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 8/2 \" %05u \" \"\\n\"");
+ break;
+ case 'e':
+ add(optarg);
+ break;
+ case 'f':
+ addfile(optarg);
+ break;
+ case 'n':
+ if ((length = atoi(optarg)) < 0)
+ errx(1, "%s: bad length value", optarg);
+ break;
+ case 'o':
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"");
+ break;
+ case 's':
+ if ((skip = strtoll(optarg, &p, 0)) < 0)
+ errx(1, "%s: bad skip value", optarg);
+ switch(*p) {
+ case 'b':
+ skip *= 512;
+ break;
+ case 'k':
+ skip *= 1024;
+ break;
+ case 'm':
+ skip *= 1048576;
+ break;
+ }
+ break;
+ case 'v':
+ vflag = ALL;
+ break;
+ case 'x':
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"");
+ break;
+ case '?':
+ usage();
+ }
+
+ if (!fshead) {
+ add("\"%07.7_Ax\n\"");
+ add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\"");
+ }
+
+ *argvp += optind;
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
+"usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]",
+" [-s skip] [file ...]",
+" hd [-bcdovx] [-e fmt] [-f fmt_file] [-n length]",
+" [-s skip] [file ...]");
+ exit(1);
+}
diff --git a/usr.bin/hexdump/od.1 b/usr.bin/hexdump/od.1
new file mode 100644
index 0000000..ff0eaf3
--- /dev/null
+++ b/usr.bin/hexdump/od.1
@@ -0,0 +1,264 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)od.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 22, 2011
+.Dt OD 1
+.Os
+.Sh NAME
+.Nm od
+.Nd octal, decimal, hex, ASCII dump
+.Sh SYNOPSIS
+.Nm
+.Op Fl aBbcDdeFfHhIiLlOosvXx
+.Op Fl A Ar base
+.Op Fl j Ar skip
+.Op Fl N Ar length
+.Op Fl t Ar type
+.Op Oo Cm + Oc Ns Ar offset Ns Oo Cm \&. Oc Ns Op Cm Bb
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a filter which displays the specified files, or standard
+input if no files are specified, in a user specified format.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl I , L , l"
+.It Fl A Ar base
+Specify the input address base.
+The argument
+.Ar base
+may be one of
+.Cm d ,
+.Cm o ,
+.Cm x
+or
+.Cm n ,
+which specify decimal, octal, hexadecimal
+addresses or no address, respectively.
+.It Fl a
+Output named characters.
+Equivalent to
+.Fl t Cm a .
+.It Fl B , o
+Output octal shorts.
+Equivalent to
+.Fl t Cm o2 .
+.It Fl b
+Output octal bytes.
+Equivalent to
+.Fl t Cm o1 .
+.It Fl c
+Output C-style escaped characters.
+Equivalent to
+.Fl t Cm c .
+.It Fl D
+Output unsigned decimal ints.
+Equivalent to
+.Fl t Cm u4 .
+.It Fl d
+Output unsigned decimal shorts.
+Equivalent to
+.Fl t Cm u2 .
+.It Fl e , F
+Output double-precision floating point numbers.
+Equivalent to
+.Fl t Cm fD .
+.It Fl f
+Output single-precision floating point numbers.
+Equivalent to
+.Fl t Cm fF .
+.It Fl H , X
+Output hexadecimal ints.
+Equivalent to
+.Fl t Cm x4 .
+.It Fl h , x
+Output hexadecimal shorts.
+Equivalent to
+.Fl t Cm x2 .
+.It Fl I , L , l
+Output signed decimal longs.
+Equivalent to
+.Fl t Cm dL .
+.It Fl i
+Output signed decimal ints.
+Equivalent to
+.Fl t Cm dI .
+.It Fl j Ar skip
+Skip
+.Ar skip
+bytes of the combined input before dumping.
+The number may be followed by one
+of
+.Cm b , k
+or
+.Cm m
+which specify the units of the number as blocks (512 bytes), kilobytes and
+megabytes, respectively.
+.It Fl N Ar length
+Dump at most
+.Ar length
+bytes of input.
+.It Fl O
+Output octal ints.
+Equivalent to
+.Fl t Cm o4 .
+.It Fl s
+Output signed decimal shorts.
+Equivalent to
+.Fl t Cm d2 .
+.It Fl t Ar type
+Specify the output format.
+The
+.Ar type
+argument
+is a string containing one or more of the following kinds of type specifiers:
+.Bl -tag -width indent
+.It Cm a
+Named characters
+.Pq Tn ASCII .
+Control characters are displayed using the following names:
+.Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ"
+.It "000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ"
+.It "006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT"
+.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1"
+.It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB"
+.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS"
+.It "01E RS 01F US 020 SP 07F DEL \& \&"
+.El
+.It Cm c
+Characters in the default character set.
+Non-printing characters are
+represented as 3-digit octal character codes, except the following
+characters, which are represented as C escapes:
+.Pp
+.Bl -tag -width carriage-return -compact
+.It NUL
+\e0
+.It alert
+\ea
+.It backspace
+\eb
+.It newline
+\en
+.It carriage-return
+\er
+.It tab
+\et
+.It vertical tab
+\ev
+.El
+.Pp
+Multi-byte characters are displayed in the area corresponding to the first
+byte of the character.
+The remaining bytes are shown as
+.Ql ** .
+.It Xo
+.Sm off
+.Op Cm d | o | u | x
+.Op Cm C | S | I | L | Ar n
+.Sm on
+.Xc
+Signed decimal
+.Pq Cm d ,
+octal
+.Pq Cm o ,
+unsigned decimal
+.Pq Cm u
+or
+hexadecimal
+.Pq Cm x .
+Followed by an optional size specifier, which may be either
+.Cm C
+.Pq Vt char ,
+.Cm S
+.Pq Vt short ,
+.Cm I
+.Pq Vt int ,
+.Cm L
+.Pq Vt long ,
+or a byte count as a decimal integer.
+.It Xo
+.Sm off
+.Cm f
+.Op Cm F | D | L | Ar n
+.Sm on
+.Xc
+Floating-point number.
+Followed by an optional size specifier, which may be either
+.Cm F
+.Pq Vt float ,
+.Cm D
+.Pq Vt double
+or
+.Cm L
+.Pq Vt "long double" .
+.El
+.It Fl v
+Write all input data, instead of replacing lines of duplicate values with a
+.Ql * .
+.El
+.Pp
+Multiple options that specify output format may be used; the output will
+contain one line for each format.
+.Pp
+If no output format is specified,
+.Fl t Cm oS
+is assumed.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+The traditional
+.Fl s
+option to extract string constants is not supported; consider using
+.Xr strings 1
+instead.
+.Sh SEE ALSO
+.Xr hexdump 1 ,
+.Xr strings 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+An
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c
new file mode 100644
index 0000000..ebcb720
--- /dev/null
+++ b/usr.bin/hexdump/odsyntax.c
@@ -0,0 +1,438 @@
+/*-
+ * Copyright (c) 1990, 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
+#if 0
+static char sccsid[] = "@(#)odsyntax.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <float.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "hexdump.h"
+
+#define PADDING " "
+
+int odmode;
+
+static void odadd(const char *);
+static void odformat(const char *);
+static const char *odformatfp(char, const char *);
+static const char *odformatint(char, const char *);
+static void odoffset(int, char ***);
+static void odusage(void);
+
+void
+oldsyntax(int argc, char ***argvp)
+{
+ static char empty[] = "", padding[] = PADDING;
+ int ch;
+ char **argv, *end;
+
+ /* Add initial (default) address format. -A may change it later. */
+#define TYPE_OFFSET 7
+ add("\"%07.7_Ao\n\"");
+ add("\"%07.7_ao \"");
+
+ odmode = 1;
+ argv = *argvp;
+ while ((ch = getopt(argc, argv, "A:aBbcDdeFfHhIij:LlN:Oost:vXx")) != -1)
+ switch (ch) {
+ case 'A':
+ switch (*optarg) {
+ case 'd': case 'o': case 'x':
+ fshead->nextfu->fmt[TYPE_OFFSET] = *optarg;
+ fshead->nextfs->nextfu->fmt[TYPE_OFFSET] =
+ *optarg;
+ break;
+ case 'n':
+ fshead->nextfu->fmt = empty;
+ fshead->nextfs->nextfu->fmt = padding;
+ break;
+ default:
+ errx(1, "%s: invalid address base", optarg);
+ }
+ break;
+ case 'a':
+ odformat("a");
+ break;
+ case 'B':
+ case 'o':
+ odformat("o2");
+ break;
+ case 'b':
+ odformat("o1");
+ break;
+ case 'c':
+ odformat("c");
+ break;
+ case 'd':
+ odformat("u2");
+ break;
+ case 'D':
+ odformat("u4");
+ break;
+ case 'e': /* undocumented in od */
+ case 'F':
+ odformat("fD");
+ break;
+ case 'f':
+ odformat("fF");
+ break;
+ case 'H':
+ case 'X':
+ odformat("x4");
+ break;
+ case 'h':
+ case 'x':
+ odformat("x2");
+ break;
+ case 'I':
+ case 'L':
+ case 'l':
+ odformat("dL");
+ break;
+ case 'i':
+ odformat("dI");
+ break;
+ case 'j':
+ errno = 0;
+ skip = strtoll(optarg, &end, 0);
+ if (*end == 'b')
+ skip *= 512;
+ else if (*end == 'k')
+ skip *= 1024;
+ else if (*end == 'm')
+ skip *= 1048576L;
+ if (errno != 0 || skip < 0 || strlen(end) > 1)
+ errx(1, "%s: invalid skip amount", optarg);
+ break;
+ case 'N':
+ if ((length = atoi(optarg)) <= 0)
+ errx(1, "%s: invalid length", optarg);
+ break;
+ case 'O':
+ odformat("o4");
+ break;
+ case 's':
+ odformat("d2");
+ break;
+ case 't':
+ odformat(optarg);
+ break;
+ case 'v':
+ vflag = ALL;
+ break;
+ case '?':
+ default:
+ odusage();
+ }
+
+ if (fshead->nextfs->nextfs == NULL)
+ odformat("oS");
+
+ argc -= optind;
+ *argvp += optind;
+
+ if (argc)
+ odoffset(argc, argvp);
+}
+
+static void
+odusage(void)
+{
+
+ fprintf(stderr,
+"usage: od [-aBbcDdeFfHhIiLlOosvXx] [-A base] [-j skip] [-N length] [-t type]\n");
+ fprintf(stderr,
+" [[+]offset[.][Bb]] [file ...]\n");
+ exit(1);
+}
+
+static void
+odoffset(int argc, char ***argvp)
+{
+ char *p, *num, *end;
+ int base;
+
+ /*
+ * The offset syntax of od(1) was genuinely bizarre. First, if
+ * it started with a plus it had to be an offset. Otherwise, if
+ * there were at least two arguments, a number or lower-case 'x'
+ * followed by a number makes it an offset. By default it was
+ * octal; if it started with 'x' or '0x' it was hex. If it ended
+ * in a '.', it was decimal. If a 'b' or 'B' was appended, it
+ * multiplied the number by 512 or 1024 byte units. There was
+ * no way to assign a block count to a hex offset.
+ *
+ * We assume it's a file if the offset is bad.
+ */
+ p = argc == 1 ? (*argvp)[0] : (*argvp)[1];
+
+ if (*p != '+' && (argc < 2 ||
+ (!isdigit(p[0]) && (p[0] != 'x' || !isxdigit(p[1])))))
+ return;
+
+ base = 0;
+ /*
+ * skip over leading '+', 'x[0-9a-fA-f]' or '0x', and
+ * set base.
+ */
+ if (p[0] == '+')
+ ++p;
+ if (p[0] == 'x' && isxdigit(p[1])) {
+ ++p;
+ base = 16;
+ } else if (p[0] == '0' && p[1] == 'x') {
+ p += 2;
+ base = 16;
+ }
+
+ /* skip over the number */
+ if (base == 16)
+ for (num = p; isxdigit(*p); ++p);
+ else
+ for (num = p; isdigit(*p); ++p);
+
+ /* check for no number */
+ if (num == p)
+ return;
+
+ /* if terminates with a '.', base is decimal */
+ if (*p == '.') {
+ if (base)
+ return;
+ base = 10;
+ }
+
+ skip = strtoll(num, &end, base ? base : 8);
+
+ /* if end isn't the same as p, we got a non-octal digit */
+ if (end != p) {
+ skip = 0;
+ return;
+ }
+
+ if (*p) {
+ if (*p == 'B') {
+ skip *= 1024;
+ ++p;
+ } else if (*p == 'b') {
+ skip *= 512;
+ ++p;
+ }
+ }
+
+ if (*p) {
+ skip = 0;
+ return;
+ }
+
+ /*
+ * If the offset uses a non-octal base, the base of the offset
+ * is changed as well. This isn't pretty, but it's easy.
+ */
+ if (base == 16) {
+ fshead->nextfu->fmt[TYPE_OFFSET] = 'x';
+ fshead->nextfs->nextfu->fmt[TYPE_OFFSET] = 'x';
+ } else if (base == 10) {
+ fshead->nextfu->fmt[TYPE_OFFSET] = 'd';
+ fshead->nextfs->nextfu->fmt[TYPE_OFFSET] = 'd';
+ }
+
+ /* Terminate file list. */
+ (*argvp)[1] = NULL;
+}
+
+static void
+odformat(const char *fmt)
+{
+ char fchar;
+
+ while (*fmt != '\0') {
+ switch ((fchar = *fmt++)) {
+ case 'a':
+ odadd("16/1 \"%3_u \" \"\\n\"");
+ break;
+ case 'c':
+ odadd("16/1 \"%3_c \" \"\\n\"");
+ break;
+ case 'o': case 'u': case 'd': case 'x':
+ fmt = odformatint(fchar, fmt);
+ break;
+ case 'f':
+ fmt = odformatfp(fchar, fmt);
+ break;
+ default:
+ errx(1, "%c: unrecognised format character", fchar);
+ }
+ }
+}
+
+static const char *
+odformatfp(char fchar __unused, const char *fmt)
+{
+ size_t isize;
+ int digits;
+ char *end, *hdfmt;
+
+ isize = sizeof(double);
+ switch (*fmt) {
+ case 'F':
+ isize = sizeof(float);
+ fmt++;
+ break;
+ case 'D':
+ isize = sizeof(double);
+ fmt++;
+ break;
+ case 'L':
+ isize = sizeof(long double);
+ fmt++;
+ break;
+ default:
+ if (isdigit((unsigned char)*fmt)) {
+ errno = 0;
+ isize = (size_t)strtoul(fmt, &end, 10);
+ if (errno != 0 || isize == 0)
+ errx(1, "%s: invalid size", fmt);
+ fmt = (const char *)end;
+ }
+ }
+ switch (isize) {
+ case sizeof(float):
+ digits = FLT_DIG;
+ break;
+ case sizeof(double):
+ digits = DBL_DIG;
+ break;
+ default:
+ if (isize == sizeof(long double))
+ digits = LDBL_DIG;
+ else
+ errx(1, "unsupported floating point size %lu",
+ (u_long)isize);
+ }
+
+ asprintf(&hdfmt, "%lu/%lu \" %%%d.%de \" \"\\n\"",
+ 16UL / (u_long)isize, (u_long)isize, digits + 8, digits);
+ if (hdfmt == NULL)
+ err(1, NULL);
+ odadd(hdfmt);
+ free(hdfmt);
+
+ return (fmt);
+}
+
+static const char *
+odformatint(char fchar, const char *fmt)
+{
+ unsigned long long n;
+ size_t isize;
+ int digits;
+ char *end, *hdfmt;
+
+ isize = sizeof(int);
+ switch (*fmt) {
+ case 'C':
+ isize = sizeof(char);
+ fmt++;
+ break;
+ case 'I':
+ isize = sizeof(int);
+ fmt++;
+ break;
+ case 'L':
+ isize = sizeof(long);
+ fmt++;
+ break;
+ case 'S':
+ isize = sizeof(short);
+ fmt++;
+ break;
+ default:
+ if (isdigit((unsigned char)*fmt)) {
+ errno = 0;
+ isize = (size_t)strtoul(fmt, &end, 10);
+ if (errno != 0 || isize == 0)
+ errx(1, "%s: invalid size", fmt);
+ if (isize != sizeof(char) && isize != sizeof(short) &&
+ isize != sizeof(int) && isize != sizeof(long))
+ errx(1, "unsupported int size %lu",
+ (u_long)isize);
+ fmt = (const char *)end;
+ }
+ }
+
+ /*
+ * Calculate the maximum number of digits we need to
+ * fit the number. Overestimate for decimal with log
+ * base 8. We need one extra space for signed numbers
+ * to store the sign.
+ */
+ n = (1ULL << (8 * isize)) - 1;
+ digits = 0;
+ while (n != 0) {
+ digits++;
+ n >>= (fchar == 'x') ? 4 : 3;
+ }
+ if (fchar == 'd')
+ digits++;
+ asprintf(&hdfmt, "%lu/%lu \"%*s%%%s%d%c\" \"\\n\"",
+ 16UL / (u_long)isize, (u_long)isize, (int)(4 * isize - digits),
+ "", (fchar == 'd' || fchar == 'u') ? "" : "0", digits, fchar);
+ if (hdfmt == NULL)
+ err(1, NULL);
+ odadd(hdfmt);
+ free(hdfmt);
+
+ return (fmt);
+}
+
+static void
+odadd(const char *fmt)
+{
+ static int needpad;
+
+ if (needpad)
+ add("\""PADDING"\"");
+ add(fmt);
+ needpad = 1;
+}
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
new file mode 100644
index 0000000..1e06120
--- /dev/null
+++ b/usr.bin/hexdump/parse.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (c) 1989, 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
+#if 0
+static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include "hexdump.h"
+
+FU *endfu; /* format at end-of-data */
+
+void
+addfile(const char *name)
+{
+ unsigned char *p;
+ FILE *fp;
+ int ch;
+ char buf[2048 + 1];
+
+ if ((fp = fopen(name, "r")) == NULL)
+ err(1, "%s", name);
+ while (fgets(buf, sizeof(buf), fp)) {
+ if (!(p = strchr(buf, '\n'))) {
+ warnx("line too long");
+ while ((ch = getchar()) != '\n' && ch != EOF);
+ continue;
+ }
+ *p = '\0';
+ for (p = buf; *p && isspace(*p); ++p);
+ if (!*p || *p == '#')
+ continue;
+ add(p);
+ }
+ (void)fclose(fp);
+}
+
+void
+add(const char *fmt)
+{
+ unsigned const char *p, *savep;
+ static FS **nextfs;
+ FS *tfs;
+ FU *tfu, **nextfu;
+
+ /* start new linked list of format units */
+ if ((tfs = calloc(1, sizeof(FS))) == NULL)
+ err(1, NULL);
+ if (!fshead)
+ fshead = tfs;
+ else
+ *nextfs = tfs;
+ nextfs = &tfs->nextfs;
+ nextfu = &tfs->nextfu;
+
+ /* take the format string and break it up into format units */
+ for (p = fmt;;) {
+ /* skip leading white space */
+ for (; isspace(*p); ++p);
+ if (!*p)
+ break;
+
+ /* allocate a new format unit and link it in */
+ if ((tfu = calloc(1, sizeof(FU))) == NULL)
+ err(1, NULL);
+ *nextfu = tfu;
+ nextfu = &tfu->nextfu;
+ tfu->reps = 1;
+
+ /* if leading digit, repetition count */
+ if (isdigit(*p)) {
+ for (savep = p; isdigit(*p); ++p);
+ if (!isspace(*p) && *p != '/')
+ badfmt(fmt);
+ /* may overwrite either white space or slash */
+ tfu->reps = atoi(savep);
+ tfu->flags = F_SETREP;
+ /* skip trailing white space */
+ for (++p; isspace(*p); ++p);
+ }
+
+ /* skip slash and trailing white space */
+ if (*p == '/')
+ while (isspace(*++p));
+
+ /* byte count */
+ if (isdigit(*p)) {
+ for (savep = p; isdigit(*p); ++p);
+ if (!isspace(*p))
+ badfmt(fmt);
+ tfu->bcnt = atoi(savep);
+ /* skip trailing white space */
+ for (++p; isspace(*p); ++p);
+ }
+
+ /* format */
+ if (*p != '"')
+ badfmt(fmt);
+ for (savep = ++p; *p != '"';)
+ if (*p++ == 0)
+ badfmt(fmt);
+ if (!(tfu->fmt = malloc(p - savep + 1)))
+ err(1, NULL);
+ (void) strlcpy(tfu->fmt, savep, p - savep + 1);
+ escape(tfu->fmt);
+ p++;
+ }
+}
+
+static const char *spec = ".#-+ 0123456789";
+
+int
+size(FS *fs)
+{
+ FU *fu;
+ int bcnt, cursize;
+ unsigned char *fmt;
+ int prec;
+
+ /* figure out the data block size needed for each format unit */
+ for (cursize = 0, fu = fs->nextfu; fu; fu = fu->nextfu) {
+ if (fu->bcnt) {
+ cursize += fu->bcnt * fu->reps;
+ continue;
+ }
+ for (bcnt = prec = 0, fmt = fu->fmt; *fmt; ++fmt) {
+ if (*fmt != '%')
+ continue;
+ /*
+ * skip any special chars -- save precision in
+ * case it's a %s format.
+ */
+ while (strchr(spec + 1, *++fmt));
+ if (*fmt == '.' && isdigit(*++fmt)) {
+ prec = atoi(fmt);
+ while (isdigit(*++fmt));
+ }
+ switch(*fmt) {
+ case 'c':
+ bcnt += 1;
+ break;
+ case 'd': case 'i': case 'o': case 'u':
+ case 'x': case 'X':
+ bcnt += 4;
+ break;
+ case 'e': case 'E': case 'f': case 'g': case 'G':
+ bcnt += 8;
+ break;
+ case 's':
+ bcnt += prec;
+ break;
+ case '_':
+ switch(*++fmt) {
+ case 'c': case 'p': case 'u':
+ bcnt += 1;
+ break;
+ }
+ }
+ }
+ cursize += bcnt * fu->reps;
+ }
+ return (cursize);
+}
+
+void
+rewrite(FS *fs)
+{
+ enum { NOTOKAY, USEBCNT, USEPREC } sokay;
+ PR *pr, **nextpr;
+ FU *fu;
+ unsigned char *p1, *p2, *fmtp;
+ char savech, cs[3];
+ int nconv, prec;
+ size_t len;
+
+ prec = 0;
+
+ for (fu = fs->nextfu; fu; fu = fu->nextfu) {
+ /*
+ * Break each format unit into print units; each conversion
+ * character gets its own.
+ */
+ nextpr = &fu->nextpr;
+ for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
+ if ((pr = calloc(1, sizeof(PR))) == NULL)
+ err(1, NULL);
+ *nextpr = pr;
+
+ /* Skip preceding text and up to the next % sign. */
+ for (p1 = fmtp; *p1 && *p1 != '%'; ++p1);
+
+ /* Only text in the string. */
+ if (!*p1) {
+ pr->fmt = fmtp;
+ pr->flags = F_TEXT;
+ break;
+ }
+
+ /*
+ * Get precision for %s -- if have a byte count, don't
+ * need it.
+ */
+ if (fu->bcnt) {
+ sokay = USEBCNT;
+ /* Skip to conversion character. */
+ for (++p1; strchr(spec, *p1); ++p1);
+ } else {
+ /* Skip any special chars, field width. */
+ while (strchr(spec + 1, *++p1));
+ if (*p1 == '.' && isdigit(*++p1)) {
+ sokay = USEPREC;
+ prec = atoi(p1);
+ while (isdigit(*++p1));
+ } else
+ sokay = NOTOKAY;
+ }
+
+ p2 = *p1 ? p1 + 1 : p1; /* Set end pointer -- make sure
+ * that it's non-NUL/-NULL first
+ * though. */
+ cs[0] = *p1; /* Set conversion string. */
+ cs[1] = '\0';
+
+ /*
+ * Figure out the byte count for each conversion;
+ * rewrite the format as necessary, set up blank-
+ * padding for end of data.
+ */
+ switch(cs[0]) {
+ case 'c':
+ pr->flags = F_CHAR;
+ switch(fu->bcnt) {
+ case 0: case 1:
+ pr->bcnt = 1;
+ break;
+ default:
+ p1[1] = '\0';
+ badcnt(p1);
+ }
+ break;
+ case 'd': case 'i':
+ pr->flags = F_INT;
+ goto isint;
+ case 'o': case 'u': case 'x': case 'X':
+ pr->flags = F_UINT;
+isint: cs[2] = '\0';
+ cs[1] = cs[0];
+ cs[0] = 'q';
+ switch(fu->bcnt) {
+ case 0: case 4:
+ pr->bcnt = 4;
+ break;
+ case 1:
+ pr->bcnt = 1;
+ break;
+ case 2:
+ pr->bcnt = 2;
+ break;
+ default:
+ p1[1] = '\0';
+ badcnt(p1);
+ }
+ break;
+ case 'e': case 'E': case 'f': case 'g': case 'G':
+ pr->flags = F_DBL;
+ switch(fu->bcnt) {
+ case 0: case 8:
+ pr->bcnt = 8;
+ break;
+ case 4:
+ pr->bcnt = 4;
+ break;
+ default:
+ if (fu->bcnt == sizeof(long double)) {
+ cs[2] = '\0';
+ cs[1] = cs[0];
+ cs[0] = 'L';
+ pr->bcnt = sizeof(long double);
+ } else {
+ p1[1] = '\0';
+ badcnt(p1);
+ }
+ }
+ break;
+ case 's':
+ pr->flags = F_STR;
+ switch(sokay) {
+ case NOTOKAY:
+ badsfmt();
+ case USEBCNT:
+ pr->bcnt = fu->bcnt;
+ break;
+ case USEPREC:
+ pr->bcnt = prec;
+ break;
+ }
+ break;
+ case '_':
+ ++p2;
+ switch(p1[1]) {
+ case 'A':
+ endfu = fu;
+ fu->flags |= F_IGNORE;
+ /* FALLTHROUGH */
+ case 'a':
+ pr->flags = F_ADDRESS;
+ ++p2;
+ switch(p1[2]) {
+ case 'd': case 'o': case'x':
+ cs[0] = 'q';
+ cs[1] = p1[2];
+ cs[2] = '\0';
+ break;
+ default:
+ p1[3] = '\0';
+ badconv(p1);
+ }
+ break;
+ case 'c':
+ pr->flags = F_C;
+ /* cs[0] = 'c'; set in conv_c */
+ goto isint2;
+ case 'p':
+ pr->flags = F_P;
+ cs[0] = 'c';
+ goto isint2;
+ case 'u':
+ pr->flags = F_U;
+ /* cs[0] = 'c'; set in conv_u */
+isint2: switch(fu->bcnt) {
+ case 0: case 1:
+ pr->bcnt = 1;
+ break;
+ default:
+ p1[2] = '\0';
+ badcnt(p1);
+ }
+ break;
+ default:
+ p1[2] = '\0';
+ badconv(p1);
+ }
+ break;
+ default:
+ p1[1] = '\0';
+ badconv(p1);
+ }
+
+ /*
+ * Copy to PR format string, set conversion character
+ * pointer, update original.
+ */
+ savech = *p2;
+ p1[0] = '\0';
+ len = strlen(fmtp) + strlen(cs) + 1;
+ if ((pr->fmt = calloc(1, len)) == NULL)
+ err(1, NULL);
+ snprintf(pr->fmt, len, "%s%s", fmtp, cs);
+ *p2 = savech;
+ pr->cchar = pr->fmt + (p1 - fmtp);
+ fmtp = p2;
+
+ /* Only one conversion character if byte count. */
+ if (!(pr->flags&F_ADDRESS) && fu->bcnt && nconv++)
+ errx(1, "byte count with multiple conversion characters");
+ }
+ /*
+ * If format unit byte count not specified, figure it out
+ * so can adjust rep count later.
+ */
+ if (!fu->bcnt)
+ for (pr = fu->nextpr; pr; pr = pr->nextpr)
+ fu->bcnt += pr->bcnt;
+ }
+ /*
+ * If the format string interprets any data at all, and it's
+ * not the same as the blocksize, and its last format unit
+ * interprets any data at all, and has no iteration count,
+ * repeat it as necessary.
+ *
+ * If, rep count is greater than 1, no trailing whitespace
+ * gets output from the last iteration of the format unit.
+ */
+ for (fu = fs->nextfu; fu; fu = fu->nextfu) {
+ if (!fu->nextfu && fs->bcnt < blocksize &&
+ !(fu->flags&F_SETREP) && fu->bcnt)
+ fu->reps += (blocksize - fs->bcnt) / fu->bcnt;
+ if (fu->reps > 1) {
+ for (pr = fu->nextpr;; pr = pr->nextpr)
+ if (!pr->nextpr)
+ break;
+ for (p1 = pr->fmt, p2 = NULL; *p1; ++p1)
+ p2 = isspace(*p1) ? p1 : NULL;
+ if (p2)
+ pr->nospace = p2;
+ }
+ }
+#ifdef DEBUG
+ for (fu = fs->nextfu; fu; fu = fu->nextfu) {
+ (void)printf("fmt:");
+ for (pr = fu->nextpr; pr; pr = pr->nextpr)
+ (void)printf(" {%s}", pr->fmt);
+ (void)printf("\n");
+ }
+#endif
+}
+
+void
+escape(char *p1)
+{
+ char *p2;
+
+ /* alphabetic escape sequences have to be done in place */
+ for (p2 = p1;; p1++, p2++) {
+ if (*p1 == '\\') {
+ p1++;
+ switch(*p1) {
+ case '\0':
+ *p2 = '\\';
+ *++p2 = '\0';
+ return;
+ case 'a':
+ /* *p2 = '\a'; */
+ *p2 = '\007';
+ break;
+ case 'b':
+ *p2 = '\b';
+ break;
+ case 'f':
+ *p2 = '\f';
+ break;
+ case 'n':
+ *p2 = '\n';
+ break;
+ case 'r':
+ *p2 = '\r';
+ break;
+ case 't':
+ *p2 = '\t';
+ break;
+ case 'v':
+ *p2 = '\v';
+ break;
+ default:
+ *p2 = *p1;
+ break;
+ }
+ } else {
+ *p2 = *p1;
+ if (*p1 == '\0')
+ return;
+ }
+ }
+}
+
+void
+badcnt(const char *s)
+{
+ errx(1, "%s: bad byte count", s);
+}
+
+void
+badsfmt(void)
+{
+ errx(1, "%%s: requires a precision or a byte count");
+}
+
+void
+badfmt(const char *fmt)
+{
+ errx(1, "\"%s\": bad format", fmt);
+}
+
+void
+badconv(const char *ch)
+{
+ errx(1, "%%%s: bad conversion character", ch);
+}
diff --git a/usr.bin/host/Makefile b/usr.bin/host/Makefile
new file mode 100644
index 0000000..5c2ce52
--- /dev/null
+++ b/usr.bin/host/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+LDNSDIR= ${.CURDIR}/../../contrib/ldns
+LDNSHOSTDIR= ${.CURDIR}/../../contrib/ldns-host
+
+.PATH: ${LDNSHOSTDIR}
+
+PROG= host
+SRCS= ldns-host.c
+MAN= host.1
+CLEANFILES+= host.1
+
+host.1: ldns-host.1
+ sed -e 's/ldns-//gI' <${.ALLSRC} >${.TARGET} || \
+ (rm -rf ${.TARGET} ; false)
+
+CFLAGS+= -I${LDNSDIR}
+LIBADD= ldns
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/host/Makefile.depend b/usr.bin/host/Makefile.depend
new file mode 100644
index 0000000..0c13258
--- /dev/null
+++ b/usr.bin/host/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libldns \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/iconv/Makefile b/usr.bin/iconv/Makefile
new file mode 100644
index 0000000..b920eb1
--- /dev/null
+++ b/usr.bin/iconv/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+# $NetBSD: Makefile,v 1.6 2009/04/14 22:15:21 lukem Exp $
+
+.include <bsd.own.mk>
+
+PROG= iconv
+#SRCS= iconv.c
+MAN= iconv.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/iconv/Makefile.depend b/usr.bin/iconv/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/iconv/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/iconv/iconv.1 b/usr.bin/iconv/iconv.1
new file mode 100644
index 0000000..3018a4b
--- /dev/null
+++ b/usr.bin/iconv/iconv.1
@@ -0,0 +1,119 @@
+.\" $FreeBSD$
+.\" $NetBSD: iconv.1,v 1.3 2008/03/20 11:35:44 tnozaki Exp $
+.\"
+.\" Copyright (c)2003 Citrus Project,
+.\" 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.
+.\"
+.Dd October 22, 2009
+.Dt ICONV 1
+.Os
+.Sh NAME
+.Nm iconv
+.Nd codeset conversion utility
+.Sh SYNOPSIS
+.Nm
+.Op Fl cs
+.Fl f
+.Ar from_name
+.Fl t
+.Ar to_name
+.Op Ar file ...
+.Nm
+.Fl f
+.Ar from_name
+.Op Fl cs
+.Op Fl t Ar to_name
+.Op Ar file ...
+.Nm
+.Fl t
+.Ar to_name
+.Op Fl cs
+.Op Fl f Ar from_name
+.Op Ar file ...
+.Nm
+.Fl l
+.Sh DESCRIPTION
+The
+.Nm
+utility converts the codeset of
+.Ar file
+(or from standard input if no file is specified) from codeset
+.Ar from_name
+to codeset
+.Ar to_name
+and outputs the
+converted text on standard output.
+.Pp
+The following options are available:
+.Bl -tag -width 0123
+.It Fl c
+Prevent output of any invalid characters.
+By default,
+.Nm
+outputs an
+.Dq invalid character
+specified by the
+.Ar to_name
+codeset when it encounts a character which is valid in the
+.Ar from_name
+codeset but does not have a corresponding character in the
+.Ar to_name
+codeset.
+.It Fl f
+Specifies the source codeset name as
+.Ar from_name .
+.It Fl l
+Lists available codeset names.
+Note that not all combinations of
+.Ar from_name
+and
+.Ar to_name
+are valid.
+.It Fl s
+Silent.
+By default,
+.Nm
+outputs the number of
+.Dq invalid characters
+to standard error if they exist.
+This option prevents this behaviour.
+.It Fl t
+Specifies the destination codeset name as
+.Ar to_name .
+.El
+.Sh EXIT STATUS
+.Ex -std iconv
+.Sh SEE ALSO
+.Xr mkcsmapper 1 ,
+.Xr mkesdb 1 ,
+.Xr iconv 3
+.Sh STANDARDS
+.Nm
+conform to
+.St -p1003.1-2008 .
+.Sh HISTORY
+.Nm
+first appeared in
+.Nx 2.0 , and made its appearance in
+.Fx 9.0 .
diff --git a/usr.bin/iconv/iconv.c b/usr.bin/iconv/iconv.c
new file mode 100644
index 0000000..161b22e
--- /dev/null
+++ b/usr.bin/iconv/iconv.c
@@ -0,0 +1,219 @@
+/* $FreeBSD$ */
+/* $NetBSD: iconv.c,v 1.16 2009/02/20 15:28:21 yamt Exp $ */
+
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * 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>
+
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <iconv.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+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 const struct option long_options[] = {
+ {"from-code", required_argument, NULL, 'f'},
+ {"list", no_argument, NULL, 'l'},
+ {"silent", no_argument, NULL, 's'},
+ {"to-code", required_argument, NULL, 't'},
+ {NULL, no_argument, NULL, 0}
+};
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "Usage:\t%1$s [-cs] -f <from_code> -t <to_code> [file ...]\n"
+ "\t%1$s -f <from_code> [-cs] [-t <to_code>] [file ...]\n"
+ "\t%1$s -t <to_code> [-cs] [-f <from_code>] [file ...]\n"
+ "\t%1$s -l\n", getprogname());
+ exit(1);
+}
+
+#define INBUFSIZE 1024
+#define OUTBUFSIZE (INBUFSIZE * 2)
+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], *in, *out;
+ unsigned long long invalids;
+ size_t inbytes, outbytes, ret;
+
+ if ((cd = iconv_open(to, from)) == (iconv_t)-1)
+ err(EXIT_FAILURE, "iconv_open(%s, %s)", to, from);
+
+ if (hide_invalid) {
+ int arg = 1;
+
+ if (iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, (void *)&arg) == -1)
+ err(EXIT_FAILURE, NULL);
+ }
+ invalids = 0;
+ while ((inbytes = fread(inbuf, 1, INBUFSIZE, fp)) > 0) {
+ in = inbuf;
+ while (inbytes > 0) {
+ size_t inval;
+
+ out = outbuf;
+ outbytes = OUTBUFSIZE;
+ ret = __iconv(cd, &in, &inbytes, &out, &outbytes,
+ 0, &inval);
+ invalids += inval;
+ if (outbytes < OUTBUFSIZE)
+ (void)fwrite(outbuf, 1, OUTBUFSIZE - outbytes,
+ stdout);
+ if (ret == (size_t)-1 && errno != E2BIG) {
+ if (errno != EINVAL || in == inbuf)
+ err(EXIT_FAILURE, "iconv()");
+
+ /* incomplete input character */
+ (void)memmove(inbuf, in, inbytes);
+ ret = fread(inbuf + inbytes, 1,
+ INBUFSIZE - inbytes, fp);
+ if (ret == 0) {
+ fflush(stdout);
+ if (feof(fp))
+ errx(EXIT_FAILURE,
+ "unexpected end of file; "
+ "the last character is "
+ "incomplete.");
+ else
+ err(EXIT_FAILURE, "fread()");
+ }
+ in = inbuf;
+ inbytes += ret;
+ }
+ }
+ }
+ /* reset the shift state of the output buffer */
+ outbytes = OUTBUFSIZE;
+ out = outbuf;
+ ret = iconv(cd, NULL, NULL, &out, &outbytes);
+ if (ret == (size_t)-1)
+ err(EXIT_FAILURE, "iconv()");
+ if (outbytes < OUTBUFSIZE)
+ (void)fwrite(outbuf, 1, OUTBUFSIZE - outbytes, stdout);
+
+ if (invalids > 0 && !silent)
+ warnx("warning: invalid characters: %llu", invalids);
+
+ iconv_close(cd);
+ return (invalids > 0);
+}
+
+static int
+do_list(unsigned int n, const char * const *list, void *data __unused)
+{
+ unsigned int i;
+
+ for(i = 0; i < n; i++) {
+ printf("%s", list[i]);
+ if (i < n - 1)
+ printf(" ");
+ }
+ printf("\n");
+
+ return (1);
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *fp;
+ const char *opt_f, *opt_t;
+ int ch, i, res;
+ bool opt_c = false, opt_s = false;
+
+ opt_f = opt_t = "";
+
+ setlocale(LC_ALL, "");
+ setprogname(argv[0]);
+
+ while ((ch = getopt_long(argc, argv, "csLlf:t:",
+ long_options, NULL)) != -1) {
+ switch (ch) {
+ case 'c':
+ opt_c = true;
+ break;
+ case 's':
+ opt_s = true;
+ break;
+ case 'l':
+ /* list */
+ if (opt_s || opt_c || strcmp(opt_f, "") != 0 ||
+ strcmp(opt_t, "") != 0) {
+ warnx("-l is not allowed with other flags.");
+ usage();
+ }
+ iconvlist(do_list, NULL);
+ return (EXIT_SUCCESS);
+ case 'f':
+ /* from */
+ if (optarg != NULL)
+ opt_f = optarg;
+ break;
+ case 't':
+ /* to */
+ if (optarg != NULL)
+ opt_t = optarg;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if ((strcmp(opt_f, "") == 0) && (strcmp(opt_t, "") == 0))
+ usage();
+ if (argc == 0)
+ 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]);
+ res |= do_conv(fp, opt_f, opt_t, opt_s, opt_c);
+ (void)fclose(fp);
+ }
+ }
+ return (res == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
diff --git a/usr.bin/id/Makefile b/usr.bin/id/Makefile
new file mode 100644
index 0000000..07cabd0
--- /dev/null
+++ b/usr.bin/id/Makefile
@@ -0,0 +1,15 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= id
+LINKS= ${BINDIR}/id ${BINDIR}/groups
+LINKS+= ${BINDIR}/id ${BINDIR}/whoami
+MAN= id.1 groups.1 whoami.1
+
+.if ${MK_AUDIT} != "no"
+CFLAGS+= -DUSE_BSM_AUDIT
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/id/Makefile.depend b/usr.bin/id/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/id/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/id/groups.1 b/usr.bin/id/groups.1
new file mode 100644
index 0000000..18e39fc
--- /dev/null
+++ b/usr.bin/id/groups.1
@@ -0,0 +1,59 @@
+.\" Copyright (c) 1991, 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.
+.\"
+.\" @(#)groups.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt GROUPS 1
+.Os
+.Sh NAME
+.Nm groups
+.Nd show group memberships
+.Sh SYNOPSIS
+.Nm
+.Op Ar user
+.Sh DESCRIPTION
+The
+.Nm
+utility has been obsoleted by the
+.Xr id 1
+utility, and is equivalent to
+.Dq Nm id Fl Gn Op Ar user .
+The command
+.Dq Nm id Fl p
+is suggested for normal interactive use.
+.Pp
+The
+.Nm
+utility displays the groups to which you (or the optionally specified
+.Ar user )
+belong.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr id 1
diff --git a/usr.bin/id/id.1 b/usr.bin/id/id.1
new file mode 100644
index 0000000..b697678
--- /dev/null
+++ b/usr.bin/id/id.1
@@ -0,0 +1,162 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)id.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 5, 2011
+.Dt ID 1
+.Os
+.Sh NAME
+.Nm id
+.Nd return user identity
+.Sh SYNOPSIS
+.Nm
+.Op Ar user
+.Nm
+.Fl A
+.Nm
+.Fl G Op Fl n
+.Op Ar user
+.Nm
+.Fl M
+.Nm
+.Fl P
+.Op Ar user
+.Nm
+.Fl c
+.Nm
+.Fl g Op Fl nr
+.Op Ar user
+.Nm
+.Fl p
+.Op Ar user
+.Nm
+.Fl u Op Fl nr
+.Op Ar user
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the user and group names and numeric IDs, of the
+calling process, to the standard output.
+If the real and effective IDs are different, both are displayed,
+otherwise only the real ID is displayed.
+.Pp
+If a
+.Ar user
+(login name or user ID)
+is specified, the user and group IDs of that user are displayed.
+In this case, the real and effective IDs are assumed to be the same.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl A
+Display the process audit user ID and other process audit properties, which
+requires privilege.
+.It Fl G
+Display the different group IDs (effective, real and supplementary)
+as white-space separated numbers, in no particular order.
+.It Fl M
+Display the MAC label of the current process.
+.It Fl P
+Display the id as a password file entry.
+.It Fl a
+Ignored for compatibility with other
+.Nm
+implementations.
+.It Fl c
+Display current login class.
+.It Fl g
+Display the effective group ID as a number.
+.It Fl n
+Display the name of the user or group ID for the
+.Fl G ,
+.Fl g
+and
+.Fl u
+options instead of the number.
+If any of the ID numbers cannot be mapped into names, the number will be
+displayed as usual.
+.It Fl p
+Make the output human-readable.
+If the user name returned by
+.Xr getlogin 2
+is different from the login name referenced by the user ID, the name
+returned by
+.Xr getlogin 2
+is displayed, preceded by the keyword
+.Dq login .
+The user ID as a name is displayed, preceded by the keyword
+.Dq uid .
+If the effective user ID is different from the real user ID, the real user
+ID is displayed as a name, preceded by the keyword
+.Dq euid .
+If the effective group ID is different from the real group ID, the real group
+ID is displayed as a name, preceded by the keyword
+.Dq rgid .
+The list of groups to which the user belongs is then displayed as names,
+preceded by the keyword
+.Dq groups .
+Each display is on a separate line.
+.It Fl r
+Display the real ID for the
+.Fl g
+and
+.Fl u
+options instead of the effective ID.
+.It Fl u
+Display the effective user ID as a number.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr who 1
+.Sh STANDARDS
+The
+.Nm
+function is expected to conform to
+.St -p1003.2 .
+.Sh HISTORY
+The
+historic
+.Xr groups 1
+command is equivalent to
+.Dq Nm id Fl Gn Op Ar user .
+.Pp
+The
+historic
+.Xr whoami 1
+command is equivalent to
+.Dq Nm id Fl un .
+.Pp
+The
+.Nm
+command appeared in
+.Bx 4.4 .
diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
new file mode 100644
index 0000000..345e2a6
--- /dev/null
+++ b/usr.bin/id/id.c
@@ -0,0 +1,501 @@
+/*-
+ * Copyright (c) 1991, 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) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)id.c 8.2 (Berkeley) 2/16/94";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/mac.h>
+
+#ifdef USE_BSM_AUDIT
+#include <bsm/audit.h>
+#endif
+
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <pwd.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void id_print(struct passwd *, int, int, int);
+static void pline(struct passwd *);
+static void pretty(struct passwd *);
+#ifdef USE_BSM_AUDIT
+static void auditid(void);
+#endif
+static void group(struct passwd *, int);
+static void maclabel(void);
+static void usage(void);
+static struct passwd *who(char *);
+
+static int isgroups, iswhoami;
+
+int
+main(int argc, char *argv[])
+{
+ struct group *gr;
+ struct passwd *pw;
+ int Gflag, Mflag, Pflag, ch, gflag, id, nflag, pflag, rflag, uflag;
+ int Aflag, cflag;
+ int error;
+ const char *myname;
+ char loginclass[MAXLOGNAME];
+
+ Gflag = Mflag = Pflag = gflag = nflag = pflag = rflag = uflag = 0;
+ Aflag = cflag = 0;
+
+ myname = strrchr(argv[0], '/');
+ myname = (myname != NULL) ? myname + 1 : argv[0];
+ if (strcmp(myname, "groups") == 0) {
+ isgroups = 1;
+ Gflag = nflag = 1;
+ }
+ else if (strcmp(myname, "whoami") == 0) {
+ iswhoami = 1;
+ uflag = nflag = 1;
+ }
+
+ while ((ch = getopt(argc, argv,
+ (isgroups || iswhoami) ? "" : "APGMacgnpru")) != -1)
+ switch(ch) {
+#ifdef USE_BSM_AUDIT
+ case 'A':
+ Aflag = 1;
+ break;
+#endif
+ case 'G':
+ Gflag = 1;
+ break;
+ case 'M':
+ Mflag = 1;
+ break;
+ case 'P':
+ Pflag = 1;
+ break;
+ case 'a':
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'g':
+ gflag = 1;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (iswhoami && argc > 0)
+ usage();
+
+ switch(Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) {
+ case 1:
+ break;
+ case 0:
+ if (!nflag && !rflag)
+ break;
+ /* FALLTHROUGH */
+ default:
+ usage();
+ }
+
+ pw = *argv ? who(*argv) : NULL;
+
+ if (Mflag && pw != NULL)
+ usage();
+
+#ifdef USE_BSM_AUDIT
+ if (Aflag) {
+ auditid();
+ exit(0);
+ }
+#endif
+
+ if (cflag) {
+ error = getloginclass(loginclass, sizeof(loginclass));
+ if (error != 0)
+ err(1, "loginclass");
+ (void)printf("%s\n", loginclass);
+ exit(0);
+ }
+
+ if (gflag) {
+ id = pw ? pw->pw_gid : rflag ? getgid() : getegid();
+ if (nflag && (gr = getgrgid(id)))
+ (void)printf("%s\n", gr->gr_name);
+ else
+ (void)printf("%u\n", id);
+ exit(0);
+ }
+
+ if (uflag) {
+ id = pw ? pw->pw_uid : rflag ? getuid() : geteuid();
+ if (nflag && (pw = getpwuid(id)))
+ (void)printf("%s\n", pw->pw_name);
+ else
+ (void)printf("%u\n", id);
+ exit(0);
+ }
+
+ if (Gflag) {
+ group(pw, nflag);
+ exit(0);
+ }
+
+ if (Mflag) {
+ maclabel();
+ exit(0);
+ }
+
+ if (Pflag) {
+ pline(pw);
+ exit(0);
+ }
+
+ if (pflag) {
+ pretty(pw);
+ exit(0);
+ }
+
+ if (pw) {
+ id_print(pw, 1, 0, 0);
+ }
+ else {
+ id = getuid();
+ pw = getpwuid(id);
+ id_print(pw, 0, 1, 1);
+ }
+ exit(0);
+}
+
+static void
+pretty(struct passwd *pw)
+{
+ struct group *gr;
+ u_int eid, rid;
+ char *login;
+
+ if (pw) {
+ (void)printf("uid\t%s\n", pw->pw_name);
+ (void)printf("groups\t");
+ group(pw, 1);
+ } else {
+ if ((login = getlogin()) == NULL)
+ err(1, "getlogin");
+
+ pw = getpwuid(rid = getuid());
+ if (pw == NULL || strcmp(login, pw->pw_name))
+ (void)printf("login\t%s\n", login);
+ if (pw)
+ (void)printf("uid\t%s\n", pw->pw_name);
+ else
+ (void)printf("uid\t%u\n", rid);
+
+ if ((eid = geteuid()) != rid) {
+ if ((pw = getpwuid(eid)))
+ (void)printf("euid\t%s\n", pw->pw_name);
+ else
+ (void)printf("euid\t%u\n", eid);
+ }
+ if ((rid = getgid()) != (eid = getegid())) {
+ if ((gr = getgrgid(rid)))
+ (void)printf("rgid\t%s\n", gr->gr_name);
+ else
+ (void)printf("rgid\t%u\n", rid);
+ }
+ (void)printf("groups\t");
+ group(NULL, 1);
+ }
+}
+
+static void
+id_print(struct passwd *pw, int use_ggl, int p_euid, int p_egid)
+{
+ struct group *gr;
+ gid_t gid, egid, lastgid;
+ uid_t uid, euid;
+ int cnt, ngroups;
+ long ngroups_max;
+ gid_t *groups;
+ const char *fmt;
+
+ if (pw != NULL) {
+ uid = pw->pw_uid;
+ gid = pw->pw_gid;
+ }
+ else {
+ uid = getuid();
+ gid = getgid();
+ }
+
+ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
+ if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL)
+ err(1, "malloc");
+
+ if (use_ggl && pw != NULL) {
+ ngroups = ngroups_max;
+ getgrouplist(pw->pw_name, gid, groups, &ngroups);
+ }
+ else {
+ ngroups = getgroups(ngroups_max, groups);
+ }
+
+ if (pw != NULL)
+ printf("uid=%u(%s)", uid, pw->pw_name);
+ else
+ printf("uid=%u", getuid());
+ printf(" gid=%u", gid);
+ if ((gr = getgrgid(gid)))
+ (void)printf("(%s)", gr->gr_name);
+ if (p_euid && (euid = geteuid()) != uid) {
+ (void)printf(" euid=%u", euid);
+ if ((pw = getpwuid(euid)))
+ (void)printf("(%s)", pw->pw_name);
+ }
+ if (p_egid && (egid = getegid()) != gid) {
+ (void)printf(" egid=%u", egid);
+ if ((gr = getgrgid(egid)))
+ (void)printf("(%s)", gr->gr_name);
+ }
+ fmt = " groups=%u";
+ for (lastgid = -1, cnt = 0; cnt < ngroups; ++cnt) {
+ if (lastgid == (gid = groups[cnt]))
+ continue;
+ printf(fmt, gid);
+ fmt = ",%u";
+ if ((gr = getgrgid(gid)))
+ printf("(%s)", gr->gr_name);
+ lastgid = gid;
+ }
+ printf("\n");
+ free(groups);
+}
+
+#ifdef USE_BSM_AUDIT
+static void
+auditid(void)
+{
+ auditinfo_t auditinfo;
+ auditinfo_addr_t ainfo_addr;
+ int ret, extended;
+
+ extended = 0;
+ ret = getaudit(&auditinfo);
+ if (ret < 0 && errno == E2BIG) {
+ if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) < 0)
+ err(1, "getaudit_addr");
+ extended = 1;
+ } else if (ret < 0)
+ err(1, "getaudit");
+ if (extended != 0) {
+ (void) printf("auid=%d\n"
+ "mask.success=0x%08x\n"
+ "mask.failure=0x%08x\n"
+ "asid=%d\n"
+ "termid_addr.port=0x%08jx\n"
+ "termid_addr.addr[0]=0x%08x\n"
+ "termid_addr.addr[1]=0x%08x\n"
+ "termid_addr.addr[2]=0x%08x\n"
+ "termid_addr.addr[3]=0x%08x\n",
+ ainfo_addr.ai_auid, ainfo_addr.ai_mask.am_success,
+ ainfo_addr.ai_mask.am_failure, ainfo_addr.ai_asid,
+ (uintmax_t)ainfo_addr.ai_termid.at_port,
+ ainfo_addr.ai_termid.at_addr[0],
+ ainfo_addr.ai_termid.at_addr[1],
+ ainfo_addr.ai_termid.at_addr[2],
+ ainfo_addr.ai_termid.at_addr[3]);
+ } else {
+ (void) printf("auid=%d\n"
+ "mask.success=0x%08x\n"
+ "mask.failure=0x%08x\n"
+ "asid=%d\n"
+ "termid.port=0x%08jx\n"
+ "termid.machine=0x%08x\n",
+ auditinfo.ai_auid, auditinfo.ai_mask.am_success,
+ auditinfo.ai_mask.am_failure,
+ auditinfo.ai_asid, (uintmax_t)auditinfo.ai_termid.port,
+ auditinfo.ai_termid.machine);
+ }
+}
+#endif
+
+static void
+group(struct passwd *pw, int nflag)
+{
+ struct group *gr;
+ int cnt, id, lastid, ngroups;
+ long ngroups_max;
+ gid_t *groups;
+ const char *fmt;
+
+ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
+ if ((groups = malloc(sizeof(gid_t) * (ngroups_max))) == NULL)
+ err(1, "malloc");
+
+ if (pw) {
+ ngroups = ngroups_max;
+ (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
+ } else {
+ ngroups = getgroups(ngroups_max, groups);
+ }
+ fmt = nflag ? "%s" : "%u";
+ for (lastid = -1, cnt = 0; cnt < ngroups; ++cnt) {
+ if (lastid == (id = groups[cnt]))
+ continue;
+ if (nflag) {
+ if ((gr = getgrgid(id)))
+ (void)printf(fmt, gr->gr_name);
+ else
+ (void)printf(*fmt == ' ' ? " %u" : "%u",
+ id);
+ fmt = " %s";
+ } else {
+ (void)printf(fmt, id);
+ fmt = " %u";
+ }
+ lastid = id;
+ }
+ (void)printf("\n");
+ free(groups);
+}
+
+static void
+maclabel(void)
+{
+ char *string;
+ mac_t label;
+ int error;
+
+ error = mac_prepare_process_label(&label);
+ if (error == -1)
+ errx(1, "mac_prepare_type: %s", strerror(errno));
+
+ error = mac_get_proc(label);
+ if (error == -1)
+ errx(1, "mac_get_proc: %s", strerror(errno));
+
+ error = mac_to_text(label, &string);
+ if (error == -1)
+ errx(1, "mac_to_text: %s", strerror(errno));
+
+ (void)printf("%s\n", string);
+ mac_free(label);
+ free(string);
+}
+
+static struct passwd *
+who(char *u)
+{
+ struct passwd *pw;
+ long id;
+ char *ep;
+
+ /*
+ * Translate user argument into a pw pointer. First, try to
+ * get it as specified. If that fails, try it as a number.
+ */
+ if ((pw = getpwnam(u)))
+ return(pw);
+ id = strtol(u, &ep, 10);
+ if (*u && !*ep && (pw = getpwuid(id)))
+ return(pw);
+ errx(1, "%s: no such user", u);
+ /* NOTREACHED */
+}
+
+static void
+pline(struct passwd *pw)
+{
+
+ if (!pw) {
+ if ((pw = getpwuid(getuid())) == NULL)
+ err(1, "getpwuid");
+ }
+
+ (void)printf("%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", pw->pw_name,
+ pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class,
+ (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos,
+ pw->pw_dir, pw->pw_shell);
+}
+
+
+static void
+usage(void)
+{
+
+ if (isgroups)
+ (void)fprintf(stderr, "usage: groups [user]\n");
+ else if (iswhoami)
+ (void)fprintf(stderr, "usage: whoami\n");
+ else
+ (void)fprintf(stderr, "%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
+ "usage: id [user]",
+#ifdef USE_BSM_AUDIT
+ " id -A\n",
+#else
+ "",
+#endif
+ " id -G [-n] [user]",
+ " id -M",
+ " id -P [user]",
+ " id -c",
+ " id -g [-nr] [user]",
+ " id -p [user]",
+ " id -u [-nr] [user]");
+ exit(1);
+}
diff --git a/usr.bin/id/whoami.1 b/usr.bin/id/whoami.1
new file mode 100644
index 0000000..09cbf98
--- /dev/null
+++ b/usr.bin/id/whoami.1
@@ -0,0 +1,56 @@
+.\" Copyright (c) 1991, 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.
+.\"
+.\" @(#)whoami.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt WHOAMI 1
+.Os
+.Sh NAME
+.Nm whoami
+.Nd display effective user id
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility has been obsoleted by the
+.Xr id 1
+utility, and is equivalent to
+.Dq Nm id Fl un .
+The command
+.Dq Nm id Fl p
+is suggested for normal interactive use.
+.Pp
+The
+.Nm
+utility displays your effective user ID as a name.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr id 1
diff --git a/usr.bin/ident/Makefile b/usr.bin/ident/Makefile
new file mode 100644
index 0000000..49798e8
--- /dev/null
+++ b/usr.bin/ident/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= ident
+
+LIBADD= sbuf
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ident/Makefile.depend b/usr.bin/ident/Makefile.depend
new file mode 100644
index 0000000..6002005
--- /dev/null
+++ b/usr.bin/ident/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ident/ident.1 b/usr.bin/ident/ident.1
new file mode 100644
index 0000000..9524980
--- /dev/null
+++ b/usr.bin/ident/ident.1
@@ -0,0 +1,68 @@
+.\" Copyright (c) 2015 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 Jul 25, 2015
+.Dt IDENT 1
+.Os
+.Sh NAME
+.Nm ident
+.Nd identify RCS keyword string in files
+.Sh SYNOPSIS
+.Nm
+.Op Fl q
+.Op Fl V
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility searches for all instances of the pattern
+.Sq $keyword: text$
+in
+.Ar files .
+.Pp
+If no arguments are passed, then
+.Nm
+parses the standard input.
+.Pp
+.Em keyword
+must only be composed of alphanumeric values in the C locale, followed by
+.Sq \&:
+and a space.
+.Pp
+These options are supported:
+.Bl -tag -width "XXX"
+.It Fl q
+Quiet mode: suppress warnings if no pattern found.
+.It Fl V
+Do nothing, added for compatibility with GNU ident.
+.El
+.Sh EXIT STATUS
+.Ex -std ident
+.Sh AUTHORS
+This version of the
+.Nm
+utility was written by
+.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org .
diff --git a/usr.bin/ident/ident.c b/usr.bin/ident/ident.c
new file mode 100644
index 0000000..36e56a0
--- /dev/null
+++ b/usr.bin/ident/ident.c
@@ -0,0 +1,242 @@
+/*-
+ * Copyright (c) 2015 Baptiste Daroussin <bapt@FreeBSD.org>
+ * Copyright (c) 2015 Xin LI <delphij@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/types.h>
+#include <sys/sbuf.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <xlocale.h>
+
+typedef enum {
+ /* state condition to transit to next state */
+ INIT, /* '$' */
+ DELIM_SEEN, /* letter */
+ KEYWORD, /* punctuation mark */
+ PUNC_SEEN, /* ':' -> _SVN; space -> TEXT */
+ PUNC_SEEN_SVN, /* space */
+ TEXT
+} analyzer_states;
+
+static int
+scan(FILE *fp, const char *name, bool quiet)
+{
+ int c;
+ bool hasid = false;
+ bool subversion = false;
+ analyzer_states state = INIT;
+ struct sbuf *id = sbuf_new_auto();
+ locale_t l;
+
+ l = newlocale(LC_ALL_MASK, "C", NULL);
+
+ if (name != NULL)
+ printf("%s:\n", name);
+
+ while ((c = fgetc(fp)) != EOF) {
+ switch (state) {
+ case INIT:
+ if (c == '$') {
+ /* Transit to DELIM_SEEN if we see $ */
+ state = DELIM_SEEN;
+ } else {
+ /* Otherwise, stay in INIT state */
+ continue;
+ }
+ break;
+ case DELIM_SEEN:
+ if (isalpha_l(c, l)) {
+ /* Transit to KEYWORD if we see letter */
+ sbuf_clear(id);
+ sbuf_putc(id, '$');
+ sbuf_putc(id, c);
+ state = KEYWORD;
+
+ continue;
+ } else if (c == '$') {
+ /* Or, stay in DELIM_SEEN if more $ */
+ continue;
+ } else {
+ /* Otherwise, transit back to INIT */
+ state = INIT;
+ }
+ break;
+ case KEYWORD:
+ sbuf_putc(id, c);
+
+ if (isalpha_l(c, l)) {
+ /*
+ * Stay in KEYWORD if additional letter is seen
+ */
+ continue;
+ } else if (c == ':') {
+ /*
+ * See ':' for the first time, transit to
+ * PUNC_SEEN.
+ */
+ state = PUNC_SEEN;
+ subversion = false;
+ } else if (c == '$') {
+ /*
+ * Incomplete ident. Go back to DELIM_SEEN
+ * state because we see a '$' which could be
+ * the beginning of a keyword.
+ */
+ state = DELIM_SEEN;
+ } else {
+ /*
+ * Go back to INIT state otherwise.
+ */
+ state = INIT;
+ }
+ break;
+ case PUNC_SEEN:
+ case PUNC_SEEN_SVN:
+ sbuf_putc(id, c);
+
+ switch (c) {
+ case ':':
+ /*
+ * If we see '::' (seen : in PUNC_SEEN),
+ * activate subversion treatment and transit
+ * to PUNC_SEEN_SVN state.
+ *
+ * If more than two :'s were seen, the ident
+ * is invalid and we would therefore go back
+ * to INIT state.
+ */
+ if (state == PUNC_SEEN) {
+ state = PUNC_SEEN_SVN;
+ subversion = true;
+ } else {
+ state = INIT;
+ }
+ break;
+ case ' ':
+ /*
+ * A space after ':' or '::' indicates we are at the
+ * last component of potential ident.
+ */
+ state = TEXT;
+ break;
+ default:
+ /* All other characters are invalid */
+ state = INIT;
+ break;
+ }
+ break;
+ case TEXT:
+ sbuf_putc(id, c);
+
+ if (iscntrl_l(c, l)) {
+ /* Control characters are not allowed in this state */
+ state = INIT;
+ } else if (c == '$') {
+ sbuf_finish(id);
+ /*
+ * valid ident should end with a space.
+ *
+ * subversion extension uses '#' to indicate that
+ * the keyword expansion have exceeded the fixed
+ * width, so it is also permitted if we are in
+ * subversion mode. No length check is enforced
+ * because GNU RCS ident(1) does not do it either.
+ */
+ c = sbuf_data(id)[sbuf_len(id) - 2];
+ if (c == ' ' || (subversion && c == '#')) {
+ printf(" %s\n", sbuf_data(id));
+ hasid = true;
+ }
+ state = INIT;
+ }
+ /* Other characters: stay in the state */
+ break;
+ }
+ }
+ sbuf_delete(id);
+ freelocale(l);
+
+ if (!hasid) {
+ if (!quiet)
+ fprintf(stderr, "%s warning: no id keywords in %s\n",
+ getprogname(), name ? name : "standard input");
+
+ return (EXIT_FAILURE);
+ }
+
+ return (EXIT_SUCCESS);
+}
+
+int
+main(int argc, char **argv)
+{
+ bool quiet = false;
+ int ch, i;
+ int ret = EXIT_SUCCESS;
+ FILE *fp;
+
+ while ((ch = getopt(argc, argv, "qV")) != -1) {
+ switch (ch) {
+ case 'q':
+ quiet = true;
+ break;
+ case 'V':
+ /* Do nothing, compat with GNU rcs's ident */
+ return (EXIT_SUCCESS);
+ default:
+ errx(EXIT_FAILURE, "usage: %s [-q] [-V] [file...]",
+ getprogname());
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ return (scan(stdin, NULL, quiet));
+
+ for (i = 0; i < argc; i++) {
+ fp = fopen(argv[i], "r");
+ if (fp == NULL) {
+ warn("%s", argv[i]);
+ ret = EXIT_FAILURE;
+ continue;
+ }
+ if (scan(fp, argv[i], quiet) != EXIT_SUCCESS)
+ ret = EXIT_FAILURE;
+ fclose(fp);
+ }
+
+ return (ret);
+}
diff --git a/usr.bin/ident/tests/Makefile b/usr.bin/ident/tests/Makefile
new file mode 100644
index 0000000..a1c6449
--- /dev/null
+++ b/usr.bin/ident/tests/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= ident
+${PACKAGE}FILES+= \
+ test.in \
+ test.out \
+ testnoid
+
+.include <bsd.test.mk>
diff --git a/usr.bin/ident/tests/Makefile.depend b/usr.bin/ident/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/ident/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ident/tests/ident.sh b/usr.bin/ident/tests/ident.sh
new file mode 100755
index 0000000..5a31182
--- /dev/null
+++ b/usr.bin/ident/tests/ident.sh
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+atf_test_case ident
+ident_body() {
+ atf_check -o file:$(atf_get_srcdir)/test.out \
+ ident < $(atf_get_srcdir)/test.in
+ atf_check -o match:'Foo.*' -s exit:1 \
+ -e inline:"ident warning: no id keywords in $(atf_get_srcdir)/testnoid\n" \
+ ident $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid
+ atf_check -o match:'Foo.*' -s exit:1 \
+ ident -q $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid
+}
+atf_init_test_cases()
+{
+ atf_add_test_case ident
+}
diff --git a/usr.bin/ident/tests/test.in b/usr.bin/ident/tests/test.in
new file mode 100644
index 0000000..6349438
--- /dev/null
+++ b/usr.bin/ident/tests/test.in
@@ -0,0 +1,15 @@
+# tranditional
+ $Foo: bar $ (OK traditional)
+ $$Foo: bar $
+ $$Fo$o: bar $
+ $Fo$o: bar $
+ $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :)
+ $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :)
+ $Foo: bar $ (WRONG -- NO SPACE AFTER :)
+ $Foo:bar $ (WRONG -- NO SPACE AFTER :)
+ $Foo: bar$ (WRONG -- NO SPACE BEFORE $))
+# Subversion like
+ $Bar:: baz$ (WRONG -- NO SPACE BEFORE $)
+ $Bar:: baz $ (OK -- SPACE BEFORE $)
+ $Qux:: frobby zow#$ (OK -- HASH BEFORE $)' '
+
diff --git a/usr.bin/ident/tests/test.out b/usr.bin/ident/tests/test.out
new file mode 100644
index 0000000..36cccc9
--- /dev/null
+++ b/usr.bin/ident/tests/test.out
@@ -0,0 +1,6 @@
+ $Foo: bar $
+ $Foo: bar $
+ $o: bar $
+ $o: bar $
+ $Bar:: baz $
+ $Qux:: frobby zow#$
diff --git a/usr.bin/ident/tests/testnoid b/usr.bin/ident/tests/testnoid
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/ident/tests/testnoid
diff --git a/usr.bin/indent/Makefile b/usr.bin/indent/Makefile
new file mode 100644
index 0000000..dcd7e39
--- /dev/null
+++ b/usr.bin/indent/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= indent
+SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/indent/Makefile.depend b/usr.bin/indent/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/indent/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/indent/README b/usr.bin/indent/README
new file mode 100644
index 0000000..03d5d3d
--- /dev/null
+++ b/usr.bin/indent/README
@@ -0,0 +1,100 @@
+
+ $FreeBSD$
+
+This is the C indenter, it originally came from the University of Illinois
+via some distribution tape for PDP-11 Unix. It has subsequently been
+hacked upon by James Gosling @ CMU. It isn't very pretty, and really needs
+to be completely redone, but it is probably the nicest C pretty printer
+around.
+
+Further additions to provide "Kernel Normal Form" were contributed
+by the folks at Sun Microsystems.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+> From mnetor!yunexus!oz@uunet.UU.NET Wed Mar 9 15:30:55 1988
+> Date: Tue, 8 Mar 88 18:36:25 EST
+> From: yunexus!oz@uunet.UU.NET (Ozan Yigit)
+> To: bostic@okeeffe.berkeley.edu
+> Cc: ccvaxa!willcox@uunet.UU.NET, jag@sun.com, rsalz@uunet.UU.NET
+> In-Reply-To: Keith Bostic's message of Tue, 16 Feb 88 16:09:06 PST
+> Subject: Re: Indent...
+
+Thank you for your response about indent. I was wrong in my original
+observation (or mis-observation :-). UCB did keep the Illinois
+copyright intact.
+
+The issue still is whether we can distribute indent, and if we can, which
+version. David Willcox (the author) states that:
+
+| Several people have asked me on what basis I claim that indent is in
+| the public domain. I knew I would be sorry I made that posting.
+|
+| Some history. Way back in 1976, the project I worked on at the
+| University of Illinois Center for Advanced Computation had a huge
+| battle about how to format C code. After about a week of fighting, I
+| got disgusted and wrote a program, which I called indent, to reformat C
+| code. It had a bunch of different options that would let you format
+| the output the way you liked. In particular, all of the different
+| formats being championed were supported.
+|
+| It was my first big C program. It was ugly. It wasn't designed, it
+| just sort of grew. But it pretty much worked, and it stopped most of
+| the fighting.
+|
+| As a matter of form, I included a University of Illinois Copyright
+| notice. However, my understanding was that, since the work was done
+| on an ARPA contract, it was in the public domain.
+|
+| Time passed. Some years later, indent showed up on one of the early
+| emacs distributions.
+|
+| Later still, someone from UC Berkeley called the UofI and asked if
+| indent was in the public domain. They wanted to include it in their
+| UNIX distributions, along with the emacs stuff. I was no longer at the
+| UofI, but Rob Kolstad, who was, asked me about it. I told him I didn't
+| care if they used it, and since then it has been on the BSD distributions.
+|
+| Somewhere along the way, several other unnamed people have had their
+| hands in it. It was converted to understand version 7 C. (The
+| original was version 6.) It was converted from its original filter
+| interface to its current "blow away the user's file" interface.
+| The $HOME/.indent.pro file parsing was added. Some more formatting
+| options were added.
+|
+| The source I have right now has two copyright notices. One is the
+| original from the UofI. One is from Berkeley.
+|
+| I am not a lawyer, and I certainly do not understand copyright law. As
+| far as I am concerned, the bulk of this program, everything covered by
+| the UofI copyright, is in the public domain, and worth every penny.
+| Berkeley's copyright probably should only cover their changes, and I
+| don't know their feelings about sending it out.
+
+In any case, there appears to be none at UofI to clarify/and change
+that copyright, but I am confident (based on the statements of its
+author) that the code, as it stands with its copyright, is
+distributable, and will not cause any legal problems.
+
+Hence, the issue reduces to *which* one to distribute through
+comp.sources.unix. I would suggest that with the permission of you
+folks (given that you have parts copyrighted), we distribute the 4.3
+version of indent, which appears to be the most up-to-date version. I
+happen to have just about every known version of indent, including the
+very original submission from the author to a unix tape, later the
+G-Emacs version, any 4.n version, sun version and the Unipress
+version. I still think we should not have to "go-back-in-time" and
+re-do all the work you people have done.
+
+I hope to hear from you as to what you think about this. You may of
+course send 4.3 version to the moderator directly, or you can let me
+know of your permission, and I will send the sources, or you can let
+me know that 4.3 version is off-limits, in which case we would probably
+have to revert to an older version. One way or another, I hope to get
+a version of indent to comp.sources.unix.
+
+regards.. oz
+
+cc: ccvaxa!willcox
+ sun.com!jar
+ uunet!rsalz
+
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c
new file mode 100644
index 0000000..cab0f7d
--- /dev/null
+++ b/usr.bin/indent/args.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Argument scanning and profile reading code. Default parameters are set
+ * here as well.
+ */
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "indent_globs.h"
+#include "indent.h"
+
+/* profile types */
+#define PRO_SPECIAL 1 /* special case */
+#define PRO_BOOL 2 /* boolean */
+#define PRO_INT 3 /* integer */
+#define PRO_FONT 4 /* troff font */
+
+/* profile specials for booleans */
+#define ON 1 /* turn it on */
+#define OFF 0 /* turn it off */
+
+/* profile specials for specials */
+#define IGN 1 /* ignore it */
+#define CLI 2 /* case label indent (float) */
+#define STDIN 3 /* use stdin */
+#define KEY 4 /* type (keyword) */
+
+static void scan_profile(FILE *);
+
+const char *option_source = "?";
+
+/*
+ * N.B.: because of the way the table here is scanned, options whose names are
+ * substrings of other options must occur later; that is, with -lp vs -l, -lp
+ * must be first. Also, while (most) booleans occur more than once, the last
+ * default value is the one actually assigned.
+ */
+struct pro {
+ const char *p_name; /* name, e.g. -bl, -cli */
+ int p_type; /* type (int, bool, special) */
+ int p_default; /* the default value (if int) */
+ int p_special; /* depends on type */
+ int *p_obj; /* the associated variable */
+} pro[] = {
+
+ {"T", PRO_SPECIAL, 0, KEY, 0},
+ {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation},
+ {"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop},
+ {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations},
+ {"bap", PRO_BOOL, false, ON, &blanklines_after_procs},
+ {"bbb", PRO_BOOL, false, ON, &blanklines_before_blockcomments},
+ {"bc", PRO_BOOL, true, OFF, &ps.leave_comma},
+ {"bl", PRO_BOOL, true, OFF, &btype_2},
+ {"br", PRO_BOOL, true, ON, &btype_2},
+ {"bs", PRO_BOOL, false, ON, &Bill_Shannon},
+ {"cdb", PRO_BOOL, true, ON, &comment_delimiter_on_blankline},
+ {"cd", PRO_INT, 0, 0, &ps.decl_com_ind},
+ {"ce", PRO_BOOL, true, ON, &cuddle_else},
+ {"ci", PRO_INT, 0, 0, &continuation_indent},
+ {"cli", PRO_SPECIAL, 0, CLI, 0},
+ {"c", PRO_INT, 33, 0, &ps.com_ind},
+ {"di", PRO_INT, 16, 0, &ps.decl_indent},
+ {"dj", PRO_BOOL, false, ON, &ps.ljust_decl},
+ {"d", PRO_INT, 0, 0, &ps.unindent_displace},
+ {"eei", PRO_BOOL, false, ON, &extra_expression_indent},
+ {"ei", PRO_BOOL, true, ON, &ps.else_if},
+ {"fbc", PRO_FONT, 0, 0, (int *) &blkcomf},
+ {"fbs", PRO_BOOL, true, ON, &function_brace_split},
+ {"fbx", PRO_FONT, 0, 0, (int *) &boxcomf},
+ {"fb", PRO_FONT, 0, 0, (int *) &bodyf},
+ {"fc1", PRO_BOOL, true, ON, &format_col1_comments},
+ {"fcb", PRO_BOOL, true, ON, &format_block_comments},
+ {"fc", PRO_FONT, 0, 0, (int *) &scomf},
+ {"fk", PRO_FONT, 0, 0, (int *) &keywordf},
+ {"fs", PRO_FONT, 0, 0, (int *) &stringf},
+ {"ip", PRO_BOOL, true, ON, &ps.indent_parameters},
+ {"i", PRO_INT, 8, 0, &ps.ind_size},
+ {"lc", PRO_INT, 0, 0, &block_comment_max_col},
+ {"ldi", PRO_INT, -1, 0, &ps.local_decl_indent},
+ {"lp", PRO_BOOL, true, ON, &lineup_to_parens},
+ {"l", PRO_INT, 78, 0, &max_col},
+ {"nbacc", PRO_BOOL, false, OFF, &blanklines_around_conditional_compilation},
+ {"nbadp", PRO_BOOL, false, OFF, &blanklines_after_declarations_at_proctop},
+ {"nbad", PRO_BOOL, false, OFF, &blanklines_after_declarations},
+ {"nbap", PRO_BOOL, false, OFF, &blanklines_after_procs},
+ {"nbbb", PRO_BOOL, false, OFF, &blanklines_before_blockcomments},
+ {"nbc", PRO_BOOL, true, ON, &ps.leave_comma},
+ {"nbs", PRO_BOOL, false, OFF, &Bill_Shannon},
+ {"ncdb", PRO_BOOL, true, OFF, &comment_delimiter_on_blankline},
+ {"nce", PRO_BOOL, true, OFF, &cuddle_else},
+ {"ndj", PRO_BOOL, false, OFF, &ps.ljust_decl},
+ {"neei", PRO_BOOL, false, OFF, &extra_expression_indent},
+ {"nei", PRO_BOOL, true, OFF, &ps.else_if},
+ {"nfbs", PRO_BOOL, true, OFF, &function_brace_split},
+ {"nfc1", PRO_BOOL, true, OFF, &format_col1_comments},
+ {"nfcb", PRO_BOOL, true, OFF, &format_block_comments},
+ {"nip", PRO_BOOL, true, OFF, &ps.indent_parameters},
+ {"nlp", PRO_BOOL, true, OFF, &lineup_to_parens},
+ {"npcs", PRO_BOOL, false, OFF, &proc_calls_space},
+ {"npro", PRO_SPECIAL, 0, IGN, 0},
+ {"npsl", PRO_BOOL, true, OFF, &procnames_start_line},
+ {"nps", PRO_BOOL, false, OFF, &pointer_as_binop},
+ {"nsc", PRO_BOOL, true, OFF, &star_comment_cont},
+ {"nsob", PRO_BOOL, false, OFF, &swallow_optional_blanklines},
+ {"nut", PRO_BOOL, true, OFF, &use_tabs},
+ {"nv", PRO_BOOL, false, OFF, &verbose},
+ {"pcs", PRO_BOOL, false, ON, &proc_calls_space},
+ {"psl", PRO_BOOL, true, ON, &procnames_start_line},
+ {"ps", PRO_BOOL, false, ON, &pointer_as_binop},
+ {"sc", PRO_BOOL, true, ON, &star_comment_cont},
+ {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines},
+ {"st", PRO_SPECIAL, 0, STDIN, 0},
+ {"ta", PRO_BOOL, false, ON, &auto_typedefs},
+ {"troff", PRO_BOOL, false, ON, &troff},
+ {"ut", PRO_BOOL, true, ON, &use_tabs},
+ {"v", PRO_BOOL, false, ON, &verbose},
+ /* whew! */
+ {0, 0, 0, 0, 0}
+};
+
+/*
+ * set_profile reads $HOME/.indent.pro and ./.indent.pro and handles arguments
+ * given in these files.
+ */
+void
+set_profile(void)
+{
+ FILE *f;
+ char fname[PATH_MAX];
+ static char prof[] = ".indent.pro";
+
+ snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof);
+ if ((f = fopen(option_source = fname, "r")) != NULL) {
+ scan_profile(f);
+ (void) fclose(f);
+ }
+ if ((f = fopen(option_source = prof, "r")) != NULL) {
+ scan_profile(f);
+ (void) fclose(f);
+ }
+ option_source = "Command line";
+}
+
+static void
+scan_profile(FILE *f)
+{
+ int comment, i;
+ char *p;
+ char buf[BUFSIZ];
+
+ while (1) {
+ p = buf;
+ comment = 0;
+ while ((i = getc(f)) != EOF) {
+ if (i == '*' && !comment && p > buf && p[-1] == '/') {
+ comment = p - buf;
+ *p++ = i;
+ } else if (i == '/' && comment && p > buf && p[-1] == '*') {
+ p = buf + comment - 1;
+ comment = 0;
+ } else if (isspace(i)) {
+ if (p > buf && !comment)
+ break;
+ } else {
+ *p++ = i;
+ }
+ }
+ if (p != buf) {
+ *p++ = 0;
+ if (verbose)
+ printf("profile: %s\n", buf);
+ set_option(buf);
+ }
+ else if (i == EOF)
+ return;
+ }
+}
+
+const char *param_start;
+
+static int
+eqin(const char *s1, const char *s2)
+{
+ while (*s1) {
+ if (*s1++ != *s2++)
+ return (false);
+ }
+ param_start = s2;
+ return (true);
+}
+
+/*
+ * Set the defaults.
+ */
+void
+set_defaults(void)
+{
+ struct pro *p;
+
+ /*
+ * Because ps.case_indent is a float, we can't initialize it from the
+ * table:
+ */
+ ps.case_indent = 0.0; /* -cli0.0 */
+ for (p = pro; p->p_name; p++)
+ if (p->p_type != PRO_SPECIAL && p->p_type != PRO_FONT)
+ *p->p_obj = p->p_default;
+}
+
+void
+set_option(char *arg)
+{
+ struct pro *p;
+
+ arg++; /* ignore leading "-" */
+ for (p = pro; p->p_name; p++)
+ if (*p->p_name == *arg && eqin(p->p_name, arg))
+ goto found;
+ errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1);
+found:
+ switch (p->p_type) {
+
+ case PRO_SPECIAL:
+ switch (p->p_special) {
+
+ case IGN:
+ break;
+
+ case CLI:
+ if (*param_start == 0)
+ goto need_param;
+ ps.case_indent = atof(param_start);
+ break;
+
+ case STDIN:
+ if (input == 0)
+ input = stdin;
+ if (output == 0)
+ output = stdout;
+ break;
+
+ case KEY:
+ if (*param_start == 0)
+ goto need_param;
+ {
+ char *str = strdup(param_start);
+ if (str == NULL)
+ err(1, NULL);
+ addkey(str, 4);
+ }
+ break;
+
+ default:
+ errx(1, "set_option: internal error: p_special %d", p->p_special);
+ }
+ break;
+
+ case PRO_BOOL:
+ if (p->p_special == OFF)
+ *p->p_obj = false;
+ else
+ *p->p_obj = true;
+ break;
+
+ case PRO_INT:
+ if (!isdigit(*param_start)) {
+ need_param:
+ errx(1, "%s: ``%s'' requires a parameter", option_source, arg - 1);
+ }
+ *p->p_obj = atoi(param_start);
+ break;
+
+ case PRO_FONT:
+ parsefont((struct fstate *) p->p_obj, param_start);
+ break;
+
+ default:
+ errx(1, "set_option: internal error: p_type %d", p->p_type);
+ }
+}
diff --git a/usr.bin/indent/indent.1 b/usr.bin/indent/indent.1
new file mode 100644
index 0000000..60ae0bc
--- /dev/null
+++ b/usr.bin/indent/indent.1
@@ -0,0 +1,557 @@
+.\" Copyright (c) 1980, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\" Copyright (c) 1976 Board of Trustees of the University of Illinois.
+.\" 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. 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.
+.\"
+.\" @(#)indent.1 8.1 (Berkeley) 7/1/93
+.\" $FreeBSD$
+.\"
+.Dd March 3, 2012
+.Dt INDENT 1
+.Os
+.Sh NAME
+.Nm indent
+.Nd indent and format C program source
+.Sh SYNOPSIS
+.Nm
+.Op Ar input-file Op Ar output-file
+.Op Fl bacc | Fl nbacc
+.Op Fl bad | Fl nbad
+.Op Fl bap | Fl nbap
+.Bk -words
+.Op Fl ei | Fl ei
+.Op Fl eei | Fl eei
+.Op Fl bbb | Fl nbbb
+.Ek
+.Op Fl \&bc | Fl nbc
+.Op Fl \&bl
+.Op Fl \&br
+.Op Fl c Ns Ar n
+.Op Fl \&cd Ns Ar n
+.Bk -words
+.Op Fl cdb | Fl ncdb
+.Ek
+.Op Fl \&ce | Fl nce
+.Op Fl \&ci Ns Ar n
+.Op Fl cli Ns Ar n
+.Op Fl d Ns Ar n
+.Op Fl \&di Ns Ar n
+.Bk -words
+.Op Fl fbs | Fl nfbs
+.Op Fl fc1 | Fl nfc1
+.Op Fl fcb | Fl nfcb
+.Ek
+.Op Fl i Ns Ar n
+.Op Fl \&ip | Fl nip
+.Op Fl l Ns Ar n
+.Op Fl \&lc Ns Ar n
+.Op Fl \&ldi Ns Ar n
+.Op Fl \&lp | Fl nlp
+.Op Fl npro
+.Op Fl pcs | Fl npcs
+.Op Fl psl | Fl npsl
+.Op Fl \&sc | Fl nsc
+.Bk -words
+.Op Fl sob | Fl nsob
+.Ek
+.Op Fl \&st
+.Op Fl \&ta
+.Op Fl troff
+.Op Fl ut | Fl nut
+.Op Fl v | Fl \&nv
+.Sh DESCRIPTION
+The
+.Nm
+utility is a
+.Em C
+program formatter.
+It reformats the
+.Em C
+program in the
+.Ar input-file
+according to the switches.
+The switches which can be
+specified are described below.
+They may appear before or after the file
+names.
+.Pp
+.Sy NOTE :
+If you only specify an
+.Ar input-file ,
+the formatting is
+done `in-place', that is, the formatted file is written back into
+.Ar input-file
+and a backup copy of
+.Ar input-file
+is written in the current directory.
+If
+.Ar input-file
+is named
+.Sq Pa /blah/blah/file ,
+the backup file is named
+.Sq Pa file.BAK .
+.Pp
+If
+.Ar output-file
+is specified,
+.Nm
+checks to make sure that it is different from
+.Ar input-file .
+.Pp
+The options listed below control the formatting style imposed by
+.Nm .
+.Bl -tag -width Op
+.It Fl bacc , nbacc
+If
+.Fl bacc
+is specified, a blank line is forced around every conditional
+compilation block.
+For example, in front of every #ifdef and after every #endif.
+Other blank lines surrounding such blocks will be swallowed.
+Default:
+.Fl nbacc .
+.It Fl bad , nbad
+If
+.Fl bad
+is specified, a blank line is forced after every block of
+declarations.
+Default:
+.Fl nbad .
+.It Fl bap , nbap
+If
+.Fl bap
+is specified, a blank line is forced after every procedure body.
+Default:
+.Fl nbap .
+.It Fl bbb , nbbb
+If
+.Fl bbb
+is specified, a blank line is forced before every block comment.
+Default:
+.Fl nbbb .
+.It Fl \&bc , nbc
+If
+.Fl \&bc
+is specified, then a newline is forced after each comma in a declaration.
+.Fl nbc
+turns off this option.
+Default:
+.Fl \&nbc .
+.It Fl \&br , \&bl
+Specifying
+.Fl \&bl
+lines-up compound statements like this:
+.Bd -literal -offset indent
+if (...)
+{
+ code
+}
+.Ed
+.Pp
+Specifying
+.Fl \&br
+(the default) makes them look like this:
+.Bd -literal -offset indent
+if (...) {
+ code
+}
+.Ed
+.It Fl c Ns Ar n
+The column in which comments on code start.
+The default is 33.
+.It Fl cd Ns Ar n
+The column in which comments on declarations start.
+The default
+is for these comments to start in the same column as those on code.
+.It Fl cdb , ncdb
+Enables (disables) the placement of comment delimiters on blank lines.
+With
+this option enabled, comments look like this:
+.Bd -literal -offset indent
+ /*
+ * this is a comment
+ */
+.Ed
+.Pp
+Rather than like this:
+.Bd -literal -offset indent
+ /* this is a comment */
+.Ed
+.Pp
+This only affects block comments, not comments to the right of
+code.
+The default is
+.Fl cdb .
+.It Fl ce , nce
+Enables (disables) forcing of `else's to cuddle up to the immediately preceding
+`}'.
+The default is
+.Fl \&ce .
+.It Fl \&ci Ns Ar n
+Sets the continuation indent to be
+.Ar n .
+Continuation
+lines will be indented that far from the beginning of the first line of the
+statement.
+Parenthesized expressions have extra indentation added to
+indicate the nesting, unless
+.Fl \&lp
+is in effect
+or the continuation indent is exactly half of the main indent.
+.Fl \&ci
+defaults to the same value as
+.Fl i .
+.It Fl cli Ns Ar n
+Causes case labels to be indented
+.Ar n
+tab stops to the right of the containing
+.Ic switch
+statement.
+.Fl cli0.5
+causes case labels to be indented half a tab stop.
+The
+default is
+.Fl cli0 .
+.It Fl d Ns Ar n
+Controls the placement of comments which are not to the
+right of code.
+For example,
+.Fl \&d\&1
+means that such comments are placed one indentation level to the
+left of code.
+Specifying the default
+.Fl \&d\&0
+lines-up these comments with the code.
+See the section on comment
+indentation below.
+.It Fl \&di Ns Ar n
+Specifies the indentation, in character positions,
+of global variable names and all struct/union member names
+relative to the beginning of their type declaration.
+The default is
+.Fl di16 .
+.It Fl dj , ndj
+.Fl \&dj
+left justifies declarations.
+.Fl ndj
+indents declarations the same as code.
+The default is
+.Fl ndj .
+.It Fl \&ei , nei
+Enables (disables) special
+.Ic else-if
+processing.
+If it is enabled, an
+.Ic if
+following an
+.Ic else
+will have the same indentation as the preceding
+.Ic \&if
+statement.
+The default is
+.Fl ei .
+.It Fl eei , neei
+Enables (disables) extra indentation on continuation lines of
+the expression part of
+.Ic if
+and
+.Ic while
+statements.
+These continuation lines will be indented one extra level.
+The default is
+.Fl neei .
+.It Fl fbs , nfbs
+Enables (disables) splitting the function declaration and opening brace
+across two lines.
+The default is
+.Fl fbs .
+.It Fl fc1 , nfc1
+Enables (disables) the formatting of comments that start in column 1.
+Often, comments whose leading `/' is in column 1 have been carefully
+hand formatted by the programmer.
+In such cases,
+.Fl nfc1
+should be
+used.
+The default is
+.Fl fc1 .
+.It Fl fcb , nfcb
+Enables (disables) the formatting of block comments (ones that begin
+with `/*\\n').
+Often, block comments have been not so carefully hand formatted by the
+programmer, but reformatting that would just change the line breaks is not
+wanted.
+In such cases,
+.Fl nfcb
+should be used.
+Block comments are then handled like box comments.
+The default is
+.Fl fcb .
+.It Fl i Ns Ar n
+The number of spaces for one indentation level.
+The default is 8.
+.It Fl \&ip , nip
+Enables (disables) the indentation of parameter declarations from the left
+margin.
+The default is
+.Fl \&ip .
+.It Fl l Ns Ar n
+Maximum length of an output line.
+The default is 78.
+.It Fl \&ldi Ns Ar n
+Specifies the indentation, in character positions,
+of local variable names
+relative to the beginning of their type declaration.
+The default is for local variable names to be indented
+by the same amount as global ones.
+.It Fl \&lp , nlp
+Lines-up code surrounded by parenthesis in continuation lines.
+If a line
+has a left paren which is not closed on that line, then continuation lines
+will be lined up to start at the character position just after the left
+paren.
+For example, here is how a piece of continued code looks with
+.Fl nlp
+in effect:
+.Bd -literal -offset indent
+p1 = first_procedure(second_procedure(p2, p3),
+\ \ third_procedure(p4, p5));
+.Ed
+.Pp
+With
+.Fl lp
+in effect (the default) the code looks somewhat clearer:
+.Bd -literal -offset indent
+p1\ =\ first_procedure(second_procedure(p2,\ p3),
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ third_procedure(p4,\ p5));
+.Ed
+.Pp
+Inserting two more newlines we get:
+.Bd -literal -offset indent
+p1\ =\ first_procedure(second_procedure(p2,
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p3),
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ third_procedure(p4,
+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p5));
+.Ed
+.It Fl npro
+Causes the profile files,
+.Sq Pa ./.indent.pro
+and
+.Sq Pa ~/.indent.pro ,
+to be ignored.
+.It Fl pcs , npcs
+If true
+.Pq Fl pcs
+all procedure calls will have a space inserted between
+the name and the `('.
+The default is
+.Fl npcs .
+.It Fl psl , npsl
+If true
+.Pq Fl psl
+the names of procedures being defined are placed in
+column 1 \- their types, if any, will be left on the previous lines.
+The
+default is
+.Fl psl .
+.It Fl \&sc , nsc
+Enables (disables) the placement of asterisks (`*'s) at the left edge of all
+comments.
+The default is
+.Fl sc .
+.It Fl sob , nsob
+If
+.Fl sob
+is specified, indent will swallow optional blank lines.
+You can use this to
+get rid of blank lines after declarations.
+Default:
+.Fl nsob .
+.It Fl \&st
+Causes
+.Nm
+to take its input from stdin and put its output to stdout.
+.It Fl ta
+Automatically add all identifiers ending in "_t" to the list
+of type keywords.
+.It Fl T Ns Ar typename
+Adds
+.Ar typename
+to the list of type keywords.
+Names accumulate:
+.Fl T
+can be specified more than once.
+You need to specify all the typenames that
+appear in your program that are defined by
+.Ic typedef
+\- nothing will be
+harmed if you miss a few, but the program will not be formatted as nicely as
+it should.
+This sounds like a painful thing to have to do, but it is really
+a symptom of a problem in C:
+.Ic typedef
+causes a syntactic change in the
+language and
+.Nm
+cannot find all
+instances of
+.Ic typedef .
+.It Fl troff
+Causes
+.Nm
+to format the program for processing by
+.Xr troff 1 .
+It will produce a fancy
+listing in much the same spirit as
+.Xr vgrind 1 .
+If the output file is not specified, the default is standard output,
+rather than formatting in place.
+.It Fl ut , nut
+Enables (disables) the use of tab characters in the output.
+Tabs are assumed to be aligned on columns divisible by 8.
+The default is
+.Fl ut .
+.It Fl v , \&nv
+.Fl v
+turns on `verbose' mode;
+.Fl \&nv
+turns it off.
+When in verbose mode,
+.Nm
+reports when it splits one line of input into two or more lines of output,
+and gives some size statistics at completion.
+The default is
+.Fl \&nv .
+.El
+.Pp
+You may set up your own `profile' of defaults to
+.Nm
+by creating a file called
+.Pa .indent.pro
+in your login directory and/or the current directory and including
+whatever switches you like.
+A `.indent.pro' in the current directory takes
+precedence over the one in your login directory.
+If
+.Nm
+is run and a profile file exists, then it is read to set up the program's
+defaults.
+Switches on the command line, though, always override profile
+switches.
+The switches should be separated by spaces, tabs or newlines.
+.Pp
+.Ss Comments
+.Sq Em Box
+.Em comments .
+The
+.Nm
+utility
+assumes that any comment with a dash or star immediately after the start of
+comment (that is, `/*\-' or `/**') is a comment surrounded by a box of stars.
+Each line of such a comment is left unchanged, except that its indentation
+may be adjusted to account for the change in indentation of the first line
+of the comment.
+.Pp
+.Em Straight text .
+All other comments are treated as straight text.
+The
+.Nm
+utility fits as many words (separated by blanks, tabs, or newlines) on a
+line as possible.
+Blank lines break paragraphs.
+.Ss Comment indentation
+If a comment is on a line with code it is started in the `comment column',
+which is set by the
+.Fl c Ns Ns Ar n
+command line parameter.
+Otherwise, the comment is started at
+.Ar n
+indentation levels less than where code is currently being placed, where
+.Ar n
+is specified by the
+.Fl d Ns Ns Ar n
+command line parameter.
+If the code on a line extends past the comment
+column, the comment starts further to the right, and the right margin may be
+automatically extended in extreme cases.
+.Ss Preprocessor lines
+In general,
+.Nm
+leaves preprocessor lines alone.
+The only
+reformatting that it will do is to straighten up trailing comments.
+It
+leaves embedded comments alone.
+Conditional compilation
+.Pq Ic #ifdef...#endif
+is recognized and
+.Nm
+attempts to correctly
+compensate for the syntactic peculiarities introduced.
+.Ss C syntax
+The
+.Nm
+utility understands a substantial amount about the syntax of C, but it
+has a `forgiving' parser.
+It attempts to cope with the usual sorts of
+incomplete and malformed syntax.
+In particular, the use of macros like:
+.Pp
+.Dl #define forever for(;;)
+.Pp
+is handled properly.
+.Sh ENVIRONMENT
+The
+.Nm
+utility uses the
+.Ev HOME
+environment variable.
+.Sh FILES
+.Bl -tag -width "./.indent.pro" -compact
+.It Pa ./.indent.pro
+profile file
+.It Pa ~/.indent.pro
+profile file
+.El
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Sh BUGS
+The
+.Nm
+utility has even more switches than
+.Xr ls 1 .
+.Pp
+A common mistake is to try to indent all the
+.Em C
+programs in a directory by typing:
+.Pp
+.Dl indent *.c
+.Pp
+This is probably a bug, not a feature.
diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c
new file mode 100644
index 0000000..3035faa
--- /dev/null
+++ b/usr.bin/indent/indent.c
@@ -0,0 +1,1234 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1976 Board of Trustees of the University of Illinois.
+ * Copyright (c) 1980, 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.
+ * 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
+ * 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) 1985 Sun Microsystems, Inc.\n\
+@(#) Copyright (c) 1976 Board of Trustees of the University of Illinois.\n\
+@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "indent_globs.h"
+#include "indent_codes.h"
+#include "indent.h"
+
+static void bakcopy(void);
+
+const char *in_name = "Standard Input"; /* will always point to name of input
+ * file */
+const char *out_name = "Standard Output"; /* will always point to name
+ * of output file */
+char bakfile[MAXPATHLEN] = "";
+
+int
+main(int argc, char **argv)
+{
+
+ int dec_ind; /* current indentation for declarations */
+ int di_stack[20]; /* a stack of structure indentation levels */
+ int flushed_nl; /* used when buffering up comments to remember
+ * that a newline was passed over */
+ int force_nl; /* when true, code must be broken */
+ int hd_type = 0; /* used to store type of stmt for if (...),
+ * for (...), etc */
+ int i; /* local loop counter */
+ int scase; /* set to true when we see a case, so we will
+ * know what to do with the following colon */
+ int sp_sw; /* when true, we are in the expression of
+ * if(...), while(...), etc. */
+ int squest; /* when this is positive, we have seen a ?
+ * without the matching : in a <c>?<s>:<s>
+ * construct */
+ const char *t_ptr; /* used for copying tokens */
+ int tabs_to_var; /* true if using tabs to indent to var name */
+ int type_code; /* the type of token, returned by lexi */
+
+ int last_else = 0; /* true iff last keyword was an else */
+
+
+ /*-----------------------------------------------*\
+ | INITIALIZATION |
+ \*-----------------------------------------------*/
+
+ found_err = 0;
+
+ ps.p_stack[0] = stmt; /* this is the parser's stack */
+ ps.last_nl = true; /* this is true if the last thing scanned was
+ * a newline */
+ ps.last_token = semicolon;
+ combuf = (char *) malloc(bufsize);
+ if (combuf == NULL)
+ err(1, NULL);
+ labbuf = (char *) malloc(bufsize);
+ if (labbuf == NULL)
+ err(1, NULL);
+ codebuf = (char *) malloc(bufsize);
+ if (codebuf == NULL)
+ err(1, NULL);
+ tokenbuf = (char *) malloc(bufsize);
+ if (tokenbuf == NULL)
+ err(1, NULL);
+ l_com = combuf + bufsize - 5;
+ l_lab = labbuf + bufsize - 5;
+ l_code = codebuf + bufsize - 5;
+ l_token = tokenbuf + bufsize - 5;
+ combuf[0] = codebuf[0] = labbuf[0] = ' '; /* set up code, label, and
+ * comment buffers */
+ combuf[1] = codebuf[1] = labbuf[1] = '\0';
+ ps.else_if = 1; /* Default else-if special processing to on */
+ s_lab = e_lab = labbuf + 1;
+ s_code = e_code = codebuf + 1;
+ s_com = e_com = combuf + 1;
+ s_token = e_token = tokenbuf + 1;
+
+ in_buffer = (char *) malloc(10);
+ if (in_buffer == NULL)
+ err(1, NULL);
+ in_buffer_limit = in_buffer + 8;
+ buf_ptr = buf_end = in_buffer;
+ line_no = 1;
+ had_eof = ps.in_decl = ps.decl_on_line = break_comma = false;
+ sp_sw = force_nl = false;
+ ps.in_or_st = false;
+ ps.bl_line = true;
+ dec_ind = 0;
+ di_stack[ps.dec_nest = 0] = 0;
+ ps.want_blank = ps.in_stmt = ps.ind_stmt = false;
+
+ scase = ps.pcase = false;
+ squest = 0;
+ sc_end = 0;
+ bp_save = 0;
+ be_save = 0;
+
+ output = 0;
+ tabs_to_var = 0;
+
+ /*--------------------------------------------------*\
+ | COMMAND LINE SCAN |
+ \*--------------------------------------------------*/
+
+#ifdef undef
+ max_col = 78; /* -l78 */
+ lineup_to_parens = 1; /* -lp */
+ ps.ljust_decl = 0; /* -ndj */
+ ps.com_ind = 33; /* -c33 */
+ star_comment_cont = 1; /* -sc */
+ ps.ind_size = 8; /* -i8 */
+ verbose = 0;
+ ps.decl_indent = 16; /* -di16 */
+ ps.local_decl_indent = -1; /* if this is not set to some nonnegative value
+ * by an arg, we will set this equal to
+ * ps.decl_ind */
+ ps.indent_parameters = 1; /* -ip */
+ ps.decl_com_ind = 0; /* if this is not set to some positive value
+ * by an arg, we will set this equal to
+ * ps.com_ind */
+ btype_2 = 1; /* -br */
+ cuddle_else = 1; /* -ce */
+ ps.unindent_displace = 0; /* -d0 */
+ ps.case_indent = 0; /* -cli0 */
+ format_block_comments = 1; /* -fcb */
+ format_col1_comments = 1; /* -fc1 */
+ procnames_start_line = 1; /* -psl */
+ proc_calls_space = 0; /* -npcs */
+ comment_delimiter_on_blankline = 1; /* -cdb */
+ ps.leave_comma = 1; /* -nbc */
+#endif
+
+ for (i = 1; i < argc; ++i)
+ if (strcmp(argv[i], "-npro") == 0)
+ break;
+ set_defaults();
+ if (i >= argc)
+ set_profile();
+
+ for (i = 1; i < argc; ++i) {
+
+ /*
+ * look thru args (if any) for changes to defaults
+ */
+ if (argv[i][0] != '-') {/* no flag on parameter */
+ if (input == NULL) { /* we must have the input file */
+ in_name = argv[i]; /* remember name of input file */
+ input = fopen(in_name, "r");
+ if (input == NULL) /* check for open error */
+ err(1, "%s", in_name);
+ continue;
+ }
+ else if (output == NULL) { /* we have the output file */
+ out_name = argv[i]; /* remember name of output file */
+ if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite
+ * the file */
+ errx(1, "input and output files must be different");
+ }
+ output = fopen(out_name, "w");
+ if (output == NULL) /* check for create error */
+ err(1, "%s", out_name);
+ continue;
+ }
+ errx(1, "unknown parameter: %s", argv[i]);
+ }
+ else
+ set_option(argv[i]);
+ } /* end of for */
+ if (input == NULL)
+ input = stdin;
+ if (output == NULL) {
+ if (troff || input == stdin)
+ output = stdout;
+ else {
+ out_name = in_name;
+ bakcopy();
+ }
+ }
+ if (ps.com_ind <= 1)
+ ps.com_ind = 2; /* dont put normal comments before column 2 */
+ if (troff) {
+ if (bodyf.font[0] == 0)
+ parsefont(&bodyf, "R");
+ if (scomf.font[0] == 0)
+ parsefont(&scomf, "I");
+ if (blkcomf.font[0] == 0)
+ blkcomf = scomf, blkcomf.size += 2;
+ if (boxcomf.font[0] == 0)
+ boxcomf = blkcomf;
+ if (stringf.font[0] == 0)
+ parsefont(&stringf, "L");
+ if (keywordf.font[0] == 0)
+ parsefont(&keywordf, "B");
+ writefdef(&bodyf, 'B');
+ writefdef(&scomf, 'C');
+ writefdef(&blkcomf, 'L');
+ writefdef(&boxcomf, 'X');
+ writefdef(&stringf, 'S');
+ writefdef(&keywordf, 'K');
+ }
+ if (block_comment_max_col <= 0)
+ block_comment_max_col = max_col;
+ if (ps.local_decl_indent < 0) /* if not specified by user, set this */
+ ps.local_decl_indent = ps.decl_indent;
+ if (ps.decl_com_ind <= 0) /* if not specified by user, set this */
+ ps.decl_com_ind = ps.ljust_decl ? (ps.com_ind <= 10 ? 2 : ps.com_ind - 8) : ps.com_ind;
+ if (continuation_indent == 0)
+ continuation_indent = ps.ind_size;
+ fill_buffer(); /* get first batch of stuff into input buffer */
+
+ parse(semicolon);
+ {
+ char *p = buf_ptr;
+ int col = 1;
+
+ while (1) {
+ if (*p == ' ')
+ col++;
+ else if (*p == '\t')
+ col = ((col - 1) & ~7) + 9;
+ else
+ break;
+ p++;
+ }
+ if (col > ps.ind_size)
+ ps.ind_level = ps.i_l_follow = col / ps.ind_size;
+ }
+ if (troff) {
+ const char *p = in_name,
+ *beg = in_name;
+
+ while (*p)
+ if (*p++ == '/')
+ beg = p;
+ fprintf(output, ".Fn \"%s\"\n", beg);
+ }
+ /*
+ * START OF MAIN LOOP
+ */
+
+ while (1) { /* this is the main loop. it will go until we
+ * reach eof */
+ int is_procname;
+
+ type_code = lexi(); /* lexi reads one token. The actual
+ * characters read are stored in "token". lexi
+ * returns a code indicating the type of token */
+ is_procname = ps.procname[0];
+
+ /*
+ * The following code moves everything following an if (), while (),
+ * else, etc. up to the start of the following stmt to a buffer. This
+ * allows proper handling of both kinds of brace placement.
+ */
+
+ flushed_nl = false;
+ while (ps.search_brace) { /* if we scanned an if(), while(),
+ * etc., we might need to copy stuff
+ * into a buffer we must loop, copying
+ * stuff into save_com, until we find
+ * the start of the stmt which follows
+ * the if, or whatever */
+ switch (type_code) {
+ case newline:
+ ++line_no;
+ flushed_nl = true;
+ case form_feed:
+ break; /* form feeds and newlines found here will be
+ * ignored */
+
+ case lbrace: /* this is a brace that starts the compound
+ * stmt */
+ if (sc_end == 0) { /* ignore buffering if a comment wasn't
+ * stored up */
+ ps.search_brace = false;
+ goto check_type;
+ }
+ if (btype_2) {
+ save_com[0] = '{'; /* we either want to put the brace
+ * right after the if */
+ goto sw_buffer; /* go to common code to get out of
+ * this loop */
+ }
+ case comment: /* we have a comment, so we must copy it into
+ * the buffer */
+ if (!flushed_nl || sc_end != 0) {
+ if (sc_end == 0) { /* if this is the first comment, we
+ * must set up the buffer */
+ save_com[0] = save_com[1] = ' ';
+ sc_end = &(save_com[2]);
+ }
+ else {
+ *sc_end++ = '\n'; /* add newline between
+ * comments */
+ *sc_end++ = ' ';
+ --line_no;
+ }
+ *sc_end++ = '/'; /* copy in start of comment */
+ *sc_end++ = '*';
+
+ for (;;) { /* loop until we get to the end of the comment */
+ *sc_end = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+
+ if (*sc_end++ == '*' && *buf_ptr == '/')
+ break; /* we are at end of comment */
+
+ if (sc_end >= &(save_com[sc_size])) { /* check for temp buffer
+ * overflow */
+ diag2(1, "Internal buffer overflow - Move big comment from right after if, while, or whatever");
+ fflush(output);
+ exit(1);
+ }
+ }
+ *sc_end++ = '/'; /* add ending slash */
+ if (++buf_ptr >= buf_end) /* get past / in buffer */
+ fill_buffer();
+ break;
+ }
+ default: /* it is the start of a normal statement */
+ if (flushed_nl) /* if we flushed a newline, make sure it is
+ * put back */
+ force_nl = true;
+ if ((type_code == sp_paren && *token == 'i'
+ && last_else && ps.else_if)
+ || (type_code == sp_nparen && *token == 'e'
+ && e_code != s_code && e_code[-1] == '}'))
+ force_nl = false;
+
+ if (sc_end == 0) { /* ignore buffering if comment wasn't
+ * saved up */
+ ps.search_brace = false;
+ goto check_type;
+ }
+ if (force_nl) { /* if we should insert a nl here, put it into
+ * the buffer */
+ force_nl = false;
+ --line_no; /* this will be re-increased when the nl is
+ * read from the buffer */
+ *sc_end++ = '\n';
+ *sc_end++ = ' ';
+ if (verbose && !flushed_nl) /* print error msg if the line
+ * was not already broken */
+ diag2(0, "Line broken");
+ flushed_nl = false;
+ }
+ for (t_ptr = token; *t_ptr; ++t_ptr)
+ *sc_end++ = *t_ptr; /* copy token into temp buffer */
+ ps.procname[0] = 0;
+
+ sw_buffer:
+ ps.search_brace = false; /* stop looking for start of
+ * stmt */
+ bp_save = buf_ptr; /* save current input buffer */
+ be_save = buf_end;
+ buf_ptr = save_com; /* fix so that subsequent calls to
+ * lexi will take tokens out of
+ * save_com */
+ *sc_end++ = ' ';/* add trailing blank, just in case */
+ buf_end = sc_end;
+ sc_end = 0;
+ break;
+ } /* end of switch */
+ if (type_code != 0) /* we must make this check, just in case there
+ * was an unexpected EOF */
+ type_code = lexi(); /* read another token */
+ /* if (ps.search_brace) ps.procname[0] = 0; */
+ if ((is_procname = ps.procname[0]) && flushed_nl
+ && !procnames_start_line && ps.in_decl
+ && type_code == ident)
+ flushed_nl = 0;
+ } /* end of while (search_brace) */
+ last_else = 0;
+check_type:
+ if (type_code == 0) { /* we got eof */
+ if (s_lab != e_lab || s_code != e_code
+ || s_com != e_com) /* must dump end of line */
+ dump_line();
+ if (ps.tos > 1) /* check for balanced braces */
+ diag2(1, "Stuff missing from end of file");
+
+ if (verbose) {
+ printf("There were %d output lines and %d comments\n",
+ ps.out_lines, ps.out_coms);
+ printf("(Lines with comments)/(Lines with code): %6.3f\n",
+ (1.0 * ps.com_lines) / code_lines);
+ }
+ fflush(output);
+ exit(found_err);
+ }
+ if (
+ (type_code != comment) &&
+ (type_code != newline) &&
+ (type_code != preesc) &&
+ (type_code != form_feed)) {
+ if (force_nl &&
+ (type_code != semicolon) &&
+ (type_code != lbrace || !btype_2)) {
+ /* we should force a broken line here */
+ if (verbose && !flushed_nl)
+ diag2(0, "Line broken");
+ flushed_nl = false;
+ dump_line();
+ ps.want_blank = false; /* dont insert blank at line start */
+ force_nl = false;
+ }
+ ps.in_stmt = true; /* turn on flag which causes an extra level of
+ * indentation. this is turned off by a ; or
+ * '}' */
+ if (s_com != e_com) { /* the turkey has embedded a comment
+ * in a line. fix it */
+ *e_code++ = ' ';
+ for (t_ptr = s_com; *t_ptr; ++t_ptr) {
+ CHECK_SIZE_CODE;
+ *e_code++ = *t_ptr;
+ }
+ *e_code++ = ' ';
+ *e_code = '\0'; /* null terminate code sect */
+ ps.want_blank = false;
+ e_com = s_com;
+ }
+ }
+ else if (type_code != comment) /* preserve force_nl thru a comment */
+ force_nl = false; /* cancel forced newline after newline, form
+ * feed, etc */
+
+
+
+ /*-----------------------------------------------------*\
+ | do switch on type of token scanned |
+ \*-----------------------------------------------------*/
+ CHECK_SIZE_CODE;
+ switch (type_code) { /* now, decide what to do with the token */
+
+ case form_feed: /* found a form feed in line */
+ ps.use_ff = true; /* a form feed is treated much like a newline */
+ dump_line();
+ ps.want_blank = false;
+ break;
+
+ case newline:
+ if (ps.last_token != comma || ps.p_l_follow > 0
+ || !ps.leave_comma || ps.block_init || !break_comma || s_com != e_com) {
+ dump_line();
+ ps.want_blank = false;
+ }
+ ++line_no; /* keep track of input line number */
+ break;
+
+ case lparen: /* got a '(' or '[' */
+ ++ps.p_l_follow; /* count parens to make Healy happy */
+ if (ps.want_blank && *token != '[' &&
+ (ps.last_token != ident || proc_calls_space
+ || (ps.its_a_keyword && (!ps.sizeof_keyword || Bill_Shannon))))
+ *e_code++ = ' ';
+ if (ps.in_decl && !ps.block_init)
+ if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) {
+ ps.dumped_decl_indent = 1;
+ sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token);
+ e_code += strlen(e_code);
+ }
+ else {
+ while ((e_code - s_code) < dec_ind) {
+ CHECK_SIZE_CODE;
+ *e_code++ = ' ';
+ }
+ *e_code++ = token[0];
+ }
+ else
+ *e_code++ = token[0];
+ ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code;
+ if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent
+ && ps.paren_indents[0] < 2 * ps.ind_size)
+ ps.paren_indents[0] = 2 * ps.ind_size;
+ ps.want_blank = false;
+ if (ps.in_or_st && *token == '(' && ps.tos <= 2) {
+ /*
+ * this is a kluge to make sure that declarations will be
+ * aligned right if proc decl has an explicit type on it, i.e.
+ * "int a(x) {..."
+ */
+ parse(semicolon); /* I said this was a kluge... */
+ ps.in_or_st = false; /* turn off flag for structure decl or
+ * initialization */
+ }
+ if (ps.sizeof_keyword)
+ ps.sizeof_mask |= 1 << ps.p_l_follow;
+ break;
+
+ case rparen: /* got a ')' or ']' */
+ rparen_count--;
+ if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.sizeof_mask) {
+ ps.last_u_d = true;
+ ps.cast_mask &= (1 << ps.p_l_follow) - 1;
+ ps.want_blank = false;
+ } else
+ ps.want_blank = true;
+ ps.sizeof_mask &= (1 << ps.p_l_follow) - 1;
+ if (--ps.p_l_follow < 0) {
+ ps.p_l_follow = 0;
+ diag3(0, "Extra %c", *token);
+ }
+ if (e_code == s_code) /* if the paren starts the line */
+ ps.paren_level = ps.p_l_follow; /* then indent it */
+
+ *e_code++ = token[0];
+
+ if (sp_sw && (ps.p_l_follow == 0)) { /* check for end of if
+ * (...), or some such */
+ sp_sw = false;
+ force_nl = true;/* must force newline after if */
+ ps.last_u_d = true; /* inform lexi that a following
+ * operator is unary */
+ ps.in_stmt = false; /* dont use stmt continuation
+ * indentation */
+
+ parse(hd_type); /* let parser worry about if, or whatever */
+ }
+ ps.search_brace = btype_2; /* this should insure that constructs
+ * such as main(){...} and int[]{...}
+ * have their braces put in the right
+ * place */
+ break;
+
+ case unary_op: /* this could be any unary operation */
+ if (ps.want_blank)
+ *e_code++ = ' ';
+
+ if (troff && !ps.dumped_decl_indent && ps.in_decl && !is_procname) {
+ sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token);
+ ps.dumped_decl_indent = 1;
+ e_code += strlen(e_code);
+ }
+ else {
+ const char *res = token;
+
+ if (ps.in_decl && !ps.block_init) { /* if this is a unary op
+ * in a declaration, we
+ * should indent this
+ * token */
+ for (i = 0; token[i]; ++i); /* find length of token */
+ while ((e_code - s_code) < (dec_ind - i)) {
+ CHECK_SIZE_CODE;
+ *e_code++ = ' '; /* pad it */
+ }
+ }
+ if (troff && token[0] == '-' && token[1] == '>')
+ res = "\\(->";
+ for (t_ptr = res; *t_ptr; ++t_ptr) {
+ CHECK_SIZE_CODE;
+ *e_code++ = *t_ptr;
+ }
+ }
+ ps.want_blank = false;
+ break;
+
+ case binary_op: /* any binary operation */
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ {
+ const char *res = token;
+
+ if (troff)
+ switch (token[0]) {
+ case '<':
+ if (token[1] == '=')
+ res = "\\(<=";
+ break;
+ case '>':
+ if (token[1] == '=')
+ res = "\\(>=";
+ break;
+ case '!':
+ if (token[1] == '=')
+ res = "\\(!=";
+ break;
+ case '|':
+ if (token[1] == '|')
+ res = "\\(br\\(br";
+ else if (token[1] == 0)
+ res = "\\(br";
+ break;
+ }
+ for (t_ptr = res; *t_ptr; ++t_ptr) {
+ CHECK_SIZE_CODE;
+ *e_code++ = *t_ptr; /* move the operator */
+ }
+ }
+ ps.want_blank = true;
+ break;
+
+ case postop: /* got a trailing ++ or -- */
+ *e_code++ = token[0];
+ *e_code++ = token[1];
+ ps.want_blank = true;
+ break;
+
+ case question: /* got a ? */
+ squest++; /* this will be used when a later colon
+ * appears so we can distinguish the
+ * <c>?<n>:<n> construct */
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ *e_code++ = '?';
+ ps.want_blank = true;
+ break;
+
+ case casestmt: /* got word 'case' or 'default' */
+ scase = true; /* so we can process the later colon properly */
+ goto copy_id;
+
+ case colon: /* got a ':' */
+ if (squest > 0) { /* it is part of the <c>?<n>: <n> construct */
+ --squest;
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ *e_code++ = ':';
+ ps.want_blank = true;
+ break;
+ }
+ if (ps.in_or_st) {
+ *e_code++ = ':';
+ ps.want_blank = false;
+ break;
+ }
+ ps.in_stmt = false; /* seeing a label does not imply we are in a
+ * stmt */
+ for (t_ptr = s_code; *t_ptr; ++t_ptr)
+ *e_lab++ = *t_ptr; /* turn everything so far into a label */
+ e_code = s_code;
+ *e_lab++ = ':';
+ *e_lab++ = ' ';
+ *e_lab = '\0';
+
+ force_nl = ps.pcase = scase; /* ps.pcase will be used by
+ * dump_line to decide how to
+ * indent the label. force_nl
+ * will force a case n: to be
+ * on a line by itself */
+ scase = false;
+ ps.want_blank = false;
+ break;
+
+ case semicolon: /* got a ';' */
+ ps.in_or_st = false;/* we are not in an initialization or
+ * structure declaration */
+ scase = false; /* these will only need resetting in an error */
+ squest = 0;
+ if (ps.last_token == rparen && rparen_count == 0)
+ ps.in_parameter_declaration = 0;
+ ps.cast_mask = 0;
+ ps.sizeof_mask = 0;
+ ps.block_init = 0;
+ ps.block_init_level = 0;
+ ps.just_saw_decl--;
+
+ if (ps.in_decl && s_code == e_code && !ps.block_init)
+ while ((e_code - s_code) < (dec_ind - 1)) {
+ CHECK_SIZE_CODE;
+ *e_code++ = ' ';
+ }
+
+ ps.in_decl = (ps.dec_nest > 0); /* if we were in a first level
+ * structure declaration, we
+ * arent any more */
+
+ if ((!sp_sw || hd_type != forstmt) && ps.p_l_follow > 0) {
+
+ /*
+ * This should be true iff there were unbalanced parens in the
+ * stmt. It is a bit complicated, because the semicolon might
+ * be in a for stmt
+ */
+ diag2(1, "Unbalanced parens");
+ ps.p_l_follow = 0;
+ if (sp_sw) { /* this is a check for an if, while, etc. with
+ * unbalanced parens */
+ sp_sw = false;
+ parse(hd_type); /* dont lose the if, or whatever */
+ }
+ }
+ *e_code++ = ';';
+ ps.want_blank = true;
+ ps.in_stmt = (ps.p_l_follow > 0); /* we are no longer in the
+ * middle of a stmt */
+
+ if (!sp_sw) { /* if not if for (;;) */
+ parse(semicolon); /* let parser know about end of stmt */
+ force_nl = true;/* force newline after an end of stmt */
+ }
+ break;
+
+ case lbrace: /* got a '{' */
+ ps.in_stmt = false; /* dont indent the {} */
+ if (!ps.block_init)
+ force_nl = true;/* force other stuff on same line as '{' onto
+ * new line */
+ else if (ps.block_init_level <= 0)
+ ps.block_init_level = 1;
+ else
+ ps.block_init_level++;
+
+ if (s_code != e_code && !ps.block_init) {
+ if (!btype_2) {
+ dump_line();
+ ps.want_blank = false;
+ }
+ else if (ps.in_parameter_declaration && !ps.in_or_st) {
+ ps.i_l_follow = 0;
+ if (function_brace_split) { /* dump the line prior to the
+ * brace ... */
+ dump_line();
+ ps.want_blank = false;
+ } else /* add a space between the decl and brace */
+ ps.want_blank = true;
+ }
+ }
+ if (ps.in_parameter_declaration)
+ prefix_blankline_requested = 0;
+
+ if (ps.p_l_follow > 0) { /* check for preceding unbalanced
+ * parens */
+ diag2(1, "Unbalanced parens");
+ ps.p_l_follow = 0;
+ if (sp_sw) { /* check for unclosed if, for, etc. */
+ sp_sw = false;
+ parse(hd_type);
+ ps.ind_level = ps.i_l_follow;
+ }
+ }
+ if (s_code == e_code)
+ ps.ind_stmt = false; /* dont put extra indentation on line
+ * with '{' */
+ if (ps.in_decl && ps.in_or_st) { /* this is either a structure
+ * declaration or an init */
+ di_stack[ps.dec_nest++] = dec_ind;
+ /* ? dec_ind = 0; */
+ }
+ else {
+ ps.decl_on_line = false; /* we can't be in the middle of
+ * a declaration, so don't do
+ * special indentation of
+ * comments */
+ if (blanklines_after_declarations_at_proctop
+ && ps.in_parameter_declaration)
+ postfix_blankline_requested = 1;
+ ps.in_parameter_declaration = 0;
+ }
+ dec_ind = 0;
+ parse(lbrace); /* let parser know about this */
+ if (ps.want_blank) /* put a blank before '{' if '{' is not at
+ * start of line */
+ *e_code++ = ' ';
+ ps.want_blank = false;
+ *e_code++ = '{';
+ ps.just_saw_decl = 0;
+ break;
+
+ case rbrace: /* got a '}' */
+ if (ps.p_stack[ps.tos] == decl && !ps.block_init) /* semicolons can be
+ * omitted in
+ * declarations */
+ parse(semicolon);
+ if (ps.p_l_follow) {/* check for unclosed if, for, else. */
+ diag2(1, "Unbalanced parens");
+ ps.p_l_follow = 0;
+ sp_sw = false;
+ }
+ ps.just_saw_decl = 0;
+ ps.block_init_level--;
+ if (s_code != e_code && !ps.block_init) { /* '}' must be first on
+ * line */
+ if (verbose)
+ diag2(0, "Line broken");
+ dump_line();
+ }
+ *e_code++ = '}';
+ ps.want_blank = true;
+ ps.in_stmt = ps.ind_stmt = false;
+ if (ps.dec_nest > 0) { /* we are in multi-level structure
+ * declaration */
+ dec_ind = di_stack[--ps.dec_nest];
+ if (ps.dec_nest == 0 && !ps.in_parameter_declaration)
+ ps.just_saw_decl = 2;
+ ps.in_decl = true;
+ }
+ prefix_blankline_requested = 0;
+ parse(rbrace); /* let parser know about this */
+ ps.search_brace = cuddle_else && ps.p_stack[ps.tos] == ifhead
+ && ps.il[ps.tos] >= ps.ind_level;
+ if (ps.tos <= 1 && blanklines_after_procs && ps.dec_nest <= 0)
+ postfix_blankline_requested = 1;
+ break;
+
+ case swstmt: /* got keyword "switch" */
+ sp_sw = true;
+ hd_type = swstmt; /* keep this for when we have seen the
+ * expression */
+ goto copy_id; /* go move the token into buffer */
+
+ case sp_paren: /* token is if, while, for */
+ sp_sw = true; /* the interesting stuff is done after the
+ * expression is scanned */
+ hd_type = (*token == 'i' ? ifstmt :
+ (*token == 'w' ? whilestmt : forstmt));
+
+ /*
+ * remember the type of header for later use by parser
+ */
+ goto copy_id; /* copy the token into line */
+
+ case sp_nparen: /* got else, do */
+ ps.in_stmt = false;
+ if (*token == 'e') {
+ if (e_code != s_code && (!cuddle_else || e_code[-1] != '}')) {
+ if (verbose)
+ diag2(0, "Line broken");
+ dump_line();/* make sure this starts a line */
+ ps.want_blank = false;
+ }
+ force_nl = true;/* also, following stuff must go onto new line */
+ last_else = 1;
+ parse(elselit);
+ }
+ else {
+ if (e_code != s_code) { /* make sure this starts a line */
+ if (verbose)
+ diag2(0, "Line broken");
+ dump_line();
+ ps.want_blank = false;
+ }
+ force_nl = true;/* also, following stuff must go onto new line */
+ last_else = 0;
+ parse(dolit);
+ }
+ goto copy_id; /* move the token into line */
+
+ case decl: /* we have a declaration type (int, register,
+ * etc.) */
+ parse(decl); /* let parser worry about indentation */
+ if (ps.last_token == rparen && ps.tos <= 1) {
+ ps.in_parameter_declaration = 1;
+ if (s_code != e_code) {
+ dump_line();
+ ps.want_blank = 0;
+ }
+ }
+ if (ps.in_parameter_declaration && ps.indent_parameters && ps.dec_nest == 0) {
+ ps.ind_level = ps.i_l_follow = 1;
+ ps.ind_stmt = 0;
+ }
+ ps.in_or_st = true; /* this might be a structure or initialization
+ * declaration */
+ ps.in_decl = ps.decl_on_line = true;
+ if ( /* !ps.in_or_st && */ ps.dec_nest <= 0)
+ ps.just_saw_decl = 2;
+ prefix_blankline_requested = 0;
+ for (i = 0; token[i++];); /* get length of token */
+
+ if (ps.ind_level == 0 || ps.dec_nest > 0) {
+ /* global variable or struct member in local variable */
+ dec_ind = ps.decl_indent > 0 ? ps.decl_indent : i;
+ tabs_to_var = (use_tabs ? ps.decl_indent > 0 : 0);
+ } else {
+ /* local variable */
+ dec_ind = ps.local_decl_indent > 0 ? ps.local_decl_indent : i;
+ tabs_to_var = (use_tabs ? ps.local_decl_indent > 0 : 0);
+ }
+ goto copy_id;
+
+ case ident: /* got an identifier or constant */
+ if (ps.in_decl) { /* if we are in a declaration, we must indent
+ * identifier */
+ if (is_procname == 0 || !procnames_start_line) {
+ if (!ps.block_init) {
+ if (troff && !ps.dumped_decl_indent) {
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ ps.want_blank = false;
+ sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7);
+ ps.dumped_decl_indent = 1;
+ e_code += strlen(e_code);
+ } else {
+ int cur_dec_ind;
+ int pos, startpos;
+
+ /*
+ * in order to get the tab math right for
+ * indentations that are not multiples of 8 we
+ * need to modify both startpos and dec_ind
+ * (cur_dec_ind) here by eight minus the
+ * remainder of the current starting column
+ * divided by eight. This seems to be a
+ * properly working fix
+ */
+ startpos = e_code - s_code;
+ cur_dec_ind = dec_ind;
+ pos = startpos;
+ if ((ps.ind_level * ps.ind_size) % 8 != 0) {
+ pos += (ps.ind_level * ps.ind_size) % 8;
+ cur_dec_ind += (ps.ind_level * ps.ind_size) % 8;
+ }
+
+ if (tabs_to_var) {
+ while ((pos & ~7) + 8 <= cur_dec_ind) {
+ CHECK_SIZE_CODE;
+ *e_code++ = '\t';
+ pos = (pos & ~7) + 8;
+ }
+ }
+ while (pos < cur_dec_ind) {
+ CHECK_SIZE_CODE;
+ *e_code++ = ' ';
+ pos++;
+ }
+ if (ps.want_blank && e_code - s_code == startpos)
+ *e_code++ = ' ';
+ ps.want_blank = false;
+ }
+ }
+ } else {
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ ps.want_blank = false;
+ if (dec_ind && s_code != e_code)
+ dump_line();
+ dec_ind = 0;
+ }
+ }
+ else if (sp_sw && ps.p_l_follow == 0) {
+ sp_sw = false;
+ force_nl = true;
+ ps.last_u_d = true;
+ ps.in_stmt = false;
+ parse(hd_type);
+ }
+ copy_id:
+ if (ps.want_blank)
+ *e_code++ = ' ';
+ if (troff && ps.its_a_keyword) {
+ e_code = chfont(&bodyf, &keywordf, e_code);
+ for (t_ptr = token; *t_ptr; ++t_ptr) {
+ CHECK_SIZE_CODE;
+ *e_code++ = keywordf.allcaps && islower(*t_ptr)
+ ? toupper(*t_ptr) : *t_ptr;
+ }
+ e_code = chfont(&keywordf, &bodyf, e_code);
+ }
+ else
+ for (t_ptr = token; *t_ptr; ++t_ptr) {
+ CHECK_SIZE_CODE;
+ *e_code++ = *t_ptr;
+ }
+ ps.want_blank = true;
+ break;
+
+ case period: /* treat a period kind of like a binary
+ * operation */
+ *e_code++ = '.'; /* move the period into line */
+ ps.want_blank = false; /* dont put a blank after a period */
+ break;
+
+ case comma:
+ ps.want_blank = (s_code != e_code); /* only put blank after comma
+ * if comma does not start the
+ * line */
+ if (ps.in_decl && is_procname == 0 && !ps.block_init)
+ while ((e_code - s_code) < (dec_ind - 1)) {
+ CHECK_SIZE_CODE;
+ *e_code++ = ' ';
+ }
+
+ *e_code++ = ',';
+ if (ps.p_l_follow == 0) {
+ if (ps.block_init_level <= 0)
+ ps.block_init = 0;
+ if (break_comma && (!ps.leave_comma || compute_code_target() + (e_code - s_code) > max_col - 8))
+ force_nl = true;
+ }
+ break;
+
+ case preesc: /* got the character '#' */
+ if ((s_com != e_com) ||
+ (s_lab != e_lab) ||
+ (s_code != e_code))
+ dump_line();
+ *e_lab++ = '#'; /* move whole line to 'label' buffer */
+ {
+ int in_comment = 0;
+ int com_start = 0;
+ char quote = 0;
+ int com_end = 0;
+
+ while (*buf_ptr == ' ' || *buf_ptr == '\t') {
+ buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ while (*buf_ptr != '\n' || (in_comment && !had_eof)) {
+ CHECK_SIZE_LAB;
+ *e_lab = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ switch (*e_lab++) {
+ case BACKSLASH:
+ if (troff)
+ *e_lab++ = BACKSLASH;
+ if (!in_comment) {
+ *e_lab++ = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ break;
+ case '/':
+ if (*buf_ptr == '*' && !in_comment && !quote) {
+ in_comment = 1;
+ *e_lab++ = *buf_ptr++;
+ com_start = e_lab - s_lab - 2;
+ }
+ break;
+ case '"':
+ if (quote == '"')
+ quote = 0;
+ break;
+ case '\'':
+ if (quote == '\'')
+ quote = 0;
+ break;
+ case '*':
+ if (*buf_ptr == '/' && in_comment) {
+ in_comment = 0;
+ *e_lab++ = *buf_ptr++;
+ com_end = e_lab - s_lab;
+ }
+ break;
+ }
+ }
+
+ while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t'))
+ e_lab--;
+ if (e_lab - s_lab == com_end && bp_save == 0) { /* comment on
+ * preprocessor line */
+ if (sc_end == 0) /* if this is the first comment, we
+ * must set up the buffer */
+ sc_end = &(save_com[0]);
+ else {
+ *sc_end++ = '\n'; /* add newline between
+ * comments */
+ *sc_end++ = ' ';
+ --line_no;
+ }
+ bcopy(s_lab + com_start, sc_end, com_end - com_start);
+ sc_end += com_end - com_start;
+ if (sc_end >= &save_com[sc_size])
+ abort();
+ e_lab = s_lab + com_start;
+ while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t'))
+ e_lab--;
+ bp_save = buf_ptr; /* save current input buffer */
+ be_save = buf_end;
+ buf_ptr = save_com; /* fix so that subsequent calls to
+ * lexi will take tokens out of
+ * save_com */
+ *sc_end++ = ' '; /* add trailing blank, just in case */
+ buf_end = sc_end;
+ sc_end = 0;
+ }
+ *e_lab = '\0'; /* null terminate line */
+ ps.pcase = false;
+ }
+
+ if (strncmp(s_lab, "#if", 3) == 0) {
+ if (blanklines_around_conditional_compilation) {
+ int c;
+ prefix_blankline_requested++;
+ while ((c = getc(input)) == '\n');
+ ungetc(c, input);
+ }
+ if ((size_t)ifdef_level < sizeof(state_stack)/sizeof(state_stack[0])) {
+ match_state[ifdef_level].tos = -1;
+ state_stack[ifdef_level++] = ps;
+ }
+ else
+ diag2(1, "#if stack overflow");
+ }
+ else if (strncmp(s_lab, "#else", 5) == 0)
+ if (ifdef_level <= 0)
+ diag2(1, "Unmatched #else");
+ else {
+ match_state[ifdef_level - 1] = ps;
+ ps = state_stack[ifdef_level - 1];
+ }
+ else if (strncmp(s_lab, "#endif", 6) == 0) {
+ if (ifdef_level <= 0)
+ diag2(1, "Unmatched #endif");
+ else {
+ ifdef_level--;
+
+#ifdef undef
+ /*
+ * This match needs to be more intelligent before the
+ * message is useful
+ */
+ if (match_state[ifdef_level].tos >= 0
+ && bcmp(&ps, &match_state[ifdef_level], sizeof ps))
+ diag2(0, "Syntactically inconsistent #ifdef alternatives");
+#endif
+ }
+ if (blanklines_around_conditional_compilation) {
+ postfix_blankline_requested++;
+ n_real_blanklines = 0;
+ }
+ }
+ break; /* subsequent processing of the newline
+ * character will cause the line to be printed */
+
+ case comment: /* we have gotten a / followed by * this is a biggie */
+ if (flushed_nl) { /* we should force a broken line here */
+ flushed_nl = false;
+ dump_line();
+ ps.want_blank = false; /* dont insert blank at line start */
+ force_nl = false;
+ }
+ pr_comment();
+ break;
+ } /* end of big switch stmt */
+
+ *e_code = '\0'; /* make sure code section is null terminated */
+ if (type_code != comment && type_code != newline && type_code != preesc)
+ ps.last_token = type_code;
+ } /* end of main while (1) loop */
+}
+
+/*
+ * copy input file to backup file if in_name is /blah/blah/blah/file, then
+ * backup file will be ".Bfile" then make the backup file the input and
+ * original input file the output
+ */
+static void
+bakcopy(void)
+{
+ int n,
+ bakchn;
+ char buff[8 * 1024];
+ const char *p;
+
+ /* construct file name .Bfile */
+ for (p = in_name; *p; p++); /* skip to end of string */
+ while (p > in_name && *p != '/') /* find last '/' */
+ p--;
+ if (*p == '/')
+ p++;
+ sprintf(bakfile, "%s.BAK", p);
+
+ /* copy in_name to backup file */
+ bakchn = creat(bakfile, 0600);
+ if (bakchn < 0)
+ err(1, "%s", bakfile);
+ while ((n = read(fileno(input), buff, sizeof buff)) != 0)
+ if (write(bakchn, buff, n) != n)
+ err(1, "%s", bakfile);
+ if (n < 0)
+ err(1, "%s", in_name);
+ close(bakchn);
+ fclose(input);
+
+ /* re-open backup file as the input file */
+ input = fopen(bakfile, "r");
+ if (input == NULL)
+ err(1, "%s", bakfile);
+ /* now the original input file will be the output */
+ output = fopen(in_name, "w");
+ if (output == NULL) {
+ unlink(bakfile);
+ err(1, "%s", in_name);
+ }
+}
diff --git a/usr.bin/indent/indent.h b/usr.bin/indent/indent.h
new file mode 100644
index 0000000..4c52bf8
--- /dev/null
+++ b/usr.bin/indent/indent.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001 Jens Schweikhardt
+ * 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 ``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.
+ */
+
+#if 0
+__FBSDID("$FreeBSD$");
+#endif
+
+void addkey(char *, int);
+int compute_code_target(void);
+int compute_label_target(void);
+int count_spaces(int, char *);
+int lexi(void);
+void diag2(int, const char *);
+void diag3(int, const char *, int);
+void diag4(int, const char *, int, int);
+void dump_line(void);
+void fill_buffer(void);
+void parse(int);
+void parsefont(struct fstate *, const char *);
+void pr_comment(void);
+void set_defaults(void);
+void set_option(char *);
+void set_profile(void);
+void writefdef(struct fstate *f, int);
diff --git a/usr.bin/indent/indent_codes.h b/usr.bin/indent/indent_codes.h
new file mode 100644
index 0000000..e1ff294
--- /dev/null
+++ b/usr.bin/indent/indent_codes.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)indent_codes.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define newline 1
+#define lparen 2
+#define rparen 3
+#define unary_op 4
+#define binary_op 5
+#define postop 6
+#define question 7
+#define casestmt 8
+#define colon 9
+#define semicolon 10
+#define lbrace 11
+#define rbrace 12
+#define ident 13
+#define comma 14
+#define comment 15
+#define swstmt 16
+#define preesc 17
+#define form_feed 18
+#define decl 19
+#define sp_paren 20
+#define sp_nparen 21
+#define ifstmt 22
+#define whilestmt 23
+#define forstmt 24
+#define stmt 25
+#define stmtl 26
+#define elselit 27
+#define dolit 28
+#define dohead 29
+#define ifhead 30
+#define elsehead 31
+#define period 32
diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h
new file mode 100644
index 0000000..2ea1d8d
--- /dev/null
+++ b/usr.bin/indent/indent_globs.h
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)indent_globs.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define BACKSLASH '\\'
+#define bufsize 200 /* size of internal buffers */
+#define sc_size 5000 /* size of save_com buffer */
+#define label_offset 2 /* number of levels a label is placed to left
+ * of code */
+
+#define tabsize 8 /* the size of a tab */
+#define tabmask 0177770 /* mask used when figuring length of lines
+ * with tabs */
+
+
+#define false 0
+#define true 1
+
+
+FILE *input; /* the fid for the input file */
+FILE *output; /* the output file */
+
+#define CHECK_SIZE_CODE \
+ if (e_code >= l_code) { \
+ int nsize = l_code-s_code+400; \
+ codebuf = (char *) realloc(codebuf, nsize); \
+ if (codebuf == NULL) \
+ err(1, NULL); \
+ e_code = codebuf + (e_code-s_code) + 1; \
+ l_code = codebuf + nsize - 5; \
+ s_code = codebuf + 1; \
+ }
+#define CHECK_SIZE_COM \
+ if (e_com >= l_com) { \
+ int nsize = l_com-s_com+400; \
+ combuf = (char *) realloc(combuf, nsize); \
+ if (combuf == NULL) \
+ err(1, NULL); \
+ e_com = combuf + (e_com-s_com) + 1; \
+ l_com = combuf + nsize - 5; \
+ s_com = combuf + 1; \
+ }
+#define CHECK_SIZE_LAB \
+ if (e_lab >= l_lab) { \
+ int nsize = l_lab-s_lab+400; \
+ labbuf = (char *) realloc(labbuf, nsize); \
+ if (labbuf == NULL) \
+ err(1, NULL); \
+ e_lab = labbuf + (e_lab-s_lab) + 1; \
+ l_lab = labbuf + nsize - 5; \
+ s_lab = labbuf + 1; \
+ }
+#define CHECK_SIZE_TOKEN \
+ if (e_token >= l_token) { \
+ int nsize = l_token-s_token+400; \
+ tokenbuf = (char *) realloc(tokenbuf, nsize); \
+ if (tokenbuf == NULL) \
+ err(1, NULL); \
+ e_token = tokenbuf + (e_token-s_token) + 1; \
+ l_token = tokenbuf + nsize - 5; \
+ s_token = tokenbuf + 1; \
+ }
+
+char *labbuf; /* buffer for label */
+char *s_lab; /* start ... */
+char *e_lab; /* .. and end of stored label */
+char *l_lab; /* limit of label buffer */
+
+char *codebuf; /* buffer for code section */
+char *s_code; /* start ... */
+char *e_code; /* .. and end of stored code */
+char *l_code; /* limit of code section */
+
+char *combuf; /* buffer for comments */
+char *s_com; /* start ... */
+char *e_com; /* ... and end of stored comments */
+char *l_com; /* limit of comment buffer */
+
+#define token s_token
+char *tokenbuf; /* the last token scanned */
+char *s_token;
+char *e_token;
+char *l_token;
+
+char *in_buffer; /* input buffer */
+char *in_buffer_limit; /* the end of the input buffer */
+char *buf_ptr; /* ptr to next character to be taken from
+ * in_buffer */
+char *buf_end; /* ptr to first after last char in in_buffer */
+
+char save_com[sc_size]; /* input text is saved here when looking for
+ * the brace after an if, while, etc */
+char *sc_end; /* pointer into save_com buffer */
+
+char *bp_save; /* saved value of buf_ptr when taking input
+ * from save_com */
+char *be_save; /* similarly saved value of buf_end */
+
+
+int found_err;
+int pointer_as_binop;
+int blanklines_after_declarations;
+int blanklines_before_blockcomments;
+int blanklines_after_procs;
+int blanklines_around_conditional_compilation;
+int swallow_optional_blanklines;
+int n_real_blanklines;
+int prefix_blankline_requested;
+int postfix_blankline_requested;
+int break_comma; /* when true and not in parens, break after a
+ * comma */
+int btype_2; /* when true, brace should be on same line as
+ * if, while, etc */
+float case_ind; /* indentation level to be used for a "case
+ * n:" */
+int code_lines; /* count of lines with code */
+int had_eof; /* set to true when input is exhausted */
+int line_no; /* the current line number. */
+int max_col; /* the maximum allowable line length */
+int verbose; /* when true, non-essential error messages are
+ * printed */
+int cuddle_else; /* true if else should cuddle up to '}' */
+int star_comment_cont; /* true iff comment continuation lines should
+ * have stars at the beginning of each line. */
+int comment_delimiter_on_blankline;
+int troff; /* true iff were generating troff input */
+int procnames_start_line; /* if true, the names of procedures
+ * being defined get placed in column
+ * 1 (ie. a newline is placed between
+ * the type of the procedure and its
+ * name) */
+int proc_calls_space; /* If true, procedure calls look like:
+ * foo(bar) rather than foo (bar) */
+int format_block_comments; /* true if comments beginning with
+ * `/ * \n' are to be reformatted */
+int format_col1_comments; /* If comments which start in column 1
+ * are to be magically reformatted
+ * (just like comments that begin in
+ * later columns) */
+int inhibit_formatting; /* true if INDENT OFF is in effect */
+int suppress_blanklines;/* set iff following blanklines should be
+ * suppressed */
+int continuation_indent;/* set to the indentation between the edge of
+ * code and continuation lines */
+int lineup_to_parens; /* if true, continued code within parens will
+ * be lined up to the open paren */
+int Bill_Shannon; /* true iff a blank should always be inserted
+ * after sizeof */
+int blanklines_after_declarations_at_proctop; /* This is vaguely
+ * similar to
+ * blanklines_after_decla
+ * rations except that
+ * it only applies to
+ * the first set of
+ * declarations in a
+ * procedure (just after
+ * the first '{') and it
+ * causes a blank line
+ * to be generated even
+ * if there are no
+ * declarations */
+int block_comment_max_col;
+int extra_expression_indent; /* true if continuation lines from the
+ * expression part of "if(e)",
+ * "while(e)", "for(e;e;e)" should be
+ * indented an extra tab stop so that
+ * they don't conflict with the code
+ * that follows */
+int function_brace_split; /* split function declaration and
+ * brace onto separate lines */
+int use_tabs; /* set true to use tabs for spacing,
+ * false uses all spaces */
+int auto_typedefs; /* set true to recognize identifiers
+ * ending in "_t" like typedefs */
+
+/* -troff font state information */
+
+struct fstate {
+ char font[4];
+ char size;
+ int allcaps:1;
+} __aligned(sizeof(int));
+char *chfont(struct fstate *, struct fstate *, char *);
+
+struct fstate
+ keywordf, /* keyword font */
+ stringf, /* string font */
+ boxcomf, /* Box comment font */
+ blkcomf, /* Block comment font */
+ scomf, /* Same line comment font */
+ bodyf; /* major body font */
+
+
+#define STACKSIZE 150
+
+struct parser_state {
+ int last_token;
+ struct fstate cfont; /* Current font */
+ int p_stack[STACKSIZE]; /* this is the parsers stack */
+ int il[STACKSIZE]; /* this stack stores indentation levels */
+ float cstk[STACKSIZE];/* used to store case stmt indentation levels */
+ int box_com; /* set to true when we are in a "boxed"
+ * comment. In that case, the first non-blank
+ * char should be lined up with the / in / followed by * */
+ int comment_delta,
+ n_comment_delta;
+ int cast_mask; /* indicates which close parens close off
+ * casts */
+ int sizeof_mask; /* indicates which close parens close off
+ * sizeof''s */
+ int block_init; /* true iff inside a block initialization */
+ int block_init_level; /* The level of brace nesting in an
+ * initialization */
+ int last_nl; /* this is true if the last thing scanned was
+ * a newline */
+ int in_or_st; /* Will be true iff there has been a
+ * declarator (e.g. int or char) and no left
+ * paren since the last semicolon. When true,
+ * a '{' is starting a structure definition or
+ * an initialization list */
+ int bl_line; /* set to 1 by dump_line if the line is blank */
+ int col_1; /* set to true if the last token started in
+ * column 1 */
+ int com_col; /* this is the column in which the current
+ * comment should start */
+ int com_ind; /* the column in which comments to the right
+ * of code should start */
+ int com_lines; /* the number of lines with comments, set by
+ * dump_line */
+ int dec_nest; /* current nesting level for structure or init */
+ int decl_com_ind; /* the column in which comments after
+ * declarations should be put */
+ int decl_on_line; /* set to true if this line of code has part
+ * of a declaration on it */
+ int i_l_follow; /* the level to which ind_level should be set
+ * after the current line is printed */
+ int in_decl; /* set to true when we are in a declaration
+ * stmt. The processing of braces is then
+ * slightly different */
+ int in_stmt; /* set to 1 while in a stmt */
+ int ind_level; /* the current indentation level */
+ int ind_size; /* the size of one indentation level */
+ int ind_stmt; /* set to 1 if next line should have an extra
+ * indentation level because we are in the
+ * middle of a stmt */
+ int last_u_d; /* set to true after scanning a token which
+ * forces a following operator to be unary */
+ int leave_comma; /* if true, never break declarations after
+ * commas */
+ int ljust_decl; /* true if declarations should be left
+ * justified */
+ int out_coms; /* the number of comments processed, set by
+ * pr_comment */
+ int out_lines; /* the number of lines written, set by
+ * dump_line */
+ int p_l_follow; /* used to remember how to indent following
+ * statement */
+ int paren_level; /* parenthesization level. used to indent
+ * within statements */
+ short paren_indents[20]; /* column positions of each paren */
+ int pcase; /* set to 1 if the current line label is a
+ * case. It is printed differently from a
+ * regular label */
+ int search_brace; /* set to true by parse when it is necessary
+ * to buffer up all info up to the start of a
+ * stmt after an if, while, etc */
+ int unindent_displace; /* comments not to the right of code
+ * will be placed this many
+ * indentation levels to the left of
+ * code */
+ int use_ff; /* set to one if the current line should be
+ * terminated with a form feed */
+ int want_blank; /* set to true when the following token should
+ * be prefixed by a blank. (Said prefixing is
+ * ignored in some cases.) */
+ int else_if; /* True iff else if pairs should be handled
+ * specially */
+ int decl_indent; /* column to indent declared identifiers to */
+ int local_decl_indent; /* like decl_indent but for locals */
+ int its_a_keyword;
+ int sizeof_keyword;
+ int dumped_decl_indent;
+ float case_indent; /* The distance to indent case labels from the
+ * switch statement */
+ int in_parameter_declaration;
+ int indent_parameters;
+ int tos; /* pointer to top of stack */
+ char procname[100]; /* The name of the current procedure */
+ int just_saw_decl;
+} ps;
+
+int ifdef_level;
+int rparen_count;
+struct parser_state state_stack[5];
+struct parser_state match_state[5];
diff --git a/usr.bin/indent/io.c b/usr.bin/indent/io.c
new file mode 100644
index 0000000..4a3db83
--- /dev/null
+++ b/usr.bin/indent/io.c
@@ -0,0 +1,667 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "indent_globs.h"
+#include "indent.h"
+
+int comment_open;
+static int paren_target;
+static int pad_output(int current, int target);
+
+void
+dump_line(void)
+{ /* dump_line is the routine that actually
+ * effects the printing of the new source. It
+ * prints the label section, followed by the
+ * code section with the appropriate nesting
+ * level, followed by any comments */
+ int cur_col,
+ target_col = 1;
+ static int not_first_line;
+
+ if (ps.procname[0]) {
+ if (troff) {
+ if (comment_open) {
+ comment_open = 0;
+ fprintf(output, ".*/\n");
+ }
+ fprintf(output, ".Pr \"%s\"\n", ps.procname);
+ }
+ ps.ind_level = 0;
+ ps.procname[0] = 0;
+ }
+ if (s_code == e_code && s_lab == e_lab && s_com == e_com) {
+ if (suppress_blanklines > 0)
+ suppress_blanklines--;
+ else {
+ ps.bl_line = true;
+ n_real_blanklines++;
+ }
+ }
+ else if (!inhibit_formatting) {
+ suppress_blanklines = 0;
+ ps.bl_line = false;
+ if (prefix_blankline_requested && not_first_line) {
+ if (swallow_optional_blanklines) {
+ if (n_real_blanklines == 1)
+ n_real_blanklines = 0;
+ }
+ else {
+ if (n_real_blanklines == 0)
+ n_real_blanklines = 1;
+ }
+ }
+ while (--n_real_blanklines >= 0)
+ putc('\n', output);
+ n_real_blanklines = 0;
+ if (ps.ind_level == 0)
+ ps.ind_stmt = 0; /* this is a class A kludge. dont do
+ * additional statement indentation if we are
+ * at bracket level 0 */
+
+ if (e_lab != s_lab || e_code != s_code)
+ ++code_lines; /* keep count of lines with code */
+
+
+ if (e_lab != s_lab) { /* print lab, if any */
+ if (comment_open) {
+ comment_open = 0;
+ fprintf(output, ".*/\n");
+ }
+ while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t'))
+ e_lab--;
+ cur_col = pad_output(1, compute_label_target());
+ if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0
+ || strncmp(s_lab, "#endif", 6) == 0)) {
+ char *s = s_lab;
+ if (e_lab[-1] == '\n') e_lab--;
+ do putc(*s++, output);
+ while (s < e_lab && 'a' <= *s && *s<='z');
+ while ((*s == ' ' || *s == '\t') && s < e_lab)
+ s++;
+ if (s < e_lab)
+ fprintf(output, s[0]=='/' && s[1]=='*' ? "\t%.*s" : "\t/* %.*s */",
+ (int)(e_lab - s), s);
+ }
+ else fprintf(output, "%.*s", (int)(e_lab - s_lab), s_lab);
+ cur_col = count_spaces(cur_col, s_lab);
+ }
+ else
+ cur_col = 1; /* there is no label section */
+
+ ps.pcase = false;
+
+ if (s_code != e_code) { /* print code section, if any */
+ char *p;
+
+ if (comment_open) {
+ comment_open = 0;
+ fprintf(output, ".*/\n");
+ }
+ target_col = compute_code_target();
+ {
+ int i;
+
+ for (i = 0; i < ps.p_l_follow; i++)
+ if (ps.paren_indents[i] >= 0)
+ ps.paren_indents[i] = -(ps.paren_indents[i] + target_col);
+ }
+ cur_col = pad_output(cur_col, target_col);
+ for (p = s_code; p < e_code; p++)
+ if (*p == (char) 0200)
+ fprintf(output, "%d", target_col * 7);
+ else
+ putc(*p, output);
+ cur_col = count_spaces(cur_col, s_code);
+ }
+ if (s_com != e_com) {
+ if (troff) {
+ int all_here = 0;
+ char *p;
+
+ if (e_com[-1] == '/' && e_com[-2] == '*')
+ e_com -= 2, all_here++;
+ while (e_com > s_com && e_com[-1] == ' ')
+ e_com--;
+ *e_com = 0;
+ p = s_com;
+ while (*p == ' ')
+ p++;
+ if (p[0] == '/' && p[1] == '*')
+ p += 2, all_here++;
+ else if (p[0] == '*')
+ p += p[1] == '/' ? 2 : 1;
+ while (*p == ' ')
+ p++;
+ if (*p == 0)
+ goto inhibit_newline;
+ if (comment_open < 2 && ps.box_com) {
+ comment_open = 0;
+ fprintf(output, ".*/\n");
+ }
+ if (comment_open == 0) {
+ if ('a' <= *p && *p <= 'z')
+ *p = *p + 'A' - 'a';
+ if (e_com - p < 50 && all_here == 2) {
+ char *follow = p;
+ fprintf(output, "\n.nr C! \\w\1");
+ while (follow < e_com) {
+ switch (*follow) {
+ case '\n':
+ putc(' ', output);
+ case 1:
+ break;
+ case '\\':
+ putc('\\', output);
+ default:
+ putc(*follow, output);
+ }
+ follow++;
+ }
+ putc(1, output);
+ }
+ fprintf(output, "\n./* %dp %d %dp\n",
+ ps.com_col * 7,
+ (s_code != e_code || s_lab != e_lab) - ps.box_com,
+ target_col * 7);
+ }
+ comment_open = 1 + ps.box_com;
+ while (*p) {
+ if (*p == BACKSLASH)
+ putc(BACKSLASH, output);
+ putc(*p++, output);
+ }
+ }
+ else { /* print comment, if any */
+ int target = ps.com_col;
+ char *com_st = s_com;
+
+ target += ps.comment_delta;
+ while (*com_st == '\t')
+ com_st++, target += 8; /* ? */
+ while (target <= 0)
+ if (*com_st == ' ')
+ target++, com_st++;
+ else if (*com_st == '\t')
+ target = ((target - 1) & ~7) + 9, com_st++;
+ else
+ target = 1;
+ if (cur_col > target) { /* if comment can't fit on this line,
+ * put it on next line */
+ putc('\n', output);
+ cur_col = 1;
+ ++ps.out_lines;
+ }
+ while (e_com > com_st && isspace(e_com[-1]))
+ e_com--;
+ cur_col = pad_output(cur_col, target);
+ if (!ps.box_com) {
+ if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) {
+ if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1)
+ com_st[1] = '*';
+ else
+ fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output);
+ }
+ }
+ fwrite(com_st, e_com - com_st, 1, output);
+ ps.comment_delta = ps.n_comment_delta;
+ cur_col = count_spaces(cur_col, com_st);
+ ++ps.com_lines; /* count lines with comments */
+ }
+ }
+ if (ps.use_ff)
+ putc('\014', output);
+ else
+ putc('\n', output);
+inhibit_newline:
+ ++ps.out_lines;
+ if (ps.just_saw_decl == 1 && blanklines_after_declarations) {
+ prefix_blankline_requested = 1;
+ ps.just_saw_decl = 0;
+ }
+ else
+ prefix_blankline_requested = postfix_blankline_requested;
+ postfix_blankline_requested = 0;
+ }
+ ps.decl_on_line = ps.in_decl; /* if we are in the middle of a
+ * declaration, remember that fact for
+ * proper comment indentation */
+ ps.ind_stmt = ps.in_stmt & ~ps.in_decl; /* next line should be
+ * indented if we have not
+ * completed this stmt and if
+ * we are not in the middle of
+ * a declaration */
+ ps.use_ff = false;
+ ps.dumped_decl_indent = 0;
+ *(e_lab = s_lab) = '\0'; /* reset buffers */
+ *(e_code = s_code) = '\0';
+ *(e_com = s_com) = '\0';
+ ps.ind_level = ps.i_l_follow;
+ ps.paren_level = ps.p_l_follow;
+ paren_target = -ps.paren_indents[ps.paren_level - 1];
+ not_first_line = 1;
+}
+
+int
+compute_code_target(void)
+{
+ int target_col = ps.ind_size * ps.ind_level + 1;
+
+ if (ps.paren_level)
+ if (!lineup_to_parens)
+ target_col += continuation_indent
+ * (2 * continuation_indent == ps.ind_size ? 1 : ps.paren_level);
+ else {
+ int w;
+ int t = paren_target;
+
+ if ((w = count_spaces(t, s_code) - max_col) > 0
+ && count_spaces(target_col, s_code) <= max_col) {
+ t -= w + 1;
+ if (t > target_col)
+ target_col = t;
+ }
+ else
+ target_col = t;
+ }
+ else if (ps.ind_stmt)
+ target_col += continuation_indent;
+ return target_col;
+}
+
+int
+compute_label_target(void)
+{
+ return
+ ps.pcase ? (int) (case_ind * ps.ind_size) + 1
+ : *s_lab == '#' ? 1
+ : ps.ind_size * (ps.ind_level - label_offset) + 1;
+}
+
+
+/*
+ * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
+ *
+ * All rights reserved
+ *
+ *
+ * NAME: fill_buffer
+ *
+ * FUNCTION: Reads one block of input into input_buffer
+ *
+ * HISTORY: initial coding November 1976 D A Willcox of CAC 1/7/77 A
+ * Willcox of CAC Added check for switch back to partly full input
+ * buffer from temporary buffer
+ *
+ */
+void
+fill_buffer(void)
+{ /* this routine reads stuff from the input */
+ char *p;
+ int i;
+ FILE *f = input;
+
+ if (bp_save != 0) { /* there is a partly filled input buffer left */
+ buf_ptr = bp_save; /* dont read anything, just switch buffers */
+ buf_end = be_save;
+ bp_save = be_save = 0;
+ if (buf_ptr < buf_end)
+ return; /* only return if there is really something in
+ * this buffer */
+ }
+ for (p = in_buffer;;) {
+ if (p >= in_buffer_limit) {
+ int size = (in_buffer_limit - in_buffer) * 2 + 10;
+ int offset = p - in_buffer;
+ in_buffer = realloc(in_buffer, size);
+ if (in_buffer == NULL)
+ errx(1, "input line too long");
+ p = in_buffer + offset;
+ in_buffer_limit = in_buffer + size - 2;
+ }
+ if ((i = getc(f)) == EOF) {
+ *p++ = ' ';
+ *p++ = '\n';
+ had_eof = true;
+ break;
+ }
+ *p++ = i;
+ if (i == '\n')
+ break;
+ }
+ buf_ptr = in_buffer;
+ buf_end = p;
+ if (p[-2] == '/' && p[-3] == '*') {
+ if (in_buffer[3] == 'I' && strncmp(in_buffer, "/**INDENT**", 11) == 0)
+ fill_buffer(); /* flush indent error message */
+ else {
+ int com = 0;
+
+ p = in_buffer;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p == '/' && p[1] == '*') {
+ p += 2;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (p[0] == 'I' && p[1] == 'N' && p[2] == 'D' && p[3] == 'E'
+ && p[4] == 'N' && p[5] == 'T') {
+ p += 6;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p == '*')
+ com = 1;
+ else if (*p == 'O') {
+ if (*++p == 'N')
+ p++, com = 1;
+ else if (*p == 'F' && *++p == 'F')
+ p++, com = 2;
+ }
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (p[0] == '*' && p[1] == '/' && p[2] == '\n' && com) {
+ if (s_com != e_com || s_lab != e_lab || s_code != e_code)
+ dump_line();
+ if (!(inhibit_formatting = com - 1)) {
+ n_real_blanklines = 0;
+ postfix_blankline_requested = 0;
+ prefix_blankline_requested = 0;
+ suppress_blanklines = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (inhibit_formatting) {
+ p = in_buffer;
+ do
+ putc(*p, output);
+ while (*p++ != '\n');
+ }
+}
+
+/*
+ * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
+ *
+ * All rights reserved
+ *
+ *
+ * NAME: pad_output
+ *
+ * FUNCTION: Writes tabs and spaces to move the current column up to the desired
+ * position.
+ *
+ * ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf.
+ *
+ * PARAMETERS: current integer The current column target
+ * nteger The desired column
+ *
+ * RETURNS: Integer value of the new column. (If current >= target, no action is
+ * taken, and current is returned.
+ *
+ * GLOBALS: None
+ *
+ * CALLS: write (sys)
+ *
+ * CALLED BY: dump_line
+ *
+ * HISTORY: initial coding November 1976 D A Willcox of CAC
+ *
+ */
+static int
+pad_output(int current, int target)
+ /* writes tabs and blanks (if necessary) to
+ * get the current output position up to the
+ * target column */
+ /* current: the current column value */
+ /* target: position we want it at */
+{
+ int curr; /* internal column pointer */
+ int tcur;
+
+ if (troff)
+ fprintf(output, "\\h'|%dp'", (target - 1) * 7);
+ else {
+ if (current >= target)
+ return (current); /* line is already long enough */
+ curr = current;
+ if (use_tabs) {
+ while ((tcur = ((curr - 1) & tabmask) + tabsize + 1) <= target) {
+ putc('\t', output);
+ curr = tcur;
+ }
+ }
+ while (curr++ < target)
+ putc(' ', output); /* pad with final blanks */
+ }
+ return (target);
+}
+
+/*
+ * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
+ *
+ * All rights reserved
+ *
+ *
+ * NAME: count_spaces
+ *
+ * FUNCTION: Find out where printing of a given string will leave the current
+ * character position on output.
+ *
+ * ALGORITHM: Run thru input string and add appropriate values to current
+ * position.
+ *
+ * RETURNS: Integer value of position after printing "buffer" starting in column
+ * "current".
+ *
+ * HISTORY: initial coding November 1976 D A Willcox of CAC
+ *
+ */
+int
+count_spaces(int current, char *buffer)
+/*
+ * this routine figures out where the character position will be after
+ * printing the text in buffer starting at column "current"
+ */
+{
+ char *buf; /* used to look thru buffer */
+ int cur; /* current character counter */
+
+ cur = current;
+
+ for (buf = buffer; *buf != '\0'; ++buf) {
+ switch (*buf) {
+
+ case '\n':
+ case 014: /* form feed */
+ cur = 1;
+ break;
+
+ case '\t':
+ cur = ((cur - 1) & tabmask) + tabsize + 1;
+ break;
+
+ case 010: /* backspace */
+ --cur;
+ break;
+
+ default:
+ ++cur;
+ break;
+ } /* end of switch */
+ } /* end of for loop */
+ return (cur);
+}
+
+void
+diag4(int level, const char *msg, int a, int b)
+{
+ if (level)
+ found_err = 1;
+ if (output == stdout) {
+ fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stdout, msg, a, b);
+ fprintf(stdout, " */\n");
+ }
+ else {
+ fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stderr, msg, a, b);
+ fprintf(stderr, "\n");
+ }
+}
+
+void
+diag3(int level, const char *msg, int a)
+{
+ if (level)
+ found_err = 1;
+ if (output == stdout) {
+ fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stdout, msg, a);
+ fprintf(stdout, " */\n");
+ }
+ else {
+ fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stderr, msg, a);
+ fprintf(stderr, "\n");
+ }
+}
+
+void
+diag2(int level, const char *msg)
+{
+ if (level)
+ found_err = 1;
+ if (output == stdout) {
+ fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stdout, "%s", msg);
+ fprintf(stdout, " */\n");
+ }
+ else {
+ fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no);
+ fprintf(stderr, "%s", msg);
+ fprintf(stderr, "\n");
+ }
+}
+
+void
+writefdef(struct fstate *f, int nm)
+{
+ fprintf(output, ".ds f%c %s\n.nr s%c %d\n",
+ nm, f->font, nm, f->size);
+}
+
+char *
+chfont(struct fstate *of, struct fstate *nf, char *s)
+{
+ if (of->font[0] != nf->font[0]
+ || of->font[1] != nf->font[1]) {
+ *s++ = '\\';
+ *s++ = 'f';
+ if (nf->font[1]) {
+ *s++ = '(';
+ *s++ = nf->font[0];
+ *s++ = nf->font[1];
+ }
+ else
+ *s++ = nf->font[0];
+ }
+ if (nf->size != of->size) {
+ *s++ = '\\';
+ *s++ = 's';
+ if (nf->size < of->size) {
+ *s++ = '-';
+ *s++ = '0' + of->size - nf->size;
+ }
+ else {
+ *s++ = '+';
+ *s++ = '0' + nf->size - of->size;
+ }
+ }
+ return s;
+}
+
+void
+parsefont(struct fstate *f, const char *s0)
+{
+ const char *s = s0;
+ int sizedelta = 0;
+
+ bzero(f, sizeof *f);
+ while (*s) {
+ if (isdigit(*s))
+ f->size = f->size * 10 + *s - '0';
+ else if (isupper(*s))
+ if (f->font[0])
+ f->font[1] = *s;
+ else
+ f->font[0] = *s;
+ else if (*s == 'c')
+ f->allcaps = 1;
+ else if (*s == '+')
+ sizedelta++;
+ else if (*s == '-')
+ sizedelta--;
+ else {
+ errx(1, "bad font specification: %s", s0);
+ }
+ s++;
+ }
+ if (f->font[0] == 0)
+ f->font[0] = 'R';
+ if (bodyf.size == 0)
+ bodyf.size = 11;
+ if (f->size == 0)
+ f->size = bodyf.size + sizedelta;
+ else if (sizedelta > 0)
+ f->size += bodyf.size;
+ else
+ f->size = bodyf.size - f->size;
+}
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
new file mode 100644
index 0000000..1200a39
--- /dev/null
+++ b/usr.bin/indent/lexi.c
@@ -0,0 +1,608 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Here we have the token scanner for indent. It scans off one token and puts
+ * it in the global variable "token". It returns a code, indicating the type
+ * of token scanned.
+ */
+
+#include <err.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include "indent_globs.h"
+#include "indent_codes.h"
+#include "indent.h"
+
+#define alphanum 1
+#define opchar 3
+
+struct templ {
+ const char *rwd;
+ int rwcode;
+};
+
+struct templ specials[1000] =
+{
+ {"switch", 1},
+ {"case", 2},
+ {"break", 0},
+ {"struct", 3},
+ {"union", 3},
+ {"enum", 3},
+ {"default", 2},
+ {"int", 4},
+ {"char", 4},
+ {"float", 4},
+ {"double", 4},
+ {"long", 4},
+ {"short", 4},
+ {"typedef", 4},
+ {"unsigned", 4},
+ {"register", 4},
+ {"static", 4},
+ {"global", 4},
+ {"extern", 4},
+ {"void", 4},
+ {"const", 4},
+ {"volatile", 4},
+ {"goto", 0},
+ {"return", 0},
+ {"if", 5},
+ {"while", 5},
+ {"for", 5},
+ {"else", 6},
+ {"do", 6},
+ {"sizeof", 7},
+ {0, 0}
+};
+
+char chartype[128] =
+{ /* this is used to facilitate the decision of
+ * what type (alphanumeric, operator) each
+ * character is */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 1, 3, 3, 0,
+ 0, 0, 3, 3, 0, 3, 0, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 3, 3, 3, 3,
+ 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, 0, 0, 0, 3, 1,
+ 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, 0, 3, 0, 3, 0
+};
+
+int
+lexi(void)
+{
+ int unary_delim; /* this is set to 1 if the current token
+ * forces a following operator to be unary */
+ static int last_code; /* the last token type returned */
+ static int l_struct; /* set to 1 if the last token was 'struct' */
+ int code; /* internal code to be returned */
+ char qchar; /* the delimiter character for a string */
+
+ e_token = s_token; /* point to start of place to save token */
+ unary_delim = false;
+ ps.col_1 = ps.last_nl; /* tell world that this token started in
+ * column 1 iff the last thing scanned was nl */
+ ps.last_nl = false;
+
+ while (*buf_ptr == ' ' || *buf_ptr == '\t') { /* get rid of blanks */
+ ps.col_1 = false; /* leading blanks imply token is not in column
+ * 1 */
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ }
+
+ /* Scan an alphanumeric token */
+ if (chartype[(int)*buf_ptr] == alphanum || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
+ /*
+ * we have a character or number
+ */
+ const char *j; /* used for searching thru list of
+ *
+ * reserved words */
+ struct templ *p;
+
+ if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
+ int seendot = 0,
+ seenexp = 0,
+ seensfx = 0;
+ if (*buf_ptr == '0' &&
+ (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) {
+ *e_token++ = *buf_ptr++;
+ *e_token++ = *buf_ptr++;
+ while (isxdigit(*buf_ptr)) {
+ CHECK_SIZE_TOKEN;
+ *e_token++ = *buf_ptr++;
+ }
+ }
+ else
+ while (1) {
+ if (*buf_ptr == '.') {
+ if (seendot)
+ break;
+ else
+ seendot++;
+ }
+ CHECK_SIZE_TOKEN;
+ *e_token++ = *buf_ptr++;
+ if (!isdigit(*buf_ptr) && *buf_ptr != '.') {
+ if ((*buf_ptr != 'E' && *buf_ptr != 'e') || seenexp)
+ break;
+ else {
+ seenexp++;
+ seendot++;
+ CHECK_SIZE_TOKEN;
+ *e_token++ = *buf_ptr++;
+ if (*buf_ptr == '+' || *buf_ptr == '-')
+ *e_token++ = *buf_ptr++;
+ }
+ }
+ }
+ while (1) {
+ if (!(seensfx & 1) &&
+ (*buf_ptr == 'U' || *buf_ptr == 'u')) {
+ CHECK_SIZE_TOKEN;
+ *e_token++ = *buf_ptr++;
+ seensfx |= 1;
+ continue;
+ }
+ if (!(seensfx & 2) &&
+ (*buf_ptr == 'L' || *buf_ptr == 'l')) {
+ CHECK_SIZE_TOKEN;
+ if (buf_ptr[1] == buf_ptr[0])
+ *e_token++ = *buf_ptr++;
+ *e_token++ = *buf_ptr++;
+ seensfx |= 2;
+ continue;
+ }
+ break;
+ }
+ }
+ else
+ while (chartype[(int)*buf_ptr] == alphanum || *buf_ptr == BACKSLASH) {
+ /* fill_buffer() terminates buffer with newline */
+ if (*buf_ptr == BACKSLASH) {
+ if (*(buf_ptr + 1) == '\n') {
+ buf_ptr += 2;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ } else
+ break;
+ }
+ CHECK_SIZE_TOKEN;
+ /* copy it over */
+ *e_token++ = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ *e_token++ = '\0';
+ while (*buf_ptr == ' ' || *buf_ptr == '\t') { /* get rid of blanks */
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ ps.its_a_keyword = false;
+ ps.sizeof_keyword = false;
+ if (l_struct && !ps.p_l_follow) {
+ /* if last token was 'struct' and we're not
+ * in parentheses, then this token
+ * should be treated as a declaration */
+ l_struct = false;
+ last_code = ident;
+ ps.last_u_d = true;
+ return (decl);
+ }
+ ps.last_u_d = l_struct; /* Operator after identifier is binary
+ * unless last token was 'struct' */
+ l_struct = false;
+ last_code = ident; /* Remember that this is the code we will
+ * return */
+
+ if (auto_typedefs) {
+ const char *q = s_token;
+ size_t q_len = strlen(q);
+ /* Check if we have an "_t" in the end */
+ if (q_len > 2 &&
+ (strcmp(q + q_len - 2, "_t") == 0)) {
+ ps.its_a_keyword = true;
+ ps.last_u_d = true;
+ goto found_auto_typedef;
+ }
+ }
+
+ /*
+ * This loop will check if the token is a keyword.
+ */
+ for (p = specials; (j = p->rwd) != 0; p++) {
+ const char *q = s_token; /* point at scanned token */
+ if (*j++ != *q++ || *j++ != *q++)
+ continue; /* This test depends on the fact that
+ * identifiers are always at least 1 character
+ * long (ie. the first two bytes of the
+ * identifier are always meaningful) */
+ if (q[-1] == 0)
+ break; /* If its a one-character identifier */
+ while (*q++ == *j)
+ if (*j++ == 0)
+ goto found_keyword; /* I wish that C had a multi-level
+ * break... */
+ }
+ if (p->rwd) { /* we have a keyword */
+ found_keyword:
+ ps.its_a_keyword = true;
+ ps.last_u_d = true;
+ switch (p->rwcode) {
+ case 1: /* it is a switch */
+ return (swstmt);
+ case 2: /* a case or default */
+ return (casestmt);
+
+ case 3: /* a "struct" */
+ /*
+ * Next time around, we will want to know that we have had a
+ * 'struct'
+ */
+ l_struct = true;
+ /* FALLTHROUGH */
+
+ case 4: /* one of the declaration keywords */
+ found_auto_typedef:
+ if (ps.p_l_follow) {
+ ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.sizeof_mask;
+ break; /* inside parens: cast, param list or sizeof */
+ }
+ last_code = decl;
+ return (decl);
+
+ case 5: /* if, while, for */
+ return (sp_paren);
+
+ case 6: /* do, else */
+ return (sp_nparen);
+
+ case 7:
+ ps.sizeof_keyword = true;
+ default: /* all others are treated like any other
+ * identifier */
+ return (ident);
+ } /* end of switch */
+ } /* end of if (found_it) */
+ if (*buf_ptr == '(' && ps.tos <= 1 && ps.ind_level == 0) {
+ char *tp = buf_ptr;
+ while (tp < buf_end)
+ if (*tp++ == ')' && (*tp == ';' || *tp == ','))
+ goto not_proc;
+ strncpy(ps.procname, token, sizeof ps.procname - 1);
+ ps.in_parameter_declaration = 1;
+ rparen_count = 1;
+ not_proc:;
+ }
+ /*
+ * The following hack attempts to guess whether or not the current
+ * token is in fact a declaration keyword -- one that has been
+ * typedefd
+ */
+ if (((*buf_ptr == '*' && buf_ptr[1] != '=') || isalpha(*buf_ptr) || *buf_ptr == '_')
+ && !ps.p_l_follow
+ && !ps.block_init
+ && (ps.last_token == rparen || ps.last_token == semicolon ||
+ ps.last_token == decl ||
+ ps.last_token == lbrace || ps.last_token == rbrace)) {
+ ps.its_a_keyword = true;
+ ps.last_u_d = true;
+ last_code = decl;
+ return decl;
+ }
+ if (last_code == decl) /* if this is a declared variable, then
+ * following sign is unary */
+ ps.last_u_d = true; /* will make "int a -1" work */
+ last_code = ident;
+ return (ident); /* the ident is not in the list */
+ } /* end of procesing for alpanum character */
+
+ /* Scan a non-alphanumeric token */
+
+ *e_token++ = *buf_ptr; /* if it is only a one-character token, it is
+ * moved here */
+ *e_token = '\0';
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+
+ switch (*token) {
+ case '\n':
+ unary_delim = ps.last_u_d;
+ ps.last_nl = true; /* remember that we just had a newline */
+ code = (had_eof ? 0 : newline);
+
+ /*
+ * if data has been exhausted, the newline is a dummy, and we should
+ * return code to stop
+ */
+ break;
+
+ case '\'': /* start of quoted character */
+ case '"': /* start of string */
+ qchar = *token;
+ if (troff) {
+ e_token[-1] = '`';
+ if (qchar == '"')
+ *e_token++ = '`';
+ e_token = chfont(&bodyf, &stringf, e_token);
+ }
+ do { /* copy the string */
+ while (1) { /* move one character or [/<char>]<char> */
+ if (*buf_ptr == '\n') {
+ diag2(1, "Unterminated literal");
+ goto stop_lit;
+ }
+ CHECK_SIZE_TOKEN; /* Only have to do this once in this loop,
+ * since CHECK_SIZE guarantees that there
+ * are at least 5 entries left */
+ *e_token = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ if (*e_token == BACKSLASH) { /* if escape, copy extra char */
+ if (*buf_ptr == '\n') /* check for escaped newline */
+ ++line_no;
+ if (troff) {
+ *++e_token = BACKSLASH;
+ if (*buf_ptr == BACKSLASH)
+ *++e_token = BACKSLASH;
+ }
+ *++e_token = *buf_ptr++;
+ ++e_token; /* we must increment this again because we
+ * copied two chars */
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ else
+ break; /* we copied one character */
+ } /* end of while (1) */
+ } while (*e_token++ != qchar);
+ if (troff) {
+ e_token = chfont(&stringf, &bodyf, e_token - 1);
+ if (qchar == '"')
+ *e_token++ = '\'';
+ }
+stop_lit:
+ code = ident;
+ break;
+
+ case ('('):
+ case ('['):
+ unary_delim = true;
+ code = lparen;
+ break;
+
+ case (')'):
+ case (']'):
+ code = rparen;
+ break;
+
+ case '#':
+ unary_delim = ps.last_u_d;
+ code = preesc;
+ break;
+
+ case '?':
+ unary_delim = true;
+ code = question;
+ break;
+
+ case (':'):
+ code = colon;
+ unary_delim = true;
+ break;
+
+ case (';'):
+ unary_delim = true;
+ code = semicolon;
+ break;
+
+ case ('{'):
+ unary_delim = true;
+
+ /*
+ * if (ps.in_or_st) ps.block_init = 1;
+ */
+ /* ? code = ps.block_init ? lparen : lbrace; */
+ code = lbrace;
+ break;
+
+ case ('}'):
+ unary_delim = true;
+ /* ? code = ps.block_init ? rparen : rbrace; */
+ code = rbrace;
+ break;
+
+ case 014: /* a form feed */
+ unary_delim = ps.last_u_d;
+ ps.last_nl = true; /* remember this so we can set 'ps.col_1'
+ * right */
+ code = form_feed;
+ break;
+
+ case (','):
+ unary_delim = true;
+ code = comma;
+ break;
+
+ case '.':
+ unary_delim = false;
+ code = period;
+ break;
+
+ case '-':
+ case '+': /* check for -, +, --, ++ */
+ code = (ps.last_u_d ? unary_op : binary_op);
+ unary_delim = true;
+
+ if (*buf_ptr == token[0]) {
+ /* check for doubled character */
+ *e_token++ = *buf_ptr++;
+ /* buffer overflow will be checked at end of loop */
+ if (last_code == ident || last_code == rparen) {
+ code = (ps.last_u_d ? unary_op : postop);
+ /* check for following ++ or -- */
+ unary_delim = false;
+ }
+ }
+ else if (*buf_ptr == '=')
+ /* check for operator += */
+ *e_token++ = *buf_ptr++;
+ else if (*buf_ptr == '>') {
+ /* check for operator -> */
+ *e_token++ = *buf_ptr++;
+ if (!pointer_as_binop) {
+ unary_delim = false;
+ code = unary_op;
+ ps.want_blank = false;
+ }
+ }
+ break; /* buffer overflow will be checked at end of
+ * switch */
+
+ case '=':
+ if (ps.in_or_st)
+ ps.block_init = 1;
+#ifdef undef
+ if (chartype[*buf_ptr] == opchar) { /* we have two char assignment */
+ e_token[-1] = *buf_ptr++;
+ if ((e_token[-1] == '<' || e_token[-1] == '>') && e_token[-1] == *buf_ptr)
+ *e_token++ = *buf_ptr++;
+ *e_token++ = '='; /* Flip =+ to += */
+ *e_token = 0;
+ }
+#else
+ if (*buf_ptr == '=') {/* == */
+ *e_token++ = '='; /* Flip =+ to += */
+ buf_ptr++;
+ *e_token = 0;
+ }
+#endif
+ code = binary_op;
+ unary_delim = true;
+ break;
+ /* can drop thru!!! */
+
+ case '>':
+ case '<':
+ case '!': /* ops like <, <<, <=, !=, etc */
+ if (*buf_ptr == '>' || *buf_ptr == '<' || *buf_ptr == '=') {
+ *e_token++ = *buf_ptr;
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ if (*buf_ptr == '=')
+ *e_token++ = *buf_ptr++;
+ code = (ps.last_u_d ? unary_op : binary_op);
+ unary_delim = true;
+ break;
+
+ default:
+ if (token[0] == '/' && *buf_ptr == '*') {
+ /* it is start of comment */
+ *e_token++ = '*';
+
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+
+ code = comment;
+ unary_delim = ps.last_u_d;
+ break;
+ }
+ while (*(e_token - 1) == *buf_ptr || *buf_ptr == '=') {
+ /*
+ * handle ||, &&, etc, and also things as in int *****i
+ */
+ *e_token++ = *buf_ptr;
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ }
+ code = (ps.last_u_d ? unary_op : binary_op);
+ unary_delim = true;
+
+
+ } /* end of switch */
+ if (code != newline) {
+ l_struct = false;
+ last_code = code;
+ }
+ if (buf_ptr >= buf_end) /* check for input buffer empty */
+ fill_buffer();
+ ps.last_u_d = unary_delim;
+ *e_token = '\0'; /* null terminate the token */
+ return (code);
+}
+
+/*
+ * Add the given keyword to the keyword table, using val as the keyword type
+ */
+void
+addkey(char *key, int val)
+{
+ struct templ *p = specials;
+ while (p->rwd)
+ if (p->rwd[0] == key[0] && strcmp(p->rwd, key) == 0)
+ return;
+ else
+ p++;
+ if (p >= specials + sizeof specials / sizeof specials[0])
+ return; /* For now, table overflows are silently
+ * ignored */
+ p->rwd = key;
+ p->rwcode = val;
+ p[1].rwd = 0;
+ p[1].rwcode = 0;
+}
diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c
new file mode 100644
index 0000000..65d9a6b
--- /dev/null
+++ b/usr.bin/indent/parse.c
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include "indent_globs.h"
+#include "indent_codes.h"
+#include "indent.h"
+
+static void reduce(void);
+
+void
+parse(int tk) /* tk: the code for the construct scanned */
+{
+ int i;
+
+#ifdef debug
+ printf("%2d - %s\n", tk, token);
+#endif
+
+ while (ps.p_stack[ps.tos] == ifhead && tk != elselit) {
+ /* true if we have an if without an else */
+ ps.p_stack[ps.tos] = stmt; /* apply the if(..) stmt ::= stmt
+ * reduction */
+ reduce(); /* see if this allows any reduction */
+ }
+
+
+ switch (tk) { /* go on and figure out what to do with the
+ * input */
+
+ case decl: /* scanned a declaration word */
+ ps.search_brace = btype_2;
+ /* indicate that following brace should be on same line */
+ if (ps.p_stack[ps.tos] != decl) { /* only put one declaration
+ * onto stack */
+ break_comma = true; /* while in declaration, newline should be
+ * forced after comma */
+ ps.p_stack[++ps.tos] = decl;
+ ps.il[ps.tos] = ps.i_l_follow;
+
+ if (ps.ljust_decl) {/* only do if we want left justified
+ * declarations */
+ ps.ind_level = 0;
+ for (i = ps.tos - 1; i > 0; --i)
+ if (ps.p_stack[i] == decl)
+ ++ps.ind_level; /* indentation is number of
+ * declaration levels deep we are */
+ ps.i_l_follow = ps.ind_level;
+ }
+ }
+ break;
+
+ case ifstmt: /* scanned if (...) */
+ if (ps.p_stack[ps.tos] == elsehead && ps.else_if) /* "else if ..." */
+ ps.i_l_follow = ps.il[ps.tos];
+ case dolit: /* 'do' */
+ case forstmt: /* for (...) */
+ ps.p_stack[++ps.tos] = tk;
+ ps.il[ps.tos] = ps.ind_level = ps.i_l_follow;
+ ++ps.i_l_follow; /* subsequent statements should be indented 1 */
+ ps.search_brace = btype_2;
+ break;
+
+ case lbrace: /* scanned { */
+ break_comma = false; /* don't break comma in an initial list */
+ if (ps.p_stack[ps.tos] == stmt || ps.p_stack[ps.tos] == decl
+ || ps.p_stack[ps.tos] == stmtl)
+ ++ps.i_l_follow; /* it is a random, isolated stmt group or a
+ * declaration */
+ else {
+ if (s_code == e_code) {
+ /*
+ * only do this if there is nothing on the line
+ */
+ --ps.ind_level;
+ /*
+ * it is a group as part of a while, for, etc.
+ */
+ if (ps.p_stack[ps.tos] == swstmt && ps.case_indent >= 1)
+ --ps.ind_level;
+ /*
+ * for a switch, brace should be two levels out from the code
+ */
+ }
+ }
+
+ ps.p_stack[++ps.tos] = lbrace;
+ ps.il[ps.tos] = ps.ind_level;
+ ps.p_stack[++ps.tos] = stmt;
+ /* allow null stmt between braces */
+ ps.il[ps.tos] = ps.i_l_follow;
+ break;
+
+ case whilestmt: /* scanned while (...) */
+ if (ps.p_stack[ps.tos] == dohead) {
+ /* it is matched with do stmt */
+ ps.ind_level = ps.i_l_follow = ps.il[ps.tos];
+ ps.p_stack[++ps.tos] = whilestmt;
+ ps.il[ps.tos] = ps.ind_level = ps.i_l_follow;
+ }
+ else { /* it is a while loop */
+ ps.p_stack[++ps.tos] = whilestmt;
+ ps.il[ps.tos] = ps.i_l_follow;
+ ++ps.i_l_follow;
+ ps.search_brace = btype_2;
+ }
+
+ break;
+
+ case elselit: /* scanned an else */
+
+ if (ps.p_stack[ps.tos] != ifhead)
+ diag2(1, "Unmatched 'else'");
+ else {
+ ps.ind_level = ps.il[ps.tos]; /* indentation for else should
+ * be same as for if */
+ ps.i_l_follow = ps.ind_level + 1; /* everything following should
+ * be in 1 level */
+ ps.p_stack[ps.tos] = elsehead;
+ /* remember if with else */
+ ps.search_brace = btype_2 | ps.else_if;
+ }
+ break;
+
+ case rbrace: /* scanned a } */
+ /* stack should have <lbrace> <stmt> or <lbrace> <stmtl> */
+ if (ps.p_stack[ps.tos - 1] == lbrace) {
+ ps.ind_level = ps.i_l_follow = ps.il[--ps.tos];
+ ps.p_stack[ps.tos] = stmt;
+ }
+ else
+ diag2(1, "Statement nesting error");
+ break;
+
+ case swstmt: /* had switch (...) */
+ ps.p_stack[++ps.tos] = swstmt;
+ ps.cstk[ps.tos] = case_ind;
+ /* save current case indent level */
+ ps.il[ps.tos] = ps.i_l_follow;
+ case_ind = ps.i_l_follow + ps.case_indent; /* cases should be one
+ * level down from
+ * switch */
+ ps.i_l_follow += ps.case_indent + 1; /* statements should be two
+ * levels in */
+ ps.search_brace = btype_2;
+ break;
+
+ case semicolon: /* this indicates a simple stmt */
+ break_comma = false; /* turn off flag to break after commas in a
+ * declaration */
+ ps.p_stack[++ps.tos] = stmt;
+ ps.il[ps.tos] = ps.ind_level;
+ break;
+
+ default: /* this is an error */
+ diag2(1, "Unknown code to parser");
+ return;
+
+
+ } /* end of switch */
+
+ reduce(); /* see if any reduction can be done */
+
+#ifdef debug
+ for (i = 1; i <= ps.tos; ++i)
+ printf("(%d %d)", ps.p_stack[i], ps.il[i]);
+ printf("\n");
+#endif
+
+ return;
+}
+
+/*
+ * NAME: reduce
+ *
+ * FUNCTION: Implements the reduce part of the parsing algorithm
+ *
+ * ALGORITHM: The following reductions are done. Reductions are repeated
+ * until no more are possible.
+ *
+ * Old TOS New TOS
+ * <stmt> <stmt> <stmtl>
+ * <stmtl> <stmt> <stmtl>
+ * do <stmt> "dostmt"
+ * if <stmt> "ifstmt"
+ * switch <stmt> <stmt>
+ * decl <stmt> <stmt>
+ * "ifelse" <stmt> <stmt>
+ * for <stmt> <stmt>
+ * while <stmt> <stmt>
+ * "dostmt" while <stmt>
+ *
+ * On each reduction, ps.i_l_follow (the indentation for the following line)
+ * is set to the indentation level associated with the old TOS.
+ *
+ * PARAMETERS: None
+ *
+ * RETURNS: Nothing
+ *
+ * GLOBALS: ps.cstk ps.i_l_follow = ps.il ps.p_stack = ps.tos =
+ *
+ * CALLS: None
+ *
+ * CALLED BY: parse
+ *
+ * HISTORY: initial coding November 1976 D A Willcox of CAC
+ *
+ */
+/*----------------------------------------------*\
+| REDUCTION PHASE |
+\*----------------------------------------------*/
+static void
+reduce(void)
+{
+ int i;
+
+ for (;;) { /* keep looping until there is nothing left to
+ * reduce */
+
+ switch (ps.p_stack[ps.tos]) {
+
+ case stmt:
+ switch (ps.p_stack[ps.tos - 1]) {
+
+ case stmt:
+ case stmtl:
+ /* stmtl stmt or stmt stmt */
+ ps.p_stack[--ps.tos] = stmtl;
+ break;
+
+ case dolit: /* <do> <stmt> */
+ ps.p_stack[--ps.tos] = dohead;
+ ps.i_l_follow = ps.il[ps.tos];
+ break;
+
+ case ifstmt:
+ /* <if> <stmt> */
+ ps.p_stack[--ps.tos] = ifhead;
+ for (i = ps.tos - 1;
+ (
+ ps.p_stack[i] != stmt
+ &&
+ ps.p_stack[i] != stmtl
+ &&
+ ps.p_stack[i] != lbrace
+ );
+ --i);
+ ps.i_l_follow = ps.il[i];
+ /*
+ * for the time being, we will assume that there is no else on
+ * this if, and set the indentation level accordingly. If an
+ * else is scanned, it will be fixed up later
+ */
+ break;
+
+ case swstmt:
+ /* <switch> <stmt> */
+ case_ind = ps.cstk[ps.tos - 1];
+
+ case decl: /* finish of a declaration */
+ case elsehead:
+ /* <<if> <stmt> else> <stmt> */
+ case forstmt:
+ /* <for> <stmt> */
+ case whilestmt:
+ /* <while> <stmt> */
+ ps.p_stack[--ps.tos] = stmt;
+ ps.i_l_follow = ps.il[ps.tos];
+ break;
+
+ default: /* <anything else> <stmt> */
+ return;
+
+ } /* end of section for <stmt> on top of stack */
+ break;
+
+ case whilestmt: /* while (...) on top */
+ if (ps.p_stack[ps.tos - 1] == dohead) {
+ /* it is termination of a do while */
+ ps.tos -= 2;
+ break;
+ }
+ else
+ return;
+
+ default: /* anything else on top */
+ return;
+
+ }
+ }
+}
diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c
new file mode 100644
index 0000000..9524bf4
--- /dev/null
+++ b/usr.bin/indent/pr_comment.c
@@ -0,0 +1,429 @@
+/*
+ * Copyright (c) 1985 Sun Microsystems, Inc.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)pr_comment.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "indent_globs.h"
+#include "indent.h"
+/*
+ * NAME:
+ * pr_comment
+ *
+ * FUNCTION:
+ * This routine takes care of scanning and printing comments.
+ *
+ * ALGORITHM:
+ * 1) Decide where the comment should be aligned, and if lines should
+ * be broken.
+ * 2) If lines should not be broken and filled, just copy up to end of
+ * comment.
+ * 3) If lines should be filled, then scan thru input_buffer copying
+ * characters to com_buf. Remember where the last blank, tab, or
+ * newline was. When line is filled, print up to last blank and
+ * continue copying.
+ *
+ * HISTORY:
+ * November 1976 D A Willcox of CAC Initial coding
+ * 12/6/76 D A Willcox of CAC Modification to handle
+ * UNIX-style comments
+ *
+ */
+
+/*
+ * this routine processes comments. It makes an attempt to keep comments from
+ * going over the max line length. If a line is too long, it moves everything
+ * from the last blank to the next comment line. Blanks and tabs from the
+ * beginning of the input line are removed
+ */
+
+void
+pr_comment(void)
+{
+ int now_col; /* column we are in now */
+ int adj_max_col; /* Adjusted max_col for when we decide to
+ * spill comments over the right margin */
+ char *last_bl; /* points to the last blank in the output
+ * buffer */
+ char *t_ptr; /* used for moving string */
+ int unix_comment; /* tri-state variable used to decide if it is
+ * a unix-style comment. 0 means only blanks
+ * since /+*, 1 means regular style comment, 2
+ * means unix style comment */
+ int break_delim = comment_delimiter_on_blankline;
+ int l_just_saw_decl = ps.just_saw_decl;
+ /*
+ * int ps.last_nl = 0; true iff the last significant thing
+ * weve seen is a newline
+ */
+ int one_liner = 1; /* true iff this comment is a one-liner */
+ adj_max_col = max_col;
+ ps.just_saw_decl = 0;
+ last_bl = 0; /* no blanks found so far */
+ ps.box_com = false; /* at first, assume that we are not in
+ * a boxed comment or some other
+ * comment that should not be touched */
+ ++ps.out_coms; /* keep track of number of comments */
+ unix_comment = 1; /* set flag to let us figure out if there is a
+ * unix-style comment ** DISABLED: use 0 to
+ * reenable this hack! */
+
+ /* Figure where to align and how to treat the comment */
+
+ if (ps.col_1 && !format_col1_comments) { /* if comment starts in column
+ * 1 it should not be touched */
+ ps.box_com = true;
+ ps.com_col = 1;
+ }
+ else {
+ if (*buf_ptr == '-' || *buf_ptr == '*' ||
+ (*buf_ptr == '\n' && !format_block_comments)) {
+ ps.box_com = true; /* A comment with a '-' or '*' immediately
+ * after the /+* is assumed to be a boxed
+ * comment. A comment with a newline
+ * immediately after the /+* is assumed to
+ * be a block comment and is treated as a
+ * box comment unless format_block_comments
+ * is nonzero (the default). */
+ break_delim = 0;
+ }
+ if ( /* ps.bl_line && */ (s_lab == e_lab) && (s_code == e_code)) {
+ /* klg: check only if this line is blank */
+ /*
+ * If this (*and previous lines are*) blank, dont put comment way
+ * out at left
+ */
+ ps.com_col = (ps.ind_level - ps.unindent_displace) * ps.ind_size + 1;
+ adj_max_col = block_comment_max_col;
+ if (ps.com_col <= 1)
+ ps.com_col = 1 + !format_col1_comments;
+ }
+ else {
+ int target_col;
+ break_delim = 0;
+ if (s_code != e_code)
+ target_col = count_spaces(compute_code_target(), s_code);
+ else {
+ target_col = 1;
+ if (s_lab != e_lab)
+ target_col = count_spaces(compute_label_target(), s_lab);
+ }
+ ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind;
+ if (ps.com_col < target_col)
+ ps.com_col = ((target_col + 7) & ~7) + 1;
+ if (ps.com_col + 24 > adj_max_col)
+ adj_max_col = ps.com_col + 24;
+ }
+ }
+ if (ps.box_com) {
+ buf_ptr[-2] = 0;
+ ps.n_comment_delta = 1 - count_spaces(1, in_buffer);
+ buf_ptr[-2] = '/';
+ }
+ else {
+ ps.n_comment_delta = 0;
+ while (*buf_ptr == ' ' || *buf_ptr == '\t')
+ buf_ptr++;
+ }
+ ps.comment_delta = 0;
+ *e_com++ = '/'; /* put '/' followed by '*' into buffer */
+ *e_com++ = '*';
+ if (*buf_ptr != ' ' && !ps.box_com)
+ *e_com++ = ' ';
+
+ *e_com = '\0';
+ if (troff) {
+ now_col = 1;
+ adj_max_col = 80;
+ }
+ else
+ now_col = count_spaces(ps.com_col, s_com); /* figure what column we
+ * would be in if we
+ * printed the comment
+ * now */
+
+ /* Start to copy the comment */
+
+ while (1) { /* this loop will go until the comment is
+ * copied */
+ if (*buf_ptr > 040 && *buf_ptr != '*')
+ ps.last_nl = 0;
+ CHECK_SIZE_COM;
+ switch (*buf_ptr) { /* this checks for various spcl cases */
+ case 014: /* check for a form feed */
+ if (!ps.box_com) { /* in a text comment, break the line here */
+ ps.use_ff = true;
+ /* fix so dump_line uses a form feed */
+ dump_line();
+ last_bl = 0;
+ *e_com++ = ' ';
+ *e_com++ = '*';
+ *e_com++ = ' ';
+ while (*++buf_ptr == ' ' || *buf_ptr == '\t');
+ }
+ else {
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ *e_com++ = 014;
+ }
+ break;
+
+ case '\n':
+ if (had_eof) { /* check for unexpected eof */
+ printf("Unterminated comment\n");
+ *e_com = '\0';
+ dump_line();
+ return;
+ }
+ one_liner = 0;
+ if (ps.box_com || ps.last_nl) { /* if this is a boxed comment,
+ * we dont ignore the newline */
+ if (s_com == e_com) {
+ *e_com++ = ' ';
+ *e_com++ = ' ';
+ }
+ *e_com = '\0';
+ if (!ps.box_com && e_com - s_com > 3) {
+ if (break_delim == 1 && s_com[0] == '/'
+ && s_com[1] == '*' && s_com[2] == ' ') {
+ char *t = e_com;
+ break_delim = 2;
+ e_com = s_com + 2;
+ *e_com = 0;
+ if (blanklines_before_blockcomments)
+ prefix_blankline_requested = 1;
+ dump_line();
+ e_com = t;
+ s_com[0] = s_com[1] = s_com[2] = ' ';
+ }
+ dump_line();
+ CHECK_SIZE_COM;
+ *e_com++ = ' ';
+ *e_com++ = ' ';
+ }
+ dump_line();
+ now_col = ps.com_col;
+ }
+ else {
+ ps.last_nl = 1;
+ if (unix_comment != 1) { /* we not are in unix_style
+ * comment */
+ if (unix_comment == 0 && s_code == e_code) {
+ /*
+ * if it is a UNIX-style comment, ignore the
+ * requirement that previous line be blank for
+ * unindention
+ */
+ ps.com_col = (ps.ind_level - ps.unindent_displace) * ps.ind_size + 1;
+ if (ps.com_col <= 1)
+ ps.com_col = 2;
+ }
+ unix_comment = 2; /* permanently remember that we are in
+ * this type of comment */
+ dump_line();
+ ++line_no;
+ now_col = ps.com_col;
+ *e_com++ = ' ';
+ /*
+ * fix so that the star at the start of the line will line
+ * up
+ */
+ do /* flush leading white space */
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ while (*buf_ptr == ' ' || *buf_ptr == '\t');
+ break;
+ }
+ if (*(e_com - 1) == ' ' || *(e_com - 1) == '\t')
+ last_bl = e_com - 1;
+ /*
+ * if there was a space at the end of the last line, remember
+ * where it was
+ */
+ else { /* otherwise, insert one */
+ last_bl = e_com;
+ CHECK_SIZE_COM;
+ *e_com++ = ' ';
+ ++now_col;
+ }
+ }
+ ++line_no; /* keep track of input line number */
+ if (!ps.box_com) {
+ int nstar = 1;
+ do { /* flush any blanks and/or tabs at start of
+ * next line */
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ if (*buf_ptr == '*' && --nstar >= 0) {
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+ if (*buf_ptr == '/')
+ goto end_of_comment;
+ }
+ } while (*buf_ptr == ' ' || *buf_ptr == '\t');
+ }
+ else if (++buf_ptr >= buf_end)
+ fill_buffer();
+ break; /* end of case for newline */
+
+ case '*': /* must check for possibility of being at end
+ * of comment */
+ if (++buf_ptr >= buf_end) /* get to next char after * */
+ fill_buffer();
+
+ if (unix_comment == 0) /* set flag to show we are not in
+ * unix-style comment */
+ unix_comment = 1;
+
+ if (*buf_ptr == '/') { /* it is the end!!! */
+ end_of_comment:
+ if (++buf_ptr >= buf_end)
+ fill_buffer();
+
+ if (*(e_com - 1) != ' ' && !ps.box_com) { /* insure blank before
+ * end */
+ *e_com++ = ' ';
+ ++now_col;
+ }
+ if (break_delim == 1 && !one_liner && s_com[0] == '/'
+ && s_com[1] == '*' && s_com[2] == ' ') {
+ char *t = e_com;
+ break_delim = 2;
+ e_com = s_com + 2;
+ *e_com = 0;
+ if (blanklines_before_blockcomments)
+ prefix_blankline_requested = 1;
+ dump_line();
+ e_com = t;
+ s_com[0] = s_com[1] = s_com[2] = ' ';
+ }
+ if (break_delim == 2 && e_com > s_com + 3
+ /* now_col > adj_max_col - 2 && !ps.box_com */ ) {
+ *e_com = '\0';
+ dump_line();
+ now_col = ps.com_col;
+ }
+ CHECK_SIZE_COM;
+ *e_com++ = '*';
+ *e_com++ = '/';
+ *e_com = '\0';
+ ps.just_saw_decl = l_just_saw_decl;
+ return;
+ }
+ else { /* handle isolated '*' */
+ *e_com++ = '*';
+ ++now_col;
+ }
+ break;
+ default: /* we have a random char */
+ if (unix_comment == 0 && *buf_ptr != ' ' && *buf_ptr != '\t')
+ unix_comment = 1; /* we are not in unix-style comment */
+
+ *e_com = *buf_ptr++;
+ if (buf_ptr >= buf_end)
+ fill_buffer();
+
+ if (*e_com == '\t') /* keep track of column */
+ now_col = ((now_col - 1) & tabmask) + tabsize + 1;
+ else if (*e_com == '\b') /* this is a backspace */
+ --now_col;
+ else
+ ++now_col;
+
+ if (*e_com == ' ' || *e_com == '\t')
+ last_bl = e_com;
+ /* remember we saw a blank */
+
+ ++e_com;
+ if (now_col > adj_max_col && !ps.box_com && unix_comment == 1 && e_com[-1] > ' ') {
+ /*
+ * the comment is too long, it must be broken up
+ */
+ if (break_delim == 1 && s_com[0] == '/'
+ && s_com[1] == '*' && s_com[2] == ' ') {
+ char *t = e_com;
+ break_delim = 2;
+ e_com = s_com + 2;
+ *e_com = 0;
+ if (blanklines_before_blockcomments)
+ prefix_blankline_requested = 1;
+ dump_line();
+ e_com = t;
+ s_com[0] = s_com[1] = s_com[2] = ' ';
+ }
+ if (last_bl == 0) { /* we have seen no blanks */
+ last_bl = e_com; /* fake it */
+ *e_com++ = ' ';
+ }
+ *e_com = '\0'; /* print what we have */
+ *last_bl = '\0';
+ while (last_bl > s_com && last_bl[-1] < 040)
+ *--last_bl = 0;
+ e_com = last_bl;
+ dump_line();
+
+ *e_com++ = ' '; /* add blanks for continuation */
+ *e_com++ = ' ';
+ *e_com++ = ' ';
+
+ t_ptr = last_bl + 1;
+ last_bl = 0;
+ if (t_ptr >= e_com) {
+ while (*t_ptr == ' ' || *t_ptr == '\t')
+ t_ptr++;
+ while (*t_ptr != '\0') { /* move unprinted part of
+ * comment down in buffer */
+ if (*t_ptr == ' ' || *t_ptr == '\t')
+ last_bl = e_com;
+ *e_com++ = *t_ptr++;
+ }
+ }
+ *e_com = '\0';
+ now_col = count_spaces(ps.com_col, s_com); /* recompute current
+ * position */
+ }
+ break;
+ }
+ }
+}
diff --git a/usr.bin/ipcrm/Makefile b/usr.bin/ipcrm/Makefile
new file mode 100644
index 0000000..990b9f9
--- /dev/null
+++ b/usr.bin/ipcrm/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PROG= ipcrm
+SRCS= ipcrm.c ipc.c
+LIBADD= kvm
+CFLAGS+=-I${.CURDIR}/../ipcs
+.PATH: ${.CURDIR}/../ipcs
+
+WARNS?= 0
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ipcrm/Makefile.depend b/usr.bin/ipcrm/Makefile.depend
new file mode 100644
index 0000000..34582cd
--- /dev/null
+++ b/usr.bin/ipcrm/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ipcrm/ipcrm.1 b/usr.bin/ipcrm/ipcrm.1
new file mode 100644
index 0000000..f70eab6
--- /dev/null
+++ b/usr.bin/ipcrm/ipcrm.1
@@ -0,0 +1,119 @@
+.\" Copyright (c) 1994 Adam Glass
+.\" 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. 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 Adam Glass ``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 Adam Glass 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 December 12, 2007
+.Dt IPCRM 1
+.Os
+.Sh NAME
+.Nm ipcrm
+.Nd "remove the specified message queues, semaphore sets, and shared segments"
+.Sh SYNOPSIS
+.Nm
+.Op Fl W
+.Op Fl v
+.Op Fl q Ar msqid
+.Op Fl m Ar shmid
+.Op Fl s Ar semid
+.Op Fl Q Ar msgkey
+.Op Fl M Ar shmkey
+.Op Fl S Ar semkey
+.Ar ...
+.Sh DESCRIPTION
+The
+.Nm
+utility removes the specified message queues, semaphores and shared memory
+segments.
+These System V IPC objects can be specified by their
+creation ID or any associated key.
+.Pp
+The following options are generic:
+.Bl -tag -width indent
+.It Fl v
+If specified once with -W or with -1 for an object, it will show
+all removed objects.
+If specified twice with -W or with -1 for an objects, it will show
+all removed objects and all failed removals.
+.It Fl W
+Try to wipe all specified message queues, semaphores and shared
+memory segments.
+.It Fl y
+Use the
+.Xr kvm 3
+interface instead of the
+.Xr sysctl 3
+interface to extract the required information.
+If
+.Nm
+is to operate on the running system,
+using
+.Xr kvm 3
+will require read privileges to
+.Pa /dev/kmem .
+.El
+.Pp
+The following options are used to specify which IPC objects will be removed.
+Any number and combination of these options can be used:
+.Bl -tag -width indent
+.It Fl q Ar msqid
+Remove the message queue associated with the ID
+.Ar msqid
+from the system.
+.It Fl m Ar shmid
+Mark the shared memory segment associated with ID
+.Ar shmid
+for removal.
+This marked segment will be destroyed after the last detach.
+.It Fl s Ar semid
+Remove the semaphore set associated with ID
+.Ar semid
+from the system.
+.It Fl Q Ar msgkey
+Remove the message queue associated with key
+.Ar msgkey
+from the system.
+.It Fl M Ar shmkey
+Mark the shared memory segment associated with key
+.Ar shmkey
+for removal.
+This marked segment will be destroyed after the last detach.
+.It Fl S Ar semkey
+Remove the semaphore set associated with key
+.Ar semkey
+from the system.
+.El
+.Pp
+The identifiers and keys associated with these System V IPC objects can be
+determined by using
+.Xr ipcs 1 .
+If the identifier or the key is -1, it will remove all these objects.
+.Sh SEE ALSO
+.Xr ipcs 1
+.Sh HISTORY
+The wiping of all System V IPC objects was first implemented in
+.Fx 6.4 No and 7.1.
+.Sh AUTHORS
+The original author was Adam Glass.
+The wiping of all System V IPC objects was thought up by Callum
+Gibson and extended and implemented by Edwin Groothuis.
diff --git a/usr.bin/ipcrm/ipcrm.c b/usr.bin/ipcrm/ipcrm.c
new file mode 100644
index 0000000..98c4555
--- /dev/null
+++ b/usr.bin/ipcrm/ipcrm.c
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 1994 Adam Glass
+ * 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 Adam Glass.
+ * 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 Adam Glass ``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 Adam Glass 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>
+#define _WANT_MSG_PROTOTYPES
+#define _WANT_SEM_PROTOTYPES
+#define _WANT_SHM_PROTOTYPES
+#define _KERNEL
+#include <sys/sem.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#undef _KERNEL
+
+#include <ctype.h>
+#include <err.h>
+#include <grp.h>
+#include <kvm.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ipc.h"
+
+static int signaled;
+static int errflg;
+static int rmverbose = 0;
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: ipcrm [-W] [-v[v]]\n"
+ " [-q msqid] [-m shmid] [-s semid]\n"
+ " [-Q msgkey] [-M shmkey] [-S semkey] ...\n");
+ exit(1);
+}
+
+static int
+msgrm(key_t key, int id)
+{
+
+ if (key == -1 || id == -1) {
+ struct msqid_kernel *kxmsqids;
+ size_t kxmsqids_len;
+ int num;
+
+ kget(X_MSGINFO, &msginfo, sizeof(msginfo));
+ kxmsqids_len = sizeof(struct msqid_kernel) * msginfo.msgmni;
+ kxmsqids = malloc(kxmsqids_len);
+ kget(X_MSQIDS, kxmsqids, kxmsqids_len);
+ num = msginfo.msgmni;
+ while (num-- && !signaled)
+ if (kxmsqids[num].u.msg_qbytes != 0) {
+ id = IXSEQ_TO_IPCID(num,
+ kxmsqids[num].u.msg_perm);
+ if (msgctl(id, IPC_RMID, NULL) < 0) {
+ if (rmverbose > 1)
+ warn("msqid(%d): ", id);
+ errflg++;
+ } else
+ if (rmverbose)
+ printf(
+ "Removed %s %d\n",
+ IPC_TO_STRING('Q'),
+ id);
+ }
+ return signaled ? -1 : 0; /* errors maybe handled above */
+ }
+
+ if (key) {
+ id = msgget(key, 0);
+ if (id == -1)
+ return -1;
+ }
+
+ return msgctl(id, IPC_RMID, NULL);
+}
+
+static int
+shmrm(key_t key, int id)
+{
+
+ if (key == -1 || id == -1) {
+ struct shmid_kernel *kxshmids;
+ size_t kxshmids_len;
+ int num;
+
+ kget(X_SHMINFO, &shminfo, sizeof(shminfo));
+ kxshmids_len = sizeof(struct shmid_kernel) * shminfo.shmmni;
+ kxshmids = malloc(kxshmids_len);
+ kget(X_SHMSEGS, kxshmids, kxshmids_len);
+ num = shminfo.shmmni;
+ while (num-- && !signaled)
+ if (kxshmids[num].u.shm_perm.mode & 0x0800) {
+ id = IXSEQ_TO_IPCID(num,
+ kxshmids[num].u.shm_perm);
+ if (shmctl(id, IPC_RMID, NULL) < 0) {
+ if (rmverbose > 1)
+ warn("shmid(%d): ", id);
+ errflg++;
+ } else
+ if (rmverbose)
+ printf(
+ "Removed %s %d\n",
+ IPC_TO_STRING('M'),
+ id);
+ }
+ return signaled ? -1 : 0; /* errors maybe handled above */
+ }
+
+ if (key) {
+ id = shmget(key, 0, 0);
+ if (id == -1)
+ return -1;
+ }
+
+ return shmctl(id, IPC_RMID, NULL);
+}
+
+static int
+semrm(key_t key, int id)
+{
+ union semun arg;
+
+ if (key == -1 || id == -1) {
+ struct semid_kernel *kxsema;
+ size_t kxsema_len;
+ int num;
+
+ kget(X_SEMINFO, &seminfo, sizeof(seminfo));
+ kxsema_len = sizeof(struct semid_kernel) * seminfo.semmni;
+ kxsema = malloc(kxsema_len);
+ kget(X_SEMA, kxsema, kxsema_len);
+ num = seminfo.semmni;
+ while (num-- && !signaled)
+ if ((kxsema[num].u.sem_perm.mode & SEM_ALLOC) != 0) {
+ id = IXSEQ_TO_IPCID(num,
+ kxsema[num].u.sem_perm);
+ if (semctl(id, 0, IPC_RMID, NULL) < 0) {
+ if (rmverbose > 1)
+ warn("semid(%d): ", id);
+ errflg++;
+ } else
+ if (rmverbose)
+ printf(
+ "Removed %s %d\n",
+ IPC_TO_STRING('S'),
+ id);
+ }
+ return signaled ? -1 : 0; /* errors maybe handled above */
+ }
+
+ if (key) {
+ id = semget(key, 0, 0);
+ if (id == -1)
+ return -1;
+ }
+
+ return semctl(id, 0, IPC_RMID, arg);
+}
+
+static void
+not_configured(int signo __unused)
+{
+
+ signaled++;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int c, result, target_id;
+ key_t target_key;
+
+ while ((c = getopt(argc, argv, "q:m:s:Q:M:S:vWy")) != -1) {
+
+ signaled = 0;
+ switch (c) {
+ case 'v':
+ rmverbose++;
+ break;
+ case 'y':
+ use_sysctl = 0;
+ break;
+ }
+ }
+
+ optind = 1;
+ errflg = 0;
+ signal(SIGSYS, not_configured);
+ while ((c = getopt(argc, argv, "q:m:s:Q:M:S:vWy")) != -1) {
+
+ signaled = 0;
+ switch (c) {
+ case 'q':
+ case 'm':
+ case 's':
+ target_id = atoi(optarg);
+ if (c == 'q')
+ result = msgrm(0, target_id);
+ else if (c == 'm')
+ result = shmrm(0, target_id);
+ else
+ result = semrm(0, target_id);
+ if (result < 0) {
+ errflg++;
+ if (!signaled)
+ warn("%sid(%d): ",
+ IPC_TO_STR(toupper(c)), target_id);
+ else
+ warnx(
+ "%ss are not configured "
+ "in the running kernel",
+ IPC_TO_STRING(toupper(c)));
+ }
+ break;
+ case 'Q':
+ case 'M':
+ case 'S':
+ target_key = atol(optarg);
+ if (target_key == IPC_PRIVATE) {
+ warnx("can't remove private %ss",
+ IPC_TO_STRING(c));
+ continue;
+ }
+ if (c == 'Q')
+ result = msgrm(target_key, 0);
+ else if (c == 'M')
+ result = shmrm(target_key, 0);
+ else
+ result = semrm(target_key, 0);
+ if (result < 0) {
+ errflg++;
+ if (!signaled)
+ warn("%ss(%ld): ",
+ IPC_TO_STR(c), target_key);
+ else
+ warnx("%ss are not configured "
+ "in the running kernel",
+ IPC_TO_STRING(c));
+ }
+ break;
+ case 'v':
+ case 'y':
+ /* Handled in other getopt() loop */
+ break;
+ case 'W':
+ msgrm(-1, 0);
+ shmrm(-1, 0);
+ semrm(-1, 0);
+ break;
+ case ':':
+ fprintf(stderr,
+ "option -%c requires an argument\n", optopt);
+ usage();
+ case '?':
+ fprintf(stderr, "unrecognized option: -%c\n", optopt);
+ usage();
+ }
+ }
+
+ if (optind != argc) {
+ fprintf(stderr, "unknown argument: %s\n", argv[optind]);
+ usage();
+ }
+ exit(errflg);
+}
diff --git a/usr.bin/ipcs/Makefile b/usr.bin/ipcs/Makefile
new file mode 100644
index 0000000..d14723f
--- /dev/null
+++ b/usr.bin/ipcs/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= ipcs
+SRCS= ipcs.c ipc.c
+LIBADD= kvm
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ipcs/Makefile.depend b/usr.bin/ipcs/Makefile.depend
new file mode 100644
index 0000000..34582cd
--- /dev/null
+++ b/usr.bin/ipcs/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ipcs/ipc.c b/usr.bin/ipcs/ipc.c
new file mode 100644
index 0000000..306d659
--- /dev/null
+++ b/usr.bin/ipcs/ipc.c
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
+ * 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. 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 ``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.
+ *
+ * The split of ipcs.c into ipcs.c and ipc.c to accommodate the
+ * changes in ipcrm.c was done by Edwin Groothuis <edwin@FreeBSD.org>
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#define _KERNEL
+#include <sys/sem.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#undef _KERNEL
+
+#include <assert.h>
+#include <err.h>
+#include <kvm.h>
+#include <nlist.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#include "ipc.h"
+
+int use_sysctl = 1;
+struct semid_kernel *sema;
+struct seminfo seminfo;
+struct msginfo msginfo;
+struct msqid_kernel *msqids;
+struct shminfo shminfo;
+struct shmid_kernel *shmsegs;
+
+struct nlist symbols[] = {
+ { .n_name = "sema" },
+ { .n_name = "seminfo" },
+ { .n_name = "msginfo" },
+ { .n_name = "msqids" },
+ { .n_name = "shminfo" },
+ { .n_name = "shmsegs" },
+ { .n_name = NULL }
+};
+
+#define SHMINFO_XVEC X(shmmax, sizeof(u_long)) \
+ X(shmmin, sizeof(u_long)) \
+ X(shmmni, sizeof(u_long)) \
+ X(shmseg, sizeof(u_long)) \
+ X(shmall, sizeof(u_long))
+
+#define SEMINFO_XVEC X(semmni, sizeof(int)) \
+ X(semmns, sizeof(int)) \
+ X(semmnu, sizeof(int)) \
+ X(semmsl, sizeof(int)) \
+ X(semopm, sizeof(int)) \
+ X(semume, sizeof(int)) \
+ X(semusz, sizeof(int)) \
+ X(semvmx, sizeof(int)) \
+ X(semaem, sizeof(int))
+
+#define MSGINFO_XVEC X(msgmax, sizeof(int)) \
+ X(msgmni, sizeof(int)) \
+ X(msgmnb, sizeof(int)) \
+ X(msgtql, sizeof(int)) \
+ X(msgssz, sizeof(int)) \
+ X(msgseg, sizeof(int))
+
+#define X(a, b) { "kern.ipc." #a, offsetof(TYPEC, a), (b) },
+#define TYPEC struct shminfo
+static struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { .sysctl=NULL } };
+#undef TYPEC
+#define TYPEC struct seminfo
+static struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { .sysctl=NULL } };
+#undef TYPEC
+#define TYPEC struct msginfo
+static struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { .sysctl=NULL } };
+#undef TYPEC
+#undef X
+
+kvm_t *kd;
+
+void
+sysctlgatherstruct(void *addr, size_t size, struct scgs_vector *vecarr)
+{
+ struct scgs_vector *xp;
+ size_t tsiz;
+ int rv;
+
+ for (xp = vecarr; xp->sysctl != NULL; xp++) {
+ assert(xp->offset <= size);
+ tsiz = xp->size;
+ rv = sysctlbyname(xp->sysctl, (char *)addr + xp->offset,
+ &tsiz, NULL, 0);
+ if (rv == -1)
+ err(1, "sysctlbyname: %s", xp->sysctl);
+ if (tsiz != xp->size)
+ errx(1, "%s size mismatch (expected %zu, got %zu)",
+ xp->sysctl, xp->size, tsiz);
+ }
+}
+
+void
+kget(int idx, void *addr, size_t size)
+{
+ const char *symn; /* symbol name */
+ size_t tsiz;
+ int rv;
+ unsigned long kaddr;
+ const char *sym2sysctl[] = { /* symbol to sysctl name table */
+ "kern.ipc.sema",
+ "kern.ipc.seminfo",
+ "kern.ipc.msginfo",
+ "kern.ipc.msqids",
+ "kern.ipc.shminfo",
+ "kern.ipc.shmsegs" };
+
+ assert((unsigned)idx <= sizeof(sym2sysctl) / sizeof(*sym2sysctl));
+ if (!use_sysctl) {
+ symn = symbols[idx].n_name;
+ if (*symn == '_')
+ symn++;
+ if (symbols[idx].n_type == 0 || symbols[idx].n_value == 0)
+ errx(1, "symbol %s undefined", symn);
+ /*
+ * For some symbols, the value we retrieve is
+ * actually a pointer; since we want the actual value,
+ * we have to manually dereference it.
+ */
+ switch (idx) {
+ case X_MSQIDS:
+ tsiz = sizeof(msqids);
+ rv = kvm_read(kd, symbols[idx].n_value,
+ &msqids, tsiz);
+ kaddr = (u_long)msqids;
+ break;
+ case X_SHMSEGS:
+ tsiz = sizeof(shmsegs);
+ rv = kvm_read(kd, symbols[idx].n_value,
+ &shmsegs, tsiz);
+ kaddr = (u_long)shmsegs;
+ break;
+ case X_SEMA:
+ tsiz = sizeof(sema);
+ rv = kvm_read(kd, symbols[idx].n_value,
+ &sema, tsiz);
+ kaddr = (u_long)sema;
+ break;
+ default:
+ rv = tsiz = 0;
+ kaddr = symbols[idx].n_value;
+ break;
+ }
+ if ((unsigned)rv != tsiz)
+ errx(1, "%s: %s", symn, kvm_geterr(kd));
+ if ((unsigned)kvm_read(kd, kaddr, addr, size) != size)
+ errx(1, "%s: %s", symn, kvm_geterr(kd));
+ } else {
+ switch (idx) {
+ case X_SHMINFO:
+ sysctlgatherstruct(addr, size, shminfo_scgsv);
+ break;
+ case X_SEMINFO:
+ sysctlgatherstruct(addr, size, seminfo_scgsv);
+ break;
+ case X_MSGINFO:
+ sysctlgatherstruct(addr, size, msginfo_scgsv);
+ break;
+ default:
+ tsiz = size;
+ rv = sysctlbyname(sym2sysctl[idx], addr, &tsiz,
+ NULL, 0);
+ if (rv == -1)
+ err(1, "sysctlbyname: %s", sym2sysctl[idx]);
+ if (tsiz != size)
+ errx(1, "%s size mismatch "
+ "(expected %zu, got %zu)",
+ sym2sysctl[idx], size, tsiz);
+ break;
+ }
+ }
+}
diff --git a/usr.bin/ipcs/ipc.h b/usr.bin/ipcs/ipc.h
new file mode 100644
index 0000000..0b6188a
--- /dev/null
+++ b/usr.bin/ipcs/ipc.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
+ * 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. 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 ``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.
+ *
+ * The split of ipcs.c into ipcs.c and ipc.c to accommodate the
+ * changes in ipcrm.c was done by Edwin Groothuis <edwin@FreeBSD.org>
+ *
+ * $FreeBSD$
+ */
+
+/* Part of struct nlist symbols[] */
+#define X_SEMA 0
+#define X_SEMINFO 1
+#define X_MSGINFO 2
+#define X_MSQIDS 3
+#define X_SHMINFO 4
+#define X_SHMSEGS 5
+
+#define SHMINFO 1
+#define SHMTOTAL 2
+#define MSGINFO 4
+#define MSGTOTAL 8
+#define SEMINFO 16
+#define SEMTOTAL 32
+
+#define IPC_TO_STR(x) (x == 'Q' ? "msq" : (x == 'M' ? "shm" : "sem"))
+#define IPC_TO_STRING(x) (x == 'Q' ? "message queue" : \
+ (x == 'M' ? "shared memory segment" : "semaphore"))
+
+/* SysCtlGatherStruct structure. */
+struct scgs_vector {
+ const char *sysctl;
+ size_t offset;
+ size_t size;
+};
+
+void kget(int idx, void *addr, size_t size);
+void sysctlgatherstruct(void *addr, size_t size, struct scgs_vector *vec);
+
+extern int use_sysctl;
+extern struct nlist symbols[];
+extern kvm_t *kd;
+
+extern struct semid_kernel *sema;
+extern struct msqid_kernel *msqids;
+extern struct shmid_kernel *shmsegs;
diff --git a/usr.bin/ipcs/ipcs.1 b/usr.bin/ipcs/ipcs.1
new file mode 100644
index 0000000..22cf3db
--- /dev/null
+++ b/usr.bin/ipcs/ipcs.1
@@ -0,0 +1,176 @@
+.\"
+.\" Copyright (c) 1994 SigmaSoft, Th. Lockert
+.\" 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 SigmaSoft, Th. Lockert.
+.\" 3. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 24, 2004
+.Dt "IPCS" 1
+.Os
+.Sh NAME
+.Nm ipcs
+.Nd report System V interprocess communication facilities status
+.Sh SYNOPSIS
+.Nm
+.Op Fl abcmopqstMQSTy
+.Op Fl C Ar core
+.Op Fl N Ar system
+.Op Fl u Ar user
+.Sh DESCRIPTION
+The
+.Nm
+utility provides information on System V interprocess communication
+(IPC) facilities on the system.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Show the maximum amount of information possible when
+displaying active semaphores, message queues,
+and shared memory segments.
+(This is shorthand for specifying the
+.Fl b ,
+.Fl c ,
+.Fl o ,
+.Fl p ,
+and
+.Fl t
+options.)
+.It Fl b
+Show the maximum allowed sizes for active semaphores, message queues,
+and shared memory segments.
+The
+.Dq maximum allowed size
+is the maximum number of bytes in a message on a message queue,
+the size of a shared memory segment,
+or the number of semaphores in a set of semaphores.
+.It Fl c
+Show the creator's name and group for active semaphores, message queues,
+and shared memory segments.
+.It Fl m
+Display information about active shared memory segments.
+.It Fl o
+Show outstanding usage for active message queues,
+and shared memory segments.
+The
+.Dq outstanding usage
+is the number of messages in a message queue, or the number
+of processes attached to a shared memory segment.
+.It Fl p
+Show the process ID information for active semaphores, message queues,
+and shared memory segments.
+The
+.Dq process ID information
+is the last process to send a message to or receive a message from
+a message queue,
+the process that created a semaphore, or the last process to attach
+or detach a shared memory segment.
+.It Fl q
+Display information about active message queues.
+.It Fl s
+Display information about active semaphores.
+.It Fl t
+Show access times for active semaphores, message queues,
+and shared memory segments.
+The access times is the time
+of the last control operation on an IPC object,
+the last send or receive of a message,
+the last attach or detach of a shared memory segment,
+or the last operation on a semaphore.
+.It Fl C Ar core
+Extract values associated with the name list from the specified
+core instead of the default
+.Pa /dev/kmem .
+Implies
+.Fl y .
+.It Fl M
+Display system information about shared memory.
+.It Fl N Ar system
+Extract the name list from the specified system instead of the
+default
+.Pa /boot/kernel/kernel .
+Implies
+.Fl y .
+.It Fl Q
+Display system information about messages queues.
+.It Fl S
+Display system information about semaphores.
+.It Fl T
+Display system information about shared memory, message queues
+and semaphores.
+.It Fl y
+Use the
+.Xr kvm 3
+interface instead of the
+.Xr sysctl 3
+interface to extract the required information.
+If
+.Nm
+is to operate on the running system,
+using
+.Xr kvm 3
+will require read privileges to
+.Pa /dev/kmem .
+.It Fl u Ar user
+Display information about IPC mechanisms owned by
+.Pa user .
+User specification can be in the form of a numeric UID or
+a login name.
+.El
+.Pp
+If none of the
+.Fl M ,
+.Fl m ,
+.Fl Q ,
+.Fl q ,
+.Fl S ,
+or
+.Fl s
+options are specified, information about all active IPC facilities is
+listed.
+.Sh RESTRICTIONS
+System data structures may change while
+.Nm
+is running; the output of
+.Nm
+is not guaranteed to be consistent.
+.Sh FILES
+.Bl -tag -width /boot/kernel/kernel -compact
+.It Pa /dev/kmem
+default kernel memory
+.It Pa /boot/kernel/kernel
+default system name list
+.El
+.Sh SEE ALSO
+.Xr ipcrm 1
+.Sh AUTHORS
+.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
+.Nm .
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c
new file mode 100644
index 0000000..be6ca56
--- /dev/null
+++ b/usr.bin/ipcs/ipcs.c
@@ -0,0 +1,570 @@
+/*
+ * Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
+ * 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. 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#define _KERNEL
+#include <sys/sem.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#undef _KERNEL
+
+#include <err.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <kvm.h>
+#include <limits.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ipc.h"
+
+char *fmt_perm(u_short);
+void cvt_time(time_t, char *);
+void usage(void);
+uid_t user2uid(char *username);
+
+void print_kmsqtotal(struct msginfo msginfo);
+void print_kmsqheader(int option);
+void print_kmsqptr(int i, int option, struct msqid_kernel *kmsqptr);
+void print_kshmtotal(struct shminfo shminfo);
+void print_kshmheader(int option);
+void print_kshmptr(int i, int option, struct shmid_kernel *kshmptr);
+void print_ksemtotal(struct seminfo seminfo);
+void print_ksemheader(int option);
+void print_ksemptr(int i, int option, struct semid_kernel *ksemaptr);
+
+char *
+fmt_perm(u_short mode)
+{
+ static char buffer[100];
+
+ buffer[0] = '-';
+ buffer[1] = '-';
+ buffer[2] = ((mode & 0400) ? 'r' : '-');
+ buffer[3] = ((mode & 0200) ? 'w' : '-');
+ buffer[4] = ((mode & 0100) ? 'a' : '-');
+ buffer[5] = ((mode & 0040) ? 'r' : '-');
+ buffer[6] = ((mode & 0020) ? 'w' : '-');
+ buffer[7] = ((mode & 0010) ? 'a' : '-');
+ buffer[8] = ((mode & 0004) ? 'r' : '-');
+ buffer[9] = ((mode & 0002) ? 'w' : '-');
+ buffer[10] = ((mode & 0001) ? 'a' : '-');
+ buffer[11] = '\0';
+ return (&buffer[0]);
+}
+
+void
+cvt_time(time_t t, char *buf)
+{
+ struct tm *tm;
+
+ if (t == 0) {
+ strcpy(buf, "no-entry");
+ } else {
+ tm = localtime(&t);
+ sprintf(buf, "%2d:%02d:%02d",
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ }
+}
+
+#define BIGGEST 1
+#define CREATOR 2
+#define OUTSTANDING 4
+#define PID 8
+#define TIME 16
+
+int
+main(int argc, char *argv[])
+{
+ int display = SHMINFO | MSGINFO | SEMINFO;
+ int option = 0;
+ char *core = NULL, *user = NULL, *namelist = NULL;
+ char kvmoferr[_POSIX2_LINE_MAX]; /* Error buf for kvm_openfiles. */
+ int i;
+ u_long shmidx;
+ uid_t uid = 0;
+
+ while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTu:y")) != -1)
+ switch (i) {
+ case 'a':
+ option |= BIGGEST | CREATOR | OUTSTANDING | PID | TIME;
+ break;
+ case 'b':
+ option |= BIGGEST;
+ break;
+ case 'C':
+ core = optarg;
+ break;
+ case 'c':
+ option |= CREATOR;
+ break;
+ case 'M':
+ display = SHMTOTAL;
+ break;
+ case 'm':
+ display = SHMINFO;
+ break;
+ case 'N':
+ namelist = optarg;
+ break;
+ case 'o':
+ option |= OUTSTANDING;
+ break;
+ case 'p':
+ option |= PID;
+ break;
+ case 'Q':
+ display = MSGTOTAL;
+ break;
+ case 'q':
+ display = MSGINFO;
+ break;
+ case 'S':
+ display = SEMTOTAL;
+ break;
+ case 's':
+ display = SEMINFO;
+ break;
+ case 'T':
+ display = SHMTOTAL | MSGTOTAL | SEMTOTAL;
+ break;
+ case 't':
+ option |= TIME;
+ break;
+ case 'u':
+ user = optarg;
+ uid = user2uid(user);
+ break;
+ case 'y':
+ use_sysctl = 0;
+ break;
+ default:
+ usage();
+ }
+
+ /*
+ * If paths to the exec file or core file were specified, we
+ * aren't operating on the running kernel, so we can't use
+ * sysctl.
+ */
+ if (namelist != NULL || core != NULL)
+ use_sysctl = 0;
+
+ if (!use_sysctl) {
+ kd = kvm_openfiles(namelist, core, NULL, O_RDONLY, kvmoferr);
+ if (kd == NULL)
+ errx(1, "kvm_openfiles: %s", kvmoferr);
+ switch (kvm_nlist(kd, symbols)) {
+ case 0:
+ break;
+ case -1:
+ errx(1, "unable to read kernel symbol table");
+ default:
+ break;
+ }
+ }
+
+ kget(X_MSGINFO, &msginfo, sizeof(msginfo));
+ if ((display & (MSGINFO | MSGTOTAL))) {
+ if (display & MSGTOTAL)
+ print_kmsqtotal(msginfo);
+
+ if (display & MSGINFO) {
+ struct msqid_kernel *kxmsqids;
+ size_t kxmsqids_len;
+
+ kxmsqids_len =
+ sizeof(struct msqid_kernel) * msginfo.msgmni;
+ kxmsqids = malloc(kxmsqids_len);
+ kget(X_MSQIDS, kxmsqids, kxmsqids_len);
+
+ print_kmsqheader(option);
+
+ for (i = 0; i < msginfo.msgmni; i += 1) {
+ if (kxmsqids[i].u.msg_qbytes != 0) {
+ if (user &&
+ uid != kxmsqids[i].u.msg_perm.uid)
+ continue;
+
+ print_kmsqptr(i, option, &kxmsqids[i]);
+ }
+
+ }
+
+ printf("\n");
+ }
+ } else
+ if (display & (MSGINFO | MSGTOTAL)) {
+ fprintf(stderr,
+ "SVID messages facility "
+ "not configured in the system\n");
+ }
+
+ kget(X_SHMINFO, &shminfo, sizeof(shminfo));
+ if ((display & (SHMINFO | SHMTOTAL))) {
+
+ if (display & SHMTOTAL)
+ print_kshmtotal(shminfo);
+
+ if (display & SHMINFO) {
+ struct shmid_kernel *kxshmids;
+ size_t kxshmids_len;
+
+ kxshmids_len =
+ sizeof(struct shmid_kernel) * shminfo.shmmni;
+ kxshmids = malloc(kxshmids_len);
+ kget(X_SHMSEGS, kxshmids, kxshmids_len);
+
+ print_kshmheader(option);
+
+ for (shmidx = 0; shmidx < shminfo.shmmni; shmidx += 1) {
+ if (kxshmids[shmidx].u.shm_perm.mode & 0x0800) {
+ if (user &&
+ uid != kxshmids[shmidx].u.shm_perm.uid)
+ continue;
+
+ print_kshmptr(shmidx, option, &kxshmids[shmidx]);
+ }
+ }
+ printf("\n");
+ }
+ } else
+ if (display & (SHMINFO | SHMTOTAL)) {
+ fprintf(stderr,
+ "SVID shared memory facility "
+ "not configured in the system\n");
+ }
+
+ kget(X_SEMINFO, &seminfo, sizeof(seminfo));
+ if ((display & (SEMINFO | SEMTOTAL))) {
+ struct semid_kernel *kxsema;
+ size_t kxsema_len;
+
+ if (display & SEMTOTAL)
+ print_ksemtotal(seminfo);
+
+ if (display & SEMINFO) {
+ kxsema_len =
+ sizeof(struct semid_kernel) * seminfo.semmni;
+ kxsema = malloc(kxsema_len);
+ kget(X_SEMA, kxsema, kxsema_len);
+
+ print_ksemheader(option);
+
+ for (i = 0; i < seminfo.semmni; i += 1) {
+ if ((kxsema[i].u.sem_perm.mode & SEM_ALLOC)
+ != 0) {
+ if (user &&
+ uid != kxsema[i].u.sem_perm.uid)
+ continue;
+
+ print_ksemptr(i, option, &kxsema[i]);
+
+ }
+ }
+
+ printf("\n");
+ }
+ } else
+ if (display & (SEMINFO | SEMTOTAL)) {
+ fprintf(stderr,
+ "SVID semaphores facility "
+ "not configured in the system\n");
+ }
+
+ if (!use_sysctl)
+ kvm_close(kd);
+
+ exit(0);
+}
+
+void
+print_kmsqtotal(struct msginfo local_msginfo)
+{
+
+ printf("msginfo:\n");
+ printf("\tmsgmax: %12d\t(max characters in a message)\n",
+ local_msginfo.msgmax);
+ printf("\tmsgmni: %12d\t(# of message queues)\n",
+ local_msginfo.msgmni);
+ printf("\tmsgmnb: %12d\t(max characters in a message queue)\n",
+ local_msginfo.msgmnb);
+ printf("\tmsgtql: %12d\t(max # of messages in system)\n",
+ local_msginfo.msgtql);
+ printf("\tmsgssz: %12d\t(size of a message segment)\n",
+ local_msginfo.msgssz);
+ printf("\tmsgseg: %12d\t(# of message segments in system)\n\n",
+ local_msginfo.msgseg);
+}
+
+void print_kmsqheader(int option)
+{
+
+ printf("Message Queues:\n");
+ printf("T %12s %12s %-11s %-8s %-8s",
+ "ID", "KEY", "MODE", "OWNER", "GROUP");
+ if (option & CREATOR)
+ printf(" %-8s %-8s", "CREATOR", "CGROUP");
+ if (option & OUTSTANDING)
+ printf(" %20s %20s", "CBYTES", "QNUM");
+ if (option & BIGGEST)
+ printf(" %20s", "QBYTES");
+ if (option & PID)
+ printf(" %12s %12s", "LSPID", "LRPID");
+ if (option & TIME)
+ printf(" %-8s %-8s %-8s", "STIME", "RTIME", "CTIME");
+ printf("\n");
+}
+
+void
+print_kmsqptr(int i, int option, struct msqid_kernel *kmsqptr)
+{
+ char stime_buf[100], rtime_buf[100], ctime_buf[100];
+
+ cvt_time(kmsqptr->u.msg_stime, stime_buf);
+ cvt_time(kmsqptr->u.msg_rtime, rtime_buf);
+ cvt_time(kmsqptr->u.msg_ctime, ctime_buf);
+
+ printf("q %12d %12d %s %-8s %-8s",
+ IXSEQ_TO_IPCID(i, kmsqptr->u.msg_perm),
+ (int)kmsqptr->u.msg_perm.key,
+ fmt_perm(kmsqptr->u.msg_perm.mode),
+ user_from_uid(kmsqptr->u.msg_perm.uid, 0),
+ group_from_gid(kmsqptr->u.msg_perm.gid, 0));
+
+ if (option & CREATOR)
+ printf(" %-8s %-8s",
+ user_from_uid(kmsqptr->u.msg_perm.cuid, 0),
+ group_from_gid(kmsqptr->u.msg_perm.cgid, 0));
+
+ if (option & OUTSTANDING)
+ printf(" %12lu %12lu",
+ kmsqptr->u.msg_cbytes,
+ kmsqptr->u.msg_qnum);
+
+ if (option & BIGGEST)
+ printf(" %20lu", kmsqptr->u.msg_qbytes);
+
+ if (option & PID)
+ printf(" %12d %12d",
+ kmsqptr->u.msg_lspid,
+ kmsqptr->u.msg_lrpid);
+
+ if (option & TIME)
+ printf(" %s %s %s",
+ stime_buf,
+ rtime_buf,
+ ctime_buf);
+
+ printf("\n");
+}
+
+void
+print_kshmtotal(struct shminfo local_shminfo)
+{
+
+ printf("shminfo:\n");
+ printf("\tshmmax: %12lu\t(max shared memory segment size)\n",
+ local_shminfo.shmmax);
+ printf("\tshmmin: %12lu\t(min shared memory segment size)\n",
+ local_shminfo.shmmin);
+ printf("\tshmmni: %12lu\t(max number of shared memory identifiers)\n",
+ local_shminfo.shmmni);
+ printf("\tshmseg: %12lu\t(max shared memory segments per process)\n",
+ local_shminfo.shmseg);
+ printf("\tshmall: %12lu\t(max amount of shared memory in pages)\n\n",
+ local_shminfo.shmall);
+}
+
+void
+print_kshmheader(int option)
+{
+
+ printf("Shared Memory:\n");
+ printf("T %12s %12s %-11s %-8s %-8s",
+ "ID", "KEY", "MODE", "OWNER", "GROUP");
+ if (option & CREATOR)
+ printf(" %-8s %-8s", "CREATOR", "CGROUP");
+ if (option & OUTSTANDING)
+ printf(" %12s", "NATTCH");
+ if (option & BIGGEST)
+ printf(" %12s", "SEGSZ");
+ if (option & PID)
+ printf(" %12s %12s", "CPID", "LPID");
+ if (option & TIME)
+ printf(" %-8s %-8s %-8s", "ATIME", "DTIME", "CTIME");
+ printf("\n");
+}
+
+void
+print_kshmptr(int i, int option, struct shmid_kernel *kshmptr)
+{
+ char atime_buf[100], dtime_buf[100], ctime_buf[100];
+
+ cvt_time(kshmptr->u.shm_atime, atime_buf);
+ cvt_time(kshmptr->u.shm_dtime, dtime_buf);
+ cvt_time(kshmptr->u.shm_ctime, ctime_buf);
+
+ printf("m %12d %12d %s %-8s %-8s",
+ IXSEQ_TO_IPCID(i, kshmptr->u.shm_perm),
+ (int)kshmptr->u.shm_perm.key,
+ fmt_perm(kshmptr->u.shm_perm.mode),
+ user_from_uid(kshmptr->u.shm_perm.uid, 0),
+ group_from_gid(kshmptr->u.shm_perm.gid, 0));
+
+ if (option & CREATOR)
+ printf(" %-8s %-8s",
+ user_from_uid(kshmptr->u.shm_perm.cuid, 0),
+ group_from_gid(kshmptr->u.shm_perm.cgid, 0));
+
+ if (option & OUTSTANDING)
+ printf(" %12d",
+ kshmptr->u.shm_nattch);
+
+ if (option & BIGGEST)
+ printf(" %12zu",
+ kshmptr->u.shm_segsz);
+
+ if (option & PID)
+ printf(" %12d %12d",
+ kshmptr->u.shm_cpid,
+ kshmptr->u.shm_lpid);
+
+ if (option & TIME)
+ printf(" %s %s %s",
+ atime_buf,
+ dtime_buf,
+ ctime_buf);
+
+ printf("\n");
+}
+
+void
+print_ksemtotal(struct seminfo local_seminfo)
+{
+
+ printf("seminfo:\n");
+ printf("\tsemmni: %12d\t(# of semaphore identifiers)\n",
+ local_seminfo.semmni);
+ printf("\tsemmns: %12d\t(# of semaphores in system)\n",
+ local_seminfo.semmns);
+ printf("\tsemmnu: %12d\t(# of undo structures in system)\n",
+ local_seminfo.semmnu);
+ printf("\tsemmsl: %12d\t(max # of semaphores per id)\n",
+ local_seminfo.semmsl);
+ printf("\tsemopm: %12d\t(max # of operations per semop call)\n",
+ local_seminfo.semopm);
+ printf("\tsemume: %12d\t(max # of undo entries per process)\n",
+ local_seminfo.semume);
+ printf("\tsemusz: %12d\t(size in bytes of undo structure)\n",
+ local_seminfo.semusz);
+ printf("\tsemvmx: %12d\t(semaphore maximum value)\n",
+ local_seminfo.semvmx);
+ printf("\tsemaem: %12d\t(adjust on exit max value)\n\n",
+ local_seminfo.semaem);
+}
+
+void
+print_ksemheader(int option)
+{
+
+ printf("Semaphores:\n");
+ printf("T %12s %12s %-11s %-8s %-8s",
+ "ID", "KEY", "MODE", "OWNER", "GROUP");
+ if (option & CREATOR)
+ printf(" %-8s %-8s", "CREATOR", "CGROUP");
+ if (option & BIGGEST)
+ printf(" %12s", "NSEMS");
+ if (option & TIME)
+ printf(" %-8s %-8s", "OTIME", "CTIME");
+ printf("\n");
+}
+
+void
+print_ksemptr(int i, int option, struct semid_kernel *ksemaptr)
+{
+ char ctime_buf[100], otime_buf[100];
+
+ cvt_time(ksemaptr->u.sem_otime, otime_buf);
+ cvt_time(ksemaptr->u.sem_ctime, ctime_buf);
+
+ printf("s %12d %12d %s %-8s %-8s",
+ IXSEQ_TO_IPCID(i, ksemaptr->u.sem_perm),
+ (int)ksemaptr->u.sem_perm.key,
+ fmt_perm(ksemaptr->u.sem_perm.mode),
+ user_from_uid(ksemaptr->u.sem_perm.uid, 0),
+ group_from_gid(ksemaptr->u.sem_perm.gid, 0));
+
+ if (option & CREATOR)
+ printf(" %-8s %-8s",
+ user_from_uid(ksemaptr->u.sem_perm.cuid, 0),
+ group_from_gid(ksemaptr->u.sem_perm.cgid, 0));
+
+ if (option & BIGGEST)
+ printf(" %12d",
+ ksemaptr->u.sem_nsems);
+
+ if (option & TIME)
+ printf(" %s %s",
+ otime_buf,
+ ctime_buf);
+
+ printf("\n");
+}
+
+uid_t
+user2uid(char *username)
+{
+ struct passwd *pwd;
+ uid_t uid;
+ char *r;
+
+ uid = strtoul(username, &r, 0);
+ if (!*r && r != username)
+ return (uid);
+ if ((pwd = getpwnam(username)) == NULL)
+ errx(1, "getpwnam failed: No such user");
+ endpwent();
+ return (pwd->pw_uid);
+}
+
+void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: "
+ "ipcs [-abcmopqstyMQST] [-C corefile] [-N namelist] [-u user]\n");
+ exit(1);
+}
diff --git a/usr.bin/iscsictl/Makefile b/usr.bin/iscsictl/Makefile
new file mode 100644
index 0000000..72eae15
--- /dev/null
+++ b/usr.bin/iscsictl/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+PACKAGE= iscsi
+PROG= iscsictl
+SRCS= iscsictl.c periphs.c parse.y token.l y.tab.h
+CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I${.CURDIR}/../../sys/dev/iscsi
+MAN= iscsi.conf.5 iscsictl.8
+
+LIBADD= xo
+
+YFLAGS+= -v
+LFLAGS+= -i
+CLEANFILES= y.tab.c y.tab.h y.output
+
+WARNS= 6
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/iscsictl/Makefile.depend b/usr.bin/iscsictl/Makefile.depend
new file mode 100644
index 0000000..6146f86
--- /dev/null
+++ b/usr.bin/iscsictl/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcam \
+ lib/libcompiler_rt \
+ lib/libutil \
+ lib/libxo \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/iscsictl/iscsi.conf.5 b/usr.bin/iscsictl/iscsi.conf.5
new file mode 100644
index 0000000..6d80392
--- /dev/null
+++ b/usr.bin/iscsictl/iscsi.conf.5
@@ -0,0 +1,178 @@
+.\" Copyright (c) 2007-2010 Daniel Braniss <danny@cs.huji.ac.il>
+.\" 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 May 6, 2016
+.Dt ISCSI.CONF 5
+.Os
+.Sh NAME
+.Nm iscsi.conf
+.Nd iSCSI initiator configuration file
+.Sh DESCRIPTION
+The
+.Nm
+configuration file is used by the
+.Xr iscsictl 8
+and
+.Xr iscontrol 8
+utilities.
+The general syntax is:
+.Bf Li
+.Bd -literal
+ # this is a comment
+ nickname_1 {
+ variable = value;
+ ...
+ }
+ nickname_2 {
+ variable = value;
+ ...
+ }
+ ...
+.Ed
+.Ef
+.Bl -tag -width MaxConnections
+.It Cm AuthMethod
+Sets the authentication type.
+Type can be either
+.Qq Ar None ,
+or
+.Qq Ar CHAP .
+Default is
+.Qq Ar None .
+When set to
+.Cm CHAP ,
+both
+.Cm chapIName
+and
+.Cm chapSecret
+must be defined.
+.It Cm chapIName
+Login for CHAP authentication.
+.It Cm chapSecret
+Secret for CHAP authentication.
+.It Cm tgtChapName
+Target login for Mutual CHAP authentication.
+.It Cm tgtChapSecret
+Target secret for Mutual CHAP authentication.
+.It Cm HeaderDigest
+Sets the header digest; a checksum calculated over the header of iSCSI
+PDUs, and verified on receive.
+Digest can be either
+.Qq Ar None ,
+or
+.Qq Ar CRC32C .
+Default is
+.Qq Ar None .
+.It Cm DataDigest
+Sets the data digest; a checksum calculated over the Data Section of iSCSI
+PDUs, and verified on receive.
+Digest can be either
+.Qq Ar None ,
+or
+.Qq Ar CRC32C .
+Default is
+.Qq Ar None .
+.It Cm InitiatorName
+Sets the initiator name.
+By default, the name is concatenation of
+.Qq Ar iqn.1994-09.org.freebsd:
+with the hostname.
+.It Cm TargetName
+Sets the target name.
+Not required for discovery sessions.
+.It Cm TargetAddress
+Sets the target address and port, in
+.Sy address[:port]
+format.
+The
+.Sy address
+can be either an IP address, or hostname.
+The optional port defaults to 3260.
+.It Cm SessionType
+Sets the session type.
+Type can be either
+.Qq Ar Discovery ,
+or
+.Qq Ar Normal .
+Default is
+.Qq Ar Normal .
+For normal sessions, the
+.Sy TargetName
+must be defined.
+Discovery sessions result in the initiator connecting to all the targets
+returned by SendTargets iSCSI discovery with the defined
+.Sy TargetAddress .
+.It Cm Enable
+Enable or disable the session.
+State can be either
+.Qq Ar On ,
+or
+.Qq Ar Off .
+Default is
+.Qq Ar On .
+.It Cm Offload
+Name of selected iSCSI hardware offload driver.
+Default is
+.Qq Ar None .
+.It Cm Protocol
+Name of selected protocol.
+It can be either
+.Qq Ar iSER ,
+for iSCSI over RDMA, or
+.Qq Ar iSCSI .
+Default is
+.Qq Ar iSCSI .
+.El
+.Sh FILES
+.Bl -tag -width indent
+.It Pa /etc/iscsi.conf
+.El
+.Sh EXAMPLES
+.Bd -literal
+myiscsi { # nickname
+ targetaddress = iscsi1
+ targetname = iqn.1900.com.com:sn.123456
+}
+
+myiscsi6 { # nickname
+ targetaddress = [2001:db8::de:ef]:3260
+ targetname = iqn.1900.com.com:sn.123456
+}
+
+chaptest {
+ targetaddress = 10.0.0.1;
+ targetname = iqn.1900.com.com:sn.123456;
+ initiatorname = iqn.2005-01.il.ac.huji.cs:nobody;
+ authmethod = CHAP;
+ chapiname = iqn.2005-01.il.ac.huji.cs:nobody;
+ chapsecret = "secretsecret";
+}
+.Ed
+.Sh SEE ALSO
+.Xr iscontrol 8 ,
+.Xr iscsictl 8
+.\"Sh HISTORY
+.\"Sh AUTHORS
diff --git a/usr.bin/iscsictl/iscsictl.8 b/usr.bin/iscsictl/iscsictl.8
new file mode 100644
index 0000000..7360e6a
--- /dev/null
+++ b/usr.bin/iscsictl/iscsictl.8
@@ -0,0 +1,223 @@
+.\" Copyright (c) 2012 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Edward Tomasz Napierala 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 AUTHORS 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 AUTHORS 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 May 6, 2016
+.Dt ISCSICTL 8
+.Os
+.Sh NAME
+.Nm iscsictl
+.Nd iSCSI initiator management utility
+.Sh SYNOPSIS
+.Nm
+.Fl A
+.Fl p Ar portal Fl t Ar target
+.Op Fl u Ar user Fl s Ar secret
+.Op Fl w Ar timeout
+.Op Fl r
+.Op Fl e Cm on | off
+.Nm
+.Fl A
+.Fl d Ar discovery-host
+.Op Fl u Ar user Fl s Ar secret
+.Op Fl r
+.Op Fl e Cm on | off
+.Nm
+.Fl A
+.Fl a Op Fl c Ar path
+.Nm
+.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
+.Op Fl e Cm on | off
+.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
+.Nm
+.Fl R
+.Fl a
+.Nm
+.Fl R
+.Fl n Ar nickname Op Fl c Ar path
+.Nm
+.Fl L
+.Op Fl v
+.Op Fl w Ar timeout
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to configure the iSCSI initiator.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl A"
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.It Fl A
+Add session.
+.It Fl M
+Modify session.
+.It Fl R
+Remove session.
+.It Fl L
+List sessions.
+.It Fl a
+When adding, add all sessions defined in the configuration file.
+When removing, remove all currently established sessions.
+.It Fl c
+Path to the configuration file.
+The default is
+.Pa /etc/iscsi.conf .
+.It Fl d
+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 session will be removed.
+.It Fl e
+Enable or disable the session.
+This is ignored for discovery sessions, but gets passed down to normal
+sessions they add.
+.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
+Target portal - host name or address - for statically defined targets.
+.It Fl r
+Use iSER (iSCSI over RDMA) instead of plain iSCSI over TCP/IP.
+.It Fl s
+CHAP secret.
+.It Fl t
+Target name.
+.It Fl u
+CHAP login.
+.It Fl v
+Verbose mode.
+.It Fl w
+Instead of returning immediately, wait up to
+.Ar timeout
+seconds until all configured sessions are successfully established.
+.El
+.Pp
+Certain parameters are necessary when adding a session.
+One can specify these either via command line (using the
+.Fl t ,
+.Fl p ,
+.Fl u ,
+and
+.Fl s
+options), or configuration file (using the
+.Fl a
+or
+.Fl n
+options).
+Some functionality - for example mutual CHAP - is available only
+via configuration file.
+.Pp
+Since connecting to the target is performed in background, non-zero
+exit status does not mean that the session was successfully established.
+Use either
+.Nm Fl L
+to check the connection status, or the
+.Fl w
+flag to wait for session establishment.
+.Pp
+Note that in order for the iSCSI initiator to be able to connect to a target,
+the
+.Xr iscsid 8
+daemon must be running.
+.Pp
+Also note that
+.Fx
+currently supports two different initiators: the old one,
+.Xr iscsi_initiator 4 ,
+with its control utility
+.Xr iscontrol 8 ,
+and the new one,
+.Xr iscsi 4 ,
+with
+.Nm
+and
+.Xr iscsid 8 .
+The only thing the two have in common is the configuration file,
+.Xr iscsi.conf 5 .
+.Sh FILES
+.Bl -tag -width ".Pa /etc/iscsi.conf" -compact
+.It Pa /etc/iscsi.conf
+iSCSI initiator configuration file.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 on success, and >0 if an error occurs.
+.Sh EXAMPLES
+Attach to target iqn.2012-06.com.example:target0, served by 192.168.1.1:
+.Dl Nm Fl A Fl t Ar iqn.2012-06.com.example:target0 Fl p Ar 192.168.1.1
+.Pp
+Perform discovery on 192.168.1.1, and add disabled sessions for each
+discovered target; use
+.Nm -M -e on
+to connect them:
+.Dl Nm Fl A Fl d Ar 192.168.1.1 Fl e Ar off
+.Pp
+Disconnect all iSCSI sessions:
+.Dl Nm Fl Ra
+.Sh SEE ALSO
+.Xr libxo 3 ,
+.Xr xo_parse_args 3 ,
+.Xr iscsi 4 ,
+.Xr iscsi.conf 5 ,
+.Xr iscsid 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+The
+.Nm
+utility was developed by
+.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
new file mode 100644
index 0000000..71a1abe
--- /dev/null
+++ b/usr.bin/iscsictl/iscsictl.c
@@ -0,0 +1,1042 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala 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/ioctl.h>
+#include <sys/param.h>
+#include <sys/linker.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+
+#include <iscsi_ioctl.h>
+#include "iscsictl.h"
+
+struct conf *
+conf_new(void)
+{
+ struct conf *conf;
+
+ conf = calloc(1, sizeof(*conf));
+ if (conf == NULL)
+ xo_err(1, "calloc");
+
+ TAILQ_INIT(&conf->conf_targets);
+
+ return (conf);
+}
+
+struct target *
+target_find(struct conf *conf, const char *nickname)
+{
+ struct target *targ;
+
+ TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
+ if (targ->t_nickname != NULL &&
+ strcasecmp(targ->t_nickname, nickname) == 0)
+ return (targ);
+ }
+
+ return (NULL);
+}
+
+struct target *
+target_new(struct conf *conf)
+{
+ struct target *targ;
+
+ targ = calloc(1, sizeof(*targ));
+ if (targ == NULL)
+ xo_err(1, "calloc");
+ targ->t_conf = conf;
+ TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next);
+
+ return (targ);
+}
+
+void
+target_delete(struct target *targ)
+{
+
+ TAILQ_REMOVE(&targ->t_conf->conf_targets, targ, t_next);
+ free(targ);
+}
+
+static char *
+default_initiator_name(void)
+{
+ char *name;
+ size_t namelen;
+ int error;
+
+ namelen = _POSIX_HOST_NAME_MAX + strlen(DEFAULT_IQN);
+
+ name = calloc(1, namelen + 1);
+ if (name == NULL)
+ xo_err(1, "calloc");
+ strcpy(name, DEFAULT_IQN);
+ error = gethostname(name + strlen(DEFAULT_IQN),
+ namelen - strlen(DEFAULT_IQN));
+ if (error != 0)
+ xo_err(1, "gethostname");
+
+ return (name);
+}
+
+static bool
+valid_hex(const char ch)
+{
+ switch (ch) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'a':
+ case 'A':
+ case 'b':
+ case 'B':
+ case 'c':
+ case 'C':
+ case 'd':
+ case 'D':
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'F':
+ return (true);
+ default:
+ return (false);
+ }
+}
+
+int
+parse_enable(const char *enable)
+{
+ if (enable == NULL)
+ return (ENABLE_UNSPECIFIED);
+
+ if (strcasecmp(enable, "on") == 0 ||
+ strcasecmp(enable, "yes") == 0)
+ return (ENABLE_ON);
+
+ if (strcasecmp(enable, "off") == 0 ||
+ strcasecmp(enable, "no") == 0)
+ return (ENABLE_OFF);
+
+ return (ENABLE_UNSPECIFIED);
+}
+
+bool
+valid_iscsi_name(const char *name)
+{
+ int i;
+
+ if (strlen(name) >= MAX_NAME_LEN) {
+ xo_warnx("overlong name for \"%s\"; max length allowed "
+ "by iSCSI specification is %d characters",
+ name, MAX_NAME_LEN);
+ return (false);
+ }
+
+ /*
+ * In the cases below, we don't return an error, just in case the admin
+ * was right, and we're wrong.
+ */
+ if (strncasecmp(name, "iqn.", strlen("iqn.")) == 0) {
+ for (i = strlen("iqn."); name[i] != '\0'; i++) {
+ /*
+ * XXX: We should verify UTF-8 normalisation, as defined
+ * by 3.2.6.2: iSCSI Name Encoding.
+ */
+ if (isalnum(name[i]))
+ continue;
+ if (name[i] == '-' || name[i] == '.' || name[i] == ':')
+ continue;
+ xo_warnx("invalid character \"%c\" in iSCSI name "
+ "\"%s\"; allowed characters are letters, digits, "
+ "'-', '.', and ':'", name[i], name);
+ break;
+ }
+ /*
+ * XXX: Check more stuff: valid date and a valid reversed domain.
+ */
+ } else if (strncasecmp(name, "eui.", strlen("eui.")) == 0) {
+ if (strlen(name) != strlen("eui.") + 16)
+ xo_warnx("invalid iSCSI name \"%s\"; the \"eui.\" "
+ "should be followed by exactly 16 hexadecimal "
+ "digits", name);
+ for (i = strlen("eui."); name[i] != '\0'; i++) {
+ if (!valid_hex(name[i])) {
+ xo_warnx("invalid character \"%c\" in iSCSI "
+ "name \"%s\"; allowed characters are 1-9 "
+ "and A-F", name[i], name);
+ break;
+ }
+ }
+ } else if (strncasecmp(name, "naa.", strlen("naa.")) == 0) {
+ if (strlen(name) > strlen("naa.") + 32)
+ xo_warnx("invalid iSCSI name \"%s\"; the \"naa.\" "
+ "should be followed by at most 32 hexadecimal "
+ "digits", name);
+ for (i = strlen("naa."); name[i] != '\0'; i++) {
+ if (!valid_hex(name[i])) {
+ xo_warnx("invalid character \"%c\" in ISCSI "
+ "name \"%s\"; allowed characters are 1-9 "
+ "and A-F", name[i], name);
+ break;
+ }
+ }
+ } else {
+ xo_warnx("invalid iSCSI name \"%s\"; should start with "
+ "either \".iqn\", \"eui.\", or \"naa.\"",
+ name);
+ }
+ return (true);
+}
+
+void
+conf_verify(struct conf *conf)
+{
+ struct target *targ;
+
+ TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
+ assert(targ->t_nickname != NULL);
+ if (targ->t_session_type == SESSION_TYPE_UNSPECIFIED)
+ targ->t_session_type = SESSION_TYPE_NORMAL;
+ if (targ->t_session_type == SESSION_TYPE_NORMAL &&
+ targ->t_name == NULL)
+ xo_errx(1, "missing TargetName for target \"%s\"",
+ targ->t_nickname);
+ if (targ->t_session_type == SESSION_TYPE_DISCOVERY &&
+ targ->t_name != NULL)
+ xo_errx(1, "cannot specify TargetName for discovery "
+ "sessions for target \"%s\"", targ->t_nickname);
+ if (targ->t_name != NULL) {
+ if (valid_iscsi_name(targ->t_name) == false)
+ xo_errx(1, "invalid target name \"%s\"",
+ targ->t_name);
+ }
+ if (targ->t_protocol == PROTOCOL_UNSPECIFIED)
+ targ->t_protocol = PROTOCOL_ISCSI;
+ if (targ->t_address == NULL)
+ xo_errx(1, "missing TargetAddress for target \"%s\"",
+ targ->t_nickname);
+ if (targ->t_initiator_name == NULL)
+ targ->t_initiator_name = default_initiator_name();
+ if (valid_iscsi_name(targ->t_initiator_name) == false)
+ xo_errx(1, "invalid initiator name \"%s\"",
+ targ->t_initiator_name);
+ if (targ->t_header_digest == DIGEST_UNSPECIFIED)
+ targ->t_header_digest = DIGEST_NONE;
+ if (targ->t_data_digest == DIGEST_UNSPECIFIED)
+ targ->t_data_digest = DIGEST_NONE;
+ if (targ->t_auth_method == AUTH_METHOD_UNSPECIFIED) {
+ if (targ->t_user != NULL || targ->t_secret != NULL ||
+ targ->t_mutual_user != NULL ||
+ targ->t_mutual_secret != NULL)
+ targ->t_auth_method =
+ AUTH_METHOD_CHAP;
+ else
+ targ->t_auth_method =
+ AUTH_METHOD_NONE;
+ }
+ if (targ->t_auth_method == AUTH_METHOD_CHAP) {
+ if (targ->t_user == NULL) {
+ xo_errx(1, "missing chapIName for target \"%s\"",
+ targ->t_nickname);
+ }
+ if (targ->t_secret == NULL)
+ xo_errx(1, "missing chapSecret for target \"%s\"",
+ targ->t_nickname);
+ if (targ->t_mutual_user != NULL ||
+ targ->t_mutual_secret != NULL) {
+ if (targ->t_mutual_user == NULL)
+ xo_errx(1, "missing tgtChapName for "
+ "target \"%s\"", targ->t_nickname);
+ if (targ->t_mutual_secret == NULL)
+ xo_errx(1, "missing tgtChapSecret for "
+ "target \"%s\"", targ->t_nickname);
+ }
+ }
+ }
+}
+
+static void
+conf_from_target(struct iscsi_session_conf *conf,
+ const struct target *targ)
+{
+ memset(conf, 0, sizeof(*conf));
+
+ /*
+ * XXX: Check bounds and return error instead of silently truncating.
+ */
+ if (targ->t_initiator_name != NULL)
+ strlcpy(conf->isc_initiator, targ->t_initiator_name,
+ sizeof(conf->isc_initiator));
+ if (targ->t_initiator_address != NULL)
+ strlcpy(conf->isc_initiator_addr, targ->t_initiator_address,
+ sizeof(conf->isc_initiator_addr));
+ if (targ->t_initiator_alias != NULL)
+ strlcpy(conf->isc_initiator_alias, targ->t_initiator_alias,
+ sizeof(conf->isc_initiator_alias));
+ if (targ->t_name != NULL)
+ strlcpy(conf->isc_target, targ->t_name,
+ sizeof(conf->isc_target));
+ if (targ->t_address != NULL)
+ strlcpy(conf->isc_target_addr, targ->t_address,
+ sizeof(conf->isc_target_addr));
+ if (targ->t_user != NULL)
+ strlcpy(conf->isc_user, targ->t_user,
+ sizeof(conf->isc_user));
+ if (targ->t_secret != NULL)
+ strlcpy(conf->isc_secret, targ->t_secret,
+ sizeof(conf->isc_secret));
+ if (targ->t_mutual_user != NULL)
+ strlcpy(conf->isc_mutual_user, targ->t_mutual_user,
+ sizeof(conf->isc_mutual_user));
+ if (targ->t_mutual_secret != NULL)
+ strlcpy(conf->isc_mutual_secret, targ->t_mutual_secret,
+ sizeof(conf->isc_mutual_secret));
+ if (targ->t_session_type == SESSION_TYPE_DISCOVERY)
+ conf->isc_discovery = 1;
+ if (targ->t_enable != ENABLE_OFF)
+ conf->isc_enable = 1;
+ if (targ->t_protocol == PROTOCOL_ISER)
+ conf->isc_iser = 1;
+ if (targ->t_offload != NULL)
+ strlcpy(conf->isc_offload, targ->t_offload,
+ sizeof(conf->isc_offload));
+ if (targ->t_header_digest == DIGEST_CRC32C)
+ conf->isc_header_digest = ISCSI_DIGEST_CRC32C;
+ else
+ conf->isc_header_digest = ISCSI_DIGEST_NONE;
+ if (targ->t_data_digest == DIGEST_CRC32C)
+ conf->isc_data_digest = ISCSI_DIGEST_CRC32C;
+ else
+ conf->isc_data_digest = ISCSI_DIGEST_NONE;
+}
+
+static int
+kernel_add(int iscsi_fd, const struct target *targ)
+{
+ struct iscsi_session_add isa;
+ int error;
+
+ memset(&isa, 0, sizeof(isa));
+ conf_from_target(&isa.isa_conf, targ);
+ error = ioctl(iscsi_fd, ISCSISADD, &isa);
+ if (error != 0)
+ xo_warn("ISCSISADD");
+ return (error);
+}
+
+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)
+ xo_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, int enable)
+{
+ 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)
+ xo_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)
+ xo_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)
+ xo_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));
+ if (enable == ENABLE_ON)
+ conf->isc_enable = 1;
+ else if (enable == ENABLE_OFF)
+ conf->isc_enable = 0;
+
+ 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)
+ xo_warn("ISCSISMODIFY");
+}
+
+static int
+kernel_remove(int iscsi_fd, const struct target *targ)
+{
+ struct iscsi_session_remove isr;
+ int error;
+
+ memset(&isr, 0, sizeof(isr));
+ conf_from_target(&isr.isr_conf, targ);
+ error = ioctl(iscsi_fd, ISCSISREMOVE, &isr);
+ if (error != 0)
+ xo_warn("ISCSISREMOVE");
+ return (error);
+}
+
+/*
+ * XXX: Add filtering.
+ */
+static int
+kernel_list(int iscsi_fd, const struct target *targ __unused,
+ int verbose)
+{
+ struct iscsi_session_state *states = NULL;
+ const struct iscsi_session_state *state;
+ const struct iscsi_session_conf *conf;
+ struct iscsi_session_list isl;
+ unsigned int i, nentries = 1;
+ int error;
+
+ for (;;) {
+ states = realloc(states,
+ nentries * sizeof(struct iscsi_session_state));
+ if (states == NULL)
+ xo_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) {
+ xo_warn("ISCSISLIST");
+ return (error);
+ }
+
+ if (verbose != 0) {
+ xo_open_list("session");
+ for (i = 0; i < isl.isl_nentries; i++) {
+ state = &states[i];
+ conf = &state->iss_conf;
+
+ xo_open_instance("session");
+
+ /*
+ * Display-only modifier as this information
+ * is also present within the 'session' container
+ */
+ xo_emit("{L:/%-18s}{V:sessionId/%u}\n",
+ "Session ID:", state->iss_id);
+
+ xo_open_container("initiator");
+ xo_emit("{L:/%-18s}{V:name/%s}\n",
+ "Initiator name:", conf->isc_initiator);
+ xo_emit("{L:/%-18s}{V:portal/%s}\n",
+ "Initiator portal:", conf->isc_initiator_addr);
+ xo_emit("{L:/%-18s}{V:alias/%s}\n",
+ "Initiator alias:", conf->isc_initiator_alias);
+ xo_close_container("initiator");
+
+ xo_open_container("target");
+ xo_emit("{L:/%-18s}{V:name/%s}\n",
+ "Target name:", conf->isc_target);
+ xo_emit("{L:/%-18s}{V:portal/%s}\n",
+ "Target portal:", conf->isc_target_addr);
+ xo_emit("{L:/%-18s}{V:alias/%s}\n",
+ "Target alias:", state->iss_target_alias);
+ xo_close_container("target");
+
+ xo_open_container("auth");
+ xo_emit("{L:/%-18s}{V:user/%s}\n",
+ "User:", conf->isc_user);
+ xo_emit("{L:/%-18s}{V:secret/%s}\n",
+ "Secret:", conf->isc_secret);
+ xo_emit("{L:/%-18s}{V:mutualUser/%s}\n",
+ "Mutual user:", conf->isc_mutual_user);
+ xo_emit("{L:/%-18s}{V:mutualSecret/%s}\n",
+ "Mutual secret:", conf->isc_mutual_secret);
+ xo_close_container("auth");
+
+ xo_emit("{L:/%-18s}{V:type/%s}\n",
+ "Session type:",
+ conf->isc_discovery ? "Discovery" : "Normal");
+ xo_emit("{L:/%-18s}{V:enable/%s}\n",
+ "Enable:",
+ conf->isc_enable ? "Yes" : "No");
+ xo_emit("{L:/%-18s}{V:state/%s}\n",
+ "Session state:",
+ state->iss_connected ? "Connected" : "Disconnected");
+ xo_emit("{L:/%-18s}{V:failureReason/%s}\n",
+ "Failure reason:", state->iss_reason);
+ xo_emit("{L:/%-18s}{V:headerDigest/%s}\n",
+ "Header digest:",
+ state->iss_header_digest == ISCSI_DIGEST_CRC32C ?
+ "CRC32C" : "None");
+ xo_emit("{L:/%-18s}{V:dataDigest/%s}\n",
+ "Data digest:",
+ state->iss_data_digest == ISCSI_DIGEST_CRC32C ?
+ "CRC32C" : "None");
+ xo_emit("{L:/%-18s}{V:dataSegmentLen/%d}\n",
+ "DataSegmentLen:", state->iss_max_data_segment_length);
+ xo_emit("{L:/%-18s}{V:maxBurstLen/%d}\n",
+ "MaxBurstLen:", state->iss_max_burst_length);
+ xo_emit("{L:/%-18s}{V:firstBurstLen/%d}\n",
+ "FirstBurstLen:", state->iss_first_burst_length);
+ xo_emit("{L:/%-18s}{V:immediateData/%s}\n",
+ "ImmediateData:", state->iss_immediate_data ? "Yes" : "No");
+ xo_emit("{L:/%-18s}{V:iSER/%s}\n",
+ "iSER (RDMA):", conf->isc_iser ? "Yes" : "No");
+ xo_emit("{L:/%-18s}{V:offloadDriver/%s}\n",
+ "Offload driver:", state->iss_offload);
+ xo_emit("{L:/%-18s}",
+ "Device nodes:");
+ print_periphs(state->iss_id);
+ xo_emit("\n\n");
+ xo_close_instance("session");
+ }
+ xo_close_list("session");
+ } else {
+ xo_emit("{T:/%-36s} {T:/%-16s} {T:/%s}\n",
+ "Target name", "Target portal", "State");
+
+ if (isl.isl_nentries != 0)
+ xo_open_list("session");
+ for (i = 0; i < isl.isl_nentries; i++) {
+
+ state = &states[i];
+ conf = &state->iss_conf;
+
+ xo_open_instance("session");
+ xo_emit("{V:name/%-36s/%s} {V:portal/%-16s/%s} ",
+ conf->isc_target, conf->isc_target_addr);
+
+ if (state->iss_reason[0] != '\0') {
+ xo_emit("{V:state/%s}\n", state->iss_reason);
+ } else {
+ if (conf->isc_discovery) {
+ xo_emit("{V:state}\n", "Discovery");
+ } else if (conf->isc_enable == 0) {
+ xo_emit("{V:state}\n", "Disabled");
+ } else if (state->iss_connected) {
+ xo_emit("{V:state}: ", "Connected");
+ print_periphs(state->iss_id);
+ xo_emit("\n");
+ } else {
+ xo_emit("{V:state}\n", "Disconnected");
+ }
+ }
+ xo_close_instance("session");
+ }
+ if (isl.isl_nentries != 0)
+ xo_close_list("session");
+ }
+
+ return (0);
+}
+
+static int
+kernel_wait(int iscsi_fd, int timeout)
+{
+ struct iscsi_session_state *states = NULL;
+ const struct iscsi_session_state *state;
+ struct iscsi_session_list isl;
+ unsigned int i, nentries = 1;
+ bool all_connected;
+ int error;
+
+ for (;;) {
+ for (;;) {
+ states = realloc(states,
+ nentries * sizeof(struct iscsi_session_state));
+ if (states == NULL)
+ xo_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) {
+ xo_warn("ISCSISLIST");
+ return (error);
+ }
+
+ all_connected = true;
+ for (i = 0; i < isl.isl_nentries; i++) {
+ state = &states[i];
+
+ if (!state->iss_connected) {
+ all_connected = false;
+ break;
+ }
+ }
+
+ if (all_connected)
+ return (0);
+
+ sleep(1);
+
+ if (timeout > 0) {
+ timeout--;
+ if (timeout == 0)
+ return (1);
+ }
+ }
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: iscsictl -A -p portal -t target "
+ "[-u user -s secret] [-w timeout] [-e on | off]\n");
+ fprintf(stderr, " iscsictl -A -d discovery-host "
+ "[-u user -s secret] [-e on | off]\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] [-e on | off]\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");
+ fprintf(stderr, " iscsictl -L [-v] [-w timeout]\n");
+ exit(1);
+}
+
+char *
+checked_strdup(const char *s)
+{
+ char *c;
+
+ c = strdup(s);
+ if (c == NULL)
+ xo_err(1, "strdup");
+ return (c);
+}
+
+int
+main(int argc, char **argv)
+{
+ int Aflag = 0, Mflag = 0, Rflag = 0, Lflag = 0, aflag = 0,
+ rflag = 0, vflag = 0;
+ const char *conf_path = DEFAULT_CONFIG_PATH;
+ char *nickname = NULL, *discovery_host = NULL, *portal = NULL,
+ *target = NULL, *user = NULL, *secret = NULL;
+ int timeout = -1, enable = ENABLE_UNSPECIFIED;
+ long long session_id = -1;
+ char *end;
+ int ch, error, iscsi_fd, retval, saved_errno;
+ int failed = 0;
+ struct conf *conf;
+ struct target *targ;
+
+ argc = xo_parse_args(argc, argv);
+ xo_open_container("iscsictl");
+
+ while ((ch = getopt(argc, argv, "AMRLac:d:e:i:n:p:rt:u:s:vw:")) != -1) {
+ switch (ch) {
+ case 'A':
+ Aflag = 1;
+ break;
+ case 'M':
+ Mflag = 1;
+ break;
+ case 'R':
+ Rflag = 1;
+ break;
+ case 'L':
+ Lflag = 1;
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 'c':
+ conf_path = optarg;
+ break;
+ case 'd':
+ discovery_host = optarg;
+ break;
+ case 'e':
+ enable = parse_enable(optarg);
+ if (enable == ENABLE_UNSPECIFIED) {
+ xo_errx(1, "invalid argument to -e, "
+ "must be either \"on\" or \"off\"");
+ }
+ break;
+ case 'i':
+ session_id = strtol(optarg, &end, 10);
+ if ((size_t)(end - optarg) != strlen(optarg))
+ xo_errx(1, "trailing characters after session-id");
+ if (session_id < 0)
+ xo_errx(1, "session-id cannot be negative");
+ if (session_id > UINT_MAX)
+ xo_errx(1, "session-id cannot be greater than %u",
+ UINT_MAX);
+ break;
+ case 'n':
+ nickname = optarg;
+ break;
+ case 'p':
+ portal = optarg;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 't':
+ target = optarg;
+ break;
+ case 'u':
+ user = optarg;
+ break;
+ case 's':
+ secret = optarg;
+ break;
+ case 'v':
+ vflag = 1;
+ break;
+ case 'w':
+ timeout = strtol(optarg, &end, 10);
+ if ((size_t)(end - optarg) != strlen(optarg))
+ xo_errx(1, "trailing characters after timeout");
+ if (timeout < 0)
+ xo_errx(1, "timeout cannot be negative");
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ if (argc != 0)
+ usage();
+
+ if (Aflag + Mflag + Rflag + Lflag == 0)
+ Lflag = 1;
+ if (Aflag + Mflag + Rflag + Lflag > 1)
+ xo_errx(1, "at most one of -A, -M, -R, or -L may be specified");
+
+ /*
+ * Note that we ignore unnecessary/inapplicable "-c" flag; so that
+ * people can do something like "alias ISCSICTL="iscsictl -c path"
+ * in shell scripts.
+ */
+ if (Aflag != 0) {
+ if (aflag != 0) {
+ if (enable != ENABLE_UNSPECIFIED)
+ xo_errx(1, "-a and -e and mutually exclusive");
+ if (portal != NULL)
+ xo_errx(1, "-a and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-a and -t and mutually exclusive");
+ if (user != NULL)
+ xo_errx(1, "-a and -u and mutually exclusive");
+ if (secret != NULL)
+ xo_errx(1, "-a and -s and mutually exclusive");
+ if (nickname != NULL)
+ xo_errx(1, "-a and -n and mutually exclusive");
+ if (discovery_host != NULL)
+ xo_errx(1, "-a and -d and mutually exclusive");
+ if (rflag != 0)
+ xo_errx(1, "-a and -r and mutually exclusive");
+ } else if (nickname != NULL) {
+ if (enable != ENABLE_UNSPECIFIED)
+ xo_errx(1, "-n and -e and mutually exclusive");
+ if (portal != NULL)
+ xo_errx(1, "-n and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-n and -t and mutually exclusive");
+ if (user != NULL)
+ xo_errx(1, "-n and -u and mutually exclusive");
+ if (secret != NULL)
+ xo_errx(1, "-n and -s and mutually exclusive");
+ if (discovery_host != NULL)
+ xo_errx(1, "-n and -d and mutually exclusive");
+ if (rflag != 0)
+ xo_errx(1, "-n and -r and mutually exclusive");
+ } else if (discovery_host != NULL) {
+ if (portal != NULL)
+ xo_errx(1, "-d and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-d and -t and mutually exclusive");
+ } else {
+ if (target == NULL && portal == NULL)
+ xo_errx(1, "must specify -a, -n or -t/-p");
+
+ if (target != NULL && portal == NULL)
+ xo_errx(1, "-t must always be used with -p");
+ if (portal != NULL && target == NULL)
+ xo_errx(1, "-p must always be used with -t");
+ }
+
+ if (user != NULL && secret == NULL)
+ xo_errx(1, "-u must always be used with -s");
+ if (secret != NULL && user == NULL)
+ xo_errx(1, "-s must always be used with -u");
+
+ if (session_id != -1)
+ xo_errx(1, "-i cannot be used with -A");
+ if (vflag != 0)
+ xo_errx(1, "-v cannot be used with -A");
+
+ } else if (Mflag != 0) {
+ if (session_id == -1)
+ xo_errx(1, "-M requires -i");
+
+ if (nickname != NULL) {
+ if (enable != ENABLE_UNSPECIFIED)
+ xo_errx(1, "-n and -e and mutually exclusive");
+ if (portal != NULL)
+ xo_errx(1, "-n and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-n and -t and mutually exclusive");
+ if (user != NULL)
+ xo_errx(1, "-n and -u and mutually exclusive");
+ if (secret != NULL)
+ xo_errx(1, "-n and -s and mutually exclusive");
+ }
+
+ if (aflag != 0)
+ xo_errx(1, "-a cannot be used with -M");
+ if (discovery_host != NULL)
+ xo_errx(1, "-d cannot be used with -M");
+ if (rflag != 0)
+ xo_errx(1, "-r cannot be used with -M");
+ if (vflag != 0)
+ xo_errx(1, "-v cannot be used with -M");
+ if (timeout != -1)
+ xo_errx(1, "-w cannot be used with -M");
+
+ } else if (Rflag != 0) {
+ if (aflag != 0) {
+ if (portal != NULL)
+ xo_errx(1, "-a and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-a and -t and mutually exclusive");
+ if (nickname != NULL)
+ xo_errx(1, "-a and -n and mutually exclusive");
+ } else if (nickname != NULL) {
+ if (portal != NULL)
+ xo_errx(1, "-n and -p and mutually exclusive");
+ if (target != NULL)
+ xo_errx(1, "-n and -t and mutually exclusive");
+ } else if (target == NULL && portal == NULL) {
+ xo_errx(1, "must specify either -a, -n, -t, or -p");
+ }
+
+ if (discovery_host != NULL)
+ xo_errx(1, "-d cannot be used with -R");
+ if (enable != ENABLE_UNSPECIFIED)
+ xo_errx(1, "-e cannot be used with -R");
+ if (session_id != -1)
+ xo_errx(1, "-i cannot be used with -R");
+ if (rflag != 0)
+ xo_errx(1, "-r cannot be used with -R");
+ if (user != NULL)
+ xo_errx(1, "-u cannot be used with -R");
+ if (secret != NULL)
+ xo_errx(1, "-s cannot be used with -R");
+ if (vflag != 0)
+ xo_errx(1, "-v cannot be used with -R");
+ if (timeout != -1)
+ xo_errx(1, "-w cannot be used with -R");
+
+ } else {
+ assert(Lflag != 0);
+
+ if (discovery_host != NULL)
+ xo_errx(1, "-d cannot be used with -L");
+ if (session_id != -1)
+ xo_errx(1, "-i cannot be used with -L");
+ if (nickname != NULL)
+ xo_errx(1, "-n cannot be used with -L");
+ if (portal != NULL)
+ xo_errx(1, "-p cannot be used with -L");
+ if (rflag != 0)
+ xo_errx(1, "-r cannot be used with -L");
+ if (target != NULL)
+ xo_errx(1, "-t cannot be used with -L");
+ if (user != NULL)
+ xo_errx(1, "-u cannot be used with -L");
+ if (secret != NULL)
+ xo_errx(1, "-s cannot be used with -L");
+ }
+
+ iscsi_fd = open(ISCSI_PATH, O_RDWR);
+ if (iscsi_fd < 0 && errno == ENOENT) {
+ saved_errno = errno;
+ retval = kldload("iscsi");
+ if (retval != -1)
+ iscsi_fd = open(ISCSI_PATH, O_RDWR);
+ else
+ errno = saved_errno;
+ }
+ if (iscsi_fd < 0)
+ xo_err(1, "failed to open %s", ISCSI_PATH);
+
+ if (Aflag != 0 && aflag != 0) {
+ conf = conf_new_from_file(conf_path);
+
+ TAILQ_FOREACH(targ, &conf->conf_targets, t_next)
+ failed += kernel_add(iscsi_fd, targ);
+ } else if (nickname != NULL) {
+ conf = conf_new_from_file(conf_path);
+ targ = target_find(conf, nickname);
+ if (targ == NULL)
+ xo_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, enable);
+ } else {
+ if (Aflag != 0 && target != NULL) {
+ if (valid_iscsi_name(target) == false)
+ xo_errx(1, "invalid target name \"%s\"", target);
+ }
+ conf = conf_new();
+ targ = target_new(conf);
+ targ->t_initiator_name = default_initiator_name();
+ targ->t_header_digest = DIGEST_NONE;
+ targ->t_data_digest = DIGEST_NONE;
+ targ->t_name = target;
+ if (discovery_host != NULL) {
+ targ->t_session_type = SESSION_TYPE_DISCOVERY;
+ targ->t_address = discovery_host;
+ } else {
+ targ->t_session_type = SESSION_TYPE_NORMAL;
+ targ->t_address = portal;
+ }
+ targ->t_enable = enable;
+ if (rflag != 0)
+ targ->t_protocol = PROTOCOL_ISER;
+ targ->t_user = user;
+ targ->t_secret = secret;
+
+ if (Aflag != 0)
+ failed += kernel_add(iscsi_fd, targ);
+ else if (Rflag != 0)
+ failed += kernel_remove(iscsi_fd, targ);
+ else
+ failed += kernel_list(iscsi_fd, targ, vflag);
+ }
+
+ if (timeout != -1)
+ failed += kernel_wait(iscsi_fd, timeout);
+
+ error = close(iscsi_fd);
+ if (error != 0)
+ xo_err(1, "close");
+
+ xo_close_container("iscsictl");
+ xo_finish();
+
+ if (failed != 0)
+ return (1);
+
+ return (0);
+}
diff --git a/usr.bin/iscsictl/iscsictl.h b/usr.bin/iscsictl/iscsictl.h
new file mode 100644
index 0000000..18300a1
--- /dev/null
+++ b/usr.bin/iscsictl/iscsictl.h
@@ -0,0 +1,123 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef ISCSICTL_H
+#define ISCSICTL_H
+
+#include <sys/queue.h>
+#include <stdbool.h>
+#include <libutil.h>
+
+#define DEFAULT_CONFIG_PATH "/etc/iscsi.conf"
+#define DEFAULT_IQN "iqn.1994-09.org.freebsd:"
+
+#define MAX_NAME_LEN 223
+#define MAX_DATA_SEGMENT_LENGTH 65536
+
+#define AUTH_METHOD_UNSPECIFIED 0
+#define AUTH_METHOD_NONE 1
+#define AUTH_METHOD_CHAP 2
+
+#define DIGEST_UNSPECIFIED 0
+#define DIGEST_NONE 1
+#define DIGEST_CRC32C 2
+
+#define SESSION_TYPE_UNSPECIFIED 0
+#define SESSION_TYPE_NORMAL 1
+#define SESSION_TYPE_DISCOVERY 2
+
+#define PROTOCOL_UNSPECIFIED 0
+#define PROTOCOL_ISCSI 1
+#define PROTOCOL_ISER 2
+
+#define ENABLE_UNSPECIFIED 0
+#define ENABLE_ON 1
+#define ENABLE_OFF 2
+
+struct target {
+ TAILQ_ENTRY(target) t_next;
+ struct conf *t_conf;
+ char *t_nickname;
+ char *t_name;
+ char *t_address;
+ char *t_initiator_name;
+ char *t_initiator_address;
+ char *t_initiator_alias;
+ int t_header_digest;
+ int t_data_digest;
+ int t_auth_method;
+ int t_session_type;
+ int t_enable;
+ int t_protocol;
+ char *t_offload;
+ char *t_user;
+ char *t_secret;
+ char *t_mutual_user;
+ char *t_mutual_secret;
+};
+
+struct conf {
+ TAILQ_HEAD(, target) conf_targets;
+};
+
+#define CONN_SESSION_TYPE_NONE 0
+#define CONN_SESSION_TYPE_DISCOVERY 1
+#define CONN_SESSION_TYPE_NORMAL 2
+
+struct connection {
+ struct target *conn_target;
+ int conn_socket;
+ int conn_session_type;
+ uint32_t conn_cmdsn;
+ uint32_t conn_statsn;
+ size_t conn_max_data_segment_length;
+ size_t conn_max_burst_length;
+ size_t conn_max_outstanding_r2t;
+ int conn_header_digest;
+ int conn_data_digest;
+};
+
+struct conf *conf_new(void);
+struct conf *conf_new_from_file(const char *path);
+void conf_delete(struct conf *conf);
+void conf_verify(struct conf *conf);
+
+struct target *target_new(struct conf *conf);
+struct target *target_find(struct conf *conf, const char *nickname);
+void target_delete(struct target *ic);
+
+void print_periphs(int session_id);
+
+char *checked_strdup(const char *);
+bool valid_iscsi_name(const char *name);
+int parse_enable(const char *enable);
+
+#endif /* !ISCSICTL_H */
diff --git a/usr.bin/iscsictl/parse.y b/usr.bin/iscsictl/parse.y
new file mode 100644
index 0000000..84c05b8
--- /dev/null
+++ b/usr.bin/iscsictl/parse.y
@@ -0,0 +1,359 @@
+%{
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/queue.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxo/xo.h>
+
+#include "iscsictl.h"
+
+extern FILE *yyin;
+extern char *yytext;
+extern int lineno;
+
+static struct conf *conf;
+static struct target *target;
+
+extern void yyerror(const char *);
+extern int yylex(void);
+extern void yyrestart(FILE *);
+
+%}
+
+%token AUTH_METHOD ENABLE HEADER_DIGEST DATA_DIGEST TARGET_NAME TARGET_ADDRESS
+%token INITIATOR_NAME INITIATOR_ADDRESS INITIATOR_ALIAS USER SECRET
+%token MUTUAL_USER MUTUAL_SECRET SEMICOLON SESSION_TYPE PROTOCOL OFFLOAD
+%token IGNORED EQUALS OPENING_BRACKET CLOSING_BRACKET
+
+%union
+{
+ char *str;
+}
+
+%token <str> STR
+
+%%
+
+targets:
+ |
+ targets target
+ ;
+
+target: STR OPENING_BRACKET target_entries CLOSING_BRACKET
+ {
+ if (target_find(conf, $1) != NULL)
+ xo_errx(1, "duplicated target %s", $1);
+ target->t_nickname = $1;
+ target = target_new(conf);
+ }
+ ;
+
+target_entries:
+ |
+ target_entries target_entry
+ |
+ target_entries target_entry SEMICOLON
+ ;
+
+target_entry:
+ target_name
+ |
+ target_address
+ |
+ initiator_name
+ |
+ initiator_address
+ |
+ initiator_alias
+ |
+ user
+ |
+ secret
+ |
+ mutual_user
+ |
+ mutual_secret
+ |
+ auth_method
+ |
+ header_digest
+ |
+ data_digest
+ |
+ session_type
+ |
+ enable
+ |
+ offload
+ |
+ protocol
+ |
+ ignored
+ ;
+
+target_name: TARGET_NAME EQUALS STR
+ {
+ if (target->t_name != NULL)
+ xo_errx(1, "duplicated TargetName at line %d", lineno);
+ target->t_name = $3;
+ }
+ ;
+
+target_address: TARGET_ADDRESS EQUALS STR
+ {
+ if (target->t_address != NULL)
+ xo_errx(1, "duplicated TargetAddress at line %d", lineno);
+ target->t_address = $3;
+ }
+ ;
+
+initiator_name: INITIATOR_NAME EQUALS STR
+ {
+ if (target->t_initiator_name != NULL)
+ xo_errx(1, "duplicated InitiatorName at line %d", lineno);
+ target->t_initiator_name = $3;
+ }
+ ;
+
+initiator_address: INITIATOR_ADDRESS EQUALS STR
+ {
+ if (target->t_initiator_address != NULL)
+ xo_errx(1, "duplicated InitiatorAddress at line %d", lineno);
+ target->t_initiator_address = $3;
+ }
+ ;
+
+initiator_alias: INITIATOR_ALIAS EQUALS STR
+ {
+ if (target->t_initiator_alias != NULL)
+ xo_errx(1, "duplicated InitiatorAlias at line %d", lineno);
+ target->t_initiator_alias = $3;
+ }
+ ;
+
+user: USER EQUALS STR
+ {
+ if (target->t_user != NULL)
+ xo_errx(1, "duplicated chapIName at line %d", lineno);
+ target->t_user = $3;
+ }
+ ;
+
+secret: SECRET EQUALS STR
+ {
+ if (target->t_secret != NULL)
+ xo_errx(1, "duplicated chapSecret at line %d", lineno);
+ target->t_secret = $3;
+ }
+ ;
+
+mutual_user: MUTUAL_USER EQUALS STR
+ {
+ if (target->t_mutual_user != NULL)
+ xo_errx(1, "duplicated tgtChapName at line %d", lineno);
+ target->t_mutual_user = $3;
+ }
+ ;
+
+mutual_secret: MUTUAL_SECRET EQUALS STR
+ {
+ if (target->t_mutual_secret != NULL)
+ xo_errx(1, "duplicated tgtChapSecret at line %d", lineno);
+ target->t_mutual_secret = $3;
+ }
+ ;
+
+auth_method: AUTH_METHOD EQUALS STR
+ {
+ if (target->t_auth_method != AUTH_METHOD_UNSPECIFIED)
+ xo_errx(1, "duplicated AuthMethod at line %d", lineno);
+ if (strcasecmp($3, "none") == 0)
+ target->t_auth_method = AUTH_METHOD_NONE;
+ else if (strcasecmp($3, "chap") == 0)
+ target->t_auth_method = AUTH_METHOD_CHAP;
+ else
+ xo_errx(1, "invalid AuthMethod at line %d; "
+ "must be either \"none\" or \"CHAP\"", lineno);
+ }
+ ;
+
+header_digest: HEADER_DIGEST EQUALS STR
+ {
+ if (target->t_header_digest != DIGEST_UNSPECIFIED)
+ xo_errx(1, "duplicated HeaderDigest at line %d", lineno);
+ if (strcasecmp($3, "none") == 0)
+ target->t_header_digest = DIGEST_NONE;
+ else if (strcasecmp($3, "CRC32C") == 0)
+ target->t_header_digest = DIGEST_CRC32C;
+ else
+ xo_errx(1, "invalid HeaderDigest at line %d; "
+ "must be either \"none\" or \"CRC32C\"", lineno);
+ }
+ ;
+
+data_digest: DATA_DIGEST EQUALS STR
+ {
+ if (target->t_data_digest != DIGEST_UNSPECIFIED)
+ xo_errx(1, "duplicated DataDigest at line %d", lineno);
+ if (strcasecmp($3, "none") == 0)
+ target->t_data_digest = DIGEST_NONE;
+ else if (strcasecmp($3, "CRC32C") == 0)
+ target->t_data_digest = DIGEST_CRC32C;
+ else
+ xo_errx(1, "invalid DataDigest at line %d; "
+ "must be either \"none\" or \"CRC32C\"", lineno);
+ }
+ ;
+
+session_type: SESSION_TYPE EQUALS STR
+ {
+ if (target->t_session_type != SESSION_TYPE_UNSPECIFIED)
+ xo_errx(1, "duplicated SessionType at line %d", lineno);
+ if (strcasecmp($3, "normal") == 0)
+ target->t_session_type = SESSION_TYPE_NORMAL;
+ else if (strcasecmp($3, "discovery") == 0)
+ target->t_session_type = SESSION_TYPE_DISCOVERY;
+ else
+ xo_errx(1, "invalid SessionType at line %d; "
+ "must be either \"normal\" or \"discovery\"", lineno);
+ }
+ ;
+
+enable: ENABLE EQUALS STR
+ {
+ if (target->t_enable != ENABLE_UNSPECIFIED)
+ xo_errx(1, "duplicated enable at line %d", lineno);
+ target->t_enable = parse_enable($3);
+ if (target->t_enable == ENABLE_UNSPECIFIED)
+ xo_errx(1, "invalid enable at line %d; "
+ "must be either \"on\" or \"off\"", lineno);
+ }
+ ;
+
+offload: OFFLOAD EQUALS STR
+ {
+ if (target->t_offload != NULL)
+ xo_errx(1, "duplicated offload at line %d", lineno);
+ target->t_offload = $3;
+ }
+ ;
+
+protocol: PROTOCOL EQUALS STR
+ {
+ if (target->t_protocol != PROTOCOL_UNSPECIFIED)
+ xo_errx(1, "duplicated protocol at line %d", lineno);
+ if (strcasecmp($3, "iscsi") == 0)
+ target->t_protocol = PROTOCOL_ISCSI;
+ else if (strcasecmp($3, "iser") == 0)
+ target->t_protocol = PROTOCOL_ISER;
+ else
+ xo_errx(1, "invalid protocol at line %d; "
+ "must be either \"iscsi\" or \"iser\"", lineno);
+ }
+ ;
+
+ignored: IGNORED EQUALS STR
+ {
+ xo_warnx("obsolete statement ignored at line %d", lineno);
+ }
+ ;
+
+%%
+
+void
+yyerror(const char *str)
+{
+
+ xo_errx(1, "error in configuration file at line %d near '%s': %s",
+ lineno, yytext, str);
+}
+
+static void
+check_perms(const char *path)
+{
+ struct stat sb;
+ int error;
+
+ error = stat(path, &sb);
+ if (error != 0) {
+ xo_warn("stat");
+ return;
+ }
+ if (sb.st_mode & S_IWOTH) {
+ xo_warnx("%s is world-writable", path);
+ } else if (sb.st_mode & S_IROTH) {
+ xo_warnx("%s is world-readable", path);
+ } else if (sb.st_mode & S_IXOTH) {
+ /*
+ * Ok, this one doesn't matter, but still do it,
+ * just for consistency.
+ */
+ xo_warnx("%s is world-executable", path);
+ }
+
+ /*
+ * XXX: Should we also check for owner != 0?
+ */
+}
+
+struct conf *
+conf_new_from_file(const char *path)
+{
+ int error;
+
+ conf = conf_new();
+ target = target_new(conf);
+
+ yyin = fopen(path, "r");
+ if (yyin == NULL)
+ xo_err(1, "unable to open configuration file %s", path);
+ check_perms(path);
+ lineno = 1;
+ yyrestart(yyin);
+ error = yyparse();
+ assert(error == 0);
+ fclose(yyin);
+
+ assert(target->t_nickname == NULL);
+ target_delete(target);
+
+ conf_verify(conf);
+
+ return (conf);
+}
diff --git a/usr.bin/iscsictl/periphs.c b/usr.bin/iscsictl/periphs.c
new file mode 100644
index 0000000..0697860
--- /dev/null
+++ b/usr.bin/iscsictl/periphs.c
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 1997-2007 Kenneth D. Merry
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Edward Tomasz Napierala
+ * 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.
+ * 3. 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 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/ioctl.h>
+#include <sys/stdint.h>
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <sys/sbuf.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#include <cam/cam.h>
+#include <cam/cam_debug.h>
+#include <cam/cam_ccb.h>
+#include <cam/scsi/scsi_all.h>
+#include <cam/scsi/scsi_da.h>
+#include <cam/scsi/scsi_pass.h>
+#include <cam/scsi/scsi_message.h>
+#include <cam/scsi/smp_all.h>
+#include <cam/ata/ata_all.h>
+#include <camlib.h>
+#include <libxo/xo.h>
+
+#include "iscsictl.h"
+
+void
+print_periphs(int session_id)
+{
+ union ccb ccb;
+ int bufsize, fd;
+ unsigned int i;
+ int have_path_id, skip_bus, skip_device;
+ path_id_t path_id;
+
+ if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
+ xo_warn("couldn't open %s", XPT_DEVICE);
+ return;
+ }
+
+ /*
+ * First, iterate over the whole list to find the bus.
+ */
+
+ bzero(&ccb, sizeof(union ccb));
+
+ ccb.ccb_h.path_id = CAM_XPT_PATH_ID;
+ ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
+ ccb.ccb_h.target_lun = CAM_LUN_WILDCARD;
+
+ ccb.ccb_h.func_code = XPT_DEV_MATCH;
+ bufsize = sizeof(struct dev_match_result) * 100;
+ ccb.cdm.match_buf_len = bufsize;
+ ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
+ if (ccb.cdm.matches == NULL) {
+ xo_warnx("can't malloc memory for matches");
+ close(fd);
+ return;
+ }
+ ccb.cdm.num_matches = 0;
+
+ /*
+ * We fetch all nodes, since we display most of them in the default
+ * case, and all in the verbose case.
+ */
+ ccb.cdm.num_patterns = 0;
+ ccb.cdm.pattern_buf_len = 0;
+
+ path_id = -1; /* Make GCC happy. */
+ have_path_id = 0;
+ skip_bus = 1;
+ skip_device = 1;
+
+ xo_open_container("devices");
+ xo_open_list("lun");
+ /*
+ * We do the ioctl multiple times if necessary, in case there are
+ * more than 100 nodes in the EDT.
+ */
+ do {
+ if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
+ xo_warn("error sending CAMIOCOMMAND ioctl");
+ break;
+ }
+
+ if ((ccb.ccb_h.status != CAM_REQ_CMP)
+ || ((ccb.cdm.status != CAM_DEV_MATCH_LAST)
+ && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) {
+ xo_warnx("got CAM error %#x, CDM error %d\n",
+ ccb.ccb_h.status, ccb.cdm.status);
+ break;
+ }
+
+ for (i = 0; i < ccb.cdm.num_matches; i++) {
+ switch (ccb.cdm.matches[i].type) {
+ case DEV_MATCH_BUS: {
+ struct bus_match_result *bus_result;
+
+ bus_result = &ccb.cdm.matches[i].result.bus_result;
+
+ skip_bus = 1;
+
+ if (strcmp(bus_result->dev_name, "iscsi") != 0) {
+ //printf("not iscsi\n");
+ continue;
+ }
+
+ if ((int)bus_result->unit_number != session_id) {
+ //printf("wrong unit, %d != %d\n", bus_result->unit_number, session_id);
+ continue;
+ }
+ skip_bus = 0;
+ }
+ case DEV_MATCH_DEVICE: {
+ skip_device = 1;
+
+ if (skip_bus != 0)
+ continue;
+
+ skip_device = 0;
+ break;
+ }
+ case DEV_MATCH_PERIPH: {
+ struct periph_match_result *periph_result;
+
+ periph_result =
+ &ccb.cdm.matches[i].result.periph_result;
+
+ if (skip_device != 0)
+ continue;
+
+ if (strcmp(periph_result->periph_name, "pass") == 0)
+ continue;
+
+ xo_open_instance("lun");
+ xo_emit("{e:lun/%d}", periph_result->target_lun);
+ xo_emit("{Vq:device/%s%d} ",
+ periph_result->periph_name,
+ periph_result->unit_number);
+ xo_close_instance("lun");
+
+ if (have_path_id == 0) {
+ path_id = periph_result->path_id;
+ have_path_id = 1;
+ }
+
+ break;
+ }
+ default:
+ fprintf(stdout, "unknown match type\n");
+ break;
+ }
+ }
+
+ } while ((ccb.ccb_h.status == CAM_REQ_CMP)
+ && (ccb.cdm.status == CAM_DEV_MATCH_MORE));
+ xo_close_list("lun");
+
+ xo_emit("{e:scbus/%d}{e:bus/%d}{e:target/%d}",
+ have_path_id ? (int)path_id : -1, 0, have_path_id ? 0 : -1);
+ xo_close_container("devices");
+
+ close(fd);
+}
+
diff --git a/usr.bin/iscsictl/token.l b/usr.bin/iscsictl/token.l
new file mode 100644
index 0000000..c9e3e72
--- /dev/null
+++ b/usr.bin/iscsictl/token.l
@@ -0,0 +1,99 @@
+%{
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "iscsictl.h"
+#include "y.tab.h"
+
+int lineno;
+
+#define YY_DECL int yylex(void)
+extern int yylex(void);
+
+%}
+
+%option noinput
+%option nounput
+%option noyywrap
+
+%%
+HeaderDigest { return HEADER_DIGEST; }
+DataDigest { return DATA_DIGEST; }
+TargetName { return TARGET_NAME; }
+TargetAddress { return TARGET_ADDRESS; }
+InitiatorName { return INITIATOR_NAME; }
+InitiatorAddress { return INITIATOR_ADDRESS; }
+InitiatorAlias { return INITIATOR_ALIAS; }
+chapIName { return USER; }
+chapSecret { return SECRET; }
+tgtChapName { return MUTUAL_USER; }
+tgtChapSecret { return MUTUAL_SECRET; }
+AuthMethod { return AUTH_METHOD; }
+SessionType { return SESSION_TYPE; }
+enable { return ENABLE; }
+protocol { return PROTOCOL; }
+offload { return OFFLOAD; }
+port { return IGNORED; }
+MaxConnections { return IGNORED; }
+TargetAlias { return IGNORED; }
+TargetPortalGroupTag { return IGNORED; }
+InitialR2T { return IGNORED; }
+ImmediateData { return IGNORED; }
+MaxRecvDataSegmentLength { return IGNORED; }
+MaxBurstLength { return IGNORED; }
+FirstBurstLength { return IGNORED; }
+DefaultTime2Wait { return IGNORED; }
+DefaultTime2Retain { return IGNORED; }
+MaxOutstandingR2T { return IGNORED; }
+DataPDUInOrder { return IGNORED; }
+DataSequenceInOrder { return IGNORED; }
+ErrorRecoveryLevel { return IGNORED; }
+tags { return IGNORED; }
+maxluns { return IGNORED; }
+sockbufsize { return IGNORED; }
+chapDigest { return IGNORED; }
+\"[^"]+\" { yylval.str = strndup(yytext + 1,
+ strlen(yytext) - 2); return STR; }
+[a-zA-Z0-9\.\-_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; }
+\{ { return OPENING_BRACKET; }
+\} { return CLOSING_BRACKET; }
+= { return EQUALS; }
+; { return SEMICOLON; }
+#.*$ /* ignore comments */;
+\r\n { lineno++; }
+\n { lineno++; }
+[ \t]+ /* ignore whitespace */;
+. { yylval.str = strdup(yytext); return STR; }
+%%
diff --git a/usr.bin/join/Makefile b/usr.bin/join/Makefile
new file mode 100644
index 0000000..c3f40e4
--- /dev/null
+++ b/usr.bin/join/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+
+.include <src.opts.mk>
+
+PROG= join
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/join/Makefile.depend b/usr.bin/join/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/join/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/join/join.1 b/usr.bin/join/join.1
new file mode 100644
index 0000000..3b91390
--- /dev/null
+++ b/usr.bin/join/join.1
@@ -0,0 +1,223 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)join.1 8.3 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd July 5, 2004
+.Dt JOIN 1
+.Os
+.Sh NAME
+.Nm join
+.Nd relational database operator
+.Sh SYNOPSIS
+.Nm
+.Oo
+.Fl a Ar file_number | Fl v Ar file_number
+.Oc
+.Op Fl e Ar string
+.Op Fl o Ar list
+.Op Fl t Ar char
+.Op Fl 1 Ar field
+.Op Fl 2 Ar field
+.Ar file1
+.Ar file2
+.Sh DESCRIPTION
+The
+.Nm
+utility performs an
+.Dq equality join
+on the specified files
+and writes the result to the standard output.
+The
+.Dq join field
+is the field in each file by which the files are compared.
+The first field in each line is used by default.
+There is one line in the output for each pair of lines in
+.Ar file1
+and
+.Ar file2
+which have identical join fields.
+Each output line consists of the join field, the remaining fields from
+.Ar file1
+and then the remaining fields from
+.Ar file2 .
+.Pp
+The default field separators are tab and space characters.
+In this case, multiple tabs and spaces count as a single field separator,
+and leading tabs and spaces are ignored.
+The default output field separator is a single space character.
+.Pp
+Many of the options use file and field numbers.
+Both file numbers and field numbers are 1 based, i.e., the first file on
+the command line is file number 1 and the first field is field number 1.
+The following options are available:
+.Bl -tag -width indent
+.It Fl a Ar file_number
+In addition to the default output, produce a line for each unpairable
+line in file
+.Ar file_number .
+.It Fl e Ar string
+Replace empty output fields with
+.Ar string .
+.It Fl o Ar list
+The
+.Fl o
+option specifies the fields that will be output from each file for
+each line with matching join fields.
+Each element of
+.Ar list
+has either the form
+.Ar file_number . Ns Ar field ,
+where
+.Ar file_number
+is a file number and
+.Ar field
+is a field number, or the form
+.Ql 0
+.Pq zero ,
+representing the join field.
+The elements of list must be either comma
+.Pq Ql \&,
+or whitespace separated.
+(The latter requires quoting to protect it from the shell, or, a simpler
+approach is to use multiple
+.Fl o
+options.)
+.It Fl t Ar char
+Use character
+.Ar char
+as a field delimiter for both input and output.
+Every occurrence of
+.Ar char
+in a line is significant.
+.It Fl v Ar file_number
+Do not display the default output, but display a line for each unpairable
+line in file
+.Ar file_number .
+The options
+.Fl v Cm 1
+and
+.Fl v Cm 2
+may be specified at the same time.
+.It Fl 1 Ar field
+Join on the
+.Ar field Ns 'th
+field of
+.Ar file1 .
+.It Fl 2 Ar field
+Join on the
+.Ar field Ns 'th
+field of
+.Ar file2 .
+.El
+.Pp
+When the default field delimiter characters are used, the files to be joined
+should be ordered in the collating sequence of
+.Xr sort 1 ,
+using the
+.Fl b
+option, on the fields on which they are to be joined, otherwise
+.Nm
+may not report all field matches.
+When the field delimiter characters are specified by the
+.Fl t
+option, the collating sequence should be the same as
+.Xr sort 1
+without the
+.Fl b
+option.
+.Pp
+If one of the arguments
+.Ar file1
+or
+.Ar file2
+is
+.Sq Fl ,
+the standard input is used.
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+For compatibility with historic versions of
+.Nm ,
+the following options are available:
+.Bl -tag -width indent
+.It Fl a
+In addition to the default output, produce a line for each unpairable line
+in both
+.Ar file1
+and
+.Ar file2 .
+.It Fl j1 Ar field
+Join on the
+.Ar field Ns 'th
+field of
+.Ar file1 .
+.It Fl j2 Ar field
+Join on the
+.Ar field Ns 'th
+field of
+.Ar file2 .
+.It Fl j Ar field
+Join on the
+.Ar field Ns 'th
+field of both
+.Ar file1
+and
+.Ar file2 .
+.It Fl o Ar list ...
+Historical implementations of
+.Nm
+permitted multiple arguments to the
+.Fl o
+option.
+These arguments were of the form
+.Ar file_number . Ns Ar field_number
+as described
+for the current
+.Fl o
+option.
+This has obvious difficulties in the presence of files named
+.Pa 1.2 .
+.El
+.Pp
+These options are available only so historic shell scripts do not require
+modification and should not be used.
+.Sh SEE ALSO
+.Xr awk 1 ,
+.Xr comm 1 ,
+.Xr paste 1 ,
+.Xr sort 1 ,
+.Xr uniq 1
+.Sh STANDARDS
+The
+.Nm
+command conforms to
+.St -p1003.1-2001 .
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c
new file mode 100644
index 0000000..afa7cbc
--- /dev/null
+++ b/usr.bin/join/join.c
@@ -0,0 +1,665 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Steve Hayman of the Computer Science Department, Indiana University,
+ * Michiro Hikida and David Goodenough.
+ *
+ * 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) 1991, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)join.c 8.6 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+/*
+ * There's a structure per input file which encapsulates the state of the
+ * file. We repeatedly read lines from each file until we've read in all
+ * the consecutive lines from the file with a common join field. Then we
+ * compare the set of lines with an equivalent set from the other file.
+ */
+typedef struct {
+ char *line; /* line */
+ u_long linealloc; /* line allocated count */
+ char **fields; /* line field(s) */
+ u_long fieldcnt; /* line field(s) count */
+ u_long fieldalloc; /* line field(s) allocated count */
+} LINE;
+
+typedef struct {
+ FILE *fp; /* file descriptor */
+ u_long joinf; /* join field (-1, -2, -j) */
+ int unpair; /* output unpairable lines (-a) */
+ u_long number; /* 1 for file 1, 2 for file 2 */
+
+ LINE *set; /* set of lines with same field */
+ int pushbool; /* if pushback is set */
+ u_long pushback; /* line on the stack */
+ u_long setcnt; /* set count */
+ u_long setalloc; /* set allocated count */
+} INPUT;
+static INPUT input1 = { NULL, 0, 0, 1, NULL, 0, 0, 0, 0 },
+ input2 = { NULL, 0, 0, 2, NULL, 0, 0, 0, 0 };
+
+typedef struct {
+ u_long filenum; /* file number */
+ u_long fieldno; /* field number */
+} OLIST;
+static OLIST *olist; /* output field list */
+static u_long olistcnt; /* output field list count */
+static u_long olistalloc; /* output field allocated count */
+
+static int joinout = 1; /* show lines with matched join fields (-v) */
+static int needsep; /* need separator character */
+static int spans = 1; /* span multiple delimiters (-t) */
+static char *empty; /* empty field replacement string (-e) */
+static wchar_t default_tabchar[] = L" \t";
+static wchar_t *tabchar = default_tabchar; /* delimiter characters (-t) */
+
+static int cmp(LINE *, u_long, LINE *, u_long);
+static void fieldarg(char *);
+static void joinlines(INPUT *, INPUT *);
+static int mbscoll(const char *, const char *);
+static char *mbssep(char **, const wchar_t *);
+static void obsolete(char **);
+static void outfield(LINE *, u_long, int);
+static void outoneline(INPUT *, LINE *);
+static void outtwoline(INPUT *, LINE *, INPUT *, LINE *);
+static void slurp(INPUT *);
+static wchar_t *towcs(const char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ INPUT *F1, *F2;
+ int aflag, ch, cval, vflag;
+ char *end;
+
+ setlocale(LC_ALL, "");
+
+ F1 = &input1;
+ F2 = &input2;
+
+ aflag = vflag = 0;
+ obsolete(argv);
+ while ((ch = getopt(argc, argv, "\01a:e:j:1:2:o:t:v:")) != -1) {
+ switch (ch) {
+ case '\01': /* See comment in obsolete(). */
+ aflag = 1;
+ F1->unpair = F2->unpair = 1;
+ break;
+ case '1':
+ if ((F1->joinf = strtol(optarg, &end, 10)) < 1)
+ errx(1, "-1 option field number less than 1");
+ if (*end)
+ errx(1, "illegal field number -- %s", optarg);
+ --F1->joinf;
+ break;
+ case '2':
+ if ((F2->joinf = strtol(optarg, &end, 10)) < 1)
+ errx(1, "-2 option field number less than 1");
+ if (*end)
+ errx(1, "illegal field number -- %s", optarg);
+ --F2->joinf;
+ break;
+ case 'a':
+ aflag = 1;
+ switch(strtol(optarg, &end, 10)) {
+ case 1:
+ F1->unpair = 1;
+ break;
+ case 2:
+ F2->unpair = 1;
+ break;
+ default:
+ errx(1, "-a option file number not 1 or 2");
+ break;
+ }
+ if (*end)
+ errx(1, "illegal file number -- %s", optarg);
+ break;
+ case 'e':
+ empty = optarg;
+ break;
+ case 'j':
+ if ((F1->joinf = F2->joinf =
+ strtol(optarg, &end, 10)) < 1)
+ errx(1, "-j option field number less than 1");
+ if (*end)
+ errx(1, "illegal field number -- %s", optarg);
+ --F1->joinf;
+ --F2->joinf;
+ break;
+ case 'o':
+ fieldarg(optarg);
+ break;
+ case 't':
+ spans = 0;
+ if (mbrtowc(&tabchar[0], optarg, MB_LEN_MAX, NULL) !=
+ strlen(optarg))
+ errx(1, "illegal tab character specification");
+ tabchar[1] = L'\0';
+ break;
+ case 'v':
+ vflag = 1;
+ joinout = 0;
+ switch (strtol(optarg, &end, 10)) {
+ case 1:
+ F1->unpair = 1;
+ break;
+ case 2:
+ F2->unpair = 1;
+ break;
+ default:
+ errx(1, "-v option file number not 1 or 2");
+ break;
+ }
+ if (*end)
+ errx(1, "illegal file number -- %s", optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (aflag && vflag)
+ errx(1, "the -a and -v options are mutually exclusive");
+
+ if (argc != 2)
+ usage();
+
+ /* Open the files; "-" means stdin. */
+ if (!strcmp(*argv, "-"))
+ F1->fp = stdin;
+ else if ((F1->fp = fopen(*argv, "r")) == NULL)
+ err(1, "%s", *argv);
+ ++argv;
+ if (!strcmp(*argv, "-"))
+ F2->fp = stdin;
+ else if ((F2->fp = fopen(*argv, "r")) == NULL)
+ err(1, "%s", *argv);
+ if (F1->fp == stdin && F2->fp == stdin)
+ errx(1, "only one input file may be stdin");
+
+ slurp(F1);
+ slurp(F2);
+ while (F1->setcnt && F2->setcnt) {
+ cval = cmp(F1->set, F1->joinf, F2->set, F2->joinf);
+ if (cval == 0) {
+ /* Oh joy, oh rapture, oh beauty divine! */
+ if (joinout)
+ joinlines(F1, F2);
+ slurp(F1);
+ slurp(F2);
+ } else if (cval < 0) {
+ /* File 1 takes the lead... */
+ if (F1->unpair)
+ joinlines(F1, NULL);
+ slurp(F1);
+ } else {
+ /* File 2 takes the lead... */
+ if (F2->unpair)
+ joinlines(F2, NULL);
+ slurp(F2);
+ }
+ }
+
+ /*
+ * Now that one of the files is used up, optionally output any
+ * remaining lines from the other file.
+ */
+ if (F1->unpair)
+ while (F1->setcnt) {
+ joinlines(F1, NULL);
+ slurp(F1);
+ }
+ if (F2->unpair)
+ while (F2->setcnt) {
+ joinlines(F2, NULL);
+ slurp(F2);
+ }
+ exit(0);
+}
+
+static void
+slurp(INPUT *F)
+{
+ LINE *lp, *lastlp, tmp;
+ size_t len;
+ int cnt;
+ char *bp, *fieldp;
+
+ /*
+ * Read all of the lines from an input file that have the same
+ * join field.
+ */
+ F->setcnt = 0;
+ for (lastlp = NULL;; ++F->setcnt) {
+ /*
+ * If we're out of space to hold line structures, allocate
+ * more. Initialize the structure so that we know that this
+ * is new space.
+ */
+ if (F->setcnt == F->setalloc) {
+ cnt = F->setalloc;
+ F->setalloc += 50;
+ if ((F->set = realloc(F->set,
+ F->setalloc * sizeof(LINE))) == NULL)
+ err(1, NULL);
+ memset(F->set + cnt, 0, 50 * sizeof(LINE));
+
+ /* re-set lastlp in case it moved */
+ if (lastlp != NULL)
+ lastlp = &F->set[F->setcnt - 1];
+ }
+
+ /*
+ * Get any pushed back line, else get the next line. Allocate
+ * space as necessary. If taking the line from the stack swap
+ * the two structures so that we don't lose space allocated to
+ * either structure. This could be avoided by doing another
+ * level of indirection, but it's probably okay as is.
+ */
+ lp = &F->set[F->setcnt];
+ if (F->setcnt)
+ lastlp = &F->set[F->setcnt - 1];
+ if (F->pushbool) {
+ tmp = F->set[F->setcnt];
+ F->set[F->setcnt] = F->set[F->pushback];
+ F->set[F->pushback] = tmp;
+ F->pushbool = 0;
+ continue;
+ }
+ if ((bp = fgetln(F->fp, &len)) == NULL)
+ return;
+ if (lp->linealloc <= len + 1) {
+ lp->linealloc += MAX(100, len + 1 - lp->linealloc);
+ if ((lp->line =
+ realloc(lp->line, lp->linealloc)) == NULL)
+ err(1, NULL);
+ }
+ memmove(lp->line, bp, len);
+
+ /* Replace trailing newline, if it exists. */
+ if (bp[len - 1] == '\n')
+ lp->line[len - 1] = '\0';
+ else
+ lp->line[len] = '\0';
+ bp = lp->line;
+
+ /* Split the line into fields, allocate space as necessary. */
+ lp->fieldcnt = 0;
+ while ((fieldp = mbssep(&bp, tabchar)) != NULL) {
+ if (spans && *fieldp == '\0')
+ continue;
+ if (lp->fieldcnt == lp->fieldalloc) {
+ lp->fieldalloc += 50;
+ if ((lp->fields = realloc(lp->fields,
+ lp->fieldalloc * sizeof(char *))) == NULL)
+ err(1, NULL);
+ }
+ lp->fields[lp->fieldcnt++] = fieldp;
+ }
+
+ /* See if the join field value has changed. */
+ if (lastlp != NULL && cmp(lp, F->joinf, lastlp, F->joinf)) {
+ F->pushbool = 1;
+ F->pushback = F->setcnt;
+ break;
+ }
+ }
+}
+
+static char *
+mbssep(char **stringp, const wchar_t *delim)
+{
+ char *s, *tok;
+ const wchar_t *spanp;
+ wchar_t c, sc;
+ size_t n;
+
+ if ((s = *stringp) == NULL)
+ return (NULL);
+ for (tok = s;;) {
+ n = mbrtowc(&c, s, MB_LEN_MAX, NULL);
+ if (n == (size_t)-1 || n == (size_t)-2)
+ errc(1, EILSEQ, NULL); /* XXX */
+ s += n;
+ spanp = delim;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else
+ s[-n] = '\0';
+ *stringp = s;
+ return (tok);
+ }
+ } while (sc != 0);
+ }
+}
+
+static int
+cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2)
+{
+ if (lp1->fieldcnt <= fieldno1)
+ return (lp2->fieldcnt <= fieldno2 ? 0 : 1);
+ if (lp2->fieldcnt <= fieldno2)
+ return (-1);
+ return (mbscoll(lp1->fields[fieldno1], lp2->fields[fieldno2]));
+}
+
+static int
+mbscoll(const char *s1, const char *s2)
+{
+ wchar_t *w1, *w2;
+ int ret;
+
+ if (MB_CUR_MAX == 1)
+ return (strcoll(s1, s2));
+ if ((w1 = towcs(s1)) == NULL || (w2 = towcs(s2)) == NULL)
+ err(1, NULL); /* XXX */
+ ret = wcscoll(w1, w2);
+ free(w1);
+ free(w2);
+ return (ret);
+}
+
+static wchar_t *
+towcs(const char *s)
+{
+ wchar_t *wcs;
+ size_t n;
+
+ if ((n = mbsrtowcs(NULL, &s, 0, NULL)) == (size_t)-1)
+ return (NULL);
+ if ((wcs = malloc((n + 1) * sizeof(*wcs))) == NULL)
+ return (NULL);
+ mbsrtowcs(wcs, &s, n + 1, NULL);
+ return (wcs);
+}
+
+static void
+joinlines(INPUT *F1, INPUT *F2)
+{
+ u_long cnt1, cnt2;
+
+ /*
+ * Output the results of a join comparison. The output may be from
+ * either file 1 or file 2 (in which case the first argument is the
+ * file from which to output) or from both.
+ */
+ if (F2 == NULL) {
+ for (cnt1 = 0; cnt1 < F1->setcnt; ++cnt1)
+ outoneline(F1, &F1->set[cnt1]);
+ return;
+ }
+ for (cnt1 = 0; cnt1 < F1->setcnt; ++cnt1)
+ for (cnt2 = 0; cnt2 < F2->setcnt; ++cnt2)
+ outtwoline(F1, &F1->set[cnt1], F2, &F2->set[cnt2]);
+}
+
+static void
+outoneline(INPUT *F, LINE *lp)
+{
+ u_long cnt;
+
+ /*
+ * Output a single line from one of the files, according to the
+ * join rules. This happens when we are writing unmatched single
+ * lines. Output empty fields in the right places.
+ */
+ if (olist)
+ for (cnt = 0; cnt < olistcnt; ++cnt) {
+ if (olist[cnt].filenum == (unsigned)F->number)
+ outfield(lp, olist[cnt].fieldno, 0);
+ else if (olist[cnt].filenum == 0)
+ outfield(lp, F->joinf, 0);
+ else
+ outfield(lp, 0, 1);
+ }
+ else
+ for (cnt = 0; cnt < lp->fieldcnt; ++cnt)
+ outfield(lp, cnt, 0);
+ (void)printf("\n");
+ if (ferror(stdout))
+ err(1, "stdout");
+ needsep = 0;
+}
+
+static void
+outtwoline(INPUT *F1, LINE *lp1, INPUT *F2, LINE *lp2)
+{
+ u_long cnt;
+
+ /* Output a pair of lines according to the join list (if any). */
+ if (olist)
+ for (cnt = 0; cnt < olistcnt; ++cnt)
+ if (olist[cnt].filenum == 0) {
+ if (lp1->fieldcnt >= F1->joinf)
+ outfield(lp1, F1->joinf, 0);
+ else
+ outfield(lp2, F2->joinf, 0);
+ } else if (olist[cnt].filenum == 1)
+ outfield(lp1, olist[cnt].fieldno, 0);
+ else /* if (olist[cnt].filenum == 2) */
+ outfield(lp2, olist[cnt].fieldno, 0);
+ else {
+ /*
+ * Output the join field, then the remaining fields from F1
+ * and F2.
+ */
+ outfield(lp1, F1->joinf, 0);
+ for (cnt = 0; cnt < lp1->fieldcnt; ++cnt)
+ if (F1->joinf != cnt)
+ outfield(lp1, cnt, 0);
+ for (cnt = 0; cnt < lp2->fieldcnt; ++cnt)
+ if (F2->joinf != cnt)
+ outfield(lp2, cnt, 0);
+ }
+ (void)printf("\n");
+ if (ferror(stdout))
+ err(1, "stdout");
+ needsep = 0;
+}
+
+static void
+outfield(LINE *lp, u_long fieldno, int out_empty)
+{
+ if (needsep++)
+ (void)printf("%lc", (wint_t)*tabchar);
+ if (!ferror(stdout)) {
+ if (lp->fieldcnt <= fieldno || out_empty) {
+ if (empty != NULL)
+ (void)printf("%s", empty);
+ } else {
+ if (*lp->fields[fieldno] == '\0')
+ return;
+ (void)printf("%s", lp->fields[fieldno]);
+ }
+ }
+ if (ferror(stdout))
+ err(1, "stdout");
+}
+
+/*
+ * Convert an output list argument "2.1, 1.3, 2.4" into an array of output
+ * fields.
+ */
+static void
+fieldarg(char *option)
+{
+ u_long fieldno, filenum;
+ char *end, *token;
+
+ while ((token = strsep(&option, ", \t")) != NULL) {
+ if (*token == '\0')
+ continue;
+ if (token[0] == '0')
+ filenum = fieldno = 0;
+ else if ((token[0] == '1' || token[0] == '2') &&
+ token[1] == '.') {
+ filenum = token[0] - '0';
+ fieldno = strtol(token + 2, &end, 10);
+ if (*end)
+ errx(1, "malformed -o option field");
+ if (fieldno == 0)
+ errx(1, "field numbers are 1 based");
+ --fieldno;
+ } else
+ errx(1, "malformed -o option field");
+ if (olistcnt == olistalloc) {
+ olistalloc += 50;
+ if ((olist = realloc(olist,
+ olistalloc * sizeof(OLIST))) == NULL)
+ err(1, NULL);
+ }
+ olist[olistcnt].filenum = filenum;
+ olist[olistcnt].fieldno = fieldno;
+ ++olistcnt;
+ }
+}
+
+static void
+obsolete(char **argv)
+{
+ size_t len;
+ char **p, *ap, *t;
+
+ while ((ap = *++argv) != NULL) {
+ /* Return if "--". */
+ if (ap[0] == '-' && ap[1] == '-')
+ return;
+ /* skip if not an option */
+ if (ap[0] != '-')
+ continue;
+ switch (ap[1]) {
+ case 'a':
+ /*
+ * The original join allowed "-a", which meant the
+ * same as -a1 plus -a2. POSIX 1003.2, Draft 11.2
+ * only specifies this as "-a 1" and "a -2", so we
+ * have to use another option flag, one that is
+ * unlikely to ever be used or accidentally entered
+ * on the command line. (Well, we could reallocate
+ * the argv array, but that hardly seems worthwhile.)
+ */
+ if (ap[2] == '\0' && (argv[1] == NULL ||
+ (strcmp(argv[1], "1") != 0 &&
+ strcmp(argv[1], "2") != 0))) {
+ ap[1] = '\01';
+ warnx("-a option used without an argument; "
+ "reverting to historical behavior");
+ }
+ break;
+ case 'j':
+ /*
+ * The original join allowed "-j[12] arg" and "-j arg".
+ * Convert the former to "-[12] arg". Don't convert
+ * the latter since getopt(3) can handle it.
+ */
+ switch(ap[2]) {
+ case '1':
+ if (ap[3] != '\0')
+ goto jbad;
+ ap[1] = '1';
+ ap[2] = '\0';
+ break;
+ case '2':
+ if (ap[3] != '\0')
+ goto jbad;
+ ap[1] = '2';
+ ap[2] = '\0';
+ break;
+ case '\0':
+ break;
+ default:
+jbad: errx(1, "illegal option -- %s", ap);
+ usage();
+ }
+ break;
+ case 'o':
+ /*
+ * The original join allowed "-o arg arg".
+ * Convert to "-o arg -o arg".
+ */
+ if (ap[2] != '\0')
+ break;
+ for (p = argv + 2; *p; ++p) {
+ if (p[0][0] == '0' || ((p[0][0] != '1' &&
+ p[0][0] != '2') || p[0][1] != '.'))
+ break;
+ len = strlen(*p);
+ if (len - 2 != strspn(*p + 2, "0123456789"))
+ break;
+ if ((t = malloc(len + 3)) == NULL)
+ err(1, NULL);
+ t[0] = '-';
+ t[1] = 'o';
+ memmove(t + 2, *p, len + 1);
+ *p = t;
+ }
+ argv = p - 1;
+ break;
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s %s\n%s\n",
+ "usage: join [-a fileno | -v fileno ] [-e string] [-1 field]",
+ "[-2 field]",
+ " [-o list] [-t char] file1 file2");
+ exit(1);
+}
diff --git a/usr.bin/join/tests/Makefile b/usr.bin/join/tests/Makefile
new file mode 100644
index 0000000..46c83e3
--- /dev/null
+++ b/usr.bin/join/tests/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.1.in
+${PACKAGE}FILES+= regress.2.in
+${PACKAGE}FILES+= regress.out
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/join/tests/Makefile.depend b/usr.bin/join/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/join/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/join/tests/legacy_test.sh b/usr.bin/join/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/join/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/join/tests/regress.1.in b/usr.bin/join/tests/regress.1.in
new file mode 100644
index 0000000..975bbaf
--- /dev/null
+++ b/usr.bin/join/tests/regress.1.in
@@ -0,0 +1,4 @@
+!Name,Data1
+Foo,1
+Bar,2
+Baz,3
diff --git a/usr.bin/join/tests/regress.2.in b/usr.bin/join/tests/regress.2.in
new file mode 100644
index 0000000..0206b49
--- /dev/null
+++ b/usr.bin/join/tests/regress.2.in
@@ -0,0 +1,4 @@
+!Name,Data2
+Foo,Bar
+Baz,2
+Foobar,1
diff --git a/usr.bin/join/tests/regress.out b/usr.bin/join/tests/regress.out
new file mode 100644
index 0000000..fa75c88
--- /dev/null
+++ b/usr.bin/join/tests/regress.out
@@ -0,0 +1,5 @@
+!Name,Data1,Data2
+Foo,1,Bar
+Bar,2,(unknown)
+Baz,3,2
+Foobar,(unknown),1
diff --git a/usr.bin/join/tests/regress.sh b/usr.bin/join/tests/regress.sh
new file mode 100644
index 0000000..e07e554
--- /dev/null
+++ b/usr.bin/join/tests/regress.sh
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+echo 1..1
+
+REGRESSION_START($1)
+
+REGRESSION_TEST_ONE(`join -t , -a1 -a2 -e "(unknown)" -o 0,1.2,2.2 ${SRCDIR}/regress.1.in ${SRCDIR}/regress.2.in')
+
+REGRESSION_END()
diff --git a/usr.bin/jot/Makefile b/usr.bin/jot/Makefile
new file mode 100644
index 0000000..206c893
--- /dev/null
+++ b/usr.bin/jot/Makefile
@@ -0,0 +1,12 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= jot
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/jot/Makefile.depend b/usr.bin/jot/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/jot/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/jot/jot.1 b/usr.bin/jot/jot.1
new file mode 100644
index 0000000..8b93837
--- /dev/null
+++ b/usr.bin/jot/jot.1
@@ -0,0 +1,328 @@
+.\" Copyright (c) 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.
+.\"
+.\" @(#)jot.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 7, 2015
+.Dt JOT 1
+.Os
+.Sh NAME
+.Nm jot
+.Nd print sequential or random data
+.Sh SYNOPSIS
+.Nm
+.Op Fl cnr
+.Op Fl b Ar word
+.Op Fl w Ar word
+.Op Fl s Ar string
+.Op Fl p Ar precision
+.Op Ar reps Op Ar begin Op Ar end Op Ar s
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to print out increasing, decreasing, random,
+or redundant data, usually numbers, one per line.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl r
+Generate random data instead of the default sequential data.
+.It Fl b Ar word
+Just print
+.Ar word
+repetitively.
+.It Fl w Ar word
+Print
+.Ar word
+with the generated data appended to it.
+Octal, hexadecimal, exponential,
+.Tn ASCII ,
+zero padded,
+and right-adjusted representations
+are possible by using the appropriate
+.Xr printf 3
+conversion specification inside
+.Ar word ,
+in which case the data are inserted rather than appended.
+.It Fl c
+This is an abbreviation for
+.Fl w Ar %c .
+.It Fl s Ar string
+Print data separated by
+.Ar string .
+Normally, newlines separate data.
+.It Fl n
+Do not print the final newline normally appended to the output.
+.It Fl p Ar precision
+Print only as many digits or characters of the data
+as indicated by the integer
+.Ar precision .
+In the absence of
+.Fl p ,
+the precision is the greater of the precisions of
+.Ar begin
+and
+.Ar end .
+The
+.Fl p
+option is overridden by whatever appears in a
+.Xr printf 3
+conversion following
+.Fl w .
+.El
+.Pp
+The last four arguments indicate, respectively,
+the number of data, the lower bound, the upper bound,
+and the step size or, for random data, the seed.
+While at least one of them must appear,
+any of the other three may be omitted, and
+will be considered as such if given as
+.Fl ""
+or as an empty string.
+Any three of these arguments determines the fourth.
+If four are specified and the given and computed values of
+.Ar reps
+conflict, the lower value is used.
+If fewer than three are specified, defaults are assigned
+left to right, except for
+.Ar s ,
+which assumes a default of 1 or -1 if both
+.Ar begin
+and
+.Ar end
+are given.
+.Pp
+Defaults for the four arguments are, respectively,
+100, 1, 100, and 1, except that when random data are requested,
+the seed,
+.Ar s ,
+is picked randomly.
+The
+.Ar reps
+argument is expected to be an unsigned integer,
+and if given as zero is taken to be infinite.
+The
+.Ar begin
+and
+.Ar end
+arguments may be given as real numbers or as characters
+representing the corresponding value in
+.Tn ASCII .
+The last argument must be a real number.
+.Pp
+Random numbers are obtained through
+.Xr arc4random 3
+when no seed is specified,
+and through
+.Xr random 3
+when a seed is given.
+When
+.Nm
+is asked to generate random integers or characters with begin
+and end values in the range of the random number generator function
+and no format is specified with one of the
+.Fl w ,
+.Fl b ,
+or
+.Fl p
+options,
+.Nm
+will arrange for all the values in the range to appear in the output
+with an equal probability.
+In all other cases be careful to ensure that the output format's
+rounding or truncation will not skew the distribution of output
+values in an unintended way.
+.Pp
+The name
+.Nm
+derives in part from
+.Nm iota ,
+a function in APL.
+.Ss Rounding and truncation
+The
+.Nm
+utility uses double precision floating point arithmetic internally.
+Before printing a number, it is converted depending on the output
+format used.
+.Pp
+If no output format is specified or the output format is a
+floating point format
+.Po
+.Sq E ,
+.Sq G ,
+.Sq e ,
+.Sq f ,
+or
+.Sq g
+.Pc ,
+the value is rounded using the
+.Xr printf 3
+function, taking into account the requested precision.
+.Pp
+If the output format is an integer format
+.Po
+.Sq D ,
+.Sq O ,
+.Sq U ,
+.Sq X ,
+.Sq c ,
+.Sq d ,
+.Sq i ,
+.Sq o ,
+.Sq u ,
+or
+.Sq x
+.Pc ,
+the value is converted to an integer value by truncation.
+.Pp
+As an illustration, consider the following command:
+.Bd -literal -offset indent
+$ jot 6 1 10 0.5
+1
+2
+2
+2
+3
+4
+.Ed
+.Pp
+By requesting an explicit precision of 1, the values generated before rounding
+can be seen.
+The .5 values are rounded down if the integer part is even,
+up otherwise.
+.Bd -literal -offset indent
+$ jot -p 1 6 1 10 0.5
+1.0
+1.5
+2.0
+2.5
+3.0
+3.5
+.Ed
+.Pp
+By offsetting the values slightly, the values generated by the following
+command are always rounded down:
+.Bd -literal -offset indent
+$ jot -p 0 6 .9999999999 10 0.5
+1
+1
+2
+2
+3
+3
+.Ed
+.Pp
+Another way of achieving the same result is to force truncation by
+specifying an integer format:
+.Bd -literal -offset indent
+$ jot -w %d 6 1 10 0.5
+.Ed
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The command
+.Dl jot - 1 10
+.Pp
+prints the integers from 1 to 10,
+while the command
+.Dl jot 21 -1 1.00
+.Pp
+prints 21 evenly spaced numbers increasing from -1 to 1.
+The
+.Tn ASCII
+character set is generated with
+.Dl jot -c 128 0
+.Pp
+and the strings xaa through xaz with
+.Dl jot -w xa%c 26 a
+.Pp
+while 20 random 8-letter strings are produced with
+.Dl "jot -r -c 160 a z | rs -g 0 8"
+.Pp
+Infinitely many
+.Em yes Ns 's
+may be obtained through
+.Dl jot -b yes 0
+.Pp
+and thirty
+.Xr ed 1
+substitution commands applying to lines 2, 7, 12, etc.\& is
+the result of
+.Dl jot -w %ds/old/new/ 30 2 - 5
+.Pp
+The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be
+produced by truncating the output precision and a suitable choice of step size,
+as in
+.Dl jot -w %d - 9.5 0 -.5
+.Pp
+and a file containing exactly 1024 bytes is created with
+.Dl jot -b x 512 > block
+.Pp
+Finally, to set tabs four spaces apart starting
+from column 10 and ending in column 132, use
+.Dl expand -`jot -s, - 10 132 4`
+.Pp
+and to print all lines 80 characters or longer,
+.Dl grep `jot -s \&"\&" -b \&. 80`
+.Sh DIAGNOSTICS
+The following diagnostic messages deserve special explanation:
+.Bl -diag
+.It "illegal or unsupported format '%s'"
+The requested conversion format specifier for
+.Xr printf 3
+was not of the form
+.Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]?
+where
+.Dq ?\&
+must be one of
+.Dl [l]{d,i,o,u,x}
+or
+.Dl {c,e,f,g,D,E,G,O,U,X}
+.It "range error in conversion"
+A value to be printed fell outside the range of the data type
+associated with the requested output format.
+.It "too many conversions"
+More than one conversion format specifier has been supplied,
+but only one is allowed.
+.El
+.Sh SEE ALSO
+.Xr ed 1 ,
+.Xr expand 1 ,
+.Xr rs 1 ,
+.Xr seq 1 ,
+.Xr yes 1 ,
+.Xr arc4random 3 ,
+.Xr printf 3 ,
+.Xr random 3
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.2 .
+.Sh AUTHORS
+.An John A. Kunze
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c
new file mode 100644
index 0000000..779a4b9
--- /dev/null
+++ b/usr.bin/jot/jot.c
@@ -0,0 +1,493 @@
+/*-
+ * Copyright (c) 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) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * jot - print sequential or random data
+ *
+ * Author: John Kunze, Office of Comp. Affairs, UCB
+ */
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+/* Defaults */
+#define REPS_DEF 100
+#define BEGIN_DEF 1
+#define ENDER_DEF 100
+#define STEP_DEF 1
+
+/* Flags of options that have been set */
+#define HAVE_STEP 1
+#define HAVE_ENDER 2
+#define HAVE_BEGIN 4
+#define HAVE_REPS 8
+
+#define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0)
+
+static bool boring;
+static int prec = -1;
+static bool longdata;
+static bool intdata;
+static bool chardata;
+static bool nosign;
+static const char *sepstring = "\n";
+static char format[BUFSIZ];
+
+static void getformat(void);
+static int getprec(const char *);
+static int putdata(double, bool);
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ bool have_format = false;
+ bool infinity = false;
+ bool nofinalnl = false;
+ bool randomize = false;
+ bool use_random = false;
+ int ch;
+ int mask = 0;
+ int n = 0;
+ double begin = BEGIN_DEF;
+ double divisor;
+ double ender = ENDER_DEF;
+ double s = STEP_DEF;
+ double x, y;
+ long i;
+ long reps = REPS_DEF;
+
+ while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1)
+ switch (ch) {
+ case 'b':
+ boring = true;
+ /* FALLTHROUGH */
+ case 'w':
+ if (strlcpy(format, optarg, sizeof(format)) >=
+ sizeof(format))
+ errx(1, "-%c word too long", ch);
+ have_format = true;
+ break;
+ case 'c':
+ chardata = true;
+ break;
+ case 'n':
+ nofinalnl = true;
+ break;
+ case 'p':
+ prec = atoi(optarg);
+ if (prec < 0)
+ errx(1, "bad precision value");
+ have_format = true;
+ break;
+ case 'r':
+ randomize = true;
+ break;
+ case 's':
+ sepstring = optarg;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) { /* examine args right to left, falling thru cases */
+ case 4:
+ if (!is_default(argv[3])) {
+ if (!sscanf(argv[3], "%lf", &s))
+ errx(1, "bad s value: %s", argv[3]);
+ mask |= HAVE_STEP;
+ if (randomize)
+ use_random = true;
+ }
+ /* FALLTHROUGH */
+ case 3:
+ if (!is_default(argv[2])) {
+ if (!sscanf(argv[2], "%lf", &ender))
+ ender = argv[2][strlen(argv[2])-1];
+ mask |= HAVE_ENDER;
+ if (prec < 0)
+ n = getprec(argv[2]);
+ }
+ /* FALLTHROUGH */
+ case 2:
+ if (!is_default(argv[1])) {
+ if (!sscanf(argv[1], "%lf", &begin))
+ begin = argv[1][strlen(argv[1])-1];
+ mask |= HAVE_BEGIN;
+ if (prec < 0)
+ prec = getprec(argv[1]);
+ if (n > prec) /* maximum precision */
+ prec = n;
+ }
+ /* FALLTHROUGH */
+ case 1:
+ if (!is_default(argv[0])) {
+ if (!sscanf(argv[0], "%ld", &reps))
+ errx(1, "bad reps value: %s", argv[0]);
+ mask |= HAVE_REPS;
+ }
+ break;
+ case 0:
+ usage();
+ default:
+ errx(1, "too many arguments. What do you mean by %s?",
+ argv[4]);
+ }
+ getformat();
+
+ if (prec == -1)
+ prec = 0;
+
+ while (mask) /* 4 bit mask has 1's where last 4 args were given */
+ switch (mask) { /* fill in the 0's by default or computation */
+ case HAVE_STEP:
+ case HAVE_ENDER:
+ case HAVE_ENDER | HAVE_STEP:
+ case HAVE_BEGIN:
+ case HAVE_BEGIN | HAVE_STEP:
+ reps = REPS_DEF;
+ mask |= HAVE_REPS;
+ break;
+ case HAVE_BEGIN | HAVE_ENDER:
+ s = ender > begin ? 1 : -1;
+ mask |= HAVE_STEP;
+ break;
+ case HAVE_BEGIN | HAVE_ENDER | HAVE_STEP:
+ if (randomize)
+ reps = REPS_DEF;
+ else if (s == 0.0)
+ reps = 0;
+ else
+ reps = (ender - begin + s) / s;
+ if (reps <= 0)
+ errx(1, "impossible stepsize");
+ mask = 0;
+ break;
+ case HAVE_REPS:
+ case HAVE_REPS | HAVE_STEP:
+ begin = BEGIN_DEF;
+ mask |= HAVE_BEGIN;
+ break;
+ case HAVE_REPS | HAVE_ENDER:
+ s = STEP_DEF;
+ mask = HAVE_REPS | HAVE_ENDER | HAVE_STEP;
+ break;
+ case HAVE_REPS | HAVE_ENDER | HAVE_STEP:
+ if (randomize)
+ begin = BEGIN_DEF;
+ else if (reps == 0)
+ errx(1, "must specify begin if reps == 0");
+ begin = ender - reps * s + s;
+ mask = 0;
+ break;
+ case HAVE_REPS | HAVE_BEGIN:
+ s = STEP_DEF;
+ mask = HAVE_REPS | HAVE_BEGIN | HAVE_STEP;
+ break;
+ case HAVE_REPS | HAVE_BEGIN | HAVE_STEP:
+ if (randomize)
+ ender = ENDER_DEF;
+ else
+ ender = begin + reps * s - s;
+ mask = 0;
+ break;
+ case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER:
+ if (reps == 0)
+ errx(1, "infinite sequences cannot be bounded");
+ else if (reps == 1)
+ s = 0.0;
+ else
+ s = (ender - begin) / (reps - 1);
+ mask = 0;
+ break;
+ case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER | HAVE_STEP:
+ /* if reps given and implied, */
+ if (!randomize && s != 0.0) {
+ long t = (ender - begin + s) / s;
+ if (t <= 0)
+ errx(1, "impossible stepsize");
+ if (t < reps) /* take lesser */
+ reps = t;
+ }
+ mask = 0;
+ break;
+ default:
+ errx(1, "bad mask");
+ }
+ if (reps == 0)
+ infinity = true;
+ if (randomize) {
+ if (use_random) {
+ srandom((unsigned long)s);
+ divisor = (double)INT32_MAX + 1;
+ } else
+ divisor = (double)UINT32_MAX + 1;
+
+ /*
+ * Attempt to DWIM when the user has specified an
+ * integer range within that of the random number
+ * generator: distribute the numbers equally in
+ * the range [begin .. ender]. Jot's default %.0f
+ * format would make the appearance of the first and
+ * last specified value half as likely as the rest.
+ */
+ if (!have_format && prec == 0 &&
+ begin >= 0 && begin < divisor &&
+ ender >= 0 && ender < divisor) {
+ if (begin <= ender)
+ ender += 1;
+ else
+ begin += 1;
+ nosign = true;
+ intdata = true;
+ (void)strlcpy(format,
+ chardata ? "%c" : "%u", sizeof(format));
+ }
+ x = ender - begin;
+ for (i = 1; i <= reps || infinity; i++) {
+ if (use_random)
+ y = random() / divisor;
+ else
+ y = arc4random() / divisor;
+ if (putdata(y * x + begin, !(reps - i)))
+ errx(1, "range error in conversion");
+ }
+ } else
+ for (i = 1, x = begin; i <= reps || infinity; i++, x += s)
+ if (putdata(x, !(reps - i)))
+ errx(1, "range error in conversion");
+ if (!nofinalnl)
+ putchar('\n');
+ exit(0);
+}
+
+/*
+ * Send x to stdout using the specified format.
+ * Last is true if this is the set's last value.
+ * Return 0 if OK, or a positive number if the number passed was
+ * outside the range specified by the various flags.
+ */
+static int
+putdata(double x, bool last)
+{
+
+ if (boring)
+ printf("%s", format);
+ else if (longdata && nosign) {
+ if (x <= (double)ULONG_MAX && x >= (double)0)
+ printf(format, (unsigned long)x);
+ else
+ return (1);
+ } else if (longdata) {
+ if (x <= (double)LONG_MAX && x >= (double)LONG_MIN)
+ printf(format, (long)x);
+ else
+ return (1);
+ } else if (chardata || (intdata && !nosign)) {
+ if (x <= (double)INT_MAX && x >= (double)INT_MIN)
+ printf(format, (int)x);
+ else
+ return (1);
+ } else if (intdata) {
+ if (x <= (double)UINT_MAX && x >= (double)0)
+ printf(format, (unsigned int)x);
+ else
+ return (1);
+
+ } else
+ printf(format, x);
+ if (!last)
+ fputs(sepstring, stdout);
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+ "usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]",
+ " [reps [begin [end [s]]]]");
+ exit(1);
+}
+
+/*
+ * Return the number of digits following the number's decimal point.
+ * Return 0 if no decimal point is found.
+ */
+static int
+getprec(const char *str)
+{
+ const char *p;
+ const char *q;
+
+ for (p = str; *p; p++)
+ if (*p == '.')
+ break;
+ if (!*p)
+ return (0);
+ for (q = ++p; *p; p++)
+ if (!isdigit((unsigned char)*p))
+ break;
+ return (p - q);
+}
+
+/*
+ * Set format, intdata, chardata, longdata, and nosign
+ * based on the command line arguments.
+ */
+static void
+getformat(void)
+{
+ char *p, *p2;
+ int dot, hash, space, sign, numbers = 0;
+ size_t sz;
+
+ if (boring) /* no need to bother */
+ return;
+ for (p = format; *p; p++) /* look for '%' */
+ if (*p == '%') {
+ if (p[1] == '%')
+ p++; /* leave %% alone */
+ else
+ break;
+ }
+ sz = sizeof(format) - strlen(format) - 1;
+ if (!*p && !chardata) {
+ if (snprintf(p, sz, "%%.%df", prec) >= (int)sz)
+ errx(1, "-w word too long");
+ } else if (!*p && chardata) {
+ if (strlcpy(p, "%c", sz) >= sz)
+ errx(1, "-w word too long");
+ intdata = true;
+ } else if (!*(p+1)) {
+ if (sz <= 0)
+ errx(1, "-w word too long");
+ strcat(format, "%"); /* cannot end in single '%' */
+ } else {
+ /*
+ * Allow conversion format specifiers of the form
+ * %[#][ ][{+,-}][0-9]*[.[0-9]*]? where ? must be one of
+ * [l]{d,i,o,u,x} or {f,e,g,E,G,d,o,x,D,O,U,X,c,u}
+ */
+ p2 = p++;
+ dot = hash = space = sign = numbers = 0;
+ while (!isalpha((unsigned char)*p)) {
+ if (isdigit((unsigned char)*p)) {
+ numbers++;
+ p++;
+ } else if ((*p == '#' && !(numbers|dot|sign|space|
+ hash++)) ||
+ (*p == ' ' && !(numbers|dot|space++)) ||
+ ((*p == '+' || *p == '-') && !(numbers|dot|sign++))
+ || (*p == '.' && !(dot++)))
+ p++;
+ else
+ goto fmt_broken;
+ }
+ if (*p == 'l') {
+ longdata = true;
+ if (*++p == 'l') {
+ if (p[1] != '\0')
+ p++;
+ goto fmt_broken;
+ }
+ }
+ switch (*p) {
+ case 'o': case 'u': case 'x': case 'X':
+ intdata = nosign = true;
+ break;
+ case 'd': case 'i':
+ intdata = true;
+ break;
+ case 'D':
+ if (!longdata) {
+ intdata = true;
+ break;
+ }
+ case 'O': case 'U':
+ if (!longdata) {
+ intdata = nosign = true;
+ break;
+ }
+ case 'c':
+ if (!(intdata | longdata)) {
+ chardata = true;
+ break;
+ }
+ case 'h': case 'n': case 'p': case 'q': case 's': case 'L':
+ case '$': case '*':
+ goto fmt_broken;
+ case 'f': case 'e': case 'g': case 'E': case 'G':
+ if (!longdata)
+ break;
+ /* FALLTHROUGH */
+ default:
+fmt_broken:
+ *++p = '\0';
+ errx(1, "illegal or unsupported format '%s'", p2);
+ /* NOTREACHED */
+ }
+ while (*++p)
+ if (*p == '%' && *(p+1) && *(p+1) != '%')
+ errx(1, "too many conversions");
+ else if (*p == '%' && *(p+1) == '%')
+ p++;
+ else if (*p == '%' && !*(p+1)) {
+ if (strlcat(format, "%", sizeof(format)) >=
+ sizeof(format))
+ errx(1, "-w word too long");
+ break;
+ }
+ }
+}
diff --git a/usr.bin/jot/tests/Makefile b/usr.bin/jot/tests/Makefile
new file mode 100644
index 0000000..10e102b
--- /dev/null
+++ b/usr.bin/jot/tests/Makefile
@@ -0,0 +1,70 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.ascii.out
+${PACKAGE}FILES+= regress.block.out
+${PACKAGE}FILES+= regress.dddd.out
+${PACKAGE}FILES+= regress.dddh.out
+${PACKAGE}FILES+= regress.ddhd.out
+${PACKAGE}FILES+= regress.ddhd2.out
+${PACKAGE}FILES+= regress.ddhh.out
+${PACKAGE}FILES+= regress.ddhh2.out
+${PACKAGE}FILES+= regress.dhdd.out
+${PACKAGE}FILES+= regress.dhdh.out
+${PACKAGE}FILES+= regress.dhhd.out
+${PACKAGE}FILES+= regress.dhhd2.out
+${PACKAGE}FILES+= regress.dhhh.out
+${PACKAGE}FILES+= regress.dhhh2.out
+${PACKAGE}FILES+= regress.ed.out
+${PACKAGE}FILES+= regress.grep.out
+${PACKAGE}FILES+= regress.hddd.out
+${PACKAGE}FILES+= regress.hddd2.out
+${PACKAGE}FILES+= regress.hddh.out
+${PACKAGE}FILES+= regress.hddh2.out
+${PACKAGE}FILES+= regress.hdhd.out
+${PACKAGE}FILES+= regress.hdhd2.out
+${PACKAGE}FILES+= regress.hdhh.out
+${PACKAGE}FILES+= regress.hdhh2.out
+${PACKAGE}FILES+= regress.hhdd.out
+${PACKAGE}FILES+= regress.hhdd2.out
+${PACKAGE}FILES+= regress.hhdh.out
+${PACKAGE}FILES+= regress.hhdh2.out
+${PACKAGE}FILES+= regress.hhhd.out
+${PACKAGE}FILES+= regress.hhhd2.out
+${PACKAGE}FILES+= regress.hhhh.out
+${PACKAGE}FILES+= regress.hhhh2.out
+${PACKAGE}FILES+= regress.n21.out
+${PACKAGE}FILES+= regress.rand1.out
+${PACKAGE}FILES+= regress.rand2.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.stutter.out
+${PACKAGE}FILES+= regress.stutter2.out
+${PACKAGE}FILES+= regress.tabs.out
+${PACKAGE}FILES+= regress.wX1.out
+${PACKAGE}FILES+= regress.wXl.out
+${PACKAGE}FILES+= regress.wc.out
+${PACKAGE}FILES+= regress.wdl.out
+${PACKAGE}FILES+= regress.wdn.out
+${PACKAGE}FILES+= regress.we.out
+${PACKAGE}FILES+= regress.wf.out
+${PACKAGE}FILES+= regress.wg.out
+${PACKAGE}FILES+= regress.wgd.out
+${PACKAGE}FILES+= regress.wo.out
+${PACKAGE}FILES+= regress.wp1.out
+${PACKAGE}FILES+= regress.wp2.out
+${PACKAGE}FILES+= regress.wp3.out
+${PACKAGE}FILES+= regress.wp4.out
+${PACKAGE}FILES+= regress.wp5.out
+${PACKAGE}FILES+= regress.wp6.out
+${PACKAGE}FILES+= regress.wu.out
+${PACKAGE}FILES+= regress.wwe.out
+${PACKAGE}FILES+= regress.wx.out
+${PACKAGE}FILES+= regress.wxn.out
+${PACKAGE}FILES+= regress.x.out
+${PACKAGE}FILES+= regress.xaa.out
+${PACKAGE}FILES+= regress.yes.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/jot/tests/Makefile.depend b/usr.bin/jot/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/jot/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/jot/tests/legacy_test.sh b/usr.bin/jot/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/jot/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/jot/tests/regress.ascii.out b/usr.bin/jot/tests/regress.ascii.out
new file mode 100644
index 0000000..abcfb84
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ascii.out
Binary files differ
diff --git a/usr.bin/jot/tests/regress.block.out b/usr.bin/jot/tests/regress.block.out
new file mode 100644
index 0000000..a6f4536
--- /dev/null
+++ b/usr.bin/jot/tests/regress.block.out
@@ -0,0 +1,512 @@
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
diff --git a/usr.bin/jot/tests/regress.dddd.out b/usr.bin/jot/tests/regress.dddd.out
new file mode 100644
index 0000000..190423f
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dddd.out
@@ -0,0 +1,100 @@
+1
+2
+3
+4
+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
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
diff --git a/usr.bin/jot/tests/regress.dddh.out b/usr.bin/jot/tests/regress.dddh.out
new file mode 100644
index 0000000..d0da901
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dddh.out
@@ -0,0 +1,100 @@
+1
+3
+5
+7
+9
+11
+13
+15
+17
+19
+21
+23
+25
+27
+29
+31
+33
+35
+37
+39
+41
+43
+45
+47
+49
+51
+53
+55
+57
+59
+61
+63
+65
+67
+69
+71
+73
+75
+77
+79
+81
+83
+85
+87
+89
+91
+93
+95
+97
+99
+101
+103
+105
+107
+109
+111
+113
+115
+117
+119
+121
+123
+125
+127
+129
+131
+133
+135
+137
+139
+141
+143
+145
+147
+149
+151
+153
+155
+157
+159
+161
+163
+165
+167
+169
+171
+173
+175
+177
+179
+181
+183
+185
+187
+189
+191
+193
+195
+197
+199
diff --git a/usr.bin/jot/tests/regress.ddhd.out b/usr.bin/jot/tests/regress.ddhd.out
new file mode 100644
index 0000000..544a1ea
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ddhd.out
@@ -0,0 +1,100 @@
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
diff --git a/usr.bin/jot/tests/regress.ddhd2.out b/usr.bin/jot/tests/regress.ddhd2.out
new file mode 100644
index 0000000..6e21bc7
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ddhd2.out
@@ -0,0 +1,100 @@
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
diff --git a/usr.bin/jot/tests/regress.ddhh.out b/usr.bin/jot/tests/regress.ddhh.out
new file mode 100644
index 0000000..46066d0
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ddhh.out
@@ -0,0 +1,100 @@
+-78
+-76
+-74
+-72
+-70
+-68
+-66
+-64
+-62
+-60
+-58
+-56
+-54
+-52
+-50
+-48
+-46
+-44
+-42
+-40
+-38
+-36
+-34
+-32
+-30
+-28
+-26
+-24
+-22
+-20
+-18
+-16
+-14
+-12
+-10
+-8
+-6
+-4
+-2
+0
+2
+4
+6
+8
+10
+12
+14
+16
+18
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
diff --git a/usr.bin/jot/tests/regress.ddhh2.out b/usr.bin/jot/tests/regress.ddhh2.out
new file mode 100644
index 0000000..9299c4c
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ddhh2.out
@@ -0,0 +1,100 @@
+-38
+-36
+-34
+-32
+-30
+-28
+-26
+-24
+-22
+-20
+-18
+-16
+-14
+-12
+-10
+-8
+-6
+-4
+-2
+0
+2
+4
+6
+8
+10
+12
+14
+16
+18
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
+122
+124
+126
+128
+130
+132
+134
+136
+138
+140
+142
+144
+146
+148
+150
+152
+154
+156
+158
+160
diff --git a/usr.bin/jot/tests/regress.dhdd.out b/usr.bin/jot/tests/regress.dhdd.out
new file mode 100644
index 0000000..d61477b
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhdd.out
@@ -0,0 +1,100 @@
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
diff --git a/usr.bin/jot/tests/regress.dhdh.out b/usr.bin/jot/tests/regress.dhdh.out
new file mode 100644
index 0000000..1fc43dc
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhdh.out
@@ -0,0 +1,100 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
+122
+124
+126
+128
+130
+132
+134
+136
+138
+140
+142
+144
+146
+148
+150
+152
+154
+156
+158
+160
+162
+164
+166
+168
+170
+172
+174
+176
+178
+180
+182
+184
+186
+188
+190
+192
+194
+196
+198
+200
+202
+204
+206
+208
+210
+212
+214
+216
+218
diff --git a/usr.bin/jot/tests/regress.dhhd.out b/usr.bin/jot/tests/regress.dhhd.out
new file mode 100644
index 0000000..d21b134
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhhd.out
@@ -0,0 +1,101 @@
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
diff --git a/usr.bin/jot/tests/regress.dhhd2.out b/usr.bin/jot/tests/regress.dhhd2.out
new file mode 100644
index 0000000..315826d
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhhd2.out
@@ -0,0 +1,141 @@
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
diff --git a/usr.bin/jot/tests/regress.dhhh.out b/usr.bin/jot/tests/regress.dhhh.out
new file mode 100644
index 0000000..302eb42
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhhh.out
@@ -0,0 +1,51 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
diff --git a/usr.bin/jot/tests/regress.dhhh2.out b/usr.bin/jot/tests/regress.dhhh2.out
new file mode 100644
index 0000000..f56b35b
--- /dev/null
+++ b/usr.bin/jot/tests/regress.dhhh2.out
@@ -0,0 +1,71 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
+122
+124
+126
+128
+130
+132
+134
+136
+138
+140
+142
+144
+146
+148
+150
+152
+154
+156
+158
+160
diff --git a/usr.bin/jot/tests/regress.ed.out b/usr.bin/jot/tests/regress.ed.out
new file mode 100644
index 0000000..d82a36d
--- /dev/null
+++ b/usr.bin/jot/tests/regress.ed.out
@@ -0,0 +1,30 @@
+2s/old/new/
+7s/old/new/
+12s/old/new/
+17s/old/new/
+22s/old/new/
+27s/old/new/
+32s/old/new/
+37s/old/new/
+42s/old/new/
+47s/old/new/
+52s/old/new/
+57s/old/new/
+62s/old/new/
+67s/old/new/
+72s/old/new/
+77s/old/new/
+82s/old/new/
+87s/old/new/
+92s/old/new/
+97s/old/new/
+102s/old/new/
+107s/old/new/
+112s/old/new/
+117s/old/new/
+122s/old/new/
+127s/old/new/
+132s/old/new/
+137s/old/new/
+142s/old/new/
+147s/old/new/
diff --git a/usr.bin/jot/tests/regress.grep.out b/usr.bin/jot/tests/regress.grep.out
new file mode 100644
index 0000000..b6578ef
--- /dev/null
+++ b/usr.bin/jot/tests/regress.grep.out
@@ -0,0 +1 @@
+................................................................................
diff --git a/usr.bin/jot/tests/regress.hddd.out b/usr.bin/jot/tests/regress.hddd.out
new file mode 100644
index 0000000..96cc558
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hddd.out
@@ -0,0 +1,50 @@
+1
+2
+3
+4
+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
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
diff --git a/usr.bin/jot/tests/regress.hddd2.out b/usr.bin/jot/tests/regress.hddd2.out
new file mode 100644
index 0000000..e8823e1
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hddd2.out
@@ -0,0 +1,30 @@
+1
+2
+3
+4
+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
diff --git a/usr.bin/jot/tests/regress.hddh.out b/usr.bin/jot/tests/regress.hddh.out
new file mode 100644
index 0000000..7927325
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hddh.out
@@ -0,0 +1,50 @@
+1
+3
+5
+7
+9
+11
+13
+15
+17
+19
+21
+23
+25
+27
+29
+31
+33
+35
+37
+39
+41
+43
+45
+47
+49
+51
+53
+55
+57
+59
+61
+63
+65
+67
+69
+71
+73
+75
+77
+79
+81
+83
+85
+87
+89
+91
+93
+95
+97
+99
diff --git a/usr.bin/jot/tests/regress.hddh2.out b/usr.bin/jot/tests/regress.hddh2.out
new file mode 100644
index 0000000..da7d98b
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hddh2.out
@@ -0,0 +1,30 @@
+1
+3
+5
+7
+9
+11
+13
+15
+17
+19
+21
+23
+25
+27
+29
+31
+33
+35
+37
+39
+41
+43
+45
+47
+49
+51
+53
+55
+57
+59
diff --git a/usr.bin/jot/tests/regress.hdhd.out b/usr.bin/jot/tests/regress.hdhd.out
new file mode 100644
index 0000000..32ee48f
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hdhd.out
@@ -0,0 +1,50 @@
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
diff --git a/usr.bin/jot/tests/regress.hdhd2.out b/usr.bin/jot/tests/regress.hdhd2.out
new file mode 100644
index 0000000..eaa2cdc
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hdhd2.out
@@ -0,0 +1,30 @@
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
diff --git a/usr.bin/jot/tests/regress.hdhh.out b/usr.bin/jot/tests/regress.hdhh.out
new file mode 100644
index 0000000..d06ebfa
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hdhh.out
@@ -0,0 +1,50 @@
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
diff --git a/usr.bin/jot/tests/regress.hdhh2.out b/usr.bin/jot/tests/regress.hdhh2.out
new file mode 100644
index 0000000..3a412e6
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hdhh2.out
@@ -0,0 +1,30 @@
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
+122
+124
+126
+128
+130
+132
+134
+136
+138
+140
+142
+144
+146
+148
+150
+152
+154
+156
+158
+160
diff --git a/usr.bin/jot/tests/regress.hhdd.out b/usr.bin/jot/tests/regress.hhdd.out
new file mode 100644
index 0000000..8d9aa35
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhdd.out
@@ -0,0 +1,50 @@
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
diff --git a/usr.bin/jot/tests/regress.hhdd2.out b/usr.bin/jot/tests/regress.hhdd2.out
new file mode 100644
index 0000000..ae3c906
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhdd2.out
@@ -0,0 +1,30 @@
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
diff --git a/usr.bin/jot/tests/regress.hhdh.out b/usr.bin/jot/tests/regress.hhdh.out
new file mode 100644
index 0000000..520f4ef
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhdh.out
@@ -0,0 +1,50 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
diff --git a/usr.bin/jot/tests/regress.hhdh2.out b/usr.bin/jot/tests/regress.hhdh2.out
new file mode 100644
index 0000000..5b289bf
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhdh2.out
@@ -0,0 +1,30 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
diff --git a/usr.bin/jot/tests/regress.hhhd.out b/usr.bin/jot/tests/regress.hhhd.out
new file mode 100644
index 0000000..f5ddbc5
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhhd.out
@@ -0,0 +1,50 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+47
+49
+51
+53
+55
+57
+59
+61
+63
+65
+67
+69
+71
+73
+75
+77
+79
+81
+83
+85
+87
+89
+91
+93
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
+120
diff --git a/usr.bin/jot/tests/regress.hhhd2.out b/usr.bin/jot/tests/regress.hhhd2.out
new file mode 100644
index 0000000..e6a8c4f
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhhd2.out
@@ -0,0 +1,30 @@
+20
+25
+30
+34
+39
+44
+49
+54
+59
+63
+68
+73
+78
+83
+88
+92
+97
+102
+107
+112
+117
+121
+126
+131
+136
+141
+146
+150
+155
+160
diff --git a/usr.bin/jot/tests/regress.hhhh.out b/usr.bin/jot/tests/regress.hhhh.out
new file mode 100644
index 0000000..520f4ef
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhhh.out
@@ -0,0 +1,50 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
+80
+82
+84
+86
+88
+90
+92
+94
+96
+98
+100
+102
+104
+106
+108
+110
+112
+114
+116
+118
diff --git a/usr.bin/jot/tests/regress.hhhh2.out b/usr.bin/jot/tests/regress.hhhh2.out
new file mode 100644
index 0000000..5b289bf
--- /dev/null
+++ b/usr.bin/jot/tests/regress.hhhh2.out
@@ -0,0 +1,30 @@
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+50
+52
+54
+56
+58
+60
+62
+64
+66
+68
+70
+72
+74
+76
+78
diff --git a/usr.bin/jot/tests/regress.n21.out b/usr.bin/jot/tests/regress.n21.out
new file mode 100644
index 0000000..89b0879
--- /dev/null
+++ b/usr.bin/jot/tests/regress.n21.out
@@ -0,0 +1,21 @@
+-1.00
+-0.90
+-0.80
+-0.70
+-0.60
+-0.50
+-0.40
+-0.30
+-0.20
+-0.10
+-0.00
+0.10
+0.20
+0.30
+0.40
+0.50
+0.60
+0.70
+0.80
+0.90
+1.00
diff --git a/usr.bin/jot/tests/regress.rand1.out b/usr.bin/jot/tests/regress.rand1.out
new file mode 100644
index 0000000..8b1acc1
--- /dev/null
+++ b/usr.bin/jot/tests/regress.rand1.out
@@ -0,0 +1,10 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
diff --git a/usr.bin/jot/tests/regress.rand2.out b/usr.bin/jot/tests/regress.rand2.out
new file mode 100644
index 0000000..8b1acc1
--- /dev/null
+++ b/usr.bin/jot/tests/regress.rand2.out
@@ -0,0 +1,10 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
diff --git a/usr.bin/jot/tests/regress.sh b/usr.bin/jot/tests/regress.sh
new file mode 100644
index 0000000..7f6c566
--- /dev/null
+++ b/usr.bin/jot/tests/regress.sh
@@ -0,0 +1,68 @@
+# $FreeBSD$
+
+echo 1..60
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`x', `jot -w "%X" -s , 100 1 200')
+REGRESSION_TEST(`hhhh', `jot 50 20 120 2')
+REGRESSION_TEST(`hhhd', `jot 50 20 120 -')
+REGRESSION_TEST(`hhdh', `jot 50 20 - 2')
+REGRESSION_TEST(`hhdd', `jot 50 20 - -')
+REGRESSION_TEST(`hdhh', `jot 50 - 120 2')
+REGRESSION_TEST(`hdhd', `jot 50 - 120 -')
+REGRESSION_TEST(`hddh', `jot 50 - - 2')
+REGRESSION_TEST(`hddd', `jot 50 - - -')
+REGRESSION_TEST(`dhhh', `jot - 20 120 2')
+REGRESSION_TEST(`dhhd', `jot - 20 120 -')
+REGRESSION_TEST(`dhdh', `jot - 20 - 2')
+REGRESSION_TEST(`dhdd', `jot - 20 - -')
+REGRESSION_TEST(`ddhh', `jot - - 120 2')
+REGRESSION_TEST(`ddhd', `jot - - 120 -')
+REGRESSION_TEST(`dddh', `jot - - - 2')
+REGRESSION_TEST(`dddd', `jot - - - -')
+REGRESSION_TEST(`hhhh2', `jot 30 20 160 2')
+REGRESSION_TEST(`hhhd2', `jot 30 20 160 -')
+REGRESSION_TEST(`hhdh2', `jot 30 20 - 2')
+REGRESSION_TEST(`hhdd2', `jot 30 20 - -')
+REGRESSION_TEST(`hdhh2', `jot 30 - 160 2')
+REGRESSION_TEST(`hdhd2', `jot 30 - 160 -')
+REGRESSION_TEST(`hddh2', `jot 30 - - 2')
+REGRESSION_TEST(`hddd2', `jot 30 - - -')
+REGRESSION_TEST(`dhhh2', `jot - 20 160 2')
+REGRESSION_TEST(`dhhd2', `jot - 20 160 -')
+REGRESSION_TEST(`ddhh2', `jot - - 160 2')
+REGRESSION_TEST(`rand1', `jot -r 10000 0 9 | sort -u')
+REGRESSION_TEST(`rand2', `jot -r 10000 9 0 | sort -u')
+REGRESSION_TEST(`n21', `jot 21 -1 1.00')
+REGRESSION_TEST(`ascii', `jot -c 128 0')
+REGRESSION_TEST(`xaa', `jot -w xa%c 26 a')
+REGRESSION_TEST(`yes', `jot -b yes 10')
+REGRESSION_TEST(`ed', `jot -w %ds/old/new/ 30 2 - 5')
+REGRESSION_TEST(`stutter', `jot - 9 0 -.5')
+REGRESSION_TEST(`stutter2', `jot -w %d - 9.5 0 -.5')
+REGRESSION_TEST(`block', `jot -b x 512')
+REGRESSION_TEST(`tabs', `jot -s, - 10 132 4')
+REGRESSION_TEST(`grep', `jot -s "" -b . 80')
+REGRESSION_TEST(`wf', `jot -w "a%.1fb" 10')
+REGRESSION_TEST(`we', `jot -w "a%eb" 10')
+REGRESSION_TEST(`wwe', `jot -w "a%-15eb" 10')
+REGRESSION_TEST(`wg', `jot -w "a%20gb" 10')
+REGRESSION_TEST(`wc', `jot -w "a%cb" 10 33 43')
+REGRESSION_TEST(`wgd', `jot -w "a%gb" 10 .2')
+REGRESSION_TEST(`wu', `jot -w "a%ub" 10')
+REGRESSION_TEST(`wo', `jot -w "a%ob" 10')
+REGRESSION_TEST(`wx', `jot -w "a%xb" 10')
+REGRESSION_TEST(`wX1', `jot -w "a%Xb" 10')
+REGRESSION_TEST(`wXl', `jot -w "a%Xb" 10 2147483648')
+REGRESSION_TEST(`wdl', `jot -w "a%db" 10 2147483648 2>/dev/null')
+REGRESSION_TEST(`wxn', `jot -w "a%xb" 10 -5 2>/dev/null')
+REGRESSION_TEST(`wdn', `jot -w "a%db" 10 -5')
+REGRESSION_TEST(`wp1', `jot -w "%%%d%%%%" 10')
+REGRESSION_TEST(`wp2', `jot -w "%d%%d%%" 10')
+REGRESSION_TEST(`wp3', `jot -w "a%%A%%%d%%B%%b" 10')
+REGRESSION_TEST(`wp4', `jot -w "%%d%d%%d%%" 10')
+REGRESSION_TEST(`wp5', `jot -w ftp://www.example.com/pub/uploaded%%20files/disk%03d.iso 10')
+REGRESSION_TEST(`wp6', `jot -w "%d%" 10')
+
+REGRESSION_END()
diff --git a/usr.bin/jot/tests/regress.stutter.out b/usr.bin/jot/tests/regress.stutter.out
new file mode 100644
index 0000000..10eb87d
--- /dev/null
+++ b/usr.bin/jot/tests/regress.stutter.out
@@ -0,0 +1,19 @@
+9
+8
+8
+8
+7
+6
+6
+6
+5
+4
+4
+4
+3
+2
+2
+2
+1
+0
+0
diff --git a/usr.bin/jot/tests/regress.stutter2.out b/usr.bin/jot/tests/regress.stutter2.out
new file mode 100644
index 0000000..44e0ba1
--- /dev/null
+++ b/usr.bin/jot/tests/regress.stutter2.out
@@ -0,0 +1,20 @@
+9
+9
+8
+8
+7
+7
+6
+6
+5
+5
+4
+4
+3
+3
+2
+2
+1
+1
+0
+0
diff --git a/usr.bin/jot/tests/regress.tabs.out b/usr.bin/jot/tests/regress.tabs.out
new file mode 100644
index 0000000..7859413
--- /dev/null
+++ b/usr.bin/jot/tests/regress.tabs.out
@@ -0,0 +1 @@
+10,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130
diff --git a/usr.bin/jot/tests/regress.wX1.out b/usr.bin/jot/tests/regress.wX1.out
new file mode 100644
index 0000000..dc7f5e9
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wX1.out
@@ -0,0 +1,10 @@
+a1b
+a2b
+a3b
+a4b
+a5b
+a6b
+a7b
+a8b
+a9b
+aAb
diff --git a/usr.bin/jot/tests/regress.wXl.out b/usr.bin/jot/tests/regress.wXl.out
new file mode 100644
index 0000000..cf6b9b7
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wXl.out
@@ -0,0 +1,10 @@
+a80000000b
+a80000001b
+a80000002b
+a80000003b
+a80000004b
+a80000005b
+a80000006b
+a80000007b
+a80000008b
+a80000009b
diff --git a/usr.bin/jot/tests/regress.wc.out b/usr.bin/jot/tests/regress.wc.out
new file mode 100644
index 0000000..f6e77d9
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wc.out
@@ -0,0 +1,10 @@
+a!b
+a"b
+a#b
+a$b
+a%b
+a&b
+a'b
+a(b
+a)b
+a+b
diff --git a/usr.bin/jot/tests/regress.wdl.out b/usr.bin/jot/tests/regress.wdl.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wdl.out
diff --git a/usr.bin/jot/tests/regress.wdn.out b/usr.bin/jot/tests/regress.wdn.out
new file mode 100644
index 0000000..c4027de
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wdn.out
@@ -0,0 +1,10 @@
+a-5b
+a-4b
+a-3b
+a-2b
+a-1b
+a0b
+a1b
+a2b
+a3b
+a4b
diff --git a/usr.bin/jot/tests/regress.we.out b/usr.bin/jot/tests/regress.we.out
new file mode 100644
index 0000000..5a3727d
--- /dev/null
+++ b/usr.bin/jot/tests/regress.we.out
@@ -0,0 +1,10 @@
+a1.000000e+00b
+a2.000000e+00b
+a3.000000e+00b
+a4.000000e+00b
+a5.000000e+00b
+a6.000000e+00b
+a7.000000e+00b
+a8.000000e+00b
+a9.000000e+00b
+a1.000000e+01b
diff --git a/usr.bin/jot/tests/regress.wf.out b/usr.bin/jot/tests/regress.wf.out
new file mode 100644
index 0000000..7fd3021
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wf.out
@@ -0,0 +1,10 @@
+a1.0b
+a2.0b
+a3.0b
+a4.0b
+a5.0b
+a6.0b
+a7.0b
+a8.0b
+a9.0b
+a10.0b
diff --git a/usr.bin/jot/tests/regress.wg.out b/usr.bin/jot/tests/regress.wg.out
new file mode 100644
index 0000000..5c33e35
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wg.out
@@ -0,0 +1,10 @@
+a 1b
+a 2b
+a 3b
+a 4b
+a 5b
+a 6b
+a 7b
+a 8b
+a 9b
+a 10b
diff --git a/usr.bin/jot/tests/regress.wgd.out b/usr.bin/jot/tests/regress.wgd.out
new file mode 100644
index 0000000..0f3f96d0
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wgd.out
@@ -0,0 +1,10 @@
+a0.2b
+a1.2b
+a2.2b
+a3.2b
+a4.2b
+a5.2b
+a6.2b
+a7.2b
+a8.2b
+a9.2b
diff --git a/usr.bin/jot/tests/regress.wo.out b/usr.bin/jot/tests/regress.wo.out
new file mode 100644
index 0000000..4c89c92
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wo.out
@@ -0,0 +1,10 @@
+a1b
+a2b
+a3b
+a4b
+a5b
+a6b
+a7b
+a10b
+a11b
+a12b
diff --git a/usr.bin/jot/tests/regress.wp1.out b/usr.bin/jot/tests/regress.wp1.out
new file mode 100644
index 0000000..6a5e94c
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp1.out
@@ -0,0 +1,10 @@
+%1%%
+%2%%
+%3%%
+%4%%
+%5%%
+%6%%
+%7%%
+%8%%
+%9%%
+%10%%
diff --git a/usr.bin/jot/tests/regress.wp2.out b/usr.bin/jot/tests/regress.wp2.out
new file mode 100644
index 0000000..a489d69
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp2.out
@@ -0,0 +1,10 @@
+1%d%
+2%d%
+3%d%
+4%d%
+5%d%
+6%d%
+7%d%
+8%d%
+9%d%
+10%d%
diff --git a/usr.bin/jot/tests/regress.wp3.out b/usr.bin/jot/tests/regress.wp3.out
new file mode 100644
index 0000000..95e31bb
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp3.out
@@ -0,0 +1,10 @@
+a%A%1%B%b
+a%A%2%B%b
+a%A%3%B%b
+a%A%4%B%b
+a%A%5%B%b
+a%A%6%B%b
+a%A%7%B%b
+a%A%8%B%b
+a%A%9%B%b
+a%A%10%B%b
diff --git a/usr.bin/jot/tests/regress.wp4.out b/usr.bin/jot/tests/regress.wp4.out
new file mode 100644
index 0000000..cd177b2
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp4.out
@@ -0,0 +1,10 @@
+%d1%d%
+%d2%d%
+%d3%d%
+%d4%d%
+%d5%d%
+%d6%d%
+%d7%d%
+%d8%d%
+%d9%d%
+%d10%d%
diff --git a/usr.bin/jot/tests/regress.wp5.out b/usr.bin/jot/tests/regress.wp5.out
new file mode 100644
index 0000000..2889d8f
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp5.out
@@ -0,0 +1,10 @@
+ftp://www.example.com/pub/uploaded%20files/disk001.iso
+ftp://www.example.com/pub/uploaded%20files/disk002.iso
+ftp://www.example.com/pub/uploaded%20files/disk003.iso
+ftp://www.example.com/pub/uploaded%20files/disk004.iso
+ftp://www.example.com/pub/uploaded%20files/disk005.iso
+ftp://www.example.com/pub/uploaded%20files/disk006.iso
+ftp://www.example.com/pub/uploaded%20files/disk007.iso
+ftp://www.example.com/pub/uploaded%20files/disk008.iso
+ftp://www.example.com/pub/uploaded%20files/disk009.iso
+ftp://www.example.com/pub/uploaded%20files/disk010.iso
diff --git a/usr.bin/jot/tests/regress.wp6.out b/usr.bin/jot/tests/regress.wp6.out
new file mode 100644
index 0000000..1f097f0
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wp6.out
@@ -0,0 +1,10 @@
+1%
+2%
+3%
+4%
+5%
+6%
+7%
+8%
+9%
+10%
diff --git a/usr.bin/jot/tests/regress.wu.out b/usr.bin/jot/tests/regress.wu.out
new file mode 100644
index 0000000..c39e5f6
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wu.out
@@ -0,0 +1,10 @@
+a1b
+a2b
+a3b
+a4b
+a5b
+a6b
+a7b
+a8b
+a9b
+a10b
diff --git a/usr.bin/jot/tests/regress.wwe.out b/usr.bin/jot/tests/regress.wwe.out
new file mode 100644
index 0000000..7c873a5
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wwe.out
@@ -0,0 +1,10 @@
+a1.000000e+00 b
+a2.000000e+00 b
+a3.000000e+00 b
+a4.000000e+00 b
+a5.000000e+00 b
+a6.000000e+00 b
+a7.000000e+00 b
+a8.000000e+00 b
+a9.000000e+00 b
+a1.000000e+01 b
diff --git a/usr.bin/jot/tests/regress.wx.out b/usr.bin/jot/tests/regress.wx.out
new file mode 100644
index 0000000..5520d01
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wx.out
@@ -0,0 +1,10 @@
+a1b
+a2b
+a3b
+a4b
+a5b
+a6b
+a7b
+a8b
+a9b
+aab
diff --git a/usr.bin/jot/tests/regress.wxn.out b/usr.bin/jot/tests/regress.wxn.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/jot/tests/regress.wxn.out
diff --git a/usr.bin/jot/tests/regress.x.out b/usr.bin/jot/tests/regress.x.out
new file mode 100644
index 0000000..b109793
--- /dev/null
+++ b/usr.bin/jot/tests/regress.x.out
@@ -0,0 +1 @@
+1,3,5,7,9,B,D,F,11,13,15,17,19,1B,1D,1F,21,23,25,27,29,2B,2D,2F,31,33,35,37,39,3B,3D,3F,41,43,45,47,49,4B,4D,4F,51,53,55,57,59,5B,5D,5F,61,63,65,67,69,6B,6D,6F,71,73,75,77,79,7B,7D,7F,81,83,85,87,89,8B,8D,8F,91,93,95,97,99,9B,9D,9F,A1,A3,A5,A7,A9,AB,AD,AF,B1,B3,B5,B7,B9,BB,BD,BF,C1,C3,C5,C8
diff --git a/usr.bin/jot/tests/regress.xaa.out b/usr.bin/jot/tests/regress.xaa.out
new file mode 100644
index 0000000..b14f9a0
--- /dev/null
+++ b/usr.bin/jot/tests/regress.xaa.out
@@ -0,0 +1,26 @@
+xaa
+xab
+xac
+xad
+xae
+xaf
+xag
+xah
+xai
+xaj
+xak
+xal
+xam
+xan
+xao
+xap
+xaq
+xar
+xas
+xat
+xau
+xav
+xaw
+xax
+xay
+xaz
diff --git a/usr.bin/jot/tests/regress.yes.out b/usr.bin/jot/tests/regress.yes.out
new file mode 100644
index 0000000..74e8d37
--- /dev/null
+++ b/usr.bin/jot/tests/regress.yes.out
@@ -0,0 +1,10 @@
+yes
+yes
+yes
+yes
+yes
+yes
+yes
+yes
+yes
+yes
diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile
new file mode 100644
index 0000000..f80f668
--- /dev/null
+++ b/usr.bin/kdump/Makefile
@@ -0,0 +1,31 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+.PATH: ${.CURDIR}/../ktrace
+
+PROG= kdump
+SRCS= kdump_subr.c kdump_subr.h kdump.c subr.c
+CFLAGS+= -I${.CURDIR}/../ktrace -I${.CURDIR} -I${.CURDIR}/../.. -I.
+
+LIBADD= sysdecode
+.if ${MK_CASPER} != "no"
+LIBADD+= casper
+LIBADD+= cap_grp
+LIBADD+= cap_pwd
+CFLAGS+=-DHAVE_LIBCASPER
+.endif
+
+NO_WERROR?= YES
+
+CLEANFILES= kdump_subr.c kdump_subr.h
+
+kdump_subr.h: mksubr
+ sh ${.CURDIR}/mksubr ${DESTDIR}${INCLUDEDIR} | \
+ sed -n 's/^\([a-z].*)\)$$/void \1;/p' >${.TARGET}
+
+kdump_subr.c: mksubr kdump_subr.h
+ sh ${.CURDIR}/mksubr ${DESTDIR}${INCLUDEDIR} >${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/kdump/Makefile.depend b/usr.bin/kdump/Makefile.depend
new file mode 100644
index 0000000..71c8213
--- /dev/null
+++ b/usr.bin/kdump/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcasper/libcasper \
+ lib/libcasper/services/cap_grp \
+ lib/libcasper/services/cap_pwd \
+ lib/libcompiler_rt \
+ lib/libnv \
+ lib/libsysdecode \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/kdump/kdump.1 b/usr.bin/kdump/kdump.1
new file mode 100644
index 0000000..a3cc1cf
--- /dev/null
+++ b/usr.bin/kdump/kdump.1
@@ -0,0 +1,185 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)kdump.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 28, 2014
+.Dt KDUMP 1
+.Os
+.Sh NAME
+.Nm kdump
+.Nd display kernel trace data
+.Sh SYNOPSIS
+.Nm
+.Op Fl dEnlHRSsTA
+.Op Fl f Ar trfile
+.Op Fl m Ar maxdata
+.Op Fl p Ar pid
+.Op Fl t Ar trstr
+.Sh DESCRIPTION
+The
+.Nm
+command displays the kernel trace files produced with
+.Xr ktrace 1
+in human readable format.
+By default, the file
+.Pa ktrace.out
+in the current directory is displayed.
+.Pp
+The options are as follows:
+.Bl -tag -width Fl
+.It Fl d
+Display all numbers in decimal.
+.It Fl E
+Display elapsed timestamps (time since beginning of trace).
+.It Fl f Ar trfile
+Display the specified file instead of
+.Pa ktrace.out .
+.It Fl H
+List the thread ID (tid) of the thread with each trace record, if available.
+If no thread ID is available, 0 will be printed.
+.It Fl l
+Loop reading the trace file, once the end-of-file is reached, waiting for
+more data.
+.It Fl m Ar maxdata
+Display at most
+.Ar maxdata
+bytes when decoding
+.Tn I/O .
+.It Fl n
+Suppress ad hoc translations.
+Normally
+.Nm
+tries to decode many system calls into a more human readable format.
+For example,
+.Xr ioctl 2
+values are replaced with the macro name and
+.Va errno
+values are replaced with the
+.Xr strerror 3
+string.
+Suppressing this feature yields a more consistent output format and is
+easily amenable to further processing.
+.It Fl p Ar pid
+Display only trace events that correspond to the process or thread
+.Ar pid .
+This may be useful when there are multiple processes or threads recorded in the
+same trace file.
+.It Fl R
+Display relative timestamps (time since previous entry).
+.It Fl r
+When decoding STRU records, display structure members such as UIDs,
+GIDs, dates etc. symbolically instead of numerically.
+.It Fl S
+Display system call numbers.
+.It Fl s
+Suppress display of I/O data.
+.It Fl T
+Display absolute timestamps for each entry (seconds since epoch).
+.It Fl A
+Display description of the ABI of traced process.
+.It Fl t Ar trstr
+See the
+.Fl t
+option of
+.Xr ktrace 1 .
+.El
+.Pp
+The output format of
+.Nm
+is line oriented with several fields.
+The example below shows a section of a kdump generated by the following
+commands:
+.Bd -literal -offset indent
+?> ktrace echo "ktrace"
+
+?> kdump
+
+ 85045 echo CALL writev(0x1,0x804b030,0x2)
+ 85045 echo GIO fd 1 wrote 7 bytes
+ "ktrace
+ "
+ 85045 echo RET writev 7
+.Ed
+.Pp
+The first field is the PID of the process being traced.
+The second field is the name of the program being traced.
+The third field is the operation that the kernel performed
+on behalf of the process.
+If thread IDs are being printed, then an additional thread ID column will be
+added to the output between the PID field and program name field.
+.Pp
+In the first line above, the kernel executes the
+.Xr writev 2
+system call on behalf of the process so this is a
+.Li CALL
+operation.
+The fourth field shows the system call that was executed,
+including its arguments.
+The
+.Xr writev 2
+system call takes a file descriptor, in this case 1, or standard
+output, then a pointer to the iovector to write, and the number of
+iovectors that are to be written.
+In the second line we see the operation was
+.Li GIO ,
+for general I/O, and that file descriptor 1 had
+seven bytes written to it.
+This is followed by the seven bytes that were written, the string
+.Qq Li ktrace
+with a carriage return and line feed.
+The last line is the
+.Li RET
+operation, showing a return from the kernel, what system call we are
+returning from, and the return value that the process received.
+Seven bytes were written by the
+.Xr writev 2
+system call, so 7 is the return value.
+.Pp
+The possible operations are:
+.Bl -column -offset indent ".Li CALL" ".No data from user process"
+.It Sy Name Ta Sy Operation Ta Sy Fourth field
+.It Li CALL Ta enter syscall Ta syscall name and arguments
+.It Li RET Ta return from syscall Ta syscall name and return value
+.It Li NAMI Ta file name lookup Ta path to file
+.It Li GIO Ta general I/O Ta fd, read/write, number of bytes
+.It Li PSIG Ta signal Ta signal name, handler, mask, code
+.It Li CSW Ta context switch Ta stop/resume user/kernel wmesg
+.It Li USER Ta data from user process Ta the data
+.It Li STRU Ta various syscalls Ta structure
+.It Li SCTL Ta Xr sysctl 3 requests Ta MIB name
+.It Li PFLT Ta enter page fault Ta fault address and type
+.It Li PRET Ta return from page fault Ta fault result
+.El
+.Sh SEE ALSO
+.Xr ktrace 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
new file mode 100644
index 0000000..7010bbf
--- /dev/null
+++ b/usr.bin/kdump/kdump.c
@@ -0,0 +1,1843 @@
+/*-
+ * Copyright (c) 1988, 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) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)kdump.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define _KERNEL
+extern int errno;
+#include <sys/errno.h>
+#undef _KERNEL
+#include <sys/param.h>
+#include <sys/capsicum.h>
+#include <sys/errno.h>
+#define _KERNEL
+#include <sys/time.h>
+#undef _KERNEL
+#include <sys/uio.h>
+#include <sys/ktrace.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/sysent.h>
+#include <sys/umtx.h>
+#include <sys/un.h>
+#include <sys/queue.h>
+#include <sys/wait.h>
+#ifdef HAVE_LIBCASPER
+#include <sys/nv.h>
+#endif
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <ctype.h>
+#include <err.h>
+#include <grp.h>
+#include <inttypes.h>
+#include <locale.h>
+#include <netdb.h>
+#include <nl_types.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdecode.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <vis.h>
+#include "ktrace.h"
+#include "kdump_subr.h"
+
+#ifdef HAVE_LIBCASPER
+#include <libcasper.h>
+
+#include <casper/cap_grp.h>
+#include <casper/cap_pwd.h>
+#endif
+
+u_int abidump(struct ktr_header *);
+int fetchprocinfo(struct ktr_header *, u_int *);
+int fread_tail(void *, int, int);
+void dumpheader(struct ktr_header *);
+void ktrsyscall(struct ktr_syscall *, u_int);
+void ktrsysret(struct ktr_sysret *, u_int);
+void ktrnamei(char *, int);
+void hexdump(char *, int, int);
+void visdump(char *, int, int);
+void ktrgenio(struct ktr_genio *, int);
+void ktrpsig(struct ktr_psig *);
+void ktrcsw(struct ktr_csw *);
+void ktrcsw_old(struct ktr_csw_old *);
+void ktruser_malloc(void *);
+void ktruser_rtld(int, void *);
+void ktruser(int, void *);
+void ktrcaprights(cap_rights_t *);
+void ktrsockaddr(struct sockaddr *);
+void ktrstat(struct stat *);
+void ktrstruct(char *, size_t);
+void ktrcapfail(struct ktr_cap_fail *);
+void ktrfault(struct ktr_fault *);
+void ktrfaultend(struct ktr_faultend *);
+void limitfd(int fd);
+void usage(void);
+
+#define TIMESTAMP_NONE 0x0
+#define TIMESTAMP_ABSOLUTE 0x1
+#define TIMESTAMP_ELAPSED 0x2
+#define TIMESTAMP_RELATIVE 0x4
+
+extern const char *signames[];
+
+static int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
+ resolv = 0, abiflag = 0, syscallno = 0;
+static const char *tracefile = DEF_TRACEFILE;
+static struct ktr_header ktr_header;
+
+#define TIME_FORMAT "%b %e %T %Y"
+#define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
+
+#define print_number(i,n,c) do { \
+ if (decimal) \
+ printf("%c%jd", c, (intmax_t)*i); \
+ else \
+ printf("%c%#jx", c, (uintmax_t)(u_register_t)*i); \
+ i++; \
+ n--; \
+ c = ','; \
+} while (0)
+
+struct proc_info
+{
+ TAILQ_ENTRY(proc_info) info;
+ u_int sv_flags;
+ pid_t pid;
+};
+
+static TAILQ_HEAD(trace_procs, proc_info) trace_procs;
+
+#ifdef HAVE_LIBCASPER
+static cap_channel_t *cappwd, *capgrp;
+#endif
+
+static void
+strerror_init(void)
+{
+
+ /*
+ * Cache NLS data before entering capability mode.
+ * XXXPJD: There should be strerror_init() and strsignal_init() in libc.
+ */
+ (void)catopen("libc", NL_CAT_LOCALE);
+}
+
+static void
+localtime_init(void)
+{
+ time_t ltime;
+
+ /*
+ * Allow localtime(3) to cache /etc/localtime content before entering
+ * capability mode.
+ * XXXPJD: There should be localtime_init() in libc.
+ */
+ (void)time(&ltime);
+ (void)localtime(&ltime);
+}
+
+#ifdef HAVE_LIBCASPER
+static int
+cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp)
+{
+ cap_channel_t *capcas, *cappwdloc, *capgrploc;
+ const char *cmds[1], *fields[1];
+
+ capcas = cap_init();
+ if (capcas == NULL) {
+ err(1, "unable to create casper process");
+ exit(1);
+ }
+ cappwdloc = cap_service_open(capcas, "system.pwd");
+ capgrploc = cap_service_open(capcas, "system.grp");
+ /* Casper capability no longer needed. */
+ cap_close(capcas);
+ if (cappwdloc == NULL || capgrploc == NULL) {
+ if (cappwdloc == NULL)
+ warn("unable to open system.pwd service");
+ if (capgrploc == NULL)
+ warn("unable to open system.grp service");
+ exit(1);
+ }
+ /* Limit system.pwd to only getpwuid() function and pw_name field. */
+ cmds[0] = "getpwuid";
+ if (cap_pwd_limit_cmds(cappwdloc, cmds, 1) < 0)
+ err(1, "unable to limit system.pwd service");
+ fields[0] = "pw_name";
+ if (cap_pwd_limit_fields(cappwdloc, fields, 1) < 0)
+ err(1, "unable to limit system.pwd service");
+ /* Limit system.grp to only getgrgid() function and gr_name field. */
+ cmds[0] = "getgrgid";
+ if (cap_grp_limit_cmds(capgrploc, cmds, 1) < 0)
+ err(1, "unable to limit system.grp service");
+ fields[0] = "gr_name";
+ if (cap_grp_limit_fields(capgrploc, fields, 1) < 0)
+ err(1, "unable to limit system.grp service");
+
+ *cappwdp = cappwdloc;
+ *capgrpp = capgrploc;
+ return (0);
+}
+#endif /* HAVE_LIBCASPER */
+
+int
+main(int argc, char *argv[])
+{
+ int ch, ktrlen, size;
+ void *m;
+ int trpoints = ALL_POINTS;
+ int drop_logged;
+ pid_t pid = 0;
+ u_int sv_flags;
+
+ setlocale(LC_CTYPE, "");
+
+ timestamp = TIMESTAMP_NONE;
+
+ while ((ch = getopt(argc,argv,"f:dElm:np:AHRrSsTt:")) != -1)
+ switch (ch) {
+ case 'A':
+ abiflag = 1;
+ break;
+ case 'f':
+ tracefile = optarg;
+ break;
+ case 'd':
+ decimal = 1;
+ break;
+ case 'l':
+ tail = 1;
+ break;
+ case 'm':
+ maxdata = atoi(optarg);
+ break;
+ case 'n':
+ fancy = 0;
+ break;
+ case 'p':
+ pid = atoi(optarg);
+ break;
+ case 'r':
+ resolv = 1;
+ break;
+ case 'S':
+ syscallno = 1;
+ break;
+ case 's':
+ suppressdata = 1;
+ break;
+ case 'E':
+ timestamp |= TIMESTAMP_ELAPSED;
+ break;
+ case 'H':
+ threads = 1;
+ break;
+ case 'R':
+ timestamp |= TIMESTAMP_RELATIVE;
+ break;
+ case 'T':
+ timestamp |= TIMESTAMP_ABSOLUTE;
+ break;
+ case 't':
+ trpoints = getpoints(optarg);
+ if (trpoints < 0)
+ errx(1, "unknown trace point in %s", optarg);
+ break;
+ default:
+ usage();
+ }
+
+ if (argc > optind)
+ usage();
+
+ m = malloc(size = 1025);
+ if (m == NULL)
+ errx(1, "%s", strerror(ENOMEM));
+ if (strcmp(tracefile, "-") != 0)
+ if (!freopen(tracefile, "r", stdin))
+ err(1, "%s", tracefile);
+
+ strerror_init();
+ localtime_init();
+#ifdef HAVE_LIBCASPER
+ if (resolv != 0) {
+ if (cappwdgrp_setup(&cappwd, &capgrp) < 0) {
+ cappwd = NULL;
+ capgrp = NULL;
+ }
+ }
+ if (resolv == 0 || (cappwd != NULL && capgrp != NULL)) {
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+ }
+#else
+ if (resolv == 0) {
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+ }
+#endif
+ limitfd(STDIN_FILENO);
+ limitfd(STDOUT_FILENO);
+ limitfd(STDERR_FILENO);
+
+ TAILQ_INIT(&trace_procs);
+ drop_logged = 0;
+ while (fread_tail(&ktr_header, sizeof(struct ktr_header), 1)) {
+ if (ktr_header.ktr_type & KTR_DROP) {
+ ktr_header.ktr_type &= ~KTR_DROP;
+ if (!drop_logged && threads) {
+ printf(
+ "%6jd %6jd %-8.*s Events dropped.\n",
+ (intmax_t)ktr_header.ktr_pid,
+ ktr_header.ktr_tid > 0 ?
+ (intmax_t)ktr_header.ktr_tid : 0,
+ MAXCOMLEN, ktr_header.ktr_comm);
+ drop_logged = 1;
+ } else if (!drop_logged) {
+ printf("%6jd %-8.*s Events dropped.\n",
+ (intmax_t)ktr_header.ktr_pid, MAXCOMLEN,
+ ktr_header.ktr_comm);
+ drop_logged = 1;
+ }
+ }
+ if (trpoints & (1<<ktr_header.ktr_type))
+ if (pid == 0 || ktr_header.ktr_pid == pid ||
+ ktr_header.ktr_tid == pid)
+ dumpheader(&ktr_header);
+ if ((ktrlen = ktr_header.ktr_len) < 0)
+ errx(1, "bogus length 0x%x", ktrlen);
+ if (ktrlen > size) {
+ m = realloc(m, ktrlen+1);
+ if (m == NULL)
+ errx(1, "%s", strerror(ENOMEM));
+ size = ktrlen;
+ }
+ if (ktrlen && fread_tail(m, ktrlen, 1) == 0)
+ errx(1, "data too short");
+ if (fetchprocinfo(&ktr_header, (u_int *)m) != 0)
+ continue;
+ sv_flags = abidump(&ktr_header);
+ if (pid && ktr_header.ktr_pid != pid &&
+ ktr_header.ktr_tid != pid)
+ continue;
+ if ((trpoints & (1<<ktr_header.ktr_type)) == 0)
+ continue;
+ drop_logged = 0;
+ switch (ktr_header.ktr_type) {
+ case KTR_SYSCALL:
+ ktrsyscall((struct ktr_syscall *)m, sv_flags);
+ break;
+ case KTR_SYSRET:
+ ktrsysret((struct ktr_sysret *)m, sv_flags);
+ break;
+ case KTR_NAMEI:
+ case KTR_SYSCTL:
+ ktrnamei(m, ktrlen);
+ break;
+ case KTR_GENIO:
+ ktrgenio((struct ktr_genio *)m, ktrlen);
+ break;
+ case KTR_PSIG:
+ ktrpsig((struct ktr_psig *)m);
+ break;
+ case KTR_CSW:
+ if (ktrlen == sizeof(struct ktr_csw_old))
+ ktrcsw_old((struct ktr_csw_old *)m);
+ else
+ ktrcsw((struct ktr_csw *)m);
+ break;
+ case KTR_USER:
+ ktruser(ktrlen, m);
+ break;
+ case KTR_STRUCT:
+ ktrstruct(m, ktrlen);
+ break;
+ case KTR_CAPFAIL:
+ ktrcapfail((struct ktr_cap_fail *)m);
+ break;
+ case KTR_FAULT:
+ ktrfault((struct ktr_fault *)m);
+ break;
+ case KTR_FAULTEND:
+ ktrfaultend((struct ktr_faultend *)m);
+ break;
+ default:
+ printf("\n");
+ break;
+ }
+ if (tail)
+ fflush(stdout);
+ }
+ return 0;
+}
+
+void
+limitfd(int fd)
+{
+ cap_rights_t rights;
+ unsigned long cmd;
+
+ cap_rights_init(&rights, CAP_FSTAT);
+ cmd = 0;
+
+ switch (fd) {
+ case STDIN_FILENO:
+ cap_rights_set(&rights, CAP_READ);
+ break;
+ case STDOUT_FILENO:
+ cap_rights_set(&rights, CAP_IOCTL, CAP_WRITE);
+ cmd = TIOCGETA; /* required by isatty(3) in printf(3) */
+ break;
+ case STDERR_FILENO:
+ cap_rights_set(&rights, CAP_WRITE);
+ if (!suppressdata) {
+ cap_rights_set(&rights, CAP_IOCTL);
+ cmd = TIOCGWINSZ;
+ }
+ break;
+ default:
+ abort();
+ }
+
+ if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for descriptor %d", fd);
+ if (cmd != 0 && cap_ioctls_limit(fd, &cmd, 1) < 0 && errno != ENOSYS)
+ err(1, "unable to limit ioctls for descriptor %d", fd);
+}
+
+int
+fread_tail(void *buf, int size, int num)
+{
+ int i;
+
+ while ((i = fread(buf, size, num, stdin)) == 0 && tail) {
+ sleep(1);
+ clearerr(stdin);
+ }
+ return (i);
+}
+
+int
+fetchprocinfo(struct ktr_header *kth, u_int *flags)
+{
+ struct proc_info *pi;
+
+ switch (kth->ktr_type) {
+ case KTR_PROCCTOR:
+ TAILQ_FOREACH(pi, &trace_procs, info) {
+ if (pi->pid == kth->ktr_pid) {
+ TAILQ_REMOVE(&trace_procs, pi, info);
+ break;
+ }
+ }
+ pi = malloc(sizeof(struct proc_info));
+ if (pi == NULL)
+ errx(1, "%s", strerror(ENOMEM));
+ pi->sv_flags = *flags;
+ pi->pid = kth->ktr_pid;
+ TAILQ_INSERT_TAIL(&trace_procs, pi, info);
+ return (1);
+
+ case KTR_PROCDTOR:
+ TAILQ_FOREACH(pi, &trace_procs, info) {
+ if (pi->pid == kth->ktr_pid) {
+ TAILQ_REMOVE(&trace_procs, pi, info);
+ free(pi);
+ break;
+ }
+ }
+ return (1);
+ }
+
+ return (0);
+}
+
+u_int
+abidump(struct ktr_header *kth)
+{
+ struct proc_info *pi;
+ const char *abi;
+ const char *arch;
+ u_int flags = 0;
+
+ TAILQ_FOREACH(pi, &trace_procs, info) {
+ if (pi->pid == kth->ktr_pid) {
+ flags = pi->sv_flags;
+ break;
+ }
+ }
+
+ if (abiflag == 0)
+ return (flags);
+
+ switch (flags & SV_ABI_MASK) {
+ case SV_ABI_LINUX:
+ abi = "L";
+ break;
+ case SV_ABI_FREEBSD:
+ abi = "F";
+ break;
+ case SV_ABI_CLOUDABI:
+ abi = "C";
+ break;
+ default:
+ abi = "U";
+ break;
+ }
+
+ if (flags & SV_LP64)
+ arch = "64";
+ else if (flags & SV_ILP32)
+ arch = "32";
+ else
+ arch = "00";
+
+ printf("%s%s ", abi, arch);
+
+ return (flags);
+}
+
+void
+dumpheader(struct ktr_header *kth)
+{
+ static char unknown[64];
+ static struct timeval prevtime, prevtime_e, temp;
+ const char *type;
+ const char *sign;
+
+ switch (kth->ktr_type) {
+ case KTR_SYSCALL:
+ type = "CALL";
+ break;
+ case KTR_SYSRET:
+ type = "RET ";
+ break;
+ case KTR_NAMEI:
+ type = "NAMI";
+ break;
+ case KTR_GENIO:
+ type = "GIO ";
+ break;
+ case KTR_PSIG:
+ type = "PSIG";
+ break;
+ case KTR_CSW:
+ type = "CSW ";
+ break;
+ case KTR_USER:
+ type = "USER";
+ break;
+ case KTR_STRUCT:
+ type = "STRU";
+ break;
+ case KTR_SYSCTL:
+ type = "SCTL";
+ break;
+ case KTR_PROCCTOR:
+ /* FALLTHROUGH */
+ case KTR_PROCDTOR:
+ return;
+ case KTR_CAPFAIL:
+ type = "CAP ";
+ break;
+ case KTR_FAULT:
+ type = "PFLT";
+ break;
+ case KTR_FAULTEND:
+ type = "PRET";
+ break;
+ default:
+ sprintf(unknown, "UNKNOWN(%d)", kth->ktr_type);
+ type = unknown;
+ }
+
+ /*
+ * The ktr_tid field was previously the ktr_buffer field, which held
+ * the kernel pointer value for the buffer associated with data
+ * following the record header. It now holds a threadid, but only
+ * for trace files after the change. Older trace files still contain
+ * kernel pointers. Detect this and suppress the results by printing
+ * negative tid's as 0.
+ */
+ if (threads)
+ printf("%6jd %6jd %-8.*s ", (intmax_t)kth->ktr_pid,
+ kth->ktr_tid > 0 ? (intmax_t)kth->ktr_tid : 0,
+ MAXCOMLEN, kth->ktr_comm);
+ else
+ printf("%6jd %-8.*s ", (intmax_t)kth->ktr_pid, MAXCOMLEN,
+ kth->ktr_comm);
+ if (timestamp) {
+ if (timestamp & TIMESTAMP_ABSOLUTE) {
+ printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
+ kth->ktr_time.tv_usec);
+ }
+ if (timestamp & TIMESTAMP_ELAPSED) {
+ if (prevtime_e.tv_sec == 0)
+ prevtime_e = kth->ktr_time;
+ timevalsub(&kth->ktr_time, &prevtime_e);
+ printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
+ kth->ktr_time.tv_usec);
+ timevaladd(&kth->ktr_time, &prevtime_e);
+ }
+ if (timestamp & TIMESTAMP_RELATIVE) {
+ if (prevtime.tv_sec == 0)
+ prevtime = kth->ktr_time;
+ temp = kth->ktr_time;
+ timevalsub(&kth->ktr_time, &prevtime);
+ if ((intmax_t)kth->ktr_time.tv_sec < 0) {
+ kth->ktr_time = prevtime;
+ prevtime = temp;
+ timevalsub(&kth->ktr_time, &prevtime);
+ sign = "-";
+ } else {
+ prevtime = temp;
+ sign = "";
+ }
+ printf("%s%jd.%06ld ", sign, (intmax_t)kth->ktr_time.tv_sec,
+ kth->ktr_time.tv_usec);
+ }
+ }
+ printf("%s ", type);
+}
+
+#include <sys/syscall.h>
+
+static void
+ioctlname(unsigned long val)
+{
+ const char *str;
+
+ str = sysdecode_ioctlname(val);
+ if (str != NULL)
+ printf("%s", str);
+ else if (decimal)
+ printf("%lu", val);
+ else
+ printf("%#lx", val);
+}
+
+static enum sysdecode_abi
+syscallabi(u_int sv_flags)
+{
+
+ if (sv_flags == 0)
+ return (SYSDECODE_ABI_FREEBSD);
+ switch (sv_flags & SV_ABI_MASK) {
+ case SV_ABI_FREEBSD:
+ return (SYSDECODE_ABI_FREEBSD);
+#if defined(__amd64__) || defined(__i386__)
+ case SV_ABI_LINUX:
+#ifdef __amd64__
+ if (sv_flags & SV_ILP32)
+ return (SYSDECODE_ABI_LINUX32);
+#endif
+ return (SYSDECODE_ABI_LINUX);
+#endif
+#if defined(__aarch64__) || defined(__amd64__)
+ case SV_ABI_CLOUDABI:
+ return (SYSDECODE_ABI_CLOUDABI64);
+#endif
+ default:
+ return (SYSDECODE_ABI_UNKNOWN);
+ }
+}
+
+static void
+syscallname(u_int code, u_int sv_flags)
+{
+ const char *name;
+
+ name = sysdecode_syscallname(syscallabi(sv_flags), code);
+ if (name == NULL)
+ printf("[%d]", code);
+ else {
+ printf("%s", name);
+ if (syscallno)
+ printf("[%d]", code);
+ }
+}
+
+void
+ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
+{
+ int narg = ktr->ktr_narg;
+ register_t *ip;
+ intmax_t arg;
+
+ syscallname(ktr->ktr_code, sv_flags);
+ ip = &ktr->ktr_args[0];
+ if (narg) {
+ char c = '(';
+ if (fancy &&
+ (sv_flags == 0 ||
+ (sv_flags & SV_ABI_MASK) == SV_ABI_FREEBSD)) {
+ switch (ktr->ktr_code) {
+ case SYS_bindat:
+ case SYS_connectat:
+ case SYS_faccessat:
+ case SYS_fchmodat:
+ case SYS_fchownat:
+ case SYS_fstatat:
+ case SYS_futimesat:
+ case SYS_linkat:
+ case SYS_mkdirat:
+ case SYS_mkfifoat:
+ case SYS_mknodat:
+ case SYS_openat:
+ case SYS_readlinkat:
+ case SYS_renameat:
+ case SYS_unlinkat:
+ case SYS_utimensat:
+ putchar('(');
+ atfdname(*ip, decimal);
+ c = ',';
+ ip++;
+ narg--;
+ break;
+ }
+ switch (ktr->ktr_code) {
+ case SYS_ioctl: {
+ print_number(ip, narg, c);
+ putchar(c);
+ ioctlname(*ip);
+ c = ',';
+ ip++;
+ narg--;
+ break;
+ }
+ case SYS_ptrace:
+ putchar('(');
+ ptraceopname(*ip);
+ c = ',';
+ ip++;
+ narg--;
+ break;
+ case SYS_access:
+ case SYS_eaccess:
+ case SYS_faccessat:
+ print_number(ip, narg, c);
+ putchar(',');
+ accessmodename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_open:
+ case SYS_openat:
+ print_number(ip, narg, c);
+ putchar(',');
+ flagsandmodename(ip[0], ip[1], decimal);
+ ip += 2;
+ narg -= 2;
+ break;
+ case SYS_wait4:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ /*
+ * A flags value of zero is valid for
+ * wait4() but not for wait6(), so
+ * handle zero special here.
+ */
+ if (*ip == 0) {
+ print_number(ip, narg, c);
+ } else {
+ putchar(',');
+ wait6optname(*ip);
+ ip++;
+ narg--;
+ }
+ break;
+ case SYS_wait6:
+ putchar('(');
+ idtypename(*ip, decimal);
+ c = ',';
+ ip++;
+ narg--;
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ wait6optname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_chmod:
+ case SYS_fchmod:
+ case SYS_lchmod:
+ case SYS_fchmodat:
+ print_number(ip, narg, c);
+ putchar(',');
+ modename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_mknod:
+ case SYS_mknodat:
+ print_number(ip, narg, c);
+ putchar(',');
+ modename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_getfsstat:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ getfsstatflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_mount:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ mountflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_unmount:
+ print_number(ip, narg, c);
+ putchar(',');
+ mountflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_recvmsg:
+ case SYS_sendmsg:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ sendrecvflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_recvfrom:
+ case SYS_sendto:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ sendrecvflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_chflags:
+ case SYS_fchflags:
+ case SYS_lchflags:
+ print_number(ip, narg, c);
+ putchar(',');
+ modename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_kill:
+ print_number(ip, narg, c);
+ putchar(',');
+ signame(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_reboot:
+ putchar('(');
+ rebootoptname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_umask:
+ putchar('(');
+ modename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_msync:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ msyncflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+#ifdef SYS_freebsd6_mmap
+ case SYS_freebsd6_mmap:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ mmapprotname(*ip);
+ putchar(',');
+ ip++;
+ narg--;
+ mmapflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+#endif
+ case SYS_mmap:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ mmapprotname(*ip);
+ putchar(',');
+ ip++;
+ narg--;
+ mmapflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_mprotect:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ mmapprotname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_madvise:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ madvisebehavname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_setpriority:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ prioname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_fcntl:
+ print_number(ip, narg, c);
+ putchar(',');
+ fcntlcmdname(ip[0], ip[1], decimal);
+ ip += 2;
+ narg -= 2;
+ break;
+ case SYS_socket: {
+ int sockdomain;
+ putchar('(');
+ sockdomain = *ip;
+ sockdomainname(sockdomain);
+ ip++;
+ narg--;
+ putchar(',');
+ socktypenamewithflags(*ip);
+ ip++;
+ narg--;
+ if (sockdomain == PF_INET ||
+ sockdomain == PF_INET6) {
+ putchar(',');
+ sockipprotoname(*ip);
+ ip++;
+ narg--;
+ }
+ c = ',';
+ break;
+ }
+ case SYS_setsockopt:
+ case SYS_getsockopt:
+ print_number(ip, narg, c);
+ putchar(',');
+ sockoptlevelname(*ip, decimal);
+ if (*ip == SOL_SOCKET) {
+ ip++;
+ narg--;
+ putchar(',');
+ sockoptname(*ip);
+ }
+ ip++;
+ narg--;
+ break;
+#ifdef SYS_freebsd6_lseek
+ case SYS_freebsd6_lseek:
+ print_number(ip, narg, c);
+ /* Hidden 'pad' argument, not in lseek(2) */
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ whencename(*ip);
+ ip++;
+ narg--;
+ break;
+#endif
+ case SYS_lseek:
+ print_number(ip, narg, c);
+ /* Hidden 'pad' argument, not in lseek(2) */
+ print_number(ip, narg, c);
+ putchar(',');
+ whencename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_flock:
+ print_number(ip, narg, c);
+ putchar(',');
+ flockname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_mkfifo:
+ case SYS_mkfifoat:
+ case SYS_mkdir:
+ case SYS_mkdirat:
+ print_number(ip, narg, c);
+ putchar(',');
+ modename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_shutdown:
+ print_number(ip, narg, c);
+ putchar(',');
+ shutdownhowname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_socketpair:
+ putchar('(');
+ sockdomainname(*ip);
+ ip++;
+ narg--;
+ putchar(',');
+ socktypenamewithflags(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_getrlimit:
+ case SYS_setrlimit:
+ putchar('(');
+ rlimitname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_quotactl:
+ print_number(ip, narg, c);
+ putchar(',');
+ quotactlname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_nfssvc:
+ putchar('(');
+ nfssvcname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_rtprio:
+ putchar('(');
+ rtprioname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS___semctl:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ semctlname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_semget:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ semgetname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_msgctl:
+ print_number(ip, narg, c);
+ putchar(',');
+ shmctlname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_shmat:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ shmatname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_shmctl:
+ print_number(ip, narg, c);
+ putchar(',');
+ shmctlname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_shm_open:
+ print_number(ip, narg, c);
+ putchar(',');
+ flagsname(ip[0]);
+ printf(",0%o", (unsigned int)ip[1]);
+ ip += 3;
+ narg -= 3;
+ break;
+ case SYS_minherit:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ minheritname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_rfork:
+ putchar('(');
+ rforkname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_lio_listio:
+ putchar('(');
+ lio_listioname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_mlockall:
+ putchar('(');
+ mlockallname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_sched_setscheduler:
+ print_number(ip, narg, c);
+ putchar(',');
+ schedpolicyname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_sched_get_priority_max:
+ case SYS_sched_get_priority_min:
+ putchar('(');
+ schedpolicyname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_sendfile:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ sendfileflagsname(*(int *)ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_kldsym:
+ print_number(ip, narg, c);
+ putchar(',');
+ kldsymcmdname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_sigprocmask:
+ putchar('(');
+ sigprocmaskhowname(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS___acl_get_file:
+ case SYS___acl_set_file:
+ case SYS___acl_get_fd:
+ case SYS___acl_set_fd:
+ case SYS___acl_delete_file:
+ case SYS___acl_delete_fd:
+ case SYS___acl_aclcheck_file:
+ case SYS___acl_aclcheck_fd:
+ case SYS___acl_get_link:
+ case SYS___acl_set_link:
+ case SYS___acl_delete_link:
+ case SYS___acl_aclcheck_link:
+ print_number(ip, narg, c);
+ putchar(',');
+ acltypename(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_sigaction:
+ putchar('(');
+ signame(*ip);
+ ip++;
+ narg--;
+ c = ',';
+ break;
+ case SYS_extattrctl:
+ print_number(ip, narg, c);
+ putchar(',');
+ extattrctlname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_nmount:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ mountflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_thr_create:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ putchar(',');
+ thrcreateflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_thr_kill:
+ print_number(ip, narg, c);
+ putchar(',');
+ signame(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_kldunloadf:
+ print_number(ip, narg, c);
+ putchar(',');
+ kldunloadfflagsname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_linkat:
+ case SYS_renameat:
+ case SYS_symlinkat:
+ print_number(ip, narg, c);
+ putchar(',');
+ atfdname(*ip, decimal);
+ ip++;
+ narg--;
+ break;
+ case SYS_cap_fcntls_limit:
+ print_number(ip, narg, c);
+ putchar(',');
+ arg = *ip;
+ ip++;
+ narg--;
+ capfcntlname(arg);
+ break;
+ case SYS_posix_fadvise:
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ print_number(ip, narg, c);
+ (void)putchar(',');
+ fadvisebehavname((int)*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS_procctl:
+ putchar('(');
+ idtypename(*ip, decimal);
+ c = ',';
+ ip++;
+ narg--;
+ print_number(ip, narg, c);
+ putchar(',');
+ procctlcmdname(*ip);
+ ip++;
+ narg--;
+ break;
+ case SYS__umtx_op:
+ print_number(ip, narg, c);
+ putchar(',');
+ umtxopname(*ip);
+ switch (*ip) {
+ case UMTX_OP_CV_WAIT:
+ ip++;
+ narg--;
+ putchar(',');
+ umtxcvwaitflags(*ip);
+ break;
+ case UMTX_OP_RW_RDLOCK:
+ ip++;
+ narg--;
+ putchar(',');
+ umtxrwlockflags(*ip);
+ break;
+ }
+ ip++;
+ narg--;
+ }
+ }
+ while (narg > 0) {
+ print_number(ip, narg, c);
+ }
+ putchar(')');
+ }
+ putchar('\n');
+}
+
+void
+ktrsysret(struct ktr_sysret *ktr, u_int sv_flags)
+{
+ register_t ret = ktr->ktr_retval;
+ int error = ktr->ktr_error;
+
+ syscallname(ktr->ktr_code, sv_flags);
+ printf(" ");
+
+ if (error == 0) {
+ if (fancy) {
+ printf("%ld", (long)ret);
+ if (ret < 0 || ret > 9)
+ printf("/%#lx", (unsigned long)ret);
+ } else {
+ if (decimal)
+ printf("%ld", (long)ret);
+ else
+ printf("%#lx", (unsigned long)ret);
+ }
+ } else if (error == ERESTART)
+ printf("RESTART");
+ else if (error == EJUSTRETURN)
+ printf("JUSTRETURN");
+ else {
+ printf("-1 errno %d", sysdecode_freebsd_to_abi_errno(
+ syscallabi(sv_flags), error));
+ if (fancy)
+ printf(" %s", strerror(ktr->ktr_error));
+ }
+ putchar('\n');
+}
+
+void
+ktrnamei(char *cp, int len)
+{
+ printf("\"%.*s\"\n", len, cp);
+}
+
+void
+hexdump(char *p, int len, int screenwidth)
+{
+ int n, i;
+ int width;
+
+ width = 0;
+ do {
+ width += 2;
+ i = 13; /* base offset */
+ i += (width / 2) + 1; /* spaces every second byte */
+ i += (width * 2); /* width of bytes */
+ i += 3; /* " |" */
+ i += width; /* each byte */
+ i += 1; /* "|" */
+ } while (i < screenwidth);
+ width -= 2;
+
+ for (n = 0; n < len; n += width) {
+ for (i = n; i < n + width; i++) {
+ if ((i % width) == 0) { /* beginning of line */
+ printf(" 0x%04x", i);
+ }
+ if ((i % 2) == 0) {
+ printf(" ");
+ }
+ if (i < len)
+ printf("%02x", p[i] & 0xff);
+ else
+ printf(" ");
+ }
+ printf(" |");
+ for (i = n; i < n + width; i++) {
+ if (i >= len)
+ break;
+ if (p[i] >= ' ' && p[i] <= '~')
+ printf("%c", p[i]);
+ else
+ printf(".");
+ }
+ printf("|\n");
+ }
+ if ((i % width) != 0)
+ printf("\n");
+}
+
+void
+visdump(char *dp, int datalen, int screenwidth)
+{
+ int col = 0;
+ char *cp;
+ int width;
+ char visbuf[5];
+
+ printf(" \"");
+ col = 8;
+ for (;datalen > 0; datalen--, dp++) {
+ vis(visbuf, *dp, VIS_CSTYLE, *(dp+1));
+ cp = visbuf;
+ /*
+ * Keep track of printables and
+ * space chars (like fold(1)).
+ */
+ if (col == 0) {
+ putchar('\t');
+ col = 8;
+ }
+ switch(*cp) {
+ case '\n':
+ col = 0;
+ putchar('\n');
+ continue;
+ case '\t':
+ width = 8 - (col&07);
+ break;
+ default:
+ width = strlen(cp);
+ }
+ if (col + width > (screenwidth-2)) {
+ printf("\\\n\t");
+ col = 8;
+ }
+ col += width;
+ do {
+ putchar(*cp++);
+ } while (*cp);
+ }
+ if (col == 0)
+ printf(" ");
+ printf("\"\n");
+}
+
+void
+ktrgenio(struct ktr_genio *ktr, int len)
+{
+ int datalen = len - sizeof (struct ktr_genio);
+ char *dp = (char *)ktr + sizeof (struct ktr_genio);
+ static int screenwidth = 0;
+ int i, binary;
+
+ printf("fd %d %s %d byte%s\n", ktr->ktr_fd,
+ ktr->ktr_rw == UIO_READ ? "read" : "wrote", datalen,
+ datalen == 1 ? "" : "s");
+ if (suppressdata)
+ return;
+ if (screenwidth == 0) {
+ struct winsize ws;
+
+ if (fancy && ioctl(fileno(stderr), TIOCGWINSZ, &ws) != -1 &&
+ ws.ws_col > 8)
+ screenwidth = ws.ws_col;
+ else
+ screenwidth = 80;
+ }
+ if (maxdata && datalen > maxdata)
+ datalen = maxdata;
+
+ for (i = 0, binary = 0; i < datalen && binary == 0; i++) {
+ if (dp[i] >= 32 && dp[i] < 127)
+ continue;
+ if (dp[i] == 10 || dp[i] == 13 || dp[i] == 0 || dp[i] == 9)
+ continue;
+ binary = 1;
+ }
+ if (binary)
+ hexdump(dp, datalen, screenwidth);
+ else
+ visdump(dp, datalen, screenwidth);
+}
+
+const char *signames[] = {
+ "NULL", "HUP", "INT", "QUIT", "ILL", "TRAP", "IOT", /* 1 - 6 */
+ "EMT", "FPE", "KILL", "BUS", "SEGV", "SYS", /* 7 - 12 */
+ "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", /* 13 - 18 */
+ "CONT", "CHLD", "TTIN", "TTOU", "IO", "XCPU", /* 19 - 24 */
+ "XFSZ", "VTALRM", "PROF", "WINCH", "29", "USR1", /* 25 - 30 */
+ "USR2", NULL, /* 31 - 32 */
+};
+
+void
+ktrpsig(struct ktr_psig *psig)
+{
+ if (psig->signo > 0 && psig->signo < NSIG)
+ printf("SIG%s ", signames[psig->signo]);
+ else
+ printf("SIG %d ", psig->signo);
+ if (psig->action == SIG_DFL) {
+ printf("SIG_DFL code=");
+ sigcodename(psig->signo, psig->code);
+ putchar('\n');
+ } else {
+ printf("caught handler=0x%lx mask=0x%x code=",
+ (u_long)psig->action, psig->mask.__bits[0]);
+ sigcodename(psig->signo, psig->code);
+ putchar('\n');
+ }
+}
+
+void
+ktrcsw_old(struct ktr_csw_old *cs)
+{
+ printf("%s %s\n", cs->out ? "stop" : "resume",
+ cs->user ? "user" : "kernel");
+}
+
+void
+ktrcsw(struct ktr_csw *cs)
+{
+ printf("%s %s \"%s\"\n", cs->out ? "stop" : "resume",
+ cs->user ? "user" : "kernel", cs->wmesg);
+}
+
+void
+ktruser(int len, void *p)
+{
+ unsigned char *cp;
+
+ if (sysdecode_utrace(stdout, p, len)) {
+ printf("\n");
+ return;
+ }
+
+ printf("%d ", len);
+ cp = p;
+ while (len--)
+ if (decimal)
+ printf(" %d", *cp++);
+ else
+ printf(" %02x", *cp++);
+ printf("\n");
+}
+
+void
+ktrcaprights(cap_rights_t *rightsp)
+{
+
+ printf("cap_rights_t ");
+ capname(rightsp);
+ printf("\n");
+}
+
+void
+ktrsockaddr(struct sockaddr *sa)
+{
+/*
+ TODO: Support additional address families
+ #include <netnatm/natm.h>
+ struct sockaddr_natm *natm;
+ #include <netsmb/netbios.h>
+ struct sockaddr_nb *nb;
+*/
+ char addr[64];
+
+ /*
+ * note: ktrstruct() has already verified that sa points to a
+ * buffer at least sizeof(struct sockaddr) bytes long and exactly
+ * sa->sa_len bytes long.
+ */
+ printf("struct sockaddr { ");
+ sockfamilyname(sa->sa_family);
+ printf(", ");
+
+#define check_sockaddr_len(n) \
+ if (sa_##n.s##n##_len < sizeof(struct sockaddr_##n)) { \
+ printf("invalid"); \
+ break; \
+ }
+
+ switch(sa->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in sa_in;
+
+ memset(&sa_in, 0, sizeof(sa_in));
+ memcpy(&sa_in, sa, sa->sa_len);
+ check_sockaddr_len(in);
+ inet_ntop(AF_INET, &sa_in.sin_addr, addr, sizeof addr);
+ printf("%s:%u", addr, ntohs(sa_in.sin_port));
+ break;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 sa_in6;
+
+ memset(&sa_in6, 0, sizeof(sa_in6));
+ memcpy(&sa_in6, sa, sa->sa_len);
+ check_sockaddr_len(in6);
+ getnameinfo((struct sockaddr *)&sa_in6, sizeof(sa_in6),
+ addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
+ printf("[%s]:%u", addr, htons(sa_in6.sin6_port));
+ break;
+ }
+ case AF_UNIX: {
+ struct sockaddr_un sa_un;
+
+ memset(&sa_un, 0, sizeof(sa_un));
+ memcpy(&sa_un, sa, sa->sa_len);
+ printf("%.*s", (int)sizeof(sa_un.sun_path), sa_un.sun_path);
+ break;
+ }
+ default:
+ printf("unknown address family");
+ }
+ printf(" }\n");
+}
+
+void
+ktrstat(struct stat *statp)
+{
+ char mode[12], timestr[PATH_MAX + 4];
+ struct passwd *pwd;
+ struct group *grp;
+ struct tm *tm;
+
+ /*
+ * note: ktrstruct() has already verified that statp points to a
+ * buffer exactly sizeof(struct stat) bytes long.
+ */
+ printf("struct stat {");
+ printf("dev=%ju, ino=%ju, ",
+ (uintmax_t)statp->st_dev, (uintmax_t)statp->st_ino);
+ if (resolv == 0)
+ printf("mode=0%jo, ", (uintmax_t)statp->st_mode);
+ else {
+ strmode(statp->st_mode, mode);
+ printf("mode=%s, ", mode);
+ }
+ printf("nlink=%ju, ", (uintmax_t)statp->st_nlink);
+ if (resolv == 0) {
+ pwd = NULL;
+ } else {
+#ifdef HAVE_LIBCASPER
+ if (cappwd != NULL)
+ pwd = cap_getpwuid(cappwd, statp->st_uid);
+ else
+#endif
+ pwd = getpwuid(statp->st_uid);
+ }
+ if (pwd == NULL)
+ printf("uid=%ju, ", (uintmax_t)statp->st_uid);
+ else
+ printf("uid=\"%s\", ", pwd->pw_name);
+ if (resolv == 0) {
+ grp = NULL;
+ } else {
+#ifdef HAVE_LIBCASPER
+ if (capgrp != NULL)
+ grp = cap_getgrgid(capgrp, statp->st_gid);
+ else
+#endif
+ grp = getgrgid(statp->st_gid);
+ }
+ if (grp == NULL)
+ printf("gid=%ju, ", (uintmax_t)statp->st_gid);
+ else
+ printf("gid=\"%s\", ", grp->gr_name);
+ printf("rdev=%ju, ", (uintmax_t)statp->st_rdev);
+ printf("atime=");
+ if (resolv == 0)
+ printf("%jd", (intmax_t)statp->st_atim.tv_sec);
+ else {
+ tm = localtime(&statp->st_atim.tv_sec);
+ strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
+ printf("\"%s\"", timestr);
+ }
+ if (statp->st_atim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_atim.tv_nsec);
+ else
+ printf(", ");
+ printf("mtime=");
+ if (resolv == 0)
+ printf("%jd", (intmax_t)statp->st_mtim.tv_sec);
+ else {
+ tm = localtime(&statp->st_mtim.tv_sec);
+ strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
+ printf("\"%s\"", timestr);
+ }
+ if (statp->st_mtim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_mtim.tv_nsec);
+ else
+ printf(", ");
+ printf("ctime=");
+ if (resolv == 0)
+ printf("%jd", (intmax_t)statp->st_ctim.tv_sec);
+ else {
+ tm = localtime(&statp->st_ctim.tv_sec);
+ strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
+ printf("\"%s\"", timestr);
+ }
+ if (statp->st_ctim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_ctim.tv_nsec);
+ else
+ printf(", ");
+ printf("birthtime=");
+ if (resolv == 0)
+ printf("%jd", (intmax_t)statp->st_birthtim.tv_sec);
+ else {
+ tm = localtime(&statp->st_birthtim.tv_sec);
+ strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
+ printf("\"%s\"", timestr);
+ }
+ if (statp->st_birthtim.tv_nsec != 0)
+ printf(".%09ld, ", statp->st_birthtim.tv_nsec);
+ else
+ printf(", ");
+ printf("size=%jd, blksize=%ju, blocks=%jd, flags=0x%x",
+ (uintmax_t)statp->st_size, (uintmax_t)statp->st_blksize,
+ (intmax_t)statp->st_blocks, statp->st_flags);
+ printf(" }\n");
+}
+
+void
+ktrstruct(char *buf, size_t buflen)
+{
+ char *name, *data;
+ size_t namelen, datalen;
+ int i;
+ cap_rights_t rights;
+ struct stat sb;
+ struct sockaddr_storage ss;
+
+ for (name = buf, namelen = 0;
+ namelen < buflen && name[namelen] != '\0';
+ ++namelen)
+ /* nothing */;
+ if (namelen == buflen)
+ goto invalid;
+ if (name[namelen] != '\0')
+ goto invalid;
+ data = buf + namelen + 1;
+ datalen = buflen - namelen - 1;
+ if (datalen == 0)
+ goto invalid;
+ /* sanity check */
+ for (i = 0; i < (int)namelen; ++i)
+ if (!isalpha(name[i]))
+ goto invalid;
+ if (strcmp(name, "caprights") == 0) {
+ if (datalen != sizeof(cap_rights_t))
+ goto invalid;
+ memcpy(&rights, data, datalen);
+ ktrcaprights(&rights);
+ } else if (strcmp(name, "stat") == 0) {
+ if (datalen != sizeof(struct stat))
+ goto invalid;
+ memcpy(&sb, data, datalen);
+ ktrstat(&sb);
+ } else if (strcmp(name, "sockaddr") == 0) {
+ if (datalen > sizeof(ss))
+ goto invalid;
+ memcpy(&ss, data, datalen);
+ if (datalen != ss.ss_len)
+ goto invalid;
+ ktrsockaddr((struct sockaddr *)&ss);
+ } else {
+ printf("unknown structure\n");
+ }
+ return;
+invalid:
+ printf("invalid record\n");
+}
+
+void
+ktrcapfail(struct ktr_cap_fail *ktr)
+{
+ switch (ktr->cap_type) {
+ case CAPFAIL_NOTCAPABLE:
+ /* operation on fd with insufficient capabilities */
+ printf("operation requires ");
+ capname(&ktr->cap_needed);
+ printf(", descriptor holds ");
+ capname(&ktr->cap_held);
+ break;
+ case CAPFAIL_INCREASE:
+ /* requested more capabilities than fd already has */
+ printf("attempt to increase capabilities from ");
+ capname(&ktr->cap_held);
+ printf(" to ");
+ capname(&ktr->cap_needed);
+ break;
+ case CAPFAIL_SYSCALL:
+ /* called restricted syscall */
+ printf("disallowed system call");
+ break;
+ case CAPFAIL_LOOKUP:
+ /* used ".." in strict-relative mode */
+ printf("restricted VFS lookup");
+ break;
+ default:
+ printf("unknown capability failure: ");
+ capname(&ktr->cap_needed);
+ printf(" ");
+ capname(&ktr->cap_held);
+ break;
+ }
+ printf("\n");
+}
+
+void
+ktrfault(struct ktr_fault *ktr)
+{
+
+ printf("0x%jx ", (uintmax_t)ktr->vaddr);
+ vmprotname(ktr->type);
+ printf("\n");
+}
+
+void
+ktrfaultend(struct ktr_faultend *ktr)
+{
+
+ vmresultname(ktr->result);
+ printf("\n");
+}
+
+void
+usage(void)
+{
+ fprintf(stderr, "usage: kdump [-dEnlHRrSsTA] [-f trfile] "
+ "[-m maxdata] [-p pid] [-t trstr]\n");
+ exit(1);
+}
diff --git a/usr.bin/kdump/linux32_syscalls.conf b/usr.bin/kdump/linux32_syscalls.conf
new file mode 100644
index 0000000..66a67fd
--- /dev/null
+++ b/usr.bin/kdump/linux32_syscalls.conf
@@ -0,0 +1,11 @@
+# $FreeBSD$
+sysnames="linux32_syscalls.c"
+sysproto="/dev/null"
+sysproto_h=_LINUX32_SYSPROTO_H_
+syshdr="/dev/null"
+syssw="/dev/null"
+sysmk="/dev/null"
+syscallprefix="LINUX32_SYS_"
+switchname="/dev/null"
+namesname="linux32_syscallnames"
+systrace="/dev/null"
diff --git a/usr.bin/kdump/linux_syscalls.conf b/usr.bin/kdump/linux_syscalls.conf
new file mode 100644
index 0000000..82adb56
--- /dev/null
+++ b/usr.bin/kdump/linux_syscalls.conf
@@ -0,0 +1,11 @@
+# $FreeBSD$
+sysnames="linux_syscalls.c"
+sysproto="/dev/null"
+sysproto_h=_LINUX_SYSPROTO_H_
+syshdr="/dev/null"
+syssw="/dev/null"
+sysmk="/dev/null"
+syscallprefix="LINUX_SYS_"
+switchname="/dev/null"
+namesname="linux_syscallnames"
+systrace="/dev/null"
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr
new file mode 100644
index 0000000..aa001f8
--- /dev/null
+++ b/usr.bin/kdump/mksubr
@@ -0,0 +1,759 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 "David Kirchner" <dpk@dpk.net>. 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$
+#
+# Generates kdump_subr.c
+# mkioctls is a special-purpose script, and works fine as it is
+# now, so it remains independent. The idea behind how it generates
+# its list was heavily borrowed here.
+#
+# Some functions here are automatically generated. This can mean
+# the user will see unusual kdump output or errors while building
+# if the underlying .h files are changed significantly.
+#
+# Key:
+# AUTO: Completely auto-generated with either the "or" or the "switch"
+# method.
+# AUTO - Special: Generated automatically, but with some extra commands
+# that the auto_*_type() functions are inappropriate for.
+# MANUAL: Manually entered and must therefore be manually updated.
+
+set -e
+
+LC_ALL=C; export LC_ALL
+
+if [ -z "$1" ]
+then
+ echo "usage: sh $0 include-dir"
+ exit 1
+fi
+include_dir=$1
+
+#
+# Automatically generates a C function that will print out the
+# numeric input as a pipe-delimited string of the appropriate
+# #define keys. ex:
+# S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH
+# The XOR is necessary to prevent including the "0"-value in every
+# line.
+#
+auto_or_type () {
+ local name grep file
+ name=$1
+ grep=$2
+ file=$3
+
+ cat <<_EOF_
+/* AUTO */
+void
+$name(intmax_t arg)
+{
+ int or = 0;
+ printf("%#jx<", (uintmax_t)arg);
+_EOF_
+ egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
+ $include_dir/$file | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
+cat <<_EOF_
+ printf(">");
+ if (or == 0)
+ printf("<invalid>%jd", arg);
+}
+
+_EOF_
+}
+
+#
+# Automatically generates a C function used when the argument
+# maps to a single, specific #definition
+#
+auto_switch_type () {
+ local name grep file
+ name=$1
+ grep=$2
+ file=$3
+
+ cat <<_EOF_
+/* AUTO */
+void
+$name(intmax_t arg)
+{
+ switch (arg) {
+_EOF_
+ egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
+ $include_dir/$file | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
+cat <<_EOF_
+ default: /* Should not reach */
+ printf("<invalid=%jd>", arg);
+ }
+}
+
+_EOF_
+}
+
+#
+# Automatically generates a C function used when the argument
+# maps to a #definition
+#
+auto_if_type () {
+ local name grep file
+ name=$1
+ grep=$2
+ file=$3
+
+ cat <<_EOF_
+/* AUTO */
+void
+$name(intmax_t arg)
+{
+_EOF_
+ egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
+ $include_dir/$file | \
+ awk '{ printf "\t"; \
+ if (NR > 1) \
+ printf "else " ; \
+ printf "if (arg == %s) \n\t\tprintf(\"%s\");\n", $2, $2 }'
+cat <<_EOF_
+ else /* Should not reach */
+ printf("<invalid=%jd>", arg);
+}
+
+_EOF_
+}
+
+# C start
+
+cat <<_EOF_
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#define _KERNEL
+#include <sys/socket.h>
+#undef _KERNEL
+#include <netinet/in.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/procctl.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/reboot.h>
+#include <sched.h>
+#include <sys/linker.h>
+#define _KERNEL
+#include <sys/thr.h>
+#undef _KERNEL
+#include <sys/extattr.h>
+#include <sys/acl.h>
+#include <aio.h>
+#include <sys/sem.h>
+#include <sys/ipc.h>
+#include <sys/rtprio.h>
+#include <sys/shm.h>
+#include <sys/umtx.h>
+#include <nfsserver/nfs.h>
+#include <ufs/ufs/quota.h>
+#include <sys/capsicum.h>
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+
+#include "kdump_subr.h"
+
+/*
+ * These are simple support macros. print_or utilizes a variable
+ * defined in the calling function to track whether or not it should
+ * print a logical-OR character ('|') before a string. if_print_or
+ * simply handles the necessary "if" statement used in many lines
+ * of this file.
+ */
+#define print_or(str,orflag) do { \\
+ if (orflag) putchar('|'); else orflag = 1; \\
+ printf (str); } \\
+ while (0)
+#define if_print_or(i,flag,orflag) do { \\
+ if ((i & flag) == flag) \\
+ print_or(#flag,orflag); } \\
+ while (0)
+
+/* MANUAL */
+void
+atfdname(int fd, int decimal)
+{
+ if (fd == AT_FDCWD)
+ printf("AT_FDCWD");
+ else if (decimal)
+ printf("%d", fd);
+ else
+ printf("%#x", fd);
+}
+
+/* MANUAL */
+extern char *signames[]; /* from kdump.c */
+void
+signame(int sig)
+{
+ if (sig > 0 && sig < NSIG)
+ printf("SIG%s",signames[sig]);
+ else
+ printf("SIG %d", sig);
+}
+
+/* MANUAL */
+void
+semctlname(int cmd)
+{
+ switch (cmd) {
+ case GETNCNT:
+ printf("GETNCNT");
+ break;
+ case GETPID:
+ printf("GETPID");
+ break;
+ case GETVAL:
+ printf("GETVAL");
+ break;
+ case GETALL:
+ printf("GETALL");
+ break;
+ case GETZCNT:
+ printf("GETZCNT");
+ break;
+ case SETVAL:
+ printf("SETVAL");
+ break;
+ case SETALL:
+ printf("SETALL");
+ break;
+ case IPC_RMID:
+ printf("IPC_RMID");
+ break;
+ case IPC_SET:
+ printf("IPC_SET");
+ break;
+ case IPC_STAT:
+ printf("IPC_STAT");
+ break;
+ default: /* Should not reach */
+ printf("<invalid=%d>", cmd);
+ }
+}
+
+/* MANUAL */
+void
+shmctlname(int cmd)
+{
+ switch (cmd) {
+ case IPC_RMID:
+ printf("IPC_RMID");
+ break;
+ case IPC_SET:
+ printf("IPC_SET");
+ break;
+ case IPC_STAT:
+ printf("IPC_STAT");
+ break;
+ default: /* Should not reach */
+ printf("<invalid=%d>", cmd);
+ }
+}
+
+/* MANUAL */
+void
+semgetname(int flag)
+{
+ int or = 0;
+ if_print_or(flag, IPC_CREAT, or);
+ if_print_or(flag, IPC_EXCL, or);
+ if_print_or(flag, SEM_R, or);
+ if_print_or(flag, SEM_A, or);
+ if_print_or(flag, (SEM_R>>3), or);
+ if_print_or(flag, (SEM_A>>3), or);
+ if_print_or(flag, (SEM_R>>6), or);
+ if_print_or(flag, (SEM_A>>6), or);
+}
+
+/*
+ * MANUAL
+ *
+ * Only used by SYS_open. Unless O_CREAT is set in flags, the
+ * mode argument is unused (and often bogus and misleading).
+ */
+void
+flagsandmodename(int flags, int mode, int decimal)
+{
+ flagsname(flags);
+ putchar(',');
+ if ((flags & O_CREAT) == O_CREAT) {
+ modename (mode);
+ } else {
+ if (decimal) {
+ printf("<unused>%d", mode);
+ } else {
+ printf("<unused>%#x", (unsigned int)mode);
+ }
+ }
+}
+
+/* MANUAL */
+void
+idtypename(idtype_t idtype, int decimal)
+{
+ switch(idtype) {
+ case P_PID:
+ printf("P_PID");
+ break;
+ case P_PPID:
+ printf("P_PPID");
+ break;
+ case P_PGID:
+ printf("P_PGID");
+ break;
+ case P_SID:
+ printf("P_SID");
+ break;
+ case P_CID:
+ printf("P_CID");
+ break;
+ case P_UID:
+ printf("P_UID");
+ break;
+ case P_GID:
+ printf("P_GID");
+ break;
+ case P_ALL:
+ printf("P_ALL");
+ break;
+ case P_LWPID:
+ printf("P_LWPID");
+ break;
+ case P_TASKID:
+ printf("P_TASKID");
+ break;
+ case P_PROJID:
+ printf("P_PROJID");
+ break;
+ case P_POOLID:
+ printf("P_POOLID");
+ break;
+ case P_JAILID:
+ printf("P_JAILID");
+ break;
+ case P_CTID:
+ printf("P_CTID");
+ break;
+ case P_CPUID:
+ printf("P_CPUID");
+ break;
+ case P_PSETID:
+ printf("P_PSETID");
+ break;
+ default:
+ if (decimal) {
+ printf("%d", idtype);
+ } else {
+ printf("%#x", idtype);
+ }
+ }
+}
+
+/*
+ * MANUAL
+ *
+ * [g|s]etsockopt's level argument can either be SOL_SOCKET or a value
+ * referring to a line in /etc/protocols . It might be appropriate
+ * to use getprotoent(3) here.
+ */
+void
+sockoptlevelname(int level, int decimal)
+{
+ if (level == SOL_SOCKET) {
+ printf("SOL_SOCKET");
+ } else {
+ if (decimal) {
+ printf("%d", level);
+ } else {
+ printf("%#x", (unsigned int)level);
+ }
+ }
+}
+
+/*
+ * MANUAL
+ *
+ * Used for page fault type. Cannot use auto_or_type since the macro
+ * values contain a cast. Also, VM_PROT_NONE has to be handled specially.
+ */
+void
+vmprotname (int type)
+{
+ int or = 0;
+
+ if (type == VM_PROT_NONE) {
+ (void)printf("VM_PROT_NONE");
+ return;
+ }
+ if_print_or(type, VM_PROT_READ, or);
+ if_print_or(type, VM_PROT_WRITE, or);
+ if_print_or(type, VM_PROT_EXECUTE, or);
+ if_print_or(type, VM_PROT_COPY, or);
+}
+
+/*
+ * MANUAL
+ */
+void
+socktypenamewithflags(int type)
+{
+ if (type & SOCK_CLOEXEC)
+ printf("SOCK_CLOEXEC|"), type &= ~SOCK_CLOEXEC;
+ if (type & SOCK_NONBLOCK)
+ printf("SOCK_NONBLOCK|"), type &= ~SOCK_NONBLOCK;
+ socktypename(type);
+}
+_EOF_
+
+auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h"
+auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
+auto_or_type "capfcntlname" "CAP_FCNTL_[A-Z]+[[:space:]]+\(1" "sys/capsicum.h"
+auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
+auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
+auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h"
+auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
+auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h"
+auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
+auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
+auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h"
+auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
+auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
+auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
+auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
+auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h"
+auto_or_type "mountflagsname" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
+auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
+auto_or_type "nfssvcname" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
+auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
+auto_switch_type "procctlcmdname" "PROC_[A-Z]+[[:space:]]+[0-9]" "sys/procctl.h"
+auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
+auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h"
+auto_or_type "rebootoptname" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h"
+auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h"
+auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h"
+auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h"
+auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
+auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
+auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
+auto_switch_type "sigbuscodename" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigchldcodename" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigfpecodename" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigillcodename" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigsegvcodename" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigtrapcodename" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
+auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
+auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
+auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
+auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h"
+auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h"
+auto_switch_type "umtxopname" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h"
+auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h"
+auto_or_type "wait6optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h"
+auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h"
+
+cat <<_EOF_
+/*
+ * AUTO - Special
+ * F_ is used to specify fcntl commands as well as arguments. Both sets are
+ * grouped in fcntl.h, and this awk script grabs the first group.
+ */
+void
+fcntlcmdname(int cmd, int arg, int decimal)
+{
+ switch (cmd) {
+_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]*" \
+ $include_dir/sys/fcntl.h | \
+ awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ if (o <= $(i+1)) \
+ printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i; \
+ else \
+ exit; \
+ o = $(i+1) }'
+cat <<_EOF_
+ default: /* Should not reach */
+ printf("<invalid=%d>", cmd);
+ }
+ putchar(',');
+ if (cmd == F_GETFD || cmd == F_SETFD) {
+ if (arg == FD_CLOEXEC)
+ printf("FD_CLOEXEC");
+ else if (arg == 0)
+ printf("0");
+ else {
+ if (decimal)
+ printf("<invalid>%d", arg);
+ else
+ printf("<invalid>%#x", (unsigned int)arg);
+ }
+ } else if (cmd == F_SETFL) {
+ flagsname(arg);
+ } else {
+ if (decimal)
+ printf("%d", arg);
+ else
+ printf("%#x", (unsigned int)arg);
+ }
+}
+
+/*
+ * AUTO - Special
+ *
+ * The MAP_ALIGNED flag requires special handling.
+ */
+void
+mmapflagsname(int flags)
+{
+ int align;
+ int or = 0;
+ printf("%#x<", flags);
+_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+[[:space:]]*" \
+ $include_dir/sys/mman.h | grep -v MAP_ALIGNED | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tif (!((flags > 0) ^ ((%s) > 0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }'
+cat <<_EOF_
+#ifdef MAP_32BIT
+ if (!((flags > 0) ^ ((MAP_32BIT) > 0)))
+ if_print_or(flags, MAP_32BIT, or);
+#endif
+ align = flags & MAP_ALIGNMENT_MASK;
+ if (align != 0) {
+ if (align == MAP_ALIGNED_SUPER)
+ print_or("MAP_ALIGNED_SUPER", or);
+ else {
+ print_or("MAP_ALIGNED", or);
+ printf("(%d)", align >> MAP_ALIGNMENT_SHIFT);
+ }
+ }
+ printf(">");
+ if (or == 0)
+ printf("<invalid>%d", flags);
+}
+
+/*
+ * AUTO - Special
+ *
+ * The only reason this is not fully automated is due to the
+ * grep -v RTP_PRIO statement. A better egrep line should
+ * make this capable of being a auto_switch_type() function.
+ */
+void
+rtprioname(int func)
+{
+ switch (func) {
+_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+RTP_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" \
+ $include_dir/sys/rtprio.h | grep -v RTP_PRIO | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
+cat <<_EOF_
+ default: /* Should not reach */
+ printf("<invalid=%d>", func);
+ }
+}
+
+/*
+ * AUTO - Special
+ *
+ * The send and recv functions have a flags argument which can be
+ * set to 0. There is no corresponding #define. The auto_ functions
+ * detect this as "invalid", which is incorrect here.
+ */
+void
+sendrecvflagsname(int flags)
+{
+ int or = 0;
+
+ if (flags == 0) {
+ printf("0");
+ return;
+ }
+
+ printf("%#x<", flags);
+_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }'
+cat <<_EOF_
+ printf(">");
+}
+
+/*
+ * AUTO - Special
+ *
+ * Check general codes first, then defer to signal-specific codes.
+ */
+void
+sigcodename(int sig, int code)
+{
+ switch (code) {
+_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?[[:space:]]*" \
+ $include_dir/sys/signal.h | grep -v SI_UNDEFINED | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
+cat <<_EOF_
+ default:
+ switch (sig) {
+ case SIGILL:
+ sigillcodename(code);
+ break;
+ case SIGBUS:
+ sigbuscodename(code);
+ break;
+ case SIGSEGV:
+ sigsegvcodename(code);
+ break;
+ case SIGFPE:
+ sigfpecodename(code);
+ break;
+ case SIGTRAP:
+ sigtrapcodename(code);
+ break;
+ case SIGCHLD:
+ sigchldcodename(code);
+ break;
+ default:
+ printf("<invalid=%#x>", code);
+ }
+ }
+}
+
+/*
+ * AUTO - Special
+ *
+ * Just print 0 as 0.
+ */
+void
+umtxcvwaitflags(intmax_t arg)
+{
+ int or = 0;
+ if (arg == 0) {
+ printf("0");
+ return;
+ }
+ printf("%#jx<", (uintmax_t)arg);
+_EOF_
+ egrep "^#[[:space:]]*define[[:space:]]+CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+[[:space:]]*" \
+ $include_dir/sys/umtx.h | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
+cat <<_EOF_
+ printf(">");
+ if (or == 0)
+ printf("<invalid>%jd", arg);
+}
+
+
+/*
+ * AUTO - Special
+ *
+ * Just print 0 as 0.
+ */
+void
+umtxrwlockflags(intmax_t arg)
+{
+ int or = 0;
+ if (arg == 0) {
+ printf("0");
+ return;
+ }
+ printf("%#jx<", (uintmax_t)arg);
+_EOF_
+ egrep "^#[[:space:]]*define[[:space:]]+URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+[[:space:]]*" \
+ $include_dir/sys/umtx.h | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
+cat <<_EOF_
+ printf(">");
+ if (or == 0)
+ printf("<invalid>%jd", arg);
+}
+_EOF_
+egrep '#define[[:space:]]+CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)' \
+ $include_dir/sys/capsicum.h | \
+ sed -E 's/[ ]+/ /g' | \
+ awk -F '[ \(,\)]' '
+ BEGIN {
+ printf "void\n"
+ printf "capname(const cap_rights_t *rightsp)\n"
+ printf "{\n"
+ printf "\tint comma = 0;\n\n"
+ printf "\tprintf(\"<\");\n"
+ }
+ {
+ printf "\tif ((rightsp->cr_rights[%s] & %s) == %s) {\n", $4, $2, $2
+ printf "\t\tif (comma) printf(\",\"); else comma = 1;\n"
+ printf "\t\tprintf(\"%s\");\n", $2
+ printf "\t}\n"
+ }
+ END {
+ printf "\tprintf(\">\");\n"
+ printf "}\n"
+ }'
diff --git a/usr.bin/keylogin/Makefile b/usr.bin/keylogin/Makefile
new file mode 100644
index 0000000..786efae
--- /dev/null
+++ b/usr.bin/keylogin/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= keylogin
+
+LIBADD= rpcsvc
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/keylogin/Makefile.depend b/usr.bin/keylogin/Makefile.depend
new file mode 100644
index 0000000..c8383bd
--- /dev/null
+++ b/usr.bin/keylogin/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/librpcsvc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/keylogin/keylogin.1 b/usr.bin/keylogin/keylogin.1
new file mode 100644
index 0000000..8a3927d
--- /dev/null
+++ b/usr.bin/keylogin/keylogin.1
@@ -0,0 +1,30 @@
+.\" @(#)keylogin.1 1.5 91/03/11 TIRPC 1.0;
+.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
+.\" $FreeBSD$
+.\"
+.Dd September 9, 1987
+.Dt KEYLOGIN 1
+.Os
+.Sh NAME
+.Nm keylogin
+.Nd decrypt and store secret key
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility prompts the user for their login password, and uses it to decrypt
+the user's secret key stored in the
+.Xr publickey 5
+database.
+Once decrypted, the user's key is stored by the local
+key server process
+.Xr keyserv 8
+to be used by any secure network services, such as NFS.
+.Sh SEE ALSO
+.Xr chkey 1 ,
+.Xr keylogout 1 ,
+.Xr login 1 ,
+.Xr publickey 5 ,
+.Xr keyserv 8 ,
+.Xr newkey 8
diff --git a/usr.bin/keylogin/keylogin.c b/usr.bin/keylogin/keylogin.c
new file mode 100644
index 0000000..3f4bdba
--- /dev/null
+++ b/usr.bin/keylogin/keylogin.c
@@ -0,0 +1,85 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+#if !defined(lint) && defined(SCCSIDS)
+static char sccsid[] = "@(#)keylogin.c 1.4 91/03/11 Copyr 1986 Sun Micro";
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+
+/*
+ * Set secret key on local machine
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <rpc/rpc.h>
+#include <rpc/key_prot.h>
+
+extern int key_setnet(struct key_netstarg *);
+
+int
+main(void)
+{
+ char fullname[MAXNETNAMELEN + 1];
+ struct key_netstarg netst;
+
+ if (!getnetname(fullname)) {
+ fprintf(stderr, "netname lookup failed -- make sure the ");
+ fprintf(stderr, "system domain name is set.\n");
+ exit(1);
+ }
+
+ if (! getsecretkey(fullname, (char *)&(netst.st_priv_key),
+ getpass("Password:"))) {
+ fprintf(stderr, "Can't find %s's secret key\n", fullname);
+ exit(1);
+ }
+ if (netst.st_priv_key[0] == 0) {
+ fprintf(stderr, "Password incorrect for %s\n", fullname);
+ exit(1);
+ }
+
+ netst.st_pub_key[0] = 0;
+ netst.st_netname = strdup(fullname);
+
+ if (key_setnet(&netst) < 0) {
+ fprintf(stderr, "Could not set %s's secret key\n", fullname);
+ fprintf(stderr, "Maybe the keyserver is down?\n");
+ exit(1);
+ }
+ exit(0);
+ /* NOTREACHED */
+}
diff --git a/usr.bin/keylogout/Makefile b/usr.bin/keylogout/Makefile
new file mode 100644
index 0000000..1f5feec
--- /dev/null
+++ b/usr.bin/keylogout/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= keylogout
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/keylogout/Makefile.depend b/usr.bin/keylogout/Makefile.depend
new file mode 100644
index 0000000..ddd5dbd
--- /dev/null
+++ b/usr.bin/keylogout/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ 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/keylogout/keylogout.1 b/usr.bin/keylogout/keylogout.1
new file mode 100644
index 0000000..6d643c9
--- /dev/null
+++ b/usr.bin/keylogout/keylogout.1
@@ -0,0 +1,42 @@
+.\" $FreeBSD$
+.\" @(#)keylogout.1 1.4 91/03/11 TIRPC 1.0; from 1.3 89/07/26 SMI;
+.Dd April 15, 1989
+.Dt KEYLOGOUT 1
+.Os
+.Sh NAME
+.Nm keylogout
+.Nd delete stored secret key
+.Sh SYNOPSIS
+.Nm
+.Op Fl f
+.Sh DESCRIPTION
+The
+.Nm
+utility deletes the key stored by the key server process
+.Xr keyserv 8
+to be used by any secure network services, such as NFS.
+Further access to the key is revoked,
+however current session keys may remain valid till they expire,
+or are refreshed.
+This option will cause any background jobs that need secure RPC
+services to fail, and any scheduled
+.Nm at
+jobs that need the key to fail.
+Also since only one copy is kept on a machine of the key,
+it is a bad idea to place this in your
+.Pa .logout
+file since it will affect other sessions on the same machine.
+.Pp
+The following option is available:
+.Bl -tag -width indent
+.It Fl f
+Forget the rootkey.
+This will break secure NFS if it is done on a server.
+.El
+.Sh SEE ALSO
+.Xr chkey 1 ,
+.Xr keylogin 1 ,
+.Xr login 1 ,
+.Xr publickey 5 ,
+.Xr keyserv 8 ,
+.Xr newkey 8
diff --git a/usr.bin/keylogout/keylogout.c b/usr.bin/keylogout/keylogout.c
new file mode 100644
index 0000000..c7ec049
--- /dev/null
+++ b/usr.bin/keylogout/keylogout.c
@@ -0,0 +1,69 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/*
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * unset the secret key on local machine
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <rpc/key_prot.h>
+
+int
+main(int argc, char **argv)
+{
+ static char secret[HEXKEYBYTES + 1];
+
+ if (geteuid() == 0) {
+ if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) {
+ fprintf(stderr,
+"keylogout by root would break all servers that use secure rpc!\n");
+ fprintf(stderr,
+"root may use keylogout -f to do this (at your own risk)!\n");
+ exit(1);
+ }
+ }
+
+ if (key_setsecret(secret) < 0) {
+ fprintf(stderr, "Could not unset your secret key.\n");
+ fprintf(stderr, "Maybe the keyserver is down?\n");
+ exit(1);
+ }
+ exit(0);
+ /* NOTREACHED */
+}
diff --git a/usr.bin/killall/Makefile b/usr.bin/killall/Makefile
new file mode 100644
index 0000000..890d7a1
--- /dev/null
+++ b/usr.bin/killall/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= killall
+LIBADD= jail
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/killall/Makefile.depend b/usr.bin/killall/Makefile.depend
new file mode 100644
index 0000000..41ef6ec
--- /dev/null
+++ b/usr.bin/killall/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libjail \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1
new file mode 100644
index 0000000..be813f7
--- /dev/null
+++ b/usr.bin/killall/killall.1
@@ -0,0 +1,178 @@
+.\" Copyright (C) 1995 by Joerg Wunsch, Dresden
+.\" 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(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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 30, 2013
+.Dt KILLALL 1
+.Os
+.Sh NAME
+.Nm killall
+.Nd kill processes by name
+.Sh SYNOPSIS
+.Nm
+.Op Fl delmsvz
+.Op Fl help
+.Op Fl I
+.Op Fl j Ar jail
+.Op Fl u Ar user
+.Op Fl t Ar tty
+.Op Fl c Ar procname
+.Op Fl Ar SIGNAL
+.Op Ar procname ...
+.Sh DESCRIPTION
+The
+.Nm
+utility kills processes selected by name, as opposed to the selection by PID
+as done by
+.Xr kill 1 .
+By default, it will send a
+.Dv TERM
+signal to all processes with a real UID identical to the
+caller of
+.Nm
+that match the name
+.Ar procname .
+The super-user is allowed to kill any process.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl c Ar procname"
+.It Fl d | v
+Be more verbose about what will be done.
+For a single
+.Fl d
+option, a list of the processes that will be sent the signal will be
+printed, or a message indicating that no matching processes have been
+found.
+.It Fl e
+Use the effective user ID instead of the (default) real user ID for matching
+processes specified with the
+.Fl u
+option.
+.It Fl help
+Give a help on the command usage and exit.
+.It Fl I
+Request confirmation before attempting to signal each
+process.
+.It Fl l
+List the names of the available signals and exit, like in
+.Xr kill 1 .
+.It Fl m
+Match the argument
+.Ar procname
+as a (case sensitive) regular expression against the names
+of processes found.
+CAUTION!
+This is dangerous, a single dot will match any process
+running under the real UID of the caller.
+.It Fl s
+Show only what would be done, but do not send any signal.
+.It Fl Ar SIGNAL
+Send a different signal instead of the default
+.Dv TERM .
+The signal may be specified either as a name
+(with or without a leading
+.Dq Li SIG ) ,
+or numerically.
+.It Fl j Ar jail
+Kill processes in the specified
+.Ar jail .
+.It Fl u Ar user
+Limit potentially matching processes to those belonging to
+the specified
+.Ar user .
+.It Fl t Ar tty
+Limit potentially matching processes to those running on
+the specified
+.Ar tty .
+.It Fl c Ar procname
+Limit potentially matching processes to those matching
+the specified
+.Ar procname .
+.It Fl q
+Suppress error message if no processes are matched.
+.It Fl z
+Do not skip zombies.
+This should not have any effect except to print a few error messages
+if there are zombie processes that match the specified pattern.
+.El
+.Sh ALL PROCESSES
+Sending a signal to all processes with the given UID
+is already supported by
+.Xr kill 1 .
+So use
+.Xr kill 1
+for this job (e.g.\&
+.Dq Li "kill -TERM -1"
+or as root
+.Dq Li "echo kill -TERM -1 | su -m <user>" ) .
+.Sh IMPLEMENTATION NOTES
+This
+.Fx
+implementation of
+.Nm
+has completely different semantics as compared to the traditional
+.Ux
+System V behavior of
+.Nm .
+The latter will kill all processes that the current user is able to
+kill, and is intended to be used by the system shutdown process only.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 if some processes have been found and
+signalled successfully.
+Otherwise, a status of 1 will be
+returned.
+.Sh DIAGNOSTICS
+Diagnostic messages will only be printed if requested by
+.Fl d
+options.
+.Sh SEE ALSO
+.Xr kill 1 ,
+.Xr pkill 1 ,
+.Xr sysctl 3 ,
+.Xr jail 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 2.1 .
+It has been modeled after the
+.Nm
+command as available on other platforms.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+program was originally written in Perl and was contributed by
+.An Wolfram Schneider ,
+this manual page has been written by
+.An J\(:org Wunsch .
+The current version of
+.Nm
+was rewritten in C by
+.An Peter Wemm
+using
+.Xr sysctl 3 .
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
new file mode 100644
index 0000000..cdb62da
--- /dev/null
+++ b/usr.bin/killall/killall.c
@@ -0,0 +1,437 @@
+/*-
+ * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
+ * Copyright (c) 2000 Paul Saab <ps@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/jail.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <sys/user.h>
+#include <sys/sysctl.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <jail.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pwd.h>
+#include <signal.h>
+#include <regex.h>
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <unistd.h>
+#include <locale.h>
+
+static void __dead2
+usage(void)
+{
+
+ fprintf(stderr, "usage: killall [-delmsqvz] [-help] [-I] [-j jail]\n");
+ fprintf(stderr,
+ " [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd]...\n");
+ fprintf(stderr, "At least one option or argument to specify processes must be given.\n");
+ exit(1);
+}
+
+
+static void
+printsig(FILE *fp)
+{
+ const char *const * p;
+ int cnt;
+ int offset = 0;
+
+ for (cnt = NSIG, p = sys_signame + 1; --cnt; ++p) {
+ offset += fprintf(fp, "%s ", *p);
+ if (offset >= 75 && cnt > 1) {
+ offset = 0;
+ fprintf(fp, "\n");
+ }
+ }
+ fprintf(fp, "\n");
+}
+
+static void
+nosig(char *name)
+{
+
+ warnx("unknown signal %s; valid signals:", name);
+ printsig(stderr);
+ exit(1);
+}
+
+int
+main(int ac, char **av)
+{
+ char **saved_av;
+ struct kinfo_proc *procs, *newprocs;
+ struct stat sb;
+ struct passwd *pw;
+ regex_t rgx;
+ regmatch_t pmatch;
+ int i, j, ch;
+ char buf[256];
+ char first;
+ char *user = NULL;
+ char *tty = NULL;
+ char *cmd = NULL;
+ int qflag = 0;
+ int vflag = 0;
+ int sflag = 0;
+ int dflag = 0;
+ int eflag = 0;
+ int Iflag = 0;
+ int jflag = 0;
+ int mflag = 0;
+ int zflag = 0;
+ uid_t uid = 0;
+ dev_t tdev = 0;
+ pid_t mypid;
+ char thiscmd[MAXCOMLEN + 1];
+ pid_t thispid;
+ uid_t thisuid;
+ dev_t thistdev;
+ int sig = SIGTERM;
+ const char *const *p;
+ char *ep;
+ int errors = 0;
+ int jid;
+ int mib[4];
+ size_t miblen;
+ int st, nprocs;
+ size_t size;
+ int matched;
+ int killed = 0;
+
+ setlocale(LC_ALL, "");
+
+ av++;
+ ac--;
+
+ while (ac > 0) {
+ if (strcmp(*av, "-l") == 0) {
+ printsig(stdout);
+ exit(0);
+ }
+ if (strcmp(*av, "-help") == 0)
+ usage();
+ if (**av == '-') {
+ ++*av;
+ switch (**av) {
+ case 'j':
+ ++*av;
+ if (**av == '\0') {
+ ++av;
+ --ac;
+ }
+ jflag++;
+ if (*av == NULL)
+ errx(1, "must specify jail");
+ jid = jail_getid(*av);
+ if (jid < 0)
+ errx(1, "%s", jail_errmsg);
+ if (jail_attach(jid) == -1)
+ err(1, "jail_attach(%d)", jid);
+ break;
+ case 'u':
+ ++*av;
+ if (**av == '\0') {
+ ++av;
+ --ac;
+ }
+ if (*av == NULL)
+ errx(1, "must specify user");
+ user = *av;
+ break;
+ case 't':
+ ++*av;
+ if (**av == '\0') {
+ ++av;
+ --ac;
+ }
+ if (*av == NULL)
+ errx(1, "must specify tty");
+ tty = *av;
+ break;
+ case 'c':
+ ++*av;
+ if (**av == '\0') {
+ ++av;
+ --ac;
+ }
+ if (*av == NULL)
+ errx(1, "must specify procname");
+ cmd = *av;
+ break;
+ case 'q':
+ qflag++;
+ break;
+ case 'v':
+ vflag++;
+ break;
+ case 's':
+ sflag++;
+ break;
+ case 'd':
+ dflag++;
+ break;
+ case 'e':
+ eflag++;
+ break;
+ case 'm':
+ mflag++;
+ break;
+ case 'z':
+ zflag++;
+ break;
+ default:
+ saved_av = av;
+ if (isalpha((unsigned char)**av)) {
+ if (strncasecmp(*av, "SIG", 3) == 0)
+ *av += 3;
+ for (sig = NSIG, p = sys_signame + 1;
+ --sig; ++p)
+ if (strcasecmp(*p, *av) == 0) {
+ sig = p - sys_signame;
+ break;
+ }
+ if (!sig) {
+ if (**saved_av == 'I') {
+ av = saved_av;
+ Iflag = 1;
+ break;
+ } else
+ nosig(*av);
+ }
+ } else if (isdigit((unsigned char)**av)) {
+ sig = strtol(*av, &ep, 10);
+ if (!*av || *ep)
+ errx(1, "illegal signal number: %s", *av);
+ if (sig < 0 || sig >= NSIG)
+ nosig(*av);
+ } else
+ nosig(*av);
+ }
+ ++av;
+ --ac;
+ } else {
+ break;
+ }
+ }
+
+ if (user == NULL && tty == NULL && cmd == NULL && !jflag && ac == 0)
+ usage();
+
+ if (tty) {
+ if (strncmp(tty, "/dev/", 5) == 0)
+ snprintf(buf, sizeof(buf), "%s", tty);
+ else if (strncmp(tty, "tty", 3) == 0)
+ snprintf(buf, sizeof(buf), "/dev/%s", tty);
+ else
+ snprintf(buf, sizeof(buf), "/dev/tty%s", tty);
+ if (stat(buf, &sb) < 0)
+ err(1, "stat(%s)", buf);
+ if (!S_ISCHR(sb.st_mode))
+ errx(1, "%s: not a character device", buf);
+ tdev = sb.st_rdev;
+ if (dflag)
+ printf("ttydev:0x%jx\n", (uintmax_t)tdev);
+ }
+ if (user) {
+ uid = strtol(user, &ep, 10);
+ if (*user == '\0' || *ep != '\0') { /* was it a number? */
+ pw = getpwnam(user);
+ if (pw == NULL)
+ errx(1, "user %s does not exist", user);
+ uid = pw->pw_uid;
+ if (dflag)
+ printf("uid:%d\n", uid);
+ }
+ } else {
+ uid = getuid();
+ if (uid != 0) {
+ pw = getpwuid(uid);
+ if (pw)
+ user = pw->pw_name;
+ if (dflag)
+ printf("uid:%d\n", uid);
+ }
+ }
+ size = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+
+ if (user) {
+ mib[2] = eflag ? KERN_PROC_UID : KERN_PROC_RUID;
+ mib[3] = uid;
+ miblen = 4;
+ } else if (tty) {
+ mib[2] = KERN_PROC_TTY;
+ mib[3] = tdev;
+ miblen = 4;
+ } else {
+ mib[2] = KERN_PROC_PROC;
+ mib[3] = 0;
+ miblen = 3;
+ }
+
+ procs = NULL;
+ st = sysctl(mib, miblen, NULL, &size, NULL, 0);
+ do {
+ size += size / 10;
+ newprocs = realloc(procs, size);
+ if (newprocs == NULL) {
+ free(procs);
+ err(1, "could not reallocate memory");
+ }
+ procs = newprocs;
+ st = sysctl(mib, miblen, procs, &size, NULL, 0);
+ } while (st == -1 && errno == ENOMEM);
+ if (st == -1)
+ err(1, "could not sysctl(KERN_PROC)");
+ if (size % sizeof(struct kinfo_proc) != 0) {
+ fprintf(stderr, "proc size mismatch (%zu total, %zu chunks)\n",
+ size, sizeof(struct kinfo_proc));
+ fprintf(stderr, "userland out of sync with kernel\n");
+ exit(1);
+ }
+ nprocs = size / sizeof(struct kinfo_proc);
+ if (dflag)
+ printf("nprocs %d\n", nprocs);
+ mypid = getpid();
+
+ for (i = 0; i < nprocs; i++) {
+ if (procs[i].ki_stat == SZOMB && !zflag)
+ continue;
+ thispid = procs[i].ki_pid;
+ strlcpy(thiscmd, procs[i].ki_comm, sizeof(thiscmd));
+ thistdev = procs[i].ki_tdev;
+ if (eflag)
+ thisuid = procs[i].ki_uid; /* effective uid */
+ else
+ thisuid = procs[i].ki_ruid; /* real uid */
+
+ if (thispid == mypid)
+ continue;
+ matched = 1;
+ if (user) {
+ if (thisuid != uid)
+ matched = 0;
+ }
+ if (tty) {
+ if (thistdev != tdev)
+ matched = 0;
+ }
+ if (cmd) {
+ if (mflag) {
+ if (regcomp(&rgx, cmd,
+ REG_EXTENDED|REG_NOSUB) != 0) {
+ mflag = 0;
+ warnx("%s: illegal regexp", cmd);
+ }
+ }
+ if (mflag) {
+ pmatch.rm_so = 0;
+ pmatch.rm_eo = strlen(thiscmd);
+ if (regexec(&rgx, thiscmd, 0, &pmatch,
+ REG_STARTEND) != 0)
+ matched = 0;
+ regfree(&rgx);
+ } else {
+ if (strncmp(thiscmd, cmd, MAXCOMLEN) != 0)
+ matched = 0;
+ }
+ }
+ if (jflag && thispid == getpid())
+ matched = 0;
+ if (matched == 0)
+ continue;
+ if (ac > 0)
+ matched = 0;
+ for (j = 0; j < ac; j++) {
+ if (mflag) {
+ if (regcomp(&rgx, av[j],
+ REG_EXTENDED|REG_NOSUB) != 0) {
+ mflag = 0;
+ warnx("%s: illegal regexp", av[j]);
+ }
+ }
+ if (mflag) {
+ pmatch.rm_so = 0;
+ pmatch.rm_eo = strlen(thiscmd);
+ if (regexec(&rgx, thiscmd, 0, &pmatch,
+ REG_STARTEND) == 0)
+ matched = 1;
+ regfree(&rgx);
+ } else {
+ if (strcmp(thiscmd, av[j]) == 0)
+ matched = 1;
+ }
+ if (matched)
+ break;
+ }
+ if (matched != 0 && Iflag) {
+ printf("Send signal %d to %s (pid %d uid %d)? ",
+ sig, thiscmd, thispid, thisuid);
+ fflush(stdout);
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ if (first != 'y' && first != 'Y')
+ matched = 0;
+ }
+ if (matched == 0)
+ continue;
+ if (dflag)
+ printf("sig:%d, cmd:%s, pid:%d, dev:0x%jx uid:%d\n",
+ sig, thiscmd, thispid, (uintmax_t)thistdev,
+ thisuid);
+
+ if (vflag || sflag)
+ printf("kill -%s %d\n", sys_signame[sig], thispid);
+
+ killed++;
+ if (!dflag && !sflag) {
+ if (kill(thispid, sig) < 0 /* && errno != ESRCH */ ) {
+ warn("warning: kill -%s %d",
+ sys_signame[sig], thispid);
+ errors = 1;
+ }
+ }
+ }
+ if (killed == 0) {
+ if (!qflag)
+ fprintf(stderr, "No matching processes %swere found\n",
+ getuid() != 0 ? "belonging to you " : "");
+ errors = 1;
+ }
+ exit(errors);
+}
diff --git a/usr.bin/ktrace/Makefile b/usr.bin/ktrace/Makefile
new file mode 100644
index 0000000..c00bb75
--- /dev/null
+++ b/usr.bin/ktrace/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 1.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= ktrace
+SRCS= ktrace.c subr.c
+MLINKS= ktrace.1 trace.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ktrace/Makefile.depend b/usr.bin/ktrace/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/ktrace/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/ktrace/ktrace.1 b/usr.bin/ktrace/ktrace.1
new file mode 100644
index 0000000..4a46052
--- /dev/null
+++ b/usr.bin/ktrace/ktrace.1
@@ -0,0 +1,188 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 31, 2016
+.Dt KTRACE 1
+.Os
+.Sh NAME
+.Nm ktrace
+.Nd enable kernel process tracing
+.Sh SYNOPSIS
+.Nm
+.Op Fl aCcdi
+.Op Fl f Ar trfile
+.Op Fl g Ar pgrp | Fl p Ar pid
+.Op Fl t Ar trstr
+.Nm
+.Op Fl adi
+.Op Fl f Ar trfile
+.Op Fl t Ar trstr
+.Ar command
+.Sh DESCRIPTION
+The
+.Nm
+utility enables kernel trace logging for the specified processes.
+Kernel trace data is logged to the file
+.Pa ktrace.out .
+The kernel operations that are traced include system calls, namei
+translations, signal processing, and
+.Tn I/O .
+.Pp
+Once tracing is enabled on a process, trace data will be logged until
+either the process exits or the trace point is cleared.
+A traced process can generate enormous amounts of log data quickly;
+It is strongly suggested that users memorize how to disable tracing before
+attempting to trace a process.
+The following command is sufficient to disable tracing on all user-owned
+processes, and, if executed by root, all processes:
+.Pp
+.Dl \&$ ktrace -C
+.Pp
+The trace file is not human readable; use
+.Xr kdump 1
+to decode it.
+.Pp
+The utility may be used only with a kernel that has been built with the
+.Dq KTRACE
+option in the kernel configuration file.
+.Pp
+The options are:
+.Bl -tag -width indent
+.It Fl a
+Append to the trace file instead of recreating it.
+.It Fl C
+Disable tracing on all user-owned processes, and, if executed by root, all
+processes in the system.
+.It Fl c
+Clear the specified trace points associated with the given file or processes.
+.It Fl d
+Descendants; perform the operation for all current children of the
+designated processes.
+.It Fl f Ar trfile
+Log trace records to
+.Ar trfile
+instead of
+.Pa ktrace.out .
+.It Fl g Ar pgid
+Enable (disable) tracing on all processes in the process group (only one
+.Fl g
+flag is permitted).
+.It Fl i
+Inherit; pass the trace flags to all future children of the designated
+processes.
+.It Fl p Ar pid
+Enable (disable) tracing on the indicated process id (only one
+.Fl p
+flag is permitted).
+.It Fl t Ar trstr
+Specify the list of trace points to enable or disable, one per letter.
+If an explicit list is not specified, the default set of trace points is used.
+.Pp
+The following trace points are supported:
+.Pp
+.Bl -tag -width flag -compact
+.It Cm c
+trace system calls
+.It Cm f
+trace page faults
+.It Cm i
+trace
+.Tn I/O
+.It Cm n
+trace namei translations
+.It Cm p
+trace capability check failures
+.It Cm s
+trace signal processing
+.It Cm t
+trace various structures
+.It Cm u
+userland traces
+.It Cm w
+context switches
+.It Cm y
+trace
+.Xr sysctl 3
+requests
+.It Cm +
+trace the default set of trace points -
+.Cm c , i , n , p , s , t , u , y
+.El
+.It Ar command
+Execute
+.Ar command
+with the specified trace flags.
+.El
+.Pp
+The
+.Fl p ,
+.Fl g ,
+and
+.Ar command
+options are mutually exclusive.
+.Sh EXAMPLES
+# trace all kernel operations of process id 34
+.Dl $ ktrace -p 34
+.Pp
+# trace all kernel operations of processes in process group 15 and
+# pass the trace flags to all current and future children
+.Dl $ ktrace -idg 15
+.Pp
+# disable all tracing of process 65
+.Dl $ ktrace -cp 65
+.Pp
+# disable tracing signals on process 70 and all current children
+.Dl $ ktrace -t s -cdp 70
+.Pp
+# enable tracing of
+.Tn I/O
+on process 67
+.Dl $ ktrace -ti -p 67
+.Pp
+# run the command "w", tracing only system calls
+.Dl $ ktrace -tc w
+.Pp
+# disable all tracing to the file "tracedata"
+.Dl $ ktrace -c -f tracedata
+.Pp
+# disable tracing of all user-owned processes
+.Dl $ ktrace -C
+.Sh SEE ALSO
+.Xr kdump 1 ,
+.Xr ktrace 2
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
+.Sh BUGS
+Only works if
+.Ar trfile
+is a regular file.
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c
new file mode 100644
index 0000000..f993d37
--- /dev/null
+++ b/usr.bin/ktrace/ktrace.c
@@ -0,0 +1,240 @@
+/*-
+ * Copyright (c) 1988, 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) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)ktrace.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/ktrace.h>
+
+#include <err.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ktrace.h"
+
+static char def_tracefile[] = DEF_TRACEFILE;
+
+static enum clear { NOTSET, CLEAR, CLEARALL } clear = NOTSET;
+static int pid;
+
+static void no_ktrace(int);
+static void set_pid_clear(const char *, enum clear);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int append, ch, fd, inherit, ops, trpoints;
+ const char *tracefile;
+ mode_t omask;
+ struct stat sb;
+
+ append = ops = inherit = 0;
+ trpoints = DEF_POINTS;
+ tracefile = def_tracefile;
+ while ((ch = getopt(argc,argv,"aCcdf:g:ip:t:")) != -1)
+ switch((char)ch) {
+ case 'a':
+ append = 1;
+ break;
+ case 'C':
+ set_pid_clear("1", CLEARALL);
+ break;
+ case 'c':
+ set_pid_clear(NULL, CLEAR);
+ break;
+ case 'd':
+ ops |= KTRFLAG_DESCEND;
+ break;
+ case 'f':
+ tracefile = optarg;
+ break;
+ case 'g':
+ set_pid_clear(optarg, NOTSET);
+ pid = -pid;
+ break;
+ case 'i':
+ inherit = 1;
+ break;
+ case 'p':
+ set_pid_clear(optarg, NOTSET);
+ break;
+ case 't':
+ trpoints = getpoints(optarg);
+ if (trpoints < 0) {
+ warnx("unknown facility in %s", optarg);
+ usage();
+ }
+ break;
+ default:
+ usage();
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ /* must have either -[Cc], a pid or a command */
+ if (clear == NOTSET && pid == 0 && argc == 0)
+ usage();
+ /* can't have both a pid and a command */
+ /* (note that -C sets pid to 1) */
+ if (pid != 0 && argc > 0) {
+ usage();
+ }
+
+ if (inherit)
+ trpoints |= KTRFAC_INHERIT;
+
+ (void)signal(SIGSYS, no_ktrace);
+ if (clear != NOTSET) {
+ if (clear == CLEARALL) {
+ ops = KTROP_CLEAR | KTRFLAG_DESCEND;
+ trpoints = ALL_POINTS;
+ } else {
+ ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE;
+ }
+ if (ktrace(tracefile, ops, trpoints, pid) < 0)
+ err(1, "%s", tracefile);
+ exit(0);
+ }
+
+ omask = umask(S_IRWXG|S_IRWXO);
+ if (append) {
+ if ((fd = open(tracefile, O_CREAT | O_WRONLY | O_NONBLOCK,
+ DEFFILEMODE)) < 0)
+ err(1, "%s", tracefile);
+ if (fstat(fd, &sb) != 0 || sb.st_uid != getuid())
+ errx(1, "refuse to append to %s not owned by you",
+ tracefile);
+ if (!(S_ISREG(sb.st_mode)))
+ errx(1, "%s not regular file", tracefile);
+ } else {
+ if (unlink(tracefile) == -1 && errno != ENOENT)
+ err(1, "unlink %s", tracefile);
+ if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY,
+ DEFFILEMODE)) < 0)
+ err(1, "%s", tracefile);
+ }
+ (void)umask(omask);
+ (void)close(fd);
+
+ trpoints |= PROC_ABI_POINTS;
+
+ if (argc > 0) {
+ if (ktrace(tracefile, ops, trpoints, getpid()) < 0)
+ err(1, "%s", tracefile);
+ execvp(*argv, argv);
+ err(1, "exec of '%s' failed", *argv);
+ }
+ if (ktrace(tracefile, ops, trpoints, pid) < 0)
+ err(1, "%s", tracefile);
+ exit(0);
+}
+
+static void
+set_pid_clear(const char *p, enum clear cl)
+{
+ intmax_t n;
+ char *e;
+
+ if (clear != NOTSET && cl != NOTSET) {
+ /* either -c and -C or either of them twice */
+ warnx("only one -c or -C flag is permitted");
+ usage();
+ }
+ if ((clear == CLEARALL && p != NULL) || (cl == CLEARALL && pid != 0)) {
+ /* both -C and a pid or pgid */
+ warnx("the -C flag may not be combined with -g or -p");
+ usage();
+ }
+ if (p != NULL && pid != 0) {
+ /* either -p and -g or either of them twice */
+ warnx("only one -g or -p flag is permitted");
+ usage();
+ }
+ if (p != NULL) {
+ errno = 0;
+ n = strtoimax(p, &e, 10);
+ /*
+ * 1) not a number, or outside the range of an intmax_t
+ * 2) inside the range of intmax_t but outside the range
+ * of an int, keeping in mind that the pid may be
+ * negated if it's actually a pgid.
+ */
+ if (*e != '\0' || n < 1 || errno == ERANGE ||
+ n > (intmax_t)INT_MAX || n > -(intmax_t)INT_MIN) {
+ warnx("invalid process or group id");
+ usage();
+ }
+ pid = n;
+ }
+ if (cl != NOTSET)
+ if ((clear = cl) == CLEARALL)
+ pid = 1;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "%s\n%s\n",
+ "usage: ktrace [-aCcdi] [-f trfile] [-g pgrp | -p pid] [-t trstr]",
+ " ktrace [-adi] [-f trfile] [-t trstr] command");
+ exit(1);
+}
+
+static void
+no_ktrace(int sig __unused)
+{
+
+ fprintf(stderr, "error:\t%s\n\t%s\n",
+ "ktrace() system call not supported in the running kernel",
+ "re-compile kernel with 'options KTRACE'");
+ exit(1);
+}
diff --git a/usr.bin/ktrace/ktrace.h b/usr.bin/ktrace/ktrace.h
new file mode 100644
index 0000000..26ac1143
--- /dev/null
+++ b/usr.bin/ktrace/ktrace.h
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 1988, 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.
+ *
+ * @(#)ktrace.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \
+ KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \
+ KTRFAC_STRUCT | KTRFAC_SYSCTL | KTRFAC_CAPFAIL)
+
+#define PROC_ABI_POINTS (KTRFAC_PROCCTOR | KTRFAC_PROCDTOR)
+
+#define ALL_POINTS (DEF_POINTS | KTRFAC_CSW | PROC_ABI_POINTS | \
+ KTRFAC_FAULT | KTRFAC_FAULTEND)
+
+#define DEF_TRACEFILE "ktrace.out"
+
+int getpoints(char *);
diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c
new file mode 100644
index 0000000..eacd44c
--- /dev/null
+++ b/usr.bin/ktrace/subr.c
@@ -0,0 +1,129 @@
+/*-
+ * Copyright (c) 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/proc.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/ktrace.h>
+
+#include <stdio.h>
+
+#include "ktrace.h"
+
+void timevaladd(struct timeval *, struct timeval *);
+void timevalsub(struct timeval *, struct timeval *);
+void timevalfix(struct timeval *);
+
+int
+getpoints(char *s)
+{
+ int facs = 0;
+
+ while (*s) {
+ switch(*s) {
+ case 'c':
+ facs |= KTRFAC_SYSCALL | KTRFAC_SYSRET;
+ break;
+ case 'i':
+ facs |= KTRFAC_GENIO;
+ break;
+ case 'f':
+ facs |= KTRFAC_FAULT | KTRFAC_FAULTEND;
+ break;
+ case 'n':
+ facs |= KTRFAC_NAMEI;
+ break;
+ case 'p':
+ facs |= KTRFAC_CAPFAIL;
+ break;
+ case 's':
+ facs |= KTRFAC_PSIG;
+ break;
+ case 't':
+ facs |= KTRFAC_STRUCT;
+ break;
+ case 'u':
+ facs |= KTRFAC_USER;
+ break;
+ case 'w':
+ facs |= KTRFAC_CSW;
+ break;
+ case 'y':
+ facs |= KTRFAC_SYSCTL;
+ break;
+ case '+':
+ facs |= DEF_POINTS;
+ break;
+ default:
+ return (-1);
+ }
+ s++;
+ }
+ return (facs);
+}
+
+void
+timevaladd(struct timeval *t1, struct timeval *t2)
+{
+ t1->tv_sec += t2->tv_sec;
+ t1->tv_usec += t2->tv_usec;
+ timevalfix(t1);
+}
+
+void
+timevalsub(struct timeval *t1, struct timeval *t2)
+{
+ t1->tv_sec -= t2->tv_sec;
+ t1->tv_usec -= t2->tv_usec;
+ timevalfix(t1);
+}
+
+void
+timevalfix(struct timeval *t1)
+{
+ if (t1->tv_usec < 0) {
+ t1->tv_sec--;
+ t1->tv_usec += 1000000;
+ }
+ if (t1->tv_usec >= 1000000) {
+ t1->tv_sec++;
+ t1->tv_usec -= 1000000;
+ }
+}
diff --git a/usr.bin/ktrdump/Makefile b/usr.bin/ktrdump/Makefile
new file mode 100644
index 0000000..63cd2cf
--- /dev/null
+++ b/usr.bin/ktrdump/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PROG= ktrdump
+LIBADD= kvm
+MAN= ktrdump.8
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ktrdump/Makefile.depend b/usr.bin/ktrdump/Makefile.depend
new file mode 100644
index 0000000..34582cd
--- /dev/null
+++ b/usr.bin/ktrdump/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ktrdump/ktrdump.8 b/usr.bin/ktrdump/ktrdump.8
new file mode 100644
index 0000000..8dade55
--- /dev/null
+++ b/usr.bin/ktrdump/ktrdump.8
@@ -0,0 +1,92 @@
+.\"-
+.\" Copyright (c) 2002 Chad David
+.\" 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 February 6, 2015
+.Dt KTRDUMP 8
+.Os
+.Sh NAME
+.Nm ktrdump
+.Nd print kernel ktr trace buffer
+.Sh SYNOPSIS
+.Nm
+.Op Fl cfqrtH
+.Op Fl i Ar ktrfile
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl o Ar outfile
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to dump the contents of the kernel ktr trace buffer.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl i Ar ktrfile"
+.It Fl c
+Print the CPU number that each entry was logged from.
+.It Fl f
+Print the file and line number that each entry was logged from.
+.It Fl q
+Quiet mode; do not print the column header.
+.It Fl r
+Print relative timestamps rather than absolute timestamps.
+.It Fl t
+Print the timestamp for each entry.
+.It Fl H
+Print the thread ID for each entry.
+.It Fl i Ar ktrfile
+File containing saved ktr trace events; for more information see the
+.Xr ktr 4
+manual page.
+.It Fl N Ar system
+The kernel image to resolve symbols from.
+The default is the value returned via
+.Xr getbootfile 3 .
+.It Fl M Ar core
+The core file or memory image to read from.
+The default is
+.Pa /dev/mem .
+.It Fl o Ar outfile
+The file to write the output to.
+The default is standard output.
+.El
+.Sh SEE ALSO
+.Xr ktr 4 ,
+.Xr ktr 9
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility was implemented by
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Chad David Aq Mt davidc@FreeBSD.org .
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
new file mode 100644
index 0000000..84ab3a8
--- /dev/null
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -0,0 +1,321 @@
+/*-
+ * Copyright (c) 2002 Jake Burkholder
+ * Copyright (c) 2004 Robert Watson
+ * 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/ktr.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <fcntl.h>
+#include <kvm.h>
+#include <limits.h>
+#include <nlist.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define SBUFLEN 128
+#define USAGE \
+ "usage: ktrdump [-cfqrtH] [-i ktrfile] [-M core] [-N system] [-o outfile]\n"
+
+static void usage(void);
+
+static struct nlist nl[] = {
+ { "_ktr_version" },
+ { "_ktr_entries" },
+ { "_ktr_idx" },
+ { "_ktr_buf" },
+ { NULL }
+};
+
+static int cflag;
+static int fflag;
+static int Mflag;
+static int Nflag;
+static int qflag;
+static int rflag;
+static int tflag;
+static int iflag;
+static int hflag;
+
+static char corefile[PATH_MAX];
+static char execfile[PATH_MAX];
+
+static char desc[SBUFLEN];
+static char errbuf[_POSIX2_LINE_MAX];
+static char fbuf[PATH_MAX];
+static char obuf[PATH_MAX];
+static char sbuf[KTR_PARMS][SBUFLEN];
+
+/*
+ * Reads the ktr trace buffer from kernel memory and prints the trace entries.
+ */
+int
+main(int ac, char **av)
+{
+ u_long parms[KTR_PARMS];
+ struct ktr_entry *buf;
+ uintmax_t tlast, tnow;
+ unsigned long bufptr;
+ struct stat sb;
+ kvm_t *kd;
+ FILE *out;
+ char *p;
+ int version;
+ int entries;
+ int index, index2;
+ int parm;
+ int in;
+ int c;
+ int i = 0;
+
+ /*
+ * Parse commandline arguments.
+ */
+ out = stdout;
+ while ((c = getopt(ac, av, "cfqrtHe:i:m:M:N:o:")) != -1)
+ switch (c) {
+ case 'c':
+ cflag = 1;
+ break;
+ case 'N':
+ case 'e':
+ if (strlcpy(execfile, optarg, sizeof(execfile))
+ >= sizeof(execfile))
+ errx(1, "%s: File name too long", optarg);
+ Nflag = 1;
+ break;
+ case 'f':
+ fflag = 1;
+ break;
+ case 'i':
+ iflag = 1;
+ if ((in = open(optarg, O_RDONLY)) == -1)
+ err(1, "%s", optarg);
+ break;
+ case 'M':
+ case 'm':
+ if (strlcpy(corefile, optarg, sizeof(corefile))
+ >= sizeof(corefile))
+ errx(1, "%s: File name too long", optarg);
+ Mflag = 1;
+ break;
+ case 'o':
+ if ((out = fopen(optarg, "w")) == NULL)
+ err(1, "%s", optarg);
+ break;
+ case 'q':
+ qflag++;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'H':
+ hflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ ac -= optind;
+ av += optind;
+ if (ac != 0)
+ usage();
+
+ /*
+ * Open our execfile and corefile, resolve needed symbols and read in
+ * the trace buffer.
+ */
+ if ((kd = kvm_openfiles(Nflag ? execfile : NULL,
+ Mflag ? corefile : NULL, NULL, O_RDONLY, errbuf)) == NULL)
+ errx(1, "%s", errbuf);
+ if (kvm_nlist(kd, nl) != 0 ||
+ kvm_read(kd, nl[0].n_value, &version, sizeof(version)) == -1)
+ errx(1, "%s", kvm_geterr(kd));
+ if (version != KTR_VERSION)
+ errx(1, "ktr version mismatch");
+ if (iflag) {
+ if (fstat(in, &sb) == -1)
+ errx(1, "stat");
+ entries = sb.st_size / sizeof(*buf);
+ index = 0;
+ buf = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, in, 0);
+ if (buf == MAP_FAILED)
+ errx(1, "mmap");
+ } else {
+ if (kvm_read(kd, nl[1].n_value, &entries, sizeof(entries))
+ == -1)
+ errx(1, "%s", kvm_geterr(kd));
+ if ((buf = malloc(sizeof(*buf) * entries)) == NULL)
+ err(1, NULL);
+ if (kvm_read(kd, nl[2].n_value, &index, sizeof(index)) == -1 ||
+ kvm_read(kd, nl[3].n_value, &bufptr,
+ sizeof(bufptr)) == -1 ||
+ kvm_read(kd, bufptr, buf, sizeof(*buf) * entries) == -1 ||
+ kvm_read(kd, nl[2].n_value, &index2, sizeof(index2)) == -1)
+ errx(1, "%s", kvm_geterr(kd));
+ }
+
+ /*
+ * Print a nice header.
+ */
+ if (!qflag) {
+ fprintf(out, "%-6s ", "index");
+ if (cflag)
+ fprintf(out, "%-3s ", "cpu");
+ if (tflag)
+ fprintf(out, "%-16s ", "timestamp");
+ if (fflag)
+ fprintf(out, "%-40s ", "file and line");
+ if (hflag)
+ fprintf(out, "%-18s ", "tid");
+ fprintf(out, "%s", "trace");
+ fprintf(out, "\n");
+
+ fprintf(out, "------ ");
+ if (cflag)
+ fprintf(out, "--- ");
+ if (tflag)
+ fprintf(out, "---------------- ");
+ if (fflag)
+ fprintf(out,
+ "---------------------------------------- ");
+ if (hflag)
+ fprintf(out, "------------------ ");
+ fprintf(out, "----- ");
+ fprintf(out, "\n");
+ }
+
+ /*
+ * Now tear through the trace buffer.
+ */
+ if (!iflag) {
+ i = index - 1;
+ if (i < 0)
+ i = entries - 1;
+ }
+ tlast = -1;
+ for (;;) {
+ if (buf[i].ktr_desc == NULL)
+ break;
+ if (kvm_read(kd, (u_long)buf[i].ktr_desc, desc,
+ sizeof(desc)) == -1)
+ errx(1, "%s", kvm_geterr(kd));
+ desc[sizeof(desc) - 1] = '\0';
+ parm = 0;
+ for (p = desc; (c = *p++) != '\0';) {
+ if (c != '%')
+ continue;
+next: if ((c = *p++) == '\0')
+ break;
+ if (parm == KTR_PARMS)
+ errx(1, "too many parameters in \"%s\"", desc);
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case '#': case '-': case ' ': case '+': case '\'':
+ case 'h': case 'l': case 'j': case 't': case 'z':
+ case 'q': case 'L': case '.':
+ goto next;
+ case 's':
+ if (kvm_read(kd, (u_long)buf[i].ktr_parms[parm],
+ sbuf[parm], sizeof(sbuf[parm])) == -1)
+ strcpy(sbuf[parm], "(null)");
+ sbuf[parm][sizeof(sbuf[0]) - 1] = '\0';
+ parms[parm] = (u_long)sbuf[parm];
+ parm++;
+ break;
+ default:
+ parms[parm] = buf[i].ktr_parms[parm];
+ parm++;
+ break;
+ }
+ }
+ fprintf(out, "%6d ", i);
+ if (cflag)
+ fprintf(out, "%3d ", buf[i].ktr_cpu);
+ if (tflag) {
+ tnow = (uintmax_t)buf[i].ktr_timestamp;
+ if (rflag) {
+ if (tlast == -1)
+ tlast = tnow;
+ fprintf(out, "%16ju ", !iflag ? tlast - tnow :
+ tnow - tlast);
+ tlast = tnow;
+ } else
+ fprintf(out, "%16ju ", tnow);
+ }
+ if (fflag) {
+ if (kvm_read(kd, (u_long)buf[i].ktr_file, fbuf,
+ sizeof(fbuf)) == -1)
+ strcpy(fbuf, "(null)");
+ snprintf(obuf, sizeof(obuf), "%s:%d", fbuf,
+ buf[i].ktr_line);
+ fprintf(out, "%-40s ", obuf);
+ }
+ if (hflag)
+ fprintf(out, "%p ", buf[i].ktr_thread);
+ fprintf(out, desc, parms[0], parms[1], parms[2], parms[3],
+ parms[4], parms[5]);
+ fprintf(out, "\n");
+ if (!iflag) {
+ /*
+ * 'index' and 'index2' are the values of 'ktr_idx'
+ * before and after the KTR buffer was copied into
+ * 'buf'. Since the KTR entries between 'index' and
+ * 'index2' were in flux while the KTR buffer was
+ * being copied to userspace we don't dump them.
+ */
+ if (i == index2)
+ break;
+ if (--i < 0)
+ i = entries - 1;
+ } else {
+ if (++i == entries)
+ break;
+ }
+ }
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, USAGE);
+ exit(1);
+}
diff --git a/usr.bin/lam/Makefile b/usr.bin/lam/Makefile
new file mode 100644
index 0000000..08b7328
--- /dev/null
+++ b/usr.bin/lam/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= lam
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lam/Makefile.depend b/usr.bin/lam/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/lam/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/lam/lam.1 b/usr.bin/lam/lam.1
new file mode 100644
index 0000000..896cea2
--- /dev/null
+++ b/usr.bin/lam/lam.1
@@ -0,0 +1,144 @@
+.\" Copyright (c) 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.
+.\"
+.\" @(#)lam.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 7, 2015
+.Dt LAM 1
+.Os
+.Sh NAME
+.Nm lam
+.Nd laminate files
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar min . Ns Ar max
+.Op Fl s Ar sepstring
+.Op Fl t Ar c
+.Ar
+.Nm
+.Op Fl p Ar min . Ns Ar max
+.Op Fl s Ar sepstring
+.Op Fl t Ar c
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility copies the named files side by side onto the standard output.
+The
+.Em n-th
+input lines from the input
+.Ar files
+are considered fragments of the single long
+.Em n-th
+output line into which they are assembled.
+The name `\fB\-\fP' means the standard input, and may be repeated.
+.Pp
+Normally, each option affects only the
+.Ar file
+after it.
+If the option letter is capitalized it affects all subsequent files
+until it appears again uncapitalized.
+The options are described below:
+.Bl -tag -width indent
+.It Fl f Ar min . Ns Ar max
+Print line fragments according to the format string
+.Ar min . Ns Ar max ,
+where
+.Ar min
+is the minimum field width and
+.Ar max
+the maximum field width.
+If
+.Ar min
+begins with a zero, zeros will be added to make up the field width,
+and if it begins with a `\-', the fragment will be left-adjusted
+within the field.
+.It Fl p Ar min . Ns Ar max
+Like
+.Fl f ,
+but pad this file's field when end-of-file is reached
+and other files are still active.
+.It Fl s Ar sepstring
+Print
+.Ar sepstring
+before printing line fragments from the next file.
+This option may appear after the last file.
+.It Fl t Ar c
+The input line terminator is
+.Ar c
+instead of a newline.
+The newline normally appended to each output line is omitted.
+.El
+.Pp
+To print files simultaneously for easy viewing use
+.Xr pr 1 .
+.Sh EXAMPLES
+The command
+.Bd -literal
+lam file1 file2 file3 file4
+.Ed
+.Pp
+joins 4 files together along each line.
+To merge the lines from four different files use
+.Bd -literal
+lam file1 \-S "\\
+" file2 file3 file4
+.Ed
+.Pp
+Every 2 lines of a file may be joined on one line with
+.Bd -literal
+lam \- \- < file
+.Ed
+.Pp
+and a form letter with substitutions keyed by `@' can be done with
+.Bd -literal
+lam \-t @ letter changes
+.Ed
+.Sh SEE ALSO
+.Xr join 1 ,
+.Xr paste 1 ,
+.Xr pr 1 ,
+.Xr printf 3
+.Sh STANDARDS
+Some of the functionality of
+.Nm
+is standardized as the
+.Xr paste 1
+utility by
+.St -p1003.2 .
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.2 .
+.Sh AUTHORS
+.An John A. Kunze
+.Sh BUGS
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c
new file mode 100644
index 0000000..60d1c52
--- /dev/null
+++ b/usr.bin/lam/lam.c
@@ -0,0 +1,226 @@
+/*-
+ * Copyright (c) 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) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)lam.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * lam - laminate files
+ * Author: John Kunze, UCB
+ */
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAXOFILES 20
+#define BIGBUFSIZ 5 * BUFSIZ
+
+static struct openfile { /* open file structure */
+ FILE *fp; /* file pointer */
+ short eof; /* eof flag */
+ short pad; /* pad flag for missing columns */
+ char eol; /* end of line character */
+ const char *sepstring; /* string to print before each line */
+ const char *format; /* printf(3) style string spec. */
+} input[MAXOFILES];
+
+static int morefiles; /* set by getargs(), changed by gatherline() */
+static int nofinalnl; /* normally append \n to each output line */
+static char line[BIGBUFSIZ];
+static char *linep;
+
+static char *gatherline(struct openfile *);
+static void getargs(char *[]);
+static char *pad(struct openfile *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct openfile *ip;
+
+ if (argc == 1)
+ usage();
+ getargs(argv);
+ if (!morefiles)
+ usage();
+ for (;;) {
+ linep = line;
+ for (ip = input; ip->fp != NULL; ip++)
+ linep = gatherline(ip);
+ if (!morefiles)
+ exit(0);
+ fputs(line, stdout);
+ fputs(ip->sepstring, stdout);
+ if (!nofinalnl)
+ putchar('\n');
+ }
+}
+
+static void
+getargs(char *av[])
+{
+ struct openfile *ip = input;
+ char *p, *c;
+ static char fmtbuf[BUFSIZ];
+ char *fmtp = fmtbuf;
+ int P, S, F, T;
+
+ P = S = F = T = 0; /* capitalized options */
+ while ((p = *++av) != NULL) {
+ if (*p != '-' || !p[1]) {
+ if (++morefiles >= MAXOFILES)
+ errx(1, "too many input files");
+ if (*p == '-')
+ ip->fp = stdin;
+ else if ((ip->fp = fopen(p, "r")) == NULL) {
+ err(1, "%s", p);
+ }
+ ip->pad = P;
+ if (!ip->sepstring)
+ ip->sepstring = (S ? (ip-1)->sepstring : "");
+ if (!ip->format)
+ ip->format = ((P || F) ? (ip-1)->format : "%s");
+ if (!ip->eol)
+ ip->eol = (T ? (ip-1)->eol : '\n');
+ ip++;
+ continue;
+ }
+ c = ++p;
+ switch (tolower((unsigned char)*c)) {
+ case 's':
+ if (*++p || (p = *++av))
+ ip->sepstring = p;
+ else
+ usage();
+ S = (*c == 'S' ? 1 : 0);
+ break;
+ case 't':
+ if (*++p || (p = *++av))
+ ip->eol = *p;
+ else
+ usage();
+ T = (*c == 'T' ? 1 : 0);
+ nofinalnl = 1;
+ break;
+ case 'p':
+ ip->pad = 1;
+ P = (*c == 'P' ? 1 : 0);
+ /* FALLTHROUGH */
+ case 'f':
+ F = (*c == 'F' ? 1 : 0);
+ if (*++p || (p = *++av)) {
+ fmtp += strlen(fmtp) + 1;
+ if (fmtp >= fmtbuf + sizeof(fmtbuf))
+ errx(1, "no more format space");
+ /* restrict format string to only valid width formatters */
+ if (strspn(p, "-.0123456789") != strlen(p))
+ errx(1, "invalid format string `%s'", p);
+ if (snprintf(fmtp, fmtbuf + sizeof(fmtbuf) - fmtp, "%%%ss", p)
+ >= fmtbuf + sizeof(fmtbuf) - fmtp)
+ errx(1, "no more format space");
+ ip->format = fmtp;
+ }
+ else
+ usage();
+ break;
+ default:
+ usage();
+ }
+ }
+ ip->fp = NULL;
+ if (!ip->sepstring)
+ ip->sepstring = "";
+}
+
+static char *
+pad(struct openfile *ip)
+{
+ char *lp = linep;
+
+ strlcpy(lp, ip->sepstring, line + sizeof(line) - lp);
+ lp += strlen(lp);
+ if (ip->pad) {
+ snprintf(lp, line + sizeof(line) - lp, ip->format, "");
+ lp += strlen(lp);
+ }
+ return (lp);
+}
+
+static char *
+gatherline(struct openfile *ip)
+{
+ char s[BUFSIZ];
+ int c;
+ char *p;
+ char *lp = linep;
+ char *end = s + sizeof(s) - 1;
+
+ if (ip->eof)
+ return (pad(ip));
+ for (p = s; (c = fgetc(ip->fp)) != EOF && p < end; p++)
+ if ((*p = c) == ip->eol)
+ break;
+ *p = '\0';
+ if (c == EOF) {
+ ip->eof = 1;
+ if (ip->fp == stdin)
+ fclose(stdin);
+ morefiles--;
+ return (pad(ip));
+ }
+ strlcpy(lp, ip->sepstring, line + sizeof(line) - lp);
+ lp += strlen(lp);
+ snprintf(lp, line + sizeof(line) - lp, ip->format, s);
+ lp += strlen(lp);
+ return (lp);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+"usage: lam [ -f min.max ] [ -s sepstring ] [ -t c ] file ...",
+" lam [ -p min.max ] [ -s sepstring ] [ -t c ] file ...");
+ exit(1);
+}
diff --git a/usr.bin/last/Makefile b/usr.bin/last/Makefile
new file mode 100644
index 0000000..fd63cd9
--- /dev/null
+++ b/usr.bin/last/Makefile
@@ -0,0 +1,8 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= last
+
+NO_WFORMAT=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/last/Makefile.depend b/usr.bin/last/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/last/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/last/last.1 b/usr.bin/last/last.1
new file mode 100644
index 0000000..19e0f0b
--- /dev/null
+++ b/usr.bin/last/last.1
@@ -0,0 +1,221 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)last.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt LAST 1
+.Os
+.Sh NAME
+.Nm last
+.Nd indicate last logins of users and ttys
+.Sh SYNOPSIS
+.Nm
+.Op Fl swy
+.Oo
+.Fl d
+.Sm off
+.Op Oo Ar CC Oc Ar YY
+.Op Ar MM DD
+.Ar hh mm
+.Op Ar .SS
+.Sm on
+.Oc
+.Op Fl f Ar file
+.Op Fl h Ar host
+.Op Fl n Ar maxrec
+.Op Fl t Ar tty
+.Op Ar user ...
+.Sh DESCRIPTION
+The
+.Nm
+utility will either list the sessions of specified
+.Ar users ,
+.Ar ttys ,
+and
+.Ar hosts ,
+in reverse time order,
+or list the users logged in at a specified date and time.
+Each line of output contains
+the user name, the tty from which the session was conducted, any
+hostname, the start and stop times for the session, and the duration
+of the session.
+If the session is still continuing or was cut short by
+a crash or shutdown,
+.Nm
+will so indicate.
+.Pp
+The following options are available:
+.Bl -tag -width indent-two
+.It Fl d Ar date
+Specify the snapshot date and time.
+All users logged in at the snapshot date and time will
+be reported.
+This may be used with the
+.Fl f
+option to derive the results from stored
+.Pa utx.log
+files.
+When this argument is provided, all other options except for
+.Fl f
+and
+.Fl n
+are ignored.
+The argument should be in the form
+.Sm off
+.Op Oo Ar CC Oc Ar YY
+.Op Ar MM DD
+.Ar hh mm
+.Op Ar .SS
+.Sm on
+where each pair of letters represents the following:
+.Pp
+.Bl -tag -width Ds -compact -offset indent
+.It Ar CC
+The first two digits of the year (the century).
+.It Ar YY
+The second two digits of the year.
+If
+.Ar YY
+is specified, but
+.Ar CC
+is not, a value for
+.Ar YY
+between 69 and 99 results in a
+.Ar CC
+value of 19.
+Otherwise, a
+.Ar CC
+value of 20 is used.
+.It Ar MM
+Month of the year, from 1 to 12.
+.It Ar DD
+Day of the month, from 1 to 31.
+.It Ar hh
+Hour of the day, from 0 to 23.
+.It Ar mm
+Minute of the hour, from 0 to 59.
+.It Ar SS
+Second of the minute, from 0 to 61.
+.El
+.Pp
+If the
+.Ar CC
+and
+.Ar YY
+letter pairs are not specified, the values default to the current
+year.
+If the
+.Ar SS
+letter pair is not specified, the value defaults to 0.
+.It Fl f Ar file
+Read the file
+.Ar file
+instead of the default,
+.Pa /var/log/utx.log .
+.It Fl h Ar host
+.Ar Host
+names may be names or internet numbers.
+.It Fl n Ar maxrec
+Limit the report to
+.Ar maxrec
+lines.
+.It Fl s
+Report the duration of the login session in seconds, instead of the
+default days, hours and minutes.
+.It Fl t Ar tty
+Specify the
+.Ar tty .
+Tty names may be given fully or abbreviated, for example,
+.Dq Li "last -t 03"
+is
+equivalent to
+.Dq Li "last -t tty03" .
+.It Fl w
+Widen the duration field to show seconds, as well as the
+default days, hours and minutes.
+.It Fl y
+Report the year in the session start time.
+.El
+.Pp
+If multiple arguments are given,
+and a snapshot time is not specified,
+the information which applies to any of the
+arguments is printed, e.g.,
+.Dq Li "last root -t console"
+would list all of
+.Dq Li root Ns 's
+sessions as well as all sessions on the console terminal.
+If no
+users, hostnames or terminals are specified,
+.Nm
+prints a record of
+all logins and logouts.
+.Pp
+The pseudo-user
+.Ar reboot
+logs in at reboots of the system, thus
+.Dq Li last reboot
+will give an indication of mean time between reboot.
+.Pp
+If
+.Nm
+is interrupted, it indicates to what date the search has
+progressed.
+If interrupted with a quit signal
+.Nm
+indicates how
+far the search has progressed and then continues.
+.Sh FILES
+.Bl -tag -width /var/log/utx.log -compact
+.It Pa /var/log/utx.log
+login data base
+.El
+.Sh SEE ALSO
+.Xr lastcomm 1 ,
+.Xr getutxent 3 ,
+.Xr ac 8 ,
+.Xr lastlogin 8
+.Sh HISTORY
+.Nm
+utility first appeared in
+.Bx 1 .
+.Sh AUTHORS
+.An -nosplit
+The original version was written by
+.An Howard P. Katseff ;
+.An Keith Bostic
+rewrote it in 1986/87 to add functionality and to improve code quality.
+.Sh BUGS
+If a login shell should terminate abnormally for some reason, it is likely
+that a logout record will not be written to the
+.Pa utx.log
+file.
+In this case,
+.Nm
+will indicate the logout time as "shutdown".
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
new file mode 100644
index 0000000..1db10b3
--- /dev/null
+++ b/usr.bin/last/last.c
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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) 1987, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <timeconv.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <sys/queue.h>
+
+#define NO 0 /* false/no */
+#define YES 1 /* true/yes */
+#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
+
+typedef struct arg {
+ char *name; /* argument */
+#define REBOOT_TYPE -1
+#define HOST_TYPE -2
+#define TTY_TYPE -3
+#define USER_TYPE -4
+ int type; /* type of arg */
+ struct arg *next; /* linked list pointer */
+} ARG;
+static ARG *arglist; /* head of linked list */
+
+static SLIST_HEAD(, idtab) idlist;
+
+struct idtab {
+ time_t logout; /* log out time */
+ char id[sizeof ((struct utmpx *)0)->ut_id]; /* identifier */
+ SLIST_ENTRY(idtab) list;
+};
+
+static const char *crmsg; /* cause of last reboot */
+static time_t currentout; /* current logout value */
+static long maxrec; /* records to display */
+static const char *file = NULL; /* utx.log file */
+static int sflag = 0; /* show delta in seconds */
+static int width = 5; /* show seconds in delta */
+static int yflag; /* show year */
+static int d_first;
+static int snapfound = 0; /* found snapshot entry? */
+static time_t snaptime; /* if != 0, we will only
+ * report users logged in
+ * at this snapshot time
+ */
+
+static void addarg(int, char *);
+static time_t dateconv(char *);
+static void doentry(struct utmpx *);
+static void hostconv(char *);
+static void printentry(struct utmpx *, struct idtab *);
+static char *ttyconv(char *);
+static int want(struct utmpx *);
+static void usage(void);
+static void wtmp(void);
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+"usage: last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
+" [-n maxrec] [-t tty] [user ...]\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+ char *p;
+
+ (void) setlocale(LC_TIME, "");
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+
+ maxrec = -1;
+ snaptime = 0;
+ while ((ch = getopt(argc, argv, "0123456789d:f:h:n:st:wy")) != -1)
+ switch (ch) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ /*
+ * kludge: last was originally designed to take
+ * a number after a dash.
+ */
+ if (maxrec == -1) {
+ p = strchr(argv[optind - 1], ch);
+ if (p == NULL)
+ p = strchr(argv[optind], ch);
+ maxrec = atol(p);
+ if (!maxrec)
+ exit(0);
+ }
+ break;
+ case 'd':
+ snaptime = dateconv(optarg);
+ break;
+ case 'f':
+ file = optarg;
+ break;
+ case 'h':
+ hostconv(optarg);
+ addarg(HOST_TYPE, optarg);
+ break;
+ case 'n':
+ errno = 0;
+ maxrec = strtol(optarg, &p, 10);
+ if (p == optarg || *p != '\0' || errno != 0 ||
+ maxrec <= 0)
+ errx(1, "%s: bad line count", optarg);
+ break;
+ case 's':
+ sflag++; /* Show delta as seconds */
+ break;
+ case 't':
+ addarg(TTY_TYPE, ttyconv(optarg));
+ break;
+ case 'w':
+ width = 8;
+ break;
+ case 'y':
+ yflag++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ if (sflag && width == 8) usage();
+
+ if (argc) {
+ setlinebuf(stdout);
+ for (argv += optind; *argv; ++argv) {
+ if (strcmp(*argv, "reboot") == 0)
+ addarg(REBOOT_TYPE, *argv);
+#define COMPATIBILITY
+#ifdef COMPATIBILITY
+ /* code to allow "last p5" to work */
+ addarg(TTY_TYPE, ttyconv(*argv));
+#endif
+ addarg(USER_TYPE, *argv);
+ }
+ }
+ wtmp();
+ exit(0);
+}
+
+/*
+ * wtmp --
+ * read through the utx.log file
+ */
+static void
+wtmp(void)
+{
+ struct utmpx *buf = NULL;
+ struct utmpx *ut;
+ static unsigned int amount = 0;
+ time_t t;
+ char ct[80];
+ struct tm *tm;
+
+ SLIST_INIT(&idlist);
+ (void)time(&t);
+
+ /* Load the last entries from the file. */
+ if (setutxdb(UTXDB_LOG, file) != 0)
+ err(1, "%s", file);
+ while ((ut = getutxent()) != NULL) {
+ if (amount % 128 == 0) {
+ buf = realloc(buf, (amount + 128) * sizeof *ut);
+ if (buf == NULL)
+ err(1, "realloc");
+ }
+ memcpy(&buf[amount++], ut, sizeof *ut);
+ if (t > ut->ut_tv.tv_sec)
+ t = ut->ut_tv.tv_sec;
+ }
+ endutxent();
+
+ /* Display them in reverse order. */
+ while (amount > 0)
+ doentry(&buf[--amount]);
+
+ tm = localtime(&t);
+ (void) strftime(ct, sizeof(ct), "%+", tm);
+ printf("\n%s begins %s\n", ((file == NULL) ? "utx.log" : file), ct);
+}
+
+/*
+ * doentry --
+ * process a single utx.log entry
+ */
+static void
+doentry(struct utmpx *bp)
+{
+ struct idtab *tt;
+
+ /* the machine stopped */
+ if (bp->ut_type == BOOT_TIME || bp->ut_type == SHUTDOWN_TIME) {
+ /* everybody just logged out */
+ while ((tt = SLIST_FIRST(&idlist)) != NULL) {
+ SLIST_REMOVE_HEAD(&idlist, list);
+ free(tt);
+ }
+ currentout = -bp->ut_tv.tv_sec;
+ crmsg = bp->ut_type != SHUTDOWN_TIME ?
+ "crash" : "shutdown";
+ /*
+ * if we're in snapshot mode, we want to exit if this
+ * shutdown/reboot appears while we we are tracking the
+ * active range
+ */
+ if (snaptime && snapfound)
+ exit(0);
+ /*
+ * don't print shutdown/reboot entries unless flagged for
+ */
+ if (!snaptime && want(bp))
+ printentry(bp, NULL);
+ return;
+ }
+ /* date got set */
+ if (bp->ut_type == OLD_TIME || bp->ut_type == NEW_TIME) {
+ if (want(bp) && !snaptime)
+ printentry(bp, NULL);
+ return;
+ }
+
+ if (bp->ut_type != USER_PROCESS && bp->ut_type != DEAD_PROCESS)
+ return;
+
+ /* find associated identifier */
+ SLIST_FOREACH(tt, &idlist, list)
+ if (!memcmp(tt->id, bp->ut_id, sizeof bp->ut_id))
+ break;
+
+ if (tt == NULL) {
+ /* add new one */
+ tt = malloc(sizeof(struct idtab));
+ if (tt == NULL)
+ errx(1, "malloc failure");
+ tt->logout = currentout;
+ memcpy(tt->id, bp->ut_id, sizeof bp->ut_id);
+ SLIST_INSERT_HEAD(&idlist, tt, list);
+ }
+
+ /*
+ * print record if not in snapshot mode and wanted
+ * or in snapshot mode and in snapshot range
+ */
+ if (bp->ut_type == USER_PROCESS && (want(bp) ||
+ (bp->ut_tv.tv_sec < snaptime &&
+ (tt->logout > snaptime || tt->logout < 1)))) {
+ snapfound = 1;
+ printentry(bp, tt);
+ }
+ tt->logout = bp->ut_tv.tv_sec;
+}
+
+/*
+ * printentry --
+ * output an entry
+ *
+ * If `tt' is non-NULL, use it and `crmsg' to print the logout time or
+ * logout type (crash/shutdown) as appropriate.
+ */
+static void
+printentry(struct utmpx *bp, struct idtab *tt)
+{
+ char ct[80];
+ struct tm *tm;
+ time_t delta; /* time difference */
+ time_t t;
+
+ if (maxrec != -1 && !maxrec--)
+ exit(0);
+ t = bp->ut_tv.tv_sec;
+ tm = localtime(&t);
+ (void) strftime(ct, sizeof(ct), d_first ?
+ (yflag ? "%a %e %b %Y %R" : "%a %e %b %R") :
+ (yflag ? "%a %b %e %Y %R" : "%a %b %e %R"), tm);
+ switch (bp->ut_type) {
+ case BOOT_TIME:
+ printf("%-42s", "boot time");
+ break;
+ case SHUTDOWN_TIME:
+ printf("%-42s", "shutdown time");
+ break;
+ case OLD_TIME:
+ printf("%-42s", "old time");
+ break;
+ case NEW_TIME:
+ printf("%-42s", "new time");
+ break;
+ case USER_PROCESS:
+ printf("%-10s %-8s %-22.22s",
+ bp->ut_user, bp->ut_line, bp->ut_host);
+ break;
+ }
+ printf(" %s%c", ct, tt == NULL ? '\n' : ' ');
+ if (tt == NULL)
+ return;
+ if (!tt->logout) {
+ puts(" still logged in");
+ return;
+ }
+ if (tt->logout < 0) {
+ tt->logout = -tt->logout;
+ printf("- %s", crmsg);
+ } else {
+ tm = localtime(&tt->logout);
+ (void) strftime(ct, sizeof(ct), "%R", tm);
+ printf("- %s", ct);
+ }
+ delta = tt->logout - bp->ut_tv.tv_sec;
+ if (sflag) {
+ printf(" (%8ld)\n", (long)delta);
+ } else {
+ tm = gmtime(&delta);
+ (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", tm);
+ if (delta < 86400)
+ printf(" (%s)\n", ct);
+ else
+ printf(" (%ld+%s)\n", (long)delta / 86400, ct);
+ }
+}
+
+/*
+ * want --
+ * see if want this entry
+ */
+static int
+want(struct utmpx *bp)
+{
+ ARG *step;
+
+ if (snaptime)
+ return (NO);
+
+ if (!arglist)
+ return (YES);
+
+ for (step = arglist; step; step = step->next)
+ switch(step->type) {
+ case REBOOT_TYPE:
+ if (bp->ut_type == BOOT_TIME ||
+ bp->ut_type == SHUTDOWN_TIME)
+ return (YES);
+ break;
+ case HOST_TYPE:
+ if (!strcasecmp(step->name, bp->ut_host))
+ return (YES);
+ break;
+ case TTY_TYPE:
+ if (!strcmp(step->name, bp->ut_line))
+ return (YES);
+ break;
+ case USER_TYPE:
+ if (!strcmp(step->name, bp->ut_user))
+ return (YES);
+ break;
+ }
+ return (NO);
+}
+
+/*
+ * addarg --
+ * add an entry to a linked list of arguments
+ */
+static void
+addarg(int type, char *arg)
+{
+ ARG *cur;
+
+ if ((cur = malloc(sizeof(ARG))) == NULL)
+ errx(1, "malloc failure");
+ cur->next = arglist;
+ cur->type = type;
+ cur->name = arg;
+ arglist = cur;
+}
+
+/*
+ * hostconv --
+ * convert the hostname to search pattern; if the supplied host name
+ * has a domain attached that is the same as the current domain, rip
+ * off the domain suffix since that's what login(1) does.
+ */
+static void
+hostconv(char *arg)
+{
+ static int first = 1;
+ static char *hostdot, name[MAXHOSTNAMELEN];
+ char *argdot;
+
+ if (!(argdot = strchr(arg, '.')))
+ return;
+ if (first) {
+ first = 0;
+ if (gethostname(name, sizeof(name)))
+ err(1, "gethostname");
+ hostdot = strchr(name, '.');
+ }
+ if (hostdot && !strcasecmp(hostdot, argdot))
+ *argdot = '\0';
+}
+
+/*
+ * ttyconv --
+ * convert tty to correct name.
+ */
+static char *
+ttyconv(char *arg)
+{
+ char *mval;
+
+ /*
+ * kludge -- we assume that all tty's end with
+ * a two character suffix.
+ */
+ if (strlen(arg) == 2) {
+ /* either 6 for "ttyxx" or 8 for "console" */
+ if ((mval = malloc(8)) == NULL)
+ errx(1, "malloc failure");
+ if (!strcmp(arg, "co"))
+ (void)strcpy(mval, "console");
+ else {
+ (void)strcpy(mval, "tty");
+ (void)strcpy(mval + 3, arg);
+ }
+ return (mval);
+ }
+ if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1))
+ return (arg + 5);
+ return (arg);
+}
+
+/*
+ * dateconv --
+ * Convert the snapshot time in command line given in the format
+ * [[CC]YY]MMDDhhmm[.SS]] to a time_t.
+ * Derived from atime_arg1() in usr.bin/touch/touch.c
+ */
+static time_t
+dateconv(char *arg)
+{
+ time_t timet;
+ struct tm *t;
+ int yearset;
+ char *p;
+
+ /* Start with the current time. */
+ if (time(&timet) < 0)
+ err(1, "time");
+ if ((t = localtime(&timet)) == NULL)
+ err(1, "localtime");
+
+ /* [[CC]YY]MMDDhhmm[.SS] */
+ if ((p = strchr(arg, '.')) == NULL)
+ t->tm_sec = 0; /* Seconds defaults to 0. */
+ else {
+ if (strlen(p + 1) != 2)
+ goto terr;
+ *p++ = '\0';
+ t->tm_sec = ATOI2(p);
+ }
+
+ yearset = 0;
+ switch (strlen(arg)) {
+ case 12: /* CCYYMMDDhhmm */
+ t->tm_year = ATOI2(arg);
+ t->tm_year *= 100;
+ yearset = 1;
+ /* FALLTHROUGH */
+ case 10: /* YYMMDDhhmm */
+ if (yearset) {
+ yearset = ATOI2(arg);
+ t->tm_year += yearset;
+ } else {
+ yearset = ATOI2(arg);
+ if (yearset < 69)
+ t->tm_year = yearset + 2000;
+ else
+ t->tm_year = yearset + 1900;
+ }
+ t->tm_year -= 1900; /* Convert to UNIX time. */
+ /* FALLTHROUGH */
+ case 8: /* MMDDhhmm */
+ t->tm_mon = ATOI2(arg);
+ --t->tm_mon; /* Convert from 01-12 to 00-11 */
+ t->tm_mday = ATOI2(arg);
+ t->tm_hour = ATOI2(arg);
+ t->tm_min = ATOI2(arg);
+ break;
+ case 4: /* hhmm */
+ t->tm_hour = ATOI2(arg);
+ t->tm_min = ATOI2(arg);
+ break;
+ default:
+ goto terr;
+ }
+ t->tm_isdst = -1; /* Figure out DST. */
+ timet = mktime(t);
+ if (timet == -1)
+terr: errx(1,
+ "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
+ return timet;
+}
diff --git a/usr.bin/lastcomm/Makefile b/usr.bin/lastcomm/Makefile
new file mode 100644
index 0000000..238551b
--- /dev/null
+++ b/usr.bin/lastcomm/Makefile
@@ -0,0 +1,15 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PACKAGE=acct
+
+PROG= lastcomm
+SRCS= lastcomm.c readrec.c
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lastcomm/Makefile.depend b/usr.bin/lastcomm/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/lastcomm/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/lastcomm/lastcomm.1 b/usr.bin/lastcomm/lastcomm.1
new file mode 100644
index 0000000..10ee896
--- /dev/null
+++ b/usr.bin/lastcomm/lastcomm.1
@@ -0,0 +1,185 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" From: @(#)lastcomm.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 17, 2012
+.Dt LASTCOMM 1
+.Os
+.Sh NAME
+.Nm lastcomm
+.Nd show last commands executed
+.Sh SYNOPSIS
+.Nm
+.Op Fl EScesu
+.Op Fl f Ar file
+.Op Cm + Ns Ar format
+.Op Ar command ...\&
+.Op Ar user ...\&
+.Op Ar terminal ...\&
+.Sh DESCRIPTION
+The
+.Nm
+utility gives information on previously executed commands.
+With no arguments,
+.Nm
+prints information about all the commands recorded
+during the current accounting file's lifetime.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl E
+Print the time the process exited.
+.It Fl S
+Print the time the process started.
+.It Fl c
+Print the amount of cpu time used by the process.
+.It Fl e
+Print the amount of elapsed time used by the process.
+.It Fl s
+Print the amount of system time used by the process.
+.It Fl u
+Print the amount of user time used by the process.
+.It Fl f Ar file
+Read from
+.Ar file
+rather than the default
+.Pa /var/account/acct .
+If
+.Ar file
+is a single dash
+.Pq Sq \&-
+.Nm
+reads accounting entries from the standard input.
+.El
+.Pp
+An operand with a leading plus sign
+.Pq Sq +
+is followed a user-defined format string which specifies the format
+in which to display the process's start or exit date and time.
+The format string may contain any of the conversion specifications
+described in the
+.Xr strftime 3
+manual page, as well as arbitrary text.
+.Pp
+If no options are specified,
+.Fl cS
+is assumed.
+If
+.Nm
+is invoked with arguments, only accounting entries with a
+matching
+.Ar command
+name,
+.Ar user
+name,
+or
+.Ar terminal
+name
+are printed.
+For example:
+.Pp
+.Dl lastcomm a.out root ttyd0
+.Pp
+would produce a listing of all the
+executions of commands named
+.Pa a.out
+by user
+.Ar root
+on the terminal
+.Ar ttyd0 .
+.Pp
+For each process entry, the following are printed.
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+The name of the user who ran the process.
+.It
+Flags, as accumulated by the accounting facilities in the system.
+.It
+The command name under which the process was called.
+.It
+The amount of
+CPU
+.Pq Fl c ,
+wall
+.Pq Fl e ,
+system
+.Pq Fl s ,
+or user
+.Pq Fl u
+time used by the process (in seconds).
+.It
+The time the process started
+.Pq Fl S
+or exited
+.Pq Fl E .
+.El
+.Pp
+The flags are encoded as follows: ``S'' indicates the command was
+executed by the super-user, ``F'' indicates the command ran after
+a fork, but without a following
+.Xr exec 3 ,
+.\" ``C'' indicates the command was run in PDP-11 compatibility mode
+.\" (VAX only),
+``D'' indicates the command terminated with the generation of a
+.Pa core
+file, and ``X'' indicates the command was terminated with a signal.
+.Pp
+By default, accounting entries are printed going backwards in time,
+starting from the time
+.Nm
+was executed.
+However, if
+.Nm
+reads entries from its standard input, then entries are printed in
+the order they are read.
+.Sh FILES
+.Bl -tag -width /var/account/acct -compact
+.It Pa /var/account/acct
+default accounting file
+.El
+.Sh EXAMPLES
+The command
+.Dl lastcomm -Ee
+will print the exit time and elapsed time of each command logged in
+.Pa /var/account/acct ,
+while
+.Dl tail -f -c 0 /var/account/acct | lastcomm -f -
+will print details of each terminating command.
+.Sh SEE ALSO
+.Xr last 1 ,
+.Xr sigaction 2 ,
+.Xr strftime 3 ,
+.Xr acct 5 ,
+.Xr core 5
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c
new file mode 100644
index 0000000..b2a0f0f
--- /dev/null
+++ b/usr.bin/lastcomm/lastcomm.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)lastcomm.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/acct.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include "pathnames.h"
+
+/*XXX*/#include <inttypes.h>
+
+time_t expand(u_int);
+char *flagbits(int);
+const char *getdev(dev_t);
+int readrec_forward(FILE *f, struct acctv2 *av2);
+int readrec_backward(FILE *f, struct acctv2 *av2);
+int requested(char *[], struct acctv2 *);
+static void usage(void);
+
+#define AC_UTIME 1 /* user */
+#define AC_STIME 2 /* system */
+#define AC_ETIME 4 /* elapsed */
+#define AC_CTIME 8 /* user + system time, default */
+
+#define AC_BTIME 16 /* starting time */
+#define AC_FTIME 32 /* exit time (starting time + elapsed time )*/
+
+int
+main(int argc, char *argv[])
+{
+ struct acctv2 ab;
+ char *p;
+ FILE *fp;
+ int (*readrec)(FILE *f, struct acctv2 *av2);
+ time_t t;
+ int ch, rv;
+ const char *acctfile, *format;
+ char buf[1024];
+ int flags = 0;
+
+ acctfile = _PATH_ACCT;
+ format = NULL;
+ while ((ch = getopt(argc, argv, "f:usecSE")) != -1)
+ switch((char)ch) {
+ case 'f':
+ acctfile = optarg;
+ break;
+
+ case 'u':
+ flags |= AC_UTIME; /* user time */
+ break;
+ case 's':
+ flags |= AC_STIME; /* system time */
+ break;
+ case 'e':
+ flags |= AC_ETIME; /* elapsed time */
+ break;
+ case 'c':
+ flags |= AC_CTIME; /* user + system time */
+ break;
+
+ case 'S':
+ flags |= AC_BTIME; /* starting time */
+ break;
+ case 'E':
+ /* exit time (starting time + elapsed time )*/
+ flags |= AC_FTIME;
+ break;
+
+ case '?':
+ default:
+ usage();
+ }
+
+ /* default user + system time and starting time */
+ if (!flags) {
+ flags = AC_CTIME | AC_BTIME;
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0 && **argv == '+') {
+ format = *argv + 1; /* skip + */
+ argc--;
+ argv++;
+ }
+
+ if (strcmp(acctfile, "-") == 0) {
+ fp = stdin;
+ readrec = readrec_forward;
+ } else {
+ /* Open the file. */
+ if ((fp = fopen(acctfile, "r")) == NULL)
+ err(1, "could not open %s", acctfile);
+ if (fseek(fp, 0l, SEEK_END) == -1)
+ err(1, "seek to end of %s failed", acctfile);
+ readrec = readrec_backward;
+ }
+
+ while ((rv = readrec(fp, &ab)) == 1) {
+ for (p = &ab.ac_comm[0];
+ p < &ab.ac_comm[AC_COMM_LEN] && *p; ++p)
+ if (!isprint(*p))
+ *p = '?';
+
+ if (*argv && !requested(argv, &ab))
+ continue;
+
+ (void)printf("%-*.*s %-7s %-*s %-8s",
+ AC_COMM_LEN, AC_COMM_LEN, ab.ac_comm,
+ flagbits(ab.ac_flagx),
+ MAXLOGNAME - 1, user_from_uid(ab.ac_uid, 0),
+ getdev(ab.ac_tty));
+
+
+ /* user + system time */
+ if (flags & AC_CTIME) {
+ (void)printf(" %6.3f secs",
+ (ab.ac_utime + ab.ac_stime) / 1000000);
+ }
+
+ /* usr time */
+ if (flags & AC_UTIME) {
+ (void)printf(" %6.3f us", ab.ac_utime / 1000000);
+ }
+
+ /* system time */
+ if (flags & AC_STIME) {
+ (void)printf(" %6.3f sy", ab.ac_stime / 1000000);
+ }
+
+ /* elapsed time */
+ if (flags & AC_ETIME) {
+ (void)printf(" %8.3f es", ab.ac_etime / 1000000);
+ }
+
+ /* starting time */
+ if (flags & AC_BTIME) {
+ if (format != NULL) {
+ (void)strftime(buf, sizeof(buf), format,
+ localtime(&ab.ac_btime));
+ (void)printf(" %s", buf);
+ } else
+ (void)printf(" %.16s", ctime(&ab.ac_btime));
+ }
+
+ /* exit time (starting time + elapsed time )*/
+ if (flags & AC_FTIME) {
+ t = ab.ac_btime;
+ t += (time_t)(ab.ac_etime / 1000000);
+ if (format != NULL) {
+ (void)strftime(buf, sizeof(buf), format,
+ localtime(&t));
+ (void)printf(" %s", buf);
+ } else
+ (void)printf(" %.16s", ctime(&t));
+ }
+ printf("\n");
+ }
+ if (rv == EOF)
+ err(1, "read record from %s failed", acctfile);
+
+ if (fflush(stdout))
+ err(1, "stdout");
+ exit(0);
+}
+
+char *
+flagbits(int f)
+{
+ static char flags[20] = "-";
+ char *p;
+
+#define BIT(flag, ch) if (f & flag) *p++ = ch
+
+ p = flags + 1;
+ BIT(ASU, 'S');
+ BIT(AFORK, 'F');
+ BIT(ACOMPAT, 'C');
+ BIT(ACORE, 'D');
+ BIT(AXSIG, 'X');
+ *p = '\0';
+ return (flags);
+}
+
+int
+requested(char *argv[], struct acctv2 *acp)
+{
+ const char *p;
+
+ do {
+ p = user_from_uid(acp->ac_uid, 0);
+ if (!strcmp(p, *argv))
+ return (1);
+ if ((p = getdev(acp->ac_tty)) && !strcmp(p, *argv))
+ return (1);
+ if (!strncmp(acp->ac_comm, *argv, AC_COMM_LEN))
+ return (1);
+ } while (*++argv);
+ return (0);
+}
+
+const char *
+getdev(dev_t dev)
+{
+ static dev_t lastdev = (dev_t)-1;
+ static const char *lastname;
+
+ if (dev == NODEV) /* Special case. */
+ return ("__");
+ if (dev == lastdev) /* One-element cache. */
+ return (lastname);
+ lastdev = dev;
+ lastname = devname(dev, S_IFCHR);
+ return (lastname);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: lastcomm [-EScesu] [-f file] [+format] [command ...] "
+ "[user ...] [terminal ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/lastcomm/pathnames.h b/usr.bin/lastcomm/pathnames.h
new file mode 100644
index 0000000..7415545
--- /dev/null
+++ b/usr.bin/lastcomm/pathnames.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ *
+ * $FreeBSD$
+ */
+
+#define _PATH_ACCT "/var/account/acct"
diff --git a/usr.bin/lastcomm/readrec.c b/usr.bin/lastcomm/readrec.c
new file mode 100644
index 0000000..5de7c5c
--- /dev/null
+++ b/usr.bin/lastcomm/readrec.c
@@ -0,0 +1,227 @@
+/*-
+ * Copyright (c) 2007 Diomidis Spinellis
+ * 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/stat.h>
+#include <sys/types.h>
+#include <sys/acct.h>
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+
+int readrec_forward(FILE *f, struct acctv2 *av2);
+int readrec_backward(FILE *f, struct acctv2 *av2);
+
+/*
+ * Reverse offsetof: return the offset of field f
+ * from the end of the structure s.
+ */
+#define roffsetof(s, f) (sizeof(s) - offsetof(s, f))
+
+/*
+ * Read exactly one record of size size from stream f into ptr.
+ * Failure to read the complete record is considered a file format error,
+ * and will set errno to EFTYPE.
+ * Return 0 on success, EOF on end of file or error.
+ */
+static int
+fread_record(void *ptr, size_t size, FILE *f)
+{
+ size_t rv;
+
+ if ((rv = fread(ptr, 1, size, f)) == size)
+ return (0);
+ else if (ferror(f) || rv == 0)
+ return (EOF);
+ else {
+ /* Short read. */
+ errno = EFTYPE;
+ return (EOF);
+ }
+}
+
+/*
+ * Return the value of a comp_t field.
+ */
+static float
+decode_comp(comp_t v)
+{
+ int result, exp;
+
+ result = v & 017777;
+ for (exp = v >> 13; exp; exp--)
+ result <<= 3;
+ return ((double)result / AHZV1);
+}
+
+/*
+ * Read a v1 accounting record stored at the current
+ * position of stream f.
+ * Convert the data to the current record format.
+ * Return EOF on error or end-of-file.
+ */
+static int
+readrec_v1(FILE *f, struct acctv2 *av2)
+{
+ struct acctv1 av1;
+ int rv;
+
+ if ((rv = fread_record(&av1, sizeof(av1), f)) == EOF)
+ return (EOF);
+ av2->ac_zero = 0;
+ av2->ac_version = 2;
+ av2->ac_len = av2->ac_len2 = sizeof(*av2);
+ memcpy(av2->ac_comm, av1.ac_comm, AC_COMM_LEN);
+ av2->ac_utime = decode_comp(av1.ac_utime) * 1000000;
+ av2->ac_stime = decode_comp(av1.ac_stime) * 1000000;
+ av2->ac_etime = decode_comp(av1.ac_etime) * 1000000;
+ av2->ac_btime = av1.ac_btime;
+ av2->ac_uid = av1.ac_uid;
+ av2->ac_gid = av1.ac_gid;
+ av2->ac_mem = av1.ac_mem;
+ av2->ac_io = decode_comp(av1.ac_io);
+ av2->ac_tty = av1.ac_tty;
+ av2->ac_flagx = av1.ac_flag | ANVER;
+ return (0);
+}
+
+/*
+ * Read an v2 accounting record stored at the current
+ * position of stream f.
+ * Return EOF on error or end-of-file.
+ */
+static int
+readrec_v2(FILE *f, struct acctv2 *av2)
+{
+ return (fread_record(av2, sizeof(*av2), f));
+}
+
+/*
+ * Read a new-style (post-v1) accounting record stored at
+ * the current position of stream f.
+ * Convert the data to the current record format.
+ * Return EOF on error or end-of-file.
+ */
+static int
+readrec_vx(FILE *f, struct acctv2 *av2)
+{
+ uint8_t magic, version;
+
+ if (fread_record(&magic, sizeof(magic), f) == EOF ||
+ fread_record(&version, sizeof(version), f) == EOF ||
+ ungetc(version, f) == EOF ||
+ ungetc(magic, f) == EOF)
+ return (EOF);
+ switch (version) {
+ case 2:
+ return (readrec_v2(f, av2));
+
+ /* Add handling for more versions here. */
+
+ default:
+ errno = EFTYPE;
+ return (EOF);
+ }
+}
+
+/*
+ * Read an accounting record stored at the current
+ * position of stream f.
+ * Old-format records are converted to the current record
+ * format.
+ * Return the number of records read (1 or 0 at the end-of-file),
+ * or EOF on error.
+ */
+int
+readrec_forward(FILE *f, struct acctv2 *av2)
+{
+ int magic, rv;
+
+ if ((magic = getc(f)) == EOF)
+ return (ferror(f) ? EOF : 0);
+ if (ungetc(magic, f) == EOF)
+ return (EOF);
+ if (magic != 0)
+ /* Old record format. */
+ rv = readrec_v1(f, av2);
+ else
+ /* New record formats. */
+ rv = readrec_vx(f, av2);
+ return (rv == EOF ? EOF : 1);
+}
+
+/*
+ * Read an accounting record ending at the current
+ * position of stream f.
+ * Old-format records are converted to the current record
+ * format.
+ * The file pointer is positioned at the beginning of the
+ * record read.
+ * Return the number of records read (1 or 0 at the end-of-file),
+ * or EOF on error.
+ */
+int
+readrec_backward(FILE *f, struct acctv2 *av2)
+{
+ off_t pos;
+ int c;
+ uint16_t len;
+
+ if ((pos = ftell(f)) == -1)
+ return (EOF);
+ if (pos == 0)
+ return (0);
+ if (fseek(f, -roffsetof(struct acctv2, ac_trailer),
+ SEEK_CUR) == EOF ||
+ (c = getc(f)) == EOF)
+ return (EOF);
+ if (c & ANVER) {
+ /* New record formats. */
+ if (fseeko(f, pos - roffsetof(struct acctv2, ac_len2),
+ SEEK_SET) == EOF ||
+ fread_record(&len, sizeof(len), f) == EOF ||
+ fseeko(f, pos - len, SEEK_SET) == EOF ||
+ readrec_vx(f, av2) == EOF ||
+ fseeko(f, pos - len, SEEK_SET) == EOF)
+ return (EOF);
+ else
+ return (1);
+ } else {
+ /* Old record format. */
+ if (fseeko(f, pos - sizeof(struct acctv1), SEEK_SET) == EOF ||
+ readrec_v1(f, av2) == EOF ||
+ fseeko(f, pos - sizeof(struct acctv1), SEEK_SET) == EOF)
+ return (EOF);
+ else
+ return (1);
+ }
+}
diff --git a/usr.bin/lastcomm/tests/Makefile b/usr.bin/lastcomm/tests/Makefile
new file mode 100644
index 0000000..3aa4b75
--- /dev/null
+++ b/usr.bin/lastcomm/tests/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= v1-amd64-acct.in
+${PACKAGE}FILES+= v1-amd64.out
+${PACKAGE}FILES+= v1-i386-acct.in
+${PACKAGE}FILES+= v1-i386.out
+${PACKAGE}FILES+= v1-sparc64-acct.in
+${PACKAGE}FILES+= v1-sparc64.out
+${PACKAGE}FILES+= v2-amd64-acct.in
+${PACKAGE}FILES+= v2-amd64.out
+${PACKAGE}FILES+= v2-i386-acct.in
+${PACKAGE}FILES+= v2-i386.out
+${PACKAGE}FILES+= v2-sparc64-acct.in
+${PACKAGE}FILES+= v2-sparc64.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/lastcomm/tests/Makefile.depend b/usr.bin/lastcomm/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/lastcomm/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/lastcomm/tests/README b/usr.bin/lastcomm/tests/README
new file mode 100644
index 0000000..62e0281
--- /dev/null
+++ b/usr.bin/lastcomm/tests/README
@@ -0,0 +1,10 @@
+$FreeBSD$
+
+To create the files for regression testing do the following.
+
+1. Run values.sh for a given architecture and accounting version.
+2. Unpack the generated file and rename acct into VERSION-ARCH.acct.
+3. Run lastcomm -cuseS -f VERSION-ARCH-acct.in |
+ awk '{$4 = ""; print}' >VERSION-ARCH.out.
+4. Compare the reported values in VERSION-ARCH.out against the
+ *.time values found in the file that values.sh generated.
diff --git a/usr.bin/lastcomm/tests/legacy_test.sh b/usr.bin/lastcomm/tests/legacy_test.sh
new file mode 100644
index 0000000..35ef78b
--- /dev/null
+++ b/usr.bin/lastcomm/tests/legacy_test.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+DIR=`dirname $0`
+ARCH=`uname -m`
+
+TZ=UTC; export TZ
+
+check()
+{
+ NUM=$1
+ shift
+ # Remove tty field, which varies between systems.
+ awk '{$4 = ""; print}' |
+ if diff -q - $1
+ then
+ echo "ok $NUM"
+ else
+ echo "not ok $NUM"
+ fi
+}
+
+
+cat $DIR/v1-$ARCH-acct.in $DIR/v2-$ARCH-acct.in >v1v2-$ARCH-acct.in
+cat $DIR/v2-$ARCH.out $DIR/v1-$ARCH.out >v1v2-$ARCH.out
+
+echo 1..6
+
+lastcomm -cesuS -f $DIR/v1-$ARCH-acct.in | check 1 $DIR/v1-$ARCH.out
+lastcomm -cesuS -f - <$DIR/v1-$ARCH-acct.in | tail -r | check 2 $DIR/v1-$ARCH.out
+lastcomm -cesuS -f $DIR/v2-$ARCH-acct.in | check 3 $DIR/v2-$ARCH.out
+lastcomm -cesuS -f - <$DIR/v2-$ARCH-acct.in | tail -r | check 4 $DIR/v2-$ARCH.out
+lastcomm -cesuS -f v1v2-$ARCH-acct.in | check 5 v1v2-$ARCH.out
+lastcomm -cesuS -f - <v1v2-$ARCH-acct.in | tail -r | check 6 v1v2-$ARCH.out
+
+exit 0
diff --git a/usr.bin/lastcomm/tests/v1-amd64-acct.in b/usr.bin/lastcomm/tests/v1-amd64-acct.in
new file mode 100644
index 0000000..50546a3
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-amd64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-amd64.out b/usr.bin/lastcomm/tests/v1-amd64.out
new file mode 100644
index 0000000..bacbd57
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-amd64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+core -DX root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+cc - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 11:44
+ld - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+as - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+cc1 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.234 es Wed May 16 11:44
+diff - root 0.203 secs 0.203 us 0.000 sy 0.234 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 11:44
+dd - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 3.016 es Wed May 16 11:44
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 1.938 es Wed May 16 11:44
+find - root 0.250 secs 0.031 us 0.219 sy 1.938 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 3.062 es Wed May 16 11:44
+egrep - root 3.031 secs 3.031 us 0.000 sy 3.062 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.188 es Wed May 16 11:44
+awk - root 0.172 secs 0.172 us 0.000 sy 0.188 es Wed May 16 11:44
+accton - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
diff --git a/usr.bin/lastcomm/tests/v1-i386-acct.in b/usr.bin/lastcomm/tests/v1-i386-acct.in
new file mode 100644
index 0000000..f427c0e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-i386-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-i386.out b/usr.bin/lastcomm/tests/v1-i386.out
new file mode 100644
index 0000000..86ec9e2
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-i386.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+core -DX root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+cc - root 0.000 secs 0.000 us 0.000 sy 0.469 es Fri May 18 11:34
+ld - root 0.000 secs 0.000 us 0.000 sy 0.109 es Fri May 18 11:34
+as - root 0.000 secs 0.000 us 0.000 sy 0.047 es Fri May 18 11:34
+cc1 - root 0.016 secs 0.016 us 0.000 sy 0.203 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+123456789012345 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.359 es Fri May 18 11:34
+diff - root 0.312 secs 0.297 us 0.016 sy 0.359 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+dd - root 0.016 secs 0.000 us 0.016 sy 0.031 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 3.406 es Fri May 18 11:34
+find - root 0.266 secs 0.062 us 0.203 sy 3.406 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 5.047 es Fri May 18 11:33
+egrep - root 4.984 secs 4.984 us 0.000 sy 5.047 es Fri May 18 11:33
+time - root 0.000 secs 0.000 us 0.000 sy 0.484 es Fri May 18 11:33
+awk - root 0.453 secs 0.453 us 0.000 sy 0.453 es Fri May 18 11:33
+accton - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:33
diff --git a/usr.bin/lastcomm/tests/v1-sparc64-acct.in b/usr.bin/lastcomm/tests/v1-sparc64-acct.in
new file mode 100644
index 0000000..00f05b4
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-sparc64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-sparc64.out b/usr.bin/lastcomm/tests/v1-sparc64.out
new file mode 100644
index 0000000..d33ae71
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-sparc64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.031 es Wed May 16 12:16
+core -DX root 0.031 secs 0.000 us 0.031 sy 0.047 es Wed May 16 12:16
+cc - root 0.016 secs 0.000 us 0.016 sy 0.859 es Wed May 16 12:16
+ld - root 0.094 secs 0.047 us 0.047 sy 0.266 es Wed May 16 12:16
+as - root 0.016 secs 0.000 us 0.016 sy 0.094 es Wed May 16 12:16
+cc1 - root 0.094 secs 0.047 us 0.047 sy 0.375 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+123456789012345 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 1.703 es Wed May 16 12:16
+diff - root 1.641 secs 1.344 us 0.297 sy 1.672 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.625 es Wed May 16 12:16
+dd - root 0.562 secs 0.000 us 0.562 sy 0.594 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 3.047 es Wed May 16 12:16
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 17.219 es Wed May 16 12:16
+find - root 5.516 secs 0.562 us 4.953 sy 17.188 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 30.031 es Wed May 16 12:15
+egrep - root 29.750 secs 29.688 us 0.062 sy 30.000 es Wed May 16 12:15
+time - root 0.016 secs 0.000 us 0.016 sy 1.688 es Wed May 16 12:15
+awk - root 1.609 secs 1.594 us 0.016 sy 1.641 es Wed May 16 12:15
+accton - root 0.016 secs 0.000 us 0.016 sy 0.031 es Wed May 16 12:15
diff --git a/usr.bin/lastcomm/tests/v2-amd64-acct.in b/usr.bin/lastcomm/tests/v2-amd64-acct.in
new file mode 100644
index 0000000..ca7bcaa
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-amd64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-amd64.out b/usr.bin/lastcomm/tests/v2-amd64.out
new file mode 100644
index 0000000..3942b04
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-amd64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.002 secs 0.000 us 0.002 sy 0.009 es Thu May 17 05:57
+core -DX root 0.005 secs 0.000 us 0.005 sy 0.010 es Thu May 17 05:57
+cc - root 0.005 secs 0.000 us 0.005 sy 0.652 es Thu May 17 05:57
+ld - root 0.014 secs 0.005 us 0.009 sy 0.150 es Thu May 17 05:57
+as - root 0.005 secs 0.000 us 0.005 sy 0.078 es Thu May 17 05:57
+cc1 - root 0.024 secs 0.008 us 0.016 sy 0.347 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.005 es Thu May 17 05:57
+1234567890123456 - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+ln - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.005 es Thu May 17 05:57
+1234567890123456 - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+ln - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.013 es Thu May 17 05:57
+123456789012345 - root 0.002 secs 0.000 us 0.002 sy 0.010 es Thu May 17 05:57
+ln - root 0.003 secs 0.000 us 0.003 sy 0.003 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.246 es Thu May 17 05:57
+diff - root 0.223 secs 0.164 us 0.060 sy 0.243 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.079 es Thu May 17 05:57
+dd - root 0.076 secs 0.000 us 0.076 sy 0.076 es Thu May 17 05:57
+time - root 0.004 secs 0.000 us 0.004 sy 3.006 es Thu May 17 05:57
+sleep - root 0.002 secs 0.000 us 0.002 sy 3.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 9.945 es Thu May 17 05:57
+find - root 0.822 secs 0.055 us 0.767 sy 9.942 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 3.313 es Thu May 17 05:57
+egrep - root 3.247 secs 3.247 us 0.000 sy 3.310 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.185 es Thu May 17 05:57
+awk - root 0.163 secs 0.156 us 0.007 sy 0.164 es Thu May 17 05:57
+accton - root 0.002 secs 0.000 us 0.002 sy 0.019 es Thu May 17 05:57
diff --git a/usr.bin/lastcomm/tests/v2-i386-acct.in b/usr.bin/lastcomm/tests/v2-i386-acct.in
new file mode 100644
index 0000000..4cdd973
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-i386-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-i386.out b/usr.bin/lastcomm/tests/v2-i386.out
new file mode 100644
index 0000000..61bc811
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-i386.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.005 es Fri May 18 15:13
+core -DX root 0.002 secs 0.000 us 0.002 sy 0.005 es Fri May 18 15:13
+cc - root 0.002 secs 0.000 us 0.002 sy 0.048 es Fri May 18 15:13
+ld - root 0.028 secs 0.019 us 0.009 sy 0.028 es Fri May 18 15:13
+as - root 0.002 secs 0.002 us 0.000 sy 0.002 es Fri May 18 15:13
+cc1 - root 0.016 secs 0.016 us 0.000 sy 0.016 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.002 es Fri May 18 15:13
+1234567890123456 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.001 us 0.000 sy 0.002 es Fri May 18 15:13
+1234567890123456 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.002 es Fri May 18 15:13
+123456789012345 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.425 es Fri May 18 15:13
+diff - root 0.423 secs 0.392 us 0.031 sy 0.424 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.028 es Fri May 18 15:13
+dd - root 0.025 secs 0.000 us 0.025 sy 0.026 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 3.002 es Fri May 18 15:13
+sleep - root 0.001 secs 0.000 us 0.001 sy 3.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.250 es Fri May 18 15:13
+find - root 0.248 secs 0.078 us 0.171 sy 0.249 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 6.724 es Fri May 18 15:12
+egrep - root 6.680 secs 6.680 us 0.000 sy 6.722 es Fri May 18 15:12
+time - root 0.001 secs 0.000 us 0.001 sy 0.450 es Fri May 18 15:12
+awk - root 0.448 secs 0.448 us 0.000 sy 0.449 es Fri May 18 15:12
+accton - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:12
diff --git a/usr.bin/lastcomm/tests/v2-sparc64-acct.in b/usr.bin/lastcomm/tests/v2-sparc64-acct.in
new file mode 100644
index 0000000..26df19e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-sparc64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-sparc64.out b/usr.bin/lastcomm/tests/v2-sparc64.out
new file mode 100644
index 0000000..f693e8e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-sparc64.out
@@ -0,0 +1,36 @@
+core -FDX root 0.010 secs 0.000 us 0.010 sy 0.042 es Sat May 19 09:17
+core -DX root 0.037 secs 0.001 us 0.036 sy 0.055 es Sat May 19 09:17
+cc - root 0.033 secs 0.002 us 0.031 sy 1.012 es Sat May 19 09:17
+ld - root 0.186 secs 0.115 us 0.071 sy 0.361 es Sat May 19 09:17
+as - root 0.030 secs 0.005 us 0.025 sy 0.126 es Sat May 19 09:17
+cc1 - root 0.105 secs 0.048 us 0.057 sy 0.417 es Sat May 19 09:17
+time - root 0.029 secs 0.001 us 0.028 sy 0.047 es Sat May 19 09:17
+1234567890123456 - root 0.017 secs 0.003 us 0.014 sy 0.019 es Sat May 19 09:17
+ln - root 0.019 secs 0.003 us 0.016 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.003 us 0.025 sy 0.047 es Sat May 19 09:17
+1234567890123456 - root 0.017 secs 0.002 us 0.015 sy 0.019 es Sat May 19 09:17
+ln - root 0.019 secs 0.004 us 0.015 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.004 us 0.025 sy 0.053 es Sat May 19 09:17
+123456789012345 - root 0.018 secs 0.001 us 0.016 sy 0.025 es Sat May 19 09:17
+ln - root 0.020 secs 0.001 us 0.019 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.003 us 0.026 sy 1.702 es Sat May 19 09:17
+diff - root 1.636 secs 1.337 us 0.299 sy 1.674 es Sat May 19 09:17
+time - root 0.027 secs 0.002 us 0.026 sy 0.634 es Sat May 19 09:17
+dd - root 0.588 secs 0.017 us 0.571 sy 0.605 es Sat May 19 09:17
+time - root 0.028 secs 0.001 us 0.027 sy 3.049 es Sat May 19 09:17
+sleep - root 0.018 secs 0.002 us 0.016 sy 3.021 es Sat May 19 09:17
+time - root 0.029 secs 0.002 us 0.027 sy 17.970 es Sat May 19 09:17
+find - root 5.703 secs 0.555 us 5.148 sy 17.942 es Sat May 19 09:17
+time - root 0.029 secs 0.005 us 0.024 sy 27.162 es Sat May 19 09:16
+egrep - root 26.715 secs 26.632 us 0.082 sy 27.133 es Sat May 19 09:16
+logger - root 0.023 secs 0.005 us 0.018 sy 60.808 es Sat May 19 09:15
+sh -F root 0.008 secs 0.000 us 0.008 sy 60.815 es Sat May 19 09:15
+fsck - root 0.055 secs 0.008 us 0.047 sy 60.806 es Sat May 19 09:15
+fsck_ufs - root 0.028 secs 0.005 us 0.022 sy 0.140 es Sat May 19 09:16
+fsck_ufs - root 0.028 secs 0.006 us 0.022 sy 0.123 es Sat May 19 09:16
+fsck_ufs - root 0.028 secs 0.004 us 0.024 sy 0.058 es Sat May 19 09:16
+fsck_ufs - root 0.032 secs 0.004 us 0.028 sy 0.326 es Sat May 19 09:16
+sleep - root 0.019 secs 0.001 us 0.018 sy 60.085 es Sat May 19 09:15
+time - root 0.029 secs 0.005 us 0.025 sy 1.701 es Sat May 19 09:16
+awk - root 1.644 secs 1.617 us 0.028 sy 1.657 es Sat May 19 09:16
+accton - root 0.019 secs 0.003 us 0.016 sy 0.027 es Sat May 19 09:16
diff --git a/usr.bin/lastcomm/tests/values.sh b/usr.bin/lastcomm/tests/values.sh
new file mode 100755
index 0000000..ab27f62
--- /dev/null
+++ b/usr.bin/lastcomm/tests/values.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+ACCT=acct
+RESULTS=acct.`uname -m`.tar.gz
+TMPDIR=$$.tmp
+TZ=UTC; export TZ
+
+run()
+{
+ /usr/bin/time -l -o $1.time "$@"
+}
+
+if [ `whoami` != "root" ]; then
+ echo "You need to be root to run this test."
+ exit 1
+fi
+
+echo Redirecting accounting.
+
+mkdir $TMPDIR
+cd $TMPDIR
+
+:>$ACCT
+accton $ACCT
+
+echo Running commands. This should not take more than 30s.
+
+# User time
+run awk 'BEGIN {for (i = 0; i < 1000000; i++) cos(.3)}' /dev/null
+run egrep '(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\8\7\6\5\4\3\2\1' /usr/share/dict/words
+
+# System time
+run find /usr/src -name xyzzy
+
+# Elapsed time
+run sleep 3
+
+# IO
+run dd if=/dev/zero bs=512 count=4096 of=zero 2>/dev/null
+
+# Memory
+run diff /usr/share/dict/words /dev/null >/dev/null
+
+# AC_COMM_LEN - 1
+ln /usr/bin/true 123456789012345
+run ./123456789012345
+
+# AC_COMM_LEN
+ln /usr/bin/true 1234567890123456
+run ./1234567890123456
+
+# AC_COMM_LEN + 1
+ln /usr/bin/true 12345678901234567
+run ./12345678901234567
+
+# Flags: core, fork, signal
+echo 'main(){volatile int s; fork(); s = *(int *)0;}' >core.c
+cc -o core core.c
+echo Generating segmentation fault.
+./core
+
+echo Turning off redirected accounting.
+
+accton
+
+echo Packing the results.
+
+sa -u $ACCT >sa.u
+lastcomm -cesuS -f $ACCT >lastcomm.cesuS
+tar -cf - acct sa.u lastcomm.cesuS *.time |
+gzip -c |
+uuencode $RESULTS >../$RESULTS.uue
+
+echo Cleaning up.
+cd ..
+rm -rf $TMPDIR
+
+echo "Done! Please send your reply, enclosing the file $RESULTS.uue"
+echo If your system runs with accounting enabled you probably need to run:
+echo accton /var/account/acct
diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile
new file mode 100644
index 0000000..fd2b7b4
--- /dev/null
+++ b/usr.bin/ldd/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PROG?= ldd
+SRCS= ldd.c
+.if ${MACHINE_CPUARCH} == "i386"
+SRCS+= sods.c
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ldd/Makefile.depend b/usr.bin/ldd/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/ldd/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/ldd/extern.h b/usr.bin/ldd/extern.h
new file mode 100644
index 0000000..4df6759
--- /dev/null
+++ b/usr.bin/ldd/extern.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2002 FreeBSD, 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 ``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.
+ *
+ * $FreeBSD$
+ */
+
+extern void dump_file(const char *);
+extern int error_count;
+
diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1
new file mode 100644
index 0000000..483825b
--- /dev/null
+++ b/usr.bin/ldd/ldd.1
@@ -0,0 +1,80 @@
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2008
+.Dt LDD 1
+.Os
+.Sh NAME
+.Nm ldd
+.Nd list dynamic object dependencies
+.Sh SYNOPSIS
+.Nm
+.Op Fl a
+.Op Fl v
+.Op Fl f Ar format
+.Ar program ...
+.Sh DESCRIPTION
+The
+.Nm
+utility displays all shared objects that are needed to run the given program or
+to load the given shared object.
+Contrary to
+.Xr nm 1 ,
+the list includes
+.Dq indirect
+dependencies that are the result of needed shared objects which themselves
+depend on yet other shared objects.
+.Pp
+Zero, one or two
+.Fl f
+options may be given.
+The argument is a format string passed to
+.Xr rtld 1
+and allows customization of
+.Nm Ns 's
+output.
+If one is given, it sets
+.Ev LD_TRACE_LOADED_OBJECTS_FMT1 .
+If two are given, they set
+.Ev LD_TRACE_LOADED_OBJECTS_FMT1
+and
+.Ev LD_TRACE_LOADED_OBJECTS_FMT2 ,
+respectively.
+See
+.Xr rtld 1
+for details, including a list of recognized conversion characters.
+.Pp
+The
+.Fl a
+option displays the list of all objects that are needed by each loaded
+object.
+This option does not work with
+.Xr a.out 5
+binaries.
+.Pp
+The
+.Fl v
+option displays a verbose listing of the dynamic linking headers
+encoded in the executable.
+See the source code and include
+files for the definitive meaning of all the fields.
+.Sh EXAMPLES
+The following is an example of a shell pipeline which uses the
+.Fl f
+option.
+It will print a report of all ELF binaries in the current directory,
+which link against libc.so.6:
+.Dl "find . -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A %o\en' | grep libc.so.6"
+.Sh SEE ALSO
+.Xr ld 1 ,
+.Xr nm 1 ,
+.Xr rtld 1
+.Sh HISTORY
+A
+.Nm
+utility first appeared in SunOS 4.0, it appeared in its current form in
+.Fx 1.1 .
+.Pp
+The
+.Fl v
+support is based on code written by
+.An John Polstra Aq Mt jdp@polstra.com
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c
new file mode 100644
index 0000000..e1bebe0
--- /dev/null
+++ b/usr.bin/ldd/ldd.c
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 1993 Paul Kranenburg
+ * 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 Paul Kranenburg.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/wait.h>
+
+#include <machine/elf.h>
+
+#include <arpa/inet.h>
+
+#include <dlfcn.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+/* We don't support a.out executables on arm64 and riscv */
+#if !defined(__aarch64__) && !defined(__riscv__)
+#include <a.out.h>
+#define AOUT_SUPPORTED
+#endif
+
+/*
+ * 32-bit ELF data structures can only be used if the system header[s] declare
+ * them. There is no official macro for determining whether they are declared,
+ * so check for the existence of one of the 32-macros defined in elf(5).
+ */
+#ifdef ELF32_R_TYPE
+#define ELF32_SUPPORTED
+#endif
+
+#define LDD_SETENV(name, value, overwrite) do { \
+ setenv("LD_" name, value, overwrite); \
+ setenv("LD_32_" name, value, overwrite); \
+} while (0)
+
+#define LDD_UNSETENV(name) do { \
+ unsetenv("LD_" name); \
+ unsetenv("LD_32_" name); \
+} while (0)
+
+static int is_executable(const char *fname, int fd, int *is_shlib,
+ int *type);
+static void usage(void);
+
+#define TYPE_UNKNOWN 0
+#define TYPE_AOUT 1
+#define TYPE_ELF 2 /* Architecture default */
+#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
+#define TYPE_ELF32 3 /* Explicit 32 bits on architectures >32 bits */
+
+#define _PATH_LDD32 "/usr/bin/ldd32"
+
+static int
+execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag)
+{
+ char *argv[9];
+ int i, rval, status;
+
+ LDD_UNSETENV("TRACE_LOADED_OBJECTS");
+ rval = 0;
+ i = 0;
+ argv[i++] = strdup(_PATH_LDD32);
+ if (aflag)
+ argv[i++] = strdup("-a");
+ if (vflag)
+ argv[i++] = strdup("-v");
+ if (fmt1 != NULL) {
+ argv[i++] = strdup("-f");
+ argv[i++] = strdup(fmt1);
+ }
+ if (fmt2 != NULL) {
+ argv[i++] = strdup("-f");
+ argv[i++] = strdup(fmt2);
+ }
+ argv[i++] = strdup(file);
+ argv[i++] = NULL;
+
+ switch (fork()) {
+ case -1:
+ err(1, "fork");
+ break;
+ case 0:
+ execv(_PATH_LDD32, argv);
+ warn("%s", _PATH_LDD32);
+ _exit(127);
+ break;
+ default:
+ if (wait(&status) < 0)
+ rval = 1;
+ else if (WIFSIGNALED(status))
+ rval = 1;
+ else if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
+ rval = 1;
+ break;
+ }
+ while (i--)
+ free(argv[i]);
+ LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1);
+ return (rval);
+}
+#endif
+
+int
+main(int argc, char *argv[])
+{
+ char *fmt1, *fmt2;
+ int rval, c, aflag, vflag;
+
+ aflag = vflag = 0;
+ fmt1 = fmt2 = NULL;
+
+ while ((c = getopt(argc, argv, "af:v")) != -1) {
+ switch (c) {
+ case 'a':
+ aflag++;
+ break;
+ case 'f':
+ if (fmt1 != NULL) {
+ if (fmt2 != NULL)
+ errx(1, "too many formats");
+ fmt2 = optarg;
+ } else
+ fmt1 = optarg;
+ break;
+ case 'v':
+ vflag++;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (vflag && fmt1 != NULL)
+ errx(1, "-v may not be used with -f");
+
+ if (argc <= 0) {
+ usage();
+ /* NOTREACHED */
+ }
+
+#ifdef __i386__
+ if (vflag) {
+ for (c = 0; c < argc; c++)
+ dump_file(argv[c]);
+ exit(error_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ }
+#endif
+
+ rval = 0;
+ for (; argc > 0; argc--, argv++) {
+ int fd, status, is_shlib, rv, type;
+
+ if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
+ warn("%s", *argv);
+ rval |= 1;
+ continue;
+ }
+ rv = is_executable(*argv, fd, &is_shlib, &type);
+ close(fd);
+ if (rv == 0) {
+ rval |= 1;
+ continue;
+ }
+
+ switch (type) {
+ case TYPE_ELF:
+ case TYPE_AOUT:
+ break;
+#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
+ case TYPE_ELF32:
+ rval |= execldd32(*argv, fmt1, fmt2, aflag, vflag);
+ continue;
+#endif
+ case TYPE_UNKNOWN:
+ default:
+ /*
+ * This shouldn't happen unless is_executable()
+ * is broken.
+ */
+ errx(EDOOFUS, "unknown executable type");
+ }
+
+ /* ld.so magic */
+ LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1);
+ if (fmt1 != NULL)
+ LDD_SETENV("TRACE_LOADED_OBJECTS_FMT1", fmt1, 1);
+ if (fmt2 != NULL)
+ LDD_SETENV("TRACE_LOADED_OBJECTS_FMT2", fmt2, 1);
+
+ LDD_SETENV("TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1);
+ if (aflag)
+ LDD_SETENV("TRACE_LOADED_OBJECTS_ALL", "1", 1);
+ else if (fmt1 == NULL && fmt2 == NULL)
+ /* Default formats */
+ printf("%s:\n", *argv);
+ fflush(stdout);
+
+ switch (fork()) {
+ case -1:
+ err(1, "fork");
+ break;
+ default:
+ if (wait(&status) < 0) {
+ warn("wait");
+ rval |= 1;
+ } else if (WIFSIGNALED(status)) {
+ fprintf(stderr, "%s: signal %d\n", *argv,
+ WTERMSIG(status));
+ rval |= 1;
+ } else if (WIFEXITED(status) &&
+ WEXITSTATUS(status) != 0) {
+ fprintf(stderr, "%s: exit status %d\n", *argv,
+ WEXITSTATUS(status));
+ rval |= 1;
+ }
+ break;
+ case 0:
+ if (is_shlib == 0) {
+ execl(*argv, *argv, (char *)NULL);
+ warn("%s", *argv);
+ } else {
+ dlopen(*argv, RTLD_TRACE);
+ warnx("%s: %s", *argv, dlerror());
+ }
+ _exit(1);
+ }
+ }
+
+ return rval;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: ldd [-a] [-v] [-f format] program ...\n");
+ exit(1);
+}
+
+static int
+is_executable(const char *fname, int fd, int *is_shlib, int *type)
+{
+ union {
+#ifdef AOUT_SUPPORTED
+ struct exec aout;
+#endif
+#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
+ Elf32_Ehdr elf32;
+#endif
+ Elf_Ehdr elf;
+ } hdr;
+ int n;
+
+ *is_shlib = 0;
+ *type = TYPE_UNKNOWN;
+
+ if ((n = read(fd, &hdr, sizeof(hdr))) == -1) {
+ warn("%s: can't read program header", fname);
+ return (0);
+ }
+
+#ifdef AOUT_SUPPORTED
+ if ((size_t)n >= sizeof(hdr.aout) && !N_BADMAG(hdr.aout)) {
+ /* a.out file */
+ if ((N_GETFLAG(hdr.aout) & EX_DPMASK) != EX_DYNAMIC
+#if 1 /* Compatibility */
+ || hdr.aout.a_entry < __LDPGSZ
+#endif
+ ) {
+ warnx("%s: not a dynamic executable", fname);
+ return (0);
+ }
+ *type = TYPE_AOUT;
+ return (1);
+ }
+#endif
+
+#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
+ if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) &&
+ hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) {
+ /* Handle 32 bit ELF objects */
+ Elf32_Phdr phdr;
+ int dynamic, i;
+
+ dynamic = 0;
+ *type = TYPE_ELF32;
+
+ if (lseek(fd, hdr.elf32.e_phoff, SEEK_SET) == -1) {
+ warnx("%s: header too short", fname);
+ return (0);
+ }
+ for (i = 0; i < hdr.elf32.e_phnum; i++) {
+ if (read(fd, &phdr, hdr.elf32.e_phentsize) !=
+ sizeof(phdr)) {
+ warnx("%s: can't read program header", fname);
+ return (0);
+ }
+ if (phdr.p_type == PT_DYNAMIC) {
+ dynamic = 1;
+ break;
+ }
+ }
+
+ if (!dynamic) {
+ warnx("%s: not a dynamic ELF executable", fname);
+ return (0);
+ }
+ if (hdr.elf32.e_type == ET_DYN) {
+ if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
+ *is_shlib = 1;
+ return (1);
+ }
+ warnx("%s: not a FreeBSD ELF shared object", fname);
+ return (0);
+ }
+
+ return (1);
+ }
+#endif
+
+ if ((size_t)n >= sizeof(hdr.elf) && IS_ELF(hdr.elf) &&
+ hdr.elf.e_ident[EI_CLASS] == ELF_TARG_CLASS) {
+ /* Handle default ELF objects on this architecture */
+ Elf_Phdr phdr;
+ int dynamic, i;
+
+ dynamic = 0;
+ *type = TYPE_ELF;
+
+ if (lseek(fd, hdr.elf.e_phoff, SEEK_SET) == -1) {
+ warnx("%s: header too short", fname);
+ return (0);
+ }
+ for (i = 0; i < hdr.elf.e_phnum; i++) {
+ if (read(fd, &phdr, hdr.elf.e_phentsize)
+ != sizeof(phdr)) {
+ warnx("%s: can't read program header", fname);
+ return (0);
+ }
+ if (phdr.p_type == PT_DYNAMIC) {
+ dynamic = 1;
+ break;
+ }
+ }
+
+ if (!dynamic) {
+ warnx("%s: not a dynamic ELF executable", fname);
+ return (0);
+ }
+ if (hdr.elf.e_type == ET_DYN) {
+ switch (hdr.elf.e_ident[EI_OSABI]) {
+ case ELFOSABI_FREEBSD:
+ *is_shlib = 1;
+ return (1);
+#ifdef __ARM_EABI__
+ case ELFOSABI_NONE:
+ if (hdr.elf.e_machine != EM_ARM)
+ break;
+ if (EF_ARM_EABI_VERSION(hdr.elf.e_flags) <
+ EF_ARM_EABI_FREEBSD_MIN)
+ break;
+ *is_shlib = 1;
+ return (1);
+#endif
+ }
+ warnx("%s: not a FreeBSD ELF shared object", fname);
+ return (0);
+ }
+
+ return (1);
+ }
+
+ warnx("%s: not a dynamic executable", fname);
+ return (0);
+}
diff --git a/usr.bin/ldd/sods.c b/usr.bin/ldd/sods.c
new file mode 100644
index 0000000..7e69cec
--- /dev/null
+++ b/usr.bin/ldd/sods.c
@@ -0,0 +1,571 @@
+/*
+ * Copyright (C) 1996-1997 John D. Polstra. 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 JOHN D. POLSTRA 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 JOHN D. POLSTRA 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/mman.h>
+#include <sys/stat.h>
+
+#include <machine/elf.h>
+
+#include <arpa/inet.h>
+
+#include <a.out.h>
+#include <assert.h>
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <sys/link_aout.h>
+#include <stab.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#define PAGE_SIZE 4096 /* i386 specific */
+
+#ifndef N_SETA
+#define N_SETA 0x14 /* Absolute set element symbol */
+#endif /* This is input to LD, in a .o file. */
+
+#ifndef N_SETT
+#define N_SETT 0x16 /* Text set element symbol */
+#endif /* This is input to LD, in a .o file. */
+
+#ifndef N_SETD
+#define N_SETD 0x18 /* Data set element symbol */
+#endif /* This is input to LD, in a .o file. */
+
+#ifndef N_SETB
+#define N_SETB 0x1A /* Bss set element symbol */
+#endif /* This is input to LD, in a .o file. */
+
+#ifndef N_SETV
+#define N_SETV 0x1C /* Pointer to set vector in data area. */
+#endif /* This is output from LD. */
+
+#ifdef STANDALONE
+static
+#endif
+
+static void dump_rels(const char *, const struct relocation_info *,
+ unsigned long, const char *(*)(unsigned long), unsigned char *);
+static void dump_segs(void);
+static void dump_sods(void);
+static void dump_sym(const struct nlist *);
+static void dump_syms(void);
+
+static void dump_rtsyms(void);
+
+static const char *rtsym_name(unsigned long);
+static const char *sym_name(unsigned long);
+
+#ifdef STANDALONE
+static
+#endif
+int error_count;
+
+/*
+ * Variables ending in _base are pointers to things in our address space,
+ * i.e., in the file itself.
+ *
+ * Variables ending in _addr are adjusted according to where things would
+ * actually appear in memory if the file were loaded.
+ */
+static const char *file_base;
+static const char *text_base;
+static const char *data_base;
+static const struct relocation_info *rel_base;
+static const struct nlist *sym_base;
+static const char *str_base;
+
+static const struct relocation_info *rtrel_base;
+static const struct nzlist *rtsym_base;
+static const char *rtstr_base;
+
+static const struct exec *ex;
+static const struct _dynamic *dyn;
+static const struct section_dispatch_table *sdt;
+
+static const char *text_addr;
+static const char *data_addr;
+
+static unsigned long rel_count;
+static unsigned long sym_count;
+
+static unsigned long rtrel_count;
+static unsigned long rtsym_count;
+
+/* Dynamically allocated flags, 1 byte per symbol, to record whether each
+ symbol was referenced by a relocation entry. */
+static unsigned char *sym_used;
+static unsigned char *rtsym_used;
+
+static unsigned long origin; /* What values are relocated relative to */
+
+#ifdef STANDALONE
+int
+main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; ++i)
+ dump_file(argv[i]);
+
+ return error_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+#endif
+
+static inline const void *align_struct(const void *expr)
+{
+ assert(!(((int)expr) & 3));
+ return expr;
+}
+
+static inline const void *align_long(const void *expr)
+{
+ assert(!(((int)expr) & 3));
+ return expr;
+}
+
+static inline const void *align_short(const void *expr)
+{
+ assert(!(((int)expr) & 1));
+ return expr;
+}
+
+#ifdef STANDALONE
+static
+#endif
+void
+dump_file(const char *fname)
+{
+ int fd;
+ struct stat sb;
+ caddr_t objbase;
+
+ if (stat(fname, &sb) == -1) {
+ warnx("cannot stat \"%s\"", fname);
+ ++error_count;
+ return;
+ }
+
+ if ((sb.st_mode & S_IFMT) != S_IFREG) {
+ warnx("\"%s\" is not a regular file", fname);
+ ++error_count;
+ return;
+ }
+
+ if ((fd = open(fname, O_RDONLY, 0)) == -1) {
+ warnx("cannot open \"%s\"", fname);
+ ++error_count;
+ return;
+ }
+
+ objbase = mmap(0, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ if (objbase == (caddr_t) -1) {
+ warnx("cannot mmap \"%s\"", fname);
+ ++error_count;
+ close(fd);
+ return;
+ }
+
+ close(fd);
+
+ file_base = (const char *) objbase; /* Makes address arithmetic easier */
+
+ if (IS_ELF(*(const Elf32_Ehdr*) align_struct(file_base))) {
+ warnx("%s: this is an ELF program; use objdump to examine", fname);
+ ++error_count;
+ munmap(objbase, sb.st_size);
+ return;
+ }
+
+ ex = (const struct exec *) align_struct(file_base);
+
+ printf("%s: a_midmag = 0x%lx\n", fname, (long)ex->a_midmag);
+ printf(" magic = 0x%lx = 0%lo, netmagic = 0x%lx = 0%lo\n",
+ (long)N_GETMAGIC(*ex), (long)N_GETMAGIC(*ex),
+ (long)N_GETMAGIC_NET(*ex), (long)N_GETMAGIC_NET(*ex));
+
+ if (N_BADMAG(*ex)) {
+ warnx("%s: bad magic number", fname);
+ ++error_count;
+ munmap(objbase, sb.st_size);
+ return;
+ }
+
+ printf(" a_text = 0x%lx\n", (long)ex->a_text);
+ printf(" a_data = 0x%lx\n", (long)ex->a_data);
+ printf(" a_bss = 0x%lx\n", (long)ex->a_bss);
+ printf(" a_syms = 0x%lx\n", (long)ex->a_syms);
+ printf(" a_entry = 0x%lx\n", (long)ex->a_entry);
+ printf(" a_trsize = 0x%lx\n", (long)ex->a_trsize);
+ printf(" a_drsize = 0x%lx\n", (long)ex->a_drsize);
+
+ text_base = file_base + N_TXTOFF(*ex);
+ data_base = file_base + N_DATOFF(*ex);
+ rel_base = (const struct relocation_info *)
+ align_struct(file_base + N_RELOFF(*ex));
+ sym_base = (const struct nlist *) align_struct(file_base + N_SYMOFF(*ex));
+ str_base = file_base + N_STROFF(*ex);
+
+ rel_count = (ex->a_trsize + ex->a_drsize) / sizeof rel_base[0];
+ assert(rel_count * sizeof rel_base[0] == ex->a_trsize + ex->a_drsize);
+ sym_count = ex->a_syms / sizeof sym_base[0];
+ assert(sym_count * sizeof sym_base[0] == ex->a_syms);
+
+ if (sym_count != 0) {
+ sym_used = (unsigned char *) calloc(sym_count, sizeof(unsigned char));
+ assert(sym_used != NULL);
+ }
+
+ printf(" Entry = 0x%lx\n", (long)ex->a_entry);
+ printf(" Text offset = %x, address = %lx\n", N_TXTOFF(*ex),
+ (long)N_TXTADDR(*ex));
+ printf(" Data offset = %lx, address = %lx\n", (long)N_DATOFF(*ex),
+ (long)N_DATADDR(*ex));
+
+ /*
+ * In an executable program file, everything is relocated relative to
+ * the assumed run-time load address, i.e., N_TXTADDR(*ex), i.e., 0x1000.
+ *
+ * In a shared library file, everything is relocated relative to the
+ * start of the file, i.e., N_TXTOFF(*ex), i.e., 0.
+ *
+ * The way to tell the difference is by looking at ex->a_entry. If it
+ * is >= 0x1000, then we have an executable program. Otherwise, we
+ * have a shared library.
+ *
+ * When a program is executed, the entire file is mapped into memory,
+ * including the a.out header and so forth. But it is not mapped at
+ * address 0; rather it is mapped at address 0x1000. The first page
+ * of the user's address space is left unmapped in order to catch null
+ * pointer dereferences.
+ *
+ * In this program, when we map in an executable program, we have to
+ * simulate the empty page by decrementing our assumed base address by
+ * a pagesize.
+ */
+
+ text_addr = text_base;
+ data_addr = data_base;
+ origin = 0;
+
+ if (ex->a_entry >= PAGE_SIZE) { /* Executable, not a shared library */
+ /*
+ * The fields in the object have already been relocated on the
+ * assumption that the object will be loaded at N_TXTADDR(*ex).
+ * We have to compensate for that.
+ */
+ text_addr -= PAGE_SIZE;
+ data_addr -= PAGE_SIZE;
+ origin = PAGE_SIZE;
+ printf(" Program, origin = %lx\n", origin);
+ } else if (N_GETFLAG(*ex) & EX_DYNAMIC)
+ printf(" Shared library, origin = %lx\n", origin);
+ else
+ printf(" Object file, origin = %lx\n", origin);
+
+ if (N_GETFLAG(*ex) & EX_DYNAMIC) {
+ dyn = (const struct _dynamic *) align_struct(data_base);
+ printf(" Dynamic version = %d\n", dyn->d_version);
+
+ sdt = (const struct section_dispatch_table *)
+ align_struct(text_addr + (unsigned long) dyn->d_un.d_sdt);
+
+ rtrel_base = (const struct relocation_info *)
+ align_struct(text_addr + sdt->sdt_rel);
+ rtrel_count = (sdt->sdt_hash - sdt->sdt_rel) / sizeof rtrel_base[0];
+ assert(rtrel_count * sizeof rtrel_base[0] ==
+ (size_t)(sdt->sdt_hash - sdt->sdt_rel));
+
+ rtsym_base = (const struct nzlist *)
+ align_struct(text_addr + sdt->sdt_nzlist);
+ rtsym_count = (sdt->sdt_strings - sdt->sdt_nzlist) /
+ sizeof rtsym_base[0];
+ assert(rtsym_count * sizeof rtsym_base[0] ==
+ (size_t)(sdt->sdt_strings - sdt->sdt_nzlist));
+
+ if (rtsym_count != 0) {
+ rtsym_used = (unsigned char *) calloc(rtsym_count,
+ sizeof(unsigned char));
+ assert(rtsym_used != NULL);
+ }
+
+ rtstr_base = text_addr + sdt->sdt_strings;
+ }
+
+ dump_segs();
+ dump_sods();
+ dump_rels("Relocations", rel_base, rel_count, sym_name, sym_used);
+ dump_syms();
+
+ dump_rels("Run-time relocations", rtrel_base, rtrel_count, rtsym_name,
+ rtsym_used);
+ dump_rtsyms();
+
+ if (rtsym_used != NULL) {
+ free(rtsym_used);
+ rtsym_used = NULL;
+ }
+ if (sym_used != NULL) {
+ free(sym_used);
+ sym_used = NULL;
+ }
+ munmap(objbase, sb.st_size);
+}
+
+static void
+dump_rels(const char *label, const struct relocation_info *base,
+ unsigned long count, const char *(*name)(unsigned long),
+ unsigned char *sym_used_flags)
+{
+ unsigned long i;
+
+ printf(" %s:\n", label);
+ for (i = 0; i < count; ++i) {
+ const struct relocation_info *r = &base[i];
+ unsigned int size;
+ char contents[16];
+
+ size = 1u << r->r_length;
+
+ if (origin <= (unsigned long)r->r_address
+ && (unsigned long)r->r_address < origin + ex->a_text + ex->a_data
+ && 1 <= size && size <= 4) {
+ /*
+ * XXX - This can cause unaligned accesses. OK for the
+ * i386, not so for other architectures.
+ */
+ switch (size) {
+ case 1:
+ snprintf(contents, sizeof contents, " [%02x]",
+ *(unsigned const char *)(text_addr + r->r_address));
+ break;
+ case 2:
+ snprintf(contents, sizeof contents, " [%04x]",
+ *(unsigned const short *)
+ align_short(text_addr + r->r_address));
+ break;
+ case 4:
+ snprintf(contents, sizeof contents, "[%08lx]",
+ *(unsigned const long *)
+ align_long(text_addr + r->r_address));
+ break;
+ }
+ } else
+ snprintf(contents, sizeof contents, " ");
+
+ printf(" %6lu %8x/%u %s %c%c%c%c%c%c", i,
+ r->r_address, size,
+ contents,
+ r->r_extern ? 'e' : '-',
+ r->r_jmptable ? 'j' : '-',
+ r->r_relative ? 'r' : '-',
+ r->r_baserel ? 'b' : '-',
+ r->r_pcrel ? 'p' : '-',
+ r->r_copy ? 'c' : '-');
+
+ if (r->r_extern || r->r_baserel || r->r_jmptable || r->r_copy) {
+ printf(" %4u %s", r->r_symbolnum, name(r->r_symbolnum));
+ sym_used_flags[r->r_symbolnum] = 1;
+ }
+
+ printf("\n");
+ }
+}
+
+static void
+dump_rtsyms(void)
+{
+ unsigned long i;
+
+ printf(" Run-time symbols:\n");
+ for (i = 0; i < rtsym_count; ++i) {
+ printf(" %6lu%c ", i, rtsym_used[i] ? '*' : ' ');
+ dump_sym(&rtsym_base[i].nlist);
+ printf("/%-5ld %s\n", rtsym_base[i].nz_size, rtsym_name(i));
+ }
+}
+
+static void
+dump_segs(void)
+{
+ printf(" Text segment starts at address %lx\n", origin + N_TXTOFF(*ex));
+ if (N_GETFLAG(*ex) & EX_DYNAMIC) {
+ printf(" rel starts at %lx\n", sdt->sdt_rel);
+ printf(" hash starts at %lx\n", sdt->sdt_hash);
+ printf(" nzlist starts at %lx\n", sdt->sdt_nzlist);
+ printf(" strings starts at %lx\n", sdt->sdt_strings);
+ }
+
+ printf(" Data segment starts at address %lx\n", origin + N_DATOFF(*ex));
+ if (N_GETFLAG(*ex) & EX_DYNAMIC) {
+ printf(" _dynamic starts at %lx\n", origin + N_DATOFF(*ex));
+ printf(" so_debug starts at %lx\n", (unsigned long) dyn->d_debug);
+ printf(" sdt starts at %lx\n", (unsigned long) dyn->d_un.d_sdt);
+ printf(" got starts at %lx\n", sdt->sdt_got);
+ printf(" plt starts at %lx\n", sdt->sdt_plt);
+ printf(" rest of stuff starts at %lx\n",
+ sdt->sdt_plt + sdt->sdt_plt_sz);
+ }
+}
+
+static void
+dump_sods(void)
+{
+ long sod_offset;
+ long paths_offset;
+
+ if (dyn == NULL) /* Not a shared object */
+ return;
+
+ sod_offset = sdt->sdt_sods;
+ printf(" Shared object dependencies:\n");
+ while (sod_offset != 0) {
+ const struct sod *sodp = (const struct sod *) align_struct((text_addr + sod_offset));
+ const char *name = (const char *) (text_addr + sodp->sod_name);
+
+ if (sodp->sod_library)
+ printf(" -l%-16s version %d.%d\n", name, sodp->sod_major,
+ sodp->sod_minor);
+ else
+ printf(" %s\n", name);
+ sod_offset = sodp->sod_next;
+ }
+ paths_offset = sdt->sdt_paths;
+ printf(" Shared object additional paths:\n");
+ if (paths_offset != 0) {
+ printf(" %s\n", (const char *)(text_addr + paths_offset));
+ } else {
+ printf(" (none)\n");
+ }
+}
+
+static void
+dump_sym(const struct nlist *np)
+{
+ char type[8];
+ char aux[8];
+ char weak;
+ char *p;
+
+ switch (np->n_type & ~N_EXT) {
+ case N_UNDF: strcpy(type, "undf"); break;
+ case N_ABS: strcpy(type, "abs"); break;
+ case N_TEXT: strcpy(type, "text"); break;
+ case N_DATA: strcpy(type, "data"); break;
+ case N_BSS: strcpy(type, "bss"); break;
+ case N_INDR: strcpy(type, "indr"); break;
+ case N_SIZE: strcpy(type, "size"); break;
+ case N_COMM: strcpy(type, "comm"); break;
+ case N_SETA: strcpy(type, "seta"); break;
+ case N_SETT: strcpy(type, "sett"); break;
+ case N_SETD: strcpy(type, "setd"); break;
+ case N_SETB: strcpy(type, "setb"); break;
+ case N_SETV: strcpy(type, "setv"); break;
+ case N_FN: strcpy(type, np->n_type&N_EXT ? "fn" : "warn"); break;
+ case N_GSYM: strcpy(type, "gsym"); break;
+ case N_FNAME: strcpy(type, "fname"); break;
+ case N_FUN: strcpy(type, "fun"); break;
+ case N_STSYM: strcpy(type, "stsym"); break;
+ case N_LCSYM: strcpy(type, "lcsym"); break;
+ case N_MAIN: strcpy(type, "main"); break;
+ case N_PC: strcpy(type, "pc"); break;
+ case N_RSYM: strcpy(type, "rsym"); break;
+ case N_SLINE: strcpy(type, "sline"); break;
+ case N_DSLINE: strcpy(type, "dsline"); break;
+ case N_BSLINE: strcpy(type, "bsline"); break;
+ case N_SSYM: strcpy(type, "ssym"); break;
+ case N_SO: strcpy(type, "so"); break;
+ case N_LSYM: strcpy(type, "lsym"); break;
+ case N_BINCL: strcpy(type, "bincl"); break;
+ case N_SOL: strcpy(type, "sol"); break;
+ case N_PSYM: strcpy(type, "psym"); break;
+ case N_EINCL: strcpy(type, "eincl"); break;
+ case N_ENTRY: strcpy(type, "entry"); break;
+ case N_LBRAC: strcpy(type, "lbrac"); break;
+ case N_EXCL: strcpy(type, "excl"); break;
+ case N_RBRAC: strcpy(type, "rbrac"); break;
+ case N_BCOMM: strcpy(type, "bcomm"); break;
+ case N_ECOMM: strcpy(type, "ecomm"); break;
+ case N_ECOML: strcpy(type, "ecoml"); break;
+ case N_LENG: strcpy(type, "leng"); break;
+ default:
+ snprintf(type, sizeof type, "%#02x", np->n_type);
+ break;
+ }
+
+ if (np->n_type & N_EXT && type[0] != '0')
+ for (p = type; *p != '\0'; ++p)
+ *p = toupper(*p);
+
+ switch (N_AUX(np)) {
+ case 0: strcpy(aux, ""); break;
+ case AUX_OBJECT: strcpy(aux, "objt"); break;
+ case AUX_FUNC: strcpy(aux, "func"); break;
+ default: snprintf(aux, sizeof aux, "%#01x", N_AUX(np)); break;
+ }
+
+ weak = N_BIND(np) == BIND_WEAK ? 'w' : ' ';
+
+ printf("%c%-6s %-4s %8lx", weak, type, aux, np->n_value);
+}
+
+static void
+dump_syms(void)
+{
+ unsigned long i;
+
+ printf(" Symbols:\n");
+ for (i = 0; i < sym_count; ++i) {
+ printf(" %6lu%c ", i, sym_used[i] ? '*' : ' ');
+ dump_sym(&sym_base[i]);
+ printf(" %s\n", sym_name(i));
+ }
+}
+
+static const char *
+rtsym_name(unsigned long n)
+{
+ assert(n < rtsym_count);
+ if (rtsym_base[n].nz_strx == 0)
+ return "";
+ return rtstr_base + rtsym_base[n].nz_strx;
+}
+
+static const char *
+sym_name(unsigned long n)
+{
+ assert(n < sym_count);
+ if (sym_base[n].n_un.n_strx == 0)
+ return "";
+ return str_base + sym_base[n].n_un.n_strx;
+}
diff --git a/usr.bin/leave/Makefile b/usr.bin/leave/Makefile
new file mode 100644
index 0000000..f71acbe
--- /dev/null
+++ b/usr.bin/leave/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= leave
+
+NO_WFORMAT=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/leave/Makefile.depend b/usr.bin/leave/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/leave/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/leave/leave.1 b/usr.bin/leave/leave.1
new file mode 100644
index 0000000..2e2f569
--- /dev/null
+++ b/usr.bin/leave/leave.1
@@ -0,0 +1,96 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)leave.1 8.3 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd April 28, 1995
+.Dt LEAVE 1
+.Os
+.Sh NAME
+.Nm leave
+.Nd remind you when you have to leave
+.Sh SYNOPSIS
+.Nm
+.Op Oo Cm \&+ Oc Ns Ar hhmm
+.Sh DESCRIPTION
+The
+.Nm
+utility waits until the specified time, then reminds you that you
+have to leave.
+You are reminded 5 minutes and 1 minute before the actual
+time, at the time, and every minute thereafter.
+When you log off,
+.Nm
+exits just before it would have
+printed the next message.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Ar hhmm
+The time of day is in the form
+.Ar hhmm
+where
+.Ar hh
+is a time in
+hours (on a 12 or 24 hour clock), and
+.Ar mm
+are minutes.
+All times are converted to a 12 hour clock, and assumed to
+be in the next 12 hours.
+.It Cm \&+
+If the time is preceded by
+.Sq Cm \&+ ,
+the alarm will go off in hours and minutes
+from the current time.
+.El
+.Pp
+If no argument is given,
+.Nm
+prompts with "When do you
+have to leave?".
+A reply of newline causes
+.Nm
+to exit,
+otherwise the reply is assumed to be a time.
+This form is suitable for inclusion in a
+.Pa .login
+or
+.Pa .profile .
+.Pp
+To get rid of
+.Nm
+you should either log off or use
+.Ql kill \-s KILL
+giving its process id.
+.Sh SEE ALSO
+.Xr calendar 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c
new file mode 100644
index 0000000..29c89e5
--- /dev/null
+++ b/usr.bin/leave/leave.c
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1980, 1988, 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, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)leave.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <ctype.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+static void doalarm(u_int);
+static void usage(void);
+
+/*
+ * leave [[+]hhmm]
+ *
+ * Reminds you when you have to leave.
+ * Leave prompts for input and goes away if you hit return.
+ * It nags you like a mother hen.
+ */
+int
+main(int argc, char **argv)
+{
+ u_int secs;
+ int hours, minutes;
+ char c, *cp = NULL;
+ struct tm *t;
+ time_t now;
+ int plusnow, t_12_hour;
+ char buf[50];
+
+ if (setlocale(LC_TIME, "") == NULL)
+ warn("setlocale");
+
+ if (argc < 2) {
+#define MSG1 "When do you have to leave? "
+ (void)write(STDOUT_FILENO, MSG1, sizeof(MSG1) - 1);
+ cp = fgets(buf, sizeof(buf), stdin);
+ if (cp == NULL || *cp == '\n')
+ exit(0);
+ } else if (argc > 2)
+ usage();
+ else
+ cp = argv[1];
+
+ if (*cp == '+') {
+ plusnow = 1;
+ ++cp;
+ } else
+ plusnow = 0;
+
+ for (hours = 0; (c = *cp) && c != '\n'; ++cp) {
+ if (!isdigit(c))
+ usage();
+ hours = hours * 10 + (c - '0');
+ }
+ minutes = hours % 100;
+ hours /= 100;
+
+ if (minutes < 0 || minutes > 59)
+ usage();
+ if (plusnow)
+ secs = hours * 60 * 60 + minutes * 60;
+ else {
+ (void)time(&now);
+ t = localtime(&now);
+
+ if (hours > 23)
+ usage();
+
+ /* Convert tol to 12 hr time (0:00...11:59) */
+ if (hours > 11)
+ hours -= 12;
+
+ /* Convert tm to 12 hr time (0:00...11:59) */
+ if (t->tm_hour > 11)
+ t_12_hour = t->tm_hour - 12;
+ else
+ t_12_hour = t->tm_hour;
+
+ if (hours < t_12_hour ||
+ (hours == t_12_hour && minutes <= t->tm_min))
+ /* Leave time is in the past so we add 12 hrs */
+ hours += 12;
+
+ secs = (hours - t_12_hour) * 60 * 60;
+ secs += (minutes - t->tm_min) * 60;
+ secs -= now % 60; /* truncate (now + secs) to min */
+ }
+ doalarm(secs);
+ exit(0);
+}
+
+void
+doalarm(u_int secs)
+{
+ int bother;
+ time_t daytime;
+ char tb[80];
+ int pid;
+
+ if ((pid = fork())) {
+ (void)time(&daytime);
+ daytime += secs;
+ strftime(tb, sizeof(tb), "%+", localtime(&daytime));
+ printf("Alarm set for %s. (pid %d)\n", tb, pid);
+ exit(0);
+ }
+ sleep((u_int)2); /* let parent print set message */
+ if (secs >= 2)
+ secs -= 2;
+
+ /*
+ * if write fails, we've lost the terminal through someone else
+ * causing a vhangup by logging in.
+ */
+#define FIVEMIN (5 * 60)
+#define MSG2 "\07\07You have to leave in 5 minutes.\n"
+ if (secs >= FIVEMIN) {
+ sleep(secs - FIVEMIN);
+ if (write(STDOUT_FILENO, MSG2, sizeof(MSG2) - 1) != sizeof(MSG2) - 1)
+ exit(0);
+ secs = FIVEMIN;
+ }
+
+#define ONEMIN (60)
+#define MSG3 "\07\07Just one more minute!\n"
+ if (secs >= ONEMIN) {
+ sleep(secs - ONEMIN);
+ if (write(STDOUT_FILENO, MSG3, sizeof(MSG3) - 1) != sizeof(MSG3) - 1)
+ exit(0);
+ }
+
+#define MSG4 "\07\07Time to leave!\n"
+ for (bother = 10; bother--;) {
+ sleep((u_int)ONEMIN);
+ if (write(STDOUT_FILENO, MSG4, sizeof(MSG4) - 1) != sizeof(MSG4) - 1)
+ exit(0);
+ }
+
+#define MSG5 "\07\07That was the last time I'll tell you. Bye.\n"
+ (void)write(STDOUT_FILENO, MSG5, sizeof(MSG5) - 1);
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: leave [[+]hhmm]\n");
+ exit(1);
+}
diff --git a/usr.bin/less/Makefile b/usr.bin/less/Makefile
new file mode 100644
index 0000000..b6adf2c
--- /dev/null
+++ b/usr.bin/less/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PROG= less
+SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c cvt.c \
+ decode.c edit.c filename.c forwback.c help.c ifile.c input.c \
+ jump.c line.c linenum.c lsystem.c mark.c optfunc.c option.c \
+ opttbl.c os.c output.c pattern.c position.c prompt.c search.c \
+ signal.c tags.c ttyin.c version.c
+SCRIPTS=lesspipe.sh zless.sh
+SCRIPTSNAME_lesspipe.sh=lesspipe.sh
+LIBADD= ncursesw
+LINKS= ${BINDIR}/less ${BINDIR}/more \
+ ${BINDIR}/zless ${BINDIR}/bzless \
+ ${BINDIR}/zless ${BINDIR}/xzless \
+ ${BINDIR}/zless ${BINDIR}/lzless
+MLINKS= less.1 more.1
+CLEANFILES= less.1
+
+.include "Makefile.common"
+.include <bsd.prog.mk>
diff --git a/usr.bin/less/Makefile.common b/usr.bin/less/Makefile.common
new file mode 100644
index 0000000..cffb85a
--- /dev/null
+++ b/usr.bin/less/Makefile.common
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+LSDIR= ${.CURDIR}/../../contrib/less
+.PATH: ${LSDIR}
+
+CFLAGS+=-I${.CURDIR}/../less -I${LSDIR}
+WARNS?= 1
+
+.SUFFIXES: .nro .1
+
+.nro.1:
+ cat ${.IMPSRC} > ${.TARGET}
diff --git a/usr.bin/less/Makefile.depend b/usr.bin/less/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/less/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/less/defines.h b/usr.bin/less/defines.h
new file mode 100644
index 0000000..9b0f5c9
--- /dev/null
+++ b/usr.bin/less/defines.h
@@ -0,0 +1,439 @@
+/* $FreeBSD$ */
+/* defines.h. Generated from defines.h.in by configure. */
+/* defines.h.in. Generated from configure.ac by autoheader. */
+
+
+/* Unix definition file for less. -*- C -*-
+ *
+ * This file has 3 sections:
+ * User preferences.
+ * Settings always true on Unix.
+ * Settings automatically determined by configure.
+ *
+ * * * * * * WARNING * * * * * *
+ * If you edit defines.h by hand, do "touch stamp-h" before you run make
+ * so config.status doesn't overwrite your changes.
+ */
+
+/* User preferences. */
+
+/*
+ * SECURE is 1 if you wish to disable a bunch of features in order to
+ * be safe to run by unprivileged users.
+ * SECURE_COMPILE is set by the --with-secure configure option.
+ */
+#define SECURE SECURE_COMPILE
+
+/*
+ * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
+ * (This is possible only if your system supplies the system() function.)
+ */
+#define SHELL_ESCAPE (!SECURE)
+
+/*
+ * EXAMINE is 1 if you wish to allow examining files by name from within less.
+ */
+#define EXAMINE (!SECURE)
+
+/*
+ * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key
+ * to complete filenames at prompts.
+ */
+#define TAB_COMPLETE_FILENAME (!SECURE)
+
+/*
+ * CMD_HISTORY is 1 if you wish to allow keys to cycle through
+ * previous commands at prompts.
+ */
+#define CMD_HISTORY 1
+
+/*
+ * HILITE_SEARCH is 1 if you wish to have search targets to be
+ * displayed in standout mode.
+ */
+#define HILITE_SEARCH 1
+
+/*
+ * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
+ * (This is possible only if your system supplies the system() function.)
+ * EDIT_PGM is the name of the (default) editor to be invoked.
+ */
+#define EDITOR (!SECURE)
+
+/*
+ * TAGS is 1 if you wish to support tag files.
+ */
+#define TAGS (!SECURE)
+
+/*
+ * USERFILE is 1 if you wish to allow a .less file to specify
+ * user-defined key bindings.
+ */
+#define USERFILE (!SECURE)
+
+/*
+ * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
+ * This will generally work if your system provides the "popen" function
+ * and the "echo" shell command.
+ */
+#define GLOB (!SECURE)
+
+/*
+ * PIPEC is 1 if you wish to have the "|" command
+ * which allows the user to pipe data into a shell command.
+ */
+#define PIPEC (!SECURE)
+
+/*
+ * LOGFILE is 1 if you wish to allow the -l option (to create log files).
+ */
+#define LOGFILE (!SECURE)
+
+/*
+ * GNU_OPTIONS is 1 if you wish to support the GNU-style command
+ * line options --help and --version.
+ */
+#define GNU_OPTIONS 1
+
+/*
+ * ONLY_RETURN is 1 if you want RETURN to be the only input which
+ * will continue past an error message.
+ * Otherwise, any key will continue past an error message.
+ */
+#define ONLY_RETURN 0
+
+/*
+ * LESSKEYFILE is the filename of the default lesskey output file
+ * (in the HOME directory).
+ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
+ * DEF_LESSKEYINFILE is the filename of the default lesskey input
+ * (in the HOME directory).
+ * LESSHISTFILE is the filename of the history file
+ * (in the HOME directory).
+ */
+#define LESSKEYFILE ".less"
+#define LESSKEYFILE_SYS "/etc/lesskey"
+#define DEF_LESSKEYINFILE ".lesskey"
+#define LESSHISTFILE ".lesshst"
+
+
+/* Settings always true on Unix. */
+
+/*
+ * Define MSDOS_COMPILER if compiling under Microsoft C.
+ */
+#define MSDOS_COMPILER 0
+
+/*
+ * Pathname separator character.
+ */
+#define PATHNAME_SEP "/"
+
+/*
+ * The value returned from tgetent on success.
+ * Some HP-UX systems return 0 on success.
+ */
+#define TGETENT_OK 1
+
+/*
+ * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
+ */
+#define HAVE_SYS_TYPES_H 1
+
+/*
+ * Define if you have the <sgstat.h> header file.
+ */
+/* #undef HAVE_SGSTAT_H */
+
+/*
+ * HAVE_PERROR is 1 if your system has the perror() call.
+ * (Actually, if it has sys_errlist, sys_nerr and errno.)
+ */
+#define HAVE_PERROR 1
+
+/*
+ * HAVE_TIME is 1 if your system has the time() call.
+ */
+#define HAVE_TIME 1
+
+/*
+ * HAVE_SHELL is 1 if your system supports a SHELL command interpreter.
+ */
+#define HAVE_SHELL 1
+
+/*
+ * Default shell metacharacters and meta-escape character.
+ */
+#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~"
+#define DEF_METAESCAPE "\\"
+
+/*
+ * HAVE_DUP is 1 if your system has the dup() call.
+ */
+#define HAVE_DUP 1
+
+/* Define to 1 if you have the memcpy() function. */
+#define HAVE_MEMCPY 1
+
+/* Define to 1 if you have the strchr() function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the strstr() function. */
+#define HAVE_STRSTR 1
+
+/*
+ * Sizes of various buffers.
+ */
+#if 0 /* old sizes for small memory machines */
+#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
+#define UNGOT_SIZE 100 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 200 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 512 /* Max size of line in tags file */
+#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
+
+/* Settings automatically determined by configure. */
+
+
+/* Define EDIT_PGM to your editor. */
+#define EDIT_PGM "vi"
+
+/* Define HAVE_CONST if your compiler supports the "const" modifier. */
+#define HAVE_CONST 1
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define HAVE_ERRNO if you have the errno variable. */
+#define HAVE_ERRNO 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fchmod' function. */
+#define HAVE_FCHMOD 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define HAVE_FILENO if you have the fileno() macro. */
+#define HAVE_FILENO 1
+
+/* Define HAVE_FLOAT if your compiler supports the "double" type. */
+#define HAVE_FLOAT 1
+
+/* Define to 1 if you have the `fsync' function. */
+#define HAVE_FSYNC 1
+
+/* GNU regex library */
+/* #undef HAVE_GNU_REGEX */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define HAVE_LOCALE if you have locale.h and setlocale. */
+#define HAVE_LOCALE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define HAVE_OSPEED if your termcap library has the ospeed variable. */
+#define HAVE_OSPEED 1
+
+/* PCRE (Perl-compatible regular expression) library */
+/* #undef HAVE_PCRE */
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* POSIX regcomp() and regex.h */
+#define HAVE_POSIX_REGCOMP 1
+
+/* System V regcmp() */
+/* #undef HAVE_REGCMP */
+
+/* */
+/* #undef HAVE_REGEXEC2 */
+
+/* BSD re_comp() */
+/* #undef HAVE_RE_COMP */
+
+/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro. */
+#define HAVE_SIGEMPTYSET 1
+
+/* Define to 1 if you have the `sigprocmask' function. */
+#define HAVE_SIGPROCMASK 1
+
+/* Define to 1 if you have the `sigsetmask' function. */
+#define HAVE_SIGSETMASK 1
+
+/* Define to 1 if the system has the type `sigset_t'. */
+#define HAVE_SIGSET_T 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `stat' function. */
+#define HAVE_STAT 1
+
+/* Define HAVE_STAT_INO if your struct stat has st_ino and st_dev. */
+#define HAVE_STAT_INO 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define HAVE_STRERROR if you have the strerror() function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `system' function. */
+#define HAVE_SYSTEM 1
+
+/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable. */
+#define HAVE_SYS_ERRLIST 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* 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/stream.h> header file. */
+/* #undef HAVE_SYS_STREAM_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <termcap.h> header file. */
+#define HAVE_TERMCAP_H 1
+
+/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr. */
+#define HAVE_TERMIOS_FUNCS 1
+
+/* Define to 1 if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if you have the <termio.h> header file. */
+/* #undef HAVE_TERMIO_H */
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define HAVE_TIME_T if your system supports the "time_t" type. */
+#define HAVE_TIME_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower. */
+#define HAVE_UPPER_LOWER 1
+
+/* Henry Spencer V8 regcomp() and regexp.h */
+/* #undef HAVE_V8_REGCOMP */
+
+/* Define to 1 if you have the <values.h> header file. */
+/* #undef HAVE_VALUES_H */
+
+/* Define HAVE_VOID if your compiler supports the "void" type. */
+#define HAVE_VOID 1
+
+/* Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower. */
+#define HAVE_WCTYPE 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if you have the `_setjmp' function. */
+#define HAVE__SETJMP 1
+
+/* Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.
+ */
+/* #undef MUST_DEFINE_ERRNO */
+
+/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in
+ termcap.h. */
+/* #undef MUST_DEFINE_OSPEED */
+
+/* pattern matching is supported, but without metacharacters. */
+/* #undef NO_REGEX */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "less"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "less 1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "less"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define SECURE_COMPILE=1 to build a secure version of less. */
+#define SECURE_COMPILE 0
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/usr.bin/less/lesspipe.sh b/usr.bin/less/lesspipe.sh
new file mode 100644
index 0000000..af038b1
--- /dev/null
+++ b/usr.bin/less/lesspipe.sh
@@ -0,0 +1,25 @@
+#! /bin/sh
+# ex:ts=8
+
+# $FreeBSD$
+
+case "$1" in
+ *.zip)
+ exec unzip -c "$1" 2>/dev/null
+ ;;
+ *.Z)
+ exec uncompress -c "$1" 2>/dev/null
+ ;;
+ *.gz)
+ exec gzip -d -c "$1" 2>/dev/null
+ ;;
+ *.bz2)
+ exec bzip2 -d -c "$1" 2>/dev/null
+ ;;
+ *.xz)
+ exec xz -d -c "$1" 2>/dev/null
+ ;;
+ *.lzma)
+ exec lzma -d -c "$1" 2>/dev/null
+ ;;
+esac
diff --git a/usr.bin/less/zless.sh b/usr.bin/less/zless.sh
new file mode 100644
index 0000000..f2e035c
--- /dev/null
+++ b/usr.bin/less/zless.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+export LESSOPEN="||/usr/bin/lesspipe.sh %s"
+exec /usr/bin/less "$@"
diff --git a/usr.bin/lessecho/Makefile b/usr.bin/lessecho/Makefile
new file mode 100644
index 0000000..bb8d1a6
--- /dev/null
+++ b/usr.bin/lessecho/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= lessecho
+SRCS= lessecho.c version.c
+CLEANFILES= lessecho.1
+
+.include "${.CURDIR}/../less/Makefile.common"
+.include <bsd.prog.mk>
diff --git a/usr.bin/lessecho/Makefile.depend b/usr.bin/lessecho/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/lessecho/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/lesskey/Makefile b/usr.bin/lesskey/Makefile
new file mode 100644
index 0000000..b10bf6d
--- /dev/null
+++ b/usr.bin/lesskey/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= lesskey
+SRCS= lesskey.c version.c
+CLEANFILES= lesskey.1
+
+.include "${.CURDIR}/../less/Makefile.common"
+.include <bsd.prog.mk>
diff --git a/usr.bin/lesskey/Makefile.depend b/usr.bin/lesskey/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/lesskey/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/lex/Makefile b/usr.bin/lex/Makefile
new file mode 100644
index 0000000..faa503a
--- /dev/null
+++ b/usr.bin/lex/Makefile
@@ -0,0 +1,64 @@
+# $FreeBSD$
+#
+# By default, flex will be configured to generate 8-bit scanners only if the
+# -8 flag is given. If you want it to always generate 8-bit scanners, add
+# "-DDEFAULT_CSIZE=256" to CFLAGS. Note that doing so will double the size
+# of all uncompressed scanners.
+#
+# Bootstrapping of lex is handled automatically.
+# Also note that flex.skel no longer gets installed.
+#
+
+PROG= lex
+LINKS+= ${BINDIR}/lex ${BINDIR}/lex++
+LINKS+= ${BINDIR}/lex ${BINDIR}/flex
+LINKS+= ${BINDIR}/lex ${BINDIR}/flex++
+
+FLEXDIR= ${.CURDIR}/../../contrib/flex
+
+.PATH: ${FLEXDIR}
+
+SRCS= buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
+ nfa.c options.c parse.y regex.c scan.c scanflags.c \
+ scanopt.c skel.c sym.c tables.c tables_shared.c \
+ tblcmp.c yylex.c
+LFLAGS+= -is
+CFLAGS+= -I. -I${.CURDIR} -I${FLEXDIR} -DHAVE_CONFIG_H
+INCS= FlexLexer.h
+INCSDIR= ${INCLUDEDIR}
+MLINKS+= lex.1 flex.1
+MLINKS+= lex.1 flex++.1
+MLINKS+= lex.1 lex++.1
+
+WARNS?= 3
+
+CLEANFILES= scan.c skel.c
+GENFILES= parse.c parse.h scan.c skel.c
+
+SUBDIR= lib
+
+FLEX_VERSION= `awk -f ${.CURDIR}/version.awk ${.CURDIR}/config.h`
+
+skel.c: config.h mkskel.sh flex.skl version.awk
+ sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' \
+ ${FLEXDIR}/flex.skl | \
+ m4 -I${FLEXDIR} -P ${FLEX_VERSION} | \
+ sed 's/m4postproc_/m4_/g' | \
+ sh ${FLEXDIR}/mkskel.sh > ${.TARGET}
+
+bootstrap: ${GENFILES:S/^/init/g}
+.for _f in ${GENFILES}
+ @diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
+ ${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
+ echo "Bootstrapping ${_f}" ; \
+ ${CP} ${.CURDIR}/init${_f} ${_f} ; \
+ }
+.endfor
+
+test: check
+check: ${PROG}
+ ./${PROG} ${LFLAGS} -t ${COMPRESSION} ${FLEXDIR}/scan.l | \
+ diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' ${.CURDIR}/initscan.c -
+ @echo "Check successful"
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lex/Makefile.depend b/usr.bin/lex/Makefile.depend
new file mode 100644
index 0000000..ca0b2f9
--- /dev/null
+++ b/usr.bin/lex/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/lex/config.h b/usr.bin/lex/config.h
new file mode 100644
index 0000000..88361dfb
--- /dev/null
+++ b/usr.bin/lex/config.h
@@ -0,0 +1,208 @@
+/* config.h. Generated from conf.in by configure. */
+/* conf.in. Generated from configure.in by autoheader. */
+/* $FreeBSD$ */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the `dup2' function. */
+#define HAVE_DUP2 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* pthread library */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the `pow' function. */
+#define HAVE_POW 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#define HAVE_REALLOC 1
+
+/* Define to 1 if you have the `regcomp' function. */
+#define HAVE_REGCOMP 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+#define HAVE_REGEX_H 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* 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/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Define to the m4 executable name. */
+#define M4 "m4"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "flex"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "flex-help@lists.sourceforge.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "the fast lexical analyser generator"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "the fast lexical analyser generator 2.5.37"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "flex"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.5.37"
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "2.5.37"
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+#define YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
diff --git a/usr.bin/lex/initparse.c b/usr.bin/lex/initparse.c
new file mode 100644
index 0000000..9bfd5cd
--- /dev/null
+++ b/usr.bin/lex/initparse.c
@@ -0,0 +1,1849 @@
+/* $FreeBSD$ */
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 35 "parse.y"
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* 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. */
+
+/* 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
+int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
+
+int *scon_stk;
+int scon_stk_ptr;
+
+static int madeany = false; /* whether we've made the '.' character class */
+static int ccldot, cclany;
+int previous_continued_action; /* whether the previous rule's action was '|' */
+
+#define format_warn3(fmt, a1, a2) \
+ do{ \
+ char fw3_msg[MAXLINE];\
+ snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
+ warn( fw3_msg );\
+ }while(0)
+
+/* Expand a POSIX character class expression. */
+#define CCL_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( isascii(c) && func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* negated class */
+#define CCL_NEG_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( !func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* While POSIX defines isblank(), it's not ANSI C. */
+#define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
+
+/* On some over-ambitious machines, such as DEC Alpha's, the default
+ * token type is "long" instead of "int"; this leads to problems with
+ * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
+ * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
+ * following should ensure that the default token type is "int".
+ */
+#define YYSTYPE int
+
+#line 99 "parse.c"
+
+#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 CHAR 257
+#define NUMBER 258
+#define SECTEND 259
+#define SCDECL 260
+#define XSCDECL 261
+#define NAME 262
+#define PREVCCL 263
+#define EOF_OP 264
+#define OPTION_OP 265
+#define OPT_OUTFILE 266
+#define OPT_PREFIX 267
+#define OPT_YYCLASS 268
+#define OPT_HEADER 269
+#define OPT_EXTRA_TYPE 270
+#define OPT_TABLES 271
+#define CCE_ALNUM 272
+#define CCE_ALPHA 273
+#define CCE_BLANK 274
+#define CCE_CNTRL 275
+#define CCE_DIGIT 276
+#define CCE_GRAPH 277
+#define CCE_LOWER 278
+#define CCE_PRINT 279
+#define CCE_PUNCT 280
+#define CCE_SPACE 281
+#define CCE_UPPER 282
+#define CCE_XDIGIT 283
+#define CCE_NEG_ALNUM 284
+#define CCE_NEG_ALPHA 285
+#define CCE_NEG_BLANK 286
+#define CCE_NEG_CNTRL 287
+#define CCE_NEG_DIGIT 288
+#define CCE_NEG_GRAPH 289
+#define CCE_NEG_LOWER 290
+#define CCE_NEG_PRINT 291
+#define CCE_NEG_PUNCT 292
+#define CCE_NEG_SPACE 293
+#define CCE_NEG_UPPER 294
+#define CCE_NEG_XDIGIT 295
+#define CCL_OP_DIFF 296
+#define CCL_OP_UNION 297
+#define BEGIN_REPEAT_POSIX 298
+#define END_REPEAT_POSIX 299
+#define BEGIN_REPEAT_FLEX 300
+#define END_REPEAT_FLEX 301
+#define YYERRCODE 256
+static const short yylhs[] = { -1,
+ 0, 1, 2, 2, 2, 2, 3, 6, 6, 7,
+ 7, 7, 8, 9, 9, 10, 10, 10, 10, 10,
+ 10, 4, 4, 4, 5, 12, 12, 12, 12, 14,
+ 11, 11, 11, 15, 15, 15, 16, 13, 13, 13,
+ 13, 18, 18, 17, 19, 19, 19, 19, 19, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 21, 21, 21, 23, 23, 24, 24, 24, 24,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 22, 22,
+};
+static const short yylen[] = { 2,
+ 5, 0, 3, 2, 0, 1, 1, 1, 1, 2,
+ 1, 1, 2, 2, 0, 3, 3, 3, 3, 3,
+ 3, 5, 5, 0, 0, 2, 1, 1, 1, 0,
+ 4, 3, 0, 3, 1, 1, 1, 2, 3, 2,
+ 1, 3, 1, 2, 2, 1, 6, 5, 4, 2,
+ 2, 2, 6, 5, 4, 1, 1, 1, 3, 3,
+ 1, 3, 3, 1, 3, 4, 4, 2, 2, 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, 2, 0,
+};
+static const short yydefred[] = { 2,
+ 0, 0, 6, 0, 7, 8, 9, 15, 24, 0,
+ 4, 0, 0, 12, 11, 0, 0, 0, 0, 0,
+ 0, 0, 14, 0, 1, 0, 10, 0, 0, 0,
+ 0, 0, 0, 0, 0, 24, 0, 16, 18, 19,
+ 20, 17, 21, 32, 36, 37, 0, 35, 0, 29,
+ 61, 58, 28, 0, 56, 96, 0, 0, 0, 27,
+ 0, 0, 0, 0, 0, 64, 31, 0, 23, 26,
+ 0, 0, 70, 0, 22, 0, 40, 0, 44, 0,
+ 0, 0, 50, 51, 52, 0, 0, 34, 95, 59,
+ 60, 0, 0, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 82, 81, 83, 84, 85, 86, 87,
+ 88, 93, 89, 90, 91, 94, 92, 65, 69, 39,
+ 0, 0, 0, 62, 63, 66, 0, 49, 0, 55,
+ 0, 67, 0, 48, 0, 54, 47, 53,
+};
+static const short yydgoto[] = { 1,
+ 2, 4, 9, 13, 25, 10, 16, 11, 12, 23,
+ 26, 59, 60, 35, 47, 48, 61, 62, 63, 64,
+ 65, 71, 66, 74, 119,
+};
+static const short yysindex[] = { 0,
+ 0, -222, 0, -155, 0, 0, 0, 0, 0, -215,
+ 0, -123, 6, 0, 0, -193, 10, 21, 26, 31,
+ 35, 37, 0, 59, 0, -44, 0, -147, -145, -140,
+ -133, -132, -129, 75, -214, 0, -19, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 23, 0, -48, 0,
+ 0, 0, 0, -17, 0, 0, -17, 27, 128, 0,
+ -17, -1, -30, -41, -189, 0, 0, -121, 0, 0,
+ -31, -34, 0, -87, 0, -25, 0, -17, 0, -109,
+ -41, -108, 0, 0, 0, 60, 60, 0, 0, 0,
+ 0, 46, 107, 0, 0, 0, 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, -36, -39, 0, 0, 0, -104, 0, -219, 0,
+ -238, 0, -144, 0, -143, 0, 0, 0,
+};
+static const short yyrindex[] = { 0,
+ 0, -141, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -134, 9, 0, 0, -125, 0, 0, 0, 0,
+ 0, 0, 0, -178, 0, 22, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -21, 0,
+ 0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
+ 0, 144, 47, 4, -10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 146, 0, 0, 0, 0,
+ 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 124, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 50, 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, 121, 133, 0, 0, 0, 0, 0,
+ 0, 0, 106, 0, 0, 93, 0, 32, 84, -45,
+ 0, 0, 25, 90, 0,
+};
+#define YYTABLESIZE 419
+static const short yytable[] = { 57,
+ 83, 84, 90, 56, 131, 118, 91, 129, 25, 57,
+ 120, 24, 33, 46, 56, 55, 56, 81, 33, 135,
+ 57, 85, 57, 57, 33, 57, 55, 45, 55, 57,
+ 57, 57, 57, 3, 77, 57, 57, 46, 133, 46,
+ 14, 45, 33, 46, 46, 79, 15, 46, 33, 46,
+ 46, 45, 57, 45, 33, 25, 43, 45, 45, 42,
+ 58, 25, 136, 45, 45, 24, 68, 25, 27, 33,
+ 28, 58, 33, 58, 54, 81, 69, 30, 36, 134,
+ 57, 29, 43, 30, 67, 42, 30, 43, 72, 78,
+ 42, 31, 76, 43, 46, 32, 42, 33, 78, 33,
+ 34, 33, 33, 5, 6, 7, 86, 87, 45, 8,
+ 124, 125, 25, 57, 38, 25, 39, 5, 5, 5,
+ 73, 40, 78, 5, 13, 13, 13, 46, 41, 42,
+ 13, 33, 43, 3, 3, 3, 44, 75, 126, 3,
+ 46, 45, 17, 18, 19, 20, 21, 22, 122, 123,
+ 58, 127, 132, 41, 137, 38, 49, 138, 37, 70,
+ 88, 121, 92, 0, 0, 0, 0, 0, 0, 93,
+ 43, 0, 0, 42, 0, 0, 0, 70, 0, 0,
+ 0, 0, 0, 0, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 0, 0,
+ 0, 0, 0, 0, 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 89, 51, 0, 0, 0,
+ 0, 0, 52, 0, 33, 33, 50, 51, 0, 51,
+ 0, 33, 33, 52, 53, 52, 57, 0, 0, 0,
+ 0, 0, 57, 0, 0, 0, 0, 0, 82, 0,
+ 46, 130, 128, 0, 33, 33, 46, 80, 0, 0,
+ 0, 33, 33, 0, 45, 0, 0, 25, 25, 0,
+ 45, 0, 0, 0, 25, 25, 0, 57, 0, 57,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 46, 93, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 45, 0, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+ 117, 70, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68,
+};
+static const short yycheck[] = { 10,
+ 42, 43, 34, 34, 44, 93, 41, 44, 0, 40,
+ 36, 60, 34, 10, 34, 46, 34, 63, 40, 258,
+ 40, 63, 40, 34, 46, 36, 46, 10, 46, 40,
+ 41, 42, 43, 256, 36, 46, 47, 34, 258, 36,
+ 256, 256, 34, 40, 41, 47, 262, 262, 40, 46,
+ 47, 34, 63, 36, 46, 34, 10, 40, 41, 10,
+ 91, 40, 301, 46, 47, 60, 44, 46, 262, 91,
+ 61, 91, 94, 91, 94, 121, 125, 256, 123, 299,
+ 91, 61, 36, 262, 62, 36, 61, 41, 57, 124,
+ 41, 61, 61, 47, 91, 61, 47, 61, 124, 91,
+ 42, 123, 94, 259, 260, 261, 296, 297, 91, 265,
+ 86, 87, 91, 124, 262, 94, 262, 259, 260, 261,
+ 94, 262, 124, 265, 259, 260, 261, 124, 262, 262,
+ 265, 123, 262, 259, 260, 261, 62, 10, 93, 265,
+ 262, 124, 266, 267, 268, 269, 270, 271, 258, 258,
+ 91, 45, 257, 10, 299, 10, 36, 301, 26, 54,
+ 68, 78, 73, -1, -1, -1, -1, -1, -1, 257,
+ 124, -1, -1, 124, -1, -1, -1, 93, -1, -1,
+ -1, -1, -1, -1, 272, 273, 274, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
+ 288, 289, 290, 291, 292, 293, 294, 295, -1, -1,
+ -1, -1, -1, -1, -1, -1, 93, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, 257, -1, -1, -1,
+ -1, -1, 263, -1, 256, 257, 256, 257, -1, 257,
+ -1, 263, 264, 263, 264, 263, 257, -1, -1, -1,
+ -1, -1, 263, -1, -1, -1, -1, -1, 300, -1,
+ 257, 301, 299, -1, 256, 257, 263, 298, -1, -1,
+ -1, 263, 264, -1, 257, -1, -1, 256, 257, -1,
+ 263, -1, -1, -1, 263, 264, -1, 298, -1, 300,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 298, 257, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 298, -1, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 257, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 272, 273, 274, 275,
+ 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
+ 286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
+ 257, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
+ 287, 288, 289, 290, 291, 292, 293, 294, 295,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 301
+#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,"CHAR","NUMBER","SECTEND",
+"SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE",
+"OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_EXTRA_TYPE","OPT_TABLES",
+"CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
+"CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
+"CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
+"CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
+"CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
+"BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",
+};
+static const char *yyrule[] = {
+"$accept : goal",
+"goal : initlex sect1 sect1end sect2 initforrule",
+"initlex :",
+"sect1 : sect1 startconddecl namelist1",
+"sect1 : sect1 options",
+"sect1 :",
+"sect1 : error",
+"sect1end : SECTEND",
+"startconddecl : SCDECL",
+"startconddecl : XSCDECL",
+"namelist1 : namelist1 NAME",
+"namelist1 : NAME",
+"namelist1 : error",
+"options : OPTION_OP optionlist",
+"optionlist : optionlist option",
+"optionlist :",
+"option : OPT_OUTFILE '=' NAME",
+"option : OPT_EXTRA_TYPE '=' NAME",
+"option : OPT_PREFIX '=' NAME",
+"option : OPT_YYCLASS '=' NAME",
+"option : OPT_HEADER '=' NAME",
+"option : OPT_TABLES '=' NAME",
+"sect2 : sect2 scon initforrule flexrule '\\n'",
+"sect2 : sect2 scon '{' sect2 '}'",
+"sect2 :",
+"initforrule :",
+"flexrule : '^' rule",
+"flexrule : rule",
+"flexrule : EOF_OP",
+"flexrule : error",
+"scon_stk_ptr :",
+"scon : '<' scon_stk_ptr namelist2 '>'",
+"scon : '<' '*' '>'",
+"scon :",
+"namelist2 : namelist2 ',' sconname",
+"namelist2 : sconname",
+"namelist2 : error",
+"sconname : NAME",
+"rule : re2 re",
+"rule : re2 re '$'",
+"rule : re '$'",
+"rule : re",
+"re : re '|' series",
+"re : series",
+"re2 : re '/'",
+"series : series singleton",
+"series : singleton",
+"series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
+"series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
+"series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
+"singleton : singleton '*'",
+"singleton : singleton '+'",
+"singleton : singleton '?'",
+"singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
+"singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
+"singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
+"singleton : '.'",
+"singleton : fullccl",
+"singleton : PREVCCL",
+"singleton : '\"' string '\"'",
+"singleton : '(' re ')'",
+"singleton : CHAR",
+"fullccl : fullccl CCL_OP_DIFF braceccl",
+"fullccl : fullccl CCL_OP_UNION braceccl",
+"fullccl : braceccl",
+"braceccl : '[' ccl ']'",
+"braceccl : '[' '^' ccl ']'",
+"ccl : ccl CHAR '-' CHAR",
+"ccl : ccl CHAR",
+"ccl : ccl ccl_expr",
+"ccl :",
+"ccl_expr : CCE_ALNUM",
+"ccl_expr : CCE_ALPHA",
+"ccl_expr : CCE_BLANK",
+"ccl_expr : CCE_CNTRL",
+"ccl_expr : CCE_DIGIT",
+"ccl_expr : CCE_GRAPH",
+"ccl_expr : CCE_LOWER",
+"ccl_expr : CCE_PRINT",
+"ccl_expr : CCE_PUNCT",
+"ccl_expr : CCE_SPACE",
+"ccl_expr : CCE_XDIGIT",
+"ccl_expr : CCE_UPPER",
+"ccl_expr : CCE_NEG_ALNUM",
+"ccl_expr : CCE_NEG_ALPHA",
+"ccl_expr : CCE_NEG_BLANK",
+"ccl_expr : CCE_NEG_CNTRL",
+"ccl_expr : CCE_NEG_DIGIT",
+"ccl_expr : CCE_NEG_GRAPH",
+"ccl_expr : CCE_NEG_PRINT",
+"ccl_expr : CCE_NEG_PUNCT",
+"ccl_expr : CCE_NEG_SPACE",
+"ccl_expr : CCE_NEG_XDIGIT",
+"ccl_expr : CCE_NEG_LOWER",
+"ccl_expr : CCE_NEG_UPPER",
+"string : string CHAR",
+"string :",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+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 948 "parse.y"
+
+
+/* build_eof_action - build the "<<EOF>>" action for the active start
+ * conditions
+ */
+
+void build_eof_action()
+ {
+ int i;
+ char action_text[MAXLINE];
+
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ {
+ if ( sceof[scon_stk[i]] )
+ format_pinpoint_message(
+ "multiple <<EOF>> rules for start condition %s",
+ scname[scon_stk[i]] );
+
+ else
+ {
+ sceof[scon_stk[i]] = true;
+
+ if (previous_continued_action /* && previous action was regular */)
+ add_action("YY_RULE_SETUP\n");
+
+ snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
+ scname[scon_stk[i]] );
+ add_action( action_text );
+ }
+ }
+
+ line_directive_out( (FILE *) 0, 1 );
+
+ /* This isn't a normal rule after all - don't count it as
+ * such, so we don't have any holes in the rule numbering
+ * (which make generating "rule can never match" warnings
+ * more difficult.
+ */
+ --num_rules;
+ ++num_eof_rules;
+ }
+
+
+/* format_synerr - write out formatted syntax error */
+
+void format_synerr( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
+ synerr( errmsg );
+ }
+
+
+/* synerr - report a syntax error */
+
+void synerr( str )
+const char *str;
+ {
+ syntaxerror = true;
+ pinpoint_message( str );
+ }
+
+
+/* format_warn - write out formatted warning */
+
+void format_warn( msg, arg )
+const char *msg, arg[];
+ {
+ char warn_msg[MAXLINE];
+
+ snprintf( warn_msg, sizeof(warn_msg), msg, arg );
+ warn( warn_msg );
+ }
+
+
+/* warn - report a warning, unless -w was given */
+
+void warn( str )
+const char *str;
+ {
+ line_warning( str, linenum );
+ }
+
+/* format_pinpoint_message - write out a message formatted with one string,
+ * pinpointing its location
+ */
+
+void format_pinpoint_message( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ snprintf( errmsg, sizeof(errmsg), msg, arg );
+ pinpoint_message( errmsg );
+ }
+
+
+/* pinpoint_message - write out a message, pinpointing its location */
+
+void pinpoint_message( str )
+const char *str;
+ {
+ line_pinpoint( str, linenum );
+ }
+
+
+/* line_warning - report a warning at a given line, unless -w was given */
+
+void line_warning( str, line )
+const char *str;
+int line;
+ {
+ char warning[MAXLINE];
+
+ if ( ! nowarn )
+ {
+ snprintf( warning, sizeof(warning), "warning, %s", str );
+ line_pinpoint( warning, line );
+ }
+ }
+
+
+/* line_pinpoint - write out a message, pinpointing it at the given line */
+
+void line_pinpoint( str, line )
+const char *str;
+int line;
+ {
+ fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
+ }
+
+
+/* yyerror - eat up an error message from the parser;
+ * currently, messages are ignore
+ */
+
+void yyerror( msg )
+const char *msg;
+ {
+ }
+#line 656 "parse.c"
+
+#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 = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == NULL)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == NULL)
+ 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")) != NULL)
+ {
+ 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 = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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 = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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 1:
+#line 119 "parse.y"
+ { /* add default rule */
+ int def_rule;
+
+ pat = cclinit();
+ cclnegate( pat );
+
+ def_rule = mkstate( -pat );
+
+ /* Remember the number of the default rule so we
+ * don't generate "can't match" warnings for it.
+ */
+ default_rule = num_rules;
+
+ finish_rule( def_rule, false, 0, 0, 0);
+
+ for ( i = 1; i <= lastsc; ++i )
+ scset[i] = mkbranch( scset[i], def_rule );
+
+ if ( spprdflt )
+ add_action(
+ "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
+ else
+ add_action( "ECHO" );
+
+ add_action( ";\n\tYY_BREAK\n" );
+ }
+break;
+case 2:
+#line 148 "parse.y"
+ { /* initialize for processing rules */
+
+ /* Create default DFA start condition. */
+ scinstal( "INITIAL", false );
+ }
+break;
+case 6:
+#line 159 "parse.y"
+ { synerr( _("unknown error processing section 1") ); }
+break;
+case 7:
+#line 163 "parse.y"
+ {
+ check_options();
+ scon_stk = allocate_integer_array( lastsc + 1 );
+ scon_stk_ptr = 0;
+ }
+break;
+case 8:
+#line 171 "parse.y"
+ { xcluflg = false; }
+break;
+case 9:
+#line 174 "parse.y"
+ { xcluflg = true; }
+break;
+case 10:
+#line 178 "parse.y"
+ { scinstal( nmstr, xcluflg ); }
+break;
+case 11:
+#line 181 "parse.y"
+ { scinstal( nmstr, xcluflg ); }
+break;
+case 12:
+#line 184 "parse.y"
+ { synerr( _("bad start condition list") ); }
+break;
+case 16:
+#line 195 "parse.y"
+ {
+ outfilename = copy_string( nmstr );
+ did_outfilename = 1;
+ }
+break;
+case 17:
+#line 200 "parse.y"
+ { extra_type = copy_string( nmstr ); }
+break;
+case 18:
+#line 202 "parse.y"
+ { prefix = copy_string( nmstr ); }
+break;
+case 19:
+#line 204 "parse.y"
+ { yyclass = copy_string( nmstr ); }
+break;
+case 20:
+#line 206 "parse.y"
+ { headerfilename = copy_string( nmstr ); }
+break;
+case 21:
+#line 208 "parse.y"
+ { tablesext = true; tablesfilename = copy_string( nmstr ); }
+break;
+case 22:
+#line 212 "parse.y"
+ { scon_stk_ptr = yystack.l_mark[-3]; }
+break;
+case 23:
+#line 214 "parse.y"
+ { scon_stk_ptr = yystack.l_mark[-3]; }
+break;
+case 25:
+#line 219 "parse.y"
+ {
+ /* Initialize for a parse of one rule. */
+ trlcontxt = variable_trail_rule = varlength = false;
+ trailcnt = headcnt = rulelen = 0;
+ current_state_type = STATE_NORMAL;
+ previous_continued_action = continued_action;
+ in_rule = true;
+
+ new_rule();
+ }
+break;
+case 26:
+#line 232 "parse.y"
+ {
+ pat = yystack.l_mark[0];
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scbol[scon_stk[i]] =
+ mkbranch( scbol[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ /* Add to all non-exclusive start conditions,
+ * including the default (0) start condition.
+ */
+
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scbol[i] = mkbranch( scbol[i],
+ pat );
+ }
+
+ if ( ! bol_needed )
+ {
+ bol_needed = true;
+
+ if ( performance_report > 1 )
+ pinpoint_message(
+ "'^' operator results in sub-optimal performance" );
+ }
+ }
+break;
+case 27:
+#line 268 "parse.y"
+ {
+ pat = yystack.l_mark[0];
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scset[scon_stk[i]] =
+ mkbranch( scset[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scset[i] =
+ mkbranch( scset[i],
+ pat );
+ }
+ }
+break;
+case 28:
+#line 292 "parse.y"
+ {
+ if ( scon_stk_ptr > 0 )
+ build_eof_action();
+
+ else
+ {
+ /* This EOF applies to all start conditions
+ * which don't already have EOF actions.
+ */
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! sceof[i] )
+ scon_stk[++scon_stk_ptr] = i;
+
+ if ( scon_stk_ptr == 0 )
+ warn(
+ "all start conditions already have <<EOF>> rules" );
+
+ else
+ build_eof_action();
+ }
+ }
+break;
+case 29:
+#line 315 "parse.y"
+ { synerr( _("unrecognized rule") ); }
+break;
+case 30:
+#line 319 "parse.y"
+ { yyval = scon_stk_ptr; }
+break;
+case 31:
+#line 323 "parse.y"
+ { yyval = yystack.l_mark[-2]; }
+break;
+case 32:
+#line 326 "parse.y"
+ {
+ yyval = scon_stk_ptr;
+
+ for ( i = 1; i <= lastsc; ++i )
+ {
+ int j;
+
+ for ( j = 1; j <= scon_stk_ptr; ++j )
+ if ( scon_stk[j] == i )
+ break;
+
+ if ( j > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = i;
+ }
+ }
+break;
+case 33:
+#line 343 "parse.y"
+ { yyval = scon_stk_ptr; }
+break;
+case 36:
+#line 351 "parse.y"
+ { synerr( _("bad start condition list") ); }
+break;
+case 37:
+#line 355 "parse.y"
+ {
+ if ( (scnum = sclookup( nmstr )) == 0 )
+ format_pinpoint_message(
+ "undeclared start condition %s",
+ nmstr );
+ else
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ if ( scon_stk[i] == scnum )
+ {
+ format_warn(
+ "<%s> specified twice",
+ scname[scnum] );
+ break;
+ }
+
+ if ( i > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = scnum;
+ }
+ }
+break;
+case 38:
+#line 378 "parse.y"
+ {
+ if ( transchar[lastst[yystack.l_mark[0]]] != SYM_EPSILON )
+ /* Provide final transition \now/ so it
+ * will be marked as a trailing context
+ * state.
+ */
+ yystack.l_mark[0] = link_machines( yystack.l_mark[0],
+ mkstate( SYM_EPSILON ) );
+
+ mark_beginning_as_normal( yystack.l_mark[0] );
+ current_state_type = STATE_NORMAL;
+
+ if ( previous_continued_action )
+ {
+ /* We need to treat this as variable trailing
+ * context so that the backup does not happen
+ * in the action but before the action switch
+ * statement. If the backup happens in the
+ * action, then the rules "falling into" this
+ * one's action will *also* do the backup,
+ * erroneously.
+ */
+ if ( ! varlength || headcnt != 0 )
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ /* Mark as variable. */
+ varlength = true;
+ headcnt = 0;
+
+ }
+
+ if ( lex_compat || (varlength && headcnt == 0) )
+ { /* variable trailing context rule */
+ /* Mark the first part of the rule as the
+ * accepting "head" part of a trailing
+ * context rule.
+ *
+ * By the way, we didn't do this at the
+ * beginning of this production because back
+ * then current_state_type was set up for a
+ * trail rule, and add_accept() can create
+ * a new state ...
+ */
+ add_accept( yystack.l_mark[-1],
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ else
+ trailcnt = rulelen;
+
+ yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
+ }
+break;
+case 39:
+#line 434 "parse.y"
+ { synerr( _("trailing context used twice") ); }
+break;
+case 40:
+#line 437 "parse.y"
+ {
+ headcnt = 0;
+ trailcnt = 1;
+ rulelen = 1;
+ varlength = false;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+
+ if ( trlcontxt )
+ {
+ synerr( _("trailing context used twice") );
+ yyval = mkstate( SYM_EPSILON );
+ }
+
+ else if ( previous_continued_action )
+ {
+ /* See the comment in the rule for "re2 re"
+ * above.
+ */
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ varlength = true;
+ }
+
+ if ( lex_compat || varlength )
+ {
+ /* Again, see the comment in the rule for
+ * "re2 re" above.
+ */
+ add_accept( yystack.l_mark[-1],
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ trlcontxt = true;
+
+ eps = mkstate( SYM_EPSILON );
+ yyval = link_machines( yystack.l_mark[-1],
+ link_machines( eps, mkstate( '\n' ) ) );
+ }
+break;
+case 41:
+#line 480 "parse.y"
+ {
+ yyval = yystack.l_mark[0];
+
+ if ( trlcontxt )
+ {
+ if ( lex_compat || (varlength && headcnt == 0) )
+ /* Both head and trail are
+ * variable-length.
+ */
+ variable_trail_rule = true;
+ else
+ trailcnt = rulelen;
+ }
+ }
+break;
+case 42:
+#line 498 "parse.y"
+ {
+ varlength = true;
+ yyval = mkor( yystack.l_mark[-2], yystack.l_mark[0] );
+ }
+break;
+case 43:
+#line 504 "parse.y"
+ { yyval = yystack.l_mark[0]; }
+break;
+case 44:
+#line 509 "parse.y"
+ {
+ /* This rule is written separately so the
+ * reduction will occur before the trailing
+ * series is parsed.
+ */
+
+ if ( trlcontxt )
+ synerr( _("trailing context used twice") );
+ else
+ trlcontxt = true;
+
+ if ( varlength )
+ /* We hope the trailing context is
+ * fixed-length.
+ */
+ varlength = false;
+ else
+ headcnt = rulelen;
+
+ rulelen = 0;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+ yyval = yystack.l_mark[-1];
+ }
+break;
+case 45:
+#line 536 "parse.y"
+ {
+ /* This is where concatenation of adjacent patterns
+ * gets done.
+ */
+ yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
+ }
+break;
+case 46:
+#line 544 "parse.y"
+ { yyval = yystack.l_mark[0]; }
+break;
+case 47:
+#line 547 "parse.y"
+ {
+ varlength = true;
+
+ if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
+ {
+ synerr( _("bad iteration values") );
+ yyval = yystack.l_mark[-5];
+ }
+ else
+ {
+ if ( yystack.l_mark[-3] == 0 )
+ {
+ if ( yystack.l_mark[-1] <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ yyval = yystack.l_mark[-5];
+ }
+ else
+ yyval = mkopt(
+ mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
+ }
+ else
+ yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
+ }
+ }
+break;
+case 48:
+#line 575 "parse.y"
+ {
+ varlength = true;
+
+ if ( yystack.l_mark[-2] <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ yyval = yystack.l_mark[-4];
+ }
+
+ else
+ yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
+ }
+break;
+case 49:
+#line 589 "parse.y"
+ {
+ /* The series could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( yystack.l_mark[-1] <= 0 )
+ {
+ synerr( _("iteration value must be positive")
+ );
+ yyval = yystack.l_mark[-3];
+ }
+
+ else
+ yyval = link_machines( yystack.l_mark[-3],
+ copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
+ }
+break;
+case 50:
+#line 611 "parse.y"
+ {
+ varlength = true;
+
+ yyval = mkclos( yystack.l_mark[-1] );
+ }
+break;
+case 51:
+#line 618 "parse.y"
+ {
+ varlength = true;
+ yyval = mkposcl( yystack.l_mark[-1] );
+ }
+break;
+case 52:
+#line 624 "parse.y"
+ {
+ varlength = true;
+ yyval = mkopt( yystack.l_mark[-1] );
+ }
+break;
+case 53:
+#line 630 "parse.y"
+ {
+ varlength = true;
+
+ if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
+ {
+ synerr( _("bad iteration values") );
+ yyval = yystack.l_mark[-5];
+ }
+ else
+ {
+ if ( yystack.l_mark[-3] == 0 )
+ {
+ if ( yystack.l_mark[-1] <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ yyval = yystack.l_mark[-5];
+ }
+ else
+ yyval = mkopt(
+ mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
+ }
+ else
+ yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
+ }
+ }
+break;
+case 54:
+#line 658 "parse.y"
+ {
+ varlength = true;
+
+ if ( yystack.l_mark[-2] <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ yyval = yystack.l_mark[-4];
+ }
+
+ else
+ yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
+ }
+break;
+case 55:
+#line 672 "parse.y"
+ {
+ /* The singleton could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( yystack.l_mark[-1] <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ yyval = yystack.l_mark[-3];
+ }
+
+ else
+ yyval = link_machines( yystack.l_mark[-3],
+ copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
+ }
+break;
+case 56:
+#line 691 "parse.y"
+ {
+ if ( ! madeany )
+ {
+ /* Create the '.' character class. */
+ ccldot = cclinit();
+ ccladd( ccldot, '\n' );
+ cclnegate( ccldot );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[ccldot],
+ ccllen[ccldot], nextecm,
+ ecgroup, csize, csize );
+
+ /* Create the (?s:'.') character class. */
+ cclany = cclinit();
+ cclnegate( cclany );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[cclany],
+ ccllen[cclany], nextecm,
+ ecgroup, csize, csize );
+
+ madeany = true;
+ }
+
+ ++rulelen;
+
+ if (sf_dot_all())
+ yyval = mkstate( -cclany );
+ else
+ yyval = mkstate( -ccldot );
+ }
+break;
+case 57:
+#line 725 "parse.y"
+ {
+ /* Sort characters for fast searching.
+ */
+ qsort( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]], sizeof (*ccltbl), cclcmp );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]],
+ nextecm, ecgroup, csize, csize );
+
+ ++rulelen;
+
+ if (ccl_has_nl[yystack.l_mark[0]])
+ rule_has_nl[num_rules] = true;
+
+ yyval = mkstate( -yystack.l_mark[0] );
+ }
+break;
+case 58:
+#line 743 "parse.y"
+ {
+ ++rulelen;
+
+ if (ccl_has_nl[yystack.l_mark[0]])
+ rule_has_nl[num_rules] = true;
+
+ yyval = mkstate( -yystack.l_mark[0] );
+ }
+break;
+case 59:
+#line 753 "parse.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 60:
+#line 756 "parse.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 61:
+#line 759 "parse.y"
+ {
+ ++rulelen;
+
+ if (yystack.l_mark[0] == nlch)
+ rule_has_nl[num_rules] = true;
+
+ if (sf_case_ins() && has_case(yystack.l_mark[0]))
+ /* create an alternation, as in (a|A) */
+ yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
+ else
+ yyval = mkstate( yystack.l_mark[0] );
+ }
+break;
+case 62:
+#line 773 "parse.y"
+ { yyval = ccl_set_diff (yystack.l_mark[-2], yystack.l_mark[0]); }
+break;
+case 63:
+#line 774 "parse.y"
+ { yyval = ccl_set_union (yystack.l_mark[-2], yystack.l_mark[0]); }
+break;
+case 65:
+#line 780 "parse.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 66:
+#line 783 "parse.y"
+ {
+ cclnegate( yystack.l_mark[-1] );
+ yyval = yystack.l_mark[-1];
+ }
+break;
+case 67:
+#line 790 "parse.y"
+ {
+
+ if (sf_case_ins())
+ {
+
+ /* If one end of the range has case and the other
+ * does not, or the cases are different, then we're not
+ * sure what range the user is trying to express.
+ * Examples: [@-z] or [S-t]
+ */
+ if (has_case (yystack.l_mark[-2]) != has_case (yystack.l_mark[0])
+ || (has_case (yystack.l_mark[-2]) && (b_islower (yystack.l_mark[-2]) != b_islower (yystack.l_mark[0])))
+ || (has_case (yystack.l_mark[-2]) && (b_isupper (yystack.l_mark[-2]) != b_isupper (yystack.l_mark[0]))))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ yystack.l_mark[-2], yystack.l_mark[0]);
+
+ /* If the range spans uppercase characters but not
+ * lowercase (or vice-versa), then should we automatically
+ * include lowercase characters in the range?
+ * Example: [@-_] spans [a-z] but not [A-Z]
+ */
+ else if (!has_case (yystack.l_mark[-2]) && !has_case (yystack.l_mark[0]) && !range_covers_case (yystack.l_mark[-2], yystack.l_mark[0]))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ yystack.l_mark[-2], yystack.l_mark[0]);
+ }
+
+ if ( yystack.l_mark[-2] > yystack.l_mark[0] )
+ synerr( _("negative range in character class") );
+
+ else
+ {
+ for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
+ ccladd( yystack.l_mark[-3], i );
+
+ /* Keep track if this ccl is staying in
+ * alphabetical order.
+ */
+ cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
+ lastchar = yystack.l_mark[0];
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case(yystack.l_mark[-2]) && has_case(yystack.l_mark[0])){
+ yystack.l_mark[-2] = reverse_case (yystack.l_mark[-2]);
+ yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
+
+ for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
+ ccladd( yystack.l_mark[-3], i );
+
+ cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
+ lastchar = yystack.l_mark[0];
+ }
+
+ }
+
+ yyval = yystack.l_mark[-3];
+ }
+break;
+case 68:
+#line 850 "parse.y"
+ {
+ ccladd( yystack.l_mark[-1], yystack.l_mark[0] );
+ cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
+ lastchar = yystack.l_mark[0];
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case(yystack.l_mark[0])){
+ yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
+ ccladd (yystack.l_mark[-1], yystack.l_mark[0]);
+
+ cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
+ lastchar = yystack.l_mark[0];
+ }
+
+ yyval = yystack.l_mark[-1];
+ }
+break;
+case 69:
+#line 868 "parse.y"
+ {
+ /* Too hard to properly maintain cclsorted. */
+ cclsorted = false;
+ yyval = yystack.l_mark[-1];
+ }
+break;
+case 70:
+#line 875 "parse.y"
+ {
+ cclsorted = true;
+ lastchar = 0;
+ currccl = yyval = cclinit();
+ }
+break;
+case 71:
+#line 883 "parse.y"
+ { CCL_EXPR(isalnum); }
+break;
+case 72:
+#line 884 "parse.y"
+ { CCL_EXPR(isalpha); }
+break;
+case 73:
+#line 885 "parse.y"
+ { CCL_EXPR(IS_BLANK); }
+break;
+case 74:
+#line 886 "parse.y"
+ { CCL_EXPR(iscntrl); }
+break;
+case 75:
+#line 887 "parse.y"
+ { CCL_EXPR(isdigit); }
+break;
+case 76:
+#line 888 "parse.y"
+ { CCL_EXPR(isgraph); }
+break;
+case 77:
+#line 889 "parse.y"
+ {
+ CCL_EXPR(islower);
+ if (sf_case_ins())
+ CCL_EXPR(isupper);
+ }
+break;
+case 78:
+#line 894 "parse.y"
+ { CCL_EXPR(isprint); }
+break;
+case 79:
+#line 895 "parse.y"
+ { CCL_EXPR(ispunct); }
+break;
+case 80:
+#line 896 "parse.y"
+ { CCL_EXPR(isspace); }
+break;
+case 81:
+#line 897 "parse.y"
+ { CCL_EXPR(isxdigit); }
+break;
+case 82:
+#line 898 "parse.y"
+ {
+ CCL_EXPR(isupper);
+ if (sf_case_ins())
+ CCL_EXPR(islower);
+ }
+break;
+case 83:
+#line 904 "parse.y"
+ { CCL_NEG_EXPR(isalnum); }
+break;
+case 84:
+#line 905 "parse.y"
+ { CCL_NEG_EXPR(isalpha); }
+break;
+case 85:
+#line 906 "parse.y"
+ { CCL_NEG_EXPR(IS_BLANK); }
+break;
+case 86:
+#line 907 "parse.y"
+ { CCL_NEG_EXPR(iscntrl); }
+break;
+case 87:
+#line 908 "parse.y"
+ { CCL_NEG_EXPR(isdigit); }
+break;
+case 88:
+#line 909 "parse.y"
+ { CCL_NEG_EXPR(isgraph); }
+break;
+case 89:
+#line 910 "parse.y"
+ { CCL_NEG_EXPR(isprint); }
+break;
+case 90:
+#line 911 "parse.y"
+ { CCL_NEG_EXPR(ispunct); }
+break;
+case 91:
+#line 912 "parse.y"
+ { CCL_NEG_EXPR(isspace); }
+break;
+case 92:
+#line 913 "parse.y"
+ { CCL_NEG_EXPR(isxdigit); }
+break;
+case 93:
+#line 914 "parse.y"
+ {
+ if ( sf_case_ins() )
+ warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(islower);
+ }
+break;
+case 94:
+#line 920 "parse.y"
+ {
+ if ( sf_case_ins() )
+ warn(_("[:^upper:] ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(isupper);
+ }
+break;
+case 95:
+#line 929 "parse.y"
+ {
+ if ( yystack.l_mark[0] == nlch )
+ rule_has_nl[num_rules] = true;
+
+ ++rulelen;
+
+ if (sf_case_ins() && has_case(yystack.l_mark[0]))
+ yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
+ else
+ yyval = mkstate (yystack.l_mark[0]);
+
+ yyval = link_machines( yystack.l_mark[-1], yyval);
+ }
+break;
+case 96:
+#line 944 "parse.y"
+ { yyval = mkstate( SYM_EPSILON ); }
+break;
+#line 1787 "parse.c"
+ }
+ 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 = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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/lex/initparse.h b/usr.bin/lex/initparse.h
new file mode 100644
index 0000000..6ede604
--- /dev/null
+++ b/usr.bin/lex/initparse.h
@@ -0,0 +1,46 @@
+/* $FreeBSD$ */
+#define CHAR 257
+#define NUMBER 258
+#define SECTEND 259
+#define SCDECL 260
+#define XSCDECL 261
+#define NAME 262
+#define PREVCCL 263
+#define EOF_OP 264
+#define OPTION_OP 265
+#define OPT_OUTFILE 266
+#define OPT_PREFIX 267
+#define OPT_YYCLASS 268
+#define OPT_HEADER 269
+#define OPT_EXTRA_TYPE 270
+#define OPT_TABLES 271
+#define CCE_ALNUM 272
+#define CCE_ALPHA 273
+#define CCE_BLANK 274
+#define CCE_CNTRL 275
+#define CCE_DIGIT 276
+#define CCE_GRAPH 277
+#define CCE_LOWER 278
+#define CCE_PRINT 279
+#define CCE_PUNCT 280
+#define CCE_SPACE 281
+#define CCE_UPPER 282
+#define CCE_XDIGIT 283
+#define CCE_NEG_ALNUM 284
+#define CCE_NEG_ALPHA 285
+#define CCE_NEG_BLANK 286
+#define CCE_NEG_CNTRL 287
+#define CCE_NEG_DIGIT 288
+#define CCE_NEG_GRAPH 289
+#define CCE_NEG_LOWER 290
+#define CCE_NEG_PRINT 291
+#define CCE_NEG_PUNCT 292
+#define CCE_NEG_SPACE 293
+#define CCE_NEG_UPPER 294
+#define CCE_NEG_XDIGIT 295
+#define CCL_OP_DIFF 296
+#define CCL_OP_UNION 297
+#define BEGIN_REPEAT_POSIX 298
+#define END_REPEAT_POSIX 299
+#define BEGIN_REPEAT_FLEX 300
+#define END_REPEAT_FLEX 301
diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c
new file mode 100644
index 0000000..58de7eb
--- /dev/null
+++ b/usr.bin/lex/initscan.c
@@ -0,0 +1,5216 @@
+/* $FreeBSD$ */
+
+#line 3 "<stdout>"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 37
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+#if defined(__FreeBSD__)
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+#include <sys/cdefs.h>
+#include <stdint.h>
+#else
+#define __dead2
+#endif
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined(__FreeBSD__) || \
+ (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ yy_size_t yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+#define yy_current_buffer YY_CURRENT_BUFFER
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[] ) __dead2;
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ (yytext_ptr) -= (yy_more_len); \
+ yyleng = (size_t) (yy_cp - (yytext_ptr)); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 251
+#define YY_END_OF_BUFFER 252
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_acclist[1223] =
+ { 0,
+ 248, 248, 252, 250, 251, 9, 250, 251, 20, 250,
+ 251, 250, 251, 18, 250, 251, 1, 9, 250, 251,
+ 19, 20, 250, 251, 250, 251, 250, 251, 250, 251,
+ 250, 251, 17, 18, 250, 251, 164, 250, 251, 149,
+ 164, 250, 251, 150, 250, 251, 164, 250, 251, 142,
+ 164, 250, 251, 164, 250, 251, 161, 163, 164, 250,
+ 251, 162, 163, 164, 250, 251, 163, 164, 250, 251,
+ 163, 164, 250, 251, 164, 250, 251, 164, 250, 251,
+ 164, 250, 251, 163, 164, 250, 251, 148, 149, 164,
+ 250, 251, 138, 150, 250, 251, 164, 250, 251, 164,
+
+ 250, 251, 140, 164, 250, 251, 141, 164, 250, 251,
+ 136, 250, 251, 137, 250, 251, 136, 250, 251, 135,
+ 136, 250, 251, 134, 136, 250, 251, 135, 136, 250,
+ 251, 248, 249, 250, 251, 248, 249, 250, 251, 249,
+ 250, 251, 249, 250, 251, 41, 250, 251, 42, 250,
+ 251, 41, 250, 251, 41, 250, 251, 41, 250, 251,
+ 41, 250, 251, 41, 250, 251, 41, 250, 251, 50,
+ 250, 251, 49, 250, 251, 51, 250, 251, 250, 251,
+ 170, 250, 251, 170, 250, 251, 165, 250, 251, 170,
+ 250, 251, 166, 170, 250, 251, 167, 170, 250, 251,
+
+ 169, 170, 250, 251, 171, 250, 251, 219, 250, 251,
+ 220, 250, 251, 219, 250, 251, 217, 219, 250, 251,
+ 216, 219, 250, 251, 218, 219, 250, 251, 172, 250,
+ 251, 174, 250, 251, 172, 250, 251, 173, 250, 251,
+ 172, 250, 251, 186, 250, 251, 186, 250, 251, 186,
+ 250, 251, 186, 250, 251, 188, 190, 250, 251, 190,
+ 250, 251, 188, 190, 250, 251, 188, 190, 250, 251,
+ 188, 190, 250, 251, 188, 190, 250, 251, 189, 190,
+ 250, 251, 233, 239, 250, 251, 238, 250, 251, 233,
+ 239, 250, 251, 237, 239, 250, 251, 239, 250, 251,
+
+ 239, 250, 251, 235, 239, 250, 251, 235, 239, 250,
+ 251, 235, 239, 250, 251, 234, 239, 250, 251, 234,
+ 239, 250, 251, 229, 239, 250, 251, 230, 239, 250,
+ 251, 250, 251, 131, 250, 251, 250, 251, 25, 250,
+ 251, 26, 250, 251, 25, 250, 251, 22, 250, 251,
+ 25, 250, 251, 25, 250, 251, 240, 244, 250, 251,
+ 242, 250, 251, 240, 244, 250, 251, 243, 244, 250,
+ 251, 244, 250, 251, 227, 250, 251, 227, 250, 251,
+ 228, 250, 251, 227, 250, 251, 227, 250, 251, 227,
+ 250, 251, 227, 250, 251, 227, 250, 251, 227, 250,
+
+ 251, 227, 250, 251, 130, 250, 251, 53, 130, 250,
+ 251, 52, 250, 251, 130, 250, 251, 130, 250, 251,
+ 130, 250, 251, 130, 250, 251, 54, 130, 250, 251,
+ 130, 250, 251, 130, 250, 251, 130, 250, 251, 130,
+ 250, 251, 130, 250, 251, 130, 250, 251, 130, 250,
+ 251, 130, 250, 251, 130, 250, 251, 130, 250, 251,
+ 130, 250, 251, 130, 250, 251, 130, 250, 251, 130,
+ 250, 251, 130, 250, 251, 130, 250, 251, 130, 250,
+ 251, 130, 250, 251, 130, 250, 251, 130, 250, 251,
+ 130, 250, 251, 37, 250, 251, 34, 250, 251, 37,
+
+ 250, 251, 35, 37, 250, 251, 48, 250, 251, 45,
+ 250, 251, 250, 251, 48, 250, 251, 48, 250, 251,
+ 44, 250, 251, 43, 250, 251, 176, 250, 251, 175,
+ 250, 251, 177, 250, 251, 178, 250, 251, 179, 250,
+ 251, 180, 250, 251, 181, 250, 251, 182, 250, 251,
+ 183, 250, 251, 32, 250, 251, 33, 250, 251, 32,
+ 250, 251, 31, 250, 251, 29, 250, 251, 30, 250,
+ 251, 29, 250, 251, 28, 250, 251, 9, 20, 18,
+ 1, 9, 19, 20, 16, 10, 16, 4, 16, 5,
+ 2, 17, 18, 149, 150, 144, 160, 158, 154, 154,
+
+ 245, 245, 245, 143, 148, 149, 138, 150, 140, 141,
+ 153, 139, 137, 135, 134, 134, 132, 135, 133, 135,
+ 248, 248, 246, 247, 42, 39, 40, 50, 49, 51,
+ 165, 165, 168, 169, 220, 216, 174, 184, 185, 190,
+ 187, 233, 238, 236, 222, 235, 235, 235, 231, 232,
+ 131, 26, 21, 23, 24, 240, 242, 241, 228, 221,
+ 225, 226, 53, 52, 129, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 55, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 36, 35, 45,
+
+ 46, 47, 32, 33, 30, 27, 16, 10, 16, 14,
+ 4, 16, 5, 6, 145, 146, 159, 154, 154, 154,
+ 154, 154, 245, 245, 156, 155, 157, 139, 145, 147,
+ 153, 132, 135, 133, 135, 38, 235, 235, 221, 130,
+ 130, 130, 130, 130, 130, 130, 67, 130, 130, 130,
+ 130, 72, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 14, 15, 4,
+ 8, 16, 5, 154, 154, 154, 154, 154, 154, 154,
+
+ 245, 157, 235, 235, 56, 57, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 73, 130, 74,
+ 130, 130, 130, 130, 130, 79, 130, 130, 130, 130,
+ 130, 130, 130, 130, 84, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 93, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 15, 8, 16, 8,
+ 16, 8, 16, 154, 154, 154, 154, 154, 154, 154,
+ 215, 235, 235, 58, 130, 130, 130, 60, 130, 130,
+ 64, 130, 130, 130, 130, 130, 70, 130, 130, 130,
+ 130, 75, 130, 130, 130, 130, 130, 130, 130, 130,
+
+ 130, 130, 130, 130, 87, 130, 130, 130, 130, 130,
+ 91, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 3, 8, 16, 7, 8, 16, 154, 154,
+ 154, 223, 224, 223, 235, 224, 235, 130, 130, 130,
+ 63, 130, 130, 130, 130, 130, 130, 130, 130, 126,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 124,
+ 130, 130, 86, 130, 130, 89, 130, 130, 90, 130,
+ 130, 130, 130, 105, 130, 130, 95, 130, 130, 96,
+ 130, 12, 13, 152, 151, 152, 130, 130, 130, 130,
+ 130, 130, 130, 68, 130, 130, 71, 130, 130, 130,
+
+ 130, 130, 130, 130, 123, 130, 130, 83, 130, 130,
+ 130, 88, 130, 130, 92, 130, 103, 130, 125, 130,
+ 130, 130, 151, 130, 130, 130, 130, 130, 130, 130,
+ 69, 130, 130, 130, 130, 130, 80, 130, 130, 130,
+ 130, 130, 130, 130, 114, 94, 130, 130, 115, 11,
+ 191, 215, 192, 215, 193, 215, 194, 215, 195, 215,
+ 196, 215, 197, 215, 198, 215, 199, 215, 200, 215,
+ 201, 215, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 85, 130, 130, 130,
+ 116, 104, 130, 117, 202, 215, 203, 215, 204, 215,
+
+ 205, 215, 206, 215, 207, 215, 208, 215, 209, 215,
+ 210, 215, 211, 215, 212, 215, 213, 215, 130, 130,
+ 130, 130, 130, 130, 130, 122, 130, 130, 130, 77,
+ 130, 130, 130, 130, 130, 130, 110, 120, 118, 111,
+ 121, 119, 214, 215, 130, 130, 130, 130, 130, 130,
+ 130, 126, 130, 76, 130, 130, 82, 130, 130, 127,
+ 130, 130, 106, 108, 107, 109, 130, 130, 130, 65,
+ 130, 130, 130, 130, 130, 78, 130, 130, 112, 113,
+ 98, 99, 130, 130, 130, 130, 130, 130, 130, 128,
+ 130, 97, 101, 130, 130, 130, 130, 130, 68, 130,
+
+ 130, 100, 102, 130, 130, 62, 130, 66, 130, 130,
+ 130, 130, 61, 130, 69, 130, 130, 130, 81, 130,
+ 59, 130
+ } ;
+
+static yyconst flex_int16_t yy_accept[1108] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 2, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
+ 6, 9, 12, 14, 17, 21, 25, 27, 29, 31,
+ 33, 37, 40, 44, 47, 50, 54, 57, 62, 67,
+ 71, 75, 78, 81, 84, 88, 93, 97, 100, 103,
+ 107, 111, 114, 117, 120, 124, 128, 132, 136, 140,
+ 143, 146, 149, 152, 155, 158, 161, 164, 167, 170,
+
+ 173, 176, 179, 181, 184, 187, 190, 193, 197, 201,
+ 205, 208, 211, 214, 217, 221, 225, 229, 232, 235,
+ 238, 241, 244, 247, 250, 253, 256, 260, 263, 267,
+ 271, 275, 279, 283, 287, 290, 294, 298, 301, 304,
+ 308, 312, 316, 320, 324, 328, 332, 334, 337, 339,
+ 342, 345, 348, 351, 354, 357, 361, 364, 368, 372,
+ 375, 378, 381, 384, 387, 390, 393, 396, 399, 402,
+ 405, 408, 412, 415, 418, 421, 424, 427, 431, 434,
+ 437, 440, 443, 446, 449, 452, 455, 458, 461, 464,
+ 467, 470, 473, 476, 479, 482, 485, 488, 491, 494,
+
+ 497, 500, 503, 507, 510, 513, 515, 518, 521, 524,
+ 527, 530, 533, 536, 539, 542, 545, 548, 551, 554,
+ 557, 560, 563, 566, 569, 572, 575, 578, 579, 580,
+ 580, 581, 583, 585, 585, 585, 585, 586, 588, 588,
+ 588, 588, 588, 589, 590, 591, 591, 592, 594, 595,
+ 596, 596, 596, 596, 597, 597, 598, 599, 599, 600,
+ 601, 601, 602, 603, 604, 604, 604, 605, 605, 607,
+ 609, 609, 609, 609, 610, 611, 612, 613, 613, 614,
+ 615, 616, 617, 619, 621, 622, 623, 624, 625, 626,
+ 626, 626, 627, 628, 628, 629, 630, 631, 631, 632,
+
+ 632, 633, 634, 635, 636, 637, 638, 638, 639, 640,
+ 641, 642, 643, 644, 644, 645, 645, 646, 647, 648,
+ 649, 650, 651, 651, 652, 652, 653, 654, 655, 656,
+ 657, 658, 659, 659, 659, 660, 661, 662, 663, 664,
+ 665, 665, 666, 666, 666, 667, 668, 669, 670, 671,
+ 672, 673, 674, 675, 676, 677, 678, 679, 680, 681,
+ 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ 692, 693, 694, 695, 696, 697, 698, 698, 699, 700,
+ 701, 702, 703, 704, 705, 706, 707, 707, 708, 710,
+ 710, 711, 711, 711, 711, 711, 711, 712, 713, 714,
+
+ 714, 715, 715, 716, 716, 717, 717, 718, 718, 719,
+ 720, 720, 721, 722, 723, 724, 725, 726, 727, 727,
+ 728, 730, 731, 731, 732, 732, 734, 736, 736, 736,
+ 736, 737, 737, 737, 737, 737, 737, 737, 737, 737,
+ 737, 737, 737, 737, 737, 738, 739, 740, 740, 740,
+ 741, 742, 743, 744, 745, 746, 747, 749, 750, 751,
+ 752, 754, 755, 756, 757, 758, 759, 760, 761, 762,
+ 763, 764, 765, 766, 767, 768, 769, 770, 771, 772,
+ 773, 774, 775, 776, 777, 778, 779, 780, 781, 782,
+ 783, 784, 785, 786, 787, 788, 788, 788, 788, 788,
+
+ 790, 790, 790, 790, 790, 790, 790, 791, 793, 794,
+ 794, 795, 796, 797, 798, 799, 800, 801, 802, 803,
+ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803,
+ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803,
+ 803, 803, 803, 803, 803, 803, 804, 805, 806, 807,
+ 808, 809, 810, 811, 812, 813, 814, 815, 816, 817,
+ 818, 820, 822, 823, 824, 825, 826, 828, 829, 830,
+ 831, 832, 833, 834, 835, 837, 838, 839, 840, 841,
+ 842, 843, 844, 845, 846, 848, 849, 850, 851, 852,
+ 853, 854, 855, 856, 857, 857, 857, 857, 857, 858,
+
+ 858, 858, 858, 858, 858, 860, 862, 864, 864, 865,
+ 866, 867, 868, 869, 870, 871, 871, 871, 871, 871,
+ 872, 872, 872, 872, 872, 872, 872, 872, 872, 872,
+ 872, 872, 872, 872, 872, 872, 872, 872, 872, 872,
+ 872, 872, 872, 872, 873, 874, 876, 877, 878, 880,
+ 881, 883, 884, 885, 886, 887, 889, 890, 891, 892,
+ 894, 895, 896, 897, 898, 899, 900, 901, 902, 903,
+ 904, 905, 907, 908, 909, 910, 911, 913, 914, 915,
+ 916, 917, 918, 919, 920, 921, 922, 923, 923, 923,
+ 923, 923, 924, 924, 924, 924, 926, 927, 929, 929,
+
+ 930, 931, 932, 932, 932, 933, 934, 934, 934, 934,
+ 934, 934, 934, 934, 934, 934, 934, 934, 934, 934,
+ 934, 934, 934, 934, 934, 934, 934, 934, 934, 934,
+ 934, 936, 938, 939, 940, 941, 943, 944, 945, 946,
+ 947, 948, 949, 950, 952, 953, 954, 955, 956, 957,
+ 958, 959, 960, 962, 963, 965, 966, 968, 969, 971,
+ 972, 973, 974, 976, 976, 977, 979, 980, 980, 982,
+ 982, 982, 982, 982, 982, 983, 983, 984, 984, 985,
+ 985, 987, 987, 987, 987, 987, 987, 987, 987, 987,
+ 987, 987, 987, 987, 987, 987, 987, 987, 987, 987,
+
+ 987, 987, 987, 987, 987, 987, 988, 989, 990, 991,
+ 992, 993, 994, 996, 997, 999, 1000, 1001, 1002, 1003,
+ 1004, 1005, 1007, 1008, 1010, 1011, 1012, 1014, 1015, 1017,
+ 1019, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1022, 1023,
+ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
+ 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
+ 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
+ 1024, 1024, 1024, 1024, 1024, 1025, 1026, 1027, 1028, 1029,
+ 1030, 1031, 1033, 1034, 1035, 1036, 1037, 1039, 1040, 1041,
+ 1042, 1043, 1044, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
+
+ 1046, 1046, 1046, 1048, 1049, 1049, 1049, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1051, 1051, 1053,
+ 1055, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1073,
+ 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
+ 1073, 1073, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080,
+ 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1090, 1091,
+ 1091, 1091, 1091, 1091, 1091, 1091, 1092, 1092, 1094, 1094,
+ 1094, 1094, 1094, 1094, 1095, 1095, 1095, 1095, 1095, 1095,
+ 1097, 1099, 1101, 1103, 1105, 1107, 1109, 1111, 1113, 1115,
+ 1117, 1119, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126,
+
+ 1128, 1129, 1130, 1132, 1133, 1134, 1135, 1136, 1137, 1137,
+ 1137, 1138, 1138, 1139, 1140, 1141, 1141, 1141, 1141, 1142,
+ 1143, 1143, 1143, 1143, 1143, 1143, 1143, 1145, 1146, 1147,
+ 1148, 1149, 1150, 1151, 1152, 1154, 1156, 1157, 1159, 1160,
+ 1162, 1163, 1164, 1165, 1165, 1166, 1167, 1167, 1167, 1167,
+ 1167, 1167, 1167, 1167, 1168, 1169, 1170, 1172, 1173, 1174,
+ 1175, 1176, 1178, 1179, 1180, 1181, 1182, 1182, 1182, 1182,
+ 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1192,
+ 1193, 1193, 1194, 1194, 1195, 1196, 1197, 1198, 1199, 1201,
+ 1202, 1203, 1204, 1205, 1206, 1208, 1210, 1211, 1212, 1213,
+
+ 1215, 1217, 1218, 1219, 1221, 1223, 1223
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 4, 4, 5, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 6, 7, 8, 9, 1, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 19, 19,
+ 19, 19, 19, 19, 20, 21, 22, 23, 1, 24,
+ 25, 26, 27, 1, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 44,
+ 53, 54, 55, 56, 57, 1, 58, 59, 60, 61,
+
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 44, 74, 75, 76, 77, 78, 79, 80,
+ 81, 44, 82, 83, 84, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[85] =
+ { 0,
+ 1, 1, 2, 1, 3, 4, 1, 1, 1, 5,
+ 1, 6, 1, 7, 1, 8, 1, 5, 9, 9,
+ 9, 9, 10, 1, 1, 1, 1, 11, 11, 11,
+ 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 13, 14, 15, 1, 16, 11, 11, 11,
+ 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 5, 1, 17
+ } ;
+
+static yyconst flex_int16_t yy_base[1201] =
+ { 0,
+ 0, 84, 167, 250, 171, 184, 174, 179, 192, 233,
+ 196, 200, 334, 0, 3343, 3340, 203, 416, 206, 211,
+ 187, 216, 276, 417, 500, 0, 210, 223, 421, 427,
+ 436, 440, 583, 588, 669, 0, 277, 299, 584, 751,
+ 579, 580, 576, 732, 279, 305, 310, 444, 3378, 3975,
+ 228, 3975, 3371, 0, 322, 3975, 3358, 423, 827, 3328,
+ 0, 3975, 755, 3975, 3337, 3975, 448, 3312, 3975, 3975,
+ 3323, 3291, 222, 408, 444, 764, 3975, 3311, 230, 3289,
+ 3975, 3975, 3975, 3306, 0, 3306, 164, 3304, 3975, 3236,
+ 3217, 3975, 3975, 3266, 239, 119, 3215, 3212, 3180, 0,
+
+ 3248, 3975, 3243, 3975, 476, 3227, 3222, 3975, 3168, 0,
+ 3975, 3975, 3975, 3203, 3975, 464, 3975, 3975, 3975, 3186,
+ 3975, 742, 3975, 3161, 751, 180, 3975, 3975, 3171, 0,
+ 3149, 757, 3975, 0, 3975, 3149, 3975, 200, 3138, 0,
+ 429, 241, 3097, 3092, 3975, 3975, 306, 3975, 323, 3975,
+ 3975, 3126, 3108, 3072, 3069, 0, 3975, 3115, 3975, 0,
+ 3975, 446, 3975, 3114, 3031, 3098, 435, 371, 3045, 3026,
+ 3975, 3076, 3975, 3074, 3070, 439, 440, 3975, 578, 751,
+ 586, 562, 735, 752, 0, 572, 577, 588, 786, 749,
+ 396, 809, 727, 582, 747, 753, 764, 769, 580, 3975,
+
+ 3975, 3067, 588, 3975, 3975, 3053, 3002, 2996, 3975, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 0,
+ 3975, 3046, 3975, 3975, 3975, 3018, 2986, 837, 3975, 2998,
+ 0, 847, 3975, 2997, 817, 777, 0, 0, 891, 903,
+ 912, 924, 0, 774, 0, 451, 3975, 0, 858, 3975,
+ 2996, 2914, 472, 3975, 2974, 2953, 3975, 791, 236, 822,
+ 899, 3975, 275, 0, 2873, 2872, 3975, 2871, 949, 3975,
+ 2949, 2850, 2918, 2906, 3975, 0, 3975, 796, 3975, 0,
+ 0, 2925, 0, 0, 2597, 3975, 3975, 3975, 3975, 795,
+ 794, 3975, 3975, 484, 0, 2597, 3975, 877, 2596, 2594,
+
+ 2594, 3975, 0, 3975, 918, 3975, 1005, 3975, 3975, 3975,
+ 3975, 0, 3975, 611, 3975, 0, 3975, 0, 853, 851,
+ 3975, 3975, 490, 3975, 608, 3975, 3975, 3975, 3975, 0,
+ 3975, 3975, 596, 2510, 3975, 0, 3975, 3975, 2588, 3975,
+ 2581, 3975, 894, 906, 0, 911, 717, 727, 923, 728,
+ 2571, 882, 930, 889, 902, 916, 917, 940, 928, 923,
+ 940, 933, 0, 932, 3975, 935, 939, 951, 956, 1059,
+ 964, 965, 1052, 955, 957, 1099, 2578, 3975, 1078, 3975,
+ 3975, 3975, 0, 3975, 3975, 3975, 987, 0, 0, 1087,
+ 3975, 2576, 1132, 985, 1046, 1058, 0, 1058, 0, 1009,
+
+ 3975, 1016, 3975, 1057, 3975, 1099, 3975, 1068, 731, 1088,
+ 1095, 1178, 1244, 1280, 988, 0, 3975, 3975, 2492, 1162,
+ 3975, 3975, 1081, 0, 1086, 0, 0, 1098, 1105, 1100,
+ 3975, 1167, 1245, 1246, 1247, 1250, 2539, 1248, 1249, 1258,
+ 1244, 1251, 1259, 1321, 1233, 1224, 0, 1072, 1228, 1243,
+ 1261, 1287, 1298, 1289, 1298, 1287, 0, 1299, 1228, 1308,
+ 0, 1280, 1298, 1307, 1316, 1314, 1316, 2532, 1322, 1337,
+ 1338, 1340, 1342, 1342, 1348, 1353, 1356, 1347, 1357, 1362,
+ 1366, 1358, 1353, 1356, 1377, 1366, 1370, 1371, 1367, 1383,
+ 1384, 1379, 1391, 1392, 1381, 1388, 1397, 1275, 1455, 3975,
+
+ 1439, 1463, 1444, 1415, 1412, 1415, 0, 1409, 0, 1429,
+ 1492, 1558, 1594, 1524, 2449, 1564, 1639, 3975, 3975, 1537,
+ 1556, 1560, 1407, 2427, 1558, 1563, 1559, 1564, 1572, 1584,
+ 1574, 1562, 1615, 1619, 1609, 1625, 1626, 1643, 1614, 1651,
+ 1662, 1658, 1664, 1665, 1616, 1616, 1637, 3975, 3975, 1638,
+ 1631, 2352, 1634, 1641, 1655, 1650, 1677, 1679, 1671, 1689,
+ 0, 0, 1690, 1677, 1681, 1697, 0, 2348, 1684, 1694,
+ 2274, 1686, 1685, 1695, 0, 1692, 1711, 1704, 1703, 1701,
+ 1713, 1703, 1704, 1712, 0, 1717, 1731, 1731, 1719, 1723,
+ 1722, 1741, 1726, 1742, 1734, 1747, 1741, 2241, 3975, 1464,
+
+ 1485, 1729, 1743, 1740, 0, 1721, 1591, 2173, 1585, 2139,
+ 1771, 1807, 1417, 962, 1426, 1755, 2049, 1745, 1769, 3975,
+ 1774, 1782, 1789, 1775, 1796, 1791, 1810, 1800, 1820, 1822,
+ 1821, 1823, 1832, 1831, 1838, 1840, 1853, 1856, 1854, 1855,
+ 1863, 1865, 1861, 1846, 1862, 0, 1853, 1864, 0, 1857,
+ 0, 2008, 1866, 1862, 1869, 0, 1874, 1893, 1870, 0,
+ 1888, 1875, 1886, 1882, 1880, 1878, 1897, 1876, 1882, 1889,
+ 1889, 0, 1904, 1895, 1899, 1919, 0, 1907, 1909, 1908,
+ 1923, 1791, 1924, 1925, 1919, 1747, 1917, 1918, 1918, 1938,
+ 1924, 1726, 1599, 1927, 1937, 1970, 3975, 1702, 1652, 1923,
+
+ 1755, 1941, 1625, 1618, 3975, 3975, 1961, 1977, 1966, 1969,
+ 1956, 1979, 1983, 1986, 1989, 1984, 1992, 1987, 1994, 1990,
+ 1988, 1995, 2007, 2004, 2016, 2022, 1996, 2028, 2018, 2026,
+ 0, 0, 1620, 1990, 2009, 0, 2035, 2020, 2035, 2029,
+ 2024, 2025, 2029, 1589, 2049, 2041, 2052, 2048, 2053, 2054,
+ 2044, 2057, 0, 2064, 0, 2048, 0, 1576, 0, 2064,
+ 2070, 2056, 0, 2096, 2062, 0, 2067, 2108, 0, 1531,
+ 2072, 2078, 1438, 1853, 3975, 2105, 3975, 2068, 3975, 1463,
+ 3975, 1407, 1402, 1348, 1345, 1314, 1307, 1269, 1260, 1256,
+ 1210, 1158, 2106, 2111, 2097, 2118, 2122, 2129, 2125, 2140,
+
+ 2131, 2136, 2141, 2143, 2156, 2131, 2138, 2147, 2101, 2151,
+ 2138, 2153, 0, 2141, 0, 2144, 2165, 2153, 2159, 2158,
+ 2165, 0, 2165, 0, 2167, 2169, 0, 2178, 0, 0,
+ 0, 2183, 2167, 2179, 2210, 2178, 2189, 2188, 2189, 2202,
+ 2186, 2194, 2218, 2196, 2202, 1119, 1114, 2206, 2118, 3975,
+ 1106, 1100, 1081, 1068, 1065, 1061, 1057, 972, 968, 965,
+ 914, 925, 893, 881, 874, 869, 865, 861, 854, 843,
+ 807, 802, 776, 2235, 2212, 2226, 2221, 2227, 2239, 2238,
+ 2228, 0, 2228, 2239, 2242, 2252, 0, 2238, 2244, 2249,
+ 2244, 2258, 2263, 2269, 2255, 3975, 2263, 2265, 2265, 2281,
+
+ 2265, 2262, 0, 2285, 2288, 2274, 3975, 2277, 2280, 2295,
+ 2279, 2280, 2283, 2303, 2283, 2330, 3975, 2335, 3975, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 735,
+ 612, 608, 598, 441, 374, 261, 245, 202, 152, 149,
+ 137, 165, 2296, 2303, 2304, 2320, 2326, 2316, 2324, 2329,
+ 2324, 2316, 2319, 2335, 2324, 2327, 0, 2332, 2328, 2327,
+ 2332, 2345, 2348, 2352, 2344, 3975, 2338, 0, 2338, 2343,
+ 2357, 2362, 2357, 3975, 2371, 2356, 2359, 2358, 2380, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975,
+ 3975, 128, 2384, 2382, 2373, 2387, 2376, 2378, 2378, 0,
+
+ 2395, 2396, 0, 2385, 2384, 2405, 2403, 2401, 2405, 2413,
+ 3975, 2401, 3975, 3975, 3975, 2409, 2416, 2404, 3975, 3975,
+ 2400, 2422, 2422, 2414, 2417, 2417, 3975, 2421, 2421, 2418,
+ 2424, 2441, 2442, 2443, 0, 0, 2453, 0, 2436, 0,
+ 2451, 3975, 3975, 2445, 3975, 3975, 2446, 2457, 2445, 2461,
+ 2464, 2462, 2468, 2473, 2466, 2460, 0, 2462, 2459, 2461,
+ 2483, 0, 2463, 3975, 3975, 3975, 2484, 2488, 2476, 2482,
+ 3975, 2495, 2485, 2497, 2495, 2501, 2506, 2493, 0, 3975,
+ 2496, 3975, 2508, 2498, 2506, 2503, 2506, 2505, 0, 2520,
+ 3975, 3975, 2522, 2514, 0, 0, 2529, 2514, 2515, 0,
+
+ 0, 2533, 2539, 0, 0, 3975, 2601, 2618, 2635, 2652,
+ 2669, 2686, 2703, 2720, 2737, 2754, 2771, 2788, 2805, 2822,
+ 2839, 2856, 2873, 2890, 2907, 2917, 2933, 2942, 2958, 2975,
+ 2986, 3002, 3019, 3036, 3053, 3063, 3079, 3096, 3113, 3127,
+ 3137, 3153, 3170, 3187, 3204, 3215, 2009, 3227, 3244, 3254,
+ 3270, 3287, 3294, 3300, 3316, 3326, 3342, 3359, 3376, 2564,
+ 3386, 3403, 3420, 3437, 3454, 3471, 3488, 3505, 3522, 3532,
+ 3548, 3562, 3572, 3588, 3605, 3622, 3639, 3650, 3662, 3679,
+ 3696, 3713, 3730, 3740, 3749, 3765, 3782, 3799, 2571, 3809,
+ 3826, 3843, 3860, 3877, 3885, 3890, 3906, 3923, 3940, 3957
+
+ } ;
+
+static yyconst flex_int16_t yy_def[1201] =
+ { 0,
+ 1106, 1106, 1107, 1107, 1108, 1109, 1110, 1110, 1111, 1111,
+ 1112, 1112, 1106, 13, 1113, 1113, 1114, 1114, 1115, 1115,
+ 1116, 1116, 1117, 1117, 1106, 25, 1118, 1118, 1119, 1119,
+ 1120, 1120, 1121, 1121, 1106, 35, 1122, 1122, 1123, 1123,
+ 1113, 1113, 1113, 1113, 1124, 1124, 1125, 1125, 1106, 1106,
+ 1106, 1106, 1106, 1126, 1106, 1106, 1106, 1106, 1127, 1106,
+ 1128, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1129, 1130, 1131, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1132, 1133, 1132, 1134, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1135,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1136,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1130, 1106, 1106, 1130, 1137, 1106, 1106, 1106, 1138,
+ 1106, 1130, 1106, 1139, 1106, 1139, 1106, 1140, 1106, 1141,
+ 1141, 1141, 1106, 1106, 1106, 1106, 1142, 1106, 1142, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1143, 1106, 1143, 1106, 1144,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1145, 1106, 1106, 1106, 1146, 1146,
+ 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1147,
+ 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1106,
+
+ 1106, 1148, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1149,
+ 1106, 1149, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1150, 1106, 1106, 1106, 1106, 1106, 1151, 1152, 1106, 1106,
+ 1106, 1106, 1153, 1151, 1154, 1155, 1106, 1156, 1106, 1106,
+ 1106, 1106, 1157, 1106, 1106, 1106, 1106, 1106, 1158, 1158,
+ 1159, 1106, 1106, 1160, 1106, 1106, 1106, 1161, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1162, 1106, 1106, 1106, 1163,
+ 1164, 1164, 1165, 1166, 1167, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1168, 1169, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1170, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1171, 1106, 1172, 1106, 1172, 1106, 1173, 1173, 1173,
+ 1106, 1106, 1174, 1106, 1174, 1106, 1106, 1106, 1106, 1175,
+ 1106, 1106, 1106, 1106, 1106, 1176, 1106, 1106, 1106, 1106,
+ 1177, 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1106, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1179, 1106, 1106, 1106,
+ 1106, 1106, 1180, 1106, 1106, 1106, 1106, 1181, 1182, 1183,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1184, 1181, 1185, 1186,
+
+ 1106, 1186, 1106, 1187, 1106, 1187, 1106, 1106, 1188, 1188,
+ 1188, 1106, 1188, 1188, 1106, 1189, 1106, 1106, 1190, 1106,
+ 1106, 1106, 1106, 1191, 1106, 1192, 1193, 1106, 1106, 1194,
+ 1106, 1194, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1196, 1196, 1197, 1106, 1106, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1106, 1106, 1183, 1183, 1106,
+
+ 1183, 1183, 1106, 1106, 1106, 1106, 1184, 1198, 1185, 1106,
+ 1106, 1188, 414, 412, 412, 1188, 414, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1196, 1196, 1106, 1106, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1183,
+
+ 1183, 1106, 1106, 1106, 1198, 1198, 1198, 1106, 511, 511,
+ 1188, 414, 1188, 1188, 1188, 1106, 1106, 1106, 1106, 1106,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1196, 1196, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106, 1106, 1106,
+ 1106, 1106, 1199, 1106, 1106, 1198, 1106, 1198, 1106, 1188,
+
+ 1188, 1188, 1106, 1106, 1106, 1106, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1196, 1196, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1178, 1178, 1178, 1106, 1178, 1106,
+ 1106, 1106, 1106, 1199, 1106, 1199, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+
+ 1195, 1195, 1195, 1195, 1195, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1200, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1200, 1106, 1200, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+
+ 1178, 1178, 1178, 1178, 1178, 0, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+
+ } ;
+
+static yyconst flex_int16_t yy_nxt[4060] =
+ { 0,
+ 50, 51, 52, 50, 53, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 50, 50, 50, 50, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 50, 50, 50, 50, 55, 56, 50, 57, 50,
+ 58, 50, 59, 50, 50, 50, 50, 50, 50, 50,
+
+ 50, 60, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 50, 50, 50, 50,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 50, 50, 50, 63, 64,
+ 291, 65, 66, 83, 67, 84, 89, 68, 69, 70,
+ 70, 89, 1027, 70, 71, 86, 83, 992, 84, 50,
+ 72, 991, 87, 70, 93, 309, 94, 101, 102, 291,
+
+ 103, 101, 102, 990, 103, 113, 989, 114, 119, 315,
+ 120, 121, 148, 119, 149, 120, 121, 115, 50, 73,
+ 74, 116, 116, 116, 116, 148, 90, 149, 91, 228,
+ 229, 90, 230, 91, 309, 93, 95, 94, 276, 124,
+ 125, 99, 126, 96, 97, 283, 98, 284, 75, 70,
+ 70, 76, 77, 316, 78, 66, 988, 67, 79, 122,
+ 68, 69, 70, 70, 122, 95, 70, 71, 124, 125,
+ 290, 126, 96, 80, 260, 261, 70, 95, 128, 201,
+ 129, 221, 202, 222, 96, 97, 117, 98, 410, 411,
+ 223, 130, 320, 415, 415, 203, 203, 203, 203, 987,
+
+ 290, 201, 73, 74, 202, 81, 95, 221, 324, 222,
+ 325, 277, 225, 96, 226, 986, 223, 203, 203, 203,
+ 203, 320, 227, 232, 233, 324, 234, 325, 131, 132,
+ 133, 75, 70, 70, 104, 105, 106, 104, 107, 104,
+ 104, 104, 104, 104, 104, 104, 108, 104, 108, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 109,
+ 104, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 104, 104, 104, 104,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 104, 104, 104, 113, 128,
+ 114, 129, 291, 151, 235, 152, 263, 263, 985, 151,
+ 115, 152, 130, 153, 116, 116, 116, 116, 157, 153,
+ 158, 159, 157, 366, 158, 159, 225, 333, 226, 254,
+ 254, 291, 255, 401, 334, 402, 227, 265, 264, 266,
+ 319, 236, 267, 267, 267, 267, 290, 343, 344, 131,
+ 132, 133, 366, 154, 405, 155, 406, 298, 299, 154,
+ 300, 155, 305, 305, 305, 305, 431, 264, 432, 160,
+ 319, 236, 324, 160, 325, 984, 290, 343, 344, 117,
+
+ 134, 134, 135, 134, 136, 137, 134, 134, 134, 138,
+ 134, 134, 134, 134, 134, 134, 134, 139, 134, 134,
+ 134, 134, 134, 134, 134, 134, 134, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 141, 140, 140, 140, 140, 140,
+ 140, 142, 143, 134, 144, 134, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 141, 140, 140, 140, 140, 140, 140,
+ 142, 145, 134, 146, 162, 163, 205, 164, 206, 162,
+ 163, 165, 164, 353, 211, 211, 165, 333, 216, 351,
+
+ 166, 212, 212, 358, 334, 166, 379, 379, 379, 379,
+ 324, 217, 325, 352, 213, 213, 346, 359, 347, 360,
+ 315, 218, 348, 353, 214, 214, 219, 167, 371, 215,
+ 215, 376, 167, 358, 168, 169, 207, 170, 208, 168,
+ 169, 217, 170, 352, 213, 213, 346, 359, 347, 360,
+ 218, 348, 983, 214, 214, 219, 167, 371, 215, 215,
+ 376, 167, 982, 168, 316, 209, 981, 210, 168, 171,
+ 172, 173, 171, 174, 175, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 176, 177,
+ 171, 171, 171, 178, 171, 171, 179, 180, 181, 182,
+
+ 183, 184, 185, 186, 187, 185, 185, 188, 189, 190,
+ 191, 192, 185, 193, 194, 195, 196, 197, 198, 185,
+ 199, 171, 171, 171, 171, 171, 179, 180, 181, 182,
+ 183, 184, 185, 186, 187, 185, 185, 188, 189, 190,
+ 191, 192, 193, 194, 195, 196, 197, 198, 185, 199,
+ 171, 171, 171, 205, 216, 206, 249, 250, 370, 251,
+ 263, 263, 452, 252, 354, 269, 270, 217, 271, 263,
+ 263, 453, 272, 456, 372, 263, 263, 218, 349, 356,
+ 364, 273, 219, 410, 411, 355, 350, 274, 370, 980,
+ 365, 452, 264, 373, 354, 374, 375, 217, 941, 357,
+
+ 453, 264, 456, 207, 372, 208, 218, 264, 349, 356,
+ 364, 219, 387, 361, 355, 398, 350, 362, 235, 275,
+ 365, 264, 408, 373, 940, 374, 375, 425, 357, 939,
+ 264, 428, 209, 429, 210, 238, 264, 253, 228, 229,
+ 367, 230, 387, 361, 412, 398, 253, 362, 232, 233,
+ 368, 234, 408, 369, 239, 236, 240, 425, 240, 249,
+ 250, 428, 251, 429, 240, 938, 252, 240, 241, 242,
+ 367, 240, 243, 244, 410, 411, 937, 245, 298, 299,
+ 368, 300, 369, 936, 239, 236, 240, 935, 240, 445,
+ 446, 934, 390, 391, 240, 392, 933, 240, 241, 242,
+
+ 240, 243, 244, 932, 390, 391, 245, 392, 246, 393,
+ 393, 393, 393, 390, 391, 931, 392, 413, 413, 445,
+ 446, 393, 393, 393, 393, 390, 391, 458, 392, 448,
+ 393, 393, 393, 393, 461, 394, 305, 305, 305, 305,
+ 253, 449, 393, 393, 393, 393, 450, 930, 462, 414,
+ 269, 270, 454, 271, 395, 464, 458, 272, 459, 448,
+ 451, 463, 460, 461, 394, 396, 273, 465, 929, 455,
+ 466, 449, 274, 468, 467, 469, 450, 462, 414, 470,
+ 471, 472, 454, 473, 395, 464, 474, 476, 459, 451,
+ 463, 480, 460, 482, 481, 396, 475, 465, 455, 485,
+
+ 466, 486, 468, 467, 275, 469, 262, 262, 470, 471,
+ 472, 401, 473, 402, 410, 411, 474, 476, 401, 928,
+ 402, 480, 927, 482, 481, 475, 926, 497, 485, 504,
+ 486, 253, 433, 434, 435, 436, 437, 437, 438, 437,
+ 437, 437, 437, 439, 437, 437, 437, 440, 437, 437,
+ 441, 437, 442, 437, 437, 443, 437, 497, 504, 405,
+ 444, 406, 433, 434, 435, 436, 437, 437, 438, 437,
+ 437, 437, 437, 439, 437, 437, 437, 440, 437, 441,
+ 437, 442, 437, 437, 443, 437, 477, 483, 499, 500,
+ 478, 501, 505, 506, 484, 479, 379, 379, 379, 379,
+
+ 508, 405, 431, 406, 432, 502, 502, 502, 502, 510,
+ 511, 925, 520, 512, 512, 924, 477, 483, 548, 923,
+ 478, 505, 922, 506, 484, 479, 487, 521, 488, 522,
+ 508, 489, 490, 503, 391, 921, 392, 491, 492, 510,
+ 410, 411, 520, 493, 494, 513, 523, 548, 495, 409,
+ 393, 393, 393, 393, 920, 496, 487, 521, 488, 522,
+ 919, 489, 490, 519, 519, 519, 519, 491, 492, 431,
+ 914, 432, 493, 494, 513, 913, 523, 495, 409, 409,
+ 861, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+
+ 409, 409, 409, 409, 409, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 410, 411, 860, 515, 409, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 409,
+ 409, 409, 516, 516, 546, 547, 524, 524, 524, 524,
+ 524, 524, 524, 524, 549, 558, 550, 599, 859, 600,
+ 524, 524, 858, 525, 526, 528, 533, 527, 551, 535,
+ 530, 857, 529, 534, 546, 547, 410, 411, 517, 517,
+
+ 517, 517, 531, 549, 558, 532, 550, 517, 517, 517,
+ 517, 517, 517, 525, 526, 528, 533, 527, 551, 535,
+ 530, 529, 552, 534, 560, 553, 554, 555, 556, 856,
+ 557, 531, 410, 411, 532, 559, 855, 517, 517, 517,
+ 517, 517, 517, 1106, 561, 562, 563, 565, 536, 537,
+ 538, 539, 552, 560, 540, 553, 554, 555, 556, 541,
+ 557, 564, 567, 542, 568, 559, 543, 854, 544, 569,
+ 853, 545, 570, 561, 571, 562, 563, 565, 536, 537,
+ 538, 539, 572, 573, 540, 574, 575, 576, 577, 541,
+ 564, 578, 567, 542, 568, 543, 581, 544, 582, 569,
+
+ 545, 579, 570, 583, 571, 584, 585, 580, 586, 587,
+ 606, 588, 572, 573, 589, 574, 575, 576, 577, 590,
+ 591, 578, 592, 593, 852, 594, 581, 582, 598, 851,
+ 595, 579, 583, 596, 597, 584, 585, 580, 586, 587,
+ 588, 500, 602, 600, 589, 503, 391, 603, 392, 590,
+ 591, 619, 592, 593, 594, 604, 499, 500, 598, 501,
+ 595, 608, 596, 597, 601, 500, 599, 501, 600, 410,
+ 411, 259, 602, 502, 502, 502, 502, 603, 410, 411,
+ 619, 502, 502, 502, 502, 604, 601, 500, 850, 501,
+ 607, 608, 409, 409, 848, 409, 409, 409, 409, 409,
+
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 410, 411, 613, 610, 409, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 409, 409, 409, 611, 611, 616, 409,
+ 524, 524, 614, 614, 524, 524, 524, 845, 617, 618,
+ 623, 828, 696, 697, 524, 698, 524, 625, 621, 626,
+
+ 622, 775, 629, 776, 817, 624, 524, 700, 616, 628,
+ 410, 411, 612, 612, 612, 612, 410, 411, 617, 618,
+ 623, 612, 612, 612, 612, 612, 612, 625, 621, 626,
+ 622, 524, 629, 627, 624, 806, 524, 524, 524, 628,
+ 409, 524, 630, 781, 632, 644, 643, 524, 524, 636,
+ 780, 612, 612, 612, 612, 612, 612, 615, 615, 615,
+ 615, 631, 627, 633, 634, 524, 615, 615, 615, 615,
+ 615, 615, 630, 524, 632, 644, 643, 779, 646, 636,
+ 524, 645, 647, 635, 524, 649, 524, 524, 650, 651,
+ 652, 631, 653, 633, 634, 637, 615, 615, 615, 615,
+
+ 615, 615, 639, 638, 697, 640, 641, 642, 646, 654,
+ 645, 647, 656, 635, 649, 655, 658, 650, 657, 651,
+ 652, 659, 606, 660, 637, 661, 662, 692, 664, 665,
+ 669, 639, 667, 638, 640, 668, 641, 642, 670, 654,
+ 671, 672, 656, 673, 675, 655, 658, 657, 674, 676,
+ 677, 659, 660, 678, 661, 679, 662, 664, 680, 665,
+ 669, 667, 681, 683, 668, 682, 684, 670, 685, 687,
+ 671, 672, 686, 673, 675, 688, 690, 674, 676, 677,
+ 693, 689, 691, 678, 694, 679, 695, 703, 680, 701,
+ 701, 705, 681, 683, 682, 684, 524, 524, 685, 687,
+
+ 706, 686, 607, 768, 524, 688, 690, 410, 411, 693,
+ 689, 524, 691, 524, 694, 695, 708, 703, 524, 710,
+ 705, 707, 524, 410, 411, 702, 702, 702, 702, 709,
+ 706, 711, 524, 712, 702, 702, 702, 702, 702, 702,
+ 714, 713, 524, 524, 524, 524, 708, 764, 710, 715,
+ 707, 716, 717, 524, 524, 775, 718, 776, 721, 709,
+ 524, 711, 524, 712, 702, 702, 702, 702, 702, 702,
+ 714, 713, 719, 723, 720, 524, 524, 524, 524, 715,
+ 724, 716, 717, 524, 722, 524, 718, 524, 721, 726,
+ 728, 752, 731, 732, 734, 727, 730, 748, 733, 736,
+
+ 741, 738, 719, 723, 720, 725, 735, 729, 743, 740,
+ 724, 739, 742, 722, 744, 745, 746, 747, 749, 726,
+ 728, 731, 750, 732, 734, 727, 730, 733, 751, 736,
+ 741, 738, 753, 754, 725, 755, 735, 729, 740, 756,
+ 739, 757, 742, 744, 758, 745, 746, 747, 749, 759,
+ 761, 750, 760, 762, 763, 765, 766, 767, 751, 769,
+ 770, 753, 754, 771, 755, 772, 773, 777, 778, 756,
+ 757, 696, 697, 758, 698, 410, 411, 409, 524, 759,
+ 761, 760, 762, 524, 763, 765, 766, 767, 524, 769,
+ 770, 524, 771, 410, 411, 772, 773, 777, 778, 524,
+
+ 782, 524, 786, 784, 783, 524, 524, 785, 524, 524,
+ 524, 524, 524, 787, 524, 791, 524, 524, 524, 363,
+ 363, 807, 793, 737, 795, 802, 524, 788, 796, 524,
+ 782, 786, 789, 784, 783, 790, 792, 785, 524, 797,
+ 524, 794, 798, 787, 524, 791, 799, 800, 524, 804,
+ 524, 807, 793, 808, 795, 802, 788, 803, 796, 805,
+ 811, 789, 801, 809, 790, 792, 812, 813, 797, 814,
+ 794, 815, 798, 810, 704, 816, 799, 800, 818, 804,
+ 819, 820, 808, 821, 822, 823, 825, 803, 824, 805,
+ 811, 826, 801, 809, 827, 829, 812, 813, 814, 830,
+
+ 815, 831, 838, 810, 816, 839, 846, 775, 818, 776,
+ 819, 820, 849, 821, 822, 823, 825, 824, 847, 524,
+ 917, 826, 918, 827, 864, 829, 832, 833, 524, 830,
+ 831, 834, 838, 524, 835, 839, 846, 836, 840, 841,
+ 524, 849, 837, 842, 524, 878, 843, 524, 847, 844,
+ 863, 524, 862, 524, 864, 865, 832, 833, 524, 868,
+ 866, 834, 524, 524, 835, 524, 875, 836, 840, 841,
+ 876, 837, 872, 842, 878, 867, 843, 870, 524, 844,
+ 863, 862, 871, 880, 869, 865, 882, 873, 877, 868,
+ 866, 874, 879, 881, 409, 883, 875, 884, 699, 885,
+
+ 876, 886, 872, 887, 867, 888, 870, 889, 890, 891,
+ 892, 871, 880, 869, 894, 882, 873, 895, 877, 896,
+ 902, 874, 879, 881, 883, 901, 893, 884, 885, 903,
+ 904, 886, 887, 905, 907, 888, 906, 889, 890, 891,
+ 892, 897, 692, 911, 894, 898, 895, 912, 899, 896,
+ 902, 915, 943, 908, 901, 893, 909, 524, 900, 903,
+ 904, 944, 946, 905, 907, 906, 910, 945, 947, 948,
+ 950, 897, 911, 949, 951, 898, 912, 952, 899, 953,
+ 915, 942, 943, 908, 954, 955, 909, 900, 956, 666,
+ 957, 944, 946, 958, 959, 910, 945, 960, 947, 948,
+
+ 950, 961, 949, 962, 951, 963, 964, 952, 965, 953,
+ 942, 966, 967, 954, 968, 955, 969, 971, 956, 957,
+ 970, 972, 973, 958, 959, 974, 975, 960, 976, 979,
+ 961, 977, 917, 962, 918, 963, 964, 917, 965, 918,
+ 966, 967, 993, 994, 968, 995, 969, 971, 978, 970,
+ 996, 972, 973, 997, 974, 975, 998, 976, 979, 999,
+ 1000, 977, 1001, 663, 1002, 1003, 1004, 648, 1005, 1006,
+ 1007, 993, 1008, 994, 1009, 995, 1010, 978, 1011, 1012,
+ 996, 1013, 1014, 997, 1015, 1016, 998, 1017, 1018, 999,
+ 1000, 1019, 1001, 1002, 1003, 1020, 1004, 1005, 1021, 1006,
+
+ 1007, 1008, 1022, 1009, 1025, 1010, 1023, 1026, 1011, 1012,
+ 1024, 1013, 1014, 1015, 1016, 1028, 1017, 1029, 1018, 1030,
+ 1031, 1019, 1032, 1033, 1034, 1020, 1035, 1036, 1021, 1037,
+ 1038, 1022, 1039, 1025, 1040, 1023, 1041, 1026, 1042, 1024,
+ 1043, 1044, 1045, 1046, 1047, 1028, 1048, 1029, 1030, 1049,
+ 1031, 1032, 1033, 1034, 1050, 1057, 1035, 1036, 1037, 1038,
+ 1051, 1052, 1039, 1053, 1040, 1054, 1041, 1055, 1042, 1056,
+ 1043, 1044, 1045, 1046, 1047, 1048, 1058, 1059, 1060, 1049,
+ 1061, 620, 1062, 1063, 1050, 1057, 1064, 1065, 1066, 1051,
+ 1052, 1067, 1053, 1068, 1054, 1069, 1055, 1070, 1056, 1071,
+
+ 1072, 1073, 1074, 1075, 409, 1076, 1058, 1059, 1060, 1077,
+ 1061, 1062, 1078, 1063, 1079, 1080, 1064, 1065, 1066, 1081,
+ 1067, 1082, 1083, 1068, 1084, 1069, 1085, 1070, 1086, 1071,
+ 1072, 1073, 1074, 1075, 1076, 1087, 1088, 1089, 1077, 1090,
+ 1091, 1092, 1078, 1079, 1093, 1080, 1094, 566, 1095, 1081,
+ 1082, 1096, 1083, 1097, 1084, 1098, 1085, 1099, 1086, 1100,
+ 1101, 524, 1102, 1103, 1104, 1087, 1088, 1089, 1090, 1091,
+ 1105, 1092, 416, 1093, 416, 420, 1094, 1095, 391, 518,
+ 1096, 518, 1097, 378, 457, 1098, 342, 1099, 1100, 339,
+ 1101, 1102, 1103, 336, 1104, 301, 299, 301, 296, 286,
+
+ 1105, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+
+ 100, 100, 100, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 147, 147,
+ 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
+
+ 147, 147, 147, 147, 147, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 200, 200, 200, 200,
+ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
+ 200, 200, 200, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
+
+ 220, 220, 220, 220, 220, 220, 220, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 231, 231, 282, 231, 231, 423,
+ 422, 421, 231, 237, 237, 237, 237, 237, 237, 237,
+ 237, 237, 237, 237, 237, 237, 237, 237, 237, 248,
+ 248, 270, 248, 248, 420, 418, 417, 248, 259, 407,
+ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ 259, 259, 259, 259, 259, 262, 254, 262, 262, 262,
+ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
+ 262, 262, 268, 268, 268, 403, 268, 268, 250, 233,
+
+ 229, 268, 280, 386, 280, 280, 280, 280, 280, 280,
+ 280, 280, 280, 280, 280, 280, 280, 280, 280, 281,
+ 385, 281, 281, 281, 281, 281, 281, 281, 281, 281,
+ 281, 281, 281, 281, 281, 281, 285, 285, 285, 285,
+ 285, 285, 285, 285, 285, 285, 285, 285, 384, 285,
+ 382, 285, 285, 295, 381, 380, 295, 295, 295, 295,
+ 295, 295, 295, 295, 295, 295, 295, 295, 295, 295,
+ 303, 303, 378, 303, 303, 342, 340, 339, 303, 308,
+ 338, 308, 308, 308, 308, 308, 308, 308, 308, 308,
+ 308, 308, 308, 308, 308, 308, 311, 337, 311, 311,
+
+ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
+ 317, 311, 311, 312, 336, 312, 335, 331, 312, 312,
+ 312, 312, 312, 329, 328, 327, 312, 314, 326, 314,
+ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314,
+ 314, 314, 314, 314, 318, 318, 322, 318, 318, 321,
+ 317, 313, 318, 323, 323, 323, 323, 323, 323, 323,
+ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ 330, 307, 330, 310, 330, 330, 330, 330, 330, 330,
+ 330, 330, 330, 307, 330, 330, 330, 332, 306, 332,
+ 332, 332, 332, 332, 332, 332, 332, 332, 332, 332,
+
+ 332, 332, 332, 332, 341, 304, 341, 341, 341, 341,
+ 341, 341, 341, 341, 341, 341, 341, 341, 341, 341,
+ 341, 345, 345, 302, 299, 345, 345, 377, 301, 377,
+ 377, 377, 377, 377, 377, 377, 377, 377, 377, 377,
+ 377, 377, 377, 377, 383, 297, 383, 383, 383, 296,
+ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ 383, 231, 231, 294, 231, 231, 293, 292, 289, 231,
+ 388, 288, 388, 388, 388, 388, 388, 388, 388, 388,
+ 388, 388, 388, 388, 388, 388, 388, 389, 287, 389,
+ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+
+ 389, 389, 389, 389, 397, 397, 286, 282, 279, 397,
+ 399, 399, 278, 270, 258, 399, 400, 400, 400, 400,
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 400, 400, 400, 248, 248, 257, 248, 248, 256, 250,
+ 247, 248, 404, 404, 404, 404, 404, 404, 404, 404,
+ 404, 404, 404, 404, 404, 404, 404, 404, 404, 409,
+ 233, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 229, 409, 409, 259, 1106, 259, 259,
+ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ 259, 259, 259, 419, 419, 111, 419, 419, 111, 1106,
+
+ 1106, 419, 419, 424, 1106, 424, 424, 424, 424, 424,
+ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
+ 280, 1106, 280, 280, 280, 280, 280, 280, 280, 280,
+ 280, 280, 280, 280, 280, 280, 280, 281, 1106, 281,
+ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281,
+ 281, 281, 281, 281, 426, 1106, 426, 426, 426, 426,
+ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ 426, 427, 1106, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 285, 285,
+ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
+
+ 1106, 285, 1106, 285, 285, 430, 430, 430, 430, 430,
+ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ 430, 430, 295, 1106, 1106, 295, 295, 295, 295, 295,
+ 295, 295, 295, 295, 295, 295, 295, 295, 295, 303,
+ 303, 1106, 303, 303, 1106, 1106, 1106, 303, 312, 1106,
+ 312, 1106, 1106, 312, 312, 312, 312, 312, 1106, 1106,
+ 1106, 312, 314, 1106, 314, 314, 314, 314, 314, 314,
+ 314, 314, 314, 314, 314, 314, 314, 314, 314, 318,
+ 318, 1106, 318, 318, 1106, 1106, 1106, 318, 323, 323,
+ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+
+ 323, 323, 323, 323, 323, 330, 1106, 330, 1106, 330,
+ 330, 330, 330, 330, 330, 330, 330, 330, 1106, 330,
+ 330, 330, 447, 1106, 447, 447, 447, 447, 447, 447,
+ 447, 447, 447, 447, 447, 447, 447, 447, 447, 341,
+ 1106, 341, 341, 341, 341, 341, 341, 341, 341, 341,
+ 341, 341, 341, 341, 341, 341, 345, 345, 1106, 1106,
+ 345, 345, 377, 1106, 377, 377, 377, 377, 377, 377,
+ 377, 377, 377, 377, 377, 377, 377, 377, 377, 383,
+ 1106, 383, 383, 383, 1106, 383, 383, 383, 383, 383,
+ 383, 383, 383, 383, 383, 383, 388, 1106, 388, 388,
+
+ 388, 388, 388, 388, 388, 388, 388, 388, 388, 388,
+ 388, 388, 388, 389, 1106, 389, 389, 389, 389, 389,
+ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ 498, 498, 498, 498, 498, 498, 498, 498, 498, 498,
+ 498, 498, 498, 498, 498, 498, 498, 507, 507, 1106,
+ 507, 507, 1106, 1106, 1106, 507, 509, 509, 1106, 509,
+ 509, 1106, 1106, 1106, 509, 400, 400, 400, 400, 400,
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 400, 400, 404, 404, 404, 404, 404, 404, 404, 404,
+ 404, 404, 404, 404, 404, 404, 404, 404, 404, 409,
+
+ 1106, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 1106, 409, 409, 419, 419, 1106, 419,
+ 419, 1106, 1106, 1106, 419, 419, 424, 1106, 424, 424,
+ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
+ 424, 424, 424, 426, 1106, 426, 426, 426, 426, 426,
+ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ 427, 1106, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 430, 430, 430,
+ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ 430, 430, 430, 430, 437, 437, 437, 318, 318, 1106,
+
+ 318, 318, 1106, 1106, 1106, 318, 447, 1106, 447, 447,
+ 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
+ 447, 447, 447, 605, 1106, 605, 605, 605, 605, 605,
+ 605, 605, 605, 605, 605, 605, 605, 605, 605, 605,
+ 774, 774, 774, 774, 774, 774, 774, 774, 774, 774,
+ 774, 774, 774, 774, 774, 774, 774, 916, 916, 916,
+ 916, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+ 916, 916, 916, 916, 49, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+ } ;
+
+static yyconst flex_int16_t yy_chk[4060] =
+ { 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, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 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, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
+ 96, 3, 3, 5, 3, 5, 7, 3, 3, 3,
+ 3, 8, 992, 3, 3, 6, 6, 942, 6, 21,
+ 3, 941, 6, 3, 9, 126, 9, 11, 11, 96,
+
+ 11, 12, 12, 940, 12, 17, 939, 17, 19, 138,
+ 19, 19, 27, 20, 27, 20, 20, 17, 22, 3,
+ 3, 17, 17, 17, 17, 28, 7, 28, 7, 51,
+ 51, 8, 51, 8, 126, 10, 9, 10, 79, 21,
+ 21, 10, 21, 9, 9, 87, 9, 87, 3, 3,
+ 3, 4, 4, 138, 4, 4, 938, 4, 4, 19,
+ 4, 4, 4, 4, 20, 9, 4, 4, 22, 22,
+ 95, 22, 9, 4, 73, 73, 4, 10, 23, 37,
+ 23, 45, 37, 45, 10, 10, 17, 10, 259, 259,
+ 45, 23, 142, 263, 263, 37, 37, 37, 37, 937,
+
+ 95, 38, 4, 4, 38, 4, 10, 46, 147, 46,
+ 147, 79, 47, 10, 47, 936, 46, 38, 38, 38,
+ 38, 142, 47, 55, 55, 149, 55, 149, 23, 23,
+ 23, 4, 4, 4, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 18, 24,
+ 18, 24, 168, 29, 58, 29, 74, 74, 935, 30,
+ 18, 30, 24, 29, 18, 18, 18, 18, 31, 30,
+ 31, 31, 32, 191, 32, 32, 48, 162, 48, 67,
+ 67, 168, 67, 246, 162, 246, 48, 75, 74, 75,
+ 141, 58, 75, 75, 75, 75, 167, 176, 177, 24,
+ 24, 24, 191, 29, 253, 29, 253, 105, 105, 30,
+ 105, 30, 116, 116, 116, 116, 294, 74, 294, 31,
+ 141, 58, 323, 32, 323, 934, 167, 176, 177, 18,
+
+ 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, 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,
+ 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, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 33, 33, 39, 33, 39, 34,
+ 34, 33, 34, 182, 41, 42, 34, 333, 43, 181,
+
+ 33, 41, 42, 186, 333, 34, 203, 203, 203, 203,
+ 325, 43, 325, 181, 41, 42, 179, 187, 179, 188,
+ 314, 43, 179, 182, 41, 42, 43, 33, 194, 41,
+ 42, 199, 34, 186, 33, 33, 39, 33, 39, 34,
+ 34, 43, 34, 181, 41, 42, 179, 187, 179, 188,
+ 43, 179, 933, 41, 42, 43, 33, 194, 41, 42,
+ 199, 34, 932, 33, 314, 39, 931, 39, 34, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 40, 44, 40, 63, 63, 193, 63,
+ 122, 122, 347, 63, 183, 76, 76, 44, 76, 125,
+ 125, 348, 76, 350, 195, 132, 132, 44, 180, 184,
+ 190, 76, 44, 409, 409, 183, 180, 76, 193, 930,
+ 190, 347, 122, 196, 183, 197, 198, 44, 873, 184,
+
+ 348, 125, 350, 40, 195, 40, 44, 132, 180, 184,
+ 190, 44, 236, 189, 183, 244, 180, 189, 235, 76,
+ 190, 122, 258, 196, 872, 197, 198, 278, 184, 871,
+ 125, 290, 40, 291, 40, 59, 132, 63, 228, 228,
+ 192, 228, 236, 189, 260, 244, 76, 189, 232, 232,
+ 192, 232, 258, 192, 59, 235, 59, 278, 59, 249,
+ 249, 290, 249, 291, 59, 870, 249, 59, 59, 59,
+ 192, 59, 59, 59, 260, 260, 869, 59, 298, 298,
+ 192, 298, 192, 868, 59, 235, 59, 867, 59, 319,
+ 320, 866, 239, 239, 59, 239, 865, 59, 59, 59,
+
+ 59, 59, 59, 864, 240, 240, 59, 240, 59, 239,
+ 239, 239, 239, 241, 241, 863, 241, 261, 261, 319,
+ 320, 240, 240, 240, 240, 242, 242, 352, 242, 343,
+ 241, 241, 241, 241, 354, 239, 305, 305, 305, 305,
+ 249, 344, 242, 242, 242, 242, 346, 862, 355, 261,
+ 269, 269, 349, 269, 241, 357, 352, 269, 353, 343,
+ 346, 356, 353, 354, 239, 242, 269, 358, 861, 349,
+ 359, 344, 269, 360, 359, 361, 346, 355, 261, 362,
+ 364, 366, 349, 367, 241, 357, 368, 369, 353, 346,
+ 356, 371, 353, 372, 371, 242, 368, 358, 349, 374,
+
+ 359, 375, 360, 359, 269, 361, 415, 415, 362, 364,
+ 366, 400, 367, 400, 614, 614, 368, 369, 402, 860,
+ 402, 371, 859, 372, 371, 368, 858, 387, 374, 394,
+ 375, 269, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 387, 394, 404,
+ 307, 404, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 370, 373, 390, 390,
+ 370, 390, 395, 396, 373, 370, 379, 379, 379, 379,
+
+ 398, 406, 430, 406, 430, 390, 390, 390, 390, 408,
+ 410, 857, 423, 411, 411, 856, 370, 373, 448, 855,
+ 370, 395, 854, 396, 373, 370, 376, 425, 376, 428,
+ 398, 376, 376, 393, 393, 853, 393, 376, 376, 408,
+ 410, 410, 423, 376, 376, 411, 429, 448, 376, 411,
+ 393, 393, 393, 393, 852, 376, 376, 425, 376, 428,
+ 851, 376, 376, 420, 420, 420, 420, 376, 376, 432,
+ 847, 432, 376, 376, 411, 846, 429, 376, 412, 412,
+ 792, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 791, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 413, 413, 445, 446, 441, 433, 434, 435,
+ 438, 439, 436, 442, 449, 459, 450, 498, 790, 498,
+ 440, 443, 789, 433, 434, 436, 441, 435, 451, 443,
+ 439, 788, 438, 442, 445, 446, 413, 413, 414, 414,
+
+ 414, 414, 440, 449, 459, 440, 450, 414, 414, 414,
+ 414, 414, 414, 433, 434, 436, 441, 435, 451, 443,
+ 439, 438, 452, 442, 462, 453, 454, 455, 456, 787,
+ 458, 440, 414, 414, 440, 460, 786, 414, 414, 414,
+ 414, 414, 414, 444, 463, 464, 465, 467, 444, 444,
+ 444, 444, 452, 462, 444, 453, 454, 455, 456, 444,
+ 458, 466, 469, 444, 470, 460, 444, 785, 444, 471,
+ 784, 444, 472, 463, 473, 464, 465, 467, 444, 444,
+ 444, 444, 474, 475, 444, 476, 477, 478, 479, 444,
+ 466, 480, 469, 444, 470, 444, 482, 444, 483, 471,
+
+ 444, 481, 472, 484, 473, 485, 486, 481, 487, 488,
+ 508, 489, 474, 475, 490, 476, 477, 478, 479, 491,
+ 492, 480, 493, 494, 783, 495, 482, 483, 497, 782,
+ 496, 481, 484, 496, 496, 485, 486, 481, 487, 488,
+ 489, 501, 504, 501, 490, 503, 503, 505, 503, 491,
+ 492, 523, 493, 494, 495, 506, 499, 499, 497, 499,
+ 496, 510, 496, 496, 502, 502, 600, 502, 600, 613,
+ 613, 613, 504, 499, 499, 499, 499, 505, 615, 615,
+ 523, 502, 502, 502, 502, 506, 601, 601, 780, 601,
+ 508, 510, 511, 511, 773, 511, 511, 511, 511, 511,
+
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 514, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 512, 512, 520, 514,
+ 525, 527, 516, 516, 532, 526, 528, 770, 521, 522,
+ 526, 758, 607, 607, 529, 607, 531, 528, 525, 529,
+
+ 525, 693, 532, 693, 744, 527, 530, 609, 520, 531,
+ 512, 512, 513, 513, 513, 513, 516, 516, 521, 522,
+ 526, 513, 513, 513, 513, 513, 513, 528, 525, 529,
+ 525, 535, 532, 530, 527, 733, 539, 533, 545, 531,
+ 609, 534, 533, 704, 535, 546, 545, 536, 537, 539,
+ 703, 513, 513, 513, 513, 513, 513, 517, 517, 517,
+ 517, 534, 530, 536, 537, 538, 517, 517, 517, 517,
+ 517, 517, 533, 540, 535, 546, 545, 699, 550, 539,
+ 542, 547, 551, 538, 541, 553, 543, 544, 554, 555,
+ 556, 534, 557, 536, 537, 540, 517, 517, 517, 517,
+
+ 517, 517, 542, 541, 698, 542, 543, 544, 550, 557,
+ 547, 551, 558, 538, 553, 557, 560, 554, 559, 555,
+ 556, 563, 606, 564, 540, 565, 566, 692, 569, 570,
+ 574, 542, 572, 541, 542, 573, 543, 544, 576, 557,
+ 577, 578, 558, 579, 581, 557, 560, 559, 580, 582,
+ 583, 563, 564, 584, 565, 586, 566, 569, 587, 570,
+ 574, 572, 588, 590, 573, 589, 591, 576, 592, 594,
+ 577, 578, 593, 579, 581, 595, 596, 580, 582, 583,
+ 602, 595, 597, 584, 603, 586, 604, 616, 587, 611,
+ 611, 618, 588, 590, 589, 591, 621, 624, 592, 594,
+
+ 619, 593, 606, 686, 622, 595, 596, 701, 701, 602,
+ 595, 623, 597, 626, 603, 604, 622, 616, 625, 624,
+ 618, 621, 628, 611, 611, 612, 612, 612, 612, 623,
+ 619, 625, 627, 626, 612, 612, 612, 612, 612, 612,
+ 628, 627, 629, 631, 630, 632, 622, 682, 624, 629,
+ 621, 630, 631, 634, 633, 774, 632, 774, 634, 623,
+ 635, 625, 636, 626, 612, 612, 612, 612, 612, 612,
+ 628, 627, 633, 636, 633, 637, 639, 640, 638, 629,
+ 637, 630, 631, 643, 635, 641, 632, 642, 634, 639,
+ 641, 668, 644, 645, 648, 640, 643, 664, 647, 650,
+
+ 655, 653, 633, 636, 633, 638, 648, 642, 658, 654,
+ 637, 653, 657, 635, 659, 661, 662, 663, 665, 639,
+ 641, 644, 666, 645, 648, 640, 643, 647, 667, 650,
+ 655, 653, 669, 670, 638, 671, 648, 642, 654, 673,
+ 653, 674, 657, 659, 675, 661, 662, 663, 665, 676,
+ 679, 666, 678, 680, 681, 683, 684, 685, 667, 687,
+ 688, 669, 670, 689, 671, 690, 691, 694, 695, 673,
+ 674, 696, 696, 675, 696, 700, 700, 700, 711, 676,
+ 679, 678, 680, 707, 681, 683, 684, 685, 709, 687,
+ 688, 710, 689, 702, 702, 690, 691, 694, 695, 708,
+
+ 707, 712, 711, 709, 708, 713, 716, 710, 714, 718,
+ 721, 715, 720, 712, 717, 716, 719, 722, 727, 1147,
+ 1147, 734, 718, 652, 720, 727, 724, 713, 721, 723,
+ 707, 711, 714, 709, 708, 715, 717, 710, 725, 722,
+ 729, 719, 723, 712, 726, 716, 724, 725, 730, 729,
+ 728, 734, 718, 735, 720, 727, 713, 728, 721, 730,
+ 738, 714, 726, 737, 715, 717, 739, 740, 722, 741,
+ 719, 742, 723, 737, 617, 743, 724, 725, 745, 729,
+ 746, 747, 735, 748, 749, 750, 752, 728, 751, 730,
+ 738, 754, 726, 737, 756, 760, 739, 740, 741, 761,
+
+ 742, 762, 765, 737, 743, 767, 771, 776, 745, 776,
+ 746, 747, 778, 748, 749, 750, 752, 751, 772, 795,
+ 849, 754, 849, 756, 795, 760, 764, 764, 793, 761,
+ 762, 764, 765, 794, 764, 767, 771, 764, 768, 768,
+ 796, 778, 764, 768, 797, 809, 768, 799, 772, 768,
+ 794, 798, 793, 801, 795, 796, 764, 764, 802, 799,
+ 797, 764, 800, 803, 764, 804, 806, 764, 768, 768,
+ 807, 764, 803, 768, 809, 798, 768, 801, 805, 768,
+ 794, 793, 802, 811, 800, 796, 814, 804, 808, 799,
+ 797, 805, 810, 812, 610, 816, 806, 817, 608, 818,
+
+ 807, 819, 803, 820, 798, 821, 801, 823, 825, 826,
+ 828, 802, 811, 800, 832, 814, 804, 833, 808, 834,
+ 837, 805, 810, 812, 816, 836, 828, 817, 818, 838,
+ 839, 819, 820, 840, 842, 821, 841, 823, 825, 826,
+ 828, 835, 598, 844, 832, 835, 833, 845, 835, 834,
+ 837, 848, 875, 843, 836, 828, 843, 874, 835, 838,
+ 839, 876, 878, 840, 842, 841, 843, 877, 879, 880,
+ 883, 835, 844, 881, 884, 835, 845, 885, 835, 886,
+ 848, 874, 875, 843, 888, 889, 843, 835, 890, 571,
+ 891, 876, 878, 892, 893, 843, 877, 894, 879, 880,
+
+ 883, 895, 881, 897, 884, 898, 899, 885, 900, 886,
+ 874, 901, 902, 888, 904, 889, 905, 908, 890, 891,
+ 906, 909, 910, 892, 893, 911, 912, 894, 913, 915,
+ 895, 914, 916, 897, 916, 898, 899, 918, 900, 918,
+ 901, 902, 943, 944, 904, 945, 905, 908, 914, 906,
+ 946, 909, 910, 947, 911, 912, 948, 913, 915, 949,
+ 950, 914, 951, 568, 952, 953, 954, 552, 955, 956,
+ 958, 943, 959, 944, 960, 945, 961, 914, 962, 963,
+ 946, 964, 965, 947, 967, 969, 948, 970, 971, 949,
+ 950, 972, 951, 952, 953, 973, 954, 955, 975, 956,
+
+ 958, 959, 976, 960, 978, 961, 977, 979, 962, 963,
+ 977, 964, 965, 967, 969, 993, 970, 994, 971, 995,
+ 996, 972, 997, 998, 999, 973, 1001, 1002, 975, 1004,
+ 1005, 976, 1006, 978, 1007, 977, 1008, 979, 1009, 977,
+ 1010, 1012, 1016, 1017, 1018, 993, 1021, 994, 995, 1022,
+ 996, 997, 998, 999, 1023, 1031, 1001, 1002, 1004, 1005,
+ 1024, 1025, 1006, 1026, 1007, 1028, 1008, 1029, 1009, 1030,
+ 1010, 1012, 1016, 1017, 1018, 1021, 1032, 1033, 1034, 1022,
+ 1037, 524, 1039, 1041, 1023, 1031, 1044, 1047, 1048, 1024,
+ 1025, 1049, 1026, 1050, 1028, 1051, 1029, 1052, 1030, 1053,
+
+ 1054, 1055, 1056, 1058, 515, 1059, 1032, 1033, 1034, 1060,
+ 1037, 1039, 1061, 1041, 1063, 1067, 1044, 1047, 1048, 1068,
+ 1049, 1069, 1070, 1050, 1072, 1051, 1073, 1052, 1074, 1053,
+ 1054, 1055, 1056, 1058, 1059, 1075, 1076, 1077, 1060, 1078,
+ 1081, 1083, 1061, 1063, 1084, 1067, 1085, 468, 1086, 1068,
+ 1069, 1087, 1070, 1088, 1072, 1090, 1073, 1093, 1074, 1094,
+ 1097, 437, 1098, 1099, 1102, 1075, 1076, 1077, 1078, 1081,
+ 1103, 1083, 1160, 1084, 1160, 419, 1085, 1086, 392, 1189,
+ 1087, 1189, 1088, 377, 351, 1090, 341, 1093, 1094, 339,
+ 1097, 1098, 1099, 334, 1102, 301, 300, 299, 296, 285,
+
+ 1103, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,
+ 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1108, 1108,
+ 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108,
+ 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1109, 1109, 1109,
+ 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109,
+ 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
+ 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1111,
+ 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
+ 1111, 1111, 1111, 1111, 1111, 1111, 1112, 1112, 1112, 1112,
+ 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
+
+ 1112, 1112, 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
+ 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
+ 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,
+ 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
+ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
+ 1115, 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116,
+ 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
+ 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
+ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118,
+ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
+
+ 1118, 1118, 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119,
+ 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119,
+ 1119, 1119, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
+ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1121,
+ 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
+ 1121, 1121, 1121, 1121, 1121, 1121, 1122, 1122, 1122, 1122,
+ 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122,
+ 1122, 1122, 1122, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
+ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
+ 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
+
+ 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1125, 1125, 1125,
+ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
+ 1125, 1125, 1125, 1125, 1126, 1126, 282, 1126, 1126, 274,
+ 273, 272, 1126, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
+ 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128,
+ 1128, 271, 1128, 1128, 268, 266, 265, 1128, 1129, 256,
+ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
+ 1129, 1129, 1129, 1129, 1129, 1130, 255, 1130, 1130, 1130,
+ 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
+ 1130, 1130, 1131, 1131, 1131, 252, 1131, 1131, 251, 234,
+
+ 230, 1131, 1132, 227, 1132, 1132, 1132, 1132, 1132, 1132,
+ 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1133,
+ 226, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133,
+ 1133, 1133, 1133, 1133, 1133, 1133, 1134, 1134, 1134, 1134,
+ 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 222, 1134,
+ 208, 1134, 1134, 1135, 207, 206, 1135, 1135, 1135, 1135,
+ 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135,
+ 1136, 1136, 202, 1136, 1136, 175, 174, 172, 1136, 1137,
+ 170, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137,
+ 1137, 1137, 1137, 1137, 1137, 1137, 1138, 169, 1138, 1138,
+
+ 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138,
+ 166, 1138, 1138, 1139, 165, 1139, 164, 158, 1139, 1139,
+ 1139, 1139, 1139, 155, 154, 153, 1139, 1140, 152, 1140,
+ 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140,
+ 1140, 1140, 1140, 1140, 1141, 1141, 144, 1141, 1141, 143,
+ 139, 136, 1141, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
+ 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
+ 1143, 131, 1143, 129, 1143, 1143, 1143, 1143, 1143, 1143,
+ 1143, 1143, 1143, 124, 1143, 1143, 1143, 1144, 120, 1144,
+ 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144,
+
+ 1144, 1144, 1144, 1144, 1145, 114, 1145, 1145, 1145, 1145,
+ 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145,
+ 1145, 1146, 1146, 109, 107, 1146, 1146, 1148, 106, 1148,
+ 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148,
+ 1148, 1148, 1148, 1148, 1149, 103, 1149, 1149, 1149, 101,
+ 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149,
+ 1149, 1150, 1150, 99, 1150, 1150, 98, 97, 94, 1150,
+ 1151, 91, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151,
+ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1152, 90, 1152,
+ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
+
+ 1152, 1152, 1152, 1152, 1153, 1153, 88, 86, 84, 1153,
+ 1154, 1154, 80, 78, 72, 1154, 1155, 1155, 1155, 1155,
+ 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155,
+ 1155, 1155, 1155, 1156, 1156, 71, 1156, 1156, 68, 65,
+ 60, 1156, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157,
+ 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1158,
+ 57, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ 1158, 1158, 1158, 53, 1158, 1158, 1159, 49, 1159, 1159,
+ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
+ 1159, 1159, 1159, 1161, 1161, 16, 1161, 1161, 15, 0,
+
+ 0, 1161, 1161, 1162, 0, 1162, 1162, 1162, 1162, 1162,
+ 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162,
+ 1163, 0, 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1163,
+ 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1164, 0, 1164,
+ 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164,
+ 1164, 1164, 1164, 1164, 1165, 0, 1165, 1165, 1165, 1165,
+ 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165,
+ 1165, 1166, 0, 1166, 1166, 1166, 1166, 1166, 1166, 1166,
+ 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1167, 1167,
+ 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167,
+
+ 0, 1167, 0, 1167, 1167, 1168, 1168, 1168, 1168, 1168,
+ 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168,
+ 1168, 1168, 1169, 0, 0, 1169, 1169, 1169, 1169, 1169,
+ 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1170,
+ 1170, 0, 1170, 1170, 0, 0, 0, 1170, 1171, 0,
+ 1171, 0, 0, 1171, 1171, 1171, 1171, 1171, 0, 0,
+ 0, 1171, 1172, 0, 1172, 1172, 1172, 1172, 1172, 1172,
+ 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1173,
+ 1173, 0, 1173, 1173, 0, 0, 0, 1173, 1174, 1174,
+ 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174,
+
+ 1174, 1174, 1174, 1174, 1174, 1175, 0, 1175, 0, 1175,
+ 1175, 1175, 1175, 1175, 1175, 1175, 1175, 1175, 0, 1175,
+ 1175, 1175, 1176, 0, 1176, 1176, 1176, 1176, 1176, 1176,
+ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1177,
+ 0, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177,
+ 1177, 1177, 1177, 1177, 1177, 1177, 1178, 1178, 0, 0,
+ 1178, 1178, 1179, 0, 1179, 1179, 1179, 1179, 1179, 1179,
+ 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1180,
+ 0, 1180, 1180, 1180, 0, 1180, 1180, 1180, 1180, 1180,
+ 1180, 1180, 1180, 1180, 1180, 1180, 1181, 0, 1181, 1181,
+
+ 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181,
+ 1181, 1181, 1181, 1182, 0, 1182, 1182, 1182, 1182, 1182,
+ 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182,
+ 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183,
+ 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1184, 1184, 0,
+ 1184, 1184, 0, 0, 0, 1184, 1185, 1185, 0, 1185,
+ 1185, 0, 0, 0, 1185, 1186, 1186, 1186, 1186, 1186,
+ 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186,
+ 1186, 1186, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187,
+ 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1188,
+
+ 0, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
+ 1188, 1188, 1188, 0, 1188, 1188, 1190, 1190, 0, 1190,
+ 1190, 0, 0, 0, 1190, 1190, 1191, 0, 1191, 1191,
+ 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191,
+ 1191, 1191, 1191, 1192, 0, 1192, 1192, 1192, 1192, 1192,
+ 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192,
+ 1193, 0, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193,
+ 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1194, 1194, 1194,
+ 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194,
+ 1194, 1194, 1194, 1194, 1195, 1195, 1195, 1196, 1196, 0,
+
+ 1196, 1196, 0, 0, 0, 1196, 1197, 0, 1197, 1197,
+ 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197,
+ 1197, 1197, 1197, 1198, 0, 1198, 1198, 1198, 1198, 1198,
+ 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198,
+ 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199,
+ 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1200, 1200, 1200,
+ 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200,
+ 1200, 1200, 1200, 1200, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+ } ;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
+static char *yy_full_match;
+static int yy_lp;
+#define REJECT \
+{ \
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
+yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
+++(yy_lp); \
+goto find_rule; \
+}
+
+static int yy_more_flag = 0;
+static int yy_more_len = 0;
+#define yymore() ((yy_more_flag) = 1)
+#define YY_MORE_ADJ (yy_more_len)
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "scan.l"
+/* scan.l - scanner for flex input -*-C-*- */
+#line 4 "scan.l"
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* 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. */
+
+/* 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "parse.h"
+extern bool tablesverify, tablesext;
+extern int trlcontxt; /* Set in parse.y for each rule. */
+extern const char *escaped_qstart, *escaped_qend;
+
+#define ACTION_ECHO add_action( yytext )
+#define ACTION_IFDEF(def, should_define) \
+ { \
+ if ( should_define ) \
+ action_define( def, 1 ); \
+ }
+
+#define ACTION_ECHO_QSTART add_action (escaped_qstart)
+#define ACTION_ECHO_QEND add_action (escaped_qend)
+
+#define ACTION_M4_IFDEF(def, should_define) \
+ do{ \
+ if ( should_define ) \
+ buf_m4_define( &m4defs_buf, def, NULL);\
+ else \
+ buf_m4_undefine( &m4defs_buf, def);\
+ } while(0)
+
+#define MARK_END_OF_PROLOG mark_prolog();
+
+#define YY_DECL \
+ int flexscan()
+
+#define RETURNCHAR \
+ yylval = (unsigned char) yytext[0]; \
+ return CHAR;
+
+#define RETURNNAME \
+ if(yyleng < MAXLINE) \
+ { \
+ strcpy( nmstr, yytext ); \
+ } \
+ else \
+ { \
+ synerr(_("Input line too long\n")); \
+ FLEX_EXIT(EXIT_FAILURE); \
+ } \
+ return NAME;
+
+#define PUT_BACK_STRING(str, start) \
+ for ( i = strlen( str ) - 1; i >= start; --i ) \
+ unput((str)[i])
+
+#define CHECK_REJECT(str) \
+ if ( all_upper( str ) ) \
+ reject = true;
+
+#define CHECK_YYMORE(str) \
+ if ( all_lower( str ) ) \
+ yymore_used = true;
+
+#define YY_USER_INIT \
+ if ( getenv("POSIXLY_CORRECT") ) \
+ posix_compat = true;
+
+
+
+
+
+
+
+
+#line 1990 "<stdout>"
+
+#define INITIAL 0
+#define SECT2 1
+#define SECT2PROLOG 2
+#define SECT3 3
+#define CODEBLOCK 4
+#define PICKUPDEF 5
+#define SC 6
+#define CARETISBOL 7
+#define NUM 8
+#define QUOTE 9
+#define FIRSTCCL 10
+#define CCL 11
+#define ACTION 12
+#define RECOVER 13
+#define COMMENT 14
+#define ACTION_STRING 15
+#define PERCENT_BRACE_ACTION 16
+#define OPTION 17
+#define LINEDIR 18
+#define CODEBLOCK_MATCH_BRACE 19
+#define GROUP_WITH_PARAMS 20
+#define GROUP_MINUS_PARAMS 21
+#define EXTENDED_COMMENT 22
+#define COMMENT_DISCARD 23
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+ static void yyunput (int c,char *buf_ptr );
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+ static int yy_start_stack_ptr = 0;
+ static int yy_start_stack_depth = 0;
+ static int *yy_start_stack = NULL;
+
+ static void yy_push_state (int new_state );
+
+ static void yy_pop_state (void );
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+
+#line 131 "scan.l"
+
+ static int bracelevel, didadef, indented_code;
+ static int doing_rule_action = false;
+ static int option_sense;
+
+ int doing_codeblock = false;
+ int i, brace_depth=0, brace_start_line=0;
+ Char nmdef[MAXLINE];
+
+
+#line 2219 "<stdout>"
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ /* Create the reject buffer large enough to save one state per allowed character. */
+ if ( ! (yy_state_buf) )
+ (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE );
+ if ( ! (yy_state_buf) )
+ YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ (yy_more_len) = 0;
+ if ( (yy_more_flag) )
+ {
+ (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
+ (yy_more_flag) = 0;
+ }
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+
+ (yy_state_ptr) = (yy_state_buf);
+ *(yy_state_ptr)++ = yy_current_state;
+
+yy_match:
+ do
+ {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *(yy_state_ptr)++ = yy_current_state;
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 3975 );
+
+yy_find_action:
+ yy_current_state = *--(yy_state_ptr);
+ (yy_lp) = yy_accept[yy_current_state];
+goto find_rule; /* avoid `defined but not used' warning */
+find_rule: /* we branch to this label when backing up */
+ for ( ; ; ) /* until we find what rule we matched */
+ {
+ if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
+ {
+ yy_act = yy_acclist[(yy_lp)];
+ {
+ (yy_full_match) = yy_cp;
+ break;
+ }
+ }
+ --yy_cp;
+ yy_current_state = *--(yy_state_ptr);
+ (yy_lp) = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+
+case 1:
+YY_RULE_SETUP
+#line 142 "scan.l"
+indented_code = true; BEGIN(CODEBLOCK);
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 143 "scan.l"
+ACTION_ECHO; yy_push_state( COMMENT );
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 144 "scan.l"
+yy_push_state( LINEDIR );
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 145 "scan.l"
+return SCDECL;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 146 "scan.l"
+return XSCDECL;
+ YY_BREAK
+case 6:
+/* rule 6 can match eol */
+YY_RULE_SETUP
+#line 147 "scan.l"
+{
+ ++linenum;
+ line_directive_out( (FILE *) 0, 1 );
+ indented_code = false;
+ BEGIN(CODEBLOCK);
+ }
+ YY_BREAK
+case 7:
+/* rule 7 can match eol */
+YY_RULE_SETUP
+#line 153 "scan.l"
+{
+ brace_start_line = linenum;
+ ++linenum;
+ buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
+ brace_depth = 1;
+ yy_push_state(CODEBLOCK_MATCH_BRACE);
+ }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 161 "scan.l"
+synerr( _("malformed '%top' directive") );
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 163 "scan.l"
+/* discard */
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 165 "scan.l"
+{
+ sectnum = 2;
+ bracelevel = 0;
+ mark_defs1();
+ line_directive_out( (FILE *) 0, 1 );
+ BEGIN(SECT2PROLOG);
+ return SECTEND;
+ }
+ YY_BREAK
+case 11:
+/* rule 11 can match eol */
+YY_RULE_SETUP
+#line 174 "scan.l"
+yytext_is_array = false; ++linenum;
+ YY_BREAK
+case 12:
+/* rule 12 can match eol */
+YY_RULE_SETUP
+#line 175 "scan.l"
+yytext_is_array = true; ++linenum;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 177 "scan.l"
+BEGIN(OPTION); return OPTION_OP;
+ YY_BREAK
+case 14:
+/* rule 14 can match eol */
+YY_RULE_SETUP
+#line 179 "scan.l"
+++linenum; /* ignore */
+ YY_BREAK
+case 15:
+/* rule 15 can match eol */
+YY_RULE_SETUP
+#line 180 "scan.l"
+++linenum; /* ignore */
+ YY_BREAK
+/* xgettext: no-c-format */
+case 16:
+/* rule 16 can match eol */
+YY_RULE_SETUP
+#line 183 "scan.l"
+synerr( _( "unrecognized '%' directive" ) );
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 185 "scan.l"
+{
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Definition name too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ didadef = false;
+ BEGIN(PICKUPDEF);
+ }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 200 "scan.l"
+RETURNNAME;
+ YY_BREAK
+case 19:
+/* rule 19 can match eol */
+YY_RULE_SETUP
+#line 201 "scan.l"
+++linenum; /* allows blank lines in section 1 */
+ YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 202 "scan.l"
+ACTION_ECHO; ++linenum; /* maybe end of comment line */
+ YY_BREAK
+
+
+case 21:
+YY_RULE_SETUP
+#line 207 "scan.l"
+ACTION_ECHO; yy_pop_state();
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 208 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 209 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 210 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 211 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 26:
+/* rule 26 can match eol */
+YY_RULE_SETUP
+#line 212 "scan.l"
+++linenum; ACTION_ECHO;
+ YY_BREAK
+
+
+/* This is the same as COMMENT, but is discarded rather than output. */
+case 27:
+YY_RULE_SETUP
+#line 217 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 218 "scan.l"
+;
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 219 "scan.l"
+;
+ YY_BREAK
+case 30:
+/* rule 30 can match eol */
+YY_RULE_SETUP
+#line 220 "scan.l"
+++linenum;
+ YY_BREAK
+
+
+case 31:
+YY_RULE_SETUP
+#line 224 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 225 "scan.l"
+;
+ YY_BREAK
+case 33:
+/* rule 33 can match eol */
+YY_RULE_SETUP
+#line 226 "scan.l"
+++linenum;
+ YY_BREAK
+
+
+case 34:
+/* rule 34 can match eol */
+YY_RULE_SETUP
+#line 230 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 231 "scan.l"
+linenum = myctoi( yytext );
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 233 "scan.l"
+{
+ flex_free( (void *) infilename );
+ infilename = copy_string( yytext + 1 );
+ infilename[strlen( infilename ) - 1] = '\0';
+ }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 238 "scan.l"
+/* ignore spurious characters */
+ YY_BREAK
+
+
+case 38:
+/* rule 38 can match eol */
+YY_RULE_SETUP
+#line 242 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 244 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 245 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 246 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 42:
+/* rule 42 can match eol */
+YY_RULE_SETUP
+#line 248 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( indented_code )
+ BEGIN(INITIAL);
+ }
+ YY_BREAK
+
+
+case 43:
+YY_RULE_SETUP
+#line 257 "scan.l"
+{
+ if( --brace_depth == 0){
+ /* TODO: Matched. */
+ yy_pop_state();
+ }else
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 265 "scan.l"
+{
+ brace_depth++;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 45:
+/* rule 45 can match eol */
+YY_RULE_SETUP
+#line 270 "scan.l"
+{
+ ++linenum;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 275 "scan.l"
+buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 276 "scan.l"
+buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 278 "scan.l"
+{
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case YY_STATE_EOF(CODEBLOCK_MATCH_BRACE):
+#line 282 "scan.l"
+{
+ linenum = brace_start_line;
+ synerr(_("Unmatched '{'"));
+ yyterminate();
+ }
+ YY_BREAK
+
+
+case 49:
+YY_RULE_SETUP
+#line 291 "scan.l"
+/* separates name and definition */
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 293 "scan.l"
+{
+ if(yyleng < MAXLINE)
+ {
+ strcpy( (char *) nmdef, yytext );
+ }
+ else
+ {
+ format_synerr( _("Definition value for {%s} too long\n"), nmstr);
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ /* Skip trailing whitespace. */
+ for ( i = strlen( (char *) nmdef ) - 1;
+ i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
+ --i )
+ ;
+
+ nmdef[i + 1] = '\0';
+
+ ndinstal( nmstr, nmdef );
+ didadef = true;
+ }
+ YY_BREAK
+case 51:
+/* rule 51 can match eol */
+YY_RULE_SETUP
+#line 315 "scan.l"
+{
+ if ( ! didadef )
+ synerr( _( "incomplete name definition" ) );
+ BEGIN(INITIAL);
+ ++linenum;
+ }
+ YY_BREAK
+
+
+case 52:
+/* rule 52 can match eol */
+YY_RULE_SETUP
+#line 325 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 326 "scan.l"
+option_sense = true;
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 328 "scan.l"
+return '=';
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 330 "scan.l"
+option_sense = ! option_sense;
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 332 "scan.l"
+csize = option_sense ? 128 : 256;
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 333 "scan.l"
+csize = option_sense ? 256 : 128;
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 335 "scan.l"
+long_align = option_sense;
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 336 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
+ interactive = option_sense;
+ }
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 340 "scan.l"
+yytext_is_array = option_sense;
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 341 "scan.l"
+ansi_func_defs = option_sense;
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 342 "scan.l"
+ansi_func_protos = option_sense;
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 343 "scan.l"
+backing_up_report = option_sense;
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 344 "scan.l"
+interactive = ! option_sense;
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 345 "scan.l"
+bison_bridge_lval = option_sense;
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 346 "scan.l"
+{ if((bison_bridge_lloc = option_sense))
+ bison_bridge_lval = true;
+ }
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 349 "scan.l"
+C_plus_plus = option_sense;
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 350 "scan.l"
+sf_set_case_ins(!option_sense);
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 351 "scan.l"
+sf_set_case_ins(option_sense);
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 352 "scan.l"
+ddebug = option_sense;
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 353 "scan.l"
+spprdflt = ! option_sense;
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 354 "scan.l"
+useecs = option_sense;
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 355 "scan.l"
+{
+ useecs = usemecs = false;
+ use_read = fullspd = true;
+ }
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 359 "scan.l"
+{
+ useecs = usemecs = false;
+ use_read = fulltbl = true;
+ }
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 363 "scan.l"
+ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 364 "scan.l"
+interactive = option_sense;
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 365 "scan.l"
+lex_compat = option_sense;
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 366 "scan.l"
+posix_compat = option_sense;
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 367 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
+ /* Override yywrap */
+ if( option_sense == true )
+ do_yywrap = false;
+ }
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 373 "scan.l"
+usemecs = option_sense;
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+#line 374 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
+ interactive = !option_sense;
+ }
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+#line 378 "scan.l"
+performance_report += option_sense ? 1 : -1;
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+#line 379 "scan.l"
+yytext_is_array = ! option_sense;
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 380 "scan.l"
+use_read = option_sense;
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+#line 381 "scan.l"
+reentrant = option_sense;
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+#line 382 "scan.l"
+reject_really_used = option_sense;
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+#line 383 "scan.l"
+ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 384 "scan.l"
+do_stdinit = option_sense;
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 385 "scan.l"
+use_stdout = option_sense;
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 386 "scan.l"
+ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ YY_BREAK
+case 91:
+YY_RULE_SETUP
+#line 387 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+#line 388 "scan.l"
+printstats = option_sense;
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+#line 389 "scan.l"
+nowarn = ! option_sense;
+ YY_BREAK
+case 94:
+YY_RULE_SETUP
+#line 390 "scan.l"
+do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+#line 391 "scan.l"
+yymore_really_used = option_sense;
+ YY_BREAK
+case 96:
+YY_RULE_SETUP
+#line 392 "scan.l"
+do_yywrap = option_sense;
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 394 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+#line 395 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
+ YY_BREAK
+case 99:
+YY_RULE_SETUP
+#line 396 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
+ YY_BREAK
+case 100:
+YY_RULE_SETUP
+#line 398 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
+ YY_BREAK
+case 101:
+YY_RULE_SETUP
+#line 399 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
+ YY_BREAK
+case 102:
+YY_RULE_SETUP
+#line 400 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
+ YY_BREAK
+case 103:
+YY_RULE_SETUP
+#line 402 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
+ YY_BREAK
+case 104:
+YY_RULE_SETUP
+#line 403 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
+ YY_BREAK
+case 105:
+YY_RULE_SETUP
+#line 404 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
+ YY_BREAK
+case 106:
+YY_RULE_SETUP
+#line 406 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
+ YY_BREAK
+case 107:
+YY_RULE_SETUP
+#line 407 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
+ YY_BREAK
+case 108:
+YY_RULE_SETUP
+#line 408 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
+ YY_BREAK
+case 109:
+YY_RULE_SETUP
+#line 409 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
+ YY_BREAK
+case 110:
+YY_RULE_SETUP
+#line 410 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
+ YY_BREAK
+case 111:
+YY_RULE_SETUP
+#line 411 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
+ YY_BREAK
+case 112:
+YY_RULE_SETUP
+#line 412 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
+ YY_BREAK
+case 113:
+YY_RULE_SETUP
+#line 413 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
+ YY_BREAK
+case 114:
+YY_RULE_SETUP
+#line 414 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
+ YY_BREAK
+case 115:
+YY_RULE_SETUP
+#line 415 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
+ YY_BREAK
+case 116:
+YY_RULE_SETUP
+#line 416 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
+ YY_BREAK
+case 117:
+YY_RULE_SETUP
+#line 417 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
+ YY_BREAK
+case 118:
+YY_RULE_SETUP
+#line 418 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
+ YY_BREAK
+case 119:
+YY_RULE_SETUP
+#line 419 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
+ YY_BREAK
+case 120:
+YY_RULE_SETUP
+#line 420 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
+ YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 421 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
+ YY_BREAK
+case 122:
+YY_RULE_SETUP
+#line 423 "scan.l"
+return OPT_EXTRA_TYPE;
+ YY_BREAK
+case 123:
+YY_RULE_SETUP
+#line 424 "scan.l"
+return OPT_OUTFILE;
+ YY_BREAK
+case 124:
+YY_RULE_SETUP
+#line 425 "scan.l"
+return OPT_PREFIX;
+ YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 426 "scan.l"
+return OPT_YYCLASS;
+ YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 427 "scan.l"
+return OPT_HEADER;
+ YY_BREAK
+case 127:
+YY_RULE_SETUP
+#line 428 "scan.l"
+return OPT_TABLES;
+ YY_BREAK
+case 128:
+YY_RULE_SETUP
+#line 429 "scan.l"
+{
+ tablesverify = option_sense;
+ if(!tablesext && option_sense)
+ tablesext = true;
+ }
+ YY_BREAK
+case 129:
+YY_RULE_SETUP
+#line 436 "scan.l"
+{
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Option line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ nmstr[strlen( nmstr ) - 1] = '\0';
+ return NAME;
+ }
+ YY_BREAK
+case 130:
+YY_RULE_SETUP
+#line 450 "scan.l"
+{
+ format_synerr( _( "unrecognized %%option: %s" ),
+ yytext );
+ BEGIN(RECOVER);
+ }
+ YY_BREAK
+
+case 131:
+/* rule 131 can match eol */
+YY_RULE_SETUP
+#line 457 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+
+case 132:
+YY_RULE_SETUP
+#line 461 "scan.l"
+++bracelevel; yyless( 2 ); /* eat only %{ */
+ YY_BREAK
+case 133:
+YY_RULE_SETUP
+#line 462 "scan.l"
+--bracelevel; yyless( 2 ); /* eat only %} */
+ YY_BREAK
+case 134:
+YY_RULE_SETUP
+#line 464 "scan.l"
+ACTION_ECHO; /* indented code in prolog */
+ YY_BREAK
+case 135:
+YY_RULE_SETUP
+#line 466 "scan.l"
+{ /* non-indented code */
+ if ( bracelevel <= 0 )
+ { /* not in %{ ... %} */
+ yyless( 0 ); /* put it all back */
+ yy_set_bol( 1 );
+ mark_prolog();
+ BEGIN(SECT2);
+ }
+ else
+ ACTION_ECHO;
+ }
+ YY_BREAK
+case 136:
+YY_RULE_SETUP
+#line 478 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 137:
+/* rule 137 can match eol */
+YY_RULE_SETUP
+#line 479 "scan.l"
+++linenum; ACTION_ECHO;
+ YY_BREAK
+case YY_STATE_EOF(SECT2PROLOG):
+#line 481 "scan.l"
+{
+ mark_prolog();
+ sectnum = 0;
+ yyterminate(); /* to stop the parser */
+ }
+ YY_BREAK
+
+
+case 138:
+/* rule 138 can match eol */
+YY_RULE_SETUP
+#line 489 "scan.l"
+++linenum; /* allow blank lines in section 2 */
+ YY_BREAK
+case 139:
+YY_RULE_SETUP
+#line 491 "scan.l"
+{
+ indented_code = false;
+ doing_codeblock = true;
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+ }
+ YY_BREAK
+case 140:
+YY_RULE_SETUP
+#line 498 "scan.l"
+{
+ /* Allow "<" to appear in (?x) patterns. */
+ if (!sf_skip_ws())
+ BEGIN(SC);
+ return '<';
+ }
+ YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 504 "scan.l"
+return '^';
+ YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 505 "scan.l"
+BEGIN(QUOTE); return '"';
+ YY_BREAK
+case 143:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 506 "scan.l"
+{
+ BEGIN(NUM);
+ if ( lex_compat || posix_compat )
+ return BEGIN_REPEAT_POSIX;
+ else
+ return BEGIN_REPEAT_FLEX;
+ }
+ YY_BREAK
+case 144:
+/* rule 144 can match eol */
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 513 "scan.l"
+return '$';
+ YY_BREAK
+case 145:
+YY_RULE_SETUP
+#line 515 "scan.l"
+{
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ YY_BREAK
+case 146:
+/* rule 146 can match eol */
+YY_RULE_SETUP
+#line 526 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ /* Push back everything starting at the "|" */
+ size_t amt;
+ amt = strchr (yytext, '|') - yytext;
+ yyless(amt);
+ }
+ else {
+ continued_action = true;
+ ++linenum;
+ return '\n';
+ }
+ }
+ YY_BREAK
+case 147:
+YY_RULE_SETUP
+#line 541 "scan.l"
+{
+
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ yy_push_state(COMMENT_DISCARD);
+ }
+ else{
+ yyless( yyleng - 2 ); /* put back '/', '*' */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ }
+ }
+ YY_BREAK
+case 148:
+YY_RULE_SETUP
+#line 555 "scan.l"
+/* allow indented rules */ ;
+ YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 557 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ }
+ else{
+ /* This rule is separate from the one below because
+ * otherwise we get variable trailing context, so
+ * we can't build the scanner using -{f,F}.
+ */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+ YY_BREAK
+case 150:
+/* rule 150 can match eol */
+YY_RULE_SETUP
+#line 579 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ ++linenum;
+ }
+ else{
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ unput( '\n' ); /* so <ACTION> sees it */
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+ YY_BREAK
+case 151:
+#line 600 "scan.l"
+case 152:
+YY_RULE_SETUP
+#line 600 "scan.l"
+return EOF_OP;
+ YY_BREAK
+case 153:
+YY_RULE_SETUP
+#line 602 "scan.l"
+{
+ sectnum = 3;
+ BEGIN(SECT3);
+ outn("/* Begin user sect3 */");
+ yyterminate(); /* to stop the parser */
+ }
+ YY_BREAK
+case 154:
+YY_RULE_SETUP
+#line 609 "scan.l"
+{
+ int cclval;
+
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ /* Check to see if we've already encountered this
+ * ccl.
+ */
+ if (0 /* <--- This "0" effectively disables the reuse of a
+ * character class (purely based on its source text).
+ * The reason it was disabled is so yacc/bison can parse
+ * ccl operations, such as ccl difference and union.
+ */
+ && (cclval = ccllookup( (Char *) nmstr )) != 0 )
+ {
+ if ( input() != ']' )
+ synerr( _( "bad character class" ) );
+
+ yylval = cclval;
+ ++cclreuse;
+ return PREVCCL;
+ }
+ else
+ {
+ /* We fudge a bit. We know that this ccl will
+ * soon be numbered as lastccl + 1 by cclinit.
+ */
+ cclinstal( (Char *) nmstr, lastccl + 1 );
+
+ /* Push back everything but the leading bracket
+ * so the ccl can be rescanned.
+ */
+ yyless( 1 );
+
+ BEGIN(FIRSTCCL);
+ return '[';
+ }
+ }
+ YY_BREAK
+case 155:
+YY_RULE_SETUP
+#line 655 "scan.l"
+return CCL_OP_DIFF;
+ YY_BREAK
+case 156:
+YY_RULE_SETUP
+#line 656 "scan.l"
+return CCL_OP_UNION;
+ YY_BREAK
+/* Check for :space: at the end of the rule so we don't
+ * wrap the expanded regex in '(' ')' -- breaking trailing
+ * context.
+ */
+case 157:
+/* rule 157 can match eol */
+YY_RULE_SETUP
+#line 663 "scan.l"
+{
+ Char *nmdefptr;
+ int end_is_ws, end_ch;
+
+ end_ch = yytext[yyleng-1];
+ end_is_ws = end_ch != '}' ? 1 : 0;
+
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
+
+ if ( (nmdefptr = ndlookup( nmstr )) == NULL )
+ format_synerr(
+ _( "undefined definition {%s}" ),
+ nmstr );
+
+ else
+ { /* push back name surrounded by ()'s */
+ int len = strlen( (char *) nmdefptr );
+ if (end_is_ws)
+ unput(end_ch);
+
+ if ( lex_compat || nmdefptr[0] == '^' ||
+ (len > 0 && nmdefptr[len - 1] == '$')
+ || (end_is_ws && trlcontxt && !sf_skip_ws()))
+ { /* don't use ()'s after all */
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+
+ if ( nmdefptr[0] == '^' )
+ BEGIN(CARETISBOL);
+ }
+
+ else
+ {
+ unput(')');
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+ unput('(');
+ }
+ }
+ }
+ YY_BREAK
+case 158:
+YY_RULE_SETUP
+#line 711 "scan.l"
+{
+ if (sf_skip_ws())
+ yy_push_state(COMMENT_DISCARD);
+ else{
+ /* Push back the "*" and return "/" as usual. */
+ yyless(1);
+ return '/';
+ }
+ }
+ YY_BREAK
+case 159:
+YY_RULE_SETUP
+#line 721 "scan.l"
+{
+ if (lex_compat || posix_compat){
+ /* Push back the "?#" and treat it like a normal parens. */
+ yyless(1);
+ sf_push();
+ return '(';
+ }
+ else
+ yy_push_state(EXTENDED_COMMENT);
+ }
+ YY_BREAK
+case 160:
+YY_RULE_SETUP
+#line 731 "scan.l"
+{
+ sf_push();
+ if (lex_compat || posix_compat)
+ /* Push back the "?" and treat it like a normal parens. */
+ yyless(1);
+ else
+ BEGIN(GROUP_WITH_PARAMS);
+ return '(';
+ }
+ YY_BREAK
+case 161:
+YY_RULE_SETUP
+#line 740 "scan.l"
+sf_push(); return '(';
+ YY_BREAK
+case 162:
+YY_RULE_SETUP
+#line 741 "scan.l"
+sf_pop(); return ')';
+ YY_BREAK
+case 163:
+YY_RULE_SETUP
+#line 743 "scan.l"
+return (unsigned char) yytext[0];
+ YY_BREAK
+case 164:
+YY_RULE_SETUP
+#line 744 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+
+
+case 165:
+/* rule 165 can match eol */
+YY_RULE_SETUP
+#line 749 "scan.l"
+++linenum; /* Allow blank lines & continuations */
+ YY_BREAK
+case 166:
+YY_RULE_SETUP
+#line 750 "scan.l"
+return (unsigned char) yytext[0];
+ YY_BREAK
+case 167:
+YY_RULE_SETUP
+#line 751 "scan.l"
+BEGIN(SECT2); return '>';
+ YY_BREAK
+case 168:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 752 "scan.l"
+BEGIN(CARETISBOL); return '>';
+ YY_BREAK
+case 169:
+YY_RULE_SETUP
+#line 753 "scan.l"
+RETURNNAME;
+ YY_BREAK
+case 170:
+YY_RULE_SETUP
+#line 754 "scan.l"
+{
+ format_synerr( _( "bad <start condition>: %s" ),
+ yytext );
+ }
+ YY_BREAK
+
+case 171:
+YY_RULE_SETUP
+#line 760 "scan.l"
+BEGIN(SECT2); return '^';
+ YY_BREAK
+
+case 172:
+YY_RULE_SETUP
+#line 764 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+case 173:
+YY_RULE_SETUP
+#line 765 "scan.l"
+BEGIN(SECT2); return '"';
+ YY_BREAK
+case 174:
+/* rule 174 can match eol */
+YY_RULE_SETUP
+#line 767 "scan.l"
+{
+ synerr( _( "missing quote" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '"';
+ }
+ YY_BREAK
+
+
+case 175:
+YY_RULE_SETUP
+#line 776 "scan.l"
+BEGIN(SECT2);
+ YY_BREAK
+case 176:
+YY_RULE_SETUP
+#line 777 "scan.l"
+BEGIN(GROUP_MINUS_PARAMS);
+ YY_BREAK
+case 177:
+YY_RULE_SETUP
+#line 778 "scan.l"
+sf_set_case_ins(1);
+ YY_BREAK
+case 178:
+YY_RULE_SETUP
+#line 779 "scan.l"
+sf_set_dot_all(1);
+ YY_BREAK
+case 179:
+YY_RULE_SETUP
+#line 780 "scan.l"
+sf_set_skip_ws(1);
+ YY_BREAK
+
+
+case 180:
+YY_RULE_SETUP
+#line 783 "scan.l"
+BEGIN(SECT2);
+ YY_BREAK
+case 181:
+YY_RULE_SETUP
+#line 784 "scan.l"
+sf_set_case_ins(0);
+ YY_BREAK
+case 182:
+YY_RULE_SETUP
+#line 785 "scan.l"
+sf_set_dot_all(0);
+ YY_BREAK
+case 183:
+YY_RULE_SETUP
+#line 786 "scan.l"
+sf_set_skip_ws(0);
+ YY_BREAK
+
+
+case 184:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 790 "scan.l"
+BEGIN(CCL); return '^';
+ YY_BREAK
+case 185:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 791 "scan.l"
+return '^';
+ YY_BREAK
+case 186:
+YY_RULE_SETUP
+#line 792 "scan.l"
+BEGIN(CCL); RETURNCHAR;
+ YY_BREAK
+
+
+case 187:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 796 "scan.l"
+return '-';
+ YY_BREAK
+case 188:
+YY_RULE_SETUP
+#line 797 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+case 189:
+YY_RULE_SETUP
+#line 798 "scan.l"
+BEGIN(SECT2); return ']';
+ YY_BREAK
+case 190:
+/* rule 190 can match eol */
+YY_RULE_SETUP
+#line 799 "scan.l"
+{
+ synerr( _( "bad character class" ) );
+ BEGIN(SECT2);
+ return ']';
+ }
+ YY_BREAK
+
+
+case 191:
+YY_RULE_SETUP
+#line 807 "scan.l"
+BEGIN(CCL); return CCE_ALNUM;
+ YY_BREAK
+case 192:
+YY_RULE_SETUP
+#line 808 "scan.l"
+BEGIN(CCL); return CCE_ALPHA;
+ YY_BREAK
+case 193:
+YY_RULE_SETUP
+#line 809 "scan.l"
+BEGIN(CCL); return CCE_BLANK;
+ YY_BREAK
+case 194:
+YY_RULE_SETUP
+#line 810 "scan.l"
+BEGIN(CCL); return CCE_CNTRL;
+ YY_BREAK
+case 195:
+YY_RULE_SETUP
+#line 811 "scan.l"
+BEGIN(CCL); return CCE_DIGIT;
+ YY_BREAK
+case 196:
+YY_RULE_SETUP
+#line 812 "scan.l"
+BEGIN(CCL); return CCE_GRAPH;
+ YY_BREAK
+case 197:
+YY_RULE_SETUP
+#line 813 "scan.l"
+BEGIN(CCL); return CCE_LOWER;
+ YY_BREAK
+case 198:
+YY_RULE_SETUP
+#line 814 "scan.l"
+BEGIN(CCL); return CCE_PRINT;
+ YY_BREAK
+case 199:
+YY_RULE_SETUP
+#line 815 "scan.l"
+BEGIN(CCL); return CCE_PUNCT;
+ YY_BREAK
+case 200:
+YY_RULE_SETUP
+#line 816 "scan.l"
+BEGIN(CCL); return CCE_SPACE;
+ YY_BREAK
+case 201:
+YY_RULE_SETUP
+#line 817 "scan.l"
+BEGIN(CCL); return CCE_UPPER;
+ YY_BREAK
+case 202:
+YY_RULE_SETUP
+#line 818 "scan.l"
+BEGIN(CCL); return CCE_XDIGIT;
+ YY_BREAK
+case 203:
+YY_RULE_SETUP
+#line 820 "scan.l"
+BEGIN(CCL); return CCE_NEG_ALNUM;
+ YY_BREAK
+case 204:
+YY_RULE_SETUP
+#line 821 "scan.l"
+BEGIN(CCL); return CCE_NEG_ALPHA;
+ YY_BREAK
+case 205:
+YY_RULE_SETUP
+#line 822 "scan.l"
+BEGIN(CCL); return CCE_NEG_BLANK;
+ YY_BREAK
+case 206:
+YY_RULE_SETUP
+#line 823 "scan.l"
+BEGIN(CCL); return CCE_NEG_CNTRL;
+ YY_BREAK
+case 207:
+YY_RULE_SETUP
+#line 824 "scan.l"
+BEGIN(CCL); return CCE_NEG_DIGIT;
+ YY_BREAK
+case 208:
+YY_RULE_SETUP
+#line 825 "scan.l"
+BEGIN(CCL); return CCE_NEG_GRAPH;
+ YY_BREAK
+case 209:
+YY_RULE_SETUP
+#line 826 "scan.l"
+BEGIN(CCL); return CCE_NEG_LOWER;
+ YY_BREAK
+case 210:
+YY_RULE_SETUP
+#line 827 "scan.l"
+BEGIN(CCL); return CCE_NEG_PRINT;
+ YY_BREAK
+case 211:
+YY_RULE_SETUP
+#line 828 "scan.l"
+BEGIN(CCL); return CCE_NEG_PUNCT;
+ YY_BREAK
+case 212:
+YY_RULE_SETUP
+#line 829 "scan.l"
+BEGIN(CCL); return CCE_NEG_SPACE;
+ YY_BREAK
+case 213:
+YY_RULE_SETUP
+#line 830 "scan.l"
+BEGIN(CCL); return CCE_NEG_UPPER;
+ YY_BREAK
+case 214:
+YY_RULE_SETUP
+#line 831 "scan.l"
+BEGIN(CCL); return CCE_NEG_XDIGIT;
+ YY_BREAK
+case 215:
+YY_RULE_SETUP
+#line 832 "scan.l"
+{
+ format_synerr(
+ _( "bad character class expression: %s" ),
+ yytext );
+ BEGIN(CCL); return CCE_ALNUM;
+ }
+ YY_BREAK
+
+
+case 216:
+YY_RULE_SETUP
+#line 841 "scan.l"
+{
+ yylval = myctoi( yytext );
+ return NUMBER;
+ }
+ YY_BREAK
+case 217:
+YY_RULE_SETUP
+#line 846 "scan.l"
+return ',';
+ YY_BREAK
+case 218:
+YY_RULE_SETUP
+#line 847 "scan.l"
+{
+ BEGIN(SECT2);
+ if ( lex_compat || posix_compat )
+ return END_REPEAT_POSIX;
+ else
+ return END_REPEAT_FLEX;
+ }
+ YY_BREAK
+case 219:
+YY_RULE_SETUP
+#line 855 "scan.l"
+{
+ synerr( _( "bad character inside {}'s" ) );
+ BEGIN(SECT2);
+ return '}';
+ }
+ YY_BREAK
+case 220:
+/* rule 220 can match eol */
+YY_RULE_SETUP
+#line 861 "scan.l"
+{
+ synerr( _( "missing }" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '}';
+ }
+ YY_BREAK
+
+
+case 221:
+YY_RULE_SETUP
+#line 871 "scan.l"
+bracelevel = 0;
+ YY_BREAK
+case 222:
+YY_RULE_SETUP
+#line 873 "scan.l"
+ACTION_ECHO; yy_push_state( COMMENT );
+ YY_BREAK
+
+case 223:
+YY_RULE_SETUP
+#line 876 "scan.l"
+{
+ ACTION_ECHO;
+ CHECK_REJECT(yytext);
+ }
+ YY_BREAK
+case 224:
+YY_RULE_SETUP
+#line 880 "scan.l"
+{
+ ACTION_ECHO;
+ CHECK_YYMORE(yytext);
+ }
+ YY_BREAK
+
+case 225:
+YY_RULE_SETUP
+#line 886 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 226:
+YY_RULE_SETUP
+#line 887 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 227:
+YY_RULE_SETUP
+#line 888 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 228:
+/* rule 228 can match eol */
+YY_RULE_SETUP
+#line 889 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 ||
+ (doing_codeblock && indented_code) )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = doing_codeblock = false;
+ BEGIN(SECT2);
+ }
+ }
+ YY_BREAK
+
+/* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */
+
+case 229:
+YY_RULE_SETUP
+#line 907 "scan.l"
+ACTION_ECHO; ++bracelevel;
+ YY_BREAK
+case 230:
+YY_RULE_SETUP
+#line 908 "scan.l"
+ACTION_ECHO; --bracelevel;
+ YY_BREAK
+case 231:
+YY_RULE_SETUP
+#line 909 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 232:
+YY_RULE_SETUP
+#line 910 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 233:
+YY_RULE_SETUP
+#line 911 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 234:
+YY_RULE_SETUP
+#line 912 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 235:
+YY_RULE_SETUP
+#line 913 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 236:
+YY_RULE_SETUP
+#line 914 "scan.l"
+ACTION_ECHO; /* character constant */
+ YY_BREAK
+case 237:
+YY_RULE_SETUP
+#line 915 "scan.l"
+ACTION_ECHO; BEGIN(ACTION_STRING);
+ YY_BREAK
+case 238:
+/* rule 238 can match eol */
+YY_RULE_SETUP
+#line 916 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = false;
+ BEGIN(SECT2);
+ }
+ }
+ YY_BREAK
+case 239:
+YY_RULE_SETUP
+#line 928 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+
+
+case 240:
+YY_RULE_SETUP
+#line 932 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 241:
+YY_RULE_SETUP
+#line 933 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 242:
+/* rule 242 can match eol */
+YY_RULE_SETUP
+#line 934 "scan.l"
+++linenum; ACTION_ECHO; BEGIN(ACTION);
+ YY_BREAK
+case 243:
+YY_RULE_SETUP
+#line 935 "scan.l"
+ACTION_ECHO; BEGIN(ACTION);
+ YY_BREAK
+case 244:
+YY_RULE_SETUP
+#line 936 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+
+case YY_STATE_EOF(COMMENT):
+case YY_STATE_EOF(COMMENT_DISCARD):
+case YY_STATE_EOF(ACTION):
+case YY_STATE_EOF(ACTION_STRING):
+#line 939 "scan.l"
+{
+ synerr( _( "EOF encountered inside an action" ) );
+ yyterminate();
+ }
+ YY_BREAK
+case YY_STATE_EOF(EXTENDED_COMMENT):
+case YY_STATE_EOF(GROUP_WITH_PARAMS):
+case YY_STATE_EOF(GROUP_MINUS_PARAMS):
+#line 944 "scan.l"
+{
+ synerr( _( "EOF encountered inside pattern" ) );
+ yyterminate();
+ }
+ YY_BREAK
+case 245:
+YY_RULE_SETUP
+#line 949 "scan.l"
+{
+ yylval = myesc( (Char *) yytext );
+
+ if ( YY_START == FIRSTCCL )
+ BEGIN(CCL);
+
+ return CHAR;
+ }
+ YY_BREAK
+
+case 246:
+YY_RULE_SETUP
+#line 960 "scan.l"
+fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
+ YY_BREAK
+case 247:
+YY_RULE_SETUP
+#line 961 "scan.l"
+fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
+ YY_BREAK
+case 248:
+/* rule 248 can match eol */
+YY_RULE_SETUP
+#line 962 "scan.l"
+ECHO;
+ YY_BREAK
+case 249:
+/* rule 249 can match eol */
+YY_RULE_SETUP
+#line 963 "scan.l"
+ECHO;
+ YY_BREAK
+case YY_STATE_EOF(SECT3):
+#line 964 "scan.l"
+sectnum = 0; yyterminate();
+ YY_BREAK
+
+case 250:
+/* rule 250 can match eol */
+YY_RULE_SETUP
+#line 967 "scan.l"
+format_synerr( _( "bad character: %s" ), yytext );
+ YY_BREAK
+case 251:
+YY_RULE_SETUP
+#line 969 "scan.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+ YY_BREAK
+#line 4127 "<stdout>"
+ case YY_STATE_EOF(INITIAL):
+ case YY_STATE_EOF(SECT2):
+ case YY_STATE_EOF(CODEBLOCK):
+ case YY_STATE_EOF(PICKUPDEF):
+ case YY_STATE_EOF(SC):
+ case YY_STATE_EOF(CARETISBOL):
+ case YY_STATE_EOF(NUM):
+ case YY_STATE_EOF(QUOTE):
+ case YY_STATE_EOF(FIRSTCCL):
+ case YY_STATE_EOF(CCL):
+ case YY_STATE_EOF(RECOVER):
+ case YY_STATE_EOF(PERCENT_BRACE_ACTION):
+ case YY_STATE_EOF(OPTION):
+ case YY_STATE_EOF(LINEDIR):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+
+ (yy_state_ptr) = (yy_state_buf);
+ *(yy_state_ptr)++ = yy_current_state;
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *(yy_state_ptr)++ = yy_current_state;
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ int yy_is_jam;
+
+ YY_CHAR yy_c = 1;
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 1106);
+ if ( ! yy_is_jam )
+ *(yy_state_ptr)++ = yy_current_state;
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+ static void yyunput (int c, char * yy_bp )
+{
+ char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ yy_size_t number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+#endif /* ifndef YY_NO_UNPUT */
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ yy_size_t i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+ static void yy_push_state (int new_state )
+{
+ if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+ {
+ yy_size_t new_size;
+
+ (yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = (yy_start_stack_depth) * sizeof( int );
+
+ if ( ! (yy_start_stack) )
+ (yy_start_stack) = (int *) yyalloc(new_size );
+
+ else
+ (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
+
+ if ( ! (yy_start_stack) )
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+ }
+
+ (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+ BEGIN(new_state);
+}
+
+ static void yy_pop_state (void)
+{
+ if ( --(yy_start_stack_ptr) < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+yy_size_t yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str )
+{
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str )
+{
+ yyout = out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug )
+{
+ yy_flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+ (yy_start_stack_ptr) = 0;
+ (yy_start_stack_depth) = 0;
+ (yy_start_stack) = NULL;
+
+ (yy_state_buf) = 0;
+ (yy_state_ptr) = 0;
+ (yy_full_match) = 0;
+ (yy_lp) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Destroy the start condition stack. */
+ yyfree((yy_start_stack) );
+ (yy_start_stack) = NULL;
+
+ yyfree ( (yy_state_buf) );
+ (yy_state_buf) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 969 "scan.l"
+
+
+
+
+int yywrap()
+ {
+ if ( --num_input_files > 0 )
+ {
+ set_input_file( *++input_files );
+ return 0;
+ }
+
+ else
+ return 1;
+ }
+
+
+/* set_input_file - open the given file (if NULL, stdin) for scanning */
+
+void set_input_file( file )
+char *file;
+ {
+ if ( file && strcmp( file, "-" ) )
+ {
+ infilename = copy_string( file );
+ yyin = fopen( infilename, "r" );
+
+ if ( yyin == NULL )
+ lerrsf( _( "can't open %s" ), file );
+ }
+
+ else
+ {
+ yyin = stdin;
+ infilename = copy_string( "<stdin>" );
+ }
+
+ linenum = 1;
+ }
+
+
+/* Wrapper routines for accessing the scanner's malloc routines. */
+
+void *flex_alloc( size )
+size_t size;
+ {
+ return (void *) malloc( size );
+ }
+
+void *flex_realloc( ptr, size )
+void *ptr;
+size_t size;
+ {
+ return (void *) realloc( ptr, size );
+ }
+
+void flex_free( ptr )
+void *ptr;
+ {
+ if ( ptr )
+ free( ptr );
+ }
+
diff --git a/usr.bin/lex/initskel.c b/usr.bin/lex/initskel.c
new file mode 100644
index 0000000..8b756a3
--- /dev/null
+++ b/usr.bin/lex/initskel.c
@@ -0,0 +1,3738 @@
+/* $FreeBSD$ */
+/* File created from flex.skl via mkskel.sh */
+
+#include "flexdef.h"
+
+const char *skel[] = {
+ "%# -*-C-*- vi: set ft=c:",
+ "%# This file is processed in several stages.",
+ "%# Here are the stages, as best as I can describe:",
+ "%#",
+ "%# 1. flex.skl is processed through GNU m4 during the",
+ "%# pre-compilation stage of flex. Only macros starting",
+ "%# with `m4_' are processed, and quoting is normal.",
+ "%#",
+ "%# 2. The preprocessed skeleton is translated verbatim into a",
+ "%# C array, saved as \"skel.c\" and compiled into the flex binary.",
+ "%#",
+ "%# 3. At runtime, the skeleton is generated and filtered (again)",
+ "%# through m4. Macros beginning with `m4_' will be processed.",
+ "%# The quoting is \"[[\" and \"]]\" so we don't interfere with",
+ "%# user code.",
+ "%# ",
+ "%# All generate macros for the m4 stage contain the text \"m4\" or \"M4\"",
+ "%# in them. This is to distinguish them from CPP macros.",
+ "%# The exception to this rule is YY_G, which is an m4 macro, ",
+ "%# but it needs to be remain short because it is used everywhere.",
+ "%#",
+ "/* A lexical scanner generated by flex */",
+ "",
+ "%# Macros for preproc stage.",
+ "",
+ "",
+ "%# Macros for runtime processing stage.",
+ "m4_changecom",
+ "m4_changequote",
+ "m4_changequote([[, ]])",
+ "",
+ "%# ",
+ "%# Lines in this skeleton starting with a \"%\" character are \"control lines\"",
+ "%# and affect the generation of the scanner. The possible control codes are",
+ "%# listed and processed in misc.c.",
+ "%#",
+ "%# %# - A comment. The current line is omitted from the generated scanner.",
+ "%# %if-c++-only - The following lines are printed for C++ scanners ONLY.",
+ "%# %if-c-only - The following lines are NOT printed for C++ scanners.",
+ "%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners.",
+ "%# %if-reentrant - Print for reentrant scanners.(push)",
+ "%# %if-not-reentrant - Print for non-reentrant scanners. (push)",
+ "%# %if-bison-bridge - Print for bison-bridge. (push)",
+ "%# %if-not-bison-bridge - Print for non-bison-bridge. (push)",
+ "%# %endif - pop from the previous if code.",
+ "%# %% - A stop-point, where code is inserted by flex.",
+ "%# Each stop-point is numbered here and also in the code generator.",
+ "%# (See gen.c, etc. for details.)",
+ "%# %not-for-header - Begin code that should NOT appear in a \".h\" file.",
+ "%# %ok-for-header - %c and %e are used for building a header file.",
+ "%# %if-tables-serialization",
+ "%#",
+ "%# All control-lines EXCEPT comment lines (\"%#\") will be inserted into",
+ "%# the generated scanner as a C-style comment. This is to aid those who",
+ "%# edit the skeleton.",
+ "%#",
+ "",
+ "%not-for-header",
+ "%if-c-only",
+ "%if-not-reentrant",
+ "m4_ifelse(M4_YY_PREFIX,yy,,",
+ "#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]",
+ "#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]",
+ "#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]",
+ "#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]",
+ "#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]",
+ "#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]",
+ "#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]",
+ "#define yyin M4_YY_PREFIX[[in]]",
+ "#define yyleng M4_YY_PREFIX[[leng]]",
+ "#define yylex M4_YY_PREFIX[[lex]]",
+ "#define yylineno M4_YY_PREFIX[[lineno]]",
+ "#define yyout M4_YY_PREFIX[[out]]",
+ "#define yyrestart M4_YY_PREFIX[[restart]]",
+ "#define yytext M4_YY_PREFIX[[text]]",
+ "#define yywrap M4_YY_PREFIX[[wrap]]",
+ "#define yyalloc M4_YY_PREFIX[[alloc]]",
+ "#define yyrealloc M4_YY_PREFIX[[realloc]]",
+ "#define yyfree M4_YY_PREFIX[[free]]",
+ ")",
+ "%endif",
+ "%endif",
+ "%ok-for-header",
+ "",
+ "#define FLEX_SCANNER",
+ "#define YY_FLEX_MAJOR_VERSION 2",
+ "#define YY_FLEX_MINOR_VERSION 5",
+ "#define YY_FLEX_SUBMINOR_VERSION 37",
+ "#if YY_FLEX_SUBMINOR_VERSION > 0",
+ "#define FLEX_BETA",
+ "#endif",
+ "",
+ "%# Some negated symbols",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])",
+ "m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])",
+ "",
+ "%# This is the m4 way to say \"(stack_used || is_reentrant)",
+ "m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])",
+ "m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])",
+ "",
+ "%# Prefixes.",
+ "%# The complexity here is necessary so that m4 preserves",
+ "%# the argument lists to each C function.",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])",
+ "",
+ "",
+ "",
+ "%if-c++-only",
+ " /* The c++ scanner is a mess. The FlexLexer.h header file relies on the",
+ " * following macro. This is required in order to pass the c++-multiple-scanners",
+ " * test in the regression suite. We get reports that it breaks inheritance.",
+ " * We will address this in a future release of flex, or omit the C++ scanner",
+ " * altogether.",
+ " */",
+ " #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]",
+ "%endif",
+ "",
+ "%if-c-only",
+ " m4_define(yy[[_create_buffer]], [[M4_YY_PREFIX[[_create_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_delete_buffer]], [[M4_YY_PREFIX[[_delete_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_buffer]], [[M4_YY_PREFIX[[_scan_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_string]], [[M4_YY_PREFIX[[_scan_string]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_bytes]], [[M4_YY_PREFIX[[_scan_bytes]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_init_buffer]], [[M4_YY_PREFIX[[_init_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_flush_buffer]], [[M4_YY_PREFIX[[_flush_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_load_buffer_state]], [[M4_YY_PREFIX[[_load_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_switch_to_buffer]], [[M4_YY_PREFIX[[_switch_to_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[push_buffer_state]], [[M4_YY_PREFIX[[push_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[pop_buffer_state]], [[M4_YY_PREFIX[[pop_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[ensure_buffer_stack]], [[M4_YY_PREFIX[[ensure_buffer_stack]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex]], [[M4_YY_PREFIX[[lex]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[restart]], [[M4_YY_PREFIX[[restart]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_init]], [[M4_YY_PREFIX[[lex_init]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_init_extra]], [[M4_YY_PREFIX[[lex_init_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_destroy]], [[M4_YY_PREFIX[[lex_destroy]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_debug]], [[M4_YY_PREFIX[[get_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_debug]], [[M4_YY_PREFIX[[set_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_extra]], [[M4_YY_PREFIX[[get_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_extra]], [[M4_YY_PREFIX[[set_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_in]], [[M4_YY_PREFIX[[get_in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_in]], [[M4_YY_PREFIX[[set_in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_out]], [[M4_YY_PREFIX[[get_out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_out]], [[M4_YY_PREFIX[[set_out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_leng]], [[M4_YY_PREFIX[[get_leng]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_text]], [[M4_YY_PREFIX[[get_text]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_lineno]], [[M4_YY_PREFIX[[get_lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lineno]], [[M4_YY_PREFIX[[set_lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " m4_define(yy[[get_column]], [[M4_YY_PREFIX[[get_column]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_column]], [[M4_YY_PREFIX[[set_column]]m4_ifelse($#,0,,[[($@)]])]])",
+ " ]])",
+ " m4_define(yy[[wrap]], [[M4_YY_PREFIX[[wrap]]m4_ifelse($#,0,,[[($@)]])]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " m4_define(yy[[get_lval]], [[M4_YY_PREFIX[[get_lval]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lval]], [[M4_YY_PREFIX[[set_lval]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_define(yy[[get_lloc]], [[M4_YY_PREFIX[[get_lloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lloc]], [[M4_YY_PREFIX[[set_lloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "",
+ " m4_define(yy[[alloc]], [[M4_YY_PREFIX[[alloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[realloc]], [[M4_YY_PREFIX[[realloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[free]], [[M4_YY_PREFIX[[free]]m4_ifelse($#,0,,[[($@)]])]])",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_define(yy[[text]], [[M4_YY_PREFIX[[text]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[leng]], [[M4_YY_PREFIX[[leng]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[in]], [[M4_YY_PREFIX[[in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[out]], [[M4_YY_PREFIX[[out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_flex_debug]], [[M4_YY_PREFIX[[_flex_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lineno]], [[M4_YY_PREFIX[[lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],",
+ "[[",
+ " m4_define(yy[[tables_fload]], [[M4_YY_PREFIX[[tables_fload]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[tables_destroy]], [[M4_YY_PREFIX[[tables_destroy]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[TABLES_NAME]], [[M4_YY_PREFIX[[TABLES_NAME]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "/* First, we deal with platform-specific or compiler-specific issues. */",
+ "",
+ "#if defined(__FreeBSD__)",
+ "#ifndef __STDC_LIMIT_MACROS",
+ "#define __STDC_LIMIT_MACROS",
+ "#endif",
+ "#include <sys/cdefs.h>",
+ "#include <stdint.h>",
+ "#else",
+ "#define __dead2",
+ "#endif",
+ "",
+ "/* begin standard C headers. */",
+ "%if-c-only",
+ "#include <stdio.h>",
+ "#include <string.h>",
+ "#include <errno.h>",
+ "#include <stdlib.h>",
+ "%endif",
+ "",
+ "%if-tables-serialization",
+ "#include <sys/types.h>",
+ "#include <netinet/in.h>",
+ "%endif",
+ "/* end standard C headers. */",
+ "",
+ "%if-c-or-c++",
+ "/* flex integer type definitions */",
+ "",
+ "#ifndef FLEXINT_H",
+ "#define FLEXINT_H",
+ "",
+ "/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */",
+ "",
+ "#if defined(__FreeBSD__) || \\",
+ " (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)",
+ "",
+ "/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,",
+ " * if you want the limit (max/min) macros for int types. ",
+ " */",
+ "#ifndef __STDC_LIMIT_MACROS",
+ "#define __STDC_LIMIT_MACROS 1",
+ "#endif",
+ "",
+ "#include <inttypes.h>",
+ "typedef int8_t flex_int8_t;",
+ "typedef uint8_t flex_uint8_t;",
+ "typedef int16_t flex_int16_t;",
+ "typedef uint16_t flex_uint16_t;",
+ "typedef int32_t flex_int32_t;",
+ "typedef uint32_t flex_uint32_t;",
+ "#else",
+ "typedef signed char flex_int8_t;",
+ "typedef short int flex_int16_t;",
+ "typedef int flex_int32_t;",
+ "typedef unsigned char flex_uint8_t; ",
+ "typedef unsigned short int flex_uint16_t;",
+ "typedef unsigned int flex_uint32_t;",
+ "",
+ "/* Limits of integral types. */",
+ "#ifndef INT8_MIN",
+ "#define INT8_MIN (-128)",
+ "#endif",
+ "#ifndef INT16_MIN",
+ "#define INT16_MIN (-32767-1)",
+ "#endif",
+ "#ifndef INT32_MIN",
+ "#define INT32_MIN (-2147483647-1)",
+ "#endif",
+ "#ifndef INT8_MAX",
+ "#define INT8_MAX (127)",
+ "#endif",
+ "#ifndef INT16_MAX",
+ "#define INT16_MAX (32767)",
+ "#endif",
+ "#ifndef INT32_MAX",
+ "#define INT32_MAX (2147483647)",
+ "#endif",
+ "#ifndef UINT8_MAX",
+ "#define UINT8_MAX (255U)",
+ "#endif",
+ "#ifndef UINT16_MAX",
+ "#define UINT16_MAX (65535U)",
+ "#endif",
+ "#ifndef UINT32_MAX",
+ "#define UINT32_MAX (4294967295U)",
+ "#endif",
+ "",
+ "#endif /* ! C99 */",
+ "",
+ "#endif /* ! FLEXINT_H */",
+ "",
+ "%endif",
+ "",
+ "%if-c++-only",
+ "/* begin standard C++ headers. */",
+ "#include <iostream> ",
+ "#include <errno.h>",
+ "#include <cstdlib>",
+ "#include <cstdio>",
+ "#include <cstring>",
+ "/* end standard C++ headers. */",
+ "%endif",
+ "",
+ "#ifdef __cplusplus",
+ "",
+ "/* The \"const\" storage-class-modifier is valid. */",
+ "#define YY_USE_CONST",
+ "",
+ "#else /* ! __cplusplus */",
+ "",
+ "/* C99 requires __STDC__ to be defined as 1. */",
+ "#if defined (__STDC__)",
+ "",
+ "#define YY_USE_CONST",
+ "",
+ "#endif /* defined (__STDC__) */",
+ "#endif /* ! __cplusplus */",
+ "",
+ "#ifdef YY_USE_CONST",
+ "#define yyconst const",
+ "#else",
+ "#define yyconst",
+ "#endif",
+ "",
+ "%# For compilers that can not handle prototypes.",
+ "%# e.g.,",
+ "%# The function prototype",
+ "%# int foo(int x, char* y);",
+ "%# ",
+ "%# ...should be written as",
+ "%# int foo M4_YY_PARAMS(int x, char* y);",
+ "%# ",
+ "%# ...which could possibly generate",
+ "%# int foo ();",
+ "%# ",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],",
+ "[[",
+ " m4_define( [[M4_YY_PARAMS]], [[()]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_PARAMS]], [[($*)]])",
+ "]])",
+ "",
+ "%not-for-header",
+ "/* Returned upon end-of-file. */",
+ "#define YY_NULL 0",
+ "%ok-for-header",
+ "",
+ "%not-for-header",
+ "/* Promotes a possibly negative, possibly signed char to an unsigned",
+ " * integer for use as an array index. If the signed char is negative,",
+ " * we want to instead treat it as an 8-bit unsigned char, hence the",
+ " * double cast.",
+ " */",
+ "#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)",
+ "%ok-for-header",
+ "",
+ "",
+ "",
+ "%if-reentrant",
+ "",
+ "/* An opaque pointer. */",
+ "#ifndef YY_TYPEDEF_YY_SCANNER_T",
+ "#define YY_TYPEDEF_YY_SCANNER_T",
+ "typedef void* yyscan_t;",
+ "#endif",
+ "",
+ "%# Declare yyguts variable",
+ "m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])",
+ "%# Perform a noop access on yyguts to prevent unused variable complains",
+ "m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])",
+ "%# For use wherever a Global is accessed or assigned.",
+ "m4_define( [[YY_G]], [[yyg->$1]])",
+ "",
+ "%# For use in function prototypes to append the additional argument.",
+ "m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])",
+ "m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])",
+ "",
+ "%# For use in function definitions to append the additional argument.",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])",
+ "]])",
+ "m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])",
+ "",
+ "%# For use in function calls to pass the additional argument.",
+ "m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])",
+ "m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])",
+ "",
+ "%# For use in function documentation to adjust for additional argument.",
+ "m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])",
+ "",
+ "/* For convenience, these vars (plus the bison vars far below)",
+ " are macros in the reentrant scanner. */",
+ "#define yyin YY_G(yyin_r)",
+ "#define yyout YY_G(yyout_r)",
+ "#define yyextra YY_G(yyextra_r)",
+ "#define yyleng YY_G(yyleng_r)",
+ "#define yytext YY_G(yytext_r)",
+ "#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)",
+ "#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)",
+ "#define yy_flex_debug YY_G(yy_flex_debug_r)",
+ "",
+ "m4_define( [[M4_YY_INCR_LINENO]],",
+ "[[ ",
+ " do{ yylineno++;",
+ " yycolumn=0;",
+ " }while(0)",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "",
+ "%if-not-reentrant",
+ "",
+ "m4_define( [[M4_YY_INCR_LINENO]],",
+ "[[ ",
+ " yylineno++;",
+ "]])",
+ "",
+ "%# Define these macros to be no-ops.",
+ "m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])",
+ "m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])",
+ "m4_define( [[YY_G]], [[($1)]])",
+ "m4_define( [[M4_YY_PROTO_LAST_ARG]])",
+ "m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])",
+ "m4_define( [[M4_YY_DEF_LAST_ARG]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])",
+ "]])",
+ "m4_define([[M4_YY_DECL_LAST_ARG]])",
+ "m4_define([[M4_YY_CALL_LAST_ARG]])",
+ "m4_define([[M4_YY_CALL_ONLY_ARG]])",
+ "m4_define( [[M4_YY_DOC_PARAM]], [[]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "%# For compilers that need traditional function definitions.",
+ "%# e.g.,",
+ "%# The function prototype taking 2 arguments",
+ "%# int foo (int x, char* y)",
+ "%#",
+ "%# ...should be written as",
+ "%# int foo YYFARGS2(int,x, char*,y)",
+ "%#",
+ "%# ...which could possibly generate",
+ "%# int foo (x,y,yyscanner)",
+ "%# int x;",
+ "%# char * y;",
+ "%# yyscan_t yyscanner;",
+ "%#",
+ "%# Generate traditional function defs",
+ " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " $3 $4; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " $3 $4; [[\\]]",
+ " $5 $6; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ "]],",
+ "[[",
+ "%# Generate C99 function defs.",
+ " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])",
+ " m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])",
+ " m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])",
+ " m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Enter a start condition. This macro really ought to take a parameter,",
+ " * but we do it the disgusting crufty way forced on us by the ()-less",
+ " * definition of BEGIN.",
+ " */",
+ "#define BEGIN YY_G(yy_start) = 1 + 2 *",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Translate the current start state into a value that can be later handed",
+ " * to BEGIN to return to the state. The YYSTATE alias is for lex",
+ " * compatibility.",
+ " */",
+ "#define YY_START ((YY_G(yy_start) - 1) / 2)",
+ "#define YYSTATE YY_START",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Action number for EOF rule of a given start state. */",
+ "#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Special action meaning \"start processing a new file\". */",
+ "#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_END_OF_BUFFER_CHAR 0",
+ "]])",
+ "",
+ "/* Size of default input buffer. */",
+ "#ifndef YY_BUF_SIZE",
+ "#define YY_BUF_SIZE 16384",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* The state buf must be large enough to hold one state per character in the main buffer.",
+ " */",
+ "#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))",
+ "]])",
+ "",
+ "",
+ "#ifndef YY_TYPEDEF_YY_BUFFER_STATE",
+ "#define YY_TYPEDEF_YY_BUFFER_STATE",
+ "typedef struct yy_buffer_state *YY_BUFFER_STATE;",
+ "#endif",
+ "",
+ "#ifndef YY_TYPEDEF_YY_SIZE_T",
+ "#define YY_TYPEDEF_YY_SIZE_T",
+ "typedef size_t yy_size_t;",
+ "#endif",
+ "",
+ "%if-not-reentrant",
+ "extern yy_size_t yyleng;",
+ "%endif",
+ "",
+ "%if-c-only",
+ "%if-not-reentrant",
+ "extern FILE *yyin, *yyout;",
+ "%endif",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define EOB_ACT_CONTINUE_SCAN 0",
+ "#define EOB_ACT_END_OF_FILE 1",
+ "#define EOB_ACT_LAST_MATCH 2",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_USE_LINENO]],",
+ " [[",
+ " /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires",
+ " * access to the local variable yy_act. Since yyless() is a macro, it would break",
+ " * existing scanners that call yyless() from OUTSIDE yylex. ",
+ " * One obvious solution it to make yy_act a global. I tried that, and saw",
+ " * a 5% performance hit in a non-yylineno scanner, because yy_act is",
+ " * normally declared as a register variable-- so it is not worth it.",
+ " */",
+ " #define YY_LESS_LINENO(n) \\",
+ " do { \\",
+ " int yyl;\\",
+ " for ( yyl = n; yyl < yyleng; ++yyl )\\",
+ " if ( yytext[yyl] == '\\n' )\\",
+ " --yylineno;\\",
+ " }while(0)",
+ " ]],",
+ " [[",
+ " #define YY_LESS_LINENO(n)",
+ " ]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Return all but the first \"n\" matched characters back to the input stream. */",
+ "#define yyless(n) \\",
+ " do \\",
+ " { \\",
+ " /* Undo effects of setting up yytext. */ \\",
+ " int yyless_macro_arg = (n); \\",
+ " YY_LESS_LINENO(yyless_macro_arg);\\",
+ " *yy_cp = YY_G(yy_hold_char); \\",
+ " YY_RESTORE_YY_MORE_OFFSET \\",
+ " YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\",
+ " YY_DO_BEFORE_ACTION; /* set up yytext again */ \\",
+ " } \\",
+ " while ( 0 )",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )",
+ "]])",
+ "",
+ "#ifndef YY_STRUCT_YY_BUFFER_STATE",
+ "#define YY_STRUCT_YY_BUFFER_STATE",
+ "struct yy_buffer_state",
+ " {",
+ "%if-c-only",
+ " FILE *yy_input_file;",
+ "%endif",
+ "",
+ "%if-c++-only",
+ " std::istream* yy_input_file;",
+ "%endif",
+ "",
+ "",
+ " char *yy_ch_buf; /* input buffer */",
+ " char *yy_buf_pos; /* current position in input buffer */",
+ "",
+ " /* Size of input buffer in bytes, not including room for EOB",
+ " * characters.",
+ " */",
+ " yy_size_t yy_buf_size;",
+ "",
+ " /* Number of characters read into yy_ch_buf, not including EOB",
+ " * characters.",
+ " */",
+ " yy_size_t yy_n_chars;",
+ "",
+ " /* Whether we \"own\" the buffer - i.e., we know we created it,",
+ " * and can realloc() it to grow it, and should free() it to",
+ " * delete it.",
+ " */",
+ " int yy_is_our_buffer;",
+ "",
+ " /* Whether this is an \"interactive\" input source; if so, and",
+ " * if we're using stdio for input, then we want to use getc()",
+ " * instead of fread(), to make sure we stop fetching input after",
+ " * each newline.",
+ " */",
+ " int yy_is_interactive;",
+ "",
+ " /* Whether we're considered to be at the beginning of a line.",
+ " * If so, '^' rules will be active on the next match, otherwise",
+ " * not.",
+ " */",
+ " int yy_at_bol;",
+ "",
+ " int yy_bs_lineno; /**< The line count. */",
+ " int yy_bs_column; /**< The column count. */",
+ " ",
+ "",
+ " /* Whether to try to fill the input buffer when we reach the",
+ " * end of it.",
+ " */",
+ " int yy_fill_buffer;",
+ "",
+ " int yy_buffer_status;",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_BUFFER_NEW 0",
+ "#define YY_BUFFER_NORMAL 1",
+ " /* When an EOF's been seen but there's still some text to process",
+ " * then we mark the buffer as YY_EOF_PENDING, to indicate that we",
+ " * shouldn't try reading from the input source any more. We might",
+ " * still have a bunch of tokens to match, though, because of",
+ " * possible backing-up.",
+ " *",
+ " * When we actually see the EOF, we change the status to \"new\"",
+ " * (via yyrestart()), so that the user can continue scanning by",
+ " * just pointing yyin at a new input file.",
+ " */",
+ "#define YY_BUFFER_EOF_PENDING 2",
+ "]])",
+ " };",
+ "#endif /* !YY_STRUCT_YY_BUFFER_STATE */",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "%not-for-header",
+ "%if-not-reentrant",
+ "",
+ "/* Stack of input buffers. */",
+ "static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */",
+ "static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */",
+ "static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */",
+ "%endif",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* We provide macros for accessing buffer states in case in the",
+ " * future we want to put the buffer states in a more general",
+ " * \"scanner state\".",
+ " *",
+ " * Returns the top of the stack, or NULL.",
+ " */",
+ "#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \\",
+ " ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \\",
+ " : NULL)",
+ "#define yy_current_buffer YY_CURRENT_BUFFER",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Same as previous macro, but useful when we know that the buffer stack is not",
+ " * NULL or when we need an lvalue. For internal use only.",
+ " */",
+ "#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]",
+ "]])",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "%if-not-reentrant",
+ "%not-for-header",
+ "/* yy_hold_char holds the character lost when yytext is formed. */",
+ "static char yy_hold_char;",
+ "static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */",
+ "yy_size_t yyleng;",
+ "",
+ "/* Points to current character in buffer. */",
+ "static char *yy_c_buf_p = (char *) 0;",
+ "static int yy_init = 0; /* whether we need to initialize */",
+ "static int yy_start = 0; /* start state number */",
+ "",
+ "/* Flag which is used to allow yywrap()'s to do buffer switches",
+ " * instead of setting up a fresh yyin. A bit of a hack ...",
+ " */",
+ "static int yy_did_buffer_switch_on_eof;",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );",
+ "void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );",
+ "void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );",
+ "void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );",
+ "void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );",
+ "void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)",
+ "]])",
+ "",
+ "YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );",
+ "",
+ "%endif",
+ "",
+ "void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );",
+ "void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );",
+ "void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_new_buffer yy_create_buffer",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_set_interactive(is_interactive) \\",
+ " { \\",
+ " if ( ! YY_CURRENT_BUFFER ){ \\",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \\",
+ " YY_CURRENT_BUFFER_LVALUE = \\",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \\",
+ " } \\",
+ " YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\",
+ " }",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_set_bol(at_bol) \\",
+ " { \\",
+ " if ( ! YY_CURRENT_BUFFER ){\\",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \\",
+ " YY_CURRENT_BUFFER_LVALUE = \\",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \\",
+ " } \\",
+ " YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\",
+ " }",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)",
+ "]])",
+ "",
+ "%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [1.5] DFA",
+ "]])",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);",
+ "static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG ) __dead2;",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Done after the current pattern has been matched and before the",
+ " * corresponding action - sets up yytext.",
+ " */",
+ "#define YY_DO_BEFORE_ACTION \\",
+ " YY_G(yytext_ptr) = yy_bp; \\",
+ "%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \\",
+ " YY_G(yy_hold_char) = *yy_cp; \\",
+ " *yy_cp = '\\0'; \\",
+ "%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \\",
+ " YY_G(yy_c_buf_p) = yy_cp;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [4.0] data tables for the DFA and the user's section 1 definitions go here",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])",
+ "M4_YY_SC_DEFS",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,",
+ "[[",
+ "#ifndef YY_NO_UNISTD_H",
+ "/* Special case for \"unistd.h\", since it is non-ANSI. We include it way",
+ " * down here because we want the user's section 1 to have been scanned first.",
+ " * The user has a chance to override it with an option.",
+ " */",
+ "%if-c-only",
+ "#include <unistd.h>",
+ "%endif",
+ "%if-c++-only",
+ "#include <unistd.h>",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],",
+ "[[",
+ "#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS",
+ "]],",
+ "[[",
+ "#ifndef YY_EXTRA_TYPE",
+ "#define YY_EXTRA_TYPE void *",
+ "#endif",
+ "]]",
+ ")",
+ "",
+ "%if-c-only Reentrant structure and macros (non-C++).",
+ "%if-reentrant",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Holds the entire state of the reentrant scanner. */",
+ "struct yyguts_t",
+ " {",
+ "",
+ " /* User-defined. Not touched by flex. */",
+ " YY_EXTRA_TYPE yyextra_r;",
+ "",
+ " /* The rest are the same as the globals declared in the non-reentrant scanner. */",
+ " FILE *yyin_r, *yyout_r;",
+ " size_t yy_buffer_stack_top; /**< index of top of stack. */",
+ " size_t yy_buffer_stack_max; /**< capacity of stack. */",
+ " YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */",
+ " char yy_hold_char;",
+ " yy_size_t yy_n_chars;",
+ " yy_size_t yyleng_r;",
+ " char *yy_c_buf_p;",
+ " int yy_init;",
+ " int yy_start;",
+ " int yy_did_buffer_switch_on_eof;",
+ " int yy_start_stack_ptr;",
+ " int yy_start_stack_depth;",
+ " int *yy_start_stack;",
+ " yy_state_type yy_last_accepting_state;",
+ " char* yy_last_accepting_cpos;",
+ "",
+ " int yylineno_r;",
+ " int yy_flex_debug_r;",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yy_state_type *yy_state_buf;",
+ " yy_state_type *yy_state_ptr;",
+ " char *yy_full_match;",
+ " int yy_lp;",
+ "",
+ " /* These are only needed for trailing context rules,",
+ " * but there's no conditional variable for that yet. */",
+ " int yy_looking_for_trail_begin;",
+ " int yy_full_lp;",
+ " int *yy_full_state;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],",
+ "[[",
+ " char yytext_r[YYLMAX];",
+ " char *yytext_ptr;",
+ " int yy_more_offset;",
+ " int yy_prev_more_offset;",
+ "]],",
+ "[[",
+ " char *yytext_r;",
+ " int yy_more_flag;",
+ " int yy_more_len;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " YYSTYPE * yylval_r;",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " YYLTYPE * yylloc_r;",
+ "]])",
+ "",
+ " }; /* end struct yyguts_t */",
+ "]])",
+ "",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "%endif",
+ "",
+ "%if-reentrant",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ " [[",
+ " /* This must go here because YYSTYPE and YYLTYPE are included",
+ " * from bison output in section 1.*/",
+ " # define yylval YY_G(yylval_r)",
+ " ]])",
+ "",
+ " m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ " [[",
+ " # define yylloc YY_G(yylloc_r)",
+ " ]])",
+ "]])",
+ "",
+ "int yylex_init M4_YY_PARAMS(yyscan_t* scanner);",
+ "",
+ "int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);",
+ "",
+ "%endif",
+ "",
+ "%endif End reentrant structures and macros.",
+ "",
+ "/* Accessor methods to globals.",
+ " These are made visible to non-reentrant scanners for convenience. */",
+ "",
+ "m4_ifdef( [[M4_YY_NO_DESTROY]],,",
+ "[[",
+ "int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,",
+ "[[",
+ "int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,",
+ "[[",
+ "void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,",
+ "[[",
+ "YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,",
+ "[[",
+ "void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_IN]],,",
+ "[[",
+ "FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_IN]],,",
+ "[[",
+ "void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_OUT]],,",
+ "[[",
+ "FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_OUT]],,",
+ "[[",
+ "void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LENG]],,",
+ "[[",
+ "yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_TEXT]],,",
+ "[[",
+ "char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LINENO]],,",
+ "[[",
+ "int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LINENO]],,",
+ "[[",
+ "void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+ "[[",
+ "int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+ "[[",
+ "void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "]])",
+ "",
+ "%if-bison-bridge",
+ "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
+ "[[",
+ "YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_GET_LLOC]],,",
+ " [[",
+ " YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ "",
+ " m4_ifdef( [[M4_YY_NO_SET_LLOC]],,",
+ " [[",
+ " void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );",
+ " ]])",
+ "]])",
+ "%endif",
+ "",
+ "/* Macros after this point can all be overridden by user definitions in",
+ " * section 1.",
+ " */",
+ "",
+ "#ifndef YY_SKIP_YYWRAP",
+ "#ifdef __cplusplus",
+ "extern \"C\" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#else",
+ "extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#endif",
+ "#endif",
+ "",
+ "%not-for-header",
+ " m4_ifdef( [[M4_YY_NO_UNPUT]],,",
+ " [[",
+ "#ifndef YY_NO_UNPUT",
+ " static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);",
+ "#endif",
+ " ]])",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "#ifndef yytext_ptr",
+ "static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);",
+ "#endif",
+ "",
+ "#ifdef YY_NEED_STRLEN",
+ "static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);",
+ "#endif",
+ "",
+ "#ifndef YY_NO_INPUT",
+ "%if-c-only Standard (non-C++) definition",
+ "%not-for-header",
+ "#ifdef __cplusplus",
+ "static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#else",
+ "static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#endif",
+ "%ok-for-header",
+ "%endif",
+ "#endif",
+ "",
+ "",
+ "%if-c-only",
+ "%# TODO: This is messy.",
+ "m4_ifdef( [[M4_YY_STACK_USED]],",
+ "[[",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ " [[",
+ " static int yy_start_stack_ptr = 0;",
+ " static int yy_start_stack_depth = 0;",
+ " static int *yy_start_stack = NULL;",
+ " ]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,",
+ " [[",
+ " static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);",
+ " ]])",
+ " m4_ifdef( [[M4_YY_NO_POP_STATE]],,",
+ " [[",
+ " static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ " m4_ifdef( [[M4_YY_NO_TOP_STATE]],,",
+ " [[",
+ " static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ "]])",
+ "",
+ "]],",
+ "[[",
+ "m4_define( [[M4_YY_NO_PUSH_STATE]])",
+ "m4_define( [[M4_YY_NO_POP_STATE]])",
+ "m4_define( [[M4_YY_NO_TOP_STATE]])",
+ "]])",
+ "%endif",
+ "",
+ "/* Amount of stuff to slurp up with each read. */",
+ "#ifndef YY_READ_BUF_SIZE",
+ "#define YY_READ_BUF_SIZE 8192",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Copy whatever the last rule matched to the standard output. */",
+ "#ifndef ECHO",
+ "%if-c-only Standard (non-C++) definition",
+ "/* This used to be an fputs(), but since the string might contain NUL's,",
+ " * we now use fwrite().",
+ " */",
+ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define ECHO LexerOutput( yytext, yyleng )",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Gets input and stuffs it into \"buf\". number of characters read, or YY_NULL,",
+ " * is returned in \"result\".",
+ " */",
+ "#ifndef YY_INPUT",
+ "#define YY_INPUT(buf,result,max_size) \\",
+ "%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \\",
+ "\\",
+ "%if-c++-only C++ definition \\",
+ " if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \\",
+ " YY_FATAL_ERROR( \"input in flex scanner failed\" );",
+ "%endif",
+ "",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* No semi-colon after return; correct usage is to write \"yyterminate();\" -",
+ " * we don't want an extra ';' after the \"return\" because that will cause",
+ " * some compilers to complain about unreachable statements.",
+ " */",
+ "#ifndef yyterminate",
+ "#define yyterminate() return YY_NULL",
+ "#endif",
+ "]])",
+ "",
+ "/* Number of entries by which start-condition stack grows. */",
+ "#ifndef YY_START_STACK_INCR",
+ "#define YY_START_STACK_INCR 25",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Report a fatal error. */",
+ "#ifndef YY_FATAL_ERROR",
+ "%if-c-only",
+ "#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)",
+ "%endif",
+ "%if-c++-only",
+ "#define YY_FATAL_ERROR(msg) LexerError( msg )",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "%if-tables-serialization structures and prototypes",
+ "#ifdef FLEX_SCANNER",
+ "/*",
+ "dnl tables_shared.h - tables serialization header",
+ "dnl",
+ "dnl Copyright (c) 1990 The Regents of the University of California.",
+ "dnl All rights reserved.",
+ "dnl",
+ "dnl This code is derived from software contributed to Berkeley by",
+ "dnl Vern Paxson.",
+ "dnl",
+ "dnl The United States Government has rights in this work pursuant",
+ "dnl to contract no. DE-AC03-76SF00098 between the United States",
+ "dnl Department of Energy and the University of California.",
+ "dnl",
+ "dnl This file is part of flex.",
+ "dnl",
+ "dnl Redistribution and use in source and binary forms, with or without",
+ "dnl modification, are permitted provided that the following conditions",
+ "dnl are met:",
+ "dnl",
+ "dnl 1. Redistributions of source code must retain the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer.",
+ "dnl 2. Redistributions in binary form must reproduce the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer in the",
+ "dnl documentation and/or other materials provided with the distribution.",
+ "dnl",
+ "dnl Neither the name of the University nor the names of its contributors",
+ "dnl may be used to endorse or promote products derived from this software",
+ "dnl without specific prior written permission.",
+ "dnl",
+ "dnl THIS SOFTWARE IS PROVIDED `AS IS' AND WITHOUT ANY EXPRESS OR",
+ "dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED",
+ "dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
+ "dnl PURPOSE.",
+ " ",
+ "dnl",
+ "dnl This file is meant to be included in both the skeleton and the actual",
+ "dnl flex code (hence the name \"_shared\").",
+ "*/",
+ "#ifndef yyskel_static",
+ "#define yyskel_static static",
+ "#endif",
+ "#else",
+ "#ifndef yyskel_static",
+ "#define yyskel_static",
+ "#endif",
+ "#endif",
+ "",
+ "/* Structures and prototypes for serializing flex tables. The",
+ " * binary format is documented in the manual.",
+ " *",
+ " * Design considerations:",
+ " *",
+ " * - The format allows many tables per file.",
+ " * - The tables can be streamed.",
+ " * - All data is stored in network byte order.",
+ " * - We do not hinder future unicode support.",
+ " * - We can lookup tables by name.",
+ " */",
+ "",
+ "/** Magic number for serialized format. */",
+ "#ifndef YYTBL_MAGIC",
+ "#define YYTBL_MAGIC 0xF13C57B1",
+ "#endif",
+ "",
+ "/** Calculate (0-7) = number bytes needed to pad n to next 64-bit boundary. */",
+ "#ifndef yypad64",
+ "#define yypad64(n) ((8-((n)%8))%8)",
+ "#endif",
+ "",
+ "",
+ "#ifndef YYTABLES_TYPES",
+ "#define YYTABLES_TYPES",
+ "/** Possible values for td_id field. Each one corresponds to a",
+ " * scanner table of the same name.",
+ " */",
+ "enum yytbl_id {",
+ " YYTD_ID_ACCEPT = 0x01, /**< 1-dim ints */",
+ " YYTD_ID_BASE = 0x02, /**< 1-dim ints */",
+ " YYTD_ID_CHK = 0x03, /**< 1-dim ints */",
+ " YYTD_ID_DEF = 0x04, /**< 1-dim ints */",
+ " YYTD_ID_EC = 0x05, /**< 1-dim ints */",
+ " YYTD_ID_META = 0x06, /**< 1-dim ints */",
+ " YYTD_ID_NUL_TRANS = 0x07, /**< 1-dim ints, maybe indices */",
+ " YYTD_ID_NXT = 0x08, /**< may be 2 dimensional ints */",
+ " YYTD_ID_RULE_CAN_MATCH_EOL = 0x09, /**< 1-dim ints */",
+ " YYTD_ID_START_STATE_LIST = 0x0A, /**< 1-dim indices into trans tbl */",
+ " YYTD_ID_TRANSITION = 0x0B, /**< structs */",
+ " YYTD_ID_ACCLIST = 0x0C /**< 1-dim ints */",
+ "};",
+ "",
+ "/** bit flags for t_flags field of struct yytbl_data */",
+ "enum yytbl_flags {",
+ " /* These first three are mutually exclusive */",
+ " YYTD_DATA8 = 0x01, /**< data is an array of type flex_int8_t */",
+ " YYTD_DATA16 = 0x02, /**< data is an array of type flex_int16_t */",
+ " YYTD_DATA32 = 0x04, /**< data is an array of type flex_int32_t */",
+ "",
+ " /* These two are mutually exclusive. */",
+ " YYTD_PTRANS = 0x08, /**< data is a list of indexes of entries",
+ " into the expanded yy_transition",
+ " array. See notes in manual. */",
+ " YYTD_STRUCT = 0x10 /**< data consists of yy_trans_info structs */",
+ "};",
+ "",
+ "/* The serialized tables header. */",
+ "struct yytbl_hdr {",
+ " flex_uint32_t th_magic; /**< Must be 0xF13C57B1 (comes from \"Flex Table\") */",
+ " flex_uint32_t th_hsize; /**< Size of this header in bytes. */",
+ " flex_uint32_t th_ssize; /**< Size of this dataset, in bytes, including header. */",
+ " flex_uint16_t th_flags; /**< Currently unused, must be 0 */",
+ " char *th_version; /**< Flex version string. NUL terminated. */",
+ " char *th_name; /**< The name of this table set. NUL terminated. */",
+ "};",
+ "",
+ "/** A single serialized table */",
+ "struct yytbl_data {",
+ " flex_uint16_t td_id; /**< enum yytbl_id table identifier */",
+ " flex_uint16_t td_flags; /**< how to interpret this data */",
+ " flex_uint32_t td_hilen; /**< num elements in highest dimension array */",
+ " flex_uint32_t td_lolen; /**< num elements in lowest dimension array */",
+ " void *td_data; /**< table data */",
+ "};",
+ "#endif",
+ "",
+ "/** Extract corresponding data size_t from td_flags */",
+ "#ifndef YYTDFLAGS2BYTES",
+ "#define YYTDFLAGS2BYTES(td_flags)\\",
+ " (((td_flags) & YYTD_DATA8)\\",
+ " ? sizeof(flex_int8_t)\\",
+ " :(((td_flags) & YYTD_DATA16)\\",
+ " ? sizeof(flex_int16_t)\\",
+ " :sizeof(flex_int32_t)))",
+ "#endif",
+ "",
+ "#ifdef FLEX_SCANNER",
+ "%not-for-header",
+ "#endif",
+ "yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);",
+ "#ifdef FLEX_SCANNER",
+ "%ok-for-header",
+ "#endif",
+ "",
+ "/* vim:set noexpandtab cindent tabstop=8 softtabstop=0 shiftwidth=8 textwidth=0: */",
+ "",
+ "",
+ "/* Load the DFA tables from the given stream. */",
+ "int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);",
+ "",
+ "/* Unload the tables from memory. */",
+ "int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);",
+ "%not-for-header",
+ "",
+ "/** Describes a mapping from a serialized table id to its deserialized state in",
+ " * this scanner. This is the bridge between our \"generic\" deserialization code",
+ " * and the specifics of this scanner. ",
+ " */",
+ "struct yytbl_dmap {",
+ " enum yytbl_id dm_id;/**< table identifier */",
+ " void **dm_arr; /**< address of pointer to store the deserialized table. */",
+ " size_t dm_sz; /**< local sizeof() each element in table. */",
+ "};",
+ "",
+ "/** A {0,0,0}-terminated list of structs, forming the map */",
+ "static struct yytbl_dmap yydmap[] =",
+ "{",
+ "%tables-yydmap generated elements",
+ " {0,0,0}",
+ "};",
+ "",
+ "/** A tables-reader object to maintain some state in the read. */",
+ "struct yytbl_reader {",
+ " FILE * fp; /**< input stream */",
+ " flex_uint32_t bread; /**< bytes read since beginning of current tableset */",
+ "};",
+ "",
+ "%endif",
+ "/* end tables serialization structures and prototypes */",
+ "",
+ "%ok-for-header",
+ "",
+ "/* Default declaration of generated scanner - a define so the user can",
+ " * easily add parameters.",
+ " */",
+ "#ifndef YY_DECL",
+ "#define YY_DECL_IS_OURS 1",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "",
+ "m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])",
+ "m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " m4_dnl The bison pure parser is used. Redefine yylex to",
+ " m4_dnl accept the lval parameter.",
+ "",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
+ " [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
+ " [[YYFARGS1(YYSTYPE *,yylval_param)]])",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_dnl Locations are used. yylex should also accept the ylloc parameter.",
+ "",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
+ " [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
+ " [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])",
+ "]])",
+ "",
+ "extern int yylex M4_YY_LEX_PROTO;",
+ "",
+ "#define YY_DECL int yylex M4_YY_LEX_DECLARATION",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define YY_DECL int yyFlexLexer::yylex()",
+ "%endif",
+ "#endif /* !YY_DECL */",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Code executed at the beginning of each rule, after yytext and yyleng",
+ " * have been set up.",
+ " */",
+ "#ifndef YY_USER_ACTION",
+ "#define YY_USER_ACTION",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Code executed at the end of each rule. */",
+ "#ifndef YY_BREAK",
+ "#define YY_BREAK break;",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [6.0] YY_RULE_SETUP definition goes here",
+ "]])",
+ "",
+ "%not-for-header",
+ "/** The main scanner function which does all the work.",
+ " */",
+ "YY_DECL",
+ "{",
+ " yy_state_type yy_current_state;",
+ " char *yy_cp, *yy_bp;",
+ " int yy_act;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ " [[",
+ " YYSTYPE * yylval;",
+ " ]])",
+ " m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ " [[",
+ " YYLTYPE * yylloc;",
+ " ]])",
+ "]])",
+ "",
+ "%% [7.0] user's declarations go here",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " yylval = yylval_param;",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " yylloc = yylloc_param;",
+ "]])",
+ "",
+ " if ( !YY_G(yy_init) )",
+ " {",
+ " YY_G(yy_init) = 1;",
+ "",
+ "#ifdef YY_USER_INIT",
+ " YY_USER_INIT;",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " /* Create the reject buffer large enough to save one state per allowed character. */",
+ " if ( ! YY_G(yy_state_buf) )",
+ " YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_state_buf) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
+ "]])",
+ "",
+ " if ( ! YY_G(yy_start) )",
+ " YY_G(yy_start) = 1; /* first start state */",
+ "",
+ " if ( ! yyin )",
+ "%if-c-only",
+ " yyin = stdin;",
+ "%endif",
+ "%if-c++-only",
+ " yyin = & std::cin;",
+ "%endif",
+ "",
+ " if ( ! yyout )",
+ "%if-c-only",
+ " yyout = stdout;",
+ "%endif",
+ "%if-c++-only",
+ " yyout = & std::cout;",
+ "%endif",
+ "",
+ " if ( ! YY_CURRENT_BUFFER ) {",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE =",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " }",
+ "",
+ " while ( 1 ) /* loops until end-of-file is reached */",
+ " {",
+ "%% [8.0] yymore()-related code goes here",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ "",
+ " /* Support of yytext. */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ "",
+ " /* yy_bp points to the position in yy_ch_buf of the start of",
+ " * the current run.",
+ " */",
+ " yy_bp = yy_cp;",
+ "",
+ "%% [9.0] code to set up and find next match goes here",
+ "",
+ "yy_find_action:",
+ "%% [10.0] code to find the action number goes here",
+ "",
+ " YY_DO_BEFORE_ACTION;",
+ "",
+ "%% [11.0] code for yylineno update goes here",
+ "",
+ "do_action: /* This label is used only to access EOF actions. */",
+ "",
+ "%% [12.0] debug code goes here",
+ "",
+ " switch ( yy_act )",
+ " { /* beginning of action switch */",
+ "%% [13.0] actions go here",
+ "",
+ " case YY_END_OF_BUFFER:",
+ " {",
+ " /* Amount of text matched not including the EOB char. */",
+ " int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;",
+ "",
+ " /* Undo the effects of YY_DO_BEFORE_ACTION. */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ " YY_RESTORE_YY_MORE_OFFSET",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )",
+ " {",
+ " /* We're scanning a new file or input source. It's",
+ " * possible that this happened because the user",
+ " * just pointed yyin at a new source and called",
+ " * yylex(). If so, then we have to assure",
+ " * consistency between YY_CURRENT_BUFFER and our",
+ " * globals. Here is the right place to do so, because",
+ " * this is the first action (other than possibly a",
+ " * back-up) that will match for the new input source.",
+ " */",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;",
+ " }",
+ "",
+ " /* Note that here we test for yy_c_buf_p \"<=\" to the position",
+ " * of the first EOB in the buffer, since yy_c_buf_p will",
+ " * already have been incremented past the NUL character",
+ " * (since all states make transitions on EOB to the",
+ " * end-of-buffer state). Contrast this with the test",
+ " * in input().",
+ " */",
+ " if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )",
+ " { /* This was really a NUL. */",
+ " yy_state_type yy_next_state;",
+ "",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " /* Okay, we're now positioned to make the NUL",
+ " * transition. We couldn't have",
+ " * yy_get_previous_state() go ahead and do it",
+ " * for us because it doesn't know how to deal",
+ " * with the possibility of jamming (and we don't",
+ " * want to build jamming into it because then it",
+ " * will run more slowly).",
+ " */",
+ "",
+ " yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);",
+ "",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ "",
+ " if ( yy_next_state )",
+ " {",
+ " /* Consume the NUL. */",
+ " yy_cp = ++YY_G(yy_c_buf_p);",
+ " yy_current_state = yy_next_state;",
+ " goto yy_match;",
+ " }",
+ "",
+ " else",
+ " {",
+ "%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here",
+ " goto yy_find_action;",
+ " }",
+ " }",
+ "",
+ " else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " case EOB_ACT_END_OF_FILE:",
+ " {",
+ " YY_G(yy_did_buffer_switch_on_eof) = 0;",
+ "",
+ " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " /* Note: because we've taken care in",
+ " * yy_get_next_buffer() to have set up",
+ " * yytext, we can now set up",
+ " * yy_c_buf_p so that if some total",
+ " * hoser (like flex itself) wants to",
+ " * call the scanner after we return the",
+ " * YY_NULL, it'll still work - another",
+ " * YY_NULL will get returned.",
+ " */",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ "",
+ " yy_act = YY_STATE_EOF(YY_START);",
+ " goto do_action;",
+ " }",
+ "",
+ " else",
+ " {",
+ " if ( ! YY_G(yy_did_buffer_switch_on_eof) )",
+ " YY_NEW_FILE;",
+ " }",
+ " break;",
+ " }",
+ "",
+ " case EOB_ACT_CONTINUE_SCAN:",
+ " YY_G(yy_c_buf_p) =",
+ " YY_G(yytext_ptr) + yy_amount_of_matched_text;",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ " goto yy_match;",
+ "",
+ " case EOB_ACT_LAST_MATCH:",
+ " YY_G(yy_c_buf_p) =",
+ " &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ " goto yy_find_action;",
+ " }",
+ " break;",
+ " }",
+ "",
+ " default:",
+ " YY_FATAL_ERROR(",
+ " \"fatal flex scanner internal error--no action found\" );",
+ " } /* end of action switch */",
+ " } /* end of scanning one token */",
+ "} /* end of yylex */",
+ "%ok-for-header",
+ "",
+ "%if-c++-only",
+ "%not-for-header",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )",
+ "{",
+ " yyin = arg_yyin;",
+ " yyout = arg_yyout;",
+ " yy_c_buf_p = 0;",
+ " yy_init = 0;",
+ " yy_start = 0;",
+ " yy_flex_debug = 0;",
+ " yylineno = 1; // this will only get updated if %option yylineno",
+ "",
+ " yy_did_buffer_switch_on_eof = 0;",
+ "",
+ " yy_looking_for_trail_begin = 0;",
+ " yy_more_flag = 0;",
+ " yy_more_len = 0;",
+ " yy_more_offset = yy_prev_more_offset = 0;",
+ "",
+ " yy_start_stack_ptr = yy_start_stack_depth = 0;",
+ " yy_start_stack = NULL;",
+ "",
+ " yy_buffer_stack = 0;",
+ " yy_buffer_stack_top = 0;",
+ " yy_buffer_stack_max = 0;",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];",
+ "]],",
+ "[[",
+ " yy_state_buf = 0;",
+ "]])",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "yyFlexLexer::~yyFlexLexer()",
+ "{",
+ " delete [] yy_state_buf;",
+ " yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )",
+ "{",
+ " if ( new_in )",
+ " {",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " if ( new_out )",
+ " yyout = new_out;",
+ "}",
+ "",
+ "#ifdef YY_INTERACTIVE",
+ "int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )",
+ "#else",
+ "int yyFlexLexer::LexerInput( char* buf, int max_size )",
+ "#endif",
+ "{",
+ " if ( yyin->eof() || yyin->fail() )",
+ " return 0;",
+ "",
+ "#ifdef YY_INTERACTIVE",
+ " yyin->get( buf[0] );",
+ "",
+ " if ( yyin->eof() )",
+ " return 0;",
+ "",
+ " if ( yyin->bad() )",
+ " return -1;",
+ "",
+ " return 1;",
+ "",
+ "#else",
+ " (void) yyin->read( buf, max_size );",
+ "",
+ " if ( yyin->bad() )",
+ " return -1;",
+ " else",
+ " return yyin->gcount();",
+ "#endif",
+ "}",
+ "",
+ "void yyFlexLexer::LexerOutput( const char* buf, int size )",
+ "{",
+ " (void) yyout->write( buf, size );",
+ "}",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* yy_get_next_buffer - try to read in a new buffer",
+ " *",
+ " * Returns a code representing an action:",
+ " * EOB_ACT_LAST_MATCH -",
+ " * EOB_ACT_CONTINUE_SCAN - continue scanning from current position",
+ " * EOB_ACT_END_OF_FILE - end of file",
+ " */",
+ "%if-c-only",
+ "static int yy_get_next_buffer YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "int yyFlexLexer::yy_get_next_buffer()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;",
+ " char *source = YY_G(yytext_ptr);",
+ " int number_to_move, i;",
+ " int ret_val;",
+ "",
+ " if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )",
+ " YY_FATAL_ERROR(",
+ " \"fatal flex scanner internal error--end of buffer missed\" );",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )",
+ " { /* Don't try to fill the buffer, so this is an EOF. */",
+ " if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )",
+ " {",
+ " /* We matched a single character, the EOB, so",
+ " * treat this as a final EOF.",
+ " */",
+ " return EOB_ACT_END_OF_FILE;",
+ " }",
+ "",
+ " else",
+ " {",
+ " /* We matched some text prior to the EOB, first",
+ " * process it.",
+ " */",
+ " return EOB_ACT_LAST_MATCH;",
+ " }",
+ " }",
+ "",
+ " /* Try to read more data. */",
+ "",
+ " /* First move last chars to start of buffer. */",
+ " number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;",
+ "",
+ " for ( i = 0; i < number_to_move; ++i )",
+ " *(dest++) = *(source++);",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )",
+ " /* don't do the read, it's not guaranteed to return an EOF,",
+ " * just force an EOF",
+ " */",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;",
+ "",
+ " else",
+ " {",
+ " yy_size_t num_to_read =",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;",
+ "",
+ " while ( num_to_read <= 0 )",
+ " { /* Not enough room in the buffer - grow it. */",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " YY_FATAL_ERROR(",
+ "\"input buffer overflow, can't enlarge buffer because scanner uses REJECT\" );",
+ "]],",
+ "[[",
+ " /* just a shorter name for the current buffer */",
+ " YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;",
+ "",
+ " int yy_c_buf_p_offset =",
+ " (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);",
+ "",
+ " if ( b->yy_is_our_buffer )",
+ " {",
+ " yy_size_t new_size = b->yy_buf_size * 2;",
+ "",
+ " if ( new_size <= 0 )",
+ " b->yy_buf_size += b->yy_buf_size / 8;",
+ " else",
+ " b->yy_buf_size *= 2;",
+ "",
+ " b->yy_ch_buf = (char *)",
+ " /* Include room in for 2 EOB chars. */",
+ " yyrealloc( (void *) b->yy_ch_buf,",
+ " b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );",
+ " }",
+ " else",
+ " /* Can't grow it, we don't own it. */",
+ " b->yy_ch_buf = 0;",
+ "",
+ " if ( ! b->yy_ch_buf )",
+ " YY_FATAL_ERROR(",
+ " \"fatal error - scanner input buffer overflow\" );",
+ "",
+ " YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];",
+ "",
+ " num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -",
+ " number_to_move - 1;",
+ "]])",
+ " }",
+ "",
+ " if ( num_to_read > YY_READ_BUF_SIZE )",
+ " num_to_read = YY_READ_BUF_SIZE;",
+ "",
+ " /* Read in more data. */",
+ " YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),",
+ " YY_G(yy_n_chars), num_to_read );",
+ "",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " if ( YY_G(yy_n_chars) == 0 )",
+ " {",
+ " if ( number_to_move == YY_MORE_ADJ )",
+ " {",
+ " ret_val = EOB_ACT_END_OF_FILE;",
+ " yyrestart( yyin M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " else",
+ " {",
+ " ret_val = EOB_ACT_LAST_MATCH;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =",
+ " YY_BUFFER_EOF_PENDING;",
+ " }",
+ " }",
+ "",
+ " else",
+ " ret_val = EOB_ACT_CONTINUE_SCAN;",
+ "",
+ " if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {",
+ " /* Extend the array by 50%, plus the number we really need. */",
+ " yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(",
+ " (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );",
+ " if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );",
+ " }",
+ "",
+ " YY_G(yy_n_chars) += number_to_move;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];",
+ "",
+ " return ret_val;",
+ "}",
+ "]])",
+ "",
+ "/* yy_get_previous_state - get the state just before the EOB char was reached */",
+ "",
+ "%if-c-only",
+ "%not-for-header",
+ " static yy_state_type yy_get_previous_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " yy_state_type yyFlexLexer::yy_get_previous_state()",
+ "%endif",
+ "{",
+ " yy_state_type yy_current_state;",
+ " char *yy_cp;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ "%% [15.0] code to get the start state into yy_current_state goes here",
+ "",
+ " for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )",
+ " {",
+ "%% [16.0] code to find the next state goes here",
+ " }",
+ "",
+ " return yy_current_state;",
+ "}",
+ "",
+ "",
+ "/* yy_try_NUL_trans - try to make a transition on the NUL character",
+ " *",
+ " * synopsis",
+ " * next_state = yy_try_NUL_trans( current_state );",
+ " */",
+ "%if-c-only",
+ " static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)",
+ "%endif",
+ "%if-c++-only",
+ " yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )",
+ "%endif",
+ "{",
+ " int yy_is_jam;",
+ " M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */",
+ "%% [17.0] code to find the next state, and perhaps do backing up, goes here",
+ "",
+ " M4_YY_NOOP_GUTS_VAR();",
+ " return yy_is_jam ? 0 : yy_current_state;",
+ "}",
+ "",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NO_UNPUT]],,",
+ "[[",
+ "#ifndef YY_NO_UNPUT",
+ " static void yyunput YYFARGS2( int,c, char *,yy_bp)",
+ "%endif",
+ "%if-c++-only",
+ "#ifndef YY_NO_UNPUT",
+ " void yyFlexLexer::yyunput( int c, char* yy_bp)",
+ "%endif",
+ "{",
+ " char *yy_cp;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ "",
+ " /* undo effects of setting up yytext */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ "",
+ " if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )",
+ " { /* need to shift things up to make room */",
+ " /* +2 for EOB chars. */",
+ " yy_size_t number_to_move = YY_G(yy_n_chars) + 2;",
+ " char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];",
+ " char *source =",
+ " &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];",
+ "",
+ " while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )",
+ " *--dest = *--source;",
+ "",
+ " yy_cp += (int) (dest - source);",
+ " yy_bp += (int) (dest - source);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars =",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;",
+ "",
+ " if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )",
+ " YY_FATAL_ERROR( \"flex scanner push-back overflow\" );",
+ " }",
+ "",
+ " *--yy_cp = (char) c;",
+ "",
+ "%% [18.0] update yylineno here",
+ "m4_ifdef( [[M4_YY_USE_LINENO]],",
+ "[[",
+ " if ( c == '\\n' ){",
+ " --yylineno;",
+ " }",
+ "]])",
+ "",
+ " YY_G(yytext_ptr) = yy_bp;",
+ " YY_G(yy_hold_char) = *yy_cp;",
+ " YY_G(yy_c_buf_p) = yy_cp;",
+ "}",
+ "#endif /* ifndef YY_NO_UNPUT */",
+ "%if-c-only",
+ "]])",
+ "%endif",
+ "",
+ "%if-c-only",
+ "#ifndef YY_NO_INPUT",
+ "#ifdef __cplusplus",
+ " static int yyinput YYFARGS0(void)",
+ "#else",
+ " static int input YYFARGS0(void)",
+ "#endif",
+ "",
+ "%endif",
+ "%if-c++-only",
+ " int yyFlexLexer::yyinput()",
+ "%endif",
+ "{",
+ " int c;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ "",
+ " if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )",
+ " {",
+ " /* yy_c_buf_p now points to the character we want to return.",
+ " * If this occurs *before* the EOB characters, then it's a",
+ " * valid NUL; if not, then we've hit the end of the buffer.",
+ " */",
+ " if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )",
+ " /* This was really a NUL. */",
+ " *YY_G(yy_c_buf_p) = '\\0';",
+ "",
+ " else",
+ " { /* need more input */",
+ " yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);",
+ " ++YY_G(yy_c_buf_p);",
+ "",
+ " switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " case EOB_ACT_LAST_MATCH:",
+ " /* This happens because yy_g_n_b()",
+ " * sees that we've accumulated a",
+ " * token and flags that we need to",
+ " * try matching the token before",
+ " * proceeding. But for input(),",
+ " * there's no matching to consider.",
+ " * So convert the EOB_ACT_LAST_MATCH",
+ " * to EOB_ACT_END_OF_FILE.",
+ " */",
+ "",
+ " /* Reset buffer status. */",
+ " yyrestart( yyin M4_YY_CALL_LAST_ARG);",
+ "",
+ " /*FALLTHROUGH*/",
+ "",
+ " case EOB_ACT_END_OF_FILE:",
+ " {",
+ " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )",
+ " return EOF;",
+ "",
+ " if ( ! YY_G(yy_did_buffer_switch_on_eof) )",
+ " YY_NEW_FILE;",
+ "#ifdef __cplusplus",
+ " return yyinput(M4_YY_CALL_ONLY_ARG);",
+ "#else",
+ " return input(M4_YY_CALL_ONLY_ARG);",
+ "#endif",
+ " }",
+ "",
+ " case EOB_ACT_CONTINUE_SCAN:",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;",
+ " break;",
+ " }",
+ " }",
+ " }",
+ "",
+ " c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */",
+ " *YY_G(yy_c_buf_p) = '\\0'; /* preserve yytext */",
+ " YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);",
+ "",
+ "%% [19.0] update BOL and yylineno",
+ "",
+ " return c;",
+ "}",
+ "%if-c-only",
+ "#endif /* ifndef YY_NO_INPUT */",
+ "%endif",
+ "",
+ "/** Immediately switch to a different input stream.",
+ " * @param input_file A readable stream.",
+ " * M4_YY_DOC_PARAM",
+ " * @note This function does not reset the start condition to @c INITIAL .",
+ " */",
+ "%if-c-only",
+ " void yyrestart YYFARGS1( FILE *,input_file)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yyrestart( std::istream* input_file )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( ! YY_CURRENT_BUFFER ){",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE =",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "}",
+ "",
+ "/** Switch to a different input buffer.",
+ " * @param new_buffer The new input buffer.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* TODO. We should be able to replace this entire function body",
+ " * with",
+ " * yypop_buffer_state();",
+ " * yypush_buffer_state(new_buffer);",
+ " */",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " if ( YY_CURRENT_BUFFER == new_buffer )",
+ " return;",
+ "",
+ " if ( YY_CURRENT_BUFFER )",
+ " {",
+ " /* Flush out information for old buffer. */",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " YY_CURRENT_BUFFER_LVALUE = new_buffer;",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " /* We don't actually know whether we did this switch during",
+ " * EOF (yywrap()) processing, but the only time this flag",
+ " * is looked at is after yywrap() is called, so it's safe",
+ " * to go ahead and always set it.",
+ " */",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ "}",
+ "",
+ "",
+ "%if-c-only",
+ "static void yy_load_buffer_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_load_buffer_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;",
+ " YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;",
+ " yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;",
+ " YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);",
+ "}",
+ "",
+ "/** Allocate and initialize an input buffer state.",
+ " * @param file A readable stream.",
+ " * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the allocated buffer state.",
+ " */",
+ "%if-c-only",
+ " YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)",
+ "%endif",
+ "%if-c++-only",
+ " YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )",
+ "%endif",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
+ "",
+ " b->yy_buf_size = size;",
+ "",
+ " /* yy_ch_buf has to be 2 characters longer than the size given because",
+ " * we need to put in 2 end-of-buffer characters.",
+ " */",
+ " b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );",
+ " if ( ! b->yy_ch_buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
+ "",
+ " b->yy_is_our_buffer = 1;",
+ "",
+ " yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);",
+ "",
+ " return b;",
+ "}",
+ "",
+ "/** Destroy the buffer.",
+ " * @param b a buffer created with yy_create_buffer()",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( ! b )",
+ " return;",
+ "",
+ " if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */",
+ " YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;",
+ "",
+ " if ( b->yy_is_our_buffer )",
+ " yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );",
+ "",
+ " yyfree( (void *) b M4_YY_CALL_LAST_ARG );",
+ "}",
+ "",
+ "",
+ "/* Initializes or reinitializes a buffer.",
+ " * This function is sometimes called more than once on the same buffer,",
+ " * such as during a yyrestart() or at EOF.",
+ " */",
+ "%if-c-only",
+ " static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )",
+ "%endif",
+ "",
+ "{",
+ " int oerrno = errno;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " yy_flush_buffer( b M4_YY_CALL_LAST_ARG);",
+ "",
+ " b->yy_input_file = file;",
+ " b->yy_fill_buffer = 1;",
+ "",
+ " /* If b is the current buffer, then yy_init_buffer was _probably_",
+ " * called from yyrestart() or through yy_get_next_buffer.",
+ " * In that case, we don't want to reset the lineno or column.",
+ " */",
+ " if (b != YY_CURRENT_BUFFER){",
+ " b->yy_bs_lineno = 1;",
+ " b->yy_bs_column = 0;",
+ " }",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],",
+ "[[",
+ " b->yy_is_interactive = 1;",
+ "]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],",
+ " [[",
+ " b->yy_is_interactive = 0;",
+ " ]],",
+ " [[",
+ " b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;",
+ " ]])",
+ "]])",
+ "%endif",
+ "%if-c++-only",
+ " b->yy_is_interactive = 0;",
+ "%endif",
+ " errno = oerrno;",
+ "}",
+ "",
+ "/** Discard all buffered characters. On the next scan, YY_INPUT will be called.",
+ " * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( ! b )",
+ " return;",
+ "",
+ " b->yy_n_chars = 0;",
+ "",
+ " /* We always need two end-of-buffer characters. The first causes",
+ " * a transition to the end-of-buffer state. The second causes",
+ " * a jam in that state.",
+ " */",
+ " b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;",
+ " b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " b->yy_buf_pos = &b->yy_ch_buf[0];",
+ "",
+ " b->yy_at_bol = 1;",
+ " b->yy_buffer_status = YY_BUFFER_NEW;",
+ "",
+ " if ( b == YY_CURRENT_BUFFER )",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "}",
+ "",
+ "%if-c-or-c++",
+ "/** Pushes the new state onto the stack. The new state becomes",
+ " * the current state. This function will allocate the stack",
+ " * if necessary.",
+ " * @param new_buffer The new state.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ "void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if (new_buffer == NULL)",
+ " return;",
+ "",
+ " yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);",
+ "",
+ " /* This block is copied from yy_switch_to_buffer. */",
+ " if ( YY_CURRENT_BUFFER )",
+ " {",
+ " /* Flush out information for old buffer. */",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " /* Only push if top exists. Otherwise, replace top. */",
+ " if (YY_CURRENT_BUFFER)",
+ " YY_G(yy_buffer_stack_top)++;",
+ " YY_CURRENT_BUFFER_LVALUE = new_buffer;",
+ "",
+ " /* copied from yy_switch_to_buffer. */",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-or-c++",
+ "/** Removes and deletes the top of the stack, if present.",
+ " * The next element becomes the new top.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ "void yypop_buffer_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yypop_buffer_state (void)",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if (!YY_CURRENT_BUFFER)",
+ " return;",
+ "",
+ " yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE = NULL;",
+ " if (YY_G(yy_buffer_stack_top) > 0)",
+ " --YY_G(yy_buffer_stack_top);",
+ "",
+ " if (YY_CURRENT_BUFFER) {",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ " }",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-or-c++",
+ "/* Allocates the stack if it does not exist.",
+ " * Guarantees space for at least one push.",
+ " */",
+ "%if-c-only",
+ "static void yyensure_buffer_stack YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yyensure_buffer_stack(void)",
+ "%endif",
+ "{",
+ " yy_size_t num_to_alloc;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if (!YY_G(yy_buffer_stack)) {",
+ "",
+ " /* First allocation is just for 2 elements, since we don't know if this",
+ " * scanner will even need a stack. We use 2 instead of 1 to avoid an",
+ " * immediate realloc on the next call.",
+ " */",
+ " num_to_alloc = 1;",
+ " YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc",
+ " (num_to_alloc * sizeof(struct yy_buffer_state*)",
+ " M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_buffer_stack) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );",
+ " ",
+ " ",
+ " memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));",
+ " ",
+ " YY_G(yy_buffer_stack_max) = num_to_alloc;",
+ " YY_G(yy_buffer_stack_top) = 0;",
+ " return;",
+ " }",
+ "",
+ " if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){",
+ "",
+ " /* Increase the buffer to prepare for a possible push. */",
+ " int grow_size = 8 /* arbitrary grow size */;",
+ "",
+ " num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;",
+ " YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc",
+ " (YY_G(yy_buffer_stack),",
+ " num_to_alloc * sizeof(struct yy_buffer_state*)",
+ " M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_buffer_stack) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );",
+ "",
+ " /* zero only the new slots.*/",
+ " memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));",
+ " YY_G(yy_buffer_stack_max) = num_to_alloc;",
+ " }",
+ "}",
+ "%endif",
+ "",
+ "",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan directly from a user-specified character buffer.",
+ " * @param base the character buffer",
+ " * @param size the size in bytes of the character buffer",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object. ",
+ " */",
+ "YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( size < 2 ||",
+ " base[size-2] != YY_END_OF_BUFFER_CHAR ||",
+ " base[size-1] != YY_END_OF_BUFFER_CHAR )",
+ " /* They forgot to leave room for the EOB's. */",
+ " return 0;",
+ "",
+ " b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );",
+ "",
+ " b->yy_buf_size = size - 2; /* \"- 2\" to take care of EOB's */",
+ " b->yy_buf_pos = b->yy_ch_buf = base;",
+ " b->yy_is_our_buffer = 0;",
+ " b->yy_input_file = 0;",
+ " b->yy_n_chars = b->yy_buf_size;",
+ " b->yy_is_interactive = 0;",
+ " b->yy_at_bol = 1;",
+ " b->yy_fill_buffer = 0;",
+ " b->yy_buffer_status = YY_BUFFER_NEW;",
+ "",
+ " yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );",
+ "",
+ " return b;",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan a string. The next call to yylex() will",
+ " * scan from a @e copy of @a str.",
+ " * @param yystr a NUL-terminated string to scan",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object.",
+ " * @note If you want to scan bytes that may contain NUL values, then use",
+ " * yy_scan_bytes() instead.",
+ " */",
+ "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)",
+ "{",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan the given bytes. The next call to yylex() will",
+ " * scan from a @e copy of @a bytes.",
+ " * @param yybytes the byte buffer to scan",
+ " * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object.",
+ " */",
+ "YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " char *buf;",
+ " yy_size_t n;",
+ " yy_size_t i;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* Get memory for full buffer, including space for trailing EOB's. */",
+ " n = _yybytes_len + 2;",
+ " buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );",
+ " if ( ! buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );",
+ "",
+ " for ( i = 0; i < _yybytes_len; ++i )",
+ " buf[i] = yybytes[i];",
+ "",
+ " buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );",
+ "",
+ " /* It's okay to grow etc. this buffer, and we should throw it",
+ " * away when we're done.",
+ " */",
+ " b->yy_is_our_buffer = 1;",
+ "",
+ " return b;",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static void yy_push_state YYFARGS1( int ,new_state)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_push_state( int new_state )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )",
+ " {",
+ " yy_size_t new_size;",
+ "",
+ " YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;",
+ " new_size = YY_G(yy_start_stack_depth) * sizeof( int );",
+ "",
+ " if ( ! YY_G(yy_start_stack) )",
+ " YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );",
+ "",
+ " else",
+ " YY_G(yy_start_stack) = (int *) yyrealloc(",
+ " (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );",
+ "",
+ " if ( ! YY_G(yy_start_stack) )",
+ " YY_FATAL_ERROR( \"out of memory expanding start-condition stack\" );",
+ " }",
+ "",
+ " YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;",
+ "",
+ " BEGIN(new_state);",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_POP_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static void yy_pop_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_pop_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( --YY_G(yy_start_stack_ptr) < 0 )",
+ " YY_FATAL_ERROR( \"start-condition stack underflow\" );",
+ "",
+ " BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_TOP_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static int yy_top_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " int yyFlexLexer::yy_top_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];",
+ "}",
+ "]])",
+ "",
+ "#ifndef YY_EXIT_FAILURE",
+ "#define YY_EXIT_FAILURE 2",
+ "#endif",
+ "",
+ "%if-c-only",
+ "static void yy_fatal_error YYFARGS1(yyconst char*, msg)",
+ "{",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ " (void) fprintf( stderr, \"%s\\n\", msg );",
+ " exit( YY_EXIT_FAILURE );",
+ "}",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::LexerError( yyconst char msg[] )",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " std::cerr << msg << std::endl;",
+ " exit( YY_EXIT_FAILURE );",
+ "}",
+ "%endif",
+ "",
+ "/* Redefine yyless() so it works in section 3 code. */",
+ "",
+ "#undef yyless",
+ "#define yyless(n) \\",
+ " do \\",
+ " { \\",
+ " /* Undo effects of setting up yytext. */ \\",
+ " int yyless_macro_arg = (n); \\",
+ " YY_LESS_LINENO(yyless_macro_arg);\\",
+ " yytext[yyleng] = YY_G(yy_hold_char); \\",
+ " YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \\",
+ " YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \\",
+ " *YY_G(yy_c_buf_p) = '\\0'; \\",
+ " yyleng = yyless_macro_arg; \\",
+ " } \\",
+ " while ( 0 )",
+ "",
+ "",
+ "",
+ "/* Accessor methods (get/set functions) to struct members. */",
+ "",
+ "%if-c-only",
+ "%if-reentrant",
+ "m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,",
+ "[[",
+ "/** Get the user-defined data for this scanner.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "YY_EXTRA_TYPE yyget_extra YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyextra;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LINENO]],,",
+ "[[",
+ "/** Get the current line number.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "int yyget_lineno YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " ",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " if (! YY_CURRENT_BUFFER)",
+ " return 0;",
+ " ]])",
+ " return yylineno;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+ "[[",
+ "/** Get the current column number.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "int yyget_column YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " ",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " if (! YY_CURRENT_BUFFER)",
+ " return 0;",
+ " ]])",
+ " return yycolumn;",
+ "}",
+ "]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_IN]],,",
+ "[[",
+ "/** Get the input stream.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "FILE *yyget_in YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyin;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_OUT]],,",
+ "[[",
+ "/** Get the output stream.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "FILE *yyget_out YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyout;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LENG]],,",
+ "[[",
+ "/** Get the length of the current token.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "yy_size_t yyget_leng YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyleng;",
+ "}",
+ "]])",
+ "",
+ "/** Get the current token.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_GET_TEXT]],,",
+ "[[",
+ "char *yyget_text YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yytext;",
+ "}",
+ "]])",
+ "",
+ "%if-reentrant",
+ "m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,",
+ "[[",
+ "/** Set the user-defined data. This data is never touched by the scanner.",
+ " * @param user_defined The data to be associated with this scanner.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyextra = user_defined ;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LINENO]],,",
+ "[[",
+ "/** Set the current line number.",
+ " * @param line_number",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_lineno YYFARGS1( int ,line_number)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " /* lineno is only valid if an input buffer exists. */",
+ " if (! YY_CURRENT_BUFFER )",
+ " YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );",
+ " ]])",
+ " yylineno = line_number;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+ "[[",
+ "/** Set the current column.",
+ " * @param line_number",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_column YYFARGS1( int , column_no)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " /* column is only valid if an input buffer exists. */",
+ " if (! YY_CURRENT_BUFFER )",
+ " YY_FATAL_ERROR( \"yyset_column called with no buffer\" );",
+ " ]])",
+ " yycolumn = column_no;",
+ "}",
+ "]])",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_IN]],,",
+ "[[",
+ "/** Set the input stream. This does not discard the current",
+ " * input buffer.",
+ " * @param in_str A readable stream.",
+ " * M4_YY_DOC_PARAM",
+ " * @see yy_switch_to_buffer",
+ " */",
+ "void yyset_in YYFARGS1( FILE * ,in_str)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyin = in_str ;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_OUT]],,",
+ "[[",
+ "void yyset_out YYFARGS1( FILE * ,out_str)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyout = out_str ;",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,",
+ "[[",
+ "int yyget_debug YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yy_flex_debug;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,",
+ "[[",
+ "void yyset_debug YYFARGS1( int ,bdebug)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yy_flex_debug = bdebug ;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "%if-reentrant",
+ "/* Accessor methods for yylval and yylloc */",
+ "",
+ "%if-bison-bridge",
+ "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
+ "[[",
+ "YYSTYPE * yyget_lval YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yylval;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LVAL]],,",
+ "[[",
+ "void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yylval = yylval_param;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_GET_LLOC]],,",
+ " [[",
+ "YYLTYPE *yyget_lloc YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yylloc;",
+ "}",
+ " ]])",
+ "",
+ " m4_ifdef( [[M4_YY_NO_SET_LLOC]],,",
+ " [[",
+ "void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yylloc = yylloc_param;",
+ "}",
+ " ]])",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "/* User-visible API */",
+ "",
+ "/* yylex_init is special because it creates the scanner itself, so it is",
+ " * the ONLY reentrant function that doesn't take the scanner as the last argument.",
+ " * That's why we explicitly handle the declaration, instead of using our macros.",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "int yylex_init( ptr_yy_globals )",
+ " yyscan_t* ptr_yy_globals;",
+ "]],",
+ "[[",
+ "int yylex_init(yyscan_t* ptr_yy_globals)",
+ "]])",
+ "{",
+ " if (ptr_yy_globals == NULL){",
+ " errno = EINVAL;",
+ " return 1;",
+ " }",
+ "",
+ " *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );",
+ "",
+ " if (*ptr_yy_globals == NULL){",
+ " errno = ENOMEM;",
+ " return 1;",
+ " }",
+ "",
+ " /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */",
+ " memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));",
+ "",
+ " return yy_init_globals ( *ptr_yy_globals );",
+ "}",
+ "",
+ "",
+ "/* yylex_init_extra has the same functionality as yylex_init, but follows the",
+ " * convention of taking the scanner as the last argument. Note however, that",
+ " * this is a *pointer* to a scanner, as it will be allocated by this call (and",
+ " * is the reason, too, why this function also must handle its own declaration).",
+ " * The user defined value in the first argument will be available to yyalloc in",
+ " * the yyextra field.",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "int yylex_init_extra( yy_user_defined, ptr_yy_globals )",
+ " YY_EXTRA_TYPE yy_user_defined;",
+ " yyscan_t* ptr_yy_globals;",
+ "]],",
+ "[[",
+ "int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )",
+ "]])",
+ "{",
+ " struct yyguts_t dummy_yyguts;",
+ "",
+ " yyset_extra (yy_user_defined, &dummy_yyguts);",
+ "",
+ " if (ptr_yy_globals == NULL){",
+ " errno = EINVAL;",
+ " return 1;",
+ " }",
+ " ",
+ " *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );",
+ " ",
+ " if (*ptr_yy_globals == NULL){",
+ " errno = ENOMEM;",
+ " return 1;",
+ " }",
+ " ",
+ " /* By setting to 0xAA, we expose bugs in",
+ " yy_init_globals. Leave at 0x00 for releases. */",
+ " memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));",
+ " ",
+ " yyset_extra (yy_user_defined, *ptr_yy_globals);",
+ " ",
+ " return yy_init_globals ( *ptr_yy_globals );",
+ "}",
+ "",
+ "%endif if-c-only",
+ "",
+ "",
+ "%if-c-only",
+ "static int yy_init_globals YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " /* Initialization is the same as for the non-reentrant scanner.",
+ " * This function is called from yylex_destroy(), so don't allocate here.",
+ " */",
+ "",
+ "m4_ifdef( [[M4_YY_USE_LINENO]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ " [[",
+ " /* We do not touch yylineno unless the option is enabled. */",
+ " yylineno = 1;",
+ " ]])",
+ "]])",
+ " YY_G(yy_buffer_stack) = 0;",
+ " YY_G(yy_buffer_stack_top) = 0;",
+ " YY_G(yy_buffer_stack_max) = 0;",
+ " YY_G(yy_c_buf_p) = (char *) 0;",
+ " YY_G(yy_init) = 0;",
+ " YY_G(yy_start) = 0;",
+ "",
+ "m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],",
+ "[[",
+ " YY_G(yy_start_stack_ptr) = 0;",
+ " YY_G(yy_start_stack_depth) = 0;",
+ " YY_G(yy_start_stack) = NULL;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " YY_G(yy_state_buf) = 0;",
+ " YY_G(yy_state_ptr) = 0;",
+ " YY_G(yy_full_match) = 0;",
+ " YY_G(yy_lp) = 0;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],",
+ "[[",
+ " YY_G(yytext_ptr) = 0;",
+ " YY_G(yy_more_offset) = 0;",
+ " YY_G(yy_prev_more_offset) = 0;",
+ "]])",
+ "",
+ "/* Defined in main.c */",
+ "#ifdef YY_STDINIT",
+ " yyin = stdin;",
+ " yyout = stdout;",
+ "#else",
+ " yyin = (FILE *) 0;",
+ " yyout = (FILE *) 0;",
+ "#endif",
+ "",
+ " /* For future reference: Set errno on error, since we are called by",
+ " * yylex_init()",
+ " */",
+ " return 0;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-only SNIP! this currently causes conflicts with the c++ scanner",
+ "/* yylex_destroy is for both reentrant and non-reentrant scanners. */",
+ "int yylex_destroy YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* Pop the buffer stack, destroying each element. */",
+ " while(YY_CURRENT_BUFFER){",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );",
+ " YY_CURRENT_BUFFER_LVALUE = NULL;",
+ " yypop_buffer_state(M4_YY_CALL_ONLY_ARG);",
+ " }",
+ "",
+ " /* Destroy the stack itself. */",
+ " yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);",
+ " YY_G(yy_buffer_stack) = NULL;",
+ "",
+ "m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],",
+ "[[",
+ " /* Destroy the start condition stack. */",
+ " yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );",
+ " YY_G(yy_start_stack) = NULL;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);",
+ " YY_G(yy_state_buf) = NULL;",
+ "]])",
+ "",
+ " /* Reset the globals. This is important in a non-reentrant scanner so the next time",
+ " * yylex() is called, initialization will occur. */",
+ " yy_init_globals( M4_YY_CALL_ONLY_ARG);",
+ "",
+ "%if-reentrant",
+ " /* Destroy the main struct (reentrant only). */",
+ " yyfree ( yyscanner M4_YY_CALL_LAST_ARG );",
+ " yyscanner = NULL;",
+ "%endif",
+ " return 0;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/*",
+ " * Internal utility routines.",
+ " */",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#ifndef yytext_ptr",
+ "static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)",
+ "{",
+ " int i;",
+ " for ( i = 0; i < n; ++i )",
+ " s1[i] = s2[i];",
+ "}",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#ifdef YY_NEED_STRLEN",
+ "static int yy_flex_strlen YYFARGS1( yyconst char *,s)",
+ "{",
+ " int n;",
+ " for ( n = 0; s[n]; ++n )",
+ " ;",
+ "",
+ " return n;",
+ "}",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,",
+ "[[",
+ "void *yyalloc YYFARGS1( yy_size_t ,size)",
+ "{",
+ " return (void *) malloc( size );",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,",
+ "[[",
+ "void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)",
+ "{",
+ " /* The cast to (char *) in the following accommodates both",
+ " * implementations that use char* generic pointers, and those",
+ " * that use void* generic pointers. It works with the latter",
+ " * because both ANSI C and C++ allow castless assignment from",
+ " * any pointer type to void*, and deal with argument conversions",
+ " * as though doing an assignment.",
+ " */",
+ " return (void *) realloc( (char *) ptr, size );",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,",
+ "[[",
+ "void yyfree YYFARGS1( void *,ptr)",
+ "{",
+ " free( (char *) ptr ); /* see yyrealloc() for (char *) cast */",
+ "}",
+ "]])",
+ "",
+ "%if-tables-serialization definitions",
+ "#ifdef FLEX_SCANNER",
+ "/*",
+ "dnl tables_shared.c - tables serialization code",
+ "dnl ",
+ "dnl Copyright (c) 1990 The Regents of the University of California.",
+ "dnl All rights reserved.",
+ "dnl ",
+ "dnl This code is derived from software contributed to Berkeley by",
+ "dnl Vern Paxson.",
+ "dnl ",
+ "dnl The United States Government has rights in this work pursuant",
+ "dnl to contract no. DE-AC03-76SF00098 between the United States",
+ "dnl Department of Energy and the University of California.",
+ "dnl ",
+ "dnl This file is part of flex.",
+ "dnl ",
+ "dnl Redistribution and use in source and binary forms, with or without",
+ "dnl modification, are permitted provided that the following conditions",
+ "dnl are met:",
+ "dnl ",
+ "dnl 1. Redistributions of source code must retain the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer.",
+ "dnl 2. Redistributions in binary form must reproduce the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer in the",
+ "dnl documentation and/or other materials provided with the distribution.",
+ "dnl ",
+ "dnl Neither the name of the University nor the names of its contributors",
+ "dnl may be used to endorse or promote products derived from this software",
+ "dnl without specific prior written permission.",
+ "dnl ",
+ "dnl THIS SOFTWARE IS PROVIDED `AS IS' AND WITHOUT ANY EXPRESS OR",
+ "dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED",
+ "dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
+ "dnl PURPOSE.",
+ "dnl ",
+ "*/",
+ " ",
+ "/* This file is meant to be included in both the skeleton and the actual",
+ " * flex code (hence the name \"_shared\"). ",
+ " */",
+ "#ifndef yyskel_static",
+ "#define yyskel_static static",
+ "#endif",
+ "#else",
+ "#include \"flexdef.h\"",
+ "#include \"tables.h\"",
+ "#ifndef yyskel_static",
+ "#define yyskel_static",
+ "#endif",
+ "#endif",
+ "",
+ "",
+ "/** Get the number of integers in this table. This is NOT the",
+ " * same thing as the number of elements.",
+ " * @param td the table ",
+ " * @return the number of integers in the table",
+ " */",
+ "yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)",
+ "{",
+ " flex_int32_t n;",
+ "",
+ " /* total number of ints */",
+ " n = tbl->td_lolen;",
+ " if (tbl->td_hilen > 0)",
+ " n *= tbl->td_hilen;",
+ "",
+ " if (tbl->td_id == YYTD_ID_TRANSITION)",
+ " n *= 2;",
+ " return n;",
+ "}",
+ "",
+ "",
+ "static int yytbl_read8 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " rd->bread += sizeof(flex_uint8_t);",
+ " return 0;",
+ "}",
+ "",
+ "static int yytbl_read16 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));",
+ " rd->bread += sizeof(flex_uint16_t);",
+ " return 0;",
+ "}",
+ "",
+ "static int yytbl_read32 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));",
+ " rd->bread += sizeof(flex_uint32_t);",
+ " return 0;",
+ "}",
+ "",
+ "/** Read the header */",
+ "static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)",
+ "{",
+ " int bytes;",
+ " memset (th, 0, sizeof (struct yytbl_hdr));",
+ "",
+ " if (yytbl_read32 (&(th->th_magic), rd) != 0)",
+ " return -1;",
+ "",
+ " if (th->th_magic != YYTBL_MAGIC){",
+ " YY_FATAL_ERROR( \"bad magic number\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " if (yytbl_read32 (&(th->th_hsize), rd) != 0",
+ " || yytbl_read32 (&(th->th_ssize), rd) != 0",
+ " || yytbl_read16 (&(th->th_flags), rd) != 0)",
+ " return -1;",
+ "",
+ " /* Sanity check on header size. Greater than 1k suggests some funny business. */",
+ " if (th->th_hsize < 16 || th->th_hsize > 1024){",
+ " YY_FATAL_ERROR( \"insane header size detected\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* Allocate enough space for the version and name fields */",
+ " bytes = th->th_hsize - 14;",
+ " th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);",
+ " if ( ! th->th_version )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_hdr_read()\" );",
+ "",
+ " /* we read it all into th_version, and point th_name into that data */",
+ " if (fread (th->th_version, 1, bytes, rd->fp) != bytes){",
+ " errno = EIO;",
+ " yyfree(th->th_version M4_YY_CALL_LAST_ARG);",
+ " th->th_version = NULL;",
+ " return -1;",
+ " }",
+ " else",
+ " rd->bread += bytes;",
+ "",
+ " th->th_name = th->th_version + strlen (th->th_version) + 1;",
+ " return 0;",
+ "}",
+ "",
+ "/** lookup id in the dmap list.",
+ " * @param dmap pointer to first element in list",
+ " * @return NULL if not found.",
+ " */",
+ "static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,",
+ " int, id)",
+ "{",
+ " while (dmap->dm_id)",
+ " if (dmap->dm_id == id)",
+ " return dmap;",
+ " else",
+ " dmap++;",
+ " return NULL;",
+ "}",
+ "",
+ "/** Read a table while mapping its contents to the local array. ",
+ " * @param dmap used to performing mapping",
+ " * @return 0 on success",
+ " */",
+ "static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)",
+ "{",
+ " struct yytbl_data td;",
+ " struct yytbl_dmap *transdmap=0;",
+ " int len, i, rv, inner_loop_count;",
+ " void *p=0;",
+ "",
+ " memset (&td, 0, sizeof (struct yytbl_data));",
+ "",
+ " if (yytbl_read16 (&td.td_id, rd) != 0",
+ " || yytbl_read16 (&td.td_flags, rd) != 0",
+ " || yytbl_read32 (&td.td_hilen, rd) != 0",
+ " || yytbl_read32 (&td.td_lolen, rd) != 0)",
+ " return -1;",
+ "",
+ " /* Lookup the map for the transition table so we have it in case we need it",
+ " * inside the loop below. This scanner might not even have a transition",
+ " * table, which is ok.",
+ " */",
+ " transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);",
+ "",
+ " if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){",
+ " YY_FATAL_ERROR( \"table id not found in map.\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* Allocate space for table.",
+ " * The --full yy_transition table is a special case, since we",
+ " * need the dmap.dm_sz entry to tell us the sizeof the individual",
+ " * struct members.",
+ " */",
+ " {",
+ " size_t bytes;",
+ "",
+ " if ((td.td_flags & YYTD_STRUCT))",
+ " bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);",
+ " else",
+ " bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;",
+ "",
+ " if(M4_YY_TABLES_VERIFY)",
+ " /* We point to the array itself */",
+ " p = dmap->dm_arr; ",
+ " else",
+ " /* We point to the address of a pointer. */",
+ " *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);",
+ " if ( ! p )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_data_load()\" );",
+ " }",
+ "",
+ " /* If it's a struct, we read 2 integers to get one element */",
+ " if ((td.td_flags & YYTD_STRUCT) != 0)",
+ " inner_loop_count = 2;",
+ " else",
+ " inner_loop_count = 1;",
+ "",
+ " /* read and map each element.",
+ " * This loop iterates once for each element of the td_data array.",
+ " * Notice that we increment 'i' in the inner loop.",
+ " */",
+ " len = yytbl_calc_total_len (&td);",
+ " for (i = 0; i < len; ){",
+ " int j;",
+ "",
+ "",
+ " /* This loop really executes exactly 1 or 2 times.",
+ " * The second time is to handle the second member of the",
+ " * YYTD_STRUCT for the yy_transition array.",
+ " */",
+ " for (j = 0; j < inner_loop_count; j++, i++) {",
+ " flex_int32_t t32;",
+ "",
+ " /* read into t32 no matter what the real size is. */",
+ " {",
+ " flex_int16_t t16;",
+ " flex_int8_t t8;",
+ "",
+ " switch (YYTDFLAGS2BYTES (td.td_flags)) {",
+ " case sizeof (flex_int32_t):",
+ " rv = yytbl_read32 (&t32, rd);",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " rv = yytbl_read16 (&t16, rd);",
+ " t32 = t16;",
+ " break;",
+ " case sizeof (flex_int8_t):",
+ " rv = yytbl_read8 (&t8, rd);",
+ " t32 = t8;",
+ " break;",
+ " default: ",
+ " YY_FATAL_ERROR( \"invalid td_flags\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " }",
+ " if (rv != 0)",
+ " return -1;",
+ "",
+ " /* copy into the deserialized array... */",
+ "",
+ " if ((td.td_flags & YYTD_STRUCT)) {",
+ " /* t32 is the j'th member of a two-element struct. */",
+ " void *v;",
+ "",
+ " v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)",
+ " : &(((struct yy_trans_info *) p)->yy_nxt);",
+ "",
+ " switch (dmap->dm_sz) {",
+ " case sizeof (flex_int32_t):",
+ " if (M4_YY_TABLES_VERIFY){",
+ " if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int32_t\" );",
+ " }else",
+ " ((flex_int32_t *) v)[0] = (flex_int32_t) t32;",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " if (M4_YY_TABLES_VERIFY ){",
+ " if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int16_t\" );",
+ " }else",
+ " ((flex_int16_t *) v)[0] = (flex_int16_t) t32;",
+ " break;",
+ " case sizeof(flex_int8_t):",
+ " if (M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int8_t\" );",
+ " }else",
+ " ((flex_int8_t *) v)[0] = (flex_int8_t) t32;",
+ " break;",
+ " default:",
+ " YY_FATAL_ERROR( \"invalid dmap->dm_sz for struct\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* if we're done with j, increment p */",
+ " if (j == 1)",
+ " p = (struct yy_trans_info *) p + 1;",
+ " }",
+ " else if ((td.td_flags & YYTD_PTRANS)) {",
+ " /* t32 is an index into the transition array. */",
+ " struct yy_trans_info *v;",
+ "",
+ "",
+ " if (!transdmap){",
+ " YY_FATAL_ERROR( \"transition table not found\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " ",
+ " if( M4_YY_TABLES_VERIFY)",
+ " v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);",
+ " else",
+ " v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);",
+ "",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((struct yy_trans_info **) p)[0] != v)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_PTRANS\" );",
+ " }else",
+ " ((struct yy_trans_info **) p)[0] = v;",
+ " ",
+ " /* increment p */",
+ " p = (struct yy_trans_info **) p + 1;",
+ " }",
+ " else {",
+ " /* t32 is a plain int. copy data, then incrememnt p. */",
+ " switch (dmap->dm_sz) {",
+ " case sizeof (flex_int32_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int32_t\" );",
+ " }else",
+ " ((flex_int32_t *) p)[0] = (flex_int32_t) t32;",
+ " p = ((flex_int32_t *) p) + 1;",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int16_t\" );",
+ " }else",
+ " ((flex_int16_t *) p)[0] = (flex_int16_t) t32;",
+ " p = ((flex_int16_t *) p) + 1;",
+ " break;",
+ " case sizeof (flex_int8_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int8_t\" );",
+ " }else",
+ " ((flex_int8_t *) p)[0] = (flex_int8_t) t32;",
+ " p = ((flex_int8_t *) p) + 1;",
+ " break;",
+ " default:",
+ " YY_FATAL_ERROR( \"invalid dmap->dm_sz for plain int\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " }",
+ " }",
+ "",
+ " }",
+ "",
+ " /* Now eat padding. */",
+ " {",
+ " int pad;",
+ " pad = yypad64(rd->bread);",
+ " while(--pad >= 0){",
+ " flex_int8_t t8;",
+ " if(yytbl_read8(&t8,rd) != 0)",
+ " return -1;",
+ " }",
+ " }",
+ "",
+ " return 0;",
+ "}",
+ "",
+ "%define-yytables The name for this specific scanner's tables.",
+ "",
+ "/* Find the key and load the DFA tables from the given stream. */",
+ "static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)",
+ "{",
+ " int rv=0;",
+ " struct yytbl_hdr th;",
+ " struct yytbl_reader rd;",
+ "",
+ " rd.fp = fp;",
+ " th.th_version = NULL;",
+ "",
+ " /* Keep trying until we find the right set of tables or end of file. */",
+ " while (!feof(rd.fp)) {",
+ " rd.bread = 0;",
+ " if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){",
+ " rv = -1;",
+ " goto return_rv;",
+ " }",
+ "",
+ " /* A NULL key means choose the first set of tables. */",
+ " if (key == NULL)",
+ " break;",
+ "",
+ " if (strcmp(th.th_name,key) != 0){",
+ " /* Skip ahead to next set */",
+ " fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);",
+ " yyfree(th.th_version M4_YY_CALL_LAST_ARG);",
+ " th.th_version = NULL;",
+ " }",
+ " else",
+ " break;",
+ " }",
+ "",
+ " while (rd.bread < th.th_ssize){",
+ " /* Load the data tables */",
+ " if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){",
+ " rv = -1;",
+ " goto return_rv;",
+ " }",
+ " }",
+ "",
+ "return_rv:",
+ " if(th.th_version){",
+ " yyfree(th.th_version M4_YY_CALL_LAST_ARG);",
+ " th.th_version = NULL;",
+ " }",
+ "",
+ " return rv;",
+ "}",
+ "",
+ "/** Load the DFA tables for this scanner from the given stream. */",
+ "int yytables_fload YYFARGS1(FILE *, fp)",
+ "{",
+ "",
+ " if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)",
+ " return -1;",
+ " return 0;",
+ "}",
+ "",
+ "/** Destroy the loaded tables, freeing memory, etc.. */",
+ "int yytables_destroy YYFARGS0(void)",
+ "{ ",
+ " struct yytbl_dmap *dmap=0;",
+ "",
+ " if(!M4_YY_TABLES_VERIFY){",
+ " /* Walk the dmap, freeing the pointers */",
+ " for(dmap=yydmap; dmap->dm_id; dmap++) {",
+ " void * v;",
+ " v = dmap->dm_arr;",
+ " if(v && *(char**)v){",
+ " yyfree(*(char**)v M4_YY_CALL_LAST_ARG);",
+ " *(char**)v = NULL;",
+ " }",
+ " }",
+ " }",
+ "",
+ " return 0;",
+ "}",
+ "",
+ "/* end table serialization code definitions */",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef([[M4_YY_MAIN]], [[",
+ "int main M4_YY_PARAMS(void);",
+ "",
+ "int main ()",
+ "{",
+ "",
+ "%if-reentrant",
+ " yyscan_t lexer;",
+ " yylex_init(&lexer);",
+ " yylex( lexer );",
+ " yylex_destroy( lexer);",
+ "",
+ "%endif",
+ "%if-not-reentrant",
+ " yylex();",
+ "%endif",
+ "",
+ " return 0;",
+ "}",
+ "]])",
+ "",
+ "%ok-for-header",
+ "m4_ifdef( [[M4_YY_IN_HEADER]],",
+ "[[",
+ "#undef YY_NEW_FILE",
+ "#undef YY_FLUSH_BUFFER",
+ "#undef yy_set_bol",
+ "#undef yy_new_buffer",
+ "#undef yy_set_interactive",
+ "#undef YY_DO_BEFORE_ACTION",
+ "",
+ "#ifdef YY_DECL_IS_OURS",
+ "#undef YY_DECL_IS_OURS",
+ "#undef YY_DECL",
+ "#endif",
+ "]])",
+ 0
+};
diff --git a/usr.bin/lex/lex.1 b/usr.bin/lex/lex.1
new file mode 100644
index 0000000..83d3a0c
--- /dev/null
+++ b/usr.bin/lex/lex.1
@@ -0,0 +1,4297 @@
+.\" $FreeBSD$
+.\"
+.TH FLEX 1 "May 21, 2013" "Version 2.5.37"
+.SH NAME
+flex, lex \- fast lexical analyzer generator
+.SH SYNOPSIS
+.B flex
+.B [\-bcdfhilnpstvwBFILTV78+? \-C[aefFmr] \-ooutput \-Pprefix \-Sskeleton]
+.B [\-\-help \-\-version]
+.I [filename ...]
+.SH OVERVIEW
+This manual describes
+.I flex,
+a tool for generating programs that perform pattern-matching on text.
+The manual includes both tutorial and reference sections:
+.nf
+
+ Description
+ a brief overview of the tool
+
+ Some Simple Examples
+
+ Format Of The Input File
+
+ Patterns
+ the extended regular expressions used by flex
+
+ How The Input Is Matched
+ the rules for determining what has been matched
+
+ Actions
+ how to specify what to do when a pattern is matched
+
+ The Generated Scanner
+ details regarding the scanner that flex produces;
+ how to control the input source
+
+ Start Conditions
+ introducing context into your scanners, and
+ managing "mini-scanners"
+
+ Multiple Input Buffers
+ how to manipulate multiple input sources; how to
+ scan from strings instead of files
+
+ End-of-file Rules
+ special rules for matching the end of the input
+
+ Miscellaneous Macros
+ a summary of macros available to the actions
+
+ Values Available To The User
+ a summary of values available to the actions
+
+ Interfacing With Yacc
+ connecting flex scanners together with yacc parsers
+
+ Options
+ flex command-line options, and the "%option"
+ directive
+
+ Performance Considerations
+ how to make your scanner go as fast as possible
+
+ Generating C++ Scanners
+ the (experimental) facility for generating C++
+ scanner classes
+
+ Incompatibilities With Lex And POSIX
+ how flex differs from AT&T lex and the POSIX lex
+ standard
+
+ Diagnostics
+ those error messages produced by flex (or scanners
+ it generates) whose meanings might not be apparent
+
+ Files
+ files used by flex
+
+ Deficiencies / Bugs
+ known problems with flex
+
+ See Also
+ other documentation, related tools
+
+ Author
+ includes contact information
+
+.fi
+.SH DESCRIPTION
+.I flex
+is a tool for generating
+.I scanners:
+programs which recognize lexical patterns in text.
+.I flex
+reads
+the given input files, or its standard input if no file names are given,
+for a description of a scanner to generate.
+The description is in the form of pairs
+of regular expressions and C code, called
+.I rules.
+.I flex
+generates as output a C source file,
+.B lex.yy.c,
+which defines a routine
+.B yylex().
+This file is compiled and linked with the
+.B \-ll
+library to produce an executable.
+When the executable is run,
+it analyzes its input for occurrences
+of the regular expressions.
+Whenever it finds one, it executes
+the corresponding C code.
+.SH SOME SIMPLE EXAMPLES
+First some simple examples to get the flavor of how one uses
+.I flex.
+The following
+.I flex
+input specifies a scanner which whenever it encounters the string
+"username" will replace it with the user's login name:
+.nf
+
+ %%
+ username printf( "%s", getlogin() );
+
+.fi
+By default, any text not matched by a
+.I flex
+scanner
+is copied to the output, so the net effect of this scanner is
+to copy its input file to its output with each occurrence
+of "username" expanded.
+In this input, there is just one rule.
+"username" is the
+.I pattern
+and the "printf" is the
+.I action.
+The "%%" marks the beginning of the rules.
+.PP
+Here's another simple example:
+.nf
+
+ %{
+ int num_lines = 0, num_chars = 0;
+ %}
+
+ %%
+ \\n ++num_lines; ++num_chars;
+ . ++num_chars;
+
+ %%
+ main()
+ {
+ yylex();
+ printf( "# of lines = %d, # of chars = %d\\n",
+ num_lines, num_chars );
+ }
+
+.fi
+This scanner counts the number of characters and the number
+of lines in its input (it produces no output other than the
+final report on the counts).
+The first line
+declares two globals, "num_lines" and "num_chars", which are accessible
+both inside
+.B yylex()
+and in the
+.B main()
+routine declared after the second "%%".
+There are two rules, one
+which matches a newline ("\\n") and increments both the line count and
+the character count, and one which matches any character other than
+a newline (indicated by the "." regular expression).
+.PP
+A somewhat more complicated example:
+.nf
+
+ /* scanner for a toy Pascal-like language */
+
+ %{
+ /* need this for the call to atof() below */
+ #include <math.h>
+ %}
+
+ DIGIT [0-9]
+ ID [a-z][a-z0-9]*
+
+ %%
+
+ {DIGIT}+ {
+ printf( "An integer: %s (%d)\\n", yytext,
+ atoi( yytext ) );
+ }
+
+ {DIGIT}+"."{DIGIT}* {
+ printf( "A float: %s (%g)\\n", yytext,
+ atof( yytext ) );
+ }
+
+ if|then|begin|end|procedure|function {
+ printf( "A keyword: %s\\n", yytext );
+ }
+
+ {ID} printf( "An identifier: %s\\n", yytext );
+
+ "+"|"-"|"*"|"/" printf( "An operator: %s\\n", yytext );
+
+ "{"[^}\\n]*"}" /* eat up one-line comments */
+
+ [ \\t\\n]+ /* eat up whitespace */
+
+ . printf( "Unrecognized character: %s\\n", yytext );
+
+ %%
+
+ main( argc, argv )
+ int argc;
+ char **argv;
+ {
+ ++argv, --argc; /* skip over program name */
+ if ( argc > 0 )
+ yyin = fopen( argv[0], "r" );
+ else
+ yyin = stdin;
+
+ yylex();
+ }
+
+.fi
+This is the beginnings of a simple scanner for a language like
+Pascal.
+It identifies different types of
+.I tokens
+and reports on what it has seen.
+.PP
+The details of this example will be explained in the following
+sections.
+.SH FORMAT OF THE INPUT FILE
+The
+.I flex
+input file consists of three sections, separated by a line with just
+.B %%
+in it:
+.nf
+
+ definitions
+ %%
+ rules
+ %%
+ user code
+
+.fi
+The
+.I definitions
+section contains declarations of simple
+.I name
+definitions to simplify the scanner specification, and declarations of
+.I start conditions,
+which are explained in a later section.
+.PP
+Name definitions have the form:
+.nf
+
+ name definition
+
+.fi
+The "name" is a word beginning with a letter or an underscore ('_')
+followed by zero or more letters, digits, '_', or '-' (dash).
+The definition is taken to begin at the first non-white-space character
+following the name and continuing to the end of the line.
+The definition can subsequently be referred to using "{name}", which
+will expand to "(definition)".
+For example,
+.nf
+
+ DIGIT [0-9]
+ ID [a-z][a-z0-9]*
+
+.fi
+defines "DIGIT" to be a regular expression which matches a
+single digit, and
+"ID" to be a regular expression which matches a letter
+followed by zero-or-more letters-or-digits.
+A subsequent reference to
+.nf
+
+ {DIGIT}+"."{DIGIT}*
+
+.fi
+is identical to
+.nf
+
+ ([0-9])+"."([0-9])*
+
+.fi
+and matches one-or-more digits followed by a '.' followed
+by zero-or-more digits.
+.PP
+The
+.I rules
+section of the
+.I flex
+input contains a series of rules of the form:
+.nf
+
+ pattern action
+
+.fi
+where the pattern must be unindented and the action must begin
+on the same line.
+.PP
+See below for a further description of patterns and actions.
+.PP
+Finally, the user code section is simply copied to
+.B lex.yy.c
+verbatim.
+It is used for companion routines which call or are called
+by the scanner.
+The presence of this section is optional;
+if it is missing, the second
+.B %%
+in the input file may be skipped, too.
+.PP
+In the definitions and rules sections, any
+.I indented
+text or text enclosed in
+.B %{
+and
+.B %}
+is copied verbatim to the output (with the %{}'s removed).
+The %{}'s must appear unindented on lines by themselves.
+.PP
+In the rules section,
+any indented or %{} text appearing before the
+first rule may be used to declare variables
+which are local to the scanning routine and (after the declarations)
+code which is to be executed whenever the scanning routine is entered.
+Other indented or %{} text in the rule section is still copied to the output,
+but its meaning is not well-defined and it may well cause compile-time
+errors (this feature is present for
+.I POSIX
+compliance; see below for other such features).
+.PP
+In the definitions section (but not in the rules section),
+an unindented comment (i.e., a line
+beginning with "/*") is also copied verbatim to the output up
+to the next "*/".
+.SH PATTERNS
+The patterns in the input are written using an extended set of regular
+expressions.
+These are:
+.nf
+
+ x match the character 'x'
+ . any character (byte) except newline
+ [xyz] a "character class"; in this case, the pattern
+ matches either an 'x', a 'y', or a 'z'
+ [abj-oZ] a "character class" with a range in it; matches
+ an 'a', a 'b', any letter from 'j' through 'o',
+ or a 'Z'
+ [^A-Z] a "negated character class", i.e., any character
+ but those in the class. In this case, any
+ character EXCEPT an uppercase letter.
+ [^A-Z\\n] any character EXCEPT an uppercase letter or
+ a newline
+ r* zero or more r's, where r is any regular expression
+ r+ one or more r's
+ r? zero or one r's (that is, "an optional r")
+ r{2,5} anywhere from two to five r's
+ r{2,} two or more r's
+ r{4} exactly 4 r's
+ {name} the expansion of the "name" definition
+ (see above)
+ "[xyz]\\"foo"
+ the literal string: [xyz]"foo
+ \\X if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v',
+ then the ANSI-C interpretation of \\x.
+ Otherwise, a literal 'X' (used to escape
+ operators such as '*')
+ \\0 a NUL character (ASCII code 0)
+ \\123 the character with octal value 123
+ \\x2a the character with hexadecimal value 2a
+ (r) match an r; parentheses are used to override
+ precedence (see below)
+
+
+ rs the regular expression r followed by the
+ regular expression s; called "concatenation"
+
+
+ r|s either an r or an s
+
+
+ r/s an r but only if it is followed by an s. The
+ text matched by s is included when determining
+ whether this rule is the "longest match",
+ but is then returned to the input before
+ the action is executed. So the action only
+ sees the text matched by r. This type
+ of pattern is called trailing context".
+ (There are some combinations of r/s that flex
+ cannot match correctly; see notes in the
+ Deficiencies / Bugs section below regarding
+ "dangerous trailing context".)
+ ^r an r, but only at the beginning of a line (i.e.,
+ when just starting to scan, or right after a
+ newline has been scanned).
+ r$ an r, but only at the end of a line (i.e., just
+ before a newline). Equivalent to "r/\\n".
+
+ Note that flex's notion of "newline" is exactly
+ whatever the C compiler used to compile flex
+ interprets '\\n' as; in particular, on some DOS
+ systems you must either filter out \\r's in the
+ input yourself, or explicitly use r/\\r\\n for "r$".
+
+
+ <s>r an r, but only in start condition s (see
+ below for discussion of start conditions)
+ <s1,s2,s3>r
+ same, but in any of start conditions s1,
+ s2, or s3
+ <*>r an r in any start condition, even an exclusive one.
+
+
+ <<EOF>> an end-of-file
+ <s1,s2><<EOF>>
+ an end-of-file when in start condition s1 or s2
+
+.fi
+Note that inside of a character class, all regular expression operators
+lose their special meaning except escape ('\\') and the character class
+operators, '-', ']', and, at the beginning of the class, '^'.
+.PP
+The regular expressions listed above are grouped according to
+precedence, from highest precedence at the top to lowest at the bottom.
+Those grouped together have equal precedence.
+For example,
+.nf
+
+ foo|bar*
+
+.fi
+is the same as
+.nf
+
+ (foo)|(ba(r*))
+
+.fi
+since the '*' operator has higher precedence than concatenation,
+and concatenation higher than alternation ('|').
+This pattern
+therefore matches
+.I either
+the string "foo"
+.I or
+the string "ba" followed by zero-or-more r's.
+To match "foo" or zero-or-more "bar"'s, use:
+.nf
+
+ foo|(bar)*
+
+.fi
+and to match zero-or-more "foo"'s-or-"bar"'s:
+.nf
+
+ (foo|bar)*
+
+.fi
+.PP
+In addition to characters and ranges of characters, character classes
+can also contain character class
+.I expressions.
+These are expressions enclosed inside
+.B [:
+and
+.B :]
+delimiters (which themselves must appear between the '[' and ']' of the
+character class; other elements may occur inside the character class, too).
+The valid expressions are:
+.nf
+
+ [:alnum:] [:alpha:] [:blank:]
+ [:cntrl:] [:digit:] [:graph:]
+ [:lower:] [:print:] [:punct:]
+ [:space:] [:upper:] [:xdigit:]
+
+.fi
+These expressions all designate a set of characters equivalent to
+the corresponding standard C
+.B isXXX
+function.
+For example,
+.B [:alnum:]
+designates those characters for which
+.B isalnum()
+returns true - i.e., any alphabetic or numeric.
+Some systems don't provide
+.B isblank(),
+so flex defines
+.B [:blank:]
+as a blank or a tab.
+.PP
+For example, the following character classes are all equivalent:
+.nf
+
+ [[:alnum:]]
+ [[:alpha:][:digit:]]
+ [[:alpha:]0-9]
+ [a-zA-Z0-9]
+
+.fi
+If your scanner is case-insensitive (the
+.B \-i
+flag), then
+.B [:upper:]
+and
+.B [:lower:]
+are equivalent to
+.B [:alpha:].
+.PP
+Some notes on patterns:
+.IP -
+A negated character class such as the example "[^A-Z]"
+above
+.I will match a newline
+unless "\\n" (or an equivalent escape sequence) is one of the
+characters explicitly present in the negated character class
+(e.g., "[^A-Z\\n]").
+This is unlike how many other regular
+expression tools treat negated character classes, but unfortunately
+the inconsistency is historically entrenched.
+Matching newlines means that a pattern like [^"]* can match the entire
+input unless there's another quote in the input.
+.IP -
+A rule can have at most one instance of trailing context (the '/' operator
+or the '$' operator).
+The start condition, '^', and "<<EOF>>" patterns
+can only occur at the beginning of a pattern, and, as well as with '/' and '$',
+cannot be grouped inside parentheses.
+A '^' which does not occur at
+the beginning of a rule or a '$' which does not occur at the end of
+a rule loses its special properties and is treated as a normal character.
+.IP
+The following are illegal:
+.nf
+
+ foo/bar$
+ <sc1>foo<sc2>bar
+
+.fi
+Note that the first of these, can be written "foo/bar\\n".
+.IP
+The following will result in '$' or '^' being treated as a normal character:
+.nf
+
+ foo|(bar$)
+ foo|^bar
+
+.fi
+If what's wanted is a "foo" or a bar-followed-by-a-newline, the following
+could be used (the special '|' action is explained below):
+.nf
+
+ foo |
+ bar$ /* action goes here */
+
+.fi
+A similar trick will work for matching a foo or a
+bar-at-the-beginning-of-a-line.
+.SH HOW THE INPUT IS MATCHED
+When the generated scanner is run, it analyzes its input looking
+for strings which match any of its patterns.
+If it finds more than
+one match, it takes the one matching the most text (for trailing
+context rules, this includes the length of the trailing part, even
+though it will then be returned to the input).
+If it finds two
+or more matches of the same length, the
+rule listed first in the
+.I flex
+input file is chosen.
+.PP
+Once the match is determined, the text corresponding to the match
+(called the
+.I token)
+is made available in the global character pointer
+.B yytext,
+and its length in the global integer
+.B yyleng.
+The
+.I action
+corresponding to the matched pattern is then executed (a more
+detailed description of actions follows), and then the remaining
+input is scanned for another match.
+.PP
+If no match is found, then the
+.I default rule
+is executed: the next character in the input is considered matched and
+copied to the standard output.
+Thus, the simplest legal
+.I flex
+input is:
+.nf
+
+ %%
+
+.fi
+which generates a scanner that simply copies its input (one character
+at a time) to its output.
+.PP
+Note that
+.B yytext
+can be defined in two different ways: either as a character
+.I pointer
+or as a character
+.I array.
+You can control which definition
+.I flex
+uses by including one of the special directives
+.B %pointer
+or
+.B %array
+in the first (definitions) section of your flex input.
+The default is
+.B %pointer,
+unless you use the
+.B -l
+lex compatibility option, in which case
+.B yytext
+will be an array.
+The advantage of using
+.B %pointer
+is substantially faster scanning and no buffer overflow when matching
+very large tokens (unless you run out of dynamic memory).
+The disadvantage
+is that you are restricted in how your actions can modify
+.B yytext
+(see the next section), and calls to the
+.B unput()
+function destroys the present contents of
+.B yytext,
+which can be a considerable porting headache when moving between different
+.I lex
+versions.
+.PP
+The advantage of
+.B %array
+is that you can then modify
+.B yytext
+to your heart's content, and calls to
+.B unput()
+do not destroy
+.B yytext
+(see below).
+Furthermore, existing
+.I lex
+programs sometimes access
+.B yytext
+externally using declarations of the form:
+.nf
+ extern char yytext[];
+.fi
+This definition is erroneous when used with
+.B %pointer,
+but correct for
+.B %array.
+.PP
+.B %array
+defines
+.B yytext
+to be an array of
+.B YYLMAX
+characters, which defaults to a fairly large value.
+You can change
+the size by simply #define'ing
+.B YYLMAX
+to a different value in the first section of your
+.I flex
+input.
+As mentioned above, with
+.B %pointer
+yytext grows dynamically to accommodate large tokens.
+While this means your
+.B %pointer
+scanner can accommodate very large tokens (such as matching entire blocks
+of comments), bear in mind that each time the scanner must resize
+.B yytext
+it also must rescan the entire token from the beginning, so matching such
+tokens can prove slow.
+.B yytext
+presently does
+.I not
+dynamically grow if a call to
+.B unput()
+results in too much text being pushed back; instead, a run-time error results.
+.PP
+Also note that you cannot use
+.B %array
+with C++ scanner classes
+(the
+.B c++
+option; see below).
+.SH ACTIONS
+Each pattern in a rule has a corresponding action, which can be any
+arbitrary C statement.
+The pattern ends at the first non-escaped
+whitespace character; the remainder of the line is its action.
+If the
+action is empty, then when the pattern is matched the input token
+is simply discarded.
+For example, here is the specification for a program
+which deletes all occurrences of "zap me" from its input:
+.nf
+
+ %%
+ "zap me"
+
+.fi
+(It will copy all other characters in the input to the output since
+they will be matched by the default rule.)
+.PP
+Here is a program which compresses multiple blanks and tabs down to
+a single blank, and throws away whitespace found at the end of a line:
+.nf
+
+ %%
+ [ \\t]+ putchar( ' ' );
+ [ \\t]+$ /* ignore this token */
+
+.fi
+.PP
+If the action contains a '{', then the action spans till the balancing '}'
+is found, and the action may cross multiple lines.
+.I flex
+knows about C strings and comments and won't be fooled by braces found
+within them, but also allows actions to begin with
+.B %{
+and will consider the action to be all the text up to the next
+.B %}
+(regardless of ordinary braces inside the action).
+.PP
+An action consisting solely of a vertical bar ('|') means "same as
+the action for the next rule." See below for an illustration.
+.PP
+Actions can include arbitrary C code, including
+.B return
+statements to return a value to whatever routine called
+.B yylex().
+Each time
+.B yylex()
+is called it continues processing tokens from where it last left
+off until it either reaches
+the end of the file or executes a return.
+.PP
+Actions are free to modify
+.B yytext
+except for lengthening it (adding
+characters to its end--these will overwrite later characters in the
+input stream).
+This however does not apply when using
+.B %array
+(see above); in that case,
+.B yytext
+may be freely modified in any way.
+.PP
+Actions are free to modify
+.B yyleng
+except they should not do so if the action also includes use of
+.B yymore()
+(see below).
+.PP
+There are a number of special directives which can be included within
+an action:
+.IP -
+.B ECHO
+copies yytext to the scanner's output.
+.IP -
+.B BEGIN
+followed by the name of a start condition places the scanner in the
+corresponding start condition (see below).
+.IP -
+.B REJECT
+directs the scanner to proceed on to the "second best" rule which matched the
+input (or a prefix of the input).
+The rule is chosen as described
+above in "How the Input is Matched", and
+.B yytext
+and
+.B yyleng
+set up appropriately.
+It may either be one which matched as much text
+as the originally chosen rule but came later in the
+.I flex
+input file, or one which matched less text.
+For example, the following will both count the
+words in the input and call the routine special() whenever "frob" is seen:
+.nf
+
+ int word_count = 0;
+ %%
+
+ frob special(); REJECT;
+ [^ \\t\\n]+ ++word_count;
+
+.fi
+Without the
+.B REJECT,
+any "frob"'s in the input would not be counted as words, since the
+scanner normally executes only one action per token.
+Multiple
+.B REJECT's
+are allowed, each one finding the next best choice to the currently
+active rule.
+For example, when the following scanner scans the token
+"abcd", it will write "abcdabcaba" to the output:
+.nf
+
+ %%
+ a |
+ ab |
+ abc |
+ abcd ECHO; REJECT;
+ .|\\n /* eat up any unmatched character */
+
+.fi
+(The first three rules share the fourth's action since they use
+the special '|' action.)
+.B REJECT
+is a particularly expensive feature in terms of scanner performance;
+if it is used in
+.I any
+of the scanner's actions it will slow down
+.I all
+of the scanner's matching.
+Furthermore,
+.B REJECT
+cannot be used with the
+.I -Cf
+or
+.I -CF
+options (see below).
+.IP
+Note also that unlike the other special actions,
+.B REJECT
+is a
+.I branch;
+code immediately following it in the action will
+.I not
+be executed.
+.IP -
+.B yymore()
+tells the scanner that the next time it matches a rule, the corresponding
+token should be
+.I appended
+onto the current value of
+.B yytext
+rather than replacing it.
+For example, given the input "mega-kludge"
+the following will write "mega-mega-kludge" to the output:
+.nf
+
+ %%
+ mega- ECHO; yymore();
+ kludge ECHO;
+
+.fi
+First "mega-" is matched and echoed to the output.
+Then "kludge"
+is matched, but the previous "mega-" is still hanging around at the
+beginning of
+.B yytext
+so the
+.B ECHO
+for the "kludge" rule will actually write "mega-kludge".
+.PP
+Two notes regarding use of
+.B yymore().
+First,
+.B yymore()
+depends on the value of
+.I yyleng
+correctly reflecting the size of the current token, so you must not
+modify
+.I yyleng
+if you are using
+.B yymore().
+Second, the presence of
+.B yymore()
+in the scanner's action entails a minor performance penalty in the
+scanner's matching speed.
+.IP -
+.B yyless(n)
+returns all but the first
+.I n
+characters of the current token back to the input stream, where they
+will be rescanned when the scanner looks for the next match.
+.B yytext
+and
+.B yyleng
+are adjusted appropriately (e.g.,
+.B yyleng
+will now be equal to
+.I n
+).
+For example, on the input "foobar" the following will write out
+"foobarbar":
+.nf
+
+ %%
+ foobar ECHO; yyless(3);
+ [a-z]+ ECHO;
+
+.fi
+An argument of 0 to
+.B yyless
+will cause the entire current input string to be scanned again.
+Unless you've
+changed how the scanner will subsequently process its input (using
+.B BEGIN,
+for example), this will result in an endless loop.
+.PP
+Note that
+.B yyless
+is a macro and can only be used in the flex input file, not from
+other source files.
+.IP -
+.B unput(c)
+puts the character
+.I c
+back onto the input stream.
+It will be the next character scanned.
+The following action will take the current token and cause it
+to be rescanned enclosed in parentheses.
+.nf
+
+ {
+ int i;
+ /* Copy yytext because unput() trashes yytext */
+ char *yycopy = strdup( yytext );
+ unput( ')' );
+ for ( i = yyleng - 1; i >= 0; --i )
+ unput( yycopy[i] );
+ unput( '(' );
+ free( yycopy );
+ }
+
+.fi
+Note that since each
+.B unput()
+puts the given character back at the
+.I beginning
+of the input stream, pushing back strings must be done back-to-front.
+.PP
+An important potential problem when using
+.B unput()
+is that if you are using
+.B %pointer
+(the default), a call to
+.B unput()
+.I destroys
+the contents of
+.I yytext,
+starting with its rightmost character and devouring one character to
+the left with each call.
+If you need the value of yytext preserved
+after a call to
+.B unput()
+(as in the above example),
+you must either first copy it elsewhere, or build your scanner using
+.B %array
+instead (see How The Input Is Matched).
+.PP
+Finally, note that you cannot put back
+.B EOF
+to attempt to mark the input stream with an end-of-file.
+.IP -
+.B input()
+reads the next character from the input stream.
+For example,
+the following is one way to eat up C comments:
+.nf
+
+ %%
+ "/*" {
+ int c;
+
+ for ( ; ; )
+ {
+ while ( (c = input()) != '*' &&
+ c != EOF )
+ ; /* eat up text of comment */
+
+ if ( c == '*' )
+ {
+ while ( (c = input()) == '*' )
+ ;
+ if ( c == '/' )
+ break; /* found the end */
+ }
+
+ if ( c == EOF )
+ {
+ error( "EOF in comment" );
+ break;
+ }
+ }
+ }
+
+.fi
+(Note that if the scanner is compiled using
+.B C++,
+then
+.B input()
+is instead referred to as
+.B yyinput(),
+in order to avoid a name clash with the
+.B C++
+stream by the name of
+.I input.)
+.IP -
+.B YY_FLUSH_BUFFER
+flushes the scanner's internal buffer
+so that the next time the scanner attempts to match a token, it will
+first refill the buffer using
+.B YY_INPUT
+(see The Generated Scanner, below).
+This action is a special case
+of the more general
+.B yy_flush_buffer()
+function, described below in the section Multiple Input Buffers.
+.IP -
+.B yyterminate()
+can be used in lieu of a return statement in an action.
+It terminates
+the scanner and returns a 0 to the scanner's caller, indicating "all done".
+By default,
+.B yyterminate()
+is also called when an end-of-file is encountered.
+It is a macro and may be redefined.
+.SH THE GENERATED SCANNER
+The output of
+.I flex
+is the file
+.B lex.yy.c,
+which contains the scanning routine
+.B yylex(),
+a number of tables used by it for matching tokens, and a number
+of auxiliary routines and macros.
+By default,
+.B yylex()
+is declared as follows:
+.nf
+
+ int yylex()
+ {
+ ... various definitions and the actions in here ...
+ }
+
+.fi
+(If your environment supports function prototypes, then it will
+be "int yylex( void )".) This definition may be changed by defining
+the "YY_DECL" macro.
+For example, you could use:
+.nf
+
+ #define YY_DECL float lexscan( a, b ) float a, b;
+
+.fi
+to give the scanning routine the name
+.I lexscan,
+returning a float, and taking two floats as arguments.
+Note that
+if you give arguments to the scanning routine using a
+K&R-style/non-prototyped function declaration, you must terminate
+the definition with a semi-colon (;).
+.PP
+Whenever
+.B yylex()
+is called, it scans tokens from the global input file
+.I yyin
+(which defaults to stdin).
+It continues until it either reaches
+an end-of-file (at which point it returns the value 0) or
+one of its actions executes a
+.I return
+statement.
+.PP
+If the scanner reaches an end-of-file, subsequent calls are undefined
+unless either
+.I yyin
+is pointed at a new input file (in which case scanning continues from
+that file), or
+.B yyrestart()
+is called.
+.B yyrestart()
+takes one argument, a
+.B FILE *
+pointer (which can be nil, if you've set up
+.B YY_INPUT
+to scan from a source other than
+.I yyin),
+and initializes
+.I yyin
+for scanning from that file.
+Essentially there is no difference between
+just assigning
+.I yyin
+to a new input file or using
+.B yyrestart()
+to do so; the latter is available for compatibility with previous versions
+of
+.I flex,
+and because it can be used to switch input files in the middle of scanning.
+It can also be used to throw away the current input buffer, by calling
+it with an argument of
+.I yyin;
+but better is to use
+.B YY_FLUSH_BUFFER
+(see above).
+Note that
+.B yyrestart()
+does
+.I not
+reset the start condition to
+.B INITIAL
+(see Start Conditions, below).
+.PP
+If
+.B yylex()
+stops scanning due to executing a
+.I return
+statement in one of the actions, the scanner may then be called again and it
+will resume scanning where it left off.
+.PP
+By default (and for purposes of efficiency), the scanner uses
+block-reads rather than simple
+.I getc()
+calls to read characters from
+.I yyin.
+The nature of how it gets its input can be controlled by defining the
+.B YY_INPUT
+macro.
+YY_INPUT's calling sequence is "YY_INPUT(buf,result,max_size)".
+Its action is to place up to
+.I max_size
+characters in the character array
+.I buf
+and return in the integer variable
+.I result
+either the
+number of characters read or the constant YY_NULL (0 on Unix systems)
+to indicate EOF.
+The default YY_INPUT reads from the
+global file-pointer "yyin".
+.PP
+A sample definition of YY_INPUT (in the definitions
+section of the input file):
+.nf
+
+ %{
+ #define YY_INPUT(buf,result,max_size) \\
+ { \\
+ int c = getchar(); \\
+ result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \\
+ }
+ %}
+
+.fi
+This definition will change the input processing to occur
+one character at a time.
+.PP
+When the scanner receives an end-of-file indication from YY_INPUT,
+it then checks the
+.B yywrap()
+function.
+If
+.B yywrap()
+returns false (zero), then it is assumed that the
+function has gone ahead and set up
+.I yyin
+to point to another input file, and scanning continues.
+If it returns
+true (non-zero), then the scanner terminates, returning 0 to its
+caller.
+Note that in either case, the start condition remains unchanged;
+it does
+.I not
+revert to
+.B INITIAL.
+.PP
+If you do not supply your own version of
+.B yywrap(),
+then you must either use
+.B %option noyywrap
+(in which case the scanner behaves as though
+.B yywrap()
+returned 1), or you must link with
+.B \-ll
+to obtain the default version of the routine, which always returns 1.
+.PP
+Three routines are available for scanning from in-memory buffers rather
+than files:
+.B yy_scan_string(), yy_scan_bytes(),
+and
+.B yy_scan_buffer().
+See the discussion of them below in the section Multiple Input Buffers.
+.PP
+The scanner writes its
+.B ECHO
+output to the
+.I yyout
+global (default, stdout), which may be redefined by the user simply
+by assigning it to some other
+.B FILE
+pointer.
+.SH START CONDITIONS
+.I flex
+provides a mechanism for conditionally activating rules.
+Any rule
+whose pattern is prefixed with "<sc>" will only be active when
+the scanner is in the start condition named "sc".
+For example,
+.nf
+
+ <STRING>[^"]* { /* eat up the string body ... */
+ ...
+ }
+
+.fi
+will be active only when the scanner is in the "STRING" start
+condition, and
+.nf
+
+ <INITIAL,STRING,QUOTE>\\. { /* handle an escape ... */
+ ...
+ }
+
+.fi
+will be active only when the current start condition is
+either "INITIAL", "STRING", or "QUOTE".
+.PP
+Start conditions
+are declared in the definitions (first) section of the input
+using unindented lines beginning with either
+.B %s
+or
+.B %x
+followed by a list of names.
+The former declares
+.I inclusive
+start conditions, the latter
+.I exclusive
+start conditions.
+A start condition is activated using the
+.B BEGIN
+action.
+Until the next
+.B BEGIN
+action is executed, rules with the given start
+condition will be active and
+rules with other start conditions will be inactive.
+If the start condition is
+.I inclusive,
+then rules with no start conditions at all will also be active.
+If it is
+.I exclusive,
+then
+.I only
+rules qualified with the start condition will be active.
+A set of rules contingent on the same exclusive start condition
+describe a scanner which is independent of any of the other rules in the
+.I flex
+input.
+Because of this,
+exclusive start conditions make it easy to specify "mini-scanners"
+which scan portions of the input that are syntactically different
+from the rest (e.g., comments).
+.PP
+If the distinction between inclusive and exclusive start conditions
+is still a little vague, here's a simple example illustrating the
+connection between the two.
+The set of rules:
+.nf
+
+ %s example
+ %%
+
+ <example>foo do_something();
+
+ bar something_else();
+
+.fi
+is equivalent to
+.nf
+
+ %x example
+ %%
+
+ <example>foo do_something();
+
+ <INITIAL,example>bar something_else();
+
+.fi
+Without the
+.B <INITIAL,example>
+qualifier, the
+.I bar
+pattern in the second example wouldn't be active (i.e., couldn't match)
+when in start condition
+.B example.
+If we just used
+.B <example>
+to qualify
+.I bar,
+though, then it would only be active in
+.B example
+and not in
+.B INITIAL,
+while in the first example it's active in both, because in the first
+example the
+.B example
+start condition is an
+.I inclusive
+.B (%s)
+start condition.
+.PP
+Also note that the special start-condition specifier
+.B <*>
+matches every start condition.
+Thus, the above example could also have been written;
+.nf
+
+ %x example
+ %%
+
+ <example>foo do_something();
+
+ <*>bar something_else();
+
+.fi
+.PP
+The default rule (to
+.B ECHO
+any unmatched character) remains active in start conditions.
+It
+is equivalent to:
+.nf
+
+ <*>.|\\n ECHO;
+
+.fi
+.PP
+.B BEGIN(0)
+returns to the original state where only the rules with
+no start conditions are active.
+This state can also be
+referred to as the start-condition "INITIAL", so
+.B BEGIN(INITIAL)
+is equivalent to
+.B BEGIN(0).
+(The parentheses around the start condition name are not required but
+are considered good style.)
+.PP
+.B BEGIN
+actions can also be given as indented code at the beginning
+of the rules section.
+For example, the following will cause
+the scanner to enter the "SPECIAL" start condition whenever
+.B yylex()
+is called and the global variable
+.I enter_special
+is true:
+.nf
+
+ int enter_special;
+
+ %x SPECIAL
+ %%
+ if ( enter_special )
+ BEGIN(SPECIAL);
+
+ <SPECIAL>blahblahblah
+ ...more rules follow...
+
+.fi
+.PP
+To illustrate the uses of start conditions,
+here is a scanner which provides two different interpretations
+of a string like "123.456".
+By default it will treat it as
+three tokens, the integer "123", a dot ('.'), and the integer "456".
+But if the string is preceded earlier in the line by the string
+"expect-floats"
+it will treat it as a single token, the floating-point number
+123.456:
+.nf
+
+ %{
+ #include <math.h>
+ %}
+ %s expect
+
+ %%
+ expect-floats BEGIN(expect);
+
+ <expect>[0-9]+"."[0-9]+ {
+ printf( "found a float, = %f\\n",
+ atof( yytext ) );
+ }
+ <expect>\\n {
+ /* that's the end of the line, so
+ * we need another "expect-number"
+ * before we'll recognize any more
+ * numbers
+ */
+ BEGIN(INITIAL);
+ }
+
+ [0-9]+ {
+ printf( "found an integer, = %d\\n",
+ atoi( yytext ) );
+ }
+
+ "." printf( "found a dot\\n" );
+
+.fi
+Here is a scanner which recognizes (and discards) C comments while
+maintaining a count of the current input line.
+.nf
+
+ %x comment
+ %%
+ int line_num = 1;
+
+ "/*" BEGIN(comment);
+
+ <comment>[^*\\n]* /* eat anything that's not a '*' */
+ <comment>"*"+[^*/\\n]* /* eat up '*'s not followed by '/'s */
+ <comment>\\n ++line_num;
+ <comment>"*"+"/" BEGIN(INITIAL);
+
+.fi
+This scanner goes to a bit of trouble to match as much
+text as possible with each rule.
+In general, when attempting to write
+a high-speed scanner try to match as much possible in each rule, as
+it's a big win.
+.PP
+Note that start-conditions names are really integer values and
+can be stored as such.
+Thus, the above could be extended in the
+following fashion:
+.nf
+
+ %x comment foo
+ %%
+ int line_num = 1;
+ int comment_caller;
+
+ "/*" {
+ comment_caller = INITIAL;
+ BEGIN(comment);
+ }
+
+ ...
+
+ <foo>"/*" {
+ comment_caller = foo;
+ BEGIN(comment);
+ }
+
+ <comment>[^*\\n]* /* eat anything that's not a '*' */
+ <comment>"*"+[^*/\\n]* /* eat up '*'s not followed by '/'s */
+ <comment>\\n ++line_num;
+ <comment>"*"+"/" BEGIN(comment_caller);
+
+.fi
+Furthermore, you can access the current start condition using
+the integer-valued
+.B YY_START
+macro.
+For example, the above assignments to
+.I comment_caller
+could instead be written
+.nf
+
+ comment_caller = YY_START;
+
+.fi
+Flex provides
+.B YYSTATE
+as an alias for
+.B YY_START
+(since that is what's used by AT&T
+.I lex).
+.PP
+Note that start conditions do not have their own name-space; %s's and %x's
+declare names in the same fashion as #define's.
+.PP
+Finally, here's an example of how to match C-style quoted strings using
+exclusive start conditions, including expanded escape sequences (but
+not including checking for a string that's too long):
+.nf
+
+ %x str
+
+ %%
+ char string_buf[MAX_STR_CONST];
+ char *string_buf_ptr;
+
+
+ \\" string_buf_ptr = string_buf; BEGIN(str);
+
+ <str>\\" { /* saw closing quote - all done */
+ BEGIN(INITIAL);
+ *string_buf_ptr = '\\0';
+ /* return string constant token type and
+ * value to parser
+ */
+ }
+
+ <str>\\n {
+ /* error - unterminated string constant */
+ /* generate error message */
+ }
+
+ <str>\\\\[0-7]{1,3} {
+ /* octal escape sequence */
+ int result;
+
+ (void) sscanf( yytext + 1, "%o", &result );
+
+ if ( result > 0xff )
+ /* error, constant is out-of-bounds */
+
+ *string_buf_ptr++ = result;
+ }
+
+ <str>\\\\[0-9]+ {
+ /* generate error - bad escape sequence; something
+ * like '\\48' or '\\0777777'
+ */
+ }
+
+ <str>\\\\n *string_buf_ptr++ = '\\n';
+ <str>\\\\t *string_buf_ptr++ = '\\t';
+ <str>\\\\r *string_buf_ptr++ = '\\r';
+ <str>\\\\b *string_buf_ptr++ = '\\b';
+ <str>\\\\f *string_buf_ptr++ = '\\f';
+
+ <str>\\\\(.|\\n) *string_buf_ptr++ = yytext[1];
+
+ <str>[^\\\\\\n\\"]+ {
+ char *yptr = yytext;
+
+ while ( *yptr )
+ *string_buf_ptr++ = *yptr++;
+ }
+
+.fi
+.PP
+Often, such as in some of the examples above, you wind up writing a
+whole bunch of rules all preceded by the same start condition(s).
+Flex makes this a little easier and cleaner by introducing a notion of
+start condition
+.I scope.
+A start condition scope is begun with:
+.nf
+
+ <SCs>{
+
+.fi
+where
+.I SCs
+is a list of one or more start conditions.
+Inside the start condition
+scope, every rule automatically has the prefix
+.I <SCs>
+applied to it, until a
+.I '}'
+which matches the initial
+.I '{'.
+So, for example,
+.nf
+
+ <ESC>{
+ "\\\\n" return '\\n';
+ "\\\\r" return '\\r';
+ "\\\\f" return '\\f';
+ "\\\\0" return '\\0';
+ }
+
+.fi
+is equivalent to:
+.nf
+
+ <ESC>"\\\\n" return '\\n';
+ <ESC>"\\\\r" return '\\r';
+ <ESC>"\\\\f" return '\\f';
+ <ESC>"\\\\0" return '\\0';
+
+.fi
+Start condition scopes may be nested.
+.PP
+Three routines are available for manipulating stacks of start conditions:
+.TP
+.B void yy_push_state(int new_state)
+pushes the current start condition onto the top of the start condition
+stack and switches to
+.I new_state
+as though you had used
+.B BEGIN new_state
+(recall that start condition names are also integers).
+.TP
+.B void yy_pop_state()
+pops the top of the stack and switches to it via
+.B BEGIN.
+.TP
+.B int yy_top_state()
+returns the top of the stack without altering the stack's contents.
+.PP
+The start condition stack grows dynamically and so has no built-in
+size limitation.
+If memory is exhausted, program execution aborts.
+.PP
+To use start condition stacks, your scanner must include a
+.B %option stack
+directive (see Options below).
+.SH MULTIPLE INPUT BUFFERS
+Some scanners (such as those which support "include" files)
+require reading from several input streams.
+As
+.I flex
+scanners do a large amount of buffering, one cannot control
+where the next input will be read from by simply writing a
+.B YY_INPUT
+which is sensitive to the scanning context.
+.B YY_INPUT
+is only called when the scanner reaches the end of its buffer, which
+may be a long time after scanning a statement such as an "include"
+which requires switching the input source.
+.PP
+To negotiate these sorts of problems,
+.I flex
+provides a mechanism for creating and switching between multiple
+input buffers.
+An input buffer is created by using:
+.nf
+
+ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+
+.fi
+which takes a
+.I FILE
+pointer and a size and creates a buffer associated with the given
+file and large enough to hold
+.I size
+characters (when in doubt, use
+.B YY_BUF_SIZE
+for the size).
+It returns a
+.B YY_BUFFER_STATE
+handle, which may then be passed to other routines (see below).
+The
+.B YY_BUFFER_STATE
+type is a pointer to an opaque
+.B struct yy_buffer_state
+structure, so you may safely initialize YY_BUFFER_STATE variables to
+.B ((YY_BUFFER_STATE) 0)
+if you wish, and also refer to the opaque structure in order to
+correctly declare input buffers in source files other than that
+of your scanner.
+Note that the
+.I FILE
+pointer in the call to
+.B yy_create_buffer
+is only used as the value of
+.I yyin
+seen by
+.B YY_INPUT;
+if you redefine
+.B YY_INPUT
+so it no longer uses
+.I yyin,
+then you can safely pass a nil
+.I FILE
+pointer to
+.B yy_create_buffer.
+You select a particular buffer to scan from using:
+.nf
+
+ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+
+.fi
+switches the scanner's input buffer so subsequent tokens will
+come from
+.I new_buffer.
+Note that
+.B yy_switch_to_buffer()
+may be used by yywrap() to set things up for continued scanning, instead
+of opening a new file and pointing
+.I yyin
+at it.
+Note also that switching input sources via either
+.B yy_switch_to_buffer()
+or
+.B yywrap()
+does
+.I not
+change the start condition.
+.nf
+
+ void yy_delete_buffer( YY_BUFFER_STATE buffer )
+
+.fi
+is used to reclaim the storage associated with a buffer.
+(
+.B buffer
+can be nil, in which case the routine does nothing.)
+You can also clear the current contents of a buffer using:
+.nf
+
+ void yy_flush_buffer( YY_BUFFER_STATE buffer )
+
+.fi
+This function discards the buffer's contents,
+so the next time the scanner attempts to match a token from the
+buffer, it will first fill the buffer anew using
+.B YY_INPUT.
+.PP
+.B yy_new_buffer()
+is an alias for
+.B yy_create_buffer(),
+provided for compatibility with the C++ use of
+.I new
+and
+.I delete
+for creating and destroying dynamic objects.
+.PP
+Finally, the
+.B YY_CURRENT_BUFFER
+macro returns a
+.B YY_BUFFER_STATE
+handle to the current buffer.
+.PP
+Here is an example of using these features for writing a scanner
+which expands include files (the
+.B <<EOF>>
+feature is discussed below):
+.nf
+
+ /* the "incl" state is used for picking up the name
+ * of an include file
+ */
+ %x incl
+
+ %{
+ #define MAX_INCLUDE_DEPTH 10
+ YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+ int include_stack_ptr = 0;
+ %}
+
+ %%
+ include BEGIN(incl);
+
+ [a-z]+ ECHO;
+ [^a-z\\n]*\\n? ECHO;
+
+ <incl>[ \\t]* /* eat the whitespace */
+ <incl>[^ \\t\\n]+ { /* got the include file name */
+ if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
+ {
+ fprintf( stderr, "Includes nested too deeply" );
+ exit( 1 );
+ }
+
+ include_stack[include_stack_ptr++] =
+ YY_CURRENT_BUFFER;
+
+ yyin = fopen( yytext, "r" );
+
+ if ( ! yyin )
+ error( ... );
+
+ yy_switch_to_buffer(
+ yy_create_buffer( yyin, YY_BUF_SIZE ) );
+
+ BEGIN(INITIAL);
+ }
+
+ <<EOF>> {
+ if ( --include_stack_ptr < 0 )
+ {
+ yyterminate();
+ }
+
+ else
+ {
+ yy_delete_buffer( YY_CURRENT_BUFFER );
+ yy_switch_to_buffer(
+ include_stack[include_stack_ptr] );
+ }
+ }
+
+.fi
+Three routines are available for setting up input buffers for
+scanning in-memory strings instead of files.
+All of them create
+a new input buffer for scanning the string, and return a corresponding
+.B YY_BUFFER_STATE
+handle (which you should delete with
+.B yy_delete_buffer()
+when done with it).
+They also switch to the new buffer using
+.B yy_switch_to_buffer(),
+so the next call to
+.B yylex()
+will start scanning the string.
+.TP
+.B yy_scan_string(const char *str)
+scans a NUL-terminated string.
+.TP
+.B yy_scan_bytes(const char *bytes, int len)
+scans
+.I len
+bytes (including possibly NUL's)
+starting at location
+.I bytes.
+.PP
+Note that both of these functions create and scan a
+.I copy
+of the string or bytes.
+(This may be desirable, since
+.B yylex()
+modifies the contents of the buffer it is scanning.) You can avoid the
+copy by using:
+.TP
+.B yy_scan_buffer(char *base, yy_size_t size)
+which scans in place the buffer starting at
+.I base,
+consisting of
+.I size
+bytes, the last two bytes of which
+.I must
+be
+.B YY_END_OF_BUFFER_CHAR
+(ASCII NUL).
+These last two bytes are not scanned; thus, scanning
+consists of
+.B base[0]
+through
+.B base[size-2],
+inclusive.
+.IP
+If you fail to set up
+.I base
+in this manner (i.e., forget the final two
+.B YY_END_OF_BUFFER_CHAR
+bytes), then
+.B yy_scan_buffer()
+returns a nil pointer instead of creating a new input buffer.
+.IP
+The type
+.B yy_size_t
+is an integral type to which you can cast an integer expression
+reflecting the size of the buffer.
+.SH END-OF-FILE RULES
+The special rule "<<EOF>>" indicates
+actions which are to be taken when an end-of-file is
+encountered and yywrap() returns non-zero (i.e., indicates
+no further files to process).
+The action must finish
+by doing one of four things:
+.IP -
+assigning
+.I yyin
+to a new input file (in previous versions of flex, after doing the
+assignment you had to call the special action
+.B YY_NEW_FILE;
+this is no longer necessary);
+.IP -
+executing a
+.I return
+statement;
+.IP -
+executing the special
+.B yyterminate()
+action;
+.IP -
+or, switching to a new buffer using
+.B yy_switch_to_buffer()
+as shown in the example above.
+.PP
+<<EOF>> rules may not be used with other
+patterns; they may only be qualified with a list of start
+conditions.
+If an unqualified <<EOF>> rule is given, it
+applies to
+.I all
+start conditions which do not already have <<EOF>> actions.
+To
+specify an <<EOF>> rule for only the initial start condition, use
+.nf
+
+ <INITIAL><<EOF>>
+
+.fi
+.PP
+These rules are useful for catching things like unclosed comments.
+An example:
+.nf
+
+ %x quote
+ %%
+
+ ...other rules for dealing with quotes...
+
+ <quote><<EOF>> {
+ error( "unterminated quote" );
+ yyterminate();
+ }
+ <<EOF>> {
+ if ( *++filelist )
+ yyin = fopen( *filelist, "r" );
+ else
+ yyterminate();
+ }
+
+.fi
+.SH MISCELLANEOUS MACROS
+The macro
+.B YY_USER_ACTION
+can be defined to provide an action
+which is always executed prior to the matched rule's action.
+For example,
+it could be #define'd to call a routine to convert yytext to lower-case.
+When
+.B YY_USER_ACTION
+is invoked, the variable
+.I yy_act
+gives the number of the matched rule (rules are numbered starting with 1).
+Suppose you want to profile how often each of your rules is matched.
+The following would do the trick:
+.nf
+
+ #define YY_USER_ACTION ++ctr[yy_act]
+
+.fi
+where
+.I ctr
+is an array to hold the counts for the different rules.
+Note that the macro
+.B YY_NUM_RULES
+gives the total number of rules (including the default rule, even if
+you use
+.B \-s),
+so a correct declaration for
+.I ctr
+is:
+.nf
+
+ int ctr[YY_NUM_RULES];
+
+.fi
+.PP
+The macro
+.B YY_USER_INIT
+may be defined to provide an action which is always executed before
+the first scan (and before the scanner's internal initializations are done).
+For example, it could be used to call a routine to read
+in a data table or open a logging file.
+.PP
+The macro
+.B yy_set_interactive(is_interactive)
+can be used to control whether the current buffer is considered
+.I interactive.
+An interactive buffer is processed more slowly,
+but must be used when the scanner's input source is indeed
+interactive to avoid problems due to waiting to fill buffers
+(see the discussion of the
+.B \-I
+flag below).
+A non-zero value
+in the macro invocation marks the buffer as interactive, a zero
+value as non-interactive.
+Note that use of this macro overrides
+.B %option interactive ,
+.B %option always-interactive
+or
+.B %option never-interactive
+(see Options below).
+.B yy_set_interactive()
+must be invoked prior to beginning to scan the buffer that is
+(or is not) to be considered interactive.
+.PP
+The macro
+.B yy_set_bol(at_bol)
+can be used to control whether the current buffer's scanning
+context for the next token match is done as though at the
+beginning of a line.
+A non-zero macro argument makes rules anchored with
+ '^' active, while a zero argument makes '^' rules inactive.
+.PP
+The macro
+.B YY_AT_BOL()
+returns true if the next token scanned from the current buffer
+will have '^' rules active, false otherwise.
+.PP
+In the generated scanner, the actions are all gathered in one large
+switch statement and separated using
+.B YY_BREAK,
+which may be redefined.
+By default, it is simply a "break", to separate
+each rule's action from the following rule's.
+Redefining
+.B YY_BREAK
+allows, for example, C++ users to
+#define YY_BREAK to do nothing (while being very careful that every
+rule ends with a "break" or a "return"!) to avoid suffering from
+unreachable statement warnings where because a rule's action ends with
+"return", the
+.B YY_BREAK
+is inaccessible.
+.SH VALUES AVAILABLE TO THE USER
+This section summarizes the various values available to the user
+in the rule actions.
+.IP -
+.B char *yytext
+holds the text of the current token.
+It may be modified but not lengthened
+(you cannot append characters to the end).
+.IP
+If the special directive
+.B %array
+appears in the first section of the scanner description, then
+.B yytext
+is instead declared
+.B char yytext[YYLMAX],
+where
+.B YYLMAX
+is a macro definition that you can redefine in the first section
+if you don't like the default value (generally 8KB).
+Using
+.B %array
+results in somewhat slower scanners, but the value of
+.B yytext
+becomes immune to calls to
+.I input()
+and
+.I unput(),
+which potentially destroy its value when
+.B yytext
+is a character pointer.
+The opposite of
+.B %array
+is
+.B %pointer,
+which is the default.
+.IP
+You cannot use
+.B %array
+when generating C++ scanner classes
+(the
+.B \-+
+flag).
+.IP -
+.B int yyleng
+holds the length of the current token.
+.IP -
+.B FILE *yyin
+is the file which by default
+.I flex
+reads from.
+It may be redefined but doing so only makes sense before
+scanning begins or after an EOF has been encountered.
+Changing it in the midst of scanning will have unexpected results since
+.I flex
+buffers its input; use
+.B yyrestart()
+instead.
+Once scanning terminates because an end-of-file
+has been seen, you can assign
+.I yyin
+at the new input file and then call the scanner again to continue scanning.
+.IP -
+.B void yyrestart( FILE *new_file )
+may be called to point
+.I yyin
+at the new input file.
+The switch-over to the new file is immediate
+(any previously buffered-up input is lost).
+Note that calling
+.B yyrestart()
+with
+.I yyin
+as an argument thus throws away the current input buffer and continues
+scanning the same input file.
+.IP -
+.B FILE *yyout
+is the file to which
+.B ECHO
+actions are done.
+It can be reassigned by the user.
+.IP -
+.B YY_CURRENT_BUFFER
+returns a
+.B YY_BUFFER_STATE
+handle to the current buffer.
+.IP -
+.B YY_START
+returns an integer value corresponding to the current start
+condition.
+You can subsequently use this value with
+.B BEGIN
+to return to that start condition.
+.SH INTERFACING WITH YACC
+One of the main uses of
+.I flex
+is as a companion to the
+.I yacc
+parser-generator.
+.I yacc
+parsers expect to call a routine named
+.B yylex()
+to find the next input token.
+The routine is supposed to
+return the type of the next token as well as putting any associated
+value in the global
+.B yylval.
+To use
+.I flex
+with
+.I yacc,
+one specifies the
+.B \-d
+option to
+.I yacc
+to instruct it to generate the file
+.B y.tab.h
+containing definitions of all the
+.B %tokens
+appearing in the
+.I yacc
+input.
+This file is then included in the
+.I flex
+scanner.
+For example, if one of the tokens is "TOK_NUMBER",
+part of the scanner might look like:
+.nf
+
+ %{
+ #include "y.tab.h"
+ %}
+
+ %%
+
+ [0-9]+ yylval = atoi( yytext ); return TOK_NUMBER;
+
+.fi
+.SH OPTIONS
+.I flex
+has the following options:
+.TP
+.B \-b, --backup
+Generate backing-up information to
+.I lex.backup.
+This is a list of scanner states which require backing up
+and the input characters on which they do so.
+By adding rules one
+can remove backing-up states.
+If
+.I all
+backing-up states are eliminated and
+.B \-Cf
+or
+.B \-CF
+is used, the generated scanner will run faster (see the
+.B \-p
+flag).
+Only users who wish to squeeze every last cycle out of their
+scanners need worry about this option.
+(See the section on Performance Considerations below.)
+.TP
+.B \-c
+is a do-nothing, deprecated option included for POSIX compliance.
+.TP
+.B \-d, \-\-debug
+makes the generated scanner run in
+.I debug
+mode.
+Whenever a pattern is recognized and the global
+.B yy_flex_debug
+is non-zero (which is the default),
+the scanner will write to
+.I stderr
+a line of the form:
+.nf
+
+ --accepting rule at line 53 ("the matched text")
+
+.fi
+The line number refers to the location of the rule in the file
+defining the scanner (i.e., the file that was fed to flex).
+Messages are also generated when the scanner backs up, accepts the
+default rule, reaches the end of its input buffer (or encounters
+a NUL; at this point, the two look the same as far as the scanner's concerned),
+or reaches an end-of-file.
+.TP
+.B \-f, \-\-full
+specifies
+.I fast scanner.
+No table compression is done and stdio is bypassed.
+The result is large but fast.
+This option is equivalent to
+.B \-Cfr
+(see below).
+.TP
+.B \-h, \-\-help
+generates a "help" summary of
+.I flex's
+options to
+.I stdout
+and then exits.
+.B \-?
+and
+.B \-\-help
+are synonyms for
+.B \-h.
+.TP
+.B \-i, \-\-case-insensitive
+instructs
+.I flex
+to generate a
+.I case-insensitive
+scanner.
+The case of letters given in the
+.I flex
+input patterns will
+be ignored, and tokens in the input will be matched regardless of case.
+The matched text given in
+.I yytext
+will have the preserved case (i.e., it will not be folded).
+.TP
+.B \-l, \-\-lex\-compat
+turns on maximum compatibility with the original AT&T
+.I lex
+implementation.
+Note that this does not mean
+.I full
+compatibility.
+Use of this option costs a considerable amount of
+performance, and it cannot be used with the
+.B \-+, -f, -F, -Cf,
+or
+.B -CF
+options.
+For details on the compatibilities it provides, see the section
+"Incompatibilities With Lex And POSIX" below.
+This option also results
+in the name
+.B YY_FLEX_LEX_COMPAT
+being #define'd in the generated scanner.
+.TP
+.B \-n
+is another do-nothing, deprecated option included only for
+POSIX compliance.
+.TP
+.B \-p, \-\-perf\-report
+generates a performance report to stderr.
+The report consists of comments regarding features of the
+.I flex
+input file which will cause a serious loss of performance in the resulting
+scanner.
+If you give the flag twice, you will also get comments regarding
+features that lead to minor performance losses.
+.IP
+Note that the use of
+.B REJECT,
+.B %option yylineno,
+and variable trailing context (see the Deficiencies / Bugs section below)
+entails a substantial performance penalty; use of
+.I yymore(),
+the
+.B ^
+operator,
+and the
+.B \-I
+flag entail minor performance penalties.
+.TP
+.B \-s, \-\-no\-default
+causes the
+.I default rule
+(that unmatched scanner input is echoed to
+.I stdout)
+to be suppressed.
+If the scanner encounters input that does not
+match any of its rules, it aborts with an error.
+This option is
+useful for finding holes in a scanner's rule set.
+.TP
+.B \-t, \-\-stdout
+instructs
+.I flex
+to write the scanner it generates to standard output instead
+of
+.B lex.yy.c.
+.TP
+.B \-v, \-\-verbose
+specifies that
+.I flex
+should write to
+.I stderr
+a summary of statistics regarding the scanner it generates.
+Most of the statistics are meaningless to the casual
+.I flex
+user, but the first line identifies the version of
+.I flex
+(same as reported by
+.B \-V),
+and the next line the flags used when generating the scanner, including
+those that are on by default.
+.TP
+.B \-w, \-\-nowarn
+suppresses warning messages.
+.TP
+.B \-B, \-\-batch
+instructs
+.I flex
+to generate a
+.I batch
+scanner, the opposite of
+.I interactive
+scanners generated by
+.B \-I
+(see below).
+In general, you use
+.B \-B
+when you are
+.I certain
+that your scanner will never be used interactively, and you want to
+squeeze a
+.I little
+more performance out of it.
+If your goal is instead to squeeze out a
+.I lot
+more performance, you should be using the
+.B \-Cf
+or
+.B \-CF
+options (discussed below), which turn on
+.B \-B
+automatically anyway.
+.TP
+.B \-F, \-\-fast
+specifies that the
+.I fast
+scanner table representation should be used (and stdio
+bypassed).
+This representation is about as fast as the full table representation
+.B (-f),
+and for some sets of patterns will be considerably smaller (and for
+others, larger).
+In general, if the pattern set contains both "keywords"
+and a catch-all, "identifier" rule, such as in the set:
+.nf
+
+ "case" return TOK_CASE;
+ "switch" return TOK_SWITCH;
+ ...
+ "default" return TOK_DEFAULT;
+ [a-z]+ return TOK_ID;
+
+.fi
+then you're better off using the full table representation.
+If only
+the "identifier" rule is present and you then use a hash table or some such
+to detect the keywords, you're better off using
+.B -F.
+.IP
+This option is equivalent to
+.B \-CFr
+(see below).
+It cannot be used with
+.B \-+.
+.TP
+.B \-I, \-\-interactive
+instructs
+.I flex
+to generate an
+.I interactive
+scanner.
+An interactive scanner is one that only looks ahead to decide
+what token has been matched if it absolutely must.
+It turns out that
+always looking one extra character ahead, even if the scanner has already
+seen enough text to disambiguate the current token, is a bit faster than
+only looking ahead when necessary.
+But scanners that always look ahead
+give dreadful interactive performance; for example, when a user types
+a newline, it is not recognized as a newline token until they enter
+.I another
+token, which often means typing in another whole line.
+.IP
+.I Flex
+scanners default to
+.I interactive
+unless you use the
+.B \-Cf
+or
+.B \-CF
+table-compression options (see below).
+That's because if you're looking
+for high-performance you should be using one of these options, so if you
+didn't,
+.I flex
+assumes you'd rather trade off a bit of run-time performance for intuitive
+interactive behavior.
+Note also that you
+.I cannot
+use
+.B \-I
+in conjunction with
+.B \-Cf
+or
+.B \-CF.
+Thus, this option is not really needed; it is on by default for all those
+cases in which it is allowed.
+.IP
+Note that if
+.B isatty()
+returns false for the scanner input, flex will revert to batch mode, even if
+.B \-I
+was specified.
+To force interactive mode no matter what, use
+.B %option always-interactive
+(see Options below).
+.IP
+You can force a scanner to
+.I not
+be interactive by using
+.B \-B
+(see above).
+.TP
+.B \-L, \-\-noline
+instructs
+.I flex
+not to generate
+.B #line
+directives.
+Without this option,
+.I flex
+peppers the generated scanner
+with #line directives so error messages in the actions will be correctly
+located with respect to either the original
+.I flex
+input file (if the errors are due to code in the input file), or
+.B lex.yy.c
+(if the errors are
+.I flex's
+fault -- you should report these sorts of errors to the email address
+given below).
+.TP
+.B \-T, \-\-trace
+makes
+.I flex
+run in
+.I trace
+mode.
+It will generate a lot of messages to
+.I stderr
+concerning
+the form of the input and the resultant non-deterministic and deterministic
+finite automata.
+This option is mostly for use in maintaining
+.I flex.
+.TP
+.B \-V, \-\-version
+prints the version number to
+.I stdout
+and exits.
+.B \-\-version
+is a synonym for
+.B \-V.
+.TP
+.B \-7, \-\-7bit
+instructs
+.I flex
+to generate a 7-bit scanner, i.e., one which can only recognize 7-bit
+characters in its input.
+The advantage of using
+.B \-7
+is that the scanner's tables can be up to half the size of those generated
+using the
+.B \-8
+option (see below).
+The disadvantage is that such scanners often hang
+or crash if their input contains an 8-bit character.
+.IP
+Note, however, that unless you generate your scanner using the
+.B \-Cf
+or
+.B \-CF
+table compression options, use of
+.B \-7
+will save only a small amount of table space, and make your scanner
+considerably less portable.
+.I Flex's
+default behavior is to generate an 8-bit scanner unless you use the
+.B \-Cf
+or
+.B \-CF,
+in which case
+.I flex
+defaults to generating 7-bit scanners unless your site was always
+configured to generate 8-bit scanners (as will often be the case
+with non-USA sites).
+You can tell whether flex generated a 7-bit
+or an 8-bit scanner by inspecting the flag summary in the
+.B \-v
+output as described above.
+.IP
+Note that if you use
+.B \-Cfe
+or
+.B \-CFe
+(those table compression options, but also using equivalence classes as
+discussed see below), flex still defaults to generating an 8-bit
+scanner, since usually with these compression options full 8-bit tables
+are not much more expensive than 7-bit tables.
+.TP
+.B \-8, \-\-8bit
+instructs
+.I flex
+to generate an 8-bit scanner, i.e., one which can recognize 8-bit
+characters.
+This flag is only needed for scanners generated using
+.B \-Cf
+or
+.B \-CF,
+as otherwise flex defaults to generating an 8-bit scanner anyway.
+.IP
+See the discussion of
+.B \-7
+above for flex's default behavior and the tradeoffs between 7-bit
+and 8-bit scanners.
+.TP
+.B \-+, \-\-c++
+specifies that you want flex to generate a C++
+scanner class.
+See the section on Generating C++ Scanners below for
+details.
+.TP
+.B \-C[aefFmr]
+controls the degree of table compression and, more generally, trade-offs
+between small scanners and fast scanners.
+.IP
+.B \-Ca, \-\-align
+("align") instructs flex to trade off larger tables in the
+generated scanner for faster performance because the elements of
+the tables are better aligned for memory access and computation.
+On some
+RISC architectures, fetching and manipulating longwords is more efficient
+than with smaller-sized units such as shortwords.
+This option can
+double the size of the tables used by your scanner.
+.IP
+.B \-Ce, \-\-ecs
+directs
+.I flex
+to construct
+.I equivalence classes,
+i.e., sets of characters
+which have identical lexical properties (for example, if the only
+appearance of digits in the
+.I flex
+input is in the character class
+"[0-9]" then the digits '0', '1', ..., '9' will all be put
+in the same equivalence class).
+Equivalence classes usually give
+dramatic reductions in the final table/object file sizes (typically
+a factor of 2-5) and are pretty cheap performance-wise (one array
+look-up per character scanned).
+.IP
+.B \-Cf
+specifies that the
+.I full
+scanner tables should be generated -
+.I flex
+should not compress the
+tables by taking advantages of similar transition functions for
+different states.
+.IP
+.B \-CF
+specifies that the alternative fast scanner representation (described
+above under the
+.B \-F
+flag)
+should be used.
+This option cannot be used with
+.B \-+.
+.IP
+.B \-Cm, \-\-meta-ecs
+directs
+.I flex
+to construct
+.I meta-equivalence classes,
+which are sets of equivalence classes (or characters, if equivalence
+classes are not being used) that are commonly used together.
+Meta-equivalence
+classes are often a big win when using compressed tables, but they
+have a moderate performance impact (one or two "if" tests and one
+array look-up per character scanned).
+.IP
+.B \-Cr, \-\-read
+causes the generated scanner to
+.I bypass
+use of the standard I/O library (stdio) for input.
+Instead of calling
+.B fread()
+or
+.B getc(),
+the scanner will use the
+.B read()
+system call, resulting in a performance gain which varies from system
+to system, but in general is probably negligible unless you are also using
+.B \-Cf
+or
+.B \-CF.
+Using
+.B \-Cr
+can cause strange behavior if, for example, you read from
+.I yyin
+using stdio prior to calling the scanner (because the scanner will miss
+whatever text your previous reads left in the stdio input buffer).
+.IP
+.B \-Cr
+has no effect if you define
+.B YY_INPUT
+(see The Generated Scanner above).
+.IP
+A lone
+.B \-C
+specifies that the scanner tables should be compressed but neither
+equivalence classes nor meta-equivalence classes should be used.
+.IP
+The options
+.B \-Cf
+or
+.B \-CF
+and
+.B \-Cm
+do not make sense together - there is no opportunity for meta-equivalence
+classes if the table is not being compressed.
+Otherwise the options
+may be freely mixed, and are cumulative.
+.IP
+The default setting is
+.B \-Cem,
+which specifies that
+.I flex
+should generate equivalence classes
+and meta-equivalence classes.
+This setting provides the highest degree of table compression.
+You can trade off
+faster-executing scanners at the cost of larger tables with
+the following generally being true:
+.nf
+
+ slowest & smallest
+ -Cem
+ -Cm
+ -Ce
+ -C
+ -C{f,F}e
+ -C{f,F}
+ -C{f,F}a
+ fastest & largest
+
+.fi
+Note that scanners with the smallest tables are usually generated and
+compiled the quickest, so
+during development you will usually want to use the default, maximal
+compression.
+.IP
+.B \-Cfe
+is often a good compromise between speed and size for production
+scanners.
+.TP
+.B \-ooutput, \-\-outputfile=FILE
+directs flex to write the scanner to the file
+.B output
+instead of
+.B lex.yy.c.
+If you combine
+.B \-o
+with the
+.B \-t
+option, then the scanner is written to
+.I stdout
+but its
+.B #line
+directives (see the
+.B \\-L
+option above) refer to the file
+.B output.
+.TP
+.B \-Pprefix, \-\-prefix=STRING
+changes the default
+.I "yy"
+prefix used by
+.I flex
+for all globally-visible variable and function names to instead be
+.I prefix.
+For example,
+.B \-Pfoo
+changes the name of
+.B yytext
+to
+.B footext.
+It also changes the name of the default output file from
+.B lex.yy.c
+to
+.B lex.foo.c.
+Here are all of the names affected:
+.nf
+
+ yy_create_buffer
+ yy_delete_buffer
+ yy_flex_debug
+ yy_init_buffer
+ yy_flush_buffer
+ yy_load_buffer_state
+ yy_switch_to_buffer
+ yyin
+ yyleng
+ yylex
+ yylineno
+ yyout
+ yyrestart
+ yytext
+ yywrap
+
+.fi
+(If you are using a C++ scanner, then only
+.B yywrap
+and
+.B yyFlexLexer
+are affected.)
+Within your scanner itself, you can still refer to the global variables
+and functions using either version of their name; but externally, they
+have the modified name.
+.IP
+This option lets you easily link together multiple
+.I flex
+programs into the same executable.
+Note, though, that using this option also renames
+.B yywrap(),
+so you now
+.I must
+either
+provide your own (appropriately-named) version of the routine for your
+scanner, or use
+.B %option noyywrap,
+as linking with
+.B \-ll
+no longer provides one for you by default.
+.TP
+.B \-Sskeleton_file, \-\-skel=FILE
+overrides the default skeleton file from which
+.I flex
+constructs its scanners.
+You'll never need this option unless you are doing
+.I flex
+maintenance or development.
+.TP
+.B \-X, \-\-posix\-compat
+maximal compatibility with POSIX lex.
+.TP
+.B \-\-yylineno
+track line count in yylineno.
+.TP
+.B \-\-yyclass=NAME
+name of C++ class.
+.TP
+.B \-\-header\-file=FILE
+create a C header file in addition to the scanner.
+.TP
+.B \-\-tables\-file[=FILE]
+write tables to FILE.
+.TP
+.B \\-Dmacro[=defn]
+#define macro defn (default defn is '1').
+.TP
+.B \-R, \-\-reentrant
+generate a reentrant C scanner
+.TP
+.B \-\-bison\-bridge
+scanner for bison pure parser.
+.TP
+.B \-\-bison\-locations
+include yylloc support.
+.TP
+.B \-\-stdinit
+initialize yyin/yyout to stdin/stdout.
+.TP
+.B \-\-noansi\-definitions old\-style function definitions.
+.TP
+.B \-\-noansi\-prototypes
+empty parameter list in prototypes.
+.TP
+.B \-\-nounistd
+do not include <unistd.h>.
+.TP
+.B \-\-noFUNCTION
+do not generate a particular FUNCTION.
+.PP
+.I flex
+also provides a mechanism for controlling options within the
+scanner specification itself, rather than from the flex command-line.
+This is done by including
+.B %option
+directives in the first section of the scanner specification.
+You can specify multiple options with a single
+.B %option
+directive, and multiple directives in the first section of your flex input
+file.
+.PP
+Most options are given simply as names, optionally preceded by the
+word "no" (with no intervening whitespace) to negate their meaning.
+A number are equivalent to flex flags or their negation:
+.nf
+
+ 7bit -7 option
+ 8bit -8 option
+ align -Ca option
+ backup -b option
+ batch -B option
+ c++ -+ option
+
+ caseful or
+ case-sensitive opposite of -i (default)
+
+ case-insensitive or
+ caseless -i option
+
+ debug -d option
+ default opposite of -s option
+ ecs -Ce option
+ fast -F option
+ full -f option
+ interactive -I option
+ lex-compat -l option
+ meta-ecs -Cm option
+ perf-report -p option
+ read -Cr option
+ stdout -t option
+ verbose -v option
+ warn opposite of -w option
+ (use "%option nowarn" for -w)
+
+ array equivalent to "%array"
+ pointer equivalent to "%pointer" (default)
+
+.fi
+Some
+.B %option's
+provide features otherwise not available:
+.TP
+.B always-interactive
+instructs flex to generate a scanner which always considers its input
+"interactive".
+Normally, on each new input file the scanner calls
+.B isatty()
+in an attempt to determine whether
+the scanner's input source is interactive and thus should be read a
+character at a time.
+When this option is used, however, then no
+such call is made.
+.TP
+.B main
+directs flex to provide a default
+.B main()
+program for the scanner, which simply calls
+.B yylex().
+This option implies
+.B noyywrap
+(see below).
+.TP
+.B never-interactive
+instructs flex to generate a scanner which never considers its input
+"interactive" (again, no call made to
+.B isatty()).
+This is the opposite of
+.B always-interactive.
+.TP
+.B stack
+enables the use of start condition stacks (see Start Conditions above).
+.TP
+.B stdinit
+if set (i.e.,
+.B %option stdinit)
+initializes
+.I yyin
+and
+.I yyout
+to
+.I stdin
+and
+.I stdout,
+instead of the default of
+.I nil.
+Some existing
+.I lex
+programs depend on this behavior, even though it is not compliant with
+ANSI C, which does not require
+.I stdin
+and
+.I stdout
+to be compile-time constant.
+.TP
+.B yylineno
+directs
+.I flex
+to generate a scanner that maintains the number of the current line
+read from its input in the global variable
+.B yylineno.
+This option is implied by
+.B %option lex-compat.
+.TP
+.B yywrap
+if unset (i.e.,
+.B %option noyywrap),
+makes the scanner not call
+.B yywrap()
+upon an end-of-file, but simply assume that there are no more
+files to scan (until the user points
+.I yyin
+at a new file and calls
+.B yylex()
+again).
+.PP
+.I flex
+scans your rule actions to determine whether you use the
+.B REJECT
+or
+.B yymore()
+features.
+The
+.B reject
+and
+.B yymore
+options are available to override its decision as to whether you use the
+options, either by setting them (e.g.,
+.B %option reject)
+to indicate the feature is indeed used, or
+unsetting them to indicate it actually is not used
+(e.g.,
+.B %option noyymore).
+.PP
+Three options take string-delimited values, offset with '=':
+.nf
+
+ %option outfile="ABC"
+
+.fi
+is equivalent to
+.B -oABC,
+and
+.nf
+
+ %option prefix="XYZ"
+
+.fi
+is equivalent to
+.B -PXYZ.
+Finally,
+.nf
+
+ %option yyclass="foo"
+
+.fi
+only applies when generating a C++ scanner (
+.B \-+
+option).
+It informs
+.I flex
+that you have derived
+.B foo
+as a subclass of
+.B yyFlexLexer,
+so
+.I flex
+will place your actions in the member function
+.B foo::yylex()
+instead of
+.B yyFlexLexer::yylex().
+It also generates a
+.B yyFlexLexer::yylex()
+member function that emits a run-time error (by invoking
+.B yyFlexLexer::LexerError())
+if called.
+See Generating C++ Scanners, below, for additional information.
+.PP
+A number of options are available for lint purists who want to suppress
+the appearance of unneeded routines in the generated scanner.
+Each of the following, if unset
+(e.g.,
+.B %option nounput
+), results in the corresponding routine not appearing in
+the generated scanner:
+.nf
+
+ input, unput
+ yy_push_state, yy_pop_state, yy_top_state
+ yy_scan_buffer, yy_scan_bytes, yy_scan_string
+
+.fi
+(though
+.B yy_push_state()
+and friends won't appear anyway unless you use
+.B %option stack).
+.SH PERFORMANCE CONSIDERATIONS
+The main design goal of
+.I flex
+is that it generate high-performance scanners.
+It has been optimized
+for dealing well with large sets of rules.
+Aside from the effects on scanner speed of the table compression
+.B \-C
+options outlined above,
+there are a number of options/actions which degrade performance.
+These are, from most expensive to least:
+.nf
+
+ REJECT
+ %option yylineno
+ arbitrary trailing context
+
+ pattern sets that require backing up
+ %array
+ %option interactive
+ %option always-interactive
+
+ '^' beginning-of-line operator
+ yymore()
+
+.fi
+with the first three all being quite expensive and the last two
+being quite cheap.
+Note also that
+.B unput()
+is implemented as a routine call that potentially does quite a bit of
+work, while
+.B yyless()
+is a quite-cheap macro; so if just putting back some excess text you
+scanned, use
+.B yyless().
+.PP
+.B REJECT
+should be avoided at all costs when performance is important.
+It is a particularly expensive option.
+.PP
+Getting rid of backing up is messy and often may be an enormous
+amount of work for a complicated scanner.
+In principal, one begins by using the
+.B \-b
+flag to generate a
+.I lex.backup
+file.
+For example, on the input
+.nf
+
+ %%
+ foo return TOK_KEYWORD;
+ foobar return TOK_KEYWORD;
+
+.fi
+the file looks like:
+.nf
+
+ State #6 is non-accepting -
+ associated rule line numbers:
+ 2 3
+ out-transitions: [ o ]
+ jam-transitions: EOF [ \\001-n p-\\177 ]
+
+ State #8 is non-accepting -
+ associated rule line numbers:
+ 3
+ out-transitions: [ a ]
+ jam-transitions: EOF [ \\001-` b-\\177 ]
+
+ State #9 is non-accepting -
+ associated rule line numbers:
+ 3
+ out-transitions: [ r ]
+ jam-transitions: EOF [ \\001-q s-\\177 ]
+
+ Compressed tables always back up.
+
+.fi
+The first few lines tell us that there's a scanner state in
+which it can make a transition on an 'o' but not on any other
+character, and that in that state the currently scanned text does not match
+any rule.
+The state occurs when trying to match the rules found
+at lines 2 and 3 in the input file.
+If the scanner is in that state and then reads
+something other than an 'o', it will have to back up to find
+a rule which is matched.
+With a bit of headscratching one can see that this must be the
+state it's in when it has seen "fo".
+When this has happened,
+if anything other than another 'o' is seen, the scanner will
+have to back up to simply match the 'f' (by the default rule).
+.PP
+The comment regarding State #8 indicates there's a problem
+when "foob" has been scanned.
+Indeed, on any character other
+than an 'a', the scanner will have to back up to accept "foo".
+Similarly, the comment for State #9 concerns when "fooba" has
+been scanned and an 'r' does not follow.
+.PP
+The final comment reminds us that there's no point going to
+all the trouble of removing backing up from the rules unless
+we're using
+.B \-Cf
+or
+.B \-CF,
+since there's no performance gain doing so with compressed scanners.
+.PP
+The way to remove the backing up is to add "error" rules:
+.nf
+
+ %%
+ foo return TOK_KEYWORD;
+ foobar return TOK_KEYWORD;
+
+ fooba |
+ foob |
+ fo {
+ /* false alarm, not really a keyword */
+ return TOK_ID;
+ }
+
+.fi
+.PP
+Eliminating backing up among a list of keywords can also be
+done using a "catch-all" rule:
+.nf
+
+ %%
+ foo return TOK_KEYWORD;
+ foobar return TOK_KEYWORD;
+
+ [a-z]+ return TOK_ID;
+
+.fi
+This is usually the best solution when appropriate.
+.PP
+Backing up messages tend to cascade.
+With a complicated set of rules it's not uncommon to get hundreds
+of messages.
+If one can decipher them, though, it often
+only takes a dozen or so rules to eliminate the backing up (though
+it's easy to make a mistake and have an error rule accidentally match
+a valid token.
+A possible future
+.I flex
+feature will be to automatically add rules to eliminate backing up).
+.PP
+It's important to keep in mind that you gain the benefits of eliminating
+backing up only if you eliminate
+.I every
+instance of backing up.
+Leaving just one means you gain nothing.
+.PP
+.I Variable
+trailing context (where both the leading and trailing parts do not have
+a fixed length) entails almost the same performance loss as
+.B REJECT
+(i.e., substantial).
+So when possible a rule like:
+.nf
+
+ %%
+ mouse|rat/(cat|dog) run();
+
+.fi
+is better written:
+.nf
+
+ %%
+ mouse/cat|dog run();
+ rat/cat|dog run();
+
+.fi
+or as
+.nf
+
+ %%
+ mouse|rat/cat run();
+ mouse|rat/dog run();
+
+.fi
+Note that here the special '|' action does
+.I not
+provide any savings, and can even make things worse (see
+Deficiencies / Bugs below).
+.LP
+Another area where the user can increase a scanner's performance
+(and one that's easier to implement) arises from the fact that
+the longer the tokens matched, the faster the scanner will run.
+This is because with long tokens the processing of most input
+characters takes place in the (short) inner scanning loop, and
+does not often have to go through the additional work of setting up
+the scanning environment (e.g.,
+.B yytext)
+for the action.
+Recall the scanner for C comments:
+.nf
+
+ %x comment
+ %%
+ int line_num = 1;
+
+ "/*" BEGIN(comment);
+
+ <comment>[^*\\n]*
+ <comment>"*"+[^*/\\n]*
+ <comment>\\n ++line_num;
+ <comment>"*"+"/" BEGIN(INITIAL);
+
+.fi
+This could be sped up by writing it as:
+.nf
+
+ %x comment
+ %%
+ int line_num = 1;
+
+ "/*" BEGIN(comment);
+
+ <comment>[^*\\n]*
+ <comment>[^*\\n]*\\n ++line_num;
+ <comment>"*"+[^*/\\n]*
+ <comment>"*"+[^*/\\n]*\\n ++line_num;
+ <comment>"*"+"/" BEGIN(INITIAL);
+
+.fi
+Now instead of each newline requiring the processing of another
+action, recognizing the newlines is "distributed" over the other rules
+to keep the matched text as long as possible.
+Note that
+.I adding
+rules does
+.I not
+slow down the scanner! The speed of the scanner is independent
+of the number of rules or (modulo the considerations given at the
+beginning of this section) how complicated the rules are with
+regard to operators such as '*' and '|'.
+.PP
+A final example in speeding up a scanner: suppose you want to scan
+through a file containing identifiers and keywords, one per line
+and with no other extraneous characters, and recognize all the
+keywords.
+A natural first approach is:
+.nf
+
+ %%
+ asm |
+ auto |
+ break |
+ ... etc ...
+ volatile |
+ while /* it's a keyword */
+
+ .|\\n /* it's not a keyword */
+
+.fi
+To eliminate the back-tracking, introduce a catch-all rule:
+.nf
+
+ %%
+ asm |
+ auto |
+ break |
+ ... etc ...
+ volatile |
+ while /* it's a keyword */
+
+ [a-z]+ |
+ .|\\n /* it's not a keyword */
+
+.fi
+Now, if it's guaranteed that there's exactly one word per line,
+then we can reduce the total number of matches by a half by
+merging in the recognition of newlines with that of the other
+tokens:
+.nf
+
+ %%
+ asm\\n |
+ auto\\n |
+ break\\n |
+ ... etc ...
+ volatile\\n |
+ while\\n /* it's a keyword */
+
+ [a-z]+\\n |
+ .|\\n /* it's not a keyword */
+
+.fi
+One has to be careful here, as we have now reintroduced backing up
+into the scanner.
+In particular, while
+.I we
+know that there will never be any characters in the input stream
+other than letters or newlines,
+.I flex
+can't figure this out, and it will plan for possibly needing to back up
+when it has scanned a token like "auto" and then the next character
+is something other than a newline or a letter.
+Previously it would
+then just match the "auto" rule and be done, but now it has no "auto"
+rule, only an "auto\\n" rule.
+To eliminate the possibility of backing up,
+we could either duplicate all rules but without final newlines, or,
+since we never expect to encounter such an input and therefore don't
+how it's classified, we can introduce one more catch-all rule, this
+one which doesn't include a newline:
+.nf
+
+ %%
+ asm\\n |
+ auto\\n |
+ break\\n |
+ ... etc ...
+ volatile\\n |
+ while\\n /* it's a keyword */
+
+ [a-z]+\\n |
+ [a-z]+ |
+ .|\\n /* it's not a keyword */
+
+.fi
+Compiled with
+.B \-Cf,
+this is about as fast as one can get a
+.I flex
+scanner to go for this particular problem.
+.PP
+A final note:
+.I flex
+is slow when matching NUL's, particularly when a token contains
+multiple NUL's.
+It's best to write rules which match
+.I short
+amounts of text if it's anticipated that the text will often include NUL's.
+.PP
+Another final note regarding performance: as mentioned above in the section
+How the Input is Matched, dynamically resizing
+.B yytext
+to accommodate huge tokens is a slow process because it presently requires that
+the (huge) token be rescanned from the beginning.
+Thus if performance is
+vital, you should attempt to match "large" quantities of text but not
+"huge" quantities, where the cutoff between the two is at about 8K
+characters/token.
+.SH GENERATING C++ SCANNERS
+.I flex
+provides two different ways to generate scanners for use with C++.
+The first way is to simply compile a scanner generated by
+.I flex
+using a C++ compiler instead of a C compiler.
+You should not encounter
+any compilations errors (please report any you find to the email address
+given in the Author section below).
+You can then use C++ code in your rule actions instead of C code.
+Note that the default input source for your scanner remains
+.I yyin,
+and default echoing is still done to
+.I yyout.
+Both of these remain
+.I FILE *
+variables and not C++
+.I streams.
+.PP
+You can also use
+.I flex
+to generate a C++ scanner class, using the
+.B \-+
+option (or, equivalently,
+.B %option c++),
+which is automatically specified if the name of the flex
+executable ends in a '+', such as
+.I flex++.
+When using this option, flex defaults to generating the scanner to the file
+.B lex.yy.cc
+instead of
+.B lex.yy.c.
+The generated scanner includes the header file
+.I FlexLexer.h,
+which defines the interface to two C++ classes.
+.PP
+The first class,
+.B FlexLexer,
+provides an abstract base class defining the general scanner class
+interface.
+It provides the following member functions:
+.TP
+.B const char* YYText()
+returns the text of the most recently matched token, the equivalent of
+.B yytext.
+.TP
+.B int YYLeng()
+returns the length of the most recently matched token, the equivalent of
+.B yyleng.
+.TP
+.B int lineno() const
+returns the current input line number
+(see
+.B %option yylineno),
+or
+.B 1
+if
+.B %option yylineno
+was not used.
+.TP
+.B void set_debug( int flag )
+sets the debugging flag for the scanner, equivalent to assigning to
+.B yy_flex_debug
+(see the Options section above).
+Note that you must build the scanner using
+.B %option debug
+to include debugging information in it.
+.TP
+.B int debug() const
+returns the current setting of the debugging flag.
+.PP
+Also provided are member functions equivalent to
+.B yy_switch_to_buffer(),
+.B yy_create_buffer()
+(though the first argument is an
+.B std::istream*
+object pointer and not a
+.B FILE*),
+.B yy_flush_buffer(),
+.B yy_delete_buffer(),
+and
+.B yyrestart()
+(again, the first argument is a
+.B std::istream*
+object pointer).
+.PP
+The second class defined in
+.I FlexLexer.h
+is
+.B yyFlexLexer,
+which is derived from
+.B FlexLexer.
+It defines the following additional member functions:
+.TP
+.B
+yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 )
+constructs a
+.B yyFlexLexer
+object using the given streams for input and output.
+If not specified, the streams default to
+.B cin
+and
+.B cout,
+respectively.
+.TP
+.B virtual int yylex()
+performs the same role is
+.B yylex()
+does for ordinary flex scanners: it scans the input stream, consuming
+tokens, until a rule's action returns a value.
+If you derive a subclass
+.B S
+from
+.B yyFlexLexer
+and want to access the member functions and variables of
+.B S
+inside
+.B yylex(),
+then you need to use
+.B %option yyclass="S"
+to inform
+.I flex
+that you will be using that subclass instead of
+.B yyFlexLexer.
+In this case, rather than generating
+.B yyFlexLexer::yylex(),
+.I flex
+generates
+.B S::yylex()
+(and also generates a dummy
+.B yyFlexLexer::yylex()
+that calls
+.B yyFlexLexer::LexerError()
+if called).
+.TP
+.B
+virtual void switch_streams(std::istream* new_in = 0,
+.B
+std::ostream* new_out = 0)
+reassigns
+.B yyin
+to
+.B new_in
+(if non-nil)
+and
+.B yyout
+to
+.B new_out
+(ditto), deleting the previous input buffer if
+.B yyin
+is reassigned.
+.TP
+.B
+int yylex( std::istream* new_in, std::ostream* new_out = 0 )
+first switches the input streams via
+.B switch_streams( new_in, new_out )
+and then returns the value of
+.B yylex().
+.PP
+In addition,
+.B yyFlexLexer
+defines the following protected virtual functions which you can redefine
+in derived classes to tailor the scanner:
+.TP
+.B
+virtual int LexerInput( char* buf, int max_size )
+reads up to
+.B max_size
+characters into
+.B buf
+and returns the number of characters read.
+To indicate end-of-input, return 0 characters.
+Note that "interactive" scanners (see the
+.B \-B
+and
+.B \-I
+flags) define the macro
+.B YY_INTERACTIVE.
+If you redefine
+.B LexerInput()
+and need to take different actions depending on whether or not
+the scanner might be scanning an interactive input source, you can
+test for the presence of this name via
+.B #ifdef.
+.TP
+.B
+virtual void LexerOutput( const char* buf, int size )
+writes out
+.B size
+characters from the buffer
+.B buf,
+which, while NUL-terminated, may also contain "internal" NUL's if
+the scanner's rules can match text with NUL's in them.
+.TP
+.B
+virtual void LexerError( const char* msg )
+reports a fatal error message.
+The default version of this function writes the message to the stream
+.B cerr
+and exits.
+.PP
+Note that a
+.B yyFlexLexer
+object contains its
+.I entire
+scanning state.
+Thus you can use such objects to create reentrant scanners.
+You can instantiate multiple instances of the same
+.B yyFlexLexer
+class, and you can also combine multiple C++ scanner classes together
+in the same program using the
+.B \-P
+option discussed above.
+.PP
+Finally, note that the
+.B %array
+feature is not available to C++ scanner classes; you must use
+.B %pointer
+(the default).
+.PP
+Here is an example of a simple C++ scanner:
+.nf
+
+ // An example of using the flex C++ scanner class.
+
+ %{
+ int mylineno = 0;
+ %}
+
+ string \\"[^\\n"]+\\"
+
+ ws [ \\t]+
+
+ alpha [A-Za-z]
+ dig [0-9]
+ name ({alpha}|{dig}|\\$)({alpha}|{dig}|[_.\\-/$])*
+ num1 [-+]?{dig}+\\.?([eE][-+]?{dig}+)?
+ num2 [-+]?{dig}*\\.{dig}+([eE][-+]?{dig}+)?
+ number {num1}|{num2}
+
+ %%
+
+ {ws} /* skip blanks and tabs */
+
+ "/*" {
+ int c;
+
+ while((c = yyinput()) != 0)
+ {
+ if(c == '\\n')
+ ++mylineno;
+
+ else if(c == '*')
+ {
+ if((c = yyinput()) == '/')
+ break;
+ else
+ unput(c);
+ }
+ }
+ }
+
+ {number} cout << "number " << YYText() << '\\n';
+
+ \\n mylineno++;
+
+ {name} cout << "name " << YYText() << '\\n';
+
+ {string} cout << "string " << YYText() << '\\n';
+
+ %%
+
+ int main( int /* argc */, char** /* argv */ )
+ {
+ FlexLexer* lexer = new yyFlexLexer;
+ while(lexer->yylex() != 0)
+ ;
+ return 0;
+ }
+.fi
+If you want to create multiple (different) lexer classes, you use the
+.B \-P
+flag (or the
+.B prefix=
+option) to rename each
+.B yyFlexLexer
+to some other
+.B xxFlexLexer.
+You then can include
+.B <FlexLexer.h>
+in your other sources once per lexer class, first renaming
+.B yyFlexLexer
+as follows:
+.nf
+
+ #undef yyFlexLexer
+ #define yyFlexLexer xxFlexLexer
+ #include <FlexLexer.h>
+
+ #undef yyFlexLexer
+ #define yyFlexLexer zzFlexLexer
+ #include <FlexLexer.h>
+
+.fi
+if, for example, you used
+.B %option prefix="xx"
+for one of your scanners and
+.B %option prefix="zz"
+for the other.
+.PP
+IMPORTANT: the present form of the scanning class is
+.I experimental
+and may change considerably between major releases.
+.SH INCOMPATIBILITIES WITH LEX AND POSIX
+.I flex
+is a rewrite of the AT&T Unix
+.I lex
+tool (the two implementations do not share any code, though),
+with some extensions and incompatibilities, both of which
+are of concern to those who wish to write scanners acceptable
+to either implementation.
+Flex is fully compliant with the POSIX
+.I lex
+specification, except that when using
+.B %pointer
+(the default), a call to
+.B unput()
+destroys the contents of
+.B yytext,
+which is counter to the POSIX specification.
+.PP
+In this section we discuss all of the known areas of incompatibility
+between flex, AT&T lex, and the POSIX specification.
+.PP
+.I flex's
+.B \-l
+option turns on maximum compatibility with the original AT&T
+.I lex
+implementation, at the cost of a major loss in the generated scanner's
+performance.
+We note below which incompatibilities can be overcome
+using the
+.B \-l
+option.
+.PP
+.I flex
+is fully compatible with
+.I lex
+with the following exceptions:
+.IP -
+The undocumented
+.I lex
+scanner internal variable
+.B yylineno
+is not supported unless
+.B \-l
+or
+.B %option yylineno
+is used.
+.IP
+.B yylineno
+should be maintained on a per-buffer basis, rather than a per-scanner
+(single global variable) basis.
+.IP
+.B yylineno
+is not part of the POSIX specification.
+.IP -
+The
+.B input()
+routine is not redefinable, though it may be called to read characters
+following whatever has been matched by a rule.
+If
+.B input()
+encounters an end-of-file the normal
+.B yywrap()
+processing is done.
+A ``real'' end-of-file is returned by
+.B input()
+as
+.I EOF.
+.IP
+Input is instead controlled by defining the
+.B YY_INPUT
+macro.
+.IP
+The
+.I flex
+restriction that
+.B input()
+cannot be redefined is in accordance with the POSIX specification,
+which simply does not specify any way of controlling the
+scanner's input other than by making an initial assignment to
+.I yyin.
+.IP -
+The
+.B unput()
+routine is not redefinable.
+This restriction is in accordance with POSIX.
+.IP -
+.I flex
+scanners are not as reentrant as
+.I lex
+scanners.
+In particular, if you have an interactive scanner and
+an interrupt handler which long-jumps out of the scanner, and
+the scanner is subsequently called again, you may get the following
+message:
+.nf
+
+ fatal flex scanner internal error--end of buffer missed
+
+.fi
+To reenter the scanner, first use
+.nf
+
+ yyrestart( yyin );
+
+.fi
+Note that this call will throw away any buffered input; usually this
+isn't a problem with an interactive scanner.
+.IP
+Also note that flex C++ scanner classes
+.I are
+reentrant, so if using C++ is an option for you, you should use
+them instead.
+See "Generating C++ Scanners" above for details.
+.IP -
+.B output()
+is not supported.
+Output from the
+.B ECHO
+macro is done to the file-pointer
+.I yyout
+(default
+.I stdout).
+.IP
+.B output()
+is not part of the POSIX specification.
+.IP -
+.I lex
+does not support exclusive start conditions (%x), though they
+are in the POSIX specification.
+.IP -
+When definitions are expanded,
+.I flex
+encloses them in parentheses.
+With lex, the following:
+.nf
+
+ NAME [A-Z][A-Z0-9]*
+ %%
+ foo{NAME}? printf( "Found it\\n" );
+ %%
+
+.fi
+will not match the string "foo" because when the macro
+is expanded the rule is equivalent to "foo[A-Z][A-Z0-9]*?"
+and the precedence is such that the '?' is associated with
+"[A-Z0-9]*".
+With
+.I flex,
+the rule will be expanded to
+"foo([A-Z][A-Z0-9]*)?" and so the string "foo" will match.
+.IP
+Note that if the definition begins with
+.B ^
+or ends with
+.B $
+then it is
+.I not
+expanded with parentheses, to allow these operators to appear in
+definitions without losing their special meanings.
+But the
+.B <s>, /,
+and
+.B <<EOF>>
+operators cannot be used in a
+.I flex
+definition.
+.IP
+Using
+.B \-l
+results in the
+.I lex
+behavior of no parentheses around the definition.
+.IP
+The POSIX specification is that the definition be enclosed in parentheses.
+.IP -
+Some implementations of
+.I lex
+allow a rule's action to begin on a separate line, if the rule's pattern
+has trailing whitespace:
+.nf
+
+ %%
+ foo|bar<space here>
+ { foobar_action(); }
+
+.fi
+.I flex
+does not support this feature.
+.IP -
+The
+.I lex
+.B %r
+(generate a Ratfor scanner) option is not supported.
+It is not part
+of the POSIX specification.
+.IP -
+After a call to
+.B unput(),
+.I yytext
+is undefined until the next token is matched, unless the scanner
+was built using
+.B %array.
+This is not the case with
+.I lex
+or the POSIX specification.
+The
+.B \-l
+option does away with this incompatibility.
+.IP -
+The precedence of the
+.B {}
+(numeric range) operator is different.
+.I lex
+interprets "abc{1,3}" as "match one, two, or
+three occurrences of 'abc'", whereas
+.I flex
+interprets it as "match 'ab'
+followed by one, two, or three occurrences of 'c'".
+The latter is in agreement with the POSIX specification.
+.IP -
+The precedence of the
+.B ^
+operator is different.
+.I lex
+interprets "^foo|bar" as "match either 'foo' at the beginning of a line,
+or 'bar' anywhere", whereas
+.I flex
+interprets it as "match either 'foo' or 'bar' if they come at the beginning
+of a line".
+The latter is in agreement with the POSIX specification.
+.IP -
+The special table-size declarations such as
+.B %a
+supported by
+.I lex
+are not required by
+.I flex
+scanners;
+.I flex
+ignores them.
+.IP -
+The name
+.B FLEX_SCANNER
+is #define'd so scanners may be written for use with either
+.I flex
+or
+.I lex.
+Scanners also include
+.B YY_FLEX_MAJOR_VERSION
+and
+.B YY_FLEX_MINOR_VERSION
+indicating which version of
+.I flex
+generated the scanner
+(for example, for the 2.5 release, these defines would be 2 and 5
+respectively).
+.PP
+The following
+.I flex
+features are not included in
+.I lex
+or the POSIX specification:
+.nf
+
+ C++ scanners
+ %option
+ start condition scopes
+ start condition stacks
+ interactive/non-interactive scanners
+ yy_scan_string() and friends
+ yyterminate()
+ yy_set_interactive()
+ yy_set_bol()
+ YY_AT_BOL()
+ <<EOF>>
+ <*>
+ YY_DECL
+ YY_START
+ YY_USER_ACTION
+ YY_USER_INIT
+ #line directives
+ %{}'s around actions
+ multiple actions on a line
+
+.fi
+plus almost all of the flex flags.
+The last feature in the list refers to the fact that with
+.I flex
+you can put multiple actions on the same line, separated with
+semi-colons, while with
+.I lex,
+the following
+.nf
+
+ foo handle_foo(); ++num_foos_seen;
+
+.fi
+is (rather surprisingly) truncated to
+.nf
+
+ foo handle_foo();
+
+.fi
+.I flex
+does not truncate the action.
+Actions that are not enclosed in
+braces are simply terminated at the end of the line.
+.SH DIAGNOSTICS
+.I warning, rule cannot be matched
+indicates that the given rule
+cannot be matched because it follows other rules that will
+always match the same text as it.
+For example, in the following "foo" cannot be matched because it comes after
+an identifier "catch-all" rule:
+.nf
+
+ [a-z]+ got_identifier();
+ foo got_foo();
+
+.fi
+Using
+.B REJECT
+in a scanner suppresses this warning.
+.PP
+.I warning,
+.B \-s
+.I
+option given but default rule can be matched
+means that it is possible (perhaps only in a particular start condition)
+that the default rule (match any single character) is the only one
+that will match a particular input.
+Since
+.B \-s
+was given, presumably this is not intended.
+.PP
+.I reject_used_but_not_detected undefined
+or
+.I yymore_used_but_not_detected undefined -
+These errors can occur at compile time.
+They indicate that the scanner uses
+.B REJECT
+or
+.B yymore()
+but that
+.I flex
+failed to notice the fact, meaning that
+.I flex
+scanned the first two sections looking for occurrences of these actions
+and failed to find any, but somehow you snuck some in (via a #include
+file, for example).
+Use
+.B %option reject
+or
+.B %option yymore
+to indicate to flex that you really do use these features.
+.PP
+.I flex scanner jammed -
+a scanner compiled with
+.B \-s
+has encountered an input string which wasn't matched by
+any of its rules.
+This error can also occur due to internal problems.
+.PP
+.I token too large, exceeds YYLMAX -
+your scanner uses
+.B %array
+and one of its rules matched a string longer than the
+.B YYLMAX
+constant (8K bytes by default).
+You can increase the value by
+#define'ing
+.B YYLMAX
+in the definitions section of your
+.I flex
+input.
+.PP
+.I scanner requires \-8 flag to
+.I use the character 'x' -
+Your scanner specification includes recognizing the 8-bit character
+.I 'x'
+and you did not specify the \-8 flag, and your scanner defaulted to 7-bit
+because you used the
+.B \-Cf
+or
+.B \-CF
+table compression options.
+See the discussion of the
+.B \-7
+flag for details.
+.PP
+.I flex scanner push-back overflow -
+you used
+.B unput()
+to push back so much text that the scanner's buffer could not hold
+both the pushed-back text and the current token in
+.B yytext.
+Ideally the scanner should dynamically resize the buffer in this case, but at
+present it does not.
+.PP
+.I
+input buffer overflow, can't enlarge buffer because scanner uses REJECT -
+the scanner was working on matching an extremely large token and needed
+to expand the input buffer.
+This doesn't work with scanners that use
+.B
+REJECT.
+.PP
+.I
+fatal flex scanner internal error--end of buffer missed -
+This can occur in a scanner which is reentered after a long-jump
+has jumped out (or over) the scanner's activation frame.
+Before reentering the scanner, use:
+.nf
+
+ yyrestart( yyin );
+
+.fi
+or, as noted above, switch to using the C++ scanner class.
+.PP
+.I too many start conditions in <> construct! -
+you listed more start conditions in a <> construct than exist (so
+you must have listed at least one of them twice).
+.SH FILES
+.TP
+.B \-ll
+library with which scanners must be linked.
+.TP
+.I lex.yy.c
+generated scanner (called
+.I lexyy.c
+on some systems).
+.TP
+.I lex.yy.cc
+generated C++ scanner class, when using
+.B -+.
+.TP
+.I <FlexLexer.h>
+header file defining the C++ scanner base class,
+.B FlexLexer,
+and its derived class,
+.B yyFlexLexer.
+.TP
+.I flex.skl
+skeleton scanner.
+This file is only used when building flex, not when flex executes.
+.TP
+.I lex.backup
+backing-up information for
+.B \-b
+flag (called
+.I lex.bck
+on some systems).
+.SH DEFICIENCIES / BUGS
+Some trailing context
+patterns cannot be properly matched and generate
+warning messages ("dangerous trailing context").
+These are patterns where the ending of the
+first part of the rule matches the beginning of the second
+part, such as "zx*/xy*", where the 'x*' matches the 'x' at
+the beginning of the trailing context.
+(Note that the POSIX draft
+states that the text matched by such patterns is undefined.)
+.PP
+For some trailing context rules, parts which are actually fixed-length are
+not recognized as such, leading to the above mentioned performance loss.
+In particular, parts using '|' or {n} (such as "foo{3}") are always
+considered variable-length.
+.PP
+Combining trailing context with the special '|' action can result in
+.I fixed
+trailing context being turned into the more expensive
+.I variable
+trailing context.
+For example, in the following:
+.nf
+
+ %%
+ abc |
+ xyz/def
+
+.fi
+.PP
+Use of
+.B unput()
+invalidates yytext and yyleng, unless the
+.B %array
+directive
+or the
+.B \-l
+option has been used.
+.PP
+Pattern-matching of NUL's is substantially slower than matching other
+characters.
+.PP
+Dynamic resizing of the input buffer is slow, as it entails rescanning
+all the text matched so far by the current (generally huge) token.
+.PP
+Due to both buffering of input and read-ahead, you cannot intermix
+calls to <stdio.h> routines, such as, for example,
+.B getchar(),
+with
+.I flex
+rules and expect it to work.
+Call
+.B input()
+instead.
+.PP
+The total table entries listed by the
+.B \-v
+flag excludes the number of table entries needed to determine
+what rule has been matched.
+The number of entries is equal
+to the number of DFA states if the scanner does not use
+.B REJECT,
+and somewhat greater than the number of states if it does.
+.PP
+.B REJECT
+cannot be used with the
+.B \-f
+or
+.B \-F
+options.
+.PP
+The
+.I flex
+internal algorithms need documentation.
+.SH SEE ALSO
+lex(1), yacc(1), sed(1), awk(1).
+.PP
+John Levine, Tony Mason, and Doug Brown,
+.I Lex & Yacc,
+O'Reilly and Associates.
+Be sure to get the 2nd edition.
+.PP
+M. E. Lesk and E. Schmidt,
+.I LEX \- Lexical Analyzer Generator
+.PP
+Alfred Aho, Ravi Sethi and Jeffrey Ullman,
+.I Compilers: Principles, Techniques and Tools,
+Addison-Wesley (1986).
+Describes the pattern-matching techniques used by
+.I flex
+(deterministic finite automata).
+.SH AUTHOR
+Vern Paxson, with the help of many ideas and much inspiration from
+Van Jacobson.
+Original version by Jef Poskanzer.
+The fast table
+representation is a partial implementation of a design done by Van
+Jacobson.
+The implementation was done by Kevin Gong and Vern Paxson.
+.PP
+Thanks to the many
+.I flex
+beta-testers, feedbackers, and contributors, especially Francois Pinard,
+Casey Leedom,
+Robert Abramovitz,
+Stan Adermann, Terry Allen, David Barker-Plummer, John Basrai,
+Neal Becker, Nelson H.F. Beebe, benson@odi.com,
+Karl Berry, Peter A. Bigot, Simon Blanchard,
+Keith Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick Christopher,
+Brian Clapper, J.T. Conklin,
+Jason Coughlin, Bill Cox, Nick Cropper, Dave Curtis, Scott David
+Daniels, Chris G. Demetriou, Theo de Raadt,
+Mike Donahue, Chuck Doucette, Tom Epperly, Leo Eskin,
+Chris Faylor, Chris Flatters, Jon Forrest, Jeffrey Friedl,
+Joe Gayda, Kaveh R. Ghazi, Wolfgang Glunz,
+Eric Goldman, Christopher M. Gould, Ulrich Grepel, Peer Griebel,
+Jan Hajic, Charles Hemphill, NORO Hideo,
+Jarkko Hietaniemi, Scott Hofmann,
+Jeff Honig, Dana Hudes, Eric Hughes, John Interrante,
+Ceriel Jacobs, Michal Jaegermann, Sakari Jalovaara, Jeffrey R. Jones,
+Henry Juengst, Klaus Kaempf, Jonathan I. Kamens, Terrence O Kane,
+Amir Katz, ken@ken.hilco.com, Kevin B. Kenny,
+Steve Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht,
+Greg Lee, Rohan Lenard, Craig Leres, John Levine, Steve Liddle,
+David Loffredo, Mike Long,
+Mohamed el Lozy, Brian Madsen, Malte, Joe Marshall,
+Bengt Martensson, Chris Metcalf,
+Luke Mewburn, Jim Meyering, R. Alexander Milowski, Erik Naggum,
+G.T. Nicol, Landon Noll, James Nordby, Marc Nozell,
+Richard Ohnemus, Karsten Pahnke,
+Sven Panne, Roland Pesch, Walter Pelissero, Gaumond
+Pierre, Esmond Pitt, Jef Poskanzer, Joe Rahmeh, Jarmo Raiha,
+Frederic Raimbault, Pat Rankin, Rick Richardson,
+Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini,
+Andreas Scherer, Darrell Schiebel, Raf Schietekat,
+Doug Schmidt, Philippe Schnoebelen, Andreas Schwab,
+Larry Schwimmer, Alex Siegel, Eckehard Stolz, Jan-Erik Strvmquist,
+Mike Stump, Paul Stuart, Dave Tallman, Ian Lance Taylor,
+Chris Thewalt, Richard M. Timoney, Jodi Tsai,
+Paul Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, Ken
+Yap, Ron Zellar, Nathan Zelle, David Zuhn,
+and those whose names have slipped my marginal
+mail-archiving skills but whose contributions are appreciated all the
+same.
+.PP
+Thanks to Keith Bostic, Jon Forrest, Noah Friedman,
+John Gilmore, Craig Leres, John Levine, Bob Mulcahy, G.T.
+Nicol, Francois Pinard, Rich Salz, and Richard Stallman for help with various
+distribution headaches.
+.PP
+Thanks to Esmond Pitt and Earle Horton for 8-bit character support; to
+Benson Margulies and Fred Burke for C++ support; to Kent Williams and Tom
+Epperly for C++ class support; to Ove Ewerlid for support of NUL's; and to
+Eric Hughes for support of multiple buffers.
+.PP
+This work was primarily done when I was with the Real Time Systems Group
+at the Lawrence Berkeley Laboratory in Berkeley, CA.
+Many thanks to all there for the support I received.
+.PP
+Send comments to vern@ee.lbl.gov.
diff --git a/usr.bin/lex/lib/Makefile b/usr.bin/lex/lib/Makefile
new file mode 100644
index 0000000..4c28593
--- /dev/null
+++ b/usr.bin/lex/lib/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+.PATH: ${.CURDIR}/../../../contrib/flex
+
+LIB= ln
+SRCS= libmain.c libyywrap.c
+NO_PIC=
+
+.if ${MK_INSTALLLIB} != "no"
+LINKS= ${LIBDIR}/libln.a ${LIBDIR}/libl.a
+LINKS+= ${LIBDIR}/libln.a ${LIBDIR}/libfl.a
+.endif
+
+.if ${MK_PROFILE} != "no"
+LINKS+= ${LIBDIR}/libln_p.a ${LIBDIR}/libl_p.a
+LINKS+= ${LIBDIR}/libln_p.a ${LIBDIR}/libfl_p.a
+.endif
+
+.include <bsd.lib.mk>
+
diff --git a/usr.bin/lex/lib/Makefile.depend b/usr.bin/lex/lib/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/lex/lib/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/lex/version.awk b/usr.bin/lex/version.awk
new file mode 100644
index 0000000..3d34093
--- /dev/null
+++ b/usr.bin/lex/version.awk
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+BEGIN {
+ FS = "[ \t\.\"]+"
+}
+
+{
+ if ($1 ~ /^#define$/ && $2 ~ /^VERSION$/) {
+ printf("-DFLEX_MAJOR_VERSION=%s\n", $3);
+ printf("-DFLEX_MINOR_VERSION=%s\n", $4);
+ printf("-DFLEX_SUBMINOR_VERSION=%s\n", $5);
+ }
+}
diff --git a/usr.bin/limits/Makefile b/usr.bin/limits/Makefile
new file mode 100644
index 0000000..9b5f847
--- /dev/null
+++ b/usr.bin/limits/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= limits
+LIBADD= util
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/limits/Makefile.depend b/usr.bin/limits/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/limits/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/limits/limits.1 b/usr.bin/limits/limits.1
new file mode 100644
index 0000000..99136a4
--- /dev/null
+++ b/usr.bin/limits/limits.1
@@ -0,0 +1,406 @@
+.\" Copyright (c) 1996 David Nugent <davidn@blaze.net.au>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, is permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice immediately at the beginning of the file, without modification,
+.\" 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. This work was done expressly for inclusion into FreeBSD. Other use
+.\" is permitted provided this notation is included.
+.\" 4. Absolutely no warranty of function or purpose is made by the author
+.\" David Nugent.
+.\" 5. Modifications may be freely made to this file providing the above
+.\" conditions are met.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 1, 2013
+.Dt LIMITS 1
+.Os
+.Sh NAME
+.Nm limits
+.Nd set or display process resource limits
+.Sh SYNOPSIS
+.Nm
+.Op Fl C Ar class | Fl P Ar pid | Fl U Ar user
+.Op Fl SHB
+.Op Fl ea
+.Op Fl bcdfklmnopstuvw Op Ar val
+.Nm
+.Op Fl C Ar class | Fl U Ar user
+.Op Fl SHB
+.Op Fl bcdfklmnopstuvw Op Ar val
+.Op Fl E
+.Oo
+.Op Ar name Ns = Ns Ar value ...
+.Ar command
+.Oc
+.Sh DESCRIPTION
+The
+.Nm
+utility either prints or sets kernel resource limits, and may optionally set
+environment variables like
+.Xr env 1
+and run a program with the selected resources.
+Three uses of the
+.Nm
+utility are possible:
+.Bl -tag -width indent
+.It Xo
+.Nm
+.Op Ar limitflags
+.Op Ar name Ns = Ns Ar value ...
+.Ar command
+.Xc
+This usage sets limits according to
+.Ar limitflags ,
+optionally sets environment variables given as
+.Ar name Ns = Ns Ar value
+pairs, and then runs the specified
+.Ar command .
+.It Nm Op Ar limitflags
+This usage determines values of resource settings according to
+.Ar limitflags ,
+does not attempt to set them and outputs these values to
+standard output.
+By default, this will output the current kernel resource settings
+active for the calling process.
+Using the
+.Fl C Ar class
+or
+.Fl U Ar user
+options, you may also display the current resource settings modified
+by the appropriate login class resource limit entries from
+the
+.Xr login.conf 5
+login capabilities database.
+.It Nm Fl e Op Ar limitflags
+This usage determines values of resource settings according to
+.Ar limitflags ,
+but does not set them itself.
+Like the previous usage, it outputs these values to standard
+output, except that it will emit them in
+.Ic eval
+format, suitable for the calling shell.
+If the shell is known (i.e., it is one of
+.Nm sh , csh , bash , tcsh , ksh , pdksh
+or
+.Nm rc ) ,
+.Nm
+emits
+.Ic limit
+or
+.Ic ulimit
+commands in the format understood by
+that shell.
+If the name of the shell cannot be determined, then the
+.Ic ulimit
+format used by
+.Xr sh 1
+is used.
+.Pp
+This is very useful for setting limits used by scripts, or prior
+launching of daemons and other background tasks with specific
+resource limit settings, and provides the benefit of allowing
+global configuration of maximum resource usage by maintaining a
+central database of settings in the login class database.
+.Pp
+Within a shell script,
+.Nm
+will normally be used with eval within backticks as follows:
+.Pp
+.Dl "eval `limits -e -C daemon`"
+.Pp
+which causes the output of
+.Nm
+to be evaluated and set by the current shell.
+.El
+.Pp
+The value of
+.Ar limitflags
+specified in the above contains one or more of the following options:
+.Bl -tag -width ".Fl C Ar class"
+.It Fl C Ar class
+Use current resource values, modified by the resource entries applicable
+for the login class
+.Ar class .
+.It Fl U Ar user
+Use current resource values, modified by the resource entries applicable
+to the login class the
+.Ar user
+belongs to.
+If user does not belong to any class, then the resource capabilities
+for the
+.Dq Li default
+class are used, if it exists, or the
+.Dq Li root
+class if the user is a superuser account.
+.It Fl P Ar pid
+Select or set limits for the process identified by the
+.Ar pid .
+.It Fl S
+Select display or setting of
+.Dq soft
+(or current) resource limits.
+If specific limits settings follow this switch, only soft limits are
+affected unless overridden later with either the
+.Fl H
+or
+.Fl B
+options.
+.It Fl H
+Select display or setting of
+.Dq hard
+(or maximum) resource limits.
+If specific limits settings follow this switch, only hard limits are
+affected until overridden later with either the
+.Fl S
+or
+.Fl B
+options.
+.It Fl B
+Select display or setting of both
+.Dq soft
+(current) or
+.Dq hard
+(maximum)
+resource limits.
+If specific limits settings follow this switch, both soft and hard
+limits are affected until overridden later with either the
+.Fl S
+or
+.Fl H
+options.
+.It Fl e
+Select
+.Dq "eval mode"
+formatting for output.
+This is valid only on display mode and cannot be used when running a
+command.
+The exact syntax used for output depends upon the type of shell from
+which
+.Nm
+is invoked.
+.It Fl b Op Ar val
+Select or set the
+.Va sbsize
+resource limit.
+.It Fl c Op Ar val
+Select or set (if
+.Ar val
+is specified) the
+.Va coredumpsize
+resource limit.
+A value of 0 disables core dumps.
+.It Fl d Op Ar val
+Select or set (if
+.Ar val
+is specified) the
+.Va datasize
+resource limit.
+.It Fl f Op Ar val
+Select or set the
+.Va filesize
+resource limit.
+.It Fl k Op Ar val
+Select or set the
+.Va kqueues
+resource limit.
+.It Fl l Op Ar val
+Select or set the
+.Va memorylocked
+resource limit.
+.It Fl m Op Ar val
+Select or set the
+.Va memoryuse
+size limit.
+.It Fl n Op Ar val
+Select or set the
+.Va openfiles
+resource limit.
+The system-wide limit on the maximum number of
+open files per process can be viewed by examining the
+.Va kern.maxfilesperproc
+.Xr sysctl 8
+variable.
+The total number of simultaneously open files in the entire
+system is limited to the value displayed by the
+.Va kern.maxfiles
+.Xr sysctl 8
+variable.
+.It Fl o Op Ar val
+Select or set the
+.Va umtxp
+resource limit.
+The limit determines the maximal number of the process-shared locks
+which may be simultaneously created by the processes owned by the
+user, see
+.Xr pthread 3 .
+.It Fl p Op Ar val
+Select or set the
+.Va pseudoterminals
+resource limit.
+.It Fl s Op Ar val
+Select or set the
+.Va stacksize
+resource limit.
+.It Fl t Op Ar val
+Select or set the
+.Va cputime
+resource limit.
+.It Fl u Op Ar val
+Select or set the
+.Va maxproc
+resource limit.
+The system-wide limit on the maximum number of processes
+allowed per UID can be viewed by examining the
+.Va kern.maxprocperuid
+.Xr sysctl 8
+variable.
+The maximum number of processes that can be running simultaneously
+in the entire system is limited to the value of the
+.Va kern.maxproc
+.Xr sysctl 8
+variable.
+.It Fl v Op Ar val
+Select or set the
+.Va virtualmem
+resource limit.
+This limit encompasses the entire VM space for the user process
+and is inclusive of text, data, bss, stack,
+.Xr brk 2 ,
+.Xr sbrk 2
+and
+.Xr mmap 2 Ns 'd
+space.
+.It Fl w Op Ar val
+Select or set the
+.Va swapuse
+resource limit.
+.El
+.Pp
+Valid values for
+.Ar val
+in the above set of options consist of either the
+string
+.Dq Li infinity ,
+.Dq Li inf ,
+.Dq Li unlimited
+or
+.Dq Li unlimit
+for an infinite (or kernel-defined maximum)
+limit, or a numeric value optionally followed by a suffix.
+Values which relate to size default to a value in bytes, or one of the
+following suffixes may be used as a multiplier:
+.Pp
+.Bl -tag -offset indent -width 4n -compact
+.It Li b
+512 byte blocks.
+.It Li k
+kilobytes (1024 bytes).
+.It Li m
+megabytes (1024*1024 bytes).
+.It Li g
+gigabytes.
+.It Li t
+terabytes.
+.El
+.Pp
+The
+.Va cputime
+resource defaults to a number of seconds, but a multiplier may be
+used, and as with size values, multiple values separated by a valid
+suffix are added together:
+.Pp
+.Bl -tag -offset indent -width 4n -compact
+.It Li s
+seconds.
+.It Li m
+minutes.
+.It Li h
+hours.
+.It Li d
+days.
+.It Li w
+weeks.
+.It Li y
+365 day years.
+.El
+.Bl -tag -width ".Fl C Ar class"
+.It Fl E
+Cause
+.Nm
+to completely ignore the environment it inherits.
+.It Fl a
+Force all resource settings to be displayed even if
+other specific resource settings have been specified.
+For example, if you wish to disable core dumps when starting up
+the Usenet News system, but wish to set all other resource settings
+as well that apply to the
+.Dq Li news
+account, you might use:
+.Pp
+.Dl "eval `limits -U news -aBec 0`"
+.Pp
+As with the
+.Xr setrlimit 2
+call, only the superuser may raise process
+.Dq hard
+resource limits.
+Non-root users may, however, lower them or change
+.Dq soft
+resource limits
+within to any value below the hard limit.
+When invoked to execute a program, the failure of
+.Nm
+to raise a hard limit is considered a fatal error.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility
+exits with
+.Dv EXIT_FAILURE
+if usage is incorrect in any way; i.e., an invalid
+option, or set/display options are selected in the same invocation,
+.Fl e
+is used when running a program, etc.
+When run in display or eval mode,
+.Nm
+exits with a status of
+.Dv EXIT_SUCCESS .
+When run in command mode and execution of the command succeeds, the exit status
+will be whatever the executed program returns.
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr env 1 ,
+.Xr limit 1 ,
+.Xr sh 1 ,
+.Xr getrlimit 2 ,
+.Xr setrlimit 2 ,
+.Xr login_cap 3 ,
+.Xr login.conf 5 ,
+.Xr rctl 8 ,
+.Xr sysctl 8
+.Sh BUGS
+The
+.Nm
+utility does not handle commands with equal
+.Pq Ql =
+signs in their
+names, for obvious reasons.
+.Pp
+The
+.Nm
+utility makes no effort to ensure that resource settings emitted or displayed
+are valid and settable by the current user.
+Only a superuser account may raise hard limits, and when doing so
+the
+.Fx
+kernel will silently lower limits to values less than
+specified if the values given are too high.
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
new file mode 100644
index 0000000..3dd7a71
--- /dev/null
+++ b/usr.bin/limits/limits.c
@@ -0,0 +1,779 @@
+/*-
+ * Copyright (c) 1997 by
+ * David L. Nugent <davidn@blaze.net.au>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, is permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * 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. This work was done expressly for inclusion into FreeBSD. Other use
+ * is permitted provided this notation is included.
+ * 4. Absolutely no warranty of function or purpose is made by the authors.
+ * 5. Modifications may be freely made to this file providing the above
+ * conditions are met.
+ *
+ * Display/change(+runprogram)/eval resource limits.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+#include <sys/param.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <ctype.h>
+#include <errno.h>
+#include <pwd.h>
+#include <login_cap.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+enum
+{
+ SH_NONE,
+ SH_SH, /* sh */
+ SH_CSH, /* csh */
+ SH_BASH, /* gnu bash */
+ SH_TCSH, /* tcsh */
+ SH_KSH, /* (pd)ksh */
+ SH_ZSH, /* zsh */
+ SH_RC, /* rc or es */
+ SH_NUMBER
+};
+
+
+/* eval emitter for popular shells.
+ * Why aren't there any standards here? Most shells support either
+ * the csh 'limit' or sh 'ulimit' command, but each varies just
+ * enough that they aren't very compatible from one to the other.
+ */
+static struct {
+ const char * name; /* Name of shell */
+ const char * inf; /* Name used for 'unlimited' resource */
+ const char * cmd; /* Intro text */
+ const char * hard; /* Hard limit text */
+ const char * soft; /* Soft limit text */
+ const char * both; /* Hard+Soft limit text */
+ struct {
+ const char * pfx;
+ const char * sfx;
+ int divisor;
+ } lprm[RLIM_NLIMITS];
+} shellparm[] =
+{
+ { "", "infinity", "Resource limits%s%s:\n", "-max", "-cur", "",
+ {
+ { " cputime%-4s %8s", " secs\n", 1 },
+ { " filesize%-4s %8s", " kB\n", 1024 },
+ { " datasize%-4s %8s", " kB\n", 1024 },
+ { " stacksize%-4s %8s", " kB\n", 1024 },
+ { " coredumpsize%-4s %8s", " kB\n", 1024 },
+ { " memoryuse%-4s %8s", " kB\n", 1024 },
+ { " memorylocked%-4s %8s", " kB\n", 1024 },
+ { " maxprocesses%-4s %8s", "\n", 1 },
+ { " openfiles%-4s %8s", "\n", 1 },
+ { " sbsize%-4s %8s", " bytes\n", 1 },
+ { " vmemoryuse%-4s %8s", " kB\n", 1024 },
+ { " pseudo-terminals%-4s %8s", "\n", 1 },
+ { " swapuse%-4s %8s", " kB\n", 1024 },
+ { " kqueues%-4s %8s", "\n", 1 },
+ { " umtxp%-4s %8s", "\n", 1 },
+ }
+ },
+ { "sh", "unlimited", "", " -H", " -S", "",
+ {
+ { "ulimit%s -t %s", ";\n", 1 },
+ { "ulimit%s -f %s", ";\n", 512 },
+ { "ulimit%s -d %s", ";\n", 1024 },
+ { "ulimit%s -s %s", ";\n", 1024 },
+ { "ulimit%s -c %s", ";\n", 512 },
+ { "ulimit%s -m %s", ";\n", 1024 },
+ { "ulimit%s -l %s", ";\n", 1024 },
+ { "ulimit%s -u %s", ";\n", 1 },
+ { "ulimit%s -n %s", ";\n", 1 },
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 },
+ { "ulimit%s -p %s", ";\n", 1 },
+ { "ulimit%s -w %s", ";\n", 1024 },
+ { "ulimit%s -k %s", ";\n", 1 },
+ { "ulimit%s -o %s", ";\n", 1 },
+ }
+ },
+ { "csh", "unlimited", "", " -h", "", NULL,
+ {
+ { "limit%s cputime %s", ";\n", 1 },
+ { "limit%s filesize %s", ";\n", 1024 },
+ { "limit%s datasize %s", ";\n", 1024 },
+ { "limit%s stacksize %s", ";\n", 1024 },
+ { "limit%s coredumpsize %s", ";\n", 1024 },
+ { "limit%s memoryuse %s", ";\n", 1024 },
+ { "limit%s memorylocked %s", ";\n", 1024 },
+ { "limit%s maxproc %s", ";\n", 1 },
+ { "limit%s openfiles %s", ";\n", 1 },
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 },
+ { "limit%s pseudoterminals %s", ";\n", 1 },
+ { "limit%s swapsize %s", ";\n", 1024 },
+ { "limit%s kqueues %s", ";\n", 1 },
+ { "limit%s umtxp %s", ";\n", 1 },
+ }
+ },
+ { "bash|bash2", "unlimited", "", " -H", " -S", "",
+ {
+ { "ulimit%s -t %s", ";\n", 1 },
+ { "ulimit%s -f %s", ";\n", 1024 },
+ { "ulimit%s -d %s", ";\n", 1024 },
+ { "ulimit%s -s %s", ";\n", 1024 },
+ { "ulimit%s -c %s", ";\n", 1024 },
+ { "ulimit%s -m %s", ";\n", 1024 },
+ { "ulimit%s -l %s", ";\n", 1024 },
+ { "ulimit%s -u %s", ";\n", 1 },
+ { "ulimit%s -n %s", ";\n", 1 },
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 },
+ { "ulimit%s -p %s", ";\n", 1 },
+ { "ulimit%s -w %s", ";\n", 1024 }
+ }
+ },
+ { "tcsh", "unlimited", "", " -h", "", NULL,
+ {
+ { "limit%s cputime %s", ";\n", 1 },
+ { "limit%s filesize %s", ";\n", 1024 },
+ { "limit%s datasize %s", ";\n", 1024 },
+ { "limit%s stacksize %s", ";\n", 1024 },
+ { "limit%s coredumpsize %s", ";\n", 1024 },
+ { "limit%s memoryuse %s", ";\n", 1024 },
+ { "limit%s memorylocked %s", ";\n", 1024 },
+ { "limit%s maxproc %s", ";\n", 1 },
+ { "limit%s descriptors %s", ";\n", 1 },
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 },
+ { "limit%s pseudoterminals %s", ";\n", 1 },
+ { "limit%s swapsize %s", ";\n", 1024 },
+ { "limit%s kqueues %s", ";\n", 1 },
+ { "limit%s umtxp %s", ";\n", 1 },
+ }
+ },
+ { "ksh|pdksh", "unlimited", "", " -H", " -S", "",
+ {
+ { "ulimit%s -t %s", ";\n", 1 },
+ { "ulimit%s -f %s", ";\n", 512 },
+ { "ulimit%s -d %s", ";\n", 1024 },
+ { "ulimit%s -s %s", ";\n", 1024 },
+ { "ulimit%s -c %s", ";\n", 512 },
+ { "ulimit%s -m %s", ";\n", 1024 },
+ { "ulimit%s -l %s", ";\n", 1024 },
+ { "ulimit%s -p %s", ";\n", 1 },
+ { "ulimit%s -n %s", ";\n", 1 },
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 },
+ { "ulimit%s -p %s", ";\n", 1 },
+ { "ulimit%s -w %s", ";\n", 1024 }
+ }
+ },
+ { "zsh", "unlimited", "", " -H", " -S", "",
+ {
+ { "ulimit%s -t %s", ";\n", 1 },
+ { "ulimit%s -f %s", ";\n", 512 },
+ { "ulimit%s -d %s", ";\n", 1024 },
+ { "ulimit%s -s %s", ";\n", 1024 },
+ { "ulimit%s -c %s", ";\n", 512 },
+ { "ulimit%s -m %s", ";\n", 1024 },
+ { "ulimit%s -l %s", ";\n", 1024 },
+ { "ulimit%s -u %s", ";\n", 1 },
+ { "ulimit%s -n %s", ";\n", 1 },
+ { "ulimit%s -b %s", ";\n", 1 },
+ { "ulimit%s -v %s", ";\n", 1024 },
+ { "ulimit%s -p %s", ";\n", 1 },
+ { "ulimit%s -w %s", ";\n", 1024 }
+ }
+ },
+ { "rc|es", "unlimited", "", " -h", "", NULL,
+ {
+ { "limit%s cputime %s", ";\n", 1 },
+ { "limit%s filesize %s", ";\n", 1024 },
+ { "limit%s datasize %s", ";\n", 1024 },
+ { "limit%s stacksize %s", ";\n", 1024 },
+ { "limit%s coredumpsize %s", ";\n", 1024 },
+ { "limit%s memoryuse %s", ";\n", 1024 },
+ { "limit%s lockedmemory %s", ";\n", 1024 },
+ { "limit%s processes %s", ";\n", 1 },
+ { "limit%s descriptors %s", ";\n", 1 },
+ { "limit%s sbsize %s", ";\n", 1 },
+ { "limit%s vmemoryuse %s", ";\n", 1024 },
+ { "limit%s pseudoterminals %s", ";\n", 1 },
+ { "limit%s swapuse %s", ";\n", 1024 }
+ }
+ },
+ { NULL, NULL, NULL, NULL, NULL, NULL,
+ { }
+ }
+};
+
+static struct {
+ const char * cap;
+ rlim_t (*func)(login_cap_t *, const char *, rlim_t, rlim_t);
+} resources[RLIM_NLIMITS] = {
+ { "cputime", login_getcaptime },
+ { "filesize", login_getcapsize },
+ { "datasize", login_getcapsize },
+ { "stacksize", login_getcapsize },
+ { "coredumpsize", login_getcapsize },
+ { "memoryuse", login_getcapsize },
+ { "memorylocked", login_getcapsize },
+ { "maxproc", login_getcapnum },
+ { "openfiles", login_getcapnum },
+ { "sbsize", login_getcapsize },
+ { "vmemoryuse", login_getcapsize },
+ { "pseudoterminals",login_getcapnum },
+ { "swapuse", login_getcapsize },
+ { "kqueues", login_getcapnum },
+ { "umtxp", login_getcapnum },
+};
+
+/*
+ * One letter for each resource levels.
+ * NOTE: There is a dependency on the corresponding
+ * letter index being equal to the resource number.
+ * If sys/resource.h defines are changed, this needs
+ * to be modified accordingly!
+ */
+
+#define RCS_STRING "tfdscmlunbvpwko"
+
+static rlim_t resource_num(int which, int ch, const char *str);
+static void usage(void);
+static int getshelltype(void);
+static void print_limit(rlim_t limit, unsigned divisor, const char *inf,
+ const char *pfx, const char *sfx, const char *which);
+static void getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp);
+static void setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp);
+extern char **environ;
+
+static const char rcs_string[] = RCS_STRING;
+
+int
+main(int argc, char *argv[])
+{
+ char *p, *cls = NULL;
+ char *cleanenv[1];
+ struct passwd * pwd = NULL;
+ int rcswhich, shelltype;
+ int i, num_limits = 0;
+ int ch, doeval = 0, doall = 0;
+ int rtrn, setproc;
+ login_cap_t * lc = NULL;
+ enum { ANY=0, SOFT=1, HARD=2, BOTH=3, DISPLAYONLY=4 } type = ANY;
+ enum { RCSUNKNOWN=0, RCSSET=1, RCSSEL=2 } todo = RCSUNKNOWN;
+ int which_limits[RLIM_NLIMITS];
+ rlim_t set_limits[RLIM_NLIMITS];
+ struct rlimit limits[RLIM_NLIMITS];
+ pid_t pid;
+
+ /* init resource tables */
+ for (i = 0; i < RLIM_NLIMITS; i++) {
+ which_limits[i] = 0; /* Don't set/display any */
+ set_limits[i] = RLIM_INFINITY;
+ }
+
+ pid = -1;
+ optarg = NULL;
+ while ((ch = getopt(argc, argv,
+ ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:k:o:")) != -1) {
+ switch(ch) {
+ case 'a':
+ doall = 1;
+ break;
+ case 'E':
+ environ = cleanenv;
+ cleanenv[0] = NULL;
+ break;
+ case 'e':
+ doeval = 1;
+ break;
+ case 'C':
+ cls = optarg;
+ break;
+ case 'U':
+ if ((pwd = getpwnam(optarg)) == NULL) {
+ if (!isdigit(*optarg) ||
+ (pwd = getpwuid(atoi(optarg))) == NULL) {
+ warnx("invalid user `%s'", optarg);
+ usage();
+ }
+ }
+ break;
+ case 'H':
+ type = HARD;
+ break;
+ case 'S':
+ type = SOFT;
+ break;
+ case 'B':
+ type = SOFT|HARD;
+ break;
+ case 'P':
+ if (!isdigit(*optarg) || (pid = atoi(optarg)) < 0) {
+ warnx("invalid pid `%s'", optarg);
+ usage();
+ }
+ break;
+ default:
+ case ':': /* Without arg */
+ if ((p = strchr(rcs_string, optopt)) != NULL) {
+ int rcswhich1 = p - rcs_string;
+ if (optarg && *optarg == '-') { /* 'arg' is actually a switch */
+ --optind; /* back one arg, and make arg NULL */
+ optarg = NULL;
+ }
+ todo = optarg == NULL ? RCSSEL : RCSSET;
+ if (type == ANY)
+ type = BOTH;
+ which_limits[rcswhich1] = optarg ? type : DISPLAYONLY;
+ set_limits[rcswhich1] = resource_num(rcswhich1, optopt, optarg);
+ num_limits++;
+ break;
+ }
+ /* FALLTHRU */
+ case '?':
+ usage();
+ }
+ optarg = NULL;
+ }
+
+ if (pid != -1) {
+ if (cls != NULL) {
+ warnx("-C cannot be used with -P option");
+ usage();
+ }
+ if (pwd != NULL) {
+ warnx("-U cannot be used with -P option");
+ usage();
+ }
+ }
+
+ /* Get current resource values */
+ setproc = 0;
+ for (i = 0; i < RLIM_NLIMITS; i++) {
+ if (pid == -1) {
+ getrlimit(i, &limits[i]);
+ } else if (doall || num_limits == 0) {
+ getrlimit_proc(pid, i, &limits[i]);
+ } else if (which_limits[i] != 0) {
+ getrlimit_proc(pid, i, &limits[i]);
+ setproc = 1;
+ }
+ }
+
+ /* If user was specified, get class from that */
+ if (pwd != NULL)
+ lc = login_getpwclass(pwd);
+ else if (cls != NULL && *cls != '\0') {
+ lc = login_getclassbyname(cls, NULL);
+ if (lc == NULL || strcmp(cls, lc->lc_class) != 0)
+ fprintf(stderr, "login class '%s' non-existent, using %s\n",
+ cls, lc?lc->lc_class:"current settings");
+ }
+
+ /* If we have a login class, update resource table from that */
+ if (lc != NULL) {
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ char str[40];
+ rlim_t val;
+
+ /* current value overridden by resourcename or resourcename-cur */
+ sprintf(str, "%s-cur", resources[rcswhich].cap);
+ val = resources[rcswhich].func(lc, resources[rcswhich].cap, limits[rcswhich].rlim_cur, limits[rcswhich].rlim_cur);
+ limits[rcswhich].rlim_cur = resources[rcswhich].func(lc, str, val, val);
+ /* maximum value overridden by resourcename or resourcename-max */
+ sprintf(str, "%s-max", resources[rcswhich].cap);
+ val = resources[rcswhich].func(lc, resources[rcswhich].cap, limits[rcswhich].rlim_max, limits[rcswhich].rlim_max);
+ limits[rcswhich].rlim_max = resources[rcswhich].func(lc, str, val, val);
+ }
+ }
+
+ /* now, let's determine what we wish to do with all this */
+
+ argv += optind;
+
+ /* If we're setting limits or doing an eval (ie. we're not just
+ * displaying), then check that hard limits are not lower than
+ * soft limits, and force rasing the hard limit if we need to if
+ * we are raising the soft limit, or lower the soft limit if we
+ * are lowering the hard limit.
+ */
+ if ((*argv || doeval) && getuid() == 0) {
+
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ if (limits[rcswhich].rlim_max != RLIM_INFINITY) {
+ if (limits[rcswhich].rlim_cur == RLIM_INFINITY) {
+ limits[rcswhich].rlim_max = RLIM_INFINITY;
+ which_limits[rcswhich] |= HARD;
+ } else if (limits[rcswhich].rlim_cur > limits[rcswhich].rlim_max) {
+ if (which_limits[rcswhich] == SOFT) {
+ limits[rcswhich].rlim_max = limits[rcswhich].rlim_cur;
+ which_limits[rcswhich] |= HARD;
+ } else if (which_limits[rcswhich] == HARD) {
+ limits[rcswhich].rlim_cur = limits[rcswhich].rlim_max;
+ which_limits[rcswhich] |= SOFT;
+ } else {
+ /* else.. if we're specifically setting both to
+ * silly values, then let it error out.
+ */
+ }
+ }
+ }
+ }
+ }
+
+ /* See if we've overridden anything specific on the command line */
+ if (num_limits && todo == RCSSET) {
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ if (which_limits[rcswhich] & HARD)
+ limits[rcswhich].rlim_max = set_limits[rcswhich];
+ if (which_limits[rcswhich] & SOFT)
+ limits[rcswhich].rlim_cur = set_limits[rcswhich];
+ }
+ }
+
+ /* If *argv is not NULL, then we are being asked to
+ * (perhaps) set environment variables and run a program
+ */
+ if (*argv) {
+ if (doeval) {
+ warnx("-e cannot be used with `cmd' option");
+ usage();
+ }
+ if (pid != -1) {
+ warnx("-P cannot be used with `cmd' option");
+ usage();
+ }
+
+ login_close(lc);
+
+ /* set leading environment variables, like eval(1) */
+ while (*argv && (p = strchr(*argv, '='))) {
+ *p = '\0';
+ rtrn = setenv(*argv++, p + 1, 1);
+ *p = '=';
+ if (rtrn == -1)
+ err(EXIT_FAILURE, "setenv %s", *argv);
+ }
+
+ /* Set limits */
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ if (doall || num_limits == 0 || which_limits[rcswhich] != 0)
+ if (setrlimit(rcswhich, &limits[rcswhich]) == -1)
+ err(1, "setrlimit %s", resources[rcswhich].cap);
+ }
+
+ if (*argv == NULL)
+ usage();
+
+ execvp(*argv, argv);
+ err(1, "%s", *argv);
+ }
+
+ if (setproc) {
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ if (which_limits[rcswhich] != 0)
+ setrlimit_proc(pid, rcswhich, &limits[rcswhich]);
+ }
+ exit(EXIT_SUCCESS);
+ }
+
+ shelltype = doeval ? getshelltype() : SH_NONE;
+
+ if (type == ANY) /* Default to soft limits */
+ type = SOFT;
+
+ /* Display limits */
+ printf(shellparm[shelltype].cmd,
+ lc ? " for class " : " (current)",
+ lc ? lc->lc_class : "");
+
+ for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
+ if (doall || num_limits == 0 || which_limits[rcswhich] != 0) {
+ if (which_limits[rcswhich] == ANY || which_limits[rcswhich])
+ which_limits[rcswhich] = type;
+ if (shellparm[shelltype].lprm[rcswhich].pfx) {
+ if (shellparm[shelltype].both && limits[rcswhich].rlim_cur == limits[rcswhich].rlim_max) {
+ print_limit(limits[rcswhich].rlim_max,
+ shellparm[shelltype].lprm[rcswhich].divisor,
+ shellparm[shelltype].inf,
+ shellparm[shelltype].lprm[rcswhich].pfx,
+ shellparm[shelltype].lprm[rcswhich].sfx,
+ shellparm[shelltype].both);
+ } else {
+ if (which_limits[rcswhich] & HARD) {
+ print_limit(limits[rcswhich].rlim_max,
+ shellparm[shelltype].lprm[rcswhich].divisor,
+ shellparm[shelltype].inf,
+ shellparm[shelltype].lprm[rcswhich].pfx,
+ shellparm[shelltype].lprm[rcswhich].sfx,
+ shellparm[shelltype].hard);
+ }
+ if (which_limits[rcswhich] & SOFT) {
+ print_limit(limits[rcswhich].rlim_cur,
+ shellparm[shelltype].lprm[rcswhich].divisor,
+ shellparm[shelltype].inf,
+ shellparm[shelltype].lprm[rcswhich].pfx,
+ shellparm[shelltype].lprm[rcswhich].sfx,
+ shellparm[shelltype].soft);
+ }
+ }
+ }
+ }
+ }
+
+ login_close(lc);
+ exit(EXIT_SUCCESS);
+}
+
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: limits [-C class|-P pid|-U user] [-eaSHBE] "
+ "[-bcdfklmnostuvpw [val]] [[name=val ...] cmd]\n");
+ exit(EXIT_FAILURE);
+}
+
+static void
+print_limit(rlim_t limit, unsigned divisor, const char * inf, const char * pfx, const char * sfx, const char * which)
+{
+ char numbr[64];
+
+ if (limit == RLIM_INFINITY)
+ strcpy(numbr, inf);
+ else
+ sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor));
+ printf(pfx, which, numbr);
+ printf(sfx, which);
+
+}
+
+
+static rlim_t
+resource_num(int which, int ch, const char *str)
+{
+ rlim_t res = RLIM_INFINITY;
+
+ if (str != NULL &&
+ !(strcasecmp(str, "inf") == 0 ||
+ strcasecmp(str, "infinity") == 0 ||
+ strcasecmp(str, "unlimit") == 0 ||
+ strcasecmp(str, "unlimited") == 0)) {
+ const char * s = str;
+ char *e;
+
+ switch (which) {
+ case RLIMIT_CPU: /* time values */
+ errno = 0;
+ res = 0;
+ while (*s) {
+ rlim_t tim = strtoq(s, &e, 0);
+ if (e == NULL || e == s || errno)
+ break;
+ switch (*e++) {
+ case 0: /* end of string */
+ e--;
+ default:
+ case 's': case 'S': /* seconds */
+ break;
+ case 'm': case 'M': /* minutes */
+ tim *= 60L;
+ break;
+ case 'h': case 'H': /* hours */
+ tim *= (60L * 60L);
+ break;
+ case 'd': case 'D': /* days */
+ tim *= (60L * 60L * 24L);
+ break;
+ case 'w': case 'W': /* weeks */
+ tim *= (60L * 60L * 24L * 7L);
+ case 'y': case 'Y': /* Years */
+ tim *= (60L * 60L * 24L * 365L);
+ }
+ s = e;
+ res += tim;
+ }
+ break;
+ case RLIMIT_FSIZE: /* Size values */
+ case RLIMIT_DATA:
+ case RLIMIT_STACK:
+ case RLIMIT_CORE:
+ case RLIMIT_RSS:
+ case RLIMIT_MEMLOCK:
+ case RLIMIT_SBSIZE:
+ case RLIMIT_VMEM:
+ case RLIMIT_SWAP:
+ errno = 0;
+ res = 0;
+ while (*s) {
+ rlim_t mult, tim = strtoq(s, &e, 0);
+ if (e == NULL || e == s || errno)
+ break;
+ switch (*e++) {
+ case 0: /* end of string */
+ e--;
+ default:
+ mult = 1;
+ break;
+ case 'b': case 'B': /* 512-byte blocks */
+ mult = 512;
+ break;
+ case 'k': case 'K': /* 1024-byte Kilobytes */
+ mult = 1024;
+ break;
+ case 'm': case 'M': /* 1024-k kbytes */
+ mult = 1024 * 1024;
+ break;
+ case 'g': case 'G': /* 1Gbyte */
+ mult = 1024 * 1024 * 1024;
+ break;
+ case 't': case 'T': /* 1TBte */
+ mult = 1024LL * 1024LL * 1024LL * 1024LL;
+ break;
+ }
+ s = e;
+ res += (tim * mult);
+ }
+ break;
+ case RLIMIT_NPROC:
+ case RLIMIT_NOFILE:
+ case RLIMIT_NPTS:
+ case RLIMIT_KQUEUES:
+ case RLIMIT_UMTXP:
+ res = strtoq(s, &e, 0);
+ s = e;
+ break;
+ }
+ if (*s) {
+ warnx("invalid value -%c `%s'", ch, str);
+ usage();
+ }
+ }
+ return res;
+}
+
+
+static int
+getshellbyname(const char * shell)
+{
+ int i;
+ const char * q;
+ const char * p = strrchr(shell, '/');
+
+ p = p ? p+1 : shell;
+ for (i = 0; (q = shellparm[i].name) != NULL; i++) {
+ while (*q) {
+ int j = strcspn(q, "|");
+
+ if (j == 0)
+ break;
+ if (strncmp(p, q, j) == 0)
+ return i;
+ if (*(q += j))
+ ++q;
+ }
+ }
+ return SH_SH;
+}
+
+
+/*
+ * Determine the type of shell our parent process is
+ * This is quite tricky, not 100% reliable and probably
+ * not nearly as thorough as it should be. Basically, this
+ * is a "best guess" only, but hopefully will work in
+ * most cases.
+ */
+
+static int
+getshelltype(void)
+{
+ pid_t ppid = getppid();
+
+ if (ppid != 1) {
+ struct kinfo_proc kp;
+ struct stat st;
+ char path[MAXPATHLEN];
+ char * shell = getenv("SHELL");
+ int mib[4];
+ size_t len;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[3] = ppid;
+
+ if (shell != NULL && stat(shell, &st) != -1) {
+ struct stat st1;
+
+ mib[2] = KERN_PROC_PATHNAME;
+ len = sizeof(path);
+ if (sysctl(mib, 4, path, &len, NULL, 0) != -1) {
+ /* $SHELL is actual shell? */
+ if (stat(path, &st1) != -1 && memcmp(&st, &st1, sizeof st) == 0)
+ return getshellbyname(shell);
+ }
+ }
+ mib[2] = KERN_PROC_PID;
+ len = sizeof(kp);
+ if (sysctl(mib, 4, &kp, &len, NULL, 0) != -1)
+ return getshellbyname(kp.ki_comm);
+ }
+ return SH_SH;
+}
+
+static void
+getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp)
+{
+ int error;
+ int name[5];
+ size_t len;
+
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_RLIMIT;
+ name[3] = pid;
+ name[4] = resource;
+ len = sizeof(*rlp);
+ error = sysctl(name, 5, rlp, &len, NULL, 0);
+ if (error == -1)
+ err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid);
+ if (len != sizeof(*rlp))
+ errx(EXIT_FAILURE, "sysctl() returns wrong size");
+}
+
+static void
+setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp)
+{
+ int error;
+ int name[5];
+
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_RLIMIT;
+ name[3] = pid;
+ name[4] = resource;
+ error = sysctl(name, 5, NULL, 0, rlp, sizeof(*rlp));
+ if (error == -1)
+ err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid);
+}
diff --git a/usr.bin/limits/tests/Makefile b/usr.bin/limits/tests/Makefile
new file mode 100644
index 0000000..54bf892
--- /dev/null
+++ b/usr.bin/limits/tests/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH+= limits_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/limits/tests/Makefile.depend b/usr.bin/limits/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/limits/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/limits/tests/limits_test.sh b/usr.bin/limits/tests/limits_test.sh
new file mode 100755
index 0000000..63f60e8
--- /dev/null
+++ b/usr.bin/limits/tests/limits_test.sh
@@ -0,0 +1,65 @@
+#
+# Copyright 2015 EMC Corp.
+# 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.
+#
+# 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$
+#
+
+# Make sure time(1) is consistent with the FreeBSD time command and not the
+# shell interpretation of time(1)
+TIME=/usr/bin/time
+
+atf_test_case cputime_hard_flag
+cputime_hard_flag_body()
+{
+
+ atf_check -e empty -o match:'cputime[[:space:]]+3 secs' -s exit:0 \
+ limits -H -t 3 limits -H
+ atf_check -e empty -o match:'cputime[[:space:]]+3 secs' -s exit:0 \
+ limits -H -t 3 limits -S
+ atf_check -e match:'real[[:space:]]+[34]\.[0-9][0-9]' -o empty -s signal:sigkill \
+ limits -H -t 3 $TIME -p sh -c 'while : ; do : ; done'
+}
+
+SIGXCPU=24 # atf_check doesn't know sigxcpu
+
+atf_test_case cputime_soft_flag
+cputime_soft_flag_body()
+{
+
+ atf_check -e empty -o match:'cputime-max[[:space:]]+infinity secs' -s exit:0 \
+ limits -S -t 3 limits -H
+ atf_check -e empty -o match:'cputime-cur[[:space:]]+3 secs' -s exit:0 \
+ limits -S -t 3 limits -S
+ atf_check -e match:'real[[:space:]]+[34]\.[0-9][0-9]' -o empty -s signal:$SIGXCPU \
+ limits -S -t 3 $TIME -p sh -c 'while : ; do : ; done'
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case cputime_hard_flag
+ atf_add_test_case cputime_soft_flag
+}
diff --git a/usr.bin/locale/Makefile b/usr.bin/locale/Makefile
new file mode 100644
index 0000000..96c18bc
--- /dev/null
+++ b/usr.bin/locale/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= locale
+WARNS?= 3
+CFLAGS+= -I${.CURDIR}/../../lib/libc/locale
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/locale/Makefile.depend b/usr.bin/locale/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/locale/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/locale/locale.1 b/usr.bin/locale/locale.1
new file mode 100644
index 0000000..73de7ae
--- /dev/null
+++ b/usr.bin/locale/locale.1
@@ -0,0 +1,118 @@
+.\"
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@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 November 18, 2012
+.Dt LOCALE 1
+.Os
+.Sh NAME
+.Nm locale
+.Nd get locale-specific information
+.Sh SYNOPSIS
+.Nm
+.Op Fl a | m
+.Nm
+.Fl k
+.Ic list
+.Op Ar prefix
+.Nm
+.Op Fl ck
+.Op Ar keyword ...
+.Sh DESCRIPTION
+The
+.Nm
+utility is supposed to provide most locale specific information to
+the standard output.
+.Pp
+When
+.Nm
+is invoked without arguments, it will print out a summary of the current
+locale environment, subject to the environment settings and
+internal status.
+.Pp
+When
+.Nm
+is invoked with the
+.Ar keyword
+arguments, and no options are specified, it will print out the
+values of all keywords specified, using the current locale settings.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Print names of all available locales.
+While looking for locales,
+.Nm
+will respect the
+.Ev PATH_LOCALE
+environment variable, and use it instead of the system's default locale
+directory.
+.It Fl c
+Print the category name for all selected keywords.
+If no keywords are selected, print the category name for all defined
+keywords.
+.It Fl k
+Print the names and values of all selected keywords.
+If no keywords are selected, print the names and values of all defined
+keywords.
+.It Fl m
+Print names of all available charmaps.
+.El
+.Sh IMPLEMENTATION NOTES
+The special
+.Pf ( Fx
+specific) keyword
+.Cm list
+can be used to retrieve the human readable list of all available keywords.
+If so,
+a prefix string can be defined to limit the amount of keywords returned.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr setlocale 3
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2004 .
+The
+.Ev LC_CTYPE ,
+.Ev LC_MESSAGES
+and
+.Ev NLSPATH
+environment variables are not interpreted.
+.Sh BUGS
+Since
+.Fx
+does not support
+.Em charmap Ns s
+in their
+.Tn POSIX
+meaning,
+.Nm
+emulates the
+.Fl m
+option using the CODESETs listing of all available locales.
diff --git a/usr.bin/locale/locale.c b/usr.bin/locale/locale.c
new file mode 100644
index 0000000..8e1b03a
--- /dev/null
+++ b/usr.bin/locale/locale.c
@@ -0,0 +1,690 @@
+/*-
+ * Copyright (c) 2002, 2003 Alexey Zelkin <phantom@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$
+ */
+
+/*
+ * XXX: implement missing era_* (LC_TIME) keywords (require libc &
+ * nl_langinfo(3) extensions)
+ *
+ * XXX: correctly handle reserved 'charmap' keyword and '-m' option (require
+ * localedef(1) implementation). Currently it's handled via
+ * nl_langinfo(CODESET).
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <locale.h>
+#include <langinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stringlist.h>
+#include <unistd.h>
+#include "setlocale.h"
+
+/* Local prototypes */
+void init_locales_list(void);
+void list_charmaps(void);
+void list_locales(void);
+const char *lookup_localecat(int);
+char *kwval_lconv(int);
+int kwval_lookup(char *, char **, int *, int *);
+void showdetails(char *);
+void showkeywordslist(char *substring);
+void showlocale(void);
+void usage(void);
+
+/* Global variables */
+static StringList *locales = NULL;
+
+int all_locales = 0;
+int all_charmaps = 0;
+int prt_categories = 0;
+int prt_keywords = 0;
+int more_params = 0;
+
+struct _lcinfo {
+ const char *name;
+ int id;
+} lcinfo [] = {
+ { "LC_CTYPE", LC_CTYPE },
+ { "LC_COLLATE", LC_COLLATE },
+ { "LC_TIME", LC_TIME },
+ { "LC_NUMERIC", LC_NUMERIC },
+ { "LC_MONETARY", LC_MONETARY },
+ { "LC_MESSAGES", LC_MESSAGES }
+};
+#define NLCINFO nitems(lcinfo)
+
+/* ids for values not referenced by nl_langinfo() */
+#define KW_ZERO 10000
+#define KW_GROUPING (KW_ZERO+1)
+#define KW_INT_CURR_SYMBOL (KW_ZERO+2)
+#define KW_CURRENCY_SYMBOL (KW_ZERO+3)
+#define KW_MON_DECIMAL_POINT (KW_ZERO+4)
+#define KW_MON_THOUSANDS_SEP (KW_ZERO+5)
+#define KW_MON_GROUPING (KW_ZERO+6)
+#define KW_POSITIVE_SIGN (KW_ZERO+7)
+#define KW_NEGATIVE_SIGN (KW_ZERO+8)
+#define KW_INT_FRAC_DIGITS (KW_ZERO+9)
+#define KW_FRAC_DIGITS (KW_ZERO+10)
+#define KW_P_CS_PRECEDES (KW_ZERO+11)
+#define KW_P_SEP_BY_SPACE (KW_ZERO+12)
+#define KW_N_CS_PRECEDES (KW_ZERO+13)
+#define KW_N_SEP_BY_SPACE (KW_ZERO+14)
+#define KW_P_SIGN_POSN (KW_ZERO+15)
+#define KW_N_SIGN_POSN (KW_ZERO+16)
+#define KW_INT_P_CS_PRECEDES (KW_ZERO+17)
+#define KW_INT_P_SEP_BY_SPACE (KW_ZERO+18)
+#define KW_INT_N_CS_PRECEDES (KW_ZERO+19)
+#define KW_INT_N_SEP_BY_SPACE (KW_ZERO+20)
+#define KW_INT_P_SIGN_POSN (KW_ZERO+21)
+#define KW_INT_N_SIGN_POSN (KW_ZERO+22)
+
+struct _kwinfo {
+ const char *name;
+ int isstr; /* true - string, false - number */
+ int catid; /* LC_* */
+ int value_ref;
+ const char *comment;
+} kwinfo [] = {
+ { "charmap", 1, LC_CTYPE, CODESET, "" }, /* hack */
+
+ { "decimal_point", 1, LC_NUMERIC, RADIXCHAR, "" },
+ { "thousands_sep", 1, LC_NUMERIC, THOUSEP, "" },
+ { "grouping", 1, LC_NUMERIC, KW_GROUPING, "" },
+ { "radixchar", 1, LC_NUMERIC, RADIXCHAR,
+ "Same as decimal_point (FreeBSD only)" }, /* compat */
+ { "thousep", 1, LC_NUMERIC, THOUSEP,
+ "Same as thousands_sep (FreeBSD only)" }, /* compat */
+
+ { "int_curr_symbol", 1, LC_MONETARY, KW_INT_CURR_SYMBOL, "" },
+ { "currency_symbol", 1, LC_MONETARY, KW_CURRENCY_SYMBOL, "" },
+ { "mon_decimal_point", 1, LC_MONETARY, KW_MON_DECIMAL_POINT, "" },
+ { "mon_thousands_sep", 1, LC_MONETARY, KW_MON_THOUSANDS_SEP, "" },
+ { "mon_grouping", 1, LC_MONETARY, KW_MON_GROUPING, "" },
+ { "positive_sign", 1, LC_MONETARY, KW_POSITIVE_SIGN, "" },
+ { "negative_sign", 1, LC_MONETARY, KW_NEGATIVE_SIGN, "" },
+
+ { "int_frac_digits", 0, LC_MONETARY, KW_INT_FRAC_DIGITS, "" },
+ { "frac_digits", 0, LC_MONETARY, KW_FRAC_DIGITS, "" },
+ { "p_cs_precedes", 0, LC_MONETARY, KW_P_CS_PRECEDES, "" },
+ { "p_sep_by_space", 0, LC_MONETARY, KW_P_SEP_BY_SPACE, "" },
+ { "n_cs_precedes", 0, LC_MONETARY, KW_N_CS_PRECEDES, "" },
+ { "n_sep_by_space", 0, LC_MONETARY, KW_N_SEP_BY_SPACE, "" },
+ { "p_sign_posn", 0, LC_MONETARY, KW_P_SIGN_POSN, "" },
+ { "n_sign_posn", 0, LC_MONETARY, KW_N_SIGN_POSN, "" },
+ { "int_p_cs_precedes", 0, LC_MONETARY, KW_INT_P_CS_PRECEDES, "" },
+ { "int_p_sep_by_space", 0, LC_MONETARY, KW_INT_P_SEP_BY_SPACE, "" },
+ { "int_n_cs_precedes", 0, LC_MONETARY, KW_INT_N_CS_PRECEDES, "" },
+ { "int_n_sep_by_space", 0, LC_MONETARY, KW_INT_N_SEP_BY_SPACE, "" },
+ { "int_p_sign_posn", 0, LC_MONETARY, KW_INT_P_SIGN_POSN, "" },
+ { "int_n_sign_posn", 0, LC_MONETARY, KW_INT_N_SIGN_POSN, "" },
+
+ { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" },
+ { "d_fmt", 1, LC_TIME, D_FMT, "" },
+ { "t_fmt", 1, LC_TIME, T_FMT, "" },
+ { "am_str", 1, LC_TIME, AM_STR, "" },
+ { "pm_str", 1, LC_TIME, PM_STR, "" },
+ { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" },
+ { "day_1", 1, LC_TIME, DAY_1, "" },
+ { "day_2", 1, LC_TIME, DAY_2, "" },
+ { "day_3", 1, LC_TIME, DAY_3, "" },
+ { "day_4", 1, LC_TIME, DAY_4, "" },
+ { "day_5", 1, LC_TIME, DAY_5, "" },
+ { "day_6", 1, LC_TIME, DAY_6, "" },
+ { "day_7", 1, LC_TIME, DAY_7, "" },
+ { "abday_1", 1, LC_TIME, ABDAY_1, "" },
+ { "abday_2", 1, LC_TIME, ABDAY_2, "" },
+ { "abday_3", 1, LC_TIME, ABDAY_3, "" },
+ { "abday_4", 1, LC_TIME, ABDAY_4, "" },
+ { "abday_5", 1, LC_TIME, ABDAY_5, "" },
+ { "abday_6", 1, LC_TIME, ABDAY_6, "" },
+ { "abday_7", 1, LC_TIME, ABDAY_7, "" },
+ { "mon_1", 1, LC_TIME, MON_1, "" },
+ { "mon_2", 1, LC_TIME, MON_2, "" },
+ { "mon_3", 1, LC_TIME, MON_3, "" },
+ { "mon_4", 1, LC_TIME, MON_4, "" },
+ { "mon_5", 1, LC_TIME, MON_5, "" },
+ { "mon_6", 1, LC_TIME, MON_6, "" },
+ { "mon_7", 1, LC_TIME, MON_7, "" },
+ { "mon_8", 1, LC_TIME, MON_8, "" },
+ { "mon_9", 1, LC_TIME, MON_9, "" },
+ { "mon_10", 1, LC_TIME, MON_10, "" },
+ { "mon_11", 1, LC_TIME, MON_11, "" },
+ { "mon_12", 1, LC_TIME, MON_12, "" },
+ { "abmon_1", 1, LC_TIME, ABMON_1, "" },
+ { "abmon_2", 1, LC_TIME, ABMON_2, "" },
+ { "abmon_3", 1, LC_TIME, ABMON_3, "" },
+ { "abmon_4", 1, LC_TIME, ABMON_4, "" },
+ { "abmon_5", 1, LC_TIME, ABMON_5, "" },
+ { "abmon_6", 1, LC_TIME, ABMON_6, "" },
+ { "abmon_7", 1, LC_TIME, ABMON_7, "" },
+ { "abmon_8", 1, LC_TIME, ABMON_8, "" },
+ { "abmon_9", 1, LC_TIME, ABMON_9, "" },
+ { "abmon_10", 1, LC_TIME, ABMON_10, "" },
+ { "abmon_11", 1, LC_TIME, ABMON_11, "" },
+ { "abmon_12", 1, LC_TIME, ABMON_12, "" },
+ { "altmon_1", 1, LC_TIME, ALTMON_1, "(FreeBSD only)" },
+ { "altmon_2", 1, LC_TIME, ALTMON_2, "(FreeBSD only)" },
+ { "altmon_3", 1, LC_TIME, ALTMON_3, "(FreeBSD only)" },
+ { "altmon_4", 1, LC_TIME, ALTMON_4, "(FreeBSD only)" },
+ { "altmon_5", 1, LC_TIME, ALTMON_5, "(FreeBSD only)" },
+ { "altmon_6", 1, LC_TIME, ALTMON_6, "(FreeBSD only)" },
+ { "altmon_7", 1, LC_TIME, ALTMON_7, "(FreeBSD only)" },
+ { "altmon_8", 1, LC_TIME, ALTMON_8, "(FreeBSD only)" },
+ { "altmon_9", 1, LC_TIME, ALTMON_9, "(FreeBSD only)" },
+ { "altmon_10", 1, LC_TIME, ALTMON_10, "(FreeBSD only)" },
+ { "altmon_11", 1, LC_TIME, ALTMON_11, "(FreeBSD only)" },
+ { "altmon_12", 1, LC_TIME, ALTMON_12, "(FreeBSD only)" },
+ { "era", 1, LC_TIME, ERA, "(unavailable)" },
+ { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" },
+ { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" },
+ { "era_t_fmt", 1, LC_TIME, ERA_T_FMT, "(unavailable)" },
+ { "alt_digits", 1, LC_TIME, ALT_DIGITS, "" },
+ { "d_md_order", 1, LC_TIME, D_MD_ORDER,
+ "(FreeBSD only)" }, /* local */
+
+ { "yesexpr", 1, LC_MESSAGES, YESEXPR, "" },
+ { "noexpr", 1, LC_MESSAGES, NOEXPR, "" },
+ { "yesstr", 1, LC_MESSAGES, YESSTR,
+ "(POSIX legacy)" }, /* compat */
+ { "nostr", 1, LC_MESSAGES, NOSTR,
+ "(POSIX legacy)" } /* compat */
+
+};
+#define NKWINFO (sizeof(kwinfo)/sizeof(kwinfo[0]))
+
+const char *boguslocales[] = { "UTF-8" };
+#define NBOGUS (sizeof(boguslocales)/sizeof(boguslocales[0]))
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+ int tmp;
+
+ while ((ch = getopt(argc, argv, "ackms:")) != -1) {
+ switch (ch) {
+ case 'a':
+ all_locales = 1;
+ break;
+ case 'c':
+ prt_categories = 1;
+ break;
+ case 'k':
+ prt_keywords = 1;
+ break;
+ case 'm':
+ all_charmaps = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* validate arguments */
+ if (all_locales && all_charmaps)
+ usage();
+ if ((all_locales || all_charmaps) && argc > 0)
+ usage();
+ if ((all_locales || all_charmaps) && (prt_categories || prt_keywords))
+ usage();
+
+ /* process '-a' */
+ if (all_locales) {
+ list_locales();
+ exit(0);
+ }
+
+ /* process '-m' */
+ if (all_charmaps) {
+ list_charmaps();
+ exit(0);
+ }
+
+ /* check for special case '-k list' */
+ tmp = 0;
+ if (prt_keywords && argc > 0)
+ while (tmp < argc)
+ if (strcasecmp(argv[tmp++], "list") == 0) {
+ showkeywordslist(argv[tmp]);
+ exit(0);
+ }
+
+ /* process '-c', '-k', or command line arguments. */
+ if (prt_categories || prt_keywords || argc > 0) {
+ if (argc > 0) {
+ setlocale(LC_ALL, "");
+ while (argc > 0) {
+ showdetails(*argv);
+ argv++;
+ argc--;
+ }
+ } else {
+ uint i;
+ for (i = 0; i < nitems(kwinfo); i++)
+ showdetails ((char *)kwinfo [i].name);
+ }
+ exit(0);
+ }
+
+ /* no arguments, show current locale state */
+ showlocale();
+
+ return (0);
+}
+
+void
+usage(void)
+{
+ printf("Usage: locale [ -a | -m ]\n"
+ " locale -k list [prefix]\n"
+ " locale [ -ck ] [keyword ...]\n");
+ exit(1);
+}
+
+/*
+ * Output information about all available locales
+ *
+ * XXX actually output of this function does not guarantee that locale
+ * is really available to application, since it can be broken or
+ * inconsistent thus setlocale() will fail. Maybe add '-V' function to
+ * also validate these locales?
+ */
+void
+list_locales(void)
+{
+ size_t i;
+
+ init_locales_list();
+ for (i = 0; i < locales->sl_cur; i++) {
+ printf("%s\n", locales->sl_str[i]);
+ }
+}
+
+/*
+ * qsort() helper function
+ */
+static int
+scmp(const void *s1, const void *s2)
+{
+ return strcmp(*(const char **)s1, *(const char **)s2);
+}
+
+/*
+ * Output information about all available charmaps
+ *
+ * XXX this function is doing a task in hackish way, i.e. by scaning
+ * list of locales, spliting their codeset part and building list of
+ * them.
+ */
+void
+list_charmaps(void)
+{
+ size_t i;
+ char *s, *cs;
+ StringList *charmaps;
+
+ /* initialize StringList */
+ charmaps = sl_init();
+ if (charmaps == NULL)
+ err(1, "could not allocate memory");
+
+ /* fetch locales list */
+ init_locales_list();
+
+ /* split codesets and build their list */
+ for (i = 0; i < locales->sl_cur; i++) {
+ s = locales->sl_str[i];
+ if ((cs = strchr(s, '.')) != NULL) {
+ cs++;
+ if (sl_find(charmaps, cs) == NULL)
+ sl_add(charmaps, cs);
+ }
+ }
+
+ /* add US-ASCII, if not yet added */
+ if (sl_find(charmaps, "US-ASCII") == NULL)
+ sl_add(charmaps, "US-ASCII");
+
+ /* sort the list */
+ qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp);
+
+ /* print results */
+ for (i = 0; i < charmaps->sl_cur; i++) {
+ printf("%s\n", charmaps->sl_str[i]);
+ }
+}
+
+/*
+ * Retrieve sorted list of system locales (or user locales, if PATH_LOCALE
+ * environment variable is set)
+ */
+void
+init_locales_list(void)
+{
+ DIR *dirp;
+ struct dirent *dp;
+ size_t i;
+ int bogus;
+
+ /* why call this function twice ? */
+ if (locales != NULL)
+ return;
+
+ /* initialize StringList */
+ locales = sl_init();
+ if (locales == NULL)
+ err(1, "could not allocate memory");
+
+ /* get actual locales directory name */
+ if (__detect_path_locale() != 0)
+ err(1, "unable to find locales storage");
+
+ /* open locales directory */
+ dirp = opendir(_PathLocale);
+ if (dirp == NULL)
+ err(1, "could not open directory '%s'", _PathLocale);
+
+ /* scan directory and store its contents except "." and ".." */
+ while ((dp = readdir(dirp)) != NULL) {
+ if (*(dp->d_name) == '.')
+ continue; /* exclude "." and ".." */
+ for (bogus = i = 0; i < NBOGUS; i++)
+ if (strncmp(dp->d_name, boguslocales[i],
+ strlen(boguslocales[i])) == 0)
+ bogus = 1;
+ if (!bogus)
+ sl_add(locales, strdup(dp->d_name));
+ }
+ closedir(dirp);
+
+ /* make sure that 'POSIX' and 'C' locales are present in the list.
+ * POSIX 1003.1-2001 requires presence of 'POSIX' name only here, but
+ * we also list 'C' for constistency
+ */
+ if (sl_find(locales, "POSIX") == NULL)
+ sl_add(locales, "POSIX");
+
+ if (sl_find(locales, "C") == NULL)
+ sl_add(locales, "C");
+
+ /* make output nicer, sort the list */
+ qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
+}
+
+/*
+ * Show current locale status, depending on environment variables
+ */
+void
+showlocale(void)
+{
+ size_t i;
+ const char *lang, *vval, *eval;
+
+ setlocale(LC_ALL, "");
+
+ lang = getenv("LANG");
+ if (lang == NULL) {
+ lang = "";
+ }
+ printf("LANG=%s\n", lang);
+ /* XXX: if LANG is null, then set it to "C" to get implied values? */
+
+ for (i = 0; i < NLCINFO; i++) {
+ vval = setlocale(lcinfo[i].id, NULL);
+ eval = getenv(lcinfo[i].name);
+ if (eval != NULL && !strcmp(eval, vval)
+ && strcmp(lang, vval)) {
+ /*
+ * Appropriate environment variable set, its value
+ * is valid and not overridden by LC_ALL
+ *
+ * XXX: possible side effect: if both LANG and
+ * overridden environment variable are set into same
+ * value, then it'll be assumed as 'implied'
+ */
+ printf("%s=%s\n", lcinfo[i].name, vval);
+ } else {
+ printf("%s=\"%s\"\n", lcinfo[i].name, vval);
+ }
+ }
+
+ vval = getenv("LC_ALL");
+ if (vval == NULL) {
+ vval = "";
+ }
+ printf("LC_ALL=%s\n", vval);
+}
+
+/*
+ * keyword value lookup helper (via localeconv())
+ */
+char *
+kwval_lconv(int id)
+{
+ struct lconv *lc;
+ char *rval;
+
+ rval = NULL;
+ lc = localeconv();
+ switch (id) {
+ case KW_GROUPING:
+ rval = lc->grouping;
+ break;
+ case KW_INT_CURR_SYMBOL:
+ rval = lc->int_curr_symbol;
+ break;
+ case KW_CURRENCY_SYMBOL:
+ rval = lc->currency_symbol;
+ break;
+ case KW_MON_DECIMAL_POINT:
+ rval = lc->mon_decimal_point;
+ break;
+ case KW_MON_THOUSANDS_SEP:
+ rval = lc->mon_thousands_sep;
+ break;
+ case KW_MON_GROUPING:
+ rval = lc->mon_grouping;
+ break;
+ case KW_POSITIVE_SIGN:
+ rval = lc->positive_sign;
+ break;
+ case KW_NEGATIVE_SIGN:
+ rval = lc->negative_sign;
+ break;
+ case KW_INT_FRAC_DIGITS:
+ rval = &(lc->int_frac_digits);
+ break;
+ case KW_FRAC_DIGITS:
+ rval = &(lc->frac_digits);
+ break;
+ case KW_P_CS_PRECEDES:
+ rval = &(lc->p_cs_precedes);
+ break;
+ case KW_P_SEP_BY_SPACE:
+ rval = &(lc->p_sep_by_space);
+ break;
+ case KW_N_CS_PRECEDES:
+ rval = &(lc->n_cs_precedes);
+ break;
+ case KW_N_SEP_BY_SPACE:
+ rval = &(lc->n_sep_by_space);
+ break;
+ case KW_P_SIGN_POSN:
+ rval = &(lc->p_sign_posn);
+ break;
+ case KW_N_SIGN_POSN:
+ rval = &(lc->n_sign_posn);
+ break;
+ case KW_INT_P_CS_PRECEDES:
+ rval = &(lc->int_p_cs_precedes);
+ break;
+ case KW_INT_P_SEP_BY_SPACE:
+ rval = &(lc->int_p_sep_by_space);
+ break;
+ case KW_INT_N_CS_PRECEDES:
+ rval = &(lc->int_n_cs_precedes);
+ break;
+ case KW_INT_N_SEP_BY_SPACE:
+ rval = &(lc->int_n_sep_by_space);
+ break;
+ case KW_INT_P_SIGN_POSN:
+ rval = &(lc->int_p_sign_posn);
+ break;
+ case KW_INT_N_SIGN_POSN:
+ rval = &(lc->int_n_sign_posn);
+ break;
+ default:
+ break;
+ }
+ return (rval);
+}
+
+/*
+ * keyword value and properties lookup
+ */
+int
+kwval_lookup(char *kwname, char **kwval, int *cat, int *isstr)
+{
+ int rval;
+ size_t i;
+
+ rval = 0;
+ for (i = 0; i < NKWINFO; i++) {
+ if (strcasecmp(kwname, kwinfo[i].name) == 0) {
+ rval = 1;
+ *cat = kwinfo[i].catid;
+ *isstr = kwinfo[i].isstr;
+ if (kwinfo[i].value_ref < KW_ZERO) {
+ *kwval = nl_langinfo(kwinfo[i].value_ref);
+ } else {
+ *kwval = kwval_lconv(kwinfo[i].value_ref);
+ }
+ break;
+ }
+ }
+
+ return (rval);
+}
+
+/*
+ * Show details about requested keyword according to '-k' and/or '-c'
+ * command line options specified.
+ */
+void
+showdetails(char *kw)
+{
+ int isstr, cat, tmpval;
+ char *kwval;
+
+ if (kwval_lookup(kw, &kwval, &cat, &isstr) == 0) {
+ /*
+ * invalid keyword specified.
+ * XXX: any actions?
+ */
+ fprintf(stderr, "Unknown keyword: `%s'\n", kw);
+ return;
+ }
+
+ if (prt_categories) {
+ if (prt_keywords)
+ printf("%-20s ", lookup_localecat(cat));
+ else
+ printf("%-20s\t%s\n", kw, lookup_localecat(cat));
+ }
+
+ if (prt_keywords) {
+ if (isstr) {
+ printf("%s=\"%s\"\n", kw, kwval);
+ } else {
+ tmpval = (char) *kwval;
+ printf("%s=%d\n", kw, tmpval);
+ }
+ }
+
+ if (!prt_categories && !prt_keywords) {
+ if (isstr) {
+ printf("%s\n", kwval);
+ } else {
+ tmpval = (char) *kwval;
+ printf("%d\n", tmpval);
+ }
+ }
+}
+
+/*
+ * Convert locale category id into string
+ */
+const char *
+lookup_localecat(int cat)
+{
+ size_t i;
+
+ for (i = 0; i < NLCINFO; i++)
+ if (lcinfo[i].id == cat) {
+ return (lcinfo[i].name);
+ }
+ return ("UNKNOWN");
+}
+
+/*
+ * Show list of keywords
+ */
+void
+showkeywordslist(char *substring)
+{
+ size_t i;
+
+#define FMT "%-20s %-12s %-7s %-20s\n"
+
+ if (substring == NULL)
+ printf("List of available keywords\n\n");
+ else
+ printf("List of available keywords starting with '%s'\n\n",
+ substring);
+ printf(FMT, "Keyword", "Category", "Type", "Comment");
+ printf("-------------------- ------------ ------- --------------------\n");
+ for (i = 0; i < NKWINFO; i++) {
+ if (substring != NULL) {
+ if (strncmp(kwinfo[i].name, substring,
+ strlen(substring)) != 0)
+ continue;
+ }
+ printf(FMT,
+ kwinfo[i].name,
+ lookup_localecat(kwinfo[i].catid),
+ (kwinfo[i].isstr == 0) ? "number" : "string",
+ kwinfo[i].comment);
+ }
+}
diff --git a/usr.bin/localedef/Makefile b/usr.bin/localedef/Makefile
new file mode 100644
index 0000000..8ce5c4a
--- /dev/null
+++ b/usr.bin/localedef/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+PROG= localedef
+SRCS= charmap.c \
+ collate.c \
+ ctype.c \
+ localedef.c \
+ messages.c \
+ monetary.c \
+ numeric.c \
+ parser.y \
+ scanner.c \
+ time.c \
+ wide.c
+
+WARNS= 3
+${SRCS:M*.c}: parser.h
+parser.h: parser.y
+
+IGNORE_PRAGMA= yes
+
+CFLAGS+= -I. -I${.CURDIR}
+CFLAGS+= -I${.CURDIR}/../../lib/libc/locale
+CFLAGS+= -I${.CURDIR}/../../lib/libc/stdtime
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/localedef/Makefile.depend b/usr.bin/localedef/Makefile.depend
new file mode 100644
index 0000000..ca0b2f9
--- /dev/null
+++ b/usr.bin/localedef/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/localedef/README b/usr.bin/localedef/README
new file mode 100644
index 0000000..4d97371
--- /dev/null
+++ b/usr.bin/localedef/README
@@ -0,0 +1,11 @@
+While there are tools called "localedef" in Solaris and Linux, this
+tool does not share heritage with any other implementation. It was
+written independently by Garrett D'Amore while employed at Nexenta
+Systems, and thus carries the Nexenta Copyright.
+
+It was initially released under the CDDL license, but on 4 July 2014,
+Nexenta reissued the source under the BSD 2-clause license. This
+code is part of the Illumos project.
+
+see:
+https://github.com/Nexenta/illumos-nexenta/commit/cf17542a37fc83d0ae093777e30d480423858c29
diff --git a/usr.bin/localedef/charmap.c b/usr.bin/localedef/charmap.c
new file mode 100644
index 0000000..52839a9
--- /dev/null
+++ b/usr.bin/localedef/charmap.c
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * CHARMAP file handling for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/tree.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+
+
+typedef struct charmap {
+ const char *name;
+ wchar_t wc;
+ RB_ENTRY(charmap) rb_sym;
+ RB_ENTRY(charmap) rb_wc;
+} charmap_t;
+
+static int cmap_compare_sym(const void *n1, const void *n2);
+static int cmap_compare_wc(const void *n1, const void *n2);
+
+static RB_HEAD(cmap_sym, charmap) cmap_sym;
+static RB_HEAD(cmap_wc, charmap) cmap_wc;
+
+RB_GENERATE_STATIC(cmap_sym, charmap, rb_sym, cmap_compare_sym);
+RB_GENERATE_STATIC(cmap_wc, charmap, rb_wc, cmap_compare_wc);
+
+/*
+ * Array of POSIX specific portable characters.
+ */
+
+static const struct {
+ const char *name;
+ int ch;
+} portable_chars[] = {
+ { "NUL", '\0' },
+ { "alert", '\a' },
+ { "backspace", '\b' },
+ { "tab", '\t' },
+ { "carriage-return", '\r' },
+ { "newline", '\n' },
+ { "vertical-tab", '\v' },
+ { "form-feed", '\f' },
+ { "space", ' ' },
+ { "exclamation-mark", '!' },
+ { "quotation-mark", '"' },
+ { "number-sign", '#' },
+ { "dollar-sign", '$' },
+ { "percent-sign", '%' },
+ { "ampersand", '&' },
+ { "apostrophe", '\'' },
+ { "left-parenthesis", '(' },
+ { "right-parenthesis", '(' },
+ { "asterisk", '*' },
+ { "plus-sign", '+' },
+ { "comma", ','},
+ { "hyphen-minus", '-' },
+ { "hyphen", '-' },
+ { "full-stop", '.' },
+ { "period", '.' },
+ { "slash", '/' },
+ { "solidus", '/' },
+ { "zero", '0' },
+ { "one", '1' },
+ { "two", '2' },
+ { "three", '3' },
+ { "four", '4' },
+ { "five", '5' },
+ { "six", '6' },
+ { "seven", '7' },
+ { "eight", '8' },
+ { "nine", '9' },
+ { "colon", ':' },
+ { "semicolon", ';' },
+ { "less-than-sign", '<' },
+ { "equals-sign", '=' },
+ { "greater-than-sign", '>' },
+ { "question-mark", '?' },
+ { "commercial-at", '@' },
+ { "left-square-bracket", '[' },
+ { "backslash", '\\' },
+ { "reverse-solidus", '\\' },
+ { "right-square-bracket", ']' },
+ { "circumflex", '^' },
+ { "circumflex-accent", '^' },
+ { "low-line", '_' },
+ { "underscore", '_' },
+ { "grave-accent", '`' },
+ { "left-brace", '{' },
+ { "left-curly-bracket", '{' },
+ { "vertical-line", '|' },
+ { "right-brace", '}' },
+ { "right-curly-bracket", '}' },
+ { "tilde", '~' },
+ { "A", 'A' },
+ { "B", 'B' },
+ { "C", 'C' },
+ { "D", 'D' },
+ { "E", 'E' },
+ { "F", 'F' },
+ { "G", 'G' },
+ { "H", 'H' },
+ { "I", 'I' },
+ { "J", 'J' },
+ { "K", 'K' },
+ { "L", 'L' },
+ { "M", 'M' },
+ { "N", 'N' },
+ { "O", 'O' },
+ { "P", 'P' },
+ { "Q", 'Q' },
+ { "R", 'R' },
+ { "S", 'S' },
+ { "T", 'T' },
+ { "U", 'U' },
+ { "V", 'V' },
+ { "W", 'W' },
+ { "X", 'X' },
+ { "Y", 'Y' },
+ { "Z", 'Z' },
+ { "a", 'a' },
+ { "b", 'b' },
+ { "c", 'c' },
+ { "d", 'd' },
+ { "e", 'e' },
+ { "f", 'f' },
+ { "g", 'g' },
+ { "h", 'h' },
+ { "i", 'i' },
+ { "j", 'j' },
+ { "k", 'k' },
+ { "l", 'l' },
+ { "m", 'm' },
+ { "n", 'n' },
+ { "o", 'o' },
+ { "p", 'p' },
+ { "q", 'q' },
+ { "r", 'r' },
+ { "s", 's' },
+ { "t", 't' },
+ { "u", 'u' },
+ { "v", 'v' },
+ { "w", 'w' },
+ { "x", 'x' },
+ { "y", 'y' },
+ { "z", 'z' },
+ { NULL, 0 }
+};
+
+static int
+cmap_compare_sym(const void *n1, const void *n2)
+{
+ const charmap_t *c1 = n1;
+ const charmap_t *c2 = n2;
+ int rv;
+
+ rv = strcmp(c1->name, c2->name);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+static int
+cmap_compare_wc(const void *n1, const void *n2)
+{
+ const charmap_t *c1 = n1;
+ const charmap_t *c2 = n2;
+
+ return ((c1->wc < c2->wc) ? -1 : (c1->wc > c2->wc) ? 1 : 0);
+}
+
+void
+init_charmap(void)
+{
+ RB_INIT(&cmap_sym);
+
+ RB_INIT(&cmap_wc);
+}
+
+static void
+add_charmap_impl(const char *sym, wchar_t wc, int nodups)
+{
+ charmap_t srch;
+ charmap_t *n = NULL;
+
+ srch.wc = wc;
+ srch.name = sym;
+
+ /*
+ * also possibly insert the wide mapping, although note that there
+ * can only be one of these per wide character code.
+ */
+ if ((wc != (wchar_t)-1) && ((RB_FIND(cmap_wc, &cmap_wc, &srch)) == NULL)) {
+ if ((n = calloc(1, sizeof (*n))) == NULL) {
+ errf("out of memory");
+ return;
+ }
+ n->wc = wc;
+ RB_INSERT(cmap_wc, &cmap_wc, n);
+ }
+
+ if (sym) {
+ if (RB_FIND(cmap_sym, &cmap_sym, &srch) != NULL) {
+ if (nodups) {
+ errf("duplicate character definition");
+ }
+ return;
+ }
+ if ((n == NULL) && ((n = calloc(1, sizeof (*n))) == NULL)) {
+ errf("out of memory");
+ return;
+ }
+ n->wc = wc;
+ n->name = sym;
+
+ RB_INSERT(cmap_sym, &cmap_sym, n);
+ }
+}
+
+void
+add_charmap(const char *sym, int c)
+{
+ add_charmap_impl(sym, c, 1);
+}
+
+void
+add_charmap_undefined(char *sym)
+{
+ charmap_t srch;
+ charmap_t *cm = NULL;
+
+ srch.name = sym;
+ cm = RB_FIND(cmap_sym, &cmap_sym, &srch);
+
+ if ((undefok == 0) && ((cm == NULL) || (cm->wc == (wchar_t)-1))) {
+ warn("undefined symbol <%s>", sym);
+ add_charmap_impl(sym, -1, 0);
+ } else {
+ free(sym);
+ }
+}
+
+void
+add_charmap_range(char *s, char *e, int wc)
+{
+ int ls, le;
+ int si;
+ int sn, en;
+ int i;
+
+ static const char *digits = "0123456789";
+
+ ls = strlen(s);
+ le = strlen(e);
+
+ if (((si = strcspn(s, digits)) == 0) || (si == ls) ||
+ (strncmp(s, e, si) != 0) ||
+ ((int)strspn(s + si, digits) != (ls - si)) ||
+ ((int)strspn(e + si, digits) != (le - si)) ||
+ ((sn = atoi(s + si)) > ((en = atoi(e + si))))) {
+ errf("malformed charmap range");
+ return;
+ }
+
+ s[si] = 0;
+
+ for (i = sn; i <= en; i++) {
+ char *nn;
+ (void) asprintf(&nn, "%s%0*u", s, ls - si, i);
+ if (nn == NULL) {
+ errf("out of memory");
+ return;
+ }
+
+ add_charmap_impl(nn, wc, 1);
+ wc++;
+ }
+ free(s);
+ free(e);
+}
+
+void
+add_charmap_char(const char *name, int val)
+{
+ add_charmap_impl(name, val, 0);
+}
+
+/*
+ * POSIX insists that certain entries be present, even when not in the
+ * original charmap file.
+ */
+void
+add_charmap_posix(void)
+{
+ int i;
+
+ for (i = 0; portable_chars[i].name; i++) {
+ add_charmap_char(portable_chars[i].name, portable_chars[i].ch);
+ }
+}
+
+int
+lookup_charmap(const char *sym, wchar_t *wc)
+{
+ charmap_t srch;
+ charmap_t *n;
+
+ srch.name = sym;
+ n = RB_FIND(cmap_sym, &cmap_sym, &srch);
+ if (n && n->wc != (wchar_t)-1) {
+ if (wc)
+ *wc = n->wc;
+ return (0);
+ }
+ return (-1);
+}
+
+int
+check_charmap(wchar_t wc)
+{
+ charmap_t srch;
+
+ srch.wc = wc;
+ return (RB_FIND(cmap_wc, &cmap_wc, &srch) ? 0 : -1);
+}
diff --git a/usr.bin/localedef/collate.c b/usr.bin/localedef/collate.c
new file mode 100644
index 0000000..0eb6ea1
--- /dev/null
+++ b/usr.bin/localedef/collate.c
@@ -0,0 +1,1313 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_COLLATE database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/tree.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <limits.h>
+#include "localedef.h"
+#include "parser.h"
+#include "collate.h"
+
+/*
+ * Design notes.
+ *
+ * It will be extremely helpful to the reader if they have access to
+ * the localedef and locale file format specifications available.
+ * Latest versions of these are available from www.opengroup.org.
+ *
+ * The design for the collation code is a bit complex. The goal is a
+ * single collation database as described in collate.h (in
+ * libc/port/locale). However, there are some other tidbits:
+ *
+ * a) The substitution entries are now a directly indexable array. A
+ * priority elsewhere in the table is taken as an index into the
+ * substitution table if it has a high bit (COLLATE_SUBST_PRIORITY)
+ * set. (The bit is cleared and the result is the index into the
+ * table.
+ *
+ * b) We eliminate duplicate entries into the substitution table.
+ * This saves a lot of space.
+ *
+ * c) The priorities for each level are "compressed", so that each
+ * sorting level has consecutively numbered priorities starting at 1.
+ * (O is reserved for the ignore priority.) This means sort levels
+ * which only have a few distinct priorities can represent the
+ * priority level in fewer bits, which makes the strxfrm output
+ * smaller.
+ *
+ * d) We record the total number of priorities so that strxfrm can
+ * figure out how many bytes to expand a numeric priority into.
+ *
+ * e) For the UNDEFINED pass (the last pass), we record the maximum
+ * number of bits needed to uniquely prioritize these entries, so that
+ * the last pass can also use smaller strxfrm output when possible.
+ *
+ * f) Priorities with the sign bit set are verboten. This works out
+ * because no active character set needs that bit to carry significant
+ * information once the character is in wide form.
+ *
+ * To process the entire data to make the database, we actually run
+ * multiple passes over the data.
+ *
+ * The first pass, which is done at parse time, identifies elements,
+ * substitutions, and such, and records them in priority order. As
+ * some priorities can refer to other priorities, using forward
+ * references, we use a table of references indicating whether the
+ * priority's value has been resolved, or whether it is still a
+ * reference.
+ *
+ * The second pass walks over all the items in priority order, noting
+ * that they are used directly, and not just an indirect reference.
+ * This is done by creating a "weight" structure for the item. The
+ * weights are stashed in an RB tree sorted by relative "priority".
+ *
+ * The third pass walks over all the weight structures, in priority
+ * order, and assigns a new monotonically increasing (per sort level)
+ * weight value to them. These are the values that will actually be
+ * written to the file.
+ *
+ * The fourth pass just writes the data out.
+ */
+
+/*
+ * In order to resolve the priorities, we create a table of priorities.
+ * Entries in the table can be in one of three states.
+ *
+ * UNKNOWN is for newly allocated entries, and indicates that nothing
+ * is known about the priority. (For example, when new entries are created
+ * for collating-symbols, this is the value assigned for them until the
+ * collating symbol's order has been determined.
+ *
+ * RESOLVED is used for an entry where the priority indicates the final
+ * numeric weight.
+ *
+ * REFER is used for entries that reference other entries. Typically
+ * this is used for forward references. A collating-symbol can never
+ * have this value.
+ *
+ * The "pass" field is used during final resolution to aid in detection
+ * of referencing loops. (For example <A> depends on <B>, but <B> has its
+ * priority dependent on <A>.)
+ */
+typedef enum {
+ UNKNOWN, /* priority is totally unknown */
+ RESOLVED, /* priority value fully resolved */
+ REFER /* priority is a reference (index) */
+} res_t;
+
+typedef struct weight {
+ int32_t pri;
+ int opt;
+ RB_ENTRY(weight) entry;
+} weight_t;
+
+typedef struct priority {
+ res_t res;
+ int32_t pri;
+ int pass;
+ int lineno;
+} collpri_t;
+
+#define NUM_WT collinfo.directive_count
+
+/*
+ * These are the abstract collating symbols, which are just a symbolic
+ * way to reference a priority.
+ */
+struct collsym {
+ char *name;
+ int32_t ref;
+ RB_ENTRY(collsym) entry;
+};
+
+/*
+ * These are also abstract collating symbols, but we allow them to have
+ * different priorities at different levels.
+ */
+typedef struct collundef {
+ char *name;
+ int32_t ref[COLL_WEIGHTS_MAX];
+ RB_ENTRY(collundef) entry;
+} collundef_t;
+
+/*
+ * These are called "chains" in libc. This records the fact that two
+ * more characters should be treated as a single collating entity when
+ * they appear together. For example, in Spanish <C><h> gets collated
+ * as a character between <C> and <D>.
+ */
+struct collelem {
+ char *symbol;
+ wchar_t *expand;
+ int32_t ref[COLL_WEIGHTS_MAX];
+ RB_ENTRY(collelem) rb_bysymbol;
+ RB_ENTRY(collelem) rb_byexpand;
+};
+
+/*
+ * Individual characters have a sequence of weights as well.
+ */
+typedef struct collchar {
+ wchar_t wc;
+ int32_t ref[COLL_WEIGHTS_MAX];
+ RB_ENTRY(collchar) entry;
+} collchar_t;
+
+/*
+ * Substitution entries. The key is itself a priority. Note that
+ * when we create one of these, we *automatically* wind up with a
+ * fully resolved priority for the key, because creation of
+ * substitutions creates a resolved priority at the same time.
+ */
+typedef struct subst{
+ int32_t key;
+ int32_t ref[COLLATE_STR_LEN];
+ RB_ENTRY(subst) entry;
+ RB_ENTRY(subst) entry_ref;
+} subst_t;
+
+static RB_HEAD(collsyms, collsym) collsyms;
+static RB_HEAD(collundefs, collundef) collundefs;
+static RB_HEAD(elem_by_symbol, collelem) elem_by_symbol;
+static RB_HEAD(elem_by_expand, collelem) elem_by_expand;
+static RB_HEAD(collchars, collchar) collchars;
+static RB_HEAD(substs, subst) substs[COLL_WEIGHTS_MAX];
+static RB_HEAD(substs_ref, subst) substs_ref[COLL_WEIGHTS_MAX];
+static RB_HEAD(weights, weight) weights[COLL_WEIGHTS_MAX];
+static int32_t nweight[COLL_WEIGHTS_MAX];
+
+/*
+ * This is state tracking for the ellipsis token. Note that we start
+ * the initial values so that the ellipsis logic will think we got a
+ * magic starting value of NUL. It starts at minus one because the
+ * starting point is exclusive -- i.e. the starting point is not
+ * itself handled by the ellipsis code.
+ */
+static int currorder = EOF;
+static int lastorder = EOF;
+static collelem_t *currelem;
+static collchar_t *currchar;
+static collundef_t *currundef;
+static wchar_t ellipsis_start = 0;
+static int32_t ellipsis_weights[COLL_WEIGHTS_MAX];
+
+/*
+ * We keep a running tally of weights.
+ */
+static int nextpri = 1;
+static int nextsubst[COLL_WEIGHTS_MAX] = { 0 };
+
+/*
+ * This array collects up the weights for each level.
+ */
+static int32_t order_weights[COLL_WEIGHTS_MAX];
+static int curr_weight = 0;
+static int32_t subst_weights[COLLATE_STR_LEN];
+static int curr_subst = 0;
+
+/*
+ * Some initial priority values.
+ */
+static int32_t pri_undefined[COLL_WEIGHTS_MAX];
+static int32_t pri_ignore;
+
+static collate_info_t collinfo;
+
+static collpri_t *prilist = NULL;
+static int numpri = 0;
+static int maxpri = 0;
+
+static void start_order(int);
+
+static int32_t
+new_pri(void)
+{
+ int i;
+
+ if (numpri >= maxpri) {
+ maxpri = maxpri ? maxpri * 2 : 1024;
+ prilist = realloc(prilist, sizeof (collpri_t) * maxpri);
+ if (prilist == NULL) {
+ fprintf(stderr,"out of memory");
+ return (-1);
+ }
+ for (i = numpri; i < maxpri; i++) {
+ prilist[i].res = UNKNOWN;
+ prilist[i].pri = 0;
+ prilist[i].pass = 0;
+ }
+ }
+ return (numpri++);
+}
+
+static collpri_t *
+get_pri(int32_t ref)
+{
+ if ((ref < 0) || (ref > numpri)) {
+ INTERR;
+ return (NULL);
+ }
+ return (&prilist[ref]);
+}
+
+static void
+set_pri(int32_t ref, int32_t v, res_t res)
+{
+ collpri_t *pri;
+
+ pri = get_pri(ref);
+
+ if ((res == REFER) && ((v < 0) || (v >= numpri))) {
+ INTERR;
+ }
+
+ /* Resolve self references */
+ if ((res == REFER) && (ref == v)) {
+ v = nextpri;
+ res = RESOLVED;
+ }
+
+ if (pri->res != UNKNOWN) {
+ warn("repeated item in order list (first on %d)",
+ pri->lineno);
+ return;
+ }
+ pri->lineno = lineno;
+ pri->pri = v;
+ pri->res = res;
+}
+
+static int32_t
+resolve_pri(int32_t ref)
+{
+ collpri_t *pri;
+ static int32_t pass = 0;
+
+ pri = get_pri(ref);
+ pass++;
+ while (pri->res == REFER) {
+ if (pri->pass == pass) {
+ /* report a line with the circular symbol */
+ lineno = pri->lineno;
+ fprintf(stderr,"circular reference in order list");
+ return (-1);
+ }
+ if ((pri->pri < 0) || (pri->pri >= numpri)) {
+ INTERR;
+ return (-1);
+ }
+ pri->pass = pass;
+ pri = &prilist[pri->pri];
+ }
+
+ if (pri->res == UNKNOWN) {
+ return (-1);
+ }
+ if (pri->res != RESOLVED)
+ INTERR;
+
+ return (pri->pri);
+}
+
+static int
+weight_compare(const void *n1, const void *n2)
+{
+ int32_t k1 = ((const weight_t *)n1)->pri;
+ int32_t k2 = ((const weight_t *)n2)->pri;
+
+ return (k1 < k2 ? -1 : k1 > k2 ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(weights, weight, entry, weight_compare);
+
+static int
+collsym_compare(const void *n1, const void *n2)
+{
+ const collsym_t *c1 = n1;
+ const collsym_t *c2 = n2;
+ int rv;
+
+ rv = strcmp(c1->name, c2->name);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(collsyms, collsym, entry, collsym_compare);
+
+static int
+collundef_compare(const void *n1, const void *n2)
+{
+ const collundef_t *c1 = n1;
+ const collundef_t *c2 = n2;
+ int rv;
+
+ rv = strcmp(c1->name, c2->name);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(collundefs, collundef, entry, collundef_compare);
+
+static int
+element_compare_symbol(const void *n1, const void *n2)
+{
+ const collelem_t *c1 = n1;
+ const collelem_t *c2 = n2;
+ int rv;
+
+ rv = strcmp(c1->symbol, c2->symbol);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(elem_by_symbol, collelem, rb_bysymbol, element_compare_symbol);
+
+static int
+element_compare_expand(const void *n1, const void *n2)
+{
+ const collelem_t *c1 = n1;
+ const collelem_t *c2 = n2;
+ int rv;
+
+ rv = wcscmp(c1->expand, c2->expand);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(elem_by_expand, collelem, rb_byexpand, element_compare_expand);
+
+static int
+collchar_compare(const void *n1, const void *n2)
+{
+ wchar_t k1 = ((const collchar_t *)n1)->wc;
+ wchar_t k2 = ((const collchar_t *)n2)->wc;
+
+ return (k1 < k2 ? -1 : k1 > k2 ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(collchars, collchar, entry, collchar_compare);
+
+static int
+subst_compare(const void *n1, const void *n2)
+{
+ int32_t k1 = ((const subst_t *)n1)->key;
+ int32_t k2 = ((const subst_t *)n2)->key;
+
+ return (k1 < k2 ? -1 : k1 > k2 ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(substs, subst, entry, subst_compare);
+
+static int
+subst_compare_ref(const void *n1, const void *n2)
+{
+ const wchar_t *c1 = ((const subst_t *)n1)->ref;
+ const wchar_t *c2 = ((const subst_t *)n2)->ref;
+ int rv;
+
+ rv = wcscmp(c1, c2);
+ return ((rv < 0) ? -1 : (rv > 0) ? 1 : 0);
+}
+
+RB_GENERATE_STATIC(substs_ref, subst, entry_ref, subst_compare_ref);
+
+void
+init_collate(void)
+{
+ int i;
+
+ RB_INIT(&collsyms);
+
+ RB_INIT(&collundefs);
+
+ RB_INIT(&elem_by_symbol);
+
+ RB_INIT(&elem_by_expand);
+
+ RB_INIT(&collchars);
+
+ for (i = 0; i < COLL_WEIGHTS_MAX; i++) {
+ RB_INIT(&substs[i]);
+ RB_INIT(&substs_ref[i]);
+ RB_INIT(&weights[i]);
+ nweight[i] = 1;
+ }
+
+ (void) memset(&collinfo, 0, sizeof (collinfo));
+
+ /* allocate some initial priorities */
+ pri_ignore = new_pri();
+
+ set_pri(pri_ignore, 0, RESOLVED);
+
+ for (i = 0; i < COLL_WEIGHTS_MAX; i++) {
+ pri_undefined[i] = new_pri();
+
+ /* we will override this later */
+ set_pri(pri_undefined[i], COLLATE_MAX_PRIORITY, UNKNOWN);
+ }
+}
+
+void
+define_collsym(char *name)
+{
+ collsym_t *sym;
+
+ if ((sym = calloc(sizeof (*sym), 1)) == NULL) {
+ fprintf(stderr,"out of memory");
+ return;
+ }
+ sym->name = name;
+ sym->ref = new_pri();
+
+ if (RB_FIND(collsyms, &collsyms, sym) != NULL) {
+ /*
+ * This should never happen because we are only called
+ * for undefined symbols.
+ */
+ free(sym);
+ INTERR;
+ return;
+ }
+ RB_INSERT(collsyms, &collsyms, sym);
+}
+
+collsym_t *
+lookup_collsym(char *name)
+{
+ collsym_t srch;
+
+ srch.name = name;
+ return (RB_FIND(collsyms, &collsyms, &srch));
+}
+
+collelem_t *
+lookup_collelem(char *symbol)
+{
+ collelem_t srch;
+
+ srch.symbol = symbol;
+ return (RB_FIND(elem_by_symbol, &elem_by_symbol, &srch));
+}
+
+static collundef_t *
+get_collundef(char *name)
+{
+ collundef_t srch;
+ collundef_t *ud;
+ int i;
+
+ srch.name = name;
+ if ((ud = RB_FIND(collundefs, &collundefs, &srch)) == NULL) {
+ if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
+ ((ud->name = strdup(name)) == NULL)) {
+ fprintf(stderr,"out of memory");
+ free(ud);
+ return (NULL);
+ }
+ for (i = 0; i < NUM_WT; i++) {
+ ud->ref[i] = new_pri();
+ }
+ RB_INSERT(collundefs, &collundefs, ud);
+ }
+ add_charmap_undefined(name);
+ return (ud);
+}
+
+static collchar_t *
+get_collchar(wchar_t wc, int create)
+{
+ collchar_t srch;
+ collchar_t *cc;
+ int i;
+
+ srch.wc = wc;
+ cc = RB_FIND(collchars, &collchars, &srch);
+ if ((cc == NULL) && create) {
+ if ((cc = calloc(sizeof (*cc), 1)) == NULL) {
+ fprintf(stderr, "out of memory");
+ return (NULL);
+ }
+ for (i = 0; i < NUM_WT; i++) {
+ cc->ref[i] = new_pri();
+ }
+ cc->wc = wc;
+ RB_INSERT(collchars, &collchars, cc);
+ }
+ return (cc);
+}
+
+void
+end_order_collsym(collsym_t *sym)
+{
+ start_order(T_COLLSYM);
+ /* update the weight */
+
+ set_pri(sym->ref, nextpri, RESOLVED);
+ nextpri++;
+}
+
+void
+end_order(void)
+{
+ int i;
+ int32_t pri;
+ int32_t ref;
+ collpri_t *p;
+
+ /* advance the priority/weight */
+ pri = nextpri;
+
+ switch (currorder) {
+ case T_CHAR:
+ for (i = 0; i < NUM_WT; i++) {
+ if (((ref = order_weights[i]) < 0) ||
+ ((p = get_pri(ref)) == NULL) ||
+ (p->pri == -1)) {
+ /* unspecified weight is a self reference */
+ set_pri(currchar->ref[i], pri, RESOLVED);
+ } else {
+ set_pri(currchar->ref[i], ref, REFER);
+ }
+ order_weights[i] = -1;
+ }
+
+ /* leave a cookie trail in case next symbol is ellipsis */
+ ellipsis_start = currchar->wc + 1;
+ currchar = NULL;
+ break;
+
+ case T_ELLIPSIS:
+ /* save off the weights were we can find them */
+ for (i = 0; i < NUM_WT; i++) {
+ ellipsis_weights[i] = order_weights[i];
+ order_weights[i] = -1;
+ }
+ break;
+
+ case T_COLLELEM:
+ if (currelem == NULL) {
+ INTERR;
+ } else {
+ for (i = 0; i < NUM_WT; i++) {
+
+ if (((ref = order_weights[i]) < 0) ||
+ ((p = get_pri(ref)) == NULL) ||
+ (p->pri == -1)) {
+ set_pri(currelem->ref[i], pri,
+ RESOLVED);
+ } else {
+ set_pri(currelem->ref[i], ref, REFER);
+ }
+ order_weights[i] = -1;
+ }
+ }
+ break;
+
+ case T_UNDEFINED:
+ for (i = 0; i < NUM_WT; i++) {
+ if (((ref = order_weights[i]) < 0) ||
+ ((p = get_pri(ref)) == NULL) ||
+ (p->pri == -1)) {
+ set_pri(pri_undefined[i], -1, RESOLVED);
+ } else {
+ set_pri(pri_undefined[i], ref, REFER);
+ }
+ order_weights[i] = -1;
+ }
+ break;
+
+ case T_SYMBOL:
+ for (i = 0; i < NUM_WT; i++) {
+ if (((ref = order_weights[i]) < 0) ||
+ ((p = get_pri(ref)) == NULL) ||
+ (p->pri == -1)) {
+ set_pri(currundef->ref[i], pri, RESOLVED);
+ } else {
+ set_pri(currundef->ref[i], ref, REFER);
+ }
+ order_weights[i] = -1;
+ }
+ break;
+
+ default:
+ INTERR;
+ }
+
+ nextpri++;
+}
+
+static void
+start_order(int type)
+{
+ int i;
+
+ lastorder = currorder;
+ currorder = type;
+
+ /* this is used to protect ELLIPSIS processing */
+ if ((lastorder == T_ELLIPSIS) && (type != T_CHAR)) {
+ fprintf(stderr, "character value expected");
+ }
+
+ for (i = 0; i < COLL_WEIGHTS_MAX; i++) {
+ order_weights[i] = -1;
+ }
+ curr_weight = 0;
+}
+
+void
+start_order_undefined(void)
+{
+ start_order(T_UNDEFINED);
+}
+
+void
+start_order_symbol(char *name)
+{
+ currundef = get_collundef(name);
+ start_order(T_SYMBOL);
+}
+
+void
+start_order_char(wchar_t wc)
+{
+ collchar_t *cc;
+ int32_t ref;
+
+ start_order(T_CHAR);
+
+ /*
+ * If we last saw an ellipsis, then we need to close the range.
+ * Handle that here. Note that we have to be careful because the
+ * items *inside* the range are treated exclusiveley to the items
+ * outside of the range. The ends of the range can have quite
+ * different weights than the range members.
+ */
+ if (lastorder == T_ELLIPSIS) {
+ int i;
+
+ if (wc < ellipsis_start) {
+ fprintf(stderr, "malformed range!");
+ return;
+ }
+ while (ellipsis_start < wc) {
+ /*
+ * pick all of the saved weights for the
+ * ellipsis. note that -1 encodes for the
+ * ellipsis itself, which means to take the
+ * current relative priority.
+ */
+ if ((cc = get_collchar(ellipsis_start, 1)) == NULL) {
+ INTERR;
+ return;
+ }
+ for (i = 0; i < NUM_WT; i++) {
+ collpri_t *p;
+ if (((ref = ellipsis_weights[i]) == -1) ||
+ ((p = get_pri(ref)) == NULL) ||
+ (p->pri == -1)) {
+ set_pri(cc->ref[i], nextpri, RESOLVED);
+ } else {
+ set_pri(cc->ref[i], ref, REFER);
+ }
+ ellipsis_weights[i] = 0;
+ }
+ ellipsis_start++;
+ nextpri++;
+ }
+ }
+
+ currchar = get_collchar(wc, 1);
+}
+
+void
+start_order_collelem(collelem_t *e)
+{
+ start_order(T_COLLELEM);
+ currelem = e;
+}
+
+void
+start_order_ellipsis(void)
+{
+ int i;
+
+ start_order(T_ELLIPSIS);
+
+ if (lastorder != T_CHAR) {
+ fprintf(stderr, "illegal starting point for range");
+ return;
+ }
+
+ for (i = 0; i < NUM_WT; i++) {
+ ellipsis_weights[i] = order_weights[i];
+ }
+}
+
+void
+define_collelem(char *name, wchar_t *wcs)
+{
+ collelem_t *e;
+ int i;
+
+ if (wcslen(wcs) >= COLLATE_STR_LEN) {
+ fprintf(stderr,"expanded collation element too long");
+ return;
+ }
+
+ if ((e = calloc(sizeof (*e), 1)) == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+ e->expand = wcs;
+ e->symbol = name;
+
+ /*
+ * This is executed before the order statement, so we don't
+ * know how many priorities we *really* need. We allocate one
+ * for each possible weight. Not a big deal, as collating-elements
+ * prove to be quite rare.
+ */
+ for (i = 0; i < COLL_WEIGHTS_MAX; i++) {
+ e->ref[i] = new_pri();
+ }
+
+ /* A character sequence can only reduce to one element. */
+ if ((RB_FIND(elem_by_symbol, &elem_by_symbol, e) != NULL) ||
+ (RB_FIND(elem_by_expand, &elem_by_expand, e) != NULL)) {
+ fprintf(stderr, "duplicate collating element definition");
+ free(e);
+ return;
+ }
+ RB_INSERT(elem_by_symbol, &elem_by_symbol, e);
+ RB_INSERT(elem_by_expand, &elem_by_expand, e);
+}
+
+void
+add_order_bit(int kw)
+{
+ uint8_t bit = DIRECTIVE_UNDEF;
+
+ switch (kw) {
+ case T_FORWARD:
+ bit = DIRECTIVE_FORWARD;
+ break;
+ case T_BACKWARD:
+ bit = DIRECTIVE_BACKWARD;
+ break;
+ case T_POSITION:
+ bit = DIRECTIVE_POSITION;
+ break;
+ default:
+ INTERR;
+ break;
+ }
+ collinfo.directive[collinfo.directive_count] |= bit;
+}
+
+void
+add_order_directive(void)
+{
+ if (collinfo.directive_count >= COLL_WEIGHTS_MAX) {
+ fprintf(stderr,"too many directives (max %d)", COLL_WEIGHTS_MAX);
+ }
+ collinfo.directive_count++;
+}
+
+static void
+add_order_pri(int32_t ref)
+{
+ if (curr_weight >= NUM_WT) {
+ fprintf(stderr,"too many weights (max %d)", NUM_WT);
+ return;
+ }
+ order_weights[curr_weight] = ref;
+ curr_weight++;
+}
+
+void
+add_order_collsym(collsym_t *s)
+{
+ add_order_pri(s->ref);
+}
+
+void
+add_order_char(wchar_t wc)
+{
+ collchar_t *cc;
+
+ if ((cc = get_collchar(wc, 1)) == NULL) {
+ INTERR;
+ return;
+ }
+
+ add_order_pri(cc->ref[curr_weight]);
+}
+
+void
+add_order_collelem(collelem_t *e)
+{
+ add_order_pri(e->ref[curr_weight]);
+}
+
+void
+add_order_ignore(void)
+{
+ add_order_pri(pri_ignore);
+}
+
+void
+add_order_symbol(char *sym)
+{
+ collundef_t *c;
+ if ((c = get_collundef(sym)) == NULL) {
+ INTERR;
+ return;
+ }
+ add_order_pri(c->ref[curr_weight]);
+}
+
+void
+add_order_ellipsis(void)
+{
+ /* special NULL value indicates self reference */
+ add_order_pri(0);
+}
+
+void
+add_order_subst(void)
+{
+ subst_t srch;
+ subst_t *s;
+ int i;
+
+ (void) memset(&srch, 0, sizeof (srch));
+ for (i = 0; i < curr_subst; i++) {
+ srch.ref[i] = subst_weights[i];
+ subst_weights[i] = 0;
+ }
+ s = RB_FIND(substs_ref, &substs_ref[curr_weight], &srch);
+
+ if (s == NULL) {
+ if ((s = calloc(sizeof (*s), 1)) == NULL) {
+ fprintf(stderr,"out of memory");
+ return;
+ }
+ s->key = new_pri();
+
+ /*
+ * We use a self reference for our key, but we set a
+ * high bit to indicate that this is a substitution
+ * reference. This will expedite table lookups later,
+ * and prevent table lookups for situations that don't
+ * require it. (In short, its a big win, because we
+ * can skip a lot of binary searching.)
+ */
+ set_pri(s->key,
+ (nextsubst[curr_weight] | COLLATE_SUBST_PRIORITY),
+ RESOLVED);
+ nextsubst[curr_weight] += 1;
+
+ for (i = 0; i < curr_subst; i++) {
+ s->ref[i] = srch.ref[i];
+ }
+
+ RB_INSERT(substs_ref, &substs_ref[curr_weight], s);
+
+ if (RB_FIND(substs, &substs[curr_weight], s) != NULL) {
+ INTERR;
+ return;
+ }
+ RB_INSERT(substs, &substs[curr_weight], s);
+ }
+ curr_subst = 0;
+
+
+ /*
+ * We are using the current (unique) priority as a search key
+ * in the substitution table.
+ */
+ add_order_pri(s->key);
+}
+
+static void
+add_subst_pri(int32_t ref)
+{
+ if (curr_subst >= COLLATE_STR_LEN) {
+ fprintf(stderr,"substitution string is too long");
+ return;
+ }
+ subst_weights[curr_subst] = ref;
+ curr_subst++;
+}
+
+void
+add_subst_char(wchar_t wc)
+{
+ collchar_t *cc;
+
+
+ if (((cc = get_collchar(wc, 1)) == NULL) ||
+ (cc->wc != wc)) {
+ INTERR;
+ return;
+ }
+ /* we take the weight for the character at that position */
+ add_subst_pri(cc->ref[curr_weight]);
+}
+
+void
+add_subst_collelem(collelem_t *e)
+{
+ add_subst_pri(e->ref[curr_weight]);
+}
+
+void
+add_subst_collsym(collsym_t *s)
+{
+ add_subst_pri(s->ref);
+}
+
+void
+add_subst_symbol(char *ptr)
+{
+ collundef_t *cu;
+
+ if ((cu = get_collundef(ptr)) != NULL) {
+ add_subst_pri(cu->ref[curr_weight]);
+ }
+}
+
+void
+add_weight(int32_t ref, int pass)
+{
+ weight_t srch;
+ weight_t *w;
+
+ srch.pri = resolve_pri(ref);
+
+ /* No translation of ignores */
+ if (srch.pri == 0)
+ return;
+
+ /* Substitution priorities are not weights */
+ if (srch.pri & COLLATE_SUBST_PRIORITY)
+ return;
+
+ if (RB_FIND(weights, &weights[pass], &srch) != NULL)
+ return;
+
+ if ((w = calloc(sizeof (*w), 1)) == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+ w->pri = srch.pri;
+ RB_INSERT(weights, &weights[pass], w);
+}
+
+void
+add_weights(int32_t *refs)
+{
+ int i;
+ for (i = 0; i < NUM_WT; i++) {
+ add_weight(refs[i], i);
+ }
+}
+
+int32_t
+get_weight(int32_t ref, int pass)
+{
+ weight_t srch;
+ weight_t *w;
+ int32_t pri;
+
+ pri = resolve_pri(ref);
+ if (pri & COLLATE_SUBST_PRIORITY) {
+ return (pri);
+ }
+ if (pri <= 0) {
+ return (pri);
+ }
+ srch.pri = pri;
+ if ((w = RB_FIND(weights, &weights[pass], &srch)) == NULL) {
+ INTERR;
+ return (-1);
+ }
+ return (w->opt);
+}
+
+wchar_t *
+wsncpy(wchar_t *s1, const wchar_t *s2, size_t n)
+{
+ wchar_t *os1 = s1;
+
+ n++;
+ while (--n > 0 && (*s1++ = *s2++) != 0)
+ continue;
+ if (n > 0)
+ while (--n > 0)
+ *s1++ = 0;
+ return (os1);
+}
+
+#define RB_COUNT(x, name, head, cnt) do { \
+ (cnt) = 0; \
+ RB_FOREACH(x, name, (head)) { \
+ (cnt)++; \
+ } \
+} while (0)
+
+#define RB_NUMNODES(type, name, head, cnt) do { \
+ type *t; \
+ cnt = 0; \
+ RB_FOREACH(t, name, head) { \
+ cnt++; \
+ } \
+} while (0)
+
+void
+dump_collate(void)
+{
+ FILE *f;
+ int i, j, n;
+ size_t sz;
+ int32_t pri;
+ collelem_t *ce;
+ collchar_t *cc;
+ subst_t *sb;
+ char vers[COLLATE_STR_LEN];
+ collate_char_t chars[UCHAR_MAX + 1];
+ collate_large_t *large;
+ collate_subst_t *subst[COLL_WEIGHTS_MAX];
+ collate_chain_t *chain;
+
+ /*
+ * We have to run through a preliminary pass to identify all the
+ * weights that we use for each sorting level.
+ */
+ for (i = 0; i < NUM_WT; i++) {
+ add_weight(pri_ignore, i);
+ }
+ for (i = 0; i < NUM_WT; i++) {
+ RB_FOREACH(sb, substs, &substs[i]) {
+ for (j = 0; sb->ref[j]; j++) {
+ add_weight(sb->ref[j], i);
+ }
+ }
+ }
+ RB_FOREACH(ce, elem_by_expand, &elem_by_expand) {
+ add_weights(ce->ref);
+ }
+ RB_FOREACH(cc, collchars, &collchars) {
+ add_weights(cc->ref);
+ }
+
+ /*
+ * Now we walk the entire set of weights, removing the gaps
+ * in the weights. This gives us optimum usage. The walk
+ * occurs in priority.
+ */
+ for (i = 0; i < NUM_WT; i++) {
+ weight_t *w;
+ RB_FOREACH(w, weights, &weights[i]) {
+ w->opt = nweight[i];
+ nweight[i] += 1;
+ }
+ }
+
+ (void) memset(&chars, 0, sizeof (chars));
+ (void) memset(vers, 0, COLLATE_STR_LEN);
+ (void) strlcpy(vers, COLLATE_VERSION, sizeof (vers));
+
+ /*
+ * We need to make sure we arrange for the UNDEFINED field
+ * to show up. Also, set the total weight counts.
+ */
+ for (i = 0; i < NUM_WT; i++) {
+ if (resolve_pri(pri_undefined[i]) == -1) {
+ set_pri(pri_undefined[i], -1, RESOLVED);
+ /* they collate at the end of everything else */
+ collinfo.undef_pri[i] = COLLATE_MAX_PRIORITY;
+ }
+ collinfo.pri_count[i] = nweight[i];
+ }
+
+ collinfo.pri_count[NUM_WT] = max_wide();
+ collinfo.undef_pri[NUM_WT] = COLLATE_MAX_PRIORITY;
+ collinfo.directive[NUM_WT] = DIRECTIVE_UNDEFINED;
+
+ /*
+ * Ordinary character priorities
+ */
+ for (i = 0; i <= UCHAR_MAX; i++) {
+ if ((cc = get_collchar(i, 0)) != NULL) {
+ for (j = 0; j < NUM_WT; j++) {
+ chars[i].pri[j] = get_weight(cc->ref[j], j);
+ }
+ } else {
+ for (j = 0; j < NUM_WT; j++) {
+ chars[i].pri[j] =
+ get_weight(pri_undefined[j], j);
+ }
+ /*
+ * Per POSIX, for undefined characters, we
+ * also have to add a last item, which is the
+ * character code.
+ */
+ chars[i].pri[NUM_WT] = i;
+ }
+ }
+
+ /*
+ * Substitution tables
+ */
+ for (i = 0; i < NUM_WT; i++) {
+ collate_subst_t *st = NULL;
+ subst_t *temp;
+ RB_COUNT(temp, substs, &substs[i], n);
+ collinfo.subst_count[i] = n;
+ if ((st = calloc(sizeof (collate_subst_t) * n, 1)) == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+ n = 0;
+ RB_FOREACH(sb, substs, &substs[i]) {
+ if ((st[n].key = resolve_pri(sb->key)) < 0) {
+ /* by definition these resolve! */
+ INTERR;
+ }
+ if (st[n].key != (n | COLLATE_SUBST_PRIORITY)) {
+ INTERR;
+ }
+ for (j = 0; sb->ref[j]; j++) {
+ st[n].pri[j] = get_weight(sb->ref[j], i);
+ }
+ n++;
+ }
+ if (n != collinfo.subst_count[i])
+ INTERR;
+ subst[i] = st;
+ }
+
+
+ /*
+ * Chains, i.e. collating elements
+ */
+ RB_NUMNODES(collelem_t, elem_by_expand, &elem_by_expand,
+ collinfo.chain_count);
+ chain = calloc(sizeof (collate_chain_t), collinfo.chain_count);
+ if (chain == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+ n = 0;
+ RB_FOREACH(ce, elem_by_expand, &elem_by_expand) {
+ (void) wsncpy(chain[n].str, ce->expand, COLLATE_STR_LEN);
+ for (i = 0; i < NUM_WT; i++) {
+ chain[n].pri[i] = get_weight(ce->ref[i], i);
+ }
+ n++;
+ }
+ if (n != collinfo.chain_count)
+ INTERR;
+
+ /*
+ * Large (> UCHAR_MAX) character priorities
+ */
+ RB_NUMNODES(collchar_t, collchars, &collchars, n);
+ large = calloc(n, sizeof (collate_large_t));
+ if (large == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+
+ i = 0;
+ RB_FOREACH(cc, collchars, &collchars) {
+ int undef = 0;
+ /* we already gathered those */
+ if (cc->wc <= UCHAR_MAX)
+ continue;
+ for (j = 0; j < NUM_WT; j++) {
+ if ((pri = get_weight(cc->ref[j], j)) < 0) {
+ undef = 1;
+ }
+ if (undef && (pri >= 0)) {
+ /* if undefined, then all priorities are */
+ INTERR;
+ } else {
+ large[i].pri.pri[j] = pri;
+ }
+ }
+ if (!undef) {
+ large[i].val = cc->wc;
+ collinfo.large_count = i++;
+ }
+ }
+
+ if ((f = open_category()) == NULL) {
+ return;
+ }
+
+ /* Time to write the entire data set out */
+
+ if ((wr_category(vers, COLLATE_STR_LEN, f) < 0) ||
+ (wr_category(&collinfo, sizeof (collinfo), f) < 0) ||
+ (wr_category(&chars, sizeof (chars), f) < 0)) {
+ return;
+ }
+
+ for (i = 0; i < NUM_WT; i++) {
+ sz = sizeof (collate_subst_t) * collinfo.subst_count[i];
+ if (wr_category(subst[i], sz, f) < 0) {
+ return;
+ }
+ }
+ sz = sizeof (collate_chain_t) * collinfo.chain_count;
+ if (wr_category(chain, sz, f) < 0) {
+ return;
+ }
+ sz = sizeof (collate_large_t) * collinfo.large_count;
+ if (wr_category(large, sz, f) < 0) {
+ return;
+ }
+
+ close_category(f);
+}
diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c
new file mode 100644
index 0000000..e737ed5
--- /dev/null
+++ b/usr.bin/localedef/ctype.c
@@ -0,0 +1,463 @@
+/*
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 Garrett D'Amore <garrett@damore.org> All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_CTYPE database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/tree.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/types.h>
+#include <wchar.h>
+#include <ctype.h>
+#include <wctype.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+#include "runefile.h"
+
+
+/* Needed for bootstrapping, _CTYPE_N */
+#ifndef _CTYPE_N
+#define _CTYPE_N 0x00400000L
+#endif
+
+#define _ISUPPER _CTYPE_U
+#define _ISLOWER _CTYPE_L
+#define _ISDIGIT _CTYPE_D
+#define _ISXDIGIT _CTYPE_X
+#define _ISSPACE _CTYPE_S
+#define _ISBLANK _CTYPE_B
+#define _ISALPHA _CTYPE_A
+#define _ISPUNCT _CTYPE_P
+#define _ISGRAPH _CTYPE_G
+#define _ISPRINT _CTYPE_R
+#define _ISCNTRL _CTYPE_C
+#define _E1 _CTYPE_Q
+#define _E2 _CTYPE_I
+#define _E3 0
+#define _E4 _CTYPE_N
+#define _E5 _CTYPE_T
+
+static wchar_t last_ctype;
+static int ctype_compare(const void *n1, const void *n2);
+
+typedef struct ctype_node {
+ wchar_t wc;
+ int32_t ctype;
+ int32_t toupper;
+ int32_t tolower;
+ RB_ENTRY(ctype_node) entry;
+} ctype_node_t;
+
+static RB_HEAD(ctypes, ctype_node) ctypes;
+RB_GENERATE_STATIC(ctypes, ctype_node, entry, ctype_compare);
+
+static int
+ctype_compare(const void *n1, const void *n2)
+{
+ const ctype_node_t *c1 = n1;
+ const ctype_node_t *c2 = n2;
+
+ return (c1->wc < c2->wc ? -1 : c1->wc > c2->wc ? 1 : 0);
+}
+
+void
+init_ctype(void)
+{
+ RB_INIT(&ctypes);
+}
+
+
+static void
+add_ctype_impl(ctype_node_t *ctn)
+{
+ switch (last_kw) {
+ case T_ISUPPER:
+ ctn->ctype |= (_ISUPPER | _ISALPHA | _ISGRAPH | _ISPRINT);
+ break;
+ case T_ISLOWER:
+ ctn->ctype |= (_ISLOWER | _ISALPHA | _ISGRAPH | _ISPRINT);
+ break;
+ case T_ISALPHA:
+ ctn->ctype |= (_ISALPHA | _ISGRAPH | _ISPRINT);
+ break;
+ case T_ISDIGIT:
+ ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | _E4);
+ break;
+ case T_ISSPACE:
+ ctn->ctype |= _ISSPACE;
+ break;
+ case T_ISCNTRL:
+ ctn->ctype |= _ISCNTRL;
+ break;
+ case T_ISGRAPH:
+ ctn->ctype |= (_ISGRAPH | _ISPRINT);
+ break;
+ case T_ISPRINT:
+ ctn->ctype |= _ISPRINT;
+ break;
+ case T_ISPUNCT:
+ ctn->ctype |= (_ISPUNCT | _ISGRAPH | _ISPRINT);
+ break;
+ case T_ISXDIGIT:
+ ctn->ctype |= (_ISXDIGIT | _ISPRINT);
+ break;
+ case T_ISBLANK:
+ ctn->ctype |= (_ISBLANK | _ISSPACE);
+ break;
+ case T_ISPHONOGRAM:
+ ctn->ctype |= (_E1 | _ISPRINT | _ISGRAPH);
+ break;
+ case T_ISIDEOGRAM:
+ ctn->ctype |= (_E2 | _ISPRINT | _ISGRAPH);
+ break;
+ case T_ISENGLISH:
+ ctn->ctype |= (_E3 | _ISPRINT | _ISGRAPH);
+ break;
+ case T_ISNUMBER:
+ ctn->ctype |= (_E4 | _ISPRINT | _ISGRAPH);
+ break;
+ case T_ISSPECIAL:
+ ctn->ctype |= (_E5 | _ISPRINT | _ISGRAPH);
+ break;
+ case T_ISALNUM:
+ /*
+ * We can't do anything with this. The character
+ * should already be specified as a digit or alpha.
+ */
+ break;
+ default:
+ errf("not a valid character class");
+ }
+}
+
+static ctype_node_t *
+get_ctype(wchar_t wc)
+{
+ ctype_node_t srch;
+ ctype_node_t *ctn;
+
+ srch.wc = wc;
+ if ((ctn = RB_FIND(ctypes, &ctypes, &srch)) == NULL) {
+ if ((ctn = calloc(1, sizeof (*ctn))) == NULL) {
+ errf("out of memory");
+ return (NULL);
+ }
+ ctn->wc = wc;
+
+ RB_INSERT(ctypes, &ctypes, ctn);
+ }
+ return (ctn);
+}
+
+void
+add_ctype(int val)
+{
+ ctype_node_t *ctn;
+
+ if ((ctn = get_ctype(val)) == NULL) {
+ INTERR;
+ return;
+ }
+ add_ctype_impl(ctn);
+ last_ctype = ctn->wc;
+}
+
+void
+add_ctype_range(wchar_t end)
+{
+ ctype_node_t *ctn;
+ wchar_t cur;
+
+ if (end < last_ctype) {
+ errf("malformed character range (%u ... %u))",
+ last_ctype, end);
+ return;
+ }
+ for (cur = last_ctype + 1; cur <= end; cur++) {
+ if ((ctn = get_ctype(cur)) == NULL) {
+ INTERR;
+ return;
+ }
+ add_ctype_impl(ctn);
+ }
+ last_ctype = end;
+
+}
+
+/*
+ * A word about widths: if the width mask is specified, then libc
+ * unconditionally honors it. Otherwise, it assumes printable
+ * characters have width 1, and non-printable characters have width
+ * -1 (except for NULL which is special with with 0). Hence, we have
+ * no need to inject defaults here -- the "default" unset value of 0
+ * indicates that libc should use its own logic in wcwidth as described.
+ */
+void
+add_width(int wc, int width)
+{
+ ctype_node_t *ctn;
+
+ if ((ctn = get_ctype(wc)) == NULL) {
+ INTERR;
+ return;
+ }
+ ctn->ctype &= ~(_CTYPE_SWM);
+ switch (width) {
+ case 0:
+ ctn->ctype |= _CTYPE_SW0;
+ break;
+ case 1:
+ ctn->ctype |= _CTYPE_SW1;
+ break;
+ case 2:
+ ctn->ctype |= _CTYPE_SW2;
+ break;
+ case 3:
+ ctn->ctype |= _CTYPE_SW3;
+ break;
+ }
+}
+
+void
+add_width_range(int start, int end, int width)
+{
+ for (; start <= end; start++) {
+ add_width(start, width);
+ }
+}
+
+void
+add_caseconv(int val, int wc)
+{
+ ctype_node_t *ctn;
+
+ ctn = get_ctype(val);
+ if (ctn == NULL) {
+ INTERR;
+ return;
+ }
+
+ switch (last_kw) {
+ case T_TOUPPER:
+ ctn->toupper = wc;
+ break;
+ case T_TOLOWER:
+ ctn->tolower = wc;
+ break;
+ default:
+ INTERR;
+ break;
+ }
+}
+
+void
+dump_ctype(void)
+{
+ FILE *f;
+ _FileRuneLocale rl;
+ ctype_node_t *ctn, *last_ct, *last_lo, *last_up;
+ _FileRuneEntry *ct = NULL;
+ _FileRuneEntry *lo = NULL;
+ _FileRuneEntry *up = NULL;
+ wchar_t wc;
+
+ (void) memset(&rl, 0, sizeof (rl));
+ last_ct = NULL;
+ last_lo = NULL;
+ last_up = NULL;
+
+ if ((f = open_category()) == NULL)
+ return;
+
+ (void) memcpy(rl.magic, _FILE_RUNE_MAGIC_1, 8);
+ (void) strncpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding));
+
+ /*
+ * Initialize the identity map.
+ */
+ for (wc = 0; (unsigned)wc < _CACHED_RUNES; wc++) {
+ rl.maplower[wc] = wc;
+ rl.mapupper[wc] = wc;
+ }
+
+ RB_FOREACH(ctn, ctypes, &ctypes) {
+ int conflict = 0;
+
+ wc = ctn->wc;
+
+ /*
+ * POSIX requires certain portable characters have
+ * certain types. Add them if they are missing.
+ */
+ if ((wc >= 1) && (wc <= 127)) {
+ if ((wc >= 'A') && (wc <= 'Z'))
+ ctn->ctype |= _ISUPPER;
+ if ((wc >= 'a') && (wc <= 'z'))
+ ctn->ctype |= _ISLOWER;
+ if ((wc >= '0') && (wc <= '9'))
+ ctn->ctype |= _ISDIGIT;
+ if (wc == ' ')
+ ctn->ctype |= _ISPRINT;
+ if (strchr(" \f\n\r\t\v", (char)wc) != NULL)
+ ctn->ctype |= _ISSPACE;
+ if (strchr("0123456789ABCDEFabcdef", (char)wc) != NULL)
+ ctn->ctype |= _ISXDIGIT;
+ if (strchr(" \t", (char)wc))
+ ctn->ctype |= _ISBLANK;
+
+ /*
+ * Technically these settings are only
+ * required for the C locale. However, it
+ * turns out that because of the historical
+ * version of isprint(), we need them for all
+ * locales as well. Note that these are not
+ * necessarily valid punctation characters in
+ * the current language, but ispunct() needs
+ * to return TRUE for them.
+ */
+ if (strchr("!\"'#$%&()*+,-./:;<=>?@[\\]^_`{|}~",
+ (char)wc))
+ ctn->ctype |= _ISPUNCT;
+ }
+
+ /*
+ * POSIX also requires that certain types imply
+ * others. Add any inferred types here.
+ */
+ if (ctn->ctype & (_ISUPPER |_ISLOWER))
+ ctn->ctype |= _ISALPHA;
+ if (ctn->ctype & _ISDIGIT)
+ ctn->ctype |= _ISXDIGIT;
+ if (ctn->ctype & _ISBLANK)
+ ctn->ctype |= _ISSPACE;
+ if (ctn->ctype & (_ISALPHA|_ISDIGIT|_ISXDIGIT))
+ ctn->ctype |= _ISGRAPH;
+ if (ctn->ctype & _ISGRAPH)
+ ctn->ctype |= _ISPRINT;
+
+ /*
+ * Finally, POSIX requires that certain combinations
+ * are invalid. We don't flag this as a fatal error,
+ * but we will warn about.
+ */
+ if ((ctn->ctype & _ISALPHA) &&
+ (ctn->ctype & (_ISPUNCT|_ISDIGIT)))
+ conflict++;
+ if ((ctn->ctype & _ISPUNCT) &
+ (ctn->ctype & (_ISDIGIT|_ISALPHA|_ISXDIGIT)))
+ conflict++;
+ if ((ctn->ctype & _ISSPACE) && (ctn->ctype & _ISGRAPH))
+ conflict++;
+ if ((ctn->ctype & _ISCNTRL) & _ISPRINT)
+ conflict++;
+ if ((wc == ' ') && (ctn->ctype & (_ISPUNCT|_ISGRAPH)))
+ conflict++;
+
+ if (conflict) {
+ warn("conflicting classes for character 0x%x (%x)",
+ wc, ctn->ctype);
+ }
+ /*
+ * Handle the lower 256 characters using the simple
+ * optimization. Note that if we have not defined the
+ * upper/lower case, then we identity map it.
+ */
+ if ((unsigned)wc < _CACHED_RUNES) {
+ rl.runetype[wc] = ctn->ctype;
+ if (ctn->tolower)
+ rl.maplower[wc] = ctn->tolower;
+ if (ctn->toupper)
+ rl.mapupper[wc] = ctn->toupper;
+ continue;
+ }
+
+ if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype)) {
+ ct[rl.runetype_ext_nranges-1].max = wc;
+ last_ct = ctn;
+ } else {
+ rl.runetype_ext_nranges++;
+ ct = realloc(ct,
+ sizeof (*ct) * rl.runetype_ext_nranges);
+ ct[rl.runetype_ext_nranges - 1].min = wc;
+ ct[rl.runetype_ext_nranges - 1].max = wc;
+ ct[rl.runetype_ext_nranges - 1].map = ctn->ctype;
+ last_ct = ctn;
+ }
+ if (ctn->tolower == 0) {
+ last_lo = NULL;
+ } else if ((last_lo != NULL) &&
+ (last_lo->tolower + 1 == ctn->tolower)) {
+ lo[rl.maplower_ext_nranges-1].max = wc;
+ last_lo = ctn;
+ } else {
+ rl.maplower_ext_nranges++;
+ lo = realloc(lo,
+ sizeof (*lo) * rl.maplower_ext_nranges);
+ lo[rl.maplower_ext_nranges - 1].min = wc;
+ lo[rl.maplower_ext_nranges - 1].max = wc;
+ lo[rl.maplower_ext_nranges - 1].map = ctn->tolower;
+ last_lo = ctn;
+ }
+
+ if (ctn->toupper == 0) {
+ last_up = NULL;
+ } else if ((last_up != NULL) &&
+ (last_up->toupper + 1 == ctn->toupper)) {
+ up[rl.mapupper_ext_nranges-1].max = wc;
+ last_up = ctn;
+ } else {
+ rl.mapupper_ext_nranges++;
+ up = realloc(up,
+ sizeof (*up) * rl.mapupper_ext_nranges);
+ up[rl.mapupper_ext_nranges - 1].min = wc;
+ up[rl.mapupper_ext_nranges - 1].max = wc;
+ up[rl.mapupper_ext_nranges - 1].map = ctn->toupper;
+ last_up = ctn;
+ }
+ }
+
+ if ((wr_category(&rl, sizeof (rl), f) < 0) ||
+ (wr_category(ct, sizeof (*ct) * rl.runetype_ext_nranges, f) < 0) ||
+ (wr_category(lo, sizeof (*lo) * rl.maplower_ext_nranges, f) < 0) ||
+ (wr_category(up, sizeof (*up) * rl.mapupper_ext_nranges, f) < 0)) {
+ return;
+ }
+
+ close_category(f);
+}
diff --git a/usr.bin/localedef/localedef.1 b/usr.bin/localedef/localedef.1
new file mode 100644
index 0000000..f096ca0
--- /dev/null
+++ b/usr.bin/localedef/localedef.1
@@ -0,0 +1,267 @@
+.\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved
+.\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
+.\" Portions Copyright 2013 DEY Storage Systems, Inc.
+.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
+.\" permission to reproduce portions of its copyrighted documentation.
+.\" Original documentation from The Open Group can be obtained online at
+.\" http://www.opengroup.org/bookstore/.
+.\" The Institute of Electrical and Electronics Engineers and The Open Group,
+.\" have given us permission to reprint portions of their documentation. In
+.\" the following statement, the phrase "this text" refers to portions of the
+.\" system documentation. Portions of this text are reprinted and reproduced
+.\" in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1,
+.\" 2004 Edition, Standard for Information Technology -- Portable Operating
+.\" System Interface (POSIX), The Open Group Base Specifications Issue 6,
+.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
+.\" Engineers, Inc and The Open Group. In the event of any discrepancy between
+.\" these versions and the original IEEE and The Open Group Standard, the
+.\" original IEEE and The Open Group Standard is the referee document. The
+.\" original Standard can be obtained online at
+.\" http://www.opengroup.org/unix/online.html.
+.\" This notice shall appear on any product containing this material.
+.\" The contents of this file are subject to the terms of the Common
+.\" Development and Distribution License (the "License"). You may not use
+.\" this file except in compliance with the License.
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or
+.\" http://www.opensolaris.org/os/licensing. See the License for the specific
+.\" language governing permissions and limitations under the License.
+.\" When distributing Covered Code, include this CDDL HEADER in each file and
+.\" include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable,
+.\" add the following below this CDDL HEADER, with the fields enclosed by
+.\" brackets "[]" replaced with your own identifying information:
+.\" Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 28, 2015
+.Dt LOCALEDEF 1
+.Os
+.Sh NAME
+.Nm localedef
+.Nd define locale environment
+.Sh SYNOPSIS
+.Nm
+.Op Fl cDUv
+.Op Fl f Ar charmap
+.Op Fl i Ar sourcefile
+.Op Fl u Ar codeset
+.Op Fl w Ar widthfile
+.Ar localename
+.Sh DESCRIPTION
+The
+.Nm
+utility converts source definitions for locale categories
+into a format usable by the functions and utilities whose operational behavior
+is determined by the setting of the locale environment variables; see
+.Xr environ 7 .
+.Pp
+The utility reads source definitions for one or more locale categories
+belonging to the same locale from the file named in the
+.Fl i
+option (if specified) or from standard input.
+.Pp
+Each category source definition is identified by the corresponding environment
+variable name and terminated by an
+.Sy END
+.Em category-name
+statement.
+The following categories are supported:
+.Bl -tag -width ".Ev LC_MONETARY"
+.It Ev LC_CTYPE
+Defines character classification and case conversion.
+.It Ev LC_COLLATE
+Defines collation rules.
+.It Ev LC_MONETARY
+Defines the format and symbols used in formatting of monetary information.
+.It Ev LC_NUMERIC
+Defines the decimal delimiter, grouping and grouping symbol for non-monetary
+numeric editing.
+.It Ev LC_TIME
+Defines the format and content of date and time information.
+.It Ev LC_MESSAGES
+Defines the format and values of affirmative and negative responses.
+.El
+.Pp
+The following options are supported:
+.Bl -tag -width indent
+.It Fl c
+Creates permanent output even if warning messages have been issued.
+.It Fl D
+BSD-style
+output.
+Rather than the default of creating the
+.Ar localename
+directory and creating files like
+.Pa LC_CTYPE ,
+.Pa LC_COLLATE ,
+etc.\& in that directory,
+the output file names have the format
+.Dq <localename>.<category>
+and are dumped to the current directory.
+.It Fl f Ar charmap
+Specifies the pathname of a file containing a mapping of character symbols and
+collating element symbols to actual character encodings.
+This option must be specified if symbolic names (other than collating symbols
+defined in a
+.Sy collating-symbol
+keyword) are used.
+If the
+.Fl f
+option is not present, the default character mapping will be used.
+.It Fl i Ar sourcefile
+The path name of a file containing the source definitions.
+If this option is not present, source definitions will be read from
+standard input.
+.It Fl u Ar codeset
+Specifies the name of a codeset used as the target mapping of character symbols
+and collating element symbols whose encoding values are defined in terms of the
+ISO/IEC 10646-1:2000 standard position constant values.
+See
+.Sx NOTES .
+.It Fl U
+Ignore the presence of character symbols that have no matching character
+definition. This facilitates the use of a common locale definition file
+to be used across multiple encodings, even when some symbols are not
+present in a given encoding.
+.It Fl v
+Emit verbose debugging output on standard output.
+.It Fl w Ar widthfile
+The path name of the file containing character screen width definitions.
+If not supplied, then default screen widths will be assumed, which will
+generally not account for East Asian encodings requiring more than a single
+character cell to display, nor for combining or accent marks that occupy
+no additional screen width.
+.El
+.Pp
+The following operands are required:
+.Bl -tag -width ".Ar localename"
+.It Ar localename
+Identifies the locale.
+If the name contains one or more slash characters,
+.Ar localename
+will be interpreted as a path name where the created locale
+definitions will be stored.
+This capability may be restricted to users with appropriate privileges.
+(As a consequence of specifying one
+.Ar localename ,
+although several categories can be processed in one execution, only categories
+belonging to the same locale can be processed.)
+.El
+.Sh OUTPUT
+.Nm
+creates a directory of files that represents the locale's data,
+unless instructed otherwise by the
+.Fl D (
+BSD
+output) option.
+The contants of this directory should generally be copied into the
+appropriate subdirectory of
+.Pa /usr/share/locale
+in order the definitions to be visible to programs linked with libc.
+.Sh ENVIRONMENT
+See
+.Xr environ 7
+for definitions of the following environment variables that affect the
+execution of
+.Nm :
+.Ev LANG ,
+.Ev LC_ALL ,
+.Ev LC_COLLATE ,
+.Ev LC_CTYPE ,
+.Ev LC_MESSAGES ,
+.Ev LC_MONETARY ,
+.Ev LC_MUMERIC ,
+.Ev LC_TIME ,
+and
+.Ev NLSPATH .
+.Sh EXIT STATUS
+The following exit values are returned:
+.Bl -tag -width XX
+.It 0
+No errors occurred and the locales were successfully created.
+.It 1
+Warnings occurred and the locales were successfully created.
+.It 2
+The locale specification exceeded implementation limits or the coded character
+set or sets used were not supported by the implementation, and no locale was
+created.
+.It >3
+Warnings or errors occurred and no output was created.
+.El
+.Pp
+If an error is detected, no permanent output will be created.
+.Sh SEE ALSO
+.Xr locale 1 ,
+.Xr iconv_open 3 ,
+.Xr nl_langinfo 3 ,
+.Xr strftime 3 ,
+.Xr environ 7
+.Sh WARNINGS
+If warnings occur, permanent output will be created if the
+.Fl c
+option was specified.
+The following conditions will cause warning messages to be issued:
+.Bl -bullet
+.It
+If a symbolic name not found in the
+.Pa charmap
+file is used for the descriptions of the
+.Sy LC_CTYPE
+or
+.Sy LC_COLLATE
+categories (for other categories, this will be an error condition).
+.It
+If optional keywords not supported by the implementation are present in the
+source.
+.El
+.Sh NOTES
+When the
+.Fl u
+option is used, the
+.Ar codeset
+option-argument is interpreted as a name of a codeset to which the
+ISO/IEC 10646-1:2000 standard position constant values are converted.
+Both the ISO/IEC 10646-1:2000 standard position constant values and
+other formats (decimal, hexadecimal, or octal) are valid as encoding
+values within the charmap file.
+The
+.Ar codeset
+can be any codeset that is supported by the
+.Fn iconv_open 3
+function.
+.Pp
+When conflicts occur between the charmap specification of
+.Ar codeset ,
+.Em mb_cur_max ,
+or
+.Em mb_cur_min
+and the corresponding value for the codeset represented by the
+.Fl u
+option-argument
+.Ar codeset ,
+the
+.Nm
+utility fails with an error.
+.Pp
+When conflicts occur between the charmap encoding values specified for symbolic
+names of characters of the portable character set and the character encoding
+values defined by the US-ASCII, the result is unspecified.
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 11 .
+.Pp
+It was written by
+.An Garrett D'Amore
+.Aq Mt garrett@nexenta.com
+for Illumos.
+.An John Marino
+.Aq Mt draco@marino.st
+provided the alternations necessary to compile cleanly on
+.Dx .
+.An Baptiste Daroussin
+.Aq Mt bapt@FreeBSD.org
+ported it to
+.Fx
+and converted it to
+.Xr tree 3 .
diff --git a/usr.bin/localedef/localedef.c b/usr.bin/localedef/localedef.c
new file mode 100644
index 0000000..e4d0dff
--- /dev/null
+++ b/usr.bin/localedef/localedef.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * POSIX localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <libgen.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <limits.h>
+#include <locale.h>
+#include <dirent.h>
+#include "localedef.h"
+#include "parser.h"
+
+#ifndef TEXT_DOMAIN
+#define TEXT_DOMAIN "SYS_TEST"
+#endif
+
+static int bsd = 0;
+int verbose = 0;
+int undefok = 0;
+int warnok = 0;
+static char *locname = NULL;
+static char locpath[PATH_MAX];
+
+const char *
+category_name(void)
+{
+ switch (get_category()) {
+ case T_CHARMAP:
+ return ("CHARMAP");
+ case T_WIDTH:
+ return ("WIDTH");
+ case T_COLLATE:
+ return ("LC_COLLATE");
+ case T_CTYPE:
+ return ("LC_CTYPE");
+ case T_MESSAGES:
+ return ("LC_MESSAGES");
+ case T_MONETARY:
+ return ("LC_MONETARY");
+ case T_NUMERIC:
+ return ("LC_NUMERIC");
+ case T_TIME:
+ return ("LC_TIME");
+ default:
+ INTERR;
+ return (NULL);
+ }
+}
+
+static char *
+category_file(void)
+{
+ if (bsd)
+ (void) snprintf(locpath, sizeof (locpath), "%s.%s",
+ locname, category_name());
+ else
+ (void) snprintf(locpath, sizeof (locpath), "%s/%s",
+ locname, category_name());
+ return (locpath);
+}
+
+FILE *
+open_category(void)
+{
+ FILE *file;
+
+ if (verbose) {
+ (void) printf("Writing category %s: ", category_name());
+ (void) fflush(stdout);
+ }
+
+ /* make the parent directory */
+ if (!bsd)
+ (void) mkdir(dirname(category_file()), 0755);
+
+ /*
+ * note that we have to regenerate the file name, as dirname
+ * clobbered it.
+ */
+ file = fopen(category_file(), "w");
+ if (file == NULL) {
+ errf(strerror(errno));
+ return (NULL);
+ }
+ return (file);
+}
+
+void
+close_category(FILE *f)
+{
+ if (fchmod(fileno(f), 0644) < 0) {
+ (void) fclose(f);
+ (void) unlink(category_file());
+ errf(strerror(errno));
+ }
+ if (fclose(f) < 0) {
+ (void) unlink(category_file());
+ errf(strerror(errno));
+ }
+ if (verbose) {
+ (void) fprintf(stdout, "done.\n");
+ (void) fflush(stdout);
+ }
+}
+
+/*
+ * This function is used when copying the category from another
+ * locale. Note that the copy is actually performed using a hard
+ * link for efficiency.
+ */
+void
+copy_category(char *src)
+{
+ char srcpath[PATH_MAX];
+ int rv;
+
+ (void) snprintf(srcpath, sizeof (srcpath), "%s/%s",
+ src, category_name());
+ rv = access(srcpath, R_OK);
+ if ((rv != 0) && (strchr(srcpath, '/') == NULL)) {
+ /* Maybe we should try the system locale */
+ (void) snprintf(srcpath, sizeof (srcpath),
+ "/usr/lib/locale/%s/%s", src, category_name());
+ rv = access(srcpath, R_OK);
+ }
+
+ if (rv != 0) {
+ fprintf(stderr,"source locale data unavailable: %s", src);
+ return;
+ }
+
+ if (verbose > 1) {
+ (void) printf("Copying category %s from %s: ",
+ category_name(), src);
+ (void) fflush(stdout);
+ }
+
+ /* make the parent directory */
+ if (!bsd)
+ (void) mkdir(dirname(category_file()), 0755);
+
+ if (link(srcpath, category_file()) != 0) {
+ fprintf(stderr,"unable to copy locale data: %s",
+ strerror(errno));
+ return;
+ }
+ if (verbose > 1) {
+ (void) printf("done.\n");
+ }
+}
+
+int
+putl_category(const char *s, FILE *f)
+{
+ if (s && fputs(s, f) == EOF) {
+ (void) fclose(f);
+ (void) unlink(category_file());
+ errf(strerror(errno));
+ return (EOF);
+ }
+ if (fputc('\n', f) == EOF) {
+ (void) fclose(f);
+ (void) unlink(category_file());
+ errf(strerror(errno));
+ return (EOF);
+ }
+ return (0);
+}
+
+int
+wr_category(void *buf, size_t sz, FILE *f)
+{
+ if (!sz) {
+ return (0);
+ }
+ if (fwrite(buf, sz, 1, f) < 1) {
+ (void) fclose(f);
+ (void) unlink(category_file());
+ errf(strerror(errno));
+ return (EOF);
+ }
+ return (0);
+}
+
+int yyparse(void);
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr, "Usage: localedef [options] localename\n");
+ (void) fprintf(stderr, "[options] are:\n");
+ (void) fprintf(stderr, " -D : BSD-style output\n");
+ (void) fprintf(stderr, " -c : ignore warnings\n");
+ (void) fprintf(stderr, " -v : verbose output\n");
+ (void) fprintf(stderr, " -U : ignore undefined symbols\n");
+ (void) fprintf(stderr, " -f charmap : use given charmap file\n");
+ (void) fprintf(stderr, " -u encoding : assume encoding\n");
+ (void) fprintf(stderr, " -w widths : use screen widths file\n");
+ (void) fprintf(stderr, " -i locsrc : source file for locale\n");
+ exit(4);
+}
+
+int
+main(int argc, char **argv)
+{
+ int c;
+ char *lfname = NULL;
+ char *cfname = NULL;
+ char *wfname = NULL;
+ DIR *dir;
+
+ init_charmap();
+ init_collate();
+ init_ctype();
+ init_messages();
+ init_monetary();
+ init_numeric();
+ init_time();
+
+ yydebug = 0;
+
+ (void) setlocale(LC_ALL, "");
+
+ while ((c = getopt(argc, argv, "w:i:cf:u:vUD")) != -1) {
+ switch (c) {
+ case 'D':
+ bsd = 1;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'i':
+ lfname = optarg;
+ break;
+ case 'u':
+ set_wide_encoding(optarg);
+ break;
+ case 'f':
+ cfname = optarg;
+ break;
+ case 'U':
+ undefok++;
+ break;
+ case 'c':
+ warnok++;
+ break;
+ case 'w':
+ wfname = optarg;
+ break;
+ case '?':
+ usage();
+ break;
+ }
+ }
+
+ if ((argc - 1) != (optind)) {
+ usage();
+ }
+ locname = argv[argc - 1];
+ if (verbose) {
+ (void) printf("Processing locale %s.\n", locname);
+ }
+
+ if (cfname) {
+ if (verbose)
+ (void) printf("Loading charmap %s.\n", cfname);
+ reset_scanner(cfname);
+ (void) yyparse();
+ }
+
+ if (wfname) {
+ if (verbose)
+ (void) printf("Loading widths %s.\n", wfname);
+ reset_scanner(wfname);
+ (void) yyparse();
+ }
+
+ if (verbose) {
+ (void) printf("Loading POSIX portable characters.\n");
+ }
+ add_charmap_posix();
+
+ if (lfname) {
+ reset_scanner(lfname);
+ } else {
+ reset_scanner(NULL);
+ }
+
+ /* make the directory for the locale if not already present */
+ if (!bsd) {
+ while ((dir = opendir(locname)) == NULL) {
+ if ((errno != ENOENT) ||
+ (mkdir(locname, 0755) < 0)) {
+ errf(strerror(errno));
+ }
+ }
+ (void) closedir(dir);
+ (void) mkdir(dirname(category_file()), 0755);
+ }
+
+ (void) yyparse();
+ if (verbose) {
+ (void) printf("All done.\n");
+ }
+ return (warnings ? 1 : 0);
+}
diff --git a/usr.bin/localedef/localedef.h b/usr.bin/localedef/localedef.h
new file mode 100644
index 0000000..8c82939
--- /dev/null
+++ b/usr.bin/localedef/localedef.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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$
+ */
+
+/*
+ * POSIX localedef.
+ */
+
+/* Common header files. */
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sys/types.h>
+
+extern int com_char;
+extern int esc_char;
+extern int mb_cur_max;
+extern int mb_cur_min;
+extern int last_kw;
+extern int verbose;
+extern int yydebug;
+extern int lineno;
+extern int undefok; /* mostly ignore undefined symbols */
+extern int warnok;
+extern int warnings;
+
+int yylex(void);
+void yyerror(const char *);
+void errf(const char *, ...);
+void warn(const char *, ...);
+
+int putl_category(const char *, FILE *);
+int wr_category(void *, size_t, FILE *);
+FILE *open_category(void);
+void close_category(FILE *);
+void copy_category(char *);
+const char *category_name(void);
+
+int get_category(void);
+int get_symbol(void);
+int get_escaped(int);
+int get_wide(void);
+void reset_scanner(const char *);
+void scan_to_eol(void);
+void add_wcs(wchar_t);
+void add_tok(int);
+wchar_t *get_wcs(void);
+
+/* charmap.c - CHARMAP handling */
+void init_charmap(void);
+void add_charmap(const char *, int);
+void add_charmap_undefined(char *);
+void add_charmap_posix(void);
+void add_charmap_range(char *, char *, int);
+void add_charmap_char(const char *name, int val);
+int lookup_charmap(const char *, wchar_t *);
+int check_charmap_undefined(char *);
+int check_charmap(wchar_t);
+
+/* collate.o - LC_COLLATE handling */
+typedef struct collelem collelem_t;
+typedef struct collsym collsym_t;
+void init_collate(void);
+void define_collsym(char *);
+void define_collelem(char *, wchar_t *);
+void add_order_directive(void);
+void add_order_bit(int);
+void dump_collate(void);
+collsym_t *lookup_collsym(char *);
+collelem_t *lookup_collelem(char *);
+void start_order_collelem(collelem_t *);
+void start_order_undefined(void);
+void start_order_symbol(char *);
+void start_order_char(wchar_t);
+void start_order_ellipsis(void);
+void end_order_collsym(collsym_t *);
+void end_order(void);
+void add_weight(int32_t, int);
+void add_weights(int32_t *);
+void add_weight_num(int);
+void add_order_collelem(collelem_t *);
+void add_order_collsym(collsym_t *);
+void add_order_char(wchar_t);
+void add_order_ignore(void);
+void add_order_ellipsis(void);
+void add_order_symbol(char *);
+void add_order_subst(void);
+void add_subst_char(wchar_t);
+void add_subst_collsym(collsym_t *);
+void add_subst_collelem(collelem_t *);
+void add_subst_symbol(char *);
+int32_t get_weight(int32_t, int);
+wchar_t * wsncpy(wchar_t *, const wchar_t *, size_t);
+
+
+/* ctype.c - LC_CTYPE handling */
+void init_ctype(void);
+void add_ctype(int);
+void add_ctype_range(wchar_t);
+void add_width(int, int);
+void add_width_range(int, int, int);
+void add_caseconv(int, int);
+void dump_ctype(void);
+
+/* messages.c - LC_MESSAGES handling */
+void init_messages(void);
+void add_message(wchar_t *);
+void dump_messages(void);
+
+/* monetary.c - LC_MONETARY handling */
+void init_monetary(void);
+void add_monetary_str(wchar_t *);
+void add_monetary_num(int);
+void reset_monetary_group(void);
+void add_monetary_group(int);
+void dump_monetary(void);
+
+/* numeric.c - LC_NUMERIC handling */
+void init_numeric(void);
+void add_numeric_str(wchar_t *);
+void reset_numeric_group(void);
+void add_numeric_group(int);
+void dump_numeric(void);
+
+/* time.c - LC_TIME handling */
+void init_time(void);
+void add_time_str(wchar_t *);
+void reset_time_list(void);
+void add_time_list(wchar_t *);
+void check_time_list(void);
+void dump_time(void);
+
+/* wide.c - Wide character handling. */
+int to_wide(wchar_t *, const char *);
+int to_mbs(char *, wchar_t);
+int to_mb(char *, wchar_t);
+char *to_mb_string(const wchar_t *);
+void set_wide_encoding(const char *);
+void werr(const char *, ...);
+const char *get_wide_encoding(void);
+int max_wide(void);
+
+//#define _(x) gettext(x)
+#define INTERR fprintf(stderr,"internal fault (%s:%d)", __FILE__, __LINE__)
diff --git a/usr.bin/localedef/messages.c b/usr.bin/localedef/messages.c
new file mode 100644
index 0000000..0502eb5
--- /dev/null
+++ b/usr.bin/localedef/messages.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_MESSAGES database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+#include "lmessages.h"
+
+static struct lc_messages_T msgs;
+
+void
+init_messages(void)
+{
+ (void) memset(&msgs, 0, sizeof (msgs));
+}
+
+void
+add_message(wchar_t *wcs)
+{
+ char *str;
+
+ if ((str = to_mb_string(wcs)) == NULL) {
+ INTERR;
+ return;
+ }
+ free(wcs);
+
+ switch (last_kw) {
+ case T_YESSTR:
+ msgs.yesstr = str;
+ break;
+ case T_NOSTR:
+ msgs.nostr = str;
+ break;
+ case T_YESEXPR:
+ msgs.yesexpr = str;
+ break;
+ case T_NOEXPR:
+ msgs.noexpr = str;
+ break;
+ default:
+ free(str);
+ INTERR;
+ break;
+ }
+}
+
+void
+dump_messages(void)
+{
+ FILE *f;
+ char *ptr;
+
+ if (msgs.yesstr == NULL) {
+ warn("missing field 'yesstr'");
+ msgs.yesstr = "";
+ }
+ if (msgs.nostr == NULL) {
+ warn("missing field 'nostr'");
+ msgs.nostr = "";
+ }
+
+ /*
+ * CLDR likes to add : separated lists for yesstr and nostr.
+ * Legacy Solaris code does not seem to grok this. Fix it.
+ */
+ if ((ptr = strchr(msgs.yesstr, ':')) != NULL)
+ *ptr = 0;
+ if ((ptr = strchr(msgs.nostr, ':')) != NULL)
+ *ptr = 0;
+
+ if ((f = open_category()) == NULL) {
+ return;
+ }
+
+ if ((putl_category(msgs.yesexpr, f) == EOF) ||
+ (putl_category(msgs.noexpr, f) == EOF) ||
+ (putl_category(msgs.yesstr, f) == EOF) ||
+ (putl_category(msgs.nostr, f) == EOF)) {
+ return;
+ }
+ close_category(f);
+}
diff --git a/usr.bin/localedef/monetary.c b/usr.bin/localedef/monetary.c
new file mode 100644
index 0000000..d416e93
--- /dev/null
+++ b/usr.bin/localedef/monetary.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_MONETARY database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+#include "lmonetary.h"
+
+static struct lc_monetary_T mon;
+
+void
+init_monetary(void)
+{
+ (void) memset(&mon, 0, sizeof (mon));
+}
+
+void
+add_monetary_str(wchar_t *wcs)
+{
+ char *str;
+
+ if ((str = to_mb_string(wcs)) == NULL) {
+ INTERR;
+ return;
+ }
+ free(wcs);
+ switch (last_kw) {
+ case T_INT_CURR_SYMBOL:
+ mon.int_curr_symbol = str;
+ break;
+ case T_CURRENCY_SYMBOL:
+ mon.currency_symbol = str;
+ break;
+ case T_MON_DECIMAL_POINT:
+ mon.mon_decimal_point = str;
+ break;
+ case T_MON_THOUSANDS_SEP:
+ mon.mon_thousands_sep = str;
+ break;
+ case T_POSITIVE_SIGN:
+ mon.positive_sign = str;
+ break;
+ case T_NEGATIVE_SIGN:
+ mon.negative_sign = str;
+ break;
+ default:
+ free(str);
+ INTERR;
+ break;
+ }
+}
+
+void
+add_monetary_num(int n)
+{
+ char *str = NULL;
+
+ (void) asprintf(&str, "%d", n);
+ if (str == NULL) {
+ fprintf(stderr, "out of memory");
+ return;
+ }
+
+ switch (last_kw) {
+ case T_INT_FRAC_DIGITS:
+ mon.int_frac_digits = str;
+ break;
+ case T_FRAC_DIGITS:
+ mon.frac_digits = str;
+ break;
+ case T_P_CS_PRECEDES:
+ mon.p_cs_precedes = str;
+ break;
+ case T_P_SEP_BY_SPACE:
+ mon.p_sep_by_space = str;
+ break;
+ case T_N_CS_PRECEDES:
+ mon.n_cs_precedes = str;
+ break;
+ case T_N_SEP_BY_SPACE:
+ mon.n_sep_by_space = str;
+ break;
+ case T_P_SIGN_POSN:
+ mon.p_sign_posn = str;
+ break;
+ case T_N_SIGN_POSN:
+ mon.n_sign_posn = str;
+ break;
+ case T_INT_P_CS_PRECEDES:
+ mon.int_p_cs_precedes = str;
+ break;
+ case T_INT_N_CS_PRECEDES:
+ mon.int_n_cs_precedes = str;
+ break;
+ case T_INT_P_SEP_BY_SPACE:
+ mon.int_p_sep_by_space = str;
+ break;
+ case T_INT_N_SEP_BY_SPACE:
+ mon.int_n_sep_by_space = str;
+ break;
+ case T_INT_P_SIGN_POSN:
+ mon.int_p_sign_posn = str;
+ break;
+ case T_INT_N_SIGN_POSN:
+ mon.int_n_sign_posn = str;
+ break;
+ case T_MON_GROUPING:
+ mon.mon_grouping = str;
+ break;
+ default:
+ INTERR;
+ break;
+ }
+}
+
+void
+reset_monetary_group(void)
+{
+ free((char *)mon.mon_grouping);
+ mon.mon_grouping = NULL;
+}
+
+void
+add_monetary_group(int n)
+{
+ char *s = NULL;
+
+ if (mon.mon_grouping == NULL) {
+ (void) asprintf(&s, "%d", n);
+ } else {
+ (void) asprintf(&s, "%s;%d", mon.mon_grouping, n);
+ }
+ if (s == NULL)
+ fprintf(stderr, "out of memory");
+
+ free((char *)mon.mon_grouping);
+ mon.mon_grouping = s;
+}
+
+void
+dump_monetary(void)
+{
+ FILE *f;
+
+ if ((f = open_category()) == NULL) {
+ return;
+ }
+
+ if ((putl_category(mon.int_curr_symbol, f) == EOF) ||
+ (putl_category(mon.currency_symbol, f) == EOF) ||
+ (putl_category(mon.mon_decimal_point, f) == EOF) ||
+ (putl_category(mon.mon_thousands_sep, f) == EOF) ||
+ (putl_category(mon.mon_grouping, f) == EOF) ||
+ (putl_category(mon.positive_sign, f) == EOF) ||
+ (putl_category(mon.negative_sign, f) == EOF) ||
+ (putl_category(mon.int_frac_digits, f) == EOF) ||
+ (putl_category(mon.frac_digits, f) == EOF) ||
+ (putl_category(mon.p_cs_precedes, f) == EOF) ||
+ (putl_category(mon.p_sep_by_space, f) == EOF) ||
+ (putl_category(mon.n_cs_precedes, f) == EOF) ||
+ (putl_category(mon.n_sep_by_space, f) == EOF) ||
+ (putl_category(mon.p_sign_posn, f) == EOF) ||
+ (putl_category(mon.n_sign_posn, f) == EOF) ||
+ (putl_category(mon.int_p_cs_precedes, f) == EOF) ||
+ (putl_category(mon.int_n_cs_precedes, f) == EOF) ||
+ (putl_category(mon.int_p_sep_by_space, f) == EOF) ||
+ (putl_category(mon.int_n_sep_by_space, f) == EOF) ||
+ (putl_category(mon.int_p_sign_posn, f) == EOF) ||
+ (putl_category(mon.int_n_sign_posn, f) == EOF)) {
+ return;
+ }
+ close_category(f);
+}
diff --git a/usr.bin/localedef/numeric.c b/usr.bin/localedef/numeric.c
new file mode 100644
index 0000000..3ab95d5
--- /dev/null
+++ b/usr.bin/localedef/numeric.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_NUMERIC database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+#include "lnumeric.h"
+
+static struct lc_numeric_T numeric;
+
+void
+init_numeric(void)
+{
+ (void) memset(&numeric, 0, sizeof (numeric));
+}
+
+void
+add_numeric_str(wchar_t *wcs)
+{
+ char *str;
+
+ if ((str = to_mb_string(wcs)) == NULL) {
+ INTERR;
+ return;
+ }
+ free(wcs);
+
+ switch (last_kw) {
+ case T_DECIMAL_POINT:
+ numeric.decimal_point = str;
+ break;
+ case T_THOUSANDS_SEP:
+ numeric.thousands_sep = str;
+ break;
+ default:
+ free(str);
+ INTERR;
+ break;
+ }
+}
+
+void
+reset_numeric_group(void)
+{
+ free((char *)numeric.grouping);
+ numeric.grouping = NULL;
+}
+
+void
+add_numeric_group(int n)
+{
+ char *s;
+
+ if (numeric.grouping == NULL) {
+ (void) asprintf(&s, "%d", n);
+ } else {
+ (void) asprintf(&s, "%s;%d", numeric.grouping, n);
+ }
+ if (s == NULL)
+ fprintf(stderr, "out of memory");
+
+ free((char *)numeric.grouping);
+ numeric.grouping = s;
+}
+
+void
+dump_numeric(void)
+{
+ FILE *f;
+
+ if ((f = open_category()) == NULL) {
+ return;
+ }
+
+ if ((putl_category(numeric.decimal_point, f) == EOF) ||
+ (putl_category(numeric.thousands_sep, f) == EOF) ||
+ (putl_category(numeric.grouping, f) == EOF)) {
+ return;
+ }
+ close_category(f);
+}
diff --git a/usr.bin/localedef/parser.y b/usr.bin/localedef/parser.y
new file mode 100644
index 0000000..87ff95d
--- /dev/null
+++ b/usr.bin/localedef/parser.y
@@ -0,0 +1,706 @@
+%{
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * POSIX localedef grammar.
+ */
+
+#include <wchar.h>
+#include <stdio.h>
+#include <limits.h>
+#include "localedef.h"
+
+%}
+%union {
+ int num;
+ wchar_t wc;
+ char *token;
+ collsym_t *collsym;
+ collelem_t *collelem;
+}
+
+%token T_CODE_SET
+%token T_MB_CUR_MAX
+%token T_MB_CUR_MIN
+%token T_COM_CHAR
+%token T_ESC_CHAR
+%token T_LT
+%token T_GT
+%token T_NL
+%token T_SEMI
+%token T_COMMA
+%token T_ELLIPSIS
+%token T_RPAREN
+%token T_LPAREN
+%token T_QUOTE
+%token T_NULL
+%token T_WS
+%token T_END
+%token T_COPY
+%token T_CHARMAP
+%token T_WIDTH
+%token T_CTYPE
+%token T_ISUPPER
+%token T_ISLOWER
+%token T_ISALPHA
+%token T_ISDIGIT
+%token T_ISPUNCT
+%token T_ISXDIGIT
+%token T_ISSPACE
+%token T_ISPRINT
+%token T_ISGRAPH
+%token T_ISBLANK
+%token T_ISCNTRL
+%token T_ISALNUM
+%token T_ISSPECIAL
+%token T_ISPHONOGRAM
+%token T_ISIDEOGRAM
+%token T_ISENGLISH
+%token T_ISNUMBER
+%token T_TOUPPER
+%token T_TOLOWER
+%token T_COLLATE
+%token T_COLLATING_SYMBOL
+%token T_COLLATING_ELEMENT
+%token T_ORDER_START
+%token T_ORDER_END
+%token T_FORWARD
+%token T_BACKWARD
+%token T_POSITION
+%token T_FROM
+%token T_UNDEFINED
+%token T_IGNORE
+%token T_MESSAGES
+%token T_YESSTR
+%token T_NOSTR
+%token T_YESEXPR
+%token T_NOEXPR
+%token T_MONETARY
+%token T_INT_CURR_SYMBOL
+%token T_CURRENCY_SYMBOL
+%token T_MON_DECIMAL_POINT
+%token T_MON_THOUSANDS_SEP
+%token T_POSITIVE_SIGN
+%token T_NEGATIVE_SIGN
+%token T_MON_GROUPING
+%token T_INT_FRAC_DIGITS
+%token T_FRAC_DIGITS
+%token T_P_CS_PRECEDES
+%token T_P_SEP_BY_SPACE
+%token T_N_CS_PRECEDES
+%token T_N_SEP_BY_SPACE
+%token T_P_SIGN_POSN
+%token T_N_SIGN_POSN
+%token T_INT_P_CS_PRECEDES
+%token T_INT_N_CS_PRECEDES
+%token T_INT_P_SEP_BY_SPACE
+%token T_INT_N_SEP_BY_SPACE
+%token T_INT_P_SIGN_POSN
+%token T_INT_N_SIGN_POSN
+%token T_NUMERIC
+%token T_DECIMAL_POINT
+%token T_THOUSANDS_SEP
+%token T_GROUPING
+%token T_TIME
+%token T_ABDAY
+%token T_DAY
+%token T_ABMON
+%token T_MON
+%token T_ERA
+%token T_ERA_D_FMT
+%token T_ERA_T_FMT
+%token T_ERA_D_T_FMT
+%token T_ALT_DIGITS
+%token T_D_T_FMT
+%token T_D_FMT
+%token T_T_FMT
+%token T_AM_PM
+%token T_T_FMT_AMPM
+%token T_DATE_FMT
+%token <wc> T_CHAR
+%token <token> T_NAME
+%token <num> T_NUMBER
+%token <token> T_SYMBOL
+%token <collsym> T_COLLSYM
+%token <collelem> T_COLLELEM
+
+%%
+
+localedef : setting_list categories
+ | categories
+ ;
+
+string : T_QUOTE charlist T_QUOTE
+ | T_QUOTE T_QUOTE
+ ;
+
+charlist : charlist T_CHAR
+ {
+ add_wcs($2);
+ }
+ | T_CHAR
+ {
+ add_wcs($1);
+ }
+ ;
+
+setting_list : setting_list setting
+ | setting
+ ;
+
+
+setting : T_COM_CHAR T_CHAR T_NL
+ {
+ com_char = $2;
+ }
+ | T_ESC_CHAR T_CHAR T_NL
+ {
+ esc_char = $2;
+ }
+ | T_MB_CUR_MAX T_NUMBER T_NL
+ {
+ mb_cur_max = $2;
+ }
+ | T_MB_CUR_MIN T_NUMBER T_NL
+ {
+ mb_cur_min = $2;
+ }
+ | T_CODE_SET string T_NL
+ {
+ wchar_t *w = get_wcs();
+ set_wide_encoding(to_mb_string(w));
+ free(w);
+ }
+ | T_CODE_SET T_NAME T_NL
+ {
+ set_wide_encoding($2);
+ }
+ ;
+
+copycat : T_COPY T_NAME T_NL
+ {
+ copy_category($2);
+ }
+ | T_COPY string T_NL
+ {
+ wchar_t *w = get_wcs();
+ copy_category(to_mb_string(w));
+ free(w);
+ }
+ ;
+
+categories : categories category
+ | category
+ ;
+
+
+category : charmap
+ | messages
+ | monetary
+ | ctype
+ | collate
+ | numeric
+ | time
+ ;
+
+
+charmap : T_CHARMAP T_NL charmap_list T_END T_CHARMAP T_NL
+ | T_WIDTH T_NL width_list T_END T_WIDTH T_NL
+ ;
+
+
+charmap_list : charmap_list charmap_entry
+ | charmap_entry
+ ;
+
+
+charmap_entry : T_SYMBOL T_CHAR
+ {
+ add_charmap($1, $2);
+ scan_to_eol();
+ }
+ | T_SYMBOL T_ELLIPSIS T_SYMBOL T_CHAR
+ {
+ add_charmap_range($1, $3, $4);
+ scan_to_eol();
+ }
+ | T_NL
+ ;
+
+width_list : width_list width_entry
+ | width_entry
+ ;
+
+width_entry : T_CHAR T_NUMBER T_NL
+ {
+ add_width($1, $2);
+ }
+ | T_SYMBOL T_NUMBER T_NL
+ {
+ add_charmap_undefined($1);
+ }
+ | T_CHAR T_ELLIPSIS T_CHAR T_NUMBER T_NL
+ {
+ add_width_range($1, $3, $4);
+ }
+ | T_SYMBOL T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
+ {
+ add_charmap_undefined($1);
+ add_charmap_undefined($3);
+ }
+ | T_CHAR T_ELLIPSIS T_SYMBOL T_NUMBER T_NL
+ {
+ add_width($1, $4);
+ add_charmap_undefined($3);
+ }
+ | T_SYMBOL T_ELLIPSIS T_CHAR T_NUMBER T_NL
+ {
+ add_width($3, $4);
+ add_charmap_undefined($1);
+ }
+ | T_NL
+ ;
+
+ctype : T_CTYPE T_NL ctype_list T_END T_CTYPE T_NL
+ {
+ dump_ctype();
+ }
+ | T_CTYPE T_NL copycat T_END T_CTYPE T_NL
+ ;
+
+ctype_list : ctype_list ctype_kw
+ | ctype_kw
+ ;
+
+ctype_kw : T_ISUPPER cc_list T_NL
+ | T_ISLOWER cc_list T_NL
+ | T_ISALPHA cc_list T_NL
+ | T_ISDIGIT cc_list T_NL
+ | T_ISPUNCT cc_list T_NL
+ | T_ISXDIGIT cc_list T_NL
+ | T_ISSPACE cc_list T_NL
+ | T_ISPRINT cc_list T_NL
+ | T_ISGRAPH cc_list T_NL
+ | T_ISBLANK cc_list T_NL
+ | T_ISCNTRL cc_list T_NL
+ | T_ISALNUM cc_list T_NL
+ | T_ISSPECIAL cc_list T_NL
+ | T_ISENGLISH cc_list T_NL
+ | T_ISNUMBER cc_list T_NL
+ | T_ISIDEOGRAM cc_list T_NL
+ | T_ISPHONOGRAM cc_list T_NL
+ | T_TOUPPER conv_list T_NL
+ | T_TOLOWER conv_list T_NL
+ ;
+
+
+cc_list : cc_list T_SEMI T_CHAR
+ {
+ add_ctype($3);
+ }
+ | cc_list T_SEMI T_SYMBOL
+ {
+ add_charmap_undefined($3);
+ }
+ | cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR
+ {
+ /* note that the endpoints *must* be characters */
+ add_ctype_range($5);
+ }
+ | T_CHAR
+ {
+ add_ctype($1);
+ }
+ | T_SYMBOL
+ {
+ add_charmap_undefined($1);
+ }
+ ;
+
+conv_list : conv_list T_SEMI conv_pair
+ | conv_pair
+ ;
+
+
+conv_pair : T_LPAREN T_CHAR T_COMMA T_CHAR T_RPAREN
+ {
+ add_caseconv($2, $4);
+ }
+ | T_LPAREN T_SYMBOL T_COMMA T_CHAR T_RPAREN
+ {
+ add_charmap_undefined($2);
+ }
+ | T_LPAREN T_SYMBOL T_COMMA T_SYMBOL T_RPAREN
+ {
+ add_charmap_undefined($2);
+ add_charmap_undefined($4);
+ }
+ | T_LPAREN T_CHAR T_COMMA T_SYMBOL T_RPAREN
+ {
+ add_charmap_undefined($4);
+ }
+ ;
+
+collate : T_COLLATE T_NL coll_order T_END T_COLLATE T_NL
+ {
+ dump_collate();
+ }
+ | T_COLLATE T_NL coll_optional coll_order T_END T_COLLATE T_NL
+ {
+ dump_collate();
+ }
+ | T_COLLATE T_NL copycat T_END T_COLLATE T_NL
+ ;
+
+
+coll_optional : coll_optional coll_symbols
+ | coll_optional coll_elements
+ | coll_symbols
+ | coll_elements
+ ;
+
+
+coll_symbols : T_COLLATING_SYMBOL T_SYMBOL T_NL
+ {
+ define_collsym($2);
+ }
+ ;
+
+
+coll_elements : T_COLLATING_ELEMENT T_SYMBOL T_FROM string T_NL
+ {
+ define_collelem($2, get_wcs());
+ }
+ ;
+
+coll_order : T_ORDER_START T_NL order_list T_ORDER_END T_NL
+ {
+ /* If no order list supplied default to one forward */
+ add_order_bit(T_FORWARD);
+ add_order_directive();
+ }
+ | T_ORDER_START order_args T_NL order_list T_ORDER_END T_NL
+ ;
+
+
+order_args : order_args T_SEMI order_arg
+ {
+ add_order_directive();
+ }
+ | order_arg
+ {
+ add_order_directive();
+ }
+ ;
+
+order_arg : order_arg T_COMMA order_dir
+ | order_dir
+ ;
+
+order_dir : T_FORWARD
+ {
+ add_order_bit(T_FORWARD);
+ }
+ | T_BACKWARD
+ {
+ add_order_bit(T_BACKWARD);
+ }
+ | T_POSITION
+ {
+ add_order_bit(T_POSITION);
+ }
+ ;
+
+order_list : order_list order_item
+ | order_item
+ ;
+
+order_item : T_COLLSYM T_NL
+ {
+ end_order_collsym($1);
+ }
+ | order_itemkw T_NL
+ {
+ end_order();
+ }
+ | order_itemkw order_weights T_NL
+ {
+ end_order();
+ }
+ ;
+
+order_itemkw : T_CHAR
+ {
+ start_order_char($1);
+ }
+ | T_ELLIPSIS
+ {
+ start_order_ellipsis();
+ }
+ | T_COLLELEM
+ {
+ start_order_collelem($1);
+ }
+ | T_UNDEFINED
+ {
+ start_order_undefined();
+ }
+ | T_SYMBOL
+ {
+ start_order_symbol($1);
+ }
+ ;
+
+order_weights : order_weights T_SEMI order_weight
+ | order_weights T_SEMI
+ | order_weight
+ ;
+
+order_weight : T_COLLELEM
+ {
+ add_order_collelem($1);
+ }
+ | T_COLLSYM
+ {
+ add_order_collsym($1);
+ }
+ | T_CHAR
+ {
+ add_order_char($1);
+ }
+ | T_ELLIPSIS
+ {
+ add_order_ellipsis();
+ }
+ | T_IGNORE
+ {
+ add_order_ignore();
+ }
+ | T_SYMBOL
+ {
+ add_order_symbol($1);
+ }
+ | T_QUOTE order_str T_QUOTE
+ {
+ add_order_subst();
+ }
+ ;
+
+order_str : order_str order_stritem
+ | order_stritem
+ ;
+
+order_stritem : T_CHAR
+ {
+ add_subst_char($1);
+ }
+ | T_COLLSYM
+ {
+ add_subst_collsym($1);
+ }
+ | T_COLLELEM
+ {
+ add_subst_collelem($1);
+ }
+ | T_SYMBOL
+ {
+ add_subst_symbol($1);
+ }
+ ;
+
+messages : T_MESSAGES T_NL messages_list T_END T_MESSAGES T_NL
+ {
+ dump_messages();
+ }
+ | T_MESSAGES T_NL copycat T_END T_MESSAGES T_NL
+ ;
+
+messages_list : messages_list messages_item
+ | messages_item
+ ;
+
+messages_kw : T_YESSTR
+ | T_NOSTR
+ | T_YESEXPR
+ | T_NOEXPR
+ ;
+
+messages_item : messages_kw string T_NL
+ {
+ add_message(get_wcs());
+ }
+ ;
+
+monetary : T_MONETARY T_NL monetary_list T_END T_MONETARY T_NL
+ {
+ dump_monetary();
+ }
+ | T_MONETARY T_NL copycat T_END T_MONETARY T_NL
+ ;
+
+monetary_list : monetary_list monetary_kw
+ | monetary_kw
+ ;
+
+monetary_strkw : T_INT_CURR_SYMBOL
+ | T_CURRENCY_SYMBOL
+ | T_MON_DECIMAL_POINT
+ | T_MON_THOUSANDS_SEP
+ | T_POSITIVE_SIGN
+ | T_NEGATIVE_SIGN
+ ;
+
+monetary_numkw : T_INT_FRAC_DIGITS
+ | T_FRAC_DIGITS
+ | T_P_CS_PRECEDES
+ | T_P_SEP_BY_SPACE
+ | T_N_CS_PRECEDES
+ | T_N_SEP_BY_SPACE
+ | T_P_SIGN_POSN
+ | T_N_SIGN_POSN
+ | T_INT_P_CS_PRECEDES
+ | T_INT_N_CS_PRECEDES
+ | T_INT_P_SEP_BY_SPACE
+ | T_INT_N_SEP_BY_SPACE
+ | T_INT_P_SIGN_POSN
+ | T_INT_N_SIGN_POSN
+ ;
+
+monetary_kw : monetary_strkw string T_NL
+ {
+ add_monetary_str(get_wcs());
+ }
+ | monetary_numkw T_NUMBER T_NL
+ {
+ add_monetary_num($2);
+ }
+ | T_MON_GROUPING mon_group_list T_NL
+ ;
+
+mon_group_list : T_NUMBER
+ {
+ reset_monetary_group();
+ add_monetary_group($1);
+ }
+ | mon_group_list T_SEMI T_NUMBER
+ {
+ add_monetary_group($3);
+ }
+ ;
+
+
+numeric : T_NUMERIC T_NL numeric_list T_END T_NUMERIC T_NL
+ {
+ dump_numeric();
+ }
+ | T_NUMERIC T_NL copycat T_END T_NUMERIC T_NL
+ ;
+
+
+numeric_list : numeric_list numeric_item
+ | numeric_item
+ ;
+
+
+numeric_item : numeric_strkw string T_NL
+ {
+ add_numeric_str(get_wcs());
+ }
+ | T_GROUPING group_list T_NL
+ ;
+
+numeric_strkw : T_DECIMAL_POINT
+ | T_THOUSANDS_SEP
+ ;
+
+
+group_list : T_NUMBER
+ {
+ reset_numeric_group();
+ add_numeric_group($1);
+ }
+ | group_list T_SEMI T_NUMBER
+ {
+ add_numeric_group($3);
+ }
+ ;
+
+
+time : T_TIME T_NL time_kwlist T_END T_TIME T_NL
+ {
+ dump_time();
+ }
+ | T_TIME T_NL copycat T_END T_NUMERIC T_NL
+ ;
+
+time_kwlist : time_kwlist time_kw
+ | time_kw
+ ;
+
+time_kw : time_strkw string T_NL
+ {
+ add_time_str(get_wcs());
+ }
+ | time_listkw time_list T_NL
+ {
+ check_time_list();
+ }
+ ;
+
+time_listkw : T_ABDAY
+ | T_DAY
+ | T_ABMON
+ | T_MON
+ | T_ERA
+ | T_ALT_DIGITS
+ | T_AM_PM
+ ;
+
+time_strkw : T_ERA_D_T_FMT
+ | T_ERA_T_FMT
+ | T_ERA_D_FMT
+ | T_D_T_FMT
+ | T_D_FMT
+ | T_T_FMT
+ | T_T_FMT_AMPM
+ | T_DATE_FMT
+ ;
+
+time_list : time_list T_SEMI string
+ {
+ add_time_list(get_wcs());
+ }
+ | string
+ {
+ reset_time_list();
+ add_time_list(get_wcs());
+ }
+ ;
diff --git a/usr.bin/localedef/scanner.c b/usr.bin/localedef/scanner.c
new file mode 100644
index 0000000..fa62089
--- /dev/null
+++ b/usr.bin/localedef/scanner.c
@@ -0,0 +1,866 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * This file contains the "scanner", which tokenizes the input files
+ * for localedef for processing by the higher level grammar processor.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>
+#include <wchar.h>
+#include <sys/types.h>
+#include <assert.h>
+#include "localedef.h"
+#include "parser.h"
+
+int com_char = '#';
+int esc_char = '\\';
+int mb_cur_min = 1;
+int mb_cur_max = 1;
+int lineno = 1;
+int warnings = 0;
+int is_stdin = 1;
+FILE *input;
+static int nextline;
+//static FILE *input = stdin;
+static const char *filename = "<stdin>";
+static int instring = 0;
+static int escaped = 0;
+
+/*
+ * Token space ... grows on demand.
+ */
+static char *token = NULL;
+static int tokidx;
+static int toksz = 0;
+static int hadtok = 0;
+
+/*
+ * Wide string space ... grows on demand.
+ */
+static wchar_t *widestr = NULL;
+static int wideidx = 0;
+static int widesz = 0;
+
+/*
+ * The last keyword seen. This is useful to trigger the special lexer rules
+ * for "copy" and also collating symbols and elements.
+ */
+int last_kw = 0;
+static int category = T_END;
+
+static struct token {
+ int id;
+ const char *name;
+} keywords[] = {
+ { T_COM_CHAR, "comment_char" },
+ { T_ESC_CHAR, "escape_char" },
+ { T_END, "END" },
+ { T_COPY, "copy" },
+ { T_MESSAGES, "LC_MESSAGES" },
+ { T_YESSTR, "yesstr" },
+ { T_YESEXPR, "yesexpr" },
+ { T_NOSTR, "nostr" },
+ { T_NOEXPR, "noexpr" },
+ { T_MONETARY, "LC_MONETARY" },
+ { T_INT_CURR_SYMBOL, "int_curr_symbol" },
+ { T_CURRENCY_SYMBOL, "currency_symbol" },
+ { T_MON_DECIMAL_POINT, "mon_decimal_point" },
+ { T_MON_THOUSANDS_SEP, "mon_thousands_sep" },
+ { T_POSITIVE_SIGN, "positive_sign" },
+ { T_NEGATIVE_SIGN, "negative_sign" },
+ { T_MON_GROUPING, "mon_grouping" },
+ { T_INT_FRAC_DIGITS, "int_frac_digits" },
+ { T_FRAC_DIGITS, "frac_digits" },
+ { T_P_CS_PRECEDES, "p_cs_precedes" },
+ { T_P_SEP_BY_SPACE, "p_sep_by_space" },
+ { T_N_CS_PRECEDES, "n_cs_precedes" },
+ { T_N_SEP_BY_SPACE, "n_sep_by_space" },
+ { T_P_SIGN_POSN, "p_sign_posn" },
+ { T_N_SIGN_POSN, "n_sign_posn" },
+ { T_INT_P_CS_PRECEDES, "int_p_cs_precedes" },
+ { T_INT_N_CS_PRECEDES, "int_n_cs_precedes" },
+ { T_INT_P_SEP_BY_SPACE, "int_p_sep_by_space" },
+ { T_INT_N_SEP_BY_SPACE, "int_n_sep_by_space" },
+ { T_INT_P_SIGN_POSN, "int_p_sign_posn" },
+ { T_INT_N_SIGN_POSN, "int_n_sign_posn" },
+ { T_COLLATE, "LC_COLLATE" },
+ { T_COLLATING_SYMBOL, "collating-symbol" },
+ { T_COLLATING_ELEMENT, "collating-element" },
+ { T_FROM, "from" },
+ { T_ORDER_START, "order_start" },
+ { T_ORDER_END, "order_end" },
+ { T_FORWARD, "forward" },
+ { T_BACKWARD, "backward" },
+ { T_POSITION, "position" },
+ { T_IGNORE, "IGNORE" },
+ { T_UNDEFINED, "UNDEFINED" },
+ { T_NUMERIC, "LC_NUMERIC" },
+ { T_DECIMAL_POINT, "decimal_point" },
+ { T_THOUSANDS_SEP, "thousands_sep" },
+ { T_GROUPING, "grouping" },
+ { T_TIME, "LC_TIME" },
+ { T_ABDAY, "abday" },
+ { T_DAY, "day" },
+ { T_ABMON, "abmon" },
+ { T_MON, "mon" },
+ { T_D_T_FMT, "d_t_fmt" },
+ { T_D_FMT, "d_fmt" },
+ { T_T_FMT, "t_fmt" },
+ { T_AM_PM, "am_pm" },
+ { T_T_FMT_AMPM, "t_fmt_ampm" },
+ { T_ERA, "era" },
+ { T_ERA_D_FMT, "era_d_fmt" },
+ { T_ERA_T_FMT, "era_t_fmt" },
+ { T_ERA_D_T_FMT, "era_d_t_fmt" },
+ { T_ALT_DIGITS, "alt_digits" },
+ { T_CTYPE, "LC_CTYPE" },
+ { T_ISUPPER, "upper" },
+ { T_ISLOWER, "lower" },
+ { T_ISALPHA, "alpha" },
+ { T_ISDIGIT, "digit" },
+ { T_ISPUNCT, "punct" },
+ { T_ISXDIGIT, "xdigit" },
+ { T_ISSPACE, "space" },
+ { T_ISPRINT, "print" },
+ { T_ISGRAPH, "graph" },
+ { T_ISBLANK, "blank" },
+ { T_ISCNTRL, "cntrl" },
+ /*
+ * These entries are local additions, and not specified by
+ * TOG. Note that they are not guaranteed to be accurate for
+ * all locales, and so applications should not depend on them.
+ */
+ { T_ISSPECIAL, "special" },
+ { T_ISENGLISH, "english" },
+ { T_ISPHONOGRAM, "phonogram" },
+ { T_ISIDEOGRAM, "ideogram" },
+ { T_ISNUMBER, "number" },
+ /*
+ * We have to support this in the grammar, but it would be a
+ * syntax error to define a character as one of these without
+ * also defining it as an alpha or digit. We ignore it in our
+ * parsing.
+ */
+ { T_ISALNUM, "alnum" },
+ { T_TOUPPER, "toupper" },
+ { T_TOLOWER, "tolower" },
+
+ /*
+ * These are keywords used in the charmap file. Note that
+ * Solaris originally used angle brackets to wrap some of them,
+ * but we removed that to simplify our parser. The first of these
+ * items are "global items."
+ */
+ { T_CHARMAP, "CHARMAP" },
+ { T_WIDTH, "WIDTH" },
+
+ { -1, NULL },
+};
+
+/*
+ * These special words are only used in a charmap file, enclosed in <>.
+ */
+static struct token symwords[] = {
+ { T_COM_CHAR, "comment_char" },
+ { T_ESC_CHAR, "escape_char" },
+ { T_CODE_SET, "code_set_name" },
+ { T_MB_CUR_MAX, "mb_cur_max" },
+ { T_MB_CUR_MIN, "mb_cur_min" },
+ { -1, NULL },
+};
+
+static int categories[] = {
+ T_CHARMAP,
+ T_CTYPE,
+ T_COLLATE,
+ T_MESSAGES,
+ T_MONETARY,
+ T_NUMERIC,
+ T_TIME,
+ T_WIDTH,
+ 0
+};
+
+void
+reset_scanner(const char *fname)
+{
+ if (fname == NULL) {
+ filename = "<stdin>";
+ is_stdin = 1;
+ } else {
+ if (!is_stdin)
+ (void) fclose(input);
+ if ((input = fopen(fname, "r")) == NULL) {
+ perror("fopen");
+ exit(4);
+ } else {
+ is_stdin = 0;
+ }
+ filename = fname;
+ }
+ com_char = '#';
+ esc_char = '\\';
+ instring = 0;
+ escaped = 0;
+ lineno = 1;
+ nextline = 1;
+ tokidx = 0;
+ wideidx = 0;
+}
+
+#define hex(x) \
+ (isdigit(x) ? (x - '0') : ((islower(x) ? (x - 'a') : (x - 'A')) + 10))
+#define isodigit(x) ((x >= '0') && (x <= '7'))
+
+static int
+scanc(void)
+{
+ int c;
+
+ if (is_stdin)
+ c = getc(stdin);
+ else
+ c = getc(input);
+ lineno = nextline;
+ if (c == '\n') {
+ nextline++;
+ }
+ return (c);
+}
+
+static void
+unscanc(int c)
+{
+ if (c == '\n') {
+ nextline--;
+ }
+ if (ungetc(c, is_stdin ? stdin : input) < 0) {
+ yyerror("ungetc failed");
+ }
+}
+
+static int
+scan_hex_byte(void)
+{
+ int c1, c2;
+ int v;
+
+ c1 = scanc();
+ if (!isxdigit(c1)) {
+ yyerror("malformed hex digit");
+ return (0);
+ }
+ c2 = scanc();
+ if (!isxdigit(c2)) {
+ yyerror("malformed hex digit");
+ return (0);
+ }
+ v = ((hex(c1) << 4) | hex(c2));
+ return (v);
+}
+
+static int
+scan_dec_byte(void)
+{
+ int c1, c2, c3;
+ int b;
+
+ c1 = scanc();
+ if (!isdigit(c1)) {
+ yyerror("malformed decimal digit");
+ return (0);
+ }
+ b = c1 - '0';
+ c2 = scanc();
+ if (!isdigit(c2)) {
+ yyerror("malformed decimal digit");
+ return (0);
+ }
+ b *= 10;
+ b += (c2 - '0');
+ c3 = scanc();
+ if (!isdigit(c3)) {
+ unscanc(c3);
+ } else {
+ b *= 10;
+ b += (c3 - '0');
+ }
+ return (b);
+}
+
+static int
+scan_oct_byte(void)
+{
+ int c1, c2, c3;
+ int b;
+
+ b = 0;
+
+ c1 = scanc();
+ if (!isodigit(c1)) {
+ yyerror("malformed octal digit");
+ return (0);
+ }
+ b = c1 - '0';
+ c2 = scanc();
+ if (!isodigit(c2)) {
+ yyerror("malformed octal digit");
+ return (0);
+ }
+ b *= 8;
+ b += (c2 - '0');
+ c3 = scanc();
+ if (!isodigit(c3)) {
+ unscanc(c3);
+ } else {
+ b *= 8;
+ b += (c3 - '0');
+ }
+ return (b);
+}
+
+void
+add_tok(int c)
+{
+ if ((tokidx + 1) >= toksz) {
+ toksz += 64;
+ if ((token = realloc(token, toksz)) == NULL) {
+ yyerror("out of memory");
+ tokidx = 0;
+ toksz = 0;
+ return;
+ }
+ }
+
+ token[tokidx++] = (char)c;
+ token[tokidx] = 0;
+}
+void
+add_wcs(wchar_t c)
+{
+ if ((wideidx + 1) >= widesz) {
+ widesz += 64;
+ widestr = realloc(widestr, (widesz * sizeof (wchar_t)));
+ if (widestr == NULL) {
+ yyerror("out of memory");
+ wideidx = 0;
+ widesz = 0;
+ return;
+ }
+ }
+
+ widestr[wideidx++] = c;
+ widestr[wideidx] = 0;
+}
+
+wchar_t *
+get_wcs(void)
+{
+ wchar_t *ws = widestr;
+ wideidx = 0;
+ widestr = NULL;
+ widesz = 0;
+ if (ws == NULL) {
+ if ((ws = wcsdup(L"")) == NULL) {
+ yyerror("out of memory");
+ }
+ }
+ return (ws);
+}
+
+static int
+get_byte(void)
+{
+ int c;
+
+ if ((c = scanc()) != esc_char) {
+ unscanc(c);
+ return (EOF);
+ }
+ c = scanc();
+
+ switch (c) {
+ case 'd':
+ case 'D':
+ return (scan_dec_byte());
+ case 'x':
+ case 'X':
+ return (scan_hex_byte());
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ /* put the character back so we can get it */
+ unscanc(c);
+ return (scan_oct_byte());
+ default:
+ unscanc(c);
+ unscanc(esc_char);
+ return (EOF);
+ }
+}
+
+int
+get_escaped(int c)
+{
+ switch (c) {
+ case 'n':
+ return ('\n');
+ case 'r':
+ return ('\r');
+ case 't':
+ return ('\t');
+ case 'f':
+ return ('\f');
+ case 'v':
+ return ('\v');
+ case 'b':
+ return ('\b');
+ case 'a':
+ return ('\a');
+ default:
+ return (c);
+ }
+}
+
+int
+get_wide(void)
+{
+ static char mbs[MB_LEN_MAX + 1] = "";
+ static int mbi = 0;
+ int c;
+ wchar_t wc;
+
+ if (mb_cur_max >= (int)sizeof (mbs)) {
+ yyerror("max multibyte character size too big");
+ mbi = 0;
+ return (T_NULL);
+ }
+ for (;;) {
+ if ((mbi == mb_cur_max) || ((c = get_byte()) == EOF)) {
+ /*
+ * end of the byte sequence reached, but no
+ * valid wide decoding. fatal error.
+ */
+ mbi = 0;
+ yyerror("not a valid character encoding");
+ return (T_NULL);
+ }
+ mbs[mbi++] = c;
+ mbs[mbi] = 0;
+
+ /* does it decode? */
+ if (to_wide(&wc, mbs) >= 0) {
+ break;
+ }
+ }
+
+ mbi = 0;
+ if ((category != T_CHARMAP) && (category != T_WIDTH)) {
+ if (check_charmap(wc) < 0) {
+ yyerror("no symbolic name for character");
+ return (T_NULL);
+ }
+ }
+
+ yylval.wc = wc;
+ return (T_CHAR);
+}
+
+int
+get_symbol(void)
+{
+ int c;
+
+ while ((c = scanc()) != EOF) {
+ if (escaped) {
+ escaped = 0;
+ if (c == '\n')
+ continue;
+ add_tok(get_escaped(c));
+ continue;
+ }
+ if (c == esc_char) {
+ escaped = 1;
+ continue;
+ }
+ if (c == '\n') { /* well that's strange! */
+ yyerror("unterminated symbolic name");
+ continue;
+ }
+ if (c == '>') { /* end of symbol */
+
+ /*
+ * This restarts the token from the beginning
+ * the next time we scan a character. (This
+ * token is complete.)
+ */
+
+ if (token == NULL) {
+ yyerror("missing symbolic name");
+ return (T_NULL);
+ }
+ tokidx = 0;
+
+ /*
+ * A few symbols are handled as keywords outside
+ * of the normal categories.
+ */
+ if (category == T_END) {
+ int i;
+ for (i = 0; symwords[i].name != 0; i++) {
+ if (strcmp(token, symwords[i].name) ==
+ 0) {
+ last_kw = symwords[i].id;
+ return (last_kw);
+ }
+ }
+ }
+ /*
+ * Contextual rule: Only literal characters are
+ * permitted in CHARMAP. Anywhere else the symbolic
+ * forms are fine.
+ */
+ if ((category != T_CHARMAP) &&
+ (lookup_charmap(token, &yylval.wc)) != -1) {
+ return (T_CHAR);
+ }
+ if ((yylval.collsym = lookup_collsym(token)) != NULL) {
+ return (T_COLLSYM);
+ }
+ if ((yylval.collelem = lookup_collelem(token)) !=
+ NULL) {
+ return (T_COLLELEM);
+ }
+ /* its an undefined symbol */
+ yylval.token = strdup(token);
+ token = NULL;
+ toksz = 0;
+ tokidx = 0;
+ return (T_SYMBOL);
+ }
+ add_tok(c);
+ }
+
+ yyerror("unterminated symbolic name");
+ return (EOF);
+}
+
+int
+get_category(void)
+{
+ return (category);
+}
+
+static int
+consume_token(void)
+{
+ int len = tokidx;
+ int i;
+
+ tokidx = 0;
+ if (token == NULL)
+ return (T_NULL);
+
+ /*
+ * this one is special, because we don't want it to alter the
+ * last_kw field.
+ */
+ if (strcmp(token, "...") == 0) {
+ return (T_ELLIPSIS);
+ }
+
+ /* search for reserved words first */
+ for (i = 0; keywords[i].name; i++) {
+ int j;
+ if (strcmp(keywords[i].name, token) != 0) {
+ continue;
+ }
+
+ last_kw = keywords[i].id;
+
+ /* clear the top level category if we're done with it */
+ if (last_kw == T_END) {
+ category = T_END;
+ }
+
+ /* set the top level category if we're changing */
+ for (j = 0; categories[j]; j++) {
+ if (categories[j] != last_kw)
+ continue;
+ category = last_kw;
+ }
+
+ return (keywords[i].id);
+ }
+
+ /* maybe its a numeric constant? */
+ if (isdigit(*token) || (*token == '-' && isdigit(token[1]))) {
+ char *eptr;
+ yylval.num = strtol(token, &eptr, 10);
+ if (*eptr != 0)
+ yyerror("malformed number");
+ return (T_NUMBER);
+ }
+
+ /*
+ * A single lone character is treated as a character literal.
+ * To avoid duplication of effort, we stick in the charmap.
+ */
+ if (len == 1) {
+ yylval.wc = token[0];
+ return (T_CHAR);
+ }
+
+ /* anything else is treated as a symbolic name */
+ yylval.token = strdup(token);
+ token = NULL;
+ toksz = 0;
+ tokidx = 0;
+ return (T_NAME);
+}
+
+void
+scan_to_eol(void)
+{
+ int c;
+ while ((c = scanc()) != '\n') {
+ if (c == EOF) {
+ /* end of file without newline! */
+ errf("missing newline");
+ return;
+ }
+ }
+ assert(c == '\n');
+}
+
+int
+yylex(void)
+{
+ int c;
+
+ while ((c = scanc()) != EOF) {
+
+ /* special handling for quoted string */
+ if (instring) {
+ if (escaped) {
+ escaped = 0;
+
+ /* if newline, just eat and forget it */
+ if (c == '\n')
+ continue;
+
+ if (strchr("xXd01234567", c)) {
+ unscanc(c);
+ unscanc(esc_char);
+ return (get_wide());
+ }
+ yylval.wc = get_escaped(c);
+ return (T_CHAR);
+ }
+ if (c == esc_char) {
+ escaped = 1;
+ continue;
+ }
+ switch (c) {
+ case '<':
+ return (get_symbol());
+ case '>':
+ /* oops! should generate syntax error */
+ return (T_GT);
+ case '"':
+ instring = 0;
+ return (T_QUOTE);
+ default:
+ yylval.wc = c;
+ return (T_CHAR);
+ }
+ }
+
+ /* escaped characters first */
+ if (escaped) {
+ escaped = 0;
+ if (c == '\n') {
+ /* eat the newline */
+ continue;
+ }
+ hadtok = 1;
+ if (tokidx) {
+ /* an escape mid-token is nonsense */
+ return (T_NULL);
+ }
+
+ /* numeric escapes are treated as wide characters */
+ if (strchr("xXd01234567", c)) {
+ unscanc(c);
+ unscanc(esc_char);
+ return (get_wide());
+ }
+
+ add_tok(get_escaped(c));
+ continue;
+ }
+
+ /* if it is the escape charter itself note it */
+ if (c == esc_char) {
+ escaped = 1;
+ continue;
+ }
+
+ /* remove from the comment char to end of line */
+ if (c == com_char) {
+ while (c != '\n') {
+ if ((c = scanc()) == EOF) {
+ /* end of file without newline! */
+ return (EOF);
+ }
+ }
+ assert(c == '\n');
+ if (!hadtok) {
+ /*
+ * If there were no tokens on this line,
+ * then just pretend it didn't exist at all.
+ */
+ continue;
+ }
+ hadtok = 0;
+ return (T_NL);
+ }
+
+ if (strchr(" \t\n;()<>,\"", c) && (tokidx != 0)) {
+ /*
+ * These are all token delimiters. If there
+ * is a token already in progress, we need to
+ * process it.
+ */
+ unscanc(c);
+ return (consume_token());
+ }
+
+ switch (c) {
+ case '\n':
+ if (!hadtok) {
+ /*
+ * If the line was completely devoid of tokens,
+ * then just ignore it.
+ */
+ continue;
+ }
+ /* we're starting a new line, reset the token state */
+ hadtok = 0;
+ return (T_NL);
+ case ',':
+ hadtok = 1;
+ return (T_COMMA);
+ case ';':
+ hadtok = 1;
+ return (T_SEMI);
+ case '(':
+ hadtok = 1;
+ return (T_LPAREN);
+ case ')':
+ hadtok = 1;
+ return (T_RPAREN);
+ case '>':
+ hadtok = 1;
+ return (T_GT);
+ case '<':
+ /* symbol start! */
+ hadtok = 1;
+ return (get_symbol());
+ case ' ':
+ case '\t':
+ /* whitespace, just ignore it */
+ continue;
+ case '"':
+ hadtok = 1;
+ instring = 1;
+ return (T_QUOTE);
+ default:
+ hadtok = 1;
+ add_tok(c);
+ continue;
+ }
+ }
+ return (EOF);
+}
+
+void
+yyerror(const char *msg)
+{
+ (void) fprintf(stderr, "%s: %d: error: %s\n",
+ filename, lineno, msg);
+ exit(4);
+}
+
+void
+errf(const char *fmt, ...)
+{
+ char *msg;
+
+ va_list va;
+ va_start(va, fmt);
+ (void) vasprintf(&msg, fmt, va);
+ va_end(va);
+
+ (void) fprintf(stderr, "%s: %d: error: %s\n",
+ filename, lineno, msg);
+ free(msg);
+ exit(4);
+}
+
+void
+warn(const char *fmt, ...)
+{
+ char *msg;
+
+ va_list va;
+ va_start(va, fmt);
+ (void) vasprintf(&msg, fmt, va);
+ va_end(va);
+
+ (void) fprintf(stderr, "%s: %d: warning: %s\n",
+ filename, lineno, msg);
+ free(msg);
+ warnings++;
+ if (!warnok)
+ exit(4);
+}
diff --git a/usr.bin/localedef/time.c b/usr.bin/localedef/time.c
new file mode 100644
index 0000000..e40001d
--- /dev/null
+++ b/usr.bin/localedef/time.c
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * LC_TIME database generation routines for localedef.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include "localedef.h"
+#include "parser.h"
+#include "timelocal.h"
+
+struct lc_time_T tm;
+
+void
+init_time(void)
+{
+ (void) memset(&tm, 0, sizeof (tm));
+}
+
+void
+add_time_str(wchar_t *wcs)
+{
+ char *str;
+
+ if ((str = to_mb_string(wcs)) == NULL) {
+ INTERR;
+ return;
+ }
+ free(wcs);
+
+ switch (last_kw) {
+ case T_D_T_FMT:
+ tm.c_fmt = str;
+ break;
+ case T_D_FMT:
+ tm.x_fmt = str;
+ break;
+ case T_T_FMT:
+ tm.X_fmt = str;
+ break;
+ case T_T_FMT_AMPM:
+ tm.ampm_fmt = str;
+ break;
+ case T_DATE_FMT:
+ /*
+ * This one is a Solaris extension, Too bad date just
+ * doesn't use %c, which would be simpler.
+ */
+ tm.date_fmt = str;
+ break;
+ case T_ERA_D_FMT:
+ case T_ERA_T_FMT:
+ case T_ERA_D_T_FMT:
+ /* Silently ignore it. */
+ free(str);
+ break;
+ default:
+ free(str);
+ INTERR;
+ break;
+ }
+}
+
+static void
+add_list(const char *ptr[], char *str, int limit)
+{
+ int i;
+ for (i = 0; i < limit; i++) {
+ if (ptr[i] == NULL) {
+ ptr[i] = str;
+ return;
+ }
+ }
+ fprintf(stderr,"too many list elements");
+}
+
+void
+add_time_list(wchar_t *wcs)
+{
+ char *str;
+
+ if ((str = to_mb_string(wcs)) == NULL) {
+ INTERR;
+ return;
+ }
+ free(wcs);
+
+ switch (last_kw) {
+ case T_ABMON:
+ add_list(tm.mon, str, 12);
+ break;
+ case T_MON:
+ add_list(tm.month, str, 12);
+ break;
+ case T_ABDAY:
+ add_list(tm.wday, str, 7);
+ break;
+ case T_DAY:
+ add_list(tm.weekday, str, 7);
+ break;
+ case T_AM_PM:
+ if (tm.am == NULL) {
+ tm.am = str;
+ } else if (tm.pm == NULL) {
+ tm.pm = str;
+ } else {
+ fprintf(stderr,"too many list elements");
+ free(str);
+ }
+ break;
+ case T_ALT_DIGITS:
+ case T_ERA:
+ free(str);
+ break;
+ default:
+ free(str);
+ INTERR;
+ break;
+ }
+}
+
+void
+check_time_list(void)
+{
+ switch (last_kw) {
+ case T_ABMON:
+ if (tm.mon[11] != NULL)
+ return;
+ break;
+ case T_MON:
+ if (tm.month[11] != NULL)
+ return;
+ break;
+ case T_ABDAY:
+ if (tm.wday[6] != NULL)
+ return;
+ break;
+ case T_DAY:
+ if (tm.weekday[6] != NULL)
+ return;
+ break;
+ case T_AM_PM:
+ if (tm.pm != NULL)
+ return;
+ break;
+ case T_ERA:
+ case T_ALT_DIGITS:
+ return;
+ default:
+ fprintf(stderr,"unknown list");
+ break;
+ }
+
+ fprintf(stderr,"too few items in list (%d)", last_kw);
+}
+
+void
+reset_time_list(void)
+{
+ int i;
+ switch (last_kw) {
+ case T_ABMON:
+ for (i = 0; i < 12; i++) {
+ free((char *)tm.mon[i]);
+ tm.mon[i] = NULL;
+ }
+ break;
+ case T_MON:
+ for (i = 0; i < 12; i++) {
+ free((char *)tm.month[i]);
+ tm.month[i] = NULL;
+ }
+ break;
+ case T_ABDAY:
+ for (i = 0; i < 7; i++) {
+ free((char *)tm.wday[i]);
+ tm.wday[i] = NULL;
+ }
+ break;
+ case T_DAY:
+ for (i = 0; i < 7; i++) {
+ free((char *)tm.weekday[i]);
+ tm.weekday[i] = NULL;
+ }
+ break;
+ case T_AM_PM:
+ free((char *)tm.am);
+ tm.am = NULL;
+ free((char *)tm.pm);
+ tm.pm = NULL;
+ break;
+ }
+}
+
+void
+dump_time(void)
+{
+ FILE *f;
+ int i;
+
+ if ((f = open_category()) == NULL) {
+ return;
+ }
+
+ for (i = 0; i < 12; i++) {
+ if (putl_category(tm.mon[i], f) == EOF) {
+ return;
+ }
+ }
+ for (i = 0; i < 12; i++) {
+ if (putl_category(tm.month[i], f) == EOF) {
+ return;
+ }
+ }
+ for (i = 0; i < 7; i++) {
+ if (putl_category(tm.wday[i], f) == EOF) {
+ return;
+ }
+ }
+ for (i = 0; i < 7; i++) {
+ if (putl_category(tm.weekday[i], f) == EOF) {
+ return;
+ }
+ }
+
+ /*
+ * NOTE: If date_fmt is not specified, then we'll default to
+ * using the %c for date. This is reasonable for most
+ * locales, although for reasons that I don't understand
+ * Solaris historically has had a separate format for date.
+ */
+ if ((putl_category(tm.X_fmt, f) == EOF) ||
+ (putl_category(tm.x_fmt, f) == EOF) ||
+ (putl_category(tm.c_fmt, f) == EOF) ||
+ (putl_category(tm.am, f) == EOF) ||
+ (putl_category(tm.pm, f) == EOF) ||
+ (putl_category(tm.date_fmt ? tm.date_fmt : tm.c_fmt, f) == EOF) ||
+ (putl_category(tm.ampm_fmt, f) == EOF)) {
+ return;
+ }
+ close_category(f);
+}
diff --git a/usr.bin/localedef/wide.c b/usr.bin/localedef/wide.c
new file mode 100644
index 0000000..9d898fd
--- /dev/null
+++ b/usr.bin/localedef/wide.c
@@ -0,0 +1,666 @@
+/*
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 Garrett D'Amore <garrett@damore.org> All rights reserved.
+ * Copyright 2015 John Marino <draco@marino.st>
+ *
+ * This source code is derived from the illumos localedef command, and
+ * provided under BSD-style license terms by Nexenta Systems, Inc.
+ *
+ * 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 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.
+ */
+
+/*
+ * The functions in this file convert from the standard multibyte forms
+ * to the wide character forms used internally by libc. Unfortunately,
+ * this approach means that we need a method for each and every encoding.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <string.h>
+#include <sys/types.h>
+#include "localedef.h"
+
+static int towide_none(wchar_t *, const char *, unsigned);
+static int towide_utf8(wchar_t *, const char *, unsigned);
+static int towide_big5(wchar_t *, const char *, unsigned);
+static int towide_gbk(wchar_t *, const char *, unsigned);
+static int towide_gb2312(wchar_t *, const char *, unsigned);
+static int towide_gb18030(wchar_t *, const char *, unsigned);
+static int towide_mskanji(wchar_t *, const char *, unsigned);
+static int towide_euccn(wchar_t *, const char *, unsigned);
+static int towide_eucjp(wchar_t *, const char *, unsigned);
+static int towide_euckr(wchar_t *, const char *, unsigned);
+static int towide_euctw(wchar_t *, const char *, unsigned);
+
+static int tomb_none(char *, wchar_t);
+static int tomb_utf8(char *, wchar_t);
+static int tomb_mbs(char *, wchar_t);
+
+static int (*_towide)(wchar_t *, const char *, unsigned) = towide_none;
+static int (*_tomb)(char *, wchar_t) = tomb_none;
+static char _encoding_buffer[20] = {'N','O','N','E'};
+static const char *_encoding = _encoding_buffer;
+static int _nbits = 7;
+
+/*
+ * Table of supported encodings. We only bother to list the multibyte
+ * encodings here, because single byte locales are handed by "NONE".
+ */
+static struct {
+ const char *name;
+ /* the name that the underlying libc implemenation uses */
+ const char *cname;
+ /* the maximum number of bits required for priorities */
+ int nbits;
+ int (*towide)(wchar_t *, const char *, unsigned);
+ int (*tomb)(char *, wchar_t);
+} mb_encodings[] = {
+ /*
+ * UTF8 values max out at 0x1fffff (although in theory there could
+ * be later extensions, but it won't happen.) This means we only need
+ * 21 bits to be able to encode the entire range of priorities.
+ */
+ { "UTF-8", "UTF-8", 21, towide_utf8, tomb_utf8 },
+ { "UTF8", "UTF-8", 21, towide_utf8, tomb_utf8 },
+ { "utf8", "UTF-8", 21, towide_utf8, tomb_utf8 },
+ { "utf-8", "UTF-8", 21, towide_utf8, tomb_utf8 },
+
+ { "EUC-CN", "EUC-CN", 16, towide_euccn, tomb_mbs },
+ { "eucCN", "EUC-CN", 16, towide_euccn, tomb_mbs },
+ /*
+ * Because the 3-byte form of EUC-JP use the same leading byte,
+ * only 17 bits required to provide unique priorities. (The low
+ * bit of that first byte is set.) By setting this value low,
+ * we can get by with only 3 bytes in the strxfrm expansion.
+ */
+ { "EUC-JP", "EUC-JP", 17, towide_eucjp, tomb_mbs },
+ { "eucJP", "EUC-JP", 17, towide_eucjp, tomb_mbs },
+
+ { "EUC-KR", "EUC-KR", 16, towide_euckr, tomb_mbs },
+ { "eucKR", "EUC-KR", 16, towide_euckr, tomb_mbs },
+ /*
+ * EUC-TW uses 2 bytes most of the time, but 4 bytes if the
+ * high order byte is 0x8E. However, with 4 byte encodings,
+ * the third byte will be A0-B0. So we only need to consider
+ * the lower order 24 bits for collation.
+ */
+ { "EUC-TW", "EUC-TW", 24, towide_euctw, tomb_mbs },
+ { "eucTW", "EUC-TW", 24, towide_euctw, tomb_mbs },
+
+ { "MS_Kanji", "MSKanji", 16, towide_mskanji, tomb_mbs },
+ { "MSKanji", "MSKanji", 16, towide_mskanji, tomb_mbs },
+ { "PCK", "MSKanji", 16, towide_mskanji, tomb_mbs },
+ { "SJIS", "MSKanji", 16, towide_mskanji, tomb_mbs },
+ { "Shift_JIS", "MSKanji", 16, towide_mskanji, tomb_mbs },
+
+ { "BIG5", "BIG5", 16, towide_big5, tomb_mbs },
+ { "big5", "BIG5", 16, towide_big5, tomb_mbs },
+ { "Big5", "BIG5", 16, towide_big5, tomb_mbs },
+
+ { "GBK", "GBK", 16, towide_gbk, tomb_mbs },
+
+ /*
+ * GB18030 can get away with just 31 bits. This is because the
+ * high order bit is always set for 4 byte values, and the
+ * at least one of the other bits in that 4 byte value will
+ * be non-zero.
+ */
+ { "GB18030", "GB18030", 31, towide_gb18030, tomb_mbs },
+
+ /*
+ * This should probably be an aliase for euc-cn, or vice versa.
+ */
+ { "GB2312", "GB2312", 16, towide_gb2312, tomb_mbs },
+
+ { NULL, NULL, 0, 0, 0 },
+};
+
+static char *
+show_mb(const char *mb)
+{
+ static char buf[64];
+
+ /* ASCII stuff we just print */
+ if (isascii(*mb) && isgraph(*mb)) {
+ buf[0] = *mb;
+ buf[1] = 0;
+ return (buf);
+ }
+ buf[0] = 0;
+ while (*mb != 0) {
+ char scr[8];
+ (void) snprintf(scr, sizeof (scr), "\\x%02x", *mb);
+ (void) strlcat(buf, scr, sizeof (buf));
+ mb++;
+ }
+ return (buf);
+}
+
+static char *widemsg;
+
+void
+werr(const char *fmt, ...)
+{
+ char *msg;
+
+ va_list va;
+ va_start(va, fmt);
+ (void) vasprintf(&msg, fmt, va);
+ va_end(va);
+
+ free(widemsg);
+ widemsg = msg;
+}
+
+/*
+ * This is used for 8-bit encodings.
+ */
+int
+towide_none(wchar_t *c, const char *mb, unsigned n __unused)
+{
+ if (mb_cur_max != 1) {
+ werr("invalid or unsupported multibyte locale");
+ return (-1);
+ }
+ *c = (uint8_t)*mb;
+ return (1);
+}
+
+int
+tomb_none(char *mb, wchar_t wc)
+{
+ if (mb_cur_max != 1) {
+ werr("invalid or unsupported multibyte locale");
+ return (-1);
+ }
+ *(uint8_t *)mb = (wc & 0xff);
+ mb[1] = 0;
+ return (1);
+}
+
+/*
+ * UTF-8 stores wide characters in UTF-32 form.
+ */
+int
+towide_utf8(wchar_t *wc, const char *mb, unsigned n)
+{
+ wchar_t c;
+ int nb;
+ wchar_t lv; /* lowest legal value */
+ int i;
+ const uint8_t *s = (const uint8_t *)mb;
+
+ c = *s;
+
+ if ((c & 0x80) == 0) {
+ /* 7-bit ASCII */
+ *wc = c;
+ return (1);
+ } else if ((c & 0xe0) == 0xc0) {
+ /* u80-u7ff - two bytes encoded */
+ nb = 2;
+ lv = 0x80;
+ c &= ~0xe0;
+ } else if ((c & 0xf0) == 0xe0) {
+ /* u800-uffff - three bytes encoded */
+ nb = 3;
+ lv = 0x800;
+ c &= ~0xf0;
+ } else if ((c & 0xf8) == 0xf0) {
+ /* u1000-u1fffff - four bytes encoded */
+ nb = 4;
+ lv = 0x1000;
+ c &= ~0xf8;
+ } else {
+ /* 5 and 6 byte encodings are not legal unicode */
+ werr("utf8 encoding too large (%s)", show_mb(mb));
+ return (-1);
+ }
+ if (nb > (int)n) {
+ werr("incomplete utf8 sequence (%s)", show_mb(mb));
+ return (-1);
+ }
+
+ for (i = 1; i < nb; i++) {
+ if (((s[i]) & 0xc0) != 0x80) {
+ werr("illegal utf8 byte (%x)", s[i]);
+ return (-1);
+ }
+ c <<= 6;
+ c |= (s[i] & 0x3f);
+ }
+
+ if (c < lv) {
+ werr("illegal redundant utf8 encoding (%s)", show_mb(mb));
+ return (-1);
+ }
+ *wc = c;
+ return (nb);
+}
+
+int
+tomb_utf8(char *mb, wchar_t wc)
+{
+ uint8_t *s = (uint8_t *)mb;
+ uint8_t msk;
+ int cnt;
+ int i;
+
+ if (wc <= 0x7f) {
+ s[0] = wc & 0x7f;
+ s[1] = 0;
+ return (1);
+ }
+ if (wc <= 0x7ff) {
+ cnt = 2;
+ msk = 0xc0;
+ } else if (wc <= 0xffff) {
+ cnt = 3;
+ msk = 0xe0;
+ } else if (wc <= 0x1fffff) {
+ cnt = 4;
+ msk = 0xf0;
+ } else {
+ werr("illegal uf8 char (%x)", wc);
+ return (-1);
+ }
+ for (i = cnt - 1; i; i--) {
+ s[i] = (wc & 0x3f) | 0x80;
+ wc >>= 6;
+ }
+ s[0] = (msk) | wc;
+ s[cnt] = 0;
+ return (cnt);
+}
+
+/*
+ * Several encodings share a simplistic dual byte encoding. In these
+ * forms, they all indicate that a two byte sequence is to be used if
+ * the first byte has its high bit set. They all store this simple
+ * encoding as a 16-bit value, although a great many of the possible
+ * code points are not used in most character sets. This gives a possible
+ * set of just over 32,000 valid code points.
+ *
+ * 0x00 - 0x7f - 1 byte encoding
+ * 0x80 - 0x7fff - illegal
+ * 0x8000 - 0xffff - 2 byte encoding
+ */
+
+static int
+towide_dbcs(wchar_t *wc, const char *mb, unsigned n)
+{
+ wchar_t c;
+
+ c = *(const uint8_t *)mb;
+
+ if ((c & 0x80) == 0) {
+ /* 7-bit */
+ *wc = c;
+ return (1);
+ }
+ if (n < 2) {
+ werr("incomplete character sequence (%s)", show_mb(mb));
+ return (-1);
+ }
+
+ /* Store both bytes as a single 16-bit wide. */
+ c <<= 8;
+ c |= (uint8_t)(mb[1]);
+ *wc = c;
+ return (2);
+}
+
+/*
+ * Most multibyte locales just convert the wide character to the multibyte
+ * form by stripping leading null bytes, and writing the 32-bit quantity
+ * in big-endian order.
+ */
+int
+tomb_mbs(char *mb, wchar_t wc)
+{
+ uint8_t *s = (uint8_t *)mb;
+ int n = 0, c;
+
+ if ((wc & 0xff000000U) != 0) {
+ n = 4;
+ } else if ((wc & 0x00ff0000U) != 0) {
+ n = 3;
+ } else if ((wc & 0x0000ff00U) != 0) {
+ n = 2;
+ } else {
+ n = 1;
+ }
+ c = n;
+ while (n) {
+ n--;
+ s[n] = wc & 0xff;
+ wc >>= 8;
+ }
+ /* ensure null termination */
+ s[c] = 0;
+ return (c);
+}
+
+
+/*
+ * big5 is a simple dual byte character set.
+ */
+int
+towide_big5(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_dbcs(wc, mb, n));
+}
+
+/*
+ * GBK encodes wides in the same way that big5 does, the high order
+ * bit of the first byte indicates a double byte character.
+ */
+int
+towide_gbk(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_dbcs(wc, mb, n));
+}
+
+/*
+ * GB2312 is another DBCS. Its cleaner than others in that the second
+ * byte does not encode ASCII, but it supports characters.
+ */
+int
+towide_gb2312(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_dbcs(wc, mb, n));
+}
+
+/*
+ * GB18030. This encodes as 8, 16, or 32-bits.
+ * 7-bit values are in 1 byte, 4 byte sequences are used when
+ * the second byte encodes 0x30-39 and all other sequences are 2 bytes.
+ */
+int
+towide_gb18030(wchar_t *wc, const char *mb, unsigned n)
+{
+ wchar_t c;
+
+ c = *(const uint8_t *)mb;
+
+ if ((c & 0x80) == 0) {
+ /* 7-bit */
+ *wc = c;
+ return (1);
+ }
+ if (n < 2) {
+ werr("incomplete character sequence (%s)", show_mb(mb));
+ return (-1);
+ }
+
+ /* pull in the second byte */
+ c <<= 8;
+ c |= (uint8_t)(mb[1]);
+
+ if (((c & 0xff) >= 0x30) && ((c & 0xff) <= 0x39)) {
+ if (n < 4) {
+ werr("incomplete 4-byte character sequence (%s)",
+ show_mb(mb));
+ return (-1);
+ }
+ c <<= 8;
+ c |= (uint8_t)(mb[2]);
+ c <<= 8;
+ c |= (uint8_t)(mb[3]);
+ *wc = c;
+ return (4);
+ }
+
+ *wc = c;
+ return (2);
+}
+
+/*
+ * MS-Kanji (aka SJIS) is almost a clean DBCS like the others, but it
+ * also has a range of single byte characters above 0x80. (0xa1-0xdf).
+ */
+int
+towide_mskanji(wchar_t *wc, const char *mb, unsigned n)
+{
+ wchar_t c;
+
+ c = *(const uint8_t *)mb;
+
+ if ((c < 0x80) || ((c > 0xa0) && (c < 0xe0))) {
+ /* 7-bit */
+ *wc = c;
+ return (1);
+ }
+
+ if (n < 2) {
+ werr("incomplete character sequence (%s)", show_mb(mb));
+ return (-1);
+ }
+
+ /* Store both bytes as a single 16-bit wide. */
+ c <<= 8;
+ c |= (uint8_t)(mb[1]);
+ *wc = c;
+ return (2);
+}
+
+/*
+ * EUC forms. EUC encodings are "variable". FreeBSD carries some additional
+ * variable data to encode these, but we're going to treat each as independent
+ * instead. Its the only way we can sensibly move forward.
+ *
+ * Note that the way in which the different EUC forms vary is how wide
+ * CS2 and CS3 are and what the first byte of them is.
+ */
+static int
+towide_euc_impl(wchar_t *wc, const char *mb, unsigned n,
+ uint8_t cs2, uint8_t cs2width, uint8_t cs3, uint8_t cs3width)
+{
+ int i;
+ int width = 2;
+ wchar_t c;
+
+ c = *(const uint8_t *)mb;
+
+ /*
+ * All variations of EUC encode 7-bit ASCII as one byte, and use
+ * additional bytes for more than that.
+ */
+ if ((c & 0x80) == 0) {
+ /* 7-bit */
+ *wc = c;
+ return (1);
+ }
+
+ /*
+ * All EUC variants reserve 0xa1-0xff to identify CS1, which
+ * is always two bytes wide. Note that unused CS will be zero,
+ * and that cannot be true because we know that the high order
+ * bit must be set.
+ */
+ if (c >= 0xa1) {
+ width = 2;
+ } else if (c == cs2) {
+ width = cs2width;
+ } else if (c == cs3) {
+ width = cs3width;
+ }
+
+ if ((int)n < width) {
+ werr("incomplete character sequence (%s)", show_mb(mb));
+ return (-1);
+ }
+
+ for (i = 1; i < width; i++) {
+ /* pull in the next byte */
+ c <<= 8;
+ c |= (uint8_t)(mb[i]);
+ }
+
+ *wc = c;
+ return (width);
+}
+
+/*
+ * EUC-CN encodes as follows:
+ *
+ * Code set 0 (ASCII): 0x21-0x7E
+ * Code set 1 (CNS 11643-1992 Plane 1): 0xA1A1-0xFEFE
+ * Code set 2: unused
+ * Code set 3: unused
+ */
+int
+towide_euccn(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_euc_impl(wc, mb, n, 0x8e, 4, 0, 0));
+}
+
+/*
+ * EUC-JP encodes as follows:
+ *
+ * Code set 0 (ASCII or JIS X 0201-1976 Roman): 0x21-0x7E
+ * Code set 1 (JIS X 0208): 0xA1A1-0xFEFE
+ * Code set 2 (half-width katakana): 0x8EA1-0x8EDF
+ * Code set 3 (JIS X 0212-1990): 0x8FA1A1-0x8FFEFE
+ */
+int
+towide_eucjp(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_euc_impl(wc, mb, n, 0x8e, 2, 0x8f, 3));
+}
+
+/*
+ * EUC-KR encodes as follows:
+ *
+ * Code set 0 (ASCII or KS C 5636-1993): 0x21-0x7E
+ * Code set 1 (KS C 5601-1992): 0xA1A1-0xFEFE
+ * Code set 2: unused
+ * Code set 3: unused
+ */
+int
+towide_euckr(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_euc_impl(wc, mb, n, 0, 0, 0, 0));
+}
+
+/*
+ * EUC-TW encodes as follows:
+ *
+ * Code set 0 (ASCII): 0x21-0x7E
+ * Code set 1 (CNS 11643-1992 Plane 1): 0xA1A1-0xFEFE
+ * Code set 2 (CNS 11643-1992 Planes 1-16): 0x8EA1A1A1-0x8EB0FEFE
+ * Code set 3: unused
+ */
+int
+towide_euctw(wchar_t *wc, const char *mb, unsigned n)
+{
+ return (towide_euc_impl(wc, mb, n, 0x8e, 4, 0, 0));
+}
+
+/*
+ * Public entry points.
+ */
+
+int
+to_wide(wchar_t *wc, const char *mb)
+{
+ /* this won't fail hard */
+ return (_towide(wc, mb, strlen(mb)));
+}
+
+int
+to_mb(char *mb, wchar_t wc)
+{
+ int rv;
+
+ if ((rv = _tomb(mb, wc)) < 0) {
+ errf(widemsg);
+ free(widemsg);
+ widemsg = NULL;
+ }
+ return (rv);
+}
+
+char *
+to_mb_string(const wchar_t *wcs)
+{
+ char *mbs;
+ char *ptr;
+ int len;
+
+ mbs = malloc((wcslen(wcs) * mb_cur_max) + 1);
+ if (mbs == NULL) {
+ errf("out of memory");
+ return (NULL);
+ }
+ ptr = mbs;
+ while (*wcs) {
+ if ((len = to_mb(ptr, *wcs)) < 0) {
+ INTERR;
+ free(mbs);
+ return (NULL);
+ }
+ wcs++;
+ ptr += len;
+ }
+ *ptr = 0;
+ return (mbs);
+}
+
+void
+set_wide_encoding(const char *encoding)
+{
+ int i;
+
+ _towide = towide_none;
+ _tomb = tomb_none;
+ _nbits = 8;
+
+ snprintf(_encoding_buffer, sizeof(_encoding_buffer), "NONE:%s",
+ encoding);
+ for (i = 0; mb_encodings[i].name; i++) {
+ if (strcasecmp(encoding, mb_encodings[i].name) == 0) {
+ _towide = mb_encodings[i].towide;
+ _tomb = mb_encodings[i].tomb;
+ _encoding = mb_encodings[i].cname;
+ _nbits = mb_encodings[i].nbits;
+ break;
+ }
+ }
+}
+
+const char *
+get_wide_encoding(void)
+{
+ return (_encoding);
+}
+
+int
+max_wide(void)
+{
+ return ((int)((1U << _nbits) - 1));
+}
diff --git a/usr.bin/locate/Makefile b/usr.bin/locate/Makefile
new file mode 100644
index 0000000..05b1358
--- /dev/null
+++ b/usr.bin/locate/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+
+SUBDIR= bigram code locate
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/locate/Makefile.inc b/usr.bin/locate/Makefile.inc
new file mode 100644
index 0000000..5ce397d
--- /dev/null
+++ b/usr.bin/locate/Makefile.inc
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+LIBEXECDIR?= /usr/libexec
+
+WARNS?= 0
diff --git a/usr.bin/locate/bigram/Makefile b/usr.bin/locate/bigram/Makefile
new file mode 100644
index 0000000..0591c4d
--- /dev/null
+++ b/usr.bin/locate/bigram/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= locate.bigram
+MAN=
+BINDIR= ${LIBEXECDIR}
+CFLAGS+= -I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/locate/bigram/Makefile.depend b/usr.bin/locate/bigram/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/locate/bigram/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/locate/bigram/locate.bigram.c b/usr.bin/locate/bigram/locate.bigram.c
new file mode 100644
index 0000000..6fa2d31
--- /dev/null
+++ b/usr.bin/locate/bigram/locate.bigram.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#if 0
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)locate.bigram.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+/*
+ * bigram < sorted_file_names | sort -nr |
+ * awk 'NR <= 128 { printf $2 }' > bigrams
+ *
+ * List bigrams for 'updatedb' script.
+ * Use 'code' to encode a file using this output.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h> /* for MAXPATHLEN */
+#include "locate.h"
+
+u_char buf1[MAXPATHLEN] = " ";
+u_char buf2[MAXPATHLEN];
+u_int bigram[UCHAR_MAX + 1][UCHAR_MAX + 1];
+
+int
+main(void)
+{
+ u_char *cp;
+ u_char *oldpath = buf1, *path = buf2;
+ u_int i, j;
+
+ while (fgets(path, sizeof(buf2), stdin) != NULL) {
+
+ /*
+ * We don't need remove newline character '\n'.
+ * '\n' is less than ASCII_MIN and will be later
+ * ignored at output.
+ */
+
+
+ /* skip longest common prefix */
+ for (cp = path; *cp == *oldpath; cp++, oldpath++)
+ if (*cp == '\0')
+ break;
+
+ while (*cp != '\0' && *(cp + 1) != '\0') {
+ bigram[(u_char)*cp][(u_char)*(cp + 1)]++;
+ cp += 2;
+ }
+
+ /* swap pointers */
+ if (path == buf1) {
+ path = buf2;
+ oldpath = buf1;
+ } else {
+ path = buf1;
+ oldpath = buf2;
+ }
+ }
+
+ /* output, boundary check */
+ for (i = ASCII_MIN; i <= ASCII_MAX; i++)
+ for (j = ASCII_MIN; j <= ASCII_MAX; j++)
+ if (bigram[i][j] != 0)
+ (void)printf("%4u %c%c\n", bigram[i][j], i, j);
+
+ exit(0);
+}
diff --git a/usr.bin/locate/code/Makefile b/usr.bin/locate/code/Makefile
new file mode 100644
index 0000000..dc2075f
--- /dev/null
+++ b/usr.bin/locate/code/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= locate.code
+CFLAGS+=-I${.CURDIR}/../locate
+MAN=
+BINDIR= ${LIBEXECDIR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/locate/code/Makefile.depend b/usr.bin/locate/code/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/locate/code/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/locate/code/locate.code.c b/usr.bin/locate/code/locate.code.c
new file mode 100644
index 0000000..9a87c16
--- /dev/null
+++ b/usr.bin/locate/code/locate.code.c
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#if 0
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)locate.code.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+/*
+ * PURPOSE: sorted list compressor (works with a modified 'find'
+ * to encode/decode a filename database)
+ *
+ * USAGE: bigram < list > bigrams
+ * process bigrams (see updatedb) > common_bigrams
+ * code common_bigrams < list > squozen_list
+ *
+ * METHOD: Uses 'front compression' (see ";login:", Volume 8, Number 1
+ * February/March 1983, p. 8). Output format is, per line, an
+ * offset differential count byte followed by a partially bigram-
+ * encoded ascii residue. A bigram is a two-character sequence,
+ * the first 128 most common of which are encoded in one byte.
+ *
+ * EXAMPLE: For simple front compression with no bigram encoding,
+ * if the input is... then the output is...
+ *
+ * /usr/src 0 /usr/src
+ * /usr/src/cmd/aardvark.c 8 /cmd/aardvark.c
+ * /usr/src/cmd/armadillo.c 14 armadillo.c
+ * /usr/tmp/zoo 5 tmp/zoo
+ *
+ * The codes are:
+ *
+ * 0-28 likeliest differential counts + offset to make nonnegative
+ * 30 switch code for out-of-range count to follow in next word
+ * 31 an 8 bit char followed
+ * 128-255 bigram codes (128 most common, as determined by 'updatedb')
+ * 32-127 single character (printable) ascii residue (ie, literal)
+ *
+ * The locate database store any character except newline ('\n')
+ * and NUL ('\0'). The 8-bit character support don't wast extra
+ * space until you have characters in file names less than 32
+ * or greather than 127.
+ *
+ *
+ * SEE ALSO: updatedb.sh, ../bigram/locate.bigram.c
+ *
+ * AUTHOR: James A. Woods, Informatics General Corp.,
+ * NASA Ames Research Center, 10/82
+ * 8-bit file names characters:
+ * Wolfram Schneider, Berlin September 1996
+ */
+
+#include <sys/param.h>
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "locate.h"
+
+#define BGBUFSIZE (NBG * 2) /* size of bigram buffer */
+
+u_char buf1[MAXPATHLEN] = " ";
+u_char buf2[MAXPATHLEN];
+u_char bigrams[BGBUFSIZE + 1] = { 0 };
+
+#define LOOKUP 1 /* use a lookup array instead a function, 3x faster */
+
+#ifdef LOOKUP
+#define BGINDEX(x) (big[(u_char)*x][(u_char)*(x + 1)])
+typedef short bg_t;
+bg_t big[UCHAR_MAX + 1][UCHAR_MAX + 1];
+#else
+#define BGINDEX(x) bgindex(x)
+typedef int bg_t;
+int bgindex(char *);
+#endif /* LOOKUP */
+
+
+void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ u_char *cp, *oldpath, *path;
+ int ch, code, count, diffcount, oldcount;
+ u_int i, j;
+ FILE *fp;
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1)
+ usage();
+
+ if ((fp = fopen(argv[0], "r")) == NULL)
+ err(1, "%s", argv[0]);
+
+ /* First copy bigram array to stdout. */
+ (void)fgets(bigrams, BGBUFSIZE + 1, fp);
+
+ if (fwrite(bigrams, 1, BGBUFSIZE, stdout) != BGBUFSIZE)
+ err(1, "stdout");
+ (void)fclose(fp);
+
+#ifdef LOOKUP
+ /* init lookup table */
+ for (i = 0; i < UCHAR_MAX + 1; i++)
+ for (j = 0; j < UCHAR_MAX + 1; j++)
+ big[i][j] = (bg_t)-1;
+
+ for (cp = bigrams, i = 0; *cp != '\0'; i += 2, cp += 2)
+ big[(u_char)*cp][(u_char)*(cp + 1)] = (bg_t)i;
+
+#endif /* LOOKUP */
+
+ oldpath = buf1;
+ path = buf2;
+ oldcount = 0;
+
+ while (fgets(path, sizeof(buf2), stdin) != NULL) {
+
+ /* skip empty lines */
+ if (*path == '\n')
+ continue;
+
+ /* remove newline */
+ for (cp = path; *cp != '\0'; cp++) {
+#ifndef LOCATE_CHAR30
+ /* old locate implementations core'd for char 30 */
+ if (*cp == SWITCH)
+ *cp = '?';
+ else
+#endif /* !LOCATE_CHAR30 */
+
+ /* chop newline */
+ if (*cp == '\n')
+ *cp = '\0';
+ }
+
+ /* Skip longest common prefix. */
+ for (cp = path; *cp == *oldpath; cp++, oldpath++)
+ if (*cp == '\0')
+ break;
+
+ count = cp - path;
+ diffcount = count - oldcount + OFFSET;
+ oldcount = count;
+ if (diffcount < 0 || diffcount > 2 * OFFSET) {
+ if (putchar(SWITCH) == EOF ||
+ putw(diffcount, stdout) == EOF)
+ err(1, "stdout");
+ } else
+ if (putchar(diffcount) == EOF)
+ err(1, "stdout");
+
+ while (*cp != '\0') {
+ /* print *two* characters */
+
+ if ((code = BGINDEX(cp)) != (bg_t)-1) {
+ /*
+ * print *one* as bigram
+ * Found, so mark byte with
+ * parity bit.
+ */
+ if (putchar((code / 2) | PARITY) == EOF)
+ err(1, "stdout");
+ cp += 2;
+ }
+
+ else {
+ for (i = 0; i < 2; i++) {
+ if (*cp == '\0')
+ break;
+
+ /* print umlauts in file names */
+ if (*cp < ASCII_MIN ||
+ *cp > ASCII_MAX) {
+ if (putchar(UMLAUT) == EOF ||
+ putchar(*cp++) == EOF)
+ err(1, "stdout");
+ }
+
+ else {
+ /* normal character */
+ if(putchar(*cp++) == EOF)
+ err(1, "stdout");
+ }
+ }
+
+ }
+ }
+
+ if (path == buf1) { /* swap pointers */
+ path = buf2;
+ oldpath = buf1;
+ } else {
+ path = buf1;
+ oldpath = buf2;
+ }
+ }
+ /* Non-zero status if there were errors */
+ if (fflush(stdout) != 0 || ferror(stdout))
+ exit(1);
+ exit(0);
+}
+
+#ifndef LOOKUP
+int
+bgindex(char *bg) /* Return location of bg in bigrams or -1. */
+{
+ char bg0, bg1, *p;
+
+ bg0 = bg[0];
+ bg1 = bg[1];
+ for (p = bigrams; *p != NULL; p++)
+ if (*p++ == bg0 && *p == bg1)
+ break;
+ return (*p == NULL ? -1 : (--p - bigrams));
+}
+#endif /* !LOOKUP */
+
+void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: locate.code common_bigrams < list > squozen_list\n");
+ exit(1);
+}
diff --git a/usr.bin/locate/locate/Makefile b/usr.bin/locate/locate/Makefile
new file mode 100644
index 0000000..a139ff2
--- /dev/null
+++ b/usr.bin/locate/locate/Makefile
@@ -0,0 +1,23 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= locate
+SRCS= util.c locate.c
+CFLAGS+= -I${.CURDIR} -DMMAP # -DDEBUG (print time) -O2 (10% faster)
+SCRIPTS=updatedb.sh mklocatedb.sh concatdb.sh
+MAN= locate.1 locate.updatedb.8
+
+WARNS?= 2
+
+SCRIPTSDIR= ${LIBEXECDIR}
+.for script in ${SCRIPTS}
+SCRIPTSNAME_${script}= locate.${script:R}
+.endfor
+MLINKS+= locate.updatedb.8 updatedb.8
+
+# only /usr/src/etc/Makefile install files in /etc
+# ${INSTALL} -o root -g wheel -m 644 \
+# ${.CURDIR}/locate.rc ${DESTDIR}/etc
+
+.include "../../Makefile.inc"
+.include <bsd.prog.mk>
diff --git a/usr.bin/locate/locate/Makefile.depend b/usr.bin/locate/locate/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/locate/locate/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/locate/locate/concatdb.sh b/usr.bin/locate/locate/concatdb.sh
new file mode 100644
index 0000000..156f21a
--- /dev/null
+++ b/usr.bin/locate/locate/concatdb.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# 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.
+#
+# concatdb - concatenate locate databases
+#
+# usage: concatdb database1 ... databaseN > newdb
+#
+# Sequence of databases is important.
+#
+# $FreeBSD$
+
+# The directory containing locate subprograms
+: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR
+
+PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH
+
+umask 077 # protect temp files
+
+: ${TMPDIR:=/var/tmp}; export TMPDIR;
+test -d "$TMPDIR" || TMPDIR=/var/tmp
+
+# utilities to built locate database
+: ${bigram:=locate.bigram}
+: ${code:=locate.code}
+: ${sort:=sort}
+: ${locate:=locate}
+
+
+case $# in
+ [01]) echo 'usage: concatdb databases1 ... databaseN > newdb'
+ exit 1
+ ;;
+esac
+
+
+bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XXXXXXXXXX` || exit 1
+trap 'rm -f $bigrams' 0 1 2 3 5 10 15
+
+for db
+do
+ $locate -d $db /
+done | $bigram | $sort -nr | awk 'NR <= 128 { printf $2 }' > $bigrams
+
+for db
+do
+ $locate -d $db /
+done | $code $bigrams
diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
new file mode 100644
index 0000000..c15730b
--- /dev/null
+++ b/usr.bin/locate/locate/fastfind.c
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+
+#ifndef _LOCATE_STATISTIC_
+#define _LOCATE_STATISTIC_
+
+void
+statistic (fp, path_fcodes)
+ FILE *fp; /* open database */
+ char *path_fcodes; /* for error message */
+{
+ register int lines, chars, size, big, zwerg;
+ register u_char *p, *s;
+ register int c;
+ int count, umlaut;
+ u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
+
+ for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) {
+ p[c] = check_bigram_char(getc(fp));
+ s[c] = check_bigram_char(getc(fp));
+ }
+
+ lines = chars = big = zwerg = umlaut = 0;
+ size = NBG + NBG;
+
+ for (c = getc(fp), count = 0; c != EOF; size++) {
+ if (c == SWITCH) {
+ count += getwf(fp) - OFFSET;
+ size += sizeof(int);
+ zwerg++;
+ } else
+ count += c - OFFSET;
+
+ for (p = path + count; (c = getc(fp)) > SWITCH; size++)
+ if (c < PARITY) {
+ if (c == UMLAUT) {
+ c = getc(fp);
+ size++;
+ umlaut++;
+ }
+ p++;
+ } else {
+ /* bigram char */
+ big++;
+ p += 2;
+ }
+
+ p++;
+ lines++;
+ chars += (p - path);
+ }
+
+ (void)printf("\nDatabase: %s\n", path_fcodes);
+ (void)printf("Compression: Front: %2.2f%%, ",
+ (size + big - (2 * NBG)) / (chars / (float)100));
+ (void)printf("Bigram: %2.2f%%, ", (size - big) / (size / (float)100));
+ (void)printf("Total: %2.2f%%\n",
+ (size - (2 * NBG)) / (chars / (float)100));
+ (void)printf("Filenames: %d, ", lines);
+ (void)printf("Characters: %d, ", chars);
+ (void)printf("Database size: %d\n", size);
+ (void)printf("Bigram characters: %d, ", big);
+ (void)printf("Integers: %d, ", zwerg);
+ (void)printf("8-Bit characters: %d\n", umlaut);
+
+}
+#endif /* _LOCATE_STATISTIC_ */
+
+extern char separator;
+
+void
+#ifdef FF_MMAP
+
+
+#ifdef FF_ICASE
+fastfind_mmap_icase
+#else
+fastfind_mmap
+#endif /* FF_ICASE */
+(pathpart, paddr, len, database)
+ char *pathpart; /* search string */
+ caddr_t paddr; /* mmap pointer */
+ int len; /* length of database */
+ char *database; /* for error message */
+
+
+#else /* MMAP */
+
+
+#ifdef FF_ICASE
+fastfind_icase
+#else
+fastfind
+#endif /* FF_ICASE */
+
+(fp, pathpart, database)
+ FILE *fp; /* open database */
+ char *pathpart; /* search string */
+ char *database; /* for error message */
+
+
+#endif /* MMAP */
+
+{
+ register u_char *p, *s, *patend, *q, *foundchar;
+ register int c, cc;
+ int count, found, globflag;
+ u_char *cutoff;
+ u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
+
+#ifdef FF_ICASE
+ /* use a lookup table for case insensitive search */
+ u_char table[UCHAR_MAX + 1];
+
+ tolower_word(pathpart);
+#endif /* FF_ICASE*/
+
+ /* init bigram table */
+#ifdef FF_MMAP
+ for (c = 0, p = bigram1, s = bigram2; c < NBG; c++, len-= 2) {
+ p[c] = check_bigram_char(*paddr++);
+ s[c] = check_bigram_char(*paddr++);
+ }
+#else
+ for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) {
+ p[c] = check_bigram_char(getc(fp));
+ s[c] = check_bigram_char(getc(fp));
+ }
+#endif /* FF_MMAP */
+
+ /* find optimal (last) char for searching */
+ for (p = pathpart; *p != '\0'; p++)
+ if (strchr(LOCATE_REG, *p) != NULL)
+ break;
+
+ if (*p == '\0')
+ globflag = 0;
+ else
+ globflag = 1;
+
+ p = pathpart;
+ patend = patprep(p);
+ cc = *patend;
+
+#ifdef FF_ICASE
+ /* set patend char to true */
+ for (c = 0; c < UCHAR_MAX + 1; c++)
+ table[c] = 0;
+
+ table[TOLOWER(*patend)] = 1;
+ table[toupper(*patend)] = 1;
+#endif /* FF_ICASE */
+
+
+ /* main loop */
+ found = count = 0;
+ foundchar = 0;
+
+#ifdef FF_MMAP
+ c = (u_char)*paddr++; len--;
+ for (; len > 0; ) {
+#else
+ c = getc(fp);
+ for (; c != EOF; ) {
+#endif /* FF_MMAP */
+
+ /* go forward or backward */
+ if (c == SWITCH) { /* big step, an integer */
+#ifdef FF_MMAP
+ count += getwm(paddr) - OFFSET;
+ len -= INTSIZE; paddr += INTSIZE;
+#else
+ count += getwf(fp) - OFFSET;
+#endif /* FF_MMAP */
+ } else { /* slow step, =< 14 chars */
+ count += c - OFFSET;
+ }
+
+ if (count < 0 || count > MAXPATHLEN)
+ errx(1, "corrupted database: %s", database);
+ /* overlay old path */
+ p = path + count;
+ foundchar = p - 1;
+
+#ifdef FF_MMAP
+ for (; len > 0;) {
+ c = (u_char)*paddr++;
+ len--;
+#else
+ for (;;) {
+ c = getc(fp);
+#endif /* FF_MMAP */
+ /*
+ * == UMLAUT: 8 bit char followed
+ * <= SWITCH: offset
+ * >= PARITY: bigram
+ * rest: single ascii char
+ *
+ * offset < SWITCH < UMLAUT < ascii < PARITY < bigram
+ */
+ if (c < PARITY) {
+ if (c <= UMLAUT) {
+ if (c == UMLAUT) {
+#ifdef FF_MMAP
+ c = (u_char)*paddr++;
+ len--;
+#else
+ c = getc(fp);
+#endif /* FF_MMAP */
+
+ } else
+ break; /* SWITCH */
+ }
+#ifdef FF_ICASE
+ if (table[c])
+#else
+ if (c == cc)
+#endif /* FF_ICASE */
+ foundchar = p;
+ *p++ = c;
+ }
+ else {
+ /* bigrams are parity-marked */
+ TO7BIT(c);
+
+#ifndef FF_ICASE
+ if (bigram1[c] == cc ||
+ bigram2[c] == cc)
+#else
+
+ if (table[bigram1[c]] ||
+ table[bigram2[c]])
+#endif /* FF_ICASE */
+ foundchar = p + 1;
+
+ *p++ = bigram1[c];
+ *p++ = bigram2[c];
+ }
+ }
+
+ if (found) { /* previous line matched */
+ cutoff = path;
+ *p-- = '\0';
+ foundchar = p;
+ } else if (foundchar >= path + count) { /* a char matched */
+ *p-- = '\0';
+ cutoff = path + count;
+ } else /* nothing to do */
+ continue;
+
+ found = 0;
+ for (s = foundchar; s >= cutoff; s--) {
+ if (*s == cc
+#ifdef FF_ICASE
+ || TOLOWER(*s) == cc
+#endif /* FF_ICASE */
+ ) { /* fast first char check */
+ for (p = patend - 1, q = s - 1; *p != '\0';
+ p--, q--)
+ if (*q != *p
+#ifdef FF_ICASE
+ && TOLOWER(*q) != *p
+#endif /* FF_ICASE */
+ )
+ break;
+ if (*p == '\0') { /* fast match success */
+ found = 1;
+ if (!globflag ||
+#ifndef FF_ICASE
+ !fnmatch(pathpart, path, 0))
+#else
+ !fnmatch(pathpart, path,
+ FNM_CASEFOLD))
+#endif /* !FF_ICASE */
+ {
+ if (f_silent)
+ counter++;
+ else if (f_limit) {
+ counter++;
+ if (f_limit >= counter)
+ (void)printf("%s%c",path,separator);
+ else
+ errx(0, "[show only %d lines]", counter - 1);
+ } else
+ (void)printf("%s%c",path,separator);
+ }
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/usr.bin/locate/locate/locate.1 b/usr.bin/locate/locate/locate.1
new file mode 100644
index 0000000..b0248d7
--- /dev/null
+++ b/usr.bin/locate/locate/locate.1
@@ -0,0 +1,272 @@
+.\" Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+.\" Copyright (c) 1990, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)locate.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd August 17, 2006
+.Dt LOCATE 1
+.Os
+.Sh NAME
+.Nm locate
+.Nd find filenames quickly
+.Sh SYNOPSIS
+.Nm
+.Op Fl 0Scims
+.Op Fl l Ar limit
+.Op Fl d Ar database
+.Ar pattern ...
+.Sh DESCRIPTION
+The
+.Nm
+program searches a database for all pathnames which match the specified
+.Ar pattern .
+The database is recomputed periodically (usually weekly or daily),
+and contains the pathnames
+of all files which are publicly accessible.
+.Pp
+Shell globbing and quoting characters
+.Dq ( * ,
+.Dq \&? ,
+.Dq \e ,
+.Dq \&[
+and
+.Dq \&] )
+may be used in
+.Ar pattern ,
+although they will have to be escaped from the shell.
+Preceding any character with a backslash
+.Pq Dq \e
+eliminates any special
+meaning which it may have.
+The matching differs in that no characters must be matched explicitly,
+including slashes
+.Pq Dq / .
+.Pp
+As a special case, a pattern containing no globbing characters
+.Pq Dq foo
+is matched as though it were
+.Dq *foo* .
+.Pp
+Historically, locate only stored characters between 32 and 127.
+The
+current implementation store any character except newline
+.Pq Sq \en
+and
+.Dv NUL
+.Pq Sq \e0 .
+The 8-bit character support does not waste extra space for
+plain ASCII file names.
+Characters less than 32 or greater than 127
+are stored in 2 bytes.
+.Pp
+The following options are available:
+.Bl -tag -width 10n
+.It Fl 0
+Print pathnames separated by an
+.Tn ASCII
+.Dv NUL
+character (character code 0) instead of default NL
+(newline, character code 10).
+.It Fl S
+Print some statistics about the database and exit.
+.It Fl c
+Suppress normal output; instead print a count of matching file names.
+.It Fl d Ar database
+Search in
+.Ar database
+instead of the default file name database.
+Multiple
+.Fl d
+options are allowed.
+Each additional
+.Fl d
+option adds the specified database to the list
+of databases to be searched.
+.Pp
+The option
+.Ar database
+may be a colon-separated list of databases.
+A single colon is a reference
+to the default database.
+.Bd -literal
+$ locate -d $HOME/lib/mydb: foo
+.Ed
+.Pp
+will first search string
+.Dq foo
+in
+.Pa $HOME/lib/mydb
+and then in
+.Pa /var/db/locate.database .
+.Bd -literal
+$ locate -d $HOME/lib/mydb::/cdrom/locate.database foo
+.Ed
+.Pp
+will first search string
+.Dq foo
+in
+.Pa $HOME/lib/mydb
+and then in
+.Pa /var/db/locate.database
+and then in
+.Pa /cdrom/locate.database .
+.Pp
+.Dl "$ locate -d db1 -d db2 -d db3 pattern"
+.Pp
+is the same as
+.Pp
+.Dl "$ locate -d db1:db2:db3 pattern"
+.Pp
+or
+.Pp
+.Dl "$ locate -d db1:db2 -d db3 pattern"
+.Pp
+If
+.Fl
+is given as the database name, standard input will be read instead.
+For example, you can compress your database
+and use:
+.Bd -literal
+$ zcat database.gz | locate -d - pattern
+.Ed
+.Pp
+This might be useful on machines with a fast CPU and little RAM and slow
+I/O.
+Note: you can only use
+.Em one
+pattern for stdin.
+.It Fl i
+Ignore case distinctions in both the pattern and the database.
+.It Fl l Ar number
+Limit output to
+.Ar number
+of file names and exit.
+.It Fl m
+Use
+.Xr mmap 2
+instead of the
+.Xr stdio 3
+library.
+This is the default behavior
+and is faster in most cases.
+.It Fl s
+Use the
+.Xr stdio 3
+library instead of
+.Xr mmap 2 .
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width LOCATE_PATH -compact
+.It Pa LOCATE_PATH
+path to the locate database if set and not empty, ignored if the
+.Fl d
+option was specified.
+.El
+.Sh FILES
+.Bl -tag -width /etc/periodic/weekly/310.locate -compact
+.It Pa /var/db/locate.database
+locate database
+.It Pa /usr/libexec/locate.updatedb
+Script to update the locate database
+.It Pa /etc/periodic/weekly/310.locate
+Script that starts the database rebuild
+.El
+.Sh SEE ALSO
+.Xr find 1 ,
+.Xr whereis 1 ,
+.Xr which 1 ,
+.Xr fnmatch 3 ,
+.Xr locate.updatedb 8
+.Rs
+.%A Woods, James A.
+.%D 1983
+.%T "Finding Files Fast"
+.%J ";login"
+.%V 8:1
+.%P pp. 8-10
+.Re
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Bx 4.4 .
+Many new features were
+added in
+.Fx 2.2 .
+.Sh BUGS
+The
+.Nm
+program may fail to list some files that are present, or may
+list files that have been removed from the system.
+This is because
+locate only reports files that are present in the database, which is
+typically only regenerated once a week by the
+.Pa /etc/periodic/weekly/310.locate
+script.
+Use
+.Xr find 1
+to locate files that are of a more transitory nature.
+.Pp
+The
+.Nm
+database is typically built by user
+.Dq nobody
+and the
+.Xr locate.updatedb 8
+utility skips directories
+which are not readable for user
+.Dq nobody ,
+group
+.Dq nobody ,
+or
+world.
+For example, if your HOME directory is not world-readable,
+.Em none
+of your files are
+in the database.
+.Pp
+The
+.Nm
+database is not byte order independent.
+It is not possible
+to share the databases between machines with different byte order.
+The current
+.Nm
+implementation understands databases in host byte order or
+network byte order if both architectures use the same integer size.
+So on a
+.Fx Ns /i386
+machine
+(little endian), you can read
+a locate database which was built on SunOS/sparc machine
+(big endian, net).
+.Pp
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c
new file mode 100644
index 0000000..3a87b14
--- /dev/null
+++ b/usr.bin/locate/locate/locate.c
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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) 1995-1996 Wolfram Schneider, Berlin.\n\
+@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)locate.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+/*
+ * Ref: Usenix ;login:, Vol 8, No 1, February/March, 1983, p. 8.
+ *
+ * Locate scans a file list for the full pathname of a file given only part
+ * of the name. The list has been processed with with "front-compression"
+ * and bigram coding. Front compression reduces space by a factor of 4-5,
+ * bigram coding by a further 20-25%.
+ *
+ * The codes are:
+ *
+ * 0-28 likeliest differential counts + offset to make nonnegative
+ * 30 switch code for out-of-range count to follow in next word
+ * 31 an 8 bit char followed
+ * 128-255 bigram codes (128 most common, as determined by 'updatedb')
+ * 32-127 single character (printable) ascii residue (ie, literal)
+ *
+ * A novel two-tiered string search technique is employed:
+ *
+ * First, a metacharacter-free subpattern and partial pathname is matched
+ * BACKWARDS to avoid full expansion of the pathname list. The time savings
+ * is 40-50% over forward matching, which cannot efficiently handle
+ * overlapped search patterns and compressed path residue.
+ *
+ * Then, the actual shell glob-style regular expression (if in this form) is
+ * matched against the candidate pathnames using the slower routines provided
+ * in the standard 'find'.
+ */
+
+#include <sys/param.h>
+#include <ctype.h>
+#include <err.h>
+#include <fnmatch.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef MMAP
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <sys/mman.h>
+# include <fcntl.h>
+#endif
+
+
+#include "locate.h"
+#include "pathnames.h"
+
+#ifdef DEBUG
+# include <sys/time.h>
+# include <sys/types.h>
+# include <sys/resource.h>
+#endif
+
+int f_mmap; /* use mmap */
+int f_icase; /* ignore case */
+int f_stdin; /* read database from stdin */
+int f_statistic; /* print statistic */
+int f_silent; /* suppress output, show only count of matches */
+int f_limit; /* limit number of output lines, 0 == infinite */
+u_int counter; /* counter for matches [-c] */
+char separator='\n'; /* line separator */
+
+
+void usage(void);
+void statistic(FILE *, char *);
+void fastfind(FILE *, char *, char *);
+void fastfind_icase(FILE *, char *, char *);
+void fastfind_mmap(char *, caddr_t, int, char *);
+void fastfind_mmap_icase(char *, caddr_t, int, char *);
+void search_mmap(char *, char **);
+void search_fopen(char *, char **);
+unsigned long cputime(void);
+
+extern char **colon(char **, char*, char*);
+extern void print_matches(u_int);
+extern int getwm(caddr_t);
+extern int getwf(FILE *);
+extern u_char *tolower_word(u_char *);
+extern int check_bigram_char(int);
+extern char *patprep(char *);
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ register int ch;
+ char **dbv = NULL;
+ char *path_fcodes; /* locate database */
+#ifdef MMAP
+ f_mmap = 1; /* mmap is default */
+#endif
+ (void) setlocale(LC_ALL, "");
+
+ while ((ch = getopt(argc, argv, "0Scd:il:ms")) != -1)
+ switch(ch) {
+ case '0': /* 'find -print0' style */
+ separator = '\0';
+ break;
+ case 'S': /* statistic lines */
+ f_statistic = 1;
+ break;
+ case 'l': /* limit number of output lines, 0 == infinite */
+ f_limit = atoi(optarg);
+ break;
+ case 'd': /* database */
+ dbv = colon(dbv, optarg, _PATH_FCODES);
+ break;
+ case 'i': /* ignore case */
+ f_icase = 1;
+ break;
+ case 'm': /* mmap */
+#ifdef MMAP
+ f_mmap = 1;
+#else
+ warnx("mmap(2) not implemented");
+#endif
+ break;
+ case 's': /* stdio lib */
+ f_mmap = 0;
+ break;
+ case 'c': /* suppress output, show only count of matches */
+ f_silent = 1;
+ break;
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+ /* to few arguments */
+ if (argc < 1 && !(f_statistic))
+ usage();
+
+ /* no (valid) database as argument */
+ if (dbv == NULL || *dbv == NULL) {
+ /* try to read database from environment */
+ if ((path_fcodes = getenv("LOCATE_PATH")) == NULL ||
+ *path_fcodes == '\0')
+ /* use default database */
+ dbv = colon(dbv, _PATH_FCODES, _PATH_FCODES);
+ else /* $LOCATE_PATH */
+ dbv = colon(dbv, path_fcodes, _PATH_FCODES);
+ }
+
+ if (f_icase && UCHAR_MAX < 4096) /* init tolower lookup table */
+ for (ch = 0; ch < UCHAR_MAX + 1; ch++)
+ myctype[ch] = tolower(ch);
+
+ /* foreach database ... */
+ while((path_fcodes = *dbv) != NULL) {
+ dbv++;
+
+ if (!strcmp(path_fcodes, "-"))
+ f_stdin = 1;
+ else
+ f_stdin = 0;
+
+#ifndef MMAP
+ f_mmap = 0; /* be paranoid */
+#endif
+ if (!f_mmap || f_stdin || f_statistic)
+ search_fopen(path_fcodes, argv);
+ else
+ search_mmap(path_fcodes, argv);
+ }
+
+ if (f_silent)
+ print_matches(counter);
+ exit(0);
+}
+
+
+void
+search_fopen(db, s)
+ char *db; /* database */
+ char **s; /* search strings */
+{
+ FILE *fp;
+#ifdef DEBUG
+ long t0;
+#endif
+
+ /* can only read stdin once */
+ if (f_stdin) {
+ fp = stdin;
+ if (*(s+1) != NULL) {
+ warnx("read database from stdin, use only `%s' as pattern", *s);
+ *(s+1) = NULL;
+ }
+ }
+ else if ((fp = fopen(db, "r")) == NULL)
+ err(1, "`%s'", db);
+
+ /* count only chars or lines */
+ if (f_statistic) {
+ statistic(fp, db);
+ (void)fclose(fp);
+ return;
+ }
+
+ /* foreach search string ... */
+ while(*s != NULL) {
+#ifdef DEBUG
+ t0 = cputime();
+#endif
+ if (!f_stdin &&
+ fseek(fp, (long)0, SEEK_SET) == -1)
+ err(1, "fseek to begin of ``%s''\n", db);
+
+ if (f_icase)
+ fastfind_icase(fp, *s, db);
+ else
+ fastfind(fp, *s, db);
+#ifdef DEBUG
+ warnx("fastfind %ld ms", cputime () - t0);
+#endif
+ s++;
+ }
+ (void)fclose(fp);
+}
+
+#ifdef MMAP
+void
+search_mmap(db, s)
+ char *db; /* database */
+ char **s; /* search strings */
+{
+ struct stat sb;
+ int fd;
+ caddr_t p;
+ off_t len;
+#ifdef DEBUG
+ long t0;
+#endif
+ if ((fd = open(db, O_RDONLY)) == -1 ||
+ fstat(fd, &sb) == -1)
+ err(1, "`%s'", db);
+ len = sb.st_size;
+ if (len < (2*NBG))
+ errx(1,
+ "database too small: %s\nRun /usr/libexec/locate.updatedb",
+ db);
+
+ if ((p = mmap((caddr_t)0, (size_t)len,
+ PROT_READ, MAP_SHARED,
+ fd, (off_t)0)) == MAP_FAILED)
+ err(1, "mmap ``%s''", db);
+
+ /* foreach search string ... */
+ while (*s != NULL) {
+#ifdef DEBUG
+ t0 = cputime();
+#endif
+ if (f_icase)
+ fastfind_mmap_icase(*s, p, (int)len, db);
+ else
+ fastfind_mmap(*s, p, (int)len, db);
+#ifdef DEBUG
+ warnx("fastfind %ld ms", cputime () - t0);
+#endif
+ s++;
+ }
+
+ if (munmap(p, (size_t)len) == -1)
+ warn("munmap %s\n", db);
+
+ (void)close(fd);
+}
+#endif /* MMAP */
+
+#ifdef DEBUG
+unsigned long
+cputime ()
+{
+ struct rusage rus;
+
+ getrusage(RUSAGE_SELF, &rus);
+ return(rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000);
+}
+#endif /* DEBUG */
+
+void
+usage ()
+{
+ (void)fprintf(stderr,
+ "usage: locate [-0Scims] [-l limit] [-d database] pattern ...\n\n");
+ (void)fprintf(stderr,
+ "default database: `%s' or $LOCATE_PATH\n", _PATH_FCODES);
+ exit(1);
+}
+
+
+/* load fastfind functions */
+
+/* statistic */
+/* fastfind_mmap, fastfind_mmap_icase */
+#ifdef MMAP
+#undef FF_MMAP
+#undef FF_ICASE
+
+#define FF_MMAP
+#include "fastfind.c"
+#define FF_ICASE
+#include "fastfind.c"
+#endif /* MMAP */
+
+/* fopen */
+/* fastfind, fastfind_icase */
+#undef FF_MMAP
+#undef FF_ICASE
+#include "fastfind.c"
+#define FF_ICASE
+#include "fastfind.c"
diff --git a/usr.bin/locate/locate/locate.h b/usr.bin/locate/locate/locate.h
new file mode 100644
index 0000000..c2f27fb
--- /dev/null
+++ b/usr.bin/locate/locate/locate.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 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.
+ * 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
+ * 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.
+ *
+ * @(#)locate.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+/* Symbolic constants shared by locate.c and code.c */
+
+#define NBG 128 /* number of bigrams considered */
+#define OFFSET 14 /* abs value of max likely diff */
+#define PARITY 0200 /* parity bit */
+#define SWITCH 30 /* switch code */
+#define UMLAUT 31 /* an 8 bit char followed */
+
+/* 0-28 likeliest differential counts + offset to make nonnegative */
+#define LDC_MIN 0
+#define LDC_MAX 28
+
+/* 128-255 bigram codes (128 most common, as determined by 'updatedb') */
+#define BIGRAM_MIN (UCHAR_MAX - SCHAR_MAX)
+#define BIGRAM_MAX UCHAR_MAX
+
+/* 32-127 single character (printable) ascii residue (ie, literal) */
+#define ASCII_MIN 32
+#define ASCII_MAX SCHAR_MAX
+
+/* #define TO7BIT(x) (x = ( ((u_char)x) & SCHAR_MAX )) */
+#define TO7BIT(x) (x = x & SCHAR_MAX )
+
+
+#if UCHAR_MAX >= 4096
+ define TOLOWER(ch) tolower(ch)
+#else
+
+u_char myctype[UCHAR_MAX + 1];
+#define TOLOWER(ch) (myctype[ch])
+#endif
+
+#define INTSIZE (sizeof(int))
+
+#define LOCATE_REG "*?[]\\" /* fnmatch(3) meta characters */
diff --git a/usr.bin/locate/locate/locate.rc b/usr.bin/locate/locate/locate.rc
new file mode 100644
index 0000000..99655c5
--- /dev/null
+++ b/usr.bin/locate/locate/locate.rc
@@ -0,0 +1,33 @@
+#
+# /etc/locate.rc - command script for updatedb(8)
+#
+# $FreeBSD$
+
+#
+# All commented values are the defaults
+#
+# temp directory
+#TMPDIR="/tmp"
+
+# the actual database
+#FCODES="/var/db/locate.database"
+
+# directories to be put in the database
+#SEARCHPATHS="/"
+
+# paths unwanted in output
+#PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap /var/db/freebsd-update"
+
+# directories unwanted in output
+#PRUNEDIRS=".zfs"
+
+# filesystems allowed. Beware: a non-listed filesystem will be pruned
+# and if the SEARCHPATHS starts in such a filesystem locate will build
+# an empty database.
+#
+# the default list contains all local file systems that are not synthetic,
+# loopback mounts, or read-only, according to lsvfs.
+#
+# be careful if you add 'nfs' or other network file system types or file
+# systems that generally reside on slow or removable devices like cd9660
+#FILESYSTEMS="ufs ext2fs zfs xfs"
diff --git a/usr.bin/locate/locate/locate.updatedb.8 b/usr.bin/locate/locate/locate.updatedb.8
new file mode 100644
index 0000000..2e2248f
--- /dev/null
+++ b/usr.bin/locate/locate/locate.updatedb.8
@@ -0,0 +1,75 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Mike Pritchard.
+.\" 4. Neither the name of the author 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 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 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 11, 1996
+.Dt LOCATE.UPDATEDB 8
+.Os
+.Sh NAME
+.Nm locate.updatedb
+.Nd update locate database
+.Sh SYNOPSIS
+.Nm /usr/libexec/locate.updatedb
+.Sh DESCRIPTION
+The
+.Nm
+utility updates the database used by
+.Xr locate 1 .
+It is typically run once a week by the
+.Pa /etc/periodic/weekly/310.locate
+script.
+.Pp
+The contents of the newly built database can be controlled by the
+.Pa /etc/locate.rc
+file.
+.Sh ENVIRONMENT
+.Bl -tag -width /var/db/locate.database -compact
+.It Pa LOCATE_CONFIG
+path to the configuration file
+.El
+.Sh FILES
+.Bl -tag -width /var/db/locate.database -compact
+.It Pa /var/db/locate.database
+the default database
+.It Pa /etc/locate.rc
+the configuration file
+.El
+.Sh SEE ALSO
+.Xr locate 1 ,
+.Xr periodic 8
+.Rs
+.%A Woods, James A.
+.%D 1983
+.%T "Finding Files Fast"
+.%J ";login"
+.%V 8:1
+.%P pp. 8-10
+.Re
diff --git a/usr.bin/locate/locate/mklocatedb.sh b/usr.bin/locate/locate/mklocatedb.sh
new file mode 100644
index 0000000..39d15d7
--- /dev/null
+++ b/usr.bin/locate/locate/mklocatedb.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# 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.
+#
+# mklocatedb - build locate database
+#
+# usage: mklocatedb [-presort] < filelist > database
+#
+# $FreeBSD$
+
+# The directory containing locate subprograms
+: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR
+
+PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH
+
+umask 077 # protect temp files
+
+: ${TMPDIR:=/tmp}; export TMPDIR
+test -d "$TMPDIR" || TMPDIR=/tmp
+if ! TMPDIR=`mktemp -d $TMPDIR/mklocateXXXXXXXXXX`; then
+ exit 1
+fi
+
+
+# utilities to built locate database
+: ${bigram:=locate.bigram}
+: ${code:=locate.code}
+: ${sort:=sort}
+
+
+sortopt="-u -T $TMPDIR"
+sortcmd=$sort
+
+
+bigrams=$TMPDIR/_mklocatedb$$.bigrams
+filelist=$TMPDIR/_mklocatedb$$.list
+
+trap 'rm -f $bigrams $filelist; rmdir $TMPDIR' 0 1 2 3 5 10 15
+
+
+# Input already sorted
+if [ X"$1" = "X-presort" ]; then
+ shift;
+
+ # create an empty file
+ true > $bigrams
+
+ # Locate database bootstrapping
+ # 1. first build a temp database without bigram compression
+ # 2. create the bigram from the temp database
+ # 3. create the real locate database with bigram compression.
+ #
+ # This scheme avoid large temporary files in /tmp
+
+ $code $bigrams > $filelist || exit 1
+ locate -d $filelist / | $bigram | $sort -nr | head -128 |
+ awk '{if (/^[ ]*[0-9]+[ ]+..$/) {printf("%s",$2)} else {exit 1}}' > $bigrams || exit 1
+ locate -d $filelist / | $code $bigrams || exit 1
+ exit
+
+else
+ if $sortcmd $sortopt > $filelist; then
+ $bigram < $filelist | $sort -nr |
+ awk '{if (/^[ ]*[0-9]+[ ]+..$/) {printf("%s",$2)} else {exit 1}}' > $bigrams || exit 1
+ $code $bigrams < $filelist || exit 1
+ else
+ echo "`basename $0`: cannot build locate database" >&2
+ exit 1
+ fi
+fi
diff --git a/usr.bin/locate/locate/pathnames.h b/usr.bin/locate/locate/pathnames.h
new file mode 100644
index 0000000..8fb0e8c
--- /dev/null
+++ b/usr.bin/locate/locate/pathnames.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1989, 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.
+ * 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
+ * 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ */
+
+#define _PATH_FCODES "/var/db/locate.database"
diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh
new file mode 100644
index 0000000..97f096d
--- /dev/null
+++ b/usr.bin/locate/locate/updatedb.sh
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# 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.
+#
+# updatedb - update locate database for local mounted filesystems
+#
+# $FreeBSD$
+
+if [ "$(id -u)" = "0" ]; then
+ echo ">>> WARNING" 1>&2
+ echo ">>> Executing updatedb as root. This WILL reveal all filenames" 1>&2
+ echo ">>> on your machine to all login users, which is a security risk." 1>&2
+fi
+: ${LOCATE_CONFIG="/etc/locate.rc"}
+if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then
+ . $LOCATE_CONFIG
+fi
+
+# The directory containing locate subprograms
+: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR
+: ${TMPDIR:=/tmp}; export TMPDIR
+if ! TMPDIR=`mktemp -d $TMPDIR/locateXXXXXXXXXX`; then
+ exit 1
+fi
+
+PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH
+
+
+: ${mklocatedb:=locate.mklocatedb} # make locate database program
+: ${FCODES:=/var/db/locate.database} # the database
+: ${SEARCHPATHS="/"} # directories to be put in the database
+: ${PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap /var/db/freebsd-update"} # unwanted directories
+: ${PRUNEDIRS=".zfs"} # unwanted directories, in any parent
+: ${FILESYSTEMS="$(lsvfs | tail -n +3 | \
+ egrep -vw "loopback|network|synthetic|read-only|0" | \
+ cut -d " " -f1)"} # allowed filesystems
+: ${find:=find}
+
+if [ -z "$SEARCHPATHS" ]; then
+ echo "$0: empty variable SEARCHPATHS" >&2; exit 1
+fi
+if [ -z "$FILESYSTEMS" ]; then
+ echo "$0: empty variable FILESYSTEMS" >&2; exit 1
+fi
+
+# Make a list a paths to exclude in the locate run
+excludes="! (" or=""
+for fstype in $FILESYSTEMS
+do
+ excludes="$excludes $or -fstype $fstype"
+ or="-or"
+done
+excludes="$excludes ) -prune"
+
+if [ -n "$PRUNEPATHS" ]; then
+ for path in $PRUNEPATHS; do
+ excludes="$excludes -or -path $path -prune"
+ done
+fi
+
+if [ -n "$PRUNEDIRS" ]; then
+ for dir in $PRUNEDIRS; do
+ excludes="$excludes -or -name $dir -type d -prune"
+ done
+fi
+
+tmp=$TMPDIR/_updatedb$$
+trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15
+
+# search locally
+if $find -s $SEARCHPATHS $excludes -or -print 2>/dev/null |
+ $mklocatedb -presort > $tmp
+then
+ if [ -n "$($find $tmp -size -257c -print)" ]; then
+ echo "updatedb: locate database $tmp is empty" >&2
+ exit 1
+ else
+ cat $tmp > $FCODES # should be cp?
+ fi
+fi
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
new file mode 100644
index 0000000..9130e37
--- /dev/null
+++ b/usr.bin/locate/locate/util.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+#include <sys/param.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+
+#include "locate.h"
+
+char **colon(char **, char*, char*);
+char *patprep(char *);
+void print_matches(u_int);
+u_char *tolower_word(u_char *);
+int getwm(caddr_t);
+int getwf(FILE *);
+int check_bigram_char(int);
+
+/*
+ * Validate bigram chars. If the test failed the database is corrupt
+ * or the database is obviously not a locate database.
+ */
+int
+check_bigram_char(ch)
+ int ch;
+{
+ /* legal bigram: 0, ASCII_MIN ... ASCII_MAX */
+ if (ch == 0 ||
+ (ch >= ASCII_MIN && ch <= ASCII_MAX))
+ return(ch);
+
+ errx(1,
+ "locate database header corrupt, bigram char outside 0, %d-%d: %d",
+ ASCII_MIN, ASCII_MAX, ch);
+ exit(1);
+}
+
+/* split a colon separated string into a char vector
+ *
+ * "bla:foo" -> {"foo", "bla"}
+ * "bla:" -> {"foo", dot}
+ * "bla" -> {"bla"}
+ * "" -> do nothing
+ *
+ */
+char **
+colon(dbv, path, dot)
+ char **dbv;
+ char *path;
+ char *dot; /* default for single ':' */
+{
+ int vlen, slen;
+ char *c, *ch, *p;
+ char **pv;
+
+ if (dbv == NULL) {
+ if ((dbv = malloc(sizeof(char *))) == NULL)
+ err(1, "malloc");
+ *dbv = NULL;
+ }
+
+ /* empty string */
+ if (*path == '\0') {
+ warnx("empty database name, ignored");
+ return(dbv);
+ }
+
+ /* length of string vector */
+ for(vlen = 0, pv = dbv; *pv != NULL; pv++, vlen++);
+
+ for (ch = c = path; ; ch++) {
+ if (*ch == ':' ||
+ (!*ch && !(*(ch - 1) == ':' && ch == 1+ path))) {
+ /* single colon -> dot */
+ if (ch == c)
+ p = dot;
+ else {
+ /* a string */
+ slen = ch - c;
+ if ((p = malloc(sizeof(char) * (slen + 1)))
+ == NULL)
+ err(1, "malloc");
+ bcopy(c, p, slen);
+ *(p + slen) = '\0';
+ }
+ /* increase dbv with element p */
+ if ((dbv = realloc(dbv, sizeof(char *) * (vlen + 2)))
+ == NULL)
+ err(1, "realloc");
+ *(dbv + vlen) = p;
+ *(dbv + ++vlen) = NULL;
+ c = ch + 1;
+ }
+ if (*ch == '\0')
+ break;
+ }
+ return (dbv);
+}
+
+void
+print_matches(counter)
+ u_int counter;
+{
+ (void)printf("%d\n", counter);
+}
+
+
+/*
+ * extract last glob-free subpattern in name for fast pre-match; prepend
+ * '\0' for backwards match; return end of new pattern
+ */
+static char globfree[100];
+
+char *
+patprep(name)
+ char *name;
+{
+ register char *endmark, *p, *subp;
+
+ subp = globfree;
+ *subp++ = '\0'; /* set first element to '\0' */
+ p = name + strlen(name) - 1;
+
+ /* skip trailing metacharacters */
+ for (; p >= name; p--)
+ if (strchr(LOCATE_REG, *p) == NULL)
+ break;
+
+ /*
+ * check if maybe we are in a character class
+ *
+ * 'foo.[ch]'
+ * |----< p
+ */
+ if (p >= name &&
+ (strchr(p, '[') != NULL || strchr(p, ']') != NULL)) {
+ for (p = name; *p != '\0'; p++)
+ if (*p == ']' || *p == '[')
+ break;
+ p--;
+
+ /*
+ * cannot find a non-meta character, give up
+ * '*\*[a-z]'
+ * |-------< p
+ */
+ if (p >= name && strchr(LOCATE_REG, *p) != NULL)
+ p = name - 1;
+ }
+
+ if (p < name)
+ /* only meta chars: "???", force '/' search */
+ *subp++ = '/';
+
+ else {
+ for (endmark = p; p >= name; p--)
+ if (strchr(LOCATE_REG, *p) != NULL)
+ break;
+ for (++p;
+ (p <= endmark) && subp < (globfree + sizeof(globfree));)
+ *subp++ = *p++;
+ }
+ *subp = '\0';
+ return(--subp);
+}
+
+/* tolower word */
+u_char *
+tolower_word(word)
+ u_char *word;
+{
+ register u_char *p;
+
+ for(p = word; *p != '\0'; p++)
+ *p = TOLOWER(*p);
+
+ return(word);
+}
+
+
+/*
+ * Read integer from mmap pointer.
+ * Essentially a simple ``return *(int *)p'' but avoids sigbus
+ * for integer alignment (SunOS 4.x, 5.x).
+ *
+ * Convert network byte order to host byte order if necessary.
+ * So we can read a locate database on FreeBSD/i386 (little endian)
+ * which was built on SunOS/sparc (big endian).
+ */
+
+int
+getwm(p)
+ caddr_t p;
+{
+ union {
+ char buf[INTSIZE];
+ int i;
+ } u;
+ register int i, hi;
+
+ for (i = 0; i < (int)INTSIZE; i++)
+ u.buf[i] = *p++;
+
+ i = u.i;
+
+ if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
+ hi = ntohl(i);
+ if (hi > MAXPATHLEN || hi < -(MAXPATHLEN))
+ errx(1, "integer out of +-MAXPATHLEN (%d): %u",
+ MAXPATHLEN, abs(i) < abs(hi) ? i : hi);
+ return(hi);
+ }
+ return(i);
+}
+
+/*
+ * Read integer from stream.
+ *
+ * Convert network byte order to host byte order if necessary.
+ * So we can read on FreeBSD/i386 (little endian) a locate database
+ * which was built on SunOS/sparc (big endian).
+ */
+
+int
+getwf(fp)
+ FILE *fp;
+{
+ register int word, hword;
+
+ word = getw(fp);
+
+ if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
+ hword = ntohl(word);
+ if (hword > MAXPATHLEN || hword < -(MAXPATHLEN))
+ errx(1, "integer out of +-MAXPATHLEN (%d): %u",
+ MAXPATHLEN, abs(word) < abs(hword) ? word : hword);
+ return(hword);
+ }
+ return(word);
+}
diff --git a/usr.bin/lock/Makefile b/usr.bin/lock/Makefile
new file mode 100644
index 0000000..cc5d689
--- /dev/null
+++ b/usr.bin/lock/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= lock
+BINOWN= root
+BINMODE=4555
+
+LIBADD= crypt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lock/Makefile.depend b/usr.bin/lock/Makefile.depend
new file mode 100644
index 0000000..4d4fe05
--- /dev/null
+++ b/usr.bin/lock/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/lock/lock.1 b/usr.bin/lock/lock.1
new file mode 100644
index 0000000..9d7b0c6
--- /dev/null
+++ b/usr.bin/lock/lock.1
@@ -0,0 +1,84 @@
+.\" Copyright (c) 1987, 1990, 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.
+.\"
+.\" @(#)lock.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2002
+.Dt LOCK 1
+.Os
+.Sh NAME
+.Nm lock
+.Nd reserve a terminal
+.Sh SYNOPSIS
+.Nm
+.Op Fl npv
+.Op Fl t Ar timeout
+.Sh DESCRIPTION
+The
+.Nm
+utility requests a password from the user, reads it again for verification
+and then will normally not relinquish the terminal until the password is
+repeated.
+There are two other conditions under which it will terminate: it
+will timeout after some interval of time and it may be killed by someone
+with the appropriate permission.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl n
+Do not use a timeout value.
+Terminal will be locked forever.
+.It Fl p
+A password is not requested, instead the user's current login password
+is used.
+.It Fl t Ar timeout
+The time limit (default 15 minutes) is changed to
+.Ar timeout
+minutes.
+.It Fl v
+Disable switching virtual terminals while this terminal is locked.
+This option is implemented in a way similar to the
+.Fl S
+option of
+.Xr vidcontrol 1 ,
+and thus has the same restrictions.
+It is only available if the terminal in question is a
+.Xr syscons 4
+or
+.Xr vt 4
+virtual terminal.
+.El
+.Sh SEE ALSO
+.Xr vidcontrol 1 ,
+.Xr syscons 4 ,
+.Xr vt 4
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c
new file mode 100644
index 0000000..8c12946
--- /dev/null
+++ b/usr.bin/lock/lock.c
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 1980, 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Bob Toxen.
+ *
+ * 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[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Lock a terminal up until the given key is entered or the given
+ * interval times out.
+ *
+ * Timeout interval is by default TIMEOUT, it can be changed with
+ * an argument of the form -time where time is in minutes
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/signal.h>
+#include <sys/consio.h>
+
+#include <err.h>
+#include <ctype.h>
+#include <errno.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+
+#define TIMEOUT 15
+
+static void quit(int);
+static void bye(int);
+static void hi(int);
+static void usage(void);
+
+static struct timeval timeout;
+static struct timeval zerotime;
+static struct termios tty, ntty;
+static long nexttime; /* keep the timeout time */
+static int no_timeout; /* lock terminal forever */
+static int vtyunlock; /* Unlock flag and code. */
+
+/*ARGSUSED*/
+int
+main(int argc, char **argv)
+{
+ struct passwd *pw;
+ struct itimerval ntimer, otimer;
+ struct tm *timp;
+ time_t timval;
+ int ch, failures, sectimeout, usemine, vtylock;
+ char *ap, *cryptpw, *mypw, *ttynam, *tzn;
+ char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
+
+ openlog("lock", 0, LOG_AUTH);
+
+ sectimeout = TIMEOUT;
+ pw = NULL;
+ mypw = NULL;
+ usemine = 0;
+ no_timeout = 0;
+ vtylock = 0;
+ while ((ch = getopt(argc, argv, "npt:v")) != -1)
+ switch((char)ch) {
+ case 't':
+ if ((sectimeout = atoi(optarg)) <= 0)
+ errx(1, "illegal timeout value");
+ break;
+ case 'p':
+ usemine = 1;
+ if (!(pw = getpwuid(getuid())))
+ errx(1, "unknown uid %d", getuid());
+ mypw = strdup(pw->pw_passwd);
+ break;
+ case 'n':
+ no_timeout = 1;
+ break;
+ case 'v':
+ vtylock = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ timeout.tv_sec = sectimeout * 60;
+
+ /* discard privs */
+ if (setuid(getuid()) != 0)
+ errx(1, "setuid failed");
+
+ if (tcgetattr(0, &tty)) /* get information for header */
+ exit(1);
+ gethostname(hostname, sizeof(hostname));
+ if (!(ttynam = ttyname(0)))
+ errx(1, "not a terminal?");
+ if (strncmp(ttynam, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+ ttynam += strlen(_PATH_DEV);
+ timval = time(NULL);
+ nexttime = timval + (sectimeout * 60);
+ timp = localtime(&timval);
+ ap = asctime(timp);
+ tzn = timp->tm_zone;
+
+ (void)signal(SIGINT, quit);
+ (void)signal(SIGQUIT, quit);
+ ntty = tty; ntty.c_lflag &= ~ECHO;
+ (void)tcsetattr(0, TCSADRAIN|TCSASOFT, &ntty);
+
+ if (!mypw) {
+ /* get key and check again */
+ (void)printf("Key: ");
+ if (!fgets(s, sizeof(s), stdin) || *s == '\n')
+ quit(0);
+ (void)printf("\nAgain: ");
+ /*
+ * Don't need EOF test here, if we get EOF, then s1 != s
+ * and the right things will happen.
+ */
+ (void)fgets(s1, sizeof(s1), stdin);
+ (void)putchar('\n');
+ if (strcmp(s1, s)) {
+ (void)printf("\07lock: passwords didn't match.\n");
+ (void)tcsetattr(0, TCSADRAIN|TCSASOFT, &tty);
+ exit(1);
+ }
+ s[0] = '\0';
+ mypw = s1;
+ }
+
+ /* set signal handlers */
+ (void)signal(SIGINT, hi);
+ (void)signal(SIGQUIT, hi);
+ (void)signal(SIGTSTP, hi);
+ (void)signal(SIGALRM, bye);
+
+ ntimer.it_interval = zerotime;
+ ntimer.it_value = timeout;
+ if (!no_timeout)
+ setitimer(ITIMER_REAL, &ntimer, &otimer);
+ if (vtylock) {
+ /*
+ * If this failed, we want to err out; warn isn't good
+ * enough, since we don't want the user to think that
+ * everything is nice and locked because they got a
+ * "Key:" prompt.
+ */
+ if (ioctl(0, VT_LOCKSWITCH, &vtylock) == -1) {
+ (void)tcsetattr(0, TCSADRAIN|TCSASOFT, &tty);
+ err(1, "locking vty");
+ }
+ vtyunlock = 0x2;
+ }
+
+ /* header info */
+ if (pw != NULL)
+ (void)printf("lock: %s using %s on %s.", pw->pw_name,
+ ttynam, hostname);
+ else
+ (void)printf("lock: %s on %s.", ttynam, hostname);
+ if (no_timeout)
+ (void)printf(" no timeout.");
+ else
+ (void)printf(" timeout in %d minute%s.", sectimeout,
+ sectimeout != 1 ? "s" : "");
+ if (vtylock)
+ (void)printf(" vty locked.");
+ (void)printf("\ntime now is %.20s%s%s", ap, tzn, ap + 19);
+
+ failures = 0;
+
+ for (;;) {
+ (void)printf("Key: ");
+ if (!fgets(s, sizeof(s), stdin)) {
+ clearerr(stdin);
+ hi(0);
+ goto tryagain;
+ }
+ if (usemine) {
+ s[strlen(s) - 1] = '\0';
+ cryptpw = crypt(s, mypw);
+ if (cryptpw == NULL || !strcmp(mypw, cryptpw))
+ break;
+ }
+ else if (!strcmp(s, s1))
+ break;
+ (void)printf("\07\n");
+ failures++;
+ if (getuid() == 0)
+ syslog(LOG_NOTICE, "%d ROOT UNLOCK FAILURE%s (%s on %s)",
+ failures, failures > 1 ? "S": "", ttynam, hostname);
+tryagain:
+ if (tcgetattr(0, &ntty) && (errno != EINTR))
+ exit(1);
+ sleep(1); /* to discourage guessing */
+ }
+ if (getuid() == 0)
+ syslog(LOG_NOTICE, "ROOT UNLOCK ON hostname %s port %s",
+ hostname, ttynam);
+ quit(0);
+ return(0); /* not reached */
+}
+
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: lock [-npv] [-t timeout]\n");
+ exit(1);
+}
+
+static void
+hi(int signo __unused)
+{
+ time_t timval;
+
+ timval = time(NULL);
+ (void)printf("lock: type in the unlock key. ");
+ if (no_timeout) {
+ (void)putchar('\n');
+ } else {
+ (void)printf("timeout in %jd:%jd minutes\n",
+ (intmax_t)(nexttime - timval) / 60,
+ (intmax_t)(nexttime - timval) % 60);
+ }
+}
+
+static void
+quit(int signo __unused)
+{
+ (void)putchar('\n');
+ (void)tcsetattr(0, TCSADRAIN|TCSASOFT, &tty);
+ if (vtyunlock)
+ (void)ioctl(0, VT_LOCKSWITCH, &vtyunlock);
+ exit(0);
+}
+
+static void
+bye(int signo __unused)
+{
+ if (!no_timeout) {
+ (void)tcsetattr(0, TCSADRAIN|TCSASOFT, &tty);
+ if (vtyunlock)
+ (void)ioctl(0, VT_LOCKSWITCH, &vtyunlock);
+ (void)printf("lock: timeout\n");
+ exit(1);
+ }
+}
diff --git a/usr.bin/lockf/Makefile b/usr.bin/lockf/Makefile
new file mode 100644
index 0000000..7baff7c
--- /dev/null
+++ b/usr.bin/lockf/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= lockf
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lockf/Makefile.depend b/usr.bin/lockf/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/lockf/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/lockf/lockf.1 b/usr.bin/lockf/lockf.1
new file mode 100644
index 0000000..e6204a1
--- /dev/null
+++ b/usr.bin/lockf/lockf.1
@@ -0,0 +1,173 @@
+.\"
+.\" Copyright (C) 1998 John D. Polstra. 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 JOHN D. POLSTRA 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 JOHN D. POLSTRA 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 7, 1998
+.Dt LOCKF 1
+.Os
+.Sh NAME
+.Nm lockf
+.Nd execute a command while holding a file lock
+.Sh SYNOPSIS
+.Nm
+.Op Fl kns
+.Op Fl t Ar seconds
+.Ar file
+.Ar command
+.Op Ar arguments
+.Sh DESCRIPTION
+The
+.Nm
+utility acquires an exclusive lock on a
+.Ar file ,
+creating it if necessary,
+.Bf Em
+and removing the file on exit unless explicitly told not to.
+.Ef
+While holding the lock, it executes a
+.Ar command
+with optional
+.Ar arguments .
+After the
+.Ar command
+completes,
+.Nm
+releases the lock, and removes the
+.Ar file
+unless the
+.Fl k
+option is specified.
+.Bx Ns -style
+locking is used, as described in
+.Xr flock 2 ;
+the mere existence of the
+.Ar file
+is not considered to constitute a lock.
+.Pp
+If the
+.Nm
+utility is being used to facilitate concurrency between a number
+of processes, it is recommended that the
+.Fl k
+option be used.
+This will guarantee lock ordering, as well as implement
+a performance enhanced algorithm which minimizes CPU load associated
+with concurrent unlink, drop and re-acquire activity.
+It should be noted
+that if the
+.Fl k
+option is not used, then no guarantees around lock ordering can be made.
+.Pp
+The following options are supported:
+.Bl -tag -width ".Fl t Ar seconds"
+.It Fl k
+Causes the lock file to be kept (not removed) after the command
+completes.
+.It Fl s
+Causes
+.Nm
+to operate silently.
+Failure to acquire the lock is indicated only in the exit status.
+.It Fl n
+Causes
+.Nm
+to fail if the specified lock
+.Ar file
+does not exist. If
+.Fl n
+is not specified,
+.Nm
+will create
+.Ar file
+if necessary.
+.It Fl t Ar seconds
+Specifies a timeout for waiting for the lock.
+By default,
+.Nm
+waits indefinitely to acquire the lock.
+If a timeout is specified with this option,
+.Nm
+will wait at most the given number of
+.Ar seconds
+before giving up.
+A timeout of 0 may be given, in which case
+.Nm
+will fail unless it can acquire the lock immediately.
+When a lock times out,
+.Ar command
+is
+.Em not
+executed.
+.El
+.Pp
+In no event will
+.Nm
+break a lock that is held by another process.
+.Sh EXIT STATUS
+If
+.Nm
+successfully acquires the lock, it returns the exit status produced by
+.Ar command .
+Otherwise, it returns one of the exit codes defined in
+.Xr sysexits 3 ,
+as follows:
+.Bl -tag -width ".Dv EX_CANTCREAT"
+.It Dv EX_TEMPFAIL
+The specified lock file was already locked by another process.
+.It Dv EX_CANTCREAT
+The
+.Nm
+utility
+was unable to create the lock file, e.g., because of insufficient access
+privileges.
+.It Dv EX_UNAVAILABLE
+The
+.Fl n
+option is specified and the specified lock file does not exist.
+.It Dv EX_USAGE
+There was an error on the
+.Nm
+command line.
+.It Dv EX_OSERR
+A system call (e.g.,
+.Xr fork 2 )
+failed unexpectedly.
+.It Dv EX_SOFTWARE
+The
+.Ar command
+did not exit normally,
+but may have been signaled or stopped.
+.El
+.Sh SEE ALSO
+.Xr flock 2 ,
+.Xr lockf 3 ,
+.Xr sysexits 3
+.Sh HISTORY
+A
+.Nm
+utility first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An John Polstra Aq Mt jdp@polstra.com
diff --git a/usr.bin/lockf/lockf.c b/usr.bin/lockf/lockf.c
new file mode 100644
index 0000000..5555c48
--- /dev/null
+++ b/usr.bin/lockf/lockf.c
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 1997 John D. Polstra. 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 JOHN D. POLSTRA 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 JOHN D. POLSTRA 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/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+static int acquire_lock(const char *name, int flags);
+static void cleanup(void);
+static void killed(int sig);
+static void timeout(int sig);
+static void usage(void);
+static void wait_for_lock(const char *name);
+
+static const char *lockname;
+static int lockfd = -1;
+static int keep;
+static volatile sig_atomic_t timed_out;
+
+/*
+ * Execute an arbitrary command while holding a file lock.
+ */
+int
+main(int argc, char **argv)
+{
+ int ch, flags, silent, status, waitsec;
+ pid_t child;
+
+ silent = keep = 0;
+ flags = O_CREAT;
+ waitsec = -1; /* Infinite. */
+ while ((ch = getopt(argc, argv, "sknt:")) != -1) {
+ switch (ch) {
+ case 'k':
+ keep = 1;
+ break;
+ case 'n':
+ flags &= ~O_CREAT;
+ break;
+ case 's':
+ silent = 1;
+ break;
+ case 't':
+ {
+ char *endptr;
+ waitsec = strtol(optarg, &endptr, 0);
+ if (*optarg == '\0' || *endptr != '\0' || waitsec < 0)
+ errx(EX_USAGE,
+ "invalid timeout \"%s\"", optarg);
+ }
+ break;
+ default:
+ usage();
+ }
+ }
+ if (argc - optind < 2)
+ usage();
+ lockname = argv[optind++];
+ argc -= optind;
+ argv += optind;
+ if (waitsec > 0) { /* Set up a timeout. */
+ struct sigaction act;
+
+ act.sa_handler = timeout;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
+ sigaction(SIGALRM, &act, NULL);
+ alarm(waitsec);
+ }
+ /*
+ * If the "-k" option is not given, then we must not block when
+ * acquiring the lock. If we did, then the lock holder would
+ * unlink the file upon releasing the lock, and we would acquire
+ * a lock on a file with no directory entry. Then another
+ * process could come along and acquire the same lock. To avoid
+ * this problem, we separate out the actions of waiting for the
+ * lock to be available and of actually acquiring the lock.
+ *
+ * That approach produces behavior that is technically correct;
+ * however, it causes some performance & ordering problems for
+ * locks that have a lot of contention. First, it is unfair in
+ * the sense that a released lock isn't necessarily granted to
+ * the process that has been waiting the longest. A waiter may
+ * be starved out indefinitely. Second, it creates a thundering
+ * herd situation each time the lock is released.
+ *
+ * When the "-k" option is used, the unlink race no longer
+ * exists. In that case we can block while acquiring the lock,
+ * avoiding the separate step of waiting for the lock. This
+ * yields fairness and improved performance.
+ */
+ lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
+ while (lockfd == -1 && !timed_out && waitsec != 0) {
+ if (keep)
+ lockfd = acquire_lock(lockname, flags);
+ else {
+ wait_for_lock(lockname);
+ lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
+ }
+ }
+ if (waitsec > 0)
+ alarm(0);
+ if (lockfd == -1) { /* We failed to acquire the lock. */
+ if (silent)
+ exit(EX_TEMPFAIL);
+ errx(EX_TEMPFAIL, "%s: already locked", lockname);
+ }
+ /* At this point, we own the lock. */
+ if (atexit(cleanup) == -1)
+ err(EX_OSERR, "atexit failed");
+ if ((child = fork()) == -1)
+ err(EX_OSERR, "cannot fork");
+ if (child == 0) { /* The child process. */
+ close(lockfd);
+ execvp(argv[0], argv);
+ warn("%s", argv[0]);
+ _exit(1);
+ }
+ /* This is the parent process. */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ signal(SIGTERM, killed);
+ if (waitpid(child, &status, 0) == -1)
+ err(EX_OSERR, "waitpid failed");
+ return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
+}
+
+/*
+ * Try to acquire a lock on the given file, creating the file if
+ * necessary. The flags argument is O_NONBLOCK or 0, depending on
+ * whether we should wait for the lock. Returns an open file descriptor
+ * on success, or -1 on failure.
+ */
+static int
+acquire_lock(const char *name, int flags)
+{
+ int fd;
+
+ if ((fd = open(name, O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
+ if (errno == EAGAIN || errno == EINTR)
+ return (-1);
+ err(EX_CANTCREAT, "cannot open %s", name);
+ }
+ return (fd);
+}
+
+/*
+ * Remove the lock file.
+ */
+static void
+cleanup(void)
+{
+
+ if (keep)
+ flock(lockfd, LOCK_UN);
+ else
+ unlink(lockname);
+}
+
+/*
+ * Signal handler for SIGTERM. Cleans up the lock file, then re-raises
+ * the signal.
+ */
+static void
+killed(int sig)
+{
+
+ cleanup();
+ signal(sig, SIG_DFL);
+ if (kill(getpid(), sig) == -1)
+ err(EX_OSERR, "kill failed");
+}
+
+/*
+ * Signal handler for SIGALRM.
+ */
+static void
+timeout(int sig __unused)
+{
+
+ timed_out = 1;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: lockf [-kns] [-t seconds] file command [arguments]\n");
+ exit(EX_USAGE);
+}
+
+/*
+ * Wait until it might be possible to acquire a lock on the given file.
+ * If the file does not exist, return immediately without creating it.
+ */
+static void
+wait_for_lock(const char *name)
+{
+ int fd;
+
+ if ((fd = open(name, O_RDONLY|O_EXLOCK, 0666)) == -1) {
+ if (errno == ENOENT || errno == EINTR)
+ return;
+ err(EX_CANTCREAT, "cannot open %s", name);
+ }
+ close(fd);
+}
diff --git a/usr.bin/logger/Makefile b/usr.bin/logger/Makefile
new file mode 100644
index 0000000..cbdd0b4
--- /dev/null
+++ b/usr.bin/logger/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= logger
+
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/logger/Makefile.depend b/usr.bin/logger/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/logger/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/logger/logger.1 b/usr.bin/logger/logger.1
new file mode 100644
index 0000000..f82bc44
--- /dev/null
+++ b/usr.bin/logger/logger.1
@@ -0,0 +1,130 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)logger.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 21, 2015
+.Dt LOGGER 1
+.Os
+.Sh NAME
+.Nm logger
+.Nd make entries in the system log
+.Sh SYNOPSIS
+.Nm
+.Op Fl 46Ais
+.Op Fl f Ar file
+.Op Fl h Ar host
+.Op Fl P Ar port
+.Op Fl p Ar pri
+.Op Fl t Ar tag
+.Op Ar message ...
+.Sh DESCRIPTION
+The
+.Nm
+utility provides a shell command interface to the
+.Xr syslog 3
+system log module.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl 4
+Force
+.Nm
+to use IPv4 addresses only.
+.It Fl 6
+Force
+.Nm
+to use IPv6 addresses only.
+.It Fl A
+By default,
+.Nm
+tries to send the message to only one address,
+even if the host has more than one A or AAAA record.
+If this option is specified,
+.Nm
+tries to send the message to all addresses.
+.It Fl i
+Log the process id of the logger process
+with each line.
+.It Fl s
+Log the message to standard error, as well as the system log.
+.It Fl f Ar file
+Read the contents of the specified file into syslog.
+This option is ignored when a message is also specified.
+.It Fl h Ar host
+Send the message to the remote system
+.Ar host
+instead of logging it locally.
+.It Fl P Ar port
+Send the message to the specified
+.Ar port
+number on a remote system,
+which can be specified as a service name
+or as a decimal number.
+The default is
+.Dq Li syslog .
+If an unknown service name is used,
+.Nm
+prints a warning and falls back to port 514.
+.It Fl p Ar pri
+Enter the message with the specified priority.
+The priority may be specified numerically or as a ``facility.level''
+pair.
+For example, ``\-p local3.info'' logs the message(s) as
+.Ar info Ns rmational
+level in the
+.Ar local3
+facility.
+The default is ``user.notice.''
+.It Fl t Ar tag
+Mark every line in the log with the specified
+.Ar tag
+rather than the default of current login name.
+.It Ar message
+Write the message to log; if not specified, and the
+.Fl f
+flag is not
+provided, standard input is logged.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Bd -literal -offset indent -compact
+logger System rebooted
+
+logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
+.Ed
+.Sh SEE ALSO
+.Xr syslog 3 ,
+.Xr syslogd 8
+.Sh STANDARDS
+The
+.Nm
+command is expected to be
+.St -p1003.2
+compatible.
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
new file mode 100644
index 0000000..49360f4
--- /dev/null
+++ b/usr.bin/logger/logger.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 1983, 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) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define SYSLOG_NAMES
+#include <syslog.h>
+
+static int decode(char *, const CODE *);
+static int pencode(char *);
+static void logmessage(int, const char *, const char *, const char *,
+ const char *);
+static void usage(void);
+
+struct socks {
+ int sock;
+ int addrlen;
+ struct sockaddr_storage addr;
+};
+
+#ifdef INET6
+static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
+#else
+static int family = PF_INET; /* protocol family (IPv4 only) */
+#endif
+static int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
+
+/*
+ * logger -- read and log utility
+ *
+ * Reads from an input and arranges to write the result on the system
+ * log.
+ */
+int
+main(int argc, char *argv[])
+{
+ int ch, logflags, pri;
+ char *tag, *host, buf[1024];
+ const char *svcname;
+
+ tag = NULL;
+ host = NULL;
+ svcname = "syslog";
+ pri = LOG_USER | LOG_NOTICE;
+ logflags = 0;
+ unsetenv("TZ");
+ while ((ch = getopt(argc, argv, "46Af:h:iP:p:st:")) != -1)
+ switch((char)ch) {
+ case '4':
+ family = PF_INET;
+ break;
+#ifdef INET6
+ case '6':
+ family = PF_INET6;
+ break;
+#endif
+ case 'A':
+ send_to_all++;
+ break;
+ case 'f': /* file to log */
+ if (freopen(optarg, "r", stdin) == NULL)
+ err(1, "%s", optarg);
+ setvbuf(stdin, 0, _IONBF, 0);
+ break;
+ case 'h': /* hostname to deliver to */
+ host = optarg;
+ break;
+ case 'i': /* log process id also */
+ logflags |= LOG_PID;
+ break;
+ case 'P': /* service name or port number */
+ svcname = optarg;
+ break;
+ case 'p': /* priority */
+ pri = pencode(optarg);
+ break;
+ case 's': /* log to standard error */
+ logflags |= LOG_PERROR;
+ break;
+ case 't': /* tag */
+ tag = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (tag == NULL)
+ tag = getlogin();
+ /* setup for logging */
+ if (host == NULL)
+ openlog(tag, logflags, 0);
+ (void) fclose(stdout);
+
+ /* log input line if appropriate */
+ if (argc > 0) {
+ char *p, *endp;
+ size_t len;
+
+ for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) {
+ len = strlen(*argv);
+ if (p + len > endp && p > buf) {
+ logmessage(pri, tag, host, svcname, buf);
+ p = buf;
+ }
+ if (len > sizeof(buf) - 1)
+ logmessage(pri, tag, host, svcname, *argv++);
+ else {
+ if (p != buf)
+ *p++ = ' ';
+ bcopy(*argv++, p, len);
+ *(p += len) = '\0';
+ }
+ }
+ if (p != buf)
+ logmessage(pri, tag, host, svcname, buf);
+ } else
+ while (fgets(buf, sizeof(buf), stdin) != NULL)
+ logmessage(pri, tag, host, svcname, buf);
+ exit(0);
+}
+
+/*
+ * Send the message to syslog, either on the local host, or on a remote host
+ */
+static void
+logmessage(int pri, const char *tag, const char *host, const char *svcname,
+ const char *buf)
+{
+ static struct socks *socks;
+ static int nsock = 0;
+ struct addrinfo hints, *res, *r;
+ char *line;
+ int maxs, len, sock, error, i, lsent;
+
+ if (host == NULL) {
+ syslog(pri, "%s", buf);
+ return;
+ }
+
+ if (nsock <= 0) { /* set up socket stuff */
+ /* resolve hostname */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = family;
+ hints.ai_socktype = SOCK_DGRAM;
+ error = getaddrinfo(host, svcname, &hints, &res);
+ if (error == EAI_SERVICE) {
+ warnx("%s/udp: unknown service", svcname);
+ error = getaddrinfo(host, "514", &hints, &res);
+ }
+ if (error)
+ errx(1, "%s: %s", gai_strerror(error), host);
+ /* count max number of sockets we may open */
+ for (maxs = 0, r = res; r; r = r->ai_next, maxs++);
+ socks = malloc(maxs * sizeof(struct socks));
+ if (!socks)
+ errx(1, "couldn't allocate memory for sockets");
+ for (r = res; r; r = r->ai_next) {
+ sock = socket(r->ai_family, r->ai_socktype,
+ r->ai_protocol);
+ if (sock < 0)
+ continue;
+ memcpy(&socks[nsock].addr, r->ai_addr, r->ai_addrlen);
+ socks[nsock].addrlen = r->ai_addrlen;
+ socks[nsock++].sock = sock;
+ }
+ freeaddrinfo(res);
+ if (nsock <= 0)
+ errx(1, "socket");
+ }
+
+ if ((len = asprintf(&line, "<%d>%s: %s", pri, tag, buf)) == -1)
+ errx(1, "asprintf");
+
+ lsent = -1;
+ for (i = 0; i < nsock; ++i) {
+ lsent = sendto(socks[i].sock, line, len, 0,
+ (struct sockaddr *)&socks[i].addr,
+ socks[i].addrlen);
+ if (lsent == len && !send_to_all)
+ break;
+ }
+ if (lsent != len) {
+ if (lsent == -1)
+ warn ("sendto");
+ else
+ warnx ("sendto: short send - %d bytes", lsent);
+ }
+
+ free(line);
+}
+
+/*
+ * Decode a symbolic name to a numeric value
+ */
+static int
+pencode(char *s)
+{
+ char *save;
+ int fac, lev;
+
+ for (save = s; *s && *s != '.'; ++s);
+ if (*s) {
+ *s = '\0';
+ fac = decode(save, facilitynames);
+ if (fac < 0)
+ errx(1, "unknown facility name: %s", save);
+ *s++ = '.';
+ }
+ else {
+ fac = 0;
+ s = save;
+ }
+ lev = decode(s, prioritynames);
+ if (lev < 0)
+ errx(1, "unknown priority name: %s", save);
+ return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
+}
+
+static int
+decode(char *name, const CODE *codetab)
+{
+ const CODE *c;
+
+ if (isdigit(*name))
+ return (atoi(name));
+
+ for (c = codetab; c->c_name; c++)
+ if (!strcasecmp(name, c->c_name))
+ return (c->c_val);
+
+ return (-1);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: %s\n",
+ "logger [-46Ais] [-f file] [-h host] [-P port] [-p pri] [-t tag]\n"
+ " [message ...]"
+ );
+ exit(1);
+}
diff --git a/usr.bin/login/Makefile b/usr.bin/login/Makefile
new file mode 100644
index 0000000..0763c84
--- /dev/null
+++ b/usr.bin/login/Makefile
@@ -0,0 +1,25 @@
+# @(#)Makefile 8.1 (Berkeley) 7/19/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= login
+SRCS= login.c login_fbtab.c
+CFLAGS+=-DLOGALL
+LIBADD= util pam
+
+WARNS?= 5
+
+.if ${MK_AUDIT} != "no"
+SRCS+= login_audit.c
+CFLAGS+= -DUSE_BSM_AUDIT
+LIBADD+= bsm
+.endif
+
+.if ${MK_SETUID_LOGIN} != "no"
+BINOWN= root
+BINMODE=4555
+PRECIOUSPROG=
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/login/Makefile.depend b/usr.bin/login/Makefile.depend
new file mode 100644
index 0000000..85813bf
--- /dev/null
+++ b/usr.bin/login/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbsm \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libpam/libpam \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/login/README b/usr.bin/login/README
new file mode 100644
index 0000000..192534d
--- /dev/null
+++ b/usr.bin/login/README
@@ -0,0 +1,12 @@
+This login has additional functionalities. They are all based on (part of)
+Wietse Venema's logdaemon package.
+
+
+The following defines can be used:
+
+- LOGALL to log all logins
+
+
+-Guido
+
+$FreeBSD$
diff --git a/usr.bin/login/login.1 b/usr.bin/login/login.1
new file mode 100644
index 0000000..a1a283a
--- /dev/null
+++ b/usr.bin/login/login.1
@@ -0,0 +1,164 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)login.1 8.2 (Berkeley) 5/5/94
+.\" $FreeBSD$
+.\"
+.Dd September 13, 2006
+.Dt LOGIN 1
+.Os
+.Sh NAME
+.Nm login
+.Nd log into the computer
+.Sh SYNOPSIS
+.Nm
+.Op Fl fp
+.Op Fl h Ar hostname
+.Op Ar user
+.Sh DESCRIPTION
+The
+.Nm
+utility logs users (and pseudo-users) into the computer system.
+.Pp
+If no user is specified, or if a user is specified and authentication
+of the user fails,
+.Nm
+prompts for a user name.
+Authentication of users is configurable via
+.Xr pam 8 .
+Password authentication is the default.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl f
+When a user name is specified, this option indicates that proper
+authentication has already been done and that no password need be
+requested.
+This option may only be used by the super-user or when an already
+logged in user is logging in as themselves.
+.It Fl h
+Specify the host from which the connection was received.
+It is used by various daemons such as
+.Xr telnetd 8 .
+This option may only be used by the super-user.
+.It Fl p
+By default,
+.Nm
+discards any previous environment.
+The
+.Fl p
+option disables this behavior.
+.El
+.Pp
+Login access can be controlled via
+.Xr login.access 5
+or the login class in
+.Xr login.conf 5 ,
+which provides
+allow and deny records based on time, tty and remote host name.
+.Pp
+If the file
+.Pa /etc/fbtab
+exists,
+.Nm
+changes the protection and ownership of certain devices specified in this
+file.
+.Pp
+Immediately after logging a user in,
+.Nm
+displays the system copyright notice, the date and time the user last
+logged in, the message of the day as well as other information.
+If the file
+.Pa .hushlogin
+exists in the user's home directory, all of these messages are suppressed.
+This is to simplify logins for non-human users, such as
+.Xr uucp 1 .
+.Pp
+The
+.Nm
+utility enters information into the environment (see
+.Xr environ 7 )
+specifying the user's home directory (HOME), command interpreter (SHELL),
+search path (PATH), terminal type (TERM) and user name (both LOGNAME and
+USER).
+Other environment variables may be set due to entries in the login
+class capabilities database, for the login class assigned in the
+user's system passwd record.
+The login class also controls the maximum and current process resource
+limits granted to a login, process priorities and many other aspects of
+a user's login environment.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Pp
+The
+.Nm
+utility will submit an audit record when login succeeds or fails.
+Failure to determine the current auditing state will
+result in an error exit from
+.Nm .
+.Sh FILES
+.Bl -tag -width ".Pa /etc/security/audit_control" -compact
+.It Pa /etc/fbtab
+changes device protections
+.It Pa /etc/login.conf
+login class capabilities database
+.It Pa /etc/motd
+message-of-the-day
+.It Pa /var/mail/user
+system mailboxes
+.It Pa \&.hushlogin
+makes login quieter
+.It Pa /etc/pam.d/login
+.Xr pam 8
+configuration file
+.It Pa /etc/security/audit_user
+user flags for auditing
+.It Pa /etc/security/audit_control
+global flags for auditing
+.El
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr chpass 1 ,
+.Xr csh 1 ,
+.Xr newgrp 1 ,
+.Xr passwd 1 ,
+.Xr rlogin 1 ,
+.Xr getpass 3 ,
+.Xr fbtab 5 ,
+.Xr login.access 5 ,
+.Xr login.conf 5 ,
+.Xr environ 7
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v6 .
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
new file mode 100644
index 0000000..525ccfc
--- /dev/null
+++ b/usr.bin/login/login.c
@@ -0,0 +1,1033 @@
+/*-
+ * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technologies, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * login [ name ]
+ * login -h hostname (for telnetd, etc.)
+ * login -f name (for pre-authenticated login: datakit, xterm, etc.)
+ */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <login_cap.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <ttyent.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+#include <security/openpam.h>
+
+#include "login.h"
+#include "pathnames.h"
+
+static int auth_pam(void);
+static void bail(int, int);
+static void bail_internal(int, int, int);
+static int export(const char *);
+static void export_pam_environment(void);
+static int motd(const char *);
+static void badlogin(char *);
+static char *getloginname(void);
+static void pam_syslog(const char *);
+static void pam_cleanup(void);
+static void refused(const char *, const char *, int);
+static const char *stypeof(char *);
+static void sigint(int);
+static void timedout(int);
+static void bail_sig(int);
+static void usage(void);
+
+#define TTYGRPNAME "tty" /* group to own ttys */
+#define DEFAULT_BACKOFF 3
+#define DEFAULT_RETRIES 10
+#define DEFAULT_PROMPT "login: "
+#define DEFAULT_PASSWD_PROMPT "Password:"
+#define TERM_UNKNOWN "su"
+#define DEFAULT_WARN (2L * 7L * 86400L) /* Two weeks */
+#define NO_SLEEP_EXIT 0
+#define SLEEP_EXIT 5
+
+/*
+ * This bounds the time given to login. Not a define so it can
+ * be patched on machines where it's too small.
+ */
+static u_int timeout = 300;
+
+/* Buffer for signal handling of timeout */
+static jmp_buf timeout_buf;
+
+struct passwd *pwd;
+static int failures;
+
+static char *envinit[1]; /* empty environment list */
+
+/*
+ * Command line flags and arguments
+ */
+static int fflag; /* -f: do not perform authentication */
+static int hflag; /* -h: login from remote host */
+static char *hostname; /* hostname from command line */
+static int pflag; /* -p: preserve environment */
+
+/*
+ * User name
+ */
+static char *username; /* user name */
+static char *olduser; /* previous user name */
+
+/*
+ * Prompts
+ */
+static char default_prompt[] = DEFAULT_PROMPT;
+static const char *prompt;
+static char default_passwd_prompt[] = DEFAULT_PASSWD_PROMPT;
+static const char *passwd_prompt;
+
+static char *tty;
+
+/*
+ * PAM data
+ */
+static pam_handle_t *pamh = NULL;
+static struct pam_conv pamc = { openpam_ttyconv, NULL };
+static int pam_err;
+static int pam_silent = PAM_SILENT;
+static int pam_cred_established;
+static int pam_session_established;
+
+int
+main(int argc, char *argv[])
+{
+ struct group *gr;
+ struct stat st;
+ int retries, backoff;
+ int ask, ch, cnt, quietlog, rootlogin, rval;
+ uid_t uid, euid;
+ gid_t egid;
+ char *term;
+ char *p, *ttyn;
+ char tname[sizeof(_PATH_TTY) + 10];
+ char *arg0;
+ const char *tp;
+ const char *shell = NULL;
+ login_cap_t *lc = NULL;
+ login_cap_t *lc_user = NULL;
+ pid_t pid;
+ sigset_t mask, omask;
+ struct sigaction sa;
+#ifdef USE_BSM_AUDIT
+ char auditsuccess = 1;
+#endif
+
+ sa.sa_flags = SA_RESTART;
+ (void)sigfillset(&sa.sa_mask);
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGQUIT, &sa, NULL);
+ (void)sigaction(SIGINT, &sa, NULL);
+ (void)sigaction(SIGHUP, &sa, NULL);
+ if (setjmp(timeout_buf)) {
+ if (failures)
+ badlogin(username);
+ (void)fprintf(stderr, "Login timed out after %d seconds\n",
+ timeout);
+ bail(NO_SLEEP_EXIT, 0);
+ }
+ sa.sa_handler = timedout;
+ (void)sigaction(SIGALRM, &sa, NULL);
+ (void)alarm(timeout);
+ (void)setpriority(PRIO_PROCESS, 0, 0);
+
+ openlog("login", 0, LOG_AUTH);
+
+ uid = getuid();
+ euid = geteuid();
+ egid = getegid();
+
+ while ((ch = getopt(argc, argv, "fh:p")) != -1)
+ switch (ch) {
+ case 'f':
+ fflag = 1;
+ break;
+ case 'h':
+ if (uid != 0)
+ errx(1, "-h option: %s", strerror(EPERM));
+ if (strlen(optarg) >= MAXHOSTNAMELEN)
+ errx(1, "-h option: %s: exceeds maximum "
+ "hostname size", optarg);
+ hflag = 1;
+ hostname = optarg;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case '?':
+ default:
+ if (uid == 0)
+ syslog(LOG_ERR, "invalid flag %c", ch);
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0) {
+ username = strdup(*argv);
+ if (username == NULL)
+ err(1, "strdup()");
+ ask = 0;
+ } else {
+ ask = 1;
+ }
+
+ setproctitle("-%s", getprogname());
+
+ closefrom(3);
+
+ /*
+ * Get current TTY
+ */
+ ttyn = ttyname(STDIN_FILENO);
+ if (ttyn == NULL || *ttyn == '\0') {
+ (void)snprintf(tname, sizeof(tname), "%s??", _PATH_TTY);
+ ttyn = tname;
+ }
+ if (strncmp(ttyn, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
+ tty = ttyn + sizeof _PATH_DEV - 1;
+ else
+ tty = ttyn;
+
+ /*
+ * Get "login-retries" & "login-backoff" from default class
+ */
+ lc = login_getclass(NULL);
+ prompt = login_getcapstr(lc, "login_prompt",
+ default_prompt, default_prompt);
+ passwd_prompt = login_getcapstr(lc, "passwd_prompt",
+ default_passwd_prompt, default_passwd_prompt);
+ retries = login_getcapnum(lc, "login-retries",
+ DEFAULT_RETRIES, DEFAULT_RETRIES);
+ backoff = login_getcapnum(lc, "login-backoff",
+ DEFAULT_BACKOFF, DEFAULT_BACKOFF);
+ login_close(lc);
+ lc = NULL;
+
+ /*
+ * Try to authenticate the user until we succeed or time out.
+ */
+ for (cnt = 0;; ask = 1) {
+ if (ask) {
+ fflag = 0;
+ if (olduser != NULL)
+ free(olduser);
+ olduser = username;
+ username = getloginname();
+ }
+ rootlogin = 0;
+
+ /*
+ * Note if trying multiple user names; log failures for
+ * previous user name, but don't bother logging one failure
+ * for nonexistent name (mistyped username).
+ */
+ if (failures && strcmp(olduser, username) != 0) {
+ if (failures > (pwd ? 0 : 1))
+ badlogin(olduser);
+ }
+
+ /*
+ * Load the PAM policy and set some variables
+ */
+ pam_err = pam_start("login", username, &pamc, &pamh);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_start()");
+#ifdef USE_BSM_AUDIT
+ au_login_fail("PAM Error", 1);
+#endif
+ bail(NO_SLEEP_EXIT, 1);
+ }
+ pam_err = pam_set_item(pamh, PAM_TTY, tty);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_set_item(PAM_TTY)");
+#ifdef USE_BSM_AUDIT
+ au_login_fail("PAM Error", 1);
+#endif
+ bail(NO_SLEEP_EXIT, 1);
+ }
+ pam_err = pam_set_item(pamh, PAM_RHOST, hostname);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_set_item(PAM_RHOST)");
+#ifdef USE_BSM_AUDIT
+ au_login_fail("PAM Error", 1);
+#endif
+ bail(NO_SLEEP_EXIT, 1);
+ }
+
+ pwd = getpwnam(username);
+ if (pwd != NULL && pwd->pw_uid == 0)
+ rootlogin = 1;
+
+ /*
+ * If the -f option was specified and the caller is
+ * root or the caller isn't changing their uid, don't
+ * authenticate.
+ */
+ if (pwd != NULL && fflag &&
+ (uid == (uid_t)0 || uid == (uid_t)pwd->pw_uid)) {
+ /* already authenticated */
+ rval = 0;
+#ifdef USE_BSM_AUDIT
+ auditsuccess = 0; /* opened a terminal window only */
+#endif
+ } else {
+ fflag = 0;
+ (void)setpriority(PRIO_PROCESS, 0, -4);
+ rval = auth_pam();
+ (void)setpriority(PRIO_PROCESS, 0, 0);
+ }
+
+ if (pwd && rval == 0)
+ break;
+
+ pam_cleanup();
+
+ /*
+ * We are not exiting here, but this corresponds to a failed
+ * login event, so set exitstatus to 1.
+ */
+#ifdef USE_BSM_AUDIT
+ au_login_fail("Login incorrect", 1);
+#endif
+
+ (void)printf("Login incorrect\n");
+ failures++;
+
+ pwd = NULL;
+
+ /*
+ * Allow up to 'retry' (10) attempts, but start
+ * backing off after 'backoff' (3) attempts.
+ */
+ if (++cnt > backoff) {
+ if (cnt >= retries) {
+ badlogin(username);
+ bail(SLEEP_EXIT, 1);
+ }
+ sleep((u_int)((cnt - backoff) * 5));
+ }
+ }
+
+ /* committed to login -- turn off timeout */
+ (void)alarm((u_int)0);
+
+ (void)sigemptyset(&mask);
+ (void)sigaddset(&mask, SIGHUP);
+ (void)sigaddset(&mask, SIGTERM);
+ (void)sigprocmask(SIG_BLOCK, &mask, &omask);
+ sa.sa_handler = bail_sig;
+ (void)sigaction(SIGHUP, &sa, NULL);
+ (void)sigaction(SIGTERM, &sa, NULL);
+
+ endpwent();
+
+#ifdef USE_BSM_AUDIT
+ /* Audit successful login. */
+ if (auditsuccess)
+ au_login_success();
+#endif
+
+ /*
+ * This needs to happen before login_getpwclass to support
+ * home directories on GSS-API authenticated NFS where the
+ * kerberos credentials need to be saved so that the kernel
+ * can authenticate to the NFS server.
+ */
+ pam_err = pam_setcred(pamh, pam_silent|PAM_ESTABLISH_CRED);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_setcred()");
+ bail(NO_SLEEP_EXIT, 1);
+ }
+ pam_cred_established = 1;
+
+ /*
+ * Establish the login class.
+ */
+ lc = login_getpwclass(pwd);
+ lc_user = login_getuserclass(pwd);
+
+ if (!(quietlog = login_getcapbool(lc_user, "hushlogin", 0)))
+ quietlog = login_getcapbool(lc, "hushlogin", 0);
+
+ /*
+ * Switching needed for NFS with root access disabled.
+ *
+ * XXX: This change fails to modify the additional groups for the
+ * process, and as such, may restrict rights normally granted
+ * through those groups.
+ */
+ (void)setegid(pwd->pw_gid);
+ (void)seteuid(rootlogin ? 0 : pwd->pw_uid);
+ if (!*pwd->pw_dir || chdir(pwd->pw_dir) < 0) {
+ if (login_getcapbool(lc, "requirehome", 0))
+ refused("Home directory not available", "HOMEDIR", 1);
+ if (chdir("/") < 0)
+ refused("Cannot find root directory", "ROOTDIR", 1);
+ if (!quietlog || *pwd->pw_dir)
+ printf("No home directory.\nLogging in with home = \"/\".\n");
+ pwd->pw_dir = strdup("/");
+ if (pwd->pw_dir == NULL) {
+ syslog(LOG_NOTICE, "strdup(): %m");
+ bail(SLEEP_EXIT, 1);
+ }
+ }
+ (void)seteuid(euid);
+ (void)setegid(egid);
+ if (!quietlog) {
+ quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0;
+ if (!quietlog)
+ pam_silent = 0;
+ }
+
+ shell = login_getcapstr(lc, "shell", pwd->pw_shell, pwd->pw_shell);
+ if (*pwd->pw_shell == '\0')
+ pwd->pw_shell = strdup(_PATH_BSHELL);
+ if (pwd->pw_shell == NULL) {
+ syslog(LOG_NOTICE, "strdup(): %m");
+ bail(SLEEP_EXIT, 1);
+ }
+ if (*shell == '\0') /* Not overridden */
+ shell = pwd->pw_shell;
+ if ((shell = strdup(shell)) == NULL) {
+ syslog(LOG_NOTICE, "strdup(): %m");
+ bail(SLEEP_EXIT, 1);
+ }
+
+ /*
+ * Set device protections, depending on what terminal the
+ * user is logged in. This feature is used on Suns to give
+ * console users better privacy.
+ */
+ login_fbtab(tty, pwd->pw_uid, pwd->pw_gid);
+
+ /*
+ * Clear flags of the tty. None should be set, and when the
+ * user sets them otherwise, this can cause the chown to fail.
+ * Since it isn't clear that flags are useful on character
+ * devices, we just clear them.
+ *
+ * We don't log in the case of EOPNOTSUPP because dev might be
+ * on NFS, which doesn't support chflags.
+ *
+ * We don't log in the EROFS because that means that /dev is on
+ * a read only file system and we assume that the permissions there
+ * are sane.
+ */
+ if (ttyn != tname && chflags(ttyn, 0))
+ if (errno != EOPNOTSUPP && errno != EROFS)
+ syslog(LOG_ERR, "chflags(%s): %m", ttyn);
+ if (ttyn != tname && chown(ttyn, pwd->pw_uid,
+ (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid))
+ if (errno != EROFS)
+ syslog(LOG_ERR, "chown(%s): %m", ttyn);
+
+#ifdef LOGALL
+ /*
+ * Syslog each successful login, so we don't have to watch
+ * hundreds of wtmp or lastlogin files.
+ */
+ if (hflag)
+ syslog(LOG_INFO, "login from %s on %s as %s",
+ hostname, tty, pwd->pw_name);
+ else
+ syslog(LOG_INFO, "login on %s as %s",
+ tty, pwd->pw_name);
+#endif
+
+ /*
+ * If fflag is on, assume caller/authenticator has logged root
+ * login.
+ */
+ if (rootlogin && fflag == 0) {
+ if (hflag)
+ syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s",
+ username, tty, hostname);
+ else
+ syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s",
+ username, tty);
+ }
+
+ /*
+ * Destroy environment unless user has requested its
+ * preservation - but preserve TERM in all cases
+ */
+ term = getenv("TERM");
+ if (!pflag)
+ environ = envinit;
+ if (term != NULL)
+ setenv("TERM", term, 0);
+
+ /*
+ * PAM modules might add supplementary groups during pam_setcred().
+ */
+ if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) != 0) {
+ syslog(LOG_ERR, "setusercontext() failed - exiting");
+ bail(NO_SLEEP_EXIT, 1);
+ }
+
+ pam_err = pam_setcred(pamh, pam_silent|PAM_REINITIALIZE_CRED);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_setcred()");
+ bail(NO_SLEEP_EXIT, 1);
+ }
+
+ pam_err = pam_open_session(pamh, pam_silent);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_open_session()");
+ bail(NO_SLEEP_EXIT, 1);
+ }
+ pam_session_established = 1;
+
+ /*
+ * We must fork() before setuid() because we need to call
+ * pam_close_session() as root.
+ */
+ pid = fork();
+ if (pid < 0) {
+ err(1, "fork");
+ } else if (pid != 0) {
+ /*
+ * Parent: wait for child to finish, then clean up
+ * session.
+ *
+ * If we get SIGHUP or SIGTERM, clean up the session
+ * and exit right away. This will make the terminal
+ * inaccessible and send SIGHUP to the foreground
+ * process group.
+ */
+ int status;
+ setproctitle("-%s [pam]", getprogname());
+ (void)sigprocmask(SIG_SETMASK, &omask, NULL);
+ waitpid(pid, &status, 0);
+ (void)sigprocmask(SIG_BLOCK, &mask, NULL);
+ bail(NO_SLEEP_EXIT, 0);
+ }
+
+ /*
+ * NOTICE: We are now in the child process!
+ */
+
+ /*
+ * Add any environment variables the PAM modules may have set.
+ */
+ export_pam_environment();
+
+ /*
+ * We're done with PAM now; our parent will deal with the rest.
+ */
+ pam_end(pamh, 0);
+ pamh = NULL;
+
+ /*
+ * We don't need to be root anymore, so set the login name and
+ * the UID.
+ */
+ if (setlogin(username) != 0) {
+ syslog(LOG_ERR, "setlogin(%s): %m - exiting", username);
+ bail(NO_SLEEP_EXIT, 1);
+ }
+ if (setusercontext(lc, pwd, pwd->pw_uid,
+ LOGIN_SETALL & ~(LOGIN_SETLOGIN|LOGIN_SETGROUP)) != 0) {
+ syslog(LOG_ERR, "setusercontext() failed - exiting");
+ exit(1);
+ }
+
+ (void)setenv("SHELL", pwd->pw_shell, 1);
+ (void)setenv("HOME", pwd->pw_dir, 1);
+ /* Overwrite "term" from login.conf(5) for any known TERM */
+ if (term == NULL && (tp = stypeof(tty)) != NULL)
+ (void)setenv("TERM", tp, 1);
+ else
+ (void)setenv("TERM", TERM_UNKNOWN, 0);
+ (void)setenv("LOGNAME", username, 1);
+ (void)setenv("USER", username, 1);
+ (void)setenv("PATH", rootlogin ? _PATH_STDPATH : _PATH_DEFPATH, 0);
+
+ if (!quietlog) {
+ const char *cw;
+
+ cw = login_getcapstr(lc, "welcome", NULL, NULL);
+ if (cw != NULL && access(cw, F_OK) == 0)
+ motd(cw);
+ else
+ motd(_PATH_MOTDFILE);
+
+ if (login_getcapbool(lc_user, "nocheckmail", 0) == 0 &&
+ login_getcapbool(lc, "nocheckmail", 0) == 0) {
+ char *cx;
+
+ /* $MAIL may have been set by class. */
+ cx = getenv("MAIL");
+ if (cx == NULL) {
+ asprintf(&cx, "%s/%s",
+ _PATH_MAILDIR, pwd->pw_name);
+ }
+ if (cx && stat(cx, &st) == 0 && st.st_size != 0)
+ (void)printf("You have %smail.\n",
+ (st.st_mtime > st.st_atime) ? "new " : "");
+ if (getenv("MAIL") == NULL)
+ free(cx);
+ }
+ }
+
+ login_close(lc_user);
+ login_close(lc);
+
+ sa.sa_handler = SIG_DFL;
+ (void)sigaction(SIGALRM, &sa, NULL);
+ (void)sigaction(SIGQUIT, &sa, NULL);
+ (void)sigaction(SIGINT, &sa, NULL);
+ (void)sigaction(SIGTERM, &sa, NULL);
+ (void)sigaction(SIGHUP, &sa, NULL);
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGTSTP, &sa, NULL);
+ (void)sigprocmask(SIG_SETMASK, &omask, NULL);
+
+ /*
+ * Login shells have a leading '-' in front of argv[0]
+ */
+ p = strrchr(pwd->pw_shell, '/');
+ if (asprintf(&arg0, "-%s", p ? p + 1 : pwd->pw_shell) >= MAXPATHLEN) {
+ syslog(LOG_ERR, "user: %s: shell exceeds maximum pathname size",
+ username);
+ errx(1, "shell exceeds maximum pathname size");
+ } else if (arg0 == NULL) {
+ err(1, "asprintf()");
+ }
+
+ execlp(shell, arg0, (char *)0);
+ err(1, "%s", shell);
+
+ /*
+ * That's it, folks!
+ */
+}
+
+/*
+ * Attempt to authenticate the user using PAM. Returns 0 if the user is
+ * authenticated, or 1 if not authenticated. If some sort of PAM system
+ * error occurs (e.g., the "/etc/pam.conf" file is missing) then this
+ * function returns -1. This can be used as an indication that we should
+ * fall back to a different authentication mechanism.
+ */
+static int
+auth_pam(void)
+{
+ const char *tmpl_user;
+ const void *item;
+ int rval;
+
+ pam_err = pam_authenticate(pamh, pam_silent);
+ switch (pam_err) {
+
+ case PAM_SUCCESS:
+ /*
+ * With PAM we support the concept of a "template"
+ * user. The user enters a login name which is
+ * authenticated by PAM, usually via a remote service
+ * such as RADIUS or TACACS+. If authentication
+ * succeeds, a different but related "template" name
+ * is used for setting the credentials, shell, and
+ * home directory. The name the user enters need only
+ * exist on the remote authentication server, but the
+ * template name must be present in the local password
+ * database.
+ *
+ * This is supported by two various mechanisms in the
+ * individual modules. However, from the application's
+ * point of view, the template user is always passed
+ * back as a changed value of the PAM_USER item.
+ */
+ pam_err = pam_get_item(pamh, PAM_USER, &item);
+ if (pam_err == PAM_SUCCESS) {
+ tmpl_user = (const char *)item;
+ if (strcmp(username, tmpl_user) != 0)
+ pwd = getpwnam(tmpl_user);
+ } else {
+ pam_syslog("pam_get_item(PAM_USER)");
+ }
+ rval = 0;
+ break;
+
+ case PAM_AUTH_ERR:
+ case PAM_USER_UNKNOWN:
+ case PAM_MAXTRIES:
+ rval = 1;
+ break;
+
+ default:
+ pam_syslog("pam_authenticate()");
+ rval = -1;
+ break;
+ }
+
+ if (rval == 0) {
+ pam_err = pam_acct_mgmt(pamh, pam_silent);
+ switch (pam_err) {
+ case PAM_SUCCESS:
+ break;
+ case PAM_NEW_AUTHTOK_REQD:
+ pam_err = pam_chauthtok(pamh,
+ pam_silent|PAM_CHANGE_EXPIRED_AUTHTOK);
+ if (pam_err != PAM_SUCCESS) {
+ pam_syslog("pam_chauthtok()");
+ rval = 1;
+ }
+ break;
+ default:
+ pam_syslog("pam_acct_mgmt()");
+ rval = 1;
+ break;
+ }
+ }
+
+ if (rval != 0) {
+ pam_end(pamh, pam_err);
+ pamh = NULL;
+ }
+ return (rval);
+}
+
+/*
+ * Export any environment variables PAM modules may have set
+ */
+static void
+export_pam_environment(void)
+{
+ char **pam_env;
+ char **pp;
+
+ pam_env = pam_getenvlist(pamh);
+ if (pam_env != NULL) {
+ for (pp = pam_env; *pp != NULL; pp++) {
+ (void)export(*pp);
+ free(*pp);
+ }
+ }
+}
+
+/*
+ * Perform sanity checks on an environment variable:
+ * - Make sure there is an '=' in the string.
+ * - Make sure the string doesn't run on too long.
+ * - Do not export certain variables. This list was taken from the
+ * Solaris pam_putenv(3) man page.
+ * Then export it.
+ */
+static int
+export(const char *s)
+{
+ static const char *noexport[] = {
+ "SHELL", "HOME", "LOGNAME", "MAIL", "CDPATH",
+ "IFS", "PATH", NULL
+ };
+ char *p;
+ const char **pp;
+ size_t n;
+
+ if (strlen(s) > 1024 || (p = strchr(s, '=')) == NULL)
+ return (0);
+ if (strncmp(s, "LD_", 3) == 0)
+ return (0);
+ for (pp = noexport; *pp != NULL; pp++) {
+ n = strlen(*pp);
+ if (s[n] == '=' && strncmp(s, *pp, n) == 0)
+ return (0);
+ }
+ *p = '\0';
+ (void)setenv(s, p + 1, 1);
+ *p = '=';
+ return (1);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: login [-fp] [-h hostname] [username]\n");
+ exit(1);
+}
+
+/*
+ * Prompt user and read login name from stdin.
+ */
+static char *
+getloginname(void)
+{
+ char *nbuf, *p;
+ int ch;
+
+ nbuf = malloc(MAXLOGNAME);
+ if (nbuf == NULL)
+ err(1, "malloc()");
+ do {
+ (void)printf("%s", prompt);
+ for (p = nbuf; (ch = getchar()) != '\n'; ) {
+ if (ch == EOF) {
+ badlogin(username);
+ bail(NO_SLEEP_EXIT, 0);
+ }
+ if (p < nbuf + MAXLOGNAME - 1)
+ *p++ = ch;
+ }
+ } while (p == nbuf);
+
+ *p = '\0';
+ if (nbuf[0] == '-') {
+ pam_silent = 0;
+ memmove(nbuf, nbuf + 1, strlen(nbuf));
+ } else {
+ pam_silent = PAM_SILENT;
+ }
+ return nbuf;
+}
+
+/*
+ * SIGINT handler for motd().
+ */
+static volatile int motdinterrupt;
+static void
+sigint(int signo __unused)
+{
+ motdinterrupt = 1;
+}
+
+/*
+ * Display the contents of a file (such as /etc/motd).
+ */
+static int
+motd(const char *motdfile)
+{
+ struct sigaction newint, oldint;
+ FILE *f;
+ int ch;
+
+ if ((f = fopen(motdfile, "r")) == NULL)
+ return (-1);
+ motdinterrupt = 0;
+ newint.sa_handler = sigint;
+ newint.sa_flags = 0;
+ sigfillset(&newint.sa_mask);
+ sigaction(SIGINT, &newint, &oldint);
+ while ((ch = fgetc(f)) != EOF && !motdinterrupt)
+ putchar(ch);
+ sigaction(SIGINT, &oldint, NULL);
+ if (ch != EOF || ferror(f)) {
+ fclose(f);
+ return (-1);
+ }
+ fclose(f);
+ return (0);
+}
+
+/*
+ * SIGALRM handler, to enforce login prompt timeout.
+ *
+ * XXX This can potentially confuse the hell out of PAM. We should
+ * XXX instead implement a conversation function that returns
+ * XXX PAM_CONV_ERR when interrupted by a signal, and have the signal
+ * XXX handler just set a flag.
+ */
+static void
+timedout(int signo __unused)
+{
+
+ longjmp(timeout_buf, signo);
+}
+
+static void
+badlogin(char *name)
+{
+
+ if (failures == 0)
+ return;
+ if (hflag) {
+ syslog(LOG_NOTICE, "%d LOGIN FAILURE%s FROM %s",
+ failures, failures > 1 ? "S" : "", hostname);
+ syslog(LOG_AUTHPRIV|LOG_NOTICE,
+ "%d LOGIN FAILURE%s FROM %s, %s",
+ failures, failures > 1 ? "S" : "", hostname, name);
+ } else {
+ syslog(LOG_NOTICE, "%d LOGIN FAILURE%s ON %s",
+ failures, failures > 1 ? "S" : "", tty);
+ syslog(LOG_AUTHPRIV|LOG_NOTICE,
+ "%d LOGIN FAILURE%s ON %s, %s",
+ failures, failures > 1 ? "S" : "", tty, name);
+ }
+ failures = 0;
+}
+
+const char *
+stypeof(char *ttyid)
+{
+ struct ttyent *t;
+
+ if (ttyid != NULL && *ttyid != '\0') {
+ t = getttynam(ttyid);
+ if (t != NULL && t->ty_type != NULL)
+ return (t->ty_type);
+ }
+ return (NULL);
+}
+
+static void
+refused(const char *msg, const char *rtype, int lout)
+{
+
+ if (msg != NULL)
+ printf("%s.\n", msg);
+ if (hflag)
+ syslog(LOG_NOTICE, "LOGIN %s REFUSED (%s) FROM %s ON TTY %s",
+ pwd->pw_name, rtype, hostname, tty);
+ else
+ syslog(LOG_NOTICE, "LOGIN %s REFUSED (%s) ON TTY %s",
+ pwd->pw_name, rtype, tty);
+ if (lout)
+ bail(SLEEP_EXIT, 1);
+}
+
+/*
+ * Log a PAM error
+ */
+static void
+pam_syslog(const char *msg)
+{
+ syslog(LOG_ERR, "%s: %s", msg, pam_strerror(pamh, pam_err));
+}
+
+/*
+ * Shut down PAM
+ */
+static void
+pam_cleanup(void)
+{
+
+ if (pamh != NULL) {
+ if (pam_session_established) {
+ pam_err = pam_close_session(pamh, 0);
+ if (pam_err != PAM_SUCCESS)
+ pam_syslog("pam_close_session()");
+ }
+ pam_session_established = 0;
+ if (pam_cred_established) {
+ pam_err = pam_setcred(pamh, pam_silent|PAM_DELETE_CRED);
+ if (pam_err != PAM_SUCCESS)
+ pam_syslog("pam_setcred()");
+ }
+ pam_cred_established = 0;
+ pam_end(pamh, pam_err);
+ pamh = NULL;
+ }
+}
+
+static void
+bail_internal(int sec, int eval, int signo)
+{
+ struct sigaction sa;
+
+ pam_cleanup();
+#ifdef USE_BSM_AUDIT
+ if (pwd != NULL)
+ audit_logout();
+#endif
+ (void)sleep(sec);
+ if (signo == 0)
+ exit(eval);
+ else {
+ sa.sa_handler = SIG_DFL;
+ sa.sa_flags = 0;
+ (void)sigemptyset(&sa.sa_mask);
+ (void)sigaction(signo, &sa, NULL);
+ (void)sigaddset(&sa.sa_mask, signo);
+ (void)sigprocmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
+ raise(signo);
+ exit(128 + signo);
+ }
+}
+
+/*
+ * Exit, optionally after sleeping a few seconds
+ */
+static void
+bail(int sec, int eval)
+{
+ bail_internal(sec, eval, 0);
+}
+
+/*
+ * Exit because of a signal.
+ * This is not async-signal safe, so only call async-signal safe functions
+ * while the signal is unmasked.
+ */
+static void
+bail_sig(int signo)
+{
+ bail_internal(NO_SLEEP_EXIT, 0, signo);
+}
diff --git a/usr.bin/login/login.h b/usr.bin/login/login.h
new file mode 100644
index 0000000..48ef31b
--- /dev/null
+++ b/usr.bin/login/login.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2001 FreeBSD, Inc
+ *
+ * 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 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.
+ *
+ * $FreeBSD$
+ */
+
+void login_fbtab(char *, uid_t, gid_t);
+
+#ifdef USE_BSM_AUDIT
+void au_login_success(void);
+void au_login_fail(const char *errmsg, int na);
+void audit_logout(void);
+#endif
+
+extern char **environ;
+extern struct passwd *pwd;
diff --git a/usr.bin/login/login_audit.c b/usr.bin/login/login_audit.c
new file mode 100644
index 0000000..210f2d7
--- /dev/null
+++ b/usr.bin/login/login_audit.c
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc.
+ * All rights reserved.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <bsm/libbsm.h>
+#include <bsm/audit_uevents.h>
+
+#include <err.h>
+#include <errno.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <strings.h>
+#include <unistd.h>
+
+#include "login.h"
+
+/*
+ * Audit data
+ */
+static au_tid_t tid;
+
+/*
+ * The following tokens are included in the audit record for a successful
+ * login: header, subject, return.
+ */
+void
+au_login_success(void)
+{
+ token_t *tok;
+ int aufd;
+ au_mask_t aumask;
+ auditinfo_t auinfo;
+ uid_t uid = pwd->pw_uid;
+ gid_t gid = pwd->pw_gid;
+ pid_t pid = getpid();
+ int au_cond;
+
+ /* If we are not auditing, don't cut an audit record; just return. */
+ if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) {
+ if (errno == ENOSYS)
+ return;
+ errx(1, "login: Could not determine audit condition");
+ }
+ if (au_cond == AUC_NOAUDIT)
+ return;
+
+ /* Compute and set the user's preselection mask. */
+ if (au_user_mask(pwd->pw_name, &aumask) == -1)
+ errx(1, "login: Could not set audit mask\n");
+
+ /* Set the audit info for the user. */
+ auinfo.ai_auid = uid;
+ auinfo.ai_asid = pid;
+ bcopy(&tid, &auinfo.ai_termid, sizeof(auinfo.ai_termid));
+ bcopy(&aumask, &auinfo.ai_mask, sizeof(auinfo.ai_mask));
+ if (setaudit(&auinfo) != 0)
+ err(1, "login: setaudit failed");
+
+ if ((aufd = au_open()) == -1)
+ errx(1,"login: Audit Error: au_open() failed");
+
+ if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid, gid, pid,
+ pid, &tid)) == NULL)
+ errx(1, "login: Audit Error: au_to_subject32() failed");
+ au_write(aufd, tok);
+
+ if ((tok = au_to_return32(0, 0)) == NULL)
+ errx(1, "login: Audit Error: au_to_return32() failed");
+ au_write(aufd, tok);
+
+ if (au_close(aufd, 1, AUE_login) == -1)
+ errx(1, "login: Audit Record was not committed.");
+}
+
+/*
+ * The following tokens are included in the audit record for failed
+ * login attempts: header, subject, text, return.
+ */
+void
+au_login_fail(const char *errmsg, int na)
+{
+ token_t *tok;
+ int aufd;
+ int au_cond;
+ uid_t uid;
+ gid_t gid;
+ pid_t pid = getpid();
+
+ /* If we are not auditing, don't cut an audit record; just return. */
+ if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) {
+ if (errno == ENOSYS)
+ return;
+ errx(1, "login: Could not determine audit condition");
+ }
+ if (au_cond == AUC_NOAUDIT)
+ return;
+
+ if ((aufd = au_open()) == -1)
+ errx(1, "login: Audit Error: au_open() failed");
+
+ if (na) {
+ /*
+ * Non attributable event. Assuming that login is not called
+ * within a user's session => auid,asid == -1.
+ */
+ if ((tok = au_to_subject32(-1, geteuid(), getegid(), -1, -1,
+ pid, -1, &tid)) == NULL)
+ errx(1, "login: Audit Error: au_to_subject32() failed");
+ } else {
+ /* We know the subject -- so use its value instead. */
+ uid = pwd->pw_uid;
+ gid = pwd->pw_gid;
+ if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid,
+ gid, pid, pid, &tid)) == NULL)
+ errx(1, "login: Audit Error: au_to_subject32() failed");
+ }
+ au_write(aufd, tok);
+
+ /* Include the error message. */
+ if ((tok = au_to_text(errmsg)) == NULL)
+ errx(1, "login: Audit Error: au_to_text() failed");
+ au_write(aufd, tok);
+
+ if ((tok = au_to_return32(1, errno)) == NULL)
+ errx(1, "login: Audit Error: au_to_return32() failed");
+ au_write(aufd, tok);
+
+ if (au_close(aufd, 1, AUE_login) == -1)
+ errx(1, "login: Audit Error: au_close() was not committed");
+}
+
+/*
+ * The following tokens are included in the audit record for a logout:
+ * header, subject, return.
+ */
+void
+audit_logout(void)
+{
+ token_t *tok;
+ int aufd;
+ uid_t uid = pwd->pw_uid;
+ gid_t gid = pwd->pw_gid;
+ pid_t pid = getpid();
+ int au_cond;
+
+ /* If we are not auditing, don't cut an audit record; just return. */
+ if (auditon(A_GETCOND, &au_cond, sizeof(int)) < 0) {
+ if (errno == ENOSYS)
+ return;
+ errx(1, "login: Could not determine audit condition");
+ }
+ if (au_cond == AUC_NOAUDIT)
+ return;
+
+ if ((aufd = au_open()) == -1)
+ errx(1, "login: Audit Error: au_open() failed");
+
+ /* The subject that is created (euid, egid of the current process). */
+ if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid, gid, pid,
+ pid, &tid)) == NULL)
+ errx(1, "login: Audit Error: au_to_subject32() failed");
+ au_write(aufd, tok);
+
+ if ((tok = au_to_return32(0, 0)) == NULL)
+ errx(1, "login: Audit Error: au_to_return32() failed");
+ au_write(aufd, tok);
+
+ if (au_close(aufd, 1, AUE_logout) == -1)
+ errx(1, "login: Audit Record was not committed.");
+}
diff --git a/usr.bin/login/login_fbtab.c b/usr.bin/login/login_fbtab.c
new file mode 100644
index 0000000..f4f0516
--- /dev/null
+++ b/usr.bin/login/login_fbtab.c
@@ -0,0 +1,142 @@
+/************************************************************************
+* Copyright 1995 by Wietse Venema. All rights reserved.
+*
+* This material was originally written and compiled by Wietse Venema at
+* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
+* 1992, 1993, 1994 and 1995.
+*
+* Redistribution and use in source and binary forms are permitted
+* provided that this entire copyright notice is duplicated in all such
+* copies.
+*
+* This software is provided "as is" and without any expressed or implied
+* warranties, including, without limitation, the implied warranties of
+* merchantibility and fitness for any particular purpose.
+************************************************************************/
+/*
+ SYNOPSIS
+ void login_fbtab(tty, uid, gid)
+ char *tty;
+ uid_t uid;
+ gid_t gid;
+
+ DESCRIPTION
+ This module implements device security as described in the
+ SunOS 4.1.x fbtab(5) and SunOS 5.x logindevperm(4) manual
+ pages. The program first looks for /etc/fbtab. If that file
+ cannot be opened it attempts to process /etc/logindevperm.
+ We expect entries with the following format:
+
+ Comments start with a # and extend to the end of the line.
+
+ Blank lines or lines with only a comment are ignored.
+
+ All other lines consist of three fields delimited by
+ whitespace: a login device (/dev/console), an octal
+ permission number (0600), and a ":"-delimited list of
+ devices (/dev/kbd:/dev/mouse). All device names are
+ absolute paths. A path that ends in "*" refers to all
+ directory entries except "." and "..".
+
+ If the tty argument (relative path) matches a login device
+ name (absolute path), the permissions of the devices in the
+ ":"-delimited list are set as specified in the second
+ field, and their ownership is changed to that of the uid
+ and gid arguments.
+
+ DIAGNOSTICS
+ Problems are reported via the syslog daemon with severity
+ LOG_ERR.
+
+ BUGS
+ This module uses strtok(3), which may cause conflicts with other
+ uses of that same routine.
+
+ AUTHOR
+ Wietse Venema (wietse@wzv.win.tue.nl)
+ Eindhoven University of Technology
+ The Netherlands
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <glob.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "login.h"
+#include "pathnames.h"
+
+static void login_protect(const char *, char *, int, uid_t, gid_t);
+
+#define WSPACE " \t\n"
+
+/* login_fbtab - apply protections specified in /etc/fbtab or logindevperm */
+
+void
+login_fbtab(char *tty, uid_t uid, gid_t gid)
+{
+ FILE *fp;
+ char buf[BUFSIZ];
+ char *devname;
+ char *cp;
+ int prot;
+ const char *table;
+
+ if ((fp = fopen(table = _PATH_FBTAB, "r")) == NULL
+ && (fp = fopen(table = _PATH_LOGINDEVPERM, "r")) == NULL)
+ return;
+
+ while (fgets(buf, sizeof(buf), fp)) {
+ if ((cp = strchr(buf, '#')))
+ *cp = 0; /* strip comment */
+ if ((cp = devname = strtok(buf, WSPACE)) == NULL)
+ continue; /* empty or comment */
+ if (strncmp(devname, _PATH_DEV, sizeof _PATH_DEV - 1) != 0
+ || (cp = strtok(NULL, WSPACE)) == NULL
+ || *cp != '0'
+ || sscanf(cp, "%o", &prot) == 0
+ || prot == 0
+ || (prot & 0777) != prot
+ || (cp = strtok(NULL, WSPACE)) == NULL) {
+ syslog(LOG_ERR, "%s: bad entry: %s", table, cp ? cp : "(null)");
+ continue;
+ }
+ if (strcmp(devname + 5, tty) == 0) {
+ for (cp = strtok(cp, ":"); cp; cp = strtok(NULL, ":")) {
+ login_protect(table, cp, prot, uid, gid);
+ }
+ }
+ }
+ fclose(fp);
+}
+
+/* login_protect - protect one device entry */
+
+static void
+login_protect(const char *table, char *pattern, int mask, uid_t uid, gid_t gid)
+{
+ glob_t gl;
+ char *path;
+ unsigned int i;
+
+ if (glob(pattern, GLOB_NOSORT, NULL, &gl) != 0)
+ return;
+ for (i = 0; i < gl.gl_pathc; i++) {
+ path = gl.gl_pathv[i];
+ /* clear flags of the device */
+ if (chflags(path, 0) && errno != ENOENT && errno != EOPNOTSUPP)
+ syslog(LOG_ERR, "%s: chflags(%s): %m", table, path);
+ if (chmod(path, mask) && errno != ENOENT)
+ syslog(LOG_ERR, "%s: chmod(%s): %m", table, path);
+ if (chown(path, uid, gid) && errno != ENOENT)
+ syslog(LOG_ERR, "%s: chown(%s): %m", table, path);
+ }
+ globfree(&gl);
+}
diff --git a/usr.bin/login/pathnames.h b/usr.bin/login/pathnames.h
new file mode 100644
index 0000000..836725f
--- /dev/null
+++ b/usr.bin/login/pathnames.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/9/93
+ * $FreeBSD$
+ */
+
+#include <paths.h>
+
+#define _PATH_HUSHLOGIN ".hushlogin"
+#define _PATH_MOTDFILE "/etc/motd"
+#define _PATH_FBTAB "/etc/fbtab"
+#define _PATH_LOGINDEVPERM "/etc/logindevperm"
diff --git a/usr.bin/logins/Makefile b/usr.bin/logins/Makefile
new file mode 100644
index 0000000..ad88cd9
--- /dev/null
+++ b/usr.bin/logins/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= logins
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/logins/Makefile.depend b/usr.bin/logins/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/logins/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/logins/logins.1 b/usr.bin/logins/logins.1
new file mode 100644
index 0000000..d84284a
--- /dev/null
+++ b/usr.bin/logins/logins.1
@@ -0,0 +1,104 @@
+.\"-
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" 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. 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 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 March 6, 2004
+.Dt LOGINS 1
+.Os
+.Sh NAME
+.Nm logins
+.Nd display account information
+.Sh SYNOPSIS
+.Nm
+.Op Fl admopstux
+.Op Fl g Ar groups
+.Op Fl l Ar logins
+.Sh DESCRIPTION
+The
+.Nm
+utility displays information about user and system accounts.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl g Ar groups"
+.It Fl a
+Display information about the password change and account expiration
+times for each account.
+.It Fl d
+Select accounts with duplicate UIDs.
+.It Fl g Ar groups
+Select accounts that are members of the specified groups.
+If multiple group names are specified, they must be separated with
+commas.
+.It Fl l Ar logins
+Select accounts matching the specified login names.
+If multiple names are specified, they must be separated with commas.
+.It Fl m
+Show information about secondary groups.
+.It Fl o
+Display the information for each account on a single line of
+colon-separated fields.
+.It Fl p
+Select accounts with no password.
+.It Fl s
+Select system accounts.
+These are currently defined as accounts with UIDs below 1000, plus the
+.Dq Li nobody
+account (UID 65534).
+.It Fl t
+Sort selected accounts by name rather than by UID.
+.It Fl u
+Select user accounts.
+These are currently defined as accounts with UIDs above 1000, except
+the
+.Dq Li nobody
+account (UID 65534).
+.It Fl x
+Display information about each account's home directory and shell.
+.El
+.Pp
+If multiple selection options are specified, all accounts matching any
+of the selection criteria will be displayed.
+.Pp
+If no selection options are specified, all accounts will be displayed.
+.Sh SEE ALSO
+.Xr getgrent 3 ,
+.Xr getpwent 3 ,
+.Xr group 5 ,
+.Xr passwd 5 ,
+.Xr pw 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 4.10 .
+.Sh AUTHORS
+The
+.Nm
+utility was written by
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org
+based on similar utilities in other operating systems.
diff --git a/usr.bin/logins/logins.c b/usr.bin/logins/logins.c
new file mode 100644
index 0000000..5cc60d7
--- /dev/null
+++ b/usr.bin/logins/logins.c
@@ -0,0 +1,408 @@
+/*-
+ * Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+ * 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.
+ * 3. 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <grp.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+struct xpasswd {
+ char *pw_name;
+ char *pw_passwd;
+ uid_t pw_uid;
+ gid_t pw_gid;
+ time_t pw_change;
+ char *pw_class;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+ time_t pw_expire;
+ int pw_selected;
+};
+
+struct xgroup {
+ char *gr_name;
+ char *gr_passwd;
+ gid_t gr_gid;
+ char *gr_mem;
+};
+
+static int everything = 1;
+static int a_flag;
+static int d_flag;
+static const char *g_args;
+static const char *l_args;
+static int m_flag;
+static int o_flag;
+static int p_flag;
+static int s_flag;
+static int t_flag;
+static int u_flag;
+static int x_flag;
+
+static int
+member(const char *elem, const char *list)
+{
+ char *p;
+ int len;
+
+ p = strstr(list, elem);
+ len = strlen(elem);
+
+ return (p != NULL &&
+ (p == list || p[-1] == ',') &&
+ (p[len] == '\0' || p[len] == ','));
+}
+
+static void *
+xmalloc(size_t size)
+{
+ void *newptr;
+
+ if ((newptr = malloc(size)) == NULL)
+ err(1, "malloc()");
+ return (newptr);
+}
+
+static void *
+xrealloc(void *ptr, size_t size)
+{
+ void *newptr;
+
+ if ((newptr = realloc(ptr, size)) == NULL)
+ err(1, "realloc()");
+ return (newptr);
+}
+
+static char *
+xstrdup(const char *str)
+{
+ char *dupstr;
+
+ if ((dupstr = strdup(str)) == NULL)
+ err(1, "strdup()");
+ return (dupstr);
+}
+
+static struct xgroup *grps;
+static size_t grpsz;
+static size_t ngrps;
+
+static void
+get_groups(void)
+{
+ struct group *grp;
+ size_t len;
+ int i;
+
+ setgrent();
+ for (;;) {
+ if (ngrps == grpsz) {
+ grpsz += grpsz ? grpsz : 128;
+ grps = xrealloc(grps, grpsz * sizeof *grps);
+ }
+ if ((grp = getgrent()) == NULL)
+ break;
+ grps[ngrps].gr_name = xstrdup(grp->gr_name);
+ grps[ngrps].gr_passwd = xstrdup(grp->gr_passwd);
+ grps[ngrps].gr_gid = grp->gr_gid;
+ grps[ngrps].gr_mem = xstrdup("");
+ for (i = 0, len = 1; grp->gr_mem[i] != NULL; ++i)
+ len += strlen(grp->gr_mem[i]) + 1;
+ grps[ngrps].gr_mem = xmalloc(len);
+ for (i = 0, len = 0; grp->gr_mem[i] != NULL; ++i)
+ len += sprintf(grps[ngrps].gr_mem + len,
+ i ? ",%s" : "%s", grp->gr_mem[i]);
+ grps[ngrps].gr_mem[len] = '\0';
+ ngrps++;
+ }
+ endgrent();
+}
+
+static struct xgroup *
+find_group_bygid(gid_t gid)
+{
+ unsigned int i;
+
+ for (i = 0; i < ngrps; ++i)
+ if (grps[i].gr_gid == gid)
+ return (&grps[i]);
+ return (NULL);
+}
+
+#if 0
+static struct xgroup *
+find_group_byname(const char *name)
+{
+ unsigned int i;
+
+ for (i = 0; i < ngrps; ++i)
+ if (strcmp(grps[i].gr_name, name) == 0)
+ return (&grps[i]);
+ return (NULL);
+}
+#endif
+
+static struct xpasswd *pwds;
+static size_t pwdsz;
+static size_t npwds;
+
+static int
+pwd_cmp_byname(const void *ap, const void *bp)
+{
+ const struct passwd *a = ap;
+ const struct passwd *b = bp;
+
+ return (strcmp(a->pw_name, b->pw_name));
+}
+
+static int
+pwd_cmp_byuid(const void *ap, const void *bp)
+{
+ const struct passwd *a = ap;
+ const struct passwd *b = bp;
+
+ return (a->pw_uid - b->pw_uid);
+}
+
+static void
+get_users(void)
+{
+ struct passwd *pwd;
+
+ setpwent();
+ for (;;) {
+ if (npwds == pwdsz) {
+ pwdsz += pwdsz ? pwdsz : 128;
+ pwds = xrealloc(pwds, pwdsz * sizeof *pwds);
+ }
+ if ((pwd = getpwent()) == NULL)
+ break;
+ pwds[npwds].pw_name = xstrdup(pwd->pw_name);
+ pwds[npwds].pw_passwd = xstrdup(pwd->pw_passwd);
+ pwds[npwds].pw_uid = pwd->pw_uid;
+ pwds[npwds].pw_gid = pwd->pw_gid;
+ pwds[npwds].pw_change = pwd->pw_change;
+ pwds[npwds].pw_class = xstrdup(pwd->pw_class);
+ pwds[npwds].pw_gecos = xstrdup(pwd->pw_gecos);
+ pwds[npwds].pw_dir = xstrdup(pwd->pw_dir);
+ pwds[npwds].pw_shell = xstrdup(pwd->pw_shell);
+ pwds[npwds].pw_expire = pwd->pw_expire;
+ pwds[npwds].pw_selected = 0;
+ npwds++;
+ }
+ endpwent();
+}
+
+static void
+select_users(void)
+{
+ unsigned int i, j;
+ struct xgroup *grp;
+ struct xpasswd *pwd;
+
+ for (i = 0, pwd = pwds; i < npwds; ++i, ++pwd) {
+ if (everything) {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ if (d_flag)
+ if ((i > 0 && pwd->pw_uid == pwd[-1].pw_uid) ||
+ (i < npwds - 1 && pwd->pw_uid == pwd[1].pw_uid)) {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ if (g_args) {
+ for (j = 0, grp = grps; j < ngrps; ++j, ++grp) {
+ if (member(grp->gr_name, g_args) &&
+ member(pwd->pw_name, grp->gr_mem)) {
+ pwd->pw_selected = 1;
+ break;
+ }
+ }
+ if (pwd->pw_selected)
+ continue;
+ }
+ if (l_args)
+ if (member(pwd->pw_name, l_args)) {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ if (p_flag)
+ if (pwd->pw_passwd[0] == '\0') {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ if (s_flag)
+ if (pwd->pw_uid < 1000 || pwd->pw_uid == 65534) {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ if (u_flag)
+ if (pwd->pw_uid >= 1000 && pwd->pw_uid != 65534) {
+ pwd->pw_selected = 1;
+ continue;
+ }
+ }
+}
+
+static void
+sort_users(void)
+{
+ if (t_flag)
+ mergesort(pwds, npwds, sizeof *pwds, pwd_cmp_byname);
+ else
+ mergesort(pwds, npwds, sizeof *pwds, pwd_cmp_byuid);
+}
+
+static void
+display_user(struct xpasswd *pwd)
+{
+ struct xgroup *grp;
+ unsigned int i;
+ char cbuf[16], ebuf[16];
+ struct tm *tm;
+
+ grp = find_group_bygid(pwd->pw_gid);
+ printf(o_flag ? "%s:%ld:%s:%ld:%s" : "%-15s %-7ld %-15s %-7ld %s\n",
+ pwd->pw_name, (long)pwd->pw_uid, grp ? grp->gr_name : "",
+ (long)pwd->pw_gid, pwd->pw_gecos);
+ if (m_flag) {
+ for (i = 0, grp = grps; i < ngrps; ++i, ++grp) {
+ if (grp->gr_gid == pwd->pw_gid ||
+ !member(pwd->pw_name, grp->gr_mem))
+ continue;
+ printf(o_flag ? "%s:%s:%ld" : "%24s%-15s %-7ld\n",
+ "", grp->gr_name, (long)grp->gr_gid);
+ }
+ }
+ if (x_flag) {
+ printf(o_flag ? "%s:%s" : "%24s%s\n", "", pwd->pw_dir);
+ printf(o_flag ? "%s:%s" : "%24s%s\n", "", pwd->pw_shell);
+ }
+ if (a_flag) {
+ tm = gmtime(&pwd->pw_change);
+ strftime(cbuf, sizeof(cbuf), pwd->pw_change ? "%F" : "0", tm);
+ tm = gmtime(&pwd->pw_expire);
+ strftime(ebuf, sizeof(ebuf), pwd->pw_expire ? "%F" : "0", tm);
+ printf(o_flag ? "%s:%s:%s" : "%24s%s %s\n", "", cbuf, ebuf);
+ }
+ if (o_flag)
+ printf("\n");
+}
+
+static void
+list_users(void)
+{
+ struct xpasswd *pwd;
+ unsigned int i;
+
+ for (i = 0, pwd = pwds; i < npwds; ++i, ++pwd)
+ if (pwd->pw_selected)
+ display_user(pwd);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: logins [-admopstux] [-g group] [-l login]\n");
+ exit(1);
+}
+
+int
+main(int argc, char * const argv[])
+{
+ int o;
+
+ while ((o = getopt(argc, argv, "adg:l:mopstux")) != -1)
+ switch (o) {
+ case 'a':
+ a_flag = 1;
+ break;
+ case 'd':
+ everything = 0;
+ d_flag = 1;
+ break;
+ case 'g':
+ everything = 0;
+ g_args = optarg;
+ break;
+ case 'l':
+ everything = 0;
+ l_args = optarg;
+ break;
+ case 'm':
+ m_flag = 1;
+ break;
+ case 'o':
+ o_flag = 1;
+ break;
+ case 'p':
+ everything = 0;
+ p_flag = 1;
+ break;
+ case 's':
+ everything = 0;
+ s_flag = 1;
+ break;
+ case 't':
+ t_flag = 1;
+ break;
+ case 'u':
+ everything = 0;
+ u_flag = 1;
+ break;
+ case 'x':
+ x_flag = 1;
+ break;
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0)
+ usage();
+
+ get_groups();
+ get_users();
+ select_users();
+ sort_users();
+ list_users();
+ exit(0);
+}
diff --git a/usr.bin/logname/Makefile b/usr.bin/logname/Makefile
new file mode 100644
index 0000000..875df2c
--- /dev/null
+++ b/usr.bin/logname/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= logname
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/logname/Makefile.depend b/usr.bin/logname/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/logname/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/logname/logname.1 b/usr.bin/logname/logname.1
new file mode 100644
index 0000000..e943ecb
--- /dev/null
+++ b/usr.bin/logname/logname.1
@@ -0,0 +1,71 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)logname.1 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt LOGNAME 1
+.Os
+.Sh NAME
+.Nm logname
+.Nd display user's login name
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility writes the user's login name to standard output followed by
+a newline.
+.Pp
+The
+.Nm
+utility explicitly ignores the
+.Ev LOGNAME
+and
+.Ev USER
+environment variables
+because the environment cannot be trusted.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr who 1 ,
+.Xr whoami 1 ,
+.Xr getlogin 2
+.Sh STANDARDS
+The
+.Nm
+utility is expected to conform to
+.St -p1003.2 .
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
diff --git a/usr.bin/logname/logname.c b/usr.bin/logname/logname.c
new file mode 100644
index 0000000..8a251ae
--- /dev/null
+++ b/usr.bin/logname/logname.c
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * 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) 1991, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)logname.c 8.2 (Berkeley) 4/3/94";
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void usage(void);
+
+int
+main(int argc, char *argv[] __unused)
+{
+ char *p;
+
+ if (argc != 1)
+ usage();
+ if ((p = getlogin()) == NULL)
+ err(1, NULL);
+ (void)printf("%s\n", p);
+ exit(0);
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: logname\n");
+ exit(1);
+}
diff --git a/usr.bin/look/Makefile b/usr.bin/look/Makefile
new file mode 100644
index 0000000..dd724a3
--- /dev/null
+++ b/usr.bin/look/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= look
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/look/Makefile.depend b/usr.bin/look/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/look/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/look/look.1 b/usr.bin/look/look.1
new file mode 100644
index 0000000..bfeb3a6
--- /dev/null
+++ b/usr.bin/look/look.1
@@ -0,0 +1,126 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)look.1 8.1 (Berkeley) 6/14/93
+.\" $FreeBSD$
+.\"
+.Dd July 17, 2004
+.Dt LOOK 1
+.Os
+.Sh NAME
+.Nm look
+.Nd display lines beginning with a given string
+.Sh SYNOPSIS
+.Nm
+.Op Fl df
+.Op Fl t Ar termchar
+.Ar string
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility displays any lines in
+.Ar file
+which contain
+.Ar string
+as a prefix.
+As
+.Nm
+performs a binary search, the lines in
+.Ar file
+must be sorted.
+.Pp
+If
+.Ar file
+is not specified, the file
+.Pa /usr/share/dict/words
+is used, only alphanumeric characters are compared and the case of
+alphabetic characters is ignored.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl d , -alphanum
+Dictionary character set and order, i.e., only alphanumeric characters
+are compared.
+.It Fl f , -ignore-case
+Ignore the case of alphabetic characters.
+.It Fl t , -terminate Ar termchar
+Specify a string termination character, i.e., only the characters
+in
+.Ar string
+up to and including the first occurrence of
+.Ar termchar
+are compared.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of the
+.Nm
+utility.
+Their effect is described in
+.Xr environ 7 .
+.Sh FILES
+.Bl -tag -width /usr/share/dict/words -compact
+.It Pa /usr/share/dict/words
+the dictionary
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 if one or more lines were found and displayed,
+1 if no lines were found, and >1 if an error occurred.
+.Sh COMPATIBILITY
+The original manual page stated that tabs and blank characters participated
+in comparisons when the
+.Fl d
+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 compatibility.
+.Sh SEE ALSO
+.Xr grep 1 ,
+.Xr sort 1
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v7 .
+.Sh BUGS
+Lines are not compared according to the current locale's collating
+order.
+Input files must be sorted with
+.Ev LC_COLLATE
+set to
+.Ql C .
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
new file mode 100644
index 0000000..ada6e25
--- /dev/null
+++ b/usr.bin/look/look.c
@@ -0,0 +1,361 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * David Hitz of Auspex Systems, Inc.
+ *
+ * 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) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)look.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * look -- find lines in a sorted list.
+ *
+ * The man page said that TABs and SPACEs participate in -d comparisons.
+ * In fact, they were ignored. This implements historic practice, not
+ * the manual page.
+ */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "pathnames.h"
+
+static char _path_words[] = _PATH_WORDS;
+
+#define EQUAL 0
+#define GREATER 1
+#define LESS (-1)
+
+static int dflag, fflag;
+
+static char *binary_search(wchar_t *, unsigned char *, unsigned char *);
+static int compare(wchar_t *, unsigned char *, unsigned char *);
+static char *linear_search(wchar_t *, unsigned char *, unsigned char *);
+static int look(wchar_t *, unsigned char *, unsigned char *);
+static wchar_t *prepkey(const char *, wchar_t);
+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[])
+{
+ struct stat sb;
+ int ch, fd, match;
+ wchar_t termchar;
+ unsigned char *back, *front;
+ unsigned const char *file;
+ wchar_t *key;
+
+ (void) setlocale(LC_CTYPE, "");
+
+ file = _path_words;
+ termchar = L'\0';
+ while ((ch = getopt_long(argc, argv, "+adft:", longopts, NULL)) != -1)
+ switch(ch) {
+ case 'a':
+ /* COMPATIBILITY */
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'f':
+ fflag = 1;
+ break;
+ case 't':
+ if (mbrtowc(&termchar, optarg, MB_LEN_MAX, NULL) !=
+ strlen(optarg))
+ errx(2, "invalid termination character");
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ usage();
+ if (argc == 1) /* But set -df by default. */
+ dflag = fflag = 1;
+ key = prepkey(*argv++, termchar);
+ if (argc >= 2)
+ file = *argv++;
+
+ match = 1;
+
+ do {
+ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
+ err(2, "%s", file);
+ if ((uintmax_t)sb.st_size > (uintmax_t)SIZE_T_MAX)
+ errx(2, "%s: %s", file, strerror(EFBIG));
+ if (sb.st_size == 0) {
+ close(fd);
+ continue;
+ }
+ if ((front = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED)
+ err(2, "%s", file);
+ back = front + sb.st_size;
+ match *= (look(key, front, back));
+ close(fd);
+ } while (argc-- > 2 && (file = *argv++));
+
+ exit(match);
+}
+
+static wchar_t *
+prepkey(const char *string, wchar_t termchar)
+{
+ const char *readp;
+ wchar_t *key, *writep;
+ wchar_t ch;
+ size_t clen;
+
+ /*
+ * Reformat search string and convert to wide character representation
+ * to avoid doing it multiple times later.
+ */
+ if ((key = malloc(sizeof(wchar_t) * (strlen(string) + 1))) == NULL)
+ err(2, NULL);
+ readp = string;
+ writep = key;
+ while ((clen = mbrtowc(&ch, readp, MB_LEN_MAX, NULL)) != 0) {
+ if (clen == (size_t)-1 || clen == (size_t)-2)
+ errc(2, EILSEQ, NULL);
+ if (fflag)
+ ch = towlower(ch);
+ if (!dflag || iswalnum(ch))
+ *writep++ = ch;
+ readp += clen;
+ }
+ *writep = L'\0';
+ if (termchar != L'\0' && (writep = wcschr(key, termchar)) != NULL)
+ *++writep = L'\0';
+ return (key);
+}
+
+static int
+look(wchar_t *string, unsigned char *front, unsigned char *back)
+{
+
+ front = binary_search(string, front, back);
+ front = linear_search(string, front, back);
+
+ if (front)
+ print_from(string, front, back);
+ return (front ? 0 : 1);
+}
+
+
+/*
+ * Binary search for "string" in memory between "front" and "back".
+ *
+ * This routine is expected to return a pointer to the start of a line at
+ * *or before* the first word matching "string". Relaxing the constraint
+ * this way simplifies the algorithm.
+ *
+ * Invariants:
+ * front points to the beginning of a line at or before the first
+ * matching string.
+ *
+ * back points to the beginning of a line at or after the first
+ * matching line.
+ *
+ * Base of the Invariants.
+ * front = NULL;
+ * back = EOF;
+ *
+ * Advancing the Invariants:
+ *
+ * p = first newline after halfway point from front to back.
+ *
+ * If the string at "p" is not greater than the string to match,
+ * p is the new front. Otherwise it is the new back.
+ *
+ * Termination:
+ *
+ * The definition of the routine allows it return at any point,
+ * since front is always at or before the line to print.
+ *
+ * In fact, it returns when the chosen "p" equals "back". This
+ * implies that there exists a string is least half as long as
+ * (back - front), which in turn implies that a linear search will
+ * be no more expensive than the cost of simply printing a string or two.
+ *
+ * Trying to continue with binary search at this point would be
+ * more trouble than it's worth.
+ */
+#define SKIP_PAST_NEWLINE(p, back) \
+ while (p < back && *p++ != '\n');
+
+static char *
+binary_search(wchar_t *string, unsigned char *front, unsigned char *back)
+{
+ unsigned char *p;
+
+ p = front + (back - front) / 2;
+ SKIP_PAST_NEWLINE(p, back);
+
+ /*
+ * If the file changes underneath us, make sure we don't
+ * infinitely loop.
+ */
+ while (p < back && back > front) {
+ if (compare(string, p, back) == GREATER)
+ front = p;
+ else
+ back = p;
+ p = front + (back - front) / 2;
+ SKIP_PAST_NEWLINE(p, back);
+ }
+ return (front);
+}
+
+/*
+ * Find the first line that starts with string, linearly searching from front
+ * to back.
+ *
+ * Return NULL for no such line.
+ *
+ * This routine assumes:
+ *
+ * o front points at the first character in a line.
+ * o front is before or at the first line to be printed.
+ */
+static char *
+linear_search(wchar_t *string, unsigned char *front, unsigned char *back)
+{
+ while (front < back) {
+ switch (compare(string, front, back)) {
+ case EQUAL: /* Found it. */
+ return (front);
+ case LESS: /* No such string. */
+ return (NULL);
+ case GREATER: /* Keep going. */
+ break;
+ }
+ SKIP_PAST_NEWLINE(front, back);
+ }
+ return (NULL);
+}
+
+/*
+ * Print as many lines as match string, starting at front.
+ */
+static void
+print_from(wchar_t *string, unsigned char *front, unsigned char *back)
+{
+ for (; front < back && compare(string, front, back) == EQUAL; ++front) {
+ for (; front < back && *front != '\n'; ++front)
+ if (putchar(*front) == EOF)
+ err(2, "stdout");
+ if (putchar('\n') == EOF)
+ err(2, "stdout");
+ }
+}
+
+/*
+ * Return LESS, GREATER, or EQUAL depending on how the string1 compares with
+ * string2 (s1 ??? s2).
+ *
+ * o Matches up to len(s1) are EQUAL.
+ * o Matches up to len(s2) are GREATER.
+ *
+ * Compare understands about the -f and -d flags, and treats comparisons
+ * appropriately.
+ *
+ * The string "s1" is null terminated. The string s2 is '\n' terminated (or
+ * "back" terminated).
+ */
+static int
+compare(wchar_t *s1, unsigned char *s2, unsigned char *back)
+{
+ wchar_t ch1, ch2;
+ size_t len2;
+
+ for (; *s1 && s2 < back && *s2 != '\n'; ++s1, s2 += len2) {
+ ch1 = *s1;
+ len2 = mbrtowc(&ch2, s2, back - s2, NULL);
+ if (len2 == (size_t)-1 || len2 == (size_t)-2) {
+ ch2 = *s2;
+ len2 = 1;
+ }
+ if (fflag)
+ ch2 = towlower(ch2);
+ if (dflag && !iswalnum(ch2)) {
+ /* Ignore character in comparison. */
+ --s1;
+ continue;
+ }
+ if (ch1 != ch2)
+ return (ch1 < ch2 ? LESS : GREATER);
+ }
+ return (*s1 ? GREATER : EQUAL);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: look [-df] [-t char] string [file ...]\n");
+ exit(2);
+}
diff --git a/usr.bin/look/pathnames.h b/usr.bin/look/pathnames.h
new file mode 100644
index 0000000..bd870e2
--- /dev/null
+++ b/usr.bin/look/pathnames.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/9/93
+ */
+
+#define _PATH_WORDS "/usr/share/dict/words"
diff --git a/usr.bin/lorder/Makefile b/usr.bin/lorder/Makefile
new file mode 100644
index 0000000..6199682
--- /dev/null
+++ b/usr.bin/lorder/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+SCRIPTS=lorder.sh
+MAN= lorder.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lorder/Makefile.depend b/usr.bin/lorder/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/lorder/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/lorder/lorder.1 b/usr.bin/lorder/lorder.1
new file mode 100644
index 0000000..56a4b2a
--- /dev/null
+++ b/usr.bin/lorder/lorder.1
@@ -0,0 +1,90 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)lorder.1 8.2 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd August 14, 2015
+.Dt LORDER 1
+.Os
+.Sh NAME
+.Nm lorder
+.Nd list dependencies for object files
+.Sh SYNOPSIS
+.Nm
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility uses
+.Xr nm 1
+to determine interdependencies in the list of object files
+and library archives
+specified on the command line.
+The
+.Nm
+utility outputs a list of file names where the first file contains a symbol
+which is defined by the second file.
+.Pp
+The output is normally used with
+.Xr tsort 1
+when a library is created to determine the optimum ordering of the
+object modules so that all references may be resolved in a single
+pass of the loader.
+.Pp
+When linking static binaries,
+.Nm
+and
+.Xr tsort 1
+can be used to properly order library archives automatically.
+.Sh ENVIRONMENT
+.Bl -tag -width indent
+.It Ev NM
+Path to the
+.Xr nm 1
+binary, defaults to
+.Dq Li nm .
+.It Ev NMFLAGS
+Flags to pass to
+.Xr nm 1 .
+.El
+.Sh EXAMPLES
+.Bd -literal -offset indent
+ar cr library.a `lorder ${OBJS} | tsort`
+cc -o foo ${OBJS} `lorder ${STATIC_LIBS} | tsort`
+.Ed
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr ld 1 ,
+.Xr nm 1 ,
+.Xr ranlib 1 ,
+.Xr tsort 1
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v7 .
diff --git a/usr.bin/lorder/lorder.sh b/usr.bin/lorder/lorder.sh
new file mode 100644
index 0000000..8123c96
--- /dev/null
+++ b/usr.bin/lorder/lorder.sh
@@ -0,0 +1,90 @@
+#!/bin/sh -
+#
+# Copyright (c) 1990, 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.
+#
+# @(#)lorder.sh 8.1 (Berkeley) 6/6/93
+#
+# $FreeBSD$
+#
+
+# only one argument is a special case, just output the name twice
+case $# in
+ 0)
+ echo "usage: lorder file ...";
+ exit ;;
+ 1)
+ echo $1 $1;
+ exit ;;
+esac
+
+# temporary files
+R=$(mktemp -t _reference_)
+S=$(mktemp -t _symbol_)
+NM=${NM:-nm}
+
+# remove temporary files on HUP, INT, QUIT, PIPE, TERM
+trap "rm -f $R $S $T; exit 1" 1 2 3 13 15
+
+# make sure all the files get into the output
+for i in $*; do
+ echo $i $i
+done
+
+# if the line has " [TDW] " it's a globally defined symbol, put it
+# into the symbol file.
+#
+# if the line has " U " it's a globally undefined symbol, put it into
+# the reference file.
+${NM} ${NMFLAGS} -go $* | sed "
+ / [TDW] / {
+ s/:.* [TDW] / /
+ w $S
+ d
+ }
+ / U / {
+ s/:.* U / /
+ w $R
+ }
+ d
+"
+
+# eliminate references that can be resolved by the same library.
+if [ $(expr "$*" : '.*\.a[[:>:]]') -ne 0 ]; then
+ sort -u -o $S $S
+ sort -u -o $R $R
+ T=$(mktemp -t _temp_)
+ comm -23 $R $S >$T
+ mv $T $R
+fi
+
+# sort references and symbols on the second field (the symbol),
+# join on that field, and print out the file names.
+sort -k 2 -o $R $R
+sort -k 2 -o $S $S
+join -j 2 -o 1.1 2.1 $R $S
+rm -f $R $S
diff --git a/usr.bin/lsvfs/Makefile b/usr.bin/lsvfs/Makefile
new file mode 100644
index 0000000..324b6fd
--- /dev/null
+++ b/usr.bin/lsvfs/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= lsvfs
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lsvfs/Makefile.depend b/usr.bin/lsvfs/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/lsvfs/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/lsvfs/lsvfs.1 b/usr.bin/lsvfs/lsvfs.1
new file mode 100644
index 0000000..5bdb64e
--- /dev/null
+++ b/usr.bin/lsvfs/lsvfs.1
@@ -0,0 +1,55 @@
+.\" $FreeBSD$
+.\" Garrett A. Wollman, September 1994
+.\" This file is in the public domain.
+.\"
+.Dd June 9, 2013
+.Dt LSVFS 1
+.Os
+.Sh NAME
+.Nm lsvfs
+.Nd list installed virtual file systems
+.Sh SYNOPSIS
+.Nm
+.Op Ar vfsname Ar ...
+.Sh DESCRIPTION
+The
+.Nm
+command lists information about the currently loaded virtual file system
+modules.
+When
+.Ar vfsname
+arguments are given,
+.Nm
+lists information about the specified VFS modules.
+Otherwise,
+.Nm
+lists all currently loaded modules.
+The information is as follows:
+.Pp
+.Bl -tag -compact -width Filesystem
+.It Filesystem
+the name of the file system, as would be used in the
+.Ar type
+parameter to
+.Xr mount 2
+and the
+.Fl t
+option to
+.Xr mount 8
+.It Num
+the filesystem type number.
+.It Refs
+the number of references to this VFS; i.e., the number of currently
+mounted file systems of this type
+.It Flags
+flag bits.
+.El
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr getvfsbyname 3 ,
+.Xr mount 8
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.Fx 2.0 .
diff --git a/usr.bin/lsvfs/lsvfs.c b/usr.bin/lsvfs/lsvfs.c
new file mode 100644
index 0000000..a0a6acb
--- /dev/null
+++ b/usr.bin/lsvfs/lsvfs.c
@@ -0,0 +1,97 @@
+/*
+ * lsvfs - list loaded VFSes
+ * Garrett A. Wollman, September 1994
+ * This file is in the public domain.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/sysctl.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define FMT "%-32.32s 0x%08x %5d %s\n"
+#define HDRFMT "%-32.32s %10s %5.5s %s\n"
+#define DASHES "-------------------------------- " \
+ "---------- ----- ---------------\n"
+
+static struct flaglist {
+ int flag;
+ const char str[32]; /* must be longer than the longest one. */
+} fl[] = {
+ { .flag = VFCF_STATIC, .str = "static", },
+ { .flag = VFCF_NETWORK, .str = "network", },
+ { .flag = VFCF_READONLY, .str = "read-only", },
+ { .flag = VFCF_SYNTHETIC, .str = "synthetic", },
+ { .flag = VFCF_LOOPBACK, .str = "loopback", },
+ { .flag = VFCF_UNICODE, .str = "unicode", },
+ { .flag = VFCF_JAIL, .str = "jail", },
+ { .flag = VFCF_DELEGADMIN, .str = "delegated-administration", },
+};
+
+static const char *fmt_flags(int);
+
+int
+main(int argc, char **argv)
+{
+ int cnt, rv = 0, i;
+ struct xvfsconf vfc, *xvfsp;
+ size_t buflen;
+ argc--, argv++;
+
+ printf(HDRFMT, "Filesystem", "Num", "Refs", "Flags");
+ fputs(DASHES, stdout);
+
+ if(argc) {
+ for(; argc; argc--, argv++) {
+ if (getvfsbyname(*argv, &vfc) == 0) {
+ printf(FMT, vfc.vfc_name, vfc.vfc_typenum, vfc.vfc_refcount,
+ fmt_flags(vfc.vfc_flags));
+ } else {
+ warnx("VFS %s unknown or not loaded", *argv);
+ rv++;
+ }
+ }
+ } else {
+ if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0)
+ err(1, "sysctl(vfs.conflist)");
+ xvfsp = malloc(buflen);
+ if (xvfsp == NULL)
+ errx(1, "malloc failed");
+ if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0)
+ err(1, "sysctl(vfs.conflist)");
+ cnt = buflen / sizeof(struct xvfsconf);
+
+ for (i = 0; i < cnt; i++) {
+ printf(FMT, xvfsp[i].vfc_name, xvfsp[i].vfc_typenum,
+ xvfsp[i].vfc_refcount, fmt_flags(xvfsp[i].vfc_flags));
+ }
+ free(xvfsp);
+ }
+
+ return rv;
+}
+
+static const char *
+fmt_flags(int flags)
+{
+ static char buf[sizeof(struct flaglist) * sizeof(fl)];
+ int i;
+
+ buf[0] = '\0';
+ for (i = 0; i < (int)nitems(fl); i++)
+ if (flags & fl[i].flag) {
+ strlcat(buf, fl[i].str, sizeof(buf));
+ strlcat(buf, ", ", sizeof(buf));
+ }
+ if (buf[0] != '\0')
+ buf[strlen(buf) - 2] = '\0';
+ return (buf);
+}
diff --git a/usr.bin/lzmainfo/Makefile b/usr.bin/lzmainfo/Makefile
new file mode 100644
index 0000000..158a209
--- /dev/null
+++ b/usr.bin/lzmainfo/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+PROG= lzmainfo
+
+XZDIR= ${.CURDIR}/../../contrib/xz/src
+LZMALIBDIR= ${.CURDIR}/../../lib/liblzma
+
+.PATH: ${XZDIR}/lzmainfo
+SRCS+= lzmainfo.c
+
+.PATH: ${XZDIR}/common
+SRCS+= tuklib_progname.c \
+ tuklib_exit.c
+
+CFLAGS+= -DHAVE_CONFIG_H \
+ -I${LZMALIBDIR} \
+ -I${XZDIR}/common
+
+LIBADD= lzma
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/lzmainfo/Makefile.depend b/usr.bin/lzmainfo/Makefile.depend
new file mode 100644
index 0000000..987c487
--- /dev/null
+++ b/usr.bin/lzmainfo/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libthr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
new file mode 100644
index 0000000..5511877
--- /dev/null
+++ b/usr.bin/m4/Makefile
@@ -0,0 +1,27 @@
+# $OpenBSD: Makefile,v 1.13 2014/05/12 19:11:19 espie Exp $
+# $FreeBSD$
+
+# -DEXTENDED
+# if you want the paste & spaste macros.
+
+.include <src.opts.mk>
+
+PROG= m4
+CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/../../lib/libopenbsd
+LIBADD= y l m openbsd
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l
+
+WARNS= 3
+
+tokenizer.o: parser.h
+
+CLEANFILES+= parser.c parser.h tokenizer.o
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/m4/Makefile.depend b/usr.bin/m4/Makefile.depend
new file mode 100644
index 0000000..d97824a
--- /dev/null
+++ b/usr.bin/m4/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libopenbsd \
+ lib/liby \
+ lib/msun \
+ usr.bin/lex/lib \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/m4/NOTES b/usr.bin/m4/NOTES
new file mode 100644
index 0000000..d60f80e
--- /dev/null
+++ b/usr.bin/m4/NOTES
@@ -0,0 +1,64 @@
+m4 - macro processor
+
+PD m4 is based on the macro tool distributed with the software
+tools (VOS) package, and described in the "SOFTWARE TOOLS" and
+"SOFTWARE TOOLS IN PASCAL" books. It has been expanded to include
+most of the command set of SysV m4, the standard UN*X macro processor.
+
+Since both PD m4 and UN*X m4 are based on SOFTWARE TOOLS macro,
+there may be certain implementation similarities between
+the two. The PD m4 was produced without ANY references to m4
+sources.
+
+written by: Ozan S. Yigit
+
+References:
+
+ Software Tools distribution: macro
+
+ Kernighan, Brian W. and P. J. Plauger, SOFTWARE
+ TOOLS IN PASCAL, Addison-Wesley, Mass. 1981
+
+ Kernighan, Brian W. and P. J. Plauger, SOFTWARE
+ TOOLS, Addison-Wesley, Mass. 1976
+
+ Kernighan, Brian W. and Dennis M. Ritchie,
+ THE M4 MACRO PROCESSOR, Unix Programmer's Manual,
+ Seventh Edition, Vol. 2, Bell Telephone Labs, 1979
+
+ System V man page for M4
+
+
+Implementation Notes:
+
+[1] PD m4 uses a different (and simpler) stack mechanism than the one
+ described in Software Tools and Software Tools in Pascal books.
+ The triple stack thing is replaced with a single stack containing
+ the call frames and the arguments. Each frame is back-linked to a
+ previous stack frame, which enables us to rewind the stack after
+ each nested call is completed. Each argument is a character pointer
+ to the beginning of the argument string within the string space.
+ The only exceptions to this are (*) arg 0 and arg 1, which are
+ the macro definition and macro name strings, stored dynamically
+ for the hash table.
+
+ . .
+ | . | <-- sp | . |
+ +-------+ +-----+
+ | arg 3 ------------------------------->| str |
+ +-------+ | . |
+ | arg 2 --------------+ .
+ +-------+ |
+ * | | |
+ +-------+ | +-----+
+ | plev | <-- fp +---------------->| str |
+ +-------+ | . |
+ | type | .
+ +-------+
+ | prcf -----------+ plev: paren level
+ +-------+ | type: call type
+ | . | | prcf: prev. call frame
+ . |
+ +-------+ |
+ | <----------+
+ +-------+
diff --git a/usr.bin/m4/TEST/ack.m4 b/usr.bin/m4/TEST/ack.m4
new file mode 100644
index 0000000..bf2a995
--- /dev/null
+++ b/usr.bin/m4/TEST/ack.m4
@@ -0,0 +1,40 @@
+# $OpenBSD: ack.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: ack.m4,v 1.4 1995/09/28 05:37:54 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)ack.m4 8.1 (Berkeley) 6/6/93
+#
+
+define(ack, `ifelse($1,0,incr($2),$2,0,`ack(DECR($1),1)',
+`ack(DECR($1), ack($1,DECR($2)))')')
diff --git a/usr.bin/m4/TEST/hanoi.m4 b/usr.bin/m4/TEST/hanoi.m4
new file mode 100644
index 0000000..5be47d1
--- /dev/null
+++ b/usr.bin/m4/TEST/hanoi.m4
@@ -0,0 +1,45 @@
+# $OpenBSD: hanoi.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: hanoi.m4,v 1.4 1995/09/28 05:37:56 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)hanoi.m4 8.1 (Berkeley) 6/6/93
+#
+
+define(hanoi, `trans(A, B, C, $1)')
+
+define(moved,`move disk from $1 to $2
+')
+
+define(trans, `ifelse($4,1,`moved($1,$2)',
+ `trans($1,$3,$2,DECR($4))moved($1,$2)trans($3,$2,$1,DECR($4))')')
diff --git a/usr.bin/m4/TEST/hash.m4 b/usr.bin/m4/TEST/hash.m4
new file mode 100644
index 0000000..06357df
--- /dev/null
+++ b/usr.bin/m4/TEST/hash.m4
@@ -0,0 +1,55 @@
+# $OpenBSD: hash.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: hash.m4,v 1.4 1995/09/28 05:37:58 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)hash.m4 8.1 (Berkeley) 6/6/93
+#
+
+dnl This probably will not run on any m4 that cannot
+dnl handle char constants in eval.
+dnl
+changequote(<,>) define(HASHVAL,99) dnl
+define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl
+define(str,
+ <ifelse($1,",$2,
+ <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>)
+ >) dnl
+define(KEYWORD,<$1,hash($1),>) dnl
+define(TSTART,
+<struct prehash {
+ char *keyword;
+ int hashval;
+} keytab[] = {>) dnl
+define(TEND,< "",0
+};>) dnl
diff --git a/usr.bin/m4/TEST/math.m4 b/usr.bin/m4/TEST/math.m4
new file mode 100644
index 0000000..0262af6
--- /dev/null
+++ b/usr.bin/m4/TEST/math.m4
@@ -0,0 +1,181 @@
+dnl $FreeBSD$
+dnl A regression test for m4 C operators (ksb,petef)
+dnl If you think you have a short-circuiting m4, run us m4 -DSHORCIRCUIT=yes
+dnl
+dnl first level of precedence
+ifelse(expr(-7),-7,,`failed -
+')dnl
+ifelse(expr(- -2),2,,`failed -
+')dnl
+ifelse(expr(!0),1,,`failed !
+')dnl
+ifelse(expr(!7),0,,`failed !
+')dnl
+ifelse(expr(~-1),0,,`failed ~
+')dnl
+dnl next level of precedence
+ifelse(expr(3*5),15,,`failed *
+')dnl
+ifelse(expr(3*0),0,,`failed *
+')dnl
+ifelse(expr(11/2),5,,`failed /
+')dnl
+ifelse(expr(1/700),0,,`failed /
+')dnl
+ifelse(expr(10%5),0,,`failed %
+')dnl
+ifelse(expr(2%5),2,,`failed %
+')dnl
+ifelse(expr(2%-1),0,,`failed %
+')dnl
+dnl next level of precedence
+ifelse(expr(2+2),4,,`failed +
+')dnl
+ifelse(expr(2+-2),0,,`failed +
+')dnl
+ifelse(expr(2- -2),4,,`failed -
+')dnl
+ifelse(expr(2-2),0,,`failed -
+')dnl
+dnl next level of precedence
+ifelse(expr(1<<4),16,,`failed <<
+')dnl
+ifelse(expr(16>>4),1,,`failed >>
+')dnl
+dnl next level of precedence
+ifelse(expr(4<4),0,,`failed <
+')dnl
+ifelse(expr(4<5),1,,`failed <
+')dnl
+ifelse(expr(4<3),0,,`failed <
+')dnl
+ifelse(expr(4>4),0,,`failed >
+')dnl
+ifelse(expr(4>5),0,,`failed >
+')dnl
+ifelse(expr(4>3),1,,`failed >
+')dnl
+ifelse(expr(4<=4),1,,`failed <=
+')dnl
+ifelse(expr(4<=5),1,,`failed <=
+')dnl
+ifelse(expr(4<=3),0,,`failed <=
+')dnl
+ifelse(expr(4>=4),1,,`failed >=
+')dnl
+ifelse(expr(4>=5),0,,`failed >=
+')dnl
+ifelse(expr(4>=3),1,,`failed >=
+')dnl
+dnl next level of precedence
+ifelse(expr(1==1),1,,`failed ==
+')dnl
+ifelse(expr(1==-1),0,,`failed ==
+')dnl
+ifelse(expr(1!=1),0,,`failed !=
+')dnl
+ifelse(expr(1!=2),1,,`failed !=
+')dnl
+dnl next level of precedence
+ifelse(expr(3&5),1,,`failed &
+')dnl
+ifelse(expr(8&7),0,,`failed &
+')dnl
+dnl next level of precedence
+ifelse(expr(1^1),0,,`failed ^
+')dnl
+ifelse(expr(21^5),16,,`failed ^
+')dnl
+dnl next level of precedence
+ifelse(expr(1|1),1,,`failed |
+')dnl
+ifelse(expr(21|5),21,,`failed |
+')dnl
+ifelse(expr(100|1),101,,`failed |
+')dnl
+dnl next level of precedence
+ifelse(expr(1&&1),1,,`failed &&
+')dnl
+ifelse(expr(0&&1),0,,`failed &&
+')dnl
+ifelse(expr(1&&0),0,,`failed &&
+')dnl
+ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0&&10/0),0,,`failed && shortcircuit
+')')dnl
+dnl next level of precedence
+ifelse(expr(1||1),1,,`failed ||
+')dnl
+ifelse(expr(1||0),1,,`failed ||
+')dnl
+ifelse(expr(0||0),0,,`failed ||
+')dnl
+ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1||10/0),1,,`failed || shortcircuit
+')')dnl
+dnl next level of precedence
+ifelse(expr(0 ? 2 : 5),5,,`failed ?:
+')dnl
+ifelse(expr(1 ? 2 : 5),2,,`failed ?:
+')dnl
+ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(0 ? 10/0 : 7),7,,`failed ?: shortcircuit
+')')dnl
+ifelse(SHORTCIRCUIT,`yes',`ifelse(expr(1 ? 7 : 10/0),7,,`failed ?: shortcircuit
+')')dnl
+dnl operator precedence
+ifelse(expr(!0*-2),-2,,`precedence wrong, ! *
+')dnl
+ifelse(expr(~8/~2),3,,`precedence wrong ~ /
+')dnl
+ifelse(expr(~-20%7),5,,`precedence wrong ~ %
+')dnl
+ifelse(expr(3*2+100),106,,`precedence wrong * +
+')dnl
+ifelse(expr(3+2*100),203,,`precedence wrong + *
+')dnl
+ifelse(expr(2%5-6/3),0,,`precedence wrong % -
+')dnl
+ifelse(expr(2/5-5%3),-2,,`precedence wrong / -
+')dnl
+ifelse(expr(2+5%5+1),3,,`precedence wrong % +
+')dnl
+ifelse(expr(7+9<<1),32,,`precedence wrong + <<
+')dnl
+ifelse(expr(35-3>>2),8,,`precedence wrong - >>
+')dnl
+ifelse(expr(9<10<<5),1,,`precedence wrong << <
+')dnl
+ifelse(expr(9>10<<5),0,,`precedence wrong << >
+')dnl
+ifelse(expr(32>>2<32),1,,`precedence wrong >> <
+')dnl
+ifelse(expr(9<=10<<5),1,,`precedence wrong << <
+')dnl
+ifelse(expr(5<<1<=20>>1),1,,`precedence wrong << <=
+')dnl
+ifelse(expr(5<<1>=20>>1),1,,`precedence wrong << >=
+')dnl
+ifelse(expr(0<7==5>=5),1,,`precedence wrong < ==
+')dnl
+ifelse(expr(0<7!=5>=5),0,,`precedence wrong < !=
+')dnl
+ifelse(expr(0>7==5>=5),0,,`precedence wrong > ==
+')dnl
+ifelse(expr(0>7!=5>=5),1,,`precedence wrong > !=
+')dnl
+ifelse(expr(1&7==7),1,,`precedence wrong & ==
+')dnl
+ifelse(expr(0&7!=6),0,,`precedence wrong & !=
+')dnl
+ifelse(expr(9&1|5),5,,`precedence wrong & |
+')dnl
+ifelse(expr(9&1^5),4,,`precedence wrong & ^
+')dnl
+ifelse(expr(9^1|5),13,,`precedence wrong ^ |
+')dnl
+ifelse(expr(5|0&&1),1,,`precedence wrong | &&
+')dnl
+ifelse(expr(5&&0||0&&5||5),1,,`precedence wrong && ||
+')dnl
+ifelse(expr(0 || 1 ? 0 : 1),0,,`precedence wrong || ?:
+')dnl
+ifelse(expr(5&&(0||0)&&(5||5)),0,,`precedence wrong || parens
+')dnl
diff --git a/usr.bin/m4/TEST/sqroot.m4 b/usr.bin/m4/TEST/sqroot.m4
new file mode 100644
index 0000000..1442ecf6
--- /dev/null
+++ b/usr.bin/m4/TEST/sqroot.m4
@@ -0,0 +1,45 @@
+# $OpenBSD: sqroot.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: sqroot.m4,v 1.4 1995/09/28 05:38:01 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)sqroot.m4 8.1 (Berkeley) 6/6/93
+#
+
+define(square_root,
+ `ifelse(eval($1<0),1,negative-square-root,
+ `square_root_aux($1, 1, eval(($1+1)/2))')')
+define(square_root_aux,
+ `ifelse($3, $2, $3,
+ $3, eval($1/$2), $3,
+ `square_root_aux($1, $3, eval(($3+($1/$3))/2))')')
diff --git a/usr.bin/m4/TEST/string.m4 b/usr.bin/m4/TEST/string.m4
new file mode 100644
index 0000000..61fc28e
--- /dev/null
+++ b/usr.bin/m4/TEST/string.m4
@@ -0,0 +1,45 @@
+# $OpenBSD: string.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: string.m4,v 1.4 1995/09/28 05:38:03 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)string.m4 8.1 (Berkeley) 6/6/93
+#
+
+define(string,`integer $1(len(substr($2,1)))
+str($1,substr($2,1),0)
+data $1(len(substr($2,1)))/EOS/
+')
+
+define(str,`ifelse($2,",,data $1(incr($3))/`LET'substr($2,0,1)/
+`str($1,substr($2,1),incr($3))')')
diff --git a/usr.bin/m4/TEST/test.m4 b/usr.bin/m4/TEST/test.m4
new file mode 100644
index 0000000..25b01b8
--- /dev/null
+++ b/usr.bin/m4/TEST/test.m4
@@ -0,0 +1,243 @@
+# $OpenBSD: test.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+# $NetBSD: test.m4,v 1.4 1995/09/28 05:38:05 tls Exp $
+#
+# Copyright (c) 1989, 1993
+# The Regents of the University of California. All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# 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. 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.
+#
+# $FreeBSD$
+#
+# @(#)test.m4 8.1 (Berkeley) 6/6/93
+#
+
+# test file for mp (not comprehensive)
+#
+# v7 m4 does not have `decr'.
+#
+define(DECR,`eval($1-1)')
+#
+# include string macros
+#
+include(string.m4)
+#
+# create some fortrash strings for an even uglier language
+#
+string(TEXT, "text")
+string(DATA, "data")
+string(BEGIN, "begin")
+string(END, "end")
+string(IF, "if")
+string(THEN, "then")
+string(ELSE, "else")
+string(CASE, "case")
+string(REPEAT, "repeat")
+string(WHILE, "while")
+string(DEFAULT, "default")
+string(UNTIL, "until")
+string(FUNCTION, "function")
+string(PROCEDURE, "procedure")
+string(EXTERNAL, "external")
+string(FORWARD, "forward")
+string(TYPE, "type")
+string(VAR, "var")
+string(CONST, "const")
+string(PROGRAM, "program")
+string(INPUT, "input")
+string(OUTPUT, "output")
+#
+divert(2)
+diversion #1
+divert(3)
+diversion #2
+divert(4)
+diversion #3
+divert(5)
+diversion #4
+divert(0)
+define(abc,xxx)
+ifdef(`abc',defined,undefined)
+#
+# v7 m4 does this wrong. The right output is
+# this is A vEry lon sEntEnCE
+# see m4 documentation for translit.
+#
+translit(`this is a very long sentence', abcdefg, ABCDEF)
+#
+# include towers-of-hanoi
+#
+include(hanoi.m4)
+#
+# some reasonable set of disks
+#
+hanoi(6)
+#
+# include ackermann's function
+#
+include(ack.m4)
+#
+# something like (3,3) will blow away un*x m4.
+#
+ack(2,3)
+#
+# include a square_root function for fixed nums
+#
+include(sqroot.m4)
+#
+# some square roots.
+#
+square_root(15)
+square_root(100)
+square_root(-4)
+square_root(21372)
+#
+# some textual material for enjoyment.
+#
+[taken from the 'Clemson University Computer Newsletter',
+ September 1981, pp. 6-7]
+
+I am a wizard in the magical Kingdom of Transformation and I
+slay dragons for a living. Actually, I am a systems programmer.
+One of the problems with systems programming is explaining to
+non-computer enthusiasts what that is. All of the terms I use to
+describe my job are totally meaningless to them. Usually my response
+to questions about my work is to say as little as possible. For
+instance, if someone asks what happened at work this week, I say
+"Nothing much" and then I change the subject.
+
+With the assistance of my brother, a mechanical engineer, I have devised
+an analogy that everyone can understand. The analogy describes the
+"Kingdom of Transformation" where travelers wander and are magically
+transformed. This kingdom is the computer and the travelers are information.
+The purpose of the computer is to change information to a more meaningful
+forma. The law of conservation applies here: The computer never creates
+and never intentionally destroys data. With no further ado, let us travel
+to the Kingdom of Transformation:
+
+In a land far, far away, there is a magical kingdom called the Kingdom of
+Transformation. A king rules over this land and employs a Council of
+Wizardry. The main purpose of this kingdom is to provide a way for
+neighboring kingdoms to transform citizens into more useful citizens. This
+is done by allowing the citizens to enter the kingdom at one of its ports
+and to travel any of the many routes in the kingdom. They are magically
+transformed along the way. The income of the Kingdom of Transformation
+comes from the many toll roads within its boundaries.
+
+The Kingdom of Transformation was created when several kingdoms got
+together and discovered a mutual need for new talents and abilities for
+citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to
+create this kingdom. CTK designed the country, its transportation routes,
+and its laws of transformation, and created the major highway system.
+
+Hazards
+=======
+
+Because magic is not truly controllable, CTK invariably, but unknowingly,
+creates dragons. Dragons are huge fire-breathing beasts which sometimes
+injure or kill travelers. Fortunately, they do not travel, but always
+remain near their den.
+
+Other hazards also exist which are potentially harmful. As the roads
+become older and more weatherbeaten, pot-holes will develop, trees will
+fall on travelers, etc. CTK maintenance men are called to fix these
+problems.
+
+Wizards
+=======
+
+The wizards play a major role in creating and maintaining the kingdom but
+get little credit for their work because it is performed secretly. The
+wizards do not wan the workers or travelers to learn their incantations
+because many laws would be broken and chaos would result.
+
+CTK's grand design is always general enough to be applicable in many
+different situations. As a result, it is often difficult to use. The
+first duty of the wizards is to tailor the transformation laws so as to be
+more beneficial and easier to use in their particular environment.
+
+After creation of the kingdom, a major duty of the wizards is to search for
+and kill dragons. If travelers do not return on time or if they return
+injured, the ruler of the country contacts the wizards. If the wizards
+determine that the injury or death occurred due to the traveler's
+negligence, they provide the traveler's country with additional warnings.
+If not, they must determine if the cause was a road hazard or a dragon. If
+the suspect a road hazard, they call in a CTK maintenance man to locate the
+hazard and to eliminate it, as in repairing the pothole in the road. If
+they think that cause was a dragon, then they must find and slay it.
+
+The most difficult part of eliminating a dragon is finding it. Sometimes
+the wizard magically knows where the dragon's lair it, but often the wizard
+must send another traveler along the same route and watch to see where he
+disappears. This sounds like a failsafe method for finding dragons (and a
+suicide mission for thr traveler) but the second traveler does not always
+disappear. Some dragons eat any traveler who comes too close; others are
+very picky.
+
+The wizards may call in CTK who designed the highway system and
+transformation laws to help devise a way to locate the dragon. CTK also
+helps provide the right spell or incantation to slay the dragon. (There is
+no general spell to slay dragons; each dragon must be eliminated with a
+different spell.)
+
+Because neither CTK nor wizards are perfect, spells to not always work
+correctly. At best, nothing happens when the wrong spell is uttered. At
+worst, the dragon becomes a much larger dragon or multiplies into several
+smaller ones. In either case, new spells must be found.
+
+If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
+have time to do other things. They hide in castles and practice spells and
+incatations. They also devise shortcuts for travelers and new laws of
+transformation.
+
+Changes in the Kingdom
+======================
+
+As new transformation kingdoms are created and old ones are maintained,
+CTK, Inc. is constantly learning new things. It learns ways to avoid
+creating some of the dragons that they have previously created. It also
+discovers new and better laws of transformation. As a result, CTK will
+periodically create a new grand design which is far better than the old.
+The wizards determine when is a good time to implement this new design.
+This is when the tourist season is slow or when no important travelers
+(VIPs) are to arrive. The kingdom must be closed for the actual
+implementation and is leter reopened as a new and better place to go.
+
+A final question you might ask is what happens when the number of tourists
+becomes too great for the kingdom to handle in a reasonable period of time
+(i.e., the tourist lines at the ports are too long). The Kingdom of
+Transformation has three options: (1) shorten the paths that a tourist must
+travel, or (2) convince CTK to develop a faster breed of horses so that the
+travelers can finish sooner, or (3) annex more territories so that the
+kingdom can handle more travelers.
+
+Thus ends the story of the Kingdom of Transformation. I hope this has
+explained my job to you: I slay dragons for a living.
+
+#
+#should do an automatic undivert..
+#
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
new file mode 100644
index 0000000..f3d72b6
--- /dev/null
+++ b/usr.bin/m4/eval.c
@@ -0,0 +1,1014 @@
+/* $OpenBSD: eval.c,v 1.74 2015/02/05 12:59:57 millert Exp $ */
+/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+
+/*
+ * eval.c
+ * Facility: m4 macro processor
+ * by: oz
+ */
+
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <fcntl.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+#include "pathnames.h"
+
+static void dodefn(const char *);
+static void dopushdef(const char *, const char *);
+static void dodump(const char *[], int);
+static void dotrace(const char *[], int, int);
+static void doifelse(const char *[], int);
+static int doincl(const char *);
+static int dopaste(const char *);
+static void dochq(const char *[], int);
+static void dochc(const char *[], int);
+static void dom4wrap(const char *);
+static void dodiv(int);
+static void doundiv(const char *[], int);
+static void dosub(const char *[], int);
+static void map(char *, const char *, const char *, const char *);
+static const char *handledash(char *, char *, const char *);
+static void expand_builtin(const char *[], int, int);
+static void expand_macro(const char *[], int);
+static void dump_one_def(const char *, struct macro_definition *);
+
+unsigned long expansion_id;
+
+/*
+ * eval - eval all macros and builtins calls
+ * argc - number of elements in argv.
+ * argv - element vector :
+ * argv[0] = definition of a user
+ * macro or NULL if built-in.
+ * argv[1] = name of the macro or
+ * built-in.
+ * argv[2] = parameters to user-defined
+ * . macro or built-in.
+ * .
+ *
+ * A call in the form of macro-or-builtin() will result in:
+ * argv[0] = nullstr
+ * argv[1] = macro-or-builtin
+ * argv[2] = nullstr
+ *
+ * argc is 3 for macro-or-builtin() and 2 for macro-or-builtin
+ */
+void
+eval(const char *argv[], int argc, int td, int is_traced)
+{
+ size_t mark = SIZE_MAX;
+
+ expansion_id++;
+ if (td & RECDEF)
+ m4errx(1, "expanding recursive definition for %s.", argv[1]);
+ if (is_traced)
+ mark = trace(argv, argc, infile+ilevel);
+ if (td == MACRTYPE)
+ expand_macro(argv, argc);
+ else
+ expand_builtin(argv, argc, td);
+ if (mark != SIZE_MAX)
+ finish_trace(mark);
+}
+
+/*
+ * expand_builtin - evaluate built-in macros.
+ */
+void
+expand_builtin(const char *argv[], int argc, int td)
+{
+ int c, n;
+ int ac;
+ static int sysval = 0;
+
+#ifdef DEBUG
+ printf("argc = %d\n", argc);
+ for (n = 0; n < argc; n++)
+ printf("argv[%d] = %s\n", n, argv[n]);
+ fflush(stdout);
+#endif
+
+ /*
+ * if argc == 3 and argv[2] is null, then we
+ * have macro-or-builtin() type call. We adjust
+ * argc to avoid further checking..
+ */
+ /* we keep the initial value for those built-ins that differentiate
+ * between builtin() and builtin.
+ */
+ ac = argc;
+
+ if (argc == 3 && !*(argv[2]) && !mimic_gnu)
+ argc--;
+
+ switch (td & TYPEMASK) {
+
+ case DEFITYPE:
+ if (argc > 2)
+ dodefine(argv[2], (argc > 3) ? argv[3] : null);
+ break;
+
+ case PUSDTYPE:
+ if (argc > 2)
+ dopushdef(argv[2], (argc > 3) ? argv[3] : null);
+ break;
+
+ case DUMPTYPE:
+ dodump(argv, argc);
+ break;
+
+ case TRACEONTYPE:
+ dotrace(argv, argc, 1);
+ break;
+
+ case TRACEOFFTYPE:
+ dotrace(argv, argc, 0);
+ break;
+
+ case EXPRTYPE:
+ /*
+ * doexpr - evaluate arithmetic
+ * expression
+ */
+ {
+ int base = 10;
+ int maxdigits = 0;
+ const char *errstr;
+
+ if (argc > 3) {
+ base = strtonum(argv[3], 2, 36, &errstr);
+ if (errstr) {
+ m4errx(1, "expr: base %s invalid.", argv[3]);
+ }
+ }
+ if (argc > 4) {
+ maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr);
+ if (errstr) {
+ m4errx(1, "expr: maxdigits %s invalid.", argv[4]);
+ }
+ }
+ if (argc > 2)
+ pbnumbase(expr(argv[2]), base, maxdigits);
+ break;
+ }
+
+ case IFELTYPE:
+ if (argc > 4)
+ doifelse(argv, argc);
+ break;
+
+ case IFDFTYPE:
+ /*
+ * doifdef - select one of two
+ * alternatives based on the existence of
+ * another definition
+ */
+ if (argc > 3) {
+ if (lookup_macro_definition(argv[2]) != NULL)
+ pbstr(argv[3]);
+ else if (argc > 4)
+ pbstr(argv[4]);
+ }
+ break;
+
+ case LENGTYPE:
+ /*
+ * dolen - find the length of the
+ * argument
+ */
+ pbnum((argc > 2) ? strlen(argv[2]) : 0);
+ break;
+
+ case INCRTYPE:
+ /*
+ * doincr - increment the value of the
+ * argument
+ */
+ if (argc > 2)
+ pbnum(atoi(argv[2]) + 1);
+ break;
+
+ case DECRTYPE:
+ /*
+ * dodecr - decrement the value of the
+ * argument
+ */
+ if (argc > 2)
+ pbnum(atoi(argv[2]) - 1);
+ break;
+
+ case SYSCTYPE:
+ /*
+ * dosys - execute system command
+ */
+ if (argc > 2) {
+ fflush(stdout);
+ sysval = system(argv[2]);
+ }
+ break;
+
+ case SYSVTYPE:
+ /*
+ * dosysval - return value of the last
+ * system call.
+ *
+ */
+ pbnum(sysval);
+ break;
+
+ case ESYSCMDTYPE:
+ if (argc > 2)
+ doesyscmd(argv[2]);
+ break;
+ case INCLTYPE:
+ if (argc > 2) {
+ if (!doincl(argv[2])) {
+ if (mimic_gnu) {
+ warn("%s at line %lu: include(%s)",
+ CURRENT_NAME, CURRENT_LINE, argv[2]);
+ exit_code = 1;
+ } else
+ err(1, "%s at line %lu: include(%s)",
+ CURRENT_NAME, CURRENT_LINE, argv[2]);
+ }
+ }
+ break;
+
+ case SINCTYPE:
+ if (argc > 2)
+ (void) doincl(argv[2]);
+ break;
+#ifdef EXTENDED
+ case PASTTYPE:
+ if (argc > 2)
+ if (!dopaste(argv[2]))
+ err(1, "%s at line %lu: paste(%s)",
+ CURRENT_NAME, CURRENT_LINE, argv[2]);
+ break;
+
+ case SPASTYPE:
+ if (argc > 2)
+ (void) dopaste(argv[2]);
+ break;
+ case FORMATTYPE:
+ doformat(argv, argc);
+ break;
+#endif
+ case CHNQTYPE:
+ dochq(argv, ac);
+ break;
+
+ case CHNCTYPE:
+ dochc(argv, argc);
+ break;
+
+ case SUBSTYPE:
+ /*
+ * dosub - select substring
+ *
+ */
+ if (argc > 3)
+ dosub(argv, argc);
+ break;
+
+ case SHIFTYPE:
+ /*
+ * doshift - push back all arguments
+ * except the first one (i.e. skip
+ * argv[2])
+ */
+ if (argc > 3) {
+ for (n = argc - 1; n > 3; n--) {
+ pbstr(rquote);
+ pbstr(argv[n]);
+ pbstr(lquote);
+ pushback(COMMA);
+ }
+ pbstr(rquote);
+ pbstr(argv[3]);
+ pbstr(lquote);
+ }
+ break;
+
+ case DIVRTYPE:
+ if (argc > 2 && (n = atoi(argv[2])) != 0)
+ dodiv(n);
+ else {
+ active = stdout;
+ oindex = 0;
+ }
+ break;
+
+ case UNDVTYPE:
+ doundiv(argv, argc);
+ break;
+
+ case DIVNTYPE:
+ /*
+ * dodivnum - return the number of
+ * current output diversion
+ */
+ pbnum(oindex);
+ break;
+
+ case UNDFTYPE:
+ /*
+ * doundefine - undefine a previously
+ * defined macro(s) or m4 keyword(s).
+ */
+ if (argc > 2)
+ for (n = 2; n < argc; n++)
+ macro_undefine(argv[n]);
+ break;
+
+ case POPDTYPE:
+ /*
+ * dopopdef - remove the topmost
+ * definitions of macro(s) or m4
+ * keyword(s).
+ */
+ if (argc > 2)
+ for (n = 2; n < argc; n++)
+ macro_popdef(argv[n]);
+ break;
+
+ case MKTMTYPE:
+ /*
+ * dotemp - create a temporary file
+ */
+ if (argc > 2) {
+ int fd;
+ char *temp;
+
+ temp = xstrdup(argv[2]);
+
+ fd = mkstemp(temp);
+ if (fd == -1)
+ err(1,
+ "%s at line %lu: couldn't make temp file %s",
+ CURRENT_NAME, CURRENT_LINE, argv[2]);
+ close(fd);
+ pbstr(temp);
+ free(temp);
+ }
+ break;
+
+ case TRNLTYPE:
+ /*
+ * dotranslit - replace all characters in
+ * the source string that appears in the
+ * "from" string with the corresponding
+ * characters in the "to" string.
+ */
+ if (argc > 3) {
+ char *temp;
+
+ temp = xalloc(strlen(argv[2])+1, NULL);
+ if (argc > 4)
+ map(temp, argv[2], argv[3], argv[4]);
+ else
+ map(temp, argv[2], argv[3], null);
+ pbstr(temp);
+ free(temp);
+ } else if (argc > 2)
+ pbstr(argv[2]);
+ break;
+
+ case INDXTYPE:
+ /*
+ * doindex - find the index of the second
+ * argument string in the first argument
+ * string. -1 if not present.
+ */
+ pbnum((argc > 3) ? indx(argv[2], argv[3]) : -1);
+ break;
+
+ case ERRPTYPE:
+ /*
+ * doerrp - print the arguments to stderr
+ * file
+ */
+ if (argc > 2) {
+ for (n = 2; n < argc; n++)
+ fprintf(stderr, "%s ", argv[n]);
+ fprintf(stderr, "\n");
+ }
+ break;
+
+ case DNLNTYPE:
+ /*
+ * dodnl - eat-up-to and including
+ * newline
+ */
+ while ((c = gpbc()) != '\n' && c != EOF)
+ ;
+ break;
+
+ case M4WRTYPE:
+ /*
+ * dom4wrap - set up for
+ * wrap-up/wind-down activity
+ */
+ if (argc > 2)
+ dom4wrap(argv[2]);
+ break;
+
+ case EXITTYPE:
+ /*
+ * doexit - immediate exit from m4.
+ */
+ killdiv();
+ exit((argc > 2) ? atoi(argv[2]) : 0);
+ break;
+
+ case DEFNTYPE:
+ if (argc > 2)
+ for (n = 2; n < argc; n++)
+ dodefn(argv[n]);
+ break;
+
+ case INDIRTYPE: /* Indirect call */
+ if (argc > 2)
+ doindir(argv, argc);
+ break;
+
+ case BUILTINTYPE: /* Builtins only */
+ if (argc > 2)
+ dobuiltin(argv, argc);
+ break;
+
+ case PATSTYPE:
+ if (argc > 2)
+ dopatsubst(argv, argc);
+ break;
+ case REGEXPTYPE:
+ if (argc > 2)
+ doregexp(argv, argc);
+ break;
+ case LINETYPE:
+ doprintlineno(infile+ilevel);
+ break;
+ case FILENAMETYPE:
+ doprintfilename(infile+ilevel);
+ break;
+ case SELFTYPE:
+ pbstr(rquote);
+ pbstr(argv[1]);
+ pbstr(lquote);
+ break;
+ default:
+ m4errx(1, "eval: major botch.");
+ break;
+ }
+}
+
+/*
+ * expand_macro - user-defined macro expansion
+ */
+void
+expand_macro(const char *argv[], int argc)
+{
+ const char *t;
+ const char *p;
+ int n;
+ int argno;
+
+ t = argv[0]; /* defn string as a whole */
+ p = t;
+ while (*p)
+ p++;
+ p--; /* last character of defn */
+ while (p > t) {
+ if (*(p - 1) != ARGFLAG)
+ PUSHBACK(*p);
+ else {
+ switch (*p) {
+
+ case '#':
+ pbnum(argc - 2);
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if ((argno = *p - '0') < argc - 1)
+ pbstr(argv[argno + 1]);
+ break;
+ case '*':
+ if (argc > 2) {
+ for (n = argc - 1; n > 2; n--) {
+ pbstr(argv[n]);
+ pushback(COMMA);
+ }
+ pbstr(argv[2]);
+ }
+ break;
+ case '@':
+ if (argc > 2) {
+ for (n = argc - 1; n > 2; n--) {
+ pbstr(rquote);
+ pbstr(argv[n]);
+ pbstr(lquote);
+ pushback(COMMA);
+ }
+ pbstr(rquote);
+ pbstr(argv[2]);
+ pbstr(lquote);
+ }
+ break;
+ default:
+ PUSHBACK(*p);
+ PUSHBACK('$');
+ break;
+ }
+ p--;
+ }
+ p--;
+ }
+ if (p == t) /* do last character */
+ PUSHBACK(*p);
+}
+
+
+/*
+ * dodefine - install definition in the table
+ */
+void
+dodefine(const char *name, const char *defn)
+{
+ if (!*name && !mimic_gnu)
+ m4errx(1, "null definition.");
+ else
+ macro_define(name, defn);
+}
+
+/*
+ * dodefn - push back a quoted definition of
+ * the given name.
+ */
+static void
+dodefn(const char *name)
+{
+ struct macro_definition *p;
+
+ if ((p = lookup_macro_definition(name)) != NULL) {
+ if ((p->type & TYPEMASK) == MACRTYPE) {
+ pbstr(rquote);
+ pbstr(p->defn);
+ pbstr(lquote);
+ } else {
+ pbstr(p->defn);
+ pbstr(BUILTIN_MARKER);
+ }
+ }
+}
+
+/*
+ * dopushdef - install a definition in the hash table
+ * without removing a previous definition. Since
+ * each new entry is entered in *front* of the
+ * hash bucket, it hides a previous definition from
+ * lookup.
+ */
+static void
+dopushdef(const char *name, const char *defn)
+{
+ if (!*name && !mimic_gnu)
+ m4errx(1, "null definition.");
+ else
+ macro_pushdef(name, defn);
+}
+
+/*
+ * dump_one_def - dump the specified definition.
+ */
+static void
+dump_one_def(const char *name, struct macro_definition *p)
+{
+ if (!traceout)
+ traceout = stderr;
+ if (mimic_gnu) {
+ if ((p->type & TYPEMASK) == MACRTYPE)
+ fprintf(traceout, "%s:\t%s\n", name, p->defn);
+ else {
+ fprintf(traceout, "%s:\t<%s>\n", name, p->defn);
+ }
+ } else
+ fprintf(traceout, "`%s'\t`%s'\n", name, p->defn);
+}
+
+/*
+ * dodumpdef - dump the specified definitions in the hash
+ * table to stderr. If nothing is specified, the entire
+ * hash table is dumped.
+ */
+static void
+dodump(const char *argv[], int argc)
+{
+ int n;
+ struct macro_definition *p;
+
+ if (argc > 2) {
+ for (n = 2; n < argc; n++)
+ if ((p = lookup_macro_definition(argv[n])) != NULL)
+ dump_one_def(argv[n], p);
+ } else
+ macro_for_all(dump_one_def);
+}
+
+/*
+ * dotrace - mark some macros as traced/untraced depending upon on.
+ */
+static void
+dotrace(const char *argv[], int argc, int on)
+{
+ int n;
+
+ if (argc > 2) {
+ for (n = 2; n < argc; n++)
+ mark_traced(argv[n], on);
+ } else
+ mark_traced(NULL, on);
+}
+
+/*
+ * doifelse - select one of two alternatives - loop.
+ */
+static void
+doifelse(const char *argv[], int argc)
+{
+ cycle {
+ if (STREQ(argv[2], argv[3]))
+ pbstr(argv[4]);
+ else if (argc == 6)
+ pbstr(argv[5]);
+ else if (argc > 6) {
+ argv += 3;
+ argc -= 3;
+ continue;
+ }
+ break;
+ }
+}
+
+/*
+ * doinclude - include a given file.
+ */
+static int
+doincl(const char *ifile)
+{
+ if (ilevel + 1 == MAXINP)
+ m4errx(1, "too many include files.");
+ if (fopen_trypath(infile+ilevel+1, ifile) != NULL) {
+ ilevel++;
+ bbase[ilevel] = bufbase = bp;
+ return (1);
+ } else
+ return (0);
+}
+
+#ifdef EXTENDED
+/*
+ * dopaste - include a given file without any
+ * macro processing.
+ */
+static int
+dopaste(const char *pfile)
+{
+ FILE *pf;
+ int c;
+
+ if ((pf = fopen(pfile, "r")) != NULL) {
+ if (synch_lines)
+ fprintf(active, "#line 1 \"%s\"\n", pfile);
+ while ((c = getc(pf)) != EOF)
+ putc(c, active);
+ (void) fclose(pf);
+ emit_synchline();
+ return (1);
+ } else
+ return (0);
+}
+#endif
+
+/*
+ * dochq - change quote characters
+ */
+static void
+dochq(const char *argv[], int ac)
+{
+ if (ac == 2) {
+ lquote[0] = LQUOTE; lquote[1] = EOS;
+ rquote[0] = RQUOTE; rquote[1] = EOS;
+ } else {
+ strlcpy(lquote, argv[2], sizeof(lquote));
+ if (ac > 3) {
+ strlcpy(rquote, argv[3], sizeof(rquote));
+ } else {
+ rquote[0] = ECOMMT; rquote[1] = EOS;
+ }
+ }
+}
+
+/*
+ * dochc - change comment characters
+ */
+static void
+dochc(const char *argv[], int argc)
+{
+/* XXX Note that there is no difference between no argument and a single
+ * empty argument.
+ */
+ if (argc == 2) {
+ scommt[0] = EOS;
+ ecommt[0] = EOS;
+ } else {
+ strlcpy(scommt, argv[2], sizeof(scommt));
+ if (argc == 3) {
+ ecommt[0] = ECOMMT; ecommt[1] = EOS;
+ } else {
+ strlcpy(ecommt, argv[3], sizeof(ecommt));
+ }
+ }
+}
+
+/*
+ * dom4wrap - expand text at EOF
+ */
+static void
+dom4wrap(const char *text)
+{
+ if (wrapindex >= maxwraps) {
+ if (maxwraps == 0)
+ maxwraps = 16;
+ else
+ maxwraps *= 2;
+ m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps),
+ "too many m4wraps");
+ }
+ m4wraps[wrapindex++] = xstrdup(text);
+}
+
+/*
+ * dodivert - divert the output to a temporary file
+ */
+static void
+dodiv(int n)
+{
+ int fd;
+
+ oindex = n;
+ if (n >= maxout) {
+ if (mimic_gnu)
+ resizedivs(n + 10);
+ else
+ n = 0; /* bitbucket */
+ }
+
+ if (n < 0)
+ n = 0; /* bitbucket */
+ if (outfile[n] == NULL) {
+ char fname[] = _PATH_DIVNAME;
+
+ if ((fd = mkstemp(fname)) < 0 ||
+ unlink(fname) == -1 ||
+ (outfile[n] = fdopen(fd, "w+")) == NULL)
+ err(1, "%s: cannot divert", fname);
+ }
+ active = outfile[n];
+}
+
+/*
+ * doundivert - undivert a specified output, or all
+ * other outputs, in numerical order.
+ */
+static void
+doundiv(const char *argv[], int argc)
+{
+ int ind;
+ int n;
+
+ if (argc > 2) {
+ for (ind = 2; ind < argc; ind++) {
+ const char *errstr;
+ n = strtonum(argv[ind], 1, INT_MAX, &errstr);
+ if (errstr) {
+ if (errno == EINVAL && mimic_gnu)
+ getdivfile(argv[ind]);
+ } else {
+ if (n < maxout && outfile[n] != NULL)
+ getdiv(n);
+ }
+ }
+ }
+ else
+ for (n = 1; n < maxout; n++)
+ if (outfile[n] != NULL)
+ getdiv(n);
+}
+
+/*
+ * dosub - select substring
+ */
+static void
+dosub(const char *argv[], int argc)
+{
+ const char *ap, *fc, *k;
+ int nc;
+
+ ap = argv[2]; /* target string */
+#ifdef EXPR
+ fc = ap + expr(argv[3]); /* first char */
+#else
+ fc = ap + atoi(argv[3]); /* first char */
+#endif
+ nc = strlen(fc);
+ if (argc >= 5)
+#ifdef EXPR
+ nc = min(nc, expr(argv[4]));
+#else
+ nc = min(nc, atoi(argv[4]));
+#endif
+ if (fc >= ap && fc < ap + strlen(ap))
+ for (k = fc + nc - 1; k >= fc; k--)
+ pushback(*k);
+}
+
+/*
+ * map:
+ * map every character of s1 that is specified in from
+ * into s3 and replace in s. (source s1 remains untouched)
+ *
+ * This is derived from the a standard implementation of map(s,from,to)
+ * function of ICON language. Within mapvec, we replace every character
+ * of "from" with the corresponding character in "to".
+ * If "to" is shorter than "from", than the corresponding entries are null,
+ * which means that those characters disappear altogether.
+ */
+static void
+map(char *dest, const char *src, const char *from, const char *to)
+{
+ const char *tmp;
+ unsigned char sch, dch;
+ static char frombis[257];
+ static char tobis[257];
+ int i;
+ char seen[256];
+ static unsigned char mapvec[256] = {
+ 0, 1, 2, 3, 4, 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, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
+ 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
+ 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
+ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
+ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+ 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
+ };
+
+ if (*src) {
+ if (mimic_gnu) {
+ /*
+ * expand character ranges on the fly
+ */
+ from = handledash(frombis, frombis + 256, from);
+ to = handledash(tobis, tobis + 256, to);
+ }
+ tmp = from;
+ /*
+ * create a mapping between "from" and
+ * "to"
+ */
+ for (i = 0; i < 256; i++)
+ seen[i] = 0;
+ while (*from) {
+ if (!seen[(unsigned char)(*from)]) {
+ mapvec[(unsigned char)(*from)] = (unsigned char)(*to);
+ seen[(unsigned char)(*from)] = 1;
+ }
+ from++;
+ if (*to)
+ to++;
+ }
+
+ while (*src) {
+ sch = (unsigned char)(*src++);
+ dch = mapvec[sch];
+ if ((*dest = (char)dch))
+ dest++;
+ }
+ /*
+ * restore all the changed characters
+ */
+ while (*tmp) {
+ mapvec[(unsigned char)(*tmp)] = (unsigned char)(*tmp);
+ tmp++;
+ }
+ }
+ *dest = '\0';
+}
+
+
+/*
+ * handledash:
+ * use buffer to copy the src string, expanding character ranges
+ * on the way.
+ */
+static const char *
+handledash(char *buffer, char *end, const char *src)
+{
+ char *p;
+
+ p = buffer;
+ while(*src) {
+ if (src[1] == '-' && src[2]) {
+ unsigned char i;
+ if ((unsigned char)src[0] <= (unsigned char)src[2]) {
+ for (i = (unsigned char)src[0];
+ i <= (unsigned char)src[2]; i++) {
+ *p++ = i;
+ if (p == end) {
+ *p = '\0';
+ return buffer;
+ }
+ }
+ } else {
+ for (i = (unsigned char)src[0];
+ i >= (unsigned char)src[2]; i--) {
+ *p++ = i;
+ if (p == end) {
+ *p = '\0';
+ return buffer;
+ }
+ }
+ }
+ src += 3;
+ } else
+ *p++ = *src++;
+ if (p == end)
+ break;
+ }
+ *p = '\0';
+ return buffer;
+}
diff --git a/usr.bin/m4/expr.c b/usr.bin/m4/expr.c
new file mode 100644
index 0000000..8a64217
--- /dev/null
+++ b/usr.bin/m4/expr.c
@@ -0,0 +1,47 @@
+/* $OpenBSD: expr.c,v 1.18 2010/09/07 19:58:09 marco Exp $ */
+/*
+ * Copyright (c) 2004 Marc Espie <espie@cvs.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 <stdint.h>
+#include <stdio.h>
+#include <stddef.h>
+#include "mdef.h"
+#include "extern.h"
+
+int32_t end_result;
+static const char *copy_toeval;
+int yyerror(const char *msg);
+
+extern void yy_scan_string(const char *);
+extern int yyparse(void);
+
+int
+yyerror(const char *msg)
+{
+ fprintf(stderr, "m4: %s in expr %s\n", msg, copy_toeval);
+ return(0);
+}
+
+int
+expr(const char *toeval)
+{
+ copy_toeval = toeval;
+ yy_scan_string(toeval);
+ yyparse();
+ return end_result;
+}
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h
new file mode 100644
index 0000000..6d410d8
--- /dev/null
+++ b/usr.bin/m4/extern.h
@@ -0,0 +1,179 @@
+/* $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 $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+/* eval.c */
+extern void eval(const char *[], int, int, int);
+extern void dodefine(const char *, const char *);
+extern unsigned long expansion_id;
+
+/* expr.c */
+extern int expr(const char *);
+
+/* gnum4.c */
+extern void addtoincludepath(const char *);
+extern struct input_file *fopen_trypath(struct input_file *, const char *);
+extern void doindir(const char *[], int);
+extern void dobuiltin(const char *[], int);
+extern void dopatsubst(const char *[], int);
+extern void doregexp(const char *[], int);
+
+extern void doprintlineno(struct input_file *);
+extern void doprintfilename(struct input_file *);
+
+extern void doesyscmd(const char *);
+extern void getdivfile(const char *);
+extern void doformat(const char *[], int);
+
+/* look.c */
+
+#define FLAG_UNTRACED 0
+#define FLAG_TRACED 1
+#define FLAG_NO_TRACE 2
+
+extern void init_macros(void);
+extern ndptr lookup(const char *);
+extern void mark_traced(const char *, int);
+extern struct ohash macros;
+
+extern struct macro_definition *lookup_macro_definition(const char *);
+extern void macro_define(const char *, const char *);
+extern void macro_pushdef(const char *, const char *);
+extern void macro_popdef(const char *);
+extern void macro_undefine(const char *);
+extern void setup_builtin(const char *, unsigned int);
+extern void macro_for_all(void (*)(const char *, struct macro_definition *));
+#define macro_getdef(p) ((p)->d)
+#define macro_name(p) ((p)->name)
+#define macro_builtin_type(p) ((p)->builtin_type)
+#define is_traced(p) ((p)->trace_flags == FLAG_NO_TRACE ? (trace_flags & TRACE_ALL) : (p)->trace_flags)
+
+extern ndptr macro_getbuiltin(const char *);
+
+/* main.c */
+extern void outputstr(const char *);
+extern void do_emit_synchline(void);
+extern int exit_code;
+#define emit_synchline() do { if (synch_lines) do_emit_synchline(); } while(0)
+
+/* misc.c */
+extern void chrsave(int);
+extern char *compute_prevep(void);
+extern void getdiv(int);
+extern ptrdiff_t indx(const char *, const char *);
+extern void initspaces(void);
+extern void killdiv(void);
+extern void onintr(int);
+extern void pbnum(int);
+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 *, ...);
+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);
+extern size_t buffer_mark(void);
+extern void dump_buffer(FILE *, size_t);
+extern void m4errx(int, const char *, ...);
+
+extern int obtain_char(struct input_file *);
+extern void set_input(struct input_file *, FILE *, const char *);
+extern void release_input(struct input_file *);
+
+/* speeded-up versions of chrsave/pushback */
+#define PUSHBACK(c) \
+ do { \
+ if (bp >= endpbb) \
+ enlarge_bufspace(); \
+ *bp++ = (c); \
+ } while(0)
+
+#define CHRSAVE(c) \
+ do { \
+ if (ep >= endest) \
+ enlarge_strspace(); \
+ *ep++ = (c); \
+ } while(0)
+
+/* and corresponding exposure for local symbols */
+extern void enlarge_bufspace(void);
+extern void enlarge_strspace(void);
+extern unsigned char *endpbb;
+extern char *endest;
+
+/* trace.c */
+extern unsigned int trace_flags;
+#define TRACE_ALL 512
+extern void trace_file(const char *);
+extern size_t trace(const char **, int, struct input_file *);
+extern void finish_trace(size_t);
+extern void set_trace_flags(const char *);
+extern FILE *traceout;
+
+extern stae *mstack; /* stack of m4 machine */
+extern char *sstack; /* shadow stack, for string space extension */
+extern FILE *active; /* active output file pointer */
+extern struct input_file infile[];/* input file stack (0=stdin) */
+extern FILE **outfile; /* diversion array(0=bitbucket) */
+extern int maxout; /* maximum number of diversions */
+extern int fp; /* m4 call frame pointer */
+extern int ilevel; /* input file stack pointer */
+extern int oindex; /* diversion index. */
+extern int sp; /* current m4 stack pointer */
+extern unsigned char *bp; /* first available character */
+extern unsigned char *buf; /* push-back buffer */
+extern unsigned char *bufbase; /* buffer base for this ilevel */
+extern unsigned char *bbase[]; /* buffer base per ilevel */
+extern char ecommt[MAXCCHARS+1];/* end character for comment */
+extern char *ep; /* first free char in strspace */
+extern char lquote[MAXCCHARS+1];/* left quote character (`) */
+extern char **m4wraps; /* m4wrap string default. */
+extern int maxwraps; /* size of m4wraps array */
+extern int wrapindex; /* current index in m4wraps */
+
+extern const char *null; /* as it says.. just a null. */
+extern char rquote[MAXCCHARS+1];/* right quote character (') */
+extern char scommt[MAXCCHARS+1];/* start character for comment */
+extern int synch_lines; /* line synchronisation directives */
+
+extern int mimic_gnu; /* behaves like gnu-m4 */
+extern int prefix_builtins; /* prefix builtin macros with m4_ */
+
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c
new file mode 100644
index 0000000..61f96d4
--- /dev/null
+++ b/usr.bin/m4/gnum4.c
@@ -0,0 +1,673 @@
+/* $OpenBSD: gnum4.c,v 1.50 2015/04/29 00:13:26 millert Exp $ */
+
+/*
+ * Copyright (c) 1999 Marc Espie
+ *
+ * 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 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.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * functions needed to support gnu-m4 extensions, including a fake freezing
+ */
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <err.h>
+#include <paths.h>
+#include <regex.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <limits.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+
+
+int mimic_gnu = 0;
+
+/*
+ * Support for include path search
+ * First search in the current directory.
+ * If not found, and the path is not absolute, include path kicks in.
+ * First, -I options, in the order found on the command line.
+ * Then M4PATH env variable
+ */
+
+static struct path_entry {
+ char *name;
+ struct path_entry *next;
+} *first, *last;
+
+static struct path_entry *new_path_entry(const char *);
+static void ensure_m4path(void);
+static struct input_file *dopath(struct input_file *, const char *);
+
+static struct path_entry *
+new_path_entry(const char *dirname)
+{
+ struct path_entry *n;
+
+ n = malloc(sizeof(struct path_entry));
+ if (!n)
+ errx(1, "out of memory");
+ n->name = xstrdup(dirname);
+ n->next = 0;
+ return n;
+}
+
+void
+addtoincludepath(const char *dirname)
+{
+ struct path_entry *n;
+
+ n = new_path_entry(dirname);
+
+ if (last) {
+ last->next = n;
+ last = n;
+ }
+ else
+ last = first = n;
+}
+
+static void
+ensure_m4path(void)
+{
+ static int envpathdone = 0;
+ char *envpath;
+ char *sweep;
+ char *path;
+
+ if (envpathdone)
+ return;
+ envpathdone = TRUE;
+ envpath = getenv("M4PATH");
+ if (!envpath)
+ return;
+ /* for portability: getenv result is read-only */
+ envpath = xstrdup(envpath);
+ for (sweep = envpath;
+ (path = strsep(&sweep, ":")) != NULL;)
+ addtoincludepath(path);
+ free(envpath);
+}
+
+static
+struct input_file *
+dopath(struct input_file *i, const char *filename)
+{
+ char path[PATH_MAX];
+ struct path_entry *pe;
+ FILE *f;
+
+ for (pe = first; pe; pe = pe->next) {
+ snprintf(path, sizeof(path), "%s/%s", pe->name, filename);
+ if ((f = fopen(path, "r")) != NULL) {
+ set_input(i, f, path);
+ return i;
+ }
+ }
+ return NULL;
+}
+
+struct input_file *
+fopen_trypath(struct input_file *i, const char *filename)
+{
+ FILE *f;
+
+ f = fopen(filename, "r");
+ if (f != NULL) {
+ set_input(i, f, filename);
+ return i;
+ }
+ if (filename[0] == '/')
+ return NULL;
+
+ ensure_m4path();
+
+ return dopath(i, filename);
+}
+
+void
+doindir(const char *argv[], int argc)
+{
+ ndptr n;
+ struct macro_definition *p = NULL;
+
+ n = lookup(argv[2]);
+ if (n == NULL || (p = macro_getdef(n)) == NULL)
+ m4errx(1, "indir: undefined macro %s.", argv[2]);
+ argv[1] = p->defn;
+
+ eval(argv+1, argc-1, p->type, is_traced(n));
+}
+
+void
+dobuiltin(const char *argv[], int argc)
+{
+ ndptr p;
+
+ argv[1] = NULL;
+ p = macro_getbuiltin(argv[2]);
+ if (p != NULL)
+ eval(argv+1, argc-1, macro_builtin_type(p), is_traced(p));
+ else
+ m4errx(1, "unknown builtin %s.", argv[2]);
+}
+
+
+/* We need some temporary buffer space, as pb pushes BACK and substitution
+ * proceeds forward... */
+static char *buffer;
+static size_t bufsize = 0;
+static size_t current = 0;
+
+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 *, 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)
+
+static void
+addchars(const char *c, size_t n)
+{
+ if (n == 0)
+ return;
+ while (current + n > bufsize) {
+ if (bufsize == 0)
+ bufsize = 1024;
+ else if (bufsize <= SIZE_MAX/2) {
+ bufsize *= 2;
+ } else {
+ errx(1, "size overflow");
+ }
+ buffer = xrealloc(buffer, bufsize, NULL);
+ }
+ memcpy(buffer+current, c, n);
+ current += n;
+}
+
+static void
+addchar(int c)
+{
+ if (current +1 > bufsize) {
+ if (bufsize == 0)
+ bufsize = 1024;
+ else
+ bufsize *= 2;
+ buffer = xrealloc(buffer, bufsize, NULL);
+ }
+ buffer[current++] = c;
+}
+
+static char *
+getstring(void)
+{
+ addchar('\0');
+ current = 0;
+ return buffer;
+}
+
+
+static void
+exit_regerror(int er, regex_t *re, const char *source)
+{
+ size_t errlen;
+ char *errbuf;
+
+ errlen = regerror(er, re, NULL, 0);
+ errbuf = xalloc(errlen,
+ "malloc in regerror: %lu", (unsigned long)errlen);
+ regerror(er, re, errbuf, errlen);
+ m4errx(1, "regular expression error in %s: %s.", source, errbuf);
+}
+
+static void
+add_sub(int n, const char *string, regex_t *re, regmatch_t *pm)
+{
+ if (n > (int)re->re_nsub)
+ warnx("No subexpression %d", n);
+ /* Subexpressions that did not match are
+ * not an error. */
+ else if (pm[n].rm_so != -1 &&
+ pm[n].rm_eo != -1) {
+ addchars(string + pm[n].rm_so,
+ pm[n].rm_eo - pm[n].rm_so);
+ }
+}
+
+/* Add replacement string to the output buffer, recognizing special
+ * constructs and replacing them with substrings of the original string.
+ */
+static void
+add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
+{
+ const char *p;
+
+ for (p = replace; *p != '\0'; p++) {
+ if (*p == '&' && !mimic_gnu) {
+ add_sub(0, string, re, pm);
+ continue;
+ }
+ if (*p == '\\') {
+ if (p[1] == '\\') {
+ addchar(p[1]);
+ p++;
+ continue;
+ }
+ if (p[1] == '&') {
+ if (mimic_gnu)
+ add_sub(0, string, re, pm);
+ else
+ addchar(p[1]);
+ p++;
+ continue;
+ }
+ if (isdigit((unsigned char)p[1])) {
+ add_sub(*(++p) - '0', string, re, pm);
+ continue;
+ }
+ }
+ addchar(*p);
+ }
+}
+
+static void
+do_subst(const char *string, regex_t *re, const char *source,
+ const char *replace, regmatch_t *pm)
+{
+ int error;
+ int flags = 0;
+ const char *last_match = NULL;
+
+ while ((error = regexec(re, string, re->re_nsub+1, pm, flags)) == 0) {
+ if (pm[0].rm_eo != 0) {
+ if (string[pm[0].rm_eo-1] == '\n')
+ flags = 0;
+ else
+ flags = REG_NOTBOL;
+ }
+
+ /* NULL length matches are special... We use the `vi-mode'
+ * rule: don't allow a NULL-match at the last match
+ * position.
+ */
+ if (pm[0].rm_so == pm[0].rm_eo &&
+ string + pm[0].rm_so == last_match) {
+ if (*string == '\0')
+ return;
+ addchar(*string);
+ if (*string++ == '\n')
+ flags = 0;
+ else
+ flags = REG_NOTBOL;
+ continue;
+ }
+ last_match = string + pm[0].rm_so;
+ addchars(string, pm[0].rm_so);
+ add_replace(string, re, replace, pm);
+ string += pm[0].rm_eo;
+ }
+ if (error != REG_NOMATCH)
+ exit_regerror(error, re, source);
+ pbstr(string);
+}
+
+static void
+do_regexp(const char *string, regex_t *re, const char *source,
+ const char *replace, regmatch_t *pm)
+{
+ int error;
+
+ switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) {
+ case 0:
+ add_replace(string, re, replace, pm);
+ pbstr(getstring());
+ break;
+ case REG_NOMATCH:
+ break;
+ default:
+ exit_regerror(error, re, source);
+ }
+}
+
+static void
+do_regexpindex(const char *string, regex_t *re, const char *source,
+ regmatch_t *pm)
+{
+ int error;
+
+ switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) {
+ case 0:
+ pbunsigned(pm[0].rm_so);
+ break;
+ case REG_NOMATCH:
+ pbnum(-1);
+ break;
+ default:
+ exit_regerror(error, re, source);
+ }
+}
+
+/* In Gnu m4 mode, parentheses for backmatch don't work like POSIX 1003.2
+ * says. So we twiddle with the regexp before passing it to regcomp.
+ */
+static char *
+twiddle(const char *p)
+{
+ /* + at start of regexp is a normal character for Gnu m4 */
+ if (*p == '^') {
+ addchar(*p);
+ p++;
+ }
+ if (*p == '+') {
+ addchar('\\');
+ }
+ /* This could use strcspn for speed... */
+ while (*p != '\0') {
+ if (*p == '\\') {
+ switch(p[1]) {
+ case '(':
+ case ')':
+ case '|':
+ addchar(p[1]);
+ break;
+ case 'w':
+ addconstantstring("[_a-zA-Z0-9]");
+ break;
+ case 'W':
+ addconstantstring("[^_a-zA-Z0-9]");
+ break;
+ case '<':
+ addconstantstring("[[:<:]]");
+ break;
+ case '>':
+ addconstantstring("[[:>:]]");
+ break;
+ default:
+ addchars(p, 2);
+ break;
+ }
+ p+=2;
+ continue;
+ }
+ if (*p == '(' || *p == ')' || *p == '|')
+ addchar('\\');
+
+ addchar(*p);
+ p++;
+ }
+ return getstring();
+}
+
+/* patsubst(string, regexp, opt replacement) */
+/* argv[2]: string
+ * argv[3]: regexp
+ * argv[4]: opt rep
+ */
+void
+dopatsubst(const char *argv[], int argc)
+{
+ if (argc <= 3) {
+ warnx("Too few arguments to patsubst");
+ return;
+ }
+ /* special case: empty regexp */
+ if (argv[3][0] == '\0') {
+ const char *s;
+ size_t len;
+ if (argc > 4 && argv[4])
+ len = strlen(argv[4]);
+ else
+ len = 0;
+ for (s = argv[2]; *s != '\0'; s++) {
+ addchars(argv[4], len);
+ addchar(*s);
+ }
+ } else {
+ int error;
+ regex_t re;
+ regmatch_t *pmatch;
+ int mode = REG_EXTENDED;
+ const char *source;
+ size_t l = strlen(argv[3]);
+
+ if (!mimic_gnu ||
+ (argv[3][0] == '^') ||
+ (l > 0 && argv[3][l-1] == '$'))
+ mode |= REG_NEWLINE;
+
+ source = mimic_gnu ? twiddle(argv[3]) : argv[3];
+ error = regcomp(&re, source, mode);
+ if (error != 0)
+ exit_regerror(error, &re, source);
+
+ 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);
+ }
+ pbstr(getstring());
+}
+
+void
+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");
+ return;
+ }
+ /* special gnu case */
+ if (argv[3][0] == '\0' && mimic_gnu) {
+ if (argc == 4 || argv[4] == NULL)
+ return;
+ else
+ pbstr(argv[4]);
+ }
+ source = mimic_gnu ? twiddle(argv[3]) : argv[3];
+ error = regcomp(&re, source, REG_EXTENDED|REG_NEWLINE);
+ if (error != 0)
+ exit_regerror(error, &re, source);
+
+ pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), NULL);
+ if (argc == 4 || argv[4] == NULL)
+ do_regexpindex(argv[2], &re, source, pmatch);
+ else
+ do_regexp(argv[2], &re, source, argv[4], pmatch);
+ free(pmatch);
+ regfree(&re);
+}
+
+void
+doformat(const char *argv[], int argc)
+{
+ const char *format = argv[2];
+ int pos = 3;
+ int left_padded;
+ long width;
+ size_t l;
+ const char *thisarg = NULL;
+ char temp[2];
+ long extra;
+
+ while (*format != 0) {
+ if (*format != '%') {
+ addchar(*format++);
+ continue;
+ }
+
+ format++;
+ if (*format == '%') {
+ addchar(*format++);
+ continue;
+ }
+ if (*format == 0) {
+ addchar('%');
+ break;
+ }
+
+ if (*format == '*') {
+ format++;
+ if (pos >= argc)
+ m4errx(1,
+ "Format with too many format specifiers.");
+ width = strtol(argv[pos++], NULL, 10);
+ } else {
+ width = strtol(format, __DECONST(char **,&format), 10);
+ }
+ if (width < 0) {
+ left_padded = 1;
+ width = -width;
+ } else {
+ left_padded = 0;
+ }
+ if (*format == '.') {
+ format++;
+ if (*format == '*') {
+ format++;
+ if (pos >= argc)
+ m4errx(1,
+ "Format with too many format specifiers.");
+ extra = strtol(argv[pos++], NULL, 10);
+ } else {
+ extra = strtol(format, __DECONST(char **, &format), 10);
+ }
+ } else {
+ extra = LONG_MAX;
+ }
+ if (pos >= argc)
+ m4errx(1, "Format with too many format specifiers.");
+ switch(*format) {
+ case 's':
+ thisarg = argv[pos++];
+ break;
+ case 'c':
+ temp[0] = strtoul(argv[pos++], NULL, 10);
+ temp[1] = 0;
+ thisarg = temp;
+ break;
+ default:
+ m4errx(1, "Unsupported format specification: %s.",
+ argv[2]);
+ }
+ format++;
+ l = strlen(thisarg);
+ if ((long)l > extra)
+ l = extra;
+ if (!left_padded) {
+ while ((long)l < width--)
+ addchar(' ');
+ }
+ addchars(thisarg, l);
+ if (left_padded) {
+ while ((long)l < width--)
+ addchar(' ');
+ }
+ }
+ pbstr(getstring());
+}
+
+void
+doesyscmd(const char *cmd)
+{
+ int p[2];
+ pid_t pid, cpid;
+ char *argv[4];
+ int cc;
+ int status;
+
+ /* Follow gnu m4 documentation: first flush buffers. */
+ fflush(NULL);
+
+ argv[0] = __DECONST(char *, "sh");
+ argv[1] = __DECONST(char *, "-c");
+ argv[2] = __DECONST(char *, cmd);
+ argv[3] = NULL;
+
+ /* Just set up standard output, share stderr and stdin with m4 */
+ if (pipe(p) == -1)
+ err(1, "bad pipe");
+ switch(cpid = fork()) {
+ case -1:
+ err(1, "bad fork");
+ /* NOTREACHED */
+ case 0:
+ (void) close(p[0]);
+ (void) dup2(p[1], 1);
+ (void) close(p[1]);
+ execv(_PATH_BSHELL, argv);
+ exit(1);
+ default:
+ /* Read result in two stages, since m4's buffer is
+ * pushback-only. */
+ (void) close(p[1]);
+ do {
+ char result[BUFSIZE];
+ cc = read(p[0], result, sizeof result);
+ if (cc > 0)
+ addchars(result, cc);
+ } while (cc > 0 || (cc == -1 && errno == EINTR));
+
+ (void) close(p[0]);
+ while ((pid = wait(&status)) != cpid && pid >= 0)
+ continue;
+ pbstr(getstring());
+ }
+}
+
+void
+getdivfile(const char *name)
+{
+ FILE *f;
+ int c;
+
+ f = fopen(name, "r");
+ if (!f)
+ return;
+
+ while ((c = getc(f))!= EOF)
+ putc(c, active);
+ (void) fclose(f);
+}
diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c
new file mode 100644
index 0000000..383fbc6
--- /dev/null
+++ b/usr.bin/m4/look.c
@@ -0,0 +1,339 @@
+/* $OpenBSD: look.c,v 1.24 2014/12/21 09:33:12 espie Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * look.c
+ * Facility: m4 macro processor
+ * by: oz
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <string.h>
+#include <ohash.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+
+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 void free_definition(char *);
+static void keep(char *);
+static int string_in_use(const char *);
+
+static struct ohash_info macro_info = {
+ offsetof(struct ndblock, name),
+ NULL, hash_calloc, hash_free, element_alloc };
+
+struct ohash macros;
+
+/* Support routines for hash tables. */
+void *
+hash_calloc(size_t n, size_t s, void *u __unused)
+{
+ void *storage = xcalloc(n, s, "hash alloc");
+ return storage;
+}
+
+void
+hash_free(void *p, void *u __unused)
+{
+ free(p);
+}
+
+void *
+element_alloc(size_t s, void *u __unused)
+{
+ return xalloc(s, "element alloc");
+}
+
+void
+init_macros(void)
+{
+ ohash_init(&macros, 10, &macro_info);
+}
+
+/*
+ * find name in the hash table
+ */
+ndptr
+lookup(const char *name)
+{
+ return ohash_find(&macros, ohash_qlookup(&macros, name));
+}
+
+struct macro_definition *
+lookup_macro_definition(const char *name)
+{
+ ndptr p;
+
+ p = ohash_find(&macros, ohash_qlookup(&macros, name));
+ if (p)
+ return p->d;
+ else
+ return NULL;
+}
+
+static void
+setup_definition(struct macro_definition *d, const char *defn, const char *name)
+{
+ ndptr p;
+
+ if (strncmp(defn, BUILTIN_MARKER, sizeof(BUILTIN_MARKER)-1) == 0 &&
+ (p = macro_getbuiltin(defn+sizeof(BUILTIN_MARKER)-1)) != NULL) {
+ d->type = macro_builtin_type(p);
+ d->defn = xstrdup(defn+sizeof(BUILTIN_MARKER)-1);
+ } else {
+ if (!*defn)
+ d->defn = __DECONST(char *, null);
+ else
+ d->defn = xstrdup(defn);
+ d->type = MACRTYPE;
+ }
+ if (STREQ(name, defn))
+ d->type |= RECDEF;
+}
+
+static ndptr
+create_entry(const char *name)
+{
+ const char *end = NULL;
+ unsigned int i;
+ ndptr n;
+
+ i = ohash_qlookupi(&macros, name, &end);
+ n = ohash_find(&macros, i);
+ if (n == NULL) {
+ n = ohash_create_entry(&macro_info, name, &end);
+ ohash_insert(&macros, i, n);
+ n->trace_flags = FLAG_NO_TRACE;
+ n->builtin_type = MACRTYPE;
+ n->d = NULL;
+ }
+ return n;
+}
+
+void
+macro_define(const char *name, const char *defn)
+{
+ ndptr n = create_entry(name);
+ if (n->d != NULL) {
+ if (n->d->defn != null)
+ free_definition(n->d->defn);
+ } else {
+ n->d = xalloc(sizeof(struct macro_definition), NULL);
+ n->d->next = NULL;
+ }
+ setup_definition(n->d, defn, name);
+}
+
+void
+macro_pushdef(const char *name, const char *defn)
+{
+ ndptr n;
+ struct macro_definition *d;
+
+ n = create_entry(name);
+ d = xalloc(sizeof(struct macro_definition), NULL);
+ d->next = n->d;
+ n->d = d;
+ setup_definition(n->d, defn, name);
+}
+
+void
+macro_undefine(const char *name)
+{
+ ndptr n = lookup(name);
+ if (n != NULL) {
+ struct macro_definition *r, *r2;
+
+ for (r = n->d; r != NULL; r = r2) {
+ r2 = r->next;
+ if (r->defn != null)
+ free(r->defn);
+ free(r);
+ }
+ n->d = NULL;
+ }
+}
+
+void
+macro_popdef(const char *name)
+{
+ ndptr n = lookup(name);
+
+ if (n != NULL) {
+ struct macro_definition *r = n->d;
+ if (r != NULL) {
+ n->d = r->next;
+ if (r->defn != null)
+ free(r->defn);
+ free(r);
+ }
+ }
+}
+
+void
+macro_for_all(void (*f)(const char *, struct macro_definition *))
+{
+ ndptr n;
+ unsigned int i;
+
+ for (n = ohash_first(&macros, &i); n != NULL;
+ n = ohash_next(&macros, &i))
+ if (n->d != NULL)
+ f(n->name, n->d);
+}
+
+void
+setup_builtin(const char *name, unsigned int type)
+{
+ ndptr n;
+ char *name2;
+
+ if (prefix_builtins) {
+ name2 = xalloc(strlen(name)+3+1, NULL);
+ memcpy(name2, "m4_", 3);
+ memcpy(name2 + 3, name, strlen(name)+1);
+ } else
+ name2 = xstrdup(name);
+
+ n = create_entry(name2);
+ n->builtin_type = type;
+ n->d = xalloc(sizeof(struct macro_definition), NULL);
+ n->d->defn = name2;
+ n->d->type = type;
+ n->d->next = NULL;
+}
+
+void
+mark_traced(const char *name, int on)
+{
+ ndptr p;
+ unsigned int i;
+
+ if (name == NULL) {
+ if (on)
+ trace_flags |= TRACE_ALL;
+ else
+ trace_flags &= ~TRACE_ALL;
+ for (p = ohash_first(&macros, &i); p != NULL;
+ p = ohash_next(&macros, &i))
+ p->trace_flags = FLAG_NO_TRACE;
+ } else {
+ p = create_entry(name);
+ p->trace_flags = on;
+ }
+}
+
+ndptr
+macro_getbuiltin(const char *name)
+{
+ ndptr p;
+
+ p = lookup(name);
+ if (p == NULL || p->builtin_type == MACRTYPE)
+ return NULL;
+ else
+ return p;
+}
+
+/* XXX things are slightly more complicated than they seem.
+ * a macro may actually be "live" (in the middle of an expansion
+ * on the stack.
+ * So we actually may need to place it in an array for later...
+ */
+
+static int kept_capacity = 0;
+static int kept_size = 0;
+static char **kept = NULL;
+
+static void
+keep(char *ptr)
+{
+ if (kept_capacity <= kept_size) {
+ if (kept_capacity)
+ kept_capacity *= 2;
+ else
+ kept_capacity = 50;
+ kept = xreallocarray(kept, kept_capacity,
+ sizeof(char *), "Out of memory while saving %d strings\n",
+ kept_capacity);
+ }
+ kept[kept_size++] = ptr;
+}
+
+static int
+string_in_use(const char *ptr)
+{
+ int i;
+ for (i = 0; i <= sp; i++) {
+ if (sstack[i] == STORAGE_MACRO && mstack[i].sstr == ptr)
+ return 1;
+ }
+ return 0;
+}
+
+
+static void
+free_definition(char *ptr)
+{
+ int i;
+
+ /* first try to free old strings */
+ for (i = 0; i < kept_size; i++) {
+ if (!string_in_use(kept[i])) {
+ kept_size--;
+ free(kept[i]);
+ if (i != kept_size)
+ kept[i] = kept[kept_size];
+ i--;
+ }
+ }
+
+ /* then deal with us */
+ if (string_in_use(ptr))
+ keep(ptr);
+ else
+ free(ptr);
+}
+
diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1
new file mode 100644
index 0000000..1429cde
--- /dev/null
+++ b/usr.bin/m4/m4.1
@@ -0,0 +1,512 @@
+.\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $
+.\" @(#) $OpenBSD: m4.1,v 1.63 2015/09/14 20:06:58 schwarze Exp $
+.\"
+.\" Copyright (c) 1989, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Ozan Yigit at York University.
+.\"
+.\" 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. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd $Mdocdate: September 14 2015 $
+.Dt M4 1
+.Os
+.Sh NAME
+.Nm m4
+.Nd macro language processor
+.Sh SYNOPSIS
+.Nm
+.Op Fl gPs
+.Oo
+.Sm off
+.Fl D Ar name Op No = Ar value
+.Sm on
+.Oc
+.Op Fl d Ar flags
+.Op Fl I Ar dirname
+.Op Fl o Ar filename
+.Op Fl t Ar macro
+.Op Fl U Ns Ar name
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a macro processor that can be used as a front end to any
+language (e.g., C, ratfor, fortran, lex, and yacc).
+If no input files are given,
+.Nm
+reads from the standard input,
+otherwise files specified on the command line are
+processed in the given order.
+Input files can be regular files, files in the m4 include paths, or a
+single dash
+.Pq Sq - ,
+denoting standard input.
+.Nm
+writes
+the processed text to the standard output, unless told otherwise.
+.Pp
+Macro calls have the form name(argument1[, argument2, ..., argumentN]).
+.Pp
+There cannot be any space following the macro name and the open
+parenthesis
+.Pq Sq \&( .
+If the macro name is not followed by an open
+parenthesis it is processed with no arguments.
+.Pp
+Macro names consist of a leading alphabetic or underscore
+possibly followed by alphanumeric or underscore characters, e.g.,
+valid macro names match the pattern
+.Dq [a-zA-Z_][a-zA-Z0-9_]* .
+.Pp
+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
+.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.
+.Pp
+Most built-ins do not make any sense without arguments, and hence are not
+recognized as special when not followed by an open parenthesis.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl D Ns Ar name Ns Op = Ns Ar value
+Define the symbol
+.Ar name
+to have some value (or
+.Dv NULL ) .
+.It Fl d Ar "flags"
+Set trace flags.
+.Ar flags
+may hold the following:
+.Bl -tag -width Ds
+.It Ar a
+print macro arguments.
+.It Ar c
+print macro expansion over several lines.
+.It Ar e
+print result of macro expansion.
+.It Ar f
+print filename location.
+.It Ar l
+print line number.
+.It Ar q
+quote arguments and expansion with the current quotes.
+.It Ar t
+start with all macros traced.
+.It Ar x
+number macro expansions.
+.It Ar V
+turn on all options.
+.El
+.Pp
+By default, trace is set to
+.Qq eq .
+.It Fl g
+Activate GNU-m4 compatibility mode.
+In this mode, translit handles simple character
+ranges (e.g., a-z), regular expressions mimic emacs behavior,
+multiple m4wrap calls are handled as a stack,
+the number of diversions is unlimited,
+empty names for macro definitions are allowed,
+and eval understands
+.Sq 0rbase:value
+numbers.
+.It Fl I Ar "dirname"
+Add directory
+.Ar dirname
+to the include path.
+.It Fl o Ar filename
+Send trace output to
+.Ar filename .
+.It Fl P
+Prefix all built-in macros with
+.Sq m4_ .
+For example, instead of writing
+.Ic define ,
+use
+.Ic m4_define .
+.It Fl s
+Output line synchronization directives, suitable for
+.Xr cpp 1 .
+.It Fl t Ar macro
+Turn tracing on for
+.Ar macro .
+.It Fl "U" Ns Ar "name"
+Undefine the symbol
+.Ar name .
+.El
+.Sh SYNTAX
+.Nm
+provides the following built-in macros.
+They may be redefined, losing their original meaning.
+Return values are null unless otherwise stated.
+.Bl -tag -width changequote
+.It Fn builtin name
+Calls a built-in by its
+.Fa name ,
+overriding possible redefinitions.
+.It Fn changecom startcomment endcomment
+Changes the start comment and end comment sequences.
+Comment sequences may be up to five characters long.
+The default values are the hash sign
+and the newline character.
+.Bd -literal -offset indent
+# This is a comment
+.Ed
+.Pp
+With no arguments, comments are turned off.
+With one single argument, the end comment sequence is set
+to the newline character.
+.It Fn changequote beginquote endquote
+Defines the open quote and close quote sequences.
+Quote sequences may be up to five characters long.
+The default values are the backquote character and the quote
+character.
+.Bd -literal -offset indent
+`Here is a quoted string'
+.Ed
+.Pp
+With no arguments, the default quotes are restored.
+With one single argument, the close quote sequence is set
+to the newline character.
+.It Fn decr arg
+Decrements the argument
+.Fa arg
+by 1.
+The argument
+.Fa arg
+must be a valid numeric string.
+.It Fn define name value
+Define a new macro named by the first argument
+.Fa name
+to have the
+value of the second argument
+.Fa value .
+Each occurrence of
+.Sq $n
+(where
+.Ar n
+is 0 through 9) is replaced by the
+.Ar n Ns 'th
+argument.
+.Sq $0
+is the name of the calling macro.
+Undefined arguments are replaced by a null string.
+.Sq $#
+is replaced by the number of arguments;
+.Sq $*
+is replaced by all arguments comma separated;
+.Sq $@
+is the same as
+.Sq $*
+but all arguments are quoted against further expansion.
+.It Fn defn name ...
+Returns the quoted definition for each argument.
+This can be used to rename
+macro definitions (even for built-in macros).
+.It Fn divert num
+There are 10 output queues (numbered 0-9).
+At the end of processing
+.Nm
+concatenates all the queues in numerical order to produce the
+final output.
+Initially the output queue is 0.
+The divert
+macro allows you to select a new output queue (an invalid argument
+passed to divert causes output to be discarded).
+.It Ic divnum
+Returns the current output queue number.
+.It Ic dnl
+Discard input characters up to and including the next newline.
+.It Fn dumpdef name ...
+Prints the names and definitions for the named items, or for everything
+if no arguments are passed.
+.It Fn errprint msg
+Prints the first argument on the standard error output stream.
+.It Fn esyscmd cmd
+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[,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 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
+.Ic eval .
+.It Fn format formatstring arg1 ...
+Returns
+.Fa formatstring
+with escape sequences substituted with
+.Fa arg1
+and following arguments, in a way similar to
+.Xr printf 3 .
+This built-in is only available in GNU-m4 compatibility mode, and the only
+parameters implemented are there for autoconf compatibility:
+left-padding flag, an optional field width, a maximum field width,
+*-specified field widths, and the %s and %c data type.
+.It Fn ifdef name yes no
+If the macro named by the first argument is defined then return the second
+argument, otherwise the third.
+If there is no third argument, the value is
+.Dv NULL .
+The word
+.Qq unix
+is predefined.
+.It Fn ifelse a b yes ...
+If the first argument
+.Fa a
+matches the second argument
+.Fa b
+then
+.Fn ifelse
+returns
+the third argument
+.Fa yes .
+If the match fails the three arguments are
+discarded and the next three arguments are used until there is
+zero or one arguments left, either this last argument or
+.Dv NULL
+is returned if no other matches were found.
+.It Fn include name
+Returns the contents of the file specified in the first argument.
+If the file is not found as is, look through the include path:
+first the directories specified with
+.Fl I
+on the command line, then the environment variable
+.Ev M4PATH ,
+as a colon-separated list of directories.
+Include aborts with an error message if the file cannot be included.
+.It Fn incr arg
+Increments the argument by 1.
+The argument must be a valid numeric string.
+.It Fn index string substring
+Returns the index of the second argument in the first argument (e.g.,
+.Ic index(the quick brown fox jumped, fox)
+returns 16).
+If the second
+argument is not found index returns \-1.
+.It Fn indir macro arg1 ...
+Indirectly calls the macro whose name is passed as the first argument,
+with the remaining arguments passed as first, ... arguments.
+.It Fn len arg
+Returns the number of characters in the first argument.
+Extra arguments
+are ignored.
+.It Fn m4exit code
+Immediately exits with the return value specified by the first argument,
+0 if none.
+.It Fn m4wrap todo
+Allows you to define what happens at the final
+.Dv EOF ,
+usually for cleanup purposes (e.g.,
+.Ic m4wrap("cleanup(tempfile)")
+causes the macro cleanup to be
+invoked after all other processing is done).
+.Pp
+Multiple calls to
+.Fn m4wrap
+get inserted in sequence at the final
+.Dv EOF .
+.It Fn maketemp template
+Like
+.Ic mkstemp .
+.It Fn mkstemp template
+Invokes
+.Xr mkstemp 3
+on the first argument, and returns the modified string.
+This can be used to create unique
+temporary file names.
+.It Fn paste file
+Includes the contents of the file specified by the first argument without
+any macro processing.
+Aborts with an error message if the file cannot be
+included.
+.It Fn patsubst string regexp replacement
+Substitutes a regular expression in a string with a replacement string.
+Usual substitution patterns apply: an ampersand
+.Pq Sq \&&
+is replaced by the string matching the regular expression.
+The string
+.Sq \e# ,
+where
+.Sq #
+is a digit, is replaced by the corresponding back-reference.
+.It Fn popdef arg ...
+Restores the
+.Ic pushdef Ns ed
+definition for each argument.
+.It Fn pushdef macro def
+Takes the same arguments as
+.Ic define ,
+but it saves the definition on a
+stack for later retrieval by
+.Fn popdef .
+.It Fn regexp string regexp replacement
+Finds a regular expression in a string.
+If no further arguments are given,
+it returns the first match position or \-1 if no match.
+If a third argument
+is provided, it returns the replacement string, with sub-patterns replaced.
+.It Fn shift arg1 ...
+Returns all but the first argument, the remaining arguments are
+quoted and pushed back with commas in between.
+The quoting
+nullifies the effect of the extra scan that will subsequently be
+performed.
+.It Fn sinclude file
+Similar to
+.Ic include ,
+except it ignores any errors.
+.It Fn spaste file
+Similar to
+.Fn paste ,
+except it ignores any errors.
+.It Fn substr string offset length
+Returns a substring of the first argument starting at the offset specified
+by the second argument and the length specified by the third argument.
+If no third argument is present it returns the rest of the string.
+.It Fn syscmd cmd
+Passes the first argument to the shell.
+Nothing is returned.
+.It Ic sysval
+Returns the return value from the last
+.Ic syscmd .
+.It Fn traceon arg ...
+Enables tracing of macro expansions for the given arguments, or for all
+macros if no argument is given.
+.It Fn traceoff arg ...
+Disables tracing of macro expansions for the given arguments, or for all
+macros if no argument is given.
+.It Fn translit string mapfrom mapto
+Transliterate the characters in the first argument from the set
+given by the second argument to the set given by the third.
+You cannot use
+.Xr tr 1
+style abbreviations.
+.It Fn undefine name1 ...
+Removes the definition for the macros specified by its arguments.
+.It Fn undivert arg ...
+Flushes the named output queues (or all queues if no arguments).
+.It Ic unix
+A pre-defined macro for testing the OS platform.
+.It Ic __line__
+Returns the current file's line number.
+.It Ic __file__
+Returns the current file's name.
+.El
+.Sh EXIT STATUS
+.Ex -std m4
+.Pp
+But note that the
+.Ic m4exit
+macro can modify the exit status.
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The flags
+.Op Fl dgIPot
+and the macros
+.Ic builtin ,
+.Ic esyscmd ,
+.Ic expr ,
+.Ic format ,
+.Ic indir ,
+.Ic paste ,
+.Ic patsubst ,
+.Ic regexp ,
+.Ic spaste ,
+.Ic unix ,
+.Ic __line__ ,
+and
+.Ic __file__
+are extensions to that specification.
+.Pp
+.Ic maketemp
+is not supposed to be a synonym for
+.Ic mkstemp ,
+but instead to be an insecure temporary file name creation function.
+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
+.Ic traceon
+and
+.Ic dumpdef
+are not specified in any standard,
+are likely to change and should not be relied upon.
+The current format of tracing is closely modelled on
+.Nm gnu-m4 ,
+to allow
+.Nm autoconf
+to work.
+.Pp
+The built-ins
+.Ic pushdef
+and
+.Ic popdef
+handle macro definitions as a stack.
+However,
+.Ic define
+interacts with the stack in an undefined way.
+In this implementation,
+.Ic define
+replaces the top-most definition only.
+Other implementations may erase all definitions on the stack instead.
+.Pp
+All built-ins do expand without arguments in many other
+.Nm .
+.Pp
+Many other
+.Nm
+have dire size limitations with respect to buffer sizes.
+.Sh AUTHORS
+.An -nosplit
+.An Ozan Yigit Aq Mt oz@sis.yorku.ca
+and
+.An Richard A. O'Keefe Aq Mt ok@goanna.cs.rmit.OZ.AU .
+.Pp
+GNU-m4 compatibility extensions by
+.An Marc Espie Aq Mt espie@cvs.openbsd.org .
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c
new file mode 100644
index 0000000..92d1ea3
--- /dev/null
+++ b/usr.bin/m4/main.c
@@ -0,0 +1,632 @@
+/* $OpenBSD: main.c,v 1.86 2015/11/03 16:21:47 deraadt Exp $ */
+/* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ */
+
+/*
+ * main.c
+ * Facility: m4 macro processor
+ * by: oz
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <assert.h>
+#include <signal.h>
+#include <err.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <ohash.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+#include "pathnames.h"
+
+stae *mstack; /* stack of m4 machine */
+char *sstack; /* shadow stack, for string space extension */
+static size_t STACKMAX; /* current maximum size of stack */
+int sp; /* current m4 stack pointer */
+int fp; /* m4 call frame pointer */
+struct input_file infile[MAXINP];/* input file stack (0=stdin) */
+FILE **outfile; /* diversion array(0=bitbucket)*/
+int maxout;
+FILE *active; /* active output file pointer */
+int ilevel = 0; /* input file stack pointer */
+int oindex = 0; /* diversion index.. */
+const char *null = ""; /* as it says.. just a null.. */
+char **m4wraps = NULL; /* m4wraps array. */
+int maxwraps = 0; /* size of m4wraps array */
+int wrapindex = 0; /* current offset in m4wraps */
+char lquote[MAXCCHARS+1] = {LQUOTE}; /* left quote character (`) */
+char rquote[MAXCCHARS+1] = {RQUOTE}; /* right quote character (') */
+char scommt[MAXCCHARS+1] = {SCOMMT}; /* start character for comment */
+char ecommt[MAXCCHARS+1] = {ECOMMT}; /* end character for comment */
+int synch_lines = 0; /* line synchronisation for C preprocessor */
+int prefix_builtins = 0; /* -P option to prefix builtin keywords */
+
+struct keyblk {
+ const char *knam; /* keyword name */
+ int ktyp; /* keyword type */
+};
+
+static struct keyblk keywrds[] = { /* m4 keywords to be installed */
+ { "include", INCLTYPE },
+ { "sinclude", SINCTYPE },
+ { "define", DEFITYPE },
+ { "defn", DEFNTYPE },
+ { "divert", DIVRTYPE | NOARGS },
+ { "expr", EXPRTYPE },
+ { "eval", EXPRTYPE },
+ { "substr", SUBSTYPE },
+ { "ifelse", IFELTYPE },
+ { "ifdef", IFDFTYPE },
+ { "len", LENGTYPE },
+ { "incr", INCRTYPE },
+ { "decr", DECRTYPE },
+ { "dnl", DNLNTYPE | NOARGS },
+ { "changequote", CHNQTYPE | NOARGS },
+ { "changecom", CHNCTYPE | NOARGS },
+ { "index", INDXTYPE },
+#ifdef EXTENDED
+ { "paste", PASTTYPE },
+ { "spaste", SPASTYPE },
+ /* Newer extensions, needed to handle gnu-m4 scripts */
+ { "indir", INDIRTYPE},
+ { "builtin", BUILTINTYPE},
+ { "patsubst", PATSTYPE},
+ { "regexp", REGEXPTYPE},
+ { "esyscmd", ESYSCMDTYPE},
+ { "__file__", FILENAMETYPE | NOARGS},
+ { "__line__", LINETYPE | NOARGS},
+#endif
+ { "popdef", POPDTYPE },
+ { "pushdef", PUSDTYPE },
+ { "dumpdef", DUMPTYPE | NOARGS },
+ { "shift", SHIFTYPE | NOARGS },
+ { "translit", TRNLTYPE },
+ { "undefine", UNDFTYPE },
+ { "undivert", UNDVTYPE | NOARGS },
+ { "divnum", DIVNTYPE | NOARGS },
+ { "maketemp", MKTMTYPE },
+ { "mkstemp", MKTMTYPE },
+ { "errprint", ERRPTYPE | NOARGS },
+ { "m4wrap", M4WRTYPE | NOARGS },
+ { "m4exit", EXITTYPE | NOARGS },
+ { "syscmd", SYSCTYPE },
+ { "sysval", SYSVTYPE | NOARGS },
+ { "traceon", TRACEONTYPE | NOARGS },
+ { "traceoff", TRACEOFFTYPE | NOARGS },
+
+ { "unix", SELFTYPE | NOARGS },
+};
+
+#define MAXKEYS (sizeof(keywrds)/sizeof(struct keyblk))
+
+extern int optind;
+extern char *optarg;
+
+#define MAXRECORD 50
+static struct position {
+ char *name;
+ unsigned long line;
+} quotes[MAXRECORD], paren[MAXRECORD];
+
+static void record(struct position *, int);
+static void dump_stack(struct position *, int);
+
+static void macro(void);
+static void initkwds(void);
+static ndptr inspect(int, char *);
+static int do_look_ahead(int, const char *);
+static void reallyoutputstr(const char *);
+static void reallyputchar(int);
+
+static void enlarge_stack(void);
+
+int main(int, char *[]);
+
+int exit_code = 0;
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ int n;
+ char *p;
+
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ signal(SIGINT, onintr);
+
+ init_macros();
+ initspaces();
+ STACKMAX = INITSTACKMAX;
+
+ mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL);
+ sstack = xalloc(STACKMAX, NULL);
+
+ maxout = 0;
+ outfile = NULL;
+ resizedivs(MAXOUT);
+
+ while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1)
+ switch(c) {
+
+ case 'D': /* define something..*/
+ for (p = optarg; *p; p++)
+ if (*p == '=')
+ break;
+ if (*p)
+ *p++ = EOS;
+ dodefine(optarg, p);
+ break;
+ case 'I':
+ addtoincludepath(optarg);
+ break;
+ case 'P':
+ prefix_builtins = 1;
+ break;
+ case 'U': /* undefine... */
+ macro_popdef(optarg);
+ break;
+ case 'g':
+ mimic_gnu = 1;
+ break;
+ case 'd':
+ set_trace_flags(optarg);
+ break;
+ case 's':
+ synch_lines = 1;
+ break;
+ case 't':
+ mark_traced(optarg, 1);
+ break;
+ case 'o':
+ trace_file(optarg);
+ break;
+ case '?':
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ initkwds();
+ if (mimic_gnu)
+ setup_builtin("format", FORMATTYPE);
+
+ active = stdout; /* default active output */
+ bbase[0] = bufbase;
+ if (!argc) {
+ sp = -1; /* stack pointer initialized */
+ fp = 0; /* frame pointer initialized */
+ set_input(infile+0, stdin, "stdin");
+ /* default input (naturally) */
+ macro();
+ } else
+ for (; argc--; ++argv) {
+ p = *argv;
+ if (p[0] == '-' && p[1] == EOS)
+ set_input(infile, stdin, "stdin");
+ else if (fopen_trypath(infile, p) == NULL)
+ err(1, "%s", p);
+ sp = -1;
+ fp = 0;
+ macro();
+ release_input(infile);
+ }
+
+ if (wrapindex) {
+ int i;
+
+ ilevel = 0; /* in case m4wrap includes.. */
+ bufbase = bp = buf; /* use the entire buffer */
+ if (mimic_gnu) {
+ while (wrapindex != 0) {
+ for (i = 0; i < wrapindex; i++)
+ pbstr(m4wraps[i]);
+ wrapindex =0;
+ macro();
+ }
+ } else {
+ for (i = 0; i < wrapindex; i++) {
+ pbstr(m4wraps[i]);
+ macro();
+ }
+ }
+ }
+
+ if (active != stdout)
+ active = stdout; /* reset output just in case */
+ for (n = 1; n < maxout; n++) /* default wrap-up: undivert */
+ if (outfile[n] != NULL)
+ getdiv(n);
+ /* remove bitbucket if used */
+ if (outfile[0] != NULL) {
+ (void) fclose(outfile[0]);
+ }
+
+ return exit_code;
+}
+
+/*
+ * Look ahead for `token'.
+ * (on input `t == token[0]')
+ * Used for comment and quoting delimiters.
+ * Returns 1 if `token' present; copied to output.
+ * 0 if `token' not found; all characters pushed back
+ */
+static int
+do_look_ahead(int t, const char *token)
+{
+ int i;
+
+ assert((unsigned char)t == (unsigned char)token[0]);
+
+ for (i = 1; *++token; i++) {
+ t = gpbc();
+ if (t == EOF || (unsigned char)t != (unsigned char)*token) {
+ pushback(t);
+ while (--i)
+ pushback(*--token);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+#define LOOK_AHEAD(t, token) (t != EOF && \
+ (unsigned char)(t)==(unsigned char)(token)[0] && \
+ do_look_ahead(t,token))
+
+/*
+ * macro - the work horse..
+ */
+static void
+macro(void)
+{
+ char token[MAXTOK+1];
+ int t, l;
+ ndptr p;
+ int nlpar;
+
+ cycle {
+ t = gpbc();
+
+ if (LOOK_AHEAD(t,lquote)) { /* strip quotes */
+ nlpar = 0;
+ record(quotes, nlpar++);
+ /*
+ * Opening quote: scan forward until matching
+ * closing quote has been found.
+ */
+ do {
+
+ l = gpbc();
+ if (LOOK_AHEAD(l,rquote)) {
+ if (--nlpar > 0)
+ outputstr(rquote);
+ } else if (LOOK_AHEAD(l,lquote)) {
+ record(quotes, nlpar++);
+ outputstr(lquote);
+ } else if (l == EOF) {
+ if (nlpar == 1)
+ warnx("unclosed quote:");
+ else
+ warnx("%d unclosed quotes:", nlpar);
+ dump_stack(quotes, nlpar);
+ exit(1);
+ } else {
+ if (nlpar > 0) {
+ if (sp < 0)
+ reallyputchar(l);
+ else
+ CHRSAVE(l);
+ }
+ }
+ }
+ while (nlpar != 0);
+ } else if (sp < 0 && LOOK_AHEAD(t, scommt)) {
+ reallyoutputstr(scommt);
+
+ for(;;) {
+ t = gpbc();
+ if (LOOK_AHEAD(t, ecommt)) {
+ reallyoutputstr(ecommt);
+ break;
+ }
+ if (t == EOF)
+ break;
+ reallyputchar(t);
+ }
+ } else if (t == '_' || isalpha(t)) {
+ p = inspect(t, token);
+ if (p != NULL)
+ pushback(l = gpbc());
+ if (p == NULL || (l != LPAREN &&
+ (macro_getdef(p)->type & NEEDARGS) != 0))
+ outputstr(token);
+ else {
+ /*
+ * real thing.. First build a call frame:
+ */
+ pushf(fp); /* previous call frm */
+ pushf(macro_getdef(p)->type); /* type of the call */
+ pushf(is_traced(p));
+ pushf(0); /* parenthesis level */
+ fp = sp; /* new frame pointer */
+ /*
+ * now push the string arguments:
+ */
+ pushdef(p); /* defn string */
+ pushs1((char *)macro_name(p)); /* macro name */
+ pushs(ep); /* start next..*/
+
+ if (l != LPAREN && PARLEV == 0) {
+ /* no bracks */
+ chrsave(EOS);
+
+ if (sp == (int)STACKMAX)
+ errx(1, "internal stack overflow");
+ eval((const char **) mstack+fp+1, 2,
+ CALTYP, TRACESTATUS);
+
+ ep = PREVEP; /* flush strspace */
+ sp = PREVSP; /* previous sp.. */
+ fp = PREVFP; /* rewind stack...*/
+ }
+ }
+ } else if (t == EOF) {
+ 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);
+ }
+ if (ilevel <= 0)
+ break; /* all done thanks.. */
+ release_input(infile+ilevel--);
+ emit_synchline();
+ bufbase = bbase[ilevel];
+ continue;
+ } else if (sp < 0) { /* not in a macro at all */
+ reallyputchar(t); /* output directly.. */
+ }
+
+ else switch(t) {
+
+ case LPAREN:
+ if (PARLEV > 0)
+ chrsave(t);
+ while (isspace(l = gpbc())) /* skip blank, tab, nl.. */
+ if (PARLEV > 0)
+ chrsave(l);
+ pushback(l);
+ record(paren, PARLEV++);
+ break;
+
+ case RPAREN:
+ if (--PARLEV > 0)
+ chrsave(t);
+ else { /* end of argument list */
+ chrsave(EOS);
+
+ if (sp == (int)STACKMAX)
+ errx(1, "internal stack overflow");
+
+ eval((const char **) mstack+fp+1, sp-fp,
+ CALTYP, TRACESTATUS);
+
+ ep = PREVEP; /* flush strspace */
+ sp = PREVSP; /* previous sp.. */
+ fp = PREVFP; /* rewind stack...*/
+ }
+ break;
+
+ case COMMA:
+ if (PARLEV == 1) {
+ chrsave(EOS); /* new argument */
+ while (isspace(l = gpbc()))
+ ;
+ pushback(l);
+ pushs(ep);
+ } else
+ chrsave(t);
+ break;
+
+ default:
+ if (LOOK_AHEAD(t, scommt)) {
+ char *p;
+ for (p = scommt; *p; p++)
+ chrsave(*p);
+ for(;;) {
+ t = gpbc();
+ if (LOOK_AHEAD(t, ecommt)) {
+ for (p = ecommt; *p; p++)
+ chrsave(*p);
+ break;
+ }
+ if (t == EOF)
+ break;
+ CHRSAVE(t);
+ }
+ } else
+ CHRSAVE(t); /* stack the char */
+ break;
+ }
+ }
+}
+
+/*
+ * output string directly, without pushing it for reparses.
+ */
+void
+outputstr(const char *s)
+{
+ if (sp < 0)
+ reallyoutputstr(s);
+ else
+ while (*s)
+ CHRSAVE(*s++);
+}
+
+void
+reallyoutputstr(const char *s)
+{
+ if (synch_lines) {
+ while (*s) {
+ fputc(*s, active);
+ if (*s++ == '\n') {
+ infile[ilevel].synch_lineno++;
+ if (infile[ilevel].synch_lineno !=
+ infile[ilevel].lineno)
+ do_emit_synchline();
+ }
+ }
+ } else
+ fputs(s, active);
+}
+
+void
+reallyputchar(int c)
+{
+ putc(c, active);
+ if (synch_lines && c == '\n') {
+ infile[ilevel].synch_lineno++;
+ if (infile[ilevel].synch_lineno != infile[ilevel].lineno)
+ do_emit_synchline();
+ }
+}
+
+/*
+ * build an input token..
+ * consider only those starting with _ or A-Za-z.
+ */
+static ndptr
+inspect(int c, char *tp)
+{
+ char *name = tp;
+ char *etp = tp+MAXTOK;
+ ndptr p;
+
+ *tp++ = c;
+
+ while ((isalnum(c = gpbc()) || c == '_') && tp < etp)
+ *tp++ = c;
+ if (c != EOF)
+ PUSHBACK(c);
+ *tp = EOS;
+ /* token is too long, it won't match anything, but it can still
+ * be output. */
+ if (tp == ep) {
+ outputstr(name);
+ while (isalnum(c = gpbc()) || c == '_') {
+ if (sp < 0)
+ reallyputchar(c);
+ else
+ CHRSAVE(c);
+ }
+ *name = EOS;
+ return NULL;
+ }
+
+ p = ohash_find(&macros, ohash_qlookupi(&macros, name, (const char **)&tp));
+ if (p == NULL)
+ return NULL;
+ if (macro_getdef(p) == NULL)
+ return NULL;
+ return p;
+}
+
+/*
+ * initkwds - initialise m4 keywords as fast as possible.
+ * This very similar to install, but without certain overheads,
+ * such as calling lookup. Malloc is not used for storing the
+ * keyword strings, since we simply use the static pointers
+ * within keywrds block.
+ */
+static void
+initkwds(void)
+{
+ unsigned int type;
+ int i;
+
+ for (i = 0; i < (int)MAXKEYS; i++) {
+ type = keywrds[i].ktyp & TYPEMASK;
+ if ((keywrds[i].ktyp & NOARGS) == 0)
+ type |= NEEDARGS;
+ setup_builtin(keywrds[i].knam, type);
+ }
+}
+
+static void
+record(struct position *t, int lev)
+{
+ if (lev < MAXRECORD) {
+ t[lev].name = CURRENT_NAME;
+ t[lev].line = CURRENT_LINE;
+ }
+}
+
+static void
+dump_stack(struct position *t, int lev)
+{
+ int i;
+
+ for (i = 0; i < lev; i++) {
+ if (i == MAXRECORD) {
+ fprintf(stderr, " ...\n");
+ break;
+ }
+ fprintf(stderr, " %s at line %lu\n",
+ t[i].name, t[i].line);
+ }
+}
+
+
+static void
+enlarge_stack(void)
+{
+ STACKMAX += STACKMAX/2;
+ mstack = xreallocarray(mstack, STACKMAX, sizeof(stae),
+ "Evaluation stack overflow (%lu)",
+ (unsigned long)STACKMAX);
+ sstack = xrealloc(sstack, STACKMAX,
+ "Evaluation stack overflow (%lu)",
+ (unsigned long)STACKMAX);
+}
diff --git a/usr.bin/m4/mdef.h b/usr.bin/m4/mdef.h
new file mode 100644
index 0000000..fc2d32a
--- /dev/null
+++ b/usr.bin/m4/mdef.h
@@ -0,0 +1,238 @@
+/* $OpenBSD: mdef.h,v 1.33 2015/11/03 16:21:47 deraadt Exp $ */
+/* $NetBSD: mdef.h,v 1.7 1996/01/13 23:25:27 pk Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ *
+ * @(#)mdef.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#ifdef __GNUC__
+# define UNUSED __attribute__((__unused__))
+#else
+# define UNUSED
+#endif
+
+#define MACRTYPE 1
+#define DEFITYPE 2
+#define EXPRTYPE 3
+#define SUBSTYPE 4
+#define IFELTYPE 5
+#define LENGTYPE 6
+#define CHNQTYPE 7
+#define SYSCTYPE 8
+#define UNDFTYPE 9
+#define INCLTYPE 10
+#define SINCTYPE 11
+#define PASTTYPE 12
+#define SPASTYPE 13
+#define INCRTYPE 14
+#define IFDFTYPE 15
+#define PUSDTYPE 16
+#define POPDTYPE 17
+#define SHIFTYPE 18
+#define DECRTYPE 19
+#define DIVRTYPE 20
+#define UNDVTYPE 21
+#define DIVNTYPE 22
+#define MKTMTYPE 23
+#define ERRPTYPE 24
+#define M4WRTYPE 25
+#define TRNLTYPE 26
+#define DNLNTYPE 27
+#define DUMPTYPE 28
+#define CHNCTYPE 29
+#define INDXTYPE 30
+#define SYSVTYPE 31
+#define EXITTYPE 32
+#define DEFNTYPE 33
+#define SELFTYPE 34
+#define INDIRTYPE 35
+#define BUILTINTYPE 36
+#define PATSTYPE 37
+#define FILENAMETYPE 38
+#define LINETYPE 39
+#define REGEXPTYPE 40
+#define ESYSCMDTYPE 41
+#define TRACEONTYPE 42
+#define TRACEOFFTYPE 43
+#define FORMATTYPE 44
+
+#define BUILTIN_MARKER "__builtin_"
+
+#define TYPEMASK 63 /* Keep bits really corresponding to a type. */
+#define RECDEF 256 /* Pure recursive def, don't expand it */
+#define NOARGS 512 /* builtin needs no args */
+#define NEEDARGS 1024 /* mark builtin that need args with this */
+
+/*
+ * m4 special characters
+ */
+
+#define ARGFLAG '$'
+#define LPAREN '('
+#define RPAREN ')'
+#define LQUOTE '`'
+#define RQUOTE '\''
+#define COMMA ','
+#define SCOMMT '#'
+#define ECOMMT '\n'
+
+/*
+ * other important constants
+ */
+
+#define EOS '\0'
+#define MAXINP 10 /* maximum include files */
+#define MAXOUT 10 /* maximum # of diversions */
+#define BUFSIZE 4096 /* starting size of pushback buffer */
+#define INITSTACKMAX 4096 /* starting size of call stack */
+#define STRSPMAX 4096 /* starting size of string space */
+#define MAXTOK 512 /* maximum chars in a tokn */
+#define MAXCCHARS 5 /* max size of comment/quote delim */
+
+#define ALL 1
+#define TOP 0
+
+#define TRUE 1
+#define FALSE 0
+#define cycle for(;;)
+
+/*
+ * m4 data structures
+ */
+
+typedef struct ndblock *ndptr;
+
+struct macro_definition {
+ struct macro_definition *next;
+ char *defn; /* definition.. */
+ unsigned int type; /* type of the entry.. */
+};
+
+
+struct ndblock { /* hashtable structure */
+ unsigned int builtin_type;
+ unsigned int trace_flags;
+ struct macro_definition *d;
+ char name[1]; /* entry name.. */
+};
+
+typedef union { /* stack structure */
+ int sfra; /* frame entry */
+ char *sstr; /* string entry */
+} stae;
+
+struct input_file {
+ FILE *file;
+ char *name;
+ unsigned long lineno;
+ unsigned long synch_lineno; /* used for -s */
+ int c;
+};
+
+#define STORAGE_STRSPACE 0
+#define STORAGE_MACRO 1
+#define STORAGE_OTHER 2
+
+#define CURRENT_NAME (infile[ilevel].name)
+#define CURRENT_LINE (infile[ilevel].lineno)
+/*
+ * macros for readibility and/or speed
+ *
+ * gpbc() - get a possibly pushed-back character
+ * pushf() - push a call frame entry onto stack
+ * pushs() - push a string pointer onto stack
+ */
+#define gpbc() (bp > bufbase) ? *--bp : obtain_char(infile+ilevel)
+#define pushf(x) \
+ do { \
+ if (++sp == (int)STACKMAX) \
+ enlarge_stack();\
+ mstack[sp].sfra = (x); \
+ sstack[sp] = STORAGE_OTHER; \
+ } while (0)
+
+#define pushs(x) \
+ do { \
+ if (++sp == (int)STACKMAX) \
+ enlarge_stack();\
+ mstack[sp].sstr = (x); \
+ sstack[sp] = STORAGE_STRSPACE; \
+ } while (0)
+
+#define pushs1(x) \
+ do { \
+ if (++sp == (int)STACKMAX) \
+ enlarge_stack();\
+ mstack[sp].sstr = (x); \
+ sstack[sp] = STORAGE_OTHER; \
+ } while (0)
+
+#define pushdef(p) \
+ do { \
+ if (++sp == (int)STACKMAX) \
+ enlarge_stack();\
+ mstack[sp].sstr = macro_getdef(p)->defn;\
+ sstack[sp] = STORAGE_MACRO; \
+ } while (0)
+
+
+/*
+ * . .
+ * | . | <-- sp | . |
+ * +-------+ +-----+
+ * | arg 3 ----------------------->| str |
+ * +-------+ | . |
+ * | arg 2 ---PREVEP-----+ .
+ * +-------+ |
+ * . | | |
+ * +-------+ | +-----+
+ * | plev | PARLEV +-------->| str |
+ * +-------+ | . |
+ * | type | CALTYP .
+ * +-------+
+ * | prcf ---PREVFP--+
+ * +-------+ |
+ * | . | PREVSP |
+ * . |
+ * +-------+ |
+ * | <----------+
+ * +-------+
+ *
+ */
+#define PARLEV (mstack[fp].sfra)
+#define CALTYP (mstack[fp-2].sfra)
+#define TRACESTATUS (mstack[fp-1].sfra)
+#define PREVEP (mstack[fp+3].sstr)
+#define PREVSP (fp-4)
+#define PREVFP (mstack[fp-3].sfra)
diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c
new file mode 100644
index 0000000..aeafea9
--- /dev/null
+++ b/usr.bin/m4/misc.c
@@ -0,0 +1,470 @@
+/* $OpenBSD: misc.c,v 1.46 2015/12/07 14:12:46 espie Exp $ */
+/* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <err.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+#include "pathnames.h"
+
+
+char *ep; /* first free char in strspace */
+static char *strspace; /* string space for evaluation */
+char *endest; /* end of string space */
+static size_t strsize = STRSPMAX;
+static size_t bufsize = BUFSIZE;
+
+unsigned char *buf; /* push-back buffer */
+unsigned char *bufbase; /* the base for current ilevel */
+unsigned char *bbase[MAXINP]; /* the base for each ilevel */
+unsigned char *bp; /* first available character */
+unsigned char *endpbb; /* end of push-back buffer */
+
+
+/*
+ * find the index of second str in the first str.
+ */
+ptrdiff_t
+indx(const char *s1, const char *s2)
+{
+ char *t;
+
+ t = strstr(s1, s2);
+ if (t == NULL)
+ return (-1);
+ else
+ return (t - s1);
+}
+/*
+ * pushback - push character back onto input
+ */
+void
+pushback(int c)
+{
+ if (c == EOF)
+ return;
+ if (bp >= endpbb)
+ enlarge_bufspace();
+ *bp++ = c;
+}
+
+/*
+ * pbstr - push string back onto input
+ * pushback is replicated to improve
+ * performance.
+ */
+void
+pbstr(const char *s)
+{
+ size_t n;
+
+ n = strlen(s);
+ while (endpbb - bp <= (long)n)
+ enlarge_bufspace();
+ while (n > 0)
+ *bp++ = s[--n];
+}
+
+/*
+ * pbnum - convert number to string, push back on input.
+ */
+void
+pbnum(int n)
+{
+ pbnumbase(n, 10, 0);
+}
+
+void
+pbnumbase(int n, int base, int d)
+{
+ static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ int num;
+ int printed = 0;
+
+ if (base > 36)
+ m4errx(1, "base %d > 36: not supported.", base);
+
+ if (base < 2)
+ m4errx(1, "bad base %d for conversion.", base);
+
+ num = (n < 0) ? -n : n;
+ do {
+ pushback(digits[num % base]);
+ printed++;
+ }
+ while ((num /= base) > 0);
+
+ if (n < 0)
+ printed++;
+ while (printed++ < d)
+ pushback('0');
+
+ if (n < 0)
+ pushback('-');
+}
+
+/*
+ * pbunsigned - convert unsigned long to string, push back on input.
+ */
+void
+pbunsigned(unsigned long n)
+{
+ do {
+ pushback(n % 10 + '0');
+ }
+ while ((n /= 10) > 0);
+}
+
+void
+initspaces(void)
+{
+ int i;
+
+ strspace = xalloc(strsize+1, NULL);
+ ep = strspace;
+ endest = strspace+strsize;
+ buf = xalloc(bufsize, NULL);
+ bufbase = buf;
+ bp = buf;
+ endpbb = buf + bufsize;
+ for (i = 0; i < MAXINP; i++)
+ bbase[i] = buf;
+}
+
+void
+enlarge_strspace(void)
+{
+ char *newstrspace;
+ int i;
+
+ strsize *= 2;
+ newstrspace = malloc(strsize + 1);
+ if (!newstrspace)
+ errx(1, "string space overflow");
+ memcpy(newstrspace, strspace, strsize/2);
+ for (i = 0; i <= sp; i++)
+ if (sstack[i] == STORAGE_STRSPACE)
+ mstack[i].sstr = (mstack[i].sstr - strspace)
+ + newstrspace;
+ ep = (ep-strspace) + newstrspace;
+ free(strspace);
+ strspace = newstrspace;
+ endest = strspace + strsize;
+}
+
+void
+enlarge_bufspace(void)
+{
+ unsigned char *newbuf;
+ int i;
+
+ bufsize += bufsize/2;
+ newbuf = xrealloc(buf, bufsize, "too many characters pushed back");
+ for (i = 0; i < MAXINP; i++)
+ bbase[i] = (bbase[i]-buf)+newbuf;
+ bp = (bp-buf)+newbuf;
+ bufbase = (bufbase-buf)+newbuf;
+ buf = newbuf;
+ endpbb = buf+bufsize;
+}
+
+/*
+ * chrsave - put single char on string space
+ */
+void
+chrsave(int c)
+{
+ if (ep >= endest)
+ enlarge_strspace();
+ *ep++ = c;
+}
+
+/*
+ * read in a diversion file, and dispose it.
+ */
+void
+getdiv(int n)
+{
+ int c;
+
+ if (active == outfile[n])
+ m4errx(1, "undivert: diversion still active.");
+ rewind(outfile[n]);
+ while ((c = getc(outfile[n])) != EOF)
+ putc(c, active);
+ (void) fclose(outfile[n]);
+ outfile[n] = NULL;
+}
+
+void
+onintr(int signo __unused)
+{
+#define intrmessage "m4: interrupted.\n"
+ write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1);
+ _exit(1);
+}
+
+/*
+ * killdiv - get rid of the diversion files
+ */
+void
+killdiv(void)
+{
+ int n;
+
+ for (n = 0; n < maxout; n++)
+ if (outfile[n] != NULL) {
+ (void) fclose(outfile[n]);
+ }
+}
+
+extern char *__progname;
+
+void
+m4errx(int eval, const char *fmt, ...)
+{
+ fprintf(stderr, "%s: ", __progname);
+ fprintf(stderr, "%s at line %lu: ", CURRENT_NAME, CURRENT_LINE);
+ if (fmt != NULL) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
+ fprintf(stderr, "\n");
+ exit(eval);
+}
+
+/*
+ * resizedivs: allocate more diversion files */
+void
+resizedivs(int n)
+{
+ int i;
+
+ outfile = xreallocarray(outfile, n, sizeof(FILE *),
+ "too many diverts %d", n);
+ for (i = maxout; i < n; i++)
+ outfile[i] = NULL;
+ maxout = n;
+}
+
+void *
+xalloc(size_t n, const char *fmt, ...)
+{
+ void *p = malloc(n);
+
+ if (p == NULL) {
+ if (fmt == NULL)
+ err(1, "malloc");
+ else {
+ va_list va;
+
+ va_start(va, fmt);
+ verr(1, fmt, va);
+ va_end(va);
+ }
+ }
+ return p;
+}
+
+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);
+
+ if (p == NULL) {
+ free(old);
+ if (fmt == NULL)
+ err(1, "realloc");
+ else {
+ va_list va;
+
+ va_start(va, fmt);
+ verr(1, fmt, va);
+ va_end(va);
+ }
+ }
+ return p;
+}
+
+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)
+{
+ char *p = strdup(s);
+ if (p == NULL)
+ err(1, "strdup");
+ return p;
+}
+
+void
+usage(void)
+{
+ fprintf(stderr, "usage: m4 [-gPs] [-Dname[=value]] [-d flags] "
+ "[-I dirname] [-o filename]\n"
+ "\t[-t macro] [-Uname] [file ...]\n");
+ exit(1);
+}
+
+int
+obtain_char(struct input_file *f)
+{
+ if (f->c == EOF)
+ return EOF;
+
+ f->c = fgetc(f->file);
+ if (f->c == '\n')
+ f->lineno++;
+
+ return f->c;
+}
+
+void
+set_input(struct input_file *f, FILE *real, const char *name)
+{
+ f->file = real;
+ f->lineno = 1;
+ f->c = 0;
+ f->name = xstrdup(name);
+ emit_synchline();
+}
+
+void
+do_emit_synchline(void)
+{
+ fprintf(active, "#line %lu \"%s\"\n",
+ infile[ilevel].lineno, infile[ilevel].name);
+ infile[ilevel].synch_lineno = infile[ilevel].lineno;
+}
+
+void
+release_input(struct input_file *f)
+{
+ if (ferror(f->file))
+ errx(1, "Fatal error reading from %s\n", f->name);
+ if (f->file != stdin)
+ fclose(f->file);
+ f->c = EOF;
+ /*
+ * XXX can't free filename, as there might still be
+ * error information pointing to it.
+ */
+}
+
+void
+doprintlineno(struct input_file *f)
+{
+ pbunsigned(f->lineno);
+}
+
+void
+doprintfilename(struct input_file *f)
+{
+ pbstr(rquote);
+ pbstr(f->name);
+ pbstr(lquote);
+}
+
+/*
+ * buffer_mark/dump_buffer: allows one to save a mark in a buffer,
+ * and later dump everything that was added since then to a file.
+ */
+size_t
+buffer_mark(void)
+{
+ return bp - buf;
+}
+
+
+void
+dump_buffer(FILE *f, size_t m)
+{
+ unsigned char *s;
+
+ for (s = bp; s-buf > (long)m;)
+ fputc(*--s, f);
+}
diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y
new file mode 100644
index 0000000..3e4c8051
--- /dev/null
+++ b/usr.bin/m4/parser.y
@@ -0,0 +1,86 @@
+%{
+/* $OpenBSD: parser.y,v 1.7 2012/04/12 17:00:11 espie Exp $ */
+/*
+ * Copyright (c) 2004 Marc Espie <espie@cvs.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.
+ *
+ * $FreeBSD$
+ */
+
+#include <math.h>
+#include <stdint.h>
+#define YYSTYPE int32_t
+extern int32_t end_result;
+extern int yylex(void);
+extern int yyerror(const char *);
+%}
+%token NUMBER
+%token ERROR
+%left LOR
+%left LAND
+%left '|'
+%left '^'
+%left '&'
+%left EQ NE
+%left '<' LE '>' GE
+%left LSHIFT RSHIFT
+%left '+' '-'
+%left '*' '/' '%'
+%right EXPONENT
+%right UMINUS UPLUS '!' '~'
+
+%%
+
+top : expr { end_result = $1; }
+ ;
+expr : expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr EXPONENT expr { $$ = pow($1, $3); }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '/' expr {
+ if ($3 == 0) {
+ yyerror("division by zero");
+ exit(1);
+ }
+ $$ = $1 / $3;
+ }
+ | expr '%' expr {
+ if ($3 == 0) {
+ yyerror("modulo zero");
+ exit(1);
+ }
+ $$ = $1 % $3;
+ }
+ | expr LSHIFT expr { $$ = $1 << $3; }
+ | expr RSHIFT expr { $$ = $1 >> $3; }
+ | expr '<' expr { $$ = $1 < $3; }
+ | expr '>' expr { $$ = $1 > $3; }
+ | expr LE expr { $$ = $1 <= $3; }
+ | expr GE expr { $$ = $1 >= $3; }
+ | expr EQ expr { $$ = $1 == $3; }
+ | expr NE expr { $$ = $1 != $3; }
+ | expr '&' expr { $$ = $1 & $3; }
+ | expr '^' expr { $$ = $1 ^ $3; }
+ | expr '|' expr { $$ = $1 | $3; }
+ | expr LAND expr { $$ = $1 && $3; }
+ | expr LOR expr { $$ = $1 || $3; }
+ | '(' expr ')' { $$ = $2; }
+ | '-' expr %prec UMINUS { $$ = -$2; }
+ | '+' expr %prec UPLUS { $$ = $2; }
+ | '!' expr { $$ = !$2; }
+ | '~' expr { $$ = ~$2; }
+ | NUMBER
+ ;
+%%
+
diff --git a/usr.bin/m4/pathnames.h b/usr.bin/m4/pathnames.h
new file mode 100644
index 0000000..668111c
--- /dev/null
+++ b/usr.bin/m4/pathnames.h
@@ -0,0 +1,39 @@
+/* $OpenBSD: pathnames.h,v 1.6 2015/11/03 16:21:47 deraadt Exp $ */
+/* $NetBSD: pathnames.h,v 1.6 1995/09/29 00:27:55 cgd Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#define _PATH_DIVNAME "/tmp/m4.0XXXXXXXXXX" /* unix diversion files */
diff --git a/usr.bin/m4/stdd.h b/usr.bin/m4/stdd.h
new file mode 100644
index 0000000..85e6b00
--- /dev/null
+++ b/usr.bin/m4/stdd.h
@@ -0,0 +1,56 @@
+/* $OpenBSD: stdd.h,v 1.6 2010/09/07 19:58:09 marco Exp $ */
+/* $NetBSD: stdd.h,v 1.2 1995/09/28 05:37:50 tls Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ozan Yigit at York University.
+ *
+ * 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. 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.
+ *
+ * @(#)stdd.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+/*
+ * standard defines
+ */
+
+#define max(a,b) ((a) > (b)? (a): (b))
+#define min(a,b) ((a) < (b)? (a): (b))
+
+#define iswhite(c) ((c) == ' ' || (c) == '\t')
+
+/*
+ * STREQ is an optimised strcmp(a,b)==0
+ * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
+ */
+#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
+#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
+
+#define YES 1
+#define NO 0
diff --git a/usr.bin/m4/tests/Makefile b/usr.bin/m4/tests/Makefile
new file mode 100644
index 0000000..c3002f6
--- /dev/null
+++ b/usr.bin/m4/tests/Makefile
@@ -0,0 +1,51 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= args.m4
+${PACKAGE}FILES+= args2.m4
+${PACKAGE}FILES+= comments.m4
+${PACKAGE}FILES+= esyscmd.m4
+${PACKAGE}FILES+= eval.m4
+${PACKAGE}FILES+= ff_after_dnl.m4.uu
+${PACKAGE}FILES+= gnueval.m4
+${PACKAGE}FILES+= gnuformat.m4
+${PACKAGE}FILES+= gnupatterns.m4
+${PACKAGE}FILES+= gnupatterns2.m4
+${PACKAGE}FILES+= gnuprefix.m4
+${PACKAGE}FILES+= gnusofterror.m4
+${PACKAGE}FILES+= includes.aux
+${PACKAGE}FILES+= includes.m4
+${PACKAGE}FILES+= m4wrap3.m4
+${PACKAGE}FILES+= patterns.m4
+${PACKAGE}FILES+= quotes.m4
+${PACKAGE}FILES+= redef.m4
+${PACKAGE}FILES+= regress.args.out
+${PACKAGE}FILES+= regress.args2.out
+${PACKAGE}FILES+= regress.comments.out
+${PACKAGE}FILES+= regress.esyscmd.out
+${PACKAGE}FILES+= regress.eval.out
+${PACKAGE}FILES+= regress.ff_after_dnl.out
+${PACKAGE}FILES+= regress.gnueval.out
+${PACKAGE}FILES+= regress.gnuformat.out
+${PACKAGE}FILES+= regress.gnupatterns.out
+${PACKAGE}FILES+= regress.gnupatterns2.out
+${PACKAGE}FILES+= regress.gnuprefix.out
+${PACKAGE}FILES+= regress.gnusofterror.out
+${PACKAGE}FILES+= regress.gnutranslit2.out
+${PACKAGE}FILES+= regress.includes.out
+${PACKAGE}FILES+= regress.m4wrap3.out
+${PACKAGE}FILES+= regress.patterns.out
+${PACKAGE}FILES+= regress.quotes.out
+${PACKAGE}FILES+= regress.redef.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.strangequotes.out
+${PACKAGE}FILES+= regress.translit.out
+${PACKAGE}FILES+= regress.translit2.out
+${PACKAGE}FILES+= strangequotes.m4.uu
+${PACKAGE}FILES+= translit.m4
+${PACKAGE}FILES+= translit2.m4
+
+.include <bsd.test.mk>
diff --git a/usr.bin/m4/tests/Makefile.depend b/usr.bin/m4/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/m4/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/m4/tests/args.m4 b/usr.bin/m4/tests/args.m4
new file mode 100644
index 0000000..3ad30f2
--- /dev/null
+++ b/usr.bin/m4/tests/args.m4
@@ -0,0 +1,9 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/args.m4,v 1.1 2001/10/10 23:23:59 espie Exp $
+dnl Expanding all arguments
+define(`A', `first form: $@, second form $*')dnl
+define(`B', `C')dnl
+A(1,2,`B')
+dnl indirection means macro can get called with argc == 2 !
+indir(`A',1,2,`B')
+indir(`A')
diff --git a/usr.bin/m4/tests/args2.m4 b/usr.bin/m4/tests/args2.m4
new file mode 100644
index 0000000..3f9ed60
--- /dev/null
+++ b/usr.bin/m4/tests/args2.m4
@@ -0,0 +1,5 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/args2.m4,v 1.1 2008/08/16 09:57:12 espie Exp $
+dnl Preserving spaces within nested parentheses
+define(`foo',`$1')dnl
+foo(( check for embedded spaces))
diff --git a/usr.bin/m4/tests/comments.m4 b/usr.bin/m4/tests/comments.m4
new file mode 100644
index 0000000..d7038c4
--- /dev/null
+++ b/usr.bin/m4/tests/comments.m4
@@ -0,0 +1,59 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/comments.m4,v 1.1 2005/09/06 15:33:21 espie Exp $
+dnl checking the way changecom works.
+1: normal
+define(`comment', `COMMENT')dnl
+define(`p', 'XXX')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+2: `changecom(>>)dnl'
+changecom(>>)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+3: `changecom dnl'
+changecom dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+4: `changecom()dnl'
+changecom()dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+5: `changecom(,)dnl'
+changecom(,)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+6: `changecom(`p',q)dnl'
+changecom(`p',q)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+7: `changecom(`p')dnl'
+changecom(`p')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+8: `changecom(#)dnl'
+changecom(#)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
diff --git a/usr.bin/m4/tests/esyscmd.m4 b/usr.bin/m4/tests/esyscmd.m4
new file mode 100644
index 0000000..7b1342d
--- /dev/null
+++ b/usr.bin/m4/tests/esyscmd.m4
@@ -0,0 +1,43 @@
+dnl $FreeBSD$
+changequote(`{',`}')dnl
+dnl
+esyscmd({sh -c "m4<<EOF
+define(_bp,hi there a)
+define(_comb,
+_bp($1$2)
+_bp($2$1)
+)
+define(bp,
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+)
+bp(a00)
+bp(b00)
+bp(c00)
+bp(d00)
+bp(e00)
+bp(f00)
+bp(g00)
+bp(h00)
+bp(i00)
+bp(j00)
+bp(k00)
+bp(l00)
+bp(m00)
+bp(n00)
+bp(o00)
+bp(p00)
+bp(q00)
+bp(r00)
+bp(s00)
+bp(t00)
+bp(u00)
+bp(v00)
+bp(w00)
+EOF"})dnl
diff --git a/usr.bin/m4/tests/eval.m4 b/usr.bin/m4/tests/eval.m4
new file mode 100644
index 0000000..361f9b9
--- /dev/null
+++ b/usr.bin/m4/tests/eval.m4
@@ -0,0 +1,6 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/eval.m4,v 1.1 2004/05/12 21:24:37 espie Exp $
+dnl expr parser
+eval(224&127)
+eval(224|127)
+eval(224&&127)
diff --git a/usr.bin/m4/tests/ff_after_dnl.m4.uu b/usr.bin/m4/tests/ff_after_dnl.m4.uu
new file mode 100644
index 0000000..222f9e3
--- /dev/null
+++ b/usr.bin/m4/tests/ff_after_dnl.m4.uu
@@ -0,0 +1,11 @@
+$FreeBSD$
+$OpenBSD: src/regress/usr.bin/m4/ff_after_dnl.m4.uu,v 1.1.1.1 2000/07/01 00:31:01 espie Exp $
+$NetBSD: ff_after_dnl.m4.uu,v 1.1 1997/12/30 23:30:53 cgd Exp $
+
+begin 644 ff_after_dnl.m4
+M"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#$I"F1N;`D)5$A)4R!32$]5
+M3$0@3D]4(%-(3U<@55`@*$Q)3D4@,BD*9&YL_PD)5$A)4R!32$]53$0@3D]4
+M(%-(3U<@55`@*$Q)3D4@,RD*9&YL"?\)5$A)4R!32$]53$0@3D]4(%-(3U<@
+K55`@*$Q)3D4@-"D*"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#4I"E<@
+`
+end
diff --git a/usr.bin/m4/tests/gnueval.m4 b/usr.bin/m4/tests/gnueval.m4
new file mode 100644
index 0000000..9e7b576
--- /dev/null
+++ b/usr.bin/m4/tests/gnueval.m4
@@ -0,0 +1,7 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/gnueval.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+dnl exponentiation is right associative
+eval(`4**2**3')
+dnl priority between unary operators and *
+eval(`4**2*3')
+eval(`-4**3')
diff --git a/usr.bin/m4/tests/gnuformat.m4 b/usr.bin/m4/tests/gnuformat.m4
new file mode 100644
index 0000000..429d265
--- /dev/null
+++ b/usr.bin/m4/tests/gnuformat.m4
@@ -0,0 +1,2 @@
+dnl $FreeBSD$
+format(`a%15sa%%b%-15sbc%3scd%-3sd', `string', `pouet', `toolong', `toolong2')
diff --git a/usr.bin/m4/tests/gnupatterns.m4 b/usr.bin/m4/tests/gnupatterns.m4
new file mode 100644
index 0000000..735d1cf
--- /dev/null
+++ b/usr.bin/m4/tests/gnupatterns.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+patsubst(`string with a + to replace with a minus', `+', `minus')
+patsubst(`string with aaaaa to replace with a b', `a+', `b')
+patsubst(`+string with a starting + to replace with a minus', `^+', `minus')
diff --git a/usr.bin/m4/tests/gnupatterns2.m4 b/usr.bin/m4/tests/gnupatterns2.m4
new file mode 100644
index 0000000..23170b7
--- /dev/null
+++ b/usr.bin/m4/tests/gnupatterns2.m4
@@ -0,0 +1,6 @@
+dnl $FreeBSD$
+define(`zoinx',dnl
+`patsubst($1,\(\w+\)\(\W*\),\1 )')dnl
+zoinx(acosl asinl atanl \
+ cosl sinl tanl \
+ coshl sinhl tanhl)
diff --git a/usr.bin/m4/tests/gnuprefix.m4 b/usr.bin/m4/tests/gnuprefix.m4
new file mode 100644
index 0000000..fff9784
--- /dev/null
+++ b/usr.bin/m4/tests/gnuprefix.m4
@@ -0,0 +1,2 @@
+dumpdef()
+m4_dumpdef()
diff --git a/usr.bin/m4/tests/gnusofterror.m4 b/usr.bin/m4/tests/gnusofterror.m4
new file mode 100644
index 0000000..5ddc028
--- /dev/null
+++ b/usr.bin/m4/tests/gnusofterror.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/gnusofterror.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+include(`hey I do not exit')dnl
+abc
diff --git a/usr.bin/m4/tests/includes.aux b/usr.bin/m4/tests/includes.aux
new file mode 100644
index 0000000..a977969
--- /dev/null
+++ b/usr.bin/m4/tests/includes.aux
@@ -0,0 +1,3 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.aux,v 1.1 2008/08/16 10:02:32 espie Exp $
+hello world dnl
diff --git a/usr.bin/m4/tests/includes.m4 b/usr.bin/m4/tests/includes.m4
new file mode 100644
index 0000000..c06e763
--- /dev/null
+++ b/usr.bin/m4/tests/includes.m4
@@ -0,0 +1,5 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.m4,v 1.1 2008/08/16 10:02:32 espie Exp $
+dnl Check that include can occur within parameters
+define(`foo', include(includes.aux))dnl
+foo
diff --git a/usr.bin/m4/tests/legacy_test.sh b/usr.bin/m4/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/m4/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/m4/tests/m4wrap3.m4 b/usr.bin/m4/tests/m4wrap3.m4
new file mode 100644
index 0000000..a0dffb0
--- /dev/null
+++ b/usr.bin/m4/tests/m4wrap3.m4
@@ -0,0 +1,12 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/m4wrap3.m4,v 1.1 2005/03/02 10:12:41 espie Exp $
+dnl Another test, this time for multiple wrappers
+dnl Check the behavior in presence of recursive m4wraps
+dnl both for POSIX m4 and for gnu-m4 mode
+m4wrap(`this is
+')dnl
+m4wrap(`a string
+')dnl
+m4wrap(`m4wrap(`recurse
+')')dnl
+normal m4 stuff
diff --git a/usr.bin/m4/tests/patterns.m4 b/usr.bin/m4/tests/patterns.m4
new file mode 100644
index 0000000..e064778
--- /dev/null
+++ b/usr.bin/m4/tests/patterns.m4
@@ -0,0 +1,12 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/patterns.m4,v 1.4 2003/06/08 20:11:45 espie Exp $
+patsubst(`quote s in string', `(s)', `\\\1')
+patsubst(`check whether subst
+over several lines
+works as expected', `^', `>>>')
+patsubst(`# This is a line to zap
+# and a second line
+keep this one', `^ *#.*
+')
+dnl Special case: empty regexp
+patsubst(`empty regexp',`',`a ')
diff --git a/usr.bin/m4/tests/quotes.m4 b/usr.bin/m4/tests/quotes.m4
new file mode 100644
index 0000000..c783e22
--- /dev/null
+++ b/usr.bin/m4/tests/quotes.m4
@@ -0,0 +1,58 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/quotes.m4,v 1.2 2005/09/06 15:33:21 espie Exp $
+dnl Checking the way changequote() is supposed to work
+define(`string',`STRING')dnl
+1: normal
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+2: kill quotes
+changequote()dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+3: normal changed quote
+changequote([,])dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+4: empty quotes, kill them too
+changequote(,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+5: start quote only
+changequote(`)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+6: normal quotes are back
+changequote
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+7: start quote+empty end quote
+changequote([,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
diff --git a/usr.bin/m4/tests/redef.m4 b/usr.bin/m4/tests/redef.m4
new file mode 100644
index 0000000..de01f67
--- /dev/null
+++ b/usr.bin/m4/tests/redef.m4
@@ -0,0 +1,17 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/redef.m4,v 1.2 2001/09/27 22:40:58 espie Exp $
+dnl check all properties of builtin are passed on, including args behavior
+define(`mybuiltin',defn(`builtin'))dnl
+builtin mybuiltin
+define(`mydefine',defn(`define'))dnl
+mydefine(`mydefn',defn(`defn'))dnl
+mydefine(`myundefine',mydefn(`undefine'))dnl
+myundefine(`defn')dnl
+myundefine(`define')dnl
+myundefine(`undefine')dnl
+mydefine(`mydef2',mydefn(`mydefine'))dnl
+mydefine(`mydef', mydefn(`define'))dnl
+myundefine(`mydefine')dnl
+mydef2(`A',`B')dnl
+mydef(`C',`D')dnl
+A C
diff --git a/usr.bin/m4/tests/regress.args.out b/usr.bin/m4/tests/regress.args.out
new file mode 100644
index 0000000..aaa8900
--- /dev/null
+++ b/usr.bin/m4/tests/regress.args.out
@@ -0,0 +1,3 @@
+first form: 1,2,B, second form 1,2,C
+first form: 1,2,B, second form 1,2,C
+first form: , second form
diff --git a/usr.bin/m4/tests/regress.args2.out b/usr.bin/m4/tests/regress.args2.out
new file mode 100644
index 0000000..74bdbd6
--- /dev/null
+++ b/usr.bin/m4/tests/regress.args2.out
@@ -0,0 +1 @@
+( check for embedded spaces)
diff --git a/usr.bin/m4/tests/regress.comments.out b/usr.bin/m4/tests/regress.comments.out
new file mode 100644
index 0000000..157f107
--- /dev/null
+++ b/usr.bin/m4/tests/regress.comments.out
@@ -0,0 +1,47 @@
+1: normal
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+2: changecom(>>)dnl
+# this is a COMMENT
+>> this is a comment
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+3: changecom dnl
+ # this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+4: changecom()dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+5: changecom(,)dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+6: changecom(`p',q)dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q COMMENT too
+
+7: changecom(`p')dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q comment too
+
+8: changecom(#)dnl
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
diff --git a/usr.bin/m4/tests/regress.esyscmd.out b/usr.bin/m4/tests/regress.esyscmd.out
new file mode 100644
index 0000000..89a1d06
--- /dev/null
+++ b/usr.bin/m4/tests/regress.esyscmd.out
@@ -0,0 +1,578 @@
+
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
diff --git a/usr.bin/m4/tests/regress.eval.out b/usr.bin/m4/tests/regress.eval.out
new file mode 100644
index 0000000..7298b3f
--- /dev/null
+++ b/usr.bin/m4/tests/regress.eval.out
@@ -0,0 +1,3 @@
+96
+255
+1
diff --git a/usr.bin/m4/tests/regress.ff_after_dnl.out b/usr.bin/m4/tests/regress.ff_after_dnl.out
new file mode 100644
index 0000000..8e51f1e
--- /dev/null
+++ b/usr.bin/m4/tests/regress.ff_after_dnl.out
@@ -0,0 +1,2 @@
+ THIS SHOULD SHOW UP (LINE 1)
+ THIS SHOULD SHOW UP (LINE 5)
diff --git a/usr.bin/m4/tests/regress.gnueval.out b/usr.bin/m4/tests/regress.gnueval.out
new file mode 100644
index 0000000..6d7fd49
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnueval.out
@@ -0,0 +1,3 @@
+65536
+48
+-64
diff --git a/usr.bin/m4/tests/regress.gnuformat.out b/usr.bin/m4/tests/regress.gnuformat.out
new file mode 100644
index 0000000..3f484d6
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnuformat.out
@@ -0,0 +1 @@
+a stringa%bpouet bctoolongcdtoolong2d
diff --git a/usr.bin/m4/tests/regress.gnupatterns.out b/usr.bin/m4/tests/regress.gnupatterns.out
new file mode 100644
index 0000000..8e31103
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnupatterns.out
@@ -0,0 +1,3 @@
+string with a minus to replace with a minus
+string with b to replbce with b b
+minusstring with a starting + to replace with a minus
diff --git a/usr.bin/m4/tests/regress.gnupatterns2.out b/usr.bin/m4/tests/regress.gnupatterns2.out
new file mode 100644
index 0000000..c45944a
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnupatterns2.out
@@ -0,0 +1 @@
+acosl asinl atanl cosl sinl tanl coshl sinhl tanhl
diff --git a/usr.bin/m4/tests/regress.gnuprefix.out b/usr.bin/m4/tests/regress.gnuprefix.out
new file mode 100644
index 0000000..186421d
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnuprefix.out
@@ -0,0 +1,46 @@
+`m4_ifelse' `m4_ifelse'
+`m4_dnl' `m4_dnl'
+`m4_expr' `m4_expr'
+`m4_builtin' `m4_builtin'
+`m4_popdef' `m4_popdef'
+`m4_eval' `m4_eval'
+`m4_len' `m4_len'
+`m4_indir' `m4_indir'
+`m4_sinclude' `m4_sinclude'
+`m4_index' `m4_index'
+`m4_traceoff' `m4_traceoff'
+`m4___file__' `m4___file__'
+`m4_unix' `m4_unix'
+`m4_mkstemp' `m4_mkstemp'
+`m4_changecom' `m4_changecom'
+`m4_defn' `m4_defn'
+`m4_decr' `m4_decr'
+`m4_translit' `m4_translit'
+`m4_patsubst' `m4_patsubst'
+`m4_dumpdef' `m4_dumpdef'
+`m4___line__' `m4___line__'
+`m4_esyscmd' `m4_esyscmd'
+`m4_traceon' `m4_traceon'
+`m4_incr' `m4_incr'
+`m4_shift' `m4_shift'
+`m4_syscmd' `m4_syscmd'
+`m4_include' `m4_include'
+`m4_pushdef' `m4_pushdef'
+`m4_paste' `m4_paste'
+`m4_regexp' `m4_regexp'
+`m4_changequote' `m4_changequote'
+`m4_undivert' `m4_undivert'
+`m4_m4exit' `m4_m4exit'
+`m4_substr' `m4_substr'
+`m4_m4wrap' `m4_m4wrap'
+`m4_ifdef' `m4_ifdef'
+`m4_sysval' `m4_sysval'
+`m4_divert' `m4_divert'
+`m4_maketemp' `m4_maketemp'
+`m4_spaste' `m4_spaste'
+`m4_define' `m4_define'
+`m4_undefine' `m4_undefine'
+`m4_divnum' `m4_divnum'
+`m4_errprint' `m4_errprint'
+dumpdef()
+
diff --git a/usr.bin/m4/tests/regress.gnusofterror.out b/usr.bin/m4/tests/regress.gnusofterror.out
new file mode 100644
index 0000000..322fa4c
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnusofterror.out
@@ -0,0 +1,2 @@
+m4: gnusofterror.m4 at line 3: include(hey I do not exit): No such file or directory
+abc
diff --git a/usr.bin/m4/tests/regress.gnutranslit2.out b/usr.bin/m4/tests/regress.gnutranslit2.out
new file mode 100644
index 0000000..5c88e73
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnutranslit2.out
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+ABCDEFGHIJ
+ABC-0980-ZYX
+ABC-0980-ZYX
diff --git a/usr.bin/m4/tests/regress.includes.out b/usr.bin/m4/tests/regress.includes.out
new file mode 100644
index 0000000..4a1f475
--- /dev/null
+++ b/usr.bin/m4/tests/regress.includes.out
@@ -0,0 +1 @@
+hello world
diff --git a/usr.bin/m4/tests/regress.m4wrap3.out b/usr.bin/m4/tests/regress.m4wrap3.out
new file mode 100644
index 0000000..51b43f4
--- /dev/null
+++ b/usr.bin/m4/tests/regress.m4wrap3.out
@@ -0,0 +1,4 @@
+normal m4 stuff
+this is
+a string
+recurse
diff --git a/usr.bin/m4/tests/regress.patterns.out b/usr.bin/m4/tests/regress.patterns.out
new file mode 100644
index 0000000..c273b58
--- /dev/null
+++ b/usr.bin/m4/tests/regress.patterns.out
@@ -0,0 +1,6 @@
+quote \s in \string
+>>>check whether subst
+>>>over several lines
+>>>works as expected
+keep this one
+a ea ma pa ta ya a ra ea ga ea xa p
diff --git a/usr.bin/m4/tests/regress.quotes.out b/usr.bin/m4/tests/regress.quotes.out
new file mode 100644
index 0000000..fe5b8a4
--- /dev/null
+++ b/usr.bin/m4/tests/regress.quotes.out
@@ -0,0 +1,49 @@
+m4: unclosed quote:
+ quotes.m4 at line 55
+1: normal
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+2: kill quotes
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+3: normal changed quote
+`quoted STRING'
+quoted string
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+4: empty quotes, kill them too
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+5: start quote only
+quoted string'[quoted STRING]
+normal STRING
+half quoted stringgoing up to that STRING'
+
+6: normal quotes are back
+
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+7: start quote+empty end quote
+`quoted STRING'
+quoted string]
+normal string
+`half quoted string
+going up to that string'
diff --git a/usr.bin/m4/tests/regress.redef.out b/usr.bin/m4/tests/regress.redef.out
new file mode 100644
index 0000000..ee482f0
--- /dev/null
+++ b/usr.bin/m4/tests/regress.redef.out
@@ -0,0 +1,2 @@
+builtin mybuiltin
+B C
diff --git a/usr.bin/m4/tests/regress.sh b/usr.bin/m4/tests/regress.sh
new file mode 100644
index 0000000..c1d8b45
--- /dev/null
+++ b/usr.bin/m4/tests/regress.sh
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+echo 1..21
+
+test_m4() {
+ m4 "${@}" 2>&1 | sed -e "s,${SRCDIR}/,,g"
+}
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`args', `test_m4 ${SRCDIR}/args.m4')
+REGRESSION_TEST(`args2', `test_m4 ${SRCDIR}/args2.m4')
+REGRESSION_TEST(`comments', `test_m4 ${SRCDIR}/comments.m4')
+REGRESSION_TEST(`esyscmd', `test_m4 ${SRCDIR}/esyscmd.m4')
+REGRESSION_TEST(`eval', `test_m4 ${SRCDIR}/eval.m4')
+REGRESSION_TEST(`ff_after_dnl', `uudecode -o /dev/stdout ${SRCDIR}/ff_after_dnl.m4.uu | m4')
+REGRESSION_TEST(`gnueval', `test_m4 -g ${SRCDIR}/gnueval.m4')
+REGRESSION_TEST(`gnuformat', `test_m4 -g ${SRCDIR}/gnuformat.m4')
+REGRESSION_TEST(`gnupatterns', `test_m4 -g ${SRCDIR}/gnupatterns.m4')
+REGRESSION_TEST(`gnupatterns2', `test_m4 -g ${SRCDIR}/gnupatterns2.m4')
+REGRESSION_TEST(`gnuprefix', `test_m4 -P ${SRCDIR}/gnuprefix.m4 2>&1')
+REGRESSION_TEST(`gnusofterror', `test_m4 -g ${SRCDIR}/gnusofterror.m4 2>&1')
+REGRESSION_TEST(`gnutranslit2', `test_m4 -g ${SRCDIR}/translit2.m4')
+REGRESSION_TEST(`includes', `test_m4 -I${SRCDIR} ${SRCDIR}/includes.m4')
+REGRESSION_TEST(`m4wrap3', `test_m4 ${SRCDIR}/m4wrap3.m4')
+REGRESSION_TEST(`patterns', `test_m4 ${SRCDIR}/patterns.m4')
+REGRESSION_TEST(`quotes', `test_m4 ${SRCDIR}/quotes.m4 2>&1')
+REGRESSION_TEST(`strangequotes', `uudecode -o /dev/stdout ${SRCDIR}/strangequotes.m4.uu | m4')
+REGRESSION_TEST(`redef', `test_m4 ${SRCDIR}/redef.m4')
+REGRESSION_TEST(`translit', `test_m4 ${SRCDIR}/translit.m4')
+REGRESSION_TEST(`translit2', `test_m4 ${SRCDIR}/translit2.m4')
+
+REGRESSION_END()
diff --git a/usr.bin/m4/tests/regress.strangequotes.out b/usr.bin/m4/tests/regress.strangequotes.out
new file mode 100644
index 0000000..f19297b
--- /dev/null
+++ b/usr.bin/m4/tests/regress.strangequotes.out
@@ -0,0 +1 @@
+4 to 5
diff --git a/usr.bin/m4/tests/regress.translit.out b/usr.bin/m4/tests/regress.translit.out
new file mode 100644
index 0000000..54abdd3
--- /dev/null
+++ b/usr.bin/m4/tests/regress.translit.out
@@ -0,0 +1 @@
+onkp
diff --git a/usr.bin/m4/tests/regress.translit2.out b/usr.bin/m4/tests/regress.translit2.out
new file mode 100644
index 0000000..5c56177
--- /dev/null
+++ b/usr.bin/m4/tests/regress.translit2.out
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+A12345678J
+ABC-0980-ZYX
+Abc-0980-Zyx
diff --git a/usr.bin/m4/tests/strangequotes.m4.uu b/usr.bin/m4/tests/strangequotes.m4.uu
new file mode 100644
index 0000000..e3d840f
--- /dev/null
+++ b/usr.bin/m4/tests/strangequotes.m4.uu
@@ -0,0 +1,8 @@
+$FreeBSD$
+$OpenBSD: src/regress/usr.bin/m4/strangequotes.m4.uu,v 1.2 2001/09/19 19:15:08 espie Exp $
+
+begin 644 strangequotes.m4
+M8VAA;F=E<75O=&4HJRR[*61N;`ID969I;F4HJT&[+""K)#$@=&\@)#*[*61N
+*;`I!*#0L(#4I"F4H
+`
+end
diff --git a/usr.bin/m4/tests/translit.m4 b/usr.bin/m4/tests/translit.m4
new file mode 100644
index 0000000..19af2e1
--- /dev/null
+++ b/usr.bin/m4/tests/translit.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/translit.m4,v 1.1 2010/03/23 20:11:52 espie Exp $
+dnl first one should match, not second one
+translit(`onk*', `**', `p_')
diff --git a/usr.bin/m4/tests/translit2.m4 b/usr.bin/m4/tests/translit2.m4
new file mode 100644
index 0000000..ec26c08
--- /dev/null
+++ b/usr.bin/m4/tests/translit2.m4
@@ -0,0 +1,9 @@
+dnl $FreeBSD$
+translit(`[HAVE_abc/def.h
+]', `
+/.', `/ ')
+translit(`[HAVE_abc/def.h=]', `=/.', `/~~')
+translit(`0123456789', `0123456789', `ABCDEFGHIJ')
+translit(`0123456789', `[0-9]', `[A-J]')
+translit(`abc-0980-zyx', `abcdefghijklmnopqrstuvwxyz', `ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+translit(`abc-0980-zyx', `[a-z]', `[A-Z]')
diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l
new file mode 100644
index 0000000..2b4b2db
--- /dev/null
+++ b/usr.bin/m4/tokenizer.l
@@ -0,0 +1,114 @@
+%option nounput noinput
+%{
+/* $OpenBSD: tokenizer.l,v 1.8 2012/04/12 17:00:11 espie Exp $ */
+/*
+ * Copyright (c) 2004 Marc Espie <espie@cvs.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.
+ *
+ * $FreeBSD$
+ */
+#include "parser.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdint.h>
+#include <limits.h>
+
+extern int mimic_gnu;
+extern int32_t yylval;
+
+int32_t number(void);
+int32_t parse_radix(void);
+extern int yylex(void);
+
+#define YY_DECL int yylex(void)
+%}
+
+delim [ \t\n]
+ws {delim}+
+hex 0[xX][0-9a-fA-F]+
+oct 0[0-7]*
+dec [1-9][0-9]*
+radix 0[rR][0-9]+:[0-9a-zA-Z]+
+
+%%
+{ws} {/* just skip it */}
+{hex}|{oct}|{dec} { yylval = number(); return(NUMBER); }
+{radix} { if (mimic_gnu) {
+ yylval = parse_radix(); return(NUMBER);
+ } else {
+ return(ERROR);
+ }
+ }
+"<=" { return(LE); }
+">=" { return(GE); }
+"<<" { return(LSHIFT); }
+">>" { return(RSHIFT); }
+"==" { return(EQ); }
+"!=" { return(NE); }
+"&&" { return(LAND); }
+"||" { return(LOR); }
+"**" { if (mimic_gnu) { return (EXPONENT); } }
+. { return yytext[0]; }
+%%
+
+int32_t
+number(void)
+{
+ long l;
+
+ errno = 0;
+ l = strtol(yytext, NULL, 0);
+ if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) ||
+ l > INT32_MAX || l < INT32_MIN) {
+ fprintf(stderr, "m4: numeric overflow in expr: %s\n", yytext);
+ }
+ return l;
+}
+
+int32_t
+parse_radix(void)
+{
+ long base;
+ char *next;
+ long l;
+ int d;
+
+ l = 0;
+ base = strtol(yytext+2, &next, 0);
+ if (base > 36 || next == NULL) {
+ fprintf(stderr, "m4: error in number %s\n", yytext);
+ } else {
+ next++;
+ while (*next != 0) {
+ if (*next >= '0' && *next <= '9')
+ d = *next - '0';
+ else if (*next >= 'a' && *next <= 'z')
+ d = *next - 'a' + 10;
+ else {
+ assert(*next >= 'A' && *next <= 'Z');
+ d = *next - 'A' + 10;
+ }
+ if (d >= base) {
+ fprintf(stderr,
+ "m4: error in number %s\n", yytext);
+ return 0;
+ }
+ l = base * l + d;
+ next++;
+ }
+ }
+ return l;
+}
+
diff --git a/usr.bin/m4/trace.c b/usr.bin/m4/trace.c
new file mode 100644
index 0000000..90e913d
--- /dev/null
+++ b/usr.bin/m4/trace.c
@@ -0,0 +1,198 @@
+/* $OpenBSD: trace.c,v 1.16 2010/09/07 19:58:09 marco Exp $ */
+/*
+ * Copyright (c) 2001 Marc Espie.
+ *
+ * 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 OPENBSD PROJECT 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 OPENBSD
+ * PROJECT 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 <err.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "mdef.h"
+#include "stdd.h"
+#include "extern.h"
+
+FILE *traceout;
+
+#define TRACE_ARGS 1
+#define TRACE_EXPANSION 2
+#define TRACE_QUOTE 4
+#define TRACE_FILENAME 8
+#define TRACE_LINENO 16
+#define TRACE_CONT 32
+#define TRACE_ID 64
+#define TRACE_NEWFILE 128 /* not implemented yet */
+#define TRACE_INPUT 256 /* not implemented yet */
+
+static unsigned int letter_to_flag(int);
+static void print_header(struct input_file *);
+static int frame_level(void);
+
+
+unsigned int trace_flags = TRACE_QUOTE | TRACE_EXPANSION;
+
+void
+trace_file(const char *name)
+{
+
+ if (traceout && traceout != stderr)
+ fclose(traceout);
+ traceout = fopen(name, "w");
+ if (!traceout)
+ err(1, "can't open %s", name);
+}
+
+static unsigned int
+letter_to_flag(int c)
+{
+ switch(c) {
+ case 'a':
+ return TRACE_ARGS;
+ case 'e':
+ return TRACE_EXPANSION;
+ case 'q':
+ return TRACE_QUOTE;
+ case 'c':
+ return TRACE_CONT;
+ case 'x':
+ return TRACE_ID;
+ case 'f':
+ return TRACE_FILENAME;
+ case 'l':
+ return TRACE_LINENO;
+ case 'p':
+ return TRACE_NEWFILE;
+ case 'i':
+ return TRACE_INPUT;
+ case 't':
+ return TRACE_ALL;
+ case 'V':
+ return ~0;
+ default:
+ return 0;
+ }
+}
+
+void
+set_trace_flags(const char *s)
+{
+ char mode = 0;
+ unsigned int f = 0;
+
+ if (*s == '+' || *s == '-')
+ mode = *s++;
+ while (*s)
+ f |= letter_to_flag(*s++);
+ switch(mode) {
+ case 0:
+ trace_flags = f;
+ break;
+ case '+':
+ trace_flags |= f;
+ break;
+ case '-':
+ trace_flags &= ~f;
+ break;
+ }
+}
+
+static int
+frame_level(void)
+{
+ int level;
+ int framep;
+
+ for (framep = fp, level = 0; framep != 0;
+ level++,framep = mstack[framep-3].sfra)
+ ;
+ return level;
+}
+
+static void
+print_header(struct input_file *inp)
+{
+ fprintf(traceout, "m4trace:");
+ if (trace_flags & TRACE_FILENAME)
+ fprintf(traceout, "%s:", inp->name);
+ if (trace_flags & TRACE_LINENO)
+ fprintf(traceout, "%lu:", inp->lineno);
+ fprintf(traceout, " -%d- ", frame_level());
+ if (trace_flags & TRACE_ID)
+ fprintf(traceout, "id %lu: ", expansion_id);
+}
+
+size_t
+trace(const char *argv[], int argc, struct input_file *inp)
+{
+ if (!traceout)
+ traceout = stderr;
+ print_header(inp);
+ if (trace_flags & TRACE_CONT) {
+ fprintf(traceout, "%s ...\n", argv[1]);
+ print_header(inp);
+ }
+ fprintf(traceout, "%s", argv[1]);
+ if ((trace_flags & TRACE_ARGS) && argc > 2) {
+ char delim[3];
+ int i;
+
+ delim[0] = LPAREN;
+ delim[1] = EOS;
+ for (i = 2; i < argc; i++) {
+ fprintf(traceout, "%s%s%s%s", delim,
+ (trace_flags & TRACE_QUOTE) ? lquote : "",
+ argv[i],
+ (trace_flags & TRACE_QUOTE) ? rquote : "");
+ delim[0] = COMMA;
+ delim[1] = ' ';
+ delim[2] = EOS;
+ }
+ fprintf(traceout, "%c", RPAREN);
+ }
+ if (trace_flags & TRACE_CONT) {
+ fprintf(traceout, " -> ???\n");
+ print_header(inp);
+ fprintf(traceout, argc > 2 ? "%s(...)" : "%s", argv[1]);
+ }
+ if (trace_flags & TRACE_EXPANSION)
+ return buffer_mark();
+ else {
+ fprintf(traceout, "\n");
+ return SIZE_MAX;
+ }
+}
+
+void
+finish_trace(size_t mark)
+{
+ fprintf(traceout, " -> ");
+ if (trace_flags & TRACE_QUOTE)
+ fprintf(traceout, "%s", lquote);
+ dump_buffer(traceout, mark);
+ if (trace_flags & TRACE_QUOTE)
+ fprintf(traceout, "%s", rquote);
+ fprintf(traceout, "\n");
+}
diff --git a/usr.bin/mail/Makefile b/usr.bin/mail/Makefile
new file mode 100644
index 0000000..ea2338b
--- /dev/null
+++ b/usr.bin/mail/Makefile
@@ -0,0 +1,22 @@
+# @(#)Makefile 8.2 (Berkeley) 1/25/94
+# $FreeBSD$
+
+PROG= mail
+SRCS= version.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c edit.c fio.c \
+ getname.c head.c v7.local.c lex.c list.c main.c names.c popen.c \
+ quit.c send.c strings.c temp.c tty.c util.c vars.c
+FILES= mail.help mail.tildehelp
+FILESDIR= ${SHAREDIR}/misc
+EFILES= mail.rc
+LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx
+MLINKS= mail.1 Mail.1 mail.1 mailx.1
+
+WARNS?= 2
+
+.PATH: ${.CURDIR}/misc
+
+etc-mailrc:
+ cd ${.CURDIR}/misc; ${INSTALL} -o root -g wheel \
+ -m 644 ${EFILES} ${DESTDIR}/etc
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mail/Makefile.depend b/usr.bin/mail/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/mail/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/mail/cmd1.c b/usr.bin/mail/cmd1.c
new file mode 100644
index 0000000..4782ec9
--- /dev/null
+++ b/usr.bin/mail/cmd1.c
@@ -0,0 +1,466 @@
+/*-
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)cmd1.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * User commands.
+ */
+
+extern const struct cmd cmdtab[];
+
+/*
+ * Print the current active headings.
+ * Don't change dot if invoker didn't give an argument.
+ */
+
+static int screen;
+
+int
+headers(int *msgvec)
+{
+ int n, mesg, flag, size;
+ struct message *mp;
+
+ size = screensize();
+ n = msgvec[0];
+ if (n != 0)
+ screen = (n-1)/size;
+ if (screen < 0)
+ screen = 0;
+ mp = &message[screen * size];
+ if (mp >= &message[msgCount])
+ mp = &message[msgCount - size];
+ if (mp < &message[0])
+ mp = &message[0];
+ flag = 0;
+ mesg = mp - &message[0];
+ if (dot != &message[n-1])
+ dot = mp;
+ for (; mp < &message[msgCount]; mp++) {
+ mesg++;
+ if (mp->m_flag & MDELETED)
+ continue;
+ if (flag++ >= size)
+ break;
+ printhead(mesg);
+ }
+ if (flag == 0) {
+ printf("No more mail.\n");
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Scroll to the next/previous screen
+ */
+int
+scroll(char arg[])
+{
+ int s, size;
+ int cur[1];
+
+ cur[0] = 0;
+ size = screensize();
+ s = screen;
+ switch (*arg) {
+ case 0:
+ case '+':
+ s++;
+ if (s * size >= msgCount) {
+ printf("On last screenful of messages\n");
+ return (0);
+ }
+ screen = s;
+ break;
+
+ case '-':
+ if (--s < 0) {
+ printf("On first screenful of messages\n");
+ return (0);
+ }
+ screen = s;
+ break;
+
+ default:
+ printf("Unrecognized scrolling command \"%s\"\n", arg);
+ return (1);
+ }
+ return (headers(cur));
+}
+
+/*
+ * Compute screen size.
+ */
+int
+screensize(void)
+{
+ int s;
+ char *cp;
+
+ if ((cp = value("screen")) != NULL && (s = atoi(cp)) > 0)
+ return (s);
+ return (screenheight - 4);
+}
+
+/*
+ * Print out the headlines for each message
+ * in the passed message list.
+ */
+int
+from(int *msgvec)
+{
+ int *ip;
+
+ for (ip = msgvec; *ip != 0; ip++)
+ printhead(*ip);
+ if (--ip >= msgvec)
+ dot = &message[*ip - 1];
+ return (0);
+}
+
+/*
+ * Print out the header of a specific message.
+ * This is a slight improvement to the standard one.
+ */
+void
+printhead(int mesg)
+{
+ struct message *mp;
+ char headline[LINESIZE], wcount[LINESIZE], *subjline, dispc, curind;
+ char pbuf[BUFSIZ];
+ struct headline hl;
+ int subjlen;
+ char *name;
+
+ mp = &message[mesg-1];
+ (void)readline(setinput(mp), headline, LINESIZE);
+ if ((subjline = hfield("subject", mp)) == NULL)
+ subjline = hfield("subj", mp);
+ /*
+ * Bletch!
+ */
+ curind = dot == mp ? '>' : ' ';
+ dispc = ' ';
+ if (mp->m_flag & MSAVED)
+ dispc = '*';
+ if (mp->m_flag & MPRESERVE)
+ dispc = 'P';
+ if ((mp->m_flag & (MREAD|MNEW)) == MNEW)
+ dispc = 'N';
+ if ((mp->m_flag & (MREAD|MNEW)) == 0)
+ dispc = 'U';
+ if (mp->m_flag & MBOX)
+ dispc = 'M';
+ parse(headline, &hl, pbuf);
+ sprintf(wcount, "%3ld/%-5ld", mp->m_lines, mp->m_size);
+ subjlen = screenwidth - 50 - strlen(wcount);
+ name = value("show-rcpt") != NULL ?
+ skin(hfield("to", mp)) : nameof(mp, 0);
+ if (subjline == NULL || subjlen < 0) /* pretty pathetic */
+ printf("%c%c%3d %-20.20s %16.16s %s\n",
+ curind, dispc, mesg, name, hl.l_date, wcount);
+ else
+ printf("%c%c%3d %-20.20s %16.16s %s \"%.*s\"\n",
+ curind, dispc, mesg, name, hl.l_date, wcount,
+ subjlen, subjline);
+}
+
+/*
+ * Print out the value of dot.
+ */
+int
+pdot(void)
+{
+ printf("%td\n", dot - &message[0] + 1);
+ return (0);
+}
+
+/*
+ * Print out all the possible commands.
+ */
+int
+pcmdlist(void)
+{
+ const struct cmd *cp;
+ int cc;
+
+ printf("Commands are:\n");
+ for (cc = 0, cp = cmdtab; cp->c_name != NULL; cp++) {
+ cc += strlen(cp->c_name) + 2;
+ if (cc > 72) {
+ printf("\n");
+ cc = strlen(cp->c_name) + 2;
+ }
+ if ((cp+1)->c_name != NULL)
+ printf("%s, ", cp->c_name);
+ else
+ printf("%s\n", cp->c_name);
+ }
+ return (0);
+}
+
+/*
+ * Paginate messages, honor ignored fields.
+ */
+int
+more(int *msgvec)
+{
+
+ return (type1(msgvec, 1, 1));
+}
+
+/*
+ * Paginate messages, even printing ignored fields.
+ */
+int
+More(int *msgvec)
+{
+
+ return (type1(msgvec, 0, 1));
+}
+
+/*
+ * Type out messages, honor ignored fields.
+ */
+int
+type(int *msgvec)
+{
+
+ return (type1(msgvec, 1, 0));
+}
+
+/*
+ * Type out messages, even printing ignored fields.
+ */
+int
+Type(int *msgvec)
+{
+
+ return (type1(msgvec, 0, 0));
+}
+
+/*
+ * Type out the messages requested.
+ */
+static jmp_buf pipestop;
+int
+type1(int *msgvec, int doign, int page)
+{
+ int nlines, *ip;
+ struct message *mp;
+ char *cp;
+ FILE *obuf;
+
+ obuf = stdout;
+ if (setjmp(pipestop))
+ goto close_pipe;
+ if (value("interactive") != NULL &&
+ (page || (cp = value("crt")) != NULL)) {
+ nlines = 0;
+ if (!page) {
+ for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++)
+ nlines += message[*ip - 1].m_lines;
+ }
+ if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) {
+ cp = value("PAGER");
+ if (cp == NULL || *cp == '\0')
+ cp = _PATH_MORE;
+ obuf = Popen(cp, "w");
+ if (obuf == NULL) {
+ warnx("%s", cp);
+ obuf = stdout;
+ } else
+ (void)signal(SIGPIPE, brokpipe);
+ }
+ }
+
+ /*
+ * Send messages to the output.
+ *
+ */
+ for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) {
+ mp = &message[*ip - 1];
+ touch(mp);
+ dot = mp;
+ if (value("quiet") == NULL)
+ fprintf(obuf, "Message %d:\n", *ip);
+ (void)sendmessage(mp, obuf, doign ? ignore : 0, NULL);
+ }
+
+close_pipe:
+ if (obuf != stdout) {
+ /*
+ * Ignore SIGPIPE so it can't cause a duplicate close.
+ */
+ (void)signal(SIGPIPE, SIG_IGN);
+ (void)Pclose(obuf);
+ (void)signal(SIGPIPE, SIG_DFL);
+ }
+ return (0);
+}
+
+/*
+ * Respond to a broken pipe signal --
+ * probably caused by quitting more.
+ */
+/*ARGSUSED*/
+void
+brokpipe(int signo __unused)
+{
+ longjmp(pipestop, 1);
+}
+
+/*
+ * Print the top so many lines of each desired message.
+ * The number of lines is taken from the variable "toplines"
+ * and defaults to 5.
+ */
+int
+top(int *msgvec)
+{
+ int *ip;
+ struct message *mp;
+ int c, topl, lines, lineb;
+ char *valtop, linebuf[LINESIZE];
+ FILE *ibuf;
+
+ topl = 5;
+ valtop = value("toplines");
+ if (valtop != NULL) {
+ topl = atoi(valtop);
+ if (topl < 0 || topl > 10000)
+ topl = 5;
+ }
+ lineb = 1;
+ for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
+ mp = &message[*ip - 1];
+ touch(mp);
+ dot = mp;
+ if (value("quiet") == NULL)
+ printf("Message %d:\n", *ip);
+ ibuf = setinput(mp);
+ c = mp->m_lines;
+ if (!lineb)
+ printf("\n");
+ for (lines = 0; lines < c && lines <= topl; lines++) {
+ if (readline(ibuf, linebuf, sizeof(linebuf)) < 0)
+ break;
+ puts(linebuf);
+ lineb = strspn(linebuf, " \t") == strlen(linebuf);
+ }
+ }
+ return (0);
+}
+
+/*
+ * Touch all the given messages so that they will
+ * get mboxed.
+ */
+int
+stouch(int msgvec[])
+{
+ int *ip;
+
+ for (ip = msgvec; *ip != 0; ip++) {
+ dot = &message[*ip-1];
+ dot->m_flag |= MTOUCH;
+ dot->m_flag &= ~MPRESERVE;
+ }
+ return (0);
+}
+
+/*
+ * Make sure all passed messages get mboxed.
+ */
+int
+mboxit(int msgvec[])
+{
+ int *ip;
+
+ for (ip = msgvec; *ip != 0; ip++) {
+ dot = &message[*ip-1];
+ dot->m_flag |= MTOUCH|MBOX;
+ dot->m_flag &= ~MPRESERVE;
+ }
+ return (0);
+}
+
+/*
+ * List the folders the user currently has.
+ */
+int
+folders(void)
+{
+ char dirname[PATHSIZE];
+ char *cmd;
+
+ if (getfold(dirname, sizeof(dirname)) < 0) {
+ printf("No value set for \"folder\"\n");
+ return (1);
+ }
+ if ((cmd = value("LISTER")) == NULL)
+ cmd = "ls";
+ (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL);
+ return (0);
+}
+
+/*
+ * Update the mail file with any new messages that have
+ * come in since we started reading mail.
+ */
+int
+inc(void *v __unused)
+{
+ int nmsg, mdot;
+
+ nmsg = incfile();
+
+ if (nmsg == 0)
+ printf("No new mail.\n");
+ else if (nmsg > 0) {
+ mdot = newfileinfo(msgCount - nmsg);
+ dot = &message[mdot - 1];
+ } else
+ printf("\"inc\" command failed...\n");
+
+ return (0);
+}
diff --git a/usr.bin/mail/cmd2.c b/usr.bin/mail/cmd2.c
new file mode 100644
index 0000000..dd7f6dd
--- /dev/null
+++ b/usr.bin/mail/cmd2.c
@@ -0,0 +1,504 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <sys/wait.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * More user commands.
+ */
+
+extern int wait_status;
+
+/*
+ * If any arguments were given, go to the next applicable argument
+ * following dot, otherwise, go to the next applicable message.
+ * If given as first command with no arguments, print first message.
+ */
+int
+next(int *msgvec)
+{
+ struct message *mp;
+ int *ip, *ip2, list[2], mdot;
+
+ if (*msgvec != 0) {
+
+ /*
+ * If some messages were supplied, find the
+ * first applicable one following dot using
+ * wrap around.
+ */
+
+ mdot = dot - &message[0] + 1;
+
+ /*
+ * Find the first message in the supplied
+ * message list which follows dot.
+ */
+
+ for (ip = msgvec; *ip != 0; ip++)
+ if (*ip > mdot)
+ break;
+ if (*ip == 0)
+ ip = msgvec;
+ ip2 = ip;
+ do {
+ mp = &message[*ip2 - 1];
+ if ((mp->m_flag & MDELETED) == 0) {
+ dot = mp;
+ goto hitit;
+ }
+ if (*ip2 != 0)
+ ip2++;
+ if (*ip2 == 0)
+ ip2 = msgvec;
+ } while (ip2 != ip);
+ printf("No messages applicable\n");
+ return (1);
+ }
+
+ /*
+ * If this is the first command, select message 1.
+ * Note that this must exist for us to get here at all.
+ */
+
+ if (!sawcom)
+ goto hitit;
+
+ /*
+ * Just find the next good message after dot, no
+ * wraparound.
+ */
+
+ for (mp = dot+1; mp < &message[msgCount]; mp++)
+ if ((mp->m_flag & (MDELETED|MSAVED)) == 0)
+ break;
+ if (mp >= &message[msgCount]) {
+ printf("At EOF\n");
+ return (0);
+ }
+ dot = mp;
+hitit:
+ /*
+ * Print dot.
+ */
+
+ list[0] = dot - &message[0] + 1;
+ list[1] = 0;
+ return (type(list));
+}
+
+/*
+ * Save a message in a file. Mark the message as saved
+ * so we can discard when the user quits.
+ */
+int
+save(char str[])
+{
+
+ return (save1(str, 1, "save", saveignore));
+}
+
+/*
+ * Copy a message to a file without affected its saved-ness
+ */
+int
+copycmd(char str[])
+{
+
+ return (save1(str, 0, "copy", saveignore));
+}
+
+/*
+ * Save/copy the indicated messages at the end of the passed file name.
+ * If mark is true, mark the message "saved."
+ */
+int
+save1(char str[], int mark, const char *cmd, struct ignoretab *ignore)
+{
+ struct message *mp;
+ char *file;
+ const char *disp;
+ int f, *msgvec, *ip;
+ FILE *obuf;
+
+ msgvec = (int *)salloc((msgCount + 2) * sizeof(*msgvec));
+ if ((file = snarf(str, &f)) == NULL)
+ return (1);
+ if (!f) {
+ *msgvec = first(0, MMNORM);
+ if (*msgvec == 0) {
+ printf("No messages to %s.\n", cmd);
+ return (1);
+ }
+ msgvec[1] = 0;
+ }
+ if (f && getmsglist(str, msgvec, 0) < 0)
+ return (1);
+ if ((file = expand(file)) == NULL)
+ return (1);
+ printf("\"%s\" ", file);
+ (void)fflush(stdout);
+ if (access(file, 0) >= 0)
+ disp = "[Appended]";
+ else
+ disp = "[New file]";
+ if ((obuf = Fopen(file, "a")) == NULL) {
+ warn((char *)NULL);
+ return (1);
+ }
+ for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
+ mp = &message[*ip - 1];
+ touch(mp);
+ if (sendmessage(mp, obuf, ignore, NULL) < 0) {
+ warnx("%s", file);
+ (void)Fclose(obuf);
+ return (1);
+ }
+ if (mark)
+ mp->m_flag |= MSAVED;
+ }
+ (void)fflush(obuf);
+ if (ferror(obuf))
+ warn("%s", file);
+ (void)Fclose(obuf);
+ printf("%s\n", disp);
+ return (0);
+}
+
+/*
+ * Write the indicated messages at the end of the passed
+ * file name, minus header and trailing blank line.
+ */
+int
+swrite(char str[])
+{
+
+ return (save1(str, 1, "write", ignoreall));
+}
+
+/*
+ * Snarf the file from the end of the command line and
+ * return a pointer to it. If there is no file attached,
+ * just return NULL. Put a null in front of the file
+ * name so that the message list processing won't see it,
+ * unless the file name is the only thing on the line, in
+ * which case, return 0 in the reference flag variable.
+ */
+
+char *
+snarf(char linebuf[], int *flag)
+{
+ char *cp;
+
+ *flag = 1;
+ cp = strlen(linebuf) + linebuf - 1;
+
+ /*
+ * Strip away trailing blanks.
+ */
+
+ while (cp > linebuf && isspace((unsigned char)*cp))
+ cp--;
+ *++cp = '\0';
+
+ /*
+ * Now search for the beginning of the file name.
+ */
+
+ while (cp > linebuf && !isspace((unsigned char)*cp))
+ cp--;
+ if (*cp == '\0') {
+ printf("No file specified.\n");
+ return (NULL);
+ }
+ if (isspace((unsigned char)*cp))
+ *cp++ = '\0';
+ else
+ *flag = 0;
+ return (cp);
+}
+
+/*
+ * Delete messages.
+ */
+int
+delete(int msgvec[])
+{
+
+ delm(msgvec);
+ return (0);
+}
+
+/*
+ * Delete messages, then type the new dot.
+ */
+int
+deltype(int msgvec[])
+{
+ int list[2];
+ int lastdot;
+
+ lastdot = dot - &message[0] + 1;
+ if (delm(msgvec) >= 0) {
+ list[0] = dot - &message[0] + 1;
+ if (list[0] > lastdot) {
+ touch(dot);
+ list[1] = 0;
+ return (type(list));
+ }
+ printf("At EOF\n");
+ } else
+ printf("No more messages\n");
+ return (0);
+}
+
+/*
+ * Delete the indicated messages.
+ * Set dot to some nice place afterwards.
+ * Internal interface.
+ */
+int
+delm(int *msgvec)
+{
+ struct message *mp;
+ int *ip, last;
+
+ last = 0;
+ for (ip = msgvec; *ip != 0; ip++) {
+ mp = &message[*ip - 1];
+ touch(mp);
+ mp->m_flag |= MDELETED|MTOUCH;
+ mp->m_flag &= ~(MPRESERVE|MSAVED|MBOX);
+ last = *ip;
+ }
+ if (last != 0) {
+ dot = &message[last-1];
+ last = first(0, MDELETED);
+ if (last != 0) {
+ dot = &message[last-1];
+ return (0);
+ }
+ else {
+ dot = &message[0];
+ return (-1);
+ }
+ }
+
+ /*
+ * Following can't happen -- it keeps lint happy
+ */
+
+ return (-1);
+}
+
+/*
+ * Undelete the indicated messages.
+ */
+int
+undelete_messages(int *msgvec)
+{
+ struct message *mp;
+ int *ip;
+
+ for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
+ mp = &message[*ip - 1];
+ touch(mp);
+ dot = mp;
+ mp->m_flag &= ~MDELETED;
+ }
+ return (0);
+}
+
+/*
+ * Interactively dump core on "core"
+ */
+int
+core(void)
+{
+ int pid;
+
+ switch (pid = fork()) {
+ case -1:
+ warn("fork");
+ return (1);
+ case 0:
+ abort();
+ _exit(1);
+ }
+ printf("Okie dokie");
+ (void)fflush(stdout);
+ wait_child(pid);
+ if (WIFSIGNALED(wait_status) && WCOREDUMP(wait_status))
+ printf(" -- Core dumped.\n");
+ else
+ printf(" -- Can't dump core.\n");
+ return (0);
+}
+
+/*
+ * Clobber as many bytes of stack as the user requests.
+ */
+int
+clobber(char **argv)
+{
+ int times;
+
+ if (argv[0] == 0)
+ times = 1;
+ else
+ times = (atoi(argv[0]) + 511) / 512;
+ clob1(times);
+ return (0);
+}
+
+/*
+ * Clobber the stack.
+ */
+void
+clob1(int n)
+{
+ char buf[512];
+ char *cp;
+
+ if (n <= 0)
+ return;
+ for (cp = buf; cp < &buf[512]; *cp++ = 0xFF)
+ ;
+ clob1(n - 1);
+}
+
+/*
+ * Add the given header fields to the retained list.
+ * If no arguments, print the current list of retained fields.
+ */
+int
+retfield(char *list[])
+{
+
+ return (ignore1(list, ignore + 1, "retained"));
+}
+
+/*
+ * Add the given header fields to the ignored list.
+ * If no arguments, print the current list of ignored fields.
+ */
+int
+igfield(char *list[])
+{
+
+ return (ignore1(list, ignore, "ignored"));
+}
+
+int
+saveretfield(char *list[])
+{
+
+ return (ignore1(list, saveignore + 1, "retained"));
+}
+
+int
+saveigfield(char *list[])
+{
+
+ return (ignore1(list, saveignore, "ignored"));
+}
+
+int
+ignore1(char *list[], struct ignoretab *tab, const char *which)
+{
+ char field[LINESIZE];
+ int h;
+ struct ignore *igp;
+ char **ap;
+
+ if (*list == NULL)
+ return (igshow(tab, which));
+ for (ap = list; *ap != 0; ap++) {
+ istrncpy(field, *ap, sizeof(field));
+ if (member(field, tab))
+ continue;
+ h = hash(field);
+ igp = calloc(1, sizeof(struct ignore));
+ igp->i_field = calloc((unsigned)strlen(field) + 1,
+ sizeof(char));
+ strcpy(igp->i_field, field);
+ igp->i_link = tab->i_head[h];
+ tab->i_head[h] = igp;
+ tab->i_count++;
+ }
+ return (0);
+}
+
+/*
+ * Print out all currently retained fields.
+ */
+int
+igshow(struct ignoretab *tab, const char *which)
+{
+ int h;
+ struct ignore *igp;
+ char **ap, **ring;
+
+ if (tab->i_count == 0) {
+ printf("No fields currently being %s.\n", which);
+ return (0);
+ }
+ ring = (char **)salloc((tab->i_count + 1) * sizeof(char *));
+ ap = ring;
+ for (h = 0; h < HSHSIZE; h++)
+ for (igp = tab->i_head[h]; igp != NULL; igp = igp->i_link)
+ *ap++ = igp->i_field;
+ *ap = 0;
+ qsort(ring, tab->i_count, sizeof(char *), igcomp);
+ for (ap = ring; *ap != 0; ap++)
+ printf("%s\n", *ap);
+ return (0);
+}
+
+/*
+ * Compare two names for sorting ignored field list.
+ */
+int
+igcomp(const void *l, const void *r)
+{
+
+ return (strcmp(*(const char **)l, *(const char **)r));
+}
diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c
new file mode 100644
index 0000000..9308ad3
--- /dev/null
+++ b/usr.bin/mail/cmd3.c
@@ -0,0 +1,713 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Still more user commands.
+ */
+
+/*
+ * Process a shell escape by saving signals, ignoring signals,
+ * and forking a sh -c
+ */
+int
+shell(char *str)
+{
+ sig_t sigint = signal(SIGINT, SIG_IGN);
+ char *sh;
+ char cmd[BUFSIZ];
+
+ if (strlcpy(cmd, str, sizeof(cmd)) >= sizeof(cmd))
+ return (1);
+ if (bangexp(cmd, sizeof(cmd)) < 0)
+ return (1);
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+ (void)run_command(sh, 0, -1, -1, "-c", cmd, NULL);
+ (void)signal(SIGINT, sigint);
+ printf("!\n");
+ return (0);
+}
+
+/*
+ * Fork an interactive shell.
+ */
+/*ARGSUSED*/
+int
+dosh(char *str __unused)
+{
+ sig_t sigint = signal(SIGINT, SIG_IGN);
+ char *sh;
+
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+ (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL);
+ (void)signal(SIGINT, sigint);
+ printf("\n");
+ return (0);
+}
+
+/*
+ * Expand the shell escape by expanding unescaped !'s into the
+ * last issued command where possible.
+ */
+int
+bangexp(char *str, size_t strsize)
+{
+ char bangbuf[BUFSIZ];
+ static char lastbang[BUFSIZ];
+ char *cp, *cp2;
+ int n, changed = 0;
+
+ cp = str;
+ cp2 = bangbuf;
+ n = sizeof(bangbuf);
+ while (*cp != '\0') {
+ if (*cp == '!') {
+ if (n < strlen(lastbang)) {
+overf:
+ printf("Command buffer overflow\n");
+ return (-1);
+ }
+ changed++;
+ if (strlcpy(cp2, lastbang, sizeof(bangbuf) - (cp2 - bangbuf))
+ >= sizeof(bangbuf) - (cp2 - bangbuf))
+ goto overf;
+ cp2 += strlen(lastbang);
+ n -= strlen(lastbang);
+ cp++;
+ continue;
+ }
+ if (*cp == '\\' && cp[1] == '!') {
+ if (--n <= 1)
+ goto overf;
+ *cp2++ = '!';
+ cp += 2;
+ changed++;
+ }
+ if (--n <= 1)
+ goto overf;
+ *cp2++ = *cp++;
+ }
+ *cp2 = 0;
+ if (changed) {
+ printf("!%s\n", bangbuf);
+ (void)fflush(stdout);
+ }
+ if (strlcpy(str, bangbuf, strsize) >= strsize)
+ goto overf;
+ if (strlcpy(lastbang, bangbuf, sizeof(lastbang)) >= sizeof(lastbang))
+ goto overf;
+ return (0);
+}
+
+/*
+ * Print out a nice help message from some file or another.
+ */
+
+int
+help(void)
+{
+ int c;
+ FILE *f;
+
+ if ((f = Fopen(_PATH_HELP, "r")) == NULL) {
+ warn("%s", _PATH_HELP);
+ return (1);
+ }
+ while ((c = getc(f)) != EOF)
+ putchar(c);
+ (void)Fclose(f);
+ return (0);
+}
+
+/*
+ * Change user's working directory.
+ */
+int
+schdir(char **arglist)
+{
+ char *cp;
+
+ if (*arglist == NULL) {
+ if (homedir == NULL)
+ return (1);
+ cp = homedir;
+ } else
+ if ((cp = expand(*arglist)) == NULL)
+ return (1);
+ if (chdir(cp) < 0) {
+ warn("%s", cp);
+ return (1);
+ }
+ return (0);
+}
+
+int
+respond(int *msgvec)
+{
+ if (value("Replyall") == NULL && value("flipr") == NULL)
+ return (dorespond(msgvec));
+ else
+ return (doRespond(msgvec));
+}
+
+/*
+ * Reply to a list of messages. Extract each name from the
+ * message header and send them off to mail1()
+ */
+int
+dorespond(int *msgvec)
+{
+ struct message *mp;
+ char *cp, *rcv, *replyto;
+ char **ap;
+ struct name *np;
+ struct header head;
+
+ if (msgvec[1] != 0) {
+ printf("Sorry, can't reply to multiple messages at once\n");
+ return (1);
+ }
+ mp = &message[msgvec[0] - 1];
+ touch(mp);
+ dot = mp;
+ if ((rcv = skin(hfield("from", mp))) == NULL)
+ rcv = skin(nameof(mp, 1));
+ if ((replyto = skin(hfield("reply-to", mp))) != NULL)
+ np = extract(replyto, GTO);
+ else if ((cp = skin(hfield("to", mp))) != NULL)
+ np = extract(cp, GTO);
+ else
+ np = NULL;
+ np = elide(np);
+ /*
+ * Delete my name from the reply list,
+ * and with it, all my alternate names.
+ */
+ np = delname(np, myname);
+ if (altnames)
+ for (ap = altnames; *ap != NULL; ap++)
+ np = delname(np, *ap);
+ if (np != NULL && replyto == NULL)
+ np = cat(np, extract(rcv, GTO));
+ else if (np == NULL) {
+ if (replyto != NULL)
+ printf("Empty reply-to field -- replying to author\n");
+ np = extract(rcv, GTO);
+ }
+ head.h_to = np;
+ if ((head.h_subject = hfield("subject", mp)) == NULL)
+ head.h_subject = hfield("subj", mp);
+ head.h_subject = reedit(head.h_subject);
+ if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) {
+ np = elide(extract(cp, GCC));
+ np = delname(np, myname);
+ if (altnames != 0)
+ for (ap = altnames; *ap != NULL; ap++)
+ np = delname(np, *ap);
+ head.h_cc = np;
+ } else
+ head.h_cc = NULL;
+ head.h_bcc = NULL;
+ head.h_smopts = NULL;
+ head.h_replyto = value("REPLYTO");
+ head.h_inreplyto = skin(hfield("message-id", mp));
+ mail1(&head, 1);
+ return (0);
+}
+
+/*
+ * Modify the subject we are replying to to begin with Re: if
+ * it does not already.
+ */
+char *
+reedit(char *subj)
+{
+ char *newsubj;
+
+ if (subj == NULL)
+ return (NULL);
+ if ((subj[0] == 'r' || subj[0] == 'R') &&
+ (subj[1] == 'e' || subj[1] == 'E') &&
+ subj[2] == ':')
+ return (subj);
+ newsubj = salloc(strlen(subj) + 5);
+ sprintf(newsubj, "Re: %s", subj);
+ return (newsubj);
+}
+
+/*
+ * Preserve the named messages, so that they will be sent
+ * back to the system mailbox.
+ */
+int
+preserve(int *msgvec)
+{
+ int *ip, mesg;
+ struct message *mp;
+
+ if (edit) {
+ printf("Cannot \"preserve\" in edit mode\n");
+ return (1);
+ }
+ for (ip = msgvec; *ip != 0; ip++) {
+ mesg = *ip;
+ mp = &message[mesg-1];
+ mp->m_flag |= MPRESERVE;
+ mp->m_flag &= ~MBOX;
+ dot = mp;
+ }
+ return (0);
+}
+
+/*
+ * Mark all given messages as unread.
+ */
+int
+unread(int msgvec[])
+{
+ int *ip;
+
+ for (ip = msgvec; *ip != 0; ip++) {
+ dot = &message[*ip-1];
+ dot->m_flag &= ~(MREAD|MTOUCH);
+ dot->m_flag |= MSTATUS;
+ }
+ return (0);
+}
+
+/*
+ * Print the size of each message.
+ */
+int
+messize(int *msgvec)
+{
+ struct message *mp;
+ int *ip, mesg;
+
+ for (ip = msgvec; *ip != 0; ip++) {
+ mesg = *ip;
+ mp = &message[mesg-1];
+ printf("%d: %ld/%ld\n", mesg, mp->m_lines, mp->m_size);
+ }
+ return (0);
+}
+
+/*
+ * Quit quickly. If we are sourcing, just pop the input level
+ * by returning an error.
+ */
+int
+rexit(int e __unused)
+{
+ if (sourcing)
+ return (1);
+ exit(0);
+ /*NOTREACHED*/
+}
+
+/*
+ * Set or display a variable value. Syntax is similar to that
+ * of csh.
+ */
+int
+set(char **arglist)
+{
+ struct var *vp;
+ char *cp, *cp2;
+ char varbuf[BUFSIZ], **ap, **p;
+ int errs, h, s;
+
+ if (*arglist == NULL) {
+ for (h = 0, s = 1; h < HSHSIZE; h++)
+ for (vp = variables[h]; vp != NULL; vp = vp->v_link)
+ s++;
+ ap = (char **)salloc(s * sizeof(*ap));
+ for (h = 0, p = ap; h < HSHSIZE; h++)
+ for (vp = variables[h]; vp != NULL; vp = vp->v_link)
+ *p++ = vp->v_name;
+ *p = NULL;
+ sort(ap);
+ for (p = ap; *p != NULL; p++)
+ printf("%s\t%s\n", *p, value(*p));
+ return (0);
+ }
+ errs = 0;
+ for (ap = arglist; *ap != NULL; ap++) {
+ cp = *ap;
+ cp2 = varbuf;
+ while (cp2 < varbuf + sizeof(varbuf) - 1 && *cp != '=' && *cp != '\0')
+ *cp2++ = *cp++;
+ *cp2 = '\0';
+ if (*cp == '\0')
+ cp = "";
+ else
+ cp++;
+ if (equal(varbuf, "")) {
+ printf("Non-null variable name required\n");
+ errs++;
+ continue;
+ }
+ assign(varbuf, cp);
+ }
+ return (errs);
+}
+
+/*
+ * Unset a bunch of variable values.
+ */
+int
+unset(char **arglist)
+{
+ struct var *vp, *vp2;
+ int errs, h;
+ char **ap;
+
+ errs = 0;
+ for (ap = arglist; *ap != NULL; ap++) {
+ if ((vp2 = lookup(*ap)) == NULL) {
+ if (getenv(*ap))
+ unsetenv(*ap);
+ else if (!sourcing) {
+ printf("\"%s\": undefined variable\n", *ap);
+ errs++;
+ }
+ continue;
+ }
+ h = hash(*ap);
+ if (vp2 == variables[h]) {
+ variables[h] = variables[h]->v_link;
+ vfree(vp2->v_name);
+ vfree(vp2->v_value);
+ (void)free(vp2);
+ continue;
+ }
+ for (vp = variables[h]; vp->v_link != vp2; vp = vp->v_link)
+ ;
+ vp->v_link = vp2->v_link;
+ vfree(vp2->v_name);
+ vfree(vp2->v_value);
+ (void)free(vp2);
+ }
+ return (errs);
+}
+
+/*
+ * Put add users to a group.
+ */
+int
+group(char **argv)
+{
+ struct grouphead *gh;
+ struct group *gp;
+ char **ap, *gname, **p;
+ int h, s;
+
+ if (*argv == NULL) {
+ for (h = 0, s = 1; h < HSHSIZE; h++)
+ for (gh = groups[h]; gh != NULL; gh = gh->g_link)
+ s++;
+ ap = (char **)salloc(s * sizeof(*ap));
+ for (h = 0, p = ap; h < HSHSIZE; h++)
+ for (gh = groups[h]; gh != NULL; gh = gh->g_link)
+ *p++ = gh->g_name;
+ *p = NULL;
+ sort(ap);
+ for (p = ap; *p != NULL; p++)
+ printgroup(*p);
+ return (0);
+ }
+ if (argv[1] == NULL) {
+ printgroup(*argv);
+ return (0);
+ }
+ gname = *argv;
+ h = hash(gname);
+ if ((gh = findgroup(gname)) == NULL) {
+ gh = calloc(sizeof(*gh), 1);
+ gh->g_name = vcopy(gname);
+ gh->g_list = NULL;
+ gh->g_link = groups[h];
+ groups[h] = gh;
+ }
+
+ /*
+ * Insert names from the command list into the group.
+ * Who cares if there are duplicates? They get tossed
+ * later anyway.
+ */
+
+ for (ap = argv+1; *ap != NULL; ap++) {
+ gp = calloc(sizeof(*gp), 1);
+ gp->ge_name = vcopy(*ap);
+ gp->ge_link = gh->g_list;
+ gh->g_list = gp;
+ }
+ return (0);
+}
+
+/*
+ * Sort the passed string vecotor into ascending dictionary
+ * order.
+ */
+void
+sort(char **list)
+{
+ char **ap;
+
+ for (ap = list; *ap != NULL; ap++)
+ ;
+ if (ap-list < 2)
+ return;
+ qsort(list, ap-list, sizeof(*list), diction);
+}
+
+/*
+ * Do a dictionary order comparison of the arguments from
+ * qsort.
+ */
+int
+diction(const void *a, const void *b)
+{
+ return (strcmp(*(const char **)a, *(const char **)b));
+}
+
+/*
+ * The do nothing command for comments.
+ */
+
+/*ARGSUSED*/
+int
+null(int e __unused)
+{
+ return (0);
+}
+
+/*
+ * Change to another file. With no argument, print information about
+ * the current file.
+ */
+int
+file(char **argv)
+{
+
+ if (argv[0] == NULL) {
+ newfileinfo(0);
+ return (0);
+ }
+ if (setfile(*argv) < 0)
+ return (1);
+ announce();
+ return (0);
+}
+
+/*
+ * Expand file names like echo
+ */
+int
+echo(char **argv)
+{
+ char **ap, *cp;
+
+ for (ap = argv; *ap != NULL; ap++) {
+ cp = *ap;
+ if ((cp = expand(cp)) != NULL) {
+ if (ap != argv)
+ printf(" ");
+ printf("%s", cp);
+ }
+ }
+ printf("\n");
+ return (0);
+}
+
+int
+Respond(int *msgvec)
+{
+ if (value("Replyall") == NULL && value("flipr") == NULL)
+ return (doRespond(msgvec));
+ else
+ return (dorespond(msgvec));
+}
+
+/*
+ * Reply to a series of messages by simply mailing to the senders
+ * and not messing around with the To: and Cc: lists as in normal
+ * reply.
+ */
+int
+doRespond(int msgvec[])
+{
+ struct header head;
+ struct message *mp;
+ int *ap;
+ char *cp, *mid;
+
+ head.h_to = NULL;
+ for (ap = msgvec; *ap != 0; ap++) {
+ mp = &message[*ap - 1];
+ touch(mp);
+ dot = mp;
+ if ((cp = skin(hfield("from", mp))) == NULL)
+ cp = skin(nameof(mp, 2));
+ head.h_to = cat(head.h_to, extract(cp, GTO));
+ mid = skin(hfield("message-id", mp));
+ }
+ if (head.h_to == NULL)
+ return (0);
+ mp = &message[msgvec[0] - 1];
+ if ((head.h_subject = hfield("subject", mp)) == NULL)
+ head.h_subject = hfield("subj", mp);
+ head.h_subject = reedit(head.h_subject);
+ head.h_cc = NULL;
+ head.h_bcc = NULL;
+ head.h_smopts = NULL;
+ head.h_replyto = value("REPLYTO");
+ head.h_inreplyto = mid;
+ mail1(&head, 1);
+ return (0);
+}
+
+/*
+ * Conditional commands. These allow one to parameterize one's
+ * .mailrc and do some things if sending, others if receiving.
+ */
+int
+ifcmd(char **argv)
+{
+ char *cp;
+
+ if (cond != CANY) {
+ printf("Illegal nested \"if\"\n");
+ return (1);
+ }
+ cond = CANY;
+ cp = argv[0];
+ switch (*cp) {
+ case 'r': case 'R':
+ cond = CRCV;
+ break;
+
+ case 's': case 'S':
+ cond = CSEND;
+ break;
+
+ default:
+ printf("Unrecognized if-keyword: \"%s\"\n", cp);
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Implement 'else'. This is pretty simple -- we just
+ * flip over the conditional flag.
+ */
+int
+elsecmd(void)
+{
+
+ switch (cond) {
+ case CANY:
+ printf("\"Else\" without matching \"if\"\n");
+ return (1);
+
+ case CSEND:
+ cond = CRCV;
+ break;
+
+ case CRCV:
+ cond = CSEND;
+ break;
+
+ default:
+ printf("Mail's idea of conditions is screwed up\n");
+ cond = CANY;
+ break;
+ }
+ return (0);
+}
+
+/*
+ * End of if statement. Just set cond back to anything.
+ */
+int
+endifcmd(void)
+{
+
+ if (cond == CANY) {
+ printf("\"Endif\" without matching \"if\"\n");
+ return (1);
+ }
+ cond = CANY;
+ return (0);
+}
+
+/*
+ * Set the list of alternate names.
+ */
+int
+alternates(char **namelist)
+{
+ int c;
+ char **ap, **ap2, *cp;
+
+ c = argcount(namelist) + 1;
+ if (c == 1) {
+ if (altnames == 0)
+ return (0);
+ for (ap = altnames; *ap != NULL; ap++)
+ printf("%s ", *ap);
+ printf("\n");
+ return (0);
+ }
+ if (altnames != 0)
+ (void)free(altnames);
+ altnames = calloc((unsigned)c, sizeof(char *));
+ for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) {
+ cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char));
+ strcpy(cp, *ap);
+ *ap2 = cp;
+ }
+ *ap2 = 0;
+ return (0);
+}
diff --git a/usr.bin/mail/cmdtab.c b/usr.bin/mail/cmdtab.c
new file mode 100644
index 0000000..eb19bc4
--- /dev/null
+++ b/usr.bin/mail/cmdtab.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "def.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Define all of the command names and bindings.
+ */
+
+const struct cmd cmdtab[] = {
+ /* msgmask msgflag */
+ /* command function argtype result & mask */
+ /* ------- -------- ------- ------ ------- */
+ { "next", next, NDMLIST, 0, MMNDEL },
+ { "alias", group, M|RAWLIST, 0, 1000 },
+ { "print", type, MSGLIST, 0, MMNDEL },
+ { "type", type, MSGLIST, 0, MMNDEL },
+ { "Type", Type, MSGLIST, 0, MMNDEL },
+ { "Print", Type, MSGLIST, 0, MMNDEL },
+ { "visual", visual, I|MSGLIST, 0, MMNORM },
+ { "top", top, MSGLIST, 0, MMNDEL },
+ { "touch", stouch, W|MSGLIST, 0, MMNDEL },
+ { "preserve", preserve, W|MSGLIST, 0, MMNDEL },
+ { "delete", delete, W|P|MSGLIST, 0, MMNDEL },
+ { "dp", deltype, W|MSGLIST, 0, MMNDEL },
+ { "dt", deltype, W|MSGLIST, 0, MMNDEL },
+ { "undelete", undelete_messages, P|MSGLIST, MDELETED,MMNDEL },
+ { "unset", unset, M|RAWLIST, 1, 1000 },
+ { "mail", sendmail, R|M|I|STRLIST, 0, 0 },
+ { "mbox", mboxit, W|MSGLIST, 0, 0 },
+ { "more", more, MSGLIST, 0, MMNDEL },
+ { "page", more, MSGLIST, 0, MMNDEL },
+ { "More", More, MSGLIST, 0, MMNDEL },
+ { "Page", More, MSGLIST, 0, MMNDEL },
+ { "unread", unread, MSGLIST, 0, MMNDEL },
+ { "!", shell, I|STRLIST, 0, 0 },
+ { "copy", copycmd, M|STRLIST, 0, 0 },
+ { "chdir", schdir, M|RAWLIST, 0, 1 },
+ { "cd", schdir, M|RAWLIST, 0, 1 },
+ { "save", save, STRLIST, 0, 0 },
+ { "source", source, M|RAWLIST, 1, 1 },
+ { "set", set, M|RAWLIST, 0, 1000 },
+ { "shell", dosh, I|NOLIST, 0, 0 },
+ { "version", pversion, M|NOLIST, 0, 0 },
+ { "group", group, M|RAWLIST, 0, 1000 },
+ { "write", swrite, STRLIST, 0, 0 },
+ { "from", from, MSGLIST, 0, MMNORM },
+ { "file", file, T|M|RAWLIST, 0, 1 },
+ { "folder", file, T|M|RAWLIST, 0, 1 },
+ { "folders", folders, T|M|NOLIST, 0, 0 },
+ { "?", help, M|NOLIST, 0, 0 },
+ { "z", scroll, M|STRLIST, 0, 0 },
+ { "headers", headers, MSGLIST, 0, MMNDEL },
+ { "help", help, M|NOLIST, 0, 0 },
+ { "=", pdot, NOLIST, 0, 0 },
+ { "Reply", Respond, R|I|MSGLIST, 0, MMNDEL },
+ { "Respond", Respond, R|I|MSGLIST, 0, MMNDEL },
+ { "reply", respond, R|I|MSGLIST, 0, MMNDEL },
+ { "respond", respond, R|I|MSGLIST, 0, MMNDEL },
+ { "edit", editor, I|MSGLIST, 0, MMNORM },
+ { "echo", echo, M|RAWLIST, 0, 1000 },
+ { "quit", quitcmd, NOLIST, 0, 0 },
+ { "list", pcmdlist, M|NOLIST, 0, 0 },
+ { "xit", rexit, M|NOLIST, 0, 0 },
+ { "exit", rexit, M|NOLIST, 0, 0 },
+ { "size", messize, MSGLIST, 0, MMNDEL },
+ { "hold", preserve, W|MSGLIST, 0, MMNDEL },
+ { "if", ifcmd, F|M|RAWLIST, 1, 1 },
+ { "else", elsecmd, F|M|RAWLIST, 0, 0 },
+ { "endif", endifcmd, F|M|RAWLIST, 0, 0 },
+ { "alternates", alternates, M|RAWLIST, 0, 1000 },
+ { "ignore", igfield, M|RAWLIST, 0, 1000 },
+ { "discard", igfield, M|RAWLIST, 0, 1000 },
+ { "retain", retfield, M|RAWLIST, 0, 1000 },
+ { "saveignore", saveigfield, M|RAWLIST, 0, 1000 },
+ { "savediscard",saveigfield, M|RAWLIST, 0, 1000 },
+ { "saveretain", saveretfield, M|RAWLIST, 0, 1000 },
+/* { "Header", Header, STRLIST, 0, 1000 }, */
+ { "core", core, M|NOLIST, 0, 0 },
+ { "#", null, M|NOLIST, 0, 0 },
+ { "clobber", clobber, M|RAWLIST, 0, 1 },
+ { "inc", inc, T|NOLIST, 0, 0 },
+ { 0, 0, 0, 0, 0 }
+};
diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c
new file mode 100644
index 0000000..ef72e9f
--- /dev/null
+++ b/usr.bin/mail/collect.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Mail -- a mail program
+ *
+ * Collect input from standard input, handling
+ * ~ escapes.
+ */
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Read a message from standard output and return a read file to it
+ * or NULL on error.
+ */
+
+/*
+ * The following hokiness with global variables is so that on
+ * receipt of an interrupt signal, the partial message can be salted
+ * away on dead.letter.
+ */
+
+static sig_t saveint; /* Previous SIGINT value */
+static sig_t savehup; /* Previous SIGHUP value */
+static sig_t savetstp; /* Previous SIGTSTP value */
+static sig_t savettou; /* Previous SIGTTOU value */
+static sig_t savettin; /* Previous SIGTTIN value */
+static FILE *collf; /* File for saving away */
+static int hadintr; /* Have seen one SIGINT so far */
+
+static jmp_buf colljmp; /* To get back to work */
+static int colljmp_p; /* whether to long jump */
+static jmp_buf collabort; /* To end collection with error */
+
+FILE *
+collect(struct header *hp, int printheaders)
+{
+ FILE *fbuf;
+ int lc, cc, escape, eofcount, fd, c, t;
+ char linebuf[LINESIZE], tempname[PATHSIZE], *cp, getsub;
+ sigset_t nset;
+ int longline, lastlong, rc; /* So we don't make 2 or more lines
+ out of a long input line. */
+
+ collf = NULL;
+ /*
+ * Start catching signals from here, but we're still die on interrupts
+ * until we're in the main loop.
+ */
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGINT);
+ (void)sigaddset(&nset, SIGHUP);
+ (void)sigprocmask(SIG_BLOCK, &nset, NULL);
+ if ((saveint = signal(SIGINT, SIG_IGN)) != SIG_IGN)
+ (void)signal(SIGINT, collint);
+ if ((savehup = signal(SIGHUP, SIG_IGN)) != SIG_IGN)
+ (void)signal(SIGHUP, collhup);
+ savetstp = signal(SIGTSTP, collstop);
+ savettou = signal(SIGTTOU, collstop);
+ savettin = signal(SIGTTIN, collstop);
+ if (setjmp(collabort) || setjmp(colljmp)) {
+ (void)rm(tempname);
+ goto err;
+ }
+ (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);
+
+ noreset++;
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.RsXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (collf = Fdopen(fd, "w+")) == NULL) {
+ warn("%s", tempname);
+ goto err;
+ }
+ (void)rm(tempname);
+
+ /*
+ * If we are going to prompt for a subject,
+ * refrain from printing a newline after
+ * the headers (since some people mind).
+ */
+ t = GTO|GSUBJECT|GCC|GNL;
+ getsub = 0;
+ if (hp->h_subject == NULL && value("interactive") != NULL &&
+ (value("ask") != NULL || value("asksub") != NULL))
+ t &= ~GNL, getsub++;
+ if (printheaders) {
+ puthead(hp, stdout, t);
+ (void)fflush(stdout);
+ }
+ if ((cp = value("escape")) != NULL)
+ escape = *cp;
+ else
+ escape = ESCAPE;
+ eofcount = 0;
+ hadintr = 0;
+ lastlong = 0;
+ longline = 0;
+
+ if (!setjmp(colljmp)) {
+ if (getsub)
+ grabh(hp, GSUBJECT);
+ } else {
+ /*
+ * Come here for printing the after-signal message.
+ * Duplicate messages won't be printed because
+ * the write is aborted if we get a SIGTTOU.
+ */
+cont:
+ if (hadintr) {
+ (void)fflush(stdout);
+ fprintf(stderr,
+ "\n(Interrupt -- one more to kill letter)\n");
+ } else {
+ printf("(continue)\n");
+ (void)fflush(stdout);
+ }
+ }
+ for (;;) {
+ colljmp_p = 1;
+ c = readline(stdin, linebuf, LINESIZE);
+ colljmp_p = 0;
+ if (c < 0) {
+ if (value("interactive") != NULL &&
+ value("ignoreeof") != NULL && ++eofcount < 25) {
+ printf("Use \".\" to terminate letter\n");
+ continue;
+ }
+ break;
+ }
+ lastlong = longline;
+ longline = c == LINESIZE - 1;
+ eofcount = 0;
+ hadintr = 0;
+ if (linebuf[0] == '.' && linebuf[1] == '\0' &&
+ value("interactive") != NULL && !lastlong &&
+ (value("dot") != NULL || value("ignoreeof") != NULL))
+ break;
+ if (linebuf[0] != escape || value("interactive") == NULL ||
+ lastlong) {
+ if (putline(collf, linebuf, !longline) < 0)
+ goto err;
+ continue;
+ }
+ c = linebuf[1];
+ switch (c) {
+ default:
+ /*
+ * On double escape, just send the single one.
+ * Otherwise, it's an error.
+ */
+ if (c == escape) {
+ if (putline(collf, &linebuf[1], !longline) < 0)
+ goto err;
+ else
+ break;
+ }
+ printf("Unknown tilde escape.\n");
+ break;
+ case 'C':
+ /*
+ * Dump core.
+ */
+ core();
+ break;
+ case '!':
+ /*
+ * Shell escape, send the balance of the
+ * line to sh -c.
+ */
+ shell(&linebuf[2]);
+ break;
+ case ':':
+ case '_':
+ /*
+ * Escape to command mode, but be nice!
+ */
+ execute(&linebuf[2], 1);
+ goto cont;
+ case '.':
+ /*
+ * Simulate end of file on input.
+ */
+ goto out;
+ case 'q':
+ /*
+ * Force a quit of sending mail.
+ * Act like an interrupt happened.
+ */
+ hadintr++;
+ collint(SIGINT);
+ exit(1);
+ case 'x':
+ /*
+ * Exit, do not save in dead.letter.
+ */
+ goto err;
+ case 'h':
+ /*
+ * Grab a bunch of headers.
+ */
+ grabh(hp, GTO|GSUBJECT|GCC|GBCC);
+ goto cont;
+ case 't':
+ /*
+ * Add to the To list.
+ */
+ hp->h_to = cat(hp->h_to, extract(&linebuf[2], GTO));
+ break;
+ case 's':
+ /*
+ * Set the Subject line.
+ */
+ cp = &linebuf[2];
+ while (isspace((unsigned char)*cp))
+ cp++;
+ hp->h_subject = savestr(cp);
+ break;
+ case 'R':
+ /*
+ * Set the Reply-To line.
+ */
+ cp = &linebuf[2];
+ while (isspace((unsigned char)*cp))
+ cp++;
+ hp->h_replyto = savestr(cp);
+ break;
+ case 'c':
+ /*
+ * Add to the CC list.
+ */
+ hp->h_cc = cat(hp->h_cc, extract(&linebuf[2], GCC));
+ break;
+ case 'b':
+ /*
+ * Add to the BCC list.
+ */
+ hp->h_bcc = cat(hp->h_bcc, extract(&linebuf[2], GBCC));
+ break;
+ case 'i':
+ case 'A':
+ case 'a':
+ /*
+ * Insert named variable in message.
+ */
+ switch(c) {
+ case 'i':
+ cp = &linebuf[2];
+ while(isspace((unsigned char)*cp))
+ cp++;
+ break;
+ case 'a':
+ cp = "sign";
+ break;
+ case 'A':
+ cp = "Sign";
+ break;
+ default:
+ goto err;
+ }
+
+ if(*cp != '\0' && (cp = value(cp)) != NULL) {
+ printf("%s\n", cp);
+ if(putline(collf, cp, 1) < 0)
+ goto err;
+ }
+
+ break;
+ case 'd':
+ /*
+ * Read in the dead letter file.
+ */
+ if (strlcpy(linebuf + 2, getdeadletter(),
+ sizeof(linebuf) - 2)
+ >= sizeof(linebuf) - 2) {
+ printf("Line buffer overflow\n");
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'r':
+ case '<':
+ /*
+ * Invoke a file:
+ * Search for the file name,
+ * then open it and copy the contents to collf.
+ */
+ cp = &linebuf[2];
+ while (isspace((unsigned char)*cp))
+ cp++;
+ if (*cp == '\0') {
+ printf("Interpolate what file?\n");
+ break;
+ }
+ cp = expand(cp);
+ if (cp == NULL)
+ break;
+ if (*cp == '!') {
+ /*
+ * Insert stdout of command.
+ */
+ char *sh;
+ int nullfd, tempfd, rc;
+ char tempname2[PATHSIZE];
+
+ if ((nullfd = open("/dev/null", O_RDONLY, 0))
+ == -1) {
+ warn("/dev/null");
+ break;
+ }
+
+ (void)snprintf(tempname2, sizeof(tempname2),
+ "%s/mail.ReXXXXXXXXXX", tmpdir);
+ if ((tempfd = mkstemp(tempname2)) == -1 ||
+ (fbuf = Fdopen(tempfd, "w+")) == NULL) {
+ warn("%s", tempname2);
+ break;
+ }
+ (void)unlink(tempname2);
+
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+
+ rc = run_command(sh, 0, nullfd, fileno(fbuf),
+ "-c", cp+1, NULL);
+
+ close(nullfd);
+
+ if (rc < 0) {
+ (void)Fclose(fbuf);
+ break;
+ }
+
+ if (fsize(fbuf) == 0) {
+ fprintf(stderr,
+ "No bytes from command \"%s\"\n",
+ cp+1);
+ (void)Fclose(fbuf);
+ break;
+ }
+
+ rewind(fbuf);
+ } else if (isdir(cp)) {
+ printf("%s: Directory\n", cp);
+ break;
+ } else if ((fbuf = Fopen(cp, "r")) == NULL) {
+ warn("%s", cp);
+ break;
+ }
+ printf("\"%s\" ", cp);
+ (void)fflush(stdout);
+ lc = 0;
+ cc = 0;
+ while ((rc = readline(fbuf, linebuf, LINESIZE)) >= 0) {
+ if (rc != LINESIZE - 1)
+ lc++;
+ if ((t = putline(collf, linebuf,
+ rc != LINESIZE - 1)) < 0) {
+ (void)Fclose(fbuf);
+ goto err;
+ }
+ cc += t;
+ }
+ (void)Fclose(fbuf);
+ printf("%d/%d\n", lc, cc);
+ break;
+ case 'w':
+ /*
+ * Write the message on a file.
+ */
+ cp = &linebuf[2];
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ if (*cp == '\0') {
+ fprintf(stderr, "Write what file!?\n");
+ break;
+ }
+ if ((cp = expand(cp)) == NULL)
+ break;
+ rewind(collf);
+ exwrite(cp, collf, 1);
+ break;
+ case 'm':
+ case 'M':
+ case 'f':
+ case 'F':
+ /*
+ * Interpolate the named messages, if we
+ * are in receiving mail mode. Does the
+ * standard list processing garbage.
+ * If ~f is given, we don't shift over.
+ */
+ if (forward(linebuf + 2, collf, tempname, c) < 0)
+ goto err;
+ goto cont;
+ case '?':
+ if ((fbuf = Fopen(_PATH_TILDE, "r")) == NULL) {
+ warn("%s", _PATH_TILDE);
+ break;
+ }
+ while ((t = getc(fbuf)) != EOF)
+ (void)putchar(t);
+ (void)Fclose(fbuf);
+ break;
+ case 'p':
+ /*
+ * Print out the current state of the
+ * message without altering anything.
+ */
+ rewind(collf);
+ printf("-------\nMessage contains:\n");
+ puthead(hp, stdout, GTO|GSUBJECT|GCC|GBCC|GNL);
+ while ((t = getc(collf)) != EOF)
+ (void)putchar(t);
+ goto cont;
+ case '|':
+ /*
+ * Pipe message through command.
+ * Collect output as new message.
+ */
+ rewind(collf);
+ mespipe(collf, &linebuf[2]);
+ goto cont;
+ case 'v':
+ case 'e':
+ /*
+ * Edit the current message.
+ * 'e' means to use EDITOR
+ * 'v' means to use VISUAL
+ */
+ rewind(collf);
+ mesedit(collf, c);
+ goto cont;
+ }
+ }
+ goto out;
+err:
+ if (collf != NULL) {
+ (void)Fclose(collf);
+ collf = NULL;
+ }
+out:
+ if (collf != NULL)
+ rewind(collf);
+ noreset--;
+ (void)sigprocmask(SIG_BLOCK, &nset, NULL);
+ (void)signal(SIGINT, saveint);
+ (void)signal(SIGHUP, savehup);
+ (void)signal(SIGTSTP, savetstp);
+ (void)signal(SIGTTOU, savettou);
+ (void)signal(SIGTTIN, savettin);
+ (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);
+ return (collf);
+}
+
+/*
+ * Write a file, ex-like if f set.
+ */
+int
+exwrite(char name[], FILE *fp, int f)
+{
+ FILE *of;
+ int c, lc;
+ long cc;
+ struct stat junk;
+
+ if (f) {
+ printf("\"%s\" ", name);
+ (void)fflush(stdout);
+ }
+ if (stat(name, &junk) >= 0 && S_ISREG(junk.st_mode)) {
+ if (!f)
+ fprintf(stderr, "%s: ", name);
+ fprintf(stderr, "File exists\n");
+ return (-1);
+ }
+ if ((of = Fopen(name, "w")) == NULL) {
+ warn((char *)NULL);
+ return (-1);
+ }
+ lc = 0;
+ cc = 0;
+ while ((c = getc(fp)) != EOF) {
+ cc++;
+ if (c == '\n')
+ lc++;
+ (void)putc(c, of);
+ if (ferror(of)) {
+ warnx("%s", name);
+ (void)Fclose(of);
+ return (-1);
+ }
+ }
+ (void)Fclose(of);
+ printf("%d/%ld\n", lc, cc);
+ (void)fflush(stdout);
+ return (0);
+}
+
+/*
+ * Edit the message being collected on fp.
+ * On return, make the edit file the new temp file.
+ */
+void
+mesedit(FILE *fp, int c)
+{
+ sig_t sigint = signal(SIGINT, SIG_IGN);
+ FILE *nf = run_editor(fp, (off_t)-1, c, 0);
+
+ if (nf != NULL) {
+ (void)fseeko(nf, (off_t)0, SEEK_END);
+ collf = nf;
+ (void)Fclose(fp);
+ }
+ (void)signal(SIGINT, sigint);
+}
+
+/*
+ * Pipe the message through the command.
+ * Old message is on stdin of command;
+ * New message collected from stdout.
+ * Sh -c must return 0 to accept the new message.
+ */
+void
+mespipe(FILE *fp, char cmd[])
+{
+ FILE *nf;
+ int fd;
+ sig_t sigint = signal(SIGINT, SIG_IGN);
+ char *sh, tempname[PATHSIZE];
+
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.ReXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (nf = Fdopen(fd, "w+")) == NULL) {
+ warn("%s", tempname);
+ goto out;
+ }
+ (void)rm(tempname);
+ /*
+ * stdin = current message.
+ * stdout = new message.
+ */
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+ if (run_command(sh,
+ 0, fileno(fp), fileno(nf), "-c", cmd, NULL) < 0) {
+ (void)Fclose(nf);
+ goto out;
+ }
+ if (fsize(nf) == 0) {
+ fprintf(stderr, "No bytes from \"%s\" !?\n", cmd);
+ (void)Fclose(nf);
+ goto out;
+ }
+ /*
+ * Take new files.
+ */
+ (void)fseeko(nf, (off_t)0, SEEK_END);
+ collf = nf;
+ (void)Fclose(fp);
+out:
+ (void)signal(SIGINT, sigint);
+}
+
+/*
+ * Interpolate the named messages into the current
+ * message, preceding each line with a tab.
+ * Return a count of the number of characters now in
+ * the message, or -1 if an error is encountered writing
+ * the message temporary. The flag argument is 'm' if we
+ * should shift over and 'f' if not.
+ */
+int
+forward(char ms[], FILE *fp, char *fn, int f)
+{
+ int *msgvec;
+ struct ignoretab *ig;
+ char *tabst;
+
+ msgvec = (int *)salloc((msgCount+1) * sizeof(*msgvec));
+ if (msgvec == NULL)
+ return (0);
+ if (getmsglist(ms, msgvec, 0) < 0)
+ return (0);
+ if (*msgvec == 0) {
+ *msgvec = first(0, MMNORM);
+ if (*msgvec == 0) {
+ printf("No appropriate messages\n");
+ return (0);
+ }
+ msgvec[1] = 0;
+ }
+ if (f == 'f' || f == 'F')
+ tabst = NULL;
+ else if ((tabst = value("indentprefix")) == NULL)
+ tabst = "\t";
+ ig = isupper((unsigned char)f) ? NULL : ignore;
+ printf("Interpolating:");
+ for (; *msgvec != 0; msgvec++) {
+ struct message *mp = message + *msgvec - 1;
+
+ touch(mp);
+ printf(" %d", *msgvec);
+ if (sendmessage(mp, fp, ig, tabst) < 0) {
+ warnx("%s", fn);
+ return (-1);
+ }
+ }
+ printf("\n");
+ return (0);
+}
+
+/*
+ * Print (continue) when continued after ^Z.
+ */
+/*ARGSUSED*/
+void
+collstop(int s)
+{
+ sig_t old_action = signal(s, SIG_DFL);
+ sigset_t nset;
+
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, s);
+ (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);
+ (void)kill(0, s);
+ (void)sigprocmask(SIG_BLOCK, &nset, NULL);
+ (void)signal(s, old_action);
+ if (colljmp_p) {
+ colljmp_p = 0;
+ hadintr = 0;
+ longjmp(colljmp, 1);
+ }
+}
+
+/*
+ * On interrupt, come here to save the partial message in ~/dead.letter.
+ * Then jump out of the collection loop.
+ */
+/*ARGSUSED*/
+void
+collint(int s __unused)
+{
+ /*
+ * the control flow is subtle, because we can be called from ~q.
+ */
+ if (!hadintr) {
+ if (value("ignore") != NULL) {
+ printf("@");
+ (void)fflush(stdout);
+ clearerr(stdin);
+ return;
+ }
+ hadintr = 1;
+ longjmp(colljmp, 1);
+ }
+ rewind(collf);
+ if (value("nosave") == NULL)
+ savedeadletter(collf);
+ longjmp(collabort, 1);
+}
+
+/*ARGSUSED*/
+void
+collhup(int s __unused)
+{
+ rewind(collf);
+ savedeadletter(collf);
+ /*
+ * Let's pretend nobody else wants to clean up,
+ * a true statement at this time.
+ */
+ exit(1);
+}
+
+void
+savedeadletter(FILE *fp)
+{
+ FILE *dbuf;
+ int c;
+ char *cp;
+
+ if (fsize(fp) == 0)
+ return;
+ cp = getdeadletter();
+ c = umask(077);
+ dbuf = Fopen(cp, "a");
+ (void)umask(c);
+ if (dbuf == NULL)
+ return;
+ while ((c = getc(fp)) != EOF)
+ (void)putc(c, dbuf);
+ (void)Fclose(dbuf);
+ rewind(fp);
+}
diff --git a/usr.bin/mail/def.h b/usr.bin/mail/def.h
new file mode 100644
index 0000000..e637252
--- /dev/null
+++ b/usr.bin/mail/def.h
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 1980, 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.
+ *
+ * @(#)def.h 8.4 (Berkeley) 4/20/95
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Mail -- a mail program
+ *
+ * Author: Kurt Shoens (UCB) March 25, 1978
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+
+#define APPEND /* New mail goes to end of mailbox */
+
+#define ESCAPE '~' /* Default escape for sending */
+#define NMLSIZE 1024 /* max names in a message list */
+#define PATHSIZE MAXPATHLEN /* Size of pathnames throughout */
+#define HSHSIZE 59 /* Hash size for aliases and vars */
+#define LINESIZE BUFSIZ /* max readable line width */
+#define STRINGSIZE ((unsigned)128) /* Dynamic allocation units */
+#define MAXARGC 1024 /* Maximum list of raw strings */
+#define MAXEXP 25 /* Maximum expansion of aliases */
+
+#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
+
+struct message {
+ short m_flag; /* flags, see below */
+ short m_offset; /* offset in block of message */
+ long m_block; /* block number of this message */
+ long m_size; /* Bytes in the message */
+ long m_lines; /* Lines in the message */
+};
+
+/*
+ * flag bits.
+ */
+
+#define MUSED (1<<0) /* entry is used, but this bit isn't */
+#define MDELETED (1<<1) /* entry has been deleted */
+#define MSAVED (1<<2) /* entry has been saved */
+#define MTOUCH (1<<3) /* entry has been noticed */
+#define MPRESERVE (1<<4) /* keep entry in sys mailbox */
+#define MMARK (1<<5) /* message is marked! */
+#define MODIFY (1<<6) /* message has been modified */
+#define MNEW (1<<7) /* message has never been seen */
+#define MREAD (1<<8) /* message has been read sometime. */
+#define MSTATUS (1<<9) /* message status has changed */
+#define MBOX (1<<10) /* Send this to mbox, regardless */
+
+/*
+ * Given a file address, determine the block number it represents.
+ */
+#define blockof(off) ((int)((off) / 4096))
+#define boffsetof(off) ((int)((off) % 4096))
+#define positionof(block, offset) ((off_t)(block) * 4096 + (offset))
+
+/*
+ * Format of the command description table.
+ * The actual table is declared and initialized
+ * in lex.c
+ */
+struct cmd {
+ const char *c_name; /* Name of command */
+ int (*c_func)(); /* Implementor of the command */
+ short c_argtype; /* Type of arglist (see below) */
+ short c_msgflag; /* Required flags of messages */
+ short c_msgmask; /* Relevant flags of messages */
+};
+
+/* Yechh, can't initialize unions */
+
+#define c_minargs c_msgflag /* Minimum argcount for RAWLIST */
+#define c_maxargs c_msgmask /* Max argcount for RAWLIST */
+
+/*
+ * Argument types.
+ */
+
+#define MSGLIST 0 /* Message list type */
+#define STRLIST 1 /* A pure string */
+#define RAWLIST 2 /* Shell string list */
+#define NOLIST 3 /* Just plain 0 */
+#define NDMLIST 4 /* Message list, no defaults */
+
+#define P 040 /* Autoprint dot after command */
+#define I 0100 /* Interactive command bit */
+#define M 0200 /* Legal from send mode bit */
+#define W 0400 /* Illegal when read only bit */
+#define F 01000 /* Is a conditional command */
+#define T 02000 /* Is a transparent command */
+#define R 04000 /* Cannot be called from collect */
+
+/*
+ * Oft-used mask values
+ */
+
+#define MMNORM (MDELETED|MSAVED)/* Look at both save and delete bits */
+#define MMNDEL MDELETED /* Look only at deleted bit */
+
+/*
+ * Structure used to return a break down of a head
+ * line (hats off to Bill Joy!)
+ */
+
+struct headline {
+ char *l_from; /* The name of the sender */
+ char *l_tty; /* His tty string (if any) */
+ char *l_date; /* The entire date string */
+};
+
+#define GTO 1 /* Grab To: line */
+#define GSUBJECT 2 /* Likewise, Subject: line */
+#define GCC 4 /* And the Cc: line */
+#define GBCC 8 /* And also the Bcc: line */
+#define GREPLYTO 0x10 /* And the Reply-To: line */
+#define GINREPLYTO 0x20 /* The In-Reply-To: line */
+#define GMASK (GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO)
+ /* Mask of places from whence */
+
+#define GNL 0x40 /* Print blank line after */
+#define GDEL 0x80 /* Entity removed from list */
+#define GCOMMA 0x100 /* detract puts in commas */
+
+/*
+ * Structure used to pass about the current
+ * state of the user-typed message header.
+ */
+
+struct header {
+ struct name *h_bcc; /* Blind carbon copies */
+ struct name *h_cc; /* Carbon copies string */
+ struct name *h_smopts; /* Sendmail options */
+ struct name *h_to; /* Dynamic "To:" string */
+ char *h_inreplyto; /* Reference */
+ char *h_replyto; /* Reply address */
+ char *h_subject; /* Subject string */
+};
+
+/*
+ * Structure of namelist nodes used in processing
+ * the recipients of mail and aliases and all that
+ * kind of stuff.
+ */
+
+struct name {
+ struct name *n_flink; /* Forward link in list. */
+ struct name *n_blink; /* Backward list link */
+ short n_type; /* From which list it came */
+ char *n_name; /* This fella's name */
+};
+
+/*
+ * Structure of a variable node. All variables are
+ * kept on a singly-linked list of these, rooted by
+ * "variables"
+ */
+
+struct var {
+ struct var *v_link; /* Forward link to next variable */
+ char *v_name; /* The variable's name */
+ char *v_value; /* And it's current value */
+};
+
+struct group {
+ struct group *ge_link; /* Next person in this group */
+ char *ge_name; /* This person's user name */
+};
+
+struct grouphead {
+ struct grouphead *g_link; /* Next grouphead in list */
+ char *g_name; /* Name of this group */
+ struct group *g_list; /* Users in group. */
+};
+
+/*
+ * Structure of the hash table of ignored header fields
+ */
+struct ignoretab {
+ int i_count; /* Number of entries */
+ struct ignore {
+ struct ignore *i_link; /* Next ignored field in bucket */
+ char *i_field; /* This ignored field */
+ } *i_head[HSHSIZE];
+};
+
+/*
+ * Token values returned by the scanner used for argument lists.
+ * Also, sizes of scanner-related things.
+ */
+
+#define TEOL 0 /* End of the command line */
+#define TNUMBER 1 /* A message number */
+#define TDASH 2 /* A simple dash */
+#define TSTRING 3 /* A string (possibly containing -) */
+#define TDOT 4 /* A "." */
+#define TUP 5 /* An "^" */
+#define TDOLLAR 6 /* A "$" */
+#define TSTAR 7 /* A "*" */
+#define TOPEN 8 /* An '(' */
+#define TCLOSE 9 /* A ')' */
+#define TPLUS 10 /* A '+' */
+#define TERROR 11 /* A lexical error */
+
+#define REGDEP 2 /* Maximum regret depth. */
+#define STRINGLEN 1024 /* Maximum length of string token */
+
+/*
+ * Constants for conditional commands. These describe whether
+ * we should be executing stuff or not.
+ */
+
+#define CANY 0 /* Execute in send or receive mode */
+#define CRCV 1 /* Execute in receive mode only */
+#define CSEND 2 /* Execute in send mode only */
+
+/*
+ * Kludges to handle the change from setexit / reset to setjmp / longjmp
+ */
+
+#define setexit() setjmp(srbuf)
+#define reset(x) longjmp(srbuf, x)
+
+/*
+ * Truncate a file to the last character written. This is
+ * useful just before closing an old file that was opened
+ * for read/write.
+ */
+#define trunc(stream) { \
+ (void)fflush(stream); \
+ (void)ftruncate(fileno(stream), ftello(stream)); \
+}
diff --git a/usr.bin/mail/edit.c b/usr.bin/mail/edit.c
new file mode 100644
index 0000000..f9e974d
--- /dev/null
+++ b/usr.bin/mail/edit.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Perform message editing functions.
+ */
+
+/*
+ * Edit a message list.
+ */
+int
+editor(int *msgvec)
+{
+
+ return (edit1(msgvec, 'e'));
+}
+
+/*
+ * Invoke the visual editor on a message list.
+ */
+int
+visual(int *msgvec)
+{
+
+ return (edit1(msgvec, 'v'));
+}
+
+/*
+ * Edit a message by writing the message into a funnily-named file
+ * (which should not exist) and forking an editor on it.
+ * We get the editor from the stuff above.
+ */
+int
+edit1(int *msgvec, int type)
+{
+ int c, i;
+ FILE *fp;
+ struct message *mp;
+ off_t size;
+
+ /*
+ * Deal with each message to be edited . . .
+ */
+ for (i = 0; i < msgCount && msgvec[i]; i++) {
+ sig_t sigint;
+
+ if (i > 0) {
+ char buf[100];
+ char *p;
+
+ printf("Edit message %d [ynq]? ", msgvec[i]);
+ if (fgets(buf, sizeof(buf), stdin) == NULL)
+ break;
+ for (p = buf; *p == ' ' || *p == '\t'; p++)
+ ;
+ if (*p == 'q')
+ break;
+ if (*p == 'n')
+ continue;
+ }
+ dot = mp = &message[msgvec[i] - 1];
+ touch(mp);
+ sigint = signal(SIGINT, SIG_IGN);
+ fp = run_editor(setinput(mp), mp->m_size, type, readonly);
+ if (fp != NULL) {
+ (void)fseeko(otf, (off_t)0, SEEK_END);
+ size = ftello(otf);
+ mp->m_block = blockof(size);
+ mp->m_offset = boffsetof(size);
+ mp->m_size = (long)fsize(fp);
+ mp->m_lines = 0;
+ mp->m_flag |= MODIFY;
+ rewind(fp);
+ while ((c = getc(fp)) != EOF) {
+ if (c == '\n')
+ mp->m_lines++;
+ if (putc(c, otf) == EOF)
+ break;
+ }
+ if (ferror(otf))
+ warnx("/tmp");
+ (void)Fclose(fp);
+ }
+ (void)signal(SIGINT, sigint);
+ }
+ return (0);
+}
+
+/*
+ * Run an editor on the file at "fpp" of "size" bytes,
+ * and return a new file pointer.
+ * Signals must be handled by the caller.
+ * "Type" is 'e' for _PATH_EX, 'v' for _PATH_VI.
+ */
+FILE *
+run_editor(FILE *fp, off_t size, int type, int readonly)
+{
+ FILE *nf = NULL;
+ int t;
+ time_t modtime;
+ char *edit, tempname[PATHSIZE];
+ struct stat statb;
+
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.ReXXXXXXXXXX", tmpdir);
+ if ((t = mkstemp(tempname)) == -1 ||
+ (nf = Fdopen(t, "w")) == NULL) {
+ warn("%s", tempname);
+ goto out;
+ }
+ if (readonly && fchmod(t, 0400) == -1) {
+ warn("%s", tempname);
+ (void)rm(tempname);
+ goto out;
+ }
+ if (size >= 0)
+ while (--size >= 0 && (t = getc(fp)) != EOF)
+ (void)putc(t, nf);
+ else
+ while ((t = getc(fp)) != EOF)
+ (void)putc(t, nf);
+ (void)fflush(nf);
+ if (fstat(fileno(nf), &statb) < 0)
+ modtime = 0;
+ else
+ modtime = statb.st_mtime;
+ if (ferror(nf)) {
+ (void)Fclose(nf);
+ warnx("%s", tempname);
+ (void)rm(tempname);
+ nf = NULL;
+ goto out;
+ }
+ if (Fclose(nf) < 0) {
+ warn("%s", tempname);
+ (void)rm(tempname);
+ nf = NULL;
+ goto out;
+ }
+ nf = NULL;
+ if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL)
+ edit = type == 'e' ? _PATH_EX : _PATH_VI;
+ if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) {
+ (void)rm(tempname);
+ goto out;
+ }
+ /*
+ * If in read only mode or file unchanged, just remove the editor
+ * temporary and return.
+ */
+ if (readonly) {
+ (void)rm(tempname);
+ goto out;
+ }
+ if (stat(tempname, &statb) < 0) {
+ warn("%s", tempname);
+ goto out;
+ }
+ if (modtime == statb.st_mtime) {
+ (void)rm(tempname);
+ goto out;
+ }
+ /*
+ * Now switch to new file.
+ */
+ if ((nf = Fopen(tempname, "a+")) == NULL) {
+ warn("%s", tempname);
+ (void)rm(tempname);
+ goto out;
+ }
+ (void)rm(tempname);
+out:
+ return (nf);
+}
diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h
new file mode 100644
index 0000000..2578d65
--- /dev/null
+++ b/usr.bin/mail/extern.h
@@ -0,0 +1,252 @@
+/*-
+ * Copyright (c) 1992, 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.
+ *
+ * @(#)extern.h 8.2 (Berkeley) 4/20/95
+ *
+ * $FreeBSD$
+ */
+
+struct name *cat(struct name *, struct name *);
+struct name *delname(struct name *, char []);
+struct name *elide(struct name *);
+struct name *extract(char [], int);
+struct name *gexpand(struct name *, struct grouphead *, int, int);
+struct name *nalloc(char [], int);
+struct name *outof(struct name *, FILE *, struct header *);
+struct name *put(struct name *, struct name *);
+struct name *tailof(struct name *);
+struct name *usermap(struct name *);
+FILE *Fdopen(int, const char *);
+FILE *Fopen(const char *, const char *);
+FILE *Popen(char *, const char *);
+FILE *collect(struct header *, int);
+char *copyin(char *, char **);
+char *detract(struct name *, int);
+char *expand(char *);
+char *getdeadletter(void);
+char *getname(int);
+char *hfield(const char *, struct message *);
+FILE *infix(struct header *, FILE *);
+char *ishfield(char [], char *, const char *);
+char *name1(struct message *, int);
+char *nameof(struct message *, int);
+char *nextword(char *, char *);
+char *readtty(const char *, char []);
+char *reedit(char *);
+FILE *run_editor(FILE *, off_t, int, int);
+char *salloc(int);
+char *savestr(char *);
+FILE *setinput(struct message *);
+char *skin(char *);
+char *skip_comment(char *);
+char *snarf(char [], int *);
+char *username(void);
+char *value(const char *);
+char *vcopy(const char *);
+char *yankword(char *, char []);
+char *yanklogin(char *, char []);
+int Fclose(FILE *);
+int More(int *);
+int Pclose(FILE *);
+int Respond(int *);
+int Type(int *);
+int doRespond(int []);
+int dorespond(int *);
+void alter(char *);
+int alternates(char **);
+void announce(void);
+int append(struct message *, FILE *);
+int argcount(char **);
+void assign(const char *, const char *);
+int bangexp(char *, size_t);
+void brokpipe(int);
+int charcount(char *, int);
+int check(int, int);
+void clob1(int);
+int clobber(char **);
+void close_all_files(void);
+int cmatch(char *, char *);
+void collhup(int);
+void collint(int);
+void collstop(int);
+void commands(void);
+int copycmd(char []);
+int core(void);
+int count(struct name *);
+int delete(int []);
+int delm(int []);
+int deltype(int []);
+void demail(void);
+int diction(const void *, const void *);
+int dosh(char *);
+int echo(char **);
+int edit1(int *, int);
+int editor(int *);
+void edstop(void);
+int elsecmd(void);
+int endifcmd(void);
+int evalcol(int);
+int execute(char [], int);
+int exwrite(char [], FILE *, int);
+void fail(const char *, const char *);
+int file(char **);
+struct grouphead *
+ findgroup(char []);
+void findmail(char *, char *, int);
+int first(int, int);
+void fixhead(struct header *, struct name *);
+void fmt(const char *, struct name *, FILE *, int);
+int folders(void);
+int forward(char [], FILE *, char *, int);
+void free_child(int);
+int from(int *);
+off_t fsize(FILE *);
+int getfold(char *, int);
+int gethfield(FILE *, char [], int, char **);
+int getmsglist(char *, int *, int);
+int getrawlist(char [], char **, int);
+int getuserid(char []);
+int grabh(struct header *, int);
+int group(char **);
+void hangup(int);
+int hash(const char *);
+void hdrstop(int);
+int headers(int *);
+int help(void);
+void holdsigs(void);
+int ifcmd(char **);
+int igcomp(const void *, const void *);
+int igfield(char *[]);
+int ignore1(char *[], struct ignoretab *, const char *);
+int igshow(struct ignoretab *, const char *);
+int inc(void *);
+int incfile(void);
+void intr(int);
+int isdate(char []);
+int isdir(char []);
+int isfileaddr(char *);
+int ishead(char []);
+int isign(const char *, struct ignoretab []);
+int isprefix(const char *, const char *);
+void istrncpy(char *, const char *, size_t);
+const struct cmd *
+ lex(char []);
+void load(char *);
+struct var *
+ lookup(const char *);
+int mail(struct name *,
+ struct name *, struct name *, struct name *, char *, char *);
+void mail1(struct header *, int);
+void makemessage(FILE *, int);
+void mark(int);
+int markall(char [], int);
+int matchsender(char *, int);
+int matchfield(char *, int);
+int mboxit(int []);
+int member(char *, struct ignoretab *);
+void mesedit(FILE *, int);
+void mespipe(FILE *, char []);
+int messize(int *);
+int metamess(int, int);
+int more(int *);
+int newfileinfo(int);
+int next(int *);
+int null(int);
+void parse(char [], struct headline *, char []);
+int pcmdlist(void);
+int pdot(void);
+void prepare_child(sigset_t *, int, int);
+int preserve(int *);
+void prettyprint(struct name *);
+void printgroup(char []);
+void printhead(int);
+int puthead(struct header *, FILE *, int);
+int putline(FILE *, char *, int);
+int pversion(int);
+void quit(void);
+int quitcmd(void);
+int readline(FILE *, char *, int);
+void register_file(FILE *, int, int);
+void regret(int);
+void relsesigs(void);
+int respond(int *);
+int retfield(char *[]);
+int rexit(int);
+int rm(char *);
+int run_command(char *, sigset_t *, int, int, char *, char *, char *);
+int save(char []);
+int save1(char [], int, const char *, struct ignoretab *);
+void savedeadletter(FILE *);
+int saveigfield(char *[]);
+int savemail(char [], FILE *);
+int saveretfield(char *[]);
+int scan(char **);
+void scaninit(void);
+int schdir(char **);
+int screensize(void);
+int scroll(char []);
+int sendmessage(struct message *, FILE *, struct ignoretab *, char *);
+int sendmail(char *);
+int set(char **);
+int setfile(char *);
+void setmsize(int);
+void setptr(FILE *, off_t);
+void setscreensize(void);
+int shell(char *);
+void sigchild(int);
+void sort(char **);
+int source(char **);
+void spreserve(void);
+void sreset(void);
+int start_command(char *, sigset_t *, int, int, char *, char *, char *);
+void statusput(struct message *, FILE *, char *);
+void stop(int);
+int stouch(int []);
+int swrite(char []);
+void tinit(void);
+int top(int *);
+void touch(struct message *);
+void ttyint(int);
+void ttystop(int);
+int type(int *);
+int type1(int *, int, int);
+int undelete_messages(int *);
+void unmark(int);
+char **unpack(struct name *);
+int unread(int []);
+void unregister_file(FILE *);
+int unset(char **);
+int unstack(void);
+void vfree(char *);
+int visual(int *);
+int wait_child(int);
+int wait_command(int);
+int writeback(FILE *);
+
+extern char *__progname;
+extern char *tmpdir;
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c
new file mode 100644
index 0000000..d9d4ee1
--- /dev/null
+++ b/usr.bin/mail/fio.c
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <sys/file.h>
+#include <sys/wait.h>
+
+#include <unistd.h>
+#include <paths.h>
+#include <errno.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * File I/O.
+ */
+
+extern int wait_status;
+
+/*
+ * Set up the input pointers while copying the mail file into /tmp.
+ */
+void
+setptr(FILE *ibuf, off_t offset)
+{
+ int c, count;
+ char *cp, *cp2;
+ struct message this;
+ FILE *mestmp;
+ int maybe, inhead;
+ char linebuf[LINESIZE], pathbuf[PATHSIZE];
+ int omsgCount;
+
+ /* Get temporary file. */
+ (void)snprintf(pathbuf, sizeof(pathbuf), "%s/mail.XXXXXXXXXX", tmpdir);
+ if ((c = mkstemp(pathbuf)) == -1 || (mestmp = Fdopen(c, "r+")) == NULL)
+ err(1, "can't open %s", pathbuf);
+ (void)rm(pathbuf);
+
+ if (offset == 0) {
+ msgCount = 0;
+ } else {
+ /* Seek into the file to get to the new messages */
+ (void)fseeko(ibuf, offset, SEEK_SET);
+ /*
+ * We need to make "offset" a pointer to the end of
+ * the temp file that has the copy of the mail file.
+ * If any messages have been edited, this will be
+ * different from the offset into the mail file.
+ */
+ (void)fseeko(otf, (off_t)0, SEEK_END);
+ offset = ftello(otf);
+ }
+ omsgCount = msgCount;
+ maybe = 1;
+ inhead = 0;
+ this.m_flag = MUSED|MNEW;
+ this.m_size = 0;
+ this.m_lines = 0;
+ this.m_block = 0;
+ this.m_offset = 0;
+ for (;;) {
+ if (fgets(linebuf, sizeof(linebuf), ibuf) == NULL) {
+ if (append(&this, mestmp))
+ errx(1, "temporary file");
+ makemessage(mestmp, omsgCount);
+ return;
+ }
+ count = strlen(linebuf);
+ /*
+ * Transforms lines ending in <CR><LF> to just <LF>.
+ * This allows mail to be able to read Eudora mailboxes.
+ */
+ if (count >= 2 && linebuf[count - 1] == '\n' &&
+ linebuf[count - 2] == '\r') {
+ count--;
+ linebuf[count - 1] = '\n';
+ }
+
+ (void)fwrite(linebuf, sizeof(*linebuf), count, otf);
+ if (ferror(otf))
+ errx(1, "/tmp");
+ if (count)
+ linebuf[count - 1] = '\0';
+ if (maybe && linebuf[0] == 'F' && ishead(linebuf)) {
+ msgCount++;
+ if (append(&this, mestmp))
+ errx(1, "temporary file");
+ this.m_flag = MUSED|MNEW;
+ this.m_size = 0;
+ this.m_lines = 0;
+ this.m_block = blockof(offset);
+ this.m_offset = boffsetof(offset);
+ inhead = 1;
+ } else if (linebuf[0] == 0) {
+ inhead = 0;
+ } else if (inhead) {
+ for (cp = linebuf, cp2 = "status";; cp++) {
+ if ((c = *cp2++) == '\0') {
+ while (isspace((unsigned char)*cp++))
+ ;
+ if (cp[-1] != ':')
+ break;
+ while ((c = *cp++) != '\0')
+ if (c == 'R')
+ this.m_flag |= MREAD;
+ else if (c == 'O')
+ this.m_flag &= ~MNEW;
+ inhead = 0;
+ break;
+ }
+ if (*cp != c && *cp != toupper((unsigned char)c))
+ break;
+ }
+ }
+ offset += count;
+ this.m_size += count;
+ this.m_lines++;
+ maybe = linebuf[0] == 0;
+ }
+}
+
+/*
+ * Drop the passed line onto the passed output buffer.
+ * If a write error occurs, return -1, else the count of
+ * characters written, including the newline if requested.
+ */
+int
+putline(FILE *obuf, char *linebuf, int outlf)
+{
+ int c;
+
+ c = strlen(linebuf);
+ (void)fwrite(linebuf, sizeof(*linebuf), c, obuf);
+ if (outlf) {
+ fprintf(obuf, "\n");
+ c++;
+ }
+ if (ferror(obuf))
+ return (-1);
+ return (c);
+}
+
+/*
+ * Read up a line from the specified input into the line
+ * buffer. Return the number of characters read. Do not
+ * include the newline (or carriage return) at the end.
+ */
+int
+readline(FILE *ibuf, char *linebuf, int linesize)
+{
+ int n;
+
+ clearerr(ibuf);
+ if (fgets(linebuf, linesize, ibuf) == NULL)
+ return (-1);
+ n = strlen(linebuf);
+ if (n > 0 && linebuf[n - 1] == '\n')
+ linebuf[--n] = '\0';
+ if (n > 0 && linebuf[n - 1] == '\r')
+ linebuf[--n] = '\0';
+ return (n);
+}
+
+/*
+ * Return a file buffer all ready to read up the
+ * passed message pointer.
+ */
+FILE *
+setinput(struct message *mp)
+{
+
+ (void)fflush(otf);
+ if (fseeko(itf,
+ positionof(mp->m_block, mp->m_offset), SEEK_SET) < 0)
+ err(1, "fseeko");
+ return (itf);
+}
+
+/*
+ * Take the data out of the passed ghost file and toss it into
+ * a dynamically allocated message structure.
+ */
+void
+makemessage(FILE *f, int omsgCount)
+{
+ size_t size;
+ struct message *nmessage;
+
+ size = (msgCount + 1) * sizeof(struct message);
+ nmessage = (struct message *)realloc(message, size);
+ if (nmessage == NULL)
+ errx(1, "Insufficient memory for %d messages\n",
+ msgCount);
+ if (omsgCount == 0 || message == NULL)
+ dot = nmessage;
+ else
+ dot = nmessage + (dot - message);
+ message = nmessage;
+ size -= (omsgCount + 1) * sizeof(struct message);
+ (void)fflush(f);
+ (void)lseek(fileno(f), (off_t)sizeof(*message), 0);
+ if (read(fileno(f), (char *)&message[omsgCount], size) != size)
+ errx(1, "Message temporary file corrupted");
+ message[msgCount].m_size = 0;
+ message[msgCount].m_lines = 0;
+ (void)Fclose(f);
+}
+
+/*
+ * Append the passed message descriptor onto the temp file.
+ * If the write fails, return 1, else 0
+ */
+int
+append(struct message *mp, FILE *f)
+{
+ return (fwrite((char *)mp, sizeof(*mp), 1, f) != 1);
+}
+
+/*
+ * Delete a file, but only if the file is a plain file.
+ */
+int
+rm(char *name)
+{
+ struct stat sb;
+
+ if (stat(name, &sb) < 0)
+ return (-1);
+ if (!S_ISREG(sb.st_mode)) {
+ errno = EISDIR;
+ return (-1);
+ }
+ return (unlink(name));
+}
+
+static int sigdepth; /* depth of holdsigs() */
+static sigset_t nset, oset;
+/*
+ * Hold signals SIGHUP, SIGINT, and SIGQUIT.
+ */
+void
+holdsigs(void)
+{
+
+ if (sigdepth++ == 0) {
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGHUP);
+ (void)sigaddset(&nset, SIGINT);
+ (void)sigaddset(&nset, SIGQUIT);
+ (void)sigprocmask(SIG_BLOCK, &nset, &oset);
+ }
+}
+
+/*
+ * Release signals SIGHUP, SIGINT, and SIGQUIT.
+ */
+void
+relsesigs(void)
+{
+
+ if (--sigdepth == 0)
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
+}
+
+/*
+ * Determine the size of the file possessed by
+ * the passed buffer.
+ */
+off_t
+fsize(FILE *iob)
+{
+ struct stat sbuf;
+
+ if (fstat(fileno(iob), &sbuf) < 0)
+ return (0);
+ return (sbuf.st_size);
+}
+
+/*
+ * Evaluate the string given as a new mailbox name.
+ * Supported meta characters:
+ * % for my system mail box
+ * %user for user's system mail box
+ * # for previous file
+ * & invoker's mbox file
+ * +file file in folder directory
+ * any shell meta character
+ * Return the file name as a dynamic string.
+ */
+char *
+expand(char *name)
+{
+ char xname[PATHSIZE];
+ char cmdbuf[PATHSIZE]; /* also used for file names */
+ int pid, l;
+ char *cp, *sh;
+ int pivec[2];
+ struct stat sbuf;
+
+ /*
+ * The order of evaluation is "%" and "#" expand into constants.
+ * "&" can expand into "+". "+" can expand into shell meta characters.
+ * Shell meta characters expand into constants.
+ * This way, we make no recursive expansion.
+ */
+ switch (*name) {
+ case '%':
+ findmail(name[1] ? name + 1 : myname, xname, sizeof(xname));
+ return (savestr(xname));
+ case '#':
+ if (name[1] != 0)
+ break;
+ if (prevfile[0] == 0) {
+ printf("No previous file\n");
+ return (NULL);
+ }
+ return (savestr(prevfile));
+ case '&':
+ if (name[1] == 0 && (name = value("MBOX")) == NULL)
+ name = "~/mbox";
+ /* fall through */
+ }
+ if (name[0] == '+' && getfold(cmdbuf, sizeof(cmdbuf)) >= 0) {
+ (void)snprintf(xname, sizeof(xname), "%s/%s", cmdbuf, name + 1);
+ name = savestr(xname);
+ }
+ /* catch the most common shell meta character */
+ if (name[0] == '~' && homedir != NULL &&
+ (name[1] == '/' || name[1] == '\0')) {
+ (void)snprintf(xname, sizeof(xname), "%s%s", homedir, name + 1);
+ name = savestr(xname);
+ }
+ if (!strpbrk(name, "~{[*?$`'\"\\"))
+ return (savestr(name));
+ if (pipe(pivec) < 0) {
+ warn("pipe");
+ return (NULL);
+ }
+ (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+ pid = start_command(sh, 0, -1, pivec[1], "-c", cmdbuf, NULL);
+ if (pid < 0) {
+ (void)close(pivec[0]);
+ (void)close(pivec[1]);
+ return (NULL);
+ }
+ (void)close(pivec[1]);
+ l = read(pivec[0], xname, BUFSIZ);
+ (void)close(pivec[0]);
+ if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) &&
+ WTERMSIG(wait_status) != SIGPIPE) {
+ fprintf(stderr, "\"%s\": Expansion failed.\n", name);
+ return (NULL);
+ }
+ if (l < 0) {
+ warn("read");
+ return (NULL);
+ }
+ if (l == 0) {
+ fprintf(stderr, "\"%s\": No match.\n", name);
+ return (NULL);
+ }
+ if (l == BUFSIZ) {
+ fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name);
+ return (NULL);
+ }
+ xname[l] = '\0';
+ for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
+ ;
+ cp[1] = '\0';
+ if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) {
+ fprintf(stderr, "\"%s\": Ambiguous.\n", name);
+ return (NULL);
+ }
+ return (savestr(xname));
+}
+
+/*
+ * Determine the current folder directory name.
+ */
+int
+getfold(char *name, int namelen)
+{
+ char *folder;
+ int copylen;
+
+ if ((folder = value("folder")) == NULL)
+ return (-1);
+ if (*folder == '/')
+ copylen = strlcpy(name, folder, namelen);
+ else
+ copylen = snprintf(name, namelen, "%s/%s",
+ homedir ? homedir : ".", folder);
+ return (copylen < 0 || copylen >= namelen ? (-1) : (0));
+}
+
+/*
+ * Return the name of the dead.letter file.
+ */
+char *
+getdeadletter(void)
+{
+ char *cp;
+
+ if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL)
+ cp = expand("~/dead.letter");
+ else if (*cp != '/') {
+ char buf[PATHSIZE];
+
+ (void)snprintf(buf, sizeof(buf), "~/%s", cp);
+ cp = expand(buf);
+ }
+ return (cp);
+}
diff --git a/usr.bin/mail/getname.c b/usr.bin/mail/getname.c
new file mode 100644
index 0000000..4f06354
--- /dev/null
+++ b/usr.bin/mail/getname.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)getname.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <pwd.h>
+#include "extern.h"
+
+/* Getname / getuserid for those with hashed passwd data base). */
+
+/*
+ * Search the passwd file for a uid. Return name on success, NULL on failure.
+ */
+char *
+getname(int uid)
+{
+ struct passwd *pw;
+
+ if ((pw = getpwuid(uid)) == NULL)
+ return (NULL);
+ return (pw->pw_name);
+}
+
+/*
+ * Convert the passed name to a user id and return it. Return -1
+ * on error.
+ */
+int
+getuserid(char name[])
+{
+ struct passwd *pw;
+
+ if ((pw = getpwnam(name)) == NULL)
+ return (-1);
+ return (pw->pw_uid);
+}
diff --git a/usr.bin/mail/glob.h b/usr.bin/mail/glob.h
new file mode 100644
index 0000000..a2eeea3
--- /dev/null
+++ b/usr.bin/mail/glob.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1980, 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.
+ *
+ * @(#)glob.h 8.1 (Berkeley) 6/6/93
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * A bunch of global variable declarations lie herein.
+ * def.h must be included first.
+ */
+
+int msgCount; /* Count of messages read in */
+int rcvmode; /* True if receiving mail */
+int sawcom; /* Set after first command */
+char *Tflag; /* -T temp file for netnews */
+int senderr; /* An error while checking */
+int edit; /* Indicates editing a file */
+int readonly; /* Will be unable to rewrite file */
+int noreset; /* String resets suspended */
+int sourcing; /* Currently reading variant file */
+int loading; /* Loading user definitions */
+int cond; /* Current state of conditional exc. */
+FILE *itf; /* Input temp file buffer */
+FILE *otf; /* Output temp file buffer */
+int image; /* File descriptor for image of msg */
+FILE *input; /* Current command input file */
+char mailname[PATHSIZE]; /* Name of current file */
+char prevfile[PATHSIZE]; /* Name of previous file */
+char *homedir; /* Path name of home directory */
+char *myname; /* My login name */
+off_t mailsize; /* Size of system mailbox */
+int lexnumber; /* Number of TNUMBER from scan() */
+char lexstring[STRINGLEN]; /* String from TSTRING, scan() */
+int regretp; /* Pointer to TOS of regret tokens */
+int regretstack[REGDEP]; /* Stack of regretted tokens */
+char *string_stack[REGDEP]; /* Stack of regretted strings */
+int numberstack[REGDEP]; /* Stack of regretted numbers */
+struct message *dot; /* Pointer to current message */
+struct message *message; /* The actual message structure */
+struct var *variables[HSHSIZE]; /* Pointer to active var list */
+struct grouphead *groups[HSHSIZE];/* Pointer to active groups */
+struct ignoretab ignore[2]; /* ignored and retained fields
+ 0 is ignore, 1 is retain */
+struct ignoretab saveignore[2]; /* ignored and retained fields
+ on save to folder */
+struct ignoretab ignoreall[2]; /* special, ignore all headers */
+char **altnames; /* List of alternate names for user */
+int debug; /* Debug flag set */
+int screenwidth; /* Screen width, or best guess */
+int screenheight; /* Screen height, or best guess,
+ for "header" command */
+int realscreenheight; /* the real screen height */
+
+#include <setjmp.h>
+
+jmp_buf srbuf;
+
+
+/*
+ * The pointers for the string allocation routines,
+ * there are NSPACE independent areas.
+ * The first holds STRINGSIZE bytes, the next
+ * twice as much, and so on.
+ */
+
+#define NSPACE 25 /* Total number of string spaces */
+struct strings {
+ char *s_topFree; /* Beginning of this area */
+ char *s_nextFree; /* Next alloctable place here */
+ unsigned s_nleft; /* Number of bytes left here */
+} stringdope[NSPACE];
diff --git a/usr.bin/mail/head.c b/usr.bin/mail/head.c
new file mode 100644
index 0000000..d836ce4
--- /dev/null
+++ b/usr.bin/mail/head.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Routines for processing and detecting headlines.
+ */
+
+/*
+ * See if the passed line buffer is a mail header.
+ * Return true if yes. Note the extreme pains to
+ * accommodate all funny formats.
+ */
+int
+ishead(char linebuf[])
+{
+ struct headline hl;
+ char parbuf[BUFSIZ];
+
+ if (strncmp(linebuf, "From ", 5) != 0)
+ return (0);
+ parse(linebuf, &hl, parbuf);
+ if (hl.l_date == NULL) {
+ fail(linebuf, "No date field");
+ return (0);
+ }
+ if (!isdate(hl.l_date)) {
+ fail(linebuf, "Date field not legal date");
+ return (0);
+ }
+ /*
+ * I guess we got it!
+ */
+ return (1);
+}
+
+void
+fail(const char *linebuf __unused, const char *reason __unused)
+{
+
+ /*
+ if (value("debug") == NULL)
+ return;
+ fprintf(stderr, "\"%s\"\nnot a header because %s\n", linebuf, reason);
+ */
+}
+
+/*
+ * Split a headline into its useful components.
+ * Copy the line into dynamic string space, then set
+ * pointers into the copied line in the passed headline
+ * structure. Actually, it scans.
+ */
+void
+parse(char line[], struct headline *hl, char pbuf[])
+{
+ char *cp, *sp;
+ char word[LINESIZE];
+
+ hl->l_from = NULL;
+ hl->l_tty = NULL;
+ hl->l_date = NULL;
+ cp = line;
+ sp = pbuf;
+ /*
+ * Skip over "From" first.
+ */
+ cp = nextword(cp, word);
+ /*
+ * Check for missing return-path.
+ */
+ if (isdate(cp)) {
+ hl->l_date = copyin(cp, &sp);
+ return;
+ }
+ cp = nextword(cp, word);
+ if (strlen(word) > 0)
+ hl->l_from = copyin(word, &sp);
+ if (cp != NULL && strncmp(cp, "tty", 3) == 0) {
+ cp = nextword(cp, word);
+ hl->l_tty = copyin(word, &sp);
+ }
+ if (cp != NULL)
+ hl->l_date = copyin(cp, &sp);
+}
+
+/*
+ * Copy the string on the left into the string on the right
+ * and bump the right (reference) string pointer by the length.
+ * Thus, dynamically allocate space in the right string, copying
+ * the left string into it.
+ */
+char *
+copyin(char *src, char **space)
+{
+ char *cp, *top;
+
+ top = cp = *space;
+ while ((*cp++ = *src++) != '\0')
+ ;
+ *space = cp;
+ return (top);
+}
+
+/*
+ * Test to see if the passed string is a ctime(3) generated
+ * date string as documented in the manual. The template
+ * below is used as the criterion of correctness.
+ * Also, we check for a possible trailing time zone using
+ * the tmztype template.
+ *
+ * If the mail file is created by Sys V (Solaris), there are
+ * no seconds in the time. If the mail is created by another
+ * program such as imapd, it might have timezone as
+ * <-|+>nnnn (-0800 for instance) at the end.
+ */
+
+/*
+ * 'A' An upper case char
+ * 'a' A lower case char
+ * ' ' A space
+ * '0' A digit
+ * 'O' A digit or space
+ * 'p' A punctuation char
+ * 'P' A punctuation char or space
+ * ':' A colon
+ * 'N' A new line
+ */
+
+static char *date_formats[] = {
+ "Aaa Aaa O0 00:00:00 0000", /* Mon Jan 01 23:59:59 2001 */
+ "Aaa Aaa O0 00:00:00 AAA 0000", /* Mon Jan 01 23:59:59 PST 2001 */
+ "Aaa Aaa O0 00:00:00 0000 p0000", /* Mon Jan 01 23:59:59 2001 -0800 */
+ "Aaa Aaa O0 00:00 0000", /* Mon Jan 01 23:59 2001 */
+ "Aaa Aaa O0 00:00 AAA 0000", /* Mon Jan 01 23:59 PST 2001 */
+ "Aaa Aaa O0 00:00 0000 p0000", /* Mon Jan 01 23:59 2001 -0800 */
+ NULL
+};
+
+int
+isdate(char date[])
+{
+ int i;
+
+ for(i = 0; date_formats[i] != NULL; i++) {
+ if (cmatch(date, date_formats[i]))
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Match the given string (cp) against the given template (tp).
+ * Return 1 if they match, 0 if they don't
+ */
+int
+cmatch(char *cp, char *tp)
+{
+
+ while (*cp != '\0' && *tp != '\0')
+ switch (*tp++) {
+ case 'a':
+ if (!islower((unsigned char)*cp++))
+ return (0);
+ break;
+ case 'A':
+ if (!isupper((unsigned char)*cp++))
+ return (0);
+ break;
+ case ' ':
+ if (*cp++ != ' ')
+ return (0);
+ break;
+ case '0':
+ if (!isdigit((unsigned char)*cp++))
+ return (0);
+ break;
+ case 'O':
+ if (*cp != ' ' && !isdigit((unsigned char)*cp))
+ return (0);
+ cp++;
+ break;
+ case 'p':
+ if (!ispunct((unsigned char)*cp++))
+ return (0);
+ break;
+ case 'P':
+ if (*cp != ' ' && !ispunct((unsigned char)*cp))
+ return (0);
+ cp++;
+ break;
+ case ':':
+ if (*cp++ != ':')
+ return (0);
+ break;
+ case 'N':
+ if (*cp++ != '\n')
+ return (0);
+ break;
+ }
+ if (*cp != '\0' || *tp != '\0')
+ return (0);
+ return (1);
+}
+
+/*
+ * Collect a liberal (space, tab delimited) word into the word buffer
+ * passed. Also, return a pointer to the next word following that,
+ * or NULL if none follow.
+ */
+char *
+nextword(char *wp, char *wbuf)
+{
+ int c;
+
+ if (wp == NULL) {
+ *wbuf = '\0';
+ return (NULL);
+ }
+ while ((c = *wp++) != '\0' && c != ' ' && c != '\t') {
+ *wbuf++ = c;
+ if (c == '"') {
+ while ((c = *wp++) != '\0' && c != '"')
+ *wbuf++ = c;
+ if (c == '"')
+ *wbuf++ = c;
+ else
+ wp--;
+ }
+ }
+ *wbuf = '\0';
+ for (; c == ' ' || c == '\t'; c = *wp++)
+ ;
+ if (c == '\0')
+ return (NULL);
+ return (wp - 1);
+}
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c
new file mode 100644
index 0000000..4d799e7
--- /dev/null
+++ b/usr.bin/mail/lex.c
@@ -0,0 +1,699 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <errno.h>
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Lexical processing of commands.
+ */
+
+static const char *prompt = "& ";
+
+extern const struct cmd cmdtab[];
+extern const char *version;
+
+/*
+ * Set up editing on the given file name.
+ * If the first character of name is %, we are considered to be
+ * editing the file, otherwise we are reading our mail which has
+ * signficance for mbox and so forth.
+ *
+ * If the -e option is being passed to mail, this function has a
+ * tri-state return code: -1 on error, 0 on no mail, 1 if there is
+ * mail.
+ */
+int
+setfile(char *name)
+{
+ FILE *ibuf;
+ int checkmode, i, fd;
+ struct stat stb;
+ char isedit = *name != '%' || getuserid(myname) != getuid();
+ char *who = name[1] ? name + 1 : myname;
+ char tempname[PATHSIZE];
+ static int shudclob;
+
+ checkmode = value("checkmode") != NULL;
+ if ((name = expand(name)) == NULL)
+ return (-1);
+
+ if ((ibuf = Fopen(name, "r")) == NULL) {
+ if (!isedit && errno == ENOENT)
+ goto nomail;
+ warn("%s", name);
+ return (-1);
+ }
+
+ if (fstat(fileno(ibuf), &stb) < 0) {
+ warn("fstat");
+ (void)Fclose(ibuf);
+ return (-1);
+ }
+
+ if (S_ISDIR(stb.st_mode) || !S_ISREG(stb.st_mode)) {
+ (void)Fclose(ibuf);
+ errno = S_ISDIR(stb.st_mode) ? EISDIR : EINVAL;
+ warn("%s", name);
+ return (-1);
+ }
+
+ /*
+ * Looks like all will be well. We must now relinquish our
+ * hold on the current set of stuff. Must hold signals
+ * while we are reading the new file, else we will ruin
+ * the message[] data structure.
+ */
+
+ holdsigs();
+ if (shudclob)
+ quit();
+
+ /*
+ * Copy the messages into /tmp
+ * and set pointers.
+ */
+
+ readonly = 0;
+ if ((i = open(name, 1)) < 0)
+ readonly++;
+ else
+ (void)close(i);
+ if (shudclob) {
+ (void)fclose(itf);
+ (void)fclose(otf);
+ }
+ shudclob = 1;
+ edit = isedit;
+ strlcpy(prevfile, mailname, sizeof(prevfile));
+ if (name != mailname)
+ strlcpy(mailname, name, sizeof(mailname));
+ mailsize = fsize(ibuf);
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.RxXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 || (otf = fdopen(fd, "w")) == NULL)
+ err(1, "%s", tempname);
+ (void)fcntl(fileno(otf), F_SETFD, 1);
+ if ((itf = fopen(tempname, "r")) == NULL)
+ err(1, "%s", tempname);
+ (void)fcntl(fileno(itf), F_SETFD, 1);
+ (void)rm(tempname);
+ setptr(ibuf, 0);
+ setmsize(msgCount);
+ /*
+ * New mail may have arrived while we were reading
+ * the mail file, so reset mailsize to be where
+ * we really are in the file...
+ */
+ mailsize = ftello(ibuf);
+ (void)Fclose(ibuf);
+ relsesigs();
+ sawcom = 0;
+
+ if ((checkmode || !edit) && msgCount == 0) {
+nomail:
+ if (!checkmode) {
+ fprintf(stderr, "No mail for %s\n", who);
+ return (-1);
+ } else
+ return (0);
+ }
+ return (checkmode ? 1 : 0);
+}
+
+/*
+ * Incorporate any new mail that has arrived since we first
+ * started reading mail.
+ */
+int
+incfile(void)
+{
+ off_t newsize;
+ int omsgCount = msgCount;
+ FILE *ibuf;
+
+ ibuf = Fopen(mailname, "r");
+ if (ibuf == NULL)
+ return (-1);
+ holdsigs();
+ newsize = fsize(ibuf);
+ if (newsize == 0)
+ return (-1); /* mail box is now empty??? */
+ if (newsize < mailsize)
+ return (-1); /* mail box has shrunk??? */
+ if (newsize == mailsize)
+ return (0); /* no new mail */
+ setptr(ibuf, mailsize);
+ setmsize(msgCount);
+ mailsize = ftello(ibuf);
+ (void)Fclose(ibuf);
+ relsesigs();
+ return (msgCount - omsgCount);
+}
+
+static int *msgvec;
+static int reset_on_stop; /* do a reset() if stopped */
+
+/*
+ * Interpret user commands one by one. If standard input is not a tty,
+ * print no prompt.
+ */
+void
+commands(void)
+{
+ int n, eofloop = 0;
+ char linebuf[LINESIZE];
+
+ if (!sourcing) {
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGINT, intr);
+ if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGHUP, hangup);
+ (void)signal(SIGTSTP, stop);
+ (void)signal(SIGTTOU, stop);
+ (void)signal(SIGTTIN, stop);
+ }
+ setexit();
+ for (;;) {
+ /*
+ * Print the prompt, if needed. Clear out
+ * string space, and flush the output.
+ */
+ if (!sourcing && value("interactive") != NULL) {
+ if ((value("autoinc") != NULL) && (incfile() > 0))
+ printf("New mail has arrived.\n");
+ reset_on_stop = 1;
+ printf("%s", prompt);
+ }
+ (void)fflush(stdout);
+ sreset();
+ /*
+ * Read a line of commands from the current input
+ * and handle end of file specially.
+ */
+ n = 0;
+ for (;;) {
+ if (readline(input, &linebuf[n], LINESIZE - n) < 0) {
+ if (n == 0)
+ n = -1;
+ break;
+ }
+ if ((n = strlen(linebuf)) == 0)
+ break;
+ n--;
+ if (linebuf[n] != '\\')
+ break;
+ linebuf[n++] = ' ';
+ }
+ reset_on_stop = 0;
+ if (n < 0) {
+ /* eof */
+ if (loading)
+ break;
+ if (sourcing) {
+ unstack();
+ continue;
+ }
+ if (value("interactive") != NULL &&
+ value("ignoreeof") != NULL &&
+ ++eofloop < 25) {
+ printf("Use \"quit\" to quit.\n");
+ continue;
+ }
+ break;
+ }
+ eofloop = 0;
+ if (execute(linebuf, 0))
+ break;
+ }
+}
+
+/*
+ * Execute a single command.
+ * Command functions return 0 for success, 1 for error, and -1
+ * for abort. A 1 or -1 aborts a load or source. A -1 aborts
+ * the interactive command loop.
+ * Contxt is non-zero if called while composing mail.
+ */
+int
+execute(char linebuf[], int contxt)
+{
+ char word[LINESIZE];
+ char *arglist[MAXARGC];
+ const struct cmd *com;
+ char *cp, *cp2;
+ int c, muvec[2];
+ int e = 1;
+
+ /*
+ * Strip the white space away from the beginning
+ * of the command, then scan out a word, which
+ * consists of anything except digits and white space.
+ *
+ * Handle ! escapes differently to get the correct
+ * lexical conventions.
+ */
+
+ for (cp = linebuf; isspace((unsigned char)*cp); cp++)
+ ;
+ if (*cp == '!') {
+ if (sourcing) {
+ printf("Can't \"!\" while sourcing\n");
+ goto out;
+ }
+ shell(cp+1);
+ return (0);
+ }
+ cp2 = word;
+ while (*cp != '\0' && strchr(" \t0123456789$^.:/-+*'\"", *cp) == NULL)
+ *cp2++ = *cp++;
+ *cp2 = '\0';
+
+ /*
+ * Look up the command; if not found, bitch.
+ * Normally, a blank command would map to the
+ * first command in the table; while sourcing,
+ * however, we ignore blank lines to eliminate
+ * confusion.
+ */
+
+ if (sourcing && *word == '\0')
+ return (0);
+ com = lex(word);
+ if (com == NULL) {
+ printf("Unknown command: \"%s\"\n", word);
+ goto out;
+ }
+
+ /*
+ * See if we should execute the command -- if a conditional
+ * we always execute it, otherwise, check the state of cond.
+ */
+
+ if ((com->c_argtype & F) == 0)
+ if ((cond == CRCV && !rcvmode) || (cond == CSEND && rcvmode))
+ return (0);
+
+ /*
+ * Process the arguments to the command, depending
+ * on the type he expects. Default to an error.
+ * If we are sourcing an interactive command, it's
+ * an error.
+ */
+
+ if (!rcvmode && (com->c_argtype & M) == 0) {
+ printf("May not execute \"%s\" while sending\n",
+ com->c_name);
+ goto out;
+ }
+ if (sourcing && com->c_argtype & I) {
+ printf("May not execute \"%s\" while sourcing\n",
+ com->c_name);
+ goto out;
+ }
+ if (readonly && com->c_argtype & W) {
+ printf("May not execute \"%s\" -- message file is read only\n",
+ com->c_name);
+ goto out;
+ }
+ if (contxt && com->c_argtype & R) {
+ printf("Cannot recursively invoke \"%s\"\n", com->c_name);
+ goto out;
+ }
+ switch (com->c_argtype & ~(F|P|I|M|T|W|R)) {
+ case MSGLIST:
+ /*
+ * A message list defaulting to nearest forward
+ * legal message.
+ */
+ if (msgvec == 0) {
+ printf("Illegal use of \"message list\"\n");
+ break;
+ }
+ if ((c = getmsglist(cp, msgvec, com->c_msgflag)) < 0)
+ break;
+ if (c == 0) {
+ *msgvec = first(com->c_msgflag, com->c_msgmask);
+ msgvec[1] = 0;
+ }
+ if (*msgvec == 0) {
+ printf("No applicable messages\n");
+ break;
+ }
+ e = (*com->c_func)(msgvec);
+ break;
+
+ case NDMLIST:
+ /*
+ * A message list with no defaults, but no error
+ * if none exist.
+ */
+ if (msgvec == 0) {
+ printf("Illegal use of \"message list\"\n");
+ break;
+ }
+ if (getmsglist(cp, msgvec, com->c_msgflag) < 0)
+ break;
+ e = (*com->c_func)(msgvec);
+ break;
+
+ case STRLIST:
+ /*
+ * Just the straight string, with
+ * leading blanks removed.
+ */
+ while (isspace((unsigned char)*cp))
+ cp++;
+ e = (*com->c_func)(cp);
+ break;
+
+ case RAWLIST:
+ /*
+ * A vector of strings, in shell style.
+ */
+ if ((c = getrawlist(cp, arglist,
+ sizeof(arglist) / sizeof(*arglist))) < 0)
+ break;
+ if (c < com->c_minargs) {
+ printf("%s requires at least %d arg(s)\n",
+ com->c_name, com->c_minargs);
+ break;
+ }
+ if (c > com->c_maxargs) {
+ printf("%s takes no more than %d arg(s)\n",
+ com->c_name, com->c_maxargs);
+ break;
+ }
+ e = (*com->c_func)(arglist);
+ break;
+
+ case NOLIST:
+ /*
+ * Just the constant zero, for exiting,
+ * eg.
+ */
+ e = (*com->c_func)(0);
+ break;
+
+ default:
+ errx(1, "Unknown argtype");
+ }
+
+out:
+ /*
+ * Exit the current source file on
+ * error.
+ */
+ if (e) {
+ if (e < 0)
+ return (1);
+ if (loading)
+ return (1);
+ if (sourcing)
+ unstack();
+ return (0);
+ }
+ if (com == NULL)
+ return (0);
+ if (value("autoprint") != NULL && com->c_argtype & P)
+ if ((dot->m_flag & MDELETED) == 0) {
+ muvec[0] = dot - &message[0] + 1;
+ muvec[1] = 0;
+ type(muvec);
+ }
+ if (!sourcing && (com->c_argtype & T) == 0)
+ sawcom = 1;
+ return (0);
+}
+
+/*
+ * Set the size of the message vector used to construct argument
+ * lists to message list functions.
+ */
+void
+setmsize(int sz)
+{
+
+ if (msgvec != NULL)
+ (void)free(msgvec);
+ msgvec = calloc((unsigned)(sz + 1), sizeof(*msgvec));
+}
+
+/*
+ * Find the correct command in the command table corresponding
+ * to the passed command "word"
+ */
+
+const struct cmd *
+lex(char word[])
+{
+ const struct cmd *cp;
+
+ /*
+ * ignore trailing chars after `#'
+ *
+ * lines with beginning `#' are comments
+ * spaces before `#' are ignored in execute()
+ */
+
+ if (*word == '#')
+ *(word+1) = '\0';
+
+
+ for (cp = &cmdtab[0]; cp->c_name != NULL; cp++)
+ if (isprefix(word, cp->c_name))
+ return (cp);
+ return (NULL);
+}
+
+/*
+ * Determine if as1 is a valid prefix of as2.
+ * Return true if yep.
+ */
+int
+isprefix(const char *as1, const char *as2)
+{
+ const char *s1, *s2;
+
+ s1 = as1;
+ s2 = as2;
+ while (*s1++ == *s2)
+ if (*s2++ == '\0')
+ return (1);
+ return (*--s1 == '\0');
+}
+
+/*
+ * The following gets called on receipt of an interrupt. This is
+ * to abort printout of a command, mainly.
+ * Dispatching here when command() is inactive crashes rcv.
+ * Close all open files except 0, 1, 2, and the temporary.
+ * Also, unstack all source files.
+ */
+
+static int inithdr; /* am printing startup headers */
+
+void
+intr(int s __unused)
+{
+
+ noreset = 0;
+ if (!inithdr)
+ sawcom++;
+ inithdr = 0;
+ while (sourcing)
+ unstack();
+
+ close_all_files();
+
+ if (image >= 0) {
+ (void)close(image);
+ image = -1;
+ }
+ fprintf(stderr, "Interrupt\n");
+ reset(0);
+}
+
+/*
+ * When we wake up after ^Z, reprint the prompt.
+ */
+void
+stop(int s)
+{
+ sig_t old_action = signal(s, SIG_DFL);
+ sigset_t nset;
+
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, s);
+ (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);
+ (void)kill(0, s);
+ (void)sigprocmask(SIG_BLOCK, &nset, NULL);
+ (void)signal(s, old_action);
+ if (reset_on_stop) {
+ reset_on_stop = 0;
+ reset(0);
+ }
+}
+
+/*
+ * Branch here on hangup signal and simulate "exit".
+ */
+void
+hangup(int s __unused)
+{
+
+ /* nothing to do? */
+ exit(1);
+}
+
+/*
+ * Announce the presence of the current Mail version,
+ * give the message count, and print a header listing.
+ */
+void
+announce(void)
+{
+ int vec[2], mdot;
+
+ mdot = newfileinfo(0);
+ vec[0] = mdot;
+ vec[1] = 0;
+ dot = &message[mdot - 1];
+ if (msgCount > 0 && value("noheader") == NULL) {
+ inithdr++;
+ headers(vec);
+ inithdr = 0;
+ }
+}
+
+/*
+ * Announce information about the file we are editing.
+ * Return a likely place to set dot.
+ */
+int
+newfileinfo(int omsgCount)
+{
+ struct message *mp;
+ int u, n, mdot, d, s;
+ char fname[PATHSIZE+1], zname[PATHSIZE+1], *ename;
+
+ for (mp = &message[omsgCount]; mp < &message[msgCount]; mp++)
+ if (mp->m_flag & MNEW)
+ break;
+ if (mp >= &message[msgCount])
+ for (mp = &message[omsgCount]; mp < &message[msgCount]; mp++)
+ if ((mp->m_flag & MREAD) == 0)
+ break;
+ if (mp < &message[msgCount])
+ mdot = mp - &message[0] + 1;
+ else
+ mdot = omsgCount + 1;
+ s = d = 0;
+ for (mp = &message[0], n = 0, u = 0; mp < &message[msgCount]; mp++) {
+ if (mp->m_flag & MNEW)
+ n++;
+ if ((mp->m_flag & MREAD) == 0)
+ u++;
+ if (mp->m_flag & MDELETED)
+ d++;
+ if (mp->m_flag & MSAVED)
+ s++;
+ }
+ ename = mailname;
+ if (getfold(fname, sizeof(fname) - 1) >= 0) {
+ strcat(fname, "/");
+ if (strncmp(fname, mailname, strlen(fname)) == 0) {
+ (void)snprintf(zname, sizeof(zname), "+%s",
+ mailname + strlen(fname));
+ ename = zname;
+ }
+ }
+ printf("\"%s\": ", ename);
+ if (msgCount == 1)
+ printf("1 message");
+ else
+ printf("%d messages", msgCount);
+ if (n > 0)
+ printf(" %d new", n);
+ if (u-n > 0)
+ printf(" %d unread", u);
+ if (d > 0)
+ printf(" %d deleted", d);
+ if (s > 0)
+ printf(" %d saved", s);
+ if (readonly)
+ printf(" [Read only]");
+ printf("\n");
+ return (mdot);
+}
+
+/*
+ * Print the current version number.
+ */
+
+int
+pversion(int e __unused)
+{
+
+ printf("Version %s\n", version);
+ return (0);
+}
+
+/*
+ * Load a file of user definitions.
+ */
+void
+load(char *name)
+{
+ FILE *in, *oldin;
+
+ if ((in = Fopen(name, "r")) == NULL)
+ return;
+ oldin = input;
+ input = in;
+ loading = 1;
+ sourcing = 1;
+ commands();
+ loading = 0;
+ sourcing = 0;
+ input = oldin;
+ (void)Fclose(in);
+}
diff --git a/usr.bin/mail/list.c b/usr.bin/mail/list.c
new file mode 100644
index 0000000..3a5cc15
--- /dev/null
+++ b/usr.bin/mail/list.c
@@ -0,0 +1,816 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <ctype.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Message list handling.
+ */
+
+/*
+ * Convert the user string of message numbers and
+ * store the numbers into vector.
+ *
+ * Returns the count of messages picked up or -1 on error.
+ */
+int
+getmsglist(char *buf, int *vector, int flags)
+{
+ int *ip;
+ struct message *mp;
+
+ if (msgCount == 0) {
+ *vector = 0;
+ return (0);
+ }
+ if (markall(buf, flags) < 0)
+ return (-1);
+ ip = vector;
+ for (mp = &message[0]; mp < &message[msgCount]; mp++)
+ if (mp->m_flag & MMARK)
+ *ip++ = mp - &message[0] + 1;
+ *ip = 0;
+ return (ip - vector);
+}
+
+/*
+ * Mark all messages that the user wanted from the command
+ * line in the message structure. Return 0 on success, -1
+ * on error.
+ */
+
+/*
+ * Bit values for colon modifiers.
+ */
+
+#define CMNEW 01 /* New messages */
+#define CMOLD 02 /* Old messages */
+#define CMUNREAD 04 /* Unread messages */
+#define CMDELETED 010 /* Deleted messages */
+#define CMREAD 020 /* Read messages */
+
+/*
+ * The following table describes the letters which can follow
+ * the colon and gives the corresponding modifier bit.
+ */
+
+static struct coltab {
+ char co_char; /* What to find past : */
+ int co_bit; /* Associated modifier bit */
+ int co_mask; /* m_status bits to mask */
+ int co_equal; /* ... must equal this */
+} coltab[] = {
+ { 'n', CMNEW, MNEW, MNEW },
+ { 'o', CMOLD, MNEW, 0 },
+ { 'u', CMUNREAD, MREAD, 0 },
+ { 'd', CMDELETED, MDELETED, MDELETED},
+ { 'r', CMREAD, MREAD, MREAD },
+ { 0, 0, 0, 0 }
+};
+
+static int lastcolmod;
+
+int
+markall(char buf[], int f)
+{
+ char **np;
+ int i;
+ struct message *mp;
+ char *namelist[NMLSIZE], *bufp;
+ int tok, beg, mc, star, other, valdot, colmod, colresult;
+
+ valdot = dot - &message[0] + 1;
+ colmod = 0;
+ for (i = 1; i <= msgCount; i++)
+ unmark(i);
+ bufp = buf;
+ mc = 0;
+ np = &namelist[0];
+ scaninit();
+ tok = scan(&bufp);
+ star = 0;
+ other = 0;
+ beg = 0;
+ while (tok != TEOL) {
+ switch (tok) {
+ case TNUMBER:
+number:
+ if (star) {
+ printf("No numbers mixed with *\n");
+ return (-1);
+ }
+ mc++;
+ other++;
+ if (beg != 0) {
+ if (check(lexnumber, f))
+ return (-1);
+ for (i = beg; i <= lexnumber; i++)
+ if (f == MDELETED || (message[i - 1].m_flag & MDELETED) == 0)
+ mark(i);
+ beg = 0;
+ break;
+ }
+ beg = lexnumber;
+ if (check(beg, f))
+ return (-1);
+ tok = scan(&bufp);
+ regret(tok);
+ if (tok != TDASH) {
+ mark(beg);
+ beg = 0;
+ }
+ break;
+
+ case TPLUS:
+ if (beg != 0) {
+ printf("Non-numeric second argument\n");
+ return (-1);
+ }
+ i = valdot;
+ do {
+ i++;
+ if (i > msgCount) {
+ printf("Referencing beyond EOF\n");
+ return (-1);
+ }
+ } while ((message[i - 1].m_flag & MDELETED) != f);
+ mark(i);
+ break;
+
+ case TDASH:
+ if (beg == 0) {
+ i = valdot;
+ do {
+ i--;
+ if (i <= 0) {
+ printf("Referencing before 1\n");
+ return (-1);
+ }
+ } while ((message[i - 1].m_flag & MDELETED) != f);
+ mark(i);
+ }
+ break;
+
+ case TSTRING:
+ if (beg != 0) {
+ printf("Non-numeric second argument\n");
+ return (-1);
+ }
+ other++;
+ if (lexstring[0] == ':') {
+ colresult = evalcol(lexstring[1]);
+ if (colresult == 0) {
+ printf("Unknown colon modifier \"%s\"\n",
+ lexstring);
+ return (-1);
+ }
+ colmod |= colresult;
+ }
+ else
+ *np++ = savestr(lexstring);
+ break;
+
+ case TDOLLAR:
+ case TUP:
+ case TDOT:
+ lexnumber = metamess(lexstring[0], f);
+ if (lexnumber == -1)
+ return (-1);
+ goto number;
+
+ case TSTAR:
+ if (other) {
+ printf("Can't mix \"*\" with anything\n");
+ return (-1);
+ }
+ star++;
+ break;
+
+ case TERROR:
+ return (-1);
+ }
+ tok = scan(&bufp);
+ }
+ lastcolmod = colmod;
+ *np = NULL;
+ mc = 0;
+ if (star) {
+ for (i = 0; i < msgCount; i++)
+ if ((message[i].m_flag & MDELETED) == f) {
+ mark(i+1);
+ mc++;
+ }
+ if (mc == 0) {
+ printf("No applicable messages.\n");
+ return (-1);
+ }
+ return (0);
+ }
+
+ /*
+ * If no numbers were given, mark all of the messages,
+ * so that we can unmark any whose sender was not selected
+ * if any user names were given.
+ */
+
+ if ((np > namelist || colmod != 0) && mc == 0)
+ for (i = 1; i <= msgCount; i++)
+ if ((message[i-1].m_flag & MDELETED) == f)
+ mark(i);
+
+ /*
+ * If any names were given, go through and eliminate any
+ * messages whose senders were not requested.
+ */
+
+ if (np > namelist) {
+ for (i = 1; i <= msgCount; i++) {
+ for (mc = 0, np = &namelist[0]; *np != NULL; np++)
+ if (**np == '/') {
+ if (matchfield(*np, i)) {
+ mc++;
+ break;
+ }
+ }
+ else {
+ if (matchsender(*np, i)) {
+ mc++;
+ break;
+ }
+ }
+ if (mc == 0)
+ unmark(i);
+ }
+
+ /*
+ * Make sure we got some decent messages.
+ */
+
+ mc = 0;
+ for (i = 1; i <= msgCount; i++)
+ if (message[i-1].m_flag & MMARK) {
+ mc++;
+ break;
+ }
+ if (mc == 0) {
+ printf("No applicable messages from {%s",
+ namelist[0]);
+ for (np = &namelist[1]; *np != NULL; np++)
+ printf(", %s", *np);
+ printf("}\n");
+ return (-1);
+ }
+ }
+
+ /*
+ * If any colon modifiers were given, go through and
+ * unmark any messages which do not satisfy the modifiers.
+ */
+
+ if (colmod != 0) {
+ for (i = 1; i <= msgCount; i++) {
+ struct coltab *colp;
+
+ mp = &message[i - 1];
+ for (colp = &coltab[0]; colp->co_char != '\0'; colp++)
+ if (colp->co_bit & colmod)
+ if ((mp->m_flag & colp->co_mask)
+ != colp->co_equal)
+ unmark(i);
+
+ }
+ for (mp = &message[0]; mp < &message[msgCount]; mp++)
+ if (mp->m_flag & MMARK)
+ break;
+ if (mp >= &message[msgCount]) {
+ struct coltab *colp;
+
+ printf("No messages satisfy");
+ for (colp = &coltab[0]; colp->co_char != '\0'; colp++)
+ if (colp->co_bit & colmod)
+ printf(" :%c", colp->co_char);
+ printf("\n");
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+/*
+ * Turn the character after a colon modifier into a bit
+ * value.
+ */
+int
+evalcol(int col)
+{
+ struct coltab *colp;
+
+ if (col == 0)
+ return (lastcolmod);
+ for (colp = &coltab[0]; colp->co_char != '\0'; colp++)
+ if (colp->co_char == col)
+ return (colp->co_bit);
+ return (0);
+}
+
+/*
+ * Check the passed message number for legality and proper flags.
+ * If f is MDELETED, then either kind will do. Otherwise, the message
+ * has to be undeleted.
+ */
+int
+check(int mesg, int f)
+{
+ struct message *mp;
+
+ if (mesg < 1 || mesg > msgCount) {
+ printf("%d: Invalid message number\n", mesg);
+ return (-1);
+ }
+ mp = &message[mesg-1];
+ if (f != MDELETED && (mp->m_flag & MDELETED) != 0) {
+ printf("%d: Inappropriate message\n", mesg);
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * Scan out the list of string arguments, shell style
+ * for a RAWLIST.
+ */
+int
+getrawlist(char line[], char **argv, int argc)
+{
+ char c, *cp, *cp2, quotec;
+ int argn;
+ char *linebuf;
+ size_t linebufsize = BUFSIZ;
+
+ if ((linebuf = malloc(linebufsize)) == NULL)
+ err(1, "Out of memory");
+
+ argn = 0;
+ cp = line;
+ for (;;) {
+ for (; *cp == ' ' || *cp == '\t'; cp++)
+ ;
+ if (*cp == '\0')
+ break;
+ if (argn >= argc - 1) {
+ printf(
+ "Too many elements in the list; excess discarded.\n");
+ break;
+ }
+ cp2 = linebuf;
+ quotec = '\0';
+ while ((c = *cp) != '\0') {
+ /* Allocate more space if necessary */
+ if (cp2 - linebuf == linebufsize - 1) {
+ linebufsize += BUFSIZ;
+ if ((linebuf = realloc(linebuf, linebufsize)) == NULL)
+ err(1, "Out of memory");
+ cp2 = linebuf + linebufsize - BUFSIZ - 1;
+ }
+ cp++;
+ if (quotec != '\0') {
+ if (c == quotec)
+ quotec = '\0';
+ else if (c == '\\')
+ switch (c = *cp++) {
+ case '\0':
+ *cp2++ = '\\';
+ cp--;
+ break;
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ c -= '0';
+ if (*cp >= '0' && *cp <= '7')
+ c = c * 8 + *cp++ - '0';
+ if (*cp >= '0' && *cp <= '7')
+ c = c * 8 + *cp++ - '0';
+ *cp2++ = c;
+ break;
+ case 'b':
+ *cp2++ = '\b';
+ break;
+ case 'f':
+ *cp2++ = '\f';
+ break;
+ case 'n':
+ *cp2++ = '\n';
+ break;
+ case 'r':
+ *cp2++ = '\r';
+ break;
+ case 't':
+ *cp2++ = '\t';
+ break;
+ case 'v':
+ *cp2++ = '\v';
+ break;
+ default:
+ *cp2++ = c;
+ }
+ else if (c == '^') {
+ c = *cp++;
+ if (c == '?')
+ *cp2++ = '\177';
+ /* null doesn't show up anyway */
+ else if ((c >= 'A' && c <= '_') ||
+ (c >= 'a' && c <= 'z'))
+ *cp2++ = c & 037;
+ else {
+ *cp2++ = '^';
+ cp--;
+ }
+ } else
+ *cp2++ = c;
+ } else if (c == '"' || c == '\'')
+ quotec = c;
+ else if (c == ' ' || c == '\t')
+ break;
+ else
+ *cp2++ = c;
+ }
+ *cp2 = '\0';
+ argv[argn++] = savestr(linebuf);
+ }
+ argv[argn] = NULL;
+ (void)free(linebuf);
+ return (argn);
+}
+
+/*
+ * scan out a single lexical item and return its token number,
+ * updating the string pointer passed **p. Also, store the value
+ * of the number or string scanned in lexnumber or lexstring as
+ * appropriate. In any event, store the scanned `thing' in lexstring.
+ */
+
+static struct lex {
+ char l_char;
+ char l_token;
+} singles[] = {
+ { '$', TDOLLAR },
+ { '.', TDOT },
+ { '^', TUP },
+ { '*', TSTAR },
+ { '-', TDASH },
+ { '+', TPLUS },
+ { '(', TOPEN },
+ { ')', TCLOSE },
+ { 0, 0 }
+};
+
+int
+scan(char **sp)
+{
+ char *cp, *cp2;
+ int c;
+ struct lex *lp;
+ int quotec;
+
+ if (regretp >= 0) {
+ strcpy(lexstring, string_stack[regretp]);
+ lexnumber = numberstack[regretp];
+ return (regretstack[regretp--]);
+ }
+ cp = *sp;
+ cp2 = lexstring;
+ c = *cp++;
+
+ /*
+ * strip away leading white space.
+ */
+
+ while (c == ' ' || c == '\t')
+ c = *cp++;
+
+ /*
+ * If no characters remain, we are at end of line,
+ * so report that.
+ */
+
+ if (c == '\0') {
+ *sp = --cp;
+ return (TEOL);
+ }
+
+ /*
+ * If the leading character is a digit, scan
+ * the number and convert it on the fly.
+ * Return TNUMBER when done.
+ */
+
+ if (isdigit((unsigned char)c)) {
+ lexnumber = 0;
+ while (isdigit((unsigned char)c)) {
+ lexnumber = lexnumber*10 + c - '0';
+ *cp2++ = c;
+ c = *cp++;
+ }
+ *cp2 = '\0';
+ *sp = --cp;
+ return (TNUMBER);
+ }
+
+ /*
+ * Check for single character tokens; return such
+ * if found.
+ */
+
+ for (lp = &singles[0]; lp->l_char != '\0'; lp++)
+ if (c == lp->l_char) {
+ lexstring[0] = c;
+ lexstring[1] = '\0';
+ *sp = cp;
+ return (lp->l_token);
+ }
+
+ /*
+ * We've got a string! Copy all the characters
+ * of the string into lexstring, until we see
+ * a null, space, or tab.
+ * If the lead character is a " or ', save it
+ * and scan until you get another.
+ */
+
+ quotec = 0;
+ if (c == '\'' || c == '"') {
+ quotec = c;
+ c = *cp++;
+ }
+ while (c != '\0') {
+ if (c == quotec) {
+ cp++;
+ break;
+ }
+ if (quotec == 0 && (c == ' ' || c == '\t'))
+ break;
+ if (cp2 - lexstring < STRINGLEN-1)
+ *cp2++ = c;
+ c = *cp++;
+ }
+ if (quotec && c == '\0') {
+ fprintf(stderr, "Missing %c\n", quotec);
+ return (TERROR);
+ }
+ *sp = --cp;
+ *cp2 = '\0';
+ return (TSTRING);
+}
+
+/*
+ * Unscan the named token by pushing it onto the regret stack.
+ */
+void
+regret(int token)
+{
+ if (++regretp >= REGDEP)
+ errx(1, "Too many regrets");
+ regretstack[regretp] = token;
+ lexstring[STRINGLEN-1] = '\0';
+ string_stack[regretp] = savestr(lexstring);
+ numberstack[regretp] = lexnumber;
+}
+
+/*
+ * Reset all the scanner global variables.
+ */
+void
+scaninit(void)
+{
+ regretp = -1;
+}
+
+/*
+ * Find the first message whose flags & m == f and return
+ * its message number.
+ */
+int
+first(int f, int m)
+{
+ struct message *mp;
+
+ if (msgCount == 0)
+ return (0);
+ f &= MDELETED;
+ m &= MDELETED;
+ for (mp = dot; mp < &message[msgCount]; mp++)
+ if ((mp->m_flag & m) == f)
+ return (mp - message + 1);
+ for (mp = dot-1; mp >= &message[0]; mp--)
+ if ((mp->m_flag & m) == f)
+ return (mp - message + 1);
+ return (0);
+}
+
+/*
+ * See if the passed name sent the passed message number. Return true
+ * if so.
+ */
+int
+matchsender(char *str, int mesg)
+{
+ char *cp;
+
+ /* null string matches nothing instead of everything */
+ if (*str == '\0')
+ return (0);
+
+ cp = nameof(&message[mesg - 1], 0);
+ return (strcasestr(cp, str) != NULL);
+}
+
+/*
+ * See if the passed name received the passed message number. Return true
+ * if so.
+ */
+
+static char *to_fields[] = { "to", "cc", "bcc", NULL };
+
+static int
+matchto(char *str, int mesg)
+{
+ struct message *mp;
+ char *cp, **to;
+
+ str++;
+
+ /* null string matches nothing instead of everything */
+ if (*str == '\0')
+ return (0);
+
+ mp = &message[mesg - 1];
+
+ for (to = to_fields; *to != NULL; to++) {
+ cp = hfield(*to, mp);
+ if (cp != NULL && strcasestr(cp, str) != NULL)
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * See if the given substring is contained within the specified field. If
+ * 'searchheaders' is set, then the form '/x:y' will be accepted and matches
+ * any message with the substring 'y' in field 'x'. If 'x' is omitted or
+ * 'searchheaders' is not set, then the search matches any messages
+ * with the substring 'y' in the 'Subject'. The search is case insensitive.
+ *
+ * The form '/to:y' is a special case, and will match all messages
+ * containing the substring 'y' in the 'To', 'Cc', or 'Bcc' header
+ * fields. The search for 'to' is case sensitive, so that '/To:y' can
+ * be used to limit the search to just the 'To' field.
+ */
+
+static char lastscan[STRINGLEN];
+int
+matchfield(char *str, int mesg)
+{
+ struct message *mp;
+ char *cp, *cp2;
+
+ str++;
+ if (*str == '\0')
+ str = lastscan;
+ else
+ strlcpy(lastscan, str, sizeof(lastscan));
+ mp = &message[mesg-1];
+
+ /*
+ * Now look, ignoring case, for the word in the string.
+ */
+
+ if (value("searchheaders") && (cp = strchr(str, ':')) != NULL) {
+ /* Check for special case "/to:" */
+ if (strncmp(str, "to:", 3) == 0)
+ return (matchto(cp, mesg));
+ *cp++ = '\0';
+ cp2 = hfield(*str != '\0' ? str : "subject", mp);
+ cp[-1] = ':';
+ str = cp;
+ cp = cp2;
+ } else
+ cp = hfield("subject", mp);
+
+ if (cp == NULL)
+ return (0);
+
+ return (strcasestr(cp, str) != NULL);
+}
+
+/*
+ * Mark the named message by setting its mark bit.
+ */
+void
+mark(int mesg)
+{
+ int i;
+
+ i = mesg;
+ if (i < 1 || i > msgCount)
+ errx(1, "Bad message number to mark");
+ message[i-1].m_flag |= MMARK;
+}
+
+/*
+ * Unmark the named message.
+ */
+void
+unmark(int mesg)
+{
+ int i;
+
+ i = mesg;
+ if (i < 1 || i > msgCount)
+ errx(1, "Bad message number to unmark");
+ message[i-1].m_flag &= ~MMARK;
+}
+
+/*
+ * Return the message number corresponding to the passed meta character.
+ */
+int
+metamess(int meta, int f)
+{
+ int c, m;
+ struct message *mp;
+
+ c = meta;
+ switch (c) {
+ case '^':
+ /*
+ * First 'good' message left.
+ */
+ for (mp = &message[0]; mp < &message[msgCount]; mp++)
+ if ((mp->m_flag & MDELETED) == f)
+ return (mp - &message[0] + 1);
+ printf("No applicable messages\n");
+ return (-1);
+
+ case '$':
+ /*
+ * Last 'good message left.
+ */
+ for (mp = &message[msgCount-1]; mp >= &message[0]; mp--)
+ if ((mp->m_flag & MDELETED) == f)
+ return (mp - &message[0] + 1);
+ printf("No applicable messages\n");
+ return (-1);
+
+ case '.':
+ /*
+ * Current message.
+ */
+ m = dot - &message[0] + 1;
+ if ((dot->m_flag & MDELETED) != f) {
+ printf("%d: Inappropriate message\n", m);
+ return (-1);
+ }
+ return (m);
+
+ default:
+ printf("Unknown metachar (%c)\n", c);
+ return (-1);
+ }
+}
diff --git a/usr.bin/mail/mail.1 b/usr.bin/mail/mail.1
new file mode 100644
index 0000000..3c3a23e
--- /dev/null
+++ b/usr.bin/mail/mail.1
@@ -0,0 +1,1280 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)mail.1 8.8 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd January 5, 2006
+.Dt MAIL 1
+.Os
+.Sh NAME
+.Nm mail ,
+.Nm Mail ,
+.Nm mailx
+.Nd send and receive mail
+.Sh SYNOPSIS
+.Nm
+.Op Fl dEiInv
+.Op Fl s Ar subject
+.Op Fl c Ar cc-addr
+.Op Fl b Ar bcc-addr
+.Op Fl F
+.Ar to-addr ...
+.Op Fl Ar sendmail-option ...
+.Nm
+.Op Fl dEHiInNv
+.Op Fl F
+.Fl f
+.Op Ar name
+.Nm
+.Op Fl dEHiInNv
+.Op Fl F
+.Op Fl u Ar user
+.Nm
+.Op Fl d
+.Fl e
+.Op Fl f Ar name
+.Sh INTRODUCTION
+The
+.Nm
+utility is an intelligent mail processing system, which has
+a command syntax reminiscent of
+.Xr ed 1
+with lines replaced by messages.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl v
+Verbose mode.
+The details of
+delivery are displayed on the user's terminal.
+.It Fl d
+Debugging mode.
+See the
+.Va debug
+mail option for details.
+.It Fl e
+Test for the presence of mail in the (by default, system)
+mailbox.
+An exit status of 0 is returned if
+it has mail; otherwise, an exit status
+of 1 is returned.
+.It Fl H
+Write a header summary only, then exit.
+.It Fl E
+Do not send messages with an empty body.
+This is useful for piping errors from
+.Xr cron 8
+scripts.
+.It Fl i
+Ignore tty interrupt signals.
+This is
+particularly useful when using
+.Nm
+on noisy phone lines.
+.It Fl I
+Force
+.Nm
+to run in interactive mode even when
+input is not a terminal.
+In particular, the
+.Ql ~
+special
+character when sending mail is only active in interactive mode.
+.It Fl n
+Inhibit reading the system-wide
+.Pa mail.rc
+files upon startup.
+.It Fl N
+Inhibit the initial display of message headers
+when reading mail or editing a mail folder.
+.It Fl s Ar subject
+Specify
+.Ar subject
+on command line.
+(Only the first argument after the
+.Fl s
+flag is used as a subject; be careful to quote subjects
+containing spaces.)
+.It Fl c Ar cc-addr
+Send carbon copies to
+.Ar cc-addr
+list of users.
+The
+.Ar cc-addr
+argument should be a comma-separated list of names.
+.It Fl b Ar bcc-addr
+Send blind carbon copies to
+.Ar bcc-addr
+list of users.
+The
+.Ar bcc-addr
+argument should be a comma-separated list of names.
+.It Fl f Op Ar mbox
+Read in the contents of your
+.Pa mbox
+(or the specified file)
+for processing; when you
+.Ic quit ,
+.Nm
+writes undeleted messages back to this file.
+.It Fl F
+Record the message in a file named after the first
+recipient.
+The name is the login-name portion of the
+address found first on the
+.Dq Li To:
+line in the mail header.
+Overrides the
+.Va record
+variable, if set.
+.It Fl u Ar user
+Is equivalent to:
+.Pp
+.Dl "mail -f /var/mail/user"
+.El
+.Ss "Startup Actions"
+At startup time
+.Nm
+will execute commands in the system command files
+.Pa /usr/share/misc/mail.rc ,
+.Pa /usr/local/etc/mail.rc
+and
+.Pa /etc/mail.rc
+in order, unless explicitly told not to by the use of the
+.Fl n
+option.
+Next, the commands in the user's personal command file
+.Pa ~/.mailrc
+are executed.
+The
+.Nm
+utility then examines its command line options to determine whether a
+new message is to be sent, or whether an existing mailbox is to
+be read.
+.Ss "Sending Mail"
+To send a message to one or more people,
+.Nm
+can be invoked with arguments which are the names of people to
+whom the mail will be sent.
+You are then expected to type in
+your message, followed
+by a
+.Aq Li control-D
+at the beginning of a line.
+The section below
+.Sx "Replying To or Originating Mail" ,
+describes some features of
+.Nm
+available to help you compose your letter.
+.Ss "Reading Mail"
+In normal usage
+.Nm
+is given no arguments and checks your mail out of the
+post office, then
+prints out a one line header of each message found.
+The current message is initially the first message (numbered 1)
+and can be printed using the
+.Ic print
+command (which can be abbreviated
+.Ic p ) .
+You can move among the messages much as you move between lines in
+.Xr ed 1 ,
+with the commands
+.Ic +
+and
+.Ic \-
+moving backwards and forwards, and
+simple numbers.
+.Ss "Disposing of Mail"
+After examining a message you can
+.Ic delete
+.Pq Ic d
+the message or
+.Ic reply
+.Pq Ic r
+to it.
+Deletion causes the
+.Nm
+program to forget about the message.
+This is not irreversible; the message can be
+.Ic undeleted
+.Pq Ic u
+by giving its number, or the
+.Nm
+session can be aborted by giving the
+.Ic exit
+.Pq Ic x
+command.
+Deleted messages will, however, usually disappear never to be seen again.
+.Ss "Specifying Messages"
+Commands such as
+.Ic print
+and
+.Ic delete
+can be given a list of message numbers as arguments to apply
+to a number of messages at once.
+Thus
+.Dq Li "delete 1 2"
+deletes messages 1 and 2, while
+.Dq Li "delete 1\-5"
+deletes messages 1 through 5.
+The special name
+.Ql *
+addresses all messages, and
+.Ql $
+addresses
+the last message; thus the command
+.Ic top
+which prints the first few lines of a message could be used in
+.Dq Li "top *"
+to print the first few lines of all messages.
+.Ss "Replying To or Originating Mail"
+You can use the
+.Ic reply
+command to
+set up a response to a message, sending it back to the
+person who it was from.
+Text you then type in, up to an end-of-file,
+defines the contents of the message.
+While you are composing a message,
+.Nm
+treats lines beginning with the character
+.Ql ~
+specially.
+For instance, typing
+.Ic ~m
+(alone on a line) will place a copy
+of the current message into the response right shifting it by a tabstop
+(see
+.Va indentprefix
+variable, below).
+Other escapes will set up subject fields, add and delete recipients
+to the message and allow you to escape to an editor to revise the
+message or to a shell to run some commands.
+(These options
+are given in the summary below.)
+.Ss "Ending a Mail Processing Session"
+You can end a
+.Nm
+session with the
+.Ic quit
+.Pq Ic q
+command.
+Messages which have been examined go to your
+.Pa mbox
+file unless they have been deleted in which case they are discarded.
+Unexamined messages go back to the post office.
+(See the
+.Fl f
+option above).
+.Ss "Personal and System Wide Distribution Lists"
+It is also possible to create a personal distribution lists so that,
+for instance, you can send mail to
+.Dq Li cohorts
+and have it go
+to a group of people.
+Such lists can be defined by placing a line like
+.Pp
+.Dl "alias cohorts bill ozalp jkf mark kridle@ucbcory"
+.Pp
+in the file
+.Pa .mailrc
+in your home directory.
+The current list of such aliases can be displayed with the
+.Ic alias
+command in
+.Nm .
+System wide distribution lists can be created by editing
+.Pa /etc/mail/aliases ,
+see
+.Xr aliases 5
+and
+.Xr sendmail 8 ;
+these are kept in a different syntax.
+In mail you send, personal aliases will be expanded in mail sent
+to others so that they will be able to
+.Ic reply
+to the recipients.
+System wide
+aliases
+are not expanded when the mail is sent,
+but any reply returned to the machine will have the system wide
+alias expanded as all mail goes through
+.Xr sendmail 8 .
+.Ss "Network Mail (ARPA, UUCP, Berknet)"
+See
+.Xr mailaddr 7
+for a description of network addresses.
+.Pp
+The
+.Nm
+utility has a number of options which can be set in the
+.Pa .mailrc
+file to alter its behavior; thus
+.Dq Li "set askcc"
+enables the
+.Va askcc
+feature.
+(These options are summarized below.)
+.Sh SUMMARY
+(Adapted from the
+.%T "Mail Reference Manual" . )
+.Pp
+Each command is typed on a line by itself, and may take arguments
+following the command word.
+The command need not be typed in its
+entirety \(em the first command which matches the typed prefix is used.
+For commands which take message lists as arguments, if no message
+list is given, then the next message forward which satisfies the
+command's requirements is used.
+If there are no messages forward of
+the current message, the search proceeds backwards, and if there are no
+good messages at all,
+.Nm
+types
+.Dq Li "No applicable messages"
+and
+aborts the command.
+.Bl -tag -width indent
+.It Ic \-
+Print out the preceding message.
+If given a numeric
+argument
+.Ar n ,
+goes to the
+.Ar n Ns 'th
+previous message and prints it.
+.It Ic #
+ignore the remainder of the line as a comment.
+.It Ic \&?
+Prints a brief summary of commands.
+.It Ic \&!
+Executes the shell
+(see
+.Xr sh 1
+and
+.Xr csh 1 )
+command which follows.
+.It Ic Print
+.Pq Ic P
+Like
+.Ic print
+but also prints out ignored header fields.
+See also
+.Ic print , ignore
+and
+.Ic retain .
+.It Ic Reply
+.Pq Ic R
+Reply to originator.
+Does not reply to other
+recipients of the original message.
+.It Ic Type
+.Pq Ic T
+Identical to the
+.Ic Print
+command.
+.It Ic alias
+.Pq Ic a
+With no arguments, prints out all currently-defined aliases.
+With one
+argument, prints out that alias.
+With more than one argument, creates
+a new alias or changes an old one.
+.It Ic alternates
+.Pq Ic alt
+The
+.Ic alternates
+command is useful if you have accounts on several machines.
+It can be used to inform
+.Nm
+that the listed addresses are really you.
+When you
+.Ic reply
+to messages,
+.Nm
+will not send a copy of the message to any of the addresses
+listed on the
+.Ic alternates
+list.
+If the
+.Ic alternates
+command is given with no argument, the current set of alternative
+names is displayed.
+.It Ic chdir
+.Pq Ic c
+Changes the user's working directory to that specified, if given.
+If
+no directory is given, then changes to the user's login directory.
+.It Ic copy
+.Pq Ic co
+The
+.Ic copy
+command does the same thing that
+.Ic save
+does, except that it does not mark the messages it
+is used on for deletion when you
+.Ic quit .
+.It Ic delete
+.Pq Ic d
+Takes a list of messages as argument and marks them all as deleted.
+Deleted messages will not be saved in
+.Pa mbox ,
+nor will they be available for most other commands.
+.It Ic dp
+(also
+.Ic dt )
+Deletes the current message and prints the next message.
+If there is no next message,
+.Nm
+says
+.Dq Li "at EOF" .
+.It Ic edit
+.Pq Ic e
+Takes a list of messages and points the text editor at each one in
+turn.
+On return from the editor, the message is read back in.
+.It Ic exit
+.Ic ( ex
+or
+.Ic x )
+Effects an immediate return to the shell without
+modifying the user's system mailbox, his
+.Pa mbox
+file, or his edit file in
+.Fl f .
+.It Ic file
+.Pq Ic fi
+The same as
+.Ic folder .
+.It Ic folders
+List the names of the folders in your folder directory.
+.It Ic folder
+.Pq Ic fo
+The
+.Ic folder
+command switches to a new mail file or folder.
+With no
+arguments, it tells you which file you are currently reading.
+If you give it an argument, it will write out changes (such
+as deletions) you have made in the current file and read in
+the new file.
+Some special conventions are recognized for
+the name.
+.Ql #
+means the previous file,
+.Ql %
+means your system mailbox,
+.Dq Li % Ns Ar user
+means user's system mailbox,
+.Ql &
+means your
+.Pa mbox
+file, and
+.Dq Li + Ns Ar folder
+means a file in your folder
+directory.
+.It Ic from
+.Pq Ic f
+Takes a list of messages and prints their message headers.
+.It Ic headers
+.Pq Ic h
+Lists the current range of headers, which is an 18-message group.
+If
+a
+.Ql +
+argument is given, then the next 18-message group is printed, and if
+a
+.Ql \-
+argument is given, the previous 18-message group is printed.
+.It Ic help
+A synonym for
+.Ic \&? .
+.It Ic hold
+.Ic ( ho ,
+also
+.Ic preserve )
+Takes a message list and marks each
+message therein to be saved in the
+user's system mailbox instead of in
+.Pa mbox .
+Does not override the
+.Ic delete
+command.
+.It Ic ignore
+Add the list of header fields named to the
+.Ar ignored list .
+Header fields in the ignore list are not printed
+on your terminal when you print a message.
+This
+command is very handy for suppression of certain machine-generated
+header fields.
+The
+.Ic Type
+and
+.Ic Print
+commands can be used to print a message in its entirety, including
+ignored fields.
+If
+.Ic ignore
+is executed with no arguments, it lists the current set of
+ignored fields.
+.It Ic inc
+Incorporate any new messages that have arrived while mail
+is being read.
+The new messages are added to the end of the message list,
+and the current message is reset to be the first new mail message.
+This does not renumber the existing message list, nor
+does it cause any changes made so far to be saved.
+.It Ic mail
+.Pq Ic m
+Takes as argument login names and distribution group names and sends
+mail to those people.
+.It Ic mbox
+Indicate that a list of messages be sent to
+.Pa mbox
+in your home directory when you quit.
+This is the default
+action for messages if you do
+.Em not
+have the
+.Ic hold
+option set.
+.It Ic more
+.Pq Ic mo
+Takes a list of messages and invokes the pager on that list.
+.It Ic next
+.Ic ( n ,
+like
+.Ic +
+or
+.Tn CR )
+Goes to the next message in sequence and types it.
+With an argument list, types the next matching message.
+.It Ic preserve
+.Pq Ic pre
+A synonym for
+.Ic hold .
+.It Ic print
+.Pq Ic p
+Takes a message list and types out each message on the user's terminal.
+.It Ic quit
+.Pq Ic q
+Terminates the session, saving all undeleted, unsaved messages in
+the user's
+.Pa mbox
+file in his login directory, preserving all messages marked with
+.Ic hold
+or
+.Ic preserve
+or never referenced
+in his system mailbox, and removing all other messages from his system
+mailbox.
+If new mail has arrived during the session, the message
+.Dq Li "You have new mail"
+is given.
+If given while editing a
+mailbox file with the
+.Fl f
+flag, then the edit file is rewritten.
+A return to the shell is
+effected, unless the rewrite of edit file fails, in which case the user
+can escape with the
+.Ic exit
+command.
+.It Ic reply
+.Pq Ic r
+Takes a message list and sends mail to the sender and all
+recipients of the specified message.
+The default message must not be deleted.
+.It Ic respond
+A synonym for
+.Ic reply .
+.It Ic retain
+Add the list of header fields named to the
+.Em "retained list" .
+Only the header fields in the retained list
+are shown on your terminal when you print a message.
+All other header fields are suppressed.
+The
+.Ic type
+and
+.Ic print
+commands can be used to print a message in its entirety.
+If
+.Ic retain
+is executed with no arguments, it lists the current set of
+retained fields.
+.It Ic save
+.Pq Ic s
+Takes a message list and a filename and appends each message in
+turn to the end of the file.
+The filename in quotes, followed by the line
+count and character count is echoed on the user's terminal.
+.It Ic set
+.Pq Ic se
+With no arguments, prints all variable values.
+Otherwise, sets
+option.
+Arguments are of the form
+.Ar option Ns Li = Ns Ar value
+(no space before or after
+.Ql = )
+or
+.Ar option .
+Quotation marks may be placed around any part of the assignment statement to
+quote blanks or tabs, i.e.\&
+.Dq Li "set indentprefix=\*q->\*q"
+.It Ic saveignore
+.Ic Saveignore
+is to
+.Ic save
+what
+.Ic ignore
+is to
+.Ic print
+and
+.Ic type .
+Header fields thus marked are filtered out when
+saving a message by
+.Ic save
+or when automatically saving to
+.Pa mbox .
+.It Ic saveretain
+.Ic Saveretain
+is to
+.Ic save
+what
+.Ic retain
+is to
+.Ic print
+and
+.Ic type .
+Header fields thus marked are the only ones saved
+with a message when saving by
+.Ic save
+or when automatically saving to
+.Pa mbox .
+.Ic Saveretain
+overrides
+.Ic saveignore .
+.It Ic shell
+.Pq Ic sh
+Invokes an interactive version of the shell.
+.It Ic size
+Takes a message list and prints out the size in characters of each
+message.
+.It Ic source
+The
+.Ic source
+command reads
+commands from a file.
+.It Ic top
+Takes a message list and prints the top few lines of each.
+The number of
+lines printed is controlled by the variable
+.Va toplines
+and defaults to 5.
+.It Ic type
+.Pq Ic t
+A synonym for
+.Ic print .
+.It Ic unalias
+Takes a list of names defined by
+.Ic alias
+commands and discards the remembered groups of users.
+The group names
+no longer have any significance.
+.It Ic undelete
+.Pq Ic u
+Takes a message list and marks each message as
+.Em not
+being deleted.
+.It Ic unread
+.Pq Ic U
+Takes a message list and marks each message as
+.Em not
+having been read.
+.It Ic unset
+Takes a list of option names and discards their remembered values;
+the inverse of
+.Ic set .
+.It Ic visual
+.Pq Ic v
+Takes a message list and invokes the display editor on each message.
+.It Ic write
+.Pq Ic w
+Similar to
+.Ic save ,
+except that
+.Em only
+the message body
+.Em ( without
+the header) is saved.
+Extremely useful for such tasks as sending and receiving source
+program text over the message system.
+.It Ic xit
+.Pq Ic x
+A synonym for
+.Ic exit .
+.It Ic z
+The
+.Nm
+utility presents message headers in windowfuls as described under the
+.Ic headers
+command.
+You can move
+.Nm Ns 's
+attention forward to the next window with the
+.Ic z
+command.
+Also, you can move to the previous window by using
+.Ic z\- .
+.El
+.Ss Tilde/Escapes
+Here is a summary of the tilde escapes,
+which are used when composing messages to perform
+special functions.
+Tilde escapes are only recognized at the beginning
+of lines.
+The name
+.Dq "tilde escape"
+is somewhat of a misnomer since the actual escape character can be set
+by the option
+.Va escape .
+.Bl -tag -width indent
+.It Ic ~a
+Inserts the autograph string from the sign= option into the message.
+.It Ic ~A
+Inserts the autograph string from the Sign= option into the message.
+.It Ic ~b Ar name ...
+Add the given names to the list of carbon copy recipients but do not make
+the names visible in the Cc: line
+.Dq ( blind
+carbon copy).
+.It Ic ~c Ar name ...
+Add the given names to the list of carbon copy recipients.
+.It Ic ~d
+Read the file
+.Pa dead.letter
+from your home directory into the message.
+.It Ic ~e
+Invoke the text editor on the message collected so far.
+After the
+editing session is finished, you may continue appending text to the
+message.
+.It Ic ~f Ar messages
+Read the named messages into the message being sent.
+If no messages are specified, read in the current message.
+Message headers currently being ignored (by the
+.Ic ignore
+or
+.Ic retain
+command) are not included.
+.It Ic ~F Ar messages
+Identical to
+.Ic ~f ,
+except all message headers are included.
+.It Ic ~h
+Edit the message header fields by typing each one in turn and allowing
+the user to append text to the end or modify the field by using the
+current terminal erase and kill characters.
+.It Ic ~i Ar string
+Inserts the value of the named option into the text of the message.
+.It Ic ~m Ar messages
+Read the named messages into the message being sent, indented by a
+tab or by the value of
+.Va indentprefix .
+If no messages are specified,
+read the current message.
+Message headers currently being ignored (by the
+.Ic ignore
+or
+.Ic retain
+command) are not included.
+.It Ic ~M Ar messages
+Identical to
+.Ic ~m ,
+except all message headers are included.
+.It Ic ~p
+Print out the message collected so far, prefaced by the message header
+fields.
+.It Ic ~q
+Abort the message being sent, copying the message to
+.Pa dead.letter
+in your home directory if
+.Va save
+is set.
+.It Ic ~r Ar filename , Ic ~r Li \&! Ns Ar command
+.It Ic ~< Ar filename , Ic ~< Li \&! Ns Ar command
+Read the named file into the message.
+If the argument begins with a
+.Ql \&! ,
+the rest of the string is taken as an arbitrary system command and is
+executed, with the standard output inserted into the message.
+.It Ic ~R Ar string
+Use
+.Ar string
+as the Reply-To field.
+.It Ic ~s Ar string
+Cause the named string to become the current subject field.
+.It Ic ~t Ar name ...
+Add the given names to the direct recipient list.
+.It Ic ~v
+Invoke an alternative editor (defined by the
+.Ev VISUAL
+environment variable) on the
+message collected so far.
+Usually, the alternative editor will be a
+screen editor.
+After you quit the editor, you may resume appending
+text to the end of your message.
+.It Ic ~w Ar filename
+Write the message onto the named file.
+.It Ic ~x
+Exits as with
+.Ic ~q ,
+except the message is not saved in
+.Pa dead.letter .
+.It Ic ~! Ar command
+Execute the indicated shell command, then return to the message.
+.It Ic ~| Ar command , Ic ~^ Ar command
+Pipe the message through the command as a filter.
+If the command gives
+no output or terminates abnormally, retain the original text of the
+message.
+The command
+.Xr fmt 1
+is often used as
+.Ar command
+to rejustify the message.
+.It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
+Execute the given
+.Nm
+command.
+Not all commands, however, are allowed.
+.It Ic ~.
+Simulate end-of-file on input.
+.It Ic ~?
+Print a summary of the available command escapes.
+.It Ic ~~ Ar string
+Insert the string of text in the message prefaced by a single
+.Ql ~ .
+If
+you have changed the escape character, then you should double
+that character in order to send it.
+.El
+.Ss "Mail Options"
+Options can be set with the
+.Ic set
+command
+and can be disabled with the
+.Ic unset
+or
+.Ic set Cm no Ns Ar name
+commands.
+Options may be either binary, in which case it is only
+significant to see whether they are set or not; or string, in which
+case the actual value is of interest.
+If an option is not set,
+.Nm
+will look for an environment variable of the same name.
+The available options include the following:
+.Bl -tag -width indent
+.It Va append
+Causes messages saved in
+.Pa mbox
+to be appended to the end rather than prepended.
+This should always be set (preferably in one of the system-wide
+.Pa mail.rc
+files).
+Default is
+.Va noappend .
+.It Va ask , asksub
+Causes
+.Nm
+to prompt you for the subject of each message you send.
+If
+you respond with simply a newline, no subject field will be sent.
+Default is
+.Va asksub .
+.It Va askbcc
+Causes you to be prompted for additional blind carbon copy recipients at the
+end of each message.
+Responding with a newline indicates your
+satisfaction with the current list.
+Default is
+.Va noaskbcc .
+.It Va askcc
+Causes you to be prompted for additional carbon copy recipients at the
+end of each message.
+Responding with a newline indicates your
+satisfaction with the current list.
+Default is
+.Va noaskcc .
+.It Va autoinc
+Causes new mail to be automatically incorporated when it arrives.
+Setting this is similar to issuing the
+.Ic inc
+command at each prompt, except that the current message is not
+reset when new mail arrives.
+Default is
+.Va noautoinc .
+.It Va autoprint
+Causes the
+.Ic delete
+command to behave like
+.Ic dp ;
+thus, after deleting a message, the next one will be typed
+automatically.
+Default is
+.Va noautoprint .
+.It Va crt
+The valued option
+.Va crt
+is used as a threshold to determine how long a message must
+be before
+.Ev PAGER
+is used to read it.
+If
+.Va crt
+is set without a value,
+then the height of the terminal screen stored in the system
+is used to compute the threshold (see
+.Xr stty 1 ) .
+Default is
+.Va nocrt .
+.It Va debug
+Setting the binary option
+.Va debug
+is the same as specifying
+.Fl d
+on the command line and causes
+.Nm
+to output all sorts of information useful for debugging
+.Nm .
+In case
+.Nm
+is invoked in this mode to send mail, all preparations
+will be performed and reported about, but the mail will
+not be actually sent.
+Default is
+.Va nodebug .
+.It Va dot
+The binary option
+.Va dot
+causes
+.Nm
+to interpret a period alone on a line as the terminator
+of a message you are sending.
+Default is
+.Va nodot .
+.It Va escape
+If defined, the first character of this option gives the character to
+use in place of
+.Ql ~
+to denote escapes.
+.It Va flipr
+Reverses the sense of
+.Ic reply
+and
+.Ic Reply
+commands.
+Default is
+.Va noflipr .
+.It Va folder
+The name of the directory to use for storing folders of
+messages.
+If this name begins with a
+.Ql / ,
+.Nm
+considers it to be an absolute pathname; otherwise, the
+folder directory is found relative to your home directory.
+.It Va header
+If defined, initially display message headers when reading mail or
+editing a mail folder.
+Default is
+.Va header .
+This option can be disabled by giving the
+.Fl N
+flag on the command line.
+.It Va hold
+This option is used to hold messages in the system mailbox
+by default.
+Default is
+.Va nohold .
+.It Va ignore
+Causes interrupt signals from your terminal to be ignored and echoed as
+.Li @ Ns 's.
+Default is
+.Va noignore .
+.It Va ignoreeof
+An option related to
+.Va dot
+is
+.Va ignoreeof
+which makes
+.Nm
+refuse to accept a
+.Aq Li control-D
+as the end of a message.
+.Ar Ignoreeof
+also applies to
+.Nm
+command mode.
+Default is
+.Va noignoreeof .
+.It Va indentprefix
+String used by the
+.Ic ~m
+tilde escape for indenting messages, in place of
+the normal tab character
+.Pq Li ^I .
+Be sure to quote the value if it contains
+spaces or tabs.
+.It Va metoo
+Usually, when a group is expanded that contains the sender, the sender
+is removed from the expansion.
+Setting this option causes the sender
+to be included in the group.
+Default is
+.Va nometoo .
+.It Va quiet
+Suppresses the printing of the version when first invoked.
+Default is
+.Va noquiet .
+.It Va record
+If defined, gives the pathname of the file used to record all outgoing
+mail.
+If not defined, outgoing mail is not saved.
+Default is
+.Va norecord .
+.It Va Replyall
+Reverses the sense of
+.Ic reply
+and
+.Ic Reply
+commands.
+Default is
+.Va noReplyall .
+.It Va save
+If this option is set, and you abort a message with two
+.Tn RUBOUT
+(erase or delete),
+.Nm
+will copy the partial letter to the file
+.Pa dead.letter
+in your home directory.
+Default is
+.Va save .
+.It Va searchheaders
+If this option is set, then a message-list specifier in the form
+.Dq Li / Ns Ar x Ns Li : Ns Ar y
+will expand to all messages containing the substring
+.Ar y
+in the header field
+.Ar x .
+The string search is case insensitive.
+If
+.Ar x
+is omitted, it will default to the
+.Dq Li Subject
+header field.
+The form
+.Dq Li /to: Ns Ar y
+is a special case, and will expand
+to all messages containing the substring
+.Ar y
+in the
+.Dq Li To ,
+.Dq Li Cc
+or
+.Dq Li Bcc
+header fields.
+The check for
+.Qq Li "to"
+is case sensitive, so that
+.Dq Li /To: Ns Ar y
+can be used to limit the search for
+.Ar y
+to just the
+.Dq Li To:
+field.
+Default is
+.Va nosearchheaders .
+.It Va toplines
+If defined, gives the number of lines of a message to be printed out
+with the
+.Ic top
+command; normally, the first five lines are printed.
+.It Va verbose
+Setting the option
+.Va verbose
+is the same as using the
+.Fl v
+flag on the command line.
+When
+.Nm
+runs in verbose mode,
+the actual delivery of messages is displayed on the user's
+terminal.
+Default is
+.Va noverbose .
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev REPLYTO"
+.It Ev DEAD
+Pathname of the file to save partial messages to in case of interrupts
+or delivery errors.
+Default is
+.Pa ~/dead.letter .
+.It Ev EDITOR
+Pathname of the text editor to use in the
+.Ic edit
+command and
+.Ic ~e
+escape.
+If not defined, then a default editor is used.
+.It Ev HOME
+Pathname of the user's home directory.
+.It Ev LISTER
+Pathname of the directory lister to use in the
+.Ic folders
+command.
+Default is
+.Pa /bin/ls .
+.It Ev MAIL
+Location of the user's mailbox.
+Default is
+.Pa /var/mail .
+.It Ev MAILRC
+Pathname of file containing initial
+.Nm
+commands.
+Default is
+.Pa ~/.mailrc .
+.It Ev MBOX
+The name of the mailbox file.
+It can be the name of a folder.
+The default is
+.Pa mbox
+in the user's home directory.
+.It Ev PAGER
+Pathname of the program to use in the
+.Ic more
+command or when
+.Va crt
+variable is set.
+The default paginator
+.Xr more 1
+is used if this option is not defined.
+.It Ev REPLYTO
+If set, will be used to initialize the Reply-To field for outgoing
+messages.
+.It Ev SHELL
+Pathname of the shell to use in the
+.Ic \&!
+command and the
+.Ic ~!
+escape.
+A default shell is used if this option is
+not defined.
+.It Ev TMPDIR
+Pathname of the directory used for creating temporary files.
+.It Ev VISUAL
+Pathname of the text editor to use in the
+.Ic visual
+command and
+.Ic ~v
+escape.
+.It Ev USER
+Login name of the user executing mail.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
+.It Pa /var/mail/*
+Post office.
+.It Pa ~/mbox
+User's old mail.
+.It Pa ~/.mailrc
+File giving initial
+.Nm
+commands.
+This can be overridden by setting the
+.Ev MAILRC
+environment variable.
+.It Pa /tmp/R*
+Temporary files.
+.It Pa /usr/share/misc/mail.*help
+Help files.
+.Pp
+.It Pa /usr/share/misc/mail.rc
+.It Pa /usr/local/etc/mail.rc
+.It Pa /etc/mail.rc
+System-wide initialization files.
+Each file will be sourced, in order,
+if it exists.
+.El
+.Sh SEE ALSO
+.Xr fmt 1 ,
+.Xr newaliases 1 ,
+.Xr vacation 1 ,
+.Xr aliases 5 ,
+.Xr mailaddr 7 ,
+.Xr sendmail 8
+.Rs
+.%T "The Mail Reference Manual"
+.Re
+.Sh HISTORY
+A
+.Nm
+command
+appeared in
+.At v1 .
+This man page is derived from
+.%T "The Mail Reference Manual"
+originally written by
+.An Kurt Shoens .
+.Sh BUGS
+There are some flags that are not documented here.
+Most are
+not useful to the general user.
+.Pp
+Usually,
+.Nm
+is just a link to
+.Nm Mail
+and
+.Nm mailx ,
+which can be confusing.
+.Pp
+The name of the
+.Ic alternates
+list is incorrect English (it should be
+.Dq alternatives ) ,
+but is retained for compatibility.
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
new file mode 100644
index 0000000..0699a55
--- /dev/null
+++ b/usr.bin/mail/main.c
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Startup -- interface with user.
+ */
+
+static jmp_buf hdrjmp;
+
+extern const char *version;
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+ struct name *to, *cc, *bcc, *smopts;
+ char *subject, *replyto;
+ char *ef, *rc;
+ char nosrc = 0;
+ sig_t prevint;
+
+ /*
+ * Set up a reasonable environment.
+ * Figure out whether we are being run interactively,
+ * start the SIGCHLD catcher, and so forth.
+ */
+ (void)signal(SIGCHLD, sigchild);
+ if (isatty(0))
+ assign("interactive", "");
+ image = -1;
+ /*
+ * Now, determine how we are being used.
+ * We successively pick off - flags.
+ * If there is anything left, it is the base of the list
+ * of users to mail to. Argp will be set to point to the
+ * first of these users.
+ */
+ ef = NULL;
+ to = NULL;
+ cc = NULL;
+ bcc = NULL;
+ smopts = NULL;
+ subject = NULL;
+ while ((i = getopt(argc, argv, "FEHINT:b:c:edfins:u:v")) != -1) {
+ switch (i) {
+ case 'T':
+ /*
+ * Next argument is temp file to write which
+ * articles have been read/deleted for netnews.
+ */
+ Tflag = optarg;
+ if ((i = open(Tflag, O_CREAT | O_TRUNC | O_WRONLY,
+ 0600)) < 0)
+ err(1, "%s", Tflag);
+ (void)close(i);
+ break;
+ case 'u':
+ /*
+ * Next argument is person to pretend to be.
+ */
+ myname = optarg;
+ unsetenv("MAIL");
+ break;
+ case 'i':
+ /*
+ * User wants to ignore interrupts.
+ * Set the variable "ignore"
+ */
+ assign("ignore", "");
+ break;
+ case 'd':
+ debug++;
+ break;
+ case 'e':
+ /*
+ * User wants to check mail and exit.
+ */
+ assign("checkmode", "");
+ break;
+ case 'H':
+ /*
+ * User wants a header summary only.
+ */
+ assign("headersummary", "");
+ break;
+ case 'F':
+ /*
+ * User wants to record messages to files
+ * named after first recipient username.
+ */
+ assign("recordrecip", "");
+ break;
+ case 's':
+ /*
+ * Give a subject field for sending from
+ * non terminal
+ */
+ subject = optarg;
+ break;
+ case 'f':
+ /*
+ * User is specifying file to "edit" with Mail,
+ * as opposed to reading system mailbox.
+ * If no argument is given after -f, we read his
+ * mbox file.
+ *
+ * getopt() can't handle optional arguments, so here
+ * is an ugly hack to get around it.
+ */
+ if ((argv[optind] != NULL) && (argv[optind][0] != '-'))
+ ef = argv[optind++];
+ else
+ ef = "&";
+ break;
+ case 'n':
+ /*
+ * User doesn't want to source /usr/lib/Mail.rc
+ */
+ nosrc++;
+ break;
+ case 'N':
+ /*
+ * Avoid initial header printing.
+ */
+ assign("noheader", "");
+ break;
+ case 'v':
+ /*
+ * Send mailer verbose flag
+ */
+ assign("verbose", "");
+ break;
+ case 'I':
+ /*
+ * We're interactive
+ */
+ assign("interactive", "");
+ break;
+ case 'c':
+ /*
+ * Get Carbon Copy Recipient list
+ */
+ cc = cat(cc, nalloc(optarg, GCC));
+ break;
+ case 'b':
+ /*
+ * Get Blind Carbon Copy Recipient list
+ */
+ bcc = cat(bcc, nalloc(optarg, GBCC));
+ break;
+ case 'E':
+ /*
+ * Don't send empty files.
+ */
+ assign("dontsendempty", "");
+ break;
+ case '?':
+ fprintf(stderr, "\
+Usage: %s [-dEiInv] [-s subject] [-c cc-addr] [-b bcc-addr] [-F] to-addr ...\n\
+ %*s [-sendmail-option ...]\n\
+ %s [-dEHiInNv] [-F] -f [name]\n\
+ %s [-dEHiInNv] [-F] [-u user]\n\
+ %s [-d] -e [-f name]\n", __progname, (int)strlen(__progname), "",
+ __progname, __progname, __progname);
+ exit(1);
+ }
+ }
+ for (i = optind; (argv[i] != NULL) && (*argv[i] != '-'); i++)
+ to = cat(to, nalloc(argv[i], GTO));
+ for (; argv[i] != NULL; i++)
+ smopts = cat(smopts, nalloc(argv[i], 0));
+ /*
+ * Check for inconsistent arguments.
+ */
+ if (to == NULL && (subject != NULL || cc != NULL || bcc != NULL))
+ errx(1, "You must specify direct recipients with -s, -c, or -b.");
+ if (ef != NULL && to != NULL)
+ errx(1, "Cannot give -f and people to send to.");
+ tinit();
+ setscreensize();
+ input = stdin;
+ rcvmode = !to;
+ spreserve();
+ if (!nosrc) {
+ char *s, *path_rc;
+
+ if ((path_rc = malloc(sizeof(_PATH_MASTER_RC))) == NULL)
+ err(1, "malloc(path_rc) failed");
+
+ strcpy(path_rc, _PATH_MASTER_RC);
+ while ((s = strsep(&path_rc, ":")) != NULL)
+ if (*s != '\0')
+ load(s);
+ }
+ /*
+ * Expand returns a savestr, but load only uses the file name
+ * for fopen, so it's safe to do this.
+ */
+ if ((rc = getenv("MAILRC")) == NULL)
+ rc = "~/.mailrc";
+ load(expand(rc));
+
+ replyto = value("REPLYTO");
+ if (!rcvmode) {
+ mail(to, cc, bcc, smopts, subject, replyto);
+ /*
+ * why wait?
+ */
+ exit(senderr);
+ }
+
+ if(value("checkmode") != NULL) {
+ if (ef == NULL)
+ ef = "%";
+ if (setfile(ef) <= 0)
+ /* Either an error has occurred, or no mail */
+ exit(1);
+ else
+ exit(0);
+ /* NOTREACHED */
+ }
+
+ /*
+ * Ok, we are reading mail.
+ * Decide whether we are editing a mailbox or reading
+ * the system mailbox, and open up the right stuff.
+ */
+ if (ef == NULL)
+ ef = "%";
+ if (setfile(ef) < 0)
+ exit(1); /* error already reported */
+ if (setjmp(hdrjmp) == 0) {
+ if ((prevint = signal(SIGINT, SIG_IGN)) != SIG_IGN)
+ (void)signal(SIGINT, hdrstop);
+ if (value("quiet") == NULL)
+ printf("Mail version %s. Type ? for help.\n",
+ version);
+ announce();
+ (void)fflush(stdout);
+ (void)signal(SIGINT, prevint);
+ }
+
+ /* If we were in header summary mode, it's time to exit. */
+ if (value("headersummary") != NULL)
+ exit(0);
+
+ commands();
+ (void)signal(SIGHUP, SIG_IGN);
+ (void)signal(SIGINT, SIG_IGN);
+ (void)signal(SIGQUIT, SIG_IGN);
+ quit();
+ exit(0);
+}
+
+/*
+ * Interrupt printing of the headers.
+ */
+/*ARGSUSED*/
+void
+hdrstop(int signo __unused)
+{
+
+ (void)fflush(stdout);
+ fprintf(stderr, "\nInterrupt\n");
+ longjmp(hdrjmp, 1);
+}
+
+/*
+ * Compute what the screen size for printing headers should be.
+ * We use the following algorithm for the height:
+ * If baud rate < 1200, use 9
+ * If baud rate = 1200, use 14
+ * If baud rate > 1200, use 24 or ws_row
+ * Width is either 80 or ws_col;
+ */
+void
+setscreensize(void)
+{
+ struct termios tbuf;
+ struct winsize ws;
+ speed_t speed;
+
+ if (ioctl(1, TIOCGWINSZ, (char *)&ws) < 0)
+ ws.ws_col = ws.ws_row = 0;
+ if (tcgetattr(1, &tbuf) < 0)
+ speed = B9600;
+ else
+ speed = cfgetospeed(&tbuf);
+ if (speed < B1200)
+ screenheight = 9;
+ else if (speed == B1200)
+ screenheight = 14;
+ else if (ws.ws_row != 0)
+ screenheight = ws.ws_row;
+ else
+ screenheight = 24;
+ if ((realscreenheight = ws.ws_row) == 0)
+ realscreenheight = 24;
+ if ((screenwidth = ws.ws_col) == 0)
+ screenwidth = 80;
+}
diff --git a/usr.bin/mail/misc/mail.help b/usr.bin/mail/misc/mail.help
new file mode 100644
index 0000000..f5c5dd2
--- /dev/null
+++ b/usr.bin/mail/misc/mail.help
@@ -0,0 +1,23 @@
+ Mail Commands
+t <message list> type messages
+n goto and type next message
+e <message list> edit messages
+f <message list> give head lines of messages
+d <message list> delete messages
+s <message list> file append messages to file
+u <message list> undelete messages
+R <message list> reply to message senders
+r <message list> reply to message senders and all recipients
+pre <message list> make messages go back to /var/mail
+m <user list> mail to specific users
+q quit, saving unresolved messages in mbox
+x quit, do not remove system mailbox
+h print out active message headers
+! shell escape
+cd [directory] chdir to directory or home if none given
+
+A <message list> consists of integers, ranges of same, or user names separated
+by spaces. If omitted, Mail uses the last message typed.
+
+A <user list> consists of user names or aliases separated by spaces.
+Aliases are defined in .mailrc in your home directory.
diff --git a/usr.bin/mail/misc/mail.rc b/usr.bin/mail/misc/mail.rc
new file mode 100644
index 0000000..2293b3c
--- /dev/null
+++ b/usr.bin/mail/misc/mail.rc
@@ -0,0 +1,2 @@
+set append dot save ask crt
+ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via
diff --git a/usr.bin/mail/misc/mail.tildehelp b/usr.bin/mail/misc/mail.tildehelp
new file mode 100644
index 0000000..47201d3
--- /dev/null
+++ b/usr.bin/mail/misc/mail.tildehelp
@@ -0,0 +1,36 @@
+-----------------------------------------------------------
+The following ~ escapes are defined:
+~? Print this message
+~~ Quote a single tilde
+~. Simulate end-of-file on input
+~A Equivalent to: ~i Sign
+~a Equivalent to: ~i sign
+~b users Add users to Bcc list
+~c users Add users to Cc list
+~C Dump core
+~d Read in dead.letter
+~e Edit the message buffer
+~f messages Read in messages
+~F messages Same as ~f, but keep all header lines
+~h Prompt for Subject and To, Cc, and Bcc lists
+~i name Insert the value of the named variable
+~m messages Read in messages, right shifted by a tab
+~M messages Same as ~m, but keep all header lines
+~p Print the message buffer
+~q Quit, save partial message in dead.letter
+~r file Read a file into the message buffer
+~r !command Insert the output of the command
+~< file Same as ~r
+~< !command Same as ~r
+~R address Set Reply-to to address
+~s subject Set Subject to subject
+~t users Add users to the To list
+~v Invoke display editor on message
+~w file Write message onto file
+~x Quit, do not save to dead.letter
+~! command Invoke the shell
+~| command Pipe the message through the command
+~^ command Same as ~|
+~_ mail-cmd Perform the command-level request
+~: mail-cmd Same as ~_
+-----------------------------------------------------------
diff --git a/usr.bin/mail/names.c b/usr.bin/mail/names.c
new file mode 100644
index 0000000..8697f7b
--- /dev/null
+++ b/usr.bin/mail/names.c
@@ -0,0 +1,762 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Mail -- a mail program
+ *
+ * Handle name lists.
+ */
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Allocate a single element of a name list,
+ * initialize its name field to the passed
+ * name and return it.
+ */
+struct name *
+nalloc(char str[], int ntype)
+{
+ struct name *np;
+
+ np = (struct name *)salloc(sizeof(*np));
+ np->n_flink = NULL;
+ np->n_blink = NULL;
+ np->n_type = ntype;
+ np->n_name = savestr(str);
+ return (np);
+}
+
+/*
+ * Find the tail of a list and return it.
+ */
+struct name *
+tailof(struct name *name)
+{
+ struct name *np;
+
+ np = name;
+ if (np == NULL)
+ return (NULL);
+ while (np->n_flink != NULL)
+ np = np->n_flink;
+ return (np);
+}
+
+/*
+ * Extract a list of names from a line,
+ * and make a list of names from it.
+ * Return the list or NULL if none found.
+ */
+struct name *
+extract(char line[], int ntype)
+{
+ char *cp, *nbuf;
+ struct name *top, *np, *t;
+
+ if (line == NULL || *line == '\0')
+ return (NULL);
+ if ((nbuf = malloc(strlen(line) + 1)) == NULL)
+ err(1, "Out of memory");
+ top = NULL;
+ np = NULL;
+ cp = line;
+ while ((cp = yankword(cp, nbuf)) != NULL) {
+ t = nalloc(nbuf, ntype);
+ if (top == NULL)
+ top = t;
+ else
+ np->n_flink = t;
+ t->n_blink = np;
+ np = t;
+ }
+ (void)free(nbuf);
+ return (top);
+}
+
+/*
+ * Turn a list of names into a string of the same names.
+ */
+char *
+detract(struct name *np, int ntype)
+{
+ int s, comma;
+ char *cp, *top;
+ struct name *p;
+
+ comma = ntype & GCOMMA;
+ if (np == NULL)
+ return (NULL);
+ ntype &= ~GCOMMA;
+ s = 0;
+ if (debug && comma)
+ fprintf(stderr, "detract asked to insert commas\n");
+ for (p = np; p != NULL; p = p->n_flink) {
+ if (ntype && (p->n_type & GMASK) != ntype)
+ continue;
+ s += strlen(p->n_name) + 1;
+ if (comma)
+ s++;
+ }
+ if (s == 0)
+ return (NULL);
+ s += 2;
+ top = salloc(s);
+ cp = top;
+ for (p = np; p != NULL; p = p->n_flink) {
+ if (ntype && (p->n_type & GMASK) != ntype)
+ continue;
+ cp += strlcpy(cp, p->n_name, strlen(p->n_name) + 1);
+ if (comma && p->n_flink != NULL)
+ *cp++ = ',';
+ *cp++ = ' ';
+ }
+ *--cp = '\0';
+ if (comma && *--cp == ',')
+ *cp = '\0';
+ return (top);
+}
+
+/*
+ * Grab a single word (liberal word)
+ * Throw away things between ()'s, and take anything between <>.
+ */
+char *
+yankword(char *ap, char wbuf[])
+{
+ char *cp, *cp2;
+
+ cp = ap;
+ for (;;) {
+ if (*cp == '\0')
+ return (NULL);
+ if (*cp == '(') {
+ int nesting = 0;
+
+ while (*cp != '\0') {
+ switch (*cp++) {
+ case '(':
+ nesting++;
+ break;
+ case ')':
+ --nesting;
+ break;
+ }
+ if (nesting <= 0)
+ break;
+ }
+ } else if (*cp == ' ' || *cp == '\t' || *cp == ',')
+ cp++;
+ else
+ break;
+ }
+ if (*cp == '<')
+ for (cp2 = wbuf; *cp && (*cp2++ = *cp++) != '>';)
+ ;
+ else
+ for (cp2 = wbuf; *cp != '\0' && strchr(" \t,(", *cp) == NULL;
+ *cp2++ = *cp++)
+ ;
+ *cp2 = '\0';
+ return (cp);
+}
+
+/*
+ * Grab a single login name (liberal word)
+ * Throw away things between ()'s, take anything between <>,
+ * and look for words before metacharacters %, @, !.
+ */
+char *
+yanklogin(char *ap, char wbuf[])
+{
+ char *cp, *cp2, *cp_temp;
+ int n;
+
+ cp = ap;
+ for (;;) {
+ if (*cp == '\0')
+ return (NULL);
+ if (*cp == '(') {
+ int nesting = 0;
+
+ while (*cp != '\0') {
+ switch (*cp++) {
+ case '(':
+ nesting++;
+ break;
+ case ')':
+ --nesting;
+ break;
+ }
+ if (nesting <= 0)
+ break;
+ }
+ } else if (*cp == ' ' || *cp == '\t' || *cp == ',')
+ cp++;
+ else
+ break;
+ }
+
+ /*
+ * Now, let's go forward till we meet the needed character,
+ * and step one word back.
+ */
+
+ /* First, remember current point. */
+ cp_temp = cp;
+ n = 0;
+
+ /*
+ * Note that we look ahead in a cycle. This is safe, since
+ * non-end of string is checked first.
+ */
+ while(*cp != '\0' && strchr("@%!", *(cp + 1)) == NULL)
+ cp++;
+
+ /*
+ * Now, start stepping back to the first non-word character,
+ * while counting the number of symbols in a word.
+ */
+ while(cp != cp_temp && strchr(" \t,<>", *(cp - 1)) == NULL) {
+ n++;
+ cp--;
+ }
+
+ /* Finally, grab the word forward. */
+ cp2 = wbuf;
+ while(n >= 0) {
+ *cp2++=*cp++;
+ n--;
+ }
+
+ *cp2 = '\0';
+ return (cp);
+}
+
+/*
+ * For each recipient in the passed name list with a /
+ * in the name, append the message to the end of the named file
+ * and remove him from the recipient list.
+ *
+ * Recipients whose name begins with | are piped through the given
+ * program and removed.
+ */
+struct name *
+outof(struct name *names, FILE *fo, struct header *hp)
+{
+ int c, ispipe;
+ struct name *np, *top;
+ time_t now;
+ char *date, *fname;
+ FILE *fout, *fin;
+
+ top = names;
+ np = names;
+ (void)time(&now);
+ date = ctime(&now);
+ while (np != NULL) {
+ if (!isfileaddr(np->n_name) && np->n_name[0] != '|') {
+ np = np->n_flink;
+ continue;
+ }
+ ispipe = np->n_name[0] == '|';
+ if (ispipe)
+ fname = np->n_name+1;
+ else
+ fname = expand(np->n_name);
+
+ /*
+ * See if we have copied the complete message out yet.
+ * If not, do so.
+ */
+
+ if (image < 0) {
+ int fd;
+ char tempname[PATHSIZE];
+
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.ReXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (fout = Fdopen(fd, "a")) == NULL) {
+ warn("%s", tempname);
+ senderr++;
+ goto cant;
+ }
+ image = open(tempname, O_RDWR);
+ (void)rm(tempname);
+ if (image < 0) {
+ warn("%s", tempname);
+ senderr++;
+ (void)Fclose(fout);
+ goto cant;
+ }
+ (void)fcntl(image, F_SETFD, 1);
+ fprintf(fout, "From %s %s", myname, date);
+ puthead(hp, fout,
+ GTO|GSUBJECT|GCC|GREPLYTO|GINREPLYTO|GNL);
+ while ((c = getc(fo)) != EOF)
+ (void)putc(c, fout);
+ rewind(fo);
+ fprintf(fout, "\n");
+ (void)fflush(fout);
+ if (ferror(fout)) {
+ warn("%s", tempname);
+ senderr++;
+ (void)Fclose(fout);
+ goto cant;
+ }
+ (void)Fclose(fout);
+ }
+
+ /*
+ * Now either copy "image" to the desired file
+ * or give it as the standard input to the desired
+ * program as appropriate.
+ */
+
+ if (ispipe) {
+ int pid;
+ char *sh;
+ sigset_t nset;
+
+ /*
+ * XXX
+ * We can't really reuse the same image file,
+ * because multiple piped recipients will
+ * share the same lseek location and trample
+ * on one another.
+ */
+ if ((sh = value("SHELL")) == NULL)
+ sh = _PATH_CSHELL;
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGHUP);
+ (void)sigaddset(&nset, SIGINT);
+ (void)sigaddset(&nset, SIGQUIT);
+ pid = start_command(sh, &nset, image, -1, "-c", fname,
+ NULL);
+ if (pid < 0) {
+ senderr++;
+ goto cant;
+ }
+ free_child(pid);
+ } else {
+ int f;
+ if ((fout = Fopen(fname, "a")) == NULL) {
+ warn("%s", fname);
+ senderr++;
+ goto cant;
+ }
+ if ((f = dup(image)) < 0) {
+ warn("dup");
+ fin = NULL;
+ } else
+ fin = Fdopen(f, "r");
+ if (fin == NULL) {
+ fprintf(stderr, "Can't reopen image\n");
+ (void)Fclose(fout);
+ senderr++;
+ goto cant;
+ }
+ rewind(fin);
+ while ((c = getc(fin)) != EOF)
+ (void)putc(c, fout);
+ if (ferror(fout)) {
+ warnx("%s", fname);
+ senderr++;
+ (void)Fclose(fout);
+ (void)Fclose(fin);
+ goto cant;
+ }
+ (void)Fclose(fout);
+ (void)Fclose(fin);
+ }
+cant:
+ /*
+ * In days of old we removed the entry from the
+ * the list; now for sake of header expansion
+ * we leave it in and mark it as deleted.
+ */
+ np->n_type |= GDEL;
+ np = np->n_flink;
+ }
+ if (image >= 0) {
+ (void)close(image);
+ image = -1;
+ }
+ return (top);
+}
+
+/*
+ * Determine if the passed address is a local "send to file" address.
+ * If any of the network metacharacters precedes any slashes, it can't
+ * be a filename. We cheat with .'s to allow path names like ./...
+ */
+int
+isfileaddr(char *name)
+{
+ char *cp;
+
+ if (*name == '+')
+ return (1);
+ for (cp = name; *cp != '\0'; cp++) {
+ if (*cp == '!' || *cp == '%' || *cp == '@')
+ return (0);
+ if (*cp == '/')
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Map all of the aliased users in the invoker's mailrc
+ * file and insert them into the list.
+ * Changed after all these months of service to recursively
+ * expand names (2/14/80).
+ */
+
+struct name *
+usermap(struct name *names)
+{
+ struct name *new, *np, *cp;
+ struct grouphead *gh;
+ int metoo;
+
+ new = NULL;
+ np = names;
+ metoo = (value("metoo") != NULL);
+ while (np != NULL) {
+ if (np->n_name[0] == '\\') {
+ cp = np->n_flink;
+ new = put(new, np);
+ np = cp;
+ continue;
+ }
+ gh = findgroup(np->n_name);
+ cp = np->n_flink;
+ if (gh != NULL)
+ new = gexpand(new, gh, metoo, np->n_type);
+ else
+ new = put(new, np);
+ np = cp;
+ }
+ return (new);
+}
+
+/*
+ * Recursively expand a group name. We limit the expansion to some
+ * fixed level to keep things from going haywire.
+ * Direct recursion is not expanded for convenience.
+ */
+
+struct name *
+gexpand(struct name *nlist, struct grouphead *gh, int metoo, int ntype)
+{
+ struct group *gp;
+ struct grouphead *ngh;
+ struct name *np;
+ static int depth;
+ char *cp;
+
+ if (depth > MAXEXP) {
+ printf("Expanding alias to depth larger than %d\n", MAXEXP);
+ return (nlist);
+ }
+ depth++;
+ for (gp = gh->g_list; gp != NULL; gp = gp->ge_link) {
+ cp = gp->ge_name;
+ if (*cp == '\\')
+ goto quote;
+ if (strcmp(cp, gh->g_name) == 0)
+ goto quote;
+ if ((ngh = findgroup(cp)) != NULL) {
+ nlist = gexpand(nlist, ngh, metoo, ntype);
+ continue;
+ }
+quote:
+ np = nalloc(cp, ntype);
+ /*
+ * At this point should allow to expand
+ * to self if only person in group
+ */
+ if (gp == gh->g_list && gp->ge_link == NULL)
+ goto skip;
+ if (!metoo && strcmp(cp, myname) == 0)
+ np->n_type |= GDEL;
+skip:
+ nlist = put(nlist, np);
+ }
+ depth--;
+ return (nlist);
+}
+
+/*
+ * Concatenate the two passed name lists, return the result.
+ */
+struct name *
+cat(struct name *n1, struct name *n2)
+{
+ struct name *tail;
+
+ if (n1 == NULL)
+ return (n2);
+ if (n2 == NULL)
+ return (n1);
+ tail = tailof(n1);
+ tail->n_flink = n2;
+ n2->n_blink = tail;
+ return (n1);
+}
+
+/*
+ * Unpack the name list onto a vector of strings.
+ * Return an error if the name list won't fit.
+ */
+char **
+unpack(struct name *np)
+{
+ char **ap, **top;
+ struct name *n;
+ int t, extra, metoo, verbose;
+
+ n = np;
+ if ((t = count(n)) == 0)
+ errx(1, "No names to unpack");
+ /*
+ * Compute the number of extra arguments we will need.
+ * We need at least two extra -- one for "mail" and one for
+ * the terminating 0 pointer. Additional spots may be needed
+ * to pass along -f to the host mailer.
+ */
+ extra = 2;
+ extra++;
+ metoo = value("metoo") != NULL;
+ if (metoo)
+ extra++;
+ verbose = value("verbose") != NULL;
+ if (verbose)
+ extra++;
+ top = (char **)salloc((t + extra) * sizeof(*top));
+ ap = top;
+ *ap++ = "send-mail";
+ *ap++ = "-i";
+ if (metoo)
+ *ap++ = "-m";
+ if (verbose)
+ *ap++ = "-v";
+ for (; n != NULL; n = n->n_flink)
+ if ((n->n_type & GDEL) == 0)
+ *ap++ = n->n_name;
+ *ap = NULL;
+ return (top);
+}
+
+/*
+ * Remove all of the duplicates from the passed name list by
+ * insertion sorting them, then checking for dups.
+ * Return the head of the new list.
+ */
+struct name *
+elide(struct name *names)
+{
+ struct name *np, *t, *new;
+ struct name *x;
+
+ if (names == NULL)
+ return (NULL);
+ new = names;
+ np = names;
+ np = np->n_flink;
+ if (np != NULL)
+ np->n_blink = NULL;
+ new->n_flink = NULL;
+ while (np != NULL) {
+ t = new;
+ while (strcasecmp(t->n_name, np->n_name) < 0) {
+ if (t->n_flink == NULL)
+ break;
+ t = t->n_flink;
+ }
+
+ /*
+ * If we ran out of t's, put the new entry after
+ * the current value of t.
+ */
+
+ if (strcasecmp(t->n_name, np->n_name) < 0) {
+ t->n_flink = np;
+ np->n_blink = t;
+ t = np;
+ np = np->n_flink;
+ t->n_flink = NULL;
+ continue;
+ }
+
+ /*
+ * Otherwise, put the new entry in front of the
+ * current t. If at the front of the list,
+ * the new guy becomes the new head of the list.
+ */
+
+ if (t == new) {
+ t = np;
+ np = np->n_flink;
+ t->n_flink = new;
+ new->n_blink = t;
+ t->n_blink = NULL;
+ new = t;
+ continue;
+ }
+
+ /*
+ * The normal case -- we are inserting into the
+ * middle of the list.
+ */
+
+ x = np;
+ np = np->n_flink;
+ x->n_flink = t;
+ x->n_blink = t->n_blink;
+ t->n_blink->n_flink = x;
+ t->n_blink = x;
+ }
+
+ /*
+ * Now the list headed up by new is sorted.
+ * Go through it and remove duplicates.
+ */
+
+ np = new;
+ while (np != NULL) {
+ t = np;
+ while (t->n_flink != NULL &&
+ strcasecmp(np->n_name, t->n_flink->n_name) == 0)
+ t = t->n_flink;
+ if (t == np || t == NULL) {
+ np = np->n_flink;
+ continue;
+ }
+
+ /*
+ * Now t points to the last entry with the same name
+ * as np. Make np point beyond t.
+ */
+
+ np->n_flink = t->n_flink;
+ if (t->n_flink != NULL)
+ t->n_flink->n_blink = np;
+ np = np->n_flink;
+ }
+ return (new);
+}
+
+/*
+ * Put another node onto a list of names and return
+ * the list.
+ */
+struct name *
+put(struct name *list, struct name *node)
+{
+ node->n_flink = list;
+ node->n_blink = NULL;
+ if (list != NULL)
+ list->n_blink = node;
+ return (node);
+}
+
+/*
+ * Determine the number of undeleted elements in
+ * a name list and return it.
+ */
+int
+count(struct name *np)
+{
+ int c;
+
+ for (c = 0; np != NULL; np = np->n_flink)
+ if ((np->n_type & GDEL) == 0)
+ c++;
+ return (c);
+}
+
+/*
+ * Delete the given name from a namelist.
+ */
+struct name *
+delname(struct name *np, char name[])
+{
+ struct name *p;
+
+ for (p = np; p != NULL; p = p->n_flink)
+ if (strcasecmp(p->n_name, name) == 0) {
+ if (p->n_blink == NULL) {
+ if (p->n_flink != NULL)
+ p->n_flink->n_blink = NULL;
+ np = p->n_flink;
+ continue;
+ }
+ if (p->n_flink == NULL) {
+ if (p->n_blink != NULL)
+ p->n_blink->n_flink = NULL;
+ continue;
+ }
+ p->n_blink->n_flink = p->n_flink;
+ p->n_flink->n_blink = p->n_blink;
+ }
+ return (np);
+}
+
+/*
+ * Pretty print a name list
+ * Uncomment it if you need it.
+ */
+
+/*
+void
+prettyprint(struct name *name)
+{
+ struct name *np;
+
+ np = name;
+ while (np != NULL) {
+ fprintf(stderr, "%s(%d) ", np->n_name, np->n_type);
+ np = np->n_flink;
+ }
+ fprintf(stderr, "\n");
+}
+*/
diff --git a/usr.bin/mail/pathnames.h b/usr.bin/mail/pathnames.h
new file mode 100644
index 0000000..17dd106
--- /dev/null
+++ b/usr.bin/mail/pathnames.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ *
+ * $FreeBSD$
+ */
+
+#define _PATH_EX "/usr/bin/ex"
+#define _PATH_HELP "/usr/share/misc/mail.help"
+#define _PATH_TILDE "/usr/share/misc/mail.tildehelp"
+#define _PATH_MASTER_RC "/usr/share/misc/mail.rc:/usr/local/etc/mail.rc:/etc/mail.rc"
+#define _PATH_MORE "/usr/bin/more"
diff --git a/usr.bin/mail/popen.c b/usr.bin/mail/popen.c
new file mode 100644
index 0000000..60a0936
--- /dev/null
+++ b/usr.bin/mail/popen.c
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <sys/wait.h>
+#include <fcntl.h>
+#include "extern.h"
+
+#define READ 0
+#define WRITE 1
+
+struct fp {
+ FILE *fp;
+ int pipe;
+ int pid;
+ struct fp *link;
+};
+static struct fp *fp_head;
+
+struct child {
+ int pid;
+ char done;
+ char free;
+ int status;
+ struct child *link;
+};
+static struct child *child;
+static struct child *findchild(int);
+static void delchild(struct child *);
+static int file_pid(FILE *);
+
+FILE *
+Fopen(const char *path, const char *mode)
+{
+ FILE *fp;
+
+ if ((fp = fopen(path, mode)) != NULL) {
+ register_file(fp, 0, 0);
+ (void)fcntl(fileno(fp), F_SETFD, 1);
+ }
+ return (fp);
+}
+
+FILE *
+Fdopen(int fd, const char *mode)
+{
+ FILE *fp;
+
+ if ((fp = fdopen(fd, mode)) != NULL) {
+ register_file(fp, 0, 0);
+ (void)fcntl(fileno(fp), F_SETFD, 1);
+ }
+ return (fp);
+}
+
+int
+Fclose(FILE *fp)
+{
+ unregister_file(fp);
+ return (fclose(fp));
+}
+
+FILE *
+Popen(char *cmd, const char *mode)
+{
+ int p[2];
+ int myside, hisside, fd0, fd1;
+ int pid;
+ sigset_t nset;
+ FILE *fp;
+
+ if (pipe(p) < 0)
+ return (NULL);
+ (void)fcntl(p[READ], F_SETFD, 1);
+ (void)fcntl(p[WRITE], F_SETFD, 1);
+ if (*mode == 'r') {
+ myside = p[READ];
+ fd0 = -1;
+ hisside = fd1 = p[WRITE];
+ } else {
+ myside = p[WRITE];
+ hisside = fd0 = p[READ];
+ fd1 = -1;
+ }
+ (void)sigemptyset(&nset);
+ if ((pid = start_command(cmd, &nset, fd0, fd1, NULL, NULL, NULL)) < 0) {
+ (void)close(p[READ]);
+ (void)close(p[WRITE]);
+ return (NULL);
+ }
+ (void)close(hisside);
+ if ((fp = fdopen(myside, mode)) != NULL)
+ register_file(fp, 1, pid);
+ return (fp);
+}
+
+int
+Pclose(FILE *ptr)
+{
+ int i;
+ sigset_t nset, oset;
+
+ i = file_pid(ptr);
+ unregister_file(ptr);
+ (void)fclose(ptr);
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGINT);
+ (void)sigaddset(&nset, SIGHUP);
+ (void)sigprocmask(SIG_BLOCK, &nset, &oset);
+ i = wait_child(i);
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
+ return (i);
+}
+
+void
+close_all_files(void)
+{
+
+ while (fp_head != NULL)
+ if (fp_head->pipe)
+ (void)Pclose(fp_head->fp);
+ else
+ (void)Fclose(fp_head->fp);
+}
+
+void
+register_file(FILE *fp, int pipe, int pid)
+{
+ struct fp *fpp;
+
+ if ((fpp = malloc(sizeof(*fpp))) == NULL)
+ err(1, "Out of memory");
+ fpp->fp = fp;
+ fpp->pipe = pipe;
+ fpp->pid = pid;
+ fpp->link = fp_head;
+ fp_head = fpp;
+}
+
+void
+unregister_file(FILE *fp)
+{
+ struct fp **pp, *p;
+
+ for (pp = &fp_head; (p = *pp) != NULL; pp = &p->link)
+ if (p->fp == fp) {
+ *pp = p->link;
+ (void)free(p);
+ return;
+ }
+ errx(1, "Invalid file pointer");
+ /*NOTREACHED*/
+}
+
+int
+file_pid(FILE *fp)
+{
+ struct fp *p;
+
+ for (p = fp_head; p != NULL; p = p->link)
+ if (p->fp == fp)
+ return (p->pid);
+ errx(1, "Invalid file pointer");
+ /*NOTREACHED*/
+}
+
+/*
+ * Run a command without a shell, with optional arguments and splicing
+ * of stdin and stdout. The command name can be a sequence of words.
+ * Signals must be handled by the caller.
+ * "Mask" contains the signals to ignore in the new process.
+ * SIGINT is enabled unless it's in the mask.
+ */
+/*VARARGS4*/
+int
+run_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0,
+ char *a1, char *a2)
+{
+ int pid;
+
+ if ((pid = start_command(cmd, mask, infd, outfd, a0, a1, a2)) < 0)
+ return (-1);
+ return (wait_command(pid));
+}
+
+/*VARARGS4*/
+int
+start_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0,
+ char *a1, char *a2)
+{
+ int pid;
+
+ if ((pid = fork()) < 0) {
+ warn("fork");
+ return (-1);
+ }
+ if (pid == 0) {
+ char *argv[100];
+ int i = getrawlist(cmd, argv, sizeof(argv) / sizeof(*argv));
+
+ if ((argv[i++] = a0) != NULL &&
+ (argv[i++] = a1) != NULL &&
+ (argv[i++] = a2) != NULL)
+ argv[i] = NULL;
+ prepare_child(mask, infd, outfd);
+ execvp(argv[0], argv);
+ warn("%s", argv[0]);
+ _exit(1);
+ }
+ return (pid);
+}
+
+void
+prepare_child(sigset_t *nset, int infd, int outfd)
+{
+ int i;
+ sigset_t eset;
+
+ /*
+ * All file descriptors other than 0, 1, and 2 are supposed to be
+ * close-on-exec.
+ */
+ if (infd >= 0)
+ dup2(infd, 0);
+ if (outfd >= 0)
+ dup2(outfd, 1);
+ for (i = 1; i < NSIG; i++)
+ if (nset != NULL && sigismember(nset, i))
+ (void)signal(i, SIG_IGN);
+ if (nset == NULL || !sigismember(nset, SIGINT))
+ (void)signal(SIGINT, SIG_DFL);
+ (void)sigemptyset(&eset);
+ (void)sigprocmask(SIG_SETMASK, &eset, NULL);
+}
+
+int
+wait_command(int pid)
+{
+
+ if (wait_child(pid) < 0) {
+ printf("Fatal error in process.\n");
+ return (-1);
+ }
+ return (0);
+}
+
+static struct child *
+findchild(int pid)
+{
+ struct child **cpp;
+
+ for (cpp = &child; *cpp != NULL && (*cpp)->pid != pid;
+ cpp = &(*cpp)->link)
+ ;
+ if (*cpp == NULL) {
+ *cpp = malloc(sizeof(struct child));
+ if (*cpp == NULL)
+ err(1, "Out of memory");
+ (*cpp)->pid = pid;
+ (*cpp)->done = (*cpp)->free = 0;
+ (*cpp)->link = NULL;
+ }
+ return (*cpp);
+}
+
+static void
+delchild(struct child *cp)
+{
+ struct child **cpp;
+
+ for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link)
+ ;
+ *cpp = cp->link;
+ (void)free(cp);
+}
+
+/*ARGSUSED*/
+void
+sigchild(int signo __unused)
+{
+ int pid;
+ int status;
+ struct child *cp;
+
+ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
+ cp = findchild(pid);
+ if (cp->free)
+ delchild(cp);
+ else {
+ cp->done = 1;
+ cp->status = status;
+ }
+ }
+}
+
+int wait_status;
+
+/*
+ * Wait for a specific child to die.
+ */
+int
+wait_child(int pid)
+{
+ sigset_t nset, oset;
+ struct child *cp;
+
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGCHLD);
+ (void)sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ cp = findchild(pid);
+
+ while (!cp->done)
+ (void)sigsuspend(&oset);
+ wait_status = cp->status;
+ delchild(cp);
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
+ return ((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0);
+}
+
+/*
+ * Mark a child as don't care.
+ */
+void
+free_child(int pid)
+{
+ sigset_t nset, oset;
+ struct child *cp = findchild(pid);
+
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGCHLD);
+ (void)sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ if (cp->done)
+ delchild(cp);
+ else
+ cp->free = 1;
+ (void)sigprocmask(SIG_SETMASK, &oset, NULL);
+}
diff --git a/usr.bin/mail/quit.c b/usr.bin/mail/quit.c
new file mode 100644
index 0000000..a960755
--- /dev/null
+++ b/usr.bin/mail/quit.c
@@ -0,0 +1,494 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)quit.c 8.2 (Berkeley) 4/28/95";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Rcv -- receive mail rationally.
+ *
+ * Termination processing.
+ */
+
+/*
+ * The "quit" command.
+ */
+int
+quitcmd(void)
+{
+ /*
+ * If we are sourcing, then return 1 so execute() can handle it.
+ * Otherwise, return -1 to abort command loop.
+ */
+ if (sourcing)
+ return (1);
+ return (-1);
+}
+
+/*
+ * Save all of the undetermined messages at the top of "mbox"
+ * Save all untouched messages back in the system mailbox.
+ * Remove the system mailbox, if none saved there.
+ */
+void
+quit(void)
+{
+ int mcount, p, modify, autohold, anystat, holdbit, nohold;
+ FILE *ibuf, *obuf, *fbuf, *rbuf, *readstat, *abuf;
+ struct message *mp;
+ int c, fd;
+ struct stat minfo;
+ char *mbox, tempname[PATHSIZE];
+
+ /*
+ * If we are read only, we can't do anything,
+ * so just return quickly.
+ */
+ if (readonly)
+ return;
+ /*
+ * If editing (not reading system mail box), then do the work
+ * in edstop()
+ */
+ if (edit) {
+ edstop();
+ return;
+ }
+
+ /*
+ * See if there any messages to save in mbox. If no, we
+ * can save copying mbox to /tmp and back.
+ *
+ * Check also to see if any files need to be preserved.
+ * Delete all untouched messages to keep them out of mbox.
+ * If all the messages are to be preserved, just exit with
+ * a message.
+ */
+
+ fbuf = Fopen(mailname, "r");
+ if (fbuf == NULL)
+ goto newmail;
+ (void)flock(fileno(fbuf), LOCK_EX);
+ rbuf = NULL;
+ if (fstat(fileno(fbuf), &minfo) >= 0 && minfo.st_size > mailsize) {
+ printf("New mail has arrived.\n");
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.RqXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (rbuf = Fdopen(fd, "w")) == NULL)
+ goto newmail;
+#ifdef APPEND
+ (void)fseeko(fbuf, mailsize, SEEK_SET);
+ while ((c = getc(fbuf)) != EOF)
+ (void)putc(c, rbuf);
+#else
+ p = minfo.st_size - mailsize;
+ while (p-- > 0) {
+ c = getc(fbuf);
+ if (c == EOF)
+ goto newmail;
+ (void)putc(c, rbuf);
+ }
+#endif
+ (void)Fclose(rbuf);
+ if ((rbuf = Fopen(tempname, "r")) == NULL)
+ goto newmail;
+ (void)rm(tempname);
+ }
+
+ /*
+ * Adjust the message flags in each message.
+ */
+
+ anystat = 0;
+ autohold = value("hold") != NULL;
+ holdbit = autohold ? MPRESERVE : MBOX;
+ nohold = MBOX|MSAVED|MDELETED|MPRESERVE;
+ if (value("keepsave") != NULL)
+ nohold &= ~MSAVED;
+ for (mp = &message[0]; mp < &message[msgCount]; mp++) {
+ if (mp->m_flag & MNEW) {
+ mp->m_flag &= ~MNEW;
+ mp->m_flag |= MSTATUS;
+ }
+ if (mp->m_flag & MSTATUS)
+ anystat++;
+ if ((mp->m_flag & MTOUCH) == 0)
+ mp->m_flag |= MPRESERVE;
+ if ((mp->m_flag & nohold) == 0)
+ mp->m_flag |= holdbit;
+ }
+ modify = 0;
+ if (Tflag != NULL) {
+ if ((readstat = Fopen(Tflag, "w")) == NULL)
+ Tflag = NULL;
+ }
+ for (c = 0, p = 0, mp = &message[0]; mp < &message[msgCount]; mp++) {
+ if (mp->m_flag & MBOX)
+ c++;
+ if (mp->m_flag & MPRESERVE)
+ p++;
+ if (mp->m_flag & MODIFY)
+ modify++;
+ if (Tflag != NULL && (mp->m_flag & (MREAD|MDELETED)) != 0) {
+ char *id;
+
+ if ((id = hfield("article-id", mp)) != NULL)
+ fprintf(readstat, "%s\n", id);
+ }
+ }
+ if (Tflag != NULL)
+ (void)Fclose(readstat);
+ if (p == msgCount && !modify && !anystat) {
+ printf("Held %d message%s in %s\n",
+ p, p == 1 ? "" : "s", mailname);
+ (void)Fclose(fbuf);
+ return;
+ }
+ if (c == 0) {
+ if (p != 0) {
+ writeback(rbuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+ goto cream;
+ }
+
+ /*
+ * Create another temporary file and copy user's mbox file
+ * darin. If there is no mbox, copy nothing.
+ * If he has specified "append" don't copy his mailbox,
+ * just copy saveable entries at the end.
+ */
+
+ mbox = expand("&");
+ mcount = c;
+ if (value("append") == NULL) {
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.RmXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (obuf = Fdopen(fd, "w")) == NULL) {
+ warn("%s", tempname);
+ (void)Fclose(fbuf);
+ return;
+ }
+ if ((ibuf = Fopen(tempname, "r")) == NULL) {
+ warn("%s", tempname);
+ (void)rm(tempname);
+ (void)Fclose(obuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+ (void)rm(tempname);
+ if ((abuf = Fopen(mbox, "r")) != NULL) {
+ while ((c = getc(abuf)) != EOF)
+ (void)putc(c, obuf);
+ (void)Fclose(abuf);
+ }
+ if (ferror(obuf)) {
+ warnx("%s", tempname);
+ (void)Fclose(ibuf);
+ (void)Fclose(obuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+ (void)Fclose(obuf);
+ (void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600));
+ if ((obuf = Fopen(mbox, "r+")) == NULL) {
+ warn("%s", mbox);
+ (void)Fclose(ibuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+ }
+ if (value("append") != NULL) {
+ if ((obuf = Fopen(mbox, "a")) == NULL) {
+ warn("%s", mbox);
+ (void)Fclose(fbuf);
+ return;
+ }
+ (void)fchmod(fileno(obuf), 0600);
+ }
+ for (mp = &message[0]; mp < &message[msgCount]; mp++)
+ if (mp->m_flag & MBOX)
+ if (sendmessage(mp, obuf, saveignore, NULL) < 0) {
+ warnx("%s", mbox);
+ (void)Fclose(ibuf);
+ (void)Fclose(obuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+
+ /*
+ * Copy the user's old mbox contents back
+ * to the end of the stuff we just saved.
+ * If we are appending, this is unnecessary.
+ */
+
+ if (value("append") == NULL) {
+ rewind(ibuf);
+ c = getc(ibuf);
+ while (c != EOF) {
+ (void)putc(c, obuf);
+ if (ferror(obuf))
+ break;
+ c = getc(ibuf);
+ }
+ (void)Fclose(ibuf);
+ }
+ (void)fflush(obuf);
+ trunc(obuf);
+ if (ferror(obuf)) {
+ warn("%s", mbox);
+ (void)Fclose(obuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+ (void)Fclose(obuf);
+ if (mcount == 1)
+ printf("Saved 1 message in mbox\n");
+ else
+ printf("Saved %d messages in mbox\n", mcount);
+
+ /*
+ * Now we are ready to copy back preserved files to
+ * the system mailbox, if any were requested.
+ */
+
+ if (p != 0) {
+ writeback(rbuf);
+ (void)Fclose(fbuf);
+ return;
+ }
+
+ /*
+ * Finally, remove his /var/mail file.
+ * If new mail has arrived, copy it back.
+ */
+
+cream:
+ if (rbuf != NULL) {
+ abuf = Fopen(mailname, "r+");
+ if (abuf == NULL)
+ goto newmail;
+ while ((c = getc(rbuf)) != EOF)
+ (void)putc(c, abuf);
+ (void)Fclose(rbuf);
+ trunc(abuf);
+ (void)Fclose(abuf);
+ alter(mailname);
+ (void)Fclose(fbuf);
+ return;
+ }
+ demail();
+ (void)Fclose(fbuf);
+ return;
+
+newmail:
+ printf("Thou hast new mail.\n");
+ if (fbuf != NULL)
+ (void)Fclose(fbuf);
+}
+
+/*
+ * Preserve all the appropriate messages back in the system
+ * mailbox, and print a nice message indicated how many were
+ * saved. On any error, just return -1. Else return 0.
+ * Incorporate the any new mail that we found.
+ */
+int
+writeback(FILE *res)
+{
+ struct message *mp;
+ int p, c;
+ FILE *obuf;
+
+ p = 0;
+ if ((obuf = Fopen(mailname, "r+")) == NULL) {
+ warn("%s", mailname);
+ return (-1);
+ }
+#ifndef APPEND
+ if (res != NULL)
+ while ((c = getc(res)) != EOF)
+ (void)putc(c, obuf);
+#endif
+ for (mp = &message[0]; mp < &message[msgCount]; mp++)
+ if ((mp->m_flag&MPRESERVE)||(mp->m_flag&MTOUCH)==0) {
+ p++;
+ if (sendmessage(mp, obuf, NULL, NULL) < 0) {
+ warnx("%s", mailname);
+ (void)Fclose(obuf);
+ return (-1);
+ }
+ }
+#ifdef APPEND
+ if (res != NULL)
+ while ((c = getc(res)) != EOF)
+ (void)putc(c, obuf);
+#endif
+ (void)fflush(obuf);
+ trunc(obuf);
+ if (ferror(obuf)) {
+ warn("%s", mailname);
+ (void)Fclose(obuf);
+ return (-1);
+ }
+ if (res != NULL)
+ (void)Fclose(res);
+ (void)Fclose(obuf);
+ alter(mailname);
+ if (p == 1)
+ printf("Held 1 message in %s\n", mailname);
+ else
+ printf("Held %d messages in %s\n", p, mailname);
+ return (0);
+}
+
+/*
+ * Terminate an editing session by attempting to write out the user's
+ * file from the temporary. Save any new stuff appended to the file.
+ */
+void
+edstop(void)
+{
+ int gotcha, c;
+ struct message *mp;
+ FILE *obuf, *ibuf, *readstat;
+ struct stat statb;
+ char tempname[PATHSIZE];
+
+ if (readonly)
+ return;
+ holdsigs();
+ if (Tflag != NULL) {
+ if ((readstat = Fopen(Tflag, "w")) == NULL)
+ Tflag = NULL;
+ }
+ for (mp = &message[0], gotcha = 0; mp < &message[msgCount]; mp++) {
+ if (mp->m_flag & MNEW) {
+ mp->m_flag &= ~MNEW;
+ mp->m_flag |= MSTATUS;
+ }
+ if (mp->m_flag & (MODIFY|MDELETED|MSTATUS))
+ gotcha++;
+ if (Tflag != NULL && (mp->m_flag & (MREAD|MDELETED)) != 0) {
+ char *id;
+
+ if ((id = hfield("article-id", mp)) != NULL)
+ fprintf(readstat, "%s\n", id);
+ }
+ }
+ if (Tflag != NULL)
+ (void)Fclose(readstat);
+ if (!gotcha || Tflag != NULL)
+ goto done;
+ ibuf = NULL;
+ if (stat(mailname, &statb) >= 0 && statb.st_size > mailsize) {
+ int fd;
+
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mbox.XXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (obuf = Fdopen(fd, "w")) == NULL) {
+ warn("%s", tempname);
+ relsesigs();
+ reset(0);
+ }
+ if ((ibuf = Fopen(mailname, "r")) == NULL) {
+ warn("%s", mailname);
+ (void)Fclose(obuf);
+ (void)rm(tempname);
+ relsesigs();
+ reset(0);
+ }
+ (void)fseeko(ibuf, mailsize, SEEK_SET);
+ while ((c = getc(ibuf)) != EOF)
+ (void)putc(c, obuf);
+ (void)Fclose(ibuf);
+ (void)Fclose(obuf);
+ if ((ibuf = Fopen(tempname, "r")) == NULL) {
+ warn("%s", tempname);
+ (void)rm(tempname);
+ relsesigs();
+ reset(0);
+ }
+ (void)rm(tempname);
+ }
+ printf("\"%s\" ", mailname);
+ (void)fflush(stdout);
+ if ((obuf = Fopen(mailname, "r+")) == NULL) {
+ warn("%s", mailname);
+ relsesigs();
+ reset(0);
+ }
+ trunc(obuf);
+ c = 0;
+ for (mp = &message[0]; mp < &message[msgCount]; mp++) {
+ if ((mp->m_flag & MDELETED) != 0)
+ continue;
+ c++;
+ if (sendmessage(mp, obuf, NULL, NULL) < 0) {
+ warnx("%s", mailname);
+ relsesigs();
+ reset(0);
+ }
+ }
+ gotcha = (c == 0 && ibuf == NULL);
+ if (ibuf != NULL) {
+ while ((c = getc(ibuf)) != EOF)
+ (void)putc(c, obuf);
+ (void)Fclose(ibuf);
+ }
+ (void)fflush(obuf);
+ if (ferror(obuf)) {
+ warn("%s", mailname);
+ relsesigs();
+ reset(0);
+ }
+ (void)Fclose(obuf);
+ if (gotcha) {
+ (void)rm(mailname);
+ printf("removed\n");
+ } else
+ printf("complete\n");
+ (void)fflush(stdout);
+
+done:
+ relsesigs();
+}
diff --git a/usr.bin/mail/rcv.h b/usr.bin/mail/rcv.h
new file mode 100644
index 0000000..0ee7f2d
--- /dev/null
+++ b/usr.bin/mail/rcv.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1980, 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.
+ *
+ * @(#)rcv.h 8.1 (Berkeley) 6/6/93
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Mail -- a mail program
+ *
+ * This file is included by normal files which want both
+ * globals and declarations.
+ */
+
+#include "def.h"
+#include "glob.h"
diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c
new file mode 100644
index 0000000..5be7405
--- /dev/null
+++ b/usr.bin/mail/send.c
@@ -0,0 +1,585 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Mail to others.
+ */
+
+/*
+ * Send message described by the passed pointer to the
+ * passed output buffer. Return -1 on error.
+ * Adjust the status: field if need be.
+ * If doign is given, suppress ignored header fields.
+ * prefix is a string to prepend to each output line.
+ */
+int
+sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
+ char *prefix)
+{
+ long count;
+ FILE *ibuf;
+ char *cp, *cp2, line[LINESIZE];
+ int ishead, infld, ignoring, dostat, firstline;
+ int c, length, prefixlen;
+
+ /*
+ * Compute the prefix string, without trailing whitespace
+ */
+ if (prefix != NULL) {
+ cp2 = 0;
+ for (cp = prefix; *cp != '\0'; cp++)
+ if (*cp != ' ' && *cp != '\t')
+ cp2 = cp;
+ prefixlen = cp2 == NULL ? 0 : cp2 - prefix + 1;
+ }
+ ibuf = setinput(mp);
+ count = mp->m_size;
+ ishead = 1;
+ dostat = doign == 0 || !isign("status", doign);
+ infld = 0;
+ firstline = 1;
+ /*
+ * Process headers first
+ */
+ while (count > 0 && ishead) {
+ if (fgets(line, sizeof(line), ibuf) == NULL)
+ break;
+ count -= length = strlen(line);
+ if (firstline) {
+ /*
+ * First line is the From line, so no headers
+ * there to worry about
+ */
+ firstline = 0;
+ ignoring = doign == ignoreall;
+ } else if (line[0] == '\n') {
+ /*
+ * If line is blank, we've reached end of
+ * headers, so force out status: field
+ * and note that we are no longer in header
+ * fields
+ */
+ if (dostat) {
+ statusput(mp, obuf, prefix);
+ dostat = 0;
+ }
+ ishead = 0;
+ ignoring = doign == ignoreall;
+ } else if (infld && (line[0] == ' ' || line[0] == '\t')) {
+ /*
+ * If this line is a continuation (via space or tab)
+ * of a previous header field, just echo it
+ * (unless the field should be ignored).
+ * In other words, nothing to do.
+ */
+ } else {
+ /*
+ * Pick up the header field if we have one.
+ */
+ for (cp = line; (c = *cp++) != '\0' && c != ':' &&
+ !isspace((unsigned char)c);)
+ ;
+ cp2 = --cp;
+ while (isspace((unsigned char)*cp++))
+ ;
+ if (cp[-1] != ':') {
+ /*
+ * Not a header line, force out status:
+ * This happens in uucp style mail where
+ * there are no headers at all.
+ */
+ if (dostat) {
+ statusput(mp, obuf, prefix);
+ dostat = 0;
+ }
+ if (doign != ignoreall)
+ /* add blank line */
+ (void)putc('\n', obuf);
+ ishead = 0;
+ ignoring = 0;
+ } else {
+ /*
+ * If it is an ignored field and
+ * we care about such things, skip it.
+ */
+ *cp2 = '\0'; /* temporarily null terminate */
+ if (doign && isign(line, doign))
+ ignoring = 1;
+ else if ((line[0] == 's' || line[0] == 'S') &&
+ strcasecmp(line, "status") == 0) {
+ /*
+ * If the field is "status," go compute
+ * and print the real Status: field
+ */
+ if (dostat) {
+ statusput(mp, obuf, prefix);
+ dostat = 0;
+ }
+ ignoring = 1;
+ } else {
+ ignoring = 0;
+ *cp2 = c; /* restore */
+ }
+ infld = 1;
+ }
+ }
+ if (!ignoring) {
+ /*
+ * Strip trailing whitespace from prefix
+ * if line is blank.
+ */
+ if (prefix != NULL) {
+ if (length > 1)
+ fputs(prefix, obuf);
+ else
+ (void)fwrite(prefix, sizeof(*prefix),
+ prefixlen, obuf);
+ }
+ (void)fwrite(line, sizeof(*line), length, obuf);
+ if (ferror(obuf))
+ return (-1);
+ }
+ }
+ /*
+ * Copy out message body
+ */
+ if (doign == ignoreall)
+ count--; /* skip final blank line */
+ if (prefix != NULL)
+ while (count > 0) {
+ if (fgets(line, sizeof(line), ibuf) == NULL) {
+ c = 0;
+ break;
+ }
+ count -= c = strlen(line);
+ /*
+ * Strip trailing whitespace from prefix
+ * if line is blank.
+ */
+ if (c > 1)
+ fputs(prefix, obuf);
+ else
+ (void)fwrite(prefix, sizeof(*prefix),
+ prefixlen, obuf);
+ (void)fwrite(line, sizeof(*line), c, obuf);
+ if (ferror(obuf))
+ return (-1);
+ }
+ else
+ while (count > 0) {
+ c = count < LINESIZE ? count : LINESIZE;
+ if ((c = fread(line, sizeof(*line), c, ibuf)) <= 0)
+ break;
+ count -= c;
+ if (fwrite(line, sizeof(*line), c, obuf) != c)
+ return (-1);
+ }
+ if (doign == ignoreall && c > 0 && line[c - 1] != '\n')
+ /* no final blank line */
+ if ((c = getc(ibuf)) != EOF && putc(c, obuf) == EOF)
+ return (-1);
+ return (0);
+}
+
+/*
+ * Output a reasonable looking status field.
+ */
+void
+statusput(struct message *mp, FILE *obuf, char *prefix)
+{
+ char statout[3];
+ char *cp = statout;
+
+ if (mp->m_flag & MREAD)
+ *cp++ = 'R';
+ if ((mp->m_flag & MNEW) == 0)
+ *cp++ = 'O';
+ *cp = '\0';
+ if (statout[0] != '\0')
+ fprintf(obuf, "%sStatus: %s\n",
+ prefix == NULL ? "" : prefix, statout);
+}
+
+/*
+ * Interface between the argument list and the mail1 routine
+ * which does all the dirty work.
+ */
+int
+mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts,
+ char *subject, char *replyto)
+{
+ struct header head;
+
+ head.h_to = to;
+ head.h_subject = subject;
+ head.h_cc = cc;
+ head.h_bcc = bcc;
+ head.h_smopts = smopts;
+ head.h_replyto = replyto;
+ head.h_inreplyto = NULL;
+ mail1(&head, 0);
+ return (0);
+}
+
+
+/*
+ * Send mail to a bunch of user names. The interface is through
+ * the mail routine below.
+ */
+int
+sendmail(char *str)
+{
+ struct header head;
+
+ head.h_to = extract(str, GTO);
+ head.h_subject = NULL;
+ head.h_cc = NULL;
+ head.h_bcc = NULL;
+ head.h_smopts = NULL;
+ head.h_replyto = value("REPLYTO");
+ head.h_inreplyto = NULL;
+ mail1(&head, 0);
+ return (0);
+}
+
+/*
+ * Mail a message on standard input to the people indicated
+ * in the passed header. (Internal interface).
+ */
+void
+mail1(struct header *hp, int printheaders)
+{
+ char *cp;
+ char *nbuf;
+ int pid;
+ char **namelist;
+ struct name *to, *nsto;
+ FILE *mtf;
+
+ /*
+ * Collect user's mail from standard input.
+ * Get the result as mtf.
+ */
+ if ((mtf = collect(hp, printheaders)) == NULL)
+ return;
+ if (value("interactive") != NULL) {
+ if (value("askcc") != NULL || value("askbcc") != NULL) {
+ if (value("askcc") != NULL)
+ grabh(hp, GCC);
+ if (value("askbcc") != NULL)
+ grabh(hp, GBCC);
+ } else {
+ printf("EOT\n");
+ (void)fflush(stdout);
+ }
+ }
+ if (fsize(mtf) == 0) {
+ if (value("dontsendempty") != NULL)
+ goto out;
+ if (hp->h_subject == NULL)
+ printf("No message, no subject; hope that's ok\n");
+ else
+ printf("Null message body; hope that's ok\n");
+ }
+ /*
+ * Now, take the user names from the combined
+ * to and cc lists and do all the alias
+ * processing.
+ */
+ senderr = 0;
+ to = usermap(cat(hp->h_bcc, cat(hp->h_to, hp->h_cc)));
+ if (to == NULL) {
+ printf("No recipients specified\n");
+ senderr++;
+ }
+ /*
+ * Look through the recipient list for names with /'s
+ * in them which we write to as files directly.
+ */
+ to = outof(to, mtf, hp);
+ if (senderr)
+ savedeadletter(mtf);
+ to = elide(to);
+ if (count(to) == 0)
+ goto out;
+ if (value("recordrecip") != NULL) {
+ /*
+ * Before fixing the header, save old To:.
+ * We do this because elide above has sorted To: list, and
+ * we would like to save message in a file named by the first
+ * recipient the user has entered, not the one being the first
+ * after sorting happened.
+ */
+ if ((nsto = malloc(sizeof(struct name))) == NULL)
+ err(1, "Out of memory");
+ bcopy(hp->h_to, nsto, sizeof(struct name));
+ }
+ fixhead(hp, to);
+ if ((mtf = infix(hp, mtf)) == NULL) {
+ fprintf(stderr, ". . . message lost, sorry.\n");
+ return;
+ }
+ namelist = unpack(cat(hp->h_smopts, to));
+ if (debug) {
+ char **t;
+
+ printf("Sendmail arguments:");
+ for (t = namelist; *t != NULL; t++)
+ printf(" \"%s\"", *t);
+ printf("\n");
+ goto out;
+ }
+ if (value("recordrecip") != NULL) {
+ /*
+ * Extract first recipient username from saved To: and use it
+ * as a filename.
+ */
+ if ((nbuf = malloc(strlen(detract(nsto, 0)) + 1)) == NULL)
+ err(1, "Out of memory");
+ if ((cp = yanklogin(detract(nsto, 0), nbuf)) != NULL)
+ (void)savemail(expand(nbuf), mtf);
+ free(nbuf);
+ free(nsto);
+ } else if ((cp = value("record")) != NULL)
+ (void)savemail(expand(cp), mtf);
+ /*
+ * Fork, set up the temporary mail file as standard
+ * input for "mail", and exec with the user list we generated
+ * far above.
+ */
+ pid = fork();
+ if (pid == -1) {
+ warn("fork");
+ savedeadletter(mtf);
+ goto out;
+ }
+ if (pid == 0) {
+ sigset_t nset;
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, SIGHUP);
+ (void)sigaddset(&nset, SIGINT);
+ (void)sigaddset(&nset, SIGQUIT);
+ (void)sigaddset(&nset, SIGTSTP);
+ (void)sigaddset(&nset, SIGTTIN);
+ (void)sigaddset(&nset, SIGTTOU);
+ prepare_child(&nset, fileno(mtf), -1);
+ if ((cp = value("sendmail")) != NULL)
+ cp = expand(cp);
+ else
+ cp = _PATH_SENDMAIL;
+ execv(cp, namelist);
+ warn("%s", cp);
+ _exit(1);
+ }
+ if (value("verbose") != NULL)
+ (void)wait_child(pid);
+ else
+ free_child(pid);
+out:
+ (void)Fclose(mtf);
+}
+
+/*
+ * Fix the header by glopping all of the expanded names from
+ * the distribution list into the appropriate fields.
+ */
+void
+fixhead(struct header *hp, struct name *tolist)
+{
+ struct name *np;
+
+ hp->h_to = NULL;
+ hp->h_cc = NULL;
+ hp->h_bcc = NULL;
+ for (np = tolist; np != NULL; np = np->n_flink) {
+ /* Don't copy deleted addresses to the header */
+ if (np->n_type & GDEL)
+ continue;
+ if ((np->n_type & GMASK) == GTO)
+ hp->h_to =
+ cat(hp->h_to, nalloc(np->n_name, np->n_type));
+ else if ((np->n_type & GMASK) == GCC)
+ hp->h_cc =
+ cat(hp->h_cc, nalloc(np->n_name, np->n_type));
+ else if ((np->n_type & GMASK) == GBCC)
+ hp->h_bcc =
+ cat(hp->h_bcc, nalloc(np->n_name, np->n_type));
+ }
+}
+
+/*
+ * Prepend a header in front of the collected stuff
+ * and return the new file.
+ */
+FILE *
+infix(struct header *hp, FILE *fi)
+{
+ FILE *nfo, *nfi;
+ int c, fd;
+ char tempname[PATHSIZE];
+
+ (void)snprintf(tempname, sizeof(tempname),
+ "%s/mail.RsXXXXXXXXXX", tmpdir);
+ if ((fd = mkstemp(tempname)) == -1 ||
+ (nfo = Fdopen(fd, "w")) == NULL) {
+ warn("%s", tempname);
+ return (fi);
+ }
+ if ((nfi = Fopen(tempname, "r")) == NULL) {
+ warn("%s", tempname);
+ (void)Fclose(nfo);
+ (void)rm(tempname);
+ return (fi);
+ }
+ (void)rm(tempname);
+ (void)puthead(hp, nfo,
+ GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO|GNL|GCOMMA);
+ c = getc(fi);
+ while (c != EOF) {
+ (void)putc(c, nfo);
+ c = getc(fi);
+ }
+ if (ferror(fi)) {
+ warnx("read");
+ rewind(fi);
+ return (fi);
+ }
+ (void)fflush(nfo);
+ if (ferror(nfo)) {
+ warn("%s", tempname);
+ (void)Fclose(nfo);
+ (void)Fclose(nfi);
+ rewind(fi);
+ return (fi);
+ }
+ (void)Fclose(nfo);
+ (void)Fclose(fi);
+ rewind(nfi);
+ return (nfi);
+}
+
+/*
+ * Dump the to, subject, cc header on the
+ * passed file buffer.
+ */
+int
+puthead(struct header *hp, FILE *fo, int w)
+{
+ int gotcha;
+
+ gotcha = 0;
+ if (hp->h_to != NULL && w & GTO)
+ fmt("To:", hp->h_to, fo, w&GCOMMA), gotcha++;
+ if (hp->h_subject != NULL && w & GSUBJECT)
+ fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++;
+ if (hp->h_cc != NULL && w & GCC)
+ fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++;
+ if (hp->h_bcc != NULL && w & GBCC)
+ fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++;
+ if (hp->h_replyto != NULL && w & GREPLYTO)
+ fprintf(fo, "Reply-To: %s\n", hp->h_replyto), gotcha++;
+ if (hp->h_inreplyto != NULL && w & GINREPLYTO)
+ fprintf(fo, "In-Reply-To: <%s>\n", hp->h_inreplyto), gotcha++;
+ if (gotcha && w & GNL)
+ (void)putc('\n', fo);
+ return (0);
+}
+
+/*
+ * Format the given header line to not exceed 72 characters.
+ */
+void
+fmt(const char *str, struct name *np, FILE *fo, int comma)
+{
+ int col, len;
+
+ comma = comma ? 1 : 0;
+ col = strlen(str);
+ if (col)
+ fputs(str, fo);
+ for (; np != NULL; np = np->n_flink) {
+ if (np->n_flink == NULL)
+ comma = 0;
+ len = strlen(np->n_name);
+ col++; /* for the space */
+ if (col + len + comma > 72 && col > 4) {
+ fprintf(fo, "\n ");
+ col = 4;
+ } else
+ fprintf(fo, " ");
+ fputs(np->n_name, fo);
+ if (comma)
+ fprintf(fo, ",");
+ col += len + comma;
+ }
+ fprintf(fo, "\n");
+}
+
+/*
+ * Save the outgoing mail on the passed file.
+ */
+
+/*ARGSUSED*/
+int
+savemail(char name[], FILE *fi)
+{
+ FILE *fo;
+ char buf[BUFSIZ];
+ int i;
+ time_t now;
+
+ if ((fo = Fopen(name, "a")) == NULL) {
+ warn("%s", name);
+ return (-1);
+ }
+ (void)time(&now);
+ fprintf(fo, "From %s %s", myname, ctime(&now));
+ while ((i = fread(buf, 1, sizeof(buf), fi)) > 0)
+ (void)fwrite(buf, 1, i, fo);
+ fprintf(fo, "\n");
+ (void)fflush(fo);
+ if (ferror(fo))
+ warn("%s", name);
+ (void)Fclose(fo);
+ rewind(fi);
+ return (0);
+}
diff --git a/usr.bin/mail/strings.c b/usr.bin/mail/strings.c
new file mode 100644
index 0000000..ec9334e
--- /dev/null
+++ b/usr.bin/mail/strings.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)strings.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Mail -- a mail program
+ *
+ * String allocation routines.
+ * Strings handed out here are reclaimed at the top of the command
+ * loop each time, so they need not be freed.
+ */
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Allocate size more bytes of space and return the address of the
+ * first byte to the caller. An even number of bytes are always
+ * allocated so that the space will always be on a word boundary.
+ * The string spaces are of exponentially increasing size, to satisfy
+ * the occasional user with enormous string size requests.
+ */
+
+char *
+salloc(int size)
+{
+ char *t;
+ int s, index;
+ struct strings *sp;
+
+ s = size;
+ s += (sizeof(char *) - 1);
+ s &= ~(sizeof(char *) - 1);
+ index = 0;
+ for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
+ if (sp->s_topFree == NULL && (STRINGSIZE << index) >= s)
+ break;
+ if (sp->s_nleft >= s)
+ break;
+ index++;
+ }
+ if (sp >= &stringdope[NSPACE])
+ errx(1, "String too large");
+ if (sp->s_topFree == NULL) {
+ index = sp - &stringdope[0];
+ if ((sp->s_topFree = malloc(STRINGSIZE << index)) == NULL)
+ err(1, "No room for space %d", index);
+ sp->s_nextFree = sp->s_topFree;
+ sp->s_nleft = STRINGSIZE << index;
+ }
+ sp->s_nleft -= s;
+ t = sp->s_nextFree;
+ sp->s_nextFree += s;
+ return (t);
+}
+
+/*
+ * Reset the string area to be empty.
+ * Called to free all strings allocated
+ * since last reset.
+ */
+void
+sreset(void)
+{
+ struct strings *sp;
+ int index;
+
+ if (noreset)
+ return;
+ index = 0;
+ for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
+ if (sp->s_topFree == NULL)
+ continue;
+ sp->s_nextFree = sp->s_topFree;
+ sp->s_nleft = STRINGSIZE << index;
+ index++;
+ }
+}
+
+/*
+ * Make the string area permanent.
+ * Meant to be called in main, after initialization.
+ */
+void
+spreserve(void)
+{
+ struct strings *sp;
+
+ for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++)
+ sp->s_topFree = NULL;
+}
diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c
new file mode 100644
index 0000000..d274467
--- /dev/null
+++ b/usr.bin/mail/temp.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Give names to all the temporary files that we will need.
+ */
+
+char *tmpdir;
+
+void
+tinit(void)
+{
+ char *cp;
+
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+ if ((tmpdir = strdup(tmpdir)) == NULL)
+ errx(1, "Out of memory");
+ /* Strip trailing '/' if necessary */
+ cp = tmpdir + strlen(tmpdir) - 1;
+ while (cp > tmpdir && *cp == '/') {
+ *cp = '\0';
+ cp--;
+ }
+
+ /*
+ * It's okay to call savestr in here because main will
+ * do a spreserve() after us.
+ */
+ if (myname != NULL) {
+ if (getuserid(myname) < 0)
+ errx(1, "\"%s\" is not a user of this system", myname);
+ } else {
+ if ((cp = username()) == NULL) {
+ myname = "ubluit";
+ if (rcvmode)
+ errx(1, "Who are you!?");
+ } else
+ myname = savestr(cp);
+ }
+ if ((cp = getenv("HOME")) == NULL || *cp == '\0' ||
+ strlen(cp) >= PATHSIZE)
+ homedir = NULL;
+ else
+ homedir = savestr(cp);
+ if (debug)
+ printf("user = %s, homedir = %s\n", myname,
+ homedir ? homedir : "NONE");
+}
diff --git a/usr.bin/mail/tty.c b/usr.bin/mail/tty.c
new file mode 100644
index 0000000..f8635a2
--- /dev/null
+++ b/usr.bin/mail/tty.c
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)tty.c 8.2 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Mail -- a mail program
+ *
+ * Generally useful tty stuff.
+ */
+
+#include "rcv.h"
+#include "extern.h"
+
+static cc_t c_erase; /* Current erase char */
+static cc_t c_kill; /* Current kill char */
+static jmp_buf rewrite; /* Place to go when continued */
+static jmp_buf intjmp; /* Place to go when interrupted */
+#ifndef TIOCSTI
+static int ttyset; /* We must now do erase/kill */
+#endif
+
+/*
+ * Read all relevant header fields.
+ */
+
+int
+grabh(struct header *hp, int gflags)
+{
+ struct termios ttybuf;
+ sig_t saveint;
+ sig_t savetstp;
+ sig_t savettou;
+ sig_t savettin;
+ int errs;
+#ifndef TIOCSTI
+ sig_t savequit;
+#else
+# ifdef TIOCEXT
+ int extproc, flag;
+# endif /* TIOCEXT */
+#endif /* TIOCSTI */
+
+ savetstp = signal(SIGTSTP, SIG_DFL);
+ savettou = signal(SIGTTOU, SIG_DFL);
+ savettin = signal(SIGTTIN, SIG_DFL);
+ errs = 0;
+#ifndef TIOCSTI
+ ttyset = 0;
+#endif
+ if (tcgetattr(fileno(stdin), &ttybuf) < 0) {
+ warn("tcgetattr(stdin)");
+ return (-1);
+ }
+ c_erase = ttybuf.c_cc[VERASE];
+ c_kill = ttybuf.c_cc[VKILL];
+#ifndef TIOCSTI
+ ttybuf.c_cc[VERASE] = _POSIX_VDISABLE;
+ ttybuf.c_cc[VKILL] = _POSIX_VDISABLE;
+ if ((saveint = signal(SIGINT, SIG_IGN)) == SIG_DFL)
+ (void)signal(SIGINT, SIG_DFL);
+ if ((savequit = signal(SIGQUIT, SIG_IGN)) == SIG_DFL)
+ (void)signal(SIGQUIT, SIG_DFL);
+#else
+# ifdef TIOCEXT
+ extproc = ((ttybuf.c_lflag & EXTPROC) ? 1 : 0);
+ if (extproc) {
+ flag = 0;
+ if (ioctl(fileno(stdin), TIOCEXT, &flag) < 0)
+ warn("TIOCEXT: off");
+ }
+# endif /* TIOCEXT */
+ if (setjmp(intjmp))
+ goto out;
+ saveint = signal(SIGINT, ttyint);
+#endif
+ if (gflags & GTO) {
+#ifndef TIOCSTI
+ if (!ttyset && hp->h_to != NULL)
+ ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
+#endif
+ hp->h_to =
+ extract(readtty("To: ", detract(hp->h_to, 0)), GTO);
+ }
+ if (gflags & GSUBJECT) {
+#ifndef TIOCSTI
+ if (!ttyset && hp->h_subject != NULL)
+ ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
+#endif
+ hp->h_subject = readtty("Subject: ", hp->h_subject);
+ }
+ if (gflags & GCC) {
+#ifndef TIOCSTI
+ if (!ttyset && hp->h_cc != NULL)
+ ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
+#endif
+ hp->h_cc =
+ extract(readtty("Cc: ", detract(hp->h_cc, 0)), GCC);
+ }
+ if (gflags & GBCC) {
+#ifndef TIOCSTI
+ if (!ttyset && hp->h_bcc != NULL)
+ ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
+#endif
+ hp->h_bcc =
+ extract(readtty("Bcc: ", detract(hp->h_bcc, 0)), GBCC);
+ }
+out:
+ (void)signal(SIGTSTP, savetstp);
+ (void)signal(SIGTTOU, savettou);
+ (void)signal(SIGTTIN, savettin);
+#ifndef TIOCSTI
+ ttybuf.c_cc[VERASE] = c_erase;
+ ttybuf.c_cc[VKILL] = c_kill;
+ if (ttyset)
+ tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
+ (void)signal(SIGQUIT, savequit);
+#else
+# ifdef TIOCEXT
+ if (extproc) {
+ flag = 1;
+ if (ioctl(fileno(stdin), TIOCEXT, &flag) < 0)
+ warn("TIOCEXT: on");
+ }
+# endif /* TIOCEXT */
+#endif
+ (void)signal(SIGINT, saveint);
+ return (errs);
+}
+
+/*
+ * Read up a header from standard input.
+ * The source string has the preliminary contents to
+ * be read.
+ *
+ */
+
+char *
+readtty(const char *pr, char src[])
+{
+ char ch, canonb[BUFSIZ];
+ int c;
+ char *cp, *cp2;
+
+ fputs(pr, stdout);
+ (void)fflush(stdout);
+ if (src != NULL && strlen(src) > BUFSIZ - 2) {
+ printf("too long to edit\n");
+ return (src);
+ }
+#ifndef TIOCSTI
+ if (src != NULL)
+ strlcpy(canonb, src, sizeof(canonb));
+ else
+ *canonb = '\0';
+ fputs(canonb, stdout);
+ (void)fflush(stdout);
+#else
+ cp = src == NULL ? "" : src;
+ while ((c = *cp++) != '\0') {
+ if ((c_erase != _POSIX_VDISABLE && c == c_erase) ||
+ (c_kill != _POSIX_VDISABLE && c == c_kill)) {
+ ch = '\\';
+ ioctl(0, TIOCSTI, &ch);
+ }
+ ch = c;
+ ioctl(0, TIOCSTI, &ch);
+ }
+ cp = canonb;
+ *cp = '\0';
+#endif
+ cp2 = cp;
+ while (cp2 < canonb + BUFSIZ)
+ *cp2++ = '\0';
+ cp2 = cp;
+ if (setjmp(rewrite))
+ goto redo;
+ (void)signal(SIGTSTP, ttystop);
+ (void)signal(SIGTTOU, ttystop);
+ (void)signal(SIGTTIN, ttystop);
+ clearerr(stdin);
+ while (cp2 < canonb + BUFSIZ) {
+ c = getc(stdin);
+ if (c == EOF || c == '\n')
+ break;
+ *cp2++ = c;
+ }
+ *cp2 = '\0';
+ (void)signal(SIGTSTP, SIG_DFL);
+ (void)signal(SIGTTOU, SIG_DFL);
+ (void)signal(SIGTTIN, SIG_DFL);
+ if (c == EOF && ferror(stdin)) {
+redo:
+ cp = strlen(canonb) > 0 ? canonb : NULL;
+ clearerr(stdin);
+ return (readtty(pr, cp));
+ }
+#ifndef TIOCSTI
+ if (cp == NULL || *cp == '\0')
+ return (src);
+ cp2 = cp;
+ if (!ttyset)
+ return (strlen(canonb) > 0 ? savestr(canonb) : NULL);
+ while (*cp != '\0') {
+ c = *cp++;
+ if (c_erase != _POSIX_VDISABLE && c == c_erase) {
+ if (cp2 == canonb)
+ continue;
+ if (cp2[-1] == '\\') {
+ cp2[-1] = c;
+ continue;
+ }
+ cp2--;
+ continue;
+ }
+ if (c_kill != _POSIX_VDISABLE && c == c_kill) {
+ if (cp2 == canonb)
+ continue;
+ if (cp2[-1] == '\\') {
+ cp2[-1] = c;
+ continue;
+ }
+ cp2 = canonb;
+ continue;
+ }
+ *cp2++ = c;
+ }
+ *cp2 = '\0';
+#endif
+ if (equal("", canonb))
+ return (NULL);
+ return (savestr(canonb));
+}
+
+/*
+ * Receipt continuation.
+ */
+void
+ttystop(int s)
+{
+ sig_t old_action = signal(s, SIG_DFL);
+ sigset_t nset;
+
+ (void)sigemptyset(&nset);
+ (void)sigaddset(&nset, s);
+ (void)sigprocmask(SIG_BLOCK, &nset, NULL);
+ kill(0, s);
+ (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);
+ (void)signal(s, old_action);
+ longjmp(rewrite, 1);
+}
+
+void
+ttyint(int s __unused)
+{
+ longjmp(intjmp, 1);
+}
diff --git a/usr.bin/mail/util.c b/usr.bin/mail/util.c
new file mode 100644
index 0000000..43a0a55
--- /dev/null
+++ b/usr.bin/mail/util.c
@@ -0,0 +1,598 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/time.h>
+
+#include <fcntl.h>
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Auxiliary functions.
+ */
+
+static char *save2str(char *, char *);
+
+/*
+ * Return a pointer to a dynamic copy of the argument.
+ */
+char *
+savestr(char *str)
+{
+ char *new;
+ int size = strlen(str) + 1;
+
+ if ((new = salloc(size)) != NULL)
+ bcopy(str, new, size);
+ return (new);
+}
+
+/*
+ * Make a copy of new argument incorporating old one.
+ */
+static char *
+save2str(char *str, char *old)
+{
+ char *new;
+ int newsize = strlen(str) + 1;
+ int oldsize = old ? strlen(old) + 1 : 0;
+
+ if ((new = salloc(newsize + oldsize)) != NULL) {
+ if (oldsize) {
+ bcopy(old, new, oldsize);
+ new[oldsize - 1] = ' ';
+ }
+ bcopy(str, new + oldsize, newsize);
+ }
+ return (new);
+}
+
+/*
+ * Touch the named message by setting its MTOUCH flag.
+ * Touched messages have the effect of not being sent
+ * back to the system mailbox on exit.
+ */
+void
+touch(struct message *mp)
+{
+
+ mp->m_flag |= MTOUCH;
+ if ((mp->m_flag & MREAD) == 0)
+ mp->m_flag |= MREAD|MSTATUS;
+}
+
+/*
+ * Test to see if the passed file name is a directory.
+ * Return true if it is.
+ */
+int
+isdir(char name[])
+{
+ struct stat sbuf;
+
+ if (stat(name, &sbuf) < 0)
+ return (0);
+ return (S_ISDIR(sbuf.st_mode));
+}
+
+/*
+ * Count the number of arguments in the given string raw list.
+ */
+int
+argcount(char **argv)
+{
+ char **ap;
+
+ for (ap = argv; *ap++ != NULL;)
+ ;
+ return (ap - argv - 1);
+}
+
+/*
+ * Return the desired header line from the passed message
+ * pointer (or NULL if the desired header field is not available).
+ */
+char *
+hfield(const char *field, struct message *mp)
+{
+ FILE *ibuf;
+ char linebuf[LINESIZE];
+ int lc;
+ char *hfield;
+ char *colon, *oldhfield = NULL;
+
+ ibuf = setinput(mp);
+ if ((lc = mp->m_lines - 1) < 0)
+ return (NULL);
+ if (readline(ibuf, linebuf, LINESIZE) < 0)
+ return (NULL);
+ while (lc > 0) {
+ if ((lc = gethfield(ibuf, linebuf, lc, &colon)) < 0)
+ return (oldhfield);
+ if ((hfield = ishfield(linebuf, colon, field)) != NULL)
+ oldhfield = save2str(hfield, oldhfield);
+ }
+ return (oldhfield);
+}
+
+/*
+ * Return the next header field found in the given message.
+ * Return >= 0 if something found, < 0 elsewise.
+ * "colon" is set to point to the colon in the header.
+ * Must deal with \ continuations & other such fraud.
+ */
+int
+gethfield(FILE *f, char linebuf[], int rem, char **colon)
+{
+ char line2[LINESIZE];
+ char *cp, *cp2;
+ int c;
+
+ for (;;) {
+ if (--rem < 0)
+ return (-1);
+ if ((c = readline(f, linebuf, LINESIZE)) <= 0)
+ return (-1);
+ for (cp = linebuf; isprint((unsigned char)*cp) && *cp != ' ' && *cp != ':';
+ cp++)
+ ;
+ if (*cp != ':' || cp == linebuf)
+ continue;
+ /*
+ * I guess we got a headline.
+ * Handle wraparounding
+ */
+ *colon = cp;
+ cp = linebuf + c;
+ for (;;) {
+ while (--cp >= linebuf && (*cp == ' ' || *cp == '\t'))
+ ;
+ cp++;
+ if (rem <= 0)
+ break;
+ ungetc(c = getc(f), f);
+ if (c != ' ' && c != '\t')
+ break;
+ if ((c = readline(f, line2, LINESIZE)) < 0)
+ break;
+ rem--;
+ for (cp2 = line2; *cp2 == ' ' || *cp2 == '\t'; cp2++)
+ ;
+ c -= cp2 - line2;
+ if (cp + c >= linebuf + LINESIZE - 2)
+ break;
+ *cp++ = ' ';
+ bcopy(cp2, cp, c);
+ cp += c;
+ }
+ *cp = 0;
+ return (rem);
+ }
+ /* NOTREACHED */
+}
+
+/*
+ * Check whether the passed line is a header line of
+ * the desired breed. Return the field body, or 0.
+ */
+
+char*
+ishfield(char linebuf[], char *colon, const char *field)
+{
+ char *cp = colon;
+
+ *cp = 0;
+ if (strcasecmp(linebuf, field) != 0) {
+ *cp = ':';
+ return (0);
+ }
+ *cp = ':';
+ for (cp++; *cp == ' ' || *cp == '\t'; cp++)
+ ;
+ return (cp);
+}
+
+/*
+ * Copy a string and lowercase the result.
+ * dsize: space left in buffer (including space for NULL)
+ */
+void
+istrncpy(char *dest, const char *src, size_t dsize)
+{
+
+ strlcpy(dest, src, dsize);
+ for (; *dest; dest++)
+ *dest = tolower((unsigned char)*dest);
+}
+
+/*
+ * The following code deals with input stacking to do source
+ * commands. All but the current file pointer are saved on
+ * the stack.
+ */
+
+static int ssp; /* Top of file stack */
+struct sstack {
+ FILE *s_file; /* File we were in. */
+ int s_cond; /* Saved state of conditionals */
+ int s_loading; /* Loading .mailrc, etc. */
+};
+#define SSTACK_SIZE 64 /* XXX was NOFILE. */
+static struct sstack sstack[SSTACK_SIZE];
+
+/*
+ * Pushdown current input file and switch to a new one.
+ * Set the global flag "sourcing" so that others will realize
+ * that they are no longer reading from a tty (in all probability).
+ */
+int
+source(char **arglist)
+{
+ FILE *fi;
+ char *cp;
+
+ if ((cp = expand(*arglist)) == NULL)
+ return (1);
+ if ((fi = Fopen(cp, "r")) == NULL) {
+ warn("%s", cp);
+ return (1);
+ }
+ if (ssp >= SSTACK_SIZE - 1) {
+ printf("Too much \"sourcing\" going on.\n");
+ (void)Fclose(fi);
+ return (1);
+ }
+ sstack[ssp].s_file = input;
+ sstack[ssp].s_cond = cond;
+ sstack[ssp].s_loading = loading;
+ ssp++;
+ loading = 0;
+ cond = CANY;
+ input = fi;
+ sourcing++;
+ return (0);
+}
+
+/*
+ * Pop the current input back to the previous level.
+ * Update the "sourcing" flag as appropriate.
+ */
+int
+unstack(void)
+{
+ if (ssp <= 0) {
+ printf("\"Source\" stack over-pop.\n");
+ sourcing = 0;
+ return (1);
+ }
+ (void)Fclose(input);
+ if (cond != CANY)
+ printf("Unmatched \"if\"\n");
+ ssp--;
+ cond = sstack[ssp].s_cond;
+ loading = sstack[ssp].s_loading;
+ input = sstack[ssp].s_file;
+ if (ssp == 0)
+ sourcing = loading;
+ return (0);
+}
+
+/*
+ * Touch the indicated file.
+ * This is nifty for the shell.
+ */
+void
+alter(char *name)
+{
+ struct timespec ts[2];
+
+ (void)clock_gettime(CLOCK_REALTIME, &ts[0]);
+ ts[0].tv_sec++;
+ ts[1].tv_sec = 0;
+ ts[1].tv_nsec = UTIME_OMIT;
+ (void)utimensat(AT_FDCWD, name, ts, 0);
+}
+
+/*
+ * Get sender's name from this message. If the message has
+ * a bunch of arpanet stuff in it, we may have to skin the name
+ * before returning it.
+ */
+char *
+nameof(struct message *mp, int reptype)
+{
+ char *cp, *cp2;
+
+ cp = skin(name1(mp, reptype));
+ if (reptype != 0 || charcount(cp, '!') < 2)
+ return (cp);
+ cp2 = strrchr(cp, '!');
+ cp2--;
+ while (cp2 > cp && *cp2 != '!')
+ cp2--;
+ if (*cp2 == '!')
+ return (cp2 + 1);
+ return (cp);
+}
+
+/*
+ * Start of a "comment".
+ * Ignore it.
+ */
+char *
+skip_comment(char *cp)
+{
+ int nesting = 1;
+
+ for (; nesting > 0 && *cp; cp++) {
+ switch (*cp) {
+ case '\\':
+ if (cp[1])
+ cp++;
+ break;
+ case '(':
+ nesting++;
+ break;
+ case ')':
+ nesting--;
+ break;
+ }
+ }
+ return (cp);
+}
+
+/*
+ * Skin an arpa net address according to the RFC 822 interpretation
+ * of "host-phrase."
+ */
+char *
+skin(char *name)
+{
+ char *nbuf, *bufend, *cp, *cp2;
+ int c, gotlt, lastsp;
+
+ if (name == NULL)
+ return (NULL);
+ if (strchr(name, '(') == NULL && strchr(name, '<') == NULL
+ && strchr(name, ' ') == NULL)
+ return (name);
+
+ /* We assume that length(input) <= length(output) */
+ if ((nbuf = malloc(strlen(name) + 1)) == NULL)
+ err(1, "Out of memory");
+ gotlt = 0;
+ lastsp = 0;
+ bufend = nbuf;
+ for (cp = name, cp2 = bufend; (c = *cp++) != '\0'; ) {
+ switch (c) {
+ case '(':
+ cp = skip_comment(cp);
+ lastsp = 0;
+ break;
+
+ case '"':
+ /*
+ * Start of a "quoted-string".
+ * Copy it in its entirety.
+ */
+ while ((c = *cp) != '\0') {
+ cp++;
+ if (c == '"')
+ break;
+ if (c != '\\')
+ *cp2++ = c;
+ else if ((c = *cp) != '\0') {
+ *cp2++ = c;
+ cp++;
+ }
+ }
+ lastsp = 0;
+ break;
+
+ case ' ':
+ if (cp[0] == 'a' && cp[1] == 't' && cp[2] == ' ')
+ cp += 3, *cp2++ = '@';
+ else
+ if (cp[0] == '@' && cp[1] == ' ')
+ cp += 2, *cp2++ = '@';
+ else
+ lastsp = 1;
+ break;
+
+ case '<':
+ cp2 = bufend;
+ gotlt++;
+ lastsp = 0;
+ break;
+
+ case '>':
+ if (gotlt) {
+ gotlt = 0;
+ while ((c = *cp) != '\0' && c != ',') {
+ cp++;
+ if (c == '(')
+ cp = skip_comment(cp);
+ else if (c == '"')
+ while ((c = *cp) != '\0') {
+ cp++;
+ if (c == '"')
+ break;
+ if (c == '\\' && *cp != '\0')
+ cp++;
+ }
+ }
+ lastsp = 0;
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ if (lastsp) {
+ lastsp = 0;
+ *cp2++ = ' ';
+ }
+ *cp2++ = c;
+ if (c == ',' && !gotlt &&
+ (*cp == ' ' || *cp == '"' || *cp == '<')) {
+ *cp2++ = ' ';
+ while (*cp == ' ')
+ cp++;
+ lastsp = 0;
+ bufend = cp2;
+ }
+ }
+ }
+ *cp2 = '\0';
+
+ if ((cp = realloc(nbuf, strlen(nbuf) + 1)) != NULL)
+ nbuf = cp;
+ return (nbuf);
+}
+
+/*
+ * Fetch the sender's name from the passed message.
+ * Reptype can be
+ * 0 -- get sender's name for display purposes
+ * 1 -- get sender's name for reply
+ * 2 -- get sender's name for Reply
+ */
+char *
+name1(struct message *mp, int reptype)
+{
+ char namebuf[LINESIZE];
+ char linebuf[LINESIZE];
+ char *cp, *cp2;
+ FILE *ibuf;
+ int first = 1;
+
+ if ((cp = hfield("from", mp)) != NULL)
+ return (cp);
+ if (reptype == 0 && (cp = hfield("sender", mp)) != NULL)
+ return (cp);
+ ibuf = setinput(mp);
+ namebuf[0] = '\0';
+ if (readline(ibuf, linebuf, LINESIZE) < 0)
+ return (savestr(namebuf));
+newname:
+ for (cp = linebuf; *cp != '\0' && *cp != ' '; cp++)
+ ;
+ for (; *cp == ' ' || *cp == '\t'; cp++)
+ ;
+ for (cp2 = &namebuf[strlen(namebuf)];
+ *cp != '\0' && *cp != ' ' && *cp != '\t' &&
+ cp2 < namebuf + LINESIZE - 1;)
+ *cp2++ = *cp++;
+ *cp2 = '\0';
+ if (readline(ibuf, linebuf, LINESIZE) < 0)
+ return (savestr(namebuf));
+ if ((cp = strchr(linebuf, 'F')) == NULL)
+ return (savestr(namebuf));
+ if (strncmp(cp, "From", 4) != 0)
+ return (savestr(namebuf));
+ while ((cp = strchr(cp, 'r')) != NULL) {
+ if (strncmp(cp, "remote", 6) == 0) {
+ if ((cp = strchr(cp, 'f')) == NULL)
+ break;
+ if (strncmp(cp, "from", 4) != 0)
+ break;
+ if ((cp = strchr(cp, ' ')) == NULL)
+ break;
+ cp++;
+ if (first) {
+ cp2 = namebuf;
+ first = 0;
+ } else
+ cp2 = strrchr(namebuf, '!') + 1;
+ strlcpy(cp2, cp, sizeof(namebuf) - (cp2 - namebuf) - 1);
+ strcat(namebuf, "!");
+ goto newname;
+ }
+ cp++;
+ }
+ return (savestr(namebuf));
+}
+
+/*
+ * Count the occurrences of c in str
+ */
+int
+charcount(char *str, int c)
+{
+ char *cp;
+ int i;
+
+ for (i = 0, cp = str; *cp != '\0'; cp++)
+ if (*cp == c)
+ i++;
+ return (i);
+}
+
+/*
+ * See if the given header field is supposed to be ignored.
+ */
+int
+isign(const char *field, struct ignoretab ignore[2])
+{
+ char realfld[LINESIZE];
+
+ if (ignore == ignoreall)
+ return (1);
+ /*
+ * Lower-case the string, so that "Status" and "status"
+ * will hash to the same place.
+ */
+ istrncpy(realfld, field, sizeof(realfld));
+ if (ignore[1].i_count > 0)
+ return (!member(realfld, ignore + 1));
+ else
+ return (member(realfld, ignore));
+}
+
+int
+member(char *realfield, struct ignoretab *table)
+{
+ struct ignore *igp;
+
+ for (igp = table->i_head[hash(realfield)]; igp != NULL; igp = igp->i_link)
+ if (*igp->i_field == *realfield &&
+ equal(igp->i_field, realfield))
+ return (1);
+ return (0);
+}
diff --git a/usr.bin/mail/v7.local.c b/usr.bin/mail/v7.local.c
new file mode 100644
index 0000000..8fc2f64
--- /dev/null
+++ b/usr.bin/mail/v7.local.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)v7.local.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Mail -- a mail program
+ *
+ * Version 7
+ *
+ * Local routines that are installation dependent.
+ */
+
+#include "rcv.h"
+#include <fcntl.h>
+#include "extern.h"
+
+/*
+ * Locate the user's mailbox file (ie, the place where new, unread
+ * mail is queued).
+ */
+void
+findmail(char *user, char *buf, int buflen)
+{
+ char *tmp = getenv("MAIL");
+
+ if (tmp == NULL)
+ (void)snprintf(buf, buflen, "%s/%s", _PATH_MAILDIR, user);
+ else
+ (void)strlcpy(buf, tmp, buflen);
+}
+
+/*
+ * Get rid of the queued mail.
+ */
+void
+demail(void)
+{
+
+ if (value("keep") != NULL || rm(mailname) < 0)
+ (void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600));
+}
+
+/*
+ * Discover user login name.
+ */
+char *
+username(void)
+{
+ char *np;
+ uid_t uid;
+
+ if ((np = getenv("USER")) != NULL)
+ return (np);
+ if ((np = getenv("LOGNAME")) != NULL)
+ return (np);
+ if ((np = getname(uid = getuid())) != NULL)
+ return (np);
+ printf("Cannot associate a name with uid %u\n", (unsigned)uid);
+ return (NULL);
+}
diff --git a/usr.bin/mail/vars.c b/usr.bin/mail/vars.c
new file mode 100644
index 0000000..dca0604
--- /dev/null
+++ b/usr.bin/mail/vars.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "rcv.h"
+#include "extern.h"
+
+/*
+ * Mail -- a mail program
+ *
+ * Variable handling stuff.
+ */
+
+/*
+ * Assign a value to a variable.
+ */
+void
+assign(const char *name, const char *value)
+{
+ struct var *vp;
+ int h;
+
+ h = hash(name);
+ vp = lookup(name);
+ if (vp == NULL) {
+ vp = calloc(sizeof(*vp), 1);
+ vp->v_name = vcopy(name);
+ vp->v_link = variables[h];
+ variables[h] = vp;
+ }
+ else
+ vfree(vp->v_value);
+ vp->v_value = vcopy(value);
+}
+
+/*
+ * Free up a variable string. We do not bother to allocate
+ * strings whose value is "" since they are expected to be frequent.
+ * Thus, we cannot free same!
+ */
+void
+vfree(char *cp)
+{
+ if (*cp != '\0')
+ (void)free(cp);
+}
+
+/*
+ * Copy a variable value into permanent (ie, not collected after each
+ * command) space. Do not bother to alloc space for ""
+ */
+
+char *
+vcopy(const char *str)
+{
+ char *new;
+ unsigned len;
+
+ if (*str == '\0')
+ return ("");
+ len = strlen(str) + 1;
+ if ((new = malloc(len)) == NULL)
+ err(1, "Out of memory");
+ bcopy(str, new, (int)len);
+ return (new);
+}
+
+/*
+ * Get the value of a variable and return it.
+ * Look in the environment if its not available locally.
+ */
+
+char *
+value(const char *name)
+{
+ struct var *vp;
+
+ if ((vp = lookup(name)) == NULL)
+ return (getenv(name));
+ return (vp->v_value);
+}
+
+/*
+ * Locate a variable and return its variable
+ * node.
+ */
+
+struct var *
+lookup(const char *name)
+{
+ struct var *vp;
+
+ for (vp = variables[hash(name)]; vp != NULL; vp = vp->v_link)
+ if (*vp->v_name == *name && equal(vp->v_name, name))
+ return (vp);
+ return (NULL);
+}
+
+/*
+ * Locate a group name and return it.
+ */
+
+struct grouphead *
+findgroup(char name[])
+{
+ struct grouphead *gh;
+
+ for (gh = groups[hash(name)]; gh != NULL; gh = gh->g_link)
+ if (*gh->g_name == *name && equal(gh->g_name, name))
+ return (gh);
+ return (NULL);
+}
+
+/*
+ * Print a group out on stdout
+ */
+void
+printgroup(char name[])
+{
+ struct grouphead *gh;
+ struct group *gp;
+
+ if ((gh = findgroup(name)) == NULL) {
+ printf("\"%s\": not a group\n", name);
+ return;
+ }
+ printf("%s\t", gh->g_name);
+ for (gp = gh->g_list; gp != NULL; gp = gp->ge_link)
+ printf(" %s", gp->ge_name);
+ printf("\n");
+}
+
+/*
+ * Hash the passed string and return an index into
+ * the variable or group hash table.
+ */
+int
+hash(const char *name)
+{
+ int h = 0;
+
+ while (*name != '\0') {
+ h <<= 2;
+ h += *name++;
+ }
+ if (h < 0 && (h = -h) < 0)
+ h = 0;
+ return (h % HSHSIZE);
+}
diff --git a/usr.bin/mail/version.c b/usr.bin/mail/version.c
new file mode 100644
index 0000000..379fda8
--- /dev/null
+++ b/usr.bin/mail/version.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1980, 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
+#if 0
+static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Just keep track of the date/sid of this version of Mail.
+ * Load this file first to get a "total" Mail version.
+ */
+const char *version = "8.1 6/6/93";
diff --git a/usr.bin/makewhatis/Makefile b/usr.bin/makewhatis/Makefile
new file mode 100644
index 0000000..9530bca
--- /dev/null
+++ b/usr.bin/makewhatis/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= makewhatis
+LIBADD= z
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/makewhatis/Makefile.depend b/usr.bin/makewhatis/Makefile.depend
new file mode 100644
index 0000000..d209adb
--- /dev/null
+++ b/usr.bin/makewhatis/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/makewhatis/makewhatis.1 b/usr.bin/makewhatis/makewhatis.1
new file mode 100644
index 0000000..1928c84
--- /dev/null
+++ b/usr.bin/makewhatis/makewhatis.1
@@ -0,0 +1,136 @@
+.\" Copyright (c) 2002 John Rochester
+.\" 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 December 3, 2005
+.Dt MAKEWHATIS 1
+.Os
+.Sh NAME
+.Nm makewhatis
+.Nd "create whatis database"
+.Sh SYNOPSIS
+.Nm
+.Op Fl a
+.Op Fl i Ar column
+.Op Fl n Ar name
+.Op Fl o Ar file
+.Op Fl v
+.Op Fl L
+.Op Ar directories ...
+.Sh DESCRIPTION
+The
+.Nm
+utility collects the names and short descriptions from all the unformatted
+man pages in the
+.Ar directories
+and puts them into a file used by the
+.Xr whatis 1
+and
+.Xr apropos 1
+commands.
+Directories may be separated by colons instead of spaces.
+If no
+.Ar directories
+are specified, the contents of the
+.Ev MANPATH
+environment variable will be used, or if that is not set, the default directory
+.Pa /usr/share/man
+will be processed.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl i Ar column"
+.It Fl a
+Appends to the output file(s) instead of replacing them.
+The output
+will be sorted with duplicate lines removed, but may have obsolete
+entries.
+.It Fl i Ar column
+Indents the description by
+.Ar column
+characters.
+The default value is 24.
+.It Fl n Ar name
+Uses
+.Ar name
+instead of
+.Pa whatis .
+.It Fl o Ar file
+Outputs all lines to the
+.Ar file
+instead of
+.Pa */man/whatis .
+.It Fl v
+Makes
+.Nm
+more verbose about what it is doing.
+.It Fl L
+Process only localized subdirectories corresponding to the locale specified
+in the standard environment variables.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev MANPATH"
+.It Ev LC_ALL , LC_CTYPE , LANG
+These variables control what subdirectories will be processed if the
+.Fl L
+option is used.
+.It Ev MACHINE
+If set, its value is used to override the current
+machine type when searching machine specific subdirectories.
+.It Ev MACHINE_ARCH
+If set, its value is used to override the current
+architecture when searching architecture specific subdirectories.
+.It Ev MANPATH
+Determines the set of directories to be processed if none are given on
+the command line.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/man" -compact
+.It Pa /usr/share/man
+Default directory to process if the
+.Ev MANPATH
+environment variable is not set.
+.It Pa */man/whatis
+The default output file.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr whatis 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 2.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+program was originally written in Perl and was contributed by
+.An Wolfram Schneider .
+The current version of
+.Nm
+was rewritten in C by
+.An John Rochester .
diff --git a/usr.bin/makewhatis/makewhatis.c b/usr.bin/makewhatis/makewhatis.c
new file mode 100644
index 0000000..45abc8f
--- /dev/null
+++ b/usr.bin/makewhatis/makewhatis.c
@@ -0,0 +1,1049 @@
+/*-
+ * Copyright (c) 2002 John Rochester
+ * 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.
+ * 3. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/utsname.h>
+
+#include <ctype.h>
+#include <dirent.h>
+#include <err.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stringlist.h>
+#include <unistd.h>
+#include <zlib.h>
+
+#define DEFAULT_MANPATH "/usr/share/man"
+#define LINE_ALLOC 4096
+
+static char blank[] = "";
+
+/*
+ * Information collected about each man page in a section.
+ */
+struct page_info {
+ char * filename;
+ char * name;
+ char * suffix;
+ int gzipped;
+ ino_t inode;
+};
+
+/*
+ * An entry kept for each visited directory.
+ */
+struct visited_dir {
+ dev_t device;
+ ino_t inode;
+ SLIST_ENTRY(visited_dir) next;
+};
+
+/*
+ * an expanding string
+ */
+struct sbuf {
+ char * content; /* the start of the buffer */
+ char * end; /* just past the end of the content */
+ char * last; /* the last allocated character */
+};
+
+/*
+ * Removes the last amount characters from the sbuf.
+ */
+#define sbuf_retract(sbuf, amount) \
+ ((sbuf)->end -= (amount))
+/*
+ * Returns the length of the sbuf content.
+ */
+#define sbuf_length(sbuf) \
+ ((sbuf)->end - (sbuf)->content)
+
+typedef char *edited_copy(char *from, char *to, int length);
+
+static int append; /* -a flag: append to existing whatis */
+static int verbose; /* -v flag: be verbose with warnings */
+static int indent = 24; /* -i option: description indentation */
+static const char *whatis_name="whatis";/* -n option: the name */
+static char *common_output; /* -o option: the single output file */
+static char *locale; /* user's locale if -L is used */
+static char *lang_locale; /* short form of locale */
+static const char *machine, *machine_arch;
+
+static int exit_code; /* exit code to use when finished */
+static SLIST_HEAD(, visited_dir) visited_dirs =
+ SLIST_HEAD_INITIALIZER(visited_dirs);
+
+/*
+ * While the whatis line is being formed, it is stored in whatis_proto.
+ * When finished, it is reformatted into whatis_final and then appended
+ * to whatis_lines.
+ */
+static struct sbuf *whatis_proto;
+static struct sbuf *whatis_final;
+static StringList *whatis_lines; /* collected output lines */
+
+static char tmp_file[MAXPATHLEN]; /* path of temporary file, if any */
+
+/* A set of possible names for the NAME man page section */
+static const char *name_section_titles[] = {
+ "NAME", "Name", "NAMN", "BEZEICHNUNG", "\xcc\xbe\xbe\xce",
+ "\xee\xe1\xfa\xf7\xe1\xee\xe9\xe5", NULL
+};
+
+/* A subset of the mdoc(7) commands to ignore */
+static char mdoc_commands[] = "ArDvErEvFlLiNmPa";
+
+/*
+ * Frees a struct page_info and its content.
+ */
+static void
+free_page_info(struct page_info *info)
+{
+ free(info->filename);
+ free(info->name);
+ free(info->suffix);
+ free(info);
+}
+
+/*
+ * Allocates and fills in a new struct page_info given the
+ * name of the man section directory and the dirent of the file.
+ * If the file is not a man page, returns NULL.
+ */
+static struct page_info *
+new_page_info(char *dir, struct dirent *dirent)
+{
+ struct page_info *info;
+ int basename_length;
+ char *suffix;
+ struct stat st;
+
+ info = (struct page_info *) malloc(sizeof(struct page_info));
+ if (info == NULL)
+ err(1, "malloc");
+ basename_length = strlen(dirent->d_name);
+ suffix = &dirent->d_name[basename_length];
+ asprintf(&info->filename, "%s/%s", dir, dirent->d_name);
+ if ((info->gzipped = basename_length >= 4 && strcmp(&dirent->d_name[basename_length - 3], ".gz") == 0)) {
+ suffix -= 3;
+ *suffix = '\0';
+ }
+ for (;;) {
+ if (--suffix == dirent->d_name || !isalnum(*suffix)) {
+ if (*suffix == '.')
+ break;
+ if (verbose)
+ warnx("%s: invalid man page name", info->filename);
+ free(info->filename);
+ free(info);
+ return NULL;
+ }
+ }
+ *suffix++ = '\0';
+ info->name = strdup(dirent->d_name);
+ info->suffix = strdup(suffix);
+ if (stat(info->filename, &st) < 0) {
+ warn("%s", info->filename);
+ free_page_info(info);
+ return NULL;
+ }
+ if (!S_ISREG(st.st_mode)) {
+ if (verbose && !S_ISDIR(st.st_mode))
+ warnx("%s: not a regular file", info->filename);
+ free_page_info(info);
+ return NULL;
+ }
+ info->inode = st.st_ino;
+ return info;
+}
+
+/*
+ * Reset an sbuf's length to 0.
+ */
+static void
+sbuf_clear(struct sbuf *sbuf)
+{
+ sbuf->end = sbuf->content;
+}
+
+/*
+ * Allocate a new sbuf.
+ */
+static struct sbuf *
+new_sbuf(void)
+{
+ struct sbuf *sbuf = (struct sbuf *) malloc(sizeof(struct sbuf));
+ sbuf->content = (char *) malloc(LINE_ALLOC);
+ sbuf->last = sbuf->content + LINE_ALLOC - 1;
+ sbuf_clear(sbuf);
+ return sbuf;
+}
+
+/*
+ * Ensure that there is enough room in the sbuf for nchars more characters.
+ */
+static void
+sbuf_need(struct sbuf *sbuf, int nchars)
+{
+ char *new_content;
+ size_t size, cntsize;
+
+ /* double the size of the allocation until the buffer is big enough */
+ while (sbuf->end + nchars > sbuf->last) {
+ size = sbuf->last + 1 - sbuf->content;
+ size *= 2;
+ cntsize = sbuf->end - sbuf->content;
+
+ new_content = (char *)malloc(size);
+ memcpy(new_content, sbuf->content, cntsize);
+ free(sbuf->content);
+ sbuf->content = new_content;
+ sbuf->end = new_content + cntsize;
+ sbuf->last = new_content + size - 1;
+ }
+}
+
+/*
+ * Appends a string of a given length to the sbuf.
+ */
+static void
+sbuf_append(struct sbuf *sbuf, const char *text, int length)
+{
+ if (length > 0) {
+ sbuf_need(sbuf, length);
+ memcpy(sbuf->end, text, length);
+ sbuf->end += length;
+ }
+}
+
+/*
+ * Appends a null-terminated string to the sbuf.
+ */
+static void
+sbuf_append_str(struct sbuf *sbuf, char *text)
+{
+ sbuf_append(sbuf, text, strlen(text));
+}
+
+/*
+ * Appends an edited null-terminated string to the sbuf.
+ */
+static void
+sbuf_append_edited(struct sbuf *sbuf, char *text, edited_copy copy)
+{
+ int length = strlen(text);
+ if (length > 0) {
+ sbuf_need(sbuf, length);
+ sbuf->end = copy(text, sbuf->end, length);
+ }
+}
+
+/*
+ * Strips any of a set of chars from the end of the sbuf.
+ */
+static void
+sbuf_strip(struct sbuf *sbuf, const char *set)
+{
+ while (sbuf->end > sbuf->content && strchr(set, sbuf->end[-1]) != NULL)
+ sbuf->end--;
+}
+
+/*
+ * Returns the null-terminated string built by the sbuf.
+ */
+static char *
+sbuf_content(struct sbuf *sbuf)
+{
+ *sbuf->end = '\0';
+ return sbuf->content;
+}
+
+/*
+ * Returns true if no man page exists in the directory with
+ * any of the names in the StringList.
+ */
+static int
+no_page_exists(char *dir, StringList *names, char *suffix)
+{
+ char path[MAXPATHLEN];
+ size_t i;
+
+ for (i = 0; i < names->sl_cur; i++) {
+ snprintf(path, sizeof path, "%s/%s.%s.gz", dir, names->sl_str[i], suffix);
+ if (access(path, F_OK) < 0) {
+ path[strlen(path) - 3] = '\0';
+ if (access(path, F_OK) < 0)
+ continue;
+ }
+ return 0;
+ }
+ return 1;
+}
+
+static void
+trap_signal(int sig __unused)
+{
+ if (tmp_file[0] != '\0')
+ unlink(tmp_file);
+ exit(1);
+}
+
+/*
+ * Attempts to open an output file. Returns NULL if unsuccessful.
+ */
+static FILE *
+open_output(char *name)
+{
+ FILE *output;
+
+ whatis_lines = sl_init();
+ if (append) {
+ char line[LINE_ALLOC];
+
+ output = fopen(name, "r");
+ if (output == NULL) {
+ warn("%s", name);
+ exit_code = 1;
+ return NULL;
+ }
+ while (fgets(line, sizeof line, output) != NULL) {
+ line[strlen(line) - 1] = '\0';
+ sl_add(whatis_lines, strdup(line));
+ }
+ }
+ if (common_output == NULL) {
+ snprintf(tmp_file, sizeof tmp_file, "%s.tmp", name);
+ name = tmp_file;
+ }
+ output = fopen(name, "w");
+ if (output == NULL) {
+ warn("%s", name);
+ exit_code = 1;
+ return NULL;
+ }
+ return output;
+}
+
+static int
+linesort(const void *a, const void *b)
+{
+ return strcmp((*(const char * const *)a), (*(const char * const *)b));
+}
+
+/*
+ * Writes the unique sorted lines to the output file.
+ */
+static void
+finish_output(FILE *output, char *name)
+{
+ size_t i;
+ char *prev = NULL;
+
+ qsort(whatis_lines->sl_str, whatis_lines->sl_cur, sizeof(char *), linesort);
+ for (i = 0; i < whatis_lines->sl_cur; i++) {
+ char *line = whatis_lines->sl_str[i];
+ if (i > 0 && strcmp(line, prev) == 0)
+ continue;
+ prev = line;
+ fputs(line, output);
+ putc('\n', output);
+ }
+ fclose(output);
+ sl_free(whatis_lines, 1);
+ if (common_output == NULL) {
+ rename(tmp_file, name);
+ unlink(tmp_file);
+ }
+}
+
+static FILE *
+open_whatis(char *mandir)
+{
+ char filename[MAXPATHLEN];
+
+ snprintf(filename, sizeof filename, "%s/%s", mandir, whatis_name);
+ return open_output(filename);
+}
+
+static void
+finish_whatis(FILE *output, char *mandir)
+{
+ char filename[MAXPATHLEN];
+
+ snprintf(filename, sizeof filename, "%s/%s", mandir, whatis_name);
+ finish_output(output, filename);
+}
+
+/*
+ * Tests to see if the given directory has already been visited.
+ */
+static int
+already_visited(char *dir)
+{
+ struct stat st;
+ struct visited_dir *visit;
+
+ if (stat(dir, &st) < 0) {
+ warn("%s", dir);
+ exit_code = 1;
+ return 1;
+ }
+ SLIST_FOREACH(visit, &visited_dirs, next) {
+ if (visit->inode == st.st_ino &&
+ visit->device == st.st_dev) {
+ warnx("already visited %s", dir);
+ return 1;
+ }
+ }
+ visit = (struct visited_dir *) malloc(sizeof(struct visited_dir));
+ visit->device = st.st_dev;
+ visit->inode = st.st_ino;
+ SLIST_INSERT_HEAD(&visited_dirs, visit, next);
+ return 0;
+}
+
+/*
+ * Removes trailing spaces from a string, returning a pointer to just
+ * beyond the new last character.
+ */
+static char *
+trim_rhs(char *str)
+{
+ char *rhs = &str[strlen(str)];
+ while (--rhs > str && isspace(*rhs))
+ ;
+ *++rhs = '\0';
+ return rhs;
+}
+
+/*
+ * Returns a pointer to the next non-space character in the string.
+ */
+static char *
+skip_spaces(char *s)
+{
+ while (*s != '\0' && isspace(*s))
+ s++;
+ return s;
+}
+
+/*
+ * Returns whether the string contains only digits.
+ */
+static int
+only_digits(char *line)
+{
+ if (!isdigit(*line++))
+ return 0;
+ while (isdigit(*line))
+ line++;
+ return *line == '\0';
+}
+
+/*
+ * Returns whether the line is of one of the forms:
+ * .Sh NAME
+ * .Sh "NAME"
+ * etc.
+ * assuming that section_start is ".Sh".
+ */
+static int
+name_section_line(char *line, const char *section_start)
+{
+ char *rhs;
+ const char **title;
+
+ if (strncmp(line, section_start, 3) != 0)
+ return 0;
+ line = skip_spaces(line + 3);
+ rhs = trim_rhs(line);
+ if (*line == '"') {
+ line++;
+ if (*--rhs == '"')
+ *rhs = '\0';
+ }
+ for (title = name_section_titles; *title != NULL; title++)
+ if (strcmp(*title, line) == 0)
+ return 1;
+ return 0;
+}
+
+/*
+ * Copies characters while removing the most common nroff/troff
+ * markup:
+ * \(em, \(mi, \s[+-N], \&
+ * \fF, \f(fo, \f[font]
+ * \*s, \*(st, \*[stringvar]
+ */
+static char *
+de_nroff_copy(char *from, char *to, int fromlen)
+{
+ char *from_end = &from[fromlen];
+ while (from < from_end) {
+ switch (*from) {
+ case '\\':
+ switch (*++from) {
+ case '(':
+ if (strncmp(&from[1], "em", 2) == 0 ||
+ strncmp(&from[1], "mi", 2) == 0) {
+ from += 3;
+ continue;
+ }
+ break;
+ case 's':
+ if (*++from == '-')
+ from++;
+ while (isdigit(*from))
+ from++;
+ continue;
+ case 'f':
+ case '*':
+ if (*++from == '(')
+ from += 3;
+ else if (*from == '[') {
+ while (*++from != ']' && from < from_end);
+ from++;
+ } else
+ from++;
+ continue;
+ case '&':
+ from++;
+ continue;
+ }
+ break;
+ }
+ *to++ = *from++;
+ }
+ return to;
+}
+
+/*
+ * Appends a string with the nroff formatting removed.
+ */
+static void
+add_nroff(char *text)
+{
+ sbuf_append_edited(whatis_proto, text, de_nroff_copy);
+}
+
+/*
+ * Appends "name(suffix), " to whatis_final.
+ */
+static void
+add_whatis_name(char *name, char *suffix)
+{
+ if (*name != '\0') {
+ sbuf_append_str(whatis_final, name);
+ sbuf_append(whatis_final, "(", 1);
+ sbuf_append_str(whatis_final, suffix);
+ sbuf_append(whatis_final, "), ", 3);
+ }
+}
+
+/*
+ * Processes an old-style man(7) line. This ignores commands with only
+ * a single number argument.
+ */
+static void
+process_man_line(char *line)
+{
+ if (*line == '.') {
+ while (isalpha(*++line))
+ ;
+ line = skip_spaces(line);
+ if (only_digits(line))
+ return;
+ } else
+ line = skip_spaces(line);
+ if (*line != '\0') {
+ add_nroff(line);
+ sbuf_append(whatis_proto, " ", 1);
+ }
+}
+
+/*
+ * Processes a new-style mdoc(7) line.
+ */
+static void
+process_mdoc_line(char *line)
+{
+ int xref;
+ int arg = 0;
+ char *line_end = &line[strlen(line)];
+ int orig_length = sbuf_length(whatis_proto);
+ char *next;
+
+ if (*line == '\0')
+ return;
+ if (line[0] != '.' || !isupper(line[1]) || !islower(line[2])) {
+ add_nroff(skip_spaces(line));
+ sbuf_append(whatis_proto, " ", 1);
+ return;
+ }
+ xref = strncmp(line, ".Xr", 3) == 0;
+ line += 3;
+ while ((line = skip_spaces(line)) < line_end) {
+ if (*line == '"') {
+ next = ++line;
+ for (;;) {
+ next = strchr(next, '"');
+ if (next == NULL)
+ break;
+ memmove(next, next + 1, strlen(next));
+ line_end--;
+ if (*next != '"')
+ break;
+ next++;
+ }
+ } else
+ next = strpbrk(line, " \t");
+ if (next != NULL)
+ *next++ = '\0';
+ else
+ next = line_end;
+ if (isupper(*line) && islower(line[1]) && line[2] == '\0') {
+ if (strcmp(line, "Ns") == 0) {
+ arg = 0;
+ line = next;
+ continue;
+ }
+ if (strstr(mdoc_commands, line) != NULL) {
+ line = next;
+ continue;
+ }
+ }
+ if (arg > 0 && strchr(",.:;?!)]", *line) == 0) {
+ if (xref) {
+ sbuf_append(whatis_proto, "(", 1);
+ add_nroff(line);
+ sbuf_append(whatis_proto, ")", 1);
+ xref = 0;
+ line = blank;
+ } else
+ sbuf_append(whatis_proto, " ", 1);
+ }
+ add_nroff(line);
+ arg++;
+ line = next;
+ }
+ if (sbuf_length(whatis_proto) > orig_length)
+ sbuf_append(whatis_proto, " ", 1);
+}
+
+/*
+ * Collects a list of comma-separated names from the text.
+ */
+static void
+collect_names(StringList *names, char *text)
+{
+ char *arg;
+
+ for (;;) {
+ arg = text;
+ text = strchr(text, ',');
+ if (text != NULL)
+ *text++ = '\0';
+ sl_add(names, arg);
+ if (text == NULL)
+ return;
+ if (*text == ' ')
+ text++;
+ }
+}
+
+enum { STATE_UNKNOWN, STATE_MANSTYLE, STATE_MDOCNAME, STATE_MDOCDESC };
+
+/*
+ * Processes a man page source into a single whatis line and adds it
+ * to whatis_lines.
+ */
+static void
+process_page(struct page_info *page, char *section_dir)
+{
+ gzFile in;
+ char buffer[4096];
+ char *line;
+ StringList *names;
+ char *descr;
+ int state = STATE_UNKNOWN;
+ size_t i;
+
+ sbuf_clear(whatis_proto);
+ if ((in = gzopen(page->filename, "r")) == NULL) {
+ warn("%s", page->filename);
+ exit_code = 1;
+ return;
+ }
+ while (gzgets(in, buffer, sizeof buffer) != NULL) {
+ line = buffer;
+ if (strncmp(line, ".\\\"", 3) == 0) /* ignore comments */
+ continue;
+ switch (state) {
+ /*
+ * haven't reached the NAME section yet.
+ */
+ case STATE_UNKNOWN:
+ if (name_section_line(line, ".SH"))
+ state = STATE_MANSTYLE;
+ else if (name_section_line(line, ".Sh"))
+ state = STATE_MDOCNAME;
+ continue;
+ /*
+ * Inside an old-style .SH NAME section.
+ */
+ case STATE_MANSTYLE:
+ if (strncmp(line, ".SH", 3) == 0)
+ break;
+ if (strncmp(line, ".SS", 3) == 0)
+ break;
+ trim_rhs(line);
+ if (strcmp(line, ".") == 0)
+ continue;
+ if (strncmp(line, ".IX", 3) == 0) {
+ line += 3;
+ line = skip_spaces(line);
+ }
+ process_man_line(line);
+ continue;
+ /*
+ * Inside a new-style .Sh NAME section (the .Nm part).
+ */
+ case STATE_MDOCNAME:
+ trim_rhs(line);
+ if (strncmp(line, ".Nm", 3) == 0) {
+ process_mdoc_line(line);
+ continue;
+ } else {
+ if (strcmp(line, ".") == 0)
+ continue;
+ sbuf_append(whatis_proto, "- ", 2);
+ state = STATE_MDOCDESC;
+ }
+ /* fall through */
+ /*
+ * Inside a new-style .Sh NAME section (after the .Nm-s).
+ */
+ case STATE_MDOCDESC:
+ if (strncmp(line, ".Sh", 3) == 0)
+ break;
+ trim_rhs(line);
+ if (strcmp(line, ".") == 0)
+ continue;
+ process_mdoc_line(line);
+ continue;
+ }
+ break;
+ }
+ gzclose(in);
+ sbuf_strip(whatis_proto, " \t.-");
+ line = sbuf_content(whatis_proto);
+ /*
+ * line now contains the appropriate data, but without
+ * the proper indentation or the section appended to each name.
+ */
+ descr = strstr(line, " - ");
+ if (descr == NULL) {
+ descr = strchr(line, ' ');
+ if (descr == NULL) {
+ if (verbose)
+ fprintf(stderr, " ignoring junk description \"%s\"\n", line);
+ return;
+ }
+ *descr++ = '\0';
+ } else {
+ *descr = '\0';
+ descr += 3;
+ }
+ names = sl_init();
+ collect_names(names, line);
+ sbuf_clear(whatis_final);
+ if (!sl_find(names, page->name) && no_page_exists(section_dir, names, page->suffix)) {
+ /*
+ * Add the page name since that's the only thing that
+ * man(1) will find.
+ */
+ add_whatis_name(page->name, page->suffix);
+ }
+ for (i = 0; i < names->sl_cur; i++)
+ add_whatis_name(names->sl_str[i], page->suffix);
+ sl_free(names, 0);
+ sbuf_retract(whatis_final, 2); /* remove last ", " */
+ while (sbuf_length(whatis_final) < indent)
+ sbuf_append(whatis_final, " ", 1);
+ sbuf_append(whatis_final, " - ", 3);
+ sbuf_append_str(whatis_final, skip_spaces(descr));
+ sl_add(whatis_lines, strdup(sbuf_content(whatis_final)));
+}
+
+/*
+ * Sorts pages first by inode number, then by name.
+ */
+static int
+pagesort(const void *a, const void *b)
+{
+ const struct page_info *p1 = *(struct page_info * const *) a;
+ const struct page_info *p2 = *(struct page_info * const *) b;
+ if (p1->inode == p2->inode)
+ return strcmp(p1->name, p2->name);
+ return p1->inode - p2->inode;
+}
+
+/*
+ * Processes a single man section.
+ */
+static void
+process_section(char *section_dir)
+{
+ struct dirent **entries;
+ int nentries;
+ struct page_info **pages;
+ int npages = 0;
+ int i;
+ ino_t prev_inode = 0;
+
+ if (verbose)
+ fprintf(stderr, " %s\n", section_dir);
+
+ /*
+ * scan the man section directory for pages
+ */
+ nentries = scandir(section_dir, &entries, NULL, alphasort);
+ if (nentries < 0) {
+ warn("%s", section_dir);
+ exit_code = 1;
+ return;
+ }
+ /*
+ * collect information about man pages
+ */
+ pages = (struct page_info **) calloc(nentries, sizeof(struct page_info *));
+ for (i = 0; i < nentries; i++) {
+ struct page_info *info = new_page_info(section_dir, entries[i]);
+ if (info != NULL)
+ pages[npages++] = info;
+ free(entries[i]);
+ }
+ free(entries);
+ qsort(pages, npages, sizeof(struct page_info *), pagesort);
+ /*
+ * process each unique page
+ */
+ for (i = 0; i < npages; i++) {
+ struct page_info *page = pages[i];
+ if (page->inode != prev_inode) {
+ prev_inode = page->inode;
+ if (verbose)
+ fprintf(stderr, " reading %s\n", page->filename);
+ process_page(page, section_dir);
+ } else if (verbose)
+ fprintf(stderr, " skipping %s, duplicate\n", page->filename);
+ free_page_info(page);
+ }
+ free(pages);
+}
+
+/*
+ * Returns whether the directory entry is a man page section.
+ */
+static int
+select_sections(const struct dirent *entry)
+{
+ const char *p = &entry->d_name[3];
+
+ if (strncmp(entry->d_name, "man", 3) != 0)
+ return 0;
+ while (*p != '\0') {
+ if (!isalnum(*p++))
+ return 0;
+ }
+ return 1;
+}
+
+/*
+ * Processes a single top-level man directory by finding all the
+ * sub-directories named man* and processing each one in turn.
+ */
+static void
+process_mandir(char *dir_name)
+{
+ struct dirent **entries;
+ int nsections;
+ FILE *fp = NULL;
+ int i;
+ struct stat st;
+
+ if (already_visited(dir_name))
+ return;
+ if (verbose)
+ fprintf(stderr, "man directory %s\n", dir_name);
+ nsections = scandir(dir_name, &entries, select_sections, alphasort);
+ if (nsections < 0) {
+ warn("%s", dir_name);
+ exit_code = 1;
+ return;
+ }
+ if (common_output == NULL && (fp = open_whatis(dir_name)) == NULL)
+ return;
+ for (i = 0; i < nsections; i++) {
+ char section_dir[MAXPATHLEN];
+ snprintf(section_dir, sizeof section_dir, "%s/%s", dir_name, entries[i]->d_name);
+ process_section(section_dir);
+ snprintf(section_dir, sizeof section_dir, "%s/%s/%s", dir_name,
+ entries[i]->d_name, machine);
+ if (stat(section_dir, &st) == 0 && S_ISDIR(st.st_mode))
+ process_section(section_dir);
+ if (strcmp(machine_arch, machine) != 0) {
+ snprintf(section_dir, sizeof section_dir, "%s/%s/%s",
+ dir_name, entries[i]->d_name, machine_arch);
+ if (stat(section_dir, &st) == 0 && S_ISDIR(st.st_mode))
+ process_section(section_dir);
+ }
+ free(entries[i]);
+ }
+ free(entries);
+ if (common_output == NULL)
+ finish_whatis(fp, dir_name);
+}
+
+/*
+ * Processes one argument, which may be a colon-separated list of
+ * directories.
+ */
+static void
+process_argument(const char *arg)
+{
+ char *dir;
+ char *mandir;
+ char *parg;
+
+ parg = strdup(arg);
+ if (parg == NULL)
+ err(1, "out of memory");
+ while ((dir = strsep(&parg, ":")) != NULL) {
+ if (locale != NULL) {
+ asprintf(&mandir, "%s/%s", dir, locale);
+ process_mandir(mandir);
+ free(mandir);
+ if (lang_locale != NULL) {
+ asprintf(&mandir, "%s/%s", dir, lang_locale);
+ process_mandir(mandir);
+ free(mandir);
+ }
+ } else {
+ process_mandir(dir);
+ }
+ }
+ free(parg);
+}
+
+
+int
+main(int argc, char **argv)
+{
+ int opt;
+ FILE *fp = NULL;
+
+ while ((opt = getopt(argc, argv, "ai:n:o:vL")) != -1) {
+ switch (opt) {
+ case 'a':
+ append++;
+ break;
+ case 'i':
+ indent = atoi(optarg);
+ break;
+ case 'n':
+ whatis_name = optarg;
+ break;
+ case 'o':
+ common_output = optarg;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'L':
+ locale = getenv("LC_ALL");
+ if (locale == NULL)
+ locale = getenv("LC_CTYPE");
+ if (locale == NULL)
+ locale = getenv("LANG");
+ if (locale != NULL) {
+ char *sep = strchr(locale, '_');
+ if (sep != NULL && isupper(sep[1]) &&
+ isupper(sep[2])) {
+ asprintf(&lang_locale, "%.*s%s", (int)(ptrdiff_t)(sep - locale), locale, &sep[3]);
+ }
+ }
+ break;
+ default:
+ fprintf(stderr, "usage: %s [-a] [-i indent] [-n name] [-o output_file] [-v] [-L] [directories...]\n", argv[0]);
+ exit(1);
+ }
+ }
+
+ signal(SIGINT, trap_signal);
+ signal(SIGHUP, trap_signal);
+ signal(SIGQUIT, trap_signal);
+ signal(SIGTERM, trap_signal);
+ SLIST_INIT(&visited_dirs);
+ whatis_proto = new_sbuf();
+ whatis_final = new_sbuf();
+
+ if ((machine = getenv("MACHINE")) == NULL) {
+ static struct utsname utsname;
+
+ if (uname(&utsname) == -1)
+ err(1, "uname");
+ machine = utsname.machine;
+ }
+
+ if ((machine_arch = getenv("MACHINE_ARCH")) == NULL)
+ machine_arch = MACHINE_ARCH;
+
+ if (common_output != NULL && (fp = open_output(common_output)) == NULL)
+ err(1, "%s", common_output);
+ if (optind == argc) {
+ const char *manpath = getenv("MANPATH");
+ if (manpath == NULL)
+ manpath = DEFAULT_MANPATH;
+ process_argument(manpath);
+ } else {
+ while (optind < argc)
+ process_argument(argv[optind++]);
+ }
+ if (common_output != NULL)
+ finish_output(fp, common_output);
+ exit(exit_code);
+}
diff --git a/usr.bin/makewhatis/makewhatis.local.8 b/usr.bin/makewhatis/makewhatis.local.8
new file mode 100644
index 0000000..dfe252f
--- /dev/null
+++ b/usr.bin/makewhatis/makewhatis.local.8
@@ -0,0 +1,83 @@
+.\" Copyright (c) April 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+.\" 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 April 26, 1996
+.Dt MAKEWHATIS.LOCAL 8
+.Os
+.Sh NAME
+.Nm makewhatis.local , catman.local
+.Nd start makewhatis or catman for local file systems
+.Sh SYNOPSIS
+.Nm /usr/libexec/makewhatis.local
+.Op options
+.Ar directories ...
+.Nm /usr/libexec/catman.local
+.Op options
+.Ar directories ...
+.Sh DESCRIPTION
+The
+.Nm
+utility starts
+.Xr makewhatis 1
+only for file systems physically mounted on the system
+where the
+.Nm
+is being executed.
+Running makewhatis
+by
+.Pa periodic weekly
+for rw nfs-mounted /usr may kill
+your NFS server -- all NFS clients start makewhatis at the same time!
+So use this wrapper for
+.Xr cron 8
+instead of calling makewhatis directly.
+The
+.Nm catman.local
+utility is using for same purposes as
+.Nm
+but for
+.Xr catman 1 .
+.Sh FILES
+.Bl -tag -width /etc/periodic/weekly/320.whatis.XXX -compact
+.It Pa /etc/periodic/weekly/320.whatis
+run
+.Nm
+every week
+.It Pa /etc/periodic/weekly/330.catman
+run
+.Nm catman.local
+every week
+.El
+.Sh SEE ALSO
+.Xr catman 1 ,
+.Xr find 1 ,
+.Xr makewhatis 1 ,
+.Xr cron 8 ,
+.Xr periodic 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 2.2 .
diff --git a/usr.bin/makewhatis/makewhatis.local.sh b/usr.bin/makewhatis/makewhatis.local.sh
new file mode 100644
index 0000000..8be2530
--- /dev/null
+++ b/usr.bin/makewhatis/makewhatis.local.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# Copyright (c) April 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# 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.
+#
+# makewhatis.local - start makewhatis(1) only for file systems
+# physically mounted on the system
+#
+# Running makewhatis from /etc/periodic/weekly/320.whatis for rw nfs-mounted
+# /usr may kill your NFS server -- all clients start makewhatis at the same
+# time! So use this wrapper instead calling makewhatis directly.
+#
+# PS: this wrapper works also for catman(1)
+#
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:$PATH; export PATH
+opt= dirs= localdirs=
+
+for arg
+do
+ case "$arg" in
+ -*) opt="$opt $arg";;
+ *) dirs="$dirs $arg";;
+ esac
+done
+
+dirs=`echo $dirs | sed 's/:/ /g'`
+case X"$dirs" in X) echo "usage: $0 [options] directories ..."; exit 1;; esac
+
+localdirs=`find -H $dirs -fstype local -type d -prune -print`
+
+case X"$localdirs" in
+ X) echo "$0: no local-mounted manual directories found: $dirs"
+ exit 1;;
+ *) exec `basename $0 .local` $opt $localdirs;;
+esac
diff --git a/usr.bin/man/Makefile b/usr.bin/man/Makefile
new file mode 100644
index 0000000..7057b2e
--- /dev/null
+++ b/usr.bin/man/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+SCRIPTS= man.sh
+LINKS= ${BINDIR}/man ${BINDIR}/manpath
+
+MAN= man.1 manpath.1 man.conf.5
+
+.if ${MK_MANDOCDB} == no
+LINKS+= ${BINDIR}/man ${BINDIR}/apropos \
+ ${BINDIR}/man ${BINDIR}/whatis
+MAN+= apropos.1
+MLINKS= apropos.1 whatis.1
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/man/Makefile.depend b/usr.bin/man/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/man/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/man/apropos.1 b/usr.bin/man/apropos.1
new file mode 100644
index 0000000..4b79ada
--- /dev/null
+++ b/usr.bin/man/apropos.1
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2010 Gordon Tetlow
+.\" 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 September 1, 2010
+.Dt APROPOS 1
+.Os
+.Sh NAME
+.Nm apropos ,
+.Nm whatis
+.Nd keyword search whatis documentation databases
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Ar keyword ...
+.Nm whatis
+.Op Fl d
+.Ar keyword ...
+.Sh DESCRIPTION
+The
+.Nm
+utility searches a set of databases looking for documentation matching each
+.Ar keyword
+and displays the results.
+The
+.Nm whatis
+utility does the same search but only on complete words.
+.Bl -tag -width ".Fl d"
+.It Fl d
+Print extra debugging information.
+.El
+.Pp
+The
+.Ar keyword
+is simply passed to
+.Xr grep 1
+allowing for extended regular expression matches.
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev PAGER"
+.It Ev MANLOCALES , MANPATH , PATH
+Used to find the location of the
+.Nm whatis
+database files. See
+.Xr manpath 1
+for additional information.
+.It Ev PAGER
+Program used to display files.
+If unset,
+.Ic "more -s"
+is used.
+.El
+.Sh DIAGNOSTICS
+The
+.Nm
+utility exits 0 if a keyword matched and 1 if no keywords are matched or no
+.Nm whatis
+databases are found.
+.Sh SEE ALSO
+.Xr grep 1 ,
+.Xr makewhatis 1 ,
+.Xr man 1 ,
+.Xr manpath 1 ,
+.Xr man.conf 5
diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1
new file mode 100644
index 0000000..5647b6c
--- /dev/null
+++ b/usr.bin/man/man.1
@@ -0,0 +1,365 @@
+.\"-
+.\" Copyright (c) 2010 Gordon Tetlow
+.\" 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 September 26, 2014
+.Dt MAN 1
+.Os
+.Sh NAME
+.Nm man
+.Nd display online manual documentation pages
+.Sh SYNOPSIS
+.Nm
+.Op Fl adho
+.Op Fl t | w
+.Op Fl M Ar manpath
+.Op Fl P Ar pager
+.Op Fl S Ar mansect
+.Op Fl m Ar arch Ns Op : Ns Ar machine
+.Op Fl p Op Ar eprtv
+.Op Ar mansect
+.Ar page ...
+.Nm
+.Fl f
+.Ar keyword ...
+.Nm
+.Fl k
+.Ar keyword ...
+.Sh DESCRIPTION
+The
+.Nm
+utility finds and displays online manual documentation pages.
+If
+.Ar mansect
+is provided,
+.Nm
+restricts the search to the specific section of the manual.
+.Pp
+The sections of the manual are:
+.Bl -enum -offset indent -compact
+.It
+.Fx
+General Commands Manual
+.It
+.Fx
+System Calls Manual
+.It
+.Fx
+Library Functions Manual
+.It
+.Fx
+Kernel Interfaces Manual
+.It
+.Fx
+File Formats Manual
+.It
+.Fx
+Games Manual
+.It
+.Fx
+Miscellaneous Information Manual
+.It
+.Fx
+System Manager's Manual
+.It
+.Fx
+Kernel Developer's Manual
+.El
+.Pp
+Options that
+.Nm
+understands:
+.Bl -tag -width indent
+.It Fl M Ar manpath
+Forces a specific colon separated manual path instead of the default
+search path.
+See
+.Xr manpath 1 .
+Overrides the
+.Ev MANPATH
+environment variable.
+.It Fl P Ar pager
+Use specified pager.
+Defaults to
+.Dq Li "less -sR"
+if color support is enabled, or
+.Dq Li "more -s" .
+Overrides the
+.Ev MANPAGER
+environment variable, which in turn overrides the
+.Ev PAGER
+environment variable.
+.It Fl S Ar mansect
+Restricts manual sections searched to the specified colon delimited list.
+Defaults to
+.Dq Li 1:8:2:3:n:4:5:6:7:9:l .
+Overrides the
+.Ev MANSECT
+environment variable.
+.It Fl a
+Display all manual pages instead of just the first found for each
+.Ar page
+argument.
+.It Fl d
+Print extra debugging information.
+Repeat for increased verbosity.
+Does not display the manual page.
+.It Fl f
+Emulate
+.Xr whatis 1 .
+.It Fl h
+Display short help message and exit.
+.It Fl k
+Emulate
+.Xr apropos 1 .
+.It Fl m Ar arch Ns Op : Ns Ar machine
+Override the default architecture and machine settings allowing lookup of
+other platform specific manual pages.
+See
+.Sx IMPLEMENTATION NOTES
+for how this option changes the default behavior.
+Overrides the
+.Ev MACHINE_ARCH
+and
+.Ev MACHINE
+environment variables.
+.It Fl o
+Force use of non-localized manual pages.
+See
+.Sx IMPLEMENTATION NOTES
+for how locale specific searches work.
+Overrides the
+.Ev LC_ALL , LC_CTYPE ,
+and
+.Ev LANG
+environment variables.
+.It Fl p Op Cm eprtv
+Use the list of given preprocessors before running
+.Xr nroff 1
+or
+.Xr troff 1 .
+Valid preprocessors arguments:
+.Pp
+.Bl -tag -width indent -compact
+.It Cm e
+.Xr eqn 1
+.It Cm p
+.Xr pic 1
+.It Cm r
+.Xr refer 1
+.It Cm t
+.Xr tbl 1
+.It Cm v
+.Xr vgrind 1
+.El
+.Pp
+Overrides the
+.Ev MANROFFSEQ
+environment variable.
+.It Fl t
+Send manual page source through
+.Xr troff 1
+allowing transformation of the manual pages to other formats.
+.It Fl w
+Display the location of the manual page instead of the contents of
+the manual page.
+.El
+.Sh IMPLEMENTATION NOTES
+.Ss Locale Specific Searches
+The
+.Nm
+utility supports manual pages in different locales.
+The search behavior is dictated by the first of three
+environment variables with a nonempty string:
+.Ev LC_ALL , LC_CTYPE ,
+or
+.Ev LANG .
+If set,
+.Nm
+will search for locale specific manual pages using the following logic:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Va lang Ns _ Ns Va country Ns . Ns Va charset
+.It
+.Va lang Ns . Ns Va charset
+.It
+.Li en Ns . Ns Va charset
+.El
+.Pp
+For example, if
+.Ev LC_ALL
+is set to
+.Dq Li ja_JP.eucJP ,
+.Nm
+will search the following paths when considering section 1 manual pages in
+.Pa /usr/share/man :
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Pa /usr/share/man/ja_JP.eucJP/man1
+.It
+.Pa /usr/share/man/ja.eucJP/man1
+.It
+.Pa /usr/share/man/en.eucJP/man1
+.It
+.Pa /usr/share/man/man1
+.El
+.Ss Platform Specific Searches
+The
+.Nm
+utility supports platform specific manual pages.
+The search behavior is dictated by the
+.Fl m
+option or the
+.Ev MACHINE_ARCH
+and
+.Ev MACHINE
+environment variables.
+For example, if
+.Ev MACHINE_ARCH
+is set to
+.Dq Li i386
+and
+.Ev MACHINE
+is set to
+.Dq Li pc98 ,
+.Nm
+will search the following paths when considering section 4 manual pages in
+.Pa /usr/share/man :
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Pa /usr/share/man/man4/pc98
+.It
+.Pa /usr/share/man/man4/i386
+.It
+.Pa /usr/share/man/man4
+.El
+.Ss Displaying Specific Manual Files
+The
+.Nm
+utility also supports displaying a specific manual page if passed a path
+to the file as long as it contains a
+.Ql /
+character.
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev MANROFFSEQ"
+.It Ev LC_ALL , LC_CTYPE , LANG
+Used to find locale specific manual pages.
+Valid values can be found by running the
+.Xr locale 1
+command.
+See
+.Sx IMPLEMENTATION NOTES
+for details.
+Influenced by the
+.Fl o
+option.
+.It Ev MACHINE_ARCH , MACHINE
+Used to find platform specific manual pages.
+If unset, the output of
+.Dq Li "sysctl hw.machine_arch"
+and
+.Dq Li "sysctl hw.machine"
+is used respectively.
+See
+.Sx IMPLEMENTATION NOTES
+for details.
+Corresponds to the
+.Fl m
+option.
+.It Ev MANPATH
+Used to find the location of the manual files.
+See
+.Xr manpath 1
+for additional information.
+Corresponds to the
+.Fl M
+option.
+.It Ev MANROFFSEQ
+Used to determine the preprocessors for the manual source before running
+.Xr nroff 1
+or
+.Xr troff 1 .
+If unset, defaults to
+.Xr tbl 1 .
+Corresponds to the
+.Fl p
+option.
+.It Ev MANSECT
+Restricts manual sections searched to the specified colon delimited list.
+Corresponds to the
+.Fl S
+option.
+.It Ev MANWIDTH
+If set to a numeric value, used as the width manpages should be displayed.
+Otherwise, if set to a special value
+.Dq Li tty ,
+and output is to a terminal,
+the pages may be displayed over the whole width of the screen.
+.It Ev MANCOLOR
+If set, enables color support.
+.It Ev MANPAGER
+Program used to display files.
+.Pp
+If unset, and color support is enabled,
+.Dq Li "less -sR"
+is used.
+.Pp
+If unset, and color support is disabled, then
+.Ev PAGER
+is used.
+If that has no value either,
+.Dq Li "more -s"
+is used.
+.El
+.Sh FILES
+.Bl -tag -width indent -compact
+.It Pa /etc/man.conf
+System configuration file.
+.It Pa /usr/local/etc/man.d/*.conf
+Local configuration files.
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr intro 1 ,
+.Xr locale 1 ,
+.Xr manpath 1 ,
+.Xr nroff 1 ,
+.Xr troff 1 ,
+.Xr whatis 1 ,
+.Xr intro 2 ,
+.Xr intro 3 ,
+.Xr intro 4 ,
+.Xr intro 5 ,
+.Xr man.conf 5 ,
+.Xr intro 6 ,
+.Xr intro 7 ,
+.Xr intro 8 ,
+.Xr intro 9
diff --git a/usr.bin/man/man.conf.5 b/usr.bin/man/man.conf.5
new file mode 100644
index 0000000..f30a1c0
--- /dev/null
+++ b/usr.bin/man/man.conf.5
@@ -0,0 +1,142 @@
+.\"-
+.\" Copyright (c) 2010 Gordon Tetlow
+.\" 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 3, 2011
+.Dt MAN.CONF 5
+.Os
+.Sh NAME
+.Nm man.conf
+.Nd
+.Xr man 1
+and
+.Xr manpath 1
+configuration files
+.Sh DESCRIPTION
+The
+.Nm
+file is used to configure the manual search path, locales, and utility set for
+.Xr man 1
+and its related utilities.
+During initialization,
+.Xr man 1
+reads the configuration files located at
+.Pa /usr/local/etc/man.d/*.conf
+and
+.Pa /etc/man.conf .
+.Pp
+The files contained in
+.Pa /usr/local/etc/man.d/*.conf
+are intended to be used by the
+.Xr ports 7
+system for extending the manual set to support additional paths and locales.
+.Pa /etc/man.conf
+is intended to be used by the local administrator to set additional policy.
+.Pp
+Currently supported configuration variables include:
+.Bl -tag -width 12n -offset indent
+.It MANCONFIG
+Overrides the default location to import additional manual configuration files.
+Defaults to
+.Pa /usr/local/etc/man.d/*.conf .
+.It MANPATH
+Adds the specified directory to the manual search path.
+.It MANLOCALE
+Indicates support is available for the given locale.
+.El
+.Pp
+For pages in a given language, overriding the default toolset for
+display is supported via the following definitions:
+.Pp
+.Bl -tag -width 12n -offset indent -compact
+.It EQN Ns _ Ns Va LANG
+.It NROFF Ns _ Ns Va LANG
+.It PIC Ns _ Ns Va LANG
+.It TBL Ns _ Ns Va LANG
+.It TROFF Ns _ Ns Va LANG
+.It REFER Ns _ Ns Va LANG
+.It VGRIND Ns _ Ns Va LANG
+.El
+.Pp
+See the
+.Sx EXAMPLES
+section for how to use these variables.
+.Sh IMPLEMENTATION NOTES
+The parser used for this utility is very basic and only supports comment
+characters (#) at the beginning of a line.
+.Sh FILES
+.Bl -tag -width "Pa /usr/local/etc/man.d/*.conf" -compact
+.It Pa /etc/man.conf
+System configuration file.
+.It Pa /usr/local/etc/man.d/*.conf
+Local configuration files.
+.El
+.Sh EXAMPLES
+A perl port that needs to install additional manual pages outside of the
+default location could install a file in
+.Pa /usr/local/etc/man.d/perl.conf
+with the following contents:
+.Bd -literal -offset indent
+# Add perl man pages to search path
+MANPATH /usr/local/lib/perl5/5.8.9/man
+MANPATH /usr/local/lib/perl5/5.8.9/perl/man
+.Ed
+.Pp
+A Japanese localization port could install a custom toolset and include a
+file in
+.Pa /usr/local/etc/man.d/ja-man-doc.conf
+with the following contents:
+.Bd -literal -offset indent
+# Setup Japanese toolset
+MANLOCALE ja_JP.eucJP
+EQN_JA /usr/local/bin/geqn
+PIC_JA /usr/local/bin/gpic
+TBL_JA /usr/local/bin/gtbl
+NROFF_JA /usr/local/bin/groff -man -dlang=ja_JP.eucJP
+TROFF_JA /usr/local/bin/groff -man -dlang=ja_JP.euc.jp
+.Ed
+.Pp
+If the system administrator decides to override the
+.Va LOCALBASE
+.Xr make 1
+variable causing all
+.Xr ports 7
+to be installed into
+.Pa /opt
+instead of
+.Pa /usr/local ,
+specifying the following in
+.Pa /etc/man.conf
+will accommodate this change:
+.Bd -literal -offset indent
+# Look for additional configuration files
+MANCONFIG /opt/etc/man.d/*.conf
+.Ed
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr man 1 ,
+.Xr manpath 1 ,
+.Xr whatis 1
diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
new file mode 100755
index 0000000..094ea11
--- /dev/null
+++ b/usr.bin/man/man.sh
@@ -0,0 +1,1005 @@
+#! /bin/sh
+#
+# Copyright (c) 2010 Gordon Tetlow
+# 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$
+
+# Usage: add_to_manpath path
+# Adds a variable to manpath while ensuring we don't have duplicates.
+# Returns true if we were able to add something. False otherwise.
+add_to_manpath() {
+ case "$manpath" in
+ *:$1) decho " Skipping duplicate manpath entry $1" 2 ;;
+ $1:*) decho " Skipping duplicate manpath entry $1" 2 ;;
+ *:$1:*) decho " Skipping duplicate manpath entry $1" 2 ;;
+ *) if [ -d "$1" ]; then
+ decho " Adding $1 to manpath"
+ manpath="$manpath:$1"
+ return 0
+ fi
+ ;;
+ esac
+
+ return 1
+}
+
+# Usage: build_manlocales
+# Builds a correct MANLOCALES variable.
+build_manlocales() {
+ # If the user has set manlocales, who are we to argue.
+ if [ -n "$MANLOCALES" ]; then
+ return
+ fi
+
+ parse_configs
+
+ # Trim leading colon
+ MANLOCALES=${manlocales#:}
+
+ decho "Available manual locales: $MANLOCALES"
+}
+
+# Usage: build_manpath
+# Builds a correct MANPATH variable.
+build_manpath() {
+ local IFS
+
+ # If the user has set a manpath, who are we to argue.
+ if [ -n "$MANPATH" ]; then
+ return
+ fi
+
+ search_path
+
+ decho "Adding default manpath entries"
+ IFS=:
+ for path in $man_default_path; do
+ add_to_manpath "$path"
+ done
+ unset IFS
+
+ parse_configs
+
+ # Trim leading colon
+ MANPATH=${manpath#:}
+
+ decho "Using manual path: $MANPATH"
+}
+
+# Usage: check_cat catglob
+# Checks to see if a cat glob is available.
+check_cat() {
+ if exists "$1"; then
+ use_cat=yes
+ catpage=$found
+ setup_cattool $catpage
+ decho " Found catpage $catpage"
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Usage: check_man manglob catglob
+# Given 2 globs, figures out if the manglob is available, if so, check to
+# see if the catglob is also available and up to date.
+check_man() {
+ if exists "$1"; then
+ # We have a match, check for a cat page
+ manpage=$found
+ setup_cattool $manpage
+ decho " Found manpage $manpage"
+
+ if [ -n "${use_width}" ]; then
+ # non-standard width
+ unset use_cat
+ decho " Skipping catpage: non-standard page width"
+ elif exists "$2" && is_newer $found $manpage; then
+ # cat page found and is newer, use that
+ use_cat=yes
+ catpage=$found
+ setup_cattool $catpage
+ decho " Using catpage $catpage"
+ else
+ # no cat page or is older
+ unset use_cat
+ decho " Skipping catpage: not found or old"
+ fi
+ return 0
+ fi
+
+ return 1
+}
+
+# Usage: decho "string" [debuglevel]
+# Echoes to stderr string prefaced with -- if high enough debuglevel.
+decho() {
+ if [ $debug -ge ${2:-1} ]; then
+ echo "-- $1" >&2
+ fi
+}
+
+# Usage: exists glob
+# Returns true if glob resolves to a real file.
+exists() {
+ local IFS
+
+ # Don't accidentally inherit callers IFS (breaks perl manpages)
+ unset IFS
+
+ # Use some globbing tricks in the shell to determine if a file
+ # exists or not.
+ set +f
+ set -- "$1" $1
+ set -f
+
+ if [ "$1" != "$2" -a -r "$2" ]; then
+ found="$2"
+ return 0
+ fi
+
+ return 1
+}
+
+# Usage: find_file path section subdir pagename
+# Returns: true if something is matched and found.
+# Search the given path/section combo for a given page.
+find_file() {
+ local manroot catroot mann man0 catn cat0
+
+ manroot="$1/man$2"
+ catroot="$1/cat$2"
+ if [ -n "$3" ]; then
+ manroot="$manroot/$3"
+ catroot="$catroot/$3"
+ fi
+
+ if [ ! -d "$manroot" ]; then
+ return 1
+ fi
+ decho " Searching directory $manroot" 2
+
+ mann="$manroot/$4.$2*"
+ man0="$manroot/$4.0*"
+ catn="$catroot/$4.$2*"
+ cat0="$catroot/$4.0*"
+
+ # This is the behavior as seen by the original man utility.
+ # Let's not change that which doesn't seem broken.
+ if check_man "$mann" "$catn"; then
+ return 0
+ elif check_man "$man0" "$cat0"; then
+ return 0
+ elif check_cat "$catn"; then
+ return 0
+ elif check_cat "$cat0"; then
+ return 0
+ fi
+
+ return 1
+}
+
+# Usage: is_newer file1 file2
+# Returns true if file1 is newer than file2 as calculated by mtime.
+is_newer() {
+ if ! [ "$1" -ot "$2" ]; then
+ decho " mtime: $1 not older than $2" 3
+ return 0
+ else
+ decho " mtime: $1 older than $2" 3
+ return 1
+ fi
+}
+
+# Usage: manpath_parse_args "$@"
+# Parses commandline options for manpath.
+manpath_parse_args() {
+ local cmd_arg
+
+ while getopts 'Ldq' cmd_arg; do
+ case "${cmd_arg}" in
+ L) Lflag=Lflag ;;
+ d) debug=$(( $debug + 1 )) ;;
+ q) qflag=qflag ;;
+ *) manpath_usage ;;
+ esac
+ done >&2
+}
+
+# Usage: manpath_usage
+# Display usage for the manpath(1) utility.
+manpath_usage() {
+ echo 'usage: manpath [-Ldq]' >&2
+ exit 1
+}
+
+# Usage: manpath_warnings
+# Display some warnings to stderr.
+manpath_warnings() {
+ if [ -z "$Lflag" -a -n "$MANPATH" ]; then
+ echo "(Warning: MANPATH environment variable set)" >&2
+ fi
+
+ if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
+ echo "(Warning: MANLOCALES environment variable set)" >&2
+ fi
+}
+
+# Usage: man_check_for_so page path
+# Returns: True if able to resolve the file, false if it ended in tears.
+# Detects the presence of the .so directive and causes the file to be
+# redirected to another source file.
+man_check_for_so() {
+ local IFS line tstr
+
+ unset IFS
+
+ # We need to loop to accommodate multiple .so directives.
+ while true
+ do
+ line=$($cattool $manpage | head -1)
+ case "$line" in
+ .so*) trim "${line#.so}"
+ decho "$manpage includes $tstr"
+ # Glob and check for the file.
+ if ! check_man "$path/$tstr*" ""; then
+ decho " Unable to find $tstr"
+ return 1
+ fi
+ ;;
+ *) break ;;
+ esac
+ done
+
+ return 0
+}
+
+# Usage: man_display_page
+# Display either the manpage or catpage depending on the use_cat variable
+man_display_page() {
+ local IFS pipeline testline
+
+ # We are called with IFS set to colon. This causes really weird
+ # things to happen for the variables that have spaces in them.
+ unset IFS
+
+ # If we are supposed to use a catpage and we aren't using troff(1)
+ # just zcat the catpage and we are done.
+ if [ -z "$tflag" -a -n "$use_cat" ]; then
+ if [ -n "$wflag" ]; then
+ echo "$catpage (source: $manpage)"
+ ret=0
+ else
+ if [ $debug -gt 0 ]; then
+ decho "Command: $cattool $catpage | $MANPAGER"
+ ret=0
+ else
+ eval "$cattool $catpage | $MANPAGER"
+ ret=$?
+ fi
+ fi
+ return
+ fi
+
+ # Okay, we are using the manpage, do we just need to output the
+ # name of the manpage?
+ if [ -n "$wflag" ]; then
+ echo "$manpage"
+ ret=0
+ return
+ fi
+
+ if [ -n "$use_width" ]; then
+ mandoc_args="-O width=${use_width}"
+ fi
+ testline="mandoc -Tlint -Wunsupp 2>/dev/null"
+ if [ -n "$tflag" ]; then
+ pipeline="mandoc -Tps $mandoc_args"
+ else
+ pipeline="mandoc $mandoc_args | $MANPAGER"
+ fi
+
+ if ! eval "$cattool $manpage | $testline" ;then
+ if which -s groff; then
+ man_display_page_groff
+ else
+ echo "This manpage needs groff(1) to be rendered" >&2
+ echo "First install groff(1): " >&2
+ echo "pkg install groff " >&2
+ ret=1
+ fi
+ return
+ fi
+
+ if [ $debug -gt 0 ]; then
+ decho "Command: $cattool $manpage | $pipeline"
+ ret=0
+ else
+ eval "$cattool $manpage | $pipeline"
+ ret=$?
+ fi
+}
+
+# Usage: man_display_page_groff
+# Display the manpage using groff
+man_display_page_groff() {
+ local EQN NROFF PIC TBL TROFF REFER VGRIND
+ local IFS l nroff_dev pipeline preproc_arg tool
+
+ # So, we really do need to parse the manpage. First, figure out the
+ # device flag (-T) we have to pass to eqn(1) and groff(1). Then,
+ # setup the pipeline of commands based on the user's request.
+
+ # If the manpage is from a particular charset, we need to setup nroff
+ # to properly output for the correct device.
+ case "${manpage}" in
+ *.${man_charset}/*)
+ # I don't pretend to know this; I'm just copying from the
+ # previous version of man(1).
+ case "$man_charset" in
+ KOI8-R) nroff_dev="koi8-r" ;;
+ ISO8859-1) nroff_dev="latin1" ;;
+ ISO8859-15) nroff_dev="latin1" ;;
+ UTF-8) nroff_dev="utf8" ;;
+ *) nroff_dev="ascii" ;;
+ esac
+
+ NROFF="$NROFF -T$nroff_dev"
+ EQN="$EQN -T$nroff_dev"
+
+ # Iff the manpage is from the locale and not just the charset,
+ # then we need to define the locale string.
+ case "${manpage}" in
+ */${man_lang}_${man_country}.${man_charset}/*)
+ NROFF="$NROFF -dlocale=$man_lang.$man_charset"
+ ;;
+ */${man_lang}.${man_charset}/*)
+ NROFF="$NROFF -dlocale=$man_lang.$man_charset"
+ ;;
+ esac
+
+ # Allow language specific calls to override the default
+ # set of utilities.
+ l=$(echo $man_lang | tr [:lower:] [:upper:])
+ for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do
+ eval "$tool=\${${tool}_$l:-\$$tool}"
+ done
+ ;;
+ *) NROFF="$NROFF -Tascii"
+ EQN="$EQN -Tascii"
+ ;;
+ esac
+
+ if [ -z "$MANCOLOR" ]; then
+ NROFF="$NROFF -P-c"
+ fi
+
+ if [ -n "${use_width}" ]; then
+ NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n"
+ fi
+
+ if [ -n "$MANROFFSEQ" ]; then
+ set -- -$MANROFFSEQ
+ while getopts 'egprtv' preproc_arg; do
+ case "${preproc_arg}" in
+ e) pipeline="$pipeline | $EQN" ;;
+ g) ;; # Ignore for compatibility.
+ p) pipeline="$pipeline | $PIC" ;;
+ r) pipeline="$pipeline | $REFER" ;;
+ t) pipeline="$pipeline | $TBL" ;;
+ v) pipeline="$pipeline | $VGRIND" ;;
+ *) usage ;;
+ esac
+ done
+ # Strip the leading " | " from the resulting pipeline.
+ pipeline="${pipeline#" | "}"
+ else
+ pipeline="$TBL"
+ fi
+
+ if [ -n "$tflag" ]; then
+ pipeline="$pipeline | $TROFF"
+ else
+ pipeline="$pipeline | $NROFF | $MANPAGER"
+ fi
+
+ if [ $debug -gt 0 ]; then
+ decho "Command: $cattool $manpage | $pipeline"
+ ret=0
+ else
+ eval "$cattool $manpage | $pipeline"
+ ret=$?
+ fi
+}
+
+# Usage: man_find_and_display page
+# Search through the manpaths looking for the given page.
+man_find_and_display() {
+ local found_page locpath p path sect
+
+ # Check to see if it's a file. But only if it has a '/' in
+ # the filename.
+ case "$1" in
+ */*) if [ -f "$1" -a -r "$1" ]; then
+ decho "Found a usable page, displaying that"
+ unset use_cat
+ manpage="$1"
+ setup_cattool $manpage
+ if man_check_for_so $manpage $(dirname $manpage); then
+ found_page=yes
+ man_display_page
+ fi
+ return
+ fi
+ ;;
+ esac
+
+ IFS=:
+ for sect in $MANSECT; do
+ decho "Searching section $sect" 2
+ for path in $MANPATH; do
+ for locpath in $locpaths; do
+ p=$path/$locpath
+ p=${p%/.} # Rid ourselves of the trailing /.
+
+ # Check if there is a MACHINE specific manpath.
+ if find_file $p $sect $MACHINE "$1"; then
+ if man_check_for_so $manpage $p; then
+ found_page=yes
+ man_display_page
+ if [ -n "$aflag" ]; then
+ continue 2
+ else
+ return
+ fi
+ fi
+ fi
+
+ # Check if there is a MACHINE_ARCH
+ # specific manpath.
+ if find_file $p $sect $MACHINE_ARCH "$1"; then
+ if man_check_for_so $manpage $p; then
+ found_page=yes
+ man_display_page
+ if [ -n "$aflag" ]; then
+ continue 2
+ else
+ return
+ fi
+ fi
+ fi
+
+ # Check plain old manpath.
+ if find_file $p $sect '' "$1"; then
+ if man_check_for_so $manpage $p; then
+ found_page=yes
+ man_display_page
+ if [ -n "$aflag" ]; then
+ continue 2
+ else
+ return
+ fi
+ fi
+ fi
+ done
+ done
+ done
+ unset IFS
+
+ # Nothing? Well, we are done then.
+ if [ -z "$found_page" ]; then
+ echo "No manual entry for $1" >&2
+ ret=1
+ return
+ fi
+}
+
+# Usage: man_parse_args "$@"
+# Parses commandline options for man.
+man_parse_args() {
+ local IFS cmd_arg
+
+ while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do
+ case "${cmd_arg}" in
+ M) MANPATH=$OPTARG ;;
+ P) MANPAGER=$OPTARG ;;
+ S) MANSECT=$OPTARG ;;
+ a) aflag=aflag ;;
+ d) debug=$(( $debug + 1 )) ;;
+ f) fflag=fflag ;;
+ h) man_usage 0 ;;
+ k) kflag=kflag ;;
+ m) mflag=$OPTARG ;;
+ o) oflag=oflag ;;
+ p) MANROFFSEQ=$OPTARG ;;
+ t) tflag=tflag ;;
+ w) wflag=wflag ;;
+ *) man_usage ;;
+ esac
+ done >&2
+
+ shift $(( $OPTIND - 1 ))
+
+ # Check the args for incompatible options.
+ case "${fflag}${kflag}${tflag}${wflag}" in
+ fflagkflag*) echo "Incompatible options: -f and -k"; man_usage ;;
+ fflag*tflag*) echo "Incompatible options: -f and -t"; man_usage ;;
+ fflag*wflag) echo "Incompatible options: -f and -w"; man_usage ;;
+ *kflagtflag*) echo "Incompatible options: -k and -t"; man_usage ;;
+ *kflag*wflag) echo "Incompatible options: -k and -w"; man_usage ;;
+ *tflagwflag) echo "Incompatible options: -t and -w"; man_usage ;;
+ esac
+
+ # Short circuit for whatis(1) and apropos(1)
+ if [ -n "$fflag" ]; then
+ do_whatis "$@"
+ exit
+ fi
+
+ if [ -n "$kflag" ]; then
+ do_apropos "$@"
+ exit
+ fi
+
+ IFS=:
+ for sect in $man_default_sections; do
+ if [ "$sect" = "$1" ]; then
+ decho "Detected manual section as first arg: $1"
+ MANSECT="$1"
+ shift
+ break
+ fi
+ done
+ unset IFS
+
+ pages="$*"
+}
+
+# Usage: man_setup
+# Setup various trivial but essential variables.
+man_setup() {
+ # Setup machine and architecture variables.
+ if [ -n "$mflag" ]; then
+ MACHINE_ARCH=${mflag%%:*}
+ MACHINE=${mflag##*:}
+ fi
+ if [ -z "$MACHINE_ARCH" ]; then
+ MACHINE_ARCH=$($SYSCTL -n hw.machine_arch)
+ fi
+ if [ -z "$MACHINE" ]; then
+ MACHINE=$($SYSCTL -n hw.machine)
+ fi
+ decho "Using architecture: $MACHINE_ARCH:$MACHINE"
+
+ setup_pager
+
+ # Setup manual sections to search.
+ if [ -z "$MANSECT" ]; then
+ MANSECT=$man_default_sections
+ fi
+ decho "Using manual sections: $MANSECT"
+
+ build_manpath
+ man_setup_locale
+ man_setup_width
+}
+
+# Usage: man_setup_width
+# Set up page width.
+man_setup_width() {
+ local sizes
+
+ unset use_width
+ case "$MANWIDTH" in
+ [0-9]*)
+ if [ "$MANWIDTH" -gt 0 2>/dev/null ]; then
+ use_width=$MANWIDTH
+ fi
+ ;;
+ [Tt][Tt][Yy])
+ if { sizes=$($STTY size 0>&3 2>/dev/null); } 3>&1; then
+ set -- $sizes
+ if [ $2 -gt 80 ]; then
+ use_width=$(($2-2))
+ fi
+ fi
+ ;;
+ esac
+ if [ -n "$use_width" ]; then
+ decho "Using non-standard page width: ${use_width}"
+ else
+ decho 'Using standard page width'
+ fi
+}
+
+# Usage: man_setup_locale
+# Setup necessary locale variables.
+man_setup_locale() {
+ local lang_cc
+
+ locpaths='.'
+ man_charset='US-ASCII'
+
+ # Setup locale information.
+ if [ -n "$oflag" ]; then
+ decho 'Using non-localized manpages'
+ else
+ # Use the locale tool to give us the proper LC_CTYPE
+ eval $( $LOCALE )
+
+ case "$LC_CTYPE" in
+ C) ;;
+ POSIX) ;;
+ [a-z][a-z]_[A-Z][A-Z]\.*)
+ lang_cc="${LC_CTYPE%.*}"
+ man_lang="${LC_CTYPE%_*}"
+ man_country="${lang_cc#*_}"
+ man_charset="${LC_CTYPE#*.}"
+ locpaths="$LC_CTYPE"
+ locpaths="$locpaths:$man_lang.$man_charset"
+ if [ "$man_lang" != "en" ]; then
+ locpaths="$locpaths:en.$man_charset"
+ fi
+ locpaths="$locpaths:."
+ ;;
+ *) echo 'Unknown locale, assuming C' >&2
+ ;;
+ esac
+ fi
+
+ decho "Using locale paths: $locpaths"
+}
+
+# Usage: man_usage [exitcode]
+# Display usage for the man utility.
+man_usage() {
+ echo 'Usage:'
+ echo ' man [-adho] [-t | -w] [-M manpath] [-P pager] [-S mansect]'
+ echo ' [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]'
+ echo ' man -f page [...] -- Emulates whatis(1)'
+ echo ' man -k page [...] -- Emulates apropos(1)'
+
+ # When exit'ing with -h, it's not an error.
+ exit ${1:-1}
+}
+
+# Usage: parse_configs
+# Reads the end-user adjustable config files.
+parse_configs() {
+ local IFS file files
+
+ if [ -n "$parsed_configs" ]; then
+ return
+ fi
+
+ unset IFS
+
+ # Read the global config first in case the user wants
+ # to override config_local.
+ if [ -r "$config_global" ]; then
+ parse_file "$config_global"
+ fi
+
+ # Glob the list of files to parse.
+ set +f
+ files=$(echo $config_local)
+ set -f
+
+ for file in $files; do
+ if [ -r "$file" ]; then
+ parse_file "$file"
+ fi
+ done
+
+ parsed_configs='yes'
+}
+
+# Usage: parse_file file
+# Reads the specified config files.
+parse_file() {
+ local file line tstr var
+
+ file="$1"
+ decho "Parsing config file: $file"
+ while read line; do
+ decho " $line" 2
+ case "$line" in
+ \#*) decho " Comment" 3
+ ;;
+ MANPATH*) decho " MANPATH" 3
+ trim "${line#MANPATH}"
+ add_to_manpath "$tstr"
+ ;;
+ MANLOCALE*) decho " MANLOCALE" 3
+ trim "${line#MANLOCALE}"
+ manlocales="$manlocales:$tstr"
+ ;;
+ MANCONFIG*) decho " MANCONFIG" 3
+ trim "${line#MANCONFIG}"
+ config_local="$tstr"
+ ;;
+ # Set variables in the form of FOO_BAR
+ *_*[\ \ ]*) var="${line%%[\ \ ]*}"
+ trim "${line#$var}"
+ eval "$var=\"$tstr\""
+ decho " Parsed $var" 3
+ ;;
+ esac
+ done < "$file"
+}
+
+# Usage: search_path
+# Traverse $PATH looking for manpaths.
+search_path() {
+ local IFS p path
+
+ decho "Searching PATH for man directories"
+
+ IFS=:
+ for path in $PATH; do
+ # Do a little special casing since the base manpages
+ # are in /usr/share/man instead of /usr/man or /man.
+ case "$path" in
+ /bin|/usr/bin) add_to_manpath "/usr/share/man" ;;
+ *) if add_to_manpath "$path/man"; then
+ :
+ elif add_to_manpath "$path/MAN"; then
+ :
+ else
+ case "$path" in
+ */bin) p="${path%/bin}/man"
+ add_to_manpath "$p"
+ ;;
+ *) ;;
+ esac
+ fi
+ ;;
+ esac
+ done
+ unset IFS
+
+ if [ -z "$manpath" ]; then
+ decho ' Unable to find any manpaths, using default'
+ manpath=$man_default_path
+ fi
+}
+
+# Usage: search_whatis cmd [arglist]
+# Do the heavy lifting for apropos/whatis
+search_whatis() {
+ local IFS bad cmd f good key keywords loc opt out path rval wlist
+
+ cmd="$1"
+ shift
+
+ whatis_parse_args "$@"
+
+ build_manpath
+ build_manlocales
+ setup_pager
+
+ if [ "$cmd" = "whatis" ]; then
+ opt="-w"
+ fi
+
+ f='whatis'
+
+ IFS=:
+ for path in $MANPATH; do
+ if [ \! -d "$path" ]; then
+ decho "Skipping non-existent path: $path" 2
+ continue
+ fi
+
+ if [ -f "$path/$f" -a -r "$path/$f" ]; then
+ decho "Found whatis: $path/$f"
+ wlist="$wlist $path/$f"
+ fi
+
+ for loc in $MANLOCALES; do
+ if [ -f "$path/$loc/$f" -a -r "$path/$loc/$f" ]; then
+ decho "Found whatis: $path/$loc/$f"
+ wlist="$wlist $path/$loc/$f"
+ fi
+ done
+ done
+ unset IFS
+
+ if [ -z "$wlist" ]; then
+ echo "$cmd: no whatis databases in $MANPATH" >&2
+ exit 1
+ fi
+
+ rval=0
+ for key in $keywords; do
+ out=$(grep -Ehi $opt -- "$key" $wlist)
+ if [ -n "$out" ]; then
+ good="$good\\n$out"
+ else
+ bad="$bad\\n$key: nothing appropriate"
+ rval=1
+ fi
+ done
+
+ # Strip leading carriage return.
+ good=${good#\\n}
+ bad=${bad#\\n}
+
+ if [ -n "$good" ]; then
+ echo -e "$good" | $MANPAGER
+ fi
+
+ if [ -n "$bad" ]; then
+ echo -e "$bad" >&2
+ fi
+
+ exit $rval
+}
+
+# Usage: setup_cattool page
+# Finds an appropriate decompressor based on extension
+setup_cattool() {
+ case "$1" in
+ *.bz) cattool='/usr/bin/bzcat' ;;
+ *.bz2) cattool='/usr/bin/bzcat' ;;
+ *.gz) cattool='/usr/bin/zcat' ;;
+ *.lzma) cattool='/usr/bin/lzcat' ;;
+ *.xz) cattool='/usr/bin/xzcat' ;;
+ *) cattool='/usr/bin/zcat -f' ;;
+ esac
+}
+
+# Usage: setup_pager
+# Correctly sets $MANPAGER
+setup_pager() {
+ # Setup pager.
+ if [ -z "$MANPAGER" ]; then
+ if [ -n "$MANCOLOR" ]; then
+ MANPAGER="less -sR"
+ else
+ if [ -n "$PAGER" ]; then
+ MANPAGER="$PAGER"
+ else
+ MANPAGER="more -s"
+ fi
+ fi
+ fi
+ decho "Using pager: $MANPAGER"
+}
+
+# Usage: trim string
+# Trims whitespace from beginning and end of a variable
+trim() {
+ tstr=$1
+ while true; do
+ case "$tstr" in
+ [\ \ ]*) tstr="${tstr##[\ \ ]}" ;;
+ *[\ \ ]) tstr="${tstr%%[\ \ ]}" ;;
+ *) break ;;
+ esac
+ done
+}
+
+# Usage: whatis_parse_args "$@"
+# Parse commandline args for whatis and apropos.
+whatis_parse_args() {
+ local cmd_arg
+ while getopts 'd' cmd_arg; do
+ case "${cmd_arg}" in
+ d) debug=$(( $debug + 1 )) ;;
+ *) whatis_usage ;;
+ esac
+ done >&2
+
+ shift $(( $OPTIND - 1 ))
+
+ keywords="$*"
+}
+
+# Usage: whatis_usage
+# Display usage for the whatis/apropos utility.
+whatis_usage() {
+ echo "usage: $cmd [-d] keyword [...]"
+ exit 1
+}
+
+
+
+# Supported commands
+do_apropos() {
+ [ $(stat -f %i /usr/bin/man) -ne $(stat -f %i /usr/bin/apropos) ] && \
+ exec apropos "$@"
+ search_whatis apropos "$@"
+}
+
+do_man() {
+ man_parse_args "$@"
+ if [ -z "$pages" ]; then
+ echo 'What manual page do you want?' >&2
+ exit 1
+ fi
+ man_setup
+
+ for page in $pages; do
+ decho "Searching for $page"
+ man_find_and_display "$page"
+ done
+
+ exit ${ret:-0}
+}
+
+do_manpath() {
+ manpath_parse_args "$@"
+ if [ -z "$qflag" ]; then
+ manpath_warnings
+ fi
+ if [ -n "$Lflag" ]; then
+ build_manlocales
+ echo $MANLOCALES
+ else
+ build_manpath
+ echo $MANPATH
+ fi
+ exit 0
+}
+
+do_whatis() {
+ [ $(stat -f %i /usr/bin/man) -ne $(stat -f %i /usr/bin/whatis) ] && \
+ exec whatis "$@"
+ search_whatis whatis "$@"
+}
+
+# User's PATH setting decides on the groff-suite to pick up.
+EQN=eqn
+NROFF='groff -S -P-h -Wall -mtty-char -man'
+PIC=pic
+REFER=refer
+TBL=tbl
+TROFF='groff -S -man'
+VGRIND=vgrind
+
+LOCALE=/usr/bin/locale
+STTY=/bin/stty
+SYSCTL=/sbin/sysctl
+
+debug=0
+man_default_sections='1:8:2:3:n:4:5:6:7:9:l'
+man_default_path='/usr/share/man:/usr/share/openssl/man:/usr/local/man'
+cattool='/usr/bin/zcat -f'
+
+config_global='/etc/man.conf'
+
+# This can be overridden via a setting in /etc/man.conf.
+config_local='/usr/local/etc/man.d/*.conf'
+
+# Set noglobbing for now. I don't want spurious globbing.
+set -f
+
+case "$0" in
+*apropos) do_apropos "$@" ;;
+*manpath) do_manpath "$@" ;;
+*whatis) do_whatis "$@" ;;
+*) do_man "$@" ;;
+esac
diff --git a/usr.bin/man/manpath.1 b/usr.bin/man/manpath.1
new file mode 100644
index 0000000..381bef6
--- /dev/null
+++ b/usr.bin/man/manpath.1
@@ -0,0 +1,123 @@
+.\"-
+.\" Copyright (c) 2010 Gordon Tetlow
+.\" 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 September 1, 2010
+.Dt MANPATH 1
+.Os
+.Sh NAME
+.Nm manpath
+.Nd display search path for manual pages
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ldq
+.Sh DESCRIPTION
+The
+.Nm
+utility determines the user's manual search path from
+the user's
+.Ev PATH ,
+and local configuration files.
+This result is echoed to the standard output.
+.Bl -tag -width ".Fl d"
+.It Fl L
+Output manual locales list instead of the manual path.
+.It Fl d
+Print extra debugging information.
+.It Fl q
+Suppresses warning messages.
+.El
+.Sh IMPLEMENTATION NOTES
+The
+.Nm
+utility constructs the manual path from two sources:
+.Bl -enum -compact
+.It
+From each component of the user's
+.Ev PATH
+for the first of:
+.Bl -dash -compact
+.It
+.Pa pathname/man
+.It
+.Pa pathname/MAN
+.It
+If pathname ends with /bin:
+.Pa pathname/../man
+.El
+Note: Special logic exists to make
+.Pa /bin
+and
+.Pa /usr/bin
+look in
+.Pa /usr/share/man
+for manual files.
+.It
+The configuration files listed in the
+.Sx FILES
+section for
+.Va MANPATH
+entries.
+.El
+The information from these locations is then concatenated together.
+.Pp
+If the
+.Fl L
+flag is set, the
+.Nm
+utility will search the configuration files listed in the
+.Sx FILES
+section for
+.Va MANLOCALE
+entries.
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev MANLOCALES"
+.It Ev MANLOCALES
+If set with the
+.Fl L
+flag, causes the utility to display a warning and the value, overriding any
+other configuration found on the system.
+.It Ev MANPATH
+If set, causes the utility to display a warning and the value, overriding
+any other configuration found on the system.
+.It Ev PATH
+Influences the manual path as described in the
+.Sx IMPLEMENTATION NOTES .
+.El
+.Sh FILES
+.Bl -tag -width indent -compact
+.It Pa /etc/man.conf
+System configuration file.
+.It Pa /usr/local/etc/man.d/*.conf
+Local configuration files.
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr man 1 ,
+.Xr whatis 1 ,
+.Xr man.conf 5
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
new file mode 100644
index 0000000..5fa7c99
--- /dev/null
+++ b/usr.bin/mandoc/Makefile
@@ -0,0 +1,91 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+MDOCMLDIR= ${.CURDIR}/../../contrib/mdocml
+.PATH: ${MDOCMLDIR}
+
+PROG= mandoc
+MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 # roff.7
+MLINKS= mandoc.1 mdocml.1
+.if ${MK_MANDOCDB} != no
+MAN+= apropos.1 makewhatis.8
+MLINKS+= apropos.1 whatis.1
+LINKS= ${BINDIR}/mandoc ${BINDIR}/whatis \
+ ${BINDIR}/mandoc ${BINDIR}/makewhatis \
+ ${BINDIR}/mandoc ${BINDIR}/apropos
+.endif
+
+LIBMAN_SRCS= man.c \
+ man_hash.c \
+ man_macro.c \
+ man_validate.c
+
+LIBMDOC_SRCS= att.c \
+ lib.c \
+ mdoc.c \
+ mdoc_argv.c \
+ mdoc_hash.c \
+ mdoc_macro.c \
+ mdoc_state.c \
+ mdoc_validate.c \
+ st.c \
+
+LIBROFF_SRCS= eqn.c \
+ roff.c \
+ tbl.c \
+ tbl_data.c \
+ tbl_layout.c \
+ tbl_opts.c \
+
+LIB_SRCS= ${LIBMAN_SRCS} \
+ ${LIBMDOC_SRCS} \
+ ${LIBROFF_SRCS} \
+ chars.c \
+ mandoc.c \
+ mandoc_aux.c \
+ mandoc_ohash.c \
+ msec.c \
+ preconv.c \
+ read.c
+
+HTML_SRCS= eqn_html.c \
+ html.c \
+ man_html.c \
+ mdoc_html.c \
+ tbl_html.c
+
+MAN_SRCS= mdoc_man.c
+
+TERM_SRCS= eqn_term.c \
+ man_term.c \
+ mdoc_term.c \
+ term.c \
+ term_ascii.c \
+ term_ps.c \
+ tbl_term.c
+
+DB_SRCS= mandocdb.c \
+ mansearch.c \
+ mansearch_const.c \
+ tag.c \
+ manpath.c
+
+SRCS= ${LIB_SRCS} \
+ ${HTML_SRCS} \
+ ${MAN_SRCS} \
+ ${TERM_SRCS} \
+ main.c \
+ out.c \
+ tree.c
+
+SRCS+= ${DB_SRCS}
+
+WARNS?= 2
+CFLAGS+= -DHAVE_CONFIG_H \
+ -D_WITH_GETLINE \
+ -I${.CURDIR}/../../lib/libopenbsd/ \
+ -I${.CURDIR}/../../contrib/sqlite3
+LIBADD= openbsd sqlite3 z
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mandoc/Makefile.depend b/usr.bin/mandoc/Makefile.depend
new file mode 100644
index 0000000..7c705f5
--- /dev/null
+++ b/usr.bin/mandoc/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libopenbsd \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mesg/Makefile b/usr.bin/mesg/Makefile
new file mode 100644
index 0000000..47f5a85
--- /dev/null
+++ b/usr.bin/mesg/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= mesg
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mesg/Makefile.depend b/usr.bin/mesg/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/mesg/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/mesg/mesg.1 b/usr.bin/mesg/mesg.1
new file mode 100644
index 0000000..84fea4b
--- /dev/null
+++ b/usr.bin/mesg/mesg.1
@@ -0,0 +1,108 @@
+.\" Copyright (c) 1987, 1990, 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.
+.\"
+.\" @(#)mesg.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 5, 2002
+.Dt MESG 1
+.Os
+.Sh NAME
+.Nm mesg
+.Nd display (do not display) messages from other users
+.Sh SYNOPSIS
+.Nm
+.Op Cm n | Cm y
+.Sh DESCRIPTION
+The
+.Nm
+utility is invoked by a user to control write access others
+have to a terminal device.
+Write access is allowed by default, and programs such as
+.Xr talk 1
+and
+.Xr write 1
+may display messages on the terminal.
+.Pp
+The first terminal device in the sequence of devices associated with standard
+input, standard output and standard error is affected.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Cm n
+Disallow messages.
+.It Cm y
+Permit messages to be displayed.
+.El
+.Pp
+If no arguments are given,
+.Nm
+displays the present message status to the standard output.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Pp
+.Bl -tag -width flag -compact -offset indent
+.It Li "\ 0"
+Messages are allowed.
+.It Li "\ 1"
+Messages are not allowed.
+.It Li ">1"
+An error has occurred.
+.El
+.Sh EXAMPLES
+Disallow messages from other users to the current terminal:
+.Pp
+.Dl "mesg n"
+.Pp
+Allow messages from other users to
+.Pa ttyp1
+(assuming you are also logged in on that terminal):
+.Pp
+.Dl "mesg y </dev/ttyp1"
+.Sh COMPATIBILITY
+Previous versions of the
+.Nm
+utility wrote the message status to the standard error output and
+affected the terminal attached to standard error without first trying the
+standard input or output devices.
+.Sh SEE ALSO
+.Xr biff 1 ,
+.Xr talk 1 ,
+.Xr wall 1 ,
+.Xr write 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/mesg/mesg.c b/usr.bin/mesg/mesg.c
new file mode 100644
index 0000000..796a047
--- /dev/null
+++ b/usr.bin/mesg/mesg.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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) 1987, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)mesg.c 8.2 (Berkeley) 1/21/94";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ char *tty;
+ int ch;
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch (ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if ((tty = ttyname(STDIN_FILENO)) == NULL &&
+ (tty = ttyname(STDOUT_FILENO)) == NULL &&
+ (tty = ttyname(STDERR_FILENO)) == NULL)
+ err(2, "ttyname");
+ if (stat(tty, &sb) < 0)
+ err(2, "%s", tty);
+
+ if (*argv == NULL) {
+ if (sb.st_mode & S_IWGRP) {
+ (void)puts("is y");
+ exit(0);
+ }
+ (void)puts("is n");
+ exit(1);
+ }
+
+ switch (*argv[0]) {
+ case 'y':
+ if (chmod(tty, sb.st_mode | S_IWGRP) < 0)
+ err(2, "%s", tty);
+ exit(0);
+ case 'n':
+ if (chmod(tty, sb.st_mode & ~S_IWGRP) < 0)
+ err(2, "%s", tty);
+ exit(1);
+ }
+
+ usage();
+ return(0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: mesg [n | y]\n");
+ exit(2);
+}
diff --git a/usr.bin/minigzip/Makefile b/usr.bin/minigzip/Makefile
new file mode 100644
index 0000000..da15aa9
--- /dev/null
+++ b/usr.bin/minigzip/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+SRCDIR= ${.CURDIR}/../../lib/libz/test
+.PATH: ${SRCDIR}
+
+PROG= minigzip
+
+WARNS?= 5
+CFLAGS+=-DUSE_MMAP
+LIBADD= z
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/minigzip/Makefile.depend b/usr.bin/minigzip/Makefile.depend
new file mode 100644
index 0000000..d209adb
--- /dev/null
+++ b/usr.bin/minigzip/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/minigzip/minigzip.1 b/usr.bin/minigzip/minigzip.1
new file mode 100644
index 0000000..754e98f
--- /dev/null
+++ b/usr.bin/minigzip/minigzip.1
@@ -0,0 +1,83 @@
+.\" Copyright (c) 1997
+.\" Michael Smith
+.\"
+.\" 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 May 22, 2012
+.Dt MINIGZIP 1
+.Os
+.Sh NAME
+.Nm minigzip
+.Nd minimal implementation of the 'gzip' compression tool
+.Sh SYNOPSIS
+.Nm
+.Op Fl cd
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a minimal implementation of the
+.Xr gzip 1
+utility.
+It supports
+compression and decompression of individual files, as well as
+streaming compression and decompression via standard input and
+output.
+.Pp
+The default operation is compression, decompression can be
+selected by supplying the
+.Fl d
+flag on the command line.
+.Pp
+If any
+.Ar file
+arguments are supplied, the operation is performed on each file
+separately.
+Compression replaces the original file with one having a
+.Pa .gz
+suffix.
+Decompression will remove a
+.Pa .gz
+suffix if one is present.
+.Pp
+If no
+.Ar file
+arguments are supplied,
+.Nm
+reads from standard input and writes the results of the operation
+to standard output.
+.Pp
+If the
+.Fl c
+option is specified,
+.Nm
+writes the results to standard output and keep the original files
+unchanged.
+.Sh SEE ALSO
+.Xr gzip 1
+.Sh AUTHORS
+The
+.Nm
+utility was written by
+.An Jean-loup Gailly .
diff --git a/usr.bin/ministat/Makefile b/usr.bin/ministat/Makefile
new file mode 100644
index 0000000..2a63797
--- /dev/null
+++ b/usr.bin/ministat/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+PROG= ministat
+
+LIBADD= m
+
+.include <bsd.prog.mk>
+
+test: ${PROG}
+ ./${PROG} < ${.CURDIR}/chameleon
+ ./${PROG} ${.CURDIR}/chameleon
+ ./${PROG} ${.CURDIR}/iguana ${.CURDIR}/chameleon
+ ./${PROG} -c 80 ${.CURDIR}/iguana ${.CURDIR}/chameleon
+ ./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
+ ./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana ${.CURDIR}/iguana
diff --git a/usr.bin/ministat/Makefile.depend b/usr.bin/ministat/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/ministat/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ministat/README b/usr.bin/ministat/README
new file mode 100644
index 0000000..cc5fe27
--- /dev/null
+++ b/usr.bin/ministat/README
@@ -0,0 +1,50 @@
+$FreeBSD$
+
+A small tool to do the statistics legwork on benchmarks etc.
+
+Prepare your data into two files, one number per line
+run
+ ./ministat data_before data_after
+
+and see what it says.
+
+You need at least three data points in each data set, but the more
+you have the better your result generally gets.
+
+Here are two typical outputs:
+
+x _1
++ _2
++--------------------------------------------------------------------------+
+|x + x+ x x x + ++ |
+| |_________|______AM_______________|__A___________M_______________||
++--------------------------------------------------------------------------+
+ N Min Max Median Avg Stddev
+x 5 36060 36138 36107 36105.6 31.165686
++ 5 36084 36187 36163 36142.6 49.952978
+No difference proven at 95.0% confidence
+
+Here nothing can be concluded from the numbers. It _may_ be possible to
+prove something if many more measurements are made, but with only five
+measurements, nothing is proven.
+
+
+x _1
++ _2
++--------------------------------------------------------------------------+
+| + |
+| x + +|
+|x x x x + +|
+| |_______________A_____M_________| |_M___A____| |
++--------------------------------------------------------------------------+
+ N Min Max Median Avg Stddev
+x 5 0.133 0.137 0.136 0.1354 0.0015165751
++ 5 0.139 0.14 0.139 0.1394 0.00054772256
+Difference at 95.0% confidence
+ 0.004 +/- 0.00166288
+ 2.95421% +/- 1.22812%
+ (Student's t, pooled s = 0.00114018)
+
+Here we have a clearcut difference, not very big, but clear and unambiguous.
+
+
diff --git a/usr.bin/ministat/chameleon b/usr.bin/ministat/chameleon
new file mode 100644
index 0000000..c554c99
--- /dev/null
+++ b/usr.bin/ministat/chameleon
@@ -0,0 +1,6 @@
+# $FreeBSD$
+150
+400
+720
+500
+930
diff --git a/usr.bin/ministat/iguana b/usr.bin/ministat/iguana
new file mode 100644
index 0000000..d6996c1
--- /dev/null
+++ b/usr.bin/ministat/iguana
@@ -0,0 +1,8 @@
+# $FreeBSD$
+50
+200
+150
+400
+750
+400
+150
diff --git a/usr.bin/ministat/ministat.1 b/usr.bin/ministat/ministat.1
new file mode 100644
index 0000000..f713bae
--- /dev/null
+++ b/usr.bin/ministat/ministat.1
@@ -0,0 +1,135 @@
+.\"
+.\" Copyright (c) 2007 Poul-Henning Kamp
+.\" 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 November 10, 2012
+.Dt MINISTAT 1
+.Os
+.Sh NAME
+.Nm ministat
+.Nd statistics utility
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ans
+.Op Fl C Ar column
+.Op Fl c Ar confidence_level
+.Op Fl d Ar delimiter
+.Op Fl w Op width
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+command calculates fundamental statistical properties of numeric data
+in the specified files or, if no file is specified, standard input.
+.Pp
+The options are as follows:
+.Bl -tag -width Fl
+.It Fl A
+Just report the statistics of the input and relative comparisons,
+suppress the ASCII-art plot.
+.It Fl n
+Just report the raw statistics of the input, suppress the ASCII-art plot
+and the relative comparisons.
+.It Fl s
+Print the average/median/stddev bars on separate lines in the ASCII-art
+plot, to avoid overlap.
+.It Fl C Ar column
+Specify which column of data to use.
+By default the first column in the input file(s) are used.
+.It Fl c Ar confidence_level
+Specify desired confidence level for Student's T analysis.
+Possible values are 80, 90, 95, 98, 99 and 99.5 %
+.It Fl d Ar delimiter
+Specifies the column delimiter characters, default is SPACE and TAB.
+See
+.Xr strtok 3
+for details.
+.It Fl w Ar width
+Width of ASCII-art plot in characters.
+The default is the terminal width, or 74 if standard output is not a
+terminal.
+.El
+.Pp
+A sample output could look like this:
+.Bd -literal -offset indent
+ $ ministat -s -w 60 iguana chameleon
+ x iguana
+ + chameleon
+ +------------------------------------------------------------+
+ |x * x * + + x +|
+ | |________M______A_______________| |
+ | |________________M__A___________________| |
+ +------------------------------------------------------------+
+ N Min Max Median Avg Stddev
+ x 7 50 750 200 300 238.04761
+ + 5 150 930 500 540 299.08193
+ No difference proven at 95.0% confidence
+.Ed
+.Pp
+If
+.Nm
+tells you, as in the example above, that there is no difference
+proven at 95% confidence, the two data sets you gave it are for
+all statistical purposes identical.
+.Pp
+You have the option of lowering your standards by specifying a
+lower confidence level:
+.Bd -literal -offset indent
+ $ ministat -s -w 60 -c 80 iguana chameleon
+ x iguana
+ + chameleon
+ +------------------------------------------------------------+
+ |x * x * + + x +|
+ | |________M______A_______________| |
+ | |________________M__A___________________| |
+ +------------------------------------------------------------+
+ N Min Max Median Avg Stddev
+ x 7 50 750 200 300 238.04761
+ + 5 150 930 500 540 299.08193
+ Difference at 80.0% confidence
+ 240 +/- 212.215
+ 80% +/- 70.7384%
+ (Student's t, pooled s = 264.159)
+.Ed
+.Pp
+But a lower standard does not make your data any better, and the
+example is only included here to show the format of the output when
+a statistical difference is proven according to Student's T method.
+.Sh SEE ALSO
+Any mathematics text on basic statistics, for instances Larry Gonicks
+excellent "Cartoon Guide to Statistics" which supplied the above example.
+.Sh HISTORY
+The
+.Nm
+command was written by Poul-Henning Kamp out of frustration
+over all the bogus benchmark claims made by people with no
+understanding of the importance of uncertainty and statistics.
+.Pp
+From
+.Fx 5.2
+it has lived in the source tree as a developer tool, graduating
+to the installed system from
+.Fx 8.0 .
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c
new file mode 100644
index 0000000..a7f7182
--- /dev/null
+++ b/usr.bin/ministat/ministat.c
@@ -0,0 +1,635 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <math.h>
+#include <ctype.h>
+#include <err.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/ttycom.h>
+
+#define NSTUDENT 100
+#define NCONF 6
+static double const studentpct[] = { 80, 90, 95, 98, 99, 99.5 };
+static double student[NSTUDENT + 1][NCONF] = {
+/* inf */ { 1.282, 1.645, 1.960, 2.326, 2.576, 3.090 },
+/* 1. */ { 3.078, 6.314, 12.706, 31.821, 63.657, 318.313 },
+/* 2. */ { 1.886, 2.920, 4.303, 6.965, 9.925, 22.327 },
+/* 3. */ { 1.638, 2.353, 3.182, 4.541, 5.841, 10.215 },
+/* 4. */ { 1.533, 2.132, 2.776, 3.747, 4.604, 7.173 },
+/* 5. */ { 1.476, 2.015, 2.571, 3.365, 4.032, 5.893 },
+/* 6. */ { 1.440, 1.943, 2.447, 3.143, 3.707, 5.208 },
+/* 7. */ { 1.415, 1.895, 2.365, 2.998, 3.499, 4.782 },
+/* 8. */ { 1.397, 1.860, 2.306, 2.896, 3.355, 4.499 },
+/* 9. */ { 1.383, 1.833, 2.262, 2.821, 3.250, 4.296 },
+/* 10. */ { 1.372, 1.812, 2.228, 2.764, 3.169, 4.143 },
+/* 11. */ { 1.363, 1.796, 2.201, 2.718, 3.106, 4.024 },
+/* 12. */ { 1.356, 1.782, 2.179, 2.681, 3.055, 3.929 },
+/* 13. */ { 1.350, 1.771, 2.160, 2.650, 3.012, 3.852 },
+/* 14. */ { 1.345, 1.761, 2.145, 2.624, 2.977, 3.787 },
+/* 15. */ { 1.341, 1.753, 2.131, 2.602, 2.947, 3.733 },
+/* 16. */ { 1.337, 1.746, 2.120, 2.583, 2.921, 3.686 },
+/* 17. */ { 1.333, 1.740, 2.110, 2.567, 2.898, 3.646 },
+/* 18. */ { 1.330, 1.734, 2.101, 2.552, 2.878, 3.610 },
+/* 19. */ { 1.328, 1.729, 2.093, 2.539, 2.861, 3.579 },
+/* 20. */ { 1.325, 1.725, 2.086, 2.528, 2.845, 3.552 },
+/* 21. */ { 1.323, 1.721, 2.080, 2.518, 2.831, 3.527 },
+/* 22. */ { 1.321, 1.717, 2.074, 2.508, 2.819, 3.505 },
+/* 23. */ { 1.319, 1.714, 2.069, 2.500, 2.807, 3.485 },
+/* 24. */ { 1.318, 1.711, 2.064, 2.492, 2.797, 3.467 },
+/* 25. */ { 1.316, 1.708, 2.060, 2.485, 2.787, 3.450 },
+/* 26. */ { 1.315, 1.706, 2.056, 2.479, 2.779, 3.435 },
+/* 27. */ { 1.314, 1.703, 2.052, 2.473, 2.771, 3.421 },
+/* 28. */ { 1.313, 1.701, 2.048, 2.467, 2.763, 3.408 },
+/* 29. */ { 1.311, 1.699, 2.045, 2.462, 2.756, 3.396 },
+/* 30. */ { 1.310, 1.697, 2.042, 2.457, 2.750, 3.385 },
+/* 31. */ { 1.309, 1.696, 2.040, 2.453, 2.744, 3.375 },
+/* 32. */ { 1.309, 1.694, 2.037, 2.449, 2.738, 3.365 },
+/* 33. */ { 1.308, 1.692, 2.035, 2.445, 2.733, 3.356 },
+/* 34. */ { 1.307, 1.691, 2.032, 2.441, 2.728, 3.348 },
+/* 35. */ { 1.306, 1.690, 2.030, 2.438, 2.724, 3.340 },
+/* 36. */ { 1.306, 1.688, 2.028, 2.434, 2.719, 3.333 },
+/* 37. */ { 1.305, 1.687, 2.026, 2.431, 2.715, 3.326 },
+/* 38. */ { 1.304, 1.686, 2.024, 2.429, 2.712, 3.319 },
+/* 39. */ { 1.304, 1.685, 2.023, 2.426, 2.708, 3.313 },
+/* 40. */ { 1.303, 1.684, 2.021, 2.423, 2.704, 3.307 },
+/* 41. */ { 1.303, 1.683, 2.020, 2.421, 2.701, 3.301 },
+/* 42. */ { 1.302, 1.682, 2.018, 2.418, 2.698, 3.296 },
+/* 43. */ { 1.302, 1.681, 2.017, 2.416, 2.695, 3.291 },
+/* 44. */ { 1.301, 1.680, 2.015, 2.414, 2.692, 3.286 },
+/* 45. */ { 1.301, 1.679, 2.014, 2.412, 2.690, 3.281 },
+/* 46. */ { 1.300, 1.679, 2.013, 2.410, 2.687, 3.277 },
+/* 47. */ { 1.300, 1.678, 2.012, 2.408, 2.685, 3.273 },
+/* 48. */ { 1.299, 1.677, 2.011, 2.407, 2.682, 3.269 },
+/* 49. */ { 1.299, 1.677, 2.010, 2.405, 2.680, 3.265 },
+/* 50. */ { 1.299, 1.676, 2.009, 2.403, 2.678, 3.261 },
+/* 51. */ { 1.298, 1.675, 2.008, 2.402, 2.676, 3.258 },
+/* 52. */ { 1.298, 1.675, 2.007, 2.400, 2.674, 3.255 },
+/* 53. */ { 1.298, 1.674, 2.006, 2.399, 2.672, 3.251 },
+/* 54. */ { 1.297, 1.674, 2.005, 2.397, 2.670, 3.248 },
+/* 55. */ { 1.297, 1.673, 2.004, 2.396, 2.668, 3.245 },
+/* 56. */ { 1.297, 1.673, 2.003, 2.395, 2.667, 3.242 },
+/* 57. */ { 1.297, 1.672, 2.002, 2.394, 2.665, 3.239 },
+/* 58. */ { 1.296, 1.672, 2.002, 2.392, 2.663, 3.237 },
+/* 59. */ { 1.296, 1.671, 2.001, 2.391, 2.662, 3.234 },
+/* 60. */ { 1.296, 1.671, 2.000, 2.390, 2.660, 3.232 },
+/* 61. */ { 1.296, 1.670, 2.000, 2.389, 2.659, 3.229 },
+/* 62. */ { 1.295, 1.670, 1.999, 2.388, 2.657, 3.227 },
+/* 63. */ { 1.295, 1.669, 1.998, 2.387, 2.656, 3.225 },
+/* 64. */ { 1.295, 1.669, 1.998, 2.386, 2.655, 3.223 },
+/* 65. */ { 1.295, 1.669, 1.997, 2.385, 2.654, 3.220 },
+/* 66. */ { 1.295, 1.668, 1.997, 2.384, 2.652, 3.218 },
+/* 67. */ { 1.294, 1.668, 1.996, 2.383, 2.651, 3.216 },
+/* 68. */ { 1.294, 1.668, 1.995, 2.382, 2.650, 3.214 },
+/* 69. */ { 1.294, 1.667, 1.995, 2.382, 2.649, 3.213 },
+/* 70. */ { 1.294, 1.667, 1.994, 2.381, 2.648, 3.211 },
+/* 71. */ { 1.294, 1.667, 1.994, 2.380, 2.647, 3.209 },
+/* 72. */ { 1.293, 1.666, 1.993, 2.379, 2.646, 3.207 },
+/* 73. */ { 1.293, 1.666, 1.993, 2.379, 2.645, 3.206 },
+/* 74. */ { 1.293, 1.666, 1.993, 2.378, 2.644, 3.204 },
+/* 75. */ { 1.293, 1.665, 1.992, 2.377, 2.643, 3.202 },
+/* 76. */ { 1.293, 1.665, 1.992, 2.376, 2.642, 3.201 },
+/* 77. */ { 1.293, 1.665, 1.991, 2.376, 2.641, 3.199 },
+/* 78. */ { 1.292, 1.665, 1.991, 2.375, 2.640, 3.198 },
+/* 79. */ { 1.292, 1.664, 1.990, 2.374, 2.640, 3.197 },
+/* 80. */ { 1.292, 1.664, 1.990, 2.374, 2.639, 3.195 },
+/* 81. */ { 1.292, 1.664, 1.990, 2.373, 2.638, 3.194 },
+/* 82. */ { 1.292, 1.664, 1.989, 2.373, 2.637, 3.193 },
+/* 83. */ { 1.292, 1.663, 1.989, 2.372, 2.636, 3.191 },
+/* 84. */ { 1.292, 1.663, 1.989, 2.372, 2.636, 3.190 },
+/* 85. */ { 1.292, 1.663, 1.988, 2.371, 2.635, 3.189 },
+/* 86. */ { 1.291, 1.663, 1.988, 2.370, 2.634, 3.188 },
+/* 87. */ { 1.291, 1.663, 1.988, 2.370, 2.634, 3.187 },
+/* 88. */ { 1.291, 1.662, 1.987, 2.369, 2.633, 3.185 },
+/* 89. */ { 1.291, 1.662, 1.987, 2.369, 2.632, 3.184 },
+/* 90. */ { 1.291, 1.662, 1.987, 2.368, 2.632, 3.183 },
+/* 91. */ { 1.291, 1.662, 1.986, 2.368, 2.631, 3.182 },
+/* 92. */ { 1.291, 1.662, 1.986, 2.368, 2.630, 3.181 },
+/* 93. */ { 1.291, 1.661, 1.986, 2.367, 2.630, 3.180 },
+/* 94. */ { 1.291, 1.661, 1.986, 2.367, 2.629, 3.179 },
+/* 95. */ { 1.291, 1.661, 1.985, 2.366, 2.629, 3.178 },
+/* 96. */ { 1.290, 1.661, 1.985, 2.366, 2.628, 3.177 },
+/* 97. */ { 1.290, 1.661, 1.985, 2.365, 2.627, 3.176 },
+/* 98. */ { 1.290, 1.661, 1.984, 2.365, 2.627, 3.175 },
+/* 99. */ { 1.290, 1.660, 1.984, 2.365, 2.626, 3.175 },
+/* 100. */ { 1.290, 1.660, 1.984, 2.364, 2.626, 3.174 }
+};
+
+#define MAX_DS 8
+static char symbol[MAX_DS] = { ' ', 'x', '+', '*', '%', '#', '@', 'O' };
+
+struct dataset {
+ char *name;
+ double *points;
+ unsigned lpoints;
+ double sy, syy;
+ unsigned n;
+};
+
+static struct dataset *
+NewSet(void)
+{
+ struct dataset *ds;
+
+ ds = calloc(1, sizeof *ds);
+ ds->lpoints = 100000;
+ ds->points = calloc(sizeof *ds->points, ds->lpoints);
+ return(ds);
+}
+
+static void
+AddPoint(struct dataset *ds, double a)
+{
+ double *dp;
+
+ if (ds->n >= ds->lpoints) {
+ dp = ds->points;
+ ds->lpoints *= 4;
+ ds->points = calloc(sizeof *ds->points, ds->lpoints);
+ memcpy(ds->points, dp, sizeof *dp * ds->n);
+ free(dp);
+ }
+ ds->points[ds->n++] = a;
+ ds->sy += a;
+ ds->syy += a * a;
+}
+
+static double
+Min(struct dataset *ds)
+{
+
+ return (ds->points[0]);
+}
+
+static double
+Max(struct dataset *ds)
+{
+
+ return (ds->points[ds->n -1]);
+}
+
+static double
+Avg(struct dataset *ds)
+{
+
+ return(ds->sy / ds->n);
+}
+
+static double
+Median(struct dataset *ds)
+{
+ if ((ds->n % 2) == 0)
+ return ((ds->points[ds->n / 2] + (ds->points[(ds->n / 2) - 1])) / 2);
+ else
+ return (ds->points[ds->n / 2]);
+}
+
+static double
+Var(struct dataset *ds)
+{
+
+ return (ds->syy - ds->sy * ds->sy / ds->n) / (ds->n - 1.0);
+}
+
+static double
+Stddev(struct dataset *ds)
+{
+
+ return sqrt(Var(ds));
+}
+
+static void
+VitalsHead(void)
+{
+
+ printf(" N Min Max Median Avg Stddev\n");
+}
+
+static void
+Vitals(struct dataset *ds, int flag)
+{
+
+ printf("%c %3d %13.8g %13.8g %13.8g %13.8g %13.8g", symbol[flag],
+ ds->n, Min(ds), Max(ds), Median(ds), Avg(ds), Stddev(ds));
+ printf("\n");
+}
+
+static void
+Relative(struct dataset *ds, struct dataset *rs, int confidx)
+{
+ double spool, s, d, e, t;
+ int i;
+
+ i = ds->n + rs->n - 2;
+ if (i > NSTUDENT)
+ t = student[0][confidx];
+ else
+ t = student[i][confidx];
+ spool = (ds->n - 1) * Var(ds) + (rs->n - 1) * Var(rs);
+ spool /= ds->n + rs->n - 2;
+ spool = sqrt(spool);
+ s = spool * sqrt(1.0 / ds->n + 1.0 / rs->n);
+ d = Avg(ds) - Avg(rs);
+ e = t * s;
+
+ if (fabs(d) > e) {
+
+ printf("Difference at %.1f%% confidence\n", studentpct[confidx]);
+ printf(" %g +/- %g\n", d, e);
+ printf(" %g%% +/- %g%%\n", d * 100 / Avg(rs), e * 100 / Avg(rs));
+ printf(" (Student's t, pooled s = %g)\n", spool);
+ } else {
+ printf("No difference proven at %.1f%% confidence\n",
+ studentpct[confidx]);
+ }
+}
+
+struct plot {
+ double min;
+ double max;
+ double span;
+ int width;
+
+ double x0, dx;
+ int height;
+ char *data;
+ char **bar;
+ int separate_bars;
+ int num_datasets;
+};
+
+static struct plot plot;
+
+static void
+SetupPlot(int width, int separate, int num_datasets)
+{
+ struct plot *pl;
+
+ pl = &plot;
+ pl->width = width;
+ pl->height = 0;
+ pl->data = NULL;
+ pl->bar = NULL;
+ pl->separate_bars = separate;
+ pl->num_datasets = num_datasets;
+ pl->min = 999e99;
+ pl->max = -999e99;
+}
+
+static void
+AdjPlot(double a)
+{
+ struct plot *pl;
+
+ pl = &plot;
+ if (a < pl->min)
+ pl->min = a;
+ if (a > pl->max)
+ pl->max = a;
+ pl->span = pl->max - pl->min;
+ pl->dx = pl->span / (pl->width - 1.0);
+ pl->x0 = pl->min - .5 * pl->dx;
+}
+
+static void
+DimPlot(struct dataset *ds)
+{
+ AdjPlot(Min(ds));
+ AdjPlot(Max(ds));
+ AdjPlot(Avg(ds) - Stddev(ds));
+ AdjPlot(Avg(ds) + Stddev(ds));
+}
+
+static void
+PlotSet(struct dataset *ds, int val)
+{
+ struct plot *pl;
+ int i, j, m, x;
+ unsigned n;
+ int bar;
+
+ pl = &plot;
+ if (pl->span == 0)
+ return;
+
+ if (pl->separate_bars)
+ bar = val-1;
+ else
+ bar = 0;
+
+ if (pl->bar == NULL)
+ pl->bar = calloc(sizeof(char *), pl->num_datasets);
+ if (pl->bar[bar] == NULL) {
+ pl->bar[bar] = malloc(pl->width);
+ memset(pl->bar[bar], 0, pl->width);
+ }
+
+ m = 1;
+ i = -1;
+ j = 0;
+ for (n = 0; n < ds->n; n++) {
+ x = (ds->points[n] - pl->x0) / pl->dx;
+ if (x == i) {
+ j++;
+ if (j > m)
+ m = j;
+ } else {
+ j = 1;
+ i = x;
+ }
+ }
+ m += 1;
+ if (m > pl->height) {
+ pl->data = realloc(pl->data, pl->width * m);
+ memset(pl->data + pl->height * pl->width, 0,
+ (m - pl->height) * pl->width);
+ }
+ pl->height = m;
+ i = -1;
+ for (n = 0; n < ds->n; n++) {
+ x = (ds->points[n] - pl->x0) / pl->dx;
+ if (x == i) {
+ j++;
+ } else {
+ j = 1;
+ i = x;
+ }
+ pl->data[j * pl->width + x] |= val;
+ }
+ if (!isnan(Stddev(ds))) {
+ x = ((Avg(ds) - Stddev(ds)) - pl->x0) / pl->dx;
+ m = ((Avg(ds) + Stddev(ds)) - pl->x0) / pl->dx;
+ pl->bar[bar][m] = '|';
+ pl->bar[bar][x] = '|';
+ for (i = x + 1; i < m; i++)
+ if (pl->bar[bar][i] == 0)
+ pl->bar[bar][i] = '_';
+ }
+ x = (Median(ds) - pl->x0) / pl->dx;
+ pl->bar[bar][x] = 'M';
+ x = (Avg(ds) - pl->x0) / pl->dx;
+ pl->bar[bar][x] = 'A';
+}
+
+static void
+DumpPlot(void)
+{
+ struct plot *pl;
+ int i, j, k;
+
+ pl = &plot;
+ if (pl->span == 0) {
+ printf("[no plot, span is zero width]\n");
+ return;
+ }
+
+ putchar('+');
+ for (i = 0; i < pl->width; i++)
+ putchar('-');
+ putchar('+');
+ putchar('\n');
+ for (i = 1; i < pl->height; i++) {
+ putchar('|');
+ for (j = 0; j < pl->width; j++) {
+ k = pl->data[(pl->height - i) * pl->width + j];
+ if (k >= 0 && k < MAX_DS)
+ putchar(symbol[k]);
+ else
+ printf("[%02x]", k);
+ }
+ putchar('|');
+ putchar('\n');
+ }
+ for (i = 0; i < pl->num_datasets; i++) {
+ if (pl->bar[i] == NULL)
+ continue;
+ putchar('|');
+ for (j = 0; j < pl->width; j++) {
+ k = pl->bar[i][j];
+ if (k == 0)
+ k = ' ';
+ putchar(k);
+ }
+ putchar('|');
+ putchar('\n');
+ }
+ putchar('+');
+ for (i = 0; i < pl->width; i++)
+ putchar('-');
+ putchar('+');
+ putchar('\n');
+}
+
+static int
+dbl_cmp(const void *a, const void *b)
+{
+ const double *aa = a;
+ const double *bb = b;
+
+ if (*aa < *bb)
+ return (-1);
+ else if (*aa > *bb)
+ return (1);
+ else
+ return (0);
+}
+
+static struct dataset *
+ReadSet(const char *n, int column, const char *delim)
+{
+ FILE *f;
+ char buf[BUFSIZ], *p, *t;
+ struct dataset *s;
+ double d;
+ int line;
+ int i;
+
+ if (n == NULL) {
+ f = stdin;
+ n = "<stdin>";
+ } else if (!strcmp(n, "-")) {
+ f = stdin;
+ n = "<stdin>";
+ } else {
+ f = fopen(n, "r");
+ }
+ if (f == NULL)
+ err(1, "Cannot open %s", n);
+ s = NewSet();
+ s->name = strdup(n);
+ line = 0;
+ while (fgets(buf, sizeof buf, f) != NULL) {
+ line++;
+
+ i = strlen(buf);
+ while (i > 0 && isspace(buf[i - 1]))
+ buf[--i] = '\0';
+ for (i = 1, t = strtok(buf, delim);
+ t != NULL && *t != '#';
+ i++, t = strtok(NULL, delim)) {
+ if (i == column)
+ break;
+ }
+ if (t == NULL || *t == '#')
+ continue;
+
+ d = strtod(t, &p);
+ if (p != NULL && *p != '\0')
+ errx(2, "Invalid data on line %d in %s", line, n);
+ if (*buf != '\0')
+ AddPoint(s, d);
+ }
+ fclose(f);
+ if (s->n < 3) {
+ fprintf(stderr,
+ "Dataset %s must contain at least 3 data points\n", n);
+ exit (2);
+ }
+ qsort(s->points, s->n, sizeof *s->points, dbl_cmp);
+ return (s);
+}
+
+static void
+usage(char const *whine)
+{
+ int i;
+
+ fprintf(stderr, "%s\n", whine);
+ fprintf(stderr,
+ "Usage: ministat [-C column] [-c confidence] [-d delimiter(s)] [-Ans] [-w width] [file [file ...]]\n");
+ fprintf(stderr, "\tconfidence = {");
+ for (i = 0; i < NCONF; i++) {
+ fprintf(stderr, "%s%g%%",
+ i ? ", " : "",
+ studentpct[i]);
+ }
+ fprintf(stderr, "}\n");
+ fprintf(stderr, "\t-A : print statistics only. suppress the graph.\n");
+ fprintf(stderr, "\t-C : column number to extract (starts and defaults to 1)\n");
+ fprintf(stderr, "\t-d : delimiter(s) string, default to \" \\t\"\n");
+ fprintf(stderr, "\t-n : print summary statistics only, no graph/test\n");
+ fprintf(stderr, "\t-s : print avg/median/stddev bars on separate lines\n");
+ fprintf(stderr, "\t-w : width of graph/test output (default 74 or terminal width)\n");
+ exit (2);
+}
+
+int
+main(int argc, char **argv)
+{
+ struct dataset *ds[7];
+ int nds;
+ double a;
+ const char *delim = " \t";
+ char *p;
+ int c, i, ci;
+ int column = 1;
+ int flag_s = 0;
+ int flag_n = 0;
+ int termwidth = 74;
+ int suppress_plot = 0;
+
+ if (isatty(STDOUT_FILENO)) {
+ struct winsize wsz;
+
+ if ((p = getenv("COLUMNS")) != NULL && *p != '\0')
+ termwidth = atoi(p);
+ else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsz) != -1 &&
+ wsz.ws_col > 0)
+ termwidth = wsz.ws_col - 2;
+ }
+
+ ci = -1;
+ while ((c = getopt(argc, argv, "AC:c:d:snw:")) != -1)
+ switch (c) {
+ case 'A':
+ suppress_plot = 1;
+ break;
+ case 'C':
+ column = strtol(optarg, &p, 10);
+ if (p != NULL && *p != '\0')
+ usage("Invalid column number.");
+ if (column <= 0)
+ usage("Column number should be positive.");
+ break;
+ case 'c':
+ a = strtod(optarg, &p);
+ if (p != NULL && *p != '\0')
+ usage("Not a floating point number");
+ for (i = 0; i < NCONF; i++)
+ if (a == studentpct[i])
+ ci = i;
+ if (ci == -1)
+ usage("No support for confidence level");
+ break;
+ case 'd':
+ if (*optarg == '\0')
+ usage("Can't use empty delimiter string");
+ delim = optarg;
+ break;
+ case 'n':
+ flag_n = 1;
+ break;
+ case 's':
+ flag_s = 1;
+ break;
+ case 'w':
+ termwidth = strtol(optarg, &p, 10);
+ if (p != NULL && *p != '\0')
+ usage("Invalid width, not a number.");
+ if (termwidth < 0)
+ usage("Unable to move beyond left margin.");
+ break;
+ default:
+ usage("Unknown option");
+ break;
+ }
+ if (ci == -1)
+ ci = 2;
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0) {
+ ds[0] = ReadSet("-", column, delim);
+ nds = 1;
+ } else {
+ if (argc > (MAX_DS - 1))
+ usage("Too many datasets.");
+ nds = argc;
+ for (i = 0; i < nds; i++)
+ ds[i] = ReadSet(argv[i], column, delim);
+ }
+
+ for (i = 0; i < nds; i++)
+ printf("%c %s\n", symbol[i+1], ds[i]->name);
+
+ if (!flag_n && !suppress_plot) {
+ SetupPlot(termwidth, flag_s, nds);
+ for (i = 0; i < nds; i++)
+ DimPlot(ds[i]);
+ for (i = 0; i < nds; i++)
+ PlotSet(ds[i], i + 1);
+ DumpPlot();
+ }
+ VitalsHead();
+ Vitals(ds[0], 1);
+ for (i = 1; i < nds; i++) {
+ Vitals(ds[i], i + 1);
+ if (!flag_n)
+ Relative(ds[i], ds[0], ci);
+ }
+ exit(0);
+}
diff --git a/usr.bin/mkcsmapper/Makefile b/usr.bin/mkcsmapper/Makefile
new file mode 100644
index 0000000..6dbb0ec
--- /dev/null
+++ b/usr.bin/mkcsmapper/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../lib/libc/iconv
+
+PROG= mkcsmapper
+LDFLAGS+= -L${.CURDIR}/../../lib/libc
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include "${.CURDIR}/Makefile.inc"
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkcsmapper/Makefile.depend b/usr.bin/mkcsmapper/Makefile.depend
new file mode 100644
index 0000000..75e2766
--- /dev/null
+++ b/usr.bin/mkcsmapper/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkcsmapper/Makefile.inc b/usr.bin/mkcsmapper/Makefile.inc
new file mode 100644
index 0000000..5a4cc6f
--- /dev/null
+++ b/usr.bin/mkcsmapper/Makefile.inc
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.compiler.mk>
+
+SRCS+= lex.l yacc.y
+CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mkcsmapper \
+ -I${.CURDIR}/../../lib/libc/iconv \
+ -I${.CURDIR}/../../lib/libiconv_modules/mapper_std
+CFLAGS.gcc+= --param max-inline-insns-single=64
diff --git a/usr.bin/mkcsmapper/ldef.h b/usr.bin/mkcsmapper/ldef.h
new file mode 100644
index 0000000..d585703
--- /dev/null
+++ b/usr.bin/mkcsmapper/ldef.h
@@ -0,0 +1,41 @@
+/* $FreeBSD$ */
+/* $NetBSD: ldef.h,v 1.2 2006/09/09 14:35:17 tnozaki Exp $ */
+
+/*-
+ * Copyright (c)2003, 2006 Citrus Project,
+ * 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/types.h>
+
+typedef struct {
+ u_int32_t begin;
+ u_int32_t end;
+ u_int32_t width;
+} linear_zone_t;
+
+extern int debug;
+extern int linenumber;
+extern int yyerror(const char *);
+extern int yylex(void);
diff --git a/usr.bin/mkcsmapper/lex.l b/usr.bin/mkcsmapper/lex.l
new file mode 100644
index 0000000..33b7f8e
--- /dev/null
+++ b/usr.bin/mkcsmapper/lex.l
@@ -0,0 +1,109 @@
+/* $FreeBSD$ */
+/* $NetBSD: lex.l,v 1.4 2006/02/09 22:03:15 dogcow Exp $ */
+
+%{
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * 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>
+#include <sys/endian.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ldef.h"
+#include "yacc.h"
+
+#define YY_DECL int yylex(void)
+
+int linenumber = 1;
+%}
+%option noinput
+%option nounput
+
+%x COMMENT
+
+%%
+
+[ \t]+ { }
+#.*[\n]|"//".*[\n]|[\n] { linenumber++; return (R_LN); }
+
+"/*" { BEGIN COMMENT; }
+<COMMENT>"*/" { BEGIN 0; }
+<COMMENT>[\n] { linenumber++; }
+<COMMENT>. { }
+<COMMENT><<EOF>> {
+ yyerror("unexpected file end (unterminated comment)\n");
+ exit(1);
+ }
+
+"="|"/"|"-" { return ((int)yytext[0]); }
+
+([1-9][0-9]*)|(0[0-9]*)|(0[xX][0-9A-Fa-f]+) {
+ yylval.i_value = strtoul(yytext, NULL, 0);
+ return (L_IMM);
+ }
+
+"TYPE" { return (R_TYPE); }
+"NAME" { return (R_NAME); }
+"SRC_ZONE" { return (R_SRC_ZONE); }
+"DST_INVALID" { return (R_DST_INVALID); }
+"DST_ILSEQ" { return (R_DST_ILSEQ); }
+"DST_UNIT_BITS" { return (R_DST_UNIT_BITS); }
+"BEGIN_MAP" { return (R_BEGIN_MAP); }
+"END_MAP" { return (R_END_MAP); }
+"INVALID" { return (R_INVALID); }
+"ILSEQ" { return (R_ILSEQ); }
+"OOB_MODE" { return (R_OOB_MODE); }
+"ROWCOL" { return (R_ROWCOL); }
+
+\"([^\"\n]*(\\\")?)*\"|\'([^\'\n]*(\\\')?)*\' {
+ size_t len;
+
+ len = strlen(yytext);
+ yylval.s_value = malloc(len - 1);
+ strlcpy(yylval.s_value, yytext + 1, len - 1);
+ return (L_STRING);
+ }
+[^ =/\-0-9\t\n][^ \t\n]* {
+ yylval.s_value = strdup(yytext);
+ return (L_STRING);
+ }
+
+%%
+
+#ifndef yywrap
+int
+yywrap(void)
+{
+
+ return (1);
+}
+#endif
diff --git a/usr.bin/mkcsmapper/mkcsmapper.1 b/usr.bin/mkcsmapper/mkcsmapper.1
new file mode 100644
index 0000000..8faf5e6
--- /dev/null
+++ b/usr.bin/mkcsmapper/mkcsmapper.1
@@ -0,0 +1,89 @@
+.\" Copyright (c) 2009 Gabor Kovesdan <gabor@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.
+.\"
+.\" Portions of this text are reprinted and reproduced in electronic form
+.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
+.\" Portable Operating System Interface (POSIX), The Open Group Base
+.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
+.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
+.\" event of any discrepancy between this version and the original IEEE and
+.\" The Open Group Standard, the original IEEE and The Open Group Standard is
+.\" the referee document. The original Standard can be obtained online at
+.\" http://www.opengroup.org/unix/online.html.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd Sep 6, 2009
+.Dt MKCSMAPPER 1
+.Os
+.Sh NAME
+.Nm mkcsmapper
+.Nd generates hashed conversion data for
+.Xr iconv 3
+.Sh SYNOPSIS
+.Nm
+.Op Fl mpd
+.Fl o
+.Ar outfile
+.Ar infile
+.Sh DESCRIPTION
+The
+.Nm
+utility generates binary conversion data from plain text conversion tables
+for the
+.Xr iconv 3
+library.
+The conversion data has two components:
+The conversion mapping between specific character encodings.
+A pivot file, which the possible source and destination encoding
+pairs or the set of mappings to use for a compound encoding.
+.Pp
+The following options are available:
+.Bl -tag -width 0123
+.It Fl d
+Turns on debug mode.
+.It Fl m
+Generate mapping data from
+.Ar infile .
+.It Fl o Ar outfile
+Put generated binary data to
+.Ar outfile .
+.It Fl p
+Generate pivot data from
+.Ar outfile .
+.El
+.Sh EXIT STATUS
+.Ex -std mkcsmapper
+.Sh SEE ALSO
+.Xr iconv 1 ,
+.Xr mkesdb 1 ,
+.Xr iconv 3
+.Sh HISTORY
+.Nm
+first appeared in
+.Nx 2.0 , and made its appearance in
+.Fx 9.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/usr.bin/mkcsmapper/yacc.y b/usr.bin/mkcsmapper/yacc.y
new file mode 100644
index 0000000..18497ce
--- /dev/null
+++ b/usr.bin/mkcsmapper/yacc.y
@@ -0,0 +1,731 @@
+/* $FreeBSD$ */
+/* $NetBSD: yacc.y,v 1.7 2006/09/09 14:35:17 tnozaki Exp $ */
+
+%{
+/*-
+ * Copyright (c)2003, 2006 Citrus Project,
+ * 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>
+#include <sys/types.h>
+
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+
+#include "ldef.h"
+
+#ifndef __packed
+#define __packed
+#endif
+
+#include "citrus_namespace.h"
+#include "citrus_types.h"
+#include "citrus_mapper_std_file.h"
+#include "citrus_region.h"
+#include "citrus_db_factory.h"
+#include "citrus_db_hash.h"
+#include "citrus_lookup_factory.h"
+#include "citrus_pivot_factory.h"
+
+extern FILE *yyin;
+
+int debug = 0;
+
+static linear_zone_t rowcol[_CITRUS_MAPPER_STD_ROWCOL_MAX];
+static char *map_name;
+static char *output = NULL;
+static void *table = NULL;
+static size_t rowcol_len = 0;
+static size_t table_size;
+static u_int32_t done_flag = 0;
+static u_int32_t dst_ilseq, dst_invalid, dst_unit_bits, oob_mode;
+static u_int32_t rowcol_bits = 0, rowcol_mask = 0;
+static u_int32_t src_next;
+static int map_type;
+static void (*putfunc)(void *, size_t, u_int32_t) = NULL;
+
+#define DF_TYPE 0x00000001
+#define DF_NAME 0x00000002
+#define DF_SRC_ZONE 0x00000004
+#define DF_DST_INVALID 0x00000008
+#define DF_DST_ILSEQ 0x00000010
+#define DF_DST_UNIT_BITS 0x00000020
+#define DF_OOB_MODE 0x00000040
+
+static void dump_file(void);
+static void setup_map(void);
+static void set_type(int);
+static void set_name(char *);
+static void set_src_zone(u_int32_t);
+static void set_dst_invalid(u_int32_t);
+static void set_dst_ilseq(u_int32_t);
+static void set_dst_unit_bits(u_int32_t);
+static void set_oob_mode(u_int32_t);
+static int check_src(u_int32_t, u_int32_t);
+static void store(const linear_zone_t *, u_int32_t, int);
+static void put8(void *, size_t, u_int32_t);
+static void put16(void *, size_t, u_int32_t);
+static void put32(void *, size_t, u_int32_t);
+static void set_range(u_int32_t, u_int32_t);
+static void set_src(linear_zone_t *, u_int32_t, u_int32_t);
+%}
+
+%union {
+ u_int32_t i_value;
+ char *s_value;
+ linear_zone_t lz_value;
+}
+
+%token R_TYPE R_NAME R_SRC_ZONE R_DST_UNIT_BITS
+%token R_DST_INVALID R_DST_ILSEQ
+%token R_BEGIN_MAP R_END_MAP R_INVALID R_ROWCOL
+%token R_ILSEQ R_OOB_MODE
+%token R_LN
+%token <i_value> L_IMM
+%token <s_value> L_STRING
+
+%type <lz_value> src
+%type <i_value> dst types oob_mode_sel zone
+
+%%
+
+file : property mapping lns
+ { dump_file(); }
+
+property : /* empty */
+ | property R_LN
+ | property name
+ | property type
+ | property src_zone
+ | property dst_invalid
+ | property dst_ilseq
+ | property dst_unit_bits
+ | property oob_mode
+
+name : R_NAME L_STRING { set_name($2); $2 = NULL; }
+type : R_TYPE types { set_type($2); }
+types : R_ROWCOL { $$ = R_ROWCOL; }
+range : L_IMM '-' L_IMM { set_range($1, $3); }
+
+ranges : /* empty */
+ | ranges range '/'
+
+src_zone : R_SRC_ZONE zone { set_src_zone($2); }
+zone : range {
+ $$ = 32;
+ }
+ | range '/' range '/' ranges L_IMM {
+ $$ = $6;
+ }
+
+dst_invalid : R_DST_INVALID L_IMM { set_dst_invalid($2); }
+dst_ilseq : R_DST_ILSEQ L_IMM { set_dst_ilseq($2); }
+dst_unit_bits : R_DST_UNIT_BITS L_IMM { set_dst_unit_bits($2); }
+oob_mode : R_OOB_MODE oob_mode_sel { set_oob_mode($2); }
+
+oob_mode_sel : R_INVALID { $$ = _CITRUS_MAPPER_STD_OOB_NONIDENTICAL; }
+ | R_ILSEQ { $$ = _CITRUS_MAPPER_STD_OOB_ILSEQ; }
+
+mapping : begin_map map_elems R_END_MAP
+begin_map : R_BEGIN_MAP lns { setup_map(); }
+
+map_elems : /* empty */
+ | map_elems map_elem lns
+
+map_elem : src '=' dst
+ { store(&$1, $3, 0); }
+ | src '=' L_IMM '-'
+ { store(&$1, $3, 1); }
+dst : L_IMM
+ {
+ $$ = $1;
+ }
+ | R_INVALID
+ {
+ $$ = dst_invalid;
+ }
+ | R_ILSEQ
+ {
+ $$ = dst_ilseq;
+ }
+
+src : /* empty */
+ {
+ set_src(&$$, src_next, src_next);
+ }
+ | L_IMM
+ {
+ set_src(&$$, $1, $1);
+ }
+ | L_IMM '-' L_IMM
+ {
+ set_src(&$$, $1, $3);
+ }
+ | '-' L_IMM
+ {
+ set_src(&$$, src_next, $2);
+ }
+lns : R_LN
+ | lns R_LN
+
+%%
+
+static void
+warning(const char *s)
+{
+
+ fprintf(stderr, "%s in %d\n", s, linenumber);
+}
+
+int
+yyerror(const char *s)
+{
+
+ warning(s);
+ exit(1);
+}
+
+void
+put8(void *ptr, size_t ofs, u_int32_t val)
+{
+
+ *((u_int8_t *)ptr + ofs) = val;
+}
+
+void
+put16(void *ptr, size_t ofs, u_int32_t val)
+{
+
+ u_int16_t oval = htons(val);
+ memcpy((u_int16_t *)ptr + ofs, &oval, 2);
+}
+
+void
+put32(void *ptr, size_t ofs, u_int32_t val)
+{
+
+ u_int32_t oval = htonl(val);
+ memcpy((u_int32_t *)ptr + ofs, &oval, 4);
+}
+
+static void
+alloc_table(void)
+{
+ linear_zone_t *p;
+ size_t i;
+ uint32_t val = 0;
+
+ i = rowcol_len;
+ p = &rowcol[--i];
+ table_size = p->width;
+ while (i > 0) {
+ p = &rowcol[--i];
+ table_size *= p->width;
+ }
+ table = (void *)malloc(table_size * dst_unit_bits / 8);
+ if (table == NULL) {
+ perror("malloc");
+ exit(1);
+ }
+
+ switch (oob_mode) {
+ case _CITRUS_MAPPER_STD_OOB_NONIDENTICAL:
+ val = dst_invalid;
+ break;
+ case _CITRUS_MAPPER_STD_OOB_ILSEQ:
+ val = dst_ilseq;
+ break;
+ default:
+ break;
+ }
+ for (i = 0; i < table_size; i++)
+ (*putfunc)(table, i, val);
+}
+
+static void
+setup_map(void)
+{
+
+ if ((done_flag & DF_SRC_ZONE)==0) {
+ fprintf(stderr, "SRC_ZONE is mandatory.\n");
+ exit(1);
+ }
+ if ((done_flag & DF_DST_UNIT_BITS)==0) {
+ fprintf(stderr, "DST_UNIT_BITS is mandatory.\n");
+ exit(1);
+ }
+
+ if ((done_flag & DF_DST_INVALID) == 0)
+ dst_invalid = 0xFFFFFFFF;
+ if ((done_flag & DF_DST_ILSEQ) == 0)
+ dst_ilseq = 0xFFFFFFFE;
+ if ((done_flag & DF_OOB_MODE) == 0)
+ oob_mode = _CITRUS_MAPPER_STD_OOB_NONIDENTICAL;
+
+ alloc_table();
+}
+
+static void
+create_rowcol_info(struct _region *r)
+{
+ void *ptr;
+ size_t i, len, ofs;
+
+ ofs = 0;
+ ptr = malloc(_CITRUS_MAPPER_STD_ROWCOL_INFO_SIZE);
+ if (ptr == NULL)
+ err(EXIT_FAILURE, "malloc");
+ put32(ptr, ofs, rowcol_bits); ofs++;
+ put32(ptr, ofs, dst_invalid); ofs++;
+
+ /* XXX: keep backward compatibility */
+ switch (rowcol_len) {
+ case 1:
+ put32(ptr, ofs, 0); ofs++;
+ put32(ptr, ofs, 0); ofs++;
+ /*FALLTHROUGH*/
+ case 2:
+ len = 0;
+ break;
+ default:
+ len = rowcol_len;
+ }
+ for (i = 0; i < rowcol_len; ++i) {
+ put32(ptr, ofs, rowcol[i].begin); ofs++;
+ put32(ptr, ofs, rowcol[i].end); ofs++;
+ }
+ put32(ptr, ofs, dst_unit_bits); ofs++;
+ put32(ptr, ofs, len); ofs++;
+
+ _region_init(r, ptr, ofs * 4);
+}
+
+
+static void
+create_rowcol_ext_ilseq_info(struct _region *r)
+{
+ void *ptr;
+ size_t ofs;
+
+ ofs = 0;
+ ptr = malloc(_CITRUS_MAPPER_STD_ROWCOL_EXT_ILSEQ_SIZE);
+ if (ptr == NULL)
+ err(EXIT_FAILURE, "malloc");
+
+ put32(ptr, ofs, oob_mode); ofs++;
+ put32(ptr, ofs, dst_ilseq); ofs++;
+
+ _region_init(r, ptr, _CITRUS_MAPPER_STD_ROWCOL_EXT_ILSEQ_SIZE);
+}
+
+#define CHKERR(ret, func, a) \
+do { \
+ ret = func a; \
+ if (ret) \
+ errx(EXIT_FAILURE, "%s: %s", #func, strerror(ret)); \
+} while (/*CONSTCOND*/0)
+
+static void
+dump_file(void)
+{
+ struct _db_factory *df;
+ struct _region data;
+ void *serialized;
+ FILE *fp;
+ size_t size;
+ int ret;
+
+ /*
+ * build database
+ */
+ CHKERR(ret, _db_factory_create, (&df, _db_hash_std, NULL));
+
+ /* store type */
+ CHKERR(ret, _db_factory_addstr_by_s,
+ (df, _CITRUS_MAPPER_STD_SYM_TYPE, _CITRUS_MAPPER_STD_TYPE_ROWCOL));
+
+ /* store info */
+ create_rowcol_info(&data);
+ CHKERR(ret, _db_factory_add_by_s,
+ (df, _CITRUS_MAPPER_STD_SYM_INFO, &data, 1));
+
+ /* ilseq extension */
+ create_rowcol_ext_ilseq_info(&data);
+ CHKERR(ret, _db_factory_add_by_s,
+ (df, _CITRUS_MAPPER_STD_SYM_ROWCOL_EXT_ILSEQ, &data, 1));
+
+ /* store table */
+ _region_init(&data, table, table_size*dst_unit_bits/8);
+ CHKERR(ret, _db_factory_add_by_s,
+ (df, _CITRUS_MAPPER_STD_SYM_TABLE, &data, 1));
+
+ /*
+ * dump database to file
+ */
+ fp = output ? fopen(output, "wb") : stdout;
+
+ if (fp == NULL) {
+ perror("fopen");
+ exit(1);
+ }
+
+ /* dump database body */
+ size = _db_factory_calc_size(df);
+ serialized = malloc(size);
+ _region_init(&data, serialized, size);
+ CHKERR(ret, _db_factory_serialize,
+ (df, _CITRUS_MAPPER_STD_MAGIC, &data));
+ if (fwrite(serialized, size, 1, fp) != 1)
+ err(EXIT_FAILURE, "fwrite");
+
+ fclose(fp);
+}
+
+static void
+/*ARGSUSED*/
+set_type(int type)
+{
+
+ if (done_flag & DF_TYPE) {
+ warning("TYPE is duplicated. ignored this one");
+ return;
+ }
+
+ map_type = type;
+
+ done_flag |= DF_TYPE;
+}
+
+static void
+/*ARGSUSED*/
+set_name(char *str)
+{
+
+ if (done_flag & DF_NAME) {
+ warning("NAME is duplicated. ignored this one");
+ return;
+ }
+
+ map_name = str;
+
+ done_flag |= DF_NAME;
+}
+
+static void
+set_src_zone(u_int32_t val)
+{
+ linear_zone_t *p;
+ size_t i;
+
+ if (done_flag & DF_SRC_ZONE) {
+ warning("SRC_ZONE is duplicated. ignored this one");
+ return;
+ }
+ rowcol_bits = val;
+
+ /* sanity check */
+ switch (rowcol_bits) {
+ case 8: case 16: case 32:
+ if (rowcol_len <= 32 / rowcol_bits)
+ break;
+ /*FALLTHROUGH*/
+ default:
+ goto bad;
+ }
+ rowcol_mask = 1 << (rowcol_bits - 1);
+ rowcol_mask |= rowcol_mask - 1;
+ for (i = 0; i < rowcol_len; ++i) {
+ p = &rowcol[i];
+ if (p->end > rowcol_mask)
+ goto bad;
+ }
+ done_flag |= DF_SRC_ZONE;
+ return;
+
+bad:
+ yyerror("Illegal argument for SRC_ZONE");
+}
+
+static void
+set_dst_invalid(u_int32_t val)
+{
+
+ if (done_flag & DF_DST_INVALID) {
+ warning("DST_INVALID is duplicated. ignored this one");
+ return;
+ }
+
+ dst_invalid = val;
+
+ done_flag |= DF_DST_INVALID;
+}
+
+static void
+set_dst_ilseq(u_int32_t val)
+{
+
+ if (done_flag & DF_DST_ILSEQ) {
+ warning("DST_ILSEQ is duplicated. ignored this one");
+ return;
+ }
+
+ dst_ilseq = val;
+
+ done_flag |= DF_DST_ILSEQ;
+}
+
+static void
+set_oob_mode(u_int32_t val)
+{
+
+ if (done_flag & DF_OOB_MODE) {
+ warning("OOB_MODE is duplicated. ignored this one");
+ return;
+ }
+
+ oob_mode = val;
+
+ done_flag |= DF_OOB_MODE;
+}
+
+static void
+set_dst_unit_bits(u_int32_t val)
+{
+
+ if (done_flag & DF_DST_UNIT_BITS) {
+ warning("DST_UNIT_BITS is duplicated. ignored this one");
+ return;
+ }
+
+ switch (val) {
+ case 8:
+ putfunc = &put8;
+ dst_unit_bits = val;
+ break;
+ case 16:
+ putfunc = &put16;
+ dst_unit_bits = val;
+ break;
+ case 32:
+ putfunc = &put32;
+ dst_unit_bits = val;
+ break;
+ default:
+ yyerror("Illegal argument for DST_UNIT_BITS");
+ }
+ done_flag |= DF_DST_UNIT_BITS;
+}
+
+static int
+check_src(u_int32_t begin, u_int32_t end)
+{
+ linear_zone_t *p;
+ size_t i;
+ u_int32_t m, n;
+
+ if (begin > end)
+ return (1);
+ if (begin < end) {
+ m = begin & ~rowcol_mask;
+ n = end & ~rowcol_mask;
+ if (m != n)
+ return (1);
+ }
+ for (i = rowcol_len * rowcol_bits, p = &rowcol[0]; i > 0; ++p) {
+ i -= rowcol_bits;
+ m = (begin >> i) & rowcol_mask;
+ if (m < p->begin || m > p->end)
+ return (1);
+ }
+ if (begin < end) {
+ n = end & rowcol_mask;
+ --p;
+ if (n < p->begin || n > p->end)
+ return (1);
+ }
+ return (0);
+}
+
+static void
+store(const linear_zone_t *lz, u_int32_t dst, int inc)
+{
+ linear_zone_t *p;
+ size_t i, ofs;
+ u_int32_t n;
+
+ ofs = 0;
+ for (i = rowcol_len * rowcol_bits, p = &rowcol[0]; i > 0; ++p) {
+ i -= rowcol_bits;
+ n = ((lz->begin >> i) & rowcol_mask) - p->begin;
+ ofs = (ofs * p->width) + n;
+ }
+ n = lz->width;
+ while (n-- > 0) {
+ (*putfunc)(table, ofs++, dst);
+ if (inc)
+ dst++;
+ }
+}
+
+static void
+set_range(u_int32_t begin, u_int32_t end)
+{
+ linear_zone_t *p;
+
+ if (rowcol_len >= _CITRUS_MAPPER_STD_ROWCOL_MAX)
+ goto bad;
+ p = &rowcol[rowcol_len++];
+
+ if (begin > end)
+ goto bad;
+ p->begin = begin, p->end = end;
+ p->width = end - begin + 1;
+
+ return;
+
+bad:
+ yyerror("Illegal argument for SRC_ZONE");
+}
+
+static void
+set_src(linear_zone_t *lz, u_int32_t begin, u_int32_t end)
+{
+
+ if (check_src(begin, end) != 0)
+ yyerror("illegal zone");
+
+ lz->begin = begin, lz->end = end;
+ lz->width = end - begin + 1;
+
+ src_next = end + 1;
+}
+
+static void
+do_mkdb(FILE *in)
+{
+ FILE *out;
+ int ret;
+
+ /* dump DB to file */
+ out = output ? fopen(output, "wb") : stdout;
+
+ if (out == NULL)
+ err(EXIT_FAILURE, "fopen");
+
+ ret = _lookup_factory_convert(out, in);
+ fclose(out);
+ if (ret && output)
+ unlink(output); /* dump failure */
+}
+
+static void
+do_mkpv(FILE *in)
+{
+ FILE *out;
+ int ret;
+
+ /* dump pivot to file */
+ out = output ? fopen(output, "wb") : stdout;
+
+ if (out == NULL)
+ err(EXIT_FAILURE, "fopen");
+
+ ret = _pivot_factory_convert(out, in);
+ fclose(out);
+ if (ret && output)
+ unlink(output); /* dump failure */
+ if (ret)
+ errx(EXIT_FAILURE, "%s\n", strerror(ret));
+}
+
+static void
+usage(void)
+{
+ warnx("usage: \n"
+ "\t%s [-d] [-o outfile] [infile]\n"
+ "\t%s -m [-d] [-o outfile] [infile]\n"
+ "\t%s -p [-d] [-o outfile] [infile]\n",
+ getprogname(), getprogname(), getprogname());
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *in = NULL;
+ int ch, mkdb = 0, mkpv = 0;
+
+ while ((ch = getopt(argc, argv, "do:mp")) != EOF) {
+ switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'o':
+ output = strdup(optarg);
+ break;
+ case 'm':
+ mkdb = 1;
+ break;
+ case 'p':
+ mkpv = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ switch (argc) {
+ case 0:
+ in = stdin;
+ break;
+ case 1:
+ in = fopen(argv[0], "r");
+ if (!in)
+ err(EXIT_FAILURE, "%s", argv[0]);
+ break;
+ default:
+ usage();
+ }
+
+ if (mkdb)
+ do_mkdb(in);
+ else if (mkpv)
+ do_mkpv(in);
+ else {
+ yyin = in;
+ yyparse();
+ }
+
+ return (0);
+}
diff --git a/usr.bin/mkcsmapper_static/Makefile b/usr.bin/mkcsmapper_static/Makefile
new file mode 100644
index 0000000..a416b20
--- /dev/null
+++ b/usr.bin/mkcsmapper_static/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../lib/libc/iconv ${.CURDIR}/../mkcsmapper
+
+PROG= mkcsmapper_static
+SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \
+ citrus_lookup_factory.c citrus_pivot_factory.c
+MAN=
+NO_SHARED= yes
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+build-tools: mkcsmapper_static
+
+.include "${.CURDIR}/../mkcsmapper/Makefile.inc"
+.include <bsd.prog.mk>
+
+${PROG}: ${BUILD_TOOLS_META}
diff --git a/usr.bin/mkcsmapper_static/Makefile.depend b/usr.bin/mkcsmapper_static/Makefile.depend
new file mode 100644
index 0000000..75e2766
--- /dev/null
+++ b/usr.bin/mkcsmapper_static/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkdep/Makefile b/usr.bin/mkdep/Makefile
new file mode 100644
index 0000000..463466c
--- /dev/null
+++ b/usr.bin/mkdep/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+SCRIPTS= mkdep.gcc.sh
+MAN= mkdep.1
+SCRIPTSNAME= mkdep
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkdep/Makefile.depend b/usr.bin/mkdep/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/mkdep/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkdep/mkdep.1 b/usr.bin/mkdep/mkdep.1
new file mode 100644
index 0000000..9b65a9c
--- /dev/null
+++ b/usr.bin/mkdep/mkdep.1
@@ -0,0 +1,129 @@
+.\" Copyright (c) 1987, 1990, 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.
+.\"
+.\" @(#)mkdep.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd October 23, 2015
+.Dt MKDEP 1
+.Os
+.Sh NAME
+.Nm mkdep
+.Nd construct Makefile dependency list
+.Sh SYNOPSIS
+.Nm
+.Op Fl ap
+.Op Fl f Ar file
+.Op Ar flags
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility takes a set of flags for the C compiler and a list
+of C source files as arguments and constructs a set of include
+file dependencies which are written into the file ``.depend''.
+An example of its use in a Makefile might be:
+.Bd -literal -offset indent
+CFLAGS= -O -I../include
+SRCS= file1.c file2.c
+
+depend:
+ mkdep ${CFLAGS} ${SRCS}
+.Ed
+.Pp
+where the macro SRCS is the list of C source files and the macro
+CFLAGS is the list of flags for the C compiler.
+.Pp
+The user has the ability to change the preprocessor and preprocessor options
+used.
+For instance, to use
+.Sy cc
+as the preprocessor and to ignore system
+headers, one would use
+.Bd -literal -offset indent
+depend:
+ env MKDEP_CPP="cc -E" MKDEP_CPP_OPTS=-MM mkdep \\
+ ${CFLAGS} ${SRCS}
+.Ed
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Append to the output file,
+so that multiple
+.Nm Ns 's
+may be run from a single Makefile.
+.It Fl f
+Write the include file dependencies to
+.Ar file ,
+instead of the default ``.depend''.
+.It Fl p
+Cause
+.Nm
+to produce dependencies of the form:
+.Bd -literal -offset indent
+program: program.c
+.Ed
+.Pp
+so that subsequent makes will produce
+.Ar program
+directly from its C module rather than using an intermediate
+.Pa \&.o
+module.
+This is useful for programs whose source is contained in a single
+module.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width MKDEP_CPP_OPTS
+.It Ev CC
+Specifies the C compiler to use.
+The specified compiler is expected to have
+options consistent with the GNU C compiler.
+The default is
+.Sy cc .
+.It Ev MKDEP_CPP
+Specifies the preprocessor to use.
+The default is "${CC} -E".
+.It Ev MKDEP_CPP_OPTS
+Specifies the non-CFLAGS options for the preprocessor.
+The default is
+"-M".
+.El
+.Sh FILES
+.Bl -tag -width .depend -compact
+.It Pa .depend
+File containing list of dependencies.
+.El
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr cpp 1 ,
+.Xr make 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 Tahoe .
diff --git a/usr.bin/mkdep/mkdep.gcc.sh b/usr.bin/mkdep/mkdep.gcc.sh
new file mode 100644
index 0000000..ac97621
--- /dev/null
+++ b/usr.bin/mkdep/mkdep.gcc.sh
@@ -0,0 +1,96 @@
+#!/bin/sh -
+#
+# Copyright (c) 1991, 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.
+#
+# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+D=.depend # default dependency file is .depend
+append=0
+pflag=
+
+while :
+ do case "$1" in
+ # -a appends to the depend file
+ -a)
+ append=1
+ shift ;;
+
+ # -f allows you to select a makefile name
+ -f)
+ D=$2
+ shift; shift ;;
+
+ # the -p flag produces "program: program.c" style dependencies
+ # so .o's don't get produced
+ -p)
+ pflag=p
+ shift ;;
+ *)
+ break ;;
+ esac
+done
+
+case $# in 0)
+ echo 'usage: mkdep [-ap] [-f file] [flags] file ...' >&2
+ exit 1;;
+esac
+
+TMP=_mkdep$$
+trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
+trap 'rm -f $TMP' 0
+
+# For C sources, mkdep must use exactly the same cpp and predefined flags
+# as the compiler would. This is easily arranged by letting the compiler
+# pick the cpp. mkdep must be told the cpp to use for exceptional cases.
+CC=${CC-"cc"}
+MKDEP_CPP=${MKDEP_CPP-"${CC} -E"}
+MKDEP_CPP_OPTS=${MKDEP_CPP_OPTS-"-M"};
+
+echo "# $@" > $TMP # store arguments for debugging
+
+if $MKDEP_CPP $MKDEP_CPP_OPTS "$@" >> $TMP; then :
+else
+ echo 'mkdep: compile failed' >&2
+ exit 1
+fi
+
+case x$pflag in
+ x) case $append in
+ 0) sed -e 's; \./; ;g' < $TMP > $D;;
+ *) sed -e 's; \./; ;g' < $TMP >> $D;;
+ esac
+ ;;
+ *) case $append in
+ 0) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP > $D;;
+ *) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP >> $D;;
+ esac
+ ;;
+esac
+
+exit $?
diff --git a/usr.bin/mkdep/mkdep.sh b/usr.bin/mkdep/mkdep.sh
new file mode 100644
index 0000000..8524508
--- /dev/null
+++ b/usr.bin/mkdep/mkdep.sh
@@ -0,0 +1,109 @@
+#!/bin/sh -
+#
+# Copyright (c) 1991, 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.
+#
+# $FreeBSD$
+#
+# @(#)mkdep.sh 8.1 (Berkeley) 6/6/93
+#
+
+PATH=/bin:/usr/bin:/usr/ucb:/usr/old/bin
+export PATH
+
+D=.depend # default dependency file is .depend
+append=0
+
+while :
+ do case "$1" in
+ # -a appends to the depend file
+ -a)
+ append=1
+ shift ;;
+
+ # -f allows you to select a makefile name
+ -f)
+ D=$2
+ shift; shift ;;
+
+ # the -p flag produces "program: program.c" style dependencies
+ # so .o's don't get produced
+ -p)
+ SED='s;\.o ; ;'
+ shift ;;
+ *)
+ break ;;
+ esac
+done
+
+if [ $# = 0 ] ; then
+ echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
+ exit 1
+fi
+
+TMP=/tmp/mkdep$$
+
+trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
+
+cc -M $* |
+sed "
+ s; \./; ;g
+ /\.c:$/d
+ $SED" |
+awk '{
+ if ($1 != prev) {
+ if (rec != "")
+ print rec;
+ rec = $0;
+ prev = $1;
+ }
+ else {
+ if (length(rec $2) > 78) {
+ print rec;
+ rec = $0;
+ }
+ else
+ rec = rec " " $2
+ }
+}
+END {
+ print rec
+}' > $TMP
+
+if [ $? != 0 ]; then
+ echo 'mkdep: compile failed.'
+ rm -f $TMP
+ exit 1
+fi
+
+if [ $append = 1 ]; then
+ cat $TMP >> $D
+ rm -f $TMP
+else
+ mv $TMP $D
+fi
+exit 0
diff --git a/usr.bin/mkesdb/Makefile b/usr.bin/mkesdb/Makefile
new file mode 100644
index 0000000..b9495ed
--- /dev/null
+++ b/usr.bin/mkesdb/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../lib/libc/iconv
+
+PROG= mkesdb
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include "${.CURDIR}/Makefile.inc"
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkesdb/Makefile.depend b/usr.bin/mkesdb/Makefile.depend
new file mode 100644
index 0000000..ca0b2f9
--- /dev/null
+++ b/usr.bin/mkesdb/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkesdb/Makefile.inc b/usr.bin/mkesdb/Makefile.inc
new file mode 100644
index 0000000..ce817fa
--- /dev/null
+++ b/usr.bin/mkesdb/Makefile.inc
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SRCS+= lex.l yacc.y
+CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mkesdb \
+ -I${.CURDIR}/../../lib/libc/iconv
diff --git a/usr.bin/mkesdb/ldef.h b/usr.bin/mkesdb/ldef.h
new file mode 100644
index 0000000..45b4e60
--- /dev/null
+++ b/usr.bin/mkesdb/ldef.h
@@ -0,0 +1,39 @@
+/* $FreeBSD$ */
+/* $NetBSD: ldef.h,v 1.2 2005/06/27 01:23:59 fvdl Exp $ */
+
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * 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.
+ */
+
+extern int linenumber;
+extern int yyerror(const char *);
+extern int yylex(void);
+
+struct named_csid {
+ STAILQ_ENTRY(named_csid) ci_entry;
+ char *ci_symbol;
+ u_int32_t ci_csid;
+};
+STAILQ_HEAD(named_csid_list, named_csid);
diff --git a/usr.bin/mkesdb/lex.l b/usr.bin/mkesdb/lex.l
new file mode 100644
index 0000000..c9d9cc1
--- /dev/null
+++ b/usr.bin/mkesdb/lex.l
@@ -0,0 +1,102 @@
+/* $FreeBSD$ */
+/* $NetBSD: lex.l,v 1.3 2006/02/09 22:03:15 dogcow Exp $ */
+
+%{
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * 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>
+#include <sys/endian.h>
+#include <sys/queue.h>
+#include <sys/types.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ldef.h"
+#include "yacc.h"
+
+#define YY_DECL int yylex(void)
+
+int linenumber = 1;
+%}
+%option noinput
+%option nounput
+
+%x COMMENT
+
+%%
+
+[ \t]+ { }
+#.*[\n]|"//".*[\n]|[\n] { linenumber++; return (R_LN); }
+
+"/*" { BEGIN COMMENT; }
+<COMMENT>"*/" { BEGIN 0; }
+<COMMENT>[\n] { linenumber++; }
+<COMMENT>. { }
+<COMMENT><<EOF>> {
+ yyerror("unexpected file end (unterminated comment)\n");
+ exit(1);
+ }
+
+([1-9][0-9]*)|(0[0-9]*)|(0[xX][0-9A-Fa-f]+) {
+ yylval.i_value = strtoul(yytext, NULL, 0);
+ return (L_IMM);
+ }
+
+"NAME" { return (R_NAME); }
+"ENCODING" { return (R_ENCODING); }
+"VARIABLE" { return (R_VARIABLE); }
+"DEFCSID" { return (R_DEFCSID); }
+"INVALID" { return (R_INVALID); }
+
+\"([^\"\n]*(\\\")?)*\"|\'([^\'\n]*(\\\')?)*\' {
+ size_t len;
+
+ len = strlen(yytext);
+ yylval.s_value = malloc(len - 1);
+ strlcpy(yylval.s_value, yytext + 1, len - 1);
+ return (L_STRING);
+ }
+[^ =/\-0-9\t\n][^ \t\n]* {
+ yylval.s_value = strdup(yytext);
+ return (L_STRING);
+ }
+
+%%
+
+#ifndef yywrap
+int
+yywrap(void)
+{
+
+ return (1);
+}
+#endif
diff --git a/usr.bin/mkesdb/mkesdb.1 b/usr.bin/mkesdb/mkesdb.1
new file mode 100644
index 0000000..a0743b6
--- /dev/null
+++ b/usr.bin/mkesdb/mkesdb.1
@@ -0,0 +1,84 @@
+.\" Copyright (c) 2009 Gabor Kovesdan <gabor@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.
+.\"
+.\" Portions of this text are reprinted and reproduced in electronic form
+.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
+.\" Portable Operating System Interface (POSIX), The Open Group Base
+.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
+.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
+.\" event of any discrepancy between this version and the original IEEE and
+.\" The Open Group Standard, the original IEEE and The Open Group Standard is
+.\" the referee document. The original Standard can be obtained online at
+.\" http://www.opengroup.org/unix/online.html.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 1, 2009
+.Dt MKESDB 1
+.Os
+.Sh NAME
+.Nm mkesdb
+.Nd generates conversion catalog for
+.Xr iconv 3
+.Sh SYNOPSIS
+.Nm
+.Op Fl md
+.Fl o
+.Ar outfile
+.Ar infile
+.Sh DESCRIPTION
+The
+.Nm
+utility generates conversion catalog for the
+.Xr iconv 3
+library.
+The generated data includes a list of supported encodings
+and their most important characteristics, like the pluggable
+module to use
+.Pp
+The following options are available:
+.Bl -tag -width 0123
+.It Fl d
+Turns on debug mode.
+.It Fl m
+Process directory catalog or alias file.
+If not specified, the input file is treated as an encoding description.
+.It Fl o Ar outfile
+Put generated binary data to
+.Ar outfile .
+.El
+.Sh EXIT STATUS
+.Ex -std mkesdb
+.Sh SEE ALSO
+.Xr iconv 1 ,
+.Xr mkcsmapper 1 ,
+.Xr iconv 3
+.Sh HISTORY
+.Nm
+first appeared in
+.Nx 2.0 , and made its appearance in
+.Fx 9.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/usr.bin/mkesdb/yacc.y b/usr.bin/mkesdb/yacc.y
new file mode 100644
index 0000000..6d77b15
--- /dev/null
+++ b/usr.bin/mkesdb/yacc.y
@@ -0,0 +1,332 @@
+/* $FreeBSD$ */
+/* $NetBSD: yacc.y,v 1.4 2005/06/02 02:09:25 lukem Exp $ */
+
+%{
+/*-
+ * Copyright (c)2003 Citrus Project,
+ * 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>
+#include <sys/types.h>
+#include <sys/queue.h>
+
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "citrus_namespace.h"
+#include "citrus_types.h"
+#include "citrus_region.h"
+#include "citrus_esdb_file.h"
+#include "citrus_db_hash.h"
+#include "citrus_db_factory.h"
+#include "citrus_lookup_factory.h"
+
+#include "ldef.h"
+
+extern FILE *yyin;
+
+static struct named_csid_list named_csids;
+static char *encoding, *name, *output = NULL, *variable;
+static u_int32_t invalid;
+static int debug = 0, num_csids = 0, use_invalid = 0;
+
+static void dump_file(void);
+static void register_named_csid(char *, u_int32_t);
+static void set_invalid(u_int32_t);
+static void set_prop_string(const char *, char **, char **);
+%}
+%union {
+ u_int32_t i_value;
+ char *s_value;
+}
+
+%token R_NAME R_ENCODING R_VARIABLE R_DEFCSID R_INVALID
+%token R_LN
+%token <i_value> L_IMM
+%token <s_value> L_STRING
+
+%%
+
+file : property
+ { dump_file(); }
+
+property : /* empty */
+ | property R_LN
+ | property name R_LN
+ | property encoding R_LN
+ | property variable R_LN
+ | property defcsid R_LN
+ | property invalid R_LN
+
+name : R_NAME L_STRING
+ {
+ set_prop_string("NAME", &name, &$2);
+ }
+
+encoding : R_ENCODING L_STRING
+ {
+ set_prop_string("ENCODING", &encoding, &$2);
+ }
+variable : R_VARIABLE L_STRING
+ {
+ set_prop_string("VARIABLE", &variable, &$2);
+ }
+defcsid : R_DEFCSID L_STRING L_IMM
+ {
+ register_named_csid($2, $3);
+ $2 = NULL;
+ }
+invalid : R_INVALID L_IMM
+ {
+ set_invalid($2);
+ }
+%%
+
+int
+yyerror(const char *s)
+{
+
+ fprintf(stderr, "%s in %d\n", s, linenumber);
+
+ return (0);
+}
+
+#define CHKERR(ret, func, a) \
+do { \
+ ret = func a; \
+ if (ret) \
+ errx(EXIT_FAILURE, "%s: %s", #func, strerror(ret)); \
+} while (/*CONSTCOND*/0)
+static void
+dump_file(void)
+{
+ struct _db_factory *df;
+ struct _region data;
+ struct named_csid *csid;
+ FILE *fp;
+ char buf[100];
+ void *serialized;
+ size_t size;
+ int i, ret;
+
+ ret = 0;
+ if (!name) {
+ fprintf(stderr, "NAME is mandatory.\n");
+ ret = 1;
+ }
+ if (!encoding) {
+ fprintf(stderr, "ENCODING is mandatory.\n");
+ ret = 1;
+ }
+ if (ret)
+ exit(1);
+
+ /*
+ * build database
+ */
+ CHKERR(ret, _db_factory_create, (&df, _db_hash_std, NULL));
+
+ /* store version */
+ CHKERR(ret, _db_factory_add32_by_s, (df, _CITRUS_ESDB_SYM_VERSION,
+ _CITRUS_ESDB_VERSION));
+
+ /* store encoding */
+ CHKERR(ret, _db_factory_addstr_by_s, (df, _CITRUS_ESDB_SYM_ENCODING,
+ encoding));
+
+ /* store variable */
+ if (variable)
+ CHKERR(ret, _db_factory_addstr_by_s,
+ (df, _CITRUS_ESDB_SYM_VARIABLE, variable));
+
+ /* store invalid */
+ if (use_invalid)
+ CHKERR(ret, _db_factory_add32_by_s, (df,
+ _CITRUS_ESDB_SYM_INVALID, invalid));
+
+ /* store num of charsets */
+ CHKERR(ret, _db_factory_add32_by_s, (df, _CITRUS_ESDB_SYM_NUM_CHARSETS,
+ num_csids));
+ i = 0;
+ STAILQ_FOREACH(csid, &named_csids, ci_entry) {
+ snprintf(buf, sizeof(buf), _CITRUS_ESDB_SYM_CSNAME_PREFIX "%d",
+ i);
+ CHKERR(ret, _db_factory_addstr_by_s,
+ (df, buf, csid->ci_symbol));
+ snprintf(buf, sizeof(buf), _CITRUS_ESDB_SYM_CSID_PREFIX "%d",
+ i);
+ CHKERR(ret, _db_factory_add32_by_s, (df, buf, csid->ci_csid));
+ i++;
+ }
+
+ /*
+ * dump database to file
+ */
+ fp = output ? fopen(output, "wb") : stdout;
+ if (fp == NULL) {
+ perror("fopen");
+ exit(1);
+ }
+
+ /* dump database body */
+ size = _db_factory_calc_size(df);
+ serialized = malloc(size);
+ _region_init(&data, serialized, size);
+ CHKERR(ret, _db_factory_serialize, (df, _CITRUS_ESDB_MAGIC, &data));
+ if (fwrite(serialized, size, 1, fp) != 1)
+ err(EXIT_FAILURE, "fwrite");
+
+ fclose(fp);
+}
+
+static void
+set_prop_string(const char *res, char **store, char **data)
+{
+ char buf[256];
+
+ if (*store) {
+ snprintf(buf, sizeof(buf),
+ "%s is duplicated. ignored the one", res);
+ yyerror(buf);
+ return;
+ }
+
+ *store = *data;
+ *data = NULL;
+}
+
+static void
+set_invalid(u_int32_t inv)
+{
+
+ invalid = inv;
+ use_invalid = 1;
+}
+
+static void
+register_named_csid(char *sym, u_int32_t val)
+{
+ struct named_csid *csid;
+
+ STAILQ_FOREACH(csid, &named_csids, ci_entry) {
+ if (strcmp(csid->ci_symbol, sym) == 0) {
+ yyerror("multiply defined CSID");
+ exit(1);
+ }
+ }
+
+ csid = malloc(sizeof(*csid));
+ if (csid == NULL) {
+ perror("malloc");
+ exit(1);
+ }
+ csid->ci_symbol = sym;
+ csid->ci_csid = val;
+ STAILQ_INSERT_TAIL(&named_csids, csid, ci_entry);
+ num_csids++;
+}
+
+static void
+do_mkdb(FILE *in)
+{
+ FILE *out;
+ int ret;
+
+ /* dump DB to file */
+ out = output ? fopen(output, "wb") : stdout;
+ if (out == NULL)
+ err(EXIT_FAILURE, "fopen");
+
+ ret = _lookup_factory_convert(out, in);
+ fclose(out);
+ if (ret && output)
+ unlink(output); /* dump failure */
+ if (ret)
+ errx(EXIT_FAILURE, "%s\n", strerror(ret));
+}
+
+static void
+usage(void)
+{
+ errx(EXIT_FAILURE,
+ "usage:\n"
+ "\t%s [-o outfile] [infile]\n"
+ "\t%s -m [-o outfile] [infile]",
+ getprogname(), getprogname());
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *in = NULL;
+ int ch, mkdb = 0;
+
+ while ((ch = getopt(argc, argv, "do:m")) != EOF) {
+ switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'o':
+ output = strdup(optarg);
+ break;
+ case 'm':
+ mkdb = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ switch (argc) {
+ case 0:
+ in = stdin;
+ break;
+ case 1:
+ in = fopen(argv[0], "r");
+ if (!in)
+ err(EXIT_FAILURE, "%s", argv[0]);
+ break;
+ default:
+ usage();
+ }
+
+ if (mkdb)
+ do_mkdb(in);
+ else {
+ STAILQ_INIT(&named_csids);
+ yyin = in;
+ yyparse();
+ }
+
+ return (0);
+}
diff --git a/usr.bin/mkesdb_static/Makefile b/usr.bin/mkesdb_static/Makefile
new file mode 100644
index 0000000..9ce0209
--- /dev/null
+++ b/usr.bin/mkesdb_static/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../lib/libc/iconv ${.CURDIR}/../mkesdb
+
+PROG= mkesdb_static
+SRCS= citrus_bcs.c citrus_db_factory.c citrus_db_hash.c \
+ citrus_lookup_factory.c
+MAN=
+NO_SHARED= yes
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+build-tools: mkesdb_static
+
+.include "${.CURDIR}/../mkesdb/Makefile.inc"
+.include <bsd.prog.mk>
+
+${PROG}: ${BUILD_TOOLS_META}
diff --git a/usr.bin/mkesdb_static/Makefile.depend b/usr.bin/mkesdb_static/Makefile.depend
new file mode 100644
index 0000000..75e2766
--- /dev/null
+++ b/usr.bin/mkesdb_static/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkfifo/Makefile b/usr.bin/mkfifo/Makefile
new file mode 100644
index 0000000..30f013e
--- /dev/null
+++ b/usr.bin/mkfifo/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= mkfifo
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkfifo/Makefile.depend b/usr.bin/mkfifo/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/mkfifo/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/mkfifo/mkfifo.1 b/usr.bin/mkfifo/mkfifo.1
new file mode 100644
index 0000000..7072713
--- /dev/null
+++ b/usr.bin/mkfifo/mkfifo.1
@@ -0,0 +1,98 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)mkfifo.1 8.2 (Berkeley) 1/5/94
+.\" $FreeBSD$
+.\"
+.Dd January 5, 1994
+.Dt MKFIFO 1
+.Os
+.Sh NAME
+.Nm mkfifo
+.Nd make fifos
+.Sh SYNOPSIS
+.Nm
+.Op Fl m Ar mode
+.Ar fifo_name ...
+.Sh DESCRIPTION
+The
+.Nm
+utility creates the fifos requested, in the order specified.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl m
+Set the file permission bits of the created fifos to the
+specified mode, ignoring the
+.Xr umask 2
+of the calling process.
+The
+.Ar mode
+argument takes any format that can be specified to the
+.Xr chmod 1
+command.
+If a symbolic mode is specified, the op symbols
+.Ql +
+(plus) and
+.Ql -
+(hyphen) are interpreted relative to an assumed initial mode of
+.Dq Li a=rw
+(read and write permissions for all).
+.El
+.Pp
+If the
+.Fl m
+option is not specified, fifos are created with mode
+.Li 0666
+modified by the
+.Xr umask 2
+of the calling process.
+The
+.Nm
+utility requires write permission in the parent directory.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr mkdir 1 ,
+.Xr rm 1 ,
+.Xr mkfifo 2 ,
+.Xr mknod 2 ,
+.Xr mknod 8
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compliant.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
diff --git a/usr.bin/mkfifo/mkfifo.c b/usr.bin/mkfifo/mkfifo.c
new file mode 100644
index 0000000..7c974bd
--- /dev/null
+++ b/usr.bin/mkfifo/mkfifo.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1990, 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) 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 1/5/94";
+#endif
+#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define BASEMODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | \
+ S_IROTH | S_IWOTH
+
+static void usage(void);
+
+static int f_mode;
+
+int
+main(int argc, char *argv[])
+{
+ const char *modestr = NULL;
+ const void *modep;
+ mode_t fifomode;
+ int ch, exitval;
+
+ while ((ch = getopt(argc, argv, "m:")) != -1)
+ switch(ch) {
+ case 'm':
+ f_mode = 1;
+ modestr = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+ if (argv[0] == NULL)
+ usage();
+
+ if (f_mode) {
+ umask(0);
+ errno = 0;
+ if ((modep = setmode(modestr)) == NULL) {
+ if (errno)
+ err(1, "setmode");
+ errx(1, "invalid file mode: %s", modestr);
+ }
+ fifomode = getmode(modep, BASEMODE);
+ } else {
+ fifomode = BASEMODE;
+ }
+
+ for (exitval = 0; *argv != NULL; ++argv)
+ if (mkfifo(*argv, fifomode) < 0) {
+ warn("%s", *argv);
+ exitval = 1;
+ }
+ exit(exitval);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: mkfifo [-m mode] fifo_name ...\n");
+ exit(1);
+}
diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile
new file mode 100644
index 0000000..6622fe4
--- /dev/null
+++ b/usr.bin/mkimg/Makefile
@@ -0,0 +1,42 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= mkimg
+SRCS= format.c image.c mkimg.c scheme.c
+MAN= mkimg.1
+
+MKIMG_VERSION=20151211
+mkimg.o: Makefile
+
+CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION}
+CFLAGS+=-DSPARSE_WRITE
+
+# List of formats to support
+SRCS+= \
+ qcow.c \
+ raw.c \
+ vhd.c \
+ vmdk.c
+
+# List of schemes to support
+SRCS+= \
+ apm.c \
+ bsd.c \
+ ebr.c \
+ gpt.c \
+ mbr.c \
+ pc98.c \
+ vtoc8.c
+
+BINDIR?=/usr/bin
+
+LIBADD= util
+
+WARNS?= 6
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkimg/Makefile.depend b/usr.bin/mkimg/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/mkimg/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkimg/apm.c b/usr.bin/mkimg/apm.c
new file mode 100644
index 0000000..de92cc0
--- /dev/null
+++ b/usr.bin/mkimg/apm.c
@@ -0,0 +1,123 @@
+/*-
+ * 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/apm.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#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
+
+static struct mkimg_alias apm_aliases[] = {
+ { ALIAS_FREEBSD, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD) },
+ { ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(APM_ENT_TYPE_APPLE_BOOT) },
+ { ALIAS_FREEBSD_NANDFS, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_NANDFS) },
+ { ALIAS_FREEBSD_SWAP, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_SWAP) },
+ { ALIAS_FREEBSD_UFS, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_UFS) },
+ { ALIAS_FREEBSD_VINUM, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_VINUM) },
+ { ALIAS_FREEBSD_ZFS, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD_ZFS) },
+ { ALIAS_NONE, 0 }
+};
+
+static lba_t
+apm_metadata(u_int where, lba_t blk)
+{
+
+ blk += (where == SCHEME_META_IMG_START) ? nparts + 2 : 0;
+ return (round_block(blk));
+}
+
+static int
+apm_write(lba_t imgsz, void *bootcode __unused)
+{
+ u_char *buf;
+ struct apm_ddr *ddr;
+ struct apm_ent *ent;
+ struct part *part;
+ int error;
+
+ buf = calloc(nparts + 2, secsz);
+ if (buf == NULL)
+ return (ENOMEM);
+ ddr = (void *)buf;
+ be16enc(&ddr->ddr_sig, APM_DDR_SIG);
+ be16enc(&ddr->ddr_blksize, secsz);
+ be32enc(&ddr->ddr_blkcount, imgsz);
+
+ /* partition entry for the partition table itself. */
+ ent = (void *)(buf + secsz);
+ be16enc(&ent->ent_sig, APM_ENT_SIG);
+ be32enc(&ent->ent_pmblkcnt, nparts + 1);
+ be32enc(&ent->ent_start, 1);
+ be32enc(&ent->ent_size, nparts + 1);
+ 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);
+ be16enc(&ent->ent_sig, APM_ENT_SIG);
+ be32enc(&ent->ent_pmblkcnt, nparts + 1);
+ be32enc(&ent->ent_start, part->block);
+ be32enc(&ent->ent_size, part->size);
+ strncpy(ent->ent_type, ALIAS_TYPE2PTR(part->type),
+ sizeof(ent->ent_type));
+ if (part->label != NULL)
+ strncpy(ent->ent_name, part->label,
+ sizeof(ent->ent_name));
+ }
+
+ error = image_write(0, buf, nparts + 2);
+ free(buf);
+ return (error);
+}
+
+static struct mkimg_scheme apm_scheme = {
+ .name = "apm",
+ .description = "Apple Partition Map",
+ .aliases = apm_aliases,
+ .metadata = apm_metadata,
+ .write = apm_write,
+ .nparts = 4096,
+ .labellen = APM_ENT_NAMELEN - 1,
+ .maxsecsz = 4096
+};
+
+SCHEME_DEFINE(apm_scheme);
diff --git a/usr.bin/mkimg/bsd.c b/usr.bin/mkimg/bsd.c
new file mode 100644
index 0000000..75e554f
--- /dev/null
+++ b/usr.bin/mkimg/bsd.c
@@ -0,0 +1,139 @@
+/*-
+ * 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/disklabel.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef FS_NANDFS
+#define FS_NANDFS 30
+#endif
+
+static struct mkimg_alias bsd_aliases[] = {
+ { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(FS_NANDFS) },
+ { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(FS_SWAP) },
+ { ALIAS_FREEBSD_UFS, ALIAS_INT2TYPE(FS_BSDFFS) },
+ { ALIAS_FREEBSD_VINUM, ALIAS_INT2TYPE(FS_VINUM) },
+ { ALIAS_FREEBSD_ZFS, ALIAS_INT2TYPE(FS_ZFS) },
+ { ALIAS_NONE, 0 }
+};
+
+static lba_t
+bsd_metadata(u_int where, lba_t blk)
+{
+
+ if (where == SCHEME_META_IMG_START)
+ blk += BBSIZE / secsz;
+ else if (where == SCHEME_META_IMG_END)
+ blk = round_cylinder(blk);
+ else
+ blk = round_block(blk);
+ return (blk);
+}
+
+static int
+bsd_write(lba_t imgsz, void *bootcode)
+{
+ u_char *buf, *p;
+ struct disklabel *d;
+ struct partition *dp;
+ struct part *part;
+ int bsdparts, error, n;
+ uint16_t checksum;
+
+ buf = malloc(BBSIZE);
+ if (buf == NULL)
+ return (ENOMEM);
+ if (bootcode != NULL) {
+ memcpy(buf, bootcode, BBSIZE);
+ memset(buf + secsz, 0, sizeof(struct disklabel));
+ } else
+ memset(buf, 0, BBSIZE);
+
+ bsdparts = nparts + 1; /* Account for c partition */
+ if (bsdparts < MAXPARTITIONS)
+ bsdparts = MAXPARTITIONS;
+
+ d = (void *)(buf + secsz);
+ le32enc(&d->d_magic, DISKMAGIC);
+ le32enc(&d->d_secsize, secsz);
+ le32enc(&d->d_nsectors, nsecs);
+ le32enc(&d->d_ntracks, nheads);
+ le32enc(&d->d_ncylinders, ncyls);
+ le32enc(&d->d_secpercyl, nsecs * nheads);
+ le32enc(&d->d_secperunit, imgsz);
+ le16enc(&d->d_rpm, 3600);
+ le32enc(&d->d_magic2, DISKMAGIC);
+ le16enc(&d->d_npartitions, bsdparts);
+ le32enc(&d->d_bbsize, BBSIZE);
+
+ dp = &d->d_partitions[RAW_PART];
+ le32enc(&dp->p_size, imgsz);
+ STAILQ_FOREACH(part, &partlist, link) {
+ n = part->index + ((part->index >= RAW_PART) ? 1 : 0);
+ dp = &d->d_partitions[n];
+ le32enc(&dp->p_size, part->size);
+ le32enc(&dp->p_offset, part->block);
+ le32enc(&dp->p_fsize, 0);
+ dp->p_fstype = ALIAS_TYPE2INT(part->type);
+ dp->p_frag = 0;
+ le16enc(&dp->p_cpg, 0);
+ }
+
+ dp = &d->d_partitions[bsdparts];
+ checksum = 0;
+ for (p = (void *)d; p < (u_char *)dp; p += 2)
+ checksum ^= le16dec(p);
+ le16enc(&d->d_checksum, checksum);
+
+ error = image_write(0, buf, BBSIZE / secsz);
+ free(buf);
+ return (error);
+}
+
+static struct mkimg_scheme bsd_scheme = {
+ .name = "bsd",
+ .description = "BSD disk label",
+ .aliases = bsd_aliases,
+ .metadata = bsd_metadata,
+ .write = bsd_write,
+ .nparts = 19,
+ .bootcode = BBSIZE,
+ .maxsecsz = 512
+};
+
+SCHEME_DEFINE(bsd_scheme);
diff --git a/usr.bin/mkimg/ebr.c b/usr.bin/mkimg/ebr.c
new file mode 100644
index 0000000..526c494
--- /dev/null
+++ b/usr.bin/mkimg/ebr.c
@@ -0,0 +1,136 @@
+/*-
+ * 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/diskmbr.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef DOSPTYP_FAT16B
+#define DOSPTYP_FAT16B 0x06
+#endif
+#ifndef DOSPTYP_FAT32
+#define DOSPTYP_FAT32 0x0b
+#endif
+
+static struct mkimg_alias ebr_aliases[] = {
+ { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) },
+ { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) },
+ { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) },
+ { ALIAS_NONE, 0 }
+};
+
+static lba_t
+ebr_metadata(u_int where, lba_t blk)
+{
+
+ blk += (where == SCHEME_META_PART_BEFORE) ? 1 : 0;
+ return (round_track(blk));
+}
+
+static void
+ebr_chs(u_char *cylp, u_char *hdp, u_char *secp, lba_t lba)
+{
+ u_int cyl, hd, sec;
+
+ mkimg_chs(lba, 1023, &cyl, &hd, &sec);
+ *cylp = cyl;
+ *hdp = hd;
+ *secp = (sec & 0x3f) | ((cyl >> 2) & 0xc0);
+}
+
+static int
+ebr_write(lba_t imgsz __unused, void *bootcode __unused)
+{
+ u_char *ebr;
+ struct dos_partition *dp;
+ struct part *part, *next;
+ lba_t block, size;
+ int error;
+
+ ebr = malloc(secsz);
+ if (ebr == NULL)
+ return (ENOMEM);
+ memset(ebr, 0, secsz);
+ le16enc(ebr + DOSMAGICOFFSET, DOSMAGIC);
+
+ error = 0;
+ STAILQ_FOREACH_SAFE(part, &partlist, link, next) {
+ block = part->block - nsecs;
+ size = round_track(part->size);
+ dp = (void *)(ebr + DOSPARTOFF);
+ ebr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, nsecs);
+ dp->dp_typ = ALIAS_TYPE2INT(part->type);
+ ebr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
+ part->block + size - 1);
+ le32enc(&dp->dp_start, nsecs);
+ le32enc(&dp->dp_size, size);
+
+ /* Add link entry */
+ if (next != NULL) {
+ size = round_track(next->size);
+ dp++;
+ ebr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
+ next->block - nsecs);
+ dp->dp_typ = DOSPTYP_EXT;
+ ebr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
+ next->block + size - 1);
+ le32enc(&dp->dp_start, next->block - nsecs);
+ le32enc(&dp->dp_size, size + nsecs);
+ }
+
+ error = image_write(block, ebr, 1);
+ if (error)
+ break;
+
+ memset(ebr + DOSPARTOFF, 0, 2 * DOSPARTSIZE);
+ }
+
+ free(ebr);
+ return (error);
+}
+
+static struct mkimg_scheme ebr_scheme = {
+ .name = "ebr",
+ .description = "Extended Boot Record",
+ .aliases = ebr_aliases,
+ .metadata = ebr_metadata,
+ .write = ebr_write,
+ .nparts = 4096,
+ .maxsecsz = 4096
+};
+
+SCHEME_DEFINE(ebr_scheme);
diff --git a/usr.bin/mkimg/format.c b/usr.bin/mkimg/format.c
new file mode 100644
index 0000000..a21b08a
--- /dev/null
+++ b/usr.bin/mkimg/format.c
@@ -0,0 +1,87 @@
+/*-
+ * 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)
+{
+ int error;
+
+ if (format == NULL)
+ return (ENOSYS);
+ 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
new file mode 100644
index 0000000..678e636
--- /dev/null
+++ b/usr.bin/mkimg/gpt.c
@@ -0,0 +1,310 @@
+/*-
+ * 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/diskmbr.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <sys/gpt.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <uuid.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef GPT_ENT_TYPE_FREEBSD_NANDFS
+#define GPT_ENT_TYPE_FREEBSD_NANDFS \
+ {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}}
+#endif
+
+static uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI;
+static uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
+static uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
+static uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS;
+static uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+static uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+static uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
+static uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
+static uuid_t gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
+static uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
+
+static struct mkimg_alias gpt_aliases[] = {
+ { ALIAS_EFI, ALIAS_PTR2TYPE(&gpt_uuid_efi) },
+ { ALIAS_FREEBSD, ALIAS_PTR2TYPE(&gpt_uuid_freebsd) },
+ { ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_boot) },
+ { ALIAS_FREEBSD_NANDFS, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_nandfs) },
+ { ALIAS_FREEBSD_SWAP, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_swap) },
+ { ALIAS_FREEBSD_UFS, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_ufs) },
+ { ALIAS_FREEBSD_VINUM, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_vinum) },
+ { ALIAS_FREEBSD_ZFS, ALIAS_PTR2TYPE(&gpt_uuid_freebsd_zfs) },
+ { ALIAS_MBR, ALIAS_PTR2TYPE(&gpt_uuid_mbr) },
+ { ALIAS_NTFS, ALIAS_PTR2TYPE(&gpt_uuid_ms_basic_data) },
+ { ALIAS_NONE, 0 } /* Keep last! */
+};
+
+/* CRC32 code derived from work by Gary S. Brown. */
+static const uint32_t crc32_tab[] = {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+ 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+ 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
+ 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+ 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+ 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+ 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+ 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+ 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+ 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+ 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+ 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
+ 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+ 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
+ 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
+ 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
+ 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+ 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+};
+
+static uint32_t
+crc32(const void *buf, size_t sz)
+{
+ const uint8_t *p = (const uint8_t *)buf;
+ uint32_t crc = ~0U;
+
+ while (sz--)
+ crc = crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8);
+ return (crc ^ ~0U);
+}
+
+static void
+gpt_uuid_enc(void *buf, const uuid_t *uuid)
+{
+ uint8_t *p = buf;
+ int i;
+
+ le32enc(p, uuid->time_low);
+ le16enc(p + 4, uuid->time_mid);
+ le16enc(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 u_int
+gpt_tblsz(void)
+{
+ u_int ents;
+
+ ents = secsz / sizeof(struct gpt_ent);
+ return ((nparts + ents - 1) / ents);
+}
+
+static lba_t
+gpt_metadata(u_int where, lba_t blk)
+{
+
+ if (where == SCHEME_META_IMG_START || where == SCHEME_META_IMG_END) {
+ blk += gpt_tblsz();
+ blk += (where == SCHEME_META_IMG_START) ? 2 : 1;
+ }
+ return (round_block(blk));
+}
+
+static int
+gpt_write_pmbr(lba_t blks, void *bootcode)
+{
+ u_char *pmbr;
+ uint32_t secs;
+ int error;
+
+ secs = (blks > UINT32_MAX) ? UINT32_MAX : (uint32_t)blks;
+
+ pmbr = malloc(secsz);
+ if (pmbr == NULL)
+ return (errno);
+ if (bootcode != NULL) {
+ memcpy(pmbr, bootcode, DOSPARTOFF);
+ memset(pmbr + DOSPARTOFF, 0, secsz - DOSPARTOFF);
+ } else
+ memset(pmbr, 0, secsz);
+ pmbr[DOSPARTOFF + 2] = 2;
+ pmbr[DOSPARTOFF + 4] = 0xee;
+ pmbr[DOSPARTOFF + 5] = 0xff;
+ pmbr[DOSPARTOFF + 6] = 0xff;
+ pmbr[DOSPARTOFF + 7] = 0xff;
+ le32enc(pmbr + DOSPARTOFF + 8, 1);
+ le32enc(pmbr + DOSPARTOFF + 12, secs);
+ le16enc(pmbr + DOSMAGICOFFSET, DOSMAGIC);
+ error = image_write(0, pmbr, 1);
+ free(pmbr);
+ return (error);
+}
+
+static struct gpt_ent *
+gpt_mktbl(u_int tblsz)
+{
+ uuid_t uuid;
+ struct gpt_ent *tbl, *ent;
+ struct part *part;
+ int c, idx;
+
+ tbl = calloc(tblsz, secsz);
+ if (tbl == NULL)
+ return (NULL);
+
+ STAILQ_FOREACH(part, &partlist, link) {
+ ent = tbl + part->index;
+ gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type));
+ 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);
+ if (part->label != NULL) {
+ idx = 0;
+ while ((c = part->label[idx]) != '\0') {
+ le16enc(ent->ent_name + idx, c);
+ idx++;
+ }
+ }
+ }
+ return (tbl);
+}
+
+static int
+gpt_write_hdr(struct gpt_hdr *hdr, uint64_t self, uint64_t alt, uint64_t tbl)
+{
+ uint32_t crc;
+
+ le64enc(&hdr->hdr_lba_self, self);
+ le64enc(&hdr->hdr_lba_alt, alt);
+ le64enc(&hdr->hdr_lba_table, tbl);
+ hdr->hdr_crc_self = 0;
+ crc = crc32(hdr, offsetof(struct gpt_hdr, padding));
+ le64enc(&hdr->hdr_crc_self, crc);
+ return (image_write(self, hdr, 1));
+}
+
+static int
+gpt_write(lba_t imgsz, void *bootcode)
+{
+ uuid_t uuid;
+ struct gpt_ent *tbl;
+ struct gpt_hdr *hdr;
+ uint32_t crc;
+ u_int tblsz;
+ int error;
+
+ /* PMBR */
+ error = gpt_write_pmbr(imgsz, bootcode);
+ if (error)
+ return (error);
+
+ /* GPT table(s) */
+ tblsz = gpt_tblsz();
+ tbl = gpt_mktbl(tblsz);
+ if (tbl == NULL)
+ return (errno);
+ error = image_write(2, tbl, tblsz);
+ if (error)
+ goto out;
+ error = image_write(imgsz - (tblsz + 1), tbl, tblsz);
+ if (error)
+ goto out;
+
+ /* GPT header(s) */
+ hdr = malloc(secsz);
+ if (hdr == NULL) {
+ error = errno;
+ goto out;
+ }
+ memset(hdr, 0, secsz);
+ memcpy(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig));
+ le32enc(&hdr->hdr_revision, GPT_HDR_REVISION);
+ le32enc(&hdr->hdr_size, offsetof(struct gpt_hdr, padding));
+ le64enc(&hdr->hdr_lba_start, 2 + tblsz);
+ le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2);
+ 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(hdr, 1, imgsz - 1, 2);
+ if (!error)
+ error = gpt_write_hdr(hdr, imgsz - 1, 1, imgsz - tblsz - 1);
+ free(hdr);
+
+ out:
+ free(tbl);
+ return (error);
+}
+
+static struct mkimg_scheme gpt_scheme = {
+ .name = "gpt",
+ .description = "GUID Partition Table",
+ .aliases = gpt_aliases,
+ .metadata = gpt_metadata,
+ .write = gpt_write,
+ .nparts = 4096,
+ .labellen = 36,
+ .bootcode = 512,
+ .maxsecsz = 4096
+};
+
+SCHEME_DEFINE(gpt_scheme);
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c
new file mode 100644
index 0000000..2527f28
--- /dev/null
+++ b/usr.bin/mkimg/image.c
@@ -0,0 +1,727 @@
+/*-
+ * 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/mman.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+
+struct chunk {
+ STAILQ_ENTRY(chunk) ch_list;
+ size_t ch_size; /* Size of chunk in bytes. */
+ lba_t ch_block; /* Block address in image. */
+ union {
+ struct {
+ off_t ofs; /* Offset in backing file. */
+ int fd; /* FD of backing file. */
+ } file;
+ struct {
+ void *ptr; /* Pointer to data in memory */
+ } mem;
+ } ch_u;
+ u_int ch_type;
+#define CH_TYPE_ZEROES 0 /* Chunk is a gap (no data). */
+#define CH_TYPE_FILE 1 /* File-backed chunk. */
+#define CH_TYPE_MEMORY 2 /* Memory-backed chunk */
+};
+
+static STAILQ_HEAD(chunk_head, chunk) image_chunks;
+static u_int image_nchunks;
+
+static char image_swap_file[PATH_MAX];
+static int image_swap_fd = -1;
+static u_int image_swap_pgsz;
+static off_t image_swap_size;
+
+static lba_t image_size;
+
+static int
+is_empty_sector(void *buf)
+{
+ uint64_t *p = buf;
+ size_t n, max;
+
+ assert(((uintptr_t)p & 3) == 0);
+
+ max = secsz / sizeof(uint64_t);
+ for (n = 0; n < max; n++) {
+ if (p[n] != 0UL)
+ return (0);
+ }
+ return (1);
+}
+
+/*
+ * Swap file handlng.
+ */
+
+static off_t
+image_swap_alloc(size_t size)
+{
+ off_t ofs;
+ size_t unit;
+
+ unit = (secsz > image_swap_pgsz) ? secsz : image_swap_pgsz;
+ assert((unit & (unit - 1)) == 0);
+
+ size = (size + unit - 1) & ~(unit - 1);
+
+ ofs = image_swap_size;
+ image_swap_size += size;
+ if (ftruncate(image_swap_fd, image_swap_size) == -1) {
+ image_swap_size = ofs;
+ ofs = -1LL;
+ }
+ return (ofs);
+}
+
+/*
+ * Image chunk handling.
+ */
+
+static struct chunk *
+image_chunk_find(lba_t blk)
+{
+ static struct chunk *last = NULL;
+ struct chunk *ch;
+
+ ch = (last != NULL && last->ch_block <= blk)
+ ? last : STAILQ_FIRST(&image_chunks);
+ while (ch != NULL) {
+ if (ch->ch_block <= blk &&
+ (lba_t)(ch->ch_block + (ch->ch_size / secsz)) > blk) {
+ last = ch;
+ break;
+ }
+ ch = STAILQ_NEXT(ch, ch_list);
+ }
+ return (ch);
+}
+
+static size_t
+image_chunk_grow(struct chunk *ch, size_t sz)
+{
+ size_t dsz, newsz;
+
+ newsz = ch->ch_size + sz;
+ if (newsz > ch->ch_size) {
+ ch->ch_size = newsz;
+ return (0);
+ }
+ /* We would overflow -- create new chunk for remainder. */
+ dsz = SIZE_MAX - ch->ch_size;
+ assert(dsz < sz);
+ ch->ch_size = SIZE_MAX;
+ return (sz - dsz);
+}
+
+static struct chunk *
+image_chunk_memory(struct chunk *ch, lba_t blk)
+{
+ struct chunk *new;
+ void *ptr;
+
+ ptr = calloc(1, secsz);
+ if (ptr == NULL)
+ return (NULL);
+
+ if (ch->ch_block < blk) {
+ new = malloc(sizeof(*new));
+ if (new == NULL) {
+ free(ptr);
+ return (NULL);
+ }
+ memcpy(new, ch, sizeof(*new));
+ ch->ch_size = (blk - ch->ch_block) * secsz;
+ new->ch_block = blk;
+ new->ch_size -= ch->ch_size;
+ STAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
+ image_nchunks++;
+ ch = new;
+ }
+
+ if (ch->ch_size > secsz) {
+ new = malloc(sizeof(*new));
+ if (new == NULL) {
+ free(ptr);
+ return (NULL);
+ }
+ memcpy(new, ch, sizeof(*new));
+ ch->ch_size = secsz;
+ new->ch_block++;
+ new->ch_size -= secsz;
+ STAILQ_INSERT_AFTER(&image_chunks, ch, new, ch_list);
+ image_nchunks++;
+ }
+
+ ch->ch_type = CH_TYPE_MEMORY;
+ ch->ch_u.mem.ptr = ptr;
+ return (ch);
+}
+
+static int
+image_chunk_skipto(lba_t to)
+{
+ struct chunk *ch;
+ lba_t from;
+ size_t sz;
+
+ ch = STAILQ_LAST(&image_chunks, chunk, ch_list);
+ from = (ch != NULL) ? ch->ch_block + (ch->ch_size / secsz) : 0LL;
+
+ assert(from <= to);
+
+ /* Nothing to do? */
+ if (from == to)
+ return (0);
+ /* Avoid bugs due to overflows. */
+ if ((uintmax_t)(to - from) > (uintmax_t)(SIZE_MAX / secsz))
+ return (EFBIG);
+ sz = (to - from) * secsz;
+ if (ch != NULL && ch->ch_type == CH_TYPE_ZEROES) {
+ sz = image_chunk_grow(ch, sz);
+ if (sz == 0)
+ return (0);
+ from = ch->ch_block + (ch->ch_size / secsz);
+ }
+ ch = malloc(sizeof(*ch));
+ if (ch == NULL)
+ return (ENOMEM);
+ memset(ch, 0, sizeof(*ch));
+ ch->ch_block = from;
+ ch->ch_size = sz;
+ ch->ch_type = CH_TYPE_ZEROES;
+ STAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
+ image_nchunks++;
+ return (0);
+}
+
+static int
+image_chunk_append(lba_t blk, size_t sz, off_t ofs, int fd)
+{
+ struct chunk *ch;
+
+ ch = STAILQ_LAST(&image_chunks, chunk, ch_list);
+ if (ch != NULL && ch->ch_type == CH_TYPE_FILE) {
+ if (fd == ch->ch_u.file.fd &&
+ blk == (lba_t)(ch->ch_block + (ch->ch_size / secsz)) &&
+ ofs == (off_t)(ch->ch_u.file.ofs + ch->ch_size)) {
+ sz = image_chunk_grow(ch, sz);
+ if (sz == 0)
+ return (0);
+ blk = ch->ch_block + (ch->ch_size / secsz);
+ ofs = ch->ch_u.file.ofs + ch->ch_size;
+ }
+ }
+ ch = malloc(sizeof(*ch));
+ if (ch == NULL)
+ return (ENOMEM);
+ memset(ch, 0, sizeof(*ch));
+ ch->ch_block = blk;
+ ch->ch_size = sz;
+ ch->ch_type = CH_TYPE_FILE;
+ ch->ch_u.file.ofs = ofs;
+ ch->ch_u.file.fd = fd;
+ STAILQ_INSERT_TAIL(&image_chunks, ch, ch_list);
+ image_nchunks++;
+ return (0);
+}
+
+static int
+image_chunk_copyin(lba_t blk, void *buf, size_t sz, off_t ofs, int fd)
+{
+ uint8_t *p = buf;
+ int error;
+
+ error = 0;
+ sz = (sz + secsz - 1) & ~(secsz - 1);
+ while (!error && sz > 0) {
+ if (is_empty_sector(p))
+ error = image_chunk_skipto(blk + 1);
+ else
+ error = image_chunk_append(blk, secsz, ofs, fd);
+ blk++;
+ p += secsz;
+ sz -= secsz;
+ ofs += secsz;
+ }
+ return (error);
+}
+
+/*
+ * File mapping support.
+ */
+
+static void *
+image_file_map(int fd, off_t ofs, size_t sz)
+{
+ void *ptr;
+ size_t unit;
+ int flags, prot;
+
+ unit = (secsz > image_swap_pgsz) ? secsz : image_swap_pgsz;
+ assert((unit & (unit - 1)) == 0);
+
+ flags = MAP_NOCORE | MAP_NOSYNC | MAP_SHARED;
+ /* Allow writing to our swap file only. */
+ prot = PROT_READ | ((fd == image_swap_fd) ? PROT_WRITE : 0);
+ sz = (sz + unit - 1) & ~(unit - 1);
+ ptr = mmap(NULL, sz, prot, flags, fd, ofs);
+ return ((ptr == MAP_FAILED) ? NULL : ptr);
+}
+
+static int
+image_file_unmap(void *buffer, size_t sz)
+{
+ size_t unit;
+
+ unit = (secsz > image_swap_pgsz) ? secsz : image_swap_pgsz;
+ sz = (sz + unit - 1) & ~(unit - 1);
+ if (madvise(buffer, sz, MADV_DONTNEED) != 0)
+ warn("madvise");
+ munmap(buffer, sz);
+ return (0);
+}
+
+/*
+ * Input/source file handling.
+ */
+
+static int
+image_copyin_stream(lba_t blk, int fd, uint64_t *sizep)
+{
+ char *buffer;
+ uint64_t bytesize;
+ off_t swofs;
+ size_t iosz;
+ ssize_t rdsz;
+ int error;
+
+ /*
+ * This makes sure we're doing I/O in multiples of the page
+ * size as well as of the sector size. 2MB is the minimum
+ * by virtue of secsz at least 512 bytes and the page size
+ * at least 4K bytes.
+ */
+ iosz = secsz * image_swap_pgsz;
+
+ bytesize = 0;
+ do {
+ swofs = image_swap_alloc(iosz);
+ if (swofs == -1LL)
+ return (errno);
+ buffer = image_file_map(image_swap_fd, swofs, iosz);
+ if (buffer == NULL)
+ return (errno);
+ rdsz = read(fd, buffer, iosz);
+ if (rdsz > 0)
+ error = image_chunk_copyin(blk, buffer, rdsz, swofs,
+ image_swap_fd);
+ else if (rdsz < 0)
+ error = errno;
+ else
+ error = 0;
+ image_file_unmap(buffer, iosz);
+ /* XXX should we relinguish unused swap space? */
+ if (error)
+ return (error);
+
+ bytesize += rdsz;
+ blk += (rdsz + secsz - 1) / secsz;
+ } while (rdsz > 0);
+
+ if (sizep != NULL)
+ *sizep = bytesize;
+ return (0);
+}
+
+static int
+image_copyin_mapped(lba_t blk, int fd, uint64_t *sizep)
+{
+ off_t cur, data, end, hole, pos;
+ void *buf;
+ uint64_t bytesize;
+ size_t iosz, sz;
+ int error;
+
+ /*
+ * We'd like to know the size of the file and we must
+ * be able to seek in order to mmap(2). If this isn't
+ * possible, then treat the file as a stream/pipe.
+ */
+ end = lseek(fd, 0L, SEEK_END);
+ if (end == -1L)
+ return (image_copyin_stream(blk, fd, sizep));
+
+ /*
+ * We need the file opened for the duration and our
+ * caller is going to close the file. Make a dup(2)
+ * so that control the faith of the descriptor.
+ */
+ fd = dup(fd);
+ if (fd == -1)
+ return (errno);
+
+ iosz = secsz * image_swap_pgsz;
+
+ bytesize = 0;
+ cur = pos = 0;
+ error = 0;
+ while (!error && cur < end) {
+ hole = lseek(fd, cur, SEEK_HOLE);
+ if (hole == -1)
+ hole = end;
+ data = lseek(fd, cur, SEEK_DATA);
+ if (data == -1)
+ data = end;
+
+ /*
+ * Treat the entire file as data if sparse files
+ * are not supported by the underlying file system.
+ */
+ if (hole == end && data == end)
+ data = cur;
+
+ if (cur == hole && data > hole) {
+ hole = pos;
+ pos = data & ~((uint64_t)secsz - 1);
+
+ blk += (pos - hole) / secsz;
+ error = image_chunk_skipto(blk);
+
+ bytesize += pos - hole;
+ cur = data;
+ } else if (cur == data && hole > data) {
+ data = pos;
+ pos = (hole + secsz - 1) & ~((uint64_t)secsz - 1);
+
+ while (data < pos) {
+ sz = (pos - data > (off_t)iosz)
+ ? iosz : (size_t)(pos - data);
+
+ buf = image_file_map(fd, data, sz);
+ if (buf != NULL) {
+ error = image_chunk_copyin(blk, buf,
+ sz, data, fd);
+ image_file_unmap(buf, sz);
+ } else
+ error = errno;
+
+ blk += sz / secsz;
+ bytesize += sz;
+ data += sz;
+ }
+ cur = hole;
+ } else {
+ /*
+ * I don't know what this means or whether it
+ * can happen at all...
+ */
+ error = EDOOFUS;
+ break;
+ }
+ }
+ if (error)
+ close(fd);
+ if (!error && sizep != NULL)
+ *sizep = bytesize;
+ return (error);
+}
+
+int
+image_copyin(lba_t blk, int fd, uint64_t *sizep)
+{
+ struct stat sb;
+ int error;
+
+ error = image_chunk_skipto(blk);
+ if (!error) {
+ if (fstat(fd, &sb) == -1 || !S_ISREG(sb.st_mode))
+ error = image_copyin_stream(blk, fd, sizep);
+ else
+ error = image_copyin_mapped(blk, fd, sizep);
+ }
+ return (error);
+}
+
+/*
+ * Output/sink file handling.
+ */
+
+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);
+}
+
+static int
+image_copyout_memory(int fd, size_t size, void *ptr)
+{
+
+ if (write(fd, ptr, size) == -1)
+ return (errno);
+ return (0);
+}
+
+int
+image_copyout_zeroes(int fd, size_t count)
+{
+ static uint8_t *zeroes = NULL;
+ size_t sz;
+ int error;
+
+ if (lseek(fd, (off_t)count, SEEK_CUR) != -1)
+ return (0);
+
+ /*
+ * If we can't seek, we must write.
+ */
+
+ if (zeroes == NULL) {
+ zeroes = calloc(1, secsz);
+ if (zeroes == NULL)
+ return (ENOMEM);
+ }
+
+ while (count > 0) {
+ sz = (count > secsz) ? secsz : count;
+ error = image_copyout_memory(fd, sz, zeroes);
+ if (error)
+ return (error);
+ count -= sz;
+ }
+ return (0);
+}
+
+static int
+image_copyout_file(int fd, size_t size, int ifd, off_t iofs)
+{
+ void *buf;
+ size_t iosz, sz;
+ int error;
+
+ iosz = secsz * image_swap_pgsz;
+
+ while (size > 0) {
+ sz = (size > iosz) ? iosz : size;
+ buf = image_file_map(ifd, iofs, sz);
+ if (buf == NULL)
+ return (errno);
+ error = image_copyout_memory(fd, sz, buf);
+ image_file_unmap(buf, sz);
+ if (error)
+ return (error);
+ size -= sz;
+ iofs += sz;
+ }
+ return (0);
+}
+
+int
+image_copyout_region(int fd, lba_t blk, lba_t size)
+{
+ struct chunk *ch;
+ size_t ofs, sz;
+ int error;
+
+ size *= secsz;
+
+ while (size > 0) {
+ ch = image_chunk_find(blk);
+ if (ch == NULL)
+ return (EINVAL);
+ ofs = (blk - ch->ch_block) * secsz;
+ sz = ch->ch_size - ofs;
+ sz = ((lba_t)sz < size) ? sz : (size_t)size;
+ switch (ch->ch_type) {
+ case CH_TYPE_ZEROES:
+ error = image_copyout_zeroes(fd, sz);
+ break;
+ case CH_TYPE_FILE:
+ error = image_copyout_file(fd, sz, ch->ch_u.file.fd,
+ ch->ch_u.file.ofs + ofs);
+ break;
+ case CH_TYPE_MEMORY:
+ error = image_copyout_memory(fd, sz, ch->ch_u.mem.ptr);
+ break;
+ default:
+ return (EDOOFUS);
+ }
+ size -= sz;
+ blk += sz / secsz;
+ }
+ return (0);
+}
+
+int
+image_data(lba_t blk, lba_t size)
+{
+ struct chunk *ch;
+ lba_t lim;
+
+ while (1) {
+ ch = image_chunk_find(blk);
+ if (ch == NULL)
+ return (0);
+ if (ch->ch_type != CH_TYPE_ZEROES)
+ return (1);
+ lim = ch->ch_block + (ch->ch_size / secsz);
+ if (lim >= blk + size)
+ return (0);
+ size -= lim - blk;
+ blk = lim;
+ }
+ /*NOTREACHED*/
+}
+
+lba_t
+image_get_size(void)
+{
+
+ return (image_size);
+}
+
+int
+image_set_size(lba_t blk)
+{
+ int error;
+
+ error = image_chunk_skipto(blk);
+ if (!error)
+ image_size = blk;
+ return (error);
+}
+
+int
+image_write(lba_t blk, void *buf, ssize_t len)
+{
+ struct chunk *ch;
+
+ while (len > 0) {
+ if (!is_empty_sector(buf)) {
+ ch = image_chunk_find(blk);
+ if (ch == NULL)
+ return (ENXIO);
+ /* We may not be able to write to files. */
+ if (ch->ch_type == CH_TYPE_FILE)
+ return (EINVAL);
+ if (ch->ch_type == CH_TYPE_ZEROES) {
+ ch = image_chunk_memory(ch, blk);
+ if (ch == NULL)
+ return (ENOMEM);
+ }
+ assert(ch->ch_type == CH_TYPE_MEMORY);
+ memcpy(ch->ch_u.mem.ptr, buf, secsz);
+ }
+ blk++;
+ buf = (char *)buf + secsz;
+ len--;
+ }
+ return (0);
+}
+
+static void
+image_cleanup(void)
+{
+ struct chunk *ch;
+
+ while ((ch = STAILQ_FIRST(&image_chunks)) != NULL) {
+ switch (ch->ch_type) {
+ case CH_TYPE_FILE:
+ /* We may be closing the same file multiple times. */
+ if (ch->ch_u.file.fd != -1)
+ close(ch->ch_u.file.fd);
+ break;
+ case CH_TYPE_MEMORY:
+ free(ch->ch_u.mem.ptr);
+ break;
+ default:
+ break;
+ }
+ STAILQ_REMOVE_HEAD(&image_chunks, ch_list);
+ free(ch);
+ }
+ if (image_swap_fd != -1)
+ close(image_swap_fd);
+ unlink(image_swap_file);
+}
+
+int
+image_init(void)
+{
+ const char *tmpdir;
+
+ STAILQ_INIT(&image_chunks);
+ image_nchunks = 0;
+
+ image_swap_size = 0;
+ image_swap_pgsz = getpagesize();
+
+ if (atexit(image_cleanup) == -1)
+ return (errno);
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+ snprintf(image_swap_file, sizeof(image_swap_file), "%s/mkimg-XXXXXX",
+ tmpdir);
+ image_swap_fd = mkstemp(image_swap_file);
+ if (image_swap_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..0405c5b
--- /dev/null
+++ b/usr.bin/mkimg/image.h
@@ -0,0 +1,45 @@
+/*-
+ * 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_copyout_zeroes(int fd, size_t count);
+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
new file mode 100644
index 0000000..071bcf5
--- /dev/null
+++ b/usr.bin/mkimg/mbr.c
@@ -0,0 +1,132 @@
+/*-
+ * 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/diskmbr.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef DOSPTYP_FAT16B
+#define DOSPTYP_FAT16B 0x06
+#endif
+#ifndef DOSPTYP_FAT32
+#define DOSPTYP_FAT32 0x0b
+#endif
+#ifndef DOSPTYP_PPCBOOT
+#define DOSPTYP_PPCBOOT 0x41
+#endif
+#ifndef DOSPTYP_EFI
+#define DOSPTYP_EFI 0xef
+#endif
+
+static struct mkimg_alias mbr_aliases[] = {
+ { ALIAS_EBR, ALIAS_INT2TYPE(DOSPTYP_EXT) },
+ { ALIAS_EFI, ALIAS_INT2TYPE(DOSPTYP_EFI) },
+ { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) },
+ { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) },
+ { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) },
+ { ALIAS_NTFS, ALIAS_INT2TYPE(DOSPTYP_NTFS) },
+ { ALIAS_PPCBOOT, ALIAS_INT2TYPE(DOSPTYP_PPCBOOT) },
+ { ALIAS_NONE, 0 } /* Keep last! */
+};
+
+static lba_t
+mbr_metadata(u_int where, lba_t blk)
+{
+
+ blk += (where == SCHEME_META_IMG_START) ? 1 : 0;
+ return (round_track(blk));
+}
+
+static void
+mbr_chs(u_char *cylp, u_char *hdp, u_char *secp, lba_t lba)
+{
+ u_int cyl, hd, sec;
+
+ mkimg_chs(lba, 1023, &cyl, &hd, &sec);
+ *cylp = cyl;
+ *hdp = hd;
+ *secp = (sec & 0x3f) | ((cyl >> 2) & 0xc0);
+}
+
+static int
+mbr_write(lba_t imgsz __unused, void *bootcode)
+{
+ u_char *mbr;
+ struct dos_partition *dpbase, *dp;
+ struct part *part;
+ lba_t size;
+ int error;
+
+ mbr = malloc(secsz);
+ if (mbr == NULL)
+ return (ENOMEM);
+ if (bootcode != NULL) {
+ memcpy(mbr, bootcode, DOSPARTOFF);
+ memset(mbr + DOSPARTOFF, 0, secsz - DOSPARTOFF);
+ } else
+ memset(mbr, 0, secsz);
+ le16enc(mbr + DOSMAGICOFFSET, DOSMAGIC);
+ dpbase = (void *)(mbr + DOSPARTOFF);
+ STAILQ_FOREACH(part, &partlist, link) {
+ size = round_track(part->size);
+ dp = dpbase + part->index;
+ dp->dp_flag = (part->index == 0 && bootcode != NULL) ? 0x80 : 0;
+ mbr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
+ part->block);
+ dp->dp_typ = ALIAS_TYPE2INT(part->type);
+ mbr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
+ part->block + size - 1);
+ le32enc(&dp->dp_start, part->block);
+ le32enc(&dp->dp_size, size);
+ }
+ error = image_write(0, mbr, 1);
+ free(mbr);
+ return (error);
+}
+
+static struct mkimg_scheme mbr_scheme = {
+ .name = "mbr",
+ .description = "Master Boot Record",
+ .aliases = mbr_aliases,
+ .metadata = mbr_metadata,
+ .write = mbr_write,
+ .bootcode = 512,
+ .nparts = NDOSPART,
+ .maxsecsz = 4096
+};
+
+SCHEME_DEFINE(mbr_scheme);
diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1
new file mode 100644
index 0000000..246a397
--- /dev/null
+++ b/usr.bin/mkimg/mkimg.1
@@ -0,0 +1,331 @@
+.\" Copyright (c) 2013, 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 ``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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 7, 2015
+.Dt MKIMG 1
+.Os
+.Sh NAME
+.Nm mkimg
+.Nd "utility to make disk images"
+.Sh SYNOPSIS
+.Nm
+.Op Fl H Ar heads
+.Op Fl P Ar blksz
+.Op Fl S Ar secsz
+.Op Fl T Ar tracksz
+.Op Fl b Ar bootcode
+.Op Fl c Ar capacity
+.Op Fl f Ar format
+.Op Fl o Ar outfile
+.Op Fl v
+.Op Fl y
+.Op Fl s Ar scheme Op Fl p Ar partition ...
+.Nm
+.Ar --formats | --schemes | --version
+.Sh DESCRIPTION
+The
+.Nm
+utility creates a disk image from the raw partition contents specified with
+the
+.Ar partition
+argument(s) and using the partitioning scheme specified with the
+.Ar scheme
+argument.
+The disk image is written to
+.Ar stdout
+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
+.Ar bootcode
+argument and,
+depending on the scheme,
+with a boot partition.
+The contents of such a boot partition is provided like any other partition
+and the
+.Nm
+utility does not treat it any differently from other partitions.
+.Pp
+Some partitioning schemes need a disk geometry and for those the
+.Nm
+utility accepts the
+.Ar tracksz
+and
+.Ar heads
+arguments, specifying the number of sectors per track and the number of
+heads per cylinder (resp.)
+.Pp
+Both the logical and physical sector size can be specified and for that the
+.Nm
+utility
+accepts the
+.Ar secsz
+and
+.Ar blksz
+arguments.
+The
+.Ar secsz
+argument is used to specify the logical sector size.
+This is the sector size reported by a disk when queried for its capacity.
+Modern disks use a larger sector size internally,
+referred to as block size by the
+.Nm
+utility and this can be specified by the
+.Ar blksz
+argument.
+The
+.Nm
+utility will use the (physical) block size to determine the start of
+partitions and to round the size of the disk image.
+.Pp
+The
+.Fl c
+option can be used to specify a minimal capacity for the disk image.
+Use this option without the
+.Fl s
+and
+.Fl p
+options to create an empty disk image with the given (virtual) size.
+An empty partition table can be written to the disk when specifying a
+partitioning scheme with the
+.Fl s
+option, but without specifying any partitions.
+When the size required to for all the partitions is larger than the
+given capacity, then the disk image will be larger than the capacity
+given.
+.Pp
+The
+.Fl v
+option increases the level of output that the
+.Nm
+utility prints.
+.Pp
+The
+.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
+A set of long options exist to query about the
+.Nm
+utility itself.
+Options in this set should be given by themselves because the
+.Nm
+utility exits immediately after providing the requested information.
+The version of the
+.Nm
+utility is printed when the
+.Ar --version
+option is given.
+The list of supported output formats is printed when the
+.Ar --formats
+option is given and the list of supported partitioning schemes is printed
+when the
+.Ar --schemes
+option is given.
+Both the format and scheme lists a space-separated lists for easy handling
+in scripts.
+.Pp
+For a more descriptive 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.
+This will print a usage message with all the necessary details.
+.Sh DISK FORMATS
+The
+.Nm
+utility supports a number of output file formats.
+A short description of these is given below.
+.Ss QCOW and QCOW2
+QCOW stands for "QEMU Copy On Write".
+It's a sparse file format akin to VHD and VMDK and QCOW represents the
+first version.
+QCOW2 represents version 2 of the file format.
+Version 2 is not backward compatible with version 1 and adds support for
+snapshots among other things.
+The QCOW file formats are natively supported by QEMU and Xen.
+To write QCOW, specify
+.Fl f Ar qcow
+on the command line.
+To write version 2 QCOW, specify
+.Fl f Ar qcow2
+on the command line.
+The preferred file extension is ".qcow" and ".qcow2" for QCOW and QCOW2
+(resp.), but ".qcow" is sometimes used for version 2 files as well.
+.Ss RAW file format
+This file format is a sector by sector representation of an actual disk.
+There is no extra information that describes or relates to the format
+itself. The size of the file is the size of the (virtual) disk.
+This file format is suitable for being copyied onto a disk with utilities
+like
+.Nm dd .
+To write a raw disk file, either omit the
+.Fl f
+option, or specify
+.Fl f Ar raw
+on the command line.
+The preferred file extension is one of ".img" or ".raw", but there's no
+real convention for it.
+.Ss Dynamic VHD and Fixed VHD
+Microsoft's "Virtual Hard Disk" file formats.
+The dynamic format is a sparse format akin to QCOW and VMDK.
+The fixed format is effectively a raw format with a footer appended to the
+file and as such it's often indistinguishable from the raw format.
+The fixed file format has been added to support Microsoft's Azure platform
+and due to inconsistencies in interpretation of the footer is not compatible
+with utilities like
+.Nm qemu
+when it is specifically instructed to interpreted the file as a VHD file.
+By default
+.Nm qemu
+will treat the file as a raw disk file, which mostly works fine.
+To have
+.Nm
+create a dynamic VHD file, specify
+.Fl f Ar vhd
+on the command line.
+To create a fixed VHD file for use by Azure, specify
+.Fl f Ar vhdf
+on the command line.
+The preferred file extension is ".vhd".
+.Ss VMDK
+VMware's "Virtual Machine Disk" file format.
+It's a sparse file format akin to QCOW and VHD and supported by many
+virtualization solutions.
+To create a VMDK file, specify
+.Fl f Ar vmdk
+on the command line.
+The preferred file extension is ".vmdk".
+.Pp
+Not all virtualization solutions support all file formats, but often those
+virtualization environments have utilities to convert from one format to
+another.
+Note however that conversion may require that the virtual disk size is
+changed to match the constraints of the output format and this may invalidate
+the contents of the disk image.
+For example, the GUID Partition Table (GPT) scheme has a header in the last
+sector on the disk.
+When changing the disk size, the GPT must be changed so that the last header
+is moved accordingly.
+This is typically not part of the conversion process.
+If possible, use an output format specifically for the environment in which
+the file is intended to be used.
+.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
+.Xr makefs
+and also containing a swap partition, run the
+.Nm
+utility as follows:
+.Dl % mkimg -s gpt -b /boot/pmbr -p freebsd-boot:=/boot/gptboot \
+-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.
+The output of the first will be fed as the contents of a partition to the
+second.
+This can be done using a temporary file, like so:
+.Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
+-p freebsd-swap::1G -o /tmp/bsd.img
+.Dl % mkimg -s mbr -b /boot/mbr -p freebsd:=/tmp/bsd.img -o mbr-bsd.img
+.Pp
+Alternatively, the
+.Nm
+utility can be run in a cascaded fashion, whereby the output of the
+first is fed directly into the second.
+To do this, run the
+.Nm
+utility as follows:
+.Dl % mkimg -s mbr -b /boot/mbr -p freebsd:-'mkimg -s bsd -b /boot/boot \
+-p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G' -o mbr-bsd.img
+.Pp
+To accommodate the need to have partitions named or numbered in a certain
+way, the
+.Nm
+utility allows for the specification of empty partitions.
+For example, to create an image that is compatible with partition layouts
+found in
+.Pa /etc/disktab ,
+the 'd' partition often needs to be skipped.
+This is accomplished by inserting an unused partition after the first 2
+partition specifications.
+It is worth noting at this time that the BSD scheme will automatically
+skip the 'c' partition by virtue of it referring to the entire disk.
+To create an image that is compatible with the qp120at disk, use the
+.Nm
+utility as follows:
+.Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
+-p freebsd-swap::20M -p- -p- -p- -p- -p freebsd-ufs:=usr-file-system.ufs \
+-o bsd.img
+.Pp
+For partitioning schemes that feature partition labels, the
+.Nm
+utility supports assigning labels to the partitions specified.
+In the following example the file system partition is labeled as 'backup':
+.Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img
+.Sh SEE ALSO
+.Xr dd 1 ,
+.Xr gpart 8 ,
+.Xr makefs 8 ,
+.Xr mdconfig 8 ,
+.Xr newfs 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 10.1 .
+.Sh AUTHORS
+The
+.Nm
+utility and manpage were written by
+.An Marcel Moolenaar Aq Mt marcelm@juniper.net .
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
new file mode 100644
index 0000000..5a4b9f9
--- /dev/null
+++ b/usr.bin/mkimg/mkimg.c
@@ -0,0 +1,638 @@
+/*-
+ * Copyright (c) 2013,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/linker_set.h>
+#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>
+#include <getopt.h>
+#include <libutil.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#define LONGOPT_FORMATS 0x01000001
+#define LONGOPT_SCHEMES 0x01000002
+#define LONGOPT_VERSION 0x01000003
+
+static struct option longopts[] = {
+ { "formats", no_argument, NULL, LONGOPT_FORMATS },
+ { "schemes", no_argument, NULL, LONGOPT_SCHEMES },
+ { "version", no_argument, NULL, LONGOPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static uint64_t capacity;
+
+struct partlisthead partlist = STAILQ_HEAD_INITIALIZER(partlist);
+u_int nparts = 0;
+
+u_int unit_testing;
+u_int verbose;
+
+u_int ncyls = 0;
+u_int nheads = 1;
+u_int nsecs = 1;
+u_int secsz = 512;
+u_int blksz = 0;
+
+static void
+print_formats(int usage)
+{
+ struct mkimg_format *f, **f_iter;
+ const char *sep;
+
+ if (usage) {
+ fprintf(stderr, " formats:\n");
+ SET_FOREACH(f_iter, formats) {
+ f = *f_iter;
+ fprintf(stderr, "\t%s\t- %s\n", f->name,
+ f->description);
+ }
+ } else {
+ sep = "";
+ SET_FOREACH(f_iter, formats) {
+ f = *f_iter;
+ printf("%s%s", sep, f->name);
+ sep = " ";
+ }
+ putchar('\n');
+ }
+}
+
+static void
+print_schemes(int usage)
+{
+ struct mkimg_scheme *s, **s_iter;
+ const char *sep;
+
+ if (usage) {
+ fprintf(stderr, " schemes:\n");
+ SET_FOREACH(s_iter, schemes) {
+ s = *s_iter;
+ fprintf(stderr, "\t%s\t- %s\n", s->name,
+ s->description);
+ }
+ } else {
+ sep = "";
+ SET_FOREACH(s_iter, schemes) {
+ s = *s_iter;
+ printf("%s%s", sep, s->name);
+ sep = " ";
+ }
+ putchar('\n');
+ }
+}
+
+static void
+print_version(void)
+{
+ u_int width;
+
+#ifdef __LP64__
+ width = 64;
+#else
+ width = 32;
+#endif
+ printf("mkimg %u (%u-bit)\n", MKIMG_VERSION, width);
+}
+
+static void
+usage(const char *why)
+{
+
+ warnx("error: %s", why);
+ fputc('\n', stderr);
+ fprintf(stderr, "usage: %s <options>\n", getprogname());
+
+ fprintf(stderr, " options:\n");
+ fprintf(stderr, "\t--formats\t- list image formats\n");
+ fprintf(stderr, "\t--schemes\t- list partition schemes\n");
+ fprintf(stderr, "\t--version\t- show version information\n");
+ fputc('\n', stderr);
+ fprintf(stderr, "\t-b <file>\t- file containing boot code\n");
+ fprintf(stderr, "\t-c <num>\t- capacity (in bytes) of the disk\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");
+ fputc('\n', stderr);
+ print_formats(1);
+ fputc('\n', stderr);
+ print_schemes(1);
+ fputc('\n', stderr);
+ fprintf(stderr, " 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 "
+ "are determined\n\t\t\t\t by the named file\n");
+ fprintf(stderr, "\t<t>[/<l>]:-<cmd>\t- partition content and size "
+ "are taken from\n\t\t\t\t the output of the command to run\n");
+ fprintf(stderr, "\t-\t\t\t- unused partition entry\n");
+ fprintf(stderr, "\t where:\n");
+ fprintf(stderr, "\t\t<t>\t- scheme neutral partition type\n");
+ fprintf(stderr, "\t\t<l>\t- optional scheme-dependent partition "
+ "label\n");
+
+ exit(EX_USAGE);
+}
+
+static int
+parse_uint32(uint32_t *valp, uint32_t min, uint32_t max, const char *arg)
+{
+ uint64_t val;
+
+ if (expand_number(arg, &val) == -1)
+ return (errno);
+ if (val > UINT_MAX || val < (uint64_t)min || val > (uint64_t)max)
+ return (EINVAL);
+ *valp = (uint32_t)val;
+ return (0);
+}
+
+static int
+parse_uint64(uint64_t *valp, uint64_t min, uint64_t max, const char *arg)
+{
+ uint64_t val;
+
+ if (expand_number(arg, &val) == -1)
+ return (errno);
+ if (val < min || val > max)
+ return (EINVAL);
+ *valp = val;
+ return (0);
+}
+
+static int
+pwr_of_two(u_int nr)
+{
+
+ return (((nr & (nr - 1)) == 0) ? 1 : 0);
+}
+
+/*
+ * A partition specification has the following format:
+ * <type> ':' <kind> <contents>
+ * where:
+ * type the partition type alias
+ * kind the interpretation of the contents specification
+ * ':' contents holds the size of an empty partition
+ * '=' contents holds the name of a file to read
+ * '-' contents holds a command to run; the output of
+ * which is the contents of the partition.
+ * contents the specification of a partition's contents
+ *
+ * A specification that is a single dash indicates an unused partition
+ * entry.
+ */
+static int
+parse_part(const char *spec)
+{
+ struct part *part;
+ char *sep;
+ size_t len;
+ int error;
+
+ if (strcmp(spec, "-") == 0) {
+ nparts++;
+ return (0);
+ }
+
+ part = calloc(1, sizeof(struct part));
+ if (part == NULL)
+ return (ENOMEM);
+
+ sep = strchr(spec, ':');
+ if (sep == NULL) {
+ error = EINVAL;
+ goto errout;
+ }
+ len = sep - spec + 1;
+ if (len < 2) {
+ error = EINVAL;
+ goto errout;
+ }
+ part->alias = malloc(len);
+ if (part->alias == NULL) {
+ error = ENOMEM;
+ goto errout;
+ }
+ strlcpy(part->alias, spec, len);
+ spec = sep + 1;
+
+ switch (*spec) {
+ case ':':
+ part->kind = PART_KIND_SIZE;
+ break;
+ case '=':
+ part->kind = PART_KIND_FILE;
+ break;
+ case '-':
+ part->kind = PART_KIND_PIPE;
+ break;
+ default:
+ error = EINVAL;
+ goto errout;
+ }
+ spec++;
+
+ part->contents = strdup(spec);
+ if (part->contents == NULL) {
+ error = ENOMEM;
+ goto errout;
+ }
+
+ spec = part->alias;
+ sep = strchr(spec, '/');
+ if (sep != NULL) {
+ *sep++ = '\0';
+ if (strlen(part->alias) == 0 || strlen(sep) == 0) {
+ error = EINVAL;
+ goto errout;
+ }
+ part->label = strdup(sep);
+ if (part->label == NULL) {
+ error = ENOMEM;
+ goto errout;
+ }
+ }
+
+ part->index = nparts;
+ STAILQ_INSERT_TAIL(&partlist, part, link);
+ nparts++;
+ return (0);
+
+ errout:
+ if (part->alias != NULL)
+ free(part->alias);
+ free(part);
+ return (error);
+}
+
+#if defined(SPARSE_WRITE)
+ssize_t
+sparse_write(int fd, const void *ptr, size_t sz)
+{
+ 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) {
+ len = (p != NULL) ? (size_t)(p - buf) : sz;
+ if (len > 0) {
+ len = (len + secsz - 1) & ~(secsz - 1);
+ if (len > sz)
+ len = sz;
+ wr = write(fd, buf, len);
+ if (wr < 0)
+ return (-1);
+ } else {
+ while (len < sz && *p++ == '\0')
+ len++;
+ if (len < sz)
+ len &= ~(secsz - 1);
+ if (len == 0)
+ continue;
+ ofs = lseek(fd, len, SEEK_CUR);
+ if (ofs < 0)
+ return (-1);
+ wr = len;
+ }
+ buf += wr;
+ sz -= wr;
+ wrsz += wr;
+ p = memchr(buf, 0, sz);
+ }
+ return (wrsz);
+}
+#endif /* SPARSE_WRITE */
+
+void
+mkimg_chs(lba_t lba, u_int maxcyl, u_int *cylp, u_int *hdp, u_int *secp)
+{
+ u_int hd, sec;
+
+ *cylp = *hdp = *secp = ~0U;
+ if (nsecs == 1 || nheads == 1)
+ return;
+
+ sec = lba % nsecs + 1;
+ lba /= nsecs;
+ hd = lba % nheads;
+ lba /= nheads;
+ if (lba > maxcyl)
+ return;
+
+ *cylp = lba;
+ *hdp = hd;
+ *secp = sec;
+}
+
+void
+mkimg_uuid(struct uuid *uuid)
+{
+ static uint8_t gen[sizeof(struct uuid)];
+ u_int i;
+
+ if (!unit_testing) {
+ uuidgen(uuid, 1);
+ return;
+ }
+
+ for (i = 0; i < sizeof(gen); i++)
+ gen[i]++;
+ memcpy(uuid, gen, sizeof(uuid_t));
+}
+
+static int
+capacity_resize(lba_t end)
+{
+ lba_t capsz;
+
+ capsz = (capacity + secsz - 1) / secsz;
+ if (end >= capsz)
+ return (0);
+ return (image_set_size(capsz));
+}
+
+static void
+mkimg(void)
+{
+ FILE *fp;
+ struct part *part;
+ lba_t block;
+ off_t bytesize;
+ int error, fd;
+
+ /* First check partition information */
+ STAILQ_FOREACH(part, &partlist, link) {
+ error = scheme_check_part(part);
+ if (error)
+ errc(EX_DATAERR, error, "partition %d", part->index+1);
+ }
+
+ block = scheme_metadata(SCHEME_META_IMG_START, 0);
+ STAILQ_FOREACH(part, &partlist, link) {
+ block = scheme_metadata(SCHEME_META_PART_BEFORE, block);
+ if (verbose)
+ fprintf(stderr, "partition %d: starting block %llu "
+ "... ", part->index + 1, (long long)block);
+ part->block = block;
+ switch (part->kind) {
+ case PART_KIND_SIZE:
+ if (expand_number(part->contents, &bytesize) == -1)
+ error = errno;
+ break;
+ case PART_KIND_FILE:
+ fd = open(part->contents, O_RDONLY, 0);
+ if (fd != -1) {
+ error = image_copyin(block, fd, &bytesize);
+ close(fd);
+ } else
+ error = errno;
+ break;
+ case PART_KIND_PIPE:
+ fp = popen(part->contents, "r");
+ if (fp != NULL) {
+ fd = fileno(fp);
+ error = image_copyin(block, fd, &bytesize);
+ pclose(fp);
+ } else
+ error = errno;
+ break;
+ }
+ if (error)
+ errc(EX_IOERR, error, "partition %d", part->index + 1);
+ part->size = (bytesize + secsz - 1) / secsz;
+ if (verbose) {
+ bytesize = part->size * secsz;
+ fprintf(stderr, "size %llu bytes (%llu blocks)\n",
+ (long long)bytesize, (long long)part->size);
+ }
+ block = scheme_metadata(SCHEME_META_PART_AFTER,
+ part->block + part->size);
+ }
+
+ block = scheme_metadata(SCHEME_META_IMG_END, block);
+ error = image_set_size(block);
+ if (!error)
+ error = capacity_resize(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;
+
+ bcfd = -1;
+ outfd = 1; /* Write to stdout by default */
+ while ((c = getopt_long(argc, argv, "b:c:f:o:p:s:vyH:P:S:T:",
+ longopts, NULL)) != -1) {
+ switch (c) {
+ case 'b': /* BOOT CODE */
+ if (bcfd != -1)
+ usage("multiple bootcode given");
+ bcfd = open(optarg, O_RDONLY, 0);
+ if (bcfd == -1)
+ err(EX_UNAVAILABLE, "%s", optarg);
+ break;
+ case 'c': /* CAPACITY */
+ error = parse_uint64(&capacity, 1, OFF_MAX, optarg);
+ if (error)
+ errc(EX_DATAERR, error, "capacity in bytes");
+ 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 != 1)
+ usage("multiple output files given");
+ outfd = open(optarg, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
+ if (outfd == -1)
+ err(EX_CANTCREAT, "%s", optarg);
+ break;
+ case 'p': /* PARTITION */
+ error = parse_part(optarg);
+ if (error)
+ errc(EX_DATAERR, error, "partition");
+ break;
+ case 's': /* SCHEME */
+ if (scheme_selected() != NULL)
+ usage("multiple schemes given");
+ error = scheme_select(optarg);
+ if (error)
+ errc(EX_DATAERR, error, "scheme");
+ break;
+ case 'y':
+ unit_testing++;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'H': /* GEOMETRY: HEADS */
+ error = parse_uint32(&nheads, 1, 255, optarg);
+ if (error)
+ errc(EX_DATAERR, error, "number of heads");
+ break;
+ case 'P': /* GEOMETRY: PHYSICAL SECTOR SIZE */
+ error = parse_uint32(&blksz, 512, INT_MAX+1U, optarg);
+ if (error == 0 && !pwr_of_two(blksz))
+ error = EINVAL;
+ if (error)
+ errc(EX_DATAERR, error, "physical sector size");
+ break;
+ case 'S': /* GEOMETRY: LOGICAL SECTOR SIZE */
+ error = parse_uint32(&secsz, 512, INT_MAX+1U, optarg);
+ if (error == 0 && !pwr_of_two(secsz))
+ error = EINVAL;
+ if (error)
+ errc(EX_DATAERR, error, "logical sector size");
+ break;
+ case 'T': /* GEOMETRY: TRACK SIZE */
+ error = parse_uint32(&nsecs, 1, 63, optarg);
+ if (error)
+ errc(EX_DATAERR, error, "track size");
+ break;
+ case LONGOPT_FORMATS:
+ print_formats(0);
+ exit(EX_OK);
+ /*NOTREACHED*/
+ case LONGOPT_SCHEMES:
+ print_schemes(0);
+ exit(EX_OK);
+ /*NOTREACHED*/
+ case LONGOPT_VERSION:
+ print_version();
+ exit(EX_OK);
+ /*NOTREACHED*/
+ default:
+ usage("unknown option");
+ }
+ }
+
+ if (argc > optind)
+ usage("trailing arguments");
+ if (scheme_selected() == NULL && nparts > 0)
+ usage("no scheme");
+ if (nparts == 0 && capacity == 0)
+ usage("no partitions");
+
+ if (secsz > blksz) {
+ if (blksz != 0)
+ errx(EX_DATAERR, "the physical block size cannot "
+ "be smaller than the sector size");
+ blksz = secsz;
+ }
+
+ if (secsz > scheme_max_secsz())
+ errx(EX_DATAERR, "maximum sector size supported is %u; "
+ "size specified is %u", scheme_max_secsz(), secsz);
+
+ if (nparts > scheme_max_parts())
+ errx(EX_DATAERR, "%d partitions supported; %d given",
+ scheme_max_parts(), nparts);
+
+ 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);
+ if (scheme_selected())
+ fprintf(stderr, "Partitioning scheme: %s\n",
+ scheme_selected()->name);
+ fprintf(stderr, "Output file format: %s\n",
+ format_selected()->name);
+ fputc('\n', stderr);
+ }
+
+ error = image_init();
+ if (error)
+ errc(EX_OSERR, error, "cannot initialize");
+
+ mkimg();
+
+ if (verbose) {
+ fputc('\n', stderr);
+ fprintf(stderr, "Number of cylinders: %u\n", ncyls);
+ }
+
+ 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
new file mode 100644
index 0000000..281beeb
--- /dev/null
+++ b/usr.bin/mkimg/mkimg.h
@@ -0,0 +1,95 @@
+/*-
+ * 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_MKIMG_H_
+#define _MKIMG_MKIMG_H_
+
+#include <sys/queue.h>
+
+struct part {
+ STAILQ_ENTRY(part) link;
+ char *alias; /* Partition type alias. */
+ char *contents; /* Contents/size specification. */
+ u_int kind; /* Content kind. */
+#define PART_UNDEF 0
+#define PART_KIND_FILE 1
+#define PART_KIND_PIPE 2
+#define PART_KIND_SIZE 3
+ u_int index; /* Partition index (0-based). */
+ uintptr_t type; /* Scheme-specific partition type. */
+ lba_t block; /* Block-offset of partition in image. */
+ lba_t size; /* Size in blocks of partition. */
+ char *label; /* Partition label. */
+};
+
+extern STAILQ_HEAD(partlisthead, part) partlist;
+extern u_int nparts;
+
+extern u_int unit_testing;
+extern u_int verbose;
+
+extern u_int ncyls;
+extern u_int nheads;
+extern u_int nsecs;
+extern u_int secsz; /* Logical block size. */
+extern u_int blksz; /* Physical block size. */
+
+static inline lba_t
+round_block(lba_t n)
+{
+ lba_t b = blksz / secsz;
+ return ((n + b - 1) & ~(b - 1));
+}
+
+static inline lba_t
+round_cylinder(lba_t n)
+{
+ u_int cyl = nsecs * nheads;
+ u_int r = n % cyl;
+ return ((r == 0) ? n : n + cyl - r);
+}
+
+static inline lba_t
+round_track(lba_t n)
+{
+ u_int r = n % nsecs;
+ return ((r == 0) ? n : n + nsecs - r);
+}
+
+#if !defined(SPARSE_WRITE)
+#define sparse_write write
+#else
+ssize_t sparse_write(int, const void *, size_t);
+#endif
+
+void mkimg_chs(lba_t, u_int, u_int *, u_int *, u_int *);
+
+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
new file mode 100644
index 0000000..2db0394
--- /dev/null
+++ b/usr.bin/mkimg/pc98.c
@@ -0,0 +1,130 @@
+/*-
+ * 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/diskpc98.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef PC98_MAGIC
+#define PC98_MAGIC 0xaa55
+#endif
+#ifndef PC98_MAGICOFS
+#define PC98_MAGICOFS 510
+#endif
+#ifndef PC98_NPARTS
+#define PC98_NPARTS 16
+#endif
+#ifndef PC98_PTYP_386BSD
+#define PC98_PTYP_386BSD 0xc494
+#endif
+
+#define PC98_BOOTCODESZ 8192
+
+static struct mkimg_alias pc98_aliases[] = {
+ { ALIAS_FREEBSD, ALIAS_INT2TYPE(PC98_PTYP_386BSD) },
+ { ALIAS_NONE, 0 }
+};
+
+static lba_t
+pc98_metadata(u_int where, lba_t blk)
+{
+ if (where == SCHEME_META_IMG_START)
+ blk += PC98_BOOTCODESZ / secsz;
+ return (round_track(blk));
+}
+
+static void
+pc98_chs(u_short *cylp, u_char *hdp, u_char *secp, lba_t lba)
+{
+ u_int cyl, hd, sec;
+
+ mkimg_chs(lba, 0xffff, &cyl, &hd, &sec);
+ le16enc(cylp, cyl);
+ *hdp = hd;
+ *secp = sec;
+}
+
+static int
+pc98_write(lba_t imgsz __unused, void *bootcode)
+{
+ struct part *part;
+ struct pc98_partition *dpbase, *dp;
+ u_char *buf;
+ lba_t size;
+ int error, ptyp;
+
+ buf = malloc(PC98_BOOTCODESZ);
+ if (buf == NULL)
+ return (ENOMEM);
+ if (bootcode != NULL) {
+ memcpy(buf, bootcode, PC98_BOOTCODESZ);
+ memset(buf + secsz, 0, secsz);
+ } else
+ memset(buf, 0, PC98_BOOTCODESZ);
+ le16enc(buf + PC98_MAGICOFS, PC98_MAGIC);
+ dpbase = (void *)(buf + secsz);
+ STAILQ_FOREACH(part, &partlist, link) {
+ size = round_track(part->size);
+ dp = dpbase + part->index;
+ ptyp = ALIAS_TYPE2INT(part->type);
+ dp->dp_mid = ptyp;
+ dp->dp_sid = ptyp >> 8;
+ pc98_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
+ part->block);
+ pc98_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
+ part->block + size - 1);
+ if (part->label != NULL)
+ memcpy(dp->dp_name, part->label, strlen(part->label));
+ }
+ error = image_write(0, buf, PC98_BOOTCODESZ / secsz);
+ free(buf);
+ return (error);
+}
+
+static struct mkimg_scheme pc98_scheme = {
+ .name = "pc98",
+ .description = "PC-9800 disk partitions",
+ .aliases = pc98_aliases,
+ .metadata = pc98_metadata,
+ .write = pc98_write,
+ .bootcode = PC98_BOOTCODESZ,
+ .labellen = 16,
+ .nparts = PC98_NPARTS,
+ .maxsecsz = 512
+};
+
+SCHEME_DEFINE(pc98_scheme);
diff --git a/usr.bin/mkimg/qcow.c b/usr.bin/mkimg/qcow.c
new file mode 100644
index 0000000..a89761b
--- /dev/null
+++ b/usr.bin/mkimg/qcow.c
@@ -0,0 +1,370 @@
+/*-
+ * 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 <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+
+/* Default cluster sizes. */
+#define QCOW1_CLSTR_LOG2SZ 12 /* 4KB */
+#define QCOW2_CLSTR_LOG2SZ 16 /* 64KB */
+
+/* Flag bits in cluster offsets */
+#define QCOW_CLSTR_COMPRESSED (1ULL << 62)
+#define QCOW_CLSTR_COPIED (1ULL << 63)
+
+struct qcow_header {
+ uint32_t magic;
+#define QCOW_MAGIC 0x514649fb
+ uint32_t version;
+#define QCOW_VERSION_1 1
+#define QCOW_VERSION_2 2
+ uint64_t path_offset;
+ uint32_t path_length;
+ uint32_t clstr_log2sz; /* v2 only */
+ uint64_t disk_size;
+ union {
+ struct {
+ uint8_t clstr_log2sz;
+ uint8_t l2_log2sz;
+ uint16_t _pad;
+ uint32_t encryption;
+ uint64_t l1_offset;
+ } v1;
+ struct {
+ uint32_t encryption;
+ uint32_t l1_entries;
+ uint64_t l1_offset;
+ uint64_t refcnt_offset;
+ uint32_t refcnt_clstrs;
+ uint32_t snapshot_count;
+ uint64_t snapshot_offset;
+ } v2;
+ } u;
+};
+
+static u_int clstr_log2sz;
+
+static uint64_t
+round_clstr(uint64_t ofs)
+{
+ uint64_t clstrsz;
+
+ clstrsz = 1UL << clstr_log2sz;
+ return ((ofs + clstrsz - 1) & ~(clstrsz - 1));
+}
+
+static int
+qcow_resize(lba_t imgsz, u_int version)
+{
+ uint64_t imagesz;
+
+ switch (version) {
+ case QCOW_VERSION_1:
+ clstr_log2sz = QCOW1_CLSTR_LOG2SZ;
+ break;
+ case QCOW_VERSION_2:
+ clstr_log2sz = QCOW2_CLSTR_LOG2SZ;
+ break;
+ default:
+ return (EDOOFUS);
+ }
+
+ imagesz = round_clstr(imgsz * secsz);
+
+ if (verbose)
+ fprintf(stderr, "QCOW: image size = %ju, cluster size = %u\n",
+ (uintmax_t)imagesz, (u_int)(1U << clstr_log2sz));
+
+ return (image_set_size(imagesz / secsz));
+}
+
+static int
+qcow1_resize(lba_t imgsz)
+{
+
+ return (qcow_resize(imgsz, QCOW_VERSION_1));
+}
+
+static int
+qcow2_resize(lba_t imgsz)
+{
+
+ return (qcow_resize(imgsz, QCOW_VERSION_2));
+}
+
+static int
+qcow_write(int fd, u_int version)
+{
+ struct qcow_header *hdr;
+ uint64_t *l1tbl, *l2tbl, *rctbl;
+ uint16_t *rcblk;
+ uint64_t clstr_imgsz, clstr_l2tbls, clstr_l1tblsz;
+ uint64_t clstr_rcblks, clstr_rctblsz;
+ uint64_t n, imagesz, nclstrs, ofs, ofsflags;
+ lba_t blk, blkofs, blk_imgsz;
+ u_int l1clno, l2clno, rcclno;
+ u_int blk_clstrsz, refcnt_clstrs;
+ u_int clstrsz, l1idx, l2idx;
+ int error;
+
+ if (clstr_log2sz == 0)
+ return (EDOOFUS);
+
+ clstrsz = 1U << clstr_log2sz;
+ blk_clstrsz = clstrsz / secsz;
+ blk_imgsz = image_get_size();
+ imagesz = blk_imgsz * secsz;
+ clstr_imgsz = imagesz >> clstr_log2sz;
+ clstr_l2tbls = round_clstr(clstr_imgsz * 8) >> clstr_log2sz;
+ clstr_l1tblsz = round_clstr(clstr_l2tbls * 8) >> clstr_log2sz;
+ nclstrs = clstr_imgsz + clstr_l2tbls + clstr_l1tblsz + 1;
+ clstr_rcblks = clstr_rctblsz = 0;
+ do {
+ n = clstr_rcblks + clstr_rctblsz;
+ clstr_rcblks = round_clstr((nclstrs + n) * 2) >> clstr_log2sz;
+ clstr_rctblsz = round_clstr(clstr_rcblks * 8) >> clstr_log2sz;
+ } while (n < (clstr_rcblks + clstr_rctblsz));
+
+ /*
+ * We got all the sizes in clusters. Start the layout.
+ * 0 - header
+ * 1 - L1 table
+ * 2 - RC table (v2 only)
+ * 3 - L2 tables
+ * 4 - RC block (v2 only)
+ * 5 - data
+ */
+
+ l1clno = 1;
+ rcclno = 0;
+ rctbl = l2tbl = l1tbl = NULL;
+ rcblk = NULL;
+
+ hdr = calloc(1, clstrsz);
+ if (hdr == NULL)
+ return (errno);
+
+ be32enc(&hdr->magic, QCOW_MAGIC);
+ be32enc(&hdr->version, version);
+ be64enc(&hdr->disk_size, imagesz);
+ switch (version) {
+ case QCOW_VERSION_1:
+ ofsflags = 0;
+ l2clno = l1clno + clstr_l1tblsz;
+ hdr->u.v1.clstr_log2sz = clstr_log2sz;
+ hdr->u.v1.l2_log2sz = clstr_log2sz - 3;
+ be64enc(&hdr->u.v1.l1_offset, clstrsz * l1clno);
+ break;
+ case QCOW_VERSION_2:
+ ofsflags = QCOW_CLSTR_COPIED;
+ rcclno = l1clno + clstr_l1tblsz;
+ l2clno = rcclno + clstr_rctblsz;
+ be32enc(&hdr->clstr_log2sz, clstr_log2sz);
+ be32enc(&hdr->u.v2.l1_entries, clstr_l2tbls);
+ be64enc(&hdr->u.v2.l1_offset, clstrsz * l1clno);
+ be64enc(&hdr->u.v2.refcnt_offset, clstrsz * rcclno);
+ refcnt_clstrs = round_clstr(clstr_rcblks * 8) >> clstr_log2sz;
+ be32enc(&hdr->u.v2.refcnt_clstrs, refcnt_clstrs);
+ break;
+ default:
+ return (EDOOFUS);
+ }
+
+ if (sparse_write(fd, hdr, clstrsz) < 0) {
+ error = errno;
+ goto out;
+ }
+
+ free(hdr);
+ hdr = NULL;
+
+ ofs = clstrsz * l2clno;
+ nclstrs = 1 + clstr_l1tblsz + clstr_rctblsz;
+
+ l1tbl = calloc(1, clstrsz * clstr_l1tblsz);
+ if (l1tbl == NULL) {
+ error = ENOMEM;
+ goto out;
+ }
+
+ for (n = 0; n < clstr_imgsz; n++) {
+ blk = n * blk_clstrsz;
+ if (image_data(blk, blk_clstrsz)) {
+ nclstrs++;
+ l1idx = n >> (clstr_log2sz - 3);
+ if (l1tbl[l1idx] == 0) {
+ be64enc(l1tbl + l1idx, ofs + ofsflags);
+ ofs += clstrsz;
+ nclstrs++;
+ }
+ }
+ }
+
+ if (sparse_write(fd, l1tbl, clstrsz * clstr_l1tblsz) < 0) {
+ error = errno;
+ goto out;
+ }
+
+ clstr_rcblks = 0;
+ do {
+ n = clstr_rcblks;
+ clstr_rcblks = round_clstr((nclstrs + n) * 2) >> clstr_log2sz;
+ } while (n < clstr_rcblks);
+
+ if (rcclno > 0) {
+ rctbl = calloc(1, clstrsz * clstr_rctblsz);
+ if (rctbl == NULL) {
+ error = ENOMEM;
+ goto out;
+ }
+ for (n = 0; n < clstr_rcblks; n++) {
+ be64enc(rctbl + n, ofs);
+ ofs += clstrsz;
+ nclstrs++;
+ }
+ if (sparse_write(fd, rctbl, clstrsz * clstr_rctblsz) < 0) {
+ error = errno;
+ goto out;
+ }
+ free(rctbl);
+ rctbl = NULL;
+ }
+
+ l2tbl = malloc(clstrsz);
+ if (l2tbl == NULL) {
+ error = ENOMEM;
+ goto out;
+ }
+
+ for (l1idx = 0; l1idx < clstr_l2tbls; l1idx++) {
+ if (l1tbl[l1idx] == 0)
+ continue;
+ memset(l2tbl, 0, clstrsz);
+ blkofs = (lba_t)l1idx * blk_clstrsz * (clstrsz >> 3);
+ for (l2idx = 0; l2idx < (clstrsz >> 3); l2idx++) {
+ blk = blkofs + (lba_t)l2idx * blk_clstrsz;
+ if (blk >= blk_imgsz)
+ break;
+ if (image_data(blk, blk_clstrsz)) {
+ be64enc(l2tbl + l2idx, ofs + ofsflags);
+ ofs += clstrsz;
+ }
+ }
+ if (sparse_write(fd, l2tbl, clstrsz) < 0) {
+ error = errno;
+ goto out;
+ }
+ }
+
+ free(l2tbl);
+ l2tbl = NULL;
+ free(l1tbl);
+ l1tbl = NULL;
+
+ if (rcclno > 0) {
+ rcblk = calloc(1, clstrsz * clstr_rcblks);
+ if (rcblk == NULL) {
+ error = ENOMEM;
+ goto out;
+ }
+ for (n = 0; n < nclstrs; n++)
+ be16enc(rcblk + n, 1);
+ if (sparse_write(fd, rcblk, clstrsz * clstr_rcblks) < 0) {
+ error = errno;
+ goto out;
+ }
+ free(rcblk);
+ rcblk = NULL;
+ }
+
+ error = 0;
+ for (n = 0; n < clstr_imgsz; n++) {
+ blk = n * blk_clstrsz;
+ if (image_data(blk, blk_clstrsz)) {
+ error = image_copyout_region(fd, blk, blk_clstrsz);
+ if (error)
+ break;
+ }
+ }
+ if (!error)
+ error = image_copyout_done(fd);
+
+ out:
+ if (rcblk != NULL)
+ free(rcblk);
+ if (l2tbl != NULL)
+ free(l2tbl);
+ if (rctbl != NULL)
+ free(rctbl);
+ if (l1tbl != NULL)
+ free(l1tbl);
+ if (hdr != NULL)
+ free(hdr);
+ return (error);
+}
+
+static int
+qcow1_write(int fd)
+{
+
+ return (qcow_write(fd, QCOW_VERSION_1));
+}
+
+static int
+qcow2_write(int fd)
+{
+
+ return (qcow_write(fd, QCOW_VERSION_2));
+}
+
+static struct mkimg_format qcow1_format = {
+ .name = "qcow",
+ .description = "QEMU Copy-On-Write, version 1",
+ .resize = qcow1_resize,
+ .write = qcow1_write,
+};
+FORMAT_DEFINE(qcow1_format);
+
+static struct mkimg_format qcow2_format = {
+ .name = "qcow2",
+ .description = "QEMU Copy-On-Write, version 2",
+ .resize = qcow2_resize,
+ .write = qcow2_write,
+};
+FORMAT_DEFINE(qcow2_format);
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
new file mode 100644
index 0000000..6cd332f
--- /dev/null
+++ b/usr.bin/mkimg/scheme.c
@@ -0,0 +1,190 @@
+/*-
+ * Copyright (c) 2013,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 <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+static struct {
+ const char *name;
+ enum alias alias;
+} scheme_alias[] = {
+ { "ebr", ALIAS_EBR },
+ { "efi", ALIAS_EFI },
+ { "fat16b", ALIAS_FAT16B },
+ { "fat32", ALIAS_FAT32 },
+ { "freebsd", ALIAS_FREEBSD },
+ { "freebsd-boot", ALIAS_FREEBSD_BOOT },
+ { "freebsd-nandfs", ALIAS_FREEBSD_NANDFS },
+ { "freebsd-swap", ALIAS_FREEBSD_SWAP },
+ { "freebsd-ufs", ALIAS_FREEBSD_UFS },
+ { "freebsd-vinum", ALIAS_FREEBSD_VINUM },
+ { "freebsd-zfs", ALIAS_FREEBSD_ZFS },
+ { "mbr", ALIAS_MBR },
+ { "ntfs", ALIAS_NTFS },
+ { "prepboot", ALIAS_PPCBOOT },
+ { NULL, ALIAS_NONE } /* Keep last! */
+};
+
+static struct mkimg_scheme *scheme;
+static void *bootcode;
+
+static enum alias
+scheme_parse_alias(const char *name)
+{
+ u_int idx;
+
+ idx = 0;
+ while (scheme_alias[idx].name != NULL) {
+ if (strcasecmp(scheme_alias[idx].name, name) == 0)
+ return (scheme_alias[idx].alias);
+ idx++;
+ }
+ return (ALIAS_NONE);
+}
+
+int
+scheme_select(const char *spec)
+{
+ struct mkimg_scheme *s, **iter;
+
+ SET_FOREACH(iter, schemes) {
+ s = *iter;
+ if (strcasecmp(spec, s->name) == 0) {
+ scheme = s;
+ return (0);
+ }
+ }
+ return (EINVAL);
+}
+
+struct mkimg_scheme *
+scheme_selected(void)
+{
+
+ return (scheme);
+}
+
+int
+scheme_bootcode(int fd)
+{
+ struct stat sb;
+
+ if (scheme == NULL || scheme->bootcode == 0)
+ return (ENXIO);
+
+ if (fstat(fd, &sb) == -1)
+ return (errno);
+ if (sb.st_size > scheme->bootcode)
+ return (EFBIG);
+
+ bootcode = malloc(scheme->bootcode);
+ if (bootcode == NULL)
+ return (ENOMEM);
+ memset(bootcode, 0, scheme->bootcode);
+ if (read(fd, bootcode, sb.st_size) != sb.st_size) {
+ free(bootcode);
+ bootcode = NULL;
+ return (errno);
+ }
+ return (0);
+}
+
+int
+scheme_check_part(struct part *p)
+{
+ struct mkimg_alias *iter;
+ enum alias alias;
+
+ assert(scheme != NULL);
+
+ /* Check the partition type alias */
+ alias = scheme_parse_alias(p->alias);
+ if (alias == ALIAS_NONE)
+ return (EINVAL);
+
+ iter = scheme->aliases;
+ while (iter->alias != ALIAS_NONE) {
+ if (alias == iter->alias)
+ break;
+ iter++;
+ }
+ if (iter->alias == ALIAS_NONE)
+ return (EINVAL);
+ p->type = iter->type;
+
+ /* Validate the optional label. */
+ if (p->label != NULL) {
+ if (strlen(p->label) > scheme->labellen)
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+u_int
+scheme_max_parts(void)
+{
+
+ return ((scheme == NULL) ? 0 : scheme->nparts);
+}
+
+u_int
+scheme_max_secsz(void)
+{
+
+ return ((scheme == NULL) ? INT_MAX+1U : scheme->maxsecsz);
+}
+
+lba_t
+scheme_metadata(u_int where, lba_t start)
+{
+
+ return ((scheme == NULL) ? start : scheme->metadata(where, start));
+}
+
+int
+scheme_write(lba_t end)
+{
+
+ return ((scheme == NULL) ? 0 : scheme->write(end, bootcode));
+}
diff --git a/usr.bin/mkimg/scheme.h b/usr.bin/mkimg/scheme.h
new file mode 100644
index 0000000..552d031
--- /dev/null
+++ b/usr.bin/mkimg/scheme.h
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2013,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_SCHEME_H_
+#define _MKIMG_SCHEME_H_
+
+#include <sys/linker_set.h>
+
+enum alias {
+ ALIAS_NONE, /* Keep first! */
+ /* start */
+ ALIAS_EBR,
+ ALIAS_EFI,
+ ALIAS_FAT16B,
+ ALIAS_FAT32,
+ ALIAS_FREEBSD,
+ ALIAS_FREEBSD_BOOT,
+ ALIAS_FREEBSD_NANDFS,
+ ALIAS_FREEBSD_SWAP,
+ ALIAS_FREEBSD_UFS,
+ ALIAS_FREEBSD_VINUM,
+ ALIAS_FREEBSD_ZFS,
+ ALIAS_MBR,
+ ALIAS_NTFS,
+ ALIAS_PPCBOOT,
+ /* end */
+ ALIAS_COUNT /* Keep last! */
+};
+
+struct mkimg_alias {
+ u_int alias;
+ uintptr_t type;
+#define ALIAS_PTR2TYPE(p) (uintptr_t)(p)
+#define ALIAS_INT2TYPE(i) (i)
+#define ALIAS_TYPE2PTR(p) (void *)(p)
+#define ALIAS_TYPE2INT(i) (i)
+};
+
+struct mkimg_scheme {
+ const char *name;
+ const char *description;
+ struct mkimg_alias *aliases;
+ lba_t (*metadata)(u_int, lba_t);
+#define SCHEME_META_IMG_START 1
+#define SCHEME_META_IMG_END 2
+#define SCHEME_META_PART_BEFORE 3
+#define SCHEME_META_PART_AFTER 4
+ int (*write)(lba_t, void *);
+ u_int nparts;
+ u_int labellen;
+ u_int bootcode;
+ u_int maxsecsz;
+};
+
+SET_DECLARE(schemes, struct mkimg_scheme);
+#define SCHEME_DEFINE(nm) DATA_SET(schemes, nm)
+
+int scheme_select(const char *);
+struct mkimg_scheme *scheme_selected(void);
+
+int scheme_bootcode(int fd);
+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(lba_t);
+
+#endif /* _MKIMG_SCHEME_H_ */
diff --git a/usr.bin/mkimg/tests/Makefile b/usr.bin/mkimg/tests/Makefile
new file mode 100644
index 0000000..321a5a6
--- /dev/null
+++ b/usr.bin/mkimg/tests/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= mkimg
+
+SOURCES!= cd ${.CURDIR}; echo *.uu
+${PACKAGE}FILES+= ${SOURCES:S,.gz.uu,,g}
+
+${${PACKAGE}FILES}:
+ uudecode -p ${.CURDIR}/${.TARGET}.gz.uu | gunzip -c > ${.TARGET}
+
+CLEANFILES+= ${${PACKAGE}FILES}}
+
+rebase:
+ (cd ${.CURDIR}; atf-sh mkimg.sh rebase)
+
+.include <bsd.test.mk>
diff --git a/usr.bin/mkimg/tests/Makefile.depend b/usr.bin/mkimg/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/mkimg/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow.gz.uu
new file mode 100644
index 0000000..0f8ec4e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.qcow.gz
+M'XL("*DS(E0``VEM9RTQ>#$M-#`Y-BUA<&TN<6-O=RYO=70`K9W9CAW9<47?
+M^RLN9[(XW8C(D;,$N0$_&&A;T+.4(R!`MA.R`+_PXUW%.D-5W+T9E+NI0H-$
+M(3>R3BTN":W%P_/Y]L?IU,JIZ4[->-KGT_6OTX><[OSB_L?IZ[___*]O[O[X
+M^M/MF)R_\Y3[=:,G27/WMGY?Y_3FJ>5T'G]@[OH#SMUY._LGWN[.%WLY=_73
+M[1>+GU,V:/<&3VGNG-Y/R.DU/_9^7]R7*[>G]]M]N4J^W)8-=O<&?TES?TGO
+MI^3+[=G<<&_N<%^NDB]W9'/3=V%1`LO,YI9@KH%/K6QN"^9:^-2.Y^0[W]O;
+MN0X^)6Q.X=RIS/7P*6-SS;VY\YL,=)X;X%.$.PFY&^%3A#L)N9O@4X0[";F;
+MX5.$.PFY6^!3A#L)N5OA4X0[#;G;X%.$.PVYV^%3A#N-N!/\%.%.(^X$^4X9
+M=QIQ)\AWRKC3B#M!OE/&G4;<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D.V/<
+M6<@=\ITQ[BSD#OG.&'<6<H=\9XP["[E#OC/&G87<(=\9X\Y"[I#OC''7A-PA
+MWS6,NR;D#OFN8=PU$7>*GR+<-1%WBGS7,.Z:B#M%OFL8=TW$G2+?-8R[)N).
+MD>\:QET3<:?(=PWCKHVX4^2[EG'71MPI\EW+N&M#[I#O6L9=&W*'?-<R[MJ0
+M.^2[EG'7AMPAW[6,NS;D#OFN9=RU(7?(=RWCK@NY0[[K&'==R!WR7<>XZR+N
+M##]%N.LB[@SYKF/<=1%WAGS7,>ZZB#M#ONL8=UW$G2'?=8R[+N+.D.\ZQET?
+M<6?(=SWCKH^X,^2[GG'7A]PAW_6,NS[D#OFN9]SU(7?(=SWCK@^Y0[[K&7=]
+MR!WR7<^XZT/ND.]ZQMT0<H=\-S#NAI`[Y+N!<3=$W#7X*<+=$''7(-\-C+LA
+MXJY!OAL8=T/$78-\-S#NAHB[!OEN8-P-$7<-\MW`N,O_^IO/(=^-C+LQXJY!
+MOAL9=V/('?+=R+@;0^Z0[T;&W1ARAWPW,N[&D#ODNY%Q-X;<(=^-C+LQY`[Y
+M;F3<32%WR'<3XVX*N4.^FQAW4\1=BY\BW$T1=RWRW<2XFR+N6N2[B7$W1=RU
+MR'<3XVZ*N&N1[R;&W11QUR+?38R[_']#\CGDNYEQ-T?<M<AW,^-N#KE#OIL9
+M=W/('?+=S+B;0^Z0[V;&W1QRAWPW,^[FD#ODNYEQ-X?<(=_-C+LEY`[Y;F'<
+M+2%WR'<+XVZ)N.OP4X2[)>*N0[Y;&'=+Q%V'?+<P[I:(NP[Y;F'<+1%W'?+=
+MPKA;(NXZY+N%<;=&W'7(=ROC;HVXZY#O5L;=&G*'?+<R[M:0.^2[E7&WAMPA
+MWZV,NS7D#OEN9=RM(7?(=ROC;@VY0[Y;&7=;R!WRW<:XVT+ND.\VQMT6<=?C
+MIPAW6\1=CWRW,>ZVB+L>^6YCW&T1=SWRW<:XVR+N>N2[C7&W1=SUR'<;XVZ/
+MN.N1[W;&W1YQUR/?[8R[/>0.^6YGW.TA=\AW.^-N#[E#OML9=WO('?+=SKC;
+M0^Z0[W;&W1YRAWRW$^XD_X3/`=_)F7`GYY`[X#LY$^[D''$WX*<P=Q+V=P/P
+MG;#^3L+^;@"^$];?2=C?#<!WPOH["?N[`?A.6'\G87\W`-\)Z^\D[.\&X#MA
+M_9V$_=T`?">LOY.POQN`[X3U=Q+V=P/PG;#^3L+^;@"^$];?2=C?#<!WPOH[
+M"?N[`?A.6'\G87\W`-\)Z^\D[.\&Y#O6WTG8WPW(=ZR_D["_&_%3A+NPOQN1
+M[UA_)V%_-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D
+M[.]&Y#O6WTG8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\
+MQ_H["?N[$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?3?@IPEW8WTW(=ZR_D["_
+MFY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK
+M[R3L[R;D.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=
+MA'S'^CL)^[L)^8[U=Q+V=Q/R'>OO).SO9OP4X2[L[V;D.];?2=C?S<AWK+^3
+ML+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R
+M'>OO).SO9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$
+M_=V,?,?Z.PG[NQGYCO5W$O9W"WZ*<!?V=POR'>OO).SO%N0[UM])V-\MR'>L
+MOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W
+M"_(=Z^\D[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!OF/]
+MG83]W8)\Q_H["?N[%3]%N`O[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6WTG8WZW(
+M=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2
+M]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A?[<BW['^3L+^;D6^
+M8_V=A/W=AI\BW(7]W89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?
+M;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U
+M=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_)V%_MR'?L?Y.POYN
+MQT\1[L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])
+MV-_MR'>LOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.PG[NQWY
+MCO5W$O9W._(=Z^\D[.]VY#O6WVG^B9L[U3G@N^NG,'?J^KM\G]ZI<@=\IZR_
+M4]??G1)WI\R=G?%3F#MU_=TI<7?Z2YD#OE/6WZGK[TZ'.SM#]]\IZ^_4]7?E
+M[.H<\)VR_DY=?P?F@.^4]7?J^CLP!WRGK+]3U]_EN0=U#OA.67^GKK][D.=.
+M90[X3EE_IZZ_>Y"X>U"Y`[Y3UM^IZ^\>).X>5.Z`[Y3U=^KZNP?'Q=D!WRGK
+M[]3U=^7LZASPG;+^3EU_!^:`[Y3U=^KZ.S`'?*>LOU/7W^6YAW4.^8[U=^KZ
+MNX=YKG*'?,?Z.W7]W</$W</"';K_3EE_IZZ_>YBX>UBX0_??*>OOU/5W#P]_
+M=NC^.V7]G;K^KIQ=G4.^8_V=NOX.S"'?L?Y.77\'YI#O6'^GKK_+<X_J'/(=
+MZ^_4]7>/\ESA#MU_IZR_4]??/4K</:K<(=^Q_DY=?_<H<?>H<H=\Q_H[=?W=
+MH^/B[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<XSJ'
+M?,?Z.W7]W>,\5[E#OF/]G;K^[G'B[G'A#MU_IZR_4]??/4[</2[<H?OOE/5W
+MZOJ[QX<_.W3_G;+^3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\#<\AWK+]3U]_E
+MN2=U#OF.]7?J^KLG>:YPA^Z_4];?J>OOGB3NGE3ND.]8?Z>NOWN2N'M2N4.^
+M8_V=NO[NR7%Q=LAWK+]3U]^5LZMSR'>LOU/7WX$YY#O6WZGK[\`<\AWK[]3U
+M=WGN:9U#OF/]G;K^[FF>J]PAW['^3EU_]S1Q][1PA^Z_4];?J>OOGB;NGA;N
+MT/UWROH[=?W=T\.?';K_3EE_IZZ_*V=7YY#O6'^GKK\#<\AWK+]3U]^!.>0[
+MUM^IZ^_RW+,ZAWS'^CMU_=VS/%>X0_??*>OOU/5WSQ)WSRIWR'>LOU/7WSU+
+MW#VKW"'?L?Y.77_W[+@X.^0[UM^IZ^_*V=4YY#O6WZGK[\`<\AWK[]3U=V`.
+M^8[U=^KZNSSWO,XAW['^3EU_]SS/5>Z0[UA_IZZ_>YZX>UZX0_??*>OOU/5W
+MSQ-WSPMWZ/X[9?V=NO[N^>'/#MU_IZR_4]??E;.K<\AWK+]3U]^!.>0[UM^I
+MZ^_`'/(=Z^_4]7=Y[D6=0[YC_9VZ_NY%GBO<H?OOE/5WZOJ[%XF[%Y4[Y#O6
+MWZGK[UXD[EY4[I#O6'^GKK][<5R<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.^8[U
+M=^KZ.S"'?,?Z.W7]79Z[JG/(=ZR_4]??7>6YRAWR'>OOU/5W5XF[J\(=NO].
+M67^GKK^[2MQ=%>[0_7?*^CMU_=W5X<\.W7^GK+]3U]^5LZMSR'>LOU/7WX$Y
+MY#O6WZGK[\`<\AWK[]3U=WGN99U#OF/]G;K^[F6>*]RA^^^4]7?J^KN7B;N7
+ME3OD.];?J>OO7B;N7E;ND.]8?Z>NOWMY7)P=\AWK[]3U=^7LZASR'>OOU/5W
+M8`[YCO5WZOH[,(=\Q_H[=?U=GGM5YY#O6'^GKK][E><J=\AWK+]3U]^]2MR]
+M*MRA^^^4]7?J^KM7B;M7A3MT_YVR_DY=?_?J\&>'[K]3UM^IZ^_*V=4YY#O6
+MWZGK[\`<\AWK[]3U=V`.^8[U=^KZNSSWNLXAW['^3EU_]SK/%>[0_7?*^CMU
+M_=WKQ-WKRAWR'>OOU/5WKQ-WKRMWR'>LOU/7W[T^+LX.^8[U=^KZNW)V=0[Y
+MCO5WZOH[,(=\Q_H[=?T=F$.^8_V=NOXNS[VI<\AWK+_3J+\S=/^=LOY.H_[.
+MT/UWROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.XWZ
+M.T/WWRGK[Y3T=V_K'/(=Z^_4]7=O\USA#MU_IZR_4]??O4W<O:W<(=^Q_DY=
+M?_<V<?>V<H=\Q_H[=?W=V^/B[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7
+MWX$YY#O6WUG^B9L[USG@.V/]W?4G[G&7_72NW`'?&>OOS/5WY[1W+MRA^^^,
+M]7?F^KMSXNY<N$/WWQGK[\SU=^?#GQVZ_\Y8?V>NORMG5^>`[XSU=^;Z.S`'
+M?&>LOS/7WX$YX#MC_9VY_B[/29T#OC/6WYGK[R3/%>[0_7?&^CMS_9VDUY/*
+M'?"=L?[.7'\GB3NIW`'?&>OOS/5W<ER<'?"=L?[.7']7SJ[.`=\9Z^_,]7=@
+M#OC.6']GKK\#<\!WQOH[<_U=GM,ZAWS'^CMS_9WFN<H=\AWK[\SU=YJXT\(=
+MNO_.6']GKK_3Q)T6[M#]=\;Z.W/]G1[^[-#]=\;Z.W/]73F[.H=\Q_H[<_T=
+MF$.^8_V=N?X.S"'?L?[.7'^7YZS.(=^Q_LY<?V=YKG"'[K\SUM^9Z^\L<6>5
+M.^0[UM^9Z^\L<6>5.^0[UM^9Z^_LN#@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR
+M'>OOS/5W8`[YCO5WYOJ[/-?4.>0[UM^9Z^^:/%>Y0[YC_9VY_JY)W#6%.W3_
+MG;'^SEQ_UR3NFL(=NO_.6']GKK]K#G]VZ/X[8_V=N?ZNG%V=0[YC_9VY_@[,
+M(=^Q_LY<?P?FD.]8?V>NO\MS;9U#OF/]G;G^KLUSA3MT_YVQ_LY<?]<F[MK*
+M'?(=Z^_,]7=MXJZMW"'?L?[.7'_7'A=GAWS'^CMS_5TYNSJ'?,?Z.W/]'9A#
+MOF/]G;G^#LPAW['^SEQ_E^>Z.H=\Q_H[<_U=E^<J=\AWK+\SU]]UB;NN<(?N
+MOS/6WYGK[[K$75>X0_??&>OOS/5WW>'/#MU_9ZR_,]??E;.K<\AWK+\SU]^!
+M.>0[UM^9Z^_`'/(=Z^_,]7=YKJ]SR'>LOS/7W_5YKG"'[K\SUM^9Z^_ZQ%U?
+MN4.^8_V=N?ZN3]SUE3OD.];?F>OO^N/B[)#O6']GKK\K9U?GD.]8?V>NOP-S
+MR'>LOS/7WX$YY#O6WYGK[_+<4.>0[UA_9ZZ_&_)<Y0[YCO5WYOJ[(7$W%.[0
+M_7?&^CMS_=V0N!L*=^C^.V/]G;G^;CC\V:'[[XSU=^;ZNW)V=0[YCO5WYOH[
+M,(=\Q_H[<_T=F$.^8_V=N?XNSXUU#OF.]7?F^KLQSQ7NT/UWQOH[<_W=F+@;
+M*W?(=ZR_,]??C8F[L7*'?,?Z.W/]W7A<G!WR'>OOS/5WY>SJ'/(=Z^_,]7=@
+M#OF.]7?F^CLPAWS'^CMS_5V>>U?GD.]8?V>NOWN7YRIWR'>LOS/7W[U+W+TK
+MW*'[[XSU=^;ZNW>)NW>%.W3_G;'^SEQ_]^[P9X?NOS/6WYGK[\K9U3GD.];?
+MF>OOP!SR'>OOS/5W8`[YCO5WYOJ[//>^SB'?L?[.7'_W/L\5[M#]=\;Z.W/]
+MW?O$W?O*'?(=Z^_,]7?O$W?O*W?(=ZR_,]??O3\NS@[YCO5WYOJ[<G9U#OF.
+M]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:ASR'>LOS/7WWW(<Y4[Y#O6WYGK
+M[SXD[CX4[M#]=\;Z.W/]W8?$W8?"';K_SEA_9ZZ_^W#XLT/WWQGK[\SU=^7L
+MZASR'>OOS/5W8`[YCO5WYOH[,(=\Q_H[<_U=GOM8YY#O6']GKK_[F.<*=^C^
+M.V/]G;G^[F/B[F/E#OF.]7?F^KN/B;N/E3OD.];?F>OO/AX79X=\Q_H[<_U=
+M.;LZAWS'^CMS_1V80[YC_9VY_@[,(=^Q_LY<?Y?G/M4YY#O6WYGK[S[EN<H=
+M\AWK[\SU=Y\2=Y\*=^C^.V/]G;G^[E/B[E/A#MU_9ZR_,]???3K\V:'[[XSU
+M=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSWVN<\AWK+\SU]]]
+MSG.%.W3_G;'^SEQ_]SEQ][ERAWS'^CMS_=WGQ-WGRAWR'>OOS/5WGX^+LT.^
+M8_V=N?ZNG%V=0[YC_9VY_@[,(=^Q_LY<?P?FD.]8?]?DG[BY+W4.^*YA_5WC
+M^KLO>:YR!WQW_13FKG']W9?$W9?,77/&3Y&_]]A]L5]R;_RFS*&_;[L\%<S=
+M^?'UIZMO@^VW]VO:4ZNGL]8G;JY_&[XW^"__<3/SP+U?^YN_W[?[9:Y/JUDO
+MGK.[@W+_$U]_^3<_>#MW\W[-MW#L^J.[_M_3[0^]W^^.XV\;F$-_7_G_Z\N]
+MG;/+MVN_6:63TZG74]^<NC']L[N6U';SZ?1V?SZFO__CK__XZW__UY_SW,U_
+M7W3KS</]/_-V_SD=\.W0WU?^:[ZWS0]^;_._PL^_<^]_;_/OW!;]V?)?]W[?
+MOAW=S<%??R.N/QH]M79JFIL_'G%JVYO/M78Y^//?M^WW?_S#ZS_]_,>[YX?^
+M./BO>K_N!\Y/[YS?[6^2N^=WNOM^Z,]N_;KW^^[Y]7;J>\!F/;__^=];$//[
+C_<;GUYW3^9TG\$_^B:^_O+G_G]O!YMO@3_\'*;=.DB.F````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow2.gz.uu
new file mode 100644
index 0000000..0caab8b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.qcow2.gz
+M'XL(")T[(U0``VEM9RTQ>#$M-#`Y-BUA<&TN<6-O=S(N;W5T`*V826_;,!!&
+M[_D53/>F32K.D)35/9N!'@JD#7H.O,A`@"Y&&J`7__A2ULB4J1DQ-N0(1@SB
+M>Q@/GT>FLZQ^*&6U,DZ90BVFRK^F"U3KQ?:E5M_&7T[:C]5!#=.9D&(6#&YP
+M6ZSS@`,)E^GN@N9QK>J0P4&3ZH)2."-6U[?`X(X.UJU;;\8H2N`^P!HG;L9>
+M]4%=7YPP>]8'0]>'?/]LDXL77']]6-<7IW()-TKB@$D5$FZ2Q"&3FDJX61)G
+MF-1<PI5)G&52"P&G$ZIXG&-26L)!$I<S*91P)HD;,2G).YWVKF!2DG<Z[=V$
+M24G>Z;1W4R8E>:?3WLV8E.2=3GLW9U*2=R!XIP*N9%*2=Q!Y=TBX1P&W8%*2
+M=Q!Y]YAP3S8XS:4D[R#R[BGAG@4<,^]`\@XB[YX3[D7`,?,.).\@\NXEX8X"
+MCIEW('D'D7>O"/<ZX)AY!Y)W$'EWW/%.,_,.).\P\NX-L;*`8^8=2MYAY)TF
+M'`0<,^]0\@XC[Y!P)N"8>8>2=QAY9PGG`HZ9=RAYAY%W.>%&`<?,.Y2\P\B[
+M@G!O`XZ9=RAYAY%W[PCW/N"8>8>2=QAY]X%P'P..F7<H>6<B[SX1[G/`,?/.
+M2-Z9R+M3PIT%'#/OC.2=B;P[)]S%!@=<:N-=EO$7X2X[GUD8]ONG"=^/-?,L
+M+_0`1[L`^RJL<<6@;]C6;]CO@(5PCLK6=\A1+_#R>X4YW*[/#GT@L+4P?C*;
+M>2>'TH'/+ZRNOC+]L[4P_N/@IZF_W$PY^Z#Z3I?+GR6#DT^WNQ^G/`Z[U=G%
+M^G\O2PXJ-\H5].P6RI75,E5WLYS<W=_>W_[Y?=/@JANDFU?A?)?J?DV6;'5V
+MX+TU#]S;YGX!!-S>6]749X9VSZRWPU6-]QOA+S\N+593SG_-4-96:Q:[P/%=
+M69Y=7QS_&%^W^V>&_;'!^A-5NG_0ZE_](6GW3[7K<T/WS_7V+T>5YXR;H7]_
+J_]4B-O4-W#^=4?_\2;W[+"^LKDZV_VJ@(>!@%1I73>>#_Z4*H1'E$P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.raw.gz.uu
new file mode 100644
index 0000000..3f148c0
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.raw.gz
+M'XL(".W%'50``VEM9RTQ>#$M-#`Y-BUA<&TN<F%W+F]U=`"MD\UJPS`0A.]^
+MBNFU4"/)*RD]MK2Y%4)#S\'4#@3:Q*2!7O3PE2*)R#\)+FB]"(ME/\:S:\9\
+M`"0A!9A-%E)PL`4N]T'"O+Z7-N[*&*;P,,YN=%W'E8,PQ;T'"E>6#-2,^JH4
+MR/L%LWH;`CW.Z2,.S5RJ3R@Y2]]3UWVU$SB1ZW,]KAJKD]OS.P>T@":HQW"J
+M+53KRD'=IJN/I]UI=]AO(HXL3C6N6?]'W7?=3:J3F6=+,V>[B$L9@/W9(NJC
+MW+M'YW$H9[P=A$T2D!6((!HK7+J:O8^`RV/;/J]?'CZ6Z]0_HLSZU`S_1.*?
+M_TE2_Y#J4[G]4S?]TQ6TGMC-BW\_OWX1H[[,_G$6_&/UQ'F]8%9E__%`"L!L
+."DDX8/$'F8$ZXZ<%````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.vhd.gz.uu
new file mode 100644
index 0000000..a2be9b1
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.vhd.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.vhd.gz
+M'XL("`0UQ%4``VEM9RTQ>#$M-#`Y-BUA<&TN=FAD+F]U=`"M5EUOVR`4?<^O
+MN%/?*BT"##A[7+7VK5*UJMICY3FXL[JV41.I?<C^>[E\%&R#E60X!$'(/3Z<
+M^P&$V`=`5B`[D`JDP''-07Z#>@6@%UUCIJ=N"OOVY5FUN_Y]Z9[]PH)1$EL-
+MS=&>5<#U2VI@#;Y$KG$,>P^S/+M\..^?'CP<<W#,`8D:K2H&\O?D/5S_NK+L
+M$.E7SQX-Y,6?3W;5E%VPTM]Z#80#I=$_*L].PRS_#3?+M577F58#448?WP:3
+MP4+8[$@[0496$<V4J"1L-@4GYZR.@3M?.%_84-&!4>N>@*10,QSKL/$Z3)H.
+ME??MIGG=JA$_E@D5^<F/3M:J_':9"Q7F_^P8<`SGN>V"0=F-X1*A\E_JR:$=
+M=P,M`A%^@9GM#]4+4!#SDY3,:)YW1I9?@_QT:@H6L@TI4:AF];O\B3!?^$B_
+M)N/=D_5K<5EG"%^GHB),QKE[<YT,EQ;Y<8IAC)'<8@P?PN_[9O-7)>!8J>U:
+MN&K*3G0NYTS2V1)M>ENZ1>?9W>MLV_6[_N7YWL-AH<)2:Q`/9_?4;)+L1&'?
+MJ@-]NXKRA$Q\"YZ?*AU[RKA#HO!X0@H\-(0^R#BPM28N<$W/)X!7KTI=W/[X
+M>G=U&^NG>%E^E!R@'XOTLTD2ZQ?7%IH[Q$_G-ZL?'B9U(C:#?MLW&XB>7VG]
+M&J<?:1)]?F%_LQQ^+"!SQ;18=6:A^I5AR!U@,88\Y'`IAE3-.O-8+TO'L-!5
+M5^:KS"E7780K>-65KF1EK<A15UWI2E:AJR["%;SJ(ES1JZXT!77Q`0\AJT,?
+##0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdf.gz.uu
new file mode 100644
index 0000000..7f58bbc
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.vhdf.gz
+M'XL("'`EAE4``VEM9RTQ>#$M-#`Y-BUA<&TN=FAD9BYO=70`K551:\(P$'[W
+M5QSL90@K:7))]'%C^C8HD[%'J;:5LJG%"=M#?_R2)EE36T5'XA$:SOOX[KO+
+MA1"S`)`#IT"4$6MTHO?V?&)0SUXCM>XCM^J1`8LO19V'BTY6/1H;0*K=G`!F
+MO3CF`\9=1YV\G`(:.,T/8Y!$FUB#X%?Q>ZRJSWP`CH9*U\"Q/CM>--\Q@*0@
+M$<34[J(`D6NW9;>LTL.Q/);[W=+!H8(3F0Z6M[#;IM4@.QZXMGAE;2>N*2U@
+MM[;@^&'HWL.F'$(+KPJA#"EP!HA`,T6<:Y\Z]P#GASQ_6CP_O,T7OGZ(@?F)
+M*_2CGG[FDOCZ@<]/A-9/7-1/,I!RH#=;_;Z^32,Z?H'UBXG5CZ0#^WE'G43=
+MGP%$"QB,(;?363![U[6(S,V`B0](V_(V@.O]+E\?RQ__!G,[G8MBV'0\9?HM
+M$!)HVHR83'][_.YFFW&YW3@X-_W<P\&ECF*JW*M>NKR;[GM)/QK(I&7'^B)Q
+M7[VI`((0QYW$+;O$5\_`X5^R>0$K;/1QUCET'(.S6<,UT\__\W]K:^!$X%91
+,#^7H%Z>,MH[2!P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-apm.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-apm.vmdk.gz.uu
new file mode 100644
index 0000000..4b6923a
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-apm.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-apm.vmdk.gz
+M'XL(".[%'50``VEM9RTQ>#$M-#`Y-BUA<&TN=FUD:RYO=70`K9Q;;]S($87?
+M_2L([\LB0`2>X?W!0-:1#03!`L9ZDSQN>(V%V)8@"4D,S(\/F^S3.I1$-[$J
+M[V@YY:FJZ:X>E>2O#IBFZY\DR;LDSY-\2(HR29',?[4^DC1[,.;'J>8+Y[]>
+M_OSW"_[Y\>+B_&I-!A<E(4@UG1B;]SE?//K#=*?O16U>F!^G:+K,175/`GVZ
+MT\X+N^GR^<73<R%<7;N\/+@GDBX)B9)-NN*9/>UN]GNK^\,K7SRWOLRM83[>
+MLDFJ+"D[;R9EL=A94IV6U]*DFIVF.>$/R>75W;^3R_&NO[VZN;_VZSNYLYV=
+M\]+YE[W+,&^L*MT3]X)+U[@4Y9AD0Y+!O9R<;]]??1XO_C/>WEU=?WT#;O?D
+MSC;/DKQQRW'^Z<-C8[@W29,2[CV2\Y__<OG&?W+3BYOVENE<U+R0^;WG?6C>
+MLDS<U]/'LKKQZ[W+./D_877N;'UQBN6]<_>DR).J29;E%"[W:7YY\%M>:M??
+MCNW]^.NWF_'-ZR_77T/MW-FZDC5+HGHI5)84F4OEM^;*5[B,[F.SG%IR_GQU
+M_^FJ_SAO\VY\??%#PG2EJ]U\@+5?U[KK.:3</=EYV>=W_[N?]YL,_F2OF&Y9
+MQ+*)^;V+4U)4+M=\@,M1G)(L=\_FOYH7/.\DAW-*SM=?+W[YQ_PM[HKU\<-/
+MOS!=/4?-GO,"YY!Y0YL]%>O^B\<?R^3\\5WRVFWRUT_C\@EDNF;]-G/.ZSE@
+M,4_NB:_:FMXUL=R]L)QL<MG>M\G;]FZ\^.'R\FTXV=9M-E\>\])&EZ5<4[O/
+M]U+.N7#K2:\'O1S%,'07[=#>W(^W[GC#472N1(/?J3O6_.$8M^]3+2<UN4],
+M<GZ3O+X:YC-U:?\U7G]ANG[]&,_K<!^)9@G,W)/YT[.D'_T[K)\8=TPNW7A_
+M^^VB__;YZNLP?Z,E;YAN6&LW+V<]S8?#G`]P7N&S"YQK]WHYU;`\IAO=ZH8G
+M"US.TQ<R+"J\;7+^LBSOT]@.\]+FW$PWN=6=GE^'K]2CMYJS)^>'JBUY[WRZ
+M+/4M(/.M;%.BL)SU#:6!COW]]>VZL-?2C[/'/\M>VH_S)S]2J]^9<$UGO;XR
+M??3S+-.X7(QBD]#]%$OGKS_-7Q\>UE>Z]97B66E4+4:S2??/.<7-T^V6[KNP
+M%<].HWHQAB/5*UUK&\5S>EP]_JH!>;Z?CK\+T#/3J%R,8I-NKW:%KQT]*XVJ
+MQ6@VZ?9J5_K:T;/3J%Z,X=!F*U\[>DX:Y2[\50KI@5_+RMK7CIZ91N5B%)MT
+M>[5K?.WH66E4+4:S2;=7N];7CIZ=1O5B#(<VV_G:T7/2*'=A@X`\WT_7^]K1
+M,].H7(QBDVZO=H.O'3TKC:K%:#;I]FHW^MK1L].H7HSAT&8G7SMZ3AKE+KG4
+M+H^EJU)?.WIF&I6+46S2[=2N8K^C9Z51M1C-)MU.[2KV.WIV&M6+,1S:+/L=
+M/2>-<I=":E=$T['?T3/3J%R,8I-NKW;L=_2L-*H6H]FDVZL=^QT].XWJQ1@.
+M;9;]CIZ31KE+*;4KH^G8[^B9:50N1K%)MU<[]CMZ5AI5B]%LTNW5COV.GIU&
+M]6(,AS;+?D?/2:/<A;\$09[OIV._HV>F4;D8Q2;=7NW8[^A9:50M1K-)MU<[
+M]CMZ=AK5BS$<VBS['3TGC7(7`AG(\]UT=>IK1\],HW(QBDVZG=K5['?TK#2J
+M%J/9I-NI7<U^1\].HWHQAD.;9;^CYZ11[M)([9IH.O8[>F8:E8M1;-+MU8[]
+MCIZ51M5B-)MT>[5COZ-GIU&]&,.AS;+?T7/2*'?AOY\@S_?3L=_1,].H7(QB
+MDVZO=NQW]*PTJA:CV:3;JQW['3T[C>K%&`YMEOV.GI-&N0OY(^3Y?CKV.WIF
+M&I6+46S2[=6._8Z>E4;58C2;='NU8[^C9Z=1O1C#H<VRW]%STBAWZ:5V?2Q=
+MD_K:T3/3J%R,8I-NIW8-^QT]*XVJQ6@VZ79JU[#?T;/3J%Z,X=!FV>_H.6F4
+MNPQ2NR&:COV.GIE&Y6(4FW1[M6._HV>E4;48S2;=7NW8[^C9:50OQG!HL^QW
+M])PTREU&J=T83<=^1\],HW(QBDVZO=JQW]&STJA:C&:3;J]V['?T[#2J%V,X
+MM%GV.WI.&N4ND]1NBJ9COZ-GIE&Y&,4FW5[MV._H66E4+4:S2;=7._8[>G8:
+MU8LQ'-HL^QT])XU*97H&>;Z;KDW7V@7/3*-R,8I-NIW:M;[?!<]*HVHQFDVZ
+MG=JUOM\%STZC>C&&0YOU_2YX3AKE2B;\#E&DU?I^!^%W4'X'X7>(\KO6]SL(
+MOX/R.PB_0Y3?M;[?0?@=E-]!^-V!S?I^!^%W4'X'X7>((JW6]SL(OX/R.PB_
+M0Y3?M;[?0?@=E-]!^!VB_*[U_0["[Z#\#L+O#FS6]SL(OX/R.PB_0Q1IM;[?
+M0?@=E-]!^!VB_*[U_0["[Z#\#L+O$.5WK>]W$'X'Y7<0?G=@L[[?0?@=E-]!
+M^!VB2*M+?>V$WT'Y'83?(<KO.O8[X7=0?@?A=XCRNX[]3O@=E-]!^-V!S;+?
+M";^#\CL(OT,4:77L=\+OH/P.PN\0Y7<=^YWP.RB_@_`[1/E=QWXG_`[*[R#\
+M[L!FV>^$WT'Y'83?(8JT.O8[X7=0?@?A=XCRNX[]3O@=E-]!^!VB_*YCOQ-^
+M!^5W$'YW8+/L=\+OH/P.PN\015H=^YWP.RB_@_`[1/E=QWXG_`[*[R#\#E%^
+MU['?";^#\CL(OSNP6?8[X7=0?@?A=X@BK3[UM1-^!^5W$'Z'*+_KV>^$WT'Y
+M'83?(<KO>O8[X7=0?@?A=P<VRWXG_`[*[R#\#E&DU;/?";^#\CL(OT.4W_7L
+M=\+OH/P.PN\0Y7<]^YWP.RB_@_"[`YMEOQ-^!^5W$'Z'*-+JV>^$WT'Y'83?
+M(<KO>O8[X7=0?@?A=XCRNY[]3O@=E-]!^-V!S;+?";^#\CL(OT,4:?7L=\+O
+MH/P.PN\0Y7<]^YWP.RB_@_`[1/E=SWXG_`[*[R#\[L!FV>^$WT'Y'83?(8JT
+MAM373O@=E-]!^!VB_&Y@OQ-^!^5W$'Z'*+\;V.^$WT'Y'83?'=@L^YWP.RB_
+M@_`[1)'6P'XG_`[*[R#\#E%^-[#?";^#\CL(OT.4WPWL=\+OH/P.PN\.;);]
+M3O@=E-]!^!VB2&M@OQ-^!^5W$'Z'*+\;V.^$WT'Y'83?(<KO!O8[X7=0?@?A
+M=P<VRWXG_`[*[R#\#E&D-;#?";^#\CL(OT.4WPWL=\+OH/P.PN\0Y7<#^YWP
+M.RB_@_"[`YMEOQ-^!^5W04P'>2[IDO7+IQO3M7;/2LJ?^:M0N^39U8W&^D`L
+M^L`P4UAW]?L2KNFLUQ?FVWR\2+^(,-_FXT7Z183Y-A\OTB\BS+?Y>)%^$6&^
+M;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%A
+MOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X1
+M8;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^
+M$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X1G&_;Z!?!^;:-?A&<;]OH%\'YMHU^
+M$9QOV^@7P?FVC7X1G&_;Z!?!^;:-?A&<;]OH%\'YMHU^$9QOV^@7P?FVC7X1
+MG&_;Z!?!^;:-?A&<;]OH%\'YMHU^$9QOV^@7P?FVC7X1G&_;Z!?!^;:-?A&<
+M;]OH%\'YMHU^$9QOV^@7P?FVC7X1G&_;Z!?!^;:-?A&<;]OH%\'YMHU^$9QO
+MV^@7P?FVC7X1G&_;Z!?!^;:-?A%AODW/%^D7$>;;]'R1?A%AODW/%^D7$>;;
+M]'R1?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%
+MA/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z
+M183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF
+M^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$9QOV^@7,9KJ%S&:ZA<Q
+MFNH7,9KJ%S&:ZA<QFNH7,9KJ%S&:ZA<QFNH7,9KJ%S&:ZA<QFNH7,9KJ%S&:
+MZA<QFNH7,:6IH7X1DZE^$9.I?A&3J7X1DZE^$9.I?A&3J7X1DZE^$9.I?A&3
+MJ7X1DZE^$9.I?A&3J7X1DZE^$9.I?A&3J7[QE*:IH7[Q].1>P@?3/=WLJ@_,
+ME_7EA;MWJ=[K=[VK\7<2OOO%I?GQT?IR\_4M]^MUMU<=GL1EFA#;%\X??GZN
+M?OERO]Y\N:VINXWI>K_>`^O[Z>;F\_A,NB?W8OZ]VUW394]75TS^1K_+G3MS
+MWBV7]Q0N)J[NMYOV]O[J_NKZZV],M]RO=_"W<3V^NB_MS;.K,[X7<YX?/%O^
+M"^'D$V[/-N'ZK._]F>?+<92\WW'A[J);+'?4/0WSP@OW6I$]3?C^=AS??KS\
+MX]_>?]3ZY;GQ^LH#]5-IR/I-HO5+='W6VN.\_&[]JBRIJF<^FP_UN_OO^D'D
+J^HSK5Z2^?N[^SD_^O__"^</%]K\U8>X3FJTP=S>?35_]'S/@3HZ37@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow.gz.uu
new file mode 100644
index 0000000..e9033f4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow.gz.uu
@@ -0,0 +1,125 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.qcow.gz
+M'XL("*LS(E0``VEM9RTQ>#$M-#`Y-BUB<V0N<6-O=RYO=70`K9W+CAM)DD7W
+M]174^RW1S()DA-YHH`>87<]F9EM\KOD!^OA1*2/<E<9S96ITJ01!0BHN2,^C
+M4RC5@>=Z??=MM=K8:MBNAFEU.:R^_WK^;JN??G'_^^K;__S7?[_]^=NW/^[&
+M;/V+I]*O!U_Y/'=OZQ^K-N=_/75<K:??F/O^W6CNIU<7_\:K^^G-WLZ]_./N
+MS?)SK@;CWN!JGEO/K\_$Z0V_]_J^IK=K=Z?W][U=%V]WHP:W]P;_-<_].;\^
+M%V]WI^;&>W/7]'9=O-U)S>U_"8L+6`YJ[EC,#?C42<V=B[D-/G7A.?O%Y_9N
+M;HM/F9K#/[=O5VUNAT^%FAONS:W?+D`O<R,^);BSDKL)GQ+<6<G='I\2W%G)
+MW0&?$MQ9R=T1GQ+<6<G="9\2W'G)W1F?$MR)?U_\Q-T%GQ+<><6=\5.".Z^X
+M,_*=*^Z\XL[(=ZZX\XH[(]^YXLXK[HQ\YXH[K[@S\ITK[J+BSLAWH;B+BCLC
+MWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.Z&
+MDCORW:"X&TKNR'>#XFZHN'-^2G`W5-PY^6Y0W`T5=TZ^&Q1W0\6=D^\&Q=U0
+M<>?DNT%Q-U3<.?EN4-QM*NZ<?+=1W&TJ[IQ\MU'<;4KNR'<;Q=VFY(Y\MU'<
+M;4KNR'<;Q=VFY(Y\MU'<;4KNR'<;Q=VFY(Y\MU'<;4ONR'=;Q=VVY(Y\MU7<
+M;2ON@I\2W&TK[H)\MU7<;2ON@GRW5=QM*^Z"?+=5W&TK[H)\MU7<;2ON@GRW
+M5=SM*NZ"?+=3W.TJ[H)\MU/<[4KNR'<[Q=VNY(Y\MU/<[4KNR'<[Q=VNY(Y\
+MMU/<[4KNR'<[Q=VNY(Y\MU/<C25WY+M1<3>6W)'O1L7=6'$W\%."N['B;B#?
+MC8J[L>)N(-^-BKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKOEK[_U'/EN4MQ-
+M%7<#^6Y2W$TE=^2[27$WE=R1[R;%W51R1[Z;%'=3R1WY;E+<325WY+M)<3>5
+MW)'O)L7=ON2.?+=7W.U+[LAW>\7=ON)NPT\)[O85=QORW5YQMZ^XVY#O]HJ[
+M?<7=AGRW5]SM*^XVY+N]XFY?<;<AW^T5=\O_AM1SY+N#XNY0<;<AWQT4=X>2
+M._+=07%W*+DCWQT4=X>2._+=07%W*+DCWQT4=X>2._+=07%W*+DCWQT4=\>2
+M._+=47%W++DCWQT5=\>*NRT_);@[5MQMR7='Q=VQXFY+OCLJ[HX5=UORW5%Q
+M=ZRXVY+OCHJ[8\7=EGQW5-R=*NZVY+N3XNY4<;<EWYT4=Z>2._+=27%W*KDC
+MWYT4=Z>2._+=27%W*KDCWYT4=Z>2._+=27%W*KDCWYT4=^>2._+=67%W+KDC
+MWYT5=^>*NQT_);@[5]SMR'=GQ=VYXFY'OCLK[LX5=SORW5EQ=ZZXVY'OSHJ[
+M<\7=CGQW5MQ=*NYVY+N+XNY2<;<CWUT4=Y>2._+=17%W*;DCWUT4=Y>2._+=
+M17%W*;DCWUT4=Y>2._+=17%W*;DCWUT$=[;\1,^![VPMN+-UR1WXSM:".UM7
+MW(W\%'-G97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/XSE1_9V5_-X+O
+M3/5W5O9W(_C.5']G97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/XSE1_
+M9V5_-X+O3/5W5O9W(_C.5']G97\W@N],]7=6]G<C^4[U=U;V=R/Y3O5W5O9W
+M$S\EN"O[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK
+M^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG
+M^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NST_);@K^[L]
+M^4[U=U;V=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.RO]N3[U1_9V5_MR??J?[.
+MROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[._VY#O5WUG9W^W)
+M=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]G97]W8&?$MR5_=V!?*?Z.RO[
+MNP/Y3O5W5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I
+M_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?6=G?
+M'<AWJK^SLK\[D.]4?V=E?W<@WZG^SLK^[LA/">[*_NY(OE/]G97]W9%\I_H[
+M*_N[(_E.]7=6]G='\IWJ[ZSL[X[D.]7?6=G?'<EWJK^SLK\[DN]4?V=E?W<D
+MWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[U=]9
+MV=\=R7>JO[.ROSN2[U1_9V5_=^*G!'=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG
+M^CLK^[L3^4[U=U;V=R?RG>KOK.SO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_
+M=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L[.].Y#O5
+MWUG9WYW(=ZJ_L[*_._-3@KNROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9
+M?*?Z.RO[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5']G
+M97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ[ZSL[\[D
+M.]7?6=G?7?@IP5W9WUW(=ZJ_L[*_NY#O5']G97]W(=^I_L[*_NY"OE/]G97]
+MW85\I_H[*_N["_E.]7=6]G<7\IWJ[ZSL[R[D.]7?6=G?7<AWJK^SLK^[D.]4
+M?V=E?W<AWZG^SLK^[D*^4_V=E?W=A7RG^CM??I+F5GT.?/?]*>;.4W^WW*>W
+MZMR![USU=Y[ZN]7,W6KA+M;\%'/GJ;];S=RM_FQSX#M7_9VG_FYU36<7=/^=
+MJ_[.4W_7SJ[/@>]<]7>>^CN8`]^YZN\\]7<P![YSU=]YZN^6N0=]#GSGJK_S
+MU-\]6.96;0Y\YZJ_\]3?/9BY>]"Y`]^YZN\\]7</9NX>=.[`=Z[Z.T_]W8/K
+MS=F![USU=Y[ZNW9V?0Y\YZJ_\]3?P1SXSE5_YZF_@SGPG:O^SE-_M\P]['/D
+M.]7?>>KO'BYSG3ORG>KO//5W#V?N'C;NZ/X[5_V=I_[NX<S=P\8=W7_GJK_S
+MU-\]O.:SH_OO7/5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU=\O<
+MHSY'OE/]G:?^[M$RU[BC^^]<]7>>^KM',W>/.G?D.]7?>>KO'LW</>K<D>]4
+M?^>IOWMTO3D[\IWJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.4W\'<^0[U=]YZN^6
+MN<=]CGRG^CM/_=WC9:YS1[Y3_9VG_N[QS-WCQAW=?^>JO_/4WSV>N7O<N*/[
+M[USU=Y[ZN\?7?'9T_YVK_LY3?]?.KL^1[U1_YZF_@SGRG>KO//5W,$>^4_V=
+MI_YNF7O2Y\AWJK_SU-\]6>8:=W3_G:O^SE-_]V3F[DGGCGRG^CM/_=V3F;LG
+MG3ORG>KO//5W3ZXW9T>^4_V=I_ZNG5V?(]^I_LY3?P=SY#O5WWGJ[V".?*?Z
+M.T_]W3+WM,^1[U1_YZF_>[K,=>[(=ZJ_\]3?/9VY>]JXH_OO7/5WGOJ[IS-W
+M3QMW=/^=J_[.4W_W])K/CNZ_<]7?>>KOVMGU.?*=ZN\\]7<P1[Y3_9VG_@[F
+MR'>JO_/4WRUSS_H<^4[U=Y[ZNV?+7...[K]SU=]YZN^>S=P]Z]R1[U1_YZF_
+M>S9S]ZQS1[Y3_9VG_N[9]>;LR'>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=
+MS)'O5'_GJ;];YI[W.?*=ZN\\]7?/E[G.'?E.]7>>^KOG,W?/&W=T_YVK_LY3
+M?_=\YNYYXX[NOW/5WWGJ[YY?\]G1_7>N^CM/_5T[NSY'OE/]G:?^#N;(=ZJ_
+M\]3?P1SY3O5WGOJ[9>Y%GR/?J?[.4W_W8IEKW-']=Z[Z.T_]W8N9NQ>=._*=
+MZN\\]7<O9NY>=.[(=ZJ_\]3?O;C>G!WY3O5WGOJ[=G9]CGRG^CM/_1W,D>]4
+M?^>IOX,Y\IWJ[SSU=\O<RSY'OE/]G:?^[N4RU[DCWZG^SE-_]W+F[F7CCNZ_
+M<]7?>>KO7L[<O6S<T?UWKOH[3_W=RVL^.[K_SE5_YZF_:V?7Y\AWJK_SU-_!
+M'/E.]7>>^CN8(]^I_LY3?[?,O>ISY#O5WWGJ[UXM<XT[NO_.57_GJ;][-7/W
+MJG-'OE/]G:?^[M7,W:O.'?E.]7>>^KM7UYNS(]^I_LY3?]?.KL^1[U1_YZF_
+M@SGRG>KO//5W,$>^4_V=I_YNF7O=Y\AWJK_SU-^]7N8Z=^0[U=]YZN]>S]R]
+M;MS1_7>N^CM/_=WKF;O7C3NZ_\Y5?^>IOWM]S6=']]^YZN\\]7?M[/H<^4[U
+M=Y[Z.Y@CWZG^SE-_!W/D.]7?>>KOEKDW?8Y\I_H[3_W=FV6N<4?WW[GJ[SSU
+M=V]F[MYT[LAWJK_SU-^]F;E[T[DCWZG^SE-_]^9Z<W;D.]7?>>KOVMGU.?*=
+MZN\\]7<P1[Y3_9VG_@[FR'>JO_/4WRUS;_L<^4[U=U[U=T'WW[GJ[[SJ[X+N
+MOW/5WWG5WP7=?^>JO_.JOPNZ_\Y5?^=5?Q=T_YVK_LZK_B[H_CM7_9U7_5W0
+M_7>N^CL7_=V[/D>^4_V=I_[NW3+7N*/[[USU=Y[ZNW<S=^\Z=^0[U=]YZN_>
+MS=R]Z]R1[U1_YZF_>W>].3ORG>KO//5W[>SZ'/E.]7>>^CN8(]^I_LY3?P=S
+MY#O5W\7RDS2W[G/@NU#]W?</W.-N\=.Z<P>^"]7?1>KOUO/>NG%']]^%ZN\B
+M]7?KF;MUXX[NOPO5WT7J[];7?'9T_UVH_BY2?]?.KL^![T+U=Y'Z.Y@#WX7J
+M[R+U=S`'O@O5WT7J[Y8YZW/@NU#]7:3^SI:YQAW=?Q>JOXO4W]G\\JQS![X+
+MU=]%ZN]LYLXZ=^"[4/U=I/[.KC=G![X+U=]%ZN_:V?4Y\%VH_BY2?P=SX+M0
+M_5VD_@[FP'>A^KM(_=TRYWV.?*?ZNTC]G2]SG3ORG>KO(O5W/G/GC3NZ_RY4
+M?Q>IO_.9.V_<T?UWH?J[2/V=7_/9T?UWH?J[2/U=.[L^1[Y3_5VD_@[FR'>J
+MOXO4W\$<^4[U=Y'ZNV4N^ASY3O5WD?J[6.8:=W3_7:C^+E)_%S-WT;DCWZG^
+M+E)_%S-WT;DCWZG^+E)_%]>;LR/?J?XN4G_7SJ[/D>]4?Q>IOX,Y\IWJ[R+U
+M=S!'OE/]7:3^;ID;^ASY3O5WD?J[89GKW)'O5'\7J;\;9NZ&QAW=?Q>JOXO4
+MWPTS=T/CCNZ_"]7?1>KOAFL^.[K_+E1_%ZF_:V?7Y\AWJK^+U-_!'/E.]7>1
+M^CN8(]^I_BY2?[?,;?H<^4[U=Y'ZN\TRU[BC^^]"]7>1^KO-S-VF<T>^4_U=
+MI/YN,W.WZ=R1[U1_%ZF_VUQOSHY\I_J[2/U=.[L^1[Y3_5VD_@[FR'>JOXO4
+MW\$<^4[U=Y'ZNV5NV^?(=ZJ_B]3?;9>YSAWY3O5WD?J[[<S=MG%']]^%ZN\B
+M]7?;F;MMXX[NOPO5WT7J[[;7?'9T_UVH_BY2?]?.KL^1[U1_%ZF_@SGRG>KO
+M(O5W,$>^4_U=I/YNF=OU.?*=ZN\B]7>[9:YQ1_??A>KO(O5WNYF[7>>.?*?Z
+MNTC]W6[F;M>Y(]^I_BY2?[>[WIP=^4[U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7
+MJ;^#.?*=ZN\B]7?+W-CGR'>JOXO4WXW+7.>.?*?ZNTC]W3AS-S;NZ/Z[4/U=
+MI/YNG+D;&W=T_UVH_BY2?S=>\]G1_7>A^KM(_5T[NSY'OE/]7:3^#N;(=ZJ_
+MB]3?P1SY3O5WD?J[96[J<^0[U=]%ZN^F9:YQ1_??A>KO(O5WT\S=U+DCWZG^
+M+E)_-\W<39T[\IWJ[R+U=]/UYNS(=ZJ_B]3?M;/K<^0[U=]%ZN]@CGRG^KM(
+M_1W,D>]4?Q>IOUOFWO<Y\IWJ[R+U=^^7N<X=^4[U=Y'ZN_<S=^\;=W3_7:C^
+M+E)_]W[F[GWCCNZ_"]7?1>KOWE_SV=']=Z'ZNTC]73N[/D>^4_U=I/X.YLAW
+MJK^+U-_!'/E.]7>1^KME[D.?(]^I_BY2?_=AF6O<T?UWH?J[2/W=AYF[#YT[
+M\IWJ[R+U=Q]F[CYT[LAWJK^+U-]]N-Z<'?E.]7>1^KMV=GV.?*?ZNTC]'<R1
+M[U1_%ZF_@SGRG>KO(O5WR]S'/D>^4_U=I/[NXS+7N2/?J?XN4G_W<>;N8^..
+M[K\+U=]%ZN\^SMQ];-S1_7>A^KM(_=W':SX[NO\N5'\7J;]K9]?GR'>JOXO4
+MW\$<^4[U=Y'Z.Y@CWZG^+E)_M\Q]ZG/D.]7?1>KO/BUSC3NZ_RY4?Q>IO_LT
+M<_>I<T>^4_U=I/[NT\S=I\X=^4[U=Y'ZNT_7F[,CWZG^+E)_U\ZNSY'O5'\7
+MJ;^#.?*=ZN\B]7<P1[Y3_5VD_FZ9^]SGR'>JOXO4WWU>YCIWY#O5WT7J[S[/
+MW'UNW-']=Z'ZNTC]W>>9N\^-.[K_+E1_%ZF_^WS-9T?WWX7J[R+U=^WL^ASY
+M3O5WD?H[F"/?J?XN4G\'<^0[U=]%ZN^6N2]]CGRG^KM(_=V79:YQ1_??A>KO
+M(O5W7V;NOG3NR'>JOXO4WWV9N?O2N2/?J?XN4G_WY7IS=N0[U=]%ZN_:V?4Y
+M\IWJ[R+U=S!'OE/]7:3^#N;(=ZJ_&Y:?I+FO?0Y\-ZC^;DC]W==EKG,'OOO^
+M%',WI/[NZ\S=UX6[8<U/,7=#ZN^^SMQ]_;/-T=?;;D<D/_#M;?KV[8^7/P8W
+M/U[?X*OU'G[4'_CVC[?W_VF#/RZ$V>Q6PV:UV:Y&_]U7^'___-_T"N_F_K8W
+M?#='7V#\WEQ[P?8[<S\$_]/O_.OK&[=R3W[@;N[FIK0-70C37\1?1)_I`_+5
+MT1<8_T]@N;ETY>?/\X\O4?[]O\:6OW!/-U>VS^^JOSZ*F.^]W5^\OM7MV_TA
+MT=W]WV\_S7GQ=E?WYPZ__-S^^M4]N'UU]$6\_Y-/QLW5(;_Y)_>OD?M_<N_F
+D_.\5P>Z'6?[RW!Y^U!_X]J^W]_^Y&QQ^#/[Q_[+N5S>!I0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow2.gz.uu
new file mode 100644
index 0000000..34b715e6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.qcow2.gz
+M'XL(")X[(U0``VEM9RTQ>#$M-#`Y-BUB<V0N<6-O=S(N;W5T`*V8VY+20!"&
+M[WF*6<^NBIGN24@\K+KK6N6=WN@UL/`4/+P;ILDDG?XS2`52J:*&_ZN>S)=F
+M0E'$EW.E=Z%RH7'[C7O\+`>YWH?AX0Z_?_Q<]E^'183Y`J2,@<`=;L"Z2SA"
+MN,*/![R-ZU7'!HY.J3$HAPNPNJD!`W>].%ZZXV+4*L&7`",.+L9%]5&L3R?"
+MA?71W/6Q??W*4TX/5-/U<:Q/IU8(5V=Q9*0:A%MG<6RD-@BWS>*"D7I`N%T6
+M5QJI/<#YC"J/N,I(>82C+&YEI!CA0A97&RGDG<][UQ@IY)W/>[<V4L@[G_=N
+M8Z20=S[OW=9((>]\WKL'(X6\(^"=2[B=D4+>D?+N2G!/$FYOI)!WI+Q[*KAG
+M'<Y;*>0=*>^>"^Y%PAG]CI!WI+Q[*;A7"6?T.T+>D?+NM>"N$\[H=X2\(^7=
+M&\&]33BCWQ'RCI1W[T;>>:/?$?*.E7?OA54DG-'O&'G'RCLO.$HXH]\Q\HZ5
+M=RRXD'!&OV/D'2OO2L%5"6?T.T;>L?)N);@ZX8Q^Q\@[5MXU@ON0<$:_8^0=
+M*^\^"NY3PAG]CI%WK+S[++B;A#/Z'2/O@O+NB^"^)IS1[P+R+BCOO@GN-N&,
+M?A>0=T%Y=R>X[QV.K%3G75'8A^#N1_<LS;O_#&E_[(TS'I@`UO\#G*HPXII9
+M)US&";<:K(TS'CC<+H?O#GA<X7+5KFI9N9K.K?#O_9_QA,L95SCB\..H#'0%
+M^W-PQ\?1WC?K_N8"#@PW%U<)-_DXVNZQ=]8`K*Z<61:J5:Z_SJ[9'Q]23MU=
+M;<VZ]76I/D-F&DQWHCXWGF[[J]$]W:E5;'&4F:X;XC:3:SM=W=6XNNW,B\'Z
+MSCCSSFTAPSLWXFC>1D#Q?ZFB_=;XC`<.OY;#=P0&`<YV!4/5]K[%/SE0:JE#
+#$P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.raw.gz.uu
new file mode 100644
index 0000000..d48f343
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.raw.gz.uu
@@ -0,0 +1,10 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.raw.gz
+M'XL(".[%'50``VEM9RTQ>#$M-#`Y-BUB<V0N<F%W+F]U=`"ME,$.@R`,AN\^
+M1;WN0$J%Z:Y+=M]I.SNS/04//U!4*@-=0C$DI.V7O]2".!F`(L#^QYYVF*O@
+MRU2G:J21`^H6E`9]ALZ&X_JQ`W.8Y^TA0C,>)W-9:9S8V(RC/=PB6![!-2XK
+MB+1J22ZXE&/"U9Y5KSB54V<1^/ZK6%WJ[N;>=IN\L,^`'\`!L/,^XL"EO[#J
+MN\0RB)6;T0=QN;W#M3Q>!CC:*1<X[I7M;5Y=':L;"C>CV4[&P<EU$#ZY$X[*
+C/@0TOBSV#[11\9YVF+O@:P(J#RQV@XH<L/H"TT^@ZP4%````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhd.gz.uu
new file mode 100644
index 0000000..f933544
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.vhd.gz
+M'XL("`<UQ%4``VEM9RTQ>#$M-#`Y-BUB<V0N=FAD+F]U=`"METUOPR`,AN_]
+M%9YVZZ0('`+9=5+O.ZWG-$VW:MJ'UAYZR/[[[`12R-?:C8124O"3U\8@*D1[
+M`>@4]`YT!3KCME&@[\'D`-1I"S:UM(]0EQ_O57G<GQ)[U8L6)H5O%9JS/::@
+MZ"4&L."7Z"VWH7:8Y';UO-R_/3L<6AQ:4&;8*D70F\%[%/V:M^J8M-[C:X-\
+M>.G4I4-U9ROZF"T(!5)Z(U*GCC#)=^BL(JO=KBD&1-7$QY7@(>@X.]N+729Z
+M5I[,L:"*L[-C.#UG=0UNN;!ST:8*)8:A6H"68)#;E#8N#H-"J7(Z?!9?AZJG
+M#R=217?ZY*`OG787;:J@&VP5*$[G.7>AH1S[N)%4^5?T=&BG;(."(#+7@8W[
+M8?3.*/#U:2EF8CX]&9/Z"M9'BT$4(_5T1_V0A'<'+!E(ZY66>Z8AQTLCN%X]
+MC<UO.9$N?UP=)?Z&ZP3+2W"I7;MN9*H`N]URLJ/!J9L6Q=\.I^;4<<Y45SF;
+M14[F,N_9^?,,N`%1@LB]K/:`/+]W-I^=OONA#`S<G=$'0W<+QIEPO/1P^(N[
+M$.(VLW,[J\[-K8\K(T_&MK\R+ERY#`E7;HO#N!L!-CL+92"-&M;3'?5C$MXM
+M$.U6%6WO0[=5Q5*H+#":0@)6D15B-9MLUV:AM@HC'209%_$@R;B(!TG&13Q(
+<,B[B09)Q$0^2C(MZD-3T%T&(Q0_L]):$?0P`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdf.gz.uu
new file mode 100644
index 0000000..27582ee
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdf.gz.uu
@@ -0,0 +1,13 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.vhdf.gz
+M'XL("',EAE4``VEM9RTQ>#$M-#`Y-BUB<V0N=FAD9BYO=70`K90[;X0P#(!W
+M?H6E+N@&E)@DP%KI=J9V!@HG5+5=.G3@QS<&`C&ONU:$*`(Y_O!;B&$!*`11
+M;)S[@NXYXD\77(*>A@34"2@-VD!JKXMYLP\FZ%ZO+Y&_NA$GC[3V<=%B.1S>
+MPTT&RT=P,6E)1L%TPNT)!EPXLL(9IXZLLY$0]9^<U6?%SN4V7>CY>0;9@-`@
+MG)?(@5-^8;8O6YN!S-T#^V#M;D&XA-^7'@[ON`L<5Q[F]MBZ<&U==7(RXF5G
+M/-BY!.&=.^#PW$&`_62Q%6AOK<]]09='_!F`:@2>%D$]SCX3@VG`U&`TO2<*
+M3`9)Z@.15U)7?7W6U7?[XV>8<)20IMG>I(\Q=8M)``OZB7FC=\^^I^OMTG[<
+M',Z-*C>1;+-9K1C!E"MW]:+96GSOD?EL7;P.DO:CEQD0"J1DCH_6Y;R<":<F
+F9^L&2M7'QVWVP02;HXIP6BRT_IO;`6=.+A5;?,$O]2/CMC`'````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-bsd.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vmdk.gz.uu
new file mode 100644
index 0000000..ac4864b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-bsd.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-bsd.vmdk.gz
+M'XL("._%'50``VEM9RTQ>#$M-#`Y-BUB<V0N=FUD:RYO=70`K9S=;]O*$<7?
+M\U<0SDO0!X%'_'X(T*9.@:(H$-Q<W/M:\:LQFL2!;10-H#^^7'+/^M`RO<3U
+M.'+$C69&.[/2V/G-@=)T^4J2O$WR/,G[I"B3%,GT3\LM2;/'Q70[UGS@_(_K
+M?_YVX->[P^'\9@D&YR4N2#6<+%;/<SX\^6*XXTM>JP>FVS$:+G->[86C#W?<
+M>&`S7#X]>'S.A;L[S0_W[D+")2%0L@I7/)/39K(O[>Y/;WSQW/XRMX?I>,LF
+MJ;*D;/TR*8MYG275<7XL3:K):)P"ODVN;^[_DUP/]]W=S8^'6[^_HSO;R3@O
+MG7W9N0A38E7I+MP#+ESC0I1#DO5)!O=P<K[[V\W7X?#?X>[^YO;[>S#=HSO;
+M/$ORQFW'V:>/M]7"/4F:E'#/D9S_^O?K]_Z5FQY^G.X8SGE-&YF>>\I#XY9E
+MXKXO;_/NAN\/+N+HO\+NW-GZXA3S<^?NHLB3JDGF[10N]G%ZN/<IS[7K[H;3
+MP_#KSQ_#^ZMOM]]#[=S9NI(U<Z!Z+E26%)D+Y5-SY2M<1/>RF4\M.7^]>?AR
+MTWV>TKP?K@YO$X8K7>VF`ZS]OI:L)Y=R\V2G;9\__N]ARC?I_<G>,-R\B3F)
+MZ;F+8U)4+M9T@/-1'),L=U?3/TT;GC+)X8R2\^WWPR^_3V]Q5ZS/G_[R"\/5
+MD]=D.6UP<ID26N54+/D73U^6R?GSQ^3*)?GKEV%^!3)<L[S-G/%R#IB71W?A
+MJ[:$=TTL=P_,)YM<GQY.R8?3_7!X>WW](9SLR26;S[=I:X.+4BZAW>M[+N=4
+MN.6DEX.>CZ+OV\.I/_UX&.[<\8:C:%V)>I^I.];\\1C7SU/-)S6Z5TQR?I]<
+MW?33F;JP_QYNOS%<M[R,IWVXET0S.V;N8GKUS.$'_PS+*\8=DPLW/-S]/'0_
+MO]Y\[Z<W6O*>X?JE=M-VEM-\/,SI`*<=/KO!J797\ZF&[3'<X';77VQP/D]?
+MR+"I\+3)^=N\O2_#J9^V-L5FN-'M[OC\/GREGCS5%#TY/U9MCGOOPV6I;P&9
+M;V6K$H7M+$\H#73H'F[OEHU=23_.GOXL>VT_SB]^I%9_,.`2SGI_9?KDYUFF
+M?KDLBE5`]U,LG;[_/'U_>MQ?Z?97BF6E7K4LFE6X?TTA?ERF6[IWX4DL6_7J
+M9-'OJ5[I6ML@EN/3ZO%7#<CU=CC^+D#+3+UR612K<%NU*WSM:%FI5RV+9A5N
+MJW:EKQTM6_7J9-'O2K;RM:/EJ%[NCK]*(=WQ:UE9^]K1,E.O7!;%*MQ6[1I?
+M.UI6ZE7+HEF%VZK=R=>.EJUZ=;+H=R7;^MK1<E0O=\<&`;G>#M?YVM$R4Z]<
+M%L4JW%;M>E\[6E;J5<NB687;JMW@:T?+5KTZ6?2[DAU][6@YJI>[RZ5V>2Q<
+ME?K:T3)3KUP6Q2K<1NTJ]CM:5NI5RZ)9A=NH7<5^1\M6O3I9]+N29;^CY:A>
+M[JZ0VA71<.QWM,S4*Y=%L0JW53OV.UI6ZE7+HEF%VZH=^QTM6_7J9-'O2I;]
+MCI:C>KF[4FI71L.QW]$R4Z]<%L4JW%;MV.]H6:E7+8MF%6ZK=NQWM&S5JY-%
+MORM9]CM:CNKE[OA+$.1Z.QS['2TS]<IE4:S";=6._8Z6E7K5LFA6X;9JQWY'
+MRU:].EGTNY)EOZ/EJ%[NCD`&<KT9KDY][6B9J5<NBV(5;J-V-?L=+2OUJF71
+MK,)MU*YFOZ-EJUZ=+/I=R;+?T7)4+W?72.V::#CV.UIFZI7+HEB%VZH=^QTM
+M*_6J9=&LPFW5COV.EJUZ=;+H=R7+?D?+4;W<'?__!+G>#L=^1\M,O7)9%*MP
+M6[5COZ-EI5ZU+)I5N*W:L=_1LE6O3A;]KF39[V@YJI>[(W^$7&^'8[^C9:9>
+MN2R*5;BMVK'?T;)2KUH6S2K<5NW8[VC9JE<GBWY7LNQWM!S5R]UU4KLN%JY)
+M?>UHF:E7+HMB%6ZC=@W['2TK]:IET:S";=2N8;^C9:M>G2SZ7<FRW]%R5"]W
+MUTOM^F@X]CM:9NJ5RZ)8A=NJ'?L=+2OUJF71K,)MU8[]CI:M>G6RZ'<ERWY'
+MRU&]W-T@M1NBX=CO:)FI5RZ+8A5NJW;L=[2LU*N61;,*MU4[]CM:MNK5R:+?
+ME2S['2U']7)WH]1NC(9COZ-EIEZY+(I5N*W:L=_1LE*O6A;-*MQ6[=CO:-FJ
+M5R>+?E>R['>T'-4KE>D9Y'HSW"E=:A<L,_7*95&LPFW4[N3[7;"LU*N61;,*
+MMU&[D^]WP;)5KTX6_:YD?;\+EJ-ZN9()OT,4:9U\OX/P.RB_@_`[1/G=R?<[
+M"+^#\CL(OT.4WYU\OX/P.RB_@_"['<GZ?@?A=U!^!^%WB"*MD^]W$'X'Y7<0
+M?H<HOSOY?@?A=U!^!^%WB/*[D^]W$'X'Y7<0?K<C6=_O(/P.RN\@_`Y1I'7R
+M_0["[Z#\#L+O$.5W)]_O(/P.RN\@_`Y1?G?R_0["[Z#\#L+O=B3K^QV$WT'Y
+M'83?(8JTVM373O@=E-]!^!VB_*YEOQ-^!^5W$'Z'*+]KV>^$WT'Y'83?[4B6
+M_4[X'93?0?@=HDBK9;\3?@?E=Q!^ARB_:]GOA-]!^1V$WR'*[UKV.^%W4'X'
+MX7<[DF6_$WX'Y7<0?H<HTFK9[X3?0?D=A-\ARN]:]COA=U!^!^%WB/*[EOU.
+M^!V4WT'XW8YDV>^$WT'Y'83?(8JT6O8[X7=0?@?A=XCRNY;]3O@=E-]!^!VB
+M_*YEOQ-^!^5W$'ZW(UGV.^%W4'X'X7>((JTN];43?@?E=Q!^ARB_Z]COA-]!
+M^1V$WR'*[SKV.^%W4'X'X7<[DF6_$WX'Y7<0?H<HTNK8[X3?0?D=A-\ARN\Z
+M]COA=U!^!^%WB/*[COU.^!V4WT'XW8YDV>^$WT'Y'83?(8JT.O8[X7=0?@?A
+M=XCRNX[]3O@=E-]!^!VB_*YCOQ-^!^5W$'ZW(UGV.^%W4'X'X7>((JV._4[X
+M'93?0?@=HORN8[\3?@?E=Q!^ARB_Z]COA-]!^1V$W^U(EOU.^!V4WT'X':)(
+MJT]][83?0?D=A-\ARN]Z]COA=U!^!^%WB/*[GOU.^!V4WT'XW8YDV>^$WT'Y
+M'83?(8JT>O8[X7=0?@?A=XCRNY[]3O@=E-]!^!VB_*YGOQ-^!^5W$'ZW(UGV
+M.^%W4'X'X7>((JV>_4[X'93?0?@=HORN9[\3?@?E=Q!^ARB_Z]GOA-]!^1V$
+MW^U(EOU.^!V4WT'X':)(JV>_$WX'Y7<0?H<HO^O9[X3?0?D=A-\ARN]Z]COA
+M=U!^!^%W.Y)EOQ-^!^5W04P'N99PR?+MPPWI4KMG)>7/_%.H7?+L[@9C?2!F
+M?6"8*2Q9_;&`2SCK_87Y-F^OTB\BS+=Y>Y5^$6&^S=NK](L(\VW>7J5?1)AO
+MF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28
+M;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$
+MF&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?
+M1)AOF^@7$>;;)OI%A/FVB7X18;YMHE\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?
+M!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$
+MY]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3G
+MVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;
+M-OI%<+YMHU\$Y]LV^D5POFVC7T28;]/R5?I%A/DV+5^E7T28;]/R5?I%A/DV
+M+5^E7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X1
+M8;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^
+M$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)
+M?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?!.?;-OI%#*;Z10RF^D4,
+MIOI%#*;Z10RF^D4,IOI%#*;Z10RF^D4,IOI%#*;Z10RF^D4,IOI%#*;Z10RF
+M^D4,IOI%C&EJJ%_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1H
+MJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1HJE\\IFEJJ%\\7GR6\,YPE\DN^L!\
+MWM_RZ:"7?V\_</YP6/\)`></V"TJ]T&G19G4Q[T[_/WC;\\DG!_-$E["77QX
+M\M-P8<,[/HLYGS]@5RU3_4#HS0>6<.]\K'>/X?*7=J=SBGW)&G]X<CY_B*W:
+MZCG/[Y+B<1[_Y+T1SC=YW%]SN8WC*MT7]I=<INN:J'Y\J)[BZMVZD6ZR#M>^
+M>+8O[^[=Y>XZX\.X^"C6G>]<%V3]SEW"'6T;03EWEF7X?_GW]@/G3X?UGR5@
+-/@=\\W^I>^KAH%T`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow.gz.uu
new file mode 100644
index 0000000..0dfdc6c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.qcow.gz
+M'XL("*TS(E0``VEM9RTQ>#$M-#`Y-BUE8G(N<6-O=RYO=70`K9W9CAS7<D7?
+M]17%>28K(K*J,CGC`C;@M^L'VZ^WQN?Z`'Z\.62>TQVU-D.V1#4$$F1N5)U>
+M6H2DQ=/K]:]OJ]7&5L-V-4RKRV'U_<?SAZWN_.#^Q^K;?_[[?[R]^^W;'[_&
+M;/V;I]*/!U_%/'=OZQ_K-N<_GCJNUM.?F/O^831WY]7%_^'5W7FSMW,O__CU
+M9ODY5X/WW^YJGEO>KHG3&_[<Z_N:WJ[].KV_[^VZ>+L;-;B]-_C/>>Y?\^MS
+M\79W:FZ\-W=-;]?%VYW4W/ZWL+B`Y:#FCL7<@$^=U-RYF-O@4Q>>L]]\;G_-
+M;?$I4W..<ZLVM\.G0LT-]^;6;Q>@E[D1GQ+<6<G=A$\)[JSD;H]/">ZLY.Z`
+M3PGNK.3NB$\)[JSD[H1/">Z\Y.Z,3PGNO.3N@D\)[KSBSO@IP9U7W!GYSA5W
+M7G%GY#M7W'G%G9'O7''G%7=&OG/%G5?<&?G.%7=1<6?DNU#<1<6=D>]"<1<E
+M=^2[4-Q%R1WY+A1W47)'O@O%793<D>]"<1<E=^2[4-Q%R1WY+A1W0\D=^6Y0
+MW`TE=^2[07$W5-PY/R6X&RKNG'PW*.Z&BCLGWPV*NZ'BSLEW@^)NJ+AS\MV@
+MN!LJ[IQ\-RCN-A5W3K[;*.XV%7=.OMLH[C8E=^2[C>)N4W)'OMLH[C8E=^2[
+MC>)N4W)'OMLH[C8E=^2[C>)N4W)'OMLH[K8E=^2[K>)N6W)'OMLJ[K85=\%/
+M">ZV%7=!OMLJ[K85=T&^VRKNMA5W0;[;*NZV%7=!OMLJ[K85=T&^VRKN=A5W
+M0;[;*>YV%7=!OMLI[G8E=^2[G>)N5W)'OMLI[G8E=^2[G>)N5W)'OMLI[G8E
+M=^2[G>)N5W)'OMLI[L:2._+=J+@;2^[(=Z/B;JRX&_@IP=U8<3>0[T;%W5AQ
+M-Y#O1L7=6'$WD.]&Q=U8<3>0[T;%W5AQ-Y#O1L7=\I^_]1SY;E+<315W`_EN
+M4MQ-)7?DNTEQ-Y7<D>\FQ=U4<D>^FQ1W4\D=^6Y2W$TE=^2[27$WE=R1[R;%
+MW;[DCGRW5]SM2^[(=WO%W;[B;L-/">[V%7<;\MU><;>ON-N0[_:*NWW%W89\
+MMU?<[2ON-N2[O>)N7W&W(=_M%7?+_X;4<^2[@^+N4'&W(=\=%'>'DCORW4%Q
+M=RBY(]\=%'>'DCORW4%Q=RBY(]\=%'>'DCORW4%Q=RBY(]\=%'?'DCORW5%Q
+M=RRY(]\=%7?'BKLM/R6X.U;<;<EW1\7=L>)N2[X[*NZ.%7=;\MU1<7>LN-N2
+M[XZ*NV/%W99\=U3<G2KNMN2[D^+N5'&W)=^=%'>GDCORW4EQ=RJY(]^=%'>G
+MDCORW4EQ=RJY(]^=%'>GDCORW4EQ=RJY(]^=%'?GDCORW5EQ=RZY(]^=%7?G
+MBKL=/R6X.U?<[<AW9\7=N>)N1[X[*^[.%7<[\MU9<7>NN-N1[\Z*NW/%W8Y\
+M=U;<72KN=N2[B^+N4G&W(]]=%'>7DCORW45Q=RFY(]]=%'>7DCORW45Q=RFY
+M(]]=%'>7DCORW45Q=RFY(]]=!'>V?$?/@>]L+;BS=<D=^,[6@CM;5]R-_!1S
+M9V5_-X+O3/5W5O9W(_C.5']G97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V
+M=R/XSE1_9V5_-X+O3/5W5O9W(_C.5']G97\W@N],]7=6]G<C^,Y4?V=E?S>"
+M[TSU=U;V=R/XSE1_9V5_-X+O3/5W5O9W(_E.]7=6]G<C^4[U=U;V=Q,_);@K
+M^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG
+M^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[
+MB7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[L]/R6X*_N[/?E.]7=6
+M]G=[\IWJ[ZSL[_;D.]7?6=G?[<EWJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^
+M4_V=E?W=GGRG^CLK^[L]^4[U=U;V=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.R
+MO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V!GQ+<E?W=@7RG^CLK^[L#^4[U
+M=U;V=P?RG>KOK.SO#N0[U=]9V=\=R'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N
+M0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_
+ML[*_.Y#O5']G97]W(-^I_L[*_N[(3PGNRO[N2+Y3_9V5_=V1?*?Z.RO[NR/Y
+M3O5W5O9W1_*=ZN^L[.^.Y#O5WUG9WQW)=ZJ_L[*_.Y+O5']G97]W)-^I_L[*
+M_NY(OE/]G97]W9%\I_H[*_N[(_E.]7=6]G='\IWJ[ZSL[X[D.]7?6=G?'<EW
+MJK^SLK\[DN]4?V=E?W?BIP1W97]W(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[
+M$_E.]7=6]G<G\IWJ[ZSL[T[D.]7?6=G?G<AWJK^SLK\[D>]4?V=E?W<BWZG^
+MSLK^[D2^4_V=E?W=B7RG^CLK^[L3^4[U=U;V=R?RG>KOK.SO3N0[U=]9V=^=
+MR'>JO[.ROSOS4X*[LK\[D^]4?V=E?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK
+M^[LS^4[U=U;V=V?RG>KOK.SOSN0[U=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?
+MJ?[.RO[N3+Y3_9V5_=V9?*?Z.RO[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9
+MWUWX*<%=V=]=R'>JO[.RO[N0[U1_9V5_=R'?J?[.RO[N0KY3_9V5_=V%?*?Z
+M.RO[NPOY3O5W5O9W%_*=ZN^L[.\NY#O5WUG9WUW(=ZJ_L[*_NY#O5']G97]W
+M(=^I_L[*_NY"OE/]G97]W85\I_H[7[Z3YE9]#GSW_2GFSE-_M]RGM^K<@>]<
+M]7>>^KO5S-UJX2[6_!1SYZF_6\W<K?[5YL!WKOH[3_W=ZIK.+NC^.U?]G:?^
+MKIU=GP/?N>KO//5W,`>^<]7?>>KO8`Y\YZJ_\]3?+7,/^ASXSE5_YZF_>[#,
+MK=H<^,Y5?^>IOWLP<_>@<P>^<]7?>>KO'LS</>C<@>]<]7>>^KL'UYNS`]^Y
+MZN\\]7?M[/H<^,Y5?^>IOX,Y\)VK_LY3?P=SX#M7_9VG_FZ9>]CGR'>JO_/4
+MWSU<YCIWY#O5WWGJ[Q[.W#ULW-']=Z[Z.T_]W<.9NX>-.[K_SE5_YZF_>WC-
+M9T?WW[GJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.4W\'<^0[U=]YZN^6N4=]CGRG
+M^CM/_=VC9:YQ1_??N>KO//5WCV;N'G7NR'>JO_/4WSV:N7O4N2/?J?[.4W_W
+MZ'IS=N0[U=]YZN_:V?4Y\IWJ[SSU=S!'OE/]G:?^#N;(=ZJ_\]3?+7./^QSY
+M3O5WGOJ[Q\M<YXY\I_H[3_W=XYF[QXT[NO_.57_GJ;][/'/WN'%']]^YZN\\
+M]7>/K_GLZ/X[5_V=I_ZNG5V?(]^I_LY3?P=SY#O5WWGJ[V".?*?Z.T_]W3+W
+MI,^1[U1_YZF_>[+,->[H_CM7_9VG_N[)S-V3SAWY3O5WGOJ[)S-W3SIWY#O5
+MWWGJ[YY<;\Z.?*?Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KME
+M[FF?(]^I_LY3?_=TF>O<D>]4?^>IOWLZ<_>T<4?WW[GJ[SSU=T]G[IXV[NC^
+M.U?]G:?^[NDUGQW=?^>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_G
+MJ;];YI[U.?*=ZN\\]7?/EKG&'=U_YZJ_\]3?/9NY>]:Y(]^I_LY3?_=LYNY9
+MYXY\I_H[3_W=L^O-V9'O5'_GJ;]K9]?GR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^
+MSE-_M\P][W/D.]7?>>KOGB]SG3ORG>KO//5WSV?NGC?NZ/X[5_V=I_[N^<S=
+M\\8=W7_GJK_SU-\]O^:SH_OO7/5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y
+M\IWJ[SSU=\O<BSY'OE/]G:?^[L4RU[BC^^]<]7>>^KL7,W<O.G?D.]7?>>KO
+M7LS<O>C<D>]4?^>IOWMQO3D[\IWJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.4W\'
+M<^0[U=]YZN^6N9=]CGRG^CM/_=W+9:YS1[Y3_9VG_N[ES-W+QAW=?^>JO_/4
+MW[V<N7O9N*/[[USU=Y[ZNY?7?'9T_YVK_LY3?]?.KL^1[U1_YZF_@SGRG>KO
+M//5W,$>^4_V=I_YNF7O5Y\AWJK_SU-^]6N8:=W3_G:O^SE-_]VKF[E7GCGRG
+M^CM/_=VKF;M7G3ORG>KO//5WKZXW9T>^4_V=I_ZNG5V?(]^I_LY3?P=SY#O5
+MWWGJ[V".?*?Z.T_]W3+WNL^1[U1_YZF_>[W,=>[(=ZJ_\]3?O9ZY>]VXH_OO
+M7/5WGOJ[US-WKQMW=/^=J_[.4W_W^IK/CNZ_<]7?>>KOVMGU.?*=ZN\\]7<P
+M1[Y3_9VG_@[FR'>JO_/4WRUS;_H<^4[U=Y[ZNS?+7...[K]SU=]YZN_>S-R]
+MZ=R1[U1_YZF_>S-S]Z9S1[Y3_9VG_N[-]>;LR'>JO_/4W[6SZW/D.]7?>>KO
+M8(Y\I_H[3_T=S)'O5'_GJ;];YM[V.?*=ZN^\ZN^"[K]SU=]YU=\%W7_GJK_S
+MJK\+NO_.57_G57\7=/^=J_[.J_XNZ/X[5_V=5_U=T/UWKOH[K_J[H/OO7/5W
+M+OJ[=WV.?*?Z.T_]W;MEKG%']]^YZN\\]7?O9N[>=>[(=ZJ_\]3?O9NY>]>Y
+M(]^I_LY3?_?N>G-VY#O5WWGJ[]K9]3GRG>KO//5W,$>^4_V=I_X.YLAWJK^+
+MY3MI;MWGP'>A^KOO/W&/N\5/Z\X=^"Y4?Q>IOUO/>^O&'=U_%ZJ_B]3?K6?N
+MUHT[NO\N5'\7J;];7_/9T?UWH?J[2/U=.[L^![X+U=]%ZN]@#GP7JK^+U-_!
+M'/@N5'\7J;];YJS/@>]"]7>1^CM;YAIW=/]=J/XN4G]G\\NSSAWX+E1_%ZF_
+MLYD[Z]R![T+U=Y'Z.[O>G!WX+E1_%ZF_:V?7Y\!WH?J[2/T=S('O0O5WD?H[
+MF`/?A>KO(O5WRYSW.?*=ZN\B]7>^S'7NR'>JOXO4W_G,G3?NZ/Z[4/U=I/[.
+M9^Z\<4?WWX7J[R+U=W[-9T?WWX7J[R+U=^WL^ASY3O5WD?H[F"/?J?XN4G\'
+M<^0[U=]%ZN^6N>ASY#O5WT7J[V*9:]S1_7>A^KM(_5W,W$7GCGRG^KM(_5W,
+MW$7GCGRG^KM(_5U<;\Z.?*?ZNTC]73N[/D>^4_U=I/X.YLAWJK^+U-_!'/E.
+M]7>1^KME;NASY#O5WT7J[X9EKG-'OE/]7:3^;IBY&QIW=/]=J/XN4G\WS-P-
+MC3NZ_RY4?Q>IOQNN^>SH_KM0_5VD_JZ=79\CWZG^+E)_!W/D.]7?1>KO8(Y\
+MI_J[2/W=,K?I<^0[U=]%ZN\VRUSCCNZ_"]7?1>KO-C-WF\X=^4[U=Y'ZN\W,
+MW:9S1[Y3_5VD_FYSO3D[\IWJ[R+U=^WL^ASY3O5WD?H[F"/?J?XN4G\'<^0[
+MU=]%ZN^6N6V?(]^I_BY2?[==YCIWY#O5WT7J[[8S=]O&'=U_%ZJ_B]3?;6?N
+MMHT[NO\N5'\7J;_;7O/9T?UWH?J[2/U=.[L^1[Y3_5VD_@[FR'>JOXO4W\$<
+M^4[U=Y'ZNV5NU^?(=ZJ_B]3?[9:YQAW=?Q>JOXO4W^UF[G:=._*=ZN\B]7>[
+MF;M=YXY\I_J[2/W=[GIS=N0[U=]%ZN_:V?4Y\IWJ[R+U=S!'OE/]7:3^#N;(
+M=ZJ_B]3?+7-CGR/?J?XN4G\W+G.=._*=ZN\B]7?CS-W8N*/[[T+U=Y'ZNW'F
+M;FS<T?UWH?J[2/W=>,UG1_??A>KO(O5W[>SZ'/E.]7>1^CN8(]^I_BY2?P=S
+MY#O5WT7J[Y:YJ<^1[U1_%ZF_FY:YQAW=?Q>JOXO4WTTS=U/GCGRG^KM(_=TT
+M<S=U[LAWJK^+U-]-UYNS(]^I_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W,$>^
+M4_U=I/YNF7O?Y\AWJK^+U-^]7^8Z=^0[U=]%ZN_>S]R];]S1_7>A^KM(_=W[
+MF;OWC3NZ_RY4?Q>IOWM_S6=']]^%ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^+E)_
+M!W/D.]7?1>KOEKD/?8Y\I_J[2/W=AV6N<4?WWX7J[R+U=Q]F[CYT[LAWJK^+
+MU-]]F+G[T+DCWZG^+E)_]^%Z<W;D.]7?1>KOVMGU.?*=ZN\B]7<P1[Y3_5VD
+M_@[FR'>JOXO4WRUS'_L<^4[U=Y'ZNX_+7.>.?*?ZNTC]W<>9NX^-.[K_+E1_
+M%ZF_^SAS][%Q1_??A>KO(O5W'Z_Y[.C^NU#]7:3^KIU=GR/?J?XN4G\'<^0[
+MU=]%ZN]@CGRG^KM(_=TR]ZG/D>]4?Q>IO_NTS#7NZ/Z[4/U=I/[NT\S=I\X=
+M^4[U=Y'ZNT\S=Y\Z=^0[U=]%ZN\^76_.CGRG^KM(_5T[NSY'OE/]7:3^#N;(
+M=ZJ_B]3?P1SY3O5WD?J[9>YSGR/?J?XN4G_W>9GKW)'O5'\7J;_[/'/WN7%'
+M]]^%ZN\B]7>?9^X^-^[H_KM0_5VD_N[S-9\=W7\7JK^+U-^UL^MSY#O5WT7J
+M[V".?*?ZNTC]'<R1[U1_%ZF_6^:^]#GRG>KO(O5W7Y:YQAW=?Q>JOXO4WWV9
+MN?O2N2/?J?XN4G_W9>;N2^>.?*?ZNTC]W9?KS=F1[U1_%ZF_:V?7Y\AWJK^+
+MU-_!'/E.]7>1^CN8(]^I_FY8OI/FOO8Y\-V@^KLA]7=?E[G.'?CN^U/,W9#Z
+MNZ\S=U\7[H8U/\7<#:F_^SIS]_5?;0Y\-ZC^KGTL<[DW'NC^N_Y4,7?GV[<_
+M7OX<W-#-/,7@Y8*#O^9^D/?]%WS_V&_F[WS_6-N=N1]?4MCTZWMP=XZ^\O%?
+M>KOTQ=E_,[C9K/;[F\'_6E[?S\MT!E^M]_!W_1/?_O'V_E_M]?W\T]N;W6K8
+MK#;;U>A_]@W_S[_]-WTZZ$]O___.[]=<25][P?9GYG[^;GOG5]XE0__$MX[)
+MVSO7UFWH3V_W%_%#+V?Z"?GJZ*N]_Q7V;OZ$]-W/\\^O%__]7XV7__N1KA%M
+MG]]5?WU4E-][N[]Y?:O;M_OS=[3=_5]O=^:\>+NK^W.'WWYN?__J'MR^.OJ*
+MZG_EDW'SYWS_Y#^Y/T;N_Y/[:\[_7A'L?IKEQV\Z>_B[_HEO_WQ[_Z]?@\,\
+4^+>=X+`>O[_*/_X7*6^YQ%^G````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow2.gz.uu
new file mode 100644
index 0000000..426de83
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.qcow2.gz
+M'XL("*`[(U0``VEM9RTQ>#$M-#`Y-BUE8G(N<6-O=S(N;W5T`*V76[/2,!#'
+MW_D4P<M1CXK-;E**EZ.>BS.^Z8/Z7"[]%'QXVV9IVNUN`TRAP\"$_V\VY)>E
+MR;+P,,9;XW+C-J;:FOHS76!Z'X:7.?[^\7/5?QP7`68S)24,..QP`]9#Q(&&
+MR^QXP,JX7G4HX."4&H-2.*=6-S4@X&X7[4_7+D;!$G@-,.#4Q;BJ/@CU\82[
+MLCZ8NSZ4?S]_RO&!?+H^#/7QU%K#%4D<"*F-ABN3.!126PVW2^*<D-IKN$,2
+MYX54I>!L0I4:EPLIJ^$@B5L+*=1P+HDKA)3FG4U[MQ%2FG<V[5TII#3O;-J[
+MK9#2O+-I[W9"2O/.IKW;"RG-.U"\,Q%W$%*:=\"\6Q+N6<150DKS#IAWSPGW
+MHL-9*:5Y!\R[EX2[B3BAWX'F'3#O7A'N=<0)_0XT[X!Y]X9PMQ$G]#O0O`/F
+MW5O"O8LXH=^!YATP[]Z/O+-"OP/-.V3>?2!6%G%"OT/-.V3>6<)!Q`G]#C7O
+MD'F'A',1)_0[U+Q#YITG7!YQ0K]#S3MDWJT)5T2<T.]0\PZ9=QO"?8PXH=^A
+MYATR[SX1[G/$"?T.->^0>?>%<'<1)_0[U+QSS+NOA/L6<4*_<YIWCGGWG7#W
+M$2?T.Z=YYYAW#X1[['`@I3KOLDR^"/<TVK,P[_VGB_?'5GC5!R:`Q27`J0H#
+M;C/KA'W8&Y<!JTJKSX>]47^AODI/;^HK3(_RMO<'+-2W[./V<T^WN@SHO2G+
+M$?#/J;Y6YV83E<*K/G"\7PV?77VN`?IULR=\;@HX=\+_GOY*R^%FVQ\!IQ_F
+M::`KV)Z#:P_SO6_VS=`'AK=FRXB;/,PW)Y2#-*!6YV=VSQ4LUU_G]FBUBV=0
+M=F/;K:^)]0FM``;3G:C/C*?;_.=V9V.VBNT")*9KAKCMY-I.5[<<5[>;>3$\
+MWQEG[MP&,MRY`0?S-@)H.TMM8/VM\:L^</RU&CX#T!%PME_0Y<U?Y>(_(V[D
+%[($4````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.raw.gz.uu
new file mode 100644
index 0000000..bbf6836
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.raw.gz
+M'XL("._%'50``VEM9RTQ>#$M-#`Y-BUE8G(N<F%W+F]U=`"ME,T.@R`,Q^\^
+M17?=P4`'TUV7[+[+MC.Z^10\_(KX`2*H"8!H4OK+O[:%,3L`Z%E=<8,N%T,7
+MYZ*G\>8PL.M6@1;7DA<=H*7D\$&+<0?'&2"/ZSNYN&_N<+MC0"E!J0#X&O6A
+M\1((3*WL<8.^E_Z<]`D#E!4("?(*->X-^/-XKZ5#\%S_S^)P"S<)YGMP%^/E
+MG'0K(V[0<YG8]X@3*76$8+]#P<K,M2?JA9^;9V#4)2VP>K"A#YSR"[.^6R@#
+MO7`3^B`,5QE<Y9_G#@XWP@4?UR1SFU9W"M6UF9,AEYVQLW,-Q.]<B\.\%P'V
+?-PM5()T*][A!/TM_6J`8@-G^H$`#+/YC5JB9E`8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhd.gz.uu
new file mode 100644
index 0000000..583467c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.vhd.gz
+M'XL("`LUQ%4``VEM9RTQ>#$M-#`Y-BUE8G(N=FAD+F]U=`"M5\%RI"`0O<]7
+M=&IO.5C00F.NJ<I]+[LY.XXF4UN;I)(<<G#_?4%`0<6,"<HP.DT_WVN:EF',
+M'@!4`G5`+9`TUTH`W8"J`+31-1QZ[FZA;YZ?VN;]_%&XHS]8,,Y"K]C=^&,)
+M0C]$`=;F(70RU]![F.+'W</U^>^#AT,'APY(*N-5(M!Q\1RA?ZTL.X-T?\8_
+M`^3MX\BN7+*;O/1'G8`)X#P847IV&J;X%XL5VJOKAJ:`M4-\?(MN(L,D=A8[
+MR69>`<VUH+))[!H<;7GM@;L^N+FPJ:(30^F>`7%0:*YUVO@X+)I.E8^WE_KU
+MK9WQPT2JT,B/+VQE6BZZ5$$_V#$0)IVWY,*`\CZ'6TF5;T6/8C_A+G00F/0&
+M'.3'T9N@(.1'G&W$/#T927[UIJXO"#X>=P,F&%JX9A1<RTF139(IF,C3_*Y"
+MN%-NN=T^0"FAKA>`OSR_QGCIVL3JE3YMZ&^+^!SYM090ET]=?25!A9<*OK_[
+MO38=;6+U[H^?A<//X$;"_!*XTI52/S+,C+2AG]+$?GLXL<7.+.%VEUB9.??:
+M:N87SC,PO4H:8)6S80PXSB],_&Z6-#"2N\$/EG)K`Z?B\3R`PT_D0@QWW)S;
+M;7972W9-YLGHYBOCPI5K0.*5:^$P;R'`H;+H#-2CEGW:T/\LXM,"HGMS9'L5
+MH:M]V1@*!YB-H?#%-!_#DFTFV]XL),<PT[Z>TN7^*_MZ"LI]AGT]^7*?\F*[
+A]O7DRGVF?3WY<I]G7V_@LN[K2?]C8^SP'^[O5"8,#@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdf.gz.uu
new file mode 100644
index 0000000..b4d9f24
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.vhdf.gz
+M'XL("'@EAE4``VEM9RTQ>#$M-#`Y-BUE8G(N=FAD9BYO=70`K96Q<H,P#(;W
+M/(5RW3)PMK`,K+W+GJ7M#`1RN5[:I4,''KXVQL3&0$C/X!#G9'WY94F&,7,!
+MJ,_L6#9TR>3J=H==3^/5T\"VG04:7*V\U`(U2AHF:C#NX#@#Y,OZ]B[N'#O<
+M]CD@$91E`'RS^E!["016SCR7#=UKXM^C/J&!E($@(`DY;@WXX_@^EP[!8^V?
+MP>$CW"B8;\&EVLM9Z5;&LJ&[EXGYMCBQIDXA6/-4L!2Y]D0^\7/S#$QU20TL
+M'VSH`\?\PEU?$<I`+]P5?1"&6VI<YJ_G#@X?A`L^KEK-[;JZ?:BNCIP,FG;&
+MQL[5$+]S#0[C'@38GRRJ`M6J\+ELZ$Z)?QN@&(#1=I"&5Y%,0;8@&Y"DYYD`
+M64"6NT#T*ZFKO[^:^N?ZZV98X_CXY@B']L=4=XO,`$O])_*LYXZ^E^/E<+U=
+M+,X>5?9$4LVFO%($607ATJ39KOC9(T]W=6FX2>3N7B&!">#<"WQ0=_++F?IS
+HW@;;M%")?G_L\'YXAMFC2N.(3;S^FUN#DY%+1=7>[@^&L-RROP@`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-ebr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vmdk.gz.uu
new file mode 100644
index 0000000..4db541f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-ebr.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-ebr.vmdk.gz
+M'XL("/#%'50``VEM9RTQ>#$M-#`Y-BUE8G(N=FUD:RYO=70`K5Q=C]S&$7SW
+MKZ"EER`/"]:27)(/`A+G'"`(`AB68[^&G]$AMB2<#D$,[(\/AYR:*]YJ-+2O
+M3SR1+7;W3O=PZT[5A<WS[2O+RCXKRZP<L^J2Y<B6?]J.+"^>C.4X-[QQ_?O=
+M/WX\\>L/I]/UJRT97)2$(-=T8NQ>YWIZ]L5TYR]%[6XLQSF9KG!1_4V@3W>.
+MW(BF*Y>;Y\^%<'7=>GMT%Y(N"XFR7;KJ,S5%B_W2ZO[XE6^>6U_AUK!L[Z7-
+MZB*[]-[,+M5J%UE]7N_E6;TXS4O"U]G=_:?_9'?3I^'A_N/C![^^L]O;Q;F\
+M./_+X#(LA=47=^%NN'2M2W&9LF+,"KC;V?7AK_<_3Z?_3@^?[C^\?P.6>W9[
+M6Q99V;KE./_\Z=@9[D7R[`+W&MGU+W^[>^.?W/STL7M@.A>U+&1Y[:4.S7NY
+M9.[[]EA7-[U_=!EG_Q56Y_;6-Z=:7[MT%U69U6VV+J=RN<_+[=&7O/9N>)BZ
+MQ^F'7S].;U[]\N%]Z)W;6]>R=DW4K(TJLJIPJ7QIKGV5R^@>FW77LNO/]X_O
+M[H>W2YF?IE>GUQG375SOE@UL_+JVJI>02W1GEV5?O_W?XU)O-OJ=O6>Z=1%K
+M$<MK5^>LJEVN90/7K3AG1>FNEG]:%KQ44L(Y9=</[T_?_[2\Q5VSWG[WY^^9
+MKEFB%L]E@4O(4M"NIFJKOWK^6&;7M]]FKUR1/[R;UB>0Z=KM;>:<MWW`:I[=
+MA>_:EMZ!6.ENK#N;W76/7?9-]VDZO;Z[^R;L;.>*+==C6=KDLERVU.[Y7MNY
+M-&[;Z6VCUZT8Q_[4C=W'Q^G!;6_8BMZU:/25NFTMG[9Q_SKUNE.S>V*RZYOL
+MU?VX[*E+^^_IPR],-VR/\;(.]TBT:V#A+I:G9TT_^5?8GABW32[=]/CPZVGX
+M]>?[]^/R1LO>,-VX]6Y9SK:;3YNY;."RPL\N<.G=JW57P_*8;G*K&V\6N.ZG
+M;V185'C9[/K+NKQW4S<N2UMR,]WL5G?^_#I\IYZ]U)(]NSYU;<W[R:<K<@\!
+MA8>R78O"<K87%`"=AL</#]O"7@D>%\]_EKT4C\N;'ZGU[TRXI;->WR5_]O.L
+MT+A2C&J7T/T4RY?O/RW?WSVM[^+6=Q'/6J,:,=I=NG\M*3[>EGMQ[\)./'N-
+M&L08CW3OXJ!M$L_Y>??XJP;D.IZ.OPO0L]"H4HQJER[6N\KWCIZU1C5BM+MT
+ML=Y=?._HV6O4(,9XJ-C:]XZ>LT:Y$W^50G[@U[)+XWM'ST*C2C&J7;I8[UK?
+M.WK6&M6(T>[2Q7K7^=[1L]>H08SQ4+&][QT]9XUR)P($Y#J>;O"]HV>A4:48
+MU2Y=K'>C[QT]:XUJQ&AWZ6*]FWSOZ-EKU"#&>*C8V?>.GK-&N5,IO2M3Z>K<
+M]XZ>A4:58E2[=)'>U<0[>M8:U8C1[M)%>E<3[^C9:]0@QGBH6.(=/6>-<J=*
+M>E<ETQ'OZ%EH5"E&M4L7ZQWQCIZU1C5BM+MTL=X1[^C9:]0@QGBH6.(=/6>-
+M<J>+].Z23$>\HV>A4:48U2Y=K'?$.WK6&M6(T>[2Q7I'O*-GKU&#&..A8HEW
+M])PURIWX2Q#D.IZ.>$?/0J-*,:I=NECOB'?TK#6J$:/=I8OUCGA'SUZC!C'&
+M0\42[^@Y:Y0[D9"!7$?3-;GO'3T+C2K%J';I(KUKB'?TK#6J$:/=I8OTKB'>
+MT;/7J$&,\5"QQ#MZSAKE3JWTKDVF(][1L]"H4HQJER[6.^(=/6N-:L1H=^EB
+MO2/>T;/7J$&,\5"QQ#MZSAKE3OS_$^0ZGHYX1\]"HTHQJEVZ6.^(=_2L-:H1
+MH]VEB_6.>$?/7J,&,<9#Q1+OZ#EKE#N1?X1<Q],1[^A9:%0I1K5+%^L=\8Z>
+MM48U8K2[=+'>$>_HV6O4(,9XJ%CB'3UGC7*G07HWI-*UN>\=/0N-*L6H=NDB
+MO6N)=_2L-:H1H]VEB_2N)=[1L]>H08SQ4+'$.WK.&N5.H_1N3*8CWM&ST*A2
+MC&J7+M8[XAT]:XUJQ&AWZ6*](][1L]>H08SQ4+'$.WK.&N5.D_1N2J8CWM&S
+MT*A2C&J7+M8[XAT]:XUJQ&AWZ6*](][1L]>H08SQ4+'$.WK.&N5.L_1N3J8C
+MWM&ST*A2C&J7+M8[XAT]:XUJQ&AWZ6*](][1L]>H08SQ4+'$.WK.&I7+]`QR
+M'4W7Y5OO@F>A4:48U2Y=I'>=Q[O@66M4(T:[2Q?I7>?Q+GCV&C6(,1XJUN-=
+M\)PURK5,^#LD*:W.XQV$OX/R=Q#^#DG^KO-X!^'OH/P=A+]#DK_K/-Y!^#LH
+M?P?A[PX4Z_$.PM]!^3L(?X<DI=5YO(/P=U#^#L+?(<G?=1[O(/P=E+^#\'=(
+M\G>=QSL(?P?E[R#\W8%B/=Y!^#LH?P?A[Y"DM#J/=Q#^#LK?0?@[)/F[SN,=
+MA+^#\G<0_@Y)_J[S>`?A[Z#\'82_.U"LQSL(?P?E[R#\'9*45I_[W@E_!^7O
+M(/P=DOQ=3[P3_@[*WT'X.R3YNYYX)_P=E+^#\'<'BB7>"7\'Y>\@_!V2E%9/
+MO!/^#LK?0?@[)/F[GG@G_!V4OX/P=TCR=SWQ3O@[*'\'X>\.%$N\$_X.RM]!
+M^#LD*:V>>"?\'92_@_!W2/)W/?%.^#LH?P?A[Y#D[WKBG?!W4/X.PM\=*)9X
+M)_P=E+^#\'=(4EH]\4[X.RA_!^'OD.3O>N*=\'=0_@["WR')W_7$.^'OH/P=
+MA+\[4"SQ3O@[*'\'X>^0I+2&W/=.^#LH?P?A[Y#D[P;BG?!W4/X.PM\AR=\-
+MQ#OA[Z#\'82_.U`L\4[X.RA_!^'OD*2T!N*=\'=0_@["WR')WPW$.^'OH/P=
+MA+]#DK\;B'?"WT'Y.PA_=Z!8XIWP=U#^#L+?(4EI#<0[X>^@_!V$OT.2OQN(
+M=\+?0?D["'^')'\W$.^$OX/R=Q#^[D"QQ#OA[Z#\'82_0Y+2&HAWPM]!^3L(
+M?X<D?S<0[X2_@_)W$/X.2?YN(-X)?P?E[R#\W8%BB7?"WT'Y.PA_AR2E->:^
+M=\+?0?D["'^')'\W$N^$OX/R=Q#^#DG^;B3>"7\'Y>\@_-V!8HEWPM]!^3L(
+M?X<DI342[X2_@_)W$/X.2?YN)-X)?P?E[R#\'9+\W4B\$_X.RM]!^+L#Q1+O
+MA+^#\G<0_@Y)2FLDW@E_!^7O(/P=DOS=2+P3_@[*WT'X.R3YNY%X)_P=E+^#
+M\'<'BB7>"7\'Y>\@_!V2E-9(O!/^#LK?0?@[)/F[D7@G_!V4OX/P=TCR=R/Q
+M3O@[*'\'X>\.%$N\$_X.RM\%,1WD6M)EV[=/-^5;[X)GH5%Y_OECZ=V2(L]N
+M5C<9ZP.QZ@/#3&&KZO<EW-)9KR_,MZ5_3W&_5;^(,-_F\2+](L)\F\>+](L(
+M\VT>+](O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$
+MOX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;
+M1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\
+MVT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2^"\VT;_2(XW[;1+X+S
+M;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M
+M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;
+M_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O]
+M(CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+R+,M^GY(OTBPGR;GB_2+R+,
+MM^GY(OTBPGR;GB_2+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M
+M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS
+M;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(
+M\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O@O-M&_TB
+M)E/](B93_2(F4_TB)E/](B93_2(F4_TB)E/](B93_2(F4_TB)E/](B93_2(F
+M4_TB)E/](B93_2(F4_TBYCPWU"]B-M4O8C;5+V(VU2]B-M4O8C;5+V(VU2]B
+M-M4O8C;5+V(VU2]B-M4O8C;5+V(VU2]B-M4O8C;5+V(VU2^>\SPWU"^>;SY+
+M>!<53W=;[*8/+-'_YH3S'.U>"?>H+`[+T57^8CDV(9GT#?'U?:WI1NMRY]^6
+ML*JRKKM)^$^N;_TTX>VS56__CM^X?G/:_PGK6S\.LZK=Q\16EZPY'RWXIV]_
+M?%;PEL[L<=G2W7ST]/-T8<$'/LFZ+->/GA9/?3+B-ZY/C\EV9KKR2ZO3*<^Q
+M8HT_>KHLFV=QNL_KC&!X4C,\0Y:PO]G3^MK;99QWY7YA?3?(4I;N1Y!^^*KN
+MX@[K(N5F^W3]%_?VRZO[^G9U@_%F5,_?&0??N2[)_IV[I3O;`L%E199-.G'[
+>=_S&];O3_L^6L/0)S3I8N@].R[_Z/_V4$^TO7P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
new file mode 100644
index 0000000..a67e3eb
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
@@ -0,0 +1,132 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.qcow.gz
+M'XL("*XS(E0``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W;;AS7M47?
+M_16ENT1)5*^UJJJK=$^`!,B;$YSS=@Z0NCX&G7=]?-CDOI"KY]2*(=J$(4.H
+MB>ZMP4'9'MX\'.[^:)I.FK9OVK'9Y^;F[].'-/?^YN%'\^/O?_W;]?T_?OQV
+M-R:'GSSE_K[51M/<@ZT_-V5.ST\MS6'\+^9N/@3-W7MU]@=>W;TW>SEW]=O=
+MF\7/*1NT!X--FCNDUR?D]-K_[O5]=V]7[D[O\=ZNDK?;L<'^P>#O:>Z?Z?4I
+M>;M'-C<\F#NYMZOD[8YL;OHI+$I@F=G<$LRU\*F5S6W!7`>?VO&<_.37]FZN
+MAT\)FX.?M]=-F3O"IXS-M0_F#M<9Z#PWP*<(=Q)R-\*G"'<2<C?!IPAW$G(W
+MPZ<(=Q)RM\"G"'<2<K?"IPAW&G*WP:<(=^3KQ3WN=O@4X4XC[@0_1;C3B#M!
+MOE/&G4;<"?*=,NXTXDZ0[Y1QIQ%W@GRGC#N-N!/D.V7<6<2=(-\9X\XB[@3Y
+MSAAW%G*'?&>,.PNY0[XSQIV%W"'?&>/.0NZ0[XQQ9R%WR'?&N+.0.^0[8]RU
+M(7?(=RWCK@VY0[YK&7=MQ)WBIPAW;<2=(M^UC+LVXDZ1[UK&71MQI\AW+>.N
+MC;A3Y+N6<==&W"GR7<NXZR+N%/FN8]QU$7>*?-<Q[KJ0.^2[CG'7A=PAWW6,
+MNR[D#OFN8]QU(7?(=QWCK@NY0[[K&'==R!WR7<>XZT/ND.]ZQET?<H=\US/N
+M^H@[PT\1[OJ(.T.^ZQEW?<2=(=_UC+L^XLZ0[WK&71]Q9\AW/>.NC[@SY+N>
+M<7>,N#/DNR/C[AAQ9\AW1\;=,>0.^>[(N#N&W"'?'1EWQY`[Y+LCX^X8<H=\
+M=V3<'4/ND.^.C+MCR!WRW9%Q-X3<(=\-C+LAY`[Y;F#<#1%W+7Z*<#=$W+7(
+M=P/C;HBX:Y'O!L;=$''7(M\-C+LAXJY%OAL8=T/$78M\-S#N\K_^YG/(=R/C
+M;HRX:Y'O1L;=&'*'?#<R[L:0.^2[D7$WAMPAWXV,NS'D#OEN9-R-(7?(=R/C
+M;@RY0[X;&7=3R!WRW<2XFT+ND.\FQMT4<=?AIPAW4\1=AWPW,>ZFB+L.^6YB
+MW$T1=QWRW<2XFR+N.N2[B7$W1=QUR'<3XR[_9T@^AWPW,^[FB+L.^6YFW,TA
+M=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;&W1QRAWPW,^[FD#ODNYEQMX3<
+M(=\MC+LEY`[Y;F'<+1%W/7Z*<+=$W/7(=POC;HFXZY'O%L;=$G'7(]\MC+LE
+MXJY'OEL8=TO$78]\MS#NUHB['OEN9=RM$7<]\MW*N%M#[I#O5L;=&G*'?+<R
+M[M:0.^2[E7&WAMPAWZV,NS7D#OEN9=RM(7?(=ROC;@NY0[[;&'=;R!WRW<:X
+MVR+NCO@IPMT6<7=$OML8=UO$W1'Y;F/<;1%W1^2[C7&W1=P=D>\VQMT6<7=$
+MOML8=WO$W1'Y;F?<[1%W1^2[G7&WA]PAW^V,NSWD#OEN9]SM(7?(=SOC;@^Y
+M0[[;&7=[R!WRW<ZXVT/ND.]VPIWD'_`YX#LY$.[D$'('?"<'PIT<(NX&_!3F
+M3L+^;@"^$];?2=C?#<!WPOH["?N[`?A.6'\G87\W`-\)Z^\D[.\&X#MA_9V$
+M_=T`?">LOY.POQN`[X3U=Q+V=P/PG;#^3L+^;@"^$];?2=C?#<!WPOH["?N[
+M`?A.6'\G87\W`-\)Z^\D[.\&X#MA_9V$_=V`?,?Z.PG[NP'YCO5W$O9W(WZ*
+M<!?V=R/R'>OO).SO1N0[UM])V-^-R'>LOY.POQN1[UA_)V%_-R+?L?Y.POYN
+M1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6WTG8WXW(=ZR_
+MD["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N["3]%N`O[NPGY
+MCO5W$O9W$_(=Z^\D[.\FY#O6WTG8WTW(=ZR_D["_FY#O6'\G87\W(=^Q_D["
+M_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK[R3L[R;D.];?2=C?3<AW
+MK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=C)\BW(7]W8Q\Q_H["?N[
+M&?F.]7<2]G<S\AWK[R3L[V;D.];?2=C?S<AWK+^3L+^;D>]8?R=A?S<CW['^
+M3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R'>OO).SO9N0[UM])V-_-
+MR'>LOY.POYN1[UA_)V%_-R/?L?Y.POYNP4\1[L+^;D&^8_V=A/W=@GS'^CL)
+M^[L%^8[U=Q+V=POR'>OO).SO%N0[UM])V-\MR'>LOY.POUN0[UA_)V%_MR#?
+ML?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D[.\6Y#O6WTG8
+MWRW(=ZR_D["_6Y#O6'\G87^WXJ<(=V%_MR+?L?Y.POYN1;YC_9V$_=V*?,?Z
+M.PG[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O6'\G87^W
+M(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2]G<K\AWK[R3L[U;D.];?
+M2=C?K<AWK+^3L+_;\%.$N["_VY#O6'\G87^W(=^Q_D["_FY#OF/]G83]W89\
+MQ_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?;<AWK+^3L+_;D.]8?R=A
+M?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U=Q+V=QOR'>OO).SO-N0[
+MUM])V-_M^"G"7=C?[<AWK+^3L+_;D>]8?R=A?[<CW['^3L+^;D>^8_V=A/W=
+MCGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])V-_MR'>LOY.PO]N1[UA_
+M)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.\T_<'--G0.^NWD*<Z>NO\OWZ365
+M.^`[9?V=NOZN2=PUF3L[X*<P=^KZNR9QU_RSS`'?*>OOU/5WS<F=G:'[[Y3U
+M=^KZNW)V=0[X3EE_IZZ_`W/`=\KZ.W7]'9@#OE/6WZGK[_+<DSH'?*>LOU/7
+MWSW)<TV9`[Y3UM^IZ^^>).Z>5.Z`[Y3U=^KZNR>)NR>5.^`[9?V=NO[NR>GB
+M[(#OE/5WZOJ[<G9U#OA.67^GKK\#<\!WROH[=?T=F`.^4];?J>OO\MS3.H=\
+MQ_H[=?W=TSQ7N4.^8_V=NO[N:>+N:>$.W7^GK+]3U]\]3=P]+=RA^^^4]7?J
+M^KNG)W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?FD.]8?Z>NO\MS
+MS^H<\AWK[]3U=\_R7.$.W7^GK+]3U]\]2]P]J]PAW['^3EU_]RQQ]ZQRAWS'
+M^CMU_=VST\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_4]??
+MY;GG=0[YCO5WZOJ[YWFN<H=\Q_H[=?W=\\3=\\(=NO].67^GKK][GKA[7KA#
+M]]\IZ^_4]7?/3_[LT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC_9VZ_@[,(=^Q
+M_DY=?Y?G7M0YY#O6WZGK[U[DN<(=NO].67^GKK][D;A[4;E#OF/]G;K^[D7B
+M[D7E#OF.]7?J^KL7IXNS0[YC_9VZ_JZ<79U#OF/]G;K^#LPAW['^3EU_!^:0
+M[UA_IZZ_RW,OZQSR'>OOU/5W+_-<Y0[YCO5WZOJ[EXF[EX4[=/^=LOY.77_W
+M,G'WLG"'[K]3UM^IZ^]>GOS9H?OOE/5WZOJ[<G9U#OF.]7?J^CLPAWS'^CMU
+M_1V80[YC_9VZ_B[/O:ISR'>LOU/7W[W*<X4[=/^=LOY.77_W*G'WJG*'?,?Z
+M.W7]W:O$W:O*'?(=Z^_4]7>O3A=GAWS'^CMU_5TYNSJ'?,?Z.W7]'9A#OF/]
+MG;K^#LPAW['^3EU_E^=>USGD.];?J>OO7N>YRAWR'>OOU/5WKQ-WKPMWZ/X[
+M9?V=NO[N=>+N=>$.W7^GK+]3U]^]/OFS0_??*>OOU/5WY>SJ'/(=Z^_4]7=@
+M#OF.]7?J^CLPAWS'^CMU_5V>>U/GD.]8?Z>NOWN3YPIWZ/X[9?V=NO[N3>+N
+M3>4.^8[U=^KZNS>)NS>5.^0[UM^IZ^_>G"[.#OF.]7?J^KMR=G4.^8[U=^KZ
+M.S"'?,?Z.W7]'9A#OF/]G;K^+L]=U3GD.];?J>OOKO)<Y0[YCO5WZOJ[J\3=
+M5>$.W7^GK+]3U]]=)>ZN"G?H_CME_9VZ_N[JY,\.W7^GK+]3U]^5LZMSR'>L
+MOU/7WX$YY#O6WZGK[\`<\AWK[]3U=WGN;9U#OF/]G;K^[FV>*]RA^^^4]7?J
+M^KNWB;NWE3OD.];?J>OOWB;NWE;ND.]8?Z>NOWM[NC@[Y#O6WZGK[\K9U3GD
+M.];?J>OOP!SR'>OOU/5W8`[YCO5WZOJ[//>NSB'?L?Y.77_W+L]5[I#O6'^G
+MKK][E[A[5[A#]]\IZ^_4]7?O$G?O"G?H_CME_9VZ_N[=R9\=NO].67^GKK\K
+M9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<^SJ'?,?Z.W7]W?L\5[A#
+M]]\IZ^_4]7?O$W?O*W?(=ZR_4]??O4_<O:_<(=^Q_DY=?_?^='%VR'>LOU/7
+MWY6SJW/(=ZR_4]??@3GD.];?J>OOP!SR'>OOU/5W>>ZZSB'?L?Y.H_[.T/UW
+MROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.XWZ.T/W
+MWRGK[S3J[PS=?Z>LOU/2WWVH<\AWK+]3U]]]R'.%.W3_G;+^3EU_]R%Q]Z%R
+MAWS'^CMU_=V'Q-V'RAWR'>OOU/5W'TX79X=\Q_H[=?U=.;LZAWS'^CMU_1V8
+M0[YC_9VZ_@[,(=^Q_L[R#]S<H<X!WQGK[VY^X@%WV4^'RAWPG;'^SEQ_=TA[
+MA\(=NO_.6']GKK\[).X.A3MT_YVQ_LY<?W<X^;-#]]\9Z^_,]7?E[.H<\)VQ
+M_LY<?P?F@.^,]7?F^CLP!WQGK+\SU]_E.:ESP'?&^CMS_9WDN<(=NO_.6']G
+MKK^3]/*D<@=\9ZR_,]??2>).*G?`=\;Z.W/]G9PNS@[XSEA_9ZZ_*V=7YX#O
+MC/5WYOH[,`=\9ZR_,]??@3G@.V/]G;G^+L]IG4.^8_V=N?Y.\USE#OF.]7?F
+M^CM-W&GA#MU_9ZR_,]??:>)."W?H_CMC_9VY_DY/_NS0_7?&^CMS_5TYNSJ'
+M?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^>LSB'?L?[.7']G>:YPA^Z_,];?
+MF>OO+'%GE3OD.];?F>OO+'%GE3OD.];?F>OO['1Q=LAWK+\SU]^5LZMSR'>L
+MOS/7WX$YY#O6WYGK[\`<\AWK[\SU=WFNK7/(=ZR_,]??M7FN<H=\Q_H[<_U=
+MF[AK"W?H_CMC_9VY_JY-W+6%.W3_G;'^SEQ_UY[\V:'[[XSU=^;ZNW)V=0[Y
+MCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSW5U#OF.]7?F^KLNSQ7NT/UWQOH[
+M<_U=E[CK*G?(=ZR_,]??=8F[KG*'?,?Z.W/]77>Z.#OD.];?F>OORMG5.>0[
+MUM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\U]<YY#O6WYGK[_H\5[E#OF/]G;G^
+MKD_<]84[=/^=L?[.7'_7)^[ZPAVZ_\Y8?V>NO^M/_NS0_7?&^CMS_5TYNSJ'
+M?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^>.=0[YCO5WYOJ[8YXKW*'[[XSU
+M=^;ZNV/B[EBY0[YC_9VY_NZ8N#M6[I#O6']GKK\[GB[.#OF.]7?F^KMR=G4.
+M^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L\-=0[YCO5WYOJ[(<]5[I#O6']G
+MKK\;$G=#X0[=?V>LOS/7WPV)NZ%PA^Z_,];?F>OOAI,_.W3_G;'^SEQ_5\ZN
+MSB'?L?[.7'\'YI#O6']GKK\#<\AWK+\SU]_EN;'.(=^Q_LY<?S?FN<(=NO_.
+M6']GKK\;$W=CY0[YCO5WYOJ[,7$W5NZ0[UA_9ZZ_&T\79X=\Q_H[<_U=.;LZ
+MAWS'^CMS_1V80[YC_9VY_@[,(=^Q_LY<?Y?G/M8YY#O6WYGK[S[FN<H=\AWK
+M[\SU=Q\3=Q\+=^C^.V/]G;G^[F/B[F/A#MU_9ZR_,]???3SYLT/WWQGK[\SU
+M=^7LZASR'>OOS/5W8`[YCO5WYOH[,(=\Q_H[<_U=GOM4YY#O6']GKK_[E.<*
+M=^C^.V/]G;G^[E/B[E/E#OF.]7?F^KM/B;M/E3OD.];?F>OO/ITNS@[YCO5W
+MYOJ[<G9U#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:YSR'>LOS/7WWW.
+M<Y4[Y#O6WYGK[SXG[CX7[M#]=\;Z.W/]W>?$W>?"';K_SEA_9ZZ_^WSR9X?N
+MOS/6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5W8`[YCO5WYOJ[//>ESB'?L?[.
+M7'_W)<\5[M#]=\;Z.W/]W9?$W9?*'?(=Z^_,]7=?$G=?*G?(=ZR_,]???3E=
+MG!WR'>OOS/5WY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^UKGD.]8
+M?V>NO_N:YRIWR'>LOS/7WWU-W'TMW*'[[XSU=^;ZNZ^)NZ^%.W3_G;'^SEQ_
+M]_7DSP[=?V>LOS/7WY6SJW/(=ZR_,]??@3GD.];?F>OOP!SR'>OOS/5W>>Y;
+MG4.^8_V=N?[N6YXKW*'[[XSU=^;ZNV^)NV^5.^0[UM^9Z^^^)>Z^5>Z0[UA_
+M9ZZ_^W:Z.#OD.];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7=M_H&;
+M^U[G@.]:UM^UKK_[GN<J=\!W-T]A[EK7WWU/W'W/W+4'_!3YOL?NS7[/O?%U
+MF4/?;[L\%<S=^^/';U=W@^B^*CK8^N^/FT\O?UZTZ+ZJ7WE]W>WYM=H<)O!7
+M_A,__GS]\,\R>'MWT!\8S*_PX5S^!>GN[@ZZC::V&W?NZ>,@]][P^9L>"W_#
+M3Z[OS:'OS?PKYX>N^_G98-<UTW0Q^+_Y]=U>]]-V3=LW[9@N<FREZ;3IVC)W
+M^UZ[Y?[K^\M?_];\_J=__,]Y[/_JV[V][F>^>?[FMW#6;.Z0#D+?[O_[MWLW
+M=_OE>_>GG>>,SCW!<[=?OM>?S*$//M?^[*F#TE=W\6M[-]<='CXUW'_J_-L,
+M:_:IF58R]]7-H6\?_RODW=X<,/?-\>8?6F]^@R?-LI]_L/;G;[[;##>?)G?_
+M:49O_U^FL3G*^?^RNQG\\:^_7__K;NS]];_?IM=W=W.`X`_^$^ST[FX.&-C;
+MS?]YD;_=YN$<^)W>KYW>^?<K<_=HIS<F6-`'_PEZ>M/=Z>%#.I\>_)3Y<?\:
+MT?MSX/<KOW)Z_>U7C?/7V`G\E?_$C]^O'_YY-]BFP4=[A3>#RR-^=ISG'O&S
+MXSSWB)\=Y[E'_>PX#S[B9\=Y[A$_.\YSC_C9<9Y[U,^.F\';?^?X2%_$SW-R
+M]V5R7YM!F\W<ZV-?CNOK>_AV[_Z=(_O2_Y,OXO@78WO$+^+GN9]_$=_^Z)M]
+8Q"_BY[E'_2+>'HXWWOOM/_VP*B?UK```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu
new file mode 100644
index 0000000..c9d99d1
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu
@@ -0,0 +1,26 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.qcow2.gz
+M'XL("*([(U0``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=S(N;W5T`*V92V_4,!"`
+M[_T5+F]:6.)7DN51:$LK]=8BN'')\UB)*PK\=N+8B9/)3-PNWK6BKJSY9#O?
+MC)TT2>R',<V92IG:L[9D_6_7!)O]6#;6W5W?[.:?[LC">$)$(1U*3K@%Z]+C
+M!(5+^+J#X[C9Z"2"$V/4&A3"*7)T6QT([N1H6+KA9N0@0AX"M#CR9APT/F''
+M!R/4@>,3L<<G\?738QSL2+?')^WX8%1&X?(@3B!1>PI7!'$2B2HI7!7$*22J
+MIG!-$*>1J);`\8`J/2Y%HCB%$T%<AD1)"J>"N!R)HKSC8>_V2!3E'0][5R!1
+ME'<\[%V)1%'>\;!W%1)%><?#WM5(%.6=(+QC'M<@491W`GAW['!//*Y%HBCO
+M!/#NJ<,]FW`<BZ*\$\"[YP[WPN.0>B<H[P3P[J7#O?(XI-X)RCL!O'OM<"<>
+MA]0[07DG@'>G#O?&XY!Z)RCO!/#N[<H[CM0[07DG@7?O'"OQ.*3>2<H[";SC
+M#B<\#JEWDO).`N^DPRF/0^J=I+R3P#OM<*G'(?5.4MY)X%WF<+G'(?5.4MY)
+MX-W>X=Y['%+O).6=!-Y]<+B/'H?4.TEY)X%WGQSNS..0>B<I[Q3P[K/#??$X
+MI-XIRCL%O#MWN`N/0^J=HKQ3P+M+A_LZX006-7F7)'ASN*M5S@JDWJGT@;CK
+M-8Y^6#GD.*O\<9LC5[IC`Y@_'DCNM<J>4^)-6-L)&ZL*Y$IW=!>[Y7<"#KG[
+M".`XPB7.35C;W+4/C$W#VM8UNU(N.)\=$)`)'^]FN#KR^@WI]@B@UJPH5L`?
+MX_B&=.OSR[X;Z.W60S'0@FDUX8:YZFH^OJOK&W9[_NV[@?WTTQW2+2M8Q5F1
+MLP*.CE/3_8W9IVVZ92U<[1$G*=QT+`,X<[S(Z@T<UECWA\"IK:CII<,#[JW%
+MZ609-2];9ILH)6L+5M0$[@S@TLCF*=-=IBRK6-J8]TE5:_ZH4_.4QO(^3>RV
+M+88SUIYEW)S=>F!W?[>[M["WNU^G;GR*.R.P1G=0JZ>&RIQ3T\W\@P`Q7;;$
+M8:^1_FOU3%TN=;35VSM9L$9WD*M7V-7#%\FL'IHRW;AJ8\*-N#+NZG'["C,Q
+M]7M]I3NZV]WR:X'*`:.-4*5M%3$[#"YB=AA<Q.PPN*C988`1L\/@(F:'P47,
+M#H.+FAT]L$GB;>(&9]PK,E8+\YRX^'_!UG;<#8^/Z^DV8FOKW]C$\9O11-S$
+B#6YS$\\:>K+V\Q=,-N(F;G!1-W&5F>/WT3\!FKQU%1H`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu
new file mode 100644
index 0000000..c8adeb3
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.raw.gz
+M'XL("/#%'50``VEM9RTQ>#$M-#`Y-BUG<'0N<F%W+F]U=`"MEC]O@S`0Q?=\
+MBI>U52W;V`262JW42MW2JMW:@3]FC-2=#U\?A@2(C1KIP$)(Q_UR]_#C(F4X
+M`*,AJ\@U'>B?Q?+L=W>[@:;JVX#^]ZF$%5!X8,`U/B@U/>,<NFY<4@U9(5E)
+M:#7>3SAQ.?9BAFO/6=<K'9CC1,!-[7:W`:U%55T!OZ;Z]/`Z+$P.4T+[YR6,
+M@M6PYHP;>K7-O+Z7US<<GSX^"?9]:5=[:5#[_!95!K<22:IDNS_K=@-.4U:W
+M5GO"94G</H[+**O=P,56&F>VLL(>^M^[#3@KEUG%/"MSJ#-T%:HV@7M<X7+F
+MG6<H7.<X-,@=K$+3T4V;0RF@\#8I!HB&]B66."CHFH#]Z5V<`NQ!_-Z/]1DU
+M[HC82@=2ZIEAJQ2I=@^TMS?;Q1*7<:M7D'J63;URW"RQE0XDU:N">G&12+VH
+M9?I)M<DA$Z[F54\-4\/[PW^_KZ_I0'\4RS,`S0ADJ]!H/S;XW$$X1G<0CM$=
+MA&-U!P$9W4$X1G<0CM$=A&-UAP<ZR3?$":?"F.Q:%!HN6]67&L>7^I;M.KTU
+F^C>&>/QE.,8A3KCM(>YN;99QB!..=8@;_W]*RMT?5F[7A(@+````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu
new file mode 100644
index 0000000..4631e38
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.vhd.gz
+M'XL("`XUQ%4``VEM9RTQ>#$M-#`Y-BUG<'0N=FAD+F]U=`"MF$MOVS`,@._Y
+M%0QVZS!#;R>7`2O0`KMUPX9==K$=IRN&=8_VT(/WWT?*4FS9EK&T=%0CB<+/
+M)$61K(3H+P"GP1W!M>`LO2\-N#V4.P"<#$/YNPP?H6M^WK?-X]U3$:YNT\.D
+M&$NEXB2O-!A\2`FJHH>X`[V'+F**5U>W%W<_;B-.!9P*(%N2E%;@ZMES#'Z[
+MZ[4CTI<[]=TC+[^=M--S[08I_"L/(`Q(.?J%CMHAIOB;&FM0ZGCTP\&A)=G3
+M2#XD$X.Q$]]9,9$:J;GD5#$8NX1S:U+GX"XV82WZ4,'`*/$NP$DH%;W'L(E^
+MF`T,E:>'7]6?AW:BG\J$BCOI)V=S.F^N"J&BXH^#!H;"><U<\)3'*6XA5%[D
+M/9?*Q=5%)P@;)Y0W/_7>@(*Q?DZ*%9_G%R.K7T7ZX680U<(]/]%=%NGK!*SK
+M\X#1@RGN9'#=D/]\'FC;P:(^2(*P-J!D=D',=N2_^L"\OO7Q/*"U4%4SX.>H
+M7^.7PX)Q8/84&)@<C`2KP`[A[&VUS5B_J^OW<//NXR>"?1W,;2A<&@5-"7L%
+M<C_1;K[3UG-+0YM-ZZFW(T[G<'J[C*/-IN4*;FE`)S,XLR9UJB7_;:P5J=1N
+M+*5;J#4<*Z@.&=S;"8X[+[<T73LH&RKA5D+C:_G!42&#'6X37]_0`H4J8F%'
+M1]<$[.X_%/<][$WQ^W70KY4A(I9&?B+GO=;GY5W.W')(V!ES(<5QY^5V1]ZS
+M;-[;AV!9&OF)K/>JWGO+3B+O+6Z96-6*8IOB:E[O25\U<']@_I[?\Q/=39&^
+M>J`*98BMKJF02-DT-`'(IJ$)^Y=10]FN+N:YJVQ4J1@S#.$8,PSA&#,,X5@S
+M#`$9,PSA&#,,X1@S#.%8,PP"C>!KA`CG&R&LX>A]3=!$C6Q+0_I=$TJGYAJU
+MUC[E&Z',8AC&1HAPJXT0_A>=-]9?:F(L8R-$.-9&R(5$RG26X6(C--?A.6<9
+J+C9"8G#@"\XRW'(C]-RS#,(QGF40CO$L@W#,H2*Q=]G\`YT_-4@`$P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu
new file mode 100644
index 0000000..b8ea03f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.vhdf.gz
+M'XL("'LEAE4``VEM9RTQ>#$M-#`Y-BUG<'0N=FAD9BYO=70`K9??B]0P$,??
+M]Z\8\>'DQ)#?[;X("J?XMAX>OOC2'\FQB"N"B`_]X\TD[37I)H63=$/I,IW/
+MSG<ZT\E2&@X`R8%VF7/9,+TGZ6<ZW!X\C?7/`[K?QQ`V0.*``3<X(^5XCS%@
+M[;PH\U[!V2W>KM<>1];C%8EP8^RU665#C",!M\BUSP,J!5UW!7Q8XN/^<2B0
+M&N01N+N?@F2@."CYA//:U1#'=_?A$YS>W7]!V+=5+F?..`A@'&2#E#0Z5I;[
+M\3Z5&W`N(,P^;[)B11%WL\U>P`G$C3NXW"KCY)X7Y66Q>9RBJ5<;>PD#O0#;
+M03<6<&\W.%VY\B2:>PW-`-J`8C!8O!@U,`;0NC8)/<&!NQ"/T##@/0*GRV=R
+M";`WY-?K.3[)YHK(K;*AE#V)I4+;DMP&:WM7+J0X43M[+69/5<O><2Z6W"H;
+MBMGK0O;R2<+LY5K7X>:LD1<IKJ^;/>:GANL/]_Z^/I<-TXFDGP"4,[!:A-+:
+MH6)W(*YB=R"N8G<@KFIW(+!B=R"N8G<@KF)W(*YJ=SB@H?6&..*P]@R%1H-M
+M<`.1A%$<QQ/YX_85>-PD<@W?&_T[0SS_,$S%(8ZXW2%N35'L<FS$5ASBB*LZ
+MQ-6\_=8"M.\OK?"ZD:!=2[4QD*\UXX'#SXL9?I__QME3_LT,ZR9YL]"?"RQ,
+M[5JDPQ_1(UY'\;V\>[P]_WA<<'Q6M210->@E..C^2JY*Y7X]\^\>>5JCR[RF
+M5)R]HP8J\143"Y^C.Z6EHOP.:!%K++02?9]6\B4Q9`L9<;Y4XIO_]]D&7.U2
+.<7\-#O\`_#?S";,-````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu
new file mode 100644
index 0000000..782cb6c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu
@@ -0,0 +1,87 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-gpt.vmdk.gz
+M'XL("/'%'50``VEM9RTQ>#$M-#`Y-BUG<'0N=FUD:RYO=70`K5Q=C]S&$7SW
+MKYC(#S829,%:DLOE@X+8D1T800!%=I*7/(2?\2&VI)P.A@WLCP^'G)HKWNT<
+M*5^?]K3;8G?M=,^RN:HN,,N6'^>*UA6%*WI7GEP&-_W3\G!9?F],C^.9!RY_
+M>?77?QSX\_GA</ED`8./DA!D"B?&ZGTNAP<_A#L^%;4Z,#V.FW"YCVH?!0:X
+M8^)`$JZ8#AZOA7!US7RX]R\$SD4@MX(KK^243/:IU?WVDU`\O[[<KV':WE/M
+MJMR=VF"Z4SG;N:N.\[',59/3.`%^ZE[=?/BO>S5\Z&YOWM^]"^L[^KV=G(N3
+M]S]U'F%*K#KY%_Z`AZL]Q&EP>>]R^,/N<OOUS0_#X:?A]L/-N[<OP72/?F^+
+MW!6U7X[WS^X?*\._2>9.\._A+G_ZYM7+\,G-#N^;6\+YJ&DATWM/>2CNZ>3\
+M[^/'O+KA[9U'',-/7)W?VU"<<G[OPK\H"U?5;EY.Z;&/T^$^I#S7KKL=FKOA
+MNU_>#R]?_/CN;:R=WUM?LGH&.L^%REV9>ZB0FB]?Z1']QV;>-7?YX>;N^YON
+MVRG-#\.+PZ>.<"=?NVD#SV%=2]93R"FYL].R+U_]?#?EZ_JPLS>$FQ<Q)S&]
+M=WET9>6QI@V<M^+H\L*_FOYI6O"420'OY"[OWA[>_',ZQ7VQOGW]Q1O"G:>H
+MR7-:X!0R);3*J5SR+Q]^+-WEVZ_<"Y_D=]\/\R>0</5RFGGG91\PFT?_(E1M
+M@?=-K/`'YIUUKYJ[QGW9?!@.G[YZ]67<V<8G6\R/:6F#1SDMT/[S/9=S*MRR
+MT\M&SUO1]^VAZ9OW=\.MW]ZX%:TO41\R]=M:W&_C^GVJ>:=&_XEQEY?NQ4T_
+M[:F'_<_P[D?"=<O'>%J'_TC4<V#N7TR?GAE^".^P?&+\-GFXX>[VET/WRP\W
+M;_OI1',O"=<OM9N6L^SF_69.&SBM\.H"I]J]F'<U+H]P@U]=_VB!\WZ&0L9%
+MQ;=UEQ_GY7T_-/VTM`F;<*-?W?'Z.D*E'KS5A.XN]U6;<3\$N#P++2`/K6Q5
+MHKB<Y0VE@0[=W;O;96$OI!_G#Z]ES^W'Q:-+:O4K`1<XZ_6=L@?7LUSC"C'*
+M%:"_BF73[Q^GW]?WZSOY]9W$L]*HLQCU"N[?$\3[Q^F>_%G8B&>K49T8_9[J
+MG7QK&\1S?%@]?M6`O$[#\;L`/7.-*L0H5W"IVI6A=O2L-.HL1KV"2]7N%&I'
+MSU:C.C'Z7<E6H7;T'#7*/_&K%+(=7\M.YU`[>N8:58A1KN!2M:M#[>A9:=19
+MC'H%EZI=$VI'SU:C.C'Z7<FVH7;T'#7*/[%!0%ZGX;I0.WKF&E6(4:[@4K7K
+M0^WH66G468QZ!9>JW1!J1\]6HSHQ^EW)CJ%V]!PURC\54KMB"Z[*0NWHF6M4
+M(4:Y@DO4KF*_HV>E46<QZA5<HG85^QT]6XWJQ.AW)<M^1\]1H_Q3*;4K-^'8
+M[^B9:U0A1KF"2]6._8Z>E4:=Q:A7<*G:L=_1L]6H3HQ^5[+L=_0<-<H_G:1V
+MITTX]CMZYAI5B%&NX%*U8[^C9Z519S'J%5RJ=NQW]&PUJA.CWY4L^QT]1XWR
+M3_P2!'F=AF._HV>N4848Y0HN53OV.WI6&G46HU[!I6K'?D?/5J,Z,?I=R;+?
+MT7/4*/]$0@;R.@EWSD+MZ)EK5"%&N8)+U.[,?D?/2J/.8M0KN$3MSNQW]&PU
+MJA.CWY4L^QT]1XWR3[74KMZ$8[^C9ZY1A1CE"BY5._8[>E8:=1:C7L&E:L=^
+M1\]6HSHQ^EW)LM_1<]0H_\3_/T%>I^'8[^B9:U0A1KF"2]6._8Z>E4:=Q:A7
+M<*G:L=_1L]6H3HQ^5[+L=_0<-<H_D7^$O$[#L=_1,]>H0HQR!9>J'?L=/2N-
+M.HM1K^!2M6._HV>K49T8_:YDV>_H.6J4?^JD=MT67)V%VM$SUZA"C'(%EZA=
+MS7Y'STJCSF+4*[A$[6KV.WJV&M6)T>]*EOV.GJ-&^:=>:M=OPK'?T3/7J$*,
+M<@67JAW['3TKC3J+4:_@4K5COZ-GJU&=&/VN9-GOZ#EJE'\:I';#)AS['3US
+MC2K$*%=PJ=JQW]&STJBS&/4*+E4[]CMZMAK5B='O2I;]CIZC1OFG46HW;L*Q
+MW]$SUZA"C'(%EZH=^QT]*XTZBU&OX%*U8[^C9ZM1G1C]KF39[^@Y:E0FTS/(
+MZR1<DRVUBYZY1A5BE"NX1.V:T.^B9Z519S'J%5RB=DWH=]&SU:A.C'Y7LJ'?
+M1<]1HWS)A+_#)J75A'X'X>^@_!V$O\,F?]>$?@?A[Z#\'82_PR9_UX1^!^'O
+MH/P=A+_;D6SH=Q#^#LK?0?@[;%):3>AW$/X.RM]!^#ML\G=-Z'<0_@[*WT'X
+M.VSR=TWH=Q#^#LK?0?B['<F&?@?A[Z#\'82_PR:EU81^!^'OH/P=A+_#)G_7
+MA'X'X>^@_!V$O\,F?]>$?@?A[Z#\'82_VY%LZ'<0_@[*WT'X.VQ26FT6:B?\
+M'92_@_!WV.3O6O8[X>^@_!V$O\,F?]>RWPE_!^7O(/S=CF39[X2_@_)W$/X.
+MFY16RWXG_!V4OX/P=]CD[UKV.^'OH/P=A+_#)G_7LM\)?P?E[R#\W8YDV>^$
+MOX/R=Q#^#IN45LM^)_P=E+^#\'?8Y.]:]COA[Z#\'82_PR9_U[+?"7\'Y>\@
+M_-V.9-GOA+^#\G<0_@Z;E%;+?B?\'92_@_!WV.3O6O8[X>^@_!V$O\,F?]>R
+MWPE_!^7O(/S=CF39[X2_@_)W$/X.FY16EX7:"7\'Y>\@_!TV^;N._4[X.RA_
+M!^'OL,G?=>QWPM]!^3L(?[<C6?8[X>^@_!V$O\,FI=6QWPE_!^7O(/P=-OF[
+MCOU.^#LH?P?A[[#)WW7L=\+?0?D["'^W(UGV.^'OH/P=A+_#)J75L=\)?P?E
+M[R#\'3;YNX[]3O@[*'\'X>^PR=]U['?"WT'Y.PA_MR-9]COA[Z#\'82_PR:E
+MU;'?"7\'Y>\@_!TV^;N._4[X.RA_!^'OL,G?=>QWPM]!^3L(?[<C6?8[X>^@
+M_!V$O\,FI=5GH7;"WT'Y.PA_ATW^KF>_$_X.RM]!^#ML\G<]^YWP=U#^#L+?
+M[4B6_4[X.RA_!^'OL$EI]>QWPM]!^3L(?X=-_JYGOQ/^#LK?0?@[;/)W/?N=
+M\'=0_@["W^U(EOU.^#LH?P?A[[!):?7L=\+?0?D["'^'3?ZN9[\3_@[*WT'X
+M.VSR=SW[G?!W4/X.PM_M2);]3O@[*'\'X>^P26GU['?"WT'Y.PA_ATW^KF>_
+M$_X.RM]!^#ML\G<]^YWP=U#^#L+?[4B6_4[X.RA_%\5TD-<"YY;?`#=D2^VN
+M2LJO_%.LG;NZNL%:'SB.>P'SZ^GZ/8[I(GMR&1^_/LSZQ3CS6*K^ZP`7../Z
+M(<[?I4SW<1^KKT2<O_/Q+'TEXOR=CV?I*Q'G[WP\2U^).'\WT5<BSM]-])6(
+M\W<3?27B_-U$7XDX?S?15R+.WTWTE8CS=Q-])>+\W41?B3A_-]%7(L[?3?25
+MB/-W$WTEXOS=1%^).'\WT5<BSM]-])6(\W<3?27B_-U$7XDX?S?15R+.WTWT
+ME8CS=Q-])>+\W41?B3A_-]%7(L[?3?25B/-W$WTEXOS=1%^).'\WT5<BSM]-
+M])6(\W<3?27B_-U$7PG.WVWTE>#\W49?"<[?;?25X/S=1E\)SM]M])7@_-U&
+M7PG.WVWTE>#\W49?"<[?;?25X/S=1E\)SM]M])7@_-U&7PG.WVWTE>#\W49?
+M"<[?;?25X/S=1E\)SM]M])7@_-U&7PG.WVWTE>#\W49?"<[?;?25X/S=1E\)
+MSM]M])7@_-U&7PG.WVWTE>#\W49?"<[?;?25X/S=1E\)SM]M])7@_-U&7PG.
+MWVWTE>#\W49?B3A_I^>S])6(\W=Z/DM?B3A_I^>S])6(\W=Z/DM?B3A_-]%7
+M(L[?3?25B/-W$WTEXOS=1%^).'\WT5<BSM]-])6(\W<3?27B_-U$7XDX?S?1
+M5R+.WTWTE8CS=Q-])>+\W41?B3A_-]%7(L[?3?25B/-W$WTEXOS=1%^).'\W
+MT5<BSM]-])6(\W<3?27B_-U$7XDX?S?15R+.WTWTE8CS=Q-])>+\W41?B3A_
+M-]%7(L[?3?25B/-W$WTEXOS=1%\)SM]M])483/65&$SUE1A,]9483/65&$SU
+ME1A,]9483/65&$SUE1A,]9483/65&$SUE1A,]9483/65&$SUE1A,]948L\Q0
+M7XG15%^)T51?B=%47XG15%^)T51?B=%47XG15%^)T51?B=%47XG15%^)T51?
+MB=%47XG15%^)T51?B=%47WG,LLQ07WE\=*_CG7"/DUWT@4>8ZBN/QR>7\?'K
+M*^;Z+7=7??QW^L#ER\/Z3P1$^W&`7.$:C@D7\.?&HO4:!C>.X;$HY^XSC'>Q
+MOI+PYP>!ZXWKMW]_ET=9NJ9Y!/AWKF_>WZ+T]V,NZOGFO+PS;UE$N#GWLM/U
+M??7U-^[U%V^^\V#_ND]WOKUSEWNRK:@\RGIU2*?[YS>/SXYBOKWS5/UC=379
+M/`GWV;63K9AO[SSV3\!=>Z3ABJ>B/O9.X,5\>V>-4O6MRP?7YFYL7-,GX/[P
+M`.YD_,F;[SS;GES5^?L'EW#=?+/G_N1I:7>>3I/EG#BZ8^^5"!7<T=^1^7!Y
+M^[?#VP7L]X?__2ZL;[GS+*X_T@=2U2OFN[R?4^E6B8:];O,"EUM7SW]?:4NS
+MZM7APW+MD3Z0K%ZS5"]Q59NJ=^W4G>!X5?O-&JZUK5XY7S46X<GCO],'+J\/
+MZS\+8!$`S598^%L*VIT='L[P[/!PAF>'AS,].SR@X=GAX0S/#@]G>'9X.-.S
+MH_`WC+2[B'LX+-^8JY,;*_\%8K6,Y.7X<OAI^E[A?SY;I3MSCLE+_Q,7\>N;
+G,1A>Q#W<DQ?Q<4@FRY\'R1I>Q#V<Z46\\'?OS#[Y/TT579ZT90``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow.gz.uu
new file mode 100644
index 0000000..40c4fb3
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.qcow.gz
+M'XL("+`S(E0``VEM9RTQ>#$M-#`Y-BUM8G(N<6-O=RYO=70`K9W+CAM)DD7W
+M]174^RW1S()DA-YH8`:87<]B9K;%YYH?H(\?E13AGFD\5U;=5:I$08(4%Z3G
+MT1&ZZ\ASO?[Y;;7:V&K8KH9I=3FLOO]X_K#5G1_<_UA]^^___*^W=[]]^^WG
+MF*U_\53Z\>"KF.?N;?UCW>;\CZ>.J_7T)^:^?QC-W7EU\2^\NCMO]G;NY6\_
+MWRP_YVKP_MM=S7/+VS5Q>L.?>WU?T]NUGZ?W][U=%V]WHP:W]P;_.<_]/K\^
+M%V]WI^;&>W/7]'9=O-U)S>U_"8L+6`YJ[EC,#?C42<V=B[D-/G7A.?O%Y_;G
+MW!:?,C7G.+=J<SM\*M3<<&]N_78!>ID;\2G!G97<3?B4X,Y*[O;XE.#.2NX.
+M^)3@SDKNCOB4X,Y*[D[XE.#.2^[.^)3@SDON+OB4X,XK[HR?$MQYQ9V1[UQQ
+MYQ5W1KYSQ9U7W!GYSA5W7G%GY#M7W'G%G9'O7'$7%7=&O@O%753<&?DN%'=1
+M<D>^"\5=E-R1[T)Q%R5WY+M0W$7)'?DN%'=1<D>^"\5=E-R1[T)Q-Y3<D>\&
+MQ=U0<D>^&Q1W0\6=\U."NZ'BSLEW@^)NJ+AS\MV@N!LJ[IQ\-RCNAHH[)]\-
+MBKNAXL[)=X/B;E-QY^2[C>)N4W'GY+N-XFY3<D>^VRCN-B5WY+N-XFY3<D>^
+MVRCN-B5WY+N-XFY3<D>^VRCN-B5WY+N-XFY;<D>^VRKNMB5WY+NMXFY;<1?\
+ME.!N6W$7Y+NMXFY;<1?DNZWB;EMQ%^2[K>)N6W$7Y+NMXFY;<1?DNZWB;E=Q
+M%^2[G>)N5W$7Y+N=XFY7<D>^VRGN=B5WY+N=XFY7<D>^VRGN=B5WY+N=XFY7
+M<D>^VRGN=B5WY+N=XFXLN2/?C8J[L>2.?#<J[L:*NX&?$MR-%7<#^6Y4W(T5
+M=P/Y;E3<C15W`_EN5-R-%7<#^6Y4W(T5=P/Y;E3<+?_WMYXCWTV*NZGB;B#?
+M38J[J>2.?#<I[J:2._+=I+B;2N[(=Y/B;BJY(]]-BKNIY(Y\-RGNII([\MVD
+MN-N7W)'O]HJ[?<D=^6ZON-M7W&WX*<'=ON)N0[[;*^[V%7<;\MU><;>ON-N0
+M[_:*NWW%W89\MU?<[2ON-N2[O>)N^<^0>HY\=U#<'2KN-N2[@^+N4')'OCLH
+M[@XE=^2[@^+N4')'OCLH[@XE=^2[@^+N4')'OCLH[@XE=^2[@^+N6')'OCLJ
+M[HXE=^2[H^+N6'&WY:<$=\>*NRWY[JBX.U;<;<EW1\7=L>)N2[X[*NZ.%7=;
+M\MU1<7>LN-N2[XZ*NU/%W99\=U+<G2KNMN2[D^+N5')'OCLI[DXE=^2[D^+N
+M5')'OCLI[DXE=^2[D^+N5')'OCLI[DXE=^2[D^+N7')'OCLK[LXE=^2[L^+N
+M7'&WXZ<$=^>*NQWY[JRX.U?<[<AW9\7=N>)N1[X[*^[.%7<[\MU9<7>NN-N1
+M[\Z*NTO%W8Y\=U'<72KN=N2[B^+N4G)'OKLH[BXE=^2[B^+N4G)'OKLH[BXE
+M=^2[B^+N4G)'OKLH[BXE=^2[B^#.EN_H.?"=K05WMBZY`]_96G!GZXJ[D9]B
+M[JSL[T;PG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*
+M_FX$WYGJ[ZSL[T;PG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN!-^9ZN^L[.]&
+M\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^;B3?J?[.ROYN)-^I_L[*_F[BIP1W
+M97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O
+M5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_
+M-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97^WYZ<$=V5_MR??J?[.
+MROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[._VY#O5WUG9W^W)
+M=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]G97]W9Y\I_H[*_N[/?E.]7=6
+M]G=[\IWJ[ZSL[_;D.]7?6=G?[<EWJK^SLK\[\%."N[*_.Y#O5']G97]W(-^I
+M_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?6=G?
+M'<AWJK^SLK\[D.]4?V=E?W<@WZG^SLK^[D"^4_V=E?W=@7RG^CLK^[L#^4[U
+M=U;V=P?RG>KOK.SO#N0[U=]9V=\=^2G!7=G?'<EWJK^SLK\[DN]4?V=E?W<D
+MWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[U=]9
+MV=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z.RO[NR/Y
+M3O5W5O9W1_*=ZN^L[.]._)3@KNSO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_
+M=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L[.].Y#O5
+MWUG9WYW(=ZJ_L[*_.Y'O5']G97]W(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[
+M$_E.]7=6]G=G?DIP5_9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5']G
+M97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ[ZSL[\[D
+M.]7?6=G?G<EWJK^SLK\[D^]4?V=E?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK
+M^[L+/R6X*_N["_E.]7=6]G<7\IWJ[ZSL[R[D.]7?6=G?7<AWJK^SLK^[D.]4
+M?V=E?W<AWZG^SLK^[D*^4_V=E?W=A7RG^CLK^[L+^4[U=U;V=Q?RG>KOK.SO
+M+N0[U=]9V=]=R'>JO[.RO[N0[U1_Y\MWTMRJSX'OOC_%W'GJ[Y;[]%:=._"=
+MJ_[.4W^WFKE;+=S%FI]B[CSU=ZN9N]7O;0Y\YZJ_\]3?K:[I[(+NOW/5WWGJ
+M[]K9]3GPG:O^SE-_!W/@.U?]G:?^#N;`=Z[Z.T_]W3+WH,^![USU=Y[ZNP?+
+MW*K-@>]<]7>>^KL',W</.G?@.U?]G:?^[L',W8/.'?C.57_GJ;][<+TY._"=
+MJ_[.4W_7SJ[/@>]<]7>>^CN8`]^YZN\\]7<P![YSU=]YZN^6N8=]CGRG^CM/
+M_=W#9:YS1[Y3_9VG_N[AS-W#QAW=?^>JO_/4WSV<N7O8N*/[[USU=Y[ZNX?7
+M?'9T_YVK_LY3?]?.KL^1[U1_YZF_@SGRG>KO//5W,$>^4_V=I_YNF7O4Y\AW
+MJK_SU-\]6N8:=W3_G:O^SE-_]VCF[E'GCGRG^CM/_=VCF;M'G3ORG>KO//5W
+MCZXW9T>^4_V=I_ZNG5V?(]^I_LY3?P=SY#O5WWGJ[V".?*?Z.T_]W3+WN,^1
+M[U1_YZF_>[S,=>[(=ZJ_\]3?/9ZY>]RXH_OO7/5WGOJ[QS-WCQMW=/^=J_[.
+M4W_W^)K/CNZ_<]7?>>KOVMGU.?*=ZN\\]7<P1[Y3_9VG_@[FR'>JO_/4WRUS
+M3_H<^4[U=Y[ZNR?+7...[K]SU=]YZN^>S-P]Z=R1[U1_YZF_>S)S]Z1S1[Y3
+M_9VG_N[)]>;LR'>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_GJ;];
+MYI[V.?*=ZN\\]7=/E[G.'?E.]7>>^KNG,W=/&W=T_YVK_LY3?_=TYNYIXX[N
+MOW/5WWGJ[YY>\]G1_7>N^CM/_5T[NSY'OE/]G:?^#N;(=ZJ_\]3?P1SY3O5W
+MGOJ[9>Y9GR/?J?[.4W_W;)EKW-']=Z[Z.T_]W;.9NV>=._*=ZN\\]7?/9NZ>
+M=>[(=ZJ_\]3?/;O>G!WY3O5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y\IWJ
+M[SSU=\O<\SY'OE/]G:?^[ODRU[DCWZG^SE-_]WSF[GGCCNZ_<]7?>>KOGL_<
+M/6_<T?UWKOH[3_W=\VL^.[K_SE5_YZF_:V?7Y\AWJK_SU-_!'/E.]7>>^CN8
+M(]^I_LY3?[?,O>ASY#O5WWGJ[UXL<XT[NO_.57_GJ;][,7/WHG-'OE/]G:?^
+M[L7,W8O.'?E.]7>>^KL7UYNS(]^I_LY3?]?.KL^1[U1_YZF_@SGRG>KO//5W
+M,$>^4_V=I_YNF7O9Y\AWJK_SU-^]7.8Z=^0[U=]YZN]>SMR];-S1_7>N^CM/
+M_=W+F;N7C3NZ_\Y5?^>IOWMYS6=']]^YZN\\]7?M[/H<^4[U=Y[Z.Y@CWZG^
+MSE-_!W/D.]7?>>KOEKE7?8Y\I_H[3_W=JV6N<4?WW[GJ[SSU=Z]F[EYU[LAW
+MJK_SU-^]FKE[U;DCWZG^SE-_]^IZ<W;D.]7?>>KOVMGU.?*=ZN\\]7<P1[Y3
+M_9VG_@[FR'>JO_/4WRUSK_L<^4[U=Y[ZN]?+7.>.?*?Z.T_]W>N9N]>-.[K_
+MSE5_YZF_>SUS][IQ1_??N>KO//5WKZ_Y[.C^.U?]G:?^KIU=GR/?J?[.4W\'
+M<^0[U=]YZN]@CGRG^CM/_=TR]Z;/D>]4?^>IOWNSS#7NZ/X[5_V=I_[NS<S=
+MF\X=^4[U=Y[ZNS<S=V\Z=^0[U=]YZN_>7&_.CGRG^CM/_5T[NSY'OE/]G:?^
+M#N;(=ZJ_\]3?P1SY3O5WGOJ[9>YMGR/?J?[.J_XNZ/X[5_V=5_U=T/UWKOH[
+MK_J[H/OO7/5W7O5W0???N>KOO.KO@NZ_<]7?>=7?!=U_YZJ_\ZJ_"[K_SE5_
+MYZ*_>]?GR'>JO_/4W[U;YAIW=/^=J_[.4W_W;N;N7>>.?*?Z.T_]W;N9NW>=
+M._*=ZN\\]7?OKC=G1[Y3_9VG_JZ=79\CWZG^SE-_!W/D.]7?>>KO8(Y\I_J[
+M6+Z3YM9]#GP7JK_[_A/WN%O\M.[<@>]"]7>1^KOUO+=NW-']=Z'ZNTC]W7KF
+M;MVXH_OO0O5WD?J[]36?'=U_%ZJ_B]3?M;/K<^"[4/U=I/X.YL!WH?J[2/T=
+MS('O0O5WD?J[9<[Z'/@N5'\7J;^S9:YQ1_??A>KO(O5W-K\\Z]R![T+U=Y'Z
+M.YNYL\X=^"Y4?Q>IO[/KS=F![T+U=Y'ZNW9V?0Y\%ZJ_B]3?P1SX+E1_%ZF_
+M@SGP7:C^+E)_M\QYGR/?J?XN4G_GRUSGCGRG^KM(_9W/W'GCCNZ_"]7?1>KO
+M?.;.&W=T_UVH_BY2?^?7?'9T_UVH_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W
+M,$>^4_U=I/YNF8L^1[Y3_5VD_BZ6N<8=W7\7JK^+U-_%S%UT[LAWJK^+U-_%
+MS%UT[LAWJK^+U-_%]>;LR'>JOXO4W[6SZW/D.]7?1>KO8(Y\I_J[2/T=S)'O
+M5'\7J;];YH8^1[Y3_5VD_FY8YCIWY#O5WT7J[X:9NZ%Q1_??A>KO(O5WP\S=
+MT+BC^^]"]7>1^KOAFL^.[K\+U=]%ZN_:V?4Y\IWJ[R+U=S!'OE/]7:3^#N;(
+M=ZJ_B]3?+7.;/D>^4_U=I/YNL\PU[NC^NU#]7:3^;C-SM^G<D>]4?Q>IO]O,
+MW&TZ=^0[U=]%ZN\VUYNS(]^I_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W,$>^
+M4_U=I/YNF=OV.?*=ZN\B]7?;9:YS1[Y3_5VD_FX[<[=MW-']=Z'ZNTC]W7;F
+M;MNXH_OO0O5WD?J[[36?'=U_%ZJ_B]3?M;/K<^0[U=]%ZN]@CGRG^KM(_1W,
+MD>]4?Q>IOUOF=GV.?*?ZNTC]W6Z9:]S1_7>A^KM(_=UNYF[7N2/?J?XN4G^W
+MF[G;=>[(=ZJ_B]3?[:XW9T>^4_U=I/ZNG5V?(]^I_BY2?P=SY#O5WT7J[V".
+M?*?ZNTC]W3(W]CGRG>KO(O5WXS+7N2/?J?XN4G\WSMR-C3NZ_RY4?Q>IOQMG
+M[L;&'=U_%ZJ_B]3?C==\=G3_7:C^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B]7<P
+M1[Y3_5VD_FZ9F_H<^4[U=Y'ZNVF9:]S1_7>A^KM(_=TT<S=U[LAWJK^+U-]-
+M,W=3YXY\I_J[2/W==+TY._*=ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^+E)_!W/D
+M.]7?1>KOEKGW?8Y\I_J[2/W=^V6N<T>^4_U=I/[N_<S=^\8=W7\7JK^+U-^]
+MG[E[W[BC^^]"]7>1^KOWUWQV=/]=J/XN4G_7SJ[/D>]4?Q>IOX,Y\IWJ[R+U
+M=S!'OE/]7:3^;IG[T.?(=ZJ_B]3??5CF&G=T_UVH_BY2?_=AYNY#YXY\I_J[
+M2/W=AYF[#YT[\IWJ[R+U=Q^N-V='OE/]7:3^KIU=GR/?J?XN4G\'<^0[U=]%
+MZN]@CGRG^KM(_=TR]['/D>]4?Q>IO_NXS'7NR'>JOXO4WWV<N?O8N*/[[T+U
+M=Y'ZNX\S=Q\;=W3_7:C^+E)_]_&:SX[NOPO5WT7J[]K9]3GRG>KO(O5W,$>^
+M4_U=I/X.YLAWJK^+U-\M<Y_Z'/E.]7>1^KM/RUSCCNZ_"]7?1>KO/LW<?>K<
+MD>]4?Q>IO_LT<_>I<T>^4_U=I/[NT_7F[,AWJK^+U-^UL^MSY#O5WT7J[V".
+M?*?ZNTC]'<R1[U1_%ZF_6^8^]SGRG>KO(O5WGY>YSAWY3O5WD?J[SS-WGQMW
+M=/]=J/XN4G_W>>;N<^..[K\+U=]%ZN\^7_/9T?UWH?J[2/U=.[L^1[Y3_5VD
+M_@[FR'>JOXO4W\$<^4[U=Y'ZNV7N2Y\CWZG^+E)_]V69:]S1_7>A^KM(_=V7
+MF;LOG3ORG>KO(O5W7V;NOG3NR'>JOXO4WWVYWIP=^4[U=Y'ZNW9V?8Y\I_J[
+M2/T=S)'O5'\7J;^#.?*=ZN^&Y3MI[FN?`]\-JK\;4G_W=9GKW('OOC_%W`VI
+MO_LZ<_=UX6Y8\U/,W9#ZNZ\S=U]_;W/@NT'U=^UCF<N]\4#WW_6GBKD[W[[]
+M]O+'X.;'VQU\M=[#O_5/?/O'V_O_M,$?5_W\"X/??Z-=+C>#RQO>_+CJY_LO
+M^/ZQW\S?^?ZQMCMO^(^O46SZ#3]X>V>.OI3R7SD_NIWG5X.;S6J_OQG\G^7U
+M^=_]Z?CQU\$WN]6P66VVJ]'_[!O^O__XW_2&?\[1EX__M\[OYUR)<WO!]F?F
+M?OSQ?>=7WB5#_\2WCLG;._?@;>BO@_<7\8>OSO03\M71EX__*^S=_)7KNY_G
+M'U^`_OO_UE[^<TJZE[1]?E?]]5&B?N_M_N+UK6[?[H\_(G?W?[W=F?/B[:[N
+MSQU^^;G]]:M[</OJZ$NT_Y5/QLU?'/Z3OW/_&+G_._?GG/^](MC],,L??XKM
+BX=_Z)[[]\^W]?WX.#O/@WW:"PWK\_BI_^W]F=\)"L*<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow2.gz.uu
new file mode 100644
index 0000000..09fa383
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.qcow2.gz
+M'XL("*0[(U0``VEM9RTQ>#$M-#`Y-BUM8G(N<6-O=S(N;W5T`*V8V;+3,`Q`
+MW_L5+LL%+E!BR4Y3E@O<A1G>X`%X3I=\13^>)%;C1)'BMI/6DVG'T1G9/E:6
+M+`L?8[PU+C=N8ZJMJ?]3`]/[,VSF^/O'SU7_<UP$F,V4**'#88<;L!XB#C1<
+M9L<=5L;ULD,!!Z>H,2B%<VIV4QT"[G;13EV[&`6+P&N``:<NQE7Y0<B/1[@K
+M\X.Y\T-Y_OPICG?DT_EAR(]'K35<D<2!$+71<&42AT+45L/MDC@G1.TUW"&)
+M\T)4I>!L0I4:EPM15L-!$K<6HE##N22N$*(T[VS:NXT0I7EGT]Z50I3FG4U[
+MMQ6B-.]LVKN=$*5Y9]/>[84HS3M0O#,1=Q"B-.^`>;<DW+.(JX0HS3M@WCTG
+MW(L.9Z4HS3M@WKTDW$W$"?4.-.^`>?>*<*\C3JAWH'D'S+LWA+N-.*'>@>8=
+M,._>$NY=Q`GU#C3O@'GW?N2=%>H=:-XA\^X#L;*($^H=:MXA\\X2#B).J'>H
+M>8?,.R2<BSBAWJ'F'3+O/.'RB!/J'6K>(?-N3;@BXH1ZAYIWR+S;$.YCQ`GU
+M#C7OD'GWB7"?(TZH=ZAYA\R[+X2[BSBAWJ'FG6/>?27<MX@3ZIW3O'/,N^^$
+MNX\XH=XYS3O'O'L@W&.'`RFJ\R[+Y$:XI]&>A7GO/UV\/[;"4>^8`!:7`*<R
+M#+C-K`/V8<"-!J5PU#N.]ZOAMP.VF^T"8#T_534"TH!]V&SU"74K/?VH6Y@O
+M&I[M7=&%`2]7/=Q^YOEK]\<%0.]-68Z`?T[YP=S+X1J@7S>;S.>F@','_._I
+M[]B_&C?;A@LX_>T`=70)VW-P[=N!WIE],_2.X;W>,N(FWPXTCSP'J4/-SL_L
+MGBM87'^=VV>U77RH97?*W?J:F)]06V`PW(G\S'BXS46\>]AFJ]@N0&*X9HC;
+M3J[M=';+<7:[F1?#\YUQYLYM(,.=&W`P;R&`MK+4!M9GC8]ZQ_'7:O@-0$?`
+1V6;0Y<VE:/$?-R^$K](4````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.raw.gz.uu
new file mode 100644
index 0000000..f256873
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.raw.gz
+M'XL("/+%'50``VEM9RTQ>#$M-#`Y-BUM8G(N<F%W+F]U=`"ME,NRPB`,AO=]
+MBKAUP80(Q[IUQKT;=8WU]"EX>(/I!8JM[0R04F8"W_PA!$1I`(8`W9=QWN'/
+M*NV^VE<?FGYN`]8(;9L!%0,%US".%[`YVTW84$,0SA^;1B#=S<7`J['M5(1[
+M#;MRFW?$."6X/MQV&]!:<"X#WGI]5#H=)@#M$8P%^P<UK0WX<;E/`A:<+G5^
+M@J-?N$&P7H,[A%W1ROAFS#O\>$WDW^/,DCI&X/^F8&WANV?JR;XXSX!<)0U@
+MW?DH!0[YA5'?*9=!2;@+^B`/UP7<,5VO(QS]"!=2W',QM\OJ=KFZIG`R[+0R
+L5E9N@*25*S@J^Q#0YV7A&\BK\G'>X:\J[0(T';#8"1H*P.H-:WH%_)0&````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhd.gz.uu
new file mode 100644
index 0000000..eee43f3
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.vhd.gz
+M'XL("!$UQ%4``VEM9RTQ>#$M-#`Y-BUM8G(N=FAD+F]U=`"M5\]SG"`4ON]?
+M\3*]Y>#`$Y[FFIG<>VES5E?3G4[;3))##O9_+P@HB)@U15D6%][']W[*,F8N
+M`"J!!J`>2.IQ)8#NH*H!U*1M./7</L+8_?G==V^7]\)>X\F`<>9+A>):'DL0
+M:I,*L-&;T%F/870PQ9>'I]O+KR<'AQ8.+9"LM%2)0&VTCU"_UH:=1GJ\X,\)
+M\O['S*Z,V2U2ZE.=@0G@W%M1.G8*IO@;*BN4U#!,K0+63_9Q+7@()A9E5[:3
+M;"7ET=PR*EN4W8*C/:DC<+<GZPL3*BHP*M4S(`X5ZK$*&V>'J*E0>7]];EY>
+M^Q4_3(0*S?QX-%>FU44;*N@66P9"A_.>NC"AO*WA-D+EOZQ'H9RP`V4$)MT$
+M3NJ'UEN@P.='G.W8/.V,)+]&\U/)P)J-/CTQWA?A/0.V[3'`FAF&(=RL<-O-
+M"C=RT<@$R6),Y&F'W'CV:\^9_=L.QP"EA*:)`+\Y?EUN=_0:4)5/57TE08W7
+M*OSX\'TKW?I$]GZR6/7X$=Q,F%\#5]I2ZE;ZD9&>&)<P,=\.3NRQTRG<'U)6
+M9HZ]OE[)^7X&IK*D`U9[1<8#G/T+"[^[F`8&ZN[P@UC=1L-5X7KNP>$'ZD((
+MU^[Z=I_=3<RNR^R,89T95V:N!@DSU\!AWD*`4V51$:A6Q7UZ8OQ:A+<!1/OF
+MR/8J0EO[LC$4%C`;0^&*:3Z&)=L-MJ-12)9AIG,]I<O]9\[UY)7[#.=Z<N4^
+D)<4.G>O)EOM,YWIRY3[/N5[#93W7D_K'QMCI'_LT8,@,#@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdf.gz.uu
new file mode 100644
index 0000000..434cd61
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.vhdf.gz
+M'XL("(`EAE4``VEM9RTQ>#$M-#`Y-BUM8G(N=FAD9BYO=70`K96]<H,P#(#W
+M/(5RW3)PMK`,67N7/4O;&0CD<KVT2X<./'QEC,'&@20]0"'.R?HB63\(82\`
+MA2"*&\]Y1?N:A'>[V6TZFBR?`^8"FB8")@RTN(IQO(&EH'[!(B08Q_G#(@6@
+M[-=6H$W&:YMXN--@%<N\PL<E%N?";9X#$D%11,`WYQ^NG0YE@)2!(B`-.3X:
+M\,?A?1*PQ<FUSL_B\!YN<%@^@DN-E;?3KXQY13N6B?UV.+7D'2-$_52PM'+M
+MJ7QBY^<9!'=)!2+O=1@"A_S"Z-\^=@.#<!?\@SC<PN"R<+_T<'@G7`AQY6)N
+ME[W;QMY5*R>#IIWQ8.<:2-BY%H?K#@+L)@M7(.^*G_.*]IB$MP6J'KC:"5+_
+M*M(IZ`9T#9K,.E.@]Y#E/A##2FJK[Z^Z^KG\^ADV.#F\.6(Q]IB:;M$98&'^
+M1)_,VO/OY7#>7:YGAW.CRDTD;C:V2A%T&85+DV:[X&>'/([>I?$AD7]Z>PU"
+M@91!X+UWQ["<J9OS+MBZ@5)UY^,D^!$H;HXJ@R,QL?IO;BU.KUPJ7'N;/\%5
+&,,:_"```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-mbr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vmdk.gz.uu
new file mode 100644
index 0000000..bcbad1e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-mbr.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-mbr.vmdk.gz
+M'XL("//%'50``VEM9RTQ>#$M-#`Y-BUM8G(N=FUD:RYO=70`K5Q=C]S&$7SW
+MKZ"EER`/"]:27)(/`A+G'"`(`AB68[^&G]$AMB2<#D$,[(_/##DU5[P5-;2O
+MY3V1H^VNG>[9JSM7%S;/US]95O9966;EF%67+$?F_FE]9'GQM'"/<\,GKG^_
+M^\>/)_[YP^ET_6H%@\^2%.0*)XO-ZUQ/S_X0[OREK,T3[G%.PA4^J[])#'#G
+MG2=VX4KWY/ES*=Q=MSP]^AN!RR)0MH&K/E/3;K%?VMT?OPK-\_LK_![<\5[:
+MK"ZR2Q^6V:5:UD56GY?G\JQV0;,#?)W=W7_Z3W8W?1H>[C\^?@C[._NS=<'E
+MQ<=?!H_@"JLO_L8_X>%:#W&9LF+,"OBGL^O#7^]_GD[_G1X^W7]X_P8L]^S/
+MMBRRLO7;\?'YTV.S\"^29Q?XU\BN?_G;W9OPSLU/'[L'PODLMQ'WVJX.Q;U<
+M,O]U^UAV-[U_](AS^!-WY\\V-*=:7KOT-U69U6VV;*?RV&?W]!A*7GHW/$S=
+MX_3#KQ^G-Z]^^?`^]LZ?K6]9NP`U2Z.*K"H\5"C-MZ_RB/YMLYQ:=OWY_O'=
+M_?#6E?EI>G5ZG1'NXGOG#K`)^UJK=BF7W9-UV[Y^^[]'5V\VAI.])]RRB:4(
+M]]K5.:MJC^4.<#F*<U:4_L[]D]NPJZ2$#\JN']Z?OO_)?8O[9KW][L_?$ZYQ
+M62[2;="EN((V-55K_=7SMV5V??MM]LH7^<.[:7D'$JY=O\U\\'H.6)9G?Q.Z
+MML)[$BO]$\O)9G?=8Y=]TWV:3J_O[KZ))]OY8LOEX;8V>93+"NW?WTL[7>/6
+MDUX/>CF*<>Q/W=A]?)P>_/'&H^A]B\90J3_6\ND8MZ]3+R<U^W=,=GV3O;H?
+MW9EZV']/'WXAW+"^C=T^_%NB71(+?^/>/0O\%%YA?<?X8_)PT^/#KZ?AUY_O
+MWX_N&RU[0[AQ[9W;SGJ:3X?I#M#M\+,;=+U[M9QJW![A)K^[\6:#RWF&1L9-
+MQ9?-KK\LVWLW=:/;FL,FW.QW=_[\/D*GGKV40\^N3UU;<#\%N"(/%%`$*MNT
+M*&YG?4$AT&EX_/"P;NR5\''Q_&?92_FXO/F16O].P!7.>G^7_-G/LT+S2EE4
+M&T#_4RQW7W]R7]\][>_B]W>1R%JS&EFT&[A_.8B/M^5>_'=A)Y&]9@VR&(]T
+M[^*I;9+(^7GW^*L&Y'X?CK\+,++0K%(6U09NKW=5Z!TC:\UJ9-%NX/9Z=PF]
+M8V2O68,LQD/%UJ%WC)PURU_XJQ3R`[^679K0.T86FE7*HMK`[?6N#;UC9*U9
+MC2S:#=Q>[[K0.T;VFC7(8CQ4;!]ZQ\A9L_R%!`&YWX<;0N\866A6*8MJ`[?7
+MNS'TCI&U9C6R:#=P>[V;0N\8V6O6((OQ4+%SZ!TC9\WREU)Z5Z;@ZCSTCI&%
+M9I6RJ#9P.[VKR7>,K#6KD46[@=OI74V^8V2O68,LQD/%DN\8.6N6OU32NRH)
+M1[YC9*%9I2RJ#=Q>[\AWC*PUJY%%NX';ZQWYCI&]9@VR&`\52[YCY*Q9_G*1
+MWEV2<.0[1A::5<JBVL#M]8Y\Q\A:LQI9M!NXO=Z1[QC9:]8@B_%0L>0[1LZ:
+MY2_\)0AROP]'OF-DH5FE+*H-W%[OR'>,K#6KD46[@=OK'?F.D;UF#;(8#Q5+
+MOF/DK%G^0D$&<K\+U^2A=XPL-*N41;6!V^E=0[YC9*U9C2S:#=Q.[QKR'2-[
+MS1ID,1XJEGS'R%FS_*65WK5)./(=(PO-*F51;>#V>D>^8V2M68TLV@W<7N_(
+M=XSL-6N0Q7BH6/(=(V?-\A?^_Q/D?A^.?,?(0K-*650;N+W>D>\866M6(XMV
+M`[?7._(=(WO-&F0Q'BJ6?,?(6;/\A?HCY'X?CGS'R$*S2EE4&[B]WI'O&%EK
+M5B.+=@.WUSOR'2-[S1ID,1XJEGS'R%FS_&60W@TIN#8/O6-DH5FE+*H-W$[O
+M6O(=(VO-:F31;N!V>M>2[QC9:]8@B_%0L>0[1LZ:Y2^C]&Y,PI'O&%EH5BF+
+M:@.WUSOR'2-KS6IDT6[@]GI'OF-DKUF#+,9#Q9+O&#EKEK],TKLI"4>^8V2A
+M6:4LJ@W<7N_(=XRL-:N11;N!V^L=^8Z1O68-LA@/%4N^8^2L6?XR2^_F)!SY
+MCI&%9I6RJ#9P>[TCWS&RUJQ&%NT&;J]WY#M&]IHUR&(\5"SYCI&S9N4R/8/<
+M[\)U^=J[&%EH5BF+:@.WT[LN\%V,K#6KD46[@=OI71?X+D;VFC7(8CQ4;."[
+M&#EKEF^9Z'=(2EI=X#N(?@?5[R#Z'9+Z71?X#J+?0?4[B'Z'I'[7!;Z#Z'=0
+M_0ZBWQTH-O`=1+^#ZG<0_0Y)2:L+?`?1[Z#Z'42_0U*_ZP+?0?0[J'X'T>^0
+MU.^ZP'<0_0ZJWT'TNP/%!KZ#Z'=0_0ZBWR$I:76![R#Z'52_@^AW2.IW7>`[
+MB'X'U>\@^AV2^ET7^`ZBWT'U.XA^=Z#8P'<0_0ZJWT'T.R0EK3X/O1/]#JK?
+M0?0[)/6[GGPG^AU4OX/H=TCJ=SWY3O0[J'X'T>\.%$N^$_T.JM]!]#LD):V>
+M?"?Z'52_@^AW2.IW/?E.]#NH?@?1[Y#4[WKRG>AW4/T.HM\=*)9\)_H=5+^#
+MZ'=(2EH]^4[T.ZA^!]'OD-3O>O*=Z'=0_0ZBWR&IW_7D.]'OH/H=1+\[4"SY
+M3O0[J'X'T>^0E+1Z\IWH=U#]#J+?(:G?]>0[T>^@^AU$OT-2O^O)=Z+?0?4[
+MB'YWH%CRG>AW4/T.HM\A*6D->>B=Z'=0_0ZBWR&IWPWD.]'OH/H=1+]#4K\;
+MR'>BWT'U.XA^=Z!8\IWH=U#]#J+?(2EI#>0[T>^@^AU$OT-2OQO(=Z+?0?4[
+MB'Z'I'XWD.]$OX/J=Q#][D"QY#O1[Z#Z'42_0U+2&LAWHM]!]3N(?H>D?C>0
+M[T2_@^IW$/T.2?UN(-^)?@?5[R#ZW8%BR7>BWT'U.XA^AZ2D-9#O1+^#ZG<0
+M_0Y)_6X@WXE^!]7O(/H=DOK=0+X3_0ZJWT'TNP/%DN]$OX/J=Q#]#DE):\Q#
+M[T2_@^IW$/T.2?UN)-^)?@?5[R#Z'9+ZW4B^$_T.JM]!]+L#Q9+O1+^#ZG<0
+M_0Y)26LDWXE^!]7O(/H=DOK=2+X3_0ZJWT'T.R3UNY%\)_H=5+^#Z'<'BB7?
+MB7X'U>\@^AV2DM9(OA/]#JK?0?0[)/6[D7PG^AU4OX/H=TCJ=R/Y3O0[J'X'
+MT>\.%$N^$_T.JM]!]#LD):V1?"?Z'52_@^AW2.IW(_E.]#NH?@?1[Y#4[T;R
+MG>AW4/T.HM\=*)9\)_H=5+^+9CK(O<!EZU>`F_*U=S&RT*P\__S#]<Y!Y-G-
+M[B9C?R`6?V"<*:Q5_3[`%<YZ?W&^+?U[RONM_D7$^38?+_(O(LZW^7B1?Q%Q
+MOLW'B_R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q
+M+R+.MTW\BXCS;1/_(N)\V\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;Q+^(.-\V
+M\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q+R+.MTW\BXCS;1/_(N)\V\2_B#C?
+M-O$O(LZW3?R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(O@?-O&OPC.MVW\B^!\
+MV\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;
+MQK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&
+MOPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_
+M",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\BXCS;4:^R+^(.-]FY(O\BXCS
+M;4:^R+^(.-]FY(O\BXCS;1/_(N)\V\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;
+MQ+^(.-\V\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q+R+.MTW\BXCS;1/_(N)\
+MV\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(N(\VT3_R+B
+M?-O$OX@XWS;Q+R+.MTW\BXCS;1/_(N)\V\2_B#C?-O$O(LZW3?R+X'S;QK^(
+MR=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)
+MU+^(R=2_B,G4OXC)U+^(.<\-_8N83?V+F$W]BYA-_8N83?V+F$W]BYA-_8N8
+M3?V+F$W]BYA-_8N83?V+F$W]BYA-_8N83?V+F$W]BYA-_8OG/,\-_8OGF\\2
+MWF3MP]T6N_H#RV5_ZZ>#WOZ]_\3UF]/VOPB(_K<!NO.>YQM`%ES"O_=<@'MT
+M5;AQC]69)@>!_8*_/@G<:-P_S+\-L*JRKKL!_"?W=[8^CN7S-:O:?^YL=<F:
+M\]&"?_KVQV<%KW!F[[\5[N:SK)_#Q0T?^&CLLEP^RUHB]9VQ_\3UZ6VR7@E7
+M?FEW.C8Z5JSQ9UF79?,L3\]Y&3H,3_:(9U05SS=[VE][NXWSIMPO[.^&JLK2
+M_TS33W/54]R0YTZYV1:N_^+9?GEW7]_N;C`^C.KY=\;![UP/LOW.7>'.MD1P
+E69AE]6+<_KW_Q/6[T_:_%;`,@&8=+/TGL>5?_1_0^/1A@%\`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu
new file mode 100644
index 0000000..efca490
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.qcow.gz
+M'XL("+(S(E0``VEM9RTQ>#$M-#`Y-BUP8SDX+G%C;W<N;W5T`*V=RXX<1Y)%
+M]_J*Y/M-EIE%9D;PC0:Z@=GU+&9FJWRN\P/X\4-61;BS+,^EL2%1!8%$*2XR
+MO0X/(>G`Z^;F[L=JM;;5L%D-T^J\7WW_]?QAJY]^<?]C]>V___5?;W_^\>V/
+MNS&[^<53Z=>#KX9Y[M[6/[ZV.?_QU&%U,_W&W/</H[F?7EW\!Z_NIS=[/??R
+MC[LWR\^Y&HQ[@ZMY[F9^?29.;_B]U_<UO5V[.[V_[^VZ>+MK-;BY-_CO>>[/
+M^?6Y>+M;-3?>F[NDM^OB[4YJ;O=+6%S`LE=SAV)NP*>.:NY4S*WQJ3//V2^^
+MMG=S&WS*U)SCW*K-;?&I4'/W-7#S=@%ZF1OQ*<&=E=Q-^)3@SDKN=OB4X,Y*
+M[O;XE.#.2NX.^)3@SDKNCOB4X,Y+[D[XE.#.2^[.^)3@+O_Q<\6=\5.".Z^X
+M,_*=*^Z\XL[(=ZZX\XH[(]^YXLXK[HQ\YXH[K[@S\ITK[J+BSLAWH;B+BCLC
+MWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.Z&
+MDCORW:"X&TKNR'>#XFZHN'-^2G`W5-PY^6Y0W`T5=TZ^&Q1W0\6=D^\&Q=U0
+M<>?DNT%Q-U3<.?EN4-RM*^Z<?+=6W*TK[IQ\MU;<K4ONR'=KQ=VZY(Y\MU;<
+MK4ONR'=KQ=VZY(Y\MU;<K4ONR'=KQ=VZY(Y\MU;<;4KNR'<;Q=VFY(Y\MU'<
+M;2KN@I\2W&TJ[H)\MU'<;2KN@GRW4=QM*NZ"?+=1W&TJ[H)\MU'<;2KN@GRW
+M4=QM*^Z"?+=5W&TK[H)\MU7<;4ONR'=;Q=VVY(Y\MU7<;4ONR'=;Q=VVY(Y\
+MMU7<;4ONR'=;Q=VVY(Y\MU7<C25WY+M1<3>6W)'O1L7=6'$W\%."N['B;B#?
+MC8J[L>)N(-^-BKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKOE/W_K.?+=I+B;
+M*NX&\MVDN)M*[LAWD^)N*KDCWTV*NZGDCGPW*>ZFDCORW:2XFTKNR'>3XFXJ
+MN2/?38J[7<D=^6ZGN-N5W)'O=HJ[7<7=FI\2W.TJ[M;DNYWB;E=QMR;?[11W
+MNXJ[-?ENI[C;5=RMR7<[Q=VNXFY-OMLI[I;_#:GGR'=[Q=V^XFY-OMLK[O8E
+M=^2[O>)N7W)'OMLK[O8E=^2[O>)N7W)'OMLK[O8E=^2[O>)N7W)'OMLK[@XE
+M=^2[@^+N4')'OCLH[@X5=QM^2G!WJ+C;D.\.BKM#Q=V&?'=0W!TJ[C;DNX/B
+M[E!QMR'?'11WAXJ[#?GNH+@[5MQMR'='Q=VQXFY#OCLJ[HXE=^2[H^+N6')'
+MOCLJ[HXE=^2[H^+N6')'OCLJ[HXE=^2[H^+N6')'OCLJ[DXE=^2[D^+N5')'
+MOCLI[DX5=UM^2G!WJKC;DN].BKM3Q=V6?'=2W)TJ[K;DNY/B[E1QMR7?G11W
+MIXJ[+?GNI+@[5]QMR7=GQ=VYXFY+OCLK[LXE=^2[L^+N7')'OCLK[LXE=^2[
+ML^+N7')'OCLK[LXE=^2[L^+N7')'OCL+[FSYB9X#W]F-X,YN2N[`=W8CN+.;
+MBKN1GV+NK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;P
+MG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ
+M[ZSL[T;PG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN)-^I_L[*_FXDWZG^SLK^
+M;N*G!'=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G
+M97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O
+M5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?[?CIP1W97^W
+M(]^I_L[*_FY'OE/]G97]W8Y\I_H[*_N['?E.]7=6]G<[\IWJ[ZSL[W;D.]7?
+M6=G?[<AWJK^SLK_;D>]4?V=E?[<CWZG^SLK^;D>^4_V=E?W=CGRG^CLK^[L=
+M^4[U=U;V=SORG>KOK.SO=N0[U=]9V=_MR'>JO[.RO]OS4X*[LK_;D^]4?V=E
+M?[<GWZG^SLK^;D^^4_V=E?W=GGRG^CLK^[L]^4[U=U;V=WORG>KOK.SO]N0[
+MU=]9V=_MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[
+MNSWY3O5W5O9W>_*=ZN^L[._VY#O5WUG9WQWX*<%=V=\=R'>JO[.ROSN0[U1_
+M9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W5O9W!_*=ZN^L[.\.
+MY#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`OE/]G97]W8%\I_H[
+M*_N[`_E.]7=6]G<'\IWJ[ZSL[X[\E."N[.^.Y#O5WUG9WQW)=ZJ_L[*_.Y+O
+M5']G97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.]7=6]G='\IWJ[ZSL
+M[X[D.]7?6=G?'<EWJK^SLK\[DN]4?V=E?W<DWZG^SLK^[DB^4_V=E?W=D7RG
+M^CLK^[LC^4[U=U;V=R=^2G!7]G<G\IWJ[ZSL[T[D.]7?6=G?G<AWJK^SLK\[
+MD>]4?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3^4[U=U;V=R?RG>KO
+MK.SO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)
+M?*?Z.RO[NS,_);@K^[LS^4[U=U;V=V?RG>KOK.SOSN0[U=]9V=^=R7>JO[.R
+MOSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[NS/Y3O5W5O9W9_*=
+MZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5'_GRT_2W*K/@>^^/\7<>>KOEOOT
+M5IT[\)VK_LY3?[>:N5LMW,4-/\7<>>KO5C-WJS_;'/C.57_GJ;];7=+9!=U_
+MYZJ_\]3?M;/K<^`[5_V=I_X.YL!WKOH[3_T=S('O7/5WGOJ[9>Y!GP/?N>KO
+M//5W#Y:Y59L#W[GJ[SSU=P]F[AYT[L!WKOH[3_W=@YF[!YT[\)VK_LY3?_?@
+M<G5VX#M7_9VG_JZ=79\#W[GJ[SSU=S`'OG/5WWGJ[V`.?.>JO_/4WRUS#_L<
+M^4[U=Y[ZNX?+7.>.?*?Z.T_]W<.9NX>-.[K_SE5_YZF_>SAS][!Q1_??N>KO
+M//5W#R_Y[.C^.U?]G:?^KIU=GR/?J?[.4W\'<^0[U=]YZN]@CGRG^CM/_=TR
+M]ZC/D>]4?^>IOWNTS#7NZ/X[5_V=I_[NT<S=H\X=^4[U=Y[ZNT<S=X\Z=^0[
+MU=]YZN\>7:[.CGRG^CM/_5T[NSY'OE/]G:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[
+M9>YQGR/?J?[.4W_W>)GKW)'O5'_GJ;][/'/WN'%']]^YZN\\]7>/9^X>-^[H
+M_CM7_9VG_N[Q)9\=W7_GJK_SU-^UL^MSY#O5WWGJ[V".?*?Z.T_]'<R1[U1_
+MYZF_6^:>]#GRG>KO//5W3Y:YQAW=?^>JO_/4WSV9N7O2N2/?J?[.4W_W9.;N
+M2>>.?*?Z.T_]W9/+U=F1[U1_YZF_:V?7Y\AWJK_SU-_!'/E.]7>>^CN8(]^I
+M_LY3?[?,/>USY#O5WWGJ[YXN<YT[\IWJ[SSU=T]G[IXV[NC^.U?]G:?^[NG,
+MW=/&'=U_YZJ_\]3?/;WDLZ/[[USU=Y[ZNW9V?8Y\I_H[3_T=S)'O5'_GJ;^#
+M.?*=ZN\\]7?+W+,^1[Y3_9VG_N[9,M>XH_OO7/5WGOJ[9S-WSSIWY#O5WWGJ
+M[Y[-W#WKW)'O5'_GJ;][=KDZ._*=ZN\\]7?M[/H<^4[U=Y[Z.Y@CWZG^SE-_
+M!W/D.]7?>>KOEKGG?8Y\I_H[3_W=\V6N<T>^4_V=I_[N^<S=\\8=W7_GJK_S
+MU-\]G[E[WKBC^^]<]7>>^KOGEWQV=/^=J_[.4W_7SJ[/D>]4?^>IOX,Y\IWJ
+M[SSU=S!'OE/]G:?^;IE[T>?(=ZJ_\]3?O5CF&G=T_YVK_LY3?_=BYNY%YXY\
+MI_H[3_W=BYF[%YT[\IWJ[SSU=R\N5V='OE/]G:?^KIU=GR/?J?[.4W\'<^0[
+MU=]YZN]@CGRG^CM/_=TR][+/D>]4?^>IOWNYS'7NR'>JO_/4W[V<N7O9N*/[
+M[USU=Y[ZNY<S=R\;=W3_G:O^SE-_]_*2SX[NOW/5WWGJ[]K9]3GRG>KO//5W
+M,$>^4_V=I_X.YLAWJK_SU-\M<Z_Z'/E.]7>>^KM7RUSCCNZ_<]7?>>KO7LW<
+MO>K<D>]4?^>IOWLU<_>J<T>^4_V=I_[NU>7J[,AWJK_SU-^UL^MSY#O5WWGJ
+M[V".?*?Z.T_]'<R1[U1_YZF_6^9>]SGRG>KO//5WKY>YSAWY3O5WGOJ[US-W
+MKQMW=/^=J_[.4W_W>N;N=>..[K]SU=]YZN]>7_+9T?UWKOH[3_U=.[L^1[Y3
+M_9VG_@[FR'>JO_/4W\$<^4[U=Y[ZNV7N39\CWZG^SE-_]V:9:]S1_7>N^CM/
+M_=V;F;LWG3ORG>KO//5W;V;NWG3NR'>JO_/4W[VY7)T=^4[U=Y[ZNW9V?8Y\
+MI_H[3_T=S)'O5'_GJ;^#.?*=ZN\\]7?+W-L^1[Y3_9U7_5W0_7>N^CNO^KN@
+M^^]<]7=>]7=!]]^YZN^\ZN^"[K]SU=]YU=\%W7_GJK_SJK\+NO_.57_G57\7
+M=/^=J_[.17_WKL^1[U1_YZF_>[?,->[H_CM7_9VG_N[=S-V[SAWY3O5WGOJ[
+M=S-W[SIWY#O5WWGJ[]Y=KLZ.?*?Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_!
+M'/E.]7>Q_"3-W?0Y\%VH_N[[)^YQM_CIIG,'O@O5WT7J[V[FO9O&'=U_%ZJ_
+MB]3?W<S<W33NZ/Z[4/U=I/[NYI+/CNZ_"]7?1>KOVMGU.?!=J/XN4G\'<^"[
+M4/U=I/X.YL!WH?J[2/W=,F=]#GP7JK^+U-_9,M>XH_OO0O5WD?H[FU^>=>[`
+M=Z'ZNTC]G<W<6><.?!>JOXO4W]GEZNS`=Z'ZNTC]73N[/@>^"]7?1>KO8`Y\
+M%ZJ_B]3?P1SX+E1_%ZF_6^:\SY'O5'\7J;_S9:YS1[Y3_5VD_LYG[KQQ1_??
+MA>KO(O5W/G/GC3NZ_RY4?Q>IO_-+/CNZ_RY4?Q>IOVMGU^?(=ZJ_B]3?P1SY
+M3O5WD?H[F"/?J?XN4G^WS$6?(]^I_BY2?Q?+7...[K\+U=]%ZN]BYBXZ=^0[
+MU=]%ZN]BYBXZ=^0[U=]%ZN_B<G5VY#O5WT7J[]K9]3GRG>KO(O5W,$>^4_U=
+MI/X.YLAWJK^+U-\M<T.?(]^I_BY2?S<L<YT[\IWJ[R+U=\/,W="XH_OO0O5W
+MD?J[8>9N:-S1_7>A^KM(_=UPR6=']]^%ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^
+M+E)_!W/D.]7?1>KOEKEUGR/?J?XN4G^W7N8:=W3_7:C^+E)_MYZY6W?NR'>J
+MOXO4WZUG[M:=._*=ZN\B]7?KR]79D>]4?Q>IOVMGU^?(=ZJ_B]3?P1SY3O5W
+MD?H[F"/?J?XN4G^WS&WZ'/E.]7>1^KO-,M>Y(]^I_BY2?[>9N=LT[NC^NU#]
+M7:3^;C-SMVG<T?UWH?J[2/W=YI+/CNZ_"]7?1>KOVMGU.?*=ZN\B]7<P1[Y3
+M_5VD_@[FR'>JOXO4WRUSVSY'OE/]7:3^;KO,->[H_KM0_5VD_FX[<[?MW)'O
+M5'\7J;_;SMQM.W?D.]7?1>KOMI>KLR/?J?XN4G_7SJ[/D>]4?Q>IOX,Y\IWJ
+M[R+U=S!'OE/]7:3^;ID;^QSY3O5WD?J[<9GKW)'O5'\7J;\;9^[&QAW=?Q>J
+MOXO4WXTS=V/CCNZ_"]7?1>KOQDL^.[K_+E1_%ZF_:V?7Y\AWJK^+U-_!'/E.
+M]7>1^CN8(]^I_BY2?[?,37V.?*?ZNTC]W;3,->[H_KM0_5VD_FZ:N9LZ=^0[
+MU=]%ZN^FF;NI<T>^4_U=I/YNNER='?E.]7>1^KMV=GV.?*?ZNTC]'<R1[U1_
+M%ZF_@SGRG>KO(O5WR]S[/D>^4_U=I/[N_3+7N2/?J?XN4G_W?N;N?>..[K\+
+MU=]%ZN_>S]R];]S1_7>A^KM(_=W[2SX[NO\N5'\7J;]K9]?GR'>JOXO4W\$<
+M^4[U=Y'Z.Y@CWZG^+E)_M\Q]Z'/D.]7?1>KO/BQSC3NZ_RY4?Q>IO_LP<_>A
+M<T>^4_U=I/[NP\S=A\X=^4[U=Y'ZNP^7J[,CWZG^+E)_U\ZNSY'O5'\7J;^#
+M.?*=ZN\B]7<P1[Y3_5VD_FZ9^]CGR'>JOXO4WWU<YCIWY#O5WT7J[S[.W'UL
+MW-']=Z'ZNTC]W<>9NX^-.[K_+E1_%ZF_^WC)9T?WWX7J[R+U=^WL^ASY3O5W
+MD?H[F"/?J?XN4G\'<^0[U=]%ZN^6N4]]CGRG^KM(_=VG9:YQ1_??A>KO(O5W
+MGV;N/G7NR'>JOXO4WWV:N?O4N2/?J?XN4G_WZ7)U=N0[U=]%ZN_:V?4Y\IWJ
+M[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?+7.?^QSY3O5WD?J[S\M<YXY\I_J[2/W=
+MYYF[SXT[NO\N5'\7J;_[/'/WN7%']]^%ZN\B]7>?+_GLZ/Z[4/U=I/ZNG5V?
+M(]^I_BY2?P=SY#O5WT7J[V".?*?ZNTC]W3+WI<^1[U1_%ZF_^[+,->[H_KM0
+M_5VD_N[+S-V7SAWY3O5WD?J[+S-W7SIWY#O5WT7J[[Y<KLZ.?*?ZNTC]73N[
+M/D>^4_U=I/X.YLAWJK^+U-_!'/E.]7?#\I,T][7/@>\&U=\-J;_[NLQU[L!W
+MWY]B[H;4WWV=N?NZ<#?<\%/,W9#ZNZ\S=U__;'/@NT'U=T/J[[Y>TMD-=/]=
+M^]"?^/8V_?CVQ\O;P?7MVQU\=;.#O^M/?/O'V_M_M<';ZVK^@\'U>K6['OR?
+M^0VO;Z^KF8;58:#W=3[WC^H-W\W1MS__*^<W_,WGM[U]P^OM:EBOUIO5Z+_[
+M"O_OG_\+;WC[][WAN[F2O_:"[7?F;O^\_>F?_/'MIEM(*3]Q-W=U<=V6[N?I
+M+^*'8$[T"?GJZ/N]_P58ME=WX/S\=;[]CO'?_^5X^?\?Z2+1]O5=]=='3?F]
+MM_N+U[>Z?KNW?Z9M[__S]M.<%V]W=7]N_\NO[:]?W8/K5T??4_VO?#&N;G+Y
+MS=^Y/T;N_\Z]F_._5P33K9E__+&S@[_K3WS[]]O[?]T-#K>#?_P_?B!?31"G
+"````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu
new file mode 100644
index 0000000..afb67c9
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.qcow2.gz
+M'XL("*8[(U0``VEM9RTQ>#$M-#`Y-BUP8SDX+G%C;W<R+F]U=`"MF-N2TS`,
+MAN_[%"Z'!18HL62G"8<%]L`,=W`!7+?=]BGZ\&QB;90H4MSMI,UDIN/^W\CQ
+M%S5N4:27<]&[4+I0N\/6/7RF`USOP_!PQ]\_?J[ZK^,BP7QAI)2!@!UNP+IA
+M'%BXPH\'O([K58<*#AY38U`.%\SJI@84W.6BO73M8E0B@><`$\Y<C+/J@U2?
+M3(0SZX.YZT/]^L7'G!PHI^O#5)],K2U<E<6!DJHMW":+0R6UM7"[+"XHJ7L+
+MM\_BHI(Z&#B?4>4!5RHI;^$@BULK*;1P(8NKE)3EG<][5RLIRSN?]VZCI"SO
+M?-Z[K9*RO/-Y[W9*RO+.Y[V[5U*6=V!XYQBW5U*6=R"\6Q+N&>,.2LKR#H1W
+MSPGWHL-Y+65Y!\*[EX2[8)S2[\#R#H1WKPCWFG%*OP/+.Q#>O2'<)>.4?@>6
+M=R"\>TNX=XQ3^AU8WH'P[OW(.Z_T.["\0^'=!V(5C%/Z'5K>H?#.$PX8I_0[
+MM+Q#X1T2+C!.Z7=H>8?"NTBXDG%*OT/+.Q3>K0E7,4[I=VAYA\*[FG`?&:?T
+M.[2\0^'=)\)]9IS2[]#R#H5W7PAWQ3BEWZ'E71#>?27<-\8I_2Y8W@7AW7?"
+M73-.Z7?!\BX([VX(=]OA0$MUWA6%?A#N;G3/PKS/GX&?C[URM@<F@-53@%,5
+M)EP]ZX1CFG"CP48YVP/'Z]7PW0%;89X`C-%MQL`_:<(Q"5,'MPO:O`X'/DZX
+M?G%N86*S)+->/V@G'-?-71%+5\&I%?Z[^ZM,&.:;<,+9VWD:Z`KVI^#:[7SO
+MF[[_<&8.#!_.EHR;W,XW>Y2]-F!6%^>5!:`2N?XZMYNK'>]"Q:-MM[Z.ZU.:
+M`0RF.U&?&T^W^=7M=L=B%=L%R$S7#7';R;6=KFXYKFXW\V*@O#-.O',;R/#.
+I33B8MQ&$]+]>T?;(T=D>./Y:#=\)&`@XVQ4,9?/;L?@/'U:4T(,4````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu
new file mode 100644
index 0000000..5398eae
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.raw.gz
+M'XL("//%'50``VEM9RTQ>#$M-#`Y-BUP8SDX+G)A=RYO=70`K91!#H,@$$7W
+MGF+<=F%@'*INFW3?3=NU-?44'+X@5`4$-0$,,?GP\C\#,&8:`"&P?F.,"_)6
+MN5T6EV*B\?$<4`CH0^!3`2<<:G\=P4"@_KP/QG'Y'$%67OOCN!)#D%T5%39P
+M-BYEWC^<`HL&2("X0HM'';[OKXW`F"^PP>$>;C;,C^!JO6HU4[E%/N-B@L&5
+MEE4N.$JY4PCV/156Y#TLB*VW;EUG8.H,#\!:JZ$+G.L+B[\NM(%.W(0_"./V
+M&M>X\_D*ASMQP<5]DK5-NRM#=T/F8M3^S3AX<S7$O;D&AWD?`II>9G4"]1L9
+9C'%!/BJW&R!98+8=)-3`X@?$\J!S108`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu
new file mode 100644
index 0000000..dbaca22
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.vhd.gz
+M'XL("!4UQ%4``VEM9RTQ>#$M-#`Y-BUP8SDX+G9H9"YO=70`K9?!<J,P#(;O
+M>0IE]M8#8PMCDVMG>N]EMV="2#?3V6VGR:$'^NZ5P`8;`TUV#<1#8NOCERP+
+M1XC^`-`YZ"/H!G3!]T:!WH$I`:C37MBUTGZ%MG[]V]27TT=FCW;3PZ3PK4)S
+MML<<%#W$`%;\$'W@>V@=)OOQ\'QW^O/L<&AQ:$&%8:L<0>^CYRCZM>S5,>GI
+MA"\=\O[WH"Z/U8U6]#$'$`JD]$;D3AUALL_06456QV-W&1!-%Q]W!5^"CM'9
+M2>P*,;'R9,X%58S.SN'TFM4MN+N-G8L^52@Q#+4"M`2#?$]IX^(0790J'^>W
+MZOW<3/3A0JKH09^,^O)E=]&F"KK!5H'B=%YS%SK*98J;297_BIX.[92]H2"(
+MPG5@YWX8O1$%OCXMQ4K,ER=C45_%^F@QB&JF7>YH[[/P'(#[XVW`HH`J!OYT
+M#M>L;Z>@5G-Q]YV\:G74"]GWS_/;)(X?=@Y3O:-R66@H\5J%3P^_9AS&=`[W
+M./P.-PB6U^!R6_O<2%*+P]MFL:/';2UK.^+4FCI><\U-SA9IDP7K<F+GSS,(
+MRN$:1.E5!0\XS"^,^G:Q#`S<7=$'L;L5XTPX7GHX_,9="''[U;E=5[>-U=6)
+M)^,P71E7KER&A"NWQV':0J"ZRDP9R#4R:I<[VL<L/'L@VE*?[-V!MC8G4Z@L
+M,)E"9:MS0H6J64VV6[-06X6)-N*,2[@19US"C3CC$F[$&9=P(\ZXA!MQQB7=
+0B&OZBR7$Y@L4!AU6O0T`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu
new file mode 100644
index 0000000..91bdfeb
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.vhdf.gz
+M'XL("(0EAE4``VEM9RTQ>#$M-#`Y-BUP8SDX+G9H9&8N;W5T`*V5/6^#,!"&
+M]_R*B[IEB.S#-K!6RIZE[0P4HJAJNW3HP(^O;4SPV4!(9;"0H^.>O.?[@+'A
+M`A`(K)IY+AOZYR.]^]UA9VF\>PPH)50Q\$4#+0Z-OE)`(T#O@@5=-RUBZ(_!
+M->*X-L8@Y[5HF,&Y<$7B\T,;L,Q!2)`*"MRJ\.WT.A,PI@MXP.$]W$TPWX++
+MC)?WIE:+_(9;,@RXO6/M)YQ84Z<1K'TH6)FV6!"+P,_/,S!=PPVPPMF0`F_Y
+MA4E?&<M`$NZ*/HC#K0PNI^]S#X=WP@6*JU=SNZYN'ZMK$B<C"SMC8^<:".W<
+M`8=I!X&PDUE7H)F1T7/9T)^/]!Z`P@&3G:!TWPZ5@>I`M:"DV><"5`EYX0.1
+M5E+??'^US<_UU\^PP?%@HOO+^&-FND7E@)7Y$_5N]IZ^I]/E</V\C+AQ5(T3
+M23>;]LH05!V%*X-FN^*'19XG=5E\2-(_O5(!$\`Y"=RI.]-REC:_8[!M![6P
+BYS,N\H,89D>5P4D6>/TWMP-.)2X5_57;_0$2<&2X<`@`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu
new file mode 100644
index 0000000..f76b425
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-pc98.vmdk.gz
+M'XL("/3%'50``VEM9RTQ>#$M-#`Y-BUP8SDX+G9M9&LN;W5T`*U<76_<R!%\
+M]Z^@?2]!'A:LY?>#@>0B!PB"`,;Y<O<:?N:$G#\@"T$,[(\/AYP:%;6BAG=J
+M>>7E>+MKIWMV2W)U8=-T_4J2O$OR/,F'I"B3%,G\3^LM2;.'Q7P[UWS@\O>;
+M?_QTXM<?3J?+JQ4,+DM2D"J<+#;/<SD]^B+<^;FLS0/S[1R%RUQ6=Y7HX<X[
+M#^S"Y?.#YZ=2N+MV>7AP%P*7!*!D`U<\4=-NL<_M[H^O?//<_C*WA_EXRR:I
+MLJ3L_#(IBV6=)=5Y>2Q-JCEHF@&_2VYNO_XGN1F_]G>W7^X_^_V=W=G.P7GI
+MXLO>(<R%5:6[<`\XN,9!E&.2#4D&]W!RN?OK[:_CZ;_CW=?;SY_>@N6>W=GF
+M69(W;CLN/GVX;1;N2=*DA'N.Y/*7O]V\]:_<]/2EO2.<RYHW,C_W7(?BEF7B
+MOJ]OR^[&3_<.<?)?87?N;'USBN6Y<W=1Y$G5),MV"H=]GA\>?,E+[_J[L;T?
+M?_SV97S[YN/G3Z%W[FQ=RYH%J%X:E25%YJ!\::Y]A4-T+YOEU)++K[?WO]SV
+M'^8ROXYO3M\EA"M=[^8#K/V^UJKGE'+W9.=M7][][WZN-QG\R=X2;MG$4L3\
+MW,4Y*2J'-1_@<A3G),O=U?Q/\X;G2G*XH.3R^=/IAY_GM[AKUH?W?_Z!</6<
+M-4?.&YQ3YH(V-15K_<7CEV5R^?`N>>.*_/&7<7D%$JY9WV8N>#T'+,NSN_!=
+M6^$=B>7N@>5DDYOVODV^;[^.I^]N;KX/)]NZ8O/E-F]M="CE"NU>WTL[Y\:M
+M)[T>]'(4P]"=VJ']<C_>N>,-1]&Y%@V^4G>L^<,Q;I^G6DYJ<J^8Y/(V>7,[
+MS&?J8/\]?OY(N'Y]&<_[<"^)9DG,W,7\ZEG@1_\,ZRO&'9.#&^_OOIWZ;[_>
+M?AKF-UKREG##VKMY.^MI/ASF?(#S#I_<X-R[-\NIANT1;G2[&ZXVN)RG;V38
+M5'C:Y/)QV=XO8SO,6YNQ"3>YW9V?WH?OU*.GFM&3RT/7%MRO'BY+/05DGLHV
+M+0K;69]0"'3L[S_?K1M[(WR</?Y9]E(^SJ]^I%:_$W"%L]Y?F3[Z>99I7BZ+
+M8@/H?HJE\_>?YN_W#_LKW?Y*B:PTJY9%LX'[UPSQY;K<TKT+6XGL-*N7Q7"D
+M>Z6CME$BI\?=XZ\:D.M]./XNP,A,LW)9%!NXO=X5OG>,K#2KED6S@=OK7>E[
+MQ\A.LWI9#(>*K7SO&#EIEKOCKU)(#_Q:5M:^=XS,-"N71;&!V^M=XWO'R$JS
+M:EDT&[B]WK6^=XSL-*N7Q7"HV,[WCI&39KD[$@3D>A^N][UC9*99N2R*#=Q>
+M[P;?.T96FE7+HMG`[?5N]+UC9*=9O2R&0\5.OG>,G#3+W>72NSP&5Z6^=XS,
+M-"N71;&!V^E=1;YC9*59M2R:#=Q.[RKR'2,[S>IE,1PJEGS'R$FSW%TAO2NB
+M<.0[1F::E<NBV,#M]8Y\Q\A*LVI9-!NXO=Z1[QC9:58OB^%0L>0[1DZ:Y>Y*
+MZ5T9A2/?,3+3K%P6Q09NKW?D.T96FE7+HMG`[?6.?,?(3K-Z60R'BB7?,7+2
+M+'?'7X(@U_MPY#M&9IJ5RZ+8P.WUCGS'R$JS:EDT&[B]WI'O&-EI5B^+X5"Q
+MY#M&3IKE[BC(0*YWX>K4]XZ1F6;ELB@V<#N]J\EWC*PTJY9%LX';Z5U-OF-D
+MIUF]+(9#Q9+O&#EIEKMKI'=-%(Y\Q\A,LW)9%!NXO=Z1[QA9:58MBV8#M]<[
+M\ATC.\WJ93$<*I9\Q\A)L]P=__\$N=Z'(]\Q,M.L7!;%!FZO=^0[1E::5<NB
+MV<#M]8Y\Q\A.LWI9#(>*)=\Q<M(L=T?]$7*]#T>^8V2F6;DLB@W<7N_(=XRL
+M-*N61;.!V^L=^8Z1G6;ULA@.%4N^8^2D6>ZNE][U,;@F];UC9*99N2R*#=Q.
+M[QKR'2,KS:IET6S@=GK7D.\8V6E6+XOA4+'D.T9.FN7N!NG=$(4CWS$RTZQ<
+M%L4&;J]WY#M&5II5RZ+9P.WUCGS'R$ZS>ED,AXHEWS%RTBQW-TKOQB@<^8Z1
+MF6;ELB@V<'N](]\QLM*L6A;-!FZO=^0[1G::U<MB.%0L^8Z1DV:YNTEZ-T7A
+MR'>,S#0KET6Q@=OK'?F.D95FU;)H-G![O2/?,;+3K%X6PZ%BR7>,G#0KE>D9
+MY'H7KDW7WH7(3+-R610;N)W>M9[O0F2E6;4LF@W<3N]:SW<ALM.L7A;#H6(]
+MWX7(2;-<RT2_0U32:CW?0?0[J'X'T>\0U>]:SW<0_0ZJWT'T.T3UN];S'42_
+M@^IW$/WN0+&>[R#Z'52_@^AWB$I:K><[B'X'U>\@^AVB^EWK^0ZBWT'U.XA^
+MAZA^UWJ^@^AW4/T.HM\=*-;S'42_@^IW$/T.44FK]7P'T>^@^AU$OT-4OVL]
+MWT'T.ZA^!]'O$-7O6L]W$/T.JM]!]+L#Q7J^@^AW4/T.HM\A*FEUJ>^=Z'=0
+M_0ZBWR&JWW7D.]'OH/H=1+]#5+_KR'>BWT'U.XA^=Z!8\IWH=U#]#J+?(2II
+M=>0[T>^@^AU$OT-4O^O(=Z+?0?4[B'Z'J'[7D>]$OX/J=Q#][D"QY#O1[Z#Z
+M'42_0U32ZLAWHM]!]3N(?H>H?M>1[T2_@^IW$/T.4?VN(]^)?@?5[R#ZW8%B
+MR7>BWT'U.XA^AZBDU9'O1+^#ZG<0_0Y1_:XCWXE^!]7O(/H=HOI=1[X3_0ZJ
+MWT'TNP/%DN]$OX/J=Q#]#E%)JT]][T2_@^IW$/T.4?VN)]^)?@?5[R#Z':+Z
+M74^^$_T.JM]!]+L#Q9+O1+^#ZG<0_0Y12:LGWXE^!]7O(/H=HOI=3[X3_0ZJ
+MWT'T.T3UNYY\)_H=5+^#Z'<'BB7?B7X'U>\@^AVBDE9/OA/]#JK?0?0[1/6[
+MGGPG^AU4OX/H=XCJ=SWY3O0[J'X'T>\.%$N^$_T.JM]!]#M$):V>?"?Z'52_
+M@^AWB.IW/?E.]#NH?@?1[Q#5[WKRG>AW4/T.HM\=*)9\)_H=5+^#Z'>(2EI#
+MZGLG^AU4OX/H=XCJ=P/Y3O0[J'X'T>\0U>\&\IWH=U#]#J+?'2B6?"?Z'52_
+M@^AWB$I:`_E.]#NH?@?1[Q#5[P;RG>AW4/T.HM\AJM\-Y#O1[Z#Z'42_.U`L
+M^4[T.ZA^!]'O$)6T!O*=Z'=0_0ZBWR&JWPWD.]'OH/H=1+]#5+\;R'>BWT'U
+M.XA^=Z!8\IWH=U#]#J+?(2II#>0[T>^@^AU$OT-4OQO(=Z+?0?4[B'Z'J'XW
+MD.]$OX/J=Q#][D"QY#O1[Z#Z73#30:X%+EF_/=R8KKT+D9EFI>G3M[EW,T2:
+M7.UN-/8'8O$'AIG"6M7O`USAK/<7YMO2OX>\W^I?1)AO\_8B_R+"?)NW%_D7
+M$>;;O+W(OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M
+M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS
+M;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(
+M\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_",ZW;?R+X'S;QK\(
+MSK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.
+MMVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW
+M;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M
+M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK^(,-]FY(O\BPCS;4:^R+^(
+M,-]FY(O\BPCS;4:^R+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,
+MMTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\B
+MS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O
+M(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OPC.MVW\
+MBQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+
+M&$W]BQA-_8L83?V+&$W]BYC2U-"_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_
+MB,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_>$[3U-"_>+[Z
+M+.%-UC[<=;&K/S!?]K=^.NCUW_L/7+X_;?\$0$R_#;`HDO8:\)^^X'SYO-XF
+M3_K\J;JFZ>$6*WB%L^Y?;MR_<BFXJ-P'Q19E4I^/[O#G=S\]47!I5_`*=_7A
+MTX_APH8/?)9UN7Q`L4:Z]]2#:+GWP`KWVF.]?H#+G]N=SGF.%6O\X=/E\B'`
+M&JOGO$P)^@<_PR-N">>;/.RON=[&>5/N,_N[XI9R^1!@_?A5/<4-V^V4FVSA
+MNF?/]OG=O;[>76]\&%<?97OPG>M`MN_<%>YL2P3UPLRK>>+Z[_T'+N]/VS\K
+.8+X`OOH_SBV/UN!>````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow.gz.uu
new file mode 100644
index 0000000..ddcfe73
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow.gz.uu
@@ -0,0 +1,125 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.qcow.gz
+M'XL("+,S(E0``VEM9RTQ>#$M-#`Y-BUV=&]C."YQ8V]W+F]U=`"MG=NN&\>2
+M!=_]%=3]+C$SFV2W[C@8'&`>!CB#^0'S^DS,LSY^).WN*NUD+.49V+)@2!!J
+M@;L4#AAVH+1>WWU;K3:V&K:K85I=#JOO/Y^_V^J7G]S_OOKVW__\S[>_?OOV
+MQ]V8K7]S*OU\\)7-<_>V_M'G_,>IXVH]_1MSW[_CW"^?+OX?G^Z7+_9V[N4?
+M=U\LGW,U&/<&5_/<>OY\)FYO^/<^W]?TY=K=[?U]7ZZ++W>C!K?W!O\US_TY
+M?SX77^Y.S8WWYJ[IRW7QY4YJ;O];6%S`<E!SQV)NP%,G-7<NYC9XZL)S]IO?
+MV[NY+9XR-><XMVIS.SP5:FZX-[=^NP"]S(UX2G!G)7<3GA+<6<G='D\)[JSD
+M[H"G!'=6<G?$4X([*[D[X2G!G9?<G?&4X,Y+[BYX2G#G%7?&IP1W7G%GY#M7
+MW'G%G9'O7''G%7=&OG/%G5?<&?G.%7=><6?D.U?<1<6=D>]"<1<5=T:^"\5=
+ME-R1[T)Q%R5WY+M0W$7)'?DN%'=1<D>^"\5=E-R1[T)Q%R5WY+M0W`TE=^2[
+M07$WE-R1[P;%W5!QYWQ*<#=4W#GY;E#<#15W3KX;%'=#Q9V3[P;%W5!QY^2[
+M07$W5-PY^6Y0W&TJ[IQ\MU'<;2KNG'RW4=QM2N[(=QO%W:;DCGRW4=QM2N[(
+M=QO%W:;DCGRW4=QM2N[(=QO%W:;DCGRW4=QM2^[(=UO%W;;DCGRW5=QM*^Z"
+M3PGNMA5W0;[;*NZV%7=!OMLJ[K85=T&^VRKNMA5W0;[;*NZV%7=!OMLJ[G85
+M=T&^VRGN=A5W0;[;*>YV)7?DNYWB;E=R1[[;*>YV)7?DNYWB;E=R1[[;*>YV
+M)7?DNYWB;E=R1[[;*>[&DCORW:BX&TONR'>CXFZLN!OXE.!NK+@;R'>CXFZL
+MN!O(=Z/B;JRX&\AWH^)NK+@;R'>CXFZLN!O(=Z/B;OG/WWJ.?#<I[J:*NX%\
+M-RGNII([\MVDN)M*[LAWD^)N*KDCWTV*NZGDCGPW*>ZFDCORW:2XFTKNR'>3
+MXFY?<D>^VRON]B5WY+N]XFY?<;?A4X*[?<7=AGRW5]SM*^XVY+N]XFY?<;<A
+MW^T5=_N*NPWY;J^XVU?<;<AW>\7=\K\A]1SY[J"X.U3<;<AW!\7=H>2.?'=0
+MW!U*[LAW!\7=H>2.?'=0W!U*[LAW!\7=H>2.?'=0W!U*[LAW!\7=L>2.?'=4
+MW!U+[LAW1\7=L>)NRZ<$=\>*NRWY[JBX.U;<;<EW1\7=L>)N2[X[*NZ.%7=;
+M\MU1<7>LN-N2[XZ*NU/%W99\=U+<G2KNMN2[D^+N5')'OCLI[DXE=^2[D^+N
+M5')'OCLI[DXE=^2[D^+N5')'OCLI[DXE=^2[D^+N7')'OCLK[LXE=^2[L^+N
+M7'&WXU."NW/%W8Y\=U;<G2ON=N2[L^+N7'&W(]^=%7?GBKL=^>ZLN#M7W.W(
+M=V?%W:7B;D>^NRCN+A5W._+=17%W*;DCWUT4=Y>2._+=17%W*;DCWUT4=Y>2
+M._+=17%W*;DCWUT4=Y>2._+=17!GRP_T'/C.UH([6Y?<@>]L+;BS=<7=R*>8
+M.RO[NQ%\9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>JO[.R
+MOQO!=Z;Z.RO[NQ%\9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK^[L1
+M?&>JO[.ROQO!=Z;Z.RO[NQ%\9ZJ_L[*_&\EWJK^SLK\;R7>JO[.ROYOXE."N
+M[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=
+MZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO
+M)O*=ZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[._V?$IP5_9W>_*=ZN^L
+M[._VY#O5WUG9W^W)=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]G97]W9Y\
+MI_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?[<EWJK^SLK_;D^]4?V=E
+M?[<GWZG^SLK^;D^^4_V=E?W=GGRG^CLK^[L#GQ+<E?W=@7RG^CLK^[L#^4[U
+M=U;V=P?RG>KOK.SO#N0[U=]9V=\=R'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N
+M0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_
+ML[*_.Y#O5']G97]W(-^I_L[*_N[(IP1W97]W)-^I_L[*_NY(OE/]G97]W9%\
+MI_H[*_N[(_E.]7=6]G='\IWJ[ZSL[X[D.]7?6=G?'<EWJK^SLK\[DN]4?V=E
+M?W<DWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[
+MU=]9V=\=R7>JO[.ROSOQ*<%=V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N
+M1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L[.].Y#O5WUG9WYW(=ZJ_
+ML[*_.Y'O5']G97]W(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[$_E.]7=6]G<G
+M\IWJ[ZSL[\Y\2G!7]G=G\IWJ[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?V=E
+M?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK^[LS^4[U=U;V=V?RG>KOK.SOSN0[
+MU=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[
+MNPN?$MR5_=V%?*?Z.RO[NPOY3O5W5O9W%_*=ZN^L[.\NY#O5WUG9WUW(=ZJ_
+ML[*_NY#O5']G97]W(=^I_L[*_NY"OE/]G97]W85\I_H[*_N["_E.]7=6]G<7
+M\IWJ[ZSL[R[D.]7?6=G?7<AWJK_SY0=I;M7GP'??3S%WGOJ[Y3V]5><.?.>J
+MO_/4WZUF[E8+=['F4\R=I_YN-7.W^K/-@>]<]7>>^KO5-=U=T/MWKOH[3_U=
+MN[L^![YSU=]YZN]@#GSGJK_SU-_!'/C.57_GJ;];YA[T.?"=J_[.4W_W8)E;
+MM3GPG:O^SE-_]V#F[D'G#GSGJK_SU-\]F+E[T+D#W[GJ[SSU=P^N-W<'OG/5
+MWWGJ[]K=]3GPG:O^SE-_!W/@.U?]G:?^#N;`=Z[Z.T_]W3+WL,^1[U1_YZF_
+M>[C,=>[(=ZJ_\]3?/9RY>]BXH_?O7/5WGOJ[AS-W#QMW]/Z=J_[.4W_W\)KO
+MCMZ_<]7?>>KOVMWU.?*=ZN\\]7<P1[Y3_9VG_@[FR'>JO_/4WRUSC_H<^4[U
+M=Y[ZNT?+7...WK]SU=]YZN\>S=P]ZMR1[U1_YZF_>S1S]ZAS1[Y3_9VG_N[1
+M]>;NR'>JO_/4W[6[ZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_GJ;];YA[W.?*=
+MZN\\]7>/E[G.'?E.]7>>^KO',W>/&W?T_IVK_LY3?_=XYNYQXX[>OW/5WWGJ
+M[QY?\]W1^W>N^CM/_5V[NSY'OE/]G:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[9>Y)
+MGR/?J?[.4W_W9)EKW-'[=Z[Z.T_]W9.9NR>=._*=ZN\\]7=/9NZ>=.[(=ZJ_
+M\]3?/;G>W!WY3O5WGOJ[=G=]CGRG^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU=\O<
+MTSY'OE/]G:?^[NDRU[DCWZG^SE-_]W3F[FGCCMZ_<]7?>>KOGL[</6W<T?MW
+MKOH[3_W=TVN^.WK_SE5_YZF_:W?7Y\AWJK_SU-_!'/E.]7>>^CN8(]^I_LY3
+M?[?,/>MSY#O5WWGJ[YXM<XT[>O_.57_GJ;][-G/WK'-'OE/]G:?^[MG,W;/.
+M'?E.]7>>^KMGUYN[(]^I_LY3?]?NKL^1[U1_YZF_@SGRG>KO//5W,$>^4_V=
+MI_YNF7O>Y\AWJK_SU-\]7^8Z=^0[U=]YZN^>S]P];]S1^W>N^CM/_=WSF;OG
+MC3MZ_\Y5?^>IOWM^S7='[]^YZN\\]7?M[OH<^4[U=Y[Z.Y@CWZG^SE-_!W/D
+M.]7?>>KOEKD7?8Y\I_H[3_W=BV6N<4?OW[GJ[SSU=R]F[EYT[LAWJK_SU-^]
+MF+E[T;DCWZG^SE-_]^)Z<W?D.]7?>>KOVMWU.?*=ZN\\]7<P1[Y3_9VG_@[F
+MR'>JO_/4WRUS+_L<^4[U=Y[ZNY?+7.>.?*?Z.T_]W<N9NY>-.WK_SE5_YZF_
+M>SES][)Q1^_?N>KO//5W+Z_Y[NC].U?]G:?^KMU=GR/?J?[.4W\'<^0[U=]Y
+MZN]@CGRG^CM/_=TR]ZK/D>]4?^>IOWNUS#7NZ/T[5_V=I_[NU<S=J\X=^4[U
+M=Y[ZNU<S=Z\Z=^0[U=]YZN]>76_NCGRG^CM/_5V[NSY'OE/]G:?^#N;(=ZJ_
+M\]3?P1SY3O5WGOJ[9>YUGR/?J?[.4W_W>IGKW)'O5'_GJ;][/7/WNG%'[]^Y
+MZN\\]7>O9^Y>-^[H_3M7_9VG_N[U-=\=O7_GJK_SU-^UN^MSY#O5WWGJ[V".
+M?*?Z.T_]'<R1[U1_YZF_6^;>]#GRG>KO//5W;Y:YQAV]?^>JO_/4W[V9N7O3
+MN2/?J?[.4W_W9N;N3>>.?*?Z.T_]W9OKS=V1[U1_YZF_:W?7Y\AWJK_SU-_!
+M'/E.]7>>^CN8(]^I_LY3?[?,O>USY#O5WWG5WP6]?^>JO_.JOPMZ_\Y5?^=5
+M?Q?T_IVK_LZK_B[H_3M7_9U7_5W0^W>N^CNO^KN@]^]<]7=>]7=![]^YZN]<
+M]'?O^ASY3O5WGOJ[=\M<XX[>OW/5WWGJ[][-W+WKW)'O5'_GJ;][-W/WKG-'
+MOE/]G:?^[MWUYN[(=ZJ_\]3?M;OK<^0[U=]YZN]@CGRG^CM/_1W,D>]4?Q?+
+M#]+<NL^![T+U=]]_X1YWBY_6G3OP7:C^+E)_MY[WUHT[>O\N5'\7J;];S]RM
+M&W?T_EVH_BY2?[>^YKNC]^]"]7>1^KMV=WT.?!>JOXO4W\$<^"Y4?Q>IOX,Y
+M\%VH_BY2?[?,69\#WX7J[R+U=[;,->[H_;M0_5VD_L[FCV>=._!=J/XN4G]G
+M,W?6N0/?A>KO(O5W=KVY._!=J/XN4G_7[J[/@>]"]7>1^CN8`]^%ZN\B]7<P
+M![X+U=]%ZN^6.>]SY#O5WT7J[WR9Z]R1[U1_%ZF_\YD[;]S1^W>A^KM(_9W/
+MW'GCCMZ_"]7?1>KO_)KOCMZ_"]7?1>KOVMWU.?*=ZN\B]7<P1[Y3_5VD_@[F
+MR'>JOXO4WRUST>?(=ZJ_B]3?Q3+7N*/W[T+U=Y'ZNYBYB\X=^4[U=Y'ZNYBY
+MB\X=^4[U=Y'ZN[C>W!WY3O5WD?J[=G=]CGRG^KM(_1W,D>]4?Q>IOX,Y\IWJ
+M[R+U=\O<T.?(=ZJ_B]3?#<M<YXY\I_J[2/W=,',W-.[H_;M0_5VD_FZ8N1L:
+M=_3^7:C^+E)_-USSW='[=Z'ZNTC]7;N[/D>^4_U=I/X.YLAWJK^+U-_!'/E.
+M]7>1^KME;M/GR'>JOXO4WVV6N<8=O7\7JK^+U-]M9NXVG3ORG>KO(O5WFYF[
+M3>>.?*?ZNTC]W>9Z<W?D.]7?1>KOVMWU.?*=ZN\B]7<P1[Y3_5VD_@[FR'>J
+MOXO4WRUSVSY'OE/]7:3^;KO,=>[(=ZJ_B]3?;6?NMHT[>O\N5'\7J;_;SMQM
+M&W?T_EVH_BY2?[>]YKNC]^]"]7>1^KMV=WV.?*?ZNTC]'<R1[U1_%ZF_@SGR
+MG>KO(O5WR]RNSY'O5'\7J;_;+7.-.WK_+E1_%ZF_V\W<[3IWY#O5WT7J[W8S
+M=[O.'?E.]7>1^KO=]>;NR'>JOXO4W[6[ZW/D.]7?1>KO8(Y\I_J[2/T=S)'O
+M5'\7J;];YL8^1[Y3_5VD_FY<YCIWY#O5WT7J[\:9N[%Q1^_?A>KO(O5WX\S=
+MV+BC]^]"]7>1^KOQFN^.WK\+U=]%ZN_:W?4Y\IWJ[R+U=S!'OE/]7:3^#N;(
+M=ZJ_B]3?+7-3GR/?J?XN4G\W+7.-.WK_+E1_%ZF_FV;NILX=^4[U=Y'ZNVGF
+M;NK<D>]4?Q>IOYNN-W='OE/]7:3^KMU=GR/?J?XN4G\'<^0[U=]%ZN]@CGRG
+M^KM(_=TR][[/D>]4?Q>IOWN_S'7NR'>JOXO4W[V?N7O?N*/W[T+U=Y'ZN_<S
+M=^\;=_3^7:C^+E)_]_Z:[X[>OPO5WT7J[]K=]3GRG>KO(O5W,$>^4_U=I/X.
+MYLAWJK^+U-\M<Q_Z'/E.]7>1^KL/RUSCCMZ_"]7?1>KO/LS<?>C<D>]4?Q>I
+MO_LP<_>A<T>^4_U=I/[NP_7F[LAWJK^+U-^UN^MSY#O5WT7J[V".?*?ZNTC]
+M'<R1[U1_%ZF_6^8^]CGRG>KO(O5W'Y>YSAWY3O5WD?J[CS-W'QMW]/Y=J/XN
+M4G_W<>;N8^..WK\+U=]%ZN\^7O/=T?MWH?J[2/U=N[L^1[Y3_5VD_@[FR'>J
+MOXO4W\$<^4[U=Y'ZNV7N4Y\CWZG^+E)_]VF9:]S1^W>A^KM(_=VGF;M/G3OR
+MG>KO(O5WGV;N/G7NR'>JOXO4WWVZWMP=^4[U=Y'ZNW9W?8Y\I_J[2/T=S)'O
+M5'\7J;^#.?*=ZN\B]7?+W.<^1[Y3_5VD_N[S,M>Y(]^I_BY2?_=YYNYSXX[>
+MOPO5WT7J[S[/W'UNW-'[=Z'ZNTC]W>=KOCMZ_RY4?Q>IOVMWU^?(=ZJ_B]3?
+MP1SY3O5WD?H[F"/?J?XN4G^WS'WI<^0[U=]%ZN^^+'.-.WK_+E1_%ZF_^S)S
+M]Z5S1[Y3_5VD_N[+S-V7SAWY3O5WD?J[+]>;NR/?J?XN4G_7[J[/D>]4?Q>I
+MOX,Y\IWJ[R+U=S!'OE/]W;#\(,U][7/@NT'U=T/J[[XN<YT[\-WW4\S=D/J[
+MKS-W7Q?NAC6?$G_N<?IBORZ]\=LV1W_>=CM5S/WR[=L?+W\.;GY^OF&[VOEJ
+MN_GQ??#5)E;#\.-_7:Z&DQK\Y_^>S__XG_\8_NO>Y]O\_9_O_C^W]OO!<;6>
+M5FO'P;NY7_ZYG<JYWWV^NSGZ<Z/_PAS]N=$X]T-/W_^-X[OCSVGNSU_FZ,^-
+M_BN_&;?/./W\]XH?;P6.]>"#7P;OYGY\N7>'\^^PJ;GOO_#MP<WGNYOK7Z[_
+M<L3OS1E]NA^/&ZYNYKJF\F<L;N\!?CK0U%]`A9YQXKG3?G4X_WS2[G(S]_#+
+J//?S&:<?4MK#W_4O?/O7V_M_W:$RS(-_&WO#>OO]4_[Q?X8;4W9_I0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow2.gz.uu
new file mode 100644
index 0000000..426bfa7
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.qcow2.gz
+M'XL("*@[(U0``VEM9RTQ>#$M-#`Y-BUV=&]C."YQ8V]W,BYO=70`K9C;CM,P
+M$(;O^Q3N<EY@B6?L-.&PP.ZR$A=((%Z`IG$?@.L^/$[LULED)BY5VK129?V?
+MQO;7J=.B"`^EK%:F5*96^T;YS_$"-?@POM3AU^/WF^'CL`HP70@I9L#@"3=B
+MW2<<2+A"3P<TCQM4APP.CJDI*(<S8G5S`PSN>M4O7;\9%4G@)<"`$S?CHOH@
+MU$<3YL+Z8.GZD%\_>\S1@7*^/@SUT=1&PE59'#"I6L)MLSAD4HV$VV5QADFU
+M$LYE<99)[06<SJCB<263TA(.LK@-DT()9[*XBDE)WNF\=S63DKS3>>^V3$KR
+M3N>]:YB4Y)W.>[=C4I)W.N]=RZ0D[T#P3B6<8U*2=T"\6T?<5<+MF93D'1#O
+MGD3<TQ-.<RG).R#>/8NXYPG']#N0O`/BW8N(>YEP3+\#R3L@WKV*N.N$8_H=
+M2-X!\>YUQ+U).*;?@>0=$._>3KS33+\#R3LDWKV+K"+AF'Z'DG=(O-,1!PG'
+M]#N4O$/B'4:<23BFWZ'D'1+O;,25"<?T.Y2\0^+=)N*JA&/Z'4K>(?&NCKCW
+M"<?T.Y2\0^+=AXC[F'!,OT/).R3>?8JXVX1C^AU*WAGBW>>(^Y)P3+\SDG>&
+M>/<UXNX2CNEW1O+.$._N(^[AA`,N=?*N*/@KXKY-OK.P[/G3I/.Q9M[E@1E@
+M]3_`N0H#KEYTPC9,V-\Z;D"5MKN\$A:[G?1-1)E6`C[^=>[N]X/Y,:S/+GU#
+M8-/Z%=PR4535'\=!6C\[6K\ZB\MLAPT'LT6F&W#-N3C_X^*/]JU3SA'<GP%N
+MM_!FZ,ET77?R]\>IZ@S@>@`,N&ZZ(4QWF/EOX#BL#NM)?0&7I@N#"(QPFJO.
+MGQ;[UQC7)IRF/6MVLFNV.K>H*GU?/@O7;E7CNI-MLYG@KHZXOB_[`Y"_:9V^
+;RP.'GS?C9U#%1.!B[IFR:U2K?VQQ7;KP$@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.raw.gz.uu
new file mode 100644
index 0000000..f5ae94e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.raw.gz.uu
@@ -0,0 +1,10 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.raw.gz
+M'XL("/3%'50``VEM9RTQ>#$M-#`Y-BUV=&]C."YR87<N;W5T`*V230Z",!"%
+M]YSBX=(%:8=296N,.Q,3+R#8>@#7/;QMA@0*Y<>$H73S>%_F,2,$%Z`T3@1=
+MA:,(50FE4"HO&'A]>N!N7VLOSZNZ%UPN8YCT8M(BE@17C,IEQPYXCGQR&7B&
+MJ"$H"61<W;OJ5=Q2?XQK]HK+N'8K3OO;P%A8.\*]!KCWSL.0D[@6?N`DPY]<
+M!>;CN#+$9?-XPK,X+[A\TA_C^K@TL%"$DZGN4/`;XTR/DW^M2I[LSNZZ*O*S
+M%6<:M!9$*/4$=]`=CH*K\M\WB7M><(\B?GA55`?<;?<4!6#V`]&)2;VR!```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhd.gz.uu
new file mode 100644
index 0000000..9132726
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.vhd.gz
+M'XL("!@UQ%4``VEM9RTQ>#$M-#`Y-BUV=&]C."YV:&0N;W5T`*V634_#,`R&
+M[_L5!FX[3(F;IML5`3<D)`Y<2==L3(@/`8<=QG_';I.U:9MM0+HL2I?ZZ6O'
+MSB)$<P'H#/0*M`6=\[A0H!=0S`%HTC6L>^EN8;=\>[7+K\UVYJ[=I(%)T;4*
+MS=D>,U#TD@+0\$MTQ6/8><SLXGH]W;RL/0X=#ATH+]@J0]#EX#V*?ITWZICT
+ML,'G&GGYM%>7#=6U5O0M*A`*I.P\D7EUA)E]A\XJLEJMZE:`L'5\?`MN@HG6
+MV5[L<M&SZL@<"ZIHG1W#Z4-6O\%-)VXMFE2AQ"BH%Z`E%,AC2AL?AT&C5-E^
+MOIN/3]O3AY%4T7M]<C"7Q=U%ERKH'W8*%*?S(7>AIGSU<2.I\J_HZ=!.N0$%
+M0>1^`FOWP^BU*.CJTU(<B'E\,:+Z#.M3FE>4=X&<"R.G8E604?Q4%7/XYL/:
+MR_LK=1O&ST16]\_Q,_/`[DAU4$4O>->(IHM9M%:+_Q>;,:G<;7#EJ3@J<E%!
+M9<':'NZQ@ULF7HQRX*[E3$99)\LQX)GJN5NRNXUQ?X5E#,<;:0L*<:V[V#'!
+M`#?87%@=[,NLBZM:7$_CD>B%^CS.)DV5<G4JKC)06D`<VT;//6[)5O1'),Q(
+M'Y_8W<W"3Y,JZ/:59!L5IE:H'#"90@+:Q`JE.)@9OZU?[10F.O4Q+N&ICW$)
+A3WV,2WCJ8US"4Q_C$I[Z&)?TU*?KW)O\`()N%&`J#```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdf.gz.uu
new file mode 100644
index 0000000..ddb9c0a
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.vhdf.gz
+M'XL("(@EAE4``VEM9RTQ>#$M-#`Y-BUV=&]C."YV:&1F+F]U=`"ME$]+PS`8
+MQN_[%`]X&1-*_K>]BGH3!AZ\VJ[I&$,%\>`A']YDR6S39'5(T[2TO'U^>9_D
+MY27$#T`HE`Q*NBD8)(<0X-(&.MAX.F$>/[6^>[Z73X4?9N5AU`:S$C(7,,5D
+MF-4F`*M(1^>!%4@-PK)`CZL'5?TG;BX_CVN6LNMQ[;4X99\=.@VM)[C7$6ZW
+M\&'0Q*Z&/7!6705<3^U29]>+IR=,+^%LP*R3_#QNL,M&$A;A:"X[%/Z.<=V`
+MJQ+5G-EU-CN]:*G0_EI<UZ#58"VX2G"W*N"84TG[?Y-Y7@Z8;1%?OE1$`"Y6
+M>S(T*L6A>BA]ZE4<I8"J459C((N.&6;W\:YW7X?O\?[)T*CZ/C^=GMDF:!<I
+MP1JWB.K<^RB_FX?]YO"V/^-8<,7"PK)T*FZ[:IO8E;'=EP,[GI#;(3N>;I(<
+M[UZM0`0HC8R'[+9QL3B<^#6K>[3BM#_G&7U$@6SM.9PD$]7_2]GAU,*E8FMO
+*]0/Z[P?!W08`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vmdk.gz.uu
new file mode 100644
index 0000000..238837c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-1x1-4096-vtoc8.vmdk.gz
+M'XL("/7%'50``VEM9RTQ>#$M-#`Y-BUV=&]C."YV;61K+F]U=`"M7%UOY,81
+M?/>O&)Q?#@D@L);?#P<DCFP@"`P8/B-Y-3]C(?;=02<$,;`_/AQR:E24Q!O"
+M:F5E<FZ[:Z=[5B6ENK!9MGTY5_2N*%PQNK)R&=SR3]O#9?GC8GE<&CYQ_<?M
+M]_^\X=?;FYOK5QL8?):D(%,X6>Q>YWKSY(MPER]E[9Y8'I<D7.ZS^F>)`>YR
+M\,0A7+$\>7DIA;OKUJ='?R-P+@*Y'5SY0DV'Q7YI=W_Z*C3/[R_W>UB.MVI=
+MG;NJ#TM7E>LZ=_5E?2YS]1(T+X!?N]N[S_]QM]/GX?[NT\/'L+^+/]LEN*A\
+M?#5XA*6PNO(W_@D/UWJ(:G+YZ'+XI]WU_KN[7Z>;_T[WG^\^?G@'EGOQ9UOD
+MKFC]=GQ\]OC8+?R+9*Z"?PUW_=O?;]^%=VYV\ZF[)YS/6C:RO/92A^)6E?/?
+MSQ_K[J8/#QYQ#E]Q=_YL0W/*];4+?U,6KF[=NIW28U^6I\=0\MJ[X7[J'J:?
+M?O\TO7OSV\</L7?^;'W+VA6H61N5NS+W4*$TW[[2(_JWS7IJ[OKKW<,O=\/[
+MI<S/TYN;KQWA*M^[Y0";L*^MZB6E.CS99=O7;__WL-3KQG"R=X1;-[$6L;QV
+M>7%E[;&6`UR/XN+RPM\M_[1L>*FD@`]RUX\?;G[\U_(C[IOU_H>__DBX9LE:
+M(I<-+BE+0;N:RJW^\NG;TEW??^O>^")_^F5:WX&$:[<?,Q^\G0/6Y<7?A*YM
+M\)[$"O_$>K+NMGOHW#?=Y^GFZ]O;;^+)=K[88GTL6YL\2K5!^_?WVLZE<=M)
+M;P>]'L4X]C?=V'UZF.[]\<:CZ'V+QE"I/];B\1CWKU.O)S7[=XR[OG-O[L;E
+M3#WLOZ>/OQ%NV-[&RS[\6Z)=$W-_L[Q[5O@IO,+VCO''Y.&FA_O?;X;??[W[
+M,"X_:.X=X<:M=\MVMM-\/,SE`)<=OKC!I7=OUE.-VR/<Y'<W/MO@>IZAD7%3
+M\67=];=U>[],W;AL;<$FW.QW=WEY'Z%33UYJ07?7QZZMN)\#7)X%"L@#E>U:
+M%+>SO:`0Z#0\?+S?-O9&^#A_^KOLM7Q<//N56O]!P`W.>G]5]N3W6:YYA2S*
+M':#_+98MWW]9OG]XW%_E]U=)9*U9C2S:'=S/"\2GY^56_J>PD\A>LP99C&>Z
+M5WEJFR1R?MH]_JD!N3^&X]\"C,PUJY!%N8,[ZET9>L?(6K,:6;0[N*/>5:%W
+MC.PU:Y#%>*K8.O2.D;-F^0O_E$)VXL^RJ@F]8V2N684LRAW<4>_:T#M&UIK5
+MR*+=P1WUK@N]8V2O68,LQE/%]J%WC)PURU]($)#[8[@A](Z1N685LBAW<$>]
+M&T/O&%EK5B.+=@=WU+LI](Z1O68-LAA/%3N'WC%RUBQ_*:1W10JNSD+O&)EK
+M5B&+<@=WT+N:?,?(6K,:6;0[N(/>U>0[1O::-<AB/%4L^8Z1LV;Y2RF]*Y-P
+MY#M&YII5R*+<P1WUCGS'R%JS&EFT.[BCWI'O&-EKUB"+\52QY#M&SIKE+Y7T
+MKDK"D>\8F6M6(8MR!W?4._(=(VO-:F31[N".>D>^8V2O68,LQE/%DN\8.6N6
+MO_"/(,C],1SYCI&Y9A6R*'=P1[TCWS&RUJQ&%NT.[JAWY#M&]IHUR&(\52SY
+MCI&S9OD+!1G(_2%<DX7>,3+7K$(6Y0[NH'<-^8Z1M68ULFAW<`>]:\AWC.PU
+M:Y#%>*I8\ATC9\WREU9ZUR;AR'>,S#6KD$6Y@SOJ'?F.D;5F-;)H=W!'O2/?
+M,;+7K$$6XZEBR7>,G#7+7_C_GR#WQW#D.T;FFE7(HMS!'?6.?,?(6K,:6;0[
+MN*/>D>\8V6O6((OQ5+'D.T;.FN4OU!\A]\=PY#M&YII5R*+<P1WUCGS'R%JS
+M&EFT.[BCWI'O&-EKUB"+\52QY#M&SIKE+X/T;DC!M5GH'2-SS2ID4>[@#GK7
+MDN\866M6(XMV!W?0NY9\Q\A>LP99C*>*)=\Q<M8L?QFE=V,2CGS'R%RS"EF4
+M.[BCWI'O&%EK5B.+=@=WU#OR'2-[S1ID,9XJEGS'R%FS_&62WDU)./(=(W/-
+M*F11[N".>D>^8V2M68TLVAW<4>_(=XSL-6N0Q7BJ6/(=(V?-\I=9>C<GX<AW
+MC,PUJY!%N8,[ZAWYCI&U9C6R:'=P1[TCWS&RUZQ!%N.I8LEWC)PU*Y/I&>3^
+M$*[+MM[%R%RS"EF4.[B#WG6![V)DK5F-+-H=W$'ONL!W,;+7K$$6XZEB`]_%
+MR%FS?,M$OT-2TNH"WT'T.ZA^!]'OD-3ONL!W$/T.JM]!]#LD];LN\!U$OX/J
+M=Q#][D2Q@>\@^AU4OX/H=TA*6EW@.XA^!]7O(/H=DOI=%_@.HM]!]3N(?H>D
+M?M<%OH/H=U#]#J+?G2@V\!U$OX/J=Q#]#DE)JPM\!]'OH/H=1+]#4K_K`M]!
+M]#NH?@?1[Y#4[[K`=Q#]#JK?0?2[$\4&OH/H=U#]#J+?(2EI]5GHG>AW4/T.
+MHM\AJ=_UY#O1[Z#Z'42_0U*_Z\EWHM]!]3N(?G>B6/*=Z'=0_0ZBWR$I:?7D
+M.]'OH/H=1+]#4K_KR7>BWT'U.XA^AZ1^UY/O1+^#ZG<0_>Y$L>0[T>^@^AU$
+MOT-2TNK)=Z+?0?4[B'Z'I'[7D^]$OX/J=Q#]#DG]KB??B7X'U>\@^MV)8LEW
+MHM]!]3N(?H>DI-63[T2_@^IW$/T.2?VN)]^)?@?5[R#Z'9+Z74^^$_T.JM]!
+M]+L3Q9+O1+^#ZG<0_0Y)26O(0N]$OX/J=Q#]#DG];B#?B7X'U>\@^AV2^MU`
+MOA/]#JK?0?2[$\62[T2_@^IW$/T.24EK(-^)?@?5[R#Z'9+ZW4"^$_T.JM]!
+M]#LD];N!?"?Z'52_@^AW)XHEWXE^!]7O(/H=DI+60+X3_0ZJWT'T.R3UNX%\
+M)_H=5+^#Z'=(ZG<#^4[T.ZA^!]'O3A1+OA/]#JK?0?0[)"6M@7PG^AU4OX/H
+M=TCJ=P/Y3O0[J'X'T>^0U.\&\IWH=U#]#J+?G2B6?"?Z'52_@^AW2$I:8Q9Z
+M)_H=5+^#Z'=(ZG<C^4[T.ZA^!]'OD-3O1O*=Z'=0_0ZBWYTHEGPG^AU4OX/H
+M=TA*6B/Y3O0[J'X'T>^0U.]&\IWH=U#]#J+?(:G?C>0[T>^@^AU$OSM1+/E.
+M]#NH?@?1[Y"4M$;RG>AW4/T.HM\AJ=^-Y#O1[Z#Z'42_0U*_&\EWHM]!]3N(
+M?G>B6/*=Z'=0_0ZBWR$I:8WD.]'OH/H=1+]#4K\;R7>BWT'U.XA^AZ1^-Y+O
+M1+^#ZG<0_>Y$L>0[T>^@^ETTTT'N!<YMWP%NRK;>O6@I?^&?8N_<B[N;C/V!
+M6/V!<::P5?7'`#<XZ_W%^38?K_(O(LZW^7B5?Q%QOLW'J_R+B/-M/E[E7T2<
+M;YOX%Q'GVR;^1<3YMHE_$7&^;>)?1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE]$
+MG&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?
+M1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE]$G&^;^!<1Y]LF_D7$^;:)?Q%QOFWB
+M7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?!.?;-OY%<+YMXU\$Y]LV_D5POFWC
+M7P3GVS;^17"^;>-?!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3GVS;^17"^;>-?
+M!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3GVS;^17"^;>-?!.?;-OY%<+YMXU\$
+MY]LV_D5POFWC7P3GVS;^17"^;>-?!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3G
+MVS;^17"^;>-?!.?;-OY%<+YMXU]$G&\S\E7^1<3Y-B-?Y5]$G&\S\E7^1<3Y
+M-B-?Y5]$G&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_
+M$7&^;>)?1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE]$G&^;^!<1Y]LF_D7$^;:)
+M?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?1)QOF_@7$>?;)OY%Q/FV
+MB7\1<;YMXE]$G&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7P3GVS;^14RF_D5,IOY%
+M3*;^14RF_D5,IOY%3*;^14RF_D5,IOY%3*;^14RF_D5,IOY%3*;^14RF_D5,
+MIOY%3*;^1<Q99NA?Q&SJ7\1LZE_$;.I?Q&SJ7\1LZE_$;.I?Q&SJ7\1LZE_$
+M;.I?Q&SJ7\1LZE_$;.I?Q&SJ7\1LZE_$;.I?O&199NA?O#S[+.&3<,^+W?R!
+MQ;J_HN)GNI;^DT++]5-#\]+YCS\^`/SN?IJ^>7];?K_;7V&_OV:7AR\#-NM(
+M\W)XND76/F:U2;@O[6^#ZZS*W>#ZLW#;V&6<W#0]@?M9X`;CP\"S<J?UIZ`Y
+M!?CV:;GPY<;/S]Z=,([@_">GOGVVOPWNL5S]:;OLX/#2[L*/[!.X\1&N>9;U
+MI6+?OKB[R?2M@ODLW-BY?G*7WN75,[@_5P%N_5CL;5+__+_'3UQ_N-G_;WNK
+5%`'0[+U7^,]AS;[Z/YH4:2:>70``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.qcow.gz.uu
new file mode 100644
index 0000000..99f2a7b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.qcow.gz
+M'XL(")XS(E0``VEM9RTQ>#$M-3$R+6%P;2YQ8V]W+F]U=`"MG=F.'=EQ1=_[
+M*RYGLCC=B,B1LP2Y`3\8:%O0LY0C($"V$[(`O_#C7<4Z0U7<O1F4NZE"@T0A
+M-[).+:X6I,7#\_GVQ^G4RJGI3LUXVN?3]:_3AYSN_.+^Q^GKO__\KV_N_OCZ
+MT^V8G+_SE/MUHR=)<_>V?E_G].:IY70>?V#N^@/.W7D[^R?>[LX7>SEW]=/M
+M%XN?4S9H]P9/:>Z<WD_(Z34_]GY?W)<KMZ?WVWVY2K[<E@UV]P9_27-_2>^G
+MY,OMV=QP;^YP7ZZ2+W=D<]-W85$"R\SFEF"N@4^M;&X+YEKXU([GY#O?V]NY
+M#CXE;$[AW*G,]?`I8W/-O;GSFPQTGAO@4X0[";D;X5.$.PFYF^!3A#L)N9OA
+M4X0[";E;X%.$.PFY6^%3A#L-N=O@4X0[#;G;X5.$.XVX$_P4X4XC[@3Y3AEW
+M&G$GR'?*N-.(.T&^4\:=1MP)\ITR[C3B3I#OE'%G$7>"?&>,.XNX$^0[8]Q9
+MR!WRG3'N+.0.^<X8=Q9RAWQGC#L+N4.^,\:=A=PAWQGCSD+ND.^,<=>$W"'?
+M-8R[)N0.^:YAW#41=XJ?(MPU$7>*?-<P[IJ(.T6^:QAW3<2=(M\UC+LFXDZ1
+M[QK&71-QI\AW#>.NC;A3Y+N6<==&W"GR7<NX:T/ND.]:QET;<H=\US+NVI`[
+MY+N6<=>&W"'?M8R[-N0.^:YEW+4A=\AW+>.N"[E#ONL8=UW('?)=Q[CK(NX,
+M/T6XZR+N#/FN8]QU$7>&?-<Q[KJ(.T.^ZQAW7<2=(=]UC+LNXLZ0[SK&71]Q
+M9\AW/>.NC[@SY+N><=>'W"'?]8R[/N0.^:YGW/4A=\AW/>.N#[E#ONL9=WW(
+M'?)=S[CK0^Z0[WK&W1!RAWPW,.Z&D#ODNX%Q-T3<-?@IPMT0<=<@WPV,NR'B
+MKD&^&QAW0\1=@WPW,.Z&B+L&^6Y@W`T1=PWRW<"XR__S-Y]#OAL9=V/$78-\
+M-S+NQI`[Y+N1<3>&W"'?C8R[,>0.^6YDW(TA=\AW(^-N#+E#OAL9=V/('?+=
+MR+B;0NZ0[R;&W11RAWPW,>ZFB+L6/T6XFR+N6N2[B7$W1=RUR'<3XVZ*N&N1
+M[R;&W11QUR+?38R[*>*N1;Z;&'?Y_X;D<\AW,^-NCKAKD>]FQMT<<H=\-S/N
+MYI`[Y+N9<3>'W"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=TO('?+=PKA;
+M0NZ0[Q;&W1)QU^&G"'=+Q%V'?+<P[I:(NP[Y;F'<+1%W'?+=PKA;(NXZY+N%
+M<;=$W'7(=POC;HVXZY#O5L;=&G'7(=^MC+LUY`[Y;F7<K2%WR'<KXVX-N4.^
+M6QEW:\@=\MW*N%M#[I#O5L;=&G*'?+<R[K:0.^2[C7&WA=PAWVV,NRWBKL=/
+M$>ZVB+L>^6YCW&T1=SWRW<:XVR+N>N2[C7&W1=SUR'<;XVZ+N.N1[S;&W1YQ
+MUR/?[8R[/>*N1[[;&7=[R!WRW<ZXVT/ND.]VQMT><H=\MS/N]I`[Y+N=<;>'
+MW"'?[8R[/>0.^6XGW$G^"9\#OI,SX4[.(7?`=W(FW,DYXF[`3V'N).SO!N`[
+M8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z
+M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2
+M]G<#\)VP_D["_FX`OA/6WTG8WPW(=ZR_D["_&Y#O6'\G87\WXJ<(=V%_-R+?
+ML?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6WTG8
+MWXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[$?F.
+M]7<2]G<C\AWK[R3L[T;D.];?2=C?C<AWK+^3L+^;\%.$N["_FY#O6'\G87\W
+M(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK[R3L[R;D.];?
+M2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=A'S'^CL)^[L)
+M^8[U=Q+V=Q/R'>OO).SO)N0[UM])V-_-^"G"7=C?S<AWK+^3L+^;D>]8?R=A
+M?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R'>OO).SO9N0[
+MUM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z.PG[
+MNQGYCO5W$O9W,_(=Z^\D[.\6_!3A+NSO%N0[UM])V-\MR'>LOY.POUN0[UA_
+M)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D[.\6
+MY#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!OF/]G83]W8)\Q_H[
+M"?N[!?F.]7<2]G<K?HIP%_9W*_(=Z^\D[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O
+M6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2]G<K\AWK[R3L
+M[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A?[<BW['^3L+^;D6^8_V=A/W=BGS'
+M^CL)^[L-/T6X"_N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?;<AWK+^3L+_;
+MD.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U=Q+V=QOR'>OO
+M).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_)V%_MR'?L?Y.POYN0[YC_9V$_=V.
+MGR+<A?W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])V-_MR'>LOY.P
+MO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.PG[NQWYCO5W$O9W._(=
+MZ^\D[.]VY#O6WTG8W^W(=ZR_T_P3-W>J<\!WUT]A[M3U=_D^O5/E#OA.67^G
+MKK\[)>Y.F3L[XZ<P=^KZNU/B[O27,@=\IZR_4]??G0YW=H;NOU/6WZGK[\K9
+MU3G@.V7]G;K^#LP!WRGK[]3U=V`.^$Y9?Z>NO\MS#^H<\)VR_DY=?_<@SYW*
+M'/"=LOY.77_W(''WH'('?*>LOU/7WSU(W#VHW`'?*>OOU/5W#XZ+LP.^4];?
+MJ>OORMG5.>`[9?V=NOX.S`'?*>OOU/5W8`[X3EE_IZZ_RW,/ZQSR'>OOU/5W
+M#_-<Y0[YCO5WZOJ[AXF[AX4[=/^=LOY.77_W,''WL'"'[K]3UM^IZ^\>'O[L
+MT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC_9VZ_@[,(=^Q_DY=?Y?G'M4YY#O6
+MWZGK[Q[EN<(=NO].67^GKK][E+A[5+E#OF/]G;K^[E'B[E'E#OF.]7?J^KM'
+MQ\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_4]??Y;G'=0[Y
+MCO5WZOJ[QWFN<H=\Q_H[=?W=X\3=X\(=NO].67^GKK][G+A[7+A#]]\IZ^_4
+M]7>/#W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?FD.]8?Z>NO\MS
+M3^H<\AWK[]3U=T_R7.$.W7^GK+]3U]\]2=P]J=PAW['^3EU_]R1Q]Z1RAWS'
+M^CMU_=V3X^+LD.]8?Z>NORMG5^>0[UA_IZZ_`W/(=ZR_4]??@3GD.];?J>OO
+M\MS3.H=\Q_H[=?W=TSQ7N4.^8_V=NO[N:>+N:>$.W7^GK+]3U]\]3=P]+=RA
+M^^^4]7?J^KNGAS\[=/^=LOY.77]7SJ[.(=^Q_DY=?P?FD.]8?Z>NOP-SR'>L
+MOU/7W^6Y9W4.^8[U=^KZNV=YKG"'[K]3UM^IZ^^>)>Z>5>Z0[UA_IZZ_>Y:X
+M>U:Y0[YC_9VZ_N[9<7%VR'>LOU/7WY6SJW/(=ZR_4]??@3GD.];?J>OOP!SR
+M'>OOU/5W>>YYG4.^8_V=NO[N>9ZKW"'?L?Y.77_W/''WO'"'[K]3UM^IZ^^>
+M)^Z>%^[0_7?*^CMU_=WSPY\=NO].67^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7
+MWX$YY#O6WZGK[_+<BSJ'?,?Z.W7]W8L\5[A#]]\IZ^_4]7<O$G<O*G?(=ZR_
+M4]??O4C<O:C<(=^Q_DY=?_?BN#@[Y#O6WZGK[\K9U3GD.];?J>OOP!SR'>OO
+MU/5W8`[YCO5WZOJ[/'=5YY#O6'^GKK^[RG.5.^0[UM^IZ^^N$G=7A3MT_YVR
+M_DY=?W>5N+LJW*'[[Y3U=^KZNZO#GQVZ_TY9?Z>NORMG5^>0[UA_IZZ_`W/(
+M=ZR_4]??@3GD.];?J>OO\MS+.H=\Q_H[=?W=RSQ7N$/WWRGK[]3U=R\3=R\K
+M=\AWK+]3U]^]3-R]K-PAW['^3EU_]_*X.#OD.];?J>OORMG5.>0[UM^IZ^_`
+M'/(=Z^_4]7=@#OF.]7?J^KL\]ZK.(=^Q_DY=?_<JSU7ND.]8?Z>NOWN5N'M5
+MN$/WWRGK[]3U=Z\2=Z\*=^C^.V7]G;K^[M7ASP[=?Z>LOU/7WY6SJW/(=ZR_
+M4]??@3GD.];?J>OOP!SR'>OOU/5W>>YUG4.^8_V=NO[N=9XKW*'[[Y3U=^KZ
+MN]>)N]>5.^0[UM^IZ^]>)^Y>5^Z0[UA_IZZ_>WU<G!WR'>OOU/5WY>SJ'/(=
+MZ^_4]7=@#OF.]7?J^CLPAWS'^CMU_5V>>U/GD.]8?Z=1?V?H_CME_9U&_9VA
+M^^^4]7<:]7>&[K]3UM]IU-\9NO].67^G47]GZ/X[9?V=1OV=H?OOE/5W&O5W
+MANZ_4];?*>GOWM8YY#O6WZGK[][FN<(=NO].67^GKK][F[A[6[E#OF/]G;K^
+M[FWB[FWE#OF.]7?J^KNWQ\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_
+M`W/(=ZR_L_P3-W>N<\!WQOJ[ZT_<XR[[Z5RY`[XSUM^9Z^_.:>]<N$/WWQGK
+M[\SU=^?$W;EPA^Z_,];?F>OOSH<_.W3_G;'^SEQ_5\ZNS@'?&>OOS/5W8`[X
+MSEA_9ZZ_`W/`=\;Z.W/]79Z3.@=\9ZR_,]??29XKW*'[[XSU=^;Z.TFO)Y4[
+MX#MC_9VY_DX2=U*Y`[XSUM^9Z^_DN#@[X#MC_9VY_JZ<79T#OC/6WYGK[\`<
+M\)VQ_LY<?P?F@.^,]7?F^KL\IW4.^8[U=^;Z.\USE3OD.];?F>OO-'&GA3MT
+M_YVQ_LY<?Z>).RW<H?OOC/5WYOH[/?S9H?OOC/5WYOJ[<G9U#OF.]7?F^CLP
+MAWS'^CMS_1V80[YC_9VY_B[/69U#OF/]G;G^SO)<X0[=?V>LOS/7WUGBSBIW
+MR'>LOS/7WUGBSBIWR'>LOS/7W]EQ<7;(=ZR_,]??E;.K<\AWK+\SU]^!.>0[
+MUM^9Z^_`'/(=Z^_,]7=YKJESR'>LOS/7WS5YKG*'?,?Z.W/]79.X:PIWZ/X[
+M8_V=N?ZN2=PUA3MT_YVQ_LY<?]<<_NS0_7?&^CMS_5TYNSJ'?,?Z.W/]'9A#
+MOF/]G;G^#LPAW['^SEQ_E^?:.H=\Q_H[<_U=F^<*=^C^.V/]G;G^KDW<M94[
+MY#O6WYGK[]K$75NY0[YC_9VY_JX]+LX.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\
+MQ_H[<_T=F$.^8_V=N?XNSW5U#OF.]7?F^KLNSU7ND.]8?V>NO^L2=UWA#MU_
+M9ZR_,]??=8F[KG"'[K\SUM^9Z^^ZPY\=NO_.6']GKK\K9U?GD.]8?V>NOP-S
+MR'>LOS/7WX$YY#O6WYGK[_)<7^>0[UA_9ZZ_Z_-<X0[=?V>LOS/7W_6)N[YR
+MAWS'^CMS_5V?N.LK=\AWK+\SU]_UQ\79(=^Q_LY<?U?.KLXAW['^SEQ_!^:0
+M[UA_9ZZ_`W/(=ZR_,]??Y;FASB'?L?[.7'\WY+G*'?(=Z^_,]7=#XFXHW*'[
+M[XSU=^;ZNR%Q-Q3NT/UWQOH[<_W=</BS0_??&>OOS/5WY>SJ'/(=Z^_,]7=@
+M#OF.]7?F^CLPAWS'^CMS_5V>&^L<\AWK[\SU=V.>*]RA^^^,]7?F^KLQ<3=6
+M[I#O6']GKK\;$W=CY0[YCO5WYOJ[\;@X.^0[UM^9Z^_*V=4YY#O6WYGK[\`<
+M\AWK[\SU=V`.^8[U=^;ZNSSWKLXAW['^SEQ_]R[/5>Z0[UA_9ZZ_>Y>X>U>X
+M0_??&>OOS/5W[Q)W[PIWZ/X[8_V=N?[NW>'/#MU_9ZR_,]??E;.K<\AWK+\S
+MU]^!.>0[UM^9Z^_`'/(=Z^_,]7=Y[GV=0[YC_9VY_NY]GBO<H?OOC/5WYOJ[
+M]XF[]Y4[Y#O6WYGK[]XG[MY7[I#O6']GKK][?UR<'?(=Z^_,]7?E[.H<\AWK
+M[\SU=V`.^8[U=^;Z.S"'?,?Z.W/]79[[4.>0[UA_9ZZ_^Y#G*G?(=ZR_,]??
+M?4C<?2C<H?OOC/5WYOJ[#XF[#X4[=/^=L?[.7'_WX?!GA^Z_,];?F>OORMG5
+M.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\]['.(=^Q_LY<?_<QSQ7NT/UW
+MQOH[<_W=Q\3=Q\H=\AWK[\SU=Q\3=Q\K=\AWK+\SU]]]/"[.#OF.]7?F^KMR
+M=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L]]JG/(=ZR_,]???<ISE3OD
+M.];?F>OO/B7N/A7NT/UWQOH[<_W=I\3=I\(=NO_.6']GKK_[=/BS0_??&>OO
+MS/5WY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^USGD.]8?V>NO_N<
+MYPIWZ/X[8_V=N?[N<^+N<^4.^8[U=^;ZN\^)N\^5.^0[UM^9Z^\^'Q=GAWS'
+M^CMS_5TYNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^KLD_<7-?ZASP7</ZN\;U
+M=U_R7.4.^.[Z*<Q=X_J[+XF[+YF[YHR?(G_OL?MBO^3>^$V90W_?=GDJF+OS
+MX^M/5]\&VV_OU[2G5D]GK4_<7/\V?&_P7_[C9N:!>[_V-W^_;_?+7)]6LUX\
+M9W<'Y?XGOO[R;W[P=N[F_9IOX=CU1W?]WZ?;'WJ_WQW'WS8PA_Z^\O_7EWL[
+M9Y=OUWZS2B>G4Z^GOCEU8_IG=RVI[>;3Z>W^?$Q__\=?__'7__ZO/^>YFW]?
+M=.O-P_T_\W;_.1WP[=#?5_YKOK?-#WYO<Z*1?^?>_][FW[DM^K/EO^[]OGT[
+MNIN#O_Y&7'\T>FKMU#0W?SSBU+8WGVOM<O#GOV_;[__XA]=_^OF/=\\/_7'P
+M7_5^W0^<G]XYO]O?)'?/[W3W_="?W?IU[_?=\^OMU/>`S7I^__._MR#F]_NM
+HSV](YW>>P#_Y)[[^\N;^?VX'FS3XF[UA<[[^!I]_^C_<Q@LX=*8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.qcow2.gz.uu
new file mode 100644
index 0000000..88ef9cd
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.qcow2.gz
+M'XL("(\[(U0``VEM9RTQ>#$M-3$R+6%P;2YQ8V]W,BYO=70`K9A);]LP$$;O
+M^15,]Z9-*LZ0E-P]FX$>"J0->@Z\R$"`+D8:H!?_^%+6R)2I&3$VY`A"#.)[
+M&`^?QZ:SK'XH9;4R3IF16DR5?TX7J-:3[4NMOHV_G+0?JX,:IC,AQ2P8W."V
+M6.<!!Q(NT]T%S>-:U2&#@R;5!:5P1JRN;X'!'1VL6[?>C")*X#[`&B=NQE[U
+M05U?G#![U@=#UX=\_VR3BQ=<?WU8UQ>G<@E7)''`I$82;I+$(9.:2KA9$F>8
+MU%S"E4F<95(+`:<3JGB<8U):PD$2ES,IE'`FB2N8E.2=3GLW8E*2=SKMW81)
+M2=[IM'=3)B5YI]/>S9B4Y)U.>S=G4I)W('BG`JYD4I)W$'EW2+A'`;=@4I)W
+M$'GWF'!/-CC-I23O(/+N*>&>!1PS[T#R#B+OGA/N1<`Q\PXD[R#R[B7AC@*.
+MF7<@>0>1=Z\(]SK@F'D'DG<0>7?<\4XS\PXD[S#R[@VQLH!CYAU*WF'DG28<
+M!!PS[U#R#B/OD'`FX)AYAY)W&'EG"><"CIEW*'F'D7<YX8J`8^8=2MYAY-V(
+M<&\#CIEW*'F'D7?O"/<^X)AYAY)W&'GW@7`?`XZ9=RAY9R+O/A'N<\`Q\\Y(
+MWIG(NU/"G04<,^^,Y)V)O#LGW,4&!UQJXUV6\1?A+COO61CV^Z<)WX\U<Y<7
+M>H#%+L"^"FO<:-`7;.L7['?`0CA'9>M/R*(7>/F]PAQNUV>'/A#86A@_F<V\
+MDT/IP.<75E=?F?[96AC_=O#3U%]NIIQ]4'VGR^7/DL')I]O=CU,>A]WJ[&+]
+MOY<E!Y4;Y49T=POERFJ9JKM93N[N;^]O__R^:7#5!Z2;5^%\E^I^399L=7;@
+MO34/W-MFJ@`!M_=6-?69H=TSZ^UP5>/]1OC+CTN+U93S7S.4M=6:Q2YP?%>6
+M9]<7QS_&U^W^F6%_;+#^1)7N'[3Z5[])VOU3[?K<T/USO?W+4>4YXV;HW]]_
+HM8A-?4/WKZ#^^9-Z]RXOK*Y.MO]JH"'@8!4:5TWG@_\+*`W"Y1,`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.raw.gz.uu
new file mode 100644
index 0000000..025d7ad
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.raw.gz
+M'XL(".3%'50``VEM9RTQ>#$M-3$R+6%P;2YR87<N;W5T`*V3S6K#,!"$[WZ*
+MZ;50(\DKJ3FFM+D50D//P=0.!-K4I(%>]/"5(HG(/PDN:+T(BV4_QK-KQGP`
+M)"$%F$T64G`PPN4^2)B7M]+&71G#%![&V8VNZ[AR$*:X]T#ARI*!FE%?E0)Y
+MOV#6KT.@QSE]Q*&92_4!)6?I6W;=9SN!$[D^U^.JL3JY.[]S0`MH@EJ$4^V@
+M6E<.ZK9=?3SM3_OOPS;BR.)4XYKU?]1]U=VD.IEYMC1SMA27,@#[LT741[EW
+MC\[C4,YX.PB;)"`K$$$T5KAT-7L?`5?'MGW:/#^\KS:I?T29]:D9_HG$/_^3
+MI/XAU:=R^Z=N^J<K:#VQFQ?_?G[](D9]N?U[#/ZQ>N*\7C#KLO]X(`5@-H4D
+,'+#X`^%)]I"G!0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.vhd.gz.uu
new file mode 100644
index 0000000..a9aaac8
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.vhd.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.vhd.gz
+M'XL(".XTQ%4``VEM9RTQ>#$M-3$R+6%P;2YV:&0N;W5T`*U6R6[;,!"]^RNF
+MZ"U`#7)$CM)C@R:W`D&#HL=`E:E4:),8L8'FX/Y[.5RBC1)LES)-D*;GZ?'-
+M0@KA'P`J@!H@`Z1Y7"J@CU!>`MC%T-#U,DSA4#\_F7K?OJ[#<UAY,"GZ5D-S
+MML<"E'U)"5CQ2VC#8SA$F/7[ZX>+]O$APF&`PP"D2[8J$.C'Y#W*_GKIV3'2
+M]Q9_.<BKGV_LBBF[SLI^RPT(!5+V_E%$=A9F_7>X666MFL:U$H1Q^L0VF`P6
+MNLV.M--B9-6CF1)5=)M-P=&2U2EP%ZO@"Q\J-C!*VPL@"27RV(9-U&'2;*B\
+M[K;5R\Z,^.%,J-`;/SE9*^:WBR%4,/XY,%`<SDO;!8>R'\,E0N6_U*.AG0H#
+M*X+0<0'=]H?J=5#0YT=2+&@^[XQ9?A7SLZFIL<LVIB2A6-3O^BO#O%,C_:H9
+M[YZM7\W+-D/4)A45W62<N[=?DN%2,S\E.8PYDFN.X6/X?=IN?YL$'.;:KH<K
+MINQT$W+.)9TOT:[WI5LWD=V]S;9]NV^?G^XC'!<J+K4.\7AVC]4VR4YG]JTY
+MTK<Q:3``#GT+D9_)'7O&N8-8>#XA-1\:VAYD"G!CB6M>L_,)X,V+,5=WGS]\
+MN[GKZV=47GY2'*$?]O3S2=+7KU];Y-PA?CZ_1?WX,"D3L=GIM_OC`S'RRZT?
+M!OU$E>CG%PZWZ^''`V(HIMFJ,W;5+P]#%0"S,51=#N=B*&G1F:=ZF0+#3%==
+MFJ\RYUQU&2[C59="R9JU$B===2F4K$Q778;+>-5EN*Q777(%=?4/V&/DOA\-
+"````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.vhdf.gz.uu
new file mode 100644
index 0000000..51eda6d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.vhdf.gz
+M'XL("%4EAE4``VEM9RTQ>#$M-3$R+6%P;2YV:&1F+F]U=`"M55%KPC`0?O=7
+M'.QE""MM<DGT<6/Z-BB3L4=QMI6RJ<4)VT-__')-LJ:VBAN)1V@X[^.[[RZ7
+M.#8+``4(!K&VV!J;T-Z>3PSJV7.DUVWD5CTR8,FEJ/-PT<FJ1V,#R,@M8L"L
+M%\=]P*3KJ-.G4T`#1_PP`163R35(<16_^ZKZR`?@6*AT#1SOLQ-%\YT`*`8*
+M04[M+@N0.;DMNV6U.AS+8[G?+1T<:CB94;#Z"[OMJAID)P+7%J^L+;JFM(#=
+MVH+CAZ%[#YMR2!)>%T(;,A`<$(%EFK@@GS[W`.>'/']8/-Z]S!>^?HB!^<DK
+M]&.>?N:2^/J!ST^&UD]>U$]Q4&J@-UO]/K],(SI^H?6;6/WBU<!^WE&G4?=G
+M`-$"!F,H['26W-YU$I&[&3#Q`5E;W@9PO=_EZV/Y[=]@8:=S40P;Q3-.;X%4
+MP%;-B,GHV^-W,]N,R^W&P;GIYQX.H2B*ZW*_]=(5W71?2_;>0*8M.]X72?CJ
+M327U<I)T$K?L4E\]`X>_R>8%O&&CC[/.H>,8G,T$UTP__\__K:V!DX%;13^4
+*HQ\K>!7WT@<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-apm.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-apm.vmdk.gz.uu
new file mode 100644
index 0000000..d704c00
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-apm.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-512-apm.vmdk.gz
+M'XL(".7%'50``VEM9RTQ>#$M-3$R+6%P;2YV;61K+F]U=`"MG%MOW,@1A=_]
+M*PCORR)`!)[A_<%`UI$-!,$"QGJ3/&YXC878EB`)20S,CP^;[-,ZE$0WL2IE
+MM)SR5-5T5X]*RE<'3-/U*TGR+LGS)!^2HDQ2)/,_K8\DS1Z,^7&J^<+YKY<_
+M__V"7S]>7)Q?K<G@HB0$J:838_,^YXM'7TQW^E[4YH7Y<8JFRUQ4]R30ISOM
+MO+";+I]?/#T7PM6UR\N#>R+IDI`HV:0KGMG3[F:_M[H_O/+%<^O+W!KFXRV;
+MI,J2LO-F4A:+G275:7DM3:K9:9H3_I!<7MW].[D<[_K;JYO[:[^^DSO;V3DO
+MG7_9NPSSQJK2/7$ON'2-2U&.238D&=S+R?GV_=7G\>(_X^W=U?77-^!V3^YL
+M\RS)&[<<YY\^/#:&>Y,T*>'>(SG_^2^7;_PG-[VX:6^9SD7-"YG?>]Z'YBW+
+MQ'T_?2RK&[_>NXR3_PJK<V?KBU,L[YV[)T6>5$VR+*=PN4_SRX/?\E*[_G9L
+M[\=?O]V,;UY_N?X::N?.UI6L61+52Z&RI,A<*K\U5[["970?F^74DO/GJ_M/
+M5_W'>9MWX^N+'Q*F*UWMY@.L_;K67<\AY>[)SLL^O_O?_;S?9/`G>\5TRR*6
+M3<SO79R2HG*YY@-<CN*49+E[-O_3O.!Y)SF<4W*^_GKQRS_F'W%7K(\??OJ%
+MZ>HY:O:<%SB'S!O:[*E8]U\\_E@FYX_ODM=ND[]^&I=/(-,UZX^9<U[/`8MY
+M<D]\U=;TKHGE[H7E9)/+]KY-WK9WX\4/EY=OP\FV;K/Y\IB7-KHLY9K:?;Z7
+M<LZ%6T]Z/>CE*(:ANVB']N9^O'7'&XZB<R4:_$[=L>8/Q[A]GVHYJ<E]8I+S
+MF^3UU3"?J4O[K_'Z"]/UZ\=X7H?[2#1+8.:>S)^>)?WHWV']Q+AC<NG&^]MO
+M%_VWSU=?A_D'+7G#=,-:NWDYZVD^'.9\@/,*GUW@7+O7RZF&Y3'=Z%8W/%G@
+M<IZ^D&%1X6V3\Y=E>9_&=IB7-N=FNLFM[O3\.GRE'KW5G#TY/U1MR7OGTV6I
+M;P&9;V6;$H7EK&\H#73L[Z]OUX6]EGZ</?Y=]M)^G#_YE5K]SH1K.NOUE>FC
+MWV>9QN5B%)N$[K=8.G__:?[^\+"^TJVO%,]*HVHQFDVZ?\XI;IYNMW0_A:UX
+M=AK5BS$<J5[I6MLHGM/CZO%/#<CS_73\6X">F4;E8A2;='NU*WSMZ%EI5"U&
+MLTFW5[O2UXZ>G4;U8@R'-EOYVM%STBAWX9]22`_\65;6OG;TS#0J%Z/8I-NK
+M7>-K1\]*HVHQFDVZO=JUOG;T[#2J%V,XM-G.UXZ>DT:Y"QL$Y/E^NM[7CIZ9
+M1N5B%)MT>[4;?.WH66E4+4:S2;=7N]'7CIZ=1O5B#(<V._G:T7/2*'?)I79Y
+M+%V5^MK1,].H7(QBDVZG=A7['3TKC:K%:#;I=FI7L=_1L].H7HSAT&;9[^@Y
+M:92[%%*[(IJ._8Z>F4;E8A2;='NU8[^C9Z51M1C-)MU>[=COZ-EI5"_&<&BS
+M['?TG#3*74JI71E-QWY'STRC<C&*3;J]VK'?T;/2J%J,9I-NKW;L=_3L-*H7
+M8SBT6?8[>DX:Y2[\(PCR?#\=^QT],XW*Q2@VZ?9JQWY'STJC:C&:3;J]VK'?
+MT;/3J%Z,X=!FV>_H.6F4NQ#(0)[OIJM37SMZ9AJ5BU%LTNW4KF:_HV>E4;48
+MS2;=3NUJ]CMZ=AK5BS$<VBS['3TGC7*71FK71-.QW]$STZA<C&*3;J]V['?T
+MK#2J%J/9I-NK'?L=/3N-ZL48#FV6_8Z>DT:Y"___$^3Y?CKV.WIF&I6+46S2
+M[=6._8Z>E4;58C2;='NU8[^C9Z=1O1C#H<VRW]%STBAW(7^$/-]/QWY'STRC
+M<C&*3;J]VK'?T;/2J%J,9I-NKW;L=_3L-*H78SBT6?8[>DX:Y2Z]U*Z/I6M2
+M7SMZ9AJ5BU%LTNW4KF&_HV>E4;48S2;=3NT:]CMZ=AK5BS$<VBS['3TGC7*7
+M06HW1-.QW]$STZA<C&*3;J]V['?TK#2J%J/9I-NK'?L=/3N-ZL48#FV6_8Z>
+MDT:YRRBU&Z/IV._HF6E4+D:Q2;=7._8[>E8:58O1;-+MU8[]CIZ=1O5B#(<V
+MRWY'STFCW&62VDW1=.QW],PT*A>CV*3;JQW['3TKC:K%:#;I]FK'?D?/3J-Z
+M,89#FV6_H^>D4:E,SR#/=].UZ5J[X)EI5"Y&L4FW4[O6][O@66E4+4:S2;=3
+MN];WN^#9:50OQG!HL[[?!<])HUS)A-\ABK1:W^\@_`[*[R#\#E%^U_I^!^%W
+M4'X'X7>(\KO6]SL(OX/R.PB_.[!9W^\@_`[*[R#\#E&DU?I^!^%W4'X'X7>(
+M\KO6]SL(OX/R.PB_0Y3?M;[?0?@=E-]!^-V!S?I^!^%W4'X'X7>((JW6]SL(
+MOX/R.PB_0Y3?M;[?0?@=E-]!^!VB_*[U_0["[Z#\#L+O#FS6]SL(OX/R.PB_
+M0Q1I=:FOG?`[*+^#\#M$^5W'?B?\#LKO(/P.47[7L=\)OX/R.PB_.[!9]COA
+M=U!^!^%WB"*MCOU.^!V4WT'X':+\KF._$WX'Y7<0?H<HO^O8[X3?0?D=A-\=
+MV"S[G?`[*+^#\#M$D5;'?B?\#LKO(/P.47[7L=\)OX/R.PB_0Y3?=>QWPN^@
+M_`["[PYLEOU.^!V4WT'X':)(JV._$WX'Y7<0?H<HO^O8[X3?0?D=A-\ARN\Z
+M]COA=U!^!^%W!S;+?B?\#LKO(/P.4:35I[YVPN^@_`["[Q#E=SW[G?`[*+^#
+M\#M$^5W/?B?\#LKO(/SNP&;9[X3?0?D=A-\ABK1Z]COA=U!^!^%WB/*[GOU.
+M^!V4WT'X':+\KF>_$WX'Y7<0?G=@L^QWPN^@_`["[Q!%6CW[G?`[*+^#\#M$
+M^5W/?B?\#LKO(/P.47[7L]\)OX/R.PB_.[!9]COA=U!^!^%WB"*MGOU.^!V4
+MWT'X':+\KF>_$WX'Y7<0?H<HO^O9[X3?0?D=A-\=V"S[G?`[*+^#\#M$D=:0
+M^MH)OX/R.PB_0Y3?#>QWPN^@_`["[Q#E=P/[G?`[*+^#\+L#FV6_$WX'Y7<0
+M?H<HTAK8[X3?0?D=A-\ARN\&]COA=U!^!^%WB/*[@?U.^!V4WT'XW8'-LM\)
+MOX/R.PB_0Q1I#>QWPN^@_`["[Q#E=P/[G?`[*+^#\#M$^=W`?B?\#LKO(/SN
+MP&;9[X3?0?D=A-\ABK0&]COA=U!^!^%WB/*[@?U.^!V4WT'X':+\;F"_$WX'
+MY7<0?G=@L^QWPN^@_"Z(Z2#/)5VR?OMT8[K6[EE)^3/_%&J7/+NZT5@?B$4?
+M&&8*ZZY^7\(UG?7ZPGR;CQ?I%Q'FVWR\2+^(,-_FXT7Z183Y-A\OTB\BS+=-
+M](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW
+M3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,
+MMTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\B
+MS+=-](L(\VT3_2+"?-M$OX@PWS;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"
+M\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S
+M;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M
+M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;
+M_2(XW[;1+X+S;1O](CC?MM$O(LRWZ?DB_2+"?)N>+](O(LRWZ?DB_2+"?)N>
+M+](O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@P
+MWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(
+M,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_
+MB##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2^"\VT;_2)&4_TB1E/](D93
+M_2)&4_TB1E/](D93_2)&4_TB1E/](D93_2)&4_TB1E/](D93_2)&4_TB1E/]
+M(D93_2*F-#74+V(RU2]B,M4O8C+5+V(RU2]B,M4O8C+5+V(RU2]B,M4O8C+5
+M+V(RU2]B,M4O8C+5+V(RU2]B,M4O8C+5+Y[2-#74+YZ>W$OX8+JGFUWU@?FR
+MOKQP]R[5>_VN=S7^3L)WO[@T/SY:7VZ^ON5^O>[VJL.3N$P38OO"^<//S]4O
+M7^[7FR^W-76W,5WOUWM@?3_=W'P>GTGWY%[,OW>[:[KLZ>J*R=_H=[ES9\Z[
+MY?*>PL7$U?UVT][>7]U?77_]C>F6^_4._C:NQU?WI;UY=G7&]V+.\X-G2R)R
+M\@FW9YMP?=;W_LSSY3A*WN^X<'?1+98[ZIZ&>>&%>ZW(GB9\?SN.;S]>_O%O
+M[S]J_?+<>'WE@?JI%&[](='Z);H^:^UQ7GZW?E665-4SG\V'^MW]=_T@<GW6
+G]:M]_=S]G9_\=_^%\X>+[?_6A+E/:+;"W-U\-GWU?YW"XEV37@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow.gz.uu
new file mode 100644
index 0000000..1aab948
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow.gz.uu
@@ -0,0 +1,125 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.qcow.gz
+M'XL(")\S(E0``VEM9RTQ>#$M-3$R+6)S9"YQ8V]W+F]U=`"MG<N.&TF21??U
+M%=3[+=',@F2$WFB@!YA=SV9F6WRN^0'Z^%$I(]R5QG-E:G2I!$%"*BY(SZ-3
+M*-6!YWI]]VVUVMAJV*Z&:74YK+[_>OYNJY]^<?_[ZMO__-=_O_WYV[<_[L9L
+M_8NGTJ\'7_D\=V_K'ZLVYW\]=5RMI]^8^_[=:.ZG5Q?_QJO[Z<W>SKW\X^[-
+M\G.N!N/>X&J>6\^OS\3I#;_W^KZFMVMWI_?WO5T7;W>C!K?W!O\US_TYOSX7
+M;W>GYL9[<]?T=EV\W4G-[7\)BPM8#FKN6,P-^-1)S9V+N0T^=>$Y^\7G]FYN
+MBT^9FL,_MV]7;6Z'3X6:&^[-K=\N0"]S(SXEN+.2NPF?$MQ9R=T>GQ+<6<G=
+M`9\2W%G)W1&?$MQ9R=T)GQ+<><G=&9\2W(E_7_S$W06?$MQYQ9WQ4X([K[@S
+M\ITK[KSBSLAWKKCSBCLCW[GBSBONC'SGBCNON#/RG2ONHN+.R'>AN(N*.R/?
+MA>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[H:2
+M._+=H+@;2N[(=X/B;JBX<WY*<#=4W#GY;E#<#15W3KX;%'=#Q9V3[P;%W5!Q
+MY^2[07$W5-PY^6Y0W&TJ[IQ\MU'<;2KNG'RW4=QM2N[(=QO%W:;DCGRW4=QM
+M2N[(=QO%W:;DCGRW4=QM2N[(=QO%W:;DCGRW4=QM2^[(=UO%W;;DCGRW5=QM
+M*^Z"GQ+<;2ON@GRW5=QM*^Z"?+=5W&TK[H)\MU7<;2ON@GRW5=QM*^Z"?+=5
+MW.TJ[H)\MU/<[2KN@GRW4]SM2N[(=SO%W:[DCGRW4]SM2N[(=SO%W:[DCGRW
+M4]SM2N[(=SO%W:[DCGRW4]R-)7?DNU%Q-Y;<D>]&Q=U8<3?P4X*[L>)N(-^-
+MBKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKNQXFX@WXV*N^6OO_4<^6Y2W$T5
+M=P/Y;E+<325WY+M)<3>5W)'O)L7=5')'OIL4=U/)'?EN4MQ-)7?DNTEQ-Y7<
+MD>\FQ=V^Y(Y\MU?<[4ONR'=[Q=V^XF[#3PGN]A5W&_+=7G&WK[C;D._VBKM]
+MQ=V&?+=7W.TK[C;DN[WB;E]QMR'?[15WR_^&U'/DNX/B[E!QMR'?'11WAY([
+M\MU!<7<HN2/?'11WAY([\MU!<7<HN2/?'11WAY([\MU!<7<HN2/?'11WQY([
+M\MU1<7<LN2/?'15WQXJ[+3\EN#M6W&W)=T?%W;'B;DN^.RKNCA5W6_+=47%W
+MK+C;DN^.BKMCQ=V6?'=4W)TJ[K;DNY/B[E1QMR7?G11WIY([\MU)<7<JN2/?
+MG11WIY([\MU)<7<JN2/?G11WIY([\MU)<7<JN2/?G11WYY([\MU9<7<NN2/?
+MG15WYXJ['3\EN#M7W.W(=V?%W;GB;D>^.RONSA5W._+=67%WKKC;D>_.BKMS
+MQ=V.?'=6W%TJ[G;DNXOB[E)QMR/?711WEY([\MU%<7<IN2/?711WEY([\MU%
+M<7<IN2/?711WEY([\MU%<7<IN2/?701WMOQ$SX'O;"VXLW7)'?C.UH([6U?<
+MC?P4<V=E?S>"[TSU=U;V=R/XSE1_9V5_-X+O3/5W5O9W(_C.5']G97\W@N],
+M]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/XSE1_9V5_-X+O3/5W5O9W(_C.5']G
+M97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/Y3O5W5O9W(_E.]7=6]G<3
+M/R6X*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[
+MNXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z
+M.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[/3\EN"O[NSWY
+M3O5W5O9W>_*=ZN^L[._VY#O5WUG9W^W)=ZJ_L[*_VY/O5']G97^W)]^I_L[*
+M_FY/OE/]G97]W9Y\I_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?[<EW
+MJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^4_V=E?W=@9\2W)7]W8%\I_H[*_N[
+M`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?6=G?'<AWJK^SLK\[D.]4?V=E?W<@WZG^
+MSLK^[D"^4_V=E?W=@7RG^CLK^[L#^4[U=U;V=P?RG>KOK.SO#N0[U=]9V=\=
+MR'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[NR$\)[LK^[DB^4_V=E?W=D7RG^CLK
+M^[LC^4[U=U;V=T?RG>KOK.SOCN0[U=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?
+MJ?[.RO[N2+Y3_9V5_=V1?*?Z.RO[NR/Y3O5W5O9W1_*=ZN^L[.^.Y#O5WUG9
+MWQW)=ZJ_L[*_.Y+O5']G97]WXJ<$=V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z
+M.RO[NQ/Y3O5W5O9W)_*=ZN^L[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O5']G97]W
+M(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[$_E.]7=6]G<G\IWJ[ZSL[T[D.]7?
+M6=G?G<AWJK^SLK\[\U."N[*_.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\
+MI_H[*_N[,_E.]7=6]G=G\IWJ[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?V=E
+M?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK^[LS^4[U=U;V=V?RG>KOK.SOSN0[
+MU=]9V=]=^"G!7=G?7<AWJK^SLK^[D.]4?V=E?W<AWZG^SLK^[D*^4_V=E?W=
+MA7RG^CLK^[L+^4[U=U;V=Q?RG>KOK.SO+N0[U=]9V=]=R'>JO[.RO[N0[U1_
+M9V5_=R'?J?[.RO[N0KY3_9V5_=V%?*?Z.U]^DN96?0Y\]_TIYLY3?[?<I[?J
+MW('O7/5WGOJ[U<S=:N$NUOP4<^>IOUO-W*W^;'/@.U?]G:?^;G5-9Q=T_YVK
+M_LY3?]?.KL^![USU=Y[Z.Y@#W[GJ[SSU=S`'OG/5WWGJ[Y:Y!WT.?.>JO_/4
+MWSU8YE9M#GSGJK_SU-\]F+E[T+D#W[GJ[SSU=P]F[AYT[L!WKOH[3_W=@^O-
+MV8'O7/5WGOJ[=G9]#GSGJK_SU-_!'/C.57_GJ;^#.?"=J_[.4W^WS#WL<^0[
+MU=]YZN\>+G.=._*=ZN\\]7</9^X>-N[H_CM7_9VG_N[AS-W#QAW=?^>JO_/4
+MWSV\YK.C^^]<]7>>^KMV=GV.?*?Z.T_]'<R1[U1_YZF_@SGRG>KO//5WR]RC
+M/D>^4_V=I_[NT3+7N*/[[USU=Y[ZNT<S=X\Z=^0[U=]YZN\>S=P]ZMR1[U1_
+MYZF_>W2].3ORG>KO//5W[>SZ'/E.]7>>^CN8(]^I_LY3?P=SY#O5WWGJ[Y:Y
+MQWV.?*?Z.T_]W>-EKG-'OE/]G:?^[O',W>/&'=U_YZJ_\]3?/9ZY>]RXH_OO
+M7/5WGOJ[Q]=\=G3_G:O^SE-_U\ZNSY'O5'_GJ;^#.?*=ZN\\]7<P1[Y3_9VG
+M_FZ9>]+GR'>JO_/4WSU9YAIW=/^=J_[.4W_W9.;N2>>.?*?Z.T_]W9.9NR>=
+M._*=ZN\\]7=/KC=G1[Y3_9VG_JZ=79\CWZG^SE-_!W/D.]7?>>KO8(Y\I_H[
+M3_W=,O>TSY'O5'_GJ;][NLQU[LAWJK_SU-\]G;E[VKBC^^]<]7>>^KNG,W=/
+M&W=T_YVK_LY3?_?TFL^.[K]SU=]YZN_:V?4Y\IWJ[SSU=S!'OE/]G:?^#N;(
+M=ZJ_\]3?+7//^ASY3O5WGOJ[9\M<XX[NOW/5WWGJ[Y[-W#WKW)'O5'_GJ;][
+M-G/WK'-'OE/]G:?^[MGUYNS(=ZJ_\]3?M;/K<^0[U=]YZN]@CGRG^CM/_1W,
+MD>]4?^>IOUOFGO<Y\IWJ[SSU=\^7N<X=^4[U=Y[ZN^<S=\\;=W3_G:O^SE-_
+M]WSF[GGCCNZ_<]7?>>KOGE_SV=']=Z[Z.T_]73N[/D>^4_V=I_X.YLAWJK_S
+MU-_!'/E.]7>>^KME[D6?(]^I_LY3?_=BF6O<T?UWKOH[3_W=BYF[%YT[\IWJ
+M[SSU=R]F[EYT[LAWJK_SU-^]N-Z<'?E.]7>>^KMV=GV.?*?Z.T_]'<R1[U1_
+MYZF_@SGRG>KO//5WR]S+/D>^4_V=I_[NY3+7N2/?J?[.4W_W<N;N9>..[K]S
+MU=]YZN]>SMR];-S1_7>N^CM/_=W+:SX[NO_.57_GJ;]K9]?GR'>JO_/4W\$<
+M^4[U=Y[Z.Y@CWZG^SE-_M\R]ZG/D.]7?>>KO7BUSC3NZ_\Y5?^>IOWLU<_>J
+M<T>^4_V=I_[NU<S=J\X=^4[U=Y[ZNU?7F[,CWZG^SE-_U\ZNSY'O5'_GJ;^#
+M.?*=ZN\\]7<P1[Y3_9VG_FZ9>]WGR'>JO_/4W[U>YCIWY#O5WWGJ[U[/W+UN
+MW-']=Z[Z.T_]W>N9N]>-.[K_SE5_YZF_>WW-9T?WW[GJ[SSU=^WL^ASY3O5W
+MGOH[F"/?J?[.4W\'<^0[U=]YZN^6N3=]CGRG^CM/_=V;9:YQ1_??N>KO//5W
+M;V;NWG3NR'>JO_/4W[V9N7O3N2/?J?[.4W_WYGIS=N0[U=]YZN_:V?4Y\IWJ
+M[SSU=S!'OE/]G:?^#N;(=ZJ_\]3?+7-O^QSY3O5W7O5W0???N>KOO.KO@NZ_
+M<]7?>=7?!=U_YZJ_\ZJ_"[K_SE5_YU5_%W3_G:O^SJO^+NC^.U?]G5?]7=#]
+M=Z[Z.Q?]W;L^1[Y3_9VG_N[=,M>XH_OO7/5WGOJ[=S-W[SIWY#O5WWGJ[][-
+MW+WKW)'O5'_GJ;][=[TY._*=ZN\\]7?M[/H<^4[U=Y[Z.Y@CWZG^SE-_!W/D
+M.]7?Q?*3-+?N<^"[4/W=]P_<XV[QT[IS![X+U=]%ZN_6\]ZZ<4?WWX7J[R+U
+M=^N9NW7CCNZ_"]7?1>KOUM=\=G3_7:C^+E)_U\ZNSX'O0O5WD?H[F`/?A>KO
+M(O5W,`>^"]7?1>KOECGK<^"[4/U=I/[.EKG&'=U_%ZJ_B]3?V?SRK','O@O5
+MWT7J[VSFSCIWX+M0_5VD_LZN-V<'O@O5WT7J[]K9]3GP7:C^+E)_!W/@NU#]
+M7:3^#N;`=Z'ZNTC]W3+G?8Y\I_J[2/V=+W.=._*=ZN\B]7<^<^>-.[K_+E1_
+M%ZF_\YD[;]S1_7>A^KM(_9U?\]G1_7>A^KM(_5T[NSY'OE/]7:3^#N;(=ZJ_
+MB]3?P1SY3O5WD?J[92[Z'/E.]7>1^KM8YAIW=/]=J/XN4G\7,W?1N2/?J?XN
+M4G\7,W?1N2/?J?XN4G\7UYNS(]^I_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W
+M,$>^4_U=I/YNF1OZ'/E.]7>1^KMAF>O<D>]4?Q>IOQMF[H;&'=U_%ZJ_B]3?
+M#3-W0^..[K\+U=]%ZN^&:SX[NO\N5'\7J;]K9]?GR'>JOXO4W\$<^4[U=Y'Z
+M.Y@CWZG^+E)_M\QM^ASY3O5WD?J[S3+7N*/[[T+U=Y'ZN\W,W:9S1[Y3_5VD
+M_FXS<[?IW)'O5'\7J;_;7&_.CGRG^KM(_5T[NSY'OE/]7:3^#N;(=ZJ_B]3?
+MP1SY3O5WD?J[96[;Y\AWJK^+U-]ME[G.'?E.]7>1^KOMS-VV<4?WWX7J[R+U
+M=]N9NVWCCNZ_"]7?1>KOMM=\=G3_7:C^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B
+M]7<P1[Y3_5VD_FZ9V_4Y\IWJ[R+U=[MEKG%']]^%ZN\B]7>[F;M=YXY\I_J[
+M2/W=;N9NU[DCWZG^+E)_M[O>G!WY3O5WD?J[=G9]CGRG^KM(_1W,D>]4?Q>I
+MOX,Y\IWJ[R+U=\O<V.?(=ZJ_B]3?C<M<YXY\I_J[2/W=.',W-N[H_KM0_5VD
+M_FZ<N1L;=W3_7:C^+E)_-U[SV=']=Z'ZNTC]73N[/D>^4_U=I/X.YLAWJK^+
+MU-_!'/E.]7>1^KME;NISY#O5WT7J[Z9EKG%']]^%ZN\B]7?3S-W4N2/?J?XN
+M4G\WS=Q-G3ORG>KO(O5WT_7F[,AWJK^+U-^UL^MSY#O5WT7J[V".?*?ZNTC]
+M'<R1[U1_%ZF_6^;>]SGRG>KO(O5W[Y>YSAWY3O5WD?J[]S-W[QMW=/]=J/XN
+M4G_W?N;N?>..[K\+U=]%ZN_>7_/9T?UWH?J[2/U=.[L^1[Y3_5VD_@[FR'>J
+MOXO4W\$<^4[U=Y'ZNV7N0Y\CWZG^+E)_]V&9:]S1_7>A^KM(_=V'F;L/G3OR
+MG>KO(O5W'V;N/G3NR'>JOXO4WWVXWIP=^4[U=Y'ZNW9V?8Y\I_J[2/T=S)'O
+M5'\7J;^#.?*=ZN\B]7?+W,<^1[Y3_5VD_N[C,M>Y(]^I_BY2?_=QYNYCXX[N
+MOPO5WT7J[S[.W'ULW-']=Z'ZNTC]W<=K/CNZ_RY4?Q>IOVMGU^?(=ZJ_B]3?
+MP1SY3O5WD?H[F"/?J?XN4G^WS'WJ<^0[U=]%ZN\^+7.-.[K_+E1_%ZF_^S1S
+M]ZES1[Y3_5VD_N[3S-VGSAWY3O5WD?J[3]>;LR/?J?XN4G_7SJ[/D>]4?Q>I
+MOX,Y\IWJ[R+U=S!'OE/]7:3^;IG[W.?(=ZJ_B]3??5[F.G?D.]7?1>KO/L_<
+M?6[<T?UWH?J[2/W=YYF[SXT[NO\N5'\7J;_[?,UG1_??A>KO(O5W[>SZ'/E.
+M]7>1^CN8(]^I_BY2?P=SY#O5WT7J[Y:Y+WV.?*?ZNTC]W9=EKG%']]^%ZN\B
+M]7=?9NZ^=.[(=ZJ_B]3??9FY^]*Y(]^I_BY2?_?E>G-VY#O5WT7J[]K9]3GR
+MG>KO(O5W,$>^4_U=I/X.YLAWJK\;EI^DN:]]#GPWJ/YN2/W=UV6N<P>^^_X4
+M<S>D_N[KS-W7A;MAS4\Q=T/J[[[.W'W]L\W1U]MN1R0_\.UM^O;MCY<_!C<_
+M7M_@J_4>?M0?^/:/M_?_:8,_+H39[%;#9K79KD;_W5?X?__\W_0*[^;^MC=\
+M-T=?8/S>7'O!]CMS/P3_T^_\Z^L;MW)/?N!N[N:FM`U="--?Q%]$G^D#\M71
+M%QC_3V"YN73EY\_SCR]1_OV_QI:_<$\W5[;/[ZJ_/HJ8[[W=7[R^U>W;_2'1
+MW?W?;S_->?%V5_?G#K_\W/[ZU3VX?77T1;S_DT_&S=4AO_DG]Z^1^W]R[^;\
+C[Q7![H=9_O+<'G[4'_CVK[?W_[D;''X,_O'_LNY7-X&E````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow2.gz.uu
new file mode 100644
index 0000000..0fb9958
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.qcow2.gz
+M'XL(")$[(U0``VEM9RTQ>#$M-3$R+6)S9"YQ8V]W,BYO=70`K9C;DM)`$(;O
+M>8I9SZZ*F>Y)2#RLNNM:Y9W>Z#6P\!0\O!NFR22=_C-(!5*IHH;_JY[,EV9"
+M4<27<Z5WH7*A<?N->_PL![G>A^'A#K]__%SV7X=%A/D"I(R!P!UNP+I+.$*X
+MPH\'O(WK5<<&CDZI,2B'"["ZJ0$#=[TX7KKC8M0JP9<`(PXNQD7U4:Q/)\*%
+M]='<];%]_<I33@]4T_5QK$^G5@A79W%DI!J$6V=Q;*0V"+?-XH*1>D"X7197
+M&JD]P/F,*H^XRDAYA*,L;F6D&.%"%E<;*>2=SWO7&"GDG<][MS92R#N?]VYC
+MI)!W/N_=UD@A[WS>NP<CA;PCX)U+N)V10MZ1\NY*<$\2;F^DD'>DO'LJN&<=
+MSELIY!TI[YX+[D7"&?V.D'>DO'LIN%<)9_0[0MZ1\NZUX*X3SNAWA+PCY=T;
+MP;U-.*/?$?*.E'?O1MYYH]\1\HZ5=^^%522<T>\8><?*.R\X2CBCWS'RCI5W
+M++B0<$:_8^0=*^]*P54)9_0[1MZQ\FXEN#KAC'['R#M6WC6"^Y!P1K]CY!TK
+M[SX*[E/"&?V.D7>LO/LLN)N$,_H=(^^"\NZ+X+XFG-'O`O(N*.^^">XVX8Q^
+M%Y!W07EW)[CO'8ZL5.==4=B'X.Y']RS-N_\,:7_LC3,>F`#6_P.<JC#BFEDG
+M7,8)MQJLC3,>.-PNA^\.>%SA<M6N:EFYFLZM\._]G_&$RQE7..+PXZ@,=`7[
+M<W#'Q]'>-^O^Y@(.##<75PDW^3C:[K%WU@"LKIQ9%JI5KK_.KMD?'U).W5UM
+MS;KU=:D^0V8:3'>B/C>>;ONKT3W=J55L<929KAOB-I-K.UW=U;BZ[<R+P?K.
+M.//.;2'#.S?B:-Y&0/%_J:+]UOB,!PZ_EL-W!`8!SG8%0]7VOL4_.5!JJ4,3
+"````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.raw.gz.uu
new file mode 100644
index 0000000..874e570
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.raw.gz.uu
@@ -0,0 +1,10 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.raw.gz
+M'XL(".;%'50``VEM9RTQ>#$M-3$R+6)S9"YR87<N;W5T`*V4P0Z#(`R&[SY%
+MO>Y`2H7IKDMVWVD[.[,]!0\_4%0J`UU",22D[9>_U((X&8`BP/['GG:8J^#+
+M5*=JI)$#ZA:4!GV&SH;C^K$#<YCG[2%",QXG<UEIG-C8C*,]W")8'L$U+BN(
+MM&I)+KB48\+5GE6O.)539Q'X_JM87>KNYMYVF[RPSX`?P`&P\S[BP*6_L.J[
+MQ#*(E9O1!W&YO<.U/%X&.-HI%SCNE>UM7ET=JQL*-Z/93L;!R740/KD3CLH^
+B!#2^+/8/M%'QGG:8N^!K`BH/+':#BARP^@+33Z#K!04`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.vhd.gz.uu
new file mode 100644
index 0000000..04627e2
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.vhd.gz
+M'XL("/$TQ%4``VEM9RTQ>#$M-3$R+6)S9"YV:&0N;W5T`*V736_#(`R&[_T5
+MGG;KI`@<`MEU4N\[K><T3;=JVH?6'GK(_OOL!%+(U]J-A%)2\)/7QB`J1'L!
+MZ!3T#G0%.N.V4:#OP>0`U&D+-K6TCU"7'^]5>=R?$GO5BQ8FA6\5FK,]IJ#H
+M)0:PX)?H+;>A=ICD=O6\W+\].QQ:'%I09M@J1=";P7L4_9JWZIBTWN-K@WQX
+MZ=2E0W5G*_J8+0@%4GHC4J>.,,EWZ*PBJ]VN*09$U<3'E>`AZ#@[VXM=)GI6
+MGLRQH(JSLV,X/6=U#6ZYL'/1I@HEAJ%:@)9@D-N4-BX.@T*I<CI\%E^'JJ</
+M)U)%=_KDH"^==A=MJJ`;;!4H3N<Y=Z&A'/NXD53Y5_1T:*=L@X(@,M>!C?MA
+M],XH\/5I*69B/CT9D_H*UD>+010C]71'_9"$=P<L&4CKE99[IB''2R.X7CV-
+MS6\YD2Y_7!TE_H;K!,M+<*E=NVYDJ@"[W7*RH\&IFQ;%WPZGYM1QSE17.9M%
+M3N8R[]GY\PRX`5&"R+VL]H`\OW<VGYV^^Z$,#-R=T0=#=PO&F7"\]'#XB[L0
+MXC:S<SNKSLVMCRLC3\:VOS(N7+D,"5=NB\.X&P$V.PME((T:UM,=]6,2WBT0
+M[585;>]#MU7%4J@L,)I"`E:1%6(UFVS79J&V"B,=)!D7\2#)N(@'2<9%/$@R
+;+N)!DG$1#Y*,BWJ0U/0708C%#^STEH1]#```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdf.gz.uu
new file mode 100644
index 0000000..70c4c8c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdf.gz.uu
@@ -0,0 +1,13 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.vhdf.gz
+M'XL("%DEAE4``VEM9RTQ>#$M-3$R+6)S9"YV:&1F+F]U=`"ME#MOA#`,@'=^
+MA:4NZ`:4F"3`6NEVIG8&"B=4M5TZ=.#'-P8",:^[5H0H`CG^\%N(80$H!%%L
+MG/N"[CGB3Q=<@IZ&!-0)*`W:0&JOBWFS#R;H7J\OD;^Z$2>/M/9QT6(Y'-[#
+M30;+1W`Q:4E&P73"[0D&7#BRPAFGCJRSD1#UGYS59\7.Y39=Z/EY!MF`T""<
+ME\B!4WYAMB];FX',W0/[8.UN0;B$WY<>#N^X"QQ7'N;VV+IP;5UU<C+B96<\
+MV+D$X9T[X/#<08#]9+$5:&^MSWU!ET?\&8!J!)X603W./A.#:<#48#2])PI,
+M!DGJ`Y%74E=]?=;5=_OC9YAPE)"FV=ZDCS%UBTD`"_J)>:-WS[ZGZ^W2?MP<
+MSHTJ-Y%LLUFM&,&4*W?UHME:?.^1^6Q=O`Z2]J.7&1`*I&2.C];EO)P)IR9G
+EZP9*U<?';?;!!)NCBG!:++3^F]L!9TXN%5M\P2_U(^.V,`<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-bsd.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-bsd.vmdk.gz.uu
new file mode 100644
index 0000000..84e2c3e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-bsd.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-1x1-512-bsd.vmdk.gz
+M'XL(".?%'50``VEM9RTQ>#$M-3$R+6)S9"YV;61K+F]U=`"MG-UOV\H1Q=_S
+M5Q#.2]`'@4?\?@C0IDZ!HB@0W%S<^UKQJS&:Q(%M%`V@/[Y<<L_ZT#*]Q/4X
+M<L2-9D8[L]+8^<V!TG3Y2I*\3?(\R?ND*),4R?1/RRU)L\?%=#O6?.#\C^M_
+M_G;@U[O#X?QF"0;G)2Y(-9PL5L]S/CSY8KCC2UZK!Z;;,1HN<U[MA:,/=]QX
+M8#-</CUX?,Z%NSO-#_?N0L(E(5"R"E<\D]-FLB_M[D]O?/'<_C*WA^EXRR:I
+MLJ1L_3(IBWF=)=5Q?BQ-JLEHG`*^3:YO[O^37`_WW=W-CX=;O[^C.]O)."^=
+M?=FY"%-B5>DNW`,N7.-"E$.2]4D&]W!ROOO;S=?A\-_A[O[F]OM[,-VC.]L\
+M2_+&;<?9IX^WU<(]29J4<,^1G/_Z]^OW_I6;'GZ<[AC.>4T;F9Y[RD/CEF7B
+MOB]O\^Z&[P\NXNB_PN[<V?KB%/-SY^ZBR).J2>;M%"[V<7JX]RG/M>ONAM/#
+M\.O/'\/[JV^WWT/MW-FZDC5SH'HN5)84F0OE4W/E*UQ$][*93RTY?[UY^'+3
+M?9[2O!^N#F\3ABM=[:8#K/V^EJPGEW+S9*=MGS_^[V'*-^G]R=XPW+R).8GI
+MN8MC4E0NUG2`\U$<DRQW5],_31N>,LGAC)+S[??#+[]/;W%7K,^?_O(+P]63
+MUV0Y;7!RF1):Y50L^1=/7Y;)^?/'Y,HE^>N787X%,ERSO,V<\7(.F)='=^&K
+MMH1W32QW#\PGFUR?'D[)A]/]<'A[??TAG.S))9O/MVEK@XM2+J'=ZWLNYU2X
+MY:27@YZ/HN_;PZD__7@8[MSQAJ-H78EZGZD[UOSQ&-?/4\TG-;I73')^GUS=
+M]-.9NK#_'FZ_,5RWO(RG?;B71#,[9NYB>O7,X0?_#,LKQAV3"S<\W/T\=#^_
+MWGSOIS=:\I[A^J5VTW:6TWP\S.D`IQT^N\&I=E?SJ8;M,=S@=M=?;'`^3U_(
+ML*GPM,GYV[R]+\.IG[8VQ6:XT>WN^/P^?*6>/-44/3D_5FV.>^_#9:EO`9EO
+M9:L2A>TL3R@-=.@>;N^6C5U)/\Z>_BQ[;3_.+WZD5G\PX!+.>G]E^N3G6:9^
+MN2R*54#W4RR=OO\\?7]ZW%_I]E>*9:5>M2R:5;A_32%^7*9;NG?A22Q;]>ID
+MT>^I7NE:VR"6X]/J\5<-R/5V./XN0,M,O7)9%*MP6[4K?.UH6:E7+8MF%6ZK
+M=J6O'2U;]>IDT>]*MO*UH^6H7NZ.OTHAW?%K65G[VM$R4Z]<%L4JW%;M&E\[
+M6E;J5<NB687;JMW)UXZ6K7IULNAW)=OZVM%R5"]WQP8!N=X.U_G:T3)3KUP6
+MQ2K<5NUZ7SM:5NI5RZ)9A=NJW>!K1\M6O3I9]+N2'7WM:#FJE[O+I79Y+%R5
+M^MK1,E.O7!;%*MQ&[2KV.UI6ZE7+HEF%VZA=Q7Y'RU:].EGTNY)EOZ/EJ%[N
+MKI#:%=%P['>TS-0KET6Q"K=5._8[6E;J5<NB687;JAW['2U;]>IDT>]*EOV.
+MEJ-ZN;M2:E=&P['?T3)3KUP6Q2K<5NW8[VA9J5<MBV85;JMV['>T;-6KDT6_
+M*UGV.UJ.ZN7N^$L0Y'H['/L=+3/URF51K,)MU8[]CI:5>M6R:%;AMFK'?D?+
+M5KTZ6?2[DF6_H^6H7NZ.0`9RO1FN3GWM:)FI5RZ+8A5NHW8U^QTM*_6J9=&L
+MPFW4KF:_HV6K7ITL^EW)LM_1<E0O=]=([9IH./8[6F;JE<NB6(7;JAW['2TK
+M]:IET:S";=6._8Z6K7IULNAW)<M^1\M1O=P=__\$N=X.QWY'RTR]<ED4JW!;
+MM6._HV6E7K4LFE6XK=JQW]&R5:].%OVN9-GO:#FJE[LC?X1<;X=COZ-EIEZY
+M+(I5N*W:L=_1LE*O6A;-*MQ6[=CO:-FJ5R>+?E>R['>T'-7+W752NRX6KDE]
+M[6B9J5<NBV(5;J-V#?L=+2OUJF71K,)MU*YAOZ-EJUZ=+/I=R;+?T7)4+W?7
+M2^WZ:#CV.UIFZI7+HEB%VZH=^QTM*_6J9=&LPFW5COV.EJUZ=;+H=R7+?D?+
+M4;W<W2"U&Z+AV.]HF:E7+HMB%6ZK=NQWM*S4JY9%LPJW53OV.UJVZM7)HM^5
+M+/L=+4?U<G>CU&Z,AF._HV6F7KDLBE6XK=JQW]&R4J]:%LTJW%;MV.]HV:I7
+M)XM^5[+L=[0<U2N5Z1GD>C/<*5UJ%RPS]<IE4:S";=3NY/M=L*S4JY9%LPJW
+M4;N3[W?!LE6O3A;]KF1]OPN6HWJYD@F_0Q1IG7R_@_`[*+^#\#M$^=W)]SL(
+MOX/R.PB_0Y3?G7R_@_`[*+^#\+L=R?I^!^%W4'X'X7>((JV3[W<0?@?E=Q!^
+MARB_._E^!^%W4'X'X7>(\KN3[W<0?@?E=Q!^MR-9W^\@_`[*[R#\#E&D=?+]
+M#L+OH/P.PN\0Y7<GW^\@_`[*[R#\#E%^=_+]#L+OH/P.PN]V).O['83?0?D=
+MA-\ABK3:U-=.^!V4WT'X':+\KF6_$WX'Y7<0?H<HOVO9[X3?0?D=A-_M2);]
+M3O@=E-]!^!VB2*MEOQ-^!^5W$'Z'*+]KV>^$WT'Y'83?(<KO6O8[X7=0?@?A
+M=SN29;\3?@?E=Q!^ARC2:MGOA-]!^1V$WR'*[UKV.^%W4'X'X7>(\KN6_4[X
+M'93?0?C=CF39[X3?0?D=A-\ABK1:]COA=U!^!^%WB/*[EOU.^!V4WT'X':+\
+MKF6_$WX'Y7<0?K<C6?8[X7=0?@?A=X@BK2[UM1-^!^5W$'Z'*+_KV.^$WT'Y
+M'83?(<KO.O8[X7=0?@?A=SN29;\3?@?E=Q!^ARC2ZMCOA-]!^1V$WR'*[SKV
+M.^%W4'X'X7>(\KN._4[X'93?0?C=CF39[X3?0?D=A-\ABK0Z]COA=U!^!^%W
+MB/*[COU.^!V4WT'X':+\KF._$WX'Y7<0?K<C6?8[X7=0?@?A=X@BK8[]3O@=
+ME-]!^!VB_*YCOQ-^!^5W$'Z'*+_KV.^$WT'Y'83?[4B6_4[X'93?0?@=HDBK
+M3WWMA-]!^1V$WR'*[WKV.^%W4'X'X7>(\KN>_4[X'93?0?C=CF39[X3?0?D=
+MA-\ABK1Z]COA=U!^!^%WB/*[GOU.^!V4WT'X':+\KF>_$WX'Y7<0?K<C6?8[
+MX7=0?@?A=X@BK9[]3O@=E-]!^!VB_*YGOQ-^!^5W$'Z'*+_KV>^$WT'Y'83?
+M[4B6_4[X'93?0?@=HDBK9[\3?@?E=Q!^ARB_Z]GOA-]!^1V$WR'*[WKV.^%W
+M4'X'X7<[DF6_$WX'Y7=!3`>YEG#)\NW##>E2NV<EY<_\4ZA=\NSN!F-](&9]
+M8)@I+%G]L8!+..O]A?DV;Z_2+R+,MWE[E7X18;[-VZOTBPCS;=Y>I5]$F&^;
+MZ!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AO
+MF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28
+M;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$
+MF&^;Z!<1YMLF^D6$^;:)?A%AOFVB7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$
+MY]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3G
+MVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;
+M-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV
+M^D5POFVC7P3GVS;Z17"^;:-?1)AOT_)5^D6$^38M7Z5?1)AOT_)5^D6$^38M
+M7Z5?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%A
+MOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X1
+M8;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^
+M$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE\$Y]LV^D4,IOI%#*;Z10RF
+M^D4,IOI%#*;Z10RF^D4,IOI%#*;Z10RF^D4,IOI%#*;Z10RF^D4,IOI%#*;Z
+M10RF^D6,:6JH7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ
+M7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7SRF:6JH7SQ>?);PSG"7R2[ZP'S>
+MW_+IH)=_;S]P_G!8_PD!YP_8+2KW0:=%F=3'O3O\_>-OSR2<'\T27L)=?'CR
+MTW!APSL^BSF?/V!7+5/]0.C-!Y9P[WRL=X_A\I=VIW.*?<D:?WAR/G^(K=KJ
+M.<_ODN)Q'O_DO1'.-WG<7W.YC>,JW1?VEURFZYJH?GRHGN+JW;J1;K(.U[YX
+MMB_O[MWE[CKCP[CX*-:=[UP79/W.7<(=;1M!.7>69?A_^??V`^=/A_6?)6`^
+,!WSS?ZE[ZN&@70``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow.gz.uu
new file mode 100644
index 0000000..8e8e277
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.qcow.gz
+M'XL("*$S(E0``VEM9RTQ>#$M-3$R+65B<BYQ8V]W+F]U=`"MG=F.'-=R1=_U
+M%<5Y)BLBLJHR.>,"-N"WZP?;K[?&Y_H`?KPY9)[3';4V0[9$-0029&Y4G5Y:
+MA*3%T^OUKV^KU<96PW8U3*O+8?7]Q_.'K>[\X/['ZMM__OM_O+W[[=L?O\9L
+M_9NGTH\'7\4\=V_K'^LVYS^>.J[6TY^8^_YA-'?GU<7_X=7=>;.W<R__^/5F
+M^3E7@_??[FJ>6]ZNB=,;_MSK^YK>KOTZO;_O[;IXNQLUN+TW^,]Y[E_SZW/Q
+M=G=J;KPW=TUOU\7;G=3<_K>PN(#EH.:.Q=R`3YW4W+F8V^!3%YZSWWQN?\UM
+M\2E3<XYSJS:WPZ="S0WWYM9O%Z"7N1&?$MQ9R=V$3PGNK.1NCT\)[JSD[H!/
+M">ZLY.Z(3PGNK.3NA$\)[KSD[HQ/">Z\Y.Z"3PGNO.+.^"G!G5?<&?G.%7=>
+M<6?D.U?<><6=D>]<<><5=T:^<\6=5]P9^<X5=U%Q9^2[4-Q%Q9V1[T)Q%R5W
+MY+M0W$7)'?DN%'=1<D>^"\5=E-R1[T)Q%R5WY+M0W$7)'?DN%'=#R1WY;E#<
+M#25WY+M!<3=4W#D_);@;*NZ<?#<H[H:*.R??#8J[H>+.R7>#XFZHN'/RW:"X
+M&RKNG'PW*.XV%7=.OMLH[C85=TZ^VRCN-B5WY+N-XFY3<D>^VRCN-B5WY+N-
+MXFY3<D>^VRCN-B5WY+N-XFY3<D>^VRCNMB5WY+NMXFY;<D>^VRKNMA5WP4\)
+M[K85=T&^VRKNMA5W0;[;*NZV%7=!OMLJ[K85=T&^VRKNMA5W0;[;*NYV%7=!
+MOMLI[G85=T&^VRGN=B5WY+N=XFY7<D>^VRGN=B5WY+N=XFY7<D>^VRGN=B5W
+MY+N=XFY7<D>^VRGNQI([\MVHN!M+[LAWH^)NK+@;^"G!W5AQ-Y#O1L7=6'$W
+MD.]&Q=U8<3>0[T;%W5AQ-Y#O1L7=6'$WD.]&Q=WRG[_U'/EN4MQ-%7<#^6Y2
+MW$TE=^2[27$WE=R1[R;%W51R1[Z;%'=3R1WY;E+<325WY+M)<3>5W)'O)L7=
+MON2.?+=7W.U+[LAW>\7=ON)NPT\)[O85=QORW5YQMZ^XVY#O]HJ[?<7=AGRW
+M5]SM*^XVY+N]XFY?<;<AW^T5=\O_AM1SY+N#XNY0<;<AWQT4=X>2._+=07%W
+M*+DCWQT4=X>2._+=07%W*+DCWQT4=X>2._+=07%W*+DCWQT4=\>2._+=47%W
+M++DCWQT5=\>*NRT_);@[5MQMR7='Q=VQXFY+OCLJ[HX5=UORW5%Q=ZRXVY+O
+MCHJ[8\7=EGQW5-R=*NZVY+N3XNY4<;<EWYT4=Z>2._+=27%W*KDCWYT4=Z>2
+M._+=27%W*KDCWYT4=Z>2._+=27%W*KDCWYT4=^>2._+=67%W+KDCWYT5=^>*
+MNQT_);@[5]SMR'=GQ=VYXFY'OCLK[LX5=SORW5EQ=ZZXVY'OSHJ[<\7=CGQW
+M5MQ=*NYVY+N+XNY2<;<CWUT4=Y>2._+=17%W*;DCWUT4=Y>2._+=17%W*;DC
+MWUT4=Y>2._+=17%W*;DCWUT$=[9\1\^![VPMN+-UR1WXSM:".UM7W(W\%'-G
+M97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/XSE1_9V5_-X+O3/5W5O9W
+M(_C.5']G97\W@N],]7=6]G<C^,Y4?V=E?S>"[TSU=U;V=R/XSE1_9V5_-X+O
+M3/5W5O9W(_C.5']G97\W@N],]7=6]G<C^4[U=U;V=R/Y3O5W5O9W$S\EN"O[
+MNXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z
+M.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)
+M?*?Z.RO[NXE\I_H[*_N[B7RG^CLK^[N)?*?Z.RO[NST_);@K^[L]^4[U=U;V
+M=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3
+M_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[._VY#O5WUG9W^W)=ZJ_L[*_
+MVY/O5']G97^W)]^I_L[*_FY/OE/]G97]W8&?$MR5_=V!?*?Z.RO[NP/Y3O5W
+M5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`
+MOE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?6=G?'<AWJK^S
+MLK\[D.]4?V=E?W<@WZG^SLK^[LA/">[*_NY(OE/]G97]W9%\I_H[*_N[(_E.
+M]7=6]G='\IWJ[ZSL[X[D.]7?6=G?'<EWJK^SLK\[DN]4?V=E?W<DWZG^SLK^
+M[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[U=]9V=\=R7>J
+MO[.ROSN2[U1_9V5_=^*G!'=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3
+M^4[U=U;V=R?RG>KOK.SO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.
+MRO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L[.].Y#O5WUG9WYW(
+M=ZJ_L[*_._-3@KNROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[
+MNS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5']G97]W)M^I
+M_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ[ZSL[\[D.]7?6=G?
+M7?@IP5W9WUW(=ZJ_L[*_NY#O5']G97]W(=^I_L[*_NY"OE/]G97]W85\I_H[
+M*_N["_E.]7=6]G<7\IWJ[ZSL[R[D.]7?6=G?7<AWJK^SLK^[D.]4?V=E?W<A
+MWZG^SLK^[D*^4_V=E?W=A7RG^CM?OI/F5GT.?/?]*>;.4W^WW*>WZMR![USU
+M=Y[ZN]7,W6KA+M;\%'/GJ;];S=RM_M7FP'>N^CM/_=WJFLXNZ/X[5_V=I_ZN
+MG5V?`]^YZN\\]7<P![YSU=]YZN]@#GSGJK_SU-\M<P_Z'/C.57_GJ;][L,RM
+MVASXSE5_YZF_>S!S]Z!S![YSU=]YZN\>S-P]Z-R![USU=Y[ZNP?7F[,#W[GJ
+M[SSU=^WL^ASXSE5_YZF_@SGPG:O^SE-_!W/@.U?]G:?^;IE[V.?(=ZJ_\]3?
+M/5SF.G?D.]7?>>KO'L[</6S<T?UWKOH[3_W=PYF[AXT[NO_.57_GJ;][>,UG
+M1_??N>KO//5W[>SZ'/E.]7>>^CN8(]^I_LY3?P=SY#O5WWGJ[Y:Y1WV.?*?Z
+M.T_]W:-EKG%']]^YZN\\]7>/9NX>=>[(=ZJ_\]3?/9JY>]2Y(]^I_LY3?_?H
+M>G-VY#O5WWGJ[]K9]3GRG>KO//5W,$>^4_V=I_X.YLAWJK_SU-\M<X_['/E.
+M]7>>^KO'RUSGCGRG^CM/_=WCF;O'C3NZ_\Y5?^>IOWL\<_>X<4?WW[GJ[SSU
+M=X^O^>SH_CM7_9VG_JZ=79\CWZG^SE-_!W/D.]7?>>KO8(Y\I_H[3_W=,O>D
+MSY'O5'_GJ;][LLPU[NC^.U?]G:?^[LG,W9/.'?E.]7>>^KLG,W=/.G?D.]7?
+M>>KOGEQOSHY\I_H[3_U=.[L^1[Y3_9VG_@[FR'>JO_/4W\$<^4[U=Y[ZNV7N
+M:9\CWZG^SE-_]W29Z]R1[U1_YZF_>SIS][1Q1_??N>KO//5W3V?NGC;NZ/X[
+M5_V=I_[NZ36?'=U_YZJ_\]3?M;/K<^0[U=]YZN]@CGRG^CM/_1W,D>]4?^>I
+MOUOFGO4Y\IWJ[SSU=\^6N<8=W7_GJK_SU-\]F[E[UKDCWZG^SE-_]VSF[EGG
+MCGRG^CM/_=VSZ\W9D>]4?^>IOVMGU^?(=ZJ_\]3?P1SY3O5WGOH[F"/?J?[.
+M4W^WS#WO<^0[U=]YZN^>+W.=._*=ZN\\]7?/9^Z>-^[H_CM7_9VG_N[YS-WS
+MQAW=?^>JO_/4WSV_YK.C^^]<]7>>^KMV=GV.?*?Z.T_]'<R1[U1_YZF_@SGR
+MG>KO//5WR]R+/D>^4_V=I_[NQ3+7N*/[[USU=Y[ZNQ<S=R\Z=^0[U=]YZN]>
+MS-R]Z-R1[U1_YZF_>W&].3ORG>KO//5W[>SZ'/E.]7>>^CN8(]^I_LY3?P=S
+MY#O5WWGJ[Y:YEWV.?*?Z.T_]W<MEKG-'OE/]G:?^[N7,W<O&'=U_YZJ_\]3?
+MO9RY>]FXH_OO7/5WGOJ[E]=\=G3_G:O^SE-_U\ZNSY'O5'_GJ;^#.?*=ZN\\
+M]7<P1[Y3_9VG_FZ9>]7GR'>JO_/4W[U:YAIW=/^=J_[.4W_W:N;N5>>.?*?Z
+M.T_]W:N9NU>=._*=ZN\\]7>OKC=G1[Y3_9VG_JZ=79\CWZG^SE-_!W/D.]7?
+M>>KO8(Y\I_H[3_W=,O>ZSY'O5'_GJ;][O<QU[LAWJK_SU-^]GKE[W;BC^^]<
+M]7>>^KO7,W>O&W=T_YVK_LY3?_?ZFL^.[K]SU=]YZN_:V?4Y\IWJ[SSU=S!'
+MOE/]G:?^#N;(=ZJ_\]3?+7-O^ASY3O5WGOJ[-\M<XX[NOW/5WWGJ[][,W+WI
+MW)'O5'_GJ;][,W/WIG-'OE/]G:?^[LWUYNS(=ZJ_\]3?M;/K<^0[U=]YZN]@
+MCGRG^CM/_1W,D>]4?^>IOUOFWO8Y\IWJ[[SJ[X+NOW/5WWG5WP7=?^>JO_.J
+MOPNZ_\Y5?^=5?Q=T_YVK_LZK_B[H_CM7_9U7_5W0_7>N^CNO^KN@^^]<]7<N
+M^KMW?8Y\I_H[3_W=NV6N<4?WW[GJ[SSU=^]F[MYU[LAWJK_SU-^]F[E[U[DC
+MWZG^SE-_]^YZ<W;D.]7?>>KOVMGU.?*=ZN\\]7<P1[Y3_9VG_@[FR'>JOXOE
+M.VENW>?`=Z'ZN^\_<8^[Q4_KSAWX+E1_%ZF_6\][Z\8=W7\7JK^+U-^M9^[6
+MC3NZ_RY4?Q>IOUM?\]G1_7>A^KM(_5T[NSX'O@O5WT7J[V`.?!>JOXO4W\$<
+M^"Y4?Q>IOUOFK,^![T+U=Y'Z.UOF&G=T_UVH_BY2?V?SR[/.'?@N5'\7J;^S
+MF3OKW('O0O5WD?H[N]Z<'?@N5'\7J;]K9]?GP'>A^KM(_1W,@>]"]7>1^CN8
+M`]^%ZN\B]7?+G/<Y\IWJ[R+U=[[,=>[(=ZJ_B]3?^<R=-^[H_KM0_5VD_LYG
+M[KQQ1_??A>KO(O5W?LUG1_??A>KO(O5W[>SZ'/E.]7>1^CN8(]^I_BY2?P=S
+MY#O5WT7J[Y:YZ'/D.]7?1>KO8IEKW-']=Z'ZNTC]7<S<1>>.?*?ZNTC]7<S<
+M1>>.?*?ZNTC]75QOSHY\I_J[2/U=.[L^1[Y3_5VD_@[FR'>JOXO4W\$<^4[U
+M=Y'ZNV5NZ'/D.]7?1>KOAF6N<T>^4_U=I/YNF+D;&G=T_UVH_BY2?S?,W`V-
+M.[K_+E1_%ZF_&Z[Y[.C^NU#]7:3^KIU=GR/?J?XN4G\'<^0[U=]%ZN]@CGRG
+M^KM(_=TRM^ESY#O5WT7J[S;+7...[K\+U=]%ZN\V,W>;SAWY3O5WD?J[S<S=
+MIG-'OE/]7:3^;G.].3ORG>KO(O5W[>SZ'/E.]7>1^CN8(]^I_BY2?P=SY#O5
+MWT7J[Y:Y;9\CWZG^+E)_MUWF.G?D.]7?1>KOMC-WV\8=W7\7JK^+U-]M9^ZV
+MC3NZ_RY4?Q>IO]M>\]G1_7>A^KM(_5T[NSY'OE/]7:3^#N;(=ZJ_B]3?P1SY
+M3O5WD?J[96[7Y\AWJK^+U-_MEKG&'=U_%ZJ_B]3?[6;N=IT[\IWJ[R+U=[N9
+MNUWGCGRG^KM(_=WN>G-VY#O5WT7J[]K9]3GRG>KO(O5W,$>^4_U=I/X.YLAW
+MJK^+U-\M<V.?(]^I_BY2?S<N<YT[\IWJ[R+U=^/,W=BXH_OO0O5WD?J[<>9N
+M;-S1_7>A^KM(_=UXS6=']]^%ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^+E)_!W/D
+M.]7?1>KOEKFISY'O5'\7J;^;EKG&'=U_%ZJ_B]3?33-W4^>.?*?ZNTC]W31S
+M-W7NR'>JOXO4WTW7F[,CWZG^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B]7<P1[Y3
+M_5VD_FZ9>]_GR'>JOXO4W[U?YCIWY#O5WT7J[][/W+UOW-']=Z'ZNTC]W?N9
+MN_>-.[K_+E1_%ZF_>W_-9T?WWX7J[R+U=^WL^ASY3O5WD?H[F"/?J?XN4G\'
+M<^0[U=]%ZN^6N0]]CGRG^KM(_=V'9:YQ1_??A>KO(O5W'V;N/G3NR'>JOXO4
+MWWV8N?O0N2/?J?XN4G_WX7IS=N0[U=]%ZN_:V?4Y\IWJ[R+U=S!'OE/]7:3^
+M#N;(=ZJ_B]3?+7,?^QSY3O5WD?J[C\M<YXY\I_J[2/W=QYF[CXT[NO\N5'\7
+MJ;_[.'/WL7%']]^%ZN\B]7<?K_GLZ/Z[4/U=I/ZNG5V?(]^I_BY2?P=SY#O5
+MWT7J[V".?*?ZNTC]W3+WJ<^1[U1_%ZF_^[3,->[H_KM0_5VD_N[3S-VGSAWY
+M3O5WD?J[3S-WGSIWY#O5WT7J[SY=;\Z.?*?ZNTC]73N[/D>^4_U=I/X.YLAW
+MJK^+U-_!'/E.]7>1^KME[G.?(]^I_BY2?_=YF>O<D>]4?Q>IO_L\<_>Y<4?W
+MWX7J[R+U=Y]G[CXW[NC^NU#]7:3^[O,UGQW=?Q>JOXO4W[6SZW/D.]7?1>KO
+M8(Y\I_J[2/T=S)'O5'\7J;];YK[T.?*=ZN\B]7=?EKG&'=U_%ZJ_B]3??9FY
+M^]*Y(]^I_BY2?_=EYNY+YXY\I_J[2/W=E^O-V9'O5'\7J;]K9]?GR'>JOXO4
+MW\$<^4[U=Y'Z.Y@CWZG^;EB^D^:^]CGPW:#ZNR'U=U^7N<X=^.[[4\S=D/J[
+MKS-W7Q?NAC4_Q=P-J;_[.G/W]5]M#GPWJ/ZN?2QSN3<>Z/Z[_E0Q=^?;MS]>
+M_AS<T,T\Q>#E@H._YGZ0]_T7?/_8;^;O?/]8VYVY'U]2V/3K>W!WCK[R\5]Z
+MN_3%V7\SN-FL]ON;P?]:7M_/RW0&7ZWW\'?]$]_^\?;^7^WU_?S3VYO=:MBL
+M-MO5Z'_V#?_/O_TW?3KH3V___\[OUUQ)7WO!]F?F?OYN>^=7WB5#_\2WCLG;
+M.]?6;>A/;_<7\4,O9_H)^>KHJ[W_%?9N_H3TW<_SSZ\7__U?C9?_^Y&N$6V?
+MWU5_?524WWN[OWE]J]NW^_-WM-W]7V]WYKQXNZO[<X???FY__^H>W+XZ^HKJ
+M?^63<?/G?/_D/[D_1N[_D_MKSO]>$>Q^FN7';SI[^+O^B6__?'O_KU^#PSSX
+3MYW@L!Z_O\H__A<I;[G$7Z<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow2.gz.uu
new file mode 100644
index 0000000..07c721f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.qcow2.gz
+M'XL("),[(U0``VEM9RTQ>#$M-3$R+65B<BYQ8V]W,BYO=70`K9=;L](P$,??
+M^13!RU&/BLUN4HJ7HYZ+,[[I@_I<+OT4?'C;9FG:[6X#3*'#P(3_;S;DEZ7)
+MLO`PQEOC<N,VIMJ:^C-=8'H?AI<Y_O[Q<]5_'!<!9C,E)0PX['`#UD/$@8;+
+M['C`RKA>=2C@X)0:@U(XIU8W-2#@;A?M3]<N1L$2>`TPX-3%N*H^"/7QA+NR
+M/IB[/I1_/W_*\8%\NCX,]?'46L,521P(J8V&*Y,X%%);#;=+XIR0VFNX0Q+G
+MA52EX&Q"E1J7"RFKX2")6PLIU'`NB2N$E.:=37NW$5*:=S;M72FD-.]LVKNM
+MD-*\LVGO=D)*\\ZFO=L+*<T[4+PS$7<04IIWP+Q;$NY9Q%5"2O,.F'?/"?>B
+MPUDII7D'S+N7A+N).*'?@>8=,.]>$>YUQ`G]#C3O@'GWAG"W$2?T.]"\`^;=
+M6\*]BSBAWX'F'3#OWH^\LT*_`\T[9-Y](%86<4*_0\T[9-Y9PD'$"?T.->^0
+M>8>$<Q$G]#O4O$/FG2=<'G%"OT/-.V3>K0E71)S0[U#S#IEW&\)]C#BAWZ'F
+M'3+O/A'N<\0)_0XU[Y!Y]X5P=Q$G]#O4O'/,NZ^$^Q9Q0K]SFG>.>?>=</<1
+M)_0[IWGGF'</A'OL<""E.N^R3+X(]S3:LS#O_:>+]\=6>-4')H#%)<"I"@-N
+M,^N$?=@;EP&K2JO/A[U1?Z&^2D]OZBM,C_*V]P<LU+?LX_9S3[>Z#.B]*<L1
+M\,^IOE;G9A.5PJL^<+Q?#9]=?:X!^G6S)WQN"CAWPO^>_DK+X6;;'P&G'^9I
+MH"O8GH-K#_.];_;-T`>&MV;+B)L\S#<GE(,TH%;G9W;/%2S77^?V:+6+9U!V
+M8]NMKXGU":T`!M.=J,^,I]O\YW9G8[:*[0(DIFN&N.WDVDY7MQQ7MYMY,3S?
+M&6?NW`8RW+D!!_,V`F@[2VU@_:WQJSYP_+4:/@/0$7"V7]#ES5_EXC\C;N3L
+$@10`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.raw.gz.uu
new file mode 100644
index 0000000..70326d3
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.raw.gz
+M'XL(".?%'50``VEM9RTQ>#$M-3$R+65B<BYR87<N;W5T`*V4S0Z#(`S'[SY%
+M=]W!0`?379?LOLNV,[KY%#S\BO@!(J@)@&A2^LN_MH4Q.P#H65UQ@RX70Q?G
+MHJ?QYC"PZU:!%M>2%QV@I>3P08MQ!\<9((_K.[FX;^YPNV-`*4&I`/@:]:'Q
+M$@A,K>QQ@[Z7_IST"0.4%0@)\@HU[@WX\WBOI4/P7/_/XG`+-PGF>W`7X^6<
+M="LC;M!SF=CWB!,I=81@OT/!RLRU)^J%GYMG8-0E+;!ZL*$/G/(+L[Y;*`.]
+M<!/Z(`Q7&5SEG^<.#C?"!1_7)'.;5G<*U;69DR&7G;&S<PW$[UR+P[P7`?8W
+>"U4@G0KWN$$_2W]:H!B`V?Z@0`,L_F-6J)F4!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.vhd.gz.uu
new file mode 100644
index 0000000..d8b38b0
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.vhd.gz
+M'XL("/0TQ%4``VEM9RTQ>#$M-3$R+65B<BYV:&0N;W5T`*U7P7*D(!"]SU=T
+M:F\Y6-!"8ZZIRGTONSD[CB936YNDDAQR</]]04!!Q8P)RC`Z33_?:YJ68<P>
+M`%0"=4`MD#372@#=@*H`M-$U''KN;J%OGI_:YOW\4;BC/U@PSD*OV-WX8PE"
+M/T0!UN8A=#+7T'N8XL?=P_7Y[X.'0P>'#D@JXU4BT''Q'*%_K2P[@W1_QC\#
+MY.WCR*Y<LIN\]$>=@`G@/!A1>G8:IO@7BQ7:J^N&IH"U0WQ\BVXBPR1V%CO)
+M9EX!S;6@LDGL&AQM>>V!NSZXN;"IHA-#Z9X!<5!HKG7:^#@LFDZ5C[>7^O6M
+MG?'#1*K0R(\O;&5:+KI403_8,1`FG;?DPH#R/H=;295O18]B/^$N=!"8]`8<
+MY,?1FZ`@Y$><;<0\/1E)?O6FKB\(/AYW`R886KAF%%S+29%-DBF8R-/\KD*X
+M4VZYW3Y`*:&N%X"_/+_&>.G:Q.J5/FWH;XOX'/FU!E"73UU])4&%EPJ^O_N]
+M-AUM8O7NCY^%P\_@1L+\$KC2E5(_,LR,M*&?TL1^>SBQQ<XLX7:76)DY]]IJ
+MYA?.,S"]2AI@E;-A##C.+TS\;I8T,)*[P0^6<FL#I^+Q/(##3^1"#'?<G-MM
+M=E=+=DWFR>CF*^/"E6M`XI5KX3!O(<"ALN@,U*.6?=K0_RSBTP*B>W-D>Q6A
+MJWW9&`H'F(VA\,4T'\.2;2;;WBPDQS#3OI[2Y?XK^WH*RGV&?3WY<I_R8KOV
+@]>3*?:9]/?ERGV=?;^"R[NM)_V-C[/`?[N]4)@P.````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdf.gz.uu
new file mode 100644
index 0000000..e70f7b5
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.vhdf.gz
+M'XL("%TEAE4``VEM9RTQ>#$M-3$R+65B<BYV:&1F+F]U=`"ME;%R@S`,AO<\
+MA7+=,G"VL`RLO<N>I>T,!'*Y7MJE0P<>OC;&Q,9`2,_@$.=D??EE288Q<P&H
+MS^Q8-G3)Y.IVAUU/X]73P+:=!1I<K;S4`C5*&B9J,.[@.`/DR_KV+NX<.]SV
+M.2`1E&4`?+/Z4'L)!%;./)<-W6OBWZ,^H8&4@2`@"3EN#?CC^#Z7#L%C[9_!
+MX2/<*)AOP:7:RUGI5L:RH;N7B?FV.+&F3B%8\U2P%+GV1#[Q<_,,3'5)#2P?
+M;.@#Q_S"75\1RD`OW!5]$(9;:ESFK^<.#A^$"SZN6LWMNKI]J*Z.G`R:=L;&
+MSM40OW,-#N,>!-B?+*H"U:KPN6SH3HE_&Z`8@-%VD(97D4Q!MB`;D*3GF0!9
+M0):[0/0KJ:N_OYKZY_KK9ECC^/CF"(?VQU1WB\P`2_TG\JSGCKZ7X^5PO5TL
+MSAY5]D12S::\4@19!>'2I-FN^-DC3W=U:;A)Y.Y>(8$)X-P+?%!W\LN9^G/>
+G!MNT4(E^?^SP?GB&V:-*XXA-O/Z;6X.3D4M%U=[N#X:PW+*_"```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-ebr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-ebr.vmdk.gz.uu
new file mode 100644
index 0000000..9ad3787
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-ebr.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-512-ebr.vmdk.gz
+M'XL(".C%'50``VEM9RTQ>#$M-3$R+65B<BYV;61K+F]U=`"M7%V/W,81?/>O
+MH*67(`\+UI)<D@\"$N<<(`@"&)9COX:?T2&V))P.00SLCP^'G)HKWFHTM*]/
+M/)$M=O=.]W#K3M6%S?/M*\O*/BO+K!RSZI+ER)9_VHXL+YZ,Y3@WO'']^]T_
+M?CSQZP^GT_6K+1E<E(0@UW1B[%[G>GKVQ73G+T7M;BS'.9FN<%']3:!/=X[<
+MB*8KEYOGSX5P==UZ>W07DBX+B;)=NNHS-46+_=+J_OB5;YY;7^'6L&SOI<WJ
+M(KOTWLPNU6H767U>[^59O3C-2\+7V=W]I_]D=].GX>'^X^,'O[ZSV]O%N;PX
+M_\O@,BR%U1=WX6ZX=*U+<9FR8LP*N-O9]>&O]S]/I_].#Y_N/[Q_`Y9[=GM;
+M%EG9NN4X__SIV!GN1?+L`O<:V?4O?[M[XY_<_/2Q>V`Z%[4L9'GMI0[->[ED
+M[OOV6%<WO7]T&6?_%5;G]M8WIUI?NW0759G5;;8NIW*YS\OMT9>\]FYXF+K'
+MZ8=?/TYO7OWRX7WHG=M;U[)V3=2LC2JRJG"I?&FN?97+Z!Z;==>RZ\_WC^_N
+MA[=+F9^F5Z?7&=-=7.^6#6S\NK:JEY!+=&>795^__=_C4F\V^IV]9[IU$6L1
+MRVM7YZRJ7:YE`]>M.&=%Z:Z6?UH6O%12PCEEUP_O3]__M+S%7;/>?O?G[YFN
+M6:(6SV6!2\A2T*ZF:JN_>OY89M>WWV:O7)$_O)O6)Y#IVNUMYIRW?<!JGMV%
+M[]J6WH%8Z6ZL.YO==8]=]DWW:3J]OKO[)NQLYXHMUV-9VN2R7+;4[OE>V[DT
+M;MOI;:/7K1C'_M2-W<?'Z<%M;]B*WK5H])6Z;2V?MG'_.O6Z4[-[8K+KF^S5
+M_;CLJ4O[[^G#+TPW;(_QL@[W2+1K8.$NEJ=G33_Y5]B>&+=-+MWT^/#K:?CU
+MY_OWX_)&R]XPW;CU;EG.MIM/F[ELX++"SRYPZ=VK=5?#\IAN<JL;;Q:X[J=O
+M9%A4>-GL^LNZO'=3-RY+6W(SW>Q6=_[\.GRGGKW4DCV[/G5MS?O)IRMR#P&%
+MA[)=B\)RMA<4`)V&QP\/V\)>"1X7SW^6O12/RYL?J?7O3+BELU[?)7_V\ZS0
+MN%*,:I?0_13+E^\_+=_?/:WOXM9W$<]:HQHQVEVZ?RTI/MZ6>W'OPDX\>XT:
+MQ!B/=._BH&T2S_EY]_BK!N0ZGHZ_"]"ST*A2C&J7+M:[RO>.GK5&-6*TNW2Q
+MWEU\[^C9:]0@QGBHV-KWCIZS1KD3?Y5"?N#7LDOC>T?/0J-*,:I=NECO6M\[
+M>M8:U8C1[M+%>M?YWM&SUZA!C/%0L;WO'3UGC7(G`@3D.IYN\+VC9Z%1I1C5
+M+EVL=Z/O'3UKC6K$:'?I8KV;?._HV6O4(,9XJ-C9]XZ>LT:Y4RF]*U/IZMSW
+MCIZ%1I5B5+MTD=[5Q#MZUAK5B-'NTD5Z5Q/OZ-EKU"#&>*A8XAT]9XURITIZ
+M5R73$>_H66A4*4:U2Q?K'?&.GK5&-6*TNW2QWA'OZ-EKU"#&>*A8XAT]9XUR
+MIXOT[I),1[RC9Z%1I1C5+EVL=\0[>M8:U8C1[M+%>D>\HV>O48,8XZ%BB7?T
+MG#7*G?A+$.0ZGHYX1\]"HTHQJEVZ6.^(=_2L-:H1H]VEB_6.>$?/7J,&,<9#
+MQ1+OZ#EKE#N1D(%<1],UN>\=/0N-*L6H=NDBO6N(=_2L-:H1H]VEB_2N(=[1
+ML]>H08SQ4+'$.WK.&N5.K?2N3:8CWM&ST*A2C&J7+M8[XAT]:XUJQ&AWZ6*]
+M(][1L]>H08SQ4+'$.WK.&N5._/\3Y#J>CGA'ST*C2C&J7;I8[XAW]*PUJA&C
+MW:6+]8YX1\]>HP8QQD/%$N_H.6N4.Y%_A%S'TQ'OZ%EH5"E&M4L7ZQWQCIZU
+M1C5BM+MTL=X1[^C9:]0@QGBH6.(=/6>-<J=!>C>DTK6Y[QT]"XTJQ:AVZ2*]
+M:XEW]*PUJA&CW:6+]*XEWM&SUZA!C/%0L<0[>LX:Y4ZC]&Y,IB/>T;/0J%*,
+M:I<NUCOB'3UKC6K$:'?I8KTCWM&SUZA!C/%0L<0[>LX:Y4Z3]&Y*IB/>T;/0
+MJ%*,:I<NUCOB'3UKC6K$:'?I8KTCWM&SUZA!C/%0L<0[>LX:Y4ZS]&Y.IB/>
+MT;/0J%*,:I<NUCOB'3UKC6K$:'?I8KTCWM&SUZA!C/%0L<0[>LX:E<OT#'(=
+M3=?E6^^"9Z%1I1C5+EVD=YW'N^!9:U0C1KM+%^E=Y_$N>/8:-8@Q'BK6XUWP
+MG#7*M4SX.R0IK<[C'82_@_)W$/X.2?ZN\W@'X>^@_!V$OT.2O^L\WD'X.RA_
+M!^'O#A3K\0["WT'Y.PA_AR2EU7F\@_!W4/X.PM\AR=]U'N\@_!V4OX/P=TCR
+M=YW'.PA_!^7O(/S=@6(]WD'X.RA_!^'OD*2T.H]W$/X.RM]!^#LD^;O.XQV$
+MOX/R=Q#^#DG^KO-X!^'OH/P=A+\[4*S'.PA_!^7O(/P=DI16G_O>"7\'Y>\@
+M_!V2_%U/O!/^#LK?0?@[)/F[GG@G_!V4OX/P=P>*)=X)?P?E[R#\'9*45D^\
+M$_X.RM]!^#LD^;N>>"?\'92_@_!W2/)W/?%.^#LH?P?A[PX42[P3_@[*WT'X
+M.R0IK9YX)_P=E+^#\'=(\G<]\4[X.RA_!^'OD.3O>N*=\'=0_@["WQTHEG@G
+M_!V4OX/P=TA26CWQ3O@[*'\'X>^0Y.]ZXIWP=U#^#L+?(<G?]<0[X>^@_!V$
+MOSM0+/%.^#LH?P?A[Y"DM(;<]T[X.RA_!^'OD.3O!N*=\'=0_@["WR')WPW$
+M.^'OH/P=A+\[4"SQ3O@[*'\'X>^0I+0&XIWP=U#^#L+?(<G?#<0[X>^@_!V$
+MOT.2OQN(=\+?0?D["']WH%CBG?!W4/X.PM\A26D-Q#OA[Z#\'82_0Y*_&XAW
+MPM]!^3L(?X<D?S<0[X2_@_)W$/[N0+'$.^'OH/P=A+]#DM(:B'?"WT'Y.PA_
+MAR1_-Q#OA+^#\G<0_@Y)_FX@W@E_!^7O(/S=@6*)=\+?0?D["'^')*4UYKYW
+MPM]!^3L(?X<D?S<2[X2_@_)W$/X.2?YN)-X)?P?E[R#\W8%BB7?"WT'Y.PA_
+MAR2E-1+OA+^#\G<0_@Y)_FXDW@E_!^7O(/P=DOS=2+P3_@[*WT'XNP/%$N^$
+MOX/R=Q#^#DE*:R3>"7\'Y>\@_!V2_-U(O!/^#LK?0?@[)/F[D7@G_!V4OX/P
+M=P>*)=X)?P?E[R#\'9*4UDB\$_X.RM]!^#LD^;N1>"?\'92_@_!W2/)W(_%.
+M^#LH?P?A[PX42[P3_@[*WP4Q'>1:TF7;MT\WY5OO@F>A47G^^6/IW9(BSVY6
+M-QGK`['J`\-,8:OJ]R7<TEFO+\RWI7]/<;]5OX@PW^;Q(OTBPGR;QXOTBPCS
+M;1XOTB\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_
+MB##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$
+MOX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;
+M1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+X+S;1O](CC?MM$O@O-M
+M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;
+M_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O]
+M(CC?MM$O@O-M&_TB.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O@O-M&_TB
+M.-^VT2^"\VT;_2(XW[;1+X+S;1O](CC?MM$O(LRWZ?DB_2+"?)N>+](O(LRW
+MZ?DB_2+"?)N>+](O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3
+M_2+"?-M$OX@PWS;1+R+,MTWTBPCS;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M
+M$_TBPGS;1+^(,-\VT2\BS+=-](L(\VT3_2+"?-M$OX@PWS;1+R+,MTWTBPCS
+M;1/](L)\VT2_B##?-M$O(LRW3?2+"/-M$_TBPGS;1+^(,-\VT2^"\VT;_2(F
+M4_TB)E/](B93_2(F4_TB)E/](B93_2(F4_TB)E/](B93_2(F4_TB)E/](B93
+M_2(F4_TB)E/](B93_2+F/#?4+V(VU2]B-M4O8C;5+V(VU2]B-M4O8C;5+V(V
+MU2]B-M4O8C;5+V(VU2]B-M4O8C;5+V(VU2]B-M4O8C;5+Y[S/#?4+YYO/DMX
+M%Q5/=UOLI@\LT?_FA/,<[5X)]Z@L#LO15?YB.38AF?0-\?5]K>E&ZW+GWY:P
+MJK*NNTGX3ZYO_33A[;-5;_^.W[A^<]K_">M;/PZSJMW'Q%:7K#D?+?BG;W]\
+M5O"6SNQQV=+=?/3T\W1AP0<^R;HLUX^>%D]],N(WKD^/R79FNO)+J],IS[%B
+MC3]ZNBR;9W&ZS^N,8'A2,SQ#EK"_V=/ZVMMEG'?E?F%]-\A2ENY'D'[XJN[B
+M#NLBY6;[=/T7]_;+J_OZ=G6#\694S]\9!]^Y+LG^G;NE.]L"P65%EDTZ<?MW
+=_,;UN]/^SY:P]`G-.EBZ#T[+O_H__903[2]?````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu
new file mode 100644
index 0000000..93e4a77
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu
@@ -0,0 +1,132 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.qcow.gz
+M'XL("*,S(E0``VEM9RTQ>#$M-3$R+6=P="YQ8V]W+F]U=`"MG<MN7-F11>?U
+M%5=OB9*HC(C[U-MNM`'/RH9[UH.ZKQQU&]ES?7PSR?,@(_=6V!!51$$%X6YD
+M'BTNJE2KC@Z'NV]-TTG3]DT[-<>EN?GG]"'-O7]X^-'\^-M?_GI]_]N/W^[&
+MY/"3I]P_M]I(FGNP]><ZI^>GUN8P_0MS-Q]P[MZKLW_CU=U[LY=S5[_=O5G\
+MG+)!>S#8I+E#>GU"3J_]UU[?=_=VY>[T'N_M*GF['1OL'PS^GN;^2*]/R=L=
+MV-SX8.[DWJZ2MSNQN?FGL"B!96%S:S#7PJ<V-K<'<QU\ZHCGY"<_MW=S/7Q*
+MV)S"N:;,#?`I8W/M@[G#=08ZSXWP*<*=A-Q-\"G"G83<S?`IPIV$W"WP*<*=
+MA-RM\"G"G83<;?`IPIV&W.WP*<*=AMP=X5.$.XVX$_P4X4XC[@3Y3AEW&G$G
+MR'?*N-.(.T&^4\:=1MP)\ITR[C3B3I#OE'%G$7>"?&>,.XNX$^0[8]Q9R!WR
+MG3'N+.0.^<X8=Q9RAWQGC#L+N4.^,\:=A=PAWQGCSD+ND.^,<=>&W"'?M8R[
+M-N0.^:YEW+41=XJ?(MRU$7>*?-<R[MJ(.T6^:QEW;<2=(M^UC+LVXDZ1[UK&
+M71MQI\AW+>.NB[A3Y+N.<==%W"GR7<>XZT+ND.\ZQET7<H=\US'NNI`[Y+N.
+M<=>%W"'?=8R[+N0.^:YCW'4A=\AW'>.N#[E#ONL9=WW('?)=S[CK(^X,/T6X
+MZR/N#/FN9]SU$7>&?-<S[OJ(.T.^ZQEW?<2=(=_UC+L^XLZ0[WK&W1!Q9\AW
+M`^-NB+@SY+N!<3>$W"'?#8R[(>0.^6Y@W`TA=\AW`^-N"+E#OAL8=T/('?+=
+MP+@;0NZ0[P;&W1ARAWPW,N[&D#ODNY%Q-T;<M?@IPMT8<=<BWXV,NS'BKD6^
+M&QEW8\1=BWPW,N[&B+L6^6YDW(T1=RWRW<BXR[_]S>>0[R;&W11QUR+?38R[
+M*>0.^6YBW$TA=\AW$^-N"KE#OIL8=U/('?+=Q+B;0NZ0[R;&W11RAWPW,>[F
+MD#ODNYEQ-X?<(=_-C+LYXJ[#3Q'NYHB[#OEN9MS-$7<=\MW,N)LC[CKDNYEQ
+M-T?<=<AW,^-NCKCKD.]FQEW^SY!\#OEN8=PM$7<=\MW"N%M"[I#O%L;=$G*'
+M?+<P[I:0.^2[A7&WA-PAWRV,NR7D#OEN8=PM(7?(=POC;@VY0[Y;&7=KR!WR
+MW<JX6R/N>OP4X6Z-N.N1[U;&W1IQUR/?K8R[->*N1[Y;&7=KQ%V/?+<R[M:(
+MNQ[Y;F7<;1%W/?+=QKC;(NYZY+N-<;>%W"'?;8R[+>0.^6YCW&TA=\AW&^-N
+M"[E#OML8=UO('?+=QKC;0NZ0[S;&W1YRAWRW,^[VD#ODNYUQMT?<#?@IPMT>
+M<3<@W^V,NSWB;D"^VQEW>\3=@'RW,^[VB+L!^6YGW.T1=P/RW<ZX.T;<#<AW
+M1\;=,>)N0+X[,NZ.(7?(=T?&W3'D#OGNR+@[AMPAWQT9=\>0.^2[(^/N&'*'
+M?'=DW!U#[I#OCH0[R=_A<\!W<B#<R2'D#OA.#H0[.43<C?@IS)V$_=T(?">L
+MOY.POQN![X3U=Q+V=R/PG;#^3L+^;@2^$];?2=C?C<!WPOH["?N[$?A.6'\G
+M87\W`M\)Z^\D[.]&X#MA_9V$_=T(?">LOY.POQN![X3U=Q+V=R/PG;#^3L+^
+M;@2^$];?2=C?C<!WPOH["?N[$?F.]7<2]G<C\AWK[R3L[R;\%.$N[.\FY#O6
+MWTG8WTW(=ZR_D["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N[
+M"?F.]7<2]G<3\AWK[R3L[R;D.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^
+M3L+^;D*^8_V=A/W=A'S'^CL)^[L)^8[U=Q+V=S-^BG`7]G<S\AWK[R3L[V;D
+M.];?2=C?S<AWK+^3L+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)
+M^[L9^8[U=Q+V=S/R'>OO).SO9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?
+ML?Y.POYN1KYC_9V$_=V,?,?Z.PG[NP4_1;@+^[L%^8[U=Q+V=POR'>OO).SO
+M%N0[UM])V-\MR'>LOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z
+M.PG[NP7YCO5W$O9W"_(=Z^\D[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W
+M(-^Q_D["_FY!OF/]G83]W8J?(MR%_=V*?,?Z.PG[NQ7YCO5W$O9W*_(=Z^\D
+M[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\
+MQ_H["?N[%?F.]7<2]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A
+M?[<BW['^3L+^;L-/$>["_FY#OF/]G83]W89\Q_H["?N[#?F.]7<2]G<;\AWK
+M[R3L[S;D.];?2=C?;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=
+MAGS'^CL)^[L-^8[U=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_
+M)V%_M^.G"'=A?[<CW['^3L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V=SOR
+M'>OO).SO=N0[UM])V-_MR'>LOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$
+M_=V.?,?Z.PG[NQWYCO5W$O9W._(=Z^\D[.]VY#O6WTG8W^W(=ZR_D["_.^*G
+M"'=A?W=$OF/]G83]W1'YCO5W$O9W1^0[UM])V-\=D>]8?R=A?W=$OF/]G83]
+MW1'YCO5W$O9W1^0[UM])V-\=D>]8?R=A?W=$OF/]G83]W1'YCO5W$O9W1^0[
+MUM])V-\=D>]8?R=A?W=$OF/]G>;ON+FFS@'?W3R%N5/7W^7[])K*'?"=LOY.
+M77_7).Z:S)T=\%.8.W7]79.X:_XH<\!WROH[=?U=<W)G9^C^.V7]G;K^KIQ=
+MG0.^4];?J>OOP!SPG;+^3EU_!^:`[Y3U=^KZNSSWI,X!WRGK[]3U=T_R7%/F
+M@.^4]7?J^KLGB;LGE3O@.V7]G;K^[DGB[DGE#OA.67^GKK][<KHX.^`[9?V=
+MNOZNG%V=`[Y3UM^IZ^_`'/"=LOY.77\'YH#OE/5WZOJ[//>TSB'?L?Y.77_W
+M-,]5[I#O6'^GKK][FKA[6KA#]]\IZ^_4]7=/$W=/"W?H_CME_9VZ_N[IR9\=
+MNO].67^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<LSJ'?,?Z
+M.W7]W;,\5[A#]]\IZ^_4]7?/$G?/*G?(=ZR_4]??/4O</:O<(=^Q_DY=?_?L
+M='%VR'>LOU/7WY6SJW/(=ZR_4]??@3GD.];?J>OOP!SR'>OOU/5W>>YYG4.^
+M8_V=NO[N>9ZKW"'?L?Y.77_W/''WO'"'[K]3UM^IZ^^>)^Z>%^[0_7?*^CMU
+M_=WSDS\[=/^=LOY.77]7SJ[.(=^Q_DY=?P?FD.]8?Z>NOP-SR'>LOU/7W^6Y
+M%W4.^8[U=^KZNQ=YKG"'[K]3UM^IZ^]>).Y>5.Z0[UA_IZZ_>Y&X>U&Y0[YC
+M_9VZ_N[%Z>+LD.]8?Z>NORMG5^>0[UA_IZZ_`W/(=ZR_4]??@3GD.];?J>OO
+M\MS+.H=\Q_H[=?W=RSQ7N4.^8_V=NO[N9>+N9>$.W7^GK+]3U]^]3-R]+-RA
+M^^^4]7?J^KN7)W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?FD.]8
+M?Z>NO\MSK^H<\AWK[]3U=Z_R7.$.W7^GK+]3U]^]2MR]JMPAW['^3EU_]RIQ
+M]ZIRAWS'^CMU_=VKT\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(
+M=ZR_4]??Y;G7=0[YCO5WZOJ[UWFN<H=\Q_H[=?W=Z\3=Z\(=NO].67^GKK][
+MG;A[7;A#]]\IZ^_4]7>O3_[LT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC_9VZ
+M_@[,(=^Q_DY=?Y?GWM0YY#O6WZGK[][DN<(=NO].67^GKK][D[A[4[E#OF/]
+MG;K^[DWB[DWE#OF.]7?J^KLWIXNS0[YC_9VZ_JZ<79U#OF/]G;K^#LPAW['^
+M3EU_!^:0[UA_IZZ_RW-7=0[YCO5WZOJ[JSQ7N4.^8_V=NO[N*G%W5;A#]]\I
+MZ^_4]7=7B;NKPAVZ_TY9?Z>NO[LZ^;-#]]\IZ^_4]7?E[.H<\AWK[]3U=V`.
+M^8[U=^KZ.S"'?,?Z.W7]79Y[6^>0[UA_IZZ_>YOG"G?H_CME_9VZ_NYMXNYM
+MY0[YCO5WZOJ[MXF[MY4[Y#O6WZGK[]Z>+LX.^8[U=^KZNW)V=0[YCO5WZOH[
+M,(=\Q_H[=?T=F$.^8_V=NOXNS[VK<\AWK+]3U]^]RW.5.^0[UM^IZ^_>)>[>
+M%>[0_7?*^CMU_=V[Q-V[PAVZ_TY9?Z>NOWMW\F>'[K]3UM^IZ^_*V=4YY#O6
+MWZGK[\`<\AWK[]3U=V`.^8[U=^KZNSSWOLXAW['^3EU_]S[/%>[0_7?*^CMU
+M_=W[Q-W[RAWR'>OOU/5W[Q-W[RMWR'>LOU/7W[T_79P=\AWK[]3U=^7LZASR
+M'>OOU/5W8`[YCO5WZOH[,(=\Q_H[=?U=GKNN<\AWK+_3J+\S=/^=LOY.H_[.
+MT/UWROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.XWZ
+M.T/WWRGK[Y3T=Q_J'/(=Z^_4]7<?\ESA#MU_IZR_4]???4C<?:C<(=^Q_DY=
+M?_<A<?>A<H=\Q_H[=?W=A]/%V2'?L?Y.77]7SJ[.(=^Q_DY=?P?FD.]8?Z>N
+MOP-SR'>LO[/\'3=WJ'/`=\;ZNYL?>,!=]M.A<@=\9ZR_,]??'=+>H7"'[K\S
+MUM^9Z^\.B;M#X0[=?V>LOS/7WQU._NS0_7?&^CMS_5TYNSH'?&>LOS/7WX$Y
+MX#MC_9VY_@[,`=\9Z^_,]7=Y3NH<\)VQ_LY<?R=YKG"'[K\SUM^9Z^\DO3RI
+MW`'?&>OOS/5WDKB3RAWPG;'^SEQ_)Z>+LP.^,];?F>OORMG5.>`[8_V=N?X.
+MS`'?&>OOS/5W8`[XSEA_9ZZ_RW-:YY#O6']GKK_3/%>Y0[YC_9VY_DX3=UJX
+M0_??&>OOS/5WFKC3PAVZ_\Y8?V>NO].3/SMT_YVQ_LY<?U?.KLXAW['^SEQ_
+M!^:0[UA_9ZZ_`W/(=ZR_,]??Y3FK<\AWK+\SU]]9GBO<H?OOC/5WYOH[2]Q9
+MY0[YCO5WYOH[2]Q9Y0[YCO5WYOH[.UV<'?(=Z^_,]7?E[.H<\AWK[\SU=V`.
+M^8[U=^;Z.S"'?,?Z.W/]79YKZQSR'>OOS/5W;9ZKW"'?L?[.7'_7)N[:PAVZ
+M_\Y8?V>NOVL3=VWA#MU_9ZR_,]??M2=_=NC^.V/]G;G^KIQ=G4.^8_V=N?X.
+MS"'?L?[.7'\'YI#O6']GKK_+<UV=0[YC_9VY_J[+<X4[=/^=L?[.7'_7)>ZZ
+MRAWR'>OOS/5W7>*NJ]PAW['^SEQ_UYTNS@[YCO5WYOJ[<G9U#OF.]7?F^CLP
+MAWS'^CMS_1V80[YC_9VY_B[/]74.^8[U=^;ZNS[/5>Z0[UA_9ZZ_ZQ-W?>$.
+MW7]GK+\SU]_UB;N^<(?NOS/6WYGK[_J3/SMT_YVQ_LY<?U?.KLXAW['^SEQ_
+M!^:0[UA_9ZZ_`W/(=ZR_,]??Y;FASB'?L?[.7'\WY+G"';K_SEA_9ZZ_&Q)W
+M0^4.^8[U=^;ZNR%Q-U3ND.]8?V>NOQM.%V>'?,?Z.W/]73F[.H=\Q_H[<_T=
+MF$.^8_V=N?X.S"'?L?[.7'^7Y\8ZAWS'^CMS_=V8YRIWR'>LOS/7WXV)N[%P
+MA^Z_,];?F>OOQL3=6+A#]]\9Z^_,]7?CR9\=NO_.6']GKK\K9U?GD.]8?V>N
+MOP-SR'>LOS/7WX$YY#O6WYGK[_+<5.>0[UA_9ZZ_F_)<X0[=?V>LOS/7WTV)
+MNZERAWS'^CMS_=V4N)LJ=\AWK+\SU]]-IXNS0[YC_9VY_JZ<79U#OF/]G;G^
+M#LPAW['^SEQ_!^:0[UA_9ZZ_RW,?ZQSR'>OOS/5W'_-<Y0[YCO5WYOJ[CXF[
+MCX4[=/^=L?[.7'_W,7'WL7"'[K\SUM^9Z^\^GOS9H?OOC/5WYOJ[<G9U#OF.
+M]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:ISR'>LOS/7WWW*<X4[=/^=L?[.
+M7'_W*7'WJ7*'?,?Z.W/]W:?$W:?*'?(=Z^_,]7>?3A=GAWS'^CMS_5TYNSJ'
+M?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^<^USGD.];?F>OO/N>YRAWR'>OO
+MS/5WGQ-WGPMWZ/X[8_V=N?[N<^+N<^$.W7]GK+\SU]]]/OFS0_??&>OOS/5W
+MY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^U+GD.]8?V>NO_N2YPIW
+MZ/X[8_V=N?[N2^+N2^4.^8[U=^;ZNR^)NR^5.^0[UM^9Z^^^G"[.#OF.]7?F
+M^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L]]K7/(=ZR_,]???<US
+ME3OD.];?F>OOOB;NOA;NT/UWQOH[<_W=U\3=U\(=NO_.6']GKK_[>O)GA^Z_
+M,];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\]ZW.(=^Q_LY<
+M?_<MSQ7NT/UWQOH[<_W=M\3=M\H=\AWK[\SU=]\2=]\J=\AWK+\SU]]].UV<
+M'?(=Z^_,]7?E[.H<\AWK[\SU=V`.^8[U=^;Z.S"'?,?ZNS9_Q\U]KW/`=RWK
+M[UK7WWW/<Y4[X+N;IS!WK>OOOB?NOF?NV@-^BORYQ^[-?L^]\7690W_>=GDJ
+MF+OW[<=O5W>#Z+ZJMF2`T>O[P[\^=%_5K[R^[O;\6FT.,_@[_X$??[Y^^%<9
+MO+T[Z-\8S*_PX5Q^P]W=W4&WT=1^X\YC^CC(_3<\UNOTP!M^<GUO#OW9S+]R
+M?NBZGY\-=ETSSQ>#_Y5?W^UU/VW7M'W33NDBQU::3INN+7.W[[5;[[^^__S+
+M7YO?__3W?YS'_KN^W=OK?G9MAO7V#Q_8W*L3^G9_^+=[-W?[Y7OPIYWGC,X]
+MP7.W7[Z[G\RA#S[7_NRI@])7=_%S>S?7'1X^-=Y_:NR:49O^YM^&9CKW/P_F
+MT!\?_RODW=X<L/3GG]O^YA=XTJS'\W>V_OR'[S;CS:?)W7^:T=O_EVEJ!CG_
+M7W;GG]M__NWZGW=C[Z__[VUZ?7<W!PC^X#_`3N_NY@!&Q"%GB_SM-@_GP*_T
+M?NWTSK]>6;I'.[TIP8(^^`_0TYOO3@\?TOE%P4^9'_>O$;T_!WZ]\DNG=_M_
+M-9Z_QL[@[_P'?OQ^_?"ON\$V#3[:*VP/_?J(GQWGN4?\[#C//>)GQWGN43\[
+MSH./^-EQGGO$SX[SW"-^=ISG'O6SXV;P]O<<'^F+^'GNS%YKS;PVZ]#T_HLX
+M^W+\XS^NK_\7O-V[WW-D7_I_\D4<_V3LC_A%_#SW\R_B/?VYS=_<FWW$+^+G
+4N4?](MX>AAN9_O;_@'C+'O6L````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu
new file mode 100644
index 0000000..7528fc4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu
@@ -0,0 +1,26 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.qcow2.gz
+M'XL(")4[(U0``VEM9RTQ>#$M-3$R+6=P="YQ8V]W,BYO=70`K9A+;YPP$(#O
+M^15.WTT:BL<VC[Z3-"OE4B55>VL/+(]3%:EWVM]>C`T&,P/)UKMHE<B:3V/S
+MS=@0Q^;#F.),)DSFK-FS[G][`9O\,[]8>[N[CJ:?]LC`>$Q$(0-2C+@9Z]+A
+M@,+%?#G`<=PD.X'@8(A:@K9PDLQN;0#!G1SU2]??C,R+$(<`#8Z\&0?E!R8_
+M/T(>F!^$SD_@ZZ>&.'\@6<]/F/S\J)3"99LX0*)R"E=LX@02M:=PY29.(E$5
+MA:LW<0J):@@<WU"EPR5(%*=PL(E+D2A!X>0F+D.B*._XMG<Y$D5YQ[>]*Y`H
+MRCN^[=T>B:*\X]O>E4@4Y1W?]JY"HBCO@/"..5R-1%'>@>?=L<4]<K@&B:*\
+M`\^[QQ;W9,1Q+(KR#CSOGEK<,X=#^AU0WH'GW7.+>^%P2+\#RCOPO'MI<2<.
+MA_0[H+P#S[M3BWOE<$B_`\H[\+P[6WC'D7X'E'?"\^ZU9<4.A_0[07DG/.^X
+MQ8'#(?U.4-X)SSMA<=+AD'XG*.^$YYVRN,3AD'XG*.^$YUUJ<9G#(?U.4-X)
+MS[O<XMXX'-+O!.6=\+Q[:W'O'`[I=X+R3GC>O;>X#PZ']#M!>2<][SY:W">'
+M0_J=I+R3GG?G%G?A<$B_DY1WTO/NTN(^CSC`HD;OXAB_+.YJ4;.`]#N9W!.W
+M6^+HAY5#CK/2';<Y\DL/K`"SAP/)O5::<TJX"2LS86U5@?S2`^U%-/^.P+YV
+M'P`<,ISC[(25J5WSP%C7K&GL95;*!F>3`P(RX>-H@JL"KU]?;@\`*L6*8@'\
+M/N37EUM77^;=0&>WZIN!`J;DB.OGJLII?E>[:W9S_O6;AOUPT^W+3>-J_;!4
+M)%YVG)KNU1?$/F7*+6W\U1YP@L*-QS(/IX\7:;6"PR[6_B%P<BUJ?.EPCWMK
+M<"J>1TW;%LL4RX`E):L*$O=KADL"FR?U\#YA:<F26K]/*AO]1Y7HIS26=65B
+MMFWHSU@Y2[D^NW7`]NXVNC.PL^CWJ<U/<FL$=M$#U.I)6#-")[4Q73;'8:^1
+M_FOU=%_>JV"KEUM9L(L>(%>O,*N'+Y)."BV9=EBUH>`&W#[PZB5ZN*N/KG\O
+M?^F!]B::?PU06F"P#&72E`&K0^,"5H?&!:P.C0M:'1H8L#HT+F!U:%S`ZM"X
+MH-71`>LXW":N<=J]/&.J8KED335/@]R.V^@G.MT:UK;^E4T<OQEUP$U<XU8W
+?\;0F)VL_?[W)!MS$-2[H)BY3??P^^@=.=Z`2%1H`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu
new file mode 100644
index 0000000..98d9945
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.raw.gz
+M'XL(".C%'50``VEM9RTQ>#$M-3$R+6=P="YR87<N;W5T`*V534_#,`R&[_L5
+MWA5$E*1)FIWXD$#B-A#<N/1C/:%)W,M_)VX:UG9Q89+3J*KD^JGM^*VEC`O`
+M:)!5YDX;^@<QO_K-U6:@J?HR8/@^AK``B@",N"88I<9W#@?HNG%+-7A%9VE!
+MJ_0\XL1I;<4$UYZ\SC9MF.)$Q*5TN\N`UD)5G0'?4WQZ.`X+QH'9@0[O2S`*
+MK`9K?G%#KK:9QO?X]`S[^]<WA'V<TM4J&%4#1D)30MLMHE-DNG?+="-.HY=9
+M5COA"A*WS>.*>+8T+K=IG%GSBCWTO[.-."OG7G[JY2UX#:Z!MB)QGS.<8^X\
+M@^;:0=F`.X!5T'3XT#I0*L079.('2*AO"W('I0)=([`_OHACA-V(K^LQ/J/&
+MCLAMVD!5S^BUCL"@_D@7YKB"NWH>JV?9JK<;FR6W:0-9O2I6+U\D4C)]JEI2
+M2,+5S-5S:`[Z"/_O\SMMZ/=B?D6@&8%L$8;F<XSJ0!RC.A#'J`[$L:H#@8SJ
+M0!RC.A#'J`[$L:HC`+WD&^*(&X:X@;*%MH!B.<2I<=R+;W&;2=?KM=&_,L3S
+CA^$9ASCBUH=X02:;UB)9QB&..-8A'H"5E)L?B^NWCH@+````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu
new file mode 100644
index 0000000..81f18cb
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.vhd.gz
+M'XL("/<TQ%4``VEM9RTQ>#$M-3$R+6=P="YV:&0N;W5T`*V82W/3,!"`[_T5
+MF^%6!H_>=F[0F3)P*PP,%RY^I62`\&@//9C_CE:6;,NV#&G743U)E/V\+ZVV
+M8JR_`(P$<P#3@M'X/E=@]I`7`';2#^'NW'^$KOYQ:NO[XT/FK^ZBAW$VE8K%
+M45Y(4/8A.8@2'V(:?`]=P&3/KF\OC]]O`TYXG/`@G:.4%&"JQ7.4_;;HM4/2
+MIZ/XZI!77P;MY%*[4<K^Y0TP!9Q/?B&#=A:3_8F-55;J<'##0-.B[#"B#]'$
+M:.S,=YK-I"9JKCF5C<:NX<R6U#FXRPL?BSY5;&+D]L[`<,@%OK=I$_RP&#95
+M'NY^EK_OVIE^(I$J9M"/+^9DVESA4T6$'WL-%*;SEKG@*/=SW$JJ/,E[)I8+
+MT;5.8#I,"&=^[+T1!5/]#&<;/D\'(ZE?B?K9Q<#*E7MZHKO*XM<`K*KS@,&#
+M,6XPN*K1?ZX.M.UH49\D7E@J$#P9$+6;^*]JB.-;'<X#:@UEN0!^#/K5+AP:
+ME`&UQ\2PQ4%QT`+TF,[.5EU/];M^_19N7KW_@+#/H[FU2Y<&5('%DQ]FVBU7
+M6C#WC5A;;#4N-BGGW@XXF<+)W>K:K7&Q2;Z!6QO0\01.;4D->\E_Q+;':19+
+M%5.I0D-AMY`:FC*)^Q;AJ.MRB].5@;S&+5QSJ-U>WAC<R*"PR\3M;]8"8;<W
+MN[%;1U<([$[OLE,/>Y']>N[U:[G/B+61GDAYKQ5;&8%*_<-<B''4=;DMT'N:
+MS'M[GRQK(SV1]%[9>V_=2:C4ZI()NUJ6[6)<1>L][MI'NSYL_5[>TQ/=31:_
+M>J#PVQ#9OB9\(2734'D@F8;*KU]"#;G:#.:Y458B%X05!G&$%09QA!4&<:05
+M!H&$%09QA!4&<805!G&D%<8"73(3-4*(\WVS]7-E_Q6=J9%L:5"_EXB2L;E*
+M;+5/Z48H$0Q%V`@A;K,1DNG8^DO,C"5LA!!'V@@97TB)SC),:(26.CSF+,.$
+H1HB-#GS"6899;X0>>Y:!.,*S#,01GF4@CCA5L&^Y^`N^QF[[`!,`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu
new file mode 100644
index 0000000..f59ec14
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.vhdf.gz
+M'XL("&$EAE4``VEM9RTQ>#$M-3$R+6=P="YV:&1F+F]U=`"ME\V.U#`,@._S
+M%$9[6+1HJR9-TO8(TB)Q&V#17KCT)UF-@$%('#C,PV,GZ3:92;HL2FM5&;G^
+M:CMVW:EK=P`(#O60N.85IW=5?)YV-SM+8^/+@/A\<N$,6"'0X294UISNT1J,
+M\5(S:^6,47BWKBVN6H_758";0ZLSR2M"7.5P2[CF94`I81@N@%\6_[C=#@E"
+M@>B!X_TU"`:2@Q1/.!N[G$+_[MY_@/W;3_<$^[J&RQDJS03]#+HE1.P=VPCW
+M/@[7X3CA#/`V&6R3Q5V?9\_A&L+-&[B4Y'%BR\K5T+_MK</).K;J0JM.0L=!
+M33`/6=SW"*<*5YX@]:B@G4!ID`PF0XM9`6/H'[:)ZPD.?(:ZAY8!'PEX.GZL
+MC@YV6_UZX_T3S%=$2O**7/8$WZH(<NJ9<"'&-:6SUU'V9+'L];Y84I)79+,W
+MN.REDT1.I5H7<3YKU:L8-Q;.GB(U]@>^OR^O><5I7\6G`PH/+.:A,&8JV!V$
+M*]@=A"O8'80KVAT$+-@=A"O8'80KV!V$*]H="-1UN2%..*J]&7/>@\0A'E=-
+M?ARC?P^?K6/74;B:;XW^C2&>W@Q=<(@3;G.(&YT/UA]GP18<XH0K.L2E__Q6
+M#2C;7TK2NA6@L*6Z$,C7FK'`Z>=13[\/?\+L$8ZYBD@*V?.&"E.UP`=ZB)II
+M'?AW=?=X<_CQN."XCVI)(-8?6C68L_$B7!F'^W#@WRQROWJ7>$W),'N]@EK0
+M*R8,W'NWCTM%VB^@)5AMH!-D^R31CTB1+&3"V5();_[?O76XTJ6"?PUV?P'7
+':/,?LPT`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu
new file mode 100644
index 0000000..cec7ced
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu
@@ -0,0 +1,87 @@
+# $FreeBSD$
+begin 644 img-1x1-512-gpt.vmdk.gz
+M'XL(".G%'50``VEM9RTQ>#$M-3$R+6=P="YV;61K+F]U=`"M7%V/W,81?/>O
+MF,@/#A)DP5J22_)!0.S(!HP@@&(I\4L>LOR*#Y$EY70(8F!_?#CDU%SQ;N=(
+M^?I,B=O:[MKI'K+W7%U@EBT_SA6M*PI7]*X\N0QN^J?E<%E^;TS'L>8;ES^_
+M^LO?#_SY[>%P^6(!@X^2$&0*)\;J<RZ'!S^$.SX5M7IC.HZ;<+F/:A\%!KAC
+MXHTD7#&]>;P6PM6=Y[=[_T+@7`1R*[CR2D[)9)]:W>^^",7SZ\O]&J;M/36N
+MRMVI#:8[E;.=N^HXOY>Y:G(:)\`OW:N;3_]VKX9/W>W-Q[L/87U'O[>3<W'R
+M_J?.(TR)52?_PK_AX1H/<1I<WKL<_FUWN?WNYMUP^.]P^^GFP_N78+I'O[=%
+M[HK&+\?[9_?'RO`?DKD3_&>XRY^^?_4R7+G9X>/YEG`^:EK(]-E3'HI[.CG_
+MY_$QKVYX?^<1Q_`35^?W-A2GG#^[\"_*PE6-FY=3>NSC]'8?4IYKU]T.Y[OA
+M[2\?AY<O?O[P/M;.[ZTO63,#U7.A<E?F'BJDYLM7>D1_V<R[YB[O;NY^NNG>
+M3&E^&EX<OG2$._G:31M8AW4M64\AI^3.3LN^?/N_NRE?UX>=O2'<O(@YB>FS
+MRZ,K*X\U;>"\%4>7%_[5]$_3@J=,"G@G=_GP_O##C],M[HOUYO77/Q"NGJ(F
+MSVF!4\B4T"JG<LF_?'A9NLN;;]T+G^3;GX;Y"B1<L]QFWGG9!\SFT;\(55O@
+M?1,K_!OSSKI7Y[NS^^;\:3A\^>K5-W%GSS[98CZFI0T>Y;1`^^M[+N=4N&6G
+MEXV>MZ+OV\.Y/W^\&V[]]L:M:'V)^I"IW];B?AO7GU/-.S7Z*\9=7KH7-_VT
+MIQ[V7\.'GPG7+9?QM`Y_231S8.Y?3%?/##^$3UBN&+]-'FZXN_WET/WR[N9]
+M/]UH[B7A^J5VTW*6W;S?S&D#IQ5>7>!4NQ?SKL;E$6[PJ^L?+7#>SU#(N*CX
+ML>[R\[R\GX9S/RUMPB;<Z%=WO+Z.4*D''S6AN\M]U6;<3P$NST(+R$,K6Y4H
+M+F?Y0&F@0W?WX799V`OIQ_G#[[+G]N/BT5=J]2L!%SCK]9VR!]]GN<858I0K
+M0/\MEDU__CC]>7V_OI-?WTD\*XVJQ6A6</^<(#X^3O?D[\*S>+8:U8G1[ZG>
+MR;>V03S'A]7CKQJ0UVDX_BY`SURC"C'*%5RJ=F6H'3TKC:K%:%9PJ=J=0NWH
+MV6I4)T:_*]DJU(Z>HT;Y$W^50K;CU[)3'6I'SURC"C'*%5RJ=DVH'3TKC:K%
+M:%9PJ=J=0^WHV6I4)T:_*]DVU(Z>HT;Y$QL$Y'4:K@NUHV>N4848Y0HN5;L^
+MU(Z>E4;58C0KN%3MAE`[>K8:U8G1[TIV#+6CYZA1_E1([8HMN"H+M:-GKE&%
+M&.4*+E&[BOV.GI5&U6(T*[A$[2KV.WJV&M6)T>]*EOV.GJ-&^5,IM2LWX=CO
+MZ)EK5"%&N8)+U8[]CIZ51M5B-"NX5.W8[^C9:E0G1K\K6?8[>HX:Y4\GJ=UI
+M$X[]CIZY1A5BE"NX5.W8[^A9:50M1K."2]6._8Z>K49U8O2[DF6_H^>H4?[$
+M7X(@K]-P['?TS#6J$*-<P:5JQWY'STJC:C&:%5RJ=NQW]&PUJA.CWY4L^QT]
+M1XWR)Q(RD-=)N#H+M:-GKE&%&.4*+E&[FOV.GI5&U6(T*[A$[6KV.WJV&M6)
+MT>]*EOV.GJ-&^5,CM6LVX=COZ)EK5"%&N8)+U8[]CIZ51M5B-"NX5.W8[^C9
+M:E0G1K\K6?8[>HX:Y4_\_R?(ZS0<^QT]<XTJQ"A7<*G:L=_1L]*H6HQF!9>J
+M'?L=/5N-ZL3H=R7+?D?/4:/\B?PCY'4:COV.GKE&%6*4*[A4[=COZ%EI5"U&
+MLX)+U8[]CIZM1G5B]+N29;^CYZA1_M1)[;HMN"8+M:-GKE&%&.4*+E&[AOV.
+MGI5&U6(T*[A$[1KV.WJV&M6)T>]*EOV.GJ-&^5,OM>LWX=COZ)EK5"%&N8)+
+MU8[]CIZ51M5B-"NX5.W8[^C9:E0G1K\K6?8[>HX:Y4^#U&[8A&._HV>N4848
+MY0HN53OV.WI6&E6+T:S@4K5COZ-GJU&=&/VN9-GOZ#EJE#^-4KMQ$X[]CIZY
+M1A5BE"NX5.W8[^A9:50M1K."2]6._8Z>K49U8O2[DF6_H^>H49E,SR"ODW#G
+M;*E=],PUJA"C7,$E:G<._2YZ5AI5B]&LX!*U.X=^%SU;C>K$Z'<E&_I=]!PU
+MRI=,^#ML4EKGT.\@_!V4OX/P=]CD[\ZAWT'X.RA_!^'OL,G?G4._@_!W4/X.
+MPM_M2#;T.PA_!^7O(/P=-BFM<^AW$/X.RM]!^#ML\G?GT.\@_!V4OX/P=]CD
+M[\ZAWT'X.RA_!^'O=B0;^AV$OX/R=Q#^#IN4UCGT.PA_!^7O(/P=-OF[<^AW
+M$/X.RM]!^#ML\G?GT.\@_!V4OX/P=SN2#?T.PM]!^3L(?X=-2JO-0NV$OX/R
+M=Q#^#IO\7<M^)_P=E+^#\'?8Y.]:]COA[Z#\'82_VY$L^YWP=U#^#L+?89/2
+M:MGOA+^#\G<0_@Z;_%W+?B?\'92_@_!WV.3O6O8[X>^@_!V$O]N1+/N=\'=0
+M_@["WV&3TFK9[X2_@_)W$/X.F_Q=RWXG_!V4OX/P=]CD[UKV.^'OH/P=A+_;
+MD2S[G?!W4/X.PM]AD])JV>^$OX/R=Q#^#IO\7<M^)_P=E+^#\'?8Y.]:]COA
+M[Z#\'82_VY$L^YWP=U#^#L+?89/2ZK)0.^'OH/P=A+_#)G_7L=\)?P?E[R#\
+M'3;YNX[]3O@[*'\'X>]V),M^)_P=E+^#\'?8I+0Z]COA[Z#\'82_PR9_U['?
+M"7\'Y>\@_!TV^;N._4[X.RA_!^'O=B3+?B?\'92_@_!WV*2T.O8[X>^@_!V$
+MO\,F?]>QWPE_!^7O(/P=-OF[COU.^#LH?P?A[W8DRWXG_!V4OX/P=]BDM#KV
+M.^'OH/P=A+_#)G_7L=\)?P?E[R#\'3;YNX[]3O@[*'\'X>]V),M^)_P=E+^#
+M\'?8I+3Z+-1.^#LH?P?A[[#)W_7L=\+?0?D["'^'3?ZN9[\3_@[*WT'XNQW)
+MLM\)?P?E[R#\'38IK9[]3O@[*'\'X>^PR=_U['?"WT'Y.PA_ATW^KF>_$_X.
+MRM]!^+L=R;+?"7\'Y>\@_!TV*:V>_4[X.RA_!^'OL,G?]>QWPM]!^3L(?X=-
+M_JYGOQ/^#LK?0?B['<FRWPE_!^7O(/P=-BFMGOU.^#LH?P?A[[#)W_7L=\+?
+M0?D["'^'3?ZN9[\3_@[*WT'XNQW)LM\)?P?E[Z*8#O):X-SR)\`-V5*[JY+R
+M*_\4:^>NKFZPU@>.XU[`_'JZ?H]CNLB>7,;GKP^S?C'./):J_SK`!<ZX?HCS
+M=RG3?=SGZBL1Y^\\GJ6O1)R_\WB6OA)Q_L[C6?I*Q/F[B;X2<?YNHJ]$G+^;
+MZ"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_
+MF^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<
+MOYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$
+MG+^;Z"L1Y^\F^DIP_FZCKP3G[S;Z2G#^;J.O!.?O-OI*</YNHZ\$Y^\V^DIP
+M_FZCKP3G[S;Z2G#^;J.O!.?O-OI*</YNHZ\$Y^\V^DIP_FZCKP3G[S;Z2G#^
+M;J.O!.?O-OI*</YNHZ\$Y^\V^DIP_FZCKP3G[S;Z2G#^;J.O!.?O-OI*</YN
+MHZ\$Y^\V^DIP_FZCKP3G[S;Z2G#^;J.O!.?O-OI*</YNHZ\$Y^\V^DIP_FZC
+MKP3G[S;Z2L3Y.SV?I:]$G+_3\UGZ2L3Y.SV?I:]$G+_3\UGZ2L3YNXF^$G'^
+M;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q
+M_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2
+M<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^
+M$G'^;J*O1)R_F^@K$>?O)OI*</YNHZ_$8*JOQ&"JK\1@JJ_$8*JOQ&"JK\1@
+MJJ_$8*JOQ&"JK\1@JJ_$8*JOQ&"JK\1@JJ_$8*JOQ&"JK\1@JJ_$F&6&^DJ,
+MIOI*C*;Z2HRF^DJ,IOI*C*;Z2HRF^DJ,IOI*C*;Z2HRF^DJ,IOI*C*;Z2HRF
+M^DJ,IOI*C*;Z2HRF^LICEF6&^LKCHV<=[X1[G.RB#SS"5%]Y/#ZYC,]?7S'7
+M;WFZZN._TV]<OCFL_XN`:#\/D"M<PS'A`O[>6+1>P^#&,1R+<NX^P_@4ZRL)
+M__8@<+UQ_?;O[W*4I3N?'P'^C>N;][<H_?.8BV9^."^?S%L6$6[.O>QT?=]^
+M][U[_?4/;SW8/^[3G1_O/':NZ=U0>8CUZO!$NF\?WQW%_'CGJ?K'ZFJR>1+N
+MJVLW6S$_WGGLGX"[=J3ABJ>B/O=)X,7\>&>-4O6MJTM7'_WS>_MS$N[="NYD
+M?.7-3YYM3Z[J_/.#2[AN?MAS?_*TM*NGVV2Y)X[NV'LE0@5W]$]D/ES>__7P
+M?@'[P^$_OP_K6YX\B^M'^HU4]8KC4U>$7]1&NFX-EUM7S_^^TI9FU6O"Q7+M
+M2+^1K-YYJ5[B6VU:U+5;=X+CM]IOUG"M<?5F5?XB/'G\=_J-R^O#^K\%L`B`
+M9BLL_",%[>X.#V=X=W@XP[O#PYG>'1[0\.[P<(9WAX<SO#L\G.G=4?@'1MI]
+MB7LX?^WU4\T;_PS_<GW5I+^.I_7]^&9>V%>K=&?.,?G5_\27^/7-&`R_Q#W<
+BDU_BXY!.-OP\2-;P2]S#F7Z)%_[IG=D7_P=,%9H/M&4`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow.gz.uu
new file mode 100644
index 0000000..903950a4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.qcow.gz
+M'XL("*0S(E0``VEM9RTQ>#$M-3$R+6UB<BYQ8V]W+F]U=`"MG<N.&TF21??U
+M%=3[+=',@F2$WFA@!IA=SV)FML7GFA^@CQ^5%.&>:3Q75MU5JD1!@A07I.?1
+M$;KKR'.]_OEMM=K8:MBNAFEU.:R^_WC^L-6=']S_6'W[[__\K[=WOWW[[>>8
+MK7_Q5/KQX*N8Y^YM_6/=YOR/IXZK]?0GYKY_&,W=>77Q+[RZ.V_V=N[E;S_?
+M+#_G:O#^VUW-<\O;-7%ZPY][?5_3V[6?I_?WO5T7;W>C!K?W!O\YS_T^OSX7
+M;W>GYL9[<]?T=EV\W4G-[7\)BPM8#FKN6,P-^-1)S9V+N0T^=>$Y^\7G]N?<
+M%I\R-><XMVIS.WPJU-QP;V[]=@%ZF1OQ*<&=E=Q-^)3@SDKN]OB4X,Y*[@[X
+ME.#.2NZ.^)3@SDKN3OB4X,Y+[L[XE.#.2^XN^)3@SBONC)\2W'G%G9'O7''G
+M%7=&OG/%G5?<&?G.%7=><6?D.U?<><6=D>]<<1<5=T:^"\5=5-P9^2X4=U%R
+M1[X+Q5V4W)'O0G$7)7?DNU#<1<D=^2X4=U%R1[X+Q5V4W)'O0G$WE-R1[P;%
+MW5!R1[X;%'=#Q9WS4X*[H>+.R7>#XFZHN'/RW:"X&RKNG'PW*.Z&BCLGWPV*
+MNZ'BSLEW@^)N4W'GY+N-XFY3<>?DNXWB;E-R1[[;*.XV)7?DNXWB;E-R1[[;
+M*.XV)7?DNXWB;E-R1[[;*.XV)7?DNXWB;EMR1[[;*NZV)7?DNZWB;EMQ%_R4
+MX&Y;<1?DNZWB;EMQ%^2[K>)N6W$7Y+NMXFY;<1?DNZWB;EMQ%^2[K>)N5W$7
+MY+N=XFY7<1?DNYWB;E=R1[[;*>YV)7?DNYWB;E=R1[[;*>YV)7?DNYWB;E=R
+M1[[;*>YV)7?DNYWB;BRY(]^-BKNQY(Y\-RKNQHJ[@9\2W(T5=P/Y;E3<C15W
+M`_EN5-R-%7<#^6Y4W(T5=P/Y;E3<C15W`_EN5-PM__>WGB/?38J[J>)N(-]-
+MBKNIY(Y\-RGNII([\MVDN)M*[LAWD^)N*KDCWTV*NZGDCGPW*>ZFDCORW:2X
+MVY?<D>_VBKM]R1WY;J^XVU?<;?@IP=V^XFY#OMLK[O85=QORW5YQMZ^XVY#O
+M]HJ[?<7=AGRW5]SM*^XVY+N]XF[YSY!ZCGQW4-P=*NXVY+N#XNY0<D>^.RCN
+M#B5WY+N#XNY0<D>^.RCN#B5WY+N#XNY0<D>^.RCN#B5WY+N#XNY8<D>^.RKN
+MCB5WY+NCXNY8<;?EIP1WQXJ[+?GNJ+@[5MQMR7='Q=VQXFY+OCLJ[HX5=UOR
+MW5%Q=ZRXVY+OCHJ[4\7=EGQW4MR=*NZVY+N3XNY4<D>^.RGN3B5WY+N3XNY4
+M<D>^.RGN3B5WY+N3XNY4<D>^.RGN3B5WY+N3XNY<<D>^.RONSB5WY+NSXNY<
+M<;?CIP1WYXJ['?GNK+@[5]SMR'=GQ=VYXFY'OCLK[LX5=SORW5EQ=ZZXVY'O
+MSHJ[2\7=CGQW4=Q=*NYVY+N+XNY2<D>^NRCN+B5WY+N+XNY2<D>^NRCN+B5W
+MY+N+XNY2<D>^NRCN+B5WY+N+X,Z6[^@Y\)VM!7>V+KD#W]E:<&?KBKN1GV+N
+MK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^
+M;@3?F>KOK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;P
+MG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN)-^I_L[*_FXDWZG^SLK^;N*G!'=E
+M?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4
+M?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\W
+MD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?[?GIP1W97^W)]^I_L[*
+M_FY/OE/]G97]W9Y\I_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?[<EW
+MJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^4_V=E?W=GGRG^CLK^[L]^4[U=U;V
+M=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.ROSOP4X*[LK\[D.]4?V=E?W<@WZG^
+MSLK^[D"^4_V=E?W=@7RG^CLK^[L#^4[U=U;V=P?RG>KOK.SO#N0[U=]9V=\=
+MR'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W
+M5O9W!_*=ZN^L[.\.Y#O5WUG9WQWY*<%=V=\=R7>JO[.ROSN2[U1_9V5_=R3?
+MJ?[.RO[N2+Y3_9V5_=V1?*?Z.RO[NR/Y3O5W5O9W1_*=ZN^L[.^.Y#O5WUG9
+MWQW)=ZJ_L[*_.Y+O5']G97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.
+M]7=6]G='\IWJ[ZSL[T[\E."N[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O5']G97]W
+M(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[$_E.]7=6]G<G\IWJ[ZSL[T[D.]7?
+M6=G?G<AWJK^SLK\[D>]4?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3
+M^4[U=U;V=V=^2G!7]G=G\IWJ[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?V=E
+M?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK^[LS^4[U=U;V=V?RG>KOK.SOSN0[
+MU=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[
+MNPL_);@K^[L+^4[U=U;V=Q?RG>KOK.SO+N0[U=]9V=]=R'>JO[.RO[N0[U1_
+M9V5_=R'?J?[.RO[N0KY3_9V5_=V%?*?Z.RO[NPOY3O5W5O9W%_*=ZN^L[.\N
+MY#O5WUG9WUW(=ZJ_L[*_NY#O5'_GRW?2W*K/@>^^/\7<>>KOEOOT5IT[\)VK
+M_LY3?[>:N5LMW,6:GV+N//5WJYF[U>]M#GSGJK_SU-^MKNGL@NZ_<]7?>>KO
+MVMGU.?"=J_[.4W\'<^`[5_V=I_X.YL!WKOH[3_W=,O>@SX'O7/5WGOJ[!\O<
+MJLV![USU=Y[ZNP<S=P\Z=^`[5_V=I_[NP<S=@\X=^,Y5?^>IOWMPO3D[\)VK
+M_LY3?]?.KL^![USU=Y[Z.Y@#W[GJ[SSU=S`'OG/5WWGJ[Y:YAWV.?*?Z.T_]
+MW<-EKG-'OE/]G:?^[N',W</&'=U_YZJ_\]3?/9RY>]BXH_OO7/5WGOJ[A]=\
+M=G3_G:O^SE-_U\ZNSY'O5'_GJ;^#.?*=ZN\\]7<P1[Y3_9VG_FZ9>]3GR'>J
+MO_/4WSU:YAIW=/^=J_[.4W_W:.;N4>>.?*?Z.T_]W:.9NT>=._*=ZN\\]7>/
+MKC=G1[Y3_9VG_JZ=79\CWZG^SE-_!W/D.]7?>>KO8(Y\I_H[3_W=,O>XSY'O
+M5'_GJ;][O,QU[LAWJK_SU-\]GKE[W+BC^^]<]7>>^KO',W>/&W=T_YVK_LY3
+M?_?XFL^.[K]SU=]YZN_:V?4Y\IWJ[SSU=S!'OE/]G:?^#N;(=ZJ_\]3?+7-/
+M^ASY3O5WGOJ[)\M<XX[NOW/5WWGJ[Y[,W#WIW)'O5'_GJ;][,G/WI'-'OE/]
+MG:?^[LGUYNS(=ZJ_\]3?M;/K<^0[U=]YZN]@CGRG^CM/_1W,D>]4?^>IOUOF
+MGO8Y\IWJ[SSU=T^7N<X=^4[U=Y[ZNZ<S=T\;=W3_G:O^SE-_]W3F[FGCCNZ_
+M<]7?>>KOGE[SV=']=Z[Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_!'/E.]7>>
+M^KME[EF?(]^I_LY3?_=LF6O<T?UWKOH[3_W=LYF[9YT[\IWJ[SSU=\]F[IYU
+M[LAWJK_SU-\]N]Z<'?E.]7>>^KMV=GV.?*?Z.T_]'<R1[U1_YZF_@SGRG>KO
+M//5WR]SS/D>^4_V=I_[N^3+7N2/?J?[.4W_W?.;N>>..[K]SU=]YZN^>S]P]
+M;]S1_7>N^CM/_=WS:SX[NO_.57_GJ;]K9]?GR'>JO_/4W\$<^4[U=Y[Z.Y@C
+MWZG^SE-_M\R]Z'/D.]7?>>KO7BQSC3NZ_\Y5?^>IOWLQ<_>B<T>^4_V=I_[N
+MQ<S=B\X=^4[U=Y[ZNQ?7F[,CWZG^SE-_U\ZNSY'O5'_GJ;^#.?*=ZN\\]7<P
+M1[Y3_9VG_FZ9>]GGR'>JO_/4W[U<YCIWY#O5WWGJ[U[.W+ULW-']=Z[Z.T_]
+MW<N9NY>-.[K_SE5_YZF_>WG-9T?WW[GJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.
+M4W\'<^0[U=]YZN^6N5=]CGRG^CM/_=VK9:YQ1_??N>KO//5WKV;N7G7NR'>J
+MO_/4W[V:N7O5N2/?J?[.4W_WZGIS=N0[U=]YZN_:V?4Y\IWJ[SSU=S!'OE/]
+MG:?^#N;(=ZJ_\]3?+7.O^QSY3O5WGOJ[U\M<YXY\I_H[3_W=ZYF[UXT[NO_.
+M57_GJ;][/7/WNG%']]^YZN\\]7>OK_GLZ/X[5_V=I_ZNG5V?(]^I_LY3?P=S
+MY#O5WWGJ[V".?*?Z.T_]W3+WIL^1[U1_YZF_>[/,->[H_CM7_9VG_N[-S-V;
+MSAWY3O5WGOJ[-S-W;SIWY#O5WWGJ[]Y<;\Z.?*?Z.T_]73N[/D>^4_V=I_X.
+MYLAWJK_SU-_!'/E.]7>>^KME[FV?(]^I_LZK_B[H_CM7_9U7_5W0_7>N^CNO
+M^KN@^^]<]7=>]7=!]]^YZN^\ZN^"[K]SU=]YU=\%W7_GJK_SJK\+NO_.57_G
+MHK][U^?(=ZJ_\]3?O5OF&G=T_YVK_LY3?_=NYNY=YXY\I_H[3_W=NYF[=YT[
+M\IWJ[SSU=^^N-V='OE/]G:?^KIU=GR/?J?[.4W\'<^0[U=]YZN]@CGRG^KM8
+MOI/FUGT.?!>JO_O^$_>X6_RT[MR![T+U=Y'ZN_6\MV[<T?UWH?J[2/W=>N9N
+MW;BC^^]"]7>1^KOU-9\=W7\7JK^+U-^UL^MSX+M0_5VD_@[FP'>A^KM(_1W,
+M@>]"]7>1^KMESOH<^"Y4?Q>IO[-EKG%']]^%ZN\B]7<VOSSKW('O0O5WD?H[
+MF[FSSAWX+E1_%ZF_L^O-V8'O0O5WD?J[=G9]#GP7JK^+U-_!'/@N5'\7J;^#
+M.?!=J/XN4G^WS'F?(]^I_BY2?^?+7.>.?*?ZNTC]G<_<>>..[K\+U=]%ZN]\
+MYLX;=W3_7:C^+E)_Y]=\=G3_7:C^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B]7<P
+M1[Y3_5VD_FZ9BSY'OE/]7:3^+I:YQAW=?Q>JOXO4W\7,773NR'>JOXO4W\7,
+M773NR'>JOXO4W\7UYNS(=ZJ_B]3?M;/K<^0[U=]%ZN]@CGRG^KM(_1W,D>]4
+M?Q>IOUOFACY'OE/]7:3^;ECF.G?D.]7?1>KOAIF[H7%']]^%ZN\B]7?#S-W0
+MN*/[[T+U=Y'ZN^&:SX[NOPO5WT7J[]K9]3GRG>KO(O5W,$>^4_U=I/X.YLAW
+MJK^+U-\M<YL^1[Y3_5VD_FZSS#7NZ/Z[4/U=I/YN,W.WZ=R1[U1_%ZF_V\S<
+M;3IWY#O5WT7J[S;7F[,CWZG^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B]7<P1[Y3
+M_5VD_FZ9V_8Y\IWJ[R+U=]MEKG-'OE/]7:3^;CMSMVW<T?UWH?J[2/W==N9N
+MV[BC^^]"]7>1^KOM-9\=W7\7JK^+U-^UL^MSY#O5WT7J[V".?*?ZNTC]'<R1
+M[U1_%ZF_6^9V?8Y\I_J[2/W=;IEKW-']=Z'ZNTC]W6[F;M>Y(]^I_BY2?[>;
+MN=MU[LAWJK^+U-_MKC=G1[Y3_5VD_JZ=79\CWZG^+E)_!W/D.]7?1>KO8(Y\
+MI_J[2/W=,C?V.?*=ZN\B]7?C,M>Y(]^I_BY2?S?.W(V-.[K_+E1_%ZF_&V?N
+MQL8=W7\7JK^+U-^-UWQV=/]=J/XN4G_7SJ[/D>]4?Q>IOX,Y\IWJ[R+U=S!'
+MOE/]7:3^;IF;^ASY3O5WD?J[:9EKW-']=Z'ZNTC]W31S-W7NR'>JOXO4WTTS
+M=U/GCGRG^KM(_=UTO3D[\IWJ[R+U=^WL^ASY3O5WD?H[F"/?J?XN4G\'<^0[
+MU=]%ZN^6N?=]CGRG^KM(_=W[9:YS1[Y3_5VD_N[]S-W[QAW=?Q>JOXO4W[V?
+MN7O?N*/[[T+U=Y'ZN_?7?'9T_UVH_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W
+M,$>^4_U=I/YNF?O0Y\AWJK^+U-]]6.8:=W3_7:C^+E)_]V'F[D/GCGRG^KM(
+M_=V'F;L/G3ORG>KO(O5W'ZXW9T>^4_U=I/ZNG5V?(]^I_BY2?P=SY#O5WT7J
+M[V".?*?ZNTC]W3+WL<^1[U1_%ZF_^[C,=>[(=ZJ_B]3??9RY^]BXH_OO0O5W
+MD?J[CS-W'QMW=/]=J/XN4G_W\9K/CNZ_"]7?1>KOVMGU.?*=ZN\B]7<P1[Y3
+M_5VD_@[FR'>JOXO4WRUSG_H<^4[U=Y'ZNT_+7...[K\+U=]%ZN\^S=Q]ZMR1
+M[U1_%ZF_^S1S]ZES1[Y3_5VD_N[3]>;LR'>JOXO4W[6SZW/D.]7?1>KO8(Y\
+MI_J[2/T=S)'O5'\7J;];YC[W.?*=ZN\B]7>?E[G.'?E.]7>1^KO/,W>?&W=T
+M_UVH_BY2?_=YYNYSXX[NOPO5WT7J[SY?\]G1_7>A^KM(_5T[NSY'OE/]7:3^
+M#N;(=ZJ_B]3?P1SY3O5WD?J[9>Y+GR/?J?XN4G_W99EKW-']=Z'ZNTC]W9>9
+MNR^=._*=ZN\B]7=?9NZ^=.[(=ZJ_B]3??;G>G!WY3O5WD?J[=G9]CGRG^KM(
+M_1W,D>]4?Q>IOX,Y\IWJ[X;E.VGN:Y\#WPVJOQM2?_=UF>O<@>^^/\7<#:F_
+M^SIS]W7A;ECS4\S=D/J[KS-W7W]O<^"[0?5W[6.9R[WQ0/??]:>*N3O?OOWV
+M\L?@YL?;'7RUWL._]4]\^\?;^_^TP1]7_?P+@]]_HUTN-X/+&][\N.KG^R_X
+M_K'?S-_Y_K&V.V_XCZ]1;/H-/WA[9XZ^E/)?.3^ZG>=7@YO-:K^_&?R?Y?7Y
+MW_WI^/'7P3>[U;!9;;:KT?_L&_Z___C?](9_SM&7C_^WSN_G7(ES>\'V9^9^
+M_/%]YU?>)4/_Q+>.R=L[]^!MZ*^#]Q?QAZ_.]!/RU=&7C_\K[-W\E>N[G^<?
+M7X#^^__67OYS2KJ7M'U^5_WU4:)^[^W^XO6M;M_NCS\B=_=_O=V9\^+MKN[/
+M'7[YN?WUJWMP^^KH2[3_E4_&S5\<_I._<_\8N?\[]^><_[TBV/TPRQ]_BNWA
+AW_HGOOWS[?U_?@X.\^#?=H+#>OS^*G_[?V9WPD*PIP``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow2.gz.uu
new file mode 100644
index 0000000..0b7d7db
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.qcow2.gz
+M'XL(")<[(U0``VEM9RTQ>#$M-3$R+6UB<BYQ8V]W,BYO=70`K9C9LM,P#$#?
+M^Q4NRP4N4&+)3E.6"]R%&=[@`7A.EWQ%/YXD5N-$D>*VD]:3:<?1&=D^5I8L
+M"Q]CO#4N-VYCJJVI_U,#T_LS;.;X^\?/5?]S7`28S90HH<-AAQNP'B(.-%QF
+MQQU6QO6R0P$'IZ@Q*(5S:G93'0+N=M%.7;L8!8O`:X`!IR[&5?E!R(]'N"OS
+M@[GS0WG^_"F.=^33^6'(CT>M-5R1Q($0M=%P91*'0M16P^V2."=$[37<(8GS
+M0E2EX&Q"E1J7"U%6PT$2MQ:B4,.Y)*X0HC3O;-J[C1"E>6?3WI5"E.:=37NW
+M%:(T[VS:NYT0I7EGT][MA2C-.U"\,Q%W$*(T[X!YMR3<LXBKA"C-.V#>/2?<
+MBPYGI2C-.V#>O23<3<0)]0XT[X!Y]XIPKR-.J'>@>0?,NS>$NXTXH=Z!YATP
+M[]X2[EW$"?4.-.^`>?=^Y)T5ZAUHWB'S[@.QLH@3ZAUJWB'SSA(.(DZH=ZAY
+MA\P[))R+.*'>H>8=,N\\X?*($^H=:MXA\VY-N"+BA'J'FG?(O-L0[F/$"?4.
+M->^0>?>)<)\C3JAWJ'F'S+LOA+N+.*'>H>:=8]Y])=RWB!/JG=.\<\R[[X2[
+MCSBAWCG-.\>\>R#<8X<#*:KS+LOD1KBGT9Z%>>\_7;P_ML)1[Y@`%I<`IS(,
+MN,VL`_9AP(T&I7#4.X[WJ^&W`[:;[0)@/3]5-0+2@'W8;/4)=2L]_:A;F"\:
+MGNU=T84!+U<]W'[F^6OWQP5`[TU9CH!_3OG!W,OA&J!?-YO,YZ:`<P?\[^GO
+MV+\:-]N&"SC][0!U=`G;<W#MVX'>F7TS]([AO=XRXB;?#C2//`>I0\W.S^R>
+M*UA<?YW;9[5=?*AE=\K=^IJ8GU!;8##<B?S,>+C-1;Q[V&:KV"Y`8KAFB-M.
+MKNUT=LMQ=KN9%\/SG7'FSFT@PYT;<#!O(8"VLM0&UF>-CWK'\==J^`U`1\#9
+09M#ES:5H\1\W+X2OTA0`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.raw.gz.uu
new file mode 100644
index 0000000..494fe71
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.raw.gz
+M'XL(".G%'50``VEM9RTQ>#$M-3$R+6UB<BYR87<N;W5T`*V4R[+"(`R&]WV*
+MN'7!A`C'NG7&O1MUC?7T*7AX@^D%BJWM#)!29@+?_"$$1&D`A@#=EW'>X<\J
+M[;[:5Q^:?FX#U@AMFP$5`P77,(X7L#G;3=A00Q#.'YM&(-W-Q<"KL>U4A'L-
+MNW*;=\0X);@^W'8;T%IP+@/>>GU4.ATF`.T1C`7[!S6M#?AQN4\"%IPN=7Z"
+MHU^X0;!>@SN$7='*^&;,._QX3>3?X\R2.D;@_Z9@;>&[9^K)OCC/@%PE#6#=
+M^2@%#OF%4=\IET%)N`OZ(`_7!=PQ7:\C'/T(%U+<<S&WR^IVN;JF<#+LM#)6
+K5FZ`I)4K."K[$-#G9>$;R*OR<=[AKRKM`C0=L-@)&@K`Z@UK>@7\E`8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.vhd.gz.uu
new file mode 100644
index 0000000..6aa2b8a
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.vhd.gz
+M'XL("/LTQ%4``VEM9RTQ>#$M-3$R+6UB<BYV:&0N;W5T`*U7SW.<(!2^[U_Q
+M,KWEX,`3GN::F=Q[:7-65].=3MM,DD,.]G\O""B(F#5%6187WL?W?LHR9BX`
+M*H$&H!Y(ZG$E@.Z@J@'4I&TX]=P^PMC]^=UW;Y?WPE[CR8!QYDN%XEH>2Q!J
+MDPJPT9O068]A=##%EX>GV\NO)P>'%@XMD*RT5(E`;;2/4+_6AIU&>KS@SPGR
+M_L?,KHS9+5+J4YV!">#<6U$Z=@JF^!LJ*Y34,$RM`M9/]G$M>`@F%F57MI-L
+M)>71W#(J6Y3=@J,]J2-PMR?K"Q,J*C`JU3,@#A7JL0H;9X>HJ5!Y?WUN7E[[
+M%3],A`K-_'@T5Z;511LJZ!9;!D*'\YZZ,*&\K>$V0N6_K$>AG+`#900FW01.
+MZH?66Z#`YT><[=@\[8PDOT;S4\G`FHT^/3'>%^$]`[;M,<":&88AW*QPV\T*
+M-W+1R`3)8DSD:8?<>/9KSYG]VP['`*6$IHD`OSE^76YW]!I0E4]5?25!C=<J
+M_/CP?2O=^D3V?K)8]?@1W$R87P-7VE+J5OJ1D9X8ES`QWPY.[+'3*=P?4E9F
+MCKV^7LGY?@:FLJ0#5GM%Q@.<_0L+O[N8!@;J[O"#6-U&PU7A>N[!X0?J0@C7
+M[OIVG]U-S*[+[(QAG1E79JX&"3/7P&'>0H!395$1J%;%?7IB_%J$MP%$^^;(
+M]BI"6_NR,106,!M#X8II/H8EVPVVHU%(EF&F<SVER_UGSO7DE?L,YWIRY3XE
+CQ0Z=Z\F6^TSG>G+E/L^Y7L-E/=>3^L?&V.D?^S1@R`P.````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdf.gz.uu
new file mode 100644
index 0000000..609685d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.vhdf.gz
+M'XL("&4EAE4``VEM9RTQ>#$M-3$R+6UB<BYV:&1F+F]U=`"ME;UR@S`,@/<\
+MA7+=,G"VL`Q9>Y<]2]L9".1RO;1+APX\?&6,P<:!)#U`(<[)^B)9/PAA+P"%
+M((H;SWE%^YJ$=[O9;3J:+)\#Y@*:)@(F#+2XBG&\@:6@?L$B)!C'^<,B!:#L
+MUU:@3<9KFWBXTV`5R[S"QR46Y\)MG@,205%$P#?G'ZZ=#F6`E($B(`TY/AKP
+MQ^%]$K#%R;7.S^+P'FYP6#Z"2XV5M].OC'E%.Y:)_78XM>0=(T3]5+"T<NVI
+M?&+GYQD$=TD%(N]U&`*'_,+HWSYV`X-P%_R#.-S"X+)PO_1P>"=<"''E8FZ7
+MO=O&WE4K)X.FG?%@YQI(V+D6A^L.`NPF"U<@[XJ?\XKVF(2W!:H>N-H)4O\J
+MTBGH!G0-FLPZ4Z#WD.4^$,-*:JOOK[KZN?SZ&38X.;PY8C'VF)INT1E@8?Y$
+MG\S:\^_E<-Y=KF>'<Z/*321N-K9*$709A4N39KO@9X<\CMZE\2&1?WI[#4*!
+ME$'@O7?'L)RIF_,NV+J!4G7GXR3X$2ANCBJ#(S&Q^F]N+4ZO7"I<>YL_P54P
+%QK\(````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-mbr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-mbr.vmdk.gz.uu
new file mode 100644
index 0000000..2464362
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-mbr.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-512-mbr.vmdk.gz
+M'XL(".K%'50``VEM9RTQ>#$M-3$R+6UB<BYV;61K+F]U=`"M7%V/W,81?/>O
+MH*67(`\+UI)<D@\"$N<<(`@"&)9COX:?T2&V))P.00SLC\\,.357O!4UM*_E
+M/9&C[:Z=[MFK.U<7-L_7/UE6]EE99N6859<L1^;^:7UD>?&T<(]SPR>N?[_[
+MQX\G_OG#Z73]:@6#SY(4Y`HGB\WK7$_/_A#N_*6LS1/N<4["%3ZKOTD,<.>=
+M)W;A2O?D^7,IW%VW/#WZ&X'+(E"V@:L^4]-NL5_:W1^_"LWS^RO\'MSQ7MJL
+M+K)+'Y;9I5K615:?E^?RK'9!LP-\G=W=?_I/=C=]&A[N/SY^"/L[^[-UP>7%
+MQU\&C^`*JR_^QC_AX5H/<9FR8LP*^*>SZ\-?[W^>3O^='C[=?WC_!BSW[,^V
+M++*R]=OQ\?G38[/P+Y)G%_C7R*Y_^=O=F_#.S4\?NP?"^2RW$??:K@[%O5PR
+M_W7[6'8WO7_TB'/X$W?GSS8TIUI>N_0W59G5;;9LI_+89_?T&$I>>C<\3-WC
+M],.O'Z<WKW[Y\#[VSI^M;UF[`#5+HXJL*CQ4*,VWK_*(_FVSG%IV_?G^\=W]
+M\-:5^6EZ=7J=$>[B>^<.L`G[6JMV*9?=DW7;OG[[OT=7;S:&D[TGW+*)I0CW
+MVM4YJVJ/Y0YP.8IS5I3^SOV3V["KI(0/RJX?WI^^_\E]B_MFO?WNS]\3KG%9
+M+M)MT*6X@C8U56O]U?.W979]^VWVRA?YP[MI>0<2KEV_S7SP>@Y8EF=_$[JV
+MPGL2*_T3R\EF=]UCEWW3?9I.K^_NOHDGV_EBR^7AMC9YE,L*[=_?2SM=X]:3
+M7@]Z.8IQ[$_=V'U\G![\\<:CZ'V+QE"I/];RZ1BWKU,O)S7[=TQV?9.]NA_=
+MF7K8?T\??B'<L+Z-W3[\6Z)=$@M_X]X]"_P47F%]Q_AC\G#3X\.OI^'7G^_?
+MC^X;+7M#N''MG=O.>II/A^D.T.WPLQMTO7NUG&K<'N$FO[OQ9H/+>89&QDW%
+ME\VNORS;>S=UH]N:PR;<['=W_OP^0J>>O91#SZY/75MP/P6X(@\44`0JV[0H
+M;F=]02'0:7C\\+!N[)7P<?'\9]E+^;B\^9%:_T[`%<YZ?Y?\V<^S0O-*650;
+M0/]3+'=??W)?WSWM[^+W=Y'(6K,:6;0;N'\YB(^WY5[\=V$GD;UF#;(8CW3O
+MXJEMDLCY>??XJP;D?A^.OPLPLM"L4A;5!FZO=U7H'2-KS6IDT6[@]GIW";UC
+M9*]9@RS&0\76H7>,G#7+7_BK%/(#OY9=FM`[1A::5<JBVL#M]:X-O6-DK5F-
+M+-H-W%[ONM`[1O::-<AB/%1L'WK'R%FS_(4$`;G?AQM"[QA9:%8IBVH#M]>[
+M,?2.D;5F-;)H-W![O9M"[QC9:]8@B_%0L7/H'2-GS?*74GI7IN#J//2.D85F
+ME;*H-G`[O:O)=XRL-:N11;N!V^E=3;YC9*]9@RS&0\62[Q@Y:Y:_5-*[*@E'
+MOF-DH5FE+*H-W%[OR'>,K#6KD46[@=OK'?F.D;UF#;(8#Q5+OF/DK%G^<I'>
+M79)PY#M&%II5RJ+:P.WUCGS'R%JS&EFT&[B]WI'O&-EKUB"+\5"QY#M&SIKE
+M+_PE"'*_#T>^8V2A6:4LJ@W<7N_(=XRL-:N11;N!V^L=^8Z1O68-LA@/%4N^
+M8^2L6?Y"009ROPO7Y*%WC"PTJY1%M8';Z5U#OF-DK5F-+-H-W$[O&O(=(WO-
+M&F0Q'BJ6?,?(6;/\I97>M4DX\ATC"\TJ95%MX/9Z1[YC9*U9C2S:#=Q>[\AW
+MC.PU:Y#%>*A8\ATC9\WR%_[_$^1^'XY\Q\A"LTI95!NXO=Z1[QA9:U8CBW8#
+MM]<[\ATC>\T:9#$>*I9\Q\A9L_R%^B/D?A^.?,?(0K-*650;N+W>D>\866M6
+M(XMV`[?7._(=(WO-&F0Q'BJ6?,?(6;/\99#>#2FX-@^]8V2A6:4LJ@W<3N]:
+M\ATC:\UJ9-%NX'9ZUY+O&-EKUB"+\5"QY#M&SIKE+Z/T;DS"D>\866A6*8MJ
+M`[?7._(=(VO-:F31;N#V>D>^8V2O68,LQD/%DN\8.6N6OTS2NRD)1[YC9*%9
+MI2RJ#=Q>[\AWC*PUJY%%NX';ZQWYCI&]9@VR&`\52[YCY*Q9_C)+[^8D'/F.
+MD85FE;*H-G![O2/?,;+6K$86[09NKW?D.T;VFC7(8CQ4+/F.D;-FY3(]@]SO
+MPG7YVKL866A6*8MJ`[?3NR[P78RL-:N11;N!V^E=%_@N1O::-<AB/%1LX+L8
+M.6N6;YGH=TA*6EW@.XA^!]7O(/H=DOI=%_@.HM]!]3N(?H>D?M<%OH/H=U#]
+M#J+?'2@V\!U$OX/J=Q#]#DE)JPM\!]'OH/H=1+]#4K_K`M]!]#NH?@?1[Y#4
+M[[K`=Q#]#JK?0?2[`\4&OH/H=U#]#J+?(2EI=8'O(/H=5+^#Z'=(ZG==X#N(
+M?@?5[R#Z'9+Z71?X#J+?0?4[B'YWH-C`=Q#]#JK?0?0[)"6M/@^]$_T.JM]!
+M]#LD];N>?"?Z'52_@^AW2.IW/?E.]#NH?@?1[PX42[X3_0ZJWT'T.R0EK9Y\
+M)_H=5+^#Z'=(ZG<]^4[T.ZA^!]'OD-3O>O*=Z'=0_0ZBWQTHEGPG^AU4OX/H
+M=TA*6CWY3O0[J'X'T>^0U.]Z\IWH=U#]#J+?(:G?]>0[T>^@^AU$OSM0+/E.
+M]#NH?@?1[Y"4M'KRG>AW4/T.HM\AJ=_UY#O1[Z#Z'42_0U*_Z\EWHM]!]3N(
+M?G>@6/*=Z'=0_0ZBWR$I:0UYZ)WH=U#]#J+?(:G?#>0[T>^@^AU$OT-2OQO(
+M=Z+?0?4[B'YWH%CRG>AW4/T.HM\A*6D-Y#O1[Z#Z'42_0U*_&\AWHM]!]3N(
+M?H>D?C>0[T2_@^IW$/WN0+'D.]'OH/H=1+]#4M(:R'>BWT'U.XA^AZ1^-Y#O
+M1+^#ZG<0_0Y)_6X@WXE^!]7O(/K=@6+)=Z+?0?4[B'Z'I*0UD.]$OX/J=Q#]
+M#DG];B#?B7X'U>\@^AV2^MU`OA/]#JK?0?2[`\62[T2_@^IW$/T.24EKS$/O
+M1+^#ZG<0_0Y)_6XDWXE^!]7O(/H=DOK=2+X3_0ZJWT'TNP/%DN]$OX/J=Q#]
+M#DE):R3?B7X'U>\@^AV2^MU(OA/]#JK?0?0[)/6[D7PG^AU4OX/H=P>*)=^)
+M?@?5[R#Z'9*2UDB^$_T.JM]!]#LD];N1?"?Z'52_@^AW2.IW(_E.]#NH?@?1
+M[PX42[X3_0ZJWT'T.R0EK9%\)_H=5+^#Z'=(ZG<C^4[T.ZA^!]'OD-3O1O*=
+MZ'=0_0ZBWQTHEGPG^AU4OXMF.LB]P&7K5X";\K5W,;+0K#S__,/USD'DV<WN
+M)F-_(!9_8)PIK%7]/L`5SGI_<;XM_7O*^ZW^1<3Y-A\O\B\BSK?Y>)%_$7&^
+MS<>+_(N(\VT3_R+B?-O$OX@XWS;Q+R+.MTW\BXCS;1/_(N)\V\2_B#C?-O$O
+M(LZW3?R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q
+M+R+.MTW\BXCS;1/_(N)\V\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;Q+^(.-\V
+M\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q+R+.MTW\B^!\V\:_",ZW;?R+X'S;
+MQK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&
+MOPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_
+M",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(
+MSK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+B/-M1K[(OX@XWV;DB_R+B/-M
+M1K[(OX@XWV;DB_R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(N(\VT3_R+B?-O$
+MOX@XWS;Q+R+.MTW\BXCS;1/_(N)\V\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;
+MQ+^(.-\V\2\BSK=-_(N(\VT3_R+B?-O$OX@XWS;Q+R+.MTW\BXCS;1/_(N)\
+MV\2_B#C?-O$O(LZW3?R+B/-M$_\BXGS;Q+^(.-\V\2\BSK=-_(O@?-O&OXC)
+MU+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4
+MOXC)U+^(R=2_B,G4OX@YSPW]BYA-_8N83?V+F$W]BYA-_8N83?V+F$W]BYA-
+M_8N83?V+F$W]BYA-_8N83?V+F$W]BYA-_8N83?V+F$W]B^<\SPW]B^>;SQ+>
+M9.W#W1:[^@/+97_KIX/>_KW_Q/6;T_:_"(C^MP&Z\Y[G&T`67,*_]UR`>W15
+MN'&/U9DF!X']@K\^"=QHW#_,OPVPJK*NNP'\)_=WMCZ.Y?,UJ]I_[FQUR9KS
+MT8)_^O;'9P6O<&;OOQ7NYK.LG\/%#1_X:.RR7#[+6B+UG;'_Q/7I;;)>"5=^
+M:7<Z-CI6K/%G69=E\RQ/SWD9.@Q/]HAG5!7/-WO:7WN[C?.FW"_L[X:JRM+_
+M3--/<]53W)#G3KG9%J[_XME^>7=?W^YN,#Z,ZOEWQL'O7`^R_<Y=X<ZV1'!9
+DF&7U8MS^O?_$];O3]K\5L`R`9ATL_2>QY5_]']#X]&&`7P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu
new file mode 100644
index 0000000..5a36a47
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.qcow.gz
+M'XL("*8S(E0``VEM9RTQ>#$M-3$R+7!C.3@N<6-O=RYO=70`K9W+CAQ'DD7W
+M^HKD^TV6F45F1O"-!KJ!V?4L9F:K?*[S`_CQ0U9%N+,LSZ6Q(5$%@40I+C*]
+M#@\AZ<#KYN;NQVJUMM6P60W3ZKQ???_U_&&KGWYQ_V/U[;__]5]O?_[Q[8^[
+M,;OYQ5/IUX.OAGGNWM8_OK8Y__'4874S_<;<]P^CN9]>7?P'K^ZG-WL]]_*/
+MNS?+S[D:C'N#JWGN9GY])DYO^+W7]S6]7;L[O;_O[;IXNVLUN+DW^.]Y[L_Y
+M];EXNULU-]Z;NZ2WZ^+M3FIN]TM87,"R5W.'8F[`IXYJ[E3,K?&I,\_9+[ZV
+M=W,;?,K4G./<JLUM\:E0<_<U</-V`7J9&_$IP9V5W$WXE.#.2NYV^)3@SDKN
+M]OB4X,Y*[@[XE.#.2NZ.^)3@SDON3OB4X,Y+[L[XE.`N__%SQ9WQ4X([K[@S
+M\ITK[KSBSLAWKKCSBCLCW[GBSBONC'SGBCNON#/RG2ONHN+.R'>AN(N*.R/?
+MA>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[H:2
+M._+=H+@;2N[(=X/B;JBX<WY*<#=4W#GY;E#<#15W3KX;%'=#Q9V3[P;%W5!Q
+MY^2[07$W5-PY^6Y0W*TK[IQ\MU;<K2ONG'RW5MRM2^[(=VO%W;KDCGRW5MRM
+M2^[(=VO%W;KDCGRW5MRM2^[(=VO%W;KDCGRW5MQM2N[(=QO%W:;DCGRW4=QM
+M*NZ"GQ+<;2KN@GRW4=QM*NZ"?+=1W&TJ[H)\MU'<;2KN@GRW4=QM*NZ"?+=1
+MW&TK[H)\MU7<;2ON@GRW5=QM2^[(=UO%W;;DCGRW5=QM2^[(=UO%W;;DCGRW
+M5=QM2^[(=UO%W;;DCGRW5=R-)7?DNU%Q-Y;<D>]&Q=U8<3?P4X*[L>)N(-^-
+MBKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKNQXFX@WXV*N^4_?^LY\MVDN)LJ
+M[@;RW:2XFTKNR'>3XFXJN2/?38J[J>2.?#<I[J:2._+=I+B;2N[(=Y/B;BJY
+M(]]-BKM=R1WY;J>XVY7<D>]VBKM=Q=V:GQ+<[2KNUN2[G>)N5W&W)M_M%'>[
+MBKLU^6ZGN-M5W*W)=SO%W:[B;DV^VRGNEO\-J>?(=WO%W;[B;DV^VRON]B5W
+MY+N]XFY?<D>^VRON]B5WY+N]XFY?<D>^VRON]B5WY+N]XFY?<D>^VRON#B5W
+MY+N#XNY0<D>^.RCN#A5W&WY*<'>HN-N0[PZ*NT/%W89\=U#<'2KN-N2[@^+N
+M4'&W(=\=%'>'BKL-^>Z@N#M6W&W(=T?%W;'B;D.^.RKNCB5WY+NCXNY8<D>^
+M.RKNCB5WY+NCXNY8<D>^.RKNCB5WY+NCXNY8<D>^.RKN3B5WY+N3XNY4<D>^
+M.RGN3A5W6WY*<'>JN-N2[TZ*NU/%W99\=U+<G2KNMN2[D^+N5'&W)=^=%'>G
+MBKLM^>ZDN#M7W&W)=V?%W;GB;DN^.RONSB5WY+NSXNY<<D>^.RONSB5WY+NS
+MXNY<<D>^.RONSB5WY+NSXNY<<D>^.PON;/F)G@/?V8W@SFY*[L!W=B.XLYN*
+MNY&?8NZL[.]&\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^;@3?F>KOK.SO1O"=
+MJ?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^;@3?F>KO
+MK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FXDWZG^SLK^;B3?J?[.ROYN
+MXJ<$=V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E
+M?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4
+M?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_M^.G!'=E?[<C
+MWZG^SLK^;D>^4_V=E?W=CGRG^CLK^[L=^4[U=U;V=SORG>KOK.SO=N0[U=]9
+MV=_MR'>JO[.RO]N1[U1_9V5_MR/?J?[.ROYN1[Y3_9V5_=V.?*?Z.RO[NQWY
+M3O5W5O9W._*=ZN^L[.]VY#O5WUG9W^W(=ZJ_L[*_V_-3@KNRO]N3[U1_9V5_
+MMR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[._VY#O5
+MWUG9W^W)=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]G97]W9Y\I_H[*_N[
+M/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?'?@IP5W9WQW(=ZJ_L[*_.Y#O5']G
+M97]W(-^I_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D
+M.]7?6=G?'<AWJK^SLK\[D.]4?V=E?W<@WZG^SLK^[D"^4_V=E?W=@7RG^CLK
+M^[L#^4[U=U;V=P?RG>KOK.SOCOR4X*[L[X[D.]7?6=G?'<EWJK^SLK\[DN]4
+M?V=E?W<DWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SO
+MCN0[U=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z
+M.RO[NR/Y3O5W5O9W)WY*<%?V=R?RG>KOK.SO3N0[U=]9V=^=R'>JO[.ROSN1
+M[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L
+M[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O5']G97]W(M^I_L[*_NY$OE/]G97]W8E\
+MI_H[*_N[,S\EN"O[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_
+M.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ
+M[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?^?+3]+<JL^![[X_Q=QYZN^6^_16
+MG3OPG:O^SE-_MYJY6RW<Q0T_Q=QYZN]6,W>K/]L<^,Y5?^>IOUM=TMD%W7_G
+MJK_SU-^UL^MSX#M7_9VG_@[FP'>N^CM/_1W,@>]<]7>>^KME[D&?`]^YZN\\
+M]7</EKE5FP/?N>KO//5W#V;N'G3NP'>N^CM/_=V#F;L'G3OPG:O^SE-_]^!R
+M=7;@.U?]G:?^KIU=GP/?N>KO//5W,`>^<]7?>>KO8`Y\YZJ_\]3?+7,/^QSY
+M3O5WGOJ[A\M<YXY\I_H[3_W=PYF[AXT[NO_.57_GJ;][.'/WL'%']]^YZN\\
+M]7</+_GLZ/X[5_V=I_ZNG5V?(]^I_LY3?P=SY#O5WWGJ[V".?*?Z.T_]W3+W
+MJ,^1[U1_YZF_>[3,->[H_CM7_9VG_N[1S-VCSAWY3O5WGOJ[1S-WCSIWY#O5
+MWWGJ[QY=KLZ.?*?Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KME
+M[G&?(]^I_LY3?_=XF>O<D>]4?^>IOWL\<_>X<4?WW[GJ[SSU=X]G[AXW[NC^
+M.U?]G:?^[O$EGQW=?^>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_G
+MJ;];YI[T.?*=ZN\\]7=/EKG&'=U_YZJ_\]3?/9FY>]*Y(]^I_LY3?_=DYNY)
+MYXY\I_H[3_W=D\O5V9'O5'_GJ;]K9]?GR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^
+MSE-_M\P][7/D.]7?>>KOGBYSG3ORG>KO//5W3V?NGC;NZ/X[5_V=I_[NZ<S=
+MT\8=W7_GJK_SU-\]O>2SH_OO7/5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y
+M\IWJ[SSU=\O<LSY'OE/]G:?^[MDRU[BC^^]<]7>>^KMG,W?/.G?D.]7?>>KO
+MGLW</>O<D>]4?^>IOWMVN3H[\IWJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.4W\'
+M<^0[U=]YZN^6N>=]CGRG^CM/_=WS9:YS1[Y3_9VG_N[YS-WSQAW=?^>JO_/4
+MWSV?N7O>N*/[[USU=Y[ZN^>7?'9T_YVK_LY3?]?.KL^1[U1_YZF_@SGRG>KO
+M//5W,$>^4_V=I_YNF7O1Y\AWJK_SU-^]6.8:=W3_G:O^SE-_]V+F[D7GCGRG
+M^CM/_=V+F;L7G3ORG>KO//5W+RY79T>^4_V=I_ZNG5V?(]^I_LY3?P=SY#O5
+MWWGJ[V".?*?Z.T_]W3+WLL^1[U1_YZF_>[G,=>[(=ZJ_\]3?O9RY>]FXH_OO
+M7/5WGOJ[ES-W+QMW=/^=J_[.4W_W\I+/CNZ_<]7?>>KOVMGU.?*=ZN\\]7<P
+M1[Y3_9VG_@[FR'>JO_/4WRUSK_H<^4[U=Y[ZNU?+7...[K]SU=]YZN]>S=R]
+MZMR1[U1_YZF_>S5S]ZIS1[Y3_9VG_N[5Y>KLR'>JO_/4W[6SZW/D.]7?>>KO
+M8(Y\I_H[3_T=S)'O5'_GJ;];YE[W.?*=ZN\\]7>OE[G.'?E.]7>>^KO7,W>O
+M&W=T_YVK_LY3?_=ZYNYUXX[NOW/5WWGJ[UY?\MG1_7>N^CM/_5T[NSY'OE/]
+MG:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[9>Y-GR/?J?[.4W_W9IEKW-']=Z[Z.T_]
+MW9N9NS>=._*=ZN\\]7=O9N[>=.[(=ZJ_\]3?O;E<G1WY3O5WGOJ[=G9]CGRG
+M^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU=\O<VSY'OE/]G5?]7=#]=Z[Z.Z_ZNZ#[
+M[USU=U[U=T'WW[GJ[[SJ[X+NOW/5WWG5WP7=?^>JO_.JOPNZ_\Y5?^=5?Q=T
+M_YVK_LY%?_>NSY'O5'_GJ;][M\PU[NC^.U?]G:?^[MW,W;O.'?E.]7>>^KMW
+M,W?O.G?D.]7?>>KOWEVNSHY\I_H[3_U=.[L^1[Y3_9VG_@[FR'>JO_/4W\$<
+M^4[U=['\),W=]#GP7:C^[OLG[G&W^.FF<P>^"]7?1>KO;N:]F\8=W7\7JK^+
+MU-_=S-S=-.[H_KM0_5VD_N[FDL^.[K\+U=]%ZN_:V?4Y\%VH_BY2?P=SX+M0
+M_5VD_@[FP'>A^KM(_=TR9WT.?!>JOXO4W]DRU[BC^^]"]7>1^CN;7YYU[L!W
+MH?J[2/V=S=Q9YPY\%ZJ_B]3?V>7J[,!WH?J[2/U=.[L^![X+U=]%ZN]@#GP7
+MJK^+U-_!'/@N5'\7J;];YKS/D>]4?Q>IO_-EKG-'OE/]7:3^SF?NO'%']]^%
+MZN\B]7<^<^>-.[K_+E1_%ZF_\TL^.[K_+E1_%ZF_:V?7Y\AWJK^+U-_!'/E.
+M]7>1^CN8(]^I_BY2?[?,19\CWZG^+E)_%\M<XX[NOPO5WT7J[V+F+CIWY#O5
+MWT7J[V+F+CIWY#O5WT7J[^)R=7;D.]7?1>KOVMGU.?*=ZN\B]7<P1[Y3_5VD
+M_@[FR'>JOXO4WRUS0Y\CWZG^+E)_-RQSG3ORG>KO(O5WP\S=T+BC^^]"]7>1
+M^KMAYFYHW-']=Z'ZNTC]W7#)9T?WWX7J[R+U=^WL^ASY3O5WD?H[F"/?J?XN
+M4G\'<^0[U=]%ZN^6N76?(]^I_BY2?[=>YAIW=/]=J/XN4G^WGKE;=^[(=ZJ_
+MB]3?K6?NUIT[\IWJ[R+U=^O+U=F1[U1_%ZF_:V?7Y\AWJK^+U-_!'/E.]7>1
+M^CN8(]^I_BY2?[?,;?H<^4[U=Y'ZN\TRU[DCWZG^+E)_MYFYVS3NZ/Z[4/U=
+MI/YN,W.W:=S1_7>A^KM(_=WFDL^.[K\+U=]%ZN_:V?4Y\IWJ[R+U=S!'OE/]
+M7:3^#N;(=ZJ_B]3?+7/;/D>^4_U=I/YNN\PU[NC^NU#]7:3^;CMSM^W<D>]4
+M?Q>IO]O.W&T[=^0[U=]%ZN^VEZNS(]^I_BY2?]?.KL^1[U1_%ZF_@SGRG>KO
+M(O5W,$>^4_U=I/YNF1O['/E.]7>1^KMQF>O<D>]4?Q>IOQMG[L;&'=U_%ZJ_
+MB]3?C3-W8^..[K\+U=]%ZN_&2SX[NO\N5'\7J;]K9]?GR'>JOXO4W\$<^4[U
+M=Y'Z.Y@CWZG^+E)_M\Q-?8Y\I_J[2/W=M,PU[NC^NU#]7:3^;IJYFSIWY#O5
+MWT7J[Z:9NZES1[Y3_5VD_FZZ7)T=^4[U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7
+MJ;^#.?*=ZN\B]7?+W/L^1[Y3_5VD_N[],M>Y(]^I_BY2?_=^YNY]XX[NOPO5
+MWT7J[][/W+UOW-']=Z'ZNTC]W?M+/CNZ_RY4?Q>IOVMGU^?(=ZJ_B]3?P1SY
+M3O5WD?H[F"/?J?XN4G^WS'WH<^0[U=]%ZN\^+'.-.[K_+E1_%ZF_^S!S]Z%S
+M1[Y3_5VD_N[#S-V'SAWY3O5WD?J[#Y>KLR/?J?XN4G_7SJ[/D>]4?Q>IOX,Y
+M\IWJ[R+U=S!'OE/]7:3^;IG[V.?(=ZJ_B]3??5SF.G?D.]7?1>KO/L[<?6S<
+MT?UWH?J[2/W=QYF[CXT[NO\N5'\7J;_[>,EG1_??A>KO(O5W[>SZ'/E.]7>1
+M^CN8(]^I_BY2?P=SY#O5WT7J[Y:Y3WV.?*?ZNTC]W:=EKG%']]^%ZN\B]7>?
+M9NX^=>[(=ZJ_B]3??9JY^]2Y(]^I_BY2?_?I<G5VY#O5WT7J[]K9]3GRG>KO
+M(O5W,$>^4_U=I/X.YLAWJK^+U-\M<Y_['/E.]7>1^KO/RUSGCGRG^KM(_=WG
+MF;O/C3NZ_RY4?Q>IO_L\<_>Y<4?WWX7J[R+U=Y\O^>SH_KM0_5VD_JZ=79\C
+MWZG^+E)_!W/D.]7?1>KO8(Y\I_J[2/W=,O>ESY'O5'\7J;_[LLPU[NC^NU#]
+M7:3^[LO,W9?.'?E.]7>1^KLO,W=?.G?D.]7?1>KOOERNSHY\I_J[2/U=.[L^
+M1[Y3_5VD_@[FR'>JOXO4W\$<^4[U=\/RDS3WM<^![P;5WPVIO_NZS'7NP'??
+MGV+NAM3??9VY^[IP-]SP4\S=D/J[KS-W7_]L<^"[0?5W0^KOOE[2V0UT_UW[
+MT)_X]C;]^/;'R]O!]>W;'7QULX._ZT]\^\?;^W^UP=OK:OZ#P?5ZM;L>_)_Y
+M#:]OKZN9AM5AH/=U/O>/Z@W?S=&W/_\KYS?\S>>WO7W#Z^UJ6*_6F]7HO_L*
+M_^^?_PMO>/OWO>&[N9*_]H+M=^9N_[S]Z9_\\>VF6T@I/W$W=W5QW9;NY^DO
+MXH=@3O0)^>KH^[W_!5BV5W?@_/QUOOV.\=__Y7CY_Q_I(M'V]5WUUT=-^;VW
+M^XO7M[I^N[=_IFWO__/VTYP7;W=U?V[_RZ_MKU_=@^M71]]3_:]\,:YN<OG-
+MW[D_1N[_SKV;\[]7!-.MF7_\L;.#O^M/?/OWV_M_W0T.MX-__#]^(%]-$*<`
+!````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu
new file mode 100644
index 0000000..632e42a
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.qcow2.gz
+M'XL(")D[(U0``VEM9RTQ>#$M-3$R+7!C.3@N<6-O=S(N;W5T`*V8VY+3,`R&
+M[_L4+H<%%BBQ9*<)AP7VP`QW<`%<M]WV*?KP;&)ME"A2W.VDS62FX_[?R/$7
+M-6Y1I)=ST;M0NE"[P]8]?*8#7._#\'#'WS]^KOJOXR+!?&&DE(&`'6[`NF$<
+M6+C"CP>\CNM5APH.'E-C4`X7S.JF!A3<Y:*]=.UB5"*!YP`3SER,L^J#5)],
+MA#/K@[GK0_WZQ<><'"BGZ\-4GTRM+5R5Q8&2JBW<)HM#);6U<+LL+BBI>PNW
+MS^*BDCH8.)]1Y0%7*BEOX2"+6RLIM'`ABZN4E.6=SWM7*RG+.Y_W;J.D+.]\
+MWKNMDK*\\WGO=DK*\L[GO;M74I9W8'CG&+=74I9W(+Q;$NX9XPY*RO(.A'?/
+M"?>BPWDM97D'PKN7A+M@G-+OP/(.A'>O"/>:<4J_`\L[$-Z](=PEXY1^!Y9W
+M(+Q[2[AWC%/Z'5C>@?#N_<@[K_0[L+Q#X=T'8A6,4_H=6MZA\,X3#ABG]#NT
+MO$/A'1(N,$[I=VAYA\*[2+B2<4J_0\L[%-ZM"5<Q3NEW:'F'PKN:<!\9I_0[
+MM+Q#X=TGPGUFG-+OT/(.A7=?"'?%.*7?H>5=$-Y])=PWQBG]+EC>!>'==\)=
+M,T[I=\'R+@CO;@AWV^%`2W7>%85^$.YN=,_"O,^?@9^/O7*V!R:`U5.`4Q4F
+M7#WKA&.:<*/!1CG;`\?KU?#=`5MAG@",T6W&P#]IPC$)4P>W"]J\#@<^3KA^
+M<6YA8K,DLUX_:"<<U\U=$4M7P:D5_KO[JTP8YIMPPMG;>1KH"O:GX-KM?.^;
+MOO]P9@X,'\Z6C)O<SC=[E+TV8%87YY4%H!*Y_CJWFZL=[T+%HVVWOH[K4YH!
+M#*8[49\;3[?YU>UVQV(5VP7(3-<-<=O)M9VN;CFN;C?S8J"\,TZ\<QO(\,Y-
+H.)BW$83TOU[1]LC1V1XX_EH-WPD8"#C;%0QE\]NQ^`\?5I30@Q0`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu
new file mode 100644
index 0000000..4145c82
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.raw.gz
+M'XL(".K%'50``VEM9RTQ>#$M-3$R+7!C.3@N<F%W+F]U=`"ME$$.@R`01?>>
+M8MQV86`<JFZ;=-]-V[4U]10<OB!4!00U`0PQ^?#R/P,P9AH`(;!^8XP+\E:Y
+M71:78J+Q\1Q0".A#X%,!)QQJ?QW!0*#^O`_&<?D<059>^^.X$D.07145-G`V
+M+F7>/YP"BP9(@+A"BT<=ON^OC<"8+[#!X1YN-LR/X&J]:C53N44^XV*"P966
+M52XX2KE3"/8]%5;D/2R(K;=N76=@Z@P/P%JKH0N<ZPN+ORZT@4[<A#\(X_8:
+MU[CS^0J'.W'!Q7V2M4V[*T-W0^9BU/[-.'AS-<2]N0:'>1\"FEYF=0+U&QF,
+8<4$^*K<;(%E@MATDU,#B!\3RH'-%!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu
new file mode 100644
index 0000000..fd654d6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.vhd.gz
+M'XL("/\TQ%4``VEM9RTQ>#$M-3$R+7!C.3@N=FAD+F]U=`"ME\%RHS`,AN]Y
+M"F7VU@-C"V.3:V=Z[V6W9T)(-]/9;:?)H0?Z[I7`!AL#378-Q$-BZ^.7+`M'
+MB/X`T#GH(^@&=,'W1H'>@2D!J-->V+72?H6V?OW;U)?31V:/=M/#I/"M0G.V
+MQQP4/<0`5OP0?>![:!TF^_'P?'?Z\^QP:'%H085AJQQ![Z/G*/JU[-4QZ>F$
+M+QWR_O>@+H_5C5;T,0<0"J3T1N1.'6&RS]!915;'8W<9$$T7'W<%7X*.T=E)
+M[`HQL?)DS@55C,[.X?2:U2VXNXV=BSY5*#$,M0*T!(-\3VGCXA!=E"H?Y[?J
+M_=Q,].%"JNA!GXSZ\F5WT:8*NL%6@>)T7G,7.LIEBIM)E?^*G@[ME+VA((C"
+M=6#G?AB]$06^/BW%2LR7)V-17\7Z:#&(:J9=[FCOL_`<@/OC;<"B@"H&_G0.
+MUZQOIZ!6<W'WG;QJ==0+V??/\]LDCA]V#E.]HW)9:"CQ6H5/#[]F',9T#O<X
+M_`XW");7X');^]Q(4HO#VV:QH\=M+6L[XM2:.EYSS4W.%FF3!>MR8N?/,PC*
+MX1I$Z54%#SC,+XSZ=K$,#-Q=T0>QNQ7C3#A>>CC\QET(<?O5N5U7MXW5U8DG
+MXS!=&5>N7(:$*[?'8=I"H+K*3!G(-3)JESO:QRP\>R#:4I_LW8&V-B=3J"PP
+MF4)EJW-"A:I93;9;LU!;A8DVXHQ+N!%G7,*-..,2;L09EW`CSKB$&W'&)=V(
+/:_J+)<3F"Q0&'5:]#0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu
new file mode 100644
index 0000000..ba3cfda
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.vhdf.gz
+M'XL("&HEAE4``VEM9RTQ>#$M-3$R+7!C.3@N=FAD9BYO=70`K94];X,P$(;W
+M_(J+NF6([,,VL%;*GJ7M#!2BJ&J[=.C`CZ]M3/#90$AEL)"CXYZ\Y_N`L>$"
+M$`BLFGDN&_KG([W[W6%G:;Q[#"@E5#'P10,M#HV^4D`C0.^"!5TW+6+HC\$U
+MXK@VQB#GM6B8P;EP1>+S0QNPS$%(D`H*W*KP[?0Z$S"F"WC`X3W<33#?@LN,
+ME_>F5HO\AELR#+B]8^TGG%A3IQ&L?2A8F;98$(O`S\\S,%W##;#"V9`";_F%
+M25\9RT`2[HH^B,.M#"ZG[W,/AW?"!8JK5W.[KFX?JVL2)R,+.V-CYQH([=P!
+MAVD'@;"365>@F9'1<]G0GX_T'H#"`9.=H'3?#I6!ZD"UH*39YP)4"7GA`Y%6
+M4M]\?[7-S_77S[#!\6"B^\OX8V:Z1>6`E?D3]6[VGKZGT^5P_;R,N'%4C1-)
+M-YOVRA!4'84K@V:[XH=%GB=U67Q(TC^]4@$3P#D)W*D[TW*6-K]CL&T'M;#G
+A,R[R@QAF1Y7!219X_3>W`TXE+A7]5=O]`1)P9+AP"```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu
new file mode 100644
index 0000000..7f13ae4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu
@@ -0,0 +1,82 @@
+# $FreeBSD$
+begin 644 img-1x1-512-pc98.vmdk.gz
+M'XL(".O%'50``VEM9RTQ>#$M-3$R+7!C.3@N=FUD:RYO=70`K5Q=;]S($7SW
+MKZ!]+T$>%JSE]X.!Y"('"((`QOER]QI^YH2</R`+00SLCP^'G!H5M:*&=VIY
+MY>5XNVNG>W9+<G5ATW3]2I*\2_(\R8>D*),4R?Q/ZRU)LX?%?#O7?.#R]YM_
+M_'3BUQ].I\NK%0PN2U*0*IPL-L]S.3WZ(MSYN:S-`_/M'(7+7%9WE>CASCL/
+M[,+E\X/GIU*XNW9Y>'`7`I<$H&0#5SQ1TVZQS^WNCZ]\\]S^,K>'^7C+)JFR
+MI.S\,BF+99TEU7EY+$VJ.6B:`;]+;FZ__B>Y&;_V=[=?[C_[_9W=V<[!>>GB
+MR]XAS(55I;MP#SBXQD&48Y(-20;W<'*Y^^OMK^/IO^/=U]O/G]Z"Y9[=V>99
+MDC=N.RX^?;AM%NY)TJ2$>X[D\I>_W;SUK]ST]*6](YS+FC<R/_=<A^*69>*^
+MKV_+[L9/]PYQ\E]A=^YL?7.*Y;ES=U'D2=4DRW8*AWV>'QY\R4OO^KNQO1]_
+M_/9E?/OFX^=/H7?N;%W+F@6H7AJ5)47FH'QIKGV%0W0OF^74DLNOM_>_W/8?
+MYC*_CF].WR6$*UWOY@.L_;[6JN>4<O=DYVU?WOWO?JXW&?S)WA)NV<12Q/S<
+MQ3DI*H<U'^!R%.<DR]W5_$_SAN=*<KB@Y/+YT^F'G^>WN&O6A_=__H%P]9PU
+M1\X;G%/F@C8U%6O]Q>.797+Y\"YYXXK\\9=Q>042KEG?9BYX/0<LR[.[\%U;
+MX1V)Y>Z!Y623F_:^3;YOOXZG[VYNO@\GV[IB\^4V;VUT*.4*[5[?2SOGQJTG
+MO1[T<A3#T)W:H?UR/]ZYXPU'T;D6#;Y2=ZSYPS%NGZ=:3FIRKYCD\C9Y<SO,
+M9^I@_SU^_DBX?GT9S_MP+XEF2<S<Q?SJ6>!'_PSK*\8=DX,;[^^^G?IOO]Y^
+M&N8W6O*6<,/:NWD[ZVD^'.9\@/,.G]S@W+LWRZF&[1%N=+L;KC:XG*=O9-A4
+M>-KD\G'9WB]C.\Q;F[$)-[G=G9_>A^_4HZ>:T9/+0]<6W*\>+DL]!62>RC8M
+M"MM9GU`(=.SO/]^M&WLC?)P]_EGV4C[.KWZD5K\3<(6SWE^9/OIYEFE>+HMB
+M`^A^BJ7S]Y_F[_</^RO=_DJ)K#2KED6S@?O7#/'ENMS2O0M;B>PTJY?%<*1[
+MI:.V42*GQ]WCKQJ0ZWTX_B[`R$RS<ED4&[B]WA6^=XRL-*N61;.!V^M=Z7O'
+MR$ZS>ED,AXJM?.\8.6F6N^.O4D@/_%I6UKYWC,PT*Y=%L8';ZUWC>\?(2K-J
+M630;N+W>M;YWC.PTJY?%<*C8SO>.D9-FN3L2!.1Z'Z[WO6-DIEFY+(H-W%[O
+M!M\[1E::5<NBV<#M]6[TO6-DIUF]+(9#Q4Z^=XR<-,O=Y=*[/`97I;YWC,PT
+M*Y=%L8';Z5U%OF-DI5FU+)H-W$[O*O(=(SO-ZF4Q'"J6?,?(2;/<72&]*Z)P
+MY#M&9IJ5RZ+8P.WUCGS'R$JS:EDT&[B]WI'O&-EI5B^+X5"QY#M&3IKE[DKI
+M71F%(]\Q,M.L7!;%!FZO=^0[1E::5<NBV<#M]8Y\Q\A.LWI9#(>*)=\Q<M(L
+M=\=?@B#7^W#D.T9FFI7+HMC`[?6.?,?(2K-J630;N+W>D>\8V6E6+XOA4+'D
+M.T9.FN7N*,A`KG?AZM3WCI&99N6R*#9P.[VKR7>,K#2KED6S@=OI74V^8V2G
+M6;TLAD/%DN\8.6F6NVND=TT4CGS'R$RS<ED4&[B]WI'O&%EI5BV+9@.WUSOR
+M'2,[S>IE,1PJEGS'R$FSW!W__P2YWH<CWS$RTZQ<%L4&;J]WY#M&5II5RZ+9
+MP.WUCGS'R$ZS>ED,AXHEWS%RTBQW1_T1<KT/1[YC9*99N2R*#=Q>[\AWC*PT
+MJY9%LX';ZQWYCI&=9O6R&`X52[YCY*19[JZ7WO4QN";UO6-DIEFY+(H-W$[O
+M&O(=(RO-JF71;.!V>M>0[QC9:58OB^%0L>0[1DZ:Y>X&Z=T0A2/?,3+3K%P6
+MQ09NKW?D.T96FE7+HMG`[?6.?,?(3K-Z60R'BB7?,7+2+'<W2N_&*!SYCI&9
+M9N6R*#9P>[TCWS&RTJQ:%LT&;J]WY#M&=IK5RV(X5"SYCI&39KF[27HW1>'(
+M=XS,-"N71;&!V^L=^8Z1E6;5LF@V<'N](]\QLM.L7A;#H6+)=XR<-"N5Z1GD
+M>A>N3=?>A<A,LW)9%!NXG=ZUGN]"9*59M2R:#=Q.[UK/=R&RTZQ>%L.A8CW?
+MA<A)LUS+1+]#5-)J/=]!]#NH?@?1[Q#5[UK/=Q#]#JK?0?0[1/6[UO,=1+^#
+MZG<0_>Y`L9[O(/H=5+^#Z'>(2EJMYSN(?@?5[R#Z':+Z7>OY#J+?0?4[B'Z'
+MJ'[7>KZ#Z'=0_0ZBWQTHUO,=1+^#ZG<0_0Y12:OU?`?1[Z#Z'42_0U2_:SW?
+M0?0[J'X'T>\0U>]:SW<0_0ZJWT'TNP/%>KZ#Z'=0_0ZBWR$J:76I[YWH=U#]
+M#J+?(:K?=>0[T>^@^AU$OT-4O^O(=Z+?0?4[B'YWH%CRG>AW4/T.HM\A*FEU
+MY#O1[Z#Z'42_0U2_Z\AWHM]!]3N(?H>H?M>1[T2_@^IW$/WN0+'D.]'OH/H=
+M1+]#5-+JR'>BWT'U.XA^AZA^UY'O1+^#ZG<0_0Y1_:XCWXE^!]7O(/K=@6+)
+M=Z+?0?4[B'Z'J*35D>]$OX/J=Q#]#E']KB/?B7X'U>\@^AVB^EU'OA/]#JK?
+M0?2[`\62[T2_@^IW$/T.44FK3WWO1+^#ZG<0_0Y1_:XGWXE^!]7O(/H=HOI=
+M3[X3_0ZJWT'TNP/%DN]$OX/J=Q#]#E%)JR??B7X'U>\@^AVB^EU/OA/]#JK?
+M0?0[1/6[GGPG^AU4OX/H=P>*)=^)?@?5[R#Z':*25D^^$_T.JM]!]#M$];N>
+M?"?Z'52_@^AWB.IW/?E.]#NH?@?1[PX42[X3_0ZJWT'T.T0EK9Y\)_H=5+^#
+MZ'>(ZG<]^4[T.ZA^!]'O$-7O>O*=Z'=0_0ZBWQTHEGPG^AU4OX/H=XA*6D/J
+M>R?Z'52_@^AWB.IW`_E.]#NH?@?1[Q#5[P;RG>AW4/T.HM\=*)9\)_H=5+^#
+MZ'>(2EH#^4[T.ZA^!]'O$-7O!O*=Z'=0_0ZBWR&JWPWD.]'OH/H=1+\[4"SY
+M3O0[J'X'T>\0E;0&\IWH=U#]#J+?(:K?#>0[T>^@^AU$OT-4OQO(=Z+?0?4[
+MB'YWH%CRG>AW4/T.HM\A*FD-Y#O1[Z#Z'42_0U2_&\AWHM]!]3N(?H>H?C>0
+M[T2_@^IW$/WN0+'D.]'OH/I=,--!K@4N6;\]W)BNO0N1F6:EZ=.WN7<S1)I<
+M[6XT]@=B\0>&F<):U>\#7.&L]Q?FV]*_A[S?ZE]$F&_S]B+_(L)\F[<7^1<1
+MYMN\O<B_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3
+M_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M
+M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS
+M;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+\(SK=M_(O@?-O&OPC.
+MMVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW
+M;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M
+M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\
+MB^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OX@PWV;DB_R+"/-M1K[(OX@P
+MWV;DB_R+"/-M1K[(OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW
+M3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,
+MMTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\B
+MS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_",ZW;?R+
+M&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L8
+M3?V+&$W]BQA-_8L83?V+F-+4T+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(
+MR=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+]X3M/4T+]XOOHL
+MX4W6/MQUL:L_,%_VMWXZZ/7?^P]<OC]M_P1`3+\-L"B2]AKPG[[@?/F\WB9/
+M^ORINJ;IX18K>(6S[E]NW+]R*;BHW`?%%F52GX_N\.=W/SU1<&E7\`IW]>'3
+MC^'"A@]\EG6Y?$"Q1KKWU(-HN??`"O?:8[U^@,N?VYW.>8X5:_SAT^7R(<`:
+MJ^>\3`GZ!S_#(VX)YYL\[*^YWL9Y4^XS^[OBEG+Y$&#]^%4]Q0W;[92;;.&Z
+M9\_V^=V]OMY=;WP85Q]E>_"=ZT"V[]P5[FQ+!/7"S*MYXOKO_0<N[T_;/RM@
+-O@"^^C_.+8_6X%X`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow.gz.uu
new file mode 100644
index 0000000..e8eb9e2
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow.gz.uu
@@ -0,0 +1,125 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.qcow.gz
+M'XL("*@S(E0``VEM9RTQ>#$M-3$R+79T;V,X+G%C;W<N;W5T`*V=VZX;QY(%
+MW_T5U/TN,3.;9+?N.!@<8!X&.(/Y`?/Z3,RS/GXD[>XJ[60LY1G8LF!($&J!
+MNQ0.&':@M%[??5NM-K8:MJMA6ET.J^\_G[_;ZI>?W/^^^O;?__S/M[]^^_;'
+MW9BM?W,J_7SPE<US][;^T>?\QZGC:CW]&W/?O^/<+Y\N_A^?[I<O]G;NY1]W
+M7RR?<S48]P97\]QZ_GPF;F_X]S[?U_3EVMWM_7U?KHLO=Z,&M_<&_S7/_3E_
+M/A=?[D[-C??FKNG+=?'E3FIN_UM87,!R4'/'8F[`4R<U=R[F-GCJPG/VF]_;
+MN[DMGC(UYSBW:G,[/!5J;K@WMWZ[`+W,C7A*<&<E=Q.>$MQ9R=T>3PGNK.3N
+M@*<$=U9R=\13@CLKN3OA*<&=E]R=\93@SDON+GA*<.<5=\:G!'=><6?D.U?<
+M><6=D>]<<><5=T:^<\6=5]P9^<X5=UYQ9^0[5]Q%Q9V1[T)Q%Q5W1KX+Q5V4
+MW)'O0G$7)7?DNU#<1<D=^2X4=U%R1[X+Q5V4W)'O0G$7)7?DNU#<#25WY+M!
+M<3>4W)'O!L7=4''G?$IP-U3<.?EN4-P-%7=.OAL4=T/%G9/O!L7=4''GY+M!
+M<3=4W#GY;E#<;2KNG'RW4=QM*NZ<?+=1W&U*[LAW&\7=IN2.?+=1W&U*[LAW
+M&\7=IN2.?+=1W&U*[LAW&\7=IN2.?+=1W&U+[LAW6\7=MN2.?+=5W&TK[H)/
+M">ZV%7=!OMLJ[K85=T&^VRKNMA5W0;[;*NZV%7=!OMLJ[K85=T&^VRKN=A5W
+M0;[;*>YV%7=!OMLI[G8E=^2[G>)N5W)'OMLI[G8E=^2[G>)N5W)'OMLI[G8E
+M=^2[G>)N5W)'OMLI[L:2._+=J+@;2^[(=Z/B;JRX&_B4X&ZLN!O(=Z/B;JRX
+M&\AWH^)NK+@;R'>CXFZLN!O(=Z/B;JRX&\AWH^)N^<_?>HY\-RGNIHJ[@7PW
+M*>ZFDCORW:2XFTKNR'>3XFXJN2/?38J[J>2.?#<I[J:2._+=I+B;2N[(=Y/B
+M;E]R1[[;*^[V)7?DN[WB;E]QM^%3@KM]Q=V&?+=7W.TK[C;DN[WB;E]QMR'?
+M[15W^XJ[#?ENK[C;5]QMR'=[Q=WROR'U'/GNH+@[5-QMR'<'Q=VAY(Y\=U#<
+M'4KNR'<'Q=VAY(Y\=U#<'4KNR'<'Q=VAY(Y\=U#<'4KNR'<'Q=VQY(Y\=U3<
+M'4ONR'='Q=VQXF[+IP1WQXJ[+?GNJ+@[5MQMR7='Q=VQXFY+OCLJ[HX5=UOR
+MW5%Q=ZRXVY+OCHJ[4\7=EGQW4MR=*NZVY+N3XNY4<D>^.RGN3B5WY+N3XNY4
+M<D>^.RGN3B5WY+N3XNY4<D>^.RGN3B5WY+N3XNY<<D>^.RONSB5WY+NSXNY<
+M<;?C4X*[<\7=CGQW5MR=*^YVY+NSXNY<<;<CWYT5=^>*NQWY[JRX.U?<[<AW
+M9\7=I>)N1[Z[*.XN%7<[\MU%<7<IN2/?711WEY([\MU%<7<IN2/?711WEY([
+M\MU%<7<IN2/?711WEY([\MU%<&?+#_0<^,[6@CM;E]R![VPMN+-UQ=W(IY@[
+M*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>JO[.ROQO!=Z;Z.RO[NQ%\9ZJ_L[*_
+M&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>JO[.ROQO!=Z;Z.RO[NQ%\
+M9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;R7>JO[.ROQO)=ZJ_L[*_F_B4X*[L
+M[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ
+M[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F
+M\IWJ[ZSL[R;RG>KOK.SO)O*=ZN^L[.\F\IWJ[ZSL[_9\2G!7]G=[\IWJ[ZSL
+M[_;D.]7?6=G?[<EWJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^4_V=E?W=GGRG
+M^CLK^[L]^4[U=U;V=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.RO]N3[U1_9V5_
+MMR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NP.?$MR5_=V!?*?Z.RO[NP/Y3O5W
+M5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`
+MOE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?6=G?'<AWJK^S
+MLK\[D.]4?V=E?W<@WZG^SLK^[LBG!'=E?W<DWZG^SLK^[DB^4_V=E?W=D7RG
+M^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[U=]9V=\=R7>JO[.ROSN2[U1_9V5_
+M=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z.RO[NR/Y3O5W5O9W1_*=ZN^L[.^.Y#O5
+MWUG9WQW)=ZJ_L[*_._$IP5W9WYW(=ZJ_L[*_.Y'O5']G97]W(M^I_L[*_NY$
+MOE/]G97]W8E\I_H[*_N[$_E.]7=6]G<G\IWJ[ZSL[T[D.]7?6=G?G<AWJK^S
+MLK\[D>]4?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3^4[U=U;V=R?R
+MG>KOK.SOSGQ*<%?V=V?RG>KOK.SOSN0[U=]9V=^=R7>JO[.ROSN3[U1_9V5_
+M=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5
+MWUG9WYW)=ZJ_L[*_.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[
+M"Y\2W)7]W85\I_H[*_N["_E.]7=6]G<7\IWJ[ZSL[R[D.]7?6=G?7<AWJK^S
+MLK^[D.]4?V=E?W<AWZG^SLK^[D*^4_V=E?W=A7RG^CLK^[L+^4[U=U;V=Q?R
+MG>KOK.SO+N0[U=]9V=]=R'>JO_/E!VENU>?`=]]/,7>>^KOE/;U5YPY\YZJ_
+M\]3?K6;N5@MWL>93S)VG_FXU<[?ZL\V![USU=Y[ZN]4UW5W0^W>N^CM/_5V[
+MNSX'OG/5WWGJ[V`.?.>JO_/4W\$<^,Y5?^>IOUOF'O0Y\)VK_LY3?_=@F5NU
+M.?"=J_[.4W_W8.;N0><.?.>JO_/4WSV8N7O0N0/?N>KO//5W#ZXW=P>^<]7?
+M>>KOVMWU.?"=J_[.4W\'<^`[5_V=I_X.YL!WKOH[3_W=,O>PSY'O5'_GJ;][
+MN,QU[LAWJK_SU-\]G+E[V+BC]^]<]7>>^KN',W</&W?T_IVK_LY3?_?PFN^.
+MWK]SU=]YZN_:W?4Y\IWJ[SSU=S!'OE/]G:?^#N;(=ZJ_\]3?+7./^ASY3O5W
+MGOJ[1\M<XX[>OW/5WWGJ[Q[-W#WJW)'O5'_GJ;][-'/WJ'-'OE/]G:?^[M'U
+MYN[(=ZJ_\]3?M;OK<^0[U=]YZN]@CGRG^CM/_1W,D>]4?^>IOUOF'O<Y\IWJ
+M[SSU=X^7N<X=^4[U=Y[ZN\<S=X\;=_3^G:O^SE-_]WCF[G'CCMZ_<]7?>>KO
+M'E_SW='[=Z[Z.T_]7;N[/D>^4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KME[DF?
+M(]^I_LY3?_=DF6O<T?MWKOH[3_W=DYF[)YT[\IWJ[SSU=T]F[IYT[LAWJK_S
+MU-\]N=[<'?E.]7>>^KMV=WV.?*?Z.T_]'<R1[U1_YZF_@SGRG>KO//5WR]S3
+M/D>^4_V=I_[NZ3+7N2/?J?[.4W_W=.;N:>..WK]SU=]YZN^>SMP];=S1^W>N
+M^CM/_=W3:[X[>O_.57_GJ;]K=]?GR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^SE-_
+MM\P]ZW/D.]7?>>KOGBUSC3MZ_\Y5?^>IOWLV<_>L<T>^4_V=I_[NV<S=L\X=
+M^4[U=Y[ZNV?7F[LCWZG^SE-_U^ZNSY'O5'_GJ;^#.?*=ZN\\]7<P1[Y3_9VG
+M_FZ9>][GR'>JO_/4WSU?YCIWY#O5WWGJ[Y[/W#UOW-'[=Z[Z.T_]W?.9N^>-
+M.WK_SE5_YZF_>W[-=T?OW[GJ[SSU=^WN^ASY3O5WGOH[F"/?J?[.4W\'<^0[
+MU=]YZN^6N1=]CGRG^CM/_=V+9:YQ1^_?N>KO//5W+V;N7G3NR'>JO_/4W[V8
+MN7O1N2/?J?[.4W_WXGIS=^0[U=]YZN_:W?4Y\IWJ[SSU=S!'OE/]G:?^#N;(
+M=ZJ_\]3?+7,O^QSY3O5WGOJ[E\M<YXY\I_H[3_W=RYF[EXT[>O_.57_GJ;][
+M.7/WLG%'[]^YZN\\]7<OK_GNZ/T[5_V=I_ZNW5V?(]^I_LY3?P=SY#O5WWGJ
+M[V".?*?Z.T_]W3+WJL^1[U1_YZF_>[7,->[H_3M7_9VG_N[5S-VKSAWY3O5W
+MGOJ[5S-WKSIWY#O5WWGJ[UY=;^Z.?*?Z.T_]7;N[/D>^4_V=I_X.YLAWJK_S
+MU-_!'/E.]7>>^KME[G6?(]^I_LY3?_=ZF>O<D>]4?^>IOWL]<_>Z<4?OW[GJ
+M[SSU=Z]G[EXW[NC].U?]G:?^[O4UWQV]?^>JO_/4W[6[ZW/D.]7?>>KO8(Y\
+MI_H[3_T=S)'O5'_GJ;];YM[T.?*=ZN\\]7=OEKG&';U_YZJ_\]3?O9FY>].Y
+M(]^I_LY3?_=FYNY-YXY\I_H[3_W=F^O-W9'O5'_GJ;]K=]?GR'>JO_/4W\$<
+M^4[U=Y[Z.Y@CWZG^SE-_M\R][7/D.]7?>=7?!;U_YZJ_\ZJ_"WK_SE5_YU5_
+M%_3^G:O^SJO^+NC].U?]G5?]7=#[=Z[Z.Z_ZNZ#W[USU=U[U=T'OW[GJ[UST
+M=^_Z'/E.]7>>^KMWRUSCCMZ_<]7?>>KOWLW<O>O<D>]4?^>IOWLW<_>N<T>^
+M4_V=I_[NW?7F[LAWJK_SU-^UN^MSY#O5WWGJ[V".?*?Z.T_]'<R1[U1_%\L/
+MTMRZSX'O0O5WWW_A'G>+G]:=._!=J/XN4G^WGO?6C3MZ_RY4?Q>IOUO/W*T;
+M=_3^7:C^+E)_M[[FNZ/W[T+U=Y'ZNW9W?0Y\%ZJ_B]3?P1SX+E1_%ZF_@SGP
+M7:C^+E)_M\Q9GP/?A>KO(O5WMLPU[NC]NU#]7:3^SN:/9YT[\%VH_BY2?V<S
+M=]:Y`]^%ZN\B]7=VO;D[\%VH_BY2?]?NKL^![T+U=Y'Z.Y@#WX7J[R+U=S`'
+MO@O5WT7J[Y8Y[W/D.]7?1>KO?)GKW)'O5'\7J;_SF3MOW-'[=Z'ZNTC]G<_<
+M>>..WK\+U=]%ZN_\FN^.WK\+U=]%ZN_:W?4Y\IWJ[R+U=S!'OE/]7:3^#N;(
+M=ZJ_B]3?+7/1Y\AWJK^+U-_%,M>XH_?O0O5WD?J[F+F+SAWY3O5WD?J[F+F+
+MSAWY3O5WD?J[N-[<'?E.]7>1^KMV=WV.?*?ZNTC]'<R1[U1_%ZF_@SGRG>KO
+M(O5WR]S0Y\AWJK^+U-\-RUSGCGRG^KM(_=TP<S<T[NC]NU#]7:3^;IBY&QIW
+M]/Y=J/XN4G\W7//=T?MWH?J[2/U=N[L^1[Y3_5VD_@[FR'>JOXO4W\$<^4[U
+M=Y'ZNV5NT^?(=ZJ_B]3?;9:YQAV]?Q>JOXO4WVUF[C:=._*=ZN\B]7>;F;M-
+MYXY\I_J[2/W=YGIS=^0[U=]%ZN_:W?4Y\IWJ[R+U=S!'OE/]7:3^#N;(=ZJ_
+MB]3?+7/;/D>^4_U=I/YNN\QU[LAWJK^+U-]M9^ZVC3MZ_RY4?Q>IO]O.W&T;
+M=_3^7:C^+E)_M[WFNZ/W[T+U=Y'ZNW9W?8Y\I_J[2/T=S)'O5'\7J;^#.?*=
+MZN\B]7?+W*[/D>]4?Q>IO]LM<XT[>O\N5'\7J;_;S=SM.G?D.]7?1>KO=C-W
+MN\X=^4[U=Y'ZN]WUYN[(=ZJ_B]3?M;OK<^0[U=]%ZN]@CGRG^KM(_1W,D>]4
+M?Q>IOUOFQCY'OE/]7:3^;ESF.G?D.]7?1>KOQIF[L7%'[]^%ZN\B]7?CS-W8
+MN*/W[T+U=Y'ZN_&:[X[>OPO5WT7J[]K=]3GRG>KO(O5W,$>^4_U=I/X.YLAW
+MJK^+U-\M<U.?(]^I_BY2?S<M<XT[>O\N5'\7J;^;9NZFSAWY3O5WD?J[:>9N
+MZMR1[U1_%ZF_FZXW=T>^4_U=I/ZNW5V?(]^I_BY2?P=SY#O5WT7J[V".?*?Z
+MNTC]W3+WOL^1[U1_%ZF_>[_,=>[(=ZJ_B]3?O9^Y>]^XH_?O0O5WD?J[]S-W
+M[QMW]/Y=J/XN4G_W_IKOCMZ_"]7?1>KOVMWU.?*=ZN\B]7<P1[Y3_5VD_@[F
+MR'>JOXO4WRUS'_H<^4[U=Y'ZNP_+7...WK\+U=]%ZN\^S-Q]Z-R1[U1_%ZF_
+M^S!S]Z%S1[Y3_5VD_N[#]>;NR'>JOXO4W[6[ZW/D.]7?1>KO8(Y\I_J[2/T=
+MS)'O5'\7J;];YC[V.?*=ZN\B]7<?E[G.'?E.]7>1^KN/,W<?&W?T_EVH_BY2
+M?_=QYNYCXX[>OPO5WT7J[SY>\]W1^W>A^KM(_5V[NSY'OE/]7:3^#N;(=ZJ_
+MB]3?P1SY3O5WD?J[9>Y3GR/?J?XN4G_W:9EKW-'[=Z'ZNTC]W:>9NT^=._*=
+MZN\B]7>?9NX^=>[(=ZJ_B]3??;K>W!WY3O5WD?J[=G=]CGRG^KM(_1W,D>]4
+M?Q>IOX,Y\IWJ[R+U=\O<YSY'OE/]7:3^[O,RU[DCWZG^+E)_]WGF[G/CCMZ_
+M"]7?1>KO/L_<?6[<T?MWH?J[2/W=YVN^.WK_+E1_%ZF_:W?7Y\AWJK^+U-_!
+M'/E.]7>1^CN8(]^I_BY2?[?,?>ESY#O5WT7J[[XL<XT[>O\N5'\7J;_[,G/W
+MI7-'OE/]7:3^[LO,W9?.'?E.]7>1^KLOUYN[(]^I_BY2?]?NKL^1[U1_%ZF_
+M@SGRG>KO(O5W,$>^4_W=L/P@S7WM<^"[0?5W0^KOOBYSG3OPW?=3S-V0^KNO
+M,W=?%^Z&-9\2?^YQ^F*_+KWQVS9'?]YV.U7,_?+MVQ\O?PYN?GZ^8;O:^6J[
+M^?%]\-4F5L/PXW]=KH:3&OSG_Y[/__B?_QC^Z][GV_S]G^_^/[?V^\%QM9Y6
+M:\?!N[E?_KF=RKG??;Z[.?ISH__"'/VYT3CW0T_?_XWCN^//:>[/7^;HSXW^
+M*[\9M\\X_?SWBA]O!8[UX(-?!N_F?GRY=X?S[["IN>^_\.W!S>>[F^M?KO]R
+MQ._-&7VZ'X\;KF[FNJ;R9RQN[P%^.M#47T"%GG'BN=-^=3C_?-+N<C/W\,L\
+I]_,9IQ]2VL/?]2]\^]?;^W_=H3+,@W\;>\-Z^_U3_O%_AAM3=G^E````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow2.gz.uu
new file mode 100644
index 0000000..c389b8f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.qcow2.gz
+M'XL(")L[(U0``VEM9RTQ>#$M-3$R+79T;V,X+G%C;W<R+F]U=`"MF-N.TS`0
+MAN_[%.YR7F")9^PTX;#`[K(2%T@@7H"F<1^`ZSX\3NS6R60F+E7:M%)E_9_&
+M]M>ITZ((#Z6L5J94IE;[1OG/\0(U^#"^U.'7X_>;X>.P"C!=""EFP.`)-V+=
+M)QQ(N$)/!S2/&U2'#`Z.J2DHAS-B=7,##.YZU2]=OQD52>`EP(`3-^.B^B#4
+M1Q/FPOI@Z?J07S][S-&!<KX^#/71U$;"55D<,*E:PFVS.&12C83;97&&2;42
+MSF5QEDGM!9S.J.)Q)9/2$@ZRN`V30@EGLKB*24G>Z;QW-9.2O--Y[[9,2O).
+MY[UKF)3DG<Y[MV-2DG<Z[UW+I"3O0/!.)9QC4I)W0+Q;1]Q5PNV9E.0=$.^>
+M1-S3$TYS*<D[(-X]B[CG"<?T.Y"\`^+=BXA[F7!,OP/).R#>O8JXZX1C^AU(
+MW@'Q[G7$O4DXIM^!Y!T0[]Y.O--,OP/).R3>O8NL(N&8?H>2=TB\TQ$'"<?T
+M.Y2\0^(=1IQ).*;?H>0=$N]LQ)4)Q_0[E+Q#XMTFXJJ$8_H=2MXA\:Z.N/<)
+MQ_0[E+Q#XMV'B/N8<$R_0\D[)-Y]BKC;A&/Z'4K>&>+=YXC[DG!,OS.2=X9X
+M]S7B[A*.Z7=&\LX0[^XC[N&$`RYU\JXH^"OBODV^L[#L^=.D\[%FWN6!&6#U
+M/\"Y"@.N7G3"-DS8WSIN0)6VN[P2%KN=]$U$F58"/OYU[N[W@_DQK,\N?4-@
+MT_H5W#)15-4?QT%:/SM:OSJ+RVR'#0>S1:8;<,VY./_CXH_VK5/.$=R?`6ZW
+M\&;HR71==_+WQZGJ#.!Z``RX;KHA3'>8^6_@.*P.ZTE]`9>F"X,(C'":J\Z?
+M%OO7&-<FG*8]:W:R:[8ZMZ@J?5\^"]=N5>.ZDVVSF>"NCKB^+_L#D+]IG;[+
+:`X>?-^-G4,5$X&+NF;)K5*M_;'%=NO`2````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.raw.gz.uu
new file mode 100644
index 0000000..c35f98d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.raw.gz.uu
@@ -0,0 +1,10 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.raw.gz
+M'XL(".S%'50``VEM9RTQ>#$M-3$R+79T;V,X+G)A=RYO=70`K9)-#H(P$(7W
+MG.+AT@5IAU)E:XP[$Q,O(-AZ`-<]O&V&!`KEQX2A=/-X7^8Q(P07H#1.!%V%
+MHPA5":50*B\8>'UZX&Y?:R_/J[H77"YCF/1BTB*6!%>,RF7'#GB.?'(9>(:H
+M(2@)9%S=N^I5W%)_C&OVBLNX=BM.^]O`6%@[PKT&N/?.PY"3N!9^X"3#GUP%
+MYN.X,L1E\WC"LS@ON'S2'^/ZN#2P4(23J>Y0\!OC3(^3?ZU*GNS.[KHJ\K,5
+L9QJT%D0H]01WT!V.@JORWS>)>UYPCR)^>%54!]QM]Q0%8/8#T8E)O;($````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhd.gz.uu
new file mode 100644
index 0000000..d9a0c6e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.vhd.gz
+M'XL("`(UQ%4``VEM9RTQ>#$M-3$R+79T;V,X+G9H9"YO=70`K99-3\,P#(;O
+M^Q4&;CM,B9NFVQ4!-R0D#EQ)UVQ,B`\!AQW&?\=ND[5IFVU`NBQ*E_KI:\?.
+M(D1S`>@,]`JT!9WSN%"@%U#,`6C2-:Q[Z6YAMWQ[M<NOS7;FKMVD@4G1M0K-
+MV1XS4/22`M#P2W3%8]AYS.SB>CW=O*P]#AT.'2@OV"I#T.7@/8I^G3?JF/2P
+MP><:>?FT5Y<-U;56]"TJ$`JD[#R1>76$F7V'SBJR6JWJ5H"P=7Q\"VZ"B=;9
+M7NQRT;/JR!P+JFB='</I0U:_P4TG;BV:5*'$**@7H"44R&-*&Q^'0:-4V7Z^
+MFX]/V].'D531>WUR,)?%W467*N@?=@H4I_,A=Z&F?/5Q(ZGRK^CIT$ZY`05!
+MY'X":_?#Z+4HZ.K34AR(>7PQHOH,ZU.:5Y1W@9P+(Z=B59!1_%05<_CFP]K+
+M^RMU&\;/1%;WS_$S\\#N2'5012]XUXBFBUFT5HO_%YLQJ=QM<.6I."IR44%E
+MP=H>[K&#6R9>C'+@KN5,1EDGRS'@F>JY6[*[C7%_A64,QQMI"PIQK;O8,<$`
+M-]A<6!WLRZR+JUI<3^.1Z(7Z/,XF395R=2JN,E!:0!S;1L\];LE6]$<DS$@?
+MG]C=S<)/DRKH]I5D&Q6F5J@<,)E"`MK$"J4XF!F_K5_M%"8Z]3$NX:F/<0E/
+@?8Q+>.IC7,)3'^,2GOH8E_34I^O<F_P`@FX48"H,````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdf.gz.uu
new file mode 100644
index 0000000..ea456e4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.vhdf.gz
+M'XL("&TEAE4``VEM9RTQ>#$M-3$R+79T;V,X+G9H9&8N;W5T`*V43TO#,!C&
+M[_L4#W@9$TK^M[V*>A,&'KS:KND80P7QX"$?WF3);--D=4C3M+2\?7YYG^3E
+M)<0/0"B4#$JZ*1@DAQ#@T@8ZV'@Z81X_M;Y[OI=/A1]FY6'4!K,2,A<PQ628
+MU28`JTA'YX$52`W"LD"/JP=5_2=N+C^/:Y:RZW'MM3AEGQTZ#:TGN-<1;K?P
+M8=#$KH8]<%9=!5Q/[5)GUXNG)TPOX6S`K)/\/&ZPRT82%N%H+CL4_HYQW8"K
+M$M6<V74V.[UHJ=#^6ES7H-5@+;A*<+<JX)A32?M_DWE>#IAM$5^^5$0`+E9[
+M,C0JQ:%Z*'WJ51RE@*I15F,@BXX99O?QKG=?A^_Q_LG0J/H^/YV>V29H%RG!
+M&K>(ZMS[*+^;A_WF\+8_XUAPQ<+"LG0J;KMJF]B5L=V7`SN>D-LA.YYNDASO
+M7JU`!"B-C(?LMG&Q.)SX-:M[M.*T/^<9?42!;.TYG"03U?]+V>'4PJ5B:V_U
+)`_KO!\'=!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vmdk.gz.uu
new file mode 100644
index 0000000..2cc570c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-1x1-512-vtoc8.vmdk.gz
+M'XL(".W%'50``VEM9RTQ>#$M-3$R+79T;V,X+G9M9&LN;W5T`*U<76_DQA%\
+M]Z\8G%\."2"PEM\/!R2.;"`(#!@^(WDU/V,A]MU!)P0QL#\^'')J5)3$&\)J
+M965R;KMKIWM6):6ZL%FV?3E7]*XH7#&ZLG(9W/)/V\-E^>-B>5P:/G']Q^WW
+M_[SAU]N;F^M7&QA\EJ0@4SA9[%[G>O/DBW"7+V7MGE@>ER1<[K/Z9XD![G+P
+MQ"%<L3QY>2F%N^O6IT=_(W`N`KD=7/E"38?%?FEW?_HJ-,_O+_=[6(ZW:EV=
+MNZH/2U>5ZSIW]65]+G/U$C0O@%^[V[O/_W&WT^?A_N[3P\>POXL_VR6XJ'Q\
+M-7B$I;"Z\C?^"0_7>HAJ<OGH<OBGW?7^N[M?IYO_3O>?[SY^>`>6>_%G6^2N
+M:/UV?'SV^-@M_(MDKH)_#7?]V]]OWX5W;G;SJ;LGG,]:-K*\]E*'XE:5\]_/
+M'^ONI@\/'G$.7W%W_FQ#<\KUM0M_4Q:N;MVZG=)C7Y:GQU#RVKOA?NH>II]^
+M_S2]>_/;QP^Q=_YL?<O:%:A9&Y6[,O=0H33?OM(C^K?->FKN^NO=PR]WP_NE
+MS,_3FYNO'>$JW[OE`)NPKZWJ):4Z/-EEV]=O__>PU.O&<+)WA%LWL1:QO'9Y
+M<67ML98#7(_BXO+"WRW_M&QXJ:2`#W+7CQ]N?OS7\B/NF_7^A[_^2+AFR5HB
+MEPTN*4M!NYK*K?[RZ=O27=]_Z][X(G_Z95K?@81KMQ\S'[R=`];EQ=^$KFWP
+MGL0*_\1ZLNZV>^C<-]WGZ>;KV]MOXLEVOMAB?2Q;FSQ*M4'[]_?:SJ5QVTEO
+M![T>Q3CV-]W8?7J8[OWQQJ/H?8O&4*D_UN+Q&/>O4Z\G-?MWC+N^<V_NQN5,
+M/>R_IX^_$6[8WL;+/OQ;HET3<W^SO'M6^"F\PO:.\<?DX::'^]]OAM]_O?LP
+M+C]H[AWAQJUWRW:VTWP\S.4`EQV^N,&E=V_64XW;(]SD=S<^V^!ZGJ&1<5/Q
+M9=WUMW5[OTS=N&QMP2;<['=W>7D?H5-/7FI!=]?'KJVXGP-<G@4*R`.5[5H4
+MM[.]H!#H-#Q\O-\V]D;X.'_ZN^RU?%P\^Y5:_T'`#<YZ?U7VY/=9KGF%+,H=
+MH/\MEBW??UF^?WC<7^7W5TEDK5F-+-H=W,\+Q*?GY5;^I["3R%ZS!EF,9[I7
+M>6J;)')^VCW^J0&Y/X;CWP*,S#6KD$6Y@SOJ71EZQ\A:LQI9M#NXH]Y5H7>,
+M[#5KD,5XJM@Z](Z1LV;Y"_^40G;BS[*J";UC9*Y9A2S*'=Q1[]K0.T;6FM7(
+MHMW!'?6N"[UC9*]9@RS&4\7VH7>,G#7+7T@0D/MCN"'TCI&Y9A6R*'=P1[T;
+M0^\866M6(XMV!W?4NRGTCI&]9@VR&$\5.X?>,7+6+'\II'=%"J[.0N\8F6M6
+M(8MR!W?0NYI\Q\A:LQI9M#NX@][5Y#M&]IHUR&(\52SYCI&S9OE+*;TKDW#D
+M.T;FFE7(HMS!'?6.?,?(6K,:6;0[N*/>D>\8V6O6((OQ5+'D.T;.FN4OE?2N
+M2L*1[QB9:U8ABW('=]0[\ATC:\UJ9-'NX(YZ1[YC9*]9@RS&4\62[Q@Y:Y:_
+M\(\@R/TQ'/F.D;EF%;(H=W!'O2/?,;+6K$86[0[NJ'?D.T;VFC7(8CQ5+/F.
+MD;-F^0L%&<C](5R3A=XQ,M>L0A;E#NZ@=PWYCI&U9C6R:'=P![UKR'>,[#5K
+MD,5XJECR'2-GS?*75GK7)N'(=XS,-:N01;F#.^H=^8Z1M68ULFAW<$>](]\Q
+MLM>L01;CJ6+)=XR<-<M?^/^?(/?'<.0[1N::5<BBW,$=]8Y\Q\A:LQI9M#NX
+MH]Z1[QC9:]8@B_%4L>0[1LZ:Y2_4'R'WQW#D.T;FFE7(HMS!'?6.?,?(6K,:
+M6;0[N*/>D>\8V6O6((OQ5+'D.T;.FN4O@_1N2,&U6>@=(W/-*F11[N`.>M>2
+M[QA9:U8CBW8'=]"[EGS'R%ZS!EF,IXHEWS%RUBQ_&:5W8Q*.?,?(7+,*690[
+MN*/>D>\866M6(XMV!W?4._(=(WO-&F0QGBJ6?,?(6;/\99+>34DX\ATC<\TJ
+M9%'NX(YZ1[YC9*U9C2S:'=Q1[\AWC.PU:Y#%>*I8\ATC9\WREUEZ-R?AR'>,
+MS#6KD$6Y@SOJ'?F.D;5F-;)H=W!'O2/?,;+7K$$6XZEBR7>,G#4KD^D9Y/X0
+MKLNVWL7(7+,*690[N(/>=8'O8F2M68TLVAW<0>^ZP'<QLM>L01;CJ6(#W\7(
+M6;-\RT2_0U+2Z@+?0?0[J'X'T>^0U.^ZP'<0_0ZJWT'T.R3UNR[P'42_@^IW
+M$/WN1+&![R#Z'52_@^AW2$I:7>`[B'X'U>\@^AV2^ET7^`ZBWT'U.XA^AZ1^
+MUP6^@^AW4/T.HM^=*#;P'42_@^IW$/T.24FK"WP'T>^@^AU$OT-2O^L"WT'T
+M.ZA^!]'OD-3ONL!W$/T.JM]!]+L3Q0:^@^AW4/T.HM\A*6GU6>B=Z'=0_0ZB
+MWR&IW_7D.]'OH/H=1+]#4K_KR7>BWT'U.XA^=Z)8\IWH=U#]#J+?(2EI]>0[
+MT>^@^AU$OT-2O^O)=Z+?0?4[B'Z'I'[7D^]$OX/J=Q#][D2QY#O1[Z#Z'42_
+M0U+2ZLEWHM]!]3N(?H>D?M>3[T2_@^IW$/T.2?VN)]^)?@?5[R#ZW8EBR7>B
+MWT'U.XA^AZ2DU9/O1+^#ZG<0_0Y)_:XGWXE^!]7O(/H=DOI=3[X3_0ZJWT'T
+MNQ/%DN]$OX/J=Q#]#DE):\A"[T2_@^IW$/T.2?UN(-^)?@?5[R#Z'9+ZW4"^
+M$_T.JM]!]+L3Q9+O1+^#ZG<0_0Y)26L@WXE^!]7O(/H=DOK=0+X3_0ZJWT'T
+M.R3UNX%\)_H=5+^#Z'<GBB7?B7X'U>\@^AV2DM9`OA/]#JK?0?0[)/6[@7PG
+M^AU4OX/H=TCJ=P/Y3O0[J'X'T>].%$N^$_T.JM]!]#LD):V!?"?Z'52_@^AW
+M2.IW`_E.]#NH?@?1[Y#4[P;RG>AW4/T.HM^=*)9\)_H=5+^#Z'=(2EIC%GHG
+M^AU4OX/H=TCJ=R/Y3O0[J'X'T>^0U.]&\IWH=U#]#J+?G2B6?"?Z'52_@^AW
+M2$I:(_E.]#NH?@?1[Y#4[T;RG>AW4/T.HM\AJ=^-Y#O1[Z#Z'42_.U$L^4[T
+M.ZA^!]'OD)2T1O*=Z'=0_0ZBWR&IWXWD.]'OH/H=1+]#4K\;R7>BWT'U.XA^
+M=Z)8\IWH=U#]#J+?(2EIC>0[T>^@^AU$OT-2OQO)=Z+?0?4[B'Z'I'XWDN]$
+MOX/J=Q#][D2QY#O1[Z#Z73330>X%SFW?`6[*MMZ]:"E_X9]B[]R+NYN,_8%8
+M_8%QIK!5]<<`-SCK_<7Y-A^O\B\BSK?Y>)5_$7&^S<>K_(N(\VT^7N5?1)QO
+MF_@7$>?;)OY%Q/FVB7\1<;YMXE]$G&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7T2<
+M;YOX%Q'GVR;^1<3YMHE_$7&^;>)?1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE]$
+MG&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?
+M1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE\$Y]LV_D5POFWC7P3GVS;^17"^;>-?
+M!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3GVS;^17"^;>-?!.?;-OY%<+YMXU\$
+MY]LV_D5POFWC7P3GVS;^17"^;>-?!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3G
+MVS;^17"^;>-?!.?;-OY%<+YMXU\$Y]LV_D5POFWC7P3GVS;^17"^;>-?!.?;
+M-OY%<+YMXU\$Y]LV_D5POFWC7T2<;S/R5?Y%Q/DV(U_E7T2<;S/R5?Y%Q/DV
+M(U_E7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?1)QOF_@7$>?;)OY%Q/FVB7\1
+M<;YMXE]$G&^;^!<1Y]LF_D7$^;:)?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_
+M$7&^;>)?1)QOF_@7$>?;)OY%Q/FVB7\1<;YMXE]$G&^;^!<1Y]LF_D7$^;:)
+M?Q%QOFWB7T2<;YOX%Q'GVR;^1<3YMHE_$7&^;>)?!.?;-OY%3*;^14RF_D5,
+MIOY%3*;^14RF_D5,IOY%3*;^14RF_D5,IOY%3*;^14RF_D5,IOY%3*;^14RF
+M_D5,IOY%S%EFZ%_$;.I?Q&SJ7\1LZE_$;.I?Q&SJ7\1LZE_$;.I?Q&SJ7\1L
+MZE_$;.I?Q&SJ7\1LZE_$;.I?Q&SJ7\1LZE^\9%EFZ%^\//LLX9-PSXO=_('%
+MNK^BXF>ZEOZ30LOU4T/STOF//SX`_.Y^FKYY?UM^O]M?8;^_9I>'+P,VZTCS
+M<GBZ1=8^9K5)N"_M;X/KK,K=X/JS<-O899S<-#V!^UG@!N/#P+-RI_6GH#D%
+M^/9IN?#EQL_/WITPCN#\)Z>^?;:_#>ZQ7/UIN^S@\-+NPH_L$[CQ$:YYEO6E
+M8M^^N+O)]*V"^2S<V+E^<I?>Y=4SN#]7`6[]6.QM4O_\O\=/7'^XV?]O>ZL4
+4`=#LO5?XSV'-OOH_FA1I)IY=````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow.gz.uu
new file mode 100644
index 0000000..491ab80
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.qcow.gz
+M'XL(",$S(E0``VEM9RTV,W@R-34M-#`Y-BUA<&TN<6-O=RYO=70`K9W9CAW9
+M<47?^RLN9[(XW8C(D;,$N0$_&&A;T+.4(R!`MA.R`+_PXUW%.D-5W+T9E+NI
+M0H-$(3>R3BTN":W%P_/Y]L?IU,JIZ4[->-KGT_6OTX><[OSB_L?IZ[___*]O
+M[O[X^M/MF)R_\Y3[=:,G27/WMGY?Y_3FJ>5T'G]@[OH#SMUY._LGWN[.%WLY
+M=_73[1>+GU,V:/<&3VGNG-Y/R.DU/_9^7]R7*[>G]]M]N4J^W)8-=O<&?TES
+M?TGOI^3+[=G<<&_N<%^NDB]W9'/3=V%1`LO,YI9@KH%/K6QN"^9:^-2.Y^0[
+MW]O;N0X^)6Q.X=RIS/7P*6-SS;VY\YL,=)X;X%.$.PFY&^%3A#L)N9O@4X0[
+M";F;X5.$.PFY6^!3A#L)N5OA4X0[#;G;X%.$.PVYV^%3A#N-N!/\%.%.(^X$
+M^4X9=QIQ)\AWRKC3B#M!OE/&G4;<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D
+M.V/<6<@=\ITQ[BSD#OG.&'<6<H=\9XP["[E#OC/&G87<(=\9X\Y"[I#OC''7
+MA-PAWS6,NR;D#OFN8=PU$7>*GR+<-1%WBGS7,.Z:B#M%OFL8=TW$G2+?-8R[
+M)N).D>\:QET3<:?(=PWCKHVX4^2[EG'71MPI\EW+N&M#[I#O6L9=&W*'?-<R
+M[MJ0.^2[EG'7AMPAW[6,NS;D#OFN9=RU(7?(=RWCK@NY0[[K&'==R!WR7<>X
+MZR+N##]%N.LB[@SYKF/<=1%WAGS7,>ZZB#M#ONL8=UW$G2'?=8R[+N+.D.\Z
+MQET?<6?(=SWCKH^X,^2[GG'7A]PAW_6,NS[D#OFN9]SU(7?(=SWCK@^Y0[[K
+M&7=]R!WR7<^XZT/ND.]ZQMT0<H=\-S#NAI`[Y+N!<3=$W#7X*<+=$''7(-\-
+MC+LAXJY!OAL8=T/$78-\-S#NAHB[!OEN8-P-$7<-\MW`N,O_^IO/(=^-C+LQ
+MXJY!OAL9=V/('?+=R+@;0^Z0[T;&W1ARAWPW,N[&D#ODNY%Q-X;<(=^-C+LQ
+MY`[Y;F3<32%WR'<3XVX*N4.^FQAW4\1=BY\BW$T1=RWRW<2XFR+N6N2[B7$W
+M1=RUR'<3XVZ*N&N1[R;&W11QUR+?38R[_']#\CGDNYEQ-T?<M<AW,^-N#KE#
+MOIL9=W/('?+=S+B;0^Z0[V;&W1QRAWPW,^[FD#ODNYEQ-X?<(=_-C+LEY`[Y
+M;F'<+2%WR'<+XVZ)N.OP4X2[)>*N0[Y;&'=+Q%V'?+<P[I:(NP[Y;F'<+1%W
+M'?+=PKA;(NXZY+N%<;=&W'7(=ROC;HVXZY#O5L;=&G*'?+<R[M:0.^2[E7&W
+MAMPAWZV,NS7D#OEN9=RM(7?(=ROC;@VY0[Y;&7=;R!WRW<:XVT+ND.\VQMT6
+M<=?CIPAW6\1=CWRW,>ZVB+L>^6YCW&T1=SWRW<:XVR+N>N2[C7&W1=SUR'<;
+MXVZ/N.N1[W;&W1YQUR/?[8R[/>0.^6YGW.TA=\AW.^-N#[E#OML9=WO('?+=
+MSKC;0^Z0[W;&W1YRAWRW$^XD_X3/`=_)F7`GYY`[X#LY$^[D''$WX*<P=Q+V
+M=P/PG;#^3L+^;@"^$];?2=C?#<!WPOH["?N[`?A.6'\G87\W`-\)Z^\D[.\&
+MX#MA_9V$_=T`?">LOY.POQN`[X3U=Q+V=P/PG;#^3L+^;@"^$];?2=C?#<!W
+MPOH["?N[`?A.6'\G87\W`-\)Z^\D[.\&Y#O6WTG8WPW(=ZR_D["_&_%3A+NP
+MOQN1[UA_)V%_-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=
+MZ^\D[.]&Y#O6WTG8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]
+MW8A\Q_H["?N[$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?3?@IPEW8WTW(=ZR_
+MD["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3
+M\AWK[R3L[R;D.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=
+MA/W=A'S'^CL)^[L)^8[U=Q+V=Q/R'>OO).SO9OP4X2[L[V;D.];?2=C?S<AW
+MK+^3L+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V
+M=S/R'>OO).SO9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC
+M_9V$_=V,?,?Z.PG[NQGYCO5W$O9W"WZ*<!?V=POR'>OO).SO%N0[UM])V-\M
+MR'>LOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W
+M$O9W"_(=Z^\D[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!
+MOF/]G83]W8)\Q_H["?N[%3]%N`O[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6WTG8
+MWZW(=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.
+M]7<2]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A?[<BW['^3L+^
+M;D6^8_V=A/W=AI\BW(7]W89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D.];?
+M2=C?;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-
+M^8[U=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_)V%_MR'?L?Y.
+MPOYNQT\1[L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[
+MUM])V-_MR'>LOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.PG[
+MNQWYCO5W$O9W._(=Z^\D[.]VY#O6WVG^B9L[U3G@N^NG,'?J^KM\G]ZI<@=\
+MIZR_4]??G1)WI\R=G?%3F#MU_=TI<7?Z2YD#OE/6WZGK[TZ'.SM#]]\IZ^_4
+M]7?E[.H<\)VR_DY=?P?F@.^4]7?J^CLP!WRGK+]3U]_EN0=U#OA.67^GKK][
+MD.=.90[X3EE_IZZ_>Y"X>U"Y`[Y3UM^IZ^\>).X>5.Z`[Y3U=^KZNP?'Q=D!
+MWRGK[]3U=^7LZASPG;+^3EU_!^:`[Y3U=^KZ.S`'?*>LOU/7W^6YAW4.^8[U
+M=^KZNX=YKG*'?,?Z.W7]W</$W</"';K_3EE_IZZ_>YBX>UBX0_??*>OOU/5W
+M#P]_=NC^.V7]G;K^KIQ=G4.^8_V=NOX.S"'?L?Y.77\'YI#O6'^GKK_+<X_J
+M'/(=Z^_4]7>/\ESA#MU_IZR_4]??/4K</:K<(=^Q_DY=?_<H<?>H<H=\Q_H[
+M=?W=H^/B[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<
+MXSJ'?,?Z.W7]W>,\5[E#OF/]G;K^[G'B[G'A#MU_IZR_4]??/4[</2[<H?OO
+ME/5WZOJ[QX<_.W3_G;+^3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\#<\AWK+]3
+MU]_EN2=U#OF.]7?J^KLG>:YPA^Z_4];?J>OOGB3NGE3ND.]8?Z>NOWN2N'M2
+MN4.^8_V=NO[NR7%Q=LAWK+]3U]^5LZMSR'>LOU/7WX$YY#O6WZGK[\`<\AWK
+M[]3U=WGN:9U#OF/]G;K^[FF>J]PAW['^3EU_]S1Q][1PA^Z_4];?J>OOGB;N
+MGA;NT/UWROH[=?W=T\.?';K_3EE_IZZ_*V=7YY#O6'^GKK\#<\AWK+]3U]^!
+M.>0[UM^IZ^_RW+,ZAWS'^CMU_=VS/%>X0_??*>OOU/5WSQ)WSRIWR'>LOU/7
+MWSU+W#VKW"'?L?Y.77_W[+@X.^0[UM^IZ^_*V=4YY#O6WZGK[\`<\AWK[]3U
+M=V`.^8[U=^KZNSSWO,XAW['^3EU_]SS/5>Z0[UA_IZZ_>YZX>UZX0_??*>OO
+MU/5WSQ-WSPMWZ/X[9?V=NO[N^>'/#MU_IZR_4]??E;.K<\AWK+]3U]^!.>0[
+MUM^IZ^_`'/(=Z^_4]7=Y[D6=0[YC_9VZ_NY%GBO<H?OOE/5WZOJ[%XF[%Y4[
+MY#O6WZGK[UXD[EY4[I#O6'^GKK][<5R<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.
+M^8[U=^KZ.S"'?,?Z.W7]79Z[JG/(=ZR_4]??7>6YRAWR'>OOU/5W5XF[J\(=
+MNO].67^GKK^[2MQ=%>[0_7?*^CMU_=W5X<\.W7^GK+]3U]^5LZMSR'>LOU/7
+MWX$YY#O6WZGK[\`<\AWK[]3U=WGN99U#OF/]G;K^[F6>*]RA^^^4]7?J^KN7
+MB;N7E3OD.];?J>OO7B;N7E;ND.]8?Z>NOWMY7)P=\AWK[]3U=^7LZASR'>OO
+MU/5W8`[YCO5WZOH[,(=\Q_H[=?U=GGM5YY#O6'^GKK][E><J=\AWK+]3U]^]
+M2MR]*MRA^^^4]7?J^KM7B;M7A3MT_YVR_DY=?_?J\&>'[K]3UM^IZ^_*V=4Y
+MY#O6WZGK[\`<\AWK[]3U=V`.^8[U=^KZNSSWNLXAW['^3EU_]SK/%>[0_7?*
+M^CMU_=WKQ-WKRAWR'>OOU/5WKQ-WKRMWR'>LOU/7W[T^+LX.^8[U=^KZNW)V
+M=0[YCO5WZOH[,(=\Q_H[=?T=F$.^8_V=NOXNS[VI<\AWK+_3J+\S=/^=LOY.
+MH_[.T/UWROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ
+M.XWZ.T/WWRGK[Y3T=V_K'/(=Z^_4]7=O\USA#MU_IZR_4]??O4W<O:W<(=^Q
+M_DY=?_<V<?>V<H=\Q_H[=?W=V^/B[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>L
+MOU/7WX$YY#O6WUG^B9L[USG@.V/]W?4G[G&7_72NW`'?&>OOS/5WY[1W+MRA
+M^^^,]7?F^KMSXNY<N$/WWQGK[\SU=^?#GQVZ_\Y8?V>NORMG5^>`[XSU=^;Z
+M.S`'?&>LOS/7WX$YX#MC_9VY_B[/29T#OC/6WYGK[R3/%>[0_7?&^CMS_9VD
+MUY/*'?"=L?[.7'\GB3NIW`'?&>OOS/5W<ER<'?"=L?[.7']7SJ[.`=\9Z^_,
+M]7=@#OC.6']GKK\#<\!WQOH[<_U=GM,ZAWS'^CMS_9WFN<H=\AWK[\SU=YJX
+MT\(=NO_.6']GKK_3Q)T6[M#]=\;Z.W/]G1[^[-#]=\;Z.W/]73F[.H=\Q_H[
+M<_T=F$.^8_V=N?X.S"'?L?[.7'^7YZS.(=^Q_LY<?V=YKG"'[K\SUM^9Z^\L
+M<6>5.^0[UM^9Z^\L<6>5.^0[UM^9Z^_LN#@[Y#O6WYGK[\K9U3GD.];?F>OO
+MP!SR'>OOS/5W8`[YCO5WYOJ[/-?4.>0[UM^9Z^^:/%>Y0[YC_9VY_JY)W#6%
+M.W3_G;'^SEQ_UR3NFL(=NO_.6']GKK]K#G]VZ/X[8_V=N?ZNG%V=0[YC_9VY
+M_@[,(=^Q_LY<?P?FD.]8?V>NO\MS;9U#OF/]G;G^KLUSA3MT_YVQ_LY<?]<F
+M[MK*'?(=Z^_,]7=MXJZMW"'?L?[.7'_7'A=GAWS'^CMS_5TYNSJ'?,?Z.W/]
+M'9A#OF/]G;G^#LPAW['^SEQ_E^>Z.H=\Q_H[<_U=E^<J=\AWK+\SU]]UB;NN
+M<(?NOS/6WYGK[[K$75>X0_??&>OOS/5WW>'/#MU_9ZR_,]??E;.K<\AWK+\S
+MU]^!.>0[UM^9Z^_`'/(=Z^_,]7=YKJ]SR'>LOS/7W_5YKG"'[K\SUM^9Z^_Z
+MQ%U?N4.^8_V=N?ZN3]SUE3OD.];?F>OO^N/B[)#O6']GKK\K9U?GD.]8?V>N
+MOP-SR'>LOS/7WX$YY#O6WYGK[_+<4.>0[UA_9ZZ_&_)<Y0[YCO5WYOJ[(7$W
+M%.[0_7?&^CMS_=V0N!L*=^C^.V/]G;G^;CC\V:'[[XSU=^;ZNW)V=0[YCO5W
+MYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSXUU#OF.]7?F^KLQSQ7NT/UWQOH[<_W=
+MF+@;*W?(=ZR_,]??C8F[L7*'?,?Z.W/]W7A<G!WR'>OOS/5WY>SJ'/(=Z^_,
+M]7=@#OF.]7?F^CLPAWS'^CMS_5V>>U?GD.]8?V>NOWN7YRIWR'>LOS/7W[U+
+MW+TKW*'[[XSU=^;ZNW>)NW>%.W3_G;'^SEQ_]^[P9X?NOS/6WYGK[\K9U3GD
+M.];?F>OOP!SR'>OOS/5W8`[YCO5WYOJ[//>^SB'?L?[.7'_W/L\5[M#]=\;Z
+M.W/]W?O$W?O*'?(=Z^_,]7?O$W?O*W?(=ZR_,]??O3\NS@[YCO5WYOJ[<G9U
+M#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:ASR'>LOS/7WWW(<Y4[Y#O6
+MWYGK[SXD[CX4[M#]=\;Z.W/]W8?$W8?"';K_SEA_9ZZ_^W#XLT/WWQGK[\SU
+M=^7LZASR'>OOS/5W8`[YCO5WYOH[,(=\Q_H[<_U=GOM8YY#O6']GKK_[F.<*
+M=^C^.V/]G;G^[F/B[F/E#OF.]7?F^KN/B;N/E3OD.];?F>OO/AX79X=\Q_H[
+M<_U=.;LZAWS'^CMS_1V80[YC_9VY_@[,(=^Q_LY<?Y?G/M4YY#O6WYGK[S[E
+MN<H=\AWK[\SU=Y\2=Y\*=^C^.V/]G;G^[E/B[E/A#MU_9ZR_,]???3K\V:'[
+M[XSU=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSWVN<\AWK+\S
+MU]]]SG.%.W3_G;'^SEQ_]SEQ][ERAWS'^CMS_=WGQ-WGRAWR'>OOS/5WGX^+
+MLT.^8_V=N?ZNG%V=0[YC_9VY_@[,(=^Q_LY<?P?FD.]8?]?DG[BY+W4.^*YA
+M_5WC^KLO>:YR!WQW_13FKG']W9?$W9?,77/&3Y&_]]A]L5]R;_RFS*&_;[L\
+M%<S=^?'UIZMO@^VW]VO:4ZNGL]8G;JY_&[XW^"__<3/SP+U?^YN_W[?[9:Y/
+MJUDOGK.[@W+_$U]_^3<_>#MW\W[-MW#L^J.[_M_3[0^]W^^.XV\;F$-_7_G_
+MZ\N]G;/+MVN_6:63TZG74]^<NC']L[N6U';SZ?1V?SZFO__CK__XZW__UY_S
+MW,U_7W3KS</]/_-V_SD=\.W0WU?^:[ZWS0]^;_._PL^_<^]_;_/OW!;]V?)?
+M]W[?OAW=S<%??R.N/QH]M79JFIL_'G%JVYO/M78Y^//?M^WW?_S#ZS_]_,>[
+MYX?^./BO>K_N!\Y/[YS?[6^2N^=WNOM^Z,]N_;KW^^[Y]7;J>\!F/;__^=];
+F$//[_<;GUYW3^9TG\$_^B:^_O+G_G]O!YMO@3_\'*;=.DB.F````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow2.gz.uu
new file mode 100644
index 0000000..aa257d4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.qcow2.gz
+M'XL("+@[(U0``VEM9RTV,W@R-34M-#`Y-BUA<&TN<6-O=S(N;W5T`*V826_;
+M,!!&[_D53/>F32K.D)35/9N!'@JD#7H.O,A`@"Y&&J`7__A2ULB4J1DQ-N0(
+M1@SB>Q@/GT>FLZQ^*&6U,DZ90BVFRK^F"U3KQ?:E5M_&7T[:C]5!#=.9D&(6
+M#&YP6ZSS@`,)E^GN@N9QK>J0P4&3ZH)2."-6U[?`X(X.UJU;;\8H2N`^P!HG
+M;L9>]4%=7YPP>]8'0]>'?/]LDXL77']]6-<7IW()-TKB@$D5$FZ2Q"&3FDJX
+M61)GF-1<PI5)G&52"P&G$ZIXG&-26L)!$I<S*91P)HD;,2G).YWVKF!2DG<Z
+M[=V$24G>Z;1W4R8E>:?3WLV8E.2=3GLW9U*2=R!XIP*N9%*2=Q!Y=TBX1P&W
+M8%*2=Q!Y]YAP3S8XS:4D[R#R[BGAG@4<,^]`\@XB[YX3[D7`,?,.).\@\NXE
+MX8X"CIEW('D'D7>O"/<ZX)AY!Y)W$'EWW/%.,_,.).\P\NX-L;*`8^8=2MYA
+MY)TF'`0<,^]0\@XC[Y!P)N"8>8>2=QAY9PGG`HZ9=RAYAY%W.>%&`<?,.Y2\
+MP\B[@G!O`XZ9=RAYAY%W[PCW/N"8>8>2=QAY]X%P'P..F7<H>6<B[SX1[G/`
+M,?/.2-Z9R+M3PIT%'#/OC.2=B;P[)]S%!@=<:N-=EO$7X2X[GUD8]ONG"=^/
+M-?,L+_0`1[L`^RJL<<6@;]C6;]CO@(5PCLK6=\A1+_#R>X4YW*[/#GT@L+4P
+M?C*;>2>'TH'/+ZRNOC+]L[4P_N/@IZF_W$PY^Z#Z3I?+GR6#DT^WNQ^G/`Z[
+MU=G%^G\O2PXJ-\H5].P6RI75,E5WLYS<W=_>W_[Y?=/@JANDFU?A?)?J?DV6
+M;'5VX+TU#]S;YGX!!-S>6]749X9VSZRWPU6-]QOA+S\N+593SG_-4-96:Q:[
+MP/%=69Y=7QS_&%^W^V>&_;'!^A-5NG_0ZE_](6GW3[7K<T/WS_7V+T>5YXR;
+MH7]__]4B-O4-W#^=4?_\2;W[+"^LKDZV_VJ@(>!@%1I73>>#_Z4*H1'E$P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.raw.gz.uu
new file mode 100644
index 0000000..13210f0
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.raw.gz
+M'XL("/[%'50``VEM9RTV,W@R-34M-#`Y-BUA<&TN<F%W+F]U=`"MD\UJPS`0
+MA.]^BNFU4"/)*RD]MK2Y%4)#S\'4#@3:Q*2!7O3PE2*)R#\)+FB]"(ME/\:S
+M:\9\`"0A!9A-%E)PL`4N]T'"O+Z7-N[*&*;P,,YN=%W'E8,PQ;T'"E>6#-2,
+M^JH4R/L%LWH;`CW.Z2,.S5RJ3R@Y2]]3UWVU$SB1ZW,]KAJKD]OS.P>T@":H
+MQW"J+53KRD'=IJN/I]UI=]AO(HXL3C6N6?]'W7?=3:J3F6=+,V>[B$L9@/W9
+M(NJCW+M'YW$H9[P=A$T2D!6((!HK7+J:O8^`RV/;/J]?'CZ6Z]0_HLSZU`S_
+M1.*?_TE2_Y#J4[G]4S?]TQ6TGMC-BW\_OWX1H[[,_G$6_&/UQ'F]8%9E__%`
+1"L!L"DDX8/$'F8$ZXZ<%````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.vhd.gz.uu
new file mode 100644
index 0000000..01a176d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.vhd.gz
+M'XL("#0UQ%4``VEM9RTV,W@R-34M-#`Y-BUA<&TN=FAD+F]U=`"M5DMKW#`0
+MON^O&.@MD$4:2_+FDI+2Y%8(#:7'X'CE8)K'DEU(#LY_KT8/)#_9)-H5PD:>
+M3]]\\Y`8<S\`58!J0&E0DIY+`>H,R@V`6?0#[<S]*W3U\Y.N#^W;VO^ZE0/C
+M++7JFY,]%B#,)B5@19NH+3U#%V#6WR[O3]K'^P"''@X]D"S)JD!0=Z-]RBUL
+MW#X6[F^+_RSD>V17C-E%*^=@TT#1)%\4@=V[G;^GS@IC9;ZG(>&NM/J$T7OI
+M+41G!]I)-K!*:$Z)RJ*S4W!JR>HC<"<K'PN7*B8Q2C,S4!Q*I&>3-D&'T3"I
+M\K;?52][/>"',ZFBDF`,U\2\N^A3!</'GH$@@DON@D79#^$F4N5+ZJF^G?`/
+M1@0FPP):]_OJ12A(^2G.%C2?#\8LOXKXF=*4&*O-C$)#S9<<OOQ-,.?#<%0S
+MT?VT?C4MFPH1VY%=+[Z\O]!=_YI,EYKX"4YI3)E<4PX?P^]BMWO0$W"8RUT'
+M5XS9R<;7G"TZUZ+M[%JW;`*[6U-MA_;0/C_=!CAJ5-1J+>+Q[!ZKW20[F3FV
+M^LC8;I(Z8:/80N"G<^>>MN%0)#R=D!($@C0'F0#<&N*2ULS["/#J1>L?-S]/
+M_US=I/IID9<?9T?HAXE^KDA2_=+>PN<.\<_S6]2/#I-R(C>C?OM7EXB!7V[]
+M*J\?JR;F^87N>MW_.T#TS31;=\;8_?(P%!XP&T,1:S@70ZX7@_G1*"O<6)<S
+K774)+N-5E^`R7G4)+N-5E^`R7G4)+N-5E^"R7G4-H,F]U7^P3V5T'PT`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.vhdf.gz.uu
new file mode 100644
index 0000000..a48dd82
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.vhdf.gz
+M'XL("*DEAE4``VEM9RTV,W@R-34M-#`Y-BUA<&TN=FAD9BYO=70`K57+:L,P
+M$+SG*Q9Z"]3(>KJG/FAR*X2&TF-P;3F8-HE)`^W!'U_)DAK)=D):)"]"8KW#
+M[*RT0L@,`,J`84#*D#7:S<=]SZ"=/2=JW"5NM!,#EIZ+.@V7]$8[F1I`K-U,
+M$2H'<<0'3$-'NWCJ`QHXS8^F()`V7@!G%_&[;YH/.0*'8Z5KX,B0':NZ=0H@
+M,`@*_,;.O`(NM=NR6S7Y_E`?ZMUVY>!4%8&7.EC\A=TF;T;9L<BUI1?6-K,+
+M;`'#VH+C1V.?/=J5@VOA52&440R,`*6`2T6<:9_:#P#G>RD?EH_7+_.EKQ^E
+MD?GQ"_3#GG[FDOCZ@<^/Q]:/G]5/$!!BY&P>]?O\,@?1\8NL7XJL?B@?F4\[
+MVD42?@:06L!H##/;G3FQ=UV+2%P/R'Q`?"QO!UCLMK(XU-_^#<YL=ZZJ<=/Q
+MF.BW@`O`>==B2KWV^%W-UM-ZLW9PKONYAX,)'454N=\&Z69ANJ\U?N^S(T.1
+MLD"]5/,D59!XH-ZM#T=_DY42"J./LV`3.$9[LX;KNI__\W]K:^!XY*.B'LK)
+)#UU>%[W2!P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-apm.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-apm.vmdk.gz.uu
new file mode 100644
index 0000000..860e005
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-apm.vmdk.gz.uu
@@ -0,0 +1,83 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-apm.vmdk.gz
+M'XL("/_%'50``VEM9RTV,W@R-34M-#`Y-BUA<&TN=FUD:RYO=70`K9Q;;^3&
+M$87?_2L(^<4(D`'/\/ZP0.S(!H+`P,+K)(\.K[&0]4J0A"0+S(\/F^S3.I3$
+M;<*J]<@SM5-5TUU-E;1?'3!-US])DG=)GB?YD!1EDB*9_VI])&GV9,R/<\TW
+M+G^]_O'O)_[YYG2Z?+4F@XN2$*2:3HS-YUQ.S_XPW?E+49LWYL<YFBYS4=V+
+M0)_NO//&;KI\?O/\6@A7URYO#^Z%I$M"HF23KGAE3[N;_=+J_O"5+YY;7^;6
+M,!]OV215EI2=-Y.R6.PLJ<[+>VE2S4[3G/#KY/KFX=_)]?C0W]_</=[Z]9W=
+MV<[.>>G\R]YEF#=6E>Z%>\.E:UR*<DRR(<G@WDXN]S_<?!Q/_QGO'VYN/[T#
+MMWMV9YMG2=ZXY3C_].FQ,=R'I$D)]QG)Y<]_N7[GK]ST=-?>,YV+FA<R?_:\
+M#\U;EHG[>OE85C=^>G09)_\GK,Z=K2].L7QV[EX4>5(UR;*<PN4^SV\/?LM+
+M[?K[L7T<?_Y\-[Z[^NWV4ZB=.UM7LF9)5"^%RI(B<ZG\UESY"I?173;+J267
+MCS>/O][T'^9M/HQ7IZ\3IBM=[>8#K/VZUEW/(>7NR<[+OGS_O\=YO\G@3_:&
+MZ99%+)N8/[LX)T7E<LT'N!S%.<ER]VK^JWG!\TYR.*?D<OOI]-,_YF]Q5ZP/
+M[[_]B>GJ.6KVG!<XA\P;VNRI6/=?/+\LD\N'[Y,KM\F??QV7*Y#IFO7;S#FO
+MYX#%/+L7OFIK>M?$<O?&<K+)=?O8)M^U#^/IZ^OK[\+)MFZS^?*8ES:Z+.6:
+MVEW?2SGGPJTGO1[T<A3#T)W:H;U['._=\8:CZ%R)!K]3=ZSYTS%N/Z=:3FIR
+M5TQR>9=<W0SSF;JT_QIO?V.Z?KV,YW6X2Z)9`C/W8KYZEO2C_X3UBG''Y-*-
+MC_>?3_WGCS>?AOD;+7G'=,-:NWDY6>H7%=;T?%'A8^?:7:5/2YMS,]WH2K0N
+MJO;?&'.N=1U/57!73.$>O@J7SZ=?QW:8EY5<G8OB*AS%]/PHM$3/JK`>]%R+
+M]2C\PCZ?'L;>I\M2?X#3ICCKFI*L3++,KVC;0!]O[Y>EE=F5]N/L^<^RM_;C
+M_,6/U.IW)ES36:^O3)_]/,LT+A>CV"1T/\72^>M/\]?[I_65;GVE>%8:58O1
+M;-+]<TYQ]W*[I;O$6O'L-*H78SA2O=*UME$\I^?5XZ\:D-?[Z?B[`#TSC<K%
+M*#;I]FI7^-K1L]*H6HQFDVZO=J6O'3T[C>K%&`YMMO*UH^>D4>Z)OTHA/?!K
+M65G[VM$STZA<C&*3;J]VC:\=/2N-JL5H-NGV:M?ZVM&STZA>C.'09CM?.WI.
+M&N6>V"`@K_?3];YV],PT*A>CV*3;J]W@:T?/2J-J,9I-NKW:C;YV].PTJA=C
+M.+39R=>.GI-&N:=<:I?'TE6IKQT],XW*Q2@VZ79J5['?T;/2J%J,9I-NIW85
+M^QT].XWJQ1@.;9;]CIZ31KFG0FI71-.QW]$STZA<C&*3;J]V['?TK#2J%J/9
+MI-NK'?L=/3N-ZL48#FV6_8Z>DT:YIU)J5T;3L=_1,].H7(QBDVZO=NQW]*PT
+MJA:CV:3;JQW['3T[C>K%&`YMEOV.GI-&N2?^$@1YO9^._8Z>F4;E8A2;='NU
+M8[^C9Z51M1C-)MU>[=COZ-EI5"_&<&BS['?TG#3*/1'(0%[OIJM37SMZ9AJ5
+MBU%LTNW4KF:_HV>E4;48S2;=3NUJ]CMZ=AK5BS$<VBS['3TGC7)/C=2NB:9C
+MOZ-GIE&Y&,4FW5[MV._H66E4+4:S2;=7._8[>G8:U8LQ'-HL^QT])XUR3_PG
+M%.3U?CKV.WIF&I6+46S2[=6._8Z>E4;58C2;='NU8[^C9Z=1O1C#H<VRW]%S
+MTBCW1/X(>;V?COV.GIE&Y6(4FW1[M6._HV>E4;48S2;=7NW8[^C9:50OQG!H
+ML^QW])PTRCWU4KL^EJY)?>WHF6E4+D:Q2;=3NX;]CIZ51M5B-)MT.[5KV._H
+MV6E4+\9P:+/L=_2<-,H]#5*[(9J._8Z>F4;E8A2;='NU8[^C9Z51M1C-)MU>
+M[=COZ-EI5"_&<&BS['?TG#3*/8U2NS&:COV.GIE&Y6(4FW1[M6._HV>E4;48
+MS2;=7NW8[^C9:50OQG!HL^QW])PTRCU-4KLIFH[]CIZ91N5B%)MT>[5COZ-G
+MI5&U&,TFW5[MV._HV6E4+\9P:+/L=_2<-"J5Z1GD]6ZZ-EUK%SPSC<K%*#;I
+M=FK7^GX7/"N-JL5H-NEV:M?Z?A<\.XWJQ1@.;=;WN^`Y:90KF?`[1)%6Z_L=
+MA-]!^1V$WR'*[UK?[R#\#LKO(/P.47[7^GX'X7=0?@?A=P<VZ_L=A-]!^1V$
+MWR&*M%K?[R#\#LKO(/P.47[7^GX'X7=0?@?A=XCRN];W.PB_@_(["+\[L%G?
+M[R#\#LKO(/P.4:35^GX'X7=0?@?A=XCRN];W.PB_@_(["+]#E-^UOM]!^!V4
+MWT'XW8'-^GX'X7=0?@?A=X@BK2[UM1-^!^5W$'Z'*+_KV.^$WT'Y'83?(<KO
+M.O8[X7=0?@?A=P<VRWXG_`[*[R#\#E&DU;'?";^#\CL(OT.4WW7L=\+OH/P.
+MPN\0Y7<=^YWP.RB_@_"[`YMEOQ-^!^5W$'Z'*-+JV.^$WT'Y'83?(<KO.O8[
+MX7=0?@?A=XCRNX[]3O@=E-]!^-V!S;+?";^#\CL(OT,4:77L=\+OH/P.PN\0
+MY7<=^YWP.RB_@_`[1/E=QWXG_`[*[R#\[L!FV>^$WT'Y'83?(8JT^M373O@=
+ME-]!^!VB_*YGOQ-^!^5W$'Z'*+_KV>^$WT'Y'83?'=@L^YWP.RB_@_`[1)%6
+MSWXG_`[*[R#\#E%^U[/?";^#\CL(OT.4W_7L=\+OH/P.PN\.;);]3O@=E-]!
+M^!VB2*MGOQ-^!^5W$'Z'*+_KV>^$WT'Y'83?(<KO>O8[X7=0?@?A=P<VRWXG
+M_`[*[R#\#E&DU;/?";^#\CL(OT.4W_7L=\+OH/P.PN\0Y7<]^YWP.RB_@_"[
+M`YMEOQ-^!^5W$'Z'*-(:4E\[X7=0?@?A=XCRNX']3O@=E-]!^!VB_&Y@OQ-^
+M!^5W$'YW8+/L=\+OH/P.PN\015H#^YWP.RB_@_`[1/G=P'XG_`[*[R#\#E%^
+M-[#?";^#\CL(OSNP6?8[X7=0?@?A=X@BK8']3O@=E-]!^!VB_&Y@OQ-^!^5W
+M$'Z'*+\;V.^$WT'Y'83?'=@L^YWP.RB_@_`[1)'6P'XG_`[*[R#\#E%^-[#?
+M";^#\CL(OT.4WPWL=\+OH/P.PN\.;);]3O@=E-\%,1WDM:1+UB^?;DS7VKTJ
+M*7_EKT+MDE=7-QKK`['H`\-,8=W5[TNXIK->7YAO\_$F_2+"?)N/-^D7$>;;
+M?+Q)OX@PW^;C3?I%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB
+M7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YM
+MHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^
+M;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D5POFVC7P3G
+MVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;
+M-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV
+M^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z
+M17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z183Y-CW?I%]$F&_3
+M\TWZ183Y-CW?I%]$F&_3\TWZ183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FV
+MB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183Y
+MMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$
+M^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%
+M<+YMHU_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?Q&BJ7\1HJE_$:*I?
+MQ&BJ7\1HJE_$:*I?Q&BJ7\1HJE_$E*:&^D5,IOI%3*;Z14RF^D5,IOI%3*;Z
+M14RF^D5,IOI%3*;Z14RF^D5,IOI%3*;Z14RF^D5,IOI%3*;Z14RF^L5SFJ:&
+M^L7SBWL)'TSW<K.K/C!?UI<7[MZE>J_?]:[&7TCX_4\NS3?/UI>;KV^Y7Z^[
+MO>KP(B[3A-B^<7G_XVOURY?[]>;+;4W=;4S7^_4>6-^W=W<?QU?2O;@7\^_=
+M[IHN>[FZ8O(W^EWNWYGS;KF\IW`Q<76_W+7WCS>/-[>??F&ZY7Z]@[^-Z_'5
+M_=;>O;HZXWLQY_G!L^6_$,X^X?9L$Z[/^MZ?>;X<1\G['1?N+KK%<D?=\S`O
+MO'#O%=G+A#_<C^-W'Z[_^+<?/FC]\MQX?>6!^JDT9/TFT?HENCYK[7%>?K%^
+M5994U2O7YE/]'OZ[7HA<GW']BM37S]W?^<7_]]^XO#]M_UL3YCZAV0IS=_/9
+,]*O_`W*E&0&37@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow.gz.uu
new file mode 100644
index 0000000..c016f6e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow.gz.uu
@@ -0,0 +1,126 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.qcow.gz
+M'XL(",,S(E0``VEM9RTV,W@R-34M-#`Y-BUB<V0N<6-O=RYO=70`K9W)CAM)
+MLD7W]174/$LTLR`9H1D-O`?TKGOSWK8XKOD!ZG]O#1'NF<9SRZK1I1*$%%)Q
+M07H>'0&J`]=Z_>O;:K6QU;!=#=/J<EA]__G\W59W?G+_^^K;/__W[V_O?OOV
+MVZ\Q6__!4^GGN]-JFN?N;?VKS_F/IXZK]?0GYKY_-YJ[\^KB/WAU=][L[=S+
+MWWZ]67[.U6#<&US-<^OY]9DXO>'/O;ZOZ>W:K]/[Z]ZNB[>[48/;>X/_F.=^
+MGU^?B[>[4W/CO;EK>KLNWNZDYO9_"(L+6`YJ[EC,#?C42<V=B[D-/G7A.?N#
+MK^VON2T^96K.<6[5YG;X5*BYX=[<^NT"]#(WXE.".RNYF_`IP9V5W.WQ*<&=
+ME=P=\"G!G97<'?$IP9V5W)WP*<&=E]R=\2G!G9?<7?`IP9U7W!D_);CSBCLC
+MW[GBSBONC'SGBCNON#/RG2ONO.+.R'>NN/.*.R/?N>(N*NZ,?!>*NZBX,_)=
+M*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B;BBY
+M(]\-BKNAY(Y\-RCNAHH[YZ<$=T/%G9/O!L7=4''GY+M!<3=4W#GY;E#<#15W
+M3KX;%'=#Q9V3[P;%W:;BSLEW&\7=IN+.R7<;Q=VFY(Y\MU'<;4KNR'<;Q=VF
+MY(Y\MU'<;4KNR'<;Q=VFY(Y\MU'<;4KNR'<;Q=VVY(Y\MU7<;4ONR'=;Q=VV
+MXB[X*<'=MN(NR'=;Q=VVXB[(=UO%W;;B+LAW6\7=MN(NR'=;Q=VVXB[(=UO%
+MW:[B+LAW.\7=KN(NR'<[Q=VNY(Y\MU/<[4KNR'<[Q=VNY(Y\MU/<[4KNR'<[
+MQ=VNY(Y\MU/<[4KNR'<[Q=U8<D>^&Q5W8\D=^6Y4W(T5=P,_);@;*^X&\MVH
+MN!LK[@;RW:BX&RON!O+=J+@;*^X&\MVHN!LK[@;RW:BX6_[Z6\^1[R;%W51Q
+M-Y#O)L7=5')'OIL4=U/)'?EN4MQ-)7?DNTEQ-Y7<D>\FQ=U4<D>^FQ1W4\D=
+M^6Y2W.U+[LAW>\7=ON2.?+=7W.TK[C;\E.!N7W&W(=_M%7?[BKL-^6ZON-M7
+MW&W(=WO%W;[B;D.^VRON]A5W&_+=7G&W_&](/4>^.RCN#A5W&_+=07%W*+DC
+MWQT4=X>2._+=07%W*+DCWQT4=X>2._+=07%W*+DCWQT4=X>2._+=07%W++DC
+MWQT5=\>2._+=47%WK+C;\E."NV/%W99\=U3<'2ONMN2[H^+N6'&W)=\=%7?'
+MBKLM^>ZHN#M6W&W)=T?%W:GB;DN^.RGN3A5W6_+=27%W*KDCWYT4=Z>2._+=
+M27%W*KDCWYT4=Z>2._+=27%W*KDCWYT4=Z>2._+=27%W+KDCWYT5=^>2._+=
+M67%WKKC;\5."NW/%W8Y\=U;<G2ON=N2[L^+N7'&W(]^=%7?GBKL=^>ZLN#M7
+MW.W(=V?%W:7B;D>^NRCN+A5W._+=17%W*;DCWUT4=Y>2._+=17%W*;DCWUT4
+M=Y>2._+=17%W*;DCWUT4=Y>2._+=17!GRP=Z#GQG:\&=K4ONP'>V%MS9NN)N
+MY*>8.RO[NQ%\9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>J
+MO[.ROQO!=Z;Z.RO[NQ%\9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK
+M^[L1?&>JO[.ROQO!=Z;Z.RO[NQ%\9ZJ_L[*_&\EWJK^SLK\;R7>JO[.ROYOX
+M*<%=V=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9V=]-Y#O5WUG9WTWD.]7?6=G?
+M3>0[U=]9V=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9V=]-Y#O5WUG9WTWD.]7?
+M6=G?3>0[U=]9V=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9V=_M^2G!7=G?[<EW
+MJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^4_V=E?W=GGRG^CLK^[L]^4[U=U;V
+M=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3
+M_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[.\._)3@KNSO#N0[U=]9V=\=
+MR'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W
+M5O9W!_*=ZN^L[.\.Y#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`
+MOE/]G97]W8%\I_H[*_N[`_E.]7=6]G='?DIP5_9W1_*=ZN^L[.^.Y#O5WUG9
+MWQW)=ZJ_L[*_.Y+O5']G97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.
+M]7=6]G='\IWJ[ZSL[X[D.]7?6=G?'<EWJK^SLK\[DN]4?V=E?W<DWZG^SLK^
+M[DB^4_V=E?W=D7RG^CLK^[L3/R6X*_N[$_E.]7=6]G<G\IWJ[ZSL[T[D.]7?
+M6=G?G<AWJK^SLK\[D>]4?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3
+M^4[U=U;V=R?RG>KOK.SO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.
+MRO[N1+Y3_9V5_=V9GQ+<E?W=F7RG^CLK^[LS^4[U=U;V=V?RG>KOK.SOSN0[
+MU=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[
+MNS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5']G97]W)M^I
+M_L[*_N["3PGNRO[N0KY3_9V5_=V%?*?Z.RO[NPOY3O5W5O9W%_*=ZN^L[.\N
+MY#O5WUG9WUW(=ZJ_L[*_NY#O5']G97]W(=^I_L[*_NY"OE/]G97]W85\I_H[
+M*_N["_E.]7=6]G<7\IWJ[ZSL[R[D.]7?^?)!FEOU.?#=]Z>8.T_]W7*?WJIS
+M![YSU=]YZN]6,W>KA;M8\U/,G:?^;C5SM_J]S8'O7/5WGOJ[U36=7=#]=Z[Z
+M.T_]73N[/@>^<]7?>>KO8`Y\YZJ_\]3?P1SXSE5_YZF_6^8>]#GPG:O^SE-_
+M]V"96[4Y\)VK_LY3?_=@YNY!YPY\YZJ_\]3?/9BY>]"Y`]^YZN\\]7</KC=G
+M![YSU=]YZN_:V?4Y\)VK_LY3?P=SX#M7_9VG_@[FP'>N^CM/_=TR][#/D>]4
+M?^>IOWNXS'7NR'>JO_/4WSV<N7O8N*/[[USU=Y[ZNX<S=P\;=W3_G:O^SE-_
+M]_":SX[NOW/5WWGJ[]K9]3GRG>KO//5W,$>^4_V=I_X.YLAWJK_SU-\M<X_Z
+M'/E.]7>>^KM'RUSCCNZ_<]7?>>KO'LW</>K<D>]4?^>IOWLT<_>H<T>^4_V=
+MI_[NT?7F[,AWJK_SU-^UL^MSY#O5WWGJ[V".?*?Z.T_]'<R1[U1_YZF_6^8>
+M]SGRG>KO//5WCY>YSAWY3O5WGOJ[QS-WCQMW=/^=J_[.4W_W>.;N<>..[K]S
+MU=]YZN\>7_/9T?UWKOH[3_U=.[L^1[Y3_9VG_@[FR'>JO_/4W\$<^4[U=Y[Z
+MNV7N29\CWZG^SE-_]V29:]S1_7>N^CM/_=V3F;LGG3ORG>KO//5W3V;NGG3N
+MR'>JO_/4WSVYWIP=^4[U=Y[ZNW9V?8Y\I_H[3_T=S)'O5'_GJ;^#.?*=ZN\\
+M]7?+W-,^1[Y3_9VG_N[I,M>Y(]^I_LY3?_=TYNYIXX[NOW/5WWGJ[Y[.W#UM
+MW-']=Z[Z.T_]W=-K/CNZ_\Y5?^>IOVMGU^?(=ZJ_\]3?P1SY3O5WGOH[F"/?
+MJ?[.4W^WS#WK<^0[U=]YZN^>+7.-.[K_SE5_YZF_>S9S]ZQS1[Y3_9VG_N[9
+MS-VSSAWY3O5WGOJ[9]>;LR/?J?[.4W_7SJ[/D>]4?^>IOX,Y\IWJ[SSU=S!'
+MOE/]G:?^;IE[WN?(=ZJ_\]3?/5_F.G?D.]7?>>KOGL_</6_<T?UWKOH[3_W=
+M\YF[YXT[NO_.57_GJ;][?LUG1_??N>KO//5W[>SZ'/E.]7>>^CN8(]^I_LY3
+M?P=SY#O5WWGJ[Y:Y%WV.?*?Z.T_]W8MEKG%']]^YZN\\]7<O9NY>=.[(=ZJ_
+M\]3?O9BY>]&Y(]^I_LY3?_?B>G-VY#O5WWGJ[]K9]3GRG>KO//5W,$>^4_V=
+MI_X.YLAWJK_SU-\M<R_['/E.]7>>^KN7RUSGCGRG^CM/_=W+F;N7C3NZ_\Y5
+M?^>IOWLY<_>R<4?WW[GJ[SSU=R^O^>SH_CM7_9VG_JZ=79\CWZG^SE-_!W/D
+M.]7?>>KO8(Y\I_H[3_W=,O>JSY'O5'_GJ;][M<PU[NC^.U?]G:?^[M7,W:O.
+M'?E.]7>>^KM7,W>O.G?D.]7?>>KO7EUOSHY\I_H[3_U=.[L^1[Y3_9VG_@[F
+MR'>JO_/4W\$<^4[U=Y[ZNV7N=9\CWZG^SE-_]WJ9Z]R1[U1_YZF_>SUS][IQ
+M1_??N>KO//5WKV?N7C?NZ/X[5_V=I_[N]36?'=U_YZJ_\]3?M;/K<^0[U=]Y
+MZN]@CGRG^CM/_1W,D>]4?^>IOUOFWO0Y\IWJ[SSU=V^6N<8=W7_GJK_SU-^]
+MF;E[T[DCWZG^SE-_]V;F[DWGCGRG^CM/_=V;Z\W9D>]4?^>IOVMGU^?(=ZJ_
+M\]3?P1SY3O5WGOH[F"/?J?[.4W^WS+WM<^0[U=]YU=\%W7_GJK_SJK\+NO_.
+M57_G57\7=/^=J_[.J_XNZ/X[5_V=5_U=T/UWKOH[K_J[H/OO7/5W7O5W0???
+MN>KO7/1W[_H<^4[U=Y[ZNW?+7...[K]SU=]YZN_>S=R]Z]R1[U1_YZF_>S=S
+M]ZYS1[Y3_9VG_N[=]>;LR'>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O
+M5'\7RP=I;MWGP'>A^KOOG[C'W>*G=><.?!>JOXO4WZWGO77CCNZ_"]7?1>KO
+MUC-WZ\8=W7\7JK^+U-^MK_GLZ/Z[4/U=I/ZNG5V?`]^%ZN\B]7<P![X+U=]%
+MZN]@#GP7JK^+U-\M<];GP'>A^KM(_9TM<XT[NO\N5'\7J;^S^>59YPY\%ZJ_
+MB]3?V<R==>[`=Z'ZNTC]G5UOS@Y\%ZJ_B]3?M;/K<^"[4/U=I/X.YL!WH?J[
+M2/T=S('O0O5WD?J[9<[['/E.]7>1^CM?YCIWY#O5WT7J[WSFSAMW=/]=J/XN
+M4G_G,W?>N*/[[T+U=Y'Z.[_FLZ/[[T+U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7
+MJ;^#.?*=ZN\B]7?+7/0Y\IWJ[R+U=[',->[H_KM0_5VD_BYF[J)S1[Y3_5VD
+M_BYF[J)S1[Y3_5VD_BZN-V='OE/]7:3^KIU=GR/?J?XN4G\'<^0[U=]%ZN]@
+MCGRG^KM(_=TR-_0Y\IWJ[R+U=\,RU[DCWZG^+E)_-\S<#8T[NO\N5'\7J;\;
+M9NZ&QAW=?Q>JOXO4WPW7?'9T_UVH_BY2?]?.KL^1[U1_%ZF_@SGRG>KO(O5W
+M,$>^4_U=I/YNF=OT.?*=ZN\B]7>;9:YQ1_??A>KO(O5WFYF[3>>.?*?ZNTC]
+MW6;F;M.Y(]^I_BY2?[>YWIP=^4[U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7J;^#
+M.?*=ZN\B]7?+W+;/D>]4?Q>IO]LN<YT[\IWJ[R+U=]N9NVWCCNZ_"]7?1>KO
+MMC-WV\8=W7\7JK^+U-]MK_GLZ/Z[4/U=I/ZNG5V?(]^I_BY2?P=SY#O5WT7J
+M[V".?*?ZNTC]W3*WZW/D.]7?1>KO=LM<XX[NOPO5WT7J[W8S=[O.'?E.]7>1
+M^KO=S-VN<T>^4_U=I/YN=[TY._*=ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^+E)_
+M!W/D.]7?1>KOEKFQSY'O5'\7J;\;E[G.'?E.]7>1^KMQYFYLW-']=Z'ZNTC]
+MW3AS-S;NZ/Z[4/U=I/YNO.:SH_OO0O5WD?J[=G9]CGRG^KM(_1W,D>]4?Q>I
+MOX,Y\IWJ[R+U=\O<U.?(=ZJ_B]3?3<M<XX[NOPO5WT7J[Z:9NZES1[Y3_5VD
+M_FZ:N9LZ=^0[U=]%ZN^FZ\W9D>]4?Q>IOVMGU^?(=ZJ_B]3?P1SY3O5WD?H[
+MF"/?J?XN4G^WS+WO<^0[U=]%ZN_>+W.=._*=ZN\B]7?O9^[>-^[H_KM0_5VD
+M_N[]S-W[QAW=?Q>JOXO4W[V_YK.C^^]"]7>1^KMV=GV.?*?ZNTC]'<R1[U1_
+M%ZF_@SGRG>KO(O5WR]R'/D>^4_U=I/[NPS+7N*/[[T+U=Y'ZNP\S=Q\Z=^0[
+MU=]%ZN\^S-Q]Z-R1[U1_%ZF_^W"].3ORG>KO(O5W[>SZ'/E.]7>1^CN8(]^I
+M_BY2?P=SY#O5WT7J[Y:YCWV.?*?ZNTC]W<=EKG-'OE/]7:3^[N/,W<?&'=U_
+M%ZJ_B]3??9RY^]BXH_OO0O5WD?J[C]=\=G3_7:C^+E)_U\ZNSY'O5'\7J;^#
+M.?*=ZN\B]7<P1[Y3_5VD_FZ9^]3GR'>JOXO4WWU:YAIW=/]=J/XN4G_W:>;N
+M4^>.?*?ZNTC]W:>9NT^=._*=ZN\B]7>?KC=G1[Y3_5VD_JZ=79\CWZG^+E)_
+M!W/D.]7?1>KO8(Y\I_J[2/W=,O>YSY'O5'\7J;_[O,QU[LAWJK^+U-]]GKG[
+MW+BC^^]"]7>1^KO/,W>?&W=T_UVH_BY2?_?YFL^.[K\+U=]%ZN_:V?4Y\IWJ
+M[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?+7-?^ASY3O5WD?J[+\M<XX[NOPO5WT7J
+M[[[,W'WIW)'O5'\7J;_[,G/WI7-'OE/]7:3^[LOUYNS(=ZJ_B]3?M;/K<^0[
+MU=]%ZN]@CGRG^KM(_1W,D>]4?S<L'Z2YKWT.?#>H_FY(_=W79:YS![[[_A1S
+M-Z3^[NO,W=>%NV'-3S%W0^KOOL[<??V]S=&_M]V.2'[BV]OT[=MO+W\.;GZ^
+MOL%7ZSW\J#_Q[6]O[__7!G]>"+/9K8;-:K-=C?YG7^'__\__I5?X:^XO>\._
+MYN@?&+\WM[S@)KR;N2]WYGX(_G+G5Z[MSE-'ZW]<'\>;/[I_?/O\]HZ1-W0A
+M3)_[0?29/B'?+/T#X_\-+#>7KMS].O^\9#=6Z^4OW-/-E>WKN^JOCR+F>V_W
+M#U[?ZO;M_I3H[OZOMSMS7KS=U?VYGQ*]\_6\]R4L3N_S[:NC?\3[O_EBW%P=
+M\B=_Y_X8N?\[]]><_[4BV/TTRP_/[>%'_8EO_WA[_[]?@\//P=_^#8HD%YJ!
+#I0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow2.gz.uu
new file mode 100644
index 0000000..b27f56c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.qcow2.gz
+M'XL("+H[(U0``VEM9RTV,W@R-34M-#`Y-BUB<V0N<6-O=S(N;W5T`*V8VY+3
+M,`R&[_L4Y@P+E%AR3ARVL+#,<`<W<-UVVZ?H\.RL:R5*%"E>.FD[F>FX_S=R
+M_%E)6A3IY5SI7:A<:-UQY^Z_TP?<X,OXXTZ_OO]8#U^G58+YPD@I`_6AQXU8
+M?QD'%J[PTP&OXP;5H8*#+C4%Y7#!K&YN0,%=K<ZG[KP8C4C@)<"$,Q?CHOH@
+MU2<3X<+Z8.GZ4#]_99>3`]5\?9CJDZG:PC59'"BIUL)MLSA44CL+M\_B@I*Z
+MLW#&SAW@2B5U-'`^H\H]KE)2WL)!%E<K*;1P(8MKE)3EG<][URHIRSN?]VZK
+MI"SO?-Z[G9*RO/-Y[_9*RO+.Y[V[4U*6=V!XYQAW4%*6=R"\>T2XQXP[*BG+
+M.Q#>/2'<TQ[GM93E'0COGA'N.>.4?@>6=R"\>T&XEXQ3^AU8WH'P[A7AKABG
+M]#NPO`/AW6O"O6&<TN_`\@Z$=V\GWGFEWX'E'0KOWA&K8)S2[]#R#H5WGG#`
+M.*7?H>4="N^0<(%Q2K]#RSL4WI6$JQBG]#NTO$/A74VXAG%*OT/+.Q3>M81[
+MSSBEWZ'E'0KO/A#N(^.4?H>6=RB\^T2X:\8I_0XM[X+P;D.XSXQ3^EVPO`O"
+MNR^$NV&<TN^"Y5T0WGTEW+<>!UJJ]ZXH]`_A;B=[%I:]_PQ\?^R5HSTP`VS^
+M!SA78<*UBTZX3!..&FR5HSUPNEF/WSWPO,)E'5>UK%P##ZWPS^WOZ83+!5<X
+MX>S'41KH"NZWX`2W&>#B%>TX^.5P'=W>\_8?$@>XZ\3K<+./H_$>^Z`-F),M
+M%Y8%&I$;KG.\M8MWX%UW%[=F_?HZKD^1&4;3G:G/3:<;KQK]TYU8CXB#S'3=
+M&!>O&F)?\A)FSMYF6MU^X<5`N3,>N',C9+QS$PZ6;020_I<JXJ^F1WO@]',]
+6?B=@(.!B9S!4L?>M_@&MW,<Y0Q,`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.raw.gz.uu
new file mode 100644
index 0000000..b44538e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.raw.gz
+M'XL("`#&'50``VEM9RTV,W@R-34M-#`Y-BUB<V0N<F%W+F]U=`"ME#L.@S`,
+M0'=.X;E#E&])%RI5ZMZIG2F%4^3P38`4FQ#H$`<B(MM/_N!P/@F`EL#;C3VO
+M<#=&EZM.U4B3`6AJT`;,&:PWY\M##D3A7O<GP^)FG-CSRN/82B).'N%BP&K(
+MX:X(I[QR0)9<(*].@.KG`_Y&N&9Z(T[O1><KP?LM13994ZIVL;=VY8?[#*('
+MH8#;62<I\-=?6.*[I&%(DNY.?)"FVP9<3>T%PLF#=('BW@&'^DE:>%"])HVN
+M*]P,M9Z,/R<W0.CD3CA9]B*0X\WB_T!OE>YYA7LPNB:@GH'%*EA_K"=67[CE
+&;;$%!0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhd.gz.uu
new file mode 100644
index 0000000..97c5f24
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.vhd.gz
+M'XL("#8UQ%4``VEM9RTV,W@R-34M-#`Y-BUB<V0N=FAD+F]U=`"MELE.PS`0
+MAN]]BI&X<:B<L6.'"TA(W#G!.4U35"$640X]I._.C!=B9RN+F]1R9,_G?Q9;
+M%L+]`+0$O0/=@BZY;Q3H*S`5``WZ%VU;^$_HFK?7MOG<']?^UZT<K!"Q56K.
+M]BA!T2(&L.9%]);[T`7,^N+NZ7+_\A1PZ''H0:5A*XF@-Z-US!8JMX[%/>[Q
+MV2)/O3HY5M=;.0=W.Y"[:(8,ZDZVO8F=561%\_DM86-L?,*;?"0#O;.#V)5B
+M8!7)G`JJZ)V=PNDEJ]_@+E<^%ZY4J#`,M0)T`0:Y3V43XC!ZJ52.A_?ZX]`.
+M].%,J>@H&<,Q->\N^E+!,-DK4"QPR5VPE,,0-U$J_XJ>3NV4[U`01!D&T+J?
+M1J]'0:Q/%V(AYO/)F-57LSY%.Z&>:.<'NMMU^GP#&P;2?J7M7FJ_QWX2P<>[
+MAZG\-C/E\L?=T>`Y7!`<GP8I[B;"29>.GA(5+S0%R-9_Q/T(=^W^`:>6U''-
+MM%,#L\Z6F8NYJ09V<9ZA:*&0(*JHJB/@=WZAUW<UEH&)NPOZ8.QNS3B3SB\B
+M')YQ%U+<QI_+86:2PC/1NQZK:S(G8SO<&3_<N0Q)=Z[#8=Z#`.W)0A5(L\;M
+M_$!WOTX?!T1_5&4[^S`<5;D4*@_,II"`;6:%V"X6VV^K4&-E7<YTD61<QHLD
+CXS)>)!F7\2+)N(P72<9EO$@R+NM%DH!4>ZLOT2?4EGT,````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdf.gz.uu
new file mode 100644
index 0000000..5983e57
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.vhdf.gz
+M'XL("*PEAE4``VEM9RTV,W@R-34M-#`Y-BUB<V0N=FAD9BYO=70`K90[;\,@
+M$(!W_XJ3NF6PX'B8+$U4*7NG=G9<'$55VZ5#!WY\(38Q9_RH*@.VC([[?`_N
+M&.L&@$1@]<1[7N">2CI=L2MN-`Q`58%4H#08?YP-BVR(P+V>7LITN!['E[3F
+M<>5H1!RNX:+!HIW#'1*<\,(V.<EXHM5P$';8RPG<HW^.`TXN6><CP>R48-99
+MM57L8F[-2"_-,W`+7``SO0PI\)Y?&.S;YV8@<7?!/LC=K0.NHN=Y@L,5=X'B
+MS@''R>$AA2O1.^;6-1LG0XPKXX^5&R"T<CL<;ML(\-99_`WTI_+WO,`]EW1V
+M0-D#-XN@Z7N?%J!;T!:T"M^5!+V'RJ1`I#?)-5^?MOF^_J09#CC>-8/)%?11
+MA&K1%6`=?J+?PG=BW\/ILKM^7"(NMJK8D7RQ>2V!H,^9NV94;%=\'ULG\B`9
+M$CT>[$S;GO\SB=XAQ<F[L]9"T\4G+K(A@LE6%7"*C;3^F]L.IS>^*O[R%;]:
+',:4),`<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-bsd.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vmdk.gz.uu
new file mode 100644
index 0000000..3df9b01
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-bsd.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-bsd.vmdk.gz
+M'XL("`'&'50``VEM9RTV,W@R-34M-#`Y-BUB<V0N=FUD:RYO=70`K9Q;;R/'
+M$87?_2L:\EL>B#F<^\,FCB,'"((`AFW8K^;<8B'V[D(K!%F`/S[3,WU:9T2-
+M>V"5S%VREE7%[NIAB?[J@%FV_CA7=*XH7#&XLG(9W/Q/Z\UE^;,QWXKXQ/6?
+M]__Z\<2?KTZGZQ=K,O@H"4&FZ<38O,[U].*'Z<Z_%[5Y8KZ=D^ER']7=!(9T
+MYYTG=M/-]7#GUT*XNLOR].`?2#H7$[E-NO*5/>UN]O=6]Z<O0O'\^G*_AOEX
+MJ];5N:NZ8+JJ7.S<U>?EN<S5L],T)_S2W3]\^H^['S_UCP\?GSZ$]9W]V<[.
+M1>7]J]YGF#=65_Z!?\*G:WV*:G3YX'+XI]WU\>\/OXZG_XZ/GQX^O'\';O?L
+MS[;(7='ZY7C_[/FV,?R+9*Z"?PUW_=L_[M^%*S<[?;P\,IV/FA<RO_:\#\U;
+M5<[_N;TMJQO?/_F,4_B)J_-G&XI3+J]=^`=EX>K6+<LI?>[S_/00MKS4KG\<
+M+T_C#Y\_CN_N?OOP/M;.GZTO6;LD:I9"Y:[,?:JP-5^^TF?TE\UR:N[ZZ\/3
+M+P_]]_,V/XUWIR\=TU6^=O,!-F%=ZZ[GD&KW9.=E7[_YW].\7S>$DWU@NF41
+MRR;FUR[/KJQ]KOD`\[EV>>[RQN5+^GG!\TX*>"=W_?#^]-U/#E7>%.[[;__Z
+M'=,U<[K9<U[@'#)O:+.G<MU_^?*R=-?OOW%W?I,__#(N5R#3M>O;S#NOYX#%
+M//L'H6IK>M_$"O_$<K+N_O)T<5]?/HVG+^_OOXXG>_&;+9;;O+319ZG6U/[Z
+M7LHY%VX]Z?6@EZ,8ANYT&2X?G\9'?[SQ*#I_M0YAI_Y8B^=CW+Y.O9S4Y*\8
+M=WWG[AZ&^4Q]VG^/'WYCNGZ]C.=U^$NB70)S_V"^>I;T8WB%]8KQQ^33C4^/
+MGT_]YU\?W@_S&\V]8[IAK=V\G/DTUT7%-;U<5'S9N79W>%[:G)OI1E^B=5%-
+M>&/,N=9U/%<AGV^EOX4J7#^??ADOP[PL=W<NR[MX%-/+H]`2O:C">M!S+=:C
+M"`O[?/HT]B%=GH4#G#;%6=?D+^7Y2EY7M&V@3Q\>EZ55^9WVX_SE[[*W]N/B
+MYE=J_0<3KNFLUU=E+WZ?Y1I7B%%N$OK?8MGZ,>#T[?/Z*K^^2CQKC6K$:#?I
+M?IY3?+S=;N4OL8MX=AK5BS$<J5[E?U^,XCF]K!X_:D`>[Z?C9P%ZYAI5B%%N
+MTNW5K@RUHV>M48T8[2;=7NVJ4#MZ=AK5BS$<VFP=:D?/2:/\'3]*(3OPL:QJ
+M0NWHF6M4(4:Y2;=7NS;4CIZU1C5BM)MT>[6[A-K1L].H7HSAT&:[4#MZ3AKE
+M[]@@((_WT_6A=O3,-:H0H]RDVZO=$&I'SUJC&C':3;J]VHVA=O3L-*H78SBT
+MV2G4CIZ31OF[0FI7I-+56:@=/7.-*L0H-^EV:E>SW]&SUJA&C':3;J=V-?L=
+M/3N-ZL48#FV6_8Z>DT;YNU)J5R;3L=_1,]>H0HQRDVZO=NQW]*PUJA&CW:3;
+MJQW['3T[C>K%&`YMEOV.GI-&^;M*:E<ET['?T3/7J$*,<I-NKW;L=_2L-:H1
+MH]VDVZL=^QT].XWJQ1@.;9;]CIZ31OD[?@B"/-Y/QWY'SURC"C'*3;J]VK'?
+MT;/6J$:,=I-NKW;L=_3L-*H78SBT6?8[>DX:Y>\:J5V32M=DH7;TS#6J$*/<
+MI-NI7<-^1\]:HQHQVDVZG=HU['?T[#2J%V,XM%GV.WI.&N7O6JE=FTS'?D?/
+M7*,*,<I-NKW:L=_1L]:H1HQVDVZO=NQW].PTJA=C.+19]CMZ3AKE[_B_4)#'
+M^^G8[^B9:U0A1KE)MU<[]CMZUAK5B-%NTNW5COV.GIU&]6(,AS;+?D?/2:/\
+M'?DCY/%^.O8[>N8:58A1;M+MU8[]CIZU1C5BM)MT>[5COZ-GIU&]&,.AS;+?
+MT7/2*'_72^WZ5+HV"[6C9ZY1A1CE)MU.[5KV.WK6&M6(T6[2[=2N9;^C9Z=1
+MO1C#H<VRW]%STBA_-TCMAF0Z]CMZYAI5B%%NTNW5COV.GK5&-6*TFW1[M6._
+MHV>G4;T8PZ'-LM_1<](H?S=*[<9D.O8[>N8:58A1;M+MU8[]CIZU1C5BM)MT
+M>[5COZ-GIU&]&,.AS;+?T7/2*'\W2>VF9#KV.WKF&E6(46[2[=6._8Z>M48U
+M8K2;='NU8[^C9Z=1O1C#H<VRW]%STJA,IF>0Q[OI+ME:N^B9:U0A1KE)MU.[
+M2^AWT;/6J$:,=I-NIW:7T.^B9Z=1O1C#H<V&?A<])XWR)1-^AR32NH1^!^%W
+M4'X'X7=(\KM+Z'<0?@?E=Q!^AR2_NX1^!^%W4'X'X7<'-AOZ'83?0?D=A-\A
+MB;0NH=]!^!V4WT'X'9+\[A+Z'83?0?D=A-\AR>\NH=]!^!V4WT'XW8'-AGX'
+MX7=0?@?A=T@BK4OH=Q!^!^5W$'Z')+^[A'X'X7=0?@?A=TCRNTOH=Q!^!^5W
+M$'YW8+.AWT'X'93?0?@=DDBKRT+MA-]!^1V$WR')[SKV.^%W4'X'X7=(\KN.
+M_4[X'93?0?C=@<VRWPF_@_(["+]#$FEU['?"[Z#\#L+OD.1W'?N=\#LHOX/P
+M.R3Y7<=^)_P.RN\@_.[`9MGOA-]!^1V$WR&)M#KV.^%W4'X'X7=(\KN._4[X
+M'93?0?@=DORN8[\3?@?E=Q!^=V"S['?"[Z#\#L+OD$1:'?N=\#LHOX/P.R3Y
+M7<=^)_P.RN\@_`Y)?M>QWPF_@_(["+\[L%GV.^%W4'X'X7=((JT^"[43?@?E
+M=Q!^AR2_Z]GOA-]!^1V$WR')[WKV.^%W4'X'X7<'-LM^)_P.RN\@_`Y)I-6S
+MWPF_@_(["+]#DM_U['?"[Z#\#L+OD.1W/?N=\#LHOX/PNP.;9;\3?@?E=Q!^
+MAR32ZMGOA-]!^1V$WR')[WKV.^%W4'X'X7=(\KN>_4[X'93?0?C=@<VRWPF_
+M@_(["+]#$FGU['?"[Z#\#L+OD.1W/?N=\#LHOX/P.R3Y7<]^)_P.RN\@_.[`
+M9MGOA-]!^1V$WR&)M(8LU$[X'93?0?@=DOQN8+\3?@?E=Q!^AR2_&]COA-]!
+M^1V$WQW8+/N=\#LHOX/P.R21UL!^)_P.RN\@_`Y)?C>PWPF_@_(["+]#DM\-
+M['?"[Z#\#L+O#FR6_4[X'93?0?@=DDAK8+\3?@?E=Q!^AR2_&]COA-]!^1V$
+MWR')[P;V.^%W4'X'X7<'-LM^)_P.RN\@_`Y)I#6PWPF_@_(["+]#DM\-['?"
+M[Z#\#L+OD.1W`_N=\#LHOX/PNP.;9;\3?@?E=U%,!WDLZ=SZ)Z0;L[5VKTK*
+M7_FG6#OWZNI&8WT@%GU@G"FLN_IC"==TUNN+\VW>WJ1?1)QO\_8F_2+B?)NW
+M-^D7$>?;O+U)OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+
+MB/-M$_TBXGS;1+^(.-\VT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1+R+.MTWT
+MBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+B/-M$_TBXGS;1+^(.-\VT2\BSK=-
+M](N(\VT3_2+B?-M$OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_",ZW;?2+X'S;
+M1K\(SK=M](O@?-M&OPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(SK=M](O@?-M&
+MOPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(SK=M](O@?-M&OPC.MVWTB^!\VT:_
+M",ZW;?2+X'S;1K\(SK=M](O@?-M&OPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(
+MSK=M](O@?-M&OPC.MVWTB^!\VT:_",ZW;?2+X'S;1K^(.-^FYYOTBXCS;7J^
+M2;^(.-^FYYOTBXCS;7J^2;^(.-\VT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1
+M+R+.MTWTBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+B/-M$_TBXGS;1+^(.-\V
+MT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_B#C?
+M-M$O(LZW3?2+B/-M$_TBXGS;1+^(.-\VT2\BSK=-](N(\VT3_2+B?-M$OPC.
+MMVWTBQA-]8L83?6+&$WUBQA-]8L83?6+&$WUBQA-]8L83?6+&$WUBQA-]8L8
+M3?6+&$WUBQA-]8L83?6+&$WUBYBRS%"_B,E4OXC)5+^(R52_B,E4OXC)5+^(
+MR52_B,E4OXC)5+^(R52_B,E4OXC)5+^(R52_B,E4OXC)5+^(R52_>,ZRS%"_
+M>+[Y+N&#Z6XWN^H#BV5]Z[>#WOZ]_\3UZ]/VOYAP^8+=LO9?=%I6KCD?7>%/
+MW_SXRH:+L]F&UW0W7Y[\,EWD7=->NK](.M_@)_'<?!=S#Y>/SW;Q2KH_G^2;
+MHHOE"W9W5Z=SBF.;-?[RY&+Y$EOUU7/V'<:#'WZ>?_'>B.?KGM?7WB[CO-GN
+M[ZS/W6[7-U']^E`]C\V[=6>[;IO.-U$]S\T1)JKWU>WJ>N/#N/DJUH/O7)]D
+G^\Y=TYUM&T&U=)9U^'_[]_X3UV]/V__6A,62\(O_`X=39<Z@70``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow.gz.uu
new file mode 100644
index 0000000..c5c9257
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow.gz.uu
@@ -0,0 +1,128 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.qcow.gz
+M'XL("%[N+50``VEM9RTV,W@R-34M-#`Y-BUE8G(N<6-O=RYO=70`K9W9CE39
+M$47?^8IDAF+*B+@C0U7)DBWYS7ZP_=IW?,X/0/YV`W6&JKA[$[2[:=0"T7<K
+M\]3*1=N]=#B?[[Z=3JV<FN[4C*=]/GW[>?HNIWL_>?C]]/6??_O[^_O?OCZZ
+M&Y/S3YYR/^^W,O=@Z[]U3K\_M9S.XR_,??LN:.[>J[/?\>KNO=GCW-6CNS>+
+MGU,V:`\&3VGNG%Z?D--K?NWUW;JW*W>G]^>]725OM_VUP7^XUZ>_"Y9?>GV_
+M\^O;P<'?RNMKX%,]FQL>S%T.;[>%3XUL;OHIS'KNX%,SFUN"N1X^M;*Y+9@;
+MX%,[GI.??&WOYD;XE+`YA7.G,C?!IXS--0_FSFGNMLS-\"GRN1#'7?Y<5.X6
+M^!3A3D+N5O@4X4Y"[C;X%.%.0NYV^!3A3B+N!#]%N-.(.T&*4L:=1MP),K(R
+M[C3B3I#OE'&G$7>"?*>,.XVX$^0[9=QIQ)T@WRGC3B/N!/E.&7<:<H=\IXP[
+M"[E#OC/&G87<(=\9X\Y"[I#OC'%G(7?(=\:XLY`[Y#MCW%G('?*=,>XLY`[Y
+MSAAW%G&G^"G"71-QI\AW#>.NB;A3Y+N&<==$W"GR7<.X:R+N%/FN8=PU$7>*
+M?-<P[IJ(.T6^:QAW3<2=(M\UC+LFY`[YKF'<M2%WR'<MXZX-N4.^:QEW;<@=
+M\EW+N&M#[I#O6L9=&W*'?-<R[MJ0.^2[EG'7AMPAW[6,NS;BSO!3A+LNXLZ0
+M[SK&71=Q9\AW'>.NB[@SY+N.<==%W!GR7<>XZR+N#/FN8]QU$7>&?-<Q[KJ(
+M.T.^ZQAW7<@=\EW'N.M#[I#O>L9='W*'?-<S[OJ0.^2[GG'7A]PAW_6,NS[D
+M#OFN9]SU(7?(=SWCK@^Y0[[K&7=]Q%V#GR+<#1%W#?+=P+@;(NX:Y+N!<3=$
+MW#7(=P/C;HBX:Y#O!L;=$''7(-\-C+LAXJY!OAL8=T/$78-\-S#NAI`[Y+N!
+M<9?_[WD^AWPW,N[&D#ODNY%Q-X;<(=^-C+LQY`[Y;F3<C2%WR'<CXVX,N4.^
+M&QEW8\@=\MW(N!LC[EK\%.%NBKAKD>\FQMT4<=<BWTV,NRGBKD6^FQAW4\1=
+MBWPW,>ZFB+L6^6YBW$T1=RWRW<2XFR+N6N2[B7$WA=PAWTV,N_R?2?D<\MW,
+MN)M#[I#O9L;=''*'?#<S[N:0.^2[F7$WA]PAW\V,NSGD#OEN9MS-(7?(=S/C
+M;HZXZ_!3A+LEXJY#OEL8=TO$78=\MS#NEHB[#OEN8=PM$7<=\MW"N%LB[CKD
+MNX5QMT3<=<AW"^-NB;CKD.\6QMT2<H=\MS#NUI`[Y+N5<;>&W"'?K8R[->0.
+M^6YEW*TA=\AW*^-N#;E#OEL9=VO('?+=RKA;0^Z0[U;&W1IQU^.G"'<D$+HW
+MAWRW,>ZVB+L>^6YCW&T1=SWRW<:XVR+N>N2[C7&W1=SUR'<;XVZ+N.N1[S;&
+MW19QUR/?;8R[+>0.^6YCW.TA=\AW.^-N#[E#OML9=WO('?+=SKC;0^Z0[W;&
+MW1YRAWRW,^[VD#ODNYUQMX?<(=_MC+L]XF[`3V'N)/^`SP'?R9EP)^>(NP'X
+M3LZ$.SE'W`W`=\+Z0/']W8&[`?A.6'\G87\W`-\)Z^\D[.\&X#MA_9V$_=T`
+M?">LOY.POQN`[X3U=Q+V=P/PG;#^3L+^;@"^$];?2=C?#<!WPOH["?N[`?A.
+M6'\G87\W`-\)Z^\D[.\&X#MA_9V$_=T`?">LOY.POQOQ4X2[L+\;D>]8?R=A
+M?S<BW['^3L+^;D2^8_V=A/W=B'S'^CL)^[L1^8[U=Q+V=R/R'>OO).SO1N0[
+MUM])V-^-R'>LOY.POQN1[UA_)V%_-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[
+MNQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6WTG8WTWX*<)=V-]-R'>LOY.POYN0[UA_
+M)V%_-R'?L?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W$_(=Z^\D[.\F
+MY#O6WTG8WTW(=ZR_D["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H[
+M"?N["?F.]7<2]G<3\AWK[R3L[V;\%.$N[.]FY#O6WTG8W\W(=ZR_D["_FY'O
+M6'\G87\W(]^Q_D["_FY&OF/]G83]W8Q\Q_H["?N[&?F.]7<2]G<S\AWK[R3L
+M[V;D.];?2=C?S<AWK+^3L+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'
+M^CL)^[L9^8[U=Q+V=PM^BG`7]G<+\AWK[R3L[Q;D.];?2=C?+<AWK+^3L+];
+MD.]8?R=A?[<@W['^3L+^;D&^8_V=A/W=@GS'^CL)^[L%^8[U=Q+V=POR'>OO
+M).SO%N0[UM])V-\MR'>LOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"
+M?,?Z.PG[NQ4_1;@+^[L5^8[U=Q+V=ROR'>OO).SO5N0[UM])V-^MR'>LOY.P
+MOUN1[UA_)V%_MR+?L?Y.POYN1;YC_9V$_=V*?,?Z.PG[NQ7YCO5W$O9W*_(=
+MZ^\D[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]
+MW8:?(MR%_=V&?,?Z.PG[NPWYCO5W$O9W&_(=Z^\D[.\VY#O6WTG8WVW(=ZR_
+MD["_VY#O6'\G87^W(=^Q_D["_FY#OF/]G83]W89\Q_H["?N[#?F.]7<2]G<;
+M\AWK[R3L[S;D.];?2=C?;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;L=/$>["
+M_FY'OF/]G83]W8Y\Q_H["?N['?F.]7<2]G<[\AWK[R3L[W;D.];?2=C?[<AW
+MK+^3L+_;D>]8?R=A?[<CW['^3L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V
+M=SOR'>OO).SO=N0[UM])V-_MR'>LOY.PO]N1[UA_)U%_9V?\%.9.\P_<W*G.
+M`=]]>PISIZZ_R_?]G4YE#OA.67^GKK\[)>Y.MV4.^$Y9?Z>NOSLE[DZ_E3G@
+M.V7]G;K^[G0YG!WPG;+^3EU_5\ZNS@'?*>OOU/5W8`[X3EE_IZZ_`W/`=\KZ
+M.W7]79Y[7.>`[Y3U=^KZN\=YKG('?*>LOU/7WSU.W#VNW`'?*>OOU/5WCQ-W
+MCRMWP'?*^CMU_=WCR^'L@.^4]7?J^KMR=G4.^$Y9?Z>NOP-SP'?*^CMU_=UQ
+M#MU_IZR_4]??Y;DG=0[YCO5WZOJ[)WFN<(?NOU/6WZGK[YXD[IX4[M#]=\KZ
+M.W7]W9/$W9/"';K_3EE_IZZ_>W(YG!WR'>OOU/5WY>SJ'/(=Z^_4]7=@#OF.
+M]7?J^CLPAWS'^CMU_5V>>UKGD.]8?Z>NOWN:YRIWR'>LOU/7WSU-W#VMW"'?
+ML?Y.77_W-''WM'*'?,?Z.W7]W=/+X>R0[UA_IZZ_*V=7YY#O6'^GKK\#<\AW
+MK+]3U]\=Y]#]=\KZ.W7]79Y[5N>0[UA_IZZ_>Y;G"G?H_CME_9VZ_NY9XNY9
+MX0[=?Z>LOU/7WSU+W#TKW*'[[Y3U=^KZNV>7P]DAW['^3EU_5\ZNSB'?L?Y.
+M77\'YI#O6'^GKK\#<\AWK+]3U]_EN>=U#OF.]7?J^KOG>:YRAWS'^CMU_=WS
+MQ-WSRAWR'>OOU/5WSQ-WSRMWR'>LOU/7WSV_',X.^8[U=^KZNW)V=0[YCO5W
+MZOH[,(=\Q_H[=?W=<0[=?Z>LOU/7W^6Y%W4.^8[U=^KZNQ=YKG"'[K]3UM^I
+MZ^]>).Y>%.[0_7?*^CMU_=V+Q-V+PAVZ_TY9?Z>NOWMQ.9P=\AWK[]3U=^7L
+MZASR'>OOU/5W8`[YCO5WZOH[,(=\Q_H[=?U=GGM9YY#O6'^GKK][F><J=\AW
+MK+]3U]^]3-R]K-PAW['^3EU_]S)Q][)RAWS'^CMU_=W+R^'LD.]8?Z>NORMG
+M5^>0[UA_IZZ_`W/(=ZR_4]??'>?0_7?*^CMU_5V>>U7GD.]8?Z>NOWN5YPIW
+MZ/X[9?V=NO[N5>+N5>$.W7^GK+]3U]^]2MR]*MRA^^^4]7?J^KM7E\/9(=^Q
+M_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_4]??Y;G7=0[YCO5WZOJ[
+MUWFN<H=\Q_H[=?W=Z\3=Z\H=\AWK[]3U=Z\3=Z\K=\AWK+]3U]^]OAS.#OF.
+M]7?J^KMR=G4.^8[U=^KZ.S"'?,?Z.W7]W7$.W7^GK+]3U]_EN:LZAWS'^CMU
+M_=U5GBO<H?OOE/5WZOJ[J\3=5>$.W7^GK+]3U]]=)>ZN"G?H_CME_9VZ_N[J
+M<C@[Y#O6WZGK[\K9U3GD.];?J>OOP!SR'>OOU/5W8`[YCO5WZOJ[//>FSB'?
+ML?Y.77_W)L]5[I#O6'^GKK][D[A[4[E#OF/]G;K^[DWB[DWE#OF.]7?J^KLW
+ME\/9(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_.\ZA^^^4]7?J^KL\][;.
+M(=^Q_DY=?_<VSQ7NT/UWROH[=?W=V\3=V\(=NO].67^GKK][F[A[6[A#]]\I
+MZ^_4]7=O+X>S0[YC_9VZ_JZ<79U#OF/]G;K^#LPAW['^3EU_!^:0[UA_IZZ_
+MRW/OZASR'>OOU/5W[_)<Y0[YCO5WZOJ[=XF[=Y4[Y#O6WZGK[]XE[MY5[I#O
+M6'^GKK][=SF<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.^8[U=^KZN^,<NO].67^G
+MKK_+<^_K'/(=Z^\TZN\,W7^GK+_3J+\S=/^=LOY.H_[.T/UWROH[C?H[0_??
+M*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.R7]W8<ZAWS'^CMU_=V'
+M/%>Y0[YC_9VZ_NY#XNY#Y0[YCO5WZOJ[#XF[#Y4[Y#O6WZGK[SY<#F>'?,?Z
+M.W7]73F[.H=\Q_H[=?T=F$.^8_V=NO[N.(?NOU/6WUG^@9L[USG@.V/]W;=?
+M>,!=]M.Y<(?NOS/6WYGK[\YI[URX0_??&>OOS/5WY\3=N7"'[K\SUM^9Z^_.
+ME\/9`=\9Z^_,]7?E[.H<\)VQ_LY<?P?F@.^,]7?F^CLP!WQGK+\SU]_E.:ES
+MP'?&^CMS_9WDN<H=\)VQ_LY<?R?IY4GE#OC.6']GKK^3Q)U4[H#OC/5WYOH[
+MN1S.#OC.6']GKK\K9U?G@.^,]7?F^CLP!WQGK+\SU]\=Y]#]=\;Z.W/]79[3
+M.H=\Q_H[<_V=YKG"';K_SEA_9ZZ_T\2=%N[0_7?&^CMS_9TF[K1PA^Z_,];?
+MF>OO]'(X.^0[UM^9Z^_*V=4YY#O6WYGK[\`<\AWK[\SU=V`.^8[U=^;ZNSQG
+M=0[YCO5WYOH[RW.5.^0[UM^9Z^\L<6>5.^0[UM^9Z^\L<6>5.^0[UM^9Z^_L
+M<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5WQSET_YVQ_LY<?Y?GFCJ'
+M?,?Z.W/]79/G"G?H_CMC_9VY_JY)W#6%.W3_G;'^SEQ_UR3NFL(=NO_.6']G
+MKK]K+H>S0[YC_9VY_JZ<79U#OF/]G;G^#LPAW['^SEQ_!^:0[UA_9ZZ_RW-M
+MG4.^8_V=N?ZNS7.5.^0[UM^9Z^_:Q%U;N4.^8_V=N?ZN3=RUE3OD.];?F>OO
+MVLOA[)#O6']GKK\K9U?GD.]8?V>NOP-SR'>LOS/7WQWGT/UWQOH[<_U=GNOJ
+M'/(=Z^_,]7==GBO<H?OOC/5WYOJ[+G'7%>[0_7?&^CMS_5V7N.L*=^C^.V/]
+MG;G^KKL<S@[YCO5WYOJ[<G9U#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/
+M]74.^8[U=^;ZNS[/5>Z0[UA_9ZZ_ZQ-W?>4.^8[U=^;ZNSYQUU?ND.]8?V>N
+MO^LOA[-#OF/]G;G^KIQ=G4.^8_V=N?X.S"'?L?[.7']WG$/WWQGK[\SU=WEN
+MJ'/(=ZR_,]??#7FN<(?NOS/6WYGK[X;$W5"X0_??&>OOS/5W0^)N*-RA^^^,
+M]7?F^KOA<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5W8`[YCO5WYOJ[
+M/#?6.>0[UM^9Z^_&/%>Y0[YC_9VY_FY,W(V5.^0[UM^9Z^_&Q-U8N4.^8_V=
+MN?YNO!S.#OF.]7?F^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]W7$.W7]GK+\SU]_E
+MN8]U#OF.]7?F^KN/>:YPA^Z_,];?F>OO/B;N/A;NT/UWQOH[<_W=Q\3=Q\(=
+MNO_.6']GKK_[>#F<'?(=Z^_,]7?E[.H<\AWK[\SU=V`.^8[U=^;Z.S"'?,?Z
+M.W/]79[[5.>0[UA_9ZZ_^Y3G*G?(=ZR_,]???4K<?:K<(=^Q_LY<?_<I<?>I
+M<H=\Q_H[<_W=I\OA[)#O6']GKK\K9U?GD.]8?V>NOP-SR'>LOS/7WQWGT/UW
+MQOH[<_U=GOM<YY#O6']GKK_[G.<*=^C^.V/]G;G^[G/B[G/A#MU_9ZR_,]??
+M?4[<?2[<H?OOC/5WYOJ[SY?#V2'?L?[.7']7SJ[.(=^Q_LY<?P?FD.]8?V>N
+MOP-SR'>LOS/7W^6Y+W4.^8[U=^;ZNR]YKG*'?,?Z.W/]W9?$W9?*'?(=Z^_,
+M]7=?$G=?*G?(=ZR_,]???;D<S@[YCO5WYOJ[<G9U#OF.]7?F^CLPAWS'^CMS
+M_=UQ#MU_9ZR_,]??Y;GK.H=\Q_H[<_W==9XKW*'[[XSU=^;ZN^O$W77A#MU_
+M9ZR_,]??72?NK@MWZ/X[8_V=N?[N^G(X.^0[UM^9Z^_*V=4YY#O6WYGK[\`<
+M\AWK[\SU=V`.^8[U=^;ZNSQW4^>0[UA_9ZZ_N\ESE3OD.];?F>OO;A)W-Y4[
+MY#O6WYGK[VX2=S>5.^0[UM^9Z^]N+H>S0[YC_9VY_JZ<79U#OF/]G;G^#LPA
+MW['^SEQ_=YAKSO@IS%V3?^#F;NL<\%W#^KO&]7>W>>Y4YH#OOCV%N6M<?W>;
+MN+N]+7/`=PWK[QK7W]TF[FY_*W/`=PWK[QK7W]U>#F>'_KSM<N+T%[Z^=]^^
+M/KKZ,=BB:XBB08&#=W,_/F8_4KBI39Q\^^F=C-+SB]3?%.^_OIL[5J[OSZ$_
+MYOD/O5WT)S/_9+!M3]-T&/Q7?GWHYJ`_\OJZ'_]3JM'3>0)_Y[_P]2_O'_Z5
+M!_L?G]VV/S7MJ>U.@_[J*_S/7_\-OKX]^NS^?V_X;@Y\=A_.Y1=<?CL[S-W<
+MF_O^V=WO_9-GN??4?>[N__C>W/7[>[_?]NBS6^>^^VI#OT#?[)_\V>T/]T/>
+M_SK_N$+93N?\GU/<O:3EZWNJKP_U^`_>[D]>W^GX=G_\^T#_\)^7>W,:O-W3
+MP[FYF`5\"8/3NSZ^.O3GT?^1+\;AEL-?_.1^'WGXR;V;TS]7!,,/LWS_76P"
+A?^>_\/4?[Q_^=3?8I,$_[02;;_2=SX_^!PM'3SM0J```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow2.gz.uu
new file mode 100644
index 0000000..304b694
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.qcow2.gz
+M'XL("%[N+50``VEM9RTV,W@R-34M-#`Y-BUE8G(N<6-O=S(N;W5T`*V8VY+3
+M,`R&[_<IS!D6*+'DI`F'%A:6&>[@`KA.3T_1X=FI:R5V%"G>=M)V,NVX_S=R
+M_%E-6A3A84QIC:N,:\QA8TZ?Z04F^3!\F>.O[S\6Z>-X$V"V4%+"P'+?XP:L
+M?Q$'&JZPXP$KXY+J4,!!EQJ#<CBG5C<U(.!N;\ZG[KP8-4O@-<"`4Q?CJOH@
+MU,<3[LKZ8.[Z4#Y_99?C`]5T?1CJXZFEAJNS.!!2C89KLS@44AL-M\WBG)#:
+M:3AEYR:X4D@=%)S-J'+"54+*:CC(XI9""C6<R^)J(:5Y9_/>-4)*\\[FO6N%
+ME.:=S7NW$5*:=S;OW59(:=[9O'<[(:5Y!XIW)N+V0DKS#IAWCPCW..(.0DKS
+M#IAW3PCWM,=9*:5Y!\R[9X1['G%"OP/-.V#>O2#<RX@3^AUHW@'S[A7A;B-.
+MZ'>@>0?,N]>$>Q-Q0K\#S3M@WKT=>6>%?@>:=\B\>T>L(N*$?H>:=\B\LX2#
+MB!/Z'6K>(?,."><B3NAWJ'F'S+N2<%7$"?T.->^0>;<D7!UQ0K]#S3MDWC6$
+M>Q]Q0K]#S3MDWGT@W,>($_H=:MXA\^X3X581)_0[U+QSS+LUX3Y'G-#OG.:=
+M8]Y](=Q=Q`G]SFG>.>;=5\)]ZW$@I7KOBD)^$>Y^M&=AWNM/%Z^/K7#4!R:`
+M]27`J0H#KIEUPF78&Q<"Y0D'G-\;83)MV9ELR6?*;VW<%6E]ZV#S*L7MYI[N
+MX3)@69JV'0%_=_7!9!F7U[?<^V&_*UOAJ`\<[Q;#9P>LP[\#2[_)RLK4\-`*
+M_][_$=:WGN^&+^#T?P=HH"NX[X@CW#K!^0N,0_+-=%L-O$O?)[C5(G;F$V[R
+MWP%_R[.7!M3)EO/*4O>]I;<U66=_I>UOB+H?6W:EW*^OB?4)O04&TYVHSXRG
+MZW_$^YMMMAX>!YGIFB%NTW<680DS9V\UKFX[\V)8OC,>N',]9+AS`P[F;03-
+DN;.<##Q]:WS4!XX_%\-G`#H"SG8&7>5_>V_^`UMI__/2%```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.raw.gz.uu
new file mode 100644
index 0000000..024a0b2
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.raw.gz
+M'XL("%[N+50``VEM9RTV,W@R-34M-#`Y-BUE8G(N<F%W+F]U=`"ME,T.@R`,
+MQ^\^1<\[&$"9[*+)DMUWV79&IT_APZ\5=2#XE4"%2`J__$L+C)D&@#WXK3OZ
+M=-'ZY)(,-%Z?!_(@T.`:VL5IF98T9AU-:9QQ#<[;@+X*#5MIX[ZQP^W.`:4$
+MK3W@:](G(J>C:,F="V`Z,*X[^GOJV@140\'(`G()\@I*'%7X>;P#^56,QPK8
+MX,0>;A)L*BB$JRQ<AL[.6FDJ<=QEUYW];^%*TR=<OJ4.3X*U(<=JL#)NL2@T
+M=Y^=9^`M\`R8&GW"!<[YA;^^FR]#..%NZ`,_7$VXPEW/+9S8"1=<7#V_+($4
+M[IQ>Z:MK(B>#+V_&P9M+$/?F&IR(^Q#<AI<%*Q!7^>.ZHW^FKAE@/@*CG2"]
+,?(PE/\L2J-?E!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhd.gz.uu
new file mode 100644
index 0000000..9c75099
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.vhd.gz
+M'XL("#HUQ%4``VEM9RTV,W@R-34M-#`Y-BUE8G(N=FAD+F]U=`"ME\%NI#`,
+MAN_S%);VU@,*)@GT,B-5ZGTOVYX#A6JTVK9J]]`##[\V"9`08#K=#$P4E/CC
+M=^P810C[`]`%Z`YT"UIQOY2@;Z&L`&C0W3BTN7N$OGE]:9N_Y\_,_?J#A>7"
+MMPK-V1X+D/22$M#P2_03]Z$?,=F/^^>;\Y_G$8<.APZD2K8J$'0=O:>K04BK
+MCDF/9_R]5%?$ZF8K^YZN@Z+S9A2^NBP[^3A)5C2?;P6U'M9GO(.'8,#'!>J4
+M6%AY,M<65<S.KN'TGM4UN)N#BX5-%4J,DEH!.H<2N4]I,ZY#=%.J?'Z\F?>/
+M=J$/-U)%3_KR:*S:=A==JN`46*M`<FKON0L#Y76)6TF5_UH]'=I)UZ%%$&H<
+MP,']</5F%/CZ="YVUGP[&)OZS*Y?WW"XKJ\'[NR.NG&[0X!1W/(NS=U>=?8-
+M/;<K^DYVVQY]W%-J=[OK@$J!,1'PUZBO21R.JN)A2774K+3;`_U=%EX3<$@8
+MJL=4SI6&"K^J\/'^826^E=DH!]<[;'%X"3<*]JM]B#MYN,)N-S]59RL_[_R^
+MASO:_XB3>^JX)K1K`YO.JL3)8JJ%G1]GR%O("R[&=@Q#X!1?F/7=QC(P<'='
+M'\3N&L:5X?S<P^$%=R'$U5-E60GAA=4[QNJ:Q,&HESOCBSN7(>'.M3A,6PC,
+M4%DH`VE6W&X/]#^S\+)`=)^B9-\V=,4TF4+I@,D4$K!-K-"D_7YH98.2Z*#`
+HN(0'!<8E/"@P+N%!@7$)#PJ,2WA08%S2@P(!*?<._P`B"8'870X`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdf.gz.uu
new file mode 100644
index 0000000..604b289
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.vhdf.gz
+M'XL("+$EAE4``VEM9RTV,W@R-34M-#`Y-BUE8G(N=FAD9BYO=70`K94[;\,@
+M$(#W_(J3NF6(X##861RI4O8N;6;;P5%4M5TZ=/"/+V>""QCG46$P@AQ\N1=G
+MQNP#8-YD7Q8,F^@95NO52./MXT">!%I<1Z<X;6LDC:*G)8T3KC-KG=!O9YIY
+M:A]WS&UN_QA02FB:&?#5Z8>9PU%J$A<(K$F,RX+A>1,V!ZS&A)$E%!*D@@KO
+MU?"P?TO$MV(\E\$6A[=P3F&;02G<SL,)(^R]G383+Z?\O//G'JZVK\,5U[0S
+MGF`Z)5@T5N9-ELJT\)P?9^`:N`!67608`J?XPI]^V[D:&)A[13^8F]L0K@SW
+M<P^'-\R%$-=.E241PAO>J^?:=9F#P>.;<>?-)4AX<RT.\Q:"[5A93`::7?-Q
+M63"\;,)F@<4%F,N#W'W;E`#5@]*@),W+`M06RLH'8IA)0_?UJ;OO\X\7X1''
+M;3%(=CJ/@FZ+*@$;^A-UI+FGW]/^M#Y_G!S.E2I7D<QE,Z<$@FHC<WEL[N&,
+M[[%V(G82C[R'I*=?]LPO@?=V/JZ8C-4]M,<1YWJP"`2I4C7B)(M._3>V%J<R
+/IXKY[JY^`1U?D=P0"0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-ebr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vmdk.gz.uu
new file mode 100644
index 0000000..3ad6aa6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-ebr.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-ebr.vmdk.gz
+M'XL("%_N+50``VEM9RTV,W@R-34M-#`Y-BUE8G(N=FUD:RYO=70`K5S1;N3&
+M$7SW5PSDMSPL6,LEN7PX.W'.`8(@@!$[]FO(Y3`68M\==$*0`_3QX9!3HR)%
+M'FFK=:L#^]A=V]U#M735!679].'<I767B[MTKBA=!C?\T_1R6?YL#*]+NO'T
+MM[=___'$CS^>3D]?3&`(41*"3.'$F+W/TVGQ0;CSYZ)F-X;7>1<N#U'MB\`(
+M=]ZXL0DW],.=UT*873/>[L*%P+D$Y&9PQ4I-F\5^+KL_?!&;%_++0P[#\9:U
+MJW)7MM%T93':N:O.X[W,58-3/P!^Z=[>?_R/>^L_WA[N/SR^C_F=P]D.SI<R
+M^)>W@#`45I7A(MP(<'6`*+W+.Y<CW'9/#W^Y_\6?_NL?/MZ_?_<&+/<<SO:2
+MNTL=T@G^V?-K9H0WR5R)\![NZ<]_??LF/KG9Z4/S0+@0-20RO/=0A^*6I0N?
+M+U]C=O[=8T#LXT?*+IQM;$XQOO<E7!075]5N3*<(V.?A=A=+'GMW>_#-H__A
+MTP?_YN[7]^]2[\+9AI;5(]!U;%3NBCQ`Q=)"^XJ`&!Z;\=3<TR_WCS_?W[X?
+MROSH[TY?.L*5H7?#`5YC7E/50TBY>;)#VD_?_N]QJ-=U\63O"3<F,18QO'=Q
+M=D45L(8#S(?>Y;G+KRX?X8>$ATHN"$[NZ?V[TS]^<BCSZ\5]_]V?_D&XZP`W
+M>`X)#B%#0;.:BJG^8OE8NJ?OOW5WH<@??O;C$TBX>OHR"\[3.6`TS^$B=FV"
+M#T/L$FZ,)^O>-H^-^Z;YZ$]?OGW[33K9)A1[&5]#:CZ@E!-T>+['=@Z-FTYZ
+M.NCQ*+JN/35=\^'1/X3C34?1AJ>UBY6&8[T\'^/\?:KQI/KPQ+BG-^[NOAO.
+M-,#^V[__E7"WZ3$>\@B/1#T&YN%B>'I&>!_?87IBPC$%./_X\.ET^_3+_;MN
+M^$)S;PC73;T;TAE.<THJY;1,*KWMT+L[/*<V8!/.AQ9-25WC%\:`->7QW(5\
+M>!7A%;OP].GTLV^Z(2UW=RZ*NW04_?(HM$6++DP'/?1B.HJ8V*?31W^+<'D6
+M#["?-6?**3S*PY,\930?H(_O'\;4ROQ.YW&^_%[VVGE\>?$MM?J=@!.<=7YE
+MMO?]C*]\!N@$+'O.KPSY7<2ST*A2C&H&-_PT<?IN^/S7\/E!X,(C=A7/6J,:
+M,=HCW2O#]XN;>'8:Y<7H#\%=8HOX`PKD>FPJC5QO)#BWZ%T1>T?/0J-*,:H9
+MW%;ORM@[>M8:U8C1KF:W++:*O:-GIU%>C/X0W#7VCC^`0:['WM'(L[6?\I:]
+MJV/OZ%EH5"E&-8/;ZET3>T?/6J,:,=K5[);%MK%W].PTRHO1'X*[Q=YQK$"N
+MQ][1R/7&9N^ZV#MZ%AI5BE'-X+9ZYV/OZ%EK5"-&NYK=LM@^]HZ>G49Y,?HC
+M<%46>W>1WO%Z[!V-7&]L]:[BO*-GH5&E&-4,;J-W%><=/6N-:L1H5[-;%LMY
+M1\].H[P8_2$XSKM">L?KL7<T<KVQV3O..WH6&E6*4<W@MGK'>4?/6J,:,=K5
+M[);%<M[1L],H+T9_"([SKI3>\7KL'8U<;VSVCO..GH5&E6)4,[BMWG'>T;/6
+MJ$:,=C6[9;&<=_3L-,J+T1^"X[SCCTZ0Z[%W-'*]L=D[SCMZ%AI5BE'-X+9Z
+MQWE'SUJC&C':U>R6Q7+>T;/3*"]&?P3NFL7>7:5WO!Y[1R/7&UN]NW+>T;/0
+MJ%*,:@:WT;LKYQT]:XUJQ&A7LUL6RWE'STZCO!C](3C.NUIZQ^NQ=S1RO;'9
+M.\X[>A8:58I1S>"V>L=Y1\]:HQHQVM7LEL5RWM&STR@O1G\(CO..__&"7(^]
+MHY'KC<W><=[1L]"H4HQJ!K?5.\X[>M8:U8C1KF:W+);SCIZ=1GDQ^D-PG'=D
+M+2'78^]HY'ICLW><=_0L-*H4HYK!;?6.\XZ>M48U8K2KV2V+Y;RC9Z=17HS^
+M"%R=Q=[=I'>\'GM'(]<;6[VK.>_H66A4*48U@]OH7<UY1\]:HQHQVM7LEL5R
+MWM&STR@O1G\(CO.ND][QFJQVZEWW`F[9.\X[>A8:58I1S>"V>L=Y1\]:HQHQ
+MVM7LEL5RWM&STR@O1G\(CO/.2^]X/?:.1JXW-GO'>4?/0J-*,:H9W%;O.._H
+M66M4(T:[FMVR6,X[>G8:Y<7H#\%QWO72.UZ/O:.1ZXW-WG'>T;/0J%*,:@:W
+MU3O..WK6&M6(T:YFMRR6\XZ>G49Y,?HC<$TV]2[MW"#7H7?)R/7&5N^:..^2
+M9Z%1I1C5#&ZC=TV<=\FSUJA&C'8UNV6Q<=XESTZCO!C](;@X[R#\'92_@_!W
+MV.7OFCCO(/P=E+^#\'?8Y>^:..\@_!V4OX/P=RO9+8N-\P["WT'Y.PA_=P`N
+MSCL(?P?E[R#\'7;YNR;..PA_!^7O(/P==OF[)LX["'\'Y>\@_-U*=LMBX[R#
+M\'=0_@["WQV`B_,.PM]!^3L(?X==_JZ)\P["WT'Y.PA_AUW^KHGS#L+?0?D[
+M"'^WDMVRV#CO(/P=E+^#\'?[<&T6>R?\'92_@_!WV.7O6LX[X>^@_!V$O\,N
+M?]=RW@E_!^7O(/S=2G;+8CGOA+^#\G<0_NX`'.>=\'=0_@["WV&7OVLY[X2_
+M@_)W$/X.N_Q=RWDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[`W"<=\+?0?D["'^'
+M7?ZNY;P3_@[*WT'X.^SR=RWGG?!W4/X.PM^M9+<LEO-.^#LH?P?A[P[`<=X)
+M?P?E[R#\'7;YNY;S3O@[*'\'X>^PR]^UG'?"WT'Y.PA_MY+=LEC..^'OH/P=
+MA+_;A[MEL7?"WT'Y.PA_AUW^[L9Y)_P=E+^#\'?8Y>]NG'?"WT'Y.PA_MY+=
+MLEC..^'OH/P=A+\[`,=Y)_P=E+^#\'?8Y>]NG'?"WT'Y.PA_AUW^[L9Y)_P=
+ME+^#\'<KV2V+Y;P3_@[*WT'XNP-PG'?"WT'Y.PA_AUW^[L9Y)_P=E+^#\'?8
+MY>]NG'?"WT'Y.PA_MY+=LEC..^'OH/P=A+\[`,=Y)_P=E+^#\'?8Y>]NG'?"
+MWT'Y.PA_AUW^[L9Y)_P=E+^#\'<KV2V+Y;P3_@[*WT'XNWVX+HN]$_X.RM]!
+M^#OL\G<=YYWP=U#^#L+?89>_ZSCOA+^#\G<0_FXENV6QG'?"WT'Y.PA_=P".
+M\T[X.RA_!^'OL,O?=9QWPM]!^3L(?X==_J[CO!/^#LK?0?B[E>R6Q7+>"7\'
+MY>\@_-T!.,X[X>^@_!V$O\,N?]=QW@E_!^7O(/P==OF[CO-.^#LH?P?A[U:R
+M6Q;+>2?\'92_@_!W!^`X[X2_@_)W$/X.N_Q=QWDG_!V4OX/P=]CE[SK..^'O
+MH/P=A+];R6Y9+.>=\'=0_@["W^W#^6SJ79+@0:Y'&2.-7&\\C4T;/MWPF;EG
+MN#CO5A5]*_^4>N?6LWNAQ3\&][+826Z(46Z8-A%3N;\/<((SED/B&KN^#WA$
+M#HFT+N?K57)(I'4Y7Z^20R*MR_EZE1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)
+M'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6Y
+MB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1U
+MN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD
+M=;F)'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%U
+MN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76Y
+MC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-
+M'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<
+M$FE=GCWW[O?+(9'6Y?1\E1P2:5U.SU?)(9'6Y?1\E1P2:5UN(H=$6I>;R"&1
+MUN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@A
+MD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO(
+M(9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;
+MR"&1UN4F<DBD=;F)'!)<E]O((<%UN8T<$MY4#@EO*H>$-Y5#PIO*(>%-Y9#P
+MIG)(>%,Y)+RI'!+>5`X);RJ'A#>50\*;RB'A3>60\*9R2/199BB'1&\JAT1O
+M*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\J
+MAT1O*H=$;RJ'/&=99BB'/&>F<LCSRU]-?`SN9;&3W/""]K<#8K-[%XQ/WDA6
+M->-_X?(^F'DO<+?!]BOY?3W\&3Z^4KC.NMS^MP$6A6N:%X#_9'[GSZ;QV_.K
+MQO]=3+]*]N7?VS>>OCG-_Q#P.C[.115^*VY1NNOY:(8_??OC(L,)SDSN.L'M
+M/LZ)M.RWX+X6N/#MNQ?/V2_NUN=.KP7NJ^F3<)?/9:?[I&/%&O^F[6MV7<3I
+M.8=O$X&]XW_*SG/`=+[N.;_Z91KG6;F?R<^]+#=\B]3?-:OG,9NJ&^6Z.5R;
+M)LO*$>YT[ZN7V=V,#P/+KXR#7[D!9/Z5.\&=;0=!/4Z62:3Q\N_M&T_?G>9_
+7)L!+!#3KX"7\'I'LB_\#:C6@$!Y@````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu
new file mode 100644
index 0000000..624c326
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu
@@ -0,0 +1,132 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.qcow.gz
+M'XL(",8S(E0``VEM9RTV,W@R-34M-#`Y-BUG<'0N<6-O=RYO=70`K9W;;AS7
+MM47?_16ENT1)5*^UJJJK=$^`!,B;$YSS=@Z0NCX&G7=]?-CDOI"KY]2*(=J$
+M(4.HB>ZMP4'9'MX\'.[^:)I.FK9OVK'9Y^;F[].'-/?^YN%'\^/O?_W;]?T_
+M?OQV-R:'GSSE_K[51M/<@ZT_-V5.ST\MS6'\+^9N/@3-W7MU]@=>W;TW>SEW
+M]=O=F\7/*1NT!X--FCNDUR?D]-K_[O5]=V]7[D[O\=ZNDK?;L<'^P>#O:>Z?
+MZ?4I>;M'-C<\F#NYMZOD[8YL;OHI+$I@F=G<$LRU\*F5S6W!7`>?VO&<_.37
+M]FZNAT\)FX.?M]=-F3O"IXS-M0_F#M<9Z#PWP*<(=Q)R-\*G"'<2<C?!IPAW
+M$G(WPZ<(=Q)RM\"G"'<2<K?"IPAW&G*WP:<(=^3KQ3WN=O@4X4XC[@0_1;C3
+MB#M!OE/&G4;<"?*=,NXTXDZ0[Y1QIQ%W@GRGC#N-N!/D.V7<6<2=(-\9X\XB
+M[@3YSAAW%G*'?&>,.PNY0[XSQIV%W"'?&>/.0NZ0[XQQ9R%WR'?&N+.0.^0[
+M8]RU(7?(=RWCK@VY0[YK&7=MQ)WBIPAW;<2=(M^UC+LVXDZ1[UK&71MQI\AW
+M+>.NC;A3Y+N6<==&W"GR7<NXZR+N%/FN8]QU$7>*?-<Q[KJ0.^2[CG'7A=PA
+MWW6,NR[D#OFN8]QU(7?(=QWCK@NY0[[K&'==R!WR7<>XZT/ND.]ZQET?<H=\
+MUS/N^H@[PT\1[OJ(.T.^ZQEW?<2=(=_UC+L^XLZ0[WK&71]Q9\AW/>.NC[@S
+MY+N><7>,N#/DNR/C[AAQ9\AW1\;=,>0.^>[(N#N&W"'?'1EWQY`[Y+LCX^X8
+M<H=\=V3<'4/ND.^.C+MCR!WRW9%Q-X3<(=\-C+LAY`[Y;F#<#1%W+7Z*<#=$
+MW+7(=P/C;HBX:Y'O!L;=$''7(M\-C+LAXJY%OAL8=T/$78M\-S#N\K_^YG/(
+M=R/C;HRX:Y'O1L;=&'*'?#<R[L:0.^2[D7$WAMPAWXV,NS'D#OEN9-R-(7?(
+M=R/C;@RY0[X;&7=3R!WRW<2XFT+ND.\FQMT4<=?AIPAW4\1=AWPW,>ZFB+L.
+M^6YBW$T1=QWRW<2XFR+N.N2[B7$W1=QUR'<3XR[_9T@^AWPW,^[FB+L.^6YF
+MW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;&W1QRAWPW,^[FD#ODNYEQ
+MMX3<(=\MC+LEY`[Y;F'<+1%W/7Z*<+=$W/7(=POC;HFXZY'O%L;=$G'7(]\M
+MC+LEXJY'OEL8=TO$78]\MS#NUHB['OEN9=RM$7<]\MW*N%M#[I#O5L;=&G*'
+M?+<R[M:0.^2[E7&WAMPAWZV,NS7D#OEN9=RM(7?(=ROC;@NY0[[;&'=;R!WR
+MW<:XVR+NCO@IPMT6<7=$OML8=UO$W1'Y;F/<;1%W1^2[C7&W1=P=D>\VQMT6
+M<7=$OML8=WO$W1'Y;F?<[1%W1^2[G7&WA]PAW^V,NSWD#OEN9]SM(7?(=SOC
+M;@^Y0[[;&7=[R!WRW<ZXVT/ND.]VPIWD'_`YX#LY$.[D$'('?"<'PIT<(NX&
+M_!3F3L+^;@"^$];?2=C?#<!WPOH["?N[`?A.6'\G87\W`-\)Z^\D[.\&X#MA
+M_9V$_=T`?">LOY.POQN`[X3U=Q+V=P/PG;#^3L+^;@"^$];?2=C?#<!WPOH[
+M"?N[`?A.6'\G87\W`-\)Z^\D[.\&X#MA_9V$_=V`?,?Z.PG[NP'YCO5W$O9W
+M(WZ*<!?V=R/R'>OO).SO1N0[UM])V-^-R'>LOY.POQN1[UA_)V%_-R+?L?Y.
+MPOYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6WTG8WXW(
+M=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N["3]%N`O[
+MNPGYCO5W$O9W$_(=Z^\D[.\FY#O6WTG8WTW(=ZR_D["_FY#O6'\G87\W(=^Q
+M_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK[R3L[R;D.];?2=C?
+M3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=C)\BW(7]W8Q\Q_H[
+M"?N[&?F.]7<2]G<S\AWK[R3L[V;D.];?2=C?S<AWK+^3L+^;D>]8?R=A?S<C
+MW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R'>OO).SO9N0[UM])
+MV-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYNP4\1[L+^;D&^8_V=A/W=@GS'
+M^CL)^[L%^8[U=Q+V=POR'>OO).SO%N0[UM])V-\MR'>LOY.POUN0[UA_)V%_
+MMR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D[.\6Y#O6
+MWTG8WRW(=ZR_D["_6Y#O6'\G87^WXJ<(=V%_MR+?L?Y.POYN1;YC_9V$_=V*
+M?,?Z.PG[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O6'\G
+M87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2]G<K\AWK[R3L[U;D
+M.];?2=C?K<AWK+^3L+_;\%.$N["_VY#O6'\G87^W(=^Q_D["_FY#OF/]G83]
+MW89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?;<AWK+^3L+_;D.]8
+M?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U=Q+V=QOR'>OO).SO
+M-N0[UM])V-_M^"G"7=C?[<AWK+^3L+_;D>]8?R=A?[<CW['^3L+^;D>^8_V=
+MA/W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])V-_MR'>LOY.PO]N1
+M[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.\T_<'--G0.^NWD*<Z>NO\OW
+MZ365.^`[9?V=NOZN2=PUF3L[X*<P=^KZNR9QU_RSS`'?*>OOU/5WS<F=G:'[
+M[Y3U=^KZNW)V=0[X3EE_IZZ_`W/`=\KZ.W7]'9@#OE/6WZGK[_+<DSH'?*>L
+MOU/7WSW)<TV9`[Y3UM^IZ^^>).Z>5.Z`[Y3U=^KZNR>)NR>5.^`[9?V=NO[N
+MR>GB[(#OE/5WZOJ[<G9U#OA.67^GKK\#<\!WROH[=?T=F`.^4];?J>OO\MS3
+M.H=\Q_H[=?W=TSQ7N4.^8_V=NO[N:>+N:>$.W7^GK+]3U]\]3=P]+=RA^^^4
+M]7?J^KNG)W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?FD.]8?Z>N
+MO\MSS^H<\AWK[]3U=\_R7.$.W7^GK+]3U]\]2]P]J]PAW['^3EU_]RQQ]ZQR
+MAWS'^CMU_=VST\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_
+M4]??Y;GG=0[YCO5WZOJ[YWFN<H=\Q_H[=?W=\\3=\\(=NO].67^GKK][GKA[
+M7KA#]]\IZ^_4]7?/3_[LT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC_9VZ_@[,
+M(=^Q_DY=?Y?G7M0YY#O6WZGK[U[DN<(=NO].67^GKK][D;A[4;E#OF/]G;K^
+M[D7B[D7E#OF.]7?J^KL7IXNS0[YC_9VZ_JZ<79U#OF/]G;K^#LPAW['^3EU_
+M!^:0[UA_IZZ_RW,OZQSR'>OOU/5W+_-<Y0[YCO5WZOJ[EXF[EX4[=/^=LOY.
+M77_W,G'WLG"'[K]3UM^IZ^]>GOS9H?OOE/5WZOJ[<G9U#OF.]7?J^CLPAWS'
+M^CMU_1V80[YC_9VZ_B[/O:ISR'>LOU/7W[W*<X4[=/^=LOY.77_W*G'WJG*'
+M?,?Z.W7]W:O$W:O*'?(=Z^_4]7>O3A=GAWS'^CMU_5TYNSJ'?,?Z.W7]'9A#
+MOF/]G;K^#LPAW['^3EU_E^=>USGD.];?J>OO7N>YRAWR'>OOU/5WKQ-WKPMW
+MZ/X[9?V=NO[N=>+N=>$.W7^GK+]3U]^]/OFS0_??*>OOU/5WY>SJ'/(=Z^_4
+M]7=@#OF.]7?J^CLPAWS'^CMU_5V>>U/GD.]8?Z>NOWN3YPIWZ/X[9?V=NO[N
+M3>+N3>4.^8[U=^KZNS>)NS>5.^0[UM^IZ^_>G"[.#OF.]7?J^KMR=G4.^8[U
+M=^KZ.S"'?,?Z.W7]'9A#OF/]G;K^+L]=U3GD.];?J>OOKO)<Y0[YCO5WZOJ[
+MJ\3=5>$.W7^GK+]3U]]=)>ZN"G?H_CME_9VZ_N[JY,\.W7^GK+]3U]^5LZMS
+MR'>LOU/7WX$YY#O6WZGK[\`<\AWK[]3U=WGN;9U#OF/]G;K^[FV>*]RA^^^4
+M]7?J^KNWB;NWE3OD.];?J>OOWB;NWE;ND.]8?Z>NOWM[NC@[Y#O6WZGK[\K9
+MU3GD.];?J>OOP!SR'>OOU/5W8`[YCO5WZOJ[//>NSB'?L?Y.77_W+L]5[I#O
+M6'^GKK][E[A[5[A#]]\IZ^_4]7?O$G?O"G?H_CME_9VZ_N[=R9\=NO].67^G
+MKK\K9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<^SJ'?,?Z.W7]W?L\
+M5[A#]]\IZ^_4]7?O$W?O*W?(=ZR_4]??O4_<O:_<(=^Q_DY=?_?^='%VR'>L
+MOU/7WY6SJW/(=ZR_4]??@3GD.];?J>OOP!SR'>OOU/5W>>ZZSB'?L?Y.H_[.
+MT/UWROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.XWZ
+M.T/WWRGK[S3J[PS=?Z>LOU/2WWVH<\AWK+]3U]]]R'.%.W3_G;+^3EU_]R%Q
+M]Z%RAWS'^CMU_=V'Q-V'RAWR'>OOU/5W'TX79X=\Q_H[=?U=.;LZAWS'^CMU
+M_1V80[YC_9VZ_@[,(=^Q_L[R#]S<H<X!WQGK[VY^X@%WV4^'RAWPG;'^SEQ_
+M=TA[A\(=NO_.6']GKK\[).X.A3MT_YVQ_LY<?W<X^;-#]]\9Z^_,]7?E[.H<
+M\)VQ_LY<?P?F@.^,]7?F^CLP!WQGK+\SU]_E.:ESP'?&^CMS_9WDN<(=NO_.
+M6']GKK^3]/*D<@=\9ZR_,]??2>).*G?`=\;Z.W/]G9PNS@[XSEA_9ZZ_*V=7
+MYX#OC/5WYOH[,`=\9ZR_,]??@3G@.V/]G;G^+L]IG4.^8_V=N?Y.\USE#OF.
+M]7?F^CM-W&GA#MU_9ZR_,]??:>)."W?H_CMC_9VY_DY/_NS0_7?&^CMS_5TY
+MNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^>LSB'?L?[.7']G>:YPA^Z_
+M,];?F>OO+'%GE3OD.];?F>OO+'%GE3OD.];?F>OO['1Q=LAWK+\SU]^5LZMS
+MR'>LOS/7WX$YY#O6WYGK[\`<\AWK[\SU=WFNK7/(=ZR_,]??M7FN<H=\Q_H[
+M<_U=F[AK"W?H_CMC_9VY_JY-W+6%.W3_G;'^SEQ_UY[\V:'[[XSU=^;ZNW)V
+M=0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSW5U#OF.]7?F^KLNSQ7NT/UW
+MQOH[<_U=E[CK*G?(=ZR_,]??=8F[KG*'?,?Z.W/]77>Z.#OD.];?F>OORMG5
+M.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\U]<YY#O6WYGK[_H\5[E#OF/]
+MG;G^KD_<]84[=/^=L?[.7'_7)^[ZPAVZ_\Y8?V>NO^M/_NS0_7?&^CMS_5TY
+MNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^>.=0[YCO5WYOJ[8YXKW*'[
+M[XSU=^;ZNV/B[EBY0[YC_9VY_NZ8N#M6[I#O6']GKK\[GB[.#OF.]7?F^KMR
+M=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L\-=0[YCO5WYOJ[(<]5[I#O
+M6']GKK\;$G=#X0[=?V>LOS/7WPV)NZ%PA^Z_,];?F>OOAI,_.W3_G;'^SEQ_
+M5\ZNSB'?L?[.7'\'YI#O6']GKK\#<\AWK+\SU]_EN;'.(=^Q_LY<?S?FN<(=
+MNO_.6']GKK\;$W=CY0[YCO5WYOJ[,7$W5NZ0[UA_9ZZ_&T\79X=\Q_H[<_U=
+M.;LZAWS'^CMS_1V80[YC_9VY_@[,(=^Q_LY<?Y?G/M8YY#O6WYGK[S[FN<H=
+M\AWK[\SU=Q\3=Q\+=^C^.V/]G;G^[F/B[F/A#MU_9ZR_,]???3SYLT/WWQGK
+M[\SU=^7LZASR'>OOS/5W8`[YCO5WYOH[,(=\Q_H[<_U=GOM4YY#O6']GKK_[
+ME.<*=^C^.V/]G;G^[E/B[E/E#OF.]7?F^KM/B;M/E3OD.];?F>OO/ITNS@[Y
+MCO5WYOJ[<G9U#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:YSR'>LOS/7
+MWWW.<Y4[Y#O6WYGK[SXG[CX7[M#]=\;Z.W/]W>?$W>?"';K_SEA_9ZZ_^WSR
+M9X?NOS/6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5W8`[YCO5WYOJ[//>ESB'?
+ML?[.7'_W)<\5[M#]=\;Z.W/]W9?$W9?*'?(=Z^_,]7=?$G=?*G?(=ZR_,]??
+M?3E=G!WR'>OOS/5WY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^UKG
+MD.]8?V>NO_N:YRIWR'>LOS/7WWU-W'TMW*'[[XSU=^;ZNZ^)NZ^%.W3_G;'^
+MSEQ_]_7DSP[=?V>LOS/7WY6SJW/(=ZR_,]??@3GD.];?F>OOP!SR'>OOS/5W
+M>>Y;G4.^8_V=N?[N6YXKW*'[[XSU=^;ZNV^)NV^5.^0[UM^9Z^^^)>Z^5>Z0
+M[UA_9ZZ_^W:Z.#OD.];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7=M
+M_H&;^U[G@.]:UM^UKK_[GN<J=\!W-T]A[EK7WWU/W'W/W+4'_!3YOL?NS7[/
+MO?%UF4/?;[L\%<S=^^/';U=W@^B^*CK8^N^/FT\O?UZTZ+ZJ7WE]W>WYM=H<
+M)O!7_A,__GS]\,\R>'MWT!\8S*_PX5S^!>GN[@ZZC::V&W?NZ>,@]][P^9L>
+M"W_#3Z[OS:'OS?PKYX>N^_G98-<UTW0Q^+_Y]=U>]]-V3=LW[9@N<FREZ;3I
+MVC)W^UZ[Y?[K^\M?_];\_J=__,]Y[/_JV[V][F>^>?[FMW#6;.Z0#D+?[O_[
+MMWLW=_OE>_>GG>>,SCW!<[=?OM>?S*$//M?^[*F#TE=W\6M[-]<='CXUW'_J
+M_-L,:_:IF58R]]7-H6\?_RODW=X<,/?-\>8?6F]^@R?-LI]_L/;G;[[;##>?
+M)G?_:49O_U^FL3G*^?^RNQG\\:^_7__K;NS]];_?IM=W=W.`X`_^$^ST[FX.
+M&-C;S?]YD;_=YN$<^)W>KYW>^?<K<_=HIS<F6-`'_PEZ>M/=Z>%#.I\>_)3Y
+M<?\:T?MSX/<KOW)Z_>U7C?/7V`G\E?_$C]^O'_YY-]BFP4=[A3>#RR-^=ISG
+M'O&SXSSWB)\=Y[E'_>PX#S[B9\=Y[A$_.\YSC_C9<9Y[U,^.F\';?^?X2%_$
+MSW-R]V5R7YM!F\W<ZV-?CNOK>_AV[_Z=(_O2_Y,OXO@78WO$+^+GN9]_$=_^
+;Z)M]Q"_BY[E'_2+>'HXWWOOM/_VP*B?UK```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu
new file mode 100644
index 0000000..b082a2d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu
@@ -0,0 +1,26 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.qcow2.gz
+M'XL("+X[(U0``VEM9RTV,W@R-34M-#`Y-BUG<'0N<6-O=S(N;W5T`*V92V_4
+M,!"`[_T5+F]:6.)7DN51:$LK]=8BN'')\UB)*PK\=N+8B9/)3-PNWK6BKJSY
+M9#O?C)TT2>R',<V92IG:L[9D_6_7!)O]6#;6W5W?[.:?[LC">$)$(1U*3K@%
+MZ]+C!(5+^+J#X[C9Z"2"$V/4&A3"*7)T6QT([N1H6+KA9N0@0AX"M#CR9APT
+M/F''!R/4@>,3L<<G\?738QSL2+?')^WX8%1&X?(@3B!1>PI7!'$2B2HI7!7$
+M*22JIG!-$*>1J);`\8`J/2Y%HCB%$T%<AD1)"J>"N!R)HKSC8>_V2!3E'0][
+M5R!1E'<\[%V)1%'>\;!W%1)%><?#WM5(%.6=(+QC'M<@491W`GAW['!//*Y%
+MHBCO!/#NJ<,]FW`<BZ*\$\"[YP[WPN.0>B<H[P3P[J7#O?(XI-X)RCL!O'OM
+M<"<>A]0[07DG@'>G#O?&XY!Z)RCO!/#N[<H[CM0[07DG@7?O'"OQ.*3>2<H[
+M";SC#B<\#JEWDO).`N^DPRF/0^J=I+R3P#OM<*G'(?5.4MY)X%WF<+G'(?5.
+M4MY)X-W>X=Y['%+O).6=!-Y]<+B/'H?4.TEY)X%WGQSNS..0>B<I[Q3P[K/#
+M??$XI-XIRCL%O#MWN`N/0^J=HKQ3P+M+A_LZX006-7F7)'ASN*M5S@JDWJGT
+M@;CK-8Y^6#GD.*O\<9LC5[IC`Y@_'DCNM<J>4^)-6-L)&ZL*Y$IW=!>[Y7<"
+M#KG[".`XPB7.35C;W+4/C$W#VM8UNU(N.)\=$)`)'^]FN#KR^@WI]@B@UJPH
+M5L`?X_B&=.OSR[X;Z.W60S'0@FDUX8:YZFH^OJOK&W9[_NV[@?WTTQW2+2M8
+MQ5F1LP*.CE/3_8W9IVVZ92U<[1$G*=QT+`,X<[S(Z@T<UECWA\"IK:CII<,#
+M[JW%Z609-2];9ILH)6L+5M0$[@S@TLCF*=-=IBRK6-J8]TE5:_ZH4_.4QO(^
+M3>RV+88SUIYEW)S=>F!W?[>[M["WNU^G;GR*.R.P1G=0JZ>&RIQ3T\W\@P`Q
+M7;;$8:^1_FOU3%TN=;35VSM9L$9WD*M7V-7#%\FL'IHRW;AJ8\*-N#+NZG'[
+M"C,Q]7M]I3NZV]WR:X'*`:.-4*5M%3$[#"YB=AA<Q.PPN*C988`1L\/@(F:'
+MP47,#H.+FAT]L$GB;>(&9]PK,E8+\YRX^'_!UG;<#8^/Z^DV8FOKW]C$\9O1
+E1-S$#6YS$\\:>K+V\Q=,-N(F;G!1-W&5F>/WT3\!FKQU%1H`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu
new file mode 100644
index 0000000..d413df2
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.raw.gz
+M'XL("`+&'50``VEM9RTV,W@R-34M-#`Y-BUG<'0N<F%W+F]U=`"MEC]O@S`0
+MQ?=\BI>U52W;V`262JW42MW2JMW:@3]FC-2=#U\?A@2(C1KIP$)(Q_UR]_#C
+M(F4X`*,AJ\@U'>B?Q?+L=W>[@:;JVX#^]ZF$%5!X8,`U/B@U/>,<NFY<4@U9
+M(5E):#7>3SAQ.?9BAFO/6=<K'9CC1,!-[7:W`:U%55T!OZ;Z]/`Z+$P.4T+[
+MYR6,@M6PYHP;>K7-O+Z7US<<GSX^"?9]:5=[:5#[_!95!K<22:IDNS_K=@-.
+M4U:W5GO"94G</H[+**O=P,56&F>VLL(>^M^[#3@KEUG%/"MSJ#-T%:HV@7M<
+MX7+FG6<H7.<X-,@=K$+3T4V;0RF@\#8I!HB&]B66."CHFH#]Z5V<`NQ!_-Z/
+M]1DU[HC82@=2ZIEAJQ2I=@^TMS?;Q1*7<:M7D'J63;URW"RQE0XDU:N">G&1
+M2+VH9?I)M<DA$Z[F54\-4\/[PW^_KZ_I0'\4RS,`S0ADJ]!H/S;XW$$X1G<0
+MCM$=A&-U!P$9W4$X1G<0CM$=A&-UAP<ZR3?$":?"F.Q:%!HN6]67&L>7^I;M
+I.KTU^C>&>/QE.,8A3KCM(>YN;99QB!..=8@;_W]*RMT?5F[7A(@+````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu
new file mode 100644
index 0000000..0e9500f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.vhd.gz
+M'XL("#XUQ%4``VEM9RTV,W@R-34M-#`Y-BUG<'0N=FAD+F]U=`"MF$N/TS`0
+M@._]%8.X+2*R'=M)+D4@+1*W!8&X["7/584HCW+80_O?F7&<)D[BB(IIK2B5
+M,U_F;=="]!\`FX+MP+9@#=UG&FP!60Z`DWXH=Y7^)YSK'\>V_G-X3OSGO.MA
+M4DRE0G&25REH?$D&JJ27V(;NX3Q@DI?W3W>'[T\#3GF<\B"3D52JP%:+]V0-
+MY/U['.[K07USR,NH7;K4;I3J#>PZ2+O)$^F@W<5=WTR-U2B%S],PD&<@]#B"
+M'\'$:.S,=T;,I"9JKCE5C,:NX>R6U"VXNYV/19\JF!@97@58"9FB>TR;P0^+
+M@:GR?/I9_CZU,_U4)%7L)!CSN0WO*9\J:GC8:Z!)P2USP5%.<]Q*JOR7]VPH
+M-T07G2#,,*$&\W'@^T50&4Y1,>AGI=CP>3P84?U*TD]C)90KU_C$^5T2?J_`
+MJKH-.'@PQ%T#4M7D/U>I;3M:U">)%ZXEI&T\(/M)?*N&.;Y5=QO0&"C+!?#+
+MH%_MPF%`6]`%)08V!RW!*##ZBG.VFWJJW_W[#_#P]M-G@CV.YM:NV+#5E5!;
+MZGFA=LM*&\V]K!1;3<6&`9EY>\"E4=Q^M79K*K:JW<"MC3A.;TE=UY)_B&V/
+M,R*4RJ=2J'.50E="V41P^QF.NR^W-%UA5&M:PHV$VJWEC04I`7(LD]Q!%"A4
+M$1=V7(4K`IZ/'Y-C#WN=_'KE]6NESXBU$9^(>:]U?3F/F9N-#3MB+H0X[K[<
+MYN0]P^:]PB?+VHA/1+U7]MY;=Q)Y;ZUTKZM:DKP(<16O]Z1;-;`^L'\OK_&)
+M\T,2?GN@\LL0V[JF?"-ETU![()N&VM<OHX:RW0SFK5&V7D,VDRW^26#5,&MR
+MSAY(.,8>2#C&'D@XUAY(0,8>2#C&'D@XQAY(.-8>F#6%2V:FK1KA*/=D`5)#
+ME]&&+5`CNND:]=M/S2WZO]"Q#=[&5FTU&(5@W*H1;G.K5G6W&LNX52,<ZU8M
+L]WV/Z;2%<(RG+81C/&TA'.-I"^$83UL(QWC:0CCN5,&MR^XO,$6$MJ(3````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu
new file mode 100644
index 0000000..b446783
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.vhdf.gz
+M'XL("+4EAE4``VEM9RTV,W@R-34M-#`Y-BUG<'0N=FAD9BYO=70`K9?-K],P
+M#,#O^RN,N#U$E.]F%P9(#XG;`X&X<.GGTX080G#@L#\>.^E>DRZI&,IJ59U<
+M_VH[=MQR'GX`6@)O,^>RXOR6I<=Y=[?S--'=!L3GDPLK($-@P/6HY)+N&4>8
+MIEFX\%;!&$7SY=KCV/)[S2+<$%NMI*R(<2S@+N%.MP&-@;:]`GZ^^"?]<AC0
+M%O0>)-Z/L0DP$HQ^POG831_[=__N/3R\^?B)8%^7<*5`92>@L]`::-3*.[$1
+M[J\TW(!#ARC[:LH&JXJXPSI[`:<(-VS@<E+&Z2VK4$/_MK8!9WAJY6(K-4*G
+M8&JA'0JX5RN<K5QYFM2XL$T/=@0CH)_H8K`@!(##-G$>(D&BBWMH!,B.@.?3
+M!W8*L)?LYXO9/RWFBLA)65'*GJ92X:X4;D.UO1DNI#A5.WN.LF>J96\_%TM.
+MRHIB]MJ0O7R2*'NYUD7<G#7V+,5U=;,G_-3`_L#]^_I<5IP?6'H$H)Z!U3QL
+MIJFOV!V$J]@=A*O8'82KVAT$K-@=A*O8'82KV!V$J]H="!QYO2%..*J]?@\]
+MYKR#+JV:\CA>_#LDX8YR:_1O#/'\8HP5ASCA-H?X--X:;,4A3KBJ0]S-K]]6
+M@?7]90U=-QHLMI2+@7*I&0_L?YS&_O?Q3YP]YW=F6%Z25T+V4E%A6FR1EAYB
+M![J._'M^_WAW_/YXP<DYJDL"34-62H+MKL)U:;A?CO+;VKO,-N62[(FK<EYM
+M`X<8IY^"Q4\#W&*X7B3YDRBRA4PX7RKQS?^[M@%7NU3PTV#W%T[=6[ZS#0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu
new file mode 100644
index 0000000..8292403
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu
@@ -0,0 +1,88 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-gpt.vmdk.gz
+M'XL("`/&'50``VEM9RTV,W@R-34M-#`Y-BUG<'0N=FUD:RYO=70`K5Q=C]S&
+M$7SWKYB<'QPDR(*U_%H^*(B=LP,C"*#(3O*2ARR_XD-L23D=C`C8'Q\..357
+MO+LY4KX^\;3;VN[:Z9YE<U5=8)8M/\X5K2L*5_2NK%P&-_W3<K@LOS>FXWCB
+M"Y<_7__E[P?^_/IPN'RV@,%'20@RA1-C]3Z7PX,?PAV?BUJ],!W'3;C<1[6/
+M`@/<,?%"$JZ87CP^%<+5G>>7>_]$X%P$<BNX\HF<DLD^M[K??!:*Y]>7^S5,
+MVULUKLY=U0;35>5LYZX^SJ]EKIZ<Q@GP<W=]\^$_[GKXT-W>O+][%]9W]'L[
+M.1>5]Z\ZCS`E5E?^B7_!PS4>HAI<WKL<_F5WN?WFYL?A\/-P^^'FW=M78+I'
+MO[=%[HK&+\?[9_?'RO!ODKD*_CW<Y8_?7K\*G]SL\/Y\2S@?-2UD>N\I#\6M
+M*N=_'Q_SZH:W=QYQ##]Q=7YO0W'*^;T+_Z0L7-VX>3FEQSY.+_<AY;EVW>UP
+MOAN^__A^>'7UT[NWL79^;WW)FAGH-!<J=V7NH4)JOGRE1_0?FWG7W.7'F[L?
+M;KKOIC0_#%>'SQWA*E^[:0-/85U+UE-(E=S9:=F7K_]W-^7K^K"S-X2;%S$G
+M,;UW>71E[;&F#9RWXNCRPC^;_FE:\)1)`>_D+N_>'M[\8SK%?;&^>_WE&\*=
+MIJC)<UK@%#(EM,JI7/(O'WXLW>6[K]V53_+['X;Y$TBX9CG-O/.R#YC-HW\2
+MJK;`^R96^!?FG777Y[NS^^K\83A\?GW]5=S9LT^VF(]I:8-'J19H__F>RSD5
+M;MGI9:/GK>C[]G#NS^_OAEN_O7$K6E^B/F3JM[6XW\;U^]3S3HW^$^,NK]S5
+M33_MJ8?]]_#N)\)UR\=X6H?_2#1S8.Z?3)^>&7X([[!\8OPV>;CA[O;CH?OX
+MX\W;?CK1W"O"]4OMIN7D65A47-/#1<6WG6IWE=TO;<(FW.!+M"SJ%$Z,"6M9
+MQWT5_">F]$>HPN7CX8?AW$_+<E?'LKR*6S$^W`HMT8,J+!L]U6+9BK"PCX</
+M0Q?@\BQLX+@JSK(FEU<NS\.*U@WT[MWMO+0JO])^G#^\EKVT'Q>/+JGU+P1<
+MX*S75V4/KF>YQA5BE"M`?Q7+IM\_3+^O[]=7^?55XEEKU$F,9@7WKPGB_>-T
+M*_\1.XMGJU&=&/V>ZE6^M0WB.3ZL'K]J0)ZGX?A=@)ZY1A5BE"NX5.W*4#MZ
+MUAIU$J-9P:5J5X7:T;/5J$Z,?E>R=:@=/4>-\@_\*H5LQ]>RZA1J1\]<HPHQ
+MRA5<JG9-J!T]:XTZB=&LX%*U.X?:T;/5J$Z,?E>R;:@=/4>-\@]L$)#G:;@N
+MU(Z>N4858I0KN%3M^E`[>M8:=1*C6<&E:C>$VM&SU:A.C'Y7LF.H'3U'C?(/
+MA=2NV(*KLU`[>N8:58A1KN`2M:O9[^A9:]1)C&8%EZA=S7Y'SU:C.C'Z7<FR
+MW]%SU"C_4$KMRDTX]CMZYAI5B%&NX%*U8[^C9ZU1)S&:%5RJ=NQW]&PUJA.C
+MWY4L^QT]1XWR#Y74KMJ$8[^C9ZY1A1CE"BY5._8[>M8:=1*C6<&E:L=^1\]6
+MHSHQ^EW)LM_1<]0H_\`O09#G:3CV.WKF&E6(4:[@4K5COZ-GK5$G,9H57*IV
+M['?T;#6J$Z/?E2S['3U'C?(/)&0@SY-PIRS4CIZY1A5BE"NX1.U.['?TK#7J
+M)$:S@DO4[L1^1\]6HSHQ^EW)LM_1<]0H_]!([9I-./8[>N8:58A1KN!2M6._
+MHV>M42<QFA5<JG;L=_1L-:H3H]^5+/L=/4>-\@_\+Q3D>1J._8Z>N4858I0K
+MN%3MV._H66O428QF!9>J'?L=/5N-ZL3H=R7+?D?/4:/\`_E'R/,T'/L=/7.-
+M*L0H5W"IVK'?T;/6J),8S0HN53OV.WJV&M6)T>]*EOV.GJ-&^8=.:M=MP359
+MJ!T]<XTJQ"A7<(G:->QW]*PUZB1&LX)+U*YAOZ-GJU&=&/VN9-GOZ#EJE'_H
+MI7;])AS['3USC2K$*%=PJ=JQW]&SUJB3&,T*+E4[]CMZMAK5B='O2I;]CIZC
+M1OF'06HW;,*QW]$SUZA"C'(%EZH=^QT]:XTZB=&LX%*U8[^C9ZM1G1C]KF39
+M[^@Y:I1_&*5VXR8<^QT]<XTJQ"A7<*G:L=_1L]:HDQC-"BY5._8[>K8:U8G1
+M[TJ6_8Z>HT9E,CV#/$_"G;.E=M$SUZA"C'(%EZC=.?2[Z%EKU$F,9@67J-TY
+M]+OHV6I4)T:_*]G0[Z+GJ%&^9,+?89/2.H=^!^'OH/P=A+_#)G]W#OT.PM]!
+M^3L(?X=-_NX<^AV$OX/R=Q#^;D>RH=]!^#LH?P?A[[!):9U#OX/P=U#^#L+?
+M89._.X=^!^'OH/P=A+_#)G]W#OT.PM]!^3L(?[<CV=#O(/P=E+^#\'?8I+3.
+MH=]!^#LH?P?A[[#)WYU#OX/P=U#^#L+?89._.X=^!^'OH/P=A+_;D6SH=Q#^
+M#LK?0?@[;%):;19J)_P=E+^#\'?8Y.]:]COA[Z#\'82_PR9_U[+?"7\'Y>\@
+M_-V.9-GOA+^#\G<0_@Z;E%;+?B?\'92_@_!WV.3O6O8[X>^@_!V$O\,F?]>R
+MWPE_!^7O(/S=CF39[X2_@_)W$/X.FY16RWXG_!V4OX/P=]CD[UKV.^'OH/P=
+MA+_#)G_7LM\)?P?E[R#\W8YDV>^$OX/R=Q#^#IN45LM^)_P=E+^#\'?8Y.]:
+M]COA[Z#\'82_PR9_U[+?"7\'Y>\@_-V.9-GOA+^#\G<0_@Z;E%:7A=H)?P?E
+M[R#\'3;YNX[]3O@[*'\'X>^PR=]U['?"WT'Y.PA_MR-9]COA[Z#\'82_PR:E
+MU;'?"7\'Y>\@_!TV^;N._4[X.RA_!^'OL,G?=>QWPM]!^3L(?[<C6?8[X>^@
+M_!V$O\,FI=6QWPE_!^7O(/P=-OF[COU.^#LH?P?A[[#)WW7L=\+?0?D["'^W
+M(UGV.^'OH/P=A+_#)J75L=\)?P?E[R#\'3;YNX[]3O@[*'\'X>^PR=]U['?"
+MWT'Y.PA_MR-9]COA[Z#\'82_PR:EU6>A=L+?0?D["'^'3?ZN9[\3_@[*WT'X
+M.VSR=SW[G?!W4/X.PM_M2);]3O@[*'\'X>^P26GU['?"WT'Y.PA_ATW^KF>_
+M$_X.RM]!^#ML\G<]^YWP=U#^#L+?[4B6_4[X.RA_!^'OL$EI]>QWPM]!^3L(
+M?X=-_JYGOQ/^#LK?0?@[;/)W/?N=\'=0_@["W^U(EOU.^#LH?P?A[[!):?7L
+M=\+?0?D["'^'3?ZN9[\3_@[*WT'X.VSR=SW[G?!W4/X.PM_M2);]3O@[*'\7
+MQ720YP+GEM\`-V1+[9Z4E#_Q3[%V[LG5#=;ZP''<"Y@_G:[?XY@NLF>7\>GK
+MPZQ?C#./I>J_#'"!,ZX?XOQ=RG0?]ZGZ2L3Y.X\7Z2L1Y^\\7J2O1)R_\WB1
+MOA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[
+MB;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3Y
+MNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$
+M^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$IR_V^@KP?F[C;X2G+_;Z"O!
+M^;N-OA*<O]OH*\'YNXV^$IR_V^@KP?F[C;X2G+_;Z"O!^;N-OA*<O]OH*\'Y
+MNXV^$IR_V^@KP?F[C;X2G+_;Z"O!^;N-OA*<O]OH*\'YNXV^$IR_V^@KP?F[
+MC;X2G+_;Z"O!^;N-OA*<O]OH*\'YNXV^$IR_V^@KP?F[C;X2G+_;Z"O!^;N-
+MOA*<O]OH*\'YNXV^$IR_V^@KP?F[C;X2<?Y.SQ?I*Q'G[_1\D;X2<?Y.SQ?I
+M*Q'G[_1\D;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G
+M[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1
+MY^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K
+M$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA*<O]OH*S&8ZBLQ
+MF.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8
+MZBLQF.HK,9CJ*S%FF:&^$J.IOA*CJ;X2HZF^$J.IOA*CJ;X2HZF^$J.IOA*C
+MJ;X2HZF^$J.IOA*CJ;X2HZF^$J.IOA*CJ;X2HZF^\IAEF:&^\OCH7L<[X1XG
+MN^@#CS#55QZ/SR[CT]=7S/5;[J[Z^._T"Y>O#NL_$1#MIP%RA6LX)ES`GQN+
+MUFL8W#B&8U'.W6<8[V+]1,*_/@A<;UR__?N['&7ISN='@'_C^N;]+4I_/^:B
+MF6_.RSOSED6$FW,O.UW?U]]\ZUY_^>9[#_;/^W3GVSMWN2?;BMJCK%>'=+I_
+M>O/X["CFVSM/U3_63R:;)^&^>.ID*^;;.X_],W!/'6FXXKFH3[T3>#'?WEFC
+M5'WK\L&UN1O/[MPGX'[_`*XR_N3-=YYM*U=W_O[!)5PWW^RYKSPM[4[3:;*<
+M$T=W[+T2H88[^CLR'RYO_WIXNX#][O#?WX;U+7>>Q=-'^H54]8KY+N^G5+IU
+MHF&OV[S`Y=;5\]]7VM*L>DWXL#QUI%](5N^\5"]Q59NJ]]2I.\'QJO:K-5QK
+M6[UROFHLPI/'?Z=?N+P^K/\L@$4`-%MAX6\I:'=V>#C#L\/#&9X='L[T[/"`
+MAF>'AS,\.SR<X=GAX4S/CL+?,-+N(N[AL'QCKBLWUOX+Q&H9R<OQY?#S]+W"
+M_WRQ2G?F').7_F<NXD]OQF!X$?=PSU[$QR&9+'\>)&MX$?=PIA?QPM^],_OL
+)_ZT-&`6T90``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow.gz.uu
new file mode 100644
index 0000000..2a4ea04
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow.gz.uu
@@ -0,0 +1,128 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.qcow.gz
+M'XL("&'N+50``VEM9RTV,W@R-34M-#`Y-BUM8G(N<6-O=RYO=70`K9W)CE79
+M$47G]16/'I+N1<1M:3)3EFS),WM@>UJW';\/0/YV`WF:S+A[$Y0+0*5$67?K
+MO9.+1:E8.IS/=]].IU9.37=JQM,^G[[^//V0T[V?//QQ^O+/O_W]W?UO7WZ[
+M&Y/S#YYR/^^W,O=@Z[]U3K\]M9S.XT_,??TA:.[>J[,_\.KNO=GCW-5O=V\6
+M/Z=LT!X,GM+<.;T^(:?7_-SKNW5O5^Y.[]>]725OM_VYP7^XUZ=_"):?>GU_
+M\.O;P<'?R^MKX%,]FQL>S%T.;[>%3XUL;OHAS'KNX%,SFUN"N1X^M;*Y+9@;
+MX%,[GI,??&WOYD;XE+`YA7.G,C?!IXS--0_FSFGNMLS-\"GRZT(<=_G71>5N
+M@4\1[B3D;H5/$>XDY&Z#3Q'N).1NAT\1[B3B3O!3A#N-N!.D*&7<:<2=(",K
+MXTXC[@3Y3AEW&G$GR'?*N-.(.T&^4\:=1MP)\ITR[C3B3I#OE'&G(7?(=\JX
+MLY`[Y#MCW%G('?*=,>XLY`[YSAAW%G*'?&>,.PNY0[XSQIV%W"'?&>/.0NZ0
+M[XQQ9Q%WBI\BW#41=XI\US#NFH@[1;YK&'=-Q)TBWS6,NR;B3I'O&L9=$W&G
+MR'<-XZZ)N%/DNX9QUT3<*?)=P[AK0NZ0[QK&71MRAWS7,N[:D#ODNY9QUX;<
+M(=^UC+LVY`[YKF7<M2%WR'<MXZX-N4.^:QEW;<@=\EW+N&LC[@P_1;CK(NX,
+M^:YCW'41=X9\US'NNH@[0[[K&'==Q)TAWW6,NR[BSI#O.L9=%W%GR'<=XZZ+
+MN#/DNXYQUX7<(=]UC+L^Y`[YKF?<]2%WR'<]XZX/N4.^ZQEW?<@=\EW/N.M#
+M[I#O>L9='W*'?-<S[OJ0.^2[GG'71]PU^"G"W1!QUR#?#8R[(>*N0;X;&'=#
+MQ%V#?#<P[H:(NP;Y;F#<#1%W#?+=P+@;(NX:Y+N!<3=$W#7(=P/C;@BY0[X;
+M&'?Y?\_S.>2[D7$WAMPAWXV,NS'D#OEN9-R-(7?(=R/C;@RY0[X;&7=CR!WR
+MW<BX&T/ND.]&QMT8<=?BIPAW4\1=BWPW,>ZFB+L6^6YBW$T1=RWRW<2XFR+N
+M6N2[B7$W1=RUR'<3XVZ*N&N1[R;&W11QUR+?38R[*>0.^6YBW.4_)N5SR'<S
+MXVX.N4.^FQEW<\@=\MW,N)M#[I#O9L;=''*'?#<S[N:0.^2[F7$WA]PAW\V,
+MNSGBKL-/$>Z6B+L.^6YAW"T1=QWRW<*X6R+N.N2[A7&W1-QUR'<+XVZ)N.N0
+M[Q;&W1)QUR'?+8R[)>*N0[Y;&'=+R!WRW<*X6T/ND.]6QMT:<H=\MS+NUI`[
+MY+N5<;>&W"'?K8R[->0.^6YEW*TA=\AW*^-N#;E#OEL9=VO$78^?(MR10.C>
+M'/+=QKC;(NYZY+N-<;=%W/7(=QOC;HNXZY'O-L;=%G'7(]]MC+LMXJY'OML8
+M=UO$78]\MS'NMI`[Y+N-<;>'W"'?[8R[/>0.^6YGW.TA=\AW.^-N#[E#OML9
+M=WO('?+=SKC;0^Z0[W;&W1YRAWRW,^[VB+L!/X6YD_P!GP.^DS/A3LX1=P/P
+MG9P)=W*.N!N`[X3U@>+[NP-W`_"=L/Y.POYN`+X3UM])V-\-P'?"^CL)^[L!
+M^$Y8?R=A?S<`WPGK[R3L[P;@.V']G83]W0!\)ZR_D["_&X#OA/5W$O9W`_"=
+ML/Y.POYN`+X3UM])V-\-P'?"^CL)^[L!^$Y8?R=A?S?BIPAW87\W(M^Q_D["
+M_FY$OF/]G83]W8A\Q_H["?N[$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?C<AW
+MK+^3L+\;D>]8?R=A?S<BW['^3L+^;D2^8_V=A/W=B'S'^CL)^[L1^8[U=Q+V
+M=R/R'>OO).SO1N0[UM])V-^-R'>LOY.POYOP4X2[L+^;D.]8?R=A?S<AW['^
+M3L+^;D*^8_V=A/W=A'S'^CL)^[L)^8[U=Q+V=Q/R'>OO).SO)N0[UM])V-]-
+MR'>LOY.POYN0[UA_)V%_-R'?L?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W
+M$O9W$_(=Z^\D[.\FY#O6WTG8W\WX*<)=V-_-R'>LOY.POYN1[UA_)V%_-R/?
+ML?Y.POYN1KYC_9V$_=V,?,?Z.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8
+MW\W(=ZR_D["_FY'O6'\G87\W(]^Q_D["_FY&OF/]G83]W8Q\Q_H["?N[&?F.
+M]7<2]G<S\AWK[R3L[Q;\%.$N[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W
+M(-^Q_D["_FY!OF/]G83]W8)\Q_H["?N[!?F.]7<2]G<+\AWK[R3L[Q;D.];?
+M2=C?+<AWK+^3L+];D.]8?R=A?[<@W['^3L+^;D&^8_V=A/W=@GS'^CL)^[L%
+M^8[U=Q+V=RM^BG`7]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A
+M?[<BW['^3L+^;D6^8_V=A/W=BGS'^CL)^[L5^8[U=Q+V=ROR'>OO).SO5N0[
+MUM])V-^MR'>LOY.POUN1[UA_)V%_MR+?L?Y.POYN1;YC_9V$_=V*?,?Z.PG[
+MNPT_1;@+^[L-^8[U=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_
+M)V%_MR'?L?Y.POYN0[YC_9V$_=V&?,?Z.PG[NPWYCO5W$O9W&_(=Z^\D[.\V
+MY#O6WTG8WVW(=ZR_D["_VY#O6'\G87^W(=^Q_D["_FY#OF/]G83]W8Z?(MR%
+M_=V.?,?Z.PG[NQWYCO5W$O9W._(=Z^\D[.]VY#O6WTG8W^W(=ZR_D["_VY'O
+M6'\G87^W(]^Q_D["_FY'OF/]G83]W8Y\Q_H["?N['?F.]7<2]G<[\AWK[R3L
+M[W;D.];?2=C?[<AWK+^3L+_;D>]8?R=A?[<CW['^3J+^SL[X*<R=Y@_<W*G.
+M`=]]?0ISIZZ_R_?]G4YE#OA.67^GKK\[)>Y.MV4.^$Y9?Z>NOSLE[DZ_ESG@
+M.V7]G;K^[G0YG!WPG;+^3EU_5\ZNS@'?*>OOU/5W8`[X3EE_IZZ_`W/`=\KZ
+M.W7]79Y[5.>`[Y3U=^KZNT=YKG('?*>LOU/7WSU*W#VJW`'?*>OOU/5WCQ)W
+MCRIWP'?*^CMU_=VCR^'L@.^4]7?J^KMR=G4.^$Y9?Z>NOP-SP'?*^CMU_=UQ
+M#MU_IZR_4]??Y;G'=0[YCO5WZOJ[QWFN<(?NOU/6WZGK[QXG[AX7[M#]=\KZ
+M.W7]W>/$W>/"';K_3EE_IZZ_>WPYG!WR'>OOU/5WY>SJ'/(=Z^_4]7=@#OF.
+M]7?J^CLPAWS'^CMU_5V>>U+GD.]8?Z>NOWN2YRIWR'>LOU/7WSU)W#VIW"'?
+ML?Y.77_W)''WI'*'?,?Z.W7]W9/+X>R0[UA_IZZ_*V=7YY#O6'^GKK\#<\AW
+MK+]3U]\=Y]#]=\KZ.W7]79Y[6N>0[UA_IZZ_>YKG"G?H_CME_9VZ_NYIXNYI
+MX0[=?Z>LOU/7WSU-W#TMW*'[[Y3U=^KZNZ>7P]DAW['^3EU_5\ZNSB'?L?Y.
+M77\'YI#O6'^GKK\#<\AWK+]3U]_EN6=U#OF.]7?J^KMG>:YRAWS'^CMU_=VS
+MQ-VSRAWR'>OOU/5WSQ)WSRIWR'>LOU/7WSV[',X.^8[U=^KZNW)V=0[YCO5W
+MZOH[,(=\Q_H[=?W=<0[=?Z>LOU/7W^6YYW4.^8[U=^KZN^=YKG"'[K]3UM^I
+MZ^^>)^Z>%^[0_7?*^CMU_=WSQ-WSPAVZ_TY9?Z>NOWM^.9P=\AWK[]3U=^7L
+MZASR'>OOU/5W8`[YCO5WZOH[,(=\Q_H[=?U=GGM1YY#O6'^GKK][D><J=\AW
+MK+]3U]^]2-R]J-PAW['^3EU_]R)Q]Z)RAWS'^CMU_=V+R^'LD.]8?Z>NORMG
+M5^>0[UA_IZZ_`W/(=ZR_4]??'>?0_7?*^CMU_5V>>UGGD.]8?Z>NOWN9YPIW
+MZ/X[9?V=NO[N9>+N9>$.W7^GK+]3U]^]3-R]+-RA^^^4]7?J^KN7E\/9(=^Q
+M_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_4]??Y;E7=0[YCO5WZOJ[
+M5WFN<H=\Q_H[=?W=J\3=J\H=\AWK[]3U=Z\2=Z\J=\AWK+]3U]^]NAS.#OF.
+M]7?J^KMR=G4.^8[U=^KZ.S"'?,?Z.W7]W7$.W7^GK+]3U]_EN:LZAWS'^CMU
+M_=U5GBO<H?OOE/5WZOJ[J\3=5>$.W7^GK+]3U]]=)>ZN"G?H_CME_9VZ_N[J
+M<C@[Y#O6WZGK[\K9U3GD.];?J>OOP!SR'>OOU/5W8`[YCO5WZOJ[//>ZSB'?
+ML?Y.77_W.L]5[I#O6'^GKK][G;A[7;E#OF/]G;K^[G7B[G7E#OF.]7?J^KO7
+ME\/9(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_.\ZA^^^4]7?J^KL\]Z;.
+M(=^Q_DY=?_<FSQ7NT/UWROH[=?W=F\3=F\(=NO].67^GKK][D[A[4[A#]]\I
+MZ^_4]7=O+H>S0[YC_9VZ_JZ<79U#OF/]G;K^#LPAW['^3EU_!^:0[UA_IZZ_
+MRW-OZQSR'>OOU/5W;_-<Y0[YCO5WZOJ[MXF[MY4[Y#O6WZGK[]XF[MY6[I#O
+M6'^GKK][>SF<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.^8[U=^KZN^,<NO].67^G
+MKK_+<^_J'/(=Z^\TZN\,W7^GK+_3J+\S=/^=LOY.H_[.T/UWROH[C?H[0_??
+M*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ.R7]W?LZAWS'^CMU_=W[
+M/%>Y0[YC_9VZ_NY]XNY]Y0[YCO5WZOJ[]XF[]Y4[Y#O6WZGK[]Y?#F>'?,?Z
+M.W7]73F[.H=\Q_H[=?T=F$.^8_V=NO[N.(?NOU/6WUG^P,V=ZQSPG;'^[NLG
+M'G"7_70NW*'[[XSU=^;ZNW/:.Q?NT/UWQOH[<_W=.7%W+MRA^^^,]7?F^KOS
+MY7!VP'?&^CMS_5TYNSH'?&>LOS/7WX$YX#MC_9VY_@[,`=\9Z^_,]7=Y3NH<
+M\)VQ_LY<?R=YKG('?&>LOS/7WTEZ>5*Y`[XSUM^9Z^\D<2>5.^`[8_V=N?Y.
+M+H>S`[XSUM^9Z^_*V=4YX#MC_9VY_@[,`=\9Z^_,]7?'.73_G;'^SEQ_E^>T
+MSB'?L?[.7'^G>:YPA^Z_,];?F>OO-'&GA3MT_YVQ_LY<?Z>).RW<H?OOC/5W
+MYOH[O1S.#OF.]7?F^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L]9
+MG4.^8_V=N?[.\ESE#OF.]7?F^CM+W%GE#OF.]7?F^CM+W%GE#OF.]7?F^CN[
+M',X.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_W=<0[=?V>LOS/7W^6YILXA
+MW['^SEQ_U^2YPAVZ_\Y8?V>NOVL2=TWA#MU_9ZR_,]??-8F[IG"'[K\SUM^9
+MZ^^:R^'LD.]8?V>NORMG5^>0[UA_9ZZ_`W/(=ZR_,]??@3GD.];?F>OO\EQ;
+MYY#O6']GKK]K\USE#OF.]7?F^KLV<==6[I#O6']GKK]K$W=MY0[YCO5WYOJ[
+M]G(X.^0[UM^9Z^_*V=4YY#O6WYGK[\`<\AWK[\SU=\<Y=/^=L?[.7'^7Y[HZ
+MAWS'^CMS_5V7YPIWZ/X[8_V=N?ZN2]QUA3MT_YVQ_LY<?]<E[KK"';K_SEA_
+M9ZZ_ZRZ'LT.^8_V=N?ZNG%V=0[YC_9VY_@[,(=^Q_LY<?P?FD.]8?V>NO\MS
+M?9U#OF/]G;G^KL]SE3OD.];?F>OO^L1=7[E#OF/]G;G^KD_<]94[Y#O6WYGK
+M[_K+X>R0[UA_9ZZ_*V=7YY#O6']GKK\#<\AWK+\SU]\=Y]#]=\;Z.W/]79X;
+MZASR'>OOS/5W0YXKW*'[[XSU=^;ZNR%Q-Q3NT/UWQOH[<_W=D+@;"G?H_CMC
+M_9VY_FZX',X.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XN
+MSXUU#OF.]7?F^KLQSU7ND.]8?V>NOQL3=V/E#OF.]7?F^KLQ<3=6[I#O6']G
+MKK\;+X>S0[YC_9VY_JZ<79U#OF/]G;G^#LPAW['^SEQ_=YQ#]]\9Z^_,]7=Y
+M[D.=0[YC_9VY_NY#GBO<H?OOC/5WYOJ[#XF[#X4[=/^=L?[.7'_W(7'WH7"'
+M[K\SUM^9Z^\^7`YGAWS'^CMS_5TYNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^
+MSEQ_E^<^UCGD.];?F>OO/N:YRAWR'>OOS/5W'Q-W'RMWR'>LOS/7WWU,W'VL
+MW"'?L?[.7'_W\7(X.^0[UM^9Z^_*V=4YY#O6WYGK[\`<\AWK[\SU=\<Y=/^=
+ML?[.7'^7YS[5.>0[UM^9Z^\^Y;G"';K_SEA_9ZZ_^Y2X^U2X0_??&>OOS/5W
+MGQ)WGPIWZ/X[8_V=N?[NT^5P=LAWK+\SU]^5LZMSR'>LOS/7WX$YY#O6WYGK
+M[\`<\AWK[\SU=WGN<YU#OF/]G;G^[G.>J]PAW['^SEQ_]SEQ][ERAWS'^CMS
+M_=WGQ-WGRAWR'>OOS/5WGR^'LT.^8_V=N?ZNG%V=0[YC_9VY_@[,(=^Q_LY<
+M?W><0_??&>OOS/5W>>ZZSB'?L?[.7']WG><*=^C^.V/]G;G^[CIQ=UVX0_??
+M&>OOS/5WUXF[Z\(=NO_.6']GKK^[OAS.#OF.]7?F^KMR=G4.^8[U=^;Z.S"'
+M?,?Z.W/]'9A#OF/]G;G^+L_=U#GD.];?F>OO;O)<Y0[YCO5WYOJ[F\3=3>4.
+M^8[U=^;ZNYO$W4WE#OF.]7?F^KN;R^'LD.]8?V>NORMG5^>0[UA_9ZZ_`W/(
+M=ZR_,]??'>::,WX*<]?D#]S<;9T#OFM8?]>X_NXVSYW*'/#=UZ<P=XWK[VX3
+M=[>W90[XKF']7>/ZN]O$W>WO90[XKF']7>/ZN]O+X>S0W[==3IQ^XLL[]^W+
+M;U??!]OO7]M&3^<)_)-_XLM?WCW\7@:_WVOT!P:_O6$Y#.8WW-[=:_2]K9O:
+M!-[7G][9+;V]1>KOLO??\,T=?-?O[LVAOS?ZSYP?NHKH1X-M>YJFP^"_\NM#
+M5Q']F=?7;;_XZ]M_!Z;M3TU[:KO3H#_["O_SUW^[5W@W!V3P_[WANSD@@X=S
+M^067WQ\/<S?WYK[)8+_W;Y[EWE/WN;O_\;VYZW?W?@/OD0SJW#<!;N@3],W^
+M8AGTAPLG[W^=O]_);*=S_O,9=]%I^?J>ZNM#@?^#M_N#UW<ZOMWO_X'1/_SW
+MY=Z<!F_W]'!N+F8!7\+@]*Z/KP[]!?=_YHMQN#;Q)W_E?AMY^"OW;DY_K0B&
+H[V;Y]MOB!/[)/_'E'^\>?K\;;-+@+SO!YBM]Y_-O_P.[1]$3H:@`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow2.gz.uu
new file mode 100644
index 0000000..4524f2b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.qcow2.gz
+M'XL("&+N+50``VEM9RTV,W@R-34M-#`Y-BUM8G(N<6-O=S(N;W5T`*V8VY+3
+M,`Q`W_<KS!T6*+'DW+BTL+#,\`8/P'-Z^XH.WTY2*[&C2/&VDS:3:<?5&=D^
+M4I-DF7\9DUOC"N-J<]R:]CL=8*(OX\.<?GW_L8I?IQL/LYD2)0R4AP$W8OT+
+M.-!PF9T.6!D798<"#OJH*2B%<VIV<P,"[O;FO'3GS:A8!%X#]#AU,Z[*#WQ^
+M/,)=F1\LG1_*ZY?W<7R@F,\/?7X\JM1P51('0E2MX9HD#H6HK8;;)7%.B-IK
+M.*5R(UPN1!T5G$VHTN(*(<IJ.$CB2B$*-9Q+XBHA2O/.IKVKA2C-.YOVKA&B
+M-.]LVKNM$*5Y9]/>[80HS3N;]FXO1&G>@>*=";B#$*5Y!\R[1X1[''!'(4KS
+M#IAW3PCW=,!9*4KS#IAWSPCW/."$?@>:=\"\>T&XEP$G]#O0O`/FW2O"W0:<
+MT.]`\PZ8=Z\)]R;@A'X'FG?`O'L[\<X*_0XT[Y!Y]XY86<`)_0XU[Y!Y9PD'
+M`2?T.]2\0^8=$LX%G-#O4/,.F7<YX8J`$_H=:MXA\ZXD7!5P0K]#S3MDWM6$
+M>Q]P0K]#S3MDWGT@W,>`$_H=:MXA\^X3X=8!)_0[U+QSS+L-X3X'G-#OG.:=
+M8]Y](=Q=P`G]SFG>.>;=5\)]&W`@10W>99E\$.Y^4K.P[/6G"]?'5CCK`S/`
+MZA+@7(8>5R\ZX=Q/N-.@$<[ZP.EN-7X/P'.Q70"L:`7'.)IP[HO-KTZ3]Z5A
+MJ4!H>CL;RBR>\,:7QWH5X?8+K]^Y/BX`YKEIF@GP=Y\?S*9Q>7[E8>']K?SC
+MAK*KVKPP%3PTP[_W?Z9"M[C%*MCC],<---`G/+38"6X3X;HKEF/TR[A.1][%
+MGR/<>A5:?8N;?=S0W4,=I`%ULOFRLE1#LQILC?:YNW3O[K#Z?V]VZ3WLKPGY
+M"<T*1M.=R<],I]M=%0QW[VP_.APDIFO&N.W0680M3*S>>IK=;N'-L+PR'EBY
+M'61<N1X'RS:"^MQ96@/;7TW/^L#IYVK\]D!'P,56T!7=?]O-?U_U;%8C%0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.raw.gz.uu
new file mode 100644
index 0000000..b3375d7
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.raw.gz
+M'XL("&+N+50``VEM9RTV,W@R-34M-#`Y-BUM8G(N<F%W+F]U=`"ME,V.A"`,
+MQ^\^1<][(`5E92Y.LLG>][(S9\;5I_#AMUAURN#'F$"18`J__$L+B-P`*@/H
+M5\9MQ_"E8AN*CV*DZ<<YH$-`G0`5`1G7$HX6D$QOPUCVX3>,P8&AM_3?37/N
+M,!!!7<FH-4K@_I9=:=]VC#C9GN'VYX#6@O<)\'?69W9EG-=7=YGSZ\:"L354
+M%NPG./.NPOOW[44AXW2N@!EGCG"S8*Z@-=Q5X$IR]F(E5^*T2]:=G`M<P]^,
+MJ_;4T4E@M^;8#-;F+19'%N^3>0;=@2X!W>0S,7#)+SSU75(9)@IW1Q^DX?J`
+MJ^/U6N#,0;@0XQ[+R[*2PH/3:U)U;>9DZ->;\>;-#9#XYC+.Y'T(+N/+0A5(
+<J])QVS'\J-@86$W`;"<87C[$XA^HPB9UY08`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhd.gz.uu
new file mode 100644
index 0000000..b8584d7
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhd.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.vhd.gz
+M'XL("$$UQ%4``VEM9RTV,W@R-34M-#`Y-BUM8G(N=FAD+F]U=`"MESUOI#`0
+MAOO]%2-=EP*9P39.LRM%2G_-);5-(%J=+HF2*U+PX\^##=@8V&S."VN!S#R\
+MGB]DQMP/0%8@.Y`M2$'7-0=Y"[4"L)/^Q&$L_2WTS>M+V_P]?Q;^UQ\<K&2A
+M56Q.]E@!MR^I`36]1#[1-?0CIOAQ_WQS_O,\XM#CT(-$3585@C3)>SH#C#MU
+M1'H\X^^ENBI5-UNY]W0=5%WP1!6J*XI3B./6RCY/IP`C!_^,9W03382X2)U@
+M"ZM`YII3V;S8-9S<L[H&=W/PL7"I8A.CMB,#64*-=&W39O1#<MI4^?QXT^\?
+M[4(?;J2*G/25R9S:7B[Z5,$IL$X!I]3>6RX,E-<E;B55_LM[,K;C_L(Z@8EQ
+M`H?EQ]Z;41#JDR7;\?EV,#;U:=+';9WIE7%[HK\KXF,"&G,=4#%7'3%N6K!I
+M?'4PT()&JM+2UZKW7V/OVY6`G%S9'@/_F:?,\37==4`A0.L$^&O4U^S*N%Z?
+M4IGCJX:$L?W8MG,A0>%7%3[>/ZS4K](;[>![W4]IO(0;!8?=/L:=`ESERFVF
+M!,TIRKOP.L`=W7_$\3UUU!/:M8G-Q8K,R:+5PBZ,,Y0ME!4U8S9UK0`XQ1=F
+M?;>I#(R6NZ,/TN5JPM7Q\V6`PPO+A1AGILZR$L(+WCNFZIK,P3#+ROABY1(D
+MKER'P[R-0`^=Q6:@?2H=MR?ZGT5\."#Z3U&V;QOZ9II-(??`;`HML,VL4.?]
+M?DCA@I)IHT"XC!L%PF7<*!`NXT:!<!DW"H3+N%$@7-:-@@7:W#O\`W7?LJE=
+##@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdf.gz.uu
new file mode 100644
index 0000000..cecbe9d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.vhdf.gz
+M'XL("+HEAE4``VEM9RTV,W@R-34M-#`Y-BUM8G(N=FAD9BYO=70`K94[;\,@
+M$,?W?(J3NF6P>!CL+(E4*7N7-K/MX"B*VBX=.OC#]P#C\+#SJ#`$X1S\\C_N
+MN!!B'X"2`6EFQF7#\%J$;5BM5X9&V^>`-0%"$V"!0(OK$(<+4&8C],A[_:I'
+M;2"Z=_BNQKGM,""AV&'#9UMXN..T*^W+!H/SGZN[_7-`(:!I$N"[T\=NRGA>
+M7Z4RQ[<V"2,J*`4("35[5.%A_Q$IM#B:RV&+8_=P3K#-H#G<SL-Q-/;>2IN)
+MXRX_[_RYA]O:C\.5M]3A21`U9UAT5N1-EAI;N,^/,U`%E`.I1QL+@5-\X:IO
+MD\I@@;LW]$'J;J-Q5;B>>CAVQUT(<>U4669">.?TMJFZ+G,P:'PS'KRY&A+>
+M7(MC>0O!QE06S$!<E8[+AN&M")L%EB,PUPE2]]\F.<@>I`(I]+PJ06Z@JGT@
+M"S-IZ+Z_5/=S_O4B;'#4%H/9KO<SKF^+K(`U^D?D4<\]?2_[T_K\>7(X5ZI<
+M1<++AKLX`]E&[M+8W<.976)U/#XD&IT>TSK]LH??!*>W\W'EY*SJH3T:G.O!
+>2V"8*U4&)TBTZ[^QM3B9.57P?W?U!^R^27D0"0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-mbr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vmdk.gz.uu
new file mode 100644
index 0000000..5ebc9fc
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-mbr.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-mbr.vmdk.gz
+M'XL("&/N+50``VEM9RTV,W@R-34M-#`Y-BUM8G(N=FUD:RYO=70`K5S1;N3&
+M$7SW5PSDMSPL6,LEN7PX.W'.`8(@@!$[]FO(Y3`68M\==$*0`_3QX9!3HR)%
+M'FFK=:L#^]A=V]U#M735!679].'<I767B[MTKBA=!C?\T_1R6?YL#*]+NO'T
+MM[=___'$CS^>3D]?3&`(41*"3.'$F+W/TVGQ0;CSYZ)F-X;7>1<N#U'MB\`(
+M=]ZXL0DW],.=UT*873/>[L*%P+D$Y&9PQ4I-F\5^+KL_?!&;%_++0P[#\9:U
+MJW)7MM%T93':N:O.X[W,58-3/P!^Z=[>?_R/>^L_WA[N/SR^C_F=P]D.SI<R
+M^)>W@#`45I7A(MP(<'6`*+W+.Y<CW'9/#W^Y_\6?_NL?/MZ_?_<&+/<<SO:2
+MNTL=T@G^V?-K9H0WR5R)\![NZ<]_??LF/KG9Z4/S0+@0-20RO/=0A^*6I0N?
+M+U]C=O[=8T#LXT?*+IQM;$XQOO<E7!075]5N3*<(V.?A=A=+'GMW>_#-H__A
+MTP?_YN[7]^]2[\+9AI;5(]!U;%3NBCQ`Q=)"^XJ`&!Z;\=3<TR_WCS_?W[X?
+MROSH[TY?.L*5H7?#`5YC7E/50TBY>;)#VD_?_N]QJ-=U\63O"3<F,18QO'=Q
+M=D45L(8#S(?>Y;G+KRX?X8>$ATHN"$[NZ?V[TS]^<BCSZ\5]_]V?_D&XZP`W
+M>`X)#B%#0;.:BJG^8OE8NJ?OOW5WH<@??O;C$TBX>OHR"\[3.6`TS^$B=FV"
+M#T/L$FZ,)^O>-H^-^Z;YZ$]?OGW[33K9)A1[&5]#:CZ@E!-T>+['=@Z-FTYZ
+M.NCQ*+JN/35=\^'1/X3C34?1AJ>UBY6&8[T\'^/\?:KQI/KPQ+BG-^[NOAO.
+M-,#^V[__E7"WZ3$>\@B/1#T&YN%B>'I&>!_?87IBPC$%./_X\.ET^_3+_;MN
+M^$)S;PC73;T;TAE.<THJY;1,*KWMT+L[/*<V8!/.AQ9-25WC%\:`->7QW(5\
+M>!7A%;OP].GTLV^Z(2UW=RZ*NW04_?(HM$6++DP'/?1B.HJ8V*?31W^+<'D6
+M#["?-6?**3S*PY,\930?H(_O'\;4ROQ.YW&^_%[VVGE\>?$MM?J=@!.<=7YE
+MMO?]C*]\!N@$+'O.KPSY7<2ST*A2C&H&-_PT<?IN^/S7\/E!X,(C=A7/6J,:
+M,=HCW2O#]XN;>'8:Y<7H#\%=8HOX`PKD>FPJC5QO)#BWZ%T1>T?/0J-*,:H9
+MW%;ORM@[>M8:U8C1KF:W++:*O:-GIU%>C/X0W#7VCC^`0:['WM'(L[6?\I:]
+MJV/OZ%EH5"E&-8/;ZET3>T?/6J,:,=K5[);%MK%W].PTRHO1'X*[Q=YQK$"N
+MQ][1R/7&9N^ZV#MZ%AI5BE'-X+9ZYV/OZ%EK5"-&NYK=LM@^]HZ>G49Y,?HC
+M<%46>W>1WO%Z[!V-7&]L]:[BO*-GH5&E&-4,;J-W%><=/6N-:L1H5[-;%LMY
+M1\].H[P8_2$XSKM">L?KL7<T<KVQV3O..WH6&E6*4<W@MGK'>4?/6J,:,=K5
+M[);%<M[1L],H+T9_"([SKI3>\7KL'8U<;VSVCO..GH5&E6)4,[BMWG'>T;/6
+MJ$:,=C6[9;&<=_3L-,J+T1^"X[SCCTZ0Z[%W-'*]L=D[SCMZ%AI5BE'-X+9Z
+MQWE'SUJC&C':U>R6Q7+>T;/3*"]&?P3NFL7>7:5WO!Y[1R/7&UN]NW+>T;/0
+MJ%*,:@:WT;LKYQT]:XUJQ&A7LUL6RWE'STZCO!C](3C.NUIZQ^NQ=S1RO;'9
+M.\X[>A8:58I1S>"V>L=Y1\]:HQHQVM7LEL5RWM&STR@O1G\(CO..__&"7(^]
+MHY'KC<W><=[1L]"H4HQJ!K?5.\X[>M8:U8C1KF:W+);SCIZ=1GDQ^D-PG'=D
+M+2'78^]HY'ICLW><=_0L-*H4HYK!;?6.\XZ>M48U8K2KV2V+Y;RC9Z=17HS^
+M"%R=Q=[=I'>\'GM'(]<;6[VK.>_H66A4*48U@]OH7<UY1\]:HQHQVM7LEL5R
+MWM&STR@O1G\(CO.ND][QFJQVZEWW`F[9.\X[>A8:58I1S>"V>L=Y1\]:HQHQ
+MVM7LEL5RWM&STR@O1G\(CO/.2^]X/?:.1JXW-GO'>4?/0J-*,:H9W%;O.._H
+M66M4(T:[FMVR6,X[>G8:Y<7H#\%QWO72.UZ/O:.1ZXW-WG'>T;/0J%*,:@:W
+MU3O..WK6&M6(T:YFMRR6\XZ>G49Y,?HC<$TV]2[MW"#7H7?)R/7&5N^:..^2
+M9Z%1I1C5#&ZC=TV<=\FSUJA&C'8UNV6Q<=XESTZCO!C](;@X[R#\'92_@_!W
+MV.7OFCCO(/P=E+^#\'?8Y>^:..\@_!V4OX/P=RO9+8N-\P["WT'Y.PA_=P`N
+MSCL(?P?E[R#\'7;YNR;..PA_!^7O(/P==OF[)LX["'\'Y>\@_-U*=LMBX[R#
+M\'=0_@["WQV`B_,.PM]!^3L(?X==_JZ)\P["WT'Y.PA_AUW^KHGS#L+?0?D[
+M"'^WDMVRV#CO(/P=E+^#\'?[<&T6>R?\'92_@_!WV.7O6LX[X>^@_!V$O\,N
+M?]=RW@E_!^7O(/S=2G;+8CGOA+^#\G<0_NX`'.>=\'=0_@["WV&7OVLY[X2_
+M@_)W$/X.N_Q=RWDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[`W"<=\+?0?D["'^'
+M7?ZNY;P3_@[*WT'X.^SR=RWGG?!W4/X.PM^M9+<LEO-.^#LH?P?A[P[`<=X)
+M?P?E[R#\'7;YNY;S3O@[*'\'X>^PR]^UG'?"WT'Y.PA_MY+=LEC..^'OH/P=
+MA+_;A[MEL7?"WT'Y.PA_AUW^[L9Y)_P=E+^#\'?8Y>]NG'?"WT'Y.PA_MY+=
+MLEC..^'OH/P=A+\[`,=Y)_P=E+^#\'?8Y>]NG'?"WT'Y.PA_AUW^[L9Y)_P=
+ME+^#\'<KV2V+Y;P3_@[*WT'XNP-PG'?"WT'Y.PA_AUW^[L9Y)_P=E+^#\'?8
+MY>]NG'?"WT'Y.PA_MY+=LEC..^'OH/P=A+\[`,=Y)_P=E+^#\'?8Y>]NG'?"
+MWT'Y.PA_AUW^[L9Y)_P=E+^#\'<KV2V+Y;P3_@[*WT'XNWVX+HN]$_X.RM]!
+M^#OL\G<=YYWP=U#^#L+?89>_ZSCOA+^#\G<0_FXENV6QG'?"WT'Y.PA_=P".
+M\T[X.RA_!^'OL,O?=9QWPM]!^3L(?X==_J[CO!/^#LK?0?B[E>R6Q7+>"7\'
+MY>\@_-T!.,X[X>^@_!V$O\,N?]=QW@E_!^7O(/P==OF[CO-.^#LH?P?A[U:R
+M6Q;+>2?\'92_@_!W!^`X[X2_@_)W$/X.N_Q=QWDG_!V4OX/P=]CE[SK..^'O
+MH/P=A+];R6Y9+.>=\'=0_@["W^W#^6SJ79+@0:Y'&2.-7&\\C4T;/MWPF;EG
+MN#CO5A5]*_^4>N?6LWNAQ3\&][+826Z(46Z8-A%3N;\/<((SED/B&KN^#WA$
+M#HFT+N?K57)(I'4Y7Z^20R*MR_EZE1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)
+M'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6Y
+MB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1U
+MN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD
+M=;F)'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%U
+MN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76Y
+MC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-
+M'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<
+M$FE=GCWW[O?+(9'6Y?1\E1P2:5U.SU?)(9'6Y?1\E1P2:5UN(H=$6I>;R"&1
+MUN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@A
+MD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO(
+M(9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;
+MR"&1UN4F<DBD=;F)'!)<E]O((<%UN8T<$MY4#@EO*H>$-Y5#PIO*(>%-Y9#P
+MIG)(>%,Y)+RI'!+>5`X);RJ'A#>50\*;RB'A3>60\*9R2/199BB'1&\JAT1O
+M*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\J
+MAT1O*H=$;RJ'/&=99BB'/&>F<LCSRU]-?`SN9;&3W/`RECO][M*7?V_?>/KF
+M-/^3`-'^-L!)$+<$9,$7C(_RR'XUX_\)\SZ8>2\%WP;;KQ3\]?!G^/CJ)'"=
+M<?_0_S;`HG!-\P+PG\SO_-DT?GM^E3<^W^OXP!15^#6[1>FNYZ,9_O3MCXL,
+M)S@S_>P$M_OUD5C0?@ON:X$+/P_TXCG[3>#ZW.FUP'TU?1+N\KGL=$%UK%CC
+M7]U]S:Z+.#WG\'TGT('\7]YY#IC.USWG5[],XSPK]S/YN9?EAN^Y^LMK]3QF
+M8WJC7#>':]-D63G"G>Y]]3*[F_%A8/F5<?`K-X#,OW(GN+/M(*C'R3*I/E[^
+>O7WCZ;O3_,\$>(F`9AV\A%],DGWQ?Q6YC7-O8```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu
new file mode 100644
index 0000000..bfa03be
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu
@@ -0,0 +1,126 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.qcow.gz
+M'XL("&/N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G%C;W<N;W5T`*V=VXX4
+M67-&[^<IBC,TIXJ(S*I,#MW(DBWY#E_8OOWK>#T/@/SLAF9W[NZH]4TP&A@T
+M`A7Y*2MK]0+-+&W6ZY_?5JO15L-F-<RK\W[U_>?MNZWN_>3A]]6W__J/_WQW
+M_]NW/WZ.V?HOKDH_WYZ6N0=;_]?G_,=5A]5Z_H6Y[]^-YN[=7?R-N[OW9B_G
+MKO[X^6;Y.E>#\6!PU>;6[?Y,/+WAU^[O2WJ[]O/I_;ZWZ^+MCFIP\V#P:YO[
+M5[L__UNP_-+]_<W/=XN#?R[W-^!5DYJ;_Y(^7X]XU4[-[8NY#5YU4'/'8FZ+
+M5YW4W+F8F^`J4Q^%%5^YOI[Q*O&%9L47FJ]W>)7X0K,[PM,7VM=E;H]7;=3<
+M0^[^=<'=`:\2W%G)W1&O$MQ9R=T)KQ+<6<G=&:\2W%G%G=%5KKCSBCLC1;GB
+MSBONC(SLBCNON#/RG2ONO.+.R'>NN/.*.R/?N>+.*^Z,?.>*.Z^X,_*=*^Z\
+MY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>A
+MN(N2._)=*.ZBXL[IJD%Q-U3<.?EN4-P-%7=.OAL4=T/%G9/O!L7=4''GY+M!
+M<3=4W#GY;E#<#15W3KX;%'=#Q9V3[P;%W5!R1[X;%7=CR1WY;E3<C25WY+M1
+M<3>6W)'O1L7=6')'OAL5=V/)'?EN5-R-)7?DNU%Q-Y;<D>]&Q=U8<1=TU49Q
+MMZFX"_+=1G&WJ;@+\MU&<;>IN`ORW49QMZFX"_+=1G&WJ;@+\MU&<;>IN`OR
+MW49QMZFX"_+=1G&W*;DCWVT5=]N2._+=5G&W+;DCWVT5=]N2._+=5G&W+;DC
+MWVT5=]N2._+=5G&W+;DCWVT5=]N2._+=5G&WK;@;Z*I)<3=5W`WDNTEQ-U7<
+M#>2[27$W5=P-Y+M)<3=5W`WDNTEQ-U7<#>2[27$W5=P-Y+M)<3=5W`WDNTEQ
+M-Y7<D>_N_BL\O%!Q1[Z;%7=SR1WY;E;<S25WY+M9<3>7W)'O9L7=7')'OIL5
+M=W/)'?EN5MS-)7?DNUEQ-U?<C7353G&WJ[@;R7<[Q=VNXFXDW^T4=[N*NY%\
+MMU/<[2KN1O+=3G&WJ[@;R7<[Q=VNXFXDW^T4=[N*NY%\MU/<[4KNR'=W_S<4
+M7JBX(]_M%7?[DCORW5YQMR^Y(]_M%7?[DCORW5YQMR^Y(]_M%7?[DCORW5YQ
+MMR^Y(]_M%7?[BKL-7750W!TJ[C;DNX/B[E!QMR'?'11WAXJ[#?GNH+@[5-QM
+MR'<'Q=VAXFY#OCLH[@X5=QORW4%Q=ZBXVY#O#HJ[0\D=^>ZHN#N6W)'OCHJ[
+M8\D=^>ZHN#N6W)'OCHJ[8\D=^>ZHN#N6W)'OCHJ[8\D=^>ZHN#N6W)'OCHJ[
+M8\7=EJY:.J#+%PKNMN2[D^+N5'&W)=^=%'>GBKLM^>ZDN#M5W&W)=R?%W:GB
+M;DN^.RGN3A5W6_+=27%WJKC;DN].BKM3R1WY[JRX.Y?<D>_.BKMSR1WY[JRX
+M.Y?<D>_.BKMSR1WY[JRX.Y?<D>_.BKMSR1WY[JRX.Y?<D>_.BKMSQ=T$5]G=
+M#^"%@KL)?&<J.+0J./0)?&<J.+1UQ=T$OK.UX,YR?W?!W02^,]7?6=G?3>`[
+M4_V=E?W=!+XSU=]9V=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7?
+M6=G?3>`[4_V=E?W=!+XSU=]9V=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97]
+MW4Q7J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^
+MSLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXF
+MWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN1U>I_L[*
+M_FY'OE/]G97]W8Y\I_H[*_N['?E.]7=6]G<[\IWJ[ZSL[W;D.]7?6=G?[<AW
+MJK^SLK_;D>]4?V=E?[<CWZG^SLK^;D>^4_V=E?W=CGRG^CLK^[L=^4[U=U;V
+M=SORG>KOK.SO=N0[U=]9V=_MR'>JO[.RO]N1[U1_9V5_MZ>K5']G97^W)]^I
+M_L[*_FY/OE/]G97]W9Y\I_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?
+M[<EWJK^SLK_;D^]4?V=E?[<GWZG^SLK^;D^^4_V=E?W=GGRG^CLK^[L]^4[U
+M=U;V=WORG>KOK.SO]N0[U=]9V=_MR7>JO[.ROSO05:J_L[*_.Y#O5']G97]W
+M(-^I_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7?
+M6=G?'<AWJK^SLK\[D.]4?V=E?W<@WZG^SLK^[D"^4_V=E?W=@7RG^CLK^[L#
+M^4[U=U;V=P?RG>KOK.SO#N0[U=]9V=\=Z2K5WUG9WQW)=ZJ_L[*_.Y+O5']G
+M97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.]7=6]G='\IWJ[ZSL[X[D
+M.]7?6=G?'<EWJK^SLK\[DN]4?V=E?W<DWZG^SLK^[DB^4_V=E?W=D7RG^CLK
+M^[LC^4[U=U;V=T?RG>KOK.SO3G25ZN^L[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O
+M5']G97]W(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[$_E.]7=6]G<G\IWJ[ZSL
+M[T[D.]7?6=G?G<AWJK^SLK\[D>]4?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG
+M^CLK^[L3^4[U=U;V=V>Z2O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_
+M.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ
+M[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?V=E?W<FWZG^SLK^[DR^4_V=E?W=
+MF7RG^CNK^KM8PU5^]P-XX0%W=YRL^ASXSE5_YZF_6[6]U7J9`]^YZN\\]7>K
+MQMWJZS('OG/5WWGJ[U:-N]6?RQSXSE5_YZF_@V<'OG/5WWGJ[V`.?.>JO_/4
+MW\$<^,Y5?^>IOX,Y\)VK_LY3?_>HS3WJ<^`[5_V=I_[N4;N]1YT[\)VK_LY3
+M?_>H<?>H<P>^<]7?>>KO'C7N'G7NP'>N^CM/_1T\._"=J_[.4W\'<^`[5_V=
+MI_X.YL!WKOH[3_W=Y1R=?^>JO_/4WSUN<X_['/E.]7>>^KO'C;O'"W=T_IVK
+M_LY3?_>X<?=XX8[.OW/5WWGJ[QXW[AXOW-'Y=Z[Z.T_]'3P[\IWJ[SSU=S!'
+MOE/]G:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[)VWN29\CWZG^SE-_]Z1Q]Z1S1[Y3
+M_9VG_NY)X^Y)YXY\I_H[3_W=D\;=D\X=^4[U=Y[Z.WAVY#O5WWGJ[V".?*?Z
+M.T_]'<R1[U1_YZF_NYRC\^]<]7>>^KNG;>YIGR/?J?[.4W_WM''W=.&.SK]S
+MU=]YZN^>-NZ>+MS1^7>N^CM/_=W3QMW3A3LZ_\Y5?^>IOX-G1[Y3_9VG_@[F
+MR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^SE-_]ZS-/>MSY#O5WWGJ[YXU[IYU[LAW
+MJK_SU-\]:]P]Z]R1[U1_YZF_>]:X>]:Y(]^I_LY3?P?/CGRG^CM/_1W,D>]4
+M?^>IOX,Y\IWJ[SSU=Y=S=/Z=J_[.4W_WO,T][W/D.]7?>>KOGC?NGB_<T?EW
+MKOH[3_W=\\;=\X4[.O_.57_GJ;][WKA[OG!'Y]^YZN\\]7?P[,AWJK_SU-_!
+M'/E.]7>>^CN8(]^I_LY3?P=SY#O5WWGJ[UZTN1=]CGRG^CM/_=V+QMV+SAWY
+M3O5WGOJ[%XV[%YT[\IWJ[SSU=R\:=R\Z=^0[U=]YZN_@V9'O5'_GJ;^#.?*=
+MZN\\]7<P1[Y3_9VG_NYRCLZ_<]7?>>KO7K:YEWV.?*?Z.T_]W<O&W<N%.SK_
+MSE5_YZF_>]FX>[EP1^??N>KO//5W+QMW+Q?NZ/P[5_V=I_X.GAWY3O5WGOH[
+MF"/?J?[.4W\'<^0[U=]YZN]@CGRG^CM/_=VK-O>JSY'O5'_GJ;][U;A[U;DC
+MWZG^SE-_]ZIQ]ZIS1[Y3_9VG_NY5X^Y5YXY\I_H[3_T=/#ORG>KO//5W,$>^
+M4_V=I_X.YLAWJK_SU-]=SM'Y=Z[Z.T_]W56;N^ISY#O5WWGJ[ZX:=U<+=W3^
+MG:O^SE-_=]6XNUJXH_/O7/5WGOJ[J\;=U<(=G7_GJK_SU-_!LR/?J?[.4W\'
+M<^0[U=]YZN]@CGRG^CM/_1W,D>]4?^>IOWO=YE[W.?*=ZN\\]7>O&W>O.W?D
+M.]7?>>KO7C?N7G?NR'>JO_/4W[UNW+WNW)'O5'_GJ;^#9T>^4_V=I_X.YLAW
+MJK_SU-_!'/E.]7>>^KO+.3K_SE5_YZF_>]/FWO0Y\IWJ[SSU=V\:=V\6[NC\
+M.U?]G:?^[DWC[LW"'9U_YZJ_\]3?O6G<O5FXH_/O7/5WGOH[>';D.]7?>>KO
+M8(Y\I_H[3_T=S)'O5'_GJ;^#.?*=ZN\\]7=OV]S;/D>^4_V=I_[N;>/N;>>.
+M?*?Z.T_]W=O&W=O.'?E.]7>>^KNWC;NWG3ORG>KO//5W\.S(=ZJ_\]3?P1SY
+M3O5WGOH[F"/?J?[.4W]W.4?GW[GJ[[SJ[X+.OW/5WWG5WP6=?^>JO_.JOPLZ
+M_\Y5?^=5?Q=T_IVK_LZK_B[H_#M7_9U7_5W0^7>N^CNO^KN@\^]<]7=>]7=!
+MY]^YZN\\]7?OV];[/D>^4_V=I_[N?>/N?>>.?*?Z.T_]W?O&W?O.'?E.]7>>
+M^KOWC;OWG3ORG>KO//5W\.S(=ZJ_\]3?P1SY3O5WGOH[F"/?J?[.4W]W.4?G
+MW\7=#^"%!]RMV]RZSX'OOE_%W$7J[]:-N_7"'9U_%ZJ_B]3?K1MWZX4[.O\N
+M5'\7J;];-^[6"W=T_EVH_BY2?P?/#GP7JK^+U-_!'/@N5'\7J;^#.?!=J/XN
+M4G\'<^"[4/U=I/[.VISU.?!=J/XN4G]GC3OKW('O0O5WD?H[:]Q9YPY\%ZJ_
+MB]3?6>/..G?@NU#]7:3^#IX=^"Y4?Q>IOX,Y\%VH_BY2?P=SX+M0_5VD_NYR
+MCLZ_"]7?1>KOO,UYGR/?J?XN4G_GC3M?N*/S[T+U=Y'Z.V_<^<(=G7\7JK^+
+MU-]YX\X7[NC\NU#]7:3^#IX=^4[U=Y'Z.Y@CWZG^+E)_!W/D.]7?1>KO8(Y\
+MI_J[2/U=M+GH<^0[U=]%ZN^B<1>=._*=ZN\B]7?1N(O.'?E.]7>1^KMHW$7G
+MCGRG^KM(_1T\._*=ZN\B]7<P1[Y3_5VD_@[FR'>JOXO4WUW.T?EWH?J[2/W=
+MT.:&/D>^4_U=I/YN:-P-"W=T_EVH_BY2?S<T[H:%.SK_+E1_%ZF_&QIWP\(=
+MG7\7JK^+U-_!LR/?J?XN4G\'<^0[U=]%ZN]@CGRG^KM(_1W,D>]4?Q>IOQO;
+MW-CGR'>JOXO4WXV-N[%S1[Y3_5VD_FYLW(V=._*=ZN\B]7=CXV[LW)'O5'\7
+MJ;^#9T>^4_U=I/X.YLAWJK^+U-_!'/E.]7>1^KO+.3K_+E1_%ZF_V[2Y39\C
+MWZG^+E)_MVG<;1;NZ/R[4/U=I/YNT[C;+-S1^7>A^KM(_=VF<;=9N*/S[T+U
+M=Y'Z.WAVY#O5WT7J[V".?*?ZNTC]'<R1[U1_%ZF_@SGRG>KO(O5WVS:W[7/D
+M.]7?1>KOMHV[;>>.?*?ZNTC]W;9QM^W<D>]4?Q>IO]LV[K:=._*=ZN\B]7?P
+M[,AWJK^+U-_!'/E.]7>1^CN8(]^I_BY2?W<Y1^??A>KO(O5W4YN;^ASY3O5W
+MD?J[J7$W+=S1^7>A^KM(_=W4N)L6[NC\NU#]7:3^;FK<30MW=/Y=J/XN4G\'
+MSXY\I_J[2/T=S)'O5'\7J;^#.?*=ZN\B]7<P1[Y3_5VD_FYN<W.?(]^I_BY2
+M?S<W[N;.'?E.]7>1^KNY<3=W[LAWJK^+U-_-C;NY<T>^4_U=I/X.GAWY3O5W
+MD?H[F"/?J?XN4G\'<^0[U=]%ZN\NY^C\NU#]7:3^[D.;^]#GR'>JOXO4WWUH
+MW'U8N*/S[T+U=Y'ZNP^-NP\+=W3^7:C^+E)_]Z%Q]V'ACLZ_"]7?1>KOX-F1
+M[U1_%ZF_@SGRG>KO(O5W,$>^4_U=I/X.YLAWJK^+U-]];',?^QSY3O5WD?J[
+MCXV[CYT[\IWJ[R+U=Q\;=Q\[=^0[U=]%ZN\^-NX^=N[(=ZJ_B]3?P;,CWZG^
+M+E)_!W/D.]7?1>KO8(Y\I_J[2/W=Y1R=?Q>JOXO4WWUJ<Y_Z'/E.]7>1^KM/
+MC;M/"W=T_EVH_BY2?_>I<?=IX8[.OPO5WT7J[SXU[CXMW-'Y=Z'ZNTC]'3P[
+M\IWJ[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?P1SY3O5WD?J[SVWN<Y\CWZG^+E)_
+M][EQ][ES1[Y3_5VD_NYSX^YSYXY\I_J[2/W=Y\;=Y\X=^4[U=Y'Z.WAVY#O5
+MWT7J[V".?*?ZNTC]'<R1[U1_%ZF_NYRC\^]"]7>1^KOK-G?=Y\AWJK^+U-]=
+M-^ZN%^[H_+M0_5VD_NZZ<7>]<$?GWX7J[R+U=]>-N^N%.SK_+E1_%ZF_@V='
+MOE/]7:3^#N;(=ZJ_B]3?P1SY3O5WD?H[F"/?J?XN4G]WT^9N^ASY3O5WD?J[
+MF\;=3>>.?*?ZNTC]W4WC[J9S1[Y3_5VD_NZF<7?3N2/?J?XN4G\'SXY\I_J[
+M2/T=S)'O5'\7J;^#.?*=ZN\B]7<7<\,:KAKN?@`O/.#N+NC]TN?`=X/J[[Z_
+M\("[+XV[+^ME#GPWJ/YN2/W=EW9[7[XN<^"[0?5W0^KOOC3NOORYS('O!M7?
+M#:F_@V='?]^V^BCZ"]_>I6_?_KBZ'1QO/]O!5^L=_%N_\.W?WCW\9QF\/9OG
+M;PR.XVIW.?C?[0V/MV?SS,/J,-#[:O8S_89OEC?\<X[^KO=_\OR&W_S\MO3%
+M]D_N<'OZS7<XW=[AN%T-XVK<K";_U3O\WW__GW2'/^=^VT?R<PYT\'#N[H:7
+MWSHOYF[NS?W0P?G>K[P/V^I@_0]^]W]\;^[ZW;W?PB?209_[(<X3O2#?[&_6
+MP71QY.3]S_GV+.=8K>_^UXT_'%P^WU6_/TK\'[S=O[B_U>7;O?TCQO;AK[=[
+M<UZ\W=7#N=L_8MS[/!]\A,73N[Z\._HK[O_)AW%Q<.(O?N7^&'GXE?MSSG^O
+J".9;L_SX[70'_]8O?/OZ[N$_/P>'-OC;GN#P'9?U^H__!PSBQAVCJ```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu
new file mode 100644
index 0000000..be431e6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.qcow2.gz
+M'XL("&/N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G%C;W<R+F]U=`"MF-MR
+MTS`00-_S%>(.!8*U*_G")2F%,L,;/`#/B9M\189O)XH42U[O6FU0XO$TH^Z9
+ME?9H(Z>J_$LIJY6IE>G4?JN.G\,%*ODPOM3AY[?OR_1U6'B8KH0H9J#9#;@1
+MZV_$@82K]'1`\[@D.V1P<(Z:@G(X(V8W-\#@KA:GI3L5HR41>`G0X\1B7)0?
+M^/QHA+DP/RB='_+K9\]Q=*">SP]]?C2JD7!M%@=,5"?A-ED<,E%;"==G<8:)
+MNI-PPLY-<):)V@LXG5'EB*N9*"WA((MKF"B4<":+:YDHR3N=]ZYCHB3O=-Z[
+M#1,E>:?SWFV9*,D[G?>N9Z(D[W3>NSLF2O(.!.]4Q.V8*,D[(-X]"KC'$;=G
+MHB3O@'CW).">#CC-14G>`?'N6<`]CSBFWX'D'1#O7@3<RXAC^AU(W@'Q[E7`
+M744<T^]`\@Z(=Z\#[DW$,?T.).^`>/=VXIUF^AU(WB'Q[EU@51'']#N4O$/B
+MG0XXB#BFWZ'D'1+O,.!,Q#']#B7OD'AG`ZZ..*;?H>0=$N^:@&LCCNEW*'F'
+MQ+LNX-Y''-/O4/(.B7<?`NYCQ#']#B7OD'CW*>!6$<?T.Y2\,\2[=<!=1QS3
+M[XSDG2'>?0ZXFXAC^IV1O#/$NR\!]W7``1<U>%=5_!5PMY,]"V7/GR:>CS5S
+MEP=F@.U#@',9>EQ7=,+63]AIL&'N\L#A9CE^#\"3,`\`6JLV4^`O/V'KA>F,
+MZ@TWK[!/M#SA=;I^MK0PUI6DZ/H!^X3V'QDVN\(9MOX'A\;M6UNK%NZ;X9_;
+MWU.EC[AB)?$X^0>','!.>&BR$]PZP;DSRS[YSU0VU>O8X-._$]QJ&9O]$3?[
+M@X-[BMIQ`^)D;5E9VJ%=G:^TSN[P[IZQSM_?Y/`]U%?%_)AV!:/ISN2GIM-U
+MYX+A^9W4P^$@,UTUQKES05K/40DSJ[>:9M<7+H:F.^.>.]=!QCO7XZ!L(^A.
+CG>5HH.OBD[L\</BQ'+\]T`1@L14TM?MV6_P#%UJW"245````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu
new file mode 100644
index 0000000..3e69394
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.raw.gz
+M'XL("&3N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G)A=RYO=70`K91-CX,@
+M$(;O_HKWO`<#(U2]M$F3WO>RNV=K]%?XXY<O+2-^M`F@B!EX\@XSC!"^`8H@
+MNHUQWS#=2]ZGXJMP-#E^!M0:70K\,4"'(ZNO5>@5S&SUH!K=3":&J0SM%KXS
+M3AIC"@J[=@T+KEQPP5V5^?Q('`KY7&$]9%;8.(6ZAM+0%S3TKL*_Q^]*H<=E
+M"XG'T1EN%AR29P-WBW"5,8[1RCC9T$M40_B)YQ'NZM\9IX[4F9,0PY9AUUF=
+M-UD:T_F^.,Z0`V0%T00;<>`27[STM:D,8NX>Z$/J;F=Q-5\O(QR=N`N.>UI<
+M%$\6PI/3NZ;J^LS!D.N;\>;-M1!^<SV.\A:"UE46DX&VBB?COF'Z+GGW0!6`
+0V4[05CXABG]2`B^9YP8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu
new file mode 100644
index 0000000..662d2c3
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.vhd.gz
+M'XL("$8UQ%4``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G9H9"YO=70`K9?/;Z0@
+M%,?O\U>\9&\]&'@".I=.TJ3WO>SVC%:;2=-VL^VA!__XY0DHB#J=+J-C,/`^
+M?M\/(#!F?P"J!-6#ZD!):E<"U!&J&L!TNAO')W>O,+1OKUW[<?XLW&\X6!AG
+MH55L3O98@C`?J0`U?40]4AL&CRE^W#_=G%^>/`X=#AU(5F15(J@F^4[?`!-6
+M'9$>SOB\5%>FZF8K^YV^A[(/1I2ANJ(XA3AAK,QXNB4T:HR/OZ.7J"/$1>HD
+M6U@%,M>"RF9GUW!JS^H:W,W!Y<*6BBF,RCP9*`X54MN4C8]#<IM2^7S_H_^^
+M=PM]N%$J:M+'D[YZVUUTI8)38JT"0:6]YRZ,E+<E;J54_BMZ*K83KF&"P*3O
+MP-'].'HS"D)]BK.=F&\G8U.?)GW"S#.]\MSN&.Z*^)J`37\=4$K0*?"7=[@E
+M?4<!K5B+NYNR2<7,#I_B_+8;U??M_':9XX=Z5\CU"NLZL\)Z5&A69+.@2P4U
+M?E7AP_WOE1E<ZVPIL3B\A/."P_4^QIT"7&DGW$P)B@U:#F7G7L)V@+NU?X\3
+M>^IH5>C6.C:=E9F+1=<+NS#/P#O@)2W';%JW`N"47YCU'5,9&+F[HP]2=S7A
+MJG@\#W!XP5V(<8W;>?W(*(47HG>;JFLS)Z-9SHPOSER"Q#/7XC#O0J#'E<54
+M(*WBR7.[8_A9Q)<%HMN,LNUNZ':/;`J%`V93*-S^D5&A;G>+[=HJ5-(F)=-1
+I@7`9CPJ$RWA4(%S&HP+A,AX5")?QJ$"XK$<%`S2U=_@'6B6GGU\.````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu
new file mode 100644
index 0000000..dd1a665
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.vhdf.gz
+M'XL(",`EAE4``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G9H9&8N;W5T`*V5.V^#
+M,!#']WR*D[IE0/;Y`2Q!JI2]2YN9$(BBJNW2H0,?OGY2VT`>E3$A)H=_^=_#
+M!R'V`.`(I%VXKAO&YR(>XV:[,30Z/`84`MHY\%4!#0ZUOII#QT'-DA/88&9T
+M9A@+=S3NV^.H,LY!;M6J8<(5$\ZYRS/'#\E5(8\K+/O,"BNC4)3`!0@)%=ZK
+M\+!_2Q1:7+:46!S>PGG!KG@6<$V`8\HX!$^&Q08=!=:[FW`>X';VXW'\FCH5
+M"=(O&5:=%7F+I5(C7A?F&6@/E`&IG`UCX)1?^--7SV5@Y.X5?3!WM]6X,GZ>
+M!CB\X2[$N*/&!?F,4G@C>KNYNBYS,FBZ,^[<N1H2[UR+P[R-H#:=156@[N*S
+MZ[IA?"GB88'<`7-%D/JWFV0@!Y`]2*'G)0=90UF%0(PK:>R^/OON^_(39-C@
+MJ&T&BZ=>CTSO%ED"MOI/Y$G/`WU/^_/V\G'V.-^J?$=2FTVM8@CRF+A+4W</
+M%WQ/U;$T2#2)'FJ=8=M3OT31:T(<GYSM!SB>#,Z?T4UD6&I5!B=(LNJ_N;4X
+0F;E4U(MW\PM:UWFK$@D`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu
new file mode 100644
index 0000000..c3521af
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-pc98.vmdk.gz
+M'XL("&7N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G9M9&LN;W5T`*U<78_<
+MQA%\]Z\8G-_RL&`MOY8/LA-'#A`$`8S8L5]#+LGX$%L23H<@`O;'AT-.S16Y
+MI$C[^K0GL,7NVNZ>W;Y3=6&39/IR+FM<EKFL=7GA$KCAGZ:'2](78WAD\<;M
+M;V___N.)7W\\G6Y?3&#P41*"1.'$F#W/[;3X(MSY<U&S&\/CO`N7^JCF+C#`
+MG3=N;,(-_7#GM1!F5X^W6W\A<"X"N1E<OE+39K&?R^X/7X3F^?Q2G\-PO$7E
+MRM0533!=D8]VZLKS>"]QY>#4#X!?NK>/'__CWG8?KT^/'Y[?A_S._FP'YZSP
+M_L75(PR%E86_\#<\7.4ABLZEK4OA;[O;TU\>?^E._^V>/CZ^?_<&+/?LSS9+
+M75;Y=+Q_\O*8&?Y)$E?`/X>[_?FO;]^$5VYR^E`_$<Y'#8D,SSW4H;A%X?SW
+M_6/,KGOW[!'[\!6S\V<;FI./SYWYBSQS9>7&='*/?1YNMZ'DL7?7IZY^[G[X
+M]*%[\_#K^W>Q=_YL?<NJ$>@R-BIU>>JA0FF^?;E']"^;\=3<[9?'YY\?K]\/
+M97[L'DY?.L(5OG?#`5Y"7E/50TBQ>;)#VK=O__<\U.O:<+*/A!N3&(L8GCL_
+MN[ST6,,!ID/OTM2E%Y>.\$/"0R49O).[O7]W^L=/#D5ZR=SWW_WI'X2[#'"#
+MYY#@$#(4-*LIG^K/ER]+=_O^6_?@B_SAYVY\!1*NFMYFWGDZ!XSFV5^$KDWP
+M?HAE_L9XLNYM_5R[;^J/W>G+MV^_B2=;^V*S\3&DUGF48H+VK^^QG4/CII.>
+M#GH\BK9M3G5;?WCNGOSQQJ-H_*NU#97Z8\U>CG'^/.5X4KU_Q;C;&_?PV`YG
+MZF'_W;W_E7#7Z64\Y.%?$M48F/J+X=4SPG?A&:97C#\F#]<]/WTZ73_]\OBN
+M'=YH[@WAVJEW0SK#:4Y)Q9R62<6G'7KW@)?4!FS"=;Y%4U*7\,88L*8\7KJ0
+M#H_</T(7;I]./W=U.Z3E'LYY_A"/HE\>A;9HT87IH(=>3$<1$OMT^MA=`UR:
+MA`/L9\V9<O(OY>&5/&4T'Z#/[Y_&U(KT0>=QNOQ9]MIYG-W]2"U_)^`$9YU?
+MD>S]/.,CG0$Z`4M>\BM\?IEXYAI5B%'.X(;?)D[?#=__&KX_")Q_B5W$L]*H
+M6HSF2/<*__/B*IZM1G5B](?@LM`B_H("N1Z;2B/5&Q'.+7J7A][1,]>H0HQR
+M!K?5NR+TCIZ51M5B-*O9+8LM0^_HV6I4)T9_".X2>L=?P"#78^]HI,G:;WG+
+MWE6A=_3,-:H0HYS!;?6N#KVC9Z51M1C-:G;+8IO0.WJV&M6)T1^"NX;><:Q`
+MKL?>T4CUQF;OVM`[>N8:58A1SN"V>M>%WM&STJA:C&8UNV6Q?>@=/5N-ZL3H
+MC\"52>A=)KWC]=@[&JG>V.I=R7E'SURC"C'*&=Q&[TK..WI6&E6+T:QFMRR6
+M\XZ>K49U8O2'X#CO<ND=K\?>T4CUQF;O.._HF6M4(48Y@]OJ'><=/2N-JL5H
+M5K-;%LMY1\]6HSHQ^D-PG'>%]([78^]HI'ICLW><=_3,-:H0HYS!;?6.\XZ>
+ME4;58C2KV2V+Y;RC9ZM1G1C](3C.._[J!+D>>T<CU1N;O>.\HV>N4848Y0QN
+MJW><=_2L-*H6HUG-;EDLYQT]6XWJQ.B/P%V2T+N+]([78^]HI'ICJW<7SCMZ
+MYAI5B%'.X#9Z=^&\HV>E4;48S6IVRV(Y[^C9:E0G1G\(CO.NDM[Q>NP=C51O
+M;/:.\XZ>N4858I0SN*W><=[1L]*H6HQF-;MEL9QW]&PUJA.C/P3'><?_>$&N
+MQ][12/7&9N\X[^B9:U0A1CF#V^H=YQT]*XVJQ6A6LUL6RWE'SU:C.C'Z0W"<
+M=V0M(==C[VBD>F.S=YQW],PUJA"CG,%M]8[SCIZ51M5B-*O9+8OEO*-GJU&=
+M&/T1N"H)O;M*[W@]]HY&JC>V>E=QWM$SUZA"C'(&M]&[BO..GI5&U6(TJ]DM
+MB^6\HV>K49T8_2$XSKM6>L=KLMJQ=^T=W+)WG'?TS#6J$*.<P6WUCO..GI5&
+MU6(TJ]DMB^6\HV>K49T8_2$XSKM.>L?KL7<T4KVQV3O..WKF&E6(4<[@MGK'
+M>4?/2J-J,9K5[);%<M[1L]6H3HS^$!SG72^]X_78.QJIWMCL'><=/7.-*L0H
+M9W!;O>.\HV>E4;48S6IVRV(Y[^C9:E0G1G\$KDZFWL6=&^3:]RX:J=[8ZET=
+MYEWTS#6J$*.<P6WTK@[S+GI6&E6+T:QFMRPVS+OHV6I4)T9_""[,.PA_!^7O
+M(/P==OF[.LP["'\'Y>\@_!UV^;LZS#L(?P?E[R#\W4IVRV+#O(/P=U#^#L+?
+M'8`+\P["WT'Y.PA_AUW^K@[S#L+?0?D["'^'7?ZN#O,.PM]!^3L(?[>2W;+8
+M,.\@_!V4OX/P=P?@PKR#\'=0_@["WV&7OZO#O(/P=U#^#L+?89>_J\.\@_!W
+M4/X.PM^M9+<L-LP["'\'Y>\@_-T^7).$W@E_!^7O(/P==OF[AO-.^#LH?P?A
+M[[#+WS6<=\+?0?D["'^WDMVR6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[QK.
+M.^'OH/P=A+_#+G_7<-X)?P?E[R#\W4IVRV(Y[X2_@_)W$/[N`!SGG?!W4/X.
+MPM]AE[]K..^$OX/R=Q#^#KO\7<-Y)_P=E+^#\'<KV2V+Y;P3_@[*WT'XNP-P
+MG'?"WT'Y.PA_AUW^KN&\$_X.RM]!^#OL\G<-YYWP=U#^#L+?K62W+);S3O@[
+M*'\'X>_VX:Y)Z)WP=U#^#L+?89>_NW+>"7\'Y>\@_!UV^;LKYYWP=U#^#L+?
+MK62W+);S3O@[*'\'X>\.P''>"7\'Y>\@_!UV^;LKYYWP=U#^#L+?89>_NW+>
+M"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^[@`<YYWP=U#^#L+?89>_NW+>"7\'Y>\@
+M_!UV^;LKYYWP=U#^#L+?K62W+);S3O@[*'\'X>\.P''>"7\'Y>\@_!UV^;LK
+MYYWP=U#^#L+?89>_NW+>"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^;A^N34+OA+^#
+M\G<0_@Z[_%W+>2?\'92_@_!WV.7O6LX[X>^@_!V$OUO);EDLYYWP=U#^#L+?
+M'8#CO!/^#LK?0?@[[/)W+>>=\'=0_@["WV&7OVLY[X2_@_)W$/YN);MEL9QW
+MPM]!^3L(?W<`CO-.^#LH?P?A[[#+W[6<=\+?0?D["'^'7?ZNY;P3_@[*WT'X
+MNY7LEL5RW@E_!^7O(/S=`3C..^'OH/P=A+_#+G_7<MX)?P?E[R#\'7;YNY;S
+M3O@[*'\'X>]6LEL6RWDG_!V4OX/P=_MP73+U+DKP(->CC)%&JC=N8].&;S=\
+M)^X%+LR[547?RC_%WKGU[.ZT^,?@[HN=Y(88Y89Q$S&5^_L`)SAC.20NH>O[
+M@$?DD(CK<CY>)8=$7)?S\2HY).*ZG(]7R2$1U^4F<DC$=;F)'!)Q76XBAT1<
+MEYO((1'7Y29R2,1UN8D<$G%=;B*'1%R7F\@A$=?E)G)(Q'6YB1P2<5UN(H=$
+M7)>;R"$1U^4F<DC$=;F)'!)Q76XBAT1<EYO((1'7Y29R2,1UN8D<$G%=;B*'
+M1%R7F\@A$=?E)G)(Q'6YB1P2<5UN(H=$7)>;R"$1U^4F<DC$=;F)'!)Q76XB
+MAT1<EYO((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<
+M$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P2
+M7)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<
+ME]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7
+MV\@A$=?ER4OO?K\<$G%=3L]7R2$1U^7T?)4<$G%=3L]7R2$1U^4F<DC$=;F)
+M'!)Q76XBAT1<EYO((1'7Y29R2,1UN8D<$G%=;B*'1%R7F\@A$=?E)G)(Q'6Y
+MB1P2<5UN(H=$7)>;R"$1U^4F<DC$=;F)'!)Q76XBAT1<EYO((1'7Y29R2,1U
+MN8D<$G%=;B*'1%R7F\@A$=?E)G)(Q'6YB1P2<5UN(H=$7)>;R"$1U^4F<DC$
+M=;F)'!)Q76XBAT1<EYO((<%UN8T<$ER7V\@AT9G*(=&9RB'1F<HAT9G*(=&9
+MRB'1F<HAT9G*(=&9RB'1F<HAT9G*(=&9RB'1F<HAT9G*(=&9RB'1)XFA'!*]
+MJ1P2O:D<$KVI'!*]J1P2O:D<$KVI'!*]J1P2O:D<$KVI'!*]J1P2O:D<$KVI
+M'!*]J1P2O:D<$KVI'/*<)(FA'/*<F,HAS_<?37P,[K[826Z8C>5.GUUZ__?V
+MC=LWI_F?"(C^MP'FN:OO`?\9"L[&3Q.N,G?-UNI*I^/$=L%?S_J7G8WEFEEF
+MW+\B^6PBOSW#LC/.\#)FF)?^@W;SPEW.1S/\Z=L?%QE.<&9',L'MOD,B#]IO
+MP7TM</XW@EX\9Y\%?H5+.8WU6N"^FKX)EWTN.UU1'2O6^,.[+\EE$:?G['_R
+M>$*0_\\[SP'C^;J7_*K[-,ZS<C^3G[LOU__4U8^OU?.8#>J-<MT<SO_4U?.<
+M'>%.][ZZS^YJ?!A8OC,.OG,]R/R=.\&=;0=!-4Z62?=Q__?VC=MWI_F?"3`+
+3@&8=S/Q'DR1?_!^)[K:L<6``````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow.gz.uu
new file mode 100644
index 0000000..50e4d02
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.qcow.gz
+M'XL(",PS(E0``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YQ8V]W+F]U=`"MG<EN
+M'%<21??^BM(L49)5$?%RTDAT-PSTH@$W^@><0]4ZT:M>^..;DMX@1MZK\"03
+M!@4Z+XI/AT>R??!X/G_]<3IU<DK]*4VGZW*Z^WE^D],W/[G_=OKUWS_]\\=O
+M?_SZP]<Q.7_GJ7L_E],PGJ8\=V_K?VU./S^UGLY3./?E3=#<-Z_.?O.KN_?)
+M'N=N?OCZR>+G]+<-GMSKD]]Q>E_>#+Z^<YU3^%1B<]V]N=L\]W.=^XM/3\GI
+M];]M\!=W>OI[3R]Z?799X7,#&QSO#>[N]=EE@T]-;&[^+LQVN<"G%C:W!G-7
+M^-3&YB[?G[OBIZYX3K[SB_%U#OW:2OEZ/WY`X=RISJ&O#"E?3\</I'MSYSQW
+M6^?05X:4KZ?C!_I[<S__6(`N<PD^1;B3B+MK!Y\BW$G$W;6'3Q'N).+N.L"G
+M"'<2<C?"IPAW&G(WP:<(=QIR-\.G"'<:<K?`IPAW&G*'?*>,.PVY0[Y3QIV&
+MW"'?*>-.0^Z0[Y1QIP%W"?Y>IHP["[A+\/<R8]Q9P%V"?Q(PQIT%W"7X)P%C
+MW%G`73HCWQGCS@+NTAGYSAAW%G"7SLAWQKBS@+MT1KXSQIV%W"'?&>,NA=PA
+MWR7&70JY0[Y+C+L4<H=\EQAW*>0.^2XQ[E+('?)=8MRED#ODN\2X2R%WR'>)
+M<9<B[@0_1;CK(NX$^:YCW'41=X)\US'NNH@[0;[K&'==Q)T@WW6,NR[B3I#O
+M.L9=%W$GR'<=XZZ+N!/DNXYQUX7<(=]UC+L^Y`[YKF?<]2%WR'<]XZX/N4.^
+MZQEW?<@=\EW/N.M#[I#O>L9='W*'?-<S[OJ0.^2[GG'71]PI?HIP-T3<*?+=
+MP+@;(NX4^6Y@W`T1=XI\-S#NAH@[1;X;&'=#Q)TBWPV,NR'B3I'O!L;=$'&G
+MR'<#XVX(N4.^&QAW8\@=\MW(N!M#[I#O1L;=&'*'?#<R[L:0.^2[D7$WAMPA
+MWXV,NS'D#OEN9-R-(7?(=R/C;HRX,_P4X:[\YWD^AWPW,>ZFB#M#OIL8=U/$
+MG2'?38R[*>+.D.\FQMT4<6?(=Q/C;HJX,^2[B7$W1=P9\MW$N)M"[I#O)L;=
+M''*'?#<S[N:0.^2[F7$WA]PAW\V,NSGD#OEN9MS-(7?(=S/C;@ZY0[Z;&7=S
+MR!WRW<RXFR/N$GZ*<%?^-RF?0[Y;&'=+Q%U"OEL8=TO$74*^6QAW2\1=0KY;
+M&'=+Q%U"OEL8=TO$74*^6QAW2\1=0KY;&'=+R!WRW<*X6T/ND.]6QMT:<H=\
+MMS+NUI`[Y+N5<;>&W"'?K8R[->0.^6YEW*TA=\AW*^-N#;E#OEL9=VO$78>?
+M(MQM$7<=\MW&N-LB[CKDNXUQMT7<=<AW&^-NB[CKD.\VQMT6<=<AWVV,NRWB
+MKD.^VQAW6\1=AWRW,>ZVD#ODNXUQ=PFY0[Z[,.XN(7?(=Q?&W27D#OGNPKB[
+MA-PAWUT8=Y>0.^2["^/N$G*'?'=AW%U"[I#O+HR[2\1=CY\BW%TC[GKDNROC
+M[AIQUR/?71EWUXB['OGNRKB[1MSUR'=7QMTUXJY'OKLR[JX1=SWRW95Q=XVX
+MZY'OKHR[:\@=\MV5<"?E'3X'?"=GPIV<0^Z`[^1,N)-SR!WPG9P)=W(.N0.^
+M$];?2=3?I1[X3EA_)U%_EWK@.V']G43]7>J![X3U=Q+U=W?_E@*?(MQ%_5T:
+M@.^$]7<2]7=I`+X3UM])U-^E`?A.6'\G47^7!N`[8?V=1/U=&H#OA/5W$O5W
+M:0"^$];?2=3?I0'X3EA_)U%_EP;@.V']G43]71J0[UA_)U%_EP;D.];?2=3?
+MI0'YCO5W$O5W:4"^8_V=1/U=&I#O6'\G47^7!N0[UM])U-^E`?F.]7<2]G<C
+M?HIP%_9W(_(=Z^\D[.]&Y#O6WTG8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["
+M_FY$OF/]G83]W8A\Q_H["?N[$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?C<AW
+MK+^3L+\;D>]8?R=A?S<BW['^3L+^;D2^8_V=A/W=B'S'^CL)^[L)/T6X"_N[
+M"?F.]7<2]G<3\AWK[R3L[R;D.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^
+M3L+^;D*^8_V=A/W=A'S'^CL)^[L)^8[U=Q+V=Q/R'>OO).SO)N0[UM])V-]-
+MR'>LOY.POYN0[UA_)V%_-R'?L?Y.POYN0KYC_9V$_=V,GR+<A?W=C'S'^CL)
+M^[L9^8[U=Q+V=S/R'>OO).SO9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?
+ML?Y.POYN1KYC_9V$_=V,?,?Z.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8
+MW\W(=ZR_D["_FY'O6'\G87\W(]^Q_D["_F[!3Q'NPOYN0;YC_9V$_=V"?,?Z
+M.PG[NP7YCO5W$O9W"_(=Z^\D[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W
+M(-^Q_D["_FY!OF/]G83]W8)\Q_H["?N[!?F.]7<2]G<+\AWK[R3L[Q;D.];?
+M2=C?+<AWK+^3L+];D.]8?R=A?[?BIPAW87^W(M^Q_D["_FY%OF/]G83]W8I\
+MQ_H["?N[%?F.]7<2]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A
+M?[<BW['^3L+^;D6^8_V=A/W=BGS'^CL)^[L5^8[U=Q+V=ROR'>OO).SO5N0[
+MUM])V-^MR'>LOY.PO]OP4X2[L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=
+MAGS'^CL)^[L-^8[U=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_
+M)V%_MR'?L?Y.POYN0[YC_9V$_=V&?,?Z.PG[NPWYCO5W$O9W&_(=Z^\D[.\V
+MY#O6WTG8WUWP4X2[L+^[(-^Q_D["_NZ"?,?Z.PG[NPOR'>OO).SO+LAWK+^3
+ML+^[(-^Q_D["_NZ"?,?Z.PG[NPOR'>OO).SO+LAWK+_3\HZ;.[4YX+N[IS!W
+MZOJ[<M_?J7$'?*>LOU/7WYTR=Z?&'?"=LOY.77]WRMR=&G?`=\KZ.W7]W6D_
+MG!WPG;+^3EU_5\^NS0'?*>OOU/5W8`[X3EE_IZZ_.\ZA^^^4]7?J^KLR]Z#-
+M`=\IZ^_4]7</RESE#MU_IZR_4]??/<C</:C<H?OOE/5WZOJ[!YF[!Y4[=/^=
+MLOY.77_W8#^<'?"=LOY.77]7SZ[-`=\IZ^_4]7=@#OA.67^GKK\#<\!WROH[
+M=?U=F7O8YI#O6'^GKK][6.8:=\AWK+]3U]\]S-P];-PAW['^3EU_]S!S][!Q
+MAWS'^CMU_=W#_7!VR'>LOU/7W]6S:W/(=ZR_4]??@3GD.];?J>OO#G/=&3]%
+MN'/]79E[U.:0[UA_IZZ_>U3F3G4.^8[U=^KZNT>9NT>W=0[YCO5WZOJ[1YF[
+M1[_4.>0[UM^IZ^\>[8>S0[YC_9VZ_JZ>79M#OF/]G;K^#LPAW['^3EU_!^:0
+M[UA_IZZ_*W./VQSR'>OOU/5WC\M<XP[YCO5WZOJ[QYF[QXT[Y#O6WZGK[QYG
+M[AXW[I#O6'^GKK][O!_.#OF.]7?J^KMZ=FT.^8[U=^KZ.S"'?,?Z.W7]W7$.
+MW7^GK+]3U]^5N2=M#OF.]7?J^KLG9:YRA^Z_4];?J>OOGF3NGE3NT/UWROH[
+M=?W=D\S=D\H=NO].67^GKK][LA_.#OF.]7?J^KMZ=FT.^8[U=^KZ.S"'?,?Z
+M.W7]'9A#OF/]G;K^KLP];7/(=ZR_4]??/2USC3OD.];?J>OOGF;NGC;ND.]8
+M?Z>NOWN:N7O:N$.^8_V=NO[NZ7XX.^0[UM^IZ^_JV;4YY#O6WZGK[\`<\AWK
+M[]3U=\<Y=/^=LOY.77]7YIZU.>0[UM^IZ^^>E;G*';K_3EE_IZZ_>Y:Y>U:Y
+M0_??*>OOU/5WSS)WSRIWZ/X[9?V=NO[NV7XX.^0[UM^IZ^_JV;4YY#O6WZGK
+M[\`<\AWK[]3U=V`.^8[U=^KZNS+WO,TAW['^3EU_][S,->Z0[UA_IZZ_>YZY
+M>]ZX0[YC_9VZ_NYYYNYYXP[YCO5WZOJ[Y_OA[)#O6'^GKK^K9]?FD.]8?Z>N
+MOP-SR'>LOU/7WQWGT/UWROH[=?U=F7O1YI#O6'^GKK][4>8J=^C^.V7]G;K^
+M[D7F[D7E#MU_IZR_4]??O<C<O:C<H?OOE/5WZOJ[%_OA[)#O6'^GKK^K9]?F
+MD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[\K<39M#OF/]G;K^[J;,->Z0[UA_
+MIZZ_N\G<W33ND.]8?Z>NO[O)W-TT[I#O6'^GKK^[V0]GAWS'^CMU_5T]NS:'
+M?,?Z.W7]'9A#OF/]G;K^[CB'[K]3UM^IZ^_*W,LVAWS'^CMU_=W+,E>Y0_??
+M*>OOU/5W+S-W+RMWZ/X[9?V=NO[N9>;N9>4.W7^GK+]3U]^]W`]GAWS'^CMU
+M_5T]NS:'?,?Z.W7]'9A#OF/]G;K^#LPAW['^3EU_5^9>M3GD.];?J>OO7I6Y
+MQAWR'>OOU/5WKS)WKQIWR'>LOU/7W[W*W+UJW"'?L?Y.77_W:C^<'?(=Z^_4
+M]7?U[-H<\AWK[]3U=V`.^8[U=^KZN^,<NO].67^GKK\K<Z_;'/(=Z^_4]7>O
+MRUSE#MU_IZR_4]??O<[<O:[<H?OOE/5WZOJ[UYF[UY4[=/^=LOY.77_W>C^<
+M'?(=Z^_4]7?U[-H<\AWK[]3U=V`.^8[U=^KZ.S"'?,?Z.W7]79G[L<TAW['^
+M3J/^KD/WWRGK[S3J[SIT_YVR_DZC_JY#]]\IZ^\TZN\Z=/^=LOY.H_ZN0_??
+M*>OO-.KO.G3_G;+^3J/^KD/WWRGK[Y3T=V_:'/(=Z^_4]7=ORESE#MU_IZR_
+M4]??O<G<O:G<H?OOE/5WZOJ[-YF[-Y4[=/^=LOY.77_W9C^<'?(=Z^_4]7?U
+M[-H<\AWK[]3U=V`.^8[U=^KZ.S"'?,?Z.ROON+ESFP.^,];?W7W@'G?%3^?&
+M'?"=L?[.7']WSGOGQAWPG;'^SEQ_=\[<G1MWP'?&^CMS_=UY/YP=\)VQ_LY<
+M?U?/KLT!WQGK[\SU=V`.^,Y8?V>NOSO.H?OOC/5WYOJ[,B=M#OC.6']GKK^3
+M,E>Y0_??&>OOS/5WDE^>5.[0_7?&^CMS_9UD[J1RA^Z_,];?F>OO9#^<'?"=
+ML?[.7']7SZ[-`=\9Z^_,]7=@#OC.6']GKK\#<\!WQOH[<_U=F=,VAWS'^CMS
+M_9V6N<8=\AWK[\SU=YJYT\8=\AWK[\SU=YJYT\8=\AWK[\SU=[H?S@[YCO5W
+MYOJ[>G9M#OF.]7?F^CLPAWS'^CMS_=UQ#MU_9ZR_,]??E3EK<\AWK+\SU]]9
+MF:O<H?OOC/5WYOH[R]Q9Y0[=?V>LOS/7WUGFSBIWZ/X[8_V=N?[.]L/9(=^Q
+M_LY<?U?/KLTAW['^SEQ_!^:0[UA_9ZZ_`W/(=ZR_,]??E;G4YI#O6']GKK]+
+M9:YQAWS'^CMS_5W*W*7&'?(=Z^_,]7<I<Y<:=\AWK+\SU]^E_7!VR'>LOS/7
+MW]6S:W/(=ZR_,]??@3GD.];?F>OOCG/H_CMC_9VY_J[,=6T.^8[U=^;ZNZ[,
+M5>[0_7?&^CMS_5V7N>LJ=^C^.V/]G;G^KLO<=94[=/^=L?[.7'_7[8>S0[YC
+M_9VY_JZ>79M#OF/]G;G^#LPAW['^SEQ_!^:0[UA_9ZZ_*W-]FT.^8_V=N?ZN
+M+W.-.^0[UM^9Z^_ZS%W?N$.^8_V=N?ZNS]SUC3OD.];?F>OO^OUP=LAWK+\S
+MU]_5LVMSR'>LOS/7WX$YY#O6WYGK[XYSZ/X[8_V=N?ZNS`UM#OF.]7?F^KNA
+MS%7NT/UWQOH[<_W=D+D;*G?H_CMC_9VY_F[(W`V5.W3_G;'^SEQ_-^R'LT.^
+M8_V=N?ZNGEV;0[YC_9VY_@[,(=^Q_LY<?P?FD.]8?V>NORMS8YM#OF/]G;G^
+M;BQSC3OD.];?F>OOQLS=V+A#OF/]G;G^;LS<C8T[Y#O6WYGK[\;]<';(=ZR_
+M,]??U;-K<\AWK+\SU]^!.>0[UM^9Z^^.<^C^.V/]G;G^KLQ-;0[YCO5WYOJ[
+MJ<Q5[M#]=\;Z.W/]W92YFRIWZ/X[8_V=N?YNRMQ-E3MT_YVQ_LY<?S?MA[-#
+MOF/]G;G^KIY=FT.^8_V=N?X.S"'?L?[.7'\'YI#O6']GKK\K<V_;'/(=Z^_,
+M]7=ORUSC#OF.]7?F^KNWF;NWC3OD.];?F>OOWF;NWC;ND.]8?V>NOWN['\X.
+M^8[U=^;ZNWIV;0[YCO5WYOH[,(=\Q_H[<_W=<0[=?V>LOS/7WY6Y=VT.^8[U
+M=^;ZNW=EKG*'[K\SUM^9Z^_>9>[>5>[0_7?&^CMS_=V[S-V[RAVZ_\Y8?V>N
+MOWNW'\X.^8[U=^;ZNWIV;0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?ZNS+UO
+M<\AWK+\SU]^]+W.-.^0[UM^9Z^_>9^[>-^Z0[UA_9ZZ_>Y^Y>]^X0[YC_9VY
+M_N[]?C@[Y#O6WYGK[^K9M3GD.];?F>OOP!SR'>OOS/5WQSET_YVQ_LY<?U?F
+M/K0YY#O6WYGK[SZ4N<H=NO_.6']GKK_[D+G[4+E#]]\9Z^_,]7<?,G<?*G?H
+M_CMC_9VY_N[#?C@[Y#O6WYGK[^K9M3GD.];?F>OOP!SR'>OOS/5W8`[YCO5W
+MYOJ[,O>QS2'?L?[.7'_WL<PU[I#O6']GKK_[F+G[V+A#OF/]G;G^[F/F[F/C
+M#OF.]7?F^KN/^^'LD.]8?V>NOZMGU^:0[UA_9ZZ_`W/(=ZR_,]??'>?0_7?&
+M^CMS_5V9^]3FD.]8?V>NO_M4YBIWZ/X[8_V=N?[N4^;N4^4.W7]GK+\SU]]]
+MRMQ]JMRA^^^,]7?F^KM/^^'LD.]8?V>NOZMGU^:0[UA_9ZZ_`W/(=ZR_,]??
+M@3GD.];?I?*.F[MM<\!WB?5WR?5WMV6N<0=\=_<4YBZY_NXV<W?;N`.^2ZR_
+M2ZZ_N\W<W3;N@.\2Z^_J6YD[],;H_KOV5##WS8]??[CY,MB?/W\X]:=!3WWW
+M^2WIJ;-32I_+CR\9Q08'?_KOY?*W__Q#[5_?OKX>W;GTYU[???;D^X/CZ3R=
+MS@H'O\Y]P]X4SGWO]7V=0]_K_4_,H>_U#N<^4W?W!YB[WS(N;NZ7;^;0]WK_
+M,[\8QZLYRA]3SO8'/MUZ-8>U?_CZY;>M.[N0.6ESG_Q<^W35/:6G]CQX=2?X
+MZMJ7VG+W;X5V_ZGO?K)_1W/H6]O_<530U1QX;IM/RQTG<KJN?`Y=S?%G4!F^
+F#'Z6Y@S^SC_PZ\\_WO_KZV#*@W_9*TQW7CF??_@_"8E_G;^F````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow2.gz.uu
new file mode 100644
index 0000000..32a7f31
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.qcow2.gz
+M'XL(",0[(U0``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YQ8V]W,BYO=70`K9C;
+M;M-`$(;O\Q3+J4"!DIW9=6Q.A1XB<8$$X@6(8_L!N$/*P[.Q-QE[/.--(J=6
+MI-3]/\VNO_ZUNUQV+V.\-2XSKC!-:<+G>(#I?1@>9O=K_?VF_]HM.IA=*JG1
+M"6M6Q1$W8/TC'&BX$!>^)>)ZTZ&`@T-J#$KAG#K=U`D!=[UHMZZ]&#E+X"7`
+M#J=>C(OF@VX^GG`7S@=SSX?R_OD+Y\/YY\-Z*L<'SU+S82.D5AHN3^&<E"HT
+MW":)LT*JU'#;)`Z$5*7AZB0.A52CX&Q2%>>$E-5PD,1Y(84:SB5QF9#R&B[I
+MG5L)*<T[F_8N%U*:=S;M72&D-.]LVKN-D-*\LVGO2B&E>0>*=X9P6R&E>0?,
+MNR<1]Y1PE9#2O`/FW;.(>TZX6DAIW@'S[D7$71%.Z#O0O`/FW<N(>W7$>2FE
+M>0?,N]<1=TTXH>]`\PZ8=V\B[BWAA+X#S3M@WKT;>>>%O@/-.V3>O8^L)>&$
+MOD/-.V3>V8@#P@E]AYIWR+S#B'.$$_H.->^0>><C+B.<T'>H>8?,NU7$Y803
+M^@XU[Y!Y5T3<!\()?8>:=\B\^QAQGP@G]!UJWB'S[G/$?2&<T'>H>>>8=[<1
+M]Y5P0M\YS3O'O/L6<7>$$_K.:=XYYMU]Q#T03N@[IWGGF'>/$;<F7#/K_:>C
+M^W<KO.LG)H#Y^4#UCV/`%;,NV'<+#AN]`I/Y_1&4\+B_DJ&3]@WC*A&X_EO7
+M=[\?`'_TYO-S/Q!XVK_E8(,48-[>CH.V?WZP?T42-S5?A]O,M=P.5YZ*"_4=
+M;NVKVM0UP_WIX;8S7PP[6FY]N//'"Y9K#\M%^N&F;;[0?PJN]\MVRW&T7&`I
+M^D>-E:8SXG35$5=NJ?-.V;U["3?Y9'O^WIW<?-7&E,$3:YJMCH/)(<Y6)<M;
+C8+AG"4_!XW?]Q.[GS?"K`[H(G&W"\(`67HO_;MD=L>$3````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.raw.gz.uu
new file mode 100644
index 0000000..941ae5b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.raw.gz
+M'XL("`;&'50``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YR87<N;W5T`*V206[#
+M(!!%]S[%7W=A,8!MO*J45ME5JM0+U#9P@*PY?$AP0HRQXT0>T`AIYC_-%\-8
+M"$#6:#CJZG(E1R4@)00'A']I^);DPAU/QAS^OKGX*:_AB@`C7YSWCZK%@BN3
+M<,7'"%03':T#%5@+QK/`@&NCJGV*6YLOX+J][`9<OQ57^ZRA#8Q)</\/N&'G
+MSZ"970,*#_&&7;K9%;'9VDL6=@E'$?>9XJ)=GJ@XHCXS';+3Z3NN'R#%5+5J
+M]BN',[NN"MFM.-VA]WM"L,,RCJ\.\>JJ-%I=@97OZC)YN>!^R^D)P'X$[C4A
+.-4K5C!5GC7NA2P,%````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhd.gz.uu
new file mode 100644
index 0000000..4b1226c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.vhd.gz
+M'XL("$DUQ%4``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YV:&0N;W5T`*V62V_D
+M(`S'[_,I+.VMAQ$QA"2G2GWL;:65]K#7DH14HZH/M3W,83[\VH$TD-=V6C(H
+M`H%_^=L8#T*X!T!+T!UH"SKG?J%`5U"4`#3I&_;OS`_AU#P_V>;]<-S[Y[1S
+ML$R$5K$YVZ,$11\I``U_1+?<A].`V?^XO;\X/-X/./0X]*"\8"N)H.O)=S(6
+M7&JGCDE_#_C0(X^C.CE5%UKQ6$+7@>R"%7)0YUR]#)U59$7KN>50YWU\AA8-
+MHHG1V4GL<C&Q"I0N!56,SB[A]);5.;B+G=\+ERH4L8+>`C1%#[E/:3/$8=8H
+M58YO+^;US4[TX4JJC)N1S>::=7?1IPH.B[T"-4^5V%WH*0]3W"Q5OAD]'=NI
+M.$CAP*V@Z(A\W5T]1@^'H%$CU:+8VHQ][Z^8X5!L6&WA5MPU[*[2G"!<5')0
+M"#F=?<6'%R3UVL7X_7RU]NK/#<I?D3ZSDBQ?W@Y31G;_.6PEB(J+T.IVF&JT
+MJKY_=HU)Y:[#U9_%4<T0+;06K)W@[@)<DW@SZIF[ML]_T9??L]VM!W?EN-B=
+M*ZKL*[B@+E].<4UTU,*&,-HOJ(-%=>T'KFY`R=AJT]GK)9Q-FBIU]UE<:Z"F
+M/,F@VZC*S::(<U,%?5U)5J@PM4+9EI:GZ:]<F(7W^L3I]S[^.:#R"I.Y3,"T
+M"K4')E.HZ1*95&'15IATE\NB[/,PT;V9<0GOS8Q+>&]F7,)[,^,2WIL9E_#>
+3S+BD]V8"TOG=_0-Y#+@L;`T`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdf.gz.uu
new file mode 100644
index 0000000..fc274e5
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.vhdf.gz
+M'XL(",0EAE4``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YV:&1F+F]U=`"ME#MO
+MPR`4A??\BB-URQ"9A[$]1>IKJU2I0]?:!J(H:BM5'3KXQQ>,$P/!;AH9(T0$
+MY^,><KE9YAK`!0H*D=O.*7(&SL$HP,Q,PFR).KK'+Z5N7^XI>]KTK5LY&#&+
+MY_L'U>1"MXE:MUH/P#+0D7E@B:Q"1I-`AZM&5?4G;BX^AZN7LNMPS:4X848)
+MJ:!4A'OS<.W"?P8YLZM`W(1=89<<[;)QL]9V9'H*1T;<-L:-=FFDHACUB>B0
+MC$Z><$T+SD+5K-F[%$XMFBI$7XJ3-1J3)P2ZG<;1V2#^FRJ%+'M@;G;5B7%Z
+MH7O>A)\#-@-PJ0A).50^P2`TA.J+'T/!(2H4I0^D0=Z@:S\_5/N]__%NL,?9
+MRF>R-]FMGII::@XI0&M[B)!V[L5W\[!;[]]W1QP=7-'AX+RP*E.411/9)2A#
+MNZ][>HBC8_$E^2KW!DV<3(>/QK^]K8_C)[.F`)GG8>_GV(,?P4(J^WI<GD6J
+4J]]&CQ,+IXK)O=4O0#"/42X'````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vmdk.gz.uu
new file mode 100644
index 0000000..06f3b92
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vmdk.gz.uu
@@ -0,0 +1,83 @@
+# $FreeBSD$
+begin 644 img-63x255-4096-vtoc8.vmdk.gz
+M'XL("`?&'50``VEM9RTV,W@R-34M-#`Y-BUV=&]C."YV;61K+F]U=`"M7%UO
+MW<81?<^O(.P^%$4A<,BY).^#43=1`A1%@"`.VM?P8]D(36Q#%HH:T(_O+KEG
+M=:A[Z66C<:A`XSMSM#/D/9+/'*@LUS]%H4.A6NA4G)JBE,+_U7H59?T4^&M,
+M+SS^_?;[?]S0G\>O5C`)550B)<-1L/DZCS?/_@"N^E+5Y@5_55FXVK\HPT5A
+MA*MV7MB%TS"[:R4X75_X!LHI?$)P;Q-0L8$[7>EIM]DOG>Y/7\7A^9>K.IS!
+MW][F7+1UT0PQ+)K3$M=%6RVOE47KDV8/^+JXO?OT[^+6?1KO[SX^?(CGJ\*]
+M]<G:A/QF#`B^L;8)GX07`MPY0#2NJ*>BEO!R\7C_W=VO[N8_[O[3W8?W;P3M
+M5N'>:EWH.1PGY)=/UR8(7Z0L&@E?HWC\YF^W;^*36]Y\[.\!%ZK\0?S7]GTP
+M;M,4X>/R6D[GWC\$Q#G^2:<+]S8.Y[1\;0V?G+1HS\5RG%/`KOS+4VQYF=UX
+M[_H']]/GC^[-J]\^O$^S"_<VC.R\`'7+H.KB5`>HV%H8WRD@AL=FN6O%XZ]W
+M#[_<C>]\FY_<JYO7!>":,#M_`[MXKK5K7]+LWEE_[,=O__O@^RVF>&?O`+<<
+M8FG"?^U359S:@%7[\?DJ?Q]KWVP5_LH?V'>B$I**QP_O;W[\IQ^T^.C=#W_]
+M$7"=A_.9_H"^Q#>TZ>FT]G]Z_E@6C^^^+5Z%)G_ZQ2U/(.#.X3%>D]?[($M8
+MA4_BU%;X0&(:7ECN;'';/_3%U_TG=_/Z]O;K=&?[T*PNES^:"RC-"AV>[V6<
+M?G#KG5YO]'(KIFFXZ:?^XX.[#[<WW8HA/*U3[#3<5GVZC=NOTRYW:@Y/3/'X
+MIGAU-_E[&F#_Y3[\!KAQ?8S].<(C<5X*Z_")?WH6>!>_POK$A-L4X-S#_>>;
+M\?.O=^\G_T8KW@!N6F?GCU/7\5#I3,\/E;ZLG]VK^NEH'AMP+HQH/507WQ@>
+M:SW'TQ3\LQ*>F#2%Q\\WO[A^\L<J7E6GTZMT*^;GMX)']&P*ZXWVLUAO13S8
+MYYM/;HQP=1EOX+P9SGJFHFZ>1K`ET(</]\O1&M\S\7']_'O92_E8+[ZEM@S(
+MWY?F`]]^-)Q/"$[:WWF^%>[B>^T+VVW*W+?'ZX!OKY^O,;X=<@KOW!/E-ES7
+M4M!M`'_P(#_[CX^;\\DIO'//E-ESU4#!F#G?"A?>N1-E.JZ:GS4J6;CPSA7*
+MK+BJID`OX,)/*:7_>$MP<YP=,ANN:BGH-G`[LUL>E3-E]EPU4#`>:79Y5";*
+M=%PUEYL?([,_-DI3Q=DAL^*JF@*]@+LRNZ:.LT-FPU4M!=T&;F]V&F>'S)ZK
+M!@K&0\V>XNR0Z;AJ+K<_)M=9N";.#ID55]44Z`7<M=FU<7;(;+BJI:#;P.W-
+MKHNS0V;/50,%XZ%FSW%VR'1<-9=;\M<L7!]GA\R*JVH*]`+NVNS`=\ALN*JE
+MH-O`[<T.?(?,GJL&"L9#S8+OD.FX:J8@7*<L'/@.F157U13H!=RUV8'OD-EP
+M54M!MX';F5U;QMDAL^>J@8+Q2+,M^`Z9CJMF"L+59.'`=\BLN*JF0"_@KLRN
+M!=\AL^&JEH)N`[<W._`=,GNN&B@8#S4+OD.FXZJ9@G"U63CP'3(KKJHIT`NX
+M:[,#WR&SX:J6@FX#MS<[\!TR>ZX:*!@/-0N^0Z;CJKG<_(!;=EDX\!TR*ZZJ
+M*=`+N&NS`]\AL^&JEH)N`[<W._`=,GNN&B@8#S4+OD.FXZJ9@G"=LW#@.V16
+M7%53H!=PUV8'OD-FPU4M!=T&;F=V71EGA\R>JP8*QB/-=N`[9#JNFBD(5Y^%
+M`]\AL^*JF@*]@+LRNPY\A\R&JUH*N@W<WNS`=\CLN6J@8#S4+/@.F8ZKYG+[
+MS^,A"P>^0V;%534%>@%W;7;@.V0V7-52T&W@]F8'OD-FSU4#!>.A9L%WR'1<
+M-9?;?\./63CP'3(KKJHIT`NX:[,#WR&SX:J6@FX#MS<[\!TR>ZX:*!@/-0N^
+M0Z;CJIF"<$U9./`=,BNNJBG0"[AKLP/?(;/AJI:";@.W,[MS&6>'S)ZK!@K&
+M(\V>P7?(=%PU4Q`NEX4#WR&SXJJ:`KV`NS*[,_@.F0U7M11T&[B]V8'OD-ES
+MU4#!>*A9\!TR'5?-%(1KSL*![Y!9<55-@5[`79L=^`Z9#5>U%'0;N+W9@>^0
+MV7/50,%XJ%GP'3(=5\WE1J=,F[Y]N,AW*;/BJIH"O8"[-KO(=RFSX:J6@FX#
+MMS>[R'<IL^>J@8+Q4+.1[U*FXZIYNQF5K*1UCGPGI-\)ZW="^IUD];MSY#LA
+M_4Y8OQ/2[R2KW_5EG!WI=\+ZG9!^EV^VCWPGI-\)ZW="^IUD):T^\IV0?B>L
+MWPGI=Y+5[_K(=T+ZG;!^)Z3?25:_ZR/?">EWPOJ=D'YWH-G(=T+ZG;!^)Z3?
+M25;2ZB/?">EWPOJ=D'XG6?VNCWPGI-\)ZW="^IUD];L^\IV0?B>LWPGI=P>:
+MC7PGI-\)ZW>;;4M6TNK!=Z3?">MW0OJ=9/6['GQ'^IVP?B>DWTE6O^O!=Z3?
+M">MW0OK=@6;!=Z3?">MW0OJ=9"6M'GQ'^IVP?B>DWTE6O^O!=Z3?">MW0OJ=
+M9/6[H8RS(_U.6+\3TN_RS0[@.]+OA/4[(?U.LI+6`+XC_4Y8OQ/2[R2KWPW@
+M.]+OA/4[(?U.LOK=`+XC_4Y8OQ/2[PXT"[XC_4Y8OQ/2[R0K:0W@.]+OA/4[
+M(?U.LOK=`+XC_4Y8OQ/2[R2KWPW@.]+OA/4[(?WN0+/@.]+OA/4[WBA+5M(:
+MP'>DWPGK=T+ZG63UNP%\1_J=L'XGI-])5K\;P'>DWPGK=T+ZW8%FP7>DWPGK
+M=T+ZG60EK0%\1_J=L'XGI-])5K\;P'>DWPGK=T+ZG63UN[&,LR/]3EB_$]+O
+M\LV.X#O2[X3U.R']3K*2U@B^(_U.6+\3TN\DJ]^-X#O2[X3U.R']3K+ZW0B^
+M(_U.6+\3TN\.-`N^(_U.6+\3TN\D*VF-X#O2[X3U.R']3K+ZW0B^(_U.6+\3
+MTN\DJ]^-X#O2[X3U.R'][D"SX#O2[X3U._:&2E;2&L%WI-\)ZW="^IUD];L1
+M?$?ZG;!^)Z3?25:_&\%WI-\)ZW="^MV!9L%WI-\)ZW="^IUD):T1?$?ZG;!^
+M)Z3?25:_&\%WI-\)ZW="^IUD];NIC+,C_4Y8OQ/2[_+-3N`[TN^$]3LA_4ZR
+MDM8$OB/]3EB_$]+O)*O?3>`[TN^$]3LA_4ZR^MT$OB/]3EB_$]+O#C0+OB/]
+M3EB_$]+O)"MI3>`[TN^$]3LA_4ZR^MT$OB/]3EB_$]+O)*O?3>`[TN^$]3LA
+M_>Y`L^`[TN^$]3LA_:XJK\,53W"1[RHJ>:JJ*=`MG(<H_$?I/]X27.2[E,G7
+ME;]*LRNN-SM^J6H?[G)VJS^P7DQIS&I\T**B?\Y6W7/`<,0_^(\_IO/5BRFM
+M(KCZV/G^')^Z;;MU8VS7K)<=K9E=L^Z,[9J:UOFX7F37U+3.Q_4BNZ:F=3ZN
+M%]DU-:WS3>R:FM;Y)G9-3>M\$[NFIG6^B5U3TSK?Q*ZI:9UO8M?4M,XWL6MJ
+M6N>;V#4UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)75/3.M_$KJEIG6]BU]2TSC>Q
+M:VI:YYO8-36M\TWLFIK6^29V34WK?!.[IJ9UOHE=4],ZW\2NJ6F=;V+7U+3.
+M-[%K:EKGF]@U-:WS3>R:FM;Y)G9-3>M\$[NFIG6^B5U3L<ZWL6LJUODV=DW%
+M.M_&KJE8Y]O8-17K?!N[IF*=;V/75*SS;>R:BG6^C5U3L<ZWL6LJUODV=DW%
+M.M_&KJE8Y]O8-17K?!N[IF*=;V/75*SS;>R:BG6^C5U3L<ZWL6LJUODV=DW%
+M.M_&KJE8Y]O8-17K?!N[IF*=;V/75*SS;>R:BG6^C5U3L<ZWL6LJUODV=DW%
+M.M_&KJE8Y]O8-17K?!N[IF*=;V/75*SS;>R:BG6^C5U3TSH?F2^R:VI:YR/S
+M179-3>M\9+[(KJEIG8_,%]DU-:WS3>R:FM;Y)G9-3>M\$[NFIG6^B5U3TSK?
+MQ*ZI:9UO8M?4M,XWL6MJ6N>;V#4UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)75/3
+M.M_$KJEIG6]BU]2TSC>Q:VI:YYO8-36M\TWLFIK6^29V34WK?!.[IJ9UOHE=
+M4],ZW\2NJ6F=;V+7U+3.-[%K:EKGF]@U-:WS3>R:FM;Y)G9-3>M\$[NFIG6^
+MB5U3L<ZWL6LJUODV=DV=3.V:.IG:-74RM6OJ9&K75%>6AG9-=:9V376F=DUU
+MIG9-=:9V376F=DUUIG9-=:9V376F=DUUIG9-=:9V376F=DUUIG9-=:9V376F
+M=DUUIG9-G<O2T*ZILZE=4V=3NZ;.IG9-G4WMFCJ;VC5U-K5KZFQJU]39U*ZI
+MLZE=4V=3NZ;.IG9-G8WMFET97M8&O['W%'X/[&GYG;!U^.V?=?C]UM<`O[MW
+M[NMWMU7]/9^ON_A-UB\^7[>IDR\#=LM2M-I]6+KR_%1USL)]Z7PK7&_5[@HW
+M'(5;-S>3*YQ[!O<SP5D_+'+1KH/"6_^.=@7MDN`T+V_6>MZ#DR>XOSR'>VKW
+M^;NM*I[JKYRNN'JZ*<$-8_C5V,>G]\TU.&?ZJ,A\%&[JB\$_)U+,XSY<]<5#
+H_/^/2K\`KOZ`R__OO^"_9VS_6P$U`IJ=4/U[HRR_^A][EZ;PS5\`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.qcow.gz.uu
new file mode 100644
index 0000000..d037063
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.qcow.gz
+M'XL("+4S(E0``VEM9RTV,W@R-34M-3$R+6%P;2YQ8V]W+F]U=`"MG=F.'=EQ
+M1=_[*RYGLCC=B,B1LP2Y`3\8:%O0LY0C($"V$[(`O_#C7<4Z0U7<O1F4NZE"
+M@T0A-[).+:X6I,7#\_GVQ^G4RJGI3LUXVN?3]:_3AYSN_.+^Q^GKO__\KV_N
+M_OCZT^V8G+_SE/MUHR=)<_>V?E_G].:IY70>?V#N^@/.W7D[^R?>[LX7>SEW
+M]=/M%XN?4S9H]P9/:>Z<WD_(Z34_]GY?W)<KMZ?WVWVY2K[<E@UV]P9_27-_
+M2>^GY,OMV=QP;^YP7ZZ2+W=D<]-W85$"R\SFEF"N@4^M;&X+YEKXU([GY#O?
+MV]NY#CXE;$[AW*G,]?`I8W/-O;GSFPQTGAO@4X0[";D;X5.$.PFYF^!3A#L)
+MN9OA4X0[";E;X%.$.PFY6^%3A#L-N=O@4X0[#;G;X5.$.XVX$_P4X4XC[@3Y
+M3AEW&G$GR'?*N-.(.T&^4\:=1MP)\ITR[C3B3I#OE'%G$7>"?&>,.XNX$^0[
+M8]Q9R!WRG3'N+.0.^<X8=Q9RAWQGC#L+N4.^,\:=A=PAWQGCSD+ND.^,<=>$
+MW"'?-8R[)N0.^:YAW#41=XJ?(MPU$7>*?-<P[IJ(.T6^:QAW3<2=(M\UC+LF
+MXDZ1[QK&71-QI\AW#>.NC;A3Y+N6<==&W"GR7<NX:T/ND.]:QET;<H=\US+N
+MVI`[Y+N6<=>&W"'?M8R[-N0.^:YEW+4A=\AW+>.N"[E#ONL8=UW('?)=Q[CK
+M(NX,/T6XZR+N#/FN8]QU$7>&?-<Q[KJ(.T.^ZQAW7<2=(=]UC+LNXLZ0[SK&
+M71]Q9\AW/>.NC[@SY+N><=>'W"'?]8R[/N0.^:YGW/4A=\AW/>.N#[E#ONL9
+M=WW('?)=S[CK0^Z0[WK&W1!RAWPW,.Z&D#ODNX%Q-T3<-?@IPMT0<=<@WPV,
+MNR'BKD&^&QAW0\1=@WPW,.Z&B+L&^6Y@W`T1=PWRW<"XR__S-Y]#OAL9=V/$
+M78-\-S+NQI`[Y+N1<3>&W"'?C8R[,>0.^6YDW(TA=\AW(^-N#+E#OAL9=V/(
+M'?+=R+B;0NZ0[R;&W11RAWPW,>ZFB+L6/T6XFR+N6N2[B7$W1=RUR'<3XVZ*
+MN&N1[R;&W11QUR+?38R[*>*N1;Z;&'?Y_X;D<\AW,^-NCKAKD>]FQMT<<H=\
+M-S/NYI`[Y+N9<3>'W"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=TO('?+=
+MPKA;0NZ0[Q;&W1)QU^&G"'=+Q%V'?+<P[I:(NP[Y;F'<+1%W'?+=PKA;(NXZ
+MY+N%<;=$W'7(=POC;HVXZY#O5L;=&G'7(=^MC+LUY`[Y;F7<K2%WR'<KXVX-
+MN4.^6QEW:\@=\MW*N%M#[I#O5L;=&G*'?+<R[K:0.^2[C7&WA=PAWVV,NRWB
+MKL=/$>ZVB+L>^6YCW&T1=SWRW<:XVR+N>N2[C7&W1=SUR'<;XVZ+N.N1[S;&
+MW1YQUR/?[8R[/>*N1[[;&7=[R!WRW<ZXVT/ND.]VQMT><H=\MS/N]I`[Y+N=
+M<;>'W"'?[8R[/>0.^6XGW$G^"9\#OI,SX4[.(7?`=W(FW,DYXF[`3V'N).SO
+M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\)VP_D["_FX`OA/6WTG8WPW`
+M=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$
+M]7<2]G<#\)VP_D["_FX`OA/6WTG8WPW(=ZR_D["_&Y#O6'\G87\WXJ<(=V%_
+M-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6
+MWTG8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[
+M$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?C<AWK+^3L+^;\%.$N["_FY#O6'\G
+M87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK[R3L[R;D
+M.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=A'S'^CL)
+M^[L)^8[U=Q+V=Q/R'>OO).SO)N0[UM])V-_-^"G"7=C?S<AWK+^3L+^;D>]8
+M?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R'>OO).SO
+M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z
+M.PG[NQGYCO5W$O9W,_(=Z^\D[.\6_!3A+NSO%N0[UM])V-\MR'>LOY.POUN0
+M[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D
+M[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!OF/]G83]W8)\
+MQ_H["?N[!?F.]7<2]G<K?HIP%_9W*_(=Z^\D[.]6Y#O6WTG8WZW(=ZR_D["_
+M6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2]G<K\AWK
+M[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A?[<BW['^3L+^;D6^8_V=A/W=
+MBGS'^CL)^[L-/T6X"_N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?;<AWK+^3
+ML+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U=Q+V=QOR
+M'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_)V%_MR'?L?Y.POYN0[YC_9V$
+M_=V.GR+<A?W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])V-_MR'>L
+MOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.PG[NQWYCO5W$O9W
+M._(=Z^\D[.]VY#O6WTG8W^W(=ZR_T_P3-W>J<\!WUT]A[M3U=_D^O5/E#OA.
+M67^GKK\[)>Y.F3L[XZ<P=^KZNU/B[O27,@=\IZR_4]??G0YW=H;NOU/6WZGK
+M[\K9U3G@.V7]G;K^#LP!WRGK[]3U=V`.^$Y9?Z>NO\MS#^H<\)VR_DY=?_<@
+MSYW*'/"=LOY.77_W(''WH'('?*>LOU/7WSU(W#VHW`'?*>OOU/5W#XZ+LP.^
+M4];?J>OORMG5.>`[9?V=NOX.S`'?*>OOU/5W8`[X3EE_IZZ_RW,/ZQSR'>OO
+MU/5W#_-<Y0[YCO5WZOJ[AXF[AX4[=/^=LOY.77_W,''WL'"'[K]3UM^IZ^\>
+M'O[LT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC_9VZ_@[,(=^Q_DY=?Y?G'M4Y
+MY#O6WZGK[Q[EN<(=NO].67^GKK][E+A[5+E#OF/]G;K^[E'B[E'E#OF.]7?J
+M^KM'Q\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_`W/(=ZR_4]??Y;G'
+M=0[YCO5WZOJ[QWFN<H=\Q_H[=?W=X\3=X\(=NO].67^GKK][G+A[7+A#]]\I
+MZ^_4]7>/#W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?FD.]8?Z>N
+MO\MS3^H<\AWK[]3U=T_R7.$.W7^GK+]3U]\]2=P]J=PAW['^3EU_]R1Q]Z1R
+MAWS'^CMU_=V3X^+LD.]8?Z>NORMG5^>0[UA_IZZ_`W/(=ZR_4]??@3GD.];?
+MJ>OO\MS3.H=\Q_H[=?W=TSQ7N4.^8_V=NO[N:>+N:>$.W7^GK+]3U]\]3=P]
+M+=RA^^^4]7?J^KNGAS\[=/^=LOY.77]7SJ[.(=^Q_DY=?P?FD.]8?Z>NOP-S
+MR'>LOU/7W^6Y9W4.^8[U=^KZNV=YKG"'[K]3UM^IZ^^>)>Z>5>Z0[UA_IZZ_
+M>Y:X>U:Y0[YC_9VZ_N[9<7%VR'>LOU/7WY6SJW/(=ZR_4]??@3GD.];?J>OO
+MP!SR'>OOU/5W>>YYG4.^8_V=NO[N>9ZKW"'?L?Y.77_W/''WO'"'[K]3UM^I
+MZ^^>)^Z>%^[0_7?*^CMU_=WSPY\=NO].67^GKK\K9U?GD.]8?Z>NOP-SR'>L
+MOU/7WX$YY#O6WZGK[_+<BSJ'?,?Z.W7]W8L\5[A#]]\IZ^_4]7<O$G<O*G?(
+M=ZR_4]??O4C<O:C<(=^Q_DY=?_?BN#@[Y#O6WZGK[\K9U3GD.];?J>OOP!SR
+M'>OOU/5W8`[YCO5WZOJ[/'=5YY#O6'^GKK^[RG.5.^0[UM^IZ^^N$G=7A3MT
+M_YVR_DY=?W>5N+LJW*'[[Y3U=^KZNZO#GQVZ_TY9?Z>NORMG5^>0[UA_IZZ_
+M`W/(=ZR_4]??@3GD.];?J>OO\MS+.H=\Q_H[=?W=RSQ7N$/WWRGK[]3U=R\3
+M=R\K=\AWK+]3U]^]3-R]K-PAW['^3EU_]_*X.#OD.];?J>OORMG5.>0[UM^I
+MZ^_`'/(=Z^_4]7=@#OF.]7?J^KL\]ZK.(=^Q_DY=?_<JSU7ND.]8?Z>NOWN5
+MN'M5N$/WWRGK[]3U=Z\2=Z\*=^C^.V7]G;K^[M7ASP[=?Z>LOU/7WY6SJW/(
+M=ZR_4]??@3GD.];?J>OOP!SR'>OOU/5W>>YUG4.^8_V=NO[N=9XKW*'[[Y3U
+M=^KZN]>)N]>5.^0[UM^IZ^]>)^Y>5^Z0[UA_IZZ_>WU<G!WR'>OOU/5WY>SJ
+M'/(=Z^_4]7=@#OF.]7?J^CLPAWS'^CMU_5V>>U/GD.]8?Z=1?V?H_CME_9U&
+M_9VA^^^4]7<:]7>&[K]3UM]IU-\9NO].67^G47]GZ/X[9?V=1OV=H?OOE/5W
+M&O5WANZ_4];?*>GOWM8YY#O6WZGK[][FN<(=NO].67^GKK][F[A[6[E#OF/]
+MG;K^[FWB[FWE#OF.]7?J^KNWQ\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_
+MIZZ_`W/(=ZR_L_P3-W>N<\!WQOJ[ZT_<XR[[Z5RY`[XSUM^9Z^_.:>]<N$/W
+MWQGK[\SU=^?$W;EPA^Z_,];?F>OOSH<_.W3_G;'^SEQ_5\ZNS@'?&>OOS/5W
+M8`[XSEA_9ZZ_`W/`=\;Z.W/]79Z3.@=\9ZR_,]??29XKW*'[[XSU=^;Z.TFO
+M)Y4[X#MC_9VY_DX2=U*Y`[XSUM^9Z^_DN#@[X#MC_9VY_JZ<79T#OC/6WYGK
+M[\`<\)VQ_LY<?P?F@.^,]7?F^KL\IW4.^8[U=^;Z.\USE3OD.];?F>OO-'&G
+MA3MT_YVQ_LY<?Z>).RW<H?OOC/5WYOH[/?S9H?OOC/5WYOJ[<G9U#OF.]7?F
+M^CLPAWS'^CMS_1V80[YC_9VY_B[/69U#OF/]G;G^SO)<X0[=?V>LOS/7WUGB
+MSBIWR'>LOS/7WUGBSBIWR'>LOS/7W]EQ<7;(=ZR_,]??E;.K<\AWK+\SU]^!
+M.>0[UM^9Z^_`'/(=Z^_,]7=YKJESR'>LOS/7WS5YKG*'?,?Z.W/]79.X:PIW
+MZ/X[8_V=N?ZN2=PUA3MT_YVQ_LY<?]<<_NS0_7?&^CMS_5TYNSJ'?,?Z.W/]
+M'9A#OF/]G;G^#LPAW['^SEQ_E^?:.H=\Q_H[<_U=F^<*=^C^.V/]G;G^KDW<
+MM94[Y#O6WYGK[]K$75NY0[YC_9VY_JX]+LX.^8[U=^;ZNW)V=0[YCO5WYOH[
+M,(=\Q_H[<_T=F$.^8_V=N?XNSW5U#OF.]7?F^KLNSU7ND.]8?V>NO^L2=UWA
+M#MU_9ZR_,]??=8F[KG"'[K\SUM^9Z^^ZPY\=NO_.6']GKK\K9U?GD.]8?V>N
+MOP-SR'>LOS/7WX$YY#O6WYGK[_)<7^>0[UA_9ZZ_Z_-<X0[=?V>LOS/7W_6)
+MN[YRAWS'^CMS_5V?N.LK=\AWK+\SU]_UQ\79(=^Q_LY<?U?.KLXAW['^SEQ_
+M!^:0[UA_9ZZ_`W/(=ZR_,]??Y;FASB'?L?[.7'\WY+G*'?(=Z^_,]7=#XFXH
+MW*'[[XSU=^;ZNR%Q-Q3NT/UWQOH[<_W=</BS0_??&>OOS/5WY>SJ'/(=Z^_,
+M]7=@#OF.]7?F^CLPAWS'^CMS_5V>&^L<\AWK[\SU=V.>*]RA^^^,]7?F^KLQ
+M<3=6[I#O6']GKK\;$W=CY0[YCO5WYOJ[\;@X.^0[UM^9Z^_*V=4YY#O6WYGK
+M[\`<\AWK[\SU=V`.^8[U=^;ZNSSWKLXAW['^SEQ_]R[/5>Z0[UA_9ZZ_>Y>X
+M>U>X0_??&>OOS/5W[Q)W[PIWZ/X[8_V=N?[NW>'/#MU_9ZR_,]??E;.K<\AW
+MK+\SU]^!.>0[UM^9Z^_`'/(=Z^_,]7=Y[GV=0[YC_9VY_NY]GBO<H?OOC/5W
+MYOJ[]XF[]Y4[Y#O6WYGK[]XG[MY7[I#O6']GKK][?UR<'?(=Z^_,]7?E[.H<
+M\AWK[\SU=V`.^8[U=^;Z.S"'?,?Z.W/]79[[4.>0[UA_9ZZ_^Y#G*G?(=ZR_
+M,]???4C<?2C<H?OOC/5WYOJ[#XF[#X4[=/^=L?[.7'_WX?!GA^Z_,];?F>OO
+MRMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\]['.(=^Q_LY<?_<QSQ7N
+MT/UWQOH[<_W=Q\3=Q\H=\AWK[\SU=Q\3=Q\K=\AWK+\SU]]]/"[.#OF.]7?F
+M^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L]]JG/(=ZR_,]???<IS
+ME3OD.];?F>OO/B7N/A7NT/UWQOH[<_W=I\3=I\(=NO_.6']GKK_[=/BS0_??
+M&>OOS/5WY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^USGD.]8?V>N
+MO_N<YPIWZ/X[8_V=N?[N<^+N<^4.^8[U=^;ZN\^)N\^5.^0[UM^9Z^\^'Q=G
+MAWS'^CMS_5TYNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^KLD_<7-?ZASP7</Z
+MN\;U=U_R7.4.^.[Z*<Q=X_J[+XF[+YF[YHR?(G_OL?MBO^3>^$V90W_?=GDJ
+MF+OSX^M/5]\&VV_OU[2G5D]GK4_<7/\V?&_P7_[C9N:!>[_V-W^_;_?+7)]6
+MLUX\9W<'Y?XGOO[R;W[P=N[F_9IOX=CU1W?]WZ?;'WJ_WQW'WS8PA_Z^\O_7
+MEWL[9Y=OUWZS2B>G4Z^GOCEU8_IG=RVI[>;3Z>W^?$Q__\=?__'7__ZO/^>Y
+MFW]?=.O-P_T_\W;_.1WP[=#?5_YKOK?-#WYO<Z*1?^?>_][FW[DM^K/EO^[]
+MOGT[NIN#O_Y&7'\T>FKMU#0W?SSBU+8WGVOM<O#GOV_;[__XA]=_^OF/=\\/
+M_7'P7_5^W0^<G]XYO]O?)'?/[W3W_="?W?IU[_?=\^OMU/>`S7I^__._MR#F
+K]_NMSV](YW>>P#_Y)[[^\N;^?VX'FS3XF[UA<[[^!I]_^C_<Q@LX=*8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.qcow2.gz.uu
new file mode 100644
index 0000000..290ead4
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.qcow2.gz
+M'XL("*H[(U0``VEM9RTV,W@R-34M-3$R+6%P;2YQ8V]W,BYO=70`K9A);]LP
+M$$;O^15,]Z9-*LZ0E-P]FX$>"J0->@Z\R$"`+D8:H!?_^%+6R)2I&3$VY`A"
+M#.)[&`^?QZ:SK'XH9;4R3IF16DR5?TX7J-:3[4NMOHV_G+0?JX,:IC,AQ2P8
+MW."V6.<!!Q(NT]T%S>-:U2&#@R;5!:5P1JRN;X'!'1VL6[?>C")*X#[`&B=N
+MQE[U05U?G#![U@=#UX=\_VR3BQ=<?WU8UQ>G<@E7)''`I$82;I+$(9.:2KA9
+M$F>8U%S"E4F<95(+`:<3JGB<8U):PD$2ES,IE'`FB2N8E.2=3GLW8E*2=SKM
+MW81)2=[IM'=3)B5YI]/>S9B4Y)U.>S=G4I)W('BG`JYD4I)W$'EW2+A'`;=@
+M4I)W$'GWF'!/-CC-I23O(/+N*>&>!1PS[T#R#B+OGA/N1<`Q\PXD[R#R[B7A
+MC@*.F7<@>0>1=Z\(]SK@F'D'DG<0>7?<\4XS\PXD[S#R[@VQLH!CYAU*WF'D
+MG28<!!PS[U#R#B/OD'`FX)AYAY)W&'EG"><"CIEW*'F'D7<YX8J`8^8=2MYA
+MY-V(<&\#CIEW*'F'D7?O"/<^X)AYAY)W&'GW@7`?`XZ9=RAY9R+O/A'N<\`Q
+M\\Y(WIG(NU/"G04<,^^,Y)V)O#LGW,4&!UQJXUV6\1?A+COO61CV^Z<)WX\U
+M<Y<7>H#%+L"^"FO<:-`7;.L7['?`0CA'9>M/R*(7>/F]PAQNUV>'/A#86A@_
+MF<V\DT/IP.<75E=?F?[96AC_=O#3U%]NIIQ]4'VGR^7/DL')I]O=CU,>A]WJ
+M[&+]OY<E!Y4;Y49T=POERFJ9JKM93N[N;^]O__R^:7#5!Z2;5^%\E^I^399L
+M=7;@O34/W-MFJ@`!M_=6-?69H=TSZ^UP5>/]1OC+CTN+U93S7S.4M=6:Q2YP
+M?%>69]<7QS_&U^W^F6%_;+#^1)7N'[3Z5[])VOU3[?K<T/USO?W+4>4YXV;H
+KW]]_M8A-?4/WKZ#^^9-Z]RXOK*Y.MO]JH"'@8!4:5TWG@_\+*`W"Y1,`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.raw.gz.uu
new file mode 100644
index 0000000..b47d4c6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.raw.gz
+M'XL("/7%'50``VEM9RTV,W@R-34M-3$R+6%P;2YR87<N;W5T`*V3S6K#,!"$
+M[WZ*Z;50(\DKJ3FFM+D50D//P=0.!-K4I(%>]/"5(HG(/PDN:+T(BV4_QK-K
+MQGP`)"$%F$T64G`PPN4^2)B7M]+&71G#%![&V8VNZ[AR$*:X]T#ARI*!FE%?
+ME0)YOV#6KT.@QSE]Q*&92_4!)6?I6W;=9SN!$[D^U^.JL3JY.[]S0`MH@EJ$
+M4^V@6E<.ZK9=?3SM3_OOPS;BR.)4XYKU?]1]U=VD.IEYMC1SMA27,@#[LT74
+M1[EWC\[C4,YX.PB;)"`K$$$T5KAT-7L?`5?'MGW:/#^\KS:I?T29]:D9_HG$
+M/_^3I/XAU:=R^Z=N^J<K:#VQFQ?_?G[](D9]N?U[#/ZQ>N*\7C#KLO]X(`5@
+/-H4D'+#X`^%)]I"G!0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.vhd.gz.uu
new file mode 100644
index 0000000..5aa8ba1
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.vhd.gz
+M'XL("!LUQ%4``VEM9RTV,W@R-34M-3$R+6%P;2YV:&0N;W5T`*U62VO<,!"^
+M[Z\8Z"V011I+\N:2DM+D5@@-I<?@>.5@FL>274@.SG^O1@\D/]DDVA7"1IY/
+MWWSSD!AS/P!5@&I`:5"2GDL!Z@S*#8!9]`/MS/TK=/7SDZX/[=O:_[J5`^,L
+MM>J;DST6(,PF)6!%FZ@M/4,78-;?+N]/VL?[`(<>#CV0+,FJ0%!WHWW*+6S<
+M/A;N;XO_+.1[9%>,V44KYV#30-$D7Q2!W;N=OZ?."F-EOJ<AX:ZT^H31>^DM
+M1&<'VDDVL$IH3HG*HK-3<&K)ZB-P)RL?"Y<J)C%*,S-0'$JD9Y,V08?1,*GR
+MMM]5+WL]X(<SJ:*28`S7Q+R[Z%,%P\>>@2""2^Z"1=D/X292Y4OJJ;Z=\`]&
+M!";#`EKW^^I%*$CY*<X6-)\/QBR_BOB9TI08J\V,0D/-EQR^_$TPY\-P5#/1
+M_;1^-2V;"A';D5TOOKR_T%W_FDR7FO@)3FE,F5Q3#A_#[V*W>]`3<)C+70=7
+MC-G)QM><+3K7HNWL6K=L`KM;4VV']M`^/]T&.&I4U&HMXO'L'JO=)#N9.;;Z
+MR-B&HD$/V(\M!'XZ=^YI&PY%PM,)*4$@2'.0"<"M(2YIS;R/`*]>M/YQ\_/T
+MS]5-JI\6>?EQ=H1^F.CGBB35+^TM?.X0_SR_1?WH,"DG<C/JMW]UB1CXY=8/
+MO7ZLFICG%[KK=?_O`-$WTVS=&6/WR\-0>,!L#$6LX5P,N5H,YD>CK'!C7<YT
+KU26XC%==@LMXU26XC%==@LMXU26XC%==@LMZU36`)IE7_P%G#2J)'PT`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.vhdf.gz.uu
new file mode 100644
index 0000000..43c1894
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.vhdf.gz
+M'XL("(LEAE4``VEM9RTV,W@R-34M-3$R+6%P;2YV:&1F+F]U=`"M54UKPS`,
+MO?=7"'8K+"2V;&>G?;#V-B@K8\>2Y:.$K6WH"MLA/WYV;*]VDI9NV!'&1M'C
+MZ<F6XU@/`&3`",328F/8S<=]SZ"=/4=RW$5VM!,-EIR+.@T7]48[F6I`HMQ,
+M$BH&<=0%3'Q'NWCJ`VHXQ0\3$+$RG@-G%_&[;YJ/<@2.A$I7P]$A.U9UZP1`
+M$!`(_,;,O`)>*K=AMVJR_:$^U+OMRL+)*@(O5+#X"[M-UHRR8X%KBQ?6%LV"
+M&$"_MF#Y8>BSAUTYN!)>%D(:$F`4$($4DCA3/KD?`,[W9?FP?+Q^F2]=_1`#
+M\^,7Z$<<_?0E<?4#EQ\/K1\_JY^@(,3(V3SJ]_FE#Z+E%UJ_U.@79R/S:4>[
+MB/Q/`Z(!#,8P-=V94W/7E8C4]H#4!23'\G:`^6Y;YH?ZV[W!J>G.535N*IY0
+M]19P`23K6DRAU@Z_J]EZ6F_6%LYV/_MP,*&BJ"SWVR#=U$_WM2;O?79T*%+J
+MJ9<HGK3R$O?4NW7A\#?9LH1<ZV/-VWB.T=ZLX+KNY_[\W]IJ.![XJ,B'<O(#
+(T:JTQ-('````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-apm.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-apm.vmdk.gz.uu
new file mode 100644
index 0000000..89cfd3e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-apm.vmdk.gz.uu
@@ -0,0 +1,83 @@
+# $FreeBSD$
+begin 644 img-63x255-512-apm.vmdk.gz
+M'XL("/;%'50``VEM9RTV,W@R-34M-3$R+6%P;2YV;61K+F]U=`"MG%MOY,81
+MA=_]*PCYQ0B0`<_P_K!`[,@&@L#`PNLDCPZOL9#U2I"$)`O,CP^;[-,ZE,1M
+MPBIEY)G:J:KIKJ9*RE<'3-/U*TGR+LGS)!^2HDQ2)/,_K8\DS9Z,^7&N^<;E
+MK]<__OW$KV].I\M7:S*X*`E!JNG$V'S.Y?3LB^G.7XK:O#$_SM%TF8OJ7@3Z
+M=.>=-W;3Y?.;Y]="N+IV>7MP+R1=$A(EFW3%*WO:W>R75O>'KWSQW/HRMX;Y
+M>,LFJ;*D[+R9E,5B9TEU7MY+DVIVFN:$7R?7-P__3J['A_[^YN[QUJ_O[,YV
+M=LY+YU_V+L.\L:IT+]P;+EWC4I1CD@U)!O=V<KG_X>;C>/K/>/]P<_OI';C=
+MLSO;/$ORQBW'^:=/CXWA/B1-2KC/2"Y__LOU.W_EIJ>[]I[I7-2\D/FSYWUH
+MWK),W/?+Q[*Z\=.CRSCYK[`Z=[:^.,7RV;E[4>1)U23+<@J7^SR_/?@M+[7K
+M[\?V<?SY\]WX[NJWVT^A=NYL7<F:)5&]%"I+BLRE\EMSY2M<1G?9+*>67#[>
+M//YZTW^8M_DP7IV^3IBN=+6;#[#VZUIW/8>4NR<[+_OR_?\>Y_TF@S_9&Z9;
+M%K%L8O[LXIP4E<LU'^!R%.<DR]VK^9_F!<\[R>&<DLOMI]-/_YA_Q%VQ/KS_
+M]B>FJ^>HV7->X!PR;VBSIV+=?_'\LDPN'[Y/KMPF?_YU7*Y`IFO6'S/GO)X#
+M%O/L7OBJK>E=$\O=&\O))M?M8YM\USZ,IZ^OK[\+)]NZS>;+8U[:Z+*4:VIW
+M?2_EG`NWGO1ZT,M1#$-W:H?V[G&\=\<;CJ)S)1K\3MVQYD_'N/V<:CFIR5TQ
+MR>5=<G4SS&?JTOYKO/V-Z?KU,I[7X2Z)9@G,W(OYZEG2C_X3UBO&'9-+-S[>
+M?S[UGS_>?!KF'[3D'=,-:^WFY62I7U18T_-%A8^=:W>5/BUMSLUTHRO1NJC:
+M_V#,N=9U/%7!73&%>_@J7#Z??AW;85Y6<G4NBJMP%-/SH]`2/:O">M!S+=:C
+M\`O[?'H8>Y\N2_T!3IOBK&M*LC+),K^B;0-]O+U?EE9F5]J/L^>_R][:C_,7
+MOU*KWYEP36>]OC)]]OLLT[A<C&*3T/T62^?O/\W?[Y_65[KUE>)9:50M1K-)
+M]\\YQ=W+[9;N$FO%L].H7HSA2/5*U]I&\9R>5X]_:D!>[Z?CWP+TS#0J%Z/8
+MI-NK7>%K1\]*HVHQFDVZO=J5OG;T[#2J%V,XM-G*UXZ>DT:Y)_XIA?3`GV5E
+M[6M'STRC<C&*3;J]VC6^=O2L-*H6H]FDVZM=ZVM'STZC>C&&0YOM?.WH.6F4
+M>V*#@+S>3]?[VM$STZA<C&*3;J]V@Z\=/2N-JL5H-NGV:C?ZVM&STZA>C.'0
+M9B=?.WI.&N6><JE='DM7I;YV],PT*A>CV*3;J5W%?D?/2J-J,9I-NIW:5>QW
+M].PTJA=C.+19]CMZ3AKEG@JI71%-QWY'STRC<C&*3;J]VK'?T;/2J%J,9I-N
+MKW;L=_3L-*H78SBT6?8[>DX:Y9Y*J5T93<=^1\],HW(QBDVZO=JQW]&STJA:
+MC&:3;J]V['?T[#2J%V,XM%GV.WI.&N6>^$<0Y/5^.O8[>F8:E8M1;-+MU8[]
+MCIZ51M5B-)MT>[5COZ-GIU&]&,.AS;+?T7/2*/=$(`-YO9NN3GWMZ)EI5"Y&
+ML4FW4[N:_8Z>E4;58C2;=#NUJ]GOZ-EI5"_&<&BS['?TG#3*/352NR::COV.
+MGIE&Y6(4FW1[M6._HV>E4;48S2;=7NW8[^C9:50OQG!HL^QW])PTRCWQ_T)!
+M7N^G8[^C9Z91N1C%)MU>[=COZ%EI5"U&LTFW5SOV.WIV&M6+,1S:+/L=/2>-
+M<D_DCY#7^^G8[^B9:50N1K%)MU<[]CMZ5AI5B]%LTNW5COV.GIU&]6(,AS;+
+M?D?/2:/<4R^UZV/IFM37CIZ91N5B%)MT.[5KV._H66E4+4:S2;=3NX;]CIZ=
+M1O5B#(<VRWY'STFCW-,@M1NBZ=COZ)EI5"Y&L4FW5SOV.WI6&E6+T6S2[=6.
+M_8Z>G4;U8@R'-LM^1\])H]S3*+4;H^G8[^B9:50N1K%)MU<[]CMZ5AI5B]%L
+MTNW5COV.GIU&]6(,AS;+?D?/2:/<TR2UFZ+IV._HF6E4+D:Q2;=7._8[>E8:
+M58O1;-+MU8[]CIZ=1O5B#(<VRWY'STFC4IF>05[OIFO3M7;!,].H7(QBDVZG
+M=JWO=\&STJA:C&:3;J=VK>]WP;/3J%Z,X=!F?;\+GI-&N9()OT,4:;6^WT'X
+M'93?0?@=HORN]?T.PN^@_`["[Q#E=ZWO=Q!^!^5W$'YW8+.^WT'X'93?0?@=
+MHDBK]?T.PN^@_`["[Q#E=ZWO=Q!^!^5W$'Z'*+]K?;^#\#LHOX/PNP.;]?T.
+MPN^@_`["[Q!%6JWO=Q!^!^5W$'Z'*+]K?;^#\#LHOX/P.T3Y7>O['83?0?D=
+MA-\=V*SO=Q!^!^5W$'Z'*-+J4E\[X7=0?@?A=XCRNX[]3O@=E-]!^!VB_*YC
+MOQ-^!^5W$'YW8+/L=\+OH/P.PN\015H=^YWP.RB_@_`[1/E=QWXG_`[*[R#\
+M#E%^U['?";^#\CL(OSNP6?8[X7=0?@?A=X@BK8[]3O@=E-]!^!VB_*YCOQ-^
+M!^5W$'Z'*+_KV.^$WT'Y'83?'=@L^YWP.RB_@_`[1)%6QWXG_`[*[R#\#E%^
+MU['?";^#\CL(OT.4WW7L=\+OH/P.PN\.;);]3O@=E-]!^!VB2*M/?>V$WT'Y
+M'83?(<KO>O8[X7=0?@?A=XCRNY[]3O@=E-]!^-V!S;+?";^#\CL(OT,4:?7L
+M=\+OH/P.PN\0Y7<]^YWP.RB_@_`[1/E=SWXG_`[*[R#\[L!FV>^$WT'Y'83?
+M(8JT>O8[X7=0?@?A=XCRNY[]3O@=E-]!^!VB_*YGOQ-^!^5W$'YW8+/L=\+O
+MH/P.PN\015H]^YWP.RB_@_`[1/E=SWXG_`[*[R#\#E%^U[/?";^#\CL(OSNP
+M6?8[X7=0?@?A=X@BK2'UM1-^!^5W$'Z'*+\;V.^$WT'Y'83?(<KO!O8[X7=0
+M?@?A=P<VRWXG_`[*[R#\#E&D-;#?";^#\CL(OT.4WPWL=\+OH/P.PN\0Y7<#
+M^YWP.RB_@_"[`YMEOQ-^!^5W$'Z'*-(:V.^$WT'Y'83?(<KO!O8[X7=0?@?A
+M=XCRNX']3O@=E-]!^-V!S;+?";^#\CL(OT,4:0WL=\+OH/P.PN\0Y7<#^YWP
+M.RB_@_`[1/G=P'XG_`[*[R#\[L!FV>^$WT'Y71#305Y+NF3]]NG&=*W=JY+R
+M5_XIU"YY=76CL3X0BSXPS!367?V^A&LZZ_6%^38?;](O(LRW^7B3?A%AOLW'
+MF_2+"/-M/MZD7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%
+MA/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z
+M183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF
+M^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?!.?;-OI%<+YM
+MHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC
+M7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?
+M!.?;-OI%<+YMHU\$Y]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU\$
+MY]LV^D5POFVC7P3GVS;Z17"^;:-?!.?;-OI%<+YMHU]$F&_3\TWZ183Y-CW?
+MI%]$F&_3\TWZ183Y-CW?I%]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH
+M%Q'FVR;Z183YMHE^$6&^;:)?1)AOF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;
+MZ!<1YMLF^D6$^;:)?A%AOFVB7T28;YOH%Q'FVR;Z183YMHE^$6&^;:)?1)AO
+MF^@7$>;;)OI%A/FVB7X18;YMHE]$F&^;Z!<1YMLF^D6$^;:)?A%AOFVB7P3G
+MVS;Z18RF^D6,IOI%C*;Z18RF^D6,IOI%C*;Z18RF^D6,IOI%C*;Z18RF^D6,
+MIOI%C*;Z18RF^D6,IOI%C*;Z14QI:JA?Q&2J7\1DJE_$9*I?Q&2J7\1DJE_$
+M9*I?Q&2J7\1DJE_$9*I?Q&2J7\1DJE_$9*I?Q&2J7\1DJE_$9*I?/*=I:JA?
+M/+^XE_#!="\WN^H#\V5]>>'N7:KW^EWO:OR%A-__Y-)\\VQ]N?GZEOOUNMNK
+M#B_B,DV([1N7]S^^5K]\N5]OOMS6U-W&=+U?[X'U?7MW]W%\)=V+>S'_WNVN
+MZ;*7JRLF?Z/?Y?Z=.>^6RWL*%Q-7]\M=>_]X\WAS^^D7IEONUSOXV[@>7]UO
+M[=VKJS.^%W.>'SQ;$I&S3[@]VX3KL[[W9YXOQU'R?L>%NXMNL=Q1]SS,"R_<
+M>T7V,N$/]^/XW8?K/_[MAP]:OSPW7E]YH'XJA5M_2+1^B:[/6GN<EU^L7Y4E
+M5?7*M?E4OX?_KA<BUV==O]K7S]W?^<5_]]^XO#]M_[<FS'U"LQ7F[N:SZ5?_
+)!]R'M=*37@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow.gz.uu
new file mode 100644
index 0000000..97e3920
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow.gz.uu
@@ -0,0 +1,126 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.qcow.gz
+M'XL("+8S(E0``VEM9RTV,W@R-34M-3$R+6)S9"YQ8V]W+F]U=`"MG<F.&TFR
+M1??U%=0\2S2S(!FA&0V\!_2N>_/>MCBN^0'J?V\-$>Z9QG/+JM&E$H044G%!
+M>AX=`:H#UWK]Z]MJM;'5L%T-T^IR6'W_^?S=5G=^<O_[ZML___?O;^]^^_;;
+MKS%;_\%3Z>>[TVJ:Y^YM_:O/^8^GCJOU]"?FOG\WFKOSZN(_>'5WWNSMW,O?
+M?KU9?L[58-P;7,USZ_GUF3B]X<^]OJ_I[=JOT_OKWJZ+M[M1@]M[@_^8YWZ?
+M7Y^+M[M3<^.]N6MZNR[>[J3F]G\(BPM8#FKN6,P-^-1)S9V+N0T^=>$Y^X.O
+M[:^Y+3YE:LYQ;M7F=OA4J+GAWMSZ[0+T,C?B4X([*[F;\"G!G97<[?$IP9V5
+MW!WP*<&=E=P=\2G!G97<G?`IP9V7W)WQ*<&=E]Q=\"G!G5?<&3\EN/.*.R/?
+MN>+.*^Z,?.>*.Z^X,_*=*^Z\XL[(=ZZX\XH[(]^YXBXJ[HQ\%XJ[J+@S\ETH
+M[J+DCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>)N*+DC
+MWPV*NZ'DCGPW*.Z&BCOGIP1W0\6=D^\&Q=U0<>?DNT%Q-U3<.?EN4-P-%7=.
+MOAL4=T/%G9/O!L7=IN+.R7<;Q=VFXL[)=QO%W:;DCGRW4=QM2N[(=QO%W:;D
+MCGRW4=QM2N[(=QO%W:;DCGRW4=QM2N[(=QO%W;;DCGRW5=QM2^[(=UO%W;;B
+M+O@IP=VVXB[(=UO%W;;B+LAW6\7=MN(NR'=;Q=VVXB[(=UO%W;;B+LAW6\7=
+MKN(NR'<[Q=VNXB[(=SO%W:[DCGRW4]SM2N[(=SO%W:[DCGRW4]SM2N[(=SO%
+MW:[DCGRW4]SM2N[(=SO%W5AR1[X;%7=CR1WY;E3<C15W`S\EN!LK[@;RW:BX
+M&RON!O+=J+@;*^X&\MVHN!LK[@;RW:BX&RON!O+=J+A;_OI;SY'O)L7=5'$W
+MD.\FQ=U4<D>^FQ1W4\D=^6Y2W$TE=^2[27$WE=R1[R;%W51R1[Z;%'=3R1WY
+M;E+<[4ONR'=[Q=V^Y(Y\MU?<[2ON-OR4X&Y?<;<AW^T5=_N*NPWY;J^XVU?<
+M;<AW>\7=ON)N0[[;*^[V%7<;\MU><;?\;T@]1[X[*.X.%7<;\MU!<7<HN2/?
+M'11WAY([\MU!<7<HN2/?'11WAY([\MU!<7<HN2/?'11WAY([\MU!<7<LN2/?
+M'15WQY([\MU1<7>LN-OR4X*[8\7=EGQW5-P=*^ZVY+NCXNY8<;<EWQT5=\>*
+MNRWY[JBX.U;<;<EW1\7=J>)N2[X[*>Y.%7=;\MU)<7<JN2/?G11WIY([\MU)
+M<7<JN2/?G11WIY([\MU)<7<JN2/?G11WIY([\MU)<7<NN2/?G15WYY([\MU9
+M<7>NN-OQ4X*[<\7=CGQW5MR=*^YVY+NSXNY<<;<CWYT5=^>*NQWY[JRX.U?<
+M[<AW9\7=I>)N1[Z[*.XN%7<[\MU%<7<IN2/?711WEY([\MU%<7<IN2/?711W
+MEY([\MU%<7<IN2/?711WEY([\MU%<&?+!WH.?&=KP9VM2^[`=[86W-FZXF[D
+MIY@[*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>JO[.ROQO!=Z;Z.RO[NQ%\9ZJ_
+ML[*_&\%WIOH[*_N[$7QGJK^SLK\;P7>F^CLK^[L1?&>JO[.ROQO!=Z;Z.RO[
+MNQ%\9ZJ_L[*_&\%WIOH[*_N[$7QGJK^SLK\;R7>JO[.ROQO)=ZJ_L[*_F_@I
+MP5W9WTWD.]7?6=G?3>0[U=]9V=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9V=]-
+MY#O5WUG9WTWD.]7?6=G?3>0[U=]9V=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9
+MV=]-Y#O5WUG9WTWD.]7?6=G?3>0[U=]9V=]-Y#O5WUG9W^WY*<%=V=_MR7>J
+MO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W5O9W
+M>_*=ZN^L[._VY#O5WUG9W^W)=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]
+MG97]W9Y\I_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[P[\E."N[.\.Y#O5WUG9WQW(
+M=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6
+M]G<'\IWJ[ZSL[P[D.]7?6=G?'<AWJK^SLK\[D.]4?V=E?W<@WZG^SLK^[D"^
+M4_V=E?W=@7RG^CLK^[L#^4[U=U;V=T=^2G!7]G='\IWJ[ZSL[X[D.]7?6=G?
+M'<EWJK^SLK\[DN]4?V=E?W<DWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U
+M=U;V=T?RG>KOK.SOCN0[U=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N
+M2+Y3_9V5_=V1?*?Z.RO[NQ,_);@K^[L3^4[U=U;V=R?RG>KOK.SO3N0[U=]9
+MV=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y
+M3O5W5O9W)_*=ZN^L[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O5']G97]W(M^I_L[*
+M_NY$OE/]G97]W9F?$MR5_=V9?*?Z.RO[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5
+MWUG9WYW)=ZJ_L[*_.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[
+M,_E.]7=6]G=G\IWJ[ZSL[\[D.]7?6=G?G<EWJK^SLK\[D^]4?V=E?W<FWZG^
+MSLK^[L)/">[*_NY"OE/]G97]W85\I_H[*_N["_E.]7=6]G<7\IWJ[ZSL[R[D
+M.]7?6=G?7<AWJK^SLK^[D.]4?V=E?W<AWZG^SLK^[D*^4_V=E?W=A7RG^CLK
+M^[L+^4[U=U;V=Q?RG>KOK.SO+N0[U=_Y\D&:6_4Y\-WWIY@[3_W=<I_>JG,'
+MOG/5WWGJ[U8S=ZN%NUCS4\R=I_YN-7.W^KW-@>]<]7>>^KO5-9U=T/UWKOH[
+M3_U=.[L^![YSU=]YZN]@#GSGJK_SU-_!'/C.57_GJ;];YA[T.?"=J_[.4W_W
+M8)E;M3GPG:O^SE-_]V#F[D'G#GSGJK_SU-\]F+E[T+D#W[GJ[SSU=P^N-V<'
+MOG/5WWGJ[]K9]3GPG:O^SE-_!W/@.U?]G:?^#N;`=Z[Z.T_]W3+WL,^1[U1_
+MYZF_>[C,=>[(=ZJ_\]3?/9RY>]BXH_OO7/5WGOJ[AS-W#QMW=/^=J_[.4W_W
+M\)K/CNZ_<]7?>>KOVMGU.?*=ZN\\]7<P1[Y3_9VG_@[FR'>JO_/4WRUSC_H<
+M^4[U=Y[ZNT?+7...[K]SU=]YZN\>S=P]ZMR1[U1_YZF_>S1S]ZAS1[Y3_9VG
+M_N[1]>;LR'>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_GJ;];YA[W
+M.?*=ZN\\]7>/E[G.'?E.]7>>^KO',W>/&W=T_YVK_LY3?_=XYNYQXX[NOW/5
+MWWGJ[QY?\]G1_7>N^CM/_5T[NSY'OE/]G:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[
+M9>Y)GR/?J?[.4W_W9)EKW-']=Z[Z.T_]W9.9NR>=._*=ZN\\]7=/9NZ>=.[(
+M=ZJ_\]3?/;G>G!WY3O5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU
+M=\O<TSY'OE/]G:?^[NDRU[DCWZG^SE-_]W3F[FGCCNZ_<]7?>>KOGL[</6W<
+MT?UWKOH[3_W=TVL^.[K_SE5_YZF_:V?7Y\AWJK_SU-_!'/E.]7>>^CN8(]^I
+M_LY3?[?,/>MSY#O5WWGJ[YXM<XT[NO_.57_GJ;][-G/WK'-'OE/]G:?^[MG,
+MW;/.'?E.]7>>^KMGUYNS(]^I_LY3?]?.KL^1[U1_YZF_@SGRG>KO//5W,$>^
+M4_V=I_YNF7O>Y\AWJK_SU-\]7^8Z=^0[U=]YZN^>S]P];]S1_7>N^CM/_=WS
+MF;OGC3NZ_\Y5?^>IOWM^S6=']]^YZN\\]7?M[/H<^4[U=Y[Z.Y@CWZG^SE-_
+M!W/D.]7?>>KOEKD7?8Y\I_H[3_W=BV6N<4?WW[GJ[SSU=R]F[EYT[LAWJK_S
+MU-^]F+E[T;DCWZG^SE-_]^)Z<W;D.]7?>>KOVMGU.?*=ZN\\]7<P1[Y3_9VG
+M_@[FR'>JO_/4WRUS+_L<^4[U=Y[ZNY?+7.>.?*?Z.T_]W<N9NY>-.[K_SE5_
+MYZF_>SES][)Q1_??N>KO//5W+Z_Y[.C^.U?]G:?^KIU=GR/?J?[.4W\'<^0[
+MU=]YZN]@CGRG^CM/_=TR]ZK/D>]4?^>IOWNUS#7NZ/X[5_V=I_[NU<S=J\X=
+M^4[U=Y[ZNU<S=Z\Z=^0[U=]YZN]>76_.CGRG^CM/_5T[NSY'OE/]G:?^#N;(
+M=ZJ_\]3?P1SY3O5WGOJ[9>YUGR/?J?[.4W_W>IGKW)'O5'_GJ;][/7/WNG%'
+M]]^YZN\\]7>O9^Y>-^[H_CM7_9VG_N[U-9\=W7_GJK_SU-^UL^MSY#O5WWGJ
+M[V".?*?Z.T_]'<R1[U1_YZF_6^;>]#GRG>KO//5W;Y:YQAW=?^>JO_/4W[V9
+MN7O3N2/?J?[.4W_W9N;N3>>.?*?Z.T_]W9OKS=F1[U1_YZF_:V?7Y\AWJK_S
+MU-_!'/E.]7>>^CN8(]^I_LY3?[?,O>USY#O5WWG5WP7=?^>JO_.JOPNZ_\Y5
+M?^=5?Q=T_YVK_LZK_B[H_CM7_9U7_5W0_7>N^CNO^KN@^^]<]7=>]7=!]]^Y
+MZN]<]'?O^ASY3O5WGOJ[=\M<XX[NOW/5WWGJ[][-W+WKW)'O5'_GJ;][-W/W
+MKG-'OE/]G:?^[MWUYNS(=ZJ_\]3?M;/K<^0[U=]YZN]@CGRG^CM/_1W,D>]4
+M?Q?+!VENW>?`=Z'ZN^^?N,?=XJ=UYPY\%ZJ_B]3?K>>]=>..[K\+U=]%ZN_6
+M,W?KQAW=?Q>JOXO4WZVO^>SH_KM0_5VD_JZ=79\#WX7J[R+U=S`'O@O5WT7J
+M[V`.?!>JOXO4WRUSUN?`=Z'ZNTC]G2USC3NZ_RY4?Q>IO[/YY5GG#GP7JK^+
+MU-_9S)UU[L!WH?J[2/V=76_.#GP7JK^+U-^UL^MSX+M0_5VD_@[FP'>A^KM(
+M_1W,@>]"]7>1^KMESOL<^4[U=Y'Z.U_F.G?D.]7?1>KO?.;.&W=T_UVH_BY2
+M?^<S=]ZXH_OO0O5WD?H[O^:SH_OO0O5WD?J[=G9]CGRG^KM(_1W,D>]4?Q>I
+MOX,Y\IWJ[R+U=\M<]#GRG>KO(O5WL<PU[NC^NU#]7:3^+F;NHG-'OE/]7:3^
+M+F;NHG-'OE/]7:3^+JXW9T>^4_U=I/ZNG5V?(]^I_BY2?P=SY#O5WT7J[V".
+M?*?ZNTC]W3(W]#GRG>KO(O5WPS+7N2/?J?XN4G\WS-P-C3NZ_RY4?Q>IOQMF
+M[H;&'=U_%ZJ_B]3?#==\=G3_7:C^+E)_U\ZNSY'O5'\7J;^#.?*=ZN\B]7<P
+M1[Y3_5VD_FZ9V_0Y\IWJ[R+U=YMEKG%']]^%ZN\B]7>;F;M-YXY\I_J[2/W=
+M9N9NT[DCWZG^+E)_M[G>G!WY3O5WD?J[=G9]CGRG^KM(_1W,D>]4?Q>IOX,Y
+M\IWJ[R+U=\O<ML^1[U1_%ZF_VRYSG3ORG>KO(O5WVYF[;>..[K\+U=]%ZN^V
+M,W?;QAW=?Q>JOXO4WVVO^>SH_KM0_5VD_JZ=79\CWZG^+E)_!W/D.]7?1>KO
+M8(Y\I_J[2/W=,K?K<^0[U=]%ZN]VRUSCCNZ_"]7?1>KO=C-WN\X=^4[U=Y'Z
+MN]W,W:YS1[Y3_5VD_FYWO3D[\IWJ[R+U=^WL^ASY3O5WD?H[F"/?J?XN4G\'
+M<^0[U=]%ZN^6N;'/D>]4?Q>IOQN7N<X=^4[U=Y'ZNW'F;FS<T?UWH?J[2/W=
+M.',W-N[H_KM0_5VD_FZ\YK.C^^]"]7>1^KMV=GV.?*?ZNTC]'<R1[U1_%ZF_
+M@SGRG>KO(O5WR]S4Y\AWJK^+U-]-RUSCCNZ_"]7?1>KOIIF[J7-'OE/]7:3^
+M;IJYFSIWY#O5WT7J[Z;KS=F1[U1_%ZF_:V?7Y\AWJK^+U-_!'/E.]7>1^CN8
+M(]^I_BY2?[?,O>]SY#O5WT7J[]XO<YT[\IWJ[R+U=^]G[MXW[NC^NU#]7:3^
+M[OW,W?O&'=U_%ZJ_B]3?O;_FLZ/[[T+U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7
+MJ;^#.?*=ZN\B]7?+W(<^1[Y3_5VD_N[#,M>XH_OO0O5WD?J[#S-W'SIWY#O5
+MWT7J[S[,W'WHW)'O5'\7J;_[<+TY._*=ZN\B]7?M[/H<^4[U=Y'Z.Y@CWZG^
+M+E)_!W/D.]7?1>KOEKF/?8Y\I_J[2/W=QV6N<T>^4_U=I/[NX\S=Q\8=W7\7
+MJK^+U-]]G+G[V+BC^^]"]7>1^KN/UWQV=/]=J/XN4G_7SJ[/D>]4?Q>IOX,Y
+M\IWJ[R+U=S!'OE/]7:3^;IG[U.?(=ZJ_B]3??5KF&G=T_UVH_BY2?_=IYNY3
+MYXY\I_J[2/W=IYF[3YT[\IWJ[R+U=Y^N-V='OE/]7:3^KIU=GR/?J?XN4G\'
+M<^0[U=]%ZN]@CGRG^KM(_=TR][G/D>]4?Q>IO_N\S'7NR'>JOXO4WWV>N?O<
+MN*/[[T+U=Y'ZN\\S=Y\;=W3_7:C^+E)_]_F:SX[NOPO5WT7J[]K9]3GRG>KO
+M(O5W,$>^4_U=I/X.YLAWJK^+U-\M<U_Z'/E.]7>1^KLORUSCCNZ_"]7?1>KO
+MOLS<?>G<D>]4?Q>IO_LR<_>E<T>^4_U=I/[NR_7F[,AWJK^+U-^UL^MSY#O5
+MWT7J[V".?*?ZNTC]'<R1[U1_-RP?I+FO?0Y\-ZC^;DC]W==EKG,'OOO^%',W
+MI/[NZ\S=UX6[8<U/,7=#ZN^^SMQ]_;W-T;^WW8Y(?N+;V_3MVV\O?PYN?KZ^
+MP5?K/?RH/_'M;V_O_]<&?UX(L]FMALUJLUV-_F=?X?__S_^E5_AK[B][P[_F
+MZ!\8OS>WO.`FO)NY+W?F?@C^<N=7KNW.4T?K?UP?QYL_NG]\^_SVCI$W="%,
+MG_M!])D^(=\L_0/C_PTL-Y>NW/TZ_[QD-U;KY2_<T\V5[>N[ZJ^/(N9[;_</
+M7M_J]NW^E.CN_J^W.W->O-W5_;F?$KWS];SW)2Q.[_/MJZ-_Q/N_^6+<7!WR
+M)W_G_ABY_SOWUYS_M2+8_33+#\_MX4?]B6__>'O_OU^#P\_!W_X-BB07FH&E
+"````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow2.gz.uu
new file mode 100644
index 0000000..3663da0
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.qcow2.gz
+M'XL("*P[(U0``VEM9RTV,W@R-34M-3$R+6)S9"YQ8V]W,BYO=70`K9C;DM,P
+M#(;O^Q3F#`N46').'+:PL,QP!S=PW7;;I^CP[*QK)4H4*5XZ:3N9Z;C_-W+\
+M64E:%.GE7.E=J%QHW7'G[K_3!]S@R_CC3K^^_U@/7Z=5@OG"2"D#]:''C5A_
+M&0<6KO#3`:_C!M6A@H,N-07E<,&L;FY`P5VMSJ?NO!B-2.`EP(0S%^.B^B#5
+M)Q/APOI@Z?I0/W]EEY,#U7Q]F.J3J=K"-5D<**G6PFVS.%12.PNWS^*"DKJS
+M<,;.'>!*)74T<#ZCRCVN4E+>PD$65RLIM'`ABVN4E.6=SWO7*BG+.Y_W;JND
+M+.]\WKN=DK*\\WGO]DK*\L[GO;M34I9W8'CG&'=04I9W(+Q[1+C'C#LJ*<L[
+M$-X](=S3'N>UE.4=".^>$>XYXY1^!Y9W(+Q[0;B7C%/Z'5C>@?#N%>&N&*?T
+M.["\`^'=:\*]89S2[\#R#H1W;R?>>:7?@>4="N_>$:M@G-+OT/(.A7>><,`X
+MI=^AY1T*[Y!P@7%*OT/+.Q3>E82K&*?T.[2\0^%=3;B&<4J_0\L[%-ZUA'O/
+M.*7?H>4="N\^$.XCXY1^AY9W*+S[1+AKQBG]#BWO@O!N0[C/C%/Z7;"\"\*[
+M+X2[89S2[X+E71#>?27<MQX'6JKWKBCT#^%N)WL6EKW_#'Q_[)6C/3`#;/X'
+M.%=APK6+3KA,$XX:;)6C/7"Z68_?/?"\PF4=5[6L7`,/K?#/[>_IA,L%5SCA
+M[,=1&N@*[K?@!+<9X.(5[3CXY7`=W=[S]A\2![CKQ.MPLX^C\1[[H`V8DRT7
+ME@4:D1NN<[RUBW?@77<7MV;]^CJN3Y$91M.=J<]-IQNO&OW3G5B/B(/,=-T8
+M%Z\:8E_R$F;.WF9:W7[AQ4"Y,QZX<R-DO',3#I9M!)#^ERKBKZ9'>^#T<SU^
+5)V`@X&)G,%2Q]ZW^`:W<QSE#$P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.raw.gz.uu
new file mode 100644
index 0000000..31141a5
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.raw.gz
+M'XL("/;%'50``VEM9RTV,W@R-34M-3$R+6)S9"YR87<N;W5T`*V4.PZ#,`Q`
+M=T[AN4.4;TD7*E7JWJF=*853Y/!-@!2;$.@0!R(BVT_^X'`^"8"6P-N-/:]P
+M-T:7JT[52),!:&K0!LP9K#?GRT,.1.%>]R?#XF:<V//*X]A*(DX>X6+`:LCA
+MK@BGO')`EEP@KTZ`ZN<#_D:X9GHC3N]%YRO!^RU%-EE3JG:QMW;EA_L,H@>A
+M@-M9)RGPUU]8XKND84B2[DY\D*;;!EQ-[07"R8-T@>+>`8?Z25IX4+TFC:XK
+MW`RUGHP_)S=`Z.1..%GV(I#CS>+_0&^5[GF%>S"Z)J">@<4J6'^L)U9?N.5M
+%L04%````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.vhd.gz.uu
new file mode 100644
index 0000000..963b186
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.vhd.gz.uu
@@ -0,0 +1,17 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.vhd.gz
+M'XL("!XUQ%4``VEM9RTV,W@R-34M-3$R+6)S9"YV:&0N;W5T`*V6R4[#,!"&
+M[WV*D;AQJ)RQ8X<+2$C<.<$Y35-4(191#CVD[\Z,%V)G*XN;U')DS^=_%EL6
+MPOT`M`2]`]V"+KEO%.@K,!4`#?H7;5OX3^B:M]>V^=P?U_[7K1RL$+%5:L[V
+M*$'1(@:PYD7TEOO0!<SZXN[I<O_R%'#H<>A!I6$KB:`WHW7,%BJWCL4][O'9
+M(D^].CE6UULY!W<[D+MHA@SJ3K:]B9U59$7S^2UA8VQ\PIM\)`.]LX/8E6)@
+M%<F<"JKHG9W"Z26KW^`N5SX7KE2H,`RU`G0!!KE/91/B,'JI5(Z']_KCT`[T
+MX4RIZ"@9PS$U[R[Z4L$PV2M0+'#)7;"4PQ`W42K_BIY.[93O4!!$&0;0NI]&
+MKT=!K$\78B'F\\F8U5>S/D4[H9YHYP>ZVW7Z?`,;!M)^I>U>:K_'?A+!Q[N'
+MJ?PV,^7RQ]W1X#E<$!R?!BGN)L))EXZ>$A4O-`7(UG_$_0AW[?X!IY;4<<VT
+M4P.SSI:9B[FI!G9QGJ%HH9`@JJBJ(^!W?J'7=S66@8F["_I@[&[-.)/.+R(<
+MGG$74MS&G\MA9I+",]&['JMK,B=C.]P9/]RY#$EWKL-AWH,`[<E"%4BSQNW\
+M0'>_3A\'1']493O[,!Q5N10J#\RFD(!M9H78+A;;;ZM08V5=SG219%S&BR3C
+B,EXD&9?Q(LFXC!=)QF6\2#(NZT62@%1[JR_1)]26?0P`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.vhdf.gz.uu
new file mode 100644
index 0000000..f71cccd
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.vhdf.gz
+M'XL("(XEAE4``VEM9RTV,W@R-34M-3$R+6)S9"YV:&1F+F]U=`"ME#MOPR`0
+M@'?_BI.Z9;#@>)@L350I>Z=V=EP<157;I4,'?GPA-C%G_*@J`[:,COM\#^X8
+MZP:`1&#UQ'M>X)Y*.EVQ*VXT#$!5@52@-!A_G`V+;(C`O9Y>RG2X'L>7M.9Q
+MY6A$'*[AHL&BG<,=$ISPPC8YR7BBU7`0=MC+"=RC?XX#3BY9YR/![)1@UEFU
+M5>QB;LU(+\TS<`M<`#.]#"GPGE\8[-OG9B!Q=\$^R-VM`ZZBYWF"PQ5W@>+.
+M`<?)X2&%*]$[YM8U&R=#C"OCCY4;(+1R.QQNVPCPUEG\#?2G\O>\P#V7='9`
+MV0,WBZ#I>Y\6H%O0%K0*WY4$O8?*I$"D-\DU7Y^V^;[^I!D..-XU@\D5]%&$
+M:M$58!U^HM_"=V+?P^FRNWY<(BZVJMB1?+%Y+8&@SYF[9E1L5WP?6R?R(!D2
+M/1[L3-N>_S.)WB'%R;NSUD+3Q2<NLB&"R585<(J-M/Z;VPZG-[XJ_O(5OUHQ
+&I0DP!P``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-bsd.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-bsd.vmdk.gz.uu
new file mode 100644
index 0000000..79b142e
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-bsd.vmdk.gz.uu
@@ -0,0 +1,81 @@
+# $FreeBSD$
+begin 644 img-63x255-512-bsd.vmdk.gz
+M'XL("/?%'50``VEM9RTV,W@R-34M-3$R+6)S9"YV;61K+F]U=`"MG%MO(\<1
+MA=_]*QKR6QZ(.9S[PR:.(P<(@@"&;=BOYMQB(?;N0BL$68`_/M,S?5IG1(U[
+M8)7,7;*65<7NZF&)_NJ`6;;^.%=TKBA<,;BR<AG<_$_KS67YLS'?BOC$]9_W
+M__KQQ)^O3J?K%VLR^"@)0:;IQ-B\SO7TXH?ISK\7M7EBOIV3Z7(?U=T$AG3G
+MG2=VT\WU<.?70KBZR_+TX!](.A<3N4VZ\I4][6[V]U;WIR]"\?SZ<K^&^7BK
+MUM6YJ[I@NJI<[-S5Y^6YS-6STS0G_-+=/WSZC[L?/_6/#Q^?/H3UG?W9SLY%
+MY?VKWF>8-U97_H%_PJ=K?8IJ=/G@<OBGW?7Q[P^_CJ?_CH^?'CZ\?P=N]^S/
+MMLA=T?KE>/_L^;8Q_(MDKH)_#7?]VS_NWX4K-SM]O#PRG8^:%S*_]KP/S5M5
+MSO^YO2VK&]\_^8Q3^(FK\V<;BE,NKUWX!V7AZM8MRRE][O/\]!"VO-2N?QPO
+M3^,/GS^.[^Y^^_`^ULZ?K2]9NR1JED+EKLQ]JK`U7[[29_27S7)J[OKKP],O
+M#_WW\S8_C7>G+QW35;YV\P$V85WKKN>0:O=DYV5?O_G?T[Q?-X23?6"Z91'+
+M)N;7+L^NK'VN^0#SN79Y[O+&Y4OZ><'S3@IX)W?]\/[TW4\.5=X4[OMO__H=
+MTS5SNMES7N`<,F]HLZ=RW7_Y\K)TU^^_<7=^DS_\,BY7(-.UZ]O,.Z_G@,4\
+M^P>A:FMZW\0*_\1RLN[^\G1Q7U\^C:<O[^^_CB=[\9LMEMN\M-%GJ=;4_OI>
+MRCD7;CWI]:"7HQB&[G09+A^?QD=_O/$H.G^U#F&G_EB+YV/<ODZ]G-3DKQAW
+M?>?N'H;Y3'W:?X\??F.Z?KV,YW7X2Z)=`G/_8+YZEO1C>(7UBO''Y-.-3X^?
+M3_WG7Q_>#_,;S;UCNF&MW;R<^3371<4UO5Q4?-FY=G=X7MJ<F^E&7Z)U44UX
+M8\RYUG4\5R&?;Z6_A2I</Y]^&2_#O"QW=R[+NW@4T\NCT!*]J,)ZT',MUJ,(
+M"_M\^C3V(5V>A0.<-L59U^0OY?E*7E>T;:!/'QZ7I57YG?;C_.7OLK?VX^+F
+M5VK]!Q.NZ:S75V4O?I_E&E>(46X2^M]BV?HQX/3M\_HJO[Y*/&N-:L1H-^E^
+MGE-\O-UNY2^QBWAV&M6+,1RI7N5_7XSB.;VL'C]J0![OI^-G`7KF&E6(46[2
+M[=6N#+6C9ZU1C1CM)MU>[:I0.WIV&M6+,1S:;!UJ1\])H_P=/THA._"QK&I"
+M[>B9:U0A1KE)MU>[-M2.GK5&-6*TFW1[M;N$VM&STZA>C.'09KM0.WI.&N7O
+MV"`@C_?3]:%V],PUJA"CW*3;J]T0:D?/6J,:,=I-NKW:C:%V].PTJA=C.+39
+M*=2.GI-&^;M":E>DTM59J!T]<XTJQ"@WZ79J5[/?T;/6J$:,=I-NIW8U^QT]
+M.XWJQ1@.;9;]CIZ31OF[4FI7)M.QW]$SUZA"C'*3;J]V['?TK#6J$:/=I-NK
+M'?L=/3N-ZL48#FV6_8Z>DT;YNTIJ5R73L=_1,]>H0HQRDVZO=NQW]*PUJA&C
+MW:3;JQW['3T[C>K%&`YMEOV.GI-&^3M^"((\WD_'?D?/7*,*,<I-NKW:L=_1
+ML]:H1HQVDVZO=NQW].PTJA=C.+19]CMZ3AKE[QJI79-*UV2A=O3,-:H0H]RD
+MVZE=PWY'SUJC&C':3;J=VC7L=_3L-*H78SBT6?8[>DX:Y>]:J5V;3,=^1\]<
+MHPHQRDVZO=JQW]&SUJA&C':3;J]V['?T[#2J%V,XM%GV.WI.&N7O^+]0D,?[
+MZ=COZ)EK5"%&N4FW5SOV.WK6&M6(T6[2[=6._8Z>G4;U8@R'-LM^1\])H_P=
+M^2/D\7XZ]CMZYAI5B%%NTNW5COV.GK5&-6*TFW1[M6._HV>G4;T8PZ'-LM_1
+M<](H?]=+[?I4NC8+M:-GKE&%&.4FW4[M6O8[>M8:U8C1;M+MU*YEOZ-GIU&]
+M&,.AS;+?T7/2*'\W2.V&9#KV.WKF&E6(46[2[=6._8Z>M48U8K2;='NU8[^C
+M9Z=1O1C#H<VRW]%STBA_-TKMQF0Z]CMZYAI5B%%NTNW5COV.GK5&-6*TFW1[
+MM6._HV>G4;T8PZ'-LM_1<](H?S=)[:9D.O8[>N8:58A1;M+MU8[]CIZU1C5B
+MM)MT>[5COZ-GIU&]&,.AS;+?T7/2J$RF9Y#'N^DNV5J[Z)EK5"%&N4FW4[M+
+MZ'?1L]:H1HQVDVZG=I?0[Z)GIU&]&,.AS89^%STGC?(E$WZ')-*ZA'X'X7=0
+M?@?A=TCRNTOH=Q!^!^5W$'Z')+^[A'X'X7=0?@?A=P<V&_H=A-]!^1V$WR&)
+MM"ZAWT'X'93?0?@=DOSN$OH=A-]!^1V$WR')[RZAWT'X'93?0?C=@<V&?@?A
+M=U!^!^%W2"*M2^AW$'X'Y7<0?H<DO[N$?@?A=U!^!^%W2/*[2^AW$'X'Y7<0
+M?G=@LZ'?0?@=E-]!^!V22*O+0NV$WT'Y'83?(<GO.O8[X7=0?@?A=TCRNX[]
+M3O@=E-]!^-V!S;+?";^#\CL(OT,2:77L=\+OH/P.PN^0Y'<=^YWP.RB_@_`[
+M)/E=QWXG_`[*[R#\[L!FV>^$WT'Y'83?(8FT.O8[X7=0?@?A=TCRNX[]3O@=
+ME-]!^!V2_*YCOQ-^!^5W$'YW8+/L=\+OH/P.PN^01%H=^YWP.RB_@_`[)/E=
+MQWXG_`[*[R#\#DE^U['?";^#\CL(OSNP6?8[X7=0?@?A=T@BK3X+M1-^!^5W
+M$'Z')+_KV>^$WT'Y'83?(<GO>O8[X7=0?@?A=P<VRWXG_`[*[R#\#DFDU;/?
+M";^#\CL(OT.2W_7L=\+OH/P.PN^0Y'<]^YWP.RB_@_"[`YMEOQ-^!^5W$'Z'
+M)-+JV>^$WT'Y'83?(<GO>O8[X7=0?@?A=TCRNY[]3O@=E-]!^-V!S;+?";^#
+M\CL(OT,2:?7L=\+OH/P.PN^0Y'<]^YWP.RB_@_`[)/E=SWXG_`[*[R#\[L!F
+MV>^$WT'Y'83?(8FTABS43O@=E-]!^!V2_&Y@OQ-^!^5W$'Z')+\;V.^$WT'Y
+M'83?'=@L^YWP.RB_@_`[))'6P'XG_`[*[R#\#DE^-[#?";^#\CL(OT.2WPWL
+M=\+OH/P.PN\.;);]3O@=E-]!^!V22&M@OQ-^!^5W$'Z')+\;V.^$WT'Y'83?
+M(<GO!O8[X7=0?@?A=P<VRWXG_`[*[R#\#DFD-;#?";^#\CL(OT.2WPWL=\+O
+MH/P.PN^0Y'<#^YWP.RB_@_"[`YMEOQ-^!^5W44P'>2SIW/HGI!NSM7:O2LI?
+M^:=8._?JZD9C?2`6?6"<*:R[^F,)UW36ZXOS;=[>I%]$G&_S]B;](N)\F[<W
+MZ1<1Y]N\O4F_B#C?-M$O(LZW3?2+B/-M$_TBXGS;1+^(.-\VT2\BSK=-](N(
+M\VT3_2+B?-M$OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+
+MB/-M$_TBXGS;1+^(.-\VT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1+R+.MTWT
+MBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+B/-M$_TBXGS;1+\(SK=M](O@?-M&
+MOPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(SK=M](O@?-M&OPC.MVWTB^!\VT:_
+M",ZW;?2+X'S;1K\(SK=M](O@?-M&OPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(
+MSK=M](O@?-M&OPC.MVWTB^!\VT:_",ZW;?2+X'S;1K\(SK=M](O@?-M&OPC.
+MMVWTB^!\VT:_",ZW;?2+X'S;1K\(SK=M](O@?-M&OX@XWZ;GF_2+B/-M>KY)
+MOX@XWZ;GF_2+B/-M>KY)OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_B#C?-M$O
+M(LZW3?2+B/-M$_TBXGS;1+^(.-\VT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1
+M+R+.MTWTBXCS;1/](N)\VT2_B#C?-M$O(LZW3?2+B/-M$_TBXGS;1+^(.-\V
+MT2\BSK=-](N(\VT3_2+B?-M$OX@XWS;1+R+.MTWTBXCS;1/](N)\VT2_",ZW
+M;?2+&$WUBQA-]8L83?6+&$WUBQA-]8L83?6+&$WUBQA-]8L83?6+&$WUBQA-
+M]8L83?6+&$WUBQA-]8L83?6+F++,4+^(R52_B,E4OXC)5+^(R52_B,E4OXC)
+M5+^(R52_B,E4OXC)5+^(R52_B,E4OXC)5+^(R52_B,E4OXC)5+]XSK+,4+]X
+MOODNX8/I;C>[Z@.+97WKMX/>_KW_Q/7KT_:_F'#Y@MVR]E]T6E:N.1]=X4_?
+M_/C*AHNSV8;7=#=?GOPR7>1=TUZZOT@ZW^`G\=Q\%W,/EX_/=O%*NC^?Y)NB
+MB^4+=G=7IW.*8YLU_O+D8OD26_75<_8=QH,??IY_\=Z(Y^N>U]?>+N.\V>[O
+MK,_=;M<W4?WZ4#V/S;MU9[MNF\XW43W/S1$FJO?5[>IZX\.X^2K6@^]<GV3[
+FSEW3G6T;0;5TEG7X?_OW_A/7;T_;_]:$Q9+PB_\#AU-ESJ!=````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow.gz.uu
new file mode 100644
index 0000000..39509f6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow.gz.uu
@@ -0,0 +1,128 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.qcow.gz
+M'XL("%+N+50``VEM9RTV,W@R-34M-3$R+65B<BYQ8V]W+F]U=`"MG=F.5-D1
+M1=_YBF2&8LJ(N"-#5<F2+?G-?K#]VG=\S@]`_G8#=8:JN'L3M+MIU`+1=ROS
+MU,I%V[UT.)_OOIU.K9R:[M2,IWT^??MY^BZG>S]Y^/WT]9]_^_O[^]^^/KH;
+MD_-/GG(_[[<R]V#KOW5.OS^UG,[C+\Q]^RYH[MZKL]_QZNZ]V>/<U:.[-XN?
+M4S9H#P9/:>Z<7I^0TVM^[?7=NK<K=Z?WY[U=)6^W_;7!?[C7I[\+EE]Z?;_S
+MZ]O!P=_*ZVO@4SV;&Q[,70YOMX5/C6QN^BG,>N[@4S.;6X*Y'CZULKDMF!O@
+M4SN>DY]\;>_F1OB4L#F%<Z<R-\&GC,TU#^;.:>ZVS,WP*?*Y$,==_EQ4[A;X
+M%.%.0NY6^!3A3D+N-O@4X4Y"[G;X%.%.(NX$/T6XTX@[08I2QIU&W`DRLC+N
+M-.).D.^4<:<1=X)\IXP[C;@3Y#MEW&G$G2#?*>-.(^X$^4X9=QIRAWRGC#L+
+MN4.^,\:=A=PAWQGCSD+ND.^,<6<A=\AWQKBSD#OD.V/<6<@=\ITQ[BSD#OG.
+M&'<6<:?X*<)=$W&GR'<-XZZ)N%/DNX9QUT3<*?)=P[AK(NX4^:YAW#41=XI\
+MUS#NFH@[1;YK&'=-Q)TBWS6,NR;D#OFN8=RU(7?(=RWCK@VY0[YK&7=MR!WR
+M7<NX:T/ND.]:QET;<H=\US+NVI`[Y+N6<=>&W"'?M8R[-N+.\%.$NR[BSI#O
+M.L9=%W%GR'<=XZZ+N#/DNXYQUT7<&?)=Q[CK(NX,^:YCW'41=X9\US'NNH@[
+M0[[K&'==R!WR7<>XZT/ND.]ZQET?<H=\US/N^I`[Y+N><=>'W"'?]8R[/N0.
+M^:YGW/4A=\AW/>.N#[E#ONL9=WW$78.?(MP-$7<-\MW`N!LB[AKDNX%Q-T3<
+M-<AW`^-NB+AKD.\&QMT0<=<@WPV,NR'BKD&^&QAW0\1=@WPW,.Z&D#ODNX%Q
+ME__O>3Z'?#<R[L:0.^2[D7$WAMPAWXV,NS'D#OEN9-R-(7?(=R/C;@RY0[X;
+M&7=CR!WRW<BX&R/N6OP4X6Z*N&N1[R;&W11QUR+?38R[*>*N1;Z;&'=3Q%V+
+M?#<Q[J:(NQ;Y;F+<31%W+?+=Q+B;(NY:Y+N)<3>%W"'?38R[_)])^1SRW<RX
+MFT/ND.]FQMT<<H=\-S/NYI`[Y+N9<3>'W"'?S8R[.>0.^6YFW,TA=\AW,^-N
+MCKCK\%.$NR7BKD.^6QAW2\1=AWRW,.Z6B+L.^6YAW"T1=QWRW<*X6R+N.N2[
+MA7&W1-QUR'<+XVZ)N.N0[Q;&W1)RAWRW,.[6D#ODNY5QMX;<(=^MC+LUY`[Y
+M;F7<K2%WR'<KXVX-N4.^6QEW:\@=\MW*N%M#[I#O5L;=&G'7XZ<(=R00NC>'
+M?+<Q[K:(NQ[Y;F/<;1%W/?+=QKC;(NYZY+N-<;=%W/7(=QOC;HNXZY'O-L;=
+M%G'7(]]MC+LMY`[Y;F/<[2%WR'<[XVX/N4.^VQEW>\@=\MW.N-M#[I#O=L;=
+M'G*'?+<S[O:0.^2[G7&WA]PAW^V,NSWB;L!/8>XD_X#/`=_)F7`GYXB[`?A.
+MSH0[.4?<#<!WPOI`\?W=@;L!^$Y8?R=A?S<`WPGK[R3L[P;@.V']G83]W0!\
+M)ZR_D["_&X#OA/5W$O9W`_"=L/Y.POYN`+X3UM])V-\-P'?"^CL)^[L!^$Y8
+M?R=A?S<`WPGK[R3L[P;@.V']G83]W0!\)ZR_D["_&_%3A+NPOQN1[UA_)V%_
+M-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W(_(=Z^\D[.]&Y#O6
+MWTG8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[
+M$?F.]7<2]G<C\AWK[R3L[T;D.];?2=C?3?@IPEW8WTW(=ZR_D["_FY#O6'\G
+M87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2]G<3\AWK[R3L[R;D
+M.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<AW['^3L+^;D*^8_V=A/W=A'S'^CL)
+M^[L)^8[U=Q+V=Q/R'>OO).SO9OP4X2[L[V;D.];?2=C?S<AWK+^3L+^;D>]8
+M?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U=Q+V=S/R'>OO).SO
+M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z
+M.PG[NQGYCO5W$O9W"WZ*<!?V=POR'>OO).SO%N0[UM])V-\MR'>LOY.POUN0
+M[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D
+M[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!OF/]G83]W8)\
+MQ_H["?N[%3]%N`O[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6WTG8WZW(=ZR_D["_
+M6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[%?F.]7<2]G<K\AWK
+M[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8?R=A?[<BW['^3L+^;D6^8_V=A/W=
+MAI\BW(7]W89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D.];?2=C?;<AWK+^3
+ML+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=AGS'^CL)^[L-^8[U=Q+V=QOR
+M'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0[UA_)V%_MR'?L?Y.POYNQT\1[L+^
+M;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO=N0[UM])V-_MR'>L
+MOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC_9V$_=V.?,?Z.PG[NQWYCO5W$O9W
+M._(=Z^\D[.]VY#O6WTG8W^W(=ZR_D["_VY'O6'\G47]G9_P4YD[S#]S<J<X!
+MWWU["G.GKK_+]_V=3F4.^$Y9?Z>NOSLE[DZW90[X3EE_IZZ_.R7N3K^5.>`[
+M9?V=NO[N=#F<'?"=LOY.77]7SJ[.`=\IZ^_4]7=@#OA.67^GKK\#<\!WROH[
+M=?U=GGM<YX#OE/5WZOJ[QWFN<@=\IZR_4]??/4[</:[<`=\IZ^_4]7>/$W>/
+M*W?`=\KZ.W7]W>/+X>R`[Y3U=^KZNW)V=0[X3EE_IZZ_`W/`=\KZ.W7]W7$.
+MW7^GK+]3U]_EN2=U#OF.]7?J^KLG>:YPA^Z_4];?J>OOGB3NGA3NT/UWROH[
+M=?W=D\3=D\(=NO].67^GKK][<CF<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.^8[U
+M=^KZ.S"'?,?Z.W7]79Y[6N>0[UA_IZZ_>YKG*G?(=ZR_4]??/4W</:W<(=^Q
+M_DY=?_<T<?>T<H=\Q_H[=?W=T\OA[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>L
+MOU/7WQWGT/UWROH[=?U=GGM6YY#O6'^GKK][EN<*=^C^.V7]G;K^[EGB[EGA
+M#MU_IZR_4]??/4O</2O<H?OOE/5WZOJ[9Y?#V2'?L?Y.77]7SJ[.(=^Q_DY=
+M?P?FD.]8?Z>NOP-SR'>LOU/7W^6YYW4.^8[U=^KZN^=YKG*'?,?Z.W7]W?/$
+MW?/*'?(=Z^_4]7?/$W?/*W?(=ZR_4]??/;\<S@[YCO5WZOJ[<G9U#OF.]7?J
+M^CLPAWS'^CMU_=UQ#MU_IZR_4]??Y;D7=0[YCO5WZOJ[%WFN<(?NOU/6WZGK
+M[UXD[EX4[M#]=\KZ.W7]W8O$W8O"';K_3EE_IZZ_>W$YG!WR'>OOU/5WY>SJ
+M'/(=Z^_4]7=@#OF.]7?J^CLPAWS'^CMU_5V>>UGGD.]8?Z>NOWN9YRIWR'>L
+MOU/7W[U,W+VLW"'?L?Y.77_W,G'WLG*'?,?Z.W7]W<O+X>R0[UA_IZZ_*V=7
+MYY#O6'^GKK\#<\AWK+]3U]\=Y]#]=\KZ.W7]79Y[5>>0[UA_IZZ_>Y7G"G?H
+M_CME_9VZ_NY5XNY5X0[=?Z>LOU/7W[U*W+TJW*'[[Y3U=^KZNU>7P]DAW['^
+M3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\#<\AWK+]3U]_EN==U#OF.]7?J^KO7
+M>:YRAWS'^CMU_=WKQ-WKRAWR'>OOU/5WKQ-WKRMWR'>LOU/7W[V^',X.^8[U
+M=^KZNW)V=0[YCO5WZOH[,(=\Q_H[=?W=<0[=?Z>LOU/7W^6YJSJ'?,?Z.W7]
+MW56>*]RA^^^4]7?J^KNKQ-U5X0[=?Z>LOU/7WUTE[JX*=^C^.V7]G;K^[NIR
+M.#OD.];?J>OORMG5.>0[UM^IZ^_`'/(=Z^_4]7=@#OF.]7?J^KL\]Z;.(=^Q
+M_DY=?_<FSU7ND.]8?Z>NOWN3N'M3N4.^8_V=NO[N3>+N3>4.^8[U=^KZNS>7
+MP]DAW['^3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\[SJ'[[Y3U=^KZNSSWMLXA
+MW['^3EU_]S;/%>[0_7?*^CMU_=W;Q-W;PAVZ_TY9?Z>NOWN;N'M;N$/WWRGK
+M[]3U=V\OA[-#OF/]G;K^KIQ=G4.^8_V=NOX.S"'?L?Y.77\'YI#O6'^GKK_+
+M<^_J'/(=Z^_4]7?O\ESE#OF.]7?J^KMWB;MWE3OD.];?J>OOWB7NWE7ND.]8
+M?Z>NOWMW.9P=\AWK[]3U=^7LZASR'>OOU/5W8`[YCO5WZOJ[XQRZ_TY9?Z>N
+MO\MS[^L<\AWK[S3J[PS=?Z>LO].HOS-T_YVR_DZC_L[0_7?*^CN-^CM#]]\I
+MZ^\TZN\,W7^GK+_3J+\S=/^=LOY.H_[.T/UWROH[)?W=ASJ'?,?Z.W7]W8<\
+M5[E#OF/]G;K^[D/B[D/E#OF.]7?J^KL/B;L/E3OD.];?J>OO/EP.9X=\Q_H[
+M=?U=.;LZAWS'^CMU_1V80[YC_9VZ_NXXA^Z_4];?6?Z!FSO7.>`[8_W=MU]X
+MP%WVT[EPA^Z_,];?F>OOSFGO7+A#]]\9Z^_,]7?GQ-VY<(?NOS/6WYGK[\Z7
+MP]D!WQGK[\SU=^7LZASPG;'^SEQ_!^:`[XSU=^;Z.S`'?&>LOS/7W^4YJ7/`
+M=\;Z.W/]G>2YRAWPG;'^SEQ_)^GE2>4.^,Y8?V>NOY/$G53N@.^,]7?F^CNY
+M',X.^,Y8?V>NORMG5^>`[XSU=^;Z.S`'?&>LOS/7WQWGT/UWQOH[<_U=GM,Z
+MAWS'^CMS_9WFN<(=NO_.6']GKK_3Q)T6[M#]=\;Z.W/]G2;NM'"'[K\SUM^9
+MZ^_T<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5W8`[YCO5WYOJ[/&=U
+M#OF.]7?F^CO+<Y4[Y#O6WYGK[RQQ9Y4[Y#O6WYGK[RQQ9Y4[Y#O6WYGK[^QR
+M.#OD.];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7?'.73_G;'^SEQ_E^>:.H=\
+MQ_H[<_U=D^<*=^C^.V/]G;G^KDG<-84[=/^=L?[.7'_7).Z:PAVZ_\Y8?V>N
+MOVLNA[-#OF/]G;G^KIQ=G4.^8_V=N?X.S"'?L?[.7'\'YI#O6']GKK_+<VV=
+M0[YC_9VY_J[-<Y4[Y#O6WYGK[]K$75NY0[YC_9VY_JY-W+65.^0[UM^9Z^_:
+MR^'LD.]8?V>NORMG5^>0[UA_9ZZ_`W/(=ZR_,]??'>?0_7?&^CMS_5V>Z^H<
+M\AWK[\SU=UV>*]RA^^^,]7?F^KLN<=<5[M#]=\;Z.W/]79>XZPIWZ/X[8_V=
+MN?ZNNQS.#OF.]7?F^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L_U
+M=0[YCO5WYOJ[/L]5[I#O6']GKK_K$W=]Y0[YCO5WYOJ[/G'75^Z0[UA_9ZZ_
+MZR^'LT.^8_V=N?ZNG%V=0[YC_9VY_@[,(=^Q_LY<?W><0_??&>OOS/5W>6ZH
+M<\AWK+\SU]\->:YPA^Z_,];?F>OOAL3=4+A#]]\9Z^_,]7=#XFXHW*'[[XSU
+M=^;ZN^%R.#OD.];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\
+M-]8YY#O6WYGK[\8\5[E#OF/]G;G^;DS<C94[Y#O6WYGK[\;$W5BY0[YC_9VY
+M_FZ\',X.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_W=<0[=?V>LOS/7W^6Y
+MCW4.^8[U=^;ZNX]YKG"'[K\SUM^9Z^\^)NX^%N[0_7?&^CMS_=W'Q-W'PAVZ
+M_\Y8?V>NO_MX.9P=\AWK[\SU=^7LZASR'>OOS/5W8`[YCO5WYOH[,(=\Q_H[
+M<_U=GOM4YY#O6']GKK_[E.<J=\AWK+\SU]]]2MQ]JMPAW['^SEQ_]REQ]ZER
+MAWS'^CMS_=VGR^'LD.]8?V>NORMG5^>0[UA_9ZZ_`W/(=ZR_,]??'>?0_7?&
+M^CMS_5V>^USGD.]8?V>NO_N<YPIWZ/X[8_V=N?[N<^+N<^$.W7]GK+\SU]]]
+M3MQ]+MRA^^^,]7?F^KO/E\/9(=^Q_LY<?U?.KLXAW['^SEQ_!^:0[UA_9ZZ_
+M`W/(=ZR_,]??Y;DO=0[YCO5WYOJ[+WFN<H=\Q_H[<_W=E\3=E\H=\AWK[\SU
+M=U\2=U\J=\AWK+\SU]]]N1S.#OF.]7?F^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]
+MW7$.W7]GK+\SU]_EN>LZAWS'^CMS_=UUGBO<H?OOC/5WYOJ[Z\3==>$.W7]G
+MK+\SU]]=)^ZN"W?H_CMC_9VY_N[Z<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR
+M'>OOS/5W8`[YCO5WYOJ[/'=3YY#O6']GKK^[R7.5.^0[UM^9Z^]N$G<WE3OD
+M.];?F>OO;A)W-Y4[Y#O6WYGK[VXNA[-#OF/]G;G^KIQ=G4.^8_V=N?X.S"'?
+ML?[.7']WF&O.^"G,79-_X.9NZQSP7</ZN\;U=[=Y[E3F@.^^/86Y:UQ_=YNX
+MN[TM<\!W#>OO&M??W2;N;G\K<\!W#>OO&M??W5X.9X?^O.URXO07OKYWW[X^
+MNOHQV*)KB*)!@8-W<S\^9C]2N*E-G'S[Z9V,TO.+U-\4[[^^FSM6KN_/H3_F
+M^0^]7?0G,_]DL&U/TW08_%=^?>CFH#_R^KH?_U.JT=-Y`G_GO_#U+^\?_I4'
+M^Q^?W;8_->VI[4Z#_NHK_,]?_PV^OCWZ[/Y_;_AN#GQV'\[E%UQ^.SO,W=R;
+M^_[9W>_]DV>Y]]1][N[_^-[<]?M[O]_VZ+-;Y[[[:D._0-_LG_S9[0_W0][_
+M.O^X0ME.Y_R?4]R]I.7K>ZJO#_7X#][N3U[?Z?AV?_S[0/_PGY=[<QJ\W=/#
+MN;F8!7P)@].[/KXZ].?1_Y$OQN&6PU_\Y'X?>?C)O9O3/U<$PP^S?/]=;`)_
+@Y[_P]1_O'_YU-]BDP3_M!)MO])W/C_X'"T=/.U"H````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow2.gz.uu
new file mode 100644
index 0000000..71e3879
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.qcow2.gz
+M'XL("%+N+50``VEM9RTV,W@R-34M-3$R+65B<BYQ8V]W,BYO=70`K9C;DM,P
+M#(;O]RG,&18HL>2D"8<6%I89[N`"N$Y/3]'AV:EK)784*=YVTG8R[;C_-W+\
+M64U:%.%A3&F-JXQKS&%C3I_I!2;Y,'R9XZ_O/Q;IXW@38+904L+`<M_C!JQ_
+M$0<:KK#C`2OCDNI0P$&7&H-R.*=6-S4@X&YOSJ?NO!@U2^`UP(!3%^.J^B#4
+MQQ/NROI@[OI0/G]EE^,#U71]&.KCJ:6&J[,X$%*-AFNS.!12&PVWS>*<D-II
+M.&7G)KA22!T4G,VH<L)50LIJ.,CBED(*-9S+XFHAI7EG\]XU0DKSSN:]:X64
+MYIW->[<14IIW-N_=5DAIWMF\=SLAI7D'BG<FXO9"2O,.F'>/"/<XX@Y"2O,.
+MF'=/"/>TQUDII7D'S+MGA'L><4*_`\T[8-Z](-S+B!/Z'6C>`?/N%>%N(T[H
+M=Z!Y!\R[UX1[$W%"OP/-.V#>O1UY9X5^!YIWR+Q[1ZPBXH1^AYIWR+RSA(.(
+M$_H=:MXA\PX)YR).Z'>H>8?,NY)P5<0)_0XU[Y!YMR1<'7%"OT/-.V3>-81[
+M'W%"OT/-.V3>?2#<QX@3^AUJWB'S[A/A5A$G]#O4O'/,NS7A/D><T.^<YIUC
+MWGTAW%W$"?W.:=XYYMU7PGWK<2"E>N^*0GX1[GZT9V'>ZT\7KX^M<-0')H#U
+M)<"I"@.NF77"9=@;%P+E"0><WQMA,FW9F6S)9\IO;=P5:7WK8/,JQ>WFGN[A
+M,F!9FK8=`7]W]<%D&9?7M]S[8;\K6^&H#QSO%L-G!ZS#OP-+O\G*RM3PT`K_
+MWO\1UK>>[X8OX/1_!VB@*[COB"/<.L'Y"XQ#\LUT6PV\2]\GN-4B=N83;O+?
+M`7_+LY<&U,F6\\I2][VEMS599W^E[6^(NA];=J7<KZ^)]0F]!0;3G:C/C*?K
+M?\3[FVVV'AX'F>F:(6[3=Q9A"3-G;S6N;COS8EB^,QZX<SUDN',##N9M!,VY
+CLYP,/'UK?-0'CC\7PV<`.@+.=@9=Y7][;_X#6VG_\](4````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.raw.gz.uu
new file mode 100644
index 0000000..019b487
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.raw.gz
+M'XL("%+N+50``VEM9RTV,W@R-34M-3$R+65B<BYR87<N;W5T`*V4S0Z#(`S'
+M[SY%SSL80)GLHLF2W7?9=D:G3^'#KQ5U(/B50(5("K_\2PN,F0:`/?BM._IT
+MT?KDD@PT7I\'\B#0X!K:Q6F9EC1F'4UIG'$-SMN`O@H-6VGCOK'#[<X!I02M
+M/>!KTB<BIZ-HR9T+8#HPKCOZ>^K:!%1#P<@"<@GR"DH<5?AYO`/Y58S'"MC@
+MQ!YN$FPJ*(2K+%R&SLY::2IQW&77G?UOX4K3)UR^I0Y/@K4AQVJP,FZQ*#1W
+MGYUGX"WP#)@:?<(%SOF%O[Z;+T,XX6[H`S]<3;C"7<\MG-@)%UQ</;\L@13N
+MG%[IJVLB)X,O;\;!FTL0]^8:G(C[$-R&EP4K$%?YX[JC?Z:N&6`^`J.=(+U\
++C"4_RQ*HU^4&````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.vhd.gz.uu
new file mode 100644
index 0000000..bf1b6b6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.vhd.gz
+M'XL(""$UQ%4``VEM9RTV,W@R-34M-3$R+65B<BYV:&0N;W5T`*V7P6ZD,`R&
+M[_,4EO;6`PHF"?0R(U7J?2_;G@.%:K3:MFKWT`,/OS8)D!!@.MT,3!24^.-W
+M[!A%"/L#T`7H#G0+6G&_E*!OH:P`:-#=.+2Y>X2^>7UIF[_GS\S]^H.%Y<*W
+M"LW9'@N0])(2T/!+]!/WH1\QV8_[YYOSG^<1APZ'#J1*MBH0=!V]IZM!2*N.
+M28]G_+U45\3J9BO[GJZ#HO-F%+ZZ+#OY.$E6-)]O!;4>UF>\@X=@P,<%ZI18
+M6'DRUQ95S,ZNX?2>U36XFX.+A4T52HR26@$ZAQ*Y3VDSKD-T4ZI\?KR9]X]V
+MH0\W4D5/^O)HK-IV%UVJX!18JT!R:N^Y"P/E=8E;297_6CT=VDG7H440:AS`
+MP?UP]684^/IT+G;6?#L8F_K,KE_?<+BNKP?N[(ZZ<;M#@%'<\B[-W5YU]@T]
+MMROZ3G;;'GW<4VIWN^N`2H$Q$?#7J*])'(ZJXF%)==2LM-L#_5T67A-P2!BJ
+MQU3.E88*OZKP\?YA);Z5V2@'USML<7@)-PKVJWV(.WFXPFXW/U5G*S_O_+Z'
+M.]K_B)-[ZK@FM&L#F\ZJQ,EBJH6='V?(6\@++L9V#$/@%%^8]=W&,C!P=T<?
+MQ.X:QI7A_-S#X05W(<354V59">&%U3O&ZIK$P:B7.^.+.Y<AX<ZU.$Q;",Q0
+M62@#:5;<;@_T/[/PLD!TGZ)DWS9TQ3290NF`R102L$VLT*3]?FAE@Y+HH,"X
+GA`<%QB4\*#`NX4&!<0D/"HQ+>%!@7-*#`@$I]P[_`"()@=A=#@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.vhdf.gz.uu
new file mode 100644
index 0000000..a2ee04c
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.vhdf.gz
+M'XL("),EAE4``VEM9RTV,W@R-34M-3$R+65B<BYV:&1F+F]U=`"ME3MOPR`0
+M@/?\BI.Z98C@,-A9'*E2]BYM9MO!452U73IT\(\O9X(+&.=183""''RY%V?&
+M[`-@WF1?%@R;Z!E6Z]5(X^WC0)X$6EQ'ISAM:R2-HJ<EC1.N,VN=T&]GFGEJ
+M'W?,;6[_&%!*:)H9\-7IAYG#46H2%PBL28S+@N%Y$S8'K,:$D244$J2""N_5
+M\+!_2\2W8CR7P1:'MW!.89M!*=S.PPDC[+V=-A,OI_R\\^<>KK:OPQ77M#.>
+M8#HE6#16YDV6RK3PG!]GX!JX`%9=9!@"I_C"GW[;N1H8F'M%/YB;VQ"N#/=S
+M#X<WS(40UTZ5)1'"&]ZKY]IUF8/!XYMQY\TE2'AS+0[S%H+M6%E,!II=\W%9
+M,+QLPF:!Q068RX/<?=N4`-6#TJ`DS<L"U!;*R@=BF$E#]_6IN^_SCQ?A$<=M
+M,4AV.H^";HLJ`1OZ$W6DN:??T_ZT/G^<',Z5*E>1S&4SIP2":B-S>6SNX8SO
+ML78B=A*/O(>DIU_VS"^!]W8^KIB,U3VTQQ'G>K`(!*E2->(DBT[]-[86IS*G
+.BOGNKGX!'5^1W!`)````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-ebr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-ebr.vmdk.gz.uu
new file mode 100644
index 0000000..ada1aea
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-ebr.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-512-ebr.vmdk.gz
+M'XL("%/N+50``VEM9RTV,W@R-34M-3$R+65B<BYV;61K+F]U=`"M7-%NY,81
+M?/=7#.2W/"Q8RR6Y?#@[<<X!@B"`$3OV:\CE,!9BWQUT0I`#]/'AD%.C(D4>
+M::MUJP/[V%W;W4.U=-4%9=GTX=RE=9>+NW2N*%T&-_S3]')9_FP,KTNZ\?2W
+MMW__\<2//YY.3U],8`A1$H),X<28O<_3:?%!N//GHF8WAM=Y%RX/4>V+P`AW
+MWKBQ"3?TPYW70IA=,][NPH7`N03D9G#%2DV;Q7XNNS]\$9L7\LM##L/QEK6K
+M<E>VT71E,=JYJ\[CO<Q5@U,_`'[IWMY__(][ZS_>'NX_/+Z/^9W#V0[.ES+X
+ME[>`,!16E>$BW`AP=8`HO<L[ER/<=D\/?[G_Q9_^ZQ\^WK]_]P8L]QS.]I*[
+M2QW2"?[9\VMFA#?)7(GP'N[ISW]]^R8^N=GI0_-`N!`U)#*\]U"'XI:E"Y\O
+M7V-V_MUC0.SC1\HNG&UL3C&^]R5<%!=7U6Y,IPC8Y^%V%TL>>W=[\,VC_^'3
+M!__F[M?W[U+OPMF&EM4CT'5L5.Z*/$#%TD+[BH`8'IOQU-S3+_>//]_?OA_*
+M_.CO3E\ZPI6A=\,!7F->4]5#2+EYLD/:3]_^[W&HUW7Q9.\)-R8Q%C&\=W%V
+M116PA@/,A][EN<NO+A_AAX2'2BX(3N[I_;O3/WYR*//KQ7W_W9_^0;CK`#=X
+M#@D.(4-!LYJ*J?YB^5BZI^^_=7>AR!]^]N,32+AZ^C(+SM,Y8#3/X2)V;8(/
+M0^P2;HPGZ]XVCXW[IOGH3U^^??M-.MDF%'L97T-J/J"4$W1XOL=V#HV;3GHZ
+MZ/$HNJX]-5WSX=$_A.--1]&&I[6+E89CO3P?X_Q]JO&D^O#$N*<W[NZ^&\XT
+MP/[;O_^5<+?I,1[R"(]$/0;FX6)X>D9X']]A>F+",04X__CPZ73[],O]NV[X
+M0G-O"-=-O1O2&4YS2BKEM$PJO>W0NSL\IS9@$\Z'%DU)7>,7QH`UY?'<A7QX
+M%>$5N_#TZ?2S;[HA+7=W+HJ[=!3]\BBT18LN3`<]]&(ZBIC8I]-'?XMP>18/
+ML)\U9\HI/,K#DSQE-!^@C^\?QM3*_$[G<;[\7O;:>7QY\2VU^IV`$YQU?F6V
+M]_V,KWP&Z`0L>\ZO#/E=Q+/0J%*,:@8W_#1Q^F[X_-?P^4'@PB-V%<]:HQHQ
+MVB/=*\/WBYMX=AKEQ>@/P5UBB_@#"N1Z;"J-7&\D.+?H71%[1\]"HTHQJAG<
+M5N_*V#MZUAK5B-&N9K<LMHJ]HV>G45Z,_A#<-?:./X!!KL?>T<BSM9_REKVK
+M8^_H66A4*48U@]OJ71-[1\]:HQHQVM7LEL6VL7?T[#3*B]$?@KO%WG&L0*['
+MWM'(]<9F[[K8.WH6&E6*4<W@MGKG8^_H66M4(T:[FMVRV#[VCIZ=1GDQ^B-P
+M519[=Y'>\7KL'8U<;VSUKN*\HV>A4:48U0QNHW<5YQT]:XUJQ&A7LUL6RWE'
+MSTZCO!C](3C.NT)ZQ^NQ=S1RO;'9.\X[>A8:58I1S>"V>L=Y1\]:HQHQVM7L
+MEL5RWM&STR@O1G\(CO.NE-[Q>NP=C5QO;/:.\XZ>A4:58E0SN*W><=[1L]:H
+M1HQV-;MEL9QW].PTRHO1'X+CO../3I#KL7<T<KVQV3O..WH6&E6*4<W@MGK'
+M>4?/6J,:,=K5[);%<M[1L],H+T9_!.Z:Q=Y=I7>\'GM'(]<;6[V[<M[1L]"H
+M4HQJ!K?1NROG'3UKC6K$:%>S6Q;+>4?/3J.\&/TA.,Z[6GK'Z[%W-'*]L=D[
+MSCMZ%AI5BE'-X+9ZQWE'SUJC&C':U>R6Q7+>T;/3*"]&?PB.\X[_\8)<C[VC
+MD>N-S=YQWM&ST*A2C&H&M]4[SCMZUAK5B-&N9K<LEO..GIU&>3'Z0W"<=V0M
+M(==C[VCD>F.S=YQW]"PTJA2CFL%M]8[SCIZU1C5BM*O9+8OEO*-GIU%>C/X(
+M7)W%WMVD=[P>>T<CUQM;O:LY[^A9:%0I1C6#V^A=S7E'SUJC&C':U>R6Q7+>
+MT;/3*"]&?PB.\ZZ3WO&:K';J7?<";MD[SCMZ%AI5BE'-X+9ZQWE'SUJC&C':
+MU>R6Q7+>T;/3*"]&?PB.\\Y+[W@]]HY&KC<V>\=Y1\]"HTHQJAG<5N\X[^A9
+M:U0C1KN:W;)8SCMZ=AKEQ>@/P7'>]=([7H^]HY'KC<W><=[1L]"H4HQJ!K?5
+M.\X[>M8:U8C1KF:W+);SCIZ=1GDQ^B-P33;U+NW<(->A=\G(]<96[YHX[Y)G
+MH5&E&-4,;J-W39QWR;/6J$:,=C6[9;%QWB7/3J.\&/TAN#CO(/P=E+^#\'?8
+MY>^:..\@_!V4OX/P=]CE[YHX[R#\'92_@_!W*]DMBXWS#L+?0?D["']W`"[.
+M.PA_!^7O(/P==OF[)LX["'\'Y>\@_!UV^;LFSCL(?P?E[R#\W4IVRV+CO(/P
+M=U#^#L+?'8"+\P["WT'Y.PA_AUW^KHGS#L+?0?D["'^'7?ZNB?,.PM]!^3L(
+M?[>2W;+8..\@_!V4OX/P=_MP;19[)_P=E+^#\'?8Y>]:SCOA[Z#\'82_PRY_
+MUW+>"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^[@`<YYWP=U#^#L+?89>_:SGOA+^#
+M\G<0_@Z[_%W+>2?\'92_@_!W*]DMB^6\$_X.RM]!^+L#<)QWPM]!^3L(?X==
+M_J[EO!/^#LK?0?@[[/)W+>>=\'=0_@["WZUDMRR6\T[X.RA_!^'O#L!QW@E_
+M!^7O(/P==OF[EO-.^#LH?P?A[[#+W[6<=\+?0?D["'^WDMVR6,X[X>^@_!V$
+MO]N'NV6Q=\+?0?D["'^'7?[NQGDG_!V4OX/P=]CE[VZ<=\+?0?D["'^WDMVR
+M6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[VZ<=\+?0?D["'^'7?[NQGDG_!V4
+MOX/P=RO9+8OEO!/^#LK?0?B[`W"<=\+?0?D["'^'7?[NQGDG_!V4OX/P=]CE
+M[VZ<=\+?0?D["'^WDMVR6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[VZ<=\+?
+M0?D["'^'7?[NQGDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[?;@NB[T3_@[*WT'X
+M.^SR=QWGG?!W4/X.PM]AE[_K..^$OX/R=Q#^;B6[9;&<=\+?0?D["']W`([S
+M3O@[*'\'X>^PR]]UG'?"WT'Y.PA_AUW^KN.\$_X.RM]!^+N5[);%<MX)?P?E
+M[R#\W0$XSCOA[Z#\'82_PRY_UW'>"7\'Y>\@_!UV^;N.\T[X.RA_!^'O5K);
+M%LMY)_P=E+^#\'<'X#COA+^#\G<0_@Z[_%W'>2?\'92_@_!WV.7O.LX[X>^@
+M_!V$OUO);EDLYYWP=U#^#L+?[</Y;.I=DN!!KD<9(XU<;SR-31L^W?"9N6>X
+M..]6%7TK_Y1ZY]:S>Z'%/P;WLMA);HA1;I@V$5.YOP]P@C.60^(:N[X/>$0.
+MB;0NY^M5<DBD=3E?KY)#(JW+^7J5'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<
+M$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)
+M'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6Y
+MB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1U
+MN8D<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76Y
+MC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-
+M'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<
+M$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P2
+M:5V>/??N]\LAD=;E]'R5'!)I74[/5\DAD=;E]'R5'!)I76XBAT1:EYO((9'6
+MY29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1
+MUN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@A
+MD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO(
+M(9'6Y29R2*1UN8D<$ER7V\@AP76YC1P2WE0."6\JAX0WE4/"F\HAX4WED/"F
+M<DAX4SDDO*D<$MY4#@EO*H>$-Y5#PIO*(>%-Y9#PIG)(]%EF*(=$;RJ'1&\J
+MAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'
+M1&\JAT1O*H<\9UEF*(<\9Z9RR//+7TU\#.YEL9/<\(+VMP-BLWL7C$_>2%8U
+MXW_A\CZ8>2]PM\'V*_E]/?P9/KY2N,ZZW/ZW`1:%:YH7@/]D?N?/IO';\ZO&
+M_UU,OTKVY=_;-YZ^.<W_$/`Z/LY%%7XK;E&ZZ_EHAC]]^^,BPPG.3.XZP>T^
+MSHFT[+?@OA:X\.V[%\_9+^[6YTZO!>ZKZ9-PE\]EI_ND8\4:_Z;M:W9=Q.DY
+MAV\3@;WC?\K.<\!TONXYO_IE&N=9N9_)S[TL-WR+U-\UJ^<QFZH;Y;HY7)LF
+MR\H1[G3OJY?9W8P/`\NOC(-?N0%D_I4[P9UM!T$]3I9)I/'R[^T;3]^=YG\F
+6P$L$-.O@)?P>D>R+_P-J-:`0'F``````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu
new file mode 100644
index 0000000..4753ee6
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu
@@ -0,0 +1,132 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.qcow.gz
+M'XL("+HS(E0``VEM9RTV,W@R-34M-3$R+6=P="YQ8V]W+F]U=`"MG<MN7-F1
+M1>?U%5=OB9*HC(C[U-MNM`'/RH9[UH.ZKQQU&]ES?7PSR?,@(_=6V!!51$$%
+MX6YD'BTNJE2KC@Z'NV]-TTG3]DT[-<>EN?GG]"'-O7]X^-'\^-M?_GI]_]N/
+MW^[&Y/"3I]P_M]I(FGNP]><ZI^>GUN8P_0MS-Q]P[MZKLW_CU=U[LY=S5[_=
+MO5G\G+)!>S#8I+E#>GU"3J_]UU[?=_=VY>[T'N_M*GF['1OL'PS^GN;^2*]/
+MR=L=V-SX8.[DWJZ2MSNQN?FGL"B!96%S:S#7PJ<V-K<'<QU\ZHCGY"<_MW=S
+M/7Q*V)S"N:;,#?`I8W/M@[G#=08ZSXWP*<*=A-Q-\"G"G83<S?`IPIV$W"WP
+M*<*=A-RM\"G"G83<;?`IPIV&W.WP*<*=AMP=X5.$.XVX$_P4X4XC[@3Y3AEW
+M&G$GR'?*N-.(.T&^4\:=1MP)\ITR[C3B3I#OE'%G$7>"?&>,.XNX$^0[8]Q9
+MR!WRG3'N+.0.^<X8=Q9RAWQGC#L+N4.^,\:=A=PAWQGCSD+ND.^,<=>&W"'?
+MM8R[-N0.^:YEW+41=XJ?(MRU$7>*?-<R[MJ(.T6^:QEW;<2=(M^UC+LVXDZ1
+M[UK&71MQI\AW+>.NB[A3Y+N.<==%W"GR7<>XZT+ND.\ZQET7<H=\US'NNI`[
+MY+N.<=>%W"'?=8R[+N0.^:YCW'4A=\AW'>.N#[E#ONL9=WW('?)=S[CK(^X,
+M/T6XZR/N#/FN9]SU$7>&?-<S[OJ(.T.^ZQEW?<2=(=_UC+L^XLZ0[WK&W1!Q
+M9\AW`^-NB+@SY+N!<3>$W"'?#8R[(>0.^6Y@W`TA=\AW`^-N"+E#OAL8=T/(
+M'?+=P+@;0NZ0[P;&W1ARAWPW,N[&D#ODNY%Q-T;<M?@IPMT8<=<BWXV,NS'B
+MKD6^&QEW8\1=BWPW,N[&B+L6^6YDW(T1=RWRW<BXR[_]S>>0[R;&W11QUR+?
+M38R[*>0.^6YBW$TA=\AW$^-N"KE#OIL8=U/('?+=Q+B;0NZ0[R;&W11RAWPW
+M,>[FD#ODNYEQ-X?<(=_-C+LYXJ[#3Q'NYHB[#OEN9MS-$7<=\MW,N)LC[CKD
+MNYEQ-T?<=<AW,^-NCKCKD.]FQEW^SY!\#OEN8=PM$7<=\MW"N%M"[I#O%L;=
+M$G*'?+<P[I:0.^2[A7&WA-PAWRV,NR7D#OEN8=PM(7?(=POC;@VY0[Y;&7=K
+MR!WRW<JX6R/N>OP4X6Z-N.N1[U;&W1IQUR/?K8R[->*N1[Y;&7=KQ%V/?+<R
+M[M:(NQ[Y;F7<;1%W/?+=QKC;(NYZY+N-<;>%W"'?;8R[+>0.^6YCW&TA=\AW
+M&^-N"[E#OML8=UO('?+=QKC;0NZ0[S;&W1YRAWRW,^[VD#ODNYUQMT?<#?@I
+MPMT><3<@W^V,NSWB;D"^VQEW>\3=@'RW,^[VB+L!^6YGW.T1=P/RW<ZX.T;<
+M#<AW1\;=,>)N0+X[,NZ.(7?(=T?&W3'D#OGNR+@[AMPAWQT9=\>0.^2[(^/N
+M&'*'?'=DW!U#[I#OCH0[R=_A<\!W<B#<R2'D#OA.#H0[.43<C?@IS)V$_=T(
+M?">LOY.POQN![X3U=Q+V=R/PG;#^3L+^;@2^$];?2=C?C<!WPOH["?N[$?A.
+M6'\G87\W`M\)Z^\D[.]&X#MA_9V$_=T(?">LOY.POQN![X3U=Q+V=R/PG;#^
+M3L+^;@2^$];?2=C?C<!WPOH["?N[$?F.]7<2]G<C\AWK[R3L[R;\%.$N[.\F
+MY#O6WTG8WTW(=ZR_D["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H[
+M"?N["?F.]7<2]G<3\AWK[R3L[R;D.];?2=C?3<AWK+^3L+^;D.]8?R=A?S<A
+MW['^3L+^;D*^8_V=A/W=A'S'^CL)^[L)^8[U=Q+V=S-^BG`7]G<S\AWK[R3L
+M[V;D.];?2=C?S<AWK+^3L+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'
+M^CL)^[L9^8[U=Q+V=S/R'>OO).SO9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_
+M-R/?L?Y.POYN1KYC_9V$_=V,?,?Z.PG[NP4_1;@+^[L%^8[U=Q+V=POR'>OO
+M).SO%N0[UM])V-\MR'>LOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"
+M?,?Z.PG[NP7YCO5W$O9W"_(=Z^\D[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G
+M87^W(-^Q_D["_FY!OF/]G83]W8J?(MR%_=V*?,?Z.PG[NQ7YCO5W$O9W*_(=
+MZ^\D[.]6Y#O6WTG8WZW(=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]
+MW8I\Q_H["?N[%?F.]7<2]G<K\AWK[R3L[U;D.];?2=C?K<AWK+^3L+];D>]8
+M?R=A?[<BW['^3L+^;L-/$>["_FY#OF/]G83]W89\Q_H["?N[#?F.]7<2]G<;
+M\AWK[R3L[S;D.];?2=C?;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=
+MA/W=AGS'^CL)^[L-^8[U=Q+V=QOR'>OO).SO-N0[UM])V-]MR'>LOY.PO]N0
+M[UA_)V%_M^.G"'=A?[<CW['^3L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V
+M=SOR'>OO).SO=N0[UM])V-_MR'>LOY.PO]N1[UA_)V%_MR/?L?Y.POYN1[YC
+M_9V$_=V.?,?Z.PG[NQWYCO5W$O9W._(=Z^\D[.]VY#O6WTG8W^W(=ZR_D["_
+M.^*G"'=A?W=$OF/]G83]W1'YCO5W$O9W1^0[UM])V-\=D>]8?R=A?W=$OF/]
+MG83]W1'YCO5W$O9W1^0[UM])V-\=D>]8?R=A?W=$OF/]G83]W1'YCO5W$O9W
+M1^0[UM])V-\=D>]8?R=A?W=$OF/]G>;ON+FFS@'?W3R%N5/7W^7[])K*'?"=
+MLOY.77_7).Z:S)T=\%.8.W7]79.X:_XH<\!WROH[=?U=<W)G9^C^.V7]G;K^
+MKIQ=G0.^4];?J>OOP!SPG;+^3EU_!^:`[Y3U=^KZNSSWI,X!WRGK[]3U=T_R
+M7%/F@.^4]7?J^KLGB;LGE3O@.V7]G;K^[DGB[DGE#OA.67^GKK][<KHX.^`[
+M9?V=NOZNG%V=`[Y3UM^IZ^_`'/"=LOY.77\'YH#OE/5WZOJ[//>TSB'?L?Y.
+M77_W-,]5[I#O6'^GKK][FKA[6KA#]]\IZ^_4]7=/$W=/"W?H_CME_9VZ_N[I
+MR9\=NO].67^GKK\K9U?GD.]8?Z>NOP-SR'>LOU/7WX$YY#O6WZGK[_+<LSJ'
+M?,?Z.W7]W;,\5[A#]]\IZ^_4]7?/$G?/*G?(=ZR_4]??/4O</:O<(=^Q_DY=
+M?_?L='%VR'>LOU/7WY6SJW/(=ZR_4]??@3GD.];?J>OOP!SR'>OOU/5W>>YY
+MG4.^8_V=NO[N>9ZKW"'?L?Y.77_W/''WO'"'[K]3UM^IZ^^>)^Z>%^[0_7?*
+M^CMU_=WSDS\[=/^=LOY.77]7SJ[.(=^Q_DY=?P?FD.]8?Z>NOP-SR'>LOU/7
+MW^6Y%W4.^8[U=^KZNQ=YKG"'[K]3UM^IZ^]>).Y>5.Z0[UA_IZZ_>Y&X>U&Y
+M0[YC_9VZ_N[%Z>+LD.]8?Z>NORMG5^>0[UA_IZZ_`W/(=ZR_4]??@3GD.];?
+MJ>OO\MS+.H=\Q_H[=?W=RSQ7N4.^8_V=NO[N9>+N9>$.W7^GK+]3U]^]3-R]
+M+-RA^^^4]7?J^KN7)W]VZ/X[9?V=NOZNG%V=0[YC_9VZ_@[,(=^Q_DY=?P?F
+MD.]8?Z>NO\MSK^H<\AWK[]3U=Z_R7.$.W7^GK+]3U]^]2MR]JMPAW['^3EU_
+M]RIQ]ZIRAWS'^CMU_=VKT\79(=^Q_DY=?U?.KLXAW['^3EU_!^:0[UA_IZZ_
+M`W/(=ZR_4]??Y;G7=0[YCO5WZOJ[UWFN<H=\Q_H[=?W=Z\3=Z\(=NO].67^G
+MKK][G;A[7;A#]]\IZ^_4]7>O3_[LT/UWROH[=?U=.;LZAWS'^CMU_1V80[YC
+M_9VZ_@[,(=^Q_DY=?Y?GWM0YY#O6WZGK[][DN<(=NO].67^GKK][D[A[4[E#
+MOF/]G;K^[DWB[DWE#OF.]7?J^KLWIXNS0[YC_9VZ_JZ<79U#OF/]G;K^#LPA
+MW['^3EU_!^:0[UA_IZZ_RW-7=0[YCO5WZOJ[JSQ7N4.^8_V=NO[N*G%W5;A#
+M]]\IZ^_4]7=7B;NKPAVZ_TY9?Z>NO[LZ^;-#]]\IZ^_4]7?E[.H<\AWK[]3U
+M=V`.^8[U=^KZ.S"'?,?Z.W7]79Y[6^>0[UA_IZZ_>YOG"G?H_CME_9VZ_NYM
+MXNYMY0[YCO5WZOJ[MXF[MY4[Y#O6WZGK[]Z>+LX.^8[U=^KZNW)V=0[YCO5W
+MZOH[,(=\Q_H[=?T=F$.^8_V=NOXNS[VK<\AWK+]3U]^]RW.5.^0[UM^IZ^_>
+M)>[>%>[0_7?*^CMU_=V[Q-V[PAVZ_TY9?Z>NOWMW\F>'[K]3UM^IZ^_*V=4Y
+MY#O6WZGK[\`<\AWK[]3U=V`.^8[U=^KZNSSWOLXAW['^3EU_]S[/%>[0_7?*
+M^CMU_=W[Q-W[RAWR'>OOU/5W[Q-W[RMWR'>LOU/7W[T_79P=\AWK[]3U=^7L
+MZASR'>OOU/5W8`[YCO5WZOH[,(=\Q_H[=?U=GKNN<\AWK+_3J+\S=/^=LOY.
+MH_[.T/UWROH[C?H[0_??*>OO-.KO#-U_IZR_TZB_,W3_G;+^3J/^SM#]=\KZ
+M.XWZ.T/WWRGK[Y3T=Q_J'/(=Z^_4]7<?\ESA#MU_IZR_4]???4C<?:C<(=^Q
+M_DY=?_<A<?>A<H=\Q_H[=?W=A]/%V2'?L?Y.77]7SJ[.(=^Q_DY=?P?FD.]8
+M?Z>NOP-SR'>LO[/\'3=WJ'/`=\;ZNYL?>,!=]M.A<@=\9ZR_,]??'=+>H7"'
+M[K\SUM^9Z^\.B;M#X0[=?V>LOS/7WQU._NS0_7?&^CMS_5TYNSH'?&>LOS/7
+MWX$YX#MC_9VY_@[,`=\9Z^_,]7=Y3NH<\)VQ_LY<?R=YKG"'[K\SUM^9Z^\D
+MO3RIW`'?&>OOS/5WDKB3RAWPG;'^SEQ_)Z>+LP.^,];?F>OORMG5.>`[8_V=
+MN?X.S`'?&>OOS/5W8`[XSEA_9ZZ_RW-:YY#O6']GKK_3/%>Y0[YC_9VY_DX3
+M=UJX0_??&>OOS/5WFKC3PAVZ_\Y8?V>NO].3/SMT_YVQ_LY<?U?.KLXAW['^
+MSEQ_!^:0[UA_9ZZ_`W/(=ZR_,]??Y3FK<\AWK+\SU]]9GBO<H?OOC/5WYOH[
+M2]Q9Y0[YCO5WYOH[2]Q9Y0[YCO5WYOH[.UV<'?(=Z^_,]7?E[.H<\AWK[\SU
+M=V`.^8[U=^;Z.S"'?,?Z.W/]79YKZQSR'>OOS/5W;9ZKW"'?L?[.7'_7)N[:
+MPAVZ_\Y8?V>NOVL3=VWA#MU_9ZR_,]??M2=_=NC^.V/]G;G^KIQ=G4.^8_V=
+MN?X.S"'?L?[.7'\'YI#O6']GKK_+<UV=0[YC_9VY_J[+<X4[=/^=L?[.7'_7
+M)>ZZRAWR'>OOS/5W7>*NJ]PAW['^SEQ_UYTNS@[YCO5WYOJ[<G9U#OF.]7?F
+M^CLPAWS'^CMS_1V80[YC_9VY_B[/]74.^8[U=^;ZNS[/5>Z0[UA_9ZZ_ZQ-W
+M?>$.W7]GK+\SU]_UB;N^<(?NOS/6WYGK[_J3/SMT_YVQ_LY<?U?.KLXAW['^
+MSEQ_!^:0[UA_9ZZ_`W/(=ZR_,]??Y;FASB'?L?[.7'\WY+G"';K_SEA_9ZZ_
+M&Q)W0^4.^8[U=^;ZNR%Q-U3ND.]8?V>NOQM.%V>'?,?Z.W/]73F[.H=\Q_H[
+M<_T=F$.^8_V=N?X.S"'?L?[.7'^7Y\8ZAWS'^CMS_=V8YRIWR'>LOS/7WXV)
+MN[%PA^Z_,];?F>OOQL3=6+A#]]\9Z^_,]7?CR9\=NO_.6']GKK\K9U?GD.]8
+M?V>NOP-SR'>LOS/7WX$YY#O6WYGK[_+<5.>0[UA_9ZZ_F_)<X0[=?V>LOS/7
+MWTV)NZERAWS'^CMS_=V4N)LJ=\AWK+\SU]]-IXNS0[YC_9VY_JZ<79U#OF/]
+MG;G^#LPAW['^SEQ_!^:0[UA_9ZZ_RW,?ZQSR'>OOS/5W'_-<Y0[YCO5WYOJ[
+MCXF[CX4[=/^=L?[.7'_W,7'WL7"'[K\SUM^9Z^\^GOS9H?OOC/5WYOJ[<G9U
+M#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/?:ISR'>LOS/7WWW*<X4[=/^=
+ML?[.7'_W*7'WJ7*'?,?Z.W/]W:?$W:?*'?(=Z^_,]7>?3A=GAWS'^CMS_5TY
+MNSJ'?,?Z.W/]'9A#OF/]G;G^#LPAW['^SEQ_E^<^USGD.];?F>OO/N>YRAWR
+M'>OOS/5WGQ-WGPMWZ/X[8_V=N?[N<^+N<^$.W7]GK+\SU]]]/OFS0_??&>OO
+MS/5WY>SJ'/(=Z^_,]7=@#OF.]7?F^CLPAWS'^CMS_5V>^U+GD.]8?V>NO_N2
+MYPIWZ/X[8_V=N?[N2^+N2^4.^8[U=^;ZNR^)NR^5.^0[UM^9Z^^^G"[.#OF.
+M]7?F^KMR=G4.^8[U=^;Z.S"'?,?Z.W/]'9A#OF/]G;G^+L]]K7/(=ZR_,]??
+M?<USE3OD.];?F>OOOB;NOA;NT/UWQOH[<_W=U\3=U\(=NO_.6']GKK_[>O)G
+MA^Z_,];?F>OORMG5.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F^KL\]ZW.(=^Q
+M_LY<?_<MSQ7NT/UWQOH[<_W=M\3=M\H=\AWK[\SU=]\2=]\J=\AWK+\SU]]]
+M.UV<'?(=Z^_,]7?E[.H<\AWK[\SU=V`.^8[U=^;Z.S"'?,?ZNS9_Q\U]KW/`
+M=RWK[UK7WWW/<Y4[X+N;IS!WK>OOOB?NOF?NV@-^BORYQ^[-?L^]\7690W_>
+M=GDJF+OW[<=O5W>#Z+ZJMF2`T>O[P[\^=%_5K[R^[O;\6FT.,_@[_X$??[Y^
+M^%<9O+T[Z-\8S*_PX5Q^P]W=W4&WT=1^X\YC^CC(_3<\UNOTP!M^<GUO#OW9
+MS+]R?NBZGY\-=ETSSQ>#_Y5?W^UU/VW7M'W33NDBQU::3INN+7.W[[5;[[^^
+M__S+7YO?__3W?YS'_KN^W=OK?G9MAO7V#Q_8W*L3^G9_^+=[-W?[Y7OPIYWG
+MC,X]P7.W7[Z[G\RA#S[7_NRI@])7=_%S>S?7'1X^-=Y_:NR:49O^YM^&9CKW
+M/P_FT!\?_RODW=X<L/3GG]O^YA=XTJS'\W>V_OR'[S;CS:?)W7^:T=O_EVEJ
+M!CG_7W;GG]M__NWZGW=C[Z__[VUZ?7<W!PC^X#_`3N_NY@!&Q"%GB_SM-@_G
+MP*_T?NWTSK]>6;I'.[TIP8(^^`_0TYOO3@\?TOE%P4^9'_>O$;T_!WZ]\DNG
+M=_M_-9Z_QL[@[_P'?OQ^_?"ON\$V#3[:*VP/_?J(GQWGN4?\[#C//>)GQWGN
+M43\[SH./^-EQGGO$SX[SW"-^=ISG'O6SXV;P]O<<'^F+^'GNS%YKS;PVZ]#T
+M_HLX^W+\XS^NK_\7O-V[WW-D7_I_\D4<_V3LC_A%_#SW\R_B/?VYS=_<FWW$
+7+^+GN4?](MX>AAN9_O;_@'C+'O6L````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu
new file mode 100644
index 0000000..26ffd0b
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu
@@ -0,0 +1,26 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.qcow2.gz
+M'XL("+`[(U0``VEM9RTV,W@R-34M-3$R+6=P="YQ8V]W,BYO=70`K9A+;YPP
+M$(#O^15.WTT:BL<VC[Z3-"OE4B55>VL/+(]3%:EWVM]>C`T&,P/)UKMHE<B:
+M3V/SS=@0Q^;#F.),)DSFK-FS[G][`9O\,[]8>[N[CJ:?]LC`>$Q$(0-2C+@9
+MZ]+A@,+%?#G`<=PD.X'@8(A:@K9PDLQN;0#!G1SU2]??C,R+$(<`#8Z\&0?E
+M!R8_/T(>F!^$SD_@ZZ>&.'\@6<]/F/S\J)3"99LX0*)R"E=LX@02M:=PY29.
+M(E$5A:LW<0J):@@<WU"EPR5(%*=PL(E+D2A!X>0F+D.B*._XMG<Y$D5YQ[>]
+M*Y`HRCN^[=T>B:*\X]O>E4@4Y1W?]JY"HBCO@/"..5R-1%'>@>?=L<4]<K@&
+MB:*\`\^[QQ;W9,1Q+(KR#CSOGEK<,X=#^AU0WH'GW7.+>^%P2+\#RCOPO'MI
+M<2<.A_0[H+P#S[M3BWOE<$B_`\H[\+P[6WC'D7X'E'?"\^ZU9<4.A_0[07DG
+M/.^XQ8'#(?U.4-X)SSMA<=+AD'XG*.^$YYVRN,3AD'XG*.^$YUUJ<9G#(?U.
+M4-X)S[O<XMXX'-+O!.6=\+Q[:W'O'`[I=X+R3GC>O;>X#PZ']#M!>2<][SY:
+MW">'0_J=I+R3GG?G%G?A<$B_DY1WTO/NTN(^CSC`HD;OXAB_+.YJ4;.`]#N9
+MW!.W6^+HAY5#CK/2';<Y\DL/K`"SAP/)O5::<TJX"2LS86U5@?S2`^U%-/^.
+MP+YV'P`<,ISC[(25J5WSP%C7K&GL95;*!F>3`P(RX>-H@JL"KU]?;@\`*L6*
+M8@'\/N37EUM77^;=0&>WZIN!`J;DB.OGJLII?E>[:W9S_O6;AOUPT^W+3>-J
+M_;!4)%YVG)KNU1?$/F7*+6W\U1YP@L*-QS(/IX\7:;6"PR[6_B%P<BUJ?.EP
+MCWMK<"J>1TW;%LL4RX`E):L*$O=KADL"FR?U\#YA:<F26K]/*AO]1Y7HIS26
+M=65BMFWHSU@Y2[D^NW7`]NXVNC.PL^CWJ<U/<FL$=M$#U.I)6#-")[4Q73;'
+M8:^1_FOU=%_>JV"KEUM9L(L>(%>O,*N'+Y)."BV9=EBUH>`&W#[PZB5ZN*N/
+MKG\O?^F!]B::?PU06F"P#&72E`&K0^,"5H?&!:P.C0M:'1H8L#HT+F!U:%S`
+MZM"XH-71`>LXW":N<=J]/&.J8KED335/@]R.V^@G.MT:UK;^E4T<OQEUP$U<
+BXU8W\;0F)VL_?[W)!MS$-2[H)BY3??P^^@=.=Z`2%1H`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu
new file mode 100644
index 0000000..2a259cb
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.raw.gz
+M'XL("/G%'50``VEM9RTV,W@R-34M-3$R+6=P="YR87<N;W5T`*V534_#,`R&
+M[_L5WA5$E*1)FIWXD$#B-A#<N/1C/:%)W,M_)VX:UG9Q89+3J*KD^JGM^*VE
+MC`O`:)!5YDX;^@<QO_K-U6:@J?HR8/@^AK``B@",N"88I<9W#@?HNG%+-7A%
+M9VE!J_0\XL1I;<4$UYZ\SC9MF.)$Q*5TN\N`UD)5G0'?4WQZ.`X+QH'9@0[O
+M2S`*K`9K?G%#KK:9QO?X]`S[^]<WA'V<TM4J&%4#1D)30MLMHE-DNG?+="-.
+MHY=95COA"A*WS>.*>+8T+K=IG%GSBCWTO[.-."OG7G[JY2UX#:Z!MB)QGS.<
+M8^X\@^;:0=F`.X!5T'3XT#I0*L079.('2*AO"W('I0)=([`_OHACA-V(K^LQ
+M/J/&CLAMVD!5S^BUCL"@_D@7YKB"NWH>JV?9JK<;FR6W:0-9O2I6+U\D4C)]
+MJEI22,+5S-5S:`[Z"/_O\SMMZ/=B?D6@&8%L$8;F<XSJ0!RC.A#'J`[$L:H#
+M@8SJ0!RC.A#'J`[$L:HC`+WD&^*(&X:X@;*%MH!B.<2I<=R+;W&;2=?KM=&_
+F,L3SA^$9ASCBUH=X02:;UB)9QB&..-8A'H"5E)L?B^NWCH@+````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu
new file mode 100644
index 0000000..b496241
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu
@@ -0,0 +1,23 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.vhd.gz
+M'XL(""4UQ%4``VEM9RTV,W@R-34M-3$R+6=P="YV:&0N;W5T`*V82X_3,!#'
+M[_LI!B%Q6$3D.+:37(I`6B1N"P+MA4OL)*L**(]R6(GL=\?C.`\G<:!B6BMJ
+MY<XO_WEX[(:Q_@6@,E`MJ`:4Q,^Y`%5"7@#823^XNZ;^*W3FVZDQOXX/B7]U
+M5STL97.KT!SM>0;"WB0'7N%-5(V?H1LPR=.;^^OCU_L!QSV.>Y#,T2KCH/3J
+M/GD-17\?A[L[\L\.^3BIR];J)JO>P;:%K)W](AO4/;KKR[FSPEK9W^.04.3`
+MQ#2"+\'$Y.PB=I(MK&8RMX+*)F>W<&K/ZA+<]97/15\JMC!R>V6@4L@Y?K9E
+M,\1A-6RI/)R_5S_/S4(?CY2*FB5C.;<3/>Y+A0\_]@H$"MQS%QSEO,1ME,I_
+M14^%=D-V;1"8'";XX+X=]OXL6!E.*!OTJ93MQ#R>C*B^"O4)NQ*JC6M\HGN=
+MA.\1J/5EP"&"(6Y,B#88/[=2FV;RJ"\2;VQ2R)IX0@ZS_.J:.+^ZO0PH)535
+M"OAQT&=<.B0(!:+$PK#-0:0@.4@QXISOTLSUW;QY"[>OWG]`V*?)78/E8MNF
+MK36E(-<+=>N5YG$\:7]O+#:#B\TF9!'M`9=%HW?87+L&%YMN=G!;(XX3>U;C
+M7O(/N>UQDH56Q=RJD+A_*`-U%<5]"7#4?;G!:6VS:G`+ERD8MY?7"M+4ZK/+
+MI'`0#KP&9C=VNPMK!':G=\FIA[U(?CSW^IK45\36B$_$HM?PO8I`47]Q%T(<
+M=5]N"HR>)(M>Z8ME:\0GHM&K^NAM!PE%;2W=<5=+DB<A3M-&+W7'1[L^;/]>
+M7^,3W6T2OGL@]]L0V;[&?2,E4R@\D$RA\.N74&$J=I-Y:9:55TCFLO)E0Z8P
+MKPO*'H@XPAZ(.,(>B#C2'HA`PAZ(.,(>B#C"'H@XTAZ8UZ4K9J*C&N*P]KB"
+M4N._W<*$,J*'KNY9<M<+.\S=+?N_T+$#WLY1;3,9)2,\JB%N]ZBFVYBS(V?A
+M+.%1#7&D1[7"]SVBIRV((WS:@CC"IRV((WS:@CC"IRV((WS:@CCJ4K%'EZL_
+(<L>MI:(3````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu
new file mode 100644
index 0000000..40aef66
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.vhdf.gz
+M'XL(")<EAE4``VEM9RTV,W@R-34M-3$R+6=P="YV:&1F+F]U=`"ME\V.U#`,
+M@._S%$;<%A$E:9*FIP&D!7%;$(@+E_ZDJQ$P"`DD#GUX[*;=23I)85%:J\K(
+M]5?;M>,IY_X`4!)XF[CF%=,K%I_3X>8PTT3W."`^GUS8`!D"/:Y')9=TCW,P
+MCHMP,5MY8Q3%+^L9QR['"Q;@AM!J(WE%B&,>MX8[/@ZH-;3M%?#CZI^<7X<&
+M94`U(/%^C$V`EJ#5`VZ.7?>A?[>OW\+=R_<?"/;Y$JX4J+0.J@:XAEIOO!/9
+M<!OV*P[7X]`ARGXU)H.MLKCC-GL>5Q%NV,&E)(]3>U:^AO[MW7J<YK&5#:VL
+M!BO!]#"T6=S7"&<*5YXB=6>@[L$XT`+ZD1:#`2'0/VP3.T,DR`%X`[4`V1%P
+M.K]C9P][SGX\6_Q38JF(E.05N>PIN5<1Y-1?PH485Y7.GJ7LZ6+9:Y9B24E>
+MD<U>Z[.73A(YE6I=Q"U98T]B7%<X>X;4V!^X?U]?\XKICL6G!ZH%6,S#>AS[
+M@MU!N(+=0;B"W4&XHMU!P(+=0;B"W4&X@MU!N*+=@4#'RPUQPE'MC<BJH>V@
+M<[$;V7$\L3>+8\<H7"?W1O_.$$^_#%=PB!-N=XB/+AOL>FR"+3C$"5=TB-OE
+M[[>IP,S]932M:P4&6\J&0'FIF1G8?S^[_N?I=Y@]P@E?$4DA>UE189H:9$L/
+M,0.M`_^>WM[?G+[=KSBY1+4F4-=D56'.NJMP;1SNIY/\LO4NL4W9*'OBJIPW
+MV\`QQ*F'8/'3`+<8KBX2_8@4R4(FW%PJX<W_^VX]KG2IX*?!X0]&S!$YLPT`
+!````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu
new file mode 100644
index 0000000..ea3a546
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu
@@ -0,0 +1,88 @@
+# $FreeBSD$
+begin 644 img-63x255-512-gpt.vmdk.gz
+M'XL("/K%'50``VEM9RTV,W@R-34M-3$R+6=P="YV;61K+F]U=`"M7%UOW-81
+M?<^ON%4>$K3H@F?Y_6"@294`01'`C=WFI0]=?C5"'=F5A:(&]L>7E[SGZE!:
+MBG0T"NW=,6?.WIE+SBIG#I@D\X]S6>.RS&6=RPN7P(W_-!\N21^,\3A6/''^
+MR_6/?S_PY^O#X?S%#`8?)2%(%$Z,Q>><#X]^"'=\+FIQ8CR.FW"ICVJ>!`:X
+MX\J)5;AL/'F\%,+5G:;3G7\C<"X"N05<?B&GU62?6]WOOPC%\^M+_1K&[2UJ
+M5Z:N:(+IBGRR4U<>IW.)*T>G803\TEW??/RWN^X_MG<W'^[?A_4=_=Z.SEGA
+M_8O6(XR)E85_XT]XN-I#%+U+.Y?"GW;GN^]OWO6'__9W'V_>W[X"TSWZO<U2
+ME]5^.=X_>3@6AO^0Q!7PG^'.?_[A^E6X<I/#A],=X7S4N)#QL\<\%+<HG/_S
+M])A6U]_>>\0A_,35^;T-Q<FGS\[\FSQS9>VFY>0>^SB>[D+*4^W:N_YTW[_]
+M]*%_=?7K^]M8.[^WOF3U!%1-A4I=GGJHD)HO7^X1_64S[9H[O[NY_^6F?3.F
+M^;&_.GSI"%?XVHT;6(5US5F/(<7JSH[+/G_WO_LQ7]>%G;TAW+2(*8GQL_.C
+MRTN/-6[@M!5'EV;^W?A/XX+'3#)X)W=^?WOXZ>?Q%O?%>O/ZFY\(5XU1H^>X
+MP#%D3&B14S[GGS^^+-WYS7?NRB?Y]I=^N@()5\^WF7>>]P&3>?1O0M5F>-_$
+M,G]BVEEW?;H_N6]/'_O#E]?7W\:=/?EDL^D8E]9[E&*&]M?W5,ZQ</-.SQL]
+M;477-8=3=_IPW]_Y[8U;T?@2=2%3OZW9PS8N/Z><=FKP5XP[OW)7-]VXIQ[V
+M7_W[7PG7SI?QN`Y_2=138.K?C%?/!-^'3YBO&+]-'JZ_O_MT:#^]N[GMQAO-
+MO2)<-]=N7$Z:A$7%-3U>5/S8L797R</21FS"];Y$\Z*J<&.,6/,Z'JK@KYC<
+M'Z$*YT^'7_I3-R[+71WS_"INQ?!X*[1$CZHP;_18BWDKPL(^'3[V;8!+D["!
+MPZ(X\YI<6K@T#2M:-M#[]W?3THKT2OMQ^OB[[*7].'ORE5K^1L`9SGI]1?+H
+M^RS5N$R,?`'HO\62\<^?QC^O']97^/45XEEJ5"5&O8#[YPCQX6FZA;_$3N+9
+M:%0K1K>G>H5O;;UX#H^KQU\U(._7X?B[`#U3C<K$R!=P:[7+0^WH66I4)4:]
+M@%NK71%J1\]&HUHQNEW)EJ%V]!PTRK_P5RDD.WXM*ZI0.WJF&I6)D2_@UFI7
+MA]K1L]2H2HQZ`;=6NU.H'3T;C6K%Z'8EVX3:T7/0*/_"!@%YOP[7AMK1,]6H
+M3(Q\`;=6NR[4CIZE1E5BU`NXM=KUH7;T;#2J%:/;E>P0:D?/0:/\2R:UR[;@
+MRB34CIZI1F5BY`NXE=J5['?T+#6J$J->P*W4KF2_HV>C4:T8W:YDV>_H.6B4
+M?\FE=ODF'/L=/5.-RL3(%W!KM6._HV>I4948]0)NK7;L=_1L-*H5H]N5+/L=
+M/0>-\B^%U*[8A&._HV>J49D8^0)NK7;L=_0L-:H2HU[`K=6._8Z>C4:U8G2[
+MDF6_H^>@4?Z%OP1!WJ_#L=_1,]6H3(Q\`;=6._8[>I8:58E1+^#6:L=^1\]&
+MHUHQNEW)LM_1<]`H_T)"!O)^%:Y*0NWHF6I4)D:^@%NI7<5^1\]2HRHQZ@7<
+M2NTJ]CMZ-AK5BM'M2I;]CIZ#1OF76FI7;\*QW]$SU:A,C'P!MU8[]CMZEAI5
+MB5$OX-9JQWY'ST:C6C&Z7<FRW]%ST"C_PO^%@KQ?AV._HV>J49D8^0)NK7;L
+M=_0L-:H2HU[`K=6._8Z>C4:U8G2[DF6_H^>@4?Z%_"/D_3H<^QT]4XW*Q,@7
+M<&NU8[^C9ZE1E1CU`FZM=NQW]&PTJA6CVY4L^QT]!XWR+ZW4KMV"JY-0.WJF
+M&I6)D2_@5FI7L]_1L]2H2HQZ`;=2NYK]CIZ-1K5B=+N29;^CYZ!1_J63VG6;
+M<.QW]$PU*A,C7\"MU8[]CIZE1E5BU`NXM=JQW]&ST:A6C&Y7LNQW]!PTRK_T
+M4KM^$X[]CIZI1F5BY`NXM=JQW]&SU*A*C'H!MU8[]CMZ-AK5BM'M2I;]CIZ#
+M1OF706HW;,*QW]$SU:A,C'P!MU8[]CMZEAI5B5$OX-9JQWY'ST:C6C&Z7<FR
+MW]%ST*A$IF>0]ZMPIV2N7?1,-2H3(U_`K=3N%/I=]"PUJA*C7L"MU.X4^EWT
+M;#2J%:/;E6SH=]%ST"A?,N'OL$EIG4*_@_!W4/X.PM]AD[\[A7X'X>^@_!V$
+MO\,F?W<*_0["WT'Y.PA_MR/9T.\@_!V4OX/P=]BDM$ZAWT'X.RA_!^'OL,G?
+MG4*_@_!W4/X.PM]AD[\[A7X'X>^@_!V$O]N1;.AW$/X.RM]!^#ML4EJGT.\@
+M_!V4OX/P=]CD[TZAWT'X.RA_!^'OL,G?G4*_@_!W4/X.PM_M2#;T.PA_!^7O
+M(/P=-BFM)@FU$_X.RM]!^#ML\G<-^YWP=U#^#L+?89._:]COA+^#\G<0_FY'
+MLNQWPM]!^3L(?X=-2JMAOQ/^#LK?0?@[;/)W#?N=\'=0_@["WV&3OVO8[X2_
+M@_)W$/YN1[+L=\+?0?D["'^'34JK8;\3_@[*WT'X.VSR=PW[G?!W4/X.PM]A
+MD[]KV.^$OX/R=Q#^;D>R['?"WT'Y.PA_ATU*JV&_$_X.RM]!^#ML\G<-^YWP
+M=U#^#L+?89._:]COA+^#\G<0_FY'LNQWPM]!^3L(?X=-2JM-0NV$OX/R=Q#^
+M#IO\7<M^)_P=E+^#\'?8Y.]:]COA[Z#\'82_VY$L^YWP=U#^#L+?89/2:MGO
+MA+^#\G<0_@Z;_%W+?B?\'92_@_!WV.3O6O8[X>^@_!V$O]N1+/N=\'=0_@["
+MWV&3TFK9[X2_@_)W$/X.F_Q=RWXG_!V4OX/P=]CD[UKV.^'OH/P=A+_;D2S[
+MG?!W4/X.PM]AD])JV>^$OX/R=Q#^#IO\7<M^)_P=E+^#\'?8Y.]:]COA[Z#\
+M'82_VY$L^YWP=U#^#L+?89/2ZI)0.^'OH/P=A+_#)G_7L=\)?P?E[R#\'3;Y
+MNX[]3O@[*'\'X>]V),M^)_P=E+^#\'?8I+0Z]COA[Z#\'82_PR9_U['?"7\'
+MY>\@_!TV^;N._4[X.RA_!^'O=B3+?B?\'92_@_!WV*2T.O8[X>^@_!V$O\,F
+M?]>QWPE_!^7O(/P=-OF[COU.^#LH?P?A[W8DRWXG_!V4OX/P=]BDM#KV.^'O
+MH/P=A+_#)G_7L=\)?P?E[R#\'3;YNX[]3O@[*'\'X>]V),M^)_P=E+^+8CK(
+M>X%S\Y\`UR=S[2Y*RB_\4ZR=N[BZWEH?.`Q[`=/+Z?H]CNDB>789G[\^3/K%
+M./.8J_[;`&<XX_HASM^E3`]QGZNO1)R_\WB1OA)Q_L[C1?I*Q/D[CQ?I*Q'G
+M[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1
+MY^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K
+M$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH
+M*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@KP?F[C;X2G+_;Z"O!^;N-OA*<O]OH
+M*\'YNXV^$IR_V^@KP?F[C;X2G+_;Z"O!^;N-OA*<O]OH*\'YNXV^$IR_V^@K
+MP?F[C;X2G+_;Z"O!^;N-OA*<O]OH*\'YNXV^$IR_V^@KP?F[C;X2G+_;Z"O!
+M^;N-OA*<O]OH*\'YNXV^$IR_V^@KP?F[C;X2G+_;Z"O!^;N-OA*<O]OH*\'Y
+MNXV^$IR_V^@KP?F[C;X2G+_;Z"L1Y^_T?)&^$G'^3L\7Z2L1Y^_T?)&^$G'^
+M3L\7Z2L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O
+M1)R_F^@K$>?O)OI*Q/F[B;X2<?YNHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZB
+MKT2<OYOH*Q'G[R;Z2L3YNXF^$G'^;J*O1)R_F^@K$>?O)OI*Q/F[B;X2<?YN
+MHJ]$G+^;Z"L1Y^\F^DK$^;N)OA)Q_FZBKT2<OYOH*\'YNXV^$KVIOA*]J;X2
+MO:F^$KVIOA*]J;X2O:F^$KVIOA*]J;X2O:F^$KVIOA*]J;X2O:F^$KVIOA*]
+MJ;X2O:F^$D.2&.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8ZBLQ
+MF.HK,9CJ*S&8ZBLQF.HK,9CJ*S&8ZBLQF.HKCTF2&.HKCT^>=;P3[FFRLS[P
+M"%-]Y?'X[#(^?WW95+_YZ:I/_UX_<?[VL/PO`J+Y/$"N<`G'A#/X>V/6>O6]
+M&X9PS,JYAPSC4ZPO)/SU0>`ZX_KMW]_YR'-W.CT!_!O7-^UOEOOG,6?U]'!>
+M/IDWSR+<E'O>ZOJ^^_X']_J;G]YZL'\\I#L]WGEH7=VYOO00R]7AF73?/KT[
+MLNGQSF/UC^7%9--5N*\NW6S9]'CGH7L&[M*Q#I<]%_6Y3P+/IL<[:Y2J;UV5
+MN^KHG]_;/7[R[`/0NP5<87SE34^>;0I7MO[YP3E<.SWLN2L\+>VJ\3:9[XFC
+M.W9>B5#"'?T3F0_GV[\>;F>P/Q[^\X>POOG)L[A\K)]8JUYV?.Z*\(O:2-<M
+MX5+KZOG?5YK<K'IUN%@N'>LG5JMWFJNW\JTV+NK2K3O"\5OM=TNXQKAZDRI_
+M%IX\_7O]Q/GU8?G?#)@%0+,59OZ1@G9WAX<SO#L\G.'=X>%,[PX/:'AW>#C#
+MN\/#&=X='L[T[LC\`R/MOL0]G+_VNK'FM7^&?[Z\:M:_CL?U_?QF6MA7BW0G
+MSG'UJ_^9+_'+F]$;?HE[N&>_Q(=^/=GP\RA9PR]Q#V?Z)9[YIW<F7_P?K`W?
+%E+1E````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow.gz.uu
new file mode 100644
index 0000000..e99d8f8
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow.gz.uu
@@ -0,0 +1,128 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.qcow.gz
+M'XL("%7N+50``VEM9RTV,W@R-34M-3$R+6UB<BYQ8V]W+F]U=`"MG<F.5=D1
+M1>?U%8\>DNY%Q&UI,E.6;,DS>V![6K<=OP]`_G8#>9K,N'L3E`M`I419=^N]
+MDXM%J5@ZG,]WWTZG5DY-=VK&TSZ?OOX\_9#3O9\\_''Z\L^__?W=_6]??KL;
+MD_,/GG(_[[<R]V#KOW5.OSVUG,[C3\Q]_2%H[MZKLS_PZNZ]V>/<U6]W;Q8_
+MIVS0'@R>TMPYO3XAI]?\W.N[=6]7[D[OU[U=)6^W_;G!?[C7IW\(EI]Z?7_P
+MZ]O!P=_+ZVO@4SV;&Q[,70YOMX5/C6QN^B',>N[@4S.;6X*Y'CZULKDMF!O@
+M4SN>DQ]\;>_F1OB4L#F%<Z<R-\&GC,TU#^;.:>ZVS,WP*?+K0AQW^==%Y6Z!
+M3Q'N).1NA4\1[B3D;H-/$>XDY&Z'3Q'N).).\%.$.XVX$Z0H9=QIQ)T@(ROC
+M3B/N!/E.&7<:<2?(=\JXTX@[0;Y3QIU&W`GRG3+N-.).D.^4<:<A=\AWRKBS
+MD#OD.V/<6<@=\ITQ[BSD#OG.&'<6<H=\9XP["[E#OC/&G87<(=\9X\Y"[I#O
+MC'%G$7>*GR+<-1%WBGS7,.Z:B#M%OFL8=TW$G2+?-8R[)N).D>\:QET3<:?(
+M=PWCKHFX4^2[AG'71-PI\EW#N&M"[I#O&L9=&W*'?-<R[MJ0.^2[EG'7AMPA
+MW[6,NS;D#OFN9=RU(7?(=RWCK@VY0[YK&7=MR!WR7<NX:R/N##]%N.LB[@SY
+MKF/<=1%WAGS7,>ZZB#M#ONL8=UW$G2'?=8R[+N+.D.\ZQET7<6?(=QWCKHNX
+M,^2[CG'7A=PAWW6,NS[D#OFN9]SU(7?(=SWCK@^Y0[[K&7=]R!WR7<^XZT/N
+MD.]ZQET?<H=\US/N^I`[Y+N><=='W#7X*<+=$''7(-\-C+LAXJY!OAL8=T/$
+M78-\-S#NAHB[!OEN8-P-$7<-\MW`N!LB[AKDNX%Q-T3<-<AW`^-N"+E#OAL8
+M=_E_S_,YY+N1<3>&W"'?C8R[,>0.^6YDW(TA=\AW(^-N#+E#OAL9=V/('?+=
+MR+@;0^Z0[T;&W1AQU^*G"'=3Q%V+?#<Q[J:(NQ;Y;F+<31%W+?+=Q+B;(NY:
+MY+N)<3=%W+7(=Q/C;HJX:Y'O)L;=%''7(M]-C+LIY`[Y;F+<Y3\FY7/(=S/C
+M;@ZY0[Z;&7=SR!WRW<RXFT/ND.]FQMT<<H=\-S/NYI`[Y+N9<3>'W"'?S8R[
+M.>*NPT\1[I:(NP[Y;F'<+1%W'?+=PKA;(NXZY+N%<;=$W'7(=POC;HFXZY#O
+M%L;=$G'7(=\MC+LEXJY#OEL8=TO('?+=PKA;0^Z0[U;&W1IRAWRW,N[6D#OD
+MNY5QMX;<(=^MC+LUY`[Y;F7<K2%WR'<KXVX-N4.^6QEW:\1=CY\BW)%`Z-X<
+M\MW&N-LB[GKDNXUQMT7<]<AW&^-NB[CKD>\VQMT6<=<CWVV,NRWBKD>^VQAW
+M6\1=CWRW,>ZVD#ODNXUQMX?<(=_MC+L]Y`[Y;F?<[2%WR'<[XVX/N4.^VQEW
+M>\@=\MW.N-M#[I#O=L;='G*'?+<S[O:(NP$_A;F3_`&?`[Z3,^%.SA%W`_"=
+MG`EW<HZX&X#OA/6!XON[`W<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X
+M3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\)VP
+M_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-^*G"'=A?S<BW['^3L+^
+M;D2^8_V=A/W=B'S'^CL)^[L1^8[U=Q+V=R/R'>OO).SO1N0[UM])V-^-R'>L
+MOY.POQN1[UA_)V%_-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NQ'YCO5W$O9W
+M(_(=Z^\D[.]&Y#O6WTG8WXW(=ZR_D["_F_!3A+NPOYN0[UA_)V%_-R'?L?Y.
+MPOYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W$_(=Z^\D[.\FY#O6WTG8WTW(
+M=ZR_D["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W81\Q_H["?N["?F.]7<2
+M]G<3\AWK[R3L[R;D.];?2=C?S?@IPEW8W\W(=ZR_D["_FY'O6'\G87\W(]^Q
+M_D["_FY&OF/]G83]W8Q\Q_H["?N[&?F.]7<2]G<S\AWK[R3L[V;D.];?2=C?
+MS<AWK+^3L+^;D>]8?R=A?S<CW['^3L+^;D:^8_V=A/W=C'S'^CL)^[L9^8[U
+M=Q+V=S/R'>OO).SO%OP4X2[L[Q;D.];?2=C?+<AWK+^3L+];D.]8?R=A?[<@
+MW['^3L+^;D&^8_V=A/W=@GS'^CL)^[L%^8[U=Q+V=POR'>OO).SO%N0[UM])
+MV-\MR'>LOY.POUN0[UA_)V%_MR#?L?Y.POYN0;YC_9V$_=V"?,?Z.PG[NP7Y
+MCO5W$O9W*WZ*<!?V=ROR'>OO).SO5N0[UM])V-^MR'>LOY.POUN1[UA_)V%_
+MMR+?L?Y.POYN1;YC_9V$_=V*?,?Z.PG[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6
+MWTG8WZW(=ZR_D["_6Y'O6'\G87^W(M^Q_D["_FY%OF/]G83]W8I\Q_H["?N[
+M#3]%N`O[NPWYCO5W$O9W&_(=Z^\D[.\VY#O6WTG8WVW(=ZR_D["_VY#O6'\G
+M87^W(=^Q_D["_FY#OF/]G83]W89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D
+M.];?2=C?;<AWK+^3L+_;D.]8?R=A?[<AW['^3L+^;D.^8_V=A/W=CI\BW(7]
+MW8Y\Q_H["?N['?F.]7<2]G<[\AWK[R3L[W;D.];?2=C?[<AWK+^3L+_;D>]8
+M?R=A?[<CW['^3L+^;D>^8_V=A/W=CGS'^CL)^[L=^8[U=Q+V=SOR'>OO).SO
+M=N0[UM])V-_MR'>LOY.PO]N1[UA_)V%_MR/?L?Y.HO[.SO@IS)WF#]S<J<X!
+MWWU]"G.GKK_+]_V=3F4.^$Y9?Z>NOSLE[DZW90[X3EE_IZZ_.R7N3K^7.>`[
+M9?V=NO[N=#F<'?"=LOY.77]7SJ[.`=\IZ^_4]7=@#OA.67^GKK\#<\!WROH[
+M=?U=GGM4YX#OE/5WZOJ[1WFN<@=\IZR_4]??/4K</:K<`=\IZ^_4]7>/$G>/
+M*G?`=\KZ.W7]W:/+X>R`[Y3U=^KZNW)V=0[X3EE_IZZ_`W/`=\KZ.W7]W7$.
+MW7^GK+]3U]_EN<=U#OF.]7?J^KO'>:YPA^Z_4];?J>OO'B?N'A?NT/UWROH[
+M=?W=X\3=X\(=NO].67^GKK][?#F<'?(=Z^_4]7?E[.H<\AWK[]3U=V`.^8[U
+M=^KZ.S"'?,?Z.W7]79Y[4N>0[UA_IZZ_>Y+G*G?(=ZR_4]??/4G</:G<(=^Q
+M_DY=?_<D<?>D<H=\Q_H[=?W=D\OA[)#O6'^GKK\K9U?GD.]8?Z>NOP-SR'>L
+MOU/7WQWGT/UWROH[=?U=GGM:YY#O6'^GKK][FN<*=^C^.V7]G;K^[FGB[FGA
+M#MU_IZR_4]??/4W</2W<H?OOE/5WZOJ[IY?#V2'?L?Y.77]7SJ[.(=^Q_DY=
+M?P?FD.]8?Z>NOP-SR'>LOU/7W^6Y9W4.^8[U=^KZNV=YKG*'?,?Z.W7]W;/$
+MW;/*'?(=Z^_4]7?/$G?/*G?(=ZR_4]??/;L<S@[YCO5WZOJ[<G9U#OF.]7?J
+M^CLPAWS'^CMU_=UQ#MU_IZR_4]??Y;GG=0[YCO5WZOJ[YWFN<(?NOU/6WZGK
+M[YXG[IX7[M#]=\KZ.W7]W?/$W?/"';K_3EE_IZZ_>WXYG!WR'>OOU/5WY>SJ
+M'/(=Z^_4]7=@#OF.]7?J^CLPAWS'^CMU_5V>>U'GD.]8?Z>NOWN1YRIWR'>L
+MOU/7W[U(W+VHW"'?L?Y.77_W(G'WHG*'?,?Z.W7]W8O+X>R0[UA_IZZ_*V=7
+MYY#O6'^GKK\#<\AWK+]3U]\=Y]#]=\KZ.W7]79Y[6>>0[UA_IZZ_>YGG"G?H
+M_CME_9VZ_NYEXNYEX0[=?Z>LOU/7W[U,W+TLW*'[[Y3U=^KZNY>7P]DAW['^
+M3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\#<\AWK+]3U]_EN5=U#OF.]7?J^KM7
+M>:YRAWS'^CMU_=VKQ-VKRAWR'>OOU/5WKQ)WKRIWR'>LOU/7W[VZ',X.^8[U
+M=^KZNW)V=0[YCO5WZOH[,(=\Q_H[=?W=<0[=?Z>LOU/7W^6YJSJ'?,?Z.W7]
+MW56>*]RA^^^4]7?J^KNKQ-U5X0[=?Z>LOU/7WUTE[JX*=^C^.V7]G;K^[NIR
+M.#OD.];?J>OORMG5.>0[UM^IZ^_`'/(=Z^_4]7=@#OF.]7?J^KL\][K.(=^Q
+M_DY=?_<ZSU7ND.]8?Z>NOWN=N'M=N4.^8_V=NO[N=>+N=>4.^8[U=^KZN]>7
+MP]DAW['^3EU_5\ZNSB'?L?Y.77\'YI#O6'^GKK\[SJ'[[Y3U=^KZNSSWILXA
+MW['^3EU_]R;/%>[0_7?*^CMU_=V;Q-V;PAVZ_TY9?Z>NOWN3N'M3N$/WWRGK
+M[]3U=V\NA[-#OF/]G;K^KIQ=G4.^8_V=NOX.S"'?L?Y.77\'YI#O6'^GKK_+
+M<V_K'/(=Z^_4]7=O\USE#OF.]7?J^KNWB;NWE3OD.];?J>OOWB;NWE;ND.]8
+M?Z>NOWM[.9P=\AWK[]3U=^7LZASR'>OOU/5W8`[YCO5WZOJ[XQRZ_TY9?Z>N
+MO\MS[^H<\AWK[S3J[PS=?Z>LO].HOS-T_YVR_DZC_L[0_7?*^CN-^CM#]]\I
+MZ^\TZN\,W7^GK+_3J+\S=/^=LOY.H_[.T/UWROH[)?W=^SJ'?,?Z.W7]W?L\
+M5[E#OF/]G;K^[GWB[GWE#OF.]7?J^KOWB;OWE3OD.];?J>OOWE\.9X=\Q_H[
+M=?U=.;LZAWS'^CMU_1V80[YC_9VZ_NXXA^Z_4];?6?[`S9WK'/"=L?[NZR<>
+M<)?]="[<H?OOC/5WYOJ[<]H[%^[0_7?&^CMS_=TY<7<NW*'[[XSU=^;ZN_/E
+M<';`=\;Z.W/]73F[.@=\9ZR_,]??@3G@.V/]G;G^#LP!WQGK[\SU=WE.ZASP
+MG;'^SEQ_)WFN<@=\9ZR_,]??27IY4KD#OC/6WYGK[R1Q)Y4[X#MC_9VY_DXN
+MA[,#OC/6WYGK[\K9U3G@.V/]G;G^#LP!WQGK[\SU=\<Y=/^=L?[.7'^7Y[3.
+M(=^Q_LY<?Z=YKG"'[K\SUM^9Z^\T<:>%.W3_G;'^SEQ_IXD[+=RA^^^,]7?F
+M^CN]',X.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\Q_H[<_T=F$.^8_V=N?XNSUF=
+M0[YC_9VY_L[R7.4.^8[U=^;Z.TO<6>4.^8[U=^;Z.TO<6>4.^8[U=^;Z.[L<
+MS@[YCO5WYOJ[<G9U#OF.]7?F^CLPAWS'^CMS_=UQ#MU_9ZR_,]??Y;FFSB'?
+ML?[.7'_7Y+G"';K_SEA_9ZZ_:Q)W3>$.W7]GK+\SU]\UB;NF<(?NOS/6WYGK
+M[YK+X>R0[UA_9ZZ_*V=7YY#O6']GKK\#<\AWK+\SU]^!.>0[UM^9Z^_R7%OG
+MD.]8?V>NOVOS7.4.^8[U=^;ZNS9QUU;ND.]8?V>NOVL3=VWE#OF.]7?F^KOV
+M<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5WQSET_YVQ_LY<?Y?GNCJ'
+M?,?Z.W/]79?G"G?H_CMC_9VY_JY+W'6%.W3_G;'^SEQ_UR7NNL(=NO_.6']G
+MKK_K+H>S0[YC_9VY_JZ<79U#OF/]G;G^#LPAW['^SEQ_!^:0[UA_9ZZ_RW-]
+MG4.^8_V=N?ZNSW.5.^0[UM^9Z^_ZQ%U?N4.^8_V=N?ZN3]SUE3OD.];?F>OO
+M^LOA[)#O6']GKK\K9U?GD.]8?V>NOP-SR'>LOS/7WQWGT/UWQOH[<_U=GAOJ
+M'/(=Z^_,]7=#GBO<H?OOC/5WYOJ[(7$W%.[0_7?&^CMS_=V0N!L*=^C^.V/]
+MG;G^;K@<S@[YCO5WYOJ[<G9U#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_B[/
+MC74.^8[U=^;ZNS'/5>Z0[UA_9ZZ_&Q-W8^4.^8[U=^;ZNS%Q-U;ND.]8?V>N
+MOQLOA[-#OF/]G;G^KIQ=G4.^8_V=N?X.S"'?L?[.7']WG$/WWQGK[\SU=WGN
+M0YU#OF/]G;G^[D.>*]RA^^^,]7?F^KL/B;L/A3MT_YVQ_LY<?_<A<?>A<(?N
+MOS/6WYGK[SY<#F>'?,?Z.W/]73F[.H=\Q_H[<_T=F$.^8_V=N?X.S"'?L?[.
+M7'^7YS[6.>0[UM^9Z^\^YKG*'?(=Z^_,]7<?$W<?*W?(=ZR_,]???4S<?:S<
+M(=^Q_LY<?_?Q<C@[Y#O6WYGK[\K9U3GD.];?F>OOP!SR'>OOS/5WQSET_YVQ
+M_LY<?Y?G/M4YY#O6WYGK[S[EN<(=NO_.6']GKK_[E+C[5+A#]]\9Z^_,]7>?
+M$G>?"G?H_CMC_9VY_N[3Y7!VR'>LOS/7WY6SJW/(=ZR_,]??@3GD.];?F>OO
+MP!SR'>OOS/5W>>YSG4.^8_V=N?[N<YZKW"'?L?[.7'_W.7'WN7*'?,?Z.W/]
+MW>?$W>?*'?(=Z^_,]7>?+X>S0[YC_9VY_JZ<79U#OF/]G;G^#LPAW['^SEQ_
+M=YQ#]]\9Z^_,]7=Y[KK.(=^Q_LY<?W>=YPIWZ/X[8_V=N?[N.G%W7;A#]]\9
+MZ^_,]7?7B;OKPAVZ_\Y8?V>NO[N^',X.^8[U=^;ZNW)V=0[YCO5WYOH[,(=\
+MQ_H[<_T=F$.^8_V=N?XNS]W4.>0[UM^9Z^]N\ESE#OF.]7?F^KN;Q-U-Y0[Y
+MCO5WYOJ[F\3=3>4.^8[U=^;ZNYO+X>R0[UA_9ZZ_*V=7YY#O6']GKK\#<\AW
+MK+\SU]\=YIHS?@ISU^0/W-QMG0.^:UA_U[C^[C;/G<H<\-W7IS!WC>OO;A-W
+MM[=E#OBN8?U=X_J[V\3=[>]E#OBN8?U=X_J[V\OA[-#?MUU.G'[BRSOW[<MO
+M5]\'V^]?VT9/YPG\DW_BRU_>/?Q>!K_?:_0'!K^]83D,YC?<WMUK]+VMF]H$
+MWM>?WMDMO;U%ZN^R]]_PS1U\U^_NS:&_-_K/G!^ZBNA'@VU[FJ;#X+_RZT-7
+M$?V9U]=MO_CKVW\'INU/37MJN].@/_L*__/7?[M7>#<'9/#_O>&[.2"#AW/Y
+M!9??'P]S-_?FOLE@O_=OGN7>4_>YN__QO;GK=_=^`^^1#.K<-P%NZ!/TS?YB
+M&?2'"R?O?YV_W\ELIW/^\QEWT6GY^I[JZT.!_X.W^X/7=SJ^W>__@=$__/?E
+MWIP&;_?T<&XN9@%?PN#TKH^O#OT%]W_FBW&X-O$G?^5^&WGX*_=N3G^M"(;O
+G9OGVV^($_LD_\>4?[QY^OQMLTN`O.\'F*WWG\V__`[M'T1.AJ```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow2.gz.uu
new file mode 100644
index 0000000..bea1353
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.qcow2.gz
+M'XL("%7N+50``VEM9RTV,W@R-34M-3$R+6UB<BYQ8V]W,BYO=70`K9C;DM,P
+M#$#?]RO,'18HL>3<N+2PL,SP!@_`<WK[B@[?3E(KL:-(\;:3-I-IQ]49V3Y2
+MDV29?QF36^,*XVISW)KV.QU@HB_CPYQ^??^QBE^G&P^SF1(E#)2'`3=B_0LX
+MT'"9G0Y8&1=EAP(.^J@I*(5S:G9S`P+N]N:\=.?-J%@$7@/T.'4SKLH/?'X\
+MPEV9'RR='\KKE_=Q?*"8SP]]?CRJU'!5$@="5*WAFB0.A:BMAMLE<4Z(VFLX
+MI7(C7"Y$'16<3:C2X@HARFHX2.)*(0HUG$OB*B%*\\ZFO:N%*,T[F_:N$:(T
+M[VS:NZT0I7EGT][MA"C-.YOV;B]$:=Z!XIT)N(,0I7D'S+M'A'L<<$<A2O,.
+MF'=/"/=TP%DI2O,.F'?/"/<\X(1^!YIWP+Q[0;B7`2?T.]"\`^;=*\+=!IS0
+M[T#S#IAWKPGW)N"$?@>:=\"\>SOQS@K]#C3OD'GWCEA9P`G]#C7OD'EG"0<!
+M)_0[U+Q#YAT2S@6<T.]0\PZ9=SGABH`3^AUJWB'SKB1<%7!"OT/-.V3>U81[
+M'W!"OT/-.V3>?2#<QX`3^AUJWB'S[A/AU@$G]#O4O'/,NPWA/@><T.^<YIUC
+MWGTAW%W`"?W.:=XYYMU7PGT;<"!%#=YEF7P0[GY2L[#L]:<+U\=6..L#,\#J
+M$N!<AAY7+SKAW$^XTZ`1SOK`Z6XU?@_`<[%=`*QH!<<XFG#NB\VO3I/WI6&I
+M0&AZ.QO*+)[PQI?'>A7A]@NOW[D^+@#FN6F:"?!WGQ_,IG%Y?N5AX?VM_..&
+MLJO:O#`5/#3#O_=_ID*WN,4JV./TQPTTT"<\M-@);A/ANBN68_3+N$Y'WL6?
+M(]QZ%5I]BYM]W-#=0QVD`76R^;*R5$.S&FR-]KF[=._NL/I_;W;I/>RO"?D)
+MS0I&TYW)STRGVUT5#'?O;#\Z'"2F:\:X[=!9A"U,K-YZFMUNX<VPO#(>6+D=
+L9%RY'@?+-H+ZW%E:`]M?3<_ZP.GG:OSV0$?`Q5;0%=U_V\U_7_5L5B,5````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.raw.gz.uu
new file mode 100644
index 0000000..dc6c0cb
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.raw.gz
+M'XL("%;N+50``VEM9RTV,W@R-34M-3$R+6UB<BYR87<N;W5T`*V4S8Z$(`S'
+M[SY%SWL@!65E+DZRR=[WLC-GQM6G\.&W6'7*X,>80)%@"K_\2PN(W``J`^A7
+MQFW'\*5B&XJ/8J3IQSF@0T"=`!4!&=<2CA:03&_#6/;A-XS!@:&W]-]-<^XP
+M$$%=R:@U2N#^EEUIWW:,.-F>X?;G@-:"]PGP=]9G=F6<UU=WF?/KQH*Q-506
+M["<X\Z["^_?M12'C=*Z`&6>.<+-@KJ`UW%7@2G+V8B57XK1+UIV<"US#WXRK
+M]M3126"WYM@,UN8M%D<6[Y-Y!MV!+@'=Y#,Q<,DO//5=4ADF"G=''Z3A^H"K
+MX_5:X,Q!N!#C'LO+LI+"@]-K4G5MYF3HUYOQYLT-D/CF,L[D?0@NX\M"%4BK
+;TG';,?RHV!A83<!L)QA>/L3B'ZC")G7E!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.vhd.gz.uu
new file mode 100644
index 0000000..27e7455
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.vhd.gz.uu
@@ -0,0 +1,19 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.vhd.gz
+M'XL(""DUQ%4``VEM9RTV,W@R-34M-3$R+6UB<BYV:&0N;W5T`*V7/6^D,!"&
+M^_T5(UV7`IG!-DZS*T5*?\TEM4T@6ITNB9(K4O#CSX,-V!C8;,X+:X',/+R>
+M+V3&W`]`5B`[D"U(0=<U!WD+M0*PD_[$82S]+?3-ZTO;_#U_%O[7'QRL9*%5
+M;$[V6`&W+ZD!-;U$/M$U]".F^''_?'/^\SSBT./0@T1-5A6"-,E[.@.,.W5$
+M>CSC[Z6Z*E4W6[GW=!U47?!$%:HKBE.(X];*/D^G`",'_XQG=!--A+A(G6`+
+MJT#FFE/9O-@UG-RSN@9W<_"Q<*EB$Z.V(P-90HUT;=-F]$-RVE3Y_'C3[Q_M
+M0A]NI(J<])7)G-I>+OI4P2FP3@&GU-Y;+@R4UR5N)57^RWLRMN/^PCJ!B7$"
+MA^7'WIM1$.J3)=OQ^78P-O5ITL=MG>F5<7NBOROB8P(:<QU0,5<=,6Y:L&E\
+M=3#0@D:JTM+7JO=?8^_;E8"<7-D>`_^9I\SQ-=UU0"%`ZP3X:]37[,JX7I]2
+MF>.KAH2Q_=BV<R%!X5<5/MX_K-2OTAOMX'O=3VF\A!L%A]T^QIT"7.7*;:8$
+MS2G*N_`ZP!W=?\3Q/774$]JUB<W%BLS)HM7"+HPSE"V4%35C-G6M`#C%%V9]
+MMZD,C):[HP_2Y6K"U?'S98##"\N%&&>FSK(2P@O>.Z;JFLS!,,O*^&+E$B2N
+M7(?#O(U`#YW%9J!]*AVW)_J?17PX(/I/4;9O&_IFFDTA]\!L"BVPS:Q0Y_U^
+M2.&"DFFC0+B,&P7"9=PH$"[C1H%P&3<*A,NX42!<UHV"!=K<._P#==^RJ5T.
+"````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.vhdf.gz.uu
new file mode 100644
index 0000000..5b0e076
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.vhdf.gz
+M'XL(")PEAE4``VEM9RTV,W@R-34M-3$R+6UB<BYV:&1F+F]U=`"ME3MOPR`0
+MQ_=\BI.Z9;!X&.PLB50I>Y<VL^W@*(K:+ATZ^,/W`./PL/.H,`3A'/SR/^ZX
+M$&(?@)(!:6;&9</P6H1M6*U7AD;;YX`U`4(38(%`B^L0APM09B/TR'O]JD=M
+M(+IW^*[&N>TP(*'88<-G6WBXX[0K[<L&@_.?J[O]<T`AH&D2X+O3QV[*>%Y?
+MI3+'MS8)(RHH!0@)-7M4X6'_$2FT.)K+88MC]W!.L,V@.=S.PW$T]MY*FXGC
+M+C_O_+F'V]J/PY6WU.%)$#5G6'16Y$V6&ENXSX\S4`64`ZE'&PN!4WSAJF^3
+MRF"!NS?T0>INHW%5N)YZ.';'70AQ[5199D)XY_2VJ;HN<S!H?#,>O+D:$MY<
+MBV-Y"\'&5!;,0%R5CLN&X:T(FP66(S#7"5+WWR8YR!ZD`BGTO"I!;J"J?2`+
+M,VGHOK]4]W/^]2)L<-06@]FN]S.N;XNL@#7Z1^11SSU]+_O3^OQY<CA7JEQ%
+MPLN&NS@#V4;NTMC=PYE=8G4\/B0:G1[3.OVRA]\$I[?S<>7DK.JA/1J<Z\%+
+=8)@K508G2+3KO[&U.)DY5?!_=_4'[+Y)>1`)````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-mbr.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-mbr.vmdk.gz.uu
new file mode 100644
index 0000000..fe22486
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-mbr.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-512-mbr.vmdk.gz
+M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+6UB<BYV;61K+F]U=`"M7-%NY,81
+M?/=7#.2W/"Q8RR6Y?#@[<<X!@B"`$3OV:\CE,!9BWQUT0I`#]/'AD%.C(D4>
+M::MUJP/[V%W;W4.U=-4%9=GTX=RE=9>+NW2N*%T&-_S3]')9_FP,KTNZ\?2W
+MMW__\<2//YY.3U],8`A1$H),X<28O<_3:?%!N//GHF8WAM=Y%RX/4>V+P`AW
+MWKBQ"3?TPYW70IA=,][NPH7`N03D9G#%2DV;Q7XNNS]\$9L7\LM##L/QEK6K
+M<E>VT71E,=JYJ\[CO<Q5@U,_`'[IWMY__(][ZS_>'NX_/+Z/^9W#V0[.ES+X
+ME[>`,!16E>$BW`AP=8`HO<L[ER/<=D\/?[G_Q9_^ZQ\^WK]_]P8L]QS.]I*[
+M2QW2"?[9\VMFA#?)7(GP'N[ISW]]^R8^N=GI0_-`N!`U)#*\]U"'XI:E"Y\O
+M7V-V_MUC0.SC1\HNG&UL3C&^]R5<%!=7U6Y,IPC8Y^%V%TL>>W=[\,VC_^'3
+M!__F[M?W[U+OPMF&EM4CT'5L5.Z*/$#%TD+[BH`8'IOQU-S3+_>//]_?OA_*
+M_.CO3E\ZPI6A=\,!7F->4]5#2+EYLD/:3]_^[W&HUW7Q9.\)-R8Q%C&\=W%V
+M116PA@/,A][EN<NO+A_AAX2'2BX(3N[I_;O3/WYR*//KQ7W_W9_^0;CK`#=X
+M#@D.(4-!LYJ*J?YB^5BZI^^_=7>AR!]^]N,32+AZ^C(+SM,Y8#3/X2)V;8(/
+M0^P2;HPGZ]XVCXW[IOGH3U^^??M-.MDF%'L97T-J/J"4$W1XOL=V#HV;3GHZ
+MZ/$HNJX]-5WSX=$_A.--1]&&I[6+E89CO3P?X_Q]JO&D^O#$N*<W[NZ^&\XT
+MP/[;O_^5<+?I,1[R"(]$/0;FX6)X>D9X']]A>F+",04X__CPZ73[],O]NV[X
+M0G-O"-=-O1O2&4YS2BKEM$PJO>W0NSL\IS9@$\Z'%DU)7>,7QH`UY?'<A7QX
+M%>$5N_#TZ?2S;[HA+7=W+HJ[=!3]\BBT18LN3`<]]&(ZBIC8I]-'?XMP>18/
+ML)\U9\HI/,K#DSQE-!^@C^\?QM3*_$[G<;[\7O;:>7QY\2VU^IV`$YQU?F6V
+M]_V,KWP&Z`0L>\ZO#/E=Q+/0J%*,:@8W_#1Q^F[X_-?P^4'@PB-V%<]:HQHQ
+MVB/=*\/WBYMX=AKEQ>@/P5UBB_@#"N1Z;"J-7&\D.+?H71%[1\]"HTHQJAG<
+M5N_*V#MZUAK5B-&N9K<LMHJ]HV>G45Z,_A#<-?:./X!!KL?>T<BSM9_REKVK
+M8^_H66A4*48U@]OJ71-[1\]:HQHQVM7LEL6VL7?T[#3*B]$?@KO%WG&L0*['
+MWM'(]<9F[[K8.WH6&E6*4<W@MGKG8^_H66M4(T:[FMVRV#[VCIZ=1GDQ^B-P
+M519[=Y'>\7KL'8U<;VSUKN*\HV>A4:48U0QNHW<5YQT]:XUJQ&A7LUL6RWE'
+MSTZCO!C](3C.NT)ZQ^NQ=S1RO;'9.\X[>A8:58I1S>"V>L=Y1\]:HQHQVM7L
+MEL5RWM&STR@O1G\(CO.NE-[Q>NP=C5QO;/:.\XZ>A4:58E0SN*W><=[1L]:H
+M1HQV-;MEL9QW].PTRHO1'X+CO../3I#KL7<T<KVQV3O..WH6&E6*4<W@MGK'
+M>4?/6J,:,=K5[);%<M[1L],H+T9_!.Z:Q=Y=I7>\'GM'(]<;6[V[<M[1L]"H
+M4HQJ!K?1NROG'3UKC6K$:%>S6Q;+>4?/3J.\&/TA.,Z[6GK'Z[%W-'*]L=D[
+MSCMZ%AI5BE'-X+9ZQWE'SUJC&C':U>R6Q7+>T;/3*"]&?PB.\X[_\8)<C[VC
+MD>N-S=YQWM&ST*A2C&H&M]4[SCMZUAK5B-&N9K<LEO..GIU&>3'Z0W"<=V0M
+M(==C[VCD>F.S=YQW]"PTJA2CFL%M]8[SCIZU1C5BM*O9+8OEO*-GIU%>C/X(
+M7)W%WMVD=[P>>T<CUQM;O:LY[^A9:%0I1C6#V^A=S7E'SUJC&C':U>R6Q7+>
+MT;/3*"]&?PB.\ZZ3WO&:K';J7?<";MD[SCMZ%AI5BE'-X+9ZQWE'SUJC&C':
+MU>R6Q7+>T;/3*"]&?PB.\\Y+[W@]]HY&KC<V>\=Y1\]"HTHQJAG<5N\X[^A9
+M:U0C1KN:W;)8SCMZ=AKEQ>@/P7'>]=([7H^]HY'KC<W><=[1L]"H4HQJ!K?5
+M.\X[>M8:U8C1KF:W+);SCIZ=1GDQ^B-P33;U+NW<(->A=\G(]<96[YHX[Y)G
+MH5&E&-4,;J-W39QWR;/6J$:,=C6[9;%QWB7/3J.\&/TAN#CO(/P=E+^#\'?8
+MY>^:..\@_!V4OX/P=]CE[YHX[R#\'92_@_!W*]DMBXWS#L+?0?D["']W`"[.
+M.PA_!^7O(/P==OF[)LX["'\'Y>\@_!UV^;LFSCL(?P?E[R#\W4IVRV+CO(/P
+M=U#^#L+?'8"+\P["WT'Y.PA_AUW^KHGS#L+?0?D["'^'7?ZNB?,.PM]!^3L(
+M?[>2W;+8..\@_!V4OX/P=_MP;19[)_P=E+^#\'?8Y>]:SCOA[Z#\'82_PRY_
+MUW+>"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^[@`<YYWP=U#^#L+?89>_:SGOA+^#
+M\G<0_@Z[_%W+>2?\'92_@_!W*]DMB^6\$_X.RM]!^+L#<)QWPM]!^3L(?X==
+M_J[EO!/^#LK?0?@[[/)W+>>=\'=0_@["WZUDMRR6\T[X.RA_!^'O#L!QW@E_
+M!^7O(/P==OF[EO-.^#LH?P?A[[#+W[6<=\+?0?D["'^WDMVR6,X[X>^@_!V$
+MO]N'NV6Q=\+?0?D["'^'7?[NQGDG_!V4OX/P=]CE[VZ<=\+?0?D["'^WDMVR
+M6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[VZ<=\+?0?D["'^'7?[NQGDG_!V4
+MOX/P=RO9+8OEO!/^#LK?0?B[`W"<=\+?0?D["'^'7?[NQGDG_!V4OX/P=]CE
+M[VZ<=\+?0?D["'^WDMVR6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[VZ<=\+?
+M0?D["'^'7?[NQGDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[?;@NB[T3_@[*WT'X
+M.^SR=QWGG?!W4/X.PM]AE[_K..^$OX/R=Q#^;B6[9;&<=\+?0?D["']W`([S
+M3O@[*'\'X>^PR]]UG'?"WT'Y.PA_AUW^KN.\$_X.RM]!^+N5[);%<MX)?P?E
+M[R#\W0$XSCOA[Z#\'82_PRY_UW'>"7\'Y>\@_!UV^;N.\T[X.RA_!^'O5K);
+M%LMY)_P=E+^#\'<'X#COA+^#\G<0_@Z[_%W'>2?\'92_@_!WV.7O.LX[X>^@
+M_!V$OUO);EDLYYWP=U#^#L+?[</Y;.I=DN!!KD<9(XU<;SR-31L^W?"9N6>X
+M..]6%7TK_Y1ZY]:S>Z'%/P;WLMA);HA1;I@V$5.YOP]P@C.60^(:N[X/>$0.
+MB;0NY^M5<DBD=3E?KY)#(JW+^7J5'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<
+M$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)
+M'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6Y
+MB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1U
+MN8D<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76Y
+MC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-
+M'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<
+M$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P2
+M:5V>/??N]\LAD=;E]'R5'!)I74[/5\DAD=;E]'R5'!)I76XBAT1:EYO((9'6
+MY29R2*1UN8D<$FE=;B*'1%J7F\@AD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1
+MUN4F<DBD=;F)'!)I76XBAT1:EYO((9'6Y29R2*1UN8D<$FE=;B*'1%J7F\@A
+MD=;E)G)(I'6YB1P2:5UN(H=$6I>;R"&1UN4F<DBD=;F)'!)I76XBAT1:EYO(
+M(9'6Y29R2*1UN8D<$ER7V\@AP76YC1P2WE0."6\JAX0WE4/"F\HAX4WED/"F
+M<DAX4SDDO*D<$MY4#@EO*H>$-Y5#PIO*(>%-Y9#PIG)(]%EF*(=$;RJ'1&\J
+MAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'1&\JAT1O*H=$;RJ'
+M1&\JAT1O*H<\9UEF*(<\9Z9RR//+7TU\#.YEL9/<\#*6._WNTI=_;]]X^N8T
+M_Y,`T?XVP$D0MP1DP1>,C_+(?C7C_PGS/IAY+P7?!MNO%/SU\&?X^.HD<)UQ
+M_]#_-L"B<$WS`O"?S._\V31^>WZ5-S[?Z_C`%%7X-;M%Z:[GHQG^].V/BPPG
+M.#/][`2W^_616-!^"^YK@0L_#_3B.?M-X/K<Z;7`?35]$N[RN>QT076L6.-?
+MW7W-KHLX/>?P?2?0@?Q?WGD.F,[7/>=7OTSC/"OW,_FYE^6&[[GZRVOU/&9C
+M>J-<-X=KTV19.<*=[GWU,KN;\6%@^95Q\"LW@,R_<B>XL^T@J,?),JD^7OZ]
+=?>/IN]/\SP1XB8!F';R$7TR2??%_%;F-<V]@````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu
new file mode 100644
index 0000000..75e7cd5
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu
@@ -0,0 +1,126 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.qcow.gz
+M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+7!C.3@N<6-O=RYO=70`K9W;CA19
+M<T;OYRF*,S2GBHC,JDP.W<B2+?D.7]B^_>MX/0^`_.R&9G?N[JCU33`:&#0"
+M%?DI*VOU`LTL;=;KG]]6J]%6PV8US*OS?O7]Y^V[K>[]Y.'WU;?_^H__?'?_
+MV[<_?H[9^B^N2C_?GI:Y!UO_U^?\QU6'U7K^A;GOWXWF[MU=_(V[N_=F+^>N
+M_OCY9ODZ5X/Q8'#5YM;M_DP\O>'7[N]+>KOV\^G]OK?KXNV.:G#S8/!KF_M7
+MNS__6[#\TOW]S<]WBX-_+O<WX%63FIO_DCY?CWC53LWMB[D-7G50<\=B;HM7
+MG=3<N9B;X"I3'X457[F^GO$J\85FQ1>:KW=XE?A"LSO"TQ?:UV5NCU=MU-Q#
+M[OYUP=T!KQ+<6<G=$:\2W%G)W0FO$MQ9R=T9KQ+<6<6=T56NN/.*.R-%N>+.
+M*^Z,C.R*.Z^X,_*=*^Z\XL[(=ZZX\XH[(]^YXLXK[HQ\YXH[K[@S\ITK[KSD
+MCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>(N2N[(=Z&X
+MBY([\ETH[J+BSNFJ07$W5-PY^6Y0W`T5=TZ^&Q1W0\6=D^\&Q=U0<>?DNT%Q
+M-U3<.?EN4-P-%7=.OAL4=T/%G9/O!L7=4')'OAL5=V/)'?EN5-R-)7?DNU%Q
+M-Y;<D>]&Q=U8<D>^&Q5W8\D=^6Y4W(TE=^2[47$WEMR1[T;%W5AQ%W351G&W
+MJ;@+\MU&<;>IN`ORW49QMZFX"_+=1G&WJ;@+\MU&<;>IN`ORW49QMZFX"_+=
+M1G&WJ;@+\MU&<;<IN2/?;15WVY([\MU6<;<MN2/?;15WVY([\MU6<;<MN2/?
+M;15WVY([\MU6<;<MN2/?;15WVY([\MU6<;>MN!OHJDEQ-U7<#>2[27$W5=P-
+MY+M)<3=5W`WDNTEQ-U7<#>2[27$W5=P-Y+M)<3=5W`WDNTEQ-U7<#>2[27$W
+ME=R1[^[^*SR\4'%'OIL5=W/)'?EN5MS-)7?DNUEQ-Y?<D>]FQ=U<<D>^FQ5W
+M<\D=^6Y6W,TE=^2[67$W5]R-=-5.<;>KN!O)=SO%W:[B;B3?[11WNXJ[D7RW
+M4]SM*NY&\MU.<;>KN!O)=SO%W:[B;B3?[11WNXJ[D7RW4]SM2N[(=W?_-Q1>
+MJ+@CW^T5=_N2._+=7G&W+[DCW^T5=_N2._+=7G&W+[DCW^T5=_N2._+=7G&W
+M+[DCW^T5=_N*NPU==5#<'2KN-N2[@^+N4'&W(=\=%'>'BKL-^>Z@N#M4W&W(
+M=P?%W:'B;D.^.RCN#A5W&_+=07%WJ+C;D.\.BKM#R1WY[JBX.Y;<D>^.BKMC
+MR1WY[JBX.Y;<D>^.BKMCR1WY[JBX.Y;<D>^.BKMCR1WY[JBX.Y;<D>^.BKMC
+MQ=V6KEHZH,L7"NZVY+N3XNY4<;<EWYT4=Z>*NRWY[J2X.U7<;<EW)\7=J>)N
+M2[X[*>Y.%7=;\MU)<7>JN-N2[TZ*NU/)'?GNK+@[E]R1[\Z*NW/)'?GNK+@[
+ME]R1[\Z*NW/)'?GNK+@[E]R1[\Z*NW/)'?GNK+@[E]R1[\Z*NW/%W017V=T/
+MX(6"NPE\9RHXM"HX]`E\9RHXM'7%W02^L[7@SG)_=\'=!+XSU=]9V=]-X#M3
+M_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7?6=G?3>`[4_V=E?W=!+XSU=]9
+MV=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7?6=G?3>`[4_V=E?W=
+M3%>I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.
+MROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?
+MJ?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FY'5ZG^SLK^
+M;D>^4_V=E?W=CGRG^CLK^[L=^4[U=U;V=SORG>KOK.SO=N0[U=]9V=_MR'>J
+MO[.RO]N1[U1_9V5_MR/?J?[.ROYN1[Y3_9V5_=V.?*?Z.RO[NQWY3O5W5O9W
+M._*=ZN^L[.]VY#O5WUG9W^W(=ZJ_L[*_VY'O5']G97^WIZM4?V=E?[<GWZG^
+MSLK^;D^^4_V=E?W=GGRG^CLK^[L]^4[U=U;V=WORG>KOK.SO]N0[U=]9V=_M
+MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W
+M5O9W>_*=ZN^L[._VY#O5WUG9W^W)=ZJ_L[*_.]!5JK^SLK\[D.]4?V=E?W<@
+MWZG^SLK^[D"^4_V=E?W=@7RG^CLK^[L#^4[U=U;V=P?RG>KOK.SO#N0[U=]9
+MV=\=R'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y
+M3O5W5O9W!_*=ZN^L[.\.Y#O5WUG9WQWI*M7?6=G?'<EWJK^SLK\[DN]4?V=E
+M?W<DWZG^SLK^[DB^4_V=E?W=D7RG^CLK^[LC^4[U=U;V=T?RG>KOK.SOCN0[
+MU=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z.RO[
+MNR/Y3O5W5O9W1_*=ZN^L[.].=)7J[ZSL[T[D.]7?6=G?G<AWJK^SLK\[D>]4
+M?V=E?W<BWZG^SLK^[D2^4_V=E?W=B7RG^CLK^[L3^4[U=U;V=R?RG>KOK.SO
+M3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z
+M.RO[NQ/Y3O5W5O9W9[I*]7=6]G=G\IWJ[ZSL[\[D.]7?6=G?G<EWJK^SLK\[
+MD^]4?V=E?W<FWZG^SLK^[DR^4_V=E?W=F7RG^CLK^[LS^4[U=U;V=V?RG>KO
+MK.SOSN0[U=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9
+M?*?Z.ZOZNUC#57[W`WCA`7=WG*SZ'/C.57_GJ;];M;W5>ID#W[GJ[SSU=ZO&
+MW>KK,@>^<]7?>>KO5HV[U9_+'/C.57_GJ;^#9P>^<]7?>>KO8`Y\YZJ_\]3?
+MP1SXSE5_YZF_@SGPG:O^SE-_]ZC-/>ISX#M7_9VG_NY1N[U'G3OPG:O^SE-_
+M]ZAQ]ZAS![YSU=]YZN\>->X>=>[`=Z[Z.T_]'3P[\)VK_LY3?P=SX#M7_9VG
+M_@[FP'>N^CM/_=WE')U_YZJ_\]3?/6YSC_L<^4[U=Y[ZN\>-N\<+=W3^G:O^
+MSE-_][AQ]WCACLZ_<]7?>>KO'C?N'B_<T?EWKOH[3_T=/#ORG>KO//5W,$>^
+M4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KLG;>Y)GR/?J?[.4W_WI''WI'-'OE/]
+MG:?^[DGC[DGGCGRG^CM/_=V3QMV3SAWY3O5WGOH[>';D.]7?>>KO8(Y\I_H[
+M3_T=S)'O5'_GJ;^[G*/S[USU=Y[ZNZ=M[FF?(]^I_LY3?_>T<?=TX8[.OW/5
+MWWGJ[YXV[IXNW-'Y=Z[Z.T_]W=/&W=.%.SK_SE5_YZF_@V='OE/]G:?^#N;(
+M=ZJ_\]3?P1SY3O5WGOH[F"/?J?[.4W_WK,T]ZW/D.]7?>>KOGC7NGG7NR'>J
+MO_/4WSUKW#WKW)'O5'_GJ;][UKA[UKDCWZG^SE-_!\^.?*?Z.T_]'<R1[U1_
+MYZF_@SGRG>KO//5WEW-T_IVK_LY3?_>\S3WO<^0[U=]YZN^>-^Z>+]S1^7>N
+M^CM/_=WSQMWSA3LZ_\Y5?^>IOWO>N'N^<$?GW[GJ[SSU=_#LR'>JO_/4W\$<
+M^4[U=Y[Z.Y@CWZG^SE-_!W/D.]7?>>KO7K2Y%WV.?*?Z.T_]W8O&W8O.'?E.
+M]7>>^KL7C;L7G3ORG>KO//5W+QIW+SIWY#O5WWGJ[^#9D>]4?^>IOX,Y\IWJ
+M[SSU=S!'OE/]G:?^[G*.SK]SU=]YZN]>MKF7?8Y\I_H[3_W=R\;=RX4[.O_.
+M57_GJ;][V;A[N7!'Y]^YZN\\]7<O&W<O%^[H_#M7_9VG_@Z>'?E.]7>>^CN8
+M(]^I_LY3?P=SY#O5WWGJ[V".?*?Z.T_]W:LV]ZK/D>]4?^>IOWO5N'O5N2/?
+MJ?[.4W_WJG'WJG-'OE/]G:?^[E7C[E7GCGRG^CM/_1T\._*=ZN\\]7<P1[Y3
+M_9VG_@[FR'>JO_/4WUW.T?EWKOH[3_W=59N[ZG/D.]7?>>KOKAIW5PMW=/Z=
+MJ_[.4W]WU;B[6KBC\^]<]7>>^KNKQMW5PAV=?^>JO_/4W\&S(]^I_LY3?P=S
+MY#O5WWGJ[V".?*?Z.T_]'<R1[U1_YZF_>]WF7O<Y\IWJ[SSU=Z\;=Z\[=^0[
+MU=]YZN]>-^Y>=^[(=ZJ_\]3?O6[<O>[<D>]4?^>IOX-G1[Y3_9VG_@[FR'>J
+MO_/4W\$<^4[U=Y[ZN\LY.O_.57_GJ;][T^;>]#GRG>KO//5W;QIW;Q;NZ/P[
+M5_V=I_[N3>/NS<(=G7_GJK_SU-^]:=R]6;BC\^]<]7>>^CMX=N0[U=]YZN]@
+MCGRG^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU=V_;W-L^1[Y3_9VG_NYMX^YMYXY\
+MI_H[3_W=V\;=V\X=^4[U=Y[ZN[>-N[>=._*=ZN\\]7?P[,AWJK_SU-_!'/E.
+M]7>>^CN8(]^I_LY3?W<Y1^??N>KOO.KO@LZ_<]7?>=7?!9U_YZJ_\ZJ_"SK_
+MSE5_YU5_%W3^G:O^SJO^+NC\.U?]G5?]7=#Y=Z[Z.Z_ZNZ#S[USU=U[U=T'G
+MW[GJ[SSU=^_;UOL^1[Y3_9VG_NY]X^Y]YXY\I_H[3_W=^\;=^\X=^4[U=Y[Z
+MN_>-N_>=._*=ZN\\]7?P[,AWJK_SU-_!'/E.]7>>^CN8(]^I_LY3?W<Y1^??
+MQ=T/X(4'W*W;W+K/@>^^7\7<1>KOUHV[]<(=G7\7JK^+U-^M&W?KA3LZ_RY4
+M?Q>IOULW[M8+=W3^7:C^+E)_!\\.?!>JOXO4W\$<^"Y4?Q>IOX,Y\%VH_BY2
+M?P=SX+M0_5VD_L[:G/4Y\%VH_BY2?V>-.^O<@>]"]7>1^CMKW%GG#GP7JK^+
+MU-]9X\XZ=^"[4/U=I/X.GAWX+E1_%ZF_@SGP7:C^+E)_!W/@NU#]7:3^[G*.
+MSK\+U=]%ZN^\S7F?(]^I_BY2?^>-.U^XH_/O0O5WD?H[;]SYPAV=?Q>JOXO4
+MWWGCSA?NZ/R[4/U=I/X.GAWY3O5WD?H[F"/?J?XN4G\'<^0[U=]%ZN]@CGRG
+M^KM(_5VTN>ASY#O5WT7J[Z)Q%YT[\IWJ[R+U=]&XB\X=^4[U=Y'ZNVC<1>>.
+M?*?ZNTC]'3P[\IWJ[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?7<[1^7>A^KM(_=W0
+MYH8^1[Y3_5VD_FYHW`T+=W3^7:C^+E)_-S3NAH4[.O\N5'\7J;\;&G?#PAV=
+M?Q>JOXO4W\&S(]^I_BY2?P=SY#O5WT7J[V".?*?ZNTC]'<R1[U1_%ZF_&]O<
+MV.?(=ZJ_B]3?C8V[L7-'OE/]7:3^;FS<C9T[\IWJ[R+U=V/C;NS<D>]4?Q>I
+MOX-G1[Y3_5VD_@[FR'>JOXO4W\$<^4[U=Y'ZN\LY.O\N5'\7J;_;M+E-GR/?
+MJ?XN4G^W:=QM%N[H_+M0_5VD_F[3N-LLW-'Y=Z'ZNTC]W:9QMUFXH_/O0O5W
+MD?H[>';D.]7?1>KO8(Y\I_J[2/T=S)'O5'\7J;^#.?*=ZN\B]7?;-K?M<^0[
+MU=]%ZN^VC;MMYXY\I_J[2/W=MG&W[=R1[U1_%ZF_VS;NMIT[\IWJ[R+U=_#L
+MR'>JOXO4W\$<^4[U=Y'Z.Y@CWZG^+E)_=SE'Y]^%ZN\B]7=3FYOZ'/E.]7>1
+M^KNI<3<MW-'Y=Z'ZNTC]W=2XFQ;NZ/R[4/U=I/YN:MQ-"W=T_EVH_BY2?P?/
+MCGRG^KM(_1W,D>]4?Q>IOX,Y\IWJ[R+U=S!'OE/]7:3^;FYS<Y\CWZG^+E)_
+M-S?NYLX=^4[U=Y'ZN[EQ-W?NR'>JOXO4W\V-N[ES1[Y3_5VD_@Z>'?E.]7>1
+M^CN8(]^I_BY2?P=SY#O5WT7J[R[GZ/R[4/U=I/[N0YO[T.?(=ZJ_B]3??6C<
+M?5BXH_/O0O5WD?J[#XV[#PMW=/Y=J/XN4G_WH7'W8>&.SK\+U=]%ZN_@V9'O
+M5'\7J;^#.?*=ZN\B]7<P1[Y3_5VD_@[FR'>JOXO4WWUL<Q_['/E.]7>1^KN/
+MC;N/G3ORG>KO(O5W'QMW'SMWY#O5WT7J[SXV[CYV[LAWJK^+U-_!LR/?J?XN
+M4G\'<^0[U=]%ZN]@CGRG^KM(_=WE')U_%ZJ_B]3??6ISG_H<^4[U=Y'ZNT^-
+MNT\+=W3^7:C^+E)_]ZEQ]VGACLZ_"]7?1>KO/C7N/BW<T?EWH?J[2/T=/#OR
+MG>KO(O5W,$>^4_U=I/X.YLAWJK^+U-_!'/E.]7>1^KO/;>YSGR/?J?XN4G_W
+MN7'WN7-'OE/]7:3^[G/C[G/GCGRG^KM(_=WGQMWGSAWY3O5WD?H[>';D.]7?
+M1>KO8(Y\I_J[2/T=S)'O5'\7J;^[G*/S[T+U=Y'ZN^LV=]WGR'>JOXO4WUTW
+M[JX7[NC\NU#]7:3^[KIQ=[UP1^??A>KO(O5WUXV[ZX4[.O\N5'\7J;^#9T>^
+M4_U=I/X.YLAWJK^+U-_!'/E.]7>1^CN8(]^I_BY2?W?3YF[Z'/E.]7>1^KN;
+MQMU-YXY\I_J[2/W=3>/NIG-'OE/]7:3^[J9Q=].Y(]^I_BY2?P?/CGRG^KM(
+M_1W,D>]4?Q>IOX,Y\IWJ[R+U=Q=SPQJN&NY^`"\\X.XNZ/W2Y\!W@^KOOK_P
+M@+LOC;LOZV4.?#>H_FY(_=V7=GM?OBYSX+M!]7=#ZN^^-.Z^_+G,@>\&U=\-
+MJ;^#9T=_W[;Z*/H+W]ZE;]_^N+H='&\_V\%7ZQW\6[_P[=_>/?QG&;P]F^=O
+M#([C:G<Y^-_M#8^W9_/,P^HPT/MJ]C/]AF^6-_QSCOZN]W_R_(;?_/RV],7V
+M3^YP>_K-=SC=WN&X70WC:MRL)O_5._S??_^?=(<_YW[;1_)S#G3P<.[NAI??
+M.B_F;N[-_=#!^=ZOO`_;ZF#]#W[W?WQO[OK=O=_")])!G_LASA.](-_L;];!
+M=''DY/W/^?8LYUBM[_[7C3\<7#[?5;\_2OP?O-V_N+_5Y=N]_2/&]N&OMWMS
+M7KS=U<.YVS]BW/L\'WR$Q=.[OKP[^BON_\F'<7%PXB]^Y?X8>?B5^W/.?Z\(
+IYENS_/CM=`?_UB]\^_KNX3\_!X<V^-N>X/`=E_7ZC_\'#.+&':.H````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu
new file mode 100644
index 0000000..2d392cd
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu
@@ -0,0 +1,22 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.qcow2.gz
+M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+7!C.3@N<6-O=S(N;W5T`*V8VW+3
+M,!!`W_,5X@X%@K4K^<(E*84RPQL\`,^)FWQ%AF\GBA1+7N]:;5#B\32C[IF5
+M]F@CIZK\2RFKE:F5Z=1^JXZ?PP4J^3"^U.'GM^_+]'58>)BNA"AFH-D-N!'K
+M;\2!A*OT=$#SN"0[9'!PCIJ"<C@C9C<WP."N%J>E.Q6C)1%X"=#CQ&)<E!_X
+M_&B$N3`_*)T?\NMGSW%TH)[/#WU^-*J1<&T6!TQ4)^$V61PR45L)UV=QAHFZ
+MDW#"SDUPEHG:"SB=4>6(JYDH+>$@BVN8*)1P)HMKF2C).YWWKF.B).]TWKL-
+M$R5YI_/>;9DHR3N=]ZYGHB3O=-Z[.R9*\@X$[U3$[9@HR3L@WCT*N,<1MV>B
+M).^`>/<DX)X..,U%2=X!\>Y9P#V/.*;?@>0=$.]>!-S+B&/Z'4C>`?'N5<!=
+M11S3[T#R#HAWKP/N3<0Q_0XD[X!X]W;BG6;Z'4C>(?'N76!5$<?T.Y2\0^*=
+M#CB(.*;?H>0=$N\PX$S$,?T.)>^0>&<#KHXXIM^AY!T2[YJ`:R..Z7<H>8?$
+MNR[@WD<<T^]0\@Z)=Q\"[F/$,?T.)>^0>/<IX%81Q_0[E+PSQ+MUP%U''-/O
+MC.2=(=Y]#KB;B&/ZG9&\,\2[+P'W=<`!%S5X5U7\%7"WDST+9<^?)IZ/-7.7
+M!V:`[4.`<QEZ7%=TPM9/V&FP8>[RP.%F.7X/P),P#P!:JS93X"\_8>N%Z8SJ
+M#3>OL$^T/.%UNGZVM##6E:3H^@'[A/8?&3:[PAFV_@>'QNU;6ZL6[IOAG]O?
+M4Z6/N&(E\3CY!X<P<$YX:+(3W#K!N3/+/OG/5#;5Z]C@T[\3W&H9F_T1-_N#
+M@WN*VG$#XF1M65G:H5V=K[3.[O#NGK'.W]_D\#W45\7\F'8%H^G.Y*>FTW7G
+M@N'YG=3#X2`S737&N7-!6L]1"3.KMYIFUQ<NAJ8[XYX[UT'&.]?CH&PCZ$Z=
+BY6B@Z^*3NSQP^+$<OSW0!&"Q%32U^W9;_`,76K<))14`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu
new file mode 100644
index 0000000..029e51d
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu
@@ -0,0 +1,12 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.raw.gz
+M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+7!C.3@N<F%W+F]U=`"ME$V/@R`0
+MAN_^BO>\!P,C5+VT29/>][*[9VOT5_CCER\M(WZT":"(&7CR#C.,$+X!BB"Z
+MC7'?,-U+WJ?BJW`T.7X&U!I="OPQ0(<CJZ]5Z!7,;/6@&MU,)H:I#.T6OC-.
+M&F,*"KMV#0NN7'#!797Y_$@<"OE<83UD5M@XA;J&TM`7-/2NPK_'[TJAQV4+
+MB<?1&6X6'))G`W>+<)4QCM'*.-G02U1#^(GG$>[JWQFGCM29DQ##EF'769TW
+M61K3^;XXSI`#9`71!!MQX!)?O/2UJ0QB[A[H0^IN9W$U7R\C')VX"XY[6EP4
+M3Q;"D].[INKZS,&0ZYOQYLVU$'YS/8[R%H+651:3@;:*)^.^8?HN>?=`%8#9
+/3M!6/B&*?U("+YGG!@``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu
new file mode 100644
index 0000000..eada46f
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.vhd.gz
+M'XL(""TUQ%4``VEM9RTV,W@R-34M-3$R+7!C.3@N=FAD+F]U=`"ME\]OI"`4
+MQ^_S5[QD;ST8>`(ZET[2I/>][/:,5IM)TW:S[:$'__CE"2B(.ITNHV,P\#Y^
+MWP\@,&9_`*H$U8/J0$EJ5P+4$:H:P'2Z&\<G=Z\PM&^O7?MQ_BS<;SA8&&>A
+M56Q.]EB",!^I`#5]1#U2&P:/*7[</]V<7YX\#AT.'4A69%4BJ";Y3M\`$U8=
+MD1[.^+Q45Z;J9BO[G;Z'L@]&E*&ZHCB%.&&LS'BZ)31JC(^_HY>H(\1%ZB1;
+M6`4RUX+*9F?7<&K/ZAK<S<'EPI:**8S*/!DH#A52VY2-CT-RFU+Y?/^C_[YW
+M"WVX42IJTL>3OGK;772E@E-BK0)!I;WG+HR4MR5NI53^*WHJMA.N88+`I._`
+MT?TX>C,*0GV*LYV8;R=C4Y\F?<+,,[WRW.X8[HKXFH!-?QU02M`I\)=WN"5]
+M1P&M6(N[F[))Q<P.G^+\MAO5]^W\=IGCAWI7R/4*ZSJSPGI4:%9DLZ!+!35^
+M5>'#_>^5&5SK;"FQ.+R$\X+#]3[&G0)<:2?<3`F*#5H.9>=>PG:`N[5_CQ-[
+MZFA5Z-8Z-IV5F8M%UPN[,,_`.^`E+<=L6K<"X)1?F/4=4QD8N;NC#U)W->&J
+M>#P/<'C!78AQC=MY_<@HA1>B=YNJ:S,GHUG.C"_.7(+$,]?B,.]"H,>5Q50@
+MK>+)<[MC^%G$EP6BVXRR[6[H=H]L"H4#9E,HW/Z14:%N=XOMVBI4TB8ETU&!
+H<!F/"H3+>%0@7,:C`N$R'A4(E_&H0+BL1P4#-+5W^`=:):>?7PX`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu
new file mode 100644
index 0000000..ffafcc7
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu
@@ -0,0 +1,15 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.vhdf.gz
+M'XL("*(EAE4``VEM9RTV,W@R-34M-3$R+7!C.3@N=FAD9BYO=70`K94[;X,P
+M$,?W?(J3NF5`]OD!+$&JE+U+FYD0B**J[=*A`Q^^?E+;0!Z5,2$FAW_YW\,'
+M(?8`X`BD7;BN&\;G(A[C9KLQ-#H\!A0"VCGP50$-#K6^FD/'0<V2$]A@9G1F
+M&`MW-.[;XZ@RSD%NU:IAPA43SKG+,\</R54ACRLL^\P**Z-0E,`%"`D5WJOP
+ML']+%%I<MI18'-["><&N>!9P38!CRC@$3X;%!AT%UKN;<![@=O;C<?R:.A4)
+MTB\95IT5>8NE4B->%^89:`^4`:F<#6/@E%_XTU?/96#D[A5],'>WU;@R?IX&
+M.+SA+L2XH\8%^8Q2>"-ZN[FZ+G,R:+HS[MRY&A+O7(O#O(V@-IU%5:#NXK/K
+MNF%\*>)A@=P!<T60^K>;9"`'D#U(H><E!UE#685`C"MI[+X^^^[[\A-DV."H
+M;0:+IUZ/3.\660*V^D_D2<\#?4_[\_;R<?8XWZI\1U*;3:UB"/*8N$M3=P\7
+M?$_5L31(-(D>:IUAVU._1-%K0AR?G.T'.)X,SI_13618:E4&)TBRZK^YM3B9
+/N534BW?S"UK7>:L2"0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu
new file mode 100644
index 0000000..b2d29cc
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu
@@ -0,0 +1,84 @@
+# $FreeBSD$
+begin 644 img-63x255-512-pc98.vmdk.gz
+M'XL("%CN+50``VEM9RTV,W@R-34M-3$R+7!C.3@N=FUD:RYO=70`K5Q=C]S&
+M$7SWKQB<W_*P8"V_E@^R$T<.$`0!C-BQ7T,NR?@06Q).AR`"]L>'0T[-%;FD
+M2/OZM">PQ>[:[I[=OE-U89-D^G(N:UR6N:QU>>$2N.&?IH=+TA=C>&3QQNUO
+M;__^XXE??SR=;E],8/!1$H)$X<28/<_MM/@BW/ES4;,;P^.\"Y?ZJ.8N,,"=
+M-VYLP@W]<.>U$&97C[=;?R%P+@*Y&5R^4M-FL9_+[@]?A.;Y_%*?PW"\1>7*
+MU!5-,%V1CW;JRO-X+W'EX-0/@%^ZMX\?_^/>=A^O3X\?GM^'_,[^;`?GK/#^
+MQ=4C#(65A;_P-SQ<Y2&*SJ6M2^%ON]O37QY_Z4[_[9X^/KY_]P8L]^S/-DM=
+M5OETO'_R\I@9_DD25\`_A[O]^:]OWX17;G+Z4#\1SD<-B0S//=2AN$7A_/?]
+M8\RN>_?L$?OP%;/S9QN:DX_/G?F+/'-EY<9T<H]]'FZWH>2Q=]>GKG[N?OCT
+MH7OS\.O[=[%W_FQ]RZH1Z#(V*G5YZJ%":;Y]N4?T+YOQU-SME\?GGQ^OWP]E
+M?NP>3E\ZPA6^=\,!7D)>4]5#2+%YLD/:MV__]SS4Z]IPLH^$&Y,8BQB>.S^[
+MO/18PP&F0^_2U*47EX[P0\)#)1F\D[N]?W?ZQT\.17K)W/??_>D?A+L,<(/G
+MD.`0,A0TJRF?ZL^7+TMW^_Y;]^"+_.'G;GP%$JZ:WF;>>3H'C.;97X2N3?!^
+MB&7^QGBR[FW]7+MOZH_=Z<NW;[^))UO[8K/Q,:36>91B@O:O[[&=0^.FDYX.
+M>CR*MFU.=5M_>.Z>_/'&HVC\J[4-E?ICS5Z.<?X\Y7A2O7_%N-L;]_#8#F?J
+M8?_=O?^5<-?I93SDX5\2U1B8^HOAU3/"=^$9IE>,/R8/UST_?3I=/_WR^*X=
+MWFCN#>':J7=#.L-I3DG%G)9)Q:<=>O>`E]0&;,)UOD534I?PQABPICQ>NI`.
+MC]P_0A=NGTX_=W4[I.4>SGG^$(^B7QZ%MFC1A>F@AUY,1Q$2^W3ZV%T#7)J$
+M`^QGS9ER\B_EX94\930?H,_OG\;4BO1!YW&Z_%GVVGF<W?U(+7\GX`1GG5^1
+M[/T\XR.=`3H!2U[R*WQ^F7CF&E6(4<[@AM\F3M\-W_\:OC\(G'^)7<2STJA:
+MC.9(]PK_\^(JGJU&=6+TA^"RT"+^@@*Y'IM*(]4;$<XM>I>'WM$SUZA"C'(&
+MM]6[(O2.GI5&U6(TJ]DMBRU#[^C9:E0G1G\([A)ZQU_`(-=C[VBDR=IO><O>
+M5:%W],PUJA"CG,%M]:X.O:-GI5&U&,UJ=LMBF]`[>K8:U8G1'X*[AMYQK$"N
+MQ][12/7&9N_:T#MZYAI5B%'.X+9ZUX7>T;/2J%J,9C6[9;%]Z!T]6XWJQ.B/
+MP)5)Z%TFO>/UV#L:J=[8ZEW)>4?/7*,*,<H9W$;O2LX[>E8:58O1K&:W+);S
+MCIZM1G5B](?@..]RZ1VOQ][12/7&9N\X[^B9:U0A1CF#V^H=YQT]*XVJQ6A6
+MLUL6RWE'SU:C.C'Z0W"<=X7TCM=C[VBD>F.S=YQW],PUJA"CG,%M]8[SCIZ5
+M1M5B-*O9+8OEO*-GJU&=&/TA.,X[_NH$N1Y[1R/5&YN]X[RC9ZY1A1CE#&ZK
+M=YQW]*PTJA:C6<UN62SG'3U;C>K$Z(_`79+0NXOTCM=C[VBD>F.K=Q?..WKF
+M&E6(4<[@-GIWX;RC9Z51M1C-:G;+8CGOZ-EJ5"=&?PB.\ZZ2WO%Z[!V-5&]L
+M]H[SCIZY1A5BE#.XK=YQWM&STJA:C&8UNV6QG'?T;#6J$Z,_!,=YQ_]X0:['
+MWM%(]<9F[SCOZ)EK5"%&.8/;ZAWG'3TKC:K%:%:S6Q;+>4?/5J,Z,?I#<)QW
+M9"TAUV/O:*1Z8[-WG'?TS#6J$*.<P6WUCO..GI5&U6(TJ]DMB^6\HV>K49T8
+M_1&X*@F]NTKO>#WVCD:J-[9Z5W'>T3/7J$*,<@:WT;N*\XZ>E4;58C2KV2V+
+MY;RC9ZM1G1C](3C.NU9ZQVNRVK%W[1W<LG><=_3,-:H0HYS!;?6.\XZ>E4;5
+M8C2KV2V+Y;RC9ZM1G1C](3C.NTYZQ^NQ=S12O;'9.\X[>N8:58A1SN"V>L=Y
+M1\]*HVHQFM7LEL5RWM&SU:A.C/X0'.==+[WC]=@[&JG>V.P=YQT]<XTJQ"AG
+M<%N]X[RC9Z51M1C-:G;+8CGOZ-EJ5"=&?P2N3J;>Q9T;Y-KW+AJIWMCJ71WF
+M7?3,-:H0HYS!;?2N#O,N>E8:58O1K&:W+#;,N^C9:E0G1G\(+LP["'\'Y>\@
+M_!UV^;LZS#L(?P?E[R#\'7;YNSK,.PA_!^7O(/S=2G;+8L.\@_!W4/X.PM\=
+M@`OS#L+?0?D["'^'7?ZN#O,.PM]!^3L(?X==_JX.\P["WT'Y.PA_MY+=LM@P
+M[R#\'92_@_!W!^#"O(/P=U#^#L+?89>_J\.\@_!W4/X.PM]AE[^KP[R#\'=0
+M_@["WZUDMRPVS#L(?P?E[R#\W3Y<DX3>"7\'Y>\@_!UV^;N&\T[X.RA_!^'O
+ML,O?-9QWPM]!^3L(?[>2W;)8SCOA[Z#\'82_.P#'>2?\'92_@_!WV.7O&LX[
+MX>^@_!V$O\,N?]=PW@E_!^7O(/S=2G;+8CGOA+^#\G<0_NX`'.>=\'=0_@["
+MWV&7OVLX[X2_@_)W$/X.N_Q=PWDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[`W"<
+M=\+?0?D["'^'7?ZNX;P3_@[*WT'X.^SR=PWGG?!W4/X.PM^M9+<LEO-.^#LH
+M?P?A[_;AKDGHG?!W4/X.PM]AE[^[<MX)?P?E[R#\'7;YNROGG?!W4/X.PM^M
+M9+<LEO-.^#LH?P?A[P[`<=X)?P?E[R#\'7;YNROGG?!W4/X.PM]AE[^[<MX)
+M?P?E[R#\W4IVRV(Y[X2_@_)W$/[N`!SGG?!W4/X.PM]AE[^[<MX)?P?E[R#\
+M'7;YNROGG?!W4/X.PM^M9+<LEO-.^#LH?P?A[P[`<=X)?P?E[R#\'7;YNROG
+MG?!W4/X.PM]AE[^[<MX)?P?E[R#\W4IVRV(Y[X2_@_)W$/YN'ZY-0N^$OX/R
+M=Q#^#KO\7<MY)_P=E+^#\'?8Y>]:SCOA[Z#\'82_6\EN62SGG?!W4/X.PM\=
+M@..\$_X.RM]!^#OL\G<MYYWP=U#^#L+?89>_:SGOA+^#\G<0_FXENV6QG'?"
+MWT'Y.PA_=P".\T[X.RA_!^'OL,O?M9QWPM]!^3L(?X==_J[EO!/^#LK?0?B[
+ME>R6Q7+>"7\'Y>\@_-T!.,X[X>^@_!V$O\,N?]=RW@E_!^7O(/P==OF[EO-.
+M^#LH?P?A[U:R6Q;+>2?\'92_@_!W^W!=,O4N2O`@UZ.,D4:J-VYCTX9O-WPG
+M[@4NS+M51=_*/\7>N?7L[K3XQ^#NBYWDAACEAG$3,97[^P`G.&,Y)"ZAZ_N`
+M1^20B.MR/EXEAT1<E_/Q*CDDXKJ<CU?)(1'7Y29R2,1UN8D<$G%=;B*'1%R7
+MF\@A$=?E)G)(Q'6YB1P2<5UN(H=$7)>;R"$1U^4F<DC$=;F)'!)Q76XBAT1<
+MEYO((1'7Y29R2,1UN8D<$G%=;B*'1%R7F\@A$=?E)G)(Q'6YB1P2<5UN(H=$
+M7)>;R"$1U^4F<DC$=;F)'!)Q76XBAT1<EYO((1'7Y29R2,1UN8D<$G%=;B*'
+M1%R7F\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P2
+M7)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<
+ME]O((<%UN8T<$ER7V\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7
+MV\@AP76YC1P27)?;R"'!=;F-'!)<E]O((<%UN8T<$ER7V\@AP76YC1P27)?;
+MR"$1U^7)2^]^OQP2<5U.SU?)(1'7Y?1\E1P2<5U.SU?)(1'7Y29R2,1UN8D<
+M$G%=;B*'1%R7F\@A$=?E)G)(Q'6YB1P2<5UN(H=$7)>;R"$1U^4F<DC$=;F)
+M'!)Q76XBAT1<EYO((1'7Y29R2,1UN8D<$G%=;B*'1%R7F\@A$=?E)G)(Q'6Y
+MB1P2<5UN(H=$7)>;R"$1U^4F<DC$=;F)'!)Q76XBAT1<EYO((1'7Y29R2,1U
+MN8D<$G%=;B*'1%R7F\@AP76YC1P27)?;R"'1F<HAT9G*(=&9RB'1F<HAT9G*
+M(=&9RB'1F<HAT9G*(=&9RB'1F<HAT9G*(=&9RB'1F<HAT9G*(=$GB:$<$KVI
+M'!*]J1P2O:D<$KVI'!*]J1P2O:D<$KVI'!*]J1P2O:D<$KVI'!*]J1P2O:D<
+M$KVI'!*]J1P2O:D<\IPDB:$<\IR8RB'/]Q]-?`SNOMA);IB-Y4Z?77K_]_:-
+MVS>G^9\(B/ZW`>:YJ^\!_QD*SL9/$ZXR=\W6ZDJGX\1VP5_/^I>=C>6:66;<
+MOR+Y;"*_/<.R,\[P,F:8E_Z#=O/"7<Y',_SIVQ\7&4YP9D<RP>V^0R(/VF_!
+M?2UP_C>"7CQGGP5^A4LYC?5:X+Z:O@F7?2X[75$=*];XP[LOR641I^?L?_)X
+M0I#_SSO/`>/YNI?\JOLTSK-R/Y.?NR_7_]35CZ_5\Y@-ZHURW1S._]35\YP=
+MX4[WOKK/[FI\&%B^,PZ^<SW(_)T[P9UM!T$U3I9)]W'_]_:-VW>G^9\),`N`
+29AW,_$>3)%_\'XGNMJQQ8```
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow.gz.uu
new file mode 100644
index 0000000..791a1e0
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow.gz.uu
@@ -0,0 +1,127 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.qcow.gz
+M'XL("+\S(E0``VEM9RTV,W@R-34M-3$R+79T;V,X+G%C;W<N;W5T`*V=R6X<
+M5Q)%]_Z*TBQ1DE41\7+22'0W#/2B`3?Z!YQ#U3K1JU[XXYN2WB!&WJOP)!,&
+M!3HOBD^'1[)]\'@^?_UQ.G5R2OTI3:?K<KK[>7Z3TS<_N?]V^O7?/_WSQV]_
+M_/K#US$Y?^>I>S^7TS">ICQW;^M_;4X_/[6>SE,X]^5-T-PWK\Y^\ZN[]\D>
+MYVY^^/K)XN?TMPV>W.N3WW%Z7]X,OKYSG5/X5&)SW;VYVSSW<YW[BT]/R>GU
+MOVWP%W=Z^GM/+WI]=EGA<P,;'.\-[N[UV66#3TUL;OXNS':YP*<6-K<&<U?X
+MU,;F+M^?N^*GKGA.OO.+\74._=I*^7H_?D#AW*G.H:\,*5]/QP^D>W/G/'=;
+MY]!7AI2OI^,'^GMS/_]8@"YS"3Y%N).(NVL'GR+<2<3=M8=/$>XDXNXZP*<(
+M=Q)R-\*G"'<:<C?!IPAW&G(WPZ<(=QIRM\"G"'<:<H=\IXP[#;E#OE/&G8;<
+M(=\IXTY#[I#OE'&G`7<)_EZFC#L+N$OP]S)CW%G`78)_$C#&G07<)?@G`6/<
+M6<!=.B/?&>/.`N[2&?G.&'<6<)?.R'?&N+.`NW1&OC/&G87<(=\9XRZ%W"'?
+M)<9="KE#ODN,NQ1RAWR7&'<IY`[Y+C'N4L@=\EUBW*60.^2[Q+A+(7?(=XEQ
+MER+N!#]%N.LB[@3YKF/<=1%W@GS7,>ZZB#M!ONL8=UW$G2#?=8R[+N).D.\Z
+MQET7<2?(=QWCKHNX$^2[CG'7A=PAWW6,NS[D#OFN9]SU(7?(=SWCK@^Y0[[K
+M&7=]R!WR7<^XZT/ND.]ZQET?<H=\US/N^I`[Y+N><=='W"E^BG`W1-PI\MW`
+MN!LB[A3Y;F#<#1%WBGPW,.Z&B#M%OAL8=T/$G2+?#8R[(>).D>\&QMT0<:?(
+M=P/C;@BY0[X;&'=CR!WRW<BX&T/ND.]&QMT8<H=\-S+NQI`[Y+N1<3>&W"'?
+MC8R[,>0.^6YDW(TA=\AW(^-NC+@S_!3AKOSG>3Z'?#<Q[J:(.T.^FQAW4\2=
+M(=]-C+LIXLZ0[R;&W11Q9\AW$^-NBK@SY+N)<3=%W!GRW<2XFT+ND.\FQMT<
+M<H=\-S/NYI`[Y+N9<3>'W"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/(
+M'?+=S+B;(^X2?HIP5_XW*9]#OEL8=TO$74*^6QAW2\1=0KY;&'=+Q%U"OEL8
+M=TO$74*^6QAW2\1=0KY;&'=+Q%U"OEL8=TO('?+=PKA;0^Z0[U;&W1IRAWRW
+M,N[6D#ODNY5QMX;<(=^MC+LUY`[Y;F7<K2%WR'<KXVX-N4.^6QEW:\1=AY\B
+MW&T1=QWRW<:XVR+N.N2[C7&W1=QUR'<;XVZ+N.N0[S;&W19QUR'?;8R[+>*N
+M0[[;&'=;Q%V'?+<Q[K:0.^2[C7%W";E#OKLP[BXA=\AW%\;=)>0.^>["N+N$
+MW"'?71AWEY`[Y+L+X^X2<H=\=V'<74+ND.\NC+M+Q%V/GR+<72/N>N2[*^/N
+M&G'7(]]=&7?7B+L>^>[*N+M&W/7(=U?&W37BKD>^NS+NKA%W/?+=E7%WC;CK
+MD>^NC+MKR!WRW95P)^4=/@=\)V?"G9Q#[H#OY$RXDW/('?"=G`EW<@ZY`[X3
+MUM])U-^E'OA.6'\G47^7>N`[8?V=1/U=ZH'OA/5W$O5W=_^6`I\BW$7]71J`
+M[X3U=Q+U=VD`OA/6WTG4WZ4!^$Y8?R=1?Y<&X#MA_9U$_5T:@.^$]7<2]7=I
+M`+X3UM])U-^E`?A.6'\G47^7!N`[8?V=1/U=&I#O6'\G47^7!N0[UM])U-^E
+M`?F.]7<2]7=I0+YC_9U$_5T:D.]8?R=1?Y<&Y#O6WTG4WZ4!^8[U=Q+V=R-^
+MBG`7]G<C\AWK[R3L[T;D.];?2=C?C<AWK+^3L+\;D>]8?R=A?S<BW['^3L+^
+M;D2^8_V=A/W=B'S'^CL)^[L1^8[U=Q+V=R/R'>OO).SO1N0[UM])V-^-R'>L
+MOY.POQN1[UA_)V%_-R+?L?Y.POYN1+YC_9V$_=V(?,?Z.PG[NPD_1;@+^[L)
+M^8[U=Q+V=Q/R'>OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'?L?Y.
+MPOYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W$_(=Z^\D[.\FY#O6WTG8WTW(
+M=ZR_D["_FY#O6'\G87\W(=^Q_D["_FY"OF/]G83]W8R?(MR%_=V,?,?Z.PG[
+MNQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W(=ZR_D["_FY'O6'\G87\W(]^Q
+M_D["_FY&OF/]G83]W8Q\Q_H["?N[&?F.]7<2]G<S\AWK[R3L[V;D.];?2=C?
+MS<AWK+^3L+^;D>]8?R=A?S<CW['^3L+^;L%/$>["_FY!OF/]G83]W8)\Q_H[
+M"?N[!?F.]7<2]G<+\AWK[R3L[Q;D.];?2=C?+<AWK+^3L+];D.]8?R=A?[<@
+MW['^3L+^;D&^8_V=A/W=@GS'^CL)^[L%^8[U=Q+V=POR'>OO).SO%N0[UM])
+MV-\MR'>LOY.POUN0[UA_)V%_M^*G"'=A?[<BW['^3L+^;D6^8_V=A/W=BGS'
+M^CL)^[L5^8[U=Q+V=ROR'>OO).SO5N0[UM])V-^MR'>LOY.POUN1[UA_)V%_
+MMR+?L?Y.POYN1;YC_9V$_=V*?,?Z.PG[NQ7YCO5W$O9W*_(=Z^\D[.]6Y#O6
+MWTG8WZW(=ZR_D["_V_!3A+NPO]N0[UA_)V%_MR'?L?Y.POYN0[YC_9V$_=V&
+M?,?Z.PG[NPWYCO5W$O9W&_(=Z^\D[.\VY#O6WTG8WVW(=ZR_D["_VY#O6'\G
+M87^W(=^Q_D["_FY#OF/]G83]W89\Q_H["?N[#?F.]7<2]G<;\AWK[R3L[S;D
+M.];?2=C?7?!3A+NPO[L@W['^3L+^[H)\Q_H["?N["_(=Z^\D[.\NR'>LOY.P
+MO[L@W['^3L+^[H)\Q_H["?N["_(=Z^\D[.\NR'>LO]/RCIL[M3G@N[NG,'?J
+M^KMRW]^I<0=\IZR_4]??G3)WI\8=\)VR_DY=?W?*W)T:=\!WROH[=?W=:3^<
+M'?"=LOY.77]7SZ[-`=\IZ^_4]7=@#OA.67^GKK\[SJ'[[Y3U=^KZNS+WH,T!
+MWRGK[]3U=P_*7.4.W7^GK+]3U]\]R-P]J-RA^^^4]7?J^KL'F;L'E3MT_YVR
+M_DY=?_=@/YP=\)VR_DY=?U?/KLT!WRGK[]3U=V`.^$Y9?Z>NOP-SP'?*^CMU
+M_5V9>]CFD.]8?Z>NOWM8YAIWR'>LOU/7WSW,W#ULW"'?L?Y.77_W,'/WL'&'
+M?,?Z.W7]W</]<';(=ZR_4]??U;-K<\AWK+]3U]^!.>0[UM^IZ^\.<]T9/T6X
+M<_U=F7O4YI#O6'^GKK][5.9.=0[YCO5WZOJ[1YF[1[=U#OF.]7?J^KM'F;M'
+MO]0YY#O6WZGK[Q[MA[-#OF/]G;K^KIY=FT.^8_V=NOX.S"'?L?Y.77\'YI#O
+M6'^GKK\K<X_;'/(=Z^_4]7>/RUSC#OF.]7?J^KO'F;O'C3OD.];?J>OO'F?N
+M'C?ND.]8?Z>NOWN\'\X.^8[U=^KZNWIV;0[YCO5WZOH[,(=\Q_H[=?W=<0[=
+M?Z>LOU/7WY6Y)VT.^8[U=^KZNR=EKG*'[K]3UM^IZ^^>9.Z>5.[0_7?*^CMU
+M_=V3S-V3RAVZ_TY9?Z>NOWNR'\X.^8[U=^KZNWIV;0[YCO5WZOH[,(=\Q_H[
+M=?T=F$.^8_V=NOZNS#UM<\AWK+]3U]\]+7.-.^0[UM^IZ^^>9NZ>-NZ0[UA_
+MIZZ_>YJY>]JX0[YC_9VZ_N[I?C@[Y#O6WZGK[^K9M3GD.];?J>OOP!SR'>OO
+MU/5WQSET_YVR_DY=?U?FGK4YY#O6WZGK[YZ5N<H=NO].67^GKK][EKE[5KE#
+M]]\IZ^_4]7?/,G?/*G?H_CME_9VZ_N[9?C@[Y#O6WZGK[^K9M3GD.];?J>OO
+MP!SR'>OOU/5W8`[YCO5WZOJ[,O>\S2'?L?Y.77_WO,PU[I#O6'^GKK][GKE[
+MWKA#OF/]G;K^[GGF[GGC#OF.]7?J^KOG^^'LD.]8?Z>NOZMGU^:0[UA_IZZ_
+M`W/(=ZR_4]??'>?0_7?*^CMU_5V9>]'FD.]8?Z>NOWM1YBIWZ/X[9?V=NO[N
+M1>;N1>4.W7^GK+]3U]^]R-R]J-RA^^^4]7?J^KL7^^'LD.]8?Z>NOZMGU^:0
+M[UA_IZZ_`W/(=ZR_4]??@3GD.];?J>OORMQ-FT.^8_V=NO[NILPU[I#O6'^G
+MKK^[R=S=-.Z0[UA_IZZ_N\G<W33ND.]8?Z>NO[O9#V>'?,?Z.W7]73V[-H=\
+MQ_H[=?T=F$.^8_V=NO[N.(?NOU/6WZGK[\K<RS:'?,?Z.W7]W<LR5[E#]]\I
+MZ^_4]7<O,W<O*W?H_CME_9VZ_NYEYNYEY0[=?Z>LOU/7W[W<#V>'?,?Z.W7]
+M73V[-H=\Q_H[=?T=F$.^8_V=NOX.S"'?L?Y.77]7YEZU.>0[UM^IZ^]>E;G&
+M'?(=Z^_4]7>O,G>O&G?(=ZR_4]??O<K<O6K<(=^Q_DY=?_=J/YP=\AWK[]3U
+M=_7LVASR'>OOU/5W8`[YCO5WZOJ[XQRZ_TY9?Z>NORMSK]L<\AWK[]3U=Z_+
+M7.4.W7^GK+]3U]^]SMR]KMRA^^^4]7?J^KO7F;O7E3MT_YVR_DY=?_=Z/YP=
+M\AWK[]3U=_7LVASR'>OOU/5W8`[YCO5WZOH[,(=\Q_H[=?U=F?NQS2'?L?Y.
+MH_ZN0_??*>OO-.KO.G3_G;+^3J/^KD/WWRGK[S3J[SIT_YVR_DZC_JY#]]\I
+MZ^\TZN\Z=/^=LOY.H_ZN0_??*>OOE/1W;]H<\AWK[]3U=V_*7.4.W7^GK+]3
+MU]^]R=R]J=RA^^^4]7?J^KLWF;LWE3MT_YVR_DY=?_=F/YP=\AWK[]3U=_7L
+MVASR'>OOU/5W8`[YCO5WZOH[,(=\Q_H[*^^XN7.;`[XSUM_=?>`>=\5/Y\8=
+M\)VQ_LY<?W?.>^?&'?"=L?[.7']WSMR=&W?`=\;Z.W/]W7D_G!WPG;'^SEQ_
+M5\^NS0'?&>OOS/5W8`[XSEA_9ZZ_.\ZA^^^,]7?F^KLR)VT.^,Y8?V>NOY,R
+M5[E#]]\9Z^_,]7>27YY4[M#]=\;Z.W/]G63NI'*'[K\SUM^9Z^]D/YP=\)VQ
+M_LY<?U?/KLT!WQGK[\SU=V`.^,Y8?V>NOP-SP'?&^CMS_5V9TS:'?,?Z.W/]
+MG9:YQAWR'>OOS/5WFKG3QAWR'>OOS/5WFKG3QAWR'>OOS/5WNA_.#OF.]7?F
+M^KMZ=FT.^8[U=^;Z.S"'?,?Z.W/]W7$.W7]GK+\SU]^5.6MSR'>LOS/7WUF9
+MJ]RA^^^,]7?F^CO+W%GE#MU_9ZR_,]??6>;.*G?H_CMC_9VY_L[VP]DAW['^
+MSEQ_5\^NS2'?L?[.7'\'YI#O6']GKK\#<\AWK+\SU]^5N=3FD.]8?V>NOTME
+MKG&'?,?Z.W/]7<K<I<8=\AWK[\SU=RESEQIWR'>LOS/7WZ7]<';(=ZR_,]??
+MU;-K<\AWK+\SU]^!.>0[UM^9Z^^.<^C^.V/]G;G^KLQU;0[YCO5WYOJ[KLQ5
+M[M#]=\;Z.W/]79>YZRIWZ/X[8_V=N?ZNR]QUE3MT_YVQ_LY<?]?MA[-#OF/]
+MG;G^KIY=FT.^8_V=N?X.S"'?L?[.7'\'YI#O6']GKK\K<WV;0[YC_9VY_JXO
+M<XT[Y#O6WYGK[_K,7=^X0[YC_9VY_J[/W/6-.^0[UM^9Z^_Z_7!VR'>LOS/7
+MW]6S:W/(=ZR_,]??@3GD.];?F>OOCG/H_CMC_9VY_J[,#6T.^8[U=^;ZNZ',
+M5>[0_7?&^CMS_=V0N1LJ=^C^.V/]G;G^;LC<#94[=/^=L?[.7'\W[(>S0[YC
+M_9VY_JZ>79M#OF/]G;G^#LPAW['^SEQ_!^:0[UA_9ZZ_*W-CFT.^8_V=N?YN
+M+'.-.^0[UM^9Z^_&S-W8N$.^8_V=N?YNS-R-C3OD.];?F>OOQOUP=LAWK+\S
+MU]_5LVMSR'>LOS/7WX$YY#O6WYGK[XYSZ/X[8_V=N?ZNS$UM#OF.]7?F^KNI
+MS%7NT/UWQOH[<_W=E+F;*G?H_CMC_9VY_F[*W$V5.W3_G;'^SEQ_-^V'LT.^
+M8_V=N?ZNGEV;0[YC_9VY_@[,(=^Q_LY<?P?FD.]8?V>NORMS;]L<\AWK[\SU
+M=V_+7.,.^8[U=^;ZN[>9N[>-.^0[UM^9Z^_>9N[>-NZ0[UA_9ZZ_>[L?S@[Y
+MCO5WYOJ[>G9M#OF.]7?F^CLPAWS'^CMS_=UQ#MU_9ZR_,]??E;EW;0[YCO5W
+MYOJ[=V6N<H?NOS/6WYGK[]YE[MY5[M#]=\;Z.W/]W;O,W;O*';K_SEA_9ZZ_
+M>[<?S@[YCO5WYOJ[>G9M#OF.]7?F^CLPAWS'^CMS_1V80[YC_9VY_J[,O6]S
+MR'>LOS/7W[TO<XT[Y#O6WYGK[]YG[MXW[I#O6']GKK][G[E[W[A#OF/]G;G^
+M[OU^.#OD.];?F>OOZMFU.>0[UM^9Z^_`'/(=Z^_,]7?'.73_G;'^SEQ_5^8^
+MM#GD.];?F>OO/I2YRAVZ_\Y8?V>NO_N0N?M0N4/WWQGK[\SU=Q\R=Q\J=^C^
+M.V/]G;G^[L-^.#OD.];?F>OOZMFU.>0[UM^9Z^_`'/(=Z^_,]7=@#OF.]7?F
+M^KLR]['-(=^Q_LY<?_>QS#7ND.]8?V>NO_N8N?O8N$.^8_V=N?[N8^;N8^,.
+M^8[U=^;ZNX_[X>R0[UA_9ZZ_JV?7YI#O6']GKK\#<\AWK+\SU]\=Y]#]=\;Z
+M.W/]79G[U.:0[UA_9ZZ_^U3F*G?H_CMC_9VY_NY3YNY3Y0[=?V>LOS/7WWW*
+MW'VJW*'[[XSU=^;ZNT_[X>R0[UA_9ZZ_JV?7YI#O6']GKK\#<\AWK+\SU]^!
+M.>0[UM^E\HZ;NVUSP'>)]7?)]7>W9:YQ!WQW]Q3F+KG^[C9S=]NX`[Y+K+]+
+MKK^[S=S=-NZ`[Q+K[^I;F3OTQNC^N_94,/?-CU]_N/DRV)\_?SCUIT%/???Y
+M+>FILU-*G\N/+QG%!@=_^N_E\K?__$/M7]^^OA[=N?3G7M]]]N3[@^/I/)W.
+M"@>_SGW#WA3.?>_U?9U#W^O]3\RA[_4.YSY3=_<'F+O?,BYN[I=OYM#W>O\S
+MOQC'JSG*'U/.]@<^W7HUA[5_^/KEMZT[NY`Y:7.?_%S[=-4]I:?V/'AU)_CJ
+MVI?:<O=OA7;_J>]^LG]'<^A;V_]Q5-#5''ANFT_+'2=RNJY\#EW-\6=0&;X,
+E?I;F#/[./_#KSS_>_^OK8,J#?]DK3'=>.9]_^#\)B7^=OZ8`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow2.gz.uu
new file mode 100644
index 0000000..0a79ac2
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.qcow2.gz.uu
@@ -0,0 +1,21 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.qcow2.gz
+M'XL("+8[(U0``VEM9RTV,W@R-34M-3$R+79T;V,X+G%C;W<R+F]U=`"MF-MN
+MTT`0AN_S%,NI0(&2G=EU;$Z%'B)Q@03B!8AC^P&X0\K#L[$W&7L\XTTBIU:D
+MU/T_S:Z__K6[7'8O8[PU+C.N,$UIPN=X@.E]&!YF]VO]_:;_VBTZF%TJJ=$)
+M:U;%$3=@_2,<:+@0%[XEXGK3H8"#0VH,2N&<.MW4"0%WO6BWKKT8.4O@)<`.
+MIUZ,B^:#;CZ><!?.!W//A_+^^0OGP_GGPWHJQP?/4O-A(Z16&BY/X9R4*C3<
+M)HFS0JK4<-LD#H14I>'J)`Z%5*/@;%(5YX24U7"0Q'DAA1K.)7&9D/(:+NF=
+M6PDIS3N;]BX74IIW-NU=(:0T[VS:NXV0TKRS:>]*(:5Y!XIWAG!;(:5Y!\R[
+M)Q'WE'"5D-*\`^;=LXA[3KA:2&G>`?/N1<1=$4[H.]"\`^;=RXA[=<1Y*:5Y
+M!\R[UQ%W33BA[T#S#IAW;R+N+>&$O@/-.V#>O1MYYX6^`\T[9-Z]CZPEX82^
+M0\T[9-[9B`/""7V'FG?(O,.(<X03^@XU[Y!YYR,N(YS0=ZAYA\R[5<3EA!/Z
+M#C7OD'E71-P'P@E]AYIWR+S[&'&?""?T'6K>(?/N<\1](9S0=ZAYYYAWMQ'W
+ME7!"WSG-.\>\^Q9Q=X03^LYIWCGFW7W$/1!.Z#NG>>>8=X\1MR9<,^O]IZ/[
+M=RN\ZR<F@/GY0/6/8\`5LR[8=PL.&[T"D_G]$93PN+^2H9/V#>,J$;C^6]=W
+MOQ\`?_3F\W,_$'C:O^5@@Q1@WMZ.@[9_?K!_11(W-5^'V\RUW`Y7GHH+]1UN
+M[:O:U#7#_>GAMC-?##M:;GVX\\<+EFL/RT7ZX:9MOM!_"J[WRW;+<;1<8"GZ
+M1XV5IC/B=-415VZI\T[9O7L)-_ED>_[>G=Q\U<:4P1-KFJV.@\DASE8ERUM@
+BN&<)3\'C=_W$[N?-\*L#N@B<;<+P@!9>B_]NV1VQX1,`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.raw.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.raw.gz.uu
new file mode 100644
index 0000000..c949873
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.raw.gz.uu
@@ -0,0 +1,11 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.raw.gz
+M'XL("/W%'50``VEM9RTV,W@R-34M-3$R+79T;V,X+G)A=RYO=70`K9)!;L,@
+M$$7W/L5?=V$Q@&V\JI16V56JU`O4-G"`K#E\2'!"C+'C1![0"&GF/\T7PU@(
+M0-9H..KJ<B5')2`E!`>$?VGXEN3"'4_&'/Z^N?@IK^&*`"-?G/>/JL6"*Y-P
+MQ<<(5!,=K0,56`O&L\"`:Z.J?8I;FR_@NKWL!ER_%5?[K*$-C$EP_P^X8>?/
+MH)E=`PH/\89=NMD5L=G:2Q9V"4<1]YGBHEV>J#BB/C,=LM/I.ZX?(,54M6KV
+M*X<SNZX*V:TXW:'W>T*PPS*.KP[QZJHT6EV!E>_J,GFYX'[+Z0G`?@3N-2$U
+-2M6,%6>->Z%+`P4`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhd.gz.uu
new file mode 100644
index 0000000..0355276
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhd.gz.uu
@@ -0,0 +1,18 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.vhd.gz
+M'XL("#$UQ%4``VEM9RTV,W@R-34M-3$R+79T;V,X+G9H9"YO=70`K99+;^0@
+M#,?O\RDL[:V'$3&$)*=*?>QMI97VL->2A%2CJ@^U/<QA/OS:@320UW9:,B@"
+M@7_YVQ@/0K@'0$O0'6@+.N=^H4!74)0`-.D;]N_,#^'4/#_9YOUPW/OGM'.P
+M3(16L3G;HP1%'RD`#7]$M]R'TX#9_[B]OS@\W@\X]#CTH+Q@*XF@Z\EW,A9<
+M:J>.27\/^-`CCZ,Z.5476O%80M>![((5<E#G7+T,G55D1>NYY5#G?7R&%@VB
+MB='92>QR,;$*E"X%58S.+N'TEM4YN(N=WPN7*A2Q@MX"-$4/N4]I,\1AUBA5
+MCF\OYO7-3O3A2JJ,FY'-YIIU=]&G"@Z+O0(U3Y787>@I#U/<+%6^&3T=VZDX
+M2.'`K:#HB'S=73U&#X>@42/5HMC:C'WOKYCA4&Q8;>%6W#7LKM*<(%Q4<E`(
+M.9U]Q8<7)/7:Q?C]?+7VZL\-RE^1/K.2+%_>#E-&=O\Y;"6(BHO0ZG:8:K2J
+MOG]VC4GEKL/5G\51S1`MM!:LG>#N`ER3>#/JF;NVSW_1E]^SW:T'=^6XV)TK
+MJNPKN*`N7TYQ3734PH8PVB^H@T5U[0>N;D#)V&K3V>LEG$V:*G7W65QKH*8\
+MR:#;J,K-IHAS4P5]74E6J#"U0MF6EJ?IKUR8A??ZQ.GW/OXYH/(*D[E,P+0*
+MM0<F4ZCI$IE48=%6F'27RZ+L\S#1O9EQ">_-C$MX;V9<PGLSXQ+>FQF7\-[,
+2N*3W9@+2^=W]`WD,N"QL#0``
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdf.gz.uu
new file mode 100644
index 0000000..51b7876
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdf.gz.uu
@@ -0,0 +1,14 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.vhdf.gz
+M'XL("*8EAE4``VEM9RTV,W@R-34M-3$R+79T;V,X+G9H9&8N;W5T`*V4.V_#
+M(!2%]_R*(W7+$)F'L3U%ZFNK5*E#U]H&HBAJ*U4=.OC'%XP3`\%N&ADC1`3G
+MXQYRN5GF&L`%"@J1V\XI<@;.P2C`S$S";(DZNL<OI6Y?[BE[VO2M6SD8,8OG
+M^P?5Y$*WB5JW6@_`,M"1>6")K$)&DT"'JT95]2=N+CZ'JY>RZW#-I3AA1@FI
+MH%2$>_-P[<)_!CFSJT#<A%UAEQSMLG&SUG9D>@I'1MPVQHUV::2B&/6)Z)",
+M3IYP30O.0M6LV;L43BV:*D1?BI,U&I,G!+J=QM'9(/Z;*H4L>V!N=M6)<7JA
+M>]Z$GP,V`W"I"$DY5#[!(#2$ZHL?0\$A*A2E#Z1!WJ!K/S]4^[W_\6ZPQ]G*
+M9[(WV:V>FEIJ#BE`:WN(D';NQ7?SL%OOWW=''!U<T>'@O+`J4Y1%$]DE*$.[
+MKWMZB*-C\27Y*O<&39Q,AX_&O[VMC^,GLZ8`F>=A[^?8@Q_!0BK[>ER>1:JK
+3WT:/$PNGBLF]U2]`,(]1+@<`````
+`
+end
diff --git a/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vmdk.gz.uu
new file mode 100644
index 0000000..d9340d1
--- /dev/null
+++ b/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vmdk.gz.uu
@@ -0,0 +1,83 @@
+# $FreeBSD$
+begin 644 img-63x255-512-vtoc8.vmdk.gz
+M'XL("/[%'50``VEM9RTV,W@R-34M-3$R+79T;V,X+G9M9&LN;W5T`*U<76_=
+MQA%]SZ\@[#X412%PR+DD[X-1-U$"%$6`(`[:U_!CV0A-;$,6BAK0C^\NN6=U
+MJ'OI9:-QJ$#C.W.T,^0]DL\<J"S7/T6A0Z%:Z%2<FJ*4PO_5>A5E_13X:TPO
+M//[]]OM_W-"?QZ]6,`E55"(EPU&P^3J/-\_^`*[Z4M7F!7]56;C:ORC#16&$
+MJW9>V(73,+MK)3A=7_@&RBE\0G!O$U"Q@3M=Z6FWV2^=[D]?Q>'YEZLZG,'?
+MWN9<M'71##$LFM,2UT5;+:^51>N39@_XNKB]^_3OXM9]&N_O/CY\B.>KPKWU
+MR=J$_&8,"+ZQM@F?A!<"W#E`-*ZHIZ*6\'+Q>/_=W:_NYC_N_M/=A_=O!.U6
+MX=YJ7>@Y'"?DET_7)@A?I"P:"5^C>/SF;[=OXI-;WGSL[P$7JOQ!_-?V?3!N
+MTQ3AX_):3N?>/P3$.?Y)IPOW-@[GM'QM#9^<M&C/Q7*<4\"N_,M3;'F9W7CO
+M^@?WT^>/[LVKWSZ\3[,+]S:,[+P`=<N@ZN)4!ZC86AC?*2"&QV:Y:\7CKW</
+MO]R-[WR;G]RKF]<%X)HP.W\#NWBNM6M?TNS>67_LQV__^^#[+:9X9^\`MQQB
+M:<)_[5-5G-J`5?OQ^2I_'VO?;!7^RA_8=Z(2DHK'#^]O?ORG'[3XZ-T/?_T1
+M<)V'\YG^@+[$-[3IZ;3V?WK^6!:/[[XM7H4F?_K%+4\@X,[A,5Z3U_L@2UB%
+M3^+45OA`8AI>6.YL<=L_],77_2=W\_KV]NMT9_O0K"Z7/YH+*,T*'9[O99Q^
+M<.N=7F_T<BNF:;CII_[C@[L/MS?=BB$\K5/L--Q6?;J-VZ_3+G=J#D],\?BF
+M>'4W^7L:8/_E/OP&N'%]C/TYPB-Q7@KK\(E_>A9X%[_"^L2$VQ3@W,/]YYOQ
+M\Z]W[R?_1BO>`&Y:9^>/4]?Q4.E,SP^5OJR?W:OZZ6@>&W`NC&@]5!??&!YK
+M/<?3%/RS$IZ8-(7'SS>_N'[RQRI>5:?3JW0KYN>W@D?T;`KKC?:S6&]%/-CG
+MFT]NC'!U&6_@O!G.>J:B;IY&L"70AP_WR]$:WS/Q<?W\>]E+^5@OOJ6V#,C?
+ME^8#WWXTG$\(3MK?>;X5[N)[[0O;;<K<M\?K@&^OGZ\QOAUR"N_<$^4V7-=2
+MT&T`?_`@/_N/CYOSR2F\<\^4V7/50,&8.=\*%]ZY$V4ZKIJ?-2I9N/#.%<JL
+MN*JF0"_@PD\II?]X2W!SG!TR&ZYJ*>@V<#NS6QZ5,V7V7#50,!YI=GE4)LIT
+M7#67FQ\CLS\V2E/%V2&SXJJ:`KV`NS*[IHZS0V;#52T%W09N;W8:9X?,GJL&
+M"L9#S9[B[)#IN&HNMS\FUUFX)LX.F157U13H!=RUV;5Q=LALN*JEH-O`[<VN
+MB[-#9L]5`P7CH6;/<7;(=%PUEUORURQ<'V>'S(JK:@KT`N[:[,!WR&RXJJ6@
+MV\#MS0Y\A\R>JP8*QD/-@N^0Z;AJIB!<IRP<^`Z9%5?5%.@%W+79@>^0V7!5
+M2T&W@=N975O&V2&SYZJ!@O%(LRWX#IF.JV8*PM5DX<!WR*RXJJ9`+^"NS*X%
+MWR&SX:J6@FX#MS<[\!TR>ZX:*!@/-0N^0Z;CJIF"<+59./`=,BNNJBG0"[AK
+MLP/?(;/AJI:";@.W-SOP'3)[KAHH&`\U"[Y#IN.JN=S\@%MV63CP'3(KKJHI
+MT`NX:[,#WR&SX:J6@FX#MS<[\!TR>ZX:*!@/-0N^0Z;CJIF"<)VS<.`[9%9<
+M55.@%W#79@>^0V;#52T%W09N9W9=&6>'S)ZK!@K&(\UVX#MD.JZ:*0A7GX4#
+MWR&SXJJ:`KV`NS*[#GR'S(:K6@JZ#=S>[,!WR.RY:J!@/-0L^`Z9CJOF<OO/
+MXR$+![Y#9L55-05Z`7=M=N`[9#9<U5+0;>#V9@>^0V;/50,%XZ%FP7?(=%PU
+ME]M_PX]9./`=,BNNJBG0"[AKLP/?(;/AJI:";@.W-SOP'3)[KAHH&`\U"[Y#
+MIN.JF8)P35DX\!TR*ZZJ*=`+N&NS`]\AL^&JEH)N`[<SNW,99X?,GJL&"L8C
+MS9[!=\AT7#53$"Z7A0/?(;/BJIH"O8"[,KLS^`Z9#5>U%'0;N+W9@>^0V7/5
+M0,%XJ%GP'3(=5\T4A&O.PH'OD%EQ54V!7L!=FQWX#ID-5[44=!NXO=F![Y#9
+M<]5`P7BH6?`=,AU7S>5&ITR;OGVXR'<IL^*JF@*]@+LVN\AW*;/AJI:";@.W
+M-[O(=RFSYZJ!@O%0LY'O4J;CJGF[&96LI'6.?">DWPGK=T+ZG63UNW/D.R']
+M3EB_$]+O)*O?]66<'>EWPOJ=D'Z7;[:/?">DWPGK=T+ZG60EK3[RG9!^)ZS?
+M">EWDM7O^LAW0OJ=L'XGI-])5K_K(]\)Z7?"^IV0?G>@V<AW0OJ=L'XGI-])
+M5M+J(]\)Z7?"^IV0?B=9_:Z/?">DWPGK=T+ZG63UNS[RG9!^)ZS?">EW!YJ-
+M?">DWPGK=YMM2U;2ZL%WI-\)ZW="^IUD];L>?$?ZG;!^)Z3?25:_Z\%WI-\)
+MZW="^MV!9L%WI-\)ZW="^IUD):T>?$?ZG;!^)Z3?25:_Z\%WI-\)ZW="^IUD
+M];NAC+,C_4Y8OQ/2[_+-#N`[TN^$]3LA_4ZRDM8`OB/]3EB_$]+O)*O?#>`[
+MTN^$]3LA_4ZR^MT`OB/]3EB_$]+O#C0+OB/]3EB_$]+O)"MI#>`[TN^$]3LA
+M_4ZR^MT`OB/]3EB_$]+O)*O?#>`[TN^$]3LA_>Y`L^`[TN^$]3O>*$M6TAK`
+M=Z3?">MW0OJ=9/6[`7Q'^IVP?B>DWTE6OQO`=Z3?">MW0OK=@6;!=Z3?">MW
+M0OJ=9"6M`7Q'^IVP?B>DWTE6OQO`=Z3?">MW0OJ=9/6[L8RS(_U.6+\3TN_R
+MS8[@.]+OA/4[(?U.LI+6"+XC_4Y8OQ/2[R2KWXW@.]+OA/4[(?U.LOK="+XC
+M_4Y8OQ/2[PXT"[XC_4Y8OQ/2[R0K:8W@.]+OA/4[(?U.LOK="+XC_4Y8OQ/2
+M[R2KWXW@.]+OA/4[(?WN0+/@.]+OA/4[]H9*5M(:P7>DWPGK=T+ZG63UNQ%\
+M1_J=L'XGI-])5K\;P7>DWPGK=T+ZW8%FP7>DWPGK=T+ZG60EK1%\1_J=L'XG
+MI-])5K\;P7>DWPGK=T+ZG63UNZF,LR/]3EB_$]+O\LU.X#O2[X3U.R']3K*2
+MU@2^(_U.6+\3TN\DJ]]-X#O2[X3U.R']3K+ZW02^(_U.6+\3TN\.-`N^(_U.
+M6+\3TN\D*VE-X#O2[X3U.R']3K+ZW02^(_U.6+\3TN\DJ]]-X#O2[X3U.R']
+M[D"SX#O2[X3U.R']KBJOPQ5/<)'O*BIYJJHIT"V<ARC\1^D_WA)<Y+N4R=>5
+MOTJS*ZXW.WZI:A_N<G:K/[!>3&G,:GS0HJ)_SE;=<\!PQ#_XCS^F\]6+*:TB
+MN/K8^?X<G[IMNW5C;->LEQVMF5VS[HSMFIK6^;A>9-?4M,[']2*[IJ9U/JX7
+MV34UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)75/3.M_$KJEIG6]BU]2TSC>Q:VI:
+MYYO8-36M\TWLFIK6^29V34WK?!.[IJ9UOHE=4],ZW\2NJ6F=;V+7U+3.-[%K
+M:EKGF]@U-:WS3>R:FM;Y)G9-3>M\$[NFIG6^B5U3TSK?Q*ZI:9UO8M?4M,XW
+ML6MJ6N>;V#4UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)75.QSK>Q:RK6^39V3<4Z
+MW\:NJ5CGV]@U%>M\&[NF8IUO8]=4K/-M[)J*=;Z-75.QSK>Q:RK6^39V3<4Z
+MW\:NJ5CGV]@U%>M\&[NF8IUO8]=4K/-M[)J*=;Z-75.QSK>Q:RK6^39V3<4Z
+MW\:NJ5CGV]@U%>M\&[NF8IUO8]=4K/-M[)J*=;Z-75.QSK>Q:RK6^39V3<4Z
+MW\:NJ5CGV]@U%>M\&[NF8IUO8]=4K/-M[)J*=;Z-75/3.A^9+[)K:EKG(_-%
+M=DU-ZWQDOLBNJ6F=C\P7V34UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)75/3.M_$
+MKJEIG6]BU]2TSC>Q:VI:YYO8-36M\TWLFIK6^29V34WK?!.[IJ9UOHE=4],Z
+MW\2NJ6F=;V+7U+3.-[%K:EKGF]@U-:WS3>R:FM;Y)G9-3>M\$[NFIG6^B5U3
+MTSK?Q*ZI:9UO8M?4M,XWL6MJ6N>;V#4UK?--[)J:UODF=DU-ZWP3NZ:F=;Z)
+M75.QSK>Q:RK6^39V39U,[9HZF=HU=3*U:^ID:M=45Y:&=DUUIG9-=:9V376F
+M=DUUIG9-=:9V376F=DUUIG9-=:9V376F=DUUIG9-=:9V376F=DUUIG9-=:9V
+M376F=DV=R]+0KJFSJ5U39U.[ILZF=DV=3>V:.IO:-74VM6OJ;&K7U-G4KJFS
+MJ5U39U.[ILZF=DV=C>V:71E>U@:_L?<4?@_L:?F=L'7X[9]U^/W6UP"_NW?N
+MZW>W5?T]GZ^[^$W6+SY?MZF3+P-VRU*TVGU8NO+\5'7.PGWI?"M<;]7N"C<<
+MA5LW-Y,KG'L&]S/!63\L<M&N@\);_XYV!>V2X#0O;]9ZWH.3)[B_/(=[:O?Y
+MNZTJGNJOG*ZX>KHIP0UC^-78QZ?WS34X9_JHR'P4;NJ+P3\G4LSC/ESUQ4/\
+G_X]*OP"N_H#+_^^_X+]G;/];`34"FIU0_7NC++_Z'WN7IO#-7P``
+`
+end
diff --git a/usr.bin/mkimg/tests/mkimg.sh b/usr.bin/mkimg/tests/mkimg.sh
new file mode 100755
index 0000000..8dfb74c
--- /dev/null
+++ b/usr.bin/mkimg/tests/mkimg.sh
@@ -0,0 +1,164 @@
+# $FreeBSD$
+
+mkimg_blksz_list="512 4096"
+mkimg_format_list="qcow qcow2 raw vhd vhdf vmdk"
+mkimg_geom_list="1x1 63x255"
+mkimg_scheme_list="apm bsd ebr gpt mbr pc98 vtoc8"
+
+bootcode()
+{
+ case $1 in
+ bsd|pc98) echo 8192 ;;
+ gpt|mbr) echo 512 ;;
+ *) echo 0 ;;
+ esac
+ return 0
+}
+
+mkcontents()
+{
+ local byte count name
+
+ byte=$1
+ count=$2
+
+ name=_tmp-$byte-$count.bin
+ jot -b $byte $(($count/2)) > $name
+ echo $name
+ return 0
+}
+
+makeimage()
+{
+ local blksz bootarg bootsz format geom nhds nsecs partarg pfx scheme
+
+ format=$1
+ scheme=$2
+ blksz=$3
+ geom=$4
+ pfx=$5
+ shift 5
+
+ nsecs=${geom%x*}
+ nhds=${geom#*x}
+
+ bootsz=`bootcode $scheme`
+ if test $bootsz -gt 0; then
+ bootarg="-b `mkcontents B $bootsz`"
+ else
+ bootarg=""
+ fi
+
+ partarg=""
+ for P in $*; do
+ partarg="$partarg -p $P"
+ done
+ if test -z "$partarg"; then
+ local swap ufs
+ swap="-p freebsd-swap::128K"
+ ufs="-p freebsd-ufs:=`mkcontents P 4194304`"
+ partarg="$ufs $swap"
+ fi
+
+ imagename=$pfx-$geom-$blksz-$scheme.$format
+
+ mkimg -y -f $format -o $imagename -s $scheme -P $blksz -H $nhds -T $nsecs \
+ $bootarg $partarg
+ echo $imagename
+ return 0
+}
+
+mkimg_rebase()
+{
+ local baseline image result tmpfile update
+
+ image=$1
+ result=$2
+
+ baseline=$image.gz.uu
+ update=yes
+
+ if test -f $baseline; then
+ tmpfile=_tmp-baseline
+ uudecode -p $baseline | gunzip -c > $tmpfile
+ if cmp -s $tmpfile $result; then
+ update=no
+ fi
+ fi
+
+ if test $update = yes; then
+ # Prevent keyword expansion when writing the keyword.
+ (echo -n '# $'; echo -n FreeBSD; echo '$') > $baseline
+ gzip -c $result | uuencode $image.gz >> $baseline
+ fi
+
+ rm $image $result _tmp-*
+ return 0
+}
+
+mkimg_test()
+{
+ local blksz format geom scheme
+
+ geom=$1
+ blksz=$2
+ scheme=$3
+ format=$4
+
+ case $scheme in
+ ebr|mbr|pc98)
+ bsd=`makeimage raw bsd $blksz $geom _tmp`
+ partinfo="freebsd:=$bsd"
+ ;;
+ *)
+ partinfo=""
+ ;;
+ esac
+ image=`makeimage $format $scheme $blksz $geom img $partinfo`
+ result=$image.out
+ hexdump -C $image > $result
+ if test "x$mkimg_update_baseline" = "xyes"; then
+ mkimg_rebase $image $result
+ else
+ baseline=`atf_get_srcdir`/$image
+ atf_check -s exit:0 cmp -s $baseline $result
+ fi
+ return 0
+}
+
+atf_test_case rebase
+rebase_body()
+{
+ local nm
+
+ mkimg_update_baseline=yes
+ for nm in $mkimg_tests; do
+ ${nm}_body
+ done
+ return 0
+}
+
+atf_init_test_cases()
+{
+ local B F G S nm
+
+ for G in $mkimg_geom_list; do
+ for B in $mkimg_blksz_list; do
+ for S in $mkimg_scheme_list; do
+ for F in $mkimg_format_list; do
+ nm="${S}_${G}_${B}_${F}"
+ atf_test_case $nm
+ eval "${nm}_body() { mkimg_test $G $B $S $F; }"
+ mkimg_tests="${mkimg_tests} ${nm}"
+ atf_add_test_case $nm
+ done
+ done
+ done
+ done
+
+ # XXX hack to make updating the baseline easier
+ if test "${__RUNNING_INSIDE_ATF_RUN}" != "internal-yes-value"; then
+ atf_add_test_case rebase
+ fi
+}
+
diff --git a/usr.bin/mkimg/vhd.c b/usr.bin/mkimg/vhd.c
new file mode 100644
index 0000000..c4c1d1d
--- /dev/null
+++ b/usr.bin/mkimg/vhd.c
@@ -0,0 +1,432 @@
+/*-
+ * Copyright (c) 2014, 2015 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_geom {
+ uint16_t cylinders;
+ uint8_t heads;
+ uint8_t sectors;
+};
+
+struct vhd_footer {
+ uint64_t cookie;
+#define VHD_FOOTER_COOKIE 0x636f6e6563746978ULL
+ 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 0x00020000
+ uint32_t creator_os;
+#define VHD_CREATOR_OS 0x5769326b /* Wi2k */
+ uint64_t original_size;
+ uint64_t current_size;
+ struct vhd_geom geometry;
+ 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(uint64_t image_size, struct vhd_geom *geom)
+{
+ lba_t imgsz;
+ long cth;
+
+ imgsz = image_size / VHD_SECTOR_SIZE;
+
+ /* Respect command line options if possible. */
+ if (nheads > 1 && nheads < 256 &&
+ nsecs > 1 && nsecs < 256 &&
+ ncyls < 65536) {
+ geom->cylinders = (ncyls != 0) ? ncyls :
+ imgsz / (nheads * nsecs);
+ geom->heads = nheads;
+ geom->sectors = nsecs;
+ return;
+ }
+
+ if (imgsz > 65536 * 16 * 255)
+ imgsz = 65536 * 16 * 255;
+ if (imgsz >= 65535 * 16 * 63) {
+ geom->cylinders = imgsz / (16 * 255);
+ geom->heads = 16;
+ geom->sectors = 255;
+ return;
+ }
+ geom->sectors = 17;
+ cth = imgsz / 17;
+ geom->heads = (cth + 1023) / 1024;
+ if (geom->heads < 4)
+ geom->heads = 4;
+ if (cth >= (geom->heads * 1024) || geom->heads > 16) {
+ geom->heads = 16;
+ geom->sectors = 31;
+ cth = imgsz / 31;
+ }
+ if (cth >= (geom->heads * 1024)) {
+ geom->heads = 16;
+ geom->sectors = 63;
+ cth = imgsz / 63;
+ }
+ geom->cylinders = cth / geom->heads;
+}
+
+static uint64_t
+vhd_resize(uint64_t origsz)
+{
+ struct vhd_geom geom;
+ uint64_t newsz;
+
+ /*
+ * Round the image size to the pre-determined geometry that
+ * matches the image size. This circular dependency implies
+ * that we need to loop to handle boundary conditions.
+ * The first time, newsz equals origsz and the geometry will
+ * typically yield a new size that's smaller. We keep adding
+ * cylinder's worth of sectors to the new size until its
+ * larger or equal or origsz. But during those iterations,
+ * the geometry can change, so we need to account for that.
+ */
+ newsz = origsz;
+ while (1) {
+ vhd_geometry(newsz, &geom);
+ newsz = (int64_t)geom.cylinders * geom.heads *
+ geom.sectors * VHD_SECTOR_SIZE;
+ if (newsz >= origsz)
+ break;
+ newsz += geom.heads * geom.sectors * VHD_SECTOR_SIZE;
+ }
+ return (newsz);
+}
+
+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(image_size, &footer->geometry);
+ be16enc(&footer->geometry.cylinders, footer->geometry.cylinders);
+ be32enc(&footer->disk_type, disk_type);
+ mkimg_uuid(&id);
+ vhd_uuid_enc(&footer->id, &id);
+ be32enc(&footer->checksum, vhd_checksum(footer, sizeof(*footer)));
+}
+
+/*
+ * 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 0x6378737061727365ULL
+ 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_resize(lba_t imgsz)
+{
+ uint64_t imagesz;
+
+ imagesz = vhd_resize(imgsz * secsz);
+ return (image_set_size(imagesz / secsz));
+}
+
+static int
+vhd_dyn_write(int fd)
+{
+ struct vhd_footer footer;
+ struct vhd_dyn_header header;
+ uint64_t imgsz, rawsz;
+ lba_t blk, blkcnt, nblks;
+ uint32_t *bat;
+ void *bitmap;
+ size_t batsz;
+ uint32_t sector;
+ int bat_entries, error, entry;
+
+ rawsz = image_get_size() * secsz;
+ imgsz = (rawsz + VHD_BLOCK_SIZE - 1) & ~(VHD_BLOCK_SIZE - 1);
+
+ vhd_make_footer(&footer, rawsz, VHD_DISK_TYPE_DYNAMIC, sizeof(footer));
+ if (sparse_write(fd, &footer, sizeof(footer)) < 0)
+ return (errno);
+
+ bat_entries = imgsz / VHD_BLOCK_SIZE;
+ 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 = rawsz / secsz;
+ while (blk < nblks) {
+ if (!image_data(blk, blkcnt)) {
+ blk += blkcnt;
+ continue;
+ }
+ if (sparse_write(fd, bitmap, VHD_SECTOR_SIZE) < 0) {
+ error = errno;
+ break;
+ }
+ /* Handle partial last block */
+ if (blk + blkcnt > nblks)
+ blkcnt = nblks - blk;
+ error = image_copyout_region(fd, blk, blkcnt);
+ if (error)
+ break;
+ blk += blkcnt;
+ }
+ free(bitmap);
+ if (error)
+ return (error);
+ error = image_copyout_zeroes(fd, imgsz - rawsz);
+ if (error)
+ 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_dyn_resize,
+ .write = vhd_dyn_write,
+};
+
+FORMAT_DEFINE(vhd_dyn_format);
+
+/*
+ * PART 3: Fixed VHD
+ */
+
+static int
+vhd_fix_resize(lba_t imgsz)
+{
+ uint64_t imagesz;
+
+ imagesz = vhd_resize(imgsz * secsz);
+ /*
+ * Azure demands that images are a whole number of megabytes.
+ */
+ imagesz = (imagesz + 0xfffffULL) & ~0xfffffULL;
+ return (image_set_size(imagesz / secsz));
+}
+
+static int
+vhd_fix_write(int fd)
+{
+ struct vhd_footer footer;
+ uint64_t imagesz;
+ int error;
+
+ error = image_copyout(fd);
+ if (error)
+ return (error);
+
+ imagesz = image_get_size() * secsz;
+ vhd_make_footer(&footer, imagesz, VHD_DISK_TYPE_FIXED, ~0ULL);
+ error = (sparse_write(fd, &footer, sizeof(footer)) < 0) ? errno : 0;
+ return (error);
+}
+
+static struct mkimg_format vhd_fix_format = {
+ .name = "vhdf",
+ .description = "Fixed Virtual Hard Disk",
+ .resize = vhd_fix_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..a07d0b8
--- /dev/null
+++ b/usr.bin/mkimg/vmdk.c
@@ -0,0 +1,261 @@
+/*-
+ * 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, *rgd;
+ 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;
+
+ 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);
+ }
+ le64enc(&hdr.gd_offset, sec);
+ sec += gdsz / VMDK_SECTOR_SIZE;
+ for (n = 0; n < ngts; n++) {
+ le32enc(gd + n, sec);
+ sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE;
+ }
+
+ rgd = calloc(gdsz, 1);
+ if (rgd == NULL) {
+ free(gd);
+ free(desc);
+ return (ENOMEM);
+ }
+ le64enc(&hdr.rgd_offset, sec);
+ sec += gdsz / VMDK_SECTOR_SIZE;
+ for (n = 0; n < ngts; n++) {
+ le32enc(rgd + 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(rgd);
+ 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;
+ if (!error && sparse_write(fd, rgd, gdsz) < 0)
+ error = errno;
+ if (!error && sparse_write(fd, gt, gtsz) < 0)
+ error = errno;
+ free(gt);
+ free(rgd);
+ free(gd);
+ free(desc);
+ if (error)
+ return (error);
+
+ cur = VMDK_SECTOR_SIZE + desc_len + (gdsz + gtsz) * 2;
+ 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
new file mode 100644
index 0000000..2f5cf0f
--- /dev/null
+++ b/usr.bin/mkimg/vtoc8.c
@@ -0,0 +1,118 @@
+/*-
+ * 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 <sys/vtoc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+#include "scheme.h"
+
+#ifndef VTOC_TAG_FREEBSD_NANDFS
+#define VTOC_TAG_FREEBSD_NANDFS 0x0905
+#endif
+
+static struct mkimg_alias vtoc8_aliases[] = {
+ { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_NANDFS) },
+ { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_SWAP) },
+ { ALIAS_FREEBSD_UFS, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_UFS) },
+ { ALIAS_FREEBSD_VINUM, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_VINUM) },
+ { ALIAS_FREEBSD_ZFS, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_NANDFS) },
+ { ALIAS_NONE, 0 }
+};
+
+static lba_t
+vtoc8_metadata(u_int where, lba_t blk)
+{
+
+ blk += (where == SCHEME_META_IMG_START) ? 1 : 0;
+ return (round_cylinder(blk));
+}
+
+static int
+vtoc8_write(lba_t imgsz, void *bootcode __unused)
+{
+ struct vtoc8 vtoc8;
+ struct part *part;
+ u_char *p;
+ int error, n;
+ uint16_t ofs, sum;
+
+ imgsz = (lba_t)ncyls * nheads * nsecs;
+
+ memset(&vtoc8, 0, sizeof(vtoc8));
+ sprintf(vtoc8.ascii, "FreeBSD%lldM",
+ (long long)(imgsz * secsz / 1048576));
+ be32enc(&vtoc8.version, VTOC_VERSION);
+ be16enc(&vtoc8.nparts, VTOC8_NPARTS);
+ be32enc(&vtoc8.sanity, VTOC_SANITY);
+ be16enc(&vtoc8.rpm, 3600);
+ be16enc(&vtoc8.physcyls, ncyls);
+ be16enc(&vtoc8.ncyls, ncyls);
+ be16enc(&vtoc8.altcyls, 0);
+ be16enc(&vtoc8.nheads, nheads);
+ be16enc(&vtoc8.nsecs, nsecs);
+ be16enc(&vtoc8.magic, VTOC_MAGIC);
+
+ be32enc(&vtoc8.map[VTOC_RAW_PART].nblks, imgsz);
+ STAILQ_FOREACH(part, &partlist, link) {
+ n = part->index + ((part->index >= VTOC_RAW_PART) ? 1 : 0);
+ be16enc(&vtoc8.part[n].tag, ALIAS_TYPE2INT(part->type));
+ be32enc(&vtoc8.map[n].cyl, part->block / (nsecs * nheads));
+ be32enc(&vtoc8.map[n].nblks, part->size);
+ }
+
+ /* Calculate checksum. */
+ sum = 0;
+ p = (void *)&vtoc8;
+ for (ofs = 0; ofs < sizeof(vtoc8) - 2; ofs += 2)
+ sum ^= be16dec(p + ofs);
+ be16enc(&vtoc8.cksum, sum);
+
+ error = image_write(0, &vtoc8, 1);
+ return (error);
+}
+
+static struct mkimg_scheme vtoc8_scheme = {
+ .name = "vtoc8",
+ .description = "SMI VTOC8 disk labels",
+ .aliases = vtoc8_aliases,
+ .metadata = vtoc8_metadata,
+ .write = vtoc8_write,
+ .nparts = VTOC8_NPARTS - 1,
+ .maxsecsz = 512
+};
+
+SCHEME_DEFINE(vtoc8_scheme);
diff --git a/usr.bin/mklocale/Makefile b/usr.bin/mklocale/Makefile
new file mode 100644
index 0000000..83850c4
--- /dev/null
+++ b/usr.bin/mklocale/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 6/7/93
+# $FreeBSD$
+
+PROG= mklocale
+SRCS= yacc.y lex.l y.tab.h
+CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale
+
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mklocale/Makefile.depend b/usr.bin/mklocale/Makefile.depend
new file mode 100644
index 0000000..75e2766
--- /dev/null
+++ b/usr.bin/mklocale/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mklocale/extern.h b/usr.bin/mklocale/extern.h
new file mode 100644
index 0000000..60268cc
--- /dev/null
+++ b/usr.bin/mklocale/extern.h
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+int yylex(void);
diff --git a/usr.bin/mklocale/ldef.h b/usr.bin/mklocale/ldef.h
new file mode 100644
index 0000000..392252f
--- /dev/null
+++ b/usr.bin/mklocale/ldef.h
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * 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.
+ *
+ * @(#)ldef.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include "runefile.h"
+
+/*
+ * This should look a LOT like a _RuneEntry
+ */
+typedef struct rune_list {
+ int32_t min;
+ int32_t max;
+ int32_t map;
+ uint32_t *types;
+ struct rune_list *next;
+} rune_list;
+
+typedef struct rune_map {
+ uint32_t map[_CACHED_RUNES];
+ rune_list *root;
+} rune_map;
diff --git a/usr.bin/mklocale/lex.l b/usr.bin/mklocale/lex.l
new file mode 100644
index 0000000..08fa54a
--- /dev/null
+++ b/usr.bin/mklocale/lex.l
@@ -0,0 +1,175 @@
+%{
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ldef.h"
+#include "y.tab.h"
+#include "extern.h"
+
+#define YY_DECL int yylex(void)
+%}
+
+ODIGIT [0-7]
+DIGIT [0-9]
+XDIGIT [0-9a-fA-F]
+W [\t\n\r ]
+
+%%
+\'.\' { yylval.rune = (unsigned char)yytext[1];
+ return(RUNE); }
+
+'\\a' { yylval.rune = '\a';
+ return(RUNE); }
+'\\b' { yylval.rune = '\b';
+ return(RUNE); }
+'\\f' { yylval.rune = '\f';
+ return(RUNE); }
+'\\n' { yylval.rune = '\n';
+ return(RUNE); }
+'\\r' { yylval.rune = '\r';
+ return(RUNE); }
+'\\t' { yylval.rune = '\t';
+ return(RUNE); }
+'\\v' { yylval.rune = '\v';
+ return(RUNE); }
+
+0x{XDIGIT}+ { yylval.rune = strtol(yytext, 0, 16);
+ return(RUNE); }
+0{ODIGIT}+ { yylval.rune = strtol(yytext, 0, 8);
+ return(RUNE); }
+{DIGIT}+ { yylval.rune = strtol(yytext, 0, 10);
+ return(RUNE); }
+
+
+MAPLOWER { return(MAPLOWER); }
+MAPUPPER { return(MAPUPPER); }
+TODIGIT { return(DIGITMAP); }
+INVALID { return(INVALID); }
+
+ALPHA { yylval.i = _CTYPE_A|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+CONTROL { yylval.i = _CTYPE_C;
+ return(LIST); }
+DIGIT { yylval.i = _CTYPE_D|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+GRAPH { yylval.i = _CTYPE_G|_CTYPE_R;
+ return(LIST); }
+LOWER { yylval.i = _CTYPE_L|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+PUNCT { yylval.i = _CTYPE_P|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+SPACE { yylval.i = _CTYPE_S;
+ return(LIST); }
+UPPER { yylval.i = _CTYPE_U|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+XDIGIT { yylval.i = _CTYPE_X|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+BLANK { yylval.i = _CTYPE_B;
+ return(LIST); }
+PRINT { yylval.i = _CTYPE_R;
+ return(LIST); }
+IDEOGRAM { yylval.i = _CTYPE_I|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+SPECIAL { yylval.i = _CTYPE_T|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+PHONOGRAM { yylval.i = _CTYPE_Q|_CTYPE_R|_CTYPE_G;
+ return(LIST); }
+SWIDTH0 { yylval.i = _CTYPE_SW0; return(LIST); }
+SWIDTH1 { yylval.i = _CTYPE_SW1; return(LIST); }
+SWIDTH2 { yylval.i = _CTYPE_SW2; return(LIST); }
+SWIDTH3 { yylval.i = _CTYPE_SW3; return(LIST); }
+
+VARIABLE[\t ] { static char vbuf[1024];
+ char *v = vbuf;
+ while ((*v = input()) && *v != '\n')
+ ++v;
+ if (*v) {
+ unput(*v);
+ *v = 0;
+ }
+ yylval.str = vbuf;
+ return(VARIABLE);
+ }
+
+ENCODING { return(ENCODING); }
+
+\".*\" { char *e = yytext + 1;
+ yylval.str = e;
+ while (*e && *e != '"')
+ ++e;
+ *e = 0;
+ return(STRING); }
+
+\<|\(|\[ { return(LBRK); }
+
+\>|\)|\] { return(RBRK); }
+
+\- { return(THRU); }
+\.\.\. { return(THRU); }
+
+\: { return(':'); }
+
+{W}+ ;
+
+^\#.*\n ;
+\/\* { char lc = 0;
+ do {
+ while ((lc) != '*')
+ if ((lc = input()) == 0)
+ break;
+ } while((lc = input()) != '/');
+ }
+
+\\$ ;
+. { printf("Lex is skipping '%s'\n", yytext); }
+%%
+
+#if !defined(yywrap)
+int
+yywrap(void)
+{
+ return(1);
+}
+#endif
diff --git a/usr.bin/mklocale/mklocale.1 b/usr.bin/mklocale/mklocale.1
new file mode 100644
index 0000000..10872ed
--- /dev/null
+++ b/usr.bin/mklocale/mklocale.1
@@ -0,0 +1,311 @@
+.\" Copyright (c) 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Paul Borman at Krystal Technologies.
+.\"
+.\" 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.
+.\"
+.\" @(#)mklocale.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd April 18, 2016
+.Dt MKLOCALE 1
+.Os
+.Sh NAME
+.Nm mklocale
+.Nd make LC_CTYPE locale files
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Ar "< src-file"
+.Ar "> language/LC_CTYPE"
+.Nm
+.Op Fl d
+.Fl o
+.Ar language/LC_CTYPE
+.Ar src-file
+.Sh DESCRIPTION
+The
+.Nm
+utility reads a
+.Dv LC_CTYPE
+source file from standard input and produces a
+.Dv LC_CTYPE
+binary file on standard output suitable for placement in
+.Pa /usr/share/locale/ Ns Ar language Ns Pa /LC_CTYPE .
+.Pp
+The format of
+.Ar src-file
+is quite simple.
+It consists of a series of lines which start with a keyword and have
+associated data following.
+C style comments are used
+to place comments in the file.
+.Pp
+Following options are available:
+.Bl -tag -width indent
+.It Fl d
+Turns on debugging messages.
+.It Fl o
+Specify output file.
+.El
+.Pp
+Besides the keywords which will be listed below,
+the following are valid tokens in
+.Ar src-file :
+.Bl -tag -width ".Ar literal"
+.It Dv RUNE
+A
+.Dv RUNE
+may be any of the following:
+.Bl -tag -width ".Ar 0x[0-9a-z]*"
+.It Ar 'x'
+The ASCII character
+.Ar x .
+.It Ar '\ex'
+The ANSI C character
+.Ar \ex
+where
+.Ar \ex
+is one of
+.Dv \ea ,
+.Dv \eb ,
+.Dv \ef ,
+.Dv \en ,
+.Dv \er ,
+.Dv \et ,
+or
+.Dv \ev .
+.It Ar 0x[0-9a-z]*
+A hexadecimal number representing a rune code.
+.It Ar 0[0-7]*
+An octal number representing a rune code.
+.It Ar [1-9][0-9]*
+A decimal number representing a rune code.
+.El
+.It Dv STRING
+A string enclosed in double quotes (").
+.It Dv THRU
+Either
+.Dv ...
+or
+.Dv - .
+Used to indicate ranges.
+.It Ar literal
+The follow characters are taken literally:
+.Bl -tag -width ".Dv <\|\|(\|\|["
+.It Dv "<\|(\|["
+Used to start a mapping.
+All are equivalent.
+.It Dv ">\|\^)\|]"
+Used to end a mapping.
+All are equivalent.
+.It Dv ":"
+Used as a delimiter in mappings.
+.El
+.El
+.Pp
+Key words which should only appear once are:
+.Bl -tag -width ".Dv PHONOGRAM"
+.It Dv ENCODING
+Followed by a
+.Dv STRING
+which indicates the encoding mechanism to be used for this locale.
+The current encodings are:
+.Bl -tag -width ".Dv MSKanji"
+.It Dv ASCII
+American Standard Code for Information Interchange.
+.It Dv BIG5
+The
+.Dq Big5
+encoding of Chinese.
+.It Dv EUC
+.Dv EUC
+encoding as used by several
+vendors of
+.Ux
+systems.
+.It Dv GB18030
+PRC national standard for encoding of Chinese text.
+.It Dv GB2312
+Older PRC national standard for encoding Chinese text.
+.It Dv GBK
+A widely used encoding method for Chinese text,
+backwards compatible with GB\ 2312-1980.
+.It Dv MSKanji
+The method of encoding Japanese used by Microsoft,
+loosely based on JIS.
+Also known as
+.Dq "Shift JIS"
+and
+.Dq SJIS .
+.It Dv NONE
+No translation and the default.
+.It Dv UTF-8
+The
+.Dv UTF-8
+transformation format of
+.Tn ISO
+10646
+as defined by RFC 2279.
+.El
+.It Dv VARIABLE
+This keyword must be followed by a single tab or space character,
+after which encoding specific data is placed.
+Currently only the
+.Dv "EUC"
+encoding requires variable data.
+See
+.Xr euc 5
+for further details.
+.It Dv INVALID
+(obsolete)
+A single
+.Dv RUNE
+follows and is used as the invalid rune for this locale.
+.El
+.Pp
+The following keywords may appear multiple times and have the following
+format for data:
+.Bl -tag -width ".Dv <RUNE1 THRU RUNEn : RUNE2>" -offset indent
+.It Dv <RUNE1 RUNE2>
+.Dv RUNE1
+is mapped to
+.Dv RUNE2 .
+.It Dv <RUNE1 THRU RUNEn : RUNE2>
+Runes
+.Dv RUNE1
+through
+.Dv RUNEn
+are mapped to
+.Dv RUNE2
+through
+.Dv RUNE2
++ n-1.
+.El
+.Bl -tag -width ".Dv PHONOGRAM"
+.It Dv MAPLOWER
+Defines the tolower mappings.
+.Dv RUNE2
+is the lower case representation of
+.Dv RUNE1 .
+.It Dv MAPUPPER
+Defines the toupper mappings.
+.Dv RUNE2
+is the upper case representation of
+.Dv RUNE1 .
+.It Dv TODIGIT
+Defines a map from runes to their digit value.
+.Dv RUNE2
+is the integer value represented by
+.Dv RUNE1 .
+For example, the ASCII character
+.Ql 0
+would map to the decimal value 0.
+Only values up to 255
+are allowed.
+.El
+.Pp
+The following keywords may appear multiple times and have the following
+format for data:
+.Bl -tag -width ".Dv RUNE1 THRU RUNEn" -offset indent
+.It Dv RUNE
+This rune has the property defined by the keyword.
+.It Dv "RUNE1 THRU RUNEn"
+All the runes between and including
+.Dv RUNE1
+and
+.Dv RUNEn
+have the property defined by the keyword.
+.El
+.Bl -tag -width ".Dv PHONOGRAM"
+.It Dv ALPHA
+Defines runes which are alphabetic, printable and graphic.
+.It Dv CONTROL
+Defines runes which are control characters.
+.It Dv DIGIT
+Defines runes which are decimal digits, printable and graphic.
+.It Dv GRAPH
+Defines runes which are graphic and printable.
+.It Dv LOWER
+Defines runes which are lower case, printable and graphic.
+.It Dv PUNCT
+Defines runes which are punctuation, printable and graphic.
+.It Dv SPACE
+Defines runes which are spaces.
+.It Dv UPPER
+Defines runes which are upper case, printable and graphic.
+.It Dv XDIGIT
+Defines runes which are hexadecimal digits, printable and graphic.
+.It Dv BLANK
+Defines runes which are blank.
+.It Dv PRINT
+Defines runes which are printable.
+.It Dv IDEOGRAM
+Defines runes which are ideograms, printable and graphic.
+.It Dv SPECIAL
+Defines runes which are special characters, printable and graphic.
+.It Dv PHONOGRAM
+Defines runes which are phonograms, printable and graphic.
+.It Dv SWIDTH0
+Defines runes with display width 0.
+.It Dv SWIDTH1
+Defines runes with display width 1.
+.It Dv SWIDTH2
+Defines runes with display width 2.
+.It Dv SWIDTH3
+Defines runes with display width 3.
+.El
+.Pp
+If no display width explicitly defined, width 1 assumed
+for printable runes by default.
+.Sh NOTES
+.Nm
+has been replaced by
+.Xr localedef 1
+in
+.Fx 11.0 .
+.Sh SEE ALSO
+.Xr colldef 1 ,
+.Xr localedef 1 ,
+.Xr setlocale 3 ,
+.Xr wcwidth 3 ,
+.Xr big5 5 ,
+.Xr euc 5 ,
+.Xr gb18030 5 ,
+.Xr gb2312 5 ,
+.Xr gbk 5 ,
+.Xr mskanji 5 ,
+.Xr utf8 5
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.4 .
+.Sh BUGS
+The
+.Nm
+utility is overly simplistic.
diff --git a/usr.bin/mklocale/yacc.y b/usr.bin/mklocale/yacc.y
new file mode 100644
index 0000000..01f9f49
--- /dev/null
+++ b/usr.bin/mklocale/yacc.y
@@ -0,0 +1,869 @@
+%{
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * 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
+#if 0
+static char sccsid[] = "@(#)yacc.y 8.1 (Berkeley) 6/6/93";
+#endif /* 0 */
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ldef.h"
+#include "extern.h"
+#include "runefile.h"
+
+static void *xmalloc(unsigned int sz);
+static uint32_t *xlalloc(unsigned int sz);
+void yyerror(const char *s);
+static uint32_t *xrelalloc(uint32_t *old, unsigned int sz);
+static void dump_tables(void);
+static void cleanout(void);
+
+const char *locale_file = "<stdout>";
+
+rune_map maplower = { { 0 }, NULL };
+rune_map mapupper = { { 0 }, NULL };
+rune_map types = { { 0 }, NULL };
+
+_FileRuneLocale new_locale = { "", "", {}, {}, {}, 0, 0, 0, 0 };
+char *variable = NULL;
+
+void set_map(rune_map *, rune_list *, uint32_t);
+void set_digitmap(rune_map *, rune_list *);
+void add_map(rune_map *, rune_list *, uint32_t);
+static void usage(void);
+%}
+
+%union {
+ int32_t rune;
+ int i;
+ char *str;
+
+ rune_list *list;
+}
+
+%token <rune> RUNE
+%token LBRK
+%token RBRK
+%token THRU
+%token MAPLOWER
+%token MAPUPPER
+%token DIGITMAP
+%token <i> LIST
+%token <str> VARIABLE
+%token ENCODING
+%token INVALID
+%token <str> STRING
+
+%type <list> list
+%type <list> map
+
+
+%%
+
+locale : /* empty */
+ | table
+ { dump_tables(); }
+ ;
+
+table : entry
+ | table entry
+ ;
+
+entry : ENCODING STRING
+ { if (strcmp($2, "NONE") &&
+ strcmp($2, "ASCII") &&
+ strcmp($2, "UTF-8") &&
+ strcmp($2, "EUC") &&
+ strcmp($2, "GBK") &&
+ strcmp($2, "GB18030") &&
+ strcmp($2, "GB2312") &&
+ strcmp($2, "BIG5") &&
+ strcmp($2, "MSKanji"))
+ warnx("ENCODING %s is not supported by libc", $2);
+ strlcpy(new_locale.encoding, $2,
+ sizeof(new_locale.encoding)); }
+ | VARIABLE
+ { new_locale.variable_len = strlen($1) + 1;
+ variable = xmalloc(new_locale.variable_len);
+ strcpy(variable, $1);
+ }
+ | INVALID RUNE
+ { warnx("the INVALID keyword is deprecated"); }
+ | LIST list
+ { set_map(&types, $2, $1); }
+ | MAPLOWER map
+ { set_map(&maplower, $2, 0); }
+ | MAPUPPER map
+ { set_map(&mapupper, $2, 0); }
+ | DIGITMAP map
+ { set_digitmap(&types, $2); }
+ ;
+
+list : RUNE
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $1;
+ $$->max = $1;
+ $$->next = 0;
+ }
+ | RUNE THRU RUNE
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $1;
+ $$->max = $3;
+ $$->next = 0;
+ }
+ | list RUNE
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $2;
+ $$->max = $2;
+ $$->next = $1;
+ }
+ | list RUNE THRU RUNE
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $2;
+ $$->max = $4;
+ $$->next = $1;
+ }
+ ;
+
+map : LBRK RUNE RUNE RBRK
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $2;
+ $$->max = $2;
+ $$->map = $3;
+ $$->next = 0;
+ }
+ | map LBRK RUNE RUNE RBRK
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $3;
+ $$->max = $3;
+ $$->map = $4;
+ $$->next = $1;
+ }
+ | LBRK RUNE THRU RUNE ':' RUNE RBRK
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $2;
+ $$->max = $4;
+ $$->map = $6;
+ $$->next = 0;
+ }
+ | map LBRK RUNE THRU RUNE ':' RUNE RBRK
+ {
+ $$ = (rune_list *)xmalloc(sizeof(rune_list));
+ $$->min = $3;
+ $$->max = $5;
+ $$->map = $7;
+ $$->next = $1;
+ }
+ ;
+%%
+
+int debug;
+FILE *fp;
+
+static void
+cleanout(void)
+{
+ if (fp != NULL)
+ unlink(locale_file);
+}
+
+int
+main(int ac, char *av[])
+{
+ int x;
+
+ fp = stdout;
+
+ while ((x = getopt(ac, av, "do:")) != -1) {
+ switch(x) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'o':
+ locale_file = optarg;
+ if ((fp = fopen(locale_file, "w")) == NULL)
+ err(1, "%s", locale_file);
+ atexit(cleanout);
+ break;
+ default:
+ usage();
+ }
+ }
+
+ switch (ac - optind) {
+ case 0:
+ break;
+ case 1:
+ if (freopen(av[optind], "r", stdin) == 0)
+ err(1, "%s", av[optind]);
+ break;
+ default:
+ usage();
+ }
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ mapupper.map[x] = x;
+ maplower.map[x] = x;
+ }
+ memcpy(new_locale.magic, _FILE_RUNE_MAGIC_1, sizeof(new_locale.magic));
+
+ yyparse();
+
+ return(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: mklocale [-d] [-o output] [source]\n");
+ exit(1);
+}
+
+void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+static void *
+xmalloc(unsigned int sz)
+{
+ void *r = malloc(sz);
+ if (!r)
+ errx(1, "xmalloc");
+ return(r);
+}
+
+static uint32_t *
+xlalloc(unsigned int sz)
+{
+ uint32_t *r = (uint32_t *)malloc(sz * sizeof(uint32_t));
+ if (!r)
+ errx(1, "xlalloc");
+ return(r);
+}
+
+static uint32_t *
+xrelalloc(uint32_t *old, unsigned int sz)
+{
+ uint32_t *r = (uint32_t *)realloc((char *)old,
+ sz * sizeof(uint32_t));
+ if (!r)
+ errx(1, "xrelalloc");
+ return(r);
+}
+
+void
+set_map(rune_map *map, rune_list *list, uint32_t flag)
+{
+ while (list) {
+ rune_list *nlist = list->next;
+ add_map(map, list, flag);
+ list = nlist;
+ }
+}
+
+void
+set_digitmap(rune_map *map, rune_list *list)
+{
+ int32_t i;
+
+ while (list) {
+ rune_list *nlist = list->next;
+ for (i = list->min; i <= list->max; ++i) {
+ if (list->map + (i - list->min)) {
+ rune_list *tmp = (rune_list *)xmalloc(sizeof(rune_list));
+ tmp->min = i;
+ tmp->max = i;
+ add_map(map, tmp, list->map + (i - list->min));
+ }
+ }
+ free(list);
+ list = nlist;
+ }
+}
+
+void
+add_map(rune_map *map, rune_list *list, uint32_t flag)
+{
+ int32_t i;
+ rune_list *lr = 0;
+ rune_list *r;
+ int32_t run;
+
+ while (list->min < _CACHED_RUNES && list->min <= list->max) {
+ if (flag)
+ map->map[list->min++] |= flag;
+ else
+ map->map[list->min++] = list->map++;
+ }
+
+ if (list->min > list->max) {
+ free(list);
+ return;
+ }
+
+ run = list->max - list->min + 1;
+
+ if (!(r = map->root) || (list->max < r->min - 1)
+ || (!flag && list->max == r->min - 1)) {
+ if (flag) {
+ list->types = xlalloc(run);
+ for (i = 0; i < run; ++i)
+ list->types[i] = flag;
+ }
+ list->next = map->root;
+ map->root = list;
+ return;
+ }
+
+ for (r = map->root; r && r->max + 1 < list->min; r = r->next)
+ lr = r;
+
+ if (!r) {
+ /*
+ * We are off the end.
+ */
+ if (flag) {
+ list->types = xlalloc(run);
+ for (i = 0; i < run; ++i)
+ list->types[i] = flag;
+ }
+ list->next = 0;
+ lr->next = list;
+ return;
+ }
+
+ if (list->max < r->min - 1) {
+ /*
+ * We come before this range and we do not intersect it.
+ * We are not before the root node, it was checked before the loop
+ */
+ if (flag) {
+ list->types = xlalloc(run);
+ for (i = 0; i < run; ++i)
+ list->types[i] = flag;
+ }
+ list->next = lr->next;
+ lr->next = list;
+ return;
+ }
+
+ /*
+ * At this point we have found that we at least intersect with
+ * the range pointed to by `r', we might intersect with one or
+ * more ranges beyond `r' as well.
+ */
+
+ if (!flag && list->map - list->min != r->map - r->min) {
+ /*
+ * There are only two cases when we are doing case maps and
+ * our maps needn't have the same offset. When we are adjoining
+ * but not intersecting.
+ */
+ if (list->max + 1 == r->min) {
+ lr->next = list;
+ list->next = r;
+ return;
+ }
+ if (list->min - 1 == r->max) {
+ list->next = r->next;
+ r->next = list;
+ return;
+ }
+ errx(1, "error: conflicting map entries");
+ }
+
+ if (list->min >= r->min && list->max <= r->max) {
+ /*
+ * Subset case.
+ */
+
+ if (flag) {
+ for (i = list->min; i <= list->max; ++i)
+ r->types[i - r->min] |= flag;
+ }
+ free(list);
+ return;
+ }
+ if (list->min <= r->min && list->max >= r->max) {
+ /*
+ * Superset case. Make him big enough to hold us.
+ * We might need to merge with the guy after him.
+ */
+ if (flag) {
+ list->types = xlalloc(list->max - list->min + 1);
+
+ for (i = list->min; i <= list->max; ++i)
+ list->types[i - list->min] = flag;
+
+ for (i = r->min; i <= r->max; ++i)
+ list->types[i - list->min] |= r->types[i - r->min];
+
+ free(r->types);
+ r->types = list->types;
+ } else {
+ r->map = list->map;
+ }
+ r->min = list->min;
+ r->max = list->max;
+ free(list);
+ } else if (list->min < r->min) {
+ /*
+ * Our tail intersects his head.
+ */
+ if (flag) {
+ list->types = xlalloc(r->max - list->min + 1);
+
+ for (i = r->min; i <= r->max; ++i)
+ list->types[i - list->min] = r->types[i - r->min];
+
+ for (i = list->min; i < r->min; ++i)
+ list->types[i - list->min] = flag;
+
+ for (i = r->min; i <= list->max; ++i)
+ list->types[i - list->min] |= flag;
+
+ free(r->types);
+ r->types = list->types;
+ } else {
+ r->map = list->map;
+ }
+ r->min = list->min;
+ free(list);
+ return;
+ } else {
+ /*
+ * Our head intersects his tail.
+ * We might need to merge with the guy after him.
+ */
+ if (flag) {
+ r->types = xrelalloc(r->types, list->max - r->min + 1);
+
+ for (i = list->min; i <= r->max; ++i)
+ r->types[i - r->min] |= flag;
+
+ for (i = r->max+1; i <= list->max; ++i)
+ r->types[i - r->min] = flag;
+ }
+ r->max = list->max;
+ free(list);
+ }
+
+ /*
+ * Okay, check to see if we grew into the next guy(s)
+ */
+ while ((lr = r->next) && r->max >= lr->min) {
+ if (flag) {
+ if (r->max >= lr->max) {
+ /*
+ * Good, we consumed all of him.
+ */
+ for (i = lr->min; i <= lr->max; ++i)
+ r->types[i - r->min] |= lr->types[i - lr->min];
+ } else {
+ /*
+ * "append" him on to the end of us.
+ */
+ r->types = xrelalloc(r->types, lr->max - r->min + 1);
+
+ for (i = lr->min; i <= r->max; ++i)
+ r->types[i - r->min] |= lr->types[i - lr->min];
+
+ for (i = r->max+1; i <= lr->max; ++i)
+ r->types[i - r->min] = lr->types[i - lr->min];
+
+ r->max = lr->max;
+ }
+ } else {
+ if (lr->max > r->max)
+ r->max = lr->max;
+ }
+
+ r->next = lr->next;
+
+ if (flag)
+ free(lr->types);
+ free(lr);
+ }
+}
+
+static void
+dump_tables(void)
+{
+ int x, first_d, curr_d;
+ rune_list *list;
+
+ /*
+ * See if we can compress some of the istype arrays
+ */
+ for(list = types.root; list; list = list->next) {
+ list->map = list->types[0];
+ for (x = 1; x < list->max - list->min + 1; ++x) {
+ if ((int32_t)list->types[x] != list->map) {
+ list->map = 0;
+ break;
+ }
+ }
+ }
+
+ first_d = curr_d = -1;
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ uint32_t r = types.map[x];
+
+ if (r & _CTYPE_D) {
+ if (first_d < 0)
+ first_d = curr_d = x;
+ else if (x != curr_d + 1)
+ errx(1, "error: DIGIT range is not contiguous");
+ else if (x - first_d > 9)
+ errx(1, "error: DIGIT range is too big");
+ else
+ curr_d++;
+ if (!(r & _CTYPE_X))
+ errx(1,
+ "error: DIGIT range is not a subset of XDIGIT range");
+ }
+ }
+ if (first_d < 0)
+ errx(1, "error: no DIGIT range defined in the single byte area");
+ else if (curr_d - first_d < 9)
+ errx(1, "error: DIGIT range is too small in the single byte area");
+
+ /*
+ * Fill in our tables. Do this in network order so that
+ * diverse machines have a chance of sharing data.
+ * (Machines like Crays cannot share with little machines due to
+ * word size. Sigh. We tried.)
+ */
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ new_locale.runetype[x] = htonl(types.map[x]);
+ new_locale.maplower[x] = htonl(maplower.map[x]);
+ new_locale.mapupper[x] = htonl(mapupper.map[x]);
+ }
+
+ /*
+ * Count up how many ranges we will need for each of the extents.
+ */
+ list = types.root;
+
+ while (list) {
+ new_locale.runetype_ext_nranges++;
+ list = list->next;
+ }
+ new_locale.runetype_ext_nranges =
+ htonl(new_locale.runetype_ext_nranges);
+
+ list = maplower.root;
+
+ while (list) {
+ new_locale.maplower_ext_nranges++;
+ list = list->next;
+ }
+ new_locale.maplower_ext_nranges =
+ htonl(new_locale.maplower_ext_nranges);
+
+ list = mapupper.root;
+
+ while (list) {
+ new_locale.mapupper_ext_nranges++;
+ list = list->next;
+ }
+ new_locale.mapupper_ext_nranges =
+ htonl(new_locale.mapupper_ext_nranges);
+
+ new_locale.variable_len = htonl(new_locale.variable_len);
+
+ /*
+ * Okay, we are now ready to write the new locale file.
+ */
+
+ /*
+ * PART 1: The _FileRuneLocale structure
+ */
+ if (fwrite((char *)&new_locale, sizeof(new_locale), 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+ /*
+ * PART 2: The runetype_ext structures (not the actual tables)
+ */
+ list = types.root;
+
+ while (list) {
+ _FileRuneEntry re;
+
+ re.min = htonl(list->min);
+ re.max = htonl(list->max);
+ re.map = htonl(list->map);
+
+ if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+
+ list = list->next;
+ }
+ /*
+ * PART 3: The maplower_ext structures
+ */
+ list = maplower.root;
+
+ while (list) {
+ _FileRuneEntry re;
+
+ re.min = htonl(list->min);
+ re.max = htonl(list->max);
+ re.map = htonl(list->map);
+
+ if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+
+ list = list->next;
+ }
+ /*
+ * PART 4: The mapupper_ext structures
+ */
+ list = mapupper.root;
+
+ while (list) {
+ _FileRuneEntry re;
+
+ re.min = htonl(list->min);
+ re.max = htonl(list->max);
+ re.map = htonl(list->map);
+
+ if (fwrite((char *)&re, sizeof(re), 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+
+ list = list->next;
+ }
+ /*
+ * PART 5: The runetype_ext tables
+ */
+ list = types.root;
+
+ while (list) {
+ for (x = 0; x < list->max - list->min + 1; ++x)
+ list->types[x] = htonl(list->types[x]);
+
+ if (!list->map) {
+ if (fwrite((char *)list->types,
+ (list->max - list->min + 1) * sizeof(uint32_t),
+ 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+ }
+ list = list->next;
+ }
+ /*
+ * PART 6: And finally the variable data
+ */
+ if (new_locale.variable_len != 0 &&
+ fwrite(variable, ntohl(new_locale.variable_len), 1, fp) != 1) {
+ perror(locale_file);
+ exit(1);
+ }
+ if (fclose(fp) != 0) {
+ perror(locale_file);
+ exit(1);
+ }
+ fp = NULL;
+
+ if (!debug)
+ return;
+
+ if (new_locale.encoding[0])
+ fprintf(stderr, "ENCODING %s\n", new_locale.encoding);
+ if (variable)
+ fprintf(stderr, "VARIABLE %s\n", variable);
+
+ fprintf(stderr, "\nMAPLOWER:\n\n");
+
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ if (isprint(maplower.map[x]))
+ fprintf(stderr, " '%c'", (int)maplower.map[x]);
+ else if (maplower.map[x])
+ fprintf(stderr, "%04x", maplower.map[x]);
+ else
+ fprintf(stderr, "%4x", 0);
+ if ((x & 0xf) == 0xf)
+ fprintf(stderr, "\n");
+ else
+ fprintf(stderr, " ");
+ }
+ fprintf(stderr, "\n");
+
+ for (list = maplower.root; list; list = list->next)
+ fprintf(stderr, "\t%04x - %04x : %04x\n", list->min, list->max, list->map);
+
+ fprintf(stderr, "\nMAPUPPER:\n\n");
+
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ if (isprint(mapupper.map[x]))
+ fprintf(stderr, " '%c'", (int)mapupper.map[x]);
+ else if (mapupper.map[x])
+ fprintf(stderr, "%04x", mapupper.map[x]);
+ else
+ fprintf(stderr, "%4x", 0);
+ if ((x & 0xf) == 0xf)
+ fprintf(stderr, "\n");
+ else
+ fprintf(stderr, " ");
+ }
+ fprintf(stderr, "\n");
+
+ for (list = mapupper.root; list; list = list->next)
+ fprintf(stderr, "\t%04x - %04x : %04x\n", list->min, list->max, list->map);
+
+
+ fprintf(stderr, "\nTYPES:\n\n");
+
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ uint32_t r = types.map[x];
+
+ if (r) {
+ if (isprint(x))
+ fprintf(stderr, " '%c': %2d", x, (int)(r & 0xff));
+ else
+ fprintf(stderr, "%04x: %2d", x, (int)(r & 0xff));
+
+ fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
+ fprintf(stderr, "\n");
+ }
+ }
+
+ for (list = types.root; list; list = list->next) {
+ if (list->map && list->min + 3 < list->max) {
+ uint32_t r = list->map;
+
+ fprintf(stderr, "%04x: %2d",
+ (uint32_t)list->min, (int)(r & 0xff));
+
+ fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
+ fprintf(stderr, "\n...\n");
+
+ fprintf(stderr, "%04x: %2d",
+ (uint32_t)list->max, (int)(r & 0xff));
+
+ fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
+ fprintf(stderr, "\n");
+ } else
+ for (x = list->min; x <= list->max; ++x) {
+ uint32_t r = ntohl(list->types[x - list->min]);
+
+ if (r) {
+ fprintf(stderr, "%04x: %2d", x, (int)(r & 0xff));
+
+ fprintf(stderr, " %4s", (r & _CTYPE_A) ? "alph" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_C) ? "ctrl" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_D) ? "dig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_G) ? "graf" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_L) ? "low" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_P) ? "punc" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_S) ? "spac" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_U) ? "upp" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_X) ? "xdig" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_B) ? "blnk" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_R) ? "prnt" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_I) ? "ideo" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_T) ? "spec" : "");
+ fprintf(stderr, " %4s", (r & _CTYPE_Q) ? "phon" : "");
+ fprintf(stderr, "\n");
+ }
+ }
+ }
+}
diff --git a/usr.bin/mkstr/Makefile b/usr.bin/mkstr/Makefile
new file mode 100644
index 0000000..b4e3620
--- /dev/null
+++ b/usr.bin/mkstr/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= mkstr
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkstr/Makefile.depend b/usr.bin/mkstr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/mkstr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/mkstr/mkstr.1 b/usr.bin/mkstr/mkstr.1
new file mode 100644
index 0000000..09a277e
--- /dev/null
+++ b/usr.bin/mkstr/mkstr.1
@@ -0,0 +1,136 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)mkstr.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt MKSTR 1
+.Os
+.Sh NAME
+.Nm mkstr
+.Nd create an error message file by massaging C source
+.Sh SYNOPSIS
+.Nm
+.Op Fl
+.Ar mesgfile
+.Ar prefix Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility creates a file containing error messages extracted from C source,
+and restructures the same C source, to utilize the created error message
+file.
+The intent of
+.Nm
+was to reduce the size of large programs and
+reduce swapping (see
+.Sx BUGS
+section below).
+.Pp
+The
+.Nm
+utility processes each of the specified files,
+placing a restructured version of the input in a file whose name
+consists of the specified
+.Ar prefix
+and the original name.
+A typical usage of
+.Nm
+is
+.Pp
+.Dl "mkstr pistrings xx *.c"
+.Pp
+This command causes all the error messages from the C source
+files in the current directory to be placed in the file
+.Pa pistrings
+and restructured copies of the sources to be placed in
+files whose names are prefixed with
+.Dq Li xx .
+.Pp
+Options:
+.Bl -tag -width indent
+.It Fl
+Error messages are placed at the end of the specified
+message file for recompiling part of a large
+.Nm Ns ed
+program.
+.El
+.Pp
+The
+.Nm
+utility finds error messages in the source by
+searching for the string
+.Sq Li error("
+in the input stream.
+Each time it occurs, the C string starting at the
+.Ql \&"
+is stored
+in the message file followed by a null character and a new-line character;
+The new source is restructured with
+.Xr lseek 2
+pointers into the error message file for retrieval.
+.Bd -literal -offset indent
+char efilname = "/usr/lib/pi_strings";
+int efil = -1;
+
+error(a1, a2, a3, a4)
+{
+ char buf[256];
+
+ if (efil < 0) {
+ efil = open(efilname, 0);
+ if (efil < 0)
+ err(1, "%s", efilname);
+ }
+ if (lseek(efil, (off_t)a1, SEEK_SET) < 0 ||
+ read(efil, buf, 256) <= 0)
+ err(1, "%s", efilname);
+ printf(buf, a2, a3, a4);
+}
+.Ed
+.Sh SEE ALSO
+.Xr gencat 1 ,
+.Xr xstr 1 ,
+.Xr lseek 2
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 1 .
+.Sh AUTHORS
+.An -nosplit
+.An Bill Joy
+and
+.An Chuck Haley ,
+1977.
+.Sh BUGS
+The
+.Nm
+utility was intended for the limited architecture of the PDP 11 family.
+Very few programs actually use it.
+The memory savings are negligible in modern computers.
diff --git a/usr.bin/mkstr/mkstr.c b/usr.bin/mkstr/mkstr.c
new file mode 100644
index 0000000..2025eff
--- /dev/null
+++ b/usr.bin/mkstr/mkstr.c
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)mkstr.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ungetchar(c) ungetc(c, stdin)
+
+/*
+ * mkstr - create a string error message file by massaging C source
+ *
+ * Bill Joy UCB August 1977
+ *
+ * Modified March 1978 to hash old messages to be able to recompile
+ * without addding messages to the message file (usually)
+ *
+ * Based on an earlier program conceived by Bill Joy and Chuck Haley
+ *
+ * Program to create a string error message file
+ * from a group of C programs. Arguments are the name
+ * of the file where the strings are to be placed, the
+ * prefix of the new files where the processed source text
+ * is to be placed, and the files to be processed.
+ *
+ * The program looks for 'error("' in the source stream.
+ * Whenever it finds this, the following characters from the '"'
+ * to a '"' are replaced by 'seekpt' where seekpt is a
+ * pointer into the error message file.
+ * If the '(' is not immediately followed by a '"' no change occurs.
+ *
+ * The optional '-' causes strings to be added at the end of the
+ * existing error message file for recompilation of single routines.
+ */
+
+static FILE *mesgread, *mesgwrite;
+static char name[100], *np;
+
+void copystr(void);
+int fgetNUL(char *, int, FILE *);
+unsigned hashit(char *, int, unsigned);
+void inithash(void);
+int match(const char *);
+int octdigit(char);
+void process(void);
+void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ char addon = 0;
+ size_t namelen;
+
+ argc--, argv++;
+ if (argc > 1 && argv[0][0] == '-')
+ addon++, argc--, argv++;
+ if (argc < 3)
+ usage();
+ mesgwrite = fopen(argv[0], addon ? "a" : "w");
+ if (mesgwrite == NULL)
+ err(1, "%s", argv[0]);
+ mesgread = fopen(argv[0], "r");
+ if (mesgread == NULL)
+ err(1, "%s", argv[0]);
+ inithash();
+ argc--, argv++;
+ namelen = strlcpy(name, argv[0], sizeof(name));
+ if (namelen >= sizeof(name)) {
+ errno = ENAMETOOLONG;
+ err(1, "%s", argv[0]);
+ }
+ np = name + namelen;
+ argc--, argv++;
+ do {
+ if (strlcpy(np, argv[0], sizeof(name) - namelen) >=
+ sizeof(name) - namelen) {
+ errno = ENAMETOOLONG;
+ err(1, "%s%s", name, argv[0]);
+ }
+ if (freopen(name, "w", stdout) == NULL)
+ err(1, "%s", name);
+ if (freopen(argv[0], "r", stdin) == NULL)
+ err(1, "%s", argv[0]);
+ process();
+ argc--, argv++;
+ } while (argc > 0);
+ exit(0);
+}
+
+void
+usage(void)
+{
+ fprintf(stderr, "usage: mkstr [-] mesgfile prefix file ...\n");
+ exit(1);
+}
+
+void
+process(void)
+{
+ int c;
+
+ for (;;) {
+ c = getchar();
+ if (c == EOF)
+ return;
+ if (c != 'e') {
+ putchar(c);
+ continue;
+ }
+ if (match("error(")) {
+ printf("error(");
+ c = getchar();
+ if (c != '"')
+ putchar(c);
+ else
+ copystr();
+ }
+ }
+}
+
+int
+match(const char *ocp)
+{
+ const char *cp;
+ int c;
+
+ for (cp = ocp + 1; *cp; cp++) {
+ c = getchar();
+ if (c != *cp) {
+ while (ocp < cp)
+ putchar(*ocp++);
+ ungetchar(c);
+ return (0);
+ }
+ }
+ return (1);
+}
+
+void
+copystr(void)
+{
+ int c, ch;
+ char buf[512];
+ char *cp = buf;
+
+ for (;;) {
+ if (cp == buf + sizeof(buf) - 2)
+ errx(1, "message too long");
+ c = getchar();
+ if (c == EOF)
+ break;
+ switch (c) {
+
+ case '"':
+ *cp++ = 0;
+ goto out;
+ case '\\':
+ c = getchar();
+ switch (c) {
+
+ case 'b':
+ c = '\b';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case '\n':
+ continue;
+ case 'f':
+ c = '\f';
+ break;
+ case '0':
+ c = 0;
+ break;
+ case '\\':
+ break;
+ default:
+ if (!octdigit(c))
+ break;
+ c -= '0';
+ ch = getchar();
+ if (!octdigit(ch))
+ break;
+ c <<= 7, c += ch - '0';
+ ch = getchar();
+ if (!octdigit(ch))
+ break;
+ c <<= 3, c+= ch - '0', ch = -1;
+ break;
+ }
+ }
+ *cp++ = c;
+ }
+out:
+ *cp = 0;
+ printf("%d", hashit(buf, 1, 0));
+}
+
+int
+octdigit(char c)
+{
+
+ return (c >= '0' && c <= '7');
+}
+
+void
+inithash(void)
+{
+ char buf[512];
+ int mesgpt = 0;
+
+ rewind(mesgread);
+ while (fgetNUL(buf, sizeof buf, mesgread) != 0) {
+ hashit(buf, 0, mesgpt);
+ mesgpt += strlen(buf) + 2;
+ }
+}
+
+#define NBUCKETS 511
+
+static struct hash {
+ long hval;
+ unsigned hpt;
+ struct hash *hnext;
+} *bucket[NBUCKETS];
+
+unsigned
+hashit(char *str, int really, unsigned fakept)
+{
+ int i;
+ struct hash *hp;
+ char buf[512];
+ long hashval = 0;
+ char *cp;
+
+ if (really)
+ fflush(mesgwrite);
+ for (cp = str; *cp;)
+ hashval = (hashval << 1) + *cp++;
+ i = hashval % NBUCKETS;
+ if (i < 0)
+ i += NBUCKETS;
+ if (really != 0)
+ for (hp = bucket[i]; hp != 0; hp = hp->hnext)
+ if (hp->hval == hashval) {
+ fseek(mesgread, (long) hp->hpt, 0);
+ fgetNUL(buf, sizeof buf, mesgread);
+/*
+ fprintf(stderr, "Got (from %d) %s\n", hp->hpt, buf);
+*/
+ if (strcmp(buf, str) == 0)
+ break;
+ }
+ if (!really || hp == 0) {
+ hp = (struct hash *) calloc(1, sizeof *hp);
+ if (hp == NULL)
+ err(1, NULL);
+ hp->hnext = bucket[i];
+ hp->hval = hashval;
+ hp->hpt = really ? ftell(mesgwrite) : fakept;
+ if (really) {
+ fwrite(str, sizeof (char), strlen(str) + 1, mesgwrite);
+ fwrite("\n", sizeof (char), 1, mesgwrite);
+ }
+ bucket[i] = hp;
+ }
+/*
+ fprintf(stderr, "%s hashed to %ld at %d\n", str, hp->hval, hp->hpt);
+*/
+ return (hp->hpt);
+}
+
+int
+fgetNUL(char *obuf, int rmdr, FILE *file)
+{
+ int c;
+ char *buf = obuf;
+
+ while (--rmdr > 0 && (c = getc(file)) != 0 && c != EOF)
+ *buf++ = c;
+ *buf++ = 0;
+ getc(file);
+ return ((feof(file) || ferror(file)) ? 0 : 1);
+}
diff --git a/usr.bin/mktemp/Makefile b/usr.bin/mktemp/Makefile
new file mode 100644
index 0000000..76ebee6
--- /dev/null
+++ b/usr.bin/mktemp/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= mktemp
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mktemp/Makefile.depend b/usr.bin/mktemp/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/mktemp/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
new file mode 100644
index 0000000..3a38f84
--- /dev/null
+++ b/usr.bin/mktemp/mktemp.1
@@ -0,0 +1,207 @@
+.\" Copyright (c) 1989, 1991, 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.
+.\"
+.\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $
+.\" $FreeBSD$
+.\"
+.Dd December 30, 2005
+.Dt MKTEMP 1
+.Os
+.Sh NAME
+.Nm mktemp
+.Nd make temporary file name (unique)
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Op Fl q
+.Op Fl t Ar prefix
+.Op Fl u
+.Ar template ...
+.Nm
+.Op Fl d
+.Op Fl q
+.Op Fl u
+.Fl t Ar prefix
+.Sh DESCRIPTION
+The
+.Nm
+utility takes each of the given file name templates and overwrites a
+portion of it to create a file name.
+This file name is unique
+and suitable for use by the application.
+The template may be
+any file name with some number of
+.Ql X Ns s
+appended
+to it, for example
+.Pa /tmp/temp.XXXX .
+The trailing
+.Ql X Ns s
+are replaced with the current process number and/or a
+unique letter combination.
+The number of unique file names
+.Nm
+can return depends on the number of
+.Ql X Ns s
+provided; six
+.Ql X Ns s
+will
+result in
+.Nm
+selecting 1 of 56800235584 (62 ** 6) possible file names.
+.Pp
+If
+.Nm
+can successfully generate a unique file name, the file
+is created with mode 0600 (unless the
+.Fl u
+flag is given) and the filename is printed
+to standard output.
+.Pp
+If the
+.Fl t Ar prefix
+option is given,
+.Nm
+will generate a template string based on the
+.Ar prefix
+and the
+.Ev TMPDIR
+environment variable if set.
+The default location if
+.Ev TMPDIR
+is not set is
+.Pa /tmp .
+Care should
+be taken to ensure that it is appropriate to use an environment variable
+potentially supplied by the user.
+.Pp
+If no arguments are passed or if only the
+.Fl d
+flag is passed
+.Nm
+behaves as if
+.Fl t Li tmp
+was supplied.
+.Pp
+Any number of temporary files may be created in a single invocation,
+including one based on the internal template resulting from the
+.Fl t
+flag.
+.Pp
+The
+.Nm
+utility is provided to allow shell scripts to safely use temporary files.
+Traditionally, many shell scripts take the name of the program with
+the pid as a suffix and use that as a temporary file name.
+This
+kind of naming scheme is predictable and the race condition it creates
+is easy for an attacker to win.
+A safer, though still inferior, approach
+is to make a temporary directory using the same naming scheme.
+While
+this does allow one to guarantee that a temporary file will not be
+subverted, it still allows a simple denial of service attack.
+For these
+reasons it is suggested that
+.Nm
+be used instead.
+.Sh OPTIONS
+The available options are as follows:
+.Bl -tag -width indent
+.It Fl d
+Make a directory instead of a file.
+.It Fl q
+Fail silently if an error occurs.
+This is useful if
+a script does not want error output to go to standard error.
+.It Fl t Ar prefix
+Generate a template (using the supplied
+.Ar prefix
+and
+.Ev TMPDIR
+if set) to create a filename template.
+.It Fl u
+Operate in
+.Dq unsafe
+mode.
+The temp file will be unlinked before
+.Nm
+exits.
+This is slightly better than
+.Xr mktemp 3
+but still introduces a race condition.
+Use of this
+option is not encouraged.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following
+.Xr sh 1
+fragment illustrates a simple use of
+.Nm
+where the script should quit if it cannot get a safe
+temporary file.
+.Bd -literal -offset indent
+tempfoo=`basename $0`
+TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
+echo "program output" >> $TMPFILE
+.Ed
+.Pp
+To allow the use of $TMPDIR:
+.Bd -literal -offset indent
+tempfoo=`basename $0`
+TMPFILE=`mktemp -t ${tempfoo}` || exit 1
+echo "program output" >> $TMPFILE
+.Ed
+.Pp
+In this case, we want the script to catch the error itself.
+.Bd -literal -offset indent
+tempfoo=`basename $0`
+TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX`
+if [ $? -ne 0 ]; then
+ echo "$0: Can't create temp file, exiting..."
+ exit 1
+fi
+.Ed
+.Sh SEE ALSO
+.Xr mkdtemp 3 ,
+.Xr mkstemp 3 ,
+.Xr mktemp 3 ,
+.Xr environ 7
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.Ox 2.1 .
+This implementation was written independently based on the
+.Ox
+man page, and
+first appeared in
+.Fx 2.2.7 .
+This man page is taken from
+.Ox .
diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c
new file mode 100644
index 0000000..277104f
--- /dev/null
+++ b/usr.bin/mktemp/mktemp.c
@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 1994, 1995, 1996, 1998 Peter Wemm <peter@netplex.com.au>
+ * 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.
+ *
+ */
+
+/*
+ * This program was originally written long ago, originally for a non
+ * BSD-like OS without mkstemp(). It's been modified over the years
+ * to use mkstemp() rather than the original O_CREAT|O_EXCL/fstat/lstat
+ * etc style hacks.
+ * A cleanup, misc options and mkdtemp() calls were added to try and work
+ * more like the OpenBSD version - which was first to publish the interface.
+ */
+
+#include <err.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ int c, fd, ret;
+ char *tmpdir;
+ const char *prefix;
+ char *name;
+ int dflag, qflag, tflag, uflag;
+
+ ret = dflag = qflag = tflag = uflag = 0;
+ prefix = "mktemp";
+ name = NULL;
+
+ while ((c = getopt(argc, argv, "dqt:u")) != -1)
+ switch (c) {
+ case 'd':
+ dflag++;
+ break;
+
+ case 'q':
+ qflag++;
+ break;
+
+ case 't':
+ prefix = optarg;
+ tflag++;
+ break;
+
+ case 'u':
+ uflag++;
+ break;
+
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (!tflag && argc < 1) {
+ tflag = 1;
+ prefix = "tmp";
+ }
+
+ if (tflag) {
+ tmpdir = getenv("TMPDIR");
+ if (tmpdir == NULL)
+ asprintf(&name, "%s%s.XXXXXXXX", _PATH_TMP, prefix);
+ else
+ asprintf(&name, "%s/%s.XXXXXXXX", tmpdir, prefix);
+ /* if this fails, the program is in big trouble already */
+ if (name == NULL) {
+ if (qflag)
+ return (1);
+ else
+ errx(1, "cannot generate template");
+ }
+ }
+
+ /* generate all requested files */
+ while (name != NULL || argc > 0) {
+ if (name == NULL) {
+ name = strdup(argv[0]);
+ argv++;
+ argc--;
+ }
+
+ if (dflag) {
+ if (mkdtemp(name) == NULL) {
+ ret = 1;
+ if (!qflag)
+ warn("mkdtemp failed on %s", name);
+ } else {
+ printf("%s\n", name);
+ if (uflag)
+ rmdir(name);
+ }
+ } else {
+ fd = mkstemp(name);
+ if (fd < 0) {
+ ret = 1;
+ if (!qflag)
+ warn("mkstemp failed on %s", name);
+ } else {
+ close(fd);
+ if (uflag)
+ unlink(name);
+ printf("%s\n", name);
+ }
+ }
+ if (name)
+ free(name);
+ name = NULL;
+ }
+ return (ret);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: mktemp [-d] [-q] [-t prefix] [-u] template ...\n");
+ fprintf(stderr,
+ " mktemp [-d] [-q] [-u] -t prefix \n");
+ exit (1);
+}
diff --git a/usr.bin/mkuzip/Makefile b/usr.bin/mkuzip/Makefile
new file mode 100644
index 0000000..65a76a5
--- /dev/null
+++ b/usr.bin/mkuzip/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PROG= mkuzip
+MAN= mkuzip.8
+SRCS= mkuzip.c mkuz_blockcache.c mkuz_lzma.c mkuz_zlib.c mkuz_conveyor.c \
+ mkuz_blk.c mkuz_fqueue.c mkuz_time.c
+
+#CFLAGS+= -DMKUZ_DEBUG
+
+LIBADD= z md lzma pthread
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mkuzip/Makefile.depend b/usr.bin/mkuzip/Makefile.depend
new file mode 100644
index 0000000..b485aca
--- /dev/null
+++ b/usr.bin/mkuzip/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libmd \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mkuzip/mkuz_blk.c b/usr.bin/mkuzip/mkuz_blk.c
new file mode 100644
index 0000000..cfc5273
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_blk.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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 <stdint.h>
+#include <stdlib.h>
+
+#include "mkuzip.h"
+#include "mkuz_blk.h"
+
+struct mkuz_blk *
+mkuz_blk_ctor(size_t blen)
+{
+ struct mkuz_blk *rval;
+
+ rval = mkuz_safe_zmalloc(sizeof(struct mkuz_blk) + blen);
+ rval->alen = blen;
+ rval->br_offset = OFFSET_UNDEF;
+ return (rval);
+}
diff --git a/usr.bin/mkuzip/mkuz_blk.h b/usr.bin/mkuzip/mkuz_blk.h
new file mode 100644
index 0000000..8e80a10c
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_blk.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+#define OFFSET_UNDEF UINT64_MAX
+
+struct mkuz_blk_info {
+ uint64_t offset;
+ size_t len;
+ uint32_t blkno;
+ unsigned char digest[16];
+};
+
+#define MKUZ_BLK_EOF (void *)0x1
+#define MKUZ_BLK_MORE (void *)0x2
+
+struct mkuz_blk {
+ struct mkuz_blk_info info;
+ size_t alen;
+ uint64_t br_offset;
+ unsigned char data[];
+};
+
+struct mkuz_blk *mkuz_blk_ctor(size_t);
diff --git a/usr.bin/mkuzip/mkuz_blk_chain.h b/usr.bin/mkuzip/mkuz_blk_chain.h
new file mode 100644
index 0000000..556803f
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_blk_chain.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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$
+ */
+
+struct mkuz_blk;
+struct mkuz_bchain_link;
+
+struct mkuz_bchain_link {
+ struct mkuz_blk *this;
+ struct mkuz_bchain_link *prev;
+};
diff --git a/usr.bin/mkuzip/mkuz_blockcache.c b/usr.bin/mkuzip/mkuz_blockcache.c
new file mode 100644
index 0000000..a369eeb
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_blockcache.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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 <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if defined(MKUZ_DEBUG)
+# include <assert.h>
+# include <stdio.h>
+#endif
+
+#include "mkuz_blockcache.h"
+#include "mkuz_blk.h"
+
+struct mkuz_blkcache_itm {
+ struct mkuz_blk_info hit;
+ struct mkuz_blkcache_itm *next;
+};
+
+static struct mkuz_blkcache {
+ struct mkuz_blkcache_itm first[256];
+} blkcache;
+
+static int
+verify_match(int fd, const struct mkuz_blk *cbp, struct mkuz_blkcache_itm *bcep)
+{
+ void *vbuf;
+ ssize_t rlen;
+ int rval;
+
+ rval = -1;
+ vbuf = malloc(cbp->info.len);
+ if (vbuf == NULL) {
+ goto e0;
+ }
+ if (lseek(fd, bcep->hit.offset, SEEK_SET) < 0) {
+ goto e1;
+ }
+ rlen = read(fd, vbuf, cbp->info.len);
+ if (rlen < 0 || (unsigned)rlen != cbp->info.len) {
+ goto e2;
+ }
+ rval = (memcmp(cbp->data, vbuf, cbp->info.len) == 0) ? 1 : 0;
+e2:
+ lseek(fd, cbp->info.offset, SEEK_SET);
+e1:
+ free(vbuf);
+e0:
+ return (rval);
+}
+
+#define I2J(x) ((intmax_t)(x))
+#define U2J(x) ((uintmax_t)(x))
+
+static unsigned char
+digest_fold(const unsigned char *mdigest)
+{
+ int i;
+ unsigned char rval;
+
+ rval = mdigest[0];
+ for (i = 1; i < 16; i++) {
+ rval = rval ^ mdigest[i];
+ }
+ return (rval);
+}
+
+struct mkuz_blk_info *
+mkuz_blkcache_regblock(int fd, const struct mkuz_blk *bp)
+{
+ struct mkuz_blkcache_itm *bcep;
+ int rval;
+ unsigned char h;
+
+#if defined(MKUZ_DEBUG)
+ assert((unsigned)lseek(fd, 0, SEEK_CUR) == bp->info.offset);
+#endif
+ h = digest_fold(bp->info.digest);
+ if (blkcache.first[h].hit.len == 0) {
+ bcep = &blkcache.first[h];
+ } else {
+ for (bcep = &blkcache.first[h]; bcep != NULL; bcep = bcep->next) {
+ if (bcep->hit.len != bp->info.len)
+ continue;
+ if (memcmp(bp->info.digest, bcep->hit.digest,
+ sizeof(bp->info.digest)) == 0) {
+ break;
+ }
+ }
+ if (bcep != NULL) {
+ rval = verify_match(fd, bp, bcep);
+ if (rval == 1) {
+#if defined(MKUZ_DEBUG)
+ fprintf(stderr, "cache hit %jd, %jd, %jd, %jd\n",
+ I2J(bcep->hit.blkno), I2J(bcep->hit.offset),
+ I2J(bp->info.offset), I2J(bp->info.len));
+#endif
+ return (&bcep->hit);
+ }
+ if (rval == 0) {
+#if defined(MKUZ_DEBUG)
+ fprintf(stderr, "block MD5 collision, you should try lottery, "
+ "man!\n");
+#endif
+ return (NULL);
+ }
+ warn("verify_match");
+ return (NULL);
+ }
+ bcep = malloc(sizeof(struct mkuz_blkcache_itm));
+ if (bcep == NULL)
+ return (NULL);
+ memset(bcep, '\0', sizeof(struct mkuz_blkcache_itm));
+ bcep->next = blkcache.first[h].next;
+ blkcache.first[h].next = bcep;
+ }
+ bcep->hit = bp->info;
+ return (NULL);
+}
diff --git a/usr.bin/mkuzip/mkuz_blockcache.h b/usr.bin/mkuzip/mkuz_blockcache.h
new file mode 100644
index 0000000..58eaea0
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_blockcache.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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$
+ */
+
+struct mkuz_blk;
+
+struct mkuz_blk_info *mkuz_blkcache_regblock(int, const struct mkuz_blk *);
diff --git a/usr.bin/mkuzip/mkuz_cfg.h b/usr.bin/mkuzip/mkuz_cfg.h
new file mode 100644
index 0000000..fc183e3
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_cfg.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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$
+ */
+
+struct mkuz_conveyor;
+
+struct mkuz_cfg {
+ int fdr;
+ int fdw;
+ int verbose;
+ int no_zcomp;
+ int en_dedup;
+ int nworkers;
+ int blksz;
+ const struct mkuz_format *handler;
+};
diff --git a/usr.bin/mkuzip/mkuz_cloop.h b/usr.bin/mkuzip/mkuz_cloop.h
new file mode 100644
index 0000000..4ed7c50
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_cloop.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+/* CLOOP format and related constants */
+
+/*
+ * Integer values (block size, number of blocks, offsets)
+ * are stored in big-endian (network) order on disk.
+ */
+
+#define CLOOP_MAGIC_LEN 128
+#define CLOOP_OFS_COMPR 0x0b
+#define CLOOP_OFS_VERSN (CLOOP_OFS_COMPR + 1)
+
+#define CLOOP_MAJVER_2 '2'
+#define CLOOP_MAJVER_3 '3'
+
+#define CLOOP_COMP_LIBZ 'V'
+#define CLOOP_COMP_LZMA 'L'
+
+struct cloop_header {
+ char magic[CLOOP_MAGIC_LEN]; /* cloop magic */
+ uint32_t blksz; /* block size */
+ uint32_t nblocks; /* number of blocks */
+};
diff --git a/usr.bin/mkuzip/mkuz_conveyor.c b/usr.bin/mkuzip/mkuz_conveyor.c
new file mode 100644
index 0000000..856d445
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_conveyor.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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/types.h>
+#include <err.h>
+#include <inttypes.h>
+#include <md5.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <strings.h>
+
+#if defined(MKUZ_DEBUG)
+# include <stdio.h>
+#endif
+
+#include "mkuz_conveyor.h"
+#include "mkuz_cfg.h"
+#include "mkuzip.h"
+#include "mkuz_format.h"
+#include "mkuz_blk.h"
+#include "mkuz_fqueue.h"
+#include "mkuz_blk_chain.h"
+
+static void compute_digest(struct mkuz_blk *);
+
+struct cw_args {
+ struct mkuz_conveyor *cvp;
+ struct mkuz_cfg *cfp;
+};
+
+static void *
+cworker(void *p)
+{
+ struct cw_args *cwp;
+ struct mkuz_cfg *cfp;
+ struct mkuz_blk *oblk, *iblk;
+ struct mkuz_conveyor *cvp;
+ void *c_ctx;
+
+ cwp = (struct cw_args *)p;
+ cfp = cwp->cfp;
+ cvp = cwp->cvp;
+ free(cwp);
+ c_ctx = cfp->handler->f_init(cfp->blksz);
+ for (;;) {
+ iblk = mkuz_fqueue_deq(cvp->wrk_queue);
+ if (iblk == MKUZ_BLK_EOF) {
+ /* Let other threads to see the EOF block */
+ mkuz_fqueue_enq(cvp->wrk_queue, iblk);
+ break;
+ }
+ if (cfp->no_zcomp == 0 &&
+ mkuz_memvcmp(iblk->data, '\0', iblk->info.len) != 0) {
+ /* All zeroes block */
+ oblk = mkuz_blk_ctor(0);
+ } else {
+ oblk = cfp->handler->f_compress(c_ctx, iblk);
+ if (cfp->en_dedup != 0) {
+ compute_digest(oblk);
+ }
+ }
+ oblk->info.blkno = iblk->info.blkno;
+ mkuz_fqueue_enq(cvp->results, oblk);
+ free(iblk);
+ }
+ return (NULL);
+}
+
+static void
+compute_digest(struct mkuz_blk *bp)
+{
+ MD5_CTX mcontext;
+
+ MD5Init(&mcontext);
+ MD5Update(&mcontext, bp->data, bp->info.len);
+ MD5Final(bp->info.digest, &mcontext);
+}
+
+struct mkuz_conveyor *
+mkuz_conveyor_ctor(struct mkuz_cfg *cfp)
+{
+ struct mkuz_conveyor *cp;
+ struct cw_args *cwp;
+ int i, r;
+
+ cp = mkuz_safe_zmalloc(sizeof(struct mkuz_conveyor) +
+ (sizeof(pthread_t) * cfp->nworkers));
+
+ cp->wrk_queue = mkuz_fqueue_ctor(1);
+ cp->results = mkuz_fqueue_ctor(1);
+
+ for (i = 0; i < cfp->nworkers; i++) {
+ cwp = mkuz_safe_zmalloc(sizeof(struct cw_args));
+ cwp->cfp = cfp;
+ cwp->cvp = cp;
+ r = pthread_create(&cp->wthreads[i], NULL, cworker, (void *)cwp);
+ if (r != 0) {
+ errx(1, "mkuz_conveyor_ctor: pthread_create() failed");
+ /* Not reached */
+ }
+ }
+ return (cp);
+}
diff --git a/usr.bin/mkuzip/mkuz_conveyor.h b/usr.bin/mkuzip/mkuz_conveyor.h
new file mode 100644
index 0000000..21328e7
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_conveyor.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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$
+ */
+
+struct mkuz_fifo_queue;
+
+#define ITEMS_PER_WORKER 4
+
+#define MAX_WORKERS_AUTO 24
+
+struct mkuz_conveyor {
+ /*
+ * Work items are places in here, and picked up by workers in a FIFO
+ * fashion.
+ */
+ struct mkuz_fifo_queue *wrk_queue;
+ /*
+ * Results are dropped into this FIFO and consumer is buzzed to pick them
+ * up
+ */
+ struct mkuz_fifo_queue *results;
+
+ pthread_t wthreads[];
+};
+
+struct mkuz_cfg;
+
+struct mkuz_conveyor *mkuz_conveyor_ctor(struct mkuz_cfg *);
diff --git a/usr.bin/mkuzip/mkuz_format.h b/usr.bin/mkuzip/mkuz_format.h
new file mode 100644
index 0000000..817c012
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_format.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016 Maxim Sobolev <sobomax@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$
+ */
+
+DEFINE_RAW_METHOD(f_init, void *, uint32_t);
+DEFINE_RAW_METHOD(f_compress, struct mkuz_blk *, void *, const struct mkuz_blk *);
+
+struct mkuz_format {
+ const char *magic;
+ const char *default_sufx;
+ f_init_t f_init;
+ f_compress_t f_compress;
+};
diff --git a/usr.bin/mkuzip/mkuz_fqueue.c b/usr.bin/mkuzip/mkuz_fqueue.c
new file mode 100644
index 0000000..db47a05
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_fqueue.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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 <err.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(MKUZ_DEBUG)
+# include <assert.h>
+#endif
+
+#include "mkuzip.h"
+#include "mkuz_fqueue.h"
+#include "mkuz_conveyor.h"
+#include "mkuz_blk.h"
+#include "mkuz_blk_chain.h"
+
+struct mkuz_fifo_queue *
+mkuz_fqueue_ctor(int wakeup_len)
+{
+ struct mkuz_fifo_queue *fqp;
+
+ fqp = mkuz_safe_zmalloc(sizeof(struct mkuz_fifo_queue));
+ fqp->wakeup_len = wakeup_len;
+ if (pthread_mutex_init(&fqp->mtx, NULL) != 0) {
+ errx(1, "pthread_mutex_init() failed");
+ }
+ if (pthread_cond_init(&fqp->cvar, NULL) != 0) {
+ errx(1, "pthread_cond_init() failed");
+ }
+ return (fqp);
+}
+
+void
+mkuz_fqueue_enq(struct mkuz_fifo_queue *fqp, struct mkuz_blk *bp)
+{
+ struct mkuz_bchain_link *ip;
+
+ ip = mkuz_safe_zmalloc(sizeof(struct mkuz_bchain_link));
+ ip->this = bp;
+
+ pthread_mutex_lock(&fqp->mtx);
+ if (fqp->first != NULL) {
+ fqp->first->prev = ip;
+ } else {
+ fqp->last = ip;
+ }
+ fqp->first = ip;
+ fqp->length += 1;
+ if (fqp->length >= fqp->wakeup_len) {
+ pthread_cond_signal(&fqp->cvar);
+ }
+ pthread_mutex_unlock(&fqp->mtx);
+}
+
+#if defined(NOTYET)
+int
+mkuz_fqueue_enq_all(struct mkuz_fifo_queue *fqp, struct mkuz_bchain_link *cip_f,
+ struct mkuz_bchain_link *cip_l, int clen)
+{
+ int rval;
+
+ pthread_mutex_lock(&fqp->mtx);
+ if (fqp->first != NULL) {
+ fqp->first->prev = cip_l;
+ } else {
+ fqp->last = cip_l;
+ }
+ fqp->first = cip_f;
+ fqp->length += clen;
+ rval = fqp->length;
+ if (fqp->length >= fqp->wakeup_len) {
+ pthread_cond_signal(&fqp->cvar);
+ }
+ pthread_mutex_unlock(&fqp->mtx);
+ return (rval);
+}
+#endif
+
+static int
+mkuz_fqueue_check(struct mkuz_fifo_queue *fqp, cmp_cb_t cmp_cb, void *cap)
+{
+ struct mkuz_bchain_link *ip;
+
+ for (ip = fqp->last; ip != NULL; ip = ip->prev) {
+ if (cmp_cb(ip->this, cap)) {
+ return (1);
+ }
+ }
+ return (0);
+}
+
+struct mkuz_blk *
+mkuz_fqueue_deq_when(struct mkuz_fifo_queue *fqp, cmp_cb_t cmp_cb, void *cap)
+{
+ struct mkuz_bchain_link *ip, *newlast, *newfirst, *mip;
+ struct mkuz_blk *bp;
+
+ pthread_mutex_lock(&fqp->mtx);
+ while (fqp->last == NULL || !mkuz_fqueue_check(fqp, cmp_cb, cap)) {
+ pthread_cond_wait(&fqp->cvar, &fqp->mtx);
+ }
+ if (cmp_cb(fqp->last->this, cap)) {
+ mip = fqp->last;
+ fqp->last = mip->prev;
+ if (fqp->last == NULL) {
+#if defined(MKUZ_DEBUG)
+ assert(fqp->length == 1);
+#endif
+ fqp->first = NULL;
+ }
+ } else {
+#if defined(MKUZ_DEBUG)
+ assert(fqp->length > 1);
+#endif
+ newfirst = newlast = fqp->last;
+ mip = NULL;
+ for (ip = fqp->last->prev; ip != NULL; ip = ip->prev) {
+ if (cmp_cb(ip->this, cap)) {
+ mip = ip;
+ continue;
+ }
+ newfirst->prev = ip;
+ newfirst = ip;
+ }
+ newfirst->prev = NULL;
+ fqp->first = newfirst;
+ fqp->last = newlast;
+ }
+ fqp->length -= 1;
+ pthread_mutex_unlock(&fqp->mtx);
+ bp = mip->this;
+ free(mip);
+
+ return bp;
+}
+
+struct mkuz_blk *
+mkuz_fqueue_deq(struct mkuz_fifo_queue *fqp)
+{
+ struct mkuz_bchain_link *ip;
+ struct mkuz_blk *bp;
+
+ pthread_mutex_lock(&fqp->mtx);
+ while (fqp->last == NULL) {
+ pthread_cond_wait(&fqp->cvar, &fqp->mtx);
+ }
+#if defined(MKUZ_DEBUG)
+ assert(fqp->length > 0);
+#endif
+ ip = fqp->last;
+ fqp->last = ip->prev;
+ if (fqp->last == NULL) {
+#if defined(MKUZ_DEBUG)
+ assert(fqp->length == 1);
+#endif
+ fqp->first = NULL;
+ }
+ fqp->length -= 1;
+ pthread_mutex_unlock(&fqp->mtx);
+ bp = ip->this;
+ free(ip);
+
+ return bp;
+}
+
+#if defined(NOTYET)
+struct mkuz_bchain_link *
+mkuz_fqueue_deq_all(struct mkuz_fifo_queue *fqp, int *rclen)
+{
+ struct mkuz_bchain_link *rchain;
+
+ pthread_mutex_lock(&fqp->mtx);
+ while (fqp->last == NULL) {
+ pthread_cond_wait(&fqp->cvar, &fqp->mtx);
+ }
+#if defined(MKUZ_DEBUG)
+ assert(fqp->length > 0);
+#endif
+ rchain = fqp->last;
+ fqp->first = fqp->last = NULL;
+ *rclen = fqp->length;
+ fqp->length = 0;
+ pthread_mutex_unlock(&fqp->mtx);
+ return (rchain);
+}
+#endif
diff --git a/usr.bin/mkuzip/mkuz_fqueue.h b/usr.bin/mkuzip/mkuz_fqueue.h
new file mode 100644
index 0000000..4b34216f
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_fqueue.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+struct mkuz_fifo_queue {
+ pthread_mutex_t mtx;
+ pthread_cond_t cvar;
+ struct mkuz_bchain_link *first;
+ struct mkuz_bchain_link *last;
+ int length;
+ int wakeup_len;
+};
+
+struct mkuz_blk;
+struct mkuz_bchain_link;
+
+DEFINE_RAW_METHOD(cmp_cb, int, const struct mkuz_blk *, void *);
+
+struct mkuz_fifo_queue *mkuz_fqueue_ctor(int);
+void mkuz_fqueue_enq(struct mkuz_fifo_queue *, struct mkuz_blk *);
+struct mkuz_blk *mkuz_fqueue_deq(struct mkuz_fifo_queue *);
+struct mkuz_blk *mkuz_fqueue_deq_when(struct mkuz_fifo_queue *, cmp_cb_t, void *);
+#if defined(NOTYET)
+struct mkuz_bchain_link *mkuz_fqueue_deq_all(struct mkuz_fifo_queue *, int *);
+int mkuz_fqueue_enq_all(struct mkuz_fifo_queue *, struct mkuz_bchain_link *,
+ struct mkuz_bchain_link *, int);
+#endif
diff --git a/usr.bin/mkuzip/mkuz_lzma.c b/usr.bin/mkuzip/mkuz_lzma.c
new file mode 100644
index 0000000..8810d2e
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_lzma.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@FreeBSD.org>
+ * Copyright (c) 2011 Aleksandr Rybalko <ray@ddteam.net>
+ * 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 <err.h>
+#include <stdint.h>
+
+#include <lzma.h>
+
+#include "mkuzip.h"
+#include "mkuz_lzma.h"
+#include "mkuz_blk.h"
+
+#define USED_BLOCKSIZE DEV_BSIZE
+
+struct mkuz_lzma {
+ lzma_filter filters[2];
+ lzma_options_lzma opt_lzma;
+ lzma_stream strm;
+ uint32_t blksz;
+};
+
+static const lzma_stream lzma_stream_init = LZMA_STREAM_INIT;
+
+void *
+mkuz_lzma_init(uint32_t blksz)
+{
+ struct mkuz_lzma *ulp;
+
+ if (blksz % USED_BLOCKSIZE != 0) {
+ errx(1, "cluster size should be multiple of %d",
+ USED_BLOCKSIZE);
+ /* Not reached */
+ }
+ if (blksz > MAXPHYS) {
+ errx(1, "cluster size is too large");
+ /* Not reached */
+ }
+ ulp = mkuz_safe_zmalloc(sizeof(struct mkuz_lzma));
+
+ /* Init lzma encoder */
+ ulp->strm = lzma_stream_init;
+ if (lzma_lzma_preset(&ulp->opt_lzma, LZMA_PRESET_DEFAULT))
+ errx(1, "Error loading LZMA preset");
+
+ ulp->filters[0].id = LZMA_FILTER_LZMA2;
+ ulp->filters[0].options = &ulp->opt_lzma;
+ ulp->filters[1].id = LZMA_VLI_UNKNOWN;
+
+ ulp->blksz = blksz;
+
+ return (void *)ulp;
+}
+
+struct mkuz_blk *
+mkuz_lzma_compress(void *p, const struct mkuz_blk *iblk)
+{
+ lzma_ret ret;
+ struct mkuz_blk *rval;
+ struct mkuz_lzma *ulp;
+
+ ulp = (struct mkuz_lzma *)p;
+
+ rval = mkuz_blk_ctor(ulp->blksz * 2);
+
+ ret = lzma_stream_encoder(&ulp->strm, ulp->filters, LZMA_CHECK_CRC32);
+ if (ret != LZMA_OK) {
+ if (ret == LZMA_MEMLIMIT_ERROR)
+ errx(1, "can't compress data: LZMA_MEMLIMIT_ERROR");
+
+ errx(1, "can't compress data: LZMA compressor ERROR");
+ }
+
+ ulp->strm.next_in = iblk->data;
+ ulp->strm.avail_in = ulp->blksz;
+ ulp->strm.next_out = rval->data;
+ ulp->strm.avail_out = rval->alen;
+
+ ret = lzma_code(&ulp->strm, LZMA_FINISH);
+
+ if (ret != LZMA_STREAM_END) {
+ /* Error */
+ errx(1, "lzma_code FINISH failed, code=%d, pos(in=%zd, "
+ "out=%zd)", ret, (ulp->blksz - ulp->strm.avail_in),
+ (ulp->blksz * 2 - ulp->strm.avail_out));
+ }
+
+#if 0
+ lzma_end(&ulp->strm);
+#endif
+
+ rval->info.len = rval->alen - ulp->strm.avail_out;
+ return (rval);
+}
diff --git a/usr.bin/mkuzip/mkuz_lzma.h b/usr.bin/mkuzip/mkuz_lzma.h
new file mode 100644
index 0000000..bba4542
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_lzma.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@FreeBSD.org>
+ * Copyright (c) 2011 Aleksandr Rybalko <ray@ddteam.net>
+ * 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$
+ */
+
+/* Format L3.0, since we move to XZ API */
+#define CLOOP_MAGIC_LZMA \
+ "#!/bin/sh\n" \
+ "#L3.0\n" \
+ "n=uncompress\n" \
+ "m=geom_$n\n" \
+ "(kldstat -m $m 2>&-||kldload $m)>&-&&" \
+ "mount_cd9660 /dev/`mdconfig -af $0`.$n $1\n" \
+ "exit $?\n"
+#define DEFAULT_SUFX_LZMA ".ulzma"
+
+void *mkuz_lzma_init(uint32_t);
+struct mkuz_blk *mkuz_lzma_compress(void *, const struct mkuz_blk *);
diff --git a/usr.bin/mkuzip/mkuz_time.c b/usr.bin/mkuzip/mkuz_time.c
new file mode 100644
index 0000000..a221957
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_time.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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 <math.h>
+#include <stdint.h>
+#include <time.h>
+
+#include "mkuz_time.h"
+
+double
+getdtime(void)
+{
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == -1)
+ return (-1);
+
+ return timespec2dtime(&tp);
+}
diff --git a/usr.bin/mkuzip/mkuz_time.h b/usr.bin/mkuzip/mkuz_time.h
new file mode 100644
index 0000000..670eec2
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_time.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+#ifndef _RTPP_TIME_H_
+#define _RTPP_TIME_H_
+
+#define SEC(x) ((x)->tv_sec)
+#define NSEC(x) ((x)->tv_nsec)
+
+#define timespec2dtime(s) ((double)SEC(s) + \
+ (double)NSEC(s) / 1000000000.0)
+
+/* Function prototypes */
+double getdtime(void);
+
+#endif
diff --git a/usr.bin/mkuzip/mkuz_zlib.c b/usr.bin/mkuzip/mkuz_zlib.c
new file mode 100644
index 0000000..4b191f9
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_zlib.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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 <err.h>
+#include <stdint.h>
+
+#include <zlib.h>
+
+#include "mkuzip.h"
+#include "mkuz_zlib.h"
+#include "mkuz_blk.h"
+
+struct mkuz_zlib {
+ uLongf oblen;
+ uint32_t blksz;
+};
+
+void *
+mkuz_zlib_init(uint32_t blksz)
+{
+ struct mkuz_zlib *zp;
+
+ if (blksz % DEV_BSIZE != 0) {
+ errx(1, "cluster size should be multiple of %d",
+ DEV_BSIZE);
+ /* Not reached */
+ }
+ if (compressBound(blksz) > MAXPHYS) {
+ errx(1, "cluster size is too large");
+ /* Not reached */
+ }
+ zp = mkuz_safe_zmalloc(sizeof(struct mkuz_zlib));
+ zp->oblen = compressBound(blksz);
+ zp->blksz = blksz;
+
+ return (void *)zp;
+}
+
+struct mkuz_blk *
+mkuz_zlib_compress(void *p, const struct mkuz_blk *iblk)
+{
+ uLongf destlen_z;
+ struct mkuz_blk *rval;
+ struct mkuz_zlib *zp;
+
+ zp = (struct mkuz_zlib *)p;
+
+ rval = mkuz_blk_ctor(zp->oblen);
+
+ destlen_z = rval->alen;
+ if (compress2(rval->data, &destlen_z, iblk->data, zp->blksz,
+ Z_BEST_COMPRESSION) != Z_OK) {
+ errx(1, "can't compress data: compress2() "
+ "failed");
+ /* Not reached */
+ }
+
+ rval->info.len = (uint32_t)destlen_z;
+ return (rval);
+}
diff --git a/usr.bin/mkuzip/mkuz_zlib.h b/usr.bin/mkuzip/mkuz_zlib.h
new file mode 100644
index 0000000..55e57a6
--- /dev/null
+++ b/usr.bin/mkuzip/mkuz_zlib.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+#define DEFAULT_SUFX_ZLIB ".uzip"
+
+#define CLOOP_MAGIC_ZLIB "#!/bin/sh\n#V2.0 Format\n" \
+ "(kldstat -qm g_uzip||kldload geom_uzip)>&-&&" \
+ "mount_cd9660 /dev/`mdconfig -af $0`.uzip $1\nexit $?\n"
+
+void *mkuz_zlib_init(uint32_t);
+struct mkuz_blk *mkuz_zlib_compress(void *, const struct mkuz_blk *);
diff --git a/usr.bin/mkuzip/mkuzip.8 b/usr.bin/mkuzip/mkuzip.8
new file mode 100644
index 0000000..f47764c
--- /dev/null
+++ b/usr.bin/mkuzip/mkuzip.8
@@ -0,0 +1,185 @@
+.\"-
+.\" Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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 March 17, 2006
+.Dt MKUZIP 8
+.Os
+.Sh NAME
+.Nm mkuzip
+.Nd compress disk image for use with
+.Xr geom_uzip 4
+class
+.Sh SYNOPSIS
+.Nm
+.Op Fl v
+.Op Fl o Ar outfile
+.Op Fl s Ar cluster_size
+.Op Fl j Ar compression_jobs
+.Ar infile
+.Sh DESCRIPTION
+The
+.Nm
+utility compresses a disk image file so that the
+.Xr geom_uzip 4
+class will be able to decompress the resulting image at run-time.
+This allows for a significant reduction of size of disk image at
+the expense of some CPU time required to decompress the data each
+time it is read.
+The
+.Nm
+utility
+works in two phases:
+.Bl -enum
+.It
+An
+.Ar infile
+image is split into clusters; each cluster is compressed using
+.Xr zlib 3
+or
+.Xr lzma 3 .
+.It
+The resulting set of compressed clusters along with headers that allow
+locating each individual cluster is written to the output file.
+.El
+.Pp
+The options are:
+.Bl -tag -width indent
+.It Fl o Ar outfile
+Name of the output file
+.Ar outfile .
+The default is to use the input name with the suffix
+.Pa .uzip
+for the
+.Xr zlib 3
+compression or
+.Pa .ulzma
+for the
+.Xr lzma 3 .
+.It Fl L
+Use
+.Xr lzma 3
+compression algorithm instead of the default
+.Xr zlib 3 .
+The
+.Xr lzma 3
+provides noticeable better compression levels on the same data set
+at the expense of much slower compression speed (10-20x) and somewhat slower
+decompression (2-3x).
+.It Fl s Ar cluster_size
+Split the image into clusters of
+.Ar cluster_size
+bytes, 16384 bytes by default.
+The
+.Ar cluster_size
+should be a multiple of 512 bytes.
+.It Fl v
+Display verbose messages.
+.It Fl Z
+Disable zero-blocks detection and elimination.
+When this option is set, the
+.Nm
+would compress empty blocks (i.e. clusters that consist of only zero bytes)
+just as it would any other block.
+When the option is not set, the
+.Nm
+detects such blocks and skips them from the output.
+Setting
+.Fl Z
+results is slight increase of compressed image size, typically less than 0.1%
+of a final size of the compressed image.
+.It Fl d
+Enable de-duplication.
+When the option is enabled the
+.Nm
+detects identical blocks in the input and replaces each subsequent occurence
+of such block with pointer to the very first one in the output.
+Setting this option results is moderate decrease of compressed image size,
+typically around 3-5% of a final size of the compressed image.
+.It Fl S
+Print summary about the compression ratio as well as output
+file size after file has been processed.
+.It Fl j Ar compression_jobs
+Specify the number of compression jobs that
+.Nm
+runs in parallel to speed up compression.
+When option is not specified the number of jobs set to be equal
+to the value of
+.Va hw.ncpu
+.Xr sysctl 8
+variable.
+.El
+.Sh NOTES
+The compression ratio largely depends on the cluster size used.
+.\" The following two sentences are unclear: how can gzip(1) be
+.\" used in a comparable fashion, and wouldn't a gzip-compressed
+.\" image suffer from larger cluster sizes as well?
+For large cluster sizes (16K and higher), typical compression ratios
+are only 1-2% less than those achieved with
+.Xr gzip 1 .
+However, it should be kept in mind that larger cluster
+sizes lead to higher overhead in the
+.Xr geom_uzip 4
+class, as the class has to decompress the whole cluster even if
+only a few bytes from that cluster have to be read.
+.Pp
+The
+.Nm
+utility
+inserts a short shell script at the beginning of the generated image,
+which makes it possible to
+.Dq run
+the image just like any other shell script.
+The script tries to load the
+.Xr geom_uzip 4
+class if it is not loaded, configure the image as an
+.Xr md 4
+disk device using
+.Xr mdconfig 8 ,
+and automatically mount it using
+.Xr mount_cd9660 8
+on the mount point provided as the first argument to the script.
+.Pp
+The de-duplication is a
+.Fx
+specific feature and while it does not require any changes to on-disk
+compressed image format, however it did require some matching changes to the
+.Xr geom_uzip 4
+to handle resulting images correctly.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr gzip 1 ,
+.Xr xz 1 ,
+.Xr zlib 3 ,
+.Xr lzma 3 ,
+.Xr geom 4 ,
+.Xr geom_uzip 4 ,
+.Xr md 4 ,
+.Xr mdconfig 8 ,
+.Xr mount_cd9660 8
+.Sh AUTHORS
+.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c
new file mode 100644
index 0000000..6288f4e
--- /dev/null
+++ b/usr.bin/mkuzip/mkuzip.c
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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/types.h>
+#include <sys/disk.h>
+#include <sys/endian.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <netinet/in.h>
+#include <assert.h>
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "mkuzip.h"
+#include "mkuz_cloop.h"
+#include "mkuz_blockcache.h"
+#include "mkuz_zlib.h"
+#include "mkuz_lzma.h"
+#include "mkuz_blk.h"
+#include "mkuz_cfg.h"
+#include "mkuz_conveyor.h"
+#include "mkuz_format.h"
+#include "mkuz_fqueue.h"
+#include "mkuz_time.h"
+
+#define DEFAULT_CLSTSIZE 16384
+
+static struct mkuz_format uzip_fmt = {
+ .magic = CLOOP_MAGIC_ZLIB,
+ .default_sufx = DEFAULT_SUFX_ZLIB,
+ .f_init = &mkuz_zlib_init,
+ .f_compress = &mkuz_zlib_compress
+};
+
+static struct mkuz_format ulzma_fmt = {
+ .magic = CLOOP_MAGIC_LZMA,
+ .default_sufx = DEFAULT_SUFX_LZMA,
+ .f_init = &mkuz_lzma_init,
+ .f_compress = &mkuz_lzma_compress
+};
+
+static struct mkuz_blk *readblock(int, u_int32_t);
+static void usage(void);
+static void cleanup(void);
+
+static char *cleanfile = NULL;
+
+static int
+cmp_blkno(const struct mkuz_blk *bp, void *p)
+{
+ uint32_t *ap;
+
+ ap = (uint32_t *)p;
+
+ return (bp->info.blkno == *ap);
+}
+
+int main(int argc, char **argv)
+{
+ struct mkuz_cfg cfs;
+ char *iname, *oname;
+ uint64_t *toc;
+ int i, io, opt, tmp;
+ struct {
+ int en;
+ FILE *f;
+ } summary;
+ struct iovec iov[2];
+ struct stat sb;
+ uint64_t offset, last_offset;
+ struct cloop_header hdr;
+ struct mkuz_conveyor *cvp;
+ void *c_ctx;
+ struct mkuz_blk_info *chit;
+ size_t ncpusz, ncpu;
+ double st, et;
+
+ st = getdtime();
+
+ ncpusz = sizeof(size_t);
+ if (sysctlbyname("hw.ncpu", &ncpu, &ncpusz, NULL, 0) < 0) {
+ ncpu = 1;
+ } else if (ncpu > MAX_WORKERS_AUTO) {
+ ncpu = MAX_WORKERS_AUTO;
+ }
+
+ memset(&hdr, 0, sizeof(hdr));
+ cfs.blksz = DEFAULT_CLSTSIZE;
+ oname = NULL;
+ cfs.verbose = 0;
+ cfs.no_zcomp = 0;
+ cfs.en_dedup = 0;
+ summary.en = 0;
+ summary.f = stderr;
+ cfs.handler = &uzip_fmt;
+ cfs.nworkers = ncpu;
+ struct mkuz_blk *iblk, *oblk;
+
+ while((opt = getopt(argc, argv, "o:s:vZdLSj:")) != -1) {
+ switch(opt) {
+ case 'o':
+ oname = optarg;
+ break;
+
+ case 's':
+ tmp = atoi(optarg);
+ if (tmp <= 0) {
+ errx(1, "invalid cluster size specified: %s",
+ optarg);
+ /* Not reached */
+ }
+ cfs.blksz = tmp;
+ break;
+
+ case 'v':
+ cfs.verbose = 1;
+ break;
+
+ case 'Z':
+ cfs.no_zcomp = 1;
+ break;
+
+ case 'd':
+ cfs.en_dedup = 1;
+ break;
+
+ case 'L':
+ cfs.handler = &ulzma_fmt;
+ break;
+
+ case 'S':
+ summary.en = 1;
+ summary.f = stdout;
+ break;
+
+ case 'j':
+ tmp = atoi(optarg);
+ if (tmp <= 0) {
+ errx(1, "invalid number of compression threads"
+ " specified: %s", optarg);
+ /* Not reached */
+ }
+ cfs.nworkers = tmp;
+ break;
+
+ default:
+ usage();
+ /* Not reached */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1) {
+ usage();
+ /* Not reached */
+ }
+
+ strcpy(hdr.magic, cfs.handler->magic);
+
+ if (cfs.en_dedup != 0) {
+ hdr.magic[CLOOP_OFS_VERSN] = CLOOP_MAJVER_3;
+ hdr.magic[CLOOP_OFS_COMPR] =
+ tolower(hdr.magic[CLOOP_OFS_COMPR]);
+ }
+
+ c_ctx = cfs.handler->f_init(cfs.blksz);
+
+ iname = argv[0];
+ if (oname == NULL) {
+ asprintf(&oname, "%s%s", iname, cfs.handler->default_sufx);
+ if (oname == NULL) {
+ err(1, "can't allocate memory");
+ /* Not reached */
+ }
+ }
+
+ signal(SIGHUP, exit);
+ signal(SIGINT, exit);
+ signal(SIGTERM, exit);
+ signal(SIGXCPU, exit);
+ signal(SIGXFSZ, exit);
+ atexit(cleanup);
+
+ cfs.fdr = open(iname, O_RDONLY);
+ if (cfs.fdr < 0) {
+ err(1, "open(%s)", iname);
+ /* Not reached */
+ }
+ if (fstat(cfs.fdr, &sb) != 0) {
+ err(1, "fstat(%s)", iname);
+ /* Not reached */
+ }
+ if (S_ISCHR(sb.st_mode)) {
+ off_t ms;
+
+ if (ioctl(cfs.fdr, DIOCGMEDIASIZE, &ms) < 0) {
+ err(1, "ioctl(DIOCGMEDIASIZE)");
+ /* Not reached */
+ }
+ sb.st_size = ms;
+ } else if (!S_ISREG(sb.st_mode)) {
+ fprintf(stderr, "%s: not a character device or regular file\n",
+ iname);
+ exit(1);
+ }
+ hdr.nblocks = sb.st_size / cfs.blksz;
+ if ((sb.st_size % cfs.blksz) != 0) {
+ if (cfs.verbose != 0)
+ fprintf(stderr, "file size is not multiple "
+ "of %d, padding data\n", cfs.blksz);
+ hdr.nblocks++;
+ }
+ toc = mkuz_safe_malloc((hdr.nblocks + 1) * sizeof(*toc));
+
+ cfs.fdw = open(oname, (cfs.en_dedup ? O_RDWR : O_WRONLY) | O_TRUNC | O_CREAT,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ if (cfs.fdw < 0) {
+ err(1, "open(%s)", oname);
+ /* Not reached */
+ }
+ cleanfile = oname;
+
+ /* Prepare header that we will write later when we have index ready. */
+ iov[0].iov_base = (char *)&hdr;
+ iov[0].iov_len = sizeof(hdr);
+ iov[1].iov_base = (char *)toc;
+ iov[1].iov_len = (hdr.nblocks + 1) * sizeof(*toc);
+ offset = iov[0].iov_len + iov[1].iov_len;
+
+ /* Reserve space for header */
+ lseek(cfs.fdw, offset, SEEK_SET);
+
+ if (cfs.verbose != 0) {
+ fprintf(stderr, "data size %ju bytes, number of clusters "
+ "%u, index length %zu bytes\n", sb.st_size,
+ hdr.nblocks, iov[1].iov_len);
+ }
+
+ cvp = mkuz_conveyor_ctor(&cfs);
+
+ last_offset = 0;
+ iblk = oblk = NULL;
+ for(i = io = 0; iblk != MKUZ_BLK_EOF; i++) {
+ iblk = readblock(cfs.fdr, cfs.blksz);
+ mkuz_fqueue_enq(cvp->wrk_queue, iblk);
+ if (iblk != MKUZ_BLK_EOF &&
+ (i < (cfs.nworkers * ITEMS_PER_WORKER))) {
+ continue;
+ }
+drain:
+ oblk = mkuz_fqueue_deq_when(cvp->results, cmp_blkno, &io);
+ assert(oblk->info.blkno == (unsigned)io);
+ oblk->info.offset = offset;
+ chit = NULL;
+ if (cfs.en_dedup != 0 && oblk->info.len > 0) {
+ chit = mkuz_blkcache_regblock(cfs.fdw, oblk);
+ /*
+ * There should be at least one non-empty block
+ * between us and the backref'ed offset, otherwise
+ * we won't be able to parse that sequence correctly
+ * as it would be indistinguishible from another
+ * empty block.
+ */
+ if (chit != NULL && chit->offset == last_offset) {
+ chit = NULL;
+ }
+ }
+ if (chit != NULL) {
+ toc[io] = htobe64(chit->offset);
+ oblk->info.len = 0;
+ } else {
+ if (oblk->info.len > 0 && write(cfs.fdw, oblk->data,
+ oblk->info.len) < 0) {
+ err(1, "write(%s)", oname);
+ /* Not reached */
+ }
+ toc[io] = htobe64(offset);
+ last_offset = offset;
+ offset += oblk->info.len;
+ }
+ if (cfs.verbose != 0) {
+ fprintf(stderr, "cluster #%d, in %u bytes, "
+ "out len=%lu offset=%lu", io, cfs.blksz,
+ (u_long)oblk->info.len, (u_long)be64toh(toc[io]));
+ if (chit != NULL) {
+ fprintf(stderr, " (backref'ed to #%d)",
+ chit->blkno);
+ }
+ fprintf(stderr, "\n");
+ }
+ free(oblk);
+ io += 1;
+ if (iblk == MKUZ_BLK_EOF) {
+ if (io < i)
+ goto drain;
+ /* Last block, see if we need to add some padding */
+ if ((offset % DEV_BSIZE) == 0)
+ continue;
+ oblk = mkuz_blk_ctor(DEV_BSIZE - (offset % DEV_BSIZE));
+ oblk->info.blkno = io;
+ oblk->info.len = oblk->alen;
+ if (cfs.verbose != 0) {
+ fprintf(stderr, "padding data with %lu bytes "
+ "so that file size is multiple of %d\n",
+ (u_long)oblk->alen, DEV_BSIZE);
+ }
+ mkuz_fqueue_enq(cvp->results, oblk);
+ goto drain;
+ }
+ }
+
+ close(cfs.fdr);
+
+ if (cfs.verbose != 0 || summary.en != 0) {
+ et = getdtime();
+ fprintf(summary.f, "compressed data to %ju bytes, saved %lld "
+ "bytes, %.2f%% decrease, %.2f bytes/sec.\n", offset,
+ (long long)(sb.st_size - offset),
+ 100.0 * (long long)(sb.st_size - offset) /
+ (float)sb.st_size, (float)sb.st_size / (et - st));
+ }
+
+ /* Convert to big endian */
+ hdr.blksz = htonl(cfs.blksz);
+ hdr.nblocks = htonl(hdr.nblocks);
+ /* Write headers into pre-allocated space */
+ lseek(cfs.fdw, 0, SEEK_SET);
+ if (writev(cfs.fdw, iov, 2) < 0) {
+ err(1, "writev(%s)", oname);
+ /* Not reached */
+ }
+ cleanfile = NULL;
+ close(cfs.fdw);
+
+ exit(0);
+}
+
+static struct mkuz_blk *
+readblock(int fd, u_int32_t clstsize)
+{
+ int numread;
+ struct mkuz_blk *rval;
+ static int blockcnt;
+ off_t cpos;
+
+ rval = mkuz_blk_ctor(clstsize);
+
+ rval->info.blkno = blockcnt;
+ blockcnt += 1;
+ cpos = lseek(fd, 0, SEEK_CUR);
+ if (cpos < 0) {
+ err(1, "readblock: lseek() failed");
+ /* Not reached */
+ }
+ rval->info.offset = cpos;
+
+ numread = read(fd, rval->data, clstsize);
+ if (numread < 0) {
+ err(1, "readblock: read() failed");
+ /* Not reached */
+ }
+ if (numread == 0) {
+ free(rval);
+ return MKUZ_BLK_EOF;
+ }
+ rval->info.len = numread;
+ return rval;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: mkuzip [-vZdLS] [-o outfile] [-s cluster_size] "
+ "[-j ncompr] infile\n");
+ exit(1);
+}
+
+void *
+mkuz_safe_malloc(size_t size)
+{
+ void *retval;
+
+ retval = malloc(size);
+ if (retval == NULL) {
+ err(1, "can't allocate memory");
+ /* Not reached */
+ }
+ return retval;
+}
+
+void *
+mkuz_safe_zmalloc(size_t size)
+{
+ void *retval;
+
+ retval = mkuz_safe_malloc(size);
+ bzero(retval, size);
+ return retval;
+}
+
+static void
+cleanup(void)
+{
+
+ if (cleanfile != NULL)
+ unlink(cleanfile);
+}
+
+int
+mkuz_memvcmp(const void *memory, unsigned char val, size_t size)
+{
+ const u_char *mm;
+
+ mm = (const u_char *)memory;
+ return (*mm == val) && memcmp(mm, mm + 1, size - 1) == 0;
+}
diff --git a/usr.bin/mkuzip/mkuzip.h b/usr.bin/mkuzip/mkuzip.h
new file mode 100644
index 0000000..f41507c
--- /dev/null
+++ b/usr.bin/mkuzip/mkuzip.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@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$
+ */
+
+#define DEFINE_RAW_METHOD(func, rval, args...) typedef rval (*func##_t)(args)
+
+void *mkuz_safe_malloc(size_t);
+void *mkuz_safe_zmalloc(size_t);
+int mkuz_memvcmp(const void *, unsigned char, size_t);
diff --git a/usr.bin/morse/Makefile b/usr.bin/morse/Makefile
new file mode 100644
index 0000000..4435422
--- /dev/null
+++ b/usr.bin/morse/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= morse
+MAN= morse.6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/morse/Makefile.depend b/usr.bin/morse/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/morse/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/morse/morse.6 b/usr.bin/morse/morse.6
new file mode 100644
index 0000000..94645bb
--- /dev/null
+++ b/usr.bin/morse/morse.6
@@ -0,0 +1,197 @@
+.\" Copyright (c) 2000 Alexey Zelkin. All rights reserved.
+.\" Copyright (c) 1988, 1991, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)bcd.6 8.1 (Berkeley) 5/31/93
+.\" $FreeBSD$
+.\"
+.Dd June 7, 2005
+.Dt MORSE 6
+.Os
+.Sh NAME
+.Nm morse
+.Nd reformat input as morse code
+.Sh SYNOPSIS
+.Nm
+.Op Fl elps
+.Op Fl d Ar device
+.Op Fl w Ar speed
+.Op Fl c Ar speed
+.Op Fl f Ar frequency
+.Op Ar string ...
+.Sh DESCRIPTION
+The
+.Nm
+command reads the given input and reformats it in the form of morse code.
+Acceptable input are command line arguments or the standard input.
+.Pp
+Available options:
+.Bl -tag -width indent
+.It Fl l
+The
+.Fl l
+option produces output suitable for
+.Xr led 4
+devices.
+.It Fl s
+The
+.Fl s
+option produces dots and dashes rather than words.
+.It Fl p
+Send morse the real way.
+This only works if your system has
+.Xr speaker 4
+support.
+.It Fl w Ar speed
+Set the sending speed in words per minute.
+If not specified, the default
+speed of 20 WPM is used.
+.It Fl c Ar speed
+Farnsworth support.
+Set the spacing between characters in words per minute.
+This is independent of the speed
+that the individual characters are sent.
+If not specified, defaults to the effective value of the
+.Fl w
+option.
+.It Fl f Ar frequency
+Set the sidetone frequency to something other than the default 600 Hz.
+.It Fl d Ar device
+Similar to
+.Fl p ,
+but use the RTS line of
+.Ar device
+(which must by a TTY device)
+in order to emit the morse code.
+.It Fl e
+Echo each character before it is sent, used together with either
+.Fl p
+or
+.Fl d .
+.El
+.Pp
+The
+.Fl w , c
+and
+.Fl f
+flags only work in conjunction with either the
+.Fl p
+or the
+.Fl d
+flag.
+.Pp
+Not all prosigns have corresponding characters.
+Use
+.Ql #
+for
+.Em AS ,
+.Ql &
+for
+.Em SK ,
+.Ql *
+for
+.Em VE
+and
+.Ql %
+for
+.Em BK .
+The more common prosigns are
+.Ql =
+for
+.Em BT ,
+.Ql \&(
+for
+.Em KN
+and
+.Ql +
+for
+.Em AR .
+.Pp
+Using the
+.Fl d
+flag,
+it is possible to key an external device, like a sidetone generator with
+a headset for training purposes, or even your ham radio transceiver.
+For
+the latter, simply connect an NPN transistor to the serial port
+.Ar device ,
+emitter connected to ground, base connected through a resistor
+(few kiloohms) to RTS, collector to the key line of your transceiver
+(assuming the transceiver has a positive key supply voltage and is keyed
+by grounding the key input line).
+A capacitor (some nanofarads) between
+base and ground is advisable to keep stray RF away,
+and to suppress the
+minor glitch that is generated during program startup.
+.Sh ENVIRONMENT
+Your
+.Ev LC_CTYPE
+locale codeset determines how
+characters with the high-order bit set
+are interpreted.
+.Pp
+.Bl -tag -width ".Li ISO8859-15" -compact
+.It Li ISO8859-1
+.It Li ISO8859-15
+Interpret characters with the high-order bit set as Western European characters.
+.Pp
+.It Li KOI8-R
+Interpret characters with the high-order bit set as Cyrillic characters.
+.Pp
+.It Li ISO8859-7
+Interpret characters with the high-order bit set as Greek characters.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/speaker" -compact
+.It Pa /dev/speaker
+.Xr speaker 4
+device file
+.El
+.Sh SEE ALSO
+.Xr speaker 4
+.Sh HISTORY
+Sound support for
+.Nm
+added by
+.An Lyndon Nerenberg (VE6BBM) Aq Mt lyndon@orthanc.ca .
+.Pp
+Ability to key an external device added by
+.An J\(:org Wunsch
+(DL8DTL).
+.Pp
+Farnsworth support for
+.Nm
+added by
+.An Stephen Cravey (N5UUU).
+.Sh BUGS
+Only understands a few European characters
+(German and French),
+no Asian characters,
+and no continental landline code.
+.Pp
+Sends a bit slower than it should due to system overhead.
+Some people would call this a feature.
diff --git a/usr.bin/morse/morse.c b/usr.bin/morse/morse.c
new file mode 100644
index 0000000..03a09a6
--- /dev/null
+++ b/usr.bin/morse/morse.c
@@ -0,0 +1,589 @@
+/*
+ * Copyright (c) 1988, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM)
+ * <lyndon@orthanc.ca>
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/time.h>
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+/* Always use the speaker, let the open fail if -p is selected */
+#define SPEAKER "/dev/speaker"
+
+#ifdef SPEAKER
+#include <dev/speaker/speaker.h>
+#endif
+
+struct morsetab {
+ const char inchar;
+ const char *morse;
+};
+
+static const struct morsetab mtab[] = {
+
+ /* letters */
+
+ {'a', ".-"},
+ {'b', "-..."},
+ {'c', "-.-."},
+ {'d', "-.."},
+ {'e', "."},
+ {'f', "..-."},
+ {'g', "--."},
+ {'h', "...."},
+ {'i', ".."},
+ {'j', ".---"},
+ {'k', "-.-"},
+ {'l', ".-.."},
+ {'m', "--"},
+ {'n', "-."},
+ {'o', "---"},
+ {'p', ".--."},
+ {'q', "--.-"},
+ {'r', ".-."},
+ {'s', "..."},
+ {'t', "-"},
+ {'u', "..-"},
+ {'v', "...-"},
+ {'w', ".--"},
+ {'x', "-..-"},
+ {'y', "-.--"},
+ {'z', "--.."},
+
+ /* digits */
+
+ {'0', "-----"},
+ {'1', ".----"},
+ {'2', "..---"},
+ {'3', "...--"},
+ {'4', "....-"},
+ {'5', "....."},
+ {'6', "-...."},
+ {'7', "--..."},
+ {'8', "---.."},
+ {'9', "----."},
+
+ /* punctuation */
+
+ {',', "--..--"},
+ {'.', ".-.-.-"},
+ {'"', ".-..-."},
+ {'!', "..--."},
+ {'?', "..--.."},
+ {'/', "-..-."},
+ {'-', "-....-"},
+ {'=', "-...-"}, /* BT */
+ {':', "---..."},
+ {';', "-.-.-."},
+ {'(', "-.--."}, /* KN */
+ {')', "-.--.-"},
+ {'$', "...-..-"},
+ {'+', ".-.-."}, /* AR */
+ {'@', ".--.-."}, /* AC */
+
+ /* prosigns without already assigned values */
+
+ {'#', ".-..."}, /* AS */
+ {'&', "...-.-"}, /* SK */
+ {'*', "...-."}, /* VE */
+ {'%', "-...-.-"}, /* BK */
+
+ {'\0', ""}
+};
+
+/*
+ * Code-points for some Latin1 chars in ISO-8859-1 encoding.
+ * UTF-8 encoded chars in the comments.
+ */
+static const struct morsetab iso8859_1tab[] = {
+ {'\340', ".--.-"}, /* à */
+ {'\341', ".--.-"}, /* á */
+ {'\342', ".--.-"}, /* â */
+ {'\344', ".-.-"}, /* ä */
+ {'\347', "-.-.."}, /* ç */
+ {'\350', "..-.."}, /* è */
+ {'\351', "..-.."}, /* é */
+ {'\352', "-..-."}, /* ê */
+ {'\366', "---."}, /* ö */
+ {'\374', "..--"}, /* ü */
+
+ {'\0', ""}
+};
+
+/*
+ * Code-points for some Greek chars in ISO-8859-7 encoding.
+ * UTF-8 encoded chars in the comments.
+ */
+static const struct morsetab iso8859_7tab[] = {
+ /*
+ * This table does not implement:
+ * - the special sequences for the seven diphthongs,
+ * - the punctuation differences.
+ * Implementing these features would introduce too many
+ * special-cases in the program's main loop.
+ * The diphthong sequences are:
+ * alpha iota .-.-
+ * alpha upsilon ..--
+ * epsilon upsilon ---.
+ * eta upsilon ...-
+ * omicron iota ---..
+ * omicron upsilon ..-
+ * upsilon iota .---
+ * The different punctuation symbols are:
+ * ; ..-.-
+ * ! --..--
+ */
+ {'\341', ".-"}, /* α, alpha */
+ {'\334', ".-"}, /* ά, alpha with acute */
+ {'\342', "-..."}, /* β, beta */
+ {'\343', "--."}, /* γ, gamma */
+ {'\344', "-.."}, /* δ, delta */
+ {'\345', "."}, /* ε, epsilon */
+ {'\335', "."}, /* έ, epsilon with acute */
+ {'\346', "--.."}, /* ζ, zeta */
+ {'\347', "...."}, /* η, eta */
+ {'\336', "...."}, /* ή, eta with acute */
+ {'\350', "-.-."}, /* θ, theta */
+ {'\351', ".."}, /* ι, iota */
+ {'\337', ".."}, /* ί, iota with acute */
+ {'\372', ".."}, /* ÏŠ, iota with diaeresis */
+ {'\300', ".."}, /* Î, iota with acute and diaeresis */
+ {'\352', "-.-"}, /* κ, kappa */
+ {'\353', ".-.."}, /* λ, lambda */
+ {'\354', "--"}, /* μ, mu */
+ {'\355', "-."}, /* ν, nu */
+ {'\356', "-..-"}, /* ξ, xi */
+ {'\357', "---"}, /* ο, omicron */
+ {'\374', "---"}, /* ό, omicron with acute */
+ {'\360', ".--."}, /* π, pi */
+ {'\361', ".-."}, /* Ï, rho */
+ {'\363', "..."}, /* σ, sigma */
+ {'\362', "..."}, /* Ï‚, final sigma */
+ {'\364', "-"}, /* Ï„, tau */
+ {'\365', "-.--"}, /* Ï…, upsilon */
+ {'\375', "-.--"}, /* Ï, upsilon with acute */
+ {'\373', "-.--"}, /* Ï‹, upsilon and diaeresis */
+ {'\340', "-.--"}, /* ΰ, upsilon with acute and diaeresis */
+ {'\366', "..-."}, /* φ, phi */
+ {'\367', "----"}, /* χ, chi */
+ {'\370', "--.-"}, /* ψ, psi */
+ {'\371', ".--"}, /* ω, omega */
+ {'\376', ".--"}, /* ÏŽ, omega with acute */
+
+ {'\0', ""}
+};
+
+/*
+ * Code-points for the Cyrillic alphabet in KOI8-R encoding.
+ * UTF-8 encoded chars in the comments.
+ */
+static const struct morsetab koi8rtab[] = {
+ {'\301', ".-"}, /* а, a */
+ {'\302', "-..."}, /* б, be */
+ {'\327', ".--"}, /* в, ve */
+ {'\307', "--."}, /* г, ge */
+ {'\304', "-.."}, /* д, de */
+ {'\305', "."}, /* е, ye */
+ {'\243', "."}, /* Ñ‘, yo, the same as ye */
+ {'\326', "...-"}, /* ж, she */
+ {'\332', "--.."}, /* з, ze */
+ {'\311', ".."}, /* и, i */
+ {'\312', ".---"}, /* й, i kratkoye */
+ {'\313', "-.-"}, /* к, ka */
+ {'\314', ".-.."}, /* л, el */
+ {'\315', "--"}, /* м, em */
+ {'\316', "-."}, /* н, en */
+ {'\317', "---"}, /* о, o */
+ {'\320', ".--."}, /* п, pe */
+ {'\322', ".-."}, /* р, er */
+ {'\323', "..."}, /* Ñ, es */
+ {'\324', "-"}, /* Ñ‚, te */
+ {'\325', "..-"}, /* у, u */
+ {'\306', "..-."}, /* Ñ„, ef */
+ {'\310', "...."}, /* Ñ…, kha */
+ {'\303', "-.-."}, /* ц, ce */
+ {'\336', "---."}, /* ч, che */
+ {'\333', "----"}, /* ш, sha */
+ {'\335', "--.-"}, /* щ, shcha */
+ {'\331', "-.--"}, /* Ñ‹, yi */
+ {'\330', "-..-"}, /* ь, myakhkij znak */
+ {'\334', "..-.."}, /* Ñ, ae */
+ {'\300', "..--"}, /* ÑŽ, yu */
+ {'\321', ".-.-"}, /* Ñ, ya */
+
+ {'\0', ""}
+};
+
+static void show(const char *), play(const char *), morse(char);
+static void ttyout(const char *);
+static void sighandler(int);
+
+#define GETOPTOPTS "c:d:ef:lsw:"
+#define USAGE \
+"usage: morse [-els] [-d device] [-w speed] [-c speed] [-f frequency] [string ...]\n"
+
+static int pflag, lflag, sflag, eflag;
+static int wpm = 20; /* effective words per minute */
+static int cpm; /* effective words per minute between
+ * characters */
+#define FREQUENCY 600
+static int freq = FREQUENCY;
+static char *device; /* for tty-controlled generator */
+
+#define DASH_LEN 3
+#define CHAR_SPACE 3
+#define WORD_SPACE (7 - CHAR_SPACE - 1)
+static float dot_clock;
+static float cdot_clock;
+static int spkr, line;
+static struct termios otty, ntty;
+static int olflags;
+
+#ifdef SPEAKER
+static tone_t sound;
+#undef GETOPTOPTS
+#define GETOPTOPTS "c:d:ef:lpsw:"
+#undef USAGE
+#define USAGE \
+"usage: morse [-elps] [-d device] [-w speed] [-c speed] [-f frequency] [string ...]\n"
+#endif
+
+static const struct morsetab *hightab;
+
+int
+main(int argc, char **argv)
+{
+ int ch, lflags;
+ char *p, *codeset;
+
+ while ((ch = getopt(argc, argv, GETOPTOPTS)) != -1)
+ switch ((char) ch) {
+ case 'c':
+ cpm = atoi(optarg);
+ break;
+ case 'd':
+ device = optarg;
+ break;
+ case 'e':
+ eflag = 1;
+ setvbuf(stdout, 0, _IONBF, 0);
+ break;
+ case 'f':
+ freq = atoi(optarg);
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+#ifdef SPEAKER
+ case 'p':
+ pflag = 1;
+ break;
+#endif
+ case 's':
+ sflag = 1;
+ break;
+ case 'w':
+ wpm = atoi(optarg);
+ break;
+ case '?':
+ default:
+ fputs(USAGE, stderr);
+ exit(1);
+ }
+ if (sflag && lflag) {
+ fputs("morse: only one of -l and -s allowed\n", stderr);
+ exit(1);
+ }
+ if ((pflag || device) && (sflag || lflag)) {
+ fputs("morse: only one of -p, -d and -l, -s allowed\n", stderr);
+ exit(1);
+ }
+ if (cpm == 0)
+ cpm = wpm;
+ if ((pflag || device) && ((wpm < 1) || (wpm > 60) || (cpm < 1) || (cpm > 60))) {
+ fputs("morse: insane speed\n", stderr);
+ exit(1);
+ }
+ if ((pflag || device) && (freq == 0))
+ freq = FREQUENCY;
+
+#ifdef SPEAKER
+ if (pflag) {
+ if ((spkr = open(SPEAKER, O_WRONLY, 0)) == -1) {
+ perror(SPEAKER);
+ exit(1);
+ }
+ } else
+#endif
+ if (device) {
+ if ((line = open(device, O_WRONLY | O_NONBLOCK)) == -1) {
+ perror("open tty line");
+ exit(1);
+ }
+ if (tcgetattr(line, &otty) == -1) {
+ perror("tcgetattr() failed");
+ exit(1);
+ }
+ ntty = otty;
+ ntty.c_cflag |= CLOCAL;
+ tcsetattr(line, TCSANOW, &ntty);
+ lflags = fcntl(line, F_GETFL);
+ lflags &= ~O_NONBLOCK;
+ fcntl(line, F_SETFL, &lflags);
+ ioctl(line, TIOCMGET, &lflags);
+ lflags &= ~TIOCM_RTS;
+ olflags = lflags;
+ ioctl(line, TIOCMSET, &lflags);
+ (void)signal(SIGHUP, sighandler);
+ (void)signal(SIGINT, sighandler);
+ (void)signal(SIGQUIT, sighandler);
+ (void)signal(SIGTERM, sighandler);
+ }
+ if (pflag || device) {
+ dot_clock = wpm / 2.4; /* dots/sec */
+ dot_clock = 1 / dot_clock; /* duration of a dot */
+ dot_clock = dot_clock / 2; /* dot_clock runs at twice */
+ /* the dot rate */
+ dot_clock = dot_clock * 100; /* scale for ioctl */
+
+ cdot_clock = cpm / 2.4; /* dots/sec */
+ cdot_clock = 1 / cdot_clock; /* duration of a dot */
+ cdot_clock = cdot_clock / 2; /* dot_clock runs at twice */
+ /* the dot rate */
+ cdot_clock = cdot_clock * 100; /* scale for ioctl */
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (setlocale(LC_CTYPE, "") != NULL &&
+ *(codeset = nl_langinfo(CODESET)) != '\0') {
+ if (strcmp(codeset, "KOI8-R") == 0)
+ hightab = koi8rtab;
+ else if (strcmp(codeset, "ISO8859-1") == 0 ||
+ strcmp(codeset, "ISO8859-15") == 0)
+ hightab = iso8859_1tab;
+ else if (strcmp(codeset, "ISO8859-7") == 0)
+ hightab = iso8859_7tab;
+ }
+
+ if (lflag)
+ printf("m");
+ if (*argv) {
+ do {
+ for (p = *argv; *p; ++p) {
+ if (eflag)
+ putchar(*p);
+ morse(*p);
+ }
+ if (eflag)
+ putchar(' ');
+ morse(' ');
+ } while (*++argv);
+ } else {
+ while ((ch = getchar()) != EOF) {
+ if (eflag)
+ putchar(ch);
+ morse(ch);
+ }
+ }
+ if (device)
+ tcsetattr(line, TCSANOW, &otty);
+ exit(0);
+}
+
+static void
+morse(char c)
+{
+ const struct morsetab *m;
+
+ if (isalpha((unsigned char)c))
+ c = tolower((unsigned char)c);
+ if ((c == '\r') || (c == '\n'))
+ c = ' ';
+ if (c == ' ') {
+ if (pflag)
+ play(" ");
+ else if (device)
+ ttyout(" ");
+ else if (lflag)
+ printf("\n");
+ else
+ show("");
+ return;
+ }
+ for (m = ((unsigned char)c < 0x80? mtab: hightab);
+ m != NULL && m->inchar != '\0';
+ m++) {
+ if (m->inchar == c) {
+ if (pflag) {
+ play(m->morse);
+ } else if (device) {
+ ttyout(m->morse);
+ } else
+ show(m->morse);
+ }
+ }
+}
+
+static void
+show(const char *s)
+{
+ if (lflag) {
+ printf("%s ", s);
+ } else if (sflag) {
+ printf(" %s\n", s);
+ } else {
+ for (; *s; ++s)
+ printf(" %s", *s == '.' ? *(s + 1) == '\0' ? "dit" :
+ "di" : "dah");
+ printf("\n");
+ }
+}
+
+static void
+play(const char *s)
+{
+#ifdef SPEAKER
+ const char *c;
+
+ for (c = s; *c != '\0'; c++) {
+ switch (*c) {
+ case '.':
+ sound.frequency = freq;
+ sound.duration = dot_clock;
+ break;
+ case '-':
+ sound.frequency = freq;
+ sound.duration = dot_clock * DASH_LEN;
+ break;
+ case ' ':
+ sound.frequency = 0;
+ sound.duration = cdot_clock * WORD_SPACE;
+ break;
+ default:
+ sound.duration = 0;
+ }
+ if (sound.duration) {
+ if (ioctl(spkr, SPKRTONE, &sound) == -1) {
+ perror("ioctl play");
+ exit(1);
+ }
+ }
+ sound.frequency = 0;
+ sound.duration = dot_clock;
+ if (ioctl(spkr, SPKRTONE, &sound) == -1) {
+ perror("ioctl rest");
+ exit(1);
+ }
+ }
+ sound.frequency = 0;
+ sound.duration = cdot_clock * CHAR_SPACE;
+ ioctl(spkr, SPKRTONE, &sound);
+#endif
+}
+
+static void
+ttyout(const char *s)
+{
+ const char *c;
+ int duration, on, lflags;
+
+ for (c = s; *c != '\0'; c++) {
+ switch (*c) {
+ case '.':
+ on = 1;
+ duration = dot_clock;
+ break;
+ case '-':
+ on = 1;
+ duration = dot_clock * DASH_LEN;
+ break;
+ case ' ':
+ on = 0;
+ duration = cdot_clock * WORD_SPACE;
+ break;
+ default:
+ on = 0;
+ duration = 0;
+ }
+ if (on) {
+ ioctl(line, TIOCMGET, &lflags);
+ lflags |= TIOCM_RTS;
+ ioctl(line, TIOCMSET, &lflags);
+ }
+ duration *= 10000;
+ if (duration)
+ usleep(duration);
+ ioctl(line, TIOCMGET, &lflags);
+ lflags &= ~TIOCM_RTS;
+ ioctl(line, TIOCMSET, &lflags);
+ duration = dot_clock * 10000;
+ usleep(duration);
+ }
+ duration = cdot_clock * CHAR_SPACE * 10000;
+ usleep(duration);
+}
+
+static void
+sighandler(int signo)
+{
+
+ ioctl(line, TIOCMSET, &olflags);
+ tcsetattr(line, TCSANOW, &otty);
+
+ signal(signo, SIG_DFL);
+ (void)kill(getpid(), signo);
+}
diff --git a/usr.bin/msgs/Makefile b/usr.bin/msgs/Makefile
new file mode 100644
index 0000000..3af95c3
--- /dev/null
+++ b/usr.bin/msgs/Makefile
@@ -0,0 +1,8 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= msgs
+
+LIBADD= ncursesw
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/msgs/Makefile.depend b/usr.bin/msgs/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/msgs/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/msgs/msgs.1 b/usr.bin/msgs/msgs.1
new file mode 100644
index 0000000..7eebde6
--- /dev/null
+++ b/usr.bin/msgs/msgs.1
@@ -0,0 +1,232 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)msgs.1 8.2 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd April 28, 1995
+.Dt MSGS 1
+.Os
+.Sh NAME
+.Nm msgs
+.Nd system messages and junk mail program
+.Sh SYNOPSIS
+.Nm
+.Op Fl fhlpq
+.Op Ar number
+.Op Ar \-number
+.Nm
+.Op Fl s
+.Nm
+.Op Fl c
+.Op \-days
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to read system messages.
+These messages are
+sent by mailing to the login `msgs' and should be short
+pieces of information which are suitable to be read once by most users
+of the system.
+.Pp
+The
+.Nm
+utility is normally invoked each time you login, by placing it in the file
+.Pa .login
+(or
+.Pa .profile
+if you use
+.Xr sh 1 ) .
+It will then prompt you with the source and subject of each new message.
+If there is no subject line, the first few non-blank lines of the
+message will be displayed.
+If there is more to the message, you will be told how
+long it is and asked whether you wish to see the rest of the message.
+The possible responses are:
+.Bl -tag -width Fl
+.It Fl y
+Type the rest of the message.
+.It Ic RETURN
+Synonym for y.
+.It Fl n
+Skip this message
+and go on to the next message.
+.It Fl
+Redisplay the last message.
+.It Fl q
+Drop out of
+.Nm ;
+the next time
+.Nm
+will pick up where it last left off.
+.It Fl s
+Append the current message to the file ``Messages'' in the current directory;
+`s\-' will save the previously displayed message.
+A `s' or `s\-' may
+be followed by a space and a file name to receive the message replacing
+the default ``Messages''.
+.It Fl m
+A copy of the specified message is placed in a temporary
+mailbox and
+.Xr mail 1
+is invoked on that mailbox.
+Both `m' and `s' accept a numeric argument in place of the `\-'.
+.El
+.Pp
+The
+.Nm
+utility keeps track of the next message you will see by a number in the file
+.Pa \&.msgsrc
+in your home directory.
+In the directory
+.Pa /var/msgs
+it keeps a set of files whose names are the (sequential) numbers
+of the messages they represent.
+The file
+.Pa /var/msgs/bounds
+shows the low and high number of the messages in the directory
+so that
+.Nm
+can quickly determine if there are no messages for you.
+If the contents of
+.Pa bounds
+is incorrect it can be fixed by removing it;
+.Nm
+will make a new
+.Pa bounds
+file the next time it is run with the
+.Fl s
+option.
+If
+.Nm
+is run with any option other than
+.Fl s ,
+an error will be displayed if
+.Pa /var/msgs/bounds
+does not exist.
+.Pp
+The
+.Fl s
+option is used for setting up the posting of messages.
+The line
+.Pp
+.Dl msgs: \&"\&| /usr/bin/msgs \-s\&"
+.Pp
+should be included in
+.Pa /etc/mail/aliases
+(see
+.Xr newaliases 1 )
+to enable posting of messages.
+.Pp
+The
+.Fl c
+option is used for performing cleanup on
+.Pa /var/msgs .
+A shell script entry to run
+.Nm
+with the
+.Fl c
+option should be placed in
+.Pa /etc/periodic/daily
+(see
+.Xr periodic 8 )
+to run every night.
+This will remove all messages over 21 days old.
+A different expiration may be specified on the command line to override
+the default.
+You must be the superuser to use this option.
+.Pp
+Options when reading messages include:
+.Bl -tag -width Fl
+.It Fl f
+Do not say ``No new messages.''.
+This is useful in a
+.Pa .login
+file since this is often the case here.
+.It Fl q
+Queries whether there are messages, printing
+``There are new messages.'' if there are.
+The command ``msgs \-q'' is often used in login scripts.
+.It Fl h
+Print the first part of messages only.
+.It Fl l
+Cause only locally originated messages to be reported.
+.It Ar num
+A message number can be given
+on the command line, causing
+.Nm
+to start at the specified message rather than at the next message
+indicated by your
+.Pa \&.msgsrc
+file.
+Thus
+.Pp
+.Dl msgs \-h 1
+.Pp
+prints the first part of all messages.
+.It Ar \-number
+Start
+.Ar number
+messages back from the one indicated in the
+.Pa \&.msgsrc
+file, useful for reviews of recent messages.
+.It Fl p
+Pipe long messages through
+.Xr more 1 .
+.El
+.Pp
+Within
+.Nm
+you can also go to any specific message by typing its number when
+.Nm
+requests input as to what to do.
+.Sh ENVIRONMENT
+The
+.Nm
+utility uses the
+.Ev HOME
+and
+.Ev TERM
+environment variables for the default home directory and
+terminal type.
+.Sh FILES
+.Bl -tag -width /var/msgs/* -compact
+.It Pa /var/msgs/*
+database
+.It Pa ~/.msgsrc
+number of next message to be presented
+.El
+.Sh SEE ALSO
+.Xr mail 1 ,
+.Xr more 1 ,
+.Xr aliases 5 ,
+.Xr periodic 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
new file mode 100644
index 0000000..832e86a
--- /dev/null
+++ b/usr.bin/msgs/msgs.c
@@ -0,0 +1,911 @@
+/*-
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * msgs - a user bulletin board program
+ *
+ * usage:
+ * msgs [fhlopq] [[-]number] to read messages
+ * msgs -s to place messages
+ * msgs -c [-days] to clean up the bulletin board
+ *
+ * prompt commands are:
+ * y print message
+ * n flush message, go to next message
+ * q flush message, quit
+ * p print message, turn on 'pipe thru more' mode
+ * P print message, turn off 'pipe thru more' mode
+ * - reprint last message
+ * s[-][<num>] [<filename>] save message
+ * m[-][<num>] mail with message in temp mbox
+ * x exit without flushing this message
+ * <num> print message number <num>
+ */
+
+#define V7 /* will look for TERM in the environment */
+#define OBJECT /* will object to messages without Subjects */
+/* #define REJECT */ /* will reject messages without Subjects
+ (OBJECT must be defined also) */
+/* #define UNBUFFERED *//* use unbuffered output */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <termcap.h>
+#include <termios.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include "pathnames.h"
+
+#define CMODE 0644 /* bounds file creation mode */
+#define NO 0
+#define YES 1
+#define SUPERUSER 0 /* superuser uid */
+#define DAEMON 1 /* daemon uid */
+#define NLINES 24 /* default number of lines/crt screen */
+#define NDAYS 21 /* default keep time for messages */
+#define DAYS *24*60*60 /* seconds/day */
+#define MSGSRC ".msgsrc" /* user's rc file */
+#define BOUNDS "bounds" /* message bounds file */
+#define NEXT "Next message? [yq]"
+#define MORE "More? [ynq]"
+#define NOMORE "(No more) [q] ?"
+
+typedef char bool;
+
+static FILE *msgsrc;
+static FILE *newmsg;
+static const char *sep = "-";
+static char inbuf[BUFSIZ];
+static char fname[MAXPATHLEN];
+static char cmdbuf[MAXPATHLEN + MAXPATHLEN];
+static char subj[128];
+static char from[128];
+static char date[128];
+static char *ptr;
+static char *in;
+static bool local;
+static bool ruptible;
+static bool totty;
+static bool seenfrom;
+static bool seensubj;
+static bool blankline;
+static bool printing = NO;
+static bool mailing = NO;
+static bool quitit = NO;
+static bool sending = NO;
+static bool intrpflg = NO;
+static uid_t uid;
+static int msg;
+static int prevmsg;
+static int lct;
+static int nlines;
+static int Lpp = 0;
+static time_t t;
+static time_t keep;
+
+/* option initialization */
+static bool hdrs = NO;
+static bool qopt = NO;
+static bool hush = NO;
+static bool send_msg = NO;
+static bool locomode = NO;
+static bool use_pager = NO;
+static bool clean = NO;
+static bool lastcmd = NO;
+static jmp_buf tstpbuf;
+
+static void ask(const char *);
+static void gfrsub(FILE *);
+static int linecnt(FILE *);
+static int next(char *);
+static char *nxtfld(char *);
+static void onsusp(int);
+static void onintr(int);
+static void prmesg(int);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ bool newrc, already;
+ int rcfirst = 0; /* first message to print (from .rc) */
+ int rcback = 0; /* amount to back off of rcfirst */
+ int firstmsg = 0, nextmsg = 0, lastmsg = 0;
+ int blast = 0;
+ struct stat buf; /* stat to check access of bounds */
+ FILE *bounds;
+ char *cp;
+
+#ifdef UNBUFFERED
+ setbuf(stdout, NULL);
+#endif
+ setlocale(LC_ALL, "");
+
+ time(&t);
+ if (setuid(uid = getuid()) != 0)
+ err(1, "setuid failed");
+ ruptible = (signal(SIGINT, SIG_IGN) == SIG_DFL);
+ if (ruptible)
+ signal(SIGINT, SIG_DFL);
+
+ argc--, argv++;
+ while (argc > 0) {
+ if (isdigit(argv[0][0])) { /* starting message # */
+ rcfirst = atoi(argv[0]);
+ }
+ else if (isdigit(argv[0][1])) { /* backward offset */
+ rcback = atoi( &( argv[0][1] ) );
+ }
+ else {
+ ptr = *argv;
+ while (*ptr) switch (*ptr++) {
+
+ case '-':
+ break;
+
+ case 'c':
+ if (uid != SUPERUSER && uid != DAEMON)
+ errx(1,
+ "only the super-user can use the c flag");
+ clean = YES;
+ break;
+
+ case 'f': /* silently */
+ hush = YES;
+ break;
+
+ case 'h': /* headers only */
+ hdrs = YES;
+ break;
+
+ case 'l': /* local msgs only */
+ locomode = YES;
+ break;
+
+ case 'o': /* option to save last message */
+ lastcmd = YES;
+ break;
+
+ case 'p': /* pipe thru 'more' during long msgs */
+ use_pager = YES;
+ break;
+
+ case 'q': /* query only */
+ qopt = YES;
+ break;
+
+ case 's': /* sending TO msgs */
+ send_msg = YES;
+ break;
+
+ default:
+ usage();
+ }
+ }
+ argc--, argv++;
+ }
+
+ /*
+ * determine current message bounds
+ */
+ snprintf(fname, sizeof(fname), "%s/%s", _PATH_MSGS, BOUNDS);
+
+ /*
+ * Test access rights to the bounds file
+ * This can be a little tricky. if(send_msg), then
+ * we will create it. We assume that if(send_msg),
+ * then you have write permission there.
+ * Else, it better be there, or we bail.
+ */
+ if (send_msg != YES) {
+ if (stat(fname, &buf) < 0) {
+ if (hush != YES) {
+ err(errno, "%s", fname);
+ } else {
+ exit(1);
+ }
+ }
+ }
+ bounds = fopen(fname, "r");
+
+ if (bounds != NULL) {
+ fscanf(bounds, "%d %d\n", &firstmsg, &lastmsg);
+ fclose(bounds);
+ blast = lastmsg; /* save upper bound */
+ }
+
+ if (clean)
+ keep = t - (rcback? rcback : NDAYS) DAYS;
+
+ if (clean || bounds == NULL) { /* relocate message bounds */
+ struct dirent *dp;
+ struct stat stbuf;
+ bool seenany = NO;
+ DIR *dirp;
+
+ dirp = opendir(_PATH_MSGS);
+ if (dirp == NULL)
+ err(errno, "%s", _PATH_MSGS);
+
+ firstmsg = 32767;
+ lastmsg = 0;
+
+ for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)){
+ cp = dp->d_name;
+ int i = 0;
+
+ if (dp->d_ino == 0)
+ continue;
+ if (dp->d_namlen == 0)
+ continue;
+
+ if (clean)
+ snprintf(inbuf, sizeof(inbuf), "%s/%s", _PATH_MSGS, cp);
+
+ while (isdigit(*cp))
+ i = i * 10 + *cp++ - '0';
+ if (*cp)
+ continue; /* not a message! */
+
+ if (clean) {
+ if (stat(inbuf, &stbuf) != 0)
+ continue;
+ if (stbuf.st_mtime < keep
+ && stbuf.st_mode&S_IWRITE) {
+ unlink(inbuf);
+ continue;
+ }
+ }
+
+ if (i > lastmsg)
+ lastmsg = i;
+ if (i < firstmsg)
+ firstmsg = i;
+ seenany = YES;
+ }
+ closedir(dirp);
+
+ if (!seenany) {
+ if (blast != 0) /* never lower the upper bound! */
+ lastmsg = blast;
+ firstmsg = lastmsg + 1;
+ }
+ else if (blast > lastmsg)
+ lastmsg = blast;
+
+ if (!send_msg) {
+ bounds = fopen(fname, "w");
+ if (bounds == NULL)
+ err(errno, "%s", fname);
+ chmod(fname, CMODE);
+ fprintf(bounds, "%d %d\n", firstmsg, lastmsg);
+ fclose(bounds);
+ }
+ }
+
+ if (send_msg) {
+ /*
+ * Send mode - place msgs in _PATH_MSGS
+ */
+ bounds = fopen(fname, "w");
+ if (bounds == NULL)
+ err(errno, "%s", fname);
+
+ nextmsg = lastmsg + 1;
+ snprintf(fname, sizeof(fname), "%s/%d", _PATH_MSGS, nextmsg);
+ newmsg = fopen(fname, "w");
+ if (newmsg == NULL)
+ err(errno, "%s", fname);
+ chmod(fname, CMODE);
+
+ fprintf(bounds, "%d %d\n", firstmsg, nextmsg);
+ fclose(bounds);
+
+ sending = YES;
+ if (ruptible)
+ signal(SIGINT, onintr);
+
+ if (isatty(fileno(stdin))) {
+ ptr = getpwuid(uid)->pw_name;
+ printf("Message %d:\nFrom %s %sSubject: ",
+ nextmsg, ptr, ctime(&t));
+ fflush(stdout);
+ fgets(inbuf, sizeof inbuf, stdin);
+ putchar('\n');
+ fflush(stdout);
+ fprintf(newmsg, "From %s %sSubject: %s\n",
+ ptr, ctime(&t), inbuf);
+ blankline = seensubj = YES;
+ }
+ else
+ blankline = seensubj = NO;
+ for (;;) {
+ fgets(inbuf, sizeof inbuf, stdin);
+ if (feof(stdin) || ferror(stdin))
+ break;
+ blankline = (blankline || (inbuf[0] == '\n'));
+ seensubj = (seensubj || (!blankline && (strncmp(inbuf, "Subj", 4) == 0)));
+ fputs(inbuf, newmsg);
+ }
+#ifdef OBJECT
+ if (!seensubj) {
+ printf("NOTICE: Messages should have a Subject field!\n");
+#ifdef REJECT
+ unlink(fname);
+#endif
+ exit(1);
+ }
+#endif
+ exit(ferror(stdin));
+ }
+ if (clean)
+ exit(0);
+
+ /*
+ * prepare to display messages
+ */
+ totty = (isatty(fileno(stdout)) != 0);
+ use_pager = use_pager && totty;
+
+ if ((cp = getenv("HOME")) == NULL || *cp == '\0') {
+ fprintf(stderr, "Error, no home directory!\n");
+ exit(1);
+ }
+ snprintf(fname, sizeof(fname), "%s/%s", cp, MSGSRC);
+ msgsrc = fopen(fname, "r");
+ if (msgsrc) {
+ newrc = NO;
+ fscanf(msgsrc, "%d\n", &nextmsg);
+ fclose(msgsrc);
+ if (nextmsg > lastmsg+1) {
+ printf("Warning: bounds have been reset (%d, %d)\n",
+ firstmsg, lastmsg);
+ truncate(fname, (off_t)0);
+ newrc = YES;
+ }
+ else if (!rcfirst)
+ rcfirst = nextmsg - rcback;
+ }
+ else
+ newrc = YES;
+ msgsrc = fopen(fname, "r+");
+ if (msgsrc == NULL)
+ msgsrc = fopen(fname, "w");
+ if (msgsrc == NULL)
+ err(errno, "%s", fname);
+ if (rcfirst) {
+ if (rcfirst > lastmsg+1) {
+ printf("Warning: the last message is number %d.\n",
+ lastmsg);
+ rcfirst = nextmsg;
+ }
+ if (rcfirst > firstmsg)
+ firstmsg = rcfirst; /* don't set below first msg */
+ }
+ if (newrc) {
+ nextmsg = firstmsg;
+ rewind(msgsrc);
+ fprintf(msgsrc, "%d\n", nextmsg);
+ fflush(msgsrc);
+ }
+
+#ifdef V7
+ if (totty) {
+ struct winsize win;
+ if (ioctl(fileno(stdout), TIOCGWINSZ, &win) != -1)
+ Lpp = win.ws_row;
+ if (Lpp <= 0) {
+ if (tgetent(inbuf, getenv("TERM")) <= 0
+ || (Lpp = tgetnum("li")) <= 0) {
+ Lpp = NLINES;
+ }
+ }
+ }
+#endif
+ Lpp -= 6; /* for headers, etc. */
+
+ already = NO;
+ prevmsg = firstmsg;
+ printing = YES;
+ if (ruptible)
+ signal(SIGINT, onintr);
+
+ /*
+ * Main program loop
+ */
+ for (msg = firstmsg; msg <= lastmsg; msg++) {
+
+ snprintf(fname, sizeof(fname), "%s/%d", _PATH_MSGS, msg);
+ newmsg = fopen(fname, "r");
+ if (newmsg == NULL)
+ continue;
+
+ gfrsub(newmsg); /* get From and Subject fields */
+ if (locomode && !local) {
+ fclose(newmsg);
+ continue;
+ }
+
+ if (qopt) { /* This has to be located here */
+ printf("There are new messages.\n");
+ exit(0);
+ }
+
+ if (already && !hdrs)
+ putchar('\n');
+
+ /*
+ * Print header
+ */
+ if (totty)
+ signal(SIGTSTP, onsusp);
+ (void) setjmp(tstpbuf);
+ already = YES;
+ nlines = 2;
+ if (seenfrom) {
+ printf("Message %d:\nFrom %s %s", msg, from, date);
+ nlines++;
+ }
+ if (seensubj) {
+ printf("Subject: %s", subj);
+ nlines++;
+ }
+ else {
+ if (seenfrom) {
+ putchar('\n');
+ nlines++;
+ }
+ while (nlines < 6
+ && fgets(inbuf, sizeof inbuf, newmsg)
+ && inbuf[0] != '\n') {
+ fputs(inbuf, stdout);
+ nlines++;
+ }
+ }
+
+ lct = linecnt(newmsg);
+ if (lct)
+ printf("(%d%sline%s) ", lct, seensubj? " " : " more ",
+ (lct == 1) ? "" : "s");
+
+ if (hdrs) {
+ printf("\n-----\n");
+ fclose(newmsg);
+ continue;
+ }
+
+ /*
+ * Ask user for command
+ */
+ if (totty)
+ ask(lct? MORE : (msg==lastmsg? NOMORE : NEXT));
+ else
+ inbuf[0] = 'y';
+ if (totty)
+ signal(SIGTSTP, SIG_DFL);
+cmnd:
+ in = inbuf;
+ switch (*in) {
+ case 'x':
+ /* FALLTHROUGH */
+ case 'X':
+ exit(0);
+ /* NOTREACHED */
+
+ case 'q':
+ /* FALLTHROUGH */
+ case 'Q':
+ quitit = YES;
+ printf("--Postponed--\n");
+ exit(0);
+ /* NOTREACHED */
+
+ case 'n':
+ /* FALLTHROUGH */
+ case 'N':
+ if (msg >= nextmsg) sep = "Flushed";
+ prevmsg = msg;
+ break;
+
+ case 'p':
+ /* FALLTHROUGH */
+ case 'P':
+ use_pager = (*in++ == 'p');
+ /* FALLTHROUGH */
+ case '\n':
+ /* FALLTHROUGH */
+ case 'y':
+ default:
+ if (*in == '-') {
+ msg = prevmsg-1;
+ sep = "replay";
+ break;
+ }
+ if (isdigit(*in)) {
+ msg = next(in);
+ sep = in;
+ break;
+ }
+
+ prmesg(nlines + lct + (seensubj? 1 : 0));
+ prevmsg = msg;
+
+ }
+
+ printf("--%s--\n", sep);
+ sep = "-";
+ if (msg >= nextmsg) {
+ nextmsg = msg + 1;
+ rewind(msgsrc);
+ fprintf(msgsrc, "%d\n", nextmsg);
+ fflush(msgsrc);
+ }
+ if (newmsg)
+ fclose(newmsg);
+ if (quitit)
+ break;
+ }
+
+ /*
+ * Make sure .rc file gets updated
+ */
+ if (--msg >= nextmsg) {
+ nextmsg = msg + 1;
+ rewind(msgsrc);
+ fprintf(msgsrc, "%d\n", nextmsg);
+ fflush(msgsrc);
+ }
+ if (already && !quitit && lastcmd && totty) {
+ /*
+ * save or reply to last message?
+ */
+ msg = prevmsg;
+ ask(NOMORE);
+ if (inbuf[0] == '-' || isdigit(inbuf[0]))
+ goto cmnd;
+ }
+ if (!(already || hush || qopt))
+ printf("No new messages.\n");
+ exit(0);
+ /* NOTREACHED */
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: msgs [fhlopq] [[-]number]\n");
+ exit(1);
+}
+
+static void
+prmesg(int length)
+{
+ FILE *outf;
+ char *env_pager;
+
+ if (use_pager && length > Lpp) {
+ signal(SIGPIPE, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ if ((env_pager = getenv("PAGER")) == NULL) {
+ snprintf(cmdbuf, sizeof(cmdbuf), _PATH_PAGER, Lpp);
+ } else {
+ snprintf(cmdbuf, sizeof(cmdbuf), "%s", env_pager);
+ }
+ outf = popen(cmdbuf, "w");
+ if (!outf)
+ outf = stdout;
+ else
+ setbuf(outf, (char *)NULL);
+ }
+ else
+ outf = stdout;
+
+ if (seensubj)
+ putc('\n', outf);
+
+ while (fgets(inbuf, sizeof inbuf, newmsg)) {
+ fputs(inbuf, outf);
+ if (ferror(outf)) {
+ clearerr(outf);
+ break;
+ }
+ }
+
+ if (outf != stdout) {
+ pclose(outf);
+ signal(SIGPIPE, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ }
+ else {
+ fflush(stdout);
+ }
+
+ /* force wait on output */
+ tcdrain(fileno(stdout));
+}
+
+static void
+onintr(int unused __unused)
+{
+ signal(SIGINT, onintr);
+ if (mailing)
+ unlink(fname);
+ if (sending) {
+ unlink(fname);
+ puts("--Killed--");
+ exit(1);
+ }
+ if (printing) {
+ putchar('\n');
+ if (hdrs)
+ exit(0);
+ sep = "Interrupt";
+ if (newmsg)
+ fseeko(newmsg, (off_t)0, SEEK_END);
+ intrpflg = YES;
+ }
+}
+
+/*
+ * We have just gotten a susp. Suspend and prepare to resume.
+ */
+static void
+onsusp(int unused __unused)
+{
+ signal(SIGTSTP, SIG_DFL);
+ sigsetmask(0);
+ kill(0, SIGTSTP);
+ signal(SIGTSTP, onsusp);
+ if (!mailing)
+ longjmp(tstpbuf, 0);
+}
+
+static int
+linecnt(FILE *f)
+{
+ off_t oldpos = ftello(f);
+ int l = 0;
+ char lbuf[BUFSIZ];
+
+ while (fgets(lbuf, sizeof lbuf, f))
+ l++;
+ clearerr(f);
+ fseeko(f, oldpos, SEEK_SET);
+ return (l);
+}
+
+static int
+next(char *buf)
+{
+ int i;
+ sscanf(buf, "%d", &i);
+ sprintf(buf, "Goto %d", i);
+ return(--i);
+}
+
+static void
+ask(const char *prompt)
+{
+ char inch;
+ int n, cmsg, fd;
+ off_t oldpos;
+ FILE *cpfrom, *cpto;
+
+ printf("%s ", prompt);
+ fflush(stdout);
+ intrpflg = NO;
+ (void) fgets(inbuf, sizeof inbuf, stdin);
+ if ((n = strlen(inbuf)) > 0 && inbuf[n - 1] == '\n')
+ inbuf[n - 1] = '\0';
+ if (intrpflg)
+ inbuf[0] = 'x';
+
+ /*
+ * Handle 'mail' and 'save' here.
+ */
+ if ((inch = inbuf[0]) == 's' || inch == 'm') {
+ if (inbuf[1] == '-')
+ cmsg = prevmsg;
+ else if (isdigit(inbuf[1]))
+ cmsg = atoi(&inbuf[1]);
+ else
+ cmsg = msg;
+ snprintf(fname, sizeof(fname), "%s/%d", _PATH_MSGS, cmsg);
+
+ oldpos = ftello(newmsg);
+
+ cpfrom = fopen(fname, "r");
+ if (!cpfrom) {
+ printf("Message %d not found\n", cmsg);
+ ask (prompt);
+ return;
+ }
+
+ if (inch == 's') {
+ in = nxtfld(inbuf);
+ if (*in) {
+ for (n=0; in[n] > ' '; n++) { /* sizeof fname? */
+ fname[n] = in[n];
+ }
+ fname[n] = '\0';
+ }
+ else
+ strcpy(fname, "Messages");
+ fd = open(fname, O_RDWR|O_EXCL|O_CREAT|O_APPEND);
+ }
+ else {
+ strcpy(fname, _PATH_TMP);
+ fd = mkstemp(fname);
+ if (fd != -1) {
+ snprintf(cmdbuf, sizeof(cmdbuf), _PATH_MAIL,
+ fname);
+ mailing = YES;
+ }
+ }
+ if (fd == -1 || (cpto = fdopen(fd, "a")) == NULL) {
+ if (fd != -1)
+ close(fd);
+ warn("%s", fname);
+ mailing = NO;
+ fseeko(newmsg, oldpos, SEEK_SET);
+ ask(prompt);
+ return;
+ }
+
+ while ((n = fread(inbuf, 1, sizeof inbuf, cpfrom)))
+ fwrite(inbuf, 1, n, cpto);
+
+ fclose(cpfrom);
+ fclose(cpto);
+ fseeko(newmsg, oldpos, SEEK_SET);/* reposition current message */
+ if (inch == 's')
+ printf("Message %d saved in \"%s\"\n", cmsg, fname);
+ else {
+ system(cmdbuf);
+ unlink(fname);
+ mailing = NO;
+ }
+ ask(prompt);
+ }
+}
+
+static void
+gfrsub(FILE *infile)
+{
+ off_t frompos;
+ int count;
+
+ seensubj = seenfrom = NO;
+ local = YES;
+ subj[0] = from[0] = date[0] = '\0';
+
+ /*
+ * Is this a normal message?
+ */
+ if (fgets(inbuf, sizeof inbuf, infile)) {
+ if (strncmp(inbuf, "From", 4)==0) {
+ /*
+ * expected form starts with From
+ */
+ seenfrom = YES;
+ frompos = ftello(infile);
+ ptr = from;
+ in = nxtfld(inbuf);
+ if (*in) {
+ count = sizeof(from) - 1;
+ while (*in && *in > ' ' && count-- > 0) {
+ if (*in == ':' || *in == '@' ||
+ *in == '!')
+ local = NO;
+ *ptr++ = *in++;
+ }
+ }
+ *ptr = '\0';
+ if (*(in = nxtfld(in)))
+ strlcpy(date, in, sizeof date);
+ else {
+ date[0] = '\n';
+ date[1] = '\0';
+ }
+ }
+ else {
+ /*
+ * not the expected form
+ */
+ rewind(infile);
+ return;
+ }
+ }
+ else
+ /*
+ * empty file ?
+ */
+ return;
+
+ /*
+ * look for Subject line until EOF or a blank line
+ */
+ while (fgets(inbuf, sizeof inbuf, infile)
+ && !(blankline = (inbuf[0] == '\n'))) {
+ /*
+ * extract Subject line
+ */
+ if (!seensubj && strncmp(inbuf, "Subj", 4)==0) {
+ seensubj = YES;
+ frompos = ftello(infile);
+ strlcpy(subj, nxtfld(inbuf), sizeof subj);
+ }
+ }
+ if (!blankline)
+ /*
+ * ran into EOF
+ */
+ fseeko(infile, frompos, SEEK_SET);
+
+ if (!seensubj)
+ /*
+ * for possible use with Mail
+ */
+ strlcpy(subj, "(No Subject)\n", sizeof subj);
+}
+
+static char *
+nxtfld(char *s)
+{
+ if (*s) while (*s && !isspace(*s)) s++; /* skip over this field */
+ if (*s) while (*s && isspace(*s)) s++; /* find start of next field */
+ return (s);
+}
diff --git a/usr.bin/msgs/pathnames.h b/usr.bin/msgs/pathnames.h
new file mode 100644
index 0000000..541d510
--- /dev/null
+++ b/usr.bin/msgs/pathnames.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ */
+
+#define _PATH_MSGS "/var/msgs"
+#define _PATH_MAIL "/usr/bin/Mail -f %s"
+#define _PATH_PAGER "/usr/bin/more -%d"
+#undef _PATH_TMP
+#define _PATH_TMP "/tmp/msgXXXXXX"
diff --git a/usr.bin/mt/Makefile b/usr.bin/mt/Makefile
new file mode 100644
index 0000000..b71c2f8
--- /dev/null
+++ b/usr.bin/mt/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= mt
+LIBADD= mt
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/mt/Makefile.depend b/usr.bin/mt/Makefile.depend
new file mode 100644
index 0000000..81381e2
--- /dev/null
+++ b/usr.bin/mt/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libmt \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/mt/mt.1 b/usr.bin/mt/mt.1
new file mode 100644
index 0000000..7af3d2b
--- /dev/null
+++ b/usr.bin/mt/mt.1
@@ -0,0 +1,626 @@
+.\" Copyright (c) 1981, 1990, 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.
+.\"
+.\" @(#)mt.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 20, 2016
+.Dt MT 1
+.Os
+.Sh NAME
+.Nm mt
+.Nd magnetic tape manipulating program
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar tapename
+.Ar command
+.Op Ar count
+.Nm
+.Op Fl f Ar tapename
+.Ar command
+.Ar argument
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to command a magnetic tape drive for operations
+other than reading or writing data.
+.Pp
+The
+.Fl f
+option's
+.Ar tapename
+overrides the
+.Ev TAPE
+environment variable described below.
+.Pp
+The available commands are listed below.
+Only as many
+characters as are required to uniquely identify a command
+need be specified.
+.Pp
+The following commands optionally take a
+.Ar count ,
+which defaults to 1.
+.Bl -tag -width ".Cm erase"
+.It Cm weof
+Write
+.Ar count
+end-of-file (EOF) marks at the current position.
+This returns when the file mark has been written to the media.
+.It Cm weofi
+Write
+.Ar count
+end-of-file (EOF) marks at the current position.
+This returns as soon as the command has been validated by the tape drive.
+.It Cm smk
+Write
+.Ar count
+setmarks at the current position (DDS drives only).
+.It Cm fsf
+Forward space
+.Ar count
+files.
+.It Cm fsr
+Forward space
+.Ar count
+records.
+.It Cm fss
+Forward space
+.Ar count
+setmarks (DDS drives only).
+.It Cm bsf
+Backward space
+.Ar count
+files.
+.It Cm bsr
+Backward space
+.Ar count
+records.
+.It Cm bss
+Backward space
+.Ar count
+setmarks (DDS drives only).
+.It Cm erase
+Erase the tape using a long (often very long) method.
+With a
+.Ar count
+of 0, it will erase the tape using a quick method.
+Operation is not guaranteed if the tape is not at its beginning.
+The tape will be at its beginning upon completion.
+.El
+.Pp
+The following commands ignore
+.Ar count .
+.Bl -tag -width ".Cm geteotmodel"
+.It Cm rdhpos
+Read the hardware block position.
+The block
+number reported is specific for that hardware only.
+With drive data compression especially,
+this position may have more to do with the amount of data
+sent to the drive than the amount of data written to tape.
+Some drives do not support this.
+.It Cm rdspos
+Read the SCSI logical block position.
+This typically is greater than the hardware position
+by the number of end-of-file marks.
+Some drives do not support this.
+.It Cm rewind
+Rewind the tape.
+.It Cm offline , rewoffl
+Rewind the tape and place the drive off line.
+Some drives are never off line.
+.It Cm load
+Load the tape into the drive.
+.It Cm retension
+Re-tension the tape.
+This winds the tape from the current position to the end
+and then to the beginning.
+This sometimes improves subsequent reading and writing,
+particularly for streaming drives.
+Some drives do not support this.
+.It Cm ostatus
+Output status information about the drive.
+For SCSI magnetic tape devices,
+the current operating modes of density, blocksize, and whether compression
+is enabled is reported.
+The current state of the driver (what it thinks that
+it is doing with the device) is reported.
+If the driver knows the relative
+position from BOT (in terms of filemarks and records), it outputs that.
+Note
+that this information is not definitive (only BOT, End of Recorded Media, and
+hardware or SCSI logical block position (if the drive supports such) are
+considered definitive tape positions).
+.Pp
+Also note that this is the old status command, and will be eliminated in
+favor of the new status command (see below) in a future release.
+.It Cm errstat
+Output (and clear) error status information about this device.
+For every normal
+operation (e.g., a read or a write) and every control operation (e.g,, a
+rewind), the driver stores up the last command executed and it is associated
+status and any residual counts (if any).
+This command retrieves and outputs this
+information.
+If possible, this also clears any latched error information.
+.It Cm geteotmodel
+Output the current EOT filemark model.
+The model states how
+many filemarks will be written at close if a tape was being written.
+.It Cm eod , eom
+Wind the tape to the end of the recorded data,
+typically after an EOF mark where another file may be written.
+.It Cm rblim
+Report the block limits of the tape drive, including the minimum and
+maximum block size, and the block granularity if any.
+.El
+.Pp
+The following commands may require an
+.Ar argument .
+.Bl -tag -width ".Cm seteotmodel"
+.It Cm sethpos
+Set the hardware block position.
+The
+.Ar argument
+is a hardware block number to which to position the tape.
+Some drives do not support this.
+.It Cm setspos
+Set the SCSI logical block position.
+The
+.Ar argument
+is a SCSI logical block number to which to position the tape.
+Some drives do not support this.
+.It Cm blocksize
+Set the block size for the drive.
+The
+.Ar argument
+is the number of bytes per block,
+except 0 commands the drive to use variable-length blocks.
+.It Cm seteotmodel
+Set the EOT filemark model to
+.Ar argument
+and output the old and new models.
+Typically this will be 2
+filemarks, but some devices (typically QIC cartridge drives) can
+only write 1 filemark.
+You may only choose a value of
+.Ar 1
+or
+.Ar 2 .
+.It Cm status
+Output status information about the drive.
+For SCSI magnetic tape devices,
+the current operating modes of density, blocksize, and whether compression
+is enabled is reported.
+The current state of the driver (what it thinks that
+it is doing with the device) is reported.
+.Pp
+If the driver knows the relative
+position from BOT (in terms of filemarks and records), it outputs that.
+If the tape drive supports the long form report of the
+.Tn SCSI
+READ POSITION command, the Reported File Number and Reported Record Number
+will be numbers other than -1, and there may be Flags reported as well.
+.Pp
+The BOP flag means that the logical position of the drive is at the
+beginning of the partition.
+.Pp
+The EOP flag means that the logical position of the drive is between Early
+Warning and End of Partition.
+.Pp
+The BPEW flag means that the logical position of the drive is in a
+Programmable Early Warning Zone or on the EOP side of Early Warning.
+.Pp
+Note that the Reported Record Number is the tape block or object number
+relative to the beginning of the partition.
+The Calculated Record Number is the tape block or object number relative
+to the previous file mark.
+.Pp
+Note
+that the Calculated File and Record Numbers are not definitive.
+The Reported File and Record Numbers are definitive, if they are numbers
+other than -1.
+.Bl -tag -width 6n
+.It Fl v
+Print additional status information, such as the maximum supported I/O
+size.
+.It Fl x
+Print all available status data to stdout in XML format.
+.El
+.It Cm getdensity
+Report density support information for the tape drive and any media that is
+loaded.
+Most drives will report at least basic density information similar to that
+reported by
+.Nm status
+command.
+Newer tape drives that conform to the T-10 SSC and newer tape
+specifications may report more detailed information about the types of
+tapes they support and the tape currently in the drive.
+.Bl -tag -width 6n
+.It Fl x
+Print all available density data to stdout in XML format.
+Because density information is currently included in the general status XML
+report used for
+.Nm
+status command, this will be the same XML output via
+.Do
+.Nm
+status
+.Fl x
+.Dc
+.El
+.It Cm param
+Display or set parameters.
+One of
+.Fl l ,
+.Fl s ,
+or
+.Fl x
+must be specified to indicate which operation to perform.
+.Bl -tag -width 8n
+.It Fl l
+List parameters, values and descriptions.
+By default all parameters will be displayed.
+To display a specific parameter, specify the parameter with
+.Fl p .
+.It Fl p Ar name
+Specify the parameter name to list (with
+.Fl l )
+or set (with
+.Fl s ) .
+.It Fl q
+Enable quiet mode for parameter listing.
+This will suppress printing of parameter descriptions.
+.It Fl s Ar value
+Specify the parameter value to set.
+The general type of this argument (integer, unsigned integer, string) is
+determined by the type of the variable indicated by the
+.Xr sa 4
+driver.
+More detailed argument checking is done by the
+.Xr sa 4
+driver.
+.It Fl x
+Print out all parameter information in XML format.
+.El
+.It Cm protect
+Display or set drive protection parameters.
+This is used to control checking and reporting a per-block checksum for
+tape drives that support it.
+Some drives may only support some parameters.
+.Bl -tag -width 8n
+.It Fl b Ar 0|1
+Set the Recover Buffered Data Protected bit.
+If set, this indicates that checksums are transferred with the logical
+blocks transferred by the RECOVERED BUFFERED DATA
+.Tn SCSI
+command.
+.It Fl d
+Disable all protection information settings.
+.It Fl e
+Enable all protection information settings.
+The default protection method used is Reed-Solomon CRC (protection method
+1), as specified in ECMA-319.
+The default protection information length used with Reed-Solomon CRC is
+4 bytes.
+To enable all settings except one more more settings, specify the
+.Fl e
+argument and then explicitly disable settings that you do not wish to
+enable.
+For example, specifying
+.Fl e
+.Fl w Ar 0
+will enable all settings except for LBP_W.
+.It Fl l
+List available protection parmeters and their current settings.
+.It Fl L Ar len
+Set the length of the protection information in bytes.
+For Reed-Solomon CRC, the protection information length should be 4 bytes.
+.It Fl m Ar num
+Specify the numeric value for the protection method.
+The numeric value for Reed-Solomon CRC is 1.
+.It Fl r Ar 0|1
+Set the LBP_R parameter.
+When set, this indicates that each block read from the tape drive will
+have a checksum at the end.
+.It Fl v
+Enable verbose mode for parameter listing.
+This will include descriptions of each parameter.
+.It Fl w Ar 0|1
+Set the LBP_W parameter.
+When set, this indicates that each block written to the tape drive will have
+a checksum at the end.
+The drive will verify the checksum before writing the block to tape.
+.El
+.It Cm locate
+Set the tape drive's logical position.
+One of
+.Fl b ,
+.Fl e ,
+.Fl f ,
+or
+.Fl s
+must be specified to indicate the type of position.
+If the partition number is specified, the drive will first relocate to the
+given partition (if it exists) and then to the position indicated within
+that partition.
+If the partition number is not specified, the drive will relocate to the
+given position within the current partition.
+.Bl -tag -width 14n
+.It Fl b Ar block_addr
+Relocate to the given tape block or logical object identifier.
+Note that the block number is the Reported Record Number that is relative
+to the beginning of the partition (or beginning of tape).
+.It Fl e
+Relocate to the end of data.
+.It Fl f Ar fileno
+Relocate to the given file number.
+.It Fl p Ar partition
+Specify the partition to change to.
+.It Fl s Ar setmark
+Relocate to the given set mark.
+.El
+.It Cm comp
+Set the drive's compression mode.
+The non-numeric values of
+.Ar argument
+are:
+.Pp
+.Bl -tag -width 9n -compact
+.It off
+Turn compression off.
+.It on
+Turn compression on.
+.It none
+Same as
+.Ar off .
+.It enable
+Same as
+.Ar on .
+.It IDRC
+IBM Improved Data Recording Capability compression (0x10).
+.It DCLZ
+DCLZ compression algorithm (0x20).
+.El
+.Pp
+In addition to the above recognized compression keywords, the user can
+supply a numeric compression algorithm for the drive to use.
+In most
+cases, simply turning the compression
+.Sq on
+will have the desired effect of enabling the default compression algorithm
+supported by the drive.
+If this is not the case (see the
+.Cm status
+display to see which compression algorithm is currently in use), the user
+can manually specify one of the supported compression keywords (above), or
+supply a numeric compression value from the drive's specifications.
+.Pp
+Note that for some older tape drives (for example the Exabyte 8200 and 8500
+series drives) it is necessary to switch to a different density to tell the
+drive to record data in its compressed format.
+If the user attempts to turn compression on while the uncompressed density
+is selected, the drive will return an error.
+This is generally not an issue for modern tape drives.
+.It Cm density
+Set the density for the drive.
+For the density codes, see below.
+The density value could be given either numerically, or as a string,
+corresponding to the
+.Dq Reference
+field.
+If the string is abbreviated, it will be resolved in the order
+shown in the table, and the first matching entry will be used.
+If the
+given string and the resulting canonical density name do not match
+exactly, an informational message is output about what the given
+string has been taken for.
+.El
+.Pp
+The initial version of the density table below was taken from the
+.Sq Historical sequential access density codes
+table (A-1) in Revision 11 of the SCSI-3 Stream Device Commands (SSC)
+working draft, dated November 11, 1997.
+Subsequent additions have come from a number of sources.
+.Pp
+The density codes are:
+.Bd -literal -offset 2n
+0x0 default for device
+0xE reserved for ECMA
+
+Value Width Tracks Density Code Type Reference Note
+ mm in bpmm bpi
+0x01 12.7 (0.5) 9 32 (800) NRZI R X3.22-1983 2
+0x02 12.7 (0.5) 9 63 (1,600) PE R X3.39-1986 2
+0x03 12.7 (0.5) 9 246 (6,250) GCR R X3.54-1986 2
+0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1
+0x06 12.7 (0.5) 9 126 (3,200) PE R X3.157-1987 2
+0x07 6.3 (0.25) 4 252 (6,400) IMFM C X3.116-1986 1
+0x08 3.81 (0.15) 4 315 (8,000) GCR CS X3.158-1987 1
+0x09 12.7 (0.5) 18 1,491 (37,871) GCR C X3.180 2
+0x0A 12.7 (0.5) 22 262 (6,667) MFM C X3B5/86-199 1
+0x0B 6.3 (0.25) 4 63 (1,600) PE C X3.56-1986 1
+0x0C 12.7 (0.5) 24 500 (12,690) GCR C HI-TC1 1,6
+0x0D 12.7 (0.5) 24 999 (25,380) GCR C HI-TC2 1,6
+0x0F 6.3 (0.25) 15 394 (10,000) GCR C QIC-120 1,6
+0x10 6.3 (0.25) 18 394 (10,000) GCR C QIC-150 1,6
+0x11 6.3 (0.25) 26 630 (16,000) GCR C QIC-320 1,6
+0x12 6.3 (0.25) 30 2,034 (51,667) RLL C QIC-1350 1,6
+0x13 3.81 (0.15) 1 2,400 (61,000) DDS CS X3B5/88-185A 5
+0x14 8.0 (0.315) 1 1,703 (43,245) RLL CS X3.202-1991 5,11
+0x15 8.0 (0.315) 1 1,789 (45,434) RLL CS ECMA TC17 5,12
+0x16 12.7 (0.5) 48 394 (10,000) MFM C X3.193-1990 1
+0x17 12.7 (0.5) 48 1,673 (42,500) MFM C X3B5/91-174 1
+0x18 12.7 (0.5) 112 1,673 (42,500) MFM C X3B5/92-50 1
+0x19 12.7 (0.5) 128 2,460 (62,500) RLL C DLTapeIII 6,7
+0x1A 12.7 (0.5) 128 3,214 (81,633) RLL C DLTapeIV(20) 6,7
+0x1B 12.7 (0.5) 208 3,383 (85,937) RLL C DLTapeIV(35) 6,7
+0x1C 6.3 (0.25) 34 1,654 (42,000) MFM C QIC-385M 1,6
+0x1D 6.3 (0.25) 32 1,512 (38,400) GCR C QIC-410M 1,6
+0x1E 6.3 (0.25) 30 1,385 (36,000) GCR C QIC-1000C 1,6
+0x1F 6.3 (0.25) 30 2,666 (67,733) RLL C QIC-2100C 1,6
+0x20 6.3 (0.25) 144 2,666 (67,733) RLL C QIC-6GB(M) 1,6
+0x21 6.3 (0.25) 144 2,666 (67,733) RLL C QIC-20GB(C) 1,6
+0x22 6.3 (0.25) 42 1,600 (40,640) GCR C QIC-2GB(C) ?
+0x23 6.3 (0.25) 38 2,666 (67,733) RLL C QIC-875M ?
+0x24 3.81 (0.15) 1 2,400 (61,000) CS DDS-2 5
+0x25 3.81 (0.15) 1 3,816 (97,000) CS DDS-3 5
+0x26 3.81 (0.15) 1 3,816 (97,000) CS DDS-4 5
+0x27 8.0 (0.315) 1 3,056 (77,611) RLL CS Mammoth 5
+0x28 12.7 (0.5) 36 1,491 (37,871) GCR C X3.224 1
+0x29 12.7 (0.5)
+0x2A
+0x2B 12.7 (0.5) 3 ? ? ? C X3.267 5
+0x40 12.7 (0.5) 384 4,800 (123,952) C LTO-1
+0x41 12.7 (0.5) 208 3,868 (98,250) RLL C DLTapeIV(40) 6,7
+0x42 12.7 (0.5) 512 7,398 (187,909) C LTO-2
+0x44 12.7 (0.5) 704 9,638 (244,805) C LTO-3
+0x46 12.7 (0.5) 896 12,725 (323,215) C LTO-4
+0x47 3.81 (0.25) ? 6,417 (163,000) CS DAT-72
+0x48 12.7 (0.5) 448 5,236 (133,000) PRML C SDLTapeI(110) 6,8,13
+0x49 12.7 (0.5) 448 7,598 (193,000) PRML C SDLTapeI(160) 6,8
+0x4A 12.7 (0.5) 768 ? C T10000A 10
+0x4B 12.7 (0.5) 1152 ? C T10000B 10
+0x4C 12.7 (0.5) 3584 ? C T10000C 10
+0x4D 12.7 (0.5) 4608 ? C T10000D 10
+0x51 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (unencrypted)
+0x52 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (unencrypted)
+0x53 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (unencrypted)
+0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted)
+0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted)
+0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5
+0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6
+0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7
+0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted)
+0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted)
+0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted)
+0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted)
+0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted)
+0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9
+0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9
+.Ed
+.Bd -literal -offset 2n
+Code Description Type Description
+---- -------------------------------------- ---- -----------
+NRZI Non return to zero, change on ones R Reel-to-reel
+GCR Group code recording C Cartridge
+PE Phase encoded CS Cassette
+IMFM Inverted modified frequency modulation
+MFM Modified frequency modulation
+DDS DAT data storage
+RLL Run length limited
+PRML Partial Response Maximum Likelihood
+.Ed
+.Bd -literal -offset 2n
+NOTES
+1. Serial recorded.
+2. Parallel recorded.
+3. Old format known as QIC-11.
+5. Helical scan.
+6. This is not an American National Standard. The reference is based
+ on an industry standard definition of the media format.
+7. DLT recording: serially recorded track pairs (DLTapeIII and
+ DLTapeIV(20)), or track quads (DLTapeIV(35) and DLTapeIV(40)).
+8. Super DLT (SDLT) recording: 56 serially recorded logical tracks
+ with 8 physical tracks each.
+9. Vendor-specific Exabyte density code for compressed format.
+10. bpi/bpmm values for the Oracle/StorageTek T10000 tape drives are
+ not listed in the manual. Someone with access to a drive can
+ supply the necessary values by running 'mt getdensity'.
+11. This is Exabyte 8200 uncompressed format. The compressed format
+ density code is 0x90.
+12. This is Exabyte 8500 uncompressed format. The compressed format
+ density code is 0x8c.
+13. This density code (0x48) was also used for DAT-160.
+.Ed
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev TAPE"
+.It Ev TAPE
+This is the pathname of the tape drive.
+The default (if the variable is unset, but not if it is null) is
+.Pa /dev/nsa0 .
+It may be overridden with the
+.Fl f
+option.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/*sa[0-9]*" -compact
+.It Pa /dev/*sa[0-9]*
+SCSI magnetic tape interface
+.El
+.Sh DIAGNOSTICS
+The exit status will be 0 when the drive operations were successful,
+2 when the drive operations were unsuccessful, and 1 for other
+problems like an unrecognized command or a missing drive device.
+.Sh COMPATIBILITY
+Some undocumented commands support old software.
+.Sh SEE ALSO
+.Xr dd 1 ,
+.Xr ioctl 2 ,
+.Xr mtio 4 ,
+.Xr sa 4 ,
+.Xr environ 7
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
+.Pp
+Extensions regarding the
+.Xr st 4
+driver appeared in
+.Bx 386 0.1
+as a separate
+.Nm st
+command, and have been merged into the
+.Nm
+command in
+.Fx 2.1 .
+.Pp
+The former
+.Cm eof
+command that used to be a synonym for
+.Cm weof
+has been abandoned in
+.Fx 2.1
+since it was often confused with
+.Cm eom ,
+which is fairly dangerous.
+.Sh BUGS
+The utility cannot be interrupted or killed during a long erase
+(which can be longer than an hour), and it is easy to forget
+that the default erase is long.
+.Pp
+Hardware block numbers do not always correspond to blocks on the tape
+when the drive uses internal compression.
+.Pp
+Erasure is not guaranteed if the tape is not at its beginning.
+.Pp
+Tape-related documentation is poor, here and elsewhere.
diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c
new file mode 100644
index 0000000..985a04e
--- /dev/null
+++ b/usr.bin/mt/mt.c
@@ -0,0 +1,1597 @@
+/*
+ * Copyright (c) 1980, 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.
+ */
+/*-
+ * Copyright (c) 2013, 2014, 2015 Spectra Logic Corporation
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * Authors: Ken Merry (Spectra Logic Corporation)
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 5/4/95";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * mt --
+ * magnetic tape manipulation program
+ */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/mtio.h>
+#include <sys/queue.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <errno.h>
+#include <bsdxml.h>
+#include <mtlib.h>
+
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
+#include <cam/cam_periph.h>
+#include <cam/scsi/scsi_all.h>
+#include <cam/scsi/scsi_sa.h>
+
+/* the appropriate sections of <sys/mtio.h> are also #ifdef'd for FreeBSD */
+/* c_flags */
+#define NEED_2ARGS 0x01
+#define ZERO_ALLOWED 0x02
+#define IS_DENSITY 0x04
+#define DISABLE_THIS 0x08
+#define IS_COMP 0x10
+#define USE_GETOPT 0x20
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef MAX
+#define MAX(a, b) (a > b) ? a : b
+#endif
+#define MT_PLURAL(a) (a == 1) ? "" : "s"
+
+typedef enum {
+ MT_CMD_NONE = MTLOAD + 1,
+ MT_CMD_PROTECT,
+ MT_CMD_GETDENSITY
+} mt_commands;
+
+static const struct commands {
+ const char *c_name;
+ unsigned long c_code;
+ int c_ronly;
+ int c_flags;
+} com[] = {
+ { "bsf", MTBSF, 1, 0 },
+ { "bsr", MTBSR, 1, 0 },
+ /* XXX FreeBSD considered "eof" dangerous, since it's being
+ confused with "eom" (and is an alias for "weof" anyway) */
+ { "eof", MTWEOF, 0, DISABLE_THIS },
+ { "fsf", MTFSF, 1, 0 },
+ { "fsr", MTFSR, 1, 0 },
+ { "offline", MTOFFL, 1, 0 },
+ { "load", MTLOAD, 1, 0 },
+ { "rewind", MTREW, 1, 0 },
+ { "rewoffl", MTOFFL, 1, 0 },
+ { "ostatus", MTNOP, 1, 0 },
+ { "weof", MTWEOF, 0, ZERO_ALLOWED },
+ { "weofi", MTWEOFI, 0, ZERO_ALLOWED },
+ { "erase", MTERASE, 0, ZERO_ALLOWED},
+ { "blocksize", MTSETBSIZ, 0, NEED_2ARGS|ZERO_ALLOWED },
+ { "density", MTSETDNSTY, 0, NEED_2ARGS|ZERO_ALLOWED|IS_DENSITY },
+ { "eom", MTEOD, 1, 0 },
+ { "eod", MTEOD, 1, 0 },
+ { "smk", MTWSS, 0, 0 },
+ { "wss", MTWSS, 0, 0 },
+ { "fss", MTFSS, 1, 0 },
+ { "bss", MTBSS, 1, 0 },
+ { "comp", MTCOMP, 0, NEED_2ARGS|ZERO_ALLOWED|IS_COMP },
+ { "retension", MTRETENS, 1, 0 },
+ { "rdhpos", MTIOCRDHPOS, 0, 0 },
+ { "rdspos", MTIOCRDSPOS, 0, 0 },
+ { "sethpos", MTIOCHLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
+ { "setspos", MTIOCSLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
+ { "errstat", MTIOCERRSTAT, 0, 0 },
+ { "setmodel", MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
+ { "seteotmodel", MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
+ { "getmodel", MTIOCGETEOTMODEL, 0, 0 },
+ { "geteotmodel", MTIOCGETEOTMODEL, 0, 0 },
+ { "rblim", MTIOCRBLIM, 0, 0},
+ { "getdensity", MT_CMD_GETDENSITY, 0, USE_GETOPT},
+ { "status", MTIOCEXTGET, 0, USE_GETOPT },
+ { "locate", MTIOCEXTLOCATE, 0, USE_GETOPT },
+ { "param", MTIOCPARAMGET, 0, USE_GETOPT },
+ { "protect", MT_CMD_PROTECT, 0, USE_GETOPT },
+ { NULL, 0, 0, 0 }
+};
+
+
+static const char *getblksiz(int);
+static void printreg(const char *, u_int, const char *);
+static void status(struct mtget *);
+static void usage(void);
+const char *get_driver_state_str(int dsreg);
+static void st_status (struct mtget *);
+static int mt_locate(int argc, char **argv, int mtfd, const char *tape);
+static int nstatus_print(int argc, char **argv, char *xml_str,
+ struct mt_status_data *status_data);
+static int mt_xml_cmd(unsigned long cmd, int argc, char **argv, int mtfd,
+ const char *tape);
+static int mt_print_density_entry(struct mt_status_entry *density_root, int indent);
+static int mt_print_density_report(struct mt_status_entry *report_root, int indent);
+static int mt_print_density(struct mt_status_entry *density_root, int indent);
+static int mt_getdensity(int argc, char **argv, char *xml_str,
+ struct mt_status_data *status_data);
+static int mt_set_param(int mtfd, struct mt_status_data *status_data,
+ char *param_name, char *param_value);
+static int mt_protect(int argc, char **argv, int mtfd,
+ struct mt_status_data *status_data);
+static int mt_param(int argc, char **argv, int mtfd, char *xml_str,
+ struct mt_status_data *status_data);
+static const char *denstostring (int d);
+static u_int32_t stringtocomp(const char *s);
+static const char *comptostring(u_int32_t comp);
+static void warn_eof(void);
+
+int
+main(int argc, char *argv[])
+{
+ const struct commands *comp;
+ struct mtget mt_status;
+ struct mtop mt_com;
+ int ch, len, mtfd;
+ const char *p, *tape;
+
+ bzero(&mt_com, sizeof(mt_com));
+
+ if ((tape = getenv("TAPE")) == NULL)
+ tape = DEFTAPE;
+
+ while ((ch = getopt(argc, argv, "f:t:")) != -1)
+ switch(ch) {
+ case 'f':
+ case 't':
+ tape = optarg;
+ break;
+ case '?':
+ usage();
+ break;
+ default:
+ break;
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ len = strlen(p = *argv++);
+ for (comp = com;; comp++) {
+ if (comp->c_name == NULL)
+ errx(1, "%s: unknown command", p);
+ if (strncmp(p, comp->c_name, len) == 0)
+ break;
+ }
+ if((comp->c_flags & NEED_2ARGS) && argc != 2)
+ usage();
+ if(comp->c_flags & DISABLE_THIS) {
+ warn_eof();
+ }
+ if (comp->c_flags & USE_GETOPT) {
+ argc--;
+ optind = 0;
+ }
+
+ if ((mtfd = open(tape, comp->c_ronly ? O_RDONLY : O_RDWR)) < 0)
+ err(1, "%s", tape);
+ if (comp->c_code != MTNOP) {
+ mt_com.mt_op = comp->c_code;
+ if (*argv) {
+ if (!isdigit(**argv) &&
+ (comp->c_flags & IS_DENSITY)) {
+ const char *dcanon;
+ mt_com.mt_count = mt_density_num(*argv);
+ if (mt_com.mt_count == 0)
+ errx(1, "%s: unknown density", *argv);
+ dcanon = denstostring(mt_com.mt_count);
+ if (strcmp(dcanon, *argv) != 0)
+ printf(
+ "Using \"%s\" as an alias for %s\n",
+ *argv, dcanon);
+ p = "";
+ } else if (!isdigit(**argv) &&
+ (comp->c_flags & IS_COMP)) {
+
+ mt_com.mt_count = stringtocomp(*argv);
+ if ((u_int32_t)mt_com.mt_count == 0xf0f0f0f0)
+ errx(1, "%s: unknown compression",
+ *argv);
+ p = "";
+ } else if ((comp->c_flags & USE_GETOPT) == 0) {
+ char *q;
+ /* allow for hex numbers; useful for density */
+ mt_com.mt_count = strtol(*argv, &q, 0);
+ p = q;
+ }
+ if (((comp->c_flags & USE_GETOPT) == 0)
+ && (((mt_com.mt_count <=
+ ((comp->c_flags & ZERO_ALLOWED)? -1: 0))
+ && ((comp->c_flags & IS_COMP) == 0))
+ || *p))
+ errx(1, "%s: illegal count", *argv);
+ }
+ else
+ mt_com.mt_count = 1;
+ switch (comp->c_code) {
+ case MTIOCERRSTAT:
+ {
+ unsigned int i;
+ union mterrstat umn;
+ struct scsi_tape_errors *s = &umn.scsi_errstat;
+
+ if (ioctl(mtfd, comp->c_code, (caddr_t)&umn) < 0)
+ err(2, "%s", tape);
+ (void)printf("Last I/O Residual: %u\n", s->io_resid);
+ (void)printf(" Last I/O Command:");
+ for (i = 0; i < sizeof (s->io_cdb); i++)
+ (void)printf(" %02X", s->io_cdb[i]);
+ (void)printf("\n");
+ (void)printf(" Last I/O Sense:\n\n\t");
+ for (i = 0; i < sizeof (s->io_sense); i++) {
+ (void)printf(" %02X", s->io_sense[i]);
+ if (((i + 1) & 0xf) == 0) {
+ (void)printf("\n\t");
+ }
+ }
+ (void)printf("\n");
+ (void)printf("Last Control Residual: %u\n",
+ s->ctl_resid);
+ (void)printf(" Last Control Command:");
+ for (i = 0; i < sizeof (s->ctl_cdb); i++)
+ (void)printf(" %02X", s->ctl_cdb[i]);
+ (void)printf("\n");
+ (void)printf(" Last Control Sense:\n\n\t");
+ for (i = 0; i < sizeof (s->ctl_sense); i++) {
+ (void)printf(" %02X", s->ctl_sense[i]);
+ if (((i + 1) & 0xf) == 0) {
+ (void)printf("\n\t");
+ }
+ }
+ (void)printf("\n\n");
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCRDHPOS:
+ case MTIOCRDSPOS:
+ {
+ u_int32_t block;
+ if (ioctl(mtfd, comp->c_code, (caddr_t)&block) < 0)
+ err(2, "%s", tape);
+ (void)printf("%s: %s block location %u\n", tape,
+ (comp->c_code == MTIOCRDHPOS)? "hardware" :
+ "logical", block);
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCSLOCATE:
+ case MTIOCHLOCATE:
+ {
+ u_int32_t block = (u_int32_t)mt_com.mt_count;
+ if (ioctl(mtfd, comp->c_code, (caddr_t)&block) < 0)
+ err(2, "%s", tape);
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCGETEOTMODEL:
+ {
+ u_int32_t om;
+ if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
+ err(2, "%s", tape);
+ (void)printf("%s: the model is %u filemar%s at EOT\n",
+ tape, om, (om > 1)? "ks" : "k");
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCSETEOTMODEL:
+ {
+ u_int32_t om, nm = (u_int32_t)mt_com.mt_count;
+ if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
+ err(2, "%s", tape);
+ if (ioctl(mtfd, comp->c_code, (caddr_t)&nm) < 0)
+ err(2, "%s", tape);
+ (void)printf("%s: old model was %u filemar%s at EOT\n",
+ tape, om, (om > 1)? "ks" : "k");
+ (void)printf("%s: new model is %u filemar%s at EOT\n",
+ tape, nm, (nm > 1)? "ks" : "k");
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCRBLIM:
+ {
+ struct mtrblim rblim;
+
+ bzero(&rblim, sizeof(rblim));
+
+ if (ioctl(mtfd, MTIOCRBLIM, (caddr_t)&rblim) < 0)
+ err(2, "%s", tape);
+ (void)printf("%s:\n"
+ " min blocksize %u byte%s\n"
+ " max blocksize %u byte%s\n"
+ " granularity %u byte%s\n",
+ tape, rblim.min_block_length,
+ MT_PLURAL(rblim.min_block_length),
+ rblim.max_block_length,
+ MT_PLURAL(rblim.max_block_length),
+ (1 << rblim.granularity),
+ MT_PLURAL((1 << rblim.granularity)));
+ exit(0);
+ /* NOTREACHED */
+ }
+ case MTIOCPARAMGET:
+ case MTIOCEXTGET:
+ case MT_CMD_PROTECT:
+ case MT_CMD_GETDENSITY:
+ {
+ int retval = 0;
+
+ retval = mt_xml_cmd(comp->c_code, argc, argv, mtfd,
+ tape);
+
+ exit(retval);
+ }
+ case MTIOCEXTLOCATE:
+ {
+ int retval = 0;
+
+ retval = mt_locate(argc, argv, mtfd, tape);
+
+ exit(retval);
+ }
+ default:
+ break;
+ }
+ if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0)
+ err(1, "%s: %s", tape, comp->c_name);
+ } else {
+ if (ioctl(mtfd, MTIOCGET, &mt_status) < 0)
+ err(1, NULL);
+ status(&mt_status);
+ }
+ exit(0);
+ /* NOTREACHED */
+}
+
+static const struct tape_desc {
+ short t_type; /* type of magtape device */
+ const char *t_name; /* printing name */
+ const char *t_dsbits; /* "drive status" register */
+ const char *t_erbits; /* "error" register */
+} tapes[] = {
+ { MT_ISAR, "SCSI tape drive", 0, 0 },
+ { 0, NULL, 0, 0 }
+};
+
+/*
+ * Interpret the status buffer returned
+ */
+static void
+status(struct mtget *bp)
+{
+ const struct tape_desc *mt;
+
+ for (mt = tapes;; mt++) {
+ if (mt->t_type == 0) {
+ (void)printf("%d: unknown tape drive type\n",
+ bp->mt_type);
+ return;
+ }
+ if (mt->t_type == bp->mt_type)
+ break;
+ }
+ if(mt->t_type == MT_ISAR)
+ st_status(bp);
+ else {
+ (void)printf("%s tape drive, residual=%d\n",
+ mt->t_name, bp->mt_resid);
+ printreg("ds", (unsigned short)bp->mt_dsreg, mt->t_dsbits);
+ printreg("\ner", (unsigned short)bp->mt_erreg, mt->t_erbits);
+ (void)putchar('\n');
+ }
+}
+
+/*
+ * Print a register a la the %b format of the kernel's printf.
+ */
+static void
+printreg(const char *s, u_int v, const char *bits)
+{
+ int i, any = 0;
+ char c;
+
+ if (bits && *bits == 8)
+ printf("%s=%o", s, v);
+ else
+ printf("%s=%x", s, v);
+ if (!bits)
+ return;
+ bits++;
+ if (v && bits) {
+ putchar('<');
+ while ((i = *bits++)) {
+ if (v & (1 << (i-1))) {
+ if (any)
+ putchar(',');
+ any = 1;
+ for (; (c = *bits) > 32; bits++)
+ putchar(c);
+ } else
+ for (; *bits > 32; bits++)
+ ;
+ }
+ putchar('>');
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: mt [-f device] command [count]\n");
+ exit(1);
+}
+
+static const struct compression_types {
+ u_int32_t comp_number;
+ const char *name;
+} comp_types[] = {
+ { 0x00, "none" },
+ { 0x00, "off" },
+ { 0x10, "IDRC" },
+ { 0x20, "DCLZ" },
+ { 0xffffffff, "enable" },
+ { 0xffffffff, "on" },
+ { 0xf0f0f0f0, NULL}
+};
+
+static const char *
+denstostring(int d)
+{
+ static char buf[20];
+ const char *name = mt_density_name(d);
+
+ if (name == NULL)
+ sprintf(buf, "0x%02x", d);
+ else
+ sprintf(buf, "0x%02x:%s", d, name);
+ return buf;
+}
+
+static const char *
+getblksiz(int bs)
+{
+ static char buf[25];
+ if (bs == 0)
+ return "variable";
+ else {
+ sprintf(buf, "%d bytes", bs);
+ return buf;
+ }
+}
+
+static const char *
+comptostring(u_int32_t comp)
+{
+ static char buf[20];
+ const struct compression_types *ct;
+
+ if (comp == MT_COMP_DISABLED)
+ return "disabled";
+ else if (comp == MT_COMP_UNSUPP)
+ return "unsupported";
+
+ for (ct = comp_types; ct->name; ct++)
+ if (ct->comp_number == comp)
+ break;
+
+ if (ct->comp_number == 0xf0f0f0f0) {
+ sprintf(buf, "0x%x", comp);
+ return(buf);
+ } else
+ return(ct->name);
+}
+
+static u_int32_t
+stringtocomp(const char *s)
+{
+ const struct compression_types *ct;
+ size_t l = strlen(s);
+
+ for (ct = comp_types; ct->name; ct++)
+ if (strncasecmp(ct->name, s, l) == 0)
+ break;
+
+ return(ct->comp_number);
+}
+
+static struct driver_state {
+ int dsreg;
+ const char *desc;
+} driver_states[] = {
+ { MTIO_DSREG_REST, "at rest" },
+ { MTIO_DSREG_RBSY, "Communicating with drive" },
+ { MTIO_DSREG_WR, "Writing" },
+ { MTIO_DSREG_FMK, "Writing Filemarks" },
+ { MTIO_DSREG_ZER, "Erasing" },
+ { MTIO_DSREG_RD, "Reading" },
+ { MTIO_DSREG_FWD, "Spacing Forward" },
+ { MTIO_DSREG_REV, "Spacing Reverse" },
+ { MTIO_DSREG_POS, "Hardware Positioning (direction unknown)" },
+ { MTIO_DSREG_REW, "Rewinding" },
+ { MTIO_DSREG_TEN, "Retensioning" },
+ { MTIO_DSREG_UNL, "Unloading" },
+ { MTIO_DSREG_LD, "Loading" },
+};
+
+const char *
+get_driver_state_str(int dsreg)
+{
+ unsigned int i;
+
+ for (i = 0; i < (sizeof(driver_states)/sizeof(driver_states[0])); i++) {
+ if (driver_states[i].dsreg == dsreg)
+ return (driver_states[i].desc);
+ }
+
+ return (NULL);
+}
+
+static void
+st_status(struct mtget *bp)
+{
+ printf("Mode Density Blocksize bpi "
+ "Compression\n"
+ "Current: %-17s %-12s %-7d %s\n"
+ "---------available modes---------\n"
+ "0: %-17s %-12s %-7d %s\n"
+ "1: %-17s %-12s %-7d %s\n"
+ "2: %-17s %-12s %-7d %s\n"
+ "3: %-17s %-12s %-7d %s\n",
+ denstostring(bp->mt_density), getblksiz(bp->mt_blksiz),
+ mt_density_bp(bp->mt_density, TRUE), comptostring(bp->mt_comp),
+ denstostring(bp->mt_density0), getblksiz(bp->mt_blksiz0),
+ mt_density_bp(bp->mt_density0, TRUE), comptostring(bp->mt_comp0),
+ denstostring(bp->mt_density1), getblksiz(bp->mt_blksiz1),
+ mt_density_bp(bp->mt_density1, TRUE), comptostring(bp->mt_comp1),
+ denstostring(bp->mt_density2), getblksiz(bp->mt_blksiz2),
+ mt_density_bp(bp->mt_density2, TRUE), comptostring(bp->mt_comp2),
+ denstostring(bp->mt_density3), getblksiz(bp->mt_blksiz3),
+ mt_density_bp(bp->mt_density3, TRUE), comptostring(bp->mt_comp3));
+
+ if (bp->mt_dsreg != MTIO_DSREG_NIL) {
+ const char sfmt[] = "Current Driver State: %s.\n";
+ printf("---------------------------------\n");
+ const char *state_str;
+
+ state_str = get_driver_state_str(bp->mt_dsreg);
+ if (state_str == NULL) {
+ char foo[32];
+ (void) sprintf(foo, "Unknown state 0x%x", bp->mt_dsreg);
+ printf(sfmt, foo);
+ } else {
+ printf(sfmt, state_str);
+ }
+ }
+ if (bp->mt_resid == 0 && bp->mt_fileno == (daddr_t) -1 &&
+ bp->mt_blkno == (daddr_t) -1)
+ return;
+ printf("---------------------------------\n");
+ printf("File Number: %d\tRecord Number: %d\tResidual Count %d\n",
+ bp->mt_fileno, bp->mt_blkno, bp->mt_resid);
+}
+
+static int
+mt_locate(int argc, char **argv, int mtfd, const char *tape)
+{
+ struct mtlocate mtl;
+ uint64_t logical_id = 0;
+ mt_locate_dest_type dest_type = MT_LOCATE_DEST_FILE;
+ int eod = 0, explicit = 0, immediate = 0;
+ int64_t partition = 0;
+ int block_addr_set = 0, partition_set = 0, file_set = 0, set_set = 0;
+ int c, retval;
+
+ retval = 0;
+ bzero(&mtl, sizeof(mtl));
+
+ while ((c = getopt(argc, argv, "b:eEf:ip:s:")) != -1) {
+ switch (c) {
+ case 'b':
+ /* Block address */
+ logical_id = strtoull(optarg, NULL, 0);
+ dest_type = MT_LOCATE_DEST_OBJECT;
+ block_addr_set = 1;
+ break;
+ case 'e':
+ /* end of data */
+ eod = 1;
+ dest_type = MT_LOCATE_DEST_EOD;
+ break;
+ case 'E':
+ /*
+ * XXX KDM explicit address mode. Should we even
+ * allow this, since the driver doesn't operate in
+ * explicit address mode?
+ */
+ explicit = 1;
+ break;
+ case 'f':
+ /* file number */
+ logical_id = strtoull(optarg, NULL, 0);
+ dest_type = MT_LOCATE_DEST_FILE;
+ file_set = 1;
+ break;
+ case 'i':
+ /*
+ * Immediate address mode. XXX KDM do we want to
+ * implement this? The other commands in the
+ * tape driver will need to be able to handle this.
+ */
+ immediate = 1;
+ break;
+ case 'p':
+ /*
+ * Change partition to the given partition.
+ */
+ partition = strtol(optarg, NULL, 0);
+ partition_set = 1;
+ break;
+ case 's':
+ /* Go to the given set mark */
+ logical_id = strtoull(optarg, NULL, 0);
+ dest_type = MT_LOCATE_DEST_SET;
+ set_set = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /*
+ * These options are mutually exclusive. The user may only specify
+ * one.
+ */
+ if ((block_addr_set + file_set + eod + set_set) != 1)
+ errx(1, "You must specify only one of -b, -f, -e, or -s");
+
+ mtl.dest_type = dest_type;
+ switch (dest_type) {
+ case MT_LOCATE_DEST_OBJECT:
+ case MT_LOCATE_DEST_FILE:
+ case MT_LOCATE_DEST_SET:
+ mtl.logical_id = logical_id;
+ break;
+ case MT_LOCATE_DEST_EOD:
+ break;
+ }
+
+ if (immediate != 0)
+ mtl.flags |= MT_LOCATE_FLAG_IMMED;
+
+ if (partition_set != 0) {
+ mtl.flags |= MT_LOCATE_FLAG_CHANGE_PART;
+ mtl.partition = partition;
+ }
+
+ if (explicit != 0)
+ mtl.block_address_mode = MT_LOCATE_BAM_EXPLICIT;
+ else
+ mtl.block_address_mode = MT_LOCATE_BAM_IMPLICIT;
+
+ if (ioctl(mtfd, MTIOCEXTLOCATE, &mtl) == -1)
+ err(1, "MTIOCEXTLOCATE ioctl failed on %s", tape);
+
+ return (retval);
+}
+
+typedef enum {
+ MT_PERIPH_NAME = 0,
+ MT_UNIT_NUMBER = 1,
+ MT_VENDOR = 2,
+ MT_PRODUCT = 3,
+ MT_REVISION = 4,
+ MT_COMPRESSION_SUPPORTED = 5,
+ MT_COMPRESSION_ENABLED = 6,
+ MT_COMPRESSION_ALGORITHM = 7,
+ MT_MEDIA_DENSITY = 8,
+ MT_MEDIA_BLOCKSIZE = 9,
+ MT_CALCULATED_FILENO = 10,
+ MT_CALCULATED_REL_BLKNO = 11,
+ MT_REPORTED_FILENO = 12,
+ MT_REPORTED_BLKNO = 13,
+ MT_PARTITION = 14,
+ MT_BOP = 15,
+ MT_EOP = 16,
+ MT_BPEW = 17,
+ MT_DSREG = 18,
+ MT_RESID = 19,
+ MT_FIXED_MODE = 20,
+ MT_SERIAL_NUM = 21,
+ MT_MAXIO = 22,
+ MT_CPI_MAXIO = 23,
+ MT_MAX_BLK = 24,
+ MT_MIN_BLK = 25,
+ MT_BLK_GRAN = 26,
+ MT_MAX_EFF_IOSIZE = 27
+} status_item_index;
+
+static struct mt_status_items {
+ const char *name;
+ struct mt_status_entry *entry;
+} req_status_items[] = {
+ { "periph_name", NULL },
+ { "unit_number", NULL },
+ { "vendor", NULL },
+ { "product", NULL },
+ { "revision", NULL },
+ { "compression_supported", NULL },
+ { "compression_enabled", NULL },
+ { "compression_algorithm", NULL },
+ { "media_density", NULL },
+ { "media_blocksize", NULL },
+ { "calculated_fileno", NULL },
+ { "calculated_rel_blkno", NULL },
+ { "reported_fileno", NULL },
+ { "reported_blkno", NULL },
+ { "partition", NULL },
+ { "bop", NULL },
+ { "eop", NULL },
+ { "bpew", NULL },
+ { "dsreg", NULL },
+ { "residual", NULL },
+ { "fixed_mode", NULL },
+ { "serial_num", NULL },
+ { "maxio", NULL },
+ { "cpi_maxio", NULL },
+ { "max_blk", NULL },
+ { "min_blk", NULL },
+ { "blk_gran", NULL },
+ { "max_effective_iosize", NULL }
+};
+
+int
+nstatus_print(int argc, char **argv, char *xml_str,
+ struct mt_status_data *status_data)
+{
+ unsigned int i;
+ int64_t calculated_fileno, calculated_rel_blkno;
+ int64_t rep_fileno, rep_blkno, partition, resid;
+ char block_str[32];
+ const char *dens_str;
+ int dsreg, bop, eop, bpew;
+ int xml_dump = 0;
+ size_t dens_len;
+ unsigned int field_width;
+ int verbose = 0;
+ int c;
+
+ while ((c = getopt(argc, argv, "xv")) != -1) {
+ switch (c) {
+ case 'x':
+ xml_dump = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (xml_dump != 0) {
+ printf("%s", xml_str);
+ return (0);
+ }
+
+ for (i = 0; i < (sizeof(req_status_items)/sizeof(req_status_items[0]));
+ i++) {
+ char *name;
+
+ name = __DECONST(char *, req_status_items[i].name);
+ req_status_items[i].entry = mt_status_entry_find(status_data,
+ name);
+ if (req_status_items[i].entry == NULL) {
+ errx(1, "Cannot find status entry %s",
+ req_status_items[i].name);
+ }
+ }
+
+ printf("Drive: %s%ju: <%s %s %s> Serial Number: %s\n",
+ req_status_items[MT_PERIPH_NAME].entry->value,
+ (uintmax_t)req_status_items[MT_UNIT_NUMBER].entry->value_unsigned,
+ req_status_items[MT_VENDOR].entry->value,
+ req_status_items[MT_PRODUCT].entry->value,
+ req_status_items[MT_REVISION].entry->value,
+ (req_status_items[MT_SERIAL_NUM].entry->value) ?
+ req_status_items[MT_SERIAL_NUM].entry->value : "none");
+ printf("---------------------------------\n");
+
+ /*
+ * We check to see whether we're in fixed mode or not, and don't
+ * just believe the blocksize. If the SILI bit is turned on, the
+ * blocksize will be set to 4, even though we're doing variable
+ * length (well, multiples of 4) blocks.
+ */
+ if (req_status_items[MT_FIXED_MODE].entry->value_signed == 0)
+ snprintf(block_str, sizeof(block_str), "variable");
+ else
+ snprintf(block_str, sizeof(block_str), "%s",
+ getblksiz(req_status_items[
+ MT_MEDIA_BLOCKSIZE].entry->value_unsigned));
+
+ dens_str = denstostring(req_status_items[
+ MT_MEDIA_DENSITY].entry->value_unsigned);
+ if (dens_str == NULL)
+ dens_len = 0;
+ else
+ dens_len = strlen(dens_str);
+ field_width = MAX(dens_len, 17);
+ printf("Mode %-*s Blocksize bpi Compression\n"
+ "Current: %-*s %-12s %-7d ",
+ field_width, "Density", field_width, dens_str, block_str,
+ mt_density_bp(req_status_items[
+ MT_MEDIA_DENSITY].entry->value_unsigned, TRUE));
+
+ if (req_status_items[MT_COMPRESSION_SUPPORTED].entry->value_signed == 0)
+ printf("unsupported\n");
+ else if (req_status_items[
+ MT_COMPRESSION_ENABLED].entry->value_signed == 0)
+ printf("disabled\n");
+ else {
+ printf("enabled (%s)\n",
+ comptostring(req_status_items[
+ MT_COMPRESSION_ALGORITHM].entry->value_unsigned));
+ }
+
+ dsreg = req_status_items[MT_DSREG].entry->value_signed;
+ if (dsreg != MTIO_DSREG_NIL) {
+ const char sfmt[] = "Current Driver State: %s.\n";
+ printf("---------------------------------\n");
+ const char *state_str;
+
+ state_str = get_driver_state_str(dsreg);
+ if (state_str == NULL) {
+ char foo[32];
+ (void) sprintf(foo, "Unknown state 0x%x", dsreg);
+ printf(sfmt, foo);
+ } else {
+ printf(sfmt, state_str);
+ }
+ }
+ resid = req_status_items[MT_RESID].entry->value_signed;
+ calculated_fileno = req_status_items[
+ MT_CALCULATED_FILENO].entry->value_signed;
+ calculated_rel_blkno = req_status_items[
+ MT_CALCULATED_REL_BLKNO].entry->value_signed;
+ rep_fileno = req_status_items[
+ MT_REPORTED_FILENO].entry->value_signed;
+ rep_blkno = req_status_items[
+ MT_REPORTED_BLKNO].entry->value_signed;
+ bop = req_status_items[MT_BOP].entry->value_signed;
+ eop = req_status_items[MT_EOP].entry->value_signed;
+ bpew = req_status_items[MT_BPEW].entry->value_signed;
+ partition = req_status_items[MT_PARTITION].entry->value_signed;
+
+ printf("---------------------------------\n");
+ printf("Partition: %3jd Calc File Number: %3jd "
+ " Calc Record Number: %jd\n"
+ "Residual: %3jd Reported File Number: %3jd "
+ "Reported Record Number: %jd\n", partition, calculated_fileno,
+ calculated_rel_blkno, resid, rep_fileno, rep_blkno);
+
+ printf("Flags: ");
+ if (bop > 0 || eop > 0 || bpew > 0) {
+ int need_comma = 0;
+
+ if (bop > 0) {
+ printf("BOP");
+ need_comma = 1;
+ }
+ if (eop > 0) {
+ if (need_comma != 0)
+ printf(",");
+ printf("EOP");
+ need_comma = 1;
+ }
+ if (bpew > 0) {
+ if (need_comma != 0)
+ printf(",");
+ printf("BPEW");
+ need_comma = 1;
+ }
+ } else {
+ printf("None");
+ }
+ printf("\n");
+ if (verbose != 0) {
+ printf("---------------------------------\n");
+ printf("Tape I/O parameters:\n");
+ for (i = MT_MAXIO; i <= MT_MAX_EFF_IOSIZE; i++) {
+ printf(" %s (%s): %ju bytes\n",
+ req_status_items[i].entry->desc,
+ req_status_items[i].name,
+ req_status_items[i].entry->value_unsigned);
+ }
+ }
+
+ return (0);
+}
+
+int
+mt_xml_cmd(unsigned long cmd, int argc, char **argv, int mtfd, const char *tape)
+{
+ struct mt_status_data status_data;
+#if 0
+ struct mt_status_entry *entry;
+#endif
+ char *xml_str;
+ int retval;
+ unsigned long ioctl_cmd;
+
+ switch (cmd) {
+ case MT_CMD_PROTECT:
+ case MTIOCPARAMGET:
+ ioctl_cmd = MTIOCPARAMGET;
+ break;
+ default:
+ ioctl_cmd = MTIOCEXTGET;
+ break;
+ }
+
+ retval = mt_get_xml_str(mtfd, ioctl_cmd, &xml_str);
+ if (retval != 0)
+ err(1, "Couldn't get mt XML string");
+
+ retval = mt_get_status(xml_str, &status_data);
+ if (retval != XML_STATUS_OK) {
+ warn("Couldn't get mt status for %s", tape);
+ goto bailout;
+ }
+
+ /*
+ * This gets set if there are memory allocation or other errors in
+ * our parsing of the XML.
+ */
+ if (status_data.error != 0) {
+ warnx("%s", status_data.error_str);
+ retval = 1;
+ goto bailout;
+ }
+#if 0
+ STAILQ_FOREACH(entry, &status_data.entries, links)
+ mt_status_tree_print(entry, 0, NULL);
+#endif
+
+ switch (cmd) {
+ case MTIOCEXTGET:
+ retval = nstatus_print(argc, argv, xml_str, &status_data);
+ break;
+ case MTIOCPARAMGET:
+ retval = mt_param(argc, argv, mtfd, xml_str, &status_data);
+ break;
+ case MT_CMD_PROTECT:
+ retval = mt_protect(argc, argv, mtfd, &status_data);
+ break;
+ case MT_CMD_GETDENSITY:
+ retval = mt_getdensity(argc, argv, xml_str, &status_data);
+ break;
+ }
+
+bailout:
+ if (xml_str != NULL)
+ free(xml_str);
+
+ mt_status_free(&status_data);
+
+ return (retval);
+}
+
+static int
+mt_set_param(int mtfd, struct mt_status_data *status_data, char *param_name,
+ char *param_value)
+{
+ struct mt_status_entry *entry;
+ struct mtparamset param_set;
+
+ entry = mt_status_entry_find(status_data,
+ __DECONST(char *, "mtparamget"));
+ if (entry == NULL)
+ errx(1, "Cannot find parameter root node");
+
+ bzero(&param_set, sizeof(param_set));
+ entry = mt_entry_find(entry, param_name);
+ if (entry == NULL)
+ errx(1, "Unknown parameter name \"%s\"", param_name);
+
+ strlcpy(param_set.value_name, param_name, sizeof(param_set.value_name));
+
+ switch (entry->var_type) {
+ case MT_TYPE_INT:
+ param_set.value.value_signed = strtoll(param_value, NULL, 0);
+ param_set.value_type = MT_PARAM_SET_SIGNED;
+ param_set.value_len = entry->size;
+ break;
+ case MT_TYPE_UINT:
+ param_set.value.value_unsigned = strtoull(param_value, NULL, 0);
+ param_set.value_type = MT_PARAM_SET_UNSIGNED;
+ param_set.value_len = entry->size;
+ break;
+ case MT_TYPE_STRING: {
+ size_t param_len;
+
+ param_len = strlen(param_value) + 1;
+ if (param_len > sizeof(param_set.value.value_fixed_str)) {
+ param_set.value_type = MT_PARAM_SET_VAR_STR;
+ param_set.value.value_var_str = param_value;
+ } else {
+ param_set.value_type = MT_PARAM_SET_FIXED_STR;
+ strlcpy(param_set.value.value_fixed_str, param_value,
+ sizeof(param_set.value.value_fixed_str));
+ }
+ param_set.value_len = param_len;
+ break;
+ }
+ default:
+ errx(1, "Unknown parameter type %d for %s", entry->var_type,
+ param_name);
+ break;
+ }
+
+ if (ioctl(mtfd, MTIOCPARAMSET, &param_set) == -1)
+ err(1, "MTIOCPARAMSET");
+
+ if (param_set.status != MT_PARAM_STATUS_OK)
+ errx(1, "Failed to set %s: %s", param_name,
+ param_set.error_str);
+
+ return (0);
+}
+
+
+typedef enum {
+ MT_PP_LBP_R,
+ MT_PP_LBP_W,
+ MT_PP_RBDP,
+ MT_PP_PI_LENGTH,
+ MT_PP_PROT_METHOD
+} mt_protect_param;
+
+static struct mt_protect_info {
+ const char *name;
+ struct mt_status_entry *entry;
+ uint32_t value;
+} mt_protect_list[] = {
+ { "lbp_r", NULL, 0 },
+ { "lbp_w", NULL, 0 },
+ { "rbdp", NULL, 0 },
+ { "pi_length", NULL, 0 },
+ { "prot_method", NULL, 0 }
+};
+
+#define MT_NUM_PROTECT_PARAMS (sizeof(mt_protect_list)/sizeof(mt_protect_list[0]))
+
+#define MT_PROT_NAME "protection"
+
+static int
+mt_protect(int argc, char **argv, int mtfd, struct mt_status_data *status_data)
+{
+ int retval = 0;
+ int do_enable = 0, do_disable = 0, do_list = 0;
+ int rbdp_set = 0, lbp_w_set = 0, lbp_r_set = 0;
+ int prot_method_set = 0, pi_length_set = 0;
+ int verbose = 0;
+ uint32_t rbdp = 0, lbp_w = 0, lbp_r = 0;
+ uint32_t prot_method = 0, pi_length = 0;
+ struct mt_status_entry *prot_entry, *supported_entry;
+ struct mt_status_entry *entry;
+ struct mtparamset params[MT_NUM_PROTECT_PARAMS];
+ struct mtsetlist param_list;
+ unsigned int i;
+ int c;
+
+ while ((c = getopt(argc, argv, "b:delL:m:r:vw:")) != -1) {
+ switch (c) {
+ case 'b':
+ rbdp_set = 1;
+ rbdp = strtoul(optarg, NULL, 0);
+ if ((rbdp != 0) && (rbdp != 1))
+ errx(1, "valid values for -b are 0 and 1");
+ break;
+ case 'd':
+ do_disable = 1;
+ break;
+ case 'e':
+ do_enable = 1;
+ break;
+ case 'l':
+ do_list = 1;
+ break;
+ case 'L':
+ pi_length_set = 1;
+ pi_length = strtoul(optarg, NULL, 0);
+ if (pi_length > SA_CTRL_DP_PI_LENGTH_MASK)
+ errx(1, "PI length %u > maximum %u",
+ pi_length, SA_CTRL_DP_PI_LENGTH_MASK);
+ break;
+ case 'm':
+ prot_method_set = 1;
+ prot_method = strtoul(optarg, NULL, 0);
+ if (prot_method > SA_CTRL_DP_METHOD_MAX)
+ errx(1, "Method %u > maximum %u",
+ prot_method, SA_CTRL_DP_METHOD_MAX);
+ break;
+ case 'r':
+ lbp_r_set = 1;
+ lbp_r = strtoul(optarg, NULL, 0);
+ if ((lbp_r != 0) && (lbp_r != 1))
+ errx(1, "valid values for -r are 0 and 1");
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'w':
+ lbp_w_set = 1;
+ lbp_w = strtoul(optarg, NULL, 0);
+ if ((lbp_w != 0) && (lbp_r != 1))
+ errx(1, "valid values for -r are 0 and 1");
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((rbdp_set + do_disable + do_enable + do_list + pi_length_set +
+ prot_method_set + lbp_r_set + lbp_w_set) == 0)
+ errx(1, "Need an argument for protect");
+
+ if ((do_disable + do_enable + do_list) != 1)
+ errx(1, "You must specify only one of -e, -d or -l");
+
+ if (do_list != 0) {
+ retval = mt_protect_print(status_data, verbose);
+ goto bailout;
+ }
+ if (do_enable != 0) {
+ /*
+ * Enable protection, but allow the user to override
+ * settings if he doesn't want everything turned on.
+ */
+ if (rbdp_set == 0)
+ rbdp = 1;
+ if (lbp_w_set == 0)
+ lbp_w = 1;
+ if (lbp_r_set == 0)
+ lbp_r = 1;
+ /*
+ * If the user doesn't override it, we default to enabling
+ * Reed-Solomon checkums.
+ */
+ if (prot_method_set == 0)
+ prot_method = SA_CTRL_DP_REED_SOLOMON;
+ if (pi_length_set == 0)
+ pi_length = SA_CTRL_DP_RS_LENGTH;
+ } else if (do_disable != 0) {
+ /*
+ * If the user wants to disable protection, we ignore any
+ * other parameters he has set. Everything gets set to 0.
+ */
+ rbdp = lbp_w = lbp_r = 0;
+ prot_method = pi_length = 0;
+ }
+
+ prot_entry = mt_status_entry_find(status_data,
+ __DECONST(char *, MT_PROT_NAME));
+ if (prot_entry == NULL)
+ errx(1, "Unable to find protection information status");
+
+ supported_entry = mt_entry_find(prot_entry,
+ __DECONST(char *, "protection_supported"));
+ if (supported_entry == NULL)
+ errx(1, "Unable to find protection support information");
+
+ if (((supported_entry->var_type == MT_TYPE_INT)
+ && (supported_entry->value_signed == 0))
+ || ((supported_entry->var_type == MT_TYPE_UINT)
+ && (supported_entry->value_unsigned == 0)))
+ errx(1, "This device does not support protection information");
+
+ mt_protect_list[MT_PP_LBP_R].value = lbp_r;
+ mt_protect_list[MT_PP_LBP_W].value = lbp_w;
+ mt_protect_list[MT_PP_RBDP].value = rbdp;
+ mt_protect_list[MT_PP_PI_LENGTH].value = pi_length;
+ mt_protect_list[MT_PP_PROT_METHOD].value = prot_method;
+
+ bzero(&params, sizeof(params));
+ bzero(&param_list, sizeof(param_list));
+
+ /*
+ * Go through the list and make sure that we have this parameter,
+ * and that it is still an unsigned integer. If not, we've got a
+ * problem.
+ */
+ for (i = 0; i < MT_NUM_PROTECT_PARAMS; i++) {
+ entry = mt_entry_find(prot_entry,
+ __DECONST(char *, mt_protect_list[i].name));
+ if (entry == NULL) {
+ errx(1, "Unable to find parameter %s",
+ mt_protect_list[i].name);
+ }
+ mt_protect_list[i].entry = entry;
+
+ if (entry->var_type != MT_TYPE_UINT)
+ errx(1, "Parameter %s is type %d, not unsigned, "
+ "cannot proceed", mt_protect_list[i].name,
+ entry->var_type);
+ snprintf(params[i].value_name, sizeof(params[i].value_name),
+ "%s.%s", MT_PROT_NAME, mt_protect_list[i].name);
+ /* XXX KDM unify types here */
+ params[i].value_type = MT_PARAM_SET_UNSIGNED;
+ params[i].value_len = sizeof(mt_protect_list[i].value);
+ params[i].value.value_unsigned = mt_protect_list[i].value;
+
+ }
+ param_list.num_params = MT_NUM_PROTECT_PARAMS;
+ param_list.param_len = sizeof(params);
+ param_list.params = params;
+
+ if (ioctl(mtfd, MTIOCSETLIST, &param_list) == -1)
+ err(1, "error issuing MTIOCSETLIST ioctl");
+
+ for (i = 0; i < MT_NUM_PROTECT_PARAMS; i++) {
+ if (params[i].status != MT_PARAM_STATUS_OK) {
+ warnx("%s", params[i].error_str);
+ retval = 1;
+ }
+ }
+bailout:
+
+ return (retval);
+}
+
+static int
+mt_param(int argc, char **argv, int mtfd, char *xml_str,
+ struct mt_status_data *status_data)
+{
+ int list = 0, do_set = 0, xml_dump = 0;
+ char *param_name = NULL, *param_value = NULL;
+ int retval = 0, quiet = 0;
+ int c;
+
+ while ((c = getopt(argc, argv, "lp:qs:x")) != -1) {
+ switch (c) {
+ case 'l':
+ list = 1;
+ break;
+ case 'p':
+ if (param_name != NULL) {
+ warnx("Only one parameter name may be "
+ "specified");
+ retval = 1;
+ goto bailout;
+ }
+ param_name = strdup(optarg);
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 's':
+ if (param_value != NULL) {
+ warnx("Only one parameter value may be "
+ "specified");
+ retval = 1;
+ goto bailout;
+ }
+ param_value = strdup(optarg);
+ do_set = 1;
+ break;
+ case 'x':
+ xml_dump = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((list + do_set + xml_dump) != 1) {
+ warnx("You must specify only one of -s, -l or -x");
+ retval = 1;
+ goto bailout;
+ }
+
+ if (xml_dump != 0) {
+ printf("%s", xml_str);
+ retval = 0;
+ goto bailout;
+ }
+
+ if (do_set != 0) {
+ if (param_name == NULL)
+ errx(1, "You must specify -p with -s");
+
+ retval = mt_set_param(mtfd, status_data, param_name,
+ param_value);
+ } else if (list != 0)
+ retval = mt_param_list(status_data, param_name, quiet);
+
+bailout:
+ free(param_name);
+ free(param_value);
+ return (retval);
+}
+
+int
+mt_print_density_entry(struct mt_status_entry *density_root, int indent)
+{
+ struct mt_status_entry *entry;
+ int retval = 0;
+
+ STAILQ_FOREACH(entry, &density_root->child_entries, links) {
+ if (entry->var_type == MT_TYPE_NODE) {
+ retval = mt_print_density_entry(entry, indent + 2);
+ if (retval != 0)
+ break;
+ else
+ continue;
+ }
+ if ((strcmp(entry->entry_name, "primary_density_code") == 0)
+ || (strcmp(entry->entry_name, "secondary_density_code") == 0)
+ || (strcmp(entry->entry_name, "density_code") == 0)) {
+
+ printf("%*s%s (%s): %s\n", indent, "", entry->desc ?
+ entry->desc : "", entry->entry_name,
+ denstostring(entry->value_unsigned));
+ } else if (strcmp(entry->entry_name, "density_flags") == 0) {
+ printf("%*sMedium Access: ", indent, "");
+ if (entry->value_unsigned & MT_DENS_WRITE_OK) {
+ printf("Read and Write\n");
+ } else {
+ printf("Read Only\n");
+ }
+ printf("%*sDefault Density: %s\n", indent, "",
+ (entry->value_unsigned & MT_DENS_DEFLT) ? "Yes" :
+ "No");
+ printf("%*sDuplicate Density: %s\n", indent, "",
+ (entry->value_unsigned & MT_DENS_DUP) ? "Yes" :
+ "No");
+ } else if (strcmp(entry->entry_name, "media_width") == 0) {
+ printf("%*s%s (%s): %.1f mm\n", indent, "",
+ entry->desc ? entry->desc : "", entry->entry_name,
+ (double)((double)entry->value_unsigned / 10));
+ } else if (strcmp(entry->entry_name, "medium_length") == 0) {
+ printf("%*s%s (%s): %ju m\n", indent, "",
+ entry->desc ? entry->desc : "", entry->entry_name,
+ (uintmax_t)entry->value_unsigned);
+ } else if (strcmp(entry->entry_name, "capacity") == 0) {
+ printf("%*s%s (%s): %ju MB\n", indent, "", entry->desc ?
+ entry->desc : "", entry->entry_name,
+ (uintmax_t)entry->value_unsigned);
+ } else {
+ printf("%*s%s (%s): %s\n", indent, "", entry->desc ?
+ entry->desc : "", entry->entry_name, entry->value);
+ }
+ }
+
+ return (retval);
+}
+
+int
+mt_print_density_report(struct mt_status_entry *report_root, int indent)
+{
+ struct mt_status_entry *mt_report, *media_report;
+ struct mt_status_entry *entry;
+ int retval = 0;
+
+ mt_report = mt_entry_find(report_root,
+ __DECONST(char *, MT_MEDIUM_TYPE_REPORT_NAME));
+ if (mt_report == NULL)
+ return (1);
+
+ media_report = mt_entry_find(report_root,
+ __DECONST(char *, MT_MEDIA_REPORT_NAME));
+ if (media_report == NULL)
+ return (1);
+
+ if ((mt_report->value_signed == 0)
+ && (media_report->value_signed == 0)) {
+ printf("%*sThis tape drive supports the following "
+ "media densities:\n", indent, "");
+ } else if ((mt_report->value_signed == 0)
+ && (media_report->value_signed != 0)) {
+ printf("%*sThe tape currently in this drive supports "
+ "the following media densities:\n", indent, "");
+ } else if ((mt_report->value_signed != 0)
+ && (media_report->value_signed == 0)) {
+ printf("%*sThis tape drive supports the following "
+ "media types:\n", indent, "");
+ } else {
+ printf("%*sThis tape currently in this drive supports "
+ "the following media types:\n", indent, "");
+ }
+
+ STAILQ_FOREACH(entry, &report_root->child_entries, links) {
+ struct mt_status_nv *nv;
+
+ if (strcmp(entry->entry_name, MT_DENSITY_ENTRY_NAME) != 0)
+ continue;
+
+ STAILQ_FOREACH(nv, &entry->nv_list, links) {
+ if (strcmp(nv->name, "num") != 0)
+ continue;
+
+ break;
+ }
+
+ indent += 2;
+
+ printf("%*sDensity Entry", indent, "");
+ if (nv != NULL)
+ printf(" %s", nv->value);
+ printf(":\n");
+
+ retval = mt_print_density_entry(entry, indent + 2);
+
+ indent -= 2;
+ }
+
+ return (retval);
+}
+
+int
+mt_print_density(struct mt_status_entry *density_root, int indent)
+{
+ struct mt_status_entry *entry;
+ int retval = 0;
+
+ /*
+ * We should have this entry for every tape drive. This particular
+ * value is reported via the mode page block header, not the
+ * SCSI REPORT DENSITY SUPPORT command.
+ */
+ entry = mt_entry_find(density_root,
+ __DECONST(char *, MT_MEDIA_DENSITY_NAME));
+ if (entry == NULL)
+ errx(1, "Unable to find node %s", MT_MEDIA_DENSITY_NAME);
+
+ printf("%*sCurrent density: %s\n", indent, "",
+ denstostring(entry->value_unsigned));
+
+ /*
+ * It isn't an error if we don't have any density reports. Tape
+ * drives that don't support the REPORT DENSITY SUPPORT command
+ * won't have any; they will only have the current density entry
+ * above.
+ */
+ STAILQ_FOREACH(entry, &density_root->child_entries, links) {
+ if (strcmp(entry->entry_name, MT_DENSITY_REPORT_NAME) != 0)
+ continue;
+
+ retval = mt_print_density_report(entry, indent);
+ }
+
+ return (retval);
+}
+
+int
+mt_getdensity(int argc, char **argv, char *xml_str,
+ struct mt_status_data *status_data)
+{
+ int retval = 0;
+ int verbose = 0, xml_dump = 0;
+ struct mt_status_entry *density_root = NULL;
+ int c;
+
+ while ((c = getopt(argc, argv, "vx")) != -1) {
+ switch (c) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 'x':
+ xml_dump = 1;
+ break;
+ }
+ }
+
+ if (xml_dump != 0) {
+ printf("%s", xml_str);
+ return (0);
+ }
+
+ density_root = mt_status_entry_find(status_data,
+ __DECONST(char *, MT_DENSITY_ROOT_NAME));
+ if (density_root == NULL)
+ errx(1, "Cannot find density root node %s",
+ MT_DENSITY_ROOT_NAME);
+
+ retval = mt_print_density(density_root, 0);
+
+ return (retval);
+}
+
+static void
+warn_eof(void)
+{
+ fprintf(stderr,
+ "The \"eof\" command has been disabled.\n"
+ "Use \"weof\" if you really want to write end-of-file marks,\n"
+ "or \"eom\" if you rather want to skip to the end of "
+ "recorded medium.\n");
+ exit(1);
+}
diff --git a/usr.bin/nc/Makefile b/usr.bin/nc/Makefile
new file mode 100644
index 0000000..b24a086
--- /dev/null
+++ b/usr.bin/nc/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/netcat
+
+PROG= nc
+SRCS= netcat.c atomicio.c socks.c
+
+CFLAGS+=-DIPSEC
+LIBADD= ipsec
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nc/Makefile.depend b/usr.bin/nc/Makefile.depend
new file mode 100644
index 0000000..27cbf26
--- /dev/null
+++ b/usr.bin/nc/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libipsec \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ncal/Makefile b/usr.bin/ncal/Makefile
new file mode 100644
index 0000000..23b5da2
--- /dev/null
+++ b/usr.bin/ncal/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= ncal
+
+LIBADD= calendar ncursesw
+
+LINKS= ${BINDIR}/ncal ${BINDIR}/cal
+MLINKS= ncal.1 cal.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ncal/Makefile.depend b/usr.bin/ncal/Makefile.depend
new file mode 100644
index 0000000..1841f7d
--- /dev/null
+++ b/usr.bin/ncal/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcalendar \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ncal/ncal.1 b/usr.bin/ncal/ncal.1
new file mode 100644
index 0000000..329db6d
--- /dev/null
+++ b/usr.bin/ncal/ncal.1
@@ -0,0 +1,198 @@
+.\" Copyright (c) 1997 Wolfgang Helbig
+.\" 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 March 14, 2009
+.Dt CAL 1
+.Os
+.Sh NAME
+.Nm cal ,
+.Nm ncal
+.Nd displays a calendar and the date of Easter
+.Sh SYNOPSIS
+.Nm
+.Op Fl 3hjy
+.Op Fl A Ar number
+.Op Fl B Ar number
+.Oo
+.Op Ar month
+.Ar year
+.Oc
+.Nm
+.Op Fl 3hj
+.Op Fl A Ar number
+.Op Fl B Ar number
+.Fl m Ar month
+.Op Ar year
+.Nm ncal
+.Op Fl 3hjJpwy
+.Op Fl A Ar number
+.Op Fl B Ar number
+.Op Fl s Ar country_code
+.Oo
+.Op Ar month
+.Ar year
+.Oc
+.Nm ncal
+.Op Fl 3hJeo
+.Op Fl A Ar number
+.Op Fl B Ar number
+.Op Ar year
+.Nm ncal
+.Op Fl CN
+.Op Fl H Ar yyyy-mm-dd
+.Op Fl d Ar yyyy-mm
+.Sh DESCRIPTION
+The
+.Nm
+utility displays a simple calendar in traditional format and
+.Nm ncal
+offers an alternative layout, more options and the date of Easter.
+The new format is a little cramped but it makes a year fit
+on a 25x80 terminal.
+If arguments are not specified,
+the current month is displayed.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl h
+Turns off highlighting of today.
+.It Fl J
+Display Julian Calendar, if combined with the
+.Fl e
+option, display date of Easter according to the Julian Calendar.
+.It Fl e
+Display date of Easter (for western churches).
+.It Fl j
+Display Julian days (days one-based, numbered from January 1).
+.It Fl m Ar month
+Display the specified
+.Ar month .
+If
+.Ar month
+is specified as a decimal number, it may be followed by the letter
+.Ql f
+or
+.Ql p
+to indicate the following or preceding month of that number,
+respectively.
+.It Fl o
+Display date of Orthodox Easter (Greek and Russian
+Orthodox Churches).
+.It Fl p
+Print the country codes and switching days from Julian to Gregorian
+Calendar as they are assumed by
+.Nm ncal .
+The country code as determined from the local environment is marked
+with an asterisk.
+.It Fl s Ar country_code
+Assume the switch from Julian to Gregorian Calendar at the date
+associated with the
+.Ar country_code .
+If not specified,
+.Nm ncal
+tries to guess the switch date from the local environment or
+falls back to September 2, 1752.
+This was when Great
+Britain and her colonies switched to the Gregorian Calendar.
+.It Fl w
+Print the number of the week below each week column.
+.It Fl y
+Display a calendar for the specified year.
+.It Fl 3
+Display the previous, current and next month surrounding today.
+.It Fl A Ar number
+Display the
+.Ar number
+of months after the current month.
+.It Fl B Ar number
+Display the
+.Ar number
+of months before the current month.
+.It Fl C
+Switch to
+.Nm cal
+mode.
+.It Fl N
+Switch to
+.Nm ncal
+mode.
+.It Fl d Ar yyyy-mm
+Use
+.Ar yyyy-mm
+as the current date (for debugging of date selection).
+.It Fl H Ar yyyy-mm-dd
+Use
+.Ar yyyy-mm-dd
+as the current date (for debugging of highlighting).
+.El
+.Pp
+A single parameter specifies the year (1\(en9999) to be displayed;
+note the year must be fully specified:
+.Dq Li cal 89
+will
+.Em not
+display a calendar for 1989. Two parameters denote the month and
+year; the month is either a number between 1 and 12, or a full or
+abbreviated name as specified by the current locale. Month and
+year default to those of the current system clock and time zone (so
+.Dq Li cal -m 8
+will display a calendar for the month of August in the current
+year).
+.Pp
+Not all options can be used together. For example
+.Dq Li -3 -A 2 -B 3 -y -m 7
+would mean:
+show me the three months around the seventh month, three before
+that, two after that and the whole year.
+.Nm ncal
+will warn about these combinations.
+.Pp
+A year starts on January 1.
+.Pp
+Highlighting of dates is disabled if stdout is not a tty.
+.Sh SEE ALSO
+.Xr calendar 3 ,
+.Xr strftime 3
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v5 .
+The
+.Nm ncal
+command appeared in
+.Fx 2.2.6 .
+.Sh AUTHORS
+The
+.Nm ncal
+command and manual were written by
+.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.
+.Pp
+Not all options are compatible and using them in different orders
+will give varying results.
diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c
new file mode 100644
index 0000000..5a5cbc3
--- /dev/null
+++ b/usr.bin/ncal/ncal.c
@@ -0,0 +1,1177 @@
+/*-
+ * Copyright (c) 1997 Wolfgang Helbig
+ * 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 <calendar.h>
+#include <ctype.h>
+#include <err.h>
+#include <langinfo.h>
+#include <libgen.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <time.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <term.h>
+#undef lines /* term.h defines this */
+
+/* Width of one month with backward compatibility and in regular mode*/
+#define MONTH_WIDTH_B_J 27
+#define MONTH_WIDTH_B 20
+
+#define MONTH_WIDTH_R_J 24
+#define MONTH_WIDTH_R 18
+
+#define MAX_WIDTH 64
+
+typedef struct date date;
+
+struct monthlines {
+ wchar_t name[MAX_WIDTH + 1];
+ char lines[7][MAX_WIDTH + 1];
+ char weeks[MAX_WIDTH + 1];
+ unsigned int extralen[7];
+};
+
+struct weekdays {
+ wchar_t names[7][4];
+};
+
+/* The switches from Julian to Gregorian in some countries */
+static struct djswitch {
+ const char *cc; /* Country code according to ISO 3166 */
+ const char *nm; /* Name of country */
+ date dt; /* Last day of Julian calendar */
+} switches[] = {
+ {"AL", "Albania", {1912, 11, 30}},
+ {"AT", "Austria", {1583, 10, 5}},
+ {"AU", "Australia", {1752, 9, 2}},
+ {"BE", "Belgium", {1582, 12, 14}},
+ {"BG", "Bulgaria", {1916, 3, 18}},
+ {"CA", "Canada", {1752, 9, 2}},
+ {"CH", "Switzerland", {1655, 2, 28}},
+ {"CN", "China", {1911, 12, 18}},
+ {"CZ", "Czech Republic",{1584, 1, 6}},
+ {"DE", "Germany", {1700, 2, 18}},
+ {"DK", "Denmark", {1700, 2, 18}},
+ {"ES", "Spain", {1582, 10, 4}},
+ {"FI", "Finland", {1753, 2, 17}},
+ {"FR", "France", {1582, 12, 9}},
+ {"GB", "United Kingdom",{1752, 9, 2}},
+ {"GR", "Greece", {1924, 3, 9}},
+ {"HU", "Hungary", {1587, 10, 21}},
+ {"IS", "Iceland", {1700, 11, 16}},
+ {"IT", "Italy", {1582, 10, 4}},
+ {"JP", "Japan", {1918, 12, 18}},
+ {"LI", "Lithuania", {1918, 2, 1}},
+ {"LN", "Latin", {9999, 05, 31}},
+ {"LU", "Luxembourg", {1582, 12, 14}},
+ {"LV", "Latvia", {1918, 2, 1}},
+ {"NL", "Netherlands", {1582, 12, 14}},
+ {"NO", "Norway", {1700, 2, 18}},
+ {"PL", "Poland", {1582, 10, 4}},
+ {"PT", "Portugal", {1582, 10, 4}},
+ {"RO", "Romania", {1919, 3, 31}},
+ {"RU", "Russia", {1918, 1, 31}},
+ {"SI", "Slovenia", {1919, 3, 4}},
+ {"SE", "Sweden", {1753, 2, 17}},
+ {"TR", "Turkey", {1926, 12, 18}},
+ {"US", "United States", {1752, 9, 2}},
+ {"YU", "Yugoslavia", {1919, 3, 4}}
+};
+
+static struct djswitch *dftswitch =
+ switches + sizeof(switches) / sizeof(struct djswitch) - 2;
+ /* default switch (should be "US") */
+
+/* Table used to print day of month and week numbers */
+static char daystr[] = " 1 2 3 4 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 31"
+ " 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47"
+ " 48 49 50 51 52 53";
+
+/* Table used to print day of year and week numbers */
+static char jdaystr[] = " 1 2 3 4 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 31 32 33 34 35 36 37 38 39"
+ " 40 41 42 43 44 45 46 47 48 49"
+ " 50 51 52 53 54 55 56 57 58 59"
+ " 60 61 62 63 64 65 66 67 68 69"
+ " 70 71 72 73 74 75 76 77 78 79"
+ " 80 81 82 83 84 85 86 87 88 89"
+ " 90 91 92 93 94 95 96 97 98 99"
+ " 100 101 102 103 104 105 106 107 108 109"
+ " 110 111 112 113 114 115 116 117 118 119"
+ " 120 121 122 123 124 125 126 127 128 129"
+ " 130 131 132 133 134 135 136 137 138 139"
+ " 140 141 142 143 144 145 146 147 148 149"
+ " 150 151 152 153 154 155 156 157 158 159"
+ " 160 161 162 163 164 165 166 167 168 169"
+ " 170 171 172 173 174 175 176 177 178 179"
+ " 180 181 182 183 184 185 186 187 188 189"
+ " 190 191 192 193 194 195 196 197 198 199"
+ " 200 201 202 203 204 205 206 207 208 209"
+ " 210 211 212 213 214 215 216 217 218 219"
+ " 220 221 222 223 224 225 226 227 228 229"
+ " 230 231 232 233 234 235 236 237 238 239"
+ " 240 241 242 243 244 245 246 247 248 249"
+ " 250 251 252 253 254 255 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 283 284 285 286 287 288 289"
+ " 290 291 292 293 294 295 296 297 298 299"
+ " 300 301 302 303 304 305 306 307 308 309"
+ " 310 311 312 313 314 315 316 317 318 319"
+ " 320 321 322 323 324 325 326 327 328 329"
+ " 330 331 332 333 334 335 336 337 338 339"
+ " 340 341 342 343 344 345 346 347 348 349"
+ " 350 351 352 353 354 355 356 357 358 359"
+ " 360 361 362 363 364 365 366";
+
+static int flag_nohighlight; /* user doesn't want a highlighted today */
+static int flag_weeks; /* user wants number of week */
+static int nswitch; /* user defined switch date */
+static int nswitchb; /* switch date for backward compatibility */
+static int highlightdate;
+
+static char *center(char *s, char *t, int w);
+static wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
+static int firstday(int y, int m);
+static void highlight(char *dst, char *src, int len, int *extraletters);
+static void mkmonthr(int year, int month, int jd_flag,
+ struct monthlines * monthl);
+static void mkmonthb(int year, int month, int jd_flag,
+ struct monthlines * monthl);
+static void mkweekdays(struct weekdays * wds);
+static void monthranger(int year, int m, int jd_flag,
+ int before, int after);
+static void monthrangeb(int year, int m, int jd_flag,
+ int before, int after);
+static int parsemonth(const char *s, int *m, int *y);
+static void printcc(void);
+static void printeaster(int year, int julian, int orthodox);
+static date *sdater(int ndays, struct date * d);
+static date *sdateb(int ndays, struct date * d);
+static int sndaysr(struct date * d);
+static int sndaysb(struct date * d);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct djswitch *p, *q; /* to search user defined switch date */
+ date never = {10000, 1, 1}; /* outside valid range of dates */
+ date ukswitch = {1752, 9, 2};/* switch date for Great Britain */
+ date dt;
+ int ch; /* holds the option character */
+ int m = 0; /* month */
+ int y = 0; /* year */
+ int flag_backward = 0; /* user called cal--backward compat. */
+ int flag_wholeyear = 0; /* user wants the whole year */
+ int flag_julian_cal = 0; /* user wants Julian Calendar */
+ int flag_julian_day = 0; /* user wants the Julian day numbers */
+ int flag_orthodox = 0; /* user wants Orthodox easter */
+ int flag_easter = 0; /* user wants easter date */
+ int flag_3months = 0; /* user wants 3 month display (-3) */
+ int flag_after = 0; /* user wants to see months after */
+ int flag_before = 0; /* user wants to see months before */
+ int flag_specifiedmonth = 0;/* user wants to see this month (-m) */
+ int flag_givenmonth = 0; /* user has specified month [n] */
+ int flag_givenyear = 0; /* user has specified year [n] */
+ char *cp; /* character pointer */
+ char *flag_today = NULL; /* debug: use date as being today */
+ char *flag_month = NULL; /* requested month as string */
+ char *flag_highlightdate = NULL; /* debug: date to highlight */
+ int before, after;
+ const char *locale; /* locale to get country code */
+
+ flag_nohighlight = 0;
+ flag_weeks = 0;
+
+ /*
+ * Use locale to determine the country code,
+ * and use the country code to determine the default
+ * switchdate and date format from the switches table.
+ */
+ if (setlocale(LC_ALL, "") == NULL)
+ warn("setlocale");
+ locale = setlocale(LC_TIME, NULL);
+ if (locale == NULL ||
+ strcmp(locale, "C") == 0 ||
+ strcmp(locale, "POSIX") == 0 ||
+ strcmp(locale, "ASCII") == 0 ||
+ strcmp(locale, "US-ASCII") == 0)
+ locale = "_US";
+ q = switches + sizeof(switches) / sizeof(struct djswitch);
+ for (p = switches; p != q; p++)
+ if ((cp = strstr(locale, p->cc)) != NULL && *(cp - 1) == '_')
+ break;
+ if (p == q) {
+ nswitch = ndaysj(&dftswitch->dt);
+ } else {
+ nswitch = ndaysj(&p->dt);
+ dftswitch = p;
+ }
+
+
+ /*
+ * Get the filename portion of argv[0] and set flag_backward if
+ * this program is called "cal".
+ */
+ if (strncmp(basename(argv[0]), "cal", strlen("cal")) == 0)
+ flag_backward = 1;
+
+ /* Set the switch date to United Kingdom if backwards compatible */
+ if (flag_backward)
+ nswitchb = ndaysj(&ukswitch);
+
+ before = after = -1;
+
+ while ((ch = getopt(argc, argv, "3A:B:Cd:eH:hjJm:Nops:wy")) != -1)
+ switch (ch) {
+ case '3':
+ flag_3months = 1;
+ break;
+ case 'A':
+ if (flag_after > 0)
+ errx(EX_USAGE, "Double -A specified");
+ flag_after = strtol(optarg, NULL, 10);
+ if (flag_after <= 0)
+ errx(EX_USAGE,
+ "Argument to -A must be positive");
+ break;
+ case 'B':
+ if (flag_before > 0)
+ errx(EX_USAGE, "Double -A specified");
+ flag_before = strtol(optarg, NULL, 10);
+ if (flag_before <= 0)
+ errx(EX_USAGE,
+ "Argument to -B must be positive");
+ break;
+ case 'J':
+ if (flag_backward)
+ usage();
+ nswitch = ndaysj(&never);
+ flag_julian_cal = 1;
+ break;
+ case 'C':
+ flag_backward = 1;
+ break;
+ case 'N':
+ flag_backward = 0;
+ break;
+ case 'd':
+ flag_today = optarg;
+ break;
+ case 'H':
+ flag_highlightdate = optarg;
+ break;
+ case 'h':
+ flag_nohighlight = 1;
+ break;
+ case 'e':
+ if (flag_backward)
+ usage();
+ flag_easter = 1;
+ break;
+ case 'j':
+ flag_julian_day = 1;
+ break;
+ case 'm':
+ if (flag_specifiedmonth)
+ errx(EX_USAGE, "Double -m specified");
+ flag_month = optarg;
+ flag_specifiedmonth = 1;
+ break;
+ case 'o':
+ if (flag_backward)
+ usage();
+ flag_orthodox = 1;
+ flag_easter = 1;
+ break;
+ case 'p':
+ if (flag_backward)
+ usage();
+ printcc();
+ return (0);
+ break;
+ case 's':
+ if (flag_backward)
+ usage();
+ q = switches +
+ sizeof(switches) / sizeof(struct djswitch);
+ for (p = switches;
+ p != q && strcmp(p->cc, optarg) != 0; p++)
+ ;
+ if (p == q)
+ errx(EX_USAGE,
+ "%s: invalid country code", optarg);
+ nswitch = ndaysj(&(p->dt));
+ break;
+ case 'w':
+ if (flag_backward)
+ usage();
+ flag_weeks = 1;
+ break;
+ case 'y':
+ flag_wholeyear = 1;
+ break;
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 2:
+ if (flag_easter)
+ usage();
+ flag_month = *argv++;
+ flag_givenmonth = 1;
+ m = strtol(flag_month, NULL, 10);
+ /* FALLTHROUGH */
+ case 1:
+ y = atoi(*argv);
+ if (y < 1 || y > 9999)
+ errx(EX_USAGE, "year `%s' not in range 1..9999", *argv);
+ argv++;
+ flag_givenyear = 1;
+ break;
+ case 0:
+ if (flag_today != NULL) {
+ y = strtol(flag_today, NULL, 10);
+ m = strtol(flag_today + 5, NULL, 10);
+ } else {
+ time_t t;
+ struct tm *tm;
+
+ t = time(NULL);
+ tm = localtime(&t);
+ y = tm->tm_year + 1900;
+ m = tm->tm_mon + 1;
+ }
+ break;
+ default:
+ usage();
+ }
+
+ if (flag_month != NULL) {
+ if (parsemonth(flag_month, &m, &y)) {
+ errx(EX_USAGE,
+ "%s is neither a month number (1..12) nor a name",
+ flag_month);
+ }
+ }
+
+ /*
+ * What is not supported:
+ * -3 with -A or -B
+ * -3 displays 3 months, -A and -B change that behaviour.
+ * -3 with -y
+ * -3 displays 3 months, -y says display a whole year.
+ * -3 with a given year but no given month or without -m
+ * -3 displays 3 months, no month specified doesn't make clear
+ * which three months.
+ * -m with a given month
+ * conflicting arguments, both specify the same field.
+ * -y with -m
+ * -y displays the whole year, -m displays a single month.
+ * -y with a given month
+ * -y displays the whole year, the given month displays a single
+ * month.
+ * -y with -A or -B
+ * -y displays the whole year, -A and -B display extra months.
+ */
+
+ /* -3 together with -A or -B. */
+ if (flag_3months && (flag_after || flag_before))
+ errx(EX_USAGE, "-3 together with -A and -B is not supported.");
+ /* -3 together with -y. */
+ if (flag_3months && flag_wholeyear)
+ errx(EX_USAGE, "-3 together with -y is not supported.");
+ /* -3 together with givenyear but no givenmonth. */
+ if (flag_3months && flag_givenyear &&
+ !(flag_givenmonth || flag_specifiedmonth))
+ errx(EX_USAGE,
+ "-3 together with a given year but no given month is "
+ "not supported.");
+ /* -m together with xx xxxx. */
+ if (flag_specifiedmonth && flag_givenmonth)
+ errx(EX_USAGE,
+ "-m together with a given month is not supported.");
+ /* -y together with -m. */
+ if (flag_wholeyear && flag_specifiedmonth)
+ errx(EX_USAGE, "-y together with -m is not supported.");
+ /* -y together with xx xxxx. */
+ if (flag_wholeyear && flag_givenmonth)
+ errx(EX_USAGE, "-y together a given month is not supported.");
+ /* -y together with -A or -B. */
+ if (flag_wholeyear && (flag_before > 0 || flag_after > 0))
+ errx(EX_USAGE, "-y together a -A or -B is not supported.");
+ /* The rest should be fine. */
+
+ /* Select the period to display, in order of increasing priority .*/
+ if (flag_wholeyear ||
+ (flag_givenyear && !(flag_givenmonth || flag_specifiedmonth))) {
+ m = 1;
+ before = 0;
+ after = 11;
+ }
+ if (flag_givenyear && flag_givenmonth) {
+ before = 0;
+ after = 0;
+ }
+ if (flag_specifiedmonth) {
+ before = 0;
+ after = 0;
+ }
+ if (flag_before) {
+ before = flag_before;
+ }
+ if (flag_after) {
+ after = flag_after;
+ }
+ if (flag_3months) {
+ before = 1;
+ after = 1;
+ }
+ if (after == -1)
+ after = 0;
+ if (before == -1)
+ before = 0;
+
+ /* Highlight a specified day or today .*/
+ if (flag_highlightdate != NULL) {
+ dt.y = strtol(flag_highlightdate, NULL, 10);
+ dt.m = strtol(flag_highlightdate + 5, NULL, 10);
+ dt.d = strtol(flag_highlightdate + 8, NULL, 10);
+ } else {
+ time_t t;
+ struct tm *tm1;
+
+ t = time(NULL);
+ tm1 = localtime(&t);
+ dt.y = tm1->tm_year + 1900;
+ dt.m = tm1->tm_mon + 1;
+ dt.d = tm1->tm_mday;
+ }
+ highlightdate = sndaysb(&dt);
+
+ /* And now we finally start to calculate and output calendars. */
+ if (flag_easter)
+ printeaster(y, flag_julian_cal, flag_orthodox);
+ else
+ if (flag_backward)
+ monthrangeb(y, m, flag_julian_day, before, after);
+ else
+ monthranger(y, m, flag_julian_day, before, after);
+ return (0);
+}
+
+static void
+usage(void)
+{
+
+ fputs(
+"Usage: cal [general options] [-hjy] [[month] year]\n"
+" cal [general options] [-hj] [-m month] [year]\n"
+" ncal [general options] [-hJjpwy] [-s country_code] [[month] year]\n"
+" ncal [general options] [-hJeo] [year]\n"
+"General options: [-NC3] [-A months] [-B months]\n"
+"For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]\n",
+ stderr);
+ exit(EX_USAGE);
+}
+
+/* Print the assumed switches for all countries. */
+static void
+printcc(void)
+{
+ struct djswitch *p;
+ int n; /* number of lines to print */
+ int m; /* offset from left to right table entry on the same line */
+
+#define FSTR "%c%s %-15s%4d-%02d-%02d"
+#define DFLT(p) ((p) == dftswitch ? '*' : ' ')
+#define FSTRARG(p) DFLT(p), (p)->cc, (p)->nm, (p)->dt.y, (p)->dt.m, (p)->dt.d
+
+ n = sizeof(switches) / sizeof(struct djswitch);
+ m = (n + 1) / 2;
+ n /= 2;
+ for (p = switches; p != switches + n; p++)
+ printf(FSTR" "FSTR"\n", FSTRARG(p), FSTRARG(p+m));
+ if (m != n)
+ printf(FSTR"\n", FSTRARG(p));
+}
+
+/* Print the date of easter sunday. */
+static void
+printeaster(int y, int julian, int orthodox)
+{
+ date dt;
+ struct tm tm;
+ char buf[MAX_WIDTH];
+ static int d_first = -1;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ /* force orthodox easter for years before 1583 */
+ if (y < 1583)
+ orthodox = 1;
+
+ if (orthodox)
+ if (julian)
+ easteroj(y, &dt);
+ else
+ easterog(y, &dt);
+ else
+ easterg(y, &dt);
+
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_year = dt.y - 1900;
+ tm.tm_mon = dt.m - 1;
+ tm.tm_mday = dt.d;
+ strftime(buf, sizeof(buf), d_first ? "%e %B %Y" : "%B %e %Y", &tm);
+ printf("%s\n", buf);
+}
+
+#define MW(mw, me) ((mw) + me)
+#define DECREASEMONTH(m, y) \
+ if (--m == 0) { \
+ m = 12; \
+ y--; \
+ }
+#define INCREASEMONTH(m, y) \
+ if (++(m) == 13) { \
+ (m) = 1; \
+ (y)++; \
+ }
+#define M2Y(m) ((m) / 12)
+#define M2M(m) (1 + (m) % 12)
+
+/* Print all months for the period in the range [ before .. y-m .. after ]. */
+static void
+monthrangeb(int y, int m, int jd_flag, int before, int after)
+{
+ struct monthlines year[12];
+ struct weekdays wds;
+ char s[MAX_WIDTH], t[MAX_WIDTH];
+ wchar_t ws[MAX_WIDTH], ws1[MAX_WIDTH];
+ const char *wdss;
+ int i, j;
+ int mpl;
+ int mw;
+ int m1, m2;
+ int printyearheader;
+ int prevyear = -1;
+
+ mpl = jd_flag ? 2 : 3;
+ mw = jd_flag ? MONTH_WIDTH_B_J : MONTH_WIDTH_B;
+ wdss = (mpl == 2) ? " " : "";
+
+ while (before != 0) {
+ DECREASEMONTH(m, y);
+ before--;
+ after++;
+ }
+ m1 = y * 12 + m - 1;
+ m2 = m1 + after;
+
+ mkweekdays(&wds);
+
+ /*
+ * The year header is printed when there are more than 'mpl' months
+ * and if the first month is a multitude of 'mpl'.
+ * If not, it will print the year behind every month.
+ */
+ printyearheader = (after >= mpl - 1) && (M2M(m1) - 1) % mpl == 0;
+
+ m = m1;
+ while (m <= m2) {
+ int count = 0;
+ for (i = 0; i != mpl && m + i <= m2; i++) {
+ mkmonthb(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i);
+ count++;
+ }
+
+ /* Empty line between two rows of months */
+ if (m != m1)
+ printf("\n");
+
+ /* Year at the top. */
+ if (printyearheader && M2Y(m) != prevyear) {
+ sprintf(s, "%d", M2Y(m));
+ printf("%s\n", center(t, s, mpl * mw));
+ prevyear = M2Y(m);
+ }
+
+ /* Month names. */
+ for (i = 0; i < count; i++)
+ if (printyearheader)
+ wprintf(L"%-*ls ",
+ mw, wcenter(ws, year[i].name, mw));
+ else {
+ swprintf(ws, sizeof(ws)/sizeof(ws[0]),
+ L"%-ls %d", year[i].name, M2Y(m + i));
+ wprintf(L"%-*ls ", mw, wcenter(ws1, ws, mw));
+ }
+ printf("\n");
+
+ /* Day of the week names. */
+ for (i = 0; i < count; i++) {
+ wprintf(L"%s%ls%s%ls%s%ls%s%ls%s%ls%s%ls%s%ls ",
+ wdss, wds.names[6], wdss, wds.names[0],
+ wdss, wds.names[1], wdss, wds.names[2],
+ wdss, wds.names[3], wdss, wds.names[4],
+ wdss, wds.names[5]);
+ }
+ printf("\n");
+
+ /* And the days of the month. */
+ for (i = 0; i != 6; i++) {
+ for (j = 0; j < count; j++)
+ printf("%-*s ",
+ MW(mw, year[j].extralen[i]),
+ year[j].lines[i]+1);
+ printf("\n");
+ }
+
+ m += mpl;
+ }
+}
+
+static void
+monthranger(int y, int m, int jd_flag, int before, int after)
+{
+ struct monthlines year[12];
+ struct weekdays wds;
+ char s[MAX_WIDTH], t[MAX_WIDTH];
+ int i, j;
+ int mpl;
+ int mw;
+ int m1, m2;
+ int prevyear = -1;
+ int printyearheader;
+
+ mpl = jd_flag ? 3 : 4;
+ mw = jd_flag ? MONTH_WIDTH_R_J : MONTH_WIDTH_R;
+
+ while (before != 0) {
+ DECREASEMONTH(m, y);
+ before--;
+ after++;
+ }
+ m1 = y * 12 + m - 1;
+ m2 = m1 + after;
+
+ mkweekdays(&wds);
+
+ /*
+ * The year header is printed when there are more than 'mpl' months
+ * and if the first month is a multitude of 'mpl'.
+ * If not, it will print the year behind every month.
+ */
+ printyearheader = (after >= mpl - 1) && (M2M(m1) - 1) % mpl == 0;
+
+ m = m1;
+ while (m <= m2) {
+ int count = 0;
+ for (i = 0; i != mpl && m + i <= m2; i++) {
+ mkmonthr(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i);
+ count++;
+ }
+
+ /* Empty line between two rows of months. */
+ if (m != m1)
+ printf("\n");
+
+ /* Year at the top. */
+ if (printyearheader && M2Y(m) != prevyear) {
+ sprintf(s, "%d", M2Y(m));
+ printf("%s\n", center(t, s, mpl * mw));
+ prevyear = M2Y(m);
+ }
+
+ /* Month names. */
+ wprintf(L" ");
+ for (i = 0; i < count; i++)
+ if (printyearheader)
+ wprintf(L"%-*ls", mw, year[i].name);
+ else
+ wprintf(L"%-ls %-*d", year[i].name,
+ mw - wcslen(year[i].name) - 1, M2Y(m + i));
+ printf("\n");
+
+ /* And the days of the month. */
+ for (i = 0; i != 7; i++) {
+ /* Week day */
+ wprintf(L"%.2ls", wds.names[i]);
+
+ /* Full months */
+ for (j = 0; j < count; j++)
+ printf("%-*s",
+ MW(mw, year[j].extralen[i]),
+ year[j].lines[i]);
+ printf("\n");
+ }
+
+ /* Week numbers. */
+ if (flag_weeks) {
+ printf(" ");
+ for (i = 0; i < count; i++)
+ printf("%-*s", mw, year[i].weeks);
+ printf("\n");
+ }
+
+ m += mpl;
+ }
+ return;
+}
+
+static void
+mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
+{
+
+ struct tm tm; /* for strftime printing local names of
+ * months */
+ date dt; /* handy date */
+ int dw; /* width of numbers */
+ int first; /* first day of month */
+ int firstm; /* first day of first week of month */
+ int i, j, k, l; /* just indices */
+ int last; /* the first day of next month */
+ int jan1 = 0; /* the first day of this year */
+ char *ds; /* pointer to day strings (daystr or
+ * jdaystr) */
+
+ /* Set name of month. */
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_mon = m;
+ wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]),
+ L"%OB", &tm);
+ mlines->name[0] = towupper(mlines->name[0]);
+
+ /*
+ * Set first and last to the day number of the first day of this
+ * month and the first day of next month respectively. Set jan1 to
+ * the day number of the first day of this year.
+ */
+ first = firstday(y, m + 1);
+ if (m == 11)
+ last = firstday(y + 1, 1);
+ else
+ last = firstday(y, m + 2);
+
+ if (jd_flag)
+ jan1 = firstday(y, 1);
+
+ /*
+ * Set firstm to the day number of monday of the first week of
+ * this month. (This might be in the last month)
+ */
+ firstm = first - weekday(first);
+
+ /* Set ds (daystring) and dw (daywidth) according to the jd_flag. */
+ if (jd_flag) {
+ ds = jdaystr;
+ dw = 4;
+ } else {
+ ds = daystr;
+ dw = 3;
+ }
+
+ /*
+ * Fill the lines with day of month or day of year (julian day)
+ * line index: i, each line is one weekday. column index: j, each
+ * column is one day number. print column index: k.
+ */
+ for (i = 0; i != 7; i++) {
+ l = 0;
+ for (j = firstm + i, k = 0; j < last; j += 7, k += dw) {
+ if (j >= first) {
+ if (jd_flag)
+ dt.d = j - jan1 + 1;
+ else
+ sdater(j, &dt);
+ if (j == highlightdate && !flag_nohighlight
+ && isatty(STDOUT_FILENO))
+ highlight(mlines->lines[i] + k,
+ ds + dt.d * dw, dw, &l);
+ else
+ memcpy(mlines->lines[i] + k + l,
+ ds + dt.d * dw, dw);
+ } else
+ memcpy(mlines->lines[i] + k + l, " ", dw);
+ }
+ mlines->lines[i][k + l] = '\0';
+ mlines->extralen[i] = l;
+ }
+
+ /* fill the weeknumbers. */
+ if (flag_weeks) {
+ for (j = firstm, k = 0; j < last; k += dw, j += 7)
+ if (j <= nswitch)
+ memset(mlines->weeks + k, ' ', dw);
+ else
+ memcpy(mlines->weeks + k,
+ ds + week(j, &i)*dw, dw);
+ mlines->weeks[k] = '\0';
+ }
+}
+
+static void
+mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
+{
+
+ struct tm tm; /* for strftime printing local names of
+ * months */
+ date dt; /* handy date */
+ int dw; /* width of numbers */
+ int first; /* first day of month */
+ int firsts; /* sunday of first week of month */
+ int i, j, k, l; /* just indices */
+ int jan1 = 0; /* the first day of this year */
+ int last; /* the first day of next month */
+ char *ds; /* pointer to day strings (daystr or
+ * jdaystr) */
+
+ /* Set ds (daystring) and dw (daywidth) according to the jd_flag */
+ if (jd_flag) {
+ ds = jdaystr;
+ dw = 4;
+ } else {
+ ds = daystr;
+ dw = 3;
+ }
+
+ /* Set name of month centered. */
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_mon = m;
+ wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]),
+ L"%OB", &tm);
+ mlines->name[0] = towupper(mlines->name[0]);
+
+ /*
+ * Set first and last to the day number of the first day of this
+ * month and the first day of next month respectively. Set jan1 to
+ * the day number of Jan 1st of this year.
+ */
+ dt.y = y;
+ dt.m = m + 1;
+ dt.d = 1;
+ first = sndaysb(&dt);
+ if (m == 11) {
+ dt.y = y + 1;
+ dt.m = 1;
+ dt.d = 1;
+ } else {
+ dt.y = y;
+ dt.m = m + 2;
+ dt.d = 1;
+ }
+ last = sndaysb(&dt);
+
+ if (jd_flag) {
+ dt.y = y;
+ dt.m = 1;
+ dt.d = 1;
+ jan1 = sndaysb(&dt);
+ }
+
+ /*
+ * Set firsts to the day number of sunday of the first week of
+ * this month. (This might be in the last month)
+ */
+ firsts = first - (weekday(first)+1) % 7;
+
+ /*
+ * Fill the lines with day of month or day of year (Julian day)
+ * line index: i, each line is one week. column index: j, each
+ * column is one day number. print column index: k.
+ */
+ for (i = 0; i != 6; i++) {
+ l = 0;
+ for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7;
+ j++, k += dw) {
+ if (j >= first) {
+ if (jd_flag)
+ dt.d = j - jan1 + 1;
+ else
+ sdateb(j, &dt);
+ if (j == highlightdate && !flag_nohighlight)
+ highlight(mlines->lines[i] + k,
+ ds + dt.d * dw, dw, &l);
+ else
+ memcpy(mlines->lines[i] + k + l,
+ ds + dt.d * dw, dw);
+ } else
+ memcpy(mlines->lines[i] + k + l, " ", dw);
+ }
+ if (k == 0)
+ mlines->lines[i][1] = '\0';
+ else
+ mlines->lines[i][k + l] = '\0';
+ mlines->extralen[i] = l;
+ }
+}
+
+/* Put the local names of weekdays into the wds. */
+static void
+mkweekdays(struct weekdays *wds)
+{
+ int i, len, width = 0;
+ struct tm tm;
+ wchar_t buf[20];
+
+ memset(&tm, 0, sizeof(tm));
+
+ for (i = 0; i != 7; i++) {
+ tm.tm_wday = (i+1) % 7;
+ wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", &tm);
+ for (len = 2; len > 0; --len) {
+ if ((width = wcswidth(buf, len)) <= 2)
+ break;
+ }
+ wmemset(wds->names[i], L'\0', 4);
+ if (width == 1)
+ wds->names[i][0] = L' ';
+ wcsncat(wds->names[i], buf, len);
+ wcsncat(wds->names[i], L" ", 1);
+ }
+}
+
+/*
+ * Compute the day number of the first existing date after the first day in
+ * month. (the first day in month and even the month might not exist!)
+ */
+static int
+firstday(int y, int m)
+{
+ date dt;
+ int nd;
+
+ dt.y = y;
+ dt.m = m;
+ dt.d = 1;
+ nd = sndaysr(&dt);
+ for (;;) {
+ sdater(nd, &dt);
+ if ((dt.m >= m && dt.y == y) || dt.y > y)
+ return (nd);
+ else
+ nd++;
+ }
+ /* NEVER REACHED */
+}
+
+/*
+ * Compute the number of days from date, obey the local switch from
+ * Julian to Gregorian if specified by the user.
+ */
+static int
+sndaysr(struct date *d)
+{
+
+ if (nswitch != 0)
+ if (nswitch < ndaysj(d))
+ return (ndaysg(d));
+ else
+ return (ndaysj(d));
+ else
+ return ndaysg(d);
+}
+
+/*
+ * Compute the number of days from date, obey the switch from
+ * Julian to Gregorian as used by UK and her colonies.
+ */
+static int
+sndaysb(struct date *d)
+{
+
+ if (nswitchb < ndaysj(d))
+ return (ndaysg(d));
+ else
+ return (ndaysj(d));
+}
+
+/* Inverse of sndays. */
+static struct date *
+sdater(int nd, struct date *d)
+{
+
+ if (nswitch < nd)
+ return (gdate(nd, d));
+ else
+ return (jdate(nd, d));
+}
+
+/* Inverse of sndaysb. */
+static struct date *
+sdateb(int nd, struct date *d)
+{
+
+ if (nswitchb < nd)
+ return (gdate(nd, d));
+ else
+ return (jdate(nd, d));
+}
+
+/* Center string t in string s of length w by putting enough leading blanks. */
+static char *
+center(char *s, char *t, int w)
+{
+ char blanks[MAX_WIDTH];
+
+ memset(blanks, ' ', sizeof(blanks));
+ sprintf(s, "%.*s%s", (int)(w - strlen(t)) / 2, blanks, t);
+ return (s);
+}
+
+/* Center string t in string s of length w by putting enough leading blanks. */
+static wchar_t *
+wcenter(wchar_t *s, wchar_t *t, int w)
+{
+ char blanks[MAX_WIDTH];
+
+ memset(blanks, ' ', sizeof(blanks));
+ swprintf(s, MAX_WIDTH, L"%.*s%ls", (int)(w - wcslen(t)) / 2, blanks, t);
+ return (s);
+}
+
+static int
+parsemonth(const char *s, int *m, int *y)
+{
+ int nm, ny;
+ char *cp;
+ struct tm tm;
+
+ nm = (int)strtol(s, &cp, 10);
+ if (cp != s) {
+ ny = *y;
+ if (*cp == '\0') {
+ ; /* no special action */
+ } else if (*cp == 'f' || *cp == 'F') {
+ if (nm <= *m)
+ ny++;
+ } else if (*cp == 'p' || *cp == 'P') {
+ if (nm >= *m)
+ ny--;
+ } else
+ return (1);
+ if (nm < 1 || nm > 12)
+ return 1;
+ *m = nm;
+ *y = ny;
+ return (0);
+ }
+ if (strptime(s, "%B", &tm) != NULL || strptime(s, "%b", &tm) != NULL) {
+ *m = tm.tm_mon + 1;
+ return (0);
+ }
+ return (1);
+}
+
+static void
+highlight(char *dst, char *src, int len, int *extralen)
+{
+ static int first = 1;
+ static const char *term_so, *term_se;
+
+ if (first) {
+ char tbuf[1024], cbuf[512], *b;
+
+ term_se = term_so = NULL;
+
+ /* On how to highlight on this type of terminal (if any). */
+ if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) {
+ b = cbuf;
+ term_so = tgetstr("so", &b);
+ term_se = tgetstr("se", &b);
+ }
+
+ first = 0;
+ }
+
+ /*
+ * This check is not necessary, should have been handled before calling
+ * this function.
+ */
+ if (flag_nohighlight) {
+ memcpy(dst, src, len);
+ return;
+ }
+
+ /*
+ * If it is a real terminal, use the data from the termcap database.
+ */
+ if (term_so != NULL && term_se != NULL) {
+ /* separator. */
+ dst[0] = ' ';
+ dst++;
+ /* highlight on. */
+ memcpy(dst, term_so, strlen(term_so));
+ dst += strlen(term_so);
+ /* the actual text. (minus leading space) */
+ len--;
+ src++;
+ memcpy(dst, src, len);
+ dst += len;
+ /* highlight off. */
+ memcpy(dst, term_se, strlen(term_se));
+ *extralen = strlen(term_so) + strlen(term_se);
+ return;
+ }
+
+ /*
+ * Otherwise, print a _, backspace and the letter.
+ */
+ *extralen = 0;
+ /* skip leading space. */
+ src++;
+ len--;
+ /* separator. */
+ dst[0] = ' ';
+ dst++;
+ while (len > 0) {
+ /* _ and backspace. */
+ memcpy(dst, "_\010", 2);
+ dst += 2;
+ *extralen += 2;
+ /* the character. */
+ *dst++ = *src++;
+ len--;
+ }
+ return;
+}
diff --git a/usr.bin/ncal/tests/Makefile b/usr.bin/ncal/tests/Makefile
new file mode 100644
index 0000000..404f512
--- /dev/null
+++ b/usr.bin/ncal/tests/Makefile
@@ -0,0 +1,98 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.b-3m200901-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200901-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200902-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200902-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200903-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200903-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200904-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200904-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200905-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200905-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200906-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200906-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200907-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200907-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200908-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200908-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200909-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200909-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200910-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200910-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200911-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200911-md-nhl.out
+${PACKAGE}FILES+= regress.b-3m200912-jd-nhl.out
+${PACKAGE}FILES+= regress.b-3m200912-md-nhl.out
+${PACKAGE}FILES+= regress.b-y2008-jd-nhl.out
+${PACKAGE}FILES+= regress.b-y2008-md-nhl.out
+${PACKAGE}FILES+= regress.b-y2009-jd-nhl.out
+${PACKAGE}FILES+= regress.b-y2009-md-nhl.out
+${PACKAGE}FILES+= regress.b-y2010-jd-nhl.out
+${PACKAGE}FILES+= regress.b-y2010-md-nhl.out
+${PACKAGE}FILES+= regress.b-y2011-jd-nhl.out
+${PACKAGE}FILES+= regress.b-y2011-md-nhl.out
+${PACKAGE}FILES+= regress.f-3A-nhl.out
+${PACKAGE}FILES+= regress.f-3AB-nhl.out
+${PACKAGE}FILES+= regress.f-3B-nhl.out
+${PACKAGE}FILES+= regress.f-3gy-nhl.out
+${PACKAGE}FILES+= regress.f-3y-nhl.out
+${PACKAGE}FILES+= regress.f-mgm-nhl.out
+${PACKAGE}FILES+= regress.f-yA-nhl.out
+${PACKAGE}FILES+= regress.f-yAB-nhl.out
+${PACKAGE}FILES+= regress.f-yB-nhl.out
+${PACKAGE}FILES+= regress.f-ygm-nhl.out
+${PACKAGE}FILES+= regress.f-ym-nhl.out
+${PACKAGE}FILES+= regress.r-3m200901-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200901-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200902-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200902-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200903-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200903-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200904-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200904-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200905-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200905-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200906-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200906-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200907-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200907-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200908-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200908-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200909-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200909-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200910-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200910-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200911-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200911-md-nhl.out
+${PACKAGE}FILES+= regress.r-3m200912-jd-nhl.out
+${PACKAGE}FILES+= regress.r-3m200912-md-nhl.out
+${PACKAGE}FILES+= regress.r-y2008-jd-nhl.out
+${PACKAGE}FILES+= regress.r-y2008-md-nhl.out
+${PACKAGE}FILES+= regress.r-y2009-jd-nhl.out
+${PACKAGE}FILES+= regress.r-y2009-md-nhl.out
+${PACKAGE}FILES+= regress.r-y2010-jd-nhl.out
+${PACKAGE}FILES+= regress.r-y2010-md-nhl.out
+${PACKAGE}FILES+= regress.r-y2011-jd-nhl.out
+${PACKAGE}FILES+= regress.r-y2011-md-nhl.out
+${PACKAGE}FILES+= regress.s-b-3-nhl.out
+${PACKAGE}FILES+= regress.s-b-A-nhl.out
+${PACKAGE}FILES+= regress.s-b-AB-nhl.out
+${PACKAGE}FILES+= regress.s-b-B-nhl.out
+${PACKAGE}FILES+= regress.s-b-gmgy-nhl.out
+${PACKAGE}FILES+= regress.s-b-m-nhl.out
+${PACKAGE}FILES+= regress.s-b-mgy-nhl.out
+${PACKAGE}FILES+= regress.s-r-3-nhl.out
+${PACKAGE}FILES+= regress.s-r-A-nhl.out
+${PACKAGE}FILES+= regress.s-r-AB-nhl.out
+${PACKAGE}FILES+= regress.s-r-B-nhl.out
+${PACKAGE}FILES+= regress.s-r-gmgy-nhl.out
+${PACKAGE}FILES+= regress.s-r-m-nhl.out
+${PACKAGE}FILES+= regress.s-r-mgy-nhl.out
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/ncal/tests/Makefile.depend b/usr.bin/ncal/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/ncal/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ncal/tests/legacy_test.sh b/usr.bin/ncal/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/ncal/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/ncal/tests/regress.b-3m200901-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200901-jd-nhl.out
new file mode 100644
index 0000000..65d3619
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200901-jd-nhl.out
@@ -0,0 +1,17 @@
+ December 2008 January 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 336 337 338 339 340 341 1 2 3
+342 343 344 345 346 347 348 4 5 6 7 8 9 10
+349 350 351 352 353 354 355 11 12 13 14 15 16 17
+356 357 358 359 360 361 362 18 19 20 21 22 23 24
+363 364 365 366 25 26 27 28 29 30 31
+
+
+ February 2009
+ Su Mo Tu We Th Fr Sa
+ 32 33 34 35 36 37 38
+ 39 40 41 42 43 44 45
+ 46 47 48 49 50 51 52
+ 53 54 55 56 57 58 59
+
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200901-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200901-md-nhl.out
new file mode 100644
index 0000000..afbdde1
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200901-md-nhl.out
@@ -0,0 +1,8 @@
+ December 2008 January 2009 February 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7
+ 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14
+14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21
+21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28
+28 29 30 31 25 26 27 28 29 30 31
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200902-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200902-jd-nhl.out
new file mode 100644
index 0000000..33f614d
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200902-jd-nhl.out
@@ -0,0 +1,18 @@
+ 2009
+ January February
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 32 33 34 35 36 37 38
+ 4 5 6 7 8 9 10 39 40 41 42 43 44 45
+ 11 12 13 14 15 16 17 46 47 48 49 50 51 52
+ 18 19 20 21 22 23 24 53 54 55 56 57 58 59
+ 25 26 27 28 29 30 31
+
+
+ March
+ Su Mo Tu We Th Fr Sa
+ 60 61 62 63 64 65 66
+ 67 68 69 70 71 72 73
+ 74 75 76 77 78 79 80
+ 81 82 83 84 85 86 87
+ 88 89 90
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200902-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200902-md-nhl.out
new file mode 100644
index 0000000..e81b78e
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200902-md-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ January February March
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7
+ 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14
+11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21
+18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28
+25 26 27 28 29 30 31 29 30 31
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200903-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200903-jd-nhl.out
new file mode 100644
index 0000000..5974cbf
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200903-jd-nhl.out
@@ -0,0 +1,17 @@
+ February 2009 March 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 32 33 34 35 36 37 38 60 61 62 63 64 65 66
+ 39 40 41 42 43 44 45 67 68 69 70 71 72 73
+ 46 47 48 49 50 51 52 74 75 76 77 78 79 80
+ 53 54 55 56 57 58 59 81 82 83 84 85 86 87
+ 88 89 90
+
+
+ April 2009
+ Su Mo Tu We Th Fr Sa
+ 91 92 93 94
+ 95 96 97 98 99 100 101
+102 103 104 105 106 107 108
+109 110 111 112 113 114 115
+116 117 118 119 120
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200903-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200903-md-nhl.out
new file mode 100644
index 0000000..4e9f0eb
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200903-md-nhl.out
@@ -0,0 +1,8 @@
+ February 2009 March 2009 April 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4
+ 8 9 10 11 12 13 14 8 9 10 11 12 13 14 5 6 7 8 9 10 11
+15 16 17 18 19 20 21 15 16 17 18 19 20 21 12 13 14 15 16 17 18
+22 23 24 25 26 27 28 22 23 24 25 26 27 28 19 20 21 22 23 24 25
+ 29 30 31 26 27 28 29 30
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200904-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200904-jd-nhl.out
new file mode 100644
index 0000000..d559f32
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200904-jd-nhl.out
@@ -0,0 +1,18 @@
+ 2009
+ March April
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 60 61 62 63 64 65 66 91 92 93 94
+ 67 68 69 70 71 72 73 95 96 97 98 99 100 101
+ 74 75 76 77 78 79 80 102 103 104 105 106 107 108
+ 81 82 83 84 85 86 87 109 110 111 112 113 114 115
+ 88 89 90 116 117 118 119 120
+
+
+ May
+ Su Mo Tu We Th Fr Sa
+ 121 122
+123 124 125 126 127 128 129
+130 131 132 133 134 135 136
+137 138 139 140 141 142 143
+144 145 146 147 148 149 150
+151
diff --git a/usr.bin/ncal/tests/regress.b-3m200904-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200904-md-nhl.out
new file mode 100644
index 0000000..0df9a75
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200904-md-nhl.out
@@ -0,0 +1,8 @@
+ March 2009 April 2009 May 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 6 7 1 2 3 4 1 2
+ 8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9
+15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16
+22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23
+29 30 31 26 27 28 29 30 24 25 26 27 28 29 30
+ 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200905-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200905-jd-nhl.out
new file mode 100644
index 0000000..35d9c2b
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200905-jd-nhl.out
@@ -0,0 +1,17 @@
+ April 2009 May 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 91 92 93 94 121 122
+ 95 96 97 98 99 100 101 123 124 125 126 127 128 129
+102 103 104 105 106 107 108 130 131 132 133 134 135 136
+109 110 111 112 113 114 115 137 138 139 140 141 142 143
+116 117 118 119 120 144 145 146 147 148 149 150
+ 151
+
+ June 2009
+ Su Mo Tu We Th Fr Sa
+ 152 153 154 155 156 157
+158 159 160 161 162 163 164
+165 166 167 168 169 170 171
+172 173 174 175 176 177 178
+179 180 181
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200905-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200905-md-nhl.out
new file mode 100644
index 0000000..3ee495d
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200905-md-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ April May June
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 1 2 1 2 3 4 5 6
+ 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
+12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
+19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
+26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
+ 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200906-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200906-jd-nhl.out
new file mode 100644
index 0000000..47f95b0
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200906-jd-nhl.out
@@ -0,0 +1,18 @@
+ 2009
+ May June
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 121 122 152 153 154 155 156 157
+123 124 125 126 127 128 129 158 159 160 161 162 163 164
+130 131 132 133 134 135 136 165 166 167 168 169 170 171
+137 138 139 140 141 142 143 172 173 174 175 176 177 178
+144 145 146 147 148 149 150 179 180 181
+151
+
+ July
+ Su Mo Tu We Th Fr Sa
+ 182 183 184 185
+186 187 188 189 190 191 192
+193 194 195 196 197 198 199
+200 201 202 203 204 205 206
+207 208 209 210 211 212
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200906-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200906-md-nhl.out
new file mode 100644
index 0000000..a6c1dcd
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200906-md-nhl.out
@@ -0,0 +1,8 @@
+ May 2009 June 2009 July 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 2 3 4 5 6 1 2 3 4
+ 3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
+10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
+17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
+24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
+31
diff --git a/usr.bin/ncal/tests/regress.b-3m200907-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200907-jd-nhl.out
new file mode 100644
index 0000000..9d96208
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200907-jd-nhl.out
@@ -0,0 +1,17 @@
+ June 2009 July 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 152 153 154 155 156 157 182 183 184 185
+158 159 160 161 162 163 164 186 187 188 189 190 191 192
+165 166 167 168 169 170 171 193 194 195 196 197 198 199
+172 173 174 175 176 177 178 200 201 202 203 204 205 206
+179 180 181 207 208 209 210 211 212
+
+
+ August 2009
+ Su Mo Tu We Th Fr Sa
+ 213
+214 215 216 217 218 219 220
+221 222 223 224 225 226 227
+228 229 230 231 232 233 234
+235 236 237 238 239 240 241
+242 243
diff --git a/usr.bin/ncal/tests/regress.b-3m200907-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200907-md-nhl.out
new file mode 100644
index 0000000..9b762e2
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200907-md-nhl.out
@@ -0,0 +1,8 @@
+ June 2009 July 2009 August 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 6 1 2 3 4 1
+ 7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8
+14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15
+21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22
+28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29
+ 30 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200908-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200908-jd-nhl.out
new file mode 100644
index 0000000..768de3f
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200908-jd-nhl.out
@@ -0,0 +1,18 @@
+ 2009
+ July August
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 182 183 184 185 213
+186 187 188 189 190 191 192 214 215 216 217 218 219 220
+193 194 195 196 197 198 199 221 222 223 224 225 226 227
+200 201 202 203 204 205 206 228 229 230 231 232 233 234
+207 208 209 210 211 212 235 236 237 238 239 240 241
+ 242 243
+
+ September
+ Su Mo Tu We Th Fr Sa
+ 244 245 246 247 248
+249 250 251 252 253 254 255
+256 257 258 259 260 261 262
+263 264 265 266 267 268 269
+270 271 272 273
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200908-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200908-md-nhl.out
new file mode 100644
index 0000000..339870e
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200908-md-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ July August September
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 1 1 2 3 4 5
+ 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
+26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
+ 30 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200909-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200909-jd-nhl.out
new file mode 100644
index 0000000..befa00d
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200909-jd-nhl.out
@@ -0,0 +1,17 @@
+ August 2009 September 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 213 244 245 246 247 248
+214 215 216 217 218 219 220 249 250 251 252 253 254 255
+221 222 223 224 225 226 227 256 257 258 259 260 261 262
+228 229 230 231 232 233 234 263 264 265 266 267 268 269
+235 236 237 238 239 240 241 270 271 272 273
+242 243
+
+ October 2009
+ Su Mo Tu We Th Fr Sa
+ 274 275 276
+277 278 279 280 281 282 283
+284 285 286 287 288 289 290
+291 292 293 294 295 296 297
+298 299 300 301 302 303 304
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200909-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200909-md-nhl.out
new file mode 100644
index 0000000..4fb2714
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200909-md-nhl.out
@@ -0,0 +1,8 @@
+ August 2009 September 2009 October 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 1 2 3 4 5 1 2 3
+ 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
+ 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
+16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
+23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
+30 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200910-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200910-jd-nhl.out
new file mode 100644
index 0000000..0a29593
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200910-jd-nhl.out
@@ -0,0 +1,18 @@
+ 2009
+ September October
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 244 245 246 247 248 274 275 276
+249 250 251 252 253 254 255 277 278 279 280 281 282 283
+256 257 258 259 260 261 262 284 285 286 287 288 289 290
+263 264 265 266 267 268 269 291 292 293 294 295 296 297
+270 271 272 273 298 299 300 301 302 303 304
+
+
+ November
+ Su Mo Tu We Th Fr Sa
+305 306 307 308 309 310 311
+312 313 314 315 316 317 318
+319 320 321 322 323 324 325
+326 327 328 329 330 331 332
+333 334
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200910-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200910-md-nhl.out
new file mode 100644
index 0000000..29cd67e
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200910-md-nhl.out
@@ -0,0 +1,8 @@
+ September 2009 October 2009 November 2009
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
+ 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
+13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
+20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
+27 28 29 30 25 26 27 28 29 30 31 29 30
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200911-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200911-jd-nhl.out
new file mode 100644
index 0000000..4969cbc
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200911-jd-nhl.out
@@ -0,0 +1,17 @@
+ October 2009 November 2009
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 274 275 276 305 306 307 308 309 310 311
+277 278 279 280 281 282 283 312 313 314 315 316 317 318
+284 285 286 287 288 289 290 319 320 321 322 323 324 325
+291 292 293 294 295 296 297 326 327 328 329 330 331 332
+298 299 300 301 302 303 304 333 334
+
+
+ December 2009
+ Su Mo Tu We Th Fr Sa
+ 335 336 337 338 339
+340 341 342 343 344 345 346
+347 348 349 350 351 352 353
+354 355 356 357 358 359 360
+361 362 363 364 365
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200911-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200911-md-nhl.out
new file mode 100644
index 0000000..b1f57ff
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200911-md-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ October November December
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
+ 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
+11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
+18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
+25 26 27 28 29 30 31 29 30 27 28 29 30 31
+
diff --git a/usr.bin/ncal/tests/regress.b-3m200912-jd-nhl.out b/usr.bin/ncal/tests/regress.b-3m200912-jd-nhl.out
new file mode 100644
index 0000000..61480a5
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200912-jd-nhl.out
@@ -0,0 +1,19 @@
+ 2009
+ November December
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+305 306 307 308 309 310 311 335 336 337 338 339
+312 313 314 315 316 317 318 340 341 342 343 344 345 346
+319 320 321 322 323 324 325 347 348 349 350 351 352 353
+326 327 328 329 330 331 332 354 355 356 357 358 359 360
+333 334 361 362 363 364 365
+
+
+ 2010
+ January
+ Su Mo Tu We Th Fr Sa
+ 1 2
+ 3 4 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
+ 31
diff --git a/usr.bin/ncal/tests/regress.b-3m200912-md-nhl.out b/usr.bin/ncal/tests/regress.b-3m200912-md-nhl.out
new file mode 100644
index 0000000..fd4d220
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-3m200912-md-nhl.out
@@ -0,0 +1,8 @@
+ November 2009 December 2009 January 2010
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 6 7 1 2 3 4 5 1 2
+ 8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9
+15 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16
+22 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23
+29 30 27 28 29 30 31 24 25 26 27 28 29 30
+ 31
diff --git a/usr.bin/ncal/tests/regress.b-y2008-jd-nhl.out b/usr.bin/ncal/tests/regress.b-y2008-jd-nhl.out
new file mode 100644
index 0000000..cd423db
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2008-jd-nhl.out
@@ -0,0 +1,54 @@
+ 2008
+ January February
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 32 33
+ 6 7 8 9 10 11 12 34 35 36 37 38 39 40
+ 13 14 15 16 17 18 19 41 42 43 44 45 46 47
+ 20 21 22 23 24 25 26 48 49 50 51 52 53 54
+ 27 28 29 30 31 55 56 57 58 59 60
+
+
+ March April
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 61 92 93 94 95 96
+ 62 63 64 65 66 67 68 97 98 99 100 101 102 103
+ 69 70 71 72 73 74 75 104 105 106 107 108 109 110
+ 76 77 78 79 80 81 82 111 112 113 114 115 116 117
+ 83 84 85 86 87 88 89 118 119 120 121
+ 90 91
+
+ May June
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 122 123 124 153 154 155 156 157 158 159
+125 126 127 128 129 130 131 160 161 162 163 164 165 166
+132 133 134 135 136 137 138 167 168 169 170 171 172 173
+139 140 141 142 143 144 145 174 175 176 177 178 179 180
+146 147 148 149 150 151 152 181 182
+
+
+ July August
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 183 184 185 186 187 214 215
+188 189 190 191 192 193 194 216 217 218 219 220 221 222
+195 196 197 198 199 200 201 223 224 225 226 227 228 229
+202 203 204 205 206 207 208 230 231 232 233 234 235 236
+209 210 211 212 213 237 238 239 240 241 242 243
+ 244
+
+ September October
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 245 246 247 248 249 250 275 276 277 278
+251 252 253 254 255 256 257 279 280 281 282 283 284 285
+258 259 260 261 262 263 264 286 287 288 289 290 291 292
+265 266 267 268 269 270 271 293 294 295 296 297 298 299
+272 273 274 300 301 302 303 304 305
+
+
+ November December
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 306 336 337 338 339 340 341
+307 308 309 310 311 312 313 342 343 344 345 346 347 348
+314 315 316 317 318 319 320 349 350 351 352 353 354 355
+321 322 323 324 325 326 327 356 357 358 359 360 361 362
+328 329 330 331 332 333 334 363 364 365 366
+335
diff --git a/usr.bin/ncal/tests/regress.b-y2008-md-nhl.out b/usr.bin/ncal/tests/regress.b-y2008-md-nhl.out
new file mode 100644
index 0000000..dcd96fc
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2008-md-nhl.out
@@ -0,0 +1,36 @@
+ 2008
+ January February March
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 1 2 1
+ 6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8
+13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15
+20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22
+27 28 29 30 31 24 25 26 27 28 29 23 24 25 26 27 28 29
+ 30 31
+
+ April May June
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
+ 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
+13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
+20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
+27 28 29 30 25 26 27 28 29 30 31 29 30
+
+
+ July August September
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 5 1 2 1 2 3 4 5 6
+ 6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
+13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
+20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
+27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
+ 31
+
+ October November December
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 1 1 2 3 4 5 6
+ 5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
+12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
+19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
+26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
+ 30
diff --git a/usr.bin/ncal/tests/regress.b-y2009-jd-nhl.out b/usr.bin/ncal/tests/regress.b-y2009-jd-nhl.out
new file mode 100644
index 0000000..db22d05
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2009-jd-nhl.out
@@ -0,0 +1,54 @@
+ 2009
+ January February
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 32 33 34 35 36 37 38
+ 4 5 6 7 8 9 10 39 40 41 42 43 44 45
+ 11 12 13 14 15 16 17 46 47 48 49 50 51 52
+ 18 19 20 21 22 23 24 53 54 55 56 57 58 59
+ 25 26 27 28 29 30 31
+
+
+ March April
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 60 61 62 63 64 65 66 91 92 93 94
+ 67 68 69 70 71 72 73 95 96 97 98 99 100 101
+ 74 75 76 77 78 79 80 102 103 104 105 106 107 108
+ 81 82 83 84 85 86 87 109 110 111 112 113 114 115
+ 88 89 90 116 117 118 119 120
+
+
+ May June
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 121 122 152 153 154 155 156 157
+123 124 125 126 127 128 129 158 159 160 161 162 163 164
+130 131 132 133 134 135 136 165 166 167 168 169 170 171
+137 138 139 140 141 142 143 172 173 174 175 176 177 178
+144 145 146 147 148 149 150 179 180 181
+151
+
+ July August
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 182 183 184 185 213
+186 187 188 189 190 191 192 214 215 216 217 218 219 220
+193 194 195 196 197 198 199 221 222 223 224 225 226 227
+200 201 202 203 204 205 206 228 229 230 231 232 233 234
+207 208 209 210 211 212 235 236 237 238 239 240 241
+ 242 243
+
+ September October
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 244 245 246 247 248 274 275 276
+249 250 251 252 253 254 255 277 278 279 280 281 282 283
+256 257 258 259 260 261 262 284 285 286 287 288 289 290
+263 264 265 266 267 268 269 291 292 293 294 295 296 297
+270 271 272 273 298 299 300 301 302 303 304
+
+
+ November December
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+305 306 307 308 309 310 311 335 336 337 338 339
+312 313 314 315 316 317 318 340 341 342 343 344 345 346
+319 320 321 322 323 324 325 347 348 349 350 351 352 353
+326 327 328 329 330 331 332 354 355 356 357 358 359 360
+333 334 361 362 363 364 365
+
diff --git a/usr.bin/ncal/tests/regress.b-y2009-md-nhl.out b/usr.bin/ncal/tests/regress.b-y2009-md-nhl.out
new file mode 100644
index 0000000..c9f084e
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2009-md-nhl.out
@@ -0,0 +1,36 @@
+ 2009
+ January February March
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7
+ 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14
+11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21
+18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28
+25 26 27 28 29 30 31 29 30 31
+
+
+ April May June
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 1 2 1 2 3 4 5 6
+ 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
+12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
+19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
+26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
+ 31
+
+ July August September
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 4 1 1 2 3 4 5
+ 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
+26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
+ 30 31
+
+ October November December
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
+ 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
+11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
+18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
+25 26 27 28 29 30 31 29 30 27 28 29 30 31
+
diff --git a/usr.bin/ncal/tests/regress.b-y2010-jd-nhl.out b/usr.bin/ncal/tests/regress.b-y2010-jd-nhl.out
new file mode 100644
index 0000000..d7ad9fc
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2010-jd-nhl.out
@@ -0,0 +1,54 @@
+ 2010
+ January February
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 32 33 34 35 36 37
+ 3 4 5 6 7 8 9 38 39 40 41 42 43 44
+ 10 11 12 13 14 15 16 45 46 47 48 49 50 51
+ 17 18 19 20 21 22 23 52 53 54 55 56 57 58
+ 24 25 26 27 28 29 30 59
+ 31
+
+ March April
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 60 61 62 63 64 65 91 92 93
+ 66 67 68 69 70 71 72 94 95 96 97 98 99 100
+ 73 74 75 76 77 78 79 101 102 103 104 105 106 107
+ 80 81 82 83 84 85 86 108 109 110 111 112 113 114
+ 87 88 89 90 115 116 117 118 119 120
+
+
+ May June
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 121 152 153 154 155 156
+122 123 124 125 126 127 128 157 158 159 160 161 162 163
+129 130 131 132 133 134 135 164 165 166 167 168 169 170
+136 137 138 139 140 141 142 171 172 173 174 175 176 177
+143 144 145 146 147 148 149 178 179 180 181
+150 151
+
+ July August
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 182 183 184 213 214 215 216 217 218 219
+185 186 187 188 189 190 191 220 221 222 223 224 225 226
+192 193 194 195 196 197 198 227 228 229 230 231 232 233
+199 200 201 202 203 204 205 234 235 236 237 238 239 240
+206 207 208 209 210 211 212 241 242 243
+
+
+ September October
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 244 245 246 247 274 275
+248 249 250 251 252 253 254 276 277 278 279 280 281 282
+255 256 257 258 259 260 261 283 284 285 286 287 288 289
+262 263 264 265 266 267 268 290 291 292 293 294 295 296
+269 270 271 272 273 297 298 299 300 301 302 303
+ 304
+
+ November December
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 305 306 307 308 309 310 335 336 337 338
+311 312 313 314 315 316 317 339 340 341 342 343 344 345
+318 319 320 321 322 323 324 346 347 348 349 350 351 352
+325 326 327 328 329 330 331 353 354 355 356 357 358 359
+332 333 334 360 361 362 363 364 365
+
diff --git a/usr.bin/ncal/tests/regress.b-y2010-md-nhl.out b/usr.bin/ncal/tests/regress.b-y2010-md-nhl.out
new file mode 100644
index 0000000..1d8a410
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2010-md-nhl.out
@@ -0,0 +1,36 @@
+ 2010
+ January February March
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 2 3 4 5 6 1 2 3 4 5 6
+ 3 4 5 6 7 8 9 7 8 9 10 11 12 13 7 8 9 10 11 12 13
+10 11 12 13 14 15 16 14 15 16 17 18 19 20 14 15 16 17 18 19 20
+17 18 19 20 21 22 23 21 22 23 24 25 26 27 21 22 23 24 25 26 27
+24 25 26 27 28 29 30 28 28 29 30 31
+31
+
+ April May June
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 1 2 3 4 5
+ 4 5 6 7 8 9 10 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26
+25 26 27 28 29 30 23 24 25 26 27 28 29 27 28 29 30
+ 30 31
+
+ July August September
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 3 1 2 3 4 5 6 7 1 2 3 4
+ 4 5 6 7 8 9 10 8 9 10 11 12 13 14 5 6 7 8 9 10 11
+11 12 13 14 15 16 17 15 16 17 18 19 20 21 12 13 14 15 16 17 18
+18 19 20 21 22 23 24 22 23 24 25 26 27 28 19 20 21 22 23 24 25
+25 26 27 28 29 30 31 29 30 31 26 27 28 29 30
+
+
+ October November December
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 2 3 4 5 6 1 2 3 4
+ 3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
+10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
+17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
+24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
+31
diff --git a/usr.bin/ncal/tests/regress.b-y2011-jd-nhl.out b/usr.bin/ncal/tests/regress.b-y2011-jd-nhl.out
new file mode 100644
index 0000000..31abb4e
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2011-jd-nhl.out
@@ -0,0 +1,54 @@
+ 2011
+ January February
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 32 33 34 35 36
+ 2 3 4 5 6 7 8 37 38 39 40 41 42 43
+ 9 10 11 12 13 14 15 44 45 46 47 48 49 50
+ 16 17 18 19 20 21 22 51 52 53 54 55 56 57
+ 23 24 25 26 27 28 29 58 59
+ 30 31
+
+ March April
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 60 61 62 63 64 91 92
+ 65 66 67 68 69 70 71 93 94 95 96 97 98 99
+ 72 73 74 75 76 77 78 100 101 102 103 104 105 106
+ 79 80 81 82 83 84 85 107 108 109 110 111 112 113
+ 86 87 88 89 90 114 115 116 117 118 119 120
+
+
+ May June
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+121 122 123 124 125 126 127 152 153 154 155
+128 129 130 131 132 133 134 156 157 158 159 160 161 162
+135 136 137 138 139 140 141 163 164 165 166 167 168 169
+142 143 144 145 146 147 148 170 171 172 173 174 175 176
+149 150 151 177 178 179 180 181
+
+
+ July August
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 182 183 213 214 215 216 217 218
+184 185 186 187 188 189 190 219 220 221 222 223 224 225
+191 192 193 194 195 196 197 226 227 228 229 230 231 232
+198 199 200 201 202 203 204 233 234 235 236 237 238 239
+205 206 207 208 209 210 211 240 241 242 243
+212
+
+ September October
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 244 245 246 274
+247 248 249 250 251 252 253 275 276 277 278 279 280 281
+254 255 256 257 258 259 260 282 283 284 285 286 287 288
+261 262 263 264 265 266 267 289 290 291 292 293 294 295
+268 269 270 271 272 273 296 297 298 299 300 301 302
+ 303 304
+
+ November December
+ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 305 306 307 308 309 335 336 337
+310 311 312 313 314 315 316 338 339 340 341 342 343 344
+317 318 319 320 321 322 323 345 346 347 348 349 350 351
+324 325 326 327 328 329 330 352 353 354 355 356 357 358
+331 332 333 334 359 360 361 362 363 364 365
+
diff --git a/usr.bin/ncal/tests/regress.b-y2011-md-nhl.out b/usr.bin/ncal/tests/regress.b-y2011-md-nhl.out
new file mode 100644
index 0000000..d76a44f
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.b-y2011-md-nhl.out
@@ -0,0 +1,36 @@
+ 2011
+ January February March
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 1 2 3 4 5 1 2 3 4 5
+ 2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12
+ 9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19
+16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26
+23 24 25 26 27 28 29 27 28 27 28 29 30 31
+30 31
+
+ April May June
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 2 3 4 5 6 7 1 2 3 4
+ 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11
+10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18
+17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25
+24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
+
+
+ July August September
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 2 3 4 5 6 1 2 3
+ 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
+10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
+17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24
+24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30
+31
+
+ October November December
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 1 2 3 4 5 1 2 3
+ 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
+ 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
+16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
+23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
+30 31
diff --git a/usr.bin/ncal/tests/regress.f-3A-nhl.out b/usr.bin/ncal/tests/regress.f-3A-nhl.out
new file mode 100644
index 0000000..e7f5e91
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-3A-nhl.out
@@ -0,0 +1 @@
+ncal: -3 together with -A and -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-3AB-nhl.out b/usr.bin/ncal/tests/regress.f-3AB-nhl.out
new file mode 100644
index 0000000..e7f5e91
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-3AB-nhl.out
@@ -0,0 +1 @@
+ncal: -3 together with -A and -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-3B-nhl.out b/usr.bin/ncal/tests/regress.f-3B-nhl.out
new file mode 100644
index 0000000..e7f5e91
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-3B-nhl.out
@@ -0,0 +1 @@
+ncal: -3 together with -A and -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-3gy-nhl.out b/usr.bin/ncal/tests/regress.f-3gy-nhl.out
new file mode 100644
index 0000000..018646f
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-3gy-nhl.out
@@ -0,0 +1 @@
+ncal: -3 together with a given year but no given month is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-3y-nhl.out b/usr.bin/ncal/tests/regress.f-3y-nhl.out
new file mode 100644
index 0000000..5b2e000
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-3y-nhl.out
@@ -0,0 +1 @@
+ncal: -3 together with -y is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-mgm-nhl.out b/usr.bin/ncal/tests/regress.f-mgm-nhl.out
new file mode 100644
index 0000000..5f6c2eb
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-mgm-nhl.out
@@ -0,0 +1 @@
+ncal: -m together with a given month is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-yA-nhl.out b/usr.bin/ncal/tests/regress.f-yA-nhl.out
new file mode 100644
index 0000000..ce39ae7
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-yA-nhl.out
@@ -0,0 +1 @@
+ncal: -y together a -A or -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-yAB-nhl.out b/usr.bin/ncal/tests/regress.f-yAB-nhl.out
new file mode 100644
index 0000000..ce39ae7
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-yAB-nhl.out
@@ -0,0 +1 @@
+ncal: -y together a -A or -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-yB-nhl.out b/usr.bin/ncal/tests/regress.f-yB-nhl.out
new file mode 100644
index 0000000..ce39ae7
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-yB-nhl.out
@@ -0,0 +1 @@
+ncal: -y together a -A or -B is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-ygm-nhl.out b/usr.bin/ncal/tests/regress.f-ygm-nhl.out
new file mode 100644
index 0000000..6f898eb
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-ygm-nhl.out
@@ -0,0 +1 @@
+ncal: -y together a given month is not supported.
diff --git a/usr.bin/ncal/tests/regress.f-ym-nhl.out b/usr.bin/ncal/tests/regress.f-ym-nhl.out
new file mode 100644
index 0000000..1921d92
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.f-ym-nhl.out
@@ -0,0 +1 @@
+ncal: -y together with -m is not supported.
diff --git a/usr.bin/ncal/tests/regress.r-3m200901-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200901-jd-nhl.out
new file mode 100644
index 0000000..26ef49b
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200901-jd-nhl.out
@@ -0,0 +1,8 @@
+ December 2008 January 2009 February 2009
+Mo 336 343 350 357 364 5 12 19 26 33 40 47 54
+Tu 337 344 351 358 365 6 13 20 27 34 41 48 55
+We 338 345 352 359 366 7 14 21 28 35 42 49 56
+Th 339 346 353 360 1 8 15 22 29 36 43 50 57
+Fr 340 347 354 361 2 9 16 23 30 37 44 51 58
+Sa 341 348 355 362 3 10 17 24 31 38 45 52 59
+Su 342 349 356 363 4 11 18 25 32 39 46 53
diff --git a/usr.bin/ncal/tests/regress.r-3m200901-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200901-md-nhl.out
new file mode 100644
index 0000000..d197fd3
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200901-md-nhl.out
@@ -0,0 +1,8 @@
+ December 2008 January 2009 February 2009
+Mo 1 8 15 22 29 5 12 19 26 2 9 16 23
+Tu 2 9 16 23 30 6 13 20 27 3 10 17 24
+We 3 10 17 24 31 7 14 21 28 4 11 18 25
+Th 4 11 18 25 1 8 15 22 29 5 12 19 26
+Fr 5 12 19 26 2 9 16 23 30 6 13 20 27
+Sa 6 13 20 27 3 10 17 24 31 7 14 21 28
+Su 7 14 21 28 4 11 18 25 1 8 15 22
diff --git a/usr.bin/ncal/tests/regress.r-3m200902-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200902-jd-nhl.out
new file mode 100644
index 0000000..cd84869
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200902-jd-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ January February March
+Mo 5 12 19 26 33 40 47 54 61 68 75 82 89
+Tu 6 13 20 27 34 41 48 55 62 69 76 83 90
+We 7 14 21 28 35 42 49 56 63 70 77 84
+Th 1 8 15 22 29 36 43 50 57 64 71 78 85
+Fr 2 9 16 23 30 37 44 51 58 65 72 79 86
+Sa 3 10 17 24 31 38 45 52 59 66 73 80 87
+Su 4 11 18 25 32 39 46 53 60 67 74 81 88
diff --git a/usr.bin/ncal/tests/regress.r-3m200902-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200902-md-nhl.out
new file mode 100644
index 0000000..20c35f1
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200902-md-nhl.out
@@ -0,0 +1,8 @@
+ January 2009 February 2009 March 2009
+Mo 5 12 19 26 2 9 16 23 2 9 16 23 30
+Tu 6 13 20 27 3 10 17 24 3 10 17 24 31
+We 7 14 21 28 4 11 18 25 4 11 18 25
+Th 1 8 15 22 29 5 12 19 26 5 12 19 26
+Fr 2 9 16 23 30 6 13 20 27 6 13 20 27
+Sa 3 10 17 24 31 7 14 21 28 7 14 21 28
+Su 4 11 18 25 1 8 15 22 1 8 15 22 29
diff --git a/usr.bin/ncal/tests/regress.r-3m200903-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200903-jd-nhl.out
new file mode 100644
index 0000000..1ca28e0
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200903-jd-nhl.out
@@ -0,0 +1,8 @@
+ February 2009 March 2009 April 2009
+Mo 33 40 47 54 61 68 75 82 89 96 103 110 117
+Tu 34 41 48 55 62 69 76 83 90 97 104 111 118
+We 35 42 49 56 63 70 77 84 91 98 105 112 119
+Th 36 43 50 57 64 71 78 85 92 99 106 113 120
+Fr 37 44 51 58 65 72 79 86 93 100 107 114
+Sa 38 45 52 59 66 73 80 87 94 101 108 115
+Su 32 39 46 53 60 67 74 81 88 95 102 109 116
diff --git a/usr.bin/ncal/tests/regress.r-3m200903-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200903-md-nhl.out
new file mode 100644
index 0000000..19fc969
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200903-md-nhl.out
@@ -0,0 +1,8 @@
+ February 2009 March 2009 April 2009
+Mo 2 9 16 23 2 9 16 23 30 6 13 20 27
+Tu 3 10 17 24 3 10 17 24 31 7 14 21 28
+We 4 11 18 25 4 11 18 25 1 8 15 22 29
+Th 5 12 19 26 5 12 19 26 2 9 16 23 30
+Fr 6 13 20 27 6 13 20 27 3 10 17 24
+Sa 7 14 21 28 7 14 21 28 4 11 18 25
+Su 1 8 15 22 1 8 15 22 29 5 12 19 26
diff --git a/usr.bin/ncal/tests/regress.r-3m200904-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200904-jd-nhl.out
new file mode 100644
index 0000000..8b8e77a
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200904-jd-nhl.out
@@ -0,0 +1,8 @@
+ March 2009 April 2009 May 2009
+Mo 61 68 75 82 89 96 103 110 117 124 131 138 145
+Tu 62 69 76 83 90 97 104 111 118 125 132 139 146
+We 63 70 77 84 91 98 105 112 119 126 133 140 147
+Th 64 71 78 85 92 99 106 113 120 127 134 141 148
+Fr 65 72 79 86 93 100 107 114 121 128 135 142 149
+Sa 66 73 80 87 94 101 108 115 122 129 136 143 150
+Su 60 67 74 81 88 95 102 109 116 123 130 137 144 151
diff --git a/usr.bin/ncal/tests/regress.r-3m200904-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200904-md-nhl.out
new file mode 100644
index 0000000..449127c
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200904-md-nhl.out
@@ -0,0 +1,8 @@
+ March 2009 April 2009 May 2009
+Mo 2 9 16 23 30 6 13 20 27 4 11 18 25
+Tu 3 10 17 24 31 7 14 21 28 5 12 19 26
+We 4 11 18 25 1 8 15 22 29 6 13 20 27
+Th 5 12 19 26 2 9 16 23 30 7 14 21 28
+Fr 6 13 20 27 3 10 17 24 1 8 15 22 29
+Sa 7 14 21 28 4 11 18 25 2 9 16 23 30
+Su 1 8 15 22 29 5 12 19 26 3 10 17 24 31
diff --git a/usr.bin/ncal/tests/regress.r-3m200905-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200905-jd-nhl.out
new file mode 100644
index 0000000..9054a1f
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200905-jd-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ April May June
+Mo 96 103 110 117 124 131 138 145 152 159 166 173 180
+Tu 97 104 111 118 125 132 139 146 153 160 167 174 181
+We 91 98 105 112 119 126 133 140 147 154 161 168 175
+Th 92 99 106 113 120 127 134 141 148 155 162 169 176
+Fr 93 100 107 114 121 128 135 142 149 156 163 170 177
+Sa 94 101 108 115 122 129 136 143 150 157 164 171 178
+Su 95 102 109 116 123 130 137 144 151 158 165 172 179
diff --git a/usr.bin/ncal/tests/regress.r-3m200905-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200905-md-nhl.out
new file mode 100644
index 0000000..4a6a635
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200905-md-nhl.out
@@ -0,0 +1,8 @@
+ April 2009 May 2009 June 2009
+Mo 6 13 20 27 4 11 18 25 1 8 15 22 29
+Tu 7 14 21 28 5 12 19 26 2 9 16 23 30
+We 1 8 15 22 29 6 13 20 27 3 10 17 24
+Th 2 9 16 23 30 7 14 21 28 4 11 18 25
+Fr 3 10 17 24 1 8 15 22 29 5 12 19 26
+Sa 4 11 18 25 2 9 16 23 30 6 13 20 27
+Su 5 12 19 26 3 10 17 24 31 7 14 21 28
diff --git a/usr.bin/ncal/tests/regress.r-3m200906-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200906-jd-nhl.out
new file mode 100644
index 0000000..6eb35eb
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200906-jd-nhl.out
@@ -0,0 +1,8 @@
+ May 2009 June 2009 July 2009
+Mo 124 131 138 145 152 159 166 173 180 187 194 201 208
+Tu 125 132 139 146 153 160 167 174 181 188 195 202 209
+We 126 133 140 147 154 161 168 175 182 189 196 203 210
+Th 127 134 141 148 155 162 169 176 183 190 197 204 211
+Fr 121 128 135 142 149 156 163 170 177 184 191 198 205 212
+Sa 122 129 136 143 150 157 164 171 178 185 192 199 206
+Su 123 130 137 144 151 158 165 172 179 186 193 200 207
diff --git a/usr.bin/ncal/tests/regress.r-3m200906-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200906-md-nhl.out
new file mode 100644
index 0000000..53f1274
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200906-md-nhl.out
@@ -0,0 +1,8 @@
+ May 2009 June 2009 July 2009
+Mo 4 11 18 25 1 8 15 22 29 6 13 20 27
+Tu 5 12 19 26 2 9 16 23 30 7 14 21 28
+We 6 13 20 27 3 10 17 24 1 8 15 22 29
+Th 7 14 21 28 4 11 18 25 2 9 16 23 30
+Fr 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Sa 2 9 16 23 30 6 13 20 27 4 11 18 25
+Su 3 10 17 24 31 7 14 21 28 5 12 19 26
diff --git a/usr.bin/ncal/tests/regress.r-3m200907-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200907-jd-nhl.out
new file mode 100644
index 0000000..8c5701a
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200907-jd-nhl.out
@@ -0,0 +1,8 @@
+ June 2009 July 2009 August 2009
+Mo 152 159 166 173 180 187 194 201 208 215 222 229 236 243
+Tu 153 160 167 174 181 188 195 202 209 216 223 230 237
+We 154 161 168 175 182 189 196 203 210 217 224 231 238
+Th 155 162 169 176 183 190 197 204 211 218 225 232 239
+Fr 156 163 170 177 184 191 198 205 212 219 226 233 240
+Sa 157 164 171 178 185 192 199 206 213 220 227 234 241
+Su 158 165 172 179 186 193 200 207 214 221 228 235 242
diff --git a/usr.bin/ncal/tests/regress.r-3m200907-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200907-md-nhl.out
new file mode 100644
index 0000000..f07ea0a
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200907-md-nhl.out
@@ -0,0 +1,8 @@
+ June 2009 July 2009 August 2009
+Mo 1 8 15 22 29 6 13 20 27 3 10 17 24 31
+Tu 2 9 16 23 30 7 14 21 28 4 11 18 25
+We 3 10 17 24 1 8 15 22 29 5 12 19 26
+Th 4 11 18 25 2 9 16 23 30 6 13 20 27
+Fr 5 12 19 26 3 10 17 24 31 7 14 21 28
+Sa 6 13 20 27 4 11 18 25 1 8 15 22 29
+Su 7 14 21 28 5 12 19 26 2 9 16 23 30
diff --git a/usr.bin/ncal/tests/regress.r-3m200908-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200908-jd-nhl.out
new file mode 100644
index 0000000..9d50894
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200908-jd-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ July August September
+Mo 187 194 201 208 215 222 229 236 243 250 257 264 271
+Tu 188 195 202 209 216 223 230 237 244 251 258 265 272
+We 182 189 196 203 210 217 224 231 238 245 252 259 266 273
+Th 183 190 197 204 211 218 225 232 239 246 253 260 267
+Fr 184 191 198 205 212 219 226 233 240 247 254 261 268
+Sa 185 192 199 206 213 220 227 234 241 248 255 262 269
+Su 186 193 200 207 214 221 228 235 242 249 256 263 270
diff --git a/usr.bin/ncal/tests/regress.r-3m200908-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200908-md-nhl.out
new file mode 100644
index 0000000..e4822eb
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200908-md-nhl.out
@@ -0,0 +1,8 @@
+ July 2009 August 2009 September 2009
+Mo 6 13 20 27 3 10 17 24 31 7 14 21 28
+Tu 7 14 21 28 4 11 18 25 1 8 15 22 29
+We 1 8 15 22 29 5 12 19 26 2 9 16 23 30
+Th 2 9 16 23 30 6 13 20 27 3 10 17 24
+Fr 3 10 17 24 31 7 14 21 28 4 11 18 25
+Sa 4 11 18 25 1 8 15 22 29 5 12 19 26
+Su 5 12 19 26 2 9 16 23 30 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.r-3m200909-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200909-jd-nhl.out
new file mode 100644
index 0000000..3bccbf5
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200909-jd-nhl.out
@@ -0,0 +1,8 @@
+ August 2009 September 2009 October 2009
+Mo 215 222 229 236 243 250 257 264 271 278 285 292 299
+Tu 216 223 230 237 244 251 258 265 272 279 286 293 300
+We 217 224 231 238 245 252 259 266 273 280 287 294 301
+Th 218 225 232 239 246 253 260 267 274 281 288 295 302
+Fr 219 226 233 240 247 254 261 268 275 282 289 296 303
+Sa 213 220 227 234 241 248 255 262 269 276 283 290 297 304
+Su 214 221 228 235 242 249 256 263 270 277 284 291 298
diff --git a/usr.bin/ncal/tests/regress.r-3m200909-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200909-md-nhl.out
new file mode 100644
index 0000000..0c77c2d
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200909-md-nhl.out
@@ -0,0 +1,8 @@
+ August 2009 September 2009 October 2009
+Mo 3 10 17 24 31 7 14 21 28 5 12 19 26
+Tu 4 11 18 25 1 8 15 22 29 6 13 20 27
+We 5 12 19 26 2 9 16 23 30 7 14 21 28
+Th 6 13 20 27 3 10 17 24 1 8 15 22 29
+Fr 7 14 21 28 4 11 18 25 2 9 16 23 30
+Sa 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Su 2 9 16 23 30 6 13 20 27 4 11 18 25
diff --git a/usr.bin/ncal/tests/regress.r-3m200910-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200910-jd-nhl.out
new file mode 100644
index 0000000..f5598e1
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200910-jd-nhl.out
@@ -0,0 +1,8 @@
+ September 2009 October 2009 November 2009
+Mo 250 257 264 271 278 285 292 299 306 313 320 327 334
+Tu 244 251 258 265 272 279 286 293 300 307 314 321 328
+We 245 252 259 266 273 280 287 294 301 308 315 322 329
+Th 246 253 260 267 274 281 288 295 302 309 316 323 330
+Fr 247 254 261 268 275 282 289 296 303 310 317 324 331
+Sa 248 255 262 269 276 283 290 297 304 311 318 325 332
+Su 249 256 263 270 277 284 291 298 305 312 319 326 333
diff --git a/usr.bin/ncal/tests/regress.r-3m200910-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200910-md-nhl.out
new file mode 100644
index 0000000..18561d2
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200910-md-nhl.out
@@ -0,0 +1,8 @@
+ September 2009 October 2009 November 2009
+Mo 7 14 21 28 5 12 19 26 2 9 16 23 30
+Tu 1 8 15 22 29 6 13 20 27 3 10 17 24
+We 2 9 16 23 30 7 14 21 28 4 11 18 25
+Th 3 10 17 24 1 8 15 22 29 5 12 19 26
+Fr 4 11 18 25 2 9 16 23 30 6 13 20 27
+Sa 5 12 19 26 3 10 17 24 31 7 14 21 28
+Su 6 13 20 27 4 11 18 25 1 8 15 22 29
diff --git a/usr.bin/ncal/tests/regress.r-3m200911-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200911-jd-nhl.out
new file mode 100644
index 0000000..4b8d1db
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200911-jd-nhl.out
@@ -0,0 +1,9 @@
+ 2009
+ October November December
+Mo 278 285 292 299 306 313 320 327 334 341 348 355 362
+Tu 279 286 293 300 307 314 321 328 335 342 349 356 363
+We 280 287 294 301 308 315 322 329 336 343 350 357 364
+Th 274 281 288 295 302 309 316 323 330 337 344 351 358 365
+Fr 275 282 289 296 303 310 317 324 331 338 345 352 359
+Sa 276 283 290 297 304 311 318 325 332 339 346 353 360
+Su 277 284 291 298 305 312 319 326 333 340 347 354 361
diff --git a/usr.bin/ncal/tests/regress.r-3m200911-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200911-md-nhl.out
new file mode 100644
index 0000000..35f1371
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200911-md-nhl.out
@@ -0,0 +1,8 @@
+ October 2009 November 2009 December 2009
+Mo 5 12 19 26 2 9 16 23 30 7 14 21 28
+Tu 6 13 20 27 3 10 17 24 1 8 15 22 29
+We 7 14 21 28 4 11 18 25 2 9 16 23 30
+Th 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Fr 2 9 16 23 30 6 13 20 27 4 11 18 25
+Sa 3 10 17 24 31 7 14 21 28 5 12 19 26
+Su 4 11 18 25 1 8 15 22 29 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.r-3m200912-jd-nhl.out b/usr.bin/ncal/tests/regress.r-3m200912-jd-nhl.out
new file mode 100644
index 0000000..66efa29
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200912-jd-nhl.out
@@ -0,0 +1,8 @@
+ November 2009 December 2009 January 2010
+Mo 306 313 320 327 334 341 348 355 362 4 11 18 25
+Tu 307 314 321 328 335 342 349 356 363 5 12 19 26
+We 308 315 322 329 336 343 350 357 364 6 13 20 27
+Th 309 316 323 330 337 344 351 358 365 7 14 21 28
+Fr 310 317 324 331 338 345 352 359 1 8 15 22 29
+Sa 311 318 325 332 339 346 353 360 2 9 16 23 30
+Su 305 312 319 326 333 340 347 354 361 3 10 17 24 31
diff --git a/usr.bin/ncal/tests/regress.r-3m200912-md-nhl.out b/usr.bin/ncal/tests/regress.r-3m200912-md-nhl.out
new file mode 100644
index 0000000..c62332a
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-3m200912-md-nhl.out
@@ -0,0 +1,8 @@
+ November 2009 December 2009 January 2010
+Mo 2 9 16 23 30 7 14 21 28 4 11 18 25
+Tu 3 10 17 24 1 8 15 22 29 5 12 19 26
+We 4 11 18 25 2 9 16 23 30 6 13 20 27
+Th 5 12 19 26 3 10 17 24 31 7 14 21 28
+Fr 6 13 20 27 4 11 18 25 1 8 15 22 29
+Sa 7 14 21 28 5 12 19 26 2 9 16 23 30
+Su 1 8 15 22 29 6 13 20 27 3 10 17 24 31
diff --git a/usr.bin/ncal/tests/regress.r-y2008-jd-nhl.out b/usr.bin/ncal/tests/regress.r-y2008-jd-nhl.out
new file mode 100644
index 0000000..0ea30ae
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2008-jd-nhl.out
@@ -0,0 +1,36 @@
+ 2008
+ January February March
+Mo 7 14 21 28 35 42 49 56 63 70 77 84 91
+Tu 1 8 15 22 29 36 43 50 57 64 71 78 85
+We 2 9 16 23 30 37 44 51 58 65 72 79 86
+Th 3 10 17 24 31 38 45 52 59 66 73 80 87
+Fr 4 11 18 25 32 39 46 53 60 67 74 81 88
+Sa 5 12 19 26 33 40 47 54 61 68 75 82 89
+Su 6 13 20 27 34 41 48 55 62 69 76 83 90
+
+ April May June
+Mo 98 105 112 119 126 133 140 147 154 161 168 175 182
+Tu 92 99 106 113 120 127 134 141 148 155 162 169 176
+We 93 100 107 114 121 128 135 142 149 156 163 170 177
+Th 94 101 108 115 122 129 136 143 150 157 164 171 178
+Fr 95 102 109 116 123 130 137 144 151 158 165 172 179
+Sa 96 103 110 117 124 131 138 145 152 159 166 173 180
+Su 97 104 111 118 125 132 139 146 153 160 167 174 181
+
+ July August September
+Mo 189 196 203 210 217 224 231 238 245 252 259 266 273
+Tu 183 190 197 204 211 218 225 232 239 246 253 260 267 274
+We 184 191 198 205 212 219 226 233 240 247 254 261 268
+Th 185 192 199 206 213 220 227 234 241 248 255 262 269
+Fr 186 193 200 207 214 221 228 235 242 249 256 263 270
+Sa 187 194 201 208 215 222 229 236 243 250 257 264 271
+Su 188 195 202 209 216 223 230 237 244 251 258 265 272
+
+ October November December
+Mo 280 287 294 301 308 315 322 329 336 343 350 357 364
+Tu 281 288 295 302 309 316 323 330 337 344 351 358 365
+We 275 282 289 296 303 310 317 324 331 338 345 352 359 366
+Th 276 283 290 297 304 311 318 325 332 339 346 353 360
+Fr 277 284 291 298 305 312 319 326 333 340 347 354 361
+Sa 278 285 292 299 306 313 320 327 334 341 348 355 362
+Su 279 286 293 300 307 314 321 328 335 342 349 356 363
diff --git a/usr.bin/ncal/tests/regress.r-y2008-md-nhl.out b/usr.bin/ncal/tests/regress.r-y2008-md-nhl.out
new file mode 100644
index 0000000..18191f6
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2008-md-nhl.out
@@ -0,0 +1,27 @@
+ 2008
+ January February March April
+Mo 7 14 21 28 4 11 18 25 3 10 17 24 31 7 14 21 28
+Tu 1 8 15 22 29 5 12 19 26 4 11 18 25 1 8 15 22 29
+We 2 9 16 23 30 6 13 20 27 5 12 19 26 2 9 16 23 30
+Th 3 10 17 24 31 7 14 21 28 6 13 20 27 3 10 17 24
+Fr 4 11 18 25 1 8 15 22 29 7 14 21 28 4 11 18 25
+Sa 5 12 19 26 2 9 16 23 1 8 15 22 29 5 12 19 26
+Su 6 13 20 27 3 10 17 24 2 9 16 23 30 6 13 20 27
+
+ May June July August
+Mo 5 12 19 26 2 9 16 23 30 7 14 21 28 4 11 18 25
+Tu 6 13 20 27 3 10 17 24 1 8 15 22 29 5 12 19 26
+We 7 14 21 28 4 11 18 25 2 9 16 23 30 6 13 20 27
+Th 1 8 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28
+Fr 2 9 16 23 30 6 13 20 27 4 11 18 25 1 8 15 22 29
+Sa 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30
+Su 4 11 18 25 1 8 15 22 29 6 13 20 27 3 10 17 24 31
+
+ September October November December
+Mo 1 8 15 22 29 6 13 20 27 3 10 17 24 1 8 15 22 29
+Tu 2 9 16 23 30 7 14 21 28 4 11 18 25 2 9 16 23 30
+We 3 10 17 24 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Th 4 11 18 25 2 9 16 23 30 6 13 20 27 4 11 18 25
+Fr 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26
+Sa 6 13 20 27 4 11 18 25 1 8 15 22 29 6 13 20 27
+Su 7 14 21 28 5 12 19 26 2 9 16 23 30 7 14 21 28
diff --git a/usr.bin/ncal/tests/regress.r-y2009-jd-nhl.out b/usr.bin/ncal/tests/regress.r-y2009-jd-nhl.out
new file mode 100644
index 0000000..3869ace
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2009-jd-nhl.out
@@ -0,0 +1,36 @@
+ 2009
+ January February March
+Mo 5 12 19 26 33 40 47 54 61 68 75 82 89
+Tu 6 13 20 27 34 41 48 55 62 69 76 83 90
+We 7 14 21 28 35 42 49 56 63 70 77 84
+Th 1 8 15 22 29 36 43 50 57 64 71 78 85
+Fr 2 9 16 23 30 37 44 51 58 65 72 79 86
+Sa 3 10 17 24 31 38 45 52 59 66 73 80 87
+Su 4 11 18 25 32 39 46 53 60 67 74 81 88
+
+ April May June
+Mo 96 103 110 117 124 131 138 145 152 159 166 173 180
+Tu 97 104 111 118 125 132 139 146 153 160 167 174 181
+We 91 98 105 112 119 126 133 140 147 154 161 168 175
+Th 92 99 106 113 120 127 134 141 148 155 162 169 176
+Fr 93 100 107 114 121 128 135 142 149 156 163 170 177
+Sa 94 101 108 115 122 129 136 143 150 157 164 171 178
+Su 95 102 109 116 123 130 137 144 151 158 165 172 179
+
+ July August September
+Mo 187 194 201 208 215 222 229 236 243 250 257 264 271
+Tu 188 195 202 209 216 223 230 237 244 251 258 265 272
+We 182 189 196 203 210 217 224 231 238 245 252 259 266 273
+Th 183 190 197 204 211 218 225 232 239 246 253 260 267
+Fr 184 191 198 205 212 219 226 233 240 247 254 261 268
+Sa 185 192 199 206 213 220 227 234 241 248 255 262 269
+Su 186 193 200 207 214 221 228 235 242 249 256 263 270
+
+ October November December
+Mo 278 285 292 299 306 313 320 327 334 341 348 355 362
+Tu 279 286 293 300 307 314 321 328 335 342 349 356 363
+We 280 287 294 301 308 315 322 329 336 343 350 357 364
+Th 274 281 288 295 302 309 316 323 330 337 344 351 358 365
+Fr 275 282 289 296 303 310 317 324 331 338 345 352 359
+Sa 276 283 290 297 304 311 318 325 332 339 346 353 360
+Su 277 284 291 298 305 312 319 326 333 340 347 354 361
diff --git a/usr.bin/ncal/tests/regress.r-y2009-md-nhl.out b/usr.bin/ncal/tests/regress.r-y2009-md-nhl.out
new file mode 100644
index 0000000..43496e9
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2009-md-nhl.out
@@ -0,0 +1,27 @@
+ 2009
+ January February March April
+Mo 5 12 19 26 2 9 16 23 2 9 16 23 30 6 13 20 27
+Tu 6 13 20 27 3 10 17 24 3 10 17 24 31 7 14 21 28
+We 7 14 21 28 4 11 18 25 4 11 18 25 1 8 15 22 29
+Th 1 8 15 22 29 5 12 19 26 5 12 19 26 2 9 16 23 30
+Fr 2 9 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24
+Sa 3 10 17 24 31 7 14 21 28 7 14 21 28 4 11 18 25
+Su 4 11 18 25 1 8 15 22 1 8 15 22 29 5 12 19 26
+
+ May June July August
+Mo 4 11 18 25 1 8 15 22 29 6 13 20 27 3 10 17 24 31
+Tu 5 12 19 26 2 9 16 23 30 7 14 21 28 4 11 18 25
+We 6 13 20 27 3 10 17 24 1 8 15 22 29 5 12 19 26
+Th 7 14 21 28 4 11 18 25 2 9 16 23 30 6 13 20 27
+Fr 1 8 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28
+Sa 2 9 16 23 30 6 13 20 27 4 11 18 25 1 8 15 22 29
+Su 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30
+
+ September October November December
+Mo 7 14 21 28 5 12 19 26 2 9 16 23 30 7 14 21 28
+Tu 1 8 15 22 29 6 13 20 27 3 10 17 24 1 8 15 22 29
+We 2 9 16 23 30 7 14 21 28 4 11 18 25 2 9 16 23 30
+Th 3 10 17 24 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Fr 4 11 18 25 2 9 16 23 30 6 13 20 27 4 11 18 25
+Sa 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26
+Su 6 13 20 27 4 11 18 25 1 8 15 22 29 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.r-y2010-jd-nhl.out b/usr.bin/ncal/tests/regress.r-y2010-jd-nhl.out
new file mode 100644
index 0000000..affd536
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2010-jd-nhl.out
@@ -0,0 +1,36 @@
+ 2010
+ January February March
+Mo 4 11 18 25 32 39 46 53 60 67 74 81 88
+Tu 5 12 19 26 33 40 47 54 61 68 75 82 89
+We 6 13 20 27 34 41 48 55 62 69 76 83 90
+Th 7 14 21 28 35 42 49 56 63 70 77 84
+Fr 1 8 15 22 29 36 43 50 57 64 71 78 85
+Sa 2 9 16 23 30 37 44 51 58 65 72 79 86
+Su 3 10 17 24 31 38 45 52 59 66 73 80 87
+
+ April May June
+Mo 95 102 109 116 123 130 137 144 151 158 165 172 179
+Tu 96 103 110 117 124 131 138 145 152 159 166 173 180
+We 97 104 111 118 125 132 139 146 153 160 167 174 181
+Th 91 98 105 112 119 126 133 140 147 154 161 168 175
+Fr 92 99 106 113 120 127 134 141 148 155 162 169 176
+Sa 93 100 107 114 121 128 135 142 149 156 163 170 177
+Su 94 101 108 115 122 129 136 143 150 157 164 171 178
+
+ July August September
+Mo 186 193 200 207 214 221 228 235 242 249 256 263 270
+Tu 187 194 201 208 215 222 229 236 243 250 257 264 271
+We 188 195 202 209 216 223 230 237 244 251 258 265 272
+Th 182 189 196 203 210 217 224 231 238 245 252 259 266 273
+Fr 183 190 197 204 211 218 225 232 239 246 253 260 267
+Sa 184 191 198 205 212 219 226 233 240 247 254 261 268
+Su 185 192 199 206 213 220 227 234 241 248 255 262 269
+
+ October November December
+Mo 277 284 291 298 305 312 319 326 333 340 347 354 361
+Tu 278 285 292 299 306 313 320 327 334 341 348 355 362
+We 279 286 293 300 307 314 321 328 335 342 349 356 363
+Th 280 287 294 301 308 315 322 329 336 343 350 357 364
+Fr 274 281 288 295 302 309 316 323 330 337 344 351 358 365
+Sa 275 282 289 296 303 310 317 324 331 338 345 352 359
+Su 276 283 290 297 304 311 318 325 332 339 346 353 360
diff --git a/usr.bin/ncal/tests/regress.r-y2010-md-nhl.out b/usr.bin/ncal/tests/regress.r-y2010-md-nhl.out
new file mode 100644
index 0000000..8649c16
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2010-md-nhl.out
@@ -0,0 +1,27 @@
+ 2010
+ January February March April
+Mo 4 11 18 25 1 8 15 22 1 8 15 22 29 5 12 19 26
+Tu 5 12 19 26 2 9 16 23 2 9 16 23 30 6 13 20 27
+We 6 13 20 27 3 10 17 24 3 10 17 24 31 7 14 21 28
+Th 7 14 21 28 4 11 18 25 4 11 18 25 1 8 15 22 29
+Fr 1 8 15 22 29 5 12 19 26 5 12 19 26 2 9 16 23 30
+Sa 2 9 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24
+Su 3 10 17 24 31 7 14 21 28 7 14 21 28 4 11 18 25
+
+ May June July August
+Mo 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30
+Tu 4 11 18 25 1 8 15 22 29 6 13 20 27 3 10 17 24 31
+We 5 12 19 26 2 9 16 23 30 7 14 21 28 4 11 18 25
+Th 6 13 20 27 3 10 17 24 1 8 15 22 29 5 12 19 26
+Fr 7 14 21 28 4 11 18 25 2 9 16 23 30 6 13 20 27
+Sa 1 8 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28
+Su 2 9 16 23 30 6 13 20 27 4 11 18 25 1 8 15 22 29
+
+ September October November December
+Mo 6 13 20 27 4 11 18 25 1 8 15 22 29 6 13 20 27
+Tu 7 14 21 28 5 12 19 26 2 9 16 23 30 7 14 21 28
+We 1 8 15 22 29 6 13 20 27 3 10 17 24 1 8 15 22 29
+Th 2 9 16 23 30 7 14 21 28 4 11 18 25 2 9 16 23 30
+Fr 3 10 17 24 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Sa 4 11 18 25 2 9 16 23 30 6 13 20 27 4 11 18 25
+Su 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26
diff --git a/usr.bin/ncal/tests/regress.r-y2011-jd-nhl.out b/usr.bin/ncal/tests/regress.r-y2011-jd-nhl.out
new file mode 100644
index 0000000..a4a71c2
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2011-jd-nhl.out
@@ -0,0 +1,36 @@
+ 2011
+ January February March
+Mo 3 10 17 24 31 38 45 52 59 66 73 80 87
+Tu 4 11 18 25 32 39 46 53 60 67 74 81 88
+We 5 12 19 26 33 40 47 54 61 68 75 82 89
+Th 6 13 20 27 34 41 48 55 62 69 76 83 90
+Fr 7 14 21 28 35 42 49 56 63 70 77 84
+Sa 1 8 15 22 29 36 43 50 57 64 71 78 85
+Su 2 9 16 23 30 37 44 51 58 65 72 79 86
+
+ April May June
+Mo 94 101 108 115 122 129 136 143 150 157 164 171 178
+Tu 95 102 109 116 123 130 137 144 151 158 165 172 179
+We 96 103 110 117 124 131 138 145 152 159 166 173 180
+Th 97 104 111 118 125 132 139 146 153 160 167 174 181
+Fr 91 98 105 112 119 126 133 140 147 154 161 168 175
+Sa 92 99 106 113 120 127 134 141 148 155 162 169 176
+Su 93 100 107 114 121 128 135 142 149 156 163 170 177
+
+ July August September
+Mo 185 192 199 206 213 220 227 234 241 248 255 262 269
+Tu 186 193 200 207 214 221 228 235 242 249 256 263 270
+We 187 194 201 208 215 222 229 236 243 250 257 264 271
+Th 188 195 202 209 216 223 230 237 244 251 258 265 272
+Fr 182 189 196 203 210 217 224 231 238 245 252 259 266 273
+Sa 183 190 197 204 211 218 225 232 239 246 253 260 267
+Su 184 191 198 205 212 219 226 233 240 247 254 261 268
+
+ October November December
+Mo 276 283 290 297 304 311 318 325 332 339 346 353 360
+Tu 277 284 291 298 305 312 319 326 333 340 347 354 361
+We 278 285 292 299 306 313 320 327 334 341 348 355 362
+Th 279 286 293 300 307 314 321 328 335 342 349 356 363
+Fr 280 287 294 301 308 315 322 329 336 343 350 357 364
+Sa 274 281 288 295 302 309 316 323 330 337 344 351 358 365
+Su 275 282 289 296 303 310 317 324 331 338 345 352 359
diff --git a/usr.bin/ncal/tests/regress.r-y2011-md-nhl.out b/usr.bin/ncal/tests/regress.r-y2011-md-nhl.out
new file mode 100644
index 0000000..8852932
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.r-y2011-md-nhl.out
@@ -0,0 +1,27 @@
+ 2011
+ January February March April
+Mo 3 10 17 24 31 7 14 21 28 7 14 21 28 4 11 18 25
+Tu 4 11 18 25 1 8 15 22 1 8 15 22 29 5 12 19 26
+We 5 12 19 26 2 9 16 23 2 9 16 23 30 6 13 20 27
+Th 6 13 20 27 3 10 17 24 3 10 17 24 31 7 14 21 28
+Fr 7 14 21 28 4 11 18 25 4 11 18 25 1 8 15 22 29
+Sa 1 8 15 22 29 5 12 19 26 5 12 19 26 2 9 16 23 30
+Su 2 9 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24
+
+ May June July August
+Mo 2 9 16 23 30 6 13 20 27 4 11 18 25 1 8 15 22 29
+Tu 3 10 17 24 31 7 14 21 28 5 12 19 26 2 9 16 23 30
+We 4 11 18 25 1 8 15 22 29 6 13 20 27 3 10 17 24 31
+Th 5 12 19 26 2 9 16 23 30 7 14 21 28 4 11 18 25
+Fr 6 13 20 27 3 10 17 24 1 8 15 22 29 5 12 19 26
+Sa 7 14 21 28 4 11 18 25 2 9 16 23 30 6 13 20 27
+Su 1 8 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28
+
+ September October November December
+Mo 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26
+Tu 6 13 20 27 4 11 18 25 1 8 15 22 29 6 13 20 27
+We 7 14 21 28 5 12 19 26 2 9 16 23 30 7 14 21 28
+Th 1 8 15 22 29 6 13 20 27 3 10 17 24 1 8 15 22 29
+Fr 2 9 16 23 30 7 14 21 28 4 11 18 25 2 9 16 23 30
+Sa 3 10 17 24 1 8 15 22 29 5 12 19 26 3 10 17 24 31
+Su 4 11 18 25 2 9 16 23 30 6 13 20 27 4 11 18 25
diff --git a/usr.bin/ncal/tests/regress.s-b-3-nhl.out b/usr.bin/ncal/tests/regress.s-b-3-nhl.out
new file mode 100644
index 0000000..ccb6b36
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-3-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008 April 2008
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 1 2 3 4 5
+ 3 4 5 6 7 8 9 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+10 11 12 13 14 15 16 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+17 18 19 20 21 22 23 16 17 18 19 20 21 22 20 21 22 23 24 25 26
+24 25 26 27 28 29 23 24 25 26 27 28 29 27 28 29 30
+ 30 31
diff --git a/usr.bin/ncal/tests/regress.s-b-A-nhl.out b/usr.bin/ncal/tests/regress.s-b-A-nhl.out
new file mode 100644
index 0000000..19149ca6
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-A-nhl.out
@@ -0,0 +1,8 @@
+ March 2008 April 2008
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 1 2 3 4 5
+ 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+ 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+16 17 18 19 20 21 22 20 21 22 23 24 25 26
+23 24 25 26 27 28 29 27 28 29 30
+30 31
diff --git a/usr.bin/ncal/tests/regress.s-b-AB-nhl.out b/usr.bin/ncal/tests/regress.s-b-AB-nhl.out
new file mode 100644
index 0000000..ccb6b36
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-AB-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008 April 2008
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1 1 2 3 4 5
+ 3 4 5 6 7 8 9 2 3 4 5 6 7 8 6 7 8 9 10 11 12
+10 11 12 13 14 15 16 9 10 11 12 13 14 15 13 14 15 16 17 18 19
+17 18 19 20 21 22 23 16 17 18 19 20 21 22 20 21 22 23 24 25 26
+24 25 26 27 28 29 23 24 25 26 27 28 29 27 28 29 30
+ 30 31
diff --git a/usr.bin/ncal/tests/regress.s-b-B-nhl.out b/usr.bin/ncal/tests/regress.s-b-B-nhl.out
new file mode 100644
index 0000000..5d61423
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-B-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008
+Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
+ 1 2 1
+ 3 4 5 6 7 8 9 2 3 4 5 6 7 8
+10 11 12 13 14 15 16 9 10 11 12 13 14 15
+17 18 19 20 21 22 23 16 17 18 19 20 21 22
+24 25 26 27 28 29 23 24 25 26 27 28 29
+ 30 31
diff --git a/usr.bin/ncal/tests/regress.s-b-gmgy-nhl.out b/usr.bin/ncal/tests/regress.s-b-gmgy-nhl.out
new file mode 100644
index 0000000..5620051
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-gmgy-nhl.out
@@ -0,0 +1,8 @@
+ January 2007
+Su Mo Tu We Th Fr Sa
+ 1 2 3 4 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 31
+
diff --git a/usr.bin/ncal/tests/regress.s-b-m-nhl.out b/usr.bin/ncal/tests/regress.s-b-m-nhl.out
new file mode 100644
index 0000000..37b9ffa
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-m-nhl.out
@@ -0,0 +1,8 @@
+ January 2008
+Su Mo Tu We Th Fr Sa
+ 1 2 3 4 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 31
+
diff --git a/usr.bin/ncal/tests/regress.s-b-mgy-nhl.out b/usr.bin/ncal/tests/regress.s-b-mgy-nhl.out
new file mode 100644
index 0000000..5620051
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-b-mgy-nhl.out
@@ -0,0 +1,8 @@
+ January 2007
+Su Mo Tu We Th Fr Sa
+ 1 2 3 4 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 31
+
diff --git a/usr.bin/ncal/tests/regress.s-r-3-nhl.out b/usr.bin/ncal/tests/regress.s-r-3-nhl.out
new file mode 100644
index 0000000..9a816b7
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-3-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008 April 2008
+Mo 4 11 18 25 3 10 17 24 31 7 14 21 28
+Tu 5 12 19 26 4 11 18 25 1 8 15 22 29
+We 6 13 20 27 5 12 19 26 2 9 16 23 30
+Th 7 14 21 28 6 13 20 27 3 10 17 24
+Fr 1 8 15 22 29 7 14 21 28 4 11 18 25
+Sa 2 9 16 23 1 8 15 22 29 5 12 19 26
+Su 3 10 17 24 2 9 16 23 30 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.s-r-A-nhl.out b/usr.bin/ncal/tests/regress.s-r-A-nhl.out
new file mode 100644
index 0000000..603c2cf
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-A-nhl.out
@@ -0,0 +1,8 @@
+ March 2008 April 2008
+Mo 3 10 17 24 31 7 14 21 28
+Tu 4 11 18 25 1 8 15 22 29
+We 5 12 19 26 2 9 16 23 30
+Th 6 13 20 27 3 10 17 24
+Fr 7 14 21 28 4 11 18 25
+Sa 1 8 15 22 29 5 12 19 26
+Su 2 9 16 23 30 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.s-r-AB-nhl.out b/usr.bin/ncal/tests/regress.s-r-AB-nhl.out
new file mode 100644
index 0000000..9a816b7
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-AB-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008 April 2008
+Mo 4 11 18 25 3 10 17 24 31 7 14 21 28
+Tu 5 12 19 26 4 11 18 25 1 8 15 22 29
+We 6 13 20 27 5 12 19 26 2 9 16 23 30
+Th 7 14 21 28 6 13 20 27 3 10 17 24
+Fr 1 8 15 22 29 7 14 21 28 4 11 18 25
+Sa 2 9 16 23 1 8 15 22 29 5 12 19 26
+Su 3 10 17 24 2 9 16 23 30 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.s-r-B-nhl.out b/usr.bin/ncal/tests/regress.s-r-B-nhl.out
new file mode 100644
index 0000000..94614da
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-B-nhl.out
@@ -0,0 +1,8 @@
+ February 2008 March 2008
+Mo 4 11 18 25 3 10 17 24 31
+Tu 5 12 19 26 4 11 18 25
+We 6 13 20 27 5 12 19 26
+Th 7 14 21 28 6 13 20 27
+Fr 1 8 15 22 29 7 14 21 28
+Sa 2 9 16 23 1 8 15 22 29
+Su 3 10 17 24 2 9 16 23 30
diff --git a/usr.bin/ncal/tests/regress.s-r-gmgy-nhl.out b/usr.bin/ncal/tests/regress.s-r-gmgy-nhl.out
new file mode 100644
index 0000000..0b42e41
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-gmgy-nhl.out
@@ -0,0 +1,8 @@
+ January 2007
+Mo 1 8 15 22 29
+Tu 2 9 16 23 30
+We 3 10 17 24 31
+Th 4 11 18 25
+Fr 5 12 19 26
+Sa 6 13 20 27
+Su 7 14 21 28
diff --git a/usr.bin/ncal/tests/regress.s-r-m-nhl.out b/usr.bin/ncal/tests/regress.s-r-m-nhl.out
new file mode 100644
index 0000000..34b939d
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-m-nhl.out
@@ -0,0 +1,8 @@
+ January 2008
+Mo 7 14 21 28
+Tu 1 8 15 22 29
+We 2 9 16 23 30
+Th 3 10 17 24 31
+Fr 4 11 18 25
+Sa 5 12 19 26
+Su 6 13 20 27
diff --git a/usr.bin/ncal/tests/regress.s-r-mgy-nhl.out b/usr.bin/ncal/tests/regress.s-r-mgy-nhl.out
new file mode 100644
index 0000000..0b42e41
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.s-r-mgy-nhl.out
@@ -0,0 +1,8 @@
+ January 2007
+Mo 1 8 15 22 29
+Tu 2 9 16 23 30
+We 3 10 17 24 31
+Th 4 11 18 25
+Fr 5 12 19 26
+Sa 6 13 20 27
+Su 7 14 21 28
diff --git a/usr.bin/ncal/tests/regress.sh b/usr.bin/ncal/tests/regress.sh
new file mode 100644
index 0000000..709744f
--- /dev/null
+++ b/usr.bin/ncal/tests/regress.sh
@@ -0,0 +1,80 @@
+# $FreeBSD$
+
+CAL_BIN="ncal"
+CAL="${CAL_BIN} -C"
+NCAL="${CAL_BIN} -N"
+YEARS="2008 2009 2010 2011"
+ONEYEAR="2009"
+
+echo 1..89
+
+REGRESSION_START($1)
+
+#
+# The first tests are layout tests, to make sure that the output is still the
+# same despite varying months.
+#
+
+# Full year calendars
+
+for y in ${YEARS}; do
+ # Regular calendar, Month days, No-highlight
+ REGRESSION_TEST(`r-y${y}-md-nhl', `$NCAL -h ${y}')
+ # Backwards calendar, Month days, No-highlight
+ REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -h ${y}')
+ # Regular calendar, Julian days, No-highlight
+ REGRESSION_TEST(`r-y${y}-jd-nhl', `$NCAL -jh ${y}')
+ # Backwards calendar, Julian days, No-highlight
+ REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jh ${y}')
+done
+
+# 3 month calendars
+
+for m in $(jot -w %02d 12); do
+ # Regular calendar, Month days, No-highlight
+ REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl',
+ `$NCAL -h3 ${m} ${ONEYEAR}')
+ # Backwards calendar, Month days, No-highlight
+ REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}')
+ # Regular calendar, Julian days, No-highlight
+ REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl',
+ `$NCAL -jh3 ${m} ${ONEYEAR}')
+ # Backwards calendar, Julian days, No-highlight
+ REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}')
+done
+
+#
+# The next tests are combinations of the various arguments.
+#
+
+# These should fail
+REGRESSION_TEST(`f-3y-nhl', `$NCAL -3 -y 2>&1')
+REGRESSION_TEST(`f-3A-nhl', `$NCAL -3 -A 3 2>&1')
+REGRESSION_TEST(`f-3B-nhl', `$NCAL -3 -B 3 2>&1')
+REGRESSION_TEST(`f-3gy-nhl', `$NCAL -3 2008 2>&1')
+REGRESSION_TEST(`f-3AB-nhl', `$NCAL -3 -A 3 -B 3 2>&1')
+REGRESSION_TEST(`f-mgm-nhl', `$NCAL -m 3 2 2008 2>&1')
+REGRESSION_TEST(`f-ym-nhl', `$NCAL -y -m 2 2>&1')
+REGRESSION_TEST(`f-ygm-nhl', `$NCAL -y 2 2008 2>&1')
+REGRESSION_TEST(`f-yA-nhl', `$NCAL -y -A 3 2>&1')
+REGRESSION_TEST(`f-yB-nhl', `$NCAL -y -B 3 2>&1')
+REGRESSION_TEST(`f-yAB-nhl', `$NCAL -y -A 3 -B 3 2>&1')
+
+# These should be successful
+
+REGRESSION_TEST(`s-b-3-nhl', `$CAL -d 2008.03 -3')
+REGRESSION_TEST(`s-b-A-nhl', `$CAL -d 2008.03 -A 1')
+REGRESSION_TEST(`s-b-B-nhl', `$CAL -d 2008.03 -B 1')
+REGRESSION_TEST(`s-b-AB-nhl', `$CAL -d 2008.03 -A 1 -B 1')
+REGRESSION_TEST(`s-b-m-nhl', `$CAL -d 2008.03 -m 1')
+REGRESSION_TEST(`s-b-mgy-nhl', `$CAL -d 2008.03 -m 1 2007')
+REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -d 2008.03 1 2007')
+REGRESSION_TEST(`s-r-3-nhl', `$NCAL -d 2008.03 -3')
+REGRESSION_TEST(`s-r-A-nhl', `$NCAL -d 2008.03 -A 1')
+REGRESSION_TEST(`s-r-B-nhl', `$NCAL -d 2008.03 -B 1')
+REGRESSION_TEST(`s-r-AB-nhl', `$NCAL -d 2008.03 -A 1 -B 1')
+REGRESSION_TEST(`s-r-m-nhl', `$NCAL -d 2008.03 -m 1')
+REGRESSION_TEST(`s-r-mgy-nhl', `$NCAL -d 2008.03 -m 1 2007')
+REGRESSION_TEST(`s-r-gmgy-nhl', `$NCAL -d 2008.03 1 2007')
+
+REGRESSION_END()
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
new file mode 100644
index 0000000..8bbce90
--- /dev/null
+++ b/usr.bin/netstat/Makefile
@@ -0,0 +1,66 @@
+# @(#)Makefile 8.1 (Berkeley) 6/12/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= netstat
+SRCS= if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
+ unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c \
+ flowtable.c nl_defs.h
+
+nl_symbols.c: nlist_symbols
+ awk '\
+ BEGIN { \
+ print "#include <sys/param.h>"; \
+ print "#include <nlist.h>"; \
+ print "struct nlist nl[] = {"; \
+ } \
+ !/^\#/ { printf("\t{ .n_name = \"%s\" },\n", $$2); } \
+ END { print "\t{ .n_name = NULL },\n};" } \
+ ' < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
+nl_defs.h: nlist_symbols
+ awk '\
+ BEGIN { \
+ print "#include <nlist.h>"; \
+ print "extern struct nlist nl[];"; \
+ i = 0; \
+ } \
+ !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \
+ < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
+CLEANFILES+= nl_symbols.c nl_defs.h
+CFLAGS+= -I${.OBJDIR}
+
+WARNS?= 3
+CFLAGS+=-fno-strict-aliasing
+
+CFLAGS+=-DIPSEC
+CFLAGS+=-DSCTP
+
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+=-DINET
+.endif
+
+.if ${MK_INET6_SUPPORT} != "no"
+SRCS+= inet6.c
+CFLAGS+=-DINET6
+.endif
+
+.if ${MK_OFED} != "no"
+CFLAGS+=-DSDP
+.endif
+
+.if ${MK_PF} != "no"
+CFLAGS+=-DPF
+.endif
+
+BINGRP= kmem
+BINMODE=2555
+LIBADD= kvm memstat xo util
+
+.if ${MK_NETGRAPH_SUPPORT} != "no"
+SRCS+= netgraph.c
+LIBADD+= netgraph
+CFLAGS+=-DNETGRAPH
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/netstat/Makefile.depend b/usr.bin/netstat/Makefile.depend
new file mode 100644
index 0000000..27fa660
--- /dev/null
+++ b/usr.bin/netstat/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+ lib/libmemstat \
+ lib/libnetgraph \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/netstat/bpf.c b/usr.bin/netstat/bpf.c
new file mode 100644
index 0000000..60546e3
--- /dev/null
+++ b/usr.bin/netstat/bpf.c
@@ -0,0 +1,169 @@
+/*-
+ * Copyright (c) 2005 Christian S.J. Peron
+ * 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/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/param.h>
+#include <sys/user.h>
+
+#include <net/if.h>
+#include <net/bpf.h>
+#include <net/bpfdesc.h>
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+
+#include "netstat.h"
+
+/* print bpf stats */
+
+static char *
+bpf_pidname(pid_t pid)
+{
+ struct kinfo_proc newkp;
+ int error, mib[4];
+ size_t size;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = pid;
+ size = sizeof(newkp);
+ error = sysctl(mib, 4, &newkp, &size, NULL, 0);
+ if (error < 0) {
+ xo_warn("kern.proc.pid failed");
+ return (strdup("??????"));
+ }
+ return (strdup(newkp.ki_comm));
+}
+
+static void
+bpf_flags(struct xbpf_d *bd, char *flagbuf)
+{
+
+ *flagbuf++ = bd->bd_promisc ? 'p' : '-';
+ *flagbuf++ = bd->bd_immediate ? 'i' : '-';
+ *flagbuf++ = bd->bd_hdrcmplt ? '-' : 'f';
+ *flagbuf++ = (bd->bd_direction == BPF_D_IN) ? '-' :
+ ((bd->bd_direction == BPF_D_OUT) ? 'o' : 's');
+ *flagbuf++ = bd->bd_feedback ? 'b' : '-';
+ *flagbuf++ = bd->bd_async ? 'a' : '-';
+ *flagbuf++ = bd->bd_locked ? 'l' : '-';
+ *flagbuf++ = '\0';
+
+ if (bd->bd_promisc)
+ xo_emit("{e:promiscuous/}");
+ if (bd->bd_immediate)
+ xo_emit("{e:immediate/}");
+ if (bd->bd_hdrcmplt)
+ xo_emit("{e:header-complete/}");
+ xo_emit("{e:direction}", (bd->bd_direction == BPF_D_IN) ? "input" :
+ (bd->bd_direction == BPF_D_OUT) ? "output" : "bidirectional");
+ if (bd->bd_feedback)
+ xo_emit("{e:feedback/}");
+ if (bd->bd_async)
+ xo_emit("{e:async/}");
+ if (bd->bd_locked)
+ xo_emit("{e:locked/}");
+}
+
+void
+bpf_stats(char *ifname)
+{
+ struct xbpf_d *d, *bd, zerostat;
+ char *pname, flagbuf[12];
+ size_t size;
+
+ if (zflag) {
+ bzero(&zerostat, sizeof(zerostat));
+ if (sysctlbyname("net.bpf.stats", NULL, NULL,
+ &zerostat, sizeof(zerostat)) < 0)
+ xo_warn("failed to zero bpf counters");
+ return;
+ }
+ if (sysctlbyname("net.bpf.stats", NULL, &size,
+ NULL, 0) < 0) {
+ xo_warn("net.bpf.stats");
+ return;
+ }
+ if (size == 0)
+ return;
+ bd = malloc(size);
+ if (bd == NULL) {
+ xo_warn("malloc failed");
+ return;
+ }
+ if (sysctlbyname("net.bpf.stats", bd, &size,
+ NULL, 0) < 0) {
+ xo_warn("net.bpf.stats");
+ free(bd);
+ return;
+ }
+ xo_emit("{T:/%5s} {T:/%6s} {T:/%7s} {T:/%9s} {T:/%9s} {T:/%9s} "
+ "{T:/%5s} {T:/%5s} {T:/%s}\n",
+ "Pid", "Netif", "Flags", "Recv", "Drop", "Match",
+ "Sblen", "Hblen", "Command");
+ xo_open_container("bpf-statistics");
+ xo_open_list("bpf-entry");
+ for (d = &bd[0]; d < &bd[size / sizeof(*d)]; d++) {
+ if (d->bd_structsize != sizeof(*d)) {
+ xo_warnx("bpf_stats_extended: version mismatch");
+ return;
+ }
+ if (ifname && strcmp(ifname, d->bd_ifname) != 0)
+ continue;
+ xo_open_instance("bpf-entry");
+ pname = bpf_pidname(d->bd_pid);
+ xo_emit("{k:pid/%5d} {k:interface-name/%6s} ",
+ d->bd_pid, d->bd_ifname);
+ bpf_flags(d, flagbuf);
+ xo_emit("{d:flags/%7s} {:received-packets/%9ju} "
+ "{:dropped-packets/%9ju} {:filter-packets/%9ju} "
+ "{:store-buffer-length/%5d} {:hold-buffer-length/%5d} "
+ "{:process/%s}\n",
+ flagbuf, (uintmax_t)d->bd_rcount, (uintmax_t)d->bd_dcount,
+ (uintmax_t)d->bd_fcount, d->bd_slen, d->bd_hlen, pname);
+ free(pname);
+ xo_close_instance("bpf-entry");
+ }
+ xo_close_list("bpf-entry");
+ xo_close_container("bpf-statistics");
+ free(bd);
+}
diff --git a/usr.bin/netstat/flowtable.c b/usr.bin/netstat/flowtable.c
new file mode 100644
index 0000000..c00dfd6
--- /dev/null
+++ b/usr.bin/netstat/flowtable.c
@@ -0,0 +1,88 @@
+/*-
+ * Copyright (c) 2014 Gleb Smirnoff <glebius@FreeBSD.org>
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <net/flowtable.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+
+#include "netstat.h"
+
+/*
+ * Print flowtable statistics.
+ */
+
+static void
+print_stats(struct flowtable_stat *stat)
+{
+
+#define p(f, m) if (stat->f || sflag <= 1) \
+ printf(m, (uintmax_t)stat->f, plural(stat->f))
+#define p2(f, m) if (stat->f || sflag <= 1) \
+ printf(m, (uintmax_t)stat->f, plurales(stat->f))
+
+ p(ft_lookups, "\t%ju lookup%s\n");
+ p(ft_hits, "\t%ju hit%s\n");
+ p2(ft_misses, "\t%ju miss%s\n");
+ p(ft_inserts, "\t%ju insert%s\n");
+ p(ft_collisions, "\t%ju collision%s\n");
+ p(ft_free_checks, "\t%ju free check%s\n");
+ p(ft_frees, "\t%ju free%s\n");
+ p(ft_fail_lle_invalid,
+ "\t%ju lookup%s with not resolved Layer 2 address\n");
+
+#undef p2
+#undef p
+}
+
+void
+flowtable_stats(void)
+{
+ struct flowtable_stat stat;
+
+ if (!live)
+ return;
+
+ if (fetch_stats("net.flowtable.ip4.stat", 0, &stat,
+ sizeof(stat), NULL) == 0) {
+ printf("flowtable for IPv4:\n");
+ print_stats(&stat);
+ }
+
+ if (fetch_stats("net.flowtable.ip6.stat", 0, &stat,
+ sizeof(stat), NULL) == 0) {
+ printf("flowtable for IPv6:\n");
+ print_stats(&stat);
+ }
+}
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
new file mode 100644
index 0000000..55d320e
--- /dev/null
+++ b/usr.bin/netstat/if.c
@@ -0,0 +1,655 @@
+/*-
+ * Copyright (c) 2013 Gleb Smirnoff <glebius@FreeBSD.org>
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/time.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/ethernet.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <arpa/inet.h>
+#ifdef PF
+#include <net/pfvar.h>
+#include <net/if_pfsync.h>
+#endif
+
+#include <err.h>
+#include <errno.h>
+#include <ifaddrs.h>
+#include <libutil.h>
+#ifdef INET6
+#include <netdb.h>
+#endif
+#include <signal.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+
+#include "netstat.h"
+
+static void sidewaysintpr(void);
+
+#ifdef PF
+static const char* pfsyncacts[] = {
+ /* PFSYNC_ACT_CLR */ "clear all request",
+ /* PFSYNC_ACT_INS */ "state insert",
+ /* PFSYNC_ACT_INS_ACK */ "state inserted ack",
+ /* PFSYNC_ACT_UPD */ "state update",
+ /* PFSYNC_ACT_UPD_C */ "compressed state update",
+ /* PFSYNC_ACT_UPD_REQ */ "uncompressed state request",
+ /* PFSYNC_ACT_DEL */ "state delete",
+ /* PFSYNC_ACT_DEL_C */ "compressed state delete",
+ /* PFSYNC_ACT_INS_F */ "fragment insert",
+ /* PFSYNC_ACT_DEL_F */ "fragment delete",
+ /* PFSYNC_ACT_BUS */ "bulk update mark",
+ /* PFSYNC_ACT_TDB */ "TDB replay counter update",
+ /* PFSYNC_ACT_EOF */ "end of frame mark",
+};
+
+static const char* pfsyncacts_name[] = {
+ /* PFSYNC_ACT_CLR */ "clear-all-request",
+ /* PFSYNC_ACT_INS */ "state-insert",
+ /* PFSYNC_ACT_INS_ACK */ "state-inserted-ack",
+ /* PFSYNC_ACT_UPD */ "state-update",
+ /* PFSYNC_ACT_UPD_C */ "compressed-state-update",
+ /* PFSYNC_ACT_UPD_REQ */ "uncompressed-state-request",
+ /* PFSYNC_ACT_DEL */ "state-delete",
+ /* PFSYNC_ACT_DEL_C */ "compressed-state-delete",
+ /* PFSYNC_ACT_INS_F */ "fragment-insert",
+ /* PFSYNC_ACT_DEL_F */ "fragment-delete",
+ /* PFSYNC_ACT_BUS */ "bulk-update-mark",
+ /* PFSYNC_ACT_TDB */ "TDB-replay-counter-update",
+ /* PFSYNC_ACT_EOF */ "end-of-frame-mark",
+};
+
+static void
+pfsync_acts_stats(const char *list, const char *desc, uint64_t *a)
+{
+ int i;
+
+ xo_open_list(list);
+ for (i = 0; i < PFSYNC_ACT_MAX; i++, a++) {
+ if (*a || sflag <= 1) {
+ xo_open_instance(list);
+ xo_emit("\t\t{e:name}{:count/%ju} {N:/%s%s %s}\n",
+ pfsyncacts_name[i], (uintmax_t)(*a),
+ pfsyncacts[i], plural(*a), desc);
+ xo_close_instance(list);
+ }
+ }
+ xo_close_list(list);
+}
+
+/*
+ * Dump pfsync statistics structure.
+ */
+void
+pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct pfsyncstats pfsyncstat;
+
+ if (fetch_stats("net.pfsync.stats", off, &pfsyncstat,
+ sizeof(pfsyncstat), kread) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+ xo_open_container(name);
+
+#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)pfsyncstat.f, plural(pfsyncstat.f))
+
+ p(pfsyncs_ipackets, "\t{:received-inet-packets/%ju} "
+ "{N:/packet%s received (IPv4)}\n");
+ p(pfsyncs_ipackets6, "\t{:received-inet6-packets/%ju} "
+ "{N:/packet%s received (IPv6)}\n");
+ pfsync_acts_stats("input-histogram", "received",
+ &pfsyncstat.pfsyncs_iacts[0]);
+ p(pfsyncs_badif, "\t\t/{:dropped-bad-interface/%ju} "
+ "{N:/packet%s discarded for bad interface}\n");
+ p(pfsyncs_badttl, "\t\t{:dropped-bad-ttl/%ju} "
+ "{N:/packet%s discarded for bad ttl}\n");
+ p(pfsyncs_hdrops, "\t\t{:dropped-short-header/%ju} "
+ "{N:/packet%s shorter than header}\n");
+ p(pfsyncs_badver, "\t\t{:dropped-bad-version/%ju} "
+ "{N:/packet%s discarded for bad version}\n");
+ p(pfsyncs_badauth, "\t\t{:dropped-bad-auth/%ju} "
+ "{N:/packet%s discarded for bad HMAC}\n");
+ p(pfsyncs_badact,"\t\t{:dropped-bad-action/%ju} "
+ "{N:/packet%s discarded for bad action}\n");
+ p(pfsyncs_badlen, "\t\t{:dropped-short/%ju} "
+ "{N:/packet%s discarded for short packet}\n");
+ p(pfsyncs_badval, "\t\t{:dropped-bad-values/%ju} "
+ "{N:/state%s discarded for bad values}\n");
+ p(pfsyncs_stale, "\t\t{:dropped-stale-state/%ju} "
+ "{N:/stale state%s}\n");
+ p(pfsyncs_badstate, "\t\t{:dropped-failed-lookup/%ju} "
+ "{N:/failed state lookup\\/insert%s}\n");
+ p(pfsyncs_opackets, "\t{:sent-inet-packets/%ju} "
+ "{N:/packet%s sent (IPv4})\n");
+ p(pfsyncs_opackets6, "\t{:send-inet6-packets/%ju} "
+ "{N:/packet%s sent (IPv6})\n");
+ pfsync_acts_stats("output-histogram", "sent",
+ &pfsyncstat.pfsyncs_oacts[0]);
+ p(pfsyncs_onomem, "\t\t{:discarded-no-memory/%ju} "
+ "{N:/failure%s due to mbuf memory error}\n");
+ p(pfsyncs_oerrors, "\t\t{:send-errors/%ju} "
+ "{N:/send error%s}\n");
+#undef p
+ xo_close_container(name);
+}
+#endif /* PF */
+
+/*
+ * Display a formatted value, or a '-' in the same space.
+ */
+static void
+show_stat(const char *fmt, int width, const char *name,
+ u_long value, short showvalue, int div1000)
+{
+ const char *lsep, *rsep;
+ char newfmt[64];
+
+ lsep = "";
+ if (strncmp(fmt, "LS", 2) == 0) {
+ lsep = " ";
+ fmt += 2;
+ }
+ rsep = " ";
+ if (strncmp(fmt, "NRS", 3) == 0) {
+ rsep = "";
+ fmt += 3;
+ }
+ if (showvalue == 0) {
+ /* Print just dash. */
+ xo_emit("{P:/%s}{D:/%*s}{P:/%s}", lsep, width, "-", rsep);
+ return;
+ }
+
+ /*
+ * XXX: workaround {P:} modifier can't be empty and doesn't seem to
+ * take args... so we need to conditionally include it in the format.
+ */
+#define maybe_pad(pad) do { \
+ if (strlen(pad)) { \
+ snprintf(newfmt, sizeof(newfmt), "{P:%s}", pad); \
+ xo_emit(newfmt); \
+ } \
+} while (0)
+
+ if (hflag) {
+ char buf[5];
+
+ /* Format in human readable form. */
+ humanize_number(buf, sizeof(buf), (int64_t)value, "",
+ HN_AUTOSCALE, HN_NOSPACE | HN_DECIMAL | \
+ ((div1000) ? HN_DIVISOR_1000 : 0));
+ maybe_pad(lsep);
+ snprintf(newfmt, sizeof(newfmt), "{:%s/%%%ds}", name, width);
+ xo_emit(newfmt, buf);
+ maybe_pad(rsep);
+ } else {
+ /* Construct the format string. */
+ maybe_pad(lsep);
+ snprintf(newfmt, sizeof(newfmt), "{:%s/%%%d%s}",
+ name, width, fmt);
+ xo_emit(newfmt, value);
+ maybe_pad(rsep);
+ }
+}
+
+/*
+ * Find next multiaddr for a given interface name.
+ */
+static struct ifmaddrs *
+next_ifma(struct ifmaddrs *ifma, const char *name, const sa_family_t family)
+{
+
+ for(; ifma != NULL; ifma = ifma->ifma_next) {
+ struct sockaddr_dl *sdl;
+
+ sdl = (struct sockaddr_dl *)ifma->ifma_name;
+ if (ifma->ifma_addr->sa_family == family &&
+ strcmp(sdl->sdl_data, name) == 0)
+ break;
+ }
+
+ return (ifma);
+}
+
+/*
+ * Print a description of the network interfaces.
+ */
+void
+intpr(void (*pfunc)(char *), int af)
+{
+ struct ifaddrs *ifap, *ifa;
+ struct ifmaddrs *ifmap, *ifma;
+ u_int ifn_len_max = 5, ifn_len;
+ u_int has_ipv6 = 0, net_len = 13, addr_len = 17;
+
+ if (interval)
+ return sidewaysintpr();
+
+ if (getifaddrs(&ifap) != 0)
+ err(EX_OSERR, "getifaddrs");
+ if (aflag && getifmaddrs(&ifmap) != 0)
+ err(EX_OSERR, "getifmaddrs");
+
+ if (Wflag) {
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ if (interface != NULL &&
+ strcmp(ifa->ifa_name, interface) != 0)
+ continue;
+ if (af != AF_UNSPEC && ifa->ifa_addr->sa_family != af)
+ continue;
+ ifn_len = strlen(ifa->ifa_name);
+ if ((ifa->ifa_flags & IFF_UP) == 0)
+ ++ifn_len;
+ ifn_len_max = MAX(ifn_len_max, ifn_len);
+ if (ifa->ifa_addr->sa_family == AF_INET6)
+ has_ipv6 = 1;
+ }
+ if (has_ipv6) {
+ net_len = 24;
+ addr_len = 39;
+ } else
+ net_len = 18;
+ }
+
+ xo_open_list("interface");
+ if (!pfunc) {
+ xo_emit("{T:/%-*.*s}", ifn_len_max, ifn_len_max, "Name");
+ xo_emit(" {T:/%5.5s} {T:/%-*.*s} {T:/%-*.*s} {T:/%8.8s} "
+ "{T:/%5.5s} {T:/%5.5s}",
+ "Mtu", net_len, net_len, "Network", addr_len, addr_len,
+ "Address", "Ipkts", "Ierrs", "Idrop");
+ if (bflag)
+ xo_emit(" {T:/%10.10s}","Ibytes");
+ xo_emit(" {T:/%8.8s} {T:/%5.5s}", "Opkts", "Oerrs");
+ if (bflag)
+ xo_emit(" {T:/%10.10s}","Obytes");
+ xo_emit(" {T:/%5s}", "Coll");
+ if (dflag)
+ xo_emit(" {T:/%5.5s}", "Drop");
+ xo_emit("\n");
+ }
+
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ bool network = false, link = false;
+ char *name, *xname, buf[IFNAMSIZ+1];
+ const char *nn, *rn;
+
+ if (interface != NULL && strcmp(ifa->ifa_name, interface) != 0)
+ continue;
+
+ name = ifa->ifa_name;
+
+ if (pfunc) {
+
+ (*pfunc)(name);
+
+ /*
+ * Skip all ifaddrs belonging to same interface.
+ */
+ while(ifa->ifa_next != NULL &&
+ (strcmp(ifa->ifa_next->ifa_name, name) == 0)) {
+ ifa = ifa->ifa_next;
+ }
+ continue;
+ }
+
+ if (af != AF_UNSPEC && ifa->ifa_addr->sa_family != af)
+ continue;
+
+ xo_open_instance("interface");
+
+ if ((ifa->ifa_flags & IFF_UP) == 0) {
+ xname = stpcpy(buf, name);
+ *xname++ = '*';
+ *xname = '\0';
+ xname = buf;
+ } else
+ xname = name;
+
+ xo_emit("{d:/%-*.*s}{etk:name}{eq:flags/0x%x}",
+ ifn_len_max, ifn_len_max, xname, name, ifa->ifa_flags);
+
+#define IFA_MTU(ifa) (((struct if_data *)(ifa)->ifa_data)->ifi_mtu)
+ show_stat("lu", 6, "mtu", IFA_MTU(ifa), IFA_MTU(ifa), 0);
+#undef IFA_MTU
+
+ switch (ifa->ifa_addr->sa_family) {
+ case AF_UNSPEC:
+ xo_emit("{:network/%-*.*s} ", net_len, net_len,
+ "none");
+ xo_emit("{:address/%-*.*s} ", addr_len, addr_len,
+ "none");
+ break;
+ case AF_INET:
+#ifdef INET6
+ case AF_INET6:
+#endif /* INET6 */
+ nn = netname(ifa->ifa_addr, ifa->ifa_netmask);
+ rn = routename(ifa->ifa_addr, numeric_addr);
+ if (Wflag) {
+ xo_emit("{t:network/%-*s} ", net_len, nn);
+ xo_emit("{t:address/%-*s} ", addr_len, rn);
+ } else {
+ xo_emit("{d:network/%-*.*s}{et:network} ",
+ net_len, net_len, nn, nn);
+ xo_emit("{d:address/%-*.*s}{et:address} ",
+ addr_len, addr_len, rn, rn);
+ }
+
+ network = true;
+ break;
+ case AF_LINK:
+ {
+ struct sockaddr_dl *sdl;
+ char linknum[10];
+
+ sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+ sprintf(linknum, "<Link#%d>", sdl->sdl_index);
+ xo_emit("{t:network/%-*.*s} ", net_len, net_len,
+ linknum);
+ if (sdl->sdl_nlen == 0 &&
+ sdl->sdl_alen == 0 &&
+ sdl->sdl_slen == 0)
+ xo_emit("{P:/%*s} ", addr_len, "");
+ else
+ xo_emit("{t:address/%-*.*s} ", addr_len,
+ addr_len, routename(ifa->ifa_addr, 1));
+ link = true;
+ break;
+ }
+ }
+
+#define IFA_STAT(s) (((struct if_data *)ifa->ifa_data)->ifi_ ## s)
+ show_stat("lu", 8, "received-packets", IFA_STAT(ipackets),
+ link|network, 1);
+ show_stat("lu", 5, "received-errors", IFA_STAT(ierrors),
+ link, 1);
+ show_stat("lu", 5, "dropped-packets", IFA_STAT(iqdrops),
+ link, 1);
+ if (bflag)
+ show_stat("lu", 10, "received-bytes", IFA_STAT(ibytes),
+ link|network, 0);
+ show_stat("lu", 8, "sent-packets", IFA_STAT(opackets),
+ link|network, 1);
+ show_stat("lu", 5, "send-errors", IFA_STAT(oerrors), link, 1);
+ if (bflag)
+ show_stat("lu", 10, "sent-bytes", IFA_STAT(obytes),
+ link|network, 0);
+ show_stat("NRSlu", 5, "collisions", IFA_STAT(collisions),
+ link, 1);
+ if (dflag)
+ show_stat("LSlu", 5, "dropped-packets",
+ IFA_STAT(oqdrops), link, 1);
+ xo_emit("\n");
+
+ if (!aflag) {
+ xo_close_instance("interface");
+ continue;
+ }
+
+ /*
+ * Print family's multicast addresses.
+ */
+ xo_open_list("multicast-address");
+ for (ifma = next_ifma(ifmap, ifa->ifa_name,
+ ifa->ifa_addr->sa_family);
+ ifma != NULL;
+ ifma = next_ifma(ifma, ifa->ifa_name,
+ ifa->ifa_addr->sa_family)) {
+ const char *fmt = NULL;
+
+ xo_open_instance("multicast-address");
+ switch (ifma->ifma_addr->sa_family) {
+ case AF_LINK:
+ {
+ struct sockaddr_dl *sdl;
+
+ sdl = (struct sockaddr_dl *)ifma->ifma_addr;
+ if (sdl->sdl_type != IFT_ETHER &&
+ sdl->sdl_type != IFT_FDDI)
+ break;
+ }
+ /* FALLTHROUGH */
+ case AF_INET:
+#ifdef INET6
+ case AF_INET6:
+#endif /* INET6 */
+ fmt = routename(ifma->ifma_addr, numeric_addr);
+ break;
+ }
+ if (fmt) {
+ if (Wflag)
+ xo_emit("{P:/%27s }"
+ "{t:address/%-17s/}", "", fmt);
+ else
+ xo_emit("{P:/%25s }"
+ "{t:address/%-17.17s/}", "", fmt);
+ if (ifma->ifma_addr->sa_family == AF_LINK) {
+ xo_emit(" {:received-packets/%8lu}",
+ IFA_STAT(imcasts));
+ xo_emit("{P:/%*s}", bflag? 17 : 6, "");
+ xo_emit(" {:sent-packets/%8lu}",
+ IFA_STAT(omcasts));
+ }
+ xo_emit("\n");
+ }
+ xo_close_instance("multicast-address");
+ ifma = ifma->ifma_next;
+ }
+ xo_close_list("multicast-address");
+ xo_close_instance("interface");
+ }
+ xo_close_list("interface");
+
+ freeifaddrs(ifap);
+ if (aflag)
+ freeifmaddrs(ifmap);
+}
+
+struct iftot {
+ u_long ift_ip; /* input packets */
+ u_long ift_ie; /* input errors */
+ u_long ift_id; /* input drops */
+ u_long ift_op; /* output packets */
+ u_long ift_oe; /* output errors */
+ u_long ift_od; /* output drops */
+ u_long ift_co; /* collisions */
+ u_long ift_ib; /* input bytes */
+ u_long ift_ob; /* output bytes */
+};
+
+/*
+ * Obtain stats for interface(s).
+ */
+static void
+fill_iftot(struct iftot *st)
+{
+ struct ifaddrs *ifap, *ifa;
+ bool found = false;
+
+ if (getifaddrs(&ifap) != 0)
+ xo_err(EX_OSERR, "getifaddrs");
+
+ bzero(st, sizeof(*st));
+
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr->sa_family != AF_LINK)
+ continue;
+ if (interface) {
+ if (strcmp(ifa->ifa_name, interface) == 0)
+ found = true;
+ else
+ continue;
+ }
+
+ st->ift_ip += IFA_STAT(ipackets);
+ st->ift_ie += IFA_STAT(ierrors);
+ st->ift_id += IFA_STAT(iqdrops);
+ st->ift_ib += IFA_STAT(ibytes);
+ st->ift_op += IFA_STAT(opackets);
+ st->ift_oe += IFA_STAT(oerrors);
+ st->ift_od += IFA_STAT(oqdrops);
+ st->ift_ob += IFA_STAT(obytes);
+ st->ift_co += IFA_STAT(collisions);
+ }
+
+ if (interface && found == false)
+ xo_err(EX_DATAERR, "interface %s not found", interface);
+
+ freeifaddrs(ifap);
+}
+
+/*
+ * Set a flag to indicate that a signal from the periodic itimer has been
+ * caught.
+ */
+static sig_atomic_t signalled;
+static void
+catchalarm(int signo __unused)
+{
+ signalled = true;
+}
+
+/*
+ * Print a running summary of interface statistics.
+ * Repeat display every interval seconds, showing statistics
+ * collected over that interval. Assumes that interval is non-zero.
+ * First line printed at top of screen is always cumulative.
+ */
+static void
+sidewaysintpr(void)
+{
+ struct iftot ift[2], *new, *old;
+ struct itimerval interval_it;
+ int oldmask, line;
+
+ new = &ift[0];
+ old = &ift[1];
+ fill_iftot(old);
+
+ (void)signal(SIGALRM, catchalarm);
+ signalled = false;
+ interval_it.it_interval.tv_sec = interval;
+ interval_it.it_interval.tv_usec = 0;
+ interval_it.it_value = interval_it.it_interval;
+ setitimer(ITIMER_REAL, &interval_it, NULL);
+ xo_open_list("interface-statistics");
+
+banner:
+ xo_emit("{T:/%17s} {T:/%14s} {T:/%16s}\n", "input",
+ interface != NULL ? interface : "(Total)", "output");
+ xo_emit("{T:/%10s} {T:/%5s} {T:/%5s} {T:/%10s} {T:/%10s} {T:/%5s} "
+ "{T:/%10s} {T:/%5s}",
+ "packets", "errs", "idrops", "bytes", "packets", "errs", "bytes",
+ "colls");
+ if (dflag)
+ xo_emit(" {T:/%5.5s}", "drops");
+ xo_emit("\n");
+ xo_flush();
+ line = 0;
+
+loop:
+ if ((noutputs != 0) && (--noutputs == 0)) {
+ xo_close_list("interface-statistics");
+ return;
+ }
+ oldmask = sigblock(sigmask(SIGALRM));
+ while (!signalled)
+ sigpause(0);
+ signalled = false;
+ sigsetmask(oldmask);
+ line++;
+
+ fill_iftot(new);
+
+ xo_open_instance("stats");
+ show_stat("lu", 10, "received-packets",
+ new->ift_ip - old->ift_ip, 1, 1);
+ show_stat("lu", 5, "received-errors",
+ new->ift_ie - old->ift_ie, 1, 1);
+ show_stat("lu", 5, "dropped-packets",
+ new->ift_id - old->ift_id, 1, 1);
+ show_stat("lu", 10, "received-bytes",
+ new->ift_ib - old->ift_ib, 1, 0);
+ show_stat("lu", 10, "sent-packets",
+ new->ift_op - old->ift_op, 1, 1);
+ show_stat("lu", 5, "send-errors",
+ new->ift_oe - old->ift_oe, 1, 1);
+ show_stat("lu", 10, "sent-bytes",
+ new->ift_ob - old->ift_ob, 1, 0);
+ show_stat("NRSlu", 5, "collisions",
+ new->ift_co - old->ift_co, 1, 1);
+ if (dflag)
+ show_stat("LSlu", 5, "dropped-packets",
+ new->ift_od - old->ift_od, 1, 1);
+ xo_close_instance("stats");
+ xo_emit("\n");
+ xo_flush();
+
+ if (new == &ift[0]) {
+ new = &ift[1];
+ old = &ift[0];
+ } else {
+ new = &ift[0];
+ old = &ift[1];
+ }
+
+ if (line == 21)
+ goto banner;
+ else
+ goto loop;
+
+ /* NOTREACHED */
+}
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
new file mode 100644
index 0000000..54ab56f
--- /dev/null
+++ b/usr.bin/netstat/inet.c
@@ -0,0 +1,1482 @@
+/*-
+ * Copyright (c) 1983, 1988, 1993, 1995
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/domain.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+
+#include <net/route.h>
+#include <net/if_arp.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_carp.h>
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif /* INET6 */
+#include <netinet/in_pcb.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/icmp_var.h>
+#include <netinet/igmp_var.h>
+#include <netinet/ip_var.h>
+#include <netinet/pim_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcpip.h>
+#include <netinet/tcp_seq.h>
+#define TCPSTATES
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+
+#include <arpa/inet.h>
+#include <err.h>
+#include <errno.h>
+#include <libutil.h>
+#include <netdb.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+#include "nl_defs.h"
+
+char *inetname(struct in_addr *);
+void inetprint(const char *, struct in_addr *, int, const char *, int,
+ const int);
+#ifdef INET6
+static int udp_done, tcp_done, sdp_done;
+#endif /* INET6 */
+
+static int
+pcblist_sysctl(int proto, const char *name, char **bufp, int istcp __unused)
+{
+ const char *mibvar;
+ char *buf;
+ size_t len;
+
+ switch (proto) {
+ case IPPROTO_TCP:
+ mibvar = "net.inet.tcp.pcblist";
+ break;
+ case IPPROTO_UDP:
+ mibvar = "net.inet.udp.pcblist";
+ break;
+ case IPPROTO_DIVERT:
+ mibvar = "net.inet.divert.pcblist";
+ break;
+ default:
+ mibvar = "net.inet.raw.pcblist";
+ break;
+ }
+ if (strncmp(name, "sdp", 3) == 0)
+ mibvar = "net.inet.sdp.pcblist";
+ len = 0;
+ if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
+ if (errno != ENOENT)
+ xo_warn("sysctl: %s", mibvar);
+ return (0);
+ }
+ if ((buf = malloc(len)) == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return (0);
+ }
+ if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
+ xo_warn("sysctl: %s", mibvar);
+ free(buf);
+ return (0);
+ }
+ *bufp = buf;
+ return (1);
+}
+
+/*
+ * Copied directly from uipc_socket2.c. We leave out some fields that are in
+ * nested structures that aren't used to avoid extra work.
+ */
+static void
+sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
+{
+ xsb->sb_cc = sb->sb_ccc;
+ xsb->sb_hiwat = sb->sb_hiwat;
+ xsb->sb_mbcnt = sb->sb_mbcnt;
+ xsb->sb_mcnt = sb->sb_mcnt;
+ xsb->sb_ccnt = sb->sb_ccnt;
+ xsb->sb_mbmax = sb->sb_mbmax;
+ xsb->sb_lowat = sb->sb_lowat;
+ xsb->sb_flags = sb->sb_flags;
+ xsb->sb_timeo = sb->sb_timeo;
+}
+
+int
+sotoxsocket(struct socket *so, struct xsocket *xso)
+{
+ struct protosw proto;
+ struct domain domain;
+
+ bzero(xso, sizeof *xso);
+ xso->xso_len = sizeof *xso;
+ xso->xso_so = so;
+ xso->so_type = so->so_type;
+ xso->so_options = so->so_options;
+ xso->so_linger = so->so_linger;
+ xso->so_state = so->so_state;
+ xso->so_pcb = so->so_pcb;
+ if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0)
+ return (-1);
+ xso->xso_protocol = proto.pr_protocol;
+ if (kread((uintptr_t)proto.pr_domain, &domain, sizeof(domain)) != 0)
+ return (-1);
+ xso->xso_family = domain.dom_family;
+ xso->so_qlen = so->so_qlen;
+ xso->so_incqlen = so->so_incqlen;
+ xso->so_qlimit = so->so_qlimit;
+ xso->so_timeo = so->so_timeo;
+ xso->so_error = so->so_error;
+ xso->so_oobmark = so->so_oobmark;
+ sbtoxsockbuf(&so->so_snd, &xso->so_snd);
+ sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
+ return (0);
+}
+
+static int
+pcblist_kvm(u_long off, char **bufp, int istcp)
+{
+ struct inpcbinfo pcbinfo;
+ struct inpcbhead listhead;
+ struct inpcb *inp;
+ struct xinpcb xi;
+ struct xinpgen xig;
+ struct xtcpcb xt;
+ struct socket so;
+ struct xsocket *xso;
+ char *buf, *p;
+ size_t len;
+
+ if (off == 0)
+ return (0);
+ kread(off, &pcbinfo, sizeof(pcbinfo));
+ if (istcp)
+ len = 2 * sizeof(xig) +
+ (pcbinfo.ipi_count + pcbinfo.ipi_count / 8) *
+ sizeof(struct xtcpcb);
+ else
+ len = 2 * sizeof(xig) +
+ (pcbinfo.ipi_count + pcbinfo.ipi_count / 8) *
+ sizeof(struct xinpcb);
+ if ((buf = malloc(len)) == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return (0);
+ }
+ p = buf;
+
+#define COPYOUT(obj, size) do { \
+ if (len < (size)) { \
+ xo_warnx("buffer size exceeded"); \
+ goto fail; \
+ } \
+ bcopy((obj), p, (size)); \
+ len -= (size); \
+ p += (size); \
+} while (0)
+
+#define KREAD(off, buf, len) do { \
+ if (kread((uintptr_t)(off), (buf), (len)) != 0) \
+ goto fail; \
+} while (0)
+
+ /* Write out header. */
+ xig.xig_len = sizeof xig;
+ xig.xig_count = pcbinfo.ipi_count;
+ xig.xig_gen = pcbinfo.ipi_gencnt;
+ xig.xig_sogen = 0;
+ COPYOUT(&xig, sizeof xig);
+
+ /* Walk the PCB list. */
+ xt.xt_len = sizeof xt;
+ xi.xi_len = sizeof xi;
+ if (istcp)
+ xso = &xt.xt_socket;
+ else
+ xso = &xi.xi_socket;
+ KREAD(pcbinfo.ipi_listhead, &listhead, sizeof(listhead));
+ LIST_FOREACH(inp, &listhead, inp_list) {
+ if (istcp) {
+ KREAD(inp, &xt.xt_inp, sizeof(*inp));
+ inp = &xt.xt_inp;
+ } else {
+ KREAD(inp, &xi.xi_inp, sizeof(*inp));
+ inp = &xi.xi_inp;
+ }
+
+ if (inp->inp_gencnt > pcbinfo.ipi_gencnt)
+ continue;
+
+ if (istcp) {
+ if (inp->inp_ppcb == NULL)
+ bzero(&xt.xt_tp, sizeof xt.xt_tp);
+ else if (inp->inp_flags & INP_TIMEWAIT) {
+ bzero(&xt.xt_tp, sizeof xt.xt_tp);
+ xt.xt_tp.t_state = TCPS_TIME_WAIT;
+ } else
+ KREAD(inp->inp_ppcb, &xt.xt_tp,
+ sizeof xt.xt_tp);
+ }
+ if (inp->inp_socket) {
+ KREAD(inp->inp_socket, &so, sizeof(so));
+ if (sotoxsocket(&so, xso) != 0)
+ goto fail;
+ } else {
+ bzero(xso, sizeof(*xso));
+ if (istcp)
+ xso->xso_protocol = IPPROTO_TCP;
+ }
+ if (istcp)
+ COPYOUT(&xt, sizeof xt);
+ else
+ COPYOUT(&xi, sizeof xi);
+ }
+
+ /* Reread the pcbinfo and write out the footer. */
+ kread(off, &pcbinfo, sizeof(pcbinfo));
+ xig.xig_count = pcbinfo.ipi_count;
+ xig.xig_gen = pcbinfo.ipi_gencnt;
+ COPYOUT(&xig, sizeof xig);
+
+ *bufp = buf;
+ return (1);
+
+fail:
+ free(buf);
+ return (0);
+#undef COPYOUT
+#undef KREAD
+}
+
+/*
+ * Print a summary of connections related to an Internet
+ * protocol. For TCP, also give state of connection.
+ * Listening processes (aflag) are suppressed unless the
+ * -a (all) flag is specified.
+ */
+void
+protopr(u_long off, const char *name, int af1, int proto)
+{
+ int istcp;
+ static int first = 1;
+ char *buf;
+ const char *vchar;
+ struct tcpcb *tp = NULL;
+ struct inpcb *inp;
+ struct xinpgen *xig, *oxig;
+ struct xsocket *so;
+ struct xtcp_timer *timer;
+
+ istcp = 0;
+ switch (proto) {
+ case IPPROTO_TCP:
+#ifdef INET6
+ if (strncmp(name, "sdp", 3) != 0) {
+ if (tcp_done != 0)
+ return;
+ else
+ tcp_done = 1;
+ } else {
+ if (sdp_done != 0)
+ return;
+ else
+ sdp_done = 1;
+ }
+#endif
+ istcp = 1;
+ break;
+ case IPPROTO_UDP:
+#ifdef INET6
+ if (udp_done != 0)
+ return;
+ else
+ udp_done = 1;
+#endif
+ break;
+ }
+ if (live) {
+ if (!pcblist_sysctl(proto, name, &buf, istcp))
+ return;
+ } else {
+ if (!pcblist_kvm(off, &buf, istcp))
+ return;
+ }
+
+ oxig = xig = (struct xinpgen *)buf;
+ for (xig = (struct xinpgen *)((char *)xig + xig->xig_len);
+ xig->xig_len > sizeof(struct xinpgen);
+ xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
+ if (istcp) {
+ timer = &((struct xtcpcb *)xig)->xt_timer;
+ tp = &((struct xtcpcb *)xig)->xt_tp;
+ inp = &((struct xtcpcb *)xig)->xt_inp;
+ so = &((struct xtcpcb *)xig)->xt_socket;
+ } else {
+ inp = &((struct xinpcb *)xig)->xi_inp;
+ so = &((struct xinpcb *)xig)->xi_socket;
+ timer = NULL;
+ }
+
+ /* Ignore sockets for protocols other than the desired one. */
+ if (so->xso_protocol != proto)
+ continue;
+
+ /* Ignore PCBs which were freed during copyout. */
+ if (inp->inp_gencnt > oxig->xig_gen)
+ continue;
+
+ if ((af1 == AF_INET && (inp->inp_vflag & INP_IPV4) == 0)
+#ifdef INET6
+ || (af1 == AF_INET6 && (inp->inp_vflag & INP_IPV6) == 0)
+#endif /* INET6 */
+ || (af1 == AF_UNSPEC && ((inp->inp_vflag & INP_IPV4) == 0
+#ifdef INET6
+ && (inp->inp_vflag & INP_IPV6) == 0
+#endif /* INET6 */
+ ))
+ )
+ continue;
+ if (!aflag &&
+ (
+ (istcp && tp->t_state == TCPS_LISTEN)
+ || (af1 == AF_INET &&
+ inet_lnaof(inp->inp_laddr) == INADDR_ANY)
+#ifdef INET6
+ || (af1 == AF_INET6 &&
+ IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
+#endif /* INET6 */
+ || (af1 == AF_UNSPEC &&
+ (((inp->inp_vflag & INP_IPV4) != 0 &&
+ inet_lnaof(inp->inp_laddr) == INADDR_ANY)
+#ifdef INET6
+ || ((inp->inp_vflag & INP_IPV6) != 0 &&
+ IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
+#endif
+ ))
+ ))
+ continue;
+
+ if (first) {
+ if (!Lflag) {
+ xo_emit("Active Internet connections");
+ if (aflag)
+ xo_emit(" (including servers)");
+ } else
+ xo_emit(
+ "Current listen queue sizes (qlen/incqlen/maxqlen)");
+ xo_emit("\n");
+ if (Aflag)
+ xo_emit("{T:/%-*s} ", 2 * (int)sizeof(void *),
+ "Tcpcb");
+ if (Lflag)
+ xo_emit((Aflag && !Wflag) ?
+ "{T:/%-5.5s} {T:/%-14.14s} {T:/%-18.18s}" :
+ ((!Wflag || af1 == AF_INET) ?
+ "{T:/%-5.5s} {T:/%-14.14s} {T:/%-22.22s}" :
+ "{T:/%-5.5s} {T:/%-14.14s} {T:/%-45.45s}"),
+ "Proto", "Listen", "Local Address");
+ else if (Tflag)
+ xo_emit((Aflag && !Wflag) ?
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%s}" :
+ ((!Wflag || af1 == AF_INET) ?
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%s}" :
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"),
+ "Proto", "Rexmit", "OOORcv", "0-win",
+ "Local Address", "Foreign Address");
+ else {
+ xo_emit((Aflag && !Wflag) ?
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" :
+ ((!Wflag || af1 == AF_INET) ?
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" :
+ "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"),
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address");
+ if (!xflag && !Rflag)
+ xo_emit(" (state)");
+ }
+ if (xflag) {
+ xo_emit(" {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
+ "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
+ "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
+ "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s}",
+ "R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS",
+ "R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA",
+ "R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX");
+ xo_emit(" {T:/%7.7s} {T:/%7.7s} {T:/%7.7s} "
+ "{T:/%7.7s} {T:/%7.7s} {T:/%7.7s}",
+ "rexmt", "persist", "keep", "2msl",
+ "delack", "rcvtime");
+ } else if (Rflag) {
+ xo_emit(" {T:/%8.8s} {T:/%5.5s}",
+ "flowid", "ftype");
+ }
+ xo_emit("\n");
+ first = 0;
+ }
+ if (Lflag && so->so_qlimit == 0)
+ continue;
+ xo_open_instance("socket");
+ if (Aflag) {
+ if (istcp)
+ xo_emit("{q:address/%*lx} ",
+ 2 * (int)sizeof(void *),
+ (u_long)inp->inp_ppcb);
+ else
+ xo_emit("{q:adddress/%*lx} ",
+ 2 * (int)sizeof(void *),
+ (u_long)so->so_pcb);
+ }
+#ifdef INET6
+ if ((inp->inp_vflag & INP_IPV6) != 0)
+ vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
+ "46" : "6";
+ else
+#endif
+ vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
+ "4" : "";
+ if (istcp && (tp->t_flags & TF_TOE) != 0)
+ xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", "toe", vchar);
+ else
+ xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", name, vchar);
+ if (Lflag) {
+ char buf1[33];
+
+ snprintf(buf1, sizeof buf1, "%u/%u/%u", so->so_qlen,
+ so->so_incqlen, so->so_qlimit);
+ xo_emit("{:listen-queue-sizes/%-32.32s} ", buf1);
+ } else if (Tflag) {
+ if (istcp)
+ xo_emit("{:sent-retransmit-packets/%6u} "
+ "{:received-out-of-order-packets/%6u} "
+ "{:sent-zero-window/%6u} ",
+ tp->t_sndrexmitpack, tp->t_rcvoopack,
+ tp->t_sndzerowin);
+ else
+ xo_emit("{P:/%21s}", "");
+ } else {
+ xo_emit("{:receive-bytes-waiting/%6u} "
+ "{:send-bytes-waiting/%6u} ",
+ so->so_rcv.sb_cc, so->so_snd.sb_cc);
+ }
+ if (numeric_port) {
+ if (inp->inp_vflag & INP_IPV4) {
+ inetprint("local", &inp->inp_laddr,
+ (int)inp->inp_lport, name, 1, af1);
+ if (!Lflag)
+ inetprint("remote", &inp->inp_faddr,
+ (int)inp->inp_fport, name, 1, af1);
+ }
+#ifdef INET6
+ else if (inp->inp_vflag & INP_IPV6) {
+ inet6print("local", &inp->in6p_laddr,
+ (int)inp->inp_lport, name, 1);
+ if (!Lflag)
+ inet6print("remote", &inp->in6p_faddr,
+ (int)inp->inp_fport, name, 1);
+ } /* else nothing printed now */
+#endif /* INET6 */
+ } else if (inp->inp_flags & INP_ANONPORT) {
+ if (inp->inp_vflag & INP_IPV4) {
+ inetprint("local", &inp->inp_laddr,
+ (int)inp->inp_lport, name, 1, af1);
+ if (!Lflag)
+ inetprint("remote", &inp->inp_faddr,
+ (int)inp->inp_fport, name, 0, af1);
+ }
+#ifdef INET6
+ else if (inp->inp_vflag & INP_IPV6) {
+ inet6print("local", &inp->in6p_laddr,
+ (int)inp->inp_lport, name, 1);
+ if (!Lflag)
+ inet6print("remote", &inp->in6p_faddr,
+ (int)inp->inp_fport, name, 0);
+ } /* else nothing printed now */
+#endif /* INET6 */
+ } else {
+ if (inp->inp_vflag & INP_IPV4) {
+ inetprint("local", &inp->inp_laddr,
+ (int)inp->inp_lport, name, 0, af1);
+ if (!Lflag)
+ inetprint("remote", &inp->inp_faddr,
+ (int)inp->inp_fport, name,
+ inp->inp_lport != inp->inp_fport,
+ af1);
+ }
+#ifdef INET6
+ else if (inp->inp_vflag & INP_IPV6) {
+ inet6print("local", &inp->in6p_laddr,
+ (int)inp->inp_lport, name, 0);
+ if (!Lflag)
+ inet6print("remote", &inp->in6p_faddr,
+ (int)inp->inp_fport, name,
+ inp->inp_lport != inp->inp_fport);
+ } /* else nothing printed now */
+#endif /* INET6 */
+ }
+ if (xflag) {
+ xo_emit("{:receive-mbufs/%6u} {:send-mbufs/%6u} "
+ "{:receive-clusters/%6u} {:send-clusters/%6u} "
+ "{:receive-high-water/%6u} {:send-high-water/%6u} "
+ "{:receive-low-water/%6u} {:send-low-water/%6u} "
+ "{:receive-mbuf-bytes/%6u} {:send-mbuf-bytes/%6u} "
+ "{:receive-mbuf-bytes-max/%6u} "
+ "{:send-mbuf-bytes-max/%6u}",
+ so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt,
+ so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt,
+ so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat,
+ so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
+ so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
+ so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
+ if (timer != NULL)
+ xo_emit(" {:retransmit-timer/%4d.%02d} "
+ "{:persist-timer/%4d.%02d} "
+ "{:keepalive-timer/%4d.%02d} "
+ "{:msl2-timer/%4d.%02d} "
+ "{:delay-ack-timer/%4d.%02d} "
+ "{:inactivity-timer/%4d.%02d}",
+ timer->tt_rexmt / 1000,
+ (timer->tt_rexmt % 1000) / 10,
+ timer->tt_persist / 1000,
+ (timer->tt_persist % 1000) / 10,
+ timer->tt_keep / 1000,
+ (timer->tt_keep % 1000) / 10,
+ timer->tt_2msl / 1000,
+ (timer->tt_2msl % 1000) / 10,
+ timer->tt_delack / 1000,
+ (timer->tt_delack % 1000) / 10,
+ timer->t_rcvtime / 1000,
+ (timer->t_rcvtime % 1000) / 10);
+ }
+ if (istcp && !Lflag && !xflag && !Tflag && !Rflag) {
+ if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
+ xo_emit("{:tcp-state/%d}", tp->t_state);
+ else {
+ xo_emit("{:tcp-state/%s}",
+ tcpstates[tp->t_state]);
+#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN)
+ /* Show T/TCP `hidden state' */
+ if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
+ xo_emit("{:need-syn-or-fin/*}");
+#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
+ }
+ }
+ if (Rflag) {
+ /* XXX: is this right Alfred */
+ xo_emit(" {:flow-id/%08x} {:flow-type/%5d}",
+ inp->inp_flowid,
+ inp->inp_flowtype);
+ }
+ xo_emit("\n");
+ xo_close_instance("socket");
+ }
+ if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
+ if (oxig->xig_count > xig->xig_count) {
+ xo_emit("Some {d:lost/%s} sockets may have been "
+ "deleted.\n", name);
+ } else if (oxig->xig_count < xig->xig_count) {
+ xo_emit("Some {d:created/%s} sockets may have been "
+ "created.\n", name);
+ } else {
+ xo_emit("Some {d:changed/%s} sockets may have been "
+ "created or deleted.\n", name);
+ }
+ }
+ free(buf);
+}
+
+/*
+ * Dump TCP statistics structure.
+ */
+void
+tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct tcpstat tcpstat;
+ uint64_t tcps_states[TCP_NSTATES];
+
+#ifdef INET6
+ if (tcp_done != 0)
+ return;
+ else
+ tcp_done = 1;
+#endif
+
+ if (fetch_stats("net.inet.tcp.stats", off, &tcpstat,
+ sizeof(tcpstat), kread_counters) != 0)
+ return;
+
+ if (fetch_stats_ro("net.inet.tcp.states", nl[N_TCPS_STATES].n_value,
+ &tcps_states, sizeof(tcps_states), kread_counters) != 0)
+ return;
+
+ xo_open_container("tcp");
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (tcpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f, plural(tcpstat.f))
+#define p1a(f, m) if (tcpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f)
+#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \
+ (uintmax_t )tcpstat.f2, plural(tcpstat.f2))
+#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \
+ (uintmax_t )tcpstat.f2)
+#define p3(f, m) if (tcpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f, pluralies(tcpstat.f))
+
+ p(tcps_sndtotal, "\t{:sent-packets/%ju} {N:/packet%s sent}\n");
+ p2(tcps_sndpack,tcps_sndbyte, "\t\t{:sent-data-packets/%ju} "
+ "{N:/data packet%s} ({:sent-data-bytes/%ju} {N:/byte%s})\n");
+ p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, "\t\t"
+ "{:sent-retransmitted-packets/%ju} {N:/data packet%s} "
+ "({:sent-retransmitted-bytes/%ju} {N:/byte%s}) "
+ "{N:retransmitted}\n");
+ p(tcps_sndrexmitbad, "\t\t"
+ "{:sent-unnecessary-retransmitted-packets/%ju} "
+ "{N:/data packet%s unnecessarily retransmitted}\n");
+ p(tcps_mturesent, "\t\t{:sent-resends-by-mtu-discovery/%ju} "
+ "{N:/resend%s initiated by MTU discovery}\n");
+ p2a(tcps_sndacks, tcps_delack, "\t\t{:sent-ack-only-packets/%ju} "
+ "{N:/ack-only packet%s/} ({:sent-packets-delayed/%ju} "
+ "{N:delayed})\n");
+ p(tcps_sndurg, "\t\t{:sent-urg-only-packets/%ju} "
+ "{N:/URG only packet%s}\n");
+ p(tcps_sndprobe, "\t\t{:sent-window-probe-packets/%ju} "
+ "{N:/window probe packet%s}\n");
+ p(tcps_sndwinup, "\t\t{:sent-window-update-packets/%ju} "
+ "{N:/window update packet%s}\n");
+ p(tcps_sndctrl, "\t\t{:sent-control-packets/%ju} "
+ "{N:/control packet%s}\n");
+ p(tcps_rcvtotal, "\t{:received-packets/%ju} "
+ "{N:/packet%s received}\n");
+ p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t"
+ "{:received-ack-packets/%ju} {N:/ack%s} "
+ "{N:(for} {:received-ack-bytes/%ju} {N:/byte%s})\n");
+ p(tcps_rcvdupack, "\t\t{:received-duplicate-acks/%ju} "
+ "{N:/duplicate ack%s}\n");
+ p(tcps_rcvacktoomuch, "\t\t{:received-acks-for-unsent-data/%ju} "
+ "{N:/ack%s for unsent data}\n");
+ p2(tcps_rcvpack, tcps_rcvbyte, "\t\t"
+ "{:received-in-sequence-packets/%ju} {N:/packet%s} "
+ "({:received-in-sequence-bytes/%ju} {N:/byte%s}) "
+ "{N:received in-sequence}\n");
+ p2(tcps_rcvduppack, tcps_rcvdupbyte, "\t\t"
+ "{:received-completely-duplicate-packets/%ju} "
+ "{N:/completely duplicate packet%s} "
+ "({:received-completely-duplicate-bytes/%ju} {N:/byte%s})\n");
+ p(tcps_pawsdrop, "\t\t{:received-old-duplicate-packets/%ju} "
+ "{N:/old duplicate packet%s}\n");
+ p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, "\t\t"
+ "{:received-some-duplicate-packets/%ju} "
+ "{N:/packet%s with some dup. data} "
+ "({:received-some-duplicate-bytes/%ju} {N:/byte%s duped/})\n");
+ p2(tcps_rcvoopack, tcps_rcvoobyte, "\t\t{:received-out-of-order/%ju} "
+ "{N:/out-of-order packet%s} "
+ "({:received-out-of-order-bytes/%ju} {N:/byte%s})\n");
+ p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, "\t\t"
+ "{:received-after-window-packets/%ju} {N:/packet%s} "
+ "({:received-after-window-bytes/%ju} {N:/byte%s}) "
+ "{N:of data after window}\n");
+ p(tcps_rcvwinprobe, "\t\t{:received-window-probes/%ju} "
+ "{N:/window probe%s}\n");
+ p(tcps_rcvwinupd, "\t\t{:receive-window-update-packets/%ju} "
+ "{N:/window update packet%s}\n");
+ p(tcps_rcvafterclose, "\t\t{:received-after-close-packets/%ju} "
+ "{N:/packet%s received after close}\n");
+ p(tcps_rcvbadsum, "\t\t{:discard-bad-checksum/%ju} "
+ "{N:/discarded for bad checksum%s}\n");
+ p(tcps_rcvbadoff, "\t\t{:discard-bad-header-offset/%ju} "
+ "{N:/discarded for bad header offset field%s}\n");
+ p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} "
+ "{N:discarded because packet too short}\n");
+ p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} "
+ "{N:discarded due to memory problems}\n");
+ p(tcps_connattempt, "\t{:connection-requests/%ju} "
+ "{N:/connection request%s}\n");
+ p(tcps_accepts, "\t{:connections-accepts/%ju} "
+ "{N:/connection accept%s}\n");
+ p(tcps_badsyn, "\t{:bad-connection-attempts/%ju} "
+ "{N:/bad connection attempt%s}\n");
+ p(tcps_listendrop, "\t{:listen-queue-overflows/%ju} "
+ "{N:/listen queue overflow%s}\n");
+ p(tcps_badrst, "\t{:ignored-in-window-resets/%ju} "
+ "{N:/ignored RSTs in the window%s}\n");
+ p(tcps_connects, "\t{:connections-established/%ju} "
+ "{N:/connection%s established (including accepts)}\n");
+ p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} "
+ "{N:/connection%s closed (including} "
+ "{:connection-drops/%ju} {N:/drop%s})\n");
+ p(tcps_cachedrtt, "\t\t{:connections-updated-rtt-on-close/%ju} "
+ "{N:/connection%s updated cached RTT on close}\n");
+ p(tcps_cachedrttvar, "\t\t"
+ "{:connections-updated-variance-on-close/%ju} "
+ "{N:/connection%s updated cached RTT variance on close}\n");
+ p(tcps_cachedssthresh, "\t\t"
+ "{:connections-updated-ssthresh-on-close/%ju} "
+ "{N:/connection%s updated cached ssthresh on close}\n");
+ p(tcps_conndrops, "\t{:embryonic-connections-dropped/%ju} "
+ "{N:/embryonic connection%s dropped}\n");
+ p2(tcps_rttupdated, tcps_segstimed, "\t{:segments-updated-rtt/%ju} "
+ "{N:/segment%s updated rtt (of} "
+ "{:segment-update-attempts/%ju} {N:/attempt%s})\n");
+ p(tcps_rexmttimeo, "\t{:retransmit-timeouts/%ju} "
+ "{N:/retransmit timeout%s}\n");
+ p(tcps_timeoutdrop, "\t\t"
+ "{:connections-dropped-by-retransmit-timeout/%ju} "
+ "{N:/connection%s dropped by rexmit timeout}\n");
+ p(tcps_persisttimeo, "\t{:persist-timeout/%ju} "
+ "{N:/persist timeout%s}\n");
+ p(tcps_persistdrop, "\t\t"
+ "{:connections-dropped-by-persist-timeout/%ju} "
+ "{N:/connection%s dropped by persist timeout}\n");
+ p(tcps_finwait2_drops, "\t"
+ "{:connections-dropped-by-finwait2-timeout/%ju} "
+ "{N:/Connection%s (fin_wait_2) dropped because of timeout}\n");
+ p(tcps_keeptimeo, "\t{:keepalive-timeout/%ju} "
+ "{N:/keepalive timeout%s}\n");
+ p(tcps_keepprobe, "\t\t{:keepalive-probes/%ju} "
+ "{N:/keepalive probe%s sent}\n");
+ p(tcps_keepdrops, "\t\t{:connections-dropped-by-keepalives/%ju} "
+ "{N:/connection%s dropped by keepalive}\n");
+ p(tcps_predack, "\t{:ack-header-predictions/%ju} "
+ "{N:/correct ACK header prediction%s}\n");
+ p(tcps_preddat, "\t{:data-packet-header-predictions/%ju} "
+ "{N:/correct data packet header prediction%s}\n");
+
+ xo_open_container("syncache");
+
+ p3(tcps_sc_added, "\t{:entries-added/%ju} "
+ "{N:/syncache entr%s added}\n");
+ p1a(tcps_sc_retransmitted, "\t\t{:retransmitted/%ju} "
+ "{N:/retransmitted}\n");
+ p1a(tcps_sc_dupsyn, "\t\t{:duplicates/%ju} {N:/dupsyn}\n");
+ p1a(tcps_sc_dropped, "\t\t{:dropped/%ju} {N:/dropped}\n");
+ p1a(tcps_sc_completed, "\t\t{:completed/%ju} {N:/completed}\n");
+ p1a(tcps_sc_bucketoverflow, "\t\t{:bucket-overflow/%ju} "
+ "{N:/bucket overflow}\n");
+ p1a(tcps_sc_cacheoverflow, "\t\t{:cache-overflow/%ju} "
+ "{N:/cache overflow}\n");
+ p1a(tcps_sc_reset, "\t\t{:reset/%ju} {N:/reset}\n");
+ p1a(tcps_sc_stale, "\t\t{:stale/%ju} {N:/stale}\n");
+ p1a(tcps_sc_aborted, "\t\t{:aborted/%ju} {N:/aborted}\n");
+ p1a(tcps_sc_badack, "\t\t{:bad-ack/%ju} {N:/badack}\n");
+ p1a(tcps_sc_unreach, "\t\t{:unreachable/%ju} {N:/unreach}\n");
+ p(tcps_sc_zonefail, "\t\t{:zone-failures/%ju} {N:/zone failure%s}\n");
+ p(tcps_sc_sendcookie, "\t{:sent-cookies/%ju} {N:/cookie%s sent}\n");
+ p(tcps_sc_recvcookie, "\t{:receivd-cookies/%ju} "
+ "{N:/cookie%s received}\n");
+
+ xo_close_container("syncache");
+
+ xo_open_container("hostcache");
+
+ p3(tcps_hc_added, "\t{:entries-added/%ju} "
+ "{N:/hostcache entr%s added}\n");
+ p1a(tcps_hc_bucketoverflow, "\t\t{:buffer-overflows/%ju} "
+ "{N:/bucket overflow}\n");
+
+ xo_close_container("hostcache");
+
+ xo_open_container("sack");
+
+ p(tcps_sack_recovery_episode, "\t{:recovery-episodes/%ju} "
+ "{N:/SACK recovery episode%s}\n");
+ p(tcps_sack_rexmits, "\t{:segment-retransmits/%ju} "
+ "{N:/segment rexmit%s in SACK recovery episodes}\n");
+ p(tcps_sack_rexmit_bytes, "\t{:byte-retransmits/%ju} "
+ "{N:/byte rexmit%s in SACK recovery episodes}\n");
+ p(tcps_sack_rcv_blocks, "\t{:received-blocks/%ju} "
+ "{N:/SACK option%s (SACK blocks) received}\n");
+ p(tcps_sack_send_blocks, "\t{:sent-option-blocks/%ju} "
+ "{N:/SACK option%s (SACK blocks) sent}\n");
+ p1a(tcps_sack_sboverflow, "\t{:scoreboard-overflows/%ju} "
+ "{N:/SACK scoreboard overflow}\n");
+
+ xo_close_container("sack");
+ xo_open_container("ecn");
+
+ p(tcps_ecn_ce, "\t{:ce-packets/%ju} "
+ "{N:/packet%s with ECN CE bit set}\n");
+ p(tcps_ecn_ect0, "\t{:ect0-packets/%ju} "
+ "{N:/packet%s with ECN ECT(0) bit set}\n");
+ p(tcps_ecn_ect1, "\t{:ect1-packets/%ju} "
+ "{N:/packet%s with ECN ECT(1) bit set}\n");
+ p(tcps_ecn_shs, "\t{:handshakes/%ju} "
+ "{N:/successful ECN handshake%s}\n");
+ p(tcps_ecn_rcwnd, "\t{:congestion-reductions/%ju} "
+ "{N:/time%s ECN reduced the congestion window}\n");
+ #undef p
+ #undef p1a
+ #undef p2
+ #undef p2a
+ #undef p3
+ xo_close_container("ecn");
+
+ xo_open_container("TCP connection count by state");
+ xo_emit("{T:/TCP connection count by state}:\n");
+ for (int i = 0; i < TCP_NSTATES; i++) {
+ /*
+ * XXXGL: is there a way in libxo to use %s
+ * in the "content string" of a format
+ * string? I failed to do that, that's why
+ * a temporary buffer is used to construct
+ * format string for xo_emit().
+ */
+ char fmtbuf[80];
+
+ if (sflag > 1 && tcps_states[i] == 0)
+ continue;
+ snprintf(fmtbuf, sizeof(fmtbuf), "\t{:%s/%%ju} "
+ "{Np:/connection ,connections} in %s state\n",
+ tcpstates[i], tcpstates[i]);
+ xo_emit(fmtbuf, (uintmax_t )tcps_states[i]);
+ }
+ xo_close_container("TCP connection count by state");
+
+ xo_close_container("tcp");
+}
+
+/*
+ * Dump UDP statistics structure.
+ */
+void
+udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct udpstat udpstat;
+ uint64_t delivered;
+
+#ifdef INET6
+ if (udp_done != 0)
+ return;
+ else
+ udp_done = 1;
+#endif
+
+ if (fetch_stats("net.inet.udp.stats", off, &udpstat,
+ sizeof(udpstat), kread_counters) != 0)
+ return;
+
+ xo_open_container("udp");
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (udpstat.f || sflag <= 1) \
+ xo_emit("\t" m, (uintmax_t)udpstat.f, plural(udpstat.f))
+#define p1a(f, m) if (udpstat.f || sflag <= 1) \
+ xo_emit("\t" m, (uintmax_t)udpstat.f)
+
+ p(udps_ipackets, "{:received-datagrams/%ju} "
+ "{N:/datagram%s received}\n");
+ p1a(udps_hdrops, "{:dropped-incomplete-headers/%ju} "
+ "{N:/with incomplete header}\n");
+ p1a(udps_badlen, "{:dropped-bad-data-length/%ju} "
+ "{N:/with bad data length field}\n");
+ p1a(udps_badsum, "{:dropped-bad-checksum/%ju} "
+ "{N:/with bad checksum}\n");
+ p1a(udps_nosum, "{:dropped-no-checksum/%ju} "
+ "{N:/with no checksum}\n");
+ p1a(udps_noport, "{:dropped-no-socket/%ju} "
+ "{N:/dropped due to no socket}\n");
+ p(udps_noportbcast, "{:dropped-broadcast-multicast/%ju} "
+ "{N:/broadcast\\/multicast datagram%s undelivered}\n");
+ p1a(udps_fullsock, "{:dropped-full-socket-buffer/%ju} "
+ "{N:/dropped due to full socket buffers}\n");
+ p1a(udpps_pcbhashmiss, "{:not-for-hashed-pcb/%ju} "
+ "{N:/not for hashed pcb}\n");
+ delivered = udpstat.udps_ipackets -
+ udpstat.udps_hdrops -
+ udpstat.udps_badlen -
+ udpstat.udps_badsum -
+ udpstat.udps_noport -
+ udpstat.udps_noportbcast -
+ udpstat.udps_fullsock;
+ if (delivered || sflag <= 1)
+ xo_emit("\t{:delivered-packets/%ju} {N:/delivered}\n",
+ (uint64_t)delivered);
+ p(udps_opackets, "{:output-packets/%ju} {N:/datagram%s output}\n");
+ /* the next statistic is cumulative in udps_noportbcast */
+ p(udps_filtermcast, "{:multicast-source-filter-matches/%ju} "
+ "{N:/time%s multicast source filter matched}\n");
+#undef p
+#undef p1a
+ xo_close_container("udp");
+}
+
+/*
+ * Dump CARP statistics structure.
+ */
+void
+carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct carpstats carpstat;
+
+ if (fetch_stats("net.inet.carp.stats", off, &carpstat,
+ sizeof(carpstat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (carpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)carpstat.f, plural(carpstat.f))
+#define p2(f, m) if (carpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)carpstat.f)
+
+ p(carps_ipackets, "\t{:received-inet-packets/%ju} "
+ "{N:/packet%s received (IPv4)}\n");
+ p(carps_ipackets6, "\t{:received-inet6-packets/%ju} "
+ "{N:/packet%s received (IPv6)}\n");
+ p(carps_badttl, "\t\t{:dropped-wrong-ttl/%ju} "
+ "{N:/packet%s discarded for wrong TTL}\n");
+ p(carps_hdrops, "\t\t{:dropped-short-header/%ju} "
+ "{N:/packet%s shorter than header}\n");
+ p(carps_badsum, "\t\t{:dropped-bad-checksum/%ju} "
+ "{N:/discarded for bad checksum%s}\n");
+ p(carps_badver, "\t\t{:dropped-bad-version/%ju} "
+ "{N:/discarded packet%s with a bad version}\n");
+ p2(carps_badlen, "\t\t{:dropped-short-packet/%ju} "
+ "{N:/discarded because packet too short}\n");
+ p2(carps_badauth, "\t\t{:dropped-bad-authentication/%ju} "
+ "{N:/discarded for bad authentication}\n");
+ p2(carps_badvhid, "\t\t{:dropped-bad-vhid/%ju} "
+ "{N:/discarded for bad vhid}\n");
+ p2(carps_badaddrs, "\t\t{:dropped-bad-address-list/%ju} "
+ "{N:/discarded because of a bad address list}\n");
+ p(carps_opackets, "\t{:sent-inet-packets/%ju} "
+ "{N:/packet%s sent (IPv4)}\n");
+ p(carps_opackets6, "\t{:sent-inet6-packets/%ju} "
+ "{N:/packet%s sent (IPv6)}\n");
+ p2(carps_onomem, "\t\t{:send-failed-memory-error/%ju} "
+ "{N:/send failed due to mbuf memory error}\n");
+#if notyet
+ p(carps_ostates, "\t\t{:send-state-updates/%s} "
+ "{N:/state update%s sent}\n");
+#endif
+#undef p
+#undef p2
+ xo_close_container(name);
+}
+
+/*
+ * Dump IP statistics structure.
+ */
+void
+ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct ipstat ipstat;
+
+ if (fetch_stats("net.inet.ip.stats", off, &ipstat,
+ sizeof(ipstat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (ipstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )ipstat.f, plural(ipstat.f))
+#define p1a(f, m) if (ipstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )ipstat.f)
+
+ p(ips_total, "\t{:received-packets/%ju} "
+ "{N:/total packet%s received}\n");
+ p(ips_badsum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/bad header checksum%s}\n");
+ p1a(ips_toosmall, "\t{:dropped-below-minimum-size/%ju} "
+ "{N:/with size smaller than minimum}\n");
+ p1a(ips_tooshort, "\t{:dropped-short-packets/%ju} "
+ "{N:/with data size < data length}\n");
+ p1a(ips_toolong, "\t{:dropped-too-long/%ju} "
+ "{N:/with ip length > max ip packet size}\n");
+ p1a(ips_badhlen, "\t{:dropped-short-header-length/%ju} "
+ "{N:/with header length < data size}\n");
+ p1a(ips_badlen, "\t{:dropped-short-data/%ju} "
+ "{N:/with data length < header length}\n");
+ p1a(ips_badoptions, "\t{:dropped-bad-options/%ju} "
+ "{N:/with bad options}\n");
+ p1a(ips_badvers, "\t{:dropped-bad-version/%ju} "
+ "{N:/with incorrect version number}\n");
+ p(ips_fragments, "\t{:received-fragments/%ju} "
+ "{N:/fragment%s received}\n");
+ p(ips_fragdropped, "\t{:dropped-fragments/%ju} "
+ "{N:/fragment%s dropped (dup or out of space)}\n");
+ p(ips_fragtimeout, "\t{:dropped-fragments-after-timeout/%ju} "
+ "{N:/fragment%s dropped after timeout}\n");
+ p(ips_reassembled, "\t{:reassembled-packets/%ju} "
+ "{N:/packet%s reassembled ok}\n");
+ p(ips_delivered, "\t{:received-local-packets/%ju} "
+ "{N:/packet%s for this host}\n");
+ p(ips_noproto, "\t{:dropped-unknown-protocol/%ju} "
+ "{N:/packet%s for unknown\\/unsupported protocol}\n");
+ p(ips_forward, "\t{:forwarded-packets/%ju} "
+ "{N:/packet%s forwarded}");
+ p(ips_fastforward, " ({:fast-forwarded-packets/%ju} "
+ "{N:/packet%s fast forwarded})");
+ if (ipstat.ips_forward || sflag <= 1)
+ xo_emit("\n");
+ p(ips_cantforward, "\t{:packets-cannot-forward/%ju} "
+ "{N:/packet%s not forwardable}\n");
+ p(ips_notmember, "\t{:received-unknown-multicast-group/%ju} "
+ "{N:/packet%s received for unknown multicast group}\n");
+ p(ips_redirectsent, "\t{:redirects-sent/%ju} "
+ "{N:/redirect%s sent}\n");
+ p(ips_localout, "\t{:sent-packets/%ju} "
+ "{N:/packet%s sent from this host}\n");
+ p(ips_rawout, "\t{:send-packets-fabricated-header/%ju} "
+ "{N:/packet%s sent with fabricated ip header}\n");
+ p(ips_odropped, "\t{:discard-no-mbufs/%ju} "
+ "{N:/output packet%s dropped due to no bufs, etc.}\n");
+ p(ips_noroute, "\t{:discard-no-route/%ju} "
+ "{N:/output packet%s discarded due to no route}\n");
+ p(ips_fragmented, "\t{:sent-fragments/%ju} "
+ "{N:/output datagram%s fragmented}\n");
+ p(ips_ofragments, "\t{:fragments-created/%ju} "
+ "{N:/fragment%s created}\n");
+ p(ips_cantfrag, "\t{:discard-cannot-fragment/%ju} "
+ "{N:/datagram%s that can't be fragmented}\n");
+ p(ips_nogif, "\t{:discard-tunnel-no-gif/%ju} "
+ "{N:/tunneling packet%s that can't find gif}\n");
+ p(ips_badaddr, "\t{:discard-bad-address/%ju} "
+ "{N:/datagram%s with bad address in header}\n");
+#undef p
+#undef p1a
+ xo_close_container(name);
+}
+
+/*
+ * Dump ARP statistics structure.
+ */
+void
+arp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct arpstat arpstat;
+
+ if (fetch_stats("net.link.ether.arp.stats", off, &arpstat,
+ sizeof(arpstat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (arpstat.f || sflag <= 1) \
+ xo_emit("\t" m, (uintmax_t)arpstat.f, plural(arpstat.f))
+#define p2(f, m) if (arpstat.f || sflag <= 1) \
+ xo_emit("\t" m, (uintmax_t)arpstat.f, pluralies(arpstat.f))
+
+ p(txrequests, "{:sent-requests/%ju} {N:/ARP request%s sent}\n");
+ p2(txreplies, "{:sent-replies/%ju} {N:/ARP repl%s sent}\n");
+ p(rxrequests, "{:received-requests/%ju} "
+ "{N:/ARP request%s received}\n");
+ p2(rxreplies, "{:received-replies/%ju} "
+ "{N:/ARP repl%s received}\n");
+ p(received, "{:received-packers/%ju} "
+ "{N:/ARP packet%s received}\n");
+ p(dropped, "{:dropped-no-entry/%ju} "
+ "{N:/total packet%s dropped due to no ARP entry}\n");
+ p(timeouts, "{:entries-timeout/%ju} "
+ "{N:/ARP entry%s timed out}\n");
+ p(dupips, "{:dropped-duplicate-address/%ju} "
+ "{N:/Duplicate IP%s seen}\n");
+#undef p
+#undef p2
+ xo_close_container(name);
+}
+
+
+
+static const char *icmpnames[ICMP_MAXTYPE + 1] = {
+ "echo reply", /* RFC 792 */
+ "#1",
+ "#2",
+ "destination unreachable", /* RFC 792 */
+ "source quench", /* RFC 792 */
+ "routing redirect", /* RFC 792 */
+ "#6",
+ "#7",
+ "echo", /* RFC 792 */
+ "router advertisement", /* RFC 1256 */
+ "router solicitation", /* RFC 1256 */
+ "time exceeded", /* RFC 792 */
+ "parameter problem", /* RFC 792 */
+ "time stamp", /* RFC 792 */
+ "time stamp reply", /* RFC 792 */
+ "information request", /* RFC 792 */
+ "information request reply", /* RFC 792 */
+ "address mask request", /* RFC 950 */
+ "address mask reply", /* RFC 950 */
+ "#19",
+ "#20",
+ "#21",
+ "#22",
+ "#23",
+ "#24",
+ "#25",
+ "#26",
+ "#27",
+ "#28",
+ "#29",
+ "icmp traceroute", /* RFC 1393 */
+ "datagram conversion error", /* RFC 1475 */
+ "mobile host redirect",
+ "IPv6 where-are-you",
+ "IPv6 i-am-here",
+ "mobile registration req",
+ "mobile registration reply",
+ "domain name request", /* RFC 1788 */
+ "domain name reply", /* RFC 1788 */
+ "icmp SKIP",
+ "icmp photuris", /* RFC 2521 */
+};
+
+/*
+ * Dump ICMP statistics.
+ */
+void
+icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct icmpstat icmpstat;
+ size_t len;
+ int i, first;
+
+ if (fetch_stats("net.inet.icmp.stats", off, &icmpstat,
+ sizeof(icmpstat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (icmpstat.f || sflag <= 1) \
+ xo_emit(m, icmpstat.f, plural(icmpstat.f))
+#define p1a(f, m) if (icmpstat.f || sflag <= 1) \
+ xo_emit(m, icmpstat.f)
+#define p2(f, m) if (icmpstat.f || sflag <= 1) \
+ xo_emit(m, icmpstat.f, plurales(icmpstat.f))
+
+ p(icps_error, "\t{:icmp-calls/%lu} "
+ "{N:/call%s to icmp_error}\n");
+ p(icps_oldicmp, "\t{:errors-not-from-message/%lu} "
+ "{N:/error%s not generated in response to an icmp message}\n");
+
+ for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) {
+ if (icmpstat.icps_outhist[i] != 0) {
+ if (first) {
+ xo_open_list("output-histogram");
+ xo_emit("\tOutput histogram:\n");
+ first = 0;
+ }
+ xo_open_instance("output-histogram");
+ if (icmpnames[i] != NULL)
+ xo_emit("\t\t{k:name/%s}: {:count/%lu}\n",
+ icmpnames[i], icmpstat.icps_outhist[i]);
+ else
+ xo_emit("\t\tunknown ICMP #{k:name/%d}: "
+ "{:count/%lu}\n",
+ i, icmpstat.icps_outhist[i]);
+ xo_close_instance("output-histogram");
+ }
+ }
+ if (!first)
+ xo_close_list("output-histogram");
+
+ p(icps_badcode, "\t{:dropped-bad-code/%lu} "
+ "{N:/message%s with bad code fields}\n");
+ p(icps_tooshort, "\t{:dropped-too-short/%lu} "
+ "{N:/message%s less than the minimum length}\n");
+ p(icps_checksum, "\t{:dropped-bad-checksum/%lu} "
+ "{N:/message%s with bad checksum}\n");
+ p(icps_badlen, "\t{:dropped-bad-length/%lu} "
+ "{N:/message%s with bad length}\n");
+ p1a(icps_bmcastecho, "\t{:dropped-multicast-echo/%lu} "
+ "{N:/multicast echo requests ignored}\n");
+ p1a(icps_bmcasttstamp, "\t{:dropped-multicast-timestamp/%lu} "
+ "{N:/multicast timestamp requests ignored}\n");
+
+ for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) {
+ if (icmpstat.icps_inhist[i] != 0) {
+ if (first) {
+ xo_open_list("input-histogram");
+ xo_emit("\tInput histogram:\n");
+ first = 0;
+ }
+ xo_open_instance("input-histogram");
+ if (icmpnames[i] != NULL)
+ xo_emit("\t\t{k:name/%s}: {:count/%lu}\n",
+ icmpnames[i],
+ icmpstat.icps_inhist[i]);
+ else
+ xo_emit(
+ "\t\tunknown ICMP #{k:name/%d}: {:count/%lu}\n",
+ i, icmpstat.icps_inhist[i]);
+ xo_close_instance("input-histogram");
+ }
+ }
+ if (!first)
+ xo_close_list("input-histogram");
+
+ p(icps_reflect, "\t{:sent-packets/%lu} "
+ "{N:/message response%s generated}\n");
+ p2(icps_badaddr, "\t{:discard-invalid-return-address/%lu} "
+ "{N:/invalid return address%s}\n");
+ p(icps_noroute, "\t{:discard-no-route/%lu} "
+ "{N:/no return route%s}\n");
+#undef p
+#undef p1a
+#undef p2
+ if (live) {
+ len = sizeof i;
+ if (sysctlbyname("net.inet.icmp.maskrepl", &i, &len, NULL, 0) <
+ 0)
+ return;
+ xo_emit("\tICMP address mask responses are "
+ "{q:icmp-address-responses/%sabled}\n", i ? "en" : "dis");
+ }
+
+ xo_close_container(name);
+}
+
+/*
+ * Dump IGMP statistics structure.
+ */
+void
+igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct igmpstat igmpstat;
+
+ if (fetch_stats("net.inet.igmp.stats", 0, &igmpstat,
+ sizeof(igmpstat), kread) != 0)
+ return;
+
+ if (igmpstat.igps_version != IGPS_VERSION_3) {
+ xo_warnx("%s: version mismatch (%d != %d)", __func__,
+ igmpstat.igps_version, IGPS_VERSION_3);
+ }
+ if (igmpstat.igps_len != IGPS_VERSION3_LEN) {
+ xo_warnx("%s: size mismatch (%d != %d)", __func__,
+ igmpstat.igps_len, IGPS_VERSION3_LEN);
+ }
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p64(f, m) if (igmpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t) igmpstat.f, plural(igmpstat.f))
+#define py64(f, m) if (igmpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t) igmpstat.f, pluralies(igmpstat.f))
+
+ p64(igps_rcv_total, "\t{:received-messages/%ju} "
+ "{N:/message%s received}\n");
+ p64(igps_rcv_tooshort, "\t{:dropped-too-short/%ju} "
+ "{N:/message%s received with too few bytes}\n");
+ p64(igps_rcv_badttl, "\t{:dropped-wrong-ttl/%ju} "
+ "{N:/message%s received with wrong TTL}\n");
+ p64(igps_rcv_badsum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/message%s received with bad checksum}\n");
+ py64(igps_rcv_v1v2_queries, "\t{:received-membership-queries/%ju} "
+ "{N:/V1\\/V2 membership quer%s received}\n");
+ py64(igps_rcv_v3_queries, "\t{:received-v3-membership-queries/%ju} "
+ "{N:/V3 membership quer%s received}\n");
+ py64(igps_rcv_badqueries, "\t{:dropped-membership-queries/%ju} "
+ "{N:/membership quer%s received with invalid field(s)}\n");
+ py64(igps_rcv_gen_queries, "\t{:received-general-queries/%ju} "
+ "{N:/general quer%s received}\n");
+ py64(igps_rcv_group_queries, "\t{:received-group-queries/%ju} "
+ "{N:/group quer%s received}\n");
+ py64(igps_rcv_gsr_queries, "\t{:received-group-source-queries/%ju} "
+ "{N:/group-source quer%s received}\n");
+ py64(igps_drop_gsr_queries, "\t{:dropped-group-source-queries/%ju} "
+ "{N:/group-source quer%s dropped}\n");
+ p64(igps_rcv_reports, "\t{:received-membership-requests/%ju} "
+ "{N:/membership report%s received}\n");
+ p64(igps_rcv_badreports, "\t{:dropped-membership-reports/%ju} "
+ "{N:/membership report%s received with invalid field(s)}\n");
+ p64(igps_rcv_ourreports, "\t"
+ "{:received-membership-reports-matching/%ju} "
+ "{N:/membership report%s received for groups to which we belong}"
+ "\n");
+ p64(igps_rcv_nora, "\t{:received-v3-reports-no-router-alert/%ju} "
+ "{N:/V3 report%s received without Router Alert}\n");
+ p64(igps_snd_reports, "\t{:sent-membership-reports/%ju} "
+ "{N:/membership report%s sent}\n");
+#undef p64
+#undef py64
+ xo_close_container(name);
+}
+
+/*
+ * Dump PIM statistics structure.
+ */
+void
+pim_stats(u_long off __unused, const char *name, int af1 __unused,
+ int proto __unused)
+{
+ struct pimstat pimstat;
+
+ if (fetch_stats("net.inet.pim.stats", off, &pimstat,
+ sizeof(pimstat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (pimstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)pimstat.f, plural(pimstat.f))
+#define py(f, m) if (pimstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)pimstat.f, pimstat.f != 1 ? "ies" : "y")
+
+ p(pims_rcv_total_msgs, "\t{:received-messages/%ju} "
+ "{N:/message%s received}\n");
+ p(pims_rcv_total_bytes, "\t{:received-bytes/%ju} "
+ "{N:/byte%s received}\n");
+ p(pims_rcv_tooshort, "\t{:dropped-too-short/%ju} "
+ "{N:/message%s received with too few bytes}\n");
+ p(pims_rcv_badsum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/message%s received with bad checksum}\n");
+ p(pims_rcv_badversion, "\t{:dropped-bad-version/%ju} "
+ "{N:/message%s received with bad version}\n");
+ p(pims_rcv_registers_msgs, "\t{:received-data-register-messages/%ju} "
+ "{N:/data register message%s received}\n");
+ p(pims_rcv_registers_bytes, "\t{:received-data-register-bytes/%ju} "
+ "{N:/data register byte%s received}\n");
+ p(pims_rcv_registers_wrongiif, "\t"
+ "{:received-data-register-wrong-interface/%ju} "
+ "{N:/data register message%s received on wrong iif}\n");
+ p(pims_rcv_badregisters, "\t{:received-bad-registers/%ju} "
+ "{N:/bad register%s received}\n");
+ p(pims_snd_registers_msgs, "\t{:sent-data-register-messages/%ju} "
+ "{N:/data register message%s sent}\n");
+ p(pims_snd_registers_bytes, "\t{:sent-data-register-bytes/%ju} "
+ "{N:/data register byte%s sent}\n");
+#undef p
+#undef py
+ xo_close_container(name);
+}
+
+/*
+ * Pretty print an Internet address (net address + port).
+ */
+void
+inetprint(const char *container, struct in_addr *in, int port,
+ const char *proto, int num_port, const int af1)
+{
+ struct servent *sp = 0;
+ char line[80], *cp;
+ int width;
+
+ if (container)
+ xo_open_container(container);
+
+ if (Wflag)
+ sprintf(line, "%s.", inetname(in));
+ else
+ sprintf(line, "%.*s.", (Aflag && !num_port) ? 12 : 16, inetname(in));
+ cp = strchr(line, '\0');
+ if (!num_port && port)
+ sp = getservbyport((int)port, proto);
+ if (sp || port == 0)
+ sprintf(cp, "%.15s ", sp ? sp->s_name : "*");
+ else
+ sprintf(cp, "%d ", ntohs((u_short)port));
+ width = (Aflag && !Wflag) ? 18 :
+ ((!Wflag || af1 == AF_INET) ? 22 : 45);
+ if (Wflag)
+ xo_emit("{d:target/%-*s} ", width, line);
+ else
+ xo_emit("{d:target/%-*.*s} ", width, width, line);
+
+ int alen = cp - line - 1, plen = strlen(cp) - 1;
+ xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen,
+ plen, cp);
+
+ if (container)
+ xo_close_container(container);
+}
+
+/*
+ * Construct an Internet address representation.
+ * If numeric_addr has been supplied, give
+ * numeric value, otherwise try for symbolic name.
+ */
+char *
+inetname(struct in_addr *inp)
+{
+ char *cp;
+ static char line[MAXHOSTNAMELEN];
+ struct hostent *hp;
+ struct netent *np;
+
+ cp = 0;
+ if (!numeric_addr && inp->s_addr != INADDR_ANY) {
+ int net = inet_netof(*inp);
+ int lna = inet_lnaof(*inp);
+
+ if (lna == INADDR_ANY) {
+ np = getnetbyaddr(net, AF_INET);
+ if (np)
+ cp = np->n_name;
+ }
+ if (cp == NULL) {
+ hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
+ if (hp) {
+ cp = hp->h_name;
+ trimdomain(cp, strlen(cp));
+ }
+ }
+ }
+ if (inp->s_addr == INADDR_ANY)
+ strcpy(line, "*");
+ else if (cp) {
+ strlcpy(line, cp, sizeof(line));
+ } else {
+ inp->s_addr = ntohl(inp->s_addr);
+#define C(x) ((u_int)((x) & 0xff))
+ sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24),
+ C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
+ }
+ return (line);
+}
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
new file mode 100644
index 0000000..094d25b
--- /dev/null
+++ b/usr.bin/netstat/inet6.c
@@ -0,0 +1,1348 @@
+/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
+/*-
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifdef INET6
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/ioctl.h>
+#include <sys/mbuf.h>
+#include <sys/protosw.h>
+
+#include <net/route.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#include <netinet/in_systm.h>
+#include <netinet6/in6_pcb.h>
+#include <netinet6/in6_var.h>
+#include <netinet6/ip6_var.h>
+#include <netinet6/pim6_var.h>
+#include <netinet6/raw_ip6.h>
+
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+char *inet6name(struct in6_addr *);
+
+static char ntop_buf[INET6_ADDRSTRLEN];
+
+static const char *ip6nh[] = {
+ "hop by hop",
+ "ICMP",
+ "IGMP",
+ "#3",
+ "IP",
+ "#5",
+ "TCP",
+ "#7",
+ "#8",
+ "#9",
+ "#10",
+ "#11",
+ "#12",
+ "#13",
+ "#14",
+ "#15",
+ "#16",
+ "UDP",
+ "#18",
+ "#19",
+ "#20",
+ "#21",
+ "IDP",
+ "#23",
+ "#24",
+ "#25",
+ "#26",
+ "#27",
+ "#28",
+ "TP",
+ "#30",
+ "#31",
+ "#32",
+ "#33",
+ "#34",
+ "#35",
+ "#36",
+ "#37",
+ "#38",
+ "#39",
+ "#40",
+ "IP6",
+ "#42",
+ "routing",
+ "fragment",
+ "#45",
+ "#46",
+ "#47",
+ "#48",
+ "#49",
+ "ESP",
+ "AH",
+ "#52",
+ "#53",
+ "#54",
+ "#55",
+ "#56",
+ "#57",
+ "ICMP6",
+ "no next header",
+ "destination option",
+ "#61",
+ "mobility",
+ "#63",
+ "#64",
+ "#65",
+ "#66",
+ "#67",
+ "#68",
+ "#69",
+ "#70",
+ "#71",
+ "#72",
+ "#73",
+ "#74",
+ "#75",
+ "#76",
+ "#77",
+ "#78",
+ "#79",
+ "ISOIP",
+ "#81",
+ "#82",
+ "#83",
+ "#84",
+ "#85",
+ "#86",
+ "#87",
+ "#88",
+ "OSPF",
+ "#80",
+ "#91",
+ "#92",
+ "#93",
+ "#94",
+ "#95",
+ "#96",
+ "Ethernet",
+ "#98",
+ "#99",
+ "#100",
+ "#101",
+ "#102",
+ "PIM",
+ "#104",
+ "#105",
+ "#106",
+ "#107",
+ "#108",
+ "#109",
+ "#110",
+ "#111",
+ "#112",
+ "#113",
+ "#114",
+ "#115",
+ "#116",
+ "#117",
+ "#118",
+ "#119",
+ "#120",
+ "#121",
+ "#122",
+ "#123",
+ "#124",
+ "#125",
+ "#126",
+ "#127",
+ "#128",
+ "#129",
+ "#130",
+ "#131",
+ "#132",
+ "#133",
+ "#134",
+ "#135",
+ "#136",
+ "#137",
+ "#138",
+ "#139",
+ "#140",
+ "#141",
+ "#142",
+ "#143",
+ "#144",
+ "#145",
+ "#146",
+ "#147",
+ "#148",
+ "#149",
+ "#150",
+ "#151",
+ "#152",
+ "#153",
+ "#154",
+ "#155",
+ "#156",
+ "#157",
+ "#158",
+ "#159",
+ "#160",
+ "#161",
+ "#162",
+ "#163",
+ "#164",
+ "#165",
+ "#166",
+ "#167",
+ "#168",
+ "#169",
+ "#170",
+ "#171",
+ "#172",
+ "#173",
+ "#174",
+ "#175",
+ "#176",
+ "#177",
+ "#178",
+ "#179",
+ "#180",
+ "#181",
+ "#182",
+ "#183",
+ "#184",
+ "#185",
+ "#186",
+ "#187",
+ "#188",
+ "#189",
+ "#180",
+ "#191",
+ "#192",
+ "#193",
+ "#194",
+ "#195",
+ "#196",
+ "#197",
+ "#198",
+ "#199",
+ "#200",
+ "#201",
+ "#202",
+ "#203",
+ "#204",
+ "#205",
+ "#206",
+ "#207",
+ "#208",
+ "#209",
+ "#210",
+ "#211",
+ "#212",
+ "#213",
+ "#214",
+ "#215",
+ "#216",
+ "#217",
+ "#218",
+ "#219",
+ "#220",
+ "#221",
+ "#222",
+ "#223",
+ "#224",
+ "#225",
+ "#226",
+ "#227",
+ "#228",
+ "#229",
+ "#230",
+ "#231",
+ "#232",
+ "#233",
+ "#234",
+ "#235",
+ "#236",
+ "#237",
+ "#238",
+ "#239",
+ "#240",
+ "#241",
+ "#242",
+ "#243",
+ "#244",
+ "#245",
+ "#246",
+ "#247",
+ "#248",
+ "#249",
+ "#250",
+ "#251",
+ "#252",
+ "#253",
+ "#254",
+ "#255",
+};
+
+static const char *srcrule_str[] = {
+ "first candidate",
+ "same address",
+ "appropriate scope",
+ "deprecated address",
+ "home address",
+ "outgoing interface",
+ "matching label",
+ "public/temporary address",
+ "alive interface",
+ "better virtual status",
+ "preferred source",
+ "rule #11",
+ "rule #12",
+ "rule #13",
+ "longest match",
+ "rule #15",
+};
+
+/*
+ * Dump IP6 statistics structure.
+ */
+void
+ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct ip6stat ip6stat;
+ int first, i;
+
+ if (fetch_stats("net.inet6.ip6.stats", off, &ip6stat,
+ sizeof(ip6stat), kread_counters) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (ip6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ip6stat.f, plural(ip6stat.f))
+#define p1a(f, m) if (ip6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ip6stat.f)
+
+ p(ip6s_total, "\t{:received-packets/%ju} "
+ "{N:/total packet%s received}\n");
+ p1a(ip6s_toosmall, "\t{:dropped-below-minimum-size/%ju} "
+ "{N:/with size smaller than minimum}\n");
+ p1a(ip6s_tooshort, "\t{:dropped-short-packets/%ju} "
+ "{N:/with data size < data length}\n");
+ p1a(ip6s_badoptions, "\t{:dropped-bad-options/%ju} "
+ "{N:/with bad options}\n");
+ p1a(ip6s_badvers, "\t{:dropped-bad-version/%ju} "
+ "{N:/with incorrect version number}\n");
+ p(ip6s_fragments, "\t{:received-fragments/%ju} "
+ "{N:/fragment%s received}\n");
+ p(ip6s_fragdropped, "\t{:dropped-fragment/%ju} "
+ "{N:/fragment%s dropped (dup or out of space)}\n");
+ p(ip6s_fragtimeout, "\t{:dropped-fragment-after-timeout/%ju} "
+ "{N:/fragment%s dropped after timeout}\n");
+ p(ip6s_fragoverflow, "\t{:dropped-fragments-overflow/%ju} "
+ "{N:/fragment%s that exceeded limit}\n");
+ p(ip6s_reassembled, "\t{:reassembled-packets/%ju} "
+ "{N:/packet%s reassembled ok}\n");
+ p(ip6s_delivered, "\t{:received-local-packets/%ju} "
+ "{N:/packet%s for this host}\n");
+ p(ip6s_forward, "\t{:forwarded-packets/%ju} "
+ "{N:/packet%s forwarded}\n");
+ p(ip6s_cantforward, "\t{:packets-not-forwardable/%ju} "
+ "{N:/packet%s not forwardable}\n");
+ p(ip6s_redirectsent, "\t{:sent-redirects/%ju} "
+ "{N:/redirect%s sent}\n");
+ p(ip6s_localout, "\t{:sent-packets/%ju} "
+ "{N:/packet%s sent from this host}\n");
+ p(ip6s_rawout, "\t{:send-packets-fabricated-header/%ju} "
+ "{N:/packet%s sent with fabricated ip header}\n");
+ p(ip6s_odropped, "\t{:discard-no-mbufs/%ju} "
+ "{N:/output packet%s dropped due to no bufs, etc.}\n");
+ p(ip6s_noroute, "\t{:discard-no-route/%ju} "
+ "{N:/output packet%s discarded due to no route}\n");
+ p(ip6s_fragmented, "\t{:sent-fragments/%ju} "
+ "{N:/output datagram%s fragmented}\n");
+ p(ip6s_ofragments, "\t{:fragments-created/%ju} "
+ "{N:/fragment%s created}\n");
+ p(ip6s_cantfrag, "\t{:discard-cannot-fragment/%ju} "
+ "{N:/datagram%s that can't be fragmented}\n");
+ p(ip6s_badscope, "\t{:discard-scope-violations/%ju} "
+ "{N:/packet%s that violated scope rules}\n");
+ p(ip6s_notmember, "\t{:multicast-no-join-packets/%ju} "
+ "{N:/multicast packet%s which we don't join}\n");
+ for (first = 1, i = 0; i < IP6S_HDRCNT; i++)
+ if (ip6stat.ip6s_nxthist[i] != 0) {
+ if (first) {
+ xo_emit("\t{T:Input histogram}:\n");
+ xo_open_list("input-histogram");
+ first = 0;
+ }
+ xo_open_instance("input-histogram");
+ xo_emit("\t\t{k:name/%s}: {:count/%ju}\n", ip6nh[i],
+ (uintmax_t)ip6stat.ip6s_nxthist[i]);
+ xo_close_instance("input-histogram");
+ }
+ if (!first)
+ xo_close_list("input-histogram");
+
+ xo_open_container("mbuf-statistics");
+ xo_emit("\t{T:Mbuf statistics}:\n");
+ xo_emit("\t\t{:one-mbuf/%ju} {N:/one mbuf}\n",
+ (uintmax_t)ip6stat.ip6s_m1);
+ for (first = 1, i = 0; i < IP6S_M2MMAX; i++) {
+ char ifbuf[IFNAMSIZ];
+ if (ip6stat.ip6s_m2m[i] != 0) {
+ if (first) {
+ xo_emit("\t\t{N:two or more mbuf}:\n");
+ xo_open_list("mbuf-data");
+ first = 0;
+ }
+ xo_open_instance("mbuf-data");
+ xo_emit("\t\t\t{k:name/%s}= {:count/%ju}\n",
+ if_indextoname(i, ifbuf),
+ (uintmax_t)ip6stat.ip6s_m2m[i]);
+ xo_close_instance("mbuf-data");
+ }
+ }
+ if (!first)
+ xo_close_list("mbuf-data");
+ xo_emit("\t\t{:one-extra-mbuf/%ju} {N:one ext mbuf}\n",
+ (uintmax_t)ip6stat.ip6s_mext1);
+ xo_emit("\t\t{:two-or-more-extra-mbufs/%ju} "
+ "{N:/two or more ext mbuf}\n", (uintmax_t)ip6stat.ip6s_mext2m);
+ xo_close_container("mbuf-statistics");
+
+ p(ip6s_exthdrtoolong, "\t{:dropped-header-too-long/%ju} "
+ "{N:/packet%s whose headers are not contiguous}\n");
+ p(ip6s_nogif, "\t{:discard-tunnel-no-gif/%ju} "
+ "{N:/tunneling packet%s that can't find gif}\n");
+ p(ip6s_toomanyhdr, "\t{:dropped-too-many-headers/%ju} "
+ "{N:/packet%s discarded because of too many headers}\n");
+
+ /* for debugging source address selection */
+#define PRINT_SCOPESTAT(s,i) do {\
+ switch(i) { /* XXX hardcoding in each case */\
+ case 1:\
+ p(s, "\t\t{ke:name/interface-locals}{:count/%ju} " \
+ "{N:/interface-local%s}\n"); \
+ break;\
+ case 2:\
+ p(s,"\t\t{ke:name/link-locals}{:count/%ju} " \
+ "{N:/link-local%s}\n"); \
+ break;\
+ case 5:\
+ p(s,"\t\t{ke:name/site-locals}{:count/%ju} " \
+ "{N:/site-local%s}\n");\
+ break;\
+ case 14:\
+ p(s,"\t\t{ke:name/globals}{:count/%ju} " \
+ "{N:/global%s}\n");\
+ break;\
+ default:\
+ xo_emit("\t\t{qke:name/%x}{:count/%ju} " \
+ "addresses scope=%x\n",\
+ i, (uintmax_t)ip6stat.s, i); \
+ }\
+ } while (0);
+
+ xo_open_container("source-address-selection");
+ p(ip6s_sources_none, "\t{:address-selection-failures/%ju} "
+ "{N:/failure%s of source address selection}\n");
+
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
+ if (ip6stat.ip6s_sources_sameif[i]) {
+ if (first) {
+ xo_open_list("outgoing-interface");
+ xo_emit("\tsource addresses on an outgoing "
+ "I/F\n");
+ first = 0;
+ }
+ xo_open_instance("outgoing-interface");
+ PRINT_SCOPESTAT(ip6s_sources_sameif[i], i);
+ xo_close_instance("outgoing-interface");
+ }
+ }
+ if (!first)
+ xo_close_list("outgoing-interface");
+
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
+ if (ip6stat.ip6s_sources_otherif[i]) {
+ if (first) {
+ xo_open_list("non-outgoing-interface");
+ xo_emit("\tsource addresses on a non-outgoing "
+ "I/F\n");
+ first = 0;
+ }
+ xo_open_instance("non-outgoing-interface");
+ PRINT_SCOPESTAT(ip6s_sources_otherif[i], i);
+ xo_close_instance("non-outgoing-interface");
+ }
+ }
+ if (!first)
+ xo_close_list("non-outgoing-interface");
+
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
+ if (ip6stat.ip6s_sources_samescope[i]) {
+ if (first) {
+ xo_open_list("same-source");
+ xo_emit("\tsource addresses of same scope\n");
+ first = 0;
+ }
+ xo_open_instance("same-source");
+ PRINT_SCOPESTAT(ip6s_sources_samescope[i], i);
+ xo_close_instance("same-source");
+ }
+ }
+ if (!first)
+ xo_close_list("same-source");
+
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
+ if (ip6stat.ip6s_sources_otherscope[i]) {
+ if (first) {
+ xo_open_list("different-scope");
+ xo_emit("\tsource addresses of a different "
+ "scope\n");
+ first = 0;
+ }
+ xo_open_instance("different-scope");
+ PRINT_SCOPESTAT(ip6s_sources_otherscope[i], i);
+ xo_close_instance("different-scope");
+ }
+ }
+ if (!first)
+ xo_close_list("different-scope");
+
+ for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) {
+ if (ip6stat.ip6s_sources_deprecated[i]) {
+ if (first) {
+ xo_open_list("deprecated-source");
+ xo_emit("\tdeprecated source addresses\n");
+ first = 0;
+ }
+ xo_open_instance("deprecated-source");
+ PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i);
+ xo_close_instance("deprecated-source");
+ }
+ }
+ if (!first)
+ xo_close_list("deprecated-source");
+
+ for (first = 1, i = 0; i < IP6S_RULESMAX; i++) {
+ if (ip6stat.ip6s_sources_rule[i]) {
+ if (first) {
+ xo_open_list("rules-applied");
+ xo_emit("\t{T:Source addresses selection "
+ "rule applied}:\n");
+ first = 0;
+ }
+ xo_open_instance("rules-applied");
+ xo_emit("\t\t{ke:name/%s}{:count/%ju} {d:name/%s}\n",
+ srcrule_str[i],
+ (uintmax_t)ip6stat.ip6s_sources_rule[i],
+ srcrule_str[i]);
+ xo_close_instance("rules-applied");
+ }
+ }
+ if (!first)
+ xo_close_list("rules-applied");
+
+ xo_close_container("source-address-selection");
+
+#undef p
+#undef p1a
+ xo_close_container(name);
+}
+
+/*
+ * Dump IPv6 per-interface statistics based on RFC 2465.
+ */
+void
+ip6_ifstats(char *ifname)
+{
+ struct in6_ifreq ifr;
+ int s;
+
+#define p(f, m) if (ifr.ifr_ifru.ifru_stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ifr.ifr_ifru.ifru_stat.f, \
+ plural(ifr.ifr_ifru.ifru_stat.f))
+
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ xo_warn("Warning: socket(AF_INET6)");
+ return;
+ }
+
+ strcpy(ifr.ifr_name, ifname);
+ if (ioctl(s, SIOCGIFSTAT_IN6, (char *)&ifr) < 0) {
+ if (errno != EPFNOSUPPORT)
+ xo_warn("Warning: ioctl(SIOCGIFSTAT_IN6)");
+ goto end;
+ }
+
+ xo_emit("{T:/ip6 on %s}:\n", ifr.ifr_name);
+
+ xo_open_instance("ip6-interface-statistics");
+ xo_emit("{ke:name/%s}", ifr.ifr_name);
+
+ p(ifs6_in_receive, "\t{:received-packets/%ju} "
+ "{N:/total input datagram%s}\n");
+ p(ifs6_in_hdrerr, "\t{:dropped-invalid-header/%ju} "
+ "{N:/datagram%s with invalid header received}\n");
+ p(ifs6_in_toobig, "\t{:dropped-mtu-exceeded/%ju} "
+ "{N:/datagram%s exceeded MTU received}\n");
+ p(ifs6_in_noroute, "\t{:dropped-no-route/%ju} "
+ "{N:/datagram%s with no route received}\n");
+ p(ifs6_in_addrerr, "\t{:dropped-invalid-destination/%ju} "
+ "{N:/datagram%s with invalid dst received}\n");
+ p(ifs6_in_protounknown, "\t{:dropped-unknown-protocol/%ju} "
+ "{N:/datagram%s with unknown proto received}\n");
+ p(ifs6_in_truncated, "\t{:dropped-truncated/%ju} "
+ "{N:/truncated datagram%s received}\n");
+ p(ifs6_in_discard, "\t{:dropped-discarded/%ju} "
+ "{N:/input datagram%s discarded}\n");
+ p(ifs6_in_deliver, "\t{:received-valid-packets/%ju} "
+ "{N:/datagram%s delivered to an upper layer protocol}\n");
+ p(ifs6_out_forward, "\t{:sent-forwarded/%ju} "
+ "{N:/datagram%s forwarded to this interface}\n");
+ p(ifs6_out_request, "\t{:sent-packets/%ju} "
+ "{N:/datagram%s sent from an upper layer protocol}\n");
+ p(ifs6_out_discard, "\t{:discard-packets/%ju} "
+ "{N:/total discarded output datagram%s}\n");
+ p(ifs6_out_fragok, "\t{:discard-fragments/%ju} "
+ "{N:/output datagram%s fragmented}\n");
+ p(ifs6_out_fragfail, "\t{:fragments-failed/%ju} "
+ "{N:/output datagram%s failed on fragment}\n");
+ p(ifs6_out_fragcreat, "\t{:fragments-created/%ju} "
+ "{N:/output datagram%s succeeded on fragment}\n");
+ p(ifs6_reass_reqd, "\t{:reassembly-required/%ju} "
+ "{N:/incoming datagram%s fragmented}\n");
+ p(ifs6_reass_ok, "\t{:reassembled-packets/%ju} "
+ "{N:/datagram%s reassembled}\n");
+ p(ifs6_reass_fail, "\t{:reassembly-failed/%ju} "
+ "{N:/datagram%s failed on reassembly}\n");
+ p(ifs6_in_mcast, "\t{:received-multicast/%ju} "
+ "{N:/multicast datagram%s received}\n");
+ p(ifs6_out_mcast, "\t{:sent-multicast/%ju} "
+ "{N:/multicast datagram%s sent}\n");
+
+ end:
+ xo_close_instance("ip6-interface-statistics");
+ close(s);
+
+#undef p
+}
+
+static const char *icmp6names[] = {
+ "#0",
+ "unreach",
+ "packet too big",
+ "time exceed",
+ "parameter problem",
+ "#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",
+ "#31",
+ "#32",
+ "#33",
+ "#34",
+ "#35",
+ "#36",
+ "#37",
+ "#38",
+ "#39",
+ "#40",
+ "#41",
+ "#42",
+ "#43",
+ "#44",
+ "#45",
+ "#46",
+ "#47",
+ "#48",
+ "#49",
+ "#50",
+ "#51",
+ "#52",
+ "#53",
+ "#54",
+ "#55",
+ "#56",
+ "#57",
+ "#58",
+ "#59",
+ "#60",
+ "#61",
+ "#62",
+ "#63",
+ "#64",
+ "#65",
+ "#66",
+ "#67",
+ "#68",
+ "#69",
+ "#70",
+ "#71",
+ "#72",
+ "#73",
+ "#74",
+ "#75",
+ "#76",
+ "#77",
+ "#78",
+ "#79",
+ "#80",
+ "#81",
+ "#82",
+ "#83",
+ "#84",
+ "#85",
+ "#86",
+ "#87",
+ "#88",
+ "#89",
+ "#80",
+ "#91",
+ "#92",
+ "#93",
+ "#94",
+ "#95",
+ "#96",
+ "#97",
+ "#98",
+ "#99",
+ "#100",
+ "#101",
+ "#102",
+ "#103",
+ "#104",
+ "#105",
+ "#106",
+ "#107",
+ "#108",
+ "#109",
+ "#110",
+ "#111",
+ "#112",
+ "#113",
+ "#114",
+ "#115",
+ "#116",
+ "#117",
+ "#118",
+ "#119",
+ "#120",
+ "#121",
+ "#122",
+ "#123",
+ "#124",
+ "#125",
+ "#126",
+ "#127",
+ "echo",
+ "echo reply",
+ "multicast listener query",
+ "MLDv1 listener report",
+ "MLDv1 listener done",
+ "router solicitation",
+ "router advertisement",
+ "neighbor solicitation",
+ "neighbor advertisement",
+ "redirect",
+ "router renumbering",
+ "node information request",
+ "node information reply",
+ "inverse neighbor solicitation",
+ "inverse neighbor advertisement",
+ "MLDv2 listener report",
+ "#144",
+ "#145",
+ "#146",
+ "#147",
+ "#148",
+ "#149",
+ "#150",
+ "#151",
+ "#152",
+ "#153",
+ "#154",
+ "#155",
+ "#156",
+ "#157",
+ "#158",
+ "#159",
+ "#160",
+ "#161",
+ "#162",
+ "#163",
+ "#164",
+ "#165",
+ "#166",
+ "#167",
+ "#168",
+ "#169",
+ "#170",
+ "#171",
+ "#172",
+ "#173",
+ "#174",
+ "#175",
+ "#176",
+ "#177",
+ "#178",
+ "#179",
+ "#180",
+ "#181",
+ "#182",
+ "#183",
+ "#184",
+ "#185",
+ "#186",
+ "#187",
+ "#188",
+ "#189",
+ "#180",
+ "#191",
+ "#192",
+ "#193",
+ "#194",
+ "#195",
+ "#196",
+ "#197",
+ "#198",
+ "#199",
+ "#200",
+ "#201",
+ "#202",
+ "#203",
+ "#204",
+ "#205",
+ "#206",
+ "#207",
+ "#208",
+ "#209",
+ "#210",
+ "#211",
+ "#212",
+ "#213",
+ "#214",
+ "#215",
+ "#216",
+ "#217",
+ "#218",
+ "#219",
+ "#220",
+ "#221",
+ "#222",
+ "#223",
+ "#224",
+ "#225",
+ "#226",
+ "#227",
+ "#228",
+ "#229",
+ "#230",
+ "#231",
+ "#232",
+ "#233",
+ "#234",
+ "#235",
+ "#236",
+ "#237",
+ "#238",
+ "#239",
+ "#240",
+ "#241",
+ "#242",
+ "#243",
+ "#244",
+ "#245",
+ "#246",
+ "#247",
+ "#248",
+ "#249",
+ "#250",
+ "#251",
+ "#252",
+ "#253",
+ "#254",
+ "#255",
+};
+
+/*
+ * Dump ICMP6 statistics.
+ */
+void
+icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct icmp6stat icmp6stat;
+ int i, first;
+
+ if (fetch_stats("net.inet6.icmp6.stats", off, &icmp6stat,
+ sizeof(icmp6stat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+ xo_open_container(name);
+
+#define p(f, m) if (icmp6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)icmp6stat.f, plural(icmp6stat.f))
+#define p_5(f, m) if (icmp6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)icmp6stat.f)
+
+ p(icp6s_error, "\t{:icmp6-calls/%ju} "
+ "{N:/call%s to icmp6_error}\n");
+ p(icp6s_canterror, "\t{:errors-not-generated-from-message/%ju} "
+ "{N:/error%s not generated in response to an icmp6 message}\n");
+ p(icp6s_toofreq, "\t{:errors-discarded-by-rate-limitation/%ju} "
+ "{N:/error%s not generated because of rate limitation}\n");
+#define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0]))
+ for (first = 1, i = 0; i < NELEM; i++)
+ if (icmp6stat.icp6s_outhist[i] != 0) {
+ if (first) {
+ xo_open_list("output-histogram");
+ xo_emit("\t{T:Output histogram}:\n");
+ first = 0;
+ }
+ xo_open_instance("output-histogram");
+ xo_emit("\t\t{k:name/%s}: {:count/%ju}\n",
+ icmp6names[i],
+ (uintmax_t)icmp6stat.icp6s_outhist[i]);
+ xo_close_instance("output-histogram");
+ }
+ if (!first)
+ xo_close_list("output-histogram");
+#undef NELEM
+
+ p(icp6s_badcode, "\t{:dropped-bad-code/%ju} "
+ "{N:/message%s with bad code fields}\n");
+ p(icp6s_tooshort, "\t{:dropped-too-short/%ju} "
+ "{N:/message%s < minimum length}\n");
+ p(icp6s_checksum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/bad checksum%s}\n");
+ p(icp6s_badlen, "\t{:dropped-bad-length/%ju} "
+ "{N:/message%s with bad length}\n");
+#define NELEM (int)(sizeof(icmp6stat.icp6s_inhist)/sizeof(icmp6stat.icp6s_inhist[0]))
+ for (first = 1, i = 0; i < NELEM; i++)
+ if (icmp6stat.icp6s_inhist[i] != 0) {
+ if (first) {
+ xo_open_list("input-histogram");
+ xo_emit("\t{T:Input histogram}:\n");
+ first = 0;
+ }
+ xo_open_instance("input-histogram");
+ xo_emit("\t\t{k:name/%s}: {:count/%ju}\n",
+ icmp6names[i],
+ (uintmax_t)icmp6stat.icp6s_inhist[i]);
+ xo_close_instance("input-histogram");
+ }
+ if (!first)
+ xo_close_list("input-histogram");
+#undef NELEM
+ xo_emit("\t{T:Histogram of error messages to be generated}:\n");
+ xo_open_container("errors");
+ p_5(icp6s_odst_unreach_noroute, "\t\t{:no-route/%ju} "
+ "{N:/no route}\n");
+ p_5(icp6s_odst_unreach_admin, "\t\t{:admin-prohibited/%ju} "
+ "{N:/administratively prohibited}\n");
+ p_5(icp6s_odst_unreach_beyondscope, "\t\t{:beyond-scope/%ju} "
+ "{N:/beyond scope}\n");
+ p_5(icp6s_odst_unreach_addr, "\t\t{:address-unreachable/%ju} "
+ "{N:/address unreachable}\n");
+ p_5(icp6s_odst_unreach_noport, "\t\t{:port-unreachable/%ju} "
+ "{N:/port unreachable}\n");
+ p_5(icp6s_opacket_too_big, "\t\t{:packet-too-big/%ju} "
+ "{N:/packet too big}\n");
+ p_5(icp6s_otime_exceed_transit, "\t\t{:time-exceed-transmit/%ju} "
+ "{N:/time exceed transit}\n");
+ p_5(icp6s_otime_exceed_reassembly, "\t\t{:time-exceed-reassembly/%ju} "
+ "{N:/time exceed reassembly}\n");
+ p_5(icp6s_oparamprob_header, "\t\t{:bad-header/%ju} "
+ "{N:/erroneous header field}\n");
+ p_5(icp6s_oparamprob_nextheader, "\t\t{:bad-next-header/%ju} "
+ "{N:/unrecognized next header}\n");
+ p_5(icp6s_oparamprob_option, "\t\t{:bad-option/%ju} "
+ "{N:/unrecognized option}\n");
+ p_5(icp6s_oredirect, "\t\t{:redirects/%ju} "
+ "{N:/redirect}\n");
+ p_5(icp6s_ounknown, "\t\t{:unknown/%ju} {N:unknown}\n");
+
+ p(icp6s_reflect, "\t{:reflect/%ju} "
+ "{N:/message response%s generated}\n");
+ p(icp6s_nd_toomanyopt, "\t{:too-many-nd-options/%ju} "
+ "{N:/message%s with too many ND options}\n");
+ p(icp6s_nd_badopt, "\t{:bad-nd-options/%ju} "
+ "{N:/message%s with bad ND options}\n");
+ p(icp6s_badns, "\t{:bad-neighbor-solicitation/%ju} "
+ "{N:/bad neighbor solicitation message%s}\n");
+ p(icp6s_badna, "\t{:bad-neighbor-advertisement/%ju} "
+ "{N:/bad neighbor advertisement message%s}\n");
+ p(icp6s_badrs, "\t{:bad-router-solicitation/%ju} "
+ "{N:/bad router solicitation message%s}\n");
+ p(icp6s_badra, "\t{:bad-router-advertisement/%ju} "
+ "{N:/bad router advertisement message%s}\n");
+ p(icp6s_badredirect, "\t{:bad-redirect/%ju} "
+ "{N:/bad redirect message%s}\n");
+ xo_close_container("errors");
+ p(icp6s_pmtuchg, "\t{:path-mtu-changes/%ju} {N:/path MTU change%s}\n");
+#undef p
+#undef p_5
+ xo_close_container(name);
+}
+
+/*
+ * Dump ICMPv6 per-interface statistics based on RFC 2466.
+ */
+void
+icmp6_ifstats(char *ifname)
+{
+ struct in6_ifreq ifr;
+ int s;
+
+#define p(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ifr.ifr_ifru.ifru_icmp6stat.f, \
+ plural(ifr.ifr_ifru.ifru_icmp6stat.f))
+#define p2(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ifr.ifr_ifru.ifru_icmp6stat.f, \
+ pluralies(ifr.ifr_ifru.ifru_icmp6stat.f))
+
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ xo_warn("Warning: socket(AF_INET6)");
+ return;
+ }
+
+ strcpy(ifr.ifr_name, ifname);
+ if (ioctl(s, SIOCGIFSTAT_ICMP6, (char *)&ifr) < 0) {
+ if (errno != EPFNOSUPPORT)
+ xo_warn("Warning: ioctl(SIOCGIFSTAT_ICMP6)");
+ goto end;
+ }
+
+ xo_emit("{T:/icmp6 on %s}:\n", ifr.ifr_name);
+
+ xo_open_instance("icmp6-interface-statistics");
+ xo_emit("{ke:name/%s}", ifr.ifr_name);
+ p(ifs6_in_msg, "\t{:received-packets/%ju} "
+ "{N:/total input message%s}\n");
+ p(ifs6_in_error, "\t{:received-errors/%ju} "
+ "{N:/total input error message%s}\n");
+ p(ifs6_in_dstunreach, "\t{:received-destination-unreachable/%ju} "
+ "{N:/input destination unreachable error%s}\n");
+ p(ifs6_in_adminprohib, "\t{:received-admin-prohibited/%ju} "
+ "{N:/input administratively prohibited error%s}\n");
+ p(ifs6_in_timeexceed, "\t{:received-time-exceeded/%ju} "
+ "{N:/input time exceeded error%s}\n");
+ p(ifs6_in_paramprob, "\t{:received-bad-parameter/%ju} "
+ "{N:/input parameter problem error%s}\n");
+ p(ifs6_in_pkttoobig, "\t{:received-packet-too-big/%ju} "
+ "{N:/input packet too big error%s}\n");
+ p(ifs6_in_echo, "\t{:received-echo-requests/%ju} "
+ "{N:/input echo request%s}\n");
+ p2(ifs6_in_echoreply, "\t{:received-echo-replies/%ju} "
+ "{N:/input echo repl%s}\n");
+ p(ifs6_in_routersolicit, "\t{:received-router-solicitation/%ju} "
+ "{N:/input router solicitation%s}\n");
+ p(ifs6_in_routeradvert, "\t{:received-router-advertisement/%ju} "
+ "{N:/input router advertisement%s}\n");
+ p(ifs6_in_neighborsolicit, "\t{:received-neighbor-solicitation/%ju} "
+ "{N:/input neighbor solicitation%s}\n");
+ p(ifs6_in_neighboradvert, "\t{:received-neighbor-advertisement/%ju} "
+ "{N:/input neighbor advertisement%s}\n");
+ p(ifs6_in_redirect, "\t{received-redirects/%ju} "
+ "{N:/input redirect%s}\n");
+ p2(ifs6_in_mldquery, "\t{:received-mld-queries/%ju} "
+ "{N:/input MLD quer%s}\n");
+ p(ifs6_in_mldreport, "\t{:received-mld-reports/%ju} "
+ "{N:/input MLD report%s}\n");
+ p(ifs6_in_mlddone, "\t{:received-mld-done/%ju} "
+ "{N:/input MLD done%s}\n");
+
+ p(ifs6_out_msg, "\t{:sent-packets/%ju} "
+ "{N:/total output message%s}\n");
+ p(ifs6_out_error, "\t{:sent-errors/%ju} "
+ "{N:/total output error message%s}\n");
+ p(ifs6_out_dstunreach, "\t{:sent-destination-unreachable/%ju} "
+ "{N:/output destination unreachable error%s}\n");
+ p(ifs6_out_adminprohib, "\t{:sent-admin-prohibited/%ju} "
+ "{N:/output administratively prohibited error%s}\n");
+ p(ifs6_out_timeexceed, "\t{:sent-time-exceeded/%ju} "
+ "{N:/output time exceeded error%s}\n");
+ p(ifs6_out_paramprob, "\t{:sent-bad-parameter/%ju} "
+ "{N:/output parameter problem error%s}\n");
+ p(ifs6_out_pkttoobig, "\t{:sent-packet-too-big/%ju} "
+ "{N:/output packet too big error%s}\n");
+ p(ifs6_out_echo, "\t{:sent-echo-requests/%ju} "
+ "{N:/output echo request%s}\n");
+ p2(ifs6_out_echoreply, "\t{:sent-echo-replies/%ju} "
+ "{N:/output echo repl%s}\n");
+ p(ifs6_out_routersolicit, "\t{:sent-router-solicitation/%ju} "
+ "{N:/output router solicitation%s}\n");
+ p(ifs6_out_routeradvert, "\t{:sent-router-advertisement/%ju} "
+ "{N:/output router advertisement%s}\n");
+ p(ifs6_out_neighborsolicit, "\t{:sent-neighbor-solicitation/%ju} "
+ "{N:/output neighbor solicitation%s}\n");
+ p(ifs6_out_neighboradvert, "\t{:sent-neighbor-advertisement/%ju} "
+ "{N:/output neighbor advertisement%s}\n");
+ p(ifs6_out_redirect, "\t{:sent-redirects/%ju} "
+ "{N:/output redirect%s}\n");
+ p2(ifs6_out_mldquery, "\t{:sent-mld-queries/%ju} "
+ "{N:/output MLD quer%s}\n");
+ p(ifs6_out_mldreport, "\t{:sent-mld-reports/%ju} "
+ "{N:/output MLD report%s}\n");
+ p(ifs6_out_mlddone, "\t{:sent-mld-dones/%ju} "
+ "{N:/output MLD done%s}\n");
+
+end:
+ xo_close_instance("icmp6-interface-statistics");
+ close(s);
+#undef p
+}
+
+/*
+ * Dump PIM statistics structure.
+ */
+void
+pim6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct pim6stat pim6stat;
+
+ if (fetch_stats("net.inet6.pim.stats", off, &pim6stat,
+ sizeof(pim6stat), kread) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+ xo_open_container(name);
+
+#define p(f, m) if (pim6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)pim6stat.f, plural(pim6stat.f))
+
+ p(pim6s_rcv_total, "\t{:received-packets/%ju} "
+ "{N:/message%s received}\n");
+ p(pim6s_rcv_tooshort, "\t{:dropped-too-short/%ju} "
+ "{N:/message%s received with too few bytes}\n");
+ p(pim6s_rcv_badsum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/message%s received with bad checksum}\n");
+ p(pim6s_rcv_badversion, "\t{:dropped-bad-version/%ju} "
+ "{N:/message%s received with bad version}\n");
+ p(pim6s_rcv_registers, "\t{:received-registers/%ju} "
+ "{N:/register%s received}\n");
+ p(pim6s_rcv_badregisters, "\t{:received-bad-registers/%ju} "
+ "{N:/bad register%s received}\n");
+ p(pim6s_snd_registers, "\t{:sent-registers/%ju} "
+ "{N:/register%s sent}\n");
+#undef p
+ xo_close_container(name);
+}
+
+/*
+ * Dump raw ip6 statistics structure.
+ */
+void
+rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct rip6stat rip6stat;
+ u_quad_t delivered;
+
+ if (fetch_stats("net.inet6.ip6.rip6stats", off, &rip6stat,
+ sizeof(rip6stat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+ xo_open_container(name);
+
+#define p(f, m) if (rip6stat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)rip6stat.f, plural(rip6stat.f))
+
+ p(rip6s_ipackets, "\t{:received-packets/%ju} "
+ "{N:/message%s received}\n");
+ p(rip6s_isum, "\t{:input-checksum-computation/%ju} "
+ "{N:/checksum calculation%s on inbound}\n");
+ p(rip6s_badsum, "\t{:received-bad-checksum/%ju} "
+ "{N:/message%s with bad checksum}\n");
+ p(rip6s_nosock, "\t{:dropped-no-socket/%ju} "
+ "{N:/message%s dropped due to no socket}\n");
+ p(rip6s_nosockmcast, "\t{:dropped-multicast-no-socket/%ju} "
+ "{N:/multicast message%s dropped due to no socket}\n");
+ p(rip6s_fullsock, "\t{:dropped-full-socket-buffer/%ju} "
+ "{N:/message%s dropped due to full socket buffers}\n");
+ delivered = rip6stat.rip6s_ipackets -
+ rip6stat.rip6s_badsum -
+ rip6stat.rip6s_nosock -
+ rip6stat.rip6s_nosockmcast -
+ rip6stat.rip6s_fullsock;
+ if (delivered || sflag <= 1)
+ xo_emit("\t{:delivered-packets/%ju} {N:/delivered}\n",
+ (uintmax_t)delivered);
+ p(rip6s_opackets, "\t{:sent-packets/%ju} "
+ "{N:/datagram%s output}\n");
+#undef p
+ xo_close_container(name);
+}
+
+/*
+ * Pretty print an Internet address (net address + port).
+ * Take numeric_addr and numeric_port into consideration.
+ */
+#define GETSERVBYPORT6(port, proto, ret)\
+{\
+ if (strcmp((proto), "tcp6") == 0)\
+ (ret) = getservbyport((int)(port), "tcp");\
+ else if (strcmp((proto), "udp6") == 0)\
+ (ret) = getservbyport((int)(port), "udp");\
+ else\
+ (ret) = getservbyport((int)(port), (proto));\
+};
+
+void
+inet6print(const char *container, struct in6_addr *in6, int port,
+ const char *proto, int numeric)
+{
+ struct servent *sp = 0;
+ char line[80], *cp;
+ int width;
+
+ if (container)
+ xo_open_container(container);
+
+ sprintf(line, "%.*s.", Wflag ? 39 : (Aflag && !numeric) ? 12 : 16,
+ inet6name(in6));
+ cp = strchr(line, '\0');
+ if (!numeric && port)
+ GETSERVBYPORT6(port, proto, sp);
+ if (sp || port == 0)
+ sprintf(cp, "%.15s", sp ? sp->s_name : "*");
+ else
+ sprintf(cp, "%d", ntohs((u_short)port));
+ width = Wflag ? 45 : Aflag ? 18 : 22;
+
+ xo_emit("{d:target/%-*.*s} ", width, width, line);
+
+ int alen = cp - line - 1, plen = strlen(cp) - 1;
+ xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen,
+ plen, cp);
+
+ if (container)
+ xo_close_container(container);
+}
+
+/*
+ * Construct an Internet address representation.
+ * If the numeric_addr has been supplied, give
+ * numeric value, otherwise try for symbolic name.
+ */
+
+char *
+inet6name(struct in6_addr *in6p)
+{
+ struct sockaddr_in6 sin6;
+ char hbuf[NI_MAXHOST], *cp;
+ static char line[50];
+ static char domain[MAXHOSTNAMELEN];
+ static int first = 1;
+ int flags, error;
+
+ if (IN6_IS_ADDR_UNSPECIFIED(in6p)) {
+ strcpy(line, "*");
+ return (line);
+ }
+ if (first && !numeric_addr) {
+ first = 0;
+ if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+ (cp = strchr(domain, '.')))
+ (void) strcpy(domain, cp + 1);
+ else
+ domain[0] = 0;
+ }
+ memset(&sin6, 0, sizeof(sin6));
+ memcpy(&sin6.sin6_addr, in6p, sizeof(*in6p));
+ sin6.sin6_family = AF_INET6;
+ /* XXX: in6p.s6_addr[2] can contain scopeid. */
+ in6_fillscopeid(&sin6);
+ flags = (numeric_addr) ? NI_NUMERICHOST : 0;
+ error = getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), hbuf,
+ sizeof(hbuf), NULL, 0, flags);
+ if (error == 0) {
+ if ((flags & NI_NUMERICHOST) == 0 &&
+ (cp = strchr(hbuf, '.')) &&
+ !strcmp(cp + 1, domain))
+ *cp = 0;
+ strcpy(line, hbuf);
+ } else {
+ /* XXX: this should not happen. */
+ sprintf(line, "%s",
+ inet_ntop(AF_INET6, (void *)&sin6.sin6_addr, ntop_buf,
+ sizeof(ntop_buf)));
+ }
+ return (line);
+}
+#endif /*INET6*/
diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c
new file mode 100644
index 0000000..1347a93
--- /dev/null
+++ b/usr.bin/netstat/ipsec.c
@@ -0,0 +1,455 @@
+/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
+
+/*-
+ * Copyright (c) 2005 NTT Multimedia Communications Laboratories, 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.
+ */
+/*-
+ * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+/*-
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+#include <netinet/in.h>
+
+#ifdef IPSEC
+#include <netipsec/ipsec.h>
+#include <netipsec/ah_var.h>
+#include <netipsec/esp_var.h>
+#include <netipsec/ipcomp_var.h>
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+#ifdef IPSEC
+struct val2str {
+ int val;
+ const char *str;
+};
+
+static struct val2str ipsec_ahnames[] = {
+ { SADB_AALG_NONE, "none", },
+ { SADB_AALG_MD5HMAC, "hmac-md5", },
+ { SADB_AALG_SHA1HMAC, "hmac-sha1", },
+ { SADB_X_AALG_MD5, "md5", },
+ { SADB_X_AALG_SHA, "sha", },
+ { SADB_X_AALG_NULL, "null", },
+#ifdef SADB_X_AALG_SHA2_256
+ { SADB_X_AALG_SHA2_256, "hmac-sha2-256", },
+#endif
+#ifdef SADB_X_AALG_SHA2_384
+ { SADB_X_AALG_SHA2_384, "hmac-sha2-384", },
+#endif
+#ifdef SADB_X_AALG_SHA2_512
+ { SADB_X_AALG_SHA2_512, "hmac-sha2-512", },
+#endif
+#ifdef SADB_X_AALG_RIPEMD160HMAC
+ { SADB_X_AALG_RIPEMD160HMAC, "hmac-ripemd160", },
+#endif
+#ifdef SADB_X_AALG_AES_XCBC_MAC
+ { SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", },
+#endif
+ { -1, NULL },
+};
+
+static struct val2str ipsec_espnames[] = {
+ { SADB_EALG_NONE, "none", },
+ { SADB_EALG_DESCBC, "des-cbc", },
+ { SADB_EALG_3DESCBC, "3des-cbc", },
+ { SADB_EALG_NULL, "null", },
+ { SADB_X_EALG_CAST128CBC, "cast128-cbc", },
+ { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", },
+#ifdef SADB_X_EALG_RIJNDAELCBC
+ { SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", },
+#endif
+#ifdef SADB_X_EALG_AESCTR
+ { SADB_X_EALG_AESCTR, "aes-ctr", },
+#endif
+#ifdef SADB_X_EALG_AESGCM16
+ { SADB_X_EALG_AESGCM16, "aes-gcm-16", },
+#endif
+ { -1, NULL },
+};
+
+static struct val2str ipsec_compnames[] = {
+ { SADB_X_CALG_NONE, "none", },
+ { SADB_X_CALG_OUI, "oui", },
+ { SADB_X_CALG_DEFLATE, "deflate", },
+ { SADB_X_CALG_LZS, "lzs", },
+ { -1, NULL },
+};
+
+static void print_ipsecstats(const struct ipsecstat *ipsecstat);
+
+static void
+print_ipsecstats(const struct ipsecstat *ipsecstat)
+{
+ xo_open_container("ipsec-statistics");
+
+#define p(f, m) if (ipsecstat->f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
+
+ p(ips_in_polvio, "\t{:dropped-policy-violation/%ju} "
+ "{N:/inbound packet%s violated process security policy}\n");
+ p(ips_in_nomem, "\t{:dropped-no-memory/%ju} "
+ "{N:/inbound packet%s failed due to insufficient memory}\n");
+ p(ips_in_inval, "\t{:dropped-invalid/%ju} "
+ "{N:/invalid inbound packet%s}\n");
+ p(ips_out_polvio, "\t{:discarded-policy-violation/%ju} "
+ "{N:/outbound packet%s violated process security policy}\n");
+ p(ips_out_nosa, "\t{:discarded-no-sa/%ju} "
+ "{N:/outbound packet%s with no SA available}\n");
+ p(ips_out_nomem, "\t{:discarded-no-memory/%ju} "
+ "{N:/outbound packet%s failed due to insufficient memory}\n");
+ p(ips_out_noroute, "\t{:discarded-no-route/%ju} "
+ "{N:/outbound packet%s with no route available}\n");
+ p(ips_out_inval, "\t{:discarded-invalid/%ju} "
+ "{N:/invalid outbound packet%s}\n");
+ p(ips_out_bundlesa, "\t{:send-bundled-sa/%ju} "
+ "{N:/outbound packet%s with bundled SAs}\n");
+ p(ips_mbcoalesced, "\t{:mbufs-coalesced-during-clone/%ju} "
+ "{N:/mbuf%s coalesced during clone}\n");
+ p(ips_clcoalesced, "\t{:clusters-coalesced-during-clone/%ju} "
+ "{N:/cluster%s coalesced during clone}\n");
+ p(ips_clcopied, "\t{:clusters-copied-during-clone/%ju} "
+ "{N:/cluster%s copied during clone}\n");
+ p(ips_mbinserted, "\t{:mbufs-inserted/%ju} "
+ "{N:/mbuf%s inserted during makespace}\n");
+#undef p
+ xo_close_container("ipsec-statistics");
+}
+
+void
+ipsec_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct ipsecstat ipsecstat;
+
+ if (strcmp(name, "ipsec6") == 0) {
+ if (fetch_stats("net.inet6.ipsec6.ipsecstats", off,&ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ } else {
+ if (fetch_stats("net.inet.ipsec.ipsecstats", off, &ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ }
+
+ xo_emit("{T:/%s}:\n", name);
+
+ print_ipsecstats(&ipsecstat);
+}
+
+
+static void print_ahstats(const struct ahstat *ahstat);
+static void print_espstats(const struct espstat *espstat);
+static void print_ipcompstats(const struct ipcompstat *ipcompstat);
+
+/*
+ * Dump IPSEC statistics structure.
+ */
+static void
+ipsec_hist_new(const uint64_t *hist, size_t histmax,
+ const struct val2str *name, const char *title, const char *cname)
+{
+ int first;
+ size_t proto;
+ const struct val2str *p;
+
+ first = 1;
+ for (proto = 0; proto < histmax; proto++) {
+ if (hist[proto] <= 0)
+ continue;
+ if (first) {
+ xo_open_list(cname);
+ xo_emit("\t{T:/%s histogram}:\n", title);
+ first = 0;
+ }
+ xo_open_instance(cname);
+ for (p = name; p && p->str; p++) {
+ if (p->val == (int)proto)
+ break;
+ }
+ if (p && p->str) {
+ xo_emit("\t\t{k:name}: {:count/%ju}\n", p->str,
+ (uintmax_t)hist[proto]);
+ } else {
+ xo_emit("\t\t#{k:name/%lu}: {:count/%ju}\n",
+ (unsigned long)proto, (uintmax_t)hist[proto]);
+ }
+ xo_close_instance(cname);
+ }
+ if (!first)
+ xo_close_list(cname);
+}
+
+static void
+print_ahstats(const struct ahstat *ahstat)
+{
+ xo_open_container("ah-statictics");
+
+#define p(f, n, m) if (ahstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)ahstat->f, plural(ahstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c))
+
+ p(ahs_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(ahs_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(ahs_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(ahs_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(ahs_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(ahs_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(ahs_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(ahs_badauth, "dropped-bad-auth",
+ "packet%s dropped; bad authentication detected");
+ p(ahs_badauthl, "dropped-bad-auth-level",
+ "packet%s dropped; bad authentication length");
+ p(ahs_replay, "possile-replay-detected",
+ "possible replay packet%s detected");
+ p(ahs_input, "received-packets", "packet%s in");
+ p(ahs_output, "send-packets", "packet%s out");
+ p(ahs_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(ahs_ibytes, "received-bytes", "byte%s in");
+ p(ahs_obytes, "send-bytes", "byte%s out");
+ p(ahs_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(ahs_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(ahs_crypto, "crypto-failures", "crypto processing failure%s");
+ p(ahs_tunnel, "tunnel-failures", "tunnel sanity check failure%s");
+ hist(ahstat->ahs_hist, ipsec_ahnames,
+ "AH output", "ah-output-histogram");
+
+#undef p
+#undef hist
+ xo_close_container("ah-statictics");
+}
+
+void
+ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
+{
+ struct ahstat ahstat;
+
+ if (fetch_stats("net.inet.ah.stats", off, &ahstat,
+ sizeof(ahstat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+
+ print_ahstats(&ahstat);
+}
+
+static void
+print_espstats(const struct espstat *espstat)
+{
+ xo_open_container("esp-statictics");
+#define p(f, n, m) if (espstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)espstat->f, plural(espstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c));
+
+ p(esps_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(esps_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(esps_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(esps_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(esps_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(esps_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(esps_badilen, "dropped-bad-length", "packet%s dropped; bad ilen");
+ p(esps_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(esps_badenc, "dropped-bad-crypto",
+ "packet%s dropped; bad encryption detected");
+ p(esps_badauth, "dropped-bad-auth",
+ "packet%s dropped; bad authentication detected");
+ p(esps_replay, "possible-replay-detected",
+ "possible replay packet%s detected");
+ p(esps_input, "received-packets", "packet%s in");
+ p(esps_output, "sent-packets", "packet%s out");
+ p(esps_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(esps_ibytes, "receieve-bytes", "byte%s in");
+ p(esps_obytes, "sent-bytes", "byte%s out");
+ p(esps_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(esps_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(esps_crypto, "crypto-failures", "crypto processing failure%s");
+ p(esps_tunnel, "tunnel-failures", "tunnel sanity check failure%s");
+ hist(espstat->esps_hist, ipsec_espnames,
+ "ESP output", "esp-output-histogram");
+
+#undef p
+#undef hist
+ xo_close_container("esp-statictics");
+}
+
+void
+esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
+{
+ struct espstat espstat;
+
+ if (fetch_stats("net.inet.esp.stats", off, &espstat,
+ sizeof(espstat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+
+ print_espstats(&espstat);
+}
+
+static void
+print_ipcompstats(const struct ipcompstat *ipcompstat)
+{
+ xo_open_container("ipcomp-statictics");
+
+#define p(f, n, m) if (ipcompstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c));
+
+ p(ipcomps_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(ipcomps_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(ipcomps_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(ipcomps_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(ipcomps_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(ipcomps_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(ipcomps_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(ipcomps_input, "receieve-packets", "packet%s in");
+ p(ipcomps_output, "sent-packets", "packet%s out");
+ p(ipcomps_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(ipcomps_ibytes, "receieved-bytes", "byte%s in");
+ p(ipcomps_obytes, "sent-bytes", "byte%s out");
+ p(ipcomps_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(ipcomps_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(ipcomps_crypto, "crypto-failure", "crypto processing failure%s");
+ hist(ipcompstat->ipcomps_hist, ipsec_compnames,
+ "COMP output", "comp-output-histogram");
+ p(ipcomps_threshold, "sent-uncompressed-small-packets",
+ "packet%s sent uncompressed; size < compr. algo. threshold");
+ p(ipcomps_uncompr, "sent-uncompressed-useless-packets",
+ "packet%s sent uncompressed; compression was useless");
+
+#undef p
+#undef hist
+ xo_close_container("ipcomp-statictics");
+}
+
+void
+ipcomp_stats(u_long off, const char *name, int family __unused,
+ int proto __unused)
+{
+ struct ipcompstat ipcompstat;
+
+ if (fetch_stats("net.inet.ipcomp.stats", off, &ipcompstat,
+ sizeof(ipcompstat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:/%s}:\n", name);
+
+ print_ipcompstats(&ipcompstat);
+}
+
+#endif /*IPSEC*/
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
new file mode 100644
index 0000000..4e4428d
--- /dev/null
+++ b/usr.bin/netstat/main.c
@@ -0,0 +1,874 @@
+/*-
+ * Copyright (c) 1983, 1988, 1993
+ * 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 char const copyright[] =
+"@(#) Copyright (c) 1983, 1988, 1993\n\
+ Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+
+#ifdef NETGRAPH
+#include <netgraph/ng_socket.h>
+#endif
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <kvm.h>
+#include <limits.h>
+#include <netdb.h>
+#include <nlist.h>
+#include <paths.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include "netstat.h"
+#include "nl_defs.h"
+#include <libxo/xo.h>
+
+static struct protox {
+ int pr_index; /* index into nlist of cb head */
+ int pr_sindex; /* index into nlist of stat block */
+ u_char pr_wanted; /* 1 if wanted, 0 otherwise */
+ void (*pr_cblocks)(u_long, const char *, int, int);
+ /* control blocks printing routine */
+ void (*pr_stats)(u_long, const char *, int, int);
+ /* statistics printing routine */
+ void (*pr_istats)(char *); /* per/if statistics printing routine */
+ const char *pr_name; /* well-known name */
+ int pr_usesysctl; /* non-zero if we use sysctl, not kvm */
+ int pr_protocol;
+} protox[] = {
+ { N_TCBINFO, N_TCPSTAT, 1, protopr,
+ tcp_stats, NULL, "tcp", 1, IPPROTO_TCP },
+ { N_UDBINFO, N_UDPSTAT, 1, protopr,
+ udp_stats, NULL, "udp", 1, IPPROTO_UDP },
+#ifdef SCTP
+ { -1, N_SCTPSTAT, 1, sctp_protopr,
+ sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP },
+#endif
+#ifdef SDP
+ { -1, -1, 1, protopr,
+ NULL, NULL, "sdp", 1, IPPROTO_TCP },
+#endif
+ { N_DIVCBINFO, -1, 1, protopr,
+ NULL, NULL, "divert", 1, IPPROTO_DIVERT },
+ { N_RIPCBINFO, N_IPSTAT, 1, protopr,
+ ip_stats, NULL, "ip", 1, IPPROTO_RAW },
+ { N_RIPCBINFO, N_ICMPSTAT, 1, protopr,
+ icmp_stats, NULL, "icmp", 1, IPPROTO_ICMP },
+ { N_RIPCBINFO, N_IGMPSTAT, 1, protopr,
+ igmp_stats, NULL, "igmp", 1, IPPROTO_IGMP },
+#ifdef IPSEC
+ { -1, N_IPSEC4STAT, 1, NULL, /* keep as compat */
+ ipsec_stats, NULL, "ipsec", 1, 0},
+ { -1, N_AHSTAT, 1, NULL,
+ ah_stats, NULL, "ah", 1, 0},
+ { -1, N_ESPSTAT, 1, NULL,
+ esp_stats, NULL, "esp", 1, 0},
+ { -1, N_IPCOMPSTAT, 1, NULL,
+ ipcomp_stats, NULL, "ipcomp", 1, 0},
+#endif
+ { N_RIPCBINFO, N_PIMSTAT, 1, protopr,
+ pim_stats, NULL, "pim", 1, IPPROTO_PIM },
+ { -1, N_CARPSTATS, 1, NULL,
+ carp_stats, NULL, "carp", 1, 0 },
+#ifdef PF
+ { -1, N_PFSYNCSTATS, 1, NULL,
+ pfsync_stats, NULL, "pfsync", 1, 0 },
+#endif
+ { -1, N_ARPSTAT, 1, NULL,
+ arp_stats, NULL, "arp", 1, 0 },
+ { -1, -1, 0, NULL,
+ NULL, NULL, NULL, 0, 0 }
+};
+
+#ifdef INET6
+static struct protox ip6protox[] = {
+ { N_TCBINFO, N_TCPSTAT, 1, protopr,
+ tcp_stats, NULL, "tcp", 1, IPPROTO_TCP },
+ { N_UDBINFO, N_UDPSTAT, 1, protopr,
+ udp_stats, NULL, "udp", 1, IPPROTO_UDP },
+ { N_RIPCBINFO, N_IP6STAT, 1, protopr,
+ ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW },
+ { N_RIPCBINFO, N_ICMP6STAT, 1, protopr,
+ icmp6_stats, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 },
+#ifdef SDP
+ { -1, -1, 1, protopr,
+ NULL, NULL, "sdp", 1, IPPROTO_TCP },
+#endif
+#ifdef IPSEC
+ { -1, N_IPSEC6STAT, 1, NULL,
+ ipsec_stats, NULL, "ipsec6", 1, 0 },
+#endif
+#ifdef notyet
+ { -1, N_PIM6STAT, 1, NULL,
+ pim6_stats, NULL, "pim6", 1, 0 },
+#endif
+ { -1, N_RIP6STAT, 1, NULL,
+ rip6_stats, NULL, "rip6", 1, 0 },
+ { -1, -1, 0, NULL,
+ NULL, NULL, NULL, 0, 0 }
+};
+#endif /*INET6*/
+
+#ifdef IPSEC
+static struct protox pfkeyprotox[] = {
+ { -1, N_PFKEYSTAT, 1, NULL,
+ pfkey_stats, NULL, "pfkey", 0, 0 },
+ { -1, -1, 0, NULL,
+ NULL, NULL, NULL, 0, 0 }
+};
+#endif
+
+#ifdef NETGRAPH
+static struct protox netgraphprotox[] = {
+ { N_NGSOCKLIST, -1, 1, netgraphprotopr,
+ NULL, NULL, "ctrl", 0, 0 },
+ { N_NGSOCKLIST, -1, 1, netgraphprotopr,
+ NULL, NULL, "data", 0, 0 },
+ { -1, -1, 0, NULL,
+ NULL, NULL, NULL, 0, 0 }
+};
+#endif
+
+static struct protox *protoprotox[] = {
+ protox,
+#ifdef INET6
+ ip6protox,
+#endif
+#ifdef IPSEC
+ pfkeyprotox,
+#endif
+ NULL };
+
+static void printproto(struct protox *, const char *, bool *);
+static void usage(void);
+static struct protox *name2protox(const char *);
+static struct protox *knownname(const char *);
+
+static int kresolve_list(struct nlist *_nl);
+
+static kvm_t *kvmd;
+static char *nlistf = NULL, *memf = NULL;
+
+int Aflag; /* show addresses of protocol control block */
+int aflag; /* show all sockets (including servers) */
+static int Bflag; /* show information about bpf consumers */
+int bflag; /* show i/f total bytes in/out */
+int dflag; /* show i/f dropped packets */
+int gflag; /* show group (multicast) routing or stats */
+int hflag; /* show counters in human readable format */
+int iflag; /* show interfaces */
+int Lflag; /* show size of listen queues */
+int mflag; /* show memory stats */
+int noutputs = 0; /* how much outputs before we exit */
+int numeric_addr; /* show addresses numerically */
+int numeric_port; /* show ports numerically */
+static int pflag; /* show given protocol */
+static 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 */
+int xflag; /* extra information, includes all socket buffer info */
+int zflag; /* zero stats */
+
+int interval; /* repeat interval for i/f stats */
+
+char *interface; /* desired i/f for stats, or NULL for all i/fs */
+int unit; /* unit number for above */
+
+static int af; /* address family */
+int live; /* true if we are examining a live system */
+
+int
+main(int argc, char *argv[])
+{
+ struct protox *tp = NULL; /* for printing cblocks & stats */
+ int ch;
+ int fib = -1;
+ char *endptr;
+ bool first = true;
+
+ af = AF_UNSPEC;
+
+ argc = xo_parse_args(argc, argv);
+ if (argc < 0)
+ exit(EXIT_FAILURE);
+
+ while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:RrSTsuWw:xz"))
+ != -1)
+ switch(ch) {
+ case '4':
+#ifdef INET
+ af = AF_INET;
+#else
+ errx(1, "IPv4 support is not compiled in");
+#endif
+ break;
+ case '6':
+#ifdef INET6
+ af = AF_INET6;
+#else
+ errx(1, "IPv6 support is not compiled in");
+#endif
+ break;
+ case 'A':
+ Aflag = 1;
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 'B':
+ Bflag = 1;
+ break;
+ case 'b':
+ bflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'F':
+ fib = strtol(optarg, &endptr, 0);
+ if (*endptr != '\0' ||
+ (fib == 0 && (errno == EINVAL || errno == ERANGE)))
+ xo_errx(1, "%s: invalid fib", optarg);
+ break;
+ case 'f':
+ if (strcmp(optarg, "inet") == 0)
+ af = AF_INET;
+#ifdef INET6
+ else if (strcmp(optarg, "inet6") == 0)
+ af = AF_INET6;
+#endif
+#ifdef IPSEC
+ else if (strcmp(optarg, "pfkey") == 0)
+ af = PF_KEY;
+#endif
+ else if (strcmp(optarg, "unix") == 0 ||
+ strcmp(optarg, "local") == 0)
+ af = AF_UNIX;
+#ifdef NETGRAPH
+ else if (strcmp(optarg, "ng") == 0
+ || strcmp(optarg, "netgraph") == 0)
+ af = AF_NETGRAPH;
+#endif
+ else if (strcmp(optarg, "link") == 0)
+ af = AF_LINK;
+ else {
+ xo_errx(1, "%s: unknown address family",
+ optarg);
+ }
+ break;
+ case 'g':
+ gflag = 1;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'I': {
+ char *cp;
+
+ iflag = 1;
+ for (cp = interface = optarg; isalpha(*cp); cp++)
+ continue;
+ unit = atoi(cp);
+ break;
+ }
+ case 'i':
+ iflag = 1;
+ break;
+ case 'L':
+ Lflag = 1;
+ break;
+ case 'M':
+ memf = optarg;
+ break;
+ case 'm':
+ mflag = 1;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'n':
+ numeric_addr = numeric_port = 1;
+ break;
+ case 'p':
+ if ((tp = name2protox(optarg)) == NULL) {
+ xo_errx(1, "%s: unknown or uninstrumented "
+ "protocol", optarg);
+ }
+ pflag = 1;
+ break;
+ case 'Q':
+ Qflag = 1;
+ break;
+ case 'q':
+ noutputs = atoi(optarg);
+ if (noutputs != 0)
+ noutputs++;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 'R':
+ Rflag = 1;
+ break;
+ case 's':
+ ++sflag;
+ break;
+ case 'S':
+ numeric_addr = 1;
+ break;
+ case 'u':
+ af = AF_UNIX;
+ break;
+ case 'W':
+ case 'l':
+ Wflag = 1;
+ break;
+ case 'w':
+ interval = atoi(optarg);
+ iflag = 1;
+ break;
+ case 'T':
+ Tflag = 1;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case 'z':
+ zflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+#define BACKWARD_COMPATIBILITY
+#ifdef BACKWARD_COMPATIBILITY
+ if (*argv) {
+ if (isdigit(**argv)) {
+ interval = atoi(*argv);
+ if (interval <= 0)
+ usage();
+ ++argv;
+ iflag = 1;
+ }
+ if (*argv) {
+ nlistf = *argv;
+ if (*++argv)
+ memf = *argv;
+ }
+ }
+#endif
+
+ /*
+ * Discard setgid privileges if not the running kernel so that bad
+ * guys can't print interesting stuff from kernel memory.
+ */
+ live = (nlistf == NULL && memf == NULL);
+ if (!live) {
+ if (setgid(getgid()) != 0)
+ xo_err(-1, "setgid");
+ }
+
+ if (xflag && Tflag)
+ xo_errx(1, "-x and -T are incompatible, pick one.");
+
+ if (Bflag) {
+ if (!live)
+ usage();
+ bpf_stats(interface);
+ xo_finish();
+ exit(0);
+ }
+ if (mflag) {
+ if (!live) {
+ if (kread(0, NULL, 0) == 0)
+ mbpr(kvmd, nl[N_SFSTAT].n_value);
+ } else
+ mbpr(NULL, 0);
+ xo_finish();
+ exit(0);
+ }
+ if (Qflag) {
+ if (!live) {
+ if (kread(0, NULL, 0) == 0)
+ netisr_stats();
+ } else
+ netisr_stats();
+ xo_finish();
+ exit(0);
+ }
+#if 0
+ /*
+ * Keep file descriptors open to avoid overhead
+ * of open/close on each call to get* routines.
+ */
+ sethostent(1);
+ setnetent(1);
+#else
+ /*
+ * This does not make sense any more with DNS being default over
+ * the files. Doing a setXXXXent(1) causes a tcp connection to be
+ * used for the queries, which is slower.
+ */
+#endif
+ if (iflag && !sflag) {
+ xo_open_container("statistics");
+ intpr(NULL, af);
+ xo_close_container("statistics");
+ xo_finish();
+ exit(0);
+ }
+ if (rflag) {
+ xo_open_container("statistics");
+ if (sflag) {
+ rt_stats();
+ flowtable_stats();
+ } else
+ routepr(fib, af);
+ xo_close_container("statistics");
+ xo_finish();
+ exit(0);
+ }
+
+ if (gflag) {
+ xo_open_container("statistics");
+ if (sflag) {
+ if (af == AF_INET || af == AF_UNSPEC)
+ mrt_stats();
+#ifdef INET6
+ if (af == AF_INET6 || af == AF_UNSPEC)
+ mrt6_stats();
+#endif
+ } else {
+ if (af == AF_INET || af == AF_UNSPEC)
+ mroutepr();
+#ifdef INET6
+ if (af == AF_INET6 || af == AF_UNSPEC)
+ mroute6pr();
+#endif
+ }
+ xo_close_container("statistics");
+ xo_finish();
+ exit(0);
+ }
+
+ /* Load all necessary kvm symbols */
+ kresolve_list(nl);
+
+ if (tp) {
+ xo_open_container("statistics");
+ printproto(tp, tp->pr_name, &first);
+ if (!first)
+ xo_close_list("socket");
+ xo_close_container("statistics");
+ xo_finish();
+ exit(0);
+ }
+
+ xo_open_container("statistics");
+ if (af == AF_INET || af == AF_UNSPEC)
+ for (tp = protox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name, &first);
+#ifdef INET6
+ if (af == AF_INET6 || af == AF_UNSPEC)
+ for (tp = ip6protox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name, &first);
+#endif /*INET6*/
+#ifdef IPSEC
+ if (af == PF_KEY || af == AF_UNSPEC)
+ for (tp = pfkeyprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name, &first);
+#endif /*IPSEC*/
+#ifdef NETGRAPH
+ if (af == AF_NETGRAPH || af == AF_UNSPEC)
+ for (tp = netgraphprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name, &first);
+#endif /* NETGRAPH */
+ if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag)
+ unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value,
+ nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value,
+ nl[N_UNP_SPHEAD].n_value, &first);
+
+ if (!first)
+ xo_close_list("socket");
+ xo_close_container("statistics");
+ xo_finish();
+ exit(0);
+}
+
+static int
+fetch_stats_internal(const char *sysctlname, u_long off, void *stats,
+ size_t len, kreadfn_t kreadfn, int zero)
+{
+ int error;
+
+ if (live) {
+ memset(stats, 0, len);
+ if (zero)
+ error = sysctlbyname(sysctlname, NULL, NULL, stats,
+ len);
+ else
+ error = sysctlbyname(sysctlname, stats, &len, NULL, 0);
+ if (error == -1 && errno != ENOENT)
+ xo_warn("sysctl %s", sysctlname);
+ } else {
+ if (off == 0)
+ return (1);
+ error = kreadfn(off, stats, len);
+ }
+ return (error);
+}
+
+int
+fetch_stats(const char *sysctlname, u_long off, void *stats,
+ size_t len, kreadfn_t kreadfn)
+{
+
+ return (fetch_stats_internal(sysctlname, off, stats, len, kreadfn,
+ zflag));
+}
+
+int
+fetch_stats_ro(const char *sysctlname, u_long off, void *stats,
+ size_t len, kreadfn_t kreadfn)
+{
+
+ return (fetch_stats_internal(sysctlname, off, stats, len, kreadfn, 0));
+}
+
+/*
+ * Print out protocol statistics or control blocks (per sflag).
+ * If the interface was not specifically requested, and the symbol
+ * is not in the namelist, ignore this one.
+ */
+static void
+printproto(struct protox *tp, const char *name, bool *first)
+{
+ void (*pr)(u_long, const char *, int, int);
+ u_long off;
+ bool doingdblocks = false;
+
+ if (sflag) {
+ if (iflag) {
+ if (tp->pr_istats)
+ intpr(tp->pr_istats, af);
+ else if (pflag)
+ xo_message("%s: no per-interface stats routine",
+ tp->pr_name);
+ return;
+ } else {
+ pr = tp->pr_stats;
+ if (!pr) {
+ if (pflag)
+ xo_message("%s: no stats routine",
+ tp->pr_name);
+ return;
+ }
+ if (tp->pr_usesysctl && live)
+ off = 0;
+ else if (tp->pr_sindex < 0) {
+ if (pflag)
+ xo_message("%s: stats routine doesn't "
+ "work on cores", tp->pr_name);
+ return;
+ } else
+ off = nl[tp->pr_sindex].n_value;
+ }
+ } else {
+ doingdblocks = true;
+ pr = tp->pr_cblocks;
+ if (!pr) {
+ if (pflag)
+ xo_message("%s: no PCB routine", tp->pr_name);
+ return;
+ }
+ if (tp->pr_usesysctl && live)
+ off = 0;
+ else if (tp->pr_index < 0) {
+ if (pflag)
+ xo_message("%s: PCB routine doesn't work on "
+ "cores", tp->pr_name);
+ return;
+ } else
+ off = nl[tp->pr_index].n_value;
+ }
+ if (pr != NULL && (off || (live && tp->pr_usesysctl) ||
+ af != AF_UNSPEC)) {
+ if (doingdblocks && *first) {
+ xo_open_list("socket");
+ *first = false;
+ }
+
+ (*pr)(off, name, af, tp->pr_protocol);
+ }
+}
+
+static int
+kvmd_init(void)
+{
+ char errbuf[_POSIX2_LINE_MAX];
+
+ if (kvmd != NULL)
+ return (0);
+
+ kvmd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
+ if (setgid(getgid()) != 0)
+ xo_err(-1, "setgid");
+
+ if (kvmd == NULL) {
+ xo_warnx("kvm not available: %s", errbuf);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Resolve symbol list, return 0 on success.
+ */
+static int
+kresolve_list(struct nlist *_nl)
+{
+
+ if ((kvmd == NULL) && (kvmd_init() != 0))
+ return (-1);
+
+ if (_nl[0].n_type != 0)
+ return (0);
+
+ if (kvm_nlist(kvmd, _nl) < 0) {
+ if (nlistf)
+ xo_errx(1, "%s: kvm_nlist: %s", nlistf,
+ kvm_geterr(kvmd));
+ else
+ xo_errx(1, "kvm_nlist: %s", kvm_geterr(kvmd));
+ }
+
+ return (0);
+}
+
+/*
+ * Wrapper of kvm_dpcpu_setcpu().
+ */
+void
+kset_dpcpu(u_int cpuid)
+{
+
+ if ((kvmd == NULL) && (kvmd_init() != 0))
+ xo_errx(-1, "%s: kvm is not available", __func__);
+
+ if (kvm_dpcpu_setcpu(kvmd, cpuid) < 0)
+ xo_errx(-1, "%s: kvm_dpcpu_setcpu(%u): %s", __func__,
+ cpuid, kvm_geterr(kvmd));
+ return;
+}
+
+/*
+ * Read kernel memory, return 0 on success.
+ */
+int
+kread(u_long addr, void *buf, size_t size)
+{
+
+ if (kvmd_init() < 0)
+ return (-1);
+
+ if (!buf)
+ return (0);
+ if (kvm_read(kvmd, addr, buf, size) != (ssize_t)size) {
+ xo_warnx("%s", kvm_geterr(kvmd));
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * Read single counter(9).
+ */
+uint64_t
+kread_counter(u_long addr)
+{
+
+ if (kvmd_init() < 0)
+ return (-1);
+
+ return (kvm_counter_u64_fetch(kvmd, addr));
+}
+
+/*
+ * Read an array of N counters in kernel memory into array of N uint64_t's.
+ */
+int
+kread_counters(u_long addr, void *buf, size_t size)
+{
+ uint64_t *c;
+ u_long *counters;
+ size_t i, n;
+
+ if (kvmd_init() < 0)
+ return (-1);
+
+ if (size % sizeof(uint64_t) != 0) {
+ xo_warnx("kread_counters: invalid counter set size");
+ return (-1);
+ }
+
+ n = size / sizeof(uint64_t);
+ if ((counters = malloc(n * sizeof(u_long))) == NULL)
+ xo_err(-1, "malloc");
+ if (kread(addr, counters, n * sizeof(u_long)) < 0) {
+ free(counters);
+ return (-1);
+ }
+
+ c = buf;
+ for (i = 0; i < n; i++)
+ c[i] = kvm_counter_u64_fetch(kvmd, counters[i]);
+
+ free(counters);
+ return (0);
+}
+
+const char *
+plural(uintmax_t n)
+{
+ return (n != 1 ? "s" : "");
+}
+
+const char *
+plurales(uintmax_t n)
+{
+ return (n != 1 ? "es" : "");
+}
+
+const char *
+pluralies(uintmax_t n)
+{
+ return (n != 1 ? "ies" : "y");
+}
+
+/*
+ * Find the protox for the given "well-known" name.
+ */
+static struct protox *
+knownname(const char *name)
+{
+ struct protox **tpp, *tp;
+
+ for (tpp = protoprotox; *tpp; tpp++)
+ for (tp = *tpp; tp->pr_name; tp++)
+ if (strcmp(tp->pr_name, name) == 0)
+ return (tp);
+ return (NULL);
+}
+
+/*
+ * Find the protox corresponding to name.
+ */
+static struct protox *
+name2protox(const char *name)
+{
+ struct protox *tp;
+ char **alias; /* alias from p->aliases */
+ struct protoent *p;
+
+ /*
+ * Try to find the name in the list of "well-known" names. If that
+ * fails, check if name is an alias for an Internet protocol.
+ */
+ if ((tp = knownname(name)) != NULL)
+ return (tp);
+
+ setprotoent(1); /* make protocol lookup cheaper */
+ while ((p = getprotoent()) != NULL) {
+ /* assert: name not same as p->name */
+ for (alias = p->p_aliases; *alias; alias++)
+ if (strcmp(name, *alias) == 0) {
+ endprotoent();
+ return (knownname(p->p_name));
+ }
+ }
+ endprotoent();
+ return (NULL);
+}
+
+static void
+usage(void)
+{
+ (void)xo_error("%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 [-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]\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 [-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]",
+" netstat -Q");
+ xo_finish();
+ exit(1);
+}
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
new file mode 100644
index 0000000..8b95ddd
--- /dev/null
+++ b/usr.bin/netstat/mbuf.c
@@ -0,0 +1,359 @@
+/*-
+ * Copyright (c) 1983, 1988, 1993
+ * The Regents of the University of California.
+ * Copyright (c) 2005 Robert N. M. Watson
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/mbuf.h>
+#include <sys/protosw.h>
+#include <sys/sf_buf.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+
+#include <err.h>
+#include <kvm.h>
+#include <memstat.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+/*
+ * Print mbuf statistics.
+ */
+void
+mbpr(void *kvmd, u_long mbaddr)
+{
+ struct memory_type_list *mtlp;
+ struct memory_type *mtp;
+ uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size;
+ uintmax_t mbuf_sleeps;
+ uintmax_t cluster_count, cluster_limit, cluster_free;
+ uintmax_t cluster_failures, cluster_size, cluster_sleeps;
+ uintmax_t packet_count, packet_bytes, packet_free, packet_failures;
+ uintmax_t packet_sleeps;
+ uintmax_t tag_bytes;
+ uintmax_t jumbop_count, jumbop_limit, jumbop_free;
+ uintmax_t jumbop_failures, jumbop_sleeps, jumbop_size;
+ uintmax_t jumbo9_count, jumbo9_limit, jumbo9_free;
+ uintmax_t jumbo9_failures, jumbo9_sleeps, jumbo9_size;
+ uintmax_t jumbo16_count, jumbo16_limit, jumbo16_free;
+ uintmax_t jumbo16_failures, jumbo16_sleeps, jumbo16_size;
+ uintmax_t bytes_inuse, bytes_incache, bytes_total;
+ int nsfbufs, nsfbufspeak, nsfbufsused;
+ struct sfstat sfstat;
+ size_t mlen;
+ int error;
+
+ mtlp = memstat_mtl_alloc();
+ if (mtlp == NULL) {
+ xo_warn("memstat_mtl_alloc");
+ return;
+ }
+
+ /*
+ * Use memstat_*_all() because some mbuf-related memory is in uma(9),
+ * and some malloc(9).
+ */
+ if (live) {
+ if (memstat_sysctl_all(mtlp, 0) < 0) {
+ xo_warnx("memstat_sysctl_all: %s",
+ memstat_strerror(memstat_mtl_geterror(mtlp)));
+ goto out;
+ }
+ } else {
+ if (memstat_kvm_all(mtlp, kvmd) < 0) {
+ error = memstat_mtl_geterror(mtlp);
+ if (error == MEMSTAT_ERROR_KVM)
+ xo_warnx("memstat_kvm_all: %s",
+ kvm_geterr(kvmd));
+ else
+ xo_warnx("memstat_kvm_all: %s",
+ memstat_strerror(error));
+ goto out;
+ }
+ }
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found", MBUF_MEM_NAME);
+ goto out;
+ }
+ mbuf_count = memstat_get_count(mtp);
+ mbuf_bytes = memstat_get_bytes(mtp);
+ mbuf_free = memstat_get_free(mtp);
+ mbuf_failures = memstat_get_failures(mtp);
+ mbuf_sleeps = memstat_get_sleeps(mtp);
+ mbuf_size = memstat_get_size(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_PACKET_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found",
+ MBUF_PACKET_MEM_NAME);
+ goto out;
+ }
+ packet_count = memstat_get_count(mtp);
+ packet_bytes = memstat_get_bytes(mtp);
+ packet_free = memstat_get_free(mtp);
+ packet_sleeps = memstat_get_sleeps(mtp);
+ packet_failures = memstat_get_failures(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_CLUSTER_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found",
+ MBUF_CLUSTER_MEM_NAME);
+ goto out;
+ }
+ cluster_count = memstat_get_count(mtp);
+ cluster_limit = memstat_get_countlimit(mtp);
+ cluster_free = memstat_get_free(mtp);
+ cluster_failures = memstat_get_failures(mtp);
+ cluster_sleeps = memstat_get_sleeps(mtp);
+ cluster_size = memstat_get_size(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_MALLOC, MBUF_TAG_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: malloc type %s not found",
+ MBUF_TAG_MEM_NAME);
+ goto out;
+ }
+ tag_bytes = memstat_get_bytes(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBOP_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found",
+ MBUF_JUMBOP_MEM_NAME);
+ goto out;
+ }
+ jumbop_count = memstat_get_count(mtp);
+ jumbop_limit = memstat_get_countlimit(mtp);
+ jumbop_free = memstat_get_free(mtp);
+ jumbop_failures = memstat_get_failures(mtp);
+ jumbop_sleeps = memstat_get_sleeps(mtp);
+ jumbop_size = memstat_get_size(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO9_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found",
+ MBUF_JUMBO9_MEM_NAME);
+ goto out;
+ }
+ jumbo9_count = memstat_get_count(mtp);
+ jumbo9_limit = memstat_get_countlimit(mtp);
+ jumbo9_free = memstat_get_free(mtp);
+ jumbo9_failures = memstat_get_failures(mtp);
+ jumbo9_sleeps = memstat_get_sleeps(mtp);
+ jumbo9_size = memstat_get_size(mtp);
+
+ mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO16_MEM_NAME);
+ if (mtp == NULL) {
+ xo_warnx("memstat_mtl_find: zone %s not found",
+ MBUF_JUMBO16_MEM_NAME);
+ goto out;
+ }
+ jumbo16_count = memstat_get_count(mtp);
+ jumbo16_limit = memstat_get_countlimit(mtp);
+ jumbo16_free = memstat_get_free(mtp);
+ jumbo16_failures = memstat_get_failures(mtp);
+ jumbo16_sleeps = memstat_get_sleeps(mtp);
+ jumbo16_size = memstat_get_size(mtp);
+
+ xo_open_container("mbuf-statistics");
+
+ xo_emit("{:mbuf-current/%ju}/{:mbuf-cache/%ju}/{:mbuf-total/%ju} "
+ "{N:mbufs in use (current\\/cache\\/total)}\n",
+ mbuf_count + packet_count, mbuf_free + packet_free,
+ mbuf_count + packet_count + mbuf_free + packet_free);
+
+ xo_emit("{:cluster-current/%ju}/{:cluster-cache/%ju}/"
+ "{:cluster-total/%ju}/{:cluster-max/%ju} "
+ "{N:mbuf clusters in use (current\\/cache\\/total\\/max)}\n",
+ cluster_count - packet_free, cluster_free + packet_free,
+ cluster_count + cluster_free, cluster_limit);
+
+ xo_emit("{:packet-count/%ju}/{:packet-free/%ju} "
+ "{N:mbuf+clusters out of packet secondary zone in use "
+ "(current\\/cache)}\n",
+ packet_count, packet_free);
+
+ xo_emit("{:jumbo-count/%ju}/{:jumbo-cache/%ju}/{:jumbo-total/%ju}/"
+ "{:jumbo-max/%ju} {:jumbo-page-size/%ju}{U:k} {N:(page size)} "
+ "{N:jumbo clusters in use (current\\/cache\\/total\\/max)}\n",
+ jumbop_count, jumbop_free, jumbop_count + jumbop_free,
+ jumbop_limit, jumbop_size / 1024);
+
+ xo_emit("{:jumbo9-count/%ju}/{:jumbo9-cache/%ju}/"
+ "{:jumbo9-total/%ju}/{:jumbo9-max/%ju} "
+ "{N:9k jumbo clusters in use (current\\/cache\\/total\\/max)}\n",
+ jumbo9_count, jumbo9_free, jumbo9_count + jumbo9_free,
+ jumbo9_limit);
+
+ xo_emit("{:jumbo16-count/%ju}/{:jumbo16-cache/%ju}/"
+ "{:jumbo16-total/%ju}/{:jumbo16-limit/%ju} "
+ "{N:16k jumbo clusters in use (current\\/cache\\/total\\/max)}\n",
+ jumbo16_count, jumbo16_free, jumbo16_count + jumbo16_free,
+ jumbo16_limit);
+
+#if 0
+ xo_emit("{:tag-count/%ju} {N:mbuf tags in use}\n", tag_count);
+#endif
+
+ /*-
+ * Calculate in-use bytes as:
+ * - straight mbuf memory
+ * - mbuf memory in packets
+ * - the clusters attached to packets
+ * - and the rest of the non-packet-attached clusters.
+ * - m_tag memory
+ * This avoids counting the clusters attached to packets in the cache.
+ * This currently excludes sf_buf space.
+ */
+ bytes_inuse =
+ mbuf_bytes + /* straight mbuf memory */
+ packet_bytes + /* mbufs in packets */
+ (packet_count * cluster_size) + /* clusters in packets */
+ /* other clusters */
+ ((cluster_count - packet_count - packet_free) * cluster_size) +
+ tag_bytes +
+ (jumbop_count * jumbop_size) + /* jumbo clusters */
+ (jumbo9_count * jumbo9_size) +
+ (jumbo16_count * jumbo16_size);
+
+ /*
+ * Calculate in-cache bytes as:
+ * - cached straught mbufs
+ * - cached packet mbufs
+ * - cached packet clusters
+ * - cached straight clusters
+ * This currently excludes sf_buf space.
+ */
+ bytes_incache =
+ (mbuf_free * mbuf_size) + /* straight free mbufs */
+ (packet_free * mbuf_size) + /* mbufs in free packets */
+ (packet_free * cluster_size) + /* clusters in free packets */
+ (cluster_free * cluster_size) + /* free clusters */
+ (jumbop_free * jumbop_size) + /* jumbo clusters */
+ (jumbo9_free * jumbo9_size) +
+ (jumbo16_free * jumbo16_size);
+
+ /*
+ * Total is bytes in use + bytes in cache. This doesn't take into
+ * account various other misc data structures, overhead, etc, but
+ * gives the user something useful despite that.
+ */
+ bytes_total = bytes_inuse + bytes_incache;
+
+ xo_emit("{:bytes-in-use/%ju}{U:K}/{:bytes-in-cache/%ju}{U:K}/"
+ "{:bytes-total/%ju}{U:K} "
+ "{N:bytes allocated to network (current\\/cache\\/total)}\n",
+ bytes_inuse / 1024, bytes_incache / 1024, bytes_total / 1024);
+
+ xo_emit("{:mbuf-failures/%ju}/{:cluster-failures/%ju}/"
+ "{:packet-failures/%ju} {N:requests for mbufs denied "
+ "(mbufs\\/clusters\\/mbuf+clusters)}\n",
+ mbuf_failures, cluster_failures, packet_failures);
+ xo_emit("{:mbuf-sleeps/%ju}/{:cluster-sleeps/%ju}/{:packet-sleeps/%ju} "
+ "{N:requests for mbufs delayed "
+ "(mbufs\\/clusters\\/mbuf+clusters)}\n",
+ mbuf_sleeps, cluster_sleeps, packet_sleeps);
+
+ xo_emit("{:jumbop-sleeps/%ju}/{:jumbo9-sleeps/%ju}/"
+ "{:jumbo16-sleeps/%ju} {N:/requests for jumbo clusters delayed "
+ "(%juk\\/9k\\/16k)}\n",
+ jumbop_sleeps, jumbo9_sleeps, jumbo16_sleeps, jumbop_size / 1024);
+ xo_emit("{:jumbop-failures/%ju}/{:jumbo9-failures/%ju}/"
+ "{:jumbo16-failures/%ju} {N:/requests for jumbo clusters denied "
+ "(%juk\\/9k\\/16k)}\n",
+ jumbop_failures, jumbo9_failures, jumbo16_failures,
+ jumbop_size / 1024);
+
+ mlen = sizeof(nsfbufs);
+ if (live &&
+ sysctlbyname("kern.ipc.nsfbufs", &nsfbufs, &mlen, NULL, 0) == 0 &&
+ sysctlbyname("kern.ipc.nsfbufsused", &nsfbufsused, &mlen,
+ NULL, 0) == 0 &&
+ sysctlbyname("kern.ipc.nsfbufspeak", &nsfbufspeak, &mlen,
+ NULL, 0) == 0)
+ xo_emit("{:nsfbufs-current/%d}/{:nsfbufs-peak/%d}/"
+ "{:nsfbufs/%d} "
+ "{N:sfbufs in use (current\\/peak\\/max)}\n",
+ nsfbufsused, nsfbufspeak, nsfbufs);
+
+ if (fetch_stats("kern.ipc.sfstat", mbaddr, &sfstat, sizeof(sfstat),
+ kread_counters) != 0)
+ goto out;
+
+ xo_emit("{:sendfile-syscalls/%ju} {N:sendfile syscalls}\n",
+ (uintmax_t)sfstat.sf_syscalls);
+ xo_emit("{:sendfile-no-io/%ju} "
+ "{N:sendfile syscalls completed without I\\/O request}\n",
+ (uintmax_t)sfstat.sf_noiocnt);
+ xo_emit("{:sendfile-io-count/%ju} "
+ "{N:requests for I\\/O initiated by sendfile}\n",
+ (uintmax_t)sfstat.sf_iocnt);
+ xo_emit("{:sendfile-pages-sent/%ju} "
+ "{N:pages read by sendfile as part of a request}\n",
+ (uintmax_t)sfstat.sf_pages_read);
+ xo_emit("{:sendfile-pages-valid/%ju} "
+ "{N:pages were valid at time of a sendfile request}\n",
+ (uintmax_t)sfstat.sf_pages_valid);
+ xo_emit("{:sendfile-requested-readahead/%ju} "
+ "{N:pages were requested for read ahead by applications}\n",
+ (uintmax_t)sfstat.sf_rhpages_requested);
+ xo_emit("{:sendfile-readahead/%ju} "
+ "{N:pages were read ahead by sendfile}\n",
+ (uintmax_t)sfstat.sf_rhpages_read);
+ xo_emit("{:sendfile-busy-encounters/%ju} "
+ "{N:times sendfile encountered an already busy page}\n",
+ (uintmax_t)sfstat.sf_busy);
+ xo_emit("{:sfbufs-alloc-failed/%ju} {N:requests for sfbufs denied}\n",
+ (uintmax_t)sfstat.sf_allocfail);
+ xo_emit("{:sfbufs-alloc-wait/%ju} {N:requests for sfbufs delayed}\n",
+ (uintmax_t)sfstat.sf_allocwait);
+out:
+ xo_close_container("mbuf-statistics");
+ memstat_mtl_free(mtlp);
+}
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c
new file mode 100644
index 0000000..975473e
--- /dev/null
+++ b/usr.bin/netstat/mroute.c
@@ -0,0 +1,454 @@
+/*-
+ * Copyright (c) 1989 Stephen Deering
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)mroute.c 8.2 (Berkeley) 4/28/95
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Print multicast routing structures and statistics.
+ *
+ * MROUTING 1.0
+ */
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/protosw.h>
+#include <sys/mbuf.h>
+#include <sys/time.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/igmp.h>
+#include <net/route.h>
+
+#define _KERNEL 1
+#include <netinet/ip_mroute.h>
+#undef _KERNEL
+
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+#include "nl_defs.h"
+
+static void print_bw_meter(struct bw_meter *, int *);
+static void print_mfc(struct mfc *, int, int *);
+
+static void
+print_bw_meter(struct bw_meter *bw_meter, int *banner_printed)
+{
+ char s1[256], s2[256], s3[256];
+ struct timeval now, end, delta;
+
+ gettimeofday(&now, NULL);
+
+ if (! *banner_printed) {
+ xo_open_list("bandwidth-meter");
+ xo_emit(" {T:Bandwidth Meters}\n");
+ xo_emit(" {T:/%-30s}", "Measured(Start|Packets|Bytes)");
+ xo_emit(" {T:/%s}", "Type");
+ xo_emit(" {T:/%-30s}", "Thresh(Interval|Packets|Bytes)");
+ xo_emit(" {T:Remain}");
+ xo_emit("\n");
+ *banner_printed = 1;
+ }
+
+ xo_open_instance("bandwidth-meter");
+
+ /* The measured values */
+ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) {
+ sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_measured.b_packets);
+ xo_emit("{e:measured-packets/%ju}",
+ (uintmax_t)bw_meter->bm_measured.b_packets);
+ } else
+ sprintf(s1, "?");
+ if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) {
+ sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_measured.b_bytes);
+ xo_emit("{e:measured-bytes/%ju}",
+ (uintmax_t)bw_meter->bm_measured.b_bytes);
+ } else
+ sprintf(s2, "?");
+ xo_emit(" {[:-30}{:start-time/%lu.%06lu}|{q:measured-packets/%s}"
+ "|{q:measured-bytes%s}{]:}",
+ (u_long)bw_meter->bm_start_time.tv_sec,
+ (u_long)bw_meter->bm_start_time.tv_usec, s1, s2);
+
+ /* The type of entry */
+ xo_emit(" {t:type/%-3s}", (bw_meter->bm_flags & BW_METER_GEQ) ? ">=" :
+ (bw_meter->bm_flags & BW_METER_LEQ) ? "<=" : "?");
+
+ /* The threshold values */
+ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) {
+ sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_threshold.b_packets);
+ xo_emit("{e:threshold-packets/%ju}",
+ (uintmax_t)bw_meter->bm_threshold.b_packets);
+ } else
+ sprintf(s1, "?");
+ if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) {
+ sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_threshold.b_bytes);
+ xo_emit("{e:threshold-bytes/%ju}",
+ (uintmax_t)bw_meter->bm_threshold.b_bytes);
+ } else
+ sprintf(s2, "?");
+
+ xo_emit(" {[:-30}{:threshold-time/%lu.%06lu}|{q:threshold-packets/%s}"
+ "|{q:threshold-bytes%s}{]:}",
+ (u_long)bw_meter->bm_threshold.b_time.tv_sec,
+ (u_long)bw_meter->bm_threshold.b_time.tv_usec, s1, s2);
+
+ /* Remaining time */
+ timeradd(&bw_meter->bm_start_time,
+ &bw_meter->bm_threshold.b_time, &end);
+ if (timercmp(&now, &end, <=)) {
+ timersub(&end, &now, &delta);
+ sprintf(s3, "%lu.%06lu",
+ (u_long)delta.tv_sec,
+ (u_long)delta.tv_usec);
+ } else {
+ /* Negative time */
+ timersub(&now, &end, &delta);
+ sprintf(s3, "-%lu.06%lu",
+ (u_long)delta.tv_sec,
+ (u_long)delta.tv_usec);
+ }
+ xo_emit(" {:remaining-time/%s}", s3);
+
+ xo_open_instance("bandwidth-meter");
+
+ xo_emit("\n");
+}
+
+static void
+print_mfc(struct mfc *m, int maxvif, int *banner_printed)
+{
+ struct sockaddr_in sin;
+ struct sockaddr *sa = (struct sockaddr *)&sin;
+ struct bw_meter bw_meter, *bwm;
+ int bw_banner_printed;
+ int error;
+ vifi_t vifi;
+
+ bw_banner_printed = 0;
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_len = sizeof(sin);
+ sin.sin_family = AF_INET;
+
+ if (! *banner_printed) {
+ xo_open_list("multicast-forwarding-entry");
+ xo_emit("\n{T:IPv4 Multicast Forwarding Table}\n"
+ " {T:Origin} {T:Group} "
+ " {T:Packets In-Vif} {T:Out-Vifs:Ttls}\n");
+ *banner_printed = 1;
+ }
+
+ memcpy(&sin.sin_addr, &m->mfc_origin, sizeof(sin.sin_addr));
+ xo_emit(" {:origin-address/%-15.15s}", routename(sa, numeric_addr));
+ memcpy(&sin.sin_addr, &m->mfc_mcastgrp, sizeof(sin.sin_addr));
+ xo_emit(" {:group-address/%-15.15s}",
+ routename(sa, numeric_addr));
+ xo_emit(" {:sent-packets/%9lu}", m->mfc_pkt_cnt);
+ xo_emit(" {:parent/%3d} ", m->mfc_parent);
+ xo_open_list("vif-ttl");
+ for (vifi = 0; vifi <= maxvif; vifi++) {
+ if (m->mfc_ttls[vifi] > 0) {
+ xo_open_instance("vif-ttl");
+ xo_emit(" {k:vif/%u}:{:ttl/%u}", vifi,
+ m->mfc_ttls[vifi]);
+ xo_close_instance("vif-ttl");
+ }
+ }
+ xo_close_list("vif-ttl");
+ xo_emit("\n");
+
+ /*
+ * XXX We break the rules and try to use KVM to read the
+ * bandwidth meters, they are not retrievable via sysctl yet.
+ */
+ bwm = m->mfc_bw_meter;
+ while (bwm != NULL) {
+ error = kread((u_long)bwm, (char *)&bw_meter,
+ sizeof(bw_meter));
+ if (error)
+ break;
+ print_bw_meter(&bw_meter, &bw_banner_printed);
+ bwm = bw_meter.bm_mfc_next;
+ }
+ if (banner_printed)
+ xo_close_list("bandwidth-meter");
+}
+
+void
+mroutepr()
+{
+ struct sockaddr_in sin;
+ struct sockaddr *sa = (struct sockaddr *)&sin;
+ struct vif viftable[MAXVIFS];
+ struct vif *v;
+ struct mfc *m;
+ u_long pmfchashtbl, pmfctablesize, pviftbl;
+ int banner_printed;
+ int saved_numeric_addr;
+ size_t len;
+ vifi_t vifi, maxvif;
+
+ saved_numeric_addr = numeric_addr;
+ numeric_addr = 1;
+
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_len = sizeof(sin);
+ sin.sin_family = AF_INET;
+
+ /*
+ * TODO:
+ * The VIF table will move to hanging off the struct if_info for
+ * each IPv4 configured interface. Currently it is statically
+ * allocated, and retrieved either using KVM or an opaque SYSCTL.
+ *
+ * This can't happen until the API documented in multicast(4)
+ * is itself refactored. The historical reason why VIFs use
+ * a separate ifindex space is entirely due to the legacy
+ * capability of the MROUTING code to create IPIP tunnels on
+ * the fly to support DVMRP. When gif(4) became available, this
+ * functionality was deprecated, as PIM does not use it.
+ */
+ maxvif = 0;
+ pmfchashtbl = pmfctablesize = pviftbl = 0;
+
+ len = sizeof(viftable);
+ if (live) {
+ if (sysctlbyname("net.inet.ip.viftable", viftable, &len, NULL,
+ 0) < 0) {
+ xo_warn("sysctl: net.inet.ip.viftable");
+ return;
+ }
+ } else {
+ pmfchashtbl = nl[N_MFCHASHTBL].n_value;
+ pmfctablesize = nl[N_MFCTABLESIZE].n_value;
+ pviftbl = nl[N_VIFTABLE].n_value;
+
+ if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) {
+ xo_warnx("No IPv4 MROUTING kernel support.");
+ return;
+ }
+
+ kread(pviftbl, (char *)viftable, sizeof(viftable));
+ }
+
+ banner_printed = 0;
+ for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {
+ if (v->v_lcl_addr.s_addr == 0)
+ continue;
+
+ maxvif = vifi;
+ if (!banner_printed) {
+ xo_emit("\n{T:IPv4 Virtual Interface Table\n"
+ " Vif Thresh Local-Address "
+ "Remote-Address Pkts-In Pkts-Out}\n");
+ banner_printed = 1;
+ xo_open_list("vif");
+ }
+
+ xo_open_instance("vif");
+ memcpy(&sin.sin_addr, &v->v_lcl_addr, sizeof(sin.sin_addr));
+ xo_emit(" {:vif/%2u} {:threshold/%6u} {:route/%-15.15s}",
+ /* opposite math of add_vif() */
+ vifi, v->v_threshold,
+ routename(sa, numeric_addr));
+ memcpy(&sin.sin_addr, &v->v_rmt_addr, sizeof(sin.sin_addr));
+ xo_emit(" {:source/%-15.15s}", (v->v_flags & VIFF_TUNNEL) ?
+ routename(sa, numeric_addr) : "");
+
+ xo_emit(" {:received-packets/%9lu} {:sent-packets/%9lu}\n",
+ v->v_pkt_in, v->v_pkt_out);
+ xo_close_instance("vif");
+ }
+ if (banner_printed)
+ xo_close_list("vif");
+ else
+ xo_emit("\n{T:IPv4 Virtual Interface Table is empty}\n");
+
+ banner_printed = 0;
+
+ /*
+ * TODO:
+ * The MFC table will move into the AF_INET radix trie in future.
+ * In 8.x, it becomes a dynamically allocated structure referenced
+ * by a hashed LIST, allowing more than 256 entries w/o kernel tuning.
+ *
+ * If retrieved via opaque SYSCTL, the kernel will coalesce it into
+ * a static table for us.
+ * If retrieved via KVM, the hash list pointers must be followed.
+ */
+ if (live) {
+ struct mfc *mfctable;
+
+ len = 0;
+ if (sysctlbyname("net.inet.ip.mfctable", NULL, &len, NULL,
+ 0) < 0) {
+ xo_warn("sysctl: net.inet.ip.mfctable");
+ return;
+ }
+
+ mfctable = malloc(len);
+ if (mfctable == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return;
+ }
+ if (sysctlbyname("net.inet.ip.mfctable", mfctable, &len, NULL,
+ 0) < 0) {
+ free(mfctable);
+ xo_warn("sysctl: net.inet.ip.mfctable");
+ return;
+ }
+
+ m = mfctable;
+ while (len >= sizeof(*m)) {
+ print_mfc(m++, maxvif, &banner_printed);
+ len -= sizeof(*m);
+ }
+ if (banner_printed)
+ xo_close_list("multicast-forwarding-entry");
+ if (len != 0)
+ xo_warnx("print_mfc: %lu trailing bytes", (u_long)len);
+
+ free(mfctable);
+ } else {
+ LIST_HEAD(, mfc) *mfchashtbl;
+ u_long i, mfctablesize;
+ struct mfc mfc;
+ int error;
+
+ error = kread(pmfctablesize, (char *)&mfctablesize,
+ sizeof(u_long));
+ if (error) {
+ xo_warn("kread: mfctablesize");
+ return;
+ }
+
+ len = sizeof(*mfchashtbl) * mfctablesize;
+ mfchashtbl = malloc(len);
+ if (mfchashtbl == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return;
+ }
+ kread(pmfchashtbl, (char *)&mfchashtbl, len);
+
+ for (i = 0; i < mfctablesize; i++) {
+ LIST_FOREACH(m, &mfchashtbl[i], mfc_hash) {
+ kread((u_long)m, (char *)&mfc, sizeof(mfc));
+ print_mfc(m, maxvif, &banner_printed);
+ }
+ }
+ if (banner_printed)
+ xo_close_list("multicast-forwarding-entry");
+
+ free(mfchashtbl);
+ }
+
+ if (!banner_printed)
+ xo_emit("\n{T:IPv4 Multicast Forwarding Table is empty}\n");
+
+ xo_emit("\n");
+ numeric_addr = saved_numeric_addr;
+}
+
+void
+mrt_stats()
+{
+ struct mrtstat mrtstat;
+ u_long mstaddr;
+
+ mstaddr = nl[N_MRTSTAT].n_value;
+
+ if (mstaddr == 0) {
+ fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
+ return;
+ }
+
+ if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat,
+ sizeof(mrtstat), kread_counters) != 0)
+ return;
+
+ xo_emit("{T:IPv4 multicast forwarding}:\n");
+
+#define p(f, m) if (mrtstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)mrtstat.f, plural(mrtstat.f))
+#define p2(f, m) if (mrtstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f))
+
+ xo_open_container("multicast-statistics");
+
+ p(mrts_mfc_lookups, "\t{:cache-lookups/%ju} "
+ "{N:/multicast forwarding cache lookup%s}\n");
+ p2(mrts_mfc_misses, "\t{:cache-misses/%ju} "
+ "{N:/multicast forwarding cache miss%s}\n");
+ p(mrts_upcalls, "\t{:upcalls-total/%ju} "
+ "{N:/upcall%s to multicast routing daemon}\n");
+ p(mrts_upq_ovflw, "\t{:upcall-overflows/%ju} "
+ "{N:/upcall queue overflow%s}\n");
+ p(mrts_upq_sockfull,
+ "\t{:upcalls-dropped-full-buffer/%ju} "
+ "{N:/upcall%s dropped due to full socket buffer}\n");
+ p(mrts_cache_cleanups, "\t{:cache-cleanups/%ju} "
+ "{N:/cache cleanup%s}\n");
+ p(mrts_no_route, "\t{:dropped-no-origin/%ju} "
+ "{N:/datagram%s with no route for origin}\n");
+ p(mrts_bad_tunnel, "\t{:dropped-bad-tunnel/%ju} "
+ "{N:/datagram%s arrived with bad tunneling}\n");
+ p(mrts_cant_tunnel, "\t{:dropped-could-not-tunnel/%ju} "
+ "{N:/datagram%s could not be tunneled}\n");
+ p(mrts_wrong_if, "\t{:dropped-wrong-incoming-interface/%ju} "
+ "{N:/datagram%s arrived on wrong interface}\n");
+ p(mrts_drop_sel, "\t{:dropped-selectively/%ju} "
+ "{N:/datagram%s selectively dropped}\n");
+ p(mrts_q_overflow, "\t{:dropped-queue-overflow/%ju} "
+ "{N:/datagram%s dropped due to queue overflow}\n");
+ p(mrts_pkt2large, "\t{:dropped-too-large/%ju} "
+ "{N:/datagram%s dropped for being too large}\n");
+
+#undef p2
+#undef p
+}
diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c
new file mode 100644
index 0000000..8f59c6b
--- /dev/null
+++ b/usr.bin/netstat/mroute6.c
@@ -0,0 +1,278 @@
+/*-
+ * Copyright (C) 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+/*-
+ * Copyright (c) 1989 Stephen Deering
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)mroute.c 8.2 (Berkeley) 4/28/95
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifdef INET6
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/protosw.h>
+#include <sys/mbuf.h>
+#include <sys/time.h>
+
+#include <net/if.h>
+#include <net/route.h>
+
+#include <netinet/in.h>
+
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <libxo/xo.h>
+
+#define KERNEL 1
+#include <netinet6/ip6_mroute.h>
+#undef KERNEL
+
+#include "netstat.h"
+
+#define WID_ORG (Wflag ? 39 : (numeric_addr ? 29 : 18)) /* width of origin column */
+#define WID_GRP (Wflag ? 18 : (numeric_addr ? 16 : 18)) /* width of group column */
+
+void
+mroute6pr()
+{
+ struct mf6c *mf6ctable[MF6CTBLSIZ], *mfcp;
+ struct mif6_sctl mif6table[MAXMIFS];
+ struct mf6c mfc;
+ struct rtdetq rte, *rtep;
+ struct mif6_sctl *mifp;
+ mifi_t mifi;
+ int i;
+ int banner_printed;
+ int saved_numeric_addr;
+ mifi_t maxmif = 0;
+ long int waitings;
+ size_t len;
+
+ if (live == 0)
+ return;
+
+ len = sizeof(mif6table);
+ if (sysctlbyname("net.inet6.ip6.mif6table", mif6table, &len, NULL, 0) <
+ 0) {
+ xo_warn("sysctl: net.inet6.ip6.mif6table");
+ return;
+ }
+
+ saved_numeric_addr = numeric_addr;
+ numeric_addr = 1;
+ banner_printed = 0;
+
+ for (mifi = 0, mifp = mif6table; mifi < MAXMIFS; ++mifi, ++mifp) {
+ char ifname[IFNAMSIZ];
+
+ if (mifp->m6_ifp == 0)
+ continue;
+
+ maxmif = mifi;
+ if (!banner_printed) {
+ xo_open_list("multicast-interface");
+ xo_emit("\n{T:IPv6 Multicast Interface Table}\n"
+ "{T: Mif Rate PhyIF Pkts-In Pkts-Out}\n");
+ banner_printed = 1;
+ }
+
+ xo_open_instance("multicast-interface");
+ xo_emit(" {:mif/%2u} {:rate-limit/%4d}",
+ mifi, mifp->m6_rate_limit);
+ xo_emit(" {:ifname/%5s}", (mifp->m6_flags & MIFF_REGISTER) ?
+ "reg0" : if_indextoname(mifp->m6_ifp, ifname));
+
+ xo_emit(" {:received-packets/%9ju} {:sent-packets/%9ju}\n",
+ (uintmax_t)mifp->m6_pkt_in,
+ (uintmax_t)mifp->m6_pkt_out);
+ xo_close_instance("multicast-interface");
+ }
+ if (banner_printed)
+ xo_open_list("multicast-interface");
+ else
+ xo_emit("\n{T:IPv6 Multicast Interface Table is empty}\n");
+
+ len = sizeof(mf6ctable);
+ if (sysctlbyname("net.inet6.ip6.mf6ctable", mf6ctable, &len, NULL, 0) <
+ 0) {
+ xo_warn("sysctl: net.inet6.ip6.mf6ctable");
+ return;
+ }
+
+ banner_printed = 0;
+
+ for (i = 0; i < MF6CTBLSIZ; ++i) {
+ mfcp = mf6ctable[i];
+ while(mfcp) {
+ kread((u_long)mfcp, (char *)&mfc, sizeof(mfc));
+ if (!banner_printed) {
+ xo_open_list("multicast-forwarding-cache");
+ xo_emit("\n"
+ "{T:IPv6 Multicast Forwarding Cache}\n");
+ xo_emit(" {T:%-*.*s} {T:%-*.*s} {T:%s}",
+ WID_ORG, WID_ORG, "Origin",
+ WID_GRP, WID_GRP, "Group",
+ " Packets Waits In-Mif Out-Mifs\n");
+ banner_printed = 1;
+ }
+
+ xo_open_instance("multicast-forwarding-cache");
+
+ xo_emit(" {:origin/%-*.*s}", WID_ORG, WID_ORG,
+ routename(sin6tosa(&mfc.mf6c_origin),
+ numeric_addr));
+ xo_emit(" {:group/%-*.*s}", WID_GRP, WID_GRP,
+ routename(sin6tosa(&mfc.mf6c_mcastgrp),
+ numeric_addr));
+ xo_emit(" {:total-packets/%9ju}",
+ (uintmax_t)mfc.mf6c_pkt_cnt);
+
+ for (waitings = 0, rtep = mfc.mf6c_stall; rtep; ) {
+ waitings++;
+ /* XXX KVM */
+ kread((u_long)rtep, (char *)&rte, sizeof(rte));
+ rtep = rte.next;
+ }
+ xo_emit(" {:waitings/%3ld}", waitings);
+
+ if (mfc.mf6c_parent == MF6C_INCOMPLETE_PARENT)
+ xo_emit(" --- ");
+ else
+ xo_emit(" {:parent/%3d} ", mfc.mf6c_parent);
+ xo_open_list("mif");
+ for (mifi = 0; mifi <= maxmif; mifi++) {
+ if (IF_ISSET(mifi, &mfc.mf6c_ifset))
+ xo_emit(" {l:%u}", mifi);
+ }
+ xo_close_list("mif");
+ xo_emit("\n");
+
+ mfcp = mfc.mf6c_next;
+ xo_close_instance("multicast-forwarding-cache");
+ }
+ }
+ if (banner_printed)
+ xo_close_list("multicast-forwarding-cache");
+ else
+ xo_emit("\n{T:IPv6 Multicast Forwarding Table is empty}\n");
+
+ xo_emit("\n");
+ numeric_addr = saved_numeric_addr;
+}
+
+void
+mrt6_stats()
+{
+ struct mrt6stat mrtstat;
+
+ if (fetch_stats("net.inet6.ip6.mrt6stat", 0, &mrtstat,
+ sizeof(mrtstat), kread_counters) != 0)
+ return;
+
+ xo_open_container("multicast-statistics");
+ xo_emit("{T:IPv6 multicast forwarding}:\n");
+
+#define p(f, m) if (mrtstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)mrtstat.f, plural(mrtstat.f))
+#define p2(f, m) if (mrtstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f))
+
+ p(mrt6s_mfc_lookups, "\t{:cache-lookups/%ju} "
+ "{N:/multicast forwarding cache lookup%s}\n");
+ p2(mrt6s_mfc_misses, "\t{:cache-misses/%ju} "
+ "{N:/multicast forwarding cache miss%s}\n");
+ p(mrt6s_upcalls, "\t{:upcalls/%ju} "
+ "{N:/upcall%s to multicast routing daemon}\n");
+ p(mrt6s_upq_ovflw, "\t{:upcall-overflows/%ju} "
+ "{N:/upcall queue overflow%s}\n");
+ p(mrt6s_upq_sockfull, "\t{:upcalls-dropped-full-buffer/%ju} "
+ "{N:/upcall%s dropped due to full socket buffer}\n");
+ p(mrt6s_cache_cleanups, "\t{:cache-cleanups/%ju} "
+ "{N:/cache cleanup%s}\n");
+ p(mrt6s_no_route, "\t{:dropped-no-origin/%ju} "
+ "{N:/datagram%s with no route for origin}\n");
+ p(mrt6s_bad_tunnel, "\t{:dropped-bad-tunnel/%ju} "
+ "{N:/datagram%s arrived with bad tunneling}\n");
+ p(mrt6s_cant_tunnel, "\t{:dropped-could-not-tunnel/%ju} "
+ "{N:/datagram%s could not be tunneled}\n");
+ p(mrt6s_wrong_if, "\t{:dropped-wrong-incoming-interface/%ju} "
+ "{N:/datagram%s arrived on wrong interface}\n");
+ p(mrt6s_drop_sel, "\t{:dropped-selectively/%ju} "
+ "{N:/datagram%s selectively dropped}\n");
+ p(mrt6s_q_overflow, "\t{:dropped-queue-overflow/%ju} "
+ "{N:/datagram%s dropped due to queue overflow}\n");
+ p(mrt6s_pkt2large, "\t{:dropped-too-large/%ju} "
+ "{N:/datagram%s dropped for being too large}\n");
+
+#undef p2
+#undef p
+ xo_close_container("multicast-statistics");
+}
+#endif /*INET6*/
diff --git a/usr.bin/netstat/netgraph.c b/usr.bin/netstat/netgraph.c
new file mode 100644
index 0000000..dc3ad82
--- /dev/null
+++ b/usr.bin/netstat/netgraph.c
@@ -0,0 +1,144 @@
+/*-
+ * Copyright (c) 1996-1999 Whistle Communications, Inc.
+ * All rights reserved.
+ *
+ * Subject to the following obligations and disclaimer of warranty, use and
+ * redistribution of this software, in source or object code forms, with or
+ * without modifications are expressly permitted by Whistle Communications;
+ * provided, however, that:
+ * 1. Any and all reproductions of the source or object code must include the
+ * copyright notice above and the following disclaimer of warranties; and
+ * 2. No rights are granted, in any manner or form, to use Whistle
+ * Communications, Inc. trademarks, including the mark "WHISTLE
+ * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+ * such appears in the above copyright notice or in the software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+ * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+ * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+ * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+ * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+ * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+ * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+ * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER 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 WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/protosw.h>
+#include <sys/linker.h>
+
+#include <net/route.h>
+
+#include <netgraph.h>
+#include <netgraph/ng_message.h>
+#include <netgraph/ng_socket.h>
+#include <netgraph/ng_socketvar.h>
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+static int first = 1;
+static int csock = -1;
+
+void
+netgraphprotopr(u_long off, const char *name, int af1 __unused,
+ int proto __unused)
+{
+ struct ngpcb *this, *next;
+ struct ngpcb ngpcb;
+ struct socket sockb;
+ int debug = 1;
+
+ /* If symbol not found, try looking in the KLD module */
+ if (off == 0) {
+ if (debug)
+ xo_warnx("Error reading symbols from ng_socket.ko");
+ return;
+ }
+
+ /* Get pointer to first socket */
+ kread(off, (char *)&this, sizeof(this));
+
+ /* Get my own socket node */
+ if (csock == -1)
+ NgMkSockNode(NULL, &csock, NULL);
+
+ for (; this != NULL; this = next) {
+ u_char rbuf[sizeof(struct ng_mesg) + sizeof(struct nodeinfo)];
+ struct ng_mesg *resp = (struct ng_mesg *) rbuf;
+ struct nodeinfo *ni = (struct nodeinfo *) resp->data;
+ char path[64];
+
+ /* Read in ngpcb structure */
+ kread((u_long)this, (char *)&ngpcb, sizeof(ngpcb));
+ next = LIST_NEXT(&ngpcb, socks);
+
+ /* Read in socket structure */
+ kread((u_long)ngpcb.ng_socket, (char *)&sockb, sizeof(sockb));
+
+ /* Check type of socket */
+ if (strcmp(name, "ctrl") == 0 && ngpcb.type != NG_CONTROL)
+ continue;
+ if (strcmp(name, "data") == 0 && ngpcb.type != NG_DATA)
+ continue;
+
+ /* Do headline */
+ if (first) {
+ xo_emit("{T:Netgraph sockets}\n");
+ if (Aflag)
+ xo_emit("{T:/%-8.8s} ", "PCB");
+ xo_emit("{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} "
+ "{T:/%-14.14s} {T:/%s}\n",
+ "Type", "Recv-Q", "Send-Q", "Node Address",
+ "#Hooks");
+ first = 0;
+ }
+
+ /* Show socket */
+ if (Aflag)
+ xo_emit("{:address/%8lx} ", (u_long) this);
+ xo_emit("{t:name/%-5.5s} {:receive-bytes-waiting/%6u} "
+ "{:send-byte-waiting/%6u} ",
+ name, sockb.so_rcv.sb_ccc, sockb.so_snd.sb_ccc);
+
+ /* Get info on associated node */
+ if (ngpcb.node_id == 0 || csock == -1)
+ goto finish;
+ snprintf(path, sizeof(path), "[%x]:", ngpcb.node_id);
+ if (NgSendMsg(csock, path,
+ NGM_GENERIC_COOKIE, NGM_NODEINFO, NULL, 0) < 0)
+ goto finish;
+ if (NgRecvMsg(csock, resp, sizeof(rbuf), NULL) < 0)
+ goto finish;
+
+ /* Display associated node info */
+ if (*ni->name != '\0')
+ snprintf(path, sizeof(path), "%s:", ni->name);
+ xo_emit("{t:path/%-14.14s} {:hooks/%4d}", path, ni->hooks);
+finish:
+ xo_emit("\n");
+ }
+}
+
diff --git a/usr.bin/netstat/netisr.c b/usr.bin/netstat/netisr.c
new file mode 100644
index 0000000..b384d6a
--- /dev/null
+++ b/usr.bin/netstat/netisr.c
@@ -0,0 +1,507 @@
+/*-
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * This software was developed by Robert N. M. Watson under contract
+ * to Juniper Networks, Inc.
+ *
+ * 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/_lock.h>
+#include <sys/_mutex.h>
+
+#define _WANT_NETISR_INTERNAL
+#include <net/netisr.h>
+#include <net/netisr_internal.h>
+
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+#include "nl_defs.h"
+
+/*
+ * Print statistics for the kernel netisr subsystem.
+ */
+static u_int bindthreads;
+static u_int maxthreads;
+static u_int numthreads;
+
+static u_int defaultqlimit;
+static u_int maxqlimit;
+
+static char dispatch_policy[20];
+
+static struct sysctl_netisr_proto *proto_array;
+static u_int proto_array_len;
+
+static struct sysctl_netisr_workstream *workstream_array;
+static u_int workstream_array_len;
+
+static struct sysctl_netisr_work *work_array;
+static u_int work_array_len;
+
+static u_int *nws_array;
+
+static u_int maxprot;
+
+static void
+netisr_dispatch_policy_to_string(u_int policy, char *buf,
+ size_t buflen)
+{
+ const char *str;
+
+ switch (policy) {
+ case NETISR_DISPATCH_DEFAULT:
+ str = "default";
+ break;
+ case NETISR_DISPATCH_DEFERRED:
+ str = "deferred";
+ break;
+ case NETISR_DISPATCH_HYBRID:
+ str = "hybrid";
+ break;
+ case NETISR_DISPATCH_DIRECT:
+ str = "direct";
+ break;
+ default:
+ str = "unknown";
+ break;
+ }
+ snprintf(buf, buflen, "%s", str);
+}
+
+/*
+ * Load a nul-terminated string from KVM up to 'limit', guarantee that the
+ * string in local memory is nul-terminated.
+ */
+static void
+netisr_load_kvm_string(uintptr_t addr, char *dest, u_int limit)
+{
+ u_int i;
+
+ for (i = 0; i < limit; i++) {
+ if (kread(addr + i, &dest[i], sizeof(dest[i])) != 0)
+ xo_errx(-1, "%s: kread()", __func__);
+ if (dest[i] == '\0')
+ break;
+ }
+ dest[limit - 1] = '\0';
+}
+
+static const char *
+netisr_proto2name(u_int proto)
+{
+ u_int i;
+
+ for (i = 0; i < proto_array_len; i++) {
+ if (proto_array[i].snp_proto == proto)
+ return (proto_array[i].snp_name);
+ }
+ return ("unknown");
+}
+
+static int
+netisr_protoispresent(u_int proto)
+{
+ u_int i;
+
+ for (i = 0; i < proto_array_len; i++) {
+ if (proto_array[i].snp_proto == proto)
+ return (1);
+ }
+ return (0);
+}
+
+static void
+netisr_load_kvm_config(void)
+{
+ u_int tmp;
+
+ kread(nl[N_NETISR_BINDTHREADS].n_value, &bindthreads, sizeof(u_int));
+ kread(nl[N_NETISR_MAXTHREADS].n_value, &maxthreads, sizeof(u_int));
+ kread(nl[N_NWS_COUNT].n_value, &numthreads, sizeof(u_int));
+ kread(nl[N_NETISR_DEFAULTQLIMIT].n_value, &defaultqlimit,
+ sizeof(u_int));
+ kread(nl[N_NETISR_MAXQLIMIT].n_value, &maxqlimit, sizeof(u_int));
+ kread(nl[N_NETISR_DISPATCH_POLICY].n_value, &tmp, sizeof(u_int));
+
+ netisr_dispatch_policy_to_string(tmp, dispatch_policy,
+ sizeof(dispatch_policy));
+}
+
+static void
+netisr_load_sysctl_uint(const char *name, u_int *p)
+{
+ size_t retlen;
+
+ retlen = sizeof(u_int);
+ if (sysctlbyname(name, p, &retlen, NULL, 0) < 0)
+ xo_err(-1, "%s", name);
+ if (retlen != sizeof(u_int))
+ xo_errx(-1, "%s: invalid len %ju", name, (uintmax_t)retlen);
+}
+
+static void
+netisr_load_sysctl_string(const char *name, char *p, size_t len)
+{
+ size_t retlen;
+
+ retlen = len;
+ if (sysctlbyname(name, p, &retlen, NULL, 0) < 0)
+ xo_err(-1, "%s", name);
+ p[len - 1] = '\0';
+}
+
+static void
+netisr_load_sysctl_config(void)
+{
+
+ netisr_load_sysctl_uint("net.isr.bindthreads", &bindthreads);
+ netisr_load_sysctl_uint("net.isr.maxthreads", &maxthreads);
+ netisr_load_sysctl_uint("net.isr.numthreads", &numthreads);
+
+ netisr_load_sysctl_uint("net.isr.defaultqlimit", &defaultqlimit);
+ netisr_load_sysctl_uint("net.isr.maxqlimit", &maxqlimit);
+
+ netisr_load_sysctl_string("net.isr.dispatch", dispatch_policy,
+ sizeof(dispatch_policy));
+}
+
+static void
+netisr_load_kvm_proto(void)
+{
+ struct netisr_proto *np_array, *npp;
+ u_int i, protocount;
+ struct sysctl_netisr_proto *snpp;
+ size_t len;
+
+ /*
+ * Kernel compile-time and user compile-time definitions of
+ * NETISR_MAXPROT must match, as we use that to size work arrays.
+ */
+ kread(nl[N_NETISR_MAXPROT].n_value, &maxprot, sizeof(u_int));
+ if (maxprot != NETISR_MAXPROT)
+ xo_errx(-1, "%s: NETISR_MAXPROT mismatch", __func__);
+ len = maxprot * sizeof(*np_array);
+ np_array = malloc(len);
+ if (np_array == NULL)
+ xo_err(-1, "%s: malloc", __func__);
+ if (kread(nl[N_NETISR_PROTO].n_value, np_array, len) != 0)
+ xo_errx(-1, "%s: kread(_netisr_proto)", __func__);
+
+ /*
+ * Size and allocate memory to hold only live protocols.
+ */
+ protocount = 0;
+ for (i = 0; i < maxprot; i++) {
+ if (np_array[i].np_name == NULL)
+ continue;
+ protocount++;
+ }
+ proto_array = calloc(protocount, sizeof(*proto_array));
+ if (proto_array == NULL)
+ err(-1, "malloc");
+ protocount = 0;
+ for (i = 0; i < maxprot; i++) {
+ npp = &np_array[i];
+ if (npp->np_name == NULL)
+ continue;
+ snpp = &proto_array[protocount];
+ snpp->snp_version = sizeof(*snpp);
+ netisr_load_kvm_string((uintptr_t)npp->np_name,
+ snpp->snp_name, sizeof(snpp->snp_name));
+ snpp->snp_proto = i;
+ snpp->snp_qlimit = npp->np_qlimit;
+ snpp->snp_policy = npp->np_policy;
+ snpp->snp_dispatch = npp->np_dispatch;
+ if (npp->np_m2flow != NULL)
+ snpp->snp_flags |= NETISR_SNP_FLAGS_M2FLOW;
+ if (npp->np_m2cpuid != NULL)
+ snpp->snp_flags |= NETISR_SNP_FLAGS_M2CPUID;
+ if (npp->np_drainedcpu != NULL)
+ snpp->snp_flags |= NETISR_SNP_FLAGS_DRAINEDCPU;
+ protocount++;
+ }
+ proto_array_len = protocount;
+ free(np_array);
+}
+
+static void
+netisr_load_sysctl_proto(void)
+{
+ size_t len;
+
+ if (sysctlbyname("net.isr.proto", NULL, &len, NULL, 0) < 0)
+ xo_err(-1, "net.isr.proto: query len");
+ if (len % sizeof(*proto_array) != 0)
+ xo_errx(-1, "net.isr.proto: invalid len");
+ proto_array = malloc(len);
+ if (proto_array == NULL)
+ xo_err(-1, "malloc");
+ if (sysctlbyname("net.isr.proto", proto_array, &len, NULL, 0) < 0)
+ xo_err(-1, "net.isr.proto: query data");
+ if (len % sizeof(*proto_array) != 0)
+ xo_errx(-1, "net.isr.proto: invalid len");
+ proto_array_len = len / sizeof(*proto_array);
+ if (proto_array_len < 1)
+ xo_errx(-1, "net.isr.proto: no data");
+ if (proto_array[0].snp_version != sizeof(proto_array[0]))
+ xo_errx(-1, "net.isr.proto: invalid version");
+}
+
+static void
+netisr_load_kvm_workstream(void)
+{
+ struct netisr_workstream nws;
+ struct sysctl_netisr_workstream *snwsp;
+ struct sysctl_netisr_work *snwp;
+ struct netisr_work *nwp;
+ u_int counter, cpuid, proto, wsid;
+ size_t len;
+
+ len = numthreads * sizeof(*nws_array);
+ nws_array = malloc(len);
+ if (nws_array == NULL)
+ xo_err(-1, "malloc");
+ if (kread(nl[N_NWS_ARRAY].n_value, nws_array, len) != 0)
+ xo_errx(-1, "%s: kread(_nws_array)", __func__);
+ workstream_array = calloc(numthreads, sizeof(*workstream_array));
+ if (workstream_array == NULL)
+ xo_err(-1, "calloc");
+ workstream_array_len = numthreads;
+ work_array = calloc(numthreads * proto_array_len, sizeof(*work_array));
+ if (work_array == NULL)
+ xo_err(-1, "calloc");
+ counter = 0;
+ for (wsid = 0; wsid < numthreads; wsid++) {
+ cpuid = nws_array[wsid];
+ kset_dpcpu(cpuid);
+ if (kread(nl[N_NWS].n_value, &nws, sizeof(nws)) != 0)
+ xo_errx(-1, "%s: kread(nw)", __func__);
+ snwsp = &workstream_array[wsid];
+ snwsp->snws_version = sizeof(*snwsp);
+ snwsp->snws_wsid = cpuid;
+ snwsp->snws_cpu = cpuid;
+ if (nws.nws_intr_event != NULL)
+ snwsp->snws_flags |= NETISR_SNWS_FLAGS_INTR;
+
+ /*
+ * Extract the CPU's per-protocol work information.
+ */
+ xo_emit("counting to maxprot: {:maxprot/%u}\n", maxprot);
+ for (proto = 0; proto < maxprot; proto++) {
+ if (!netisr_protoispresent(proto))
+ continue;
+ nwp = &nws.nws_work[proto];
+ snwp = &work_array[counter];
+ snwp->snw_version = sizeof(*snwp);
+ snwp->snw_wsid = cpuid;
+ snwp->snw_proto = proto;
+ snwp->snw_len = nwp->nw_len;
+ snwp->snw_watermark = nwp->nw_watermark;
+ snwp->snw_dispatched = nwp->nw_dispatched;
+ snwp->snw_hybrid_dispatched =
+ nwp->nw_hybrid_dispatched;
+ snwp->snw_qdrops = nwp->nw_qdrops;
+ snwp->snw_queued = nwp->nw_queued;
+ snwp->snw_handled = nwp->nw_handled;
+ counter++;
+ }
+ }
+ work_array_len = counter;
+}
+
+static void
+netisr_load_sysctl_workstream(void)
+{
+ size_t len;
+
+ if (sysctlbyname("net.isr.workstream", NULL, &len, NULL, 0) < 0)
+ xo_err(-1, "net.isr.workstream: query len");
+ if (len % sizeof(*workstream_array) != 0)
+ xo_errx(-1, "net.isr.workstream: invalid len");
+ workstream_array = malloc(len);
+ if (workstream_array == NULL)
+ xo_err(-1, "malloc");
+ if (sysctlbyname("net.isr.workstream", workstream_array, &len, NULL,
+ 0) < 0)
+ xo_err(-1, "net.isr.workstream: query data");
+ if (len % sizeof(*workstream_array) != 0)
+ xo_errx(-1, "net.isr.workstream: invalid len");
+ workstream_array_len = len / sizeof(*workstream_array);
+ if (workstream_array_len < 1)
+ xo_errx(-1, "net.isr.workstream: no data");
+ if (workstream_array[0].snws_version != sizeof(workstream_array[0]))
+ xo_errx(-1, "net.isr.workstream: invalid version");
+}
+
+static void
+netisr_load_sysctl_work(void)
+{
+ size_t len;
+
+ if (sysctlbyname("net.isr.work", NULL, &len, NULL, 0) < 0)
+ xo_err(-1, "net.isr.work: query len");
+ if (len % sizeof(*work_array) != 0)
+ xo_errx(-1, "net.isr.work: invalid len");
+ work_array = malloc(len);
+ if (work_array == NULL)
+ xo_err(-1, "malloc");
+ if (sysctlbyname("net.isr.work", work_array, &len, NULL, 0) < 0)
+ xo_err(-1, "net.isr.work: query data");
+ if (len % sizeof(*work_array) != 0)
+ xo_errx(-1, "net.isr.work: invalid len");
+ work_array_len = len / sizeof(*work_array);
+ if (work_array_len < 1)
+ xo_errx(-1, "net.isr.work: no data");
+ if (work_array[0].snw_version != sizeof(work_array[0]))
+ xo_errx(-1, "net.isr.work: invalid version");
+}
+
+static void
+netisr_print_proto(struct sysctl_netisr_proto *snpp)
+{
+ char tmp[20];
+
+ xo_emit("{[:-6}{k:name/%s}{]:}", snpp->snp_name);
+ xo_emit(" {:protocol/%5u}", snpp->snp_proto);
+ xo_emit(" {:queue-limit/%6u}", snpp->snp_qlimit);
+ xo_emit(" {:policy-type/%6s}",
+ (snpp->snp_policy == NETISR_POLICY_SOURCE) ? "source" :
+ (snpp->snp_policy == NETISR_POLICY_FLOW) ? "flow" :
+ (snpp->snp_policy == NETISR_POLICY_CPU) ? "cpu" : "-");
+ netisr_dispatch_policy_to_string(snpp->snp_dispatch, tmp,
+ sizeof(tmp));
+ xo_emit(" {:policy/%8s}", tmp);
+ xo_emit(" {:flags/%s%s%s}\n",
+ (snpp->snp_flags & NETISR_SNP_FLAGS_M2CPUID) ? "C" : "-",
+ (snpp->snp_flags & NETISR_SNP_FLAGS_DRAINEDCPU) ? "D" : "-",
+ (snpp->snp_flags & NETISR_SNP_FLAGS_M2FLOW) ? "F" : "-");
+}
+
+static void
+netisr_print_workstream(struct sysctl_netisr_workstream *snwsp)
+{
+ struct sysctl_netisr_work *snwp;
+ u_int i;
+
+ xo_open_list("work");
+ for (i = 0; i < work_array_len; i++) {
+ snwp = &work_array[i];
+ if (snwp->snw_wsid != snwsp->snws_wsid)
+ continue;
+ xo_open_instance("work");
+ xo_emit("{t:workstream/%4u} ", snwsp->snws_wsid);
+ xo_emit("{t:cpu/%3u} ", snwsp->snws_cpu);
+ xo_emit("{P: }");
+ xo_emit("{t:name/%-6s}", netisr_proto2name(snwp->snw_proto));
+ xo_emit(" {t:length/%5u}", snwp->snw_len);
+ xo_emit(" {t:watermark/%5u}", snwp->snw_watermark);
+ xo_emit(" {t:dispatched/%8ju}", snwp->snw_dispatched);
+ xo_emit(" {t:hybrid-dispatched/%8ju}",
+ snwp->snw_hybrid_dispatched);
+ xo_emit(" {t:queue-drops/%8ju}", snwp->snw_qdrops);
+ xo_emit(" {t:queued/%8ju}", snwp->snw_queued);
+ xo_emit(" {t:handled/%8ju}", snwp->snw_handled);
+ xo_emit("\n");
+ xo_close_instance("work");
+ }
+ xo_close_list("work");
+}
+
+void
+netisr_stats(void)
+{
+ struct sysctl_netisr_workstream *snwsp;
+ struct sysctl_netisr_proto *snpp;
+ u_int i;
+
+ if (live) {
+ netisr_load_sysctl_config();
+ netisr_load_sysctl_proto();
+ netisr_load_sysctl_workstream();
+ netisr_load_sysctl_work();
+ } else {
+ netisr_load_kvm_config();
+ netisr_load_kvm_proto();
+ netisr_load_kvm_workstream(); /* Also does work. */
+ }
+
+ xo_open_container("netisr");
+
+ xo_emit("{T:Configuration}:\n");
+ xo_emit("{T:/%-25s} {T:/%12s} {T:/%12s}\n",
+ "Setting", "Current", "Limit");
+ xo_emit("{T:/%-25s} {T:/%12u} {T:/%12u}\n",
+ "Thread count", numthreads, maxthreads);
+ xo_emit("{T:/%-25s} {T:/%12u} {T:/%12u}\n",
+ "Default queue limit", defaultqlimit, maxqlimit);
+ xo_emit("{T:/%-25s} {T:/%12s} {T:/%12s}\n",
+ "Dispatch policy", dispatch_policy, "n/a");
+ xo_emit("{T:/%-25s} {T:/%12s} {T:/%12s}\n",
+ "Threads bound to CPUs", bindthreads ? "enabled" : "disabled",
+ "n/a");
+ xo_emit("\n");
+
+ xo_emit("{T:Protocols}:\n");
+ xo_emit("{T:/%-6s} {T:/%5s} {T:/%6s} {T:/%-6s} {T:/%-8s} {T:/%-5s}\n",
+ "Name", "Proto", "QLimit", "Policy", "Dispatch", "Flags");
+ xo_open_list("protocol");
+ for (i = 0; i < proto_array_len; i++) {
+ xo_open_instance("protocol");
+ snpp = &proto_array[i];
+ netisr_print_proto(snpp);
+ xo_close_instance("protocol");
+ }
+ xo_close_list("protocol");
+ xo_emit("\n");
+
+ xo_emit("{T:Workstreams}:\n");
+ xo_emit("{T:/%4s} {T:/%3s} ", "WSID", "CPU");
+ xo_emit("{P:/%2s}", "");
+ xo_emit("{T:/%-6s} {T:/%5s} {T:/%5s} {T:/%8s} {T:/%8s} {T:/%8s} "
+ "{T:/%8s} {T:/%8s}\n",
+ "Name", "Len", "WMark", "Disp'd", "HDisp'd", "QDrops", "Queued",
+ "Handled");
+ xo_open_list("workstream");
+ for (i = 0; i < workstream_array_len; i++) {
+ xo_open_instance("workstream");
+ snwsp = &workstream_array[i];
+ netisr_print_workstream(snwsp);
+ xo_close_instance("workstream");
+ }
+ xo_close_list("workstream");
+ xo_close_container("netisr");
+}
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
new file mode 100644
index 0000000..a7e5291
--- /dev/null
+++ b/usr.bin/netstat/netstat.1
@@ -0,0 +1,828 @@
+.\" Copyright (c) 1983, 1990, 1992, 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.
+.\"
+.\" @(#)netstat.1 8.8 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2015
+.Dt NETSTAT 1
+.Os
+.Sh NAME
+.Nm netstat
+.Nd show network status and statistics
+.Sh SYNOPSIS
+.Bk -words
+.Bl -tag -width "netstat"
+.It Nm
+.Op Fl -libxo
+.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 -libxo
+.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 -libxo
+.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 -libxo
+.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 -libxo
+.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 -libxo
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl B
+.Op Fl -libxo
+.Op Fl z
+.Op Fl I Ar interface
+.It Nm Fl r
+.Op Fl -libxo
+.Op Fl 46nW
+.Op Fl F Ar fibnum
+.Op Fl f Ar address_family
+.It Nm Fl rs
+.Op Fl -libxo
+.Op Fl s
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl g
+.Op Fl -libxo
+.Op Fl 46W
+.Op Fl f Ar address_family
+.It Nm Fl gs
+.Op Fl -libxo
+.Op Fl 46s
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl Q
+.Op Fl -libxo
+.El
+.Ek
+.Sh DESCRIPTION
+The
+.Nm
+command symbolically displays the contents of various network-related
+data structures.
+There are a number of output formats,
+depending on the options for the information presented.
+.Bl -tag -width indent
+.It Xo
+.Bk -words
+.Nm
+.Op Fl 46AaLnRSTWx
+.Op Fl f Ar protocol_family | Fl p Ar protocol
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Ek
+.Xc
+Display a list of active sockets
+(protocol control blocks)
+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 -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.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.
+.It Fl a
+Show the state of all sockets;
+normally sockets used by server processes are not shown.
+.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.
+.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.
+.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
+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.
+.It Li rexmt Ta Time, in seconds, to fire Retransmit Timer, or 0 if not armed.
+.It Li persist Ta Time, in seconds, to fire Retransmit Persistence, or 0 if not armed.
+.It Li keep Ta Time, in seconds, to fire Keep Alive, or 0 if not armed.
+.It Li 2msl Ta Time, in seconds, to fire 2*msl TIME_WAIT Timer, or 0 if not armed.
+.It Li delack Ta Time, in seconds, to fire Delayed ACK Timer, or 0 if not armed.
+.It Li rcvtime Ta Time, in seconds, since last packet received.
+.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
+.Ar interface
+which have been auto-configured
+(interfaces statically configured into a system, but not
+located at boot time are not shown).
+An asterisk
+.Pq Dq Li *
+after an interface name indicates that the interface is
+.Dq down .
+.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.
+.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 46d
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl q Ar howmany
+.Ek
+.Xc
+At intervals of
+.Ar wait
+seconds, display the information regarding packet traffic on all
+configured network interfaces or a single
+.Ar interface .
+.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.
+.El
+.It Xo
+.Bk -words
+.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
+.Ek
+.Xc
+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.
+.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 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.
+.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
+.Fl m
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Ek
+.Xc
+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
+.Fl B
+.Op Fl z
+.Op Fl I Ar interface
+.Ek
+.Xc
+Show statistics about
+.Xr bpf 4
+peers.
+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 46AnW
+.Op Fl F Ar fibnum
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Ek
+.Xc
+Display the contents of routing tables.
+.Pp
+When
+.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 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.
+.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
+.Fl rs
+.Op Fl s
+.Op Fl M Ar core
+.Op Fl N Ar system
+.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
+.Fl g
+.Op Fl 46W
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Ek
+.Xc
+Display the contents of the multicast virtual interface tables,
+and multicast forwarding caches.
+Entries in these tables will appear only when the kernel is
+actively forwarding multicast sessions.
+This option is applicable only to the
+.Cm inet
+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
+.Fl gs
+.Op Fl 46s
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.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
+.Fl Q
+.Ek
+.Xc
+Show
+.Xr netisr 9
+statistics.
+The flags field shows available ISR handlers:
+.Bl -column ".Li W" ".Dv NETISR_SNP_FLAGS_DRAINEDCPU"
+.It Li C Ta Dv NETISR_SNP_FLAGS_M2CPUID Ta "Able to map mbuf to cpu id"
+.It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler"
+.It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id"
+.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
+.Ar address_family
+or a single
+.Ar protocol .
+The following address families and protocols are recognized:
+.Pp
+.Bl -tag -width ".Cm netgraph , ng Pq Dv AF_NETGRAPH" -compact
+.It Em Family
+.Em Protocols
+.It Cm inet Pq Dv AF_INET
+.Cm divert , icmp , igmp , ip , ipsec , pim, sctp , tcp , udp
+.It Cm inet6 Pq Dv AF_INET6
+.Cm icmp6 , ip6 , ipsec6 , rip6 , tcp , udp
+.It Cm pfkey Pq Dv PF_KEY
+.Cm pfkey
+.It Cm netgraph , ng Pq Dv AF_NETGRAPH
+.Cm ctrl , data
+.It Cm unix Pq Dv AF_UNIX
+.It Cm link Pq Dv AF_LINK
+.El
+.Pp
+The program will complain if
+.Ar protocol
+is unknown or if there is no statistics routine for it.
+.It Fl M
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl N
+Extract the name list from the specified system instead of the default,
+which is the kernel image the system has booted from.
+.It Fl n
+Show network addresses and ports as numbers.
+Normally
+.Nm
+attempts to resolve addresses and ports,
+and display them symbolically.
+.El
+.Sh SEE ALSO
+.Xr fstat 1 ,
+.Xr nfsstat 1 ,
+.Xr procstat 1 ,
+.Xr ps 1 ,
+.Xr sockstat 1 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3 ,
+.Xr bpf 4 ,
+.Xr inet 4 ,
+.Xr route 4 ,
+.Xr unix 4 ,
+.Xr hosts 5 ,
+.Xr networks 5 ,
+.Xr protocols 5 ,
+.Xr services 5 ,
+.Xr iostat 8 ,
+.Xr route 8 ,
+.Xr trpt 8 ,
+.Xr vmstat 8 ,
+.Xr mbuf 9
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Pp
+IPv6 support was added by WIDE/KAME project.
+.Sh BUGS
+The notion of errors is ill-defined.
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
new file mode 100644
index 0000000..4db2844
--- /dev/null
+++ b/usr.bin/netstat/netstat.h
@@ -0,0 +1,148 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * 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.
+ *
+ * @(#)netstat.h 8.2 (Berkeley) 1/4/94
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
+#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
+
+extern int Aflag; /* show addresses of protocol control block */
+extern int aflag; /* show all sockets (including servers) */
+extern int bflag; /* show i/f total bytes in/out */
+extern int dflag; /* show i/f dropped packets */
+extern int gflag; /* show group (multicast) routing or stats */
+extern int hflag; /* show counters in human readable format */
+extern int iflag; /* show interfaces */
+extern int Lflag; /* show size of listen queues */
+extern int mflag; /* show memory stats */
+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 */
+extern int xflag; /* extended display, includes all socket buffer info */
+extern int zflag; /* zero stats */
+
+extern int interval; /* repeat interval for i/f stats */
+
+extern char *interface; /* desired i/f for stats, or NULL for all i/fs */
+extern int unit; /* unit number for above */
+
+extern int live; /* true if we are examining a live system */
+
+typedef int kreadfn_t(u_long, void *, size_t);
+int fetch_stats(const char *, u_long, void *, size_t, kreadfn_t);
+int fetch_stats_ro(const char *, u_long, void *, size_t, kreadfn_t);
+
+int kread(u_long addr, void *buf, size_t size);
+uint64_t kread_counter(u_long addr);
+int kread_counters(u_long addr, void *buf, size_t size);
+void kset_dpcpu(u_int);
+const char *plural(uintmax_t);
+const char *plurales(uintmax_t);
+const char *pluralies(uintmax_t);
+
+struct sockaddr;
+struct socket;
+struct xsocket;
+int sotoxsocket(struct socket *, struct xsocket *);
+void protopr(u_long, const char *, int, int);
+void tcp_stats(u_long, const char *, int, int);
+void udp_stats(u_long, const char *, int, int);
+#ifdef SCTP
+void sctp_protopr(u_long, const char *, int, int);
+void sctp_stats(u_long, const char *, int, int);
+#endif
+void arp_stats(u_long, const char *, int, int);
+void ip_stats(u_long, const char *, int, int);
+void icmp_stats(u_long, const char *, int, int);
+void igmp_stats(u_long, const char *, int, int);
+void pim_stats(u_long, const char *, int, int);
+void carp_stats(u_long, const char *, int, int);
+void pfsync_stats(u_long, const char *, int, int);
+#ifdef IPSEC
+void ipsec_stats(u_long, const char *, int, int);
+void esp_stats(u_long, const char *, int, int);
+void ah_stats(u_long, const char *, int, int);
+void ipcomp_stats(u_long, const char *, int, int);
+#endif
+
+#ifdef INET6
+void ip6_stats(u_long, const char *, int, int);
+void ip6_ifstats(char *);
+void icmp6_stats(u_long, const char *, int, int);
+void icmp6_ifstats(char *);
+void pim6_stats(u_long, const char *, int, int);
+void rip6_stats(u_long, const char *, int, int);
+void mroute6pr(void);
+void mrt6_stats(void);
+
+struct sockaddr_in6;
+struct in6_addr;
+void in6_fillscopeid(struct sockaddr_in6 *);
+void inet6print(const char *, struct in6_addr *, int, const char *, int);
+#endif /*INET6*/
+
+#ifdef IPSEC
+void pfkey_stats(u_long, const char *, int, int);
+#endif
+
+void mbpr(void *, u_long);
+
+void netisr_stats(void);
+
+void hostpr(u_long, u_long);
+void impstats(u_long, u_long);
+
+void intpr(void (*)(char *), int);
+
+void pr_family(int);
+void rt_stats(void);
+void flowtable_stats(void);
+
+char *routename(struct sockaddr *, int);
+const char *netname(struct sockaddr *, struct sockaddr *);
+void routepr(int, int);
+
+#ifdef NETGRAPH
+void netgraphprotopr(u_long, const char *, int, int);
+#endif
+
+void unixpr(u_long, u_long, u_long, u_long, u_long, bool *);
+
+void mroutepr(void);
+void mrt_stats(void);
+void bpf_stats(char *);
diff --git a/usr.bin/netstat/nlist_symbols b/usr.bin/netstat/nlist_symbols
new file mode 100644
index 0000000..afad45d
--- /dev/null
+++ b/usr.bin/netstat/nlist_symbols
@@ -0,0 +1,55 @@
+# $FreeBSD$
+#
+# module_name symbol_name
+all _ahstat
+all _arpstat
+all _carpstats
+all _divcbinfo
+all _espstat
+all _icmp6stat
+all _icmpstat
+all _igmpstat
+all _ip6stat
+all _ipcompstat
+all _ipsec4stat
+all _ipsec6stat
+all _ipstat
+all _mf6ctable
+all _mfchashtbl
+all _mfctablesize
+all _mif6table
+all _mrt6stat
+all _mrtstat
+all _netisr_bindthreads
+all _netisr_defaultqlimit
+all _netisr_dispatch_policy
+all _netisr_maxprot
+all _netisr_maxqlimit
+all _netisr_maxthreads
+all _netisr_proto
+all _ngsocklist
+all _nws
+all _nws_array
+all _nws_count
+all _pfkeystat
+all _pfsyncstats
+all _pim6stat
+all _pimstat
+all _rip6stat
+all _ripcbinfo
+all _rtree
+all _rtstat
+all _rttrash
+all _sctpstat
+all _sfstat
+all _tcbinfo
+all _tcpstat
+all _tcps_states
+all _udbinfo
+all _udpstat
+all _unp_count
+all _unp_dhead
+all _unp_gencnt
+all _unp_shead
+all _unp_sphead
+all _viftable
diff --git a/usr.bin/netstat/pfkey.c b/usr.bin/netstat/pfkey.c
new file mode 100644
index 0000000..1a60b48
--- /dev/null
+++ b/usr.bin/netstat/pfkey.c
@@ -0,0 +1,208 @@
+/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */
+/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */
+/*-
+ * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+/*-
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+#include <netinet/in.h>
+
+#ifdef IPSEC
+#include <netipsec/keysock.h>
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+#ifdef IPSEC
+
+static const char *pfkey_msgtypenames[] = {
+ "reserved", "getspi", "update", "add", "delete",
+ "get", "acquire", "register", "expire", "flush",
+ "dump", "x_promisc", "x_pchange", "x_spdupdate", "x_spdadd",
+ "x_spddelete", "x_spdget", "x_spdacquire", "x_spddump", "x_spdflush",
+ "x_spdsetidx", "x_spdexpire", "x_spddelete2"
+};
+
+static const char *pfkey_msgtype_names (int);
+
+
+static const char *
+pfkey_msgtype_names(int x)
+{
+ const int max =
+ sizeof(pfkey_msgtypenames)/sizeof(pfkey_msgtypenames[0]);
+ static char buf[20];
+
+ if (x < max && pfkey_msgtypenames[x])
+ return pfkey_msgtypenames[x];
+ snprintf(buf, sizeof(buf), "#%d", x);
+ return buf;
+}
+
+void
+pfkey_stats(u_long off, const char *name, int family __unused,
+ int proto __unused)
+{
+ struct pfkeystat pfkeystat;
+ unsigned first, type;
+
+ if (off == 0)
+ return;
+ xo_emit("{T:/%s}:\n", name);
+ xo_open_container(name);
+ kread_counters(off, (char *)&pfkeystat, sizeof(pfkeystat));
+
+#define p(f, m) if (pfkeystat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)pfkeystat.f, plural(pfkeystat.f))
+
+ /* userland -> kernel */
+ p(out_total, "\t{:sent-requests/%ju} "
+ "{N:/request%s sent from userland}\n");
+ p(out_bytes, "\t{:sent-bytes/%ju} "
+ "{N:/byte%s sent from userland}\n");
+ for (first = 1, type = 0;
+ type<sizeof(pfkeystat.out_msgtype)/sizeof(pfkeystat.out_msgtype[0]);
+ type++) {
+ if (pfkeystat.out_msgtype[type] <= 0)
+ continue;
+ if (first) {
+ xo_open_list("output-histogram");
+ xo_emit("\t{T:histogram by message type}:\n");
+ first = 0;
+ }
+ xo_open_instance("output-histogram");
+ xo_emit("\t\t{k::type/%s}: {:count/%ju}\n",
+ pfkey_msgtype_names(type),
+ (uintmax_t)pfkeystat.out_msgtype[type]);
+ xo_close_instance("output-histogram");
+ }
+ if (!first)
+ xo_close_list("output-histogram");
+
+ p(out_invlen, "\t{:dropped-bad-length/%ju} "
+ "{N:/message%s with invalid length field}\n");
+ p(out_invver, "\t{:dropped-bad-version/%ju} "
+ "{N:/message%s with invalid version field}\n");
+ p(out_invmsgtype, "\t{:dropped-bad-type/%ju} "
+ "{N:/message%s with invalid message type field}\n");
+ p(out_tooshort, "\t{:dropped-too-short/%ju} "
+ "{N:/message%s too short}\n");
+ p(out_nomem, "\t{:dropped-no-memory/%ju} "
+ "{N:/message%s with memory allocation failure}\n");
+ p(out_dupext, "\t{:dropped-duplicate-extension/%ju} "
+ "{N:/message%s with duplicate extension}\n");
+ p(out_invexttype, "\t{:dropped-bad-extension/%ju} "
+ "{N:/message%s with invalid extension type}\n");
+ p(out_invsatype, "\t{:dropped-bad-sa-type/%ju} "
+ "{N:/message%s with invalid sa type}\n");
+ p(out_invaddr, "\t{:dropped-bad-address-extension/%ju} "
+ "{N:/message%s with invalid address extension}\n");
+
+ /* kernel -> userland */
+ p(in_total, "\t{:received-requests/%ju} "
+ "{N:/request%s sent to userland}\n");
+ p(in_bytes, "\t{:received-bytes/%ju} "
+ "{N:/byte%s sent to userland}\n");
+ for (first = 1, type = 0;
+ type < sizeof(pfkeystat.in_msgtype)/sizeof(pfkeystat.in_msgtype[0]);
+ type++) {
+ if (pfkeystat.in_msgtype[type] <= 0)
+ continue;
+ if (first) {
+ xo_open_list("input-histogram");
+ xo_emit("\t{T:histogram by message type}:\n");
+ first = 0;
+ }
+ xo_open_instance("input-histogram");
+ xo_emit("\t\t{k:type/%s}: {:count/%ju}\n",
+ pfkey_msgtype_names(type),
+ (uintmax_t)pfkeystat.in_msgtype[type]);
+ xo_close_instance("input-histogram");
+ }
+ if (!first)
+ xo_close_list("input-histogram");
+ p(in_msgtarget[KEY_SENDUP_ONE], "\t{:received-one-socket/%ju} "
+ "{N:/message%s toward single socket}\n");
+ p(in_msgtarget[KEY_SENDUP_ALL], "\t{:received-all-sockets/%ju} "
+ "{N:/message%s toward all sockets}\n");
+ p(in_msgtarget[KEY_SENDUP_REGISTERED],
+ "\t{:received-registered-sockets/%ju} "
+ "{N:/message%s toward registered sockets}\n");
+ p(in_nomem, "\t{:discarded-no-memory/%ju} "
+ "{N:/message%s with memory allocation failure}\n");
+#undef p
+ xo_close_container(name);
+}
+#endif /* IPSEC */
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
new file mode 100644
index 0000000..1cd831b
--- /dev/null
+++ b/usr.bin/netstat/route.c
@@ -0,0 +1,787 @@
+/*-
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/route.h>
+
+#include <netinet/in.h>
+#include <netgraph/ng_socket.h>
+
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <libutil.h>
+#include <netdb.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <err.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+#include "nl_defs.h"
+
+/*
+ * Definitions for showing gateway flags.
+ */
+static struct bits {
+ u_long b_mask;
+ char b_val;
+ const char *b_name;
+} bits[] = {
+ { RTF_UP, 'U', "up" },
+ { RTF_GATEWAY, 'G', "gateway" },
+ { RTF_HOST, 'H', "host" },
+ { RTF_REJECT, 'R', "reject" },
+ { RTF_DYNAMIC, 'D', "dynamic" },
+ { RTF_MODIFIED, 'M', "modified" },
+ { RTF_DONE, 'd', "done" }, /* Completed -- for routing msgs only */
+ { RTF_XRESOLVE, 'X', "xresolve" },
+ { RTF_STATIC, 'S', "static" },
+ { RTF_PROTO1, '1', "proto1" },
+ { RTF_PROTO2, '2', "proto2" },
+ { RTF_PROTO3, '3', "proto3" },
+ { RTF_BLACKHOLE,'B', "blackhole" },
+ { RTF_BROADCAST,'b', "broadcast" },
+#ifdef RTF_LLINFO
+ { RTF_LLINFO, 'L', "llinfo" },
+#endif
+ { 0 , 0, NULL }
+};
+
+struct ifmap_entry {
+ char ifname[IFNAMSIZ];
+};
+static struct ifmap_entry *ifmap;
+static int ifmap_size;
+static struct timespec uptime;
+
+static const char *netname4(in_addr_t, in_addr_t);
+static const char *netname6(struct sockaddr_in6 *, struct sockaddr_in6 *);
+static void p_rtable_sysctl(int, int);
+static void p_rtentry_sysctl(const char *name, struct rt_msghdr *);
+static int p_sockaddr(const char *name, struct sockaddr *, struct sockaddr *,
+ int, int);
+static const char *fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask,
+ int flags);
+static void p_flags(int, const char *);
+static const char *fmt_flags(int f);
+static void domask(char *, in_addr_t, u_long);
+
+
+/*
+ * Print routing tables.
+ */
+void
+routepr(int fibnum, int af)
+{
+ size_t intsize;
+ int numfibs;
+
+ if (live == 0)
+ return;
+
+ intsize = sizeof(int);
+ if (fibnum == -1 &&
+ sysctlbyname("net.my_fibnum", &fibnum, &intsize, NULL, 0) == -1)
+ fibnum = 0;
+ if (sysctlbyname("net.fibs", &numfibs, &intsize, NULL, 0) == -1)
+ numfibs = 1;
+ if (fibnum < 0 || fibnum > numfibs - 1)
+ errx(EX_USAGE, "%d: invalid fib", fibnum);
+ /*
+ * Since kernel & userland use different timebase
+ * (time_uptime vs time_second) and we are reading kernel memory
+ * directly we should do rt_expire --> expire_time conversion.
+ */
+ if (clock_gettime(CLOCK_UPTIME, &uptime) < 0)
+ err(EX_OSERR, "clock_gettime() failed");
+
+ xo_open_container("route-information");
+ xo_emit("{T:Routing tables}");
+ if (fibnum)
+ xo_emit(" ({L:fib}: {:fib/%d})", fibnum);
+ xo_emit("\n");
+ p_rtable_sysctl(fibnum, af);
+ xo_close_container("route-information");
+}
+
+
+/*
+ * Print address family header before a section of the routing table.
+ */
+void
+pr_family(int af1)
+{
+ const char *afname;
+
+ switch (af1) {
+ case AF_INET:
+ afname = "Internet";
+ break;
+#ifdef INET6
+ case AF_INET6:
+ afname = "Internet6";
+ break;
+#endif /*INET6*/
+ case AF_ISO:
+ afname = "ISO";
+ break;
+ case AF_CCITT:
+ afname = "X.25";
+ break;
+ case AF_NETGRAPH:
+ afname = "Netgraph";
+ break;
+ default:
+ afname = NULL;
+ break;
+ }
+ if (afname)
+ xo_emit("\n{k:address-family/%s}:\n", afname);
+ else
+ xo_emit("\n{L:Protocol Family} {k:address-family/%d}:\n", af1);
+}
+
+/* column widths; each followed by one space */
+#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 ? 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 ? 10 : 8))
+#endif /*INET6*/
+
+static int wid_dst;
+static int wid_gw;
+static int wid_flags;
+static int wid_pksent;
+static int wid_mtu;
+static int wid_if;
+static int wid_expire;
+
+/*
+ * Print header for routing table columns.
+ */
+static void
+pr_rthdr(int af1 __unused)
+{
+
+ if (Wflag) {
+ xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%*.*s} "
+ "{T:/%*.*s} {T:/%*.*s} {T:/%*s}\n",
+ wid_dst, wid_dst, "Destination",
+ wid_gw, wid_gw, "Gateway",
+ wid_flags, wid_flags, "Flags",
+ wid_pksent, wid_pksent, "Use",
+ wid_mtu, wid_mtu, "Mtu",
+ wid_if, wid_if, "Netif",
+ wid_expire, "Expire");
+ } else {
+ xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%*.*s} "
+ "{T:/%*s}\n",
+ wid_dst, wid_dst, "Destination",
+ wid_gw, wid_gw, "Gateway",
+ wid_flags, wid_flags, "Flags",
+ wid_if, wid_if, "Netif",
+ wid_expire, "Expire");
+ }
+}
+
+static void
+p_rtable_sysctl(int fibnum, int af)
+{
+ size_t needed;
+ int mib[7];
+ char *buf, *next, *lim;
+ struct rt_msghdr *rtm;
+ struct sockaddr *sa;
+ int fam = AF_UNSPEC, ifindex = 0, size;
+ int need_table_close = false;
+
+ struct ifaddrs *ifap, *ifa;
+ struct sockaddr_dl *sdl;
+
+ /*
+ * Retrieve interface list at first
+ * since we need #ifindex -> if_xname match
+ */
+ if (getifaddrs(&ifap) != 0)
+ err(EX_OSERR, "getifaddrs");
+
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+
+ if (ifa->ifa_addr->sa_family != AF_LINK)
+ continue;
+
+ sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+ ifindex = sdl->sdl_index;
+
+ if (ifindex >= ifmap_size) {
+ size = roundup(ifindex + 1, 32) *
+ sizeof(struct ifmap_entry);
+ if ((ifmap = realloc(ifmap, size)) == NULL)
+ errx(2, "realloc(%d) failed", size);
+ memset(&ifmap[ifmap_size], 0,
+ size - ifmap_size *
+ sizeof(struct ifmap_entry));
+
+ ifmap_size = roundup(ifindex + 1, 32);
+ }
+
+ if (*ifmap[ifindex].ifname != '\0')
+ continue;
+
+ strlcpy(ifmap[ifindex].ifname, ifa->ifa_name, IFNAMSIZ);
+ }
+
+ freeifaddrs(ifap);
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+ mib[2] = 0;
+ mib[3] = af;
+ mib[4] = NET_RT_DUMP;
+ mib[5] = 0;
+ mib[6] = fibnum;
+ 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, nitems(mib), buf, &needed, NULL, 0) < 0)
+ err(1, "sysctl: net.route.0.%d.dump.%d", af, fibnum);
+ lim = buf + needed;
+ xo_open_container("route-table");
+ xo_open_list("rt-family");
+ 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
+ */
+ sa = (struct sockaddr *)(rtm + 1);
+ /* Only print family first time. */
+ if (fam != sa->sa_family) {
+ if (need_table_close) {
+ xo_close_list("rt-entry");
+ xo_close_instance("rt-family");
+ }
+ need_table_close = true;
+
+ fam = sa->sa_family;
+ wid_dst = WID_DST_DEFAULT(fam);
+ wid_gw = WID_GW_DEFAULT(fam);
+ wid_flags = 6;
+ wid_pksent = 8;
+ wid_mtu = 6;
+ wid_if = WID_IF_DEFAULT(fam);
+ wid_expire = 6;
+ xo_open_instance("rt-family");
+ pr_family(fam);
+ xo_open_list("rt-entry");
+
+ pr_rthdr(fam);
+ }
+ p_rtentry_sysctl("rt-entry", rtm);
+ }
+ if (need_table_close) {
+ xo_close_list("rt-entry");
+ xo_close_instance("rt-family");
+ }
+ xo_close_list("rt-family");
+ xo_close_container("route-table");
+ free(buf);
+}
+
+static void
+p_rtentry_sysctl(const char *name, struct rt_msghdr *rtm)
+{
+ struct sockaddr *sa, *addr[RTAX_MAX];
+ char buffer[128];
+ char prettyname[128];
+ int i, protrusion;
+
+ xo_open_instance(name);
+ sa = (struct sockaddr *)(rtm + 1);
+ for (i = 0; i < RTAX_MAX; i++) {
+ if (rtm->rtm_addrs & (1 << i))
+ addr[i] = sa;
+ sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa));
+ }
+
+ protrusion = p_sockaddr("destination", addr[RTAX_DST],
+ addr[RTAX_NETMASK],
+ rtm->rtm_flags, wid_dst);
+ protrusion = p_sockaddr("gateway", addr[RTAX_GATEWAY], NULL, RTF_HOST,
+ wid_gw - protrusion);
+ snprintf(buffer, sizeof(buffer), "{[:-%d}{:flags/%%s}{]:} ",
+ wid_flags - protrusion);
+ p_flags(rtm->rtm_flags, buffer);
+ if (Wflag) {
+ xo_emit("{t:use/%*lu} ", wid_pksent, rtm->rtm_rmx.rmx_pksent);
+
+ if (rtm->rtm_rmx.rmx_mtu != 0)
+ xo_emit("{t:mtu/%*lu} ", wid_mtu, rtm->rtm_rmx.rmx_mtu);
+ else
+ xo_emit("{P:/%*s} ", wid_mtu, "");
+ }
+
+ memset(prettyname, 0, sizeof(prettyname));
+ if (rtm->rtm_index < ifmap_size) {
+ strlcpy(prettyname, ifmap[rtm->rtm_index].ifname,
+ sizeof(prettyname));
+ if (*prettyname == '\0')
+ strlcpy(prettyname, "---", sizeof(prettyname));
+ }
+
+ if (Wflag)
+ xo_emit("{t:interface-name/%*s}", wid_if, prettyname);
+ else
+ xo_emit("{t:interface-name/%*.*s}", wid_if, wid_if,
+ prettyname);
+ if (rtm->rtm_rmx.rmx_expire) {
+ time_t expire_time;
+
+ if ((expire_time = rtm->rtm_rmx.rmx_expire - uptime.tv_sec) > 0)
+ xo_emit(" {:expire-time/%*d}", wid_expire,
+ (int)expire_time);
+ }
+
+ xo_emit("\n");
+ xo_close_instance(name);
+}
+
+static int
+p_sockaddr(const char *name, struct sockaddr *sa, struct sockaddr *mask,
+ int flags, int width)
+{
+ const char *cp;
+ char buf[128];
+ int protrusion;
+
+ cp = fmt_sockaddr(sa, mask, flags);
+
+ if (width < 0) {
+ snprintf(buf, sizeof(buf), "{:%s/%%s} ", name);
+ xo_emit(buf, cp);
+ protrusion = 0;
+ } else {
+ if (Wflag != 0 || numeric_addr) {
+ snprintf(buf, sizeof(buf), "{[:%d}{:%s/%%s}{]:} ",
+ -width, name);
+ xo_emit(buf, cp);
+ protrusion = strlen(cp) - width;
+ if (protrusion < 0)
+ protrusion = 0;
+ } else {
+ snprintf(buf, sizeof(buf), "{[:%d}{:%s/%%-.*s}{]:} ",
+ -width, name);
+ xo_emit(buf, width, cp);
+ protrusion = 0;
+ }
+ }
+ return (protrusion);
+}
+
+static const char *
+fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags)
+{
+ static char buf[128];
+ const char *cp;
+
+ if (sa == NULL)
+ return ("null");
+
+ switch(sa->sa_family) {
+#ifdef INET6
+ case AF_INET6:
+ /*
+ * The sa6->sin6_scope_id must be filled here because
+ * this sockaddr is extracted from kmem(4) directly
+ * and has KAME-specific embedded scope id in
+ * sa6->sin6_addr.s6_addr[2].
+ */
+ in6_fillscopeid(satosin6(sa));
+ /* FALLTHROUGH */
+#endif /*INET6*/
+ case AF_INET:
+ if (flags & RTF_HOST)
+ cp = routename(sa, numeric_addr);
+ else if (mask)
+ cp = netname(sa, mask);
+ else
+ cp = netname(sa, NULL);
+ break;
+ case AF_NETGRAPH:
+ {
+ strlcpy(buf, ((struct sockaddr_ng *)sa)->sg_data,
+ sizeof(buf));
+ cp = buf;
+ break;
+ }
+ case AF_LINK:
+ {
+#if 0
+ struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa;
+
+ /* Interface route. */
+ if (sdl->sdl_nlen)
+ cp = sdl->sdl_data;
+ else
+#endif
+ cp = routename(sa, 1);
+ break;
+ }
+ default:
+ {
+ u_char *s = (u_char *)sa->sa_data, *slim;
+ char *cq, *cqlim;
+
+ cq = buf;
+ slim = sa->sa_len + (u_char *) sa;
+ cqlim = cq + sizeof(buf) - 6;
+ cq += sprintf(cq, "(%d)", sa->sa_family);
+ while (s < slim && cq < cqlim) {
+ cq += sprintf(cq, " %02x", *s++);
+ if (s < slim)
+ cq += sprintf(cq, "%02x", *s++);
+ }
+ cp = buf;
+ }
+ }
+
+ return (cp);
+}
+
+static void
+p_flags(int f, const char *format)
+{
+ struct bits *p;
+
+ xo_emit(format, fmt_flags(f));
+
+ xo_open_list("flags_pretty");
+ for (p = bits; p->b_mask; p++)
+ if (p->b_mask & f)
+ xo_emit("{le:flags_pretty/%s}", p->b_name);
+ xo_close_list("flags_pretty");
+}
+
+static const char *
+fmt_flags(int f)
+{
+ static char name[33];
+ char *flags;
+ struct bits *p = bits;
+
+ for (flags = name; p->b_mask; p++)
+ if (p->b_mask & f)
+ *flags++ = p->b_val;
+ *flags = '\0';
+ return (name);
+}
+
+char *
+routename(struct sockaddr *sa, int flags)
+{
+ static char line[NI_MAXHOST];
+ int error, f;
+
+ f = (flags) ? NI_NUMERICHOST : 0;
+ error = getnameinfo(sa, sa->sa_len, line, sizeof(line),
+ NULL, 0, f);
+ if (error) {
+ const void *src;
+ switch (sa->sa_family) {
+#ifdef INET
+ case AF_INET:
+ src = &satosin(sa)->sin_addr;
+ break;
+#endif /* INET */
+#ifdef INET6
+ case AF_INET6:
+ src = &satosin6(sa)->sin6_addr;
+ break;
+#endif /* INET6 */
+ default:
+ return(line);
+ }
+ inet_ntop(sa->sa_family, src, line, sizeof(line) - 1);
+ return (line);
+ }
+ trimdomain(line, strlen(line));
+
+ return (line);
+}
+
+#define NSHIFT(m) ( \
+ (m) == IN_CLASSA_NET ? IN_CLASSA_NSHIFT : \
+ (m) == IN_CLASSB_NET ? IN_CLASSB_NSHIFT : \
+ (m) == IN_CLASSC_NET ? IN_CLASSC_NSHIFT : \
+ 0)
+
+static void
+domask(char *dst, in_addr_t addr __unused, u_long mask)
+{
+ int b, i;
+
+ if (mask == 0) {
+ *dst = '\0';
+ return;
+ }
+ i = 0;
+ for (b = 0; b < 32; b++)
+ if (mask & (1 << b)) {
+ int bb;
+
+ i = b;
+ for (bb = b+1; bb < 32; bb++)
+ if (!(mask & (1 << bb))) {
+ i = -1; /* noncontig */
+ break;
+ }
+ break;
+ }
+ if (i == -1)
+ sprintf(dst, "&0x%lx", mask);
+ else
+ sprintf(dst, "/%d", 32-i);
+}
+
+/*
+ * Return the name of the network whose address is given.
+ */
+const char *
+netname(struct sockaddr *sa, struct sockaddr *mask)
+{
+ switch (sa->sa_family) {
+ case AF_INET:
+ if (mask != NULL)
+ return (netname4(satosin(sa)->sin_addr.s_addr,
+ satosin(mask)->sin_addr.s_addr));
+ else
+ return (netname4(satosin(sa)->sin_addr.s_addr,
+ INADDR_ANY));
+ break;
+#ifdef INET6
+ case AF_INET6:
+ return (netname6(satosin6(sa), satosin6(mask)));
+#endif /* INET6 */
+ default:
+ return (NULL);
+ }
+}
+
+static const char *
+netname4(in_addr_t in, in_addr_t mask)
+{
+ char *cp = 0;
+ static char line[MAXHOSTNAMELEN + sizeof("/xx")];
+ char nline[INET_ADDRSTRLEN];
+ struct netent *np = 0;
+ in_addr_t i;
+
+ if (in == INADDR_ANY && mask == 0) {
+ strlcpy(line, "default", sizeof(line));
+ return (line);
+ }
+
+ /* It is ok to supply host address. */
+ in &= mask;
+
+ i = ntohl(in);
+ if (!numeric_addr && i) {
+ np = getnetbyaddr(i >> NSHIFT(ntohl(mask)), AF_INET);
+ if (np != NULL) {
+ cp = np->n_name;
+ trimdomain(cp, strlen(cp));
+ }
+ }
+ if (cp != NULL)
+ strlcpy(line, cp, sizeof(line));
+ else {
+ inet_ntop(AF_INET, &in, nline, sizeof(nline));
+ strlcpy(line, nline, sizeof(line));
+ domask(line + strlen(line), i, ntohl(mask));
+ }
+
+ return (line);
+}
+
+#undef NSHIFT
+
+#ifdef INET6
+void
+in6_fillscopeid(struct sockaddr_in6 *sa6)
+{
+#if defined(__KAME__)
+ /*
+ * XXX: This is a special workaround for KAME kernels.
+ * sin6_scope_id field of SA should be set in the future.
+ */
+ if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr) ||
+ IN6_IS_ADDR_MC_NODELOCAL(&sa6->sin6_addr) ||
+ IN6_IS_ADDR_MC_LINKLOCAL(&sa6->sin6_addr)) {
+ 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
+}
+
+/* Mask to length table. To check an invalid value, (length + 1) is used. */
+static int masktolen[256] = {
+ [0xff] = 8 + 1,
+ [0xfe] = 7 + 1,
+ [0xfc] = 6 + 1,
+ [0xf8] = 5 + 1,
+ [0xf0] = 4 + 1,
+ [0xe0] = 3 + 1,
+ [0xc0] = 2 + 1,
+ [0x80] = 1 + 1,
+ [0x00] = 0 + 1,
+};
+
+static const char *
+netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask)
+{
+ static char line[NI_MAXHOST + sizeof("/xxx") - 1];
+ struct sockaddr_in6 addr;
+ char nline[NI_MAXHOST];
+ u_char *p, *lim;
+ int masklen, illegal = 0, i;
+
+ if (mask) {
+ p = (u_char *)&mask->sin6_addr;
+ for (masklen = 0, lim = p + 16; p < lim; p++) {
+ if (masktolen[*p] > 0)
+ /* -1 is required. */
+ masklen += masktolen[*p] - 1;
+ else
+ illegal++;
+ }
+ if (illegal)
+ xo_error("illegal prefixlen\n");
+
+ memcpy(&addr, sa6, sizeof(addr));
+ for (i = 0; i < 16; ++i)
+ addr.sin6_addr.s6_addr[i] &=
+ mask->sin6_addr.s6_addr[i];
+ sa6 = &addr;
+ }
+ else
+ masklen = 128;
+
+ if (masklen == 0 && IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
+ return("default");
+
+ getnameinfo((struct sockaddr *)sa6, sa6->sin6_len, nline, sizeof(nline),
+ NULL, 0, NI_NUMERICHOST);
+ if (numeric_addr)
+ strlcpy(line, nline, sizeof(line));
+ else
+ getnameinfo((struct sockaddr *)sa6, sa6->sin6_len, line,
+ sizeof(line), NULL, 0, 0);
+ if (numeric_addr || strcmp(line, nline) == 0)
+ sprintf(&line[strlen(line)], "/%d", masklen);
+
+ return (line);
+}
+#endif /*INET6*/
+
+/*
+ * Print routing statistics
+ */
+void
+rt_stats(void)
+{
+ struct rtstat rtstat;
+ u_long rtsaddr, rttaddr;
+ int rttrash;
+
+ if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) {
+ xo_emit("{W:rtstat: symbol not in namelist}\n");
+ return;
+ }
+ if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
+ xo_emit("{W:rttrash: symbol not in namelist}\n");
+ return;
+ }
+ kread(rtsaddr, (char *)&rtstat, sizeof (rtstat));
+ kread(rttaddr, (char *)&rttrash, sizeof (rttrash));
+ xo_emit("{T:routing}:\n");
+
+#define p(f, m) if (rtstat.f || sflag <= 1) \
+ xo_emit(m, rtstat.f, plural(rtstat.f))
+
+ p(rts_badredirect, "\t{:bad-redirects/%hu} "
+ "{N:/bad routing redirect%s}\n");
+ p(rts_dynamic, "\t{:dynamically-created/%hu} "
+ "{N:/dynamically created route%s}\n");
+ p(rts_newgateway, "\t{:new-gateways/%hu} "
+ "{N:/new gateway%s due to redirects}\n");
+ p(rts_unreach, "\t{:unreachable-destination/%hu} "
+ "{N:/destination%s found unreachable}\n");
+ p(rts_wildcard, "\t{:wildcard-uses/%hu} "
+ "{N:/use%s of a wildcard route}\n");
+#undef p
+
+ if (rttrash || sflag <= 1)
+ xo_emit("\t{:unused-but-not-freed/%u} "
+ "{N:/route%s not in table but not freed}\n",
+ rttrash, plural(rttrash));
+}
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
new file mode 100644
index 0000000..0ab933a
--- /dev/null
+++ b/usr.bin/netstat/sctp.c
@@ -0,0 +1,919 @@
+/*-
+ * Copyright (c) 2001-2007, by Weongyo Jeong. All rights reserved.
+ * Copyright (c) 2011, by Michael Tuexen. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * a) Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * b) 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.
+ *
+ * c) Neither the name of Cisco Systems, Inc. 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 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)sctp.c 0.1 (Berkeley) 4/18/2007";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/protosw.h>
+
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <netinet/sctp_constants.h>
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libutil.h>
+#include <netdb.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include "netstat.h"
+#include <libxo/xo.h>
+
+#ifdef SCTP
+
+static void sctp_statesprint(uint32_t state);
+
+#define NETSTAT_SCTP_STATES_CLOSED 0x0
+#define NETSTAT_SCTP_STATES_BOUND 0x1
+#define NETSTAT_SCTP_STATES_LISTEN 0x2
+#define NETSTAT_SCTP_STATES_COOKIE_WAIT 0x3
+#define NETSTAT_SCTP_STATES_COOKIE_ECHOED 0x4
+#define NETSTAT_SCTP_STATES_ESTABLISHED 0x5
+#define NETSTAT_SCTP_STATES_SHUTDOWN_SENT 0x6
+#define NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED 0x7
+#define NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT 0x8
+#define NETSTAT_SCTP_STATES_SHUTDOWN_PENDING 0x9
+
+static const char *sctpstates[] = {
+ "CLOSED",
+ "BOUND",
+ "LISTEN",
+ "COOKIE_WAIT",
+ "COOKIE_ECHOED",
+ "ESTABLISHED",
+ "SHUTDOWN_SENT",
+ "SHUTDOWN_RECEIVED",
+ "SHUTDOWN_ACK_SENT",
+ "SHUTDOWN_PENDING"
+};
+
+static LIST_HEAD(xladdr_list, xladdr_entry) xladdr_head;
+struct xladdr_entry {
+ struct xsctp_laddr *xladdr;
+ LIST_ENTRY(xladdr_entry) xladdr_entries;
+};
+
+static LIST_HEAD(xraddr_list, xraddr_entry) xraddr_head;
+struct xraddr_entry {
+ struct xsctp_raddr *xraddr;
+ LIST_ENTRY(xraddr_entry) xraddr_entries;
+};
+
+/*
+ * Construct an Internet address representation.
+ * If numeric_addr has been supplied, give
+ * numeric value, otherwise try for symbolic name.
+ */
+#ifdef INET
+static char *
+inetname(struct in_addr *inp)
+{
+ char *cp;
+ static char line[MAXHOSTNAMELEN];
+ struct hostent *hp;
+ struct netent *np;
+
+ cp = 0;
+ if (!numeric_addr && inp->s_addr != INADDR_ANY) {
+ int net = inet_netof(*inp);
+ int lna = inet_lnaof(*inp);
+
+ if (lna == INADDR_ANY) {
+ np = getnetbyaddr(net, AF_INET);
+ if (np)
+ cp = np->n_name;
+ }
+ if (cp == NULL) {
+ hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
+ if (hp) {
+ cp = hp->h_name;
+ trimdomain(cp, strlen(cp));
+ }
+ }
+ }
+ if (inp->s_addr == INADDR_ANY)
+ strcpy(line, "*");
+ else if (cp) {
+ strlcpy(line, cp, sizeof(line));
+ } else {
+ inp->s_addr = ntohl(inp->s_addr);
+#define C(x) ((u_int)((x) & 0xff))
+ sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24),
+ C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr));
+ inp->s_addr = htonl(inp->s_addr);
+ }
+ return (line);
+}
+#endif
+
+#ifdef INET6
+static char ntop_buf[INET6_ADDRSTRLEN];
+
+static char *
+inet6name(struct in6_addr *in6p)
+{
+ char *cp;
+ static char line[50];
+ struct hostent *hp;
+ static char domain[MAXHOSTNAMELEN];
+ static int first = 1;
+
+ if (first && !numeric_addr) {
+ first = 0;
+ if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+ (cp = strchr(domain, '.')))
+ (void) strcpy(domain, cp + 1);
+ else
+ domain[0] = 0;
+ }
+ cp = 0;
+ if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
+ hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
+ if (hp) {
+ if ((cp = strchr(hp->h_name, '.')) &&
+ !strcmp(cp + 1, domain))
+ *cp = 0;
+ cp = hp->h_name;
+ }
+ }
+ if (IN6_IS_ADDR_UNSPECIFIED(in6p))
+ strcpy(line, "*");
+ else if (cp)
+ strcpy(line, cp);
+ else
+ sprintf(line, "%s",
+ inet_ntop(AF_INET6, (void *)in6p, ntop_buf,
+ sizeof(ntop_buf)));
+ return (line);
+}
+#endif
+
+static void
+sctp_print_address(const char *container, union sctp_sockstore *address,
+ int port, int num_port)
+{
+ struct servent *sp = 0;
+ char line[80], *cp;
+ int width;
+
+ if (container)
+ xo_open_container(container);
+
+ switch (address->sa.sa_family) {
+#ifdef INET
+ case AF_INET:
+ sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr));
+ break;
+#endif
+#ifdef INET6
+ case AF_INET6:
+ sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr));
+ break;
+#endif
+ default:
+ sprintf(line, "%.*s.", Wflag ? 39 : 16, "");
+ break;
+ }
+ cp = strchr(line, '\0');
+ if (!num_port && port)
+ sp = getservbyport((int)port, "sctp");
+ if (sp || port == 0)
+ sprintf(cp, "%.15s ", sp ? sp->s_name : "*");
+ else
+ sprintf(cp, "%d ", ntohs((u_short)port));
+ width = Wflag ? 45 : 22;
+ xo_emit("{d:target/%-*.*s} ", width, width, line);
+
+ int alen = cp - line - 1, plen = strlen(cp) - 1;
+ xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen,
+ plen, cp);
+
+ if (container)
+ xo_close_container(container);
+}
+
+static int
+sctp_skip_xinpcb_ifneed(char *buf, const size_t buflen, size_t *offset)
+{
+ int exist_tcb = 0;
+ struct xsctp_tcb *xstcb;
+ struct xsctp_raddr *xraddr;
+ struct xsctp_laddr *xladdr;
+
+ while (*offset < buflen) {
+ xladdr = (struct xsctp_laddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last == 1)
+ break;
+ }
+
+ while (*offset < buflen) {
+ xstcb = (struct xsctp_tcb *)(buf + *offset);
+ *offset += sizeof(struct xsctp_tcb);
+ if (xstcb->last == 1)
+ break;
+
+ exist_tcb = 1;
+
+ while (*offset < buflen) {
+ xladdr = (struct xsctp_laddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last == 1)
+ break;
+ }
+
+ while (*offset < buflen) {
+ xraddr = (struct xsctp_raddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_raddr);
+ if (xraddr->last == 1)
+ break;
+ }
+ }
+
+ /*
+ * If Lflag is set, we don't care about the return value.
+ */
+ if (Lflag)
+ return 0;
+
+ return exist_tcb;
+}
+
+static void
+sctp_process_tcb(struct xsctp_tcb *xstcb,
+ char *buf, const size_t buflen, size_t *offset, int *indent)
+{
+ int i, xl_total = 0, xr_total = 0, x_max;
+ struct xsctp_raddr *xraddr;
+ struct xsctp_laddr *xladdr;
+ struct xladdr_entry *prev_xl = NULL, *xl = NULL, *xl_tmp;
+ struct xraddr_entry *prev_xr = NULL, *xr = NULL, *xr_tmp;
+
+ LIST_INIT(&xladdr_head);
+ LIST_INIT(&xraddr_head);
+
+ /*
+ * Make `struct xladdr_list' list and `struct xraddr_list' list
+ * to handle the address flexibly.
+ */
+ while (*offset < buflen) {
+ xladdr = (struct xsctp_laddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last == 1)
+ break;
+
+ prev_xl = xl;
+ xl = malloc(sizeof(struct xladdr_entry));
+ if (xl == NULL) {
+ xo_warnx("malloc %lu bytes",
+ (u_long)sizeof(struct xladdr_entry));
+ goto out;
+ }
+ xl->xladdr = xladdr;
+ if (prev_xl == NULL)
+ LIST_INSERT_HEAD(&xladdr_head, xl, xladdr_entries);
+ else
+ LIST_INSERT_AFTER(prev_xl, xl, xladdr_entries);
+ xl_total++;
+ }
+
+ while (*offset < buflen) {
+ xraddr = (struct xsctp_raddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_raddr);
+ if (xraddr->last == 1)
+ break;
+
+ prev_xr = xr;
+ xr = malloc(sizeof(struct xraddr_entry));
+ if (xr == NULL) {
+ xo_warnx("malloc %lu bytes",
+ (u_long)sizeof(struct xraddr_entry));
+ goto out;
+ }
+ xr->xraddr = xraddr;
+ if (prev_xr == NULL)
+ LIST_INSERT_HEAD(&xraddr_head, xr, xraddr_entries);
+ else
+ LIST_INSERT_AFTER(prev_xr, xr, xraddr_entries);
+ xr_total++;
+ }
+
+ /*
+ * Let's print the address infos.
+ */
+ xo_open_list("address");
+ xl = LIST_FIRST(&xladdr_head);
+ xr = LIST_FIRST(&xraddr_head);
+ x_max = MAX(xl_total, xr_total);
+ for (i = 0; i < x_max; i++) {
+ xo_open_instance("address");
+
+ if (((*indent == 0) && i > 0) || *indent > 0)
+ xo_emit("{P:/%-12s} ", " ");
+
+ if (xl != NULL) {
+ sctp_print_address("local", &(xl->xladdr->address),
+ htons(xstcb->local_port), numeric_port);
+ } else {
+ if (Wflag) {
+ xo_emit("{P:/%-45s} ", " ");
+ } else {
+ xo_emit("{P:/%-22s} ", " ");
+ }
+ }
+
+ if (xr != NULL && !Lflag) {
+ sctp_print_address("remote", &(xr->xraddr->address),
+ htons(xstcb->remote_port), numeric_port);
+ }
+
+ if (xl != NULL)
+ xl = LIST_NEXT(xl, xladdr_entries);
+ if (xr != NULL)
+ xr = LIST_NEXT(xr, xraddr_entries);
+
+ if (i == 0 && !Lflag)
+ sctp_statesprint(xstcb->state);
+
+ if (i < x_max)
+ xo_emit("\n");
+ xo_close_instance("address");
+ }
+
+out:
+ /*
+ * Free the list which be used to handle the address.
+ */
+ xl = LIST_FIRST(&xladdr_head);
+ while (xl != NULL) {
+ xl_tmp = LIST_NEXT(xl, xladdr_entries);
+ free(xl);
+ xl = xl_tmp;
+ }
+
+ xr = LIST_FIRST(&xraddr_head);
+ while (xr != NULL) {
+ xr_tmp = LIST_NEXT(xr, xraddr_entries);
+ free(xr);
+ xr = xr_tmp;
+ }
+}
+
+static void
+sctp_process_inpcb(struct xsctp_inpcb *xinpcb,
+ char *buf, const size_t buflen, size_t *offset)
+{
+ int indent = 0, xladdr_total = 0, is_listening = 0;
+ static int first = 1;
+ const char *tname, *pname;
+ struct xsctp_tcb *xstcb;
+ struct xsctp_laddr *xladdr;
+ size_t offset_laddr;
+ int process_closed;
+
+ if (xinpcb->maxqlen > 0)
+ is_listening = 1;
+
+ if (first) {
+ if (!Lflag) {
+ xo_emit("Active SCTP associations");
+ if (aflag)
+ xo_emit(" (including servers)");
+ } else
+ xo_emit("Current listen queue sizes (qlen/maxqlen)");
+ xo_emit("\n");
+ if (Lflag)
+ xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-8.8s} "
+ "{T:/%-22.22s}\n",
+ "Proto", "Type", "Listen", "Local Address");
+ else
+ if (Wflag)
+ xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-45.45s} "
+ "{T:/%-45.45s} {T:/%s}\n",
+ "Proto", "Type",
+ "Local Address", "Foreign Address",
+ "(state)");
+ else
+ xo_emit("{T:/%-6.6s} {T:/%-5.5s} {T:/%-22.22s} "
+ "{T:/%-22.22s} {T:/%s}\n",
+ "Proto", "Type",
+ "Local Address", "Foreign Address",
+ "(state)");
+ first = 0;
+ }
+ xladdr = (struct xsctp_laddr *)(buf + *offset);
+ if (Lflag && !is_listening) {
+ sctp_skip_xinpcb_ifneed(buf, buflen, offset);
+ return;
+ }
+
+ if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) {
+ /* Can't distinguish between sctp46 and sctp6 */
+ pname = "sctp46";
+ } else {
+ pname = "sctp4";
+ }
+
+ if (xinpcb->flags & SCTP_PCB_FLAGS_TCPTYPE)
+ tname = "1to1";
+ else if (xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE)
+ tname = "1toN";
+ else
+ tname = "????";
+
+ if (Lflag) {
+ char buf1[22];
+
+ snprintf(buf1, sizeof buf1, "%u/%u",
+ xinpcb->qlen, xinpcb->maxqlen);
+ xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
+ pname, tname);
+ xo_emit("{d:queues/%-8.8s}{e:queue-len/%hu}"
+ "{e:max-queue-len/%hu} ",
+ buf1, xinpcb->qlen, xinpcb->maxqlen);
+ }
+
+ offset_laddr = *offset;
+ process_closed = 0;
+
+ xo_open_list("local-address");
+retry:
+ while (*offset < buflen) {
+ xladdr = (struct xsctp_laddr *)(buf + *offset);
+ *offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last) {
+ if (aflag && !Lflag && (xladdr_total == 0) && process_closed) {
+ xo_open_instance("local-address");
+
+ xo_emit("{:protocol/%-6.6s/%s} "
+ "{:type/%-5.5s/%s} ", pname, tname);
+ if (Wflag) {
+ xo_emit("{P:/%-91.91s/%s} "
+ "{:state/CLOSED}", " ");
+ } else {
+ xo_emit("{P:/%-45.45s/%s} "
+ "{:state/CLOSED}", " ");
+ }
+ xo_close_instance("local-address");
+ }
+ if (process_closed || is_listening) {
+ xo_emit("\n");
+ }
+ break;
+ }
+
+ if (!Lflag && !is_listening && !process_closed)
+ continue;
+
+ xo_open_instance("local-address");
+
+ if (xladdr_total == 0) {
+ xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
+ pname, tname);
+ } else {
+ xo_emit("\n");
+ xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ",
+ " ");
+ }
+ sctp_print_address("local", &(xladdr->address),
+ htons(xinpcb->local_port), numeric_port);
+ if (aflag && !Lflag && xladdr_total == 0) {
+ if (Wflag) {
+ if (process_closed) {
+ xo_emit("{P:/%-45.45s} "
+ "{:state/CLOSED}", " ");
+ } else {
+ xo_emit("{P:/%-45.45s} "
+ "{:state:LISTEN}", " ");
+ }
+ } else {
+ if (process_closed) {
+ xo_emit("{P:/%-22.22s} "
+ "{:state/CLOSED}", " ");
+ } else {
+ xo_emit("{P:/%-22.22s} "
+ "{:state/LISTEN}", " ");
+ }
+ }
+ }
+ xladdr_total++;
+ xo_close_instance("local-address");
+ }
+
+ xstcb = (struct xsctp_tcb *)(buf + *offset);
+ *offset += sizeof(struct xsctp_tcb);
+ if (aflag && (xladdr_total == 0) && xstcb->last && !process_closed) {
+ process_closed = 1;
+ *offset = offset_laddr;
+ goto retry;
+ }
+ while (xstcb->last == 0 && *offset < buflen) {
+ xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
+ pname, tname);
+ sctp_process_tcb(xstcb, buf, buflen, offset, &indent);
+ indent++;
+ xstcb = (struct xsctp_tcb *)(buf + *offset);
+ *offset += sizeof(struct xsctp_tcb);
+ }
+
+ xo_close_list("local-address");
+}
+
+/*
+ * Print a summary of SCTP connections related to an Internet
+ * protocol.
+ */
+void
+sctp_protopr(u_long off __unused,
+ const char *name __unused, int af1 __unused, int proto)
+{
+ char *buf;
+ const char *mibvar = "net.inet.sctp.assoclist";
+ size_t offset = 0;
+ size_t len = 0;
+ struct xsctp_inpcb *xinpcb;
+
+ if (proto != IPPROTO_SCTP)
+ return;
+
+ if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
+ if (errno != ENOENT)
+ xo_warn("sysctl: %s", mibvar);
+ return;
+ }
+ if ((buf = malloc(len)) == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return;
+ }
+ if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
+ xo_warn("sysctl: %s", mibvar);
+ free(buf);
+ return;
+ }
+
+ xinpcb = (struct xsctp_inpcb *)(buf + offset);
+ offset += sizeof(struct xsctp_inpcb);
+ while (xinpcb->last == 0 && offset < len) {
+ sctp_process_inpcb(xinpcb, buf, (const size_t)len,
+ &offset);
+
+ xinpcb = (struct xsctp_inpcb *)(buf + offset);
+ offset += sizeof(struct xsctp_inpcb);
+ }
+
+ free(buf);
+}
+
+static void
+sctp_statesprint(uint32_t state)
+{
+ int idx;
+
+ switch (state) {
+ case SCTP_CLOSED:
+ idx = NETSTAT_SCTP_STATES_CLOSED;
+ break;
+ case SCTP_BOUND:
+ idx = NETSTAT_SCTP_STATES_BOUND;
+ break;
+ case SCTP_LISTEN:
+ idx = NETSTAT_SCTP_STATES_LISTEN;
+ break;
+ case SCTP_COOKIE_WAIT:
+ idx = NETSTAT_SCTP_STATES_COOKIE_WAIT;
+ break;
+ case SCTP_COOKIE_ECHOED:
+ idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED;
+ break;
+ case SCTP_ESTABLISHED:
+ idx = NETSTAT_SCTP_STATES_ESTABLISHED;
+ break;
+ case SCTP_SHUTDOWN_SENT:
+ idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT;
+ break;
+ case SCTP_SHUTDOWN_RECEIVED:
+ idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED;
+ break;
+ case SCTP_SHUTDOWN_ACK_SENT:
+ idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT;
+ break;
+ case SCTP_SHUTDOWN_PENDING:
+ idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING;
+ break;
+ default:
+ xo_emit("UNKNOWN {:state/0x%08x}", state);
+ return;
+ }
+
+ xo_emit("{:state/%s}", sctpstates[idx]);
+}
+
+/*
+ * Dump SCTP statistics structure.
+ */
+void
+sctp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
+{
+ struct sctpstat sctpstat;
+
+ if (fetch_stats("net.inet.sctp.stats", off, &sctpstat,
+ sizeof(sctpstat), kread) != 0)
+ return;
+
+ xo_open_container(name);
+ xo_emit("{T:/%s}:\n", name);
+
+#define p(f, m) if (sctpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)sctpstat.f, plural(sctpstat.f))
+#define p1a(f, m) if (sctpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t)sctpstat.f)
+
+ /*
+ * input statistics
+ */
+ p(sctps_recvpackets, "\t{:received-packets/%ju} "
+ "{N:/input packet%s}\n");
+ p(sctps_recvdatagrams, "\t\t{:received-datagrams/%ju} "
+ "{N:/datagram%s}\n");
+ p(sctps_recvpktwithdata, "\t\t{:received-with-data/%ju} "
+ "{N:/packet%s that had data}\n");
+ p(sctps_recvsacks, "\t\t{:received-sack-chunks/%ju} "
+ "{N:/input SACK chunk%s}\n");
+ p(sctps_recvdata, "\t\t{:received-data-chunks/%ju} "
+ "{N:/input DATA chunk%s}\n");
+ p(sctps_recvdupdata, "\t\t{:received-duplicate-data-chunks/%ju} "
+ "{N:/duplicate DATA chunk%s}\n");
+ p(sctps_recvheartbeat, "\t\t{:received-hb-chunks/%ju} "
+ "{N:/input HB chunk%s}\n");
+ p(sctps_recvheartbeatack, "\t\t{:received-hb-ack-chunks/%ju} "
+ "{N:/HB-ACK chunk%s}\n");
+ p(sctps_recvecne, "\t\t{:received-ecne-chunks/%ju} "
+ "{N:/input ECNE chunk%s}\n");
+ p(sctps_recvauth, "\t\t{:received-auth-chunks/%ju} "
+ "{N:/input AUTH chunk%s}\n");
+ p(sctps_recvauthmissing, "\t\t{:dropped-missing-auth/%ju} "
+ "{N:/chunk%s missing AUTH}\n");
+ p(sctps_recvivalhmacid, "\t\t{:dropped-invalid-hmac/%ju} "
+ "{N:/invalid HMAC id%s received}\n");
+ p(sctps_recvivalkeyid, "\t\t{:dropped-invalid-secret/%ju} "
+ "{N:/invalid secret id%s received}\n");
+ p1a(sctps_recvauthfailed, "\t\t{:dropped-auth-failed/%ju} "
+ "{N:/auth failed}\n");
+ p1a(sctps_recvexpress, "\t\t{:received-fast-path/%ju} "
+ "{N:/fast path receives all one chunk}\n");
+ p1a(sctps_recvexpressm, "\t\t{:receives-fast-path-multipart/%ju} "
+ "{N:/fast path multi-part data}\n");
+
+ /*
+ * output statistics
+ */
+ p(sctps_sendpackets, "\t{:sent-packets/%ju} "
+ "{N:/output packet%s}\n");
+ p(sctps_sendsacks, "\t\t{:sent-sacks/%ju} "
+ "{N:/output SACK%s}\n");
+ p(sctps_senddata, "\t\t{:sent-data-chunks/%ju} "
+ "{N:/output DATA chunk%s}\n");
+ p(sctps_sendretransdata, "\t\t{:sent-retransmitted-data-chunks/%ju} "
+ "{N:/retransmitted DATA chunk%s}\n");
+ p(sctps_sendfastretrans, "\t\t"
+ "{:sent-fast-retransmitted-data-chunks/%ju} "
+ "{N:/fast retransmitted DATA chunk%s}\n");
+ p(sctps_sendmultfastretrans, "\t\t"
+ "{:sent-fast-retransmitted-data-chunk-multiple-times/%ju} "
+ "{N:/FR'%s that happened more than once to same chunk}\n");
+ p(sctps_sendheartbeat, "\t\t{:sent-hb-chunks/%ju} "
+ "{N:/output HB chunk%s}\n");
+ p(sctps_sendecne, "\t\t{:sent-ecne-chunks/%ju} "
+ "{N:/output ECNE chunk%s}\n");
+ p(sctps_sendauth, "\t\t{:sent-auth-chunks/%ju} "
+ "{N:/output AUTH chunk%s}\n");
+ p1a(sctps_senderrors, "\t\t{:send-errors/%ju} "
+ "{N:/ip_output error counter}\n");
+
+ /*
+ * PCKDROPREP statistics
+ */
+ xo_emit("\t{T:Packet drop statistics}:\n");
+ xo_open_container("drop-statistics");
+ p1a(sctps_pdrpfmbox, "\t\t{:middle-box/%ju} "
+ "{N:/from middle box}\n");
+ p1a(sctps_pdrpfehos, "\t\t{:end-host/%ju} "
+ "{N:/from end host}\n");
+ p1a(sctps_pdrpmbda, "\t\t{:with-data/%ju} "
+ "{N:/with data}\n");
+ p1a(sctps_pdrpmbct, "\t\t{:non-data/%ju} "
+ "{N:/non-data, non-endhost}\n");
+ p1a(sctps_pdrpbwrpt, "\t\t{:non-endhost/%ju} "
+ "{N:/non-endhost, bandwidth rep only}\n");
+ p1a(sctps_pdrpcrupt, "\t\t{:short-header/%ju} "
+ "{N:/not enough for chunk header}\n");
+ p1a(sctps_pdrpnedat, "\t\t{:short-data/%ju} "
+ "{N:/not enough data to confirm}\n");
+ p1a(sctps_pdrppdbrk, "\t\t{:chunk-break/%ju} "
+ "{N:/where process_chunk_drop said break}\n");
+ p1a(sctps_pdrptsnnf, "\t\t{:tsn-not-found/%ju} "
+ "{N:/failed to find TSN}\n");
+ p1a(sctps_pdrpdnfnd, "\t\t{:reverse-tsn/%ju} "
+ "{N:/attempt reverse TSN lookup}\n");
+ p1a(sctps_pdrpdiwnp, "\t\t{:confirmed-zero-window/%ju} "
+ "{N:/e-host confirms zero-rwnd}\n");
+ p1a(sctps_pdrpdizrw, "\t\t{:middle-box-no-space/%ju} "
+ "{N:/midbox confirms no space}\n");
+ p1a(sctps_pdrpbadd, "\t\t{:bad-data/%ju} "
+ "{N:/data did not match TSN}\n");
+ p(sctps_pdrpmark, "\t\t{:tsn-marked-fast-retransmission/%ju} "
+ "{N:/TSN'%s marked for Fast Retran}\n");
+ xo_close_container("drop-statistics");
+
+ /*
+ * Timeouts
+ */
+ xo_emit("\t{T:Timeouts}:\n");
+ xo_open_container("timeouts");
+ p(sctps_timoiterator, "\t\t{:iterator/%ju} "
+ "{N:/iterator timer%s fired}\n");
+ p(sctps_timodata, "\t\t{:t3-data/%ju} "
+ "{N:/T3 data time out%s}\n");
+ p(sctps_timowindowprobe, "\t\t{:window-probe/%ju} "
+ "{N:/window probe (T3) timer%s fired}\n");
+ p(sctps_timoinit, "\t\t{:init-timer/%ju} "
+ "{N:/INIT timer%s fired}\n");
+ p(sctps_timosack, "\t\t{:sack-timer/%ju} "
+ "{N:/sack timer%s fired}\n");
+ p(sctps_timoshutdown, "\t\t{:shutdown-timer/%ju} "
+ "{N:/shutdown timer%s fired}\n");
+ p(sctps_timoheartbeat, "\t\t{:heartbeat-timer/%ju} "
+ "{N:/heartbeat timer%s fired}\n");
+ p1a(sctps_timocookie, "\t\t{:cookie-timer/%ju} "
+ "{N:/a cookie timeout fired}\n");
+ p1a(sctps_timosecret, "\t\t{:endpoint-changed-cookie/%ju} "
+ "{N:/an endpoint changed its cook}ie"
+ "secret\n");
+ p(sctps_timopathmtu, "\t\t{:pmtu-timer/%ju} "
+ "{N:/PMTU timer%s fired}\n");
+ p(sctps_timoshutdownack, "\t\t{:shutdown-timer/%ju} "
+ "{N:/shutdown ack timer%s fired}\n");
+ p(sctps_timoshutdownguard, "\t\t{:shutdown-guard-timer/%ju} "
+ "{N:/shutdown guard timer%s fired}\n");
+ p(sctps_timostrmrst, "\t\t{:stream-reset-timer/%ju} "
+ "{N:/stream reset timer%s fired}\n");
+ p(sctps_timoearlyfr, "\t\t{:early-fast-retransmission-timer/%ju} "
+ "{N:/early FR timer%s fired}\n");
+ p1a(sctps_timoasconf, "\t\t{:asconf-timer/%ju} "
+ "{N:/an asconf timer fired}\n");
+ p1a(sctps_timoautoclose, "\t\t{:auto-close-timer/%ju} "
+ "{N:/auto close timer fired}\n");
+ p(sctps_timoassockill, "\t\t{:asoc-free-timer/%ju} "
+ "{N:/asoc free timer%s expired}\n");
+ p(sctps_timoinpkill, "\t\t{:input-free-timer/%ju} "
+ "{N:/inp free timer%s expired}\n");
+ xo_close_container("timeouts");
+
+#if 0
+ /*
+ * Early fast retransmission counters
+ */
+ p(sctps_earlyfrstart, "\t%ju TODO:sctps_earlyfrstart\n");
+ p(sctps_earlyfrstop, "\t%ju TODO:sctps_earlyfrstop\n");
+ p(sctps_earlyfrmrkretrans, "\t%ju TODO:sctps_earlyfrmrkretrans\n");
+ p(sctps_earlyfrstpout, "\t%ju TODO:sctps_earlyfrstpout\n");
+ p(sctps_earlyfrstpidsck1, "\t%ju TODO:sctps_earlyfrstpidsck1\n");
+ p(sctps_earlyfrstpidsck2, "\t%ju TODO:sctps_earlyfrstpidsck2\n");
+ p(sctps_earlyfrstpidsck3, "\t%ju TODO:sctps_earlyfrstpidsck3\n");
+ p(sctps_earlyfrstpidsck4, "\t%ju TODO:sctps_earlyfrstpidsck4\n");
+ p(sctps_earlyfrstrid, "\t%ju TODO:sctps_earlyfrstrid\n");
+ p(sctps_earlyfrstrout, "\t%ju TODO:sctps_earlyfrstrout\n");
+ p(sctps_earlyfrstrtmr, "\t%ju TODO:sctps_earlyfrstrtmr\n");
+#endif
+
+ /*
+ * Others
+ */
+ p1a(sctps_hdrops, "\t{:dropped-too-short/%ju} "
+ "{N:/packet shorter than header}\n");
+ p1a(sctps_badsum, "\t{:dropped-bad-checksum/%ju} "
+ "{N:/checksum error}\n");
+ p1a(sctps_noport, "\t{:dropped-no-endpoint/%ju} "
+ "{N:/no endpoint for port}\n");
+ p1a(sctps_badvtag, "\t{:dropped-bad-v-tag/%ju} "
+ "{N:/bad v-tag}\n");
+ p1a(sctps_badsid, "\t{:dropped-bad-sid/%ju} "
+ "{N:/bad SID}\n");
+ p1a(sctps_nomem, "\t{:dropped-no-memory/%ju} "
+ "{N:/no memory}\n");
+ p1a(sctps_fastretransinrtt, "\t{:multiple-fast-retransmits-in-rtt/%ju} "
+ "{N:/number of multiple FR in a RT}T window\n");
+#if 0
+ p(sctps_markedretrans, "\t%ju TODO:sctps_markedretrans\n");
+#endif
+ p1a(sctps_naglesent, "\t{:rfc813-sent/%ju} "
+ "{N:/RFC813 allowed sending}\n");
+ p1a(sctps_naglequeued, "\t{:rfc813-queued/%ju} "
+ "{N:/RFC813 does not allow sending}\n");
+ p1a(sctps_maxburstqueued, "\t{:max-burst-queued/%ju} "
+ "{N:/times max burst prohibited sending}\n");
+ p1a(sctps_ifnomemqueued, "\t{:no-memory-in-interface/%ju} "
+ "{N:/look ahead tells us no memory in interface}\n");
+ p(sctps_windowprobed, "\t{:sent-window-probes/%ju} "
+ "{N:/number%s of window probes sent}\n");
+ p(sctps_lowlevelerr, "\t{:low-level-err/%ju} "
+ "{N:/time%s an output error to clamp down on next user send}\n");
+ p(sctps_lowlevelerrusr, "\t{:low-level-user-error/%ju} "
+ "{N:/time%s sctp_senderrors were caused from a user}\n");
+ p(sctps_datadropchklmt, "\t{:dropped-chunk-limit/%ju} "
+ "{N:/number of in data drop%s due to chunk limit reached}\n");
+ p(sctps_datadroprwnd, "\t{:dropped-rwnd-limit/%ju} "
+ "{N:/number of in data drop%s due to rwnd limit reached}\n");
+ p(sctps_ecnereducedcwnd, "\t{:ecn-reduced-cwnd/%ju} "
+ "{N:/time%s a ECN reduced the cwnd}\n");
+ p1a(sctps_vtagexpress, "\t{:v-tag-express-lookup/%ju} "
+ "{N:/used express lookup via vtag}\n");
+ p1a(sctps_vtagbogus, "\t{:v-tag-collision/%ju} "
+ "{N:/collision in express lookup}\n");
+ p(sctps_primary_randry, "\t{:sender-ran-dry/%ju} "
+ "{N:/time%s the sender ran dry of user data on primary}\n");
+ p1a(sctps_cmt_randry, "\t{:cmt-ran-dry/%ju} "
+ "{N:/same for above}\n");
+ p(sctps_slowpath_sack, "\t{:slow-path-sack/%ju} "
+ "{N:/sack%s the slow way}\n");
+ p(sctps_wu_sacks_sent, "\t{:sent-window-update-only-sack/%ju} "
+ "{N:/window update only sack%s sent}\n");
+ p(sctps_sends_with_flags, "\t{:sent-with-sinfo/%ju} "
+ "{N:/send%s with sinfo_flags !=0}\n");
+ p(sctps_sends_with_unord, "\t{:sent-with-unordered/%ju} "
+ "{N:/unordered send%s}\n");
+ p(sctps_sends_with_eof, "\t{:sent-with-eof/%ju} "
+ "{N:/send%s with EOF flag set}\n");
+ p(sctps_sends_with_abort, "\t{:sent-with-abort/%ju} "
+ "{N:/send%s with ABORT flag set}\n");
+ p(sctps_protocol_drain_calls, "\t{:protocol-drain-called/%ju} "
+ "{N:/time%s protocol drain called}\n");
+ p(sctps_protocol_drains_done, "\t{:protocol-drain/%ju} "
+ "{N:/time%s we did a protocol drain}\n");
+ p(sctps_read_peeks, "\t{:read-with-peek/%ju} "
+ "{N:/time%s recv was called with peek}\n");
+ p(sctps_cached_chk, "\t{:cached-chunks/%ju} "
+ "{N:/cached chunk%s used}\n");
+ p1a(sctps_cached_strmoq, "\t{:cached-output-queue-used/%ju} "
+ "{N:/cached stream oq's used}\n");
+ p(sctps_left_abandon, "\t{:messages-abandoned/%ju} "
+ "{N:/unread message%s abandonded by close}\n");
+ p1a(sctps_send_burst_avoid, "\t{:send-burst-avoidance/%ju} "
+ "{N:/send burst avoidance, already max burst inflight to net}\n");
+ p1a(sctps_send_cwnd_avoid, "\t{:send-cwnd-avoidance/%ju} "
+ "{N:/send cwnd full avoidance, already max burst inflight "
+ "to net}\n");
+ p(sctps_fwdtsn_map_over, "\t{:tsn-map-overruns/%ju} "
+ "{N:/number of map array over-run%s via fwd-tsn's}\n");
+
+#undef p
+#undef p1a
+ xo_close_container(name);
+}
+
+#endif /* SCTP */
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
new file mode 100644
index 0000000..29668a4
--- /dev/null
+++ b/usr.bin/netstat/unix.c
@@ -0,0 +1,331 @@
+/*-
+ * Copyright (c) 1983, 1988, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Display protocol blocks in the unix domain.
+ */
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/mbuf.h>
+#include <sys/sysctl.h>
+#include <sys/un.h>
+#include <sys/unpcb.h>
+
+#include <netinet/in.h>
+
+#include <errno.h>
+#include <err.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <strings.h>
+#include <kvm.h>
+#include <libxo/xo.h>
+#include "netstat.h"
+
+static void unixdomainpr(struct xunpcb *, struct xsocket *);
+
+static const char *const socktype[] =
+ { "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
+
+static int
+pcblist_sysctl(int type, char **bufp)
+{
+ char *buf;
+ size_t len;
+ char mibvar[sizeof "net.local.seqpacket.pcblist"];
+
+ sprintf(mibvar, "net.local.%s.pcblist", socktype[type]);
+
+ len = 0;
+ if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
+ if (errno != ENOENT)
+ xo_warn("sysctl: %s", mibvar);
+ return (-1);
+ }
+ if ((buf = malloc(len)) == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return (-2);
+ }
+ if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
+ xo_warn("sysctl: %s", mibvar);
+ free(buf);
+ return (-2);
+ }
+ *bufp = buf;
+ return (0);
+}
+
+static int
+pcblist_kvm(u_long count_off, u_long gencnt_off, u_long head_off, char **bufp)
+{
+ struct unp_head head;
+ struct unpcb *unp, unp_conn;
+ u_char sun_len;
+ struct socket so;
+ struct xunpgen xug;
+ struct xunpcb xu;
+ unp_gen_t unp_gencnt;
+ u_int unp_count;
+ char *buf, *p;
+ size_t len;
+
+ if (count_off == 0 || gencnt_off == 0)
+ return (-2);
+ if (head_off == 0)
+ return (-1);
+ kread(count_off, &unp_count, sizeof(unp_count));
+ len = 2 * sizeof(xug) + (unp_count + unp_count / 8) * sizeof(xu);
+ if ((buf = malloc(len)) == NULL) {
+ xo_warnx("malloc %lu bytes", (u_long)len);
+ return (-2);
+ }
+ p = buf;
+
+#define COPYOUT(obj, size) do { \
+ if (len < (size)) { \
+ xo_warnx("buffer size exceeded"); \
+ goto fail; \
+ } \
+ bcopy((obj), p, (size)); \
+ len -= (size); \
+ p += (size); \
+} while (0)
+
+#define KREAD(off, buf, len) do { \
+ if (kread((uintptr_t)(off), (buf), (len)) != 0) \
+ goto fail; \
+} while (0)
+
+ /* Write out header. */
+ kread(gencnt_off, &unp_gencnt, sizeof(unp_gencnt));
+ xug.xug_len = sizeof xug;
+ xug.xug_count = unp_count;
+ xug.xug_gen = unp_gencnt;
+ xug.xug_sogen = 0;
+ COPYOUT(&xug, sizeof xug);
+
+ /* Walk the PCB list. */
+ xu.xu_len = sizeof xu;
+ KREAD(head_off, &head, sizeof(head));
+ LIST_FOREACH(unp, &head, unp_link) {
+ xu.xu_unpp = unp;
+ KREAD(unp, &xu.xu_unp, sizeof (*unp));
+ unp = &xu.xu_unp;
+
+ if (unp->unp_gencnt > unp_gencnt)
+ continue;
+ if (unp->unp_addr != NULL) {
+ KREAD(unp->unp_addr, &sun_len, sizeof(sun_len));
+ KREAD(unp->unp_addr, &xu.xu_addr, sun_len);
+ }
+ if (unp->unp_conn != NULL) {
+ KREAD(unp->unp_conn, &unp_conn, sizeof(unp_conn));
+ if (unp_conn.unp_addr != NULL) {
+ KREAD(unp_conn.unp_addr, &sun_len,
+ sizeof(sun_len));
+ KREAD(unp_conn.unp_addr, &xu.xu_caddr, sun_len);
+ }
+ }
+ KREAD(unp->unp_socket, &so, sizeof(so));
+ if (sotoxsocket(&so, &xu.xu_socket) != 0)
+ goto fail;
+ COPYOUT(&xu, sizeof(xu));
+ }
+
+ /* Reread the counts and write the footer. */
+ kread(count_off, &unp_count, sizeof(unp_count));
+ kread(gencnt_off, &unp_gencnt, sizeof(unp_gencnt));
+ xug.xug_count = unp_count;
+ xug.xug_gen = unp_gencnt;
+ COPYOUT(&xug, sizeof xug);
+
+ *bufp = buf;
+ return (0);
+
+fail:
+ free(buf);
+ return (-1);
+#undef COPYOUT
+#undef KREAD
+}
+
+void
+unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off,
+ u_long sphead_off, bool *first)
+{
+ char *buf;
+ int ret, type;
+ struct xsocket *so;
+ struct xunpgen *xug, *oxug;
+ struct xunpcb *xunp;
+ u_long head_off;
+
+ buf = NULL;
+ for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) {
+ if (live)
+ ret = pcblist_sysctl(type, &buf);
+ else {
+ head_off = 0;
+ switch (type) {
+ case SOCK_STREAM:
+ head_off = shead_off;
+ break;
+
+ case SOCK_DGRAM:
+ head_off = dhead_off;
+ break;
+
+ case SOCK_SEQPACKET:
+ head_off = sphead_off;
+ break;
+ }
+ ret = pcblist_kvm(count_off, gencnt_off, head_off,
+ &buf);
+ }
+ if (ret == -1)
+ continue;
+ if (ret < 0)
+ return;
+
+ oxug = xug = (struct xunpgen *)buf;
+ for (xug = (struct xunpgen *)((char *)xug + xug->xug_len);
+ xug->xug_len > sizeof(struct xunpgen);
+ xug = (struct xunpgen *)((char *)xug + xug->xug_len)) {
+ xunp = (struct xunpcb *)xug;
+ so = &xunp->xu_socket;
+
+ /* Ignore PCBs which were freed during copyout. */
+ if (xunp->xu_unp.unp_gencnt > oxug->xug_gen)
+ continue;
+ if (*first) {
+ xo_open_list("socket");
+ *first = false;
+ }
+ xo_open_instance("socket");
+ unixdomainpr(xunp, so);
+ xo_close_instance("socket");
+ }
+ if (xug != oxug && xug->xug_gen != oxug->xug_gen) {
+ if (oxug->xug_count > xug->xug_count) {
+ xo_emit("Some {:type/%s} sockets may have "
+ "been {:action/deleted}.\n",
+ socktype[type]);
+ } else if (oxug->xug_count < xug->xug_count) {
+ xo_emit("Some {:type/%s} sockets may have "
+ "been {:action/created}.\n",
+ socktype[type]);
+ } else {
+ xo_emit("Some {:type/%s} sockets may have "
+ "been {:action/created or deleted}",
+ socktype[type]);
+ }
+ }
+ free(buf);
+ }
+}
+
+static void
+unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
+{
+ struct unpcb *unp;
+ struct sockaddr_un *sa;
+ static int first = 1;
+ char buf1[33];
+ static const char *titles[2] = {
+ "{T:/%-8.8s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%8.8s} "
+ "{T:/%8.8s} {T:/%8.8s} {T:/%8.8s} {T:Addr}\n",
+ "{T:/%-16.16s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%16.16s} "
+ "{T:/%16.16s} {T:/%16.16s} {T:/%16.16s} {T:Addr}\n"
+ };
+ static const char *format[2] = {
+ "{q:address/%8lx} {t:type/%-6.6s} "
+ "{:receive-bytes-waiting/%6u} "
+ "{:send-bytes-waiting/%6u} "
+ "{q:vnode/%8lx} {q:connection/%8lx} "
+ "{q:first-reference/%8lx} {q:next-reference/%8lx}",
+ "{q:address/%16lx} {t:type/%-6.6s} "
+ "{:receive-bytes-waiting/%6u} "
+ "{:send-bytes-waiting/%6u} "
+ "{q:vnode/%16lx} {q:connection/%16lx} "
+ "{q:first-reference/%16lx} {q:next-reference/%16lx}"
+ };
+ int fmt = (sizeof(void *) == 8) ? 1 : 0;
+
+ unp = &xunp->xu_unp;
+ if (unp->unp_addr)
+ sa = &xunp->xu_addr;
+ else
+ sa = (struct sockaddr_un *)0;
+
+ if (first && !Lflag) {
+ xo_emit("{T:Active UNIX domain sockets}\n");
+ xo_emit(titles[fmt],
+ "Address", "Type", "Recv-Q", "Send-Q",
+ "Inode", "Conn", "Refs", "Nextref");
+ first = 0;
+ }
+
+ if (Lflag && so->so_qlimit == 0)
+ return;
+
+ if (Lflag) {
+ snprintf(buf1, sizeof buf1, "%u/%u/%u", so->so_qlen,
+ so->so_incqlen, so->so_qlimit);
+ xo_emit("unix {d:socket/%-32.32s}{e:queue-length/%u}"
+ "{e:incomplete-queue-length/%u}{e:queue-limit/%u}",
+ buf1, so->so_qlen, so->so_incqlen, so->so_qlimit);
+ } else {
+ xo_emit(format[fmt],
+ (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc,
+ so->so_snd.sb_cc, (long)unp->unp_vnode,
+ (long)unp->unp_conn,
+ (long)LIST_FIRST(&unp->unp_refs),
+ (long)LIST_NEXT(unp, unp_reflink));
+ }
+ if (sa)
+ xo_emit(" {:path/%.*s}",
+ (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)),
+ sa->sun_path);
+ xo_emit("\n");
+}
diff --git a/usr.bin/newgrp/Makefile b/usr.bin/newgrp/Makefile
new file mode 100644
index 0000000..0a8e4a8
--- /dev/null
+++ b/usr.bin/newgrp/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PROG= newgrp
+
+LIBADD= crypt util
+
+.if defined(ENABLE_SUID_NEWGRP)
+BINMODE= 4555
+PRECIOUSPROG=
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/newgrp/Makefile.depend b/usr.bin/newgrp/Makefile.depend
new file mode 100644
index 0000000..d8297c2
--- /dev/null
+++ b/usr.bin/newgrp/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/newgrp/newgrp.1 b/usr.bin/newgrp/newgrp.1
new file mode 100644
index 0000000..4635584
--- /dev/null
+++ b/usr.bin/newgrp/newgrp.1
@@ -0,0 +1,104 @@
+.\" Copyright (c) 2002 Tim J. Robbins.
+.\" 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 February 8, 2013
+.Dt NEWGRP 1
+.Os
+.Sh NAME
+.Nm newgrp
+.Nd change to a new group
+.Sh SYNOPSIS
+.Nm
+.Op Fl l
+.Op Ar group
+.Sh DESCRIPTION
+The
+.Nm
+utility creates a new shell execution environment with modified
+real and effective group IDs.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl l
+Simulate a full login.
+The environment and umask are set to what would be expected if the user
+actually logged in again.
+.El
+.Pp
+If the
+.Ar group
+operand is present, a new shell is started with the specified effective
+and real group IDs.
+The user will be prompted for a password if they are not a member of the
+specified group.
+.Pp
+Otherwise, the real, effective and supplementary group IDs are restored to
+those from the current user's password database entry.
+.Sh EXIT STATUS
+The
+.Nm
+utility attempts to start the shell regardless of whether group IDs
+were successfully changed.
+.Pp
+If an error occurs and the shell cannot be started,
+.Nm
+exits >0.
+Otherwise, the exit status of
+.Nm
+is the exit status of the shell.
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr groups 1 ,
+.Xr login 1 ,
+.Xr sh 1 ,
+.Xr su 1 ,
+.Xr umask 1 ,
+.Xr group 5 ,
+.Xr passwd 5 ,
+.Xr environ 7
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v6 .
+.Sh BUGS
+For security reasons, the
+.Nm
+utility is normally installed without the setuid bit.
+To enable it, run the following command:
+.Bd -literal -offset indent
+chmod u+s /usr/bin/newgrp
+.Ed
+.Pp
+Group passwords are inherently insecure as there is no way to stop
+users obtaining the password hash from the group database.
+Their use is discouraged.
+Instead, users should simply be added to the necessary groups.
diff --git a/usr.bin/newgrp/newgrp.c b/usr.bin/newgrp/newgrp.c
new file mode 100644
index 0000000..8fc90f3
--- /dev/null
+++ b/usr.bin/newgrp/newgrp.c
@@ -0,0 +1,310 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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.
+ */
+
+/*
+ * newgrp -- change to a new group
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <limits.h>
+#include <login_cap.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void addgroup(const char *grpname);
+static void doshell(void);
+static int inarray(gid_t, const gid_t[], int);
+static void loginshell(void);
+static void restoregrps(void);
+static void usage(void);
+
+static struct passwd *pwd;
+static uid_t euid;
+
+extern char **environ;
+
+/* Manipulate effective user ID. */
+#define PRIV_START do { \
+ if (seteuid(euid) < 0) \
+ err(1, "seteuid"); \
+ } while (0)
+#define PRIV_END do { \
+ if (seteuid(getuid()) < 0) \
+ err(1, "seteuid"); \
+ } while (0)
+
+int
+main(int argc, char *argv[])
+{
+ int ch, login;
+
+ if ((euid = geteuid()) != 0)
+ warnx("need root permissions to function properly, check setuid bit");
+ if (seteuid(getuid()) < 0)
+ err(1, "seteuid");
+
+ if ((pwd = getpwuid(getuid())) == NULL)
+ errx(1, "unknown user");
+
+ login = 0;
+ while ((ch = getopt(argc, argv, "-l")) != -1) {
+ switch (ch) {
+ case '-': /* Obsolescent */
+ case 'l':
+ login = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 0:
+ restoregrps();
+ break;
+ case 1:
+ addgroup(*argv);
+ break;
+ default:
+ usage();
+ }
+
+ if (seteuid(euid) < 0)
+ err(1, "seteuid");
+ if (setuid(getuid()) < 0)
+ err(1, "setuid");
+
+ if (login)
+ loginshell();
+ else
+ doshell();
+
+ /*NOTREACHED*/
+ exit(1);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: newgrp [-l] [group]\n");
+ exit(1);
+}
+
+static void
+restoregrps(void)
+{
+ int initres, setres;
+
+ PRIV_START;
+ initres = initgroups(pwd->pw_name, pwd->pw_gid);
+ setres = setgid(pwd->pw_gid);
+ PRIV_END;
+
+ if (initres < 0)
+ warn("initgroups");
+ if (setres < 0)
+ warn("setgid");
+}
+
+static void
+addgroup(const char *grpname)
+{
+ gid_t *grps;
+ long lgid, ngrps_max;
+ int dbmember, i, ngrps;
+ gid_t egid;
+ struct group *grp;
+ char *ep, *pass, *cryptpw;
+ char **p;
+
+ egid = getegid();
+
+ /* Try it as a group name, then a group id. */
+ if ((grp = getgrnam(grpname)) == NULL)
+ if ((lgid = strtol(grpname, &ep, 10)) <= 0 || *ep != '\0' ||
+ (grp = getgrgid((gid_t)lgid)) == NULL ) {
+ warnx("%s: bad group name", grpname);
+ return;
+ }
+
+ /*
+ * If the user is not a member of the requested group and the group
+ * has a password, prompt and check it.
+ */
+ dbmember = 0;
+ if (pwd->pw_gid == grp->gr_gid)
+ dbmember = 1;
+ for (p = grp->gr_mem; *p != NULL; p++)
+ if (strcmp(*p, pwd->pw_name) == 0) {
+ dbmember = 1;
+ break;
+ }
+ if (!dbmember && *grp->gr_passwd != '\0' && getuid() != 0) {
+ pass = getpass("Password:");
+ if (pass == NULL)
+ return;
+ cryptpw = crypt(pass, grp->gr_passwd);
+ if (cryptpw == NULL || strcmp(grp->gr_passwd, cryptpw) != 0) {
+ fprintf(stderr, "Sorry\n");
+ return;
+ }
+ }
+
+ ngrps_max = sysconf(_SC_NGROUPS_MAX) + 1;
+ if ((grps = malloc(sizeof(gid_t) * ngrps_max)) == NULL)
+ err(1, "malloc");
+ if ((ngrps = getgroups(ngrps_max, (gid_t *)grps)) < 0) {
+ warn("getgroups");
+ goto end;
+ }
+
+ /* Remove requested gid from supp. list if it exists. */
+ if (grp->gr_gid != egid && inarray(grp->gr_gid, grps, ngrps)) {
+ for (i = 0; i < ngrps; i++)
+ if (grps[i] == grp->gr_gid)
+ break;
+ ngrps--;
+ memmove(&grps[i], &grps[i + 1], (ngrps - i) * sizeof(gid_t));
+ PRIV_START;
+ if (setgroups(ngrps, (const gid_t *)grps) < 0) {
+ PRIV_END;
+ warn("setgroups");
+ goto end;
+ }
+ PRIV_END;
+ }
+
+ PRIV_START;
+ if (setgid(grp->gr_gid)) {
+ PRIV_END;
+ warn("setgid");
+ goto end;
+ }
+ PRIV_END;
+ grps[0] = grp->gr_gid;
+
+ /* Add old effective gid to supp. list if it does not exist. */
+ if (egid != grp->gr_gid && !inarray(egid, grps, ngrps)) {
+ if (ngrps == ngrps_max)
+ warnx("too many groups");
+ else {
+ grps[ngrps++] = egid;
+ PRIV_START;
+ if (setgroups(ngrps, (const gid_t *)grps)) {
+ PRIV_END;
+ warn("setgroups");
+ goto end;
+ }
+ PRIV_END;
+ }
+ }
+end:
+ free(grps);
+}
+
+static int
+inarray(gid_t gid, const gid_t grps[], int ngrps)
+{
+ int i;
+
+ for (i = 0; i < ngrps; i++)
+ if (grps[i] == gid)
+ return (1);
+ return (0);
+}
+
+/*
+ * Set the environment to what would be expected if the user logged in
+ * again; this performs the same steps as su(1)'s -l option.
+ */
+static void
+loginshell(void)
+{
+ char *args[2], **cleanenv, *term, *ticket;
+ const char *shell;
+ login_cap_t *lc;
+
+ shell = pwd->pw_shell;
+ if (*shell == '\0')
+ shell = _PATH_BSHELL;
+ if (chdir(pwd->pw_dir) < 0) {
+ warn("%s", pwd->pw_dir);
+ chdir("/");
+ }
+
+ term = getenv("TERM");
+ ticket = getenv("KRBTKFILE");
+
+ if ((cleanenv = calloc(20, sizeof(char *))) == NULL)
+ err(1, "calloc");
+ *cleanenv = NULL;
+ environ = cleanenv;
+
+ lc = login_getpwclass(pwd);
+ setusercontext(lc, pwd, pwd->pw_uid,
+ LOGIN_SETPATH|LOGIN_SETUMASK|LOGIN_SETENV);
+ login_close(lc);
+ setenv("USER", pwd->pw_name, 1);
+ setenv("SHELL", shell, 1);
+ setenv("HOME", pwd->pw_dir, 1);
+ if (term != NULL)
+ setenv("TERM", term, 1);
+ if (ticket != NULL)
+ setenv("KRBTKFILE", ticket, 1);
+
+ if (asprintf(args, "-%s", shell) < 0)
+ err(1, "asprintf");
+ args[1] = NULL;
+
+ execv(shell, args);
+ err(1, "%s", shell);
+}
+
+static void
+doshell(void)
+{
+ const char *shell;
+
+ shell = pwd->pw_shell;
+ if (*shell == '\0')
+ shell = _PATH_BSHELL;
+ execl(shell, shell, (char *)NULL);
+ err(1, "%s", shell);
+}
diff --git a/usr.bin/newkey/Makefile b/usr.bin/newkey/Makefile
new file mode 100644
index 0000000..be1ea37
--- /dev/null
+++ b/usr.bin/newkey/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= newkey
+SRCS= newkey.c generic.c update.c
+.if ${MK_NIS} != "no"
+CFLAGS+= -DYP
+.endif
+MAN= newkey.8
+LIBADD= rpcsvc mp
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/newkey/Makefile.depend b/usr.bin/newkey/Makefile.depend
new file mode 100644
index 0000000..bae15c2
--- /dev/null
+++ b/usr.bin/newkey/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmp \
+ lib/librpcsvc \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/newkey/extern.h b/usr.bin/newkey/extern.h
new file mode 100644
index 0000000..7a5fb42
--- /dev/null
+++ b/usr.bin/newkey/extern.h
@@ -0,0 +1,47 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * $FreeBSD$
+ */
+
+#ifdef YP
+#define MAXMAPNAMELEN 256
+#else
+#define YPOP_CHANGE 1 /* change, do not add */
+#define YPOP_INSERT 2 /* add, do not change */
+#define YPOP_DELETE 3 /* delete this entry */
+#define YPOP_STORE 4 /* add, or change */
+#endif
+
+void genkeys(char *, char *, char *);
+int setpublicmap(char *, char *, char *);
+int mapupdate(char *, char *, u_int, u_int, char *, u_int, char *);
+void xencrypt(char *, char *);
+void xdecrypt(char *, char *);
+int localupdate(char *, char *, u_int, u_int, char *, u_int, char *);
diff --git a/usr.bin/newkey/generic.c b/usr.bin/newkey/generic.c
new file mode 100644
index 0000000..3626960
--- /dev/null
+++ b/usr.bin/newkey/generic.c
@@ -0,0 +1,132 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if !defined(lint) && defined(SCCSIDS)
+#if 0
+static char sccsid[] = "@(#)generic.c 1.2 91/03/11 Copyr 1986 Sun Micro";
+#endif
+#endif
+
+/*
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/file.h>
+
+#include <rpc/rpc.h>
+#include <rpc/key_prot.h>
+
+#include <mp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "extern.h"
+
+static void adjust(char[], char *);
+static void getseed(char *, int, unsigned char *);
+
+/*
+ * Generate a seed
+ */
+static void
+getseed(char *seed, int seedsize, unsigned char *pass)
+{
+ int i;
+
+ for (i = 0; i < seedsize; i++) {
+ seed[i] = (arc4random() & 0xff) ^ pass[i % 8];
+ }
+}
+
+/*
+ * Generate a random public/secret key pair
+ */
+void
+genkeys(char *public, char *secret, char *pass)
+{
+ unsigned int i;
+
+# define BASEBITS (8*sizeof (short) - 1)
+# define BASE (1 << BASEBITS)
+
+ MINT *pk = mp_itom(0);
+ MINT *sk = mp_itom(0);
+ MINT *tmp;
+ MINT *base = mp_itom(BASE);
+ MINT *root = mp_itom(PROOT);
+ MINT *modulus = mp_xtom(HEXMODULUS);
+ short r;
+ unsigned short seed[KEYSIZE/BASEBITS + 1];
+ char *xkey;
+
+ getseed((char *)seed, sizeof (seed), (u_char *)pass);
+ for (i = 0; i < KEYSIZE/BASEBITS + 1; i++) {
+ r = seed[i] % BASE;
+ tmp = mp_itom(r);
+ mp_mult(sk, base, sk);
+ mp_madd(sk, tmp, sk);
+ mp_mfree(tmp);
+ }
+ tmp = mp_itom(0);
+ mp_mdiv(sk, modulus, tmp, sk);
+ mp_mfree(tmp);
+ mp_pow(root, sk, modulus, pk);
+ xkey = mp_mtox(sk);
+ adjust(secret, xkey);
+ xkey = mp_mtox(pk);
+ adjust(public, xkey);
+ mp_mfree(sk);
+ mp_mfree(base);
+ mp_mfree(pk);
+ mp_mfree(root);
+ mp_mfree(modulus);
+}
+
+/*
+ * Adjust the input key so that it is 0-filled on the left
+ */
+static void
+adjust(char keyout[HEXKEYBYTES+1], char *keyin)
+{
+ char *p;
+ char *s;
+
+ for (p = keyin; *p; p++)
+ ;
+ for (s = keyout + HEXKEYBYTES; p >= keyin; p--, s--) {
+ *s = *p;
+ }
+ while (s >= keyout) {
+ *s-- = '0';
+ }
+}
diff --git a/usr.bin/newkey/newkey.8 b/usr.bin/newkey/newkey.8
new file mode 100644
index 0000000..80e2557
--- /dev/null
+++ b/usr.bin/newkey/newkey.8
@@ -0,0 +1,59 @@
+.\" @(#)newkey.8 1.3 91/03/11 TIRPC 1.0; from 1.12 90/02/03 SMI;
+.\" $FreeBSD$
+.Dd October 12, 1987
+.Dt NEWKEY 8
+.Os
+.Sh NAME
+.Nm newkey
+.Nd create a new key in the publickey database
+.Sh SYNOPSIS
+.Nm
+.Fl h Ar hostname
+.Nm
+.Fl u Ar username
+.Sh DESCRIPTION
+The
+.Nm
+utility is normally run by the network administrator on the
+Network Interface Service
+.Pq NIS
+master machine in order to establish public keys for
+users and super-users on the network.
+These keys are needed for using secure
+RPC
+or secure
+NFS .
+.Pp
+The
+.Nm
+utility will prompt for the login password of the given username and then
+create a new public/secret key pair in
+.Pa /etc/publickey
+encrypted with the login password of the given user.
+.Pp
+Use of this program is
+not required: users may create their own keys using
+.Xr chkey 1 .
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl h Ar hostname
+Create a new public key for the super-user at the given hostname.
+Prompts for the root password of the given hostname.
+.It Fl u Ar username
+Create a new public key for the given username.
+Prompts for the
+NIS
+password of the given username.
+.El
+.Sh SEE ALSO
+.Xr chkey 1 ,
+.Xr keylogin 1 ,
+.Xr publickey 5 ,
+.Xr keyserv 8
+.Sh NOTES
+The Network Information Service
+.Pq NIS
+was formerly known as Sun Yellow Pages
+.Pq YP .
+The functionality of the two remains the same;
+only the name has changed.
diff --git a/usr.bin/newkey/newkey.c b/usr.bin/newkey/newkey.c
new file mode 100644
index 0000000..be3b2bb
--- /dev/null
+++ b/usr.bin/newkey/newkey.c
@@ -0,0 +1,235 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if !defined(lint) && defined(SCCSIDS)
+#if 0
+static char sccsid[] = "@(#)newkey.c 1.8 91/03/11 Copyr 1986 Sun Micro";
+#endif
+#endif
+
+/*
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+
+/*
+ * Administrative tool to add a new user to the publickey database
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <rpc/rpc.h>
+#include <rpc/key_prot.h>
+
+#ifdef YP
+#include <sys/wait.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#include <netdb.h>
+#endif /* YP */
+
+#include <err.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#ifdef YP
+#define MAXMAPNAMELEN 256
+#else
+#define YPOP_CHANGE 1 /* change, do not add */
+#define YPOP_INSERT 2 /* add, do not change */
+#define YPOP_DELETE 3 /* delete this entry */
+#define YPOP_STORE 4 /* add, or change */
+#define ERR_ACCESS 1
+#define ERR_MALLOC 2
+#define ERR_READ 3
+#define ERR_WRITE 4
+#define ERR_DBASE 5
+#define ERR_KEY 6
+#endif
+
+#ifdef YP
+static char YPDBPATH[]="/var/yp";
+static char PKMAP[] = "publickey.byname";
+#else
+static char PKFILE[] = "/etc/publickey";
+static const char *err_string(int);
+#endif /* YP */
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ char name[MAXNETNAMELEN + 1];
+ char public[HEXKEYBYTES + 1];
+ char secret[HEXKEYBYTES + 1];
+ char crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
+ char crypt2[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
+ int status;
+ char *pass;
+ struct passwd *pw;
+#ifdef undef
+ struct hostent *h;
+#endif
+
+ if (argc != 3 || !(strcmp(argv[1], "-u") == 0 ||
+ strcmp(argv[1], "-h") == 0)) {
+ usage();
+ }
+ if (geteuid() != 0)
+ errx(1, "must be superuser");
+
+#ifdef YP
+ if (chdir(YPDBPATH) < 0)
+ warn("cannot chdir to %s", YPDBPATH);
+#endif /* YP */
+ if (strcmp(argv[1], "-u") == 0) {
+ pw = getpwnam(argv[2]);
+ if (pw == NULL)
+ errx(1, "unknown user: %s", argv[2]);
+ (void)user2netname(name, (int)pw->pw_uid, (char *)NULL);
+ } else {
+#ifdef undef
+ h = gethostbyname(argv[2]);
+ if (h == NULL)
+ errx(1, "unknown host: %s", argv[1]);
+ (void)host2netname(name, h->h_name, (char *)NULL);
+#else
+ (void)host2netname(name, argv[2], (char *)NULL);
+#endif
+ }
+
+ (void)printf("Adding new key for %s.\n", name);
+ pass = getpass("New password:");
+ genkeys(public, secret, pass);
+
+ memcpy(crypt1, secret, HEXKEYBYTES);
+ memcpy(crypt1 + HEXKEYBYTES, secret, KEYCHECKSUMSIZE);
+ crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE] = 0;
+ xencrypt(crypt1, pass);
+
+ memcpy(crypt2, crypt1, HEXKEYBYTES + KEYCHECKSUMSIZE + 1);
+ xdecrypt(crypt2, getpass("Retype password:"));
+ if (memcmp(crypt2, crypt2 + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0 ||
+ memcmp(crypt2, secret, HEXKEYBYTES) != 0)
+ errx(1, "password incorrect");
+
+#ifdef YP
+ (void)printf("Please wait for the database to get updated...\n");
+#endif
+ if ((status = setpublicmap(name, public, crypt1))) {
+#ifdef YP
+ errx(1, "unable to update NIS database (%u): %s",
+ status, yperr_string(status));
+#else
+ errx(1, "unable to update publickey database (%u): %s",
+ status, err_string(status));
+#endif
+ }
+ (void)printf("Your new key has been successfully stored away.\n");
+ exit(0);
+ /* NOTREACHED */
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n",
+ "usage: newkey -h hostname",
+ " newkey -u username");
+ exit(1);
+}
+
+/*
+ * Set the entry in the public key file
+ */
+int
+setpublicmap(char *name, char *public, char *secret)
+{
+ char pkent[1024];
+
+ (void)sprintf(pkent, "%s:%s", public, secret);
+#ifdef YP
+ return (mapupdate(name, PKMAP, YPOP_STORE,
+ strlen(name), name, strlen(pkent), pkent));
+#else
+ return (localupdate(name, PKFILE, YPOP_STORE,
+ strlen(name), name, strlen(pkent), pkent));
+#endif
+ }
+
+#ifndef YP
+ /*
+ * This returns a pointer to an error message string appropriate
+ * to an input error code. An input value of zero will return
+ * a success message.
+ */
+static const char *
+err_string(int code)
+{
+ const char *pmesg;
+
+ switch (code) {
+ case 0:
+ pmesg = "update operation succeeded";
+ break;
+ case ERR_KEY:
+ pmesg = "no such key in file";
+ break;
+ case ERR_READ:
+ pmesg = "cannot read the database";
+ break;
+ case ERR_WRITE:
+ pmesg = "cannot write to the database";
+ break;
+ case ERR_DBASE:
+ pmesg = "cannot update database";
+ break;
+ case ERR_ACCESS:
+ pmesg = "permission denied";
+ break;
+ case ERR_MALLOC:
+ pmesg = "malloc failed";
+ break;
+ default:
+ pmesg = "unknown error";
+ break;
+ }
+ return (pmesg);
+}
+#endif
diff --git a/usr.bin/newkey/update.c b/usr.bin/newkey/update.c
new file mode 100644
index 0000000..11a1db9
--- /dev/null
+++ b/usr.bin/newkey/update.c
@@ -0,0 +1,332 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)update.c 1.2 91/03/11 Copyr 1986 Sun Micro";
+#endif
+#endif
+
+/*
+ * Copyright (C) 1986, 1989, Sun Microsystems, Inc.
+ */
+
+/*
+ * Administrative tool to add a new user to the publickey database
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <rpc/rpc.h>
+#include <rpc/key_prot.h>
+
+#ifdef YP
+#include <sys/wait.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#include <netdb.h>
+#endif /* YP */
+
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#ifdef YP
+static char SHELL[] = "/bin/sh";
+static char YPDBPATH[]="/var/yp"; /* This is defined but not used! */
+static char UPDATEFILE[] = "updaters";
+
+static int _openchild(char *, FILE **, FILE **);
+static char *basename(char *path);
+
+/*
+ * Determine if requester is allowed to update the given map,
+ * and update it if so. Returns the yp status, which is zero
+ * if there is no access violation.
+ */
+int
+mapupdate(char *requester, char *mapname, u_int op, u_int keylen,
+ char *key, u_int datalen, char *data)
+{
+ char updater[MAXMAPNAMELEN + 40];
+ FILE *childargs;
+ FILE *childrslt;
+#ifdef WEXITSTATUS
+ int status;
+#else
+ union wait status;
+#endif
+ pid_t pid;
+ u_int yperrno;
+
+
+#ifdef DEBUG
+ printf("%s %s\n", key, data);
+#endif
+ (void)sprintf(updater, "make -s -f %s/%s %s", YPDBPATH, /* !!! */
+ UPDATEFILE, mapname);
+ pid = _openchild(updater, &childargs, &childrslt);
+ if (pid < 0) {
+ return (YPERR_YPERR);
+ }
+
+ /*
+ * Write to child
+ */
+ (void)fprintf(childargs, "%s\n", requester);
+ (void)fprintf(childargs, "%u\n", op);
+ (void)fprintf(childargs, "%u\n", keylen);
+ (void)fwrite(key, (int)keylen, 1, childargs);
+ (void)fprintf(childargs, "\n");
+ (void)fprintf(childargs, "%u\n", datalen);
+ (void)fwrite(data, (int)datalen, 1, childargs);
+ (void)fprintf(childargs, "\n");
+ (void)fclose(childargs);
+
+ /*
+ * Read from child
+ */
+ (void)fscanf(childrslt, "%d", &yperrno);
+ (void)fclose(childrslt);
+
+ (void)wait(&status);
+#ifdef WEXITSTATUS
+ if (WEXITSTATUS(status) != 0) {
+#else
+ if (status.w_retcode != 0) {
+#endif
+ return (YPERR_YPERR);
+ }
+ return (yperrno);
+}
+
+/*
+ * returns pid, or -1 for failure
+ */
+static pid_t
+_openchild(char *command, FILE **fto, FILE **ffrom)
+{
+ int i;
+ pid_t pid;
+ int pdto[2];
+ int pdfrom[2];
+ char *com;
+ struct rlimit rl;
+
+ if (pipe(pdto) < 0) {
+ goto error1;
+ }
+ if (pipe(pdfrom) < 0) {
+ goto error2;
+ }
+ switch (pid = fork()) {
+ case -1:
+ goto error3;
+
+ case 0:
+ /*
+ * child: read from pdto[0], write into pdfrom[1]
+ */
+ (void)close(0);
+ (void)dup(pdto[0]);
+ (void)close(1);
+ (void)dup(pdfrom[1]);
+ getrlimit(RLIMIT_NOFILE, &rl);
+ for (i = rl.rlim_max - 1; i >= 3; i--) {
+ (void) close(i);
+ }
+ com = malloc((unsigned) strlen(command) + 6);
+ if (com == NULL) {
+ _exit(~0);
+ }
+ (void)sprintf(com, "exec %s", command);
+ execl(SHELL, basename(SHELL), "-c", com, (char *)NULL);
+ _exit(~0);
+
+ default:
+ /*
+ * parent: write into pdto[1], read from pdfrom[0]
+ */
+ *fto = fdopen(pdto[1], "w");
+ (void)close(pdto[0]);
+ *ffrom = fdopen(pdfrom[0], "r");
+ (void)close(pdfrom[1]);
+ break;
+ }
+ return (pid);
+
+ /*
+ * error cleanup and return
+ */
+error3:
+ (void)close(pdfrom[0]);
+ (void)close(pdfrom[1]);
+error2:
+ (void)close(pdto[0]);
+ (void)close(pdto[1]);
+error1:
+ return (-1);
+}
+
+static char *
+basename(char *path)
+{
+ char *p;
+
+ p = strrchr(path, '/');
+ if (p == NULL) {
+ return (path);
+ } else {
+ return (p + 1);
+ }
+}
+
+#else /* YP */
+
+#define ERR_ACCESS 1
+#define ERR_MALLOC 2
+#define ERR_READ 3
+#define ERR_WRITE 4
+#define ERR_DBASE 5
+#define ERR_KEY 6
+
+static int match(char *, char *);
+
+/*
+ * Determine if requester is allowed to update the given map,
+ * and update it if so. Returns the status, which is zero
+ * if there is no access violation. This function updates
+ * the local file and then shuts up.
+ */
+int
+localupdate(char *name, char *filename, u_int op, u_int keylen __unused,
+ char *key, u_int datalen __unused, char *data)
+{
+ char line[256];
+ FILE *rf;
+ FILE *wf;
+ char *tmpname;
+ int err;
+
+ /*
+ * Check permission
+ */
+ if (strcmp(name, key) != 0) {
+ return (ERR_ACCESS);
+ }
+ if (strcmp(name, "nobody") == 0) {
+ /*
+ * Can't change "nobody"s key.
+ */
+ return (ERR_ACCESS);
+ }
+
+ /*
+ * Open files
+ */
+ tmpname = malloc(strlen(filename) + 4);
+ if (tmpname == NULL) {
+ return (ERR_MALLOC);
+ }
+ sprintf(tmpname, "%s.tmp", filename);
+ rf = fopen(filename, "r");
+ if (rf == NULL) {
+ return (ERR_READ);
+ }
+ wf = fopen(tmpname, "w");
+ if (wf == NULL) {
+ return (ERR_WRITE);
+ }
+ err = -1;
+ while (fgets(line, sizeof (line), rf)) {
+ if (err < 0 && match(line, name)) {
+ switch (op) {
+ case YPOP_INSERT:
+ err = ERR_KEY;
+ break;
+ case YPOP_STORE:
+ case YPOP_CHANGE:
+ fprintf(wf, "%s %s\n", key, data);
+ err = 0;
+ break;
+ case YPOP_DELETE:
+ /* do nothing */
+ err = 0;
+ break;
+ }
+ } else {
+ fputs(line, wf);
+ }
+ }
+ if (err < 0) {
+ switch (op) {
+ case YPOP_CHANGE:
+ case YPOP_DELETE:
+ err = ERR_KEY;
+ break;
+ case YPOP_INSERT:
+ case YPOP_STORE:
+ err = 0;
+ fprintf(wf, "%s %s\n", key, data);
+ break;
+ }
+ }
+ fclose(wf);
+ fclose(rf);
+ if (err == 0) {
+ if (rename(tmpname, filename) < 0) {
+ return (ERR_DBASE);
+ }
+ } else {
+ if (unlink(tmpname) < 0) {
+ return (ERR_DBASE);
+ }
+ }
+ return (err);
+}
+
+static int
+match(char *line, char *name)
+{
+ int len;
+
+ len = strlen(name);
+ return (strncmp(line, name, len) == 0 &&
+ (line[len] == ' ' || line[len] == '\t'));
+}
+#endif /* !YP */
diff --git a/usr.bin/nfsstat/Makefile b/usr.bin/nfsstat/Makefile
new file mode 100644
index 0000000..e45b5e2
--- /dev/null
+++ b/usr.bin/nfsstat/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= nfsstat
+CFLAGS+=-DNFS
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nfsstat/Makefile.depend b/usr.bin/nfsstat/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/nfsstat/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/nfsstat/nfsstat.1 b/usr.bin/nfsstat/nfsstat.1
new file mode 100644
index 0000000..6568c6a
--- /dev/null
+++ b/usr.bin/nfsstat/nfsstat.1
@@ -0,0 +1,116 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 23, 2015
+.Dt NFSSTAT 1
+.Os
+.Sh NAME
+.Nm nfsstat
+.Nd display
+.Tn NFS
+statistics
+.Sh SYNOPSIS
+.Nm
+.Op Fl cemszW
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl w Ar wait
+.Sh DESCRIPTION
+The
+.Nm
+command displays statistics kept about
+.Tn NFS
+client and server activity.
+For the NFSv4 server, the statistics are for operations within the Compound
+RPCs and not the count of RPCs.
+If you wish to compare RPC counts between NFSv3 and NFSv4, you must use
+statistics in the client(s).
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl c
+Only display client side statistics.
+.It Fl e
+Report the extra statistics collected by the NFS client and
+server for NFSv4.
+.It Fl M
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl m
+Report the mount options for all new NFS client mounts.
+This option overrides all others and
+.Nm
+will exit after completing the report.
+This option is only supported by the new NFS client.
+.It Fl N
+Extract the name list from the specified system instead of the default
+.Pa /boot/kernel/kernel .
+.It Fl s
+Only display server side statistics.
+.It Fl W
+Use wide format with interval short summary.
+This option is especially
+useful when combined with
+.Fl c
+or
+.Fl s
+and a time delay.
+.It Fl w
+Display a shorter summary of
+.Tn NFS
+activity for both the client and server at
+.Ar wait
+second intervals.
+.It Fl z
+Reset statistics after displaying them.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /boot/kernel/kernel" -compact
+.It Pa /boot/kernel/kernel
+default kernel namelist
+.It Pa /dev/kmem
+default memory file
+.El
+.Sh SEE ALSO
+.Xr fstat 1 ,
+.Xr netstat 1 ,
+.Xr ps 1 ,
+.Xr systat 1 ,
+.Xr sysctl 3 ,
+.Xr iostat 8 ,
+.Xr nfsdumpstate 8 ,
+.Xr pstat 8 ,
+.Xr vmstat 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
new file mode 100644
index 0000000..896a05b
--- /dev/null
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -0,0 +1,727 @@
+/*
+ * Copyright (c) 1983, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Macklem at The University of Guelph.
+ *
+ * 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) 1983, 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)nfsstat.c 8.2 (Berkeley) 3/31/95";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/module.h>
+#include <sys/mount.h>
+#include <sys/time.h>
+#include <sys/sysctl.h>
+#include <nfs/nfsproto.h>
+#include <nfsclient/nfs.h>
+#include <nfsserver/nfs.h>
+#include <nfs/nfssvc.h>
+
+#include <fs/nfs/nfsport.h>
+
+#include <signal.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <nlist.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <err.h>
+
+static int widemode = 0;
+static int zflag = 0;
+static int printtitle = 1;
+static struct ext_nfsstats ext_nfsstats;
+static int extra_output = 0;
+
+static void intpr(int, int);
+static void printhdr(int, int);
+static void usage(void);
+static char *sperc1(int, int);
+static char *sperc2(int, int);
+static void exp_intpr(int, int);
+static void exp_sidewaysintpr(u_int, int, int);
+
+#define DELTA(field) (nfsstats.field - lastst.field)
+
+int
+main(int argc, char **argv)
+{
+ u_int interval;
+ int clientOnly = -1;
+ int serverOnly = -1;
+ int ch;
+ char *memf, *nlistf;
+ int mntlen, i;
+ char buf[1024];
+ struct statfs *mntbuf;
+ struct nfscl_dumpmntopts dumpmntopts;
+
+ interval = 0;
+ memf = nlistf = NULL;
+ while ((ch = getopt(argc, argv, "cesWM:mN:w:z")) != -1)
+ switch(ch) {
+ case 'M':
+ memf = optarg;
+ break;
+ case 'm':
+ /* Display mount options for NFS mount points. */
+ mntlen = getmntinfo(&mntbuf, MNT_NOWAIT);
+ for (i = 0; i < mntlen; i++) {
+ if (strcmp(mntbuf->f_fstypename, "nfs") == 0) {
+ dumpmntopts.ndmnt_fname =
+ mntbuf->f_mntonname;
+ dumpmntopts.ndmnt_buf = buf;
+ dumpmntopts.ndmnt_blen = sizeof(buf);
+ if (nfssvc(NFSSVC_DUMPMNTOPTS,
+ &dumpmntopts) >= 0)
+ printf("%s on %s\n%s\n",
+ mntbuf->f_mntfromname,
+ mntbuf->f_mntonname, buf);
+ else if (errno == EPERM)
+ errx(1, "Only priviledged users"
+ " can use the -m option");
+ }
+ mntbuf++;
+ }
+ exit(0);
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'W':
+ widemode = 1;
+ break;
+ case 'w':
+ interval = atoi(optarg);
+ break;
+ case 'c':
+ clientOnly = 1;
+ if (serverOnly < 0)
+ serverOnly = 0;
+ break;
+ case 's':
+ serverOnly = 1;
+ if (clientOnly < 0)
+ clientOnly = 0;
+ break;
+ case 'z':
+ zflag = 1;
+ break;
+ case 'e':
+ extra_output = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+#define BACKWARD_COMPATIBILITY
+#ifdef BACKWARD_COMPATIBILITY
+ if (*argv) {
+ interval = atoi(*argv);
+ if (*++argv) {
+ nlistf = *argv;
+ if (*++argv)
+ memf = *argv;
+ }
+ }
+#endif
+ if (modfind("nfscommon") < 0)
+ errx(1, "NFS client/server not loaded");
+
+ if (interval) {
+ exp_sidewaysintpr(interval, clientOnly, serverOnly);
+ } else {
+ if (extra_output != 0)
+ exp_intpr(clientOnly, serverOnly);
+ else
+ intpr(clientOnly, serverOnly);
+ }
+ exit(0);
+}
+
+/*
+ * Print a description of the nfs stats.
+ */
+static void
+intpr(int clientOnly, int serverOnly)
+{
+ int nfssvc_flag;
+
+ nfssvc_flag = NFSSVC_GETSTATS;
+ if (zflag != 0) {
+ if (clientOnly != 0)
+ nfssvc_flag |= NFSSVC_ZEROCLTSTATS;
+ if (serverOnly != 0)
+ nfssvc_flag |= NFSSVC_ZEROSRVSTATS;
+ }
+ if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0)
+ err(1, "Can't get stats");
+ if (clientOnly) {
+ printf("Client Info:\n");
+ printf("Rpc Counts:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Getattr", "Setattr", "Lookup", "Readlink", "Read",
+ "Write", "Create", "Remove");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_GETATTR],
+ ext_nfsstats.rpccnt[NFSPROC_SETATTR],
+ ext_nfsstats.rpccnt[NFSPROC_LOOKUP],
+ ext_nfsstats.rpccnt[NFSPROC_READLINK],
+ ext_nfsstats.rpccnt[NFSPROC_READ],
+ ext_nfsstats.rpccnt[NFSPROC_WRITE],
+ ext_nfsstats.rpccnt[NFSPROC_CREATE],
+ ext_nfsstats.rpccnt[NFSPROC_REMOVE]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
+ "Readdir", "RdirPlus", "Access");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_RENAME],
+ ext_nfsstats.rpccnt[NFSPROC_LINK],
+ ext_nfsstats.rpccnt[NFSPROC_SYMLINK],
+ ext_nfsstats.rpccnt[NFSPROC_MKDIR],
+ ext_nfsstats.rpccnt[NFSPROC_RMDIR],
+ ext_nfsstats.rpccnt[NFSPROC_READDIR],
+ ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS],
+ ext_nfsstats.rpccnt[NFSPROC_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit");
+ printf("%9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_MKNOD],
+ ext_nfsstats.rpccnt[NFSPROC_FSSTAT],
+ ext_nfsstats.rpccnt[NFSPROC_FSINFO],
+ ext_nfsstats.rpccnt[NFSPROC_PATHCONF],
+ ext_nfsstats.rpccnt[NFSPROC_COMMIT]);
+ printf("Rpc Info:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "TimedOut", "Invalid", "X Replies", "Retries",
+ "Requests");
+ printf("%9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpctimeouts,
+ ext_nfsstats.rpcinvalid,
+ ext_nfsstats.rpcunexpected,
+ ext_nfsstats.rpcretries,
+ ext_nfsstats.rpcrequests);
+ printf("Cache Info:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s",
+ "Attr Hits", "Misses", "Lkup Hits", "Misses");
+ printf(" %9.9s %9.9s %9.9s %9.9s\n",
+ "BioR Hits", "Misses", "BioW Hits", "Misses");
+ printf("%9d %9d %9d %9d",
+ ext_nfsstats.attrcache_hits,
+ ext_nfsstats.attrcache_misses,
+ ext_nfsstats.lookupcache_hits,
+ ext_nfsstats.lookupcache_misses);
+ printf(" %9d %9d %9d %9d\n",
+ ext_nfsstats.biocache_reads -
+ ext_nfsstats.read_bios,
+ ext_nfsstats.read_bios,
+ ext_nfsstats.biocache_writes -
+ ext_nfsstats.write_bios,
+ ext_nfsstats.write_bios);
+ printf("%9.9s %9.9s %9.9s %9.9s",
+ "BioRLHits", "Misses", "BioD Hits", "Misses");
+ printf(" %9.9s %9.9s %9.9s %9.9s\n", "DirE Hits", "Misses", "Accs Hits", "Misses");
+ printf("%9d %9d %9d %9d",
+ ext_nfsstats.biocache_readlinks -
+ ext_nfsstats.readlink_bios,
+ ext_nfsstats.readlink_bios,
+ ext_nfsstats.biocache_readdirs -
+ ext_nfsstats.readdir_bios,
+ ext_nfsstats.readdir_bios);
+ printf(" %9d %9d %9d %9d\n",
+ ext_nfsstats.direofcache_hits,
+ ext_nfsstats.direofcache_misses,
+ ext_nfsstats.accesscache_hits,
+ ext_nfsstats.accesscache_misses);
+ }
+ if (serverOnly) {
+ printf("\nServer Info:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Getattr", "Setattr", "Lookup", "Readlink", "Read",
+ "Write", "Create", "Remove");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READLINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READ],
+ ext_nfsstats.srvrpccnt[NFSV4OP_WRITE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_CREATE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
+ "Readdir", "RdirPlus", "Access");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_RENAME],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS],
+ ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit");
+ printf("%9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD],
+ ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT],
+ ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO],
+ ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF],
+ ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT]);
+ printf("Server Ret-Failed\n");
+ printf("%17d\n", ext_nfsstats.srvrpc_errs);
+ printf("Server Faults\n");
+ printf("%13d\n", ext_nfsstats.srv_errs);
+ printf("Server Cache Stats:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s\n",
+ "Inprog", "Idem", "Non-idem", "Misses");
+ printf("%9d %9d %9d %9d\n",
+ ext_nfsstats.srvcache_inproghits,
+ ext_nfsstats.srvcache_idemdonehits,
+ ext_nfsstats.srvcache_nonidemdonehits,
+ ext_nfsstats.srvcache_misses);
+ printf("Server Write Gathering:\n");
+ printf("%9.9s %9.9s %9.9s\n",
+ "WriteOps", "WriteRPC", "Opsaved");
+ /*
+ * The new client doesn't do write gathering. It was
+ * only useful for NFSv2.
+ */
+ printf("%9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_WRITE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], 0);
+ }
+}
+
+static void
+printhdr(int clientOnly, int serverOnly)
+{
+ printf("%s%6.6s %6.6s %6.6s %6.6s %6.6s %6.6s %6.6s %6.6s",
+ ((serverOnly && clientOnly) ? " " : " "),
+ "GtAttr", "Lookup", "Rdlink", "Read", "Write", "Rename",
+ "Access", "Rddir");
+ if (widemode && clientOnly) {
+ printf(" Attr Lkup BioR BioW Accs BioD");
+ }
+ printf("\n");
+ fflush(stdout);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: nfsstat [-cemszW] [-M core] [-N system] [-w wait]\n");
+ exit(1);
+}
+
+static char SPBuf[64][8];
+static int SPIndex;
+
+static char *
+sperc1(int hits, int misses)
+{
+ char *p = SPBuf[SPIndex];
+
+ if (hits + misses) {
+ sprintf(p, "%3d%%",
+ (int)(char)((quad_t)hits * 100 / (hits + misses)));
+ } else {
+ sprintf(p, " -");
+ }
+ SPIndex = (SPIndex + 1) & 63;
+ return(p);
+}
+
+static char *
+sperc2(int ttl, int misses)
+{
+ char *p = SPBuf[SPIndex];
+
+ if (ttl) {
+ sprintf(p, "%3d%%",
+ (int)(char)((quad_t)(ttl - misses) * 100 / ttl));
+ } else {
+ sprintf(p, " -");
+ }
+ SPIndex = (SPIndex + 1) & 63;
+ return(p);
+}
+
+/*
+ * Print a description of the nfs stats for the experimental client/server.
+ */
+static void
+exp_intpr(int clientOnly, int serverOnly)
+{
+ int nfssvc_flag;
+
+ nfssvc_flag = NFSSVC_GETSTATS;
+ if (zflag != 0) {
+ if (clientOnly != 0)
+ nfssvc_flag |= NFSSVC_ZEROCLTSTATS;
+ if (serverOnly != 0)
+ nfssvc_flag |= NFSSVC_ZEROSRVSTATS;
+ }
+ if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0)
+ err(1, "Can't get stats");
+ if (clientOnly != 0) {
+ if (printtitle) {
+ printf("Client Info:\n");
+ printf("Rpc Counts:\n");
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Getattr", "Setattr", "Lookup", "Readlink",
+ "Read", "Write", "Create", "Remove");
+ }
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_GETATTR],
+ ext_nfsstats.rpccnt[NFSPROC_SETATTR],
+ ext_nfsstats.rpccnt[NFSPROC_LOOKUP],
+ ext_nfsstats.rpccnt[NFSPROC_READLINK],
+ ext_nfsstats.rpccnt[NFSPROC_READ],
+ ext_nfsstats.rpccnt[NFSPROC_WRITE],
+ ext_nfsstats.rpccnt[NFSPROC_CREATE],
+ ext_nfsstats.rpccnt[NFSPROC_REMOVE]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
+ "Readdir", "RdirPlus", "Access");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_RENAME],
+ ext_nfsstats.rpccnt[NFSPROC_LINK],
+ ext_nfsstats.rpccnt[NFSPROC_SYMLINK],
+ ext_nfsstats.rpccnt[NFSPROC_MKDIR],
+ ext_nfsstats.rpccnt[NFSPROC_RMDIR],
+ ext_nfsstats.rpccnt[NFSPROC_READDIR],
+ ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS],
+ ext_nfsstats.rpccnt[NFSPROC_ACCESS]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Mknod", "Fsstat", "Fsinfo", "PathConf",
+ "Commit", "SetClId", "SetClIdCf", "Lock");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_MKNOD],
+ ext_nfsstats.rpccnt[NFSPROC_FSSTAT],
+ ext_nfsstats.rpccnt[NFSPROC_FSINFO],
+ ext_nfsstats.rpccnt[NFSPROC_PATHCONF],
+ ext_nfsstats.rpccnt[NFSPROC_COMMIT],
+ ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID],
+ ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM],
+ ext_nfsstats.rpccnt[NFSPROC_LOCK]);
+ if (printtitle)
+ printf("%9.9s %9.9s %9.9s %9.9s\n",
+ "LockT", "LockU", "Open", "OpenCfr");
+ printf("%9d %9d %9d %9d\n",
+ ext_nfsstats.rpccnt[NFSPROC_LOCKT],
+ ext_nfsstats.rpccnt[NFSPROC_LOCKU],
+ ext_nfsstats.rpccnt[NFSPROC_OPEN],
+ ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "OpenOwner", "Opens", "LockOwner",
+ "Locks", "Delegs", "LocalOwn",
+ "LocalOpen", "LocalLOwn");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.clopenowners,
+ ext_nfsstats.clopens,
+ ext_nfsstats.cllockowners,
+ ext_nfsstats.cllocks,
+ ext_nfsstats.cldelegates,
+ ext_nfsstats.cllocalopenowners,
+ ext_nfsstats.cllocalopens,
+ ext_nfsstats.cllocallockowners);
+ if (printtitle)
+ printf("%9.9s\n", "LocalLock");
+ printf("%9d\n", ext_nfsstats.cllocallocks);
+ if (printtitle) {
+ printf("Rpc Info:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "TimedOut", "Invalid", "X Replies", "Retries",
+ "Requests");
+ }
+ printf("%9d %9d %9d %9d %9d\n",
+ ext_nfsstats.rpctimeouts,
+ ext_nfsstats.rpcinvalid,
+ ext_nfsstats.rpcunexpected,
+ ext_nfsstats.rpcretries,
+ ext_nfsstats.rpcrequests);
+ if (printtitle) {
+ printf("Cache Info:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s",
+ "Attr Hits", "Misses", "Lkup Hits", "Misses");
+ printf(" %9.9s %9.9s %9.9s %9.9s\n",
+ "BioR Hits", "Misses", "BioW Hits", "Misses");
+ }
+ printf("%9d %9d %9d %9d",
+ ext_nfsstats.attrcache_hits,
+ ext_nfsstats.attrcache_misses,
+ ext_nfsstats.lookupcache_hits,
+ ext_nfsstats.lookupcache_misses);
+ printf(" %9d %9d %9d %9d\n",
+ ext_nfsstats.biocache_reads - ext_nfsstats.read_bios,
+ ext_nfsstats.read_bios,
+ ext_nfsstats.biocache_writes - ext_nfsstats.write_bios,
+ ext_nfsstats.write_bios);
+ if (printtitle) {
+ printf("%9.9s %9.9s %9.9s %9.9s",
+ "BioRLHits", "Misses", "BioD Hits", "Misses");
+ printf(" %9.9s %9.9s\n", "DirE Hits", "Misses");
+ }
+ printf("%9d %9d %9d %9d",
+ ext_nfsstats.biocache_readlinks -
+ ext_nfsstats.readlink_bios,
+ ext_nfsstats.readlink_bios,
+ ext_nfsstats.biocache_readdirs -
+ ext_nfsstats.readdir_bios,
+ ext_nfsstats.readdir_bios);
+ printf(" %9d %9d\n",
+ ext_nfsstats.direofcache_hits,
+ ext_nfsstats.direofcache_misses);
+ }
+ if (serverOnly != 0) {
+ if (printtitle) {
+ printf("\nServer Info:\n");
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Getattr", "Setattr", "Lookup", "Readlink",
+ "Read", "Write", "Create", "Remove");
+ }
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READLINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READ],
+ ext_nfsstats.srvrpccnt[NFSV4OP_WRITE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_V3CREATE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
+ "Readdir", "RdirPlus", "Access");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_RENAME],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK],
+ ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READDIR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS],
+ ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Mknod", "Fsstat", "Fsinfo", "PathConf",
+ "Commit", "LookupP", "SetClId", "SetClIdCf");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD],
+ ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT],
+ ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO],
+ ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF],
+ ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUPP],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTID],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTIDCFRM]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "Open", "OpenAttr", "OpenDwnGr", "OpenCfrm",
+ "DelePurge", "DeleRet", "GetFH", "Lock");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_OPEN],
+ ext_nfsstats.srvrpccnt[NFSV4OP_OPENATTR],
+ ext_nfsstats.srvrpccnt[NFSV4OP_OPENDOWNGRADE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_OPENCONFIRM],
+ ext_nfsstats.srvrpccnt[NFSV4OP_DELEGPURGE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_DELEGRETURN],
+ ext_nfsstats.srvrpccnt[NFSV4OP_GETFH],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOCK]);
+ if (printtitle)
+ printf(
+ "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n"
+ , "LockT", "LockU", "Close", "Verify", "NVerify",
+ "PutFH", "PutPubFH", "PutRootFH");
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOCKT],
+ ext_nfsstats.srvrpccnt[NFSV4OP_LOCKU],
+ ext_nfsstats.srvrpccnt[NFSV4OP_CLOSE],
+ ext_nfsstats.srvrpccnt[NFSV4OP_VERIFY],
+ ext_nfsstats.srvrpccnt[NFSV4OP_NVERIFY],
+ ext_nfsstats.srvrpccnt[NFSV4OP_PUTFH],
+ ext_nfsstats.srvrpccnt[NFSV4OP_PUTPUBFH],
+ ext_nfsstats.srvrpccnt[NFSV4OP_PUTROOTFH]);
+ if (printtitle)
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Renew", "RestoreFH", "SaveFH", "Secinfo",
+ "RelLckOwn", "V4Create");
+ printf("%9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvrpccnt[NFSV4OP_RENEW],
+ ext_nfsstats.srvrpccnt[NFSV4OP_RESTOREFH],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SAVEFH],
+ ext_nfsstats.srvrpccnt[NFSV4OP_SECINFO],
+ ext_nfsstats.srvrpccnt[NFSV4OP_RELEASELCKOWN],
+ ext_nfsstats.srvrpccnt[NFSV4OP_CREATE]);
+ if (printtitle) {
+ printf("Server:\n");
+ printf("%9.9s %9.9s %9.9s\n",
+ "Retfailed", "Faults", "Clients");
+ }
+ printf("%9d %9d %9d\n",
+ ext_nfsstats.srv_errs, ext_nfsstats.srvrpc_errs,
+ ext_nfsstats.srvclients);
+ if (printtitle)
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s \n",
+ "OpenOwner", "Opens", "LockOwner",
+ "Locks", "Delegs");
+ printf("%9d %9d %9d %9d %9d \n",
+ ext_nfsstats.srvopenowners,
+ ext_nfsstats.srvopens,
+ ext_nfsstats.srvlockowners,
+ ext_nfsstats.srvlocks,
+ ext_nfsstats.srvdelegates);
+ if (printtitle) {
+ printf("Server Cache Stats:\n");
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Inprog", "Idem", "Non-idem", "Misses",
+ "CacheSize", "TCPPeak");
+ }
+ printf("%9d %9d %9d %9d %9d %9d\n",
+ ext_nfsstats.srvcache_inproghits,
+ ext_nfsstats.srvcache_idemdonehits,
+ ext_nfsstats.srvcache_nonidemdonehits,
+ ext_nfsstats.srvcache_misses,
+ ext_nfsstats.srvcache_size,
+ ext_nfsstats.srvcache_tcppeak);
+ }
+}
+
+/*
+ * Print a running summary of nfs statistics for the experimental client and/or
+ * server.
+ * Repeat display every interval seconds, showing statistics
+ * collected over that interval. Assumes that interval is non-zero.
+ * First line printed at top of screen is always cumulative.
+ */
+static void
+exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly)
+{
+ struct ext_nfsstats nfsstats, lastst, *ext_nfsstatsp;
+ int hdrcnt = 1;
+
+ ext_nfsstatsp = &lastst;
+ if (nfssvc(NFSSVC_GETSTATS, ext_nfsstatsp) < 0)
+ err(1, "Can't get stats");
+ sleep(interval);
+
+ for (;;) {
+ ext_nfsstatsp = &nfsstats;
+ if (nfssvc(NFSSVC_GETSTATS, ext_nfsstatsp) < 0)
+ err(1, "Can't get stats");
+
+ if (--hdrcnt == 0) {
+ printhdr(clientOnly, serverOnly);
+ if (clientOnly && serverOnly)
+ hdrcnt = 10;
+ else
+ hdrcnt = 20;
+ }
+ if (clientOnly) {
+ printf("%s %6d %6d %6d %6d %6d %6d %6d %6d",
+ ((clientOnly && serverOnly) ? "Client:" : ""),
+ DELTA(rpccnt[NFSPROC_GETATTR]),
+ DELTA(rpccnt[NFSPROC_LOOKUP]),
+ DELTA(rpccnt[NFSPROC_READLINK]),
+ DELTA(rpccnt[NFSPROC_READ]),
+ DELTA(rpccnt[NFSPROC_WRITE]),
+ DELTA(rpccnt[NFSPROC_RENAME]),
+ DELTA(rpccnt[NFSPROC_ACCESS]),
+ DELTA(rpccnt[NFSPROC_READDIR]) +
+ DELTA(rpccnt[NFSPROC_READDIRPLUS])
+ );
+ if (widemode) {
+ printf(" %s %s %s %s %s %s",
+ sperc1(DELTA(attrcache_hits),
+ DELTA(attrcache_misses)),
+ sperc1(DELTA(lookupcache_hits),
+ DELTA(lookupcache_misses)),
+ sperc2(DELTA(biocache_reads),
+ DELTA(read_bios)),
+ sperc2(DELTA(biocache_writes),
+ DELTA(write_bios)),
+ sperc1(DELTA(accesscache_hits),
+ DELTA(accesscache_misses)),
+ sperc2(DELTA(biocache_readdirs),
+ DELTA(readdir_bios))
+ );
+ }
+ printf("\n");
+ }
+ if (serverOnly) {
+ printf("%s %6d %6d %6d %6d %6d %6d %6d %6d",
+ ((clientOnly && serverOnly) ? "Server:" : ""),
+ DELTA(srvrpccnt[NFSV4OP_GETATTR]),
+ DELTA(srvrpccnt[NFSV4OP_LOOKUP]),
+ DELTA(srvrpccnt[NFSV4OP_READLINK]),
+ DELTA(srvrpccnt[NFSV4OP_READ]),
+ DELTA(srvrpccnt[NFSV4OP_WRITE]),
+ DELTA(srvrpccnt[NFSV4OP_RENAME]),
+ DELTA(srvrpccnt[NFSV4OP_ACCESS]),
+ DELTA(srvrpccnt[NFSV4OP_READDIR]) +
+ DELTA(srvrpccnt[NFSV4OP_READDIRPLUS]));
+ printf("\n");
+ }
+ lastst = nfsstats;
+ fflush(stdout);
+ sleep(interval);
+ }
+ /*NOTREACHED*/
+}
diff --git a/usr.bin/nice/Makefile b/usr.bin/nice/Makefile
new file mode 100644
index 0000000..0d2733a
--- /dev/null
+++ b/usr.bin/nice/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= nice
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nice/Makefile.depend b/usr.bin/nice/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/nice/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/nice/nice.1 b/usr.bin/nice/nice.1
new file mode 100644
index 0000000..770a460
--- /dev/null
+++ b/usr.bin/nice/nice.1
@@ -0,0 +1,120 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)nice.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 24, 2011
+.Dt NICE 1
+.Os
+.Sh NAME
+.Nm nice
+.Nd execute a utility at an altered scheduling priority
+.Sh SYNOPSIS
+.Nm
+.Op Fl n Ar increment
+.Ar utility
+.Op Ar argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility runs
+.Ar utility
+at an altered scheduling priority, by incrementing its
+.Dq nice
+value by the specified
+.Ar increment ,
+or a default value of 10.
+The lower the nice value of a process, the higher its scheduling priority.
+.Pp
+The superuser may specify a negative increment in order to run a utility
+with a higher scheduling priority.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh ENVIRONMENT
+The
+.Ev PATH
+environment variable is used to locate the requested
+.Ar utility
+if the name contains no
+.Ql /
+characters.
+.Sh EXIT STATUS
+If
+.Ar utility
+is invoked, the exit status of
+.Nm
+is the exit status of
+.Ar utility .
+.Pp
+An exit status of 126 indicates
+.Ar utility
+was found, but could not be executed.
+An exit status of 127 indicates
+.Ar utility
+could not be found.
+.Sh EXAMPLES
+Execute utility
+.Sq date
+at priority 5 assuming the priority of the
+shell is 0:
+.Pp
+.Dl "nice -n 5 date"
+.Pp
+Execute utility
+.Sq date
+at priority -19 assuming the priority of the
+shell is 0 and you are the super-user:
+.Pp
+.Dl "nice -n 16 nice -n -35 date"
+.Sh COMPATIBILITY
+The traditional
+.Fl Ns Ar increment
+option has been deprecated but is still supported.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr idprio 1 ,
+.Xr rtprio 1 ,
+.Xr getpriority 2 ,
+.Xr setpriority 2 ,
+.Xr renice 8
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v4 .
diff --git a/usr.bin/nice/nice.c b/usr.bin/nice/nice.c
new file mode 100644
index 0000000..9fab9e4
--- /dev/null
+++ b/usr.bin/nice/nice.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * 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) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)nice.c 8.2 (Berkeley) 4/16/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#define DEFNICE 10
+
+void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ long niceness = DEFNICE;
+ int ch;
+ char *ep;
+
+ /* Obsolescent syntax: -number, --number */
+ if (argc >= 2 && argv[1][0] == '-' && (argv[1][1] == '-' ||
+ isdigit((unsigned char)argv[1][1])) && strcmp(argv[1], "--") != 0)
+ if (asprintf(&argv[1], "-n%s", argv[1] + 1) < 0)
+ err(1, "asprintf");
+
+ while ((ch = getopt(argc, argv, "n:")) != -1) {
+ switch (ch) {
+ case 'n':
+ errno = 0;
+ niceness = strtol(optarg, &ep, 10);
+ if (ep == optarg || *ep != '\0' || errno ||
+ niceness < INT_MIN || niceness > INT_MAX)
+ errx(1, "%s: invalid nice value", optarg);
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ usage();
+
+ errno = 0;
+ niceness += getpriority(PRIO_PROCESS, 0);
+ if (errno)
+ warn("getpriority");
+ else if (setpriority(PRIO_PROCESS, 0, (int)niceness))
+ warn("setpriority");
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+}
+
+void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: nice [-n increment] utility [argument ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/nl/Makefile b/usr.bin/nl/Makefile
new file mode 100644
index 0000000..9b1f292
--- /dev/null
+++ b/usr.bin/nl/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= nl
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nl/Makefile.depend b/usr.bin/nl/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/nl/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/nl/nl.1 b/usr.bin/nl/nl.1
new file mode 100644
index 0000000..cb67c04
--- /dev/null
+++ b/usr.bin/nl/nl.1
@@ -0,0 +1,249 @@
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Klaus Klein.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd May 4, 2014
+.Dt NL 1
+.Os
+.Sh NAME
+.Nm nl
+.Nd line numbering filter
+.Sh SYNOPSIS
+.Nm
+.Op Fl p
+.Bk -words
+.Op Fl b Ar type
+.Ek
+.Bk -words
+.Op Fl d Ar delim
+.Ek
+.Bk -words
+.Op Fl f Ar type
+.Ek
+.Bk -words
+.Op Fl h Ar type
+.Ek
+.Bk -words
+.Op Fl i Ar incr
+.Ek
+.Bk -words
+.Op Fl l Ar num
+.Ek
+.Bk -words
+.Op Fl n Ar format
+.Ek
+.Bk -words
+.Op Fl s Ar sep
+.Ek
+.Bk -words
+.Op Fl v Ar startnum
+.Ek
+.Bk -words
+.Op Fl w Ar width
+.Ek
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility reads lines from the named
+.Ar file ,
+applies a configurable line numbering filter operation,
+and writes the result to the standard output.
+If
+.Ar file
+is a single dash
+.Pq Sq Fl
+or absent,
+.Nm
+reads from the standard input.
+.Pp
+The
+.Nm
+utility treats the text it reads in terms of logical pages.
+Unless specified otherwise, line numbering is reset at the start of each
+logical page.
+A logical page consists of a header, a body and a footer
+section; empty sections are valid.
+Different line numbering options are
+independently available for header, body and footer sections.
+.Pp
+The starts of logical page sections are signalled by input lines containing
+nothing but one of the following sequences of delimiter characters:
+.Bl -column "\e:\e:\e:" "Start of" -offset indent
+.Em "Line Start of"
+.It "\e:\e:\e: header"
+.It "\e:\e: body"
+.It "\e: footer"
+.El
+.Pp
+If the input does not contain any logical page section signalling directives,
+the text being read is assumed to consist of a single logical page body.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl v Ar startnum"
+.It Fl b Ar type
+Specify the logical page body lines to be numbered.
+Recognized
+.Ar type
+arguments are:
+.Bl -tag -width indent
+.It Cm a
+Number all lines.
+.It Cm t
+Number only non-empty lines.
+.It Cm n
+No line numbering.
+.It Cm p Ns Ar expr
+Number only those lines that contain the basic regular expression specified
+by
+.Ar expr .
+.El
+.Pp
+The default
+.Ar type
+for logical page body lines is
+.Cm t .
+.It Fl d Ar delim
+Specify the delimiter characters used to indicate the start of a logical
+page section in the input file.
+At most two characters may be specified;
+if only one character is specified, the first character is replaced and the
+second character remains unchanged.
+The default
+.Ar delim
+characters are
+.Dq Li \e: .
+.It Fl f Ar type
+Specify the same as
+.Fl b Ar type
+except for logical page footer lines.
+The default
+.Ar type
+for logical page footer lines is
+.Cm n .
+.It Fl h Ar type
+Specify the same as
+.Fl b Ar type
+except for logical page header lines.
+The default
+.Ar type
+for logical page header lines is
+.Cm n .
+.It Fl i Ar incr
+Specify the increment value used to number logical page lines.
+The default
+.Ar incr
+value is 1.
+.It Fl l Ar num
+If numbering of all lines is specified for the current logical section
+using the corresponding
+.Fl b Cm a ,
+.Fl f Cm a
+or
+.Fl h Cm a
+option,
+specify the number of adjacent blank lines to be considered as one.
+For example,
+.Fl l
+2 results in only the second adjacent blank line being numbered.
+The default
+.Ar num
+value is 1.
+.It Fl n Ar format
+Specify the line numbering output format.
+Recognized
+.Ar format
+arguments are:
+.Bl -tag -width indent -compact
+.It Cm ln
+Left justified.
+.It Cm rn
+Right justified, leading zeros suppressed.
+.It Cm rz
+Right justified, leading zeros kept.
+.El
+.Pp
+The default
+.Ar format
+is
+.Cm rn .
+.It Fl p
+Specify that line numbering should not be restarted at logical page delimiters.
+.It Fl s Ar sep
+Specify the characters used in separating the line number and the corresponding
+text line.
+The default
+.Ar sep
+setting is a single tab character.
+.It Fl v Ar startnum
+Specify the initial value used to number logical page lines; see also the
+description of the
+.Fl p
+option.
+The default
+.Ar startnum
+value is 1.
+.It Fl w Ar width
+Specify the number of characters to be occupied by the line number;
+in case the
+.Ar width
+is insufficient to hold the line number, it will be truncated to its
+.Ar width
+least significant digits.
+The default
+.Ar width
+is 6.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_CTYPE
+and
+.Ev LC_COLLATE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr jot 1 ,
+.Xr pr 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.At V.2 .
+.Sh BUGS
+Input lines are limited to
+.Dv LINE_MAX
+(2048) bytes in length.
diff --git a/usr.bin/nl/nl.c b/usr.bin/nl/nl.c
new file mode 100644
index 0000000..1770b78
--- /dev/null
+++ b/usr.bin/nl/nl.c
@@ -0,0 +1,410 @@
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
+#ifndef lint
+__COPYRIGHT(
+"@(#) Copyright (c) 1999\
+ The NetBSD Foundation, Inc. All rights reserved.");
+__RCSID("$FreeBSD$");
+#endif
+
+#define _WITH_GETLINE
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+typedef enum {
+ number_all, /* number all lines */
+ number_nonempty, /* number non-empty lines */
+ number_none, /* no line numbering */
+ number_regex /* number lines matching regular expression */
+} numbering_type;
+
+struct numbering_property {
+ const char * const name; /* for diagnostics */
+ numbering_type type; /* numbering type */
+ regex_t expr; /* for type == number_regex */
+};
+
+/* line numbering formats */
+#define FORMAT_LN "%-*d" /* left justified, leading zeros suppressed */
+#define FORMAT_RN "%*d" /* right justified, leading zeros suppressed */
+#define FORMAT_RZ "%0*d" /* right justified, leading zeros kept */
+
+#define FOOTER 0
+#define BODY 1
+#define HEADER 2
+#define NP_LAST HEADER
+
+static struct numbering_property numbering_properties[NP_LAST + 1] = {
+ { .name = "footer", .type = number_none },
+ { .name = "body", .type = number_nonempty },
+ { .name = "header", .type = number_none }
+};
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+
+/*
+ * Maximum number of characters required for a decimal representation of a
+ * (signed) int; courtesy of tzcode.
+ */
+#define INT_STRLEN_MAXIMUM \
+ ((sizeof (int) * CHAR_BIT - 1) * 302 / 1000 + 2)
+
+static void filter(void);
+static void parse_numbering(const char *, int);
+static void usage(void);
+
+/*
+ * Dynamically allocated buffer suitable for string representation of ints.
+ */
+static char *intbuffer;
+
+/* delimiter characters that indicate the start of a logical page section */
+static char delim[2 * MB_LEN_MAX];
+static int delimlen;
+
+/*
+ * Configurable parameters.
+ */
+
+/* line numbering format */
+static const char *format = FORMAT_RN;
+
+/* increment value used to number logical page lines */
+static int incr = 1;
+
+/* number of adjacent blank lines to be considered (and numbered) as one */
+static unsigned int nblank = 1;
+
+/* whether to restart numbering at logical page delimiters */
+static int restart = 1;
+
+/* characters used in separating the line number and the corrsp. text line */
+static const char *sep = "\t";
+
+/* initial value used to number logical page lines */
+static int startnum = 1;
+
+/* number of characters to be used for the line number */
+/* should be unsigned but required signed by `*' precision conversion */
+static int width = 6;
+
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ long val;
+ unsigned long uval;
+ char *ep;
+ size_t intbuffersize, clen;
+ char delim1[MB_LEN_MAX] = { '\\' }, delim2[MB_LEN_MAX] = { ':' };
+ size_t delim1len = 1, delim2len = 1;
+
+ (void)setlocale(LC_ALL, "");
+
+ while ((c = getopt(argc, argv, "pb:d:f:h:i:l:n:s:v:w:")) != -1) {
+ switch (c) {
+ case 'p':
+ restart = 0;
+ break;
+ case 'b':
+ parse_numbering(optarg, BODY);
+ break;
+ case 'd':
+ clen = mbrlen(optarg, MB_CUR_MAX, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2)
+ errc(EXIT_FAILURE, EILSEQ, NULL);
+ if (clen != 0) {
+ memcpy(delim1, optarg, delim1len = clen);
+ clen = mbrlen(optarg + delim1len,
+ MB_CUR_MAX, NULL);
+ if (clen == (size_t)-1 ||
+ clen == (size_t)-2)
+ errc(EXIT_FAILURE, EILSEQ, NULL);
+ if (clen != 0) {
+ memcpy(delim2, optarg + delim1len,
+ delim2len = clen);
+ if (optarg[delim1len + clen] != '\0')
+ errx(EXIT_FAILURE,
+ "invalid delim argument -- %s",
+ optarg);
+ }
+ }
+ break;
+ case 'f':
+ parse_numbering(optarg, FOOTER);
+ break;
+ case 'h':
+ parse_numbering(optarg, HEADER);
+ break;
+ case 'i':
+ errno = 0;
+ val = strtol(optarg, &ep, 10);
+ if ((ep != NULL && *ep != '\0') ||
+ ((val == LONG_MIN || val == LONG_MAX) && errno != 0))
+ errx(EXIT_FAILURE,
+ "invalid incr argument -- %s", optarg);
+ incr = (int)val;
+ break;
+ case 'l':
+ errno = 0;
+ uval = strtoul(optarg, &ep, 10);
+ if ((ep != NULL && *ep != '\0') ||
+ (uval == ULONG_MAX && errno != 0))
+ errx(EXIT_FAILURE,
+ "invalid num argument -- %s", optarg);
+ nblank = (unsigned int)uval;
+ break;
+ case 'n':
+ if (strcmp(optarg, "ln") == 0) {
+ format = FORMAT_LN;
+ } else if (strcmp(optarg, "rn") == 0) {
+ format = FORMAT_RN;
+ } else if (strcmp(optarg, "rz") == 0) {
+ format = FORMAT_RZ;
+ } else
+ errx(EXIT_FAILURE,
+ "illegal format -- %s", optarg);
+ break;
+ case 's':
+ sep = optarg;
+ break;
+ case 'v':
+ errno = 0;
+ val = strtol(optarg, &ep, 10);
+ if ((ep != NULL && *ep != '\0') ||
+ ((val == LONG_MIN || val == LONG_MAX) && errno != 0))
+ errx(EXIT_FAILURE,
+ "invalid startnum value -- %s", optarg);
+ startnum = (int)val;
+ break;
+ case 'w':
+ errno = 0;
+ val = strtol(optarg, &ep, 10);
+ if ((ep != NULL && *ep != '\0') ||
+ ((val == LONG_MIN || val == LONG_MAX) && errno != 0))
+ errx(EXIT_FAILURE,
+ "invalid width value -- %s", optarg);
+ width = (int)val;
+ if (!(width > 0))
+ errx(EXIT_FAILURE,
+ "width argument must be > 0 -- %d",
+ width);
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 0:
+ break;
+ case 1:
+ if (strcmp(argv[0], "-") != 0 &&
+ freopen(argv[0], "r", stdin) == NULL)
+ err(EXIT_FAILURE, "%s", argv[0]);
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ /* Generate the delimiter sequence */
+ memcpy(delim, delim1, delim1len);
+ memcpy(delim + delim1len, delim2, delim2len);
+ delimlen = delim1len + delim2len;
+
+ /* Allocate a buffer suitable for preformatting line number. */
+ intbuffersize = max((int)INT_STRLEN_MAXIMUM, width) + 1; /* NUL */
+ if ((intbuffer = malloc(intbuffersize)) == NULL)
+ err(EXIT_FAILURE, "cannot allocate preformatting buffer");
+
+ /* Do the work. */
+ filter();
+
+ exit(EXIT_SUCCESS);
+ /* NOTREACHED */
+}
+
+static void
+filter(void)
+{
+ char *buffer;
+ size_t buffersize;
+ ssize_t linelen;
+ int line; /* logical line number */
+ int section; /* logical page section */
+ unsigned int adjblank; /* adjacent blank lines */
+ int consumed; /* intbuffer measurement */
+ int donumber = 0, idx;
+
+ adjblank = 0;
+ line = startnum;
+ section = BODY;
+
+ buffer = NULL;
+ buffersize = 0;
+ while ((linelen = getline(&buffer, &buffersize, stdin)) > 0) {
+ for (idx = FOOTER; idx <= NP_LAST; idx++) {
+ /* Does it look like a delimiter? */
+ if (delimlen * (idx + 1) > linelen)
+ break;
+ if (memcmp(buffer + delimlen * idx, delim,
+ delimlen) != 0)
+ break;
+ /* Was this the whole line? */
+ if (buffer[delimlen * (idx + 1)] == '\n') {
+ section = idx;
+ adjblank = 0;
+ if (restart)
+ line = startnum;
+ goto nextline;
+ }
+ }
+
+ switch (numbering_properties[section].type) {
+ case number_all:
+ /*
+ * Doing this for number_all only is disputable, but
+ * the standard expresses an explicit dependency on
+ * `-b a' etc.
+ */
+ if (buffer[0] == '\n' && ++adjblank < nblank)
+ donumber = 0;
+ else
+ donumber = 1, adjblank = 0;
+ break;
+ case number_nonempty:
+ donumber = (buffer[0] != '\n');
+ break;
+ case number_none:
+ donumber = 0;
+ break;
+ case number_regex:
+ donumber =
+ (regexec(&numbering_properties[section].expr,
+ buffer, 0, NULL, 0) == 0);
+ break;
+ }
+
+ if (donumber) {
+ /* Note: sprintf() is safe here. */
+ consumed = sprintf(intbuffer, format, width, line);
+ (void)printf("%s",
+ intbuffer + max(0, consumed - width));
+ line += incr;
+ } else {
+ (void)printf("%*s", width, "");
+ }
+ (void)fputs(sep, stdout);
+ (void)fwrite(buffer, linelen, 1, stdout);
+
+ if (ferror(stdout))
+ err(EXIT_FAILURE, "output error");
+nextline:
+ ;
+ }
+
+ if (ferror(stdin))
+ err(EXIT_FAILURE, "input error");
+
+ free(buffer);
+}
+
+/*
+ * Various support functions.
+ */
+
+static void
+parse_numbering(const char *argstr, int section)
+{
+ int error;
+ char errorbuf[NL_TEXTMAX];
+
+ switch (argstr[0]) {
+ case 'a':
+ numbering_properties[section].type = number_all;
+ break;
+ case 'n':
+ numbering_properties[section].type = number_none;
+ break;
+ case 't':
+ numbering_properties[section].type = number_nonempty;
+ break;
+ case 'p':
+ /* If there was a previous expression, throw it away. */
+ if (numbering_properties[section].type == number_regex)
+ regfree(&numbering_properties[section].expr);
+ else
+ numbering_properties[section].type = number_regex;
+
+ /* Compile/validate the supplied regular expression. */
+ if ((error = regcomp(&numbering_properties[section].expr,
+ &argstr[1], REG_NEWLINE|REG_NOSUB)) != 0) {
+ (void)regerror(error,
+ &numbering_properties[section].expr,
+ errorbuf, sizeof (errorbuf));
+ errx(EXIT_FAILURE,
+ "%s expr: %s -- %s",
+ numbering_properties[section].name, errorbuf,
+ &argstr[1]);
+ }
+ break;
+ default:
+ errx(EXIT_FAILURE,
+ "illegal %s line numbering type -- %s",
+ numbering_properties[section].name, argstr);
+ }
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+"usage: nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num]\n"
+" [-n format] [-s sep] [-v startnum] [-w width] [file]\n");
+ exit(EXIT_FAILURE);
+}
diff --git a/usr.bin/nm/Makefile b/usr.bin/nm/Makefile
new file mode 100644
index 0000000..113553f
--- /dev/null
+++ b/usr.bin/nm/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+NMDIR= ${ELFTCDIR}/nm
+
+.PATH: ${NMDIR}
+
+PROG= nm
+
+LIBADD= dwarf elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nm/Makefile.depend b/usr.bin/nm/Makefile.depend
new file mode 100644
index 0000000..20f498c
--- /dev/null
+++ b/usr.bin/nm/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdwarf \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/nohup/Makefile b/usr.bin/nohup/Makefile
new file mode 100644
index 0000000..5ec4057
--- /dev/null
+++ b/usr.bin/nohup/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= nohup
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/nohup/Makefile.depend b/usr.bin/nohup/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/nohup/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/nohup/nohup.1 b/usr.bin/nohup/nohup.1
new file mode 100644
index 0000000..257c1d1
--- /dev/null
+++ b/usr.bin/nohup/nohup.1
@@ -0,0 +1,120 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)nohup.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2001
+.Dt NOHUP 1
+.Os
+.Sh NAME
+.Nm nohup
+.Nd invoke a utility immune to hangups
+.Sh SYNOPSIS
+.Nm
+.Op Fl Fl
+.Ar utility
+.Op Ar arguments
+.Sh DESCRIPTION
+The
+.Nm
+utility invokes
+.Ar utility
+with its
+.Ar arguments
+and at this time sets the signal
+.Dv SIGHUP
+to be ignored.
+If the standard output is a terminal, the standard output is
+appended to the file
+.Pa nohup.out
+in the current directory.
+If standard error is a terminal, it is directed to the same place
+as the standard output.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh ENVIRONMENT
+The following variables are utilized by
+.Nm :
+.Bl -tag -width flag
+.It Ev HOME
+If the output file
+.Pa nohup.out
+cannot be created in the current directory, the
+.Nm
+utility uses the directory named by
+.Ev HOME
+to create the file.
+.It Ev PATH
+Used to locate the requested
+.Ar utility
+if the name contains no
+.Ql /
+characters.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Bl -tag -width Ds
+.It 126
+The
+.Ar utility
+was found, but could not be invoked.
+.It 127
+The
+.Ar utility
+could not be found or an error occurred in
+.Nm .
+.El
+.Pp
+Otherwise, the exit status of
+.Nm
+will be that of
+.Ar utility .
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr signal 3
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
+.Sh BUGS
+Two or more instances of
+.Nm
+can append to the same file, which makes for a confusing output.
diff --git a/usr.bin/nohup/nohup.c b/usr.bin/nohup/nohup.c
new file mode 100644
index 0000000..beb1a35
--- /dev/null
+++ b/usr.bin/nohup/nohup.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1989, 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)nohup.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void dofile(void);
+static void usage(void);
+
+#define FILENAME "nohup.out"
+/*
+ * POSIX mandates that we exit with:
+ * 126 - If the utility was found, but failed to execute.
+ * 127 - If any other error occurred.
+ */
+#define EXIT_NOEXEC 126
+#define EXIT_NOTFOUND 127
+#define EXIT_MISC 127
+
+int
+main(int argc, char *argv[])
+{
+ int exit_status;
+
+ while (getopt(argc, argv, "") != -1)
+ usage();
+ argc -= optind;
+ argv += optind;
+ if (argc < 1)
+ usage();
+
+ if (isatty(STDOUT_FILENO))
+ dofile();
+ if (isatty(STDERR_FILENO) && dup2(STDOUT_FILENO, STDERR_FILENO) == -1)
+ /* may have just closed stderr */
+ err(EXIT_MISC, "%s", argv[0]);
+
+ (void)signal(SIGHUP, SIG_IGN);
+
+ execvp(*argv, argv);
+ exit_status = (errno == ENOENT) ? EXIT_NOTFOUND : EXIT_NOEXEC;
+ err(exit_status, "%s", argv[0]);
+}
+
+static void
+dofile(void)
+{
+ int fd;
+ char path[MAXPATHLEN];
+ const char *p;
+
+ /*
+ * POSIX mandates if the standard output is a terminal, the standard
+ * output is appended to nohup.out in the working directory. Failing
+ * that, it will be appended to nohup.out in the directory obtained
+ * from the HOME environment variable. If file creation is required,
+ * the mode_t is set to S_IRUSR | S_IWUSR.
+ */
+ p = FILENAME;
+ fd = open(p, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
+ if (fd != -1)
+ goto dupit;
+ if ((p = getenv("HOME")) != NULL && *p != '\0' &&
+ (size_t)snprintf(path, sizeof(path), "%s/%s", p, FILENAME) <
+ sizeof(path)) {
+ fd = open(p = path, O_RDWR | O_CREAT | O_APPEND,
+ S_IRUSR | S_IWUSR);
+ if (fd != -1)
+ goto dupit;
+ }
+ errx(EXIT_MISC, "can't open a nohup.out file");
+
+dupit:
+ if (dup2(fd, STDOUT_FILENO) == -1)
+ err(EXIT_MISC, NULL);
+ (void)fprintf(stderr, "appending output to %s\n", p);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: nohup [--] utility [arguments]\n");
+ exit(EXIT_MISC);
+}
diff --git a/usr.bin/numactl/Makefile b/usr.bin/numactl/Makefile
new file mode 100644
index 0000000..7158487
--- /dev/null
+++ b/usr.bin/numactl/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= numactl
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/numactl/Makefile.depend b/usr.bin/numactl/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/numactl/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/numactl/numactl.1 b/usr.bin/numactl/numactl.1
new file mode 100644
index 0000000..15c50d7
--- /dev/null
+++ b/usr.bin/numactl/numactl.1
@@ -0,0 +1,132 @@
+.\" Copyright (c) 2015 Adrian Chadd <adrian@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 May 9, 2015
+.Dt NUMACTL 1
+.Os
+.Sh NAME
+.Nm numactl
+.Nd "manage NUMA policy configuration"
+.Sh SYNOPSIS
+.Nm
+.Op Fl l Ar policy
+.Op Fl m Ar domain
+.Op Fl c Ar domain
+.Ar cmd ...
+.Nm
+.Fl g
+.Op Fl p Ar pid
+.Op Fl t Ar tid
+.Nm
+.Fl s
+.Op Fl l Ar policy
+.Op Fl m Ar domain
+.Op Fl c Ar domain
+.Op Fl p Ar pid
+.Op Fl t Ar tid
+.Sh DESCRIPTION
+The
+.Nm
+command can be used to assign NUMA policies to processes/threads,
+run commands with a given NUMA policy, and query information
+about NUMA policies on running processes.
+.Pp
+.Nm
+requires a target to modify or query.
+The target may be specified as a command, process id or a thread id.
+Using
+.Fl -get
+the target's NUMA policy may be queried.
+Using
+.Fl -set
+the target's NUMA policy may be queried.
+If no target is specified,
+.Nm
+operates on itself.
+Not all combinations of operations and targets are supported.
+For example,
+you may not set the id of an existing set or query and launch a command
+at the same time.
+.Pp
+Each process and thread has a NUMA policy.
+By default the policy is NONE.
+If a thread policy is NONE, then the policy will fall back to the process.
+If the process policy is NONE, then the policy will fall back to the
+system default.
+The policy may be queried by using
+.Fl -get.
+.Pp
+The options are as follows:
+.Bl -tag -width ".Fl -cpudomain Ar domain"
+.It Fl -cpudomain Ar domain , Fl c Ar domain
+Set the given CPU scheduling policy.
+Constrain the object (tid, pid, command) to run on CPUs
+that belong to the given domain.
+.It Fl -get , Fl g
+Retrieve the NUMA policy for the given thread or process id.
+.It Fl -set , Fl s
+Set the NUMA policy for the given thread or process id.
+.It Fl -memdomain Ar domain , Fl m Ar domain
+Constrain the object (tid, pid, command) to the given
+domain.
+This is only valid for fixed-domain and fixed-domain-rr.
+It must not be set for other policies.
+.It Fl -mempolicy Ar policy , Fl l Ar policy
+Set the given memory allocation policy.
+Valid policies are none, rr, fixed-domain, fixed-domain-rr,
+first-touch, and first-touch-rr.
+A memdomain argument is required for fixed-domain and
+fixed-domain-rr.
+.It Fl -pid Ar pid , Fl p Ar pid
+Operate on the given pid.
+.It Fl -tid Ar tid , Fl t Ar tid
+Operate on the given tid.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Create a
+.Pa /bin/sh
+process with memory coming from domain 0, but
+CPUs coming from domain 1:
+.Dl numactl --mempolicy=fixed-domain --memdomain=0 --cpudomain=1 /bin/sh
+.Pp
+Query the NUMA policy for the
+.Aq sh pid :
+.Dl numactl --get --pid=<sh pid>
+.Pp
+Set the NUMA policy for the given TID to round-robin:
+.Dl numactl --set --mempolicy=rr --tid=<tid>
+.Sh SEE ALSO
+.Xr cpuset 2 ,
+.Xr numa 4
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+.An Adrian Chadd Aq Mt adrian@FreeBSD.org
diff --git a/usr.bin/numactl/numactl.c b/usr.bin/numactl/numactl.c
new file mode 100644
index 0000000..8ad0d007
--- /dev/null
+++ b/usr.bin/numactl/numactl.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2015 Adrian Chadd <adrian@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/cpuset.h>
+#include <sys/numa.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+static struct option longopts[] = {
+ { "tid", required_argument, NULL, 't' },
+ { "pid", required_argument, NULL, 'p' },
+ { "memdomain", required_argument, NULL, 'm' },
+ { "cpudomain", required_argument, NULL, 'c' },
+ { "mempolicy", required_argument, NULL, 'l' },
+ { "set", no_argument, NULL, 's' },
+ { "get", no_argument, NULL, 'g' },
+ { NULL, 0, NULL, 0 }
+};
+
+static const char *
+policy_to_str(vm_domain_policy_type_t vt)
+{
+
+ switch (vt) {
+ case VM_POLICY_NONE:
+ return ("none");
+ case VM_POLICY_ROUND_ROBIN:
+ return ("rr");
+ case VM_POLICY_FIXED_DOMAIN:
+ return ("fixed-domain");
+ case VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN:
+ return ("fixed-domain-rr");
+ case VM_POLICY_FIRST_TOUCH:
+ return ("first-touch");
+ case VM_POLICY_FIRST_TOUCH_ROUND_ROBIN:
+ return ("first-touch-rr");
+ default:
+ return ("unknown");
+ }
+}
+
+static int
+parse_policy(struct vm_domain_policy_entry *vd, const char *str)
+{
+
+ if (strcmp(str, "rr") == 0) {
+ vd->policy = VM_POLICY_ROUND_ROBIN;
+ vd->domain = -1;
+ return (0);
+ }
+
+ if (strcmp(str, "first-touch-rr") == 0) {
+ vd->policy = VM_POLICY_FIRST_TOUCH_ROUND_ROBIN;
+ vd->domain = -1;
+ return (0);
+ }
+
+ if (strcmp(str, "first-touch") == 0) {
+ vd->policy = VM_POLICY_FIRST_TOUCH;
+ vd->domain = -1;
+ return (0);
+ }
+
+ if (strcmp(str, "fixed-domain") == 0) {
+ vd->policy = VM_POLICY_FIXED_DOMAIN;
+ vd->domain = 0;
+ return (0);
+ }
+
+ if (strcmp(str, "fixed-domain-rr") == 0) {
+ vd->policy = VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN;
+ vd->domain = 0;
+ return (0);
+ }
+
+ return (-1);
+}
+
+static void
+usage(void)
+{
+
+ printf("usage: numactl --get [--tid/-t <tid>] [--pid/-p <pid>]\n");
+ printf(" numactl --set [--tid=<tid>] [--pid/-p<pid>]\n");
+ printf(" [--mempolicy/-l <policy>] [--memdomain/"
+ "-m <domain>]\n");
+ printf(" [--cpudomain/-c <domain>]\n");
+ printf(" numactl [--mempolicy/-l <policy>] [--memdomain/-m "
+ "<domain>]\n");
+ printf(" [--cpudomain/-c <domain>] <cmd> ...\n");
+
+ exit(EX_USAGE);
+}
+
+static int
+set_numa_domain_cpuaffinity(int cpu_domain, cpuwhich_t which, id_t id)
+{
+ cpuset_t set;
+ int error;
+
+ error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_DOMAIN,
+ cpu_domain, sizeof(set), &set);
+ if (error != 0)
+ err(1, "cpuset_getaffinity");
+ error = cpuset_setaffinity(CPU_LEVEL_WHICH, which, id, sizeof(set),
+ &set);
+ if (error != 0)
+ err(1, "cpuset_setaffinity");
+
+ return (0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct vm_domain_policy_entry vd;
+ lwpid_t tid;
+ pid_t pid;
+ cpuwhich_t which;
+ id_t id;
+ int error;
+ int is_set, is_get;
+ int mem_policy_set;
+ int ch;
+ int cpu_domain;
+
+ id = -1;
+ which = -1;
+ is_set = 0;
+ is_get = 0;
+ mem_policy_set = 0;
+ tid = -1;
+ pid = -1;
+ cpu_domain = -1;
+
+ while ((ch = getopt_long(argc, argv, "c:gl:m:p:st:", longopts,
+ NULL)) != -1) {
+ switch (ch) {
+ case 'c':
+ cpu_domain = atoi(optarg);
+ break;
+ case 'g':
+ is_get = 1;
+ break;
+ case 'l':
+ if (parse_policy(&vd, optarg) != 0) {
+ fprintf(stderr,
+ "Could not parse policy: '%s'\n", optarg);
+ exit(1);
+ }
+ mem_policy_set = 1;
+ break;
+ case 'm':
+ if (mem_policy_set == 0) {
+ fprintf(stderr,
+ "Error: set policy first before domain\n");
+ exit(1);
+ }
+ vd.domain = atoi(optarg);
+ break;
+ case 'p':
+ pid = atoi(optarg);
+ break;
+ case 's':
+ is_set = 1;
+ break;
+ case 't':
+ tid = atoi(optarg);
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* Handle the user wishing to run a command */
+ if (argc) {
+ /* Ensure that a policy was set */
+ if (mem_policy_set == 0) {
+ fprintf(stderr, "Error: no policy given\n");
+ usage();
+ }
+
+ /* Set current memory process policy, will be inherited */
+ if (numa_setaffinity(CPU_WHICH_PID, -1, &vd) != 0)
+ err(1, "numa_setaffinity");
+
+ /* If a CPU domain policy was given, include that too */
+ if (cpu_domain != -1)
+ (void) set_numa_domain_cpuaffinity(cpu_domain,
+ CPU_WHICH_PID, -1);
+
+ errno = 0;
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+ }
+
+ /* Figure out which */
+ if (tid != -1) {
+ which = CPU_WHICH_TID;
+ id = tid;
+ } else if (pid != -1) {
+ which = CPU_WHICH_PID;
+ id = pid;
+ } else {
+ fprintf(stderr, "Error: one of tid or pid must be given\n");
+ usage();
+ }
+
+ /* Sanity checks */
+ if (is_set && is_get) {
+ fprintf(stderr, "Error: can't set both 'set' and 'get'\n");
+ usage();
+ }
+
+ if (is_set && ! mem_policy_set) {
+ fprintf(stderr, "Error: --set given, but no policy\n");
+ usage();
+ }
+
+ /* If it's get, then get the policy and return */
+ if (is_get) {
+ error = numa_getaffinity(which, id, &vd);
+ if (error != 0)
+ err(1, "numa_getaffinity");
+ printf(" Policy: %s; domain: %d\n",
+ policy_to_str(vd.policy),
+ vd.domain);
+ exit(0);
+ }
+
+ /* Assume it's set */
+
+ /* Syscall */
+ error = numa_setaffinity(which, id, &vd);
+ if (error != 0)
+ err(1, "numa_setaffinity");
+
+ /* If a CPU domain policy was given, include that too */
+ if (cpu_domain != -1)
+ (void) set_numa_domain_cpuaffinity(cpu_domain, which, id);
+
+ exit(0);
+}
diff --git a/usr.bin/number/Makefile b/usr.bin/number/Makefile
new file mode 100644
index 0000000..8e75f71
--- /dev/null
+++ b/usr.bin/number/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= number
+MAN= number.6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/number/Makefile.depend b/usr.bin/number/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/number/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/number/number.6 b/usr.bin/number/number.6
new file mode 100644
index 0000000..a8be9ff
--- /dev/null
+++ b/usr.bin/number/number.6
@@ -0,0 +1,58 @@
+.\" Copyright (c) 1989, 1993, 1994
+.\" 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)number.6 8.2 (Berkeley) 3/31/94
+.\" $FreeBSD$
+.\"
+.Dd March 31, 1994
+.Dt NUMBER 6
+.Os
+.Sh NAME
+.Nm number
+.Nd convert Arabic numerals to English
+.Sh SYNOPSIS
+.Nm
+.Op Fl l
+.Op Ar \&# ...
+.Sh DESCRIPTION
+The
+.Nm
+utility prints the English equivalent of the number to the standard
+output, with each 10^3 magnitude displayed on a separate line.
+If no argument is specified,
+.Nm
+reads lines from the standard input.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl l
+Display the number on a single line.
+.El
+.Sh BUGS
+Although
+.Nm
+understand fractions, it does not understand exponents.
diff --git a/usr.bin/number/number.c b/usr.bin/number/number.c
new file mode 100644
index 0000000..e8cf181
--- /dev/null
+++ b/usr.bin/number/number.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 1988, 1993, 1994
+ * 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.
+ * 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.
+ *
+ * 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) 1988, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)number.c 8.3 (Berkeley) 5/4/95";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MAXNUM 65 /* Biggest number we handle. */
+
+static const char *name1[] = {
+ "", "one", "two", "three",
+ "four", "five", "six", "seven",
+ "eight", "nine", "ten", "eleven",
+ "twelve", "thirteen", "fourteen", "fifteen",
+ "sixteen", "seventeen", "eighteen", "nineteen",
+},
+ *name2[] = {
+ "", "ten", "twenty", "thirty",
+ "forty", "fifty", "sixty", "seventy",
+ "eighty", "ninety",
+},
+ *name3[] = {
+ "hundred", "thousand", "million", "billion",
+ "trillion", "quadrillion", "quintillion", "sextillion",
+ "septillion", "octillion", "nonillion", "decillion",
+ "undecillion", "duodecillion", "tredecillion", "quattuordecillion",
+ "quindecillion", "sexdecillion",
+ "septendecillion", "octodecillion",
+ "novemdecillion", "vigintillion",
+};
+
+static void convert(char *);
+static int number(char *, int);
+static void pfract(int);
+static int unit(int, char *);
+static void usage(void);
+
+static int lflag;
+
+int
+main(int argc, char *argv[])
+{
+ int ch, first;
+ char line[256];
+
+ lflag = 0;
+ while ((ch = getopt(argc, argv, "l")) != -1)
+ switch (ch) {
+ case 'l':
+ lflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (*argv == NULL)
+ for (first = 1;
+ fgets(line, sizeof(line), stdin) != NULL; first = 0) {
+ if (strchr(line, '\n') == NULL)
+ errx(1, "line too long.");
+ if (!first)
+ (void)printf("...\n");
+ convert(line);
+ }
+ else
+ for (first = 1; *argv != NULL; first = 0, ++argv) {
+ if (!first)
+ (void)printf("...\n");
+ convert(*argv);
+ }
+ exit(0);
+}
+
+static void
+convert(char *line)
+{
+ int flen, len, rval;
+ char *p, *fraction;
+
+ flen = 0;
+ fraction = NULL;
+ for (p = line; *p != '\0' && *p != '\n'; ++p) {
+ if (isblank(*p)) {
+ if (p == line) {
+ ++line;
+ continue;
+ }
+ goto badnum;
+ }
+ if (isdigit(*p))
+ continue;
+ switch (*p) {
+ case '.':
+ if (fraction != NULL)
+ goto badnum;
+ fraction = p + 1;
+ *p = '\0';
+ break;
+ case '-':
+ if (p == line)
+ break;
+ /* FALLTHROUGH */
+ default:
+badnum: errx(1, "illegal number: %s", line);
+ break;
+ }
+ }
+ *p = '\0';
+
+ if ((len = strlen(line)) > MAXNUM ||
+ (fraction != NULL && ((flen = strlen(fraction)) > MAXNUM)))
+ errx(1, "number too large, max %d digits.", MAXNUM);
+
+ if (*line == '-') {
+ (void)printf("minus%s", lflag ? " " : "\n");
+ ++line;
+ --len;
+ }
+
+ rval = len > 0 ? unit(len, line) : 0;
+ if (fraction != NULL && flen != 0)
+ for (p = fraction; *p != '\0'; ++p)
+ if (*p != '0') {
+ if (rval)
+ (void)printf("%sand%s",
+ lflag ? " " : "",
+ lflag ? " " : "\n");
+ if (unit(flen, fraction)) {
+ if (lflag)
+ (void)printf(" ");
+ pfract(flen);
+ rval = 1;
+ }
+ break;
+ }
+ if (!rval)
+ (void)printf("zero%s", lflag ? "" : ".\n");
+ if (lflag)
+ (void)printf("\n");
+}
+
+static int
+unit(int len, char *p)
+{
+ int off, rval;
+
+ rval = 0;
+ if (len > 3) {
+ if (len % 3) {
+ off = len % 3;
+ len -= off;
+ if (number(p, off)) {
+ rval = 1;
+ (void)printf(" %s%s",
+ name3[len / 3], lflag ? " " : ".\n");
+ }
+ p += off;
+ }
+ for (; len > 3; p += 3) {
+ len -= 3;
+ if (number(p, 3)) {
+ rval = 1;
+ (void)printf(" %s%s",
+ name3[len / 3], lflag ? " " : ".\n");
+ }
+ }
+ }
+ if (number(p, len)) {
+ if (!lflag)
+ (void)printf(".\n");
+ rval = 1;
+ }
+ return (rval);
+}
+
+static int
+number(char *p, int len)
+{
+ int val, rval;
+
+ rval = 0;
+ switch (len) {
+ case 3:
+ if (*p != '0') {
+ rval = 1;
+ (void)printf("%s hundred", name1[*p - '0']);
+ }
+ ++p;
+ /* FALLTHROUGH */
+ case 2:
+ val = (p[1] - '0') + (p[0] - '0') * 10;
+ if (val) {
+ if (rval)
+ (void)printf(" ");
+ if (val < 20)
+ (void)printf("%s", name1[val]);
+ else {
+ (void)printf("%s", name2[val / 10]);
+ if (val % 10)
+ (void)printf("-%s", name1[val % 10]);
+ }
+ rval = 1;
+ }
+ break;
+ case 1:
+ if (*p != '0') {
+ rval = 1;
+ (void)printf("%s", name1[*p - '0']);
+ }
+ }
+ return (rval);
+}
+
+static void
+pfract(int len)
+{
+ static char const * const pref[] = { "", "ten-", "hundred-" };
+
+ switch(len) {
+ case 1:
+ (void)printf("tenths.\n");
+ break;
+ case 2:
+ (void)printf("hundredths.\n");
+ break;
+ default:
+ (void)printf("%s%sths.\n", pref[len % 3], name3[len / 3]);
+ break;
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: number [-l] [# ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/opieinfo/Makefile b/usr.bin/opieinfo/Makefile
new file mode 100644
index 0000000..f386be2
--- /dev/null
+++ b/usr.bin/opieinfo/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+#
+OPIE_DIST?= ${.CURDIR}/../../contrib/opie
+
+PROG= opieinfo
+
+CFLAGS+=-I${.CURDIR}/../../lib/libopie
+CFLAGS+=-I${OPIE_DIST}
+CFLAGS+=-DINSECURE_OVERRIDE
+
+WARNS?= 0
+
+LIBADD= opie
+
+BINOWN= root
+BINMODE=4555
+PRECIOUSPROG=
+
+.PATH: ${OPIE_DIST}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/opieinfo/Makefile.depend b/usr.bin/opieinfo/Makefile.depend
new file mode 100644
index 0000000..0466610
--- /dev/null
+++ b/usr.bin/opieinfo/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/libopie \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/opiekey/Makefile b/usr.bin/opiekey/Makefile
new file mode 100644
index 0000000..95ae8b3
--- /dev/null
+++ b/usr.bin/opiekey/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+#
+OPIE_DIST?= ${.CURDIR}/../../contrib/opie
+
+PROG= opiekey
+
+CFLAGS+=-I${.CURDIR}/../../lib/libopie
+CFLAGS+=-I${OPIE_DIST}
+CFLAGS+=-DINSECURE_OVERRIDE
+
+WARNS?= 0
+
+LIBADD= opie
+
+LINKS= ${BINDIR}/opiekey ${BINDIR}/otp-md4
+LINKS+= ${BINDIR}/opiekey ${BINDIR}/otp-md5
+LINKS+= ${BINDIR}/opiekey ${BINDIR}/otp-sha1
+
+MLINKS= opiekey.1 otp-md4.1 opiekey.1 otp-md5.1 opiekey.1 otp-sha1.1
+
+.PATH: ${OPIE_DIST}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/opiekey/Makefile.depend b/usr.bin/opiekey/Makefile.depend
new file mode 100644
index 0000000..0466610
--- /dev/null
+++ b/usr.bin/opiekey/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/libopie \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/opiepasswd/Makefile b/usr.bin/opiepasswd/Makefile
new file mode 100644
index 0000000..7b3f1f2
--- /dev/null
+++ b/usr.bin/opiepasswd/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+#
+OPIE_DIST?= ${.CURDIR}/../../contrib/opie
+
+PROG= opiepasswd
+
+CFLAGS+=-I${.CURDIR}/../../lib/libopie
+CFLAGS+=-I${OPIE_DIST}
+CFLAGS+=-DINSECURE_OVERRIDE
+
+WARNS?= 0
+
+LIBADD= opie
+
+BINOWN= root
+BINMODE=4555
+PRECIOUSPROG=
+
+.PATH: ${OPIE_DIST}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/opiepasswd/Makefile.depend b/usr.bin/opiepasswd/Makefile.depend
new file mode 100644
index 0000000..0466610
--- /dev/null
+++ b/usr.bin/opiepasswd/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/libopie \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/pagesize/Makefile b/usr.bin/pagesize/Makefile
new file mode 100644
index 0000000..6ca205d
--- /dev/null
+++ b/usr.bin/pagesize/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.2 (Berkeley) 4/3/94
+# $FreeBSD$
+
+SCRIPTS=pagesize.sh
+MAN= pagesize.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pagesize/Makefile.depend b/usr.bin/pagesize/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/pagesize/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/pagesize/pagesize.1 b/usr.bin/pagesize/pagesize.1
new file mode 100644
index 0000000..ea17c30
--- /dev/null
+++ b/usr.bin/pagesize/pagesize.1
@@ -0,0 +1,54 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)pagesize.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt PAGESIZE 1
+.Os
+.Sh NAME
+.Nm pagesize
+.Nd print system page size
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility prints the size of a page of memory in bytes, as
+returned by
+.Xr getpagesize 3 .
+This program is useful in constructing portable
+shell scripts.
+.Sh SEE ALSO
+.Xr getpagesize 3
+.Sh HISTORY
+The
+.Nm
+command
+appeared in
+.Bx 4.2 .
diff --git a/usr.bin/pagesize/pagesize.sh b/usr.bin/pagesize/pagesize.sh
new file mode 100644
index 0000000..07b9b3a
--- /dev/null
+++ b/usr.bin/pagesize/pagesize.sh
@@ -0,0 +1,36 @@
+#!/bin/sh -
+#
+# Copyright (c) 1994
+# 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.
+#
+# @(#)pagesize.sh 8.1 (Berkeley) 4/3/94
+# $FreeBSD$
+#
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH
+
+exec sysctl -n hw.pagesize
diff --git a/usr.bin/pamtest/Makefile b/usr.bin/pamtest/Makefile
new file mode 100644
index 0000000..289beb6
--- /dev/null
+++ b/usr.bin/pamtest/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+OPENPAM= ${.CURDIR}/../../contrib/openpam
+.PATH: ${OPENPAM}/include ${OPENPAM}/bin/pamtest
+
+PROG= pamtest
+SRCS= pamtest.c
+
+LIBADD= pam
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pamtest/Makefile.depend b/usr.bin/pamtest/Makefile.depend
new file mode 100644
index 0000000..916227d
--- /dev/null
+++ b/usr.bin/pamtest/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libpam/libpam \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/passwd/Makefile b/usr.bin/passwd/Makefile
new file mode 100644
index 0000000..fac1bb1
--- /dev/null
+++ b/usr.bin/passwd/Makefile
@@ -0,0 +1,22 @@
+# From: @(#)Makefile 8.3 (Berkeley) 4/2/94
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG = passwd
+BINOWN = root
+BINMODE = 4555
+PRECIOUSPROG=
+LIBADD = pam
+.if ${MK_NIS} != "no"
+SYMLINKS = ${BINDIR}/passwd ${BINDIR}/yppasswd
+MLINKS = passwd.1 yppasswd.1
+.endif
+
+beforeinstall:
+.for i in passwd yppasswd
+ [ ! -e ${DESTDIR}${BINDIR}/$i ] || \
+ chflags noschg ${DESTDIR}${BINDIR}/$i || true
+.endfor
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/passwd/Makefile.depend b/usr.bin/passwd/Makefile.depend
new file mode 100644
index 0000000..1078f33
--- /dev/null
+++ b/usr.bin/passwd/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libpam/libpam \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/passwd/passwd.1 b/usr.bin/passwd/passwd.1
new file mode 100644
index 0000000..c3d67f0
--- /dev/null
+++ b/usr.bin/passwd/passwd.1
@@ -0,0 +1,234 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)passwd.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 14, 2014
+.Dt PASSWD 1
+.Os
+.Sh NAME
+.Nm passwd , yppasswd
+.Nd modify a user's password
+.Sh SYNOPSIS
+.Nm
+.Op Fl l
+.Op Ar user
+.Nm yppasswd
+.Op Fl l
+.Op Fl y
+.Op Fl d Ar domain
+.Op Fl h Ar host
+.Op Fl o
+.Sh DESCRIPTION
+The
+.Nm
+utility changes the user's local, Kerberos, or NIS password.
+If the user is not the super-user,
+.Nm
+first prompts for the current password and will not continue unless the correct
+password is entered.
+.Pp
+When entering the new password, the characters entered do not echo, in order to
+avoid the password being seen by a passer-by.
+The
+.Nm
+utility prompts for the new password twice in order to detect typing errors.
+.Pp
+The total length of the password must be less than
+.Dv _PASSWORD_LEN
+(currently 128 characters).
+.Pp
+Once the password has been verified,
+.Nm
+communicates the new password information to
+the Kerberos authenticating host.
+.Pp
+The following option is available:
+.Bl -tag -width indent
+.It Fl l
+Cause the password to be updated only in the local
+password file, and not with the Kerberos database.
+When changing only the local password,
+.Xr pwd_mkdb 8
+is used to update the password databases.
+.El
+.Pp
+When changing local or NIS password, the next password change date
+is set according to
+.Dq passwordtime
+capability in the user's login class.
+.Pp
+To change another user's Kerberos password, one must first
+run
+.Xr kinit 1
+followed by
+.Nm .
+The super-user is not required to provide a user's current password
+if only the local password is modified.
+.Sh NIS INTERACTION
+The
+.Nm
+utility has built-in support for NIS.
+If a user exists in the NIS password
+database but does not exist locally,
+.Nm
+automatically switches into
+.Nm yppasswd
+mode.
+If the specified
+user does not exist in either the local password database or the
+NIS password maps,
+.Nm
+returns an error.
+.Pp
+When changing an NIS password, unprivileged users are required to provide
+their old password for authentication (the
+.Xr rpc.yppasswdd 8
+daemon requires the original password before
+it will allow any changes to the NIS password maps).
+This restriction applies even to the
+super-user, with one important exception: the password authentication is
+bypassed for the super-user on the NIS master server.
+This means that
+the super-user on the NIS master server can make unrestricted changes to
+anyone's NIS password.
+The super-user on NIS client systems and NIS slave
+servers still needs to provide a password before the update will be processed.
+.Pp
+The following additional options are supported for use with NIS:
+.Bl -tag -width indent
+.It Fl y
+Override
+.Nm Ns 's
+checking heuristics and forces
+it into NIS mode.
+.It Fl l
+When NIS is enabled, the
+.Fl l
+flag can be used to force
+.Nm
+into
+.Dq local only
+mode.
+This flag can be used to change the entry
+for a local user when an NIS user exists with the same login name.
+For example, you will sometimes find entries for system
+.Dq placeholder
+users such as
+.Pa bin
+or
+.Pa daemon
+in both the NIS password maps and the local user database.
+By
+default,
+.Nm
+will try to change the NIS password.
+The
+.Fl l
+flag can be used to change the local password instead.
+.It Fl d Ar domain
+Specify what domain to use when changing an NIS password.
+By default,
+.Nm
+assumes that the system default domain should be used.
+This flag is
+primarily for use by the superuser on the NIS master server: a single
+NIS server can support multiple domains.
+It is also possible that the
+domainname on the NIS master may not be set (it is not necessary for
+an NIS server to also be a client) in which case the
+.Nm
+command needs to be told what domain to operate on.
+.It Fl h Ar host
+Specify the name of an NIS server.
+This option, in conjunction
+with the
+.Fl d
+option, can be used to change an NIS password on a non-local NIS
+server.
+When a domain is specified with the
+.Fl d
+option and
+.Nm
+is unable to determine the name of the NIS master server (possibly because
+the local domainname is not set), the name of the NIS master is assumed to
+be
+.Dq localhost .
+This can be overridden with the
+.Fl h
+flag.
+The specified hostname need not be the name of an NIS master: the
+name of the NIS master for a given map can be determined by querying any
+NIS server (master or slave) in a domain, so specifying the name of a
+slave server will work equally well.
+.It Fl o
+Do not automatically override the password authentication checks for the
+super-user on the NIS master server; assume
+.Dq old
+mode instead.
+This
+flag is of limited practical use but is useful for testing.
+.El
+.Sh FILES
+.Bl -tag -width /etc/master.passwd -compact
+.It Pa /etc/master.passwd
+the user database
+.It Pa /etc/passwd
+a Version 7 format password file
+.It Pa /etc/passwd.XXXXXX
+temporary copy of the password file
+.It Pa /etc/login.conf
+login class capabilities database
+.El
+.Sh SEE ALSO
+.Xr chpass 1 ,
+.Xr kinit 1 ,
+.Xr login 1 ,
+.Xr login.conf 5 ,
+.Xr passwd 5 ,
+.Xr kerberos 8 ,
+.Xr kpasswdd 8 ,
+.Xr pam_passwdqc 8 ,
+.Xr pw 8 ,
+.Xr pwd_mkdb 8 ,
+.Xr vipw 8
+.Rs
+.%A Robert Morris
+.%A Ken Thompson
+.%T "UNIX password security"
+.Re
+.Sh NOTES
+The
+.Nm yppasswd
+command is really only a link to
+.Nm .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v6 .
diff --git a/usr.bin/passwd/passwd.c b/usr.bin/passwd/passwd.c
new file mode 100644
index 0000000..2d399c5
--- /dev/null
+++ b/usr.bin/passwd/passwd.c
@@ -0,0 +1,164 @@
+/*-
+ * Copyright (c) 2002 Networks Associates Technologies, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * NAI Labs, the Security Research Division of Network Associates, Inc.
+ * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+ * DARPA CHATS research program.
+ *
+ * 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. 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 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 <err.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+#include <security/openpam.h>
+
+static pam_handle_t *pamh;
+static struct pam_conv pamc = {
+ openpam_ttyconv,
+ NULL
+};
+
+static char *yp_domain;
+static char *yp_host;
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: passwd [-ly] [-d domain] [-h host] [user]\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char hostname[MAXHOSTNAMELEN];
+ struct passwd *pwd = NULL; /* Keep compiler happy. */
+ int o, pam_err;
+ uid_t uid;
+
+ while ((o = getopt(argc, argv, "d:h:loy")) != -1)
+ switch (o) {
+ case 'd':
+ yp_domain = optarg;
+ break;
+ case 'h':
+ yp_host = optarg;
+ break;
+ case 'l':
+ case 'o':
+ case 'y':
+ /* compatibility */
+ break;
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ uid = getuid();
+
+ switch (argc) {
+ case 0:
+ if ((pwd = getpwuid(uid)) == NULL)
+ errx(1, "who are you?");
+ break;
+ case 1:
+ if ((pwd = getpwnam(*argv)) == NULL)
+ errx(1, "%s: no such user", *argv);
+ break;
+ default:
+ usage();
+ }
+
+ if (uid != 0 && uid != pwd->pw_uid)
+ errx(1, "permission denied");
+
+ /* check where the user's from */
+ switch (pwd->pw_fields & _PWF_SOURCE) {
+ case _PWF_FILES:
+ fprintf(stderr, "Changing local password for %s\n",
+ pwd->pw_name);
+ break;
+ case _PWF_NIS:
+ fprintf(stderr, "Changing NIS password for %s\n",
+ pwd->pw_name);
+ break;
+ default:
+ /* XXX: Green men ought to be supported via PAM. */
+ errx(1,
+ "Sorry, `passwd' can only change passwords for local or NIS users.");
+ }
+
+#define pam_check(func) do { \
+ if (pam_err != PAM_SUCCESS) { \
+ if (pam_err == PAM_AUTH_ERR || pam_err == PAM_PERM_DENIED || \
+ pam_err == PAM_AUTHTOK_RECOVERY_ERR) \
+ warnx("sorry"); \
+ else \
+ warnx("%s(): %s", func, pam_strerror(pamh, pam_err)); \
+ goto end; \
+ } \
+} while (0)
+
+ /* initialize PAM */
+ pam_err = pam_start("passwd", pwd->pw_name, &pamc, &pamh);
+ pam_check("pam_start");
+
+ pam_err = pam_set_item(pamh, PAM_TTY, ttyname(STDERR_FILENO));
+ pam_check("pam_set_item");
+ gethostname(hostname, sizeof hostname);
+ pam_err = pam_set_item(pamh, PAM_RHOST, hostname);
+ pam_check("pam_set_item");
+ pam_err = pam_set_item(pamh, PAM_RUSER, getlogin());
+ pam_check("pam_set_item");
+
+ /* set YP domain and host */
+ pam_err = pam_set_data(pamh, "yp_domain", yp_domain, NULL);
+ pam_check("pam_set_data");
+ pam_err = pam_set_data(pamh, "yp_server", yp_host, NULL);
+ pam_check("pam_set_data");
+
+ /* set new password */
+ pam_err = pam_chauthtok(pamh, 0);
+ pam_check("pam_chauthtok");
+
+ end:
+ pam_end(pamh, pam_err);
+ exit(pam_err == PAM_SUCCESS ? 0 : 1);
+}
diff --git a/usr.bin/paste/Makefile b/usr.bin/paste/Makefile
new file mode 100644
index 0000000..aa237fb
--- /dev/null
+++ b/usr.bin/paste/Makefile
@@ -0,0 +1,5 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+
+PROG= paste
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/paste/Makefile.depend b/usr.bin/paste/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/paste/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/paste/paste.1 b/usr.bin/paste/paste.1
new file mode 100644
index 0000000..a8d38a0
--- /dev/null
+++ b/usr.bin/paste/paste.1
@@ -0,0 +1,146 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Adam S. Moskowitz and the Institute of Electrical and Electronics
+.\" Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)paste.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 25, 2004
+.Dt PASTE 1
+.Os
+.Sh NAME
+.Nm paste
+.Nd merge corresponding or subsequent lines of files
+.Sh SYNOPSIS
+.Nm
+.Op Fl s
+.Op Fl d Ar list
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility concatenates the corresponding lines of the given input files,
+replacing all but the last file's newline characters with a single tab
+character, and writes the resulting lines to standard output.
+If end-of-file is reached on an input file while other input files
+still contain data, the file is treated as if it were an endless source
+of empty lines.
+.Pp
+The options are as follows:
+.Bl -tag -width Fl
+.It Fl d Ar list
+Use one or more of the provided characters to replace the newline
+characters instead of the default tab.
+The characters in
+.Ar list
+are used circularly, i.e., when
+.Ar list
+is exhausted the first character from
+.Ar list
+is reused.
+This continues until a line from the last input file (in default operation)
+or the last line in each file (using the
+.Fl s
+option) is displayed, at which
+time
+.Nm
+begins selecting characters from the beginning of
+.Ar list
+again.
+.Pp
+The following special characters can also be used in list:
+.Pp
+.Bl -tag -width flag -compact
+.It Li \en
+newline character
+.It Li \et
+tab character
+.It Li \e\e
+backslash character
+.It Li \e0
+Empty string (not a null character).
+.El
+.Pp
+Any other character preceded by a backslash is equivalent to the
+character itself.
+.It Fl s
+Concatenate all of the lines of each separate input file in command line
+order.
+The newline character of every line except the last line in each input
+file is replaced with the tab character, unless otherwise specified by
+the
+.Fl d
+option.
+.El
+.Pp
+If
+.Sq Fl
+is specified for one or more of the input files, the standard
+input is used; standard input is read one line at a time, circularly,
+for each instance of
+.Sq Fl .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+List the files in the current directory in three columns:
+.Pp
+.Dl "ls | paste - - -"
+.Pp
+Combine pairs of lines from a file into single lines:
+.Pp
+.Dl "paste -s -d '\et\en' myfile"
+.Pp
+Number the lines in a file, similar to
+.Xr nl 1 :
+.Pp
+.Dl "sed = myfile | paste -s -d '\et\en' - -"
+.Pp
+Create a colon-separated list of directories named
+.Pa bin ,
+suitable
+for use in the
+.Ev PATH
+environment variable:
+.Pp
+.Dl "find / -name bin -type d | paste -s -d : -"
+.Sh SEE ALSO
+.Xr cut 1 ,
+.Xr lam 1
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At 32v .
diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c
new file mode 100644
index 0000000..f03f784
--- /dev/null
+++ b/usr.bin/paste/paste.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam S. Moskowitz of Menlo Consulting.
+ *
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)paste.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+static wchar_t *delim;
+static int delimcnt;
+
+static int parallel(char **);
+static int sequential(char **);
+static int tr(wchar_t *);
+static void usage(void);
+
+static wchar_t tab[] = L"\t";
+
+int
+main(int argc, char *argv[])
+{
+ int ch, rval, seq;
+ wchar_t *warg;
+ const char *arg;
+ size_t len;
+
+ setlocale(LC_CTYPE, "");
+
+ seq = 0;
+ while ((ch = getopt(argc, argv, "d:s")) != -1)
+ switch(ch) {
+ case 'd':
+ arg = optarg;
+ len = mbsrtowcs(NULL, &arg, 0, NULL);
+ if (len == (size_t)-1)
+ err(1, "delimiters");
+ warg = malloc((len + 1) * sizeof(*warg));
+ if (warg == NULL)
+ err(1, NULL);
+ arg = optarg;
+ len = mbsrtowcs(warg, &arg, len + 1, NULL);
+ if (len == (size_t)-1)
+ err(1, "delimiters");
+ delimcnt = tr(delim = warg);
+ break;
+ case 's':
+ seq = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (*argv == NULL)
+ usage();
+ if (!delim) {
+ delimcnt = 1;
+ delim = tab;
+ }
+
+ if (seq)
+ rval = sequential(argv);
+ else
+ rval = parallel(argv);
+ exit(rval);
+}
+
+typedef struct _list {
+ struct _list *next;
+ FILE *fp;
+ int cnt;
+ char *name;
+} LIST;
+
+static int
+parallel(char **argv)
+{
+ LIST *lp;
+ int cnt;
+ wint_t ich;
+ wchar_t ch;
+ char *p;
+ LIST *head, *tmp;
+ int opencnt, output;
+
+ for (cnt = 0, head = tmp = NULL; (p = *argv); ++argv, ++cnt) {
+ if ((lp = malloc(sizeof(LIST))) == NULL)
+ err(1, NULL);
+ if (p[0] == '-' && !p[1])
+ lp->fp = stdin;
+ else if (!(lp->fp = fopen(p, "r")))
+ err(1, "%s", p);
+ lp->next = NULL;
+ lp->cnt = cnt;
+ lp->name = p;
+ if (!head)
+ head = tmp = lp;
+ else {
+ tmp->next = lp;
+ tmp = lp;
+ }
+ }
+
+ for (opencnt = cnt; opencnt;) {
+ for (output = 0, lp = head; lp; lp = lp->next) {
+ if (!lp->fp) {
+ if (output && lp->cnt &&
+ (ch = delim[(lp->cnt - 1) % delimcnt]))
+ putwchar(ch);
+ continue;
+ }
+ if ((ich = getwc(lp->fp)) == WEOF) {
+ if (!--opencnt)
+ break;
+ lp->fp = NULL;
+ if (output && lp->cnt &&
+ (ch = delim[(lp->cnt - 1) % delimcnt]))
+ putwchar(ch);
+ continue;
+ }
+ /*
+ * make sure that we don't print any delimiters
+ * unless there's a non-empty file.
+ */
+ if (!output) {
+ output = 1;
+ for (cnt = 0; cnt < lp->cnt; ++cnt)
+ if ((ch = delim[cnt % delimcnt]))
+ putwchar(ch);
+ } else if ((ch = delim[(lp->cnt - 1) % delimcnt]))
+ putwchar(ch);
+ if (ich == '\n')
+ continue;
+ do {
+ putwchar(ich);
+ } while ((ich = getwc(lp->fp)) != WEOF && ich != '\n');
+ }
+ if (output)
+ putwchar('\n');
+ }
+
+ return (0);
+}
+
+static int
+sequential(char **argv)
+{
+ FILE *fp;
+ int cnt, failed, needdelim;
+ wint_t ch;
+ char *p;
+
+ failed = 0;
+ for (; (p = *argv); ++argv) {
+ if (p[0] == '-' && !p[1])
+ fp = stdin;
+ else if (!(fp = fopen(p, "r"))) {
+ warn("%s", p);
+ failed = 1;
+ continue;
+ }
+ cnt = needdelim = 0;
+ while ((ch = getwc(fp)) != WEOF) {
+ if (needdelim) {
+ needdelim = 0;
+ if (delim[cnt] != '\0')
+ putwchar(delim[cnt]);
+ if (++cnt == delimcnt)
+ cnt = 0;
+ }
+ if (ch != '\n')
+ putwchar(ch);
+ else
+ needdelim = 1;
+ }
+ if (needdelim)
+ putwchar('\n');
+ if (fp != stdin)
+ (void)fclose(fp);
+ }
+
+ return (failed != 0);
+}
+
+static int
+tr(wchar_t *arg)
+{
+ int cnt;
+ wchar_t ch, *p;
+
+ for (p = arg, cnt = 0; (ch = *p++); ++arg, ++cnt)
+ if (ch == '\\')
+ switch(ch = *p++) {
+ case 'n':
+ *arg = '\n';
+ break;
+ case 't':
+ *arg = '\t';
+ break;
+ case '0':
+ *arg = '\0';
+ break;
+ default:
+ *arg = ch;
+ break;
+ } else
+ *arg = ch;
+
+ if (!cnt)
+ errx(1, "no delimiters specified");
+ return(cnt);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: paste [-s] [-d delimiters] file ...\n");
+ exit(1);
+}
diff --git a/usr.bin/patch/Makefile b/usr.bin/patch/Makefile
new file mode 100644
index 0000000..a5f15c7
--- /dev/null
+++ b/usr.bin/patch/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $
+# $FreeBSD$
+
+PROG= patch
+
+SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/patch/Makefile.depend b/usr.bin/patch/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/patch/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/patch/backupfile.c b/usr.bin/patch/backupfile.c
new file mode 100644
index 0000000..ecdca19
--- /dev/null
+++ b/usr.bin/patch/backupfile.c
@@ -0,0 +1,246 @@
+/*-
+ * Copyright (C) 1990 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * without restriction.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * backupfile.c -- make Emacs style backup file names
+ *
+ * David MacKenzie <djm@ai.mit.edu>. Some algorithms adapted from GNU Emacs.
+ *
+ * $OpenBSD: backupfile.c,v 1.20 2009/10/27 23:59:41 deraadt Exp $
+ * $FreeBSD$
+ */
+
+#include <ctype.h>
+#include <dirent.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "backupfile.h"
+
+
+#define ISDIGIT(c) (isascii ((unsigned char)c) && isdigit ((unsigned char)c))
+
+/* Which type of backup file names are generated. */
+enum backup_type backup_type = none;
+
+/*
+ * The extension added to file names to produce a simple (as opposed to
+ * numbered) backup file name.
+ */
+const char *simple_backup_suffix = "~";
+
+static char *concat(const char *, const char *);
+static char *make_version_name(const char *, int);
+static int max_backup_version(const char *, const char *);
+static int version_number(const char *, const char *, size_t);
+static int argmatch(const char *, const char **);
+static void invalid_arg(const char *, const char *, int);
+
+/*
+ * Return the name of the new backup file for file FILE, allocated with
+ * malloc. Return 0 if out of memory. FILE must not end with a '/' unless it
+ * is the root directory. Do not call this function if backup_type == none.
+ */
+char *
+find_backup_file_name(const char *file)
+{
+ char *dir, *base_versions, *tmp_file;
+ int highest_backup;
+
+ if (backup_type == simple)
+ return concat(file, simple_backup_suffix);
+ tmp_file = strdup(file);
+ if (tmp_file == NULL)
+ return NULL;
+ base_versions = concat(basename(tmp_file), ".~");
+ free(tmp_file);
+ if (base_versions == NULL)
+ return NULL;
+ tmp_file = strdup(file);
+ if (tmp_file == NULL) {
+ free(base_versions);
+ return NULL;
+ }
+ dir = dirname(tmp_file);
+ if (dir == NULL) {
+ free(base_versions);
+ free(tmp_file);
+ return NULL;
+ }
+ highest_backup = max_backup_version(base_versions, dir);
+ free(base_versions);
+ free(tmp_file);
+ if (backup_type == numbered_existing && highest_backup == 0)
+ return concat(file, simple_backup_suffix);
+ return make_version_name(file, highest_backup + 1);
+}
+
+/*
+ * Return the number of the highest-numbered backup file for file FILE in
+ * directory DIR. If there are no numbered backups of FILE in DIR, or an
+ * error occurs reading DIR, return 0. FILE should already have ".~" appended
+ * to it.
+ */
+static int
+max_backup_version(const char *file, const char *dir)
+{
+ DIR *dirp;
+ struct dirent *dp;
+ int highest_version, this_version;
+ size_t file_name_length;
+
+ dirp = opendir(dir);
+ if (dirp == NULL)
+ return 0;
+
+ highest_version = 0;
+ file_name_length = strlen(file);
+
+ while ((dp = readdir(dirp)) != NULL) {
+ if (dp->d_namlen <= file_name_length)
+ continue;
+
+ this_version = version_number(file, dp->d_name, file_name_length);
+ if (this_version > highest_version)
+ highest_version = this_version;
+ }
+ closedir(dirp);
+ return highest_version;
+}
+
+/*
+ * Return a string, allocated with malloc, containing "FILE.~VERSION~".
+ * Return 0 if out of memory.
+ */
+static char *
+make_version_name(const char *file, int version)
+{
+ char *backup_name;
+
+ if (asprintf(&backup_name, "%s.~%d~", file, version) == -1)
+ return NULL;
+ return backup_name;
+}
+
+/*
+ * If BACKUP is a numbered backup of BASE, return its version number;
+ * otherwise return 0. BASE_LENGTH is the length of BASE. BASE should
+ * already have ".~" appended to it.
+ */
+static int
+version_number(const char *base, const char *backup, size_t base_length)
+{
+ int version;
+ const char *p;
+
+ version = 0;
+ if (!strncmp(base, backup, base_length) && ISDIGIT(backup[base_length])) {
+ for (p = &backup[base_length]; ISDIGIT(*p); ++p)
+ version = version * 10 + *p - '0';
+ if (p[0] != '~' || p[1])
+ version = 0;
+ }
+ return version;
+}
+
+/*
+ * Return the newly-allocated concatenation of STR1 and STR2. If out of
+ * memory, return 0.
+ */
+static char *
+concat(const char *str1, const char *str2)
+{
+ char *newstr;
+
+ if (asprintf(&newstr, "%s%s", str1, str2) == -1)
+ return NULL;
+ return newstr;
+}
+
+/*
+ * If ARG is an unambiguous match for an element of the null-terminated array
+ * OPTLIST, return the index in OPTLIST of the matched element, else -1 if it
+ * does not match any element or -2 if it is ambiguous (is a prefix of more
+ * than one element).
+ */
+static int
+argmatch(const char *arg, const char **optlist)
+{
+ int i; /* Temporary index in OPTLIST. */
+ size_t arglen; /* Length of ARG. */
+ int matchind = -1; /* Index of first nonexact match. */
+ int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
+
+ arglen = strlen(arg);
+
+ /* Test all elements for either exact match or abbreviated matches. */
+ for (i = 0; optlist[i]; i++) {
+ if (!strncmp(optlist[i], arg, arglen)) {
+ if (strlen(optlist[i]) == arglen)
+ /* Exact match found. */
+ return i;
+ else if (matchind == -1)
+ /* First nonexact match found. */
+ matchind = i;
+ else
+ /* Second nonexact match found. */
+ ambiguous = 1;
+ }
+ }
+ if (ambiguous)
+ return -2;
+ else
+ return matchind;
+}
+
+/*
+ * Error reporting for argmatch. KIND is a description of the type of entity
+ * that was being matched. VALUE is the invalid value that was given. PROBLEM
+ * is the return value from argmatch.
+ */
+static void
+invalid_arg(const char *kind, const char *value, int problem)
+{
+ fprintf(stderr, "patch: ");
+ if (problem == -1)
+ fprintf(stderr, "invalid");
+ else /* Assume -2. */
+ fprintf(stderr, "ambiguous");
+ fprintf(stderr, " %s `%s'\n", kind, value);
+}
+
+static const char *backup_args[] = {
+ "none", "never", "simple", "nil", "existing", "t", "numbered", 0
+};
+
+static enum backup_type backup_types[] = {
+ none, simple, simple, numbered_existing,
+ numbered_existing, numbered, numbered
+};
+
+/*
+ * Return the type of backup indicated by VERSION. Unique abbreviations are
+ * accepted.
+ */
+enum backup_type
+get_version(const char *version)
+{
+ int i;
+
+ if (version == NULL || *version == '\0')
+ return numbered_existing;
+ i = argmatch(version, backup_args);
+ if (i >= 0)
+ return backup_types[i];
+ invalid_arg("version control type", version, i);
+ exit(2);
+}
diff --git a/usr.bin/patch/backupfile.h b/usr.bin/patch/backupfile.h
new file mode 100644
index 0000000..71999f7
--- /dev/null
+++ b/usr.bin/patch/backupfile.h
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (C) 1990 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * without restriction.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * backupfile.h -- declarations for making Emacs style backup file names
+ *
+ * $OpenBSD: backupfile.h,v 1.6 2003/07/28 18:35:36 otto Exp $
+ * $FreeBSD$
+ */
+
+/* When to make backup files. */
+enum backup_type {
+ /* Never make backups. */
+ none,
+
+ /* Make simple backups of every file. */
+ simple,
+
+ /*
+ * Make numbered backups of files that already have numbered backups,
+ * and simple backups of the others.
+ */
+ numbered_existing,
+
+ /* Make numbered backups of every file. */
+ numbered
+};
+
+extern enum backup_type backup_type;
+extern const char *simple_backup_suffix;
+
+char *find_backup_file_name(const char *file);
+enum backup_type get_version(const char *version);
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h
new file mode 100644
index 0000000..2cdeaff
--- /dev/null
+++ b/usr.bin/patch/common.h
@@ -0,0 +1,112 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: common.h,v 1.26 2006/03/11 19:41:30 otto Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define DEBUGGING
+
+/* constants */
+
+#define MAXHUNKSIZE 200000 /* is this enough lines? */
+#define INITHUNKMAX 125 /* initial dynamic allocation size */
+#define INITLINELEN 4096
+#define BUFFERSIZE 4096
+#define LINENUM_MAX LONG_MAX
+
+#define ORIGEXT ".orig"
+#define REJEXT ".rej"
+
+/* handy definitions */
+
+#define strNE(s1,s2) (strcmp(s1, s2))
+#define strEQ(s1,s2) (!strcmp(s1, s2))
+#define strnNE(s1,s2,l) (strncmp(s1, s2, l))
+#define strnEQ(s1,s2,l) (!strncmp(s1, s2, l))
+
+/* typedefs */
+
+typedef long LINENUM; /* must be signed */
+
+/* globals */
+
+extern mode_t filemode;
+
+extern char *buf; /* general purpose buffer */
+extern size_t buf_size; /* size of general purpose buffer */
+
+extern bool using_plan_a; /* try to keep everything in memory */
+extern bool out_of_mem; /* ran out of memory in plan a */
+
+#define MAXFILEC 2
+
+extern char *filearg[MAXFILEC];
+extern bool ok_to_create_file;
+extern char *outname;
+extern char *origprae;
+
+extern char *TMPOUTNAME;
+extern char *TMPINNAME;
+extern char *TMPREJNAME;
+extern char *TMPPATNAME;
+extern bool toutkeep;
+extern bool trejkeep;
+
+#ifdef DEBUGGING
+extern int debug;
+#endif
+
+extern bool force;
+extern bool batch;
+extern bool verbose;
+extern bool reverse;
+extern bool noreverse;
+extern bool skip_rest_of_patch;
+extern int strippath;
+extern bool canonicalize;
+/* TRUE if -C was specified on command line. */
+extern bool check_only;
+extern bool warn_on_invalid_line;
+extern bool last_line_missing_eol;
+
+
+#define CONTEXT_DIFF 1
+#define NORMAL_DIFF 2
+#define ED_DIFF 3
+#define NEW_CONTEXT_DIFF 4
+#define UNI_DIFF 5
+
+extern int diff_type;
+extern char *revision; /* prerequisite revision, if any */
+extern LINENUM input_lines; /* how long is input file in lines */
+
+extern int posix;
+
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
new file mode 100644
index 0000000..19536da
--- /dev/null
+++ b/usr.bin/patch/inp.c
@@ -0,0 +1,433 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: inp.c,v 1.36 2012/04/10 14:46:34 ajacoutot Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <libgen.h>
+#include <paths.h>
+#include <spawn.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "util.h"
+#include "pch.h"
+#include "inp.h"
+
+
+/* Input-file-with-indexable-lines abstract type */
+
+static size_t i_size; /* size of the input file */
+static char *i_womp; /* plan a buffer for entire file */
+static char **i_ptr; /* pointers to lines in i_womp */
+static char empty_line[] = { '\0' };
+
+static int tifd = -1; /* plan b virtual string array */
+static char *tibuf[2]; /* plan b buffers */
+static LINENUM tiline[2] = {-1, -1}; /* 1st line in each buffer */
+static size_t lines_per_buf; /* how many lines per buffer */
+static size_t tibuflen; /* plan b buffer length */
+static size_t tireclen; /* length of records in tmp file */
+
+static bool rev_in_string(const char *);
+static bool reallocate_lines(size_t *);
+
+/* returns false if insufficient memory */
+static bool plan_a(const char *);
+
+static void plan_b(const char *);
+
+/* New patch--prepare to edit another file. */
+
+void
+re_input(void)
+{
+ if (using_plan_a) {
+ free(i_ptr);
+ i_ptr = NULL;
+ if (i_womp != NULL) {
+ munmap(i_womp, i_size);
+ i_womp = NULL;
+ }
+ i_size = 0;
+ } else {
+ using_plan_a = true; /* maybe the next one is smaller */
+ close(tifd);
+ tifd = -1;
+ free(tibuf[0]);
+ free(tibuf[1]);
+ tibuf[0] = tibuf[1] = NULL;
+ tiline[0] = tiline[1] = -1;
+ tireclen = 0;
+ }
+}
+
+/* Construct the line index, somehow or other. */
+
+void
+scan_input(const char *filename)
+{
+ if (!plan_a(filename))
+ plan_b(filename);
+ if (verbose) {
+ say("Patching file %s using Plan %s...\n", filename,
+ (using_plan_a ? "A" : "B"));
+ }
+}
+
+static bool
+reallocate_lines(size_t *lines_allocated)
+{
+ char **p;
+ size_t new_size;
+
+ new_size = *lines_allocated * 3 / 2;
+ p = realloc(i_ptr, (new_size + 2) * sizeof(char *));
+ if (p == NULL) { /* shucks, it was a near thing */
+ munmap(i_womp, i_size);
+ i_womp = NULL;
+ free(i_ptr);
+ i_ptr = NULL;
+ *lines_allocated = 0;
+ return false;
+ }
+ *lines_allocated = new_size;
+ i_ptr = p;
+ return true;
+}
+
+/* Try keeping everything in memory. */
+
+static bool
+plan_a(const char *filename)
+{
+ int ifd, statfailed;
+ char *p, *s;
+ struct stat filestat;
+ ptrdiff_t sz;
+ size_t i;
+ size_t iline, lines_allocated;
+
+#ifdef DEBUGGING
+ if (debug & 8)
+ return false;
+#endif
+
+ if (filename == NULL || *filename == '\0')
+ return false;
+
+ statfailed = stat(filename, &filestat);
+ if (statfailed && ok_to_create_file) {
+ if (verbose)
+ say("(Creating file %s...)\n", filename);
+
+ /*
+ * in check_patch case, we still display `Creating file' even
+ * though we're not. The rule is that -C should be as similar
+ * to normal patch behavior as possible
+ */
+ if (check_only)
+ return true;
+ makedirs(filename, true);
+ close(creat(filename, 0666));
+ statfailed = stat(filename, &filestat);
+ }
+ if (statfailed)
+ fatal("can't find %s\n", filename);
+ filemode = filestat.st_mode;
+ if (!S_ISREG(filemode))
+ fatal("%s is not a normal file--can't patch\n", filename);
+ if ((uint64_t)filestat.st_size > SIZE_MAX) {
+ say("block too large to mmap\n");
+ return false;
+ }
+ i_size = (size_t)filestat.st_size;
+ if (out_of_mem) {
+ set_hunkmax(); /* make sure dynamic arrays are allocated */
+ out_of_mem = false;
+ return false; /* force plan b because plan a bombed */
+ }
+ if ((ifd = open(filename, O_RDONLY)) < 0)
+ pfatal("can't open file %s", filename);
+
+ if (i_size) {
+ i_womp = mmap(NULL, i_size, PROT_READ, MAP_PRIVATE, ifd, 0);
+ if (i_womp == MAP_FAILED) {
+ perror("mmap failed");
+ i_womp = NULL;
+ close(ifd);
+ return false;
+ }
+ } else {
+ i_womp = NULL;
+ }
+
+ close(ifd);
+ if (i_size)
+ madvise(i_womp, i_size, MADV_SEQUENTIAL);
+
+ /* estimate the number of lines */
+ lines_allocated = i_size / 25;
+ if (lines_allocated < 100)
+ lines_allocated = 100;
+
+ if (!reallocate_lines(&lines_allocated))
+ return false;
+
+ /* now scan the buffer and build pointer array */
+ iline = 1;
+ i_ptr[iline] = i_womp;
+ /* test for NUL too, to maintain the behavior of the original code */
+ for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) {
+ if (*s == '\n') {
+ if (iline == lines_allocated) {
+ if (!reallocate_lines(&lines_allocated))
+ return false;
+ }
+ /* these are NOT NUL terminated */
+ i_ptr[++iline] = s + 1;
+ }
+ }
+ /* if the last line contains no EOL, append one */
+ if (i_size > 0 && i_womp[i_size - 1] != '\n') {
+ last_line_missing_eol = true;
+ /* fix last line */
+ sz = s - i_ptr[iline];
+ p = malloc(sz + 1);
+ if (p == NULL) {
+ free(i_ptr);
+ i_ptr = NULL;
+ munmap(i_womp, i_size);
+ i_womp = NULL;
+ return false;
+ }
+
+ memcpy(p, i_ptr[iline], sz);
+ p[sz] = '\n';
+ i_ptr[iline] = p;
+ /* count the extra line and make it point to some valid mem */
+ i_ptr[++iline] = empty_line;
+ } else
+ last_line_missing_eol = false;
+
+ input_lines = iline - 1;
+
+ /* now check for revision, if any */
+
+ if (revision != NULL) {
+ if (i_womp == NULL || !rev_in_string(i_womp)) {
+ if (force) {
+ if (verbose)
+ say("Warning: this file doesn't appear "
+ "to be the %s version--patching anyway.\n",
+ revision);
+ } else if (batch) {
+ fatal("this file doesn't appear to be the "
+ "%s version--aborting.\n",
+ revision);
+ } else {
+ ask("This file doesn't appear to be the "
+ "%s version--patch anyway? [n] ",
+ revision);
+ if (*buf != 'y')
+ fatal("aborted\n");
+ }
+ } else if (verbose)
+ say("Good. This file appears to be the %s version.\n",
+ revision);
+ }
+ return true; /* plan a will work */
+}
+
+/* Keep (virtually) nothing in memory. */
+
+static void
+plan_b(const char *filename)
+{
+ FILE *ifp;
+ size_t i = 0, j, len, maxlen = 1;
+ char *lbuf = NULL, *p;
+ bool found_revision = (revision == NULL);
+
+ using_plan_a = false;
+ if ((ifp = fopen(filename, "r")) == NULL)
+ pfatal("can't open file %s", filename);
+ unlink(TMPINNAME);
+ if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0)
+ pfatal("can't open file %s", TMPINNAME);
+ while ((p = fgetln(ifp, &len)) != NULL) {
+ if (p[len - 1] == '\n')
+ p[len - 1] = '\0';
+ else {
+ /* EOF without EOL, copy and add the NUL */
+ if ((lbuf = malloc(len + 1)) == NULL)
+ fatal("out of memory\n");
+ memcpy(lbuf, p, len);
+ lbuf[len] = '\0';
+ p = lbuf;
+
+ last_line_missing_eol = true;
+ len++;
+ }
+ if (revision != NULL && !found_revision && rev_in_string(p))
+ found_revision = true;
+ if (len > maxlen)
+ maxlen = len; /* find longest line */
+ }
+ free(lbuf);
+ if (ferror(ifp))
+ pfatal("can't read file %s", filename);
+
+ if (revision != NULL) {
+ if (!found_revision) {
+ if (force) {
+ if (verbose)
+ say("Warning: this file doesn't appear "
+ "to be the %s version--patching anyway.\n",
+ revision);
+ } else if (batch) {
+ fatal("this file doesn't appear to be the "
+ "%s version--aborting.\n",
+ revision);
+ } else {
+ ask("This file doesn't appear to be the %s "
+ "version--patch anyway? [n] ",
+ revision);
+ if (*buf != 'y')
+ fatal("aborted\n");
+ }
+ } else if (verbose)
+ say("Good. This file appears to be the %s version.\n",
+ revision);
+ }
+ fseek(ifp, 0L, SEEK_SET); /* rewind file */
+ tireclen = maxlen;
+ tibuflen = maxlen > BUFFERSIZE ? maxlen : BUFFERSIZE;
+ lines_per_buf = tibuflen / maxlen;
+ tibuf[0] = malloc(tibuflen + 1);
+ if (tibuf[0] == NULL)
+ fatal("out of memory\n");
+ tibuf[1] = malloc(tibuflen + 1);
+ if (tibuf[1] == NULL)
+ fatal("out of memory\n");
+ for (i = 1;; i++) {
+ p = tibuf[0] + maxlen * (i % lines_per_buf);
+ if (i % lines_per_buf == 0) /* new block */
+ if (write(tifd, tibuf[0], tibuflen) !=
+ (ssize_t) tibuflen)
+ pfatal("can't write temp file");
+ if (fgets(p, maxlen + 1, ifp) == NULL) {
+ input_lines = i - 1;
+ if (i % lines_per_buf != 0)
+ if (write(tifd, tibuf[0], tibuflen) !=
+ (ssize_t) tibuflen)
+ pfatal("can't write temp file");
+ break;
+ }
+ j = strlen(p);
+ /* These are '\n' terminated strings, so no need to add a NUL */
+ if (j == 0 || p[j - 1] != '\n')
+ p[j] = '\n';
+ }
+ fclose(ifp);
+ close(tifd);
+ if ((tifd = open(TMPINNAME, O_RDONLY)) < 0)
+ pfatal("can't reopen file %s", TMPINNAME);
+}
+
+/*
+ * Fetch a line from the input file, \n terminated, not necessarily \0.
+ */
+char *
+ifetch(LINENUM line, int whichbuf)
+{
+ if (line < 1 || line > input_lines) {
+ if (warn_on_invalid_line) {
+ say("No such line %ld in input file, ignoring\n", line);
+ warn_on_invalid_line = false;
+ }
+ return NULL;
+ }
+ if (using_plan_a)
+ return i_ptr[line];
+ else {
+ LINENUM offline = line % lines_per_buf;
+ LINENUM baseline = line - offline;
+
+ if (tiline[0] == baseline)
+ whichbuf = 0;
+ else if (tiline[1] == baseline)
+ whichbuf = 1;
+ else {
+ tiline[whichbuf] = baseline;
+
+ if (lseek(tifd, (off_t) (baseline / lines_per_buf *
+ tibuflen), SEEK_SET) < 0)
+ pfatal("cannot seek in the temporary input file");
+
+ if (read(tifd, tibuf[whichbuf], tibuflen) !=
+ (ssize_t) tibuflen)
+ pfatal("error reading tmp file %s", TMPINNAME);
+ }
+ return tibuf[whichbuf] + (tireclen * offline);
+ }
+}
+
+/*
+ * True if the string argument contains the revision number we want.
+ */
+static bool
+rev_in_string(const char *string)
+{
+ const char *s;
+ size_t patlen;
+
+ if (revision == NULL)
+ return true;
+ patlen = strlen(revision);
+ if (strnEQ(string, revision, patlen) && isspace((unsigned char)string[patlen]))
+ return true;
+ for (s = string; *s; s++) {
+ if (isspace((unsigned char)*s) && strnEQ(s + 1, revision, patlen) &&
+ isspace((unsigned char)s[patlen + 1])) {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/usr.bin/patch/inp.h b/usr.bin/patch/inp.h
new file mode 100644
index 0000000..062798a
--- /dev/null
+++ b/usr.bin/patch/inp.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: inp.h,v 1.8 2003/08/15 08:00:51 otto Exp $
+ * $FreeBSD$
+ */
+
+void re_input(void);
+void scan_input(const char *);
+char *ifetch(LINENUM, int);
diff --git a/usr.bin/patch/mkpath.c b/usr.bin/patch/mkpath.c
new file mode 100644
index 0000000..04fd537
--- /dev/null
+++ b/usr.bin/patch/mkpath.c
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 1983, 1992, 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.
+ * 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.
+ *
+ * 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.
+ *
+ * $OpenBSD: mkpath.c,v 1.2 2005/06/20 07:14:06 otto Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <err.h>
+#include <errno.h>
+#include <string.h>
+
+int mkpath(char *);
+
+/* Code taken directly from mkdir(1).
+
+ * mkpath -- create directories.
+ * path - path
+ */
+int
+mkpath(char *path)
+{
+ struct stat sb;
+ char *slash;
+ int done = 0;
+
+ slash = path;
+
+ while (!done) {
+ slash += strspn(slash, "/");
+ slash += strcspn(slash, "/");
+
+ done = (*slash == '\0');
+ *slash = '\0';
+
+ if (stat(path, &sb)) {
+ if (errno != ENOENT || (mkdir(path, 0777) &&
+ errno != EEXIST)) {
+ warn("%s", path);
+ return (-1);
+ }
+ } else if (!S_ISDIR(sb.st_mode)) {
+ warnx("%s: %s", path, strerror(ENOTDIR));
+ return (-1);
+ }
+
+ *slash = '/';
+ }
+
+ return (0);
+}
+
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1
new file mode 100644
index 0000000..e8478fc
--- /dev/null
+++ b/usr.bin/patch/patch.1
@@ -0,0 +1,690 @@
+.\"-
+.\" Copyright 1986, Larry Wall
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following condition
+.\" is met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this condition and the following disclaimer.
+.\"
+.\" 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.
+.\"
+.\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $
+.\" $FreeBSD$
+.Dd August 15, 2015
+.Dt PATCH 1
+.Os
+.Sh NAME
+.Nm patch
+.Nd apply a diff file to an original
+.Sh SYNOPSIS
+.Nm
+.Bk -words
+.Op Fl bCcEeflNnRstuv
+.Op Fl B Ar backup-prefix
+.Op Fl D Ar symbol
+.Op Fl d Ar directory
+.Op Fl F Ar max-fuzz
+.Op Fl i Ar patchfile
+.Op Fl o Ar out-file
+.Op Fl p Ar strip-count
+.Op Fl r Ar rej-name
+.Op Fl V Cm t | nil | never | none
+.Op Fl x Ar number
+.Op Fl z Ar backup-ext
+.Op Fl Fl posix
+.Op Ar origfile Op Ar patchfile
+.Ek
+.Nm
+.Pf \*(Lt Ar patchfile
+.Sh DESCRIPTION
+.Nm
+will take a patch file containing any of the four forms of difference
+listing produced by the
+.Xr diff 1
+program and apply those differences to an original file,
+producing a patched version.
+If
+.Ar patchfile
+is omitted, or is a hyphen, the patch will be read from the standard input.
+.Pp
+.Nm
+will attempt to determine the type of the diff listing, unless overruled by a
+.Fl c ,
+.Fl e ,
+.Fl n ,
+or
+.Fl u
+option.
+Context diffs (old-style, new-style, and unified) and
+normal diffs are applied directly by the
+.Nm
+program itself, whereas ed diffs are simply fed to the
+.Xr ed 1
+editor via a pipe.
+.Pp
+If the
+.Ar patchfile
+contains more than one patch,
+.Nm
+will try to apply each of them as if they came from separate patch files.
+This means, among other things, that it is assumed that the name of the file
+to patch must be determined for each diff listing, and that the garbage before
+each diff listing will be examined for interesting things such as file names
+and revision level (see the section on
+.Sx Filename Determination
+below).
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Xo
+.Fl B Ar backup-prefix ,
+.Fl Fl prefix Ar backup-prefix
+.Xc
+Causes the next argument to be interpreted as a prefix to the backup file
+name.
+If this argument is specified, any argument to
+.Fl z
+will be ignored.
+.It Fl b , Fl Fl backup
+Save a backup copy of the file before it is modified.
+By default the original file is saved with a backup extension of
+.Qq .orig
+unless the file already has a numbered backup, in which case a numbered
+backup is made.
+This is equivalent to specifying
+.Qo Fl V Cm existing Qc .
+This option is currently the default, unless
+.Fl -posix
+is specified.
+.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
+.Nm
+to interpret the patch file as a context diff.
+.It Xo
+.Fl D Ar symbol ,
+.Fl Fl ifdef Ar symbol
+.Xc
+Causes
+.Nm
+to use the
+.Qq #ifdef...#endif
+construct to mark changes.
+The argument following will be used as the differentiating symbol.
+Note that, unlike the C compiler, there must be a space between the
+.Fl D
+and the argument.
+.It Xo
+.Fl d Ar directory ,
+.Fl Fl directory Ar directory
+.Xc
+Causes
+.Nm
+to interpret the next argument as a directory,
+and change the working directory to it before doing anything else.
+.It Fl E , Fl Fl remove-empty-files
+Causes
+.Nm
+to remove output files that are empty after the patches have been applied.
+This option is useful when applying patches that create or remove files.
+.It Fl e , Fl Fl ed
+Forces
+.Nm
+to interpret the patch file as an
+.Xr ed 1
+script.
+.It Xo
+.Fl F Ar max-fuzz ,
+.Fl Fl fuzz Ar max-fuzz
+.Xc
+Sets the maximum fuzz factor.
+This option only applies to context diffs, and causes
+.Nm
+to ignore up to that many lines in looking for places to install a hunk.
+Note that a larger fuzz factor increases the odds of a faulty patch.
+The default fuzz factor is 2, and it may not be set to more than
+the number of lines of context in the context diff, ordinarily 3.
+.It Fl f , Fl Fl force
+Forces
+.Nm
+to assume that the user knows exactly what he or she is doing, and to not
+ask any questions.
+It assumes the following:
+skip patches for which a file to patch cannot be found;
+patch files even though they have the wrong version for the
+.Qq Prereq:
+line in the patch;
+and assume that patches are not reversed even if they look like they are.
+This option does not suppress commentary; use
+.Fl s
+for that.
+.It Xo
+.Fl i Ar patchfile ,
+.Fl Fl input Ar patchfile
+.Xc
+Causes the next argument to be interpreted as the input file name
+(i.e., a patchfile).
+This option may be specified multiple times.
+.It Fl l , Fl Fl ignore-whitespace
+Causes the pattern matching to be done loosely, in case the tabs and
+spaces have been munged in your input file.
+Any sequence of whitespace in the pattern line will match any sequence
+in the input file.
+Normal characters must still match exactly.
+Each line of the context must still match a line in the input file.
+.It Fl N , Fl Fl forward
+Causes
+.Nm
+to ignore patches that it thinks are reversed or already applied.
+See also
+.Fl R .
+.It Fl n , Fl Fl normal
+Forces
+.Nm
+to interpret the patch file as a normal diff.
+.It Xo
+.Fl o Ar out-file ,
+.Fl Fl output Ar out-file
+.Xc
+Causes the next argument to be interpreted as the output file name.
+.It Xo
+.Fl p Ar strip-count ,
+.Fl Fl strip Ar strip-count
+.Xc
+Sets the pathname strip count,
+which controls how pathnames found in the patch file are treated,
+in case you keep your files in a different directory than the person who sent
+out the patch.
+The strip count specifies how many slashes are to be stripped from
+the front of the pathname.
+(Any intervening directory names also go away.)
+For example, supposing the file name in the patch file was
+.Pa /u/howard/src/blurfl/blurfl.c :
+.Pp
+Setting
+.Fl p Ns Ar 0
+gives the entire pathname unmodified.
+.Pp
+.Fl p Ns Ar 1
+gives
+.Pp
+.D1 Pa u/howard/src/blurfl/blurfl.c
+.Pp
+without the leading slash.
+.Pp
+.Fl p Ns Ar 4
+gives
+.Pp
+.D1 Pa blurfl/blurfl.c
+.Pp
+Not specifying
+.Fl p
+at all just gives you
+.Pa blurfl.c ,
+unless all of the directories in the leading path
+.Pq Pa u/howard/src/blurfl
+exist and that path is relative,
+in which case you get the entire pathname unmodified.
+Whatever you end up with is looked for either in the current directory,
+or the directory specified by the
+.Fl d
+option.
+.It Fl R , Fl Fl reverse
+Tells
+.Nm
+that this patch was created with the old and new files swapped.
+(Yes, I am afraid that does happen occasionally, human nature being what it
+is.)
+.Nm
+will attempt to swap each hunk around before applying it.
+Rejects will come out in the swapped format.
+The
+.Fl R
+option will not work with ed diff scripts because there is too little
+information to reconstruct the reverse operation.
+.Pp
+If the first hunk of a patch fails,
+.Nm
+will reverse the hunk to see if it can be applied that way.
+If it can, you will be asked if you want to have the
+.Fl R
+option set.
+If it cannot, the patch will continue to be applied normally.
+(Note: this method cannot detect a reversed patch if it is a normal diff
+and if the first command is an append (i.e., it should have been a delete)
+since appends always succeed, due to the fact that a null context will match
+anywhere.
+Luckily, most patches add or change lines rather than delete them, so most
+reversed normal diffs will begin with a delete, which will fail, triggering
+the heuristic.)
+.It Xo
+.Fl r Ar rej-name ,
+.Fl Fl reject-file Ar rej-name
+.Xc
+Causes the next argument to be interpreted as the reject file name.
+.It Xo
+.Fl s , Fl Fl quiet ,
+.Fl Fl silent
+.Xc
+Makes
+.Nm
+do its work silently, unless an error occurs.
+.It Fl t , Fl Fl batch
+Similar to
+.Fl f ,
+in that it suppresses questions, but makes some different assumptions:
+skip patches for which a file to patch cannot be found (the same as
+.Fl f ) ;
+skip patches for which the file has the wrong version for the
+.Qq Prereq:
+line in the patch;
+and assume that patches are reversed if they look like they are.
+.It Fl u , Fl Fl unified
+Forces
+.Nm
+to interpret the patch file as a unified context diff (a unidiff).
+.It Xo
+.Fl V Cm t | nil | never | none ,
+.Fl Fl version-control Cm t | nil | never | none
+.Xc
+Causes the next argument to be interpreted as a method for creating
+backup file names.
+The type of backups made can also be given in the
+.Ev PATCH_VERSION_CONTROL
+or
+.Ev VERSION_CONTROL
+environment variables, which are overridden by this option.
+The
+.Fl B
+option overrides this option, causing the prefix to always be used for
+making backup file names.
+The values of the
+.Ev PATCH_VERSION_CONTROL
+and
+.Ev VERSION_CONTROL
+environment variables and the argument to the
+.Fl V
+option are like the GNU Emacs
+.Dq version-control
+variable; they also recognize synonyms that are more descriptive.
+The valid values are (unique abbreviations are accepted):
+.Bl -tag -width Ds -offset indent
+.It Cm t , numbered
+Always make numbered backups.
+.It Cm nil , existing
+Make numbered backups of files that already have them,
+simple backups of the others.
+.It Cm never , simple
+Always make simple backups.
+.It Cm none
+Do not make backups.
+.El
+.It Fl v , Fl Fl version
+Causes
+.Nm
+to print out its revision header and patch level.
+.It Xo
+.Fl x Ar number ,
+.Fl Fl debug Ar number
+.Xc
+Sets internal debugging flags, and is of interest only to
+.Nm
+patchers.
+.It Xo
+.Fl z Ar backup-ext ,
+.Fl Fl suffix Ar backup-ext
+.Xc
+Causes the next argument to be interpreted as the backup extension, to be
+used in place of
+.Qq .orig .
+.It Fl Fl posix
+Enables strict
+.St -p1003.1-2008
+conformance, specifically:
+.Bl -enum
+.It
+Backup files are not created unless the
+.Fl b
+option is specified.
+.It
+If unspecified, the file name used is the first of the old, new and
+index files that exists.
+.El
+.El
+.Ss Patch Application
+.Nm
+will try to skip any leading garbage, apply the diff,
+and then skip any trailing garbage.
+Thus you could feed an article or message containing a
+diff listing to
+.Nm ,
+and it should work.
+If the entire diff is indented by a consistent amount,
+this will be taken into account.
+.Pp
+With context diffs, and to a lesser extent with normal diffs,
+.Nm
+can detect when the line numbers mentioned in the patch are incorrect,
+and will attempt to find the correct place to apply each hunk of the patch.
+As a first guess, it takes the line number mentioned for the hunk, plus or
+minus any offset used in applying the previous hunk.
+If that is not the correct place,
+.Nm
+will scan both forwards and backwards for a set of lines matching the context
+given in the hunk.
+First
+.Nm
+looks for a place where all lines of the context match.
+If no such place is found, and it is a context diff, and the maximum fuzz factor
+is set to 1 or more, then another scan takes place ignoring the first and last
+line of context.
+If that fails, and the maximum fuzz factor is set to 2 or more,
+the first two and last two lines of context are ignored,
+and another scan is made.
+.Pq The default maximum fuzz factor is 2.
+.Pp
+If
+.Nm
+cannot find a place to install that hunk of the patch, it will put the hunk
+out to a reject file, which normally is the name of the output file plus
+.Qq .rej .
+(Note that the rejected hunk will come out in context diff form whether the
+input patch was a context diff or a normal diff.
+If the input was a normal diff, many of the contexts will simply be null.)
+The line numbers on the hunks in the reject file may be different than
+in the patch file: they reflect the approximate location patch thinks the
+failed hunks belong in the new file rather than the old one.
+.Pp
+As each hunk is completed, you will be told whether the hunk succeeded or
+failed, and which line (in the new file)
+.Nm
+thought the hunk should go on.
+If this is different from the line number specified in the diff,
+you will be told the offset.
+A single large offset MAY be an indication that a hunk was installed in the
+wrong place.
+You will also be told if a fuzz factor was used to make the match, in which
+case you should also be slightly suspicious.
+.Ss Filename Determination
+If no original file is specified on the command line,
+.Nm
+will try to figure out from the leading garbage what the name of the file
+to edit is.
+When checking a prospective file name, pathname components are stripped
+as specified by the
+.Fl p
+option and the file's existence and writability are checked relative
+to the current working directory (or the directory specified by the
+.Fl d
+option).
+.Pp
+If the diff is a context or unified diff,
+.Nm
+is able to determine the old and new file names from the diff header.
+For context diffs, the
+.Dq old
+file is specified in the line beginning with
+.Qq ***
+and the
+.Dq new
+file is specified in the line beginning with
+.Qq --- .
+For a unified diff, the
+.Dq old
+file is specified in the line beginning with
+.Qq ---
+and the
+.Dq new
+file is specified in the line beginning with
+.Qq +++ .
+If there is an
+.Qq Index:
+line in the leading garbage (regardless of the diff type),
+.Nm
+will use the file name from that line as the
+.Dq index
+file.
+.Pp
+.Nm
+will choose the file name by performing the following steps, with the first
+match used:
+.Bl -enum
+.It
+If
+.Nm
+is operating in strict
+.St -p1003.1-2008
+mode, the first of the
+.Dq old ,
+.Dq new
+and
+.Dq index
+file names that exist is used.
+Otherwise,
+.Nm
+will examine either the
+.Dq old
+and
+.Dq new
+file names or, for a non-context diff, the
+.Dq index
+file name, and choose the file name with the fewest path components,
+the shortest basename, and the shortest total file name length (in that order).
+.It
+If no suitable file was found to patch, the patch file is a context or
+unified diff, and the old file was zero length, the new file name is
+created and used.
+.It
+If the file name still cannot be determined,
+.Nm
+will prompt the user for the file name to use.
+.El
+.Pp
+Additionally, if the leading garbage contains a
+.Qq Prereq:\ \&
+line,
+.Nm
+will take the first word from the prerequisites line (normally a version
+number) and check the input file to see if that word can be found.
+If not,
+.Nm
+will ask for confirmation before proceeding.
+.Pp
+The upshot of all this is that you should be able to say, while in a news
+interface, the following:
+.Pp
+.Dl | patch -d /usr/src/local/blurfl
+.Pp
+and patch a file in the blurfl directory directly from the article containing
+the patch.
+.Ss Backup Files
+By default, the patched version is put in place of the original, with
+the original file backed up to the same name with the extension
+.Qq .orig ,
+or as specified by the
+.Fl B ,
+.Fl V ,
+or
+.Fl z
+options.
+The extension used for making backup files may also be specified in the
+.Ev SIMPLE_BACKUP_SUFFIX
+environment variable, which is overridden by the options above.
+.Pp
+If the backup file is a symbolic or hard link to the original file,
+.Nm
+creates a new backup file name by changing the first lowercase letter
+in the last component of the file's name into uppercase.
+If there are no more lowercase letters in the name,
+it removes the first character from the name.
+It repeats this process until it comes up with a
+backup file that does not already exist or is not linked to the original file.
+.Pp
+You may also specify where you want the output to go with the
+.Fl o
+option; if that file already exists, it is backed up first.
+.Ss Notes For Patch Senders
+There are several things you should bear in mind if you are going to
+be sending out patches:
+.Pp
+First, you can save people a lot of grief by keeping a
+.Pa patchlevel.h
+file which is patched to increment the patch level as the first diff in the
+patch file you send out.
+If you put a
+.Qq Prereq:
+line in with the patch, it will not let them apply
+patches out of order without some warning.
+.Pp
+Second, make sure you have specified the file names right, either in a
+context diff header, or with an
+.Qq Index:
+line.
+If you are patching something in a subdirectory, be sure to tell the patch
+user to specify a
+.Fl p
+option as needed.
+.Pp
+Third, you can create a file by sending out a diff that compares a
+null file to the file you want to create.
+This will only work if the file you want to create does not exist already in
+the target directory.
+.Pp
+Fourth, take care not to send out reversed patches, since it makes people wonder
+whether they already applied the patch.
+.Pp
+Fifth, while you may be able to get away with putting 582 diff listings into
+one file, it is probably wiser to group related patches into separate files in
+case something goes haywire.
+.Sh ENVIRONMENT
+.Bl -tag -width "PATCH_VERSION_CONTROL" -compact
+.It Ev POSIXLY_CORRECT
+When set,
+.Nm
+behaves as if the
+.Fl Fl posix
+option has been specified.
+.It Ev SIMPLE_BACKUP_SUFFIX
+Extension to use for backup file names instead of
+.Qq .orig .
+.It Ev TMPDIR
+Directory to put temporary files in; default is
+.Pa /tmp .
+.It Ev PATCH_VERSION_CONTROL
+Selects when numbered backup files are made.
+.It Ev VERSION_CONTROL
+Same as
+.Ev PATCH_VERSION_CONTROL .
+.El
+.Sh FILES
+.Bl -tag -width "$TMPDIR/patch*" -compact
+.It Pa $TMPDIR/patch*
+.Nm
+temporary files
+.It Pa /dev/tty
+used to read input when
+.Nm
+prompts the user
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It 0
+Successful completion.
+.It 1
+One or more lines were written to a reject file.
+.It \*(Gt1
+An error occurred.
+.El
+.Pp
+When applying a set of patches in a loop it behooves you to check this
+exit status so you do not apply a later patch to a partially patched file.
+.Sh DIAGNOSTICS
+Too many to list here, but generally indicative that
+.Nm
+couldn't parse your patch file.
+.Pp
+The message
+.Qq Hmm...
+indicates that there is unprocessed text in the patch file and that
+.Nm
+is attempting to intuit whether there is a patch in that text and, if so,
+what kind of patch it is.
+.Sh SEE ALSO
+.Xr diff 1
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification,
+except as detailed above for the
+.Fl -posix
+option.
+.Pp
+The flags
+.Op Fl BCEFfstVvxz
+and
+.Op Fl -posix
+are extensions to that specification.
+.Sh AUTHORS
+.An Larry Wall
+with many other contributors.
+.Sh CAVEATS
+.Nm
+cannot tell if the line numbers are off in an ed script, and can only detect
+bad line numbers in a normal diff when it finds a
+.Qq change
+or a
+.Qq delete
+command.
+A context diff using fuzz factor 3 may have the same problem.
+Until a suitable interactive interface is added, you should probably do
+a context diff in these cases to see if the changes made sense.
+Of course, compiling without errors is a pretty good indication that the patch
+worked, but not always.
+.Pp
+.Nm
+usually produces the correct results, even when it has to do a lot of
+guessing.
+However, the results are guaranteed to be correct only when the patch is
+applied to exactly the same version of the file that the patch was
+generated from.
+.Sh BUGS
+Could be smarter about partial matches, excessively deviant offsets and
+swapped code, but that would take an extra pass.
+.Pp
+Check patch mode
+.Pq Fl C
+will fail if you try to check several patches in succession that build on
+each other.
+The entire
+.Nm
+code would have to be restructured to keep temporary files around so that it
+can handle this situation.
+.Pp
+If code has been duplicated (for instance with #ifdef OLDCODE ... #else ...
+#endif),
+.Nm
+is incapable of patching both versions, and, if it works at all, will likely
+patch the wrong one, and tell you that it succeeded to boot.
+.Pp
+If you apply a patch you have already applied,
+.Nm
+will think it is a reversed patch, and offer to un-apply the patch.
+This could be construed as a feature.
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
new file mode 100644
index 0000000..1bdbcfb
--- /dev/null
+++ b/usr.bin/patch/patch.c
@@ -0,0 +1,1082 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: patch.c,v 1.54 2014/12/13 10:31:07 tobias Exp $
+ * $FreeBSD$
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <getopt.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "util.h"
+#include "pch.h"
+#include "inp.h"
+#include "backupfile.h"
+#include "pathnames.h"
+
+mode_t filemode = 0644;
+
+char *buf; /* general purpose buffer */
+size_t buf_size; /* size of the general purpose buffer */
+
+bool using_plan_a = true; /* try to keep everything in memory */
+bool out_of_mem = false; /* ran out of memory in plan a */
+
+#define MAXFILEC 2
+
+char *filearg[MAXFILEC];
+bool ok_to_create_file = false;
+char *outname = NULL;
+char *origprae = NULL;
+char *TMPOUTNAME;
+char *TMPINNAME;
+char *TMPREJNAME;
+char *TMPPATNAME;
+bool toutkeep = false;
+bool trejkeep = false;
+bool warn_on_invalid_line;
+bool last_line_missing_eol;
+
+#ifdef DEBUGGING
+int debug = 0;
+#endif
+
+bool force = false;
+bool batch = false;
+bool verbose = true;
+bool reverse = false;
+bool noreverse = false;
+bool skip_rest_of_patch = false;
+int strippath = 957;
+bool canonicalize = false;
+bool check_only = false;
+int diff_type = 0;
+char *revision = NULL; /* prerequisite revision, if any */
+LINENUM input_lines = 0; /* how long is input file in lines */
+int posix = 0; /* strict POSIX mode? */
+
+static void reinitialize_almost_everything(void);
+static void get_some_switches(void);
+static LINENUM locate_hunk(LINENUM);
+static void abort_context_hunk(void);
+static void rej_line(int, LINENUM);
+static void abort_hunk(void);
+static void apply_hunk(LINENUM);
+static void init_output(const char *);
+static void init_reject(const char *);
+static void copy_till(LINENUM, bool);
+static bool spew_output(void);
+static void dump_line(LINENUM, bool);
+static bool patch_match(LINENUM, LINENUM, LINENUM);
+static bool similar(const char *, const char *, int);
+static void usage(void);
+
+/* true if -E was specified on command line. */
+static bool remove_empty_files = false;
+
+/* true if -R was specified on command line. */
+static bool reverse_flag_specified = false;
+
+static bool Vflag = false;
+
+/* buffer holding the name of the rejected patch file. */
+static char rejname[NAME_MAX + 1];
+
+/* how many input lines have been irretractibly output */
+static LINENUM last_frozen_line = 0;
+
+static int Argc; /* guess */
+static char **Argv;
+static int Argc_last; /* for restarting plan_b */
+static char **Argv_last;
+
+static FILE *ofp = NULL; /* output file pointer */
+static FILE *rejfp = NULL; /* reject file pointer */
+
+static int filec = 0; /* how many file arguments? */
+static LINENUM last_offset = 0;
+static LINENUM maxfuzz = 2;
+
+/* patch using ifdef, ifndef, etc. */
+static bool do_defines = false;
+/* #ifdef xyzzy */
+static char if_defined[128];
+/* #ifndef xyzzy */
+static char not_defined[128];
+/* #else */
+static const char else_defined[] = "#else\n";
+/* #endif xyzzy */
+static char end_defined[128];
+
+
+/* Apply a set of diffs as appropriate. */
+
+int
+main(int argc, char *argv[])
+{
+ int error = 0, hunk, failed, i, fd;
+ bool patch_seen, reverse_seen;
+ LINENUM where = 0, newwhere, fuzz, mymaxfuzz;
+ const char *tmpdir;
+ char *v;
+
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(stderr, NULL, _IOLBF, 0);
+ for (i = 0; i < MAXFILEC; i++)
+ filearg[i] = NULL;
+
+ buf_size = INITLINELEN;
+ buf = malloc((unsigned)(buf_size));
+ if (buf == NULL)
+ fatal("out of memory\n");
+
+ /* Cons up the names of the temporary files. */
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+ for (i = strlen(tmpdir) - 1; i > 0 && tmpdir[i] == '/'; i--)
+ ;
+ i++;
+ if (asprintf(&TMPOUTNAME, "%.*s/patchoXXXXXXXXXX", i, tmpdir) == -1)
+ fatal("cannot allocate memory");
+ if ((fd = mkstemp(TMPOUTNAME)) < 0)
+ pfatal("can't create %s", TMPOUTNAME);
+ close(fd);
+
+ if (asprintf(&TMPINNAME, "%.*s/patchiXXXXXXXXXX", i, tmpdir) == -1)
+ fatal("cannot allocate memory");
+ if ((fd = mkstemp(TMPINNAME)) < 0)
+ pfatal("can't create %s", TMPINNAME);
+ close(fd);
+
+ if (asprintf(&TMPREJNAME, "%.*s/patchrXXXXXXXXXX", i, tmpdir) == -1)
+ fatal("cannot allocate memory");
+ if ((fd = mkstemp(TMPREJNAME)) < 0)
+ pfatal("can't create %s", TMPREJNAME);
+ close(fd);
+
+ if (asprintf(&TMPPATNAME, "%.*s/patchpXXXXXXXXXX", i, tmpdir) == -1)
+ fatal("cannot allocate memory");
+ if ((fd = mkstemp(TMPPATNAME)) < 0)
+ pfatal("can't create %s", TMPPATNAME);
+ close(fd);
+
+ v = getenv("SIMPLE_BACKUP_SUFFIX");
+ if (v)
+ simple_backup_suffix = v;
+ else
+ simple_backup_suffix = ORIGEXT;
+
+ /* parse switches */
+ Argc = argc;
+ Argv = argv;
+ get_some_switches();
+
+ if (!Vflag) {
+ if ((v = getenv("PATCH_VERSION_CONTROL")) == NULL)
+ v = getenv("VERSION_CONTROL");
+ if (v != NULL || !posix)
+ backup_type = get_version(v); /* OK to pass NULL. */
+ }
+
+ /* make sure we clean up /tmp in case of disaster */
+ set_signals(0);
+
+ patch_seen = false;
+ for (open_patch_file(filearg[1]); there_is_another_patch();
+ reinitialize_almost_everything()) {
+ /* for each patch in patch file */
+
+ patch_seen = true;
+
+ warn_on_invalid_line = true;
+
+ if (outname == NULL)
+ outname = xstrdup(filearg[0]);
+
+ /* for ed script just up and do it and exit */
+ if (diff_type == ED_DIFF) {
+ do_ed_script();
+ continue;
+ }
+ /* initialize the patched file */
+ if (!skip_rest_of_patch)
+ init_output(TMPOUTNAME);
+
+ /* initialize reject file */
+ init_reject(TMPREJNAME);
+
+ /* find out where all the lines are */
+ if (!skip_rest_of_patch)
+ scan_input(filearg[0]);
+
+ /*
+ * from here on, open no standard i/o files, because
+ * malloc might misfire and we can't catch it easily
+ */
+
+ /* apply each hunk of patch */
+ hunk = 0;
+ failed = 0;
+ reverse_seen = false;
+ out_of_mem = false;
+ while (another_hunk()) {
+ hunk++;
+ fuzz = 0;
+ mymaxfuzz = pch_context();
+ if (maxfuzz < mymaxfuzz)
+ mymaxfuzz = maxfuzz;
+ if (!skip_rest_of_patch) {
+ do {
+ where = locate_hunk(fuzz);
+ if (hunk == 1 && where == 0 && !force && !reverse_seen) {
+ /* dwim for reversed patch? */
+ if (!pch_swap()) {
+ if (fuzz == 0)
+ say("Not enough memory to try swapped hunk! Assuming unswapped.\n");
+ continue;
+ }
+ reverse = !reverse;
+ /* try again */
+ where = locate_hunk(fuzz);
+ if (where == 0) {
+ /* didn't find it swapped */
+ if (!pch_swap())
+ /* put it back to normal */
+ fatal("lost hunk on alloc error!\n");
+ reverse = !reverse;
+ } else if (noreverse) {
+ if (!pch_swap())
+ /* put it back to normal */
+ fatal("lost hunk on alloc error!\n");
+ reverse = !reverse;
+ say("Ignoring previously applied (or reversed) patch.\n");
+ skip_rest_of_patch = true;
+ } else if (batch) {
+ if (verbose)
+ say("%seversed (or previously applied) patch detected! %s -R.",
+ reverse ? "R" : "Unr",
+ reverse ? "Assuming" : "Ignoring");
+ } else {
+ ask("%seversed (or previously applied) patch detected! %s -R? [y] ",
+ reverse ? "R" : "Unr",
+ reverse ? "Assume" : "Ignore");
+ if (*buf == 'n') {
+ ask("Apply anyway? [n] ");
+ if (*buf != 'y')
+ skip_rest_of_patch = true;
+ else
+ reverse_seen = true;
+ where = 0;
+ reverse = !reverse;
+ if (!pch_swap())
+ /* put it back to normal */
+ fatal("lost hunk on alloc error!\n");
+ }
+ }
+ }
+ } while (!skip_rest_of_patch && where == 0 &&
+ ++fuzz <= mymaxfuzz);
+
+ if (skip_rest_of_patch) { /* just got decided */
+ if (ferror(ofp) || fclose(ofp)) {
+ say("Error writing %s\n",
+ TMPOUTNAME);
+ error = 1;
+ }
+ ofp = NULL;
+ }
+ }
+ newwhere = pch_newfirst() + last_offset;
+ if (skip_rest_of_patch) {
+ abort_hunk();
+ failed++;
+ if (verbose)
+ say("Hunk #%d ignored at %ld.\n",
+ hunk, newwhere);
+ } else if (where == 0) {
+ abort_hunk();
+ failed++;
+ if (verbose)
+ say("Hunk #%d failed at %ld.\n",
+ hunk, newwhere);
+ } else {
+ apply_hunk(where);
+ if (verbose) {
+ say("Hunk #%d succeeded at %ld",
+ hunk, newwhere);
+ if (fuzz != 0)
+ say(" with fuzz %ld", fuzz);
+ if (last_offset)
+ say(" (offset %ld line%s)",
+ last_offset,
+ last_offset == 1L ? "" : "s");
+ say(".\n");
+ }
+ }
+ }
+
+ if (out_of_mem && using_plan_a) {
+ Argc = Argc_last;
+ Argv = Argv_last;
+ say("\n\nRan out of memory using Plan A--trying again...\n\n");
+ if (ofp)
+ fclose(ofp);
+ ofp = NULL;
+ if (rejfp)
+ fclose(rejfp);
+ rejfp = NULL;
+ continue;
+ }
+ if (hunk == 0)
+ fatal("Internal error: hunk should not be 0\n");
+
+ /* finish spewing out the new file */
+ if (!skip_rest_of_patch && !spew_output()) {
+ say("Can't write %s\n", TMPOUTNAME);
+ error = 1;
+ }
+
+ /* and put the output where desired */
+ ignore_signals();
+ if (!skip_rest_of_patch) {
+ struct stat statbuf;
+ char *realout = outname;
+
+ if (!check_only) {
+ if (move_file(TMPOUTNAME, outname) < 0) {
+ toutkeep = true;
+ realout = TMPOUTNAME;
+ chmod(TMPOUTNAME, filemode);
+ } else
+ chmod(outname, filemode);
+
+ if (remove_empty_files &&
+ stat(realout, &statbuf) == 0 &&
+ statbuf.st_size == 0) {
+ if (verbose)
+ say("Removing %s (empty after patching).\n",
+ realout);
+ unlink(realout);
+ }
+ }
+ }
+ if (ferror(rejfp) || fclose(rejfp)) {
+ say("Error writing %s\n", rejname);
+ error = 1;
+ }
+ rejfp = NULL;
+ if (failed) {
+ error = 1;
+ if (*rejname == '\0') {
+ if (strlcpy(rejname, outname,
+ sizeof(rejname)) >= sizeof(rejname))
+ fatal("filename %s is too long\n", outname);
+ if (strlcat(rejname, REJEXT,
+ sizeof(rejname)) >= sizeof(rejname))
+ fatal("filename %s is too long\n", outname);
+ }
+ if (!check_only)
+ say("%d out of %d hunks %s--saving rejects to %s\n",
+ failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname);
+ else
+ say("%d out of %d hunks %s while patching %s\n",
+ failed, hunk, skip_rest_of_patch ? "ignored" : "failed", filearg[0]);
+ if (!check_only && move_file(TMPREJNAME, rejname) < 0)
+ trejkeep = true;
+ }
+ set_signals(1);
+ }
+
+ if (!patch_seen)
+ error = 2;
+
+ my_exit(error);
+ /* NOTREACHED */
+}
+
+/* Prepare to find the next patch to do in the patch file. */
+
+static void
+reinitialize_almost_everything(void)
+{
+ re_patch();
+ re_input();
+
+ input_lines = 0;
+ last_frozen_line = 0;
+
+ filec = 0;
+ if (!out_of_mem) {
+ free(filearg[0]);
+ filearg[0] = NULL;
+ }
+
+ free(outname);
+ outname = NULL;
+
+ last_offset = 0;
+ diff_type = 0;
+
+ free(revision);
+ revision = NULL;
+
+ reverse = reverse_flag_specified;
+ skip_rest_of_patch = false;
+
+ get_some_switches();
+}
+
+/* Process switches and filenames. */
+
+static void
+get_some_switches(void)
+{
+ const char *options = "b::B:cCd:D:eEfF:i:lnNo:p:r:RstuvV:x:z:";
+ static struct option longopts[] = {
+ {"backup", no_argument, 0, 'b'},
+ {"batch", no_argument, 0, 't'},
+ {"check", no_argument, 0, 'C'},
+ {"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'},
+ {"fuzz", required_argument, 0, 'F'},
+ {"ifdef", required_argument, 0, 'D'},
+ {"input", required_argument, 0, 'i'},
+ {"ignore-whitespace", no_argument, 0, 'l'},
+ {"normal", no_argument, 0, 'n'},
+ {"output", required_argument, 0, 'o'},
+ {"prefix", required_argument, 0, 'B'},
+ {"quiet", no_argument, 0, 's'},
+ {"reject-file", required_argument, 0, 'r'},
+ {"remove-empty-files", no_argument, 0, 'E'},
+ {"reverse", no_argument, 0, 'R'},
+ {"silent", no_argument, 0, 's'},
+ {"strip", required_argument, 0, 'p'},
+ {"suffix", required_argument, 0, 'z'},
+ {"unified", no_argument, 0, 'u'},
+ {"version", no_argument, 0, 'v'},
+ {"version-control", required_argument, 0, 'V'},
+ {"posix", no_argument, &posix, 1},
+ {NULL, 0, 0, 0}
+ };
+ int ch;
+
+ rejname[0] = '\0';
+ Argc_last = Argc;
+ Argv_last = Argv;
+ if (!Argc)
+ return;
+ optreset = optind = 1;
+ while ((ch = getopt_long(Argc, Argv, options, longopts, NULL)) != -1) {
+ switch (ch) {
+ case 'b':
+ if (backup_type == none)
+ backup_type = numbered_existing;
+ if (optarg == NULL)
+ break;
+ if (verbose)
+ say("Warning, the ``-b suffix'' option has been"
+ " obsoleted by the -z option.\n");
+ /* FALLTHROUGH */
+ case 'z':
+ /* must directly follow 'b' case for backwards compat */
+ simple_backup_suffix = xstrdup(optarg);
+ break;
+ case 'B':
+ origprae = xstrdup(optarg);
+ break;
+ case 'c':
+ diff_type = CONTEXT_DIFF;
+ break;
+ case 'C':
+ check_only = true;
+ break;
+ case 'd':
+ if (chdir(optarg) < 0)
+ pfatal("can't cd to %s", optarg);
+ break;
+ case 'D':
+ do_defines = true;
+ if (!isalpha((unsigned char)*optarg) && *optarg != '_')
+ fatal("argument to -D is not an identifier\n");
+ snprintf(if_defined, sizeof if_defined,
+ "#ifdef %s\n", optarg);
+ snprintf(not_defined, sizeof not_defined,
+ "#ifndef %s\n", optarg);
+ snprintf(end_defined, sizeof end_defined,
+ "#endif /* %s */\n", optarg);
+ break;
+ case 'e':
+ diff_type = ED_DIFF;
+ break;
+ case 'E':
+ remove_empty_files = true;
+ break;
+ case 'f':
+ force = true;
+ break;
+ case 'F':
+ maxfuzz = atoi(optarg);
+ break;
+ case 'i':
+ if (++filec == MAXFILEC)
+ fatal("too many file arguments\n");
+ filearg[filec] = xstrdup(optarg);
+ break;
+ case 'l':
+ canonicalize = true;
+ break;
+ case 'n':
+ diff_type = NORMAL_DIFF;
+ break;
+ case 'N':
+ noreverse = true;
+ break;
+ case 'o':
+ outname = xstrdup(optarg);
+ break;
+ case 'p':
+ strippath = atoi(optarg);
+ break;
+ case 'r':
+ if (strlcpy(rejname, optarg,
+ sizeof(rejname)) >= sizeof(rejname))
+ fatal("argument for -r is too long\n");
+ break;
+ case 'R':
+ reverse = true;
+ reverse_flag_specified = true;
+ break;
+ case 's':
+ verbose = false;
+ break;
+ case 't':
+ batch = true;
+ break;
+ case 'u':
+ diff_type = UNI_DIFF;
+ break;
+ case 'v':
+ version();
+ break;
+ case 'V':
+ backup_type = get_version(optarg);
+ Vflag = true;
+ break;
+#ifdef DEBUGGING
+ case 'x':
+ debug = atoi(optarg);
+ break;
+#endif
+ default:
+ if (ch != '\0')
+ usage();
+ break;
+ }
+ }
+ Argc -= optind;
+ Argv += optind;
+
+ if (Argc > 0) {
+ filearg[0] = xstrdup(*Argv++);
+ Argc--;
+ while (Argc > 0) {
+ if (++filec == MAXFILEC)
+ fatal("too many file arguments\n");
+ filearg[filec] = xstrdup(*Argv++);
+ Argc--;
+ }
+ }
+
+ if (getenv("POSIXLY_CORRECT") != NULL)
+ posix = 1;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+"usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]\n"
+" [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]\n"
+" [-r rej-name] [-V t | nil | never | none] [-x number]\n"
+" [-z backup-ext] [--posix] [origfile [patchfile]]\n"
+" patch <patchfile\n");
+ my_exit(EXIT_FAILURE);
+}
+
+/*
+ * Attempt to find the right place to apply this hunk of patch.
+ */
+static LINENUM
+locate_hunk(LINENUM fuzz)
+{
+ LINENUM first_guess = pch_first() + last_offset;
+ LINENUM offset;
+ LINENUM pat_lines = pch_ptrn_lines();
+ LINENUM max_pos_offset = input_lines - first_guess - pat_lines + 1;
+ LINENUM max_neg_offset = first_guess - last_frozen_line - 1 + pch_context();
+
+ if (pat_lines == 0) { /* null range matches always */
+ if (verbose && fuzz == 0 && (diff_type == CONTEXT_DIFF
+ || diff_type == NEW_CONTEXT_DIFF
+ || diff_type == UNI_DIFF)) {
+ say("Empty context always matches.\n");
+ }
+ return (first_guess);
+ }
+ if (max_neg_offset >= first_guess) /* do not try lines < 0 */
+ max_neg_offset = first_guess - 1;
+ if (first_guess <= input_lines && patch_match(first_guess, 0, fuzz))
+ return first_guess;
+ for (offset = 1; ; offset++) {
+ bool check_after = (offset <= max_pos_offset);
+ bool check_before = (offset <= max_neg_offset);
+
+ if (check_after && patch_match(first_guess, offset, fuzz)) {
+#ifdef DEBUGGING
+ if (debug & 1)
+ say("Offset changing from %ld to %ld\n",
+ last_offset, offset);
+#endif
+ last_offset = offset;
+ return first_guess + offset;
+ } else if (check_before && patch_match(first_guess, -offset, fuzz)) {
+#ifdef DEBUGGING
+ if (debug & 1)
+ say("Offset changing from %ld to %ld\n",
+ last_offset, -offset);
+#endif
+ last_offset = -offset;
+ return first_guess - offset;
+ } else if (!check_before && !check_after)
+ return 0;
+ }
+}
+
+/* We did not find the pattern, dump out the hunk so they can handle it. */
+
+static void
+abort_context_hunk(void)
+{
+ LINENUM i;
+ const LINENUM pat_end = pch_end();
+ /*
+ * add in last_offset to guess the same as the previous successful
+ * hunk
+ */
+ const LINENUM oldfirst = pch_first() + last_offset;
+ const LINENUM newfirst = pch_newfirst() + last_offset;
+ const LINENUM oldlast = oldfirst + pch_ptrn_lines() - 1;
+ const LINENUM newlast = newfirst + pch_repl_lines() - 1;
+ const char *stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : "");
+ const char *minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----");
+
+ fprintf(rejfp, "***************\n");
+ for (i = 0; i <= pat_end; i++) {
+ switch (pch_char(i)) {
+ case '*':
+ if (oldlast < oldfirst)
+ fprintf(rejfp, "*** 0%s\n", stars);
+ else if (oldlast == oldfirst)
+ fprintf(rejfp, "*** %ld%s\n", oldfirst, stars);
+ else
+ fprintf(rejfp, "*** %ld,%ld%s\n", oldfirst,
+ oldlast, stars);
+ break;
+ case '=':
+ if (newlast < newfirst)
+ fprintf(rejfp, "--- 0%s\n", minuses);
+ else if (newlast == newfirst)
+ fprintf(rejfp, "--- %ld%s\n", newfirst, minuses);
+ else
+ fprintf(rejfp, "--- %ld,%ld%s\n", newfirst,
+ newlast, minuses);
+ break;
+ case '\n':
+ fprintf(rejfp, "%s", pfetch(i));
+ break;
+ case ' ':
+ case '-':
+ case '+':
+ case '!':
+ fprintf(rejfp, "%c %s", pch_char(i), pfetch(i));
+ break;
+ default:
+ fatal("fatal internal error in abort_context_hunk\n");
+ }
+ }
+}
+
+static void
+rej_line(int ch, LINENUM i)
+{
+ size_t len;
+ const char *line = pfetch(i);
+
+ len = strnlen(line, USHRT_MAX);
+
+ fprintf(rejfp, "%c%s", ch, line);
+ 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
+abort_hunk(void)
+{
+ LINENUM i, j, split;
+ int ch1, ch2;
+ const LINENUM pat_end = pch_end();
+ const LINENUM oldfirst = pch_first() + last_offset;
+ const LINENUM newfirst = pch_newfirst() + last_offset;
+
+ if (diff_type != UNI_DIFF) {
+ abort_context_hunk();
+ return;
+ }
+ split = -1;
+ for (i = 0; i <= pat_end; i++) {
+ if (pch_char(i) == '=') {
+ split = i;
+ break;
+ }
+ }
+ if (split == -1) {
+ fprintf(rejfp, "malformed hunk: no split found\n");
+ return;
+ }
+ i = 0;
+ j = split + 1;
+ fprintf(rejfp, "@@ -%ld,%ld +%ld,%ld @@\n",
+ pch_ptrn_lines() ? oldfirst : 0,
+ pch_ptrn_lines(), newfirst, pch_repl_lines());
+ while (i < split || j <= pat_end) {
+ ch1 = i < split ? pch_char(i) : -1;
+ ch2 = j <= pat_end ? pch_char(j) : -1;
+ if (ch1 == '-') {
+ rej_line('-', i);
+ i++;
+ } else if (ch1 == ' ' && ch2 == ' ') {
+ rej_line(' ', i);
+ i++;
+ j++;
+ } else if (ch1 == '!' && ch2 == '!') {
+ while (i < split && ch1 == '!') {
+ rej_line('-', i);
+ i++;
+ ch1 = i < split ? pch_char(i) : -1;
+ }
+ while (j <= pat_end && ch2 == '!') {
+ rej_line('+', j);
+ j++;
+ ch2 = j <= pat_end ? pch_char(j) : -1;
+ }
+ } else if (ch1 == '*') {
+ i++;
+ } else if (ch2 == '+' || ch2 == ' ') {
+ rej_line(ch2, j);
+ j++;
+ } else {
+ fprintf(rejfp, "internal error on (%ld %ld %ld)\n",
+ i, split, j);
+ rej_line(ch1, i);
+ rej_line(ch2, j);
+ return;
+ }
+ }
+}
+
+/* We found where to apply it (we hope), so do it. */
+
+static void
+apply_hunk(LINENUM where)
+{
+ LINENUM old = 1;
+ const LINENUM lastline = pch_ptrn_lines();
+ LINENUM new = lastline + 1;
+#define OUTSIDE 0
+#define IN_IFNDEF 1
+#define IN_IFDEF 2
+#define IN_ELSE 3
+ int def_state = OUTSIDE;
+ const LINENUM pat_end = pch_end();
+
+ where--;
+ while (pch_char(new) == '=' || pch_char(new) == '\n')
+ new++;
+
+ while (old <= lastline) {
+ if (pch_char(old) == '-') {
+ copy_till(where + old - 1, false);
+ if (do_defines) {
+ if (def_state == OUTSIDE) {
+ fputs(not_defined, ofp);
+ def_state = IN_IFNDEF;
+ } else if (def_state == IN_IFDEF) {
+ fputs(else_defined, ofp);
+ def_state = IN_ELSE;
+ }
+ fputs(pfetch(old), ofp);
+ }
+ last_frozen_line++;
+ old++;
+ } else if (new > pat_end) {
+ break;
+ } else if (pch_char(new) == '+') {
+ copy_till(where + old - 1, false);
+ if (do_defines) {
+ if (def_state == IN_IFNDEF) {
+ fputs(else_defined, ofp);
+ def_state = IN_ELSE;
+ } else if (def_state == OUTSIDE) {
+ fputs(if_defined, ofp);
+ def_state = IN_IFDEF;
+ }
+ }
+ fputs(pfetch(new), ofp);
+ new++;
+ } else if (pch_char(new) != pch_char(old)) {
+ say("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n",
+ pch_hunk_beg() + old,
+ pch_hunk_beg() + new);
+#ifdef DEBUGGING
+ say("oldchar = '%c', newchar = '%c'\n",
+ pch_char(old), pch_char(new));
+#endif
+ my_exit(2);
+ } else if (pch_char(new) == '!') {
+ copy_till(where + old - 1, false);
+ if (do_defines) {
+ fputs(not_defined, ofp);
+ def_state = IN_IFNDEF;
+ }
+ while (pch_char(old) == '!') {
+ if (do_defines) {
+ fputs(pfetch(old), ofp);
+ }
+ last_frozen_line++;
+ old++;
+ }
+ if (do_defines) {
+ fputs(else_defined, ofp);
+ def_state = IN_ELSE;
+ }
+ while (pch_char(new) == '!') {
+ fputs(pfetch(new), ofp);
+ new++;
+ }
+ } else {
+ if (pch_char(new) != ' ')
+ fatal("Internal error: expected ' '\n");
+ old++;
+ new++;
+ if (do_defines && def_state != OUTSIDE) {
+ fputs(end_defined, ofp);
+ def_state = OUTSIDE;
+ }
+ }
+ }
+ if (new <= pat_end && pch_char(new) == '+') {
+ copy_till(where + old - 1, false);
+ if (do_defines) {
+ if (def_state == OUTSIDE) {
+ fputs(if_defined, ofp);
+ def_state = IN_IFDEF;
+ } else if (def_state == IN_IFNDEF) {
+ fputs(else_defined, ofp);
+ def_state = IN_ELSE;
+ }
+ }
+ while (new <= pat_end && pch_char(new) == '+') {
+ fputs(pfetch(new), ofp);
+ new++;
+ }
+ }
+ if (do_defines && def_state != OUTSIDE) {
+ fputs(end_defined, ofp);
+ }
+}
+
+/*
+ * Open the new file.
+ */
+static void
+init_output(const char *name)
+{
+ ofp = fopen(name, "w");
+ if (ofp == NULL)
+ pfatal("can't create %s", name);
+}
+
+/*
+ * Open a file to put hunks we can't locate.
+ */
+static void
+init_reject(const char *name)
+{
+ rejfp = fopen(name, "w");
+ if (rejfp == NULL)
+ pfatal("can't create %s", name);
+}
+
+/*
+ * Copy input file to output, up to wherever hunk is to be applied.
+ * If endoffile is true, treat the last line specially since it may
+ * lack a newline.
+ */
+static void
+copy_till(LINENUM lastline, bool endoffile)
+{
+ if (last_frozen_line > lastline)
+ fatal("misordered hunks! output would be garbled\n");
+ while (last_frozen_line < lastline) {
+ if (++last_frozen_line == lastline && endoffile)
+ dump_line(last_frozen_line, !last_line_missing_eol);
+ else
+ dump_line(last_frozen_line, true);
+ }
+}
+
+/*
+ * Finish copying the input file to the output file.
+ */
+static bool
+spew_output(void)
+{
+ int rv;
+
+#ifdef DEBUGGING
+ if (debug & 256)
+ say("il=%ld lfl=%ld\n", input_lines, last_frozen_line);
+#endif
+ if (input_lines)
+ copy_till(input_lines, true); /* dump remainder of file */
+ rv = ferror(ofp) == 0 && fclose(ofp) == 0;
+ ofp = NULL;
+ return rv;
+}
+
+/*
+ * Copy one line from input to output.
+ */
+static void
+dump_line(LINENUM line, bool write_newline)
+{
+ char *s;
+
+ s = ifetch(line, 0);
+ if (s == NULL)
+ return;
+ /* Note: string is not NUL terminated. */
+ for (; *s != '\n'; s++)
+ putc(*s, ofp);
+ if (write_newline)
+ putc('\n', ofp);
+}
+
+/*
+ * Does the patch pattern match at line base+offset?
+ */
+static bool
+patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
+{
+ LINENUM pline = 1 + fuzz;
+ LINENUM iline;
+ LINENUM pat_lines = pch_ptrn_lines() - fuzz;
+ const char *ilineptr;
+ const char *plineptr;
+ unsigned short plinelen;
+
+ for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
+ ilineptr = ifetch(iline, offset >= 0);
+ if (ilineptr == NULL)
+ return false;
+ plineptr = pfetch(pline);
+ plinelen = pch_line_len(pline);
+ if (canonicalize) {
+ if (!similar(ilineptr, plineptr, plinelen))
+ return false;
+ } else if (strnNE(ilineptr, plineptr, plinelen))
+ return false;
+ if (iline == input_lines) {
+ /*
+ * We are looking at the last line of the file.
+ * If the file has no eol, the patch line should
+ * not have one either and vice-versa. Note that
+ * plinelen > 0.
+ */
+ if (last_line_missing_eol) {
+ if (plineptr[plinelen - 1] == '\n')
+ return false;
+ } else {
+ if (plineptr[plinelen - 1] != '\n')
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+/*
+ * Do two lines match with canonicalized white space?
+ */
+static bool
+similar(const char *a, const char *b, int len)
+{
+ while (len) {
+ if (isspace((unsigned char)*b)) { /* whitespace (or \n) to match? */
+ if (!isspace((unsigned char)*a)) /* no corresponding whitespace? */
+ return false;
+ while (len && isspace((unsigned char)*b) && *b != '\n')
+ b++, len--; /* skip pattern whitespace */
+ while (isspace((unsigned char)*a) && *a != '\n')
+ a++; /* skip target whitespace */
+ if (*a == '\n' || *b == '\n')
+ return (*a == *b); /* should end in sync */
+ } else if (*a++ != *b++) /* match non-whitespace chars */
+ return false;
+ else
+ len--; /* probably not necessary */
+ }
+ return true; /* actually, this is not reached */
+ /* since there is always a \n */
+}
diff --git a/usr.bin/patch/pathnames.h b/usr.bin/patch/pathnames.h
new file mode 100644
index 0000000..79d8fae
--- /dev/null
+++ b/usr.bin/patch/pathnames.h
@@ -0,0 +1,12 @@
+/*-
+ * Placed in the public domain by Todd C. Miller <Todd.Miller@courtesan.com>
+ * on July 29, 2003.
+ *
+ * $OpenBSD: pathnames.h,v 1.1 2003/07/29 20:10:17 millert Exp $
+ * $FreeBSD$
+ */
+
+
+#include <paths.h>
+
+#define _PATH_RED "/bin/red"
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
new file mode 100644
index 0000000..e12e833
--- /dev/null
+++ b/usr.bin/patch/pch.c
@@ -0,0 +1,1617 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: pch.c,v 1.43 2014/11/18 17:03:35 tobias Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "util.h"
+#include "pch.h"
+#include "pathnames.h"
+
+/* Patch (diff listing) abstract type. */
+
+static off_t p_filesize; /* size of the patch file */
+static LINENUM p_first; /* 1st line number */
+static LINENUM p_newfirst; /* 1st line number of replacement */
+static LINENUM p_ptrn_lines; /* # lines in pattern */
+static LINENUM p_repl_lines; /* # lines in replacement text */
+static LINENUM p_end = -1; /* last line in hunk */
+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 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 */
+static off_t p_base; /* where to intuit this time */
+static LINENUM p_bline; /* line # of p_base */
+static off_t p_start; /* where intuit found a patch */
+static LINENUM p_sline; /* and the line number for it */
+static LINENUM p_hunk_beg; /* line number of current hunk */
+static LINENUM p_efake = -1; /* end of faked up lines--don't free */
+static LINENUM p_bfake = -1; /* beg of faked up lines */
+static FILE *pfp = NULL; /* patch file pointer */
+static char *bestguess = NULL; /* guess at correct filename */
+
+static void grow_hunkmax(void);
+static int intuit_diff_type(void);
+static void next_intuit_at(off_t, LINENUM);
+static void skip_to(off_t, LINENUM);
+static size_t pgets(bool _do_indent);
+static char *best_name(const struct file_name *, bool);
+static char *posix_name(const struct file_name *, bool);
+static size_t num_components(const char *);
+static LINENUM strtolinenum(char *, char **);
+
+/*
+ * Prepare to look for the next patch in the patch file.
+ */
+void
+re_patch(void)
+{
+ p_first = 0;
+ p_newfirst = 0;
+ p_ptrn_lines = 0;
+ p_repl_lines = 0;
+ p_end = (LINENUM) - 1;
+ p_max = 0;
+ p_indent = 0;
+}
+
+/*
+ * Open the patch file at the beginning of time.
+ */
+void
+open_patch_file(const char *filename)
+{
+ struct stat filestat;
+ int nr, nw;
+
+ if (filename == NULL || *filename == '\0' || strEQ(filename, "-")) {
+ pfp = fopen(TMPPATNAME, "w");
+ if (pfp == NULL)
+ pfatal("can't create %s", TMPPATNAME);
+ while ((nr = fread(buf, 1, buf_size, stdin)) > 0) {
+ nw = fwrite(buf, 1, nr, pfp);
+ if (nr != nw)
+ pfatal("write error to %s", TMPPATNAME);
+ }
+ if (ferror(pfp) || fclose(pfp))
+ pfatal("can't write %s", TMPPATNAME);
+ filename = TMPPATNAME;
+ }
+ pfp = fopen(filename, "r");
+ if (pfp == NULL)
+ pfatal("patch file %s not found", filename);
+ if (fstat(fileno(pfp), &filestat))
+ pfatal("can't stat %s", filename);
+ p_filesize = filestat.st_size;
+ next_intuit_at(0, 1L); /* start at the beginning */
+ set_hunkmax();
+}
+
+/*
+ * Make sure our dynamically realloced tables are malloced to begin with.
+ */
+void
+set_hunkmax(void)
+{
+ if (p_line == NULL)
+ p_line = malloc(hunkmax * sizeof(char *));
+ if (p_len == NULL)
+ p_len = malloc(hunkmax * sizeof(unsigned short));
+ if (p_char == NULL)
+ p_char = malloc(hunkmax * sizeof(char));
+}
+
+/*
+ * Enlarge the arrays containing the current hunk of patch.
+ */
+static void
+grow_hunkmax(void)
+{
+ int new_hunkmax = hunkmax * 2;
+
+ if (p_line == NULL || p_len == NULL || p_char == NULL)
+ fatal("Internal memory allocation error\n");
+
+ 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;
+ return;
+ }
+
+ if (!using_plan_a)
+ fatal("out of memory\n");
+ out_of_mem = true; /* whatever is null will be allocated again */
+ /* from within plan_a(), of all places */
+}
+
+/* True if the remainder of the patch file contains a diff of some sort. */
+
+bool
+there_is_another_patch(void)
+{
+ bool exists = false;
+
+ if (p_base != 0 && p_base >= p_filesize) {
+ if (verbose)
+ say("done\n");
+ return false;
+ }
+ if (verbose)
+ say("Hmm...");
+ diff_type = intuit_diff_type();
+ if (!diff_type) {
+ if (p_base != 0) {
+ if (verbose)
+ say(" Ignoring the trailing garbage.\ndone\n");
+ } else
+ say(" I can't seem to find a patch in there anywhere.\n");
+ return false;
+ }
+ if (verbose)
+ say(" %sooks like %s to me...\n",
+ (p_base == 0 ? "L" : "The next patch l"),
+ diff_type == UNI_DIFF ? "a unified diff" :
+ diff_type == CONTEXT_DIFF ? "a context diff" :
+ diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" :
+ diff_type == NORMAL_DIFF ? "a normal diff" :
+ "an ed script");
+ if (p_indent && verbose)
+ say("(Patch is indented %d space%s.)\n", p_indent,
+ p_indent == 1 ? "" : "s");
+ skip_to(p_start, p_sline);
+ while (filearg[0] == NULL) {
+ if (force || batch) {
+ say("No file to patch. Skipping...\n");
+ filearg[0] = xstrdup(bestguess);
+ skip_rest_of_patch = true;
+ return true;
+ }
+ ask("File to patch: ");
+ if (*buf != '\n') {
+ free(bestguess);
+ bestguess = xstrdup(buf);
+ filearg[0] = fetchname(buf, &exists, 0);
+ }
+ if (!exists) {
+ ask("No file found--skip this patch? [n] ");
+ if (*buf != 'y')
+ continue;
+ if (verbose)
+ say("Skipping patch...\n");
+ free(filearg[0]);
+ filearg[0] = fetchname(bestguess, &exists, 0);
+ skip_rest_of_patch = true;
+ return true;
+ }
+ }
+ return true;
+}
+
+static void
+p4_fetchname(struct file_name *name, char *str)
+{
+ char *t, *h;
+
+ /* Skip leading whitespace. */
+ while (isspace((unsigned char)*str))
+ str++;
+
+ /* Remove the file revision number. */
+ for (t = str, h = NULL; *t != '\0' && !isspace((unsigned char)*t); t++)
+ if (*t == '#')
+ h = t;
+ if (h != NULL)
+ *h = '\0';
+
+ name->path = fetchname(str, &name->exists, strippath);
+}
+
+/* Determine what kind of diff is in the remaining part of the patch file. */
+
+static int
+intuit_diff_type(void)
+{
+ off_t this_line = 0, previous_line;
+ off_t first_command_line = -1;
+ LINENUM fcl_line = -1;
+ bool last_line_was_command = false, this_is_a_command = false;
+ bool stars_last_line = false, stars_this_line = false;
+ char *s, *t;
+ int indent, retval;
+ struct file_name names[MAX_FILE];
+
+ memset(names, 0, sizeof(names));
+ ok_to_create_file = false;
+ fseeko(pfp, p_base, SEEK_SET);
+ p_input_line = p_bline - 1;
+ for (;;) {
+ previous_line = this_line;
+ last_line_was_command = this_is_a_command;
+ stars_last_line = stars_this_line;
+ this_line = ftello(pfp);
+ indent = 0;
+ p_input_line++;
+ if (pgets(false) == 0) {
+ if (first_command_line >= 0) {
+ /* nothing but deletes!? */
+ p_start = first_command_line;
+ p_sline = fcl_line;
+ retval = ED_DIFF;
+ goto scan_exit;
+ } else {
+ p_start = this_line;
+ p_sline = p_input_line;
+ retval = 0;
+ goto scan_exit;
+ }
+ }
+ for (s = buf; *s == ' ' || *s == '\t' || *s == 'X'; s++) {
+ if (*s == '\t')
+ indent += 8 - (indent % 8);
+ else
+ indent++;
+ }
+ for (t = s; isdigit((unsigned char)*t) || *t == ','; t++)
+ ;
+ this_is_a_command = (isdigit((unsigned char)*s) &&
+ (*t == 'd' || *t == 'c' || *t == 'a'));
+ if (first_command_line < 0 && this_is_a_command) {
+ first_command_line = this_line;
+ fcl_line = p_input_line;
+ p_indent = indent; /* assume this for now */
+ }
+ if (!stars_last_line && strnEQ(s, "*** ", 4))
+ names[OLD_FILE].path = fetchname(s + 4,
+ &names[OLD_FILE].exists, strippath);
+ else if (strnEQ(s, "--- ", 4))
+ names[NEW_FILE].path = fetchname(s + 4,
+ &names[NEW_FILE].exists, strippath);
+ else if (strnEQ(s, "+++ ", 4))
+ /* pretend it is the old name */
+ names[OLD_FILE].path = fetchname(s + 4,
+ &names[OLD_FILE].exists, strippath);
+ else if (strnEQ(s, "Index:", 6))
+ names[INDEX_FILE].path = fetchname(s + 6,
+ &names[INDEX_FILE].exists, strippath);
+ else if (strnEQ(s, "Prereq:", 7)) {
+ for (t = s + 7; isspace((unsigned char)*t); t++)
+ ;
+ revision = xstrdup(t);
+ for (t = revision;
+ *t && !isspace((unsigned char)*t); t++)
+ ;
+ *t = '\0';
+ if (*revision == '\0') {
+ free(revision);
+ revision = NULL;
+ }
+ } else if (strnEQ(s, "==== ", 5)) {
+ /* Perforce-style diffs. */
+ if ((t = strstr(s + 5, " - ")) != NULL)
+ p4_fetchname(&names[NEW_FILE], t + 3);
+ p4_fetchname(&names[OLD_FILE], s + 5);
+ }
+ if ((!diff_type || diff_type == ED_DIFF) &&
+ first_command_line >= 0 &&
+ strEQ(s, ".\n")) {
+ p_indent = indent;
+ p_start = first_command_line;
+ p_sline = fcl_line;
+ retval = ED_DIFF;
+ goto scan_exit;
+ }
+ if ((!diff_type || diff_type == UNI_DIFF) && strnEQ(s, "@@ -", 4)) {
+ if (strnEQ(s + 4, "0,0", 3))
+ ok_to_create_file = true;
+ p_indent = indent;
+ p_start = this_line;
+ p_sline = p_input_line;
+ retval = UNI_DIFF;
+ goto scan_exit;
+ }
+ stars_this_line = strnEQ(s, "********", 8);
+ if ((!diff_type || diff_type == CONTEXT_DIFF) && stars_last_line &&
+ strnEQ(s, "*** ", 4)) {
+ if (strtolinenum(s + 4, &s) == 0)
+ ok_to_create_file = true;
+ /*
+ * If this is a new context diff the character just
+ * at the end of the line is a '*'.
+ */
+ while (*s && *s != '\n')
+ s++;
+ p_indent = indent;
+ p_start = previous_line;
+ p_sline = p_input_line - 1;
+ retval = (*(s - 1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF);
+ goto scan_exit;
+ }
+ if ((!diff_type || diff_type == NORMAL_DIFF) &&
+ last_line_was_command &&
+ (strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2))) {
+ p_start = previous_line;
+ p_sline = p_input_line - 1;
+ p_indent = indent;
+ retval = NORMAL_DIFF;
+ goto scan_exit;
+ }
+ }
+scan_exit:
+ if (retval == UNI_DIFF) {
+ /* unswap old and new */
+ struct file_name tmp = names[OLD_FILE];
+ names[OLD_FILE] = names[NEW_FILE];
+ names[NEW_FILE] = tmp;
+ }
+ if (filearg[0] == NULL) {
+ if (posix)
+ filearg[0] = posix_name(names, ok_to_create_file);
+ else {
+ /* Ignore the Index: name for context diffs, like GNU */
+ if (names[OLD_FILE].path != NULL ||
+ names[NEW_FILE].path != NULL) {
+ free(names[INDEX_FILE].path);
+ names[INDEX_FILE].path = NULL;
+ }
+ filearg[0] = best_name(names, ok_to_create_file);
+ }
+ }
+
+ free(bestguess);
+ bestguess = NULL;
+ if (filearg[0] != NULL)
+ bestguess = xstrdup(filearg[0]);
+ else if (!ok_to_create_file) {
+ /*
+ * We don't want to create a new file but we need a
+ * filename to set bestguess. Avoid setting filearg[0]
+ * so the file is not created automatically.
+ */
+ if (posix)
+ bestguess = posix_name(names, true);
+ else
+ bestguess = best_name(names, true);
+ }
+ free(names[OLD_FILE].path);
+ free(names[NEW_FILE].path);
+ free(names[INDEX_FILE].path);
+ return retval;
+}
+
+/*
+ * Remember where this patch ends so we know where to start up again.
+ */
+static void
+next_intuit_at(off_t file_pos, LINENUM file_line)
+{
+ p_base = file_pos;
+ p_bline = file_line;
+}
+
+/*
+ * Basically a verbose fseeko() to the actual diff listing.
+ */
+static void
+skip_to(off_t file_pos, LINENUM file_line)
+{
+ size_t len;
+
+ if (p_base > file_pos)
+ fatal("Internal error: seek %lld>%lld\n",
+ (long long)p_base, (long long)file_pos);
+ if (verbose && p_base < file_pos) {
+ fseeko(pfp, p_base, SEEK_SET);
+ say("The text leading up to this was:\n--------------------------\n");
+ while (ftello(pfp) < file_pos) {
+ len = pgets(false);
+ if (len == 0)
+ fatal("Unexpected end of file\n");
+ say("|%s", buf);
+ }
+ say("--------------------------\n");
+ } else
+ fseeko(pfp, file_pos, SEEK_SET);
+ p_input_line = file_line - 1;
+}
+
+/* Make this a function for better debugging. */
+static void
+malformed(void)
+{
+ fatal("malformed patch at line %ld: %s", p_input_line, buf);
+ /* about as informative as "Syntax error" in C */
+}
+
+/*
+ * True if the line has been discarded (i.e. it is a line saying
+ * "\ No newline at end of file".)
+ */
+static bool
+remove_special_line(void)
+{
+ int c;
+
+ c = fgetc(pfp);
+ if (c == '\\') {
+ do {
+ c = fgetc(pfp);
+ } while (c != EOF && c != '\n');
+
+ return true;
+ }
+ if (c != EOF)
+ fseeko(pfp, -1, SEEK_CUR);
+
+ return false;
+}
+
+/*
+ * True if there is more of the current diff listing to process.
+ */
+bool
+another_hunk(void)
+{
+ off_t line_beginning; /* file pos of the current line */
+ LINENUM repl_beginning; /* index of --- line */
+ LINENUM fillcnt; /* #lines of missing ptrn or repl */
+ LINENUM fillsrc; /* index of first line to copy */
+ LINENUM filldst; /* index of first missing line */
+ bool ptrn_spaces_eaten; /* ptrn was slightly malformed */
+ bool repl_could_be_missing; /* no + or ! lines in this hunk */
+ bool repl_missing; /* we are now backtracking */
+ off_t repl_backtrack_position; /* file pos of first repl line */
+ LINENUM repl_patch_line; /* input line number for same */
+ LINENUM ptrn_copiable; /* # of copiable lines in ptrn */
+ char *s;
+ size_t len;
+ int context = 0;
+
+ while (p_end >= 0) {
+ if (p_end == p_efake)
+ p_end = p_bfake; /* don't free twice */
+ else
+ free(p_line[p_end]);
+ p_end--;
+ }
+ p_efake = -1;
+
+ p_max = hunkmax; /* gets reduced when --- found */
+ if (diff_type == CONTEXT_DIFF || diff_type == NEW_CONTEXT_DIFF) {
+ line_beginning = ftello(pfp);
+ repl_beginning = 0;
+ fillcnt = 0;
+ fillsrc = 0;
+ filldst = 0;
+ ptrn_spaces_eaten = false;
+ repl_could_be_missing = true;
+ repl_missing = false;
+ repl_backtrack_position = 0;
+ repl_patch_line = 0;
+ ptrn_copiable = 0;
+
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0 || strnNE(buf, "********", 8)) {
+ next_intuit_at(line_beginning, p_input_line);
+ return false;
+ }
+ p_context = 100;
+ p_hunk_beg = p_input_line + 1;
+ while (p_end < p_max) {
+ line_beginning = ftello(pfp);
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0) {
+ if (p_max - p_end < 4) {
+ /* assume blank lines got chopped */
+ strlcpy(buf, " \n", buf_size);
+ } else {
+ if (repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ fatal("unexpected end of file in patch\n");
+ }
+ }
+ p_end++;
+ if (p_end >= hunkmax)
+ fatal("Internal error: hunk larger than hunk "
+ "buffer size");
+ p_char[p_end] = *buf;
+ p_line[p_end] = NULL;
+ switch (*buf) {
+ case '*':
+ if (strnEQ(buf, "********", 8)) {
+ if (repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ } else
+ fatal("unexpected end of hunk "
+ "at line %ld\n",
+ p_input_line);
+ }
+ if (p_end != 0) {
+ if (repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ fatal("unexpected *** at line %ld: %s",
+ p_input_line, buf);
+ }
+ context = 0;
+ p_line[p_end] = savestr(buf);
+ if (out_of_mem) {
+ p_end--;
+ return false;
+ }
+ for (s = buf;
+ *s && !isdigit((unsigned char)*s); s++)
+ ;
+ if (!*s)
+ malformed();
+ if (strnEQ(s, "0,0", 3))
+ memmove(s, s + 2, strlen(s + 2) + 1);
+ p_first = strtolinenum(s, &s);
+ if (*s == ',') {
+ for (;
+ *s && !isdigit((unsigned char)*s); s++)
+ ;
+ if (!*s)
+ malformed();
+ p_ptrn_lines = strtolinenum(s, &s) - p_first + 1;
+ if (p_ptrn_lines < 0)
+ malformed();
+ } else if (p_first)
+ p_ptrn_lines = 1;
+ else {
+ p_ptrn_lines = 0;
+ p_first = 1;
+ }
+ if (p_first >= LINENUM_MAX - p_ptrn_lines ||
+ p_ptrn_lines >= LINENUM_MAX - 6)
+ malformed();
+
+ /* we need this much at least */
+ p_max = p_ptrn_lines + 6;
+ while (p_max >= hunkmax)
+ grow_hunkmax();
+ p_max = hunkmax;
+ break;
+ case '-':
+ if (buf[1] == '-') {
+ if (repl_beginning ||
+ (p_end != p_ptrn_lines + 1 +
+ (p_char[p_end - 1] == '\n'))) {
+ if (p_end == 1) {
+ /*
+ * `old' lines were omitted;
+ * set up to fill them in
+ * from 'new' context lines.
+ */
+ p_end = p_ptrn_lines + 1;
+ fillsrc = p_end + 1;
+ filldst = 1;
+ fillcnt = p_ptrn_lines;
+ } else {
+ if (repl_beginning) {
+ if (repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ fatal("duplicate \"---\" at line %ld--check line numbers at line %ld\n",
+ p_input_line, p_hunk_beg + repl_beginning);
+ } else {
+ fatal("%s \"---\" at line %ld--check line numbers at line %ld\n",
+ (p_end <= p_ptrn_lines
+ ? "Premature"
+ : "Overdue"),
+ p_input_line, p_hunk_beg);
+ }
+ }
+ }
+ repl_beginning = p_end;
+ repl_backtrack_position = ftello(pfp);
+ repl_patch_line = p_input_line;
+ p_line[p_end] = savestr(buf);
+ if (out_of_mem) {
+ p_end--;
+ return false;
+ }
+ p_char[p_end] = '=';
+ for (s = buf; *s && !isdigit((unsigned char)*s); s++)
+ ;
+ if (!*s)
+ malformed();
+ p_newfirst = strtolinenum(s, &s);
+ if (*s == ',') {
+ for (; *s && !isdigit((unsigned char)*s); s++)
+ ;
+ if (!*s)
+ malformed();
+ p_repl_lines = strtolinenum(s, &s) -
+ p_newfirst + 1;
+ if (p_repl_lines < 0)
+ malformed();
+ } else if (p_newfirst)
+ p_repl_lines = 1;
+ else {
+ p_repl_lines = 0;
+ p_newfirst = 1;
+ }
+ if (p_newfirst >= LINENUM_MAX - p_repl_lines ||
+ p_repl_lines >= LINENUM_MAX - p_end)
+ malformed();
+ p_max = p_repl_lines + p_end;
+ if (p_max > MAXHUNKSIZE)
+ fatal("hunk too large (%ld lines) at line %ld: %s",
+ p_max, p_input_line, buf);
+ while (p_max >= hunkmax)
+ grow_hunkmax();
+ if (p_repl_lines != ptrn_copiable &&
+ (p_context != 0 || p_repl_lines != 1))
+ repl_could_be_missing = false;
+ break;
+ }
+ goto change_line;
+ case '+':
+ case '!':
+ repl_could_be_missing = false;
+ change_line:
+ if (buf[1] == '\n' && canonicalize)
+ strlcpy(buf + 1, " \n", buf_size - 1);
+ if (!isspace((unsigned char)buf[1]) &&
+ buf[1] != '>' && buf[1] != '<' &&
+ repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ if (context >= 0) {
+ if (context < p_context)
+ p_context = context;
+ context = -1000;
+ }
+ p_line[p_end] = savestr(buf + 2);
+ if (out_of_mem) {
+ p_end--;
+ return false;
+ }
+ if (p_end == p_ptrn_lines) {
+ if (remove_special_line()) {
+ int l;
+
+ l = strlen(p_line[p_end]) - 1;
+ (p_line[p_end])[l] = 0;
+ }
+ }
+ break;
+ case '\t':
+ case '\n': /* assume the 2 spaces got eaten */
+ if (repl_beginning && repl_could_be_missing &&
+ (!ptrn_spaces_eaten ||
+ diff_type == NEW_CONTEXT_DIFF)) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ p_line[p_end] = savestr(buf);
+ if (out_of_mem) {
+ p_end--;
+ return false;
+ }
+ if (p_end != p_ptrn_lines + 1) {
+ ptrn_spaces_eaten |= (repl_beginning != 0);
+ context++;
+ if (!repl_beginning)
+ ptrn_copiable++;
+ p_char[p_end] = ' ';
+ }
+ break;
+ case ' ':
+ if (!isspace((unsigned char)buf[1]) &&
+ repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ context++;
+ if (!repl_beginning)
+ ptrn_copiable++;
+ p_line[p_end] = savestr(buf + 2);
+ if (out_of_mem) {
+ p_end--;
+ return false;
+ }
+ break;
+ default:
+ if (repl_beginning && repl_could_be_missing) {
+ repl_missing = true;
+ goto hunk_done;
+ }
+ malformed();
+ }
+ /* set up p_len for strncmp() so we don't have to */
+ /* assume null termination */
+ if (p_line[p_end])
+ p_len[p_end] = strlen(p_line[p_end]);
+ else
+ p_len[p_end] = 0;
+ }
+
+hunk_done:
+ if (p_end >= 0 && !repl_beginning)
+ fatal("no --- found in patch at line %ld\n", pch_hunk_beg());
+
+ if (repl_missing) {
+
+ /* reset state back to just after --- */
+ p_input_line = repl_patch_line;
+ for (p_end--; p_end > repl_beginning; p_end--)
+ free(p_line[p_end]);
+ fseeko(pfp, repl_backtrack_position, SEEK_SET);
+
+ /* redundant 'new' context lines were omitted - set */
+ /* up to fill them in from the old file context */
+ if (!p_context && p_repl_lines == 1) {
+ p_repl_lines = 0;
+ p_max--;
+ }
+ fillsrc = 1;
+ filldst = repl_beginning + 1;
+ fillcnt = p_repl_lines;
+ p_end = p_max;
+ } else if (!p_context && fillcnt == 1) {
+ /* the first hunk was a null hunk with no context */
+ /* and we were expecting one line -- fix it up. */
+ while (filldst < p_end) {
+ p_line[filldst] = p_line[filldst + 1];
+ p_char[filldst] = p_char[filldst + 1];
+ p_len[filldst] = p_len[filldst + 1];
+ filldst++;
+ }
+#if 0
+ repl_beginning--; /* this doesn't need to be fixed */
+#endif
+ p_end--;
+ p_first++; /* do append rather than insert */
+ fillcnt = 0;
+ p_ptrn_lines = 0;
+ }
+ if (diff_type == CONTEXT_DIFF &&
+ (fillcnt || (p_first > 1 && ptrn_copiable > 2 * p_context))) {
+ if (verbose)
+ say("%s\n%s\n%s\n",
+ "(Fascinating--this is really a new-style context diff but without",
+ "the telltale extra asterisks on the *** line that usually indicate",
+ "the new style...)");
+ diff_type = NEW_CONTEXT_DIFF;
+ }
+ /* if there were omitted context lines, fill them in now */
+ if (fillcnt) {
+ p_bfake = filldst; /* remember where not to free() */
+ p_efake = filldst + fillcnt - 1;
+ while (fillcnt-- > 0) {
+ while (fillsrc <= p_end && p_char[fillsrc] != ' ')
+ fillsrc++;
+ if (fillsrc > p_end)
+ fatal("replacement text or line numbers mangled in hunk at line %ld\n",
+ p_hunk_beg);
+ p_line[filldst] = p_line[fillsrc];
+ p_char[filldst] = p_char[fillsrc];
+ p_len[filldst] = p_len[fillsrc];
+ fillsrc++;
+ filldst++;
+ }
+ while (fillsrc <= p_end && fillsrc != repl_beginning &&
+ p_char[fillsrc] != ' ')
+ fillsrc++;
+#ifdef DEBUGGING
+ if (debug & 64)
+ printf("fillsrc %ld, filldst %ld, rb %ld, e+1 %ld\n",
+ fillsrc, filldst, repl_beginning, p_end + 1);
+#endif
+ if (fillsrc != p_end + 1 && fillsrc != repl_beginning)
+ malformed();
+ if (filldst != p_end + 1 && filldst != repl_beginning)
+ malformed();
+ }
+ if (p_line[p_end] != NULL) {
+ if (remove_special_line()) {
+ p_len[p_end] -= 1;
+ (p_line[p_end])[p_len[p_end]] = 0;
+ }
+ }
+ } else if (diff_type == UNI_DIFF) {
+ LINENUM fillold; /* index of old lines */
+ LINENUM fillnew; /* index of new lines */
+ char ch;
+
+ line_beginning = ftello(pfp); /* file pos of the current line */
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0 || strnNE(buf, "@@ -", 4)) {
+ next_intuit_at(line_beginning, p_input_line);
+ return false;
+ }
+ s = buf + 4;
+ if (!*s)
+ malformed();
+ p_first = strtolinenum(s, &s);
+ if (*s == ',') {
+ p_ptrn_lines = strtolinenum(s + 1, &s);
+ } else
+ p_ptrn_lines = 1;
+ if (*s == ' ')
+ s++;
+ if (*s != '+' || !*++s)
+ malformed();
+ p_newfirst = strtolinenum(s, &s);
+ if (*s == ',') {
+ p_repl_lines = strtolinenum(s + 1, &s);
+ } else
+ p_repl_lines = 1;
+ if (*s == ' ')
+ s++;
+ if (*s != '@')
+ malformed();
+ if (p_first >= LINENUM_MAX - p_ptrn_lines ||
+ p_newfirst > LINENUM_MAX - p_repl_lines ||
+ p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
+ malformed();
+ if (!p_ptrn_lines)
+ p_first++; /* do append rather than insert */
+ p_max = p_ptrn_lines + p_repl_lines + 1;
+ while (p_max >= hunkmax)
+ grow_hunkmax();
+ fillold = 1;
+ fillnew = fillold + p_ptrn_lines;
+ p_end = fillnew + p_repl_lines;
+ snprintf(buf, buf_size, "*** %ld,%ld ****\n", p_first,
+ p_first + p_ptrn_lines - 1);
+ p_line[0] = savestr(buf);
+ if (out_of_mem) {
+ p_end = -1;
+ return false;
+ }
+ p_char[0] = '*';
+ snprintf(buf, buf_size, "--- %ld,%ld ----\n", p_newfirst,
+ p_newfirst + p_repl_lines - 1);
+ p_line[fillnew] = savestr(buf);
+ if (out_of_mem) {
+ p_end = 0;
+ return false;
+ }
+ p_char[fillnew++] = '=';
+ p_context = 100;
+ context = 0;
+ p_hunk_beg = p_input_line + 1;
+ while (fillold <= p_ptrn_lines || fillnew <= p_end) {
+ line_beginning = ftello(pfp);
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0) {
+ if (p_max - fillnew < 3) {
+ /* assume blank lines got chopped */
+ strlcpy(buf, " \n", buf_size);
+ } else {
+ fatal("unexpected end of file in patch\n");
+ }
+ }
+ if (*buf == '\t' || *buf == '\n') {
+ ch = ' '; /* assume the space got eaten */
+ s = savestr(buf);
+ } else {
+ ch = *buf;
+ s = savestr(buf + 1);
+ }
+ if (out_of_mem) {
+ while (--fillnew > p_ptrn_lines)
+ free(p_line[fillnew]);
+ p_end = fillold - 1;
+ return false;
+ }
+ switch (ch) {
+ case '-':
+ if (fillold > p_ptrn_lines) {
+ free(s);
+ p_end = fillnew - 1;
+ malformed();
+ }
+ p_char[fillold] = ch;
+ p_line[fillold] = s;
+ p_len[fillold++] = strlen(s);
+ if (fillold > p_ptrn_lines) {
+ if (remove_special_line()) {
+ p_len[fillold - 1] -= 1;
+ s[p_len[fillold - 1]] = 0;
+ }
+ }
+ break;
+ case '=':
+ ch = ' ';
+ /* FALL THROUGH */
+ case ' ':
+ if (fillold > p_ptrn_lines) {
+ free(s);
+ while (--fillnew > p_ptrn_lines)
+ free(p_line[fillnew]);
+ p_end = fillold - 1;
+ malformed();
+ }
+ context++;
+ p_char[fillold] = ch;
+ p_line[fillold] = s;
+ p_len[fillold++] = strlen(s);
+ s = savestr(s);
+ if (out_of_mem) {
+ while (--fillnew > p_ptrn_lines)
+ free(p_line[fillnew]);
+ p_end = fillold - 1;
+ return false;
+ }
+ if (fillold > p_ptrn_lines) {
+ if (remove_special_line()) {
+ p_len[fillold - 1] -= 1;
+ s[p_len[fillold - 1]] = 0;
+ }
+ }
+ /* FALL THROUGH */
+ case '+':
+ if (fillnew > p_end) {
+ free(s);
+ while (--fillnew > p_ptrn_lines)
+ free(p_line[fillnew]);
+ p_end = fillold - 1;
+ malformed();
+ }
+ p_char[fillnew] = ch;
+ p_line[fillnew] = s;
+ p_len[fillnew++] = strlen(s);
+ if (fillold > p_ptrn_lines) {
+ if (remove_special_line()) {
+ p_len[fillnew - 1] -= 1;
+ s[p_len[fillnew - 1]] = 0;
+ }
+ }
+ break;
+ default:
+ p_end = fillnew;
+ malformed();
+ }
+ if (ch != ' ' && context > 0) {
+ if (context < p_context)
+ p_context = context;
+ context = -1000;
+ }
+ } /* while */
+ } else { /* normal diff--fake it up */
+ char hunk_type;
+ int i;
+ LINENUM min, max;
+
+ line_beginning = ftello(pfp);
+ p_context = 0;
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0 || !isdigit((unsigned char)*buf)) {
+ next_intuit_at(line_beginning, p_input_line);
+ return false;
+ }
+ p_first = strtolinenum(buf, &s);
+ if (*s == ',') {
+ p_ptrn_lines = strtolinenum(s + 1, &s) - p_first + 1;
+ if (p_ptrn_lines < 0)
+ malformed();
+ } else
+ p_ptrn_lines = (*s != 'a');
+ hunk_type = *s;
+ if (hunk_type == 'a')
+ p_first++; /* do append rather than insert */
+ min = strtolinenum(s + 1, &s);
+ if (*s == ',')
+ max = strtolinenum(s + 1, &s);
+ else
+ max = min;
+ if (min < 0 || min > max || max - min == LINENUM_MAX)
+ malformed();
+ if (hunk_type == 'd')
+ min++;
+ p_newfirst = min;
+ p_repl_lines = max - min + 1;
+ if (p_newfirst > LINENUM_MAX - p_repl_lines ||
+ p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
+ malformed();
+ p_end = p_ptrn_lines + p_repl_lines + 1;
+ if (p_end > MAXHUNKSIZE)
+ fatal("hunk too large (%ld lines) at line %ld: %s",
+ p_end, p_input_line, buf);
+ while (p_end >= hunkmax)
+ grow_hunkmax();
+ snprintf(buf, buf_size, "*** %ld,%ld\n", p_first,
+ p_first + p_ptrn_lines - 1);
+ p_line[0] = savestr(buf);
+ if (out_of_mem) {
+ p_end = -1;
+ return false;
+ }
+ p_char[0] = '*';
+ for (i = 1; i <= p_ptrn_lines; i++) {
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0)
+ fatal("unexpected end of file in patch at line %ld\n",
+ p_input_line);
+ if (*buf != '<')
+ fatal("< expected at line %ld of patch\n",
+ p_input_line);
+ p_line[i] = savestr(buf + 2);
+ if (out_of_mem) {
+ p_end = i - 1;
+ return false;
+ }
+ p_len[i] = strlen(p_line[i]);
+ p_char[i] = '-';
+ }
+
+ if (remove_special_line()) {
+ p_len[i - 1] -= 1;
+ (p_line[i - 1])[p_len[i - 1]] = 0;
+ }
+ if (hunk_type == 'c') {
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0)
+ fatal("unexpected end of file in patch at line %ld\n",
+ p_input_line);
+ if (*buf != '-')
+ fatal("--- expected at line %ld of patch\n",
+ p_input_line);
+ }
+ snprintf(buf, buf_size, "--- %ld,%ld\n", min, max);
+ p_line[i] = savestr(buf);
+ if (out_of_mem) {
+ p_end = i - 1;
+ return false;
+ }
+ p_char[i] = '=';
+ for (i++; i <= p_end; i++) {
+ len = pgets(true);
+ p_input_line++;
+ if (len == 0)
+ fatal("unexpected end of file in patch at line %ld\n",
+ p_input_line);
+ if (*buf != '>')
+ fatal("> expected at line %ld of patch\n",
+ p_input_line);
+ p_line[i] = savestr(buf + 2);
+ if (out_of_mem) {
+ p_end = i - 1;
+ return false;
+ }
+ p_len[i] = strlen(p_line[i]);
+ p_char[i] = '+';
+ }
+
+ if (remove_special_line()) {
+ p_len[i - 1] -= 1;
+ (p_line[i - 1])[p_len[i - 1]] = 0;
+ }
+ }
+ if (reverse) /* backwards patch? */
+ if (!pch_swap())
+ say("Not enough memory to swap next hunk!\n");
+#ifdef DEBUGGING
+ if (debug & 2) {
+ LINENUM i;
+ char special;
+
+ for (i = 0; i <= p_end; i++) {
+ if (i == p_ptrn_lines)
+ special = '^';
+ else
+ special = ' ';
+ fprintf(stderr, "%3ld %c %c %s", i, p_char[i],
+ special, p_line[i]);
+ fflush(stderr);
+ }
+ }
+#endif
+ if (p_end + 1 < hunkmax)/* paranoia reigns supreme... */
+ p_char[p_end + 1] = '^'; /* add a stopper for apply_hunk */
+ return true;
+}
+
+/*
+ * Input a line from the patch file.
+ * Worry about indentation if do_indent is true.
+ * The line is read directly into the buf global variable which
+ * is resized if necessary in order to hold the complete line.
+ * Returns the number of characters read including the terminating
+ * '\n', if any.
+ */
+size_t
+pgets(bool do_indent)
+{
+ char *line;
+ size_t len;
+ int indent = 0, skipped = 0;
+
+ line = fgetln(pfp, &len);
+ if (line != NULL) {
+ if (len + 1 > buf_size) {
+ while (len + 1 > buf_size)
+ buf_size *= 2;
+ free(buf);
+ buf = malloc(buf_size);
+ if (buf == NULL)
+ fatal("out of memory\n");
+ }
+ if (do_indent == 1 && p_indent) {
+ for (;
+ indent < p_indent && (*line == ' ' || *line == '\t' || *line == 'X');
+ line++, skipped++) {
+ if (*line == '\t')
+ indent += 8 - (indent %7);
+ else
+ indent++;
+ }
+ }
+ memcpy(buf, line, len - skipped);
+ buf[len - skipped] = '\0';
+ }
+ return len;
+}
+
+
+/*
+ * Reverse the old and new portions of the current hunk.
+ */
+bool
+pch_swap(void)
+{
+ char **tp_line; /* the text of the hunk */
+ unsigned short *tp_len;/* length of each line */
+ char *tp_char; /* +, -, and ! */
+ LINENUM i;
+ LINENUM n;
+ bool blankline = false;
+ char *s;
+
+ i = p_first;
+ p_first = p_newfirst;
+ p_newfirst = i;
+
+ /* make a scratch copy */
+
+ tp_line = p_line;
+ tp_len = p_len;
+ tp_char = p_char;
+ p_line = NULL; /* force set_hunkmax to allocate again */
+ p_len = NULL;
+ p_char = NULL;
+ set_hunkmax();
+ if (p_line == NULL || p_len == NULL || p_char == NULL) {
+
+ free(p_line);
+ p_line = tp_line;
+ free(p_len);
+ p_len = tp_len;
+ free(p_char);
+ p_char = tp_char;
+ return false; /* not enough memory to swap hunk! */
+ }
+ /* now turn the new into the old */
+
+ i = p_ptrn_lines + 1;
+ if (tp_char[i] == '\n') { /* account for possible blank line */
+ blankline = true;
+ i++;
+ }
+ if (p_efake >= 0) { /* fix non-freeable ptr range */
+ if (p_efake <= i)
+ n = p_end - i + 1;
+ else
+ n = -i;
+ p_efake += n;
+ p_bfake += n;
+ }
+ for (n = 0; i <= p_end; i++, n++) {
+ p_line[n] = tp_line[i];
+ p_char[n] = tp_char[i];
+ if (p_char[n] == '+')
+ p_char[n] = '-';
+ p_len[n] = tp_len[i];
+ }
+ if (blankline) {
+ i = p_ptrn_lines + 1;
+ p_line[n] = tp_line[i];
+ p_char[n] = tp_char[i];
+ p_len[n] = tp_len[i];
+ n++;
+ }
+ if (p_char[0] != '=')
+ fatal("Malformed patch at line %ld: expected '=' found '%c'\n",
+ p_input_line, p_char[0]);
+ p_char[0] = '*';
+ for (s = p_line[0]; *s; s++)
+ if (*s == '-')
+ *s = '*';
+
+ /* now turn the old into the new */
+
+ if (p_char[0] != '*')
+ fatal("Malformed patch at line %ld: expected '*' found '%c'\n",
+ p_input_line, p_char[0]);
+ tp_char[0] = '=';
+ for (s = tp_line[0]; *s; s++)
+ if (*s == '*')
+ *s = '-';
+ for (i = 0; n <= p_end; i++, n++) {
+ p_line[n] = tp_line[i];
+ p_char[n] = tp_char[i];
+ if (p_char[n] == '-')
+ p_char[n] = '+';
+ p_len[n] = tp_len[i];
+ }
+
+ if (i != p_ptrn_lines + 1)
+ fatal("Malformed patch at line %ld: expected %ld lines, "
+ "got %ld\n",
+ p_input_line, p_ptrn_lines + 1, i);
+
+ i = p_ptrn_lines;
+ p_ptrn_lines = p_repl_lines;
+ p_repl_lines = i;
+
+ free(tp_line);
+ free(tp_len);
+ free(tp_char);
+
+ return true;
+}
+
+/*
+ * Return the specified line position in the old file of the old context.
+ */
+LINENUM
+pch_first(void)
+{
+ return p_first;
+}
+
+/*
+ * Return the number of lines of old context.
+ */
+LINENUM
+pch_ptrn_lines(void)
+{
+ return p_ptrn_lines;
+}
+
+/*
+ * Return the probable line position in the new file of the first line.
+ */
+LINENUM
+pch_newfirst(void)
+{
+ return p_newfirst;
+}
+
+/*
+ * Return the number of lines in the replacement text including context.
+ */
+LINENUM
+pch_repl_lines(void)
+{
+ return p_repl_lines;
+}
+
+/*
+ * Return the number of lines in the whole hunk.
+ */
+LINENUM
+pch_end(void)
+{
+ return p_end;
+}
+
+/*
+ * Return the number of context lines before the first changed line.
+ */
+LINENUM
+pch_context(void)
+{
+ return p_context;
+}
+
+/*
+ * Return the length of a particular patch line.
+ */
+unsigned short
+pch_line_len(LINENUM line)
+{
+ return p_len[line];
+}
+
+/*
+ * Return the control character (+, -, *, !, etc) for a patch line.
+ */
+char
+pch_char(LINENUM line)
+{
+ return p_char[line];
+}
+
+/*
+ * Return a pointer to a particular patch line.
+ */
+char *
+pfetch(LINENUM line)
+{
+ return p_line[line];
+}
+
+/*
+ * Return where in the patch file this hunk began, for error messages.
+ */
+LINENUM
+pch_hunk_beg(void)
+{
+ return p_hunk_beg;
+}
+
+/*
+ * Apply an ed script by feeding ed itself.
+ */
+void
+do_ed_script(void)
+{
+ char *t;
+ off_t beginning_of_this_line;
+ FILE *pipefp = NULL;
+ int continuation;
+
+ if (!skip_rest_of_patch) {
+ if (copy_file(filearg[0], TMPOUTNAME) < 0) {
+ unlink(TMPOUTNAME);
+ fatal("can't create temp file %s", TMPOUTNAME);
+ }
+ snprintf(buf, buf_size, "%s%s%s", _PATH_RED,
+ verbose ? " " : " -s ", TMPOUTNAME);
+ pipefp = popen(buf, "w");
+ }
+ for (;;) {
+ beginning_of_this_line = ftello(pfp);
+ if (pgets(true) == 0) {
+ next_intuit_at(beginning_of_this_line, p_input_line);
+ break;
+ }
+ p_input_line++;
+ for (t = buf; isdigit((unsigned char)*t) || *t == ','; t++)
+ ;
+ /* POSIX defines allowed commands as {a,c,d,i,s} */
+ if (isdigit((unsigned char)*buf) &&
+ (*t == 'a' || *t == 'c' || *t == 'd' || *t == 'i' || *t == 's')) {
+ if (pipefp != NULL)
+ fputs(buf, pipefp);
+ if (*t == 's') {
+ for (;;) {
+ continuation = 0;
+ t = strchr(buf, '\0') - 1;
+ while (--t >= buf && *t == '\\')
+ continuation = !continuation;
+ if (!continuation ||
+ pgets(true) == 0)
+ break;
+ if (pipefp != NULL)
+ fputs(buf, pipefp);
+ }
+ } else if (*t != 'd') {
+ while (pgets(true)) {
+ p_input_line++;
+ if (pipefp != NULL)
+ fputs(buf, pipefp);
+ if (strEQ(buf, ".\n"))
+ break;
+ }
+ }
+ } else {
+ next_intuit_at(beginning_of_this_line, p_input_line);
+ break;
+ }
+ }
+ if (pipefp == NULL)
+ return;
+ fprintf(pipefp, "w\n");
+ fprintf(pipefp, "q\n");
+ fflush(pipefp);
+ pclose(pipefp);
+ ignore_signals();
+ if (!check_only) {
+ if (move_file(TMPOUTNAME, outname) < 0) {
+ toutkeep = true;
+ chmod(TMPOUTNAME, filemode);
+ } else
+ chmod(outname, filemode);
+ }
+ set_signals(1);
+}
+
+/*
+ * Choose the name of the file to be patched based on POSIX rules.
+ * NOTE: the POSIX rules are amazingly stupid and we only follow them
+ * if the user specified --posix or set POSIXLY_CORRECT.
+ */
+static char *
+posix_name(const struct file_name *names, bool assume_exists)
+{
+ char *path = NULL;
+ int i;
+
+ /*
+ * POSIX states that the filename will be chosen from one
+ * of the old, new and index names (in that order) if
+ * the file exists relative to CWD after -p stripping.
+ */
+ for (i = 0; i < MAX_FILE; i++) {
+ if (names[i].path != NULL && names[i].exists) {
+ path = names[i].path;
+ break;
+ }
+ }
+ if (path == NULL && !assume_exists) {
+ /*
+ * No files found, check to see if the diff could be
+ * creating a new file.
+ */
+ if (path == NULL && ok_to_create_file &&
+ names[NEW_FILE].path != NULL)
+ path = names[NEW_FILE].path;
+ }
+
+ return path ? xstrdup(path) : NULL;
+}
+
+static char *
+compare_names(const struct file_name *names, bool assume_exists)
+{
+ size_t min_components, min_baselen, min_len, tmp;
+ char *best = NULL;
+ char *path;
+ int i;
+
+ /*
+ * The "best" name is the one with the fewest number of path
+ * components, the shortest basename length, and the shortest
+ * overall length (in that order). We only use the Index: file
+ * if neither of the old or new files could be intuited from
+ * the diff header.
+ */
+ min_components = min_baselen = min_len = SIZE_MAX;
+ for (i = INDEX_FILE; i >= OLD_FILE; i--) {
+ path = names[i].path;
+ if (path == NULL || (!names[i].exists && !assume_exists))
+ continue;
+ if ((tmp = num_components(path)) > min_components)
+ continue;
+ if (tmp < min_components) {
+ min_components = tmp;
+ best = path;
+ }
+ if ((tmp = strlen(basename(path))) > min_baselen)
+ continue;
+ if (tmp < min_baselen) {
+ min_baselen = tmp;
+ best = path;
+ }
+ if ((tmp = strlen(path)) > min_len)
+ continue;
+ min_len = tmp;
+ best = path;
+ }
+ return best;
+}
+
+/*
+ * Choose the name of the file to be patched based the "best" one
+ * available.
+ */
+static char *
+best_name(const struct file_name *names, bool assume_exists)
+{
+ char *best;
+
+ best = compare_names(names, assume_exists);
+
+ /* No match? Check to see if the diff could be creating a new file. */
+ if (best == NULL && ok_to_create_file)
+ best = names[NEW_FILE].path;
+
+ return best ? xstrdup(best) : NULL;
+}
+
+static size_t
+num_components(const char *path)
+{
+ size_t n;
+ const char *cp;
+
+ for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++, cp++) {
+ while (*cp == '/')
+ cp++; /* skip consecutive slashes */
+ }
+ return n;
+}
+
+/*
+ * Convert number at NPTR into LINENUM and save address of first
+ * character that is not a digit in ENDPTR. If conversion is not
+ * possible, call fatal.
+ */
+static LINENUM
+strtolinenum(char *nptr, char **endptr)
+{
+ LINENUM rv;
+ char c;
+ char *p;
+ const char *errstr;
+
+ for (p = nptr; isdigit((unsigned char)*p); p++)
+ ;
+
+ if (p == nptr)
+ malformed();
+
+ c = *p;
+ *p = '\0';
+
+ rv = strtonum(nptr, 0, LINENUM_MAX, &errstr);
+ if (errstr != NULL)
+ fatal("invalid line number at line %ld: `%s' is %s\n",
+ p_input_line, nptr, errstr);
+
+ *p = c;
+ *endptr = p;
+
+ return rv;
+}
diff --git a/usr.bin/patch/pch.h b/usr.bin/patch/pch.h
new file mode 100644
index 0000000..da7a08d
--- /dev/null
+++ b/usr.bin/patch/pch.h
@@ -0,0 +1,56 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: pch.h,v 1.9 2003/10/31 20:20:45 millert Exp $
+ * $FreeBSD$
+ */
+
+#define OLD_FILE 0
+#define NEW_FILE 1
+#define INDEX_FILE 2
+#define MAX_FILE 3
+
+struct file_name {
+ char *path;
+ bool exists;
+};
+
+void re_patch(void);
+void open_patch_file(const char *);
+void set_hunkmax(void);
+bool there_is_another_patch(void);
+bool another_hunk(void);
+bool pch_swap(void);
+char *pfetch(LINENUM);
+unsigned short pch_line_len(LINENUM);
+LINENUM pch_first(void);
+LINENUM pch_ptrn_lines(void);
+LINENUM pch_newfirst(void);
+LINENUM pch_repl_lines(void);
+LINENUM pch_end(void);
+LINENUM pch_context(void);
+LINENUM pch_hunk_beg(void);
+char pch_char(LINENUM);
+void do_ed_script(void);
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
new file mode 100644
index 0000000..39a2eed
--- /dev/null
+++ b/usr.bin/patch/util.c
@@ -0,0 +1,422 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: util.c,v 1.35 2010/07/24 01:10:12 ray Exp $
+ * $FreeBSD$
+ */
+
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <limits.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "util.h"
+#include "backupfile.h"
+#include "pathnames.h"
+
+/* Rename a file, copying it if necessary. */
+
+int
+move_file(const char *from, const char *to)
+{
+ int fromfd;
+ ssize_t i;
+
+ /* to stdout? */
+
+ if (strEQ(to, "-")) {
+#ifdef DEBUGGING
+ if (debug & 4)
+ say("Moving %s to stdout.\n", from);
+#endif
+ fromfd = open(from, O_RDONLY);
+ if (fromfd < 0)
+ pfatal("internal error, can't reopen %s", from);
+ while ((i = read(fromfd, buf, buf_size)) > 0)
+ if (write(STDOUT_FILENO, buf, i) != i)
+ pfatal("write failed");
+ close(fromfd);
+ return 0;
+ }
+ if (backup_file(to) < 0) {
+ say("Can't backup %s, output is in %s: %s\n", to, from,
+ strerror(errno));
+ return -1;
+ }
+#ifdef DEBUGGING
+ if (debug & 4)
+ say("Moving %s to %s.\n", from, to);
+#endif
+ if (rename(from, to) < 0) {
+ if (errno != EXDEV || copy_file(from, to) < 0) {
+ say("Can't create %s, output is in %s: %s\n",
+ to, from, strerror(errno));
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/* Backup the original file. */
+
+int
+backup_file(const char *orig)
+{
+ struct stat filestat;
+ char bakname[PATH_MAX], *s, *simplename;
+ dev_t orig_device;
+ ino_t orig_inode;
+
+ if (backup_type == none || stat(orig, &filestat) != 0)
+ return 0; /* nothing to do */
+ /*
+ * If the user used zero prefixes or suffixes, then
+ * he doesn't want backups. Yet we have to remove
+ * orig to break possible hardlinks.
+ */
+ if ((origprae && *origprae == 0) || *simple_backup_suffix == 0) {
+ unlink(orig);
+ return 0;
+ }
+ orig_device = filestat.st_dev;
+ orig_inode = filestat.st_ino;
+
+ if (origprae) {
+ if (strlcpy(bakname, origprae, sizeof(bakname)) >= sizeof(bakname) ||
+ strlcat(bakname, orig, sizeof(bakname)) >= sizeof(bakname))
+ fatal("filename %s too long for buffer\n", origprae);
+ } else {
+ if ((s = find_backup_file_name(orig)) == NULL)
+ fatal("out of memory\n");
+ if (strlcpy(bakname, s, sizeof(bakname)) >= sizeof(bakname))
+ fatal("filename %s too long for buffer\n", s);
+ free(s);
+ }
+
+ if ((simplename = strrchr(bakname, '/')) != NULL)
+ simplename = simplename + 1;
+ else
+ simplename = bakname;
+
+ /*
+ * Find a backup name that is not the same file. Change the
+ * first lowercase char into uppercase; if that isn't
+ * sufficient, chop off the first char and try again.
+ */
+ while (stat(bakname, &filestat) == 0 &&
+ orig_device == filestat.st_dev && orig_inode == filestat.st_ino) {
+ /* Skip initial non-lowercase chars. */
+ for (s = simplename; *s && !islower((unsigned char)*s); s++)
+ ;
+ if (*s)
+ *s = toupper((unsigned char)*s);
+ else
+ memmove(simplename, simplename + 1,
+ strlen(simplename + 1) + 1);
+ }
+#ifdef DEBUGGING
+ if (debug & 4)
+ say("Moving %s to %s.\n", orig, bakname);
+#endif
+ if (rename(orig, bakname) < 0) {
+ if (errno != EXDEV || copy_file(orig, bakname) < 0)
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Copy a file.
+ */
+int
+copy_file(const char *from, const char *to)
+{
+ int tofd, fromfd;
+ ssize_t i;
+
+ tofd = open(to, O_CREAT|O_TRUNC|O_WRONLY, 0666);
+ if (tofd < 0)
+ return -1;
+ fromfd = open(from, O_RDONLY, 0);
+ if (fromfd < 0)
+ pfatal("internal error, can't reopen %s", from);
+ while ((i = read(fromfd, buf, buf_size)) > 0)
+ if (write(tofd, buf, i) != i)
+ pfatal("write to %s failed", to);
+ close(fromfd);
+ close(tofd);
+ return 0;
+}
+
+/*
+ * Allocate a unique area for a string.
+ */
+char *
+savestr(const char *s)
+{
+ char *rv;
+
+ if (!s)
+ s = "Oops";
+ rv = strdup(s);
+ if (rv == NULL) {
+ if (using_plan_a)
+ out_of_mem = true;
+ else
+ fatal("out of memory\n");
+ }
+ return rv;
+}
+
+/*
+ * Allocate a unique area for a string. Call fatal if out of memory.
+ */
+char *
+xstrdup(const char *s)
+{
+ char *rv;
+
+ if (!s)
+ s = "Oops";
+ rv = strdup(s);
+ if (rv == NULL)
+ fatal("out of memory\n");
+ return rv;
+}
+
+/*
+ * Vanilla terminal output (buffered).
+ */
+void
+say(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+ fflush(stdout);
+}
+
+/*
+ * Terminal output, pun intended.
+ */
+void
+fatal(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fprintf(stderr, "patch: **** ");
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ my_exit(2);
+}
+
+/*
+ * Say something from patch, something from the system, then silence . . .
+ */
+void
+pfatal(const char *fmt, ...)
+{
+ va_list ap;
+ int errnum = errno;
+
+ fprintf(stderr, "patch: **** ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, ": %s\n", strerror(errnum));
+ my_exit(2);
+}
+
+/*
+ * Get a response from the user via /dev/tty
+ */
+void
+ask(const char *fmt, ...)
+{
+ va_list ap;
+ ssize_t nr = 0;
+ static int ttyfd = -1;
+
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+ fflush(stdout);
+ if (ttyfd < 0)
+ ttyfd = open(_PATH_TTY, O_RDONLY);
+ if (ttyfd >= 0) {
+ if ((nr = read(ttyfd, buf, buf_size)) > 0 &&
+ buf[nr - 1] == '\n')
+ buf[nr - 1] = '\0';
+ }
+ if (ttyfd < 0 || nr <= 0) {
+ /* no tty or error reading, pretend user entered 'return' */
+ putchar('\n');
+ buf[0] = '\0';
+ }
+}
+
+/*
+ * How to handle certain events when not in a critical region.
+ */
+void
+set_signals(int reset)
+{
+ static sig_t hupval, intval;
+
+ if (!reset) {
+ hupval = signal(SIGHUP, SIG_IGN);
+ if (hupval != SIG_IGN)
+ hupval = my_exit;
+ intval = signal(SIGINT, SIG_IGN);
+ if (intval != SIG_IGN)
+ intval = my_exit;
+ }
+ signal(SIGHUP, hupval);
+ signal(SIGINT, intval);
+}
+
+/*
+ * How to handle certain events when in a critical region.
+ */
+void
+ignore_signals(void)
+{
+ signal(SIGHUP, SIG_IGN);
+ signal(SIGINT, SIG_IGN);
+}
+
+/*
+ * Make sure we'll have the directories to create a file. If `striplast' is
+ * true, ignore the last element of `filename'.
+ */
+
+void
+makedirs(const char *filename, bool striplast)
+{
+ char *tmpbuf;
+
+ if ((tmpbuf = strdup(filename)) == NULL)
+ fatal("out of memory\n");
+
+ if (striplast) {
+ char *s = strrchr(tmpbuf, '/');
+ if (s == NULL) {
+ free(tmpbuf);
+ return; /* nothing to be done */
+ }
+ *s = '\0';
+ }
+ if (mkpath(tmpbuf) != 0)
+ pfatal("creation of %s failed", tmpbuf);
+ free(tmpbuf);
+}
+
+/*
+ * Make filenames more reasonable.
+ */
+char *
+fetchname(const char *at, bool *exists, int strip_leading)
+{
+ char *fullname, *name, *t;
+ int sleading, tab;
+ struct stat filestat;
+
+ if (at == NULL || *at == '\0')
+ return NULL;
+ while (isspace((unsigned char)*at))
+ at++;
+#ifdef DEBUGGING
+ if (debug & 128)
+ say("fetchname %s %d\n", at, strip_leading);
+#endif
+ /* So files can be created by diffing against /dev/null. */
+ if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1))
+ return NULL;
+ name = fullname = t = savestr(at);
+
+ tab = strchr(t, '\t') != NULL;
+ /* Strip off up to `strip_leading' path components and NUL terminate. */
+ for (sleading = strip_leading; *t != '\0' && ((tab && *t != '\t') ||
+ !isspace((unsigned char)*t)); t++) {
+ if (t[0] == '/' && t[1] != '/' && t[1] != '\0')
+ if (--sleading >= 0)
+ name = t + 1;
+ }
+ *t = '\0';
+
+ /*
+ * If no -p option was given (957 is the default value!), we were
+ * given a relative pathname, and the leading directories that we
+ * just stripped off all exist, put them back on.
+ */
+ if (strip_leading == 957 && name != fullname && *fullname != '/') {
+ name[-1] = '\0';
+ if (stat(fullname, &filestat) == 0 && S_ISDIR(filestat.st_mode)) {
+ name[-1] = '/';
+ name = fullname;
+ }
+ }
+ name = savestr(name);
+ free(fullname);
+
+ *exists = stat(name, &filestat) == 0;
+ return name;
+}
+
+void
+version(void)
+{
+ printf("patch 2.0-12u11 FreeBSD\n");
+ my_exit(EXIT_SUCCESS);
+}
+
+/*
+ * Exit with cleanup.
+ */
+void
+my_exit(int status)
+{
+ unlink(TMPINNAME);
+ if (!toutkeep)
+ unlink(TMPOUTNAME);
+ if (!trejkeep)
+ unlink(TMPREJNAME);
+ unlink(TMPPATNAME);
+ exit(status);
+}
diff --git a/usr.bin/patch/util.h b/usr.bin/patch/util.h
new file mode 100644
index 0000000..2ef6b2f
--- /dev/null
+++ b/usr.bin/patch/util.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright 1986, Larry Wall
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following condition is met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this condition and the following disclaimer.
+ *
+ * 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.
+ *
+ * patch - a program to apply diffs to original files
+ *
+ * -C option added in 1998, original code by Marc Espie, based on FreeBSD
+ * behaviour
+ *
+ * $OpenBSD: util.h,v 1.16 2014/12/13 10:31:07 tobias Exp $
+ * $FreeBSD$
+ */
+
+char *fetchname(const char *, bool *, int);
+int backup_file(const char *);
+int move_file(const char *, const char *);
+int copy_file(const char *, const char *);
+void say(const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+void fatal(const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+void pfatal(const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+void ask(const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+char *savestr(const char *);
+char *xstrdup(const char *);
+void set_signals(int);
+void ignore_signals(void);
+void makedirs(const char *, bool);
+void version(void);
+void my_exit(int) __attribute__((noreturn));
+
+/* in mkpath.c */
+extern int mkpath(char *);
diff --git a/usr.bin/pathchk/Makefile b/usr.bin/pathchk/Makefile
new file mode 100644
index 0000000..b5bea85
--- /dev/null
+++ b/usr.bin/pathchk/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= pathchk
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pathchk/Makefile.depend b/usr.bin/pathchk/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/pathchk/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/pathchk/pathchk.1 b/usr.bin/pathchk/pathchk.1
new file mode 100644
index 0000000..931f82f
--- /dev/null
+++ b/usr.bin/pathchk/pathchk.1
@@ -0,0 +1,131 @@
+.\" Copyright (c) 2001, 2002 Chuck Rouillard
+.\" 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. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 1, 2010
+.Dt PATHCHK 1
+.Os
+.Sh NAME
+.Nm pathchk
+.Nd check pathnames
+.Sh SYNOPSIS
+.Nm
+.Op Fl pP
+.Ar pathname ...
+.Sh DESCRIPTION
+The
+.Nm
+utility checks whether each of the specified
+.Ar pathname
+arguments is valid or portable.
+.Pp
+A diagnostic message is written for each argument that:
+.Bl -bullet
+.It
+Is longer than
+.Dv PATH_MAX
+bytes.
+.It
+Contains any component longer than
+.Dv NAME_MAX
+bytes.
+(The value of
+.Dv NAME_MAX
+depends on the underlying file system.)
+.It
+Contains a directory component that is not searchable.
+.El
+.Pp
+It is not considered an error if a
+.Ar pathname
+argument contains a nonexistent component as long as a component by that
+name could be created.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl p
+Perform portability checks on the specified
+.Ar pathname
+arguments.
+Diagnostic messages will be written for each argument that:
+.Bl -bullet
+.It
+Is longer than
+.Dv _POSIX_PATH_MAX
+.Pq 255
+bytes.
+.It
+Contains a component longer than
+.Dv _POSIX_NAME_MAX
+.Pq 14
+bytes.
+.It
+Contains any character not in the portable filename character set (that is,
+alphanumeric characters,
+.Ql \&. ,
+.Ql \&-
+and
+.Ql _ ) .
+No component may start with the hyphen
+.Pq Ql \&-
+character.
+.El
+.It Fl P
+In addition to the default or
+.Fl p
+checks, write a diagnostic for each argument that:
+.Bl -bullet
+.It
+Is empty.
+.It
+Contains a component that starts with a hyphen.
+.El
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Check whether the names of files in the current directory are portable to
+other
+.Tn POSIX
+systems:
+.Pp
+.Dl "find . -exec pathchk -p -- {} +"
+.Sh SEE ALSO
+.Xr getconf 1 ,
+.Xr pathconf 2 ,
+.Xr stat 2
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.Fx 5.0 .
diff --git a/usr.bin/pathchk/pathchk.c b/usr.bin/pathchk/pathchk.c
new file mode 100644
index 0000000..3dc901b
--- /dev/null
+++ b/usr.bin/pathchk/pathchk.c
@@ -0,0 +1,202 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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.
+ */
+
+/*
+ * pathchk -- check pathnames
+ *
+ * Check whether files could be created with the names specified on the
+ * command line. If -p is specified, check whether the pathname is portable
+ * to all POSIX systems.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static int check(const char *);
+static int portable(const char *);
+static void usage(void);
+
+static int pflag; /* Perform portability checks */
+static int Pflag; /* Check for empty paths, leading '-' */
+
+int
+main(int argc, char *argv[])
+{
+ int ch, rval;
+ const char *arg;
+
+ while ((ch = getopt(argc, argv, "pP")) > 0) {
+ switch (ch) {
+ case 'p':
+ pflag = 1;
+ break;
+ case 'P':
+ Pflag = 1;
+ break;
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ usage();
+
+ rval = 0;
+ while ((arg = *argv++) != NULL)
+ rval |= check(arg);
+
+ exit(rval);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: pathchk [-p] pathname ...\n");
+ exit(1);
+}
+
+static int
+check(const char *path)
+{
+ struct stat sb;
+ long complen, namemax, pathmax, svnamemax;
+ int last;
+ char *end, *p, *pathd;
+
+ if ((pathd = strdup(path)) == NULL)
+ err(1, "strdup");
+
+ p = pathd;
+
+ if (Pflag && *p == '\0') {
+ warnx("%s: empty pathname", path);
+ goto bad;
+ }
+ if ((Pflag || pflag) && (*p == '-' || strstr(p, "/-") != NULL)) {
+ warnx("%s: contains a component starting with '-'", path);
+ goto bad;
+ }
+
+ if (!pflag) {
+ errno = 0;
+ namemax = pathconf(*p == '/' ? "/" : ".", _PC_NAME_MAX);
+ if (namemax == -1 && errno != 0)
+ namemax = NAME_MAX;
+ } else
+ namemax = _POSIX_NAME_MAX;
+
+ for (;;) {
+ p += strspn(p, "/");
+ complen = (long)strcspn(p, "/");
+ end = p + complen;
+ last = *end == '\0';
+ *end = '\0';
+
+ if (namemax != -1 && complen > namemax) {
+ warnx("%s: %s: component too long (limit %ld)", path,
+ p, namemax);
+ goto bad;
+ }
+
+ if (!pflag && stat(pathd, &sb) == -1 && errno != ENOENT) {
+ warn("%s: %.*s", path, (int)(strlen(pathd) -
+ complen - 1), pathd);
+ goto bad;
+ }
+
+ if (pflag && !portable(p)) {
+ warnx("%s: %s: component contains non-portable "
+ "character", path, p);
+ goto bad;
+ }
+
+ if (last)
+ break;
+
+ if (!pflag) {
+ errno = 0;
+ svnamemax = namemax;
+ namemax = pathconf(pathd, _PC_NAME_MAX);
+ if (namemax == -1 && errno != 0)
+ namemax = svnamemax;
+ }
+
+ *end = '/';
+ p = end + 1;
+ }
+
+ if (!pflag) {
+ errno = 0;
+ pathmax = pathconf(path, _PC_PATH_MAX);
+ if (pathmax == -1 && errno != 0)
+ pathmax = PATH_MAX;
+ } else
+ pathmax = _POSIX_PATH_MAX;
+ if (pathmax != -1 && strlen(path) >= (size_t)pathmax) {
+ warnx("%s: path too long (limit %ld)", path, pathmax - 1);
+ goto bad;
+ }
+
+ free(pathd);
+ return (0);
+
+bad: free(pathd);
+ return (1);
+}
+
+/*
+ * Check whether a path component contains only portable characters.
+ */
+static int
+portable(const char *path)
+{
+ static const char charset[] =
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789._-";
+ long s;
+
+ s = strspn(path, charset);
+ if (path[s] != '\0')
+ return (0);
+
+ return (1);
+}
diff --git a/usr.bin/perror/Makefile b/usr.bin/perror/Makefile
new file mode 100644
index 0000000..e76d593
--- /dev/null
+++ b/usr.bin/perror/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= perror
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/perror/Makefile.depend b/usr.bin/perror/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/perror/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/perror/perror.1 b/usr.bin/perror/perror.1
new file mode 100644
index 0000000..6fa1664
--- /dev/null
+++ b/usr.bin/perror/perror.1
@@ -0,0 +1,50 @@
+.\"
+.\" Copyright (c) 2009 Hudson River Trading LLC
+.\" Written by: George V. Neville-Neil <gnn@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 May 12, 2009
+.Dt PERROR 1
+.Os
+.Sh NAME
+.Nm perror
+.Nd "print an error number as a string"
+.Sh SYNOPSIS
+.Nm
+.Ar number
+.Sh DESCRIPTION
+The
+.Nm
+program takes a raw errno value and prints it as a string.
+.Sh SEE ALSO
+.Xr perror 3
+.Sh HISTORY
+The
+.Nm
+program first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An George V. Neville-Neil
diff --git a/usr.bin/perror/perror.c b/usr.bin/perror/perror.c
new file mode 100644
index 0000000..62af5df
--- /dev/null
+++ b/usr.bin/perror/perror.c
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 2009 Hudson River Trading LLC
+ * Written by: George V. Neville-Neil <gnn@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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+#include <locale.h>
+#include <sys/errno.h>
+
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ char *cp;
+ char *errstr;
+ long errnum;
+
+ (void) setlocale(LC_MESSAGES, "");
+ if (argc != 2)
+ usage();
+
+ errno = 0;
+
+ errnum = strtol(argv[1], &cp, 0);
+
+ if (errno != 0)
+ err(1, NULL);
+
+ if ((errstr = strerror(errnum)) == NULL)
+ err(1, NULL);
+
+ printf("%s\n", errstr);
+
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: perror number\n");
+ exit(1);
+}
+
diff --git a/usr.bin/pom/Makefile b/usr.bin/pom/Makefile
new file mode 100644
index 0000000..b7d4b00
--- /dev/null
+++ b/usr.bin/pom/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= pom
+MAN= pom.6
+LIBADD= m
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pom/Makefile.depend b/usr.bin/pom/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/pom/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/pom/pom.6 b/usr.bin/pom/pom.6
new file mode 100644
index 0000000..a38a920
--- /dev/null
+++ b/usr.bin/pom/pom.6
@@ -0,0 +1,66 @@
+.\" Copyright (c) 1989, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)pom.6 8.1 (Berkeley) 5/31/93
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2010
+.Dt POM 6
+.Os
+.Sh NAME
+.Nm pom
+.Nd display the phase of the moon
+.Sh SYNOPSIS
+.Nm
+.Op Fl p
+.Op Fl d Ar yyyy.mm.dd
+.Op Fl t Ar hh:mm:ss
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the current phase of the moon.
+Useful for selecting software completion target dates and predicting
+managerial behavior.
+.Pp
+Use the
+.Fl p
+option to print just the phase as a percentage.
+.Pp
+Use the arguments
+.Fl d
+and
+.Fl t
+to specify a specific date and time for which the phase of the moon
+has to be calculated.
+If
+.Fl d
+but not
+.Fl t
+has been specified, it will calculate the phase of the moon on that
+day at midnight.
+.Sh SEE ALSO
+`Practical Astronomy with Your Calculator' by Duffett-Smith.
diff --git a/usr.bin/pom/pom.c b/usr.bin/pom/pom.c
new file mode 100644
index 0000000..5f18bb3
--- /dev/null
+++ b/usr.bin/pom/pom.c
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software posted to USENET.
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Phase of the Moon. Calculates the current phase of the moon.
+ * Based on routines from `Practical Astronomy with Your Calculator',
+ * by Duffett-Smith. Comments give the section from the book that
+ * particular piece of code was adapted from.
+ *
+ * -- Keith E. Brandt VIII 1984
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <sysexits.h>
+#include <time.h>
+#include <unistd.h>
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+#define EPOCH 85
+#define EPSILONg 279.611371 /* solar ecliptic long at EPOCH */
+#define RHOg 282.680403 /* solar ecliptic long of perigee at EPOCH */
+#define ECCEN 0.01671542 /* solar orbit eccentricity */
+#define lzero 18.251907 /* lunar mean long at EPOCH */
+#define Pzero 192.917585 /* lunar mean long of perigee at EPOCH */
+#define Nzero 55.204723 /* lunar mean long of node at EPOCH */
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+
+static void adj360(double *);
+static double dtor(double);
+static double potm(double);
+static void usage(char *progname);
+
+int
+main(int argc, char **argv)
+{
+ time_t tt;
+ struct tm GMT, tmd;
+ double days, today, tomorrow;
+ int ch, cnt, pflag = 0;
+ char *odate = NULL, *otime = NULL;
+ char *progname = argv[0];
+
+ while ((ch = getopt(argc, argv, "d:pt:")) != -1)
+ switch (ch) {
+ case 'd':
+ odate = optarg;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case 't':
+ otime = optarg;
+ break;
+ default:
+ usage(progname);
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc)
+ usage(progname);
+
+ /* Adjust based on users preferences */
+ time(&tt);
+ if (otime != NULL || odate != NULL) {
+ /* Save today in case -d isn't specified */
+ localtime_r(&tt, &tmd);
+
+ if (odate != NULL) {
+ tmd.tm_year = strtol(odate, NULL, 10) - 1900;
+ tmd.tm_mon = strtol(odate + 5, NULL, 10) - 1;
+ tmd.tm_mday = strtol(odate + 8, NULL, 10);
+ /* Use midnight as the middle of the night */
+ tmd.tm_hour = 0;
+ tmd.tm_min = 0;
+ tmd.tm_sec = 0;
+ }
+ if (otime != NULL) {
+ tmd.tm_hour = strtol(otime, NULL, 10);
+ tmd.tm_min = strtol(otime + 3, NULL, 10);
+ tmd.tm_sec = strtol(otime + 6, NULL, 10);
+ }
+ tt = mktime(&tmd);
+ }
+
+ gmtime_r(&tt, &GMT);
+ days = (GMT.tm_yday + 1) + ((GMT.tm_hour +
+ (GMT.tm_min / 60.0) + (GMT.tm_sec / 3600.0)) / 24.0);
+ for (cnt = EPOCH; cnt < GMT.tm_year; ++cnt)
+ days += isleap(1900 + cnt) ? 366 : 365;
+ today = potm(days) + .5;
+ if (pflag) {
+ (void)printf("%1.0f\n", today);
+ return (0);
+ }
+ (void)printf("The Moon is ");
+ if ((int)today == 100)
+ (void)printf("Full\n");
+ else if (!(int)today)
+ (void)printf("New\n");
+ else {
+ tomorrow = potm(days + 1);
+ if ((int)today == 50)
+ (void)printf("%s\n", tomorrow > today ?
+ "at the First Quarter" : "at the Last Quarter");
+ else {
+ (void)printf("%s ", tomorrow > today ?
+ "Waxing" : "Waning");
+ if (today > 50)
+ (void)printf("Gibbous (%1.0f%% of Full)\n",
+ today);
+ else if (today < 50)
+ (void)printf("Crescent (%1.0f%% of Full)\n",
+ today);
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * potm --
+ * return phase of the moon
+ */
+static double
+potm(double days)
+{
+ double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime;
+ double A4, lprime, V, ldprime, D, Nm;
+
+ N = 360 * days / 365.2422; /* sec 42 #3 */
+ adj360(&N);
+ Msol = N + EPSILONg - RHOg; /* sec 42 #4 */
+ adj360(&Msol);
+ Ec = 360 / PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */
+ LambdaSol = N + Ec + EPSILONg; /* sec 42 #6 */
+ adj360(&LambdaSol);
+ l = 13.1763966 * days + lzero; /* sec 61 #4 */
+ adj360(&l);
+ Mm = l - (0.1114041 * days) - Pzero; /* sec 61 #5 */
+ adj360(&Mm);
+ Nm = Nzero - (0.0529539 * days); /* sec 61 #6 */
+ adj360(&Nm);
+ Ev = 1.2739 * sin(dtor(2*(l - LambdaSol) - Mm)); /* sec 61 #7 */
+ Ac = 0.1858 * sin(dtor(Msol)); /* sec 61 #8 */
+ A3 = 0.37 * sin(dtor(Msol));
+ Mmprime = Mm + Ev - Ac - A3; /* sec 61 #9 */
+ Ec = 6.2886 * sin(dtor(Mmprime)); /* sec 61 #10 */
+ A4 = 0.214 * sin(dtor(2 * Mmprime)); /* sec 61 #11 */
+ lprime = l + Ev + Ec - Ac + A4; /* sec 61 #12 */
+ V = 0.6583 * sin(dtor(2 * (lprime - LambdaSol))); /* sec 61 #13 */
+ ldprime = lprime + V; /* sec 61 #14 */
+ D = ldprime - LambdaSol; /* sec 63 #2 */
+ return(50 * (1 - cos(dtor(D)))); /* sec 63 #3 */
+}
+
+/*
+ * dtor --
+ * convert degrees to radians
+ */
+static double
+dtor(double deg)
+{
+
+ return(deg * PI / 180);
+}
+
+/*
+ * adj360 --
+ * adjust value so 0 <= deg <= 360
+ */
+static void
+adj360(double *deg)
+{
+
+ for (;;)
+ if (*deg < 0)
+ *deg += 360;
+ else if (*deg > 360)
+ *deg -= 360;
+ else
+ break;
+}
+
+static void
+usage(char *progname)
+{
+
+ fprintf(stderr, "Usage: %s [-p] [-d yyyy.mm.dd] [-t hh:mm:ss]\n",
+ progname);
+ exit(EX_USAGE);
+}
diff --git a/usr.bin/pr/Makefile b/usr.bin/pr/Makefile
new file mode 100644
index 0000000..15652dc
--- /dev/null
+++ b/usr.bin/pr/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= pr
+SRCS= pr.c egetopt.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pr/Makefile.depend b/usr.bin/pr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/pr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/pr/egetopt.c b/usr.bin/pr/egetopt.c
new file mode 100644
index 0000000..22a093a
--- /dev/null
+++ b/usr.bin/pr/egetopt.c
@@ -0,0 +1,217 @@
+/*-
+ * Copyright (c) 1991 Keith Muller.
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Keith Muller of the University of California, San Diego.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)egetopt.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "extern.h"
+
+/*
+ * egetopt: get option letter from argument vector (an extended
+ * version of getopt).
+ *
+ * Non standard additions to the ostr specs are:
+ * 1) '?': immediate value following arg is optional (no white space
+ * between the arg and the value)
+ * 2) '#': +/- followed by a number (with an optional sign but
+ * no white space between the arg and the number). The - may be
+ * combined with other options, but the + cannot.
+ */
+
+int eopterr = 1; /* if error message should be printed */
+int eoptind = 1; /* index into parent argv vector */
+int eoptopt; /* character checked for validity */
+char *eoptarg; /* argument associated with option */
+
+#define BADCH (int)'?'
+
+static char emsg[] = "";
+
+int
+egetopt(int nargc, char * const *nargv, const char *ostr)
+{
+ static char *place = emsg; /* option letter processing */
+ char *oli; /* option letter list index */
+ static int delim; /* which option delimiter */
+ char *p;
+ static char savec = '\0';
+
+ if (savec != '\0') {
+ *place = savec;
+ savec = '\0';
+ }
+
+ if (!*place) {
+ /*
+ * update scanning pointer
+ */
+ if ((eoptind >= nargc) ||
+ ((*(place = nargv[eoptind]) != '-') && (*place != '+'))) {
+ place = emsg;
+ return (-1);
+ }
+
+ delim = (int)*place;
+ if (place[1] && *++place == '-' && !place[1]) {
+ /*
+ * found "--"
+ */
+ ++eoptind;
+ place = emsg;
+ return (-1);
+ }
+ }
+
+ /*
+ * check option letter
+ */
+ if ((eoptopt = (int)*place++) == (int)':' || (eoptopt == (int)'?') ||
+ !(oli = strchr(ostr, eoptopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1 when by itself.
+ */
+ if ((eoptopt == (int)'-') && !*place)
+ return (-1);
+ if (strchr(ostr, '#') && (isdigit(eoptopt) ||
+ (((eoptopt == (int)'-') || (eoptopt == (int)'+')) &&
+ isdigit(*place)))) {
+ /*
+ * # option: +/- with a number is ok
+ */
+ for (p = place; *p != '\0'; ++p) {
+ if (!isdigit(*p))
+ break;
+ }
+ eoptarg = place-1;
+
+ if (*p == '\0') {
+ place = emsg;
+ ++eoptind;
+ } else {
+ place = p;
+ savec = *p;
+ *place = '\0';
+ }
+ return (delim);
+ }
+
+ if (!*place)
+ ++eoptind;
+ if (eopterr) {
+ if (!(p = strrchr(*nargv, '/')))
+ p = *nargv;
+ else
+ ++p;
+ (void)fprintf(stderr, "%s: illegal option -- %c\n",
+ p, eoptopt);
+ }
+ return (BADCH);
+ }
+ if (delim == (int)'+') {
+ /*
+ * '+' is only allowed with numbers
+ */
+ if (!*place)
+ ++eoptind;
+ if (eopterr) {
+ if (!(p = strrchr(*nargv, '/')))
+ p = *nargv;
+ else
+ ++p;
+ (void)fprintf(stderr,
+ "%s: illegal '+' delimiter with option -- %c\n",
+ p, eoptopt);
+ }
+ return (BADCH);
+ }
+ ++oli;
+ if ((*oli != ':') && (*oli != '?')) {
+ /*
+ * don't need argument
+ */
+ eoptarg = NULL;
+ if (!*place)
+ ++eoptind;
+ return (eoptopt);
+ }
+
+ if (*place) {
+ /*
+ * no white space
+ */
+ eoptarg = place;
+ } else if (*oli == '?') {
+ /*
+ * no arg, but NOT required
+ */
+ eoptarg = NULL;
+ } else if (nargc <= ++eoptind) {
+ /*
+ * no arg, but IS required
+ */
+ place = emsg;
+ if (eopterr) {
+ if (!(p = strrchr(*nargv, '/')))
+ p = *nargv;
+ else
+ ++p;
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n", p,
+ eoptopt);
+ }
+ return (BADCH);
+ } else {
+ /*
+ * arg has white space
+ */
+ eoptarg = nargv[eoptind];
+ }
+ place = emsg;
+ ++eoptind;
+ return (eoptopt);
+}
diff --git a/usr.bin/pr/extern.h b/usr.bin/pr/extern.h
new file mode 100644
index 0000000..c39e18f
--- /dev/null
+++ b/usr.bin/pr/extern.h
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1991 Keith Muller.
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Keith Muller of the University of California, San Diego.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+extern int eopterr;
+extern int eoptind;
+extern int eoptopt;
+extern char *eoptarg;
+
+void addnum(char *, int, int);
+int egetopt(int, char * const *, const char *);
+void flsh_errs(void);
+int horzcol(int, char **);
+int inln(FILE *, char *, int, int *, int, int *);
+int inskip(FILE *, int, int);
+void mfail(void);
+int mulfile(int, char **);
+FILE *nxtfile(int, char **, const char **, char *, int);
+int onecol(int, char **);
+int otln(char *, int, int *, int *, int);
+void pfail(void);
+int prhead(char *, const char *, int);
+int prtail(int, int);
+int setup(int, char **);
+void terminate(int);
+void usage(void);
+int vertcol(int, char **);
diff --git a/usr.bin/pr/pr.1 b/usr.bin/pr/pr.1
new file mode 100644
index 0000000..5268be6
--- /dev/null
+++ b/usr.bin/pr/pr.1
@@ -0,0 +1,389 @@
+.\" Copyright (c) 1991 Keith Muller.
+.\" Copyright (c) 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Keith Muller of the University of California, San Diego.
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)pr.1 8.3 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd July 3, 2004
+.Dt PR 1
+.Os
+.Sh NAME
+.Nm pr
+.Nd print files
+.Sh SYNOPSIS
+.Nm
+.Bk -words
+.Op Ar \&+page
+.Ek
+.Bk -words
+.Op Fl Ar column
+.Ek
+.Op Fl adFfmprt
+.Bk -words
+.Oo
+.Op Fl e
+.Op Ar char
+.Op Ar gap
+.Oc
+.Ek
+.Bk -words
+.Op Fl L Ar locale
+.Ek
+.Bk -words
+.Op Fl h Ar header
+.Ek
+.Bk -words
+.Oo
+.Op Fl i
+.Op Ar char
+.Op Ar gap
+.Oc
+.Ek
+.Bk -words
+.Op Fl l Ar lines
+.Ek
+.Bk -words
+.Op Fl o Ar offset
+.Ek
+.Bk -words
+.Oo
+.Op Fl s
+.Op Ar char
+.Oc
+.Ek
+.Bk -words
+.Oo
+.Op Fl n
+.Op Ar char
+.Op Ar width
+.Oc
+.Ek
+.Bk -words
+.Op Fl w Ar width
+.Ek
+.Op -
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility is a printing and pagination filter for text files.
+When multiple input files are specified, each is read, formatted,
+and written to standard output.
+By default, the input is separated into 66-line pages, each with
+.Bl -bullet
+.It
+A 5-line header with the page number, date, time, and
+the pathname of the file.
+.It
+A 5-line trailer consisting of blank lines.
+.El
+.Pp
+If standard output is associated with a terminal,
+diagnostic messages are suppressed until the
+.Nm
+utility has completed processing.
+.Pp
+When multiple column output is specified,
+text columns are of equal width.
+By default text columns are separated by at least one
+.Em <blank> .
+Input lines that do not fit into a text column are truncated.
+Lines are not truncated under single column output.
+.Sh OPTIONS
+In the following option descriptions, column, lines, offset, page, and
+width are positive decimal integers and gap is a nonnegative decimal integer.
+.Bl -tag -width 4n
+.It Ar \&+page
+Begin output at page number
+.Ar page
+of the formatted input.
+.It Fl Ar column
+Produce output that is
+.Ar columns
+wide (default is 1) that is written vertically
+down each column in the order in which the text
+is received from the input file.
+The options
+.Fl e
+and
+.Fl i
+are assumed.
+This option should not be used with
+.Fl m .
+When used with
+.Fl t ,
+the minimum number of lines is used to display the output.
+(To columnify and reshape text files more generally and without additional
+formatting, see the
+.Xr rs 1
+utility.)
+.It Fl a
+Modify the effect of the
+.Fl column
+option so that the columns are filled across the page in a round-robin order
+(e.g., when column is 2, the first input line heads column
+1, the second heads column 2, the third is the second line
+in column 1, etc.).
+This option requires the use of the
+.Fl column
+option.
+.It Fl d
+Produce output that is double spaced.
+An extra
+.Em <newline>
+character is output following every
+.Em <newline>
+found in the input.
+.It Fl e Xo
+.Op Ar char Ns
+.Op Ar gap
+.Xc
+Expand each input
+.Em <tab>
+to the next greater column
+position specified by the formula
+.Ar n*gap+1 ,
+where
+.Em n
+is an integer > 0.
+If
+.Ar gap
+is zero or is omitted the default is 8.
+All
+.Em <tab>
+characters in the input are expanded into the appropriate
+number of
+.Em <space>s .
+If any nondigit character,
+.Ar char ,
+is specified, it is used as the input tab character.
+.It Fl F
+Use a
+.Em <form-feed>
+character for new pages,
+instead of the default behavior that uses a
+sequence of
+.Em <newline>
+characters.
+.It Fl f
+Same as
+.Fl F
+but pause before beginning the first page if standard output is a terminal.
+.It Fl h Ar header
+Use the string
+.Ar header
+to replace the
+.Ar file name
+in the header line.
+.It Fl i Xo
+.Op Ar char Ns
+.Op Ar gap
+.Xc
+In output, replace multiple
+.Em <space>s
+with
+.Em <tab>s
+whenever two or more
+adjacent
+.Em <space>s
+reach column positions
+.Ar gap+1 ,
+.Ar 2*gap+1 ,
+etc.
+If
+.Ar gap
+is zero or omitted, default
+.Em <tab>
+settings at every eighth column position
+is used.
+If any nondigit character,
+.Ar char ,
+is specified, it is used as the output
+.Em <tab>
+character.
+.It Fl L Ar locale
+Use
+.Ar locale
+specified as argument instead of one found in environment.
+Use "C" to reset locale to default.
+.It Fl l Ar lines
+Override the 66 line default and reset the page length to
+.Ar lines .
+If
+.Ar lines
+is not greater than the sum of both the header and trailer
+depths (in lines), the
+.Nm
+utility suppresses output of both the header and trailer, as if the
+.Fl t
+option were in effect.
+.It Fl m
+Merge the contents of multiple files.
+One line from each file specified by a file operand is
+written side by side into text columns of equal fixed widths, in
+terms of the number of column positions.
+The number of text columns depends on the number of
+file operands successfully opened.
+The maximum number of files merged depends on page width and the
+per process open file limit.
+The options
+.Fl e
+and
+.Fl i
+are assumed.
+.It Fl n Xo
+.Op Ar char Ns
+.Op Ar width
+.Xc
+Provide
+.Ar width
+digit line numbering.
+The default for
+.Ar width ,
+if not specified, is 5.
+The number occupies the first
+.Ar width
+column positions of each text column or each line of
+.Fl m
+output.
+If
+.Ar char
+(any nondigit character) is given, it is appended to the line number to
+separate it from whatever follows.
+The default for
+.Ar char
+is a
+.Em <tab> .
+Line numbers longer than
+.Ar width
+columns are truncated.
+.It Fl o Ar offset
+Each line of output is preceded by
+.Ar offset
+.Em <spaces>s .
+If the
+.Fl o
+option is not specified, the default is zero.
+The space taken is in addition to the output line width.
+.It Fl p
+Pause before each page if the standard output is a terminal.
+.Nm
+will write an alert character to standard error and wait for a carriage
+return to be read on the terminal.
+.It Fl r
+Write no diagnostic reports on failure to open a file.
+.It Fl s Ar char
+Separate text columns by the single character
+.Ar char
+instead of by the appropriate number of
+.Em <space>s
+(default for
+.Ar char
+is the
+.Em <tab>
+character).
+.It Fl t
+Print neither the five-line identifying
+header nor the five-line trailer usually supplied for each page.
+Quit printing after the last line of each file without spacing to the
+end of the page.
+.It Fl w Ar width
+Set the width of the line to
+.Ar width
+column positions for multiple text-column output only.
+If the
+.Fl w
+option is not specified and the
+.Fl s
+option is not specified, the default width is 72.
+If the
+.Fl w
+option is not specified and the
+.Fl s
+option is specified, the default width is 512.
+.It Ar file
+A pathname of a file to be printed.
+If no
+.Ar file
+operands are specified, or if a
+.Ar file
+operand is
+.Sq Fl ,
+the standard input is used.
+The standard input is used only if no
+.Ar file
+operands are specified, or if a
+.Ar file
+operand is
+.Sq Fl .
+.El
+.Pp
+The
+.Fl s
+option does not allow the option letter to be separated from its
+argument, and the options
+.Fl e ,
+.Fl i ,
+and
+.Fl n
+require that both arguments, if present, not be separated from the option
+letter.
+.Sh EXIT STATUS
+.Ex -std
+.Sh DIAGNOSTICS
+If
+.Nm
+receives an interrupt while printing to a terminal, it
+flushes all accumulated error messages to the screen before
+terminating.
+.Pp
+Error messages are written to standard error during the printing
+process (if output is redirected) or after all successful
+file printing is complete (when printing to a terminal).
+.Sh SEE ALSO
+.Xr cat 1 ,
+.Xr more 1 ,
+.Xr rs 1
+.Sh STANDARDS
+The
+.Nm
+utility is
+.St -p1003.1-2001
+compatible.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
+.Sh BUGS
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c
new file mode 100644
index 0000000..947d768
--- /dev/null
+++ b/usr.bin/pr/pr.c
@@ -0,0 +1,1828 @@
+/*-
+ * Copyright (c) 1991 Keith Muller.
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Keith Muller of the University of California, San Diego.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)pr.c 8.2 (Berkeley) 4/16/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "pr.h"
+#include "extern.h"
+
+/*
+ * pr: a printing and pagination filter. If multiple input files
+ * are specified, each is read, formatted, and written to standard
+ * output. By default, input is separated into 66-line pages, each
+ * with a header that includes the page number, date, time and the
+ * files pathname.
+ *
+ * Complies with posix P1003.2/D11
+ */
+
+/*
+ * parameter variables
+ */
+static int pgnm; /* starting page number */
+static int clcnt; /* number of columns */
+static int colwd; /* column data width - multiple columns */
+static int across; /* mult col flag; write across page */
+static int dspace; /* double space flag */
+static char inchar; /* expand input char */
+static int ingap; /* expand input gap */
+static int pausefst; /* Pause before first page */
+static int pauseall; /* Pause before each page */
+static int formfeed; /* use formfeed as trailer */
+static char *header; /* header name instead of file name */
+static char ochar; /* contract output char */
+static int ogap; /* contract output gap */
+static int lines; /* number of lines per page */
+static int merge; /* merge multiple files in output */
+static char nmchar; /* line numbering append char */
+static int nmwd; /* width of line number field */
+static int offst; /* number of page offset spaces */
+static int nodiag; /* do not report file open errors */
+static char schar; /* text column separation character */
+static int sflag; /* -s option for multiple columns */
+static int nohead; /* do not write head and trailer */
+static int pgwd; /* page width with multiple col output */
+static const char *timefrmt; /* time conversion string */
+
+/*
+ * misc globals
+ */
+static FILE *err; /* error message file pointer */
+static int addone; /* page length is odd with double space */
+static int errcnt; /* error count on file processing */
+static char digs[] = "0123456789"; /* page number translation map */
+
+static char fnamedefault[] = FNAME;
+
+int
+main(int argc, char *argv[])
+{
+ int ret_val;
+
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGINT, terminate);
+ ret_val = setup(argc, argv);
+ if (!ret_val) {
+ /*
+ * select the output format based on options
+ */
+ if (merge)
+ ret_val = mulfile(argc, argv);
+ else if (clcnt == 1)
+ ret_val = onecol(argc, argv);
+ else if (across)
+ ret_val = horzcol(argc, argv);
+ else
+ ret_val = vertcol(argc, argv);
+ } else
+ usage();
+ flsh_errs();
+ if (errcnt || ret_val)
+ exit(1);
+ return(0);
+}
+
+/*
+ * Check if we should pause and write an alert character and wait for a
+ * carriage return on /dev/tty.
+ */
+static void
+ttypause(int pagecnt)
+{
+ int pch;
+ FILE *ttyfp;
+
+ if ((pauseall || (pausefst && pagecnt == 1)) &&
+ isatty(STDOUT_FILENO)) {
+ if ((ttyfp = fopen("/dev/tty", "r")) != NULL) {
+ (void)putc('\a', stderr);
+ while ((pch = getc(ttyfp)) != '\n' && pch != EOF)
+ ;
+ (void)fclose(ttyfp);
+ }
+ }
+}
+
+/*
+ * onecol: print files with only one column of output.
+ * Line length is unlimited.
+ */
+int
+onecol(int argc, char *argv[])
+{
+ int cnt = -1;
+ int off;
+ int lrgln;
+ int linecnt;
+ int num;
+ int lncnt;
+ int pagecnt;
+ int ips;
+ int ops;
+ int cps;
+ char *obuf;
+ char *lbuf;
+ char *nbuf;
+ char *hbuf;
+ char *ohbuf;
+ FILE *inf;
+ const char *fname;
+ int mor;
+
+ if (nmwd)
+ num = nmwd + 1;
+ else
+ num = 0;
+ off = num + offst;
+
+ /*
+ * allocate line buffer
+ */
+ if ((obuf = malloc((unsigned)(LBUF + off)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+ /*
+ * allocate header buffer
+ */
+ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ ohbuf = hbuf + offst;
+ nbuf = obuf + offst;
+ lbuf = nbuf + num;
+ if (num)
+ nbuf[--num] = nmchar;
+ if (offst) {
+ (void)memset(obuf, (int)' ', offst);
+ (void)memset(hbuf, (int)' ', offst);
+ }
+
+ /*
+ * loop by file
+ */
+ while ((inf = nxtfile(argc, argv, &fname, ohbuf, 0)) != NULL) {
+ if (pgnm) {
+ /*
+ * skip to specified page
+ */
+ if (inskip(inf, pgnm, lines))
+ continue;
+ pagecnt = pgnm;
+ } else
+ pagecnt = 1;
+ lncnt = 0;
+
+ /*
+ * loop by page
+ */
+ for(;;) {
+ linecnt = 0;
+ lrgln = 0;
+ ops = 0;
+ ips = 0;
+ cps = 0;
+
+ ttypause(pagecnt);
+
+ /*
+ * loop by line
+ */
+ while (linecnt < lines) {
+ /*
+ * input next line
+ */
+ if ((cnt = inln(inf,lbuf,LBUF,&cps,0,&mor)) < 0)
+ break;
+ if (!linecnt && !nohead &&
+ prhead(hbuf, fname, pagecnt))
+ return(1);
+
+ /*
+ * start of new line.
+ */
+ if (!lrgln) {
+ if (num)
+ addnum(nbuf, num, ++lncnt);
+ if (otln(obuf,cnt+off, &ips, &ops, mor))
+ return(1);
+ } else if (otln(lbuf, cnt, &ips, &ops, mor))
+ return(1);
+
+ /*
+ * if line bigger than buffer, get more
+ */
+ if (mor) {
+ lrgln = 1;
+ continue;
+ }
+
+ /*
+ * whole line rcvd. reset tab proc. state
+ */
+ ++linecnt;
+ lrgln = 0;
+ ops = 0;
+ ips = 0;
+ }
+
+ /*
+ * fill to end of page
+ */
+ if (linecnt && prtail(lines-linecnt-lrgln, lrgln))
+ return(1);
+
+ /*
+ * On EOF go to next file
+ */
+ if (cnt < 0)
+ break;
+ ++pagecnt;
+ }
+ if (inf != stdin)
+ (void)fclose(inf);
+ }
+ if (eoptind < argc)
+ return(1);
+ return(0);
+}
+
+/*
+ * vertcol: print files with more than one column of output down a page
+ */
+int
+vertcol(int argc, char *argv[])
+{
+ char *ptbf;
+ char **lstdat;
+ int i;
+ int j;
+ int cnt = -1;
+ int pln;
+ int *indy;
+ int cvc;
+ int *lindy;
+ int lncnt;
+ int stp;
+ int pagecnt;
+ int col = colwd + 1;
+ int mxlen = pgwd + offst + 1;
+ int mclcnt = clcnt - 1;
+ struct vcol *vc;
+ int mvc;
+ int tvc;
+ int cw = nmwd + 1;
+ int fullcol;
+ char *buf;
+ char *hbuf;
+ char *ohbuf;
+ const char *fname;
+ FILE *inf;
+ int ips = 0;
+ int cps = 0;
+ int ops = 0;
+ int mor = 0;
+
+ /*
+ * allocate page buffer
+ */
+ if ((buf = malloc((unsigned)lines*mxlen*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ /*
+ * allocate page header
+ */
+ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+ ohbuf = hbuf + offst;
+ if (offst)
+ (void)memset(hbuf, (int)' ', offst);
+
+ /*
+ * col pointers when no headers
+ */
+ mvc = lines * clcnt;
+ if ((vc =
+ (struct vcol *)malloc((unsigned)mvc*sizeof(struct vcol))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ /*
+ * pointer into page where last data per line is located
+ */
+ if ((lstdat = (char **)malloc((unsigned)lines*sizeof(char *))) == NULL){
+ mfail();
+ return(1);
+ }
+
+ /*
+ * fast index lookups to locate start of lines
+ */
+ if ((indy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) {
+ mfail();
+ return(1);
+ }
+ if ((lindy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ if (nmwd)
+ fullcol = col + cw;
+ else
+ fullcol = col;
+
+ /*
+ * initialize buffer lookup indexes and offset area
+ */
+ for (j = 0; j < lines; ++j) {
+ lindy[j] = j * mxlen;
+ indy[j] = lindy[j] + offst;
+ if (offst) {
+ ptbf = buf + lindy[j];
+ (void)memset(ptbf, (int)' ', offst);
+ ptbf += offst;
+ } else
+ ptbf = buf + indy[j];
+ lstdat[j] = ptbf;
+ }
+
+ /*
+ * loop by file
+ */
+ while ((inf = nxtfile(argc, argv, &fname, ohbuf, 0)) != NULL) {
+ if (pgnm) {
+ /*
+ * skip to requested page
+ */
+ if (inskip(inf, pgnm, lines))
+ continue;
+ pagecnt = pgnm;
+ } else
+ pagecnt = 1;
+ lncnt = 0;
+
+ /*
+ * loop by page
+ */
+ for(;;) {
+ ttypause(pagecnt);
+
+ /*
+ * loop by column
+ */
+ cvc = 0;
+ for (i = 0; i < clcnt; ++i) {
+ j = 0;
+ /*
+ * if last column, do not pad
+ */
+ if (i == mclcnt)
+ stp = 1;
+ else
+ stp = 0;
+ /*
+ * loop by line
+ */
+ for(;;) {
+ /*
+ * is this first column
+ */
+ if (!i) {
+ ptbf = buf + indy[j];
+ lstdat[j] = ptbf;
+ } else
+ ptbf = lstdat[j];
+ vc[cvc].pt = ptbf;
+
+ /*
+ * add number
+ */
+ if (nmwd) {
+ addnum(ptbf, nmwd, ++lncnt);
+ ptbf += nmwd;
+ *ptbf++ = nmchar;
+ }
+
+ /*
+ * input next line
+ */
+ cnt = inln(inf,ptbf,colwd,&cps,1,&mor);
+ vc[cvc++].cnt = cnt;
+ if (cnt < 0)
+ break;
+ ptbf += cnt;
+
+ /*
+ * pad all but last column on page
+ */
+ if (!stp) {
+ /*
+ * pad to end of column
+ */
+ if (sflag)
+ *ptbf++ = schar;
+ else if ((pln = col-cnt) > 0) {
+ (void)memset(ptbf,
+ (int)' ',pln);
+ ptbf += pln;
+ }
+ }
+ /*
+ * remember last char in line
+ */
+ lstdat[j] = ptbf;
+ if (++j >= lines)
+ break;
+ }
+ if (cnt < 0)
+ break;
+ }
+
+ /*
+ * when -t (no header) is specified the spec requires
+ * the min number of lines. The last page may not have
+ * balanced length columns. To fix this we must reorder
+ * the columns. This is a very slow technique so it is
+ * only used under limited conditions. Without -t, the
+ * balancing of text columns is unspecified. To NOT
+ * balance the last page, add the global variable
+ * nohead to the if statement below e.g.
+ *
+ * if ((cnt < 0) && nohead && cvc ......
+ */
+ --cvc;
+
+ /*
+ * check to see if last page needs to be reordered
+ */
+ if ((cnt < 0) && cvc && ((mvc-cvc) >= clcnt)){
+ pln = cvc/clcnt;
+ if (cvc % clcnt)
+ ++pln;
+
+ /*
+ * print header
+ */
+ if (!nohead && prhead(hbuf, fname, pagecnt))
+ return(1);
+ for (i = 0; i < pln; ++i) {
+ ips = 0;
+ ops = 0;
+ if (offst&& otln(buf,offst,&ips,&ops,1))
+ return(1);
+ tvc = i;
+
+ for (j = 0; j < clcnt; ++j) {
+ /*
+ * determine column length
+ */
+ if (j == mclcnt) {
+ /*
+ * last column
+ */
+ cnt = vc[tvc].cnt;
+ if (nmwd)
+ cnt += cw;
+ } else if (sflag) {
+ /*
+ * single ch between
+ */
+ cnt = vc[tvc].cnt + 1;
+ if (nmwd)
+ cnt += cw;
+ } else
+ cnt = fullcol;
+ if (otln(vc[tvc].pt, cnt, &ips,
+ &ops, 1))
+ return(1);
+ tvc += pln;
+ if (tvc >= cvc)
+ break;
+ }
+ /*
+ * terminate line
+ */
+ if (otln(buf, 0, &ips, &ops, 0))
+ return(1);
+ }
+ /*
+ * pad to end of page
+ */
+ if (prtail((lines - pln), 0))
+ return(1);
+ /*
+ * done with output, go to next file
+ */
+ break;
+ }
+
+ /*
+ * determine how many lines to output
+ */
+ if (i > 0)
+ pln = lines;
+ else
+ pln = j;
+
+ /*
+ * print header
+ */
+ if (pln && !nohead && prhead(hbuf, fname, pagecnt))
+ return(1);
+
+ /*
+ * output each line
+ */
+ for (i = 0; i < pln; ++i) {
+ ptbf = buf + lindy[i];
+ if ((j = lstdat[i] - ptbf) <= offst)
+ break;
+ if (otln(ptbf, j, &ips, &ops, 0))
+ return(1);
+ }
+
+ /*
+ * pad to end of page
+ */
+ if (pln && prtail((lines - pln), 0))
+ return(1);
+
+ /*
+ * if EOF go to next file
+ */
+ if (cnt < 0)
+ break;
+ ++pagecnt;
+ }
+ if (inf != stdin)
+ (void)fclose(inf);
+ }
+ if (eoptind < argc)
+ return(1);
+ return(0);
+}
+
+/*
+ * horzcol: print files with more than one column of output across a page
+ */
+int
+horzcol(int argc, char *argv[])
+{
+ char *ptbf;
+ int pln;
+ int cnt = -1;
+ char *lstdat;
+ int col = colwd + 1;
+ int j;
+ int i;
+ int lncnt;
+ int pagecnt;
+ char *buf;
+ char *hbuf;
+ char *ohbuf;
+ const char *fname;
+ FILE *inf;
+ int ips = 0;
+ int cps = 0;
+ int ops = 0;
+ int mor = 0;
+
+ if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ /*
+ * page header
+ */
+ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+ ohbuf = hbuf + offst;
+ if (offst) {
+ (void)memset(buf, (int)' ', offst);
+ (void)memset(hbuf, (int)' ', offst);
+ }
+
+ /*
+ * loop by file
+ */
+ while ((inf = nxtfile(argc, argv, &fname, ohbuf, 0)) != NULL) {
+ if (pgnm) {
+ if (inskip(inf, pgnm, lines))
+ continue;
+ pagecnt = pgnm;
+ } else
+ pagecnt = 1;
+ lncnt = 0;
+
+ /*
+ * loop by page
+ */
+ for(;;) {
+ ttypause(pagecnt);
+
+ /*
+ * loop by line
+ */
+ for (i = 0; i < lines; ++i) {
+ ptbf = buf + offst;
+ lstdat = ptbf;
+ j = 0;
+ /*
+ * loop by col
+ */
+ for(;;) {
+ if (nmwd) {
+ /*
+ * add number to column
+ */
+ addnum(ptbf, nmwd, ++lncnt);
+ ptbf += nmwd;
+ *ptbf++ = nmchar;
+ }
+ /*
+ * input line
+ */
+ if ((cnt = inln(inf,ptbf,colwd,&cps,1,
+ &mor)) < 0)
+ break;
+ ptbf += cnt;
+ lstdat = ptbf;
+
+ /*
+ * if last line skip padding
+ */
+ if (++j >= clcnt)
+ break;
+
+ /*
+ * pad to end of column
+ */
+ if (sflag)
+ *ptbf++ = schar;
+ else if ((pln = col - cnt) > 0) {
+ (void)memset(ptbf,(int)' ',pln);
+ ptbf += pln;
+ }
+ }
+
+ /*
+ * determine line length
+ */
+ if ((j = lstdat - buf) <= offst)
+ break;
+ if (!i && !nohead &&
+ prhead(hbuf, fname, pagecnt))
+ return(1);
+ /*
+ * output line
+ */
+ if (otln(buf, j, &ips, &ops, 0))
+ return(1);
+ }
+
+ /*
+ * pad to end of page
+ */
+ if (i && prtail(lines-i, 0))
+ return(1);
+
+ /*
+ * if EOF go to next file
+ */
+ if (cnt < 0)
+ break;
+ ++pagecnt;
+ }
+ if (inf != stdin)
+ (void)fclose(inf);
+ }
+ if (eoptind < argc)
+ return(1);
+ return(0);
+}
+
+/*
+ * mulfile: print files with more than one column of output and
+ * more than one file concurrently
+ */
+int
+mulfile(int argc, char *argv[])
+{
+ char *ptbf;
+ int j;
+ int pln;
+ int cnt;
+ char *lstdat;
+ int i;
+ FILE **fbuf;
+ int actf;
+ int lncnt;
+ int col;
+ int pagecnt;
+ int fproc;
+ char *buf;
+ char *hbuf;
+ char *ohbuf;
+ const char *fname;
+ int ips = 0;
+ int cps = 0;
+ int ops = 0;
+ int mor = 0;
+
+ /*
+ * array of FILE *, one for each operand
+ */
+ if ((fbuf = (FILE **)malloc((unsigned)clcnt*sizeof(FILE *))) == NULL) {
+ mfail();
+ return(1);
+ }
+
+ /*
+ * page header
+ */
+ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+ ohbuf = hbuf + offst;
+
+ /*
+ * do not know how many columns yet. The number of operands provide an
+ * upper bound on the number of columns. We use the number of files
+ * we can open successfully to set the number of columns. The operation
+ * of the merge operation (-m) in relation to unsuccessful file opens
+ * is unspecified by posix.
+ */
+ j = 0;
+ while (j < clcnt) {
+ if ((fbuf[j] = nxtfile(argc, argv, &fname, ohbuf, 1)) == NULL)
+ break;
+ if (pgnm && (inskip(fbuf[j], pgnm, lines)))
+ fbuf[j] = NULL;
+ ++j;
+ }
+
+ /*
+ * if no files, exit
+ */
+ if (!j)
+ return(1);
+
+ /*
+ * calculate page boundaries based on open file count
+ */
+ clcnt = j;
+ if (nmwd) {
+ colwd = (pgwd - clcnt - nmwd)/clcnt;
+ pgwd = ((colwd + 1) * clcnt) - nmwd - 2;
+ } else {
+ colwd = (pgwd + 1 - clcnt)/clcnt;
+ pgwd = ((colwd + 1) * clcnt) - 1;
+ }
+ if (colwd < 1) {
+ (void)fprintf(err,
+ "pr: page width too small for %d columns\n", clcnt);
+ return(1);
+ }
+ actf = clcnt;
+ col = colwd + 1;
+
+ /*
+ * line buffer
+ */
+ if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) {
+ mfail();
+ return(1);
+ }
+ if (offst) {
+ (void)memset(buf, (int)' ', offst);
+ (void)memset(hbuf, (int)' ', offst);
+ }
+ if (pgnm)
+ pagecnt = pgnm;
+ else
+ pagecnt = 1;
+ lncnt = 0;
+
+ /*
+ * continue to loop while any file still has data
+ */
+ while (actf > 0) {
+ ttypause(pagecnt);
+
+ /*
+ * loop by line
+ */
+ for (i = 0; i < lines; ++i) {
+ ptbf = buf + offst;
+ lstdat = ptbf;
+ if (nmwd) {
+ /*
+ * add line number to line
+ */
+ addnum(ptbf, nmwd, ++lncnt);
+ ptbf += nmwd;
+ *ptbf++ = nmchar;
+ }
+ j = 0;
+ fproc = 0;
+
+ /*
+ * loop by column
+ */
+ for (j = 0; j < clcnt; ++j) {
+ if (fbuf[j] == NULL) {
+ /*
+ * empty column; EOF
+ */
+ cnt = 0;
+ } else if ((cnt = inln(fbuf[j], ptbf, colwd,
+ &cps, 1, &mor)) < 0) {
+ /*
+ * EOF hit; no data
+ */
+ if (fbuf[j] != stdin)
+ (void)fclose(fbuf[j]);
+ fbuf[j] = NULL;
+ --actf;
+ cnt = 0;
+ } else {
+ /*
+ * process file data
+ */
+ ptbf += cnt;
+ lstdat = ptbf;
+ fproc++;
+ }
+
+ /*
+ * if last ACTIVE column, done with line
+ */
+ if (fproc >= actf)
+ break;
+
+ /*
+ * pad to end of column
+ */
+ if (sflag) {
+ *ptbf++ = schar;
+ } else if ((pln = col - cnt) > 0) {
+ (void)memset(ptbf, (int)' ', pln);
+ ptbf += pln;
+ }
+ }
+
+ /*
+ * calculate data in line
+ */
+ if ((j = lstdat - buf) <= offst)
+ break;
+
+ if (!i && !nohead && prhead(hbuf, fname, pagecnt))
+ return(1);
+
+ /*
+ * output line
+ */
+ if (otln(buf, j, &ips, &ops, 0))
+ return(1);
+
+ /*
+ * if no more active files, done
+ */
+ if (actf <= 0) {
+ ++i;
+ break;
+ }
+ }
+
+ /*
+ * pad to end of page
+ */
+ if (i && prtail(lines-i, 0))
+ return(1);
+ ++pagecnt;
+ }
+ if (eoptind < argc)
+ return(1);
+ return(0);
+}
+
+/*
+ * inln(): input a line of data (unlimited length lines supported)
+ * Input is optionally expanded to spaces
+ *
+ * inf: file
+ * buf: buffer
+ * lim: buffer length
+ * cps: column position 1st char in buffer (large line support)
+ * trnc: throw away data more than lim up to \n
+ * mor: set if more data in line (not truncated)
+ */
+int
+inln(FILE *inf, char *buf, int lim, int *cps, int trnc, int *mor)
+{
+ int col;
+ int gap = ingap;
+ int ch = EOF;
+ char *ptbuf;
+ int chk = (int)inchar;
+
+ ptbuf = buf;
+
+ if (gap) {
+ /*
+ * expanding input option
+ */
+ while ((--lim >= 0) && ((ch = getc(inf)) != EOF)) {
+ /*
+ * is this the input "tab" char
+ */
+ if (ch == chk) {
+ /*
+ * expand to number of spaces
+ */
+ col = (ptbuf - buf) + *cps;
+ col = gap - (col % gap);
+
+ /*
+ * if more than this line, push back
+ */
+ if ((col > lim) && (ungetc(ch, inf) == EOF))
+ return(1);
+
+ /*
+ * expand to spaces
+ */
+ while ((--col >= 0) && (--lim >= 0))
+ *ptbuf++ = ' ';
+ continue;
+ }
+ if (ch == '\n')
+ break;
+ *ptbuf++ = ch;
+ }
+ } else {
+ /*
+ * no expansion
+ */
+ while ((--lim >= 0) && ((ch = getc(inf)) != EOF)) {
+ if (ch == '\n')
+ break;
+ *ptbuf++ = ch;
+ }
+ }
+ col = ptbuf - buf;
+ if (ch == EOF) {
+ *mor = 0;
+ *cps = 0;
+ if (!col)
+ return(-1);
+ return(col);
+ }
+ if (ch == '\n') {
+ /*
+ * entire line processed
+ */
+ *mor = 0;
+ *cps = 0;
+ return(col);
+ }
+
+ /*
+ * line was larger than limit
+ */
+ if (trnc) {
+ /*
+ * throw away rest of line
+ */
+ while ((ch = getc(inf)) != EOF) {
+ if (ch == '\n')
+ break;
+ }
+ *cps = 0;
+ *mor = 0;
+ } else {
+ /*
+ * save column offset if not truncated
+ */
+ *cps += col;
+ *mor = 1;
+ }
+
+ return(col);
+}
+
+/*
+ * otln(): output a line of data. (Supports unlimited length lines)
+ * output is optionally contracted to tabs
+ *
+ * buf: output buffer with data
+ * cnt: number of chars of valid data in buf
+ * svips: buffer input column position (for large lines)
+ * svops: buffer output column position (for large lines)
+ * mor: output line not complete in this buf; more data to come.
+ * 1 is more, 0 is complete, -1 is no \n's
+ */
+int
+otln(char *buf, int cnt, int *svips, int *svops, int mor)
+{
+ int ops; /* last col output */
+ int ips; /* last col in buf examined */
+ int gap = ogap;
+ int tbps;
+ char *endbuf;
+
+ if (ogap) {
+ /*
+ * contracting on output
+ */
+ endbuf = buf + cnt;
+ ops = *svops;
+ ips = *svips;
+ while (buf < endbuf) {
+ /*
+ * count number of spaces and ochar in buffer
+ */
+ if (*buf == ' ') {
+ ++ips;
+ ++buf;
+ continue;
+ }
+
+ /*
+ * simulate ochar processing
+ */
+ if (*buf == ochar) {
+ ips += gap - (ips % gap);
+ ++buf;
+ continue;
+ }
+
+ /*
+ * got a non space char; contract out spaces
+ */
+ while (ips - ops > 1) {
+ /*
+ * use as many ochar as will fit
+ */
+ if ((tbps = ops + gap - (ops % gap)) > ips)
+ break;
+ if (putchar(ochar) == EOF) {
+ pfail();
+ return(1);
+ }
+ ops = tbps;
+ }
+
+ while (ops < ips) {
+ /*
+ * finish off with spaces
+ */
+ if (putchar(' ') == EOF) {
+ pfail();
+ return(1);
+ }
+ ++ops;
+ }
+
+ /*
+ * output non space char
+ */
+ if (putchar(*buf++) == EOF) {
+ pfail();
+ return(1);
+ }
+ ++ips;
+ ++ops;
+ }
+
+ if (mor > 0) {
+ /*
+ * if incomplete line, save position counts
+ */
+ *svops = ops;
+ *svips = ips;
+ return(0);
+ }
+
+ if (mor < 0) {
+ while (ips - ops > 1) {
+ /*
+ * use as many ochar as will fit
+ */
+ if ((tbps = ops + gap - (ops % gap)) > ips)
+ break;
+ if (putchar(ochar) == EOF) {
+ pfail();
+ return(1);
+ }
+ ops = tbps;
+ }
+ while (ops < ips) {
+ /*
+ * finish off with spaces
+ */
+ if (putchar(' ') == EOF) {
+ pfail();
+ return(1);
+ }
+ ++ops;
+ }
+ return(0);
+ }
+ } else {
+ /*
+ * output is not contracted
+ */
+ if (cnt && (fwrite(buf, sizeof(char), cnt, stdout) <= 0)) {
+ pfail();
+ return(1);
+ }
+ if (mor != 0)
+ return(0);
+ }
+
+ /*
+ * process line end and double space as required
+ */
+ if ((putchar('\n') == EOF) || (dspace && (putchar('\n') == EOF))) {
+ pfail();
+ return(1);
+ }
+ return(0);
+}
+
+/*
+ * inskip(): skip over pgcnt pages with lncnt lines per page
+ * file is closed at EOF (if not stdin).
+ *
+ * inf FILE * to read from
+ * pgcnt number of pages to skip
+ * lncnt number of lines per page
+ */
+int
+inskip(FILE *inf, int pgcnt, int lncnt)
+{
+ int c;
+ int cnt;
+
+ while(--pgcnt > 0) {
+ cnt = lncnt;
+ while ((c = getc(inf)) != EOF) {
+ if ((c == '\n') && (--cnt == 0))
+ break;
+ }
+ if (c == EOF) {
+ if (inf != stdin)
+ (void)fclose(inf);
+ return(1);
+ }
+ }
+ return(0);
+}
+
+/*
+ * nxtfile: returns a FILE * to next file in arg list and sets the
+ * time field for this file (or current date).
+ *
+ * buf array to store proper date for the header.
+ * dt if set skips the date processing (used with -m)
+ */
+FILE *
+nxtfile(int argc, char **argv, const char **fname, char *buf, int dt)
+{
+ FILE *inf = NULL;
+ time_t tv_sec;
+ struct tm *timeptr = NULL;
+ struct stat statbuf;
+ static int twice = -1;
+
+ ++twice;
+ if (eoptind >= argc) {
+ /*
+ * no file listed; default, use standard input
+ */
+ if (twice)
+ return(NULL);
+ clearerr(stdin);
+ inf = stdin;
+ if (header != NULL)
+ *fname = header;
+ else
+ *fname = fnamedefault;
+ if (nohead)
+ return(inf);
+ if ((tv_sec = time(NULL)) == -1) {
+ ++errcnt;
+ (void)fprintf(err, "pr: cannot get time of day, %s\n",
+ strerror(errno));
+ eoptind = argc - 1;
+ return(NULL);
+ }
+ timeptr = localtime(&tv_sec);
+ }
+ for (; eoptind < argc; ++eoptind) {
+ if (strcmp(argv[eoptind], "-") == 0) {
+ /*
+ * process a "-" for filename
+ */
+ clearerr(stdin);
+ inf = stdin;
+ if (header != NULL)
+ *fname = header;
+ else
+ *fname = fnamedefault;
+ ++eoptind;
+ if (nohead || (dt && twice))
+ return(inf);
+ if ((tv_sec = time(NULL)) == -1) {
+ ++errcnt;
+ (void)fprintf(err,
+ "pr: cannot get time of day, %s\n",
+ strerror(errno));
+ return(NULL);
+ }
+ timeptr = localtime(&tv_sec);
+ } else {
+ /*
+ * normal file processing
+ */
+ if ((inf = fopen(argv[eoptind], "r")) == NULL) {
+ ++errcnt;
+ if (nodiag)
+ continue;
+ (void)fprintf(err, "pr: cannot open %s, %s\n",
+ argv[eoptind], strerror(errno));
+ continue;
+ }
+ if (header != NULL)
+ *fname = header;
+ else if (dt)
+ *fname = fnamedefault;
+ else
+ *fname = argv[eoptind];
+ ++eoptind;
+ if (nohead || (dt && twice))
+ return(inf);
+
+ if (dt) {
+ if ((tv_sec = time(NULL)) == -1) {
+ ++errcnt;
+ (void)fprintf(err,
+ "pr: cannot get time of day, %s\n",
+ strerror(errno));
+ return(NULL);
+ }
+ timeptr = localtime(&tv_sec);
+ } else {
+ if (fstat(fileno(inf), &statbuf) < 0) {
+ ++errcnt;
+ (void)fclose(inf);
+ (void)fprintf(err,
+ "pr: cannot stat %s, %s\n",
+ argv[eoptind], strerror(errno));
+ return(NULL);
+ }
+ timeptr = localtime(&(statbuf.st_mtime));
+ }
+ }
+ break;
+ }
+ if (inf == NULL)
+ return(NULL);
+
+ /*
+ * set up time field used in header
+ */
+ if (strftime(buf, HDBUF, timefrmt, timeptr) <= 0) {
+ ++errcnt;
+ if (inf != stdin)
+ (void)fclose(inf);
+ (void)fputs("pr: time conversion failed\n", err);
+ return(NULL);
+ }
+ return(inf);
+}
+
+/*
+ * addnum(): adds the line number to the column
+ * Truncates from the front or pads with spaces as required.
+ * Numbers are right justified.
+ *
+ * buf buffer to store the number
+ * wdth width of buffer to fill
+ * line line number
+ *
+ * NOTE: numbers occupy part of the column. The posix
+ * spec does not specify if -i processing should or should not
+ * occur on number padding. The spec does say it occupies
+ * part of the column. The usage of addnum currently treats
+ * numbers as part of the column so spaces may be replaced.
+ */
+void
+addnum(char *buf, int wdth, int line)
+{
+ char *pt = buf + wdth;
+
+ do {
+ *--pt = digs[line % 10];
+ line /= 10;
+ } while (line && (pt > buf));
+
+ /*
+ * pad with space as required
+ */
+ while (pt > buf)
+ *--pt = ' ';
+}
+
+/*
+ * prhead(): prints the top of page header
+ *
+ * buf buffer with time field (and offset)
+ * cnt number of chars in buf
+ * fname fname field for header
+ * pagcnt page number
+ */
+int
+prhead(char *buf, const char *fname, int pagcnt)
+{
+ int ips = 0;
+ int ops = 0;
+
+ if ((putchar('\n') == EOF) || (putchar('\n') == EOF)) {
+ pfail();
+ return(1);
+ }
+ /*
+ * posix is not clear if the header is subject to line length
+ * restrictions. The specification for header line format
+ * in the spec clearly does not limit length. No pr currently
+ * restricts header length. However if we need to truncate in
+ * a reasonable way, adjust the length of the printf by
+ * changing HDFMT to allow a length max as an argument to printf.
+ * buf (which contains the offset spaces and time field could
+ * also be trimmed
+ *
+ * note only the offset (if any) is processed for tab expansion
+ */
+ if (offst && otln(buf, offst, &ips, &ops, -1))
+ return(1);
+ (void)printf(HDFMT,buf+offst, fname, pagcnt);
+ return(0);
+}
+
+/*
+ * prtail(): pad page with empty lines (if required) and print page trailer
+ * if requested
+ *
+ * cnt number of lines of padding needed
+ * incomp was a '\n' missing from last line output
+ */
+int
+prtail(int cnt, int incomp)
+{
+ if (nohead) {
+ /*
+ * only pad with no headers when incomplete last line
+ */
+ if (incomp &&
+ ((dspace && (putchar('\n') == EOF)) ||
+ (putchar('\n') == EOF))) {
+ pfail();
+ return(1);
+ }
+ /*
+ * but honor the formfeed request
+ */
+ if (formfeed) {
+ if (putchar('\f') == EOF) {
+ pfail();
+ return(1);
+ }
+ }
+ return(0);
+ }
+ /*
+ * if double space output two \n
+ */
+ if (dspace)
+ cnt *= 2;
+
+ /*
+ * if an odd number of lines per page, add an extra \n
+ */
+ if (addone)
+ ++cnt;
+
+ /*
+ * pad page
+ */
+ if (formfeed) {
+ if ((incomp && (putchar('\n') == EOF)) ||
+ (putchar('\f') == EOF)) {
+ pfail();
+ return(1);
+ }
+ return(0);
+ }
+ cnt += TAILLEN;
+ while (--cnt >= 0) {
+ if (putchar('\n') == EOF) {
+ pfail();
+ return(1);
+ }
+ }
+ return(0);
+}
+
+/*
+ * terminate(): when a SIGINT is recvd
+ */
+void
+terminate(int which_sig __unused)
+{
+ flsh_errs();
+ exit(1);
+}
+
+
+/*
+ * flsh_errs(): output saved up diagnostic messages after all normal
+ * processing has completed
+ */
+void
+flsh_errs(void)
+{
+ char buf[BUFSIZ];
+
+ (void)fflush(stdout);
+ (void)fflush(err);
+ if (err == stderr)
+ return;
+ rewind(err);
+ while (fgets(buf, BUFSIZ, err) != NULL)
+ (void)fputs(buf, stderr);
+}
+
+void
+mfail(void)
+{
+ (void)fputs("pr: memory allocation failed\n", err);
+}
+
+void
+pfail(void)
+{
+ (void)fprintf(err, "pr: write failure, %s\n", strerror(errno));
+}
+
+void
+usage(void)
+{
+ (void)fputs(
+ "usage: pr [+page] [-col] [-adFfmprt] [-e[ch][gap]] [-h header]\n",
+ err);
+ (void)fputs(
+ " [-i[ch][gap]] [-l line] [-n[ch][width]] [-o offset]\n",err);
+ (void)fputs(
+ " [-L locale] [-s[ch]] [-w width] [-] [file ...]\n", err);
+}
+
+/*
+ * setup: Validate command args, initialize and perform sanity
+ * checks on options
+ */
+int
+setup(int argc, char *argv[])
+{
+ int c;
+ int d_first;
+ int eflag = 0;
+ int iflag = 0;
+ int wflag = 0;
+ int cflag = 0;
+ char *Lflag = NULL;
+
+ if (isatty(fileno(stdout))) {
+ /*
+ * defer diagnostics until processing is done
+ */
+ if ((err = tmpfile()) == NULL) {
+ err = stderr;
+ (void)fputs("Cannot defer diagnostic messages\n",stderr);
+ return(1);
+ }
+ } else
+ err = stderr;
+ while ((c = egetopt(argc, argv, "#adFfmrte?h:i?L:l:n?o:ps?w:")) != -1) {
+ switch (c) {
+ case '+':
+ if ((pgnm = atoi(eoptarg)) < 1) {
+ (void)fputs("pr: +page number must be 1 or more\n",
+ err);
+ return(1);
+ }
+ break;
+ case '-':
+ if ((clcnt = atoi(eoptarg)) < 1) {
+ (void)fputs("pr: -columns must be 1 or more\n",err);
+ return(1);
+ }
+ if (clcnt > 1)
+ ++cflag;
+ break;
+ case 'a':
+ ++across;
+ break;
+ case 'd':
+ ++dspace;
+ break;
+ case 'e':
+ ++eflag;
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
+ inchar = *eoptarg++;
+ else
+ inchar = INCHAR;
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
+ if ((ingap = atoi(eoptarg)) < 0) {
+ (void)fputs(
+ "pr: -e gap must be 0 or more\n", err);
+ return(1);
+ }
+ if (ingap == 0)
+ ingap = INGAP;
+ } else if ((eoptarg != NULL) && (*eoptarg != '\0')) {
+ (void)fprintf(err,
+ "pr: invalid value for -e %s\n", eoptarg);
+ return(1);
+ } else
+ ingap = INGAP;
+ break;
+ case 'f':
+ ++pausefst;
+ /*FALLTHROUGH*/
+ case 'F':
+ ++formfeed;
+ break;
+ case 'h':
+ header = eoptarg;
+ break;
+ case 'i':
+ ++iflag;
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
+ ochar = *eoptarg++;
+ else
+ ochar = OCHAR;
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
+ if ((ogap = atoi(eoptarg)) < 0) {
+ (void)fputs(
+ "pr: -i gap must be 0 or more\n", err);
+ return(1);
+ }
+ if (ogap == 0)
+ ogap = OGAP;
+ } else if ((eoptarg != NULL) && (*eoptarg != '\0')) {
+ (void)fprintf(err,
+ "pr: invalid value for -i %s\n", eoptarg);
+ return(1);
+ } else
+ ogap = OGAP;
+ break;
+ case 'L':
+ Lflag = eoptarg;
+ break;
+ case 'l':
+ if (!isdigit((unsigned char)*eoptarg) || ((lines=atoi(eoptarg)) < 1)) {
+ (void)fputs(
+ "pr: number of lines must be 1 or more\n",err);
+ return(1);
+ }
+ break;
+ case 'm':
+ ++merge;
+ break;
+ case 'n':
+ if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
+ nmchar = *eoptarg++;
+ else
+ nmchar = NMCHAR;
+ if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
+ if ((nmwd = atoi(eoptarg)) < 1) {
+ (void)fputs(
+ "pr: -n width must be 1 or more\n",err);
+ return(1);
+ }
+ } else if ((eoptarg != NULL) && (*eoptarg != '\0')) {
+ (void)fprintf(err,
+ "pr: invalid value for -n %s\n", eoptarg);
+ return(1);
+ } else
+ nmwd = NMWD;
+ break;
+ case 'o':
+ if (!isdigit((unsigned char)*eoptarg) || ((offst = atoi(eoptarg))< 1)){
+ (void)fputs("pr: -o offset must be 1 or more\n",
+ err);
+ return(1);
+ }
+ break;
+ case 'p':
+ ++pauseall;
+ break;
+ case 'r':
+ ++nodiag;
+ break;
+ case 's':
+ ++sflag;
+ if (eoptarg == NULL)
+ schar = SCHAR;
+ else {
+ schar = *eoptarg++;
+ if (*eoptarg != '\0') {
+ (void)fprintf(err,
+ "pr: invalid value for -s %s\n",
+ eoptarg);
+ return(1);
+ }
+ }
+ break;
+ case 't':
+ ++nohead;
+ break;
+ case 'w':
+ ++wflag;
+ if (!isdigit((unsigned char)*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){
+ (void)fputs(
+ "pr: -w width must be 1 or more \n",err);
+ return(1);
+ }
+ break;
+ case '?':
+ default:
+ return(1);
+ }
+ }
+
+ /*
+ * default and sanity checks
+ */
+ if (!clcnt) {
+ if (merge) {
+ if ((clcnt = argc - eoptind) <= 1) {
+ clcnt = CLCNT;
+ merge = 0;
+ }
+ } else
+ clcnt = CLCNT;
+ }
+ if (across) {
+ if (clcnt == 1) {
+ (void)fputs("pr: -a flag requires multiple columns\n",
+ err);
+ return(1);
+ }
+ if (merge) {
+ (void)fputs("pr: -m cannot be used with -a\n", err);
+ return(1);
+ }
+ }
+ if (!wflag) {
+ if (sflag)
+ pgwd = SPGWD;
+ else
+ pgwd = PGWD;
+ }
+ if (cflag || merge) {
+ if (!eflag) {
+ inchar = INCHAR;
+ ingap = INGAP;
+ }
+ if (!iflag) {
+ ochar = OCHAR;
+ ogap = OGAP;
+ }
+ }
+ if (cflag) {
+ if (merge) {
+ (void)fputs(
+ "pr: -m cannot be used with multiple columns\n", err);
+ return(1);
+ }
+ if (nmwd) {
+ colwd = (pgwd + 1 - (clcnt * (nmwd + 2)))/clcnt;
+ pgwd = ((colwd + nmwd + 2) * clcnt) - 1;
+ } else {
+ colwd = (pgwd + 1 - clcnt)/clcnt;
+ pgwd = ((colwd + 1) * clcnt) - 1;
+ }
+ if (colwd < 1) {
+ (void)fprintf(err,
+ "pr: page width is too small for %d columns\n",clcnt);
+ return(1);
+ }
+ }
+ if (!lines)
+ lines = LINES;
+
+ /*
+ * make sure long enough for headers. if not disable
+ */
+ if (lines <= HEADLEN + TAILLEN)
+ ++nohead;
+ else if (!nohead)
+ lines -= HEADLEN + TAILLEN;
+
+ /*
+ * adjust for double space on odd length pages
+ */
+ if (dspace) {
+ if (lines == 1)
+ dspace = 0;
+ else {
+ if (lines & 1)
+ ++addone;
+ lines /= 2;
+ }
+ }
+
+ (void) setlocale(LC_TIME, (Lflag != NULL) ? Lflag : "");
+
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+ timefrmt = strdup(d_first ? TIMEFMTD : TIMEFMTM);
+
+ return(0);
+}
diff --git a/usr.bin/pr/pr.h b/usr.bin/pr/pr.h
new file mode 100644
index 0000000..a4346c7
--- /dev/null
+++ b/usr.bin/pr/pr.h
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 1991 Keith Muller.
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Keith Muller of the University of California, San Diego.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ *
+ * @(#)pr.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+/*
+ * parameter defaults
+ */
+#define CLCNT 1
+#define INCHAR '\t'
+#define INGAP 8
+#define OCHAR '\t'
+#define OGAP 8
+#define LINES 66
+#define NMWD 5
+#define NMCHAR '\t'
+#define SCHAR '\t'
+#define PGWD 72
+#define SPGWD 512
+
+/*
+ * misc default values
+ */
+#define HDFMT "%s %s Page %d\n\n\n"
+#define HEADLEN 5
+#define TAILLEN 5
+#define TIMEFMTD "%e %b %H:%M %Y"
+#define TIMEFMTM "%b %e %H:%M %Y"
+#define FNAME ""
+#define LBUF 8192
+#define HDBUF 512
+
+/*
+ * structure for vertical columns. Used to balance cols on last page
+ */
+struct vcol {
+ char *pt; /* ptr to col */
+ int cnt; /* char count */
+};
diff --git a/usr.bin/primes/Makefile b/usr.bin/primes/Makefile
new file mode 100644
index 0000000..1f762a3
--- /dev/null
+++ b/usr.bin/primes/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
+# $FreeBSD$
+
+PROG= primes
+SRCS= pattern.c pr_tbl.c primes.c spsp.c
+MAN=
+LIBADD= m
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/primes/Makefile.depend b/usr.bin/primes/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/primes/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/primes/pattern.c b/usr.bin/primes/pattern.c
new file mode 100644
index 0000000..2b30678
--- /dev/null
+++ b/usr.bin/primes/pattern.c
@@ -0,0 +1,444 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Landon Curt Noll.
+ *
+ * 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. 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
+#if 0
+static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+/*
+ * pattern - the Eratosthenes sieve on odd numbers for 3,5,7,11 and 13
+ *
+ * By: Landon Curt Noll chongo@toad.com
+ *
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ *
+ * To avoid excessive sieves for small factors, we use the table below to
+ * setup our sieve blocks. Each element represents an odd number starting
+ * with 1. All non-zero elements are factors of 3, 5, 7, 11 and 13.
+ */
+
+#include <stddef.h>
+
+#include "primes.h"
+
+const char pattern[] = {
+1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+0,0,0,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,0,
+0,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,
+0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,
+1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,
+1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,
+1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,
+0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,
+0,0,0,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,0,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,
+1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,0,0,0,
+1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,
+0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,
+0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,
+0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,
+1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,
+1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,
+0,0,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,
+1,0,1,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,
+1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,
+1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,
+0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,
+0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,
+1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,
+1,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
+0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
+1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,0,
+0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,
+0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,
+1,0,1,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,
+0,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,
+0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,
+0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,
+1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,
+1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,1,
+1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,
+1,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,
+0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,
+1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,
+0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,
+1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,
+0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,
+1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,
+1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,
+1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,
+0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,
+0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,
+1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,
+1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,
+1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,1,0,0,
+1,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,
+0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
+0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1
+};
+const size_t pattern_size = (sizeof(pattern)/sizeof(pattern[0]));
diff --git a/usr.bin/primes/pr_tbl.c b/usr.bin/primes/pr_tbl.c
new file mode 100644
index 0000000..5bb7093
--- /dev/null
+++ b/usr.bin/primes/pr_tbl.c
@@ -0,0 +1,548 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Landon Curt Noll.
+ *
+ * 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. 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
+#if 0
+static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+/*
+ * prime - prime table
+ *
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ *
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ *
+ * We are able to sieve 2^32-1 because this table has primes up to 65537
+ * and 65537^2 > 2^32-1.
+ */
+
+#include <stddef.h>
+
+#include "primes.h"
+
+const ubig prime[] = {
+2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,
+107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,
+211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,
+317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,
+439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,
+569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,
+677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,
+821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,
+947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,
+1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,
+1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,
+1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,
+1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,
+1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,
+1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,
+1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,
+1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,
+1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,
+2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,
+2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,
+2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,
+2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,
+2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,
+2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,
+2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,
+2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,
+3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,
+3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,
+3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,
+3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,
+3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,
+3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,
+3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,
+3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,
+4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,
+4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,
+4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,
+4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,
+4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,
+4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,
+4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,
+4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,
+5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,
+5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,
+5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,
+5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,
+5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,
+5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,
+5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,
+5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,
+6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,
+6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,
+6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,
+6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,
+6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,
+6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,
+6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,
+6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,
+7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,
+7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,
+7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,
+7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,
+7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,
+7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,
+7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,
+8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,
+8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,
+8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,
+8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,
+8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,
+8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,
+8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,
+9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,
+9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,
+9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,
+9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,
+9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,
+9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,
+9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,
+9967,9973,10007,10009,10037,10039,10061,10067,10069,10079,10091,10093,10099,
+10103,10111,10133,10139,10141,10151,10159,10163,10169,10177,10181,10193,10211,
+10223,10243,10247,10253,10259,10267,10271,10273,10289,10301,10303,10313,10321,
+10331,10333,10337,10343,10357,10369,10391,10399,10427,10429,10433,10453,10457,
+10459,10463,10477,10487,10499,10501,10513,10529,10531,10559,10567,10589,10597,
+10601,10607,10613,10627,10631,10639,10651,10657,10663,10667,10687,10691,10709,
+10711,10723,10729,10733,10739,10753,10771,10781,10789,10799,10831,10837,10847,
+10853,10859,10861,10867,10883,10889,10891,10903,10909,10937,10939,10949,10957,
+10973,10979,10987,10993,11003,11027,11047,11057,11059,11069,11071,11083,11087,
+11093,11113,11117,11119,11131,11149,11159,11161,11171,11173,11177,11197,11213,
+11239,11243,11251,11257,11261,11273,11279,11287,11299,11311,11317,11321,11329,
+11351,11353,11369,11383,11393,11399,11411,11423,11437,11443,11447,11467,11471,
+11483,11489,11491,11497,11503,11519,11527,11549,11551,11579,11587,11593,11597,
+11617,11621,11633,11657,11677,11681,11689,11699,11701,11717,11719,11731,11743,
+11777,11779,11783,11789,11801,11807,11813,11821,11827,11831,11833,11839,11863,
+11867,11887,11897,11903,11909,11923,11927,11933,11939,11941,11953,11959,11969,
+11971,11981,11987,12007,12011,12037,12041,12043,12049,12071,12073,12097,12101,
+12107,12109,12113,12119,12143,12149,12157,12161,12163,12197,12203,12211,12227,
+12239,12241,12251,12253,12263,12269,12277,12281,12289,12301,12323,12329,12343,
+12347,12373,12377,12379,12391,12401,12409,12413,12421,12433,12437,12451,12457,
+12473,12479,12487,12491,12497,12503,12511,12517,12527,12539,12541,12547,12553,
+12569,12577,12583,12589,12601,12611,12613,12619,12637,12641,12647,12653,12659,
+12671,12689,12697,12703,12713,12721,12739,12743,12757,12763,12781,12791,12799,
+12809,12821,12823,12829,12841,12853,12889,12893,12899,12907,12911,12917,12919,
+12923,12941,12953,12959,12967,12973,12979,12983,13001,13003,13007,13009,13033,
+13037,13043,13049,13063,13093,13099,13103,13109,13121,13127,13147,13151,13159,
+13163,13171,13177,13183,13187,13217,13219,13229,13241,13249,13259,13267,13291,
+13297,13309,13313,13327,13331,13337,13339,13367,13381,13397,13399,13411,13417,
+13421,13441,13451,13457,13463,13469,13477,13487,13499,13513,13523,13537,13553,
+13567,13577,13591,13597,13613,13619,13627,13633,13649,13669,13679,13681,13687,
+13691,13693,13697,13709,13711,13721,13723,13729,13751,13757,13759,13763,13781,
+13789,13799,13807,13829,13831,13841,13859,13873,13877,13879,13883,13901,13903,
+13907,13913,13921,13931,13933,13963,13967,13997,13999,14009,14011,14029,14033,
+14051,14057,14071,14081,14083,14087,14107,14143,14149,14153,14159,14173,14177,
+14197,14207,14221,14243,14249,14251,14281,14293,14303,14321,14323,14327,14341,
+14347,14369,14387,14389,14401,14407,14411,14419,14423,14431,14437,14447,14449,
+14461,14479,14489,14503,14519,14533,14537,14543,14549,14551,14557,14561,14563,
+14591,14593,14621,14627,14629,14633,14639,14653,14657,14669,14683,14699,14713,
+14717,14723,14731,14737,14741,14747,14753,14759,14767,14771,14779,14783,14797,
+14813,14821,14827,14831,14843,14851,14867,14869,14879,14887,14891,14897,14923,
+14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073,
+15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187,
+15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289,
+15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391,
+15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527,
+15541,15551,15559,15569,15581,15583,15601,15607,15619,15629,15641,15643,15647,
+15649,15661,15667,15671,15679,15683,15727,15731,15733,15737,15739,15749,15761,
+15767,15773,15787,15791,15797,15803,15809,15817,15823,15859,15877,15881,15887,
+15889,15901,15907,15913,15919,15923,15937,15959,15971,15973,15991,16001,16007,
+16033,16057,16061,16063,16067,16069,16073,16087,16091,16097,16103,16111,16127,
+16139,16141,16183,16187,16189,16193,16217,16223,16229,16231,16249,16253,16267,
+16273,16301,16319,16333,16339,16349,16361,16363,16369,16381,16411,16417,16421,
+16427,16433,16447,16451,16453,16477,16481,16487,16493,16519,16529,16547,16553,
+16561,16567,16573,16603,16607,16619,16631,16633,16649,16651,16657,16661,16673,
+16691,16693,16699,16703,16729,16741,16747,16759,16763,16787,16811,16823,16829,
+16831,16843,16871,16879,16883,16889,16901,16903,16921,16927,16931,16937,16943,
+16963,16979,16981,16987,16993,17011,17021,17027,17029,17033,17041,17047,17053,
+17077,17093,17099,17107,17117,17123,17137,17159,17167,17183,17189,17191,17203,
+17207,17209,17231,17239,17257,17291,17293,17299,17317,17321,17327,17333,17341,
+17351,17359,17377,17383,17387,17389,17393,17401,17417,17419,17431,17443,17449,
+17467,17471,17477,17483,17489,17491,17497,17509,17519,17539,17551,17569,17573,
+17579,17581,17597,17599,17609,17623,17627,17657,17659,17669,17681,17683,17707,
+17713,17729,17737,17747,17749,17761,17783,17789,17791,17807,17827,17837,17839,
+17851,17863,17881,17891,17903,17909,17911,17921,17923,17929,17939,17957,17959,
+17971,17977,17981,17987,17989,18013,18041,18043,18047,18049,18059,18061,18077,
+18089,18097,18119,18121,18127,18131,18133,18143,18149,18169,18181,18191,18199,
+18211,18217,18223,18229,18233,18251,18253,18257,18269,18287,18289,18301,18307,
+18311,18313,18329,18341,18353,18367,18371,18379,18397,18401,18413,18427,18433,
+18439,18443,18451,18457,18461,18481,18493,18503,18517,18521,18523,18539,18541,
+18553,18583,18587,18593,18617,18637,18661,18671,18679,18691,18701,18713,18719,
+18731,18743,18749,18757,18773,18787,18793,18797,18803,18839,18859,18869,18899,
+18911,18913,18917,18919,18947,18959,18973,18979,19001,19009,19013,19031,19037,
+19051,19069,19073,19079,19081,19087,19121,19139,19141,19157,19163,19181,19183,
+19207,19211,19213,19219,19231,19237,19249,19259,19267,19273,19289,19301,19309,
+19319,19333,19373,19379,19381,19387,19391,19403,19417,19421,19423,19427,19429,
+19433,19441,19447,19457,19463,19469,19471,19477,19483,19489,19501,19507,19531,
+19541,19543,19553,19559,19571,19577,19583,19597,19603,19609,19661,19681,19687,
+19697,19699,19709,19717,19727,19739,19751,19753,19759,19763,19777,19793,19801,
+19813,19819,19841,19843,19853,19861,19867,19889,19891,19913,19919,19927,19937,
+19949,19961,19963,19973,19979,19991,19993,19997,20011,20021,20023,20029,20047,
+20051,20063,20071,20089,20101,20107,20113,20117,20123,20129,20143,20147,20149,
+20161,20173,20177,20183,20201,20219,20231,20233,20249,20261,20269,20287,20297,
+20323,20327,20333,20341,20347,20353,20357,20359,20369,20389,20393,20399,20407,
+20411,20431,20441,20443,20477,20479,20483,20507,20509,20521,20533,20543,20549,
+20551,20563,20593,20599,20611,20627,20639,20641,20663,20681,20693,20707,20717,
+20719,20731,20743,20747,20749,20753,20759,20771,20773,20789,20807,20809,20849,
+20857,20873,20879,20887,20897,20899,20903,20921,20929,20939,20947,20959,20963,
+20981,20983,21001,21011,21013,21017,21019,21023,21031,21059,21061,21067,21089,
+21101,21107,21121,21139,21143,21149,21157,21163,21169,21179,21187,21191,21193,
+21211,21221,21227,21247,21269,21277,21283,21313,21317,21319,21323,21341,21347,
+21377,21379,21383,21391,21397,21401,21407,21419,21433,21467,21481,21487,21491,
+21493,21499,21503,21517,21521,21523,21529,21557,21559,21563,21569,21577,21587,
+21589,21599,21601,21611,21613,21617,21647,21649,21661,21673,21683,21701,21713,
+21727,21737,21739,21751,21757,21767,21773,21787,21799,21803,21817,21821,21839,
+21841,21851,21859,21863,21871,21881,21893,21911,21929,21937,21943,21961,21977,
+21991,21997,22003,22013,22027,22031,22037,22039,22051,22063,22067,22073,22079,
+22091,22093,22109,22111,22123,22129,22133,22147,22153,22157,22159,22171,22189,
+22193,22229,22247,22259,22271,22273,22277,22279,22283,22291,22303,22307,22343,
+22349,22367,22369,22381,22391,22397,22409,22433,22441,22447,22453,22469,22481,
+22483,22501,22511,22531,22541,22543,22549,22567,22571,22573,22613,22619,22621,
+22637,22639,22643,22651,22669,22679,22691,22697,22699,22709,22717,22721,22727,
+22739,22741,22751,22769,22777,22783,22787,22807,22811,22817,22853,22859,22861,
+22871,22877,22901,22907,22921,22937,22943,22961,22963,22973,22993,23003,23011,
+23017,23021,23027,23029,23039,23041,23053,23057,23059,23063,23071,23081,23087,
+23099,23117,23131,23143,23159,23167,23173,23189,23197,23201,23203,23209,23227,
+23251,23269,23279,23291,23293,23297,23311,23321,23327,23333,23339,23357,23369,
+23371,23399,23417,23431,23447,23459,23473,23497,23509,23531,23537,23539,23549,
+23557,23561,23563,23567,23581,23593,23599,23603,23609,23623,23627,23629,23633,
+23663,23669,23671,23677,23687,23689,23719,23741,23743,23747,23753,23761,23767,
+23773,23789,23801,23813,23819,23827,23831,23833,23857,23869,23873,23879,23887,
+23893,23899,23909,23911,23917,23929,23957,23971,23977,23981,23993,24001,24007,
+24019,24023,24029,24043,24049,24061,24071,24077,24083,24091,24097,24103,24107,
+24109,24113,24121,24133,24137,24151,24169,24179,24181,24197,24203,24223,24229,
+24239,24247,24251,24281,24317,24329,24337,24359,24371,24373,24379,24391,24407,
+24413,24419,24421,24439,24443,24469,24473,24481,24499,24509,24517,24527,24533,
+24547,24551,24571,24593,24611,24623,24631,24659,24671,24677,24683,24691,24697,
+24709,24733,24749,24763,24767,24781,24793,24799,24809,24821,24841,24847,24851,
+24859,24877,24889,24907,24917,24919,24923,24943,24953,24967,24971,24977,24979,
+24989,25013,25031,25033,25037,25057,25073,25087,25097,25111,25117,25121,25127,
+25147,25153,25163,25169,25171,25183,25189,25219,25229,25237,25243,25247,25253,
+25261,25301,25303,25307,25309,25321,25339,25343,25349,25357,25367,25373,25391,
+25409,25411,25423,25439,25447,25453,25457,25463,25469,25471,25523,25537,25541,
+25561,25577,25579,25583,25589,25601,25603,25609,25621,25633,25639,25643,25657,
+25667,25673,25679,25693,25703,25717,25733,25741,25747,25759,25763,25771,25793,
+25799,25801,25819,25841,25847,25849,25867,25873,25889,25903,25913,25919,25931,
+25933,25939,25943,25951,25969,25981,25997,25999,26003,26017,26021,26029,26041,
+26053,26083,26099,26107,26111,26113,26119,26141,26153,26161,26171,26177,26183,
+26189,26203,26209,26227,26237,26249,26251,26261,26263,26267,26293,26297,26309,
+26317,26321,26339,26347,26357,26371,26387,26393,26399,26407,26417,26423,26431,
+26437,26449,26459,26479,26489,26497,26501,26513,26539,26557,26561,26573,26591,
+26597,26627,26633,26641,26647,26669,26681,26683,26687,26693,26699,26701,26711,
+26713,26717,26723,26729,26731,26737,26759,26777,26783,26801,26813,26821,26833,
+26839,26849,26861,26863,26879,26881,26891,26893,26903,26921,26927,26947,26951,
+26953,26959,26981,26987,26993,27011,27017,27031,27043,27059,27061,27067,27073,
+27077,27091,27103,27107,27109,27127,27143,27179,27191,27197,27211,27239,27241,
+27253,27259,27271,27277,27281,27283,27299,27329,27337,27361,27367,27397,27407,
+27409,27427,27431,27437,27449,27457,27479,27481,27487,27509,27527,27529,27539,
+27541,27551,27581,27583,27611,27617,27631,27647,27653,27673,27689,27691,27697,
+27701,27733,27737,27739,27743,27749,27751,27763,27767,27773,27779,27791,27793,
+27799,27803,27809,27817,27823,27827,27847,27851,27883,27893,27901,27917,27919,
+27941,27943,27947,27953,27961,27967,27983,27997,28001,28019,28027,28031,28051,
+28057,28069,28081,28087,28097,28099,28109,28111,28123,28151,28163,28181,28183,
+28201,28211,28219,28229,28277,28279,28283,28289,28297,28307,28309,28319,28349,
+28351,28387,28393,28403,28409,28411,28429,28433,28439,28447,28463,28477,28493,
+28499,28513,28517,28537,28541,28547,28549,28559,28571,28573,28579,28591,28597,
+28603,28607,28619,28621,28627,28631,28643,28649,28657,28661,28663,28669,28687,
+28697,28703,28711,28723,28729,28751,28753,28759,28771,28789,28793,28807,28813,
+28817,28837,28843,28859,28867,28871,28879,28901,28909,28921,28927,28933,28949,
+28961,28979,29009,29017,29021,29023,29027,29033,29059,29063,29077,29101,29123,
+29129,29131,29137,29147,29153,29167,29173,29179,29191,29201,29207,29209,29221,
+29231,29243,29251,29269,29287,29297,29303,29311,29327,29333,29339,29347,29363,
+29383,29387,29389,29399,29401,29411,29423,29429,29437,29443,29453,29473,29483,
+29501,29527,29531,29537,29567,29569,29573,29581,29587,29599,29611,29629,29633,
+29641,29663,29669,29671,29683,29717,29723,29741,29753,29759,29761,29789,29803,
+29819,29833,29837,29851,29863,29867,29873,29879,29881,29917,29921,29927,29947,
+29959,29983,29989,30011,30013,30029,30047,30059,30071,30089,30091,30097,30103,
+30109,30113,30119,30133,30137,30139,30161,30169,30181,30187,30197,30203,30211,
+30223,30241,30253,30259,30269,30271,30293,30307,30313,30319,30323,30341,30347,
+30367,30389,30391,30403,30427,30431,30449,30467,30469,30491,30493,30497,30509,
+30517,30529,30539,30553,30557,30559,30577,30593,30631,30637,30643,30649,30661,
+30671,30677,30689,30697,30703,30707,30713,30727,30757,30763,30773,30781,30803,
+30809,30817,30829,30839,30841,30851,30853,30859,30869,30871,30881,30893,30911,
+30931,30937,30941,30949,30971,30977,30983,31013,31019,31033,31039,31051,31063,
+31069,31079,31081,31091,31121,31123,31139,31147,31151,31153,31159,31177,31181,
+31183,31189,31193,31219,31223,31231,31237,31247,31249,31253,31259,31267,31271,
+31277,31307,31319,31321,31327,31333,31337,31357,31379,31387,31391,31393,31397,
+31469,31477,31481,31489,31511,31513,31517,31531,31541,31543,31547,31567,31573,
+31583,31601,31607,31627,31643,31649,31657,31663,31667,31687,31699,31721,31723,
+31727,31729,31741,31751,31769,31771,31793,31799,31817,31847,31849,31859,31873,
+31883,31891,31907,31957,31963,31973,31981,31991,32003,32009,32027,32029,32051,
+32057,32059,32063,32069,32077,32083,32089,32099,32117,32119,32141,32143,32159,
+32173,32183,32189,32191,32203,32213,32233,32237,32251,32257,32261,32297,32299,
+32303,32309,32321,32323,32327,32341,32353,32359,32363,32369,32371,32377,32381,
+32401,32411,32413,32423,32429,32441,32443,32467,32479,32491,32497,32503,32507,
+32531,32533,32537,32561,32563,32569,32573,32579,32587,32603,32609,32611,32621,
+32633,32647,32653,32687,32693,32707,32713,32717,32719,32749,32771,32779,32783,
+32789,32797,32801,32803,32831,32833,32839,32843,32869,32887,32909,32911,32917,
+32933,32939,32941,32957,32969,32971,32983,32987,32993,32999,33013,33023,33029,
+33037,33049,33053,33071,33073,33083,33091,33107,33113,33119,33149,33151,33161,
+33179,33181,33191,33199,33203,33211,33223,33247,33287,33289,33301,33311,33317,
+33329,33331,33343,33347,33349,33353,33359,33377,33391,33403,33409,33413,33427,
+33457,33461,33469,33479,33487,33493,33503,33521,33529,33533,33547,33563,33569,
+33577,33581,33587,33589,33599,33601,33613,33617,33619,33623,33629,33637,33641,
+33647,33679,33703,33713,33721,33739,33749,33751,33757,33767,33769,33773,33791,
+33797,33809,33811,33827,33829,33851,33857,33863,33871,33889,33893,33911,33923,
+33931,33937,33941,33961,33967,33997,34019,34031,34033,34039,34057,34061,34123,
+34127,34129,34141,34147,34157,34159,34171,34183,34211,34213,34217,34231,34253,
+34259,34261,34267,34273,34283,34297,34301,34303,34313,34319,34327,34337,34351,
+34361,34367,34369,34381,34403,34421,34429,34439,34457,34469,34471,34483,34487,
+34499,34501,34511,34513,34519,34537,34543,34549,34583,34589,34591,34603,34607,
+34613,34631,34649,34651,34667,34673,34679,34687,34693,34703,34721,34729,34739,
+34747,34757,34759,34763,34781,34807,34819,34841,34843,34847,34849,34871,34877,
+34883,34897,34913,34919,34939,34949,34961,34963,34981,35023,35027,35051,35053,
+35059,35069,35081,35083,35089,35099,35107,35111,35117,35129,35141,35149,35153,
+35159,35171,35201,35221,35227,35251,35257,35267,35279,35281,35291,35311,35317,
+35323,35327,35339,35353,35363,35381,35393,35401,35407,35419,35423,35437,35447,
+35449,35461,35491,35507,35509,35521,35527,35531,35533,35537,35543,35569,35573,
+35591,35593,35597,35603,35617,35671,35677,35729,35731,35747,35753,35759,35771,
+35797,35801,35803,35809,35831,35837,35839,35851,35863,35869,35879,35897,35899,
+35911,35923,35933,35951,35963,35969,35977,35983,35993,35999,36007,36011,36013,
+36017,36037,36061,36067,36073,36083,36097,36107,36109,36131,36137,36151,36161,
+36187,36191,36209,36217,36229,36241,36251,36263,36269,36277,36293,36299,36307,
+36313,36319,36341,36343,36353,36373,36383,36389,36433,36451,36457,36467,36469,
+36473,36479,36493,36497,36523,36527,36529,36541,36551,36559,36563,36571,36583,
+36587,36599,36607,36629,36637,36643,36653,36671,36677,36683,36691,36697,36709,
+36713,36721,36739,36749,36761,36767,36779,36781,36787,36791,36793,36809,36821,
+36833,36847,36857,36871,36877,36887,36899,36901,36913,36919,36923,36929,36931,
+36943,36947,36973,36979,36997,37003,37013,37019,37021,37039,37049,37057,37061,
+37087,37097,37117,37123,37139,37159,37171,37181,37189,37199,37201,37217,37223,
+37243,37253,37273,37277,37307,37309,37313,37321,37337,37339,37357,37361,37363,
+37369,37379,37397,37409,37423,37441,37447,37463,37483,37489,37493,37501,37507,
+37511,37517,37529,37537,37547,37549,37561,37567,37571,37573,37579,37589,37591,
+37607,37619,37633,37643,37649,37657,37663,37691,37693,37699,37717,37747,37781,
+37783,37799,37811,37813,37831,37847,37853,37861,37871,37879,37889,37897,37907,
+37951,37957,37963,37967,37987,37991,37993,37997,38011,38039,38047,38053,38069,
+38083,38113,38119,38149,38153,38167,38177,38183,38189,38197,38201,38219,38231,
+38237,38239,38261,38273,38281,38287,38299,38303,38317,38321,38327,38329,38333,
+38351,38371,38377,38393,38431,38447,38449,38453,38459,38461,38501,38543,38557,
+38561,38567,38569,38593,38603,38609,38611,38629,38639,38651,38653,38669,38671,
+38677,38693,38699,38707,38711,38713,38723,38729,38737,38747,38749,38767,38783,
+38791,38803,38821,38833,38839,38851,38861,38867,38873,38891,38903,38917,38921,
+38923,38933,38953,38959,38971,38977,38993,39019,39023,39041,39043,39047,39079,
+39089,39097,39103,39107,39113,39119,39133,39139,39157,39161,39163,39181,39191,
+39199,39209,39217,39227,39229,39233,39239,39241,39251,39293,39301,39313,39317,
+39323,39341,39343,39359,39367,39371,39373,39383,39397,39409,39419,39439,39443,
+39451,39461,39499,39503,39509,39511,39521,39541,39551,39563,39569,39581,39607,
+39619,39623,39631,39659,39667,39671,39679,39703,39709,39719,39727,39733,39749,
+39761,39769,39779,39791,39799,39821,39827,39829,39839,39841,39847,39857,39863,
+39869,39877,39883,39887,39901,39929,39937,39953,39971,39979,39983,39989,40009,
+40013,40031,40037,40039,40063,40087,40093,40099,40111,40123,40127,40129,40151,
+40153,40163,40169,40177,40189,40193,40213,40231,40237,40241,40253,40277,40283,
+40289,40343,40351,40357,40361,40387,40423,40427,40429,40433,40459,40471,40483,
+40487,40493,40499,40507,40519,40529,40531,40543,40559,40577,40583,40591,40597,
+40609,40627,40637,40639,40693,40697,40699,40709,40739,40751,40759,40763,40771,
+40787,40801,40813,40819,40823,40829,40841,40847,40849,40853,40867,40879,40883,
+40897,40903,40927,40933,40939,40949,40961,40973,40993,41011,41017,41023,41039,
+41047,41051,41057,41077,41081,41113,41117,41131,41141,41143,41149,41161,41177,
+41179,41183,41189,41201,41203,41213,41221,41227,41231,41233,41243,41257,41263,
+41269,41281,41299,41333,41341,41351,41357,41381,41387,41389,41399,41411,41413,
+41443,41453,41467,41479,41491,41507,41513,41519,41521,41539,41543,41549,41579,
+41593,41597,41603,41609,41611,41617,41621,41627,41641,41647,41651,41659,41669,
+41681,41687,41719,41729,41737,41759,41761,41771,41777,41801,41809,41813,41843,
+41849,41851,41863,41879,41887,41893,41897,41903,41911,41927,41941,41947,41953,
+41957,41959,41969,41981,41983,41999,42013,42017,42019,42023,42043,42061,42071,
+42073,42083,42089,42101,42131,42139,42157,42169,42179,42181,42187,42193,42197,
+42209,42221,42223,42227,42239,42257,42281,42283,42293,42299,42307,42323,42331,
+42337,42349,42359,42373,42379,42391,42397,42403,42407,42409,42433,42437,42443,
+42451,42457,42461,42463,42467,42473,42487,42491,42499,42509,42533,42557,42569,
+42571,42577,42589,42611,42641,42643,42649,42667,42677,42683,42689,42697,42701,
+42703,42709,42719,42727,42737,42743,42751,42767,42773,42787,42793,42797,42821,
+42829,42839,42841,42853,42859,42863,42899,42901,42923,42929,42937,42943,42953,
+42961,42967,42979,42989,43003,43013,43019,43037,43049,43051,43063,43067,43093,
+43103,43117,43133,43151,43159,43177,43189,43201,43207,43223,43237,43261,43271,
+43283,43291,43313,43319,43321,43331,43391,43397,43399,43403,43411,43427,43441,
+43451,43457,43481,43487,43499,43517,43541,43543,43573,43577,43579,43591,43597,
+43607,43609,43613,43627,43633,43649,43651,43661,43669,43691,43711,43717,43721,
+43753,43759,43777,43781,43783,43787,43789,43793,43801,43853,43867,43889,43891,
+43913,43933,43943,43951,43961,43963,43969,43973,43987,43991,43997,44017,44021,
+44027,44029,44041,44053,44059,44071,44087,44089,44101,44111,44119,44123,44129,
+44131,44159,44171,44179,44189,44201,44203,44207,44221,44249,44257,44263,44267,
+44269,44273,44279,44281,44293,44351,44357,44371,44381,44383,44389,44417,44449,
+44453,44483,44491,44497,44501,44507,44519,44531,44533,44537,44543,44549,44563,
+44579,44587,44617,44621,44623,44633,44641,44647,44651,44657,44683,44687,44699,
+44701,44711,44729,44741,44753,44771,44773,44777,44789,44797,44809,44819,44839,
+44843,44851,44867,44879,44887,44893,44909,44917,44927,44939,44953,44959,44963,
+44971,44983,44987,45007,45013,45053,45061,45077,45083,45119,45121,45127,45131,
+45137,45139,45161,45179,45181,45191,45197,45233,45247,45259,45263,45281,45289,
+45293,45307,45317,45319,45329,45337,45341,45343,45361,45377,45389,45403,45413,
+45427,45433,45439,45481,45491,45497,45503,45523,45533,45541,45553,45557,45569,
+45587,45589,45599,45613,45631,45641,45659,45667,45673,45677,45691,45697,45707,
+45737,45751,45757,45763,45767,45779,45817,45821,45823,45827,45833,45841,45853,
+45863,45869,45887,45893,45943,45949,45953,45959,45971,45979,45989,46021,46027,
+46049,46051,46061,46073,46091,46093,46099,46103,46133,46141,46147,46153,46171,
+46181,46183,46187,46199,46219,46229,46237,46261,46271,46273,46279,46301,46307,
+46309,46327,46337,46349,46351,46381,46399,46411,46439,46441,46447,46451,46457,
+46471,46477,46489,46499,46507,46511,46523,46549,46559,46567,46573,46589,46591,
+46601,46619,46633,46639,46643,46649,46663,46679,46681,46687,46691,46703,46723,
+46727,46747,46751,46757,46769,46771,46807,46811,46817,46819,46829,46831,46853,
+46861,46867,46877,46889,46901,46919,46933,46957,46993,46997,47017,47041,47051,
+47057,47059,47087,47093,47111,47119,47123,47129,47137,47143,47147,47149,47161,
+47189,47207,47221,47237,47251,47269,47279,47287,47293,47297,47303,47309,47317,
+47339,47351,47353,47363,47381,47387,47389,47407,47417,47419,47431,47441,47459,
+47491,47497,47501,47507,47513,47521,47527,47533,47543,47563,47569,47581,47591,
+47599,47609,47623,47629,47639,47653,47657,47659,47681,47699,47701,47711,47713,
+47717,47737,47741,47743,47777,47779,47791,47797,47807,47809,47819,47837,47843,
+47857,47869,47881,47903,47911,47917,47933,47939,47947,47951,47963,47969,47977,
+47981,48017,48023,48029,48049,48073,48079,48091,48109,48119,48121,48131,48157,
+48163,48179,48187,48193,48197,48221,48239,48247,48259,48271,48281,48299,48311,
+48313,48337,48341,48353,48371,48383,48397,48407,48409,48413,48437,48449,48463,
+48473,48479,48481,48487,48491,48497,48523,48527,48533,48539,48541,48563,48571,
+48589,48593,48611,48619,48623,48647,48649,48661,48673,48677,48679,48731,48733,
+48751,48757,48761,48767,48779,48781,48787,48799,48809,48817,48821,48823,48847,
+48857,48859,48869,48871,48883,48889,48907,48947,48953,48973,48989,48991,49003,
+49009,49019,49031,49033,49037,49043,49057,49069,49081,49103,49109,49117,49121,
+49123,49139,49157,49169,49171,49177,49193,49199,49201,49207,49211,49223,49253,
+49261,49277,49279,49297,49307,49331,49333,49339,49363,49367,49369,49391,49393,
+49409,49411,49417,49429,49433,49451,49459,49463,49477,49481,49499,49523,49529,
+49531,49537,49547,49549,49559,49597,49603,49613,49627,49633,49639,49663,49667,
+49669,49681,49697,49711,49727,49739,49741,49747,49757,49783,49787,49789,49801,
+49807,49811,49823,49831,49843,49853,49871,49877,49891,49919,49921,49927,49937,
+49939,49943,49957,49991,49993,49999,50021,50023,50033,50047,50051,50053,50069,
+50077,50087,50093,50101,50111,50119,50123,50129,50131,50147,50153,50159,50177,
+50207,50221,50227,50231,50261,50263,50273,50287,50291,50311,50321,50329,50333,
+50341,50359,50363,50377,50383,50387,50411,50417,50423,50441,50459,50461,50497,
+50503,50513,50527,50539,50543,50549,50551,50581,50587,50591,50593,50599,50627,
+50647,50651,50671,50683,50707,50723,50741,50753,50767,50773,50777,50789,50821,
+50833,50839,50849,50857,50867,50873,50891,50893,50909,50923,50929,50951,50957,
+50969,50971,50989,50993,51001,51031,51043,51047,51059,51061,51071,51109,51131,
+51133,51137,51151,51157,51169,51193,51197,51199,51203,51217,51229,51239,51241,
+51257,51263,51283,51287,51307,51329,51341,51343,51347,51349,51361,51383,51407,
+51413,51419,51421,51427,51431,51437,51439,51449,51461,51473,51479,51481,51487,
+51503,51511,51517,51521,51539,51551,51563,51577,51581,51593,51599,51607,51613,
+51631,51637,51647,51659,51673,51679,51683,51691,51713,51719,51721,51749,51767,
+51769,51787,51797,51803,51817,51827,51829,51839,51853,51859,51869,51871,51893,
+51899,51907,51913,51929,51941,51949,51971,51973,51977,51991,52009,52021,52027,
+52051,52057,52067,52069,52081,52103,52121,52127,52147,52153,52163,52177,52181,
+52183,52189,52201,52223,52237,52249,52253,52259,52267,52289,52291,52301,52313,
+52321,52361,52363,52369,52379,52387,52391,52433,52453,52457,52489,52501,52511,
+52517,52529,52541,52543,52553,52561,52567,52571,52579,52583,52609,52627,52631,
+52639,52667,52673,52691,52697,52709,52711,52721,52727,52733,52747,52757,52769,
+52783,52807,52813,52817,52837,52859,52861,52879,52883,52889,52901,52903,52919,
+52937,52951,52957,52963,52967,52973,52981,52999,53003,53017,53047,53051,53069,
+53077,53087,53089,53093,53101,53113,53117,53129,53147,53149,53161,53171,53173,
+53189,53197,53201,53231,53233,53239,53267,53269,53279,53281,53299,53309,53323,
+53327,53353,53359,53377,53381,53401,53407,53411,53419,53437,53441,53453,53479,
+53503,53507,53527,53549,53551,53569,53591,53593,53597,53609,53611,53617,53623,
+53629,53633,53639,53653,53657,53681,53693,53699,53717,53719,53731,53759,53773,
+53777,53783,53791,53813,53819,53831,53849,53857,53861,53881,53887,53891,53897,
+53899,53917,53923,53927,53939,53951,53959,53987,53993,54001,54011,54013,54037,
+54049,54059,54083,54091,54101,54121,54133,54139,54151,54163,54167,54181,54193,
+54217,54251,54269,54277,54287,54293,54311,54319,54323,54331,54347,54361,54367,
+54371,54377,54401,54403,54409,54413,54419,54421,54437,54443,54449,54469,54493,
+54497,54499,54503,54517,54521,54539,54541,54547,54559,54563,54577,54581,54583,
+54601,54617,54623,54629,54631,54647,54667,54673,54679,54709,54713,54721,54727,
+54751,54767,54773,54779,54787,54799,54829,54833,54851,54869,54877,54881,54907,
+54917,54919,54941,54949,54959,54973,54979,54983,55001,55009,55021,55049,55051,
+55057,55061,55073,55079,55103,55109,55117,55127,55147,55163,55171,55201,55207,
+55213,55217,55219,55229,55243,55249,55259,55291,55313,55331,55333,55337,55339,
+55343,55351,55373,55381,55399,55411,55439,55441,55457,55469,55487,55501,55511,
+55529,55541,55547,55579,55589,55603,55609,55619,55621,55631,55633,55639,55661,
+55663,55667,55673,55681,55691,55697,55711,55717,55721,55733,55763,55787,55793,
+55799,55807,55813,55817,55819,55823,55829,55837,55843,55849,55871,55889,55897,
+55901,55903,55921,55927,55931,55933,55949,55967,55987,55997,56003,56009,56039,
+56041,56053,56081,56087,56093,56099,56101,56113,56123,56131,56149,56167,56171,
+56179,56197,56207,56209,56237,56239,56249,56263,56267,56269,56299,56311,56333,
+56359,56369,56377,56383,56393,56401,56417,56431,56437,56443,56453,56467,56473,
+56477,56479,56489,56501,56503,56509,56519,56527,56531,56533,56543,56569,56591,
+56597,56599,56611,56629,56633,56659,56663,56671,56681,56687,56701,56711,56713,
+56731,56737,56747,56767,56773,56779,56783,56807,56809,56813,56821,56827,56843,
+56857,56873,56891,56893,56897,56909,56911,56921,56923,56929,56941,56951,56957,
+56963,56983,56989,56993,56999,57037,57041,57047,57059,57073,57077,57089,57097,
+57107,57119,57131,57139,57143,57149,57163,57173,57179,57191,57193,57203,57221,
+57223,57241,57251,57259,57269,57271,57283,57287,57301,57329,57331,57347,57349,
+57367,57373,57383,57389,57397,57413,57427,57457,57467,57487,57493,57503,57527,
+57529,57557,57559,57571,57587,57593,57601,57637,57641,57649,57653,57667,57679,
+57689,57697,57709,57713,57719,57727,57731,57737,57751,57773,57781,57787,57791,
+57793,57803,57809,57829,57839,57847,57853,57859,57881,57899,57901,57917,57923,
+57943,57947,57973,57977,57991,58013,58027,58031,58043,58049,58057,58061,58067,
+58073,58099,58109,58111,58129,58147,58151,58153,58169,58171,58189,58193,58199,
+58207,58211,58217,58229,58231,58237,58243,58271,58309,58313,58321,58337,58363,
+58367,58369,58379,58391,58393,58403,58411,58417,58427,58439,58441,58451,58453,
+58477,58481,58511,58537,58543,58549,58567,58573,58579,58601,58603,58613,58631,
+58657,58661,58679,58687,58693,58699,58711,58727,58733,58741,58757,58763,58771,
+58787,58789,58831,58889,58897,58901,58907,58909,58913,58921,58937,58943,58963,
+58967,58979,58991,58997,59009,59011,59021,59023,59029,59051,59053,59063,59069,
+59077,59083,59093,59107,59113,59119,59123,59141,59149,59159,59167,59183,59197,
+59207,59209,59219,59221,59233,59239,59243,59263,59273,59281,59333,59341,59351,
+59357,59359,59369,59377,59387,59393,59399,59407,59417,59419,59441,59443,59447,
+59453,59467,59471,59473,59497,59509,59513,59539,59557,59561,59567,59581,59611,
+59617,59621,59627,59629,59651,59659,59663,59669,59671,59693,59699,59707,59723,
+59729,59743,59747,59753,59771,59779,59791,59797,59809,59833,59863,59879,59887,
+59921,59929,59951,59957,59971,59981,59999,60013,60017,60029,60037,60041,60077,
+60083,60089,60091,60101,60103,60107,60127,60133,60139,60149,60161,60167,60169,
+60209,60217,60223,60251,60257,60259,60271,60289,60293,60317,60331,60337,60343,
+60353,60373,60383,60397,60413,60427,60443,60449,60457,60493,60497,60509,60521,
+60527,60539,60589,60601,60607,60611,60617,60623,60631,60637,60647,60649,60659,
+60661,60679,60689,60703,60719,60727,60733,60737,60757,60761,60763,60773,60779,
+60793,60811,60821,60859,60869,60887,60889,60899,60901,60913,60917,60919,60923,
+60937,60943,60953,60961,61001,61007,61027,61031,61043,61051,61057,61091,61099,
+61121,61129,61141,61151,61153,61169,61211,61223,61231,61253,61261,61283,61291,
+61297,61331,61333,61339,61343,61357,61363,61379,61381,61403,61409,61417,61441,
+61463,61469,61471,61483,61487,61493,61507,61511,61519,61543,61547,61553,61559,
+61561,61583,61603,61609,61613,61627,61631,61637,61643,61651,61657,61667,61673,
+61681,61687,61703,61717,61723,61729,61751,61757,61781,61813,61819,61837,61843,
+61861,61871,61879,61909,61927,61933,61949,61961,61967,61979,61981,61987,61991,
+62003,62011,62017,62039,62047,62053,62057,62071,62081,62099,62119,62129,62131,
+62137,62141,62143,62171,62189,62191,62201,62207,62213,62219,62233,62273,62297,
+62299,62303,62311,62323,62327,62347,62351,62383,62401,62417,62423,62459,62467,
+62473,62477,62483,62497,62501,62507,62533,62539,62549,62563,62581,62591,62597,
+62603,62617,62627,62633,62639,62653,62659,62683,62687,62701,62723,62731,62743,
+62753,62761,62773,62791,62801,62819,62827,62851,62861,62869,62873,62897,62903,
+62921,62927,62929,62939,62969,62971,62981,62983,62987,62989,63029,63031,63059,
+63067,63073,63079,63097,63103,63113,63127,63131,63149,63179,63197,63199,63211,
+63241,63247,63277,63281,63299,63311,63313,63317,63331,63337,63347,63353,63361,
+63367,63377,63389,63391,63397,63409,63419,63421,63439,63443,63463,63467,63473,
+63487,63493,63499,63521,63527,63533,63541,63559,63577,63587,63589,63599,63601,
+63607,63611,63617,63629,63647,63649,63659,63667,63671,63689,63691,63697,63703,
+63709,63719,63727,63737,63743,63761,63773,63781,63793,63799,63803,63809,63823,
+63839,63841,63853,63857,63863,63901,63907,63913,63929,63949,63977,63997,64007,
+64013,64019,64033,64037,64063,64067,64081,64091,64109,64123,64151,64153,64157,
+64171,64187,64189,64217,64223,64231,64237,64271,64279,64283,64301,64303,64319,
+64327,64333,64373,64381,64399,64403,64433,64439,64451,64453,64483,64489,64499,
+64513,64553,64567,64577,64579,64591,64601,64609,64613,64621,64627,64633,64661,
+64663,64667,64679,64693,64709,64717,64747,64763,64781,64783,64793,64811,64817,
+64849,64853,64871,64877,64879,64891,64901,64919,64921,64927,64937,64951,64969,
+64997,65003,65011,65027,65029,65033,65053,65063,65071,65089,65099,65101,65111,
+65119,65123,65129,65141,65147,65167,65171,65173,65179,65183,65203,65213,65239,
+65257,65267,65269,65287,65293,65309,65323,65327,65353,65357,65371,65381,65393,
+65407,65413,65419,65423,65437,65447,65449,65479,65497,65519,65521,65537
+};
+
+/* pr_limit - largest prime in the prime table */
+const ubig *const pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];
diff --git a/usr.bin/primes/primes.c b/usr.bin/primes/primes.c
new file mode 100644
index 0000000..a1c95c2
--- /dev/null
+++ b/usr.bin/primes/primes.c
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Landon Curt Noll.
+ *
+ * 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. 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+/*
+ * primes - generate a table of primes between two values
+ *
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ *
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ *
+ * usage:
+ * primes [-h] [start [stop]]
+ *
+ * Print primes >= start and < stop. If stop is omitted,
+ * the value 4294967295 (2^32-1) is assumed. If start is
+ * omitted, start is read from standard input.
+ *
+ * validation check: there are 664579 primes between 0 and 10^7
+ */
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "primes.h"
+
+/*
+ * Eratosthenes sieve table
+ *
+ * We only sieve the odd numbers. The base of our sieve windows are always
+ * odd. If the base of table is 1, table[i] represents 2*i-1. After the
+ * sieve, table[i] == 1 if and only if 2*i-1 is prime.
+ *
+ * We make TABSIZE large to reduce the overhead of inner loop setup.
+ */
+static char table[TABSIZE]; /* Eratosthenes sieve of odd numbers */
+
+static int hflag;
+
+static void primes(ubig, ubig);
+static ubig read_num_buf(void);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ ubig start; /* where to start generating */
+ ubig stop; /* don't generate at or above this value */
+ int ch;
+ char *p;
+
+ while ((ch = getopt(argc, argv, "h")) != -1)
+ switch (ch) {
+ case 'h':
+ hflag++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ start = 0;
+ stop = SPSPMAX;
+
+ /*
+ * Convert low and high args. Strtoumax(3) sets errno to
+ * ERANGE if the number is too large, but, if there's
+ * a leading minus sign it returns the negation of the
+ * result of the conversion, which we'd rather disallow.
+ */
+ switch (argc) {
+ case 2:
+ /* Start and stop supplied on the command line. */
+ if (argv[0][0] == '-' || argv[1][0] == '-')
+ errx(1, "negative numbers aren't permitted.");
+
+ errno = 0;
+ start = strtoumax(argv[0], &p, 0);
+ if (errno)
+ err(1, "%s", argv[0]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[0]);
+
+ errno = 0;
+ stop = strtoumax(argv[1], &p, 0);
+ if (errno)
+ err(1, "%s", argv[1]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[1]);
+ if (stop > SPSPMAX)
+ errx(1, "%s: stop value too large.", argv[1]);
+ break;
+ case 1:
+ /* Start on the command line. */
+ if (argv[0][0] == '-')
+ errx(1, "negative numbers aren't permitted.");
+
+ errno = 0;
+ start = strtoumax(argv[0], &p, 0);
+ if (errno)
+ err(1, "%s", argv[0]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[0]);
+ break;
+ case 0:
+ start = read_num_buf();
+ break;
+ default:
+ usage();
+ }
+
+ if (start > stop)
+ errx(1, "start value must be less than stop value.");
+ primes(start, stop);
+ return (0);
+}
+
+/*
+ * read_num_buf --
+ * This routine returns a number n, where 0 <= n && n <= BIG.
+ */
+static ubig
+read_num_buf(void)
+{
+ ubig val;
+ char *p, buf[LINE_MAX]; /* > max number of digits. */
+
+ for (;;) {
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (ferror(stdin))
+ err(1, "stdin");
+ exit(0);
+ }
+ for (p = buf; isblank(*p); ++p);
+ if (*p == '\n' || *p == '\0')
+ continue;
+ if (*p == '-')
+ errx(1, "negative numbers aren't permitted.");
+ errno = 0;
+ val = strtoumax(buf, &p, 0);
+ if (errno)
+ err(1, "%s", buf);
+ if (*p != '\n')
+ errx(1, "%s: illegal numeric format.", buf);
+ return (val);
+ }
+}
+
+/*
+ * primes - sieve and print primes from start up to and but not including stop
+ */
+static void
+primes(ubig start, ubig stop)
+{
+ char *q; /* sieve spot */
+ ubig factor; /* index and factor */
+ char *tab_lim; /* the limit to sieve on the table */
+ const ubig *p; /* prime table pointer */
+ ubig fact_lim; /* highest prime for current block */
+ ubig mod; /* temp storage for mod */
+
+ /*
+ * A number of systems can not convert double values into unsigned
+ * longs when the values are larger than the largest signed value.
+ * We don't have this problem, so we can go all the way to BIG.
+ */
+ if (start < 3) {
+ start = (ubig)2;
+ }
+ if (stop < 3) {
+ stop = (ubig)2;
+ }
+ if (stop <= start) {
+ return;
+ }
+
+ /*
+ * be sure that the values are odd, or 2
+ */
+ if (start != 2 && (start&0x1) == 0) {
+ ++start;
+ }
+ if (stop != 2 && (stop&0x1) == 0) {
+ ++stop;
+ }
+
+ /*
+ * quick list of primes <= pr_limit
+ */
+ if (start <= *pr_limit) {
+ /* skip primes up to the start value */
+ for (p = &prime[0], factor = prime[0];
+ factor < stop && p <= pr_limit; factor = *(++p)) {
+ if (factor >= start) {
+ printf(hflag ? "%" PRIx64 "\n" : "%" PRIu64 "\n", factor);
+ }
+ }
+ /* return early if we are done */
+ if (p <= pr_limit) {
+ return;
+ }
+ start = *pr_limit+2;
+ }
+
+ /*
+ * we shall sieve a bytemap window, note primes and move the window
+ * upward until we pass the stop point
+ */
+ while (start < stop) {
+ /*
+ * factor out 3, 5, 7, 11 and 13
+ */
+ /* initial pattern copy */
+ factor = (start%(2*3*5*7*11*13))/2; /* starting copy spot */
+ memcpy(table, &pattern[factor], pattern_size-factor);
+ /* main block pattern copies */
+ for (fact_lim=pattern_size-factor;
+ fact_lim+pattern_size<=TABSIZE; fact_lim+=pattern_size) {
+ memcpy(&table[fact_lim], pattern, pattern_size);
+ }
+ /* final block pattern copy */
+ memcpy(&table[fact_lim], pattern, TABSIZE-fact_lim);
+
+ /*
+ * sieve for primes 17 and higher
+ */
+ /* note highest useful factor and sieve spot */
+ if (stop-start > TABSIZE+TABSIZE) {
+ tab_lim = &table[TABSIZE]; /* sieve it all */
+ fact_lim = sqrt(start+1.0+TABSIZE+TABSIZE);
+ } else {
+ tab_lim = &table[(stop-start)/2]; /* partial sieve */
+ fact_lim = sqrt(stop+1.0);
+ }
+ /* sieve for factors >= 17 */
+ factor = 17; /* 17 is first prime to use */
+ p = &prime[7]; /* 19 is next prime, pi(19)=7 */
+ do {
+ /* determine the factor's initial sieve point */
+ mod = start%factor;
+ if (mod & 0x1) {
+ q = &table[(factor-mod)/2];
+ } else {
+ q = &table[mod ? factor-(mod/2) : 0];
+ }
+ /* sive for our current factor */
+ for ( ; q < tab_lim; q += factor) {
+ *q = '\0'; /* sieve out a spot */
+ }
+ factor = *p++;
+ } while (factor <= fact_lim);
+
+ /*
+ * print generated primes
+ */
+ for (q = table; q < tab_lim; ++q, start+=2) {
+ if (*q) {
+ if (start > SIEVEMAX) {
+ if (!isprime(start))
+ continue;
+ }
+ printf(hflag ? "%" PRIx64 "\n" : "%" PRIu64 "\n", start);
+ }
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: primes [-h] [start [stop]]\n");
+ exit(1);
+}
diff --git a/usr.bin/primes/primes.h b/usr.bin/primes/primes.h
new file mode 100644
index 0000000..3a18fc7
--- /dev/null
+++ b/usr.bin/primes/primes.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Landon Curt Noll.
+ *
+ * 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. 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.
+ *
+ * @(#)primes.h 8.2 (Berkeley) 3/1/94
+ * $FreeBSD$
+ */
+
+/*
+ * primes - generate a table of primes between two values
+ *
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ *
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ */
+
+#include <stdint.h>
+
+/* ubig is the type that holds a large unsigned value */
+typedef uint64_t ubig; /* must be >=32 bit unsigned value */
+#define BIG ULONG_MAX /* largest value will sieve */
+
+/* bytes in sieve table (must be > 3*5*7*11) */
+#define TABSIZE 256*1024
+
+/*
+ * prime[i] is the (i-1)th prime.
+ *
+ * We are able to sieve 2^32-1 because this byte table yields all primes
+ * up to 65537 and 65537^2 > 2^32-1.
+ */
+extern const ubig prime[];
+extern const ubig *const pr_limit; /* largest prime in the prime array */
+
+/* Maximum size sieving alone can handle. */
+#define SIEVEMAX 4295098368ULL
+
+/*
+ * To avoid excessive sieves for small factors, we use the table below to
+ * setup our sieve blocks. Each element represents an odd number starting
+ * with 1. All non-zero elements are factors of 3, 5, 7, 11 and 13.
+ */
+extern const char pattern[];
+extern const size_t pattern_size; /* length of pattern array */
+
+/* Test for primality using strong pseudoprime tests. */
+int isprime(ubig);
+
+/* Maximum value which the SPSP code can handle. */
+#define SPSPMAX 3825123056546413050ULL
diff --git a/usr.bin/primes/spsp.c b/usr.bin/primes/spsp.c
new file mode 100644
index 0000000..f61acd6
--- /dev/null
+++ b/usr.bin/primes/spsp.c
@@ -0,0 +1,181 @@
+/*-
+ * Copyright (c) 2014 Colin Percival
+ * 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 <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "primes.h"
+
+/* Return a * b % n, where 0 <= a, b < 2^63, 0 < n < 2^63. */
+static uint64_t
+mulmod(uint64_t a, uint64_t b, uint64_t n)
+{
+ uint64_t x = 0;
+
+ while (b != 0) {
+ if (b & 1)
+ x = (x + a) % n;
+ a = (a + a) % n;
+ b >>= 1;
+ }
+
+ return (x);
+}
+
+/* Return a^r % n, where 0 <= a < 2^63, 0 < n < 2^63. */
+static uint64_t
+powmod(uint64_t a, uint64_t r, uint64_t n)
+{
+ uint64_t x = 1;
+
+ while (r != 0) {
+ if (r & 1)
+ x = mulmod(a, x, n);
+ a = mulmod(a, a, n);
+ r >>= 1;
+ }
+
+ return (x);
+}
+
+/* Return non-zero if n is a strong pseudoprime to base p. */
+static int
+spsp(uint64_t n, uint64_t p)
+{
+ uint64_t x;
+ uint64_t r = n - 1;
+ int k = 0;
+
+ /* Compute n - 1 = 2^k * r. */
+ while ((r & 1) == 0) {
+ k++;
+ r >>= 1;
+ }
+
+ /* Compute x = p^r mod n. If x = 1, n is a p-spsp. */
+ x = powmod(p, r, n);
+ if (x == 1)
+ return (1);
+
+ /* Compute x^(2^i) for 0 <= i < n. If any are -1, n is a p-spsp. */
+ while (k > 0) {
+ if (x == n - 1)
+ return (1);
+ x = powmod(x, 2, n);
+ k--;
+ }
+
+ /* Not a p-spsp. */
+ return (0);
+}
+
+/* Test for primality using strong pseudoprime tests. */
+int
+isprime(ubig _n)
+{
+ uint64_t n = _n;
+
+ /*
+ * Values from:
+ * C. Pomerance, J.L. Selfridge, and S.S. Wagstaff, Jr.,
+ * The pseudoprimes to 25 * 10^9, Math. Comp. 35(151):1003-1026, 1980.
+ */
+
+ /* No SPSPs to base 2 less than 2047. */
+ if (!spsp(n, 2))
+ return (0);
+ if (n < 2047ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3 less than 1373653. */
+ if (!spsp(n, 3))
+ return (0);
+ if (n < 1373653ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3,5 less than 25326001. */
+ if (!spsp(n, 5))
+ return (0);
+ if (n < 25326001ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3,5,7 less than 3215031751. */
+ if (!spsp(n, 7))
+ return (0);
+ if (n < 3215031751ULL)
+ return (1);
+
+ /*
+ * Values from:
+ * G. Jaeschke, On strong pseudoprimes to several bases,
+ * Math. Comp. 61(204):915-926, 1993.
+ */
+
+ /* No SPSPs to bases 2,3,5,7,11 less than 2152302898747. */
+ if (!spsp(n, 11))
+ return (0);
+ if (n < 2152302898747ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3,5,7,11,13 less than 3474749660383. */
+ if (!spsp(n, 13))
+ return (0);
+ if (n < 3474749660383ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3,5,7,11,13,17 less than 341550071728321. */
+ if (!spsp(n, 17))
+ return (0);
+ if (n < 341550071728321ULL)
+ return (1);
+
+ /* No SPSPs to bases 2,3,5,7,11,13,17,19 less than 341550071728321. */
+ if (!spsp(n, 19))
+ return (0);
+ if (n < 341550071728321ULL)
+ return (1);
+
+ /*
+ * Value from:
+ * Y. Jiang and Y. Deng, Strong pseudoprimes to the first eight prime
+ * bases, Math. Comp. 83(290):2915-2924, 2014.
+ */
+
+ /* No SPSPs to bases 2..23 less than 3825123056546413051. */
+ if (!spsp(n, 23))
+ return (0);
+ if (n < 3825123056546413051)
+ return (1);
+
+ /* We can't handle values larger than this. */
+ assert(n <= SPSPMAX);
+
+ /* UNREACHABLE */
+ return (0);
+}
diff --git a/usr.bin/printenv/Makefile b/usr.bin/printenv/Makefile
new file mode 100644
index 0000000..bcb5952
--- /dev/null
+++ b/usr.bin/printenv/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= printenv
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/printenv/Makefile.depend b/usr.bin/printenv/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/printenv/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/printenv/printenv.1 b/usr.bin/printenv/printenv.1
new file mode 100644
index 0000000..4444375
--- /dev/null
+++ b/usr.bin/printenv/printenv.1
@@ -0,0 +1,84 @@
+.\" Copyright (c) 1980, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\" 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.
+.\"
+.\" @(#)printenv.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 12, 2003
+.Dt PRINTENV 1
+.Os
+.Sh NAME
+.Nm printenv
+.Nd print out the environment
+.Sh SYNOPSIS
+.Nm
+.Op Ar name
+.Sh DESCRIPTION
+The
+.Nm
+utility prints out the names and values of the variables in the environment,
+with one name/value pair per line.
+If
+.Ar name
+is specified, only
+its value is printed.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr env 1 ,
+.Xr sh 1 ,
+.Xr environ 7
+.Sh STANDARDS
+The
+.Nm
+utility is provided for compatibility with earlier
+.Bx
+and
+.Fx
+releases and is not specified by any standards.
+The functionality of
+.Nm
+can be duplicated with the
+.Xr echo 1
+and
+.Xr env 1
+utilities.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/printenv/printenv.c b/usr.bin/printenv/printenv.c
new file mode 100644
index 0000000..315833e
--- /dev/null
+++ b/usr.bin/printenv/printenv.c
@@ -0,0 +1,99 @@
+/*-
+ * Copyright (c) 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) 1987, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)printenv.c 8.2 (Berkeley) 5/4/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+void usage(void);
+extern char **environ;
+
+/*
+ * printenv
+ *
+ * Bill Joy, UCB
+ * February, 1979
+ */
+int
+main(int argc, char *argv[])
+{
+ char *cp, **ep;
+ size_t len;
+ int ch;
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0) {
+ for (ep = environ; *ep; ep++)
+ (void)printf("%s\n", *ep);
+ exit(0);
+ }
+ len = strlen(*argv);
+ for (ep = environ; *ep; ep++)
+ if (!memcmp(*ep, *argv, len)) {
+ cp = *ep + len;
+ if (!*cp || *cp == '=') {
+ (void)printf("%s\n", *cp ? cp + 1 : cp);
+ exit(0);
+ }
+ }
+ exit(1);
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: printenv [name]\n");
+ exit(1);
+}
diff --git a/usr.bin/printf/Makefile b/usr.bin/printf/Makefile
new file mode 100644
index 0000000..759bcf7
--- /dev/null
+++ b/usr.bin/printf/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= printf
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/printf/Makefile.depend b/usr.bin/printf/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/printf/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/printf/printf.1 b/usr.bin/printf/printf.1
new file mode 100644
index 0000000..7256b53d
--- /dev/null
+++ b/usr.bin/printf/printf.1
@@ -0,0 +1,382 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)printf.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2014
+.Dt PRINTF 1
+.Os
+.Sh NAME
+.Nm printf
+.Nd formatted output
+.Sh SYNOPSIS
+.Nm
+.Ar format Op Ar arguments ...
+.Sh DESCRIPTION
+The
+.Nm
+utility formats and prints its arguments, after the first, under control
+of the
+.Ar format .
+The
+.Ar format
+is a character string which contains three types of objects: plain characters,
+which are simply copied to standard output, character escape sequences which
+are converted and copied to the standard output, and format specifications,
+each of which causes printing of the next successive
+.Ar argument .
+.Pp
+The
+.Ar arguments
+after the first are treated as strings if the corresponding format is
+either
+.Cm c , b
+or
+.Cm s ;
+otherwise it is evaluated as a C constant, with the following extensions:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+A leading plus or minus sign is allowed.
+.It
+If the leading character is a single or double quote, the value is the
+character code of the next character.
+.El
+.Pp
+The format string is reused as often as necessary to satisfy the
+.Ar arguments .
+Any extra format specifications are evaluated with zero or the null
+string.
+.Pp
+Character escape sequences are in backslash notation as defined in the
+.St -ansiC ,
+with extensions.
+The characters and their meanings
+are as follows:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It Cm \ea
+Write a <bell> character.
+.It Cm \eb
+Write a <backspace> character.
+.It Cm \ec
+Ignore remaining characters in this string.
+.It Cm \ef
+Write a <form-feed> character.
+.It Cm \en
+Write a <new-line> character.
+.It Cm \er
+Write a <carriage return> character.
+.It Cm \et
+Write a <tab> character.
+.It Cm \ev
+Write a <vertical tab> character.
+.It Cm \e\'
+Write a <single quote> character.
+.It Cm \e\e
+Write a backslash character.
+.It Cm \e Ns Ar num
+Write a byte whose
+value is the 1-, 2-, or 3-digit
+octal number
+.Ar num .
+Multibyte characters can be constructed using multiple
+.Cm \e Ns Ar num
+sequences.
+.El
+.Pp
+Each format specification is introduced by the percent character
+(``%'').
+The remainder of the format specification includes,
+in the following order:
+.Bl -tag -width Ds
+.It "Zero or more of the following flags:"
+.Bl -tag -width Ds
+.It Cm #
+A `#' character
+specifying that the value should be printed in an ``alternate form''.
+For
+.Cm b , c , d , s
+and
+.Cm u
+formats, this option has no effect.
+For the
+.Cm o
+formats the precision of the number is increased to force the first
+character of the output string to a zero.
+For the
+.Cm x
+.Pq Cm X
+format, a non-zero result has the string
+.Li 0x
+.Pq Li 0X
+prepended to it.
+For
+.Cm a , A , e , E , f , F , g
+and
+.Cm G
+formats, the result will always contain a decimal point, even if no
+digits follow the point (normally, a decimal point only appears in the
+results of those formats if a digit follows the decimal point).
+For
+.Cm g
+and
+.Cm G
+formats, trailing zeros are not removed from the result as they
+would otherwise be;
+.It Cm \&\-
+A minus sign `\-' which specifies
+.Em left adjustment
+of the output in the indicated field;
+.It Cm \&+
+A `+' character specifying that there should always be
+a sign placed before the number when using signed formats.
+.It Sq \&\ \&
+A space specifying that a blank should be left before a positive number
+for a signed format.
+A `+' overrides a space if both are used;
+.It Cm \&0
+A zero `0' character indicating that zero-padding should be used
+rather than blank-padding.
+A `\-' overrides a `0' if both are used;
+.El
+.It "Field Width:"
+An optional digit string specifying a
+.Em field width ;
+if the output string has fewer bytes than the field width it will
+be blank-padded on the left (or right, if the left-adjustment indicator
+has been given) to make up the field width (note that a leading zero
+is a flag, but an embedded zero is part of a field width);
+.It Precision:
+An optional period,
+.Sq Cm \&.\& ,
+followed by an optional digit string giving a
+.Em precision
+which specifies the number of digits to appear after the decimal point,
+for
+.Cm e
+and
+.Cm f
+formats, or the maximum number of bytes to be printed
+from a string; if the digit string is missing, the precision is treated
+as zero;
+.It Format:
+A character which indicates the type of format to use (one of
+.Cm diouxXfFeEgGaAcsb ) .
+The uppercase formats differ from their lowercase counterparts only in
+that the output of the former is entirely in uppercase.
+The floating-point format specifiers
+.Pq Cm fFeEgGaA
+may be prefixed by an
+.Cm L
+to request that additional precision be used, if available.
+.El
+.Pp
+A field width or precision may be
+.Sq Cm \&*
+instead of a digit string.
+In this case an
+.Ar argument
+supplies the field width or precision.
+.Pp
+The format characters and their meanings are:
+.Bl -tag -width Fl
+.It Cm diouXx
+The
+.Ar argument
+is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
+or unsigned hexadecimal (X or x), respectively.
+.It Cm fF
+The
+.Ar argument
+is printed in the style `[\-]ddd.ddd' where the number of d's
+after the decimal point is equal to the precision specification for
+the argument.
+If the precision is missing, 6 digits are given; if the precision
+is explicitly 0, no digits and no decimal point are printed.
+The values \*[If] and \*[Na] are printed as
+.Ql inf
+and
+.Ql nan ,
+respectively.
+.It Cm eE
+The
+.Ar argument
+is printed in the style
+.Cm e
+.Sm off
+.Sq Op - Ar d.ddd No \(+- Ar dd
+.Sm on
+where there
+is one digit before the decimal point and the number after is equal to
+the precision specification for the argument; when the precision is
+missing, 6 digits are produced.
+The values \*[If] and \*[Na] are printed as
+.Ql inf
+and
+.Ql nan ,
+respectively.
+.It Cm gG
+The
+.Ar argument
+is printed in style
+.Cm f
+.Pq Cm F
+or in style
+.Cm e
+.Pq Cm E
+whichever gives full precision in minimum space.
+.It Cm aA
+The
+.Ar argument
+is printed in style
+.Sm off
+.Sq Op - Ar h.hhh No \(+- Li p Ar d
+.Sm on
+where there is one digit before the hexadecimal point and the number
+after is equal to the precision specification for the argument;
+when the precision is missing, enough digits are produced to convey
+the argument's exact double-precision floating-point representation.
+The values \*[If] and \*[Na] are printed as
+.Ql inf
+and
+.Ql nan ,
+respectively.
+.It Cm c
+The first byte of
+.Ar argument
+is printed.
+.It Cm s
+Bytes from the string
+.Ar argument
+are printed until the end is reached or until the number of bytes
+indicated by the precision specification is reached; however if the
+precision is 0 or missing, the string is printed entirely.
+.It Cm b
+As for
+.Cm s ,
+but interpret character escapes in backslash notation in the string
+.Ar argument .
+The permitted escape sequences are slightly different in that
+octal escapes are
+.Cm \e0 Ns Ar num
+instead of
+.Cm \e Ns Ar num .
+.It Cm n$
+Allows reordering of the output according to
+.Ar argument .
+.It Cm \&%
+Print a `%'; no argument is used.
+.El
+.Pp
+The decimal point
+character is defined in the program's locale (category
+.Dv LC_NUMERIC ) .
+.Pp
+In no case does a non-existent or small field width cause truncation of
+a field; padding takes place only if the specified field width exceeds
+the actual width.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+The traditional
+.Bx
+behavior of converting arguments of numeric formats not beginning
+with a digit to the
+.Tn ASCII
+code of the first character is not supported.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr echo 1 ,
+.Xr sh 1 ,
+.Xr printf 3
+.Sh STANDARDS
+The
+.Nm
+command is expected to be compatible with the
+.St -p1003.2
+specification.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 Reno .
+It is modeled
+after the standard library function,
+.Xr printf 3 .
+.Sh CAVEATS
+.Tn ANSI
+hexadecimal character constants were deliberately not provided.
+.Pp
+Trying to print a dash ("-") as the first character causes
+.Nm
+to interpret the dash as a program argument.
+.Nm --
+must be used before
+.Ar format .
+.Pp
+If the locale contains multibyte characters
+(such as UTF-8),
+the
+.Cm c
+format and
+.Cm b
+and
+.Cm s
+formats with a precision
+may not operate as expected.
+.Sh BUGS
+Since the floating point numbers are translated from
+.Tn ASCII
+to floating-point and
+then back again, floating-point precision may be lost.
+(By default, the number is translated to an IEEE-754 double-precision
+value before being printed.
+The
+.Cm L
+modifier may produce additional precision, depending on the hardware platform.)
+.Pp
+The escape sequence \e000 is the string terminator.
+When present in the argument for the
+.Cm b
+format, the argument will be truncated at the \e000 character.
+.Pp
+Multibyte characters are not recognized in format strings (this is only
+a problem if
+.Ql %
+can appear inside a multibyte character).
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
new file mode 100644
index 0000000..8636cc1
--- /dev/null
+++ b/usr.bin/printf/printf.c
@@ -0,0 +1,686 @@
+/*-
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 1989, 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.
+ */
+/*
+ * Important: This file is used both as a standalone program /usr/bin/printf
+ * and as a builtin for /bin/sh (#define SHELL).
+ */
+
+#ifndef SHELL
+#ifndef lint
+static char const copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+#endif
+
+#ifndef lint
+#if 0
+static char const sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#ifdef SHELL
+#define main printfcmd
+#include "bltin/bltin.h"
+#include "options.h"
+#endif
+
+#define PF(f, func) do { \
+ char *b = NULL; \
+ if (havewidth) \
+ if (haveprec) \
+ (void)asprintf(&b, f, fieldwidth, precision, func); \
+ else \
+ (void)asprintf(&b, f, fieldwidth, func); \
+ else if (haveprec) \
+ (void)asprintf(&b, f, precision, func); \
+ else \
+ (void)asprintf(&b, f, func); \
+ if (b) { \
+ (void)fputs(b, stdout); \
+ free(b); \
+ } \
+} while (0)
+
+static int asciicode(void);
+static char *printf_doformat(char *, int *);
+static int escape(char *, int, size_t *);
+static int getchr(void);
+static int getfloating(long double *, int);
+static int getint(int *);
+static int getnum(intmax_t *, uintmax_t *, int);
+static const char
+ *getstr(void);
+static char *mknum(char *, char);
+static void usage(void);
+
+static const char digits[] = "0123456789";
+
+static char end_fmt[1];
+
+static int myargc;
+static char **myargv;
+static char **gargv;
+static char **maxargv;
+
+int
+main(int argc, char *argv[])
+{
+ size_t len;
+ int end, rval;
+ char *format, *fmt, *start;
+#ifndef SHELL
+ int ch;
+
+ (void) setlocale(LC_ALL, "");
+#endif
+
+#ifdef SHELL
+ nextopt("");
+ argc -= argptr - argv;
+ argv = argptr;
+#else
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch (ch) {
+ case '?':
+ default:
+ usage();
+ return (1);
+ }
+ argc -= optind;
+ argv += optind;
+#endif
+
+ if (argc < 1) {
+ usage();
+ return (1);
+ }
+
+#ifdef SHELL
+ INTOFF;
+#endif
+ /*
+ * Basic algorithm is to scan the format string for conversion
+ * specifications -- once one is found, find out if the field
+ * width or precision is a '*'; if it is, gather up value. Note,
+ * format strings are reused as necessary to use up the provided
+ * arguments, arguments of zero/null string are provided to use
+ * up the format string.
+ */
+ fmt = format = *argv;
+ escape(fmt, 1, &len); /* backslash interpretation */
+ rval = end = 0;
+ gargv = ++argv;
+
+ for (;;) {
+ maxargv = gargv;
+
+ myargv = gargv;
+ for (myargc = 0; gargv[myargc]; myargc++)
+ /* nop */;
+ start = fmt;
+ while (fmt < format + len) {
+ if (fmt[0] == '%') {
+ fwrite(start, 1, fmt - start, stdout);
+ if (fmt[1] == '%') {
+ /* %% prints a % */
+ putchar('%');
+ fmt += 2;
+ } else {
+ fmt = printf_doformat(fmt, &rval);
+ if (fmt == NULL || fmt == end_fmt) {
+#ifdef SHELL
+ INTON;
+#endif
+ return (fmt == NULL ? 1 : rval);
+ }
+ end = 0;
+ }
+ start = fmt;
+ } else
+ fmt++;
+ if (gargv > maxargv)
+ maxargv = gargv;
+ }
+ gargv = maxargv;
+
+ if (end == 1) {
+ warnx("missing format character");
+#ifdef SHELL
+ INTON;
+#endif
+ return (1);
+ }
+ fwrite(start, 1, fmt - start, stdout);
+ if (!*gargv) {
+#ifdef SHELL
+ INTON;
+#endif
+ return (rval);
+ }
+ /* Restart at the beginning of the format string. */
+ fmt = format;
+ end = 1;
+ }
+ /* NOTREACHED */
+}
+
+
+static char *
+printf_doformat(char *fmt, int *rval)
+{
+ static const char skip1[] = "#'-+ 0";
+ int fieldwidth, haveprec, havewidth, mod_ldbl, precision;
+ char convch, nextch;
+ char start[strlen(fmt) + 1];
+ char **fargv;
+ char *dptr;
+ int l;
+
+ dptr = start;
+ *dptr++ = '%';
+ *dptr = 0;
+
+ fmt++;
+
+ /* look for "n$" field index specifier */
+ l = strspn(fmt, digits);
+ if ((l > 0) && (fmt[l] == '$')) {
+ int idx = atoi(fmt);
+ if (idx <= myargc) {
+ gargv = &myargv[idx - 1];
+ } else {
+ gargv = &myargv[myargc];
+ }
+ if (gargv > maxargv)
+ maxargv = gargv;
+ fmt += l + 1;
+
+ /* save format argument */
+ fargv = gargv;
+ } else {
+ fargv = NULL;
+ }
+
+ /* skip to field width */
+ while (*fmt && strchr(skip1, *fmt) != NULL) {
+ *dptr++ = *fmt++;
+ *dptr = 0;
+ }
+
+ if (*fmt == '*') {
+
+ fmt++;
+ 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))
+ return (NULL);
+ if (gargv > maxargv)
+ maxargv = gargv;
+ havewidth = 1;
+
+ *dptr++ = '*';
+ *dptr = 0;
+ } else {
+ havewidth = 0;
+
+ /* skip to possible '.', get following precision */
+ while (isdigit(*fmt)) {
+ *dptr++ = *fmt++;
+ *dptr = 0;
+ }
+ }
+
+ if (*fmt == '.') {
+ /* precision present? */
+ fmt++;
+ *dptr++ = '.';
+
+ if (*fmt == '*') {
+
+ fmt++;
+ 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))
+ return (NULL);
+ if (gargv > maxargv)
+ maxargv = gargv;
+ haveprec = 1;
+ *dptr++ = '*';
+ *dptr = 0;
+ } else {
+ haveprec = 0;
+
+ /* skip to conversion char */
+ while (isdigit(*fmt)) {
+ *dptr++ = *fmt++;
+ *dptr = 0;
+ }
+ }
+ } else
+ haveprec = 0;
+ if (!*fmt) {
+ warnx("missing format character");
+ return (NULL);
+ }
+ *dptr++ = *fmt;
+ *dptr = 0;
+
+ /*
+ * Look for a length modifier. POSIX doesn't have these, so
+ * we only support them for floating-point conversions, which
+ * are extensions. This is useful because the L modifier can
+ * be used to gain extra range and precision, while omitting
+ * it is more likely to produce consistent results on different
+ * architectures. This is not so important for integers
+ * because overflow is the only bad thing that can happen to
+ * them, but consider the command printf %a 1.1
+ */
+ if (*fmt == 'L') {
+ mod_ldbl = 1;
+ fmt++;
+ if (!strchr("aAeEfFgG", *fmt)) {
+ warnx("bad modifier L for %%%c", *fmt);
+ return (NULL);
+ }
+ } else {
+ mod_ldbl = 0;
+ }
+
+ /* save the current arg offset, and set to the format arg */
+ if (fargv != NULL) {
+ gargv = fargv;
+ }
+
+ convch = *fmt;
+ nextch = *++fmt;
+
+ *fmt = '\0';
+ switch (convch) {
+ case 'b': {
+ size_t len;
+ char *p;
+ int getout;
+
+ p = strdup(getstr());
+ if (p == NULL) {
+ warnx("%s", strerror(ENOMEM));
+ return (NULL);
+ }
+ getout = escape(p, 0, &len);
+ fputs(p, stdout);
+ free(p);
+ if (getout)
+ return (end_fmt);
+ break;
+ }
+ case 'c': {
+ char p;
+
+ p = getchr();
+ PF(start, p);
+ break;
+ }
+ case 's': {
+ const char *p;
+
+ p = getstr();
+ PF(start, p);
+ break;
+ }
+ case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': {
+ char *f;
+ intmax_t val;
+ uintmax_t uval;
+ int signedconv;
+
+ signedconv = (convch == 'd' || convch == 'i');
+ if ((f = mknum(start, convch)) == NULL)
+ return (NULL);
+ if (getnum(&val, &uval, signedconv))
+ *rval = 1;
+ if (signedconv)
+ PF(f, val);
+ else
+ PF(f, uval);
+ break;
+ }
+ case 'e': case 'E':
+ case 'f': case 'F':
+ case 'g': case 'G':
+ case 'a': case 'A': {
+ long double p;
+
+ if (getfloating(&p, mod_ldbl))
+ *rval = 1;
+ if (mod_ldbl)
+ PF(start, p);
+ else
+ PF(start, (double)p);
+ break;
+ }
+ default:
+ warnx("illegal format character %c", convch);
+ return (NULL);
+ }
+ *fmt = nextch;
+ /* return the gargv to the next element */
+ return (fmt);
+}
+
+static char *
+mknum(char *str, char ch)
+{
+ static char *copy;
+ static size_t copy_size;
+ char *newcopy;
+ size_t len, newlen;
+
+ len = strlen(str) + 2;
+ if (len > copy_size) {
+ newlen = ((len + 1023) >> 10) << 10;
+ if ((newcopy = realloc(copy, newlen)) == NULL) {
+ warnx("%s", strerror(ENOMEM));
+ return (NULL);
+ }
+ copy = newcopy;
+ copy_size = newlen;
+ }
+
+ memmove(copy, str, len - 3);
+ copy[len - 3] = 'j';
+ copy[len - 2] = ch;
+ copy[len - 1] = '\0';
+ return (copy);
+}
+
+static int
+escape(char *fmt, int percent, size_t *len)
+{
+ char *save, *store, c;
+ int value;
+
+ for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) {
+ if (c != '\\') {
+ *store = c;
+ continue;
+ }
+ switch (*++fmt) {
+ case '\0': /* EOS, user error */
+ *store = '\\';
+ *++store = '\0';
+ *len = store - save;
+ return (0);
+ case '\\': /* backslash */
+ case '\'': /* single quote */
+ *store = *fmt;
+ break;
+ case 'a': /* bell/alert */
+ *store = '\a';
+ break;
+ case 'b': /* backspace */
+ *store = '\b';
+ break;
+ case 'c':
+ if (!percent) {
+ *store = '\0';
+ *len = store - save;
+ return (1);
+ }
+ *store = 'c';
+ break;
+ case 'f': /* form-feed */
+ *store = '\f';
+ break;
+ case 'n': /* newline */
+ *store = '\n';
+ break;
+ case 'r': /* carriage-return */
+ *store = '\r';
+ break;
+ case 't': /* horizontal tab */
+ *store = '\t';
+ break;
+ case 'v': /* vertical tab */
+ *store = '\v';
+ break;
+ /* octal constant */
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ c = (!percent && *fmt == '0') ? 4 : 3;
+ for (value = 0;
+ c-- && *fmt >= '0' && *fmt <= '7'; ++fmt) {
+ value <<= 3;
+ value += *fmt - '0';
+ }
+ --fmt;
+ if (percent && value == '%') {
+ *store++ = '%';
+ *store = '%';
+ } else
+ *store = (char)value;
+ break;
+ default:
+ *store = *fmt;
+ break;
+ }
+ }
+ *store = '\0';
+ *len = store - save;
+ return (0);
+}
+
+static int
+getchr(void)
+{
+ if (!*gargv)
+ return ('\0');
+ return ((int)**gargv++);
+}
+
+static const char *
+getstr(void)
+{
+ if (!*gargv)
+ return ("");
+ return (*gargv++);
+}
+
+static int
+getint(int *ip)
+{
+ intmax_t val;
+ uintmax_t uval;
+ int rval;
+
+ if (getnum(&val, &uval, 1))
+ return (1);
+ rval = 0;
+ if (val < INT_MIN || val > INT_MAX) {
+ warnx("%s: %s", *gargv, strerror(ERANGE));
+ rval = 1;
+ }
+ *ip = (int)val;
+ return (rval);
+}
+
+static int
+getnum(intmax_t *ip, uintmax_t *uip, int signedconv)
+{
+ char *ep;
+ int rval;
+
+ if (!*gargv) {
+ *ip = *uip = 0;
+ return (0);
+ }
+ if (**gargv == '"' || **gargv == '\'') {
+ if (signedconv)
+ *ip = asciicode();
+ else
+ *uip = asciicode();
+ return (0);
+ }
+ rval = 0;
+ errno = 0;
+ if (signedconv)
+ *ip = strtoimax(*gargv, &ep, 0);
+ else
+ *uip = strtoumax(*gargv, &ep, 0);
+ if (ep == *gargv) {
+ warnx("%s: expected numeric value", *gargv);
+ rval = 1;
+ }
+ else if (*ep != '\0') {
+ warnx("%s: not completely converted", *gargv);
+ rval = 1;
+ }
+ if (errno == ERANGE) {
+ warnx("%s: %s", *gargv, strerror(ERANGE));
+ rval = 1;
+ }
+ ++gargv;
+ return (rval);
+}
+
+static int
+getfloating(long double *dp, int mod_ldbl)
+{
+ char *ep;
+ int rval;
+
+ if (!*gargv) {
+ *dp = 0.0;
+ return (0);
+ }
+ if (**gargv == '"' || **gargv == '\'') {
+ *dp = asciicode();
+ return (0);
+ }
+ rval = 0;
+ errno = 0;
+ if (mod_ldbl)
+ *dp = strtold(*gargv, &ep);
+ else
+ *dp = strtod(*gargv, &ep);
+ if (ep == *gargv) {
+ warnx("%s: expected numeric value", *gargv);
+ rval = 1;
+ } else if (*ep != '\0') {
+ warnx("%s: not completely converted", *gargv);
+ rval = 1;
+ }
+ if (errno == ERANGE) {
+ warnx("%s: %s", *gargv, strerror(ERANGE));
+ rval = 1;
+ }
+ ++gargv;
+ return (rval);
+}
+
+static int
+asciicode(void)
+{
+ int ch;
+ wchar_t wch;
+ mbstate_t mbs;
+
+ ch = (unsigned char)**gargv;
+ if (ch == '\'' || ch == '"') {
+ memset(&mbs, 0, sizeof(mbs));
+ switch (mbrtowc(&wch, *gargv + 1, MB_LEN_MAX, &mbs)) {
+ case (size_t)-2:
+ case (size_t)-1:
+ wch = (unsigned char)gargv[0][1];
+ break;
+ case 0:
+ wch = 0;
+ break;
+ }
+ ch = wch;
+ }
+ ++gargv;
+ return (ch);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: printf format [arguments ...]\n");
+}
diff --git a/usr.bin/printf/tests/Makefile b/usr.bin/printf/tests/Makefile
new file mode 100644
index 0000000..04b43fd
--- /dev/null
+++ b/usr.bin/printf/tests/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.b.out
+${PACKAGE}FILES+= regress.d.out
+${PACKAGE}FILES+= regress.f.out
+${PACKAGE}FILES+= regress.l1.out
+${PACKAGE}FILES+= regress.l2.out
+${PACKAGE}FILES+= regress.m1.out
+${PACKAGE}FILES+= regress.m2.out
+${PACKAGE}FILES+= regress.m3.out
+${PACKAGE}FILES+= regress.m4.out
+${PACKAGE}FILES+= regress.m5.out
+${PACKAGE}FILES+= regress.missingpos1.out
+${PACKAGE}FILES+= regress.s.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.zero.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/printf/tests/Makefile.depend b/usr.bin/printf/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/printf/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/printf/tests/legacy_test.sh b/usr.bin/printf/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/printf/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/printf/tests/regress.b.out b/usr.bin/printf/tests/regress.b.out
new file mode 100644
index 0000000..0373d93
--- /dev/null
+++ b/usr.bin/printf/tests/regress.b.out
@@ -0,0 +1 @@
+abcdef
diff --git a/usr.bin/printf/tests/regress.d.out b/usr.bin/printf/tests/regress.d.out
new file mode 100644
index 0000000..da83c08
--- /dev/null
+++ b/usr.bin/printf/tests/regress.d.out
@@ -0,0 +1 @@
+123, 123,00123,00123,00123
diff --git a/usr.bin/printf/tests/regress.f.out b/usr.bin/printf/tests/regress.f.out
new file mode 100644
index 0000000..127cb8a
--- /dev/null
+++ b/usr.bin/printf/tests/regress.f.out
@@ -0,0 +1 @@
+42.250000,-42.250 ,inf,nan
diff --git a/usr.bin/printf/tests/regress.l1.out b/usr.bin/printf/tests/regress.l1.out
new file mode 100644
index 0000000..9be0dc9
--- /dev/null
+++ b/usr.bin/printf/tests/regress.l1.out
@@ -0,0 +1 @@
+228
diff --git a/usr.bin/printf/tests/regress.l2.out b/usr.bin/printf/tests/regress.l2.out
new file mode 100644
index 0000000..9be0dc9
--- /dev/null
+++ b/usr.bin/printf/tests/regress.l2.out
@@ -0,0 +1 @@
+228
diff --git a/usr.bin/printf/tests/regress.m1.out b/usr.bin/printf/tests/regress.m1.out
new file mode 100644
index 0000000..a9e063e
--- /dev/null
+++ b/usr.bin/printf/tests/regress.m1.out
Binary files differ
diff --git a/usr.bin/printf/tests/regress.m2.out b/usr.bin/printf/tests/regress.m2.out
new file mode 100644
index 0000000..cf14915
--- /dev/null
+++ b/usr.bin/printf/tests/regress.m2.out
@@ -0,0 +1,2 @@
+abc
+cdef \ No newline at end of file
diff --git a/usr.bin/printf/tests/regress.m3.out b/usr.bin/printf/tests/regress.m3.out
new file mode 100644
index 0000000..bbe4e70
--- /dev/null
+++ b/usr.bin/printf/tests/regress.m3.out
@@ -0,0 +1,4 @@
+%abc
+%def
+%ghi
+%jkl
diff --git a/usr.bin/printf/tests/regress.m4.out b/usr.bin/printf/tests/regress.m4.out
new file mode 100644
index 0000000..5e0b5d4
--- /dev/null
+++ b/usr.bin/printf/tests/regress.m4.out
@@ -0,0 +1 @@
+0,0.000000,,
diff --git a/usr.bin/printf/tests/regress.m5.out b/usr.bin/printf/tests/regress.m5.out
new file mode 100644
index 0000000..2838468
--- /dev/null
+++ b/usr.bin/printf/tests/regress.m5.out
@@ -0,0 +1 @@
+-d
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.s.out b/usr.bin/printf/tests/regress.s.out
new file mode 100644
index 0000000..3d572b9
--- /dev/null
+++ b/usr.bin/printf/tests/regress.s.out
@@ -0,0 +1 @@
+abc,abc
diff --git a/usr.bin/printf/tests/regress.sh b/usr.bin/printf/tests/regress.sh
new file mode 100644
index 0000000..c9668a3
--- /dev/null
+++ b/usr.bin/printf/tests/regress.sh
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+REGRESSION_START($1)
+
+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')
+REGRESSION_TEST(`f', `printf "%f,%-8.3f,%f,%f\n" +42.25 -42.25 inf nan')
+REGRESSION_TEST(`l1', `LC_ALL=en_US.ISO8859-1 printf "%d\n" $(printf \"\\344)')
+REGRESSION_TEST(`l2', `LC_ALL=en_US.UTF-8 printf "%d\n" $(printf \"\\303\\244)')
+REGRESSION_TEST(`m1', `printf "%c%%%d\0\045\n" abc \"abc')
+REGRESSION_TEST(`m2', `printf "abc\n\cdef"')
+REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl')
+REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
+REGRESSION_TEST(`m5', `printf -- "-d\n"')
+REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
+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/printf/tests/regress.zero.out b/usr.bin/printf/tests/regress.zero.out
new file mode 100644
index 0000000..fa8f08c
--- /dev/null
+++ b/usr.bin/printf/tests/regress.zero.out
@@ -0,0 +1 @@
+150
diff --git a/usr.bin/procstat/Makefile b/usr.bin/procstat/Makefile
new file mode 100644
index 0000000..21f325f
--- /dev/null
+++ b/usr.bin/procstat/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+PROG= procstat
+MAN= procstat.1
+SRCS= procstat.c \
+ procstat_args.c \
+ procstat_auxv.c \
+ procstat_basic.c \
+ procstat_bin.c \
+ procstat_cred.c \
+ procstat_cs.c \
+ procstat_files.c \
+ procstat_kstack.c \
+ procstat_rlimit.c \
+ procstat_rusage.c \
+ procstat_sigs.c \
+ procstat_threads.c \
+ procstat_vm.c
+
+LIBADD+= procstat xo util sbuf
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/procstat/Makefile.depend b/usr.bin/procstat/Makefile.depend
new file mode 100644
index 0000000..5260cce
--- /dev/null
+++ b/usr.bin/procstat/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+ lib/libprocstat \
+ lib/libsbuf \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/procstat/procstat.1 b/usr.bin/procstat/procstat.1
new file mode 100644
index 0000000..68aaaee
--- /dev/null
+++ b/usr.bin/procstat/procstat.1
@@ -0,0 +1,562 @@
+.\"-
+.\" Copyright (c) 2007-2009 Robert N. M. Watson
+.\" 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 September 5, 2015
+.Dt PROCSTAT 1
+.Os
+.Sh NAME
+.Nm procstat
+.Nd get detailed process information
+.Sh SYNOPSIS
+.Nm
+.Op Fl -libxo
+.Op Fl CHhn
+.Op Fl w Ar interval
+.Op Fl b | c | e | f | i | j | k | l | r | s | S | t | v | x
+.Op Fl a | Ar pid | Ar core ...
+.Sh DESCRIPTION
+The
+.Nm
+utility displays detailed information about the processes identified by the
+.Ar pid
+arguments, or if the
+.Fl a
+flag is used, all processes.
+It can also display information extracted from a process core file, if
+the core file is specified as the argument.
+.Pp
+By default, basic process statistics are printed; one of the following
+options may be specified in order to select more detailed process information
+for printing:
+.Bl -tag -width indent
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.It Fl b
+Display binary information for the process.
+.It Fl c
+Display command line arguments for the process.
+.It Fl e
+Display environment variables for the process.
+.It Fl f
+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'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.
+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 S
+Display the cpuset information for the thread.
+.It Fl t
+Display thread information for the process.
+.It Fl v
+Display virtual memory mappings for the process.
+.It Fl x
+Display ELF auxiliary vector for the process.
+.El
+.Pp
+All options generate output in the format of a table, the first field of
+which is the process ID to which the row of information corresponds.
+The
+.Fl h
+flag may be used to suppress table headers.
+.Pp
+The
+.Fl w
+flag may be used to specify a wait interval at which to repeat the printing
+of the requested process information.
+If the
+.Fl w
+flag is not specified, the output will not repeat.
+.Pp
+The
+.Fl C
+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.
+The
+.Fl H
+flag is implied for the
+.Fl S
+mode.
+.Pp
+Information for VM, file descriptor, and cpuset options is available
+only to the owner of a process or the superuser.
+A cpuset value displayed as -1 means that the information is either invalid
+or not available.
+.Ss Binary Information
+Display the process ID, command, and path to the process binary:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It OSREL
+osreldate for process binary
+.It PATH
+path to process binary (if available)
+.El
+.Ss Command Line Arguments
+Display the process ID, command, and command line arguments:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+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
+per-file descriptor object information, such as object type and file system
+path.
+By default, the following information will be printed:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It FD
+file descriptor number or cwd/root/jail
+.It T
+file descriptor type
+.It V
+vnode type
+.It FLAGS
+file descriptor flags
+.It REF
+file descriptor reference count
+.It OFFSET
+file descriptor offset
+.It PRO
+network protocol
+.It NAME
+file path or socket addresses (if available)
+.El
+.Pp
+The following file descriptor types may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It c
+crypto
+.It e
+POSIX semaphore
+.It f
+fifo
+.It h
+shared memory
+.It k
+kqueue
+.It m
+message queue
+.It p
+pipe
+.It s
+socket
+.It t
+pseudo-terminal master
+.It v
+vnode
+.El
+.Pp
+The following vnode types may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It -
+not a vnode
+.It b
+block device
+.It c
+character device
+.It d
+directory
+.It f
+fifo
+.It l
+symbolic link
+.It r
+regular file
+.It s
+socket
+.It x
+revoked device
+.El
+.Pp
+The following file descriptor flags may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It r
+read
+.It w
+write
+.It a
+append
+.It s
+async
+.It f
+fsync
+.It n
+non-blocking
+.It d
+direct I/O
+.It l
+lock held
+.El
+.Pp
+If the
+.Fl C
+flag is specified, the vnode type, reference count, and offset fields will be
+omitted, and a new capabilities field will be included listing capabilities,
+as described in
+.Xr cap_rights_limit 2 ,
+present for each capability descriptor.
+.Ss Signal Disposition Information
+Display signal pending and disposition for a process:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It SIG
+signal name
+.It FLAGS
+process signal disposition details, three symbols
+.Bl -tag -width X -compact
+.It P
+if signal is pending in the global process queue, - otherwise
+.It I
+if signal delivery disposition is SIGIGN, - otherwise
+.It C
+if signal delivery is to catch it, - otherwise
+.El
+.El
+.Pp
+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's threads:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It TID
+thread ID
+.It COMM
+command
+.It SIG
+signal name
+.It FLAGS
+thread signal delivery status, two symbols
+.Bl -tag -width X -compact
+.It P
+if signal is pending for the thread, - otherwise
+.It B
+if signal is blocked in the thread signal mask, - if not blocked
+.El
+.El
+.Pp
+The
+.Fl n
+switch has the same effect as for the
+.Fl i
+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.
+If the
+.Fl k
+flag is repeated, function offsets, not just function names, are printed.
+.Pp
+This feature requires
+.Cd "options STACK"
+or
+.Cd "options DDB"
+to be compiled into the kernel.
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It TID
+thread ID
+.It COMM
+command
+.It TDNAME
+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
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It EUID
+effective user ID
+.It RUID
+real user ID
+.It SVUID
+saved user ID
+.It EGID
+effective group ID
+.It RGID
+real group ID
+.It SVGID
+saved group ID
+.It UMASK
+file creation mode mask
+.It FLAGS
+credential flags
+.It GROUPS
+group set
+.El
+.Pp
+The following credential flags may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It C
+capability mode
+.El
+.Ss Thread Information
+Display per-thread information, including process ID, per-thread ID, name,
+CPU, and execution state:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It TID
+thread ID
+.It COMM
+command
+.It TDNAME
+thread name
+.It CPU
+current or most recent CPU run on
+.It PRI
+thread priority
+.It STATE
+thread state
+.It WCHAN
+thread wait channel
+.El
+.Ss Virtual Memory Mappings
+Display process virtual memory mappings, including addresses, mapping
+meta-data, and mapped object information:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It START
+starting address of mapping
+.It END
+ending address of mapping
+.It PRT
+protection flags
+.It RES
+resident pages
+.It PRES
+private resident pages
+.It REF
+reference count
+.It SHD
+shadow page count
+.It FLAG
+mapping flags
+.It TP
+VM object type
+.El
+.Pp
+The following protection flags may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It r
+read
+.It w
+write
+.It x
+execute
+.El
+.Pp
+The following VM object types may be displayed:
+.Pp
+.Bl -tag -width XX -compact
+.It --
+none
+.It dd
+dead
+.It df
+default
+.It dv
+device
+.It md
+device with managed pages
+.Pq GEM/TTM
+.It ph
+physical
+.It sg
+scatter/gather
+.It sw
+swap
+.It vn
+vnode
+.El
+.Pp
+The following mapping flags may be displayed:
+.Pp
+.Bl -tag -width X -compact
+.It C
+copy-on-write
+.It N
+needs copy
+.It S
+one or more superpage mappings are used
+.It D
+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
+.Xr fstat 1 ,
+.Xr ps 1 ,
+.Xr sockstat 1 ,
+.Xr cap_enter 2 ,
+.Xr cap_rights_limit 2 ,
+.Xr libprocstat 3 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3 ,
+.Xr ddb 4 ,
+.Xr stack 9
+.Sh AUTHORS
+.An Robert N M Watson Aq Mt rwatson@FreeBSD.org .
+.br
+.Xr libxo 3
+support was added by
+.An -nosplit
+Allan Jude
+.Aq Mt allanjude@FreeBSD.org .
+.Sh BUGS
+The display of open file or memory mapping pathnames is implemented using the
+kernel's name cache.
+If a file system does not use the name cache, or the path to a file is not in
+the cache, a path will not be displayed.
+.Pp
+.Nm
+currently supports extracting data only from a live kernel, and not from
+kernel crash dumps.
diff --git a/usr.bin/procstat/procstat.c b/usr.bin/procstat/procstat.c
new file mode 100644
index 0000000..cafb335
--- /dev/null
+++ b/usr.bin/procstat/procstat.c
@@ -0,0 +1,349 @@
+/*-
+ * Copyright (c) 2007, 2011 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "procstat.h"
+
+static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, lflag, rflag;
+static int sflag, tflag, vflag, xflag, Sflag;
+int hflag, nflag, Cflag, Hflag;
+
+static void
+usage(void)
+{
+
+ xo_error("usage: procstat [-CHhn] [-M core] [-N system] "
+ "[-w interval]\n"
+ " [-b | -c | -e | -f | -i | -j | -k | "
+ "-l | -r | -s | -S | -t | -v | -x]\n"
+ " [-a | pid | core ...]\n");
+ xo_finish();
+ exit(EX_USAGE);
+}
+
+static void
+procstat(struct procstat *prstat, struct kinfo_proc *kipp)
+{
+ char *pidstr = NULL;
+
+ asprintf(&pidstr, "%d", kipp->ki_pid);
+ if (pidstr == NULL)
+ xo_errc(1, ENOMEM, "Failed to allocate memory in procstat()");
+ xo_open_container(pidstr);
+
+ if (bflag)
+ procstat_bin(prstat, kipp);
+ else if (cflag)
+ procstat_args(prstat, kipp);
+ else if (eflag)
+ procstat_env(prstat, kipp);
+ else if (fflag)
+ procstat_files(prstat, kipp);
+ else if (iflag)
+ procstat_sigs(prstat, kipp);
+ else if (jflag)
+ procstat_threads_sigs(prstat, kipp);
+ else if (kflag)
+ 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)
+ procstat_threads(prstat, kipp);
+ else if (vflag)
+ procstat_vm(prstat, kipp);
+ else if (xflag)
+ procstat_auxv(prstat, kipp);
+ else if (Sflag)
+ procstat_cs(prstat, kipp);
+ else
+ procstat_basic(kipp);
+
+ xo_close_container(pidstr);
+ free(pidstr);
+}
+
+/*
+ * Sort processes first by pid and then tid.
+ */
+static int
+kinfo_proc_compare(const void *a, const void *b)
+{
+ int i;
+
+ i = ((const struct kinfo_proc *)a)->ki_pid -
+ ((const struct kinfo_proc *)b)->ki_pid;
+ if (i != 0)
+ return (i);
+ i = ((const struct kinfo_proc *)a)->ki_tid -
+ ((const struct kinfo_proc *)b)->ki_tid;
+ return (i);
+}
+
+void
+kinfo_proc_sort(struct kinfo_proc *kipp, int count)
+{
+
+ qsort(kipp, count, sizeof(*kipp), kinfo_proc_compare);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch, interval, tmp;
+ int i;
+ struct kinfo_proc *p;
+ struct procstat *prstat, *cprstat;
+ long l;
+ pid_t pid;
+ char *dummy;
+ char *nlistf, *memf;
+ const char *xocontainer;
+ int cnt;
+
+ interval = 0;
+ memf = nlistf = NULL;
+ argc = xo_parse_args(argc, argv);
+ xocontainer = "basic";
+
+ while ((ch = getopt(argc, argv, "CHN:M:abcefijklhrsStvw:x")) != -1) {
+ switch (ch) {
+ case 'C':
+ Cflag++;
+ break;
+
+ case 'H':
+ Hflag++;
+ break;
+
+ case 'M':
+ memf = optarg;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'S':
+ Sflag++;
+ xocontainer = "cs";
+ break;
+ case 'a':
+ aflag++;
+ break;
+
+ case 'b':
+ bflag++;
+ xocontainer = "binary";
+ break;
+
+ case 'c':
+ cflag++;
+ xocontainer = "arguments";
+ break;
+
+ case 'e':
+ eflag++;
+ xocontainer = "environment";
+ break;
+
+ case 'f':
+ fflag++;
+ xocontainer = "files";
+ break;
+
+ case 'i':
+ iflag++;
+ xocontainer = "signals";
+ break;
+
+ case 'j':
+ jflag++;
+ xocontainer = "thread_signals";
+ break;
+
+ case 'k':
+ kflag++;
+ xocontainer = "kstack";
+ break;
+
+ case 'l':
+ lflag++;
+ xocontainer = "rlimit";
+ break;
+
+ case 'n':
+ nflag++;
+ break;
+
+ case 'h':
+ hflag++;
+ break;
+
+ case 'r':
+ rflag++;
+ xocontainer = "rusage";
+ break;
+
+ case 's':
+ sflag++;
+ xocontainer = "credentials";
+ break;
+
+ case 't':
+ tflag++;
+ xocontainer = "threads";
+ break;
+
+ case 'v':
+ vflag++;
+ xocontainer = "vm";
+ break;
+
+ case 'w':
+ l = strtol(optarg, &dummy, 10);
+ if (*dummy != '\0')
+ usage();
+ if (l < 1 || l > INT_MAX)
+ usage();
+ interval = l;
+ break;
+
+ case 'x':
+ xflag++;
+ xocontainer = "auxv";
+ break;
+
+ case '?':
+ default:
+ usage();
+ }
+
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* We require that either 0 or 1 mode flags be set. */
+ tmp = bflag + cflag + eflag + fflag + iflag + jflag + (kflag ? 1 : 0) +
+ lflag + rflag + sflag + tflag + vflag + xflag + Sflag;
+ if (!(tmp == 0 || tmp == 1))
+ usage();
+
+ /* We allow -k to be specified up to twice, but not more. */
+ if (kflag > 2)
+ usage();
+
+ /* Must specify either the -a flag or a list of pids. */
+ if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0))
+ usage();
+
+ /* Only allow -C with -f. */
+ if (Cflag && !fflag)
+ usage();
+
+ if (memf != NULL)
+ prstat = procstat_open_kvm(nlistf, memf);
+ else
+ prstat = procstat_open_sysctl();
+ if (prstat == NULL)
+ xo_errx(1, "procstat_open()");
+ do {
+ xo_set_version(PROCSTAT_XO_VERSION);
+ xo_open_container("procstat");
+ xo_open_container(xocontainer);
+
+ if (aflag) {
+ p = procstat_getprocs(prstat, KERN_PROC_PROC, 0, &cnt);
+ if (p == NULL)
+ xo_errx(1, "procstat_getprocs()");
+ kinfo_proc_sort(p, cnt);
+ for (i = 0; i < cnt; i++) {
+ procstat(prstat, &p[i]);
+
+ /* Suppress header after first process. */
+ hflag = 1;
+ xo_flush();
+ }
+ procstat_freeprocs(prstat, p);
+ }
+ for (i = 0; i < argc; i++) {
+ l = strtol(argv[i], &dummy, 10);
+ if (*dummy == '\0') {
+ if (l < 0)
+ usage();
+ pid = l;
+
+ p = procstat_getprocs(prstat, KERN_PROC_PID,
+ pid, &cnt);
+ if (p == NULL)
+ xo_errx(1, "procstat_getprocs()");
+ if (cnt != 0)
+ procstat(prstat, p);
+ procstat_freeprocs(prstat, p);
+ } else {
+ cprstat = procstat_open_core(argv[i]);
+ if (cprstat == NULL) {
+ warnx("procstat_open()");
+ continue;
+ }
+ p = procstat_getprocs(cprstat, KERN_PROC_PID,
+ -1, &cnt);
+ if (p == NULL)
+ xo_errx(1, "procstat_getprocs()");
+ if (cnt != 0)
+ procstat(cprstat, p);
+ procstat_freeprocs(cprstat, p);
+ procstat_close(cprstat);
+ }
+ /* Suppress header after first process. */
+ hflag = 1;
+ }
+
+ xo_close_container(xocontainer);
+ xo_close_container("procstat");
+ xo_finish();
+ if (interval)
+ sleep(interval);
+ } while (interval);
+
+ procstat_close(prstat);
+
+ exit(0);
+}
diff --git a/usr.bin/procstat/procstat.h b/usr.bin/procstat/procstat.h
new file mode 100644
index 0000000..dfdf328
--- /dev/null
+++ b/usr.bin/procstat/procstat.h
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <libxo/xo.h>
+
+#ifndef PROCSTAT_H
+#define PROCSTAT_H
+
+#define PROCSTAT_XO_VERSION "1"
+
+extern int hflag, nflag, Cflag, Hflag;
+
+struct kinfo_proc;
+void kinfo_proc_sort(struct kinfo_proc *kipp, int count);
+
+void procstat_args(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_auxv(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_basic(struct kinfo_proc *kipp);
+void procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_cred(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_cs(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_env(struct procstat *prstat, struct kinfo_proc *kipp);
+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);
+void procstat_vm(struct procstat *prstat, struct kinfo_proc *kipp);
+
+#endif /* !PROCSTAT_H */
diff --git a/usr.bin/procstat/procstat_args.c b/usr.bin/procstat/procstat_args.c
new file mode 100644
index 0000000..fd5f3d3
--- /dev/null
+++ b/usr.bin/procstat/procstat_args.c
@@ -0,0 +1,96 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_args(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ int i;
+ char **args;
+
+ if (!hflag) {
+ xo_emit("{T:/%5s %-16s %-53s}\n", "PID", "COMM", "ARGS");
+ }
+
+ args = procstat_getargv(procstat, kipp, 0);
+
+ xo_emit("{k:process_id/%5d/%d} {:command/%-16s/%s}", kipp->ki_pid,
+ kipp->ki_comm);
+
+ if (args == NULL) {
+ xo_emit(" {d:args/-}\n");
+ return;
+ }
+
+ xo_open_list("arguments");
+ for (i = 0; args[i] != NULL; i++)
+ xo_emit(" {l:args/%s}", args[i]);
+ xo_close_list("arguments");
+ xo_emit("\n");
+}
+
+void
+procstat_env(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ int i;
+ char **envs;
+
+ if (!hflag) {
+ xo_emit("{T:/%5s %-16s %-53s}\n", "PID", "COMM", "ENVIRONMENT");
+ }
+
+ envs = procstat_getenvv(procstat, kipp, 0);
+
+ xo_emit("{k:process_id/%5d/%d} {:command/%-16s/%s}", kipp->ki_pid,
+ kipp->ki_comm);
+
+ if (envs == NULL) {
+ xo_emit(" {d:env/-}\n");
+ return;
+ }
+
+ xo_open_list("environment");
+ for (i = 0; envs[i] != NULL; i++)
+ xo_emit(" {l:env/%s}", envs[i]);
+ xo_close_list("environment");
+ xo_emit("\n");
+}
diff --git a/usr.bin/procstat/procstat_auxv.c b/usr.bin/procstat/procstat_auxv.c
new file mode 100644
index 0000000..f4a2265
--- /dev/null
+++ b/usr.bin/procstat/procstat_auxv.c
@@ -0,0 +1,189 @@
+/*-
+ * Copyright (c) 2011 Mikolaj Golub
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/elf.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <vm/vm.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_auxv(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ Elf_Auxinfo *auxv;
+ u_int count, i;
+ static char prefix[256];
+
+ if (!hflag)
+ xo_emit("{T:/%5s %-16s %-16s %-16s}\n", "PID", "COMM", "AUXV",
+ "VALUE");
+
+ auxv = procstat_getauxv(procstat, kipp, &count);
+ if (auxv == NULL)
+ return;
+ snprintf(prefix, sizeof(prefix), "%5d %-16s", kipp->ki_pid,
+ kipp->ki_comm);
+
+ xo_emit("{e:process_id/%5d/%d}{e:command/%-16s/%s}", kipp->ki_pid,
+ kipp->ki_comm);
+
+ for (i = 0; i < count; i++) {
+ switch(auxv[i].a_type) {
+ case AT_NULL:
+ return;
+ case AT_IGNORE:
+ break;
+ case AT_EXECFD:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_EXECFD/%ld}\n",
+ prefix, "AT_EXECFD", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_PHDR:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PHDR/%p}\n",
+ prefix, "AT_PHDR", auxv[i].a_un.a_ptr);
+ break;
+ case AT_PHENT:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PHENT/%ld}\n",
+ prefix, "AT_PHENT", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_PHNUM:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PHNUM/%ld}\n",
+ prefix, "AT_PHNUM", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_PAGESZ:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PAGESZ/%ld}\n",
+ prefix, "AT_PAGESZ", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_BASE:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_BASE/%p}\n",
+ prefix, "AT_BASE", auxv[i].a_un.a_ptr);
+ break;
+ case AT_FLAGS:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_FLAGS/%#lx}\n",
+ prefix, "AT_FLAGS", (u_long)auxv[i].a_un.a_val);
+ break;
+ case AT_ENTRY:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_ENTRY/%p}\n",
+ prefix, "AT_ENTRY", auxv[i].a_un.a_ptr);
+ break;
+#ifdef AT_NOTELF
+ case AT_NOTELF:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_NOTELF/%ld}\n",
+ prefix, "AT_NOTELF", (long)auxv[i].a_un.a_val);
+ break;
+#endif
+#ifdef AT_UID
+ case AT_UID:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_UID/%ld}\n",
+ prefix, "AT_UID", (long)auxv[i].a_un.a_val);
+ break;
+#endif
+#ifdef AT_EUID
+ case AT_EUID:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_EUID/%ld}\n",
+ prefix, "AT_EUID", (long)auxv[i].a_un.a_val);
+ break;
+#endif
+#ifdef AT_GID
+ case AT_GID:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_GID/%ld}\n",
+ prefix, "AT_GID", (long)auxv[i].a_un.a_val);
+ break;
+#endif
+#ifdef AT_EGID
+ case AT_EGID:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_EGID/%ld}\n",
+ prefix, "AT_EGID", (long)auxv[i].a_un.a_val);
+ break;
+#endif
+ case AT_EXECPATH:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_EXECPATH/%p}\n",
+ prefix, "AT_EXECPATH", auxv[i].a_un.a_ptr);
+ break;
+ case AT_CANARY:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_CANARY/%p}\n",
+ prefix, "AT_CANARY", auxv[i].a_un.a_ptr);
+ break;
+ case AT_CANARYLEN:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_CANARYLEN/%ld}\n",
+ prefix, "AT_CANARYLEN", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_OSRELDATE:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_OSRELDATE/%ld}\n",
+ prefix, "AT_OSRELDATE", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_NCPUS:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_NCPUS/%ld}\n",
+ prefix, "AT_NCPUS", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_PAGESIZES:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PAGESIZES/%p}\n",
+ prefix, "AT_PAGESIZES", auxv[i].a_un.a_ptr);
+ break;
+ case AT_PAGESIZESLEN:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}"
+ "{:AT_PAGESIZESLEN/%ld}\n", prefix,
+ "AT_PAGESIZESLEN", (long)auxv[i].a_un.a_val);
+ break;
+ case AT_STACKPROT:
+ if ((auxv[i].a_un.a_val & VM_PROT_EXECUTE) != 0)
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}"
+ "{:AT_STACKPROT/%s}\n", prefix,
+ "AT_STACKPROT", "EXECUTABLE");
+ else
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}"
+ "{:AT_STACKPROT/%s}\n", prefix,
+ "AT_STACKPROT", "NONEXECUTABLE");
+ break;
+#ifdef AT_TIMEKEEP
+ case AT_TIMEKEEP:
+ xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_TIMEKEEP/%p}\n",
+ prefix, "AT_TIMEKEEP", auxv[i].a_un.a_ptr);
+ break;
+#endif
+ default:
+ xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
+ prefix, auxv[i].a_type, auxv[i].a_un.a_val);
+ break;
+ }
+ }
+ xo_emit("\n");
+ procstat_freeauxv(procstat, auxv);
+}
+
diff --git a/usr.bin/procstat/procstat_basic.c b/usr.bin/procstat/procstat_basic.c
new file mode 100644
index 0000000..75bb7a8
--- /dev/null
+++ b/usr.bin/procstat/procstat_basic.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_basic(struct kinfo_proc *kipp)
+{
+
+ if (!hflag)
+ xo_emit("{T:/%5s %5s %5s %5s %5s %3s %-8s %-9s %-13s %-12s}\n",
+ "PID", "PPID", "PGID", "SID", "TSID", "THR", "LOGIN",
+ "WCHAN", "EMUL", "COMM");
+
+ xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:parent_process_id/%5d/%d} ", kipp->ki_ppid);
+ xo_emit("{:process_group_id/%5d/%d} ", kipp->ki_pgid);
+ xo_emit("{:session_id/%5d/%d} ", kipp->ki_sid);
+ xo_emit("{:terminal_session_id/%5d/%d} ", kipp->ki_tsid);
+ xo_emit("{:threads/%3d/%d} ", kipp->ki_numthreads);
+ xo_emit("{:login/%-8s/%s} ", strlen(kipp->ki_login) ?
+ kipp->ki_login : "-");
+ if (kipp->ki_kiflag & KI_LOCKBLOCK) {
+ xo_emit("{:lockname/*%-8s/%s} ", strlen(kipp->ki_lockname) ?
+ kipp->ki_lockname : "-");
+ } else {
+ xo_emit("{:wait_channel/%-9s/%s} ", strlen(kipp->ki_wmesg) ?
+ kipp->ki_wmesg : "-");
+ }
+ xo_emit("{:emulation/%-13s/%s} ", strcmp(kipp->ki_emul, "null") ?
+ kipp->ki_emul : "-");
+ xo_emit("{:command/%-12s/%s}\n", kipp->ki_comm);
+}
diff --git a/usr.bin/procstat/procstat_bin.c b/usr.bin/procstat/procstat_bin.c
new file mode 100644
index 0000000..8b2b8a1
--- /dev/null
+++ b/usr.bin/procstat/procstat_bin.c
@@ -0,0 +1,64 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp)
+{
+ int osrel;
+ static char pathname[PATH_MAX];
+
+ if (!hflag)
+ xo_emit("{T:/%5s %-16s %8s %s}\n", "PID", "COMM", "OSREL",
+ "PATH");
+
+ if (procstat_getpathname(prstat, kipp, pathname, sizeof(pathname)) != 0)
+ return;
+ if (strlen(pathname) == 0)
+ strcpy(pathname, "-");
+ if (procstat_getosrel(prstat, kipp, &osrel) != 0)
+ return;
+
+ xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:command/%-16s/%s} ", kipp->ki_comm);
+ xo_emit("{:osrel/%8d/%d} ", osrel);
+ xo_emit("{:pathname/%s}\n", pathname);
+}
diff --git a/usr.bin/procstat/procstat_cred.c b/usr.bin/procstat/procstat_cred.c
new file mode 100644
index 0000000..940c952
--- /dev/null
+++ b/usr.bin/procstat/procstat_cred.c
@@ -0,0 +1,103 @@
+/*-
+ * Copyright (c) 2007-2008 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <libprocstat.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "procstat.h"
+
+static const char *get_umask(struct procstat *procstat,
+ struct kinfo_proc *kipp);
+
+void
+procstat_cred(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ unsigned int i, ngroups;
+ gid_t *groups;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %-16s %5s %5s %5s %5s %5s %5s %5s %5s %-15s}\n",
+ "PID", "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID",
+ "SVGID", "UMASK", "FLAGS", "GROUPS");
+
+ xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:command/%-16s/%s} ", kipp->ki_comm);
+ xo_emit("{:uid/%5d} ", kipp->ki_uid);
+ xo_emit("{:ruid/%5d} ", kipp->ki_ruid);
+ xo_emit("{:svuid/%5d} ", kipp->ki_svuid);
+ xo_emit("{:group/%5d} ", kipp->ki_groups[0]);
+ xo_emit("{:rgid/%5d} ", kipp->ki_rgid);
+ xo_emit("{:svgid/%5d} ", kipp->ki_svgid);
+ xo_emit("{:umask/%5s} ", get_umask(procstat, kipp));
+ xo_emit("{:cr_flags/%s}", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ?
+ "C" : "-");
+ xo_emit("{P: }");
+
+ groups = NULL;
+ /*
+ * We may have too many groups to fit in kinfo_proc's statically
+ * sized storage. If that occurs, attempt to retrieve them using
+ * libprocstat.
+ */
+ if (kipp->ki_cr_flags & KI_CRF_GRP_OVERFLOW)
+ groups = procstat_getgroups(procstat, kipp, &ngroups);
+ if (groups == NULL) {
+ ngroups = kipp->ki_ngroups;
+ groups = kipp->ki_groups;
+ }
+ xo_open_list("groups");
+ for (i = 0; i < ngroups; i++)
+ xo_emit("{D:/%s}{l:groups/%d}", (i > 0) ? "," : "", groups[i]);
+ if (groups != kipp->ki_groups)
+ procstat_freegroups(procstat, groups);
+
+ xo_close_list("groups");
+ xo_emit("\n");
+}
+
+static const char *
+get_umask(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ u_short fd_cmask;
+ static char umask[4];
+
+ if (procstat_getumask(procstat, kipp, &fd_cmask) == 0) {
+ snprintf(umask, 4, "%03o", fd_cmask);
+ return (umask);
+ } else {
+ return ("-");
+ }
+}
diff --git a/usr.bin/procstat/procstat_cs.c b/usr.bin/procstat/procstat_cs.c
new file mode 100644
index 0000000..bbf9d05
--- /dev/null
+++ b/usr.bin/procstat/procstat_cs.c
@@ -0,0 +1,119 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/cpuset.h>
+#include <sys/sbuf.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_cs(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ cpusetid_t cs;
+ cpuset_t mask;
+ struct kinfo_proc *kip;
+ struct sbuf *cpusetbuf;
+ unsigned int count, i;
+ int once, twice, lastcpu, cpu;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %6s %-16s %-16s %2s %4s %-7s}\n", "PID",
+ "TID", "COMM", "TDNAME", "CPU", "CSID", "CPU MASK");
+
+ 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++) {
+ kipp = &kip[i];
+ xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:thread_id/%6d/%d} ", kipp->ki_tid);
+ xo_emit("{:command/%-16s/%s} ", strlen(kipp->ki_comm) ?
+ kipp->ki_comm : "-");
+ xo_emit("{:thread_name/%-16s/%s} ", (strlen(kipp->ki_tdname) &&
+ (strcmp(kipp->ki_comm, kipp->ki_tdname) != 0)) ?
+ kipp->ki_tdname : "-");
+ if (kipp->ki_oncpu != 255)
+ xo_emit("{:cpu/%3d/%d} ", kipp->ki_oncpu);
+ else if (kipp->ki_lastcpu != 255)
+ xo_emit("{:cpu/%3d/%d} ", kipp->ki_lastcpu);
+ else
+ xo_emit("{:cpu/%3s/%s} ", "-");
+ if (cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID,
+ kipp->ki_tid, &cs) != 0) {
+ cs = CPUSET_INVALID;
+ }
+ xo_emit("{:cpu_set_id/%4d/%d} ", cs);
+ if ((cs != CPUSET_INVALID) &&
+ (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
+ kipp->ki_tid, sizeof(mask), &mask) == 0)) {
+ lastcpu = -1;
+ once = 0;
+ twice = 0;
+ cpusetbuf = sbuf_new_auto();
+ for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
+ if (CPU_ISSET(cpu, &mask)) {
+ if (once == 0) {
+ sbuf_printf(cpusetbuf, "%d",
+ cpu);
+ once = 1;
+ } else if (cpu == lastcpu + 1) {
+ twice = 1;
+ } else if (twice == 1) {
+ sbuf_printf(cpusetbuf, "-%d,%d",
+ lastcpu, cpu);
+ twice = 0;
+ } else
+ sbuf_printf(cpusetbuf, ",%d",
+ cpu);
+ lastcpu = cpu;
+ }
+ }
+ if (once && twice)
+ sbuf_printf(cpusetbuf, "-%d", lastcpu);
+ if (sbuf_finish(cpusetbuf) != 0)
+ xo_err(1, "Could not generate output");
+ xo_emit("{:cpu_set/%s}", sbuf_data(cpusetbuf));
+ sbuf_delete(cpusetbuf);
+ }
+ xo_emit("\n");
+ }
+ procstat_freeprocs(procstat, kip);
+}
diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c
new file mode 100644
index 0000000..ae7928d
--- /dev/null
+++ b/usr.bin/procstat/procstat_files.c
@@ -0,0 +1,576 @@
+/*-
+ * Copyright (c) 2007-2011 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/capsicum.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/un.h>
+#include <sys/user.h>
+
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <libprocstat.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+static const char *
+protocol_to_string(int domain, int type, int protocol)
+{
+
+ switch (domain) {
+ case AF_INET:
+ case AF_INET6:
+ switch (protocol) {
+ case IPPROTO_TCP:
+ return ("TCP");
+ case IPPROTO_UDP:
+ return ("UDP");
+ case IPPROTO_ICMP:
+ return ("ICM");
+ case IPPROTO_RAW:
+ return ("RAW");
+ case IPPROTO_SCTP:
+ return ("SCT");
+ case IPPROTO_DIVERT:
+ return ("IPD");
+ default:
+ return ("IP?");
+ }
+
+ case AF_LOCAL:
+ switch (type) {
+ case SOCK_STREAM:
+ return ("UDS");
+ case SOCK_DGRAM:
+ return ("UDD");
+ default:
+ return ("UD?");
+ }
+ default:
+ return ("?");
+ }
+}
+
+static void
+addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen)
+{
+ char buffer2[INET6_ADDRSTRLEN];
+ struct sockaddr_in6 *sin6;
+ struct sockaddr_in *sin;
+ struct sockaddr_un *sun;
+
+ switch (ss->ss_family) {
+ case AF_LOCAL:
+ sun = (struct sockaddr_un *)ss;
+ if (strlen(sun->sun_path) == 0)
+ strlcpy(buffer, "-", buflen);
+ else
+ strlcpy(buffer, sun->sun_path, buflen);
+ break;
+
+ case AF_INET:
+ sin = (struct sockaddr_in *)ss;
+ snprintf(buffer, buflen, "%s:%d", inet_ntoa(sin->sin_addr),
+ ntohs(sin->sin_port));
+ break;
+
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *)ss;
+ if (inet_ntop(AF_INET6, &sin6->sin6_addr, buffer2,
+ sizeof(buffer2)) != NULL)
+ snprintf(buffer, buflen, "%s.%d", buffer2,
+ ntohs(sin6->sin6_port));
+ else
+ strlcpy(buffer, "-", buflen);
+ break;
+
+ default:
+ strlcpy(buffer, "", buflen);
+ break;
+ }
+}
+
+static struct cap_desc {
+ uint64_t cd_right;
+ const char *cd_desc;
+} cap_desc[] = {
+ /* General file I/O. */
+ { CAP_READ, "rd" },
+ { CAP_WRITE, "wr" },
+ { CAP_SEEK, "se" },
+ { CAP_MMAP, "mm" },
+ { CAP_CREATE, "cr" },
+ { CAP_FEXECVE, "fe" },
+ { CAP_FSYNC, "fy" },
+ { CAP_FTRUNCATE, "ft" },
+
+ /* VFS methods. */
+ { CAP_FCHDIR, "cd" },
+ { CAP_FCHFLAGS, "cf" },
+ { CAP_FCHMOD, "cm" },
+ { CAP_FCHOWN, "cn" },
+ { CAP_FCNTL, "fc" },
+ { CAP_FLOCK, "fl" },
+ { CAP_FPATHCONF, "fp" },
+ { CAP_FSCK, "fk" },
+ { CAP_FSTAT, "fs" },
+ { CAP_FSTATFS, "sf" },
+ { CAP_FUTIMES, "fu" },
+ { CAP_LINKAT_SOURCE, "ls" },
+ { CAP_LINKAT_TARGET, "lt" },
+ { CAP_MKDIRAT, "md" },
+ { CAP_MKFIFOAT, "mf" },
+ { CAP_MKNODAT, "mn" },
+ { CAP_RENAMEAT_SOURCE, "rs" },
+ { CAP_RENAMEAT_TARGET, "rt" },
+ { CAP_SYMLINKAT, "sl" },
+ { CAP_UNLINKAT, "un" },
+
+ /* Lookups - used to constrain *at() calls. */
+ { CAP_LOOKUP, "lo" },
+
+ /* Extended attributes. */
+ { CAP_EXTATTR_GET, "eg" },
+ { CAP_EXTATTR_SET, "es" },
+ { CAP_EXTATTR_DELETE, "ed" },
+ { CAP_EXTATTR_LIST, "el" },
+
+ /* Access Control Lists. */
+ { CAP_ACL_GET, "ag" },
+ { CAP_ACL_SET, "as" },
+ { CAP_ACL_DELETE, "ad" },
+ { CAP_ACL_CHECK, "ac" },
+
+ /* Socket operations. */
+ { CAP_ACCEPT, "at" },
+ { CAP_BIND, "bd" },
+ { CAP_CONNECT, "co" },
+ { CAP_GETPEERNAME, "pn" },
+ { CAP_GETSOCKNAME, "sn" },
+ { CAP_GETSOCKOPT, "gs" },
+ { CAP_LISTEN, "ln" },
+ { CAP_PEELOFF, "pf" },
+ { CAP_SETSOCKOPT, "ss" },
+ { CAP_SHUTDOWN, "sh" },
+
+ /* Mandatory Access Control. */
+ { CAP_MAC_GET, "mg" },
+ { CAP_MAC_SET, "ms" },
+
+ /* Methods on semaphores. */
+ { CAP_SEM_GETVALUE, "sg" },
+ { CAP_SEM_POST, "sp" },
+ { CAP_SEM_WAIT, "sw" },
+
+ /* Event monitoring and posting. */
+ { CAP_EVENT, "ev" },
+ { CAP_KQUEUE_EVENT, "ke" },
+ { CAP_KQUEUE_CHANGE, "kc" },
+
+ /* Strange and powerful rights that should not be given lightly. */
+ { CAP_IOCTL, "io" },
+ { CAP_TTYHOOK, "ty" },
+
+ /* Process management via process descriptors. */
+ { CAP_PDGETPID, "pg" },
+ { CAP_PDWAIT, "pw" },
+ { CAP_PDKILL, "pk" },
+
+ /*
+ * Rights that allow to use bindat(2) and connectat(2) syscalls on a
+ * directory descriptor.
+ */
+ { CAP_BINDAT, "ba" },
+ { CAP_CONNECTAT, "ca" },
+
+ /* Aliases and defines that combine multiple rights. */
+ { CAP_PREAD, "prd" },
+ { CAP_PWRITE, "pwr" },
+
+ { CAP_MMAP_R, "mmr" },
+ { CAP_MMAP_W, "mmw" },
+ { CAP_MMAP_X, "mmx" },
+ { CAP_MMAP_RW, "mrw" },
+ { CAP_MMAP_RX, "mrx" },
+ { CAP_MMAP_WX, "mwx" },
+ { CAP_MMAP_RWX, "mma" },
+
+ { CAP_RECV, "re" },
+ { CAP_SEND, "sd" },
+
+ { CAP_SOCK_CLIENT, "scl" },
+ { CAP_SOCK_SERVER, "ssr" },
+};
+static const u_int cap_desc_count = sizeof(cap_desc) /
+ sizeof(cap_desc[0]);
+
+static u_int
+width_capability(cap_rights_t *rightsp)
+{
+ u_int count, i, width;
+
+ count = 0;
+ width = 0;
+ for (i = 0; i < cap_desc_count; i++) {
+ if (cap_rights_is_set(rightsp, cap_desc[i].cd_right)) {
+ width += strlen(cap_desc[i].cd_desc);
+ if (count)
+ width++;
+ count++;
+ }
+ }
+ return (width);
+}
+
+static void
+print_capability(cap_rights_t *rightsp, u_int capwidth)
+{
+ u_int count, i, width;
+
+ count = 0;
+ width = 0;
+ for (i = width_capability(rightsp); i < capwidth; i++) {
+ if (i != 0)
+ xo_emit(" ");
+ else
+ xo_emit("-");
+ }
+ xo_open_list("capabilities");
+ for (i = 0; i < cap_desc_count; i++) {
+ if (cap_rights_is_set(rightsp, cap_desc[i].cd_right)) {
+ xo_emit("{D:/%s}{l:capabilities/%s}", count ? "," : "",
+ cap_desc[i].cd_desc);
+ width += strlen(cap_desc[i].cd_desc);
+ if (count)
+ width++;
+ count++;
+ }
+ }
+ xo_close_list("capabilities");
+}
+
+void
+procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct sockstat sock;
+ struct filestat_list *head;
+ struct filestat *fst;
+ const char *str;
+ struct vnstat vn;
+ u_int capwidth, width;
+ int error;
+ char src_addr[PATH_MAX];
+ char dst_addr[PATH_MAX];
+
+ /*
+ * To print the header in capability mode, we need to know the width
+ * of the widest capability string. Even if we get no processes
+ * back, we will print the header, so we defer aborting due to a lack
+ * of processes until after the header logic.
+ */
+ capwidth = 0;
+ head = procstat_getfiles(procstat, kipp, 0);
+ if (head != NULL && Cflag) {
+ STAILQ_FOREACH(fst, head, next) {
+ width = width_capability(&fst->fs_cap_rights);
+ if (width > capwidth)
+ capwidth = width;
+ }
+ if (capwidth < strlen("CAPABILITIES"))
+ capwidth = strlen("CAPABILITIES");
+ }
+
+ if (!hflag) {
+ if (Cflag)
+ xo_emit("{T:/%5s %-16s %5s %1s %-8s %-*s "
+ "%-3s %-12s}\n", "PID", "COMM", "FD", "T",
+ "FLAGS", capwidth, "CAPABILITIES", "PRO",
+ "NAME");
+ else
+ xo_emit("{T:/%5s %-16s %5s %1s %1s %-8s "
+ "%3s %7s %-3s %-12s}\n", "PID", "COMM", "FD", "T",
+ "V", "FLAGS", "REF", "OFFSET", "PRO", "NAME");
+ }
+
+ if (head == NULL)
+ return;
+ xo_emit("{ek:process_id/%5d/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%-16s/%s}", kipp->ki_comm);
+ xo_open_list("files");
+ STAILQ_FOREACH(fst, head, next) {
+ xo_open_instance("files");
+ xo_emit("{dk:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{d:command/%-16s/%s} ", kipp->ki_comm);
+ if (fst->fs_uflags & PS_FST_UFLAG_CTTY)
+ xo_emit("{P: }{:fd/%s} ", "ctty");
+ else if (fst->fs_uflags & PS_FST_UFLAG_CDIR)
+ xo_emit("{P: }{:fd/%s} ", "cwd");
+ else if (fst->fs_uflags & PS_FST_UFLAG_JAIL)
+ xo_emit("{P: }{:fd/%s} ", "jail");
+ else if (fst->fs_uflags & PS_FST_UFLAG_RDIR)
+ xo_emit("{P: }{:fd/%s} ", "root");
+ else if (fst->fs_uflags & PS_FST_UFLAG_TEXT)
+ xo_emit("{P: }{:fd/%s} ", "text");
+ else if (fst->fs_uflags & PS_FST_UFLAG_TRACE)
+ xo_emit("{:fd/%s} ", "trace");
+ else
+ xo_emit("{:fd/%5d} ", fst->fs_fd);
+
+ switch (fst->fs_type) {
+ case PS_FST_TYPE_VNODE:
+ str = "v";
+ xo_emit("{eq:fd_type/vnode}");
+ break;
+
+ case PS_FST_TYPE_SOCKET:
+ str = "s";
+ xo_emit("{eq:fd_type/socket}");
+ break;
+
+ case PS_FST_TYPE_PIPE:
+ str = "p";
+ xo_emit("{eq:fd_type/pipe}");
+ break;
+
+ case PS_FST_TYPE_FIFO:
+ str = "f";
+ xo_emit("{eq:fd_type/fifo}");
+ break;
+
+ case PS_FST_TYPE_KQUEUE:
+ str = "k";
+ xo_emit("{eq:fd_type/kqueue}");
+ break;
+
+ case PS_FST_TYPE_CRYPTO:
+ str = "c";
+ xo_emit("{eq:fd_type/crypto}");
+ break;
+
+ case PS_FST_TYPE_MQUEUE:
+ str = "m";
+ xo_emit("{eq:fd_type/mqueue}");
+ break;
+
+ case PS_FST_TYPE_SHM:
+ str = "h";
+ xo_emit("{eq:fd_type/shm}");
+ break;
+
+ case PS_FST_TYPE_PTS:
+ str = "t";
+ xo_emit("{eq:fd_type/pts}");
+ break;
+
+ case PS_FST_TYPE_SEM:
+ str = "e";
+ xo_emit("{eq:fd_type/sem}");
+ break;
+
+ case PS_FST_TYPE_NONE:
+ str = "?";
+ xo_emit("{eq:fd_type/none}");
+ break;
+
+ case PS_FST_TYPE_UNKNOWN:
+ default:
+ str = "?";
+ xo_emit("{eq:fd_type/unknown}");
+ break;
+ }
+ xo_emit("{d:fd_type/%1s/%s} ", str);
+ if (!Cflag) {
+ str = "-";
+ if (fst->fs_type == PS_FST_TYPE_VNODE) {
+ error = procstat_get_vnode_info(procstat, fst,
+ &vn, NULL);
+ switch (vn.vn_type) {
+ case PS_FST_VTYPE_VREG:
+ str = "r";
+ xo_emit("{eq:vode_type/regular}");
+ break;
+
+ case PS_FST_VTYPE_VDIR:
+ str = "d";
+ xo_emit("{eq:vode_type/directory}");
+ break;
+
+ case PS_FST_VTYPE_VBLK:
+ str = "b";
+ xo_emit("{eq:vode_type/block}");
+ break;
+
+ case PS_FST_VTYPE_VCHR:
+ str = "c";
+ xo_emit("{eq:vode_type/character}");
+ break;
+
+ case PS_FST_VTYPE_VLNK:
+ str = "l";
+ xo_emit("{eq:vode_type/link}");
+ break;
+
+ case PS_FST_VTYPE_VSOCK:
+ str = "s";
+ xo_emit("{eq:vode_type/socket}");
+ break;
+
+ case PS_FST_VTYPE_VFIFO:
+ str = "f";
+ xo_emit("{eq:vode_type/fifo}");
+ break;
+
+ case PS_FST_VTYPE_VBAD:
+ str = "x";
+ xo_emit("{eq:vode_type/revoked_device}");
+ break;
+
+ case PS_FST_VTYPE_VNON:
+ str = "?";
+ xo_emit("{eq:vode_type/non}");
+ break;
+
+ case PS_FST_VTYPE_UNKNOWN:
+ default:
+ str = "?";
+ xo_emit("{eq:vode_type/unknown}");
+ break;
+ }
+ }
+ xo_emit("{d:vnode_type/%1s/%s} ", str);
+ }
+
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_READ ?
+ "r" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_WRITE ?
+ "w" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_APPEND ?
+ "a" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_ASYNC ?
+ "s" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_SYNC ?
+ "f" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_NONBLOCK ?
+ "n" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_DIRECT ?
+ "d" : "-");
+ xo_emit("{d:/%s}", fst->fs_fflags & PS_FST_FFLAG_HASLOCK ?
+ "l" : "-");
+ xo_emit(" ");
+ xo_open_list("fd_flags");
+ if (fst->fs_fflags & PS_FST_FFLAG_READ)
+ xo_emit("{elq:fd_flags/read}");
+ if (fst->fs_fflags & PS_FST_FFLAG_WRITE)
+ xo_emit("{elq:fd_flags/write}");
+ if (fst->fs_fflags & PS_FST_FFLAG_APPEND)
+ xo_emit("{elq:fd_flags/append}");
+ if (fst->fs_fflags & PS_FST_FFLAG_ASYNC)
+ xo_emit("{elq:fd_flags/async}");
+ if (fst->fs_fflags & PS_FST_FFLAG_SYNC)
+ xo_emit("{elq:fd_flags/fsync}");
+ if (fst->fs_fflags & PS_FST_FFLAG_NONBLOCK)
+ xo_emit("{elq:fd_flags/nonblocking}");
+ if (fst->fs_fflags & PS_FST_FFLAG_DIRECT)
+ xo_emit("{elq:fd_flags/direct_io}");
+ if (fst->fs_fflags & PS_FST_FFLAG_HASLOCK)
+ xo_emit("{elq:fd_flags/lock_held}");
+ xo_close_list("fd_flags");
+
+ if (!Cflag) {
+ if (fst->fs_ref_count > -1)
+ xo_emit("{:ref_count/%3d/%d} ",
+ fst->fs_ref_count);
+ else
+ xo_emit("{q:ref_count/%3c/%c} ", '-');
+ if (fst->fs_offset > -1)
+ xo_emit("{:offset/%7jd/%jd} ",
+ (intmax_t)fst->fs_offset);
+ else
+ xo_emit("{q:offset/%7c/%c} ", '-');
+ }
+ if (Cflag) {
+ print_capability(&fst->fs_cap_rights, capwidth);
+ xo_emit(" ");
+ }
+ switch (fst->fs_type) {
+ case PS_FST_TYPE_SOCKET:
+ error = procstat_get_socket_info(procstat, fst, &sock,
+ NULL);
+ if (error != 0)
+ break;
+ xo_emit("{:protocol/%-3s/%s} ",
+ protocol_to_string(sock.dom_family,
+ sock.type, sock.proto));
+ /*
+ * While generally we like to print two addresses,
+ * local and peer, for sockets, it turns out to be
+ * more useful to print the first non-nul address for
+ * local sockets, as typically they aren't bound and
+ * connected, and the path strings can get long.
+ */
+ if (sock.dom_family == AF_LOCAL) {
+ struct sockaddr_un *sun =
+ (struct sockaddr_un *)&sock.sa_local;
+
+ if (sun->sun_path[0] != 0)
+ addr_to_string(&sock.sa_local,
+ src_addr, sizeof(src_addr));
+ else
+ addr_to_string(&sock.sa_peer,
+ src_addr, sizeof(src_addr));
+ xo_emit("{:path/%s}", src_addr);
+ } else {
+ addr_to_string(&sock.sa_local, src_addr,
+ sizeof(src_addr));
+ addr_to_string(&sock.sa_peer, dst_addr,
+ sizeof(dst_addr));
+ xo_emit("{:path/%s %s}", src_addr, dst_addr);
+ }
+ break;
+
+ default:
+ xo_emit("{:protocol/%-3s/%s} ", "-");
+ xo_emit("{:path/%-18s/%s}", fst->fs_path != NULL ?
+ fst->fs_path : "-");
+ }
+
+ xo_emit("\n");
+ xo_close_instance("files");
+ }
+ xo_close_list("files");
+ procstat_freefiles(procstat, head);
+}
diff --git a/usr.bin/procstat/procstat_kstack.c b/usr.bin/procstat/procstat_kstack.c
new file mode 100644
index 0000000..a413926
--- /dev/null
+++ b/usr.bin/procstat/procstat_kstack.c
@@ -0,0 +1,246 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+/*
+ * Walk the stack trace provided by the kernel and reduce it to what we
+ * actually want to print. This involves stripping true instruction pointers,
+ * frame numbers, and carriage returns as generated by stack(9). If -kk is
+ * specified, print the function and offset, otherwise just the function.
+ */
+enum trace_state { TS_FRAMENUM, TS_PC, TS_AT, TS_FUNC, TS_OFF };
+
+static enum trace_state
+kstack_nextstate(enum trace_state ts)
+{
+
+ switch (ts) {
+ case TS_FRAMENUM:
+ return (TS_PC);
+
+ case TS_PC:
+ return (TS_AT);
+
+ case TS_AT:
+ return (TS_FUNC);
+
+ case TS_FUNC:
+ return (TS_OFF);
+
+ case TS_OFF:
+ return TS_FRAMENUM;
+
+ default:
+ errx(-1, "kstack_nextstate");
+ }
+}
+
+static void
+kstack_cleanup(const char *old, char *new, int kflag)
+{
+ enum trace_state old_ts, ts;
+ const char *cp_old;
+ char *cp_new;
+
+ ts = TS_FRAMENUM;
+ for (cp_old = old, cp_new = new; *cp_old != '\0'; cp_old++) {
+ switch (*cp_old) {
+ case ' ':
+ case '\n':
+ case '+':
+ old_ts = ts;
+ ts = kstack_nextstate(old_ts);
+ if (old_ts == TS_OFF) {
+ *cp_new = ' ';
+ cp_new++;
+ }
+ if (kflag > 1 && old_ts == TS_FUNC) {
+ *cp_new = '+';
+ cp_new++;
+ }
+ continue;
+ }
+ if (ts == TS_FUNC || (kflag > 1 && ts == TS_OFF)) {
+ *cp_new = *cp_old;
+ cp_new++;
+ }
+ }
+ *cp_new = '\0';
+}
+
+static void
+kstack_cleanup_encoded(const char *old, char *new, int kflag)
+{
+ enum trace_state old_ts, ts;
+ const char *cp_old;
+ char *cp_new, *cp_loop, *cp_tofree, *cp_line;
+
+ ts = TS_FRAMENUM;
+ if (kflag == 1) {
+ for (cp_old = old, cp_new = new; *cp_old != '\0'; cp_old++) {
+ switch (*cp_old) {
+ case '\n':
+ *cp_new = *cp_old;
+ cp_new++;
+ case ' ':
+ case '+':
+ old_ts = ts;
+ ts = kstack_nextstate(old_ts);
+ continue;
+ }
+ if (ts == TS_FUNC) {
+ *cp_new = *cp_old;
+ cp_new++;
+ }
+ }
+ *cp_new = '\0';
+ cp_tofree = cp_loop = strdup(new);
+ } else
+ cp_tofree = cp_loop = strdup(old);
+ while ((cp_line = strsep(&cp_loop, "\n")) != NULL) {
+ if (strlen(cp_line) != 0 && *cp_line != 127)
+ xo_emit("{le:token/%s}", cp_line);
+ }
+ free(cp_tofree);
+}
+
+/*
+ * Sort threads by tid.
+ */
+static int
+kinfo_kstack_compare(const void *a, const void *b)
+{
+
+ return ((const struct kinfo_kstack *)a)->kkst_tid -
+ ((const struct kinfo_kstack *)b)->kkst_tid;
+}
+
+static void
+kinfo_kstack_sort(struct kinfo_kstack *kkstp, int count)
+{
+
+ qsort(kkstp, count, sizeof(*kkstp), kinfo_kstack_compare);
+}
+
+
+void
+procstat_kstack(struct procstat *procstat, struct kinfo_proc *kipp, int kflag)
+{
+ struct kinfo_kstack *kkstp, *kkstp_free;
+ struct kinfo_proc *kip, *kip_free;
+ char trace[KKST_MAXLEN], encoded_trace[KKST_MAXLEN];
+ unsigned int i, j;
+ unsigned int kip_count, kstk_count;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %6s %-16s %-16s %-29s}\n", "PID", "TID", "COMM",
+ "TDNAME", "KSTACK");
+
+ kkstp = kkstp_free = procstat_getkstack(procstat, kipp, &kstk_count);
+ if (kkstp == NULL)
+ return;
+
+ /*
+ * We need to re-query for thread information, so don't use *kipp.
+ */
+ kip = kip_free = procstat_getprocs(procstat,
+ KERN_PROC_PID | KERN_PROC_INC_THREAD, kipp->ki_pid, &kip_count);
+
+ if (kip == NULL) {
+ procstat_freekstack(procstat, kkstp_free);
+ return;
+ }
+
+ kinfo_kstack_sort(kkstp, kstk_count);
+ for (i = 0; i < kstk_count; i++) {
+ kkstp = &kkstp_free[i];
+
+ /*
+ * Look up the specific thread using its tid so we can
+ * display the per-thread command line.
+ */
+ kipp = NULL;
+ for (j = 0; j < kip_count; j++) {
+ kipp = &kip_free[j];
+ if (kkstp->kkst_tid == kipp->ki_tid)
+ break;
+ }
+ if (kipp == NULL)
+ continue;
+
+ xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:thread_id/%6d/%d} ", kkstp->kkst_tid);
+ xo_emit("{:command/%-16s/%s} ", kipp->ki_comm);
+ xo_emit("{:thread_name/%-16s/%s} ", (strlen(kipp->ki_tdname) &&
+ (strcmp(kipp->ki_comm, kipp->ki_tdname) != 0)) ?
+ kipp->ki_tdname : "-");
+
+ switch (kkstp->kkst_state) {
+ case KKST_STATE_RUNNING:
+ xo_emit("{:state/%-29s/%s}\n", "<running>");
+ continue;
+
+ case KKST_STATE_SWAPPED:
+ xo_emit("{:state/%-29s/%s}\n", "<swapped>");
+ continue;
+
+ case KKST_STATE_STACKOK:
+ break;
+
+ default:
+ xo_emit("{:state/%-29s/%s}\n", "<unknown>");
+ continue;
+ }
+
+ /*
+ * The kernel generates a trace with carriage returns between
+ * entries, but for a more compact view, we convert carriage
+ * returns to spaces.
+ */
+ kstack_cleanup(kkstp->kkst_trace, trace, kflag);
+ xo_open_list("trace");
+ kstack_cleanup_encoded(kkstp->kkst_trace, encoded_trace, kflag);
+ xo_close_list("trace");
+ xo_emit("{d:trace/%-29s}\n", trace);
+ }
+ procstat_freekstack(procstat, kkstp_free);
+ procstat_freeprocs(procstat, kip_free);
+}
diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c
new file mode 100644
index 0000000..5088c59
--- /dev/null
+++ b/usr.bin/procstat/procstat_rlimit.c
@@ -0,0 +1,127 @@
+/*-
+ * Copyright (c) 2011 Mikolaj Golub
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/resourcevar.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <libutil.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+static struct {
+ const char *name;
+ const char *suffix;
+} rlimit_param[15] = {
+ {"cputime", "sec"},
+ {"filesize", "B "},
+ {"datasize", "B "},
+ {"stacksize", "B "},
+ {"coredumpsize", "B "},
+ {"memoryuse", "B "},
+ {"memorylocked", "B "},
+ {"maxprocesses", " "},
+ {"openfiles", " "},
+ {"sbsize", "B "},
+ {"vmemoryuse", "B "},
+ {"pseudo-terminals", " "},
+ {"swapuse", "B "},
+ {"kqueues", " "},
+ {"umtxp", " "},
+};
+
+#if RLIM_NLIMITS > 15
+#error "Resource limits have grown. Add new entries to rlimit_param[]."
+#endif
+
+static const char *
+humanize_rlimit(int indx, rlim_t limit)
+{
+ static char buf[14];
+ int scale;
+
+ if (limit == RLIM_INFINITY)
+ return ("infinity ");
+
+ scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit,
+ rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL);
+ (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit,
+ rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL);
+ /* Pad with one space if there is no suffix prefix. */
+ if (scale == 0)
+ sprintf(buf + strlen(buf), " ");
+ return (buf);
+}
+
+void
+procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp)
+{
+ struct rlimit rlimit;
+ int i;
+
+ if (!hflag) {
+ xo_emit("{T:/%5s %-16s %-16s %16s %16s}\n",
+ "PID", "COMM", "RLIMIT", "SOFT ", "HARD ");
+ }
+ xo_emit("{ek:process_id/%5d}{e:command/%-16s/%s}", kipp->ki_pid,
+ kipp->ki_comm);
+ for (i = 0; i < RLIM_NLIMITS; i++) {
+ if (procstat_getrlimit(prstat, kipp, i, &rlimit) == -1)
+ return;
+ xo_emit("{dk:process_id/%5d} {d:command/%-16s} "
+ "{d:rlimit_param/%-16s} ", kipp->ki_pid, kipp->ki_comm,
+ rlimit_param[i].name);
+
+ xo_open_container(rlimit_param[i].name);
+ if (rlimit.rlim_cur == RLIM_INFINITY)
+ xo_emit("{e:soft_limit/infinity}");
+ else
+ xo_emit("{e:soft_limit/%U}", rlimit.rlim_cur);
+
+ if (rlimit.rlim_max == RLIM_INFINITY)
+ xo_emit("{e:hard_limit/infinity}");
+ else
+ xo_emit("{e:hard_limit/%U}", rlimit.rlim_max);
+ xo_close_container(rlimit_param[i].name);
+
+ xo_emit("{d:rlim_cur/%16s} ",
+ humanize_rlimit(i, rlimit.rlim_cur));
+ xo_emit("{d:rlim_max/%16s}\n",
+ humanize_rlimit(i, rlimit.rlim_max));
+ }
+}
diff --git a/usr.bin/procstat/procstat_rusage.c b/usr.bin/procstat/procstat_rusage.c
new file mode 100644
index 0000000..e14ae24
--- /dev/null
+++ b/usr.bin/procstat/procstat_rusage.c
@@ -0,0 +1,197 @@
+/*-
+ * Copyright (c) 2012 Hudson River Trading LLC
+ * Written by: John H. Baldwin <jhb@FreeBSD.org>
+ * Copyright (c) 2015 Allan Jude <allanjude@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 <stdlib.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)
+{
+
+ xo_emit("{d:process_id/%5d/%d} ", kipp->ki_pid);
+ if (Hflag)
+ xo_emit("{d:thread_id/%6d/%d} ", kipp->ki_tid);
+ xo_emit("{d:command/%-16s/%s} ", kipp->ki_comm);
+}
+
+static void
+print_rusage(struct kinfo_proc *kipp)
+{
+ long *lp;
+ unsigned int i;
+ char *field, *threadid;
+
+ print_prefix(kipp);
+ xo_emit("{d:resource/%-14s} {d:usage/%29s}{P: }\n", "user time",
+ format_time(&kipp->ki_rusage.ru_utime));
+ print_prefix(kipp);
+ xo_emit("{d:resource/%-14s} {d:usage/%29s}{P: }\n", "system time",
+ format_time(&kipp->ki_rusage.ru_stime));
+
+ if (Hflag) {
+ asprintf(&threadid, "%d", kipp->ki_tid);
+ if (threadid == NULL)
+ xo_errc(1, ENOMEM,
+ "Failed to allocate memory in print_rusage()");
+ xo_open_container(threadid);
+ xo_emit("{e:thread_id/%d}", kipp->ki_tid);
+ } else {
+ xo_emit("{e:process_id/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%s}", kipp->ki_comm);
+ }
+ xo_emit("{e:user time/%s}", format_time(&kipp->ki_rusage.ru_utime));
+ xo_emit("{e:system time/%s}", format_time(&kipp->ki_rusage.ru_stime));
+
+ lp = &kipp->ki_rusage.ru_maxrss;
+ for (i = 0; i < nitems(rusage_info); i++) {
+ print_prefix(kipp);
+ asprintf(&field, "{e:%s/%%D}", rusage_info[i].ri_name);
+ if (field == NULL)
+ xo_errc(1, ENOMEM,
+ "Failed to allocate memory in print_rusage()");
+ xo_emit(field, *lp);
+ free(field);
+ xo_emit("{d:resource/%-32s} {d:usage/%14s}\n",
+ rusage_info[i].ri_name,
+ format_value(*lp, rusage_info[i].ri_humanize,
+ rusage_info[i].ri_scale));
+ lp++;
+ }
+ if (Hflag) {
+ xo_close_container(threadid);
+ free(threadid);
+ }
+}
+
+void
+procstat_rusage(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct kinfo_proc *kip;
+ unsigned int count, i;
+
+ if (!hflag) {
+ xo_emit("{d:ta/%5s} ", "PID");
+ if (Hflag)
+ xo_emit("{d:tb/%6s} ", "TID");
+ xo_emit("{d:tc/%-16s %-32s %14s}\n", "COMM", "RESOURCE",
+ "VALUE ");
+ }
+
+ if (!Hflag) {
+ print_rusage(kipp);
+ return;
+ }
+
+ xo_emit("{e:process_id/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%s}", kipp->ki_comm);
+ xo_open_container("threads");
+
+ 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]);
+ }
+
+ xo_close_container("threads");
+ procstat_freeprocs(procstat, kip);
+}
diff --git a/usr.bin/procstat/procstat_sigs.c b/usr.bin/procstat/procstat_sigs.c
new file mode 100644
index 0000000..7bc73ec
--- /dev/null
+++ b/usr.bin/procstat/procstat_sigs.c
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 2010 Konstantin Belousov
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libprocstat.h>
+
+#include "procstat.h"
+
+static void
+procstat_print_signame(int sig)
+{
+ char name[12];
+ int i;
+
+ if (!nflag && sig < sys_nsig) {
+ strlcpy(name, sys_signame[sig], sizeof(name));
+ for (i = 0; name[i] != 0; i++)
+ name[i] = toupper(name[i]);
+ xo_emit("{d:signal/%-7s/%s} ", name);
+ xo_open_container(name);
+ } else {
+ xo_emit("{d:signal/%-7d/%d} ", sig);
+ snprintf(name, 12, "%d", sig);
+ xo_open_container(name);
+ }
+}
+
+static void
+procstat_close_signame(int sig)
+{
+ char name[12];
+ int i;
+
+ if (!nflag && sig < sys_nsig) {
+ strlcpy(name, sys_signame[sig], sizeof(name));
+ for (i = 0; name[i] != 0; i++)
+ name[i] = toupper(name[i]);
+ xo_close_container(name);
+ } else
+ snprintf(name, 12, "%d", sig);
+ xo_close_container(name);
+}
+
+static void
+procstat_print_sig(const sigset_t *set, int sig, char flag)
+{
+ xo_emit("{d:sigmember/%c}", sigismember(set, sig) ? flag : '-');
+ switch (flag) {
+ case 'B':
+ xo_emit("{en:mask/%s}", sigismember(set, sig) ?
+ "true" : "false");
+ break;
+ case 'C':
+ xo_emit("{en:catch/%s}", sigismember(set, sig) ?
+ "true" : "false");
+ break;
+ case 'P':
+ xo_emit("{en:list/%s}", sigismember(set, sig) ?
+ "true" : "false");
+ break;
+ case 'I':
+ xo_emit("{en:ignore/%s}", sigismember(set, sig) ?
+ "true" : "false");
+ break;
+ default:
+ xo_emit("{en:unknown/%s}", sigismember(set, sig) ?
+ "true" : "false");
+ break;
+ }
+}
+
+void
+procstat_sigs(struct procstat *prstat __unused, struct kinfo_proc *kipp)
+{
+ int j;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %-16s %-7s %4s}\n", "PID", "COMM", "SIG",
+ "FLAGS");
+
+ xo_emit("{ek:process_id/%5d/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%-16s/%s}", kipp->ki_comm);
+ xo_open_container("signals");
+ for (j = 1; j <= _SIG_MAXSIG; j++) {
+ xo_emit("{dk:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{d:command/%-16s/%s} ", kipp->ki_comm);
+ procstat_print_signame(j);
+ xo_emit(" ");
+ procstat_print_sig(&kipp->ki_siglist, j, 'P');
+ procstat_print_sig(&kipp->ki_sigignore, j, 'I');
+ procstat_print_sig(&kipp->ki_sigcatch, j, 'C');
+ procstat_close_signame(j);
+ xo_emit("\n");
+ }
+ xo_close_container("signals");
+}
+
+void
+procstat_threads_sigs(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct kinfo_proc *kip;
+ int j;
+ unsigned int count, i;
+ char *threadid;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %6s %-16s %-7s %4s}\n", "PID", "TID", "COMM",
+ "SIG", "FLAGS");
+
+ kip = procstat_getprocs(procstat, KERN_PROC_PID | KERN_PROC_INC_THREAD,
+ kipp->ki_pid, &count);
+ if (kip == NULL)
+ return;
+ xo_emit("{ek:process_id/%5d/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%-16s/%s}", kipp->ki_comm);
+ xo_open_container("threads");
+ kinfo_proc_sort(kip, count);
+ for (i = 0; i < count; i++) {
+ kipp = &kip[i];
+ asprintf(&threadid, "%d", kipp->ki_tid);
+ if (threadid == NULL)
+ xo_errc(1, ENOMEM, "Failed to allocate memory in "
+ "procstat_threads_sigs()");
+ xo_open_container(threadid);
+ xo_emit("{e:thread_id/%6d/%d}", kipp->ki_tid);
+ xo_open_container("signals");
+ for (j = 1; j <= _SIG_MAXSIG; j++) {
+ xo_emit("{dk:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{d:thread_id/%6d/%d} ", kipp->ki_tid);
+ xo_emit("{d:command/%-16s/%s} ", kipp->ki_comm);
+ procstat_print_signame(j);
+ xo_emit(" ");
+ procstat_print_sig(&kipp->ki_siglist, j, 'P');
+ procstat_print_sig(&kipp->ki_sigmask, j, 'B');
+ procstat_close_signame(j);
+ xo_emit("\n");
+ }
+ xo_close_container("signals");
+ xo_close_container(threadid);
+ free(threadid);
+ }
+ xo_close_container("threads");
+ procstat_freeprocs(procstat, kip);
+}
diff --git a/usr.bin/procstat/procstat_threads.c b/usr.bin/procstat/procstat_threads.c
new file mode 100644
index 0000000..aa9f9b5
--- /dev/null
+++ b/usr.bin/procstat/procstat_threads.c
@@ -0,0 +1,134 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "procstat.h"
+
+void
+procstat_threads(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct kinfo_proc *kip;
+ unsigned int count, i;
+ const char *str;
+ char *threadid;
+
+ if (!hflag)
+ xo_emit("{T:/%5s %6s %-16s %-16s %2s %4s %-7s %-9s}\n", "PID",
+ "TID", "COMM", "TDNAME", "CPU", "PRI", "STATE", "WCHAN");
+
+ xo_emit("{ek:process_id/%d}", kipp->ki_pid);
+ xo_emit("{e:command/%s}", strlen(kipp->ki_comm) ?
+ kipp->ki_comm : "-");
+ xo_open_container("threads");
+
+ 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++) {
+ kipp = &kip[i];
+ asprintf(&threadid, "%d", kipp->ki_tid);
+ if (threadid == NULL)
+ xo_errc(1, ENOMEM, "Failed to allocate memory in "
+ "procstat_threads()");
+ xo_open_container(threadid);
+ xo_emit("{dk:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{:thread_id/%6d/%d} ", kipp->ki_tid);
+ xo_emit("{d:command/%-16s/%s} ", strlen(kipp->ki_comm) ?
+ kipp->ki_comm : "-");
+ xo_emit("{:thread_name/%-16s/%s} ", (strlen(kipp->ki_tdname) &&
+ (strcmp(kipp->ki_comm, kipp->ki_tdname) != 0)) ?
+ kipp->ki_tdname : "-");
+ if (kipp->ki_oncpu != 255)
+ xo_emit("{:cpu/%3d/%d} ", kipp->ki_oncpu);
+ else if (kipp->ki_lastcpu != 255)
+ xo_emit("{:cpu/%3d/%d} ", kipp->ki_lastcpu);
+ else
+ xo_emit("{:cpu/%3s/%s} ", "-");
+ xo_emit("{:priority/%4d/%d} ", kipp->ki_pri.pri_level);
+ switch (kipp->ki_stat) {
+ case SRUN:
+ str = "run";
+ break;
+
+ case SSTOP:
+ str = "stop";
+ break;
+
+ case SSLEEP:
+ str = "sleep";
+ break;
+
+ case SLOCK:
+ str = "lock";
+ break;
+
+ case SWAIT:
+ str = "wait";
+ break;
+
+ case SZOMB:
+ str = "zomb";
+ break;
+
+ case SIDL:
+ str = "idle";
+ break;
+
+ default:
+ str = "??";
+ break;
+ }
+ xo_emit("{:run_state/%-7s/%s} ", str);
+ if (kipp->ki_kiflag & KI_LOCKBLOCK) {
+ xo_emit("{:lock_name/*%-8s/%s} ",
+ strlen(kipp->ki_lockname) ?
+ kipp->ki_lockname : "-");
+ } else {
+ xo_emit("{:wait_channel/%-9s/%s} ",
+ strlen(kipp->ki_wmesg) ? kipp->ki_wmesg : "-");
+ }
+ xo_close_container(threadid);
+ free(threadid);
+ xo_emit("\n");
+ }
+ xo_close_container("threads");
+ procstat_freeprocs(procstat, kip);
+}
diff --git a/usr.bin/procstat/procstat_vm.c b/usr.bin/procstat/procstat_vm.c
new file mode 100644
index 0000000..8c641e5
--- /dev/null
+++ b/usr.bin/procstat/procstat_vm.c
@@ -0,0 +1,164 @@
+/*-
+ * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2015 Allan Jude <allanjude@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$
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libprocstat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <libutil.h>
+
+#include "procstat.h"
+
+void
+procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct kinfo_vmentry *freep, *kve;
+ int ptrwidth;
+ int i, cnt;
+ const char *str, *lstr;
+
+ ptrwidth = 2*sizeof(void *) + 2;
+ if (!hflag)
+ xo_emit("{T:/%5s %*s %*s %3s %4s %4s %3s %3s %-4s %-2s %-s}\n",
+ "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES",
+ "PRES", "REF", "SHD", "FLAG", "TP", "PATH");
+
+ xo_emit("{ek:process_id/%d}", kipp->ki_pid);
+
+ freep = procstat_getvmmap(procstat, kipp, &cnt);
+ if (freep == NULL)
+ return;
+ xo_open_list("vm");
+ for (i = 0; i < cnt; i++) {
+ xo_open_instance("vm");
+ kve = &freep[i];
+ xo_emit("{dk:process_id/%5d} ", kipp->ki_pid);
+ xo_emit("{d:kve_start/%#*jx} ", ptrwidth,
+ (uintmax_t)kve->kve_start);
+ xo_emit("{d:kve_end/%#*jx} ", ptrwidth,
+ (uintmax_t)kve->kve_end);
+ xo_emit("{e:kve_start/%#jx}", (uintmax_t)kve->kve_start);
+ xo_emit("{e:kve_end/%#jx}", (uintmax_t)kve->kve_end);
+ xo_emit("{d:read/%s}", kve->kve_protection & KVME_PROT_READ ?
+ "r" : "-");
+ xo_emit("{d:write/%s}", kve->kve_protection & KVME_PROT_WRITE ?
+ "w" : "-");
+ xo_emit("{d:exec/%s} ", kve->kve_protection & KVME_PROT_EXEC ?
+ "x" : "-");
+ xo_open_container("kve_protection");
+ xo_emit("{en:read/%s}", kve->kve_protection & KVME_PROT_READ ?
+ "true" : "false");
+ xo_emit("{en:write/%s}", kve->kve_protection & KVME_PROT_WRITE ?
+ "true" : "false");
+ xo_emit("{en:exec/%s}", kve->kve_protection & KVME_PROT_EXEC ?
+ "true" : "false");
+ xo_close_container("kve_protection");
+ xo_emit("{:kve_resident/%4d/%d} ", kve->kve_resident);
+ xo_emit("{:kve_private_resident/%4d/%d} ",
+ kve->kve_private_resident);
+ xo_emit("{:kve_ref_count/%3d/%d} ", kve->kve_ref_count);
+ xo_emit("{:kve_shadow_count/%3d/%d} ", kve->kve_shadow_count);
+ xo_emit("{d:copy_on_write/%-1s}", kve->kve_flags &
+ KVME_FLAG_COW ? "C" : "-");
+ xo_emit("{d:need_copy/%-1s}", kve->kve_flags &
+ KVME_FLAG_NEEDS_COPY ? "N" : "-");
+ xo_emit("{d:super_pages/%-1s}", kve->kve_flags &
+ KVME_FLAG_SUPER ? "S" : "-");
+ xo_emit("{d:grows_down/%-1s} ", kve->kve_flags &
+ KVME_FLAG_GROWS_UP ? "U" : kve->kve_flags &
+ KVME_FLAG_GROWS_DOWN ? "D" : "-");
+ xo_open_container("kve_flags");
+ xo_emit("{en:copy_on_write/%s}", kve->kve_flags &
+ KVME_FLAG_COW ? "true" : "false");
+ xo_emit("{en:needs_copy/%s}", kve->kve_flags &
+ KVME_FLAG_NEEDS_COPY ? "true" : "false");
+ xo_emit("{en:super_pages/%s}", kve->kve_flags &
+ KVME_FLAG_SUPER ? "true" : "false");
+ xo_emit("{en:grows_up/%s}", kve->kve_flags &
+ KVME_FLAG_GROWS_UP ? "true" : "false");
+ xo_emit("{en:grows_down/%s}", kve->kve_flags &
+ KVME_FLAG_GROWS_DOWN ? "true" : "false");
+ xo_close_container("kve_flags");
+ switch (kve->kve_type) {
+ case KVME_TYPE_NONE:
+ str = "--";
+ lstr = "none";
+ break;
+ case KVME_TYPE_DEFAULT:
+ str = "df";
+ lstr = "default";
+ break;
+ case KVME_TYPE_VNODE:
+ str = "vn";
+ lstr = "vnode";
+ break;
+ case KVME_TYPE_SWAP:
+ str = "sw";
+ lstr = "swap";
+ break;
+ case KVME_TYPE_DEVICE:
+ str = "dv";
+ lstr = "device";
+ break;
+ case KVME_TYPE_PHYS:
+ str = "ph";
+ lstr = "physical";
+ break;
+ case KVME_TYPE_DEAD:
+ str = "dd";
+ lstr = "dead";
+ break;
+ case KVME_TYPE_SG:
+ str = "sg";
+ lstr = "scatter/gather";
+ break;
+ case KVME_TYPE_MGTDEVICE:
+ str = "md";
+ lstr = "managed_device";
+ break;
+ case KVME_TYPE_UNKNOWN:
+ default:
+ str = "??";
+ lstr = "unknown";
+ break;
+ }
+ xo_emit("{d:kve_type/%-2s} ", str);
+ xo_emit("{e:kve_type/%s}", lstr);
+ xo_emit("{:kve_path/%-s/%s}\n", kve->kve_path);
+ xo_close_instance("vm");
+ }
+ xo_close_list("vm");
+ free(freep);
+}
diff --git a/usr.bin/protect/Makefile b/usr.bin/protect/Makefile
new file mode 100644
index 0000000..89bbda8
--- /dev/null
+++ b/usr.bin/protect/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= protect
+WARNS?= 6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/protect/Makefile.depend b/usr.bin/protect/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/protect/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/protect/protect.1 b/usr.bin/protect/protect.1
new file mode 100644
index 0000000..b9be4af
--- /dev/null
+++ b/usr.bin/protect/protect.1
@@ -0,0 +1,89 @@
+.\" Copyright (c) 2013 Hudson River Trading 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 19, 2013
+.Dt PROTECT 1
+.Os
+.Sh NAME
+.Nm protect
+.Nd "protect processes from being killed when swap space is exhausted"
+.Sh SYNOPSIS
+.Nm
+.Op Fl i
+.Ar command
+.Nm
+.Op Fl cdi
+.Fl g Ar pgrp | Fl p Ar pid
+.Sh DESCRIPTION
+The
+.Nm
+command is used to mark processes as protected.
+The kernel does not kill protected processes when swap space is exhausted.
+Note that this protected state is not inherited by child processes by default.
+.Pp
+The options are:
+.Bl -tag -width XXXXXXXXXX
+.It Fl c
+Remove protection from the specified processes.
+.It Fl d
+Apply the operation to all current children of the specified processes.
+.It Fl i
+Apply the operation to all future children of the specified processes.
+.It Fl g Ar pgrp
+Apply the operation to all processes in the specified process group.
+.It Fl p Ar pid
+Apply the operation to the specified process.
+.It Ar command
+Execute
+.Ar command
+as a protected process.
+.El
+.Pp
+Note that only one of the
+.Fl p
+or
+.Fl g
+flags may be specified when adjusting the state of existing processes.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Mark the Xorg server as protected:
+.Pp
+.Dl "pgrep Xorg | xargs protect -p"
+.Pp
+Protect all ssh sessions and their child processes:
+.Pp
+.Dl "pgrep sshd | xargs protect -dip"
+.Pp
+Remove protection from all current and future processes:
+.Pp
+.Dl "protect -cdi -p 1"
+.Sh SEE ALSO
+.Xr procctl 2
+.Sh BUGS
+If you protect a runaway process that allocates all memory the system will
+deadlock.
diff --git a/usr.bin/protect/protect.c b/usr.bin/protect/protect.c
new file mode 100644
index 0000000..16b0d29
--- /dev/null
+++ b/usr.bin/protect/protect.c
@@ -0,0 +1,122 @@
+/*-
+ * Copyright (c) 2013 Hudson River Trading 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/procctl.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <err.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: protect [-i] command\n");
+ fprintf(stderr, " protect [-cdi] -g pgrp | -p pid\n");
+ exit(1);
+}
+
+static id_t
+parse_id(char *id)
+{
+ static bool first = true;
+ long value;
+ char *ch;
+
+ if (!first) {
+ warnx("only one -g or -p flag is permitted");
+ usage();
+ }
+ value = strtol(id, &ch, 0);
+ if (*ch != '\0') {
+ warnx("invalid process id");
+ usage();
+ }
+ return (value);
+}
+
+int
+main(int argc, char *argv[])
+{
+ idtype_t idtype;
+ id_t id;
+ int ch, flags;
+ bool descend, inherit, idset;
+
+ idtype = P_PID;
+ id = getpid();
+ flags = PPROT_SET;
+ descend = inherit = idset = false;
+ while ((ch = getopt(argc, argv, "cdig:p:")) != -1)
+ switch (ch) {
+ case 'c':
+ flags = PPROT_CLEAR;
+ break;
+ case 'd':
+ descend = true;
+ break;
+ case 'i':
+ inherit = true;
+ break;
+ case 'g':
+ idtype = P_PGID;
+ id = parse_id(optarg);
+ idset = true;
+ break;
+ case 'p':
+ idtype = P_PID;
+ id = parse_id(optarg);
+ idset = true;
+ break;
+ }
+ argc -= optind;
+ argv += optind;
+
+ if ((idset && argc != 0) || (!idset && (argc == 0 || descend)))
+ usage();
+
+ if (descend)
+ flags |= PPROT_DESCEND;
+ if (inherit)
+ flags |= PPROT_INHERIT;
+ if (procctl(idtype, id, PROC_SPROTECT, &flags) == -1)
+ err(1, "procctl");
+
+ if (argc != 0) {
+ errno = 0;
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+ }
+ return (0);
+}
diff --git a/usr.bin/quota/Makefile b/usr.bin/quota/Makefile
new file mode 100644
index 0000000..753972e
--- /dev/null
+++ b/usr.bin/quota/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= quota
+BINOWN= root
+BINMODE=4555
+
+LIBADD= rpcsvc util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/quota/Makefile.depend b/usr.bin/quota/Makefile.depend
new file mode 100644
index 0000000..88d0220
--- /dev/null
+++ b/usr.bin/quota/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/librpcsvc \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/quota/quota.1 b/usr.bin/quota/quota.1
new file mode 100644
index 0000000..c49553e
--- /dev/null
+++ b/usr.bin/quota/quota.1
@@ -0,0 +1,176 @@
+.\" Copyright (c) 1983, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Robert Elz at The University of Melbourne.
+.\"
+.\" 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.
+.\"
+.\" from: @(#)quota.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 3, 2007
+.Dt QUOTA 1
+.Os
+.Sh NAME
+.Nm quota
+.Nd display disk usage and limits
+.Sh SYNOPSIS
+.Nm
+.Op Fl ghlu
+.Op Fl f Ar path
+.Op Fl v | q | r
+.Nm
+.Op Fl hlu
+.Op Fl f Ar path
+.Op Fl v | q | r
+.Ar user ...
+.Nm
+.Fl g
+.Op Fl hl
+.Op Fl f Ar path
+.Op Fl v | q | r
+.Ar group ...
+.Sh DESCRIPTION
+The
+.Nm
+utility displays users' disk usage and limits.
+By default only the user quotas are printed.
+Disk block usage and limits are shown in 1024-byte blocks.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl f Ar path
+Only display quota information for the file system
+that contains the specified path.
+This can be any file within a mounted file system.
+.It Fl g
+Print group quotas for the group
+of which the user is a member.
+.It Fl h
+"Human-readable" output.
+Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.
+.It Fl l
+Do not report quotas on
+.Tn NFS
+file systems.
+.It Fl q
+Print a more terse message,
+containing only information
+on file systems where usage is over quota.
+The
+.Fl q
+flag takes precedence over the
+.Fl v
+flag.
+.It Fl r
+Display the raw quota information as it appears in the quota structure.
+Non-zero time values will also be displayed in
+.Xr ctime 3
+format.
+This option implies
+.Fl v
+and will override the
+.Fl q
+flag.
+.It Fl u
+Print the user quotas.
+This is the default unless
+.Fl g
+is specified.
+.It Fl v
+Display quotas on file systems
+where no storage is allocated.
+.El
+.Pp
+Specifying both
+.Fl g
+and
+.Fl u
+displays both the user quotas and the group quotas (for
+the user).
+.Pp
+Only the super-user may use the
+.Fl u
+flag and the optional
+.Ar user
+argument to view the limits of other users.
+Non-super-users can use the
+.Fl g
+flag and optional
+.Ar group
+argument to view only the limits of groups of which they are members.
+.Pp
+The
+.Nm
+utility tries to report the quotas of all mounted file systems.
+If the file system is mounted via
+.Tn NFS ,
+it will attempt to contact the
+.Xr rpc.rquotad 8
+daemon on the
+.Tn NFS
+server.
+For
+.Tn UFS
+file systems, quotas must be turned on in
+.Pa /etc/fstab .
+If
+.Nm
+exits with a non-zero status, one or more file systems
+are over quota or the path specified with the
+.Fl f
+option does not exist.
+.Pp
+If the
+.Fl l
+flag is specified,
+.Nm
+will not check
+.Tn NFS
+file systems.
+.Sh FILES
+.Bl -tag -width quota.group -compact
+.It Pa quota.user
+located at the file system root with user quotas
+.It Pa quota.group
+located at the file system root with group quotas
+.It Pa /etc/fstab
+to find file system names and locations
+.El
+.Sh SEE ALSO
+.Xr quotactl 2 ,
+.Xr ctime 3 ,
+.Xr fstab 5 ,
+.Xr edquota 8 ,
+.Xr quotacheck 8 ,
+.Xr quotaon 8 ,
+.Xr repquota 8 ,
+.Xr rpc.rquotad 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
new file mode 100644
index 0000000..c88f2aa
--- /dev/null
+++ b/usr.bin/quota/quota.c
@@ -0,0 +1,687 @@
+/*
+ * Copyright (c) 1980, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * 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, 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+
+/*
+ * Disk quota reporting program.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+#include <sys/socket.h>
+
+#include <rpc/rpc.h>
+#include <rpc/pmap_prot.h>
+#include <rpcsvc/rquota.h>
+
+#include <ufs/ufs/quota.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <fstab.h>
+#include <grp.h>
+#include <libutil.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+static const char *qfextension[] = INITQFNAMES;
+
+struct quotause {
+ struct quotause *next;
+ long flags;
+ struct dqblk dqblk;
+ char fsname[MAXPATHLEN + 1];
+};
+
+static char *timeprt(int64_t seconds);
+static struct quotause *getprivs(long id, int quotatype);
+static void usage(void);
+static int showuid(u_long uid);
+static int showgid(u_long gid);
+static int showusrname(char *name);
+static int showgrpname(char *name);
+static int showquotas(int type, u_long id, const char *name);
+static void showrawquotas(int type, u_long id, struct quotause *qup);
+static void heading(int type, u_long id, const char *name, const char *tag);
+static int getufsquota(struct fstab *fs, struct quotause *qup, long id,
+ int quotatype);
+static int getnfsquota(struct statfs *fst, struct quotause *qup, long id,
+ int quotatype);
+static int callaurpc(char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
+static int alldigits(char *s);
+
+static int hflag;
+static int lflag;
+static int rflag;
+static int qflag;
+static int vflag;
+static char *filename = NULL;
+
+int
+main(int argc, char *argv[])
+{
+ int ngroups;
+ gid_t mygid, gidset[NGROUPS];
+ int i, ch, gflag = 0, uflag = 0, errflag = 0;
+
+ while ((ch = getopt(argc, argv, "f:ghlrquv")) != -1) {
+ switch(ch) {
+ case 'f':
+ filename = optarg;
+ break;
+ case 'g':
+ gflag++;
+ break;
+ case 'h':
+ hflag++;
+ break;
+ case 'l':
+ lflag++;
+ break;
+ case 'q':
+ qflag++;
+ break;
+ case 'r':
+ rflag++;
+ break;
+ case 'u':
+ uflag++;
+ break;
+ case 'v':
+ vflag++;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (!uflag && !gflag)
+ uflag++;
+ if (argc == 0) {
+ if (uflag)
+ errflag += showuid(getuid());
+ if (gflag) {
+ mygid = getgid();
+ ngroups = getgroups(NGROUPS, gidset);
+ if (ngroups < 0)
+ err(1, "getgroups");
+ errflag += showgid(mygid);
+ for (i = 0; i < ngroups; i++)
+ if (gidset[i] != mygid)
+ errflag += showgid(gidset[i]);
+ }
+ return(errflag);
+ }
+ if (uflag && gflag)
+ usage();
+ if (uflag) {
+ for (; argc > 0; argc--, argv++) {
+ if (alldigits(*argv))
+ errflag += showuid(atoi(*argv));
+ else
+ errflag += showusrname(*argv);
+ }
+ return(errflag);
+ }
+ if (gflag) {
+ for (; argc > 0; argc--, argv++) {
+ if (alldigits(*argv))
+ errflag += showgid(atoi(*argv));
+ else
+ errflag += showgrpname(*argv);
+ }
+ }
+ return(errflag);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "%s\n%s\n%s\n",
+ "usage: quota [-ghlu] [-f path] [-v | -q | -r]",
+ " quota [-hlu] [-f path] [-v | -q | -r] user ...",
+ " quota -g [-hl] [-f path] [-v | -q | -r] group ...");
+ exit(1);
+}
+
+/*
+ * Print out quotas for a specified user identifier.
+ */
+static int
+showuid(u_long uid)
+{
+ struct passwd *pwd = getpwuid(uid);
+ const char *name;
+
+ if (pwd == NULL)
+ name = "(no account)";
+ else
+ name = pwd->pw_name;
+ return(showquotas(USRQUOTA, uid, name));
+}
+
+/*
+ * Print out quotas for a specifed user name.
+ */
+static int
+showusrname(char *name)
+{
+ struct passwd *pwd = getpwnam(name);
+
+ if (pwd == NULL) {
+ warnx("%s: unknown user", name);
+ return(1);
+ }
+ return(showquotas(USRQUOTA, pwd->pw_uid, name));
+}
+
+/*
+ * Print out quotas for a specified group identifier.
+ */
+static int
+showgid(u_long gid)
+{
+ struct group *grp = getgrgid(gid);
+ const char *name;
+
+ if (grp == NULL)
+ name = "(no entry)";
+ else
+ name = grp->gr_name;
+ return(showquotas(GRPQUOTA, gid, name));
+}
+
+/*
+ * Print out quotas for a specifed group name.
+ */
+static int
+showgrpname(char *name)
+{
+ struct group *grp = getgrnam(name);
+
+ if (grp == NULL) {
+ warnx("%s: unknown group", name);
+ return(1);
+ }
+ return(showquotas(GRPQUOTA, grp->gr_gid, name));
+}
+
+static void
+prthumanval(int len, u_int64_t bytes)
+{
+ char buf[len + 1];
+
+ /*
+ * Limit the width to 5 bytes as that is what users expect.
+ */
+ humanize_number(buf, MIN(sizeof(buf), 5), bytes, "",
+ HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
+
+ (void)printf(" %*s", len, buf);
+}
+
+static int
+showquotas(int type, u_long id, const char *name)
+{
+ struct quotause *qup;
+ struct quotause *quplist;
+ const char *msgi, *msgb;
+ const char *nam;
+ char *bgrace = NULL, *igrace = NULL;
+ int lines = 0, overquota = 0;
+ static time_t now;
+
+ if (now == 0)
+ time(&now);
+ quplist = getprivs(id, type);
+ for (qup = quplist; qup; qup = qup->next) {
+ msgi = NULL;
+ if (qup->dqblk.dqb_ihardlimit &&
+ qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_ihardlimit) {
+ overquota++;
+ msgi = "File limit reached on";
+ }
+ else if (qup->dqblk.dqb_isoftlimit &&
+ qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_isoftlimit) {
+ overquota++;
+ if (qup->dqblk.dqb_itime > now)
+ msgi = "In file grace period on";
+ else
+ msgi = "Over file quota on";
+ }
+ msgb = NULL;
+ if (qup->dqblk.dqb_bhardlimit &&
+ qup->dqblk.dqb_curblocks >= qup->dqblk.dqb_bhardlimit) {
+ overquota++;
+ msgb = "Block limit reached on";
+ }
+ else if (qup->dqblk.dqb_bsoftlimit &&
+ qup->dqblk.dqb_curblocks >= qup->dqblk.dqb_bsoftlimit) {
+ overquota++;
+ if (qup->dqblk.dqb_btime > now)
+ msgb = "In block grace period on";
+ else
+ msgb = "Over block quota on";
+ }
+ if (rflag) {
+ showrawquotas(type, id, qup);
+ continue;
+ }
+ if (!vflag &&
+ qup->dqblk.dqb_isoftlimit == 0 &&
+ qup->dqblk.dqb_ihardlimit == 0 &&
+ qup->dqblk.dqb_bsoftlimit == 0 &&
+ qup->dqblk.dqb_bhardlimit == 0)
+ continue;
+ if (qflag) {
+ if ((msgi != NULL || msgb != NULL) &&
+ lines++ == 0)
+ heading(type, id, name, "");
+ if (msgi != NULL)
+ printf("\t%s %s\n", msgi, qup->fsname);
+ if (msgb != NULL)
+ printf("\t%s %s\n", msgb, qup->fsname);
+ continue;
+ }
+ if (!vflag &&
+ qup->dqblk.dqb_curblocks == 0 &&
+ qup->dqblk.dqb_curinodes == 0)
+ continue;
+ if (lines++ == 0)
+ heading(type, id, name, "");
+ nam = qup->fsname;
+ if (strlen(qup->fsname) > 15) {
+ printf("%s\n", qup->fsname);
+ nam = "";
+ }
+ printf("%-15s", nam);
+ if (hflag) {
+ prthumanval(7, dbtob(qup->dqblk.dqb_curblocks));
+ printf("%c", (msgb == NULL) ? ' ' : '*');
+ prthumanval(7, dbtob(qup->dqblk.dqb_bsoftlimit));
+ prthumanval(7, dbtob(qup->dqblk.dqb_bhardlimit));
+ } else {
+ printf(" %7ju%c %7ju %7ju",
+ (uintmax_t)dbtob(qup->dqblk.dqb_curblocks)
+ / 1024,
+ (msgb == NULL) ? ' ' : '*',
+ (uintmax_t)dbtob(qup->dqblk.dqb_bsoftlimit)
+ / 1024,
+ (uintmax_t)dbtob(qup->dqblk.dqb_bhardlimit)
+ / 1024);
+ }
+ if (msgb != NULL)
+ bgrace = timeprt(qup->dqblk.dqb_btime);
+ if (msgi != NULL)
+ igrace = timeprt(qup->dqblk.dqb_itime);
+ printf("%8s %6ju%c %6ju %6ju%8s\n"
+ , (msgb == NULL) ? "" : bgrace
+ , (uintmax_t)qup->dqblk.dqb_curinodes
+ , (msgi == NULL) ? ' ' : '*'
+ , (uintmax_t)qup->dqblk.dqb_isoftlimit
+ , (uintmax_t)qup->dqblk.dqb_ihardlimit
+ , (msgi == NULL) ? "" : igrace
+ );
+ if (msgb != NULL)
+ free(bgrace);
+ if (msgi != NULL)
+ free(igrace);
+ }
+ if (!qflag && !rflag && lines == 0)
+ heading(type, id, name, "none");
+ return (overquota);
+}
+
+static void
+showrawquotas(int type, u_long id, struct quotause *qup)
+{
+ time_t t;
+
+ printf("Raw %s quota information for id %lu on %s\n",
+ type == USRQUOTA ? "user" : "group", id, qup->fsname);
+ printf("block hard limit: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_bhardlimit);
+ printf("block soft limit: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_bsoftlimit);
+ printf("current block count: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_curblocks);
+ printf("i-node hard limit: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_ihardlimit);
+ printf("i-node soft limit: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_isoftlimit);
+ printf("current i-node count: %ju\n",
+ (uintmax_t)qup->dqblk.dqb_curinodes);
+ printf("block grace time: %jd",
+ (intmax_t)qup->dqblk.dqb_btime);
+ if (qup->dqblk.dqb_btime != 0) {
+ t = qup->dqblk.dqb_btime;
+ printf(" %s", ctime(&t));
+ } else {
+ printf("\n");
+ }
+ printf("i-node grace time: %jd", (intmax_t)qup->dqblk.dqb_itime);
+ if (qup->dqblk.dqb_itime != 0) {
+ t = qup->dqblk.dqb_itime;
+ printf(" %s", ctime(&t));
+ } else {
+ printf("\n");
+ }
+}
+
+
+static void
+heading(int type, u_long id, const char *name, const char *tag)
+{
+
+ printf("Disk quotas for %s %s (%cid %lu): %s\n", qfextension[type],
+ name, *qfextension[type], id, tag);
+ if (!qflag && tag[0] == '\0') {
+ printf("%-15s %7s %8s %7s %7s %6s %7s %6s%8s\n"
+ , "Filesystem"
+ , "usage"
+ , "quota"
+ , "limit"
+ , "grace"
+ , "files"
+ , "quota"
+ , "limit"
+ , "grace"
+ );
+ }
+}
+
+/*
+ * Calculate the grace period and return a printable string for it.
+ */
+static char *
+timeprt(int64_t seconds)
+{
+ time_t hours, minutes;
+ char *buf;
+ static time_t now;
+
+ if (now == 0)
+ time(&now);
+ if (now > seconds) {
+ if ((buf = strdup("none")) == NULL)
+ errx(1, "strdup() failed in timeprt()");
+ return (buf);
+ }
+ seconds -= now;
+ minutes = (seconds + 30) / 60;
+ hours = (minutes + 30) / 60;
+ if (hours >= 36) {
+ if (asprintf(&buf, "%lddays", ((long)hours + 12) / 24) < 0)
+ errx(1, "asprintf() failed in timeprt(1)");
+ return (buf);
+ }
+ if (minutes >= 60) {
+ if (asprintf(&buf, "%2ld:%ld", (long)minutes / 60,
+ (long)minutes % 60) < 0)
+ errx(1, "asprintf() failed in timeprt(2)");
+ return (buf);
+ }
+ if (asprintf(&buf, "%2ld", (long)minutes) < 0)
+ errx(1, "asprintf() failed in timeprt(3)");
+ return (buf);
+}
+
+/*
+ * Collect the requested quota information.
+ */
+static struct quotause *
+getprivs(long id, int quotatype)
+{
+ struct quotause *qup, *quptail = NULL;
+ struct fstab *fs;
+ struct quotause *quphead;
+ struct statfs *fst;
+ int nfst, i;
+ struct statfs sfb;
+
+ qup = quphead = (struct quotause *)0;
+
+ if (filename != NULL && statfs(filename, &sfb) != 0)
+ err(1, "cannot statfs %s", filename);
+ nfst = getmntinfo(&fst, MNT_NOWAIT);
+ if (nfst == 0)
+ errx(2, "no filesystems mounted!");
+ setfsent();
+ for (i = 0; i < nfst; i++) {
+ if (qup == NULL) {
+ if ((qup = (struct quotause *)malloc(sizeof *qup))
+ == NULL)
+ errx(2, "out of memory");
+ }
+ /*
+ * See if the user requested a specific file system
+ * or specified a file inside a mounted file system.
+ */
+ if (filename != NULL &&
+ strcmp(sfb.f_mntonname, fst[i].f_mntonname) != 0)
+ continue;
+ if (strcmp(fst[i].f_fstypename, "nfs") == 0) {
+ if (lflag)
+ continue;
+ if (getnfsquota(&fst[i], qup, id, quotatype) == 0)
+ continue;
+ } else if (strcmp(fst[i].f_fstypename, "ufs") == 0) {
+ /*
+ * XXX
+ * UFS filesystems must be in /etc/fstab, and must
+ * indicate that they have quotas on (?!) This is quite
+ * unlike SunOS where quotas can be enabled/disabled
+ * on a filesystem independent of /etc/fstab, and it
+ * will still print quotas for them.
+ */
+ if ((fs = getfsspec(fst[i].f_mntfromname)) == NULL)
+ continue;
+ if (getufsquota(fs, qup, id, quotatype) == 0)
+ continue;
+ } else
+ continue;
+ strcpy(qup->fsname, fst[i].f_mntonname);
+ if (quphead == NULL)
+ quphead = qup;
+ else
+ quptail->next = qup;
+ quptail = qup;
+ quptail->next = 0;
+ qup = NULL;
+ }
+ if (qup)
+ free(qup);
+ endfsent();
+ return (quphead);
+}
+
+/*
+ * Check to see if a particular quota is available.
+ */
+static int
+getufsquota(struct fstab *fs, struct quotause *qup, long id, int quotatype)
+{
+ struct quotafile *qf;
+
+ if ((qf = quota_open(fs, quotatype, O_RDONLY)) == NULL)
+ return (0);
+ if (quota_read(qf, &qup->dqblk, id) != 0)
+ return (0);
+ quota_close(qf);
+ return (1);
+}
+
+static int
+getnfsquota(struct statfs *fst, struct quotause *qup, long id, int quotatype)
+{
+ struct getquota_args gq_args;
+ struct getquota_rslt gq_rslt;
+ struct dqblk *dqp = &qup->dqblk;
+ struct timeval tv;
+ char *cp, host[NI_MAXHOST];
+
+ if (fst->f_flags & MNT_LOCAL)
+ return (0);
+
+ /*
+ * rpc.rquotad does not support group quotas
+ */
+ if (quotatype != USRQUOTA)
+ return (0);
+
+ /*
+ * must be some form of "hostname:/path"
+ */
+ cp = fst->f_mntfromname;
+ do {
+ cp = strrchr(cp, ':');
+ } while (cp != NULL && *(cp + 1) != '/');
+ if (cp == NULL) {
+ warnx("cannot find hostname for %s", fst->f_mntfromname);
+ return (0);
+ }
+ memset(host, 0, sizeof(host));
+ memcpy(host, fst->f_mntfromname, cp - fst->f_mntfromname);
+ host[sizeof(host) - 1] = '\0';
+
+ /* Avoid attempting the RPC for special amd(8) filesystems. */
+ if (strncmp(fst->f_mntfromname, "pid", 3) == 0 &&
+ strchr(fst->f_mntfromname, '@') != NULL)
+ return (0);
+
+ gq_args.gqa_pathp = cp + 1;
+ gq_args.gqa_uid = id;
+ if (callaurpc(host, RQUOTAPROG, RQUOTAVERS,
+ RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_getquota_args, (char *)&gq_args,
+ (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt) != 0)
+ return (0);
+
+ switch (gq_rslt.status) {
+ case Q_NOQUOTA:
+ break;
+ case Q_EPERM:
+ warnx("quota permission error, host: %s",
+ fst->f_mntfromname);
+ break;
+ case Q_OK:
+ gettimeofday(&tv, NULL);
+ /* blocks*/
+ dqp->dqb_bhardlimit =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit *
+ (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+ dqp->dqb_bsoftlimit =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit *
+ (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+ dqp->dqb_curblocks =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks *
+ (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+ /* inodes */
+ dqp->dqb_ihardlimit =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit;
+ dqp->dqb_isoftlimit =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit;
+ dqp->dqb_curinodes =
+ gq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles;
+ /* grace times */
+ dqp->dqb_btime =
+ tv.tv_sec + gq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft;
+ dqp->dqb_itime =
+ tv.tv_sec + gq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft;
+ return (1);
+ default:
+ warnx("bad rpc result, host: %s", fst->f_mntfromname);
+ break;
+ }
+
+ return (0);
+}
+
+static int
+callaurpc(char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, char *in, xdrproc_t outproc, char *out)
+{
+ enum clnt_stat clnt_stat;
+ struct timeval timeout, tottimeout;
+
+ CLIENT *client = NULL;
+
+ client = clnt_create(host, prognum, versnum, "udp");
+ if (client == NULL)
+ return ((int)rpc_createerr.cf_stat);
+ timeout.tv_usec = 0;
+ timeout.tv_sec = 6;
+ CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout);
+
+ client->cl_auth = authunix_create_default();
+ tottimeout.tv_sec = 25;
+ tottimeout.tv_usec = 0;
+ clnt_stat = clnt_call(client, procnum, inproc, in,
+ outproc, out, tottimeout);
+
+ return ((int) clnt_stat);
+}
+
+static int
+alldigits(char *s)
+{
+ int c;
+
+ c = *s++;
+ do {
+ if (!isdigit(c))
+ return (0);
+ } while ((c = *s++));
+ return (1);
+}
diff --git a/usr.bin/random/Makefile b/usr.bin/random/Makefile
new file mode 100644
index 0000000..9136c98
--- /dev/null
+++ b/usr.bin/random/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 3/31/94
+# $FreeBSD$
+
+PROG= random
+MAN= random.6
+SRCS= random.c randomize_fd.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/random/Makefile.depend b/usr.bin/random/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/random/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/random/random.6 b/usr.bin/random/random.6
new file mode 100644
index 0000000..bd38ba6
--- /dev/null
+++ b/usr.bin/random/random.6
@@ -0,0 +1,125 @@
+.\" Copyright (c) 1994
+.\" 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)random.6 8.2 (Berkeley) 3/31/94
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2003
+.Dt RANDOM 6
+.Os
+.Sh NAME
+.Nm random
+.Nd random lines from a file or random numbers
+.Sh SYNOPSIS
+.Nm
+.Op Fl elrUuw
+.Op Fl f Ar filename
+.Op Ar denominator
+.Sh DESCRIPTION
+.Nm Random
+has two distinct modes of operations.
+The default is to read in lines
+from the standard input and randomly write them out
+to the standard output with a probability of
+1 /
+.Ar denominator .
+The default
+.Ar denominator
+for this mode of operation is 2, giving each line a 50/50 chance of
+being displayed.
+.Pp
+The second mode of operation is to read in a file from
+.Ar filename
+and randomize the contents of the file and send it back out to
+standard output.
+The contents can be randomized based off of newlines or based off of
+space characters as determined by
+.Xr isspace 3 .
+The default
+.Ar denominator
+for this mode of operation is 1, which gives each line a chance to be
+displayed, but in a
+.Xr random 3
+order.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl e
+If the
+.Fl e
+option is specified,
+.Nm
+does not read or write anything, and simply exits with a random
+exit value of 0 to
+.Ar denominator
+\&- 1, inclusive.
+.It Fl f Ar filename
+The
+.Fl f
+option is used to specify the
+.Ar filename
+to read from.
+Standard input is used if
+.Ar filename
+is set to
+.Sq Fl .
+.It Fl l
+Randomize the input via newlines (the default).
+.It Fl r
+The
+.Fl r
+option guarantees that the output is unbuffered.
+.It Fl U
+Tells
+.Xr random 6
+that it is okay for it to reuse any given line or word when creating a
+randomized output.
+.It Fl u
+Tells
+.Xr random 6
+not to select the same line or word from a file more than once (the
+default).
+This does not guarantee uniqueness if there are two of the
+same tokens from the input, but it does prevent selecting the same
+token more than once.
+.It Fl w
+Randomize words separated by
+.Xr isspace 3
+instead of newlines.
+.El
+.Sh SEE ALSO
+.Xr random 3 ,
+.Xr fortune 6
+.Sh HISTORY
+The
+functionality to randomizing lines and words was added in 2003 by
+.An Sean Chittenden Aq Mt seanc@FreeBSD.org .
+.Sh BUGS
+No index is used when printing out tokens from the list which
+makes it rather slow for large files (10MB+).
+For smaller
+files, however, it should still be quite fast and efficient.
diff --git a/usr.bin/random/random.c b/usr.bin/random/random.c
new file mode 100644
index 0000000..99f9d90
--- /dev/null
+++ b/usr.bin/random/random.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guy Harris at Network Appliance Corp.
+ *
+ * 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. 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)random.c 8.5 (Berkeley) 4/5/94";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "randomize_fd.h"
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ double denom;
+ int ch, fd, random_exit, randomize_lines, random_type, ret,
+ selected, unique_output, unbuffer_output;
+ char *ep;
+ const char *filename;
+
+ denom = 0;
+ filename = "/dev/fd/0";
+ random_type = RANDOM_TYPE_UNSET;
+ random_exit = randomize_lines = unbuffer_output = 0;
+ unique_output = 1;
+
+ (void)setlocale(LC_CTYPE, "");
+
+ while ((ch = getopt(argc, argv, "ef:hlruUw")) != -1)
+ switch (ch) {
+ case 'e':
+ random_exit = 1;
+ break;
+ case 'f':
+ randomize_lines = 1;
+ if (strcmp(optarg, "-") != 0)
+ filename = optarg;
+ break;
+ case 'l':
+ randomize_lines = 1;
+ random_type = RANDOM_TYPE_LINES;
+ break;
+ case 'r':
+ unbuffer_output = 1;
+ break;
+ case 'u':
+ randomize_lines = 1;
+ unique_output = 1;
+ break;
+ case 'U':
+ randomize_lines = 1;
+ unique_output = 0;
+ break;
+ case 'w':
+ randomize_lines = 1;
+ random_type = RANDOM_TYPE_WORDS;
+ break;
+ default:
+ case '?':
+ usage();
+ /* NOTREACHED */
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 0:
+ denom = (randomize_lines ? 1 : 2);
+ break;
+ case 1:
+ errno = 0;
+ denom = strtod(*argv, &ep);
+ if (errno == ERANGE)
+ err(1, "%s", *argv);
+ if (denom <= 0 || *ep != '\0')
+ errx(1, "denominator is not valid.");
+ if (random_exit && denom > 256)
+ errx(1, "denominator must be <= 256 for random exit.");
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ srandomdev();
+
+ /*
+ * Act as a filter, randomly choosing lines of the standard input
+ * to write to the standard output.
+ */
+ if (unbuffer_output)
+ setbuf(stdout, NULL);
+
+ /*
+ * Act as a filter, randomizing lines read in from a given file
+ * descriptor and write the output to standard output.
+ */
+ if (randomize_lines) {
+ if ((fd = open(filename, O_RDONLY, 0)) < 0)
+ err(1, "%s", filename);
+ ret = randomize_fd(fd, random_type, unique_output, denom);
+ if (!random_exit)
+ return(ret);
+ }
+
+ /* Compute a random exit status between 0 and denom - 1. */
+ if (random_exit)
+ return (int)(denom * random() / RANDOM_MAX_PLUS1);
+
+ /*
+ * Select whether to print the first line. (Prime the pump.)
+ * We find a random number between 0 and denom - 1 and, if it's
+ * 0 (which has a 1 / denom chance of being true), we select the
+ * line.
+ */
+ selected = (int)(denom * random() / RANDOM_MAX_PLUS1) == 0;
+ while ((ch = getchar()) != EOF) {
+ if (selected)
+ (void)putchar(ch);
+ if (ch == '\n') {
+ /* End of that line. See if we got an error. */
+ if (ferror(stdout))
+ err(2, "stdout");
+
+ /* Now see if the next line is to be printed. */
+ selected = (int)(denom * random() /
+ RANDOM_MAX_PLUS1) == 0;
+ }
+ }
+ if (ferror(stdin))
+ err(2, "stdin");
+ exit (0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: random [-elrUuw] [-f filename] [denominator]\n");
+ exit(1);
+}
diff --git a/usr.bin/random/randomize_fd.c b/usr.bin/random/randomize_fd.c
new file mode 100644
index 0000000..684c84e
--- /dev/null
+++ b/usr.bin/random/randomize_fd.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2003 Sean Chittenden <seanc@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 PROJECT 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 PROJECT 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/param.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "randomize_fd.h"
+
+static struct rand_node *rand_root;
+static struct rand_node *rand_tail;
+
+static struct rand_node *
+rand_node_allocate(void)
+{
+ struct rand_node *n;
+
+ n = (struct rand_node *)malloc(sizeof(struct rand_node));
+ if (n == NULL)
+ err(1, "malloc");
+
+ n->len = 0;
+ n->cp = NULL;
+ n->next = NULL;
+ return(n);
+}
+
+static void
+rand_node_free(struct rand_node *n)
+{
+ if (n != NULL) {
+ if (n->cp != NULL)
+ free(n->cp);
+
+ free(n);
+ }
+}
+
+static void
+rand_node_free_rec(struct rand_node *n)
+{
+ if (n != NULL) {
+ if (n->next != NULL)
+ rand_node_free_rec(n->next);
+
+ rand_node_free(n);
+ }
+}
+
+static void
+rand_node_append(struct rand_node *n)
+{
+ if (rand_root == NULL)
+ rand_root = rand_tail = n;
+ else {
+ rand_tail->next = n;
+ rand_tail = n;
+ }
+}
+
+int
+randomize_fd(int fd, int type, int unique, double denom)
+{
+ u_char *buf;
+ u_int slen;
+ u_long i, j, numnode, selected;
+ struct rand_node *n, *prev;
+ int bufleft, eof, fndstr, ret;
+ size_t bufc, buflen;
+ ssize_t len;
+
+ rand_root = rand_tail = NULL;
+ bufc = i = 0;
+ bufleft = eof = fndstr = numnode = 0;
+
+ if (type == RANDOM_TYPE_UNSET)
+ type = RANDOM_TYPE_LINES;
+
+ buflen = sizeof(u_char) * MAXBSIZE;
+ buf = (u_char *)malloc(buflen);
+ if (buf == NULL)
+ err(1, "malloc");
+
+ while (!eof) {
+ /* Check to see if we have bits in the buffer */
+ if (bufleft == 0) {
+ len = read(fd, buf, buflen);
+ if (len == -1)
+ err(1, "read");
+ else if (len == 0) {
+ eof++;
+ break;
+ } else if ((size_t)len < buflen)
+ buflen = (size_t)len;
+
+ bufleft = (int)len;
+ }
+
+ /* Look for a newline */
+ for (i = bufc; i <= buflen && bufleft >= 0; i++, bufleft--) {
+ if (i == buflen) {
+ if (fndstr) {
+ if (!eof) {
+ memmove(buf, &buf[bufc], i - bufc);
+ i -= bufc;
+ bufc = 0;
+ len = read(fd, &buf[i], buflen - i);
+ if (len == -1)
+ err(1, "read");
+ else if (len == 0) {
+ eof++;
+ break;
+ } else if (len < (ssize_t)(buflen - i))
+ buflen = i + (size_t)len;
+
+ bufleft = (int)len;
+ fndstr = 0;
+ }
+ } else {
+ buflen *= 2;
+ buf = (u_char *)realloc(buf, buflen);
+ if (buf == NULL)
+ err(1, "realloc");
+
+ if (!eof) {
+ len = read(fd, &buf[i], buflen - i);
+ if (len == -1)
+ err(1, "read");
+ else if (len == 0) {
+ eof++;
+ break;
+ } else if (len < (ssize_t)(buflen - i))
+ buflen = i + (size_t)len;
+
+ bufleft = (int)len;
+ }
+
+ }
+ }
+
+ if ((type == RANDOM_TYPE_LINES && buf[i] == '\n') ||
+ (type == RANDOM_TYPE_WORDS && isspace(buf[i])) ||
+ (eof && i == buflen - 1)) {
+make_token:
+ if (numnode == RANDOM_MAX_PLUS1) {
+ errno = EFBIG;
+ err(1, "too many delimiters");
+ }
+ numnode++;
+ n = rand_node_allocate();
+ if (-1 != (int)i) {
+ slen = i - (u_long)bufc;
+ n->len = slen + 2;
+ n->cp = (u_char *)malloc(slen + 2);
+ if (n->cp == NULL)
+ err(1, "malloc");
+
+ memmove(n->cp, &buf[bufc], slen);
+ n->cp[slen] = buf[i];
+ n->cp[slen + 1] = '\0';
+ bufc = i + 1;
+ }
+ rand_node_append(n);
+ fndstr = 1;
+ }
+ }
+ }
+
+ /* Necessary evil to compensate for files that don't end with a newline */
+ if (bufc != i) {
+ i--;
+ goto make_token;
+ }
+
+ (void)close(fd);
+
+ free(buf);
+
+ for (i = numnode; i > 0; i--) {
+ selected = random() % numnode;
+
+ for (j = 0, prev = n = rand_root; n != NULL; j++, prev = n, n = n->next) {
+ if (j == selected) {
+ if (n->cp == NULL)
+ break;
+
+ if ((int)(denom * random() /
+ RANDOM_MAX_PLUS1) == 0) {
+ ret = printf("%.*s",
+ (int)n->len - 1, n->cp);
+ if (ret < 0)
+ err(1, "printf");
+ }
+ if (unique) {
+ if (n == rand_root)
+ rand_root = n->next;
+ if (n == rand_tail)
+ rand_tail = prev;
+
+ prev->next = n->next;
+ rand_node_free(n);
+ numnode--;
+ }
+ break;
+ }
+ }
+ }
+
+ fflush(stdout);
+
+ if (!unique)
+ rand_node_free_rec(rand_root);
+
+ return(0);
+}
diff --git a/usr.bin/random/randomize_fd.h b/usr.bin/random/randomize_fd.h
new file mode 100644
index 0000000..de3f873
--- /dev/null
+++ b/usr.bin/random/randomize_fd.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003 Sean Chittenden <seanc@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 PROJECT 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 PROJECT 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 __RANDOMIZE_FD__
+#define __RANDOMIZE_FD__
+
+/*
+ * The random() function is defined to return values between 0 and
+ * 2^31 - 1 inclusive in random(3).
+ */
+#define RANDOM_MAX_PLUS1 0x80000000UL
+
+#define RANDOM_TYPE_UNSET 0
+#define RANDOM_TYPE_LINES 1
+#define RANDOM_TYPE_WORDS 2
+
+/* The multiple instance single integer key */
+struct rand_node {
+ u_char *cp;
+ u_int len;
+ struct rand_node *next;
+};
+
+int randomize_fd(int fd, int type, int unique, double denom);
+
+#endif
diff --git a/usr.bin/rctl/Makefile b/usr.bin/rctl/Makefile
new file mode 100644
index 0000000..0191bdd
--- /dev/null
+++ b/usr.bin/rctl/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= rctl
+MAN= rctl.8
+
+LIBADD= util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rctl/Makefile.depend b/usr.bin/rctl/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/rctl/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8
new file mode 100644
index 0000000..2d92d54
--- /dev/null
+++ b/usr.bin/rctl/rctl.8
@@ -0,0 +1,322 @@
+.\"-
+.\" Copyright (c) 2009 Edward Tomasz Napierala
+.\" 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 THE VOICES IN HIS HEAD 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 January 30, 2016
+.Dt RCTL 8
+.Os
+.Sh NAME
+.Nm rctl
+.Nd display and update resource limits database
+.Sh SYNOPSIS
+.Nm
+.Op Fl h
+.Op Fl n
+.Op Ar filter Ar ...
+.Nm
+.Fl a
+.Ar rule Ar ...
+.Nm
+.Fl l
+.Op Fl h
+.Op Fl n
+.Ar filter Ar ...
+.Nm
+.Fl r
+.Ar filter Ar ...
+.Nm
+.Fl u
+.Op Fl h
+.Ar filter Ar ...
+.Pp
+.Nm
+requires the kernel to be compiled with:
+.Bd -ragged -offset indent
+.Cd "options RACCT"
+.Cd "options RCTL"
+.Ed
+.Sh DESCRIPTION
+When called without options, the
+.Nm
+command writes currently defined RCTL rules to standard output.
+.Pp
+If a
+.Ar filter
+argument is specified, only rules matching the filter are displayed.
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a Ar rule
+Add
+.Ar rule
+to the RCTL database.
+.It Fl l Ar filter
+Display rules applicable to the process defined by
+.Ar filter .
+Note that this is different from showing the rules when called without
+any options, as it shows not just the rules with subject equal to that
+of process, but also rules for the user, jail, and login class applicable
+to the process.
+.It Fl r Ar filter
+Remove rules matching
+.Ar filter
+from the RCTL database.
+.It Fl u Ar filter
+Display resource usage for a subject
+.Po
+.Sy process ,
+.Sy user ,
+.Sy loginclass
+or
+.Sy jail
+.Pc
+matching the
+.Ar filter .
+.It Fl h
+"Human-readable" output.
+Use unit suffixes: Byte, Kilobyte, Megabyte,
+Gigabyte, Terabyte and Petabyte.
+.It Fl n
+Display user IDs numerically rather than converting them to a user name.
+.El
+.Pp
+Modifying rules affects all currently running and future processes matching
+the rule.
+.Sh RULE SYNTAX
+Syntax for a rule is subject:subject-id:resource:action=amount/per.
+.Pp
+.Bl -tag -width "subject-id" -compact -offset indent
+.It subject
+defines the kind of entity the rule applies to.
+It can be either
+.Sy process ,
+.Sy user ,
+.Sy loginclass ,
+or
+.Sy jail .
+.It subject-id
+identifies the
+.Em subject .
+It can be a process ID, user name, numerical user ID, login class name from
+.Xr login.conf 5 ,
+or jail name.
+.It resource
+identifies the resource the rule controls.
+See the
+.Sx RESOURCES
+section below for details.
+.It action
+defines what will happen when a process exceeds the allowed
+.Em amount .
+See the
+.Sx ACTIONS
+section below for details.
+.It amount
+defines how much of the resource a process can use before
+the defined
+.Em action
+triggers.
+Resources which limit bytes may use prefixes from
+.Xr expand_number 3 .
+.It per
+defines what entity the
+.Em amount
+gets accounted for.
+For example, rule "loginclass:users:vmem:deny=100M/process" means
+that each process of any user belonging to login class "users" may allocate
+up to 100MB of virtual memory.
+Rule "loginclass:users:vmem:deny=100M/user" would mean that for each
+user belonging to the login class "users", the sum of virtual memory allocated
+by all the processes of that user will not exceed 100MB.
+Rule "loginclass:users:vmem:deny=100M/loginclass" would mean that the sum of
+virtual memory allocated by all processes of all users belonging to that login
+class will not exceed 100MB.
+.El
+.Pp
+A valid rule has all those fields specified, except for
+.Em per ,
+which defaults
+to the value of
+.Em subject .
+.Pp
+A filter is a rule for which one of more fields other than
+.Em per
+is left empty.
+For example, a filter that matches every rule could be written as ":::=/",
+or, in short, ":".
+A filter that matches all the login classes would be "loginclass:".
+A filter that matches all defined rules for
+.Sy maxproc
+resource would be
+"::maxproc".
+.Sh SUBJECTS
+.Bl -column -offset 3n "pseudoterminals" ".Sy username or numerical User ID"
+.It Em subject Ta Em subject-id
+.It Sy process Ta numerical Process ID
+.It Sy user Ta user name or numerical User ID
+.It Sy loginclass Ta login class from
+.Xr login.conf 5
+.It Sy jail Ta jail name
+.El
+.Sh RESOURCES
+.Bl -column -offset 3n "pseudoterminals"
+.It Em resource
+.It Sy cputime Ta "CPU time, in seconds"
+.It Sy datasize Ta "data size, in bytes"
+.It Sy stacksize Ta "stack size, in bytes"
+.It Sy coredumpsize Ta "core dump size, in bytes"
+.It Sy memoryuse Ta "resident set size, in bytes"
+.It Sy memorylocked Ta "locked memory, in bytes"
+.It Sy maxproc Ta "number of processes"
+.It Sy openfiles Ta "file descriptor table size"
+.It Sy vmemoryuse Ta "address space limit, in bytes"
+.It Sy pseudoterminals Ta "number of PTYs"
+.It Sy swapuse Ta "swap space that may be reserved or used, in bytes"
+.It Sy nthr Ta "number of threads"
+.It Sy msgqqueued Ta "number of queued SysV messages"
+.It Sy msgqsize Ta "SysV message queue size, in bytes"
+.It Sy nmsgq Ta "number of SysV message queues"
+.It Sy nsem Ta "number of SysV semaphores"
+.It Sy nsemop Ta "number of SysV semaphores modified in a single semop(2) call"
+.It Sy nshm Ta "number of SysV shared memory segments"
+.It Sy shmsize Ta "SysV shared memory size, in bytes"
+.It Sy wallclock Ta "wallclock time, in seconds"
+.It Sy pcpu Ta "%CPU, in percents of a single CPU core"
+.It Sy readbps Ta "filesystem reads, in bytes per second"
+.It Sy writebps Ta "filesystem writes, in bytes per second"
+.It Sy readiops Ta "filesystem reads, in operations per second"
+.It Sy writeiops Ta "filesystem writes, in operations per second"
+.El
+.Sh ACTIONS
+.Bl -column -offset 3n "pseudoterminals"
+.It Em action
+.It Sy deny Ta deny the allocation; not supported for
+.Sy cputime ,
+.Sy wallclock ,
+.Sy readbps ,
+.Sy writebps ,
+.Sy readiops ,
+and
+.Sy writeiops
+.It Sy log Ta "log a warning to the console"
+.It Sy devctl Ta "send notification to"
+.Xr devd 8
+using
+.Sy system
+= "RCTL",
+.Sy subsystem
+= "rule",
+.Sy type
+= "matched"
+.It sig* e.g.
+.Sy sigterm ;
+send a signal to the offending process.
+See
+.Xr signal 3
+for a list of supported signals
+.It Sy throttle Ta "slow down process execution"; only supported for
+.Sy readbps ,
+.Sy writebps ,
+.Sy readiops ,
+and
+.Sy writeiops .
+.El
+.Pp
+Not all actions are supported for all resources.
+Attempting to add a rule with an action not supported by a given resource will
+result in error.
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt, or
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va kern.racct.enable: No 1
+Enable
+.Nm .
+This defaults to 1, unless
+.Cd "options RACCT_DEFAULT_TO_DISABLED"
+is set in the kernel configuration file.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Prevent user "joe" from allocating more than 1GB of virtual memory:
+.Dl Nm Fl a Ar user:joe:vmemoryuse:deny=1g
+.Pp
+Remove all RCTL rules:
+.Dl Nm Fl r Ar \&:
+.Pp
+Display resource usage information for jail named "www":
+.Dl Nm Fl hu Ar jail:www
+.Pp
+Display all the rules applicable to process with PID 512:
+.Dl Nm Fl l Ar process:512
+.Pp
+Display all rules:
+.Dl Nm
+.Pp
+Display all rules matching user "joe":
+.Dl Nm Ar user:joe
+.Pp
+Display all rules matching login classes:
+.Dl Nm Ar loginclass:
+.Sh SEE ALSO
+.Xr rctl.conf 5
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+was developed by
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
+under sponsorship from the FreeBSD Foundation.
+.Sh BUGS
+Limiting
+.Sy memoryuse
+may kill the machine due to thrashing.
+.Pp
+The
+.Sy readiops
+and
+.Sy writeiops
+counters are only approximations.
+Like
+.Sy readbps
+and
+.Sy writebps ,
+they are calculated in the filesystem layer, where it is difficult
+or even impossible to observe actual disk device operations.
+.Pp
+The
+.Sy writebps
+and
+.Sy writeiops
+resources generally account for writes to the filesystem cache,
+not to actual devices.
diff --git a/usr.bin/rctl/rctl.c b/usr.bin/rctl/rctl.c
new file mode 100644
index 0000000..4b3b8e1
--- /dev/null
+++ b/usr.bin/rctl/rctl.c
@@ -0,0 +1,686 @@
+/*-
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/rctl.h>
+#include <sys/sysctl.h>
+#include <assert.h>
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <grp.h>
+#include <libutil.h>
+#include <pwd.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define RCTL_DEFAULT_BUFSIZE 128 * 1024
+
+static int
+parse_user(const char *s, id_t *uidp, const char *unexpanded_rule)
+{
+ char *end;
+ struct passwd *pwd;
+
+ pwd = getpwnam(s);
+ if (pwd != NULL) {
+ *uidp = pwd->pw_uid;
+ return (0);
+ }
+
+ if (!isnumber(s[0])) {
+ warnx("malformed rule '%s': unknown user '%s'",
+ unexpanded_rule, s);
+ return (1);
+ }
+
+ *uidp = strtod(s, &end);
+ if ((size_t)(end - s) != strlen(s)) {
+ warnx("malformed rule '%s': trailing characters "
+ "after numerical id", unexpanded_rule);
+ return (1);
+ }
+
+ return (0);
+}
+
+static int
+parse_group(const char *s, id_t *gidp, const char *unexpanded_rule)
+{
+ char *end;
+ struct group *grp;
+
+ grp = getgrnam(s);
+ if (grp != NULL) {
+ *gidp = grp->gr_gid;
+ return (0);
+ }
+
+ if (!isnumber(s[0])) {
+ warnx("malformed rule '%s': unknown group '%s'",
+ unexpanded_rule, s);
+ return (1);
+ }
+
+ *gidp = strtod(s, &end);
+ if ((size_t)(end - s) != strlen(s)) {
+ warnx("malformed rule '%s': trailing characters "
+ "after numerical id", unexpanded_rule);
+ return (1);
+ }
+
+ return (0);
+}
+
+/*
+ * Replace human-readable number with its expanded form.
+ */
+static char *
+expand_amount(const char *rule, const char *unexpanded_rule)
+{
+ uint64_t num;
+ const char *subject, *subject_id, *resource, *action, *amount, *per;
+ char *copy, *expanded, *tofree;
+ int ret;
+
+ tofree = copy = strdup(rule);
+ if (copy == NULL) {
+ warn("strdup");
+ return (NULL);
+ }
+
+ subject = strsep(&copy, ":");
+ subject_id = strsep(&copy, ":");
+ resource = strsep(&copy, ":");
+ action = strsep(&copy, "=/");
+ amount = strsep(&copy, "/");
+ per = copy;
+
+ if (amount == NULL || strlen(amount) == 0) {
+ /*
+ * The "copy" has already been tinkered with by strsep().
+ */
+ free(tofree);
+ copy = strdup(rule);
+ if (copy == NULL) {
+ warn("strdup");
+ return (NULL);
+ }
+ return (copy);
+ }
+
+ assert(subject != NULL);
+ assert(subject_id != NULL);
+ assert(resource != NULL);
+ assert(action != NULL);
+
+ if (expand_number(amount, &num)) {
+ warnx("malformed rule '%s': invalid numeric value '%s'",
+ unexpanded_rule, amount);
+ free(tofree);
+ return (NULL);
+ }
+
+ if (per == NULL) {
+ ret = asprintf(&expanded, "%s:%s:%s:%s=%ju",
+ subject, subject_id, resource, action, (uintmax_t)num);
+ } else {
+ ret = asprintf(&expanded, "%s:%s:%s:%s=%ju/%s",
+ subject, subject_id, resource, action, (uintmax_t)num, per);
+ }
+
+ if (ret <= 0) {
+ warn("asprintf");
+ free(tofree);
+ return (NULL);
+ }
+
+ free(tofree);
+
+ return (expanded);
+}
+
+static char *
+expand_rule(const char *rule, bool resolve_ids)
+{
+ id_t id;
+ const char *subject, *textid, *rest;
+ char *copy, *expanded, *resolved, *tofree;
+ int error, ret;
+
+ tofree = copy = strdup(rule);
+ if (copy == NULL) {
+ warn("strdup");
+ return (NULL);
+ }
+
+ subject = strsep(&copy, ":");
+ textid = strsep(&copy, ":");
+ if (textid == NULL) {
+ warnx("malformed rule '%s': missing subject", rule);
+ return (NULL);
+ }
+ if (copy != NULL)
+ rest = copy;
+ else
+ rest = "";
+
+ if (strcasecmp(subject, "u") == 0)
+ subject = "user";
+ else if (strcasecmp(subject, "g") == 0)
+ subject = "group";
+ else if (strcasecmp(subject, "p") == 0)
+ subject = "process";
+ else if (strcasecmp(subject, "l") == 0 ||
+ strcasecmp(subject, "c") == 0 ||
+ strcasecmp(subject, "class") == 0)
+ subject = "loginclass";
+ else if (strcasecmp(subject, "j") == 0)
+ subject = "jail";
+
+ if (resolve_ids &&
+ strcasecmp(subject, "user") == 0 && strlen(textid) > 0) {
+ error = parse_user(textid, &id, rule);
+ if (error != 0) {
+ free(tofree);
+ return (NULL);
+ }
+ ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
+ } else if (resolve_ids &&
+ strcasecmp(subject, "group") == 0 && strlen(textid) > 0) {
+ error = parse_group(textid, &id, rule);
+ if (error != 0) {
+ free(tofree);
+ return (NULL);
+ }
+ ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
+ } else {
+ ret = asprintf(&resolved, "%s:%s:%s", subject, textid, rest);
+ }
+
+ if (ret <= 0) {
+ warn("asprintf");
+ free(tofree);
+ return (NULL);
+ }
+
+ free(tofree);
+
+ expanded = expand_amount(resolved, rule);
+ free(resolved);
+
+ return (expanded);
+}
+
+static char *
+humanize_ids(char *rule)
+{
+ id_t id;
+ struct passwd *pwd;
+ struct group *grp;
+ const char *subject, *textid, *rest;
+ char *end, *humanized;
+ int ret;
+
+ subject = strsep(&rule, ":");
+ textid = strsep(&rule, ":");
+ if (textid == NULL)
+ errx(1, "rule passed from the kernel didn't contain subject");
+ if (rule != NULL)
+ rest = rule;
+ else
+ rest = "";
+
+ /* Replace numerical user and group ids with names. */
+ if (strcasecmp(subject, "user") == 0) {
+ id = strtod(textid, &end);
+ if ((size_t)(end - textid) != strlen(textid))
+ errx(1, "malformed uid '%s'", textid);
+ pwd = getpwuid(id);
+ if (pwd != NULL)
+ textid = pwd->pw_name;
+ } else if (strcasecmp(subject, "group") == 0) {
+ id = strtod(textid, &end);
+ if ((size_t)(end - textid) != strlen(textid))
+ errx(1, "malformed gid '%s'", textid);
+ grp = getgrgid(id);
+ if (grp != NULL)
+ textid = grp->gr_name;
+ }
+
+ ret = asprintf(&humanized, "%s:%s:%s", subject, textid, rest);
+ if (ret <= 0)
+ err(1, "asprintf");
+
+ return (humanized);
+}
+
+static int
+str2int64(const char *str, int64_t *value)
+{
+ char *end;
+
+ if (str == NULL)
+ return (EINVAL);
+
+ *value = strtoul(str, &end, 10);
+ if ((size_t)(end - str) != strlen(str))
+ return (EINVAL);
+
+ return (0);
+}
+
+static char *
+humanize_amount(char *rule)
+{
+ int64_t num;
+ const char *subject, *subject_id, *resource, *action, *amount, *per;
+ char *copy, *humanized, buf[6], *tofree;
+ int ret;
+
+ tofree = copy = strdup(rule);
+ if (copy == NULL)
+ err(1, "strdup");
+
+ subject = strsep(&copy, ":");
+ subject_id = strsep(&copy, ":");
+ resource = strsep(&copy, ":");
+ action = strsep(&copy, "=/");
+ amount = strsep(&copy, "/");
+ per = copy;
+
+ if (amount == NULL || strlen(amount) == 0 ||
+ str2int64(amount, &num) != 0) {
+ free(tofree);
+ return (rule);
+ }
+
+ assert(subject != NULL);
+ assert(subject_id != NULL);
+ assert(resource != NULL);
+ assert(action != NULL);
+
+ if (humanize_number(buf, sizeof(buf), num, "", HN_AUTOSCALE,
+ HN_DECIMAL | HN_NOSPACE) == -1)
+ err(1, "humanize_number");
+
+ if (per == NULL) {
+ ret = asprintf(&humanized, "%s:%s:%s:%s=%s",
+ subject, subject_id, resource, action, buf);
+ } else {
+ ret = asprintf(&humanized, "%s:%s:%s:%s=%s/%s",
+ subject, subject_id, resource, action, buf, per);
+ }
+
+ if (ret <= 0)
+ err(1, "asprintf");
+
+ free(tofree);
+ return (humanized);
+}
+
+/*
+ * Print rules, one per line.
+ */
+static void
+print_rules(char *rules, int hflag, int nflag)
+{
+ char *rule;
+
+ while ((rule = strsep(&rules, ",")) != NULL) {
+ if (rule[0] == '\0')
+ break; /* XXX */
+ if (nflag == 0)
+ rule = humanize_ids(rule);
+ if (hflag)
+ rule = humanize_amount(rule);
+ printf("%s\n", rule);
+ }
+}
+
+static void
+enosys(void)
+{
+ int error, racct_enable;
+ size_t racct_enable_len;
+
+ racct_enable_len = sizeof(racct_enable);
+ error = sysctlbyname("kern.racct.enable",
+ &racct_enable, &racct_enable_len, NULL, 0);
+
+ if (error != 0) {
+ if (errno == ENOENT)
+ errx(1, "RACCT/RCTL support not present in kernel; see rctl(8) for details");
+
+ err(1, "sysctlbyname");
+ }
+
+ if (racct_enable == 0)
+ errx(1, "RACCT/RCTL present, but disabled; enable using kern.racct.enable=1 tunable");
+}
+
+static int
+add_rule(const char *rule, const char *unexpanded_rule)
+{
+ int error;
+
+ error = rctl_add_rule(rule, strlen(rule) + 1, NULL, 0);
+ if (error != 0) {
+ if (errno == ENOSYS)
+ enosys();
+ warn("failed to add rule '%s'", unexpanded_rule);
+ }
+
+ return (error);
+}
+
+static int
+show_limits(const char *filter, const char *unexpanded_rule,
+ int hflag, int nflag)
+{
+ int error;
+ char *outbuf = NULL;
+ size_t outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
+
+ for (;;) {
+ outbuflen *= 4;
+ outbuf = realloc(outbuf, outbuflen);
+ if (outbuf == NULL)
+ err(1, "realloc");
+ error = rctl_get_limits(filter, strlen(filter) + 1,
+ outbuf, outbuflen);
+ if (error == 0)
+ break;
+ if (errno == ERANGE)
+ continue;
+ if (errno == ENOSYS)
+ enosys();
+ warn("failed to get limits for '%s'", unexpanded_rule);
+ free(outbuf);
+
+ return (error);
+ }
+
+ print_rules(outbuf, hflag, nflag);
+ free(outbuf);
+
+ return (error);
+}
+
+static int
+remove_rule(const char *filter, const char *unexpanded_rule)
+{
+ int error;
+
+ error = rctl_remove_rule(filter, strlen(filter) + 1, NULL, 0);
+ if (error != 0) {
+ if (errno == ENOSYS)
+ enosys();
+ warn("failed to remove rule '%s'", unexpanded_rule);
+ }
+
+ return (error);
+}
+
+static char *
+humanize_usage_amount(char *usage)
+{
+ int64_t num;
+ const char *resource, *amount;
+ char *copy, *humanized, buf[6], *tofree;
+ int ret;
+
+ tofree = copy = strdup(usage);
+ if (copy == NULL)
+ err(1, "strdup");
+
+ resource = strsep(&copy, "=");
+ amount = copy;
+
+ assert(resource != NULL);
+ assert(amount != NULL);
+
+ if (str2int64(amount, &num) != 0 ||
+ humanize_number(buf, sizeof(buf), num, "", HN_AUTOSCALE,
+ HN_DECIMAL | HN_NOSPACE) == -1) {
+ free(tofree);
+ return (usage);
+ }
+
+ ret = asprintf(&humanized, "%s=%s", resource, buf);
+ if (ret <= 0)
+ err(1, "asprintf");
+
+ free(tofree);
+ return (humanized);
+}
+
+/*
+ * Query the kernel about a resource usage and print it out.
+ */
+static int
+show_usage(const char *filter, const char *unexpanded_rule, int hflag)
+{
+ int error;
+ char *copy, *outbuf = NULL, *tmp;
+ size_t outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
+
+ for (;;) {
+ outbuflen *= 4;
+ outbuf = realloc(outbuf, outbuflen);
+ if (outbuf == NULL)
+ err(1, "realloc");
+ error = rctl_get_racct(filter, strlen(filter) + 1,
+ outbuf, outbuflen);
+ if (error == 0)
+ break;
+ if (errno == ERANGE)
+ continue;
+ if (errno == ENOSYS)
+ enosys();
+ warn("failed to show resource consumption for '%s'",
+ unexpanded_rule);
+ free(outbuf);
+
+ return (error);
+ }
+
+ copy = outbuf;
+ while ((tmp = strsep(&copy, ",")) != NULL) {
+ if (tmp[0] == '\0')
+ break; /* XXX */
+
+ if (hflag)
+ tmp = humanize_usage_amount(tmp);
+
+ printf("%s\n", tmp);
+ }
+
+ free(outbuf);
+
+ return (error);
+}
+
+/*
+ * Query the kernel about resource limit rules and print them out.
+ */
+static int
+show_rules(const char *filter, const char *unexpanded_rule,
+ int hflag, int nflag)
+{
+ int error;
+ char *outbuf = NULL;
+ size_t filterlen, outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
+
+ if (filter != NULL)
+ filterlen = strlen(filter) + 1;
+ else
+ filterlen = 0;
+
+ for (;;) {
+ outbuflen *= 4;
+ outbuf = realloc(outbuf, outbuflen);
+ if (outbuf == NULL)
+ err(1, "realloc");
+ error = rctl_get_rules(filter, filterlen, outbuf, outbuflen);
+ if (error == 0)
+ break;
+ if (errno == ERANGE)
+ continue;
+ if (errno == ENOSYS)
+ enosys();
+ warn("failed to show rules for '%s'", unexpanded_rule);
+ free(outbuf);
+
+ return (error);
+ }
+
+ print_rules(outbuf, hflag, nflag);
+ free(outbuf);
+
+ return (error);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: rctl [ -h ] [-a rule | -l filter | -r filter "
+ "| -u filter | filter]\n");
+ exit(1);
+}
+
+int
+main(int argc __unused, char **argv __unused)
+{
+ int ch, aflag = 0, hflag = 0, nflag = 0, lflag = 0, rflag = 0,
+ uflag = 0;
+ char *rule = NULL, *unexpanded_rule;
+ int i, cumulated_error, error;
+
+ while ((ch = getopt(argc, argv, "ahlnru")) != -1) {
+ switch (ch) {
+ case 'a':
+ aflag = 1;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+
+ case '?':
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (aflag + lflag + rflag + uflag > 1)
+ errx(1, "at most one of -a, -l, -r, or -u may be specified");
+
+ if (argc == 0) {
+ if (aflag + lflag + rflag + uflag == 0) {
+ rule = strdup("::");
+ show_rules(rule, rule, hflag, nflag);
+
+ return (0);
+ }
+
+ usage();
+ }
+
+ cumulated_error = 0;
+
+ for (i = 0; i < argc; i++) {
+ unexpanded_rule = argv[i];
+
+ /*
+ * Skip resolving if passed -n _and_ -a. Ignore -n otherwise,
+ * so we can still do "rctl -n u:root" and see the rules without
+ * resolving the UID.
+ */
+ if (aflag != 0 && nflag != 0)
+ rule = expand_rule(unexpanded_rule, false);
+ else
+ rule = expand_rule(unexpanded_rule, true);
+
+ if (rule == NULL) {
+ cumulated_error++;
+ continue;
+ }
+
+ /*
+ * The reason for passing the unexpanded_rule is to make
+ * it easier for the user to search for the problematic
+ * rule in the passed input.
+ */
+ if (aflag) {
+ error = add_rule(rule, unexpanded_rule);
+ } else if (lflag) {
+ error = show_limits(rule, unexpanded_rule,
+ hflag, nflag);
+ } else if (rflag) {
+ error = remove_rule(rule, unexpanded_rule);
+ } else if (uflag) {
+ error = show_usage(rule, unexpanded_rule, hflag);
+ } else {
+ error = show_rules(rule, unexpanded_rule,
+ hflag, nflag);
+ }
+
+ if (error != 0)
+ cumulated_error++;
+
+ free(rule);
+ }
+
+ return (cumulated_error);
+}
diff --git a/usr.bin/readelf/Makefile b/usr.bin/readelf/Makefile
new file mode 100644
index 0000000..8f7dec5
--- /dev/null
+++ b/usr.bin/readelf/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+READELFDIR= ${ELFTCDIR}/readelf
+
+.PATH: ${READELFDIR}
+
+PROG= readelf
+SRCS= readelf.c
+
+LIBADD= dwarf elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+# This same hack is in lib/libelf/Makefile and lib/libdwarf/Makefile
+# We need to link against the correct version of these files. One
+# solution is to include ../../sys in the include path. This causes
+# problems when a header file in sys depends on a file in another
+# part of the tree, e.g. a machine dependent header.
+#
+SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h
+CLEANDIRS= sys
+CFLAGS+= -I.
+sys/elf32.h sys/elf64.h sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
+ mkdir -p ${.OBJDIR}/sys
+ ln -sf ${.ALLSRC} ${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/readelf/Makefile.depend b/usr.bin/readelf/Makefile.depend
new file mode 100644
index 0000000..20f498c
--- /dev/null
+++ b/usr.bin/readelf/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdwarf \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/renice/Makefile b/usr.bin/renice/Makefile
new file mode 100644
index 0000000..d547137
--- /dev/null
+++ b/usr.bin/renice/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= renice
+MAN= renice.8
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/renice/Makefile.depend b/usr.bin/renice/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/renice/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/renice/renice.8 b/usr.bin/renice/renice.8
new file mode 100644
index 0000000..052ef13
--- /dev/null
+++ b/usr.bin/renice/renice.8
@@ -0,0 +1,134 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" @(#)renice.8 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt RENICE 8
+.Os
+.Sh NAME
+.Nm renice
+.Nd alter priority of running processes
+.Sh SYNOPSIS
+.Nm
+.Ar priority
+.Op Oo Fl p Oc Ar pid ...
+.Op Oo Fl g Oc Ar pgrp ...
+.Op Oo Fl u Oc Ar user ...
+.Nm
+.Fl n Ar increment
+.Op Oo Fl p Oc Ar pid ...
+.Op Oo Fl g Oc Ar pgrp ...
+.Op Oo Fl u Oc Ar user ...
+.Sh DESCRIPTION
+The
+.Nm
+utility alters the
+scheduling priority of one or more running processes.
+The following
+.Ar who
+parameters are interpreted as process ID's, process group
+ID's, user ID's or user names.
+The
+.Nm Ns 'ing
+of a process group causes all processes in the process group
+to have their scheduling priority altered.
+The
+.Nm Ns 'ing
+of a user causes all processes owned by the user to have
+their scheduling priority altered.
+By default, the processes to be affected are specified by
+their process ID's.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl g
+Force
+.Ar who
+parameters to be interpreted as process group ID's.
+.It Fl n
+Instead of changing the specified processes to the given priority,
+interpret the following argument as an increment to be applied to
+the current priority of each process.
+.It Fl u
+Force the
+.Ar who
+parameters to be interpreted as user names or user ID's.
+.It Fl p
+Reset the
+.Ar who
+interpretation to be (the default) process ID's.
+.El
+.Pp
+Users other than the super-user may only alter the priority of
+processes they own,
+and can only monotonically increase their ``nice value''
+within the range 0 to
+.Dv PRIO_MAX
+(20).
+(This prevents overriding administrative fiats.)
+The super-user
+may alter the priority of any process
+and set the priority to any value in the range
+.Dv PRIO_MIN
+(\-20)
+to
+.Dv PRIO_MAX .
+Useful priorities are:
+20 (the affected processes will run only when nothing else
+in the system wants to),
+0 (the ``base'' scheduling priority),
+anything negative (to make things go very fast).
+.Sh FILES
+.Bl -tag -width /etc/passwd -compact
+.It Pa /etc/passwd
+to map user names to user ID's
+.El
+.Sh EXAMPLES
+Change the priority of process ID's 987 and 32, and
+all processes owned by users daemon and root.
+.Pp
+.Dl "renice +1 987 -u daemon root -p 32"
+.Sh SEE ALSO
+.Xr nice 1 ,
+.Xr rtprio 1 ,
+.Xr getpriority 2 ,
+.Xr setpriority 2
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.0 .
+.Sh BUGS
+Non super-users cannot increase scheduling priorities of their own processes,
+even if they were the ones that decreased the priorities in the first place.
diff --git a/usr.bin/renice/renice.c b/usr.bin/renice/renice.c
new file mode 100644
index 0000000..8c8a26e
--- /dev/null
+++ b/usr.bin/renice/renice.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 1983, 1989, 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) 1983, 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)renice.c 8.1 (Berkeley) 6/9/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int donice(int, int, int, int);
+static int getnum(const char *, const char *, int *);
+static void usage(void);
+
+/*
+ * Change the priority (nice) of processes
+ * or groups of processes which are already
+ * running.
+ */
+int
+main(int argc, char *argv[])
+{
+ struct passwd *pwd;
+ int errs, incr, prio, which, who;
+
+ errs = 0;
+ incr = 0;
+ which = PRIO_PROCESS;
+ who = 0;
+ argc--, argv++;
+ if (argc < 2)
+ usage();
+ if (strcmp(*argv, "-n") == 0) {
+ incr = 1;
+ argc--, argv++;
+ if (argc < 2)
+ usage();
+ }
+ if (getnum("priority", *argv, &prio))
+ return (1);
+ argc--, argv++;
+ for (; argc > 0; argc--, argv++) {
+ if (strcmp(*argv, "-g") == 0) {
+ which = PRIO_PGRP;
+ continue;
+ }
+ if (strcmp(*argv, "-u") == 0) {
+ which = PRIO_USER;
+ continue;
+ }
+ if (strcmp(*argv, "-p") == 0) {
+ which = PRIO_PROCESS;
+ continue;
+ }
+ if (which == PRIO_USER) {
+ if ((pwd = getpwnam(*argv)) != NULL)
+ who = pwd->pw_uid;
+ else if (getnum("uid", *argv, &who)) {
+ errs++;
+ continue;
+ } else if (who < 0) {
+ warnx("%s: bad value", *argv);
+ errs++;
+ continue;
+ }
+ } else {
+ if (getnum("pid", *argv, &who)) {
+ errs++;
+ continue;
+ }
+ if (who < 0) {
+ warnx("%s: bad value", *argv);
+ errs++;
+ continue;
+ }
+ }
+ errs += donice(which, who, prio, incr);
+ }
+ exit(errs != 0);
+}
+
+static int
+donice(int which, int who, int prio, int incr)
+{
+ int oldprio;
+
+ errno = 0;
+ oldprio = getpriority(which, who);
+ if (oldprio == -1 && errno) {
+ warn("%d: getpriority", who);
+ return (1);
+ }
+ if (incr)
+ prio = oldprio + prio;
+ if (prio > PRIO_MAX)
+ prio = PRIO_MAX;
+ if (prio < PRIO_MIN)
+ prio = PRIO_MIN;
+ if (setpriority(which, who, prio) < 0) {
+ warn("%d: setpriority", who);
+ return (1);
+ }
+ fprintf(stderr, "%d: old priority %d, new priority %d\n", who,
+ oldprio, prio);
+ return (0);
+}
+
+static int
+getnum(const char *com, const char *str, int *val)
+{
+ long v;
+ char *ep;
+
+ errno = 0;
+ v = strtol(str, &ep, 10);
+ if (v < INT_MIN || v > INT_MAX || errno == ERANGE) {
+ warnx("%s argument %s is out of range.", com, str);
+ return (1);
+ }
+ if (ep == str || *ep != '\0' || errno != 0) {
+ warnx("Bad %s argument: %s.", com, str);
+ return (1);
+ }
+
+ *val = (int)v;
+ return (0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+"usage: renice priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]",
+" renice -n increment [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]");
+ exit(1);
+}
diff --git a/usr.bin/resizewin/Makefile b/usr.bin/resizewin/Makefile
new file mode 100644
index 0000000..013109b
--- /dev/null
+++ b/usr.bin/resizewin/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= resizewin
+
+.include <bsd.prog.mk>
+
diff --git a/usr.bin/resizewin/Makefile.depend b/usr.bin/resizewin/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/resizewin/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/resizewin/resizewin.1 b/usr.bin/resizewin/resizewin.1
new file mode 100644
index 0000000..beb1a0a
--- /dev/null
+++ b/usr.bin/resizewin/resizewin.1
@@ -0,0 +1,64 @@
+.\" resizewin
+.\"
+.\" Query terminal for size and inform the kernel
+.\"
+.\" Copyright 2015 EMC / Isilon Storage Division
+.\"
+.\" 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 March 17, 2016
+.Dt RESIZEWIN 1
+.Os
+.Sh NAME
+.Nm resizewin
+.Nd update the kernel window size for the current TTY
+.Sh DESCRIPTION
+Query the terminal emulator window size with the
+.Dv TIOCSWINSZ
+ioctl and set the window size known by the kernel to the new values.
+The terminal is assumed to be VT100/ANSI compatible.
+.Nm
+is functionally similar to
+.Xr resize 1 ,
+which is part of the
+.Xr xterm 1
+distribution.
+However,
+.Nm
+only works with VT100/ANSI-compatible terminals and does
+not emit commands to set environment variables.
+.Pp
+After a terminal window has been resized, running
+.Nm
+updates the kernel's window size to match the new size.
+.Pp
+Note that virtually all modern terninals support VT100/ANSI escape
+sequences, including xterm, konsole, gnome-terminal iTerm,
+Terminal.app, and puTTY.
+.Sh SEE ALSO
+.Xr resize 1 ,
+.Xr stty 1
+.Sh HISTORY
+.Nm
+appeared in FreeBSD 11.
diff --git a/usr.bin/resizewin/resizewin.c b/usr.bin/resizewin/resizewin.c
new file mode 100644
index 0000000..5399ad3
--- /dev/null
+++ b/usr.bin/resizewin/resizewin.c
@@ -0,0 +1,129 @@
+/*
+ * resizewin
+ *
+ * Query terminal for size and inform the kernel
+ *
+ * Copyright 2015 EMC / Isilon Storage Division
+ *
+ * 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/ioctl.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <termios.h>
+#include <unistd.h>
+
+/* screen doesn't support ESC[18t (return terminal size) so do it the hard way */
+static const char query[] =
+ "\0337" /* Save cursor position */
+ "\033[r" /* Scroll whole screen */
+ "\033[999;999H" /* Move cursor */
+ "\033[6n" /* Get cursor position */
+ "\0338"; /* Restore cursor position */
+int
+main(__unused int argc, __unused char **argv)
+{
+ struct termios old, new;
+ struct winsize w;
+ int ret, fd, cnt, err;
+ char data[20];
+ struct timeval then, now;
+
+ err = 0;
+
+ if ((fd = open("/dev/tty", O_RDWR | O_NONBLOCK)) == -1)
+ exit(1);
+
+ /* Disable echo */
+ if (tcgetattr(fd, &old) == -1)
+ exit(1);
+
+ new = old;
+ new.c_cflag |= (CLOCAL | CREAD);
+ new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+ if (tcsetattr(fd, TCSANOW, &new) == -1)
+ exit(1);
+
+ if (write(fd, query, sizeof(query)) != sizeof(query)) {
+ err = 1;
+ goto out;
+ }
+
+ /* Read the response */
+ bzero(data, sizeof(data));
+ gettimeofday(&then, NULL);
+ cnt = 0;
+ while (1) {
+ ret = read(fd, data + cnt, 1);
+
+ if (ret == -1) {
+ if (errno == EAGAIN) {
+ gettimeofday(&now, NULL);
+ timersub(&now, &then, &now);
+ if (now.tv_sec >= 2) {
+ fprintf(stderr, "\n\n\nTimeout reading from terminal\n");
+ fprintf(stderr, "Read %d bytes, %s\n", cnt, data);
+ err = 1;
+ goto out;
+ }
+
+ usleep(20000);
+ continue;
+ }
+ err = 1;
+ goto out;
+ }
+ if (data[cnt] == 'R')
+ break;
+
+ cnt++;
+ if (cnt == sizeof(data) - 2) {
+ fprintf(stderr, "Response too long\n");
+ err = 1;
+ goto out;
+ }
+ }
+
+ /* Parse */
+ if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) {
+ err = 1;
+ fprintf(stderr, "Unable to parse response\n");
+ goto out;
+ }
+
+ /* Finally, what we want */
+ if (ioctl(fd, TIOCSWINSZ, &w) == -1)
+ err = 1;
+ out:
+ /* Restore echo */
+ tcsetattr(fd, TCSANOW, &old);
+
+ close(fd);
+ exit(err);
+}
diff --git a/usr.bin/rev/Makefile b/usr.bin/rev/Makefile
new file mode 100644
index 0000000..27137ff
--- /dev/null
+++ b/usr.bin/rev/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= rev
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rev/Makefile.depend b/usr.bin/rev/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/rev/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/rev/rev.1 b/usr.bin/rev/rev.1
new file mode 100644
index 0000000..26b5bd9
--- /dev/null
+++ b/usr.bin/rev/rev.1
@@ -0,0 +1,45 @@
+.\" Copyright (c) 1985, 1992, 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.
+.\"
+.\" @(#)rev.1 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt REV 1
+.Os
+.Sh NAME
+.Nm rev
+.Nd reverse lines of a file
+.Sh SYNOPSIS
+.Nm
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility copies the specified files to the standard output, reversing the
+order of characters in every line.
+If no files are specified, the standard input is read.
diff --git a/usr.bin/rev/rev.c b/usr.bin/rev/rev.c
new file mode 100644
index 0000000..a048427
--- /dev/null
+++ b/usr.bin/rev/rev.c
@@ -0,0 +1,114 @@
+/*-
+ * Copyright (c) 1987, 1992, 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) 1987, 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)rev.c 8.3 (Berkeley) 5/4/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ const char *filename;
+ wchar_t *p, *t;
+ FILE *fp;
+ size_t len;
+ int ch, rval;
+
+ setlocale(LC_ALL, "");
+
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ fp = stdin;
+ filename = "stdin";
+ rval = 0;
+ do {
+ if (*argv) {
+ if ((fp = fopen(*argv, "r")) == NULL) {
+ warn("%s", *argv);
+ rval = 1;
+ ++argv;
+ continue;
+ }
+ filename = *argv++;
+ }
+ while ((p = fgetwln(fp, &len)) != NULL) {
+ if (p[len - 1] == '\n')
+ --len;
+ for (t = p + len - 1; t >= p; --t)
+ putwchar(*t);
+ putwchar('\n');
+ }
+ if (ferror(fp)) {
+ warn("%s", filename);
+ clearerr(fp);
+ rval = 1;
+ }
+ (void)fclose(fp);
+ } while(*argv);
+ exit(rval);
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: rev [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/revoke/Makefile b/usr.bin/revoke/Makefile
new file mode 100644
index 0000000..92fe221
--- /dev/null
+++ b/usr.bin/revoke/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= revoke
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/revoke/Makefile.depend b/usr.bin/revoke/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/revoke/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/revoke/revoke.1 b/usr.bin/revoke/revoke.1
new file mode 100644
index 0000000..2ab52c3
--- /dev/null
+++ b/usr.bin/revoke/revoke.1
@@ -0,0 +1,56 @@
+.\" Copyright (c) 2009 Ed Schouten <ed@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 June 15, 2009
+.Dt REVOKE 1
+.Os
+.Sh NAME
+.Nm revoke
+.Nd "revoke a character device"
+.Sh SYNOPSIS
+.Nm
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+program revokes the character devices using
+.Xr revoke 2 .
+When used on a TTY, calls like
+.Xr read 2 ,
+.Xr write 2
+and
+.Xr ioctl 2 ,
+will be aborted immediately, effectively causing login sessions to be
+terminated.
+.Sh SEE ALSO
+.Xr revoke 2
+.Sh HISTORY
+The
+.Nm
+program first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/usr.bin/revoke/revoke.c b/usr.bin/revoke/revoke.c
new file mode 100644
index 0000000..bc9f838
--- /dev/null
+++ b/usr.bin/revoke/revoke.c
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2009 Ed Schouten <ed@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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: revoke file ...\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char **d;
+ int error = 0;
+
+ if (argc == 1)
+ usage();
+
+ for (d = &argv[1]; *d != NULL; d++) {
+ if (revoke(*d) != 0) {
+ perror(*d);
+ error = 1;
+ }
+ }
+
+ return (error);
+}
diff --git a/usr.bin/rlogin/Makefile b/usr.bin/rlogin/Makefile
new file mode 100644
index 0000000..74ab15b
--- /dev/null
+++ b/usr.bin/rlogin/Makefile
@@ -0,0 +1,11 @@
+# @(#)Makefile 8.1 (Berkeley) 7/19/93
+# $FreeBSD$
+
+PROG= rlogin
+
+PACKAGE=rcmds
+
+BINOWN= root
+BINMODE=4555
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rlogin/Makefile.depend b/usr.bin/rlogin/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/rlogin/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/rlogin/rlogin.1 b/usr.bin/rlogin/rlogin.1
new file mode 100644
index 0000000..8aea6bd
--- /dev/null
+++ b/usr.bin/rlogin/rlogin.1
@@ -0,0 +1,158 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)rlogin.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd September 26, 2003
+.Dt RLOGIN 1
+.Os
+.Sh NAME
+.Nm rlogin
+.Nd remote login
+.Sh SYNOPSIS
+.Ar rlogin
+.Op Fl 468DEd
+.Op Fl e Ar char
+.Op Fl i Ar localname
+.Op Fl l Ar username
+.Ar host
+.Sh DESCRIPTION
+The
+.Nm
+utility starts a terminal session on a remote host
+.Ar host .
+.Pp
+The standard Berkeley
+.Pa rhosts
+authorization mechanism is used.
+.Pp
+The following options are available:
+.Bl -tag -width flag
+.It Fl 4
+Use IPv4 addresses only.
+.It Fl 6
+Use IPv6 addresses only.
+.It Fl 8
+Allow an eight-bit input data path at all times; otherwise
+parity bits are stripped except when the remote side's stop and start
+characters are other than
+^S/^Q.
+.It Fl D
+Set the TCP_NODELAY socket option which can improve interactive response
+at the expense of increased network load.
+.It Fl E
+Stop any character from being recognized as an escape character.
+When used with the
+.Fl 8
+option, this provides a completely transparent connection.
+.It Fl d
+Turn on socket debugging (see
+.Xr setsockopt 2 )
+on the TCP sockets used for communication with the remote host.
+.It Fl e
+Allow user specification of the escape character, which is
+.Dq ~
+by default.
+This specification may be as a literal character, or as an octal
+value in the form \ennn.
+.It Fl i
+Allow the caller to specify a different local name to be used
+for authentication.
+This option is restricted to processes with uid 0.
+.It Fl l
+Specify a different
+.Ar username
+for the remote login.
+If this option is not specified, your local username will be used.
+.El
+.Pp
+A line of the form
+.Dq Ao escape char Ac Ns \&.
+disconnects from the remote host.
+Similarly, the line
+.Dq Ao escape char Ac Ns ^Z
+will suspend the
+.Nm
+session, and
+.Dq Ao escape\ char Ac Ns Ao delayed-suspend\ char Ac
+suspends the
+send portion of the
+.Nm
+session, but allows output from the remote system.
+By default, the tilde
+.Pq Dq ~
+character is the escape character, and
+normally control-Y
+.Pq Dq ^Y
+is the delayed-suspend character.
+.Pp
+All echoing takes place at the remote site, so that (except for delays)
+the
+.Nm
+is transparent.
+Flow control via ^S/^Q and flushing of input and output on interrupts
+are handled properly.
+.Sh ENVIRONMENT
+The following environment variable is utilized by
+.Nm :
+.Bl -tag -width TERM
+.It Ev TERM
+Determines the user's terminal type.
+.El
+.Sh FILES
+.Bl -tag -width /etc/hosts -compact
+.It Pa /etc/hosts
+.It Pa /etc/hosts.equiv
+.It Ev $HOME Ns Pa /.rhosts
+.El
+.Sh SEE ALSO
+.Xr login 1 ,
+.Xr rsh 1 ,
+.Xr telnet 1 ,
+.Xr setsockopt 2 ,
+.Xr ruserok 3 ,
+.Xr tty 4 ,
+.Xr hosts 5 ,
+.Xr hosts.equiv 5 ,
+.Xr rlogind 8 ,
+.Xr rshd 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Pp
+IPv6 support was added by WIDE/KAME project.
+.Sh BUGS
+The
+.Nm
+utility will be replaced by
+.Xr telnet 1
+in the near future.
+.Pp
+More of the environment should be propagated.
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
new file mode 100644
index 0000000..2669255
--- /dev/null
+++ b/usr.bin/rlogin/rlogin.c
@@ -0,0 +1,722 @@
+/*
+ * Copyright (c) 1983, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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) 1983, 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static const char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rlogin - remote login
+ */
+
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <paths.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <termios.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef TIOCPKT_WINDOW
+#define TIOCPKT_WINDOW 0x80
+#endif
+
+/* concession to Sun */
+#ifndef SIGUSR1
+#define SIGUSR1 30
+#endif
+
+static int eight, rem;
+static struct termios deftty;
+
+static int family = PF_UNSPEC;
+
+static int noescape;
+static u_char escapechar = '~';
+
+#define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp)
+static struct winsize winsize;
+
+static void catch_child(int);
+static void copytochild(int);
+static _Noreturn void doit(long);
+static _Noreturn void done(int);
+static void echo(char);
+static u_int getescape(const char *);
+static void lostpeer(int);
+static void mode(int);
+static void msg(const char *);
+static void oob(int);
+static int reader(int);
+static void sendwindow(void);
+static void setsignal(int);
+static void sigwinch(int);
+static void stop(char);
+static _Noreturn void usage(void);
+static void writer(void);
+static void writeroob(int);
+
+int
+main(int argc, char *argv[])
+{
+ struct passwd *pw;
+ struct servent *sp;
+ struct termios tty;
+ long omask;
+ int argoff, ch, dflag, Dflag, one;
+ uid_t uid;
+ char *host, *localname, *p, *user, term[1024] = "network";
+ speed_t ospeed;
+ struct sockaddr_storage ss;
+ socklen_t sslen;
+ size_t len, len2;
+ int i;
+
+ argoff = dflag = Dflag = 0;
+ one = 1;
+ host = localname = user = NULL;
+
+ if ((p = strrchr(argv[0], '/')))
+ ++p;
+ else
+ p = argv[0];
+
+ if (strcmp(p, "rlogin"))
+ host = p;
+
+ /* handle "rlogin host flags" */
+ if (!host && argc > 2 && argv[1][0] != '-') {
+ host = argv[1];
+ argoff = 1;
+ }
+
+#define OPTIONS "468DEde:i:l:"
+ while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
+ switch(ch) {
+ case '4':
+ family = PF_INET;
+ break;
+
+ case '6':
+ family = PF_INET6;
+ break;
+
+ case '8':
+ eight = 1;
+ break;
+ case 'D':
+ Dflag = 1;
+ break;
+ case 'E':
+ noescape = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'e':
+ noescape = 0;
+ escapechar = getescape(optarg);
+ break;
+ case 'i':
+ if (getuid() != 0)
+ errx(1, "-i user: permission denied");
+ localname = optarg;
+ break;
+ case 'l':
+ user = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ optind += argoff;
+
+ /* if haven't gotten a host yet, do so */
+ if (!host && !(host = argv[optind++]))
+ usage();
+
+ if (argv[optind])
+ usage();
+
+ if (!(pw = getpwuid(uid = getuid())))
+ errx(1, "unknown user id");
+ if (!user)
+ user = pw->pw_name;
+ if (!localname)
+ localname = pw->pw_name;
+
+ sp = NULL;
+ sp = getservbyname("login", "tcp");
+ if (sp == NULL)
+ errx(1, "login/tcp: unknown service");
+
+ if ((p = getenv("TERM")) != NULL)
+ (void)strlcpy(term, p, sizeof(term));
+ len = strlen(term);
+ if (len < (sizeof(term) - 1) && tcgetattr(0, &tty) == 0) {
+ /* start at 2 to include the / */
+ for (ospeed = i = cfgetospeed(&tty), len2 = 2; i > 9; len2++)
+ i /= 10;
+ if (len + len2 < sizeof(term))
+ (void)snprintf(term + len, len2 + 1, "/%d", ospeed);
+ }
+
+ (void)get_window_size(0, &winsize);
+
+ (void)signal(SIGPIPE, lostpeer);
+ /* will use SIGUSR1 for window size hack, so hold it off */
+ omask = sigblock(sigmask(SIGURG) | sigmask(SIGUSR1));
+ /*
+ * We set SIGURG and SIGUSR1 below so that an
+ * incoming signal will be held pending rather than being
+ * discarded. Note that these routines will be ready to get
+ * a signal by the time that they are unblocked below.
+ */
+ (void)signal(SIGURG, copytochild);
+ (void)signal(SIGUSR1, writeroob);
+
+ rem = rcmd_af(&host, sp->s_port, localname, user, term, 0, family);
+
+ if (rem < 0)
+ exit(1);
+
+ if (dflag &&
+ setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) < 0)
+ warn("setsockopt");
+ if (Dflag &&
+ setsockopt(rem, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) < 0)
+ warn("setsockopt NODELAY (ignored)");
+
+ sslen = sizeof(ss);
+ one = IPTOS_LOWDELAY;
+ if (getsockname(rem, (struct sockaddr *)&ss, &sslen) == 0 &&
+ ss.ss_family == AF_INET) {
+ if (setsockopt(rem, IPPROTO_IP, IP_TOS, (char *)&one,
+ sizeof(int)) < 0)
+ warn("setsockopt TOS (ignored)");
+ } else
+ if (ss.ss_family == AF_INET)
+ warn("setsockopt getsockname failed");
+
+ (void)setuid(uid);
+ doit(omask);
+ /*NOTREACHED*/
+}
+
+static int child;
+
+static void
+doit(long omask)
+{
+
+ (void)signal(SIGINT, SIG_IGN);
+ setsignal(SIGHUP);
+ setsignal(SIGQUIT);
+ mode(1);
+ child = fork();
+ if (child == -1) {
+ warn("fork");
+ done(1);
+ }
+ if (child == 0) {
+ if (reader(omask) == 0) {
+ msg("connection closed");
+ exit(0);
+ }
+ sleep(1);
+ msg("\007connection closed");
+ exit(1);
+ }
+
+ /*
+ * We may still own the socket, and may have a pending SIGURG (or might
+ * receive one soon) that we really want to send to the reader. When
+ * one of these comes in, the trap copytochild simply copies such
+ * signals to the child. We can now unblock SIGURG and SIGUSR1
+ * that were set above.
+ */
+ (void)sigsetmask(omask);
+ (void)signal(SIGCHLD, catch_child);
+ writer();
+ msg("closed connection");
+ done(0);
+}
+
+/* trap a signal, unless it is being ignored. */
+static void
+setsignal(int sig)
+{
+ int omask = sigblock(sigmask(sig));
+
+ if (signal(sig, exit) == SIG_IGN)
+ (void)signal(sig, SIG_IGN);
+ (void)sigsetmask(omask);
+}
+
+static void
+done(int status)
+{
+ int w, wstatus;
+
+ mode(0);
+ if (child > 0) {
+ /* make sure catch_child does not snap it up */
+ (void)signal(SIGCHLD, SIG_DFL);
+ if (kill(child, SIGKILL) >= 0)
+ while ((w = wait(&wstatus)) > 0 && w != child);
+ }
+ exit(status);
+}
+
+static int dosigwinch;
+
+/*
+ * This is called when the reader process gets the out-of-band (urgent)
+ * request to turn on the window-changing protocol.
+ */
+/* ARGSUSED */
+static void
+writeroob(int signo __unused)
+{
+ if (dosigwinch == 0) {
+ sendwindow();
+ (void)signal(SIGWINCH, sigwinch);
+ }
+ dosigwinch = 1;
+}
+
+/* ARGSUSED */
+static void
+catch_child(int signo __unused)
+{
+ pid_t pid;
+ int status;
+
+ for (;;) {
+ pid = wait3(&status, WNOHANG|WUNTRACED, NULL);
+ if (pid == 0)
+ return;
+ /* if the child (reader) dies, just quit */
+ if (pid < 0 || (pid == child && !WIFSTOPPED(status)))
+ done(WTERMSIG(status) | WEXITSTATUS(status));
+ }
+ /* NOTREACHED */
+}
+
+/*
+ * writer: write to remote: 0 -> line.
+ * ~. terminate
+ * ~^Z suspend rlogin process.
+ * ~<delayed-suspend char> suspend rlogin process, but leave reader alone.
+ */
+static void
+writer(void)
+{
+ int bol, local, n;
+ char c;
+
+ bol = 1; /* beginning of line */
+ local = 0;
+ for (;;) {
+ n = read(STDIN_FILENO, &c, 1);
+ if (n <= 0) {
+ if (n < 0 && errno == EINTR)
+ continue;
+ break;
+ }
+ /*
+ * If we're at the beginning of the line and recognize a
+ * command character, then we echo locally. Otherwise,
+ * characters are echo'd remotely. If the command character
+ * is doubled, this acts as a force and local echo is
+ * suppressed.
+ */
+ if (bol) {
+ bol = 0;
+ if (!noescape && c == escapechar) {
+ local = 1;
+ continue;
+ }
+ } else if (local) {
+ local = 0;
+ if (c == '.' || CCEQ(deftty.c_cc[VEOF], c)) {
+ echo(c);
+ break;
+ }
+ if (CCEQ(deftty.c_cc[VSUSP], c) ||
+ CCEQ(deftty.c_cc[VDSUSP], c)) {
+ bol = 1;
+ echo(c);
+ stop(c);
+ continue;
+ }
+ if (c != escapechar)
+ (void)write(rem, &escapechar, 1);
+ }
+
+ if (write(rem, &c, 1) == 0) {
+ msg("line gone");
+ break;
+ }
+ bol = CCEQ(deftty.c_cc[VKILL], c) ||
+ CCEQ(deftty.c_cc[VEOF], c) ||
+ CCEQ(deftty.c_cc[VINTR], c) ||
+ CCEQ(deftty.c_cc[VSUSP], c) ||
+ c == '\r' || c == '\n';
+ }
+}
+
+static void
+echo(char c)
+{
+ char *p;
+ char buf[8];
+
+ p = buf;
+ c &= 0177;
+ *p++ = escapechar;
+ if (c < ' ') {
+ *p++ = '^';
+ *p++ = c + '@';
+ } else if (c == 0177) {
+ *p++ = '^';
+ *p++ = '?';
+ } else
+ *p++ = c;
+ *p++ = '\r';
+ *p++ = '\n';
+ (void)write(STDOUT_FILENO, buf, p - buf);
+}
+
+static void
+stop(char cmdc)
+{
+ mode(0);
+ (void)signal(SIGCHLD, SIG_IGN);
+ (void)kill(CCEQ(deftty.c_cc[VSUSP], cmdc) ? 0 : getpid(), SIGTSTP);
+ (void)signal(SIGCHLD, catch_child);
+ mode(1);
+ sigwinch(0); /* check for size changes */
+}
+
+/* ARGSUSED */
+static void
+sigwinch(int signo __unused)
+{
+ struct winsize ws;
+
+ if (dosigwinch && get_window_size(0, &ws) == 0 &&
+ bcmp(&ws, &winsize, sizeof(ws))) {
+ winsize = ws;
+ sendwindow();
+ }
+}
+
+/*
+ * Send the window size to the server via the magic escape
+ */
+static void
+sendwindow(void)
+{
+ struct winsize ws;
+ char obuf[4 + sizeof (struct winsize)];
+
+ obuf[0] = 0377;
+ obuf[1] = 0377;
+ obuf[2] = 's';
+ obuf[3] = 's';
+ ws.ws_row = htons(winsize.ws_row);
+ ws.ws_col = htons(winsize.ws_col);
+ ws.ws_xpixel = htons(winsize.ws_xpixel);
+ ws.ws_ypixel = htons(winsize.ws_ypixel);
+ bcopy(&ws, obuf + 4, sizeof(ws));
+
+ (void)write(rem, obuf, sizeof(obuf));
+}
+
+/*
+ * reader: read from remote: line -> 1
+ */
+#define READING 1
+#define WRITING 2
+
+static jmp_buf rcvtop;
+static int rcvcnt, rcvstate;
+static pid_t ppid;
+static char rcvbuf[8 * 1024];
+
+/* ARGSUSED */
+static void
+oob(int signo __unused)
+{
+ struct termios tty;
+ int atmark, n, rcvd;
+ char waste[BUFSIZ], mark;
+
+ rcvd = 0;
+ while (recv(rem, &mark, 1, MSG_OOB) < 0) {
+ switch (errno) {
+ case EWOULDBLOCK:
+ /*
+ * Urgent data not here yet. It may not be possible
+ * to send it yet if we are blocked for output and
+ * our input buffer is full.
+ */
+ if (rcvcnt < (int)sizeof(rcvbuf)) {
+ n = read(rem, rcvbuf + rcvcnt,
+ sizeof(rcvbuf) - rcvcnt);
+ if (n <= 0)
+ return;
+ rcvd += n;
+ } else {
+ n = read(rem, waste, sizeof(waste));
+ if (n <= 0)
+ return;
+ }
+ continue;
+ default:
+ return;
+ }
+ }
+ if (mark & TIOCPKT_WINDOW) {
+ /* Let server know about window size changes */
+ (void)kill(ppid, SIGUSR1);
+ }
+ if (!eight && (mark & TIOCPKT_NOSTOP)) {
+ (void)tcgetattr(0, &tty);
+ tty.c_iflag &= ~IXON;
+ (void)tcsetattr(0, TCSANOW, &tty);
+ }
+ if (!eight && (mark & TIOCPKT_DOSTOP)) {
+ (void)tcgetattr(0, &tty);
+ tty.c_iflag |= (deftty.c_iflag & IXON);
+ (void)tcsetattr(0, TCSANOW, &tty);
+ }
+ if (mark & TIOCPKT_FLUSHWRITE) {
+ (void)tcflush(1, TCIOFLUSH);
+ for (;;) {
+ if (ioctl(rem, SIOCATMARK, &atmark) < 0) {
+ warn("ioctl");
+ break;
+ }
+ if (atmark)
+ break;
+ n = read(rem, waste, sizeof (waste));
+ if (n <= 0)
+ break;
+ }
+ /*
+ * Don't want any pending data to be output, so clear the recv
+ * buffer. If we were hanging on a write when interrupted,
+ * don't want it to restart. If we were reading, restart
+ * anyway.
+ */
+ rcvcnt = 0;
+ longjmp(rcvtop, 1);
+ }
+
+ /* oob does not do FLUSHREAD (alas!) */
+
+ /*
+ * If we filled the receive buffer while a read was pending, longjmp
+ * to the top to restart appropriately. Don't abort a pending write,
+ * however, or we won't know how much was written.
+ */
+ if (rcvd && rcvstate == READING)
+ longjmp(rcvtop, 1);
+}
+
+/* reader: read from remote: line -> 1 */
+static int
+reader(int omask)
+{
+ int n, remaining;
+ char *bufp;
+ pid_t pid;
+
+ pid = getpid();
+ (void)signal(SIGTTOU, SIG_IGN);
+ (void)signal(SIGURG, oob);
+ (void)signal(SIGUSR1, oob); /* When propogating SIGURG from parent */
+ ppid = getppid();
+ (void)fcntl(rem, F_SETOWN, pid);
+ (void)setjmp(rcvtop);
+ (void)sigsetmask(omask);
+ bufp = rcvbuf;
+ for (;;) {
+ while ((remaining = rcvcnt - (bufp - rcvbuf)) > 0) {
+ rcvstate = WRITING;
+ n = write(STDOUT_FILENO, bufp, remaining);
+ if (n < 0) {
+ if (errno != EINTR)
+ return (-1);
+ continue;
+ }
+ bufp += n;
+ }
+ bufp = rcvbuf;
+ rcvcnt = 0;
+ rcvstate = READING;
+
+ rcvcnt = read(rem, rcvbuf, sizeof (rcvbuf));
+ if (rcvcnt == 0)
+ return (0);
+ if (rcvcnt < 0) {
+ if (errno == EINTR)
+ continue;
+ warn("read");
+ return (-1);
+ }
+ }
+}
+
+static void
+mode(int f)
+{
+ struct termios tty;
+
+ switch (f) {
+ case 0:
+ (void)tcsetattr(0, TCSANOW, &deftty);
+ break;
+ case 1:
+ (void)tcgetattr(0, &deftty);
+ tty = deftty;
+ /* This is loosely derived from sys/kern/tty_compat.c. */
+ tty.c_lflag &= ~(ECHO|ICANON|ISIG|IEXTEN);
+ tty.c_iflag &= ~ICRNL;
+ tty.c_oflag &= ~OPOST;
+ tty.c_cc[VMIN] = 1;
+ tty.c_cc[VTIME] = 0;
+ if (eight) {
+ tty.c_iflag &= IXOFF;
+ tty.c_cflag &= ~(CSIZE|PARENB);
+ tty.c_cflag |= CS8;
+ }
+ (void)tcsetattr(0, TCSANOW, &tty);
+ break;
+ default:
+ return;
+ }
+}
+
+/* ARGSUSED */
+static void
+lostpeer(int signo __unused)
+{
+ (void)signal(SIGPIPE, SIG_IGN);
+ msg("\007connection closed");
+ done(1);
+}
+
+/* copy SIGURGs to the child process via SIGUSR1. */
+/* ARGSUSED */
+static void
+copytochild(int signo __unused)
+{
+ (void)kill(child, SIGUSR1);
+}
+
+static void
+msg(const char *str)
+{
+ (void)fprintf(stderr, "rlogin: %s\r\n", str);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: rlogin [-46%s]%s[-e char] [-i localname] [-l username] host\n",
+ "8DEd", " ");
+ exit(1);
+}
+
+static u_int
+getescape(const char *p)
+{
+ long val;
+ size_t len;
+
+ if ((len = strlen(p)) == 1) /* use any single char, including '\' */
+ return ((u_int)*p);
+ /* otherwise, \nnn */
+ if (*p == '\\' && len >= 2 && len <= 4) {
+ val = strtol(++p, NULL, 8);
+ for (;;) {
+ if (!*++p)
+ return ((u_int)val);
+ if (*p < '0' || *p > '8')
+ break;
+ }
+ }
+ msg("illegal option value -- e");
+ usage();
+ /* NOTREACHED */
+}
diff --git a/usr.bin/rpcgen/Makefile b/usr.bin/rpcgen/Makefile
new file mode 100644
index 0000000..f78fa64
--- /dev/null
+++ b/usr.bin/rpcgen/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= rpcgen
+SRCS= rpc_main.c rpc_clntout.c rpc_cout.c rpc_hout.c rpc_parse.c \
+ rpc_sample.c rpc_scan.c rpc_svcout.c rpc_tblout.c rpc_util.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rpcgen/Makefile.depend b/usr.bin/rpcgen/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/rpcgen/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c
new file mode 100644
index 0000000..713cba1
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_clntout.c
@@ -0,0 +1,278 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_clntout.c 1.15 94/04/25 SMI"
+static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsytsems, Inc.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <rpc/types.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+static void write_program( definition * );
+static void printbody( proc_list * );
+
+static char RESULT[] = "clnt_res";
+
+
+#define DEFAULT_TIMEOUT 25 /* in seconds */
+
+
+void
+write_stubs(void)
+{
+ list *l;
+ definition *def;
+
+ f_print(fout,
+ "\n/* Default timeout can be changed using clnt_control() */\n");
+ f_print(fout, "static struct timeval TIMEOUT = { %d, 0 };\n",
+ DEFAULT_TIMEOUT);
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind == DEF_PROGRAM) {
+ write_program(def);
+ }
+ }
+}
+
+static void
+write_program(definition *def)
+{
+ version_list *vp;
+ proc_list *proc;
+
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ f_print(fout, "\n");
+ if (mtflag == 0) {
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*\n");
+ pvname(proc->proc_name, vp->vers_num);
+ printarglist(proc, RESULT, "clnt", "CLIENT *");
+ } else {
+ f_print(fout, "enum clnt_stat \n");
+ pvname(proc->proc_name, vp->vers_num);
+ printarglist(proc, RESULT, "clnt", "CLIENT *");
+
+ }
+ f_print(fout, "{\n");
+ printbody(proc);
+
+ f_print(fout, "}\n");
+ }
+ }
+}
+
+/*
+ * Writes out declarations of procedure's argument list.
+ * In either ANSI C style, in one of old rpcgen style (pass by reference),
+ * or new rpcgen style (multiple arguments, pass by value);
+ */
+
+/* sample addargname = "clnt"; sample addargtype = "CLIENT * " */
+
+void
+printarglist(proc_list *proc, const char *result, const char *addargname,
+ const char *addargtype)
+{
+
+ decl_list *l;
+
+ if (!newstyle) {
+ /* old style: always pass argument by reference */
+ f_print(fout, "(");
+ ptype(proc->args.decls->decl.prefix,
+ proc->args.decls->decl.type, 1);
+
+ if (mtflag) {/* Generate result field */
+ f_print(fout, "*argp, ");
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*%s, %s%s)\n",
+ result, addargtype, addargname);
+ } else
+ f_print(fout, "*argp, %s%s)\n", addargtype, addargname);
+ } else if (streq(proc->args.decls->decl.type, "void")) {
+ /* newstyle, 0 argument */
+ if (mtflag) {
+ f_print(fout, "(");
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*%s, %s%s)\n",
+ result, addargtype, addargname);
+ } else
+ f_print(fout, "(%s%s)\n", addargtype, addargname);
+ } else {
+ /* new style, 1 or multiple arguments */
+ f_print(fout, "(");
+ for (l = proc->args.decls; l != NULL; l = l->next) {
+ pdeclaration(proc->args.argname, &l->decl, 0, ", ");
+ }
+ if (mtflag) {
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*%s, ", result);
+
+ }
+ f_print(fout, "%s%s)\n", addargtype, addargname);
+ }
+}
+
+
+
+static const char *
+ampr(const char *type)
+{
+ if (isvectordef(type, REL_ALIAS)) {
+ return ("");
+ } else {
+ return ("&");
+ }
+}
+
+static void
+printbody(proc_list *proc)
+{
+ decl_list *l;
+ bool_t args2 = (proc->arg_num > 1);
+
+ /*
+ * For new style with multiple arguments, need a structure in which
+ * to stuff the arguments.
+ */
+
+
+ if (newstyle && args2) {
+ f_print(fout, "\t%s", proc->args.argname);
+ f_print(fout, " arg;\n");
+ }
+ if (!mtflag) {
+ f_print(fout, "\tstatic ");
+ if (streq(proc->res_type, "void")) {
+ f_print(fout, "char ");
+ } else {
+ ptype(proc->res_prefix, proc->res_type, 0);
+ }
+ f_print(fout, "%s;\n", RESULT);
+ f_print(fout, "\n");
+ f_print(fout, "\tmemset((char *)%s%s, 0, sizeof (%s));\n",
+ ampr(proc->res_type), RESULT, RESULT);
+
+ }
+ if (newstyle && !args2 &&
+ (streq(proc->args.decls->decl.type, "void"))) {
+ /* newstyle, 0 arguments */
+
+ if (mtflag)
+ f_print(fout, "\t return ");
+ else
+ f_print(fout, "\t if ");
+
+ f_print(fout,
+ "(clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_void, ",
+ proc->proc_name);
+ f_print(fout,
+ "(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+ stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
+ RESULT);
+
+ if (mtflag)
+ f_print(fout, "\n\t\tTIMEOUT));\n");
+ else
+ f_print(fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
+
+ } else if (newstyle && args2) {
+ /*
+ * Newstyle, multiple arguments
+ * stuff arguments into structure
+ */
+ for (l = proc->args.decls; l != NULL; l = l->next) {
+ f_print(fout, "\targ.%s = %s;\n",
+ l->decl.name, l->decl.name);
+ }
+ if (mtflag)
+ f_print(fout, "\treturn ");
+ else
+ f_print(fout, "\tif ");
+ f_print(fout,
+ "(clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s",
+ proc->proc_name,proc->args.argname);
+ f_print(fout,
+ ", (caddr_t) &arg,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+ stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
+ RESULT);
+ if (mtflag)
+ f_print(fout, "\n\t\tTIMEOUT));\n");
+ else
+ f_print(fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
+ } else { /* single argument, new or old style */
+ if (!mtflag)
+ f_print(fout,
+ "\tif (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n",
+ proc->proc_name,
+ stringfix(proc->args.decls->decl.type),
+ (newstyle ? "&" : ""),
+ (newstyle ? proc->args.decls->decl.name : "argp"),
+ stringfix(proc->res_type), ampr(proc->res_type),
+ RESULT);
+ else
+
+ f_print(fout,
+ "\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT));\n",
+ proc->proc_name,
+ stringfix(proc->args.decls->decl.type),
+ (newstyle ? "&" : ""),
+ (newstyle ? proc->args.decls->decl.name : "argp"),
+ stringfix(proc->res_type), "",
+ RESULT);
+ }
+ if (!mtflag) {
+ f_print(fout, "\t\treturn (NULL);\n");
+ f_print(fout, "\t}\n");
+
+ if (streq(proc->res_type, "void")) {
+ f_print(fout, "\treturn ((void *)%s%s);\n",
+ ampr(proc->res_type), RESULT);
+ } else {
+ f_print(fout, "\treturn (%s%s);\n",
+ ampr(proc->res_type), RESULT);
+ }
+ }
+}
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c
new file mode 100644
index 0000000..0c2ce20
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_cout.c
@@ -0,0 +1,719 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_cout.c 1.14 93/07/05 SMI"
+static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+static void print_header( definition * );
+static void print_trailer( void );
+static void print_stat( int , declaration * );
+static void emit_enum( definition * );
+static void emit_program( definition * );
+static void emit_union( definition * );
+static void emit_struct( definition * );
+static void emit_typedef( definition * );
+static void emit_inline( int, declaration *, int );
+static void emit_single_in_line( int, declaration *, int, relation );
+
+/*
+ * Emit the C-routine for the given definition
+ */
+void
+emit(definition *def)
+{
+ if (def->def_kind == DEF_CONST) {
+ return;
+ }
+ if (def->def_kind == DEF_PROGRAM) {
+ emit_program(def);
+ return;
+ }
+ if (def->def_kind == DEF_TYPEDEF) {
+ /*
+ * now we need to handle declarations like
+ * struct typedef foo foo;
+ * since we dont want this to be expanded into 2 calls to xdr_foo
+ */
+
+ if (strcmp(def->def.ty.old_type, def->def_name) == 0)
+ return;
+ }
+ print_header(def);
+ switch (def->def_kind) {
+ case DEF_UNION:
+ emit_union(def);
+ break;
+ case DEF_ENUM:
+ emit_enum(def);
+ break;
+ case DEF_STRUCT:
+ emit_struct(def);
+ break;
+ case DEF_TYPEDEF:
+ emit_typedef(def);
+ break;
+ /* DEF_CONST and DEF_PROGRAM have already been handled */
+ default:
+ break;
+ }
+ print_trailer();
+}
+
+static int
+findtype(definition *def, const char *type)
+{
+
+ if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
+ return (0);
+ } else {
+ return (streq(def->def_name, type));
+ }
+}
+
+static int
+undefined(const char *type)
+{
+ definition *def;
+
+ def = (definition *) FINDVAL(defined, type, findtype);
+ return (def == NULL);
+}
+
+
+static void
+print_generic_header(const char *procname, int pointerp)
+{
+ f_print(fout, "\n");
+ f_print(fout, "bool_t\n");
+ f_print(fout, "xdr_%s(", procname);
+ f_print(fout, "XDR *xdrs, ");
+ f_print(fout, "%s ", procname);
+ if (pointerp)
+ f_print(fout, "*");
+ f_print(fout, "objp)\n{\n\n");
+}
+
+static void
+print_header(definition *def)
+{
+ print_generic_header(def->def_name,
+ def->def_kind != DEF_TYPEDEF ||
+ !isvectordef(def->def.ty.old_type,
+ def->def.ty.rel));
+ /* Now add Inline support */
+
+ if (inline_size == 0)
+ return;
+ /* May cause lint to complain. but ... */
+ f_print(fout, "\tregister long *buf;\n\n");
+}
+
+static void
+print_prog_header(proc_list *plist)
+{
+ print_generic_header(plist->args.argname, 1);
+}
+
+static void
+print_trailer(void)
+{
+ f_print(fout, "\treturn (TRUE);\n");
+ f_print(fout, "}\n");
+}
+
+
+static void
+print_ifopen(int indent, const char *name)
+{
+ tabify(fout, indent);
+ f_print(fout, "if (!xdr_%s(xdrs", name);
+}
+
+static void
+print_ifarg(const char *arg)
+{
+ f_print(fout, ", %s", arg);
+}
+
+static void
+print_ifsizeof(int indent, const char *prefix, const char *type)
+{
+ if (indent) {
+ f_print(fout, ",\n");
+ tabify(fout, indent);
+ } else {
+ f_print(fout, ", ");
+ }
+ if (streq(type, "bool")) {
+ f_print(fout, "sizeof (bool_t), (xdrproc_t) xdr_bool");
+ } else {
+ f_print(fout, "sizeof (");
+ if (undefined(type) && prefix) {
+ f_print(fout, "%s ", prefix);
+ }
+ f_print(fout, "%s), (xdrproc_t) xdr_%s", type, type);
+ }
+}
+
+static void
+print_ifclose(int indent, int brace)
+{
+ f_print(fout, "))\n");
+ tabify(fout, indent);
+ f_print(fout, "\treturn (FALSE);\n");
+ if (brace)
+ f_print(fout, "\t}\n");
+}
+
+static void
+print_ifstat(int indent, const char *prefix, const char *type, relation rel,
+ const char *amax, const char *objname, const char *name)
+{
+ const char *alt = NULL;
+ int brace = 0;
+
+ switch (rel) {
+ case REL_POINTER:
+ brace = 1;
+ f_print(fout, "\t{\n");
+ f_print(fout, "\t%s **pp = %s;\n", type, objname);
+ print_ifopen(indent, "pointer");
+ print_ifarg("(char **)");
+ f_print(fout, "pp");
+ print_ifsizeof(0, prefix, type);
+ break;
+ case REL_VECTOR:
+ if (streq(type, "string")) {
+ alt = "string";
+ } else if (streq(type, "opaque")) {
+ alt = "opaque";
+ }
+ if (alt) {
+ print_ifopen(indent, alt);
+ print_ifarg(objname);
+ } else {
+ print_ifopen(indent, "vector");
+ print_ifarg("(char *)");
+ f_print(fout, "%s", objname);
+ }
+ print_ifarg(amax);
+ if (!alt) {
+ print_ifsizeof(indent + 1, prefix, type);
+ }
+ break;
+ case REL_ARRAY:
+ if (streq(type, "string")) {
+ alt = "string";
+ } else if (streq(type, "opaque")) {
+ alt = "bytes";
+ }
+ if (streq(type, "string")) {
+ print_ifopen(indent, alt);
+ print_ifarg(objname);
+ } else {
+ if (alt) {
+ print_ifopen(indent, alt);
+ } else {
+ print_ifopen(indent, "array");
+ }
+ print_ifarg("(char **)");
+ if (*objname == '&') {
+ f_print(fout, "%s.%s_val, (u_int *) %s.%s_len",
+ objname, name, objname, name);
+ } else {
+ f_print(fout,
+ "&%s->%s_val, (u_int *) &%s->%s_len",
+ objname, name, objname, name);
+ }
+ }
+ print_ifarg(amax);
+ if (!alt) {
+ print_ifsizeof(indent + 1, prefix, type);
+ }
+ break;
+ case REL_ALIAS:
+ print_ifopen(indent, type);
+ print_ifarg(objname);
+ break;
+ }
+ print_ifclose(indent, brace);
+}
+
+/* ARGSUSED */
+static void
+emit_enum(definition *def __unused)
+{
+ print_ifopen(1, "enum");
+ print_ifarg("(enum_t *)objp");
+ print_ifclose(1, 0);
+}
+
+static void
+emit_program(definition *def)
+{
+ decl_list *dl;
+ version_list *vlist;
+ proc_list *plist;
+
+ for (vlist = def->def.pr.versions; vlist != NULL; vlist = vlist->next)
+ for (plist = vlist->procs; plist != NULL; plist = plist->next) {
+ if (!newstyle || plist->arg_num < 2)
+ continue; /* old style, or single argument */
+ print_prog_header(plist);
+ for (dl = plist->args.decls; dl != NULL;
+ dl = dl->next)
+ print_stat(1, &dl->decl);
+ print_trailer();
+ }
+}
+
+
+static void
+emit_union(definition *def)
+{
+ declaration *dflt;
+ case_list *cl;
+ declaration *cs;
+ char *object;
+ const char *vecformat = "objp->%s_u.%s";
+ const char *format = "&objp->%s_u.%s";
+
+ print_stat(1, &def->def.un.enum_decl);
+ f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
+ for (cl = def->def.un.cases; cl != NULL; cl = cl->next) {
+
+ f_print(fout, "\tcase %s:\n", cl->case_name);
+ if (cl->contflag == 1) /* a continued case statement */
+ continue;
+ cs = &cl->case_decl;
+ if (!streq(cs->type, "void")) {
+ object = xmalloc(strlen(def->def_name) +
+ strlen(format) + strlen(cs->name) + 1);
+ if (isvectordef (cs->type, cs->rel)) {
+ s_print(object, vecformat, def->def_name,
+ cs->name);
+ } else {
+ s_print(object, format, def->def_name,
+ cs->name);
+ }
+ print_ifstat(2, cs->prefix, cs->type, cs->rel,
+ cs->array_max, object, cs->name);
+ free(object);
+ }
+ f_print(fout, "\t\tbreak;\n");
+ }
+ dflt = def->def.un.default_decl;
+ if (dflt != NULL) {
+ if (!streq(dflt->type, "void")) {
+ f_print(fout, "\tdefault:\n");
+ object = xmalloc(strlen(def->def_name) +
+ strlen(format) + strlen(dflt->name) + 1);
+ if (isvectordef (dflt->type, dflt->rel)) {
+ s_print(object, vecformat, def->def_name,
+ dflt->name);
+ } else {
+ s_print(object, format, def->def_name,
+ dflt->name);
+ }
+
+ print_ifstat(2, dflt->prefix, dflt->type, dflt->rel,
+ dflt->array_max, object, dflt->name);
+ free(object);
+ f_print(fout, "\t\tbreak;\n");
+ } else {
+ f_print(fout, "\tdefault:\n");
+ f_print(fout, "\t\tbreak;\n");
+ }
+ } else {
+ f_print(fout, "\tdefault:\n");
+ f_print(fout, "\t\treturn (FALSE);\n");
+ }
+
+ f_print(fout, "\t}\n");
+}
+
+static void
+inline_struct(definition *def, int flag)
+{
+ decl_list *dl;
+ int i, size;
+ decl_list *cur, *psav;
+ bas_type *ptr;
+ char *sizestr;
+ const char *plus;
+ char ptemp[256];
+ int indent = 1;
+
+ cur = NULL;
+ if (flag == PUT)
+ f_print(fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n");
+ else
+ f_print(fout, "\t\treturn (TRUE);\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
+
+ i = 0;
+ size = 0;
+ sizestr = NULL;
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next) { /* xxx */
+ /* now walk down the list and check for basic types */
+ if ((dl->decl.prefix == NULL) &&
+ ((ptr = find_type(dl->decl.type)) != NULL) &&
+ ((dl->decl.rel == REL_ALIAS) ||
+ (dl->decl.rel == REL_VECTOR))){
+ if (i == 0)
+ cur = dl;
+ i++;
+
+ if (dl->decl.rel == REL_ALIAS)
+ size += ptr->length;
+ else {
+ /* this code is required to handle arrays */
+ if (sizestr == NULL)
+ plus = "";
+ else
+ plus = " + ";
+
+ if (ptr->length != 1)
+ s_print(ptemp, "%s%s * %d",
+ plus, dl->decl.array_max,
+ ptr->length);
+ else
+ s_print(ptemp, "%s%s", plus,
+ dl->decl.array_max);
+
+ /* now concatenate to sizestr !!!! */
+ if (sizestr == NULL) {
+ sizestr = xstrdup(ptemp);
+ }
+ else{
+ sizestr = xrealloc(sizestr,
+ strlen(sizestr)
+ +strlen(ptemp)+1);
+ sizestr = strcat(sizestr, ptemp);
+ /* build up length of array */
+ }
+ }
+ } else {
+ if (i > 0) {
+ if (sizestr == NULL && size < inline_size){
+ /*
+ * don't expand into inline code
+ * if size < inline_size
+ */
+ while (cur != dl){
+ print_stat(indent + 1, &cur->decl);
+ cur = cur->next;
+ }
+ } else {
+ /* were already looking at a xdr_inlineable structure */
+ tabify(fout, indent + 1);
+ if (sizestr == NULL)
+ f_print(fout, "buf = XDR_INLINE(xdrs, %d * BYTES_PER_XDR_UNIT);",
+ size);
+ else {
+ if (size == 0)
+ f_print(fout,
+ "buf = XDR_INLINE(xdrs, (%s) * BYTES_PER_XDR_UNIT);",
+ sizestr);
+ else
+ f_print(fout,
+ "buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
+ size, sizestr);
+
+ }
+ f_print(fout, "\n");
+ tabify(fout, indent + 1);
+ f_print(fout,
+ "if (buf == NULL) {\n");
+
+ psav = cur;
+ while (cur != dl){
+ print_stat(indent + 2, &cur->decl);
+ cur = cur->next;
+ }
+
+ f_print(fout, "\n\t\t} else {\n");
+
+ cur = psav;
+ while (cur != dl){
+ emit_inline(indent + 2, &cur->decl, flag);
+ cur = cur->next;
+ }
+
+ tabify(fout, indent + 1);
+ f_print(fout, "}\n");
+ }
+ }
+ size = 0;
+ i = 0;
+ free(sizestr);
+ sizestr = NULL;
+ print_stat(indent + 1, &dl->decl);
+ }
+ }
+
+ if (i > 0) {
+ if (sizestr == NULL && size < inline_size){
+ /* don't expand into inline code if size < inline_size */
+ while (cur != dl){
+ print_stat(indent + 1, &cur->decl);
+ cur = cur->next;
+ }
+ } else {
+ /* were already looking at a xdr_inlineable structure */
+ if (sizestr == NULL)
+ f_print(fout, "\t\tbuf = XDR_INLINE(xdrs, %d * BYTES_PER_XDR_UNIT);",
+ size);
+ else
+ if (size == 0)
+ f_print(fout,
+ "\t\tbuf = XDR_INLINE(xdrs, (%s) * BYTES_PER_XDR_UNIT);",
+ sizestr);
+ else
+ f_print(fout,
+ "\t\tbuf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
+ size, sizestr);
+
+ f_print(fout, "\n\t\tif (buf == NULL) {\n");
+ psav = cur;
+ while (cur != NULL){
+ print_stat(indent + 2, &cur->decl);
+ cur = cur->next;
+ }
+ f_print(fout, "\t\t} else {\n");
+
+ cur = psav;
+ while (cur != dl){
+ emit_inline(indent + 2, &cur->decl, flag);
+ cur = cur->next;
+ }
+ f_print(fout, "\t\t}\n");
+ }
+ }
+}
+
+static void
+emit_struct(definition *def)
+{
+ decl_list *dl;
+ int j, size, flag;
+ bas_type *ptr;
+ int can_inline;
+
+ if (inline_size == 0) {
+ /* No xdr_inlining at all */
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+ print_stat(1, &dl->decl);
+ return;
+ }
+
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+ if (dl->decl.rel == REL_VECTOR){
+ f_print(fout, "\tint i;\n");
+ break;
+ }
+
+ size = 0;
+ can_inline = 0;
+ /*
+ * Make a first pass and see if inling is possible.
+ */
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+ if ((dl->decl.prefix == NULL) &&
+ ((ptr = find_type(dl->decl.type)) != NULL) &&
+ ((dl->decl.rel == REL_ALIAS)||
+ (dl->decl.rel == REL_VECTOR))){
+ if (dl->decl.rel == REL_ALIAS)
+ size += ptr->length;
+ else {
+ can_inline = 1;
+ break; /* can be inlined */
+ }
+ } else {
+ if (size >= inline_size){
+ can_inline = 1;
+ break; /* can be inlined */
+ }
+ size = 0;
+ }
+ if (size >= inline_size)
+ can_inline = 1;
+
+ if (can_inline == 0){ /* can not inline, drop back to old mode */
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+ print_stat(1, &dl->decl);
+ return;
+ }
+
+ flag = PUT;
+ for (j = 0; j < 2; j++){
+ inline_struct(def, flag);
+ if (flag == PUT)
+ flag = GET;
+ }
+
+ f_print(fout, "\t\treturn (TRUE);\n\t}\n\n");
+
+ /* now take care of XDR_FREE case */
+
+ for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+ print_stat(1, &dl->decl);
+
+}
+
+static void
+emit_typedef(definition *def)
+{
+ const char *prefix = def->def.ty.old_prefix;
+ const char *type = def->def.ty.old_type;
+ const char *amax = def->def.ty.array_max;
+ relation rel = def->def.ty.rel;
+
+ print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name);
+}
+
+static void
+print_stat(int indent, declaration *dec)
+{
+ const char *prefix = dec->prefix;
+ const char *type = dec->type;
+ const char *amax = dec->array_max;
+ relation rel = dec->rel;
+ char name[256];
+
+ if (isvectordef(type, rel)) {
+ s_print(name, "objp->%s", dec->name);
+ } else {
+ s_print(name, "&objp->%s", dec->name);
+ }
+ print_ifstat(indent, prefix, type, rel, amax, name, dec->name);
+}
+
+
+char *upcase(const char *);
+
+static void
+emit_inline(int indent, declaration *decl, int flag)
+{
+ switch (decl->rel) {
+ case REL_ALIAS :
+ emit_single_in_line(indent, decl, flag, REL_ALIAS);
+ break;
+ case REL_VECTOR :
+ tabify(fout, indent);
+ f_print(fout, "{\n");
+ tabify(fout, indent + 1);
+ f_print(fout, "%s *genp;\n\n", decl->type);
+ tabify(fout, indent + 1);
+ f_print(fout,
+ "for (i = 0, genp = objp->%s;\n", decl->name);
+ tabify(fout, indent + 2);
+ f_print(fout, "i < %s; i++) {\n", decl->array_max);
+ emit_single_in_line(indent + 2, decl, flag, REL_VECTOR);
+ tabify(fout, indent + 1);
+ f_print(fout, "}\n");
+ tabify(fout, indent);
+ f_print(fout, "}\n");
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+emit_single_in_line(int indent, declaration *decl, int flag, relation rel)
+{
+ char *upp_case;
+
+ tabify(fout, indent);
+ if (flag == PUT)
+ f_print(fout, "IXDR_PUT_");
+ else
+ if (rel == REL_ALIAS)
+ f_print(fout, "objp->%s = IXDR_GET_", decl->name);
+ else
+ f_print(fout, "*genp++ = IXDR_GET_");
+
+ upp_case = upcase(decl->type);
+
+ /* hack - XX */
+ if (strcmp(upp_case, "INT") == 0)
+ {
+ free(upp_case);
+ upp_case = strdup("LONG");
+ }
+
+ if (strcmp(upp_case, "U_INT") == 0)
+ {
+ free(upp_case);
+ upp_case = strdup("U_LONG");
+ }
+ if (flag == PUT)
+ if (rel == REL_ALIAS)
+ f_print(fout,
+ "%s(buf, objp->%s);\n", upp_case, decl->name);
+ else
+ f_print(fout, "%s(buf, *genp++);\n", upp_case);
+
+ else
+ f_print(fout, "%s(buf);\n", upp_case);
+ free(upp_case);
+}
+
+char *
+upcase(const char *str)
+{
+ char *ptr, *hptr;
+
+ ptr = (char *)xmalloc(strlen(str)+1);
+
+ hptr = ptr;
+ while (*str != '\0')
+ *ptr++ = toupper(*str++);
+
+ *ptr = '\0';
+ return (hptr);
+}
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c
new file mode 100644
index 0000000..6aa6ff7
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_hout.c
@@ -0,0 +1,523 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_hout.c 1.16 94/04/25 SMI"
+static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_hout.c, Header file outputter for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+#include <stdio.h>
+#include <ctype.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+void storexdrfuncdecl(const char *, int );
+static void pconstdef( definition * );
+static void pstructdef( definition * );
+static void puniondef( definition * );
+static void pprogramdef( definition *, int );
+static void penumdef( definition * );
+static void ptypedef( definition * );
+static void pdefine(const char *, const char *);
+static int undefined2(const char *, const char *);
+static void parglist(proc_list *, const char *);
+static void pprocdef(proc_list *, version_list *, const char *, int);
+
+/*
+ * Print the C-version of an xdr definition
+ */
+void
+print_datadef(definition *def, int headeronly)
+{
+
+ if (def->def_kind == DEF_PROGRAM) /* handle data only */
+ return;
+
+ if (def->def_kind != DEF_CONST) {
+ f_print(fout, "\n");
+ }
+ switch (def->def_kind) {
+ case DEF_STRUCT:
+ pstructdef(def);
+ break;
+ case DEF_UNION:
+ puniondef(def);
+ break;
+ case DEF_ENUM:
+ penumdef(def);
+ break;
+ case DEF_TYPEDEF:
+ ptypedef(def);
+ break;
+ case DEF_PROGRAM:
+ pprogramdef(def, headeronly);
+ break;
+ case DEF_CONST:
+ pconstdef(def);
+ break;
+ }
+ if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
+ storexdrfuncdecl(def->def_name,
+ def->def_kind != DEF_TYPEDEF ||
+ !isvectordef(def->def.ty.old_type,
+ def->def.ty.rel));
+ }
+}
+
+
+void
+print_funcdef(definition *def, int headeronly)
+{
+ switch (def->def_kind) {
+ case DEF_PROGRAM:
+ f_print(fout, "\n");
+ pprogramdef(def, headeronly);
+ break;
+ default:
+ break;
+ }
+}
+
+/* store away enough information to allow the XDR functions to be spat
+ out at the end of the file */
+
+void
+storexdrfuncdecl(const char *name, int pointerp)
+{
+ xdrfunc * xdrptr;
+
+ xdrptr = XALLOC(struct xdrfunc);
+
+ xdrptr->name = name;
+ xdrptr->pointerp = pointerp;
+ xdrptr->next = NULL;
+
+ if (xdrfunc_tail == NULL){
+ xdrfunc_head = xdrptr;
+ xdrfunc_tail = xdrptr;
+ } else {
+ xdrfunc_tail->next = xdrptr;
+ xdrfunc_tail = xdrptr;
+ }
+
+
+}
+
+void
+print_xdr_func_def(const char *name, int pointerp)
+{
+ f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name,
+ name, pointerp ? "*" : "");
+}
+
+
+static void
+pconstdef(definition *def)
+{
+ pdefine(def->def_name, def->def.co);
+}
+
+/* print out the definitions for the arguments of functions in the
+ header file
+*/
+static void
+pargdef(definition *def)
+{
+ decl_list *l;
+ version_list *vers;
+ char *name;
+ proc_list *plist;
+
+
+ for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
+ for (plist = vers->procs; plist != NULL;
+ plist = plist->next) {
+
+ if (!newstyle || plist->arg_num < 2) {
+ continue; /* old style or single args */
+ }
+ name = plist->args.argname;
+ f_print(fout, "struct %s {\n", name);
+ for (l = plist->args.decls;
+ l != NULL; l = l->next) {
+ pdeclaration(name, &l->decl, 1,
+ ";\n");
+ }
+ f_print(fout, "};\n");
+ f_print(fout, "typedef struct %s %s;\n",
+ name, name);
+ storexdrfuncdecl(name, 1);
+ f_print(fout, "\n");
+ }
+ }
+}
+
+
+static void
+pstructdef(definition *def)
+{
+ decl_list *l;
+ const char *name = def->def_name;
+
+ f_print(fout, "struct %s {\n", name);
+ for (l = def->def.st.decls; l != NULL; l = l->next) {
+ pdeclaration(name, &l->decl, 1, ";\n");
+ }
+ f_print(fout, "};\n");
+ f_print(fout, "typedef struct %s %s;\n", name, name);
+}
+
+static void
+puniondef(definition *def)
+{
+ case_list *l;
+ const char *name = def->def_name;
+ declaration *decl;
+
+ f_print(fout, "struct %s {\n", name);
+ decl = &def->def.un.enum_decl;
+ if (streq(decl->type, "bool")) {
+ f_print(fout, "\tbool_t %s;\n", decl->name);
+ } else {
+ f_print(fout, "\t%s %s;\n", decl->type, decl->name);
+ }
+ f_print(fout, "\tunion {\n");
+ for (l = def->def.un.cases; l != NULL; l = l->next) {
+ if (l->contflag == 0)
+ pdeclaration(name, &l->case_decl, 2, ";\n");
+ }
+ decl = def->def.un.default_decl;
+ if (decl && !streq(decl->type, "void")) {
+ pdeclaration(name, decl, 2, ";\n");
+ }
+ f_print(fout, "\t} %s_u;\n", name);
+ f_print(fout, "};\n");
+ f_print(fout, "typedef struct %s %s;\n", name, name);
+}
+
+static void
+pdefine(const char *name, const char *num)
+{
+ f_print(fout, "#define\t%s %s\n", name, num);
+}
+
+static void
+puldefine(const char *name, const char *num)
+{
+ f_print(fout, "#define\t%s ((unsigned long)(%s))\n", name, num);
+}
+
+static int
+define_printed(proc_list *stop, version_list *start)
+{
+ version_list *vers;
+ proc_list *proc;
+
+ for (vers = start; vers != NULL; vers = vers->next) {
+ for (proc = vers->procs; proc != NULL; proc = proc->next) {
+ if (proc == stop) {
+ return (0);
+ } else if (streq(proc->proc_name, stop->proc_name)) {
+ return (1);
+ }
+ }
+ }
+ abort();
+ /* NOTREACHED */
+}
+
+static void
+pfreeprocdef(const char * name, const char *vers)
+{
+ f_print(fout, "extern int ");
+ pvname(name, vers);
+ f_print(fout, "_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n");
+}
+
+static void
+pdispatch(const char * name, const char *vers)
+{
+
+ f_print(fout, "void ");
+ pvname(name, vers);
+ f_print(fout, "(struct svc_req *rqstp, SVCXPRT *transp);\n");
+}
+
+static void
+pprogramdef(definition *def, int headeronly)
+{
+ version_list *vers;
+ proc_list *proc;
+ const char *ext;
+
+ pargdef(def);
+
+ puldefine(def->def_name, def->def.pr.prog_num);
+ for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
+ if (tblflag) {
+ f_print(fout,
+ "extern struct rpcgen_table %s_%s_table[];\n",
+ locase(def->def_name), vers->vers_num);
+ f_print(fout,
+ "extern %s_%s_nproc;\n",
+ locase(def->def_name), vers->vers_num);
+ }
+ puldefine(vers->vers_name, vers->vers_num);
+
+ f_print(fout, "\n");
+ ext = "extern ";
+ if (headeronly) {
+ f_print(fout, "%s", ext);
+ pdispatch(def->def_name, vers->vers_num);
+ }
+ for (proc = vers->procs; proc != NULL; proc = proc->next) {
+ if (!define_printed(proc, def->def.pr.versions)) {
+ puldefine(proc->proc_name, proc->proc_num);
+ }
+ f_print(fout, "%s", ext);
+ pprocdef(proc, vers, "CLIENT *", 0);
+ f_print(fout, "%s", ext);
+ pprocdef(proc, vers, "struct svc_req *", 1);
+ }
+ pfreeprocdef(def->def_name, vers->vers_num);
+ }
+}
+
+static void
+pprocdef(proc_list *proc, version_list *vp, const char *addargtype, int server_p)
+{
+ if (mtflag) {/* Print MT style stubs */
+ if (server_p)
+ f_print(fout, "bool_t ");
+ else
+ f_print(fout, "enum clnt_stat ");
+ } else {
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "* ");
+ }
+ if (server_p)
+ pvname_svc(proc->proc_name, vp->vers_num);
+ else
+ pvname(proc->proc_name, vp->vers_num);
+
+ parglist(proc, addargtype);
+}
+
+
+
+/* print out argument list of procedure */
+static void
+parglist(proc_list *proc, const char *addargtype)
+{
+ decl_list *dl;
+
+ f_print(fout, "(");
+ if (proc->arg_num < 2 && newstyle &&
+ streq(proc->args.decls->decl.type, "void")) {
+ /* 0 argument in new style: do nothing*/
+ }
+ else {
+ for (dl = proc->args.decls; dl != NULL; dl = dl->next) {
+ ptype(dl->decl.prefix, dl->decl.type, 1);
+ if (!newstyle)
+ f_print(fout, "*");
+ /* old style passes by reference */
+ f_print(fout, ", ");
+ }
+ }
+
+ if (mtflag) {
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*, ");
+ }
+
+ f_print(fout, "%s);\n", addargtype);
+
+}
+
+static void
+penumdef(definition *def)
+{
+ const char *name = def->def_name;
+ enumval_list *l;
+ const char *last = NULL;
+ int count = 0;
+
+ f_print(fout, "enum %s {\n", name);
+ for (l = def->def.en.vals; l != NULL; l = l->next) {
+ f_print(fout, "\t%s", l->name);
+ if (l->assignment) {
+ f_print(fout, " = %s", l->assignment);
+ last = l->assignment;
+ count = 1;
+ } else {
+ if (last == NULL) {
+ f_print(fout, " = %d", count++);
+ } else {
+ f_print(fout, " = %s + %d", last, count++);
+ }
+ }
+ if (l->next)
+ f_print(fout, ",\n");
+ else
+ f_print(fout, "\n");
+ }
+ f_print(fout, "};\n");
+ f_print(fout, "typedef enum %s %s;\n", name, name);
+}
+
+static void
+ptypedef(definition *def)
+{
+ const char *name = def->def_name;
+ const char *old = def->def.ty.old_type;
+ char prefix[8]; /* enough to contain "struct ", including NUL */
+ relation rel = def->def.ty.rel;
+
+
+ if (!streq(name, old)) {
+ if (streq(old, "string")) {
+ old = "char";
+ rel = REL_POINTER;
+ } else if (streq(old, "opaque")) {
+ old = "char";
+ } else if (streq(old, "bool")) {
+ old = "bool_t";
+ }
+ if (undefined2(old, name) && def->def.ty.old_prefix) {
+ s_print(prefix, "%s ", def->def.ty.old_prefix);
+ } else {
+ prefix[0] = 0;
+ }
+ f_print(fout, "typedef ");
+ switch (rel) {
+ case REL_ARRAY:
+ f_print(fout, "struct {\n");
+ f_print(fout, "\tu_int %s_len;\n", name);
+ f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
+ f_print(fout, "} %s", name);
+ break;
+ case REL_POINTER:
+ f_print(fout, "%s%s *%s", prefix, old, name);
+ break;
+ case REL_VECTOR:
+ f_print(fout, "%s%s %s[%s]", prefix, old, name,
+ def->def.ty.array_max);
+ break;
+ case REL_ALIAS:
+ f_print(fout, "%s%s %s", prefix, old, name);
+ break;
+ }
+ f_print(fout, ";\n");
+ }
+}
+
+void
+pdeclaration(const char *name, declaration *dec, int tab, const char *separator)
+{
+ char buf[8]; /* enough to hold "struct ", include NUL */
+ const char *prefix;
+ const char *type;
+
+ if (streq(dec->type, "void")) {
+ return;
+ }
+ tabify(fout, tab);
+ if (streq(dec->type, name) && !dec->prefix) {
+ f_print(fout, "struct ");
+ }
+ if (streq(dec->type, "string")) {
+ f_print(fout, "char *%s", dec->name);
+ } else {
+ prefix = "";
+ if (streq(dec->type, "bool")) {
+ type = "bool_t";
+ } else if (streq(dec->type, "opaque")) {
+ type = "char";
+ } else {
+ if (dec->prefix) {
+ s_print(buf, "%s ", dec->prefix);
+ prefix = buf;
+ }
+ type = dec->type;
+ }
+ switch (dec->rel) {
+ case REL_ALIAS:
+ f_print(fout, "%s%s %s", prefix, type, dec->name);
+ break;
+ case REL_VECTOR:
+ f_print(fout, "%s%s %s[%s]", prefix, type, dec->name,
+ dec->array_max);
+ break;
+ case REL_POINTER:
+ f_print(fout, "%s%s *%s", prefix, type, dec->name);
+ break;
+ case REL_ARRAY:
+ f_print(fout, "struct {\n");
+ tabify(fout, tab);
+ f_print(fout, "\tu_int %s_len;\n", dec->name);
+ tabify(fout, tab);
+ f_print(fout,
+ "\t%s%s *%s_val;\n", prefix, type, dec->name);
+ tabify(fout, tab);
+ f_print(fout, "} %s", dec->name);
+ break;
+ }
+ }
+ fputs(separator, fout);
+}
+
+static int
+undefined2(const char *type, const char *stop)
+{
+ list *l;
+ definition *def;
+
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ if (streq(def->def_name, stop)) {
+ return (1);
+ } else if (streq(def->def_name, type)) {
+ return (0);
+ }
+ }
+ }
+ return (1);
+}
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
new file mode 100644
index 0000000..32e47a0
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -0,0 +1,1267 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_main.c 1.21 94/04/25 SMI"
+static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_main.c, Top level of the RPC protocol compiler.
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+
+#include <err.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+static void c_output(const char *, const char *, int, const char *);
+static void h_output(const char *, const char *, int, const char *, int);
+static void l_output(const char *, const char *, int, const char *);
+static void t_output(const char *, const char *, int, const char *);
+static void clnt_output(const char *, const char *, int, const char * );
+static char *generate_guard(const char *);
+static void c_initialize(void);
+
+static void usage(void);
+static void options_usage(void);
+static int do_registers(int, const char **);
+static int parseargs(int, const char **, struct commandline *);
+static void svc_output(const char *, const char *, int, const char *);
+static void mkfile_output(struct commandline *);
+static void s_output(int, const char **, const char *, const char *, int, const char *, int, int);
+
+#define EXTEND 1 /* alias for TRUE */
+#define DONT_EXTEND 0 /* alias for FALSE */
+
+static const char *svcclosetime = "120";
+static const char *CPP = NULL;
+static const char CPPFLAGS[] = "-C";
+static char pathbuf[MAXPATHLEN + 1];
+static const char *allv[] = {
+ "rpcgen", "-s", "udp", "-s", "tcp",
+};
+static int allc = sizeof (allv)/sizeof (allv[0]);
+static const char *allnv[] = {
+ "rpcgen", "-s", "netpath",
+};
+static int allnc = sizeof (allnv)/sizeof (allnv[0]);
+
+/*
+ * machinations for handling expanding argument list
+ */
+static void addarg(const char *); /* add another argument to the list */
+static void insarg(int, const char *); /* insert arg at specified location */
+static void clear_args(void); /* clear argument list */
+static void checkfiles(const char *, const char *);
+ /* check if out file already exists */
+
+
+
+#define ARGLISTLEN 20
+#define FIXEDARGS 0
+
+static char *arglist[ARGLISTLEN];
+static int argcount = FIXEDARGS;
+
+
+int nonfatalerrors; /* errors */
+int inetdflag = 0; /* Support for inetd is disabled by default, use -I */
+int pmflag = 0; /* Support for port monitors is disabled by default */
+int tirpc_socket = 1; /* TI-RPC on socket, no TLI library */
+int logflag; /* Use syslog instead of fprintf for errors */
+int tblflag; /* Support for dispatch table file */
+int mtflag = 0; /* Support for MT */
+
+#define INLINE 0
+/* length at which to start doing an inline */
+
+int inline_size = INLINE;
+/*
+ * Length at which to start doing an inline. INLINE = default
+ * if 0, no xdr_inline code
+ */
+
+int indefinitewait; /* If started by port monitors, hang till it wants */
+int exitnow; /* If started by port monitors, exit after the call */
+int timerflag; /* TRUE if !indefinite && !exitnow */
+int newstyle; /* newstyle of passing arguments (by value) */
+int CCflag = 0; /* C++ files */
+static int allfiles; /* generate all files */
+int tirpcflag = 1; /* generating code for tirpc, by default */
+xdrfunc *xdrfunc_head = NULL; /* xdr function list */
+xdrfunc *xdrfunc_tail = NULL; /* xdr function list */
+pid_t childpid;
+
+
+int
+main(int argc, const char *argv[])
+{
+ struct commandline cmd;
+
+ (void) memset((char *)&cmd, 0, sizeof (struct commandline));
+ clear_args();
+ if (!parseargs(argc, argv, &cmd))
+ usage();
+ /*
+ * Only the client and server side stubs are likely to be customized,
+ * so in that case only, check if the outfile exists, and if so,
+ * print an error message and exit.
+ */
+ if (cmd.Ssflag || cmd.Scflag || cmd.makefileflag) {
+ checkfiles(cmd.infile, cmd.outfile);
+ }
+ else
+ checkfiles(cmd.infile, NULL);
+
+ if (cmd.cflag) {
+ c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile);
+ } else if (cmd.hflag) {
+ h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile,
+ cmd.hflag);
+ } else if (cmd.lflag) {
+ l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile);
+ } else if (cmd.sflag || cmd.mflag || (cmd.nflag)) {
+ s_output(argc, argv, cmd.infile, "-DRPC_SVC", DONT_EXTEND,
+ cmd.outfile, cmd.mflag, cmd.nflag);
+ } else if (cmd.tflag) {
+ t_output(cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile);
+ } else if (cmd.Ssflag) {
+ svc_output(cmd.infile, "-DRPC_SERVER", DONT_EXTEND,
+ cmd.outfile);
+ } else if (cmd.Scflag) {
+ clnt_output(cmd.infile, "-DRPC_CLIENT", DONT_EXTEND,
+ cmd.outfile);
+ } else if (cmd.makefileflag) {
+ mkfile_output(&cmd);
+ } else {
+ /* the rescans are required, since cpp may effect input */
+ c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
+ reinitialize();
+ h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h", cmd.hflag);
+ reinitialize();
+ l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
+ reinitialize();
+ if (inetdflag || !tirpcflag)
+ s_output(allc, allv, cmd.infile, "-DRPC_SVC", EXTEND,
+ "_svc.c", cmd.mflag, cmd.nflag);
+ else
+ s_output(allnc, allnv, cmd.infile, "-DRPC_SVC",
+ EXTEND, "_svc.c", cmd.mflag, cmd.nflag);
+ if (tblflag) {
+ reinitialize();
+ t_output(cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.i");
+ }
+
+ if (allfiles) {
+ reinitialize();
+ svc_output(cmd.infile, "-DRPC_SERVER", EXTEND,
+ "_server.c");
+ reinitialize();
+ clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND,
+ "_client.c");
+
+ }
+ if (allfiles || (cmd.makefileflag == 1)){
+ reinitialize();
+ mkfile_output(&cmd);
+ }
+
+ }
+ exit(nonfatalerrors);
+ /* NOTREACHED */
+}
+
+
+/*
+ * add extension to filename
+ */
+static char *
+extendfile(const char *path, const char *ext)
+{
+ char *res;
+ const char *p;
+ const char *file;
+
+ if ((file = strrchr(path, '/')) == NULL)
+ file = path;
+ else
+ file++;
+ res = xmalloc(strlen(file) + strlen(ext) + 1);
+ p = strrchr(file, '.');
+ if (p == NULL) {
+ p = file + strlen(file);
+ }
+ (void) strcpy(res, file);
+ (void) strcpy(res + (p - file), ext);
+ return (res);
+}
+
+/*
+ * Open output file with given extension
+ */
+static void
+open_output(const char *infile, const char *outfile)
+{
+
+ if (outfile == NULL) {
+ fout = stdout;
+ return;
+ }
+
+ if (infile != NULL && streq(outfile, infile)) {
+ warnx("%s already exists. No output generated", infile);
+ crash();
+ }
+ fout = fopen(outfile, "w");
+ if (fout == NULL) {
+ warn("unable to open %s", outfile);
+ crash();
+ }
+ record_open(outfile);
+
+ return;
+}
+
+static void
+add_warning(void)
+{
+ f_print(fout, "/*\n");
+ f_print(fout, " * Please do not edit this file.\n");
+ f_print(fout, " * It was generated using rpcgen.\n");
+ f_print(fout, " */\n\n");
+}
+
+/* clear list of arguments */
+static void
+clear_args(void)
+{
+ int i;
+ for (i = FIXEDARGS; i < ARGLISTLEN; i++)
+ arglist[i] = NULL;
+ argcount = FIXEDARGS;
+}
+
+/* prepend C-preprocessor and flags before arguments */
+static void
+prepend_cpp(void)
+{
+ int idx = 1;
+ const char *var;
+ char *dupvar, *s, *t;
+
+ if (CPP != NULL)
+ insarg(0, CPP);
+ else if ((var = getenv("RPCGEN_CPP")) == NULL)
+ insarg(0, "/usr/bin/cpp");
+ else {
+ /* Parse command line in a rudimentary way */
+ dupvar = xstrdup(var);
+ for (s = dupvar, idx = 0; (t = strsep(&s, " \t")) != NULL; ) {
+ if (t[0])
+ insarg(idx++, t);
+ }
+ free(dupvar);
+ }
+
+ insarg(idx, CPPFLAGS);
+}
+
+/*
+ * Open input file with given define for C-preprocessor
+ */
+static void
+open_input(const char *infile, const char *define)
+{
+ int pd[2];
+
+ infilename = (infile == NULL) ? "<stdin>" : infile;
+ (void) pipe(pd);
+ switch (childpid = fork()) {
+ case 0:
+ prepend_cpp();
+ addarg(define);
+ if (infile)
+ addarg(infile);
+ addarg((char *)NULL);
+ (void) close(1);
+ (void) dup2(pd[1], 1);
+ (void) close(pd[0]);
+ execvp(arglist[0], arglist);
+ err(1, "execvp %s", arglist[0]);
+ case -1:
+ err(1, "fork");
+ }
+ (void) close(pd[1]);
+ fin = fdopen(pd[0], "r");
+ if (fin == NULL) {
+ warn("%s", infilename);
+ crash();
+ }
+}
+
+/* valid tirpc nettypes */
+static const char *valid_ti_nettypes[] =
+{
+ "netpath",
+ "visible",
+ "circuit_v",
+ "datagram_v",
+ "circuit_n",
+ "datagram_n",
+ "udp",
+ "tcp",
+ "raw",
+ NULL
+ };
+
+/* valid inetd nettypes */
+static const char *valid_i_nettypes[] =
+{
+ "udp",
+ "tcp",
+ NULL
+ };
+
+static int
+check_nettype(const char *name, const char *list_to_check[])
+{
+ int i;
+ for (i = 0; list_to_check[i] != NULL; i++) {
+ if (strcmp(name, list_to_check[i]) == 0) {
+ return (1);
+ }
+ }
+ warnx("illegal nettype :\'%s\'", name);
+ return (0);
+}
+
+static const char *
+file_name(const char *file, const char *ext)
+{
+ char *temp;
+ temp = extendfile(file, ext);
+
+ if (access(temp, F_OK) != -1)
+ return (temp);
+ else
+ return (" ");
+
+}
+
+
+static void
+c_output(const char *infile, const char *define, int extend, const char *outfile)
+{
+ definition *def;
+ char *include;
+ const char *outfilename;
+ long tell;
+
+ c_initialize();
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ open_output(infile, outfilename);
+ add_warning();
+ if (infile && (include = extendfile(infile, ".h"))) {
+ f_print(fout, "#include \"%s\"\n", include);
+ free(include);
+ /* .h file already contains rpc/rpc.h */
+ } else
+ f_print(fout, "#include <rpc/rpc.h>\n");
+ tell = ftell(fout);
+ while ( (def = get_definition()) ) {
+ emit(def);
+ }
+ if (extend && tell == ftell(fout)) {
+ (void) unlink(outfilename);
+ }
+}
+
+
+void
+c_initialize(void)
+{
+
+ /* add all the starting basic types */
+ add_type(1, "int");
+ add_type(1, "long");
+ add_type(1, "short");
+ add_type(1, "bool");
+ add_type(1, "u_int");
+ add_type(1, "u_long");
+ add_type(1, "u_short");
+
+}
+
+static const char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
+ char *(*proc)(); \n\
+ xdrproc_t xdr_arg; \n\
+ unsigned len_arg; \n\
+ xdrproc_t xdr_res; \n\
+ unsigned len_res; \n\
+}; \n";
+
+
+char *
+generate_guard(const char *pathname)
+{
+ const char *filename;
+ char *guard, *tmp, *stopat;
+
+ filename = strrchr(pathname, '/'); /* find last component */
+ filename = ((filename == NULL) ? pathname : filename+1);
+ guard = xstrdup(filename);
+ stopat = strrchr(guard, '.');
+
+ /*
+ * Convert to a valid C macro name and make it upper case.
+ * Map macro unfriendly characterss to '_'.
+ */
+ for (tmp = guard; *tmp != '\000'; ++tmp) {
+ if (islower(*tmp))
+ *tmp = toupper(*tmp);
+ else if (isupper(*tmp) || *tmp == '_')
+ /* OK for C */;
+ else if (tmp == guard)
+ *tmp = '_';
+ else if (isdigit(*tmp))
+ /* OK for all but first character */;
+ else if (tmp == stopat) {
+ *tmp = '\0';
+ break;
+ } else
+ *tmp = '_';
+ }
+ /*
+ * Can't have a '_' in front, because it'll end up being "__".
+ * "__" macros shoudln't be used. So, remove all of the
+ * '_' characters from the front.
+ */
+ if (*guard == '_') {
+ for (tmp = guard; *tmp == '_'; ++tmp)
+ ;
+ strcpy(guard, tmp);
+ }
+ guard = extendfile(guard, "_H_RPCGEN");
+ return (guard);
+}
+
+/*
+ * Compile into an XDR header file
+ */
+
+
+static void
+h_output(const char *infile, const char *define, int extend, const char *outfile, int headeronly)
+{
+ definition *def;
+ const char *outfilename;
+ long tell;
+ const char *guard;
+ list *l;
+ xdrfunc *xdrfuncp;
+
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ open_output(infile, outfilename);
+ add_warning();
+ if (outfilename || infile){
+ guard = generate_guard(outfilename ? outfilename: infile);
+ } else
+ guard = "STDIN_";
+
+ f_print(fout, "#ifndef _%s\n#define _%s\n\n", guard,
+ guard);
+
+ f_print(fout, "#include <rpc/rpc.h>\n");
+
+ if (mtflag)
+ f_print(fout, "#include <pthread.h>\n");
+
+ /* put the C++ support */
+ if (!CCflag) {
+ f_print(fout, "\n#ifdef __cplusplus\n");
+ f_print(fout, "extern \"C\" {\n");
+ f_print(fout, "#endif\n\n");
+ }
+
+ /* put in a typedef for quadprecision. Only with Cflag */
+
+ tell = ftell(fout);
+
+ /* print data definitions */
+ while ( (def = get_definition()) ) {
+ print_datadef(def, headeronly);
+ }
+
+ /*
+ * print function declarations.
+ * Do this after data definitions because they might be used as
+ * arguments for functions
+ */
+ for (l = defined; l != NULL; l = l->next) {
+ print_funcdef(l->val, headeronly);
+ }
+ /* Now print all xdr func declarations */
+ if (xdrfunc_head != NULL){
+
+ f_print(fout,
+ "\n/* the xdr functions */\n");
+
+ if (CCflag){
+ f_print(fout, "\n#ifdef __cplusplus\n");
+ f_print(fout, "extern \"C\" {\n");
+ f_print(fout, "#endif\n");
+ }
+
+ xdrfuncp = xdrfunc_head;
+ while (xdrfuncp != NULL){
+ print_xdr_func_def(xdrfuncp->name, xdrfuncp->pointerp);
+ xdrfuncp = xdrfuncp->next;
+ }
+ }
+
+ if (extend && tell == ftell(fout)) {
+ (void) unlink(outfilename);
+ } else if (tblflag) {
+ f_print(fout, rpcgen_table_dcl);
+ }
+
+ f_print(fout, "\n#ifdef __cplusplus\n");
+ f_print(fout, "}\n");
+ f_print(fout, "#endif\n");
+
+ f_print(fout, "\n#endif /* !_%s */\n", guard);
+}
+
+/*
+ * Compile into an RPC service
+ */
+static void
+s_output(int argc, const char *argv[], const char *infile, const char *define,
+ int extend, const char *outfile, int nomain, int netflag)
+{
+ char *include;
+ definition *def;
+ int foundprogram = 0;
+ const char *outfilename;
+
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ open_output(infile, outfilename);
+ add_warning();
+ if (infile && (include = extendfile(infile, ".h"))) {
+ f_print(fout, "#include \"%s\"\n", include);
+ free(include);
+ } else
+ f_print(fout, "#include <rpc/rpc.h>\n");
+
+ f_print(fout, "#include <stdio.h>\n");
+ f_print(fout, "#include <stdlib.h> /* getenv, exit */\n");
+ f_print (fout, "#include <rpc/pmap_clnt.h> /* for pmap_unset */\n");
+ f_print (fout, "#include <string.h> /* strcmp */\n");
+ if (tirpcflag)
+ f_print(fout, "#include <rpc/rpc_com.h>\n");
+ if (strcmp(svcclosetime, "-1") == 0)
+ indefinitewait = 1;
+ else if (strcmp(svcclosetime, "0") == 0)
+ exitnow = 1;
+ else if (inetdflag || pmflag) {
+ f_print(fout, "#include <signal.h>\n");
+ timerflag = 1;
+ }
+
+ if (!tirpcflag && inetdflag)
+ f_print(fout, "#include <sys/ttycom.h> /* TIOCNOTTY */\n");
+ if (inetdflag || pmflag) {
+ f_print(fout, "#ifdef __cplusplus\n");
+ f_print(fout,
+ "#include <sys/sysent.h> /* getdtablesize, open */\n");
+ f_print(fout, "#endif /* __cplusplus */\n");
+ }
+ if (tirpcflag) {
+ f_print(fout, "#include <fcntl.h> /* open */\n");
+ f_print(fout, "#include <unistd.h> /* fork / setsid */\n");
+ f_print(fout, "#include <sys/types.h>\n");
+ }
+
+ f_print(fout, "#include <string.h>\n");
+ if (inetdflag || !tirpcflag) {
+ f_print(fout, "#include <sys/socket.h>\n");
+ f_print(fout, "#include <netinet/in.h>\n");
+ }
+
+ if ((netflag || pmflag) && tirpcflag && !nomain) {
+ f_print(fout, "#include <netconfig.h>\n");
+ }
+ if (tirpcflag)
+ f_print(fout, "#include <sys/resource.h> /* rlimit */\n");
+ if (logflag || inetdflag || pmflag || tirpcflag)
+ f_print(fout, "#include <syslog.h>\n");
+
+ f_print(fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
+ if (timerflag)
+ f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n",
+ svcclosetime);
+ while ( (def = get_definition()) ) {
+ foundprogram |= (def->def_kind == DEF_PROGRAM);
+ }
+ if (extend && !foundprogram) {
+ (void) unlink(outfilename);
+ return;
+ }
+ write_most(infile, netflag, nomain);
+ if (!nomain) {
+ if (!do_registers(argc, argv)) {
+ if (outfilename)
+ (void) unlink(outfilename);
+ usage();
+ }
+ write_rest();
+ }
+}
+
+/*
+ * generate client side stubs
+ */
+static void
+l_output(const char *infile, const char *define, int extend, const char *outfile)
+{
+ char *include;
+ definition *def;
+ int foundprogram = 0;
+ const char *outfilename;
+
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ open_output(infile, outfilename);
+ add_warning();
+ f_print (fout, "#include <string.h> /* for memset */\n");
+ if (infile && (include = extendfile(infile, ".h"))) {
+ f_print(fout, "#include \"%s\"\n", include);
+ free(include);
+ } else
+ f_print(fout, "#include <rpc/rpc.h>\n");
+ while ( (def = get_definition()) ) {
+ foundprogram |= (def->def_kind == DEF_PROGRAM);
+ }
+ if (extend && !foundprogram) {
+ (void) unlink(outfilename);
+ return;
+ }
+ write_stubs();
+}
+
+/*
+ * generate the dispatch table
+ */
+static void
+t_output(const char *infile, const char *define, int extend, const char *outfile)
+{
+ definition *def;
+ int foundprogram = 0;
+ const char *outfilename;
+
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ open_output(infile, outfilename);
+ add_warning();
+ while ( (def = get_definition()) ) {
+ foundprogram |= (def->def_kind == DEF_PROGRAM);
+ }
+ if (extend && !foundprogram) {
+ (void) unlink(outfilename);
+ return;
+ }
+ write_tables();
+}
+
+/* sample routine for the server template */
+static void
+svc_output(const char *infile, const char *define, int extend, const char *outfile)
+{
+ definition *def;
+ char *include;
+ const char *outfilename;
+ long tell;
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ checkfiles(infile, outfilename);
+ /*
+ * Check if outfile already exists.
+ * if so, print an error message and exit
+ */
+ open_output(infile, outfilename);
+ add_sample_msg();
+
+ if (infile && (include = extendfile(infile, ".h"))) {
+ f_print(fout, "#include \"%s\"\n", include);
+ free(include);
+ } else
+ f_print(fout, "#include <rpc/rpc.h>\n");
+
+ tell = ftell(fout);
+ while ( (def = get_definition()) ) {
+ write_sample_svc(def);
+ }
+ if (extend && tell == ftell(fout)) {
+ (void) unlink(outfilename);
+ }
+}
+
+/* sample main routine for client */
+static void
+clnt_output(const char *infile, const char *define, int extend, const char *outfile)
+{
+ definition *def;
+ char *include;
+ const char *outfilename;
+ long tell;
+ int has_program = 0;
+
+ open_input(infile, define);
+ outfilename = extend ? extendfile(infile, outfile) : outfile;
+ checkfiles(infile, outfilename);
+ /*
+ * Check if outfile already exists.
+ * if so, print an error message and exit
+ */
+
+ open_output(infile, outfilename);
+ add_sample_msg();
+ if (infile && (include = extendfile(infile, ".h"))) {
+ f_print(fout, "#include \"%s\"\n", include);
+ free(include);
+ } else
+ f_print(fout, "#include <rpc/rpc.h>\n");
+ f_print(fout, "#include <stdio.h>\n");
+ f_print(fout, "#include <stdlib.h>\n");
+ tell = ftell(fout);
+ while ( (def = get_definition()) ) {
+ has_program += write_sample_clnt(def);
+ }
+
+ if (has_program)
+ write_sample_clnt_main();
+
+ if (extend && tell == ftell(fout)) {
+ (void) unlink(outfilename);
+ }
+}
+
+
+static void mkfile_output(struct commandline *cmd)
+{
+ const char *mkfilename, *clientname, *clntname, *xdrname, *hdrname;
+ const char *servername, *svcname, *servprogname, *clntprogname;
+ char *temp, *mkftemp;
+
+ svcname = file_name(cmd->infile, "_svc.c");
+ clntname = file_name(cmd->infile, "_clnt.c");
+ xdrname = file_name(cmd->infile, "_xdr.c");
+ hdrname = file_name(cmd->infile, ".h");
+
+
+ if (allfiles){
+ servername = extendfile(cmd->infile, "_server.c");
+ clientname = extendfile(cmd->infile, "_client.c");
+ }else{
+ servername = " ";
+ clientname = " ";
+ }
+ servprogname = extendfile(cmd->infile, "_server");
+ clntprogname = extendfile(cmd->infile, "_client");
+
+ if (allfiles){
+ mkftemp = xmalloc(strlen("makefile.") +
+ strlen(cmd->infile) + 1);
+ temp = strrchr(cmd->infile, '.');
+ strcpy(mkftemp, "makefile.");
+ (void) strncat(mkftemp, cmd->infile,
+ (temp - cmd->infile));
+ mkfilename = mkftemp;
+ } else
+ mkfilename = cmd->outfile;
+
+
+ checkfiles(NULL, mkfilename);
+ open_output(NULL, mkfilename);
+
+ f_print(fout, "\n# This is a template makefile generated\
+ by rpcgen \n");
+
+ f_print(fout, "\n# Parameters \n\n");
+
+ f_print(fout, "CLIENT = %s\nSERVER = %s\n\n",
+ clntprogname, servprogname);
+ f_print(fout, "SOURCES_CLNT.c = \nSOURCES_CLNT.h = \n");
+ f_print(fout, "SOURCES_SVC.c = \nSOURCES_SVC.h = \n");
+ f_print(fout, "SOURCES.x = %s\n\n", cmd->infile);
+ f_print(fout, "TARGETS_SVC.c = %s %s %s \n",
+ svcname, servername, xdrname);
+ f_print(fout, "TARGETS_CLNT.c = %s %s %s \n",
+ clntname, clientname, xdrname);
+ f_print(fout, "TARGETS = %s %s %s %s %s %s\n\n",
+ hdrname, xdrname, clntname,
+ svcname, clientname, servername);
+
+ f_print(fout, "OBJECTS_CLNT = $(SOURCES_CLNT.c:%%.c=%%.o) \
+$(TARGETS_CLNT.c:%%.c=%%.o) ");
+
+ f_print(fout, "\nOBJECTS_SVC = $(SOURCES_SVC.c:%%.c=%%.o) \
+$(TARGETS_SVC.c:%%.c=%%.o) ");
+
+
+ f_print(fout, "\n# Compiler flags \n");
+ if (mtflag)
+ f_print(fout, "\nCFLAGS += -D_REENTRANT -D_THEAD_SAFE \nLDLIBS += -pthread\n");
+
+ f_print(fout, "RPCGENFLAGS = \n");
+
+ f_print(fout, "\n# Targets \n\n");
+
+ f_print(fout, "all : $(CLIENT) $(SERVER)\n\n");
+ f_print(fout, "$(TARGETS) : $(SOURCES.x) \n");
+ f_print(fout, "\trpcgen $(RPCGENFLAGS) $(SOURCES.x)\n\n");
+ if (allfiles) {
+ f_print(fout, "\trpcgen -Sc $(RPCGENFLAGS) $(SOURCES.x) -o %s\n\n", clientname);
+ f_print(fout, "\trpcgen -Ss $(RPCGENFLAGS) $(SOURCES.x) -o %s\n\n", servername);
+ }
+ f_print(fout, "$(OBJECTS_CLNT) : $(SOURCES_CLNT.c) $(SOURCES_CLNT.h) \
+$(TARGETS_CLNT.c) \n\n");
+
+ f_print(fout, "$(OBJECTS_SVC) : $(SOURCES_SVC.c) $(SOURCES_SVC.h) \
+$(TARGETS_SVC.c) \n\n");
+ f_print(fout, "$(CLIENT) : $(OBJECTS_CLNT) \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) \
+$(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
+}
+
+
+
+/*
+ * Perform registrations for service output
+ * Return 0 if failed; 1 otherwise.
+ */
+static int
+do_registers(int argc, const char *argv[])
+{
+ int i;
+
+ if (inetdflag || !tirpcflag) {
+ for (i = 1; i < argc; i++) {
+ if (streq(argv[i], "-s")) {
+ if (!check_nettype(argv[i + 1],
+ valid_i_nettypes))
+ return (0);
+ write_inetd_register(argv[i + 1]);
+ i++;
+ }
+ }
+ } else {
+ for (i = 1; i < argc; i++)
+ if (streq(argv[i], "-s")) {
+ if (!check_nettype(argv[i + 1],
+ valid_ti_nettypes))
+ return (0);
+ write_nettype_register(argv[i + 1]);
+ i++;
+ } else if (streq(argv[i], "-n")) {
+ write_netid_register(argv[i + 1]);
+ i++;
+ }
+ }
+ return (1);
+}
+
+/*
+ * Add another argument to the arg list
+ */
+static void
+addarg(const char *cp)
+{
+ if (argcount >= ARGLISTLEN) {
+ warnx("too many defines");
+ crash();
+ /*NOTREACHED*/
+ }
+ if (cp != NULL)
+ arglist[argcount++] = xstrdup(cp);
+ else
+ arglist[argcount++] = NULL;
+
+}
+
+/*
+ * Insert an argument at the specified location
+ */
+static void
+insarg(int place, const char *cp)
+{
+ int i;
+
+ if (argcount >= ARGLISTLEN) {
+ warnx("too many defines");
+ crash();
+ /*NOTREACHED*/
+ }
+
+ /* Move up existing arguments */
+ for (i = argcount - 1; i >= place; i--)
+ arglist[i + 1] = arglist[i];
+
+ arglist[place] = xstrdup(cp);
+ argcount++;
+}
+
+/*
+ * if input file is stdin and an output file is specified then complain
+ * if the file already exists. Otherwise the file may get overwritten
+ * If input file does not exist, exit with an error
+ */
+
+static void
+checkfiles(const char *infile, const char *outfile)
+{
+
+ struct stat buf;
+
+ if (infile) /* infile ! = NULL */
+ if (stat(infile, &buf) < 0)
+ {
+ warn("%s", infile);
+ crash();
+ }
+ if (outfile) {
+ if (stat(outfile, &buf) < 0)
+ return; /* file does not exist */
+ else {
+ warnx("file '%s' already exists and may be overwritten", outfile);
+ crash();
+ }
+ }
+}
+
+/*
+ * Parse command line arguments
+ */
+static int
+parseargs(int argc, const char *argv[], struct commandline *cmd)
+{
+ int i;
+ int j;
+ char c, ch;
+ char flag[(1 << 8 * sizeof (char))];
+ int nflags;
+
+ cmd->infile = cmd->outfile = NULL;
+ if (argc < 2) {
+ return (0);
+ }
+ allfiles = 0;
+ flag['c'] = 0;
+ flag['h'] = 0;
+ flag['l'] = 0;
+ flag['m'] = 0;
+ flag['o'] = 0;
+ flag['s'] = 0;
+ flag['n'] = 0;
+ flag['t'] = 0;
+ flag['S'] = 0;
+ flag['C'] = 0;
+ flag['M'] = 0;
+
+ for (i = 1; i < argc; i++) {
+ if (argv[i][0] != '-') {
+ if (cmd->infile) {
+ warnx("cannot specify more than one input file");
+ return (0);
+ }
+ cmd->infile = argv[i];
+ } else {
+ for (j = 1; argv[i][j] != 0; j++) {
+ c = argv[i][j];
+ switch (c) {
+ case 'a':
+ allfiles = 1;
+ break;
+ case 'c':
+ case 'h':
+ case 'l':
+ case 'm':
+ case 't':
+ if (flag[(int)c]) {
+ return (0);
+ }
+ flag[(int)c] = 1;
+ break;
+ case 'S':
+ /*
+ * sample flag: Ss or Sc.
+ * Ss means set flag['S'];
+ * Sc means set flag['C'];
+ * Sm means set flag['M'];
+ */
+ ch = argv[i][++j]; /* get next char */
+ if (ch == 's')
+ ch = 'S';
+ else if (ch == 'c')
+ ch = 'C';
+ else if (ch == 'm')
+ ch = 'M';
+ else
+ return (0);
+
+ if (flag[(int)ch]) {
+ return (0);
+ }
+ flag[(int)ch] = 1;
+ break;
+ case 'C': /* ANSI C syntax */
+ ch = argv[i][j+1]; /* get next char */
+
+ if (ch != 'C')
+ break;
+ CCflag = 1;
+ break;
+ case 'b':
+ /*
+ * Turn TIRPC flag off for
+ * generating backward compatible
+ * code
+ */
+ tirpcflag = 0;
+ break;
+
+ case 'I':
+ inetdflag = 1;
+ break;
+ case 'N':
+ newstyle = 1;
+ break;
+ case 'L':
+ logflag = 1;
+ break;
+ case 'P':
+ pmflag = 1;
+ break;
+ case 'K':
+ if (++i == argc) {
+ return (0);
+ }
+ svcclosetime = argv[i];
+ goto nextarg;
+ case 'T':
+ tblflag = 1;
+ break;
+ case 'M':
+ mtflag = 1;
+ break;
+ case 'i' :
+ if (++i == argc) {
+ return (0);
+ }
+ inline_size = atoi(argv[i]);
+ goto nextarg;
+ case 'n':
+ case 'o':
+ case 's':
+ if (argv[i][j - 1] != '-' ||
+ argv[i][j + 1] != 0) {
+ return (0);
+ }
+ flag[(int)c] = 1;
+ if (++i == argc) {
+ return (0);
+ }
+ if (c == 'o') {
+ if (cmd->outfile) {
+ return (0);
+ }
+ cmd->outfile = argv[i];
+ }
+ goto nextarg;
+ case 'D':
+ if (argv[i][j - 1] != '-') {
+ return (0);
+ }
+ (void) addarg(argv[i]);
+ goto nextarg;
+ case 'Y':
+ if (++i == argc) {
+ return (0);
+ }
+ if (strlcpy(pathbuf, argv[i],
+ sizeof(pathbuf)) >= sizeof(pathbuf)
+ || strlcat(pathbuf, "/cpp",
+ sizeof(pathbuf)) >=
+ sizeof(pathbuf)) {
+ warnx("argument too long");
+ return (0);
+ }
+ CPP = pathbuf;
+ goto nextarg;
+
+
+
+ default:
+ return (0);
+ }
+ }
+ nextarg:
+ ;
+ }
+ }
+
+ cmd->cflag = flag['c'];
+ cmd->hflag = flag['h'];
+ cmd->lflag = flag['l'];
+ cmd->mflag = flag['m'];
+ cmd->nflag = flag['n'];
+ cmd->sflag = flag['s'];
+ cmd->tflag = flag['t'];
+ cmd->Ssflag = flag['S'];
+ cmd->Scflag = flag['C'];
+ cmd->makefileflag = flag['M'];
+
+ if (tirpcflag) {
+ if (inetdflag)
+ pmflag = 0;
+ if ((inetdflag && cmd->nflag)) {
+ /* netid not allowed with inetdflag */
+ warnx("cannot use netid flag with inetd flag");
+ return (0);
+ }
+ } else { /* 4.1 mode */
+ pmflag = 0; /* set pmflag only in tirpcmode */
+ if (cmd->nflag) { /* netid needs TIRPC */
+ warnx("cannot use netid flag without TIRPC");
+ return (0);
+ }
+ }
+
+ if (newstyle && (tblflag || cmd->tflag)) {
+ warnx("cannot use table flags with newstyle");
+ return (0);
+ }
+
+ /* check no conflicts with file generation flags */
+ nflags = cmd->cflag + cmd->hflag + cmd->lflag + cmd->mflag +
+ cmd->sflag + cmd->nflag + cmd->tflag + cmd->Ssflag +
+ cmd->Scflag + cmd->makefileflag;
+
+ if (nflags == 0) {
+ if (cmd->outfile != NULL || cmd->infile == NULL) {
+ return (0);
+ }
+ } else if (cmd->infile == NULL &&
+ (cmd->Ssflag || cmd->Scflag || cmd->makefileflag)) {
+ warnx("\"infile\" is required for template generation flags");
+ return (0);
+ } if (nflags > 1) {
+ warnx("cannot have more than one file generation flag");
+ return (0);
+ }
+ return (1);
+}
+
+static void
+usage(void)
+{
+ f_print(stderr, "%s\n%s\n%s\n%s\n%s\n",
+ "usage: rpcgen infile",
+ " rpcgen [-abCLNTM] [-Dname[=value]] [-i size]\
+[-I -P [-K seconds]] [-Y path] infile",
+ " rpcgen [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\
+[-o outfile] [infile]",
+ " rpcgen [-s nettype]* [-o outfile] [infile]",
+ " rpcgen [-n netid]* [-o outfile] [infile]");
+ options_usage();
+ exit(1);
+}
+
+static void
+options_usage(void)
+{
+ f_print(stderr, "options:\n");
+ f_print(stderr, "-a\t\tgenerate all files, including samples\n");
+ f_print(stderr, "-b\t\tbackward compatibility mode (generates code \
+for FreeBSD 4.X)\n");
+ f_print(stderr, "-c\t\tgenerate XDR routines\n");
+ f_print(stderr, "-C\t\tANSI C mode\n");
+ f_print(stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n");
+ f_print(stderr, "-h\t\tgenerate header file\n");
+ f_print(stderr, "-i size\t\tsize at which to start generating\
+inline code\n");
+ f_print(stderr, "-I\t\tgenerate code for inetd support in server\n");
+ f_print(stderr, "-K seconds\tserver exits after K seconds of\
+inactivity\n");
+ f_print(stderr, "-l\t\tgenerate client side stubs\n");
+ f_print(stderr, "-L\t\tserver errors will be printed to syslog\n");
+ f_print(stderr, "-m\t\tgenerate server side stubs\n");
+ f_print(stderr, "-M\t\tgenerate MT-safe code\n");
+ f_print(stderr, "-n netid\tgenerate server code that supports\
+named netid\n");
+ f_print(stderr, "-N\t\tsupports multiple arguments and\
+call-by-value\n");
+ f_print(stderr, "-o outfile\tname of the output file\n");
+ f_print(stderr, "-P\t\tgenerate code for port monitoring support in server\n");
+ f_print(stderr, "-s nettype\tgenerate server code that supports named\
+nettype\n");
+ f_print(stderr, "-Sc\t\tgenerate sample client code that uses remote\
+procedures\n");
+ f_print(stderr, "-Ss\t\tgenerate sample server code that defines\
+remote procedures\n");
+ f_print(stderr, "-Sm \t\tgenerate makefile template \n");
+
+ f_print(stderr, "-t\t\tgenerate RPC dispatch table\n");
+ f_print(stderr, "-T\t\tgenerate code to support RPC dispatch tables\n");
+ f_print(stderr, "-Y path\t\tpath where cpp is found\n");
+ exit(1);
+}
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
new file mode 100644
index 0000000..69392b7
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -0,0 +1,639 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_parse.c 1.12 93/07/05 SMI"
+static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_parse.c, Parser for the RPC protocol compiler
+ * Copyright (C) 1987 Sun Microsystems, Inc.
+ */
+#include <stdio.h>
+#include <string.h>
+#include "rpc/types.h"
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+#define ARGNAME "arg"
+
+static void isdefined( definition * );
+static void def_struct( definition * );
+static void def_program( definition * );
+static void def_enum( definition * );
+static void def_const( definition * );
+static void def_union( definition * );
+static void def_typedef( definition * );
+static void get_declaration( declaration *, defkind );
+static void get_prog_declaration( declaration *, defkind, int );
+static void get_type(const char **, const char **, defkind);
+static void unsigned_dec(const char ** );
+
+/*
+ * return the next definition you see
+ */
+definition *
+get_definition(void)
+{
+ definition *defp;
+ token tok;
+
+ defp = XALLOC(definition);
+ get_token(&tok);
+ switch (tok.kind) {
+ case TOK_STRUCT:
+ def_struct(defp);
+ break;
+ case TOK_UNION:
+ def_union(defp);
+ break;
+ case TOK_TYPEDEF:
+ def_typedef(defp);
+ break;
+ case TOK_ENUM:
+ def_enum(defp);
+ break;
+ case TOK_PROGRAM:
+ def_program(defp);
+ break;
+ case TOK_CONST:
+ def_const(defp);
+ break;
+ case TOK_EOF:
+ return (NULL);
+ default:
+ error("definition keyword expected");
+ }
+ scan(TOK_SEMICOLON, &tok);
+ isdefined(defp);
+ return (defp);
+}
+
+static void
+isdefined(definition *defp)
+{
+ STOREVAL(&defined, defp);
+}
+
+static void
+def_struct(definition *defp)
+{
+ token tok;
+ declaration dec;
+ decl_list *decls;
+ decl_list **tailp;
+
+ defp->def_kind = DEF_STRUCT;
+
+ scan(TOK_IDENT, &tok);
+ defp->def_name = tok.str;
+ scan(TOK_LBRACE, &tok);
+ tailp = &defp->def.st.decls;
+ do {
+ get_declaration(&dec, DEF_STRUCT);
+ decls = XALLOC(decl_list);
+ decls->decl = dec;
+ *tailp = decls;
+ tailp = &decls->next;
+ scan(TOK_SEMICOLON, &tok);
+ peek(&tok);
+ } while (tok.kind != TOK_RBRACE);
+ get_token(&tok);
+ *tailp = NULL;
+}
+
+static void
+def_program(definition *defp)
+{
+ token tok;
+ declaration dec;
+ decl_list *decls;
+ decl_list **tailp;
+ version_list *vlist;
+ version_list **vtailp;
+ proc_list *plist;
+ proc_list **ptailp;
+ int num_args;
+ bool_t isvoid = FALSE; /* whether first argument is void */
+ defp->def_kind = DEF_PROGRAM;
+ scan(TOK_IDENT, &tok);
+ defp->def_name = tok.str;
+ scan(TOK_LBRACE, &tok);
+ vtailp = &defp->def.pr.versions;
+ tailp = &defp->def.st.decls;
+ scan(TOK_VERSION, &tok);
+ do {
+ scan(TOK_IDENT, &tok);
+ vlist = XALLOC(version_list);
+ vlist->vers_name = tok.str;
+ scan(TOK_LBRACE, &tok);
+ ptailp = &vlist->procs;
+ do {
+ /* get result type */
+ plist = XALLOC(proc_list);
+ get_type(&plist->res_prefix, &plist->res_type,
+ DEF_PROGRAM);
+ if (streq(plist->res_type, "opaque")) {
+ error("illegal result type");
+ }
+ scan(TOK_IDENT, &tok);
+ plist->proc_name = tok.str;
+ scan(TOK_LPAREN, &tok);
+ /* get args - first one */
+ num_args = 1;
+ isvoid = FALSE;
+ /*
+ * type of DEF_PROGRAM in the first
+ * get_prog_declaration and DEF_STURCT in the next
+ * allows void as argument if it is the only argument
+ */
+ get_prog_declaration(&dec, DEF_PROGRAM, num_args);
+ if (streq(dec.type, "void"))
+ isvoid = TRUE;
+ decls = XALLOC(decl_list);
+ plist->args.decls = decls;
+ decls->decl = dec;
+ tailp = &decls->next;
+ /* get args */
+ while (peekscan(TOK_COMMA, &tok)) {
+ num_args++;
+ get_prog_declaration(&dec, DEF_STRUCT,
+ num_args);
+ decls = XALLOC(decl_list);
+ decls->decl = dec;
+ *tailp = decls;
+ if (streq(dec.type, "void"))
+ isvoid = TRUE;
+ tailp = &decls->next;
+ }
+ /* multiple arguments are only allowed in newstyle */
+ if (!newstyle && num_args > 1) {
+ error("only one argument is allowed");
+ }
+ if (isvoid && num_args > 1) {
+ error("illegal use of void in program definition");
+ }
+ *tailp = NULL;
+ scan(TOK_RPAREN, &tok);
+ scan(TOK_EQUAL, &tok);
+ scan_num(&tok);
+ scan(TOK_SEMICOLON, &tok);
+ plist->proc_num = tok.str;
+ plist->arg_num = num_args;
+ *ptailp = plist;
+ ptailp = &plist->next;
+ peek(&tok);
+ } while (tok.kind != TOK_RBRACE);
+ *ptailp = NULL;
+ *vtailp = vlist;
+ vtailp = &vlist->next;
+ scan(TOK_RBRACE, &tok);
+ scan(TOK_EQUAL, &tok);
+ scan_num(&tok);
+ vlist->vers_num = tok.str;
+ /* make the argument structure name for each arg */
+ for (plist = vlist->procs; plist != NULL;
+ plist = plist->next) {
+ plist->args.argname = make_argname(plist->proc_name,
+ vlist->vers_num);
+ /* free the memory ?? */
+ }
+ scan(TOK_SEMICOLON, &tok);
+ scan2(TOK_VERSION, TOK_RBRACE, &tok);
+ } while (tok.kind == TOK_VERSION);
+ scan(TOK_EQUAL, &tok);
+ scan_num(&tok);
+ defp->def.pr.prog_num = tok.str;
+ *vtailp = NULL;
+}
+
+
+static void
+def_enum(definition *defp)
+{
+ token tok;
+ enumval_list *elist;
+ enumval_list **tailp;
+
+ defp->def_kind = DEF_ENUM;
+ scan(TOK_IDENT, &tok);
+ defp->def_name = tok.str;
+ scan(TOK_LBRACE, &tok);
+ tailp = &defp->def.en.vals;
+ do {
+ scan(TOK_IDENT, &tok);
+ elist = XALLOC(enumval_list);
+ elist->name = tok.str;
+ elist->assignment = NULL;
+ scan3(TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
+ if (tok.kind == TOK_EQUAL) {
+ scan_num(&tok);
+ elist->assignment = tok.str;
+ scan2(TOK_COMMA, TOK_RBRACE, &tok);
+ }
+ *tailp = elist;
+ tailp = &elist->next;
+ } while (tok.kind != TOK_RBRACE);
+ *tailp = NULL;
+}
+
+static void
+def_const(definition *defp)
+{
+ token tok;
+
+ defp->def_kind = DEF_CONST;
+ scan(TOK_IDENT, &tok);
+ defp->def_name = tok.str;
+ scan(TOK_EQUAL, &tok);
+ scan2(TOK_IDENT, TOK_STRCONST, &tok);
+ defp->def.co = tok.str;
+}
+
+static void
+def_union(definition *defp)
+{
+ token tok;
+ declaration dec;
+ case_list *cases;
+ case_list **tailp;
+ int flag;
+
+ defp->def_kind = DEF_UNION;
+ scan(TOK_IDENT, &tok);
+ defp->def_name = tok.str;
+ scan(TOK_SWITCH, &tok);
+ scan(TOK_LPAREN, &tok);
+ get_declaration(&dec, DEF_UNION);
+ defp->def.un.enum_decl = dec;
+ tailp = &defp->def.un.cases;
+ scan(TOK_RPAREN, &tok);
+ scan(TOK_LBRACE, &tok);
+ scan(TOK_CASE, &tok);
+ while (tok.kind == TOK_CASE) {
+ scan2(TOK_IDENT, TOK_CHARCONST, &tok);
+ cases = XALLOC(case_list);
+ cases->case_name = tok.str;
+ scan(TOK_COLON, &tok);
+ /* now peek at next token */
+ flag = 0;
+ if (peekscan(TOK_CASE, &tok)){
+ do {
+ scan2(TOK_IDENT, TOK_CHARCONST, &tok);
+ cases->contflag = 1;
+ /* continued case statement */
+ *tailp = cases;
+ tailp = &cases->next;
+ cases = XALLOC(case_list);
+ cases->case_name = tok.str;
+ scan(TOK_COLON, &tok);
+ } while (peekscan(TOK_CASE, &tok));
+ }
+ else
+ if (flag)
+ {
+
+ *tailp = cases;
+ tailp = &cases->next;
+ cases = XALLOC(case_list);
+ }
+
+ get_declaration(&dec, DEF_UNION);
+ cases->case_decl = dec;
+ cases->contflag = 0; /* no continued case statement */
+ *tailp = cases;
+ tailp = &cases->next;
+ scan(TOK_SEMICOLON, &tok);
+
+ scan3(TOK_CASE, TOK_DEFAULT, TOK_RBRACE, &tok);
+ }
+ *tailp = NULL;
+ if (tok.kind == TOK_DEFAULT) {
+ scan(TOK_COLON, &tok);
+ get_declaration(&dec, DEF_UNION);
+ defp->def.un.default_decl = XALLOC(declaration);
+ *defp->def.un.default_decl = dec;
+ scan(TOK_SEMICOLON, &tok);
+ scan(TOK_RBRACE, &tok);
+ } else {
+ defp->def.un.default_decl = NULL;
+ }
+}
+
+static const char *reserved_words[] =
+{
+ "array",
+ "bytes",
+ "destroy",
+ "free",
+ "getpos",
+ "inline",
+ "pointer",
+ "reference",
+ "setpos",
+ "sizeof",
+ "union",
+ "vector",
+ NULL
+ };
+
+static const char *reserved_types[] =
+{
+ "opaque",
+ "string",
+ NULL
+ };
+
+/*
+ * check that the given name is not one that would eventually result in
+ * xdr routines that would conflict with internal XDR routines.
+ */
+static void
+check_type_name(const char *name, int new_type)
+{
+ int i;
+ char tmp[100];
+
+ for (i = 0; reserved_words[i] != NULL; i++) {
+ if (strcmp(name, reserved_words[i]) == 0) {
+ sprintf(tmp,
+ "illegal (reserved) name :\'%s\' in type definition",
+ name);
+ error(tmp);
+ }
+ }
+ if (new_type) {
+ for (i = 0; reserved_types[i] != NULL; i++) {
+ if (strcmp(name, reserved_types[i]) == 0) {
+ sprintf(tmp,
+ "illegal (reserved) name :\'%s\' in type definition",
+ name);
+ error(tmp);
+ }
+ }
+ }
+}
+
+
+
+static void
+def_typedef(definition *defp)
+{
+ declaration dec;
+
+ defp->def_kind = DEF_TYPEDEF;
+ get_declaration(&dec, DEF_TYPEDEF);
+ defp->def_name = dec.name;
+ check_type_name(dec.name, 1);
+ defp->def.ty.old_prefix = dec.prefix;
+ defp->def.ty.old_type = dec.type;
+ defp->def.ty.rel = dec.rel;
+ defp->def.ty.array_max = dec.array_max;
+}
+
+static void
+get_declaration(declaration *dec, defkind dkind)
+{
+ token tok;
+
+ get_type(&dec->prefix, &dec->type, dkind);
+ dec->rel = REL_ALIAS;
+ if (streq(dec->type, "void")) {
+ return;
+ }
+
+ check_type_name(dec->type, 0);
+ scan2(TOK_STAR, TOK_IDENT, &tok);
+ if (tok.kind == TOK_STAR) {
+ dec->rel = REL_POINTER;
+ scan(TOK_IDENT, &tok);
+ }
+ dec->name = tok.str;
+ if (peekscan(TOK_LBRACKET, &tok)) {
+ if (dec->rel == REL_POINTER) {
+ error("no array-of-pointer declarations -- use typedef");
+ }
+ dec->rel = REL_VECTOR;
+ scan_num(&tok);
+ dec->array_max = tok.str;
+ scan(TOK_RBRACKET, &tok);
+ } else if (peekscan(TOK_LANGLE, &tok)) {
+ if (dec->rel == REL_POINTER) {
+ error("no array-of-pointer declarations -- use typedef");
+ }
+ dec->rel = REL_ARRAY;
+ if (peekscan(TOK_RANGLE, &tok)) {
+ dec->array_max = "~0"; /* unspecified size, use max */
+ } else {
+ scan_num(&tok);
+ dec->array_max = tok.str;
+ scan(TOK_RANGLE, &tok);
+ }
+ }
+ if (streq(dec->type, "opaque")) {
+ if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR) {
+ error("array declaration expected");
+ }
+ } else if (streq(dec->type, "string")) {
+ if (dec->rel != REL_ARRAY) {
+ error("variable-length array declaration expected");
+ }
+ }
+}
+
+
+static void
+get_prog_declaration(declaration *dec, defkind dkind, int num)
+{
+ token tok;
+ char name[10]; /* argument name */
+
+ if (dkind == DEF_PROGRAM) {
+ peek(&tok);
+ if (tok.kind == TOK_RPAREN) { /* no arguments */
+ dec->rel = REL_ALIAS;
+ dec->type = "void";
+ dec->prefix = NULL;
+ dec->name = NULL;
+ return;
+ }
+ }
+ get_type(&dec->prefix, &dec->type, dkind);
+ dec->rel = REL_ALIAS;
+ if (peekscan(TOK_IDENT, &tok)) /* optional name of argument */
+ strcpy(name, tok.str);
+ else
+ sprintf(name, "%s%d", ARGNAME, num);
+ /* default name of argument */
+
+ dec->name = (char *) xstrdup(name);
+ if (streq(dec->type, "void")) {
+ return;
+ }
+
+ if (streq(dec->type, "opaque")) {
+ error("opaque -- illegal argument type");
+ }
+ if (peekscan(TOK_STAR, &tok)) {
+ if (streq(dec->type, "string")) {
+ error("pointer to string not allowed in program arguments");
+ }
+ dec->rel = REL_POINTER;
+ if (peekscan(TOK_IDENT, &tok)) {
+ /* optional name of argument */
+ dec->name = xstrdup(tok.str);
+ }
+ }
+ if (peekscan(TOK_LANGLE, &tok)) {
+ if (!streq(dec->type, "string")) {
+ error("arrays cannot be declared as arguments to procedures -- use typedef");
+ }
+ dec->rel = REL_ARRAY;
+ if (peekscan(TOK_RANGLE, &tok)) {
+ dec->array_max = "~0";
+ /* unspecified size, use max */
+ } else {
+ scan_num(&tok);
+ dec->array_max = tok.str;
+ scan(TOK_RANGLE, &tok);
+ }
+ }
+ if (streq(dec->type, "string")) {
+ if (dec->rel != REL_ARRAY) {
+ /*
+ * .x specifies just string as
+ * type of argument
+ * - make it string<>
+ */
+ dec->rel = REL_ARRAY;
+ dec->array_max = "~0"; /* unspecified size, use max */
+ }
+ }
+}
+
+
+
+static void
+get_type(const char **prefixp, const char **typep, defkind dkind)
+{
+ token tok;
+
+ *prefixp = NULL;
+ get_token(&tok);
+ switch (tok.kind) {
+ case TOK_IDENT:
+ *typep = tok.str;
+ break;
+ case TOK_STRUCT:
+ case TOK_ENUM:
+ case TOK_UNION:
+ *prefixp = tok.str;
+ scan(TOK_IDENT, &tok);
+ *typep = tok.str;
+ break;
+ case TOK_UNSIGNED:
+ unsigned_dec(typep);
+ break;
+ case TOK_SHORT:
+ *typep = "short";
+ (void) peekscan(TOK_INT, &tok);
+ break;
+ case TOK_LONG:
+ *typep = "long";
+ (void) peekscan(TOK_INT, &tok);
+ break;
+ case TOK_HYPER:
+ *typep = "int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
+
+ case TOK_VOID:
+ if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
+ error("voids allowed only inside union and program definitions with one argument");
+ }
+ *typep = tok.str;
+ break;
+ case TOK_STRING:
+ case TOK_OPAQUE:
+ case TOK_CHAR:
+ case TOK_INT:
+ case TOK_FLOAT:
+ case TOK_DOUBLE:
+ case TOK_BOOL:
+ case TOK_QUAD:
+ *typep = tok.str;
+ break;
+ default:
+ error("expected type specifier");
+ }
+}
+
+static void
+unsigned_dec(const char **typep)
+{
+ token tok;
+
+ peek(&tok);
+ switch (tok.kind) {
+ case TOK_CHAR:
+ get_token(&tok);
+ *typep = "u_char";
+ break;
+ case TOK_SHORT:
+ get_token(&tok);
+ *typep = "u_short";
+ (void) peekscan(TOK_INT, &tok);
+ break;
+ case TOK_LONG:
+ get_token(&tok);
+ *typep = "u_long";
+ (void) peekscan(TOK_INT, &tok);
+ break;
+ case TOK_HYPER:
+ get_token(&tok);
+ *typep = "u_int64_t";
+
+ (void) peekscan(TOK_INT, &tok);
+ break;
+ case TOK_INT:
+ get_token(&tok);
+ *typep = "u_int";
+ break;
+ default:
+ *typep = "u_int";
+ break;
+ }
+}
diff --git a/usr.bin/rpcgen/rpc_parse.h b/usr.bin/rpcgen/rpc_parse.h
new file mode 100644
index 0000000..3ca874e
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_parse.h
@@ -0,0 +1,200 @@
+/*
+ * $FreeBSD$
+ */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* #pragma ident "@(#)rpc_parse.h 1.10 94/05/15 SMI" */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
+/* The copyright notice above does not evidence any */
+/* actual or intended publication of such source code. */
+
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+* PROPRIETARY NOTICE (Combined)
+*
+* This source code is unpublished proprietary information
+* constituting, or derived under license from AT&T's UNIX(r) System V.
+* In addition, portions of such source code were derived from Berkeley
+* 4.3 BSD under license from the Regents of the University of
+* California.
+*
+*
+*
+* Copyright Notice
+*
+* Notice of copyright on this source code product does not indicate
+* publication.
+*
+* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
+* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
+* All rights reserved.
+*/
+
+/* @(#)rpc_parse.h 1.3 90/08/29 (C) 1987 SMI */
+
+/*
+ * rpc_parse.h, Definitions for the RPCL parser
+ */
+
+enum defkind {
+ DEF_CONST,
+ DEF_STRUCT,
+ DEF_UNION,
+ DEF_ENUM,
+ DEF_TYPEDEF,
+ DEF_PROGRAM
+};
+typedef enum defkind defkind;
+
+typedef const char *const_def;
+
+enum relation {
+ REL_VECTOR, /* fixed length array */
+ REL_ARRAY, /* variable length array */
+ REL_POINTER, /* pointer */
+ REL_ALIAS, /* simple */
+};
+typedef enum relation relation;
+
+struct typedef_def {
+ const char *old_prefix;
+ const char *old_type;
+ relation rel;
+ const char *array_max;
+};
+typedef struct typedef_def typedef_def;
+
+struct enumval_list {
+ const char *name;
+ const char *assignment;
+ struct enumval_list *next;
+};
+typedef struct enumval_list enumval_list;
+
+struct enum_def {
+ enumval_list *vals;
+};
+typedef struct enum_def enum_def;
+
+struct declaration {
+ const char *prefix;
+ const char *type;
+ const char *name;
+ relation rel;
+ const char *array_max;
+};
+typedef struct declaration declaration;
+
+struct decl_list {
+ declaration decl;
+ struct decl_list *next;
+};
+typedef struct decl_list decl_list;
+
+struct struct_def {
+ decl_list *decls;
+};
+typedef struct struct_def struct_def;
+
+struct case_list {
+ const char *case_name;
+ int contflag;
+ declaration case_decl;
+ struct case_list *next;
+};
+typedef struct case_list case_list;
+
+struct union_def {
+ declaration enum_decl;
+ case_list *cases;
+ declaration *default_decl;
+};
+typedef struct union_def union_def;
+
+struct arg_list {
+ char *argname; /* name of struct for arg*/
+ decl_list *decls;
+};
+
+typedef struct arg_list arg_list;
+
+struct proc_list {
+ const char *proc_name;
+ const char *proc_num;
+ arg_list args;
+ int arg_num;
+ const char *res_type;
+ const char *res_prefix;
+ struct proc_list *next;
+};
+typedef struct proc_list proc_list;
+
+struct version_list {
+ const char *vers_name;
+ const char *vers_num;
+ proc_list *procs;
+ struct version_list *next;
+};
+typedef struct version_list version_list;
+
+struct program_def {
+ const char *prog_num;
+ version_list *versions;
+};
+typedef struct program_def program_def;
+
+struct definition {
+ const char *def_name;
+ defkind def_kind;
+ union {
+ const_def co;
+ struct_def st;
+ union_def un;
+ enum_def en;
+ typedef_def ty;
+ program_def pr;
+ } def;
+};
+typedef struct definition definition;
+
+definition *get_definition(void);
+
+
+struct bas_type
+{
+ const char *name;
+ int length;
+ struct bas_type *next;
+};
+
+typedef struct bas_type bas_type;
diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c
new file mode 100644
index 0000000..5d6c9a9
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_sample.c
@@ -0,0 +1,294 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/* #pragma ident "@(#)rpc_sample.c 1.9 94/04/25 SMI" */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_sample.c, Sample client-server code outputter for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+
+static char RQSTP[] = "rqstp";
+
+static void write_sample_client(const char *, version_list * );
+static void write_sample_server( definition * );
+static void return_type( proc_list * );
+
+void
+write_sample_svc(definition *def)
+{
+
+ if (def->def_kind != DEF_PROGRAM)
+ return;
+ write_sample_server(def);
+}
+
+
+int
+write_sample_clnt(definition *def)
+{
+ version_list *vp;
+ int count = 0;
+
+ if (def->def_kind != DEF_PROGRAM)
+ return(0);
+ /* generate sample code for each version */
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ write_sample_client(def->def_name, vp);
+ ++count;
+ }
+ return(count);
+}
+
+
+static void
+write_sample_client(const char *program_name, version_list *vp)
+{
+ proc_list *proc;
+ int i;
+ decl_list *l;
+
+ f_print(fout, "\n\nvoid\n");
+ pvname(program_name, vp->vers_num);
+ f_print(fout, "(char *host)\n{\n");
+ f_print(fout, "\tCLIENT *clnt;\n");
+
+ i = 0;
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ f_print(fout, "\t");
+ if (mtflag) {
+ f_print(fout, "enum clnt_stat retval_%d;\n\t", ++i);
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "result_%d;\n", i);
+ } else {
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, " *result_%d;\n",++i);
+ }
+ /* print out declarations for arguments */
+ if(proc->arg_num < 2 && !newstyle) {
+ f_print(fout, "\t");
+ if(!streq(proc->args.decls->decl.type, "void"))
+ ptype(proc->args.decls->decl.prefix,
+ proc->args.decls->decl.type, 1);
+ else
+ f_print(fout, "char * "); /* cannot have "void" type */
+ f_print(fout, " ");
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_arg;\n");
+ } else if (!streq(proc->args.decls->decl.type, "void")) {
+ for (l = proc->args.decls; l != NULL; l = l->next) {
+ f_print(fout, "\t");
+ ptype(l->decl.prefix, l->decl.type, 1);
+ if (strcmp(l->decl.type,"string") >= 1)
+ f_print(fout, " ");
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_%s;\n", l->decl.name);
+ }
+ }
+ }
+
+ /* generate creation of client handle */
+ f_print(fout, "\n#ifndef\tDEBUG\n");
+ f_print(fout, "\tclnt = clnt_create(host, %s, %s, \"%s\");\n",
+ program_name, vp->vers_name, tirpcflag? "netpath" : "udp");
+ f_print(fout, "\tif (clnt == (CLIENT *) NULL) {\n");
+ f_print(fout, "\t\tclnt_pcreateerror(host);\n");
+ f_print(fout, "\t\texit(1);\n\t}\n");
+ f_print(fout, "#endif\t/* DEBUG */\n\n");
+
+ /* generate calls to procedures */
+ i = 0;
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ if (mtflag)
+ f_print(fout, "\tretval_%d = ",++i);
+ else
+ f_print(fout, "\tresult_%d = ",++i);
+ pvname(proc->proc_name, vp->vers_num);
+ if (proc->arg_num < 2 && !newstyle) {
+ f_print(fout, "(");
+ if(streq(proc->args.decls->decl.type, "void"))
+ /* cast to void * */
+ f_print(fout, "(void *)");
+ f_print(fout, "&");
+ pvname(proc->proc_name, vp->vers_num);
+ if (mtflag)
+ f_print(fout, "_arg, &result_%d, clnt);\n",
+ i);
+ else
+ f_print(fout, "_arg, clnt);\n");
+
+ } else if (streq(proc->args.decls->decl.type, "void")) {
+ if (mtflag)
+ f_print(fout, "(&result_%d, clnt);\n", i);
+ else
+ f_print(fout, "(clnt);\n");
+ }
+ else {
+ f_print(fout, "(");
+ for (l = proc->args.decls; l != NULL; l = l->next) {
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_%s, ", l->decl.name);
+ }
+ if (mtflag)
+ f_print(fout, "&result_%d, ", i);
+
+ f_print(fout, "clnt);\n");
+ }
+ if (mtflag) {
+ f_print(fout, "\tif (retval_%d != RPC_SUCCESS) {\n", i);
+
+ } else {
+ f_print(fout, "\tif (result_%d == (", i);
+ ptype(proc->res_prefix, proc->res_type, 1);
+ f_print(fout, "*) NULL) {\n");
+ }
+ f_print(fout, "\t\tclnt_perror(clnt, \"call failed\");\n");
+ f_print(fout, "\t}\n");
+ }
+
+ f_print(fout, "#ifndef\tDEBUG\n");
+ f_print(fout, "\tclnt_destroy(clnt);\n");
+ f_print(fout, "#endif\t /* DEBUG */\n");
+ f_print(fout, "}\n");
+}
+
+static void
+write_sample_server(definition *def)
+{
+ version_list *vp;
+ proc_list *proc;
+
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ f_print(fout, "\n");
+ if (!mtflag) {
+ return_type(proc);
+ f_print(fout, "*\n");
+ } else
+ f_print(fout, "bool_t\n");
+ pvname_svc(proc->proc_name, vp->vers_num);
+ printarglist(proc, "result", RQSTP, "struct svc_req *");
+
+ f_print(fout, "{\n");
+ if (!mtflag) {
+ f_print(fout, "\tstatic ");
+ if(!streq(proc->res_type, "void"))
+ return_type(proc);
+ else
+ f_print(fout, "char *");
+ /* cannot have void type */
+ f_print(fout, " result;\n");
+ }
+ else
+ f_print(fout, "\tbool_t retval;\n");
+ f_print(fout,
+ "\n\t/*\n\t * insert server code here\n\t */\n\n");
+
+ if (!mtflag)
+ if(!streq(proc->res_type, "void"))
+ f_print(fout, "\treturn (&result);\n}\n");
+ else /* cast back to void * */
+ f_print(fout, "\treturn((void *) &result);\n}\n");
+ else
+ f_print(fout, "\treturn (retval);\n}\n");
+ }
+ /* put in sample freeing routine */
+ if (mtflag) {
+ f_print(fout, "\nint\n");
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout,"_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
+ f_print(fout, "{\n");
+ f_print(fout, "\t(void) xdr_free(xdr_result, result);\n");
+ f_print(fout,
+ "\n\t/*\n\t * Insert additional freeing code here, if needed\n\t */\n");
+ f_print(fout, "\n}\n");
+
+
+ }
+ }
+}
+
+
+
+static void
+return_type(proc_list *plist)
+{
+ ptype(plist->res_prefix, plist->res_type, 1);
+}
+
+void
+add_sample_msg(void)
+{
+ f_print(fout, "/*\n");
+ f_print(fout, " * This is sample code generated by rpcgen.\n");
+ f_print(fout, " * These are only templates and you can use them\n");
+ f_print(fout, " * as a guideline for developing your own functions.\n");
+ f_print(fout, " */\n\n");
+}
+
+void
+write_sample_clnt_main(void)
+{
+ list *l;
+ definition *def;
+ 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;");
+ f_print(fout, "\n\n\tif (argc < 2) {");
+ f_print(fout, "\n\t\tprintf(\"usage: %%s server_host\\n\", argv[0]);\n");
+ f_print(fout, "\t\texit(1);\n\t}");
+ f_print(fout, "\n\thost = argv[1];\n");
+
+ for (l = defined; l != NULL; l = l->next) {
+ def = l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ continue;
+ }
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout, "\t");
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout, "(host);\n");
+ }
+ }
+ f_print(fout, "}\n");
+}
diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c
new file mode 100644
index 0000000..bdbeec0
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_scan.c
@@ -0,0 +1,497 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_scan.c 1.13 93/07/05 SMI"
+static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_scan.c, Scanner for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+
+#include <sys/types.h>
+
+#include <sys/wait.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+#define startcomment(where) (where[0] == '/' && where[1] == '*')
+#define endcomment(where) (where[-1] == '*' && where[0] == '/')
+
+static int pushed = 0; /* is a token pushed */
+static token lasttok; /* last token, if pushed */
+
+static void unget_token( token * );
+static void findstrconst(char **, const char **);
+static void findchrconst(char **, const char **);
+static void findconst(char **, const char **);
+static void findkind( char **, token * );
+static int cppline( char * );
+static int directive( char * );
+static void printdirective( char * );
+static void docppline(char *, int *, const char **);
+
+/*
+ * scan expecting 1 given token
+ */
+void
+scan(tok_kind expect, token *tokp)
+{
+ get_token(tokp);
+ if (tokp->kind != expect) {
+ expected1(expect);
+ }
+}
+
+/*
+ * scan expecting any of the 2 given tokens
+ */
+void
+scan2(tok_kind expect1, tok_kind expect2, token *tokp)
+{
+ get_token(tokp);
+ if (tokp->kind != expect1 && tokp->kind != expect2) {
+ expected2(expect1, expect2);
+ }
+}
+
+/*
+ * scan expecting any of the 3 given token
+ */
+void
+scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp)
+{
+ get_token(tokp);
+ if (tokp->kind != expect1 && tokp->kind != expect2
+ && tokp->kind != expect3) {
+ expected3(expect1, expect2, expect3);
+ }
+}
+
+/*
+ * scan expecting a constant, possibly symbolic
+ */
+void
+scan_num(token *tokp)
+{
+ get_token(tokp);
+ switch (tokp->kind) {
+ case TOK_IDENT:
+ break;
+ default:
+ error("constant or identifier expected");
+ }
+}
+
+/*
+ * Peek at the next token
+ */
+void
+peek(token *tokp)
+{
+ get_token(tokp);
+ unget_token(tokp);
+}
+
+/*
+ * Peek at the next token and scan it if it matches what you expect
+ */
+int
+peekscan(tok_kind expect, token *tokp)
+{
+ peek(tokp);
+ if (tokp->kind == expect) {
+ get_token(tokp);
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Get the next token, printing out any directive that are encountered.
+ */
+void
+get_token(token *tokp)
+{
+ int commenting;
+ int stat = 0;
+
+
+ if (pushed) {
+ pushed = 0;
+ *tokp = lasttok;
+ return;
+ }
+ commenting = 0;
+ for (;;) {
+ if (*where == 0) {
+ for (;;) {
+ if (!fgets(curline, MAXLINESIZE, fin)) {
+ tokp->kind = TOK_EOF;
+ /* now check if cpp returned non NULL value */
+ waitpid(childpid, &stat, WUNTRACED);
+ if (stat > 0) {
+ /* Set return value from rpcgen */
+ nonfatalerrors = stat >> 8;
+ }
+ *where = 0;
+ return;
+ }
+ linenum++;
+ if (commenting) {
+ break;
+ } else if (cppline(curline)) {
+ docppline(curline, &linenum,
+ &infilename);
+ } else if (directive(curline)) {
+ printdirective(curline);
+ } else {
+ break;
+ }
+ }
+ where = curline;
+ } else if (isspace(*where)) {
+ while (isspace(*where)) {
+ where++; /* eat */
+ }
+ } else if (commenting) {
+ for (where++; *where; where++) {
+ if (endcomment(where)) {
+ where++;
+ commenting--;
+ break;
+ }
+ }
+ } else if (startcomment(where)) {
+ where += 2;
+ commenting++;
+ } else {
+ break;
+ }
+ }
+
+ /*
+ * 'where' is not whitespace, comment or directive Must be a token!
+ */
+ switch (*where) {
+ case ':':
+ tokp->kind = TOK_COLON;
+ where++;
+ break;
+ case ';':
+ tokp->kind = TOK_SEMICOLON;
+ where++;
+ break;
+ case ',':
+ tokp->kind = TOK_COMMA;
+ where++;
+ break;
+ case '=':
+ tokp->kind = TOK_EQUAL;
+ where++;
+ break;
+ case '*':
+ tokp->kind = TOK_STAR;
+ where++;
+ break;
+ case '[':
+ tokp->kind = TOK_LBRACKET;
+ where++;
+ break;
+ case ']':
+ tokp->kind = TOK_RBRACKET;
+ where++;
+ break;
+ case '{':
+ tokp->kind = TOK_LBRACE;
+ where++;
+ break;
+ case '}':
+ tokp->kind = TOK_RBRACE;
+ where++;
+ break;
+ case '(':
+ tokp->kind = TOK_LPAREN;
+ where++;
+ break;
+ case ')':
+ tokp->kind = TOK_RPAREN;
+ where++;
+ break;
+ case '<':
+ tokp->kind = TOK_LANGLE;
+ where++;
+ break;
+ case '>':
+ tokp->kind = TOK_RANGLE;
+ where++;
+ break;
+
+ case '"':
+ tokp->kind = TOK_STRCONST;
+ findstrconst(&where, &tokp->str);
+ break;
+ case '\'':
+ tokp->kind = TOK_CHARCONST;
+ findchrconst(&where, &tokp->str);
+ break;
+
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ tokp->kind = TOK_IDENT;
+ findconst(&where, &tokp->str);
+ break;
+
+ default:
+ if (!(isalpha(*where) || *where == '_')) {
+ char buf[100];
+ char *p;
+
+ s_print(buf, "illegal character in file: ");
+ p = buf + strlen(buf);
+ if (isprint(*where)) {
+ s_print(p, "%c", *where);
+ } else {
+ s_print(p, "%d", *where);
+ }
+ error(buf);
+ }
+ findkind(&where, tokp);
+ break;
+ }
+}
+
+static void
+unget_token(token *tokp)
+{
+ lasttok = *tokp;
+ pushed = 1;
+}
+
+static void
+findstrconst(char **str, const char **val)
+{
+ char *p;
+ char *tmp;
+ int size;
+
+ p = *str;
+ do {
+ p++;
+ } while (*p && *p != '"');
+ if (*p == 0) {
+ error("unterminated string constant");
+ }
+ p++;
+ size = p - *str + 1;
+ tmp = xmalloc(size);
+ (void) strlcpy(tmp, *str, size);
+ *val = tmp;
+ *str = p;
+}
+
+static void
+findchrconst(char **str, const char **val)
+{
+ char *p;
+ char *tmp;
+ int size;
+
+ p = *str;
+ do {
+ p++;
+ } while (*p && *p != '\'');
+ if (*p == 0) {
+ error("unterminated string constant");
+ }
+ p++;
+ size = p - *str + 1;
+ if (size != 4) {
+ error("empty char string");
+ }
+ tmp = xmalloc(size);
+ (void) strlcpy(tmp, *str, size);
+ *val = tmp;
+ *str = p;
+}
+
+static void
+findconst(char **str, const char **val)
+{
+ char *p;
+ char *tmp;
+ int size;
+
+ p = *str;
+ if (*p == '0' && *(p + 1) == 'x') {
+ p++;
+ do {
+ p++;
+ } while (isxdigit(*p));
+ } else {
+ do {
+ p++;
+ } while (isdigit(*p));
+ }
+ size = p - *str + 1;
+ tmp = xmalloc(size);
+ (void) strlcpy(tmp, *str, size);
+ *val = tmp;
+ *str = p;
+}
+
+static token symbols[] = {
+ {TOK_CONST, "const"},
+ {TOK_UNION, "union"},
+ {TOK_SWITCH, "switch"},
+ {TOK_CASE, "case"},
+ {TOK_DEFAULT, "default"},
+ {TOK_STRUCT, "struct"},
+ {TOK_TYPEDEF, "typedef"},
+ {TOK_ENUM, "enum"},
+ {TOK_OPAQUE, "opaque"},
+ {TOK_BOOL, "bool"},
+ {TOK_VOID, "void"},
+ {TOK_CHAR, "char"},
+ {TOK_INT, "int"},
+ {TOK_UNSIGNED, "unsigned"},
+ {TOK_SHORT, "short"},
+ {TOK_LONG, "long"},
+ {TOK_HYPER, "hyper"},
+ {TOK_FLOAT, "float"},
+ {TOK_DOUBLE, "double"},
+ {TOK_QUAD, "quadruple"},
+ {TOK_STRING, "string"},
+ {TOK_PROGRAM, "program"},
+ {TOK_VERSION, "version"},
+ {TOK_EOF, "??????"},
+};
+
+static void
+findkind(char **mark, token *tokp)
+{
+ int len;
+ token *s;
+ char *str, *tmp;
+
+ str = *mark;
+ for (s = symbols; s->kind != TOK_EOF; s++) {
+ len = strlen(s->str);
+ if (strncmp(str, s->str, len) == 0) {
+ if (!isalnum(str[len]) && str[len] != '_') {
+ tokp->kind = s->kind;
+ tokp->str = s->str;
+ *mark = str + len;
+ return;
+ }
+ }
+ }
+ tokp->kind = TOK_IDENT;
+ for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);
+ tmp = xmalloc(len + 1);
+ (void) strlcpy(tmp, str, len + 1);
+ tokp->str = tmp;
+ *mark = str + len;
+}
+
+static int
+cppline(char *line)
+{
+ return (line == curline && *line == '#');
+}
+
+static int
+directive(char *line)
+{
+ return (line == curline && *line == '%');
+}
+
+static void
+printdirective(char *line)
+{
+ f_print(fout, "%s", line + 1);
+}
+
+static void
+docppline(char *line, int *lineno, const char **fname)
+{
+ char *file;
+ int num;
+ char *p;
+
+ line++;
+ while (isspace(*line)) {
+ line++;
+ }
+ num = atoi(line);
+ while (isdigit(*line)) {
+ line++;
+ }
+ while (isspace(*line)) {
+ line++;
+ }
+ if (*line != '"') {
+ error("preprocessor error");
+ }
+ line++;
+ p = file = xmalloc(strlen(line) + 1);
+ while (*line && *line != '"') {
+ *p++ = *line++;
+ }
+ if (*line == 0) {
+ error("preprocessor error");
+ }
+ *p = 0;
+ if (*file == 0) {
+ *fname = NULL;
+ } else {
+ *fname = file;
+ }
+ *lineno = num - 1;
+}
diff --git a/usr.bin/rpcgen/rpc_scan.h b/usr.bin/rpcgen/rpc_scan.h
new file mode 100644
index 0000000..a57eb3b
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_scan.h
@@ -0,0 +1,136 @@
+/*
+ * $FreeBSD$
+ */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* #pragma ident "@(#)rpc_scan.h 1.11 94/05/15 SMI" */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
+/* The copyright notice above does not evidence any */
+/* actual or intended publication of such source code. */
+
+
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+* PROPRIETARY NOTICE (Combined)
+*
+* This source code is unpublished proprietary information
+* constituting, or derived under license from AT&T's UNIX(r) System V.
+* In addition, portions of such source code were derived from Berkeley
+* 4.3 BSD under license from the Regents of the University of
+* California.
+*
+*
+*
+* Copyright Notice
+*
+* Notice of copyright on this source code product does not indicate
+* publication.
+*
+* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
+* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
+* All rights reserved.
+*/
+
+/* @(#)rpc_scan.h 1.3 90/08/29 (C) 1987 SMI */
+
+/*
+ * rpc_scan.h, Definitions for the RPCL scanner
+ */
+
+/*
+ * kinds of tokens
+ */
+enum tok_kind {
+ TOK_IDENT,
+ TOK_CHARCONST,
+ TOK_STRCONST,
+ TOK_LPAREN,
+ TOK_RPAREN,
+ TOK_LBRACE,
+ TOK_RBRACE,
+ TOK_LBRACKET,
+ TOK_RBRACKET,
+ TOK_LANGLE,
+ TOK_RANGLE,
+ TOK_STAR,
+ TOK_COMMA,
+ TOK_EQUAL,
+ TOK_COLON,
+ TOK_SEMICOLON,
+ TOK_CONST,
+ TOK_STRUCT,
+ TOK_UNION,
+ TOK_SWITCH,
+ TOK_CASE,
+ TOK_DEFAULT,
+ TOK_ENUM,
+ TOK_TYPEDEF,
+ TOK_INT,
+ TOK_SHORT,
+ TOK_LONG,
+ TOK_HYPER,
+ TOK_UNSIGNED,
+ TOK_FLOAT,
+ TOK_DOUBLE,
+ TOK_QUAD,
+ TOK_OPAQUE,
+ TOK_CHAR,
+ TOK_STRING,
+ TOK_BOOL,
+ TOK_VOID,
+ TOK_PROGRAM,
+ TOK_VERSION,
+ TOK_EOF
+};
+typedef enum tok_kind tok_kind;
+
+/*
+ * a token
+ */
+struct token {
+ tok_kind kind;
+ const char *str;
+};
+typedef struct token token;
+
+
+/*
+ * routine interface
+ */
+void scan(tok_kind expect, token *tokp);
+void scan2(tok_kind expect1, tok_kind expect2, token *tokp);
+void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp);
+void scan_num(token *tokp);
+void peek(token *tokp);
+int peekscan(tok_kind expect, token *tokp);
+void get_token(token *tokp);
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
new file mode 100644
index 0000000..aa5a86a
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -0,0 +1,1020 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_svcout.c 1.4 90/04/13 SMI"
+static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
+ */
+#include <stdio.h>
+#include <string.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+static char RQSTP[] = "rqstp";
+static char TRANSP[] = "transp";
+static char ARG[] = "argument";
+static char RESULT[] = "result";
+static char ROUTINE[] = "local";
+static char RETVAL[] = "retval";
+
+static char _errbuf[256]; /* For all messages */
+
+void internal_proctype( proc_list * );
+static void write_real_program( definition * );
+static void write_program(definition *, const char *);
+static void printerr(const char *, const char *);
+static void printif(const char *, const char *, const char *, const char *);
+static void write_inetmost(const char *);
+static void print_return(const char *);
+static void print_pmapunset(const char *);
+static void print_err_message(const char *);
+static void write_timeout_func( void );
+static void write_pm_most(const char *, int);
+static void write_rpc_svc_fg(const char *, const char *);
+static void open_log_file(const char *, const char *);
+static void write_msg_out( void );
+
+
+static void
+p_xdrfunc(const char *rname, const char *typename)
+{
+ f_print(fout, "\t\txdr_%s = (xdrproc_t) xdr_%s;\n",
+ rname, stringfix(typename));
+}
+
+void
+internal_proctype(proc_list *plist)
+{
+ f_print(fout, "static ");
+ ptype(plist->res_prefix, plist->res_type, 1);
+ f_print(fout, "*");
+}
+
+
+/*
+ * write most of the service, that is, everything but the registrations.
+ */
+void
+write_most(const char *infile, int netflag, int nomain)
+{
+ if (inetdflag || pmflag) {
+ const char *var_type;
+ var_type = (nomain? "extern" : "static");
+ f_print(fout, "%s int _rpcpmstart;", var_type);
+ f_print(fout, "\t\t/* Started by a port monitor ? */\n");
+ if (!tirpcflag || tirpc_socket) {
+ f_print(fout, "%s int _rpcfdtype;", var_type);
+ f_print(fout, "\n\t\t /* Whether Stream or \
+Datagram ? */\n");
+ }
+
+ if (timerflag) {
+ f_print(fout, " /* States a server can be in \
+wrt request */\n\n");
+ f_print(fout, "#define\t_IDLE 0\n");
+ f_print(fout, "#define\t_SERVED 1\n");
+ f_print(fout, "#define\t_SERVING 2\n\n");
+ f_print(fout, "static int _rpcsvcstate = _IDLE;");
+ f_print(fout, "\t /* Set when a request is \
+serviced */\n");
+
+ if (mtflag) {
+ f_print(fout, "pthread_mutex_t _svcstate_lock;");
+ f_print(fout, "\t\t\t/* Mutex lock for variable _rpcsvcstate */\n");
+
+ }
+
+ }
+
+ write_svc_aux(nomain);
+ }
+ /* write out dispatcher and stubs */
+ write_programs((char *)NULL);
+
+ if (nomain)
+ return;
+
+ f_print(fout, "\nint\n");
+ f_print(fout, "main()\n");
+ f_print(fout, "{\n");
+ if (inetdflag) {
+ write_inetmost(infile);
+ /* Includes call to write_rpc_svc_fg() */
+ } else {
+ if (tirpcflag) {
+ if (netflag) {
+ f_print(fout,
+ "\tregister SVCXPRT *%s;\n", TRANSP);
+ f_print(fout,
+ "\tstruct netconfig *nconf = NULL;\n");
+ }
+ f_print(fout, "\tpid_t pid;\n");
+ f_print(fout, "\tint i;\n");
+ if (pmflag) {
+ if (tirpc_socket) {
+ f_print(fout, "\tstruct sockaddr_storage saddr;\n");
+ f_print(fout, "\tsocklen_t asize = sizeof (saddr);\n\n");
+ } else
+ f_print(fout, "\tchar mname[FMNAMESZ + 1];\n\n");
+ }
+
+ if (mtflag & timerflag)
+ f_print(fout, "\tmutex_init(&_svcstate_lock, USYNC_THREAD, NULL);\n");
+ if (pmflag) {
+ write_pm_most(infile, netflag);
+ f_print(fout, "\telse {\n");
+ write_rpc_svc_fg(infile, "\t\t");
+ f_print(fout, "\t}\n");
+ } else
+ write_rpc_svc_fg(infile, "\t\t");
+
+ } else {
+ f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP);
+ f_print(fout, "\n");
+ print_pmapunset("\t");
+ }
+ }
+
+ if (logflag && !inetdflag) {
+ open_log_file(infile, "\t");
+ }
+}
+
+/*
+ * write a registration for the given transport
+ */
+void
+write_netid_register(const char *transp)
+{
+ list *l;
+ definition *def;
+ version_list *vp;
+ const char *sp;
+ char tmpbuf[32];
+
+ sp = "";
+ f_print(fout, "\n");
+ f_print(fout, "%s\tnconf = getnetconfigent(\"%s\");\n", sp, transp);
+ f_print(fout, "%s\tif (nconf == NULL) {\n", sp);
+ (void) sprintf(_errbuf, "cannot find %s netid.", transp);
+ sprintf(tmpbuf, "%s\t\t", sp);
+ print_err_message(tmpbuf);
+ f_print(fout, "%s\t\texit(1);\n", sp);
+ f_print(fout, "%s\t}\n", sp);
+ if (tirpcflag) {
+ f_print(fout, "%s\t%s = svc_tli_create(RPC_ANYFD, ",
+ sp, TRANSP);
+ f_print(fout,"nconf, 0, RPC_MAXDATASIZE, RPC_MAXDATASIZE);\n");
+ } else {
+ f_print(fout,
+ "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
+ sp, TRANSP);
+ }
+ f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
+ (void) sprintf(_errbuf, "cannot create %s service.", transp);
+ print_err_message(tmpbuf);
+ f_print(fout, "%s\t\texit(1);\n", sp);
+ f_print(fout, "%s\t}\n", sp);
+
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ continue;
+ }
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout,
+ "%s\t(void) rpcb_unset(%s, %s, nconf);\n",
+ sp, def->def_name, vp->vers_name);
+ f_print(fout,
+ "%s\tif (!svc_reg(%s, %s, %s, ",
+ sp, TRANSP, def->def_name, vp->vers_name);
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout, ", nconf)) {\n");
+ (void) sprintf(_errbuf,
+ "unable to register (%s, %s, %s).",
+ def->def_name, vp->vers_name, transp);
+ print_err_message(tmpbuf);
+ f_print(fout, "%s\t\texit(1);\n", sp);
+ f_print(fout, "%s\t}\n", sp);
+ }
+ }
+ f_print(fout, "%s\tfreenetconfigent(nconf);\n", sp);
+}
+
+/*
+ * write a registration for the given transport for TLI
+ */
+void
+write_nettype_register(const char *transp)
+{
+ list *l;
+ definition *def;
+ version_list *vp;
+
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ continue;
+ }
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout, "\tif (!svc_create(");
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout, ", %s, %s, \"%s\")) {\n",
+ def->def_name, vp->vers_name, transp);
+ (void) sprintf(_errbuf,
+ "unable to create (%s, %s) for %s.",
+ def->def_name, vp->vers_name, transp);
+ print_err_message("\t\t");
+ f_print(fout, "\t\texit(1);\n");
+ f_print(fout, "\t}\n");
+ }
+ }
+}
+
+/*
+ * write the rest of the service
+ */
+void
+write_rest(void)
+{
+ f_print(fout, "\n");
+ if (inetdflag) {
+ f_print(fout, "\tif (%s == (SVCXPRT *)NULL) {\n", TRANSP);
+ (void) sprintf(_errbuf, "could not create a handle");
+ print_err_message("\t\t");
+ f_print(fout, "\t\texit(1);\n");
+ f_print(fout, "\t}\n");
+ if (timerflag) {
+ f_print(fout, "\tif (_rpcpmstart) {\n");
+ f_print(fout,
+ "\t\t(void) signal(SIGALRM, closedown);\n");
+ f_print(fout, "\t\t(void) \
+alarm(_RPCSVC_CLOSEDOWN/2);\n");
+ f_print(fout, "\t}\n");
+ }
+ }
+ f_print(fout, "\tsvc_run();\n");
+ (void) sprintf(_errbuf, "svc_run returned");
+ print_err_message("\t");
+ f_print(fout, "\texit(1);\n");
+ f_print(fout, "\t/* NOTREACHED */\n");
+ f_print(fout, "}\n");
+}
+
+void
+write_programs(const char *storage)
+{
+ list *l;
+ definition *def;
+
+ /* write out stubs for procedure definitions */
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind == DEF_PROGRAM) {
+ write_real_program(def);
+ }
+ }
+
+ /* write out dispatcher for each program */
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind == DEF_PROGRAM) {
+ write_program(def, storage);
+ }
+ }
+
+
+}
+
+/*
+ * write out definition of internal function (e.g. _printmsg_1(...))
+ * which calls server's definition of actual function (e.g. printmsg_1(...)).
+ * Unpacks single user argument of printmsg_1 to call-by-value format
+ * expected by printmsg_1.
+ */
+static void
+write_real_program(definition *def)
+{
+ version_list *vp;
+ proc_list *proc;
+ decl_list *l;
+
+ if (!newstyle) return; /* not needed for old style */
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ f_print(fout, "\n");
+ if (!mtflag)
+ internal_proctype(proc);
+ else
+ f_print(fout, "int");
+ f_print(fout, "\n_");
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "(");
+ /* arg name */
+ if (proc->arg_num > 1)
+ fputs(proc->args.argname, fout);
+ else
+ ptype(proc->args.decls->decl.prefix,
+ proc->args.decls->decl.type, 0);
+ if (mtflag) {
+ f_print(fout, " *argp, void *%s, struct svc_req *%s)\n",
+ RESULT, RQSTP);
+
+
+ }
+ else
+ f_print(fout, " *argp, struct svc_req *%s)\n",
+ RQSTP);
+
+ f_print(fout, "{\n");
+ f_print(fout, "\treturn (");
+ pvname_svc(proc->proc_name, vp->vers_num);
+ f_print(fout, "(");
+ if (proc->arg_num < 2) { /* single argument */
+ if (!streq(proc->args.decls->decl.type, "void"))
+ f_print(fout, "*argp, "); /* non-void */
+ } else {
+ for (l = proc->args.decls; l != NULL;
+ l = l->next)
+ f_print(fout, "argp->%s, ",
+ l->decl.name);
+ }
+ if (mtflag)
+ f_print(fout, "%s, ",RESULT);
+ f_print(fout, "%s));\n}\n", RQSTP);
+ }
+ }
+}
+
+static void
+write_program(definition *def, const char *storage)
+{
+ version_list *vp;
+ proc_list *proc;
+ int filled;
+
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout, "\n");
+ if (storage != NULL) {
+ f_print(fout, "%s ", storage);
+ }
+ f_print(fout, "void\n");
+ pvname(def->def_name, vp->vers_num);
+
+ f_print(fout, "(struct svc_req *%s, ", RQSTP);
+ f_print(fout, "SVCXPRT *%s)\n", TRANSP);
+ f_print(fout, "{\n");
+
+ filled = 0;
+ f_print(fout, "\tunion {\n");
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ if (proc->arg_num < 2) { /* single argument */
+ if (streq(proc->args.decls->decl.type,
+ "void")) {
+ continue;
+ }
+ filled = 1;
+ f_print(fout, "\t\t");
+ ptype(proc->args.decls->decl.prefix,
+ proc->args.decls->decl.type, 0);
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_arg;\n");
+
+ } else {
+ filled = 1;
+ f_print(fout, "\t\t%s", proc->args.argname);
+ f_print(fout, " ");
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_arg;\n");
+ }
+ }
+ if (!filled) {
+ f_print(fout, "\t\tint fill;\n");
+ }
+ f_print(fout, "\t} %s;\n", ARG);
+
+ if (mtflag) {
+ f_print(fout, "\tunion {\n");
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ if (streq(proc->res_type, "void")) {
+ continue;
+ }
+ f_print(fout, "\t\t");
+ ptype(proc->res_prefix, proc->res_type, 0);
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, "_res;\n");
+ }
+ f_print(fout, "\t} %s;\n", RESULT);
+ f_print(fout, "\tbool_t %s;\n", RETVAL);
+
+ } else
+ f_print(fout, "\tchar *%s;\n", RESULT);
+
+ f_print(fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
+ if (mtflag)
+ f_print(fout,
+ "\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
+ ROUTINE);
+ else
+ f_print(fout,
+ "\tchar *(*%s)(char *, struct svc_req *);\n",
+ ROUTINE);
+ f_print(fout, "\n");
+
+ if (timerflag) {
+ if (mtflag)
+ f_print(fout, "\tpthread_mutex_lock(&_svcstate_lock);\n");
+
+ f_print(fout, "\t_rpcsvcstate = _SERVING;\n");
+ if (mtflag)
+ f_print(fout, "\tpthread_mutex_unlock(&_svcstate_lock);\n");
+ }
+
+ f_print(fout, "\tswitch (%s->rq_proc) {\n", RQSTP);
+ if (!nullproc(vp->procs)) {
+ f_print(fout, "\tcase NULLPROC:\n");
+ f_print(fout,
+ "\t\t(void) svc_sendreply(%s,\n\t\t\t"
+ "(xdrproc_t) xdr_void, (char *)NULL);\n",
+ TRANSP);
+ print_return("\t\t");
+ f_print(fout, "\n");
+ }
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ f_print(fout, "\tcase %s:\n", proc->proc_name);
+ if (proc->arg_num < 2) { /* single argument */
+ p_xdrfunc(ARG, proc->args.decls->decl.type);
+ } else {
+ p_xdrfunc(ARG, proc->args.argname);
+ }
+ p_xdrfunc(RESULT, proc->res_type);
+
+ if (mtflag)
+ f_print(fout,
+ "\t\t%s = (bool_t (*) (char *, void *, struct svc_req *))",
+ ROUTINE);
+ else
+ f_print(fout,
+ "\t\t%s = (char *(*)(char *, struct svc_req *)) ",
+ ROUTINE);
+ if (newstyle) { /* new style: calls internal routine */
+ f_print(fout, "_");
+ }
+ if (!newstyle)
+ pvname_svc(proc->proc_name, vp->vers_num);
+ else
+ pvname(proc->proc_name, vp->vers_num);
+ f_print(fout, ";\n");
+ f_print(fout, "\t\tbreak;\n\n");
+ }
+ f_print(fout, "\tdefault:\n");
+ printerr("noproc", TRANSP);
+ print_return("\t\t");
+ f_print(fout, "\t}\n");
+
+ f_print(fout,
+ "\t(void) memset((char *)&%s, 0, sizeof (%s));\n",
+ ARG, ARG);
+ printif("getargs", TRANSP, "(caddr_t) &", ARG);
+ printerr("decode", TRANSP);
+ print_return("\t\t");
+ f_print(fout, "\t}\n");
+
+ if (!mtflag)
+ f_print(fout, "\t%s = (*%s)((char *)&%s, %s);\n",
+ RESULT, ROUTINE, ARG, RQSTP);
+ else
+ f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
+ RETVAL, ROUTINE, ARG, RESULT, RQSTP);
+
+
+ if (mtflag)
+ f_print(fout,
+ "\tif (%s > 0 && !svc_sendreply(%s, xdr_%s, (char *)&%s)) {\n",
+ RETVAL, TRANSP, RESULT, RESULT);
+ else
+ f_print(fout,
+ "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
+ RESULT, TRANSP, RESULT, RESULT);
+
+ printerr("systemerr", TRANSP);
+ f_print(fout, "\t}\n");
+
+ printif("freeargs", TRANSP, "(caddr_t) &", ARG);
+ (void) sprintf(_errbuf, "unable to free arguments");
+ print_err_message("\t\t");
+ f_print(fout, "\t\texit(1);\n");
+ f_print(fout, "\t}\n");
+ /* print out free routine */
+ if (mtflag) {
+ f_print(fout,"\tif (!");
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout,"_freeresult(%s, xdr_%s, (caddr_t) &%s))\n",
+ TRANSP, RESULT, RESULT);
+ (void) sprintf(_errbuf, "unable to free results");
+ print_err_message("\t\t");
+ f_print(fout, "\n");
+ }
+ print_return("\t");
+ f_print(fout, "}\n");
+ }
+}
+
+static void
+printerr(const char *err, const char *transp)
+{
+ f_print(fout, "\t\tsvcerr_%s(%s);\n", err, transp);
+}
+
+static void
+printif(const char *proc, const char *transp, const char *prefix,
+ const char *arg)
+{
+ f_print(fout, "\tif (!svc_%s(%s, xdr_%s, (char *)%s%s)) {\n",
+ proc, transp, arg, prefix, arg);
+}
+
+int
+nullproc(proc_list *proc)
+{
+ for (; proc != NULL; proc = proc->next) {
+ if (streq(proc->proc_num, "0")) {
+ return (1);
+ }
+ }
+ return (0);
+}
+
+static void
+write_inetmost(const char *infile)
+{
+ f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP);
+ f_print(fout, "\tint sock;\n");
+ f_print(fout, "\tint proto;\n");
+ f_print(fout, "\tstruct sockaddr_in saddr;\n");
+ f_print(fout, "\tsocklen_t asize = sizeof (saddr);\n");
+ f_print(fout, "\n");
+ f_print(fout,
+ "\tif (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {\n");
+ f_print(fout, "\t\tsocklen_t ssize = sizeof (int);\n\n");
+ f_print(fout, "\t\tif (saddr.sin_family != AF_INET)\n");
+ f_print(fout, "\t\t\texit(1);\n");
+ f_print(fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n");
+ f_print(fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n");
+ f_print(fout, "\t\t\texit(1);\n");
+ f_print(fout, "\t\tsock = 0;\n");
+ f_print(fout, "\t\t_rpcpmstart = 1;\n");
+ f_print(fout, "\t\tproto = 0;\n");
+ open_log_file(infile, "\t\t");
+ f_print(fout, "\t} else {\n");
+ write_rpc_svc_fg(infile, "\t\t");
+ f_print(fout, "\t\tsock = RPC_ANYSOCK;\n");
+ print_pmapunset("\t\t");
+ f_print(fout, "\t}\n");
+}
+
+static void
+print_return(const char *space)
+{
+ if (exitnow)
+ f_print(fout, "%sexit(0);\n", space);
+ else {
+ if (timerflag) {
+ if (mtflag)
+ f_print(fout, "%spthread_mutex_lock(&_svcstate_lock);\n", space);
+ f_print(fout, "%s_rpcsvcstate = _SERVED;\n", space);
+ if (mtflag)
+ f_print(fout, "%spthread_mutex_unlock(&_svcstate_lock);\n", space);
+ }
+ f_print(fout, "%sreturn;\n", space);
+ }
+}
+
+static void
+print_pmapunset(const char *space)
+{
+ list *l;
+ definition *def;
+ version_list *vp;
+
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind == DEF_PROGRAM) {
+ for (vp = def->def.pr.versions; vp != NULL;
+ vp = vp->next) {
+ f_print(fout, "%s(void) pmap_unset(%s, %s);\n",
+ space, def->def_name, vp->vers_name);
+ }
+ }
+ }
+}
+
+static void
+print_err_message(const char *space)
+{
+ if (logflag)
+ f_print(fout, "%ssyslog(LOG_ERR, \"%s\");\n", space, _errbuf);
+ else if (inetdflag || pmflag)
+ f_print(fout, "%s_msgout(\"%s\");\n", space, _errbuf);
+ else
+ f_print(fout, "%sfprintf(stderr, \"%s\");\n", space, _errbuf);
+}
+
+/*
+ * Write the server auxiliary function (_msgout, timeout)
+ */
+void
+write_svc_aux(int nomain)
+{
+ if (!logflag)
+ write_msg_out();
+ if (!nomain)
+ write_timeout_func();
+}
+
+/*
+ * Write the _msgout function
+ */
+
+static void
+write_msg_out(void)
+{
+ f_print(fout, "\n");
+/*
+ * Avoid making _msgout() static -- it's useful to have it visible
+ * in the toplevel RPC server code.
+ */
+ f_print(fout, "static\n");
+ f_print(fout, "void _msgout(const char* msg)\n");
+ f_print(fout, "{\n");
+ f_print(fout, "#ifdef RPC_SVC_FG\n");
+ if (inetdflag || pmflag)
+ f_print(fout, "\tif (_rpcpmstart)\n");
+ f_print(fout, "\t\tsyslog(LOG_ERR, \"%%s\", msg);\n");
+ f_print(fout, "\telse\n");
+ f_print(fout,
+ "\t\t(void) fprintf(stderr, \"%%s\\n\", msg);\n");
+ f_print(fout, "#else\n");
+ f_print(fout, "\tsyslog(LOG_ERR, \"%%s\", msg);\n");
+ f_print(fout, "#endif\n");
+ f_print(fout, "}\n");
+}
+
+/*
+ * Write the timeout function
+ */
+static void
+write_timeout_func(void)
+{
+ if (!timerflag)
+ return;
+
+ f_print(fout, "\n");
+ f_print(fout, "static void\n");
+ f_print(fout, "closedown(int sig)\n");
+ f_print(fout, "{\n");
+ if (mtflag)
+ f_print(fout, "\tpthread_mutex_lock(&_svcstate_lock);\n");
+ f_print(fout, "\tif (_rpcsvcstate == _IDLE) {\n");
+ f_print(fout, "\t\textern fd_set svc_fdset;\n");
+ f_print(fout, "\t\tstatic int size;\n");
+ f_print(fout, "\t\tint i, openfd;\n");
+ if (tirpcflag && pmflag) {
+ f_print(fout, "\t\tstruct t_info tinfo;\n\n");
+ f_print(fout,
+ "\t\tif (!t_getinfo(0, &tinfo) && (tinfo.servtype == T_CLTS))\n");
+ } else {
+ f_print(fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n");
+ }
+ f_print(fout, "\t\t\texit(0);\n");
+ f_print(fout, "\t\tif (size == 0) {\n");
+ if (tirpcflag) {
+ f_print(fout, "\t\t\tstruct rlimit rl;\n\n");
+ f_print(fout, "\t\t\trl.rlim_max = 0;\n");
+ f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
+ f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");
+
+ if (mtflag)
+ f_print(fout, "\t\t\t\tpthread_mutex_unlock(&_svcstate_lock);\n");
+
+ f_print(fout, "\t\t\t\treturn;\n\t\t\t}\n");
+ } else {
+ f_print(fout, "\t\t\tsize = getdtablesize();\n");
+ }
+ f_print(fout, "\t\t}\n");
+ f_print(fout,
+ "\t\tfor (i = 0, openfd = 0; i < size && openfd < 2; i++)\n");
+ f_print(fout, "\t\t\tif (FD_ISSET(i, &svc_fdset))\n");
+ f_print(fout, "\t\t\t\topenfd++;\n");
+ f_print(fout, "\t\tif (openfd <= 1)\n");
+ f_print(fout, "\t\t\texit(0);\n");
+ f_print(fout, "\t}\n");
+ f_print(fout, "\tif (_rpcsvcstate == _SERVED)\n");
+ f_print(fout, "\t\t_rpcsvcstate = _IDLE;\n\n");
+ if (mtflag)
+ f_print(fout, "\tpthread_mutex_unlock(&_svcstate_lock);\n");
+
+ f_print(fout, "\t(void) signal(SIGALRM, closedown);\n");
+ f_print(fout, "\t(void) alarm(_RPCSVC_CLOSEDOWN/2);\n");
+ f_print(fout, "}\n");
+
+}
+
+/*
+ * Write the most of port monitor support
+ */
+static void
+write_pm_most(const char *infile, int netflag)
+{
+ list *l;
+ definition *def;
+ version_list *vp;
+
+ if (tirpc_socket) {
+ f_print(fout,
+ "\tif (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {\n");
+ f_print(fout, "\t\tsocklen_t ssize = sizeof (int);\n");
+ } else {
+ f_print(fout, "\tif (!ioctl(0, I_LOOK, mname) &&\n");
+ f_print(fout, "\t\t(!strcmp(mname, \"sockmod\") ||");
+ f_print(fout, " !strcmp(mname, \"timod\"))) {\n");
+ }
+ f_print(fout, "\t\tchar *netid;\n");
+ if (!netflag) { /* Not included by -n option */
+ f_print(fout, "\t\tstruct netconfig *nconf = NULL;\n");
+ f_print(fout, "\t\tSVCXPRT *%s;\n", TRANSP);
+ }
+ if (timerflag)
+ f_print(fout, "\t\tint pmclose;\n");
+/*
+ * Not necessary, defined in /usr/include/stdlib
+ * f_print(fout, "\t\textern char *getenv();\n");
+ */
+ f_print(fout, "\n");
+ if (tirpc_socket) {
+ f_print(fout, "\t\tif (saddr.ss_family != AF_INET &&\n");
+ f_print(fout, "\t\t saddr.ss_family != AF_INET6)\n");
+ f_print(fout, "\t\t\texit(1);\n");
+ f_print(fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n");
+ f_print(fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n");
+ f_print(fout, "\t\t\texit(1);\n");
+ }
+ f_print(fout, "\t\t_rpcpmstart = 1;\n");
+ open_log_file(infile, "\t\t");
+ f_print(fout, "\n\t\tif ((netid = \
+getenv(\"NLSPROVIDER\")) == NULL) {\n");
+
+ if (timerflag) {
+ f_print(fout, "\t\t/* started from inetd */\n");
+ f_print(fout, "\t\t\tpmclose = 1;\n");
+ }
+ f_print(fout,
+ "\t\t} else {\n");
+ f_print(fout, "\t\t\tif ((nconf = getnetconfigent(netid)) == NULL)\n");
+ sprintf(_errbuf, "cannot get transport info");
+ print_err_message("\t\t\t\t");
+ if (timerflag) {
+ if (tirpc_socket)
+ f_print(fout, "\n\t\t\tpmclose = 1;\t/* XXX */\n");
+ else
+ f_print(fout,
+ "\n\t\t\tpmclose = (t_getstate(0) != T_DATAXFER);\n");
+ }
+ f_print(fout, "\t\t}\n");
+ /*
+ * A kludgy support for inetd services. Inetd only works with
+ * sockmod, and RPC works only with timod, hence all this jugglery
+ */
+ if (!tirpc_socket) {
+ f_print(fout, "\t\tif (strcmp(mname, \"sockmod\") == 0) {\n");
+ f_print(fout, "\t\t\tif (ioctl(0, I_POP, 0) || ");
+ f_print(fout, "ioctl(0, I_PUSH, \"timod\")) {\n");
+ sprintf(_errbuf, "could not get the right module");
+ print_err_message("\t\t\t\t");
+ f_print(fout, "\t\t\t\texit(1);\n");
+ f_print(fout, "\t\t\t}\n");
+ f_print(fout, "\t\t}\n");
+ }
+ if (tirpcflag) {
+ f_print(fout,
+ "\t\tif ((%s = svc_tli_create(0, nconf, NULL, \
+ RPC_MAXDATASIZE, RPC_MAXDATASIZE)) \
+ == NULL) {\n",
+ TRANSP);
+ } else {
+ f_print(fout,
+ "\t\tif ((%s = svc_tli_create(0, nconf, NULL, 0, 0)) \
+ == NULL) {\n",
+ TRANSP);
+ }
+ sprintf(_errbuf, "cannot create server handle");
+ print_err_message("\t\t\t");
+ f_print(fout, "\t\t\texit(1);\n");
+ f_print(fout, "\t\t}\n");
+ f_print(fout, "\t\tif (nconf)\n");
+ f_print(fout, "\t\t\tfreenetconfigent(nconf);\n");
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ continue;
+ }
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout,
+ "\t\tif (!svc_reg(%s, %s, %s, ",
+ TRANSP, def->def_name, vp->vers_name);
+ pvname(def->def_name, vp->vers_num);
+ f_print(fout, ", 0)) {\n");
+ (void) sprintf(_errbuf, "unable to register (%s, %s).",
+ def->def_name, vp->vers_name);
+ print_err_message("\t\t\t");
+ f_print(fout, "\t\t\texit(1);\n");
+ f_print(fout, "\t\t}\n");
+ }
+ }
+ if (timerflag) {
+ f_print(fout, "\t\tif (pmclose) {\n");
+ f_print(fout, "\t\t\t(void) signal(SIGALRM, closedown);\n");
+ f_print(fout, "\t\t\t(void) alarm(_RPCSVC_CLOSEDOWN/2);\n");
+ f_print(fout, "\t\t}\n");
+ }
+ f_print(fout, "\t\tsvc_run();\n");
+ f_print(fout, "\t\texit(1);\n");
+ f_print(fout, "\t\t/* NOTREACHED */\n");
+ f_print(fout, "\t}");
+}
+
+/*
+ * Support for backgrounding the server if self started.
+ */
+static void
+write_rpc_svc_fg(const char *infile, const char *sp)
+{
+ f_print(fout, "#ifndef RPC_SVC_FG\n");
+ f_print(fout, "%sint size;\n", sp);
+ if (tirpcflag)
+ f_print(fout, "%sstruct rlimit rl;\n", sp);
+ if (inetdflag)
+ f_print(fout, "%sint pid, i;\n\n", sp);
+ f_print(fout, "%spid = fork();\n", sp);
+ f_print(fout, "%sif (pid < 0) {\n", sp);
+ f_print(fout, "%s\tperror(\"cannot fork\");\n", sp);
+ f_print(fout, "%s\texit(1);\n", sp);
+ f_print(fout, "%s}\n", sp);
+ f_print(fout, "%sif (pid)\n", sp);
+ f_print(fout, "%s\texit(0);\n", sp);
+ /* get number of file descriptors */
+ if (tirpcflag) {
+ f_print(fout, "%srl.rlim_max = 0;\n", sp);
+ f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp);
+ f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
+ f_print(fout, "%s\texit(1);\n", sp);
+ } else {
+ f_print(fout, "%ssize = getdtablesize();\n", sp);
+ }
+
+ f_print(fout, "%sfor (i = 0; i < size; i++)\n", sp);
+ f_print(fout, "%s\t(void) close(i);\n", sp);
+ /* Redirect stderr and stdout to console */
+ f_print(fout, "%si = open(\"/dev/console\", 2);\n", sp);
+ f_print(fout, "%s(void) dup2(i, 1);\n", sp);
+ f_print(fout, "%s(void) dup2(i, 2);\n", sp);
+ /* This removes control of the controlling terminal */
+ if (tirpcflag)
+ f_print(fout, "%ssetsid();\n", sp);
+ else {
+ f_print(fout, "%si = open(\"/dev/tty\", 2);\n", sp);
+ f_print(fout, "%sif (i >= 0) {\n", sp);
+ f_print(fout,
+ "%s\t(void) ioctl(i, TIOCNOTTY, (char *)NULL);\n", sp);
+ f_print(fout, "%s\t(void) close(i);\n", sp);
+ f_print(fout, "%s}\n", sp);
+ }
+ if (!logflag)
+ open_log_file(infile, sp);
+ f_print(fout, "#endif\n");
+ if (logflag)
+ open_log_file(infile, sp);
+}
+
+static void
+open_log_file(const char *infile, const char *sp)
+{
+ char *s;
+
+ s = strrchr(infile, '.');
+ if (s)
+ *s = '\0';
+ f_print(fout, "%sopenlog(\"%s\", LOG_PID, LOG_DAEMON);\n", sp, infile);
+ if (s)
+ *s = '.';
+}
+
+
+
+
+/*
+ * write a registration for the given transport for Inetd
+ */
+void
+write_inetd_register(const char *transp)
+{
+ list *l;
+ definition *def;
+ version_list *vp;
+ const char *sp;
+ int isudp;
+ char tmpbuf[32];
+
+ if (inetdflag)
+ sp = "\t";
+ else
+ sp = "";
+ if (streq(transp, "udp"))
+ isudp = 1;
+ else
+ isudp = 0;
+ f_print(fout, "\n");
+ if (inetdflag) {
+ f_print(fout,
+ "\tif ((_rpcfdtype == 0) || (_rpcfdtype == %s)) {\n",
+ isudp ? "SOCK_DGRAM" : "SOCK_STREAM");
+ }
+ f_print(fout, "%s\t%s = svc%s_create(%s",
+ sp, TRANSP, transp, inetdflag? "sock": "RPC_ANYSOCK");
+ if (!isudp)
+ f_print(fout, ", 0, 0");
+ f_print(fout, ");\n");
+ f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
+ (void) sprintf(_errbuf, "cannot create %s service.", transp);
+ (void) sprintf(tmpbuf, "%s\t\t", sp);
+ print_err_message(tmpbuf);
+ f_print(fout, "%s\t\texit(1);\n", sp);
+ f_print(fout, "%s\t}\n", sp);
+
+ if (inetdflag) {
+ f_print(fout, "%s\tif (!_rpcpmstart)\n\t", sp);
+ f_print(fout, "%s\tproto = IPPROTO_%s;\n",
+ sp, isudp ? "UDP": "TCP");
+ }
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind != DEF_PROGRAM) {
+ continue;
+ }
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ f_print(fout, "%s\tif (!svc_register(%s, %s, %s, ",
+ sp, TRANSP, def->def_name, vp->vers_name);
+ pvname(def->def_name, vp->vers_num);
+ if (inetdflag)
+ f_print(fout, ", proto)) {\n");
+ else
+ f_print(fout, ", IPPROTO_%s)) {\n",
+ isudp ? "UDP": "TCP");
+ (void) sprintf(_errbuf,
+ "unable to register (%s, %s, %s).",
+ def->def_name, vp->vers_name, transp);
+ print_err_message(tmpbuf);
+ f_print(fout, "%s\t\texit(1);\n", sp);
+ f_print(fout, "%s\t}\n", sp);
+ }
+ }
+ if (inetdflag)
+ f_print(fout, "\t}\n");
+}
diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c
new file mode 100644
index 0000000..618d1f9
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_tblout.c
@@ -0,0 +1,172 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_tblout.c 1.11 93/07/05 SMI"
+static char sccsid[] = "@(#)rpc_tblout.c 1.4 89/02/22 (C) 1988 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_tblout.c, Dispatch table outputter for the RPC protocol compiler
+ * Copyright (C) 1989, Sun Microsystems, Inc.
+ */
+#include <err.h>
+#include <stdio.h>
+#include <string.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+#define TABSIZE 8
+#define TABCOUNT 5
+#define TABSTOP (TABSIZE*TABCOUNT)
+
+static char tabstr[TABCOUNT+1] = "\t\t\t\t\t";
+
+static char tbl_hdr[] = "struct rpcgen_table %s_table[] = {\n";
+static char tbl_end[] = "};\n";
+
+static char null_entry[] = "\n\t(char *(*)())0,\n\
+ \t(xdrproc_t) xdr_void,\t\t\t0,\n\
+ \t(xdrproc_t) xdr_void,\t\t\t0,\n";
+
+
+static char tbl_nproc[] = "int %s_nproc =\n\tsizeof(%s_table)/sizeof(%s_table[0]);\n\n";
+
+static void write_table( definition * );
+static void printit(const char *, const char *);
+
+void
+write_tables(void)
+{
+ list *l;
+ definition *def;
+
+ f_print(fout, "\n");
+ for (l = defined; l != NULL; l = l->next) {
+ def = (definition *) l->val;
+ if (def->def_kind == DEF_PROGRAM) {
+ write_table(def);
+ }
+ }
+}
+
+static void
+write_table(definition *def)
+{
+ version_list *vp;
+ proc_list *proc;
+ int current;
+ int expected;
+ char progvers[100];
+ int warning;
+
+ for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+ warning = 0;
+ s_print(progvers, "%s_%s",
+ locase(def->def_name), vp->vers_num);
+ /* print the table header */
+ f_print(fout, tbl_hdr, progvers);
+
+ if (nullproc(vp->procs)) {
+ expected = 0;
+ } else {
+ expected = 1;
+ fputs(null_entry, fout);
+ }
+ for (proc = vp->procs; proc != NULL; proc = proc->next) {
+ current = atoi(proc->proc_num);
+ if (current != expected++) {
+ f_print(fout,
+ "\n/*\n * WARNING: table out of order\n */\n");
+ if (warning == 0) {
+ warnx("WARNING %s table is out of order", progvers);
+ warning = 1;
+ nonfatalerrors = 1;
+ }
+ expected = current + 1;
+ }
+ f_print(fout, "\n\t(char *(*)())RPCGEN_ACTION(");
+
+ /* routine to invoke */
+ if( !newstyle )
+ pvname_svc(proc->proc_name, vp->vers_num);
+ else {
+ if( newstyle )
+ f_print( fout, "_"); /* calls internal func */
+ pvname(proc->proc_name, vp->vers_num);
+ }
+ f_print(fout, "),\n");
+
+ /* argument info */
+ if( proc->arg_num > 1 )
+ printit((char*) NULL, proc->args.argname );
+ else
+ /* do we have to do something special for newstyle */
+ printit( proc->args.decls->decl.prefix,
+ proc->args.decls->decl.type );
+ /* result info */
+ printit(proc->res_prefix, proc->res_type);
+ }
+
+ /* print the table trailer */
+ fputs(tbl_end, fout);
+ f_print(fout, tbl_nproc, progvers, progvers, progvers);
+ }
+}
+
+static void
+printit(const char *prefix, const char *type)
+{
+ int len;
+ int tabs;
+
+
+ len = fprintf(fout, "\txdr_%s,", stringfix(type));
+ /* account for leading tab expansion */
+ len += TABSIZE - 1;
+ /* round up to tabs required */
+ tabs = (TABSTOP - len + TABSIZE - 1)/TABSIZE;
+ f_print(fout, "%s", &tabstr[TABCOUNT-tabs]);
+
+ if (streq(type, "void")) {
+ f_print(fout, "0");
+ } else {
+ f_print(fout, "sizeof ( ");
+ /* XXX: should "follow" be 1 ??? */
+ ptype(prefix, type, 0);
+ f_print(fout, ")");
+ }
+ f_print(fout, ",\n");
+}
diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c
new file mode 100644
index 0000000..13b3a02
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_util.c
@@ -0,0 +1,511 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if 0
+#ifndef lint
+#ident "@(#)rpc_util.c 1.14 93/07/05 SMI"
+static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpc_util.c, Utility routines for the RPC protocol compiler
+ * Copyright (C) 1989, Sun Microsystems, Inc.
+ */
+#include <err.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include "rpc_parse.h"
+#include "rpc_scan.h"
+#include "rpc_util.h"
+
+#define ARGEXT "argument"
+
+char curline[MAXLINESIZE]; /* current read line */
+char *where = curline; /* current point in line */
+int linenum = 0; /* current line number */
+
+const char *infilename; /* input filename */
+
+#define NFILES 7
+static const char *outfiles[NFILES]; /* output file names */
+static int nfiles;
+
+FILE *fout; /* file pointer of current output */
+FILE *fin; /* file pointer of current input */
+
+list *defined; /* list of defined things */
+
+static void printwhere( void );
+
+/*
+ * Reinitialize the world
+ */
+void
+reinitialize(void)
+{
+ memset(curline, 0, MAXLINESIZE);
+ where = curline;
+ linenum = 0;
+ defined = NULL;
+}
+
+/*
+ * string equality
+ */
+int
+streq(const char *a, const char *b)
+{
+ return (strcmp(a, b) == 0);
+}
+
+/*
+ * find a value in a list
+ */
+definition *
+findval(list *lst, const char *val, int (*cmp)(definition *, const char *))
+{
+ for (; lst != NULL; lst = lst->next) {
+ if ((*cmp) (lst->val, val)) {
+ return (lst->val);
+ }
+ }
+ return (NULL);
+}
+
+/*
+ * store a value in a list
+ */
+void
+storeval(list **lstp, definition *val)
+{
+ list **l;
+ list *lst;
+
+ for (l = lstp; *l != NULL; l = (list **) & (*l)->next);
+ lst = XALLOC(list);
+ lst->val = val;
+ lst->next = NULL;
+ *l = lst;
+}
+
+static int
+findit(definition *def, const char *type)
+{
+ return (streq(def->def_name, type));
+}
+
+static const char *
+fixit(const char *type, const char *orig)
+{
+ definition *def;
+
+ def = (definition *) FINDVAL(defined, type, findit);
+ if (def == NULL || def->def_kind != DEF_TYPEDEF) {
+ return (orig);
+ }
+ switch (def->def.ty.rel) {
+ case REL_VECTOR:
+ if (streq(def->def.ty.old_type, "opaque"))
+ return ("char");
+ else
+ return (def->def.ty.old_type);
+
+ case REL_ALIAS:
+ return (fixit(def->def.ty.old_type, orig));
+ default:
+ return (orig);
+ }
+}
+
+const char *
+fixtype(const char *type)
+{
+ return (fixit(type, type));
+}
+
+const char *
+stringfix(const char *type)
+{
+ if (streq(type, "string")) {
+ return ("wrapstring");
+ } else {
+ return (type);
+ }
+}
+
+void
+ptype(const char *prefix, const char *type, int follow)
+{
+ if (prefix != NULL) {
+ if (streq(prefix, "enum")) {
+ f_print(fout, "enum ");
+ } else {
+ f_print(fout, "struct ");
+ }
+ }
+ if (streq(type, "bool")) {
+ f_print(fout, "bool_t ");
+ } else if (streq(type, "string")) {
+ f_print(fout, "char *");
+ } else {
+ f_print(fout, "%s ", follow ? fixtype(type) : type);
+ }
+}
+
+static int
+typedefed(definition *def, const char *type)
+{
+ if (def->def_kind != DEF_TYPEDEF || def->def.ty.old_prefix != NULL) {
+ return (0);
+ } else {
+ return (streq(def->def_name, type));
+ }
+}
+
+int
+isvectordef(const char *type, relation rel)
+{
+ definition *def;
+
+ for (;;) {
+ switch (rel) {
+ case REL_VECTOR:
+ return (!streq(type, "string"));
+ case REL_ARRAY:
+ return (0);
+ case REL_POINTER:
+ return (0);
+ case REL_ALIAS:
+ def = (definition *) FINDVAL(defined, type, typedefed);
+ if (def == NULL) {
+ return (0);
+ }
+ type = def->def.ty.old_type;
+ rel = def->def.ty.rel;
+ }
+ }
+
+ return (0);
+}
+
+char *
+locase(const char *str)
+{
+ char c;
+ static char buf[100];
+ char *p = buf;
+
+ while ( (c = *str++) ) {
+ *p++ = (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c;
+ }
+ *p = 0;
+ return (buf);
+}
+
+void
+pvname_svc(const char *pname, const char *vnum)
+{
+ f_print(fout, "%s_%s_svc", locase(pname), vnum);
+}
+
+void
+pvname(const char *pname, const char *vnum)
+{
+ f_print(fout, "%s_%s", locase(pname), vnum);
+}
+
+/*
+ * print a useful (?) error message, and then die
+ */
+void
+error(const char *msg)
+{
+ printwhere();
+ warnx("%s, line %d: %s", infilename, linenum, msg);
+ crash();
+}
+
+/*
+ * Something went wrong, unlink any files that we may have created and then
+ * die.
+ */
+void __dead2
+crash(void)
+{
+ int i;
+
+ for (i = 0; i < nfiles; i++) {
+ (void) unlink(outfiles[i]);
+ }
+ exit(1);
+}
+
+void
+record_open(const char *file)
+{
+ if (nfiles < NFILES) {
+ outfiles[nfiles++] = file;
+ } else {
+ warnx("too many files");
+ crash();
+ }
+}
+
+static char expectbuf[100];
+static const char *toktostr(tok_kind kind);
+
+/*
+ * error, token encountered was not the expected one
+ */
+void
+expected1(tok_kind exp1)
+{
+ s_print(expectbuf, "expected '%s'",
+ toktostr(exp1));
+ error(expectbuf);
+}
+
+/*
+ * error, token encountered was not one of two expected ones
+ */
+void
+expected2(tok_kind exp1, tok_kind exp2)
+{
+ s_print(expectbuf, "expected '%s' or '%s'",
+ toktostr(exp1),
+ toktostr(exp2));
+ error(expectbuf);
+}
+
+/*
+ * error, token encountered was not one of 3 expected ones
+ */
+void
+expected3(tok_kind exp1, tok_kind exp2, tok_kind exp3)
+{
+ s_print(expectbuf, "expected '%s', '%s' or '%s'",
+ toktostr(exp1),
+ toktostr(exp2),
+ toktostr(exp3));
+ error(expectbuf);
+}
+
+void
+tabify(FILE *f, int tab)
+{
+ while (tab--) {
+ (void) fputc('\t', f);
+ }
+}
+
+
+static token tokstrings[] = {
+ {TOK_IDENT, "identifier"},
+ {TOK_CONST, "const"},
+ {TOK_RPAREN, ")"},
+ {TOK_LPAREN, "("},
+ {TOK_RBRACE, "}"},
+ {TOK_LBRACE, "{"},
+ {TOK_LBRACKET, "["},
+ {TOK_RBRACKET, "]"},
+ {TOK_STAR, "*"},
+ {TOK_COMMA, ","},
+ {TOK_EQUAL, "="},
+ {TOK_COLON, ":"},
+ {TOK_SEMICOLON, ";"},
+ {TOK_UNION, "union"},
+ {TOK_STRUCT, "struct"},
+ {TOK_SWITCH, "switch"},
+ {TOK_CASE, "case"},
+ {TOK_DEFAULT, "default"},
+ {TOK_ENUM, "enum"},
+ {TOK_TYPEDEF, "typedef"},
+ {TOK_INT, "int"},
+ {TOK_SHORT, "short"},
+ {TOK_LONG, "long"},
+ {TOK_UNSIGNED, "unsigned"},
+ {TOK_DOUBLE, "double"},
+ {TOK_FLOAT, "float"},
+ {TOK_CHAR, "char"},
+ {TOK_STRING, "string"},
+ {TOK_OPAQUE, "opaque"},
+ {TOK_BOOL, "bool"},
+ {TOK_VOID, "void"},
+ {TOK_PROGRAM, "program"},
+ {TOK_VERSION, "version"},
+ {TOK_EOF, "??????"}
+};
+
+static const char *
+toktostr(tok_kind kind)
+{
+ token *sp;
+
+ for (sp = tokstrings; sp->kind != TOK_EOF && sp->kind != kind; sp++);
+ return (sp->str);
+}
+
+static void
+printbuf(void)
+{
+ char c;
+ int i;
+ int cnt;
+
+# define TABSIZE 4
+
+ for (i = 0; (c = curline[i]); i++) {
+ if (c == '\t') {
+ cnt = 8 - (i % TABSIZE);
+ c = ' ';
+ } else {
+ cnt = 1;
+ }
+ while (cnt--) {
+ (void) fputc(c, stderr);
+ }
+ }
+}
+
+static void
+printwhere(void)
+{
+ int i;
+ char c;
+ int cnt;
+
+ printbuf();
+ for (i = 0; i < where - curline; i++) {
+ c = curline[i];
+ if (c == '\t') {
+ cnt = 8 - (i % TABSIZE);
+ } else {
+ cnt = 1;
+ }
+ while (cnt--) {
+ (void) fputc('^', stderr);
+ }
+ }
+ (void) fputc('\n', stderr);
+}
+
+char *
+make_argname(const char *pname, const char *vname)
+{
+ char *name;
+
+ name = xmalloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3);
+ sprintf(name, "%s_%s_%s", locase(pname), vname, ARGEXT);
+ return (name);
+}
+
+bas_type *typ_list_h;
+bas_type *typ_list_t;
+
+void
+add_type(int len, const char *type)
+{
+ bas_type *ptr;
+
+ ptr = XALLOC(bas_type);
+
+ ptr->name = type;
+ ptr->length = len;
+ ptr->next = NULL;
+ if (typ_list_t == NULL)
+ {
+
+ typ_list_t = ptr;
+ typ_list_h = ptr;
+ }
+ else
+ {
+ typ_list_t->next = ptr;
+ typ_list_t = ptr;
+ }
+}
+
+
+bas_type *
+find_type(const char *type)
+{
+ bas_type * ptr;
+
+ ptr = typ_list_h;
+ while (ptr != NULL)
+ {
+ if (strcmp(ptr->name, type) == 0)
+ return (ptr);
+ else
+ ptr = ptr->next;
+ }
+ return (NULL);
+}
+
+void *
+xmalloc(size_t size)
+{
+ void *p;
+
+ if ((p = malloc(size)) == NULL) {
+ warnx("malloc failed");
+ crash();
+ }
+ return (p);
+}
+
+void *
+xrealloc(void *ptr, size_t size)
+{
+ void *p;
+
+ if ((p = realloc(ptr, size)) == NULL) {
+ warnx("realloc failed");
+ crash();
+ }
+ return (p);
+}
+
+char *
+xstrdup(const char *str)
+{
+ char *p;
+
+ if ((p = strdup(str)) == NULL) {
+ warnx("strdup failed");
+ crash();
+ }
+ return (p);
+}
diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h
new file mode 100644
index 0000000..59f38ee
--- /dev/null
+++ b/usr.bin/rpcgen/rpc_util.h
@@ -0,0 +1,230 @@
+/*
+ * $FreeBSD$
+ */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* #pragma ident "@(#)rpc_util.h 1.16 94/05/15 SMI" */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
+/* The copyright notice above does not evidence any */
+/* actual or intended publication of such source code. */
+
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+* PROPRIETARY NOTICE (Combined)
+*
+* This source code is unpublished proprietary information
+* constituting, or derived under license from AT&T's UNIX(r) System V.
+* In addition, portions of such source code were derived from Berkeley
+* 4.3 BSD under license from the Regents of the University of
+* California.
+*
+*
+*
+* Copyright Notice
+*
+* Notice of copyright on this source code product does not indicate
+* publication.
+*
+* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
+* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
+* All rights reserved.
+*/
+
+/* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
+
+/*
+ * rpc_util.h, Useful definitions for the RPC protocol compiler
+ */
+#include <sys/types.h>
+#include <stdlib.h>
+
+#define XALLOC(object) (object *) xmalloc(sizeof(object))
+
+#define s_print (void) sprintf
+#define f_print (void) fprintf
+
+struct list {
+ definition *val;
+ struct list *next;
+};
+typedef struct list list;
+
+struct xdrfunc {
+ const char *name;
+ int pointerp;
+ struct xdrfunc *next;
+};
+typedef struct xdrfunc xdrfunc;
+
+struct commandline {
+ int cflag; /* xdr C routines */
+ int hflag; /* header file */
+ int lflag; /* client side stubs */
+ int mflag; /* server side stubs */
+ int nflag; /* netid flag */
+ int sflag; /* server stubs for the given transport */
+ int tflag; /* dispatch Table file */
+ int Ssflag; /* produce server sample code */
+ int Scflag; /* produce client sample code */
+ int makefileflag; /* Generate a template Makefile */
+ const char *infile; /* input module name */
+ const char *outfile; /* output module name */
+};
+
+#define PUT 1
+#define GET 2
+
+/*
+ * Global variables
+ */
+#define MAXLINESIZE 1024
+extern char curline[MAXLINESIZE];
+extern char *where;
+extern int linenum;
+extern int tirpc_socket;
+
+extern const char *infilename;
+extern FILE *fout;
+extern FILE *fin;
+
+extern list *defined;
+
+
+extern bas_type *typ_list_h;
+extern bas_type *typ_list_t;
+extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
+
+/*
+ * All the option flags
+ */
+extern int inetdflag;
+extern int pmflag;
+extern int tblflag;
+extern int logflag;
+extern int newstyle;
+extern int CCflag; /* C++ flag */
+extern int tirpcflag; /* flag for generating tirpc code */
+extern int inline_size; /* if this is 0, then do not generate inline code */
+extern int mtflag;
+
+/*
+ * Other flags related with inetd jumpstart.
+ */
+extern int indefinitewait;
+extern int exitnow;
+extern int timerflag;
+
+extern int nonfatalerrors;
+
+extern pid_t childpid;
+
+/*
+ * rpc_util routines
+ */
+void reinitialize(void);
+void crash(void) __dead2;
+void add_type(int len, const char *type);
+void storeval(list **lstp, definition *val);
+void *xmalloc(size_t size);
+void *xrealloc(void *ptr, size_t size);
+char *xstrdup(const char *);
+char *make_argname(const char *pname, const char *vname);
+
+#define STOREVAL(list,item) \
+ storeval(list,item)
+
+definition *findval(list *lst, const char *val, int (*cmp)(definition *, const char *));
+
+#define FINDVAL(list,item,finder) \
+ findval(list, item, finder)
+
+const char *fixtype(const char *type);
+const char *stringfix(const char *type);
+char *locase(const char *str);
+void pvname_svc(const char *pname, const char *vnum);
+void pvname(const char *pname, const char *vnum);
+void ptype(const char *prefix, const char *type, int follow);
+int isvectordef(const char *type, relation rel);
+int streq(const char *a, const char *b);
+void error(const char *msg);
+void expected1(tok_kind exp1);
+void expected2(tok_kind exp1, tok_kind exp2);
+void expected3(tok_kind exp1, tok_kind exp2, tok_kind exp3);
+void tabify(FILE *f, int tab);
+void record_open(const char *file);
+bas_type *find_type(const char *type);
+
+/*
+ * rpc_cout routines
+ */
+void emit(definition *def);
+
+/*
+ * rpc_hout routines
+ */
+void pdeclaration(const char *name, declaration *dec, int tab, const char *separator);
+void print_datadef(definition *def, int headeronly);
+void print_funcdef(definition *def, int headeronly);
+void print_xdr_func_def(const char* name, int pointerp);
+
+/*
+ * rpc_svcout routines
+ */
+void write_most(const char *infile, int netflag, int nomain);
+void write_rest(void);
+void write_programs(const char *storage);
+void write_svc_aux(int nomain);
+void write_inetd_register(const char *transp);
+void write_netid_register(const char *transp);
+void write_nettype_register(const char *transp);
+int nullproc(proc_list *proc);
+
+/*
+ * rpc_clntout routines
+ */
+void write_stubs(void);
+void printarglist(proc_list *proc, const char *result, const char *addargname,
+ const char *addargtype);
+
+/*
+ * rpc_tblout routines
+ */
+void write_tables(void);
+
+/*
+ * rpc_sample routines
+ */
+void write_sample_svc(definition *);
+int write_sample_clnt(definition *);
+void write_sample_clnt_main(void);
+void add_sample_msg(void);
diff --git a/usr.bin/rpcgen/rpcgen.1 b/usr.bin/rpcgen/rpcgen.1
new file mode 100644
index 0000000..d4b1bfc
--- /dev/null
+++ b/usr.bin/rpcgen/rpcgen.1
@@ -0,0 +1,536 @@
+.\" @(#)rpcgen.1 1.35 93/06/02 SMI
+.\" $FreeBSD$
+.\" Copyright 1985-1993 Sun Microsystems, Inc.
+.\"
+.Dd September 2, 2005
+.Dt RPCGEN 1
+.Os
+.Sh NAME
+.Nm rpcgen
+.Nd an RPC protocol compiler
+.Sh SYNOPSIS
+.Nm
+.Ar infile
+.Nm
+.Op Fl a
+.Op Fl b
+.Op Fl C
+.Oo
+.Fl D Ns Ar name Ns Op Ar =value
+.Oc
+.Op Fl i Ar size
+.Op Fl I Fl P Op Fl K Ar seconds
+.Op Fl L
+.Op Fl M
+.Op Fl N
+.Op Fl T
+.Op Fl Y Ar pathname
+.Ar infile
+.Nm
+.Oo
+.Fl c |
+.Fl h |
+.Fl l |
+.Fl m |
+.Fl t |
+.Fl \&Sc |
+.Fl \&Ss |
+.Fl \&Sm
+.Oc
+.Op Fl o Ar outfile
+.Op Ar infile
+.Nm
+.Op Fl s Ar nettype
+.Op Fl o Ar outfile
+.Op Ar infile
+.Nm
+.Op Fl n Ar netid
+.Op Fl o Ar outfile
+.Op Ar infile
+.\" .SH AVAILABILITY
+.\" .LP
+.\" SUNWcsu
+.Sh DESCRIPTION
+The
+.Nm
+utility is a tool that generates C code to implement an
+.Tn RPC
+protocol.
+The input to
+.Nm
+is a language similar to C known as
+.Tn RPC
+Language (Remote Procedure Call Language).
+.Pp
+The
+.Nm
+utility is normally used as in the first synopsis where
+it takes an input file and generates three output files.
+If the
+.Ar infile
+is named
+.Pa proto.x ,
+then
+.Nm
+generates a header in
+.Pa proto.h ,
+XDR routines in
+.Pa proto_xdr.c ,
+server-side stubs in
+.Pa proto_svc.c ,
+and client-side stubs in
+.Pa proto_clnt.c .
+With the
+.Fl T
+option,
+it also generates the
+.Tn RPC
+dispatch table in
+.Pa proto_tbl.i .
+.Pp
+The
+.Nm
+utility can also generate sample client and server files
+that can be customized to suit a particular application.
+The
+.Fl \&Sc ,
+.Fl \&Ss
+and
+.Fl \&Sm
+options generate sample client, server and makefile, respectively.
+The
+.Fl a
+option generates all files, including sample files.
+If the
+.Ar infile
+is
+.Pa proto.x ,
+then the client side sample file is written to
+.Pa proto_client.c ,
+the server side sample file to
+.Pa proto_server.c
+and the sample makefile to
+.Pa makefile.proto .
+.Pp
+If option
+.Fl I
+is set,
+the server created can be started both by the port monitors
+(for example,
+.Xr inetd 8 )
+or by itself.
+When it is started by a port monitor,
+it creates servers only for the transport for which
+the file descriptor
+.Em 0
+was passed.
+The name of the transport may be specified
+by setting up the environment variable
+.Ev NLSPROVIDER .
+When the server generated by
+.Nm
+is executed,
+it creates server handles for all the transports
+specified in
+.Ev NETPATH
+environment variable,
+or if it is unset,
+it creates server handles for all the visible transports from
+.Pa /etc/netconfig
+file.
+Note:
+the transports are chosen at run time and not at compile time.
+When the server is self-started,
+it backgrounds itself by default.
+A special define symbol
+.Em RPC_SVC_FG
+can be used to run the server process in foreground.
+.Pp
+The second synopsis provides special features which allow
+for the creation of more sophisticated
+.Tn RPC
+servers.
+These features include support for user provided
+.Em #defines
+and
+.Tn RPC
+dispatch tables.
+The entries in the
+.Tn RPC
+dispatch table contain:
+.Bl -bullet -offset indent -compact
+.It
+pointers to the service routine corresponding to that procedure,
+.It
+a pointer to the input and output arguments,
+.It
+the size of these routines.
+.El
+A server can use the dispatch table to check authorization
+and then to execute the service routine;
+a client library may use it to deal with the details of storage
+management and XDR data conversion.
+.Pp
+The other three synopses shown above are used when
+one does not want to generate all the output files,
+but only a particular one.
+See the
+.Sx EXAMPLES
+section below for examples of
+.Nm
+usage.
+When
+.Nm
+is executed with the
+.Fl s
+option,
+it creates servers for that particular class of transports.
+When
+executed with the
+.Fl n
+option,
+it creates a server for the transport specified by
+.Ar netid .
+If
+.Ar infile
+is not specified,
+.Nm
+accepts the standard input.
+.Pp
+The C preprocessor,
+.Em cc -E
+is run on the input file before it is actually interpreted by
+.Nm .
+For each type of output file,
+.Nm
+defines a special preprocessor symbol for use by the
+.Nm
+programmer:
+.Bl -tag -width indent
+.It RPC_HDR
+defined when compiling into headers
+.It RPC_XDR
+defined when compiling into XDR routines
+.It RPC_SVC
+defined when compiling into server-side stubs
+.It RPC_CLNT
+defined when compiling into client-side stubs
+.It RPC_TBL
+defined when compiling into RPC dispatch tables
+.El
+.Pp
+Any line beginning with
+.Dq %
+is passed directly into the output file,
+uninterpreted by
+.Nm .
+To specify the path name of the C preprocessor use
+.Fl Y
+flag.
+.Pp
+For every data type referred to in
+.Ar infile ,
+.Nm
+assumes that there exists a
+routine with the string
+.Em xdr_
+prepended to the name of the data type.
+If this routine does not exist in the
+.Tn RPC/XDR
+library, it must be provided.
+Providing an undefined data type
+allows customization of
+.Xr xdr 3
+routines.
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Generate all files, including sample files.
+.It Fl b
+Backward compatibility mode.
+Generate transport specific
+.Tn RPC
+code for older versions
+of the operating system.
+.It Fl c
+Compile into
+.Tn XDR
+routines.
+.It Fl C
+Generate ANSI C code.
+This is always done, the flag is only provided for backwards compatibility.
+.It Fl D Ns Ar name
+.It Fl D Ns Ar name=value
+.\".It Fl D Ns Ar name Ns Op Ar =value
+Define a symbol
+.Ar name .
+Equivalent to the
+.Em #define
+directive in the source.
+If no
+.Ar value
+is given,
+.Ar value
+is defined as
+.Em 1 .
+This option may be specified more than once.
+.It Fl h
+Compile into C data-definitions (a header).
+.Fl T
+option can be used in conjunction to produce a
+header which supports
+.Tn RPC
+dispatch tables.
+.It Fl i Ar size
+Size at which to start generating inline code.
+This option is useful for optimization.
+The default size is 5.
+.Pp
+Note: in order to provide backwards compatibility with the older
+.Nm
+on the
+.Fx
+platform, the default is actually 0 (which means
+that inline code generation is disabled by default).
+You must specify
+a non-zero value explicitly to override this default.
+.It Fl I
+Compile support for
+.Xr inetd 8
+in the server side stubs.
+Such servers can be self-started or can be started by
+.Xr inetd 8 .
+When the server is self-started, it backgrounds itself by default.
+A special define symbol
+.Em RPC_SVC_FG
+can be used to run the
+server process in foreground, or the user may simply compile without
+the
+.Fl I
+option.
+.Pp
+If there are no pending client requests, the
+.Xr inetd 8
+servers exit after 120 seconds (default).
+The default can be changed with the
+.Fl K
+option.
+All the error messages for
+.Xr inetd 8
+servers
+are always logged with
+.Xr syslog 3 .
+.Pp
+Note:
+Contrary to some systems, in
+.Fx
+this option is needed to generate
+servers that can be invoked through portmonitors and
+.Xr inetd 8 .
+.It Fl K Ar seconds
+By default, services created using
+.Nm
+and invoked through
+port monitors wait 120 seconds
+after servicing a request before exiting.
+That interval can be changed using the
+.Fl K
+flag.
+To create a server that exits immediately upon servicing a request,
+use
+.Fl K Ar 0 .
+To create a server that never exits, the appropriate argument is
+.Fl K Ar -1 .
+.Pp
+When monitoring for a server,
+some portmonitors
+.Em always
+spawn a new process in response to a service request.
+If it is known that a server will be used with such a monitor, the
+server should exit immediately on completion.
+For such servers,
+.Nm
+should be used with
+.Fl K Ar 0 .
+.It Fl l
+Compile into client-side stubs.
+.It Fl L
+When the servers are started in foreground, use
+.Xr syslog 3
+to log the server errors instead of printing them on the standard
+error.
+.It Fl m
+Compile into server-side stubs,
+but do not generate a
+.Qq main
+routine.
+This option is useful for doing callback-routines
+and for users who need to write their own
+.Qq main
+routine to do initialization.
+.It Fl M
+Generate multithread-safe stubs for passing arguments and results between
+rpcgen generated code and user written code.
+This option is useful
+for users who want to use threads in their code.
+However, the
+.Xr rpc_svc_calls 3
+functions are not yet MT-safe, which means that rpcgen generated server-side
+code will not be MT-safe.
+.It Fl N
+Allow procedures to have multiple arguments.
+It also uses the style of parameter passing that closely resembles C.
+So, when passing an argument to a remote procedure, you do not have to
+pass a pointer to the argument, but can pass the argument itself.
+This behavior is different from the old style of
+.Nm
+generated code.
+To maintain backward compatibility,
+this option is not the default.
+.It Fl n Ar netid
+Compile into server-side stubs for the transport
+specified by
+.Ar netid .
+There should be an entry for
+.Ar netid
+in the
+netconfig database.
+This option may be specified more than once,
+so as to compile a server that serves multiple transports.
+.It Fl o Ar outfile
+Specify the name of the output file.
+If none is specified,
+standard output is used
+.Fl ( c ,
+.Fl h ,
+.Fl l ,
+.Fl m ,
+.Fl n ,
+.Fl s ,
+.Fl \&Sc ,
+.Fl \&Sm ,
+.Fl \&Ss ,
+and
+.Fl t
+modes only).
+.It Fl P
+Compile support for
+port monitors
+in the server side stubs.
+.Pp
+Note:
+Contrary to some systems, in
+.Fx
+this option is needed to generate
+servers that can be monitored.
+.Pp
+If the
+.Fl I
+option has been specified,
+.Fl P
+is turned off automatically.
+.It Fl s Ar nettype
+Compile into server-side stubs for all the
+transports belonging to the class
+.Ar nettype .
+The supported classes are
+.Em netpath ,
+.Em visible ,
+.Em circuit_n ,
+.Em circuit_v ,
+.Em datagram_n ,
+.Em datagram_v ,
+.Em tcp ,
+and
+.Em udp
+(see
+.Xr rpc 3
+for the meanings associated with these classes).
+This option may be specified more than once.
+Note:
+the transports are chosen at run time and not at compile time.
+.It Fl \&Sc
+Generate sample client code that uses remote procedure calls.
+.It Fl \&Sm
+Generate a sample
+.Pa Makefile
+which can be used for compiling the application.
+.It Fl \&Ss
+Generate sample server code that uses remote procedure calls.
+.It Fl t
+Compile into
+.Tn RPC
+dispatch table.
+.It Fl T
+Generate the code to support
+.Tn RPC
+dispatch tables.
+.Pp
+The options
+.Fl c ,
+.Fl h ,
+.Fl l ,
+.Fl m ,
+.Fl s ,
+.Fl \&Sc ,
+.Fl \&Sm ,
+.Fl \&Ss ,
+and
+.Fl t
+are used exclusively to generate a particular type of file,
+while the options
+.Fl D
+and
+.Fl T
+are global and can be used with the other options.
+.It Fl Y Ar pathname
+Give the name of the directory where
+.Nm
+will start looking for the C-preprocessor.
+.El
+.Sh ENVIRONMENT
+If the
+.Ev RPCGEN_CPP
+environment variable is set, its value is used as the command line of the
+C preprocessor to be run on the input file.
+.Sh EXAMPLES
+The following example:
+.Dl example% rpcgen -T prot.x
+.Pp
+generates all the five files:
+.Pa prot.h ,
+.Pa prot_clnt.c ,
+.Pa prot_svc.c ,
+.Pa prot_xdr.c
+and
+.Pa prot_tbl.i .
+.Pp
+The following example sends the C data-definitions (header)
+to the standard output.
+.Dl example% rpcgen -h prot.x
+.Pp
+To send the test version of the
+.Fl D Ns Ar TEST ,
+server side stubs for
+all the transport belonging to the class
+.Ar datagram_n
+to standard output, use:
+.Dl example% rpcgen -s datagram_n -DTEST prot.x
+.Pp
+To create the server side stubs for the transport indicated
+by
+.Ar netid
+tcp,
+use:
+.Dl example% rpcgen -n tcp -o prot_svc.c prot.x
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr rpc 3 ,
+.Xr rpc_svc_calls 3 ,
+.Xr syslog 3 ,
+.Xr xdr 3 ,
+.Xr inetd 8
+.Rs
+.%T The rpcgen chapter in the NETP manual
+.Re
diff --git a/usr.bin/rpcinfo/Makefile b/usr.bin/rpcinfo/Makefile
new file mode 100644
index 0000000..3c8e51c
--- /dev/null
+++ b/usr.bin/rpcinfo/Makefile
@@ -0,0 +1,12 @@
+# from: @(#)Makefile 5.2 (Berkeley) 5/11/90
+# $FreeBSD$
+
+PROG= rpcinfo
+SRCS= rpcinfo.c
+MAN= rpcinfo.8
+
+CFLAGS+= -DPORTMAP
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rpcinfo/Makefile.depend b/usr.bin/rpcinfo/Makefile.depend
new file mode 100644
index 0000000..1eb0f33
--- /dev/null
+++ b/usr.bin/rpcinfo/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ 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/rpcinfo/rpcinfo.8 b/usr.bin/rpcinfo/rpcinfo.8
new file mode 100644
index 0000000..f4c7fc7
--- /dev/null
+++ b/usr.bin/rpcinfo/rpcinfo.8
@@ -0,0 +1,341 @@
+.\" @(#)rpcinfo.1m 1.23 93/03/29 SMI; from SVr4
+.\" Copyright 1989 AT&T
+.\" Copyright 1991 Sun Microsystems, Inc.
+.\" $NetBSD: rpcinfo.8,v 1.6 2000/06/02 23:19:38 fvdl Exp $
+.\" $FreeBSD$
+.Dd August 18, 1992
+.Dt RPCINFO 8
+.Os
+.Sh NAME
+.Nm rpcinfo
+.Nd report RPC information
+.Sh SYNOPSIS
+.Nm
+.Op Fl m | s
+.Op Ar host
+.Nm
+.Op Ar host
+.Nm
+.Fl T Ar transport
+.Ar host prognum
+.Op Ar versnum
+.Nm
+.Fl l
+.Op Fl T Ar transport
+.Ar host prognum
+.Op Ar versnum
+.Nm
+.Op Fl n Ar portnum
+.Fl u
+.Ar host prognum
+.Op Ar versnum
+.Nm
+.Op Fl n Ar portnum
+.Op Fl t
+.Ar host prognum
+.Op Ar versnum
+.Nm
+.Fl a Ar serv_address
+.Fl T Ar transport
+.Ar prognum
+.Op Ar versnum
+.Nm
+.Fl b
+.Op Fl T Ar transport
+.Ar prognum versnum
+.Nm
+.Fl d
+.Op Fl T Ar transport
+.Ar prognum versnum
+.Sh DESCRIPTION
+The
+.Nm
+utility makes an RPC call to an RPC
+server and reports what it finds.
+.Pp
+In the first synopsis,
+.Nm
+lists all the registered RPC services with
+.Nm rpcbind
+on
+.Ar host .
+If
+.Ar host
+is not specified, the local host is the default.
+If
+.Fl s
+is used, the information is displayed in a concise format.
+.Pp
+In the second synopsis,
+.Nm
+lists all the RPC services registered with
+.Nm rpcbind ,
+version 2.
+Also note that the format of the information
+is different in the first and the second synopsis.
+This is because the second synopsis is an older protocol used to
+collect the information displayed (version 2 of the
+.Nm rpcbind
+protocol).
+.Pp
+The third synopsis makes an RPC call to procedure 0
+of
+.Ar prognum
+and
+.Ar versnum
+on the specified
+.Ar host
+and reports whether a response was received.
+.Ar transport
+is the transport which has to be used for contacting the
+given service.
+The remote address of the service is obtained by
+making a call to the remote
+.Nm rpcbind .
+.Pp
+The
+.Ar prognum
+argument is a number that represents an RPC program number
+If a
+.Ar versnum
+is specified,
+.Nm
+attempts to call that version of the specified
+.Ar prognum .
+Otherwise,
+.Nm
+attempts to find all the registered version
+numbers for the specified
+.Ar prognum
+by calling version 0,
+which is presumed not to exist;
+if it does exist,
+.Nm
+attempts to obtain this information by calling
+an extremely high version number instead,
+and attempts to call each registered version.
+Note:
+the version number is required for
+.Fl b
+and
+.Fl d
+options.
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl T Ar transport
+Specify the transport on which the service is required.
+If this option is not specified,
+.Nm
+uses the transport specified in the
+.Ev NETPATH
+environment variable, or if that is unset or empty, the transport
+in the
+.Xr netconfig 5
+database is used.
+This is a generic option,
+and can be used in conjunction with other options as
+shown in the
+.Sx SYNOPSIS .
+.It Fl a Ar serv_address
+Use
+.Ar serv_address
+as the (universal) address for the service on
+.Ar transport
+to ping procedure 0
+of the specified
+.Ar prognum
+and report whether a response was received.
+The
+.Fl T
+option is required with the
+.Fl a
+option.
+.Pp
+If
+.Ar versnum
+is not specified,
+.Nm
+tries to ping all
+available version numbers for that program number.
+This option avoids calls to remote
+.Nm rpcbind
+to find the address of the service.
+The
+.Ar serv_address
+is specified in universal address format of the given transport.
+.It Fl b
+Make an RPC broadcast to procedure 0
+of the specified
+.Ar prognum
+and
+.Ar versnum
+and report all hosts that respond.
+If
+.Ar transport
+is specified, it broadcasts its request only on the
+specified transport.
+If broadcasting is not supported by any
+transport,
+an error message is printed.
+Use of broadcasting should be limited because of the potential for adverse
+effect on other systems.
+.It Fl d
+Delete registration for the RPC service of the specified
+.Ar prognum
+and
+.Ar versnum .
+If
+.Ar transport
+is specified,
+unregister the service on only that transport,
+otherwise unregister the service on all
+the transports on which it was registered.
+Only the owner of a service can delete a registration, except the
+super-user who can delete any service.
+.It Fl l
+Display a list of entries with a given
+.Ar prognum
+and
+.Ar versnum
+on the specified
+.Ar host .
+Entries are returned for all transports
+in the same protocol family as that used to contact the remote
+.Nm rpcbind .
+.It Fl m
+Display a table of statistics of
+.Nm rpcbind
+operations on the given
+.Ar host .
+The table shows statistics for each version of
+.Nm rpcbind
+(versions 2, 3 and 4), giving the number of times each procedure was
+requested and successfully serviced, the number and type of remote call
+requests that were made, and information about RPC address lookups that were
+handled.
+This is useful for monitoring RPC activities on
+.Ar host .
+.It Fl n Ar portnum
+Use
+.Ar portnum
+as the port number for the
+.Fl t
+and
+.Fl u
+options instead of the port number given by
+.Nm rpcbind .
+Use of this option avoids a call to the remote
+.Nm rpcbind
+to find out the address of the service.
+This option is made
+obsolete by the
+.Fl a
+option.
+.It Fl p
+Probe
+.Nm rpcbind
+on
+.Ar host
+using version 2 of the
+.Nm rpcbind
+protocol,
+and display a list of all registered RPC programs.
+If
+.Ar host
+is not specified, it defaults to the local host.
+Note: Version 2 of the
+.Nm rpcbind
+protocol was previously known as the portmapper protocol.
+.It Fl s
+Display a concise list of all registered RPC programs on
+.Ar host .
+If
+.Ar host
+is not specified, it defaults to the local host.
+.It Fl t
+Make an RPC call to procedure 0 of
+.Ar prognum
+on the specified
+.Ar host
+using TCP,
+and report whether a response was received.
+This option is made
+obsolete by the
+.Fl T
+option as shown in the third synopsis.
+.It Fl u
+Make an RPC call to procedure 0 of
+.Ar prognum
+on the specified
+.Ar host
+using UDP,
+and report whether a response was received.
+This option is made
+obsolete by the
+.Fl T
+option as shown in the third synopsis.
+.El
+.Sh EXAMPLES
+To show all of the RPC services registered on the local machine use:
+.Pp
+.Dl "example% rpcinfo"
+.Pp
+To show all of the RPC
+services registered with
+.Nm rpcbind
+on the machine named
+.Dq klaxon
+use:
+.Pp
+.Dl "example% rpcinfo klaxon"
+.Pp
+The information displayed by the above commands can be quite lengthy.
+Use the
+.Fl s
+option to display a more concise list:
+.Pp
+.Dl "example$ rpcinfo -s klaxon"
+.Bl -column "program" "version(s)" "unix,tcp,udp,tcp6,udp6" "nlockmgr" "super-user"
+.It "program version(s) netid(s) service owner"
+.It "100000 2,3,4 unix,tcp,udp,tcp6,udp6 rpcbind super-user"
+.It "100008 1 udp,tcp,udp6,tcp6 walld super-user"
+.It "100002 2,1 udp,udp6 rusersd super-user"
+.It "100001 2,3,4 udp,udp6 rstatd super-user"
+.It "100012 1 udp,tcp sprayd super-user"
+.It "100007 3 udp,tcp ypbind super-user"
+.El
+.Pp
+To show whether the RPC
+service with program number
+.Ar prognum
+and version
+.Ar versnum
+is
+registered on the machine named
+.Dq klaxon
+for the transport TCP
+use:
+.Pp
+.Dl "example% rpcinfo -T tcp klaxon prognum versnum"
+.Pp
+To show all RPC
+services registered with version 2 of the
+.Nm rpcbind
+protocol on the local machine use:
+.Pp
+.Dl "example% rpcinfo -p"
+.Pp
+To delete the registration for version
+1 of the
+.Nm walld
+(program number 100008)
+service for all transports use:
+.Pp
+.Dl "example# rpcinfo -d 100008 1"
+or
+.Dl "example# rpcinfo -d walld 1"
+.Sh SEE ALSO
+.Xr rpc 3 ,
+.Xr netconfig 5 ,
+.Xr rpc 5 ,
+.Xr rpcbind 8
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
new file mode 100644
index 0000000..3fdcfd1
--- /dev/null
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -0,0 +1,1675 @@
+/* $NetBSD: rpcinfo.c,v 1.15 2000/10/04 20:09:05 mjl Exp $ */
+
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
+ */
+
+/* #ident "@(#)rpcinfo.c 1.18 93/07/05 SMI" */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)rpcinfo.c 1.16 89/04/05 Copyr 1986 Sun Micro";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * rpcinfo: ping a particular rpc program
+ * or dump the registered programs on the remote machine.
+ */
+
+/*
+ * We are for now defining PORTMAP here. It doesn't even compile
+ * unless it is defined.
+ */
+#ifndef PORTMAP
+#define PORTMAP
+#endif
+
+/*
+ * If PORTMAP is defined, rpcinfo will talk to both portmapper and
+ * rpcbind programs; else it talks only to rpcbind. In the latter case
+ * all the portmapper specific options such as -u, -t, -p become void.
+ */
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <rpc/rpc.h>
+#include <stdio.h>
+#include <rpc/rpcb_prot.h>
+#include <rpc/rpcent.h>
+#include <rpc/nettype.h>
+#include <rpc/rpc_com.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+#include <ctype.h>
+
+#ifdef PORTMAP /* Support for version 2 portmapper */
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
+#endif
+
+#define MAXHOSTLEN 256
+#define MIN_VERS ((u_long) 0)
+#define MAX_VERS ((u_long) 4294967295UL)
+#define UNKNOWN "unknown"
+
+/*
+ * Functions to be performed.
+ */
+#define NONE 0 /* no function */
+#define PMAPDUMP 1 /* dump portmapper registrations */
+#define TCPPING 2 /* ping TCP service */
+#define UDPPING 3 /* ping UDP service */
+#define BROADCAST 4 /* ping broadcast service */
+#define DELETES 5 /* delete registration for the service */
+#define ADDRPING 6 /* pings at the given address */
+#define PROGPING 7 /* pings a program on a given host */
+#define RPCBDUMP 8 /* dump rpcbind registrations */
+#define RPCBDUMP_SHORT 9 /* dump rpcbind registrations - short version */
+#define RPCBADDRLIST 10 /* dump addr list about one prog */
+#define RPCBGETSTAT 11 /* Get statistics */
+
+struct netidlist {
+ char *netid;
+ struct netidlist *next;
+};
+
+struct verslist {
+ int vers;
+ struct verslist *next;
+};
+
+struct rpcbdump_short {
+ u_long prog;
+ struct verslist *vlist;
+ struct netidlist *nlist;
+ struct rpcbdump_short *next;
+ char *owner;
+};
+
+
+
+#ifdef PORTMAP
+static void ip_ping(u_short, const char *, int, char **);
+static CLIENT *clnt_com_create(struct sockaddr_in *, u_long, u_long, int *,
+ const char *);
+static void pmapdump(int, char **);
+static void get_inet_address(struct sockaddr_in *, char *);
+#endif
+
+static bool_t reply_proc(void *, struct netbuf *, struct netconfig *);
+static void brdcst(int, char **);
+static void addrping(char *, char *, int, char **);
+static void progping(char *, int, char **);
+static CLIENT *clnt_addr_create(char *, struct netconfig *, u_long, u_long);
+static CLIENT *clnt_rpcbind_create(char *, int, struct netbuf **);
+static CLIENT *getclnthandle(char *, struct netconfig *, u_long,
+ struct netbuf **);
+static CLIENT *local_rpcb(u_long, u_long);
+static int pstatus(CLIENT *, u_long, u_long);
+static void rpcbdump(int, char *, int, char **);
+static void rpcbgetstat(int, char **);
+static void rpcbaddrlist(char *, int, char **);
+static void deletereg(char *, int, char **);
+static void print_rmtcallstat(int, rpcb_stat *);
+static void print_getaddrstat(int, rpcb_stat *);
+static void usage(void);
+static u_long getprognum(char *);
+static u_long getvers(char *);
+static char *spaces(int);
+static bool_t add_version(struct rpcbdump_short *, u_long);
+static bool_t add_netid(struct rpcbdump_short *, char *);
+
+int
+main(int argc, char **argv)
+{
+ register int c;
+ int errflg;
+ int function;
+ char *netid = NULL;
+ char *address = NULL;
+#ifdef PORTMAP
+ char *strptr;
+ u_short portnum = 0;
+#endif
+
+ function = NONE;
+ errflg = 0;
+#ifdef PORTMAP
+ while ((c = getopt(argc, argv, "a:bdlmn:pstT:u")) != -1) {
+#else
+ while ((c = getopt(argc, argv, "a:bdlmn:sT:")) != -1) {
+#endif
+ switch (c) {
+#ifdef PORTMAP
+ case 'p':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = PMAPDUMP;
+ break;
+
+ case 't':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = TCPPING;
+ break;
+
+ case 'u':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = UDPPING;
+ break;
+
+ case 'n':
+ portnum = (u_short) strtol(optarg, &strptr, 10);
+ if (strptr == optarg || *strptr != '\0')
+ errx(1, "%s is illegal port number", optarg);
+ break;
+#endif
+ case 'a':
+ address = optarg;
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = ADDRPING;
+ break;
+ case 'b':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = BROADCAST;
+ break;
+
+ case 'd':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = DELETES;
+ break;
+
+ case 'l':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = RPCBADDRLIST;
+ break;
+
+ case 'm':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = RPCBGETSTAT;
+ break;
+
+ case 's':
+ if (function != NONE)
+ errflg = 1;
+ else
+ function = RPCBDUMP_SHORT;
+ break;
+
+ case 'T':
+ netid = optarg;
+ break;
+ case '?':
+ errflg = 1;
+ break;
+ }
+ }
+
+ if (errflg || ((function == ADDRPING) && !netid))
+ usage();
+
+ if (function == NONE) {
+ if (argc - optind > 1)
+ function = PROGPING;
+ else
+ function = RPCBDUMP;
+ }
+
+ switch (function) {
+#ifdef PORTMAP
+ case PMAPDUMP:
+ if (portnum != 0)
+ usage();
+ pmapdump(argc - optind, argv + optind);
+ break;
+
+ case UDPPING:
+ ip_ping(portnum, "udp", argc - optind, argv + optind);
+ break;
+
+ case TCPPING:
+ ip_ping(portnum, "tcp", argc - optind, argv + optind);
+ break;
+#endif
+ case BROADCAST:
+ brdcst(argc - optind, argv + optind);
+ break;
+ case DELETES:
+ deletereg(netid, argc - optind, argv + optind);
+ break;
+ case ADDRPING:
+ addrping(address, netid, argc - optind, argv + optind);
+ break;
+ case PROGPING:
+ progping(netid, argc - optind, argv + optind);
+ break;
+ case RPCBDUMP:
+ case RPCBDUMP_SHORT:
+ rpcbdump(function, netid, argc - optind, argv + optind);
+ break;
+ case RPCBGETSTAT:
+ rpcbgetstat(argc - optind, argv + optind);
+ break;
+ case RPCBADDRLIST:
+ rpcbaddrlist(netid, argc - optind, argv + optind);
+ break;
+ }
+ return (0);
+}
+
+static CLIENT *
+local_rpcb(u_long prog, u_long vers)
+{
+ void *localhandle;
+ struct netconfig *nconf;
+ CLIENT *clnt;
+
+ localhandle = setnetconfig();
+ while ((nconf = getnetconfig(localhandle)) != NULL) {
+ if (nconf->nc_protofmly != NULL &&
+ strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
+ break;
+ }
+ if (nconf == NULL) {
+ warnx("getnetconfig: %s", nc_sperror());
+ return (NULL);
+ }
+
+ clnt = clnt_tp_create(NULL, prog, vers, nconf);
+ endnetconfig(localhandle);
+ return clnt;
+}
+
+#ifdef PORTMAP
+static CLIENT *
+clnt_com_create(struct sockaddr_in *addr, u_long prog, u_long vers,
+ int *fdp, const char *trans)
+{
+ CLIENT *clnt;
+
+ if (strcmp(trans, "tcp") == 0) {
+ clnt = clnttcp_create(addr, prog, vers, fdp, 0, 0);
+ } else {
+ struct timeval to;
+
+ to.tv_sec = 5;
+ to.tv_usec = 0;
+ clnt = clntudp_create(addr, prog, vers, to, fdp);
+ }
+ if (clnt == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo");
+ if (vers == MIN_VERS)
+ printf("program %lu is not available\n", prog);
+ else
+ printf("program %lu version %lu is not available\n",
+ prog, vers);
+ exit(1);
+ }
+ return (clnt);
+}
+
+/*
+ * If portnum is 0, then go and get the address from portmapper, which happens
+ * transparently through clnt*_create(); If version number is not given, it
+ * tries to find out the version number by making a call to version 0 and if
+ * that fails, it obtains the high order and the low order version number. If
+ * version 0 calls succeeds, it tries for MAXVERS call and repeats the same.
+ */
+static void
+ip_ping(u_short portnum, const char *trans, int argc, char **argv)
+{
+ CLIENT *client;
+ int fd = RPC_ANYFD;
+ struct timeval to;
+ struct sockaddr_in addr;
+ enum clnt_stat rpc_stat;
+ u_long prognum, vers, minvers, maxvers;
+ struct rpc_err rpcerr;
+ int failure = 0;
+
+ if (argc < 2 || argc > 3)
+ usage();
+ to.tv_sec = 10;
+ to.tv_usec = 0;
+ prognum = getprognum(argv[1]);
+ get_inet_address(&addr, argv[0]);
+ if (argc == 2) { /* Version number not known */
+ /*
+ * A call to version 0 should fail with a program/version
+ * mismatch, and give us the range of versions supported.
+ */
+ vers = MIN_VERS;
+ } else {
+ vers = getvers(argv[2]);
+ }
+ addr.sin_port = htons(portnum);
+ client = clnt_com_create(&addr, prognum, vers, &fd, trans);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void, (char *)NULL,
+ to);
+ if (argc != 2) {
+ /* Version number was known */
+ if (pstatus(client, prognum, vers) < 0)
+ exit(1);
+ (void) CLNT_DESTROY(client);
+ return;
+ }
+ /* Version number not known */
+ (void) CLNT_CONTROL(client, CLSET_FD_NCLOSE, (char *)NULL);
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * Oh dear, it DOES support version 0.
+ * Let's try version MAX_VERS.
+ */
+ (void) CLNT_DESTROY(client);
+ addr.sin_port = htons(portnum);
+ client = clnt_com_create(&addr, prognum, MAX_VERS, &fd, trans);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * It also supports version MAX_VERS.
+ * Looks like we have a wise guy.
+ * OK, we give them information on all
+ * 4 billion versions they support...
+ */
+ minvers = 0;
+ maxvers = MAX_VERS;
+ } else {
+ (void) pstatus(client, prognum, MAX_VERS);
+ exit(1);
+ }
+ } else {
+ (void) pstatus(client, prognum, (u_long)0);
+ exit(1);
+ }
+ (void) CLNT_DESTROY(client);
+ for (vers = minvers; vers <= maxvers; vers++) {
+ addr.sin_port = htons(portnum);
+ client = clnt_com_create(&addr, prognum, vers, &fd, trans);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (pstatus(client, prognum, vers) < 0)
+ failure = 1;
+ (void) CLNT_DESTROY(client);
+ }
+ if (failure)
+ exit(1);
+ (void) close(fd);
+ return;
+}
+
+/*
+ * Dump all the portmapper registerations
+ */
+static void
+pmapdump(int argc, char **argv)
+{
+ struct sockaddr_in server_addr;
+ struct pmaplist *head = NULL;
+ int socket = RPC_ANYSOCK;
+ struct timeval minutetimeout;
+ register CLIENT *client;
+ struct rpcent *rpc;
+ enum clnt_stat clnt_st;
+ struct rpc_err err;
+ char *host = NULL;
+
+ if (argc > 1)
+ usage();
+ if (argc == 1) {
+ host = argv[0];
+ get_inet_address(&server_addr, host);
+ server_addr.sin_port = htons(PMAPPORT);
+ client = clnttcp_create(&server_addr, PMAPPROG, PMAPVERS,
+ &socket, 50, 500);
+ } else
+ client = local_rpcb(PMAPPROG, PMAPVERS);
+
+ if (client == NULL) {
+ if (rpc_createerr.cf_stat == RPC_TLIERROR) {
+ /*
+ * "Misc. TLI error" is not too helpful. Most likely
+ * the connection to the remote server timed out, so
+ * this error is at least less perplexing.
+ */
+ rpc_createerr.cf_stat = RPC_PMAPFAILURE;
+ rpc_createerr.cf_error.re_status = RPC_FAILED;
+ }
+ clnt_pcreateerror("rpcinfo: can't contact portmapper");
+ exit(1);
+ }
+
+ minutetimeout.tv_sec = 60;
+ minutetimeout.tv_usec = 0;
+
+ clnt_st = CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t) xdr_void,
+ NULL, (xdrproc_t) xdr_pmaplist_ptr, (char *)&head,
+ minutetimeout);
+ if (clnt_st != RPC_SUCCESS) {
+ if ((clnt_st == RPC_PROGVERSMISMATCH) ||
+ (clnt_st == RPC_PROGUNAVAIL)) {
+ CLNT_GETERR(client, &err);
+ if (err.re_vers.low > PMAPVERS) {
+ if (host)
+ warnx("%s does not support portmapper."
+ "Try rpcinfo %s instead", host,
+ host);
+ else
+ warnx("local host does not support "
+ "portmapper. Try 'rpcinfo' "
+ "instead");
+ }
+ exit(1);
+ }
+ clnt_perror(client, "rpcinfo: can't contact portmapper");
+ exit(1);
+ }
+ if (head == NULL) {
+ printf("No remote programs registered.\n");
+ } else {
+ printf(" program vers proto port service\n");
+ for (; head != NULL; head = head->pml_next) {
+ printf("%10ld%5ld",
+ head->pml_map.pm_prog,
+ head->pml_map.pm_vers);
+ if (head->pml_map.pm_prot == IPPROTO_UDP)
+ printf("%6s", "udp");
+ else if (head->pml_map.pm_prot == IPPROTO_TCP)
+ printf("%6s", "tcp");
+ else if (head->pml_map.pm_prot == IPPROTO_ST)
+ printf("%6s", "local");
+ else
+ printf("%6ld", head->pml_map.pm_prot);
+ printf("%7ld", head->pml_map.pm_port);
+ rpc = getrpcbynumber(head->pml_map.pm_prog);
+ if (rpc)
+ printf(" %s\n", rpc->r_name);
+ else
+ printf("\n");
+ }
+ }
+}
+
+static void
+get_inet_address(struct sockaddr_in *addr, char *host)
+{
+ struct netconfig *nconf;
+ struct addrinfo hints, *res;
+ int error;
+
+ (void) memset((char *)addr, 0, sizeof (*addr));
+ addr->sin_addr.s_addr = inet_addr(host);
+ if (addr->sin_addr.s_addr == INADDR_NONE ||
+ addr->sin_addr.s_addr == INADDR_ANY) {
+ if ((nconf = __rpc_getconfip("udp")) == NULL &&
+ (nconf = __rpc_getconfip("tcp")) == NULL)
+ errx(1, "couldn't find a suitable transport");
+ else {
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_INET;
+ if ((error = getaddrinfo(host, "rpcbind", &hints, &res))
+ != 0)
+ errx(1, "%s: %s", host, gai_strerror(error));
+ else {
+ memcpy(addr, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
+ }
+ (void) freenetconfigent(nconf);
+ }
+ } else {
+ addr->sin_family = AF_INET;
+ }
+}
+#endif /* PORTMAP */
+
+/*
+ * reply_proc collects replies from the broadcast.
+ * to get a unique list of responses the output of rpcinfo should
+ * be piped through sort(1) and then uniq(1).
+ */
+
+/*ARGSUSED*/
+static bool_t
+reply_proc(void *res, struct netbuf *who, struct netconfig *nconf)
+ /* void *res; Nothing comes back */
+ /* struct netbuf *who; Who sent us the reply */
+ /* struct netconfig *nconf; On which transport the reply came */
+{
+ char *uaddr;
+ char hostbuf[NI_MAXHOST];
+ const char *hostname;
+ struct sockaddr *sa = (struct sockaddr *)who->buf;
+
+ if (getnameinfo(sa, sa->sa_len, hostbuf, NI_MAXHOST, NULL, 0, 0)) {
+ hostname = UNKNOWN;
+ } else {
+ hostname = hostbuf;
+ }
+ uaddr = taddr2uaddr(nconf, who);
+ if (uaddr == NULL) {
+ printf("%s\t%s\n", UNKNOWN, hostname);
+ } else {
+ printf("%s\t%s\n", uaddr, hostname);
+ free((char *)uaddr);
+ }
+ return (FALSE);
+}
+
+static void
+brdcst(int argc, char **argv)
+{
+ enum clnt_stat rpc_stat;
+ u_long prognum, vers;
+
+ if (argc != 2)
+ usage();
+ prognum = getprognum(argv[0]);
+ vers = getvers(argv[1]);
+ rpc_stat = rpc_broadcast(prognum, vers, NULLPROC,
+ (xdrproc_t) xdr_void, (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, (resultproc_t) reply_proc, NULL);
+ if ((rpc_stat != RPC_SUCCESS) && (rpc_stat != RPC_TIMEDOUT))
+ errx(1, "broadcast failed: %s", clnt_sperrno(rpc_stat));
+ exit(0);
+}
+
+static bool_t
+add_version(struct rpcbdump_short *rs, u_long vers)
+{
+ struct verslist *vl;
+
+ for (vl = rs->vlist; vl; vl = vl->next)
+ if (vl->vers == vers)
+ break;
+ if (vl)
+ return (TRUE);
+ vl = (struct verslist *)malloc(sizeof (struct verslist));
+ if (vl == NULL)
+ return (FALSE);
+ vl->vers = vers;
+ vl->next = rs->vlist;
+ rs->vlist = vl;
+ return (TRUE);
+}
+
+static bool_t
+add_netid(struct rpcbdump_short *rs, char *netid)
+{
+ struct netidlist *nl;
+
+ for (nl = rs->nlist; nl; nl = nl->next)
+ if (strcmp(nl->netid, netid) == 0)
+ break;
+ if (nl)
+ return (TRUE);
+ nl = (struct netidlist *)malloc(sizeof (struct netidlist));
+ if (nl == NULL)
+ return (FALSE);
+ nl->netid = netid;
+ nl->next = rs->nlist;
+ rs->nlist = nl;
+ return (TRUE);
+}
+
+static void
+rpcbdump(int dumptype, char *netid, int argc, char **argv)
+{
+ rpcblist_ptr head = NULL;
+ struct timeval minutetimeout;
+ register CLIENT *client;
+ struct rpcent *rpc;
+ char *host;
+ struct netidlist *nl;
+ struct verslist *vl;
+ struct rpcbdump_short *rs, *rs_tail;
+ char buf[256];
+ enum clnt_stat clnt_st;
+ struct rpc_err err;
+ struct rpcbdump_short *rs_head = NULL;
+
+ if (argc > 1)
+ usage();
+ if (argc == 1) {
+ host = argv[0];
+ if (netid == NULL) {
+ client = clnt_rpcbind_create(host, RPCBVERS, NULL);
+ } else {
+ struct netconfig *nconf;
+
+ nconf = getnetconfigent(netid);
+ if (nconf == NULL) {
+ nc_perror("rpcinfo: invalid transport");
+ exit(1);
+ }
+ client = getclnthandle(host, nconf, RPCBVERS, NULL);
+ if (nconf)
+ (void) freenetconfigent(nconf);
+ }
+ } else
+ client = local_rpcb(PMAPPROG, RPCBVERS);
+
+ if (client == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo: can't contact rpcbind");
+ exit(1);
+ }
+
+ minutetimeout.tv_sec = 60;
+ minutetimeout.tv_usec = 0;
+ clnt_st = CLNT_CALL(client, RPCBPROC_DUMP, (xdrproc_t) xdr_void,
+ NULL, (xdrproc_t) xdr_rpcblist_ptr, (char *) &head,
+ minutetimeout);
+ if (clnt_st != RPC_SUCCESS) {
+ if ((clnt_st == RPC_PROGVERSMISMATCH) ||
+ (clnt_st == RPC_PROGUNAVAIL)) {
+ int vers;
+
+ CLNT_GETERR(client, &err);
+ if (err.re_vers.low == RPCBVERS4) {
+ vers = RPCBVERS4;
+ clnt_control(client, CLSET_VERS, (char *)&vers);
+ clnt_st = CLNT_CALL(client, RPCBPROC_DUMP,
+ (xdrproc_t) xdr_void, NULL,
+ (xdrproc_t) xdr_rpcblist_ptr, (char *) &head,
+ minutetimeout);
+ if (clnt_st != RPC_SUCCESS)
+ goto failed;
+ } else {
+ if (err.re_vers.high == PMAPVERS) {
+ int high, low;
+ struct pmaplist *pmaphead = NULL;
+ rpcblist_ptr list, prev;
+
+ vers = PMAPVERS;
+ clnt_control(client, CLSET_VERS, (char *)&vers);
+ clnt_st = CLNT_CALL(client, PMAPPROC_DUMP,
+ (xdrproc_t) xdr_void, NULL,
+ (xdrproc_t) xdr_pmaplist_ptr,
+ (char *)&pmaphead, minutetimeout);
+ if (clnt_st != RPC_SUCCESS)
+ goto failed;
+ /*
+ * convert to rpcblist_ptr format
+ */
+ for (head = NULL; pmaphead != NULL;
+ pmaphead = pmaphead->pml_next) {
+ list = (rpcblist *)malloc(sizeof (rpcblist));
+ if (list == NULL)
+ goto error;
+ if (head == NULL)
+ head = list;
+ else
+ prev->rpcb_next = (rpcblist_ptr) list;
+
+ list->rpcb_next = NULL;
+ list->rpcb_map.r_prog = pmaphead->pml_map.pm_prog;
+ list->rpcb_map.r_vers = pmaphead->pml_map.pm_vers;
+ if (pmaphead->pml_map.pm_prot == IPPROTO_UDP)
+ list->rpcb_map.r_netid = "udp";
+ else if (pmaphead->pml_map.pm_prot == IPPROTO_TCP)
+ list->rpcb_map.r_netid = "tcp";
+ else {
+#define MAXLONG_AS_STRING "2147483648"
+ list->rpcb_map.r_netid =
+ malloc(strlen(MAXLONG_AS_STRING) + 1);
+ if (list->rpcb_map.r_netid == NULL)
+ goto error;
+ sprintf(list->rpcb_map.r_netid, "%6ld",
+ pmaphead->pml_map.pm_prot);
+ }
+ list->rpcb_map.r_owner = UNKNOWN;
+ low = pmaphead->pml_map.pm_port & 0xff;
+ high = (pmaphead->pml_map.pm_port >> 8) & 0xff;
+ list->rpcb_map.r_addr = strdup("0.0.0.0.XXX.XXX");
+ sprintf(&list->rpcb_map.r_addr[8], "%d.%d",
+ high, low);
+ prev = list;
+ }
+ }
+ }
+ } else { /* any other error */
+failed:
+ clnt_perror(client, "rpcinfo: can't contact rpcbind: ");
+ exit(1);
+ }
+ }
+ if (head == NULL) {
+ printf("No remote programs registered.\n");
+ } else if (dumptype == RPCBDUMP) {
+ printf(
+" program version netid address service owner\n");
+ for (; head != NULL; head = head->rpcb_next) {
+ printf("%10u%5u ",
+ head->rpcb_map.r_prog, head->rpcb_map.r_vers);
+ printf("%-9s ", head->rpcb_map.r_netid);
+ printf("%-22s", head->rpcb_map.r_addr);
+ rpc = getrpcbynumber(head->rpcb_map.r_prog);
+ if (rpc)
+ printf(" %-10s", rpc->r_name);
+ else
+ printf(" %-10s", "-");
+ printf(" %s\n", head->rpcb_map.r_owner);
+ }
+ } else if (dumptype == RPCBDUMP_SHORT) {
+ for (; head != NULL; head = head->rpcb_next) {
+ for (rs = rs_head; rs; rs = rs->next)
+ if (head->rpcb_map.r_prog == rs->prog)
+ break;
+ if (rs == NULL) {
+ rs = (struct rpcbdump_short *)
+ malloc(sizeof (struct rpcbdump_short));
+ if (rs == NULL)
+ goto error;
+ rs->next = NULL;
+ if (rs_head == NULL) {
+ rs_head = rs;
+ rs_tail = rs;
+ } else {
+ rs_tail->next = rs;
+ rs_tail = rs;
+ }
+ rs->prog = head->rpcb_map.r_prog;
+ rs->owner = head->rpcb_map.r_owner;
+ rs->nlist = NULL;
+ rs->vlist = NULL;
+ }
+ if (add_version(rs, head->rpcb_map.r_vers) == FALSE)
+ goto error;
+ if (add_netid(rs, head->rpcb_map.r_netid) == FALSE)
+ goto error;
+ }
+ printf(
+" program version(s) netid(s) service owner\n");
+ for (rs = rs_head; rs; rs = rs->next) {
+ char *p = buf;
+
+ printf("%10ld ", rs->prog);
+ for (vl = rs->vlist; vl; vl = vl->next) {
+ sprintf(p, "%d", vl->vers);
+ p = p + strlen(p);
+ if (vl->next)
+ sprintf(p++, ",");
+ }
+ printf("%-10s", buf);
+ buf[0] = '\0';
+ for (nl = rs->nlist; nl; nl = nl->next) {
+ strcat(buf, nl->netid);
+ if (nl->next)
+ strcat(buf, ",");
+ }
+ printf("%-32s", buf);
+ rpc = getrpcbynumber(rs->prog);
+ if (rpc)
+ printf(" %-11s", rpc->r_name);
+ else
+ printf(" %-11s", "-");
+ printf(" %s\n", rs->owner);
+ }
+ }
+ clnt_destroy(client);
+ return;
+error: warnx("no memory");
+ return;
+}
+
+static char nullstring[] = "\000";
+
+static void
+rpcbaddrlist(char *netid, int argc, char **argv)
+{
+ rpcb_entry_list_ptr head = NULL;
+ struct timeval minutetimeout;
+ register CLIENT *client;
+ struct rpcent *rpc;
+ char *host;
+ RPCB parms;
+ struct netbuf *targaddr;
+
+ if (argc != 3)
+ usage();
+ host = argv[0];
+ if (netid == NULL) {
+ client = clnt_rpcbind_create(host, RPCBVERS4, &targaddr);
+ } else {
+ struct netconfig *nconf;
+
+ nconf = getnetconfigent(netid);
+ if (nconf == NULL) {
+ nc_perror("rpcinfo: invalid transport");
+ exit(1);
+ }
+ client = getclnthandle(host, nconf, RPCBVERS4, &targaddr);
+ if (nconf)
+ (void) freenetconfigent(nconf);
+ }
+ if (client == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo: can't contact rpcbind");
+ exit(1);
+ }
+ minutetimeout.tv_sec = 60;
+ minutetimeout.tv_usec = 0;
+
+ parms.r_prog = getprognum(argv[1]);
+ parms.r_vers = getvers(argv[2]);
+ parms.r_netid = client->cl_netid;
+ if (targaddr == NULL) {
+ parms.r_addr = nullstring; /* for XDRing */
+ } else {
+ /*
+ * We also send the remote system the address we
+ * used to contact it in case it can help it
+ * connect back with us
+ */
+ struct netconfig *nconf;
+
+ nconf = getnetconfigent(client->cl_netid);
+ if (nconf != NULL) {
+ parms.r_addr = taddr2uaddr(nconf, targaddr);
+ if (parms.r_addr == NULL)
+ parms.r_addr = nullstring;
+ freenetconfigent(nconf);
+ } else {
+ parms.r_addr = nullstring; /* for XDRing */
+ }
+ free(targaddr->buf);
+ free(targaddr);
+ }
+ parms.r_owner = nullstring;
+
+ if (CLNT_CALL(client, RPCBPROC_GETADDRLIST, (xdrproc_t) xdr_rpcb,
+ (char *) &parms, (xdrproc_t) xdr_rpcb_entry_list_ptr,
+ (char *) &head, minutetimeout) != RPC_SUCCESS) {
+ clnt_perror(client, "rpcinfo: can't contact rpcbind: ");
+ exit(1);
+ }
+ if (head == NULL) {
+ printf("No remote programs registered.\n");
+ } else {
+ printf(
+ " program vers tp_family/name/class address\t\t service\n");
+ for (; head != NULL; head = head->rpcb_entry_next) {
+ rpcb_entry *re;
+ char buf[128];
+
+ re = &head->rpcb_entry_map;
+ printf("%10u%3u ",
+ parms.r_prog, parms.r_vers);
+ sprintf(buf, "%s/%s/%s ",
+ re->r_nc_protofmly, re->r_nc_proto,
+ re->r_nc_semantics == NC_TPI_CLTS ? "clts" :
+ re->r_nc_semantics == NC_TPI_COTS ? "cots" :
+ "cots_ord");
+ printf("%-24s", buf);
+ printf("%-24s", re->r_maddr);
+ rpc = getrpcbynumber(parms.r_prog);
+ if (rpc)
+ printf(" %-13s", rpc->r_name);
+ else
+ printf(" %-13s", "-");
+ printf("\n");
+ }
+ }
+ clnt_destroy(client);
+ return;
+}
+
+/*
+ * monitor rpcbind
+ */
+static void
+rpcbgetstat(int argc, char **argv)
+{
+ rpcb_stat_byvers inf;
+ struct timeval minutetimeout;
+ register CLIENT *client;
+ char *host;
+ int i, j;
+ rpcbs_addrlist *pa;
+ rpcbs_rmtcalllist *pr;
+ int cnt, flen;
+#define MAXFIELD 64
+ char fieldbuf[MAXFIELD];
+#define MAXLINE 256
+ char linebuf[MAXLINE];
+ char *cp, *lp;
+ const char *pmaphdr[] = {
+ "NULL", "SET", "UNSET", "GETPORT",
+ "DUMP", "CALLIT"
+ };
+ const char *rpcb3hdr[] = {
+ "NULL", "SET", "UNSET", "GETADDR", "DUMP", "CALLIT", "TIME",
+ "U2T", "T2U"
+ };
+ const char *rpcb4hdr[] = {
+ "NULL", "SET", "UNSET", "GETADDR", "DUMP", "CALLIT", "TIME",
+ "U2T", "T2U", "VERADDR", "INDRECT", "GETLIST", "GETSTAT"
+ };
+
+#define TABSTOP 8
+
+ if (argc >= 1) {
+ host = argv[0];
+ client = clnt_rpcbind_create(host, RPCBVERS4, NULL);
+ } else
+ client = local_rpcb(PMAPPROG, RPCBVERS4);
+ if (client == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo: can't contact rpcbind");
+ exit(1);
+ }
+ minutetimeout.tv_sec = 60;
+ minutetimeout.tv_usec = 0;
+ memset((char *)&inf, 0, sizeof (rpcb_stat_byvers));
+ if (CLNT_CALL(client, RPCBPROC_GETSTAT, (xdrproc_t) xdr_void, NULL,
+ (xdrproc_t) xdr_rpcb_stat_byvers, (char *)&inf, minutetimeout)
+ != RPC_SUCCESS) {
+ clnt_perror(client, "rpcinfo: can't contact rpcbind: ");
+ exit(1);
+ }
+ printf("PORTMAP (version 2) statistics\n");
+ lp = linebuf;
+ for (i = 0; i <= rpcb_highproc_2; i++) {
+ fieldbuf[0] = '\0';
+ switch (i) {
+ case PMAPPROC_SET:
+ sprintf(fieldbuf, "%d/", inf[RPCBVERS_2_STAT].setinfo);
+ break;
+ case PMAPPROC_UNSET:
+ sprintf(fieldbuf, "%d/",
+ inf[RPCBVERS_2_STAT].unsetinfo);
+ break;
+ case PMAPPROC_GETPORT:
+ cnt = 0;
+ for (pa = inf[RPCBVERS_2_STAT].addrinfo; pa;
+ pa = pa->next)
+ cnt += pa->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ case PMAPPROC_CALLIT:
+ cnt = 0;
+ for (pr = inf[RPCBVERS_2_STAT].rmtinfo; pr;
+ pr = pr->next)
+ cnt += pr->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ default: break; /* For the remaining ones */
+ }
+ cp = &fieldbuf[0] + strlen(fieldbuf);
+ sprintf(cp, "%d", inf[RPCBVERS_2_STAT].info[i]);
+ flen = strlen(fieldbuf);
+ printf("%s%s", pmaphdr[i],
+ spaces((TABSTOP * (1 + flen / TABSTOP))
+ - strlen(pmaphdr[i])));
+ sprintf(lp, "%s%s", fieldbuf,
+ spaces(cnt = ((TABSTOP * (1 + flen / TABSTOP))
+ - flen)));
+ lp += (flen + cnt);
+ }
+ printf("\n%s\n\n", linebuf);
+
+ if (inf[RPCBVERS_2_STAT].info[PMAPPROC_CALLIT]) {
+ printf("PMAP_RMTCALL call statistics\n");
+ print_rmtcallstat(RPCBVERS_2_STAT, &inf[RPCBVERS_2_STAT]);
+ printf("\n");
+ }
+
+ if (inf[RPCBVERS_2_STAT].info[PMAPPROC_GETPORT]) {
+ printf("PMAP_GETPORT call statistics\n");
+ print_getaddrstat(RPCBVERS_2_STAT, &inf[RPCBVERS_2_STAT]);
+ printf("\n");
+ }
+
+ printf("RPCBIND (version 3) statistics\n");
+ lp = linebuf;
+ for (i = 0; i <= rpcb_highproc_3; i++) {
+ fieldbuf[0] = '\0';
+ switch (i) {
+ case RPCBPROC_SET:
+ sprintf(fieldbuf, "%d/", inf[RPCBVERS_3_STAT].setinfo);
+ break;
+ case RPCBPROC_UNSET:
+ sprintf(fieldbuf, "%d/",
+ inf[RPCBVERS_3_STAT].unsetinfo);
+ break;
+ case RPCBPROC_GETADDR:
+ cnt = 0;
+ for (pa = inf[RPCBVERS_3_STAT].addrinfo; pa;
+ pa = pa->next)
+ cnt += pa->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ case RPCBPROC_CALLIT:
+ cnt = 0;
+ for (pr = inf[RPCBVERS_3_STAT].rmtinfo; pr;
+ pr = pr->next)
+ cnt += pr->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ default: break; /* For the remaining ones */
+ }
+ cp = &fieldbuf[0] + strlen(fieldbuf);
+ sprintf(cp, "%d", inf[RPCBVERS_3_STAT].info[i]);
+ flen = strlen(fieldbuf);
+ printf("%s%s", rpcb3hdr[i],
+ spaces((TABSTOP * (1 + flen / TABSTOP))
+ - strlen(rpcb3hdr[i])));
+ sprintf(lp, "%s%s", fieldbuf,
+ spaces(cnt = ((TABSTOP * (1 + flen / TABSTOP))
+ - flen)));
+ lp += (flen + cnt);
+ }
+ printf("\n%s\n\n", linebuf);
+
+ if (inf[RPCBVERS_3_STAT].info[RPCBPROC_CALLIT]) {
+ printf("RPCB_RMTCALL (version 3) call statistics\n");
+ print_rmtcallstat(RPCBVERS_3_STAT, &inf[RPCBVERS_3_STAT]);
+ printf("\n");
+ }
+
+ if (inf[RPCBVERS_3_STAT].info[RPCBPROC_GETADDR]) {
+ printf("RPCB_GETADDR (version 3) call statistics\n");
+ print_getaddrstat(RPCBVERS_3_STAT, &inf[RPCBVERS_3_STAT]);
+ printf("\n");
+ }
+
+ printf("RPCBIND (version 4) statistics\n");
+
+ for (j = 0; j <= 9; j += 9) { /* Just two iterations for printing */
+ lp = linebuf;
+ for (i = j; i <= MAX(8, rpcb_highproc_4 - 9 + j); i++) {
+ fieldbuf[0] = '\0';
+ switch (i) {
+ case RPCBPROC_SET:
+ sprintf(fieldbuf, "%d/",
+ inf[RPCBVERS_4_STAT].setinfo);
+ break;
+ case RPCBPROC_UNSET:
+ sprintf(fieldbuf, "%d/",
+ inf[RPCBVERS_4_STAT].unsetinfo);
+ break;
+ case RPCBPROC_GETADDR:
+ cnt = 0;
+ for (pa = inf[RPCBVERS_4_STAT].addrinfo; pa;
+ pa = pa->next)
+ cnt += pa->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ case RPCBPROC_CALLIT:
+ cnt = 0;
+ for (pr = inf[RPCBVERS_4_STAT].rmtinfo; pr;
+ pr = pr->next)
+ cnt += pr->success;
+ sprintf(fieldbuf, "%d/", cnt);
+ break;
+ default: break; /* For the remaining ones */
+ }
+ cp = &fieldbuf[0] + strlen(fieldbuf);
+ /*
+ * XXX: We also add RPCBPROC_GETADDRLIST queries to
+ * RPCB_GETADDR because rpcbind includes the
+ * RPCB_GETADDRLIST successes in RPCB_GETADDR.
+ */
+ if (i != RPCBPROC_GETADDR)
+ sprintf(cp, "%d", inf[RPCBVERS_4_STAT].info[i]);
+ else
+ sprintf(cp, "%d", inf[RPCBVERS_4_STAT].info[i] +
+ inf[RPCBVERS_4_STAT].info[RPCBPROC_GETADDRLIST]);
+ flen = strlen(fieldbuf);
+ printf("%s%s", rpcb4hdr[i],
+ spaces((TABSTOP * (1 + flen / TABSTOP))
+ - strlen(rpcb4hdr[i])));
+ sprintf(lp, "%s%s", fieldbuf,
+ spaces(cnt = ((TABSTOP * (1 + flen / TABSTOP))
+ - flen)));
+ lp += (flen + cnt);
+ }
+ printf("\n%s\n", linebuf);
+ }
+
+ if (inf[RPCBVERS_4_STAT].info[RPCBPROC_CALLIT] ||
+ inf[RPCBVERS_4_STAT].info[RPCBPROC_INDIRECT]) {
+ printf("\n");
+ printf("RPCB_RMTCALL (version 4) call statistics\n");
+ print_rmtcallstat(RPCBVERS_4_STAT, &inf[RPCBVERS_4_STAT]);
+ }
+
+ if (inf[RPCBVERS_4_STAT].info[RPCBPROC_GETADDR]) {
+ printf("\n");
+ printf("RPCB_GETADDR (version 4) call statistics\n");
+ print_getaddrstat(RPCBVERS_4_STAT, &inf[RPCBVERS_4_STAT]);
+ }
+ clnt_destroy(client);
+}
+
+/*
+ * Delete registeration for this (prog, vers, netid)
+ */
+static void
+deletereg(char *netid, int argc, char **argv)
+{
+ struct netconfig *nconf = NULL;
+
+ if (argc != 2)
+ usage();
+ if (netid) {
+ nconf = getnetconfigent(netid);
+ if (nconf == NULL)
+ errx(1, "netid %s not supported", netid);
+ }
+ if ((rpcb_unset(getprognum(argv[0]), getvers(argv[1]), nconf)) == 0)
+ errx(1,
+ "could not delete registration for prog %s version %s",
+ argv[0], argv[1]);
+}
+
+/*
+ * Create and return a handle for the given nconf.
+ * Exit if cannot create handle.
+ */
+static CLIENT *
+clnt_addr_create(char *address, struct netconfig *nconf,
+ u_long prog, u_long vers)
+{
+ CLIENT *client;
+ static struct netbuf *nbuf;
+ static int fd = RPC_ANYFD;
+
+ if (fd == RPC_ANYFD) {
+ if ((fd = __rpc_nconf2fd(nconf)) == -1) {
+ rpc_createerr.cf_stat = RPC_TLIERROR;
+ clnt_pcreateerror("rpcinfo");
+ exit(1);
+ }
+ /* Convert the uaddr to taddr */
+ nbuf = uaddr2taddr(nconf, address);
+ if (nbuf == NULL)
+ errx(1, "no address for client handle");
+ }
+ client = clnt_tli_create(fd, nconf, nbuf, prog, vers, 0, 0);
+ if (client == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo");
+ exit(1);
+ }
+ return (client);
+}
+
+/*
+ * If the version number is given, ping that (prog, vers); else try to find
+ * the version numbers supported for that prog and ping all the versions.
+ * Remote rpcbind is not contacted for this service. The requests are
+ * sent directly to the services themselves.
+ */
+static void
+addrping(char *address, char *netid, int argc, char **argv)
+{
+ CLIENT *client;
+ struct timeval to;
+ enum clnt_stat rpc_stat;
+ u_long prognum, versnum, minvers, maxvers;
+ struct rpc_err rpcerr;
+ int failure = 0;
+ struct netconfig *nconf;
+ int fd;
+
+ if (argc < 1 || argc > 2 || (netid == NULL))
+ usage();
+ nconf = getnetconfigent(netid);
+ if (nconf == (struct netconfig *)NULL)
+ errx(1, "could not find %s", netid);
+ to.tv_sec = 10;
+ to.tv_usec = 0;
+ prognum = getprognum(argv[0]);
+ if (argc == 1) { /* Version number not known */
+ /*
+ * A call to version 0 should fail with a program/version
+ * mismatch, and give us the range of versions supported.
+ */
+ versnum = MIN_VERS;
+ } else {
+ versnum = getvers(argv[1]);
+ }
+ client = clnt_addr_create(address, nconf, prognum, versnum);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (argc == 2) {
+ /* Version number was known */
+ if (pstatus(client, prognum, versnum) < 0)
+ failure = 1;
+ (void) CLNT_DESTROY(client);
+ if (failure)
+ exit(1);
+ return;
+ }
+ /* Version number not known */
+ (void) CLNT_CONTROL(client, CLSET_FD_NCLOSE, (char *)NULL);
+ (void) CLNT_CONTROL(client, CLGET_FD, (char *)&fd);
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * Oh dear, it DOES support version 0.
+ * Let's try version MAX_VERS.
+ */
+ (void) CLNT_DESTROY(client);
+ client = clnt_addr_create(address, nconf, prognum, MAX_VERS);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * It also supports version MAX_VERS.
+ * Looks like we have a wise guy.
+ * OK, we give them information on all
+ * 4 billion versions they support...
+ */
+ minvers = 0;
+ maxvers = MAX_VERS;
+ } else {
+ (void) pstatus(client, prognum, MAX_VERS);
+ exit(1);
+ }
+ } else {
+ (void) pstatus(client, prognum, (u_long)0);
+ exit(1);
+ }
+ (void) CLNT_DESTROY(client);
+ for (versnum = minvers; versnum <= maxvers; versnum++) {
+ client = clnt_addr_create(address, nconf, prognum, versnum);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (pstatus(client, prognum, versnum) < 0)
+ failure = 1;
+ (void) CLNT_DESTROY(client);
+ }
+ (void) close(fd);
+ if (failure)
+ exit(1);
+ return;
+}
+
+/*
+ * If the version number is given, ping that (prog, vers); else try to find
+ * the version numbers supported for that prog and ping all the versions.
+ * Remote rpcbind is *contacted* for this service. The requests are
+ * then sent directly to the services themselves.
+ */
+static void
+progping(char *netid, int argc, char **argv)
+{
+ CLIENT *client;
+ struct timeval to;
+ enum clnt_stat rpc_stat;
+ u_long prognum, versnum, minvers, maxvers;
+ struct rpc_err rpcerr;
+ int failure = 0;
+ struct netconfig *nconf;
+
+ if (argc < 2 || argc > 3 || (netid == NULL))
+ usage();
+ prognum = getprognum(argv[1]);
+ if (argc == 2) { /* Version number not known */
+ /*
+ * A call to version 0 should fail with a program/version
+ * mismatch, and give us the range of versions supported.
+ */
+ versnum = MIN_VERS;
+ } else {
+ versnum = getvers(argv[2]);
+ }
+ if (netid) {
+ nconf = getnetconfigent(netid);
+ if (nconf == (struct netconfig *)NULL)
+ errx(1, "could not find %s", netid);
+ client = clnt_tp_create(argv[0], prognum, versnum, nconf);
+ } else {
+ client = clnt_create(argv[0], prognum, versnum, "NETPATH");
+ }
+ if (client == (CLIENT *)NULL) {
+ clnt_pcreateerror("rpcinfo");
+ exit(1);
+ }
+ to.tv_sec = 10;
+ to.tv_usec = 0;
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (argc == 3) {
+ /* Version number was known */
+ if (pstatus(client, prognum, versnum) < 0)
+ failure = 1;
+ (void) CLNT_DESTROY(client);
+ if (failure)
+ exit(1);
+ return;
+ }
+ /* Version number not known */
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * Oh dear, it DOES support version 0.
+ * Let's try version MAX_VERS.
+ */
+ versnum = MAX_VERS;
+ (void) CLNT_CONTROL(client, CLSET_VERS, (char *)&versnum);
+ rpc_stat = CLNT_CALL(client, NULLPROC,
+ (xdrproc_t) xdr_void, (char *)NULL,
+ (xdrproc_t) xdr_void, (char *)NULL, to);
+ if (rpc_stat == RPC_PROGVERSMISMATCH) {
+ clnt_geterr(client, &rpcerr);
+ minvers = rpcerr.re_vers.low;
+ maxvers = rpcerr.re_vers.high;
+ } else if (rpc_stat == RPC_SUCCESS) {
+ /*
+ * It also supports version MAX_VERS.
+ * Looks like we have a wise guy.
+ * OK, we give them information on all
+ * 4 billion versions they support...
+ */
+ minvers = 0;
+ maxvers = MAX_VERS;
+ } else {
+ (void) pstatus(client, prognum, MAX_VERS);
+ exit(1);
+ }
+ } else {
+ (void) pstatus(client, prognum, (u_long)0);
+ exit(1);
+ }
+ for (versnum = minvers; versnum <= maxvers; versnum++) {
+ (void) CLNT_CONTROL(client, CLSET_VERS, (char *)&versnum);
+ rpc_stat = CLNT_CALL(client, NULLPROC, (xdrproc_t) xdr_void,
+ (char *)NULL, (xdrproc_t) xdr_void,
+ (char *)NULL, to);
+ if (pstatus(client, prognum, versnum) < 0)
+ failure = 1;
+ }
+ (void) CLNT_DESTROY(client);
+ if (failure)
+ exit(1);
+ return;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: rpcinfo [-m | -s] [host]\n");
+#ifdef PORTMAP
+ fprintf(stderr, " rpcinfo -p [host]\n");
+#endif
+ fprintf(stderr, " rpcinfo -T netid host prognum [versnum]\n");
+ fprintf(stderr, " rpcinfo -l host prognum versnum\n");
+#ifdef PORTMAP
+ fprintf(stderr,
+" rpcinfo [-n portnum] -u | -t host prognum [versnum]\n");
+#endif
+ fprintf(stderr,
+" rpcinfo -a serv_address -T netid prognum [version]\n");
+ fprintf(stderr, " rpcinfo -b prognum versnum\n");
+ fprintf(stderr, " rpcinfo -d [-T netid] prognum versnum\n");
+ exit(1);
+}
+
+static u_long
+getprognum (char *arg)
+{
+ char *strptr;
+ register struct rpcent *rpc;
+ register u_long prognum;
+ char *tptr = arg;
+
+ while (*tptr && isdigit(*tptr++));
+ if (*tptr || isalpha(*(tptr - 1))) {
+ rpc = getrpcbyname(arg);
+ if (rpc == NULL)
+ errx(1, "%s is unknown service", arg);
+ prognum = rpc->r_number;
+ } else {
+ prognum = strtol(arg, &strptr, 10);
+ if (strptr == arg || *strptr != '\0')
+ errx(1, "%s is illegal program number", arg);
+ }
+ return (prognum);
+}
+
+static u_long
+getvers(char *arg)
+{
+ char *strptr;
+ register u_long vers;
+
+ vers = (int) strtol(arg, &strptr, 10);
+ if (strptr == arg || *strptr != '\0')
+ errx(1, "%s is illegal version number", arg);
+ return (vers);
+}
+
+/*
+ * This routine should take a pointer to an "rpc_err" structure, rather than
+ * a pointer to a CLIENT structure, but "clnt_perror" takes a pointer to
+ * a CLIENT structure rather than a pointer to an "rpc_err" structure.
+ * As such, we have to keep the CLIENT structure around in order to print
+ * a good error message.
+ */
+static int
+pstatus(register CLIENT *client, u_long prog, u_long vers)
+{
+ struct rpc_err rpcerr;
+
+ clnt_geterr(client, &rpcerr);
+ if (rpcerr.re_status != RPC_SUCCESS) {
+ clnt_perror(client, "rpcinfo");
+ printf("program %lu version %lu is not available\n",
+ prog, vers);
+ return (-1);
+ } else {
+ printf("program %lu version %lu ready and waiting\n",
+ prog, vers);
+ return (0);
+ }
+}
+
+static CLIENT *
+clnt_rpcbind_create(char *host, int rpcbversnum, struct netbuf **targaddr)
+{
+ static const char *tlist[3] = {
+ "circuit_n", "circuit_v", "datagram_v"
+ };
+ int i;
+ struct netconfig *nconf;
+ CLIENT *clnt = NULL;
+ void *handle;
+
+ rpc_createerr.cf_stat = RPC_SUCCESS;
+ for (i = 0; i < 3; i++) {
+ if ((handle = __rpc_setconf(tlist[i])) == NULL)
+ continue;
+ while (clnt == (CLIENT *)NULL) {
+ if ((nconf = __rpc_getconf(handle)) == NULL) {
+ if (rpc_createerr.cf_stat == RPC_SUCCESS)
+ rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
+ break;
+ }
+ clnt = getclnthandle(host, nconf, rpcbversnum,
+ targaddr);
+ }
+ if (clnt)
+ break;
+ __rpc_endconf(handle);
+ }
+ return (clnt);
+}
+
+static CLIENT*
+getclnthandle(char *host, struct netconfig *nconf,
+ u_long rpcbversnum, struct netbuf **targaddr)
+{
+ struct netbuf addr;
+ struct addrinfo hints, *res;
+ CLIENT *client = NULL;
+
+ /* Get the address of the rpcbind */
+ memset(&hints, 0, sizeof hints);
+ if (getaddrinfo(host, "rpcbind", &hints, &res) != 0) {
+ rpc_createerr.cf_stat = RPC_N2AXLATEFAILURE;
+ return (NULL);
+ }
+ addr.len = addr.maxlen = res->ai_addrlen;
+ addr.buf = res->ai_addr;
+ client = clnt_tli_create(RPC_ANYFD, nconf, &addr, RPCBPROG,
+ rpcbversnum, 0, 0);
+ if (client) {
+ if (targaddr != NULL) {
+ *targaddr =
+ (struct netbuf *)malloc(sizeof (struct netbuf));
+ if (*targaddr != NULL) {
+ (*targaddr)->maxlen = addr.maxlen;
+ (*targaddr)->len = addr.len;
+ (*targaddr)->buf = (char *)malloc(addr.len);
+ if ((*targaddr)->buf != NULL) {
+ memcpy((*targaddr)->buf, addr.buf,
+ addr.len);
+ }
+ }
+ }
+ } else {
+ if (rpc_createerr.cf_stat == RPC_TLIERROR) {
+ /*
+ * Assume that the other system is dead; this is a
+ * better error to display to the user.
+ */
+ rpc_createerr.cf_stat = RPC_RPCBFAILURE;
+ rpc_createerr.cf_error.re_status = RPC_FAILED;
+ }
+ }
+ freeaddrinfo(res);
+ return (client);
+}
+
+static void
+print_rmtcallstat(int rtype, rpcb_stat *infp)
+{
+ register rpcbs_rmtcalllist_ptr pr;
+ struct rpcent *rpc;
+
+ if (rtype == RPCBVERS_4_STAT)
+ printf(
+ "prog\t\tvers\tproc\tnetid\tindirect success failure\n");
+ else
+ printf("prog\t\tvers\tproc\tnetid\tsuccess\tfailure\n");
+ for (pr = infp->rmtinfo; pr; pr = pr->next) {
+ rpc = getrpcbynumber(pr->prog);
+ if (rpc)
+ printf("%-16s", rpc->r_name);
+ else
+ printf("%-16d", pr->prog);
+ printf("%d\t%d\t%s\t",
+ pr->vers, pr->proc, pr->netid);
+ if (rtype == RPCBVERS_4_STAT)
+ printf("%d\t ", pr->indirect);
+ printf("%d\t%d\n", pr->success, pr->failure);
+ }
+}
+
+static void
+print_getaddrstat(int rtype, rpcb_stat *infp)
+{
+ rpcbs_addrlist_ptr al;
+ register struct rpcent *rpc;
+
+ printf("prog\t\tvers\tnetid\t success\tfailure\n");
+ for (al = infp->addrinfo; al; al = al->next) {
+ rpc = getrpcbynumber(al->prog);
+ if (rpc)
+ printf("%-16s", rpc->r_name);
+ else
+ printf("%-16d", al->prog);
+ printf("%d\t%s\t %-12d\t%d\n",
+ al->vers, al->netid,
+ al->success, al->failure);
+ }
+}
+
+static char *
+spaces(int howmany)
+{
+ static char space_array[] = /* 64 spaces */
+ " ";
+
+ if (howmany <= 0 || howmany > sizeof (space_array)) {
+ return ("");
+ }
+ return (&space_array[sizeof (space_array) - howmany - 1]);
+}
diff --git a/usr.bin/rs/Makefile b/usr.bin/rs/Makefile
new file mode 100644
index 0000000..21da34d
--- /dev/null
+++ b/usr.bin/rs/Makefile
@@ -0,0 +1,5 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+
+PROG= rs
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rs/Makefile.depend b/usr.bin/rs/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/rs/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/rs/rs.1 b/usr.bin/rs/rs.1
new file mode 100644
index 0000000..23a37b8
--- /dev/null
+++ b/usr.bin/rs/rs.1
@@ -0,0 +1,247 @@
+.\" Copyright (c) 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.
+.\"
+.\" @(#)rs.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd April 7, 2015
+.Dt RS 1
+.Os
+.Sh NAME
+.Nm rs
+.Nd reshape a data array
+.Sh SYNOPSIS
+.Nm
+.Oo
+.Fl Oo Cm csCS Oc Ns Op Ar x
+.Oo Cm kKgGw Oc Ns Op Ar N
+.Cm tTeEnyjhHmz
+.Oc
+.Op Ar rows Op Ar cols
+.Sh DESCRIPTION
+The
+.Nm
+utility reads the standard input, interpreting each line as a row
+of blank-separated entries in an array,
+transforms the array according to the options,
+and writes it on the standard output.
+With no arguments it transforms stream input into a columnar
+format convenient for terminal viewing.
+.Pp
+The shape of the input array is deduced from the number of lines
+and the number of columns on the first line.
+If that shape is inconvenient, a more useful one might be
+obtained by skipping some of the input with the
+.Fl k
+option.
+Other options control interpretation of the input columns.
+.Pp
+The shape of the output array is influenced by the
+.Ar rows
+and
+.Ar cols
+specifications, which should be positive integers.
+If only one of them is a positive integer,
+.Nm
+computes a value for the other which will accommodate
+all of the data.
+When necessary, missing data are supplied in a manner
+specified by the options and surplus data are deleted.
+There are options to control presentation of the output columns,
+including transposition of the rows and columns.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c Ns Ar x
+Input columns are delimited by the single character
+.Ar x .
+A missing
+.Ar x
+is taken to be `^I'.
+.It Fl s Ns Ar x
+Like
+.Fl c ,
+but maximal strings of
+.Ar x
+are delimiters.
+.It Fl C Ns Ar x
+Output columns are delimited by the single character
+.Ar x .
+A missing
+.Ar x
+is taken to be `^I'.
+.It Fl S Ns Ar x
+Like
+.Fl C ,
+but padded strings of
+.Ar x
+are delimiters.
+.It Fl t
+Fill in the rows of the output array using the columns of the
+input array, that is, transpose the input while honoring any
+.Ar rows
+and
+.Ar cols
+specifications.
+.It Fl T
+Print the pure transpose of the input, ignoring any
+.Ar rows
+or
+.Ar cols
+specification.
+.It Fl k Ns Ar N
+Ignore the first
+.Ar N
+lines of input.
+.It Fl K Ns Ar N
+Like
+.Fl k ,
+but print the ignored lines.
+.It Fl g Ns Ar N
+The gutter width (inter-column space), normally 2, is taken to be
+.Ar N .
+.It Fl G Ns Ar N
+The gutter width has
+.Ar N
+percent of the maximum column width added to it.
+.It Fl e
+Consider each line of input as an array entry.
+.It Fl n
+On lines having fewer entries than the first line,
+use null entries to pad out the line.
+Normally, missing entries are taken from the next line of input.
+.It Fl y
+If there are too few entries to make up the output dimensions,
+pad the output by recycling the input from the beginning.
+Normally, the output is padded with blanks.
+.It Fl h
+Print the shape of the input array and do nothing else.
+The shape is just the number of lines and the number of
+entries on the first line.
+.It Fl H
+Like
+.Fl h ,
+but also print the length of each line.
+.It Fl j
+Right adjust entries within columns.
+.It Fl w Ns Ar N
+The width of the display, normally 80, is taken to be the positive
+integer
+.Ar N .
+.It Fl m
+Do not trim excess delimiters from the ends of the output array.
+.It Fl z
+Adapt column widths to fit the largest entries appearing in them.
+.El
+.Pp
+With no arguments,
+.Nm
+transposes its input, and assumes one array entry per input line
+unless the first non-ignored line is longer than the display width.
+Option letters which take numerical arguments interpret a missing
+number as zero unless otherwise indicated.
+.Sh EXAMPLES
+The
+.Nm
+utility can be used as a filter to convert the stream output
+of certain programs (e.g.,
+.Xr spell 1 ,
+.Xr du 1 ,
+.Xr file 1 ,
+.Xr look 1 ,
+.Xr nm 1 ,
+.Xr who 1 ,
+and
+.Xr wc 1 )
+into a convenient ``window'' format, as in
+.Bd -literal -offset indent
+% who | rs
+.Ed
+.Pp
+This function has been incorporated into the
+.Xr ls 1
+program, though for most programs with similar output
+.Nm
+suffices.
+.Pp
+To convert stream input into vector output and back again, use
+.Bd -literal -offset indent
+% rs 1 0 | rs 0 1
+.Ed
+.Pp
+A 10 by 10 array of random numbers from 1 to 100 and
+its transpose can be generated with
+.Bd -literal -offset indent
+% jot \-r 100 | rs 10 10 | tee array | rs \-T > tarray
+.Ed
+.Pp
+In the editor
+.Xr vi 1 ,
+a file consisting of a multi-line vector with 9 elements per line
+can undergo insertions and deletions,
+and then be neatly reshaped into 9 columns with
+.Bd -literal -offset indent
+:1,$!rs 0 9
+.Ed
+.Pp
+Finally, to sort a database by the first line of each 4-line field, try
+.Bd -literal -offset indent
+% rs \-eC 0 4 | sort | rs \-c 0 1
+.Ed
+.Sh SEE ALSO
+.Xr jot 1 ,
+.Xr pr 1 ,
+.Xr sort 1 ,
+.Xr vi 1
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.2 .
+.Sh AUTHORS
+.An John A. Kunze
+.Sh BUGS
+.Bl -item
+.It
+Handles only two dimensional arrays.
+.It
+The algorithm currently reads the whole file into memory,
+so files that do not fit in memory will not be reshaped.
+.It
+Fields cannot be defined yet on character positions.
+.It
+Re-ordering of columns is not yet possible.
+.It
+There are too many options.
+.It
+Multibyte characters are not recognized.
+.It
+Lines longer than
+.Dv LINE_MAX
+(2048) bytes are not processed and result in immediate termination of
+.Nm .
+.El
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c
new file mode 100644
index 0000000..3f50868
--- /dev/null
+++ b/usr.bin/rs/rs.c
@@ -0,0 +1,553 @@
+/*-
+ * Copyright (c) 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) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)rs.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+
+/*
+ * rs - reshape a data array
+ * Author: John Kunze, Office of Comp. Affairs, UCB
+ * BEWARE: lots of unfinished edges
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static long flags;
+#define TRANSPOSE 000001
+#define MTRANSPOSE 000002
+#define ONEPERLINE 000004
+#define ONEISEPONLY 000010
+#define ONEOSEPONLY 000020
+#define NOTRIMENDCOL 000040
+#define SQUEEZE 000100
+#define SHAPEONLY 000200
+#define DETAILSHAPE 000400
+#define RIGHTADJUST 001000
+#define NULLPAD 002000
+#define RECYCLE 004000
+#define SKIPPRINT 010000
+#define ICOLBOUNDS 020000
+#define OCOLBOUNDS 040000
+#define ONEPERCHAR 0100000
+#define NOARGS 0200000
+
+static short *colwidths;
+static short *cord;
+static short *icbd;
+static short *ocbd;
+static int nelem;
+static char **elem;
+static char **endelem;
+static char *curline;
+static int allocsize = BUFSIZ;
+static int curlen;
+static int irows, icols;
+static int orows = 0, ocols = 0;
+static int maxlen;
+static int skip;
+static int propgutter;
+static char isep = ' ', osep = ' ';
+static char blank[] = "";
+static int owidth = 80, gutter = 2;
+
+static void getargs(int, char *[]);
+static void getfile(void);
+static int get_line(void);
+static char *getlist(short **, char *);
+static char *getnum(int *, char *, int);
+static char **getptrs(char **);
+static void prepfile(void);
+static void prints(char *, int);
+static void putfile(void);
+static void usage(void);
+
+#define INCR(ep) do { \
+ if (++ep >= endelem) \
+ ep = getptrs(ep); \
+} while(0)
+
+int
+main(int argc, char *argv[])
+{
+ getargs(argc, argv);
+ getfile();
+ if (flags & SHAPEONLY) {
+ printf("%d %d\n", irows, icols);
+ exit(0);
+ }
+ prepfile();
+ putfile();
+ exit(0);
+}
+
+static void
+getfile(void)
+{
+ char *p;
+ char *endp;
+ char **ep;
+ int c;
+ int multisep = (flags & ONEISEPONLY ? 0 : 1);
+ int nullpad = flags & NULLPAD;
+ char **padto;
+
+ while (skip--) {
+ c = get_line();
+ if (flags & SKIPPRINT)
+ puts(curline);
+ if (c == EOF)
+ return;
+ }
+ get_line();
+ if (flags & NOARGS && curlen < owidth)
+ flags |= ONEPERLINE;
+ if (flags & ONEPERLINE)
+ icols = 1;
+ else /* count cols on first line */
+ for (p = curline, endp = curline + curlen; p < endp; p++) {
+ if (*p == isep && multisep)
+ continue;
+ icols++;
+ while (*p && *p != isep)
+ p++;
+ }
+ ep = getptrs(elem);
+ do {
+ if (flags & ONEPERLINE) {
+ *ep = curline;
+ INCR(ep); /* prepare for next entry */
+ if (maxlen < curlen)
+ maxlen = curlen;
+ irows++;
+ continue;
+ }
+ for (p = curline, endp = curline + curlen; p < endp; p++) {
+ if (*p == isep && multisep)
+ continue; /* eat up column separators */
+ if (*p == isep) /* must be an empty column */
+ *ep = blank;
+ else /* store column entry */
+ *ep = p;
+ while (p < endp && *p != isep)
+ p++; /* find end of entry */
+ *p = '\0'; /* mark end of entry */
+ if (maxlen < p - *ep) /* update maxlen */
+ maxlen = p - *ep;
+ INCR(ep); /* prepare for next entry */
+ }
+ irows++; /* update row count */
+ if (nullpad) { /* pad missing entries */
+ padto = elem + irows * icols;
+ while (ep < padto) {
+ *ep = blank;
+ INCR(ep);
+ }
+ }
+ } while (get_line() != EOF);
+ *ep = 0; /* mark end of pointers */
+ nelem = ep - elem;
+}
+
+static void
+putfile(void)
+{
+ char **ep;
+ int i, j, k;
+
+ ep = elem;
+ if (flags & TRANSPOSE)
+ for (i = 0; i < orows; i++) {
+ for (j = i; j < nelem; j += orows)
+ prints(ep[j], (j - i) / orows);
+ putchar('\n');
+ }
+ else
+ for (i = k = 0; i < orows; i++) {
+ for (j = 0; j < ocols; j++, k++)
+ if (k < nelem)
+ prints(ep[k], j);
+ putchar('\n');
+ }
+}
+
+static void
+prints(char *s, int col)
+{
+ int n;
+ char *p = s;
+
+ while (*p)
+ p++;
+ n = (flags & ONEOSEPONLY ? 1 : colwidths[col] - (p - s));
+ if (flags & RIGHTADJUST)
+ while (n-- > 0)
+ putchar(osep);
+ for (p = s; *p; p++)
+ putchar(*p);
+ while (n-- > 0)
+ putchar(osep);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: rs [-[csCS][x][kKgGw][N]tTeEnyjhHmz] [rows [cols]]\n");
+ exit(1);
+}
+
+static void
+prepfile(void)
+{
+ char **ep;
+ int i;
+ int j;
+ char **lp;
+ int colw;
+ int max;
+ int n;
+
+ if (!nelem)
+ exit(0);
+ gutter += maxlen * propgutter / 100.0;
+ colw = maxlen + gutter;
+ if (flags & MTRANSPOSE) {
+ orows = icols;
+ ocols = irows;
+ }
+ else if (orows == 0 && ocols == 0) { /* decide rows and cols */
+ ocols = owidth / colw;
+ if (ocols == 0) {
+ warnx("display width %d is less than column width %d",
+ owidth, colw);
+ ocols = 1;
+ }
+ if (ocols > nelem)
+ ocols = nelem;
+ orows = nelem / ocols + (nelem % ocols ? 1 : 0);
+ }
+ else if (orows == 0) /* decide on rows */
+ orows = nelem / ocols + (nelem % ocols ? 1 : 0);
+ else if (ocols == 0) /* decide on cols */
+ ocols = nelem / orows + (nelem % orows ? 1 : 0);
+ lp = elem + orows * ocols;
+ while (lp > endelem) {
+ getptrs(elem + nelem);
+ lp = elem + orows * ocols;
+ }
+ if (flags & RECYCLE) {
+ for (ep = elem + nelem; ep < lp; ep++)
+ *ep = *(ep - nelem);
+ nelem = lp - elem;
+ }
+ if (!(colwidths = (short *) malloc(ocols * sizeof(short))))
+ errx(1, "malloc");
+ if (flags & SQUEEZE) {
+ ep = elem;
+ if (flags & TRANSPOSE)
+ for (i = 0; i < ocols; i++) {
+ max = 0;
+ for (j = 0; *ep != NULL && j < orows; j++)
+ if ((n = strlen(*ep++)) > max)
+ max = n;
+ colwidths[i] = max + gutter;
+ }
+ else
+ for (i = 0; i < ocols; i++) {
+ max = 0;
+ for (j = i; j < nelem; j += ocols)
+ if ((n = strlen(ep[j])) > max)
+ max = n;
+ colwidths[i] = max + gutter;
+ }
+ }
+ /* for (i = 0; i < orows; i++) {
+ for (j = i; j < nelem; j += orows)
+ prints(ep[j], (j - i) / orows);
+ putchar('\n');
+ }
+ else
+ for (i = 0; i < orows; i++) {
+ for (j = 0; j < ocols; j++)
+ prints(*ep++, j);
+ putchar('\n');
+ }*/
+ else
+ for (i = 0; i < ocols; i++)
+ colwidths[i] = colw;
+ if (!(flags & NOTRIMENDCOL)) {
+ if (flags & RIGHTADJUST)
+ colwidths[0] -= gutter;
+ else
+ colwidths[ocols - 1] = 0;
+ }
+ n = orows * ocols;
+ if (n > nelem && (flags & RECYCLE))
+ nelem = n;
+ /*for (i = 0; i < ocols; i++)
+ warnx("%d is colwidths, nelem %d", colwidths[i], nelem);*/
+}
+
+#define BSIZE (LINE_MAX * 2)
+static char ibuf[BSIZE];
+
+static int
+get_line(void) /* get line; maintain curline, curlen; manage storage */
+{
+ static int putlength;
+ static char *endblock = ibuf + BSIZE;
+ char *p;
+ int c, i;
+
+ if (!irows) {
+ curline = ibuf;
+ putlength = flags & DETAILSHAPE;
+ }
+ else if (skip <= 0) { /* don't waste storage */
+ curline += curlen + 1;
+ if (putlength) { /* print length, recycle storage */
+ printf(" %d line %d\n", curlen, irows);
+ curline = ibuf;
+ }
+ }
+ if (!putlength && endblock - curline < LINE_MAX + 1) { /* need storage */
+ /*ww = endblock-curline; tt += ww;*/
+ /*printf("#wasted %d total %d\n",ww,tt);*/
+ if (!(curline = (char *) malloc(BSIZE)))
+ errx(1, "file too large");
+ endblock = curline + BSIZE;
+ /*printf("#endb %d curline %d\n",endblock,curline);*/
+ }
+ for (p = curline, i = 0;; *p++ = c, i++) {
+ if ((c = getchar()) == EOF)
+ break;
+ if (i >= LINE_MAX)
+ errx(1, "maximum line length (%d) exceeded", LINE_MAX);
+ if (c == '\n')
+ break;
+ }
+ *p = '\0';
+ curlen = i;
+ return(c);
+}
+
+static char **
+getptrs(char **sp)
+{
+ char **p;
+
+ allocsize += allocsize;
+ p = (char **)realloc(elem, allocsize * sizeof(char *));
+ if (p == NULL)
+ err(1, "no memory");
+
+ sp += (p - elem);
+ endelem = (elem = p) + allocsize;
+ return(sp);
+}
+
+static void
+getargs(int ac, char *av[])
+{
+ char *p;
+
+ if (ac == 1) {
+ flags |= NOARGS | TRANSPOSE;
+ }
+ while (--ac && **++av == '-')
+ for (p = *av+1; *p; p++)
+ switch (*p) {
+ case 'T':
+ flags |= MTRANSPOSE;
+ case 't':
+ flags |= TRANSPOSE;
+ break;
+ case 'c': /* input col. separator */
+ flags |= ONEISEPONLY;
+ case 's': /* one or more allowed */
+ if (p[1])
+ isep = *++p;
+ else
+ isep = '\t'; /* default is ^I */
+ break;
+ case 'C':
+ flags |= ONEOSEPONLY;
+ case 'S':
+ if (p[1])
+ osep = *++p;
+ else
+ osep = '\t'; /* default is ^I */
+ break;
+ case 'w': /* window width, default 80 */
+ p = getnum(&owidth, p, 0);
+ if (owidth <= 0)
+ errx(1, "width must be a positive integer");
+ break;
+ case 'K': /* skip N lines */
+ flags |= SKIPPRINT;
+ case 'k': /* skip, do not print */
+ p = getnum(&skip, p, 0);
+ if (!skip)
+ skip = 1;
+ break;
+ case 'm':
+ flags |= NOTRIMENDCOL;
+ break;
+ case 'g': /* gutter space */
+ p = getnum(&gutter, p, 0);
+ break;
+ case 'G':
+ p = getnum(&propgutter, p, 0);
+ break;
+ case 'e': /* each line is an entry */
+ flags |= ONEPERLINE;
+ break;
+ case 'E':
+ flags |= ONEPERCHAR;
+ break;
+ case 'j': /* right adjust */
+ flags |= RIGHTADJUST;
+ break;
+ case 'n': /* null padding for missing values */
+ flags |= NULLPAD;
+ break;
+ case 'y':
+ flags |= RECYCLE;
+ break;
+ case 'H': /* print shape only */
+ flags |= DETAILSHAPE;
+ case 'h':
+ flags |= SHAPEONLY;
+ break;
+ case 'z': /* squeeze col width */
+ flags |= SQUEEZE;
+ break;
+ /*case 'p':
+ ipagespace = atoi(++p); (default is 1)
+ break;*/
+ case 'o': /* col order */
+ p = getlist(&cord, p);
+ break;
+ case 'b':
+ flags |= ICOLBOUNDS;
+ p = getlist(&icbd, p);
+ break;
+ case 'B':
+ flags |= OCOLBOUNDS;
+ p = getlist(&ocbd, p);
+ break;
+ default:
+ usage();
+ }
+ /*if (!osep)
+ osep = isep;*/
+ switch (ac) {
+ /*case 3:
+ opages = atoi(av[2]);*/
+ case 2:
+ if ((ocols = atoi(av[1])) < 0)
+ ocols = 0;
+ case 1:
+ if ((orows = atoi(av[0])) < 0)
+ orows = 0;
+ case 0:
+ break;
+ default:
+ errx(1, "too many arguments");
+ }
+}
+
+static char *
+getlist(short **list, char *p)
+{
+ int count = 1;
+ char *t;
+
+ for (t = p + 1; *t; t++) {
+ if (!isdigit((unsigned char)*t))
+ errx(1,
+ "option %.1s requires a list of unsigned numbers separated by commas", t);
+ count++;
+ while (*t && isdigit((unsigned char)*t))
+ t++;
+ if (*t != ',')
+ break;
+ }
+ if (!(*list = (short *) malloc(count * sizeof(short))))
+ errx(1, "no list space");
+ count = 0;
+ for (t = p + 1; *t; t++) {
+ (*list)[count++] = atoi(t);
+ printf("++ %d ", (*list)[count-1]);
+ fflush(stdout);
+ while (*t && isdigit((unsigned char)*t))
+ t++;
+ if (*t != ',')
+ break;
+ }
+ (*list)[count] = 0;
+ return(t - 1);
+}
+
+/*
+ * num = number p points to; if (strict) complain
+ * returns pointer to end of num
+ */
+static char *
+getnum(int *num, char *p, int strict)
+{
+ char *t = p;
+
+ if (!isdigit((unsigned char)*++t)) {
+ if (strict || *t == '-' || *t == '+')
+ errx(1, "option %.1s requires an unsigned integer", p);
+ *num = 0;
+ return(p);
+ }
+ *num = atoi(t);
+ while (*++t)
+ if (!isdigit((unsigned char)*t))
+ break;
+ return(--t);
+}
diff --git a/usr.bin/rsh/Makefile b/usr.bin/rsh/Makefile
new file mode 100644
index 0000000..66638cc
--- /dev/null
+++ b/usr.bin/rsh/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 7/19/93
+# $FreeBSD$
+
+PROG= rsh
+CFLAGS+=-I${.CURDIR}/../../libexec/rlogind
+
+PACKAGE=rcmds
+
+BINOWN= root
+BINMODE=4555
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rsh/Makefile.depend b/usr.bin/rsh/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/rsh/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/rsh/rsh.1 b/usr.bin/rsh/rsh.1
new file mode 100644
index 0000000..7cc64d2
--- /dev/null
+++ b/usr.bin/rsh/rsh.1
@@ -0,0 +1,172 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)rsh.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd October 16, 2002
+.Dt RSH 1
+.Os
+.Sh NAME
+.Nm rsh
+.Nd remote shell
+.Sh SYNOPSIS
+.Nm
+.Op Fl 46dn
+.Op Fl l Ar username
+.Op Fl t Ar timeout
+.Ar host
+.Op command
+.Sh DESCRIPTION
+The
+.Nm
+utility executes
+.Ar command
+on
+.Ar host .
+.Pp
+The
+.Nm
+utility copies its standard input to the remote command, the standard
+output of the remote command to its standard output, and the
+standard error of the remote command to its standard error.
+Interrupt, quit and terminate signals are propagated to the remote
+command;
+.Nm
+normally terminates when the remote command does.
+The options are as follows:
+.Bl -tag -width flag
+.It Fl 4
+Use IPv4 addresses only.
+.It Fl 6
+Use IPv6 addresses only.
+.It Fl d
+Turn on socket debugging (using
+.Xr setsockopt 2 )
+on the
+.Tn TCP
+sockets used for communication with the remote host.
+.It Fl l Ar username
+Allow the remote
+.Ar username
+to be specified.
+By default, the remote username is the same as the local username.
+Authorization is determined
+as in
+.Xr rlogin 1 .
+.It Fl n
+Redirect input from the special device
+.Pa /dev/null
+(see the
+.Sx BUGS
+section of this manual page).
+.It Fl t Ar timeout
+Allow a
+.Ar timeout
+to be specified (in seconds).
+If no
+data is sent or received in this time,
+.Nm
+will exit.
+.El
+.Pp
+If no
+.Ar command
+is specified, you will be logged in on the remote host using
+.Xr rlogin 1 .
+.Pp
+Shell metacharacters which are not quoted are interpreted on local machine,
+while quoted metacharacters are interpreted on the remote machine.
+For example, the command
+.Pp
+.Dl rsh otherhost cat remotefile >> localfile
+.Pp
+appends the remote file
+.Ar remotefile
+to the local file
+.Ar localfile ,
+while
+.Pp
+.Dl rsh otherhost cat remotefile \&">>\&" other_remotefile
+.Pp
+appends
+.Ar remotefile
+to
+.Ar other_remotefile .
+.\" .Pp
+.\" Many sites specify a large number of host names as commands in the
+.\" directory /usr/hosts.
+.\" If this directory is included in your search path, you can use the
+.\" shorthand ``host command'' for the longer form ``rsh host command''.
+.Sh FILES
+.Bl -tag -width /etc/hosts -compact
+.It Pa /etc/hosts
+.El
+.Sh SEE ALSO
+.Xr rlogin 1 ,
+.Xr setsockopt 2 ,
+.Xr rcmd 3 ,
+.Xr ruserok 3 ,
+.Xr hosts 5 ,
+.Xr hosts.equiv 5 ,
+.Xr rlogind 8 ,
+.Xr rshd 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Sh BUGS
+If you are using
+.Xr csh 1
+and put a
+.Nm
+in the background without redirecting its input away from the terminal,
+it will block even if no reads are posted by the remote command.
+If no input is desired you should redirect the input of
+.Nm
+to
+.Pa /dev/null
+using the
+.Fl n
+option.
+.Pp
+You cannot run an interactive command
+(like
+.Xr ee 1
+or
+.Xr vi 1 )
+using
+.Nm ;
+use
+.Xr rlogin 1
+instead.
+.Pp
+Stop signals stop the local
+.Nm
+process only; this is arguably wrong, but currently hard to fix for reasons
+too complicated to explain here.
diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c
new file mode 100644
index 0000000..5fa33e2
--- /dev/null
+++ b/usr.bin/rsh/rsh.c
@@ -0,0 +1,376 @@
+/*-
+ * Copyright (c) 1983, 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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) 1983, 1990, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static const char sccsid[] = "From: @(#)rsh.c 8.3 (Berkeley) 4/6/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
+
+#include <err.h>
+#include <errno.h>
+#include <libutil.h>
+#include <paths.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * rsh - remote shell
+ */
+static int rfd2;
+
+static int family = PF_UNSPEC;
+static char rlogin[] = "rlogin";
+
+void connect_timeout(int);
+char *copyargs(char * const *);
+void sendsig(int);
+void talk(int, long, pid_t, int, int);
+void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct passwd const *pw;
+ struct servent const *sp;
+ long omask;
+ int argoff, asrsh, ch, dflag, nflag, one, rem;
+ pid_t pid = 0;
+ uid_t uid;
+ char *args, *host, *p, *user;
+ int timeout = 0;
+
+ argoff = asrsh = dflag = nflag = 0;
+ one = 1;
+ host = user = NULL;
+
+ /* if called as something other than "rsh", use it as the host name */
+ if ((p = strrchr(argv[0], '/')))
+ ++p;
+ else
+ p = argv[0];
+ if (strcmp(p, "rsh"))
+ host = p;
+ else
+ asrsh = 1;
+
+ /* handle "rsh host flags" */
+ if (!host && argc > 2 && argv[1][0] != '-') {
+ host = argv[1];
+ argoff = 1;
+ }
+
+#define OPTIONS "468Lde:l:nt:w"
+ while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
+ switch(ch) {
+ case '4':
+ family = PF_INET;
+ break;
+
+ case '6':
+ family = PF_INET6;
+ break;
+
+ case 'L': /* -8Lew are ignored to allow rlogin aliases */
+ case 'e':
+ case 'w':
+ case '8':
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'l':
+ user = optarg;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ case 't':
+ timeout = atoi(optarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ optind += argoff;
+
+ /* if haven't gotten a host yet, do so */
+ if (!host && !(host = argv[optind++]))
+ usage();
+
+ /* if no further arguments, must have been called as rlogin. */
+ if (!argv[optind]) {
+ if (asrsh)
+ *argv = rlogin;
+ execv(_PATH_RLOGIN, argv);
+ err(1, "can't exec %s", _PATH_RLOGIN);
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (!(pw = getpwuid(uid = getuid())))
+ errx(1, "unknown user id");
+ if (!user)
+ user = pw->pw_name;
+
+ args = copyargs(argv);
+
+ sp = NULL;
+ if (sp == NULL)
+ sp = getservbyname("shell", "tcp");
+ if (sp == NULL)
+ errx(1, "shell/tcp: unknown service");
+
+ if (timeout) {
+ signal(SIGALRM, connect_timeout);
+ alarm(timeout);
+ }
+ rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, &rfd2,
+ family);
+ if (timeout) {
+ signal(SIGALRM, SIG_DFL);
+ alarm(0);
+ }
+
+ if (rem < 0)
+ exit(1);
+
+ if (rfd2 < 0)
+ errx(1, "can't establish stderr");
+ if (dflag) {
+ if (setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one,
+ sizeof(one)) < 0)
+ warn("setsockopt");
+ if (setsockopt(rfd2, SOL_SOCKET, SO_DEBUG, &one,
+ sizeof(one)) < 0)
+ warn("setsockopt");
+ }
+
+ (void)setuid(uid);
+ omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGTERM));
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGINT, sendsig);
+ if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGQUIT, sendsig);
+ if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+ (void)signal(SIGTERM, sendsig);
+
+ if (!nflag) {
+ pid = fork();
+ if (pid < 0)
+ err(1, "fork");
+ }
+ else
+ (void)shutdown(rem, SHUT_WR);
+
+ (void)ioctl(rfd2, FIONBIO, &one);
+ (void)ioctl(rem, FIONBIO, &one);
+
+ talk(nflag, omask, pid, rem, timeout);
+
+ if (!nflag)
+ (void)kill(pid, SIGKILL);
+ exit(0);
+}
+
+void
+talk(int nflag, long omask, pid_t pid, int rem, int timeout)
+{
+ int cc, wc;
+ fd_set readfrom, ready, rembits;
+ char buf[BUFSIZ];
+ const char *bp;
+ struct timeval tvtimeout;
+ int nfds, srval;
+
+ if (!nflag && pid == 0) {
+ (void)close(rfd2);
+
+reread: errno = 0;
+ if ((cc = read(0, buf, sizeof buf)) <= 0)
+ goto done;
+ bp = buf;
+
+rewrite:
+ if (rem >= FD_SETSIZE)
+ errx(1, "descriptor too big");
+ FD_ZERO(&rembits);
+ FD_SET(rem, &rembits);
+ nfds = rem + 1;
+ if (select(nfds, 0, &rembits, 0, 0) < 0) {
+ if (errno != EINTR)
+ err(1, "select");
+ goto rewrite;
+ }
+ if (!FD_ISSET(rem, &rembits))
+ goto rewrite;
+ wc = write(rem, bp, cc);
+ if (wc < 0) {
+ if (errno == EWOULDBLOCK)
+ goto rewrite;
+ goto done;
+ }
+ bp += wc;
+ cc -= wc;
+ if (cc == 0)
+ goto reread;
+ goto rewrite;
+done:
+ (void)shutdown(rem, SHUT_WR);
+ exit(0);
+ }
+
+ tvtimeout.tv_sec = timeout;
+ tvtimeout.tv_usec = 0;
+
+ (void)sigsetmask(omask);
+ if (rfd2 >= FD_SETSIZE || rem >= FD_SETSIZE)
+ errx(1, "descriptor too big");
+ FD_ZERO(&readfrom);
+ FD_SET(rfd2, &readfrom);
+ FD_SET(rem, &readfrom);
+ nfds = MAX(rfd2+1, rem+1);
+ do {
+ ready = readfrom;
+ if (timeout) {
+ srval = select(nfds, &ready, 0, 0, &tvtimeout);
+ } else {
+ srval = select(nfds, &ready, 0, 0, 0);
+ }
+
+ if (srval < 0) {
+ if (errno != EINTR)
+ err(1, "select");
+ continue;
+ }
+ if (srval == 0)
+ errx(1, "timeout reached (%d seconds)", timeout);
+ if (FD_ISSET(rfd2, &ready)) {
+ errno = 0;
+ cc = read(rfd2, buf, sizeof buf);
+ if (cc <= 0) {
+ if (errno != EWOULDBLOCK)
+ FD_CLR(rfd2, &readfrom);
+ } else
+ (void)write(STDERR_FILENO, buf, cc);
+ }
+ if (FD_ISSET(rem, &ready)) {
+ errno = 0;
+ cc = read(rem, buf, sizeof buf);
+ if (cc <= 0) {
+ if (errno != EWOULDBLOCK)
+ FD_CLR(rem, &readfrom);
+ } else
+ (void)write(STDOUT_FILENO, buf, cc);
+ }
+ } while (FD_ISSET(rfd2, &readfrom) || FD_ISSET(rem, &readfrom));
+}
+
+void
+connect_timeout(int sig __unused)
+{
+ char message[] = "timeout reached before connection completed.\n";
+
+ write(STDERR_FILENO, message, sizeof(message) - 1);
+ _exit(1);
+}
+
+void
+sendsig(int sig)
+{
+ char signo;
+
+ signo = sig;
+ (void)write(rfd2, &signo, 1);
+}
+
+char *
+copyargs(char * const *argv)
+{
+ int cc;
+ char *args, *p;
+ char * const *ap;
+
+ cc = 0;
+ for (ap = argv; *ap; ++ap)
+ cc += strlen(*ap) + 1;
+ if (!(args = malloc((u_int)cc)))
+ err(1, NULL);
+ for (p = args, ap = argv; *ap; ++ap) {
+ (void)strcpy(p, *ap);
+ for (p = strcpy(p, *ap); *p; ++p);
+ if (ap[1])
+ *p++ = ' ';
+ }
+ return (args);
+}
+
+void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: rsh [-46dn] [-l username] [-t timeout] host [command]\n");
+ exit(1);
+}
diff --git a/usr.bin/rup/Makefile b/usr.bin/rup/Makefile
new file mode 100644
index 0000000..54e114e
--- /dev/null
+++ b/usr.bin/rup/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= rup
+
+WARNS?= 3
+LIBADD= rpcsvc
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rup/Makefile.depend b/usr.bin/rup/Makefile.depend
new file mode 100644
index 0000000..bdd7bc2
--- /dev/null
+++ b/usr.bin/rup/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/librpcsvc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/rup/rup.1 b/usr.bin/rup/rup.1
new file mode 100644
index 0000000..499d6ab
--- /dev/null
+++ b/usr.bin/rup/rup.1
@@ -0,0 +1,95 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1985, 1991 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 7, 1993
+.Dt RUP 1
+.Os
+.Sh NAME
+.Nm rup
+.Nd remote status display
+.Sh SYNOPSIS
+.Nm
+.Op Ar host ...
+.Sh DESCRIPTION
+The
+.Nm
+utility displays a summary of the current system status of a particular
+.Ar host
+or all hosts on the local network.
+The output shows the current time of day, how long the system has
+been up,
+and the load averages.
+The load average numbers give the number of jobs in the run queue
+averaged over 1, 5 and 15 minutes.
+.Pp
+The
+.Xr rpc.rstatd 8
+daemon must be running on the remote host for this command to
+work.
+The
+.Nm
+utility uses an RPC protocol defined in
+.In rpcsvc/rstat.x .
+.Sh EXAMPLES
+.Bd -literal
+example% rup otherhost
+otherhost 7:36am up 6 days, 16:45, load average: 0.20, 0.23, 0.18
+example%
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It rup: RPC: Program not registered
+The
+.Xr rpc.rstatd 8
+daemon has not been started on the remote host.
+.It rup: RPC: Timed out
+A communication error occurred.
+Either the network is
+excessively congested, or the
+.Xr rpc.rstatd 8
+daemon has terminated on the remote host.
+.It rup: RPC: Port mapper failure - RPC: Timed out
+The remote host is not running the portmapper (see
+.Xr rpcbind 8 ) ,
+and cannot accommodate any RPC-based services.
+The host may be down.
+.El
+.Sh SEE ALSO
+.Xr rpc.rstatd 8 ,
+.Xr rpcbind 8
+.Sh HISTORY
+The
+.Nm
+command
+appeared in
+.Tn Sun-OS .
+.Sh BUGS
+The sorting options are not implemented.
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c
new file mode 100644
index 0000000..239b313
--- /dev/null
+++ b/usr.bin/rup/rup.c
@@ -0,0 +1,254 @@
+/*-
+ * Copyright (c) 1993, John Brezak
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+
+#undef FSHIFT /* Use protocol's shift and scale values */
+#undef FSCALE
+
+#include <rpcsvc/rstat.h>
+
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+#define HOST_WIDTH 15
+
+struct host_list {
+ struct host_list *next;
+ struct in_addr addr;
+} *hosts;
+
+static int
+search_host(struct in_addr addr)
+{
+ struct host_list *hp;
+
+ if (!hosts)
+ return(0);
+
+ for (hp = hosts; hp != NULL; hp = hp->next) {
+ if (hp->addr.s_addr == addr.s_addr)
+ return(1);
+ }
+ return(0);
+}
+
+static void
+remember_host(struct in_addr addr)
+{
+ struct host_list *hp;
+
+ if (!(hp = (struct host_list *)malloc(sizeof(struct host_list))))
+ errx(1, "no memory");
+ hp->addr.s_addr = addr.s_addr;
+ hp->next = hosts;
+ hosts = hp;
+}
+
+static bool_t
+rstat_reply(caddr_t replyp, struct sockaddr_in *raddrp)
+{
+ struct tm *tmp_time;
+ struct tm host_time;
+ struct tm host_uptime;
+ char days_buf[16];
+ char hours_buf[16];
+ struct hostent *hp;
+ char *host;
+ statstime *host_stat = (statstime *)replyp;
+ time_t tmp_time_t;
+
+ if (search_host(raddrp->sin_addr))
+ return(0);
+
+ hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
+ sizeof(struct in_addr), AF_INET);
+ if (hp)
+ host = hp->h_name;
+ else
+ host = inet_ntoa(raddrp->sin_addr);
+
+ /* truncate hostname to fit nicely into field */
+ if (strlen(host) > HOST_WIDTH)
+ host[HOST_WIDTH] = '\0';
+
+ printf("%-*s\t", HOST_WIDTH, host);
+
+ if (sizeof(time_t) == sizeof(host_stat->curtime.tv_sec)) {
+ tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec);
+ host_time = *tmp_time;
+
+ host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
+
+ tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec);
+ host_uptime = *tmp_time;
+ }
+ else { /* non-32-bit time_t */
+ tmp_time_t = host_stat->curtime.tv_sec;
+ tmp_time = localtime(&tmp_time_t);
+ host_time = *tmp_time;
+
+ host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
+
+ tmp_time_t = host_stat->curtime.tv_sec;
+ tmp_time = gmtime(&tmp_time_t);
+ host_uptime = *tmp_time;
+ }
+
+ #define updays (host_stat->curtime.tv_sec / 86400)
+ if (host_uptime.tm_yday != 0)
+ sprintf(days_buf, "%3d day%s, ", updays,
+ (updays > 1) ? "s" : "");
+ else
+ days_buf[0] = '\0';
+
+ if (host_uptime.tm_hour != 0)
+ sprintf(hours_buf, "%2d:%02d, ",
+ host_uptime.tm_hour, host_uptime.tm_min);
+ else
+ if (host_uptime.tm_min != 0)
+ sprintf(hours_buf, "%2d mins, ", host_uptime.tm_min);
+ else if (host_stat->curtime.tv_sec < 60)
+ sprintf(hours_buf, "%2d secs, ", host_uptime.tm_sec);
+ else
+ hours_buf[0] = '\0';
+
+ printf(" %2d:%02d%cm up %9.9s%9.9s load average: %.2f %.2f %.2f\n",
+ (host_time.tm_hour % 12) ? host_time.tm_hour % 12 : 12,
+ host_time.tm_min,
+ (host_time.tm_hour >= 12) ? 'p' : 'a',
+ days_buf,
+ hours_buf,
+ (double)host_stat->avenrun[0]/FSCALE,
+ (double)host_stat->avenrun[1]/FSCALE,
+ (double)host_stat->avenrun[2]/FSCALE);
+
+ remember_host(raddrp->sin_addr);
+ return(0);
+}
+
+static int
+onehost(char *host)
+{
+ CLIENT *rstat_clnt;
+ statstime host_stat;
+ struct sockaddr_in addr;
+ struct hostent *hp;
+ struct timeval tv;
+
+ hp = gethostbyname(host);
+ if (hp == NULL) {
+ warnx("unknown host \"%s\"", host);
+ return(-1);
+ }
+
+ rstat_clnt = clnt_create(host, RSTATPROG, RSTATVERS_TIME, "udp");
+ if (rstat_clnt == NULL) {
+ warnx("%s %s", host, clnt_spcreateerror(""));
+ return(-1);
+ }
+
+ bzero((char *)&host_stat, sizeof(host_stat));
+ tv.tv_sec = 15; /* XXX ??? */
+ tv.tv_usec = 0;
+ if (clnt_call(rstat_clnt, RSTATPROC_STATS,
+ (xdrproc_t)xdr_void, NULL,
+ (xdrproc_t)xdr_statstime, &host_stat, tv) != RPC_SUCCESS) {
+ warnx("%s: %s", host, clnt_sperror(rstat_clnt, host));
+ clnt_destroy(rstat_clnt);
+ return(-1);
+ }
+
+ addr.sin_addr.s_addr = *(int *)hp->h_addr;
+ rstat_reply((caddr_t)&host_stat, &addr);
+ clnt_destroy(rstat_clnt);
+ return (0);
+}
+
+static void
+allhosts(void)
+{
+ statstime host_stat;
+ enum clnt_stat clnt_stat;
+
+ clnt_stat = clnt_broadcast(RSTATPROG, RSTATVERS_TIME, RSTATPROC_STATS,
+ (xdrproc_t)xdr_void, NULL,
+ (xdrproc_t)xdr_statstime, &host_stat,
+ (resultproc_t)rstat_reply);
+ if (clnt_stat != RPC_SUCCESS && clnt_stat != RPC_TIMEDOUT)
+ errx(1, "%s", clnt_sperrno(clnt_stat));
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: rup [host ...]\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, "?")) != -1)
+ switch (ch) {
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+
+ setlinebuf(stdout);
+ if (argc == optind)
+ allhosts();
+ else {
+ for (; optind < argc; optind++)
+ (void) onehost(argv[optind]);
+ }
+ exit(0);
+}
diff --git a/usr.bin/ruptime/Makefile b/usr.bin/ruptime/Makefile
new file mode 100644
index 0000000..d181c9c
--- /dev/null
+++ b/usr.bin/ruptime/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= ruptime
+
+PACKAGE=rcmds
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ruptime/Makefile.depend b/usr.bin/ruptime/Makefile.depend
new file mode 100644
index 0000000..26cae4e
--- /dev/null
+++ b/usr.bin/ruptime/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/protocols \
+ 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/ruptime/ruptime.1 b/usr.bin/ruptime/ruptime.1
new file mode 100644
index 0000000..56aa394
--- /dev/null
+++ b/usr.bin/ruptime/ruptime.1
@@ -0,0 +1,90 @@
+.\" Copyright (c) 1983, 1990, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)ruptime.1 8.2 (Berkeley) 4/5/94
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2003
+.Dt RUPTIME 1
+.Os
+.Sh NAME
+.Nm ruptime
+.Nd show host status of local machines
+.Sh SYNOPSIS
+.Nm
+.Op Fl alrtu
+.Op Ar host ...
+.Sh DESCRIPTION
+The
+.Nm
+utility gives a status line like
+.Xr uptime 1
+for each machine on the local network; these are formed from packets
+broadcast by each host on the network once every three minutes.
+.Pp
+If no operands are given,
+.Nm
+displays uptime status for all machines;
+otherwise only those hosts specified on the command line are displayed.
+If hosts are specified on the command line, the sort order is equivalent
+to the order hosts were specified on the command line.
+.Pp
+Machines for which no status report has been received for 11
+minutes are shown as being down, and machines for which no status
+report has been received for 4 days are not shown in the list at all.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Include all users.
+By default, if a user has not typed to the system for
+an hour or more, then the user will be omitted from the output.
+.It Fl l
+Sort by load average.
+.It Fl r
+Reverse the sort order.
+.It Fl t
+Sort by uptime.
+.It Fl u
+Sort by number of users.
+.El
+.Pp
+The default listing is sorted by host name.
+.Sh FILES
+.Bl -tag -width /var/rwho/whod.* -compact
+.It Pa /var/rwho/whod.*
+data files
+.El
+.Sh SEE ALSO
+.Xr rwho 1 ,
+.Xr uptime 1 ,
+.Xr rwhod 8
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.Bx 4.2 .
diff --git a/usr.bin/ruptime/ruptime.c b/usr.bin/ruptime/ruptime.c
new file mode 100644
index 0000000..2f791be
--- /dev/null
+++ b/usr.bin/ruptime/ruptime.c
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 1983, 1993, 1994
+ * 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) 1983, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)ruptime.c 8.2 (Berkeley) 4/5/94";
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <protocols/rwhod.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+static struct hs {
+ struct whod hs_wd;
+ int hs_nusers;
+} *hs;
+#define LEFTEARTH(h) (now - (h) > 4*24*60*60)
+#define ISDOWN(h) (now - (h)->hs_wd.wd_recvtime > 11 * 60)
+#define WHDRSIZE __offsetof(struct whod, wd_we)
+
+static size_t nhosts;
+static time_t now;
+static int rflg = 1;
+static DIR *dirp;
+
+static int hscmp(const void *, const void *);
+static char *interval(time_t, const char *);
+static int lcmp(const void *, const void *);
+static void ruptime(const char *, int, int (*)(const void *, const void *));
+static int tcmp(const void *, const void *);
+static int ucmp(const void *, const void *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int (*cmp)(const void *, const void *);
+ int aflg, ch;
+
+ aflg = 0;
+ cmp = hscmp;
+ while ((ch = getopt(argc, argv, "alrut")) != -1)
+ switch (ch) {
+ case 'a':
+ aflg = 1;
+ break;
+ case 'l':
+ cmp = lcmp;
+ break;
+ case 'r':
+ rflg = -1;
+ break;
+ case 't':
+ cmp = tcmp;
+ break;
+ case 'u':
+ cmp = ucmp;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (chdir(_PATH_RWHODIR) || (dirp = opendir(".")) == NULL)
+ err(1, "%s", _PATH_RWHODIR);
+
+ ruptime(*argv, aflg, cmp);
+ while (*argv++ != NULL) {
+ if (*argv == NULL)
+ break;
+ ruptime(*argv, aflg, cmp);
+ }
+ exit(0);
+}
+
+static char *
+interval(time_t tval, const char *updown)
+{
+ static char resbuf[32];
+ int days, hours, minutes;
+
+ if (tval < 0) {
+ (void)snprintf(resbuf, sizeof(resbuf), "%s ??:??", updown);
+ return (resbuf);
+ }
+ /* Round to minutes. */
+ minutes = (tval + (60 - 1)) / 60;
+ hours = minutes / 60;
+ minutes %= 60;
+ days = hours / 24;
+ hours %= 24;
+ if (days)
+ (void)snprintf(resbuf, sizeof(resbuf),
+ "%s %4d+%02d:%02d", updown, days, hours, minutes);
+ else
+ (void)snprintf(resbuf, sizeof(resbuf),
+ "%s %2d:%02d", updown, hours, minutes);
+ return (resbuf);
+}
+
+#define HS(a) ((const struct hs *)(a))
+
+/* Alphabetical comparison. */
+static int
+hscmp(const void *a1, const void *a2)
+{
+ return (rflg *
+ strcmp(HS(a1)->hs_wd.wd_hostname, HS(a2)->hs_wd.wd_hostname));
+}
+
+/* Load average comparison. */
+static int
+lcmp(const void *a1, const void *a2)
+{
+ if (ISDOWN(HS(a1)))
+ if (ISDOWN(HS(a2)))
+ return (tcmp(a1, a2));
+ else
+ return (rflg);
+ else if (ISDOWN(HS(a2)))
+ return (-rflg);
+ else
+ return (rflg *
+ (HS(a2)->hs_wd.wd_loadav[0] - HS(a1)->hs_wd.wd_loadav[0]));
+}
+
+static void
+ruptime(const char *host, int aflg, int (*cmp)(const void *, const void *))
+{
+ struct hs *hsp;
+ struct whod *wd;
+ struct whoent *we;
+ struct dirent *dp;
+ const char *hostname;
+ int fd, i, maxloadav;
+ size_t hspace;
+ ssize_t cc;
+
+ rewinddir(dirp);
+ hsp = NULL;
+ maxloadav = -1;
+ (void)time(&now);
+ for (nhosts = hspace = 0; (dp = readdir(dirp)) != NULL;) {
+ if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5) != 0)
+ continue;
+ if ((fd = open(dp->d_name, O_RDONLY, 0)) < 0) {
+ warn("%s", dp->d_name);
+ continue;
+ }
+
+ if (nhosts == hspace) {
+ if ((hs =
+ realloc(hs, (hspace += 40) * sizeof(*hs))) == NULL)
+ err(1, NULL);
+ hsp = hs + nhosts;
+ }
+
+ wd = &hsp->hs_wd;
+ cc = read(fd, wd, sizeof(*wd));
+ (void)close(fd);
+ if (cc < (ssize_t)WHDRSIZE)
+ continue;
+
+ if (host != NULL) {
+ hostname = wd->wd_hostname;
+ if (strcasecmp(hostname, host) != 0)
+ continue;
+ }
+ if (LEFTEARTH(wd->wd_recvtime))
+ continue;
+
+ for (i = 0; i < 2; i++)
+ if (wd->wd_loadav[i] > maxloadav)
+ maxloadav = wd->wd_loadav[i];
+
+ for (hsp->hs_nusers = 0, we = &wd->wd_we[0];
+ (char *)(we + 1) <= (char *)wd + cc; we++)
+ if (aflg || we->we_idle < 3600)
+ ++hsp->hs_nusers;
+ ++hsp;
+ ++nhosts;
+ }
+ if (nhosts == 0) {
+ if (host == NULL)
+ errx(1, "no hosts in %s", _PATH_RWHODIR);
+ else
+ warnx("host %s not in %s", host, _PATH_RWHODIR);
+ }
+
+ qsort(hs, nhosts, sizeof(hs[0]), cmp);
+ for (i = 0; i < (int)nhosts; i++) {
+ hsp = &hs[i];
+ wd = &hsp->hs_wd;
+ if (ISDOWN(hsp)) {
+ (void)printf("%-25.25s%s\n", wd->wd_hostname,
+ interval(now - hsp->hs_wd.wd_recvtime, "down"));
+ continue;
+ }
+ (void)printf(
+ "%-25.25s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n",
+ wd->wd_hostname,
+ interval((time_t)wd->wd_sendtime -
+ (time_t)wd->wd_boottime, " up"),
+ hsp->hs_nusers,
+ hsp->hs_nusers == 1 ? ", " : "s,",
+ maxloadav >= 1000 ? 5 : 4,
+ wd->wd_loadav[0] / 100.0,
+ maxloadav >= 1000 ? 5 : 4,
+ wd->wd_loadav[1] / 100.0,
+ maxloadav >= 1000 ? 5 : 4,
+ wd->wd_loadav[2] / 100.0);
+ }
+ free(hs);
+ hs = NULL;
+}
+
+/* Number of users comparison. */
+static int
+ucmp(const void *a1, const void *a2)
+{
+ if (ISDOWN(HS(a1)))
+ if (ISDOWN(HS(a2)))
+ return (tcmp(a1, a2));
+ else
+ return (rflg);
+ else if (ISDOWN(HS(a2)))
+ return (-rflg);
+ else
+ return (rflg * (HS(a2)->hs_nusers - HS(a1)->hs_nusers));
+}
+
+/* Uptime comparison. */
+static int
+tcmp(const void *a1, const void *a2)
+{
+ return (rflg * (
+ (ISDOWN(HS(a2)) ? HS(a2)->hs_wd.wd_recvtime - now
+ : HS(a2)->hs_wd.wd_sendtime - HS(a2)->hs_wd.wd_boottime)
+ -
+ (ISDOWN(HS(a1)) ? HS(a1)->hs_wd.wd_recvtime - now
+ : HS(a1)->hs_wd.wd_sendtime - HS(a1)->hs_wd.wd_boottime)
+ ));
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: ruptime [-alrtu] [host ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/rusers/Makefile b/usr.bin/rusers/Makefile
new file mode 100644
index 0000000..f640350
--- /dev/null
+++ b/usr.bin/rusers/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG = rusers
+
+LIBADD= rpcsvc
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rusers/Makefile.depend b/usr.bin/rusers/Makefile.depend
new file mode 100644
index 0000000..bdd7bc2
--- /dev/null
+++ b/usr.bin/rusers/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/librpcsvc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/rusers/rusers.1 b/usr.bin/rusers/rusers.1
new file mode 100644
index 0000000..8980d21
--- /dev/null
+++ b/usr.bin/rusers/rusers.1
@@ -0,0 +1,104 @@
+.\" Copyright (c) 1983, 1990 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.
+.\"
+.\" from: @(#)rusers.1 6.7 (Berkeley) 4/23/91
+.\" $FreeBSD$
+.\"
+.Dd April 23, 1991
+.Dt RUSERS 1
+.Os
+.Sh NAME
+.Nm rusers
+.Nd who is logged in to machines on local network
+.Sh SYNOPSIS
+.Nm
+.Op Fl al
+.Op Ar host ...
+.Sh DESCRIPTION
+The
+.Nm
+command produces output similar to
+.Xr who 1 ,
+but for the list of
+.Ar host Ns s
+or all machines on the local
+network.
+For each
+.Ar host
+responding to the
+.Nm
+query,
+the hostname with the names of the users currently logged
+on is printed on each line.
+The
+.Nm
+command will wait for
+one minute to catch late responders.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Print all machines responding even if no one is currently logged in.
+.It Fl l
+Print a long format listing.
+This includes the user name, host name,
+tty that the user is logged in to, the date and time the user
+logged in, the amount of time since the user typed on the keyboard,
+and the remote host they logged in from (if applicable).
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It rusers: RPC: Program not registered
+The
+.Xr rpc.rusersd 8
+daemon has not been started on the remote host.
+.It rusers: RPC: Timed out
+A communication error occurred.
+Either the network is
+excessively congested, or the
+.Xr rpc.rusersd 8
+daemon has terminated on the remote host.
+.It rusers: "RPC: Port mapper failure - RPC: Timed out"
+The remote host is not running the portmapper (see
+.Xr rpcbind 8 ) ,
+and cannot accommodate any RPC-based services.
+The host may be down.
+.El
+.Sh SEE ALSO
+.Xr rwho 1 ,
+.Xr users 1 ,
+.Xr who 1 ,
+.Xr rpc.rusersd 8 ,
+.Xr rpcbind 8
+.Sh HISTORY
+The
+.Nm
+command
+appeared in
+.Em Sun-OS .
+.Sh BUGS
+The sorting options are not implemented.
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
new file mode 100644
index 0000000..4d641dc
--- /dev/null
+++ b/usr.bin/rusers/rusers.c
@@ -0,0 +1,251 @@
+/*-
+ * Copyright (c) 1993, John Brezak
+ * 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 the University of
+ * California, Berkeley and its contributors.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+#include <rpcsvc/rnusers.h>
+
+#include <arpa/inet.h>
+
+#include <err.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <timeconv.h>
+#include <unistd.h>
+
+#define MAX_INT 0x7fffffff
+#define HOST_WIDTH 20
+#define LINE_WIDTH 15
+
+static int longopt;
+static int allopt;
+
+static struct host_list {
+ struct host_list *next;
+ struct in_addr addr;
+} *hosts;
+
+static int
+search_host(struct in_addr addr)
+{
+ struct host_list *hp;
+
+ if (hosts == NULL)
+ return (0);
+
+ for (hp = hosts; hp != NULL; hp = hp->next) {
+ if (hp->addr.s_addr == addr.s_addr)
+ return (1);
+ }
+ return (0);
+}
+
+static void
+remember_host(struct in_addr addr)
+{
+ struct host_list *hp;
+
+ if ((hp = (struct host_list *)malloc(sizeof(struct host_list))) == NULL)
+ errx(1, "no memory");
+ hp->addr.s_addr = addr.s_addr;
+ hp->next = hosts;
+ hosts = hp;
+}
+
+static int
+rusers_reply(caddr_t replyp, struct sockaddr_in *raddrp)
+{
+ u_int x;
+ int idle;
+ char date[32], idle_time[64], remote[64];
+ struct hostent *hp;
+ utmpidlearr *up, u;
+ char *host;
+ int days, hours, minutes, seconds;
+
+ up = &u;
+ memcpy(up, replyp, sizeof(*up));
+ if (search_host(raddrp->sin_addr))
+ return (0);
+
+ if (!allopt && up->utmpidlearr_len == 0)
+ return (0);
+
+ hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
+ sizeof(struct in_addr), AF_INET);
+ if (hp != NULL)
+ host = hp->h_name;
+ else
+ host = inet_ntoa(raddrp->sin_addr);
+
+ if (!longopt)
+ printf("%-*s ", HOST_WIDTH, host);
+
+ for (x = 0; x < up->utmpidlearr_len; x++) {
+ time_t t = _int_to_time(up->utmpidlearr_val[x].ui_utmp.ut_time);
+ strncpy(date, &(ctime(&t)[4]), sizeof(date) - 1);
+
+ idle = up->utmpidlearr_val[x].ui_idle;
+ sprintf(idle_time, " :%02d", idle);
+ if (idle == MAX_INT)
+ strcpy(idle_time, "??");
+ else if (idle == 0)
+ strcpy(idle_time, "");
+ else {
+ seconds = idle;
+ days = seconds / (60 * 60 * 24);
+ seconds %= (60 * 60 * 24);
+ hours = seconds / (60 * 60);
+ seconds %= (60 * 60);
+ minutes = seconds / 60;
+ seconds %= 60;
+ if (idle > 60)
+ sprintf(idle_time, "%d:%02d", minutes, seconds);
+ if (idle >= (60 * 60))
+ sprintf(idle_time, "%d:%02d:%02d",
+ hours, minutes, seconds);
+ if (idle >= (24 * 60 * 60))
+ sprintf(idle_time, "%d days, %d:%02d:%02d",
+ days, hours, minutes, seconds);
+ }
+
+ strncpy(remote, up->utmpidlearr_val[x].ui_utmp.ut_host,
+ sizeof(remote) - 1);
+ if (strlen(remote) != 0)
+ sprintf(remote, "(%.16s)",
+ up->utmpidlearr_val[x].ui_utmp.ut_host);
+
+ if (longopt)
+ printf("%-8.8s %*s:%-*.*s %-12.12s %6s %.18s\n",
+ up->utmpidlearr_val[x].ui_utmp.ut_name,
+ HOST_WIDTH, host, LINE_WIDTH, LINE_WIDTH,
+ up->utmpidlearr_val[x].ui_utmp.ut_line, date,
+ idle_time, remote );
+ else
+ printf("%s ",
+ up->utmpidlearr_val[x].ui_utmp.ut_name);
+ }
+ if (!longopt)
+ putchar('\n');
+
+ remember_host(raddrp->sin_addr);
+ return (0);
+}
+
+static void
+onehost(char *host)
+{
+ utmpidlearr up;
+ CLIENT *rusers_clnt;
+ struct sockaddr_in addr;
+ struct hostent *hp;
+ struct timeval tv;
+
+ hp = gethostbyname(host);
+ if (hp == NULL)
+ errx(1, "unknown host \"%s\"", host);
+
+ rusers_clnt = clnt_create(host, RUSERSPROG, RUSERSVERS_IDLE, "udp");
+ if (rusers_clnt == NULL)
+ errx(1, "%s", clnt_spcreateerror(""));
+
+ bzero((char *)&up, sizeof(up));
+ tv.tv_sec = 15; /* XXX ?? */
+ tv.tv_usec = 0;
+ if (clnt_call(rusers_clnt, RUSERSPROC_NAMES, (xdrproc_t)xdr_void, NULL,
+ (xdrproc_t)xdr_utmpidlearr, &up, tv) != RPC_SUCCESS)
+ errx(1, "%s", clnt_sperror(rusers_clnt, ""));
+ memcpy(&addr.sin_addr.s_addr, hp->h_addr, sizeof(addr.sin_addr.s_addr));
+ rusers_reply((caddr_t)&up, &addr);
+ clnt_destroy(rusers_clnt);
+}
+
+static void
+allhosts(void)
+{
+ utmpidlearr up;
+ enum clnt_stat clnt_stat;
+
+ bzero((char *)&up, sizeof(up));
+ clnt_stat = clnt_broadcast(RUSERSPROG, RUSERSVERS_IDLE,
+ RUSERSPROC_NAMES, (xdrproc_t)xdr_void, NULL,
+ (xdrproc_t)xdr_utmpidlearr, (char *)&up,
+ (resultproc_t)rusers_reply);
+ if (clnt_stat != RPC_SUCCESS && clnt_stat != RPC_TIMEDOUT)
+ errx(1, "%s", clnt_sperrno(clnt_stat));
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: rusers [-al] [host ...]\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, "al")) != -1)
+ switch (ch) {
+ case 'a':
+ allopt++;
+ break;
+ case 'l':
+ longopt++;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ setlinebuf(stdout);
+ if (argc == optind)
+ allhosts();
+ else {
+ for (; optind < argc; optind++)
+ (void)onehost(argv[optind]);
+ }
+ exit(0);
+}
diff --git a/usr.bin/rwall/Makefile b/usr.bin/rwall/Makefile
new file mode 100644
index 0000000..4e448db
--- /dev/null
+++ b/usr.bin/rwall/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG = rwall
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rwall/Makefile.depend b/usr.bin/rwall/Makefile.depend
new file mode 100644
index 0000000..ddd5dbd
--- /dev/null
+++ b/usr.bin/rwall/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ 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/rwall/rwall.1 b/usr.bin/rwall/rwall.1
new file mode 100644
index 0000000..bb545e8
--- /dev/null
+++ b/usr.bin/rwall/rwall.1
@@ -0,0 +1,79 @@
+.\" Copyright (c) 1983, 1990 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.
+.\"
+.\" from: @(#)rwall.1 6.7 (Berkeley) 4/23/91
+.\" $FreeBSD$
+.\"
+.Dd April 23, 1991
+.Dt RWALL 1
+.Os
+.Sh NAME
+.Nm rwall
+.Nd send a message to users logged on a host
+.Sh SYNOPSIS
+.Nm
+.Ar host
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+command sends a message to the users logged into the specified
+.Ar host .
+The
+message to be sent can be typed in and terminated with EOF or it can
+be in a
+.Ar file .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It rwall: RPC: Program not registered
+The
+.Xr rpc.rwalld 8
+daemon has not been started on the remote host.
+.It rwall: RPC: Timed out
+A communication error occurred.
+Either the network is
+excessively congested, or the
+.Xr rpc.rwalld 8
+daemon has terminated on the remote host.
+.It rwall: RPC: Port mapper failure - RPC: Timed out
+The remote host is not running the portmapper (see
+.Xr rpcbind 8 ) ,
+and cannot accommodate any RPC-based services.
+The host may be down.
+.El
+.Sh SEE ALSO
+.Xr who 1 ,
+.Xr rpc.rwalld 8 ,
+.Xr rpcbind 8
+.Sh HISTORY
+The
+.Nm
+command
+appeared in
+.Em Sun-OS .
+.Sh BUGS
+The sorting options are not implemented.
diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c
new file mode 100644
index 0000000..c235ea7
--- /dev/null
+++ b/usr.bin/rwall/rwall.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * Copyright (c) 1988, 1990 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.
+ * 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
+ * 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) 1988 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91";
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * This program is not related to David Wall, whose Stanford Ph.D. thesis
+ * is entitled "Mechanisms for Broadcast and Selective Broadcast".
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/rwall.h>
+#include <err.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+static char *mbuf;
+
+static char notty[] = "no tty";
+
+static void makemsg(const char *);
+static void usage(void);
+
+/* ARGSUSED */
+int
+main(int argc, char *argv[])
+{
+ char *wallhost, res;
+ CLIENT *cl;
+ struct timeval tv;
+
+ if ((argc < 2) || (argc > 3))
+ usage();
+
+ wallhost = argv[1];
+
+ makemsg(argv[2]);
+
+ /*
+ * Create client "handle" used for calling MESSAGEPROG on the
+ * server designated on the command line. We tell the rpc package
+ * to use the "tcp" protocol when contacting the server.
+ */
+ cl = clnt_create(wallhost, WALLPROG, WALLVERS, "udp");
+ if (cl == NULL) {
+ /*
+ * Couldn't establish connection with server.
+ * Print error message and die.
+ */
+ errx(1, "%s", clnt_spcreateerror(wallhost));
+ }
+
+ tv.tv_sec = 15; /* XXX ?? */
+ tv.tv_usec = 0;
+ if (clnt_call(cl, WALLPROC_WALL, (xdrproc_t)xdr_wrapstring, &mbuf,
+ (xdrproc_t)xdr_void, &res, tv) != RPC_SUCCESS) {
+ /*
+ * An error occurred while calling the server.
+ * Print error message and die.
+ */
+ errx(1, "%s", clnt_sperror(cl, wallhost));
+ }
+
+ return (0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: rwall host [file]\n");
+ exit(1);
+}
+
+static void
+makemsg(const char *fname)
+{
+ struct tm *lt;
+ struct passwd *pw;
+ struct stat sbuf;
+ time_t now;
+ FILE *fp;
+ int fd;
+ size_t mbufsize;
+ char *tty, hostname[MAXHOSTNAMELEN], lbuf[256], tmpname[64];
+ const char *whom;
+
+ snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);
+ if ((fd = mkstemp(tmpname)) == -1 || (fp = fdopen(fd, "r+")) == NULL)
+ err(1, "can't open temporary file");
+ unlink(tmpname);
+
+ whom = getlogin();
+ if (!whom) {
+ pw = getpwuid(getuid());
+ whom = pw ? pw->pw_name : "???";
+ }
+ gethostname(hostname, sizeof(hostname));
+ time(&now);
+ lt = localtime(&now);
+
+ /*
+ * all this stuff is to blank out a square for the message;
+ * we wrap message lines at column 79, not 80, because some
+ * terminals wrap after 79, some do not, and we can't tell.
+ * Which means that we may leave a non-blank character
+ * in column 80, but that can't be helped.
+ */
+ fprintf(fp, "Remote Broadcast Message from %s@%s\n",
+ whom, hostname);
+ tty = ttyname(STDERR_FILENO);
+ if (tty == NULL)
+ tty = notty;
+ fprintf(fp, " (%s) at %d:%02d ...\n", tty,
+ lt->tm_hour, lt->tm_min);
+
+ putc('\n', fp);
+
+ if (fname && !(freopen(fname, "r", stdin)))
+ err(1, "can't read %s", fname);
+ while (fgets(lbuf, sizeof(lbuf), stdin))
+ fputs(lbuf, fp);
+ rewind(fp);
+
+ if (fstat(fd, &sbuf))
+ err(1, "can't stat temporary file");
+ mbufsize = (size_t)sbuf.st_size;
+ mbuf = malloc(mbufsize);
+ if (mbuf == NULL)
+ err(1, "out of memory");
+ if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != (u_int)mbufsize)
+ err(1, "can't read temporary file");
+ close(fd);
+}
diff --git a/usr.bin/rwho/Makefile b/usr.bin/rwho/Makefile
new file mode 100644
index 0000000..701817b
--- /dev/null
+++ b/usr.bin/rwho/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= rwho
+
+PACKAGE=rcmds
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/rwho/Makefile.depend b/usr.bin/rwho/Makefile.depend
new file mode 100644
index 0000000..26cae4e
--- /dev/null
+++ b/usr.bin/rwho/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/protocols \
+ 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/rwho/rwho.1 b/usr.bin/rwho/rwho.1
new file mode 100644
index 0000000..066f252
--- /dev/null
+++ b/usr.bin/rwho/rwho.1
@@ -0,0 +1,80 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)rwho.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt RWHO 1
+.Os
+.Sh NAME
+.Nm rwho
+.Nd who is logged in on local machines
+.Sh SYNOPSIS
+.Nm
+.Op Fl a
+.Sh DESCRIPTION
+The
+.Nm
+command produces output similar to
+.Xr who 1 ,
+but for all machines on the local network.
+If no report has been
+received from a machine for 11 minutes then
+.Nm
+assumes the machine is down, and does not report users last known
+to be logged into that machine.
+.Pp
+If a user has not typed to the system for a minute or more, then
+.Nm
+reports this idle time.
+.Pp
+The following option is available:
+.Bl -tag -width indent
+.It Fl a
+Include all users.
+By default, if a user has not typed to the system for
+an hour or more, then the user will be omitted from the output.
+.El
+.Sh FILES
+.Bl -tag -width /var/rwho/whod.* -compact
+.It Pa /var/rwho/whod.*
+information about other machines
+.El
+.Sh SEE ALSO
+.Xr ruptime 1 ,
+.Xr who 1 ,
+.Xr rwhod 8
+.Sh HISTORY
+The
+.Nm
+command
+appeared in
+.Bx 4.3 .
+.Sh BUGS
+This is unwieldy when the number of machines
+on the local net is large.
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c
new file mode 100644
index 0000000..3fb0da5
--- /dev/null
+++ b/usr.bin/rwho/rwho.c
@@ -0,0 +1,247 @@
+/*-
+ * Copyright (c) 1983, 1993 The Regents of the University of California.
+ * Copyright (c) 2013 Mariusz Zaborski <oshogbo@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.
+ * 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) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)rwho.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/capsicum.h>
+#include <sys/param.h>
+#include <sys/file.h>
+
+#include <protocols/rwhod.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <timeconv.h>
+#include <unistd.h>
+
+#define NUSERS 1000
+#define WHDRSIZE (ssize_t)(sizeof(wd) - sizeof(wd.wd_we))
+/*
+ * this macro should be shared with ruptime.
+ */
+#define down(w,now) ((now) - (w)->wd_recvtime > 11 * 60)
+
+static DIR *dirp;
+static struct whod wd;
+static int nusers;
+static struct myutmp {
+ char myhost[sizeof(wd.wd_hostname)];
+ int myidle;
+ struct outmp myutmp;
+} myutmp[NUSERS];
+
+static time_t now;
+static int aflg;
+
+static void usage(void);
+static int utmpcmp(const void *, const void *);
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+ struct dirent *dp;
+ int width;
+ ssize_t cc;
+ struct whod *w;
+ struct whoent *we;
+ struct myutmp *mp;
+ cap_rights_t rights;
+ int f, n, i;
+ int d_first;
+ int dfd;
+ time_t ct;
+
+ w = &wd;
+ (void) setlocale(LC_TIME, "");
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+
+ while ((ch = getopt(argc, argv, "a")) != -1) {
+ switch ((char)ch) {
+ case 'a':
+ aflg = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 0)
+ usage();
+
+ if (chdir(_PATH_RWHODIR) < 0)
+ err(1, "chdir(%s)", _PATH_RWHODIR);
+ if ((dirp = opendir(".")) == NULL)
+ err(1, "opendir(%s)", _PATH_RWHODIR);
+ dfd = dirfd(dirp);
+ mp = myutmp;
+ cap_rights_init(&rights, CAP_READ, CAP_LOOKUP);
+ if (cap_rights_limit(dfd, &rights) < 0 && errno != ENOSYS)
+ err(1, "cap_rights_limit failed: %s", _PATH_RWHODIR);
+ /*
+ * Cache files required for time(3) and localtime(3) before entering
+ * capability mode.
+ */
+ (void) time(&ct);
+ (void) localtime(&ct);
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "cap_enter");
+ (void) time(&now);
+ cap_rights_init(&rights, CAP_READ);
+ while ((dp = readdir(dirp)) != NULL) {
+ if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5) != 0)
+ continue;
+ f = openat(dfd, dp->d_name, O_RDONLY);
+ if (f < 0)
+ continue;
+ if (cap_rights_limit(f, &rights) < 0 && errno != ENOSYS)
+ err(1, "cap_rights_limit failed: %s", dp->d_name);
+ cc = read(f, (char *)&wd, sizeof(struct whod));
+ if (cc < WHDRSIZE) {
+ (void) close(f);
+ continue;
+ }
+ if (down(w, now) != 0) {
+ (void) close(f);
+ continue;
+ }
+ cc -= WHDRSIZE;
+ we = w->wd_we;
+ for (n = cc / sizeof(struct whoent); n > 0; n--) {
+ if (aflg == 0 && we->we_idle >= 60 * 60) {
+ we++;
+ continue;
+ }
+ if (nusers >= NUSERS)
+ errx(1, "too many users");
+ mp->myutmp = we->we_utmp;
+ mp->myidle = we->we_idle;
+ (void) strcpy(mp->myhost, w->wd_hostname);
+ nusers++;
+ we++;
+ mp++;
+ }
+ (void) close(f);
+ }
+ qsort((char *)myutmp, nusers, sizeof(struct myutmp), utmpcmp);
+ mp = myutmp;
+ width = 0;
+ for (i = 0; i < nusers; i++) {
+ /* append one for the blank and use 8 for the out_line */
+ int j;
+
+ j = strlen(mp->myhost) + 1 + sizeof(mp->myutmp.out_line);
+ if (j > width)
+ width = j;
+ mp++;
+ }
+ mp = myutmp;
+ for (i = 0; i < nusers; i++) {
+ char buf[BUFSIZ], cbuf[80];
+ time_t t;
+
+ t = _int_to_time(mp->myutmp.out_time);
+ strftime(cbuf, sizeof(cbuf), d_first ? "%e %b %R" : "%b %e %R",
+ localtime(&t));
+ (void) sprintf(buf, "%s:%-.*s", mp->myhost,
+ (int)sizeof(mp->myutmp.out_line), mp->myutmp.out_line);
+ printf("%-*.*s %-*s %s",
+ (int)sizeof(mp->myutmp.out_name),
+ (int)sizeof(mp->myutmp.out_name),
+ mp->myutmp.out_name, width, buf, cbuf);
+ mp->myidle /= 60;
+ if (mp->myidle != 0) {
+ if (aflg != 0) {
+ if (mp->myidle >= 100 * 60)
+ mp->myidle = 100 * 60 - 1;
+ if (mp->myidle >= 60)
+ printf(" %2d", mp->myidle / 60);
+ else
+ printf(" ");
+ } else {
+ printf(" ");
+ }
+ printf(":%02d", mp->myidle % 60);
+ }
+ printf("\n");
+ mp++;
+ }
+ exit(0);
+}
+
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: rwho [-a]\n");
+ exit(1);
+}
+
+#define MYUTMP(a) ((const struct myutmp *)(a))
+
+static int
+utmpcmp(const void *u1, const void *u2)
+{
+ int rc;
+
+ rc = strncmp(MYUTMP(u1)->myutmp.out_name, MYUTMP(u2)->myutmp.out_name,
+ sizeof(MYUTMP(u2)->myutmp.out_name));
+ if (rc != 0)
+ return (rc);
+ rc = strcmp(MYUTMP(u1)->myhost, MYUTMP(u2)->myhost);
+ if (rc != 0)
+ return (rc);
+ return (strncmp(MYUTMP(u1)->myutmp.out_line,
+ MYUTMP(u2)->myutmp.out_line, sizeof(MYUTMP(u2)->myutmp.out_line)));
+}
diff --git a/usr.bin/script/Makefile b/usr.bin/script/Makefile
new file mode 100644
index 0000000..f75106f
--- /dev/null
+++ b/usr.bin/script/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= script
+
+LIBADD= util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/script/Makefile.depend b/usr.bin/script/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/script/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
new file mode 100644
index 0000000..bf33205
--- /dev/null
+++ b/usr.bin/script/script.1
@@ -0,0 +1,217 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)script.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 4, 2013
+.Dt SCRIPT 1
+.Os
+.Sh NAME
+.Nm script
+.Nd make typescript of terminal session
+.Sh SYNOPSIS
+.Nm
+.Op Fl adfkpqr
+.Op Fl F Ar pipe
+.Op Fl t Ar time
+.Op Ar file Op Ar command ...
+.Sh DESCRIPTION
+The
+.Nm
+utility makes a typescript of everything printed on your terminal.
+It is useful for students who need a hardcopy record of an interactive
+session as proof of an assignment, as the typescript file
+can be printed out later with
+.Xr lpr 1 .
+.Pp
+If the argument
+.Ar file
+is given,
+.Nm
+saves all dialogue in
+.Ar file .
+If no file name is given, the typescript is saved in the file
+.Pa typescript .
+.Pp
+If the argument
+.Ar command
+is given,
+.Nm
+will run the specified command with an optional argument vector
+instead of an interactive shell.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Append the output to
+.Ar file
+or
+.Pa typescript ,
+retaining the prior contents.
+.It Fl d
+When playing back a session with the
+.Fl p
+flag, do not sleep between records when playing back a timestamped session.
+.It Fl F Ar pipe
+Immediately flush output after each write.
+This will allow a user to create a named pipe using
+.Xr mkfifo 1
+and another user may watch the live session using a utility like
+.Xr cat 1 .
+.It Fl f
+Create
+.Ar file.filemon
+or
+.Pa typescript.filemon
+using
+.Xr filemon 4 .
+.It Fl k
+Log keys sent to the program as well as output.
+.It Fl p
+Play back a session recorded with the
+.Fl r
+flag in real time.
+.It Fl q
+Run in quiet mode, omit the start, stop and command status messages.
+.It Fl r
+Record a session with input, output, and timestamping.
+.It Fl t Ar time
+Specify the interval at which the script output file will be flushed
+to disk, in seconds.
+A value of 0
+causes
+.Nm
+to flush after every character I/O event.
+The default interval is
+30 seconds.
+.El
+.Pp
+The script ends when the forked shell (or command) exits (a
+.Em control-D
+to exit
+the Bourne shell
+.Pf ( Xr sh 1 ) ,
+and
+.Em exit ,
+.Em logout
+or
+.Em control-D
+(if
+.Em ignoreeof
+is not set) for the
+C-shell,
+.Xr csh 1 ) .
+.Pp
+Certain interactive commands, such as
+.Xr vi 1 ,
+create garbage in the typescript file.
+The
+.Nm
+utility works best with commands that do not manipulate the screen.
+The results are meant to emulate a hardcopy terminal, not an addressable one.
+.Sh ENVIRONMENT
+The following environment variables are utilized by
+.Nm :
+.Bl -tag -width SHELL
+.It Ev SCRIPT
+The
+.Ev SCRIPT
+environment variable is added to the sub-shell.
+If
+.Ev SCRIPT
+already existed in the users environment,
+its value is overwritten within the sub-shell.
+The value of
+.Ev SCRIPT
+is the name of the
+.Ar typescript
+file.
+.It Ev SHELL
+If the variable
+.Ev SHELL
+exists, the shell forked by
+.Nm
+will be that shell.
+If
+.Ev SHELL
+is not set, the Bourne shell
+is assumed.
+.Pq Most shells set this variable automatically .
+.El
+.Sh SEE ALSO
+.Xr csh 1
+.Po
+for the
+.Em history
+mechanism
+.Pc ,
+.Xr filemon 4
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Pp
+The
+.Fl d ,
+.Fl p
+and
+.Fl r
+options first appeared in
+.Nx 2.0
+and were ported to
+.Fx 9.2 .
+.Sh BUGS
+The
+.Nm
+utility places
+.Sy everything
+in the log file, including linefeeds and backspaces.
+This is not what the naive user expects.
+.Pp
+It is not possible to specify a command without also naming the script file
+because of argument parsing compatibility issues.
+.Pp
+When running in
+.Fl k
+mode, echo cancelling is far from ideal.
+The slave terminal mode is checked
+for ECHO mode to check when to avoid manual echo logging.
+This does not
+work when the terminal is in a raw mode where
+the program being run is doing manual echo.
+.Pp
+If
+.Nm
+reads zero bytes from the terminal, it switches to a mode when it
+only attempts to read
+once a second until there is data to read.
+This prevents
+.Nm
+from spinning on zero-byte reads, but might cause a 1-second delay in
+processing of user input.
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
new file mode 100644
index 0000000..0128463
--- /dev/null
+++ b/usr.bin/script/script.c
@@ -0,0 +1,507 @@
+/*
+ * Copyright (c) 2010, 2012 David E. O'Brien
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/param.h>
+__FBSDID("$FreeBSD$");
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+#ifndef lint
+static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/endian.h>
+#include <dev/filemon/filemon.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libutil.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+#define DEF_BUF 65536
+
+struct stamp {
+ uint64_t scr_len; /* amount of data */
+ uint64_t scr_sec; /* time it arrived in seconds... */
+ uint32_t scr_usec; /* ...and microseconds */
+ uint32_t scr_direction; /* 'i', 'o', etc (also indicates endianness) */
+};
+
+static FILE *fscript;
+static int master, slave;
+static int child;
+static const char *fname;
+static char *fmfname;
+static int fflg, qflg, ttyflg;
+static int usesleep, rawout, showexit;
+
+static struct termios tt;
+
+static void done(int) __dead2;
+static void doshell(char **);
+static void finish(void);
+static void record(FILE *, char *, size_t, int);
+static void consume(FILE *, off_t, char *, int);
+static void playback(FILE *) __dead2;
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int cc;
+ struct termios rtt, stt;
+ struct winsize win;
+ struct timeval tv, *tvp;
+ time_t tvec, start;
+ char obuf[BUFSIZ];
+ char ibuf[BUFSIZ];
+ fd_set rfd;
+ int aflg, Fflg, kflg, pflg, ch, k, n;
+ int flushtime, readstdin;
+ int fm_fd, fm_log;
+
+ aflg = Fflg = kflg = pflg = 0;
+ usesleep = 1;
+ rawout = 0;
+ flushtime = 30;
+ fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC
+ warning. (not needed w/clang) */
+ showexit = 0;
+
+ while ((ch = getopt(argc, argv, "adFfkpqrt:")) != -1)
+ switch(ch) {
+ case 'a':
+ aflg = 1;
+ break;
+ case 'd':
+ usesleep = 0;
+ break;
+ case 'F':
+ Fflg = 1;
+ break;
+ case 'f':
+ fflg = 1;
+ break;
+ case 'k':
+ kflg = 1;
+ break;
+ case 'p':
+ pflg = 1;
+ break;
+ case 'q':
+ qflg = 1;
+ break;
+ case 'r':
+ rawout = 1;
+ break;
+ case 't':
+ flushtime = atoi(optarg);
+ if (flushtime < 0)
+ err(1, "invalid flush time %d", flushtime);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0) {
+ fname = argv[0];
+ argv++;
+ argc--;
+ } else
+ fname = "typescript";
+
+ if ((fscript = fopen(fname, pflg ? "r" : aflg ? "a" : "w")) == NULL)
+ err(1, "%s", fname);
+
+ if (fflg) {
+ asprintf(&fmfname, "%s.filemon", fname);
+ if (!fmfname)
+ err(1, "%s.filemon", fname);
+ if ((fm_fd = open("/dev/filemon", O_RDWR | O_CLOEXEC)) == -1)
+ err(1, "open(\"/dev/filemon\", O_RDWR)");
+ if ((fm_log = open(fmfname,
+ O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1)
+ err(1, "open(%s)", fmfname);
+ if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) < 0)
+ err(1, "Cannot set filemon log file descriptor");
+ }
+
+ if (pflg)
+ playback(fscript);
+
+ if ((ttyflg = isatty(STDIN_FILENO)) != 0) {
+ if (tcgetattr(STDIN_FILENO, &tt) == -1)
+ err(1, "tcgetattr");
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1)
+ err(1, "ioctl");
+ if (openpty(&master, &slave, NULL, &tt, &win) == -1)
+ err(1, "openpty");
+ } else {
+ if (openpty(&master, &slave, NULL, NULL, NULL) == -1)
+ err(1, "openpty");
+ }
+
+ if (rawout)
+ record(fscript, NULL, 0, 's');
+
+ if (!qflg) {
+ tvec = time(NULL);
+ (void)printf("Script started, output file is %s\n", fname);
+ if (!rawout) {
+ (void)fprintf(fscript, "Script started on %s",
+ ctime(&tvec));
+ if (argv[0]) {
+ showexit = 1;
+ fprintf(fscript, "Command: ");
+ for (k = 0 ; argv[k] ; ++k)
+ fprintf(fscript, "%s%s", k ? " " : "",
+ argv[k]);
+ fprintf(fscript, "\n");
+ }
+ }
+ fflush(fscript);
+ if (fflg) {
+ (void)printf("Filemon started, output file is %s\n",
+ fmfname);
+ }
+ }
+ if (ttyflg) {
+ rtt = tt;
+ cfmakeraw(&rtt);
+ rtt.c_lflag &= ~ECHO;
+ (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt);
+ }
+
+ child = fork();
+ if (child < 0) {
+ warn("fork");
+ done(1);
+ }
+ if (child == 0) {
+ if (fflg) {
+ int pid;
+
+ pid = getpid();
+ if (ioctl(fm_fd, FILEMON_SET_PID, &pid) < 0)
+ err(1, "Cannot set filemon PID");
+ }
+
+ doshell(argv);
+ }
+ close(slave);
+
+ start = tvec = time(0);
+ readstdin = 1;
+ for (;;) {
+ FD_ZERO(&rfd);
+ FD_SET(master, &rfd);
+ if (readstdin)
+ FD_SET(STDIN_FILENO, &rfd);
+ if (!readstdin && ttyflg) {
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+ tvp = &tv;
+ readstdin = 1;
+ } else if (flushtime > 0) {
+ tv.tv_sec = flushtime - (tvec - start);
+ tv.tv_usec = 0;
+ tvp = &tv;
+ } else {
+ tvp = NULL;
+ }
+ n = select(master + 1, &rfd, 0, 0, tvp);
+ if (n < 0 && errno != EINTR)
+ break;
+ if (n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) {
+ cc = read(STDIN_FILENO, ibuf, BUFSIZ);
+ if (cc < 0)
+ break;
+ if (cc == 0) {
+ if (tcgetattr(master, &stt) == 0 &&
+ (stt.c_lflag & ICANON) != 0) {
+ (void)write(master, &stt.c_cc[VEOF], 1);
+ }
+ readstdin = 0;
+ }
+ if (cc > 0) {
+ if (rawout)
+ record(fscript, ibuf, cc, 'i');
+ (void)write(master, ibuf, cc);
+ if (kflg && tcgetattr(master, &stt) >= 0 &&
+ ((stt.c_lflag & ECHO) == 0)) {
+ (void)fwrite(ibuf, 1, cc, fscript);
+ }
+ }
+ }
+ if (n > 0 && FD_ISSET(master, &rfd)) {
+ cc = read(master, obuf, sizeof (obuf));
+ if (cc <= 0)
+ break;
+ (void)write(STDOUT_FILENO, obuf, cc);
+ if (rawout)
+ record(fscript, obuf, cc, 'o');
+ else
+ (void)fwrite(obuf, 1, cc, fscript);
+ }
+ tvec = time(0);
+ if (tvec - start >= flushtime) {
+ fflush(fscript);
+ start = tvec;
+ }
+ if (Fflg)
+ fflush(fscript);
+ }
+ finish();
+ done(0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: script [-adfkpqr] [-t time] [file [command ...]]\n");
+ exit(1);
+}
+
+static void
+finish(void)
+{
+ int e, status;
+
+ if (waitpid(child, &status, 0) == child) {
+ if (WIFEXITED(status))
+ e = WEXITSTATUS(status);
+ else if (WIFSIGNALED(status))
+ e = WTERMSIG(status);
+ else /* can't happen */
+ e = 1;
+ done(e);
+ }
+}
+
+static void
+doshell(char **av)
+{
+ const char *shell;
+
+ shell = getenv("SHELL");
+ if (shell == NULL)
+ shell = _PATH_BSHELL;
+
+ (void)close(master);
+ (void)fclose(fscript);
+ free(fmfname);
+ login_tty(slave);
+ setenv("SCRIPT", fname, 1);
+ if (av[0]) {
+ execvp(av[0], av);
+ warn("%s", av[0]);
+ } else {
+ execl(shell, shell, "-i", (char *)NULL);
+ warn("%s", shell);
+ }
+ exit(1);
+}
+
+static void
+done(int eno)
+{
+ time_t tvec;
+
+ if (ttyflg)
+ (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &tt);
+ tvec = time(NULL);
+ if (rawout)
+ record(fscript, NULL, 0, 'e');
+ if (!qflg) {
+ if (!rawout) {
+ if (showexit)
+ (void)fprintf(fscript, "\nCommand exit status:"
+ " %d", eno);
+ (void)fprintf(fscript,"\nScript done on %s",
+ ctime(&tvec));
+ }
+ (void)printf("\nScript done, output file is %s\n", fname);
+ if (fflg) {
+ (void)printf("Filemon done, output file is %s\n",
+ fmfname);
+ }
+ }
+ (void)fclose(fscript);
+ (void)close(master);
+ exit(eno);
+}
+
+static void
+record(FILE *fp, char *buf, size_t cc, int direction)
+{
+ struct iovec iov[2];
+ struct stamp stamp;
+ struct timeval tv;
+
+ (void)gettimeofday(&tv, NULL);
+ stamp.scr_len = cc;
+ stamp.scr_sec = tv.tv_sec;
+ stamp.scr_usec = tv.tv_usec;
+ stamp.scr_direction = direction;
+ iov[0].iov_len = sizeof(stamp);
+ iov[0].iov_base = &stamp;
+ iov[1].iov_len = cc;
+ iov[1].iov_base = buf;
+ if (writev(fileno(fp), &iov[0], 2) == -1)
+ err(1, "writev");
+}
+
+static void
+consume(FILE *fp, off_t len, char *buf, int reg)
+{
+ size_t l;
+
+ if (reg) {
+ if (fseeko(fp, len, SEEK_CUR) == -1)
+ err(1, NULL);
+ }
+ else {
+ while (len > 0) {
+ l = MIN(DEF_BUF, len);
+ if (fread(buf, sizeof(char), l, fp) != l)
+ err(1, "cannot read buffer");
+ len -= l;
+ }
+ }
+}
+
+#define swapstamp(stamp) do { \
+ if (stamp.scr_direction > 0xff) { \
+ stamp.scr_len = bswap64(stamp.scr_len); \
+ stamp.scr_sec = bswap64(stamp.scr_sec); \
+ stamp.scr_usec = bswap32(stamp.scr_usec); \
+ stamp.scr_direction = bswap32(stamp.scr_direction); \
+ } \
+} while (0/*CONSTCOND*/)
+
+static void
+playback(FILE *fp)
+{
+ struct timespec tsi, tso;
+ struct stamp stamp;
+ struct stat pst;
+ char buf[DEF_BUF];
+ off_t nread, save_len;
+ size_t l;
+ time_t tclock;
+ int reg;
+
+ if (fstat(fileno(fp), &pst) == -1)
+ err(1, "fstat failed");
+
+ reg = S_ISREG(pst.st_mode);
+
+ for (nread = 0; !reg || nread < pst.st_size; nread += save_len) {
+ if (fread(&stamp, sizeof(stamp), 1, fp) != 1) {
+ if (reg)
+ err(1, "reading playback header");
+ else
+ break;
+ }
+ swapstamp(stamp);
+ save_len = sizeof(stamp);
+
+ if (reg && stamp.scr_len >
+ (uint64_t)(pst.st_size - save_len) - nread)
+ errx(1, "invalid stamp");
+
+ save_len += stamp.scr_len;
+ tclock = stamp.scr_sec;
+ tso.tv_sec = stamp.scr_sec;
+ tso.tv_nsec = stamp.scr_usec * 1000;
+
+ switch (stamp.scr_direction) {
+ case 's':
+ if (!qflg)
+ (void)printf("Script started on %s",
+ ctime(&tclock));
+ tsi = tso;
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'e':
+ if (!qflg)
+ (void)printf("\nScript done on %s",
+ ctime(&tclock));
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'i':
+ /* throw input away */
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'o':
+ tsi.tv_sec = tso.tv_sec - tsi.tv_sec;
+ tsi.tv_nsec = tso.tv_nsec - tsi.tv_nsec;
+ if (tsi.tv_nsec < 0) {
+ tsi.tv_sec -= 1;
+ tsi.tv_nsec += 1000000000;
+ }
+ if (usesleep)
+ (void)nanosleep(&tsi, NULL);
+ tsi = tso;
+ while (stamp.scr_len > 0) {
+ l = MIN(DEF_BUF, stamp.scr_len);
+ if (fread(buf, sizeof(char), l, fp) != l)
+ err(1, "cannot read buffer");
+
+ (void)write(STDOUT_FILENO, buf, l);
+ stamp.scr_len -= l;
+ }
+ break;
+ default:
+ errx(1, "invalid direction");
+ }
+ }
+ (void)fclose(fp);
+ exit(0);
+}
diff --git a/usr.bin/sdiff/Makefile b/usr.bin/sdiff/Makefile
new file mode 100644
index 0000000..504adc2
--- /dev/null
+++ b/usr.bin/sdiff/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= sdiff
+SRCS= common.c edit.c sdiff.c
+WARNS= 3
+
+MAN1= sdiff.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/sdiff/Makefile.depend b/usr.bin/sdiff/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/sdiff/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/sdiff/common.c b/usr.bin/sdiff/common.c
new file mode 100644
index 0000000..686965c
--- /dev/null
+++ b/usr.bin/sdiff/common.c
@@ -0,0 +1,24 @@
+/* $OpenBSD: common.c,v 1.4 2006/05/25 03:20:32 ray Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "common.h"
+
+void
+cleanup(const char *filename)
+{
+
+ if (unlink(filename))
+ err(2, "could not delete: %s", filename);
+ exit(2);
+}
diff --git a/usr.bin/sdiff/common.h b/usr.bin/sdiff/common.h
new file mode 100644
index 0000000..127c1f4
--- /dev/null
+++ b/usr.bin/sdiff/common.h
@@ -0,0 +1,9 @@
+/* $OpenBSD: common.h,v 1.2 2006/05/25 03:20:32 ray Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+void cleanup(const char *) __dead2;
diff --git a/usr.bin/sdiff/edit.c b/usr.bin/sdiff/edit.c
new file mode 100644
index 0000000..21f7cdc
--- /dev/null
+++ b/usr.bin/sdiff/edit.c
@@ -0,0 +1,205 @@
+/* $OpenBSD: edit.c,v 1.19 2009/06/07 13:29:50 ray Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "extern.h"
+
+int editit(const char *);
+
+/*
+ * Execute an editor on the specified pathname, which is interpreted
+ * from the shell. This means flags may be included.
+ *
+ * Returns -1 on error, or the exit value on success.
+ */
+int
+editit(const char *pathname)
+{
+ sig_t sighup, sigint, sigquit, sigchld;
+ pid_t pid;
+ int saved_errno, st, ret = -1;
+ const char *ed;
+
+ ed = getenv("VISUAL");
+ if (ed == NULL)
+ ed = getenv("EDITOR");
+ if (ed == NULL)
+ ed = _PATH_VI;
+
+ sighup = signal(SIGHUP, SIG_IGN);
+ sigint = signal(SIGINT, SIG_IGN);
+ sigquit = signal(SIGQUIT, SIG_IGN);
+ sigchld = signal(SIGCHLD, SIG_DFL);
+ if ((pid = fork()) == -1)
+ goto fail;
+ if (pid == 0) {
+ execlp(ed, ed, pathname, (char *)NULL);
+ _exit(127);
+ }
+ while (waitpid(pid, &st, 0) == -1)
+ if (errno != EINTR)
+ goto fail;
+ if (!WIFEXITED(st))
+ errno = EINTR;
+ else
+ ret = WEXITSTATUS(st);
+
+ fail:
+ saved_errno = errno;
+ (void)signal(SIGHUP, sighup);
+ (void)signal(SIGINT, sigint);
+ (void)signal(SIGQUIT, sigquit);
+ (void)signal(SIGCHLD, sigchld);
+ errno = saved_errno;
+ return (ret);
+}
+
+/*
+ * Parse edit command. Returns 0 on success, -1 on error.
+ */
+int
+eparse(const char *cmd, const char *left, const char *right)
+{
+ FILE *file;
+ size_t nread;
+ int fd;
+ char *filename;
+ char buf[BUFSIZ], *text;
+
+ /* Skip whitespace. */
+ while (isspace(*cmd))
+ ++cmd;
+
+ text = NULL;
+ switch (*cmd) {
+ case '\0':
+ /* Edit empty file. */
+ break;
+
+ case 'b':
+ /* Both strings. */
+ if (left == NULL)
+ goto RIGHT;
+ if (right == NULL)
+ goto LEFT;
+
+ /* Neither column is blank, so print both. */
+ if (asprintf(&text, "%s\n%s\n", left, right) == -1)
+ err(2, "could not allocate memory");
+ break;
+
+ case 'l':
+LEFT:
+ /* Skip if there is no left column. */
+ if (left == NULL)
+ break;
+
+ if (asprintf(&text, "%s\n", left) == -1)
+ err(2, "could not allocate memory");
+
+ break;
+
+ case 'r':
+RIGHT:
+ /* Skip if there is no right column. */
+ if (right == NULL)
+ break;
+
+ if (asprintf(&text, "%s\n", right) == -1)
+ err(2, "could not allocate memory");
+
+ break;
+
+ default:
+ return (-1);
+ }
+
+ /* Create temp file. */
+ if (asprintf(&filename, "%s/sdiff.XXXXXXXXXX", tmpdir) == -1)
+ err(2, "asprintf");
+ if ((fd = mkstemp(filename)) == -1)
+ err(2, "mkstemp");
+ if (text != NULL) {
+ size_t len;
+ ssize_t nwritten;
+
+ len = strlen(text);
+ if ((nwritten = write(fd, text, len)) == -1 ||
+ (size_t)nwritten != len) {
+ warn("error writing to temp file");
+ cleanup(filename);
+ }
+ }
+ close(fd);
+
+ /* text is no longer used. */
+ free(text);
+
+ /* Edit temp file. */
+ if (editit(filename) == -1) {
+ warn("error editing %s", filename);
+ cleanup(filename);
+ }
+
+ /* Open temporary file. */
+ if (!(file = fopen(filename, "r"))) {
+ warn("could not open edited file: %s", filename);
+ cleanup(filename);
+ }
+
+ /* Copy temporary file contents to output file. */
+ for (nread = sizeof(buf); nread == sizeof(buf);) {
+ size_t nwritten;
+
+ nread = fread(buf, sizeof(*buf), sizeof(buf), file);
+ /* Test for error or end of file. */
+ if (nread != sizeof(buf) &&
+ (ferror(file) || !feof(file))) {
+ warnx("error reading edited file: %s", filename);
+ cleanup(filename);
+ }
+
+ /*
+ * If we have nothing to read, break out of loop
+ * instead of writing nothing.
+ */
+ if (!nread)
+ break;
+
+ /* Write data we just read. */
+ nwritten = fwrite(buf, sizeof(*buf), nread, outfp);
+ if (nwritten != nread) {
+ warnx("error writing to output file");
+ cleanup(filename);
+ }
+ }
+
+ /* We've reached the end of the temporary file, so remove it. */
+ if (unlink(filename))
+ warn("could not delete: %s", filename);
+ fclose(file);
+
+ free(filename);
+
+ return (0);
+}
diff --git a/usr.bin/sdiff/extern.h b/usr.bin/sdiff/extern.h
new file mode 100644
index 0000000..2f24091
--- /dev/null
+++ b/usr.bin/sdiff/extern.h
@@ -0,0 +1,12 @@
+/* $OpenBSD: extern.h,v 1.5 2009/06/07 13:29:50 ray Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+extern FILE *outfp; /* file to save changes to */
+extern const char *tmpdir;
+
+int eparse(const char *, const char *, const char *);
diff --git a/usr.bin/sdiff/sdiff.1 b/usr.bin/sdiff/sdiff.1
new file mode 100644
index 0000000..16e340a
--- /dev/null
+++ b/usr.bin/sdiff/sdiff.1
@@ -0,0 +1,174 @@
+.\" $FreeBSD$
+.\" $OpenBSD: sdiff.1,v 1.15 2007/06/29 14:48:07 jmc Exp $
+.\"
+.\" Written by Raymond Lai <ray@cyth.net>.
+.\" Public domain.
+.\"
+.Dd $Mdocdate: July 5 2012 $
+.Dt SDIFF 1
+.Os
+.Sh NAME
+.Nm sdiff
+.Nd side-by-side diff
+.Sh SYNOPSIS
+.Nm
+.Op Fl abdilstW
+.Op Fl I Ar regexp
+.Op Fl o Ar outfile
+.Op Fl w Ar width
+.Ar file1
+.Ar file2
+.Sh DESCRIPTION
+.Nm
+displays two files side by side,
+with any differences between the two highlighted as follows:
+new lines are marked with
+.Sq \*(Gt ;
+deleted lines are marked with
+.Sq \*(Lt ;
+and changed lines are marked with
+.Sq \*(Ba .
+.Pp
+.Nm
+can also be used to interactively merge two files,
+prompting at each set of differences.
+See the
+.Fl o
+option for an explanation.
+.Pp
+The options are:
+.Bl -tag -width Ds
+.It Fl l -left-column
+Only print the left column for identical lines.
+.It Fl o -output Ar outfile
+Interactively merge
+.Ar file1
+and
+.Ar file2
+into
+.Ar outfile .
+In this mode, the user is prompted for each set of differences.
+See
+.Ev EDITOR
+and
+.Ev VISUAL ,
+below,
+for details of which editor, if any, is invoked.
+.Pp
+The commands are as follows:
+.Bl -tag -width Ds
+.It Cm l | 1
+Choose left set of diffs.
+.It Cm r | 2
+Choose right set of diffs.
+.It Cm s
+Silent mode \(en identical lines are not printed.
+.It Cm v
+Verbose mode \(en identical lines are printed.
+.It Cm e
+Start editing an empty file, which will be merged into
+.Ar outfile
+upon exiting the editor.
+.It Cm e Cm l
+Start editing file with left set of diffs.
+.It Cm e Cm r
+Start editing file with right set of diffs.
+.It Cm e Cm b
+Start editing file with both sets of diffs.
+.It Cm q
+Quit
+.Nm .
+.El
+.It Fl s -suppress-common-lines
+Skip identical lines.
+.It Fl w -width Ar width
+Print a maximum of
+.Ar width
+characters on each line.
+The default is 130 characters.
+.El
+.Pp
+Options passed to
+.Xr diff 1
+are:
+.Bl -tag -width Ds
+.It Fl a -text
+Treat
+.Ar file1
+and
+.Ar file2
+as text files.
+.It Fl b -ignore-space-change
+Ignore trailing blank spaces.
+.It Fl d -minimal
+Minimize diff size.
+.It Fl I -ignore-matching-lines Ar regexp
+Ignore line changes matching
+.Ar regexp .
+All lines in the change must match
+.Ar regexp
+for the change to be ignored.
+.It Fl i -ignore-case
+Do a case-insensitive comparison.
+.It Fl t -expand-tabs
+Expand tabs to spaces.
+.It Fl W -ignore-all-space
+Ignore all spaces.
+.It Fl B -ignore-blank-lines
+Ignore blank lines.
+.It Fl E -ignore-tab-expansion
+Treat tabs and eight spaces as the same.
+.It Fl t -ignore-tabs
+Ignore tabs.
+.It Fl H -speed-large-files
+Assume scattered small changes in a large file.
+.It Fl -ignore-file-name-case
+Ignore the case of file names.
+.It Fl -no-ignore-file-name-case
+Do not ignore file name case.
+.It Fl -strip-trailing-cr
+Skip identical lines.
+.It Fl -tabsize Ar NUM
+Change the size of tabs (default is 8.)
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width Ds
+.It Ev EDITOR , VISUAL
+Specifies an editor to use with the
+.Fl o
+option.
+If both
+.Ev EDITOR
+and
+.Ev VISUAL
+are set,
+.Ev VISUAL
+takes precedence.
+If neither
+.Ev EDITOR
+nor
+.Ev VISUAL
+are set,
+the default is
+.Xr vi 1 .
+.It Ev TMPDIR
+Specifies a directory for temporary files to be created.
+The default is
+.Pa /tmp .
+.El
+.Sh SEE ALSO
+.Xr cmp 1 ,
+.Xr diff 1 ,
+.Xr diff3 1 ,
+.Xr vi 1 ,
+.Xr re_format 7
+.Sh AUTHORS
+.Nm
+was written from scratch for the public domain by
+.An Ray Lai Aq ray@cyth.net .
+.Sh CAVEATS
+.Pp
+Tabs are treated as anywhere from one to eight characters wide,
+depending on the current column.
+Terminals that treat tabs as eight characters wide will look best.
+
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
new file mode 100644
index 0000000..008de53
--- /dev/null
+++ b/usr.bin/sdiff/sdiff.c
@@ -0,0 +1,1189 @@
+/* $OpenBSD: sdiff.c,v 1.36 2015/12/29 19:04:46 gsoares Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdint.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "extern.h"
+
+#define DIFF_PATH "/usr/bin/diff"
+
+#define WIDTH 126
+/*
+ * Each column must be at least one character wide, plus three
+ * characters between the columns (space, [<|>], space).
+ */
+#define WIDTH_MIN 5
+
+/* 3 kilobytes of chars */
+#define MAX_CHECK 768
+
+/* A single diff line. */
+struct diffline {
+ STAILQ_ENTRY(diffline) diffentries;
+ char *left;
+ char div;
+ char *right;
+};
+
+static void astrcat(char **, const char *);
+static void enqueue(char *, char, char *);
+static char *mktmpcpy(const char *);
+static int istextfile(FILE *);
+static void binexec(char *, char *, char *) __dead2;
+static void freediff(struct diffline *);
+static void int_usage(void);
+static int parsecmd(FILE *, FILE *, FILE *);
+static void printa(FILE *, size_t);
+static void printc(FILE *, size_t, FILE *, size_t);
+static void printcol(const char *, size_t *, const size_t);
+static void printd(FILE *, size_t);
+static void println(const char *, const char, const char *);
+static void processq(void);
+static void prompt(const char *, const char *);
+static void usage(void) __dead2;
+static char *xfgets(FILE *);
+
+static STAILQ_HEAD(, diffline) diffhead = STAILQ_HEAD_INITIALIZER(diffhead);
+static size_t line_width; /* width of a line (two columns and divider) */
+static size_t width; /* width of each column */
+static size_t file1ln, file2ln; /* line number of file1 and file2 */
+static int Iflag = 0; /* ignore sets matching regexp */
+static int lflag; /* print only left column for identical lines */
+static int sflag; /* skip identical lines */
+FILE *outfp; /* file to save changes to */
+const char *tmpdir; /* TMPDIR or /tmp */
+
+enum {
+ HELP_OPT = CHAR_MAX + 1,
+ NORMAL_OPT,
+ FCASE_SENSITIVE_OPT,
+ FCASE_IGNORE_OPT,
+ FROMFILE_OPT,
+ TOFILE_OPT,
+ UNIDIR_OPT,
+ STRIPCR_OPT,
+ HORIZ_OPT,
+ LEFTC_OPT,
+ SUPCL_OPT,
+ LF_OPT,
+ /* the following groupings must be in sequence */
+ OLDGF_OPT,
+ NEWGF_OPT,
+ UNCGF_OPT,
+ CHGF_OPT,
+ OLDLF_OPT,
+ NEWLF_OPT,
+ UNCLF_OPT,
+ /* end order-sensitive enums */
+ TSIZE_OPT,
+ HLINES_OPT,
+ LFILES_OPT,
+ DIFFPROG_OPT,
+ PIPE_FD,
+ /* pid from the diff parent (if applicable) */
+ DIFF_PID,
+
+ NOOP_OPT,
+};
+
+static struct option longopts[] = {
+ /* options only processed in sdiff */
+ { "left-column", no_argument, NULL, LEFTC_OPT },
+ { "suppress-common-lines", no_argument, NULL, 's' },
+ { "width", required_argument, NULL, 'w' },
+
+ { "output", required_argument, NULL, 'o' },
+ { "diff-program", required_argument, NULL, DIFFPROG_OPT },
+
+ { "pipe-fd", required_argument, NULL, PIPE_FD },
+ { "diff-pid", required_argument, NULL, DIFF_PID },
+ /* Options processed by diff. */
+ { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT },
+ { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT },
+ { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT },
+ { "tabsize", required_argument, NULL, TSIZE_OPT },
+ { "help", no_argument, NULL, HELP_OPT },
+ { "text", no_argument, NULL, 'a' },
+ { "ignore-blank-lines", no_argument, NULL, 'B' },
+ { "ignore-space-change", no_argument, NULL, 'b' },
+ { "minimal", no_argument, NULL, 'd' },
+ { "ignore-tab-expansion", no_argument, NULL, 'E' },
+ { "ignore-matching-lines", required_argument, NULL, 'I' },
+ { "ignore-case", no_argument, NULL, 'i' },
+ { "expand-tabs", no_argument, NULL, 't' },
+ { "speed-large-files", no_argument, NULL, 'H' },
+ { "ignore-all-space", no_argument, NULL, 'W' },
+
+ { NULL, 0, NULL, '\0'}
+};
+
+static const char *help_msg[] = {
+ "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
+ "\t-l, --left-column, Only print the left column for identical lines.",
+ "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.",
+ "\t-s, --suppress-common-lines, Skip identical lines.",
+ "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.",
+ "\tOptions passed to diff(1) are:",
+ "\t\t-a, --text, Treat file1 and file2 as text files.",
+ "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.",
+ "\t\t-d, --minimal, Minimize diff size.",
+ "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.",
+ "\t\t-i, --ignore-case, Do a case-insensitive comparison.",
+ "\t\t-t, --expand-tabs Expand tabs to spaces.",
+ "\t\t-W, --ignore-all-spaces, Ignore all spaces.",
+ "\t\t--speed-large-files, Assume large file with scattered changes.",
+ "\t\t--strip-trailing-cr, Strip trailing carriage return.",
+ "\t\t--ignore-file-name-case, Ignore case of file names.",
+ "\t\t--no-ignore-file-name-case, Do not ignore file name case",
+ "\t\t--tabsize NUM, Change size of tabs (default 8.)",
+
+ NULL,
+};
+
+/*
+ * Create temporary file if source_file is not a regular file.
+ * Returns temporary file name if one was malloced, NULL if unnecessary.
+ */
+static char *
+mktmpcpy(const char *source_file)
+{
+ struct stat sb;
+ ssize_t rcount;
+ int ifd, ofd;
+ u_char buf[BUFSIZ];
+ char *target_file;
+
+ /* Open input and output. */
+ ifd = open(source_file, O_RDONLY, 0);
+ /* File was opened successfully. */
+ if (ifd != -1) {
+ if (fstat(ifd, &sb) == -1)
+ err(2, "error getting file status from %s", source_file);
+
+ /* Regular file. */
+ if (S_ISREG(sb.st_mode)) {
+ close(ifd);
+ return (NULL);
+ }
+ } else {
+ /* If ``-'' does not exist the user meant stdin. */
+ if (errno == ENOENT && strcmp(source_file, "-") == 0)
+ ifd = STDIN_FILENO;
+ else
+ err(2, "error opening %s", source_file);
+ }
+
+ /* Not a regular file, so copy input into temporary file. */
+ if (asprintf(&target_file, "%s/sdiff.XXXXXXXXXX", tmpdir) == -1)
+ err(2, "asprintf");
+ if ((ofd = mkstemp(target_file)) == -1) {
+ warn("error opening %s", target_file);
+ goto FAIL;
+ }
+ while ((rcount = read(ifd, buf, sizeof(buf))) != -1 &&
+ rcount != 0) {
+ ssize_t wcount;
+
+ wcount = write(ofd, buf, (size_t)rcount);
+ if (-1 == wcount || rcount != wcount) {
+ warn("error writing to %s", target_file);
+ goto FAIL;
+ }
+ }
+ if (rcount == -1) {
+ warn("error reading from %s", source_file);
+ goto FAIL;
+ }
+
+ close(ifd);
+ close(ofd);
+
+ return (target_file);
+
+FAIL:
+ unlink(target_file);
+ exit(2);
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *diffpipe=NULL, *file1, *file2;
+ size_t diffargc = 0, wflag = WIDTH;
+ int ch, fd[2] = {-1}, status;
+ pid_t pid=0; pid_t ppid =-1;
+ const char *outfile = NULL;
+ struct option *popt;
+ char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2,
+ *tmp1, *tmp2, *s1, *s2;
+ int i;
+
+ /*
+ * Process diff flags.
+ */
+ /*
+ * Allocate memory for diff arguments and NULL.
+ * Each flag has at most one argument, so doubling argc gives an
+ * upper limit of how many diff args can be passed. argv[0],
+ * file1, and file2 won't have arguments so doubling them will
+ * waste some memory; however we need an extra space for the
+ * NULL at the end, so it sort of works out.
+ */
+ if (!(diffargv = calloc(argc, sizeof(char **) * 2)))
+ err(2, "main");
+
+ /* Add first argument, the program name. */
+ diffargv[diffargc++] = diffprog;
+
+ /* create a dynamic string for merging single-switch options */
+ if ( asprintf(&diffargv[diffargc++], "-") < 0 )
+ err(2, "main");
+
+ while ((ch = getopt_long(argc, argv, "aBbdEHI:ilo:stWw:",
+ longopts, NULL)) != -1) {
+ const char *errstr;
+
+ switch (ch) {
+ /* only compatible --long-name-form with diff */
+ case FCASE_IGNORE_OPT:
+ case FCASE_SENSITIVE_OPT:
+ case STRIPCR_OPT:
+ case TSIZE_OPT:
+ case 'S':
+ break;
+ /* combine no-arg single switches */
+ case 'a':
+ case 'B':
+ case 'b':
+ case 'd':
+ case 'E':
+ case 'i':
+ case 't':
+ case 'H':
+ case 'W':
+ for(popt = longopts; ch != popt->val && popt->name != NULL; popt++);
+ diffargv[1] = realloc(diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2);
+ /*
+ * In diff, the 'W' option is 'w' and the 'w' is 'W'.
+ */
+ if (ch == 'W')
+ sprintf(diffargv[1], "%sw", diffargv[1]);
+ else
+ sprintf(diffargv[1], "%s%c", diffargv[1], ch);
+ break;
+ case DIFFPROG_OPT:
+ diffargv[0] = diffprog = optarg;
+ break;
+ case 'I':
+ Iflag = 1;
+ diffargv[diffargc++] = "-I";
+ diffargv[diffargc++] = optarg;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'o':
+ outfile = optarg;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'w':
+ wflag = strtonum(optarg, WIDTH_MIN,
+ INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "width is %s: %s", errstr, optarg);
+ break;
+ case DIFF_PID:
+ ppid = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "diff pid value is %s: %s", errstr, optarg);
+ break;
+ case HELP_OPT:
+ for (i = 0; help_msg[i] != NULL; i++)
+ printf("%s\n", help_msg[i]);
+ exit(0);
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ /* no single switches were used */
+ if (strcmp(diffargv[1], "-") == 0 ) {
+ for ( i = 1; i < argc-1; i++) {
+ diffargv[i] = diffargv[i+1];
+ }
+ diffargv[diffargc-1] = NULL;
+ diffargc--;
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ if (outfile && (outfp = fopen(outfile, "w")) == NULL)
+ err(2, "could not open: %s", optarg);
+
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+
+ filename1 = argv[0];
+ filename2 = argv[1];
+
+ /*
+ * Create temporary files for diff and sdiff to share if file1
+ * or file2 are not regular files. This allows sdiff and diff
+ * to read the same inputs if one or both inputs are stdin.
+ *
+ * If any temporary files were created, their names would be
+ * saved in tmp1 or tmp2. tmp1 should never equal tmp2.
+ */
+ tmp1 = tmp2 = NULL;
+ /* file1 and file2 are the same, so copy to same temp file. */
+ if (strcmp(filename1, filename2) == 0) {
+ if ((tmp1 = mktmpcpy(filename1)))
+ filename1 = filename2 = tmp1;
+ /* Copy file1 and file2 into separate temp files. */
+ } else {
+ if ((tmp1 = mktmpcpy(filename1)))
+ filename1 = tmp1;
+ if ((tmp2 = mktmpcpy(filename2)))
+ filename2 = tmp2;
+ }
+
+ diffargv[diffargc++] = filename1;
+ diffargv[diffargc++] = filename2;
+ /* Add NULL to end of array to indicate end of array. */
+ diffargv[diffargc++] = NULL;
+
+ /* Subtract column divider and divide by two. */
+ width = (wflag - 3) / 2;
+ /* Make sure line_width can fit in size_t. */
+ if (width > (SIZE_MAX - 3) / 2)
+ errx(2, "width is too large: %zu", width);
+ line_width = width * 2 + 3;
+
+ if (ppid == -1 ) {
+ if (pipe(fd))
+ err(2, "pipe");
+
+ switch (pid = fork()) {
+ case 0:
+ /* child */
+ /* We don't read from the pipe. */
+ close(fd[0]);
+ if (dup2(fd[1], STDOUT_FILENO) == -1)
+ err(2, "child could not duplicate descriptor");
+ /* Free unused descriptor. */
+ close(fd[1]);
+ execvp(diffprog, diffargv);
+ err(2, "could not execute diff: %s", diffprog);
+ break;
+ case -1:
+ err(2, "could not fork");
+ break;
+ }
+
+ /* parent */
+ /* We don't write to the pipe. */
+ close(fd[1]);
+
+ /* Open pipe to diff command. */
+ if ((diffpipe = fdopen(fd[0], "r")) == NULL)
+ err(2, "could not open diff pipe");
+ }
+ if ((file1 = fopen(filename1, "r")) == NULL)
+ err(2, "could not open %s", filename1);
+ if ((file2 = fopen(filename2, "r")) == NULL)
+ err(2, "could not open %s", filename2);
+ if (!istextfile(file1) || !istextfile(file2)) {
+ /* Close open files and pipe, delete temps */
+ fclose(file1);
+ fclose(file2);
+ if (diffpipe != NULL)
+ fclose(diffpipe);
+ if (tmp1)
+ if (unlink(tmp1))
+ warn("Error deleting %s.", tmp1);
+ if (tmp2)
+ if (unlink(tmp2))
+ warn("Error deleting %s.", tmp2);
+ free(tmp1);
+ free(tmp2);
+ binexec(diffprog, filename1, filename2);
+ }
+ /* Line numbers start at one. */
+ file1ln = file2ln = 1;
+
+ /* Read and parse diff output. */
+ while (parsecmd(diffpipe, file1, file2) != EOF)
+ ;
+ fclose(diffpipe);
+
+ /* Wait for diff to exit. */
+ if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status) ||
+ WEXITSTATUS(status) >= 2)
+ err(2, "diff exited abnormally.");
+
+ /* Delete and free unneeded temporary files. */
+ if (tmp1)
+ if (unlink(tmp1))
+ warn("Error deleting %s.", tmp1);
+ if (tmp2)
+ if (unlink(tmp2))
+ warn("Error deleting %s.", tmp2);
+ free(tmp1);
+ free(tmp2);
+ filename1 = filename2 = tmp1 = tmp2 = NULL;
+
+ /* No more diffs, so print common lines. */
+ if (lflag)
+ while ((s1 = xfgets(file1)))
+ enqueue(s1, ' ', NULL);
+ else
+ for (;;) {
+ s1 = xfgets(file1);
+ s2 = xfgets(file2);
+ if (s1 || s2)
+ enqueue(s1, ' ', s2);
+ else
+ break;
+ }
+ fclose(file1);
+ fclose(file2);
+ /* Process unmodified lines. */
+ processq();
+
+ /* Return diff exit status. */
+ return (WEXITSTATUS(status));
+}
+
+/*
+ * When sdiff/zsdiff detects a binary file as input, executes them with
+ * diff/zdiff to maintain the same behavior as GNU sdiff with binary input.
+ */
+static void
+binexec(char *diffprog, char *f1, char *f2)
+{
+
+ char *args[] = {diffprog, f1, f2, (char *) 0};
+ execv(diffprog, args);
+
+ /* If execv() fails, sdiff's execution will continue below. */
+ errx(1, "Could not execute diff process.\n");
+}
+
+/*
+ * Checks whether a file appears to be a text file.
+ */
+static int
+istextfile(FILE *f)
+{
+ int ch, i;
+
+ if (f == NULL)
+ return (1);
+ rewind(f);
+ for (i = 0; i <= MAX_CHECK; i++) {
+ ch = fgetc(f);
+ if (ch == '\0') {
+ rewind(f);
+ return (0);
+ }
+ if (ch == EOF)
+ break;
+ }
+ rewind(f);
+ return (1);
+}
+
+/*
+ * Prints an individual column (left or right), taking into account
+ * that tabs are variable-width. Takes a string, the current column
+ * the cursor is on the screen, and the maximum value of the column.
+ * The column value is updated as we go along.
+ */
+static void
+printcol(const char *s, size_t *col, const size_t col_max)
+{
+
+ for (; *s && *col < col_max; ++s) {
+ size_t new_col;
+
+ switch (*s) {
+ case '\t':
+ /*
+ * If rounding to next multiple of eight causes
+ * an integer overflow, just return.
+ */
+ if (*col > SIZE_MAX - 8)
+ return;
+
+ /* Round to next multiple of eight. */
+ new_col = (*col / 8 + 1) * 8;
+
+ /*
+ * If printing the tab goes past the column
+ * width, don't print it and just quit.
+ */
+ if (new_col > col_max)
+ return;
+ *col = new_col;
+ break;
+ default:
+ ++(*col);
+ }
+ putchar(*s);
+ }
+}
+
+/*
+ * Prompts user to either choose between two strings or edit one, both,
+ * or neither.
+ */
+static void
+prompt(const char *s1, const char *s2)
+{
+ char *cmd;
+
+ /* Print command prompt. */
+ putchar('%');
+
+ /* Get user input. */
+ for (; (cmd = xfgets(stdin)); free(cmd)) {
+ const char *p;
+
+ /* Skip leading whitespace. */
+ for (p = cmd; isspace(*p); ++p)
+ ;
+ switch (*p) {
+ case 'e':
+ /* Skip `e'. */
+ ++p;
+ if (eparse(p, s1, s2) == -1)
+ goto USAGE;
+ break;
+ case 'l':
+ case '1':
+ /* Choose left column as-is. */
+ if (s1 != NULL)
+ fprintf(outfp, "%s\n", s1);
+ /* End of command parsing. */
+ break;
+ case 'q':
+ goto QUIT;
+ case 'r':
+ case '2':
+ /* Choose right column as-is. */
+ if (s2 != NULL)
+ fprintf(outfp, "%s\n", s2);
+ /* End of command parsing. */
+ break;
+ case 's':
+ sflag = 1;
+ goto PROMPT;
+ case 'v':
+ sflag = 0;
+ /* FALLTHROUGH */
+ default:
+ /* Interactive usage help. */
+USAGE:
+ int_usage();
+PROMPT:
+ putchar('%');
+
+ /* Prompt user again. */
+ continue;
+ }
+ free(cmd);
+ return;
+ }
+
+ /*
+ * If there was no error, we received an EOF from stdin, so we
+ * should quit.
+ */
+QUIT:
+ fclose(outfp);
+ exit(0);
+}
+
+/*
+ * Takes two strings, separated by a column divider. NULL strings are
+ * treated as empty columns. If the divider is the ` ' character, the
+ * second column is not printed (-l flag). In this case, the second
+ * string must be NULL. When the second column is NULL, the divider
+ * does not print the trailing space following the divider character.
+ *
+ * Takes into account that tabs can take multiple columns.
+ */
+static void
+println(const char *s1, const char div, const char *s2)
+{
+ size_t col;
+
+ /* Print first column. Skips if s1 == NULL. */
+ col = 0;
+ if (s1) {
+ /* Skip angle bracket and space. */
+ printcol(s1, &col, width);
+
+ }
+
+ /* Otherwise, we pad this column up to width. */
+ for (; col < width; ++col)
+ putchar(' ');
+
+ /* Only print left column. */
+ if (div == ' ' && !s2) {
+ printf(" (\n");
+ return;
+ }
+
+ /*
+ * Print column divider. If there is no second column, we don't
+ * need to add the space for padding.
+ */
+ if (!s2) {
+ printf(" %c\n", div);
+ return;
+ }
+ printf(" %c ", div);
+ col += 3;
+
+ /* Skip angle bracket and space. */
+ printcol(s2, &col, line_width);
+
+ putchar('\n');
+}
+
+/*
+ * Reads a line from file and returns as a string. If EOF is reached,
+ * NULL is returned. The returned string must be freed afterwards.
+ */
+static char *
+xfgets(FILE *file)
+{
+ size_t linecap;
+ ssize_t l;
+ char *s;
+
+ clearerr(file);
+ linecap = 0;
+ s = NULL;
+
+ if ((l = getline(&s, &linecap, file)) == -1) {
+ if (ferror(file))
+ err(2, "error reading file");
+ return (NULL);
+ }
+
+ if (s[l-1] == '\n')
+ s[l-1] = '\0';
+
+ return (s);
+}
+
+/*
+ * Parse ed commands from diffpipe and print lines from file1 (lines
+ * to change or delete) or file2 (lines to add or change).
+ * Returns EOF or 0.
+ */
+static int
+parsecmd(FILE *diffpipe, FILE *file1, FILE *file2)
+{
+ size_t file1start, file1end, file2start, file2end, n;
+ /* ed command line and pointer to characters in line */
+ char *line, *p, *q;
+ const char *errstr;
+ char c, cmd;
+
+ /* Read ed command. */
+ if (!(line = xfgets(diffpipe)))
+ return (EOF);
+
+ p = line;
+ /* Go to character after line number. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file1start = strtonum(line, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file1 start is %s: %s", errstr, line);
+
+ /* A range is specified for file1. */
+ if (c == ',') {
+ q = p;
+ /* Go to character after file2end. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file1end = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file1 end is %s: %s", errstr, line);
+ if (file1start > file1end)
+ errx(2, "invalid line range in file1: %s", line);
+ } else
+ file1end = file1start;
+
+ cmd = c;
+ /* Check that cmd is valid. */
+ if (!(cmd == 'a' || cmd == 'c' || cmd == 'd'))
+ errx(2, "ed command not recognized: %c: %s", cmd, line);
+
+ q = p;
+ /* Go to character after line number. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file2start = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file2 start is %s: %s", errstr, line);
+
+ /*
+ * There should either be a comma signifying a second line
+ * number or the line should just end here.
+ */
+ if (c != ',' && c != '\0')
+ errx(2, "invalid line range in file2: %c: %s", c, line);
+
+ if (c == ',') {
+
+ file2end = strtonum(p, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file2 end is %s: %s", errstr, line);
+ if (file2start >= file2end)
+ errx(2, "invalid line range in file2: %s", line);
+ } else
+ file2end = file2start;
+
+ /* Appends happen _after_ stated line. */
+ if (cmd == 'a') {
+ if (file1start != file1end)
+ errx(2, "append cannot have a file1 range: %s",
+ line);
+ if (file1start == SIZE_MAX)
+ errx(2, "file1 line range too high: %s", line);
+ file1start = ++file1end;
+ }
+ /*
+ * I'm not sure what the deal is with the line numbers for
+ * deletes, though.
+ */
+ else if (cmd == 'd') {
+ if (file2start != file2end)
+ errx(2, "delete cannot have a file2 range: %s",
+ line);
+ if (file2start == SIZE_MAX)
+ errx(2, "file2 line range too high: %s", line);
+ file2start = ++file2end;
+ }
+
+ /*
+ * Continue reading file1 and file2 until we reach line numbers
+ * specified by diff. Should only happen with -I flag.
+ */
+ for (; file1ln < file1start && file2ln < file2start;
+ ++file1ln, ++file2ln) {
+ char *s1, *s2;
+
+ if (!(s1 = xfgets(file1)))
+ errx(2, "file1 shorter than expected");
+ if (!(s2 = xfgets(file2)))
+ errx(2, "file2 shorter than expected");
+
+ /* If the -l flag was specified, print only left column. */
+ if (lflag) {
+ free(s2);
+ /*
+ * XXX - If -l and -I are both specified, all
+ * unchanged or ignored lines are shown with a
+ * `(' divider. This matches GNU sdiff, but I
+ * believe it is a bug. Just check out:
+ * gsdiff -l -I '^$' samefile samefile.
+ */
+ if (Iflag)
+ enqueue(s1, '(', NULL);
+ else
+ enqueue(s1, ' ', NULL);
+ } else
+ enqueue(s1, ' ', s2);
+ }
+ /* Ignore deleted lines. */
+ for (; file1ln < file1start; ++file1ln) {
+ char *s;
+
+ if (!(s = xfgets(file1)))
+ errx(2, "file1 shorter than expected");
+
+ enqueue(s, '(', NULL);
+ }
+ /* Ignore added lines. */
+ for (; file2ln < file2start; ++file2ln) {
+ char *s;
+
+ if (!(s = xfgets(file2)))
+ errx(2, "file2 shorter than expected");
+
+ /* If -l flag was given, don't print right column. */
+ if (lflag)
+ free(s);
+ else
+ enqueue(NULL, ')', s);
+ }
+
+ /* Process unmodified or skipped lines. */
+ processq();
+
+ switch (cmd) {
+ case 'a':
+ printa(file2, file2end);
+ n = file2end - file2start + 1;
+ break;
+ case 'c':
+ printc(file1, file1end, file2, file2end);
+ n = file1end - file1start + 1 + 1 + file2end - file2start + 1;
+ break;
+ case 'd':
+ printd(file1, file1end);
+ n = file1end - file1start + 1;
+ break;
+ default:
+ errx(2, "invalid diff command: %c: %s", cmd, line);
+ }
+ free(line);
+
+ /* Skip to next ed line. */
+ while (n--) {
+ if (!(line = xfgets(diffpipe)))
+ errx(2, "diff ended early");
+ free(line);
+ }
+
+ return (0);
+}
+
+/*
+ * Queues up a diff line.
+ */
+static void
+enqueue(char *left, char div, char *right)
+{
+ struct diffline *diffp;
+
+ if (!(diffp = malloc(sizeof(struct diffline))))
+ err(2, "enqueue");
+ diffp->left = left;
+ diffp->div = div;
+ diffp->right = right;
+ STAILQ_INSERT_TAIL(&diffhead, diffp, diffentries);
+}
+
+/*
+ * Free a diffline structure and its elements.
+ */
+static void
+freediff(struct diffline *diffp)
+{
+
+ free(diffp->left);
+ free(diffp->right);
+ free(diffp);
+}
+
+/*
+ * Append second string into first. Repeated appends to the same string
+ * are cached, making this an O(n) function, where n = strlen(append).
+ */
+static void
+astrcat(char **s, const char *append)
+{
+ /* Length of string in previous run. */
+ static size_t offset = 0;
+ size_t newsiz;
+ /*
+ * String from previous run. Compared to *s to see if we are
+ * dealing with the same string. If so, we can use offset.
+ */
+ static const char *oldstr = NULL;
+ char *newstr;
+
+ /*
+ * First string is NULL, so just copy append.
+ */
+ if (!*s) {
+ if (!(*s = strdup(append)))
+ err(2, "astrcat");
+
+ /* Keep track of string. */
+ offset = strlen(*s);
+ oldstr = *s;
+
+ return;
+ }
+
+ /*
+ * *s is a string so concatenate.
+ */
+
+ /* Did we process the same string in the last run? */
+ /*
+ * If this is a different string from the one we just processed
+ * cache new string.
+ */
+ if (oldstr != *s) {
+ offset = strlen(*s);
+ oldstr = *s;
+ }
+
+ /* Size = strlen(*s) + \n + strlen(append) + '\0'. */
+ newsiz = offset + 1 + strlen(append) + 1;
+
+ /* Resize *s to fit new string. */
+ newstr = realloc(*s, newsiz);
+ if (newstr == NULL)
+ err(2, "astrcat");
+ *s = newstr;
+
+ /* *s + offset should be end of string. */
+ /* Concatenate. */
+ strlcpy(*s + offset, "\n", newsiz - offset);
+ strlcat(*s + offset, append, newsiz - offset);
+
+ /* New string length should be exactly newsiz - 1 characters. */
+ /* Store generated string's values. */
+ offset = newsiz - 1;
+ oldstr = *s;
+}
+
+/*
+ * Process diff set queue, printing, prompting, and saving each diff
+ * line stored in queue.
+ */
+static void
+processq(void)
+{
+ struct diffline *diffp;
+ char divc, *left, *right;
+
+ /* Don't process empty queue. */
+ if (STAILQ_EMPTY(&diffhead))
+ return;
+
+ /* Remember the divider. */
+ divc = STAILQ_FIRST(&diffhead)->div;
+
+ left = NULL;
+ right = NULL;
+ /*
+ * Go through set of diffs, concatenating each line in left or
+ * right column into two long strings, `left' and `right'.
+ */
+ STAILQ_FOREACH(diffp, &diffhead, diffentries) {
+ /*
+ * Print changed lines if -s was given,
+ * print all lines if -s was not given.
+ */
+ if (!sflag || diffp->div == '|' || diffp->div == '<' ||
+ diffp->div == '>')
+ println(diffp->left, diffp->div, diffp->right);
+
+ /* Append new lines to diff set. */
+ if (diffp->left)
+ astrcat(&left, diffp->left);
+ if (diffp->right)
+ astrcat(&right, diffp->right);
+ }
+
+ /* Empty queue and free each diff line and its elements. */
+ while (!STAILQ_EMPTY(&diffhead)) {
+ diffp = STAILQ_FIRST(&diffhead);
+ STAILQ_REMOVE_HEAD(&diffhead, diffentries);
+ freediff(diffp);
+ }
+
+ /* Write to outfp, prompting user if lines are different. */
+ if (outfp)
+ switch (divc) {
+ case ' ': case '(': case ')':
+ fprintf(outfp, "%s\n", left);
+ break;
+ case '|': case '<': case '>':
+ prompt(left, right);
+ break;
+ default:
+ errx(2, "invalid divider: %c", divc);
+ }
+
+ /* Free left and right. */
+ free(left);
+ free(right);
+}
+
+/*
+ * Print lines following an (a)ppend command.
+ */
+static void
+printa(FILE *file, size_t line2)
+{
+ char *line;
+
+ for (; file2ln <= line2; ++file2ln) {
+ if (!(line = xfgets(file)))
+ errx(2, "append ended early");
+ enqueue(NULL, '>', line);
+ }
+ processq();
+}
+
+/*
+ * Print lines following a (c)hange command, from file1ln to file1end
+ * and from file2ln to file2end.
+ */
+static void
+printc(FILE *file1, size_t file1end, FILE *file2, size_t file2end)
+{
+ struct fileline {
+ STAILQ_ENTRY(fileline) fileentries;
+ char *line;
+ };
+ STAILQ_HEAD(, fileline) delqhead = STAILQ_HEAD_INITIALIZER(delqhead);
+
+ /* Read lines to be deleted. */
+ for (; file1ln <= file1end; ++file1ln) {
+ struct fileline *linep;
+ char *line1;
+
+ /* Read lines from both. */
+ if (!(line1 = xfgets(file1)))
+ errx(2, "error reading file1 in delete in change");
+
+ /* Add to delete queue. */
+ if (!(linep = malloc(sizeof(struct fileline))))
+ err(2, "printc");
+ linep->line = line1;
+ STAILQ_INSERT_TAIL(&delqhead, linep, fileentries);
+ }
+
+ /* Process changed lines.. */
+ for (; !STAILQ_EMPTY(&delqhead) && file2ln <= file2end;
+ ++file2ln) {
+ struct fileline *del;
+ char *add;
+
+ /* Get add line. */
+ if (!(add = xfgets(file2)))
+ errx(2, "error reading add in change");
+
+ del = STAILQ_FIRST(&delqhead);
+ enqueue(del->line, '|', add);
+ STAILQ_REMOVE_HEAD(&delqhead, fileentries);
+ /*
+ * Free fileline structure but not its elements since
+ * they are queued up.
+ */
+ free(del);
+ }
+ processq();
+
+ /* Process remaining lines to add. */
+ for (; file2ln <= file2end; ++file2ln) {
+ char *add;
+
+ /* Get add line. */
+ if (!(add = xfgets(file2)))
+ errx(2, "error reading add in change");
+
+ enqueue(NULL, '>', add);
+ }
+ processq();
+
+ /* Process remaining lines to delete. */
+ while (!STAILQ_EMPTY(&delqhead)) {
+ struct fileline *filep;
+
+ filep = STAILQ_FIRST(&delqhead);
+ enqueue(filep->line, '<', NULL);
+ STAILQ_REMOVE_HEAD(&delqhead, fileentries);
+ free(filep);
+ }
+ processq();
+}
+
+/*
+ * Print deleted lines from file, from file1ln to file1end.
+ */
+static void
+printd(FILE *file1, size_t file1end)
+{
+ char *line1;
+
+ /* Print out lines file1ln to line2. */
+ for (; file1ln <= file1end; ++file1ln) {
+ if (!(line1 = xfgets(file1)))
+ errx(2, "file1 ended early in delete");
+ enqueue(line1, '<', NULL);
+ }
+ processq();
+}
+
+/*
+ * Interactive mode usage.
+ */
+static void
+int_usage(void)
+{
+
+ puts("e:\tedit blank diff\n"
+ "eb:\tedit both diffs concatenated\n"
+ "el:\tedit left diff\n"
+ "er:\tedit right diff\n"
+ "l | 1:\tchoose left diff\n"
+ "r | 2:\tchoose right diff\n"
+ "s:\tsilent mode--don't print identical lines\n"
+ "v:\tverbose mode--print identical lines\n"
+ "q:\tquit");
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1"
+ " file2\n");
+ exit(2);
+}
diff --git a/usr.bin/sdiff/tests/Makefile b/usr.bin/sdiff/tests/Makefile
new file mode 100644
index 0000000..b01c3b6
--- /dev/null
+++ b/usr.bin/sdiff/tests/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= sdiff
+
+${PACKAGE}FILES+= \
+ d_dot.in \
+ d_flags_l.out \
+ d_flags_s.out \
+ d_flags_w.out \
+ d_iflags_a1.out \
+ d_iflags_a2.out \
+ d_iflags_b1.out \
+ d_iflags_b2.out \
+ d_iflags_c1.out \
+ d_iflags_c2.out \
+ d_iflags_d1.out \
+ d_iflags_d2.out \
+ d_input1 \
+ d_input2 \
+ d_oneline.in \
+ d_oneline_a.out \
+ d_oneline_b.out \
+ d_same.out \
+ d_short.out \
+ d_tabends.in \
+ d_tabends_a.out \
+ d_tabends_b.out \
+ d_tabends_c.out \
+ d_tabs.out \
+ d_tabs1.in \
+ d_tabs2.in
+
+.include <bsd.test.mk>
diff --git a/usr.bin/sdiff/tests/d_dot.in b/usr.bin/sdiff/tests/d_dot.in
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_dot.in
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/sdiff/tests/d_flags_l.out b/usr.bin/sdiff/tests/d_flags_l.out
new file mode 100644
index 0000000..ac8d2ad
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_l.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit (
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit (
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit (
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit (
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_flags_s.out b/usr.bin/sdiff/tests/d_flags_s.out
new file mode 100644
index 0000000..8af11f3
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_s.out
@@ -0,0 +1,79 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_flags_w.out b/usr.bin/sdiff/tests/d_flags_w.out
new file mode 100644
index 0000000..19ea79b
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_w.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_a1.out b/usr.bin/sdiff/tests/d_iflags_a1.out
new file mode 100644
index 0000000..2a0f532
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_a1.out
@@ -0,0 +1,100 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fswrite: filename match "/tmp/lynx-*" then permit
+ ) native-fsread: filename match "/tmp/lynx-*/." then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj" then permit native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ native-fsread: filename eq "/usr/obj/bin" then permit native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_a2.out b/usr.bin/sdiff/tests/d_iflags_a2.out
new file mode 100644
index 0000000..4e0d349
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_a2.out
@@ -0,0 +1,96 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-__sysctl: permit native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-close: permit native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/home" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/obj" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename match "/<non-existent filename>: native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ ) native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ ) native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-gettimeofday: permit native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ native-recvfrom: permit native-recvfrom: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_b1.out b/usr.bin/sdiff/tests/d_iflags_b1.out
new file mode 100644
index 0000000..3e548b6
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_b1.out
@@ -0,0 +1,69 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_b2.out b/usr.bin/sdiff/tests/d_iflags_b2.out
new file mode 100644
index 0000000..4504c36
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_b2.out
@@ -0,0 +1,65 @@
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_c1.out b/usr.bin/sdiff/tests/d_iflags_c1.out
new file mode 100644
index 0000000..e9ac88e
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_c1.out
@@ -0,0 +1,99 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit (
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit (
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit (
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename match "/usr/lib/libc.so.*" then p (
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t (
+ native-fsread: filename match "/usr/lib/libncurses.so.*" (
+ native-fsread: filename match "/usr/lib/libssl.so.*" then (
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/usr/obj" then permit (
+ native-fsread: filename eq "/usr/obj/bin" then permit (
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit (
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_c2.out b/usr.bin/sdiff/tests/d_iflags_c2.out
new file mode 100644
index 0000000..fe7af0e
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_c2.out
@@ -0,0 +1,94 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-__sysctl: permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-close: permit (
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit (
+ native-fswrite: filename match "/tmp/lynx-*" then permit (
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/home" then permit (
+ native-fsread: filename eq "/obj" then permit (
+ native-fsread: filename eq "$HOME/.lynxrc" then permit (
+ native-fsread: filename match "/<non-existent filename>: (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "$HOME/.mailcap" then permit (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-gettimeofday: permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ native-recvfrom: permit (
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_d1.out b/usr.bin/sdiff/tests/d_iflags_d1.out
new file mode 100644
index 0000000..3e548b6
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_d1.out
@@ -0,0 +1,69 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_d2.out b/usr.bin/sdiff/tests/d_iflags_d2.out
new file mode 100644
index 0000000..4504c36
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_d2.out
@@ -0,0 +1,65 @@
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_input1 b/usr.bin/sdiff/tests/d_input1
new file mode 100644
index 0000000..686e8ea
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_input1
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit
+ native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit
+ native-getpid: permit
+ native-gettimeofday: permit
+ native-ioctl: permit
+ native-issetugid: permit
+ native-lseek: permit
+ native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" then permit
+ native-munmap: permit
+ native-nanosleep: permit
+ native-poll: permit
+ native-pread: permit
+ native-read: permit
+ native-recvfrom: permit
+ native-select: permit
+ native-sendto: true then permit
+ native-sigaction: permit
+ native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-write: permit
diff --git a/usr.bin/sdiff/tests/d_input2 b/usr.bin/sdiff/tests/d_input2
new file mode 100644
index 0000000..70e1b57
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_input2
@@ -0,0 +1,69 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fcntl: permit
+ native-getdirentries: permit
+ native-lseek: permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-sigaction: permit
+ native-ioctl: permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-pread: permit
+ native-write: permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-poll: permit
+ native-nanosleep: permit
+ native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-sendto: true then permit
+ native-select: permit
+ native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_oneline.in b/usr.bin/sdiff/tests/d_oneline.in
new file mode 100644
index 0000000..acbe86c
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline.in
@@ -0,0 +1 @@
+abcd
diff --git a/usr.bin/sdiff/tests/d_oneline_a.out b/usr.bin/sdiff/tests/d_oneline_a.out
new file mode 100644
index 0000000..18f7c6b
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline_a.out
@@ -0,0 +1 @@
+ > abcd
diff --git a/usr.bin/sdiff/tests/d_oneline_b.out b/usr.bin/sdiff/tests/d_oneline_b.out
new file mode 100644
index 0000000..04cad47
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline_b.out
@@ -0,0 +1 @@
+abcd <
diff --git a/usr.bin/sdiff/tests/d_same.out b/usr.bin/sdiff/tests/d_same.out
new file mode 100644
index 0000000..f929fcf
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_same.out
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit native-__sysctl: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-exit: permit native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/etc/lynx.cfg" then permit native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "$HOME/.lynxrc" then permit native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permi native-fsread: filename eq "$HOME/.mime.types" then permi
+ native-fsread: filename eq "$HOME/.terminfo" then permit native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ native-fsread: filename eq "/obj" then permit native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fsread: filename match "/usr/lib/libncurses.so.*" native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename match "/usr/lib/libssl.so.*" then native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-fstat: permit native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit native-getdirentries: permit
+ native-getpid: permit native-getpid: permit
+ native-gettimeofday: permit native-gettimeofday: permit
+ native-ioctl: permit native-ioctl: permit
+ native-issetugid: permit native-issetugid: permit
+ native-lseek: permit native-lseek: permit
+ native-mmap: permit native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ native-munmap: permit native-munmap: permit
+ native-nanosleep: permit native-nanosleep: permit
+ native-poll: permit native-poll: permit
+ native-pread: permit native-pread: permit
+ native-read: permit native-read: permit
+ native-recvfrom: permit native-recvfrom: permit
+ native-select: permit native-select: permit
+ native-sendto: true then permit native-sendto: true then permit
+ native-sigaction: permit native-sigaction: permit
+ native-sigprocmask: permit native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit native-write: permit
diff --git a/usr.bin/sdiff/tests/d_short.out b/usr.bin/sdiff/tests/d_short.out
new file mode 100644
index 0000000..7a33460
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_short.out
@@ -0,0 +1,15 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
diff --git a/usr.bin/sdiff/tests/d_tabends.in b/usr.bin/sdiff/tests/d_tabends.in
new file mode 100644
index 0000000..0547049
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends.in
@@ -0,0 +1,17 @@
+
+0
+01
+012
+0123
+01234
+012345
+0123456
+01234567
+012345670
+0123456701
+01234567012
+012345670123
+0123456701234
+01234567012345
+012345670123456
+0123456701234567
diff --git a/usr.bin/sdiff/tests/d_tabends_a.out b/usr.bin/sdiff/tests/d_tabends_a.out
new file mode 100644
index 0000000..423bd02
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_a.out
@@ -0,0 +1,17 @@
+ <
+0 <
+01 <
+012 <
+0123 <
+01234 <
+012345 <
+0123456 <
+01234567 <
+012345670 <
+0123456701 <
+01234567012 <
+012345670123 <
+0123456701234 <
+0123456701234 <
+0123456701234 <
+0123456701234 <
diff --git a/usr.bin/sdiff/tests/d_tabends_b.out b/usr.bin/sdiff/tests/d_tabends_b.out
new file mode 100644
index 0000000..b180705
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_b.out
@@ -0,0 +1,17 @@
+ >
+ > 0
+ > 01
+ > 012
+ > 0123
+ > 01234
+ > 012345
+ > 0123456
+ > 01234567
+ > 012345670
+ > 0123456701
+ > 01234567012
+ > 012345670123
+ > 0123456701234
+ > 0123456701234
+ > 0123456701234
+ > 0123456701234
diff --git a/usr.bin/sdiff/tests/d_tabends_c.out b/usr.bin/sdiff/tests/d_tabends_c.out
new file mode 100644
index 0000000..c301382
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_c.out
@@ -0,0 +1,17 @@
+ <
+0 <
+01 <
+012 <
+0123 <
+01234 <
+012345 <
+0123456 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
diff --git a/usr.bin/sdiff/tests/d_tabs.out b/usr.bin/sdiff/tests/d_tabs.out
new file mode 100644
index 0000000..a67d7b1
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" the
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" the | native-fsread: filename match "/usr/lib/libssl.so.*"
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" th | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" th
+ native-fsread: filename match "/<non-existent filenam | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permi | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then pe native-fsread: filename eq "/etc/malloc.conf" then pe
+ native-fsread: filename eq "/etc/resolv.conf" then pe | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then <
+ native-fsread: filename eq "$HOME/.lynxrc" then permi <
+ native-fsread: filename eq "$HOME/.mailcap" then perm <
+ native-fsread: filename eq "$HOME/.mime.types" then p <
+ native-fsread: filename eq "$HOME/.terminfo" then per <
+ native-fsread: filename eq "$HOME/.terminfo.db" then <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ > native-fswrite: filename match "/tmp/lynx-*" then per
+ native-fsread: filename match "/tmp/lynx-*/." then pe native-fsread: filename match "/tmp/lynx-*/." then pe
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permi
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/."
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" th <
+ native-fsread: filename match "/usr/lib/libcrypto.so. <
+ native-fsread: filename match "/usr/lib/libncurses.so <
+ native-fsread: filename match "/usr/lib/libssl.so.*" <
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." | native-fsread: filename eq "$HOME/.lynxrc" then permi
+ > native-fsread: filename match "/<non-existent filenam
+ native-fsread: filename eq "/usr/obj/bin/systrace/.ma native-fsread: filename eq "/usr/obj/bin/systrace/.ma
+ > native-fsread: filename eq "$HOME/.mailcap" then perm
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mi native-fsread: filename eq "/usr/obj/bin/systrace/.mi
+ > native-fsread: filename eq "$HOME/.mime.types" then p
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then
+ > native-fsread: filename eq "$HOME/.terminfo" then per
+ native-fsread: filename eq "/usr/share/misc/terminfo. native-fsread: filename eq "/usr/share/misc/terminfo.
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then
+ native-fsread: filename eq "/var/run/dev.db" then per native-fsread: filename eq "/var/run/dev.db" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" the | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then per <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then p <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_E <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then pe
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq " native-socket: sockdom eq "AF_INET" and socktype eq "
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" the
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq " native-socket: sockdom eq "AF_INET" and socktype eq "
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" th
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_tabs1.in b/usr.bin/sdiff/tests/d_tabs1.in
new file mode 100644
index 0000000..b5a1834
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs1.in
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit
+ native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit
+ native-getpid: permit
+ native-gettimeofday: permit
+ native-ioctl: permit
+ native-issetugid: permit
+ native-lseek: permit
+ native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" then permit
+ native-munmap: permit
+ native-nanosleep: permit
+ native-poll: permit
+ native-pread: permit
+ native-read: permit
+ native-recvfrom: permit
+ native-select: permit
+ native-sendto: true then permit
+ native-sigaction: permit
+ native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-write: permit
diff --git a/usr.bin/sdiff/tests/d_tabs2.in b/usr.bin/sdiff/tests/d_tabs2.in
new file mode 100644
index 0000000..d00f415
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs2.in
@@ -0,0 +1,69 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fcntl: permit
+ native-getdirentries: permit
+ native-lseek: permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-sigaction: permit
+ native-ioctl: permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-pread: permit
+ native-write: permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-poll: permit
+ native-nanosleep: permit
+ native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-sendto: true then permit
+ native-select: permit
+ native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
diff --git a/usr.bin/sdiff/tests/sdiff.sh b/usr.bin/sdiff/tests/sdiff.sh
new file mode 100755
index 0000000..51aac6b
--- /dev/null
+++ b/usr.bin/sdiff/tests/sdiff.sh
@@ -0,0 +1,207 @@
+# $NetBSD: t_sdiff.sh,v 1.1 2012/03/17 16:33:15 jruoho Exp $
+# $FreeBSD$
+#
+# Copyright (c) 2008, 2009 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+#
+
+atf_test_case flags
+flags_head()
+{
+ atf_set "descr" "Checks -l, -s and -w flags"
+}
+flags_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_flags_l.out -s eq:1 \
+ sdiff -l "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+
+ atf_check -o file:$(atf_get_srcdir)/d_flags_s.out -s eq:1 \
+ sdiff -s "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+
+ atf_check -o file:$(atf_get_srcdir)/d_flags_w.out -s eq:1 \
+ sdiff -w 125 "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+}
+
+atf_test_case iflags
+iflags_head()
+{
+ atf_set "descr" "Checks flags -l, -s and -w combined with -I"
+}
+iflags_body()
+{
+ tail1="-w 125 -I .*filename.* $(atf_get_srcdir)/d_input1 $(atf_get_srcdir)/d_input2"
+ tail2="-w 125 -I .*filename.* $(atf_get_srcdir)/d_input2 $(atf_get_srcdir)/d_input1"
+
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_a1.out -s eq:1 sdiff ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_a2.out -s eq:1 sdiff ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_b1.out -s eq:1 sdiff -s ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_b2.out -s eq:1 sdiff -s ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_c1.out -s eq:1 sdiff -l ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_c2.out -s eq:1 sdiff -l ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_d1.out -s eq:1 sdiff -s ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_d2.out -s eq:1 sdiff -s ${tail2}
+}
+
+atf_test_case tabs
+tabs_head()
+{
+ atf_set "descr" "Checks comparing files containing tabs"
+}
+tabs_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_tabs.out -s eq:1 \
+ sdiff "$(atf_get_srcdir)/d_tabs1.in" "$(atf_get_srcdir)/d_tabs2.in"
+}
+
+atf_test_case tabends
+tabends_head()
+{
+ atf_set "descr" "Checks correct handling of lines ended with tabs"
+}
+tabends_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_a.out -s eq:1 \
+ sdiff -w30 "$(atf_get_srcdir)/d_tabends.in" /dev/null
+
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_b.out -s eq:1 \
+ sdiff -w30 /dev/null "$(atf_get_srcdir)/d_tabends.in"
+
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_c.out -s eq:1 \
+ sdiff -w19 "$(atf_get_srcdir)/d_tabends.in" /dev/null
+}
+
+atf_test_case merge
+merge_head()
+{
+ atf_set "descr" "Checks interactive merging"
+}
+merge_body()
+{
+ merge_tail="-o merge.out $(atf_get_srcdir)/d_input1 \
+$(atf_get_srcdir)/d_input2 >/dev/null ; cat merge.out"
+
+ cp $(atf_get_srcdir)/d_input* .
+
+ atf_check -o file:d_input1 -x "yes l | sdiff ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff ${merge_tail}"
+
+ atf_check -o file:d_input1 -x \
+ "yes el | EDITOR=cat VISUAL=cat sdiff ${merge_tail}"
+ atf_check -o file:d_input2 -x \
+ "yes er | EDITOR=cat VISUAL=cat sdiff ${merge_tail}"
+
+ atf_check -o file:d_input1 -x "yes l | sdiff -s ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -s ${merge_tail}"
+ atf_check -o file:d_input1 -x "yes l | sdiff -l ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -l ${merge_tail}"
+ atf_check -o file:d_input1 -x "yes l | sdiff -ls ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -ls ${merge_tail}"
+
+ atf_check -o file:d_input1 -x "{ while :; do echo s; echo l; \
+echo v; echo l; done; } | sdiff ${merge_tail}"
+
+ atf_check -o file:d_input2 -x "{ while :; do echo s; echo r; \
+echo v; echo r; done; } | sdiff ${merge_tail}"
+}
+
+atf_test_case same
+same_head()
+{
+ atf_set "descr" "Checks comparing file with itself"
+}
+same_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_same.out \
+ sdiff "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input1"
+}
+
+atf_test_case oneline
+oneline_head()
+{
+ atf_set "descr" "Checks comparing one-line files"
+}
+oneline_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_oneline_a.out -s eq:1 \
+ sdiff /dev/null "$(atf_get_srcdir)/d_oneline.in"
+
+ atf_check -o file:$(atf_get_srcdir)/d_oneline_b.out -s eq:1 \
+ sdiff "$(atf_get_srcdir)/d_oneline.in" /dev/null
+}
+
+atf_test_case dot
+dot_head()
+{
+ atf_set "descr" "Checks comparing with file containing only one character"
+}
+dot_body()
+{
+ echo ". <" > expout
+ atf_check -o file:expout -s eq:1 sdiff "$(atf_get_srcdir)/d_dot.in" /dev/null
+
+ echo " > ." > expout
+ atf_check -o file:expout -s eq:1 sdiff /dev/null "$(atf_get_srcdir)/d_dot.in"
+}
+
+atf_test_case stdin
+stdin_head()
+{
+ atf_set "descr" "Checks reading data from stdin"
+}
+stdin_body()
+{
+ echo " > stdin" > expout
+ atf_check -o file:expout -s eq:1 -x \
+ "echo stdin | sdiff /dev/null /dev/stdin"
+
+ echo "stdin <" > expout
+ atf_check -o file:expout -s eq:1 -x \
+ "echo stdin | sdiff /dev/stdin /dev/null"
+}
+
+atf_test_case short
+short_head()
+{
+ atf_set "descr" "Checks premature stop of merging"
+}
+short_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_short.out -x \
+ "printf \"r\\nl\\nr\\nl\" | sdiff -o merge.out $(atf_get_srcdir)/d_input1 \
+$(atf_get_srcdir)/d_input2 >/dev/null ; cat merge.out"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case flags
+ atf_add_test_case iflags
+ atf_add_test_case tabs
+ atf_add_test_case tabends
+ atf_add_test_case merge
+ atf_add_test_case same
+ atf_add_test_case oneline
+ atf_add_test_case dot
+ atf_add_test_case stdin
+ atf_add_test_case short
+}
diff --git a/usr.bin/sed/Makefile b/usr.bin/sed/Makefile
new file mode 100644
index 0000000..a741da3
--- /dev/null
+++ b/usr.bin/sed/Makefile
@@ -0,0 +1,15 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= sed
+SRCS= compile.c main.c misc.c process.c
+
+WARNS?= 2
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/sed/Makefile.depend b/usr.bin/sed/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/sed/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/sed/POSIX b/usr.bin/sed/POSIX
new file mode 100644
index 0000000..239acf8
--- /dev/null
+++ b/usr.bin/sed/POSIX
@@ -0,0 +1,204 @@
+# @(#)POSIX 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+Comments on the IEEE P1003.2 Draft 12
+ Part 2: Shell and Utilities
+ Section 4.55: sed - Stream editor
+
+Diomidis Spinellis <dds@doc.ic.ac.uk>
+Keith Bostic <bostic@cs.berkeley.edu>
+
+In the following paragraphs, "wrong" usually means "inconsistent with
+historic practice", as most of the following comments refer to
+undocumented inconsistencies between the historical versions of sed and
+the POSIX 1003.2 standard. All the comments are notes taken while
+implementing a POSIX-compatible version of sed, and should not be
+interpreted as official opinions or criticism towards the POSIX committee.
+All uses of "POSIX" refer to section 4.55, Draft 12 of POSIX 1003.2.
+
+ 1. 32V and BSD derived implementations of sed strip the text
+ arguments of the a, c and i commands of their initial blanks,
+ i.e.
+
+ #!/bin/sed -f
+ a\
+ foo\
+ \ indent\
+ bar
+
+ produces:
+
+ foo
+ indent
+ bar
+
+ POSIX does not specify this behavior as the System V versions of
+ sed do not do this stripping. The argument against stripping is
+ that it is difficult to write sed scripts that have leading blanks
+ if they are stripped. The argument for stripping is that it is
+ difficult to write readable sed scripts unless indentation is allowed
+ and ignored, and leading whitespace is obtainable by entering a
+ backslash in front of it. This implementation follows the BSD
+ historic practice.
+
+ 2. Historical versions of sed required that the w flag be the last
+ flag to an s command as it takes an additional argument. This
+ is obvious, but not specified in POSIX.
+
+ 3. Historical versions of sed required that whitespace follow a w
+ flag to an s command. This is not specified in POSIX. This
+ implementation permits whitespace but does not require it.
+
+ 4. Historical versions of sed permitted any number of whitespace
+ characters to follow the w command. This is not specified in
+ POSIX. This implementation permits whitespace but does not
+ require it.
+
+ 5. The rule for the l command differs from historic practice. Table
+ 2-15 includes the various ANSI C escape sequences, including \\
+ for backslash. Some historical versions of sed displayed two
+ digit octal numbers, too, not three as specified by POSIX. POSIX
+ is a cleanup, and is followed by this implementation.
+
+ 6. The POSIX specification for ! does not specify that for a single
+ command the command must not contain an address specification
+ whereas the command list can contain address specifications. The
+ specification for ! implies that "3!/hello/p" works, and it never
+ has, historically. Note,
+
+ 3!{
+ /hello/p
+ }
+
+ does work.
+
+ 7. POSIX does not specify what happens with consecutive ! commands
+ (e.g. /foo/!!!p). Historic implementations allow any number of
+ !'s without changing the behaviour. (It seems logical that each
+ one might reverse the behaviour.) This implementation follows
+ historic practice.
+
+ 8. Historic versions of sed permitted commands to be separated
+ by semi-colons, e.g. 'sed -ne '1p;2p;3q' printed the first
+ three lines of a file. This is not specified by POSIX.
+ Note, the ; command separator is not allowed for the commands
+ a, c, i, w, r, :, b, t, # and at the end of a w flag in the s
+ command. This implementation follows historic practice and
+ implements the ; separator.
+
+ 9. Historic versions of sed terminated the script if EOF was reached
+ during the execution of the 'n' command, i.e.:
+
+ sed -e '
+ n
+ i\
+ hello
+ ' </dev/null
+
+ did not produce any output. POSIX does not specify this behavior.
+ This implementation follows historic practice.
+
+10. Deleted.
+
+11. Historical implementations do not output the change text of a c
+ command in the case of an address range whose first line number
+ is greater than the second (e.g. 3,1). POSIX requires that the
+ text be output. Since the historic behavior doesn't seem to have
+ any particular purpose, this implementation follows the POSIX
+ behavior.
+
+12. POSIX does not specify whether address ranges are checked and
+ reset if a command is not executed due to a jump. The following
+ program will behave in different ways depending on whether the
+ 'c' command is triggered at the third line, i.e. will the text
+ be output even though line 3 of the input will never logically
+ encounter that command.
+
+ 2,4b
+ 1,3c\
+ text
+
+ Historic implementations did not output the text in the above
+ example. Therefore it was believed that a range whose second
+ address was never matched extended to the end of the input.
+ However, the current practice adopted by this implementation,
+ as well as by those from GNU and SUN, is as follows: The text
+ from the 'c' command still isn't output because the second address
+ isn't actually matched; but the range is reset after all if its
+ second address is a line number. In the above example, only the
+ first line of the input will be deleted.
+
+13. Historical implementations allow an output suppressing #n at the
+ beginning of -e arguments as well as in a script file. POSIX
+ does not specify this. This implementation follows historical
+ practice.
+
+14. POSIX does not explicitly specify how sed behaves if no script is
+ specified. Since the sed Synopsis permits this form of the command,
+ and the language in the Description section states that the input
+ is output, it seems reasonable that it behave like the cat(1)
+ command. Historic sed implementations behave differently for "ls |
+ sed", where they produce no output, and "ls | sed -e#", where they
+ behave like cat. This implementation behaves like cat in both cases.
+
+15. The POSIX requirement to open all w files at the beginning makes
+ sed behave nonintuitively when the w commands are preceded by
+ addresses or are within conditional blocks. This implementation
+ follows historic practice and POSIX, by default, and provides the
+ -a option which opens the files only when they are needed.
+
+16. POSIX does not specify how escape sequences other than \n and \D
+ (where D is the delimiter character) are to be treated. This is
+ reasonable, however, it also doesn't state that the backslash is
+ to be discarded from the output regardless. A strict reading of
+ POSIX would be that "echo xyz | sed s/./\a" would display "\ayz".
+ As historic sed implementations always discarded the backslash,
+ this implementation does as well.
+
+17. POSIX specifies that an address can be "empty". This implies
+ that constructs like ",d" or "1,d" and ",5d" are allowed. This
+ is not true for historic implementations or this implementation
+ of sed.
+
+18. The b t and : commands are documented in POSIX to ignore leading
+ white space, but no mention is made of trailing white space.
+ Historic implementations of sed assigned different locations to
+ the labels "x" and "x ". This is not useful, and leads to subtle
+ programming errors, but it is historic practice and changing it
+ could theoretically break working scripts. This implementation
+ follows historic practice.
+
+19. Although POSIX specifies that reading from files that do not exist
+ from within the script must not terminate the script, it does not
+ specify what happens if a write command fails. Historic practice
+ is to fail immediately if the file cannot be opened or written.
+ This implementation follows historic practice.
+
+20. Historic practice is that the \n construct can be used for either
+ string1 or string2 of the y command. This is not specified by
+ POSIX. This implementation follows historic practice.
+
+21. Deleted.
+
+22. Historic implementations of sed ignore the RE delimiter characters
+ within character classes. This is not specified in POSIX. This
+ implementation follows historic practice.
+
+23. Historic implementations handle empty RE's in a special way: the
+ empty RE is interpreted as if it were the last RE encountered,
+ whether in an address or elsewhere. POSIX does not document this
+ behavior. For example the command:
+
+ sed -e /abc/s//XXX/
+
+ substitutes XXX for the pattern abc. The semantics of "the last
+ RE" can be defined in two different ways:
+
+ 1. The last RE encountered when compiling (lexical/static scope).
+ 2. The last RE encountered while running (dynamic scope).
+
+ While many historical implementations fail on programs depending
+ on scope differences, the SunOS version exhibited dynamic scope
+ behaviour. This implementation does dynamic scoping, as this seems
+ the most useful and in order to remain consistent with historical
+ practice.
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
new file mode 100644
index 0000000..b5bc3e2
--- /dev/null
+++ b/usr.bin/sed/compile.c
@@ -0,0 +1,949 @@
+/*-
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "defs.h"
+#include "extern.h"
+
+#define LHSZ 128
+#define LHMASK (LHSZ - 1)
+static struct labhash {
+ struct labhash *lh_next;
+ u_int lh_hash;
+ struct s_command *lh_cmd;
+ int lh_ref;
+} *labels[LHSZ];
+
+static char *compile_addr(char *, struct s_addr *);
+static char *compile_ccl(char **, char *);
+static char *compile_delimited(char *, char *, int);
+static char *compile_flags(char *, struct s_subst *);
+static regex_t *compile_re(char *, int);
+static char *compile_subst(char *, struct s_subst *);
+static char *compile_text(void);
+static char *compile_tr(char *, struct s_tr **);
+static struct s_command
+ **compile_stream(struct s_command **);
+static char *duptoeol(char *, const char *);
+static void enterlabel(struct s_command *);
+static struct s_command
+ *findlabel(char *);
+static void fixuplabel(struct s_command *, struct s_command *);
+static void uselabel(void);
+
+/*
+ * Command specification. This is used to drive the command parser.
+ */
+struct s_format {
+ char code; /* Command code */
+ int naddr; /* Number of address args */
+ enum e_args args; /* Argument type */
+};
+
+static struct s_format cmd_fmts[] = {
+ {'{', 2, GROUP},
+ {'}', 0, ENDGROUP},
+ {'a', 1, TEXT},
+ {'b', 2, BRANCH},
+ {'c', 2, TEXT},
+ {'d', 2, EMPTY},
+ {'D', 2, EMPTY},
+ {'g', 2, EMPTY},
+ {'G', 2, EMPTY},
+ {'h', 2, EMPTY},
+ {'H', 2, EMPTY},
+ {'i', 1, TEXT},
+ {'l', 2, EMPTY},
+ {'n', 2, EMPTY},
+ {'N', 2, EMPTY},
+ {'p', 2, EMPTY},
+ {'P', 2, EMPTY},
+ {'q', 1, EMPTY},
+ {'r', 1, RFILE},
+ {'s', 2, SUBST},
+ {'t', 2, BRANCH},
+ {'w', 2, WFILE},
+ {'x', 2, EMPTY},
+ {'y', 2, TR},
+ {'!', 2, NONSEL},
+ {':', 0, LABEL},
+ {'#', 0, COMMENT},
+ {'=', 1, EMPTY},
+ {'\0', 0, COMMENT},
+};
+
+/* The compiled program. */
+struct s_command *prog;
+
+/*
+ * Compile the program into prog.
+ * Initialise appends.
+ */
+void
+compile(void)
+{
+ *compile_stream(&prog) = NULL;
+ fixuplabel(prog, NULL);
+ uselabel();
+ if (appendnum == 0)
+ appends = NULL;
+ else if ((appends = malloc(sizeof(struct s_appends) * appendnum)) ==
+ NULL)
+ err(1, "malloc");
+ if ((match = malloc((maxnsub + 1) * sizeof(regmatch_t))) == NULL)
+ err(1, "malloc");
+}
+
+#define EATSPACE() do { \
+ if (p) \
+ while (*p && isspace((unsigned char)*p)) \
+ p++; \
+ } while (0)
+
+static struct s_command **
+compile_stream(struct s_command **link)
+{
+ char *p;
+ static char lbuf[_POSIX2_LINE_MAX + 1]; /* To save stack */
+ struct s_command *cmd, *cmd2, *stack;
+ struct s_format *fp;
+ char re[_POSIX2_LINE_MAX + 1];
+ int naddr; /* Number of addresses */
+
+ stack = NULL;
+ for (;;) {
+ if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) {
+ if (stack != NULL)
+ errx(1, "%lu: %s: unexpected EOF (pending }'s)",
+ linenum, fname);
+ return (link);
+ }
+
+semicolon: EATSPACE();
+ if (p) {
+ if (*p == '#' || *p == '\0')
+ continue;
+ else if (*p == ';') {
+ p++;
+ goto semicolon;
+ }
+ }
+ if ((*link = cmd = malloc(sizeof(struct s_command))) == NULL)
+ err(1, "malloc");
+ link = &cmd->next;
+ cmd->startline = cmd->nonsel = 0;
+ /* First parse the addresses */
+ naddr = 0;
+
+/* Valid characters to start an address */
+#define addrchar(c) (strchr("0123456789/\\$", (c)))
+ if (addrchar(*p)) {
+ naddr++;
+ if ((cmd->a1 = malloc(sizeof(struct s_addr))) == NULL)
+ err(1, "malloc");
+ p = compile_addr(p, cmd->a1);
+ EATSPACE(); /* EXTENSION */
+ if (*p == ',') {
+ p++;
+ EATSPACE(); /* EXTENSION */
+ naddr++;
+ if ((cmd->a2 = malloc(sizeof(struct s_addr)))
+ == NULL)
+ err(1, "malloc");
+ p = compile_addr(p, cmd->a2);
+ EATSPACE();
+ } else
+ cmd->a2 = NULL;
+ } else
+ cmd->a1 = cmd->a2 = NULL;
+
+nonsel: /* Now parse the command */
+ if (!*p)
+ errx(1, "%lu: %s: command expected", linenum, fname);
+ cmd->code = *p;
+ for (fp = cmd_fmts; fp->code; fp++)
+ if (fp->code == *p)
+ break;
+ if (!fp->code)
+ errx(1, "%lu: %s: invalid command code %c", linenum, fname, *p);
+ if (naddr > fp->naddr)
+ errx(1,
+ "%lu: %s: command %c expects up to %d address(es), found %d",
+ linenum, fname, *p, fp->naddr, naddr);
+ switch (fp->args) {
+ case NONSEL: /* ! */
+ p++;
+ EATSPACE();
+ cmd->nonsel = 1;
+ goto nonsel;
+ case GROUP: /* { */
+ p++;
+ EATSPACE();
+ cmd->next = stack;
+ stack = cmd;
+ link = &cmd->u.c;
+ if (*p)
+ goto semicolon;
+ break;
+ case ENDGROUP:
+ /*
+ * Short-circuit command processing, since end of
+ * group is really just a noop.
+ */
+ cmd->nonsel = 1;
+ if (stack == NULL)
+ errx(1, "%lu: %s: unexpected }", linenum, fname);
+ cmd2 = stack;
+ stack = cmd2->next;
+ cmd2->next = cmd;
+ /*FALLTHROUGH*/
+ case EMPTY: /* d D g G h H l n N p P q x = \0 */
+ p++;
+ EATSPACE();
+ if (*p == ';') {
+ p++;
+ link = &cmd->next;
+ goto semicolon;
+ }
+ if (*p)
+ errx(1, "%lu: %s: extra characters at the end of %c command",
+ linenum, fname, cmd->code);
+ break;
+ case TEXT: /* a c i */
+ p++;
+ EATSPACE();
+ if (*p != '\\')
+ errx(1,
+"%lu: %s: command %c expects \\ followed by text", linenum, fname, cmd->code);
+ p++;
+ EATSPACE();
+ if (*p)
+ errx(1,
+ "%lu: %s: extra characters after \\ at the end of %c command",
+ linenum, fname, cmd->code);
+ cmd->t = compile_text();
+ break;
+ case COMMENT: /* \0 # */
+ break;
+ case WFILE: /* w */
+ p++;
+ EATSPACE();
+ if (*p == '\0')
+ errx(1, "%lu: %s: filename expected", linenum, fname);
+ cmd->t = duptoeol(p, "w command");
+ if (aflag)
+ cmd->u.fd = -1;
+ else if ((cmd->u.fd = open(p,
+ O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
+ DEFFILEMODE)) == -1)
+ err(1, "%s", p);
+ break;
+ case RFILE: /* r */
+ p++;
+ EATSPACE();
+ if (*p == '\0')
+ errx(1, "%lu: %s: filename expected", linenum, fname);
+ else
+ cmd->t = duptoeol(p, "read command");
+ break;
+ case BRANCH: /* b t */
+ p++;
+ EATSPACE();
+ if (*p == '\0')
+ cmd->t = NULL;
+ else
+ cmd->t = duptoeol(p, "branch");
+ break;
+ case LABEL: /* : */
+ p++;
+ EATSPACE();
+ cmd->t = duptoeol(p, "label");
+ if (strlen(p) == 0)
+ errx(1, "%lu: %s: empty label", linenum, fname);
+ enterlabel(cmd);
+ break;
+ case SUBST: /* s */
+ p++;
+ if (*p == '\0' || *p == '\\')
+ errx(1,
+"%lu: %s: substitute pattern can not be delimited by newline or backslash",
+ linenum, fname);
+ if ((cmd->u.s = calloc(1, sizeof(struct s_subst))) == NULL)
+ err(1, "malloc");
+ p = compile_delimited(p, re, 0);
+ if (p == NULL)
+ errx(1,
+ "%lu: %s: unterminated substitute pattern", linenum, fname);
+
+ /* Compile RE with no case sensitivity temporarily */
+ if (*re == '\0')
+ cmd->u.s->re = NULL;
+ else
+ cmd->u.s->re = compile_re(re, 0);
+ --p;
+ p = compile_subst(p, cmd->u.s);
+ p = compile_flags(p, cmd->u.s);
+
+ /* Recompile RE with case sensitivity from "I" flag if any */
+ if (*re == '\0')
+ cmd->u.s->re = NULL;
+ else
+ cmd->u.s->re = compile_re(re, cmd->u.s->icase);
+ EATSPACE();
+ if (*p == ';') {
+ p++;
+ link = &cmd->next;
+ goto semicolon;
+ }
+ break;
+ case TR: /* y */
+ p++;
+ p = compile_tr(p, &cmd->u.y);
+ EATSPACE();
+ if (*p == ';') {
+ p++;
+ link = &cmd->next;
+ goto semicolon;
+ }
+ if (*p)
+ errx(1,
+"%lu: %s: extra text at the end of a transform command", linenum, fname);
+ break;
+ }
+ }
+}
+
+/*
+ * Get a delimited string. P points to the delimiter of the string; d points
+ * to a buffer area. Newline and delimiter escapes are processed; other
+ * escapes are ignored.
+ *
+ * Returns a pointer to the first character after the final delimiter or NULL
+ * in the case of a non-terminated string. The character array d is filled
+ * with the processed string.
+ */
+static char *
+compile_delimited(char *p, char *d, int is_tr)
+{
+ char c;
+
+ c = *p++;
+ if (c == '\0')
+ return (NULL);
+ else if (c == '\\')
+ errx(1, "%lu: %s: \\ can not be used as a string delimiter",
+ linenum, fname);
+ else if (c == '\n')
+ errx(1, "%lu: %s: newline can not be used as a string delimiter",
+ linenum, fname);
+ while (*p) {
+ if (*p == '[' && *p != c) {
+ if ((d = compile_ccl(&p, d)) == NULL)
+ errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname);
+ continue;
+ } else if (*p == '\\' && p[1] == '[') {
+ *d++ = *p++;
+ } else if (*p == '\\' && p[1] == c)
+ p++;
+ else if (*p == '\\' && p[1] == 'n') {
+ *d++ = '\n';
+ p += 2;
+ continue;
+ } else if (*p == '\\' && p[1] == '\\') {
+ if (is_tr)
+ p++;
+ else
+ *d++ = *p++;
+ } else if (*p == c) {
+ *d = '\0';
+ return (p + 1);
+ }
+ *d++ = *p++;
+ }
+ return (NULL);
+}
+
+
+/* compile_ccl: expand a POSIX character class */
+static char *
+compile_ccl(char **sp, char *t)
+{
+ int c, d;
+ char *s = *sp;
+
+ *t++ = *s++;
+ if (*s == '^')
+ *t++ = *s++;
+ if (*s == ']')
+ *t++ = *s++;
+ for (; *s && (*t = *s) != ']'; s++, t++)
+ if (*s == '[' && ((d = *(s+1)) == '.' || d == ':' || d == '=')) {
+ *++t = *++s, t++, s++;
+ for (c = *s; (*t = *s) != ']' || c != d; s++, t++)
+ if ((c = *s) == '\0')
+ return NULL;
+ }
+ return (*s == ']') ? *sp = ++s, ++t : NULL;
+}
+
+/*
+ * Compiles the regular expression in RE and returns a pointer to the compiled
+ * regular expression.
+ * Cflags are passed to regcomp.
+ */
+static regex_t *
+compile_re(char *re, int case_insensitive)
+{
+ regex_t *rep;
+ int eval, flags;
+
+
+ flags = rflags;
+ if (case_insensitive)
+ flags |= REG_ICASE;
+ if ((rep = malloc(sizeof(regex_t))) == NULL)
+ err(1, "malloc");
+ if ((eval = regcomp(rep, re, flags)) != 0)
+ errx(1, "%lu: %s: RE error: %s",
+ linenum, fname, strregerror(eval, rep));
+ if (maxnsub < rep->re_nsub)
+ maxnsub = rep->re_nsub;
+ return (rep);
+}
+
+/*
+ * Compile the substitution string of a regular expression and set res to
+ * point to a saved copy of it. Nsub is the number of parenthesized regular
+ * expressions.
+ */
+static char *
+compile_subst(char *p, struct s_subst *s)
+{
+ static char lbuf[_POSIX2_LINE_MAX + 1];
+ int asize, size;
+ u_char ref;
+ char c, *text, *op, *sp;
+ int more = 1, sawesc = 0;
+
+ c = *p++; /* Terminator character */
+ if (c == '\0')
+ return (NULL);
+
+ s->maxbref = 0;
+ s->linenum = linenum;
+ asize = 2 * _POSIX2_LINE_MAX + 1;
+ if ((text = malloc(asize)) == NULL)
+ err(1, "malloc");
+ size = 0;
+ do {
+ op = sp = text + size;
+ for (; *p; p++) {
+ if (*p == '\\' || sawesc) {
+ /*
+ * If this is a continuation from the last
+ * buffer, we won't have a character to
+ * skip over.
+ */
+ if (sawesc)
+ sawesc = 0;
+ else
+ p++;
+
+ if (*p == '\0') {
+ /*
+ * This escaped character is continued
+ * in the next part of the line. Note
+ * this fact, then cause the loop to
+ * exit w/ normal EOL case and reenter
+ * above with the new buffer.
+ */
+ sawesc = 1;
+ p--;
+ continue;
+ } else if (strchr("123456789", *p) != NULL) {
+ *sp++ = '\\';
+ ref = *p - '0';
+ if (s->re != NULL &&
+ ref > s->re->re_nsub)
+ errx(1, "%lu: %s: \\%c not defined in the RE",
+ linenum, fname, *p);
+ if (s->maxbref < ref)
+ s->maxbref = ref;
+ } else if (*p == '&' || *p == '\\')
+ *sp++ = '\\';
+ } else if (*p == c) {
+ if (*++p == '\0' && more) {
+ if (cu_fgets(lbuf, sizeof(lbuf), &more))
+ p = lbuf;
+ }
+ *sp++ = '\0';
+ size += sp - op;
+ if ((s->new = realloc(text, size)) == NULL)
+ err(1, "realloc");
+ return (p);
+ } else if (*p == '\n') {
+ errx(1,
+"%lu: %s: unescaped newline inside substitute pattern", linenum, fname);
+ /* NOTREACHED */
+ }
+ *sp++ = *p;
+ }
+ size += sp - op;
+ if (asize - size < _POSIX2_LINE_MAX + 1) {
+ asize *= 2;
+ if ((text = realloc(text, asize)) == NULL)
+ err(1, "realloc");
+ }
+ } while (cu_fgets(p = lbuf, sizeof(lbuf), &more));
+ errx(1, "%lu: %s: unterminated substitute in regular expression",
+ linenum, fname);
+ /* NOTREACHED */
+}
+
+/*
+ * Compile the flags of the s command
+ */
+static char *
+compile_flags(char *p, struct s_subst *s)
+{
+ int gn; /* True if we have seen g or n */
+ unsigned long nval;
+ char wfile[_POSIX2_LINE_MAX + 1], *q, *eq;
+
+ s->n = 1; /* Default */
+ s->p = 0;
+ s->wfile = NULL;
+ s->wfd = -1;
+ s->icase = 0;
+ for (gn = 0;;) {
+ EATSPACE(); /* EXTENSION */
+ switch (*p) {
+ case 'g':
+ if (gn)
+ errx(1,
+"%lu: %s: more than one number or 'g' in substitute flags", linenum, fname);
+ gn = 1;
+ s->n = 0;
+ break;
+ case '\0':
+ case '\n':
+ case ';':
+ return (p);
+ case 'p':
+ s->p = 1;
+ break;
+ case 'i':
+ case 'I':
+ s->icase = 1;
+ break;
+ case '1': case '2': case '3':
+ case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ if (gn)
+ errx(1,
+"%lu: %s: more than one number or 'g' in substitute flags", linenum, fname);
+ gn = 1;
+ errno = 0;
+ nval = strtol(p, &p, 10);
+ if (errno == ERANGE || nval > INT_MAX)
+ errx(1,
+"%lu: %s: overflow in the 'N' substitute flag", linenum, fname);
+ s->n = nval;
+ p--;
+ break;
+ case 'w':
+ p++;
+#ifdef HISTORIC_PRACTICE
+ if (*p != ' ') {
+ warnx("%lu: %s: space missing before w wfile", linenum, fname);
+ return (p);
+ }
+#endif
+ EATSPACE();
+ q = wfile;
+ eq = wfile + sizeof(wfile) - 1;
+ while (*p) {
+ if (*p == '\n')
+ break;
+ if (q >= eq)
+ err(1, "wfile too long");
+ *q++ = *p++;
+ }
+ *q = '\0';
+ if (q == wfile)
+ errx(1, "%lu: %s: no wfile specified", linenum, fname);
+ s->wfile = strdup(wfile);
+ if (!aflag && (s->wfd = open(wfile,
+ O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
+ DEFFILEMODE)) == -1)
+ err(1, "%s", wfile);
+ return (p);
+ default:
+ errx(1, "%lu: %s: bad flag in substitute command: '%c'",
+ linenum, fname, *p);
+ break;
+ }
+ p++;
+ }
+}
+
+/*
+ * Compile a translation set of strings into a lookup table.
+ */
+static char *
+compile_tr(char *p, struct s_tr **py)
+{
+ struct s_tr *y;
+ int i;
+ const char *op, *np;
+ char old[_POSIX2_LINE_MAX + 1];
+ char new[_POSIX2_LINE_MAX + 1];
+ size_t oclen, oldlen, nclen, newlen;
+ mbstate_t mbs1, mbs2;
+
+ if ((*py = y = malloc(sizeof(*y))) == NULL)
+ err(1, NULL);
+ y->multis = NULL;
+ y->nmultis = 0;
+
+ if (*p == '\0' || *p == '\\')
+ errx(1,
+ "%lu: %s: transform pattern can not be delimited by newline or backslash",
+ linenum, fname);
+ p = compile_delimited(p, old, 1);
+ if (p == NULL)
+ errx(1, "%lu: %s: unterminated transform source string",
+ linenum, fname);
+ p = compile_delimited(p - 1, new, 1);
+ if (p == NULL)
+ errx(1, "%lu: %s: unterminated transform target string",
+ linenum, fname);
+ EATSPACE();
+ op = old;
+ oldlen = mbsrtowcs(NULL, &op, 0, NULL);
+ if (oldlen == (size_t)-1)
+ err(1, NULL);
+ np = new;
+ newlen = mbsrtowcs(NULL, &np, 0, NULL);
+ if (newlen == (size_t)-1)
+ err(1, NULL);
+ if (newlen != oldlen)
+ errx(1, "%lu: %s: transform strings are not the same length",
+ linenum, fname);
+ if (MB_CUR_MAX == 1) {
+ /*
+ * The single-byte encoding case is easy: generate a
+ * lookup table.
+ */
+ for (i = 0; i <= UCHAR_MAX; i++)
+ y->bytetab[i] = (char)i;
+ for (; *op; op++, np++)
+ y->bytetab[(u_char)*op] = *np;
+ } else {
+ /*
+ * Multi-byte encoding case: generate a lookup table as
+ * above, but only for single-byte characters. The first
+ * bytes of multi-byte characters have their lookup table
+ * entries set to 0, which causes do_tr() to search through
+ * an auxiliary vector of multi-byte mappings.
+ */
+ memset(&mbs1, 0, sizeof(mbs1));
+ memset(&mbs2, 0, sizeof(mbs2));
+ for (i = 0; i <= UCHAR_MAX; i++)
+ y->bytetab[i] = (btowc(i) != WEOF) ? i : 0;
+ while (*op != '\0') {
+ oclen = mbrlen(op, MB_LEN_MAX, &mbs1);
+ if (oclen == (size_t)-1 || oclen == (size_t)-2)
+ errc(1, EILSEQ, NULL);
+ nclen = mbrlen(np, MB_LEN_MAX, &mbs2);
+ if (nclen == (size_t)-1 || nclen == (size_t)-2)
+ errc(1, EILSEQ, NULL);
+ if (oclen == 1 && nclen == 1)
+ y->bytetab[(u_char)*op] = *np;
+ else {
+ y->bytetab[(u_char)*op] = 0;
+ y->multis = realloc(y->multis,
+ (y->nmultis + 1) * sizeof(*y->multis));
+ if (y->multis == NULL)
+ err(1, NULL);
+ i = y->nmultis++;
+ y->multis[i].fromlen = oclen;
+ memcpy(y->multis[i].from, op, oclen);
+ y->multis[i].tolen = nclen;
+ memcpy(y->multis[i].to, np, nclen);
+ }
+ op += oclen;
+ np += nclen;
+ }
+ }
+ return (p);
+}
+
+/*
+ * Compile the text following an a, c, or i command.
+ */
+static char *
+compile_text(void)
+{
+ int asize, esc_nl, size;
+ char *text, *p, *op, *s;
+ char lbuf[_POSIX2_LINE_MAX + 1];
+
+ asize = 2 * _POSIX2_LINE_MAX + 1;
+ if ((text = malloc(asize)) == NULL)
+ err(1, "malloc");
+ size = 0;
+ while (cu_fgets(lbuf, sizeof(lbuf), NULL)) {
+ op = s = text + size;
+ p = lbuf;
+ for (esc_nl = 0; *p != '\0'; p++) {
+ if (*p == '\\' && p[1] != '\0' && *++p == '\n')
+ esc_nl = 1;
+ *s++ = *p;
+ }
+ size += s - op;
+ if (!esc_nl) {
+ *s = '\0';
+ break;
+ }
+ if (asize - size < _POSIX2_LINE_MAX + 1) {
+ asize *= 2;
+ if ((text = realloc(text, asize)) == NULL)
+ err(1, "realloc");
+ }
+ }
+ text[size] = '\0';
+ if ((p = realloc(text, size + 1)) == NULL)
+ err(1, "realloc");
+ return (p);
+}
+
+/*
+ * Get an address and return a pointer to the first character after
+ * it. Fill the structure pointed to according to the address.
+ */
+static char *
+compile_addr(char *p, struct s_addr *a)
+{
+ char *end, re[_POSIX2_LINE_MAX + 1];
+ int icase;
+
+ icase = 0;
+
+ a->type = 0;
+ switch (*p) {
+ case '\\': /* Context address */
+ ++p;
+ /* FALLTHROUGH */
+ case '/': /* Context address */
+ p = compile_delimited(p, re, 0);
+ if (p == NULL)
+ errx(1, "%lu: %s: unterminated regular expression", linenum, fname);
+ /* Check for case insensitive regexp flag */
+ if (*p == 'I') {
+ icase = 1;
+ p++;
+ }
+ if (*re == '\0')
+ a->u.r = NULL;
+ else
+ a->u.r = compile_re(re, icase);
+ a->type = AT_RE;
+ return (p);
+
+ case '$': /* Last line */
+ a->type = AT_LAST;
+ return (p + 1);
+
+ case '+': /* Relative line number */
+ a->type = AT_RELLINE;
+ p++;
+ /* FALLTHROUGH */
+ /* Line number */
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (a->type == 0)
+ a->type = AT_LINE;
+ a->u.l = strtol(p, &end, 10);
+ return (end);
+ default:
+ errx(1, "%lu: %s: expected context address", linenum, fname);
+ return (NULL);
+ }
+}
+
+/*
+ * duptoeol --
+ * Return a copy of all the characters up to \n or \0.
+ */
+static char *
+duptoeol(char *s, const char *ctype)
+{
+ size_t len;
+ int ws;
+ char *p, *start;
+
+ ws = 0;
+ for (start = s; *s != '\0' && *s != '\n'; ++s)
+ ws = isspace((unsigned char)*s);
+ *s = '\0';
+ if (ws)
+ warnx("%lu: %s: whitespace after %s", linenum, fname, ctype);
+ len = s - start + 1;
+ if ((p = malloc(len)) == NULL)
+ err(1, "malloc");
+ return (memmove(p, start, len));
+}
+
+/*
+ * Convert goto label names to addresses, and count a and r commands, in
+ * the given subset of the script. Free the memory used by labels in b
+ * and t commands (but not by :).
+ *
+ * TODO: Remove } nodes
+ */
+static void
+fixuplabel(struct s_command *cp, struct s_command *end)
+{
+
+ for (; cp != end; cp = cp->next)
+ switch (cp->code) {
+ case 'a':
+ case 'r':
+ appendnum++;
+ break;
+ case 'b':
+ case 't':
+ /* Resolve branch target. */
+ if (cp->t == NULL) {
+ cp->u.c = NULL;
+ break;
+ }
+ if ((cp->u.c = findlabel(cp->t)) == NULL)
+ errx(1, "%lu: %s: undefined label '%s'", linenum, fname, cp->t);
+ free(cp->t);
+ break;
+ case '{':
+ /* Do interior commands. */
+ fixuplabel(cp->u.c, cp->next);
+ break;
+ }
+}
+
+/*
+ * Associate the given command label for later lookup.
+ */
+static void
+enterlabel(struct s_command *cp)
+{
+ struct labhash **lhp, *lh;
+ u_char *p;
+ u_int h, c;
+
+ for (h = 0, p = (u_char *)cp->t; (c = *p) != 0; p++)
+ h = (h << 5) + h + c;
+ lhp = &labels[h & LHMASK];
+ for (lh = *lhp; lh != NULL; lh = lh->lh_next)
+ if (lh->lh_hash == h && strcmp(cp->t, lh->lh_cmd->t) == 0)
+ errx(1, "%lu: %s: duplicate label '%s'", linenum, fname, cp->t);
+ if ((lh = malloc(sizeof *lh)) == NULL)
+ err(1, "malloc");
+ lh->lh_next = *lhp;
+ lh->lh_hash = h;
+ lh->lh_cmd = cp;
+ lh->lh_ref = 0;
+ *lhp = lh;
+}
+
+/*
+ * Find the label contained in the command l in the command linked
+ * list cp. L is excluded from the search. Return NULL if not found.
+ */
+static struct s_command *
+findlabel(char *name)
+{
+ struct labhash *lh;
+ u_char *p;
+ u_int h, c;
+
+ for (h = 0, p = (u_char *)name; (c = *p) != 0; p++)
+ h = (h << 5) + h + c;
+ for (lh = labels[h & LHMASK]; lh != NULL; lh = lh->lh_next) {
+ if (lh->lh_hash == h && strcmp(name, lh->lh_cmd->t) == 0) {
+ lh->lh_ref = 1;
+ return (lh->lh_cmd);
+ }
+ }
+ return (NULL);
+}
+
+/*
+ * Warn about any unused labels. As a side effect, release the label hash
+ * table space.
+ */
+static void
+uselabel(void)
+{
+ struct labhash *lh, *next;
+ int i;
+
+ for (i = 0; i < LHSZ; i++) {
+ for (lh = labels[i]; lh != NULL; lh = next) {
+ next = lh->lh_next;
+ if (!lh->lh_ref)
+ warnx("%lu: %s: unused label '%s'",
+ linenum, fname, lh->lh_cmd->t);
+ free(lh);
+ }
+ }
+}
diff --git a/usr.bin/sed/defs.h b/usr.bin/sed/defs.h
new file mode 100644
index 0000000..fb33676
--- /dev/null
+++ b/usr.bin/sed/defs.h
@@ -0,0 +1,149 @@
+/*-
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ *
+ * @(#)defs.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+/*
+ * Types of address specifications
+ */
+enum e_atype {
+ AT_RE = 1, /* Line that match RE */
+ AT_LINE, /* Specific line */
+ AT_RELLINE, /* Relative line */
+ AT_LAST, /* Last line */
+};
+
+/*
+ * Format of an address
+ */
+struct s_addr {
+ enum e_atype type; /* Address type */
+ union {
+ u_long l; /* Line number */
+ regex_t *r; /* Regular expression */
+ } u;
+};
+
+/*
+ * Substitution command
+ */
+struct s_subst {
+ int n; /* Occurrence to subst. */
+ int p; /* True if p flag */
+ int icase; /* True if I flag */
+ char *wfile; /* NULL if no wfile */
+ int wfd; /* Cached file descriptor */
+ regex_t *re; /* Regular expression */
+ unsigned int maxbref; /* Largest backreference. */
+ u_long linenum; /* Line number. */
+ char *new; /* Replacement text */
+};
+
+/*
+ * Translate command.
+ */
+struct s_tr {
+ unsigned char bytetab[256];
+ struct trmulti {
+ size_t fromlen;
+ char from[MB_LEN_MAX];
+ size_t tolen;
+ char to[MB_LEN_MAX];
+ } *multis;
+ int nmultis;
+};
+
+/*
+ * An internally compiled command.
+ * Initialy, label references are stored in t, on a second pass they
+ * are updated to pointers.
+ */
+struct s_command {
+ struct s_command *next; /* Pointer to next command */
+ struct s_addr *a1, *a2; /* Start and end address */
+ u_long startline; /* Start line number or zero */
+ char *t; /* Text for : a c i r w */
+ union {
+ struct s_command *c; /* Command(s) for b t { */
+ struct s_subst *s; /* Substitute command */
+ struct s_tr *y; /* Replace command array */
+ int fd; /* File descriptor for w */
+ } u;
+ char code; /* Command code */
+ u_int nonsel:1; /* True if ! */
+};
+
+/*
+ * Types of command arguments recognised by the parser
+ */
+enum e_args {
+ EMPTY, /* d D g G h H l n N p P q x = \0 */
+ TEXT, /* a c i */
+ NONSEL, /* ! */
+ GROUP, /* { */
+ ENDGROUP, /* } */
+ COMMENT, /* # */
+ BRANCH, /* b t */
+ LABEL, /* : */
+ RFILE, /* r */
+ WFILE, /* w */
+ SUBST, /* s */
+ TR /* y */
+};
+
+/*
+ * Structure containing things to append before a line is read
+ */
+struct s_appends {
+ enum {AP_STRING, AP_FILE} type;
+ char *s;
+ size_t len;
+};
+
+enum e_spflag {
+ APPEND, /* Append to the contents. */
+ REPLACE, /* Replace the contents. */
+};
+
+/*
+ * Structure for a space (process, hold, otherwise).
+ */
+typedef struct {
+ char *space; /* Current space pointer. */
+ size_t len; /* Current length. */
+ int deleted; /* If deleted. */
+ int append_newline; /* If originally terminated by \n. */
+ char *back; /* Backing memory. */
+ size_t blen; /* Backing memory length. */
+} SPACE;
diff --git a/usr.bin/sed/extern.h b/usr.bin/sed/extern.h
new file mode 100644
index 0000000..f2bd71b
--- /dev/null
+++ b/usr.bin/sed/extern.h
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+extern struct s_command *prog;
+extern struct s_appends *appends;
+extern regmatch_t *match;
+extern size_t maxnsub;
+extern u_long linenum;
+extern int appendnum;
+extern int aflag, eflag, nflag;
+extern const char *fname, *outfname;
+extern FILE *infile, *outfile;
+extern int rflags; /* regex flags to use */
+
+void cfclose(struct s_command *, struct s_command *);
+void compile(void);
+void cspace(SPACE *, const char *, size_t, enum e_spflag);
+char *cu_fgets(char *, int, int *);
+int mf_fgets(SPACE *, enum e_spflag);
+int lastline(void);
+void process(void);
+void resetstate(void);
+char *strregerror(int, regex_t *);
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
new file mode 100644
index 0000000..36a3299
--- /dev/null
+++ b/usr.bin/sed/main.c
@@ -0,0 +1,537 @@
+/*-
+ * Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson.
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94";
+#endif
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <limits.h>
+#include <locale.h>
+#include <regex.h>
+#include <stddef.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "defs.h"
+#include "extern.h"
+
+/*
+ * Linked list of units (strings and files) to be compiled
+ */
+struct s_compunit {
+ struct s_compunit *next;
+ enum e_cut {CU_FILE, CU_STRING} type;
+ char *s; /* Pointer to string or fname */
+};
+
+/*
+ * Linked list pointer to compilation units and pointer to current
+ * next pointer.
+ */
+static struct s_compunit *script, **cu_nextp = &script;
+
+/*
+ * Linked list of files to be processed
+ */
+struct s_flist {
+ char *fname;
+ struct s_flist *next;
+};
+
+/*
+ * Linked list pointer to files and pointer to current
+ * next pointer.
+ */
+static struct s_flist *files, **fl_nextp = &files;
+
+FILE *infile; /* Current input file */
+FILE *outfile; /* Current output file */
+
+int aflag, eflag, nflag;
+int rflags = 0;
+static int rval; /* Exit status */
+
+static int ispan; /* Whether inplace editing spans across files */
+
+/*
+ * Current file and line number; line numbers restart across compilation
+ * units, but span across input files. The latter is optional if editing
+ * in place.
+ */
+const char *fname; /* File name. */
+const char *outfname; /* Output file name */
+static char oldfname[PATH_MAX]; /* Old file name (for in-place editing) */
+static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */
+static const char *inplace; /* Inplace edit file extension. */
+u_long linenum;
+
+static void add_compunit(enum e_cut, char *);
+static void add_file(char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int c, fflag;
+ char *temp_arg;
+
+ (void) setlocale(LC_ALL, "");
+
+ fflag = 0;
+ inplace = NULL;
+
+ while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1)
+ switch (c) {
+ case 'r': /* Gnu sed compat */
+ case 'E':
+ rflags = REG_EXTENDED;
+ break;
+ case 'I':
+ inplace = optarg;
+ ispan = 1; /* span across input files */
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 'e':
+ eflag = 1;
+ if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL)
+ err(1, "malloc");
+ strcpy(temp_arg, optarg);
+ strcat(temp_arg, "\n");
+ add_compunit(CU_STRING, temp_arg);
+ break;
+ case 'f':
+ fflag = 1;
+ add_compunit(CU_FILE, optarg);
+ break;
+ case 'i':
+ inplace = optarg;
+ ispan = 0; /* don't span across input files */
+ break;
+ case 'l':
+ 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();
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* First usage case; script is the first arg */
+ if (!eflag && !fflag && *argv) {
+ add_compunit(CU_STRING, *argv);
+ argv++;
+ }
+
+ compile();
+
+ /* Continue with first and start second usage */
+ if (*argv)
+ for (; *argv; argv++)
+ add_file(*argv);
+ else
+ add_file(NULL);
+ process();
+ cfclose(prog, NULL);
+ if (fclose(stdout))
+ err(1, "stdout");
+ exit(rval);
+}
+
+static void
+usage(void)
+{
+ (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);
+}
+
+/*
+ * Like fgets, but go through the chain of compilation units chaining them
+ * together. Empty strings and files are ignored.
+ */
+char *
+cu_fgets(char *buf, int n, int *more)
+{
+ static enum {ST_EOF, ST_FILE, ST_STRING} state = ST_EOF;
+ static FILE *f; /* Current open file */
+ static char *s; /* Current pointer inside string */
+ static char string_ident[30];
+ char *p;
+
+again:
+ switch (state) {
+ case ST_EOF:
+ if (script == NULL) {
+ if (more != NULL)
+ *more = 0;
+ return (NULL);
+ }
+ linenum = 0;
+ switch (script->type) {
+ case CU_FILE:
+ if ((f = fopen(script->s, "r")) == NULL)
+ err(1, "%s", script->s);
+ fname = script->s;
+ state = ST_FILE;
+ goto again;
+ case CU_STRING:
+ if (((size_t)snprintf(string_ident,
+ sizeof(string_ident), "\"%s\"", script->s)) >=
+ sizeof(string_ident) - 1)
+ (void)strcpy(string_ident +
+ sizeof(string_ident) - 6, " ...\"");
+ fname = string_ident;
+ s = script->s;
+ state = ST_STRING;
+ goto again;
+ }
+ case ST_FILE:
+ if ((p = fgets(buf, n, f)) != NULL) {
+ linenum++;
+ if (linenum == 1 && buf[0] == '#' && buf[1] == 'n')
+ nflag = 1;
+ if (more != NULL)
+ *more = !feof(f);
+ return (p);
+ }
+ script = script->next;
+ (void)fclose(f);
+ state = ST_EOF;
+ goto again;
+ case ST_STRING:
+ if (linenum == 0 && s[0] == '#' && s[1] == 'n')
+ nflag = 1;
+ p = buf;
+ for (;;) {
+ if (n-- <= 1) {
+ *p = '\0';
+ linenum++;
+ if (more != NULL)
+ *more = 1;
+ return (buf);
+ }
+ switch (*s) {
+ case '\0':
+ state = ST_EOF;
+ if (s == script->s) {
+ script = script->next;
+ goto again;
+ } else {
+ script = script->next;
+ *p = '\0';
+ linenum++;
+ if (more != NULL)
+ *more = 0;
+ return (buf);
+ }
+ case '\n':
+ *p++ = '\n';
+ *p = '\0';
+ s++;
+ linenum++;
+ if (more != NULL)
+ *more = 0;
+ return (buf);
+ default:
+ *p++ = *s++;
+ }
+ }
+ }
+ /* NOTREACHED */
+ return (NULL);
+}
+
+/*
+ * Like fgets, but go through the list of files chaining them together.
+ * Set len to the length of the line.
+ */
+int
+mf_fgets(SPACE *sp, enum e_spflag spflag)
+{
+ struct stat sb;
+ ssize_t len;
+ static char *p = NULL;
+ static size_t plen = 0;
+ int c;
+ static int firstfile;
+
+ if (infile == NULL) {
+ /* stdin? */
+ if (files->fname == NULL) {
+ if (inplace != NULL)
+ errx(1, "-I or -i may not be used with stdin");
+ infile = stdin;
+ fname = "stdin";
+ outfile = stdout;
+ outfname = "stdout";
+ }
+ firstfile = 1;
+ }
+
+ for (;;) {
+ if (infile != NULL && (c = getc(infile)) != EOF) {
+ (void)ungetc(c, infile);
+ break;
+ }
+ /* If we are here then either eof or no files are open yet */
+ if (infile == stdin) {
+ sp->len = 0;
+ return (0);
+ }
+ if (infile != NULL) {
+ fclose(infile);
+ if (*oldfname != '\0') {
+ /* if there was a backup file, remove it */
+ unlink(oldfname);
+ /*
+ * Backup the original. Note that hard links
+ * are not supported on all filesystems.
+ */
+ if ((link(fname, oldfname) != 0) &&
+ (rename(fname, oldfname) != 0)) {
+ warn("rename()");
+ if (*tmpfname)
+ unlink(tmpfname);
+ exit(1);
+ }
+ *oldfname = '\0';
+ }
+ if (*tmpfname != '\0') {
+ if (outfile != NULL && outfile != stdout)
+ if (fclose(outfile) != 0) {
+ warn("fclose()");
+ unlink(tmpfname);
+ exit(1);
+ }
+ outfile = NULL;
+ if (rename(tmpfname, fname) != 0) {
+ /* this should not happen really! */
+ warn("rename()");
+ unlink(tmpfname);
+ exit(1);
+ }
+ *tmpfname = '\0';
+ }
+ outfname = NULL;
+ }
+ if (firstfile == 0)
+ files = files->next;
+ else
+ firstfile = 0;
+ if (files == NULL) {
+ sp->len = 0;
+ return (0);
+ }
+ fname = files->fname;
+ if (inplace != NULL) {
+ if (lstat(fname, &sb) != 0)
+ err(1, "%s", fname);
+ if (!(sb.st_mode & S_IFREG))
+ errx(1, "%s: %s %s", fname,
+ "in-place editing only",
+ "works for regular files");
+ if (*inplace != '\0') {
+ strlcpy(oldfname, fname,
+ sizeof(oldfname));
+ len = strlcat(oldfname, inplace,
+ sizeof(oldfname));
+ if (len > (ssize_t)sizeof(oldfname))
+ errx(1, "%s: name too long", fname);
+ }
+ len = snprintf(tmpfname, sizeof(tmpfname),
+ "%s/.!%ld!%s", dirname(fname), (long)getpid(),
+ basename(fname));
+ if (len >= (ssize_t)sizeof(tmpfname))
+ errx(1, "%s: name too long", fname);
+ unlink(tmpfname);
+ if (outfile != NULL && outfile != stdout)
+ fclose(outfile);
+ if ((outfile = fopen(tmpfname, "w")) == NULL)
+ err(1, "%s", fname);
+ fchown(fileno(outfile), sb.st_uid, sb.st_gid);
+ fchmod(fileno(outfile), sb.st_mode & ALLPERMS);
+ outfname = tmpfname;
+ if (!ispan) {
+ linenum = 0;
+ resetstate();
+ }
+ } else {
+ outfile = stdout;
+ outfname = "stdout";
+ }
+ if ((infile = fopen(fname, "r")) == NULL) {
+ warn("%s", fname);
+ rval = 1;
+ continue;
+ }
+ }
+ /*
+ * We are here only when infile is open and we still have something
+ * to read from it.
+ *
+ * Use getline() so that we can handle essentially infinite input
+ * data. The p and plen are static so each invocation gives
+ * getline() the same buffer which is expanded as needed.
+ */
+ len = getline(&p, &plen, infile);
+ if (len == -1)
+ err(1, "%s", fname);
+ if (len != 0 && p[len - 1] == '\n') {
+ sp->append_newline = 1;
+ len--;
+ } else if (!lastline()) {
+ sp->append_newline = 1;
+ } else {
+ sp->append_newline = 0;
+ }
+ cspace(sp, p, len, spflag);
+
+ linenum++;
+
+ return (1);
+}
+
+/*
+ * Add a compilation unit to the linked list
+ */
+static void
+add_compunit(enum e_cut type, char *s)
+{
+ struct s_compunit *cu;
+
+ if ((cu = malloc(sizeof(struct s_compunit))) == NULL)
+ err(1, "malloc");
+ cu->type = type;
+ cu->s = s;
+ cu->next = NULL;
+ *cu_nextp = cu;
+ cu_nextp = &cu->next;
+}
+
+/*
+ * Add a file to the linked list
+ */
+static void
+add_file(char *s)
+{
+ struct s_flist *fp;
+
+ if ((fp = malloc(sizeof(struct s_flist))) == NULL)
+ err(1, "malloc");
+ fp->next = NULL;
+ *fl_nextp = fp;
+ fp->fname = s;
+ fl_nextp = &fp->next;
+}
+
+static int
+next_files_have_lines(void)
+{
+ struct s_flist *file;
+ FILE *file_fd;
+ int ch;
+
+ file = files;
+ while ((file = file->next) != NULL) {
+ if ((file_fd = fopen(file->fname, "r")) == NULL)
+ continue;
+
+ if ((ch = getc(file_fd)) != EOF) {
+ /*
+ * This next file has content, therefore current
+ * file doesn't contains the last line.
+ */
+ ungetc(ch, file_fd);
+ fclose(file_fd);
+ return (1);
+ }
+
+ fclose(file_fd);
+ }
+
+ return (0);
+}
+
+int
+lastline(void)
+{
+ int ch;
+
+ if (feof(infile)) {
+ return !(
+ (inplace == NULL || ispan) &&
+ next_files_have_lines());
+ }
+ if ((ch = getc(infile)) == EOF) {
+ return !(
+ (inplace == NULL || ispan) &&
+ next_files_have_lines());
+ }
+ ungetc(ch, infile);
+ return (0);
+}
diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c
new file mode 100644
index 0000000..f3b5137
--- /dev/null
+++ b/usr.bin/sed/misc.c
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "defs.h"
+#include "extern.h"
+
+/*
+ * Return a string for a regular expression error passed. This is overkill,
+ * because of the silly semantics of regerror (we can never know the size of
+ * the buffer).
+ */
+char *
+strregerror(int errcode, regex_t *preg)
+{
+ static char *oe;
+ size_t s;
+
+ if (oe != NULL)
+ free(oe);
+ s = regerror(errcode, preg, NULL, 0);
+ if ((oe = malloc(s)) == NULL)
+ err(1, "malloc");
+ (void)regerror(errcode, preg, oe, s);
+ return (oe);
+}
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
new file mode 100644
index 0000000..b70a492
--- /dev/null
+++ b/usr.bin/sed/process.c
@@ -0,0 +1,784 @@
+/*-
+ * Copyright (c) 1992 Diomidis Spinellis.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis of Imperial College, University of London.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/uio.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "defs.h"
+#include "extern.h"
+
+static SPACE HS, PS, SS, YS;
+#define pd PS.deleted
+#define ps PS.space
+#define psl PS.len
+#define psanl PS.append_newline
+#define hs HS.space
+#define hsl HS.len
+
+static inline int applies(struct s_command *);
+static void do_tr(struct s_tr *);
+static void flush_appends(void);
+static void lputs(char *, size_t);
+static int regexec_e(regex_t *, const char *, int, int, size_t,
+ size_t);
+static void regsub(SPACE *, char *, char *);
+static int substitute(struct s_command *);
+
+struct s_appends *appends; /* Array of pointers to strings to append. */
+static int appendx; /* Index into appends array. */
+int appendnum; /* Size of appends array. */
+
+static int lastaddr; /* Set by applies if last address of a range. */
+static int sdone; /* If any substitutes since last line input. */
+ /* Iov structure for 'w' commands. */
+static regex_t *defpreg;
+size_t maxnsub;
+regmatch_t *match;
+
+#define OUT() do { \
+ fwrite(ps, 1, psl, outfile); \
+ if (psanl) fputc('\n', outfile); \
+} while (0)
+
+void
+process(void)
+{
+ struct s_command *cp;
+ SPACE tspace;
+ size_t oldpsl = 0;
+ char *p;
+ int oldpsanl;
+
+ p = NULL;
+
+ for (linenum = 0; mf_fgets(&PS, REPLACE);) {
+ pd = 0;
+top:
+ cp = prog;
+redirect:
+ while (cp != NULL) {
+ if (!applies(cp)) {
+ cp = cp->next;
+ continue;
+ }
+ switch (cp->code) {
+ case '{':
+ cp = cp->u.c;
+ goto redirect;
+ case 'a':
+ if (appendx >= appendnum)
+ if ((appends = realloc(appends,
+ sizeof(struct s_appends) *
+ (appendnum *= 2))) == NULL)
+ err(1, "realloc");
+ appends[appendx].type = AP_STRING;
+ appends[appendx].s = cp->t;
+ appends[appendx].len = strlen(cp->t);
+ appendx++;
+ break;
+ case 'b':
+ cp = cp->u.c;
+ goto redirect;
+ case 'c':
+ pd = 1;
+ psl = 0;
+ if (cp->a2 == NULL || lastaddr || lastline())
+ (void)fprintf(outfile, "%s", cp->t);
+ break;
+ case 'd':
+ pd = 1;
+ goto new;
+ case 'D':
+ if (pd)
+ goto new;
+ if (psl == 0 ||
+ (p = memchr(ps, '\n', psl)) == NULL) {
+ pd = 1;
+ goto new;
+ } else {
+ psl -= (p + 1) - ps;
+ memmove(ps, p + 1, psl);
+ goto top;
+ }
+ case 'g':
+ cspace(&PS, hs, hsl, REPLACE);
+ break;
+ case 'G':
+ cspace(&PS, "\n", 1, APPEND);
+ cspace(&PS, hs, hsl, APPEND);
+ break;
+ case 'h':
+ cspace(&HS, ps, psl, REPLACE);
+ break;
+ case 'H':
+ cspace(&HS, "\n", 1, APPEND);
+ cspace(&HS, ps, psl, APPEND);
+ break;
+ case 'i':
+ (void)fprintf(outfile, "%s", cp->t);
+ break;
+ case 'l':
+ lputs(ps, psl);
+ break;
+ case 'n':
+ if (!nflag && !pd)
+ OUT();
+ flush_appends();
+ if (!mf_fgets(&PS, REPLACE))
+ exit(0);
+ pd = 0;
+ break;
+ case 'N':
+ flush_appends();
+ cspace(&PS, "\n", 1, APPEND);
+ if (!mf_fgets(&PS, APPEND))
+ exit(0);
+ break;
+ case 'p':
+ if (pd)
+ break;
+ OUT();
+ break;
+ case 'P':
+ if (pd)
+ break;
+ if ((p = memchr(ps, '\n', psl)) != NULL) {
+ oldpsl = psl;
+ oldpsanl = psanl;
+ psl = p - ps;
+ psanl = 1;
+ }
+ OUT();
+ if (p != NULL) {
+ psl = oldpsl;
+ psanl = oldpsanl;
+ }
+ break;
+ case 'q':
+ if (!nflag && !pd)
+ OUT();
+ flush_appends();
+ exit(0);
+ case 'r':
+ if (appendx >= appendnum)
+ if ((appends = realloc(appends,
+ sizeof(struct s_appends) *
+ (appendnum *= 2))) == NULL)
+ err(1, "realloc");
+ appends[appendx].type = AP_FILE;
+ appends[appendx].s = cp->t;
+ appends[appendx].len = strlen(cp->t);
+ appendx++;
+ break;
+ case 's':
+ sdone |= substitute(cp);
+ break;
+ case 't':
+ if (sdone) {
+ sdone = 0;
+ cp = cp->u.c;
+ goto redirect;
+ }
+ break;
+ case 'w':
+ if (pd)
+ break;
+ if (cp->u.fd == -1 && (cp->u.fd = open(cp->t,
+ O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
+ DEFFILEMODE)) == -1)
+ err(1, "%s", cp->t);
+ if (write(cp->u.fd, ps, psl) != (ssize_t)psl ||
+ write(cp->u.fd, "\n", 1) != 1)
+ err(1, "%s", cp->t);
+ break;
+ case 'x':
+ /*
+ * If the hold space is null, make it empty
+ * but not null. Otherwise the pattern space
+ * will become null after the swap, which is
+ * an abnormal condition.
+ */
+ if (hs == NULL)
+ cspace(&HS, "", 0, REPLACE);
+ tspace = PS;
+ PS = HS;
+ psanl = tspace.append_newline;
+ HS = tspace;
+ break;
+ case 'y':
+ if (pd || psl == 0)
+ break;
+ do_tr(cp->u.y);
+ break;
+ case ':':
+ case '}':
+ break;
+ case '=':
+ (void)fprintf(outfile, "%lu\n", linenum);
+ }
+ cp = cp->next;
+ } /* for all cp */
+
+new: if (!nflag && !pd)
+ OUT();
+ flush_appends();
+ } /* for all lines */
+}
+
+/*
+ * TRUE if the address passed matches the current program state
+ * (lastline, linenumber, ps).
+ */
+#define MATCH(a) \
+ ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, 0, psl) : \
+ (a)->type == AT_LINE ? linenum == (a)->u.l : lastline())
+
+/*
+ * Return TRUE if the command applies to the current line. Sets the start
+ * line for process ranges. Interprets the non-select (``!'') flag.
+ */
+static inline int
+applies(struct s_command *cp)
+{
+ int r;
+
+ lastaddr = 0;
+ if (cp->a1 == NULL && cp->a2 == NULL)
+ r = 1;
+ else if (cp->a2)
+ if (cp->startline > 0) {
+ switch (cp->a2->type) {
+ case AT_RELLINE:
+ if (linenum - cp->startline <= cp->a2->u.l)
+ r = 1;
+ else {
+ cp->startline = 0;
+ r = 0;
+ }
+ break;
+ default:
+ if (MATCH(cp->a2)) {
+ cp->startline = 0;
+ lastaddr = 1;
+ r = 1;
+ } else if (cp->a2->type == AT_LINE &&
+ linenum > cp->a2->u.l) {
+ /*
+ * We missed the 2nd address due to a
+ * branch, so just close the range and
+ * return false.
+ */
+ cp->startline = 0;
+ r = 0;
+ } else
+ r = 1;
+ }
+ } else if (cp->a1 && MATCH(cp->a1)) {
+ /*
+ * If the second address is a number less than or
+ * equal to the line number first selected, only
+ * one line shall be selected.
+ * -- POSIX 1003.2
+ * Likewise if the relative second line address is zero.
+ */
+ if ((cp->a2->type == AT_LINE &&
+ linenum >= cp->a2->u.l) ||
+ (cp->a2->type == AT_RELLINE && cp->a2->u.l == 0))
+ lastaddr = 1;
+ else {
+ cp->startline = linenum;
+ }
+ r = 1;
+ } else
+ r = 0;
+ else
+ r = MATCH(cp->a1);
+ return (cp->nonsel ? ! r : r);
+}
+
+/*
+ * Reset the sed processor to its initial state.
+ */
+void
+resetstate(void)
+{
+ struct s_command *cp;
+
+ /*
+ * Reset all in-range markers.
+ */
+ for (cp = prog; cp; cp = cp->code == '{' ? cp->u.c : cp->next)
+ if (cp->a2)
+ cp->startline = 0;
+
+ /*
+ * Clear out the hold space.
+ */
+ cspace(&HS, "", 0, REPLACE);
+}
+
+/*
+ * substitute --
+ * Do substitutions in the pattern space. Currently, we build a
+ * copy of the new pattern space in the substitute space structure
+ * and then swap them.
+ */
+static int
+substitute(struct s_command *cp)
+{
+ SPACE tspace;
+ regex_t *re;
+ regoff_t slen;
+ int lastempty, n;
+ size_t le = 0;
+ char *s;
+
+ s = ps;
+ re = cp->u.s->re;
+ if (re == NULL) {
+ if (defpreg != NULL && cp->u.s->maxbref > defpreg->re_nsub) {
+ linenum = cp->u.s->linenum;
+ errx(1, "%lu: %s: \\%u not defined in the RE",
+ linenum, fname, cp->u.s->maxbref);
+ }
+ }
+ if (!regexec_e(re, ps, 0, 0, 0, psl))
+ return (0);
+
+ SS.len = 0; /* Clean substitute space. */
+ slen = psl;
+ n = cp->u.s->n;
+ lastempty = 1;
+
+ do {
+ /* Copy the leading retained string. */
+ if (n <= 1 && (match[0].rm_so > le))
+ cspace(&SS, s, match[0].rm_so - le, APPEND);
+
+ /* Skip zero-length matches right after other matches. */
+ if (lastempty || (match[0].rm_so - le) ||
+ match[0].rm_so != match[0].rm_eo) {
+ if (n <= 1) {
+ /* Want this match: append replacement. */
+ regsub(&SS, ps, cp->u.s->new);
+ if (n == 1)
+ n = -1;
+ } else {
+ /* Want a later match: append original. */
+ if (match[0].rm_eo - le)
+ cspace(&SS, s, match[0].rm_eo - le,
+ APPEND);
+ n--;
+ }
+ }
+
+ /* Move past this match. */
+ s = ps + match[0].rm_eo;
+ slen = psl - match[0].rm_eo;
+ le = match[0].rm_eo;
+
+ /*
+ * After a zero-length match, advance one byte,
+ * and at the end of the line, terminate.
+ */
+ if (match[0].rm_so == match[0].rm_eo) {
+ if (*s == '\0' || *s == '\n')
+ slen = -1;
+ else
+ slen--;
+ if (*s != '\0') {
+ cspace(&SS, s++, 1, APPEND);
+ le++;
+ }
+ lastempty = 1;
+ } else
+ lastempty = 0;
+
+ } while (n >= 0 && slen >= 0 &&
+ regexec_e(re, ps, REG_NOTBOL, 0, le, psl));
+
+ /* Did not find the requested number of matches. */
+ if (n > 1)
+ return (0);
+
+ /* Copy the trailing retained string. */
+ if (slen > 0)
+ cspace(&SS, s, slen, APPEND);
+
+ /*
+ * Swap the substitute space and the pattern space, and make sure
+ * that any leftover pointers into stdio memory get lost.
+ */
+ tspace = PS;
+ PS = SS;
+ psanl = tspace.append_newline;
+ SS = tspace;
+ SS.space = SS.back;
+
+ /* Handle the 'p' flag. */
+ if (cp->u.s->p)
+ OUT();
+
+ /* Handle the 'w' flag. */
+ if (cp->u.s->wfile && !pd) {
+ if (cp->u.s->wfd == -1 && (cp->u.s->wfd = open(cp->u.s->wfile,
+ O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1)
+ err(1, "%s", cp->u.s->wfile);
+ if (write(cp->u.s->wfd, ps, psl) != (ssize_t)psl ||
+ write(cp->u.s->wfd, "\n", 1) != 1)
+ err(1, "%s", cp->u.s->wfile);
+ }
+ return (1);
+}
+
+/*
+ * do_tr --
+ * Perform translation ('y' command) in the pattern space.
+ */
+static void
+do_tr(struct s_tr *y)
+{
+ SPACE tmp;
+ char c, *p;
+ size_t clen, left;
+ int i;
+
+ if (MB_CUR_MAX == 1) {
+ /*
+ * Single-byte encoding: perform in-place translation
+ * of the pattern space.
+ */
+ for (p = ps; p < &ps[psl]; p++)
+ *p = y->bytetab[(u_char)*p];
+ } else {
+ /*
+ * Multi-byte encoding: perform translation into the
+ * translation space, then swap the translation and
+ * pattern spaces.
+ */
+ /* Clean translation space. */
+ YS.len = 0;
+ for (p = ps, left = psl; left > 0; p += clen, left -= clen) {
+ if ((c = y->bytetab[(u_char)*p]) != '\0') {
+ cspace(&YS, &c, 1, APPEND);
+ clen = 1;
+ continue;
+ }
+ for (i = 0; i < y->nmultis; i++)
+ if (left >= y->multis[i].fromlen &&
+ memcmp(p, y->multis[i].from,
+ y->multis[i].fromlen) == 0)
+ break;
+ if (i < y->nmultis) {
+ cspace(&YS, y->multis[i].to,
+ y->multis[i].tolen, APPEND);
+ clen = y->multis[i].fromlen;
+ } else {
+ cspace(&YS, p, 1, APPEND);
+ clen = 1;
+ }
+ }
+ /* Swap the translation space and the pattern space. */
+ tmp = PS;
+ PS = YS;
+ psanl = tmp.append_newline;
+ YS = tmp;
+ YS.space = YS.back;
+ }
+}
+
+/*
+ * Flush append requests. Always called before reading a line,
+ * therefore it also resets the substitution done (sdone) flag.
+ */
+static void
+flush_appends(void)
+{
+ FILE *f;
+ int count, i;
+ char buf[8 * 1024];
+
+ for (i = 0; i < appendx; i++)
+ switch (appends[i].type) {
+ case AP_STRING:
+ fwrite(appends[i].s, sizeof(char), appends[i].len,
+ outfile);
+ break;
+ case AP_FILE:
+ /*
+ * Read files probably shouldn't be cached. Since
+ * it's not an error to read a non-existent file,
+ * it's possible that another program is interacting
+ * with the sed script through the filesystem. It
+ * would be truly bizarre, but possible. It's probably
+ * not that big a performance win, anyhow.
+ */
+ if ((f = fopen(appends[i].s, "r")) == NULL)
+ break;
+ while ((count = fread(buf, sizeof(char), sizeof(buf), f)))
+ (void)fwrite(buf, sizeof(char), count, outfile);
+ (void)fclose(f);
+ break;
+ }
+ if (ferror(outfile))
+ errx(1, "%s: %s", outfname, strerror(errno ? errno : EIO));
+ appendx = sdone = 0;
+}
+
+static void
+lputs(char *s, size_t len)
+{
+ static const char escapes[] = "\\\a\b\f\r\t\v";
+ int c, col, width;
+ const char *p;
+ struct winsize win;
+ static int termwidth = -1;
+ size_t clen, i;
+ wchar_t wc;
+ mbstate_t mbs;
+
+ if (outfile != stdout)
+ termwidth = 60;
+ if (termwidth == -1) {
+ if ((p = getenv("COLUMNS")) && *p != '\0')
+ termwidth = atoi(p);
+ else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
+ win.ws_col > 0)
+ termwidth = win.ws_col;
+ else
+ termwidth = 60;
+ }
+ if (termwidth <= 0)
+ termwidth = 1;
+
+ memset(&mbs, 0, sizeof(mbs));
+ col = 0;
+ while (len != 0) {
+ clen = mbrtowc(&wc, s, len, &mbs);
+ if (clen == 0)
+ clen = 1;
+ if (clen == (size_t)-1 || clen == (size_t)-2) {
+ wc = (unsigned char)*s;
+ clen = 1;
+ memset(&mbs, 0, sizeof(mbs));
+ }
+ if (wc == '\n') {
+ if (col + 1 >= termwidth)
+ fprintf(outfile, "\\\n");
+ fputc('$', outfile);
+ fputc('\n', outfile);
+ col = 0;
+ } else if (iswprint(wc)) {
+ width = wcwidth(wc);
+ if (col + width >= termwidth) {
+ fprintf(outfile, "\\\n");
+ col = 0;
+ }
+ fwrite(s, 1, clen, outfile);
+ col += width;
+ } else if (wc != L'\0' && (c = wctob(wc)) != EOF &&
+ (p = strchr(escapes, c)) != NULL) {
+ if (col + 2 >= termwidth) {
+ fprintf(outfile, "\\\n");
+ col = 0;
+ }
+ fprintf(outfile, "\\%c", "\\abfrtv"[p - escapes]);
+ col += 2;
+ } else {
+ if (col + 4 * clen >= (unsigned)termwidth) {
+ fprintf(outfile, "\\\n");
+ col = 0;
+ }
+ for (i = 0; i < clen; i++)
+ fprintf(outfile, "\\%03o",
+ (int)(unsigned char)s[i]);
+ col += 4 * clen;
+ }
+ s += clen;
+ len -= clen;
+ }
+ if (col + 1 >= termwidth)
+ fprintf(outfile, "\\\n");
+ (void)fputc('$', outfile);
+ (void)fputc('\n', outfile);
+ if (ferror(outfile))
+ errx(1, "%s: %s", outfname, strerror(errno ? errno : EIO));
+}
+
+static int
+regexec_e(regex_t *preg, const char *string, int eflags, int nomatch,
+ size_t start, size_t stop)
+{
+ int eval;
+
+ if (preg == NULL) {
+ if (defpreg == NULL)
+ errx(1, "first RE may not be empty");
+ } else
+ defpreg = preg;
+
+ /* Set anchors */
+ match[0].rm_so = start;
+ match[0].rm_eo = stop;
+
+ eval = regexec(defpreg, string,
+ nomatch ? 0 : maxnsub + 1, match, eflags | REG_STARTEND);
+ switch(eval) {
+ case 0:
+ return (1);
+ case REG_NOMATCH:
+ return (0);
+ }
+ errx(1, "RE error: %s", strregerror(eval, defpreg));
+ /* NOTREACHED */
+}
+
+/*
+ * regsub - perform substitutions after a regexp match
+ * Based on a routine by Henry Spencer
+ */
+static void
+regsub(SPACE *sp, char *string, char *src)
+{
+ int len, no;
+ char c, *dst;
+
+#define NEEDSP(reqlen) \
+ /* XXX What is the +1 for? */ \
+ if (sp->len + (reqlen) + 1 >= sp->blen) { \
+ sp->blen += (reqlen) + 1024; \
+ if ((sp->space = sp->back = realloc(sp->back, sp->blen)) \
+ == NULL) \
+ err(1, "realloc"); \
+ dst = sp->space + sp->len; \
+ }
+
+ dst = sp->space + sp->len;
+ while ((c = *src++) != '\0') {
+ if (c == '&')
+ no = 0;
+ else if (c == '\\' && isdigit((unsigned char)*src))
+ no = *src++ - '0';
+ else
+ no = -1;
+ if (no < 0) { /* Ordinary character. */
+ if (c == '\\' && (*src == '\\' || *src == '&'))
+ c = *src++;
+ NEEDSP(1);
+ *dst++ = c;
+ ++sp->len;
+ } else if (match[no].rm_so != -1 && match[no].rm_eo != -1) {
+ len = match[no].rm_eo - match[no].rm_so;
+ NEEDSP(len);
+ memmove(dst, string + match[no].rm_so, len);
+ dst += len;
+ sp->len += len;
+ }
+ }
+ NEEDSP(1);
+ *dst = '\0';
+}
+
+/*
+ * cspace --
+ * Concatenate space: append the source space to the destination space,
+ * allocating new space as necessary.
+ */
+void
+cspace(SPACE *sp, const char *p, size_t len, enum e_spflag spflag)
+{
+ size_t tlen;
+
+ /* Make sure SPACE has enough memory and ramp up quickly. */
+ tlen = sp->len + len + 1;
+ if (tlen > sp->blen) {
+ sp->blen = tlen + 1024;
+ if ((sp->space = sp->back = realloc(sp->back, sp->blen)) ==
+ NULL)
+ err(1, "realloc");
+ }
+
+ if (spflag == REPLACE)
+ sp->len = 0;
+
+ memmove(sp->space + sp->len, p, len);
+
+ sp->space[sp->len += len] = '\0';
+}
+
+/*
+ * Close all cached opened files and report any errors
+ */
+void
+cfclose(struct s_command *cp, struct s_command *end)
+{
+
+ for (; cp != end; cp = cp->next)
+ switch(cp->code) {
+ case 's':
+ if (cp->u.s->wfd != -1 && close(cp->u.s->wfd))
+ err(1, "%s", cp->u.s->wfile);
+ cp->u.s->wfd = -1;
+ break;
+ case 'w':
+ if (cp->u.fd != -1 && close(cp->u.fd))
+ err(1, "%s", cp->t);
+ cp->u.fd = -1;
+ break;
+ case '{':
+ cfclose(cp->u.c, cp->next);
+ break;
+ }
+}
diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
new file mode 100644
index 0000000..370a856
--- /dev/null
+++ b/usr.bin/sed/sed.1
@@ -0,0 +1,638 @@
+.\" Copyright (c) 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)sed.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd May 10, 2016
+.Dt SED 1
+.Os
+.Sh NAME
+.Nm sed
+.Nd stream editor
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ealnru
+.Ar command
+.Op Ar
+.Nm
+.Op Fl Ealnr
+.Op Fl e Ar command
+.Op Fl f Ar command_file
+.Op Fl I Ar extension
+.Op Fl i Ar extension
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility reads the specified files, or the standard input if no files
+are specified, modifying the input as specified by a list of commands.
+The input is then written to the standard output.
+.Pp
+A single command may be specified as the first argument to
+.Nm .
+Multiple commands may be specified by using the
+.Fl e
+or
+.Fl f
+options.
+All commands are applied to the input in the order they are specified
+regardless of their origin.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl E
+Interpret regular expressions as extended (modern) regular expressions
+rather than basic regular expressions (BRE's).
+The
+.Xr re_format 7
+manual page fully describes both formats.
+.It Fl a
+The files listed as parameters for the
+.Dq w
+functions are created (or truncated) before any processing begins,
+by default.
+The
+.Fl a
+option causes
+.Nm
+to delay opening each file until a command containing the related
+.Dq w
+function is applied to a line of input.
+.It Fl e Ar command
+Append the editing commands specified by the
+.Ar command
+argument
+to the list of commands.
+.It Fl f Ar command_file
+Append the editing commands found in the file
+.Ar command_file
+to the list of commands.
+The editing commands should each be listed on a separate line.
+.It Fl I Ar extension
+Edit files in-place, saving backups with the specified
+.Ar extension .
+If a zero-length
+.Ar extension
+is given, no backup will be saved.
+It is not recommended to give a zero-length
+.Ar extension
+when in-place editing files, as you risk corruption or partial content
+in situations where disk space is exhausted, etc.
+.Pp
+Note that in-place editing with
+.Fl I
+still takes place in a single continuous line address space covering
+all files, although each file preserves its individuality instead of
+forming one output stream.
+The line counter is never reset between files, address ranges can span
+file boundaries, and the
+.Dq $
+address matches only the last line of the last file.
+(See
+.Sx "Sed Addresses" . )
+That can lead to unexpected results in many cases of in-place editing,
+where using
+.Fl i
+is desired.
+.It Fl i Ar extension
+Edit files in-place similarly to
+.Fl I ,
+but treat each file independently from other files.
+In particular, line numbers in each file start at 1,
+the
+.Dq $
+address matches the last line of the current file,
+and address ranges are limited to the current file.
+(See
+.Sx "Sed Addresses" . )
+The net result is as though each file were edited by a separate
+.Nm
+instance.
+.It Fl l
+Make output line buffered.
+.It Fl n
+By default, each line of input is echoed to the standard output after
+all of the commands have been applied to it.
+The
+.Fl n
+option suppresses this behavior.
+.It Fl r
+Same as
+.Fl E
+for compatibility with GNU sed.
+.It Fl u
+Make output unbuffered.
+.El
+.Pp
+The form of a
+.Nm
+command is as follows:
+.Pp
+.Dl [address[,address]]function[arguments]
+.Pp
+Whitespace may be inserted before the first address and the function
+portions of the command.
+.Pp
+Normally,
+.Nm
+cyclically copies a line of input, not including its terminating newline
+character, into a
+.Em "pattern space" ,
+(unless there is something left after a
+.Dq D
+function),
+applies all of the commands with addresses that select that pattern space,
+copies the pattern space to the standard output, appending a newline, and
+deletes the pattern space.
+.Pp
+Some of the functions use a
+.Em "hold space"
+to save all or part of the pattern space for subsequent retrieval.
+.Sh "Sed Addresses"
+An address is not required, but if specified must have one of the
+following formats:
+.Bl -bullet -offset indent
+.It
+a number that counts
+input lines
+cumulatively across input files (or in each file independently
+if a
+.Fl i
+option is in effect);
+.It
+a dollar
+.Pq Dq $
+character that addresses the last line of input (or the last line
+of the current file if a
+.Fl i
+option was specified);
+.It
+a context address
+that consists of a regular expression preceded and followed by a
+delimiter. The closing delimiter can also optionally be followed by the
+.Dq I
+character, to indicate that the regular expression is to be matched
+in a case-insensitive way.
+.El
+.Pp
+A command line with no addresses selects every pattern space.
+.Pp
+A command line with one address selects all of the pattern spaces
+that match the address.
+.Pp
+A command line with two addresses selects an inclusive range.
+This
+range starts with the first pattern space that matches the first
+address.
+The end of the range is the next following pattern space
+that matches the second address.
+If the second address is a number
+less than or equal to the line number first selected, only that
+line is selected.
+The number in the second address may be prefixed with a
+.Pq Dq \&+
+to specify the number of lines to match after the first pattern.
+In the case when the second address is a context
+address,
+.Nm
+does not re-match the second address against the
+pattern space that matched the first address.
+Starting at the
+first line following the selected range,
+.Nm
+starts looking again for the first address.
+.Pp
+Editing commands can be applied to non-selected pattern spaces by use
+of the exclamation character
+.Pq Dq \&!
+function.
+.Sh "Sed Regular Expressions"
+The regular expressions used in
+.Nm ,
+by default, are basic regular expressions (BREs, see
+.Xr re_format 7
+for more information), but extended (modern) regular expressions can be used
+instead if the
+.Fl E
+flag is given.
+In addition,
+.Nm
+has the following two additions to regular expressions:
+.Pp
+.Bl -enum -compact
+.It
+In a context address, any character other than a backslash
+.Pq Dq \e
+or newline character may be used to delimit the regular expression.
+The opening delimiter needs to be preceded by a backslash
+unless it is a slash.
+For example, the context address
+.Li \exabcx
+is equivalent to
+.Li /abc/ .
+Also, putting a backslash character before the delimiting character
+within the regular expression causes the character to be treated literally.
+For example, in the context address
+.Li \exabc\exdefx ,
+the RE delimiter is an
+.Dq x
+and the second
+.Dq x
+stands for itself, so that the regular expression is
+.Dq abcxdef .
+.Pp
+.It
+The escape sequence \en matches a newline character embedded in the
+pattern space.
+You cannot, however, use a literal newline character in an address or
+in the substitute command.
+.El
+.Pp
+One special feature of
+.Nm
+regular expressions is that they can default to the last regular
+expression used.
+If a regular expression is empty, i.e., just the delimiter characters
+are specified, the last regular expression encountered is used instead.
+The last regular expression is defined as the last regular expression
+used as part of an address or substitute command, and at run-time, not
+compile-time.
+For example, the command
+.Dq /abc/s//XXX/
+will substitute
+.Dq XXX
+for the pattern
+.Dq abc .
+.Sh "Sed Functions"
+In the following list of commands, the maximum number of permissible
+addresses for each command is indicated by [0addr], [1addr], or [2addr],
+representing zero, one, or two addresses.
+.Pp
+The argument
+.Em text
+consists of one or more lines.
+To embed a newline in the text, precede it with a backslash.
+Other backslashes in text are deleted and the following character
+taken literally.
+.Pp
+The
+.Dq r
+and
+.Dq w
+functions take an optional file parameter, which should be separated
+from the function letter by white space.
+Each file given as an argument to
+.Nm
+is created (or its contents truncated) before any input processing begins.
+.Pp
+The
+.Dq b ,
+.Dq r ,
+.Dq s ,
+.Dq t ,
+.Dq w ,
+.Dq y ,
+.Dq \&! ,
+and
+.Dq \&:
+functions all accept additional arguments.
+The following synopses indicate which arguments have to be separated from
+the function letters by white space characters.
+.Pp
+Two of the functions take a function-list.
+This is a list of
+.Nm
+functions separated by newlines, as follows:
+.Bd -literal -offset indent
+{ function
+ function
+ ...
+ function
+}
+.Ed
+.Pp
+The
+.Dq {
+can be preceded by white space and can be followed by white space.
+The function can be preceded by white space.
+The terminating
+.Dq }
+must be preceded by a newline, and may also be preceded by white space.
+.Pp
+.Bl -tag -width "XXXXXX" -compact
+.It [2addr] function-list
+Execute function-list only when the pattern space is selected.
+.Pp
+.It [1addr]a\e
+.It text
+Write
+.Em text
+to standard output immediately before each attempt to read a line of input,
+whether by executing the
+.Dq N
+function or by beginning a new cycle.
+.Pp
+.It [2addr]b[label]
+Branch to the
+.Dq \&:
+function with the specified label.
+If the label is not specified, branch to the end of the script.
+.Pp
+.It [2addr]c\e
+.It text
+Delete the pattern space.
+With 0 or 1 address or at the end of a 2-address range,
+.Em text
+is written to the standard output.
+.Pp
+.It [2addr]d
+Delete the pattern space and start the next cycle.
+.Pp
+.It [2addr]D
+Delete the initial segment of the pattern space through the first
+newline character and start the next cycle.
+.Pp
+.It [2addr]g
+Replace the contents of the pattern space with the contents of the
+hold space.
+.Pp
+.It [2addr]G
+Append a newline character followed by the contents of the hold space
+to the pattern space.
+.Pp
+.It [2addr]h
+Replace the contents of the hold space with the contents of the
+pattern space.
+.Pp
+.It [2addr]H
+Append a newline character followed by the contents of the pattern space
+to the hold space.
+.Pp
+.It [1addr]i\e
+.It text
+Write
+.Em text
+to the standard output.
+.Pp
+.It [2addr]l
+(The letter ell.)
+Write the pattern space to the standard output in a visually unambiguous
+form.
+This form is as follows:
+.Pp
+.Bl -tag -width "carriage-returnXX" -offset indent -compact
+.It backslash
+\e\e
+.It alert
+\ea
+.It form-feed
+\ef
+.It carriage-return
+\er
+.It tab
+\et
+.It vertical tab
+\ev
+.El
+.Pp
+Nonprintable characters are written as three-digit octal numbers (with a
+preceding backslash) for each byte in the character (most significant byte
+first).
+Long lines are folded, with the point of folding indicated by displaying
+a backslash followed by a newline.
+The end of each line is marked with a
+.Dq $ .
+.Pp
+.It [2addr]n
+Write the pattern space to the standard output if the default output has
+not been suppressed, and replace the pattern space with the next line of
+input.
+.Pp
+.It [2addr]N
+Append the next line of input to the pattern space, using an embedded
+newline character to separate the appended material from the original
+contents.
+Note that the current line number changes.
+.Pp
+.It [2addr]p
+Write the pattern space to standard output.
+.Pp
+.It [2addr]P
+Write the pattern space, up to the first newline character to the
+standard output.
+.Pp
+.It [1addr]q
+Branch to the end of the script and quit without starting a new cycle.
+.Pp
+.It [1addr]r file
+Copy the contents of
+.Em file
+to the standard output immediately before the next attempt to read a
+line of input.
+If
+.Em file
+cannot be read for any reason, it is silently ignored and no error
+condition is set.
+.Pp
+.It [2addr]s/regular expression/replacement/flags
+Substitute the replacement string for the first instance of the regular
+expression in the pattern space.
+Any character other than backslash or newline can be used instead of
+a slash to delimit the RE and the replacement.
+Within the RE and the replacement, the RE delimiter itself can be used as
+a literal character if it is preceded by a backslash.
+.Pp
+An ampersand
+.Pq Dq &
+appearing in the replacement is replaced by the string matching the RE.
+The special meaning of
+.Dq &
+in this context can be suppressed by preceding it by a backslash.
+The string
+.Dq \e# ,
+where
+.Dq #
+is a digit, is replaced by the text matched
+by the corresponding backreference expression (see
+.Xr re_format 7 ) .
+.Pp
+A line can be split by substituting a newline character into it.
+To specify a newline character in the replacement string, precede it with
+a backslash.
+.Pp
+The value of
+.Em flags
+in the substitute function is zero or more of the following:
+.Bl -tag -width "XXXXXX" -offset indent
+.It Ar N
+Make the substitution only for the
+.Ar N Ns 'th
+occurrence of the regular expression in the pattern space.
+.It g
+Make the substitution for all non-overlapping matches of the
+regular expression, not just the first one.
+.It p
+Write the pattern space to standard output if a replacement was made.
+If the replacement string is identical to that which it replaces, it
+is still considered to have been a replacement.
+.It w Em file
+Append the pattern space to
+.Em file
+if a replacement was made.
+If the replacement string is identical to that which it replaces, it
+is still considered to have been a replacement.
+.It i or I
+Match the regular expression in a case-insensitive way.
+.El
+.Pp
+.It [2addr]t [label]
+Branch to the
+.Dq \&:
+function bearing the label if any substitutions have been made since the
+most recent reading of an input line or execution of a
+.Dq t
+function.
+If no label is specified, branch to the end of the script.
+.Pp
+.It [2addr]w Em file
+Append the pattern space to the
+.Em file .
+.Pp
+.It [2addr]x
+Swap the contents of the pattern and hold spaces.
+.Pp
+.It [2addr]y/string1/string2/
+Replace all occurrences of characters in
+.Em string1
+in the pattern space with the corresponding characters from
+.Em string2 .
+Any character other than a backslash or newline can be used instead of
+a slash to delimit the strings.
+Within
+.Em string1
+and
+.Em string2 ,
+a backslash followed by any character other than a newline is that literal
+character, and a backslash followed by an ``n'' is replaced by a newline
+character.
+.Pp
+.It [2addr]!function
+.It [2addr]!function-list
+Apply the function or function-list only to the lines that are
+.Em not
+selected by the address(es).
+.Pp
+.It [0addr]:label
+This function does nothing; it bears a label to which the
+.Dq b
+and
+.Dq t
+commands may branch.
+.Pp
+.It [1addr]=
+Write the line number to the standard output followed by a newline
+character.
+.Pp
+.It [0addr]
+Empty lines are ignored.
+.Pp
+.It [0addr]#
+The
+.Dq #
+and the remainder of the line are ignored (treated as a comment), with
+the single exception that if the first two characters in the file are
+.Dq #n ,
+the default output is suppressed.
+This is the same as specifying the
+.Fl n
+option on the command line.
+.El
+.Sh ENVIRONMENT
+The
+.Ev COLUMNS , LANG , LC_ALL , LC_CTYPE
+and
+.Ev LC_COLLATE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr awk 1 ,
+.Xr ed 1 ,
+.Xr grep 1 ,
+.Xr regex 3 ,
+.Xr re_format 7
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be a superset of the
+.St -p1003.2
+specification.
+.Pp
+The
+.Fl E , I , a
+and
+.Fl i
+options, the prefixing
+.Dq \&+
+in the second member of an address range,
+as well as the
+.Dq I
+flag to the address regular expression and substitution command are
+non-standard
+.Fx
+extensions and may not be available on other operating systems.
+.Sh HISTORY
+A
+.Nm
+command, written by
+.An L. E. McMahon ,
+appeared in
+.At v7 .
+.Sh AUTHORS
+.An Diomidis D. Spinellis Aq Mt dds@FreeBSD.org
+.Sh BUGS
+Multibyte characters containing a byte with value 0x5C
+.Tn ( ASCII
+.Ql \e )
+may be incorrectly treated as line continuation characters in arguments to the
+.Dq a ,
+.Dq c
+and
+.Dq i
+commands.
+Multibyte characters cannot be used as delimiters with the
+.Dq s
+and
+.Dq y
+commands.
diff --git a/usr.bin/sed/tests/Makefile b/usr.bin/sed/tests/Makefile
new file mode 100644
index 0000000..0d017e1
--- /dev/null
+++ b/usr.bin/sed/tests/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+TAP_TESTS_SH+= multi_test
+TEST_METADATA.multi_test+= required_files="/usr/share/dict/words"
+TAP_TESTS_SH+= inplace_race_test
+
+${PACKAGE}FILES+= hanoi.sed
+${PACKAGE}FILES+= math.sed
+${PACKAGE}FILES+= regress.G.out
+${PACKAGE}FILES+= regress.P.out
+${PACKAGE}FILES+= regress.b2a.out
+${PACKAGE}FILES+= regress.bcb.out
+${PACKAGE}FILES+= regress.c0.out
+${PACKAGE}FILES+= regress.c1.out
+${PACKAGE}FILES+= regress.c2.out
+${PACKAGE}FILES+= regress.c3.out
+${PACKAGE}FILES+= regress.hanoi.out
+${PACKAGE}FILES+= regress.icase1.out
+${PACKAGE}FILES+= regress.icase2.out
+${PACKAGE}FILES+= regress.icase3.out
+${PACKAGE}FILES+= regress.icase4.out
+${PACKAGE}FILES+= regress.in
+${PACKAGE}FILES+= regress.math.out
+${PACKAGE}FILES+= regress.not.out
+${PACKAGE}FILES+= regress.psl.out
+${PACKAGE}FILES+= regress.s3.out
+${PACKAGE}FILES+= regress.s4.out
+${PACKAGE}FILES+= regress.s5.out
+${PACKAGE}FILES+= regress.sg.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.y.out
+
+SUBDIR= regress.multitest.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/sed/tests/Makefile.depend b/usr.bin/sed/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/sed/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/sed/tests/hanoi.sed b/usr.bin/sed/tests/hanoi.sed
new file mode 100644
index 0000000..6a45dea
--- /dev/null
+++ b/usr.bin/sed/tests/hanoi.sed
@@ -0,0 +1,103 @@
+# Towers of Hanoi in sed.
+#
+# @(#)hanoi.sed 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+#
+#
+# Ex:
+# Run "sed -f hanoi.sed", and enter:
+#
+# :abcd: : :<CR>
+#
+# note -- TWO carriage returns were once required, this will output the
+# sequence of states involved in moving 4 rings, the largest called "a" and
+# the smallest called "d", from the first to the second of three towers, so
+# that the rings on any tower at any time are in descending order of size.
+# You can start with a different arrangement and a different number of rings,
+# say :ce:b:ax: and it will give the shortest procedure for moving them all
+# to the middle tower. The rules are: the names of the rings must all be
+# lower-case letters, they must be input within 3 fields (representing the
+# towers) and delimited by 4 colons, such that the letters within each field
+# are in alphabetical order (i.e. rings are in descending order of size).
+#
+# For the benefit of anyone who wants to figure out the script, an "internal"
+# line of the form
+# b:0abx:1a2b3 :2 :3x2
+# has the following meaning: the material after the three markers :1, :2,
+# and :3 represents the three towers; in this case the current set-up is
+# ":ab : :x :". The numbers after a, b and x in these fields indicate
+# that the next time it gets a chance, it will move a to tower 2, move b
+# to tower 3, and move x to tower 2. The string after :0 just keeps track
+# of the alphabetical order of the names of the rings. The b at the
+# beginning means that it is now dealing with ring b (either about to move
+# it, or re-evaluating where it should next be moved to).
+#
+# Although this version is "limited" to 26 rings because of the size of the
+# alphabet, one could write a script using the same idea in which the rings
+# were represented by arbitrary [strings][within][brackets], and in place of
+# the built-in line of the script giving the order of the letters of the
+# alphabet, it would accept from the user a line giving the ordering to be
+# assumed, e.g. [ucbvax][decvax][hplabs][foo][bar].
+#
+# George Bergman
+# Math, UC Berkeley 94720 USA
+
+# cleaning, diagnostics
+s/ *//g
+/^$/d
+/[^a-z:]/{a\
+Illegal characters: use only a-z and ":". Try again.
+d
+}
+/^:[a-z]*:[a-z]*:[a-z]*:$/!{a\
+Incorrect format: use\
+\ : string1 : string2 : string3 :<CR>\
+Try again.
+d
+}
+/\([a-z]\).*\1/{a\
+Repeated letters not allowed. Try again.
+d
+}
+# initial formatting
+h
+s/[a-z]/ /g
+G
+s/^:\( *\):\( *\):\( *\):\n:\([a-z]*\):\([a-z]*\):\([a-z]*\):$/:1\4\2\3:2\5\1\3:3\6\1\2:0/
+s/[a-z]/&2/g
+s/^/abcdefghijklmnopqrstuvwxyz/
+:a
+s/^\(.\).*\1.*/&\1/
+s/.//
+/^[^:]/ba
+s/\([^0]*\)\(:0.*\)/\2\1:/
+s/^[^0]*0\(.\)/\1&/
+:b
+# outputting current state without markers
+h
+s/.*:1/:/
+s/[123]//gp
+g
+:c
+# establishing destinations
+/^\(.\).*\1:1/td
+/^\(.\).*:1[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
+/^\(.\).*:1[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
+/^\(.\).*:1[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
+/^\(.\).*:2[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
+/^\(.\).*:2[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
+/^\(.\).*:2[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
+/^\(.\).*:3[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
+/^\(.\).*:3[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
+/^\(.\).*:3[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
+bc
+# iterate back to find smallest out-of-place ring
+:d
+s/^\(.\)\(:0[^:]*\([^:]\)\1.*:\([123]\)[^:]*\1\)\4/\3\2\4/
+td
+# move said ring (right, resp. left)
+s/^\(.\)\(.*\)\1\([23]\)\(.*:\3[^ ]*\) /\1\2 \4\1\3/
+s/^\(.\)\(.*:\([12]\)[^ ]*\) \(.*\)\1\3/\1\2\1\3\4 /
+tb
+s/.*/Done! Try another, or end with ^D./p
+d
diff --git a/usr.bin/sed/tests/inplace_race_test.sh b/usr.bin/sed/tests/inplace_race_test.sh
new file mode 100644
index 0000000..d8220ae
--- /dev/null
+++ b/usr.bin/sed/tests/inplace_race_test.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+#-
+# Copyright (c) 2011 Jilles Tjoelker
+# 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$
+
+: "${SED=sed}"
+
+# This test really needs an SMP system. On an UP system, it will
+# usually pass even if the race condition exists.
+if command -v cpuset >/dev/null; then
+ case `cpuset -g -p $$` in
+ *,*) ;;
+ *)
+ echo '1..0 # Skipped: not an SMP system'
+ exit 0 ;;
+ esac
+fi
+
+echo "1..1"
+
+data=abababab
+data=$data$data$data$data
+data=$data$data$data$data
+data=$data$data$data$data
+data=$data$data$data$data
+data="BEGIN
+$data
+END"
+for i in 0 1 2 3 4 5 6 7 8 9; do
+ echo "$data" >file$i
+done
+len=${#data}
+
+i=0
+while [ $i -lt 100 ]; do
+ ${SED} -i.prev "s/$i/ab/" file[0-9]
+ i=$((i+1))
+done &
+sedproc=$!
+
+while :; do
+ set -- file[0-9]
+ if [ $# -ne 10 ]; then
+ echo "not ok 1 inplace_race"
+ exit 3
+ fi
+done &
+checkproc=$!
+
+wait $sedproc
+kill $checkproc 2>/dev/null
+wait $checkproc >/dev/null 2>&1
+if [ $? -ne 3 ]; then
+ echo "ok 1 inplace_race"
+fi
diff --git a/usr.bin/sed/tests/legacy_test.sh b/usr.bin/sed/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/sed/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/sed/tests/math.sed b/usr.bin/sed/tests/math.sed
new file mode 100644
index 0000000..8c8de37
--- /dev/null
+++ b/usr.bin/sed/tests/math.sed
@@ -0,0 +1,439 @@
+# This is ksb's infamous sed calculator. (ksb@sa.fedex.com)
+#
+# $FreeBSD$
+#
+# $Id: math.sed,v 2.5 1998/08/02 13:23:34 ksb Exp ksb $
+# expr ::= (expr) | expr! |
+# expr ^ expr |
+# -expr | expr * expr | expr / expr | expr % expr |
+# expr + expr | expr - expr |
+# [0-9][0-9]* ;
+# Bugs: some sign combinations don't work, and I got sick of added cases
+# for unary +. Don't depend on signed math working all the time. -- ksb
+#
+# $Compile: echo "4+7*3+2^7/3" | sed -f %f
+
+# make sure the expression is well formed
+s/[ ]//g
+/[*\/^%+-]$/{
+ a\
+ poorly formed expression, dyadic operator on the end
+ q
+}
+/^[*\/^%]/{
+ a\
+ poorly formed expression, leading dyadic operator
+ q
+}
+
+# fill hold space with done token
+x
+s/^.*/done/
+x
+
+# main loop, process operators ((), !, *, /, %, +, and -)
+: loop
+# uncomment the print below to follow the "logic" -- ksb
+#p
+/^[+]/{
+ s///
+ b loop
+}
+/^--/{
+ s///
+ b loop
+}
+# eval parenthesised sub expressions first
+/^\(.*\)(\([^)]*\))\(.*\)$/{
+ H
+ s//\2/
+ x
+ s/^\(.*\)\n\(.*\)(\([^()]*\))\(.*\)$/()\2@\4@\1/
+ x
+ b loop
+}
+# reduce a^b^c -> a^(b^c)
+/\([0-9][0-9]*^\)\([0-9][0-9]*^[0-9][0-9^]*\)/{
+ s//\1(\2)/
+ b loop
+}
+# pull any buried exponents
+/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)$/{
+ s//\1(\2)/
+ b loop
+}
+/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{
+ s//\1(\2)\3/
+ b loop
+}
+/^\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{
+ s//(\1)\2/
+ b loop
+}
+/^\([-]*[0-9]*\)^0*$/{
+ s//1/
+ b loop
+}
+/^\([-]*[0-9]*\)^0*1$/{
+ s//\1/
+ b loop
+}
+/^\([-]*[0-9]*\)^-[0-9]*$/{
+ s//0/
+ b loop
+}
+/^\([-]*\)\([0-9]*\)^\([0-9][0-9]*[13579]\)$/{
+ s//\1\2*((\2*\2)^(\3\/2))/
+ b loop
+}
+/^[-]*\([0-9]*\)^\([0-9][0-9]*[02468]\)$/{
+ s//(\1*\1)^(\2\/2)/
+ b loop
+}
+# single digit powers (2 3,9 4,6,8 5,7
+/^[-]*\([0-9]*\)^0*2$/{
+ s//(\1*\1)/
+ b loop
+}
+/^\([-]*\)\([0-9]*\)^0*\([39]\)$/{
+ s//\1(\2*(\2*\2))^(\3\/3)/
+ b loop
+}
+/^[-]*\([0-9]*\)^0*\([468]\)$/{
+ s//(\1*\1)^(\2\/2)/
+ b loop
+}
+# 5 7
+/^\([-]*[0-9]*\)^\([0-9]*\)$/{
+ s//\1*(\1^(\2-1))/
+ b loop
+}
+# reduce all number factorials
+/^0*[01]!/{
+ s//1/
+ b loop
+}
+/\([*+-/%^]\)0*[01]!/{
+ s//\11/
+ b loop
+}
+/\([0-9]*\)!/{
+ s//(\1-1)!*\1/
+ b loop
+}
+# sign simplifications
+/^-\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{
+ s//\1\2\3/
+ b loop
+}
+/^\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{
+ s//-\1\2\3/
+ b loop
+}
+/^-\([0-9][0-9]*\)[+]*-\([0-9][0-9]*\)$/{
+ s//\1+\2/
+ x
+ s/\(.*\)/()-@@\1/
+ x
+ b loop
+}
+/^-\([0-9]*\)[+]\([0-9]\)*$/{
+ s//\2-\1/
+ b loop
+}
+/^-.*[-+*/%].*/{
+ H
+ s/^-//
+ x
+ s/^\(.*\)\n-.*$/()-@@\1/
+ x
+ b loop
+}
+# can we simplify multiplications
+/^\([0-9]*\)\([*][0-9]*[1-9]\)00*$/{
+ H
+ s//\1\2/
+ x
+ s/^\(.*\)\n[0-9]*[*][0-9]*[1-9]\(00*\)$/()@\2@\1/
+ x
+ b loop
+}
+/^\([0-9][1-9]*\)00*\([*][0-9]*\)$/{
+ H
+ s//\1\2/
+ x
+ s/^\(.*\)\n[0-9][1-9]*\(00*\)[*][0-9]*$/()@\2@\1/
+ x
+ b loop
+}
+# can we simplify division (20/30 -> 2/3)
+/^\([0-9][0-9]*\)0\([/%]\)\([0-9][0-9]*\)0$/{
+ s//\1\2\3/
+ b loop
+}
+# n/1 -> n
+/^0*\([0-9][0-9]*\)0[/]0*1$/{
+ s//\1/
+ b loop
+}
+# n%2 -> last_digit(n)%2 (same for 1, BTW) N.B. NO LOOP
+/^[0-9]*\([0-9]\)%0*\([12]\)$/{
+ s//\1%\2/
+}
+# move any mul/divs to the front via parans
+/^\([0-9+]*\)\([-+]\)\([0-9]*[*/][0-9*/]*\)/{
+ s//\1\2(\3)/
+ b loop
+}
+# can we div or mul
+/^[0-9]*[*][0-9]*$/{
+ b mul
+}
+/^[0-9]*[/%]0*$/{
+ i\
+divide by zero
+ d
+}
+/^[0-9]*[/%][0-9]*$/{
+ H
+ s/\([0-9]\).*[/%]/\1-/
+ x
+ s/^\(.*\)\n\([0-9]\)\([0-9]*\)\([/%]\)\([0-9]*\).*$/.\4\3q0r\2-\5@\1/
+ x
+ b loop
+}
+/^\([0-9]*[*/%][0-9]*\)\(.*\)/{
+ H
+ s//\1/
+ x
+ s/^\(.*\)\n\([0-9]*[*/][0-9]*\)\(.*\)$/()@\3@\1/
+ x
+ b loop
+}
+# can we add or subtract -- note subtract hold expression for underflow
+/^[0-9]*[+][0-9]*$/{
+ s/$/=/
+ b add
+}
+/^[0-9][0-9]*-[0-9]*$/{
+ H
+ s/$/=/
+ b sub
+}
+/^\([0-9][0-9]*[-+][0-9]*\)\(.*\)/{
+ H
+ s//\1/
+ x
+ s/^\(.*\)\n\([0-9]*[-+][0-9]*\)\(.*\)$/()@\3@\1/
+ x
+ b loop
+}
+# look in hold space for stack to reduce
+x
+/^done$/{
+ x
+ s/^0*\([0-9][0-9]*\)/\1/
+ p
+ d
+}
+# .[/%] numerator q quotient r remainder-divisor @stack
+/^\./{
+ x
+ /^[^-]/{
+ H
+ x
+ s/.\(.\)\([0-9]*\)q\([^r]*\)r\([0-9]*\)-\([0-9]*\)@\(.*\)\n\(.*\)/.\1\2q\3+1r\7-\5@\6/
+ h
+ s/..[0-9]*q[^r]*r\([0-9]*-[0-9]*\)@.*/\1/
+ b loop
+ }
+ /^-/{
+ g
+ /.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([^@]*\)@.*/{
+ s//\5\2-\6/
+ x
+ s/.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([0-9]*\)@\(.*\)/.\1\3q(\4)*10r\5\2-\6@\7/
+ x
+ b loop
+ }
+# no digits to shift on
+ s/^\.[/]q\([^r]*\)r[^@]*@.*/\1/
+ s/^\.[%]q[^r]*r0*\([0-9][0-9]*\)-[^@]*@.*/\1/
+ /^\./{
+ i\
+divide error
+ q
+ }
+ x
+ s/^\.[/%]q[^r]*r[^@]*@\(.*\)/\1/
+ x
+ b loop
+ }
+}
+/^()/{
+ s///
+ x
+ G
+ s/\(.*\)\n\([^@]*\)@\([^@]*\)@\(.*\)/\2\1\3/
+ x
+ s/[^@]*@[^@]*@\(.*\)/\1/
+ x
+ b loop
+}
+i\
+help, stack problem - the hold space
+p
+x
+i\
+and the pat space
+p
+i\
+quit
+q
+
+# turn mul into add until 1*x -> x, 0*x -> 0
+: mul
+/^00*\*.*/{
+ s//0/
+ b loop
+}
+/^0*1\*/{
+ s///
+: leading
+ s/^0*\([0-9][0-9]*\)/\1/
+ b loop
+}
+s/^\([0-9]*\)0\*\([0-9]*\)/\1*\20/
+s/^\([0-9]*\)1\*\([0-9]*\)/\1*\20+\2/
+s/^\([0-9]*\)2\*\([0-9]*\)/\1*\20+(\2+\2)/
+s/^\([0-9]*\)3\*\([0-9]*\)/\1*\20+(\2+\2+\2)/
+s/^\([0-9]*\)4\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2)/
+s/^\([0-9]*\)5\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2)/
+s/^\([0-9]*\)6\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2)/
+s/^\([0-9]*\)7\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2)/
+s/^\([0-9]*\)8\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2)/
+s/^\([0-9]*\)9\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2+\2)/
+/^0*\*[0-9]*[+]*\(.*\)/{
+ s//\1/
+ b loop
+}
+b mul
+
+# get rid of a plus term until 0+x -> x
+: add
+/^[+]\([0-9+*]*\)=/{
+ s//\1/
+ b leading
+}
+/^\([0-9*]*\)[+]=/{
+ s//\1/
+ b loop
+}
+/^\([0-9]*\)0[+]\([0-9]*\)\([0-9]\)=/{
+ s//\1+\2=\3/
+ b add
+}
+/^\([0-9]*\)\([0-9]\)[+]\([0-9]*\)0=/{
+ s//\1+\3=\2/
+ b add
+}
+s/^\([0-9]*\)1[+]/\10+/
+s/^\([0-9]*\)2[+]/\11+/
+s/^\([0-9]*\)3[+]/\12+/
+s/^\([0-9]*\)4[+]/\13+/
+s/^\([0-9]*\)5[+]/\14+/
+s/^\([0-9]*\)6[+]/\15+/
+s/^\([0-9]*\)7[+]/\16+/
+s/^\([0-9]*\)8[+]/\17+/
+s/^\([0-9]*\)9[+]/\18+/
+
+s/9=\([0-9]*\)$/_=\1/
+s/8=\([0-9]*\)$/9=\1/
+s/7=\([0-9]*\)$/8=\1/
+s/6=\([0-9]*\)$/7=\1/
+s/5=\([0-9]*\)$/6=\1/
+s/4=\([0-9]*\)$/5=\1/
+s/3=\([0-9]*\)$/4=\1/
+s/2=\([0-9]*\)$/3=\1/
+s/1=\([0-9]*\)$/2=\1/
+/_/{
+ s//_0/
+ : inc
+ s/9_/_0/
+ s/8_/9/
+ s/7_/8/
+ s/6_/7/
+ s/5_/6/
+ s/4_/5/
+ s/3_/4/
+ s/2_/3/
+ s/1_/2/
+ s/0_/1/
+ s/[+]_/+1/
+ /_/b inc
+}
+b add
+
+# get rid of a sub term until /-0*=/ or underflow
+: sub
+/^\([0-9]*\)-0*=/{
+ s//\1/
+ x
+ s/\(.*\)\n.*$/\1/
+ x
+ b leading
+}
+/^-\([0-9].*\)=/{
+: under
+ g
+ s/.*\n\([0-9]*\)-\([0-9]*\).*/-(\2-\1)/
+ x
+ s/\(.*\)\n.*/\1/
+ x
+ b loop
+}
+/^\([0-9]*\)\([0-9]\)-\([0-9]*\)0=/{
+ s//\1-\3=\2/
+ b sub
+}
+s/1=/0=/
+s/2=/1=/
+s/3=/2=/
+s/4=/3=/
+s/5=/4=/
+s/6=/5=/
+s/7=/6=/
+s/8=/7=/
+s/9=/8=/
+
+s/^\([0-9]*\)1-/\1_-/
+s/^\([0-9]*\)2-/\11-/
+s/^\([0-9]*\)3-/\12-/
+s/^\([0-9]*\)4-/\13-/
+s/^\([0-9]*\)5-/\14-/
+s/^\([0-9]*\)6-/\15-/
+s/^\([0-9]*\)7-/\16-/
+s/^\([0-9]*\)8-/\17-/
+s/^\([0-9]*\)9-/\18-/
+s/^\([0-9]*\)0-/\1'9-/
+s/_/0/
+
+: scarry
+/0'/{
+ s//'9/
+ b scarry
+}
+/^'/{
+ b under
+}
+s/1'/0/
+s/2'/1/
+s/3'/2/
+s/4'/3/
+s/5'/4/
+s/6'/5/
+s/7'/6/
+s/8'/7/
+s/9'/8/
+
+b sub
diff --git a/usr.bin/sed/tests/multi_test.sh b/usr.bin/sed/tests/multi_test.sh
new file mode 100644
index 0000000..66207a6
--- /dev/null
+++ b/usr.bin/sed/tests/multi_test.sh
@@ -0,0 +1,496 @@
+#!/bin/sh -
+#
+# Copyright (c) 1992 Diomidis Spinellis.
+# Copyright (c) 1992, 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.
+#
+# @(#)sed.test 8.1 (Berkeley) 6/6/93
+#
+# $FreeBSD$
+#
+
+# sed Regression Tests
+#
+# The directory regress.test.out contains the expected test results
+#
+# These are the regression tests mostly created during the development
+# of the BSD sed. Each test should have a unique mark name, which is
+# used for naming the corresponding file in regress.multitest.out.
+
+SRCDIR=$(dirname $0)
+
+main()
+{
+ REGRESS=${SRCDIR}/regress.multitest.out
+ DICT=/usr/share/dict/words
+
+ awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1
+ awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2
+
+ echo "1..130"
+
+ exec 4>&1 5>&2
+ tests
+ exec 1>&4 2>&5
+
+ # Remove temporary files
+ rm -f current.out lines[1-4] script[1-2]
+}
+
+tests()
+{
+ SED=sed
+ MARK=0
+
+ test_args
+ test_addr
+ test_group
+ test_acid
+ test_branch
+ test_pattern
+ test_print
+ test_subst
+ test_error
+ # Handle the result of the last test
+ result
+}
+
+# Display a test's result
+result()
+{
+ if [ "$TODO" = '1' ] ; then
+ TODO='TODO '
+ else
+ TODO=''
+ fi
+ if ! [ -r $REGRESS/${TESTNAME} ] ; then
+ echo "Seeding $REGRESS/${TESTNAME} with current result" 1>&2
+ cp current.out $REGRESS/${TESTNAME}
+ fi
+ if diff -c $REGRESS/${TESTNAME} current.out ; then
+ echo "ok $MARK $TESTNAME # $TODO$COMMENT"
+ else
+ echo "not ok $MARK $TESTNAME # $TODO$COMMENT"
+ fi 1>&4 2>&5
+}
+
+# Mark the beginning of each test
+mark()
+{
+ [ $MARK -gt 0 ] && result
+ MARK=`expr $MARK + 1`
+ TESTNAME=$1
+ exec 1>&4 2>&5
+ exec >"current.out"
+}
+
+test_args()
+{
+ COMMENT='Argument parsing - first type'
+ mark '1.1'
+ $SED 's/^/e1_/p' lines1
+ mark '1.2' ; $SED -n 's/^/e1_/p' lines1
+ mark '1.3'
+ $SED 's/^/e1_/p' <lines1
+ mark '1.4' ; $SED -n 's/^/e1_/p' <lines1
+ COMMENT='Argument parsing - second type'
+ mark '1.4.1'
+ $SED -e '' <lines1
+ echo 's/^/s1_/p' >script1
+ echo 's/^/s2_/p' >script2
+ mark '1.5'
+ $SED -f script1 lines1
+ mark '1.6'
+ $SED -f script1 <lines1
+ mark '1.7'
+ $SED -e 's/^/e1_/p' lines1
+ mark '1.8'
+ $SED -e 's/^/e1_/p' <lines1
+ mark '1.9' ; $SED -n -f script1 lines1
+ mark '1.10' ; $SED -n -f script1 <lines1
+ mark '1.11' ; $SED -n -e 's/^/e1_/p' lines1
+ mark '1.12'
+ $SED -n -e 's/^/e1_/p' <lines1
+ mark '1.13'
+ $SED -e 's/^/e1_/p' -e 's/^/e2_/p' lines1
+ mark '1.14'
+ $SED -f script1 -f script2 lines1
+ mark '1.15'
+ $SED -e 's/^/e1_/p' -f script1 lines1
+ mark '1.16'
+ $SED -e 's/^/e1_/p' lines1 lines1
+ # POSIX D11.2:11251
+ mark '1.17' ; $SED p <lines1 lines1
+cat >script1 <<EOF
+#n
+# A comment
+
+p
+EOF
+ mark '1.18' ; $SED -f script1 <lines1 lines1
+}
+
+test_addr()
+{
+ COMMENT='Address ranges'
+ mark '2.1' ; $SED -n -e '4p' lines1
+ mark '2.2' ; $SED -n -e '20p' lines1 lines2
+ mark '2.3' ; $SED -n -e '$p' lines1
+ mark '2.4' ; $SED -n -e '$p' lines1 lines2
+ mark '2.5' ; $SED -n -e '$a\
+hello' /dev/null
+ mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2
+ # Should not print anything
+ mark '2.7' ; $SED -n -e '20p' lines1
+ mark '2.8' ; $SED -n -e '/NOTFOUND/p' lines1
+ mark '2.9' ; $SED -n '/l1_7/p' lines1
+ mark '2.10' ; $SED -n ' /l1_7/ p' lines1
+ mark '2.11' ; $SED -n '\_l1\_7_p' lines1
+ mark '2.12' ; $SED -n '1,4p' lines1
+ mark '2.13' ; $SED -n '1,$p' lines1 lines2
+ mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2
+ mark '2.15' ; $SED -n '/4/,$p' lines1 lines2
+ mark '2.16' ; $SED -n '/4/,20p' lines1 lines2
+ mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2
+ mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2
+ mark '2.19' ; $SED -n '12,3p' lines1 lines2
+ mark '2.20' ; $SED -n '/l1_7/,3p' lines1 lines2
+ mark '2.21' ; $SED -n '13,+4p' lines1 lines2
+ mark '2.22' ; $SED -n '/l1_6/,+2p' lines1 lines2
+ # For PR bin/192108
+ mark '2.23'; $SED -n '12,+1p' lines1
+}
+
+test_group()
+{
+ COMMENT='Brace and other grouping'
+ mark '3.1' ; $SED -e '
+4,12 {
+ s/^/^/
+ s/$/$/
+ s/_/T/
+}' lines1
+ mark '3.2' ; $SED -e '
+4,12 {
+ s/^/^/
+ /6/,/10/ {
+ s/$/$/
+ /8/ s/_/T/
+ }
+}' lines1
+ mark '3.3' ; $SED -e '
+4,12 !{
+ s/^/^/
+ /6/,/10/ !{
+ s/$/$/
+ /8/ !s/_/T/
+ }
+}' lines1
+ mark '3.4' ; $SED -e '4,12!s/^/^/' lines1
+}
+
+test_acid()
+{
+ COMMENT='Commands a c d and i'
+ mark '4.1' ; $SED -n -e '
+s/^/before_i/p
+20i\
+inserted
+s/^/after_i/p
+' lines1 lines2
+ mark '4.2' ; $SED -n -e '
+5,12s/^/5-12/
+s/^/before_a/p
+/5-12/a\
+appended
+s/^/after_a/p
+' lines1 lines2
+ mark '4.3'
+ $SED -n -e '
+s/^/^/p
+/l1_/a\
+appended
+8,10N
+s/$/$/p
+' lines1 lines2
+ mark '4.4' ; $SED -n -e '
+c\
+hello
+' lines1
+ mark '4.5' ; $SED -n -e '
+8c\
+hello
+' lines1
+ mark '4.6' ; $SED -n -e '
+3,14c\
+hello
+' lines1
+# SunOS and GNU sed behave differently. We follow POSIX
+ mark '4.7' ; $SED -n -e '
+8,3c\
+hello
+' lines1
+ mark '4.8' ; $SED d <lines1
+}
+
+test_branch()
+{
+ COMMENT='Labels and branching'
+ mark '5.1' ; $SED -n -e '
+b label4
+:label3
+s/^/label3_/p
+b end
+:label4
+2,12b label1
+b label2
+:label1
+s/^/label1_/p
+b
+:label2
+s/^/label2_/p
+b label3
+:end
+' lines1
+ mark '5.2'
+ $SED -n -e '
+s/l1_/l2_/
+t ok
+b
+:ok
+s/^/tested /p
+' lines1 lines2
+# SunOS and GNU sed behave as follows: lines 9-$ aren't printed at all
+ mark '5.3' ; $SED -n -e '
+5,8b inside
+1,5 {
+ s/^/^/p
+ :inside
+ s/$/$/p
+}
+' lines1
+# Check that t clears the substitution done flag
+ mark '5.4' ; $SED -n -e '
+1,8s/^/^/
+t l1
+:l1
+t l2
+s/$/$/p
+b
+:l2
+s/^/ERROR/
+' lines1
+# Check that reading a line clears the substitution done flag
+ mark '5.5'
+ $SED -n -e '
+t l2
+1,8s/^/^/p
+2,7N
+b
+:l2
+s/^/ERROR/p
+' lines1
+ mark '5.6' ; $SED 5q lines1
+ mark '5.7' ; $SED -e '
+5i\
+hello
+5q' lines1
+# Branch across block boundary
+ mark '5.8' ; $SED -e '
+{
+:b
+}
+s/l/m/
+tb' lines1
+}
+
+test_pattern()
+{
+COMMENT='Pattern space commands'
+# Check that the pattern space is deleted
+ mark '6.1' ; $SED -n -e '
+c\
+changed
+p
+' lines1
+ mark '6.2' ; $SED -n -e '
+4d
+p
+' lines1
+ mark '6.3'
+ $SED -e 'N;N;N;D' lines1
+ mark '6.4' ; $SED -e '
+2h
+3H
+4g
+5G
+6x
+6p
+6x
+6p
+' lines1
+ mark '6.5' ; $SED -e '4n' lines1
+ mark '6.6' ; $SED -n -e '4n' lines1
+}
+
+test_print()
+{
+ COMMENT='Print and file routines'
+ awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
+ </dev/null >lines3
+ # GNU and SunOS sed behave differently here
+ mark '7.1'
+ $SED -n l lines3
+ mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
+ rm -f lines4
+ mark '7.3' ; $SED -e '3,12w lines4' lines1
+ COMMENT='w results'
+ cat lines4
+ mark '7.4' ; $SED -e '4r lines2' lines1
+ mark '7.5' ; $SED -e '5r /dev/dds' lines1
+ mark '7.6' ; $SED -e '6r /dev/null' lines1
+ mark '7.7'
+ sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1
+ rm -rf tmpdir
+ mkdir tmpdir
+ $SED -f script1 lines1
+ cat tmpdir/*
+ rm -rf tmpdir
+ mark '7.8'
+ echo line1 > lines3
+ echo "" >> lines3
+ TODO=1
+ $SED -n -e '$p' lines3 /dev/null
+
+}
+
+test_subst()
+{
+ COMMENT='Substitution commands'
+ mark '8.1' ; $SED -e 's/./X/g' lines1
+ mark '8.2' ; $SED -e 's,.,X,g' lines1
+# SunOS sed thinks we are escaping . as wildcard, not as separator
+ mark '8.3'
+ $SED -e 's.\..X.g' lines1
+ mark '8.4' ; $SED -e 's/[\/]/Q/' lines1
+ mark '8.5' ; $SED -e 's_\__X_' lines1
+ mark '8.6' ; $SED -e 's/./(&)/g' lines1
+ mark '8.7' ; $SED -e 's/./(\&)/g' lines1
+ mark '8.8' ; $SED -e 's/\(.\)\(.\)\(.\)/x\3x\2x\1/g' lines1
+ mark '8.9' ; $SED -e 's/_/u0\
+u1\
+u2/g' lines1
+ mark '8.10'
+ $SED -e 's/./X/4' lines1
+ rm -f lines4
+ mark '8.11' ; $SED -e 's/1/X/w lines4' lines1
+ COMMENT='s wfile results'
+ cat lines4
+ mark '8.12' ; $SED -e 's/[123]/X/g' lines1
+ mark '8.13' ; $SED -e 'y/0123456789/9876543210/' lines1
+ mark '8.14' ;
+ $SED -e 'y10\123456789198765432\101' lines1
+ mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
+ mark '8.16'
+ echo 'eeefff' | $SED -e '
+ p
+ s/e/X/p
+ :x
+ s//Y/p
+ # Establish limit counter in the hold space
+ # GNU sed version 3.02 enters into an infinite loop here
+ x
+ /.\{10\}/ {
+ s/.*/ERROR/
+ b
+ }
+ s/.*/&./
+ x
+ /f/bx
+ '
+ # POSIX does not say that this should work,
+ # but it does for GNU, BSD, and SunOS
+ mark '8.17' ; $SED -e 's/[/]/Q/' lines1
+
+ COMMENT='[ as an s delimiter and its escapes'
+ mark '8.18' ; $SED -e 's[_[X[' lines1
+ # This is a matter of interpretation
+ # POSIX 1003.1, 2004 says "Within the BRE and the replacement,
+ # the BRE delimiter itself can be used as a *literal* character
+ # if it is preceded by a backslash"
+ # SunOS 5.1 /usr/bin/sed and Mac OS X follow the literal POSIX
+ # interpretation.
+ # GNU sed version 4.1.5 treats \[ as the beginning of a character
+ # set specification (both with --posix and without).
+ mark '8.19' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X['
+ mark '8.20' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X\[['
+ COMMENT='\ in y command'
+ mark '8.21'
+ echo 'a\b(c' |
+ $SED 'y%ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"%abcdefghijklmnopqrstuvwxyz,------%'
+ COMMENT='\n in a character class and a BRE'
+ mark '8.22' ; (echo 1; echo 2) | $SED -n '1{;N;s/[\n]/X/;p;}'
+ mark '8.23' ; (echo 1; echo 2) | $SED -n '1{;N;s/\n/X/;p;}'
+}
+
+test_error()
+{
+ COMMENT='Error cases'
+ mark '9.1' ; $SED -x 2>/dev/null ; echo $?
+ mark '9.2' ; $SED -f 2>/dev/null ; echo $?
+ mark '9.3' ; $SED -e 2>/dev/null ; echo $?
+ mark '9.4' ; $SED -f /dev/xyzzyxyzy 2>/dev/null ; echo $?
+ mark '9.5' ; $SED p /dev/xyzzyxyzy 2>/dev/null ; echo $?
+ mark '9.6' ; $SED -f /bin/sh 2>/dev/null ; echo $?
+ mark '9.7' ; $SED '{' 2>/dev/null ; echo $?
+ mark '9.8' ; $SED '{' 2>/dev/null ; echo $?
+ mark '9.9' ; $SED '/hello/' 2>/dev/null ; echo $?
+ mark '9.10' ; $SED '1,/hello/' 2>/dev/null ; echo $?
+ mark '9.11' ; $SED -e '-5p' 2>/dev/null ; echo $?
+ mark '9.12' ; $SED '/jj' 2>/dev/null ; echo $?
+ mark '9.13' ; $SED 'a hello' 2>/dev/null ; echo $?
+ mark '9.14' ; $SED 'a \ hello' 2>/dev/null ; echo $?
+ mark '9.15' ; $SED 'b foo' 2>/dev/null ; echo $?
+ mark '9.16' ; $SED 'd hello' 2>/dev/null ; echo $?
+ mark '9.17' ; $SED 's/aa' 2>/dev/null ; echo $?
+ mark '9.18' ; $SED 's/aa/' 2>/dev/null ; echo $?
+ mark '9.19' ; $SED 's/a/b' 2>/dev/null ; echo $?
+ mark '9.20' ; $SED 's/a/b/c/d' 2>/dev/null ; echo $?
+ mark '9.21' ; $SED 's/a/b/ 1 2' 2>/dev/null ; echo $?
+ mark '9.22' ; $SED 's/a/b/ 1 g' 2>/dev/null ; echo $?
+ mark '9.23' ; $SED 's/a/b/w' 2>/dev/null ; echo $?
+ mark '9.24' ; $SED 'y/aa' 2>/dev/null ; echo $?
+ mark '9.25' ; $SED 'y/aa/b/' 2>/dev/null ; echo $?
+ mark '9.26' ; $SED 'y/aa/' 2>/dev/null ; echo $?
+ mark '9.27' ; $SED 'y/a/b' 2>/dev/null ; echo $?
+ mark '9.28' ; $SED 'y/a/b/c/d' 2>/dev/null ; echo $?
+ mark '9.29' ; $SED '!' 2>/dev/null ; echo $?
+ mark '9.30' ; $SED supercalifrangolisticexprialidociussupercalifrangolisticexcius 2>/dev/null ; echo $?
+ mark '9.31' ; $SED '' /dev/null 2>/dev/null ; echo $?
+}
+
+main
diff --git a/usr.bin/sed/tests/regress.G.out b/usr.bin/sed/tests/regress.G.out
new file mode 100644
index 0000000..49c277c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.G.out
@@ -0,0 +1,8 @@
+input
+
+data
+
+for validation
+
+of sed(1)
+
diff --git a/usr.bin/sed/tests/regress.P.out b/usr.bin/sed/tests/regress.P.out
new file mode 100644
index 0000000..4d3284f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.P.out
@@ -0,0 +1,8 @@
+input
+input
+data
+data
+for validation
+for validation
+of sed(1)
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.b2a.out b/usr.bin/sed/tests/regress.b2a.out
new file mode 100644
index 0000000..a44df51
--- /dev/null
+++ b/usr.bin/sed/tests/regress.b2a.out
@@ -0,0 +1,3 @@
+data
+for validation
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.bcb.out b/usr.bin/sed/tests/regress.bcb.out
new file mode 100644
index 0000000..2a26e6a
--- /dev/null
+++ b/usr.bin/sed/tests/regress.bcb.out
@@ -0,0 +1,4 @@
+input
+data
+for validation
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.c0.out b/usr.bin/sed/tests/regress.c0.out
new file mode 100644
index 0000000..a1f8944
--- /dev/null
+++ b/usr.bin/sed/tests/regress.c0.out
@@ -0,0 +1,4 @@
+foo
+foo
+foo
+foo
diff --git a/usr.bin/sed/tests/regress.c1.out b/usr.bin/sed/tests/regress.c1.out
new file mode 100644
index 0000000..21af01e
--- /dev/null
+++ b/usr.bin/sed/tests/regress.c1.out
@@ -0,0 +1,4 @@
+input
+data
+for validation
+foo
diff --git a/usr.bin/sed/tests/regress.c2.out b/usr.bin/sed/tests/regress.c2.out
new file mode 100644
index 0000000..6c54a8d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.c2.out
@@ -0,0 +1,3 @@
+input
+data
+foo
diff --git a/usr.bin/sed/tests/regress.c3.out b/usr.bin/sed/tests/regress.c3.out
new file mode 100644
index 0000000..6c54a8d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.c3.out
@@ -0,0 +1,3 @@
+input
+data
+foo
diff --git a/usr.bin/sed/tests/regress.hanoi.out b/usr.bin/sed/tests/regress.hanoi.out
new file mode 100644
index 0000000..ec39ea2
--- /dev/null
+++ b/usr.bin/sed/tests/regress.hanoi.out
@@ -0,0 +1,17 @@
+:abcd: : :
+:abc : :d :
+:ab :c :d :
+:ab :cd : :
+:a :cd :b :
+:ad :c :b :
+:ad : :bc :
+:a : :bcd :
+: :a :bcd :
+: :ad :bc :
+:c :ad :b :
+:cd :a :b :
+:cd :ab : :
+:c :ab :d :
+: :abc :d :
+: :abcd: :
+Done! Try another, or end with ^D.
diff --git a/usr.bin/sed/tests/regress.icase1.out b/usr.bin/sed/tests/regress.icase1.out
new file mode 100644
index 0000000..a610a0b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.icase1.out
@@ -0,0 +1,3 @@
+input
+data
+for validation
diff --git a/usr.bin/sed/tests/regress.icase2.out b/usr.bin/sed/tests/regress.icase2.out
new file mode 100644
index 0000000..b803373
--- /dev/null
+++ b/usr.bin/sed/tests/regress.icase2.out
@@ -0,0 +1,4 @@
+input
+data
+for validation
+of Foo(1)
diff --git a/usr.bin/sed/tests/regress.icase3.out b/usr.bin/sed/tests/regress.icase3.out
new file mode 100644
index 0000000..2a26e6a
--- /dev/null
+++ b/usr.bin/sed/tests/regress.icase3.out
@@ -0,0 +1,4 @@
+input
+data
+for validation
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.icase4.out b/usr.bin/sed/tests/regress.icase4.out
new file mode 100644
index 0000000..b803373
--- /dev/null
+++ b/usr.bin/sed/tests/regress.icase4.out
@@ -0,0 +1,4 @@
+input
+data
+for validation
+of Foo(1)
diff --git a/usr.bin/sed/tests/regress.in b/usr.bin/sed/tests/regress.in
new file mode 100644
index 0000000..2a26e6a
--- /dev/null
+++ b/usr.bin/sed/tests/regress.in
@@ -0,0 +1,4 @@
+input
+data
+for validation
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.math.out b/usr.bin/sed/tests/regress.math.out
new file mode 100644
index 0000000..3fdcd7c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.math.out
@@ -0,0 +1 @@
+67
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.1 b/usr.bin/sed/tests/regress.multitest.out/1.1
new file mode 100644
index 0000000..70fd43b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.1
@@ -0,0 +1,28 @@
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.10 b/usr.bin/sed/tests/regress.multitest.out/1.10
new file mode 100644
index 0000000..44f4ec3
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.10
@@ -0,0 +1,14 @@
+s1_l1_1
+s1_l1_2
+s1_l1_3
+s1_l1_4
+s1_l1_5
+s1_l1_6
+s1_l1_7
+s1_l1_8
+s1_l1_9
+s1_l1_10
+s1_l1_11
+s1_l1_12
+s1_l1_13
+s1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.11 b/usr.bin/sed/tests/regress.multitest.out/1.11
new file mode 100644
index 0000000..7af945d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.11
@@ -0,0 +1,14 @@
+e1_l1_1
+e1_l1_2
+e1_l1_3
+e1_l1_4
+e1_l1_5
+e1_l1_6
+e1_l1_7
+e1_l1_8
+e1_l1_9
+e1_l1_10
+e1_l1_11
+e1_l1_12
+e1_l1_13
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.12 b/usr.bin/sed/tests/regress.multitest.out/1.12
new file mode 100644
index 0000000..7af945d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.12
@@ -0,0 +1,14 @@
+e1_l1_1
+e1_l1_2
+e1_l1_3
+e1_l1_4
+e1_l1_5
+e1_l1_6
+e1_l1_7
+e1_l1_8
+e1_l1_9
+e1_l1_10
+e1_l1_11
+e1_l1_12
+e1_l1_13
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.13 b/usr.bin/sed/tests/regress.multitest.out/1.13
new file mode 100644
index 0000000..90582c8
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.13
@@ -0,0 +1,42 @@
+e1_l1_1
+e2_e1_l1_1
+e2_e1_l1_1
+e1_l1_2
+e2_e1_l1_2
+e2_e1_l1_2
+e1_l1_3
+e2_e1_l1_3
+e2_e1_l1_3
+e1_l1_4
+e2_e1_l1_4
+e2_e1_l1_4
+e1_l1_5
+e2_e1_l1_5
+e2_e1_l1_5
+e1_l1_6
+e2_e1_l1_6
+e2_e1_l1_6
+e1_l1_7
+e2_e1_l1_7
+e2_e1_l1_7
+e1_l1_8
+e2_e1_l1_8
+e2_e1_l1_8
+e1_l1_9
+e2_e1_l1_9
+e2_e1_l1_9
+e1_l1_10
+e2_e1_l1_10
+e2_e1_l1_10
+e1_l1_11
+e2_e1_l1_11
+e2_e1_l1_11
+e1_l1_12
+e2_e1_l1_12
+e2_e1_l1_12
+e1_l1_13
+e2_e1_l1_13
+e2_e1_l1_13
+e1_l1_14
+e2_e1_l1_14
+e2_e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.14 b/usr.bin/sed/tests/regress.multitest.out/1.14
new file mode 100644
index 0000000..fd78274
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.14
@@ -0,0 +1,42 @@
+s1_l1_1
+s2_s1_l1_1
+s2_s1_l1_1
+s1_l1_2
+s2_s1_l1_2
+s2_s1_l1_2
+s1_l1_3
+s2_s1_l1_3
+s2_s1_l1_3
+s1_l1_4
+s2_s1_l1_4
+s2_s1_l1_4
+s1_l1_5
+s2_s1_l1_5
+s2_s1_l1_5
+s1_l1_6
+s2_s1_l1_6
+s2_s1_l1_6
+s1_l1_7
+s2_s1_l1_7
+s2_s1_l1_7
+s1_l1_8
+s2_s1_l1_8
+s2_s1_l1_8
+s1_l1_9
+s2_s1_l1_9
+s2_s1_l1_9
+s1_l1_10
+s2_s1_l1_10
+s2_s1_l1_10
+s1_l1_11
+s2_s1_l1_11
+s2_s1_l1_11
+s1_l1_12
+s2_s1_l1_12
+s2_s1_l1_12
+s1_l1_13
+s2_s1_l1_13
+s2_s1_l1_13
+s1_l1_14
+s2_s1_l1_14
+s2_s1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.15 b/usr.bin/sed/tests/regress.multitest.out/1.15
new file mode 100644
index 0000000..7b3700c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.15
@@ -0,0 +1,42 @@
+e1_l1_1
+s1_e1_l1_1
+s1_e1_l1_1
+e1_l1_2
+s1_e1_l1_2
+s1_e1_l1_2
+e1_l1_3
+s1_e1_l1_3
+s1_e1_l1_3
+e1_l1_4
+s1_e1_l1_4
+s1_e1_l1_4
+e1_l1_5
+s1_e1_l1_5
+s1_e1_l1_5
+e1_l1_6
+s1_e1_l1_6
+s1_e1_l1_6
+e1_l1_7
+s1_e1_l1_7
+s1_e1_l1_7
+e1_l1_8
+s1_e1_l1_8
+s1_e1_l1_8
+e1_l1_9
+s1_e1_l1_9
+s1_e1_l1_9
+e1_l1_10
+s1_e1_l1_10
+s1_e1_l1_10
+e1_l1_11
+s1_e1_l1_11
+s1_e1_l1_11
+e1_l1_12
+s1_e1_l1_12
+s1_e1_l1_12
+e1_l1_13
+s1_e1_l1_13
+s1_e1_l1_13
+e1_l1_14
+s1_e1_l1_14
+s1_e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.16 b/usr.bin/sed/tests/regress.multitest.out/1.16
new file mode 100644
index 0000000..2bfa3fe
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.16
@@ -0,0 +1,56 @@
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.17 b/usr.bin/sed/tests/regress.multitest.out/1.17
new file mode 100644
index 0000000..0833b55
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.17
@@ -0,0 +1,28 @@
+l1_1
+l1_1
+l1_2
+l1_2
+l1_3
+l1_3
+l1_4
+l1_4
+l1_5
+l1_5
+l1_6
+l1_6
+l1_7
+l1_7
+l1_8
+l1_8
+l1_9
+l1_9
+l1_10
+l1_10
+l1_11
+l1_11
+l1_12
+l1_12
+l1_13
+l1_13
+l1_14
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.18 b/usr.bin/sed/tests/regress.multitest.out/1.18
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.18
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.2 b/usr.bin/sed/tests/regress.multitest.out/1.2
new file mode 100644
index 0000000..7af945d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.2
@@ -0,0 +1,14 @@
+e1_l1_1
+e1_l1_2
+e1_l1_3
+e1_l1_4
+e1_l1_5
+e1_l1_6
+e1_l1_7
+e1_l1_8
+e1_l1_9
+e1_l1_10
+e1_l1_11
+e1_l1_12
+e1_l1_13
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.3 b/usr.bin/sed/tests/regress.multitest.out/1.3
new file mode 100644
index 0000000..70fd43b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.3
@@ -0,0 +1,28 @@
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.4 b/usr.bin/sed/tests/regress.multitest.out/1.4
new file mode 100644
index 0000000..7af945d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.4
@@ -0,0 +1,14 @@
+e1_l1_1
+e1_l1_2
+e1_l1_3
+e1_l1_4
+e1_l1_5
+e1_l1_6
+e1_l1_7
+e1_l1_8
+e1_l1_9
+e1_l1_10
+e1_l1_11
+e1_l1_12
+e1_l1_13
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.4.1 b/usr.bin/sed/tests/regress.multitest.out/1.4.1
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.4.1
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.5 b/usr.bin/sed/tests/regress.multitest.out/1.5
new file mode 100644
index 0000000..dfd85f7
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.5
@@ -0,0 +1,28 @@
+s1_l1_1
+s1_l1_1
+s1_l1_2
+s1_l1_2
+s1_l1_3
+s1_l1_3
+s1_l1_4
+s1_l1_4
+s1_l1_5
+s1_l1_5
+s1_l1_6
+s1_l1_6
+s1_l1_7
+s1_l1_7
+s1_l1_8
+s1_l1_8
+s1_l1_9
+s1_l1_9
+s1_l1_10
+s1_l1_10
+s1_l1_11
+s1_l1_11
+s1_l1_12
+s1_l1_12
+s1_l1_13
+s1_l1_13
+s1_l1_14
+s1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.6 b/usr.bin/sed/tests/regress.multitest.out/1.6
new file mode 100644
index 0000000..dfd85f7
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.6
@@ -0,0 +1,28 @@
+s1_l1_1
+s1_l1_1
+s1_l1_2
+s1_l1_2
+s1_l1_3
+s1_l1_3
+s1_l1_4
+s1_l1_4
+s1_l1_5
+s1_l1_5
+s1_l1_6
+s1_l1_6
+s1_l1_7
+s1_l1_7
+s1_l1_8
+s1_l1_8
+s1_l1_9
+s1_l1_9
+s1_l1_10
+s1_l1_10
+s1_l1_11
+s1_l1_11
+s1_l1_12
+s1_l1_12
+s1_l1_13
+s1_l1_13
+s1_l1_14
+s1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.7 b/usr.bin/sed/tests/regress.multitest.out/1.7
new file mode 100644
index 0000000..70fd43b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.7
@@ -0,0 +1,28 @@
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.8 b/usr.bin/sed/tests/regress.multitest.out/1.8
new file mode 100644
index 0000000..70fd43b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.8
@@ -0,0 +1,28 @@
+e1_l1_1
+e1_l1_1
+e1_l1_2
+e1_l1_2
+e1_l1_3
+e1_l1_3
+e1_l1_4
+e1_l1_4
+e1_l1_5
+e1_l1_5
+e1_l1_6
+e1_l1_6
+e1_l1_7
+e1_l1_7
+e1_l1_8
+e1_l1_8
+e1_l1_9
+e1_l1_9
+e1_l1_10
+e1_l1_10
+e1_l1_11
+e1_l1_11
+e1_l1_12
+e1_l1_12
+e1_l1_13
+e1_l1_13
+e1_l1_14
+e1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/1.9 b/usr.bin/sed/tests/regress.multitest.out/1.9
new file mode 100644
index 0000000..44f4ec3
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/1.9
@@ -0,0 +1,14 @@
+s1_l1_1
+s1_l1_2
+s1_l1_3
+s1_l1_4
+s1_l1_5
+s1_l1_6
+s1_l1_7
+s1_l1_8
+s1_l1_9
+s1_l1_10
+s1_l1_11
+s1_l1_12
+s1_l1_13
+s1_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.1 b/usr.bin/sed/tests/regress.multitest.out/2.1
new file mode 100644
index 0000000..a7c92f0
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.1
@@ -0,0 +1 @@
+l1_4
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.10 b/usr.bin/sed/tests/regress.multitest.out/2.10
new file mode 100644
index 0000000..8e6f085
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.10
@@ -0,0 +1 @@
+l1_7
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.11 b/usr.bin/sed/tests/regress.multitest.out/2.11
new file mode 100644
index 0000000..8e6f085
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.11
@@ -0,0 +1 @@
+l1_7
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.12 b/usr.bin/sed/tests/regress.multitest.out/2.12
new file mode 100644
index 0000000..ddd4976
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.12
@@ -0,0 +1,4 @@
+l1_1
+l1_2
+l1_3
+l1_4
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.13 b/usr.bin/sed/tests/regress.multitest.out/2.13
new file mode 100644
index 0000000..d08d35c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.13
@@ -0,0 +1,23 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.14 b/usr.bin/sed/tests/regress.multitest.out/2.14
new file mode 100644
index 0000000..d08d35c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.14
@@ -0,0 +1,23 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.15 b/usr.bin/sed/tests/regress.multitest.out/2.15
new file mode 100644
index 0000000..1f20a52
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.15
@@ -0,0 +1,20 @@
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.16 b/usr.bin/sed/tests/regress.multitest.out/2.16
new file mode 100644
index 0000000..4d8dc1e
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.16
@@ -0,0 +1,17 @@
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.17 b/usr.bin/sed/tests/regress.multitest.out/2.17
new file mode 100644
index 0000000..df7978f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.17
@@ -0,0 +1,17 @@
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_14
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.18 b/usr.bin/sed/tests/regress.multitest.out/2.18
new file mode 100644
index 0000000..c4d558b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.18
@@ -0,0 +1,7 @@
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.19 b/usr.bin/sed/tests/regress.multitest.out/2.19
new file mode 100644
index 0000000..7fb81db
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.19
@@ -0,0 +1 @@
+l1_12
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.2 b/usr.bin/sed/tests/regress.multitest.out/2.2
new file mode 100644
index 0000000..fe925b0
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.2
@@ -0,0 +1 @@
+l2_6
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.20 b/usr.bin/sed/tests/regress.multitest.out/2.20
new file mode 100644
index 0000000..8e6f085
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.20
@@ -0,0 +1 @@
+l1_7
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.21 b/usr.bin/sed/tests/regress.multitest.out/2.21
new file mode 100644
index 0000000..1a9e066
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.21
@@ -0,0 +1,5 @@
+l1_13
+l1_14
+l2_1
+l2_2
+l2_3
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.22 b/usr.bin/sed/tests/regress.multitest.out/2.22
new file mode 100644
index 0000000..b182791
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.22
@@ -0,0 +1,3 @@
+l1_6
+l1_7
+l1_8
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.23 b/usr.bin/sed/tests/regress.multitest.out/2.23
new file mode 100644
index 0000000..543c057
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.23
@@ -0,0 +1,2 @@
+l1_12
+l1_13
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.3 b/usr.bin/sed/tests/regress.multitest.out/2.3
new file mode 100644
index 0000000..6165ce8
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.3
@@ -0,0 +1 @@
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.4 b/usr.bin/sed/tests/regress.multitest.out/2.4
new file mode 100644
index 0000000..1502f00
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.4
@@ -0,0 +1 @@
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.5 b/usr.bin/sed/tests/regress.multitest.out/2.5
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.5
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.6 b/usr.bin/sed/tests/regress.multitest.out/2.6
new file mode 100644
index 0000000..1502f00
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.6
@@ -0,0 +1 @@
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.7 b/usr.bin/sed/tests/regress.multitest.out/2.7
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.7
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.8 b/usr.bin/sed/tests/regress.multitest.out/2.8
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.8
diff --git a/usr.bin/sed/tests/regress.multitest.out/2.9 b/usr.bin/sed/tests/regress.multitest.out/2.9
new file mode 100644
index 0000000..8e6f085
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/2.9
@@ -0,0 +1 @@
+l1_7
diff --git a/usr.bin/sed/tests/regress.multitest.out/3.1 b/usr.bin/sed/tests/regress.multitest.out/3.1
new file mode 100644
index 0000000..f963b03
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/3.1
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+^l1T4$
+^l1T5$
+^l1T6$
+^l1T7$
+^l1T8$
+^l1T9$
+^l1T10$
+^l1T11$
+^l1T12$
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/3.2 b/usr.bin/sed/tests/regress.multitest.out/3.2
new file mode 100644
index 0000000..488e94f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/3.2
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+^l1_4
+^l1_5
+^l1_6$
+^l1_7$
+^l1T8$
+^l1_9$
+^l1_10$
+^l1_11
+^l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/3.3 b/usr.bin/sed/tests/regress.multitest.out/3.3
new file mode 100644
index 0000000..5b15dae
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/3.3
@@ -0,0 +1,14 @@
+^l1T1$
+^l1T2$
+^l1T3$
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+^l1T13$
+^l1T14$
diff --git a/usr.bin/sed/tests/regress.multitest.out/3.4 b/usr.bin/sed/tests/regress.multitest.out/3.4
new file mode 100644
index 0000000..67f03ef
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/3.4
@@ -0,0 +1,14 @@
+^l1_1
+^l1_2
+^l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+^l1_13
+^l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.1 b/usr.bin/sed/tests/regress.multitest.out/4.1
new file mode 100644
index 0000000..455093c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.1
@@ -0,0 +1,47 @@
+before_il1_1
+after_ibefore_il1_1
+before_il1_2
+after_ibefore_il1_2
+before_il1_3
+after_ibefore_il1_3
+before_il1_4
+after_ibefore_il1_4
+before_il1_5
+after_ibefore_il1_5
+before_il1_6
+after_ibefore_il1_6
+before_il1_7
+after_ibefore_il1_7
+before_il1_8
+after_ibefore_il1_8
+before_il1_9
+after_ibefore_il1_9
+before_il1_10
+after_ibefore_il1_10
+before_il1_11
+after_ibefore_il1_11
+before_il1_12
+after_ibefore_il1_12
+before_il1_13
+after_ibefore_il1_13
+before_il1_14
+after_ibefore_il1_14
+before_il2_1
+after_ibefore_il2_1
+before_il2_2
+after_ibefore_il2_2
+before_il2_3
+after_ibefore_il2_3
+before_il2_4
+after_ibefore_il2_4
+before_il2_5
+after_ibefore_il2_5
+before_il2_6
+inserted
+after_ibefore_il2_6
+before_il2_7
+after_ibefore_il2_7
+before_il2_8
+after_ibefore_il2_8
+before_il2_9
+after_ibefore_il2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.2 b/usr.bin/sed/tests/regress.multitest.out/4.2
new file mode 100644
index 0000000..4161c1c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.2
@@ -0,0 +1,54 @@
+before_al1_1
+after_abefore_al1_1
+before_al1_2
+after_abefore_al1_2
+before_al1_3
+after_abefore_al1_3
+before_al1_4
+after_abefore_al1_4
+before_a5-12l1_5
+after_abefore_a5-12l1_5
+appended
+before_a5-12l1_6
+after_abefore_a5-12l1_6
+appended
+before_a5-12l1_7
+after_abefore_a5-12l1_7
+appended
+before_a5-12l1_8
+after_abefore_a5-12l1_8
+appended
+before_a5-12l1_9
+after_abefore_a5-12l1_9
+appended
+before_a5-12l1_10
+after_abefore_a5-12l1_10
+appended
+before_a5-12l1_11
+after_abefore_a5-12l1_11
+appended
+before_a5-12l1_12
+after_abefore_a5-12l1_12
+appended
+before_al1_13
+after_abefore_al1_13
+before_al1_14
+after_abefore_al1_14
+before_al2_1
+after_abefore_al2_1
+before_al2_2
+after_abefore_al2_2
+before_al2_3
+after_abefore_al2_3
+before_al2_4
+after_abefore_al2_4
+before_al2_5
+after_abefore_al2_5
+before_al2_6
+after_abefore_al2_6
+before_al2_7
+after_abefore_al2_7
+before_al2_8
+after_abefore_al2_8
+before_al2_9
+after_abefore_al2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.3 b/usr.bin/sed/tests/regress.multitest.out/4.3
new file mode 100644
index 0000000..ccfa194
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.3
@@ -0,0 +1,56 @@
+^l1_1
+^l1_1$
+appended
+^l1_2
+^l1_2$
+appended
+^l1_3
+^l1_3$
+appended
+^l1_4
+^l1_4$
+appended
+^l1_5
+^l1_5$
+appended
+^l1_6
+^l1_6$
+appended
+^l1_7
+^l1_7$
+appended
+^l1_8
+appended
+^l1_8
+l1_9$
+^l1_10
+appended
+^l1_10
+l1_11$
+^l1_12
+^l1_12$
+appended
+^l1_13
+^l1_13$
+appended
+^l1_14
+^l1_14$
+appended
+^l2_1
+^l2_1$
+^l2_2
+^l2_2$
+^l2_3
+^l2_3$
+^l2_4
+^l2_4$
+^l2_5
+^l2_5$
+^l2_6
+^l2_6$
+^l2_7
+^l2_7$
+^l2_8
+^l2_8$
+^l2_9
+^l2_9$
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.4 b/usr.bin/sed/tests/regress.multitest.out/4.4
new file mode 100644
index 0000000..94e9a6d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.4
@@ -0,0 +1,14 @@
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
+hello
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.5 b/usr.bin/sed/tests/regress.multitest.out/4.5
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.5
@@ -0,0 +1 @@
+hello
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.6 b/usr.bin/sed/tests/regress.multitest.out/4.6
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.6
@@ -0,0 +1 @@
+hello
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.7 b/usr.bin/sed/tests/regress.multitest.out/4.7
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.7
@@ -0,0 +1 @@
+hello
diff --git a/usr.bin/sed/tests/regress.multitest.out/4.8 b/usr.bin/sed/tests/regress.multitest.out/4.8
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/4.8
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.1 b/usr.bin/sed/tests/regress.multitest.out/5.1
new file mode 100644
index 0000000..ac9202e
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.1
@@ -0,0 +1,17 @@
+label2_l1_1
+label3_label2_l1_1
+label1_l1_2
+label1_l1_3
+label1_l1_4
+label1_l1_5
+label1_l1_6
+label1_l1_7
+label1_l1_8
+label1_l1_9
+label1_l1_10
+label1_l1_11
+label1_l1_12
+label2_l1_13
+label3_label2_l1_13
+label2_l1_14
+label3_label2_l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.2 b/usr.bin/sed/tests/regress.multitest.out/5.2
new file mode 100644
index 0000000..ec339f4
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.2
@@ -0,0 +1,14 @@
+tested l2_1
+tested l2_2
+tested l2_3
+tested l2_4
+tested l2_5
+tested l2_6
+tested l2_7
+tested l2_8
+tested l2_9
+tested l2_10
+tested l2_11
+tested l2_12
+tested l2_13
+tested l2_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.3 b/usr.bin/sed/tests/regress.multitest.out/5.3
new file mode 100644
index 0000000..e1ddb54
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.3
@@ -0,0 +1,12 @@
+^l1_1
+^l1_1$
+^l1_2
+^l1_2$
+^l1_3
+^l1_3$
+^l1_4
+^l1_4$
+l1_5$
+l1_6$
+l1_7$
+l1_8$
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.4 b/usr.bin/sed/tests/regress.multitest.out/5.4
new file mode 100644
index 0000000..a9ec85b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.4
@@ -0,0 +1,14 @@
+^l1_1$
+^l1_2$
+^l1_3$
+^l1_4$
+^l1_5$
+^l1_6$
+^l1_7$
+^l1_8$
+l1_9$
+l1_10$
+l1_11$
+l1_12$
+l1_13$
+l1_14$
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.5 b/usr.bin/sed/tests/regress.multitest.out/5.5
new file mode 100644
index 0000000..6766fea
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.5
@@ -0,0 +1,5 @@
+^l1_1
+^l1_2
+^l1_4
+^l1_6
+^l1_8
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.6 b/usr.bin/sed/tests/regress.multitest.out/5.6
new file mode 100644
index 0000000..7ffbba3
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.6
@@ -0,0 +1,5 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.7 b/usr.bin/sed/tests/regress.multitest.out/5.7
new file mode 100644
index 0000000..f15f6e3
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.7
@@ -0,0 +1,6 @@
+l1_1
+l1_2
+l1_3
+l1_4
+hello
+l1_5
diff --git a/usr.bin/sed/tests/regress.multitest.out/5.8 b/usr.bin/sed/tests/regress.multitest.out/5.8
new file mode 100644
index 0000000..1557318
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/5.8
@@ -0,0 +1,14 @@
+m1_1
+m1_2
+m1_3
+m1_4
+m1_5
+m1_6
+m1_7
+m1_8
+m1_9
+m1_10
+m1_11
+m1_12
+m1_13
+m1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.1 b/usr.bin/sed/tests/regress.multitest.out/6.1
new file mode 100644
index 0000000..78db2a5
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.1
@@ -0,0 +1,14 @@
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
+changed
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.2 b/usr.bin/sed/tests/regress.multitest.out/6.2
new file mode 100644
index 0000000..77e5cc0
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.2
@@ -0,0 +1,13 @@
+l1_1
+l1_2
+l1_3
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.3 b/usr.bin/sed/tests/regress.multitest.out/6.3
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.3
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.4 b/usr.bin/sed/tests/regress.multitest.out/6.4
new file mode 100644
index 0000000..e9169dc
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.4
@@ -0,0 +1,20 @@
+l1_1
+l1_2
+l1_3
+l1_2
+l1_3
+l1_5
+l1_2
+l1_3
+l1_2
+l1_3
+l1_6
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.5 b/usr.bin/sed/tests/regress.multitest.out/6.5
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.5
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/6.6 b/usr.bin/sed/tests/regress.multitest.out/6.6
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/6.6
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.1 b/usr.bin/sed/tests/regress.multitest.out/7.1
new file mode 100644
index 0000000..586cac7
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.1
@@ -0,0 +1,15 @@
+\001\002\003\004\005\006\a\b\t$
+\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\
+\033\034\035\036\037 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF\
+GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\
+\177\200\201\202\203\204\205\206\207\210\211\212\213\214\
+\215\216\217\220\221\222\223\224\225\226\227\230\231\232\
+\233\234\235\236\237\240\241\242\243\244\245\246\247\250\
+\251\252\253\254\255\256\257\260\261\262\263\264\265\266\
+\267\270\271\272\273\274\275\276\277\300\301\302\303\304\
+\305\306\307\310\311\312\313\314\315\316\317\320\321\322\
+\323\324\325\326\327\330\331\332\333\334\335\336\337\340\
+\341\342\343\344\345\346\347\350\351\352\353\354\355\356\
+\357\360\361\362\363\364\365\366\367\370\371\372\373\374\
+\375\376\377$
+$
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.2 b/usr.bin/sed/tests/regress.multitest.out/7.2
new file mode 100644
index 0000000..cb8d266
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.2
@@ -0,0 +1,32 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+15
+l2_1
+16
+l2_2
+17
+l2_3
+18
+l2_4
+19
+l2_5
+20
+l2_6
+21
+l2_7
+22
+l2_8
+23
+l2_9
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.3 b/usr.bin/sed/tests/regress.multitest.out/7.3
new file mode 100644
index 0000000..c742250
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.3
@@ -0,0 +1,24 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.4 b/usr.bin/sed/tests/regress.multitest.out/7.4
new file mode 100644
index 0000000..19a9461
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.4
@@ -0,0 +1,23 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l2_1
+l2_2
+l2_3
+l2_4
+l2_5
+l2_6
+l2_7
+l2_8
+l2_9
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.5 b/usr.bin/sed/tests/regress.multitest.out/7.5
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.5
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.6 b/usr.bin/sed/tests/regress.multitest.out/7.6
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.6
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.7 b/usr.bin/sed/tests/regress.multitest.out/7.7
new file mode 100644
index 0000000..7baa931
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.7
@@ -0,0 +1,2814 @@
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+Al1_1
+Al1_2
+Al1_3
+Al1_4
+Al1_5
+Al1_6
+Al1_7
+Al1_8
+Al1_9
+Al1_10
+Al1_11
+Al1_12
+Al1_13
+Al1_14
+AaniaamaaliiaalaaaAl1_1
+AaniaamaaliiaalaaaAl1_2
+AaniaamaaliiaalaaaAl1_3
+AaniaamaaliiaalaaaAl1_4
+AaniaamaaliiaalaaaAl1_5
+AaniaamaaliiaalaaaAl1_6
+AaniaamaaliiaalaaaAl1_7
+AaniaamaaliiaalaaaAl1_8
+AaniaamaaliiaalaaaAl1_9
+AaniaamaaliiaalaaaAl1_10
+AaniaamaaliiaalaaaAl1_11
+AaniaamaaliiaalaaaAl1_12
+AaniaamaaliiaalaaaAl1_13
+AaniaamaaliiaalaaaAl1_14
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+AberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aAl1_1
+aAl1_2
+aAl1_3
+aAl1_4
+aAl1_5
+aAl1_6
+aAl1_7
+aAl1_8
+aAl1_9
+aAl1_10
+aAl1_11
+aAl1_12
+aAl1_13
+aAl1_14
+aaaAl1_1
+aaaAl1_2
+aaaAl1_3
+aaaAl1_4
+aaaAl1_5
+aaaAl1_6
+aaaAl1_7
+aaaAl1_8
+aaaAl1_9
+aaaAl1_10
+aaaAl1_11
+aaaAl1_12
+aaaAl1_13
+aaaAl1_14
+aalaaaAl1_1
+aalaaaAl1_2
+aalaaaAl1_3
+aalaaaAl1_4
+aalaaaAl1_5
+aalaaaAl1_6
+aalaaaAl1_7
+aalaaaAl1_8
+aalaaaAl1_9
+aalaaaAl1_10
+aalaaaAl1_11
+aalaaaAl1_12
+aalaaaAl1_13
+aalaaaAl1_14
+aaliiaalaaaAl1_1
+aaliiaalaaaAl1_2
+aaliiaalaaaAl1_3
+aaliiaalaaaAl1_4
+aaliiaalaaaAl1_5
+aaliiaalaaaAl1_6
+aaliiaalaaaAl1_7
+aaliiaalaaaAl1_8
+aaliiaalaaaAl1_9
+aaliiaalaaaAl1_10
+aaliiaalaaaAl1_11
+aaliiaalaaaAl1_12
+aaliiaalaaaAl1_13
+aaliiaalaaaAl1_14
+aamaaliiaalaaaAl1_1
+aamaaliiaalaaaAl1_2
+aamaaliiaalaaaAl1_3
+aamaaliiaalaaaAl1_4
+aamaaliiaalaaaAl1_5
+aamaaliiaalaaaAl1_6
+aamaaliiaalaaaAl1_7
+aamaaliiaalaaaAl1_8
+aamaaliiaalaaaAl1_9
+aamaaliiaalaaaAl1_10
+aamaaliiaalaaaAl1_11
+aamaaliiaalaaaAl1_12
+aamaaliiaalaaaAl1_13
+aamaaliiaalaaaAl1_14
+aardvarkAaniaamaaliiaalaaaAl1_1
+aardvarkAaniaamaaliiaalaaaAl1_2
+aardvarkAaniaamaaliiaalaaaAl1_3
+aardvarkAaniaamaaliiaalaaaAl1_4
+aardvarkAaniaamaaliiaalaaaAl1_5
+aardvarkAaniaamaaliiaalaaaAl1_6
+aardvarkAaniaamaaliiaalaaaAl1_7
+aardvarkAaniaamaaliiaalaaaAl1_8
+aardvarkAaniaamaaliiaalaaaAl1_9
+aardvarkAaniaamaaliiaalaaaAl1_10
+aardvarkAaniaamaaliiaalaaaAl1_11
+aardvarkAaniaamaaliiaalaaaAl1_12
+aardvarkAaniaamaaliiaalaaaAl1_13
+aardvarkAaniaamaaliiaalaaaAl1_14
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+aberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_1
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_2
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_3
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_4
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_5
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_6
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_7
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_8
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_9
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_10
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_11
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_12
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_13
+abetmentabetaberuncatoraberroscopeaberrometeraberratoraberrationalaberrationaberrateaberrantaberrancyaberranceAberiaAberdonianaberdevineAberdeenabepithymiaabentericAbencerragesabeltreeAbelonianabelmoskAbelmoschusabeliteAbeliteAbeliceaAbelianAbeliaabeleAbelabeighabedabecedaryabecedariumabecedarianabearanceabearabeamAbeabductorabductionabductabducentabducensabduceabdominovesicalabdominovaginalabdominousabdominothoracicabdominoscopyabdominoscopeabdominoposteriorabdominohysterotomyabdominohysterectomyabdominogenitalabdominocysticabdominocentesisabdominocardiacabdominoanteriorabdominallyabdominalianAbdominalesabdominalabdomenabditoryabditiveAbdielabdicatorabdicativeabdicationabdicateabdicantabdicableabdestAbderiteAbderianabdatabdalabcoulombAbbyabbreviatureabbreviatoryabbreviatorabbreviationabbreviatelyabbreviateabbotshipabbotnulliusabbotcyabbotAbbieabbeystedeabbeyabbessabbaticalabbatialAbbassideabbassiabbasiabbasAbbadideabbacyabbacomesAbbaabbabazeabaxileabaxialabaveabatureAbatuaabattoirabatorabatonabatisedabatisabaterabatementabateabatableabastardizeAbassinabaskabasicabasiaabashmentabashlesslyabashlessabashednessabashedlyabashedabashAbasgiabaserabasementabasednessabasedlyabasedabaseabasabarticulationabarticularabarthrosisAbarisAbaramboabaptistonAbantesAbanicabandonmentabandonerabandoneeabandonedlyabandonedabandonableabandonabampereAbamaabaloneabalienationabalienateabaissedabaiserabaisanceabaftabaffAbaditeabacusabaculusabactorabactionabactinallyabactinalabackabacistabaciscusabacinationabacinateabacayabacateabacaabacAbabuaAbabdehabaAbAaruAaroniticAaroniteAaronicalAaronicAaronaardwolfaardvarkAaniaamaaliiaalaaaAl1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/7.8 b/usr.bin/sed/tests/regress.multitest.out/7.8
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/7.8
@@ -0,0 +1 @@
+
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.1 b/usr.bin/sed/tests/regress.multitest.out/8.1
new file mode 100644
index 0000000..dcf124b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.1
@@ -0,0 +1,14 @@
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.10 b/usr.bin/sed/tests/regress.multitest.out/8.10
new file mode 100644
index 0000000..86f75c15
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.10
@@ -0,0 +1,14 @@
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X
+l1_X0
+l1_X1
+l1_X2
+l1_X3
+l1_X4
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.11 b/usr.bin/sed/tests/regress.multitest.out/8.11
new file mode 100644
index 0000000..70a0f11
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.11
@@ -0,0 +1,28 @@
+lX_1
+lX_2
+lX_3
+lX_4
+lX_5
+lX_6
+lX_7
+lX_8
+lX_9
+lX_10
+lX_11
+lX_12
+lX_13
+lX_14
+lX_1
+lX_2
+lX_3
+lX_4
+lX_5
+lX_6
+lX_7
+lX_8
+lX_9
+lX_10
+lX_11
+lX_12
+lX_13
+lX_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.12 b/usr.bin/sed/tests/regress.multitest.out/8.12
new file mode 100644
index 0000000..ded4e98
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.12
@@ -0,0 +1,14 @@
+lX_X
+lX_X
+lX_X
+lX_4
+lX_5
+lX_6
+lX_7
+lX_8
+lX_9
+lX_X0
+lX_XX
+lX_XX
+lX_XX
+lX_X4
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.13 b/usr.bin/sed/tests/regress.multitest.out/8.13
new file mode 100644
index 0000000..48646d1
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.13
@@ -0,0 +1,14 @@
+l8_8
+l8_7
+l8_6
+l8_5
+l8_4
+l8_3
+l8_2
+l8_1
+l8_0
+l8_89
+l8_88
+l8_87
+l8_86
+l8_85
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.14 b/usr.bin/sed/tests/regress.multitest.out/8.14
new file mode 100644
index 0000000..48646d1
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.14
@@ -0,0 +1,14 @@
+l8_8
+l8_7
+l8_6
+l8_5
+l8_4
+l8_3
+l8_2
+l8_1
+l8_0
+l8_89
+l8_88
+l8_87
+l8_86
+l8_85
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.15 b/usr.bin/sed/tests/regress.multitest.out/8.15
new file mode 100644
index 0000000..f414bb5
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.15
@@ -0,0 +1,13 @@
+l1_1Xl1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.16 b/usr.bin/sed/tests/regress.multitest.out/8.16
new file mode 100644
index 0000000..230cc08
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.16
@@ -0,0 +1,7 @@
+eeefff
+Xeefff
+XYefff
+XYeYff
+XYeYYf
+XYeYYY
+XYeYYY
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.17 b/usr.bin/sed/tests/regress.multitest.out/8.17
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.17
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.18 b/usr.bin/sed/tests/regress.multitest.out/8.18
new file mode 100644
index 0000000..833e1ba
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.18
@@ -0,0 +1,14 @@
+l1X1
+l1X2
+l1X3
+l1X4
+l1X5
+l1X6
+l1X7
+l1X8
+l1X9
+l1X10
+l1X11
+l1X12
+l1X13
+l1X14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.19 b/usr.bin/sed/tests/regress.multitest.out/8.19
new file mode 100644
index 0000000..6536cb8
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.19
@@ -0,0 +1,14 @@
+X_1
+X_2
+X_3
+X_4
+X_5
+X_6
+X_7
+X_8
+X_9
+X_10
+X_11
+X_12
+X_13
+X_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.2 b/usr.bin/sed/tests/regress.multitest.out/8.2
new file mode 100644
index 0000000..dcf124b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.2
@@ -0,0 +1,14 @@
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.20 b/usr.bin/sed/tests/regress.multitest.out/8.20
new file mode 100644
index 0000000..f9adada
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.20
@@ -0,0 +1,14 @@
+X[_1
+X[_2
+X[_3
+X[_4
+X[_5
+X[_6
+X[_7
+X[_8
+X[_9
+X[_10
+X[_11
+X[_12
+X[_13
+X[_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.21 b/usr.bin/sed/tests/regress.multitest.out/8.21
new file mode 100644
index 0000000..ec4d9e6
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.21
@@ -0,0 +1 @@
+a-b-c
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.22 b/usr.bin/sed/tests/regress.multitest.out/8.22
new file mode 100644
index 0000000..1191247
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.22
@@ -0,0 +1,2 @@
+1
+2
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.23 b/usr.bin/sed/tests/regress.multitest.out/8.23
new file mode 100644
index 0000000..c66dd65
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.23
@@ -0,0 +1 @@
+1X2
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.3 b/usr.bin/sed/tests/regress.multitest.out/8.3
new file mode 100644
index 0000000..dcf124b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.3
@@ -0,0 +1,14 @@
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
+XXXXX
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.4 b/usr.bin/sed/tests/regress.multitest.out/8.4
new file mode 100644
index 0000000..3bcc601
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.4
@@ -0,0 +1,14 @@
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_13
+l1_14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.5 b/usr.bin/sed/tests/regress.multitest.out/8.5
new file mode 100644
index 0000000..833e1ba
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.5
@@ -0,0 +1,14 @@
+l1X1
+l1X2
+l1X3
+l1X4
+l1X5
+l1X6
+l1X7
+l1X8
+l1X9
+l1X10
+l1X11
+l1X12
+l1X13
+l1X14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.6 b/usr.bin/sed/tests/regress.multitest.out/8.6
new file mode 100644
index 0000000..47c08ae
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.6
@@ -0,0 +1,14 @@
+(l)(1)(_)(1)
+(l)(1)(_)(2)
+(l)(1)(_)(3)
+(l)(1)(_)(4)
+(l)(1)(_)(5)
+(l)(1)(_)(6)
+(l)(1)(_)(7)
+(l)(1)(_)(8)
+(l)(1)(_)(9)
+(l)(1)(_)(1)(0)
+(l)(1)(_)(1)(1)
+(l)(1)(_)(1)(2)
+(l)(1)(_)(1)(3)
+(l)(1)(_)(1)(4)
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.7 b/usr.bin/sed/tests/regress.multitest.out/8.7
new file mode 100644
index 0000000..0ff0b9e
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.7
@@ -0,0 +1,14 @@
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)
+(&)(&)(&)(&)(&)
+(&)(&)(&)(&)(&)
+(&)(&)(&)(&)(&)
+(&)(&)(&)(&)(&)
+(&)(&)(&)(&)(&)
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.8 b/usr.bin/sed/tests/regress.multitest.out/8.8
new file mode 100644
index 0000000..08bbf8c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.8
@@ -0,0 +1,14 @@
+x_x1xl1
+x_x1xl2
+x_x1xl3
+x_x1xl4
+x_x1xl5
+x_x1xl6
+x_x1xl7
+x_x1xl8
+x_x1xl9
+x_x1xl10
+x_x1xl11
+x_x1xl12
+x_x1xl13
+x_x1xl14
diff --git a/usr.bin/sed/tests/regress.multitest.out/8.9 b/usr.bin/sed/tests/regress.multitest.out/8.9
new file mode 100644
index 0000000..e0cd8b5
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/8.9
@@ -0,0 +1,42 @@
+l1u0
+u1
+u21
+l1u0
+u1
+u22
+l1u0
+u1
+u23
+l1u0
+u1
+u24
+l1u0
+u1
+u25
+l1u0
+u1
+u26
+l1u0
+u1
+u27
+l1u0
+u1
+u28
+l1u0
+u1
+u29
+l1u0
+u1
+u210
+l1u0
+u1
+u211
+l1u0
+u1
+u212
+l1u0
+u1
+u213
+l1u0
+u1
+u214
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.1 b/usr.bin/sed/tests/regress.multitest.out/9.1
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.1
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.10 b/usr.bin/sed/tests/regress.multitest.out/9.10
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.10
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.11 b/usr.bin/sed/tests/regress.multitest.out/9.11
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.11
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.12 b/usr.bin/sed/tests/regress.multitest.out/9.12
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.12
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.13 b/usr.bin/sed/tests/regress.multitest.out/9.13
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.13
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.14 b/usr.bin/sed/tests/regress.multitest.out/9.14
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.14
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.15 b/usr.bin/sed/tests/regress.multitest.out/9.15
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.15
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.16 b/usr.bin/sed/tests/regress.multitest.out/9.16
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.16
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.17 b/usr.bin/sed/tests/regress.multitest.out/9.17
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.17
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.18 b/usr.bin/sed/tests/regress.multitest.out/9.18
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.18
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.19 b/usr.bin/sed/tests/regress.multitest.out/9.19
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.19
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.2 b/usr.bin/sed/tests/regress.multitest.out/9.2
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.2
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.20 b/usr.bin/sed/tests/regress.multitest.out/9.20
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.20
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.21 b/usr.bin/sed/tests/regress.multitest.out/9.21
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.21
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.22 b/usr.bin/sed/tests/regress.multitest.out/9.22
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.22
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.23 b/usr.bin/sed/tests/regress.multitest.out/9.23
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.23
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.24 b/usr.bin/sed/tests/regress.multitest.out/9.24
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.24
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.25 b/usr.bin/sed/tests/regress.multitest.out/9.25
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.25
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.26 b/usr.bin/sed/tests/regress.multitest.out/9.26
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.26
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.27 b/usr.bin/sed/tests/regress.multitest.out/9.27
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.27
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.28 b/usr.bin/sed/tests/regress.multitest.out/9.28
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.28
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.29 b/usr.bin/sed/tests/regress.multitest.out/9.29
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.29
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.3 b/usr.bin/sed/tests/regress.multitest.out/9.3
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.3
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.30 b/usr.bin/sed/tests/regress.multitest.out/9.30
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.30
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.31 b/usr.bin/sed/tests/regress.multitest.out/9.31
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.31
@@ -0,0 +1 @@
+0
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.4 b/usr.bin/sed/tests/regress.multitest.out/9.4
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.4
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.5 b/usr.bin/sed/tests/regress.multitest.out/9.5
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.5
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.6 b/usr.bin/sed/tests/regress.multitest.out/9.6
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.6
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.7 b/usr.bin/sed/tests/regress.multitest.out/9.7
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.7
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.8 b/usr.bin/sed/tests/regress.multitest.out/9.8
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.8
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/9.9 b/usr.bin/sed/tests/regress.multitest.out/9.9
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/9.9
@@ -0,0 +1 @@
+1
diff --git a/usr.bin/sed/tests/regress.multitest.out/Makefile b/usr.bin/sed/tests/regress.multitest.out/Makefile
new file mode 100644
index 0000000..aecb6ea
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/Makefile
@@ -0,0 +1,137 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.bin/sed/regress.multitest.out
+
+${PACKAGE}FILES+= 1.1
+${PACKAGE}FILES+= 1.10
+${PACKAGE}FILES+= 1.11
+${PACKAGE}FILES+= 1.12
+${PACKAGE}FILES+= 1.13
+${PACKAGE}FILES+= 1.14
+${PACKAGE}FILES+= 1.15
+${PACKAGE}FILES+= 1.16
+${PACKAGE}FILES+= 1.17
+${PACKAGE}FILES+= 1.18
+${PACKAGE}FILES+= 1.2
+${PACKAGE}FILES+= 1.3
+${PACKAGE}FILES+= 1.4
+${PACKAGE}FILES+= 1.4.1
+${PACKAGE}FILES+= 1.5
+${PACKAGE}FILES+= 1.6
+${PACKAGE}FILES+= 1.7
+${PACKAGE}FILES+= 1.8
+${PACKAGE}FILES+= 1.9
+${PACKAGE}FILES+= 2.1
+${PACKAGE}FILES+= 2.10
+${PACKAGE}FILES+= 2.11
+${PACKAGE}FILES+= 2.12
+${PACKAGE}FILES+= 2.13
+${PACKAGE}FILES+= 2.14
+${PACKAGE}FILES+= 2.15
+${PACKAGE}FILES+= 2.16
+${PACKAGE}FILES+= 2.17
+${PACKAGE}FILES+= 2.18
+${PACKAGE}FILES+= 2.19
+${PACKAGE}FILES+= 2.2
+${PACKAGE}FILES+= 2.20
+${PACKAGE}FILES+= 2.21
+${PACKAGE}FILES+= 2.22
+${PACKAGE}FILES+= 2.3
+${PACKAGE}FILES+= 2.4
+${PACKAGE}FILES+= 2.5
+${PACKAGE}FILES+= 2.6
+${PACKAGE}FILES+= 2.7
+${PACKAGE}FILES+= 2.8
+${PACKAGE}FILES+= 2.9
+${PACKAGE}FILES+= 3.1
+${PACKAGE}FILES+= 3.2
+${PACKAGE}FILES+= 3.3
+${PACKAGE}FILES+= 3.4
+${PACKAGE}FILES+= 4.1
+${PACKAGE}FILES+= 4.2
+${PACKAGE}FILES+= 4.3
+${PACKAGE}FILES+= 4.4
+${PACKAGE}FILES+= 4.5
+${PACKAGE}FILES+= 4.6
+${PACKAGE}FILES+= 4.7
+${PACKAGE}FILES+= 4.8
+${PACKAGE}FILES+= 5.1
+${PACKAGE}FILES+= 5.2
+${PACKAGE}FILES+= 5.3
+${PACKAGE}FILES+= 5.4
+${PACKAGE}FILES+= 5.5
+${PACKAGE}FILES+= 5.6
+${PACKAGE}FILES+= 5.7
+${PACKAGE}FILES+= 5.8
+${PACKAGE}FILES+= 6.1
+${PACKAGE}FILES+= 6.2
+${PACKAGE}FILES+= 6.3
+${PACKAGE}FILES+= 6.4
+${PACKAGE}FILES+= 6.5
+${PACKAGE}FILES+= 6.6
+${PACKAGE}FILES+= 7.1
+${PACKAGE}FILES+= 7.2
+${PACKAGE}FILES+= 7.3
+${PACKAGE}FILES+= 7.4
+${PACKAGE}FILES+= 7.5
+${PACKAGE}FILES+= 7.6
+${PACKAGE}FILES+= 7.7
+${PACKAGE}FILES+= 7.8
+${PACKAGE}FILES+= 8.1
+${PACKAGE}FILES+= 8.10
+${PACKAGE}FILES+= 8.11
+${PACKAGE}FILES+= 8.12
+${PACKAGE}FILES+= 8.13
+${PACKAGE}FILES+= 8.14
+${PACKAGE}FILES+= 8.15
+${PACKAGE}FILES+= 8.16
+${PACKAGE}FILES+= 8.17
+${PACKAGE}FILES+= 8.18
+${PACKAGE}FILES+= 8.19
+${PACKAGE}FILES+= 8.2
+${PACKAGE}FILES+= 8.20
+${PACKAGE}FILES+= 8.21
+${PACKAGE}FILES+= 8.22
+${PACKAGE}FILES+= 8.23
+${PACKAGE}FILES+= 8.3
+${PACKAGE}FILES+= 8.4
+${PACKAGE}FILES+= 8.5
+${PACKAGE}FILES+= 8.6
+${PACKAGE}FILES+= 8.7
+${PACKAGE}FILES+= 8.8
+${PACKAGE}FILES+= 8.9
+${PACKAGE}FILES+= 9.1
+${PACKAGE}FILES+= 9.10
+${PACKAGE}FILES+= 9.11
+${PACKAGE}FILES+= 9.12
+${PACKAGE}FILES+= 9.13
+${PACKAGE}FILES+= 9.14
+${PACKAGE}FILES+= 9.15
+${PACKAGE}FILES+= 9.16
+${PACKAGE}FILES+= 9.17
+${PACKAGE}FILES+= 9.18
+${PACKAGE}FILES+= 9.19
+${PACKAGE}FILES+= 9.2
+${PACKAGE}FILES+= 9.20
+${PACKAGE}FILES+= 9.21
+${PACKAGE}FILES+= 9.22
+${PACKAGE}FILES+= 9.23
+${PACKAGE}FILES+= 9.24
+${PACKAGE}FILES+= 9.25
+${PACKAGE}FILES+= 9.26
+${PACKAGE}FILES+= 9.27
+${PACKAGE}FILES+= 9.28
+${PACKAGE}FILES+= 9.29
+${PACKAGE}FILES+= 9.3
+${PACKAGE}FILES+= 9.30
+${PACKAGE}FILES+= 9.31
+${PACKAGE}FILES+= 9.4
+${PACKAGE}FILES+= 9.5
+${PACKAGE}FILES+= 9.6
+${PACKAGE}FILES+= 9.7
+${PACKAGE}FILES+= 9.8
+${PACKAGE}FILES+= 9.9
+
+.include <bsd.test.mk>
diff --git a/usr.bin/sed/tests/regress.multitest.out/Makefile.depend b/usr.bin/sed/tests/regress.multitest.out/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.multitest.out/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/sed/tests/regress.not.out b/usr.bin/sed/tests/regress.not.out
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/usr.bin/sed/tests/regress.not.out
@@ -0,0 +1 @@
+foo
diff --git a/usr.bin/sed/tests/regress.psl.out b/usr.bin/sed/tests/regress.psl.out
new file mode 100644
index 0000000..8b38f4d
--- /dev/null
+++ b/usr.bin/sed/tests/regress.psl.out
@@ -0,0 +1,4 @@
+
+
+
+of sed(1)
diff --git a/usr.bin/sed/tests/regress.s3.out b/usr.bin/sed/tests/regress.s3.out
new file mode 100644
index 0000000..68dfa9b
--- /dev/null
+++ b/usr.bin/sed/tests/regress.s3.out
@@ -0,0 +1 @@
+fo,o
diff --git a/usr.bin/sed/tests/regress.s4.out b/usr.bin/sed/tests/regress.s4.out
new file mode 100644
index 0000000..03914ba
--- /dev/null
+++ b/usr.bin/sed/tests/regress.s4.out
@@ -0,0 +1 @@
+foo,
diff --git a/usr.bin/sed/tests/regress.s5.out b/usr.bin/sed/tests/regress.s5.out
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/usr.bin/sed/tests/regress.s5.out
@@ -0,0 +1 @@
+foo
diff --git a/usr.bin/sed/tests/regress.sg.out b/usr.bin/sed/tests/regress.sg.out
new file mode 100644
index 0000000..7b24f2c
--- /dev/null
+++ b/usr.bin/sed/tests/regress.sg.out
@@ -0,0 +1 @@
+,f,o,o,
diff --git a/usr.bin/sed/tests/regress.sh b/usr.bin/sed/tests/regress.sh
new file mode 100644
index 0000000..ad05bfe
--- /dev/null
+++ b/usr.bin/sed/tests/regress.sh
@@ -0,0 +1,75 @@
+# $FreeBSD$
+
+REGRESSION_START($1)
+
+echo '1..26'
+
+REGRESSION_TEST(`G', `sed G <${SRCDIR}/regress.in')
+REGRESSION_TEST(`P', `sed P <${SRCDIR}/regress.in')
+REGRESSION_TEST(`psl', `sed \$!g\;P\;D <${SRCDIR}/regress.in')
+REGRESSION_TEST(`bcb', `sed s/X/$(jot -n -bx -s "" 2043)\\\\zz/ <${SRCDIR}/regress.in')
+REGRESSION_TEST(`y', `echo -n foo | sed y/o/O/')
+REGRESSION_TEST(`sg', `echo foo | sed s/,*/,/g')
+REGRESSION_TEST(`s3', `echo foo | sed s/,*/,/3')
+REGRESSION_TEST(`s4', `echo foo | sed s/,*/,/4')
+REGRESSION_TEST(`s5', `echo foo | sed s/,*/,/5')
+REGRESSION_TEST(`c0', `sed ''`c\
+foo
+''`<${SRCDIR}/regress.in')
+REGRESSION_TEST(`c1', `sed ''`4,$c\
+foo
+''`<${SRCDIR}/regress.in')
+REGRESSION_TEST(`c2', `sed ''`3,9c\
+foo
+''`<${SRCDIR}/regress.in')
+REGRESSION_TEST(`c3', `sed ''`3,/no such string/c\
+foo
+''`<${SRCDIR}/regress.in')
+REGRESSION_TEST(`b2a', `sed ''`2,3b
+1,2d''` <${SRCDIR}/regress.in')
+
+`
+inplace_test()
+{
+ expr="$1"
+ rc=0
+ ns=$(jot 5)
+ ins= outs= _ins=
+ for n in $ns; do
+ jot -w "l${n}_%d" 9 | tee lines.in.$n lines._in.$n | \
+ sed "$expr" > lines.out.$n
+ ins="$ins lines.in.$n"
+ outs="$outs lines.out.$n"
+ _ins="$_ins lines._in.$n"
+ done
+ sed "$expr" $_ins > lines.out
+
+ sed -i "" "$expr" $ins
+ sed -I "" "$expr" $_ins
+
+ for n in $ns; do
+ diff -u lines.out.$n lines.in.$n || rc=1
+ done
+ cat $_ins | diff -u lines.out - || rc=1
+ rm -f $ins $outs $_ins lines.out
+
+ return $rc
+}
+'
+
+REGRESSION_TEST_FREEFORM(`inplace1', `inplace_test 3,6d')
+REGRESSION_TEST_FREEFORM(`inplace2', `inplace_test 8,30d')
+REGRESSION_TEST_FREEFORM(`inplace3', `inplace_test 20,99d')
+REGRESSION_TEST_FREEFORM(`inplace4', `inplace_test "{;{;8,30d;};}"')
+REGRESSION_TEST_FREEFORM(`inplace5', `inplace_test "3x;6G"')
+
+REGRESSION_TEST(`icase1', `sed /SED/Id <${SRCDIR}/regress.in')
+REGRESSION_TEST(`icase2', `sed s/SED/Foo/I <${SRCDIR}/regress.in')
+REGRESSION_TEST(`icase3', `sed s/SED/Foo/ <${SRCDIR}/regress.in')
+REGRESSION_TEST(`icase4', `sed s/SED/Foo/i <${SRCDIR}/regress.in')
+
+REGRESSION_TEST(`hanoi', `echo ":abcd: : :" | sed -f ${SRCDIR}/hanoi.sed')
+REGRESSION_TEST(`math', `echo "4+7*3+2^7/3" | sed -f ${SRCDIR}/math.sed')
+REGRESSION_TEST(`not', `echo foo | sed "1!!s/foo/bar/"')
+
+REGRESSION_END()
diff --git a/usr.bin/sed/tests/regress.y.out b/usr.bin/sed/tests/regress.y.out
new file mode 100644
index 0000000..22f4f05
--- /dev/null
+++ b/usr.bin/sed/tests/regress.y.out
@@ -0,0 +1 @@
+fOO \ No newline at end of file
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/Makefile.depend b/usr.bin/send-pr/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/send-pr/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
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/seq/Makefile b/usr.bin/seq/Makefile
new file mode 100644
index 0000000..bb3c295
--- /dev/null
+++ b/usr.bin/seq/Makefile
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.3 2009/04/14 22:15:26 lukem Exp $
+# $FreeBSD$
+
+PROG= seq
+
+LIBADD= m
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/seq/Makefile.depend b/usr.bin/seq/Makefile.depend
new file mode 100644
index 0000000..c9f9d52
--- /dev/null
+++ b/usr.bin/seq/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/seq/seq.1 b/usr.bin/seq/seq.1
new file mode 100644
index 0000000..12dd184
--- /dev/null
+++ b/usr.bin/seq/seq.1
@@ -0,0 +1,188 @@
+.\" $NetBSD: seq.1,v 1.8 2013/04/07 17:37:45 jdf Exp $
+.\"
+.\" Copyright (c) 2005 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Brian Ginsbach.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 September 10, 2013
+.Dt SEQ 1
+.Os
+.Sh NAME
+.Nm seq
+.Nd print sequences of numbers
+.Sh SYNOPSIS
+.Nm
+.Op Fl w
+.Op Fl f Ar format
+.Op Fl s Ar string
+.Op Fl t Ar string
+.Op Ar first Op Ar incr
+.Ar last
+.Sh DESCRIPTION
+The
+.Nm
+utility prints a sequence of numbers, one per line
+.Pq default ,
+from
+.Ar first
+.Pq default 1 ,
+to near
+.Ar last
+as possible, in increments of
+.Ar incr
+.Pq default 1 .
+When
+.Ar first
+is larger than
+.Ar last ,
+the default
+.Ar incr
+is -1.
+.Pp
+All numbers are interpreted as floating point.
+.Pp
+Normally integer values are printed as decimal integers.
+.Pp
+The
+.Nm
+utility accepts the following options:
+.Bl -tag -width Ar
+.It Fl f Ar format
+Use a
+.Xr printf 3
+style
+.Ar format
+to print each number.
+Only the
+.Cm A ,
+.Cm a ,
+.Cm E ,
+.Cm e ,
+.Cm F ,
+.Cm f ,
+.Cm G ,
+.Cm g ,
+and
+.Cm %
+conversion characters are valid, along with any optional
+flags and an optional numeric minimum field width or precision.
+The
+.Ar format
+can contain character escape sequences in backslash notation as
+defined in
+.St -ansiC .
+The default is
+.Cm %g .
+.It Fl s Ar string
+Use
+.Ar string
+to separate numbers.
+The
+.Ar string
+can contain character escape sequences in backslash notation as
+defined in
+.St -ansiC .
+The default is
+.Cm \en .
+.It Fl t Ar string
+Use
+.Ar string
+to terminate sequence of numbers.
+The
+.Ar string
+can contain character escape sequences in backslash notation as
+defined in
+.St -ansiC .
+This option is useful when the default separator
+does not contain a
+.Cm \en .
+.It Fl w
+Equalize the widths of all numbers by padding with zeros as necessary.
+This option has no effect with the
+.Fl f
+option.
+If any sequence numbers will be printed in exponential notation,
+the default conversion is changed to
+.Cm %e .
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Bd -literal -offset indent
+# seq 1 3
+1
+2
+3
+
+# seq 3 1
+3
+2
+1
+
+# seq -w 0 .05 .1
+0.00
+0.05
+0.10
+.Ed
+.Sh SEE ALSO
+.Xr jot 1 ,
+.Xr printf 1 ,
+.Xr printf 3
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Tn "Plan 9 from Bell Labs" .
+A
+.Nm
+command appeared in
+.Nx 3.0 ,
+and ported to
+.Fx 9.0 .
+This command was based on the command of the same name in
+.Tn "Plan 9 from Bell Labs"
+and the
+.Tn GNU
+core utilities.
+The
+.Tn GNU
+.Nm
+command first appeared in the 1.13 shell utilities release.
+.Sh BUGS
+The
+.Fl w
+option does not handle the transition from pure floating point
+to exponent representation very well.
+The
+.Nm
+command is not bug for bug compatible with the
+.Tn "Plan 9 from Bell Labs"
+or
+.Tn GNU
+versions of
+.Nm .
diff --git a/usr.bin/seq/seq.c b/usr.bin/seq/seq.c
new file mode 100644
index 0000000..6d715e1
--- /dev/null
+++ b/usr.bin/seq/seq.c
@@ -0,0 +1,471 @@
+/* $NetBSD: seq.c,v 1.7 2010/05/27 08:40:19 dholland Exp $ */
+/*
+ * Copyright (c) 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Brian Ginsbach.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <math.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define ZERO '0'
+#define SPACE ' '
+
+#define MAX(a, b) (((a) < (b))? (b) : (a))
+#define ISSIGN(c) ((int)(c) == '-' || (int)(c) == '+')
+#define ISEXP(c) ((int)(c) == 'e' || (int)(c) == 'E')
+#define ISODIGIT(c) ((int)(c) >= '0' && (int)(c) <= '7')
+
+/* Globals */
+
+static const char *decimal_point = "."; /* default */
+static char default_format[] = { "%g" }; /* default */
+
+/* Prototypes */
+
+static double e_atof(const char *);
+
+static int decimal_places(const char *);
+static int numeric(const char *);
+static int valid_format(const char *);
+
+static char *generate_format(double, double, double, int, char);
+static char *unescape(char *);
+
+/*
+ * The seq command will print out a numeric sequence from 1, the default,
+ * to a user specified upper limit by 1. The lower bound and increment
+ * maybe indicated by the user on the command line. The sequence can
+ * be either whole, the default, or decimal numbers.
+ */
+int
+main(int argc, char *argv[])
+{
+ int c = 0, errflg = 0;
+ int equalize = 0;
+ double first = 1.0;
+ double last = 0.0;
+ double incr = 0.0;
+ struct lconv *locale;
+ char *fmt = NULL;
+ const char *sep = "\n";
+ const char *term = NULL;
+ char pad = ZERO;
+
+ /* Determine the locale's decimal point. */
+ locale = localeconv();
+ if (locale && locale->decimal_point && locale->decimal_point[0] != '\0')
+ decimal_point = locale->decimal_point;
+
+ /*
+ * Process options, but handle negative numbers separately
+ * least they trip up getopt(3).
+ */
+ while ((optind < argc) && !numeric(argv[optind]) &&
+ (c = getopt(argc, argv, "f:hs:t:w")) != -1) {
+
+ switch (c) {
+ case 'f': /* format (plan9) */
+ fmt = optarg;
+ equalize = 0;
+ break;
+ case 's': /* separator (GNU) */
+ sep = unescape(optarg);
+ break;
+ case 't': /* terminator (new) */
+ term = unescape(optarg);
+ break;
+ case 'w': /* equal width (plan9) */
+ if (!fmt)
+ if (equalize++)
+ pad = SPACE;
+ break;
+ case 'h': /* help (GNU) */
+ default:
+ errflg++;
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ if (argc < 1 || argc > 3)
+ errflg++;
+
+ if (errflg) {
+ fprintf(stderr,
+ "usage: %s [-w] [-f format] [-s string] [-t string] [first [incr]] last\n",
+ getprogname());
+ exit(1);
+ }
+
+ last = e_atof(argv[argc - 1]);
+
+ if (argc > 1)
+ first = e_atof(argv[0]);
+
+ if (argc > 2) {
+ incr = e_atof(argv[1]);
+ /* Plan 9/GNU don't do zero */
+ if (incr == 0.0)
+ errx(1, "zero %screment", (first < last)? "in" : "de");
+ }
+
+ /* default is one for Plan 9/GNU work alike */
+ if (incr == 0.0)
+ incr = (first < last) ? 1.0 : -1.0;
+
+ if (incr <= 0.0 && first < last)
+ errx(1, "needs positive increment");
+
+ if (incr >= 0.0 && first > last)
+ errx(1, "needs negative decrement");
+
+ if (fmt != NULL) {
+ if (!valid_format(fmt))
+ errx(1, "invalid format string: `%s'", fmt);
+ fmt = unescape(fmt);
+ if (!valid_format(fmt))
+ errx(1, "invalid format string");
+ /*
+ * XXX to be bug for bug compatible with Plan 9 add a
+ * newline if none found at the end of the format string.
+ */
+ } else
+ fmt = generate_format(first, incr, last, equalize, pad);
+
+ if (incr > 0) {
+ for (; first <= last; first += incr) {
+ printf(fmt, first);
+ fputs(sep, stdout);
+ }
+ } else {
+ for (; first >= last; first += incr) {
+ printf(fmt, first);
+ fputs(sep, stdout);
+ }
+ }
+ if (term != NULL)
+ fputs(term, stdout);
+
+ return (0);
+}
+
+/*
+ * numeric - verify that string is numeric
+ */
+static int
+numeric(const char *s)
+{
+ int seen_decimal_pt, decimal_pt_len;
+
+ /* skip any sign */
+ if (ISSIGN((unsigned char)*s))
+ s++;
+
+ seen_decimal_pt = 0;
+ decimal_pt_len = strlen(decimal_point);
+ while (*s) {
+ if (!isdigit((unsigned char)*s)) {
+ if (!seen_decimal_pt &&
+ strncmp(s, decimal_point, decimal_pt_len) == 0) {
+ s += decimal_pt_len;
+ seen_decimal_pt = 1;
+ continue;
+ }
+ if (ISEXP((unsigned char)*s)) {
+ s++;
+ if (ISSIGN((unsigned char)*s) ||
+ isdigit((unsigned char)*s)) {
+ s++;
+ continue;
+ }
+ }
+ break;
+ }
+ s++;
+ }
+ return (*s == '\0');
+}
+
+/*
+ * valid_format - validate user specified format string
+ */
+static int
+valid_format(const char *fmt)
+{
+ unsigned conversions = 0;
+
+ while (*fmt != '\0') {
+ /* scan for conversions */
+ if (*fmt != '%') {
+ fmt++;
+ continue;
+ }
+ fmt++;
+
+ /* allow %% but not things like %10% */
+ if (*fmt == '%') {
+ fmt++;
+ continue;
+ }
+
+ /* flags */
+ while (*fmt != '\0' && strchr("#0- +'", *fmt)) {
+ fmt++;
+ }
+
+ /* field width */
+ while (*fmt != '\0' && strchr("0123456789", *fmt)) {
+ fmt++;
+ }
+
+ /* precision */
+ if (*fmt == '.') {
+ fmt++;
+ while (*fmt != '\0' && strchr("0123456789", *fmt)) {
+ fmt++;
+ }
+ }
+
+ /* conversion */
+ switch (*fmt) {
+ case 'A':
+ case 'a':
+ case 'E':
+ case 'e':
+ case 'F':
+ case 'f':
+ case 'G':
+ case 'g':
+ /* floating point formats are accepted */
+ conversions++;
+ break;
+ default:
+ /* anything else is not */
+ return 0;
+ }
+ }
+
+ return (conversions <= 1);
+}
+
+/*
+ * unescape - handle C escapes in a string
+ */
+static char *
+unescape(char *orig)
+{
+ char c, *cp, *new = orig;
+ int i;
+
+ for (cp = orig; (*orig = *cp); cp++, orig++) {
+ if (*cp != '\\')
+ continue;
+
+ switch (*++cp) {
+ case 'a': /* alert (bell) */
+ *orig = '\a';
+ continue;
+ case 'b': /* backspace */
+ *orig = '\b';
+ continue;
+ case 'e': /* escape */
+ *orig = '\e';
+ continue;
+ case 'f': /* formfeed */
+ *orig = '\f';
+ continue;
+ case 'n': /* newline */
+ *orig = '\n';
+ continue;
+ case 'r': /* carriage return */
+ *orig = '\r';
+ continue;
+ case 't': /* horizontal tab */
+ *orig = '\t';
+ continue;
+ case 'v': /* vertical tab */
+ *orig = '\v';
+ continue;
+ case '\\': /* backslash */
+ *orig = '\\';
+ continue;
+ case '\'': /* single quote */
+ *orig = '\'';
+ continue;
+ case '\"': /* double quote */
+ *orig = '"';
+ continue;
+ case '0':
+ case '1':
+ case '2':
+ case '3': /* octal */
+ case '4':
+ case '5':
+ case '6':
+ case '7': /* number */
+ for (i = 0, c = 0;
+ ISODIGIT((unsigned char)*cp) && i < 3;
+ i++, cp++) {
+ c <<= 3;
+ c |= (*cp - '0');
+ }
+ *orig = c;
+ --cp;
+ continue;
+ case 'x': /* hexadecimal number */
+ cp++; /* skip 'x' */
+ for (i = 0, c = 0;
+ isxdigit((unsigned char)*cp) && i < 2;
+ i++, cp++) {
+ c <<= 4;
+ if (isdigit((unsigned char)*cp))
+ c |= (*cp - '0');
+ else
+ c |= ((toupper((unsigned char)*cp) -
+ 'A') + 10);
+ }
+ *orig = c;
+ --cp;
+ continue;
+ default:
+ --cp;
+ break;
+ }
+ }
+
+ return (new);
+}
+
+/*
+ * e_atof - convert an ASCII string to a double
+ * exit if string is not a valid double, or if converted value would
+ * cause overflow or underflow
+ */
+static double
+e_atof(const char *num)
+{
+ char *endp;
+ double dbl;
+
+ errno = 0;
+ dbl = strtod(num, &endp);
+
+ if (errno == ERANGE)
+ /* under or overflow */
+ err(2, "%s", num);
+ else if (*endp != '\0')
+ /* "junk" left in number */
+ errx(2, "invalid floating point argument: %s", num);
+
+ /* zero shall have no sign */
+ if (dbl == -0.0)
+ dbl = 0;
+ return (dbl);
+}
+
+/*
+ * decimal_places - count decimal places in a number (string)
+ */
+static int
+decimal_places(const char *number)
+{
+ int places = 0;
+ char *dp;
+
+ /* look for a decimal point */
+ if ((dp = strstr(number, decimal_point))) {
+ dp += strlen(decimal_point);
+
+ while (isdigit((unsigned char)*dp++))
+ places++;
+ }
+ return (places);
+}
+
+/*
+ * generate_format - create a format string
+ *
+ * XXX to be bug for bug compatible with Plan9 and GNU return "%g"
+ * when "%g" prints as "%e" (this way no width adjustments are made)
+ */
+static char *
+generate_format(double first, double incr, double last, int equalize, char pad)
+{
+ static char buf[256];
+ char cc = '\0';
+ int precision, width1, width2, places;
+
+ if (equalize == 0)
+ return (default_format);
+
+ /* figure out "last" value printed */
+ if (first > last)
+ last = first - incr * floor((first - last) / incr);
+ else
+ last = first + incr * floor((last - first) / incr);
+
+ sprintf(buf, "%g", incr);
+ if (strchr(buf, 'e'))
+ cc = 'e';
+ precision = decimal_places(buf);
+
+ width1 = sprintf(buf, "%g", first);
+ if (strchr(buf, 'e'))
+ cc = 'e';
+ if ((places = decimal_places(buf)))
+ width1 -= (places + strlen(decimal_point));
+
+ precision = MAX(places, precision);
+
+ width2 = sprintf(buf, "%g", last);
+ if (strchr(buf, 'e'))
+ cc = 'e';
+ if ((places = decimal_places(buf)))
+ width2 -= (places + strlen(decimal_point));
+
+ if (precision) {
+ sprintf(buf, "%%%c%d.%d%c", pad,
+ MAX(width1, width2) + (int) strlen(decimal_point) +
+ precision, precision, (cc) ? cc : 'f');
+ } else {
+ sprintf(buf, "%%%c%d%c", pad, MAX(width1, width2),
+ (cc) ? cc : 'g');
+ }
+
+ return (buf);
+}
diff --git a/usr.bin/setchannel/Makefile b/usr.bin/setchannel/Makefile
new file mode 100644
index 0000000..0ffb330
--- /dev/null
+++ b/usr.bin/setchannel/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= setchannel
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/setchannel/Makefile.depend b/usr.bin/setchannel/Makefile.depend
new file mode 100644
index 0000000..79eb58b
--- /dev/null
+++ b/usr.bin/setchannel/Makefile.depend
@@ -0,0 +1,16 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/setchannel/setchannel.1 b/usr.bin/setchannel/setchannel.1
new file mode 100644
index 0000000..d0c865e
--- /dev/null
+++ b/usr.bin/setchannel/setchannel.1
@@ -0,0 +1,103 @@
+.\"-
+.\" Copyright (C) 2004-2006 The FreeBSD Project. 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 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 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.
+.\"
+.\" $Id: cxm.4,v 1.1 2004/10/16 00:12:35 mavetju Exp $
+.\" $FreeBSD$
+.\"
+.Dd November 30, 2006
+.Dt PVR250-SETCHANNEL 1
+.Os
+.Sh NAME
+.Nm pvr250-setchannel
+.Nd Hauppage PVR250/350 channel selector
+.Sh SYNOPSIS
+.Cd pvr250-setchannel [-a {on | off}] [-c | -r | -s | -t] [-g geom] [-m channel_set] [channel | freq]
+.Sh DESCRIPTION
+.Nm
+provides support for selecting channels on Hauppauge WinTV cards,
+including the PVR 150, PVR 250, PVR 350 and PVR 500.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a Cm on
+Enable AFC.
+.It Fl a Cm off
+Disable AFC.
+.It Fl c
+Select composite input.
+.It Fl d
+Select the tuner unit number.
+This is appended to the base device file name
+.Pa /dev/cxm
+to form a device name such as
+.Pa /dev/cxm0
+or
+.Pa /dev/cxm1 .
+.It Fl r
+Select radio input.
+.It Fl s
+Select svideo input.
+.It Fl t
+Select tuner.
+.It Fl g Cm geom
+Select geometry. The first resolution is for NTSC, the second for
+PAL.
+.Pp
+ VCD: 352x240 or 352x288
+ SVCD: 480x480 or 480x576
+ DVD (half D1): 352x480 or 352x576
+ DVD (full D1): 720x480 or 720x576
+.It Fl m Cm channel-set
+Select channel set and system.
+.Pp
+ 0 = Tuner Default
+ 1 = US Broadcast (NTSC)
+ 2 = US Cable (NTSC)
+ 4 = Western Europe (PAL)
+ 5 = Japan Broadcast (NTSC)
+ 6 = Japan Cable (NTSC)
+ 8 = Australia (PAL)
+ 9 = France (SECAM)
+.It Cm channel
+Channel number to set.
+.It Cm freq
+Frequency in MHz (must include decimal point).
+.El
+.Sh SEE ALSO
+.Xr bktr 4 ,
+.Xr cxm 4 ,
+.Xr meteor 4
+.Sh HISTORY
+The
+.Nm
+program first appeared in the -multimedia mailing-list in January 2004. The
+.Nm
+program first appeared in the FreeBSD Ports collection in October 2004.
+.Sh AUTHORS
+.An -nosplit
+This program is made by
+.An John Wehle <john@feith.com>
+.Pp
+This man page is made by
+.An Edwin Groothuis <edwin@FreeBSD.org>
diff --git a/usr.bin/setchannel/setchannel.c b/usr.bin/setchannel/setchannel.c
new file mode 100644
index 0000000..e7b00fe
--- /dev/null
+++ b/usr.bin/setchannel/setchannel.c
@@ -0,0 +1,285 @@
+/*-
+ * Copyright (c) 2003, 2004, 2005
+ * John Wehle <john@feith.com>. 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 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 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$
+ */
+
+/* Set the channel of the tuner card. */
+
+#include <sys/ioctl.h>
+#include <sys/param.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <dev/bktr/ioctl_meteor.h>
+#include <dev/bktr/ioctl_bt848.h>
+
+static void
+usage(void)
+{
+ printf
+ ("Usage: setchannel [-a {on|off}] [-c | -r | -s | -t] "
+ "[-g geom] [-m chnl_set] [chnl | freq]\n"
+ " -a Enable / disable AFC.\n"
+ " -c Select composite input.\n"
+ " -d Select tuner unit number.\n"
+ " -r Select radio input.\n"
+ " -s Select svideo input.\n"
+ " -t Select tuner.\n"
+ " -g Select geometry.\n"
+ " 352x240 or 352x288 = VCD\n"
+ " 480x480 or 480x576 = SVCD\n"
+ " 352x480 or 352x576 = DVD (half D1)\n"
+ " 720x480 or 720x576 = DVD (full D1)\n"
+ " -m Select channel set / system.\n"
+ " 0 = Tuner Default\n"
+ " %u = US Broadcast / NTSC\n"
+ " %u = US Cable / NTSC\n"
+ " %u = Western Europe / PAL\n"
+ " %u = Japan Broadcast / NTSC\n"
+ " %u = Japan Cable / NTSC\n"
+ " %u = Australia / PAL\n"
+ " %u = France / SECAM\n"
+ " chnl Channel\n"
+ " freq Frequency in MHz (must include decimal point).\n",
+ CHNLSET_NABCST, CHNLSET_CABLEIRC, CHNLSET_WEUROPE, CHNLSET_JPNBCST,
+ CHNLSET_JPNCABLE, CHNLSET_AUSTRALIA, CHNLSET_FRANCE);
+}
+
+#define DEVNAME_BASE "/dev/cxm"
+char dev_name[16];
+
+int
+main(int argc, char *argv[])
+{
+ char *ptr;
+ char *endptr;
+ int afc;
+ int audio;
+ int c;
+ int channel_set;
+ int i;
+ int status;
+ int unit;
+ int tfd;
+ unsigned int channel;
+ unsigned int fraction;
+ unsigned int freq;
+ unsigned int x_size;
+ unsigned int y_size;
+ unsigned long device;
+ struct bktr_capture_area cap;
+
+ afc = -1;
+ audio = -1;
+ channel = 0;
+ channel_set = -1;
+ device = 0;
+ freq = 0;
+ status = 0;
+ unit = 0;
+ x_size = 0;
+ y_size = 0;
+
+ while ((c = getopt(argc, argv, "a:cd:rg:m:st")) != -1)
+ switch (c) {
+
+ case 'a':
+ if (strcasecmp(optarg, "on") == 0)
+ afc = 1;
+ else if (strcasecmp(optarg, "off") == 0)
+ afc = 0;
+ else {
+ usage();
+ exit(1);
+ }
+ break;
+
+ case 'c':
+ device = METEOR_INPUT_DEV2;
+ audio = -1;
+ break;
+
+ case 'd':
+ unit = atoi(optarg);
+ break;
+
+ case 'r':
+ device = 0;
+ audio = AUDIO_INTERN;
+ break;
+
+ case 's':
+ device = METEOR_INPUT_DEV_SVIDEO;
+ audio = -1;
+ break;
+
+ case 't':
+ device = METEOR_INPUT_DEV1;
+ audio = -1;
+ break;
+
+ case 'g':
+ if (sscanf(optarg, "%ux%u", &x_size, &y_size) != 2
+ || x_size == 0 || y_size == 0) {
+ usage();
+ exit(1);
+ }
+ break;
+
+ case 'm':
+ channel_set = atoi(optarg);
+ if (channel_set < 0 || channel_set > CHNLSET_MAX) {
+ usage();
+ exit(1);
+ }
+ break;
+
+ default:
+ usage();
+ exit(1);
+ }
+
+ if (optind < argc) {
+
+ /*
+ * A number containing a decimal point is the frequency in MHz.
+ */
+
+ if ((ptr = strchr(argv[optind], '.')) != NULL) {
+ freq = strtol(argv[optind], &endptr, 10) * 1000;
+ if (ptr != endptr) {
+ usage();
+ exit(1);
+ }
+
+ ptr++;
+
+ fraction = strtol(ptr, &endptr, 10);
+ if (!isdigit(*ptr) || *endptr != '\0') {
+ usage();
+ exit(1);
+ }
+
+ for (i = endptr - ptr; i > 3; i--)
+ fraction /= 10;
+ for (; i < 3; i++)
+ fraction *= 10;
+
+ freq += fraction;
+ }
+
+ /* An integer is the channel. */
+ else
+ channel = atoi(argv[optind]);
+ }
+
+ if (afc == -1 && audio == -1 && !device && x_size == 0 && y_size == 0
+ && channel_set == -1 && !channel && !freq) {
+ usage();
+ exit(1);
+ }
+
+ sprintf(dev_name, DEVNAME_BASE "%d", unit);
+ tfd = open(dev_name, O_RDONLY);
+ if (tfd < 0) {
+ fprintf(stderr, "Can't open %s: %s (%d)\n", dev_name,
+ strerror(errno), errno);
+ exit(1);
+ }
+
+ if (afc != -1)
+ if (ioctl(tfd, TVTUNER_SETAFC, &afc) < 0) {
+ perror("ioctl(tfd, TVTUNER_SETAFC) failed.");
+ status = 1;
+ }
+
+ if (device)
+ if (ioctl(tfd, METEORSINPUT, &device) < 0) {
+ perror("ioctl(tfd, METEORSINPUT) failed.");
+ status = 1;
+ }
+
+ if (audio != -1)
+ if (ioctl(tfd, BT848_SAUDIO, &audio) < 0) {
+ perror("ioctl(tfd, BT848_SAUDIO) failed.");
+ status = 1;
+ }
+
+ if (ioctl(tfd, BT848_GAUDIO, &audio) < 0) {
+ perror("ioctl(tfd, BT848_GAUDIO) failed.");
+ status = 1;
+ }
+
+ if (x_size && y_size) {
+ memset(&cap, 0, sizeof(cap));
+ cap.x_size = x_size;
+ cap.y_size = y_size;
+ if (ioctl(tfd, BT848_SCAPAREA, &cap) < 0) {
+ perror("ioctl(tfd, BT848_SCAPAREA) failed.");
+ status = 1;
+ }
+ }
+
+ if (channel_set != -1)
+ if (ioctl(tfd, TVTUNER_SETTYPE, &channel_set) < 0) {
+ perror("ioctl(tfd, TVTUNER_SETTYPE) failed.");
+ status = 1;
+ }
+
+ if (channel) {
+ if (ioctl(tfd, TVTUNER_SETCHNL, &channel) < 0) {
+ perror("ioctl(tfd, TVTUNER_SETCHNL) failed.");
+ status = 1;
+ }
+ } else if (freq) {
+ if (audio == AUDIO_INTERN) {
+ /* Convert from kHz to MHz * 100 */
+ freq = freq / 10;
+
+ if (ioctl(tfd, RADIO_SETFREQ, &freq) < 0) {
+ perror("ioctl(tfd, RADIO_SETFREQ) failed.");
+ status = 1;
+ }
+ } else {
+ /* Convert from kHz to MHz * 16 */
+ freq = (freq * 16) / 1000;
+
+ if (ioctl(tfd, TVTUNER_SETFREQ, &freq) < 0) {
+ perror("ioctl(tfd, TVTUNER_SETFREQ) failed.");
+ status = 1;
+ }
+ }
+ }
+
+ close(tfd);
+ exit(status);
+}
diff --git a/usr.bin/shar/Makefile b/usr.bin/shar/Makefile
new file mode 100644
index 0000000..9970eb5
--- /dev/null
+++ b/usr.bin/shar/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+SCRIPTS=shar.sh
+MAN= shar.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/shar/Makefile.depend b/usr.bin/shar/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/shar/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/shar/shar.1 b/usr.bin/shar/shar.1
new file mode 100644
index 0000000..38757ab
--- /dev/null
+++ b/usr.bin/shar/shar.1
@@ -0,0 +1,107 @@
+.\" Copyright (c) 1990, 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.
+.\"
+.\" @(#)shar.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt SHAR 1
+.Os
+.Sh NAME
+.Nm shar
+.Nd create a shell archive of files
+.Sh SYNOPSIS
+.Nm
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+command writes a
+.Xr sh 1
+shell script to the standard output which will recreate the file
+hierarchy specified by the command line operands.
+Directories will be recreated and must be specified before the
+files they contain (the
+.Xr find 1
+utility does this correctly).
+.Pp
+The
+.Nm
+command is normally used for distributing files by
+.Xr ftp 1
+or
+.Xr mail 1 .
+.Sh EXAMPLES
+To create a shell archive of the program
+.Xr ls 1
+and mail it to Rick:
+.Bd -literal -offset indent
+cd ls
+shar `find . -print` \&| mail -s "ls source" rick
+.Ed
+.Pp
+To recreate the program directory:
+.Bd -literal -offset indent
+mkdir ls
+cd ls
+\&...
+<delete header lines and examine mailed archive>
+\&...
+sh archive
+.Ed
+.Sh SEE ALSO
+.Xr compress 1 ,
+.Xr mail 1 ,
+.Xr tar 1 ,
+.Xr uuencode 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.4 .
+.Sh BUGS
+The
+.Nm
+command makes no provisions for special types of files or files containing
+magic characters.
+The
+.Nm
+command cannot handle files without a newline ('\\n')
+as the last character.
+.Pp
+It is easy to insert trojan horses into
+.Nm
+files.
+It is strongly recommended that all shell archive files be examined
+before running them through
+.Xr sh 1 .
+Archives produced using this implementation of
+.Nm
+may be easily examined with the command:
+.Bd -literal -offset indent
+egrep -v '^[X#]' shar.file
+.Ed
diff --git a/usr.bin/shar/shar.sh b/usr.bin/shar/shar.sh
new file mode 100644
index 0000000..3573013
--- /dev/null
+++ b/usr.bin/shar/shar.sh
@@ -0,0 +1,80 @@
+#!/bin/sh -
+#
+# Copyright (c) 1990, 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.
+#
+# @(#)shar.sh 8.1 (Berkeley) 6/6/93
+#
+# $FreeBSD$
+
+if [ $# -eq 0 ]; then
+ echo 'usage: shar file ...' 1>&2
+ exit 64 # EX_USAGE
+fi
+
+for i
+do
+ if [ ! \( -d $i -o -r $i \) ]; then
+ echo "$i inaccessible or not exist" 1>&2
+ exit 66 # EX_NOINPUT
+ fi
+done
+
+cat << EOF
+# This is a shell archive. Save it in a file, remove anything before
+# this line, and then unpack it by entering "sh file". Note, it may
+# create directories; files and directories will be owned by you and
+# have default permissions.
+#
+# This archive contains:
+#
+EOF
+
+for i
+do
+ echo "# $i"
+done
+
+echo "#"
+
+for i
+do
+ if [ -d $i ]; then
+ echo "echo c - $i"
+ echo "mkdir -p $i > /dev/null 2>&1"
+ else
+ md5sum=`echo -n $i | md5`
+ echo "echo x - $i"
+ echo "sed 's/^X//' >$i << '$md5sum'"
+ sed 's/^/X/' $i || exit
+ echo "$md5sum"
+ fi
+done
+echo exit
+echo ""
+
+exit 0
diff --git a/usr.bin/showmount/Makefile b/usr.bin/showmount/Makefile
new file mode 100644
index 0000000..5919909
--- /dev/null
+++ b/usr.bin/showmount/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= showmount
+MAN= showmount.8
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/showmount/Makefile.depend b/usr.bin/showmount/Makefile.depend
new file mode 100644
index 0000000..ddd5dbd
--- /dev/null
+++ b/usr.bin/showmount/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ 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/showmount/showmount.8 b/usr.bin/showmount/showmount.8
new file mode 100644
index 0000000..692c6d6
--- /dev/null
+++ b/usr.bin/showmount/showmount.8
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Rick Macklem at The University of Guelph.
+.\"
+.\" 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.
+.\"
+.\" @(#)showmount.8 8.3 (Berkeley) 3/29/95
+.\" $FreeBSD$
+.\"
+.Dd March 20, 2016
+.Dt SHOWMOUNT 8
+.Os
+.Sh NAME
+.Nm showmount
+.Nd show remote nfs mounts on host
+.Sh SYNOPSIS
+.Nm
+.Op Fl a | d
+.Op Fl E
+.Op Fl e
+.Op Fl 1
+.Op Fl 3
+.Op Ar host
+.Sh DESCRIPTION
+The
+.Nm
+utility shows status information about the
+.Tn NFS
+server on
+.Ar host .
+By default it prints the names of all hosts that have
+.Tn NFS
+file systems mounted
+on the host.
+See
+.%T "NFS: Network File System Protocol Specification" ,
+RFC 1094,
+Appendix A,
+and
+.%T "NFS: Network File System Version 3 Protocol Specification" ,
+Appendix I,
+for a detailed description of the protocol.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+List all mount points in the form:
+.Bd -ragged -offset indent -compact
+.Ar host : Ns Ar dirpath .
+.Ed
+.It Fl d
+List directory paths of mount points instead of hosts.
+.It Fl E
+Show the
+.Ar host Ns 's
+exports list in a script-friendly format.
+Client addresses and the header are not shown, and special
+characters are escaped.
+.It Fl e
+Show the
+.Ar host Ns 's
+exports list.
+.It Fl 1
+Use mount protocol Version 1, compatible with legacy servers.
+.It Fl 3
+Ignored for backwards compatibility.
+.El
+.Sh SEE ALSO
+.Xr mount 8 ,
+.Xr mount_nfs 8 ,
+.Xr mountd 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Bx 4.4 .
+.Sh BUGS
+The mount daemon running on the server only has an idea of the actual mounts,
+since the
+.Tn NFS
+server is stateless.
+The
+.Nm
+utility will only display the information
+as accurately as the mount daemon reports it.
diff --git a/usr.bin/showmount/showmount.c b/usr.bin/showmount/showmount.c
new file mode 100644
index 0000000..01c9e26
--- /dev/null
+++ b/usr.bin/showmount/showmount.c
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 1989, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Macklem at The University of Guelph.
+ *
+ * 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) 1989, 1993, 1995\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+
+#include <err.h>
+#include <netdb.h>
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+#include <rpc/pmap_prot.h>
+#include <rpcsvc/mount.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <vis.h>
+
+/* Constant defs */
+#define ALL 1
+#define DIRS 2
+
+#define DODUMP 0x1
+#define DOEXPORTS 0x2
+#define DOPARSABLEEXPORTS 0x4
+
+struct mountlist {
+ struct mountlist *ml_left;
+ struct mountlist *ml_right;
+ char ml_host[MNTNAMLEN+1];
+ char ml_dirp[MNTPATHLEN+1];
+};
+
+struct grouplist {
+ struct grouplist *gr_next;
+ char gr_name[MNTNAMLEN+1];
+};
+
+struct exportslist {
+ struct exportslist *ex_next;
+ struct grouplist *ex_groups;
+ char ex_dirp[MNTPATHLEN+1];
+};
+
+static struct mountlist *mntdump;
+static struct exportslist *exportslist;
+static int type = 0;
+
+void print_dump(struct mountlist *);
+static void usage(void);
+int xdr_mntdump(XDR *, struct mountlist **);
+int xdr_exportslist(XDR *, struct exportslist **);
+int tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
+
+/*
+ * This command queries the NFS mount daemon for it's mount list and/or
+ * it's exports list and prints them out.
+ * See "NFS: Network File System Protocol Specification, RFC1094, Appendix A"
+ * and the "Network File System Protocol XXX.."
+ * for detailed information on the protocol.
+ */
+int
+main(int argc, char **argv)
+{
+ char strvised[MNTPATHLEN * 4 + 1];
+ register struct exportslist *exp;
+ register struct grouplist *grp;
+ register int rpcs = 0, mntvers = 3;
+ const char *host;
+ int ch, estat, nbytes;
+
+ while ((ch = getopt(argc, argv, "adEe13")) != -1)
+ switch (ch) {
+ case 'a':
+ if (type == 0) {
+ type = ALL;
+ rpcs |= DODUMP;
+ } else
+ usage();
+ break;
+ case 'd':
+ if (type == 0) {
+ type = DIRS;
+ rpcs |= DODUMP;
+ } else
+ usage();
+ break;
+ case 'E':
+ rpcs |= DOPARSABLEEXPORTS;
+ break;
+ case 'e':
+ rpcs |= DOEXPORTS;
+ break;
+ case '1':
+ mntvers = 1;
+ break;
+ case '3':
+ mntvers = 3;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if ((rpcs & DOPARSABLEEXPORTS) != 0) {
+ if ((rpcs & DOEXPORTS) != 0)
+ errx(1, "-E cannot be used with -e");
+ if ((rpcs & DODUMP) != 0)
+ errx(1, "-E cannot be used with -a or -d");
+ }
+
+ if (argc > 0)
+ host = *argv;
+ else
+ host = "localhost";
+
+ if (rpcs == 0)
+ rpcs = DODUMP;
+
+ if (rpcs & DODUMP)
+ if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers,
+ MOUNTPROC_DUMP, (xdrproc_t)xdr_void, (char *)0,
+ (xdrproc_t)xdr_mntdump, (char *)&mntdump)) != 0) {
+ clnt_perrno(estat);
+ errx(1, "can't do mountdump rpc");
+ }
+ if (rpcs & (DOEXPORTS | DOPARSABLEEXPORTS))
+ if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers,
+ MOUNTPROC_EXPORT, (xdrproc_t)xdr_void, (char *)0,
+ (xdrproc_t)xdr_exportslist, (char *)&exportslist)) != 0) {
+ clnt_perrno(estat);
+ errx(1, "can't do exports rpc");
+ }
+
+ /* Now just print out the results */
+ if (rpcs & DODUMP) {
+ switch (type) {
+ case ALL:
+ printf("All mount points on %s:\n", host);
+ break;
+ case DIRS:
+ printf("Directories on %s:\n", host);
+ break;
+ default:
+ printf("Hosts on %s:\n", host);
+ break;
+ }
+ print_dump(mntdump);
+ }
+ if (rpcs & DOEXPORTS) {
+ printf("Exports list on %s:\n", host);
+ exp = exportslist;
+ while (exp) {
+ printf("%-34s ", exp->ex_dirp);
+ grp = exp->ex_groups;
+ if (grp == NULL) {
+ printf("Everyone\n");
+ } else {
+ while (grp) {
+ printf("%s ", grp->gr_name);
+ grp = grp->gr_next;
+ }
+ printf("\n");
+ }
+ exp = exp->ex_next;
+ }
+ }
+ if (rpcs & DOPARSABLEEXPORTS) {
+ exp = exportslist;
+ while (exp) {
+ nbytes = strsnvis(strvised, sizeof(strvised),
+ exp->ex_dirp, VIS_GLOB | VIS_NL, "\"'$");
+ if (nbytes == -1)
+ err(1, "strsnvis");
+ printf("%s\n", strvised);
+ exp = exp->ex_next;
+ }
+ }
+ exit(0);
+}
+
+/*
+ * tcp_callrpc has the same interface as callrpc, but tries to
+ * use tcp as transport method in order to handle large replies.
+ */
+int
+tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, char *in, xdrproc_t outproc, char *out)
+{
+ CLIENT *client;
+ struct timeval timeout;
+ int rval;
+
+ if ((client = clnt_create(host, prognum, versnum, "tcp")) == NULL &&
+ (client = clnt_create(host, prognum, versnum, "udp")) == NULL)
+ return ((int) rpc_createerr.cf_stat);
+
+ timeout.tv_sec = 25;
+ timeout.tv_usec = 0;
+ rval = (int) clnt_call(client, procnum,
+ inproc, in,
+ outproc, out,
+ timeout);
+ clnt_destroy(client);
+ return rval;
+}
+
+/*
+ * Xdr routine for retrieving the mount dump list
+ */
+int
+xdr_mntdump(XDR *xdrsp, struct mountlist **mlp)
+{
+ register struct mountlist *mp;
+ register struct mountlist *tp;
+ register struct mountlist **otp;
+ int val, val2;
+ int bool;
+ char *strp;
+
+ *mlp = (struct mountlist *)0;
+ if (!xdr_bool(xdrsp, &bool))
+ return (0);
+ while (bool) {
+ mp = (struct mountlist *)malloc(sizeof(struct mountlist));
+ if (mp == NULL)
+ return (0);
+ mp->ml_left = mp->ml_right = (struct mountlist *)0;
+ strp = mp->ml_host;
+ if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
+ return (0);
+ strp = mp->ml_dirp;
+ if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
+ return (0);
+
+ /*
+ * Build a binary tree on sorted order of either host or dirp.
+ * Drop any duplications.
+ */
+ if (*mlp == NULL) {
+ *mlp = mp;
+ } else {
+ tp = *mlp;
+ while (tp) {
+ val = strcmp(mp->ml_host, tp->ml_host);
+ val2 = strcmp(mp->ml_dirp, tp->ml_dirp);
+ switch (type) {
+ case ALL:
+ if (val == 0) {
+ if (val2 == 0) {
+ free((caddr_t)mp);
+ goto next;
+ }
+ val = val2;
+ }
+ break;
+ case DIRS:
+ if (val2 == 0) {
+ free((caddr_t)mp);
+ goto next;
+ }
+ val = val2;
+ break;
+ default:
+ if (val == 0) {
+ free((caddr_t)mp);
+ goto next;
+ }
+ break;
+ }
+ if (val < 0) {
+ otp = &tp->ml_left;
+ tp = tp->ml_left;
+ } else {
+ otp = &tp->ml_right;
+ tp = tp->ml_right;
+ }
+ }
+ *otp = mp;
+ }
+next:
+ if (!xdr_bool(xdrsp, &bool))
+ return (0);
+ }
+ return (1);
+}
+
+/*
+ * Xdr routine to retrieve exports list
+ */
+int
+xdr_exportslist(XDR *xdrsp, struct exportslist **exp)
+{
+ register struct exportslist *ep;
+ register struct grouplist *gp;
+ int bool, grpbool;
+ char *strp;
+
+ *exp = (struct exportslist *)0;
+ if (!xdr_bool(xdrsp, &bool))
+ return (0);
+ while (bool) {
+ ep = (struct exportslist *)malloc(sizeof(struct exportslist));
+ if (ep == NULL)
+ return (0);
+ ep->ex_groups = (struct grouplist *)0;
+ strp = ep->ex_dirp;
+ if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
+ return (0);
+ if (!xdr_bool(xdrsp, &grpbool))
+ return (0);
+ while (grpbool) {
+ gp = (struct grouplist *)malloc(sizeof(struct grouplist));
+ if (gp == NULL)
+ return (0);
+ strp = gp->gr_name;
+ if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
+ return (0);
+ gp->gr_next = ep->ex_groups;
+ ep->ex_groups = gp;
+ if (!xdr_bool(xdrsp, &grpbool))
+ return (0);
+ }
+ ep->ex_next = *exp;
+ *exp = ep;
+ if (!xdr_bool(xdrsp, &bool))
+ return (0);
+ }
+ return (1);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: showmount [-a | -d] [-e3] [host]\n");
+ exit(1);
+}
+
+/*
+ * Print the binary tree in inorder so that output is sorted.
+ */
+void
+print_dump(struct mountlist *mp)
+{
+
+ if (mp == NULL)
+ return;
+ if (mp->ml_left)
+ print_dump(mp->ml_left);
+ switch (type) {
+ case ALL:
+ printf("%s:%s\n", mp->ml_host, mp->ml_dirp);
+ break;
+ case DIRS:
+ printf("%s\n", mp->ml_dirp);
+ break;
+ default:
+ printf("%s\n", mp->ml_host);
+ break;
+ }
+ if (mp->ml_right)
+ print_dump(mp->ml_right);
+}
diff --git a/usr.bin/size/Makefile b/usr.bin/size/Makefile
new file mode 100644
index 0000000..d7c8e41
--- /dev/null
+++ b/usr.bin/size/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+SIZEDIR= ${ELFTCDIR}/size
+
+.PATH: ${SIZEDIR}
+
+PROG= size
+
+LIBADD= elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/size/Makefile.depend b/usr.bin/size/Makefile.depend
new file mode 100644
index 0000000..40241f3
--- /dev/null
+++ b/usr.bin/size/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/smbutil/Makefile b/usr.bin/smbutil/Makefile
new file mode 100644
index 0000000..2012124
--- /dev/null
+++ b/usr.bin/smbutil/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+PROG= smbutil
+SRCS= smbutil.c dumptree.c login.c lookup.c view.c print.c
+
+LIBADD= smb
+
+CONTRIBDIR= ${.CURDIR}/../../contrib/smbfs
+CFLAGS+= -I${CONTRIBDIR}/include
+
+WARNS?= 0
+
+.PATH: ${CONTRIBDIR}/smbutil
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/smbutil/Makefile.depend b/usr.bin/smbutil/Makefile.depend
new file mode 100644
index 0000000..4db7ad3
--- /dev/null
+++ b/usr.bin/smbutil/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkiconv \
+ lib/libsmb \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/sockstat/Makefile b/usr.bin/sockstat/Makefile
new file mode 100644
index 0000000..8093367
--- /dev/null
+++ b/usr.bin/sockstat/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= sockstat
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/sockstat/Makefile.depend b/usr.bin/sockstat/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/sockstat/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
new file mode 100644
index 0000000..95247e4
--- /dev/null
+++ b/usr.bin/sockstat/sockstat.1
@@ -0,0 +1,168 @@
+.\"-
+.\" Copyright (c) 1999 Dag-Erling Coïdan Smørgrav
+.\" 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.
+.\" 3. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 27, 2015
+.Dt SOCKSTAT 1
+.Os
+.Sh NAME
+.Nm sockstat
+.Nd list open sockets
+.Sh SYNOPSIS
+.Nm
+.Op Fl 46cLlsu
+.Op Fl j Ar jid
+.Op Fl p Ar ports
+.Op Fl P Ar protocols
+.Sh DESCRIPTION
+The
+.Nm
+command lists open Internet or
+.Ux
+domain sockets.
+.Pp
+The following options are available:
+.Bl -tag -width Fl
+.It Fl 4
+Show
+.Dv AF_INET
+(IPv4) sockets.
+.It Fl 6
+Show
+.Dv AF_INET6
+(IPv6) sockets.
+.It Fl c
+Show connected sockets.
+.It Fl j Ar jid
+Show only sockets belonging to the specified jail ID.
+.It Fl L
+Only show Internet sockets if the local and foreign addresses are not
+in the loopback network prefix
+.Li 127.0.0.0/8 ,
+or do not contain the IPv6 loopback address
+.Li ::1 .
+.It Fl l
+Show listening sockets.
+.It Fl p Ar ports
+Only show Internet sockets if the local or foreign port number
+is on the specified list.
+The
+.Ar ports
+argument is a comma-separated list of port numbers and ranges
+specified as first and last port separated by a dash.
+.It Fl P Ar protocols
+Only show sockets of the specified
+.Ar protocols .
+The
+.Ar protocols
+argument is a comma-separated list of protocol names,
+as they are defined in
+.Xr protocols 5 .
+.It Fl s
+Display the protocol state, if applicable.
+This is currently only implemented for SCTP and TCP.
+.It Fl u
+Show
+.Dv AF_LOCAL
+.Pq Ux
+sockets.
+.El
+.Pp
+If neither
+.Fl 4 , 6
+or
+.Fl u
+is specified,
+.Nm
+will list sockets in all three domains.
+.Pp
+If neither
+.Fl c
+or
+.Fl l
+is specified,
+.Nm
+will list both listening and connected sockets.
+.Pp
+The information listed for each
+socket is:
+.Bl -tag -width "FOREIGN ADDRESS"
+.It Li USER
+The user who owns the socket.
+.It Li COMMAND
+The command which holds the socket.
+.It Li PID
+The process ID of the command which holds the socket.
+.It Li FD
+The file descriptor number of the socket.
+.It Li PROTO
+The transport protocol associated with the socket for Internet
+sockets, or the type of socket
+.Pq stream, datagram, or seqpacket
+for
+.Ux
+sockets.
+.It Li LOCAL ADDRESS
+For Internet sockets, this is the address the local end of the socket
+is bound to (see
+.Xr getsockname 2 ) .
+For bound
+.Ux
+sockets, it is the socket's filename.
+For other
+.Ux
+sockets, it is a right arrow followed by the endpoint's filename, or
+.Dq Li ??
+if the endpoint could not be determined.
+.It Li FOREIGN ADDRESS
+(Internet sockets only)
+The address the foreign end of the socket is bound to (see
+.Xr getpeername 2 ) .
+.El
+.Pp
+If a socket is associated with more than one file descriptor,
+it is shown multiple times.
+If a socket is not associated with any file descriptor,
+the first four columns have no meaning.
+.Sh SEE ALSO
+.Xr fstat 1 ,
+.Xr netstat 1 ,
+.Xr procstat 1 ,
+.Xr inet 4 ,
+.Xr inet6 4 ,
+.Xr protocols 5
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Fx 3.1 .
+.Sh AUTHORS
+The
+.Nm
+command and this manual page were written by
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
new file mode 100644
index 0000000..7d533d0
--- /dev/null
+++ b/usr.bin/sockstat/sockstat.c
@@ -0,0 +1,1218 @@
+/*-
+ * Copyright (c) 2002 Dag-Erling Coïdan Smørgrav
+ * 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.
+ * 3. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/file.h>
+#include <sys/user.h>
+
+#include <sys/un.h>
+#include <sys/unpcb.h>
+
+#include <net/route.h>
+
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+#include <netinet/sctp.h>
+#include <netinet/tcp.h>
+#define TCPSTATES /* load state names */
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_seq.h>
+#include <netinet/tcp_var.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define sstosin(ss) ((struct sockaddr_in *)(ss))
+#define sstosin6(ss) ((struct sockaddr_in6 *)(ss))
+#define sstosun(ss) ((struct sockaddr_un *)(ss))
+#define sstosa(ss) ((struct sockaddr *)(ss))
+
+static int opt_4; /* Show IPv4 sockets */
+static int opt_6; /* Show IPv6 sockets */
+static int opt_c; /* Show connected sockets */
+static int opt_j; /* Show specified jail */
+static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */
+static int opt_l; /* Show listening sockets */
+static int opt_s; /* Show protocol state if applicable */
+static int opt_u; /* Show Unix domain sockets */
+static int opt_v; /* Verbose mode */
+
+/*
+ * Default protocols to use if no -P was defined.
+ */
+static const char *default_protos[] = {"sctp", "tcp", "udp", "divert" };
+static size_t default_numprotos = nitems(default_protos);
+
+static int *protos; /* protocols to use */
+static size_t numprotos; /* allocated size of protos[] */
+
+static int *ports;
+
+#define INT_BIT (sizeof(int)*CHAR_BIT)
+#define SET_PORT(p) do { ports[p / INT_BIT] |= 1 << (p % INT_BIT); } while (0)
+#define CHK_PORT(p) (ports[p / INT_BIT] & (1 << (p % INT_BIT)))
+
+struct addr {
+ struct sockaddr_storage address;
+ struct addr *next;
+};
+
+struct sock {
+ void *socket;
+ void *pcb;
+ int shown;
+ int vflag;
+ int family;
+ int proto;
+ int state;
+ const char *protoname;
+ struct addr *laddr;
+ struct addr *faddr;
+ struct sock *next;
+};
+
+#define HASHSIZE 1009
+static struct sock *sockhash[HASHSIZE];
+
+static struct xfile *xfiles;
+static int nxfiles;
+
+static int
+xprintf(const char *fmt, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, fmt);
+ len = vprintf(fmt, ap);
+ va_end(ap);
+ if (len < 0)
+ err(1, "printf()");
+ return (len);
+}
+
+
+static int
+get_proto_type(const char *proto)
+{
+ struct protoent *pent;
+
+ if (strlen(proto) == 0)
+ return (0);
+ pent = getprotobyname(proto);
+ if (pent == NULL) {
+ warn("getprotobyname");
+ return (-1);
+ }
+ return (pent->p_proto);
+}
+
+
+static void
+init_protos(int num)
+{
+ int proto_count = 0;
+
+ if (num > 0) {
+ proto_count = num;
+ } else {
+ /* Find the maximum number of possible protocols. */
+ while (getprotoent() != NULL)
+ proto_count++;
+ endprotoent();
+ }
+
+ if ((protos = malloc(sizeof(int) * proto_count)) == NULL)
+ err(1, "malloc");
+ numprotos = proto_count;
+}
+
+
+static int
+parse_protos(char *protospec)
+{
+ char *prot;
+ int proto_type, proto_index;
+
+ if (protospec == NULL)
+ return (-1);
+
+ init_protos(0);
+ proto_index = 0;
+ while ((prot = strsep(&protospec, ",")) != NULL) {
+ if (strlen(prot) == 0)
+ continue;
+ proto_type = get_proto_type(prot);
+ if (proto_type != -1)
+ protos[proto_index++] = proto_type;
+ }
+ numprotos = proto_index;
+ return (proto_index);
+}
+
+
+static void
+parse_ports(const char *portspec)
+{
+ const char *p, *q;
+ int port, end;
+
+ if (ports == NULL)
+ if ((ports = calloc(65536 / INT_BIT, sizeof(int))) == NULL)
+ err(1, "calloc()");
+ p = portspec;
+ while (*p != '\0') {
+ if (!isdigit(*p))
+ errx(1, "syntax error in port range");
+ for (q = p; *q != '\0' && isdigit(*q); ++q)
+ /* nothing */ ;
+ for (port = 0; p < q; ++p)
+ port = port * 10 + digittoint(*p);
+ if (port < 0 || port > 65535)
+ errx(1, "invalid port number");
+ SET_PORT(port);
+ switch (*p) {
+ case '-':
+ ++p;
+ break;
+ case ',':
+ ++p;
+ /* fall through */
+ case '\0':
+ default:
+ continue;
+ }
+ for (q = p; *q != '\0' && isdigit(*q); ++q)
+ /* nothing */ ;
+ for (end = 0; p < q; ++p)
+ end = end * 10 + digittoint(*p);
+ if (end < port || end > 65535)
+ errx(1, "invalid port number");
+ while (port++ < end)
+ SET_PORT(port);
+ if (*p == ',')
+ ++p;
+ }
+}
+
+static void
+sockaddr(struct sockaddr_storage *ss, int af, void *addr, int port)
+{
+ struct sockaddr_in *sin4;
+ struct sockaddr_in6 *sin6;
+
+ bzero(ss, sizeof(*ss));
+ switch (af) {
+ case AF_INET:
+ sin4 = sstosin(ss);
+ sin4->sin_len = sizeof(*sin4);
+ sin4->sin_family = af;
+ sin4->sin_port = port;
+ sin4->sin_addr = *(struct in_addr *)addr;
+ break;
+ case AF_INET6:
+ sin6 = sstosin6(ss);
+ sin6->sin6_len = sizeof(*sin6);
+ sin6->sin6_family = af;
+ sin6->sin6_port = port;
+ sin6->sin6_addr = *(struct in6_addr *)addr;
+#define s6_addr16 __u6_addr.__u6_addr16
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
+ sin6->sin6_scope_id =
+ ntohs(sin6->sin6_addr.s6_addr16[1]);
+ sin6->sin6_addr.s6_addr16[1] = 0;
+ }
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+free_socket(struct sock *sock)
+{
+ struct addr *cur, *next;
+
+ cur = sock->laddr;
+ while (cur != NULL) {
+ next = cur->next;
+ free(cur);
+ cur = next;
+ }
+ cur = sock->faddr;
+ while (cur != NULL) {
+ next = cur->next;
+ free(cur);
+ cur = next;
+ }
+ free(sock);
+}
+
+static void
+gather_sctp(void)
+{
+ struct sock *sock;
+ struct addr *laddr, *prev_laddr, *faddr, *prev_faddr;
+ struct xsctp_inpcb *xinpcb;
+ struct xsctp_tcb *xstcb;
+ struct xsctp_raddr *xraddr;
+ struct xsctp_laddr *xladdr;
+ const char *varname;
+ size_t len, offset;
+ char *buf;
+ int hash, vflag;
+ int no_stcb, local_all_loopback, foreign_all_loopback;
+
+ vflag = 0;
+ if (opt_4)
+ vflag |= INP_IPV4;
+ if (opt_6)
+ vflag |= INP_IPV6;
+
+ varname = "net.inet.sctp.assoclist";
+ if (sysctlbyname(varname, 0, &len, 0, 0) < 0) {
+ if (errno != ENOENT)
+ err(1, "sysctlbyname()");
+ return;
+ }
+ if ((buf = (char *)malloc(len)) == NULL) {
+ err(1, "malloc()");
+ return;
+ }
+ if (sysctlbyname(varname, buf, &len, 0, 0) < 0) {
+ err(1, "sysctlbyname()");
+ free(buf);
+ return;
+ }
+ xinpcb = (struct xsctp_inpcb *)(void *)buf;
+ offset = sizeof(struct xsctp_inpcb);
+ while ((offset < len) && (xinpcb->last == 0)) {
+ if ((sock = calloc(1, sizeof *sock)) == NULL)
+ err(1, "malloc()");
+ sock->socket = xinpcb->socket;
+ sock->proto = IPPROTO_SCTP;
+ sock->protoname = "sctp";
+ if (xinpcb->maxqlen == 0)
+ sock->state = SCTP_CLOSED;
+ else
+ sock->state = SCTP_LISTEN;
+ if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) {
+ sock->family = AF_INET6;
+ sock->vflag = INP_IPV6;
+ } else {
+ sock->family = AF_INET;
+ sock->vflag = INP_IPV4;
+ }
+ prev_laddr = NULL;
+ local_all_loopback = 1;
+ while (offset < len) {
+ xladdr = (struct xsctp_laddr *)(void *)(buf + offset);
+ offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last == 1)
+ break;
+ if ((laddr = calloc(1, sizeof(struct addr))) == NULL)
+ err(1, "malloc()");
+ switch (xladdr->address.sa.sa_family) {
+ case AF_INET:
+#define __IN_IS_ADDR_LOOPBACK(pina) \
+ ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+ if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr))
+ local_all_loopback = 0;
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&laddr->address,
+ AF_INET,
+ &xladdr->address.sin.sin_addr,
+ htons(xinpcb->local_port));
+ break;
+ case AF_INET6:
+ if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr))
+ local_all_loopback = 0;
+ sockaddr(&laddr->address,
+ AF_INET6,
+ &xladdr->address.sin6.sin6_addr,
+ htons(xinpcb->local_port));
+ break;
+ default:
+ errx(1, "address family %d not supported",
+ xladdr->address.sa.sa_family);
+ }
+ laddr->next = NULL;
+ if (prev_laddr == NULL)
+ sock->laddr = laddr;
+ else
+ prev_laddr->next = laddr;
+ prev_laddr = laddr;
+ }
+ if (sock->laddr == NULL) {
+ if ((sock->laddr = calloc(1, sizeof(struct addr))) == NULL)
+ err(1, "malloc()");
+ sock->laddr->address.ss_family = sock->family;
+ if (sock->family == AF_INET)
+ sock->laddr->address.ss_len = sizeof(struct sockaddr_in);
+ else
+ sock->laddr->address.ss_len = sizeof(struct sockaddr_in6);
+ local_all_loopback = 0;
+ }
+ if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL)
+ err(1, "malloc()");
+ sock->faddr->address.ss_family = sock->family;
+ if (sock->family == AF_INET)
+ sock->faddr->address.ss_len = sizeof(struct sockaddr_in);
+ else
+ sock->faddr->address.ss_len = sizeof(struct sockaddr_in6);
+ no_stcb = 1;
+ while (offset < len) {
+ xstcb = (struct xsctp_tcb *)(void *)(buf + offset);
+ offset += sizeof(struct xsctp_tcb);
+ if (no_stcb) {
+ if (opt_l &&
+ (!opt_L || !local_all_loopback) &&
+ ((xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) ||
+ (xstcb->last == 1))) {
+ hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ sock->next = sockhash[hash];
+ sockhash[hash] = sock;
+ } else {
+ free_socket(sock);
+ }
+ }
+ if (xstcb->last == 1)
+ break;
+ no_stcb = 0;
+ if (opt_c) {
+ if ((sock = calloc(1, sizeof *sock)) == NULL)
+ err(1, "malloc()");
+ sock->socket = xinpcb->socket;
+ sock->proto = IPPROTO_SCTP;
+ sock->protoname = "sctp";
+ sock->state = (int)xstcb->state;
+ if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) {
+ sock->family = AF_INET6;
+ sock->vflag = INP_IPV6;
+ } else {
+ sock->family = AF_INET;
+ sock->vflag = INP_IPV4;
+ }
+ }
+ prev_laddr = NULL;
+ local_all_loopback = 1;
+ while (offset < len) {
+ xladdr = (struct xsctp_laddr *)(void *)(buf + offset);
+ offset += sizeof(struct xsctp_laddr);
+ if (xladdr->last == 1)
+ break;
+ if (!opt_c)
+ continue;
+ if ((laddr = calloc(1, sizeof(struct addr))) == NULL)
+ err(1, "malloc()");
+ switch (xladdr->address.sa.sa_family) {
+ case AF_INET:
+#define __IN_IS_ADDR_LOOPBACK(pina) \
+ ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+ if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr))
+ local_all_loopback = 0;
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&laddr->address,
+ AF_INET,
+ &xladdr->address.sin.sin_addr,
+ htons(xstcb->local_port));
+ break;
+ case AF_INET6:
+ if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr))
+ local_all_loopback = 0;
+ sockaddr(&laddr->address,
+ AF_INET6,
+ &xladdr->address.sin6.sin6_addr,
+ htons(xstcb->local_port));
+ break;
+ default:
+ errx(1, "address family %d not supported",
+ xladdr->address.sa.sa_family);
+ }
+ laddr->next = NULL;
+ if (prev_laddr == NULL)
+ sock->laddr = laddr;
+ else
+ prev_laddr->next = laddr;
+ prev_laddr = laddr;
+ }
+ prev_faddr = NULL;
+ foreign_all_loopback = 1;
+ while (offset < len) {
+ xraddr = (struct xsctp_raddr *)(void *)(buf + offset);
+ offset += sizeof(struct xsctp_raddr);
+ if (xraddr->last == 1)
+ break;
+ if (!opt_c)
+ continue;
+ if ((faddr = calloc(1, sizeof(struct addr))) == NULL)
+ err(1, "malloc()");
+ switch (xraddr->address.sa.sa_family) {
+ case AF_INET:
+#define __IN_IS_ADDR_LOOPBACK(pina) \
+ ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+ if (!__IN_IS_ADDR_LOOPBACK(&xraddr->address.sin.sin_addr))
+ foreign_all_loopback = 0;
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&faddr->address,
+ AF_INET,
+ &xraddr->address.sin.sin_addr,
+ htons(xstcb->remote_port));
+ break;
+ case AF_INET6:
+ if (!IN6_IS_ADDR_LOOPBACK(&xraddr->address.sin6.sin6_addr))
+ foreign_all_loopback = 0;
+ sockaddr(&faddr->address,
+ AF_INET6,
+ &xraddr->address.sin6.sin6_addr,
+ htons(xstcb->remote_port));
+ break;
+ default:
+ errx(1, "address family %d not supported",
+ xraddr->address.sa.sa_family);
+ }
+ faddr->next = NULL;
+ if (prev_faddr == NULL)
+ sock->faddr = faddr;
+ else
+ prev_faddr->next = faddr;
+ prev_faddr = faddr;
+ }
+ if (opt_c) {
+ if (!opt_L || !(local_all_loopback || foreign_all_loopback)) {
+ hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ sock->next = sockhash[hash];
+ sockhash[hash] = sock;
+ } else {
+ free_socket(sock);
+ }
+ }
+ }
+ xinpcb = (struct xsctp_inpcb *)(void *)(buf + offset);
+ offset += sizeof(struct xsctp_inpcb);
+ }
+ free(buf);
+}
+
+static void
+gather_inet(int proto)
+{
+ struct xinpgen *xig, *exig;
+ struct xinpcb *xip;
+ struct xtcpcb *xtp;
+ struct inpcb *inp;
+ struct xsocket *so;
+ struct sock *sock;
+ struct addr *laddr, *faddr;
+ const char *varname, *protoname;
+ size_t len, bufsize;
+ void *buf;
+ int hash, retry, vflag;
+
+ vflag = 0;
+ if (opt_4)
+ vflag |= INP_IPV4;
+ if (opt_6)
+ vflag |= INP_IPV6;
+
+ switch (proto) {
+ case IPPROTO_TCP:
+ varname = "net.inet.tcp.pcblist";
+ protoname = "tcp";
+ break;
+ case IPPROTO_UDP:
+ varname = "net.inet.udp.pcblist";
+ protoname = "udp";
+ break;
+ case IPPROTO_DIVERT:
+ varname = "net.inet.divert.pcblist";
+ protoname = "div";
+ break;
+ default:
+ errx(1, "protocol %d not supported", proto);
+ }
+
+ buf = NULL;
+ bufsize = 8192;
+ retry = 5;
+ do {
+ for (;;) {
+ if ((buf = realloc(buf, bufsize)) == NULL)
+ err(1, "realloc()");
+ len = bufsize;
+ if (sysctlbyname(varname, buf, &len, NULL, 0) == 0)
+ break;
+ if (errno == ENOENT)
+ goto out;
+ if (errno != ENOMEM || len != bufsize)
+ err(1, "sysctlbyname()");
+ bufsize *= 2;
+ }
+ xig = (struct xinpgen *)buf;
+ exig = (struct xinpgen *)(void *)
+ ((char *)buf + len - sizeof *exig);
+ if (xig->xig_len != sizeof *xig ||
+ exig->xig_len != sizeof *exig)
+ errx(1, "struct xinpgen size mismatch");
+ } while (xig->xig_gen != exig->xig_gen && retry--);
+
+ if (xig->xig_gen != exig->xig_gen && opt_v)
+ warnx("warning: data may be inconsistent");
+
+ for (;;) {
+ xig = (struct xinpgen *)(void *)((char *)xig + xig->xig_len);
+ if (xig >= exig)
+ break;
+ xip = (struct xinpcb *)xig;
+ xtp = (struct xtcpcb *)xig;
+ switch (proto) {
+ case IPPROTO_TCP:
+ if (xtp->xt_len != sizeof(*xtp)) {
+ warnx("struct xtcpcb size mismatch");
+ goto out;
+ }
+ inp = &xtp->xt_inp;
+ so = &xtp->xt_socket;
+ protoname = xtp->xt_tp.t_flags & TF_TOE ? "toe" : "tcp";
+ break;
+ case IPPROTO_UDP:
+ case IPPROTO_DIVERT:
+ if (xip->xi_len != sizeof(*xip)) {
+ warnx("struct xinpcb size mismatch");
+ goto out;
+ }
+ inp = &xip->xi_inp;
+ so = &xip->xi_socket;
+ break;
+ default:
+ errx(1, "protocol %d not supported", proto);
+ }
+ if ((inp->inp_vflag & vflag) == 0)
+ continue;
+ if (inp->inp_vflag & INP_IPV4) {
+ if ((inp->inp_fport == 0 && !opt_l) ||
+ (inp->inp_fport != 0 && !opt_c))
+ continue;
+#define __IN_IS_ADDR_LOOPBACK(pina) \
+ ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+ if (opt_L &&
+ (__IN_IS_ADDR_LOOPBACK(&inp->inp_faddr) ||
+ __IN_IS_ADDR_LOOPBACK(&inp->inp_laddr)))
+ continue;
+#undef __IN_IS_ADDR_LOOPBACK
+ } else if (inp->inp_vflag & INP_IPV6) {
+ if ((inp->inp_fport == 0 && !opt_l) ||
+ (inp->inp_fport != 0 && !opt_c))
+ continue;
+ if (opt_L &&
+ (IN6_IS_ADDR_LOOPBACK(&inp->in6p_faddr) ||
+ IN6_IS_ADDR_LOOPBACK(&inp->in6p_laddr)))
+ continue;
+ } else {
+ if (opt_v)
+ warnx("invalid vflag 0x%x", inp->inp_vflag);
+ continue;
+ }
+ if ((sock = calloc(1, sizeof(*sock))) == NULL)
+ err(1, "malloc()");
+ if ((laddr = calloc(1, sizeof *laddr)) == NULL)
+ err(1, "malloc()");
+ if ((faddr = calloc(1, sizeof *faddr)) == NULL)
+ err(1, "malloc()");
+ sock->socket = so->xso_so;
+ sock->proto = proto;
+ if (inp->inp_vflag & INP_IPV4) {
+ sock->family = AF_INET;
+ sockaddr(&laddr->address, sock->family,
+ &inp->inp_laddr, inp->inp_lport);
+ sockaddr(&faddr->address, sock->family,
+ &inp->inp_faddr, inp->inp_fport);
+ } else if (inp->inp_vflag & INP_IPV6) {
+ sock->family = AF_INET6;
+ sockaddr(&laddr->address, sock->family,
+ &inp->in6p_laddr, inp->inp_lport);
+ sockaddr(&faddr->address, sock->family,
+ &inp->in6p_faddr, inp->inp_fport);
+ }
+ laddr->next = NULL;
+ faddr->next = NULL;
+ sock->laddr = laddr;
+ sock->faddr = faddr;
+ sock->vflag = inp->inp_vflag;
+ if (proto == IPPROTO_TCP)
+ sock->state = xtp->xt_tp.t_state;
+ sock->protoname = protoname;
+ hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ sock->next = sockhash[hash];
+ sockhash[hash] = sock;
+ }
+out:
+ free(buf);
+}
+
+static void
+gather_unix(int proto)
+{
+ struct xunpgen *xug, *exug;
+ struct xunpcb *xup;
+ struct sock *sock;
+ struct addr *laddr, *faddr;
+ const char *varname, *protoname;
+ size_t len, bufsize;
+ void *buf;
+ int hash, retry;
+
+ switch (proto) {
+ case SOCK_STREAM:
+ varname = "net.local.stream.pcblist";
+ protoname = "stream";
+ break;
+ case SOCK_DGRAM:
+ varname = "net.local.dgram.pcblist";
+ protoname = "dgram";
+ break;
+ case SOCK_SEQPACKET:
+ varname = "net.local.seqpacket.pcblist";
+ protoname = "seqpac";
+ break;
+ default:
+ abort();
+ }
+ buf = NULL;
+ bufsize = 8192;
+ retry = 5;
+ do {
+ for (;;) {
+ if ((buf = realloc(buf, bufsize)) == NULL)
+ err(1, "realloc()");
+ len = bufsize;
+ if (sysctlbyname(varname, buf, &len, NULL, 0) == 0)
+ break;
+ if (errno != ENOMEM || len != bufsize)
+ err(1, "sysctlbyname()");
+ bufsize *= 2;
+ }
+ xug = (struct xunpgen *)buf;
+ exug = (struct xunpgen *)(void *)
+ ((char *)buf + len - sizeof(*exug));
+ if (xug->xug_len != sizeof(*xug) ||
+ exug->xug_len != sizeof(*exug)) {
+ warnx("struct xinpgen size mismatch");
+ goto out;
+ }
+ } while (xug->xug_gen != exug->xug_gen && retry--);
+
+ if (xug->xug_gen != exug->xug_gen && opt_v)
+ warnx("warning: data may be inconsistent");
+
+ for (;;) {
+ xug = (struct xunpgen *)(void *)((char *)xug + xug->xug_len);
+ if (xug >= exug)
+ break;
+ xup = (struct xunpcb *)xug;
+ if (xup->xu_len != sizeof(*xup)) {
+ warnx("struct xunpcb size mismatch");
+ goto out;
+ }
+ if ((xup->xu_unp.unp_conn == NULL && !opt_l) ||
+ (xup->xu_unp.unp_conn != NULL && !opt_c))
+ continue;
+ if ((sock = calloc(1, sizeof(*sock))) == NULL)
+ err(1, "malloc()");
+ if ((laddr = calloc(1, sizeof *laddr)) == NULL)
+ err(1, "malloc()");
+ if ((faddr = calloc(1, sizeof *faddr)) == NULL)
+ err(1, "malloc()");
+ sock->socket = xup->xu_socket.xso_so;
+ sock->pcb = xup->xu_unpp;
+ sock->proto = proto;
+ sock->family = AF_UNIX;
+ sock->protoname = protoname;
+ if (xup->xu_unp.unp_addr != NULL)
+ laddr->address =
+ *(struct sockaddr_storage *)(void *)&xup->xu_addr;
+ else if (xup->xu_unp.unp_conn != NULL)
+ *(void **)&(faddr->address) = xup->xu_unp.unp_conn;
+ laddr->next = NULL;
+ faddr->next = NULL;
+ sock->laddr = laddr;
+ sock->faddr = faddr;
+ hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ sock->next = sockhash[hash];
+ sockhash[hash] = sock;
+ }
+out:
+ free(buf);
+}
+
+static void
+getfiles(void)
+{
+ size_t len, olen;
+
+ olen = len = sizeof(*xfiles);
+ if ((xfiles = malloc(len)) == NULL)
+ err(1, "malloc()");
+ while (sysctlbyname("kern.file", xfiles, &len, 0, 0) == -1) {
+ if (errno != ENOMEM || len != olen)
+ err(1, "sysctlbyname()");
+ olen = len *= 2;
+ if ((xfiles = realloc(xfiles, len)) == NULL)
+ err(1, "realloc()");
+ }
+ if (len > 0 && xfiles->xf_size != sizeof(*xfiles))
+ errx(1, "struct xfile size mismatch");
+ nxfiles = len / sizeof(*xfiles);
+}
+
+static int
+printaddr(struct sockaddr_storage *ss)
+{
+ struct sockaddr_un *sun;
+ char addrstr[NI_MAXHOST] = { '\0', '\0' };
+ int error, off, port = 0;
+
+ switch (ss->ss_family) {
+ case AF_INET:
+ if (inet_lnaof(sstosin(ss)->sin_addr) == INADDR_ANY)
+ addrstr[0] = '*';
+ port = ntohs(sstosin(ss)->sin_port);
+ break;
+ case AF_INET6:
+ if (IN6_IS_ADDR_UNSPECIFIED(&sstosin6(ss)->sin6_addr))
+ addrstr[0] = '*';
+ port = ntohs(sstosin6(ss)->sin6_port);
+ break;
+ case AF_UNIX:
+ sun = sstosun(ss);
+ off = (int)((char *)&sun->sun_path - (char *)sun);
+ return (xprintf("%.*s", sun->sun_len - off, sun->sun_path));
+ }
+ if (addrstr[0] == '\0') {
+ error = getnameinfo(sstosa(ss), ss->ss_len, addrstr,
+ sizeof(addrstr), NULL, 0, NI_NUMERICHOST);
+ if (error)
+ errx(1, "getnameinfo()");
+ }
+ if (port == 0)
+ return xprintf("%s:*", addrstr);
+ else
+ return xprintf("%s:%d", addrstr, port);
+}
+
+static const char *
+getprocname(pid_t pid)
+{
+ static struct kinfo_proc proc;
+ size_t len;
+ int mib[4];
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = (int)pid;
+ len = sizeof(proc);
+ if (sysctl(mib, nitems(mib), &proc, &len, NULL, 0) == -1) {
+ /* Do not warn if the process exits before we get its name. */
+ if (errno != ESRCH)
+ warn("sysctl()");
+ return ("??");
+ }
+ return (proc.ki_comm);
+}
+
+static int
+getprocjid(pid_t pid)
+{
+ static struct kinfo_proc proc;
+ size_t len;
+ int mib[4];
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = (int)pid;
+ len = sizeof(proc);
+ if (sysctl(mib, nitems(mib), &proc, &len, NULL, 0) == -1) {
+ /* Do not warn if the process exits before we get its jid. */
+ if (errno != ESRCH)
+ warn("sysctl()");
+ return (-1);
+ }
+ return (proc.ki_jid);
+}
+
+static int
+check_ports(struct sock *s)
+{
+ int port;
+ struct addr *addr;
+
+ if (ports == NULL)
+ return (1);
+ if ((s->family != AF_INET) && (s->family != AF_INET6))
+ return (1);
+ for (addr = s->laddr; addr != NULL; addr = addr->next) {
+ if (s->family == AF_INET)
+ port = ntohs(sstosin(&addr->address)->sin_port);
+ else
+ port = ntohs(sstosin6(&addr->address)->sin6_port);
+ if (CHK_PORT(port))
+ return (1);
+ }
+ for (addr = s->faddr; addr != NULL; addr = addr->next) {
+ if (s->family == AF_INET)
+ port = ntohs(sstosin(&addr->address)->sin_port);
+ else
+ port = ntohs(sstosin6(&addr->address)->sin6_port);
+ if (CHK_PORT(port))
+ return (1);
+ }
+ return (0);
+}
+
+static const char *
+sctp_state(int state)
+{
+ switch (state) {
+ case SCTP_CLOSED:
+ return "CLOSED";
+ break;
+ case SCTP_BOUND:
+ return "BOUND";
+ break;
+ case SCTP_LISTEN:
+ return "LISTEN";
+ break;
+ case SCTP_COOKIE_WAIT:
+ return "COOKIE_WAIT";
+ break;
+ case SCTP_COOKIE_ECHOED:
+ return "COOKIE_ECHOED";
+ break;
+ case SCTP_ESTABLISHED:
+ return "ESTABLISHED";
+ break;
+ case SCTP_SHUTDOWN_SENT:
+ return "SHUTDOWN_SENT";
+ break;
+ case SCTP_SHUTDOWN_RECEIVED:
+ return "SHUTDOWN_RECEIVED";
+ break;
+ case SCTP_SHUTDOWN_ACK_SENT:
+ return "SHUTDOWN_ACK_SENT";
+ break;
+ case SCTP_SHUTDOWN_PENDING:
+ return "SHUTDOWN_PENDING";
+ break;
+ default:
+ return "UNKNOWN";
+ break;
+ }
+}
+
+static void
+displaysock(struct sock *s, int pos)
+{
+ void *p;
+ int hash, first;
+ struct addr *laddr, *faddr;
+ struct sock *s_tmp;
+
+ while (pos < 29)
+ pos += xprintf(" ");
+ pos += xprintf("%s", s->protoname);
+ if (s->vflag & INP_IPV4)
+ pos += xprintf("4 ");
+ if (s->vflag & INP_IPV6)
+ pos += xprintf("6 ");
+ laddr = s->laddr;
+ faddr = s->faddr;
+ first = 1;
+ while (laddr != NULL || faddr != NULL) {
+ while (pos < 36)
+ pos += xprintf(" ");
+ switch (s->family) {
+ case AF_INET:
+ case AF_INET6:
+ if (laddr != NULL) {
+ pos += printaddr(&laddr->address);
+ if (s->family == AF_INET6 && pos >= 58)
+ pos += xprintf(" ");
+ }
+ while (pos < 58)
+ pos += xprintf(" ");
+ if (faddr != NULL)
+ pos += printaddr(&faddr->address);
+ break;
+ case AF_UNIX:
+ if ((laddr == NULL) || (faddr == NULL))
+ errx(1, "laddr = %p or faddr = %p is NULL",
+ (void *)laddr, (void *)faddr);
+ /* server */
+ if (laddr->address.ss_len > 0) {
+ pos += printaddr(&laddr->address);
+ break;
+ }
+ /* client */
+ p = *(void **)&(faddr->address);
+ if (p == NULL) {
+ pos += xprintf("(not connected)");
+ break;
+ }
+ pos += xprintf("-> ");
+ for (hash = 0; hash < HASHSIZE; ++hash) {
+ for (s_tmp = sockhash[hash];
+ s_tmp != NULL;
+ s_tmp = s_tmp->next)
+ if (s_tmp->pcb == p)
+ break;
+ if (s_tmp != NULL)
+ break;
+ }
+ if (s_tmp == NULL ||
+ s_tmp->laddr == NULL ||
+ s_tmp->laddr->address.ss_len == 0)
+ pos += xprintf("??");
+ else
+ pos += printaddr(&s_tmp->laddr->address);
+ break;
+ default:
+ abort();
+ }
+ if (first && opt_s &&
+ (s->proto == IPPROTO_SCTP || s->proto == IPPROTO_TCP)) {
+ while (pos < 80)
+ pos += xprintf(" ");
+ switch (s->proto) {
+ case IPPROTO_SCTP:
+ pos += xprintf("%s", sctp_state(s->state));
+ break;
+ case IPPROTO_TCP:
+ if (s->state >= 0 && s->state < TCP_NSTATES)
+ pos +=
+ xprintf("%s", tcpstates[s->state]);
+ else
+ pos += xprintf("?");
+ break;
+ }
+ }
+ if (laddr != NULL)
+ laddr = laddr->next;
+ if (faddr != NULL)
+ faddr = faddr->next;
+ if ((laddr != NULL) || (faddr != NULL)) {
+ xprintf("\n");
+ pos = 0;
+ }
+ first = 0;
+ }
+ xprintf("\n");
+}
+
+static void
+display(void)
+{
+ struct passwd *pwd;
+ struct xfile *xf;
+ struct sock *s;
+ int hash, n, pos;
+
+ printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s",
+ "USER", "COMMAND", "PID", "FD", "PROTO",
+ "LOCAL ADDRESS", "FOREIGN ADDRESS");
+ if (opt_s)
+ printf(" %-12s", "STATE");
+ printf("\n");
+ setpassent(1);
+ for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
+ if (xf->xf_data == NULL)
+ continue;
+ if (opt_j >= 0 && opt_j != getprocjid(xf->xf_pid))
+ continue;
+ hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
+ for (s = sockhash[hash]; s != NULL; s = s->next) {
+ if ((void *)s->socket != xf->xf_data)
+ continue;
+ if (!check_ports(s))
+ continue;
+ s->shown = 1;
+ pos = 0;
+ if ((pwd = getpwuid(xf->xf_uid)) == NULL)
+ pos += xprintf("%lu ", (u_long)xf->xf_uid);
+ else
+ pos += xprintf("%s ", pwd->pw_name);
+ while (pos < 9)
+ pos += xprintf(" ");
+ pos += xprintf("%.10s", getprocname(xf->xf_pid));
+ while (pos < 20)
+ pos += xprintf(" ");
+ pos += xprintf("%lu ", (u_long)xf->xf_pid);
+ while (pos < 26)
+ pos += xprintf(" ");
+ pos += xprintf("%d ", xf->xf_fd);
+ displaysock(s, pos);
+ }
+ }
+ if (opt_j >= 0)
+ return;
+ for (hash = 0; hash < HASHSIZE; hash++) {
+ for (s = sockhash[hash]; s != NULL; s = s->next) {
+ if (s->shown)
+ continue;
+ if (!check_ports(s))
+ continue;
+ pos = 0;
+ pos += xprintf("%-8s %-10s %-5s %-2s ",
+ "?", "?", "?", "?");
+ displaysock(s, pos);
+ }
+ }
+}
+
+static int set_default_protos(void)
+{
+ struct protoent *prot;
+ const char *pname;
+ size_t pindex;
+
+ init_protos(default_numprotos);
+
+ for (pindex = 0; pindex < default_numprotos; pindex++) {
+ pname = default_protos[pindex];
+ prot = getprotobyname(pname);
+ if (prot == NULL)
+ err(1, "getprotobyname: %s", pname);
+ protos[pindex] = prot->p_proto;
+ }
+ numprotos = pindex;
+ return (pindex);
+}
+
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: sockstat [-46cLlsu] [-j jid] [-p ports] [-P protocols]\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int protos_defined = -1;
+ int o, i;
+
+ opt_j = -1;
+ while ((o = getopt(argc, argv, "46cj:Llp:P:suv")) != -1)
+ switch (o) {
+ case '4':
+ opt_4 = 1;
+ break;
+ case '6':
+ opt_6 = 1;
+ break;
+ case 'c':
+ opt_c = 1;
+ break;
+ case 'j':
+ opt_j = atoi(optarg);
+ break;
+ case 'L':
+ opt_L = 1;
+ break;
+ case 'l':
+ opt_l = 1;
+ break;
+ case 'p':
+ parse_ports(optarg);
+ break;
+ case 'P':
+ protos_defined = parse_protos(optarg);
+ break;
+ case 's':
+ opt_s = 1;
+ break;
+ case 'u':
+ opt_u = 1;
+ break;
+ case 'v':
+ ++opt_v;
+ break;
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0)
+ usage();
+
+ if ((!opt_4 && !opt_6) && protos_defined != -1)
+ opt_4 = opt_6 = 1;
+ if (!opt_4 && !opt_6 && !opt_u)
+ opt_4 = opt_6 = opt_u = 1;
+ if ((opt_4 || opt_6) && protos_defined == -1)
+ protos_defined = set_default_protos();
+ if (!opt_c && !opt_l)
+ opt_c = opt_l = 1;
+
+ if (opt_4 || opt_6) {
+ for (i = 0; i < protos_defined; i++)
+ if (protos[i] == IPPROTO_SCTP)
+ gather_sctp();
+ else
+ gather_inet(protos[i]);
+ }
+
+ if (opt_u || (protos_defined == -1 && !opt_4 && !opt_6)) {
+ gather_unix(SOCK_STREAM);
+ gather_unix(SOCK_DGRAM);
+ gather_unix(SOCK_SEQPACKET);
+ }
+ getfiles();
+ display();
+ exit(0);
+}
diff --git a/usr.bin/soelim/Makefile b/usr.bin/soelim/Makefile
new file mode 100644
index 0000000..21eaaff
--- /dev/null
+++ b/usr.bin/soelim/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= soelim
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/soelim/Makefile.depend b/usr.bin/soelim/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/soelim/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/soelim/soelim.1 b/usr.bin/soelim/soelim.1
new file mode 100644
index 0000000..1f4e5a83
--- /dev/null
+++ b/usr.bin/soelim/soelim.1
@@ -0,0 +1,91 @@
+.\" 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 November 7, 2015
+.Dt SOELIM 1
+.Os
+.Sh NAME
+.Nm soelim
+.Nd interpret .so requests in manpages
+.Sh SYNOPSIS
+.Nm
+.Op Fl Crtv
+.Op Fl I Ar dir
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility
+reads the specified files or the standard input and performs the textual
+inclusion implied by the
+.Xr nroff 1
+directives of the form:
+.Pp
+.Dl \&.so anotherfile
+.Pp
+If a line starts with:
+.Dq .so anotherfile
+it replaces the line by processing
+.Dq anotherfile .
+Otherwise the line is printed to stdout.
+.Bl -tag -width "-I dir"
+.It Fl C
+Recognise
+.Em .so
+when it is not followed by a space character.
+.It Fl r
+Compatibility with groff's
+.Xr soelim 1
+(does nothing).
+.It Fl t
+Compatibility with groff's
+.Xr soelim 1
+(does nothing).
+.It Fl v
+Compatibility with groff's
+.Xr soelim 1
+(does nothing).
+.It Fl I Ar dir
+This option specifies directories where
+.Nm
+searches for files (both those on the command line and those named in
+.Dq .so
+directive.)
+This option may be specified multiple times.
+The directories will be searched in the order specified.
+.El
+.Pp
+The files are always searched first in the current directory.
+.Pp
+A file specified with an absolute path will be opened directly without
+performing a search.
+.Sh SEE ALSO
+.Xr mandoc 1
+.Sh AUTHORS
+This version of the
+.Nm
+utility was written by
+.An Baptiste Daroussin Aq Mt bapt@freebsd.org .
diff --git a/usr.bin/soelim/soelim.c b/usr.bin/soelim/soelim.c
new file mode 100644
index 0000000..4d747ee
--- /dev/null
+++ b/usr.bin/soelim/soelim.c
@@ -0,0 +1,178 @@
+/*-
+ * 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
+ * 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/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stringlist.h>
+#include <unistd.h>
+
+#define C_OPTION 0x1
+
+static StringList *includes;
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: soelim [-Crtv] [-I dir] [files]\n");
+
+ exit(EXIT_FAILURE);
+}
+
+static FILE *
+soelim_fopen(const char *name)
+{
+ FILE *f;
+ char path[PATH_MAX];
+ size_t i;
+
+ if (strcmp(name, "-") == 0)
+ return (stdin);
+
+ if ((f = fopen(name, "r")) != NULL)
+ return (f);
+
+ if (*name == '/') {
+ warn("can't open '%s'", name);
+ return (NULL);
+ }
+
+ for (i = 0; i < includes->sl_cur; i++) {
+ snprintf(path, sizeof(path), "%s/%s", includes->sl_str[i],
+ name);
+ if ((f = fopen(path, "r")) != NULL)
+ return (f);
+ }
+
+ warn("can't open '%s'", name);
+
+ return (f);
+}
+
+static int
+soelim_file(FILE *f, int flag)
+{
+ char *line = NULL;
+ char *walk, *cp;
+ size_t linecap = 0;
+ ssize_t linelen;
+
+ if (f == NULL)
+ return (1);
+
+ while ((linelen = getline(&line, &linecap, f)) > 0) {
+ if (strncmp(line, ".so", 3) != 0) {
+ printf("%s", line);
+ continue;
+ }
+
+ walk = line + 3;
+ if (!isspace(*walk) && ((flag & C_OPTION) == 0)) {
+ printf("%s", line);
+ continue;
+ }
+
+ while (isspace(*walk))
+ walk++;
+
+ cp = walk;
+ while (*cp != '\0' && !isspace(*cp))
+ cp++;
+ *cp = 0;
+ if (cp < line + linelen)
+ cp++;
+
+ if (*walk == '\0') {
+ printf("%s", line);
+ continue;
+ }
+ if (soelim_file(soelim_fopen(walk), flag) == 1) {
+ free(line);
+ return (1);
+ }
+ if (*cp != '\0')
+ printf("%s", cp);
+ }
+
+ free(line);
+ fclose(f);
+
+ return (0);
+}
+
+int
+main(int argc, char **argv)
+{
+ int ch, i;
+ int ret = 0;
+ int flags = 0;
+
+ includes = sl_init();
+ if (includes == NULL)
+ err(EXIT_FAILURE, "sl_init()");
+
+ while ((ch = getopt(argc, argv, "CrtvI:")) != -1) {
+ switch (ch) {
+ case 'C':
+ flags |= C_OPTION;
+ break;
+ case 'r':
+ case 'v':
+ case 't':
+ /* stub compatibility with groff's soelim */
+ break;
+ case 'I':
+ sl_add(includes, optarg);
+ break;
+ default:
+ sl_free(includes, 0);
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ ret = soelim_file(stdin, flags);
+
+ for (i = 0; i < argc; i++)
+ ret = soelim_file(soelim_fopen(argv[i]), flags);
+
+ sl_free(includes, 0);
+
+ return (ret);
+}
diff --git a/usr.bin/soelim/tests/Makefile b/usr.bin/soelim/tests/Makefile
new file mode 100644
index 0000000..9528694
--- /dev/null
+++ b/usr.bin/soelim/tests/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= soelim
+
+${PACKAGE}FILES+= nonexisting.in \
+ basic.in \
+ basic \
+ basic.out \
+ basic-with-space.in \
+ basic-with-space.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/soelim/tests/Makefile.depend b/usr.bin/soelim/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/soelim/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/soelim/tests/basic b/usr.bin/soelim/tests/basic
new file mode 100644
index 0000000..c4fe1dd
--- /dev/null
+++ b/usr.bin/soelim/tests/basic
@@ -0,0 +1 @@
+basic has been included
diff --git a/usr.bin/soelim/tests/basic-with-space.in b/usr.bin/soelim/tests/basic-with-space.in
new file mode 100644
index 0000000..971d681
--- /dev/null
+++ b/usr.bin/soelim/tests/basic-with-space.in
@@ -0,0 +1,3 @@
+This is a test
+.so basic something
+end
diff --git a/usr.bin/soelim/tests/basic-with-space.out b/usr.bin/soelim/tests/basic-with-space.out
new file mode 100644
index 0000000..290b2c6
--- /dev/null
+++ b/usr.bin/soelim/tests/basic-with-space.out
@@ -0,0 +1,4 @@
+This is a test
+basic has been included
+something
+end
diff --git a/usr.bin/soelim/tests/basic.in b/usr.bin/soelim/tests/basic.in
new file mode 100644
index 0000000..cd32eb1
--- /dev/null
+++ b/usr.bin/soelim/tests/basic.in
@@ -0,0 +1,3 @@
+This is a test
+.so basic
+end
diff --git a/usr.bin/soelim/tests/basic.out b/usr.bin/soelim/tests/basic.out
new file mode 100644
index 0000000..db59fbb
--- /dev/null
+++ b/usr.bin/soelim/tests/basic.out
@@ -0,0 +1,3 @@
+This is a test
+basic has been included
+end
diff --git a/usr.bin/soelim/tests/nonexisting.in b/usr.bin/soelim/tests/nonexisting.in
new file mode 100644
index 0000000..e07599d
--- /dev/null
+++ b/usr.bin/soelim/tests/nonexisting.in
@@ -0,0 +1,3 @@
+This is a test
+.so nonexistingfile
+This is next
diff --git a/usr.bin/soelim/tests/soelim.sh b/usr.bin/soelim/tests/soelim.sh
new file mode 100755
index 0000000..69c92e4
--- /dev/null
+++ b/usr.bin/soelim/tests/soelim.sh
@@ -0,0 +1,103 @@
+# $FreeBSD$
+
+atf_test_case stdin
+stdin_head()
+{
+ atf_set "descr" "stdin functionality"
+}
+
+stdin_body()
+{
+ # no file after .so
+ atf_check \
+ -o inline:".so\n" \
+ -e empty \
+ -s exit:0 \
+ soelim <<-EOF
+.so
+EOF
+
+ # only space after .so
+ atf_check \
+ -o inline:".so \n" \
+ -e empty \
+ -s exit:0 \
+ soelim <<-EOF
+.so
+EOF
+
+ # explicit stdin
+ atf_check \
+ -o inline:".so\n" \
+ -e empty \
+ -s exit:0 \
+ soelim - <<-EOF
+.so
+EOF
+
+ atf_check \
+ -o empty \
+ -e inline:"soelim: can't open 'afile': No such file or directory\n" \
+ -s exit:1 \
+ soelim <<-EOF
+.so afile
+EOF
+
+ atf_check \
+ -o inline:".soafile\n" \
+ -e empty \
+ -s exit:0 \
+ soelim <<-EOF
+.soafile
+EOF
+
+ atf_check \
+ -o empty \
+ -e inline:"soelim: can't open 'afile': No such file or directory\n" \
+ -s exit:1 \
+ soelim -C <<-EOF
+.soafile
+EOF
+}
+
+atf_test_case files
+files_head()
+{
+ atf_set "descr" "testing files"
+}
+
+files_body()
+{
+ atf_check \
+ -o inline:"This is a test\n" \
+ -e inline:"soelim: can't open 'nonexistingfile': No such file or directory\n" \
+ -s exit:1 \
+ soelim $(atf_get_srcdir)/nonexisting.in
+
+ cp $(atf_get_srcdir)/basic .
+ atf_check \
+ -o file:$(atf_get_srcdir)/basic.out \
+ -e empty \
+ -s exit:0 \
+ soelim $(atf_get_srcdir)/basic.in
+
+ rm -f basic
+ atf_check \
+ -o file:$(atf_get_srcdir)/basic.out \
+ -e empty \
+ -s exit:0 \
+ soelim -I$(atf_get_srcdir) $(atf_get_srcdir)/basic.in
+
+ atf_check \
+ -o file:$(atf_get_srcdir)/basic-with-space.out \
+ -e empty \
+ -s exit:0 \
+ soelim -I$(atf_get_srcdir) $(atf_get_srcdir)/basic-with-space.in
+
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case stdin
+ atf_add_test_case files
+}
diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile
new file mode 100644
index 0000000..d097beb
--- /dev/null
+++ b/usr.bin/sort/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= sort
+
+SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c
+
+sort.1: sort.1.in
+ /usr/bin/sed ${MAN_SUB} ${.ALLSRC} >${.TARGET}
+
+CLEANFILES+= sort.1
+
+.if ${MK_SORT_THREADS} != "no"
+CFLAGS+= -DSORT_THREADS
+LIBADD= pthread md
+MAN_SUB+= -e 's|%%THREADS%%||g'
+.else
+LIBADD= md
+MAN_SUB+= -e 's|%%THREADS%%|\.\\"|g'
+.endif
+
+.if ${MK_NLS} != "no"
+NLS+= hu_HU.ISO8859-2
+NLSSRCFILES= ${NLS:S@$@.msg@}
+MAN_SUB+= -e 's|%%NLS%%||g'
+.for lang in ${NLS}
+NLSSRCDIR_${lang}= ${.CURDIR}/nls
+.endfor
+.else
+CFLAGS+= -DWITHOUT_NLS
+MAN_SUB+= -e 's|%%NLS%%|\.\\"|g'
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/sort/Makefile.depend b/usr.bin/sort/Makefile.depend
new file mode 100644
index 0000000..0940f16
--- /dev/null
+++ b/usr.bin/sort/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c
new file mode 100644
index 0000000..3965eae
--- /dev/null
+++ b/usr.bin/sort/bwstring.c
@@ -0,0 +1,1149 @@
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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 <ctype.h>
+#include <errno.h>
+#include <err.h>
+#include <langinfo.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "bwstring.h"
+#include "sort.h"
+
+bool byte_sort;
+
+static wchar_t **wmonths;
+static unsigned char **cmonths;
+
+/* initialise months */
+
+void
+initialise_months(void)
+{
+ const nl_item item[12] = { ABMON_1, ABMON_2, ABMON_3, ABMON_4,
+ ABMON_5, ABMON_6, ABMON_7, ABMON_8, ABMON_9, ABMON_10,
+ ABMON_11, ABMON_12 };
+ unsigned char *tmp;
+ size_t len;
+
+ if (MB_CUR_MAX == 1) {
+ if (cmonths == NULL) {
+ unsigned char *m;
+
+ cmonths = sort_malloc(sizeof(unsigned char*) * 12);
+ for (int i = 0; i < 12; i++) {
+ cmonths[i] = NULL;
+ tmp = (unsigned char *) nl_langinfo(item[i]);
+ if (debug_sort)
+ printf("month[%d]=%s\n", i, tmp);
+ if (*tmp == '\0')
+ continue;
+ m = sort_strdup(tmp);
+ len = strlen(tmp);
+ for (unsigned int j = 0; j < len; j++)
+ m[j] = toupper(m[j]);
+ cmonths[i] = m;
+ }
+ }
+
+ } else {
+ if (wmonths == NULL) {
+ wchar_t *m;
+
+ wmonths = sort_malloc(sizeof(wchar_t *) * 12);
+ for (int i = 0; i < 12; i++) {
+ wmonths[i] = NULL;
+ tmp = (unsigned char *) nl_langinfo(item[i]);
+ if (debug_sort)
+ printf("month[%d]=%s\n", i, tmp);
+ if (*tmp == '\0')
+ continue;
+ len = strlen(tmp);
+ m = sort_malloc(SIZEOF_WCHAR_STRING(len + 1));
+ if (mbstowcs(m, (char*)tmp, len) ==
+ ((size_t) - 1)) {
+ sort_free(m);
+ continue;
+ }
+ m[len] = L'\0';
+ for (unsigned int j = 0; j < len; j++)
+ m[j] = towupper(m[j]);
+ wmonths[i] = m;
+ }
+ }
+ }
+}
+
+/*
+ * Compare two wide-character strings
+ */
+static int
+wide_str_coll(const wchar_t *s1, const wchar_t *s2)
+{
+ int ret = 0;
+
+ errno = 0;
+ ret = wcscoll(s1, s2);
+ if (errno == EILSEQ) {
+ errno = 0;
+ ret = wcscmp(s1, s2);
+ if (errno != 0) {
+ for (size_t i = 0; ; ++i) {
+ wchar_t c1 = s1[i];
+ wchar_t c2 = s2[i];
+ if (c1 == L'\0')
+ return ((c2 == L'\0') ? 0 : -1);
+ if (c2 == L'\0')
+ return (+1);
+ if (c1 == c2)
+ continue;
+ return ((int)(c1 - c2));
+ }
+ }
+ }
+ return (ret);
+}
+
+/* counterparts of wcs functions */
+
+void
+bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix)
+{
+
+ if (MB_CUR_MAX == 1)
+ fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix);
+ else
+ fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix);
+}
+
+const void* bwsrawdata(const struct bwstring *bws)
+{
+
+ return (&(bws->data));
+}
+
+size_t bwsrawlen(const struct bwstring *bws)
+{
+
+ return ((MB_CUR_MAX == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len));
+}
+
+size_t
+bws_memsize(const struct bwstring *bws)
+{
+
+ return ((MB_CUR_MAX == 1) ? (bws->len + 2 + sizeof(struct bwstring)) :
+ (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring)));
+}
+
+void
+bws_setlen(struct bwstring *bws, size_t newlen)
+{
+
+ if (bws && newlen != bws->len && newlen <= bws->len) {
+ bws->len = newlen;
+ if (MB_CUR_MAX == 1)
+ bws->data.cstr[newlen] = '\0';
+ else
+ bws->data.wstr[newlen] = L'\0';
+ }
+}
+
+/*
+ * Allocate a new binary string of specified size
+ */
+struct bwstring *
+bwsalloc(size_t sz)
+{
+ struct bwstring *ret;
+
+ if (MB_CUR_MAX == 1)
+ ret = sort_malloc(sizeof(struct bwstring) + 1 + sz);
+ else
+ ret = sort_malloc(sizeof(struct bwstring) +
+ SIZEOF_WCHAR_STRING(sz + 1));
+ ret->len = sz;
+
+ if (MB_CUR_MAX == 1)
+ ret->data.cstr[ret->len] = '\0';
+ else
+ ret->data.wstr[ret->len] = L'\0';
+
+ return (ret);
+}
+
+/*
+ * Create a copy of binary string.
+ * New string size equals the length of the old string.
+ */
+struct bwstring *
+bwsdup(const struct bwstring *s)
+{
+
+ if (s == NULL)
+ return (NULL);
+ else {
+ struct bwstring *ret = bwsalloc(s->len);
+
+ if (MB_CUR_MAX == 1)
+ memcpy(ret->data.cstr, s->data.cstr, (s->len));
+ else
+ memcpy(ret->data.wstr, s->data.wstr,
+ SIZEOF_WCHAR_STRING(s->len));
+
+ return (ret);
+ }
+}
+
+/*
+ * Create a new binary string from a wide character buffer.
+ */
+struct bwstring *
+bwssbdup(const wchar_t *str, size_t len)
+{
+
+ if (str == NULL)
+ return ((len == 0) ? bwsalloc(0) : NULL);
+ else {
+ struct bwstring *ret;
+
+ ret = bwsalloc(len);
+
+ if (MB_CUR_MAX == 1)
+ for (size_t i = 0; i < len; ++i)
+ ret->data.cstr[i] = (unsigned char) str[i];
+ else
+ memcpy(ret->data.wstr, str, SIZEOF_WCHAR_STRING(len));
+
+ return (ret);
+ }
+}
+
+/*
+ * Create a new binary string from a raw binary buffer.
+ */
+struct bwstring *
+bwscsbdup(const unsigned char *str, size_t len)
+{
+ struct bwstring *ret;
+
+ ret = bwsalloc(len);
+
+ if (str) {
+ if (MB_CUR_MAX == 1)
+ memcpy(ret->data.cstr, str, len);
+ else {
+ mbstate_t mbs;
+ const char *s;
+ size_t charlen, chars, cptr;
+
+ charlen = chars = 0;
+ cptr = 0;
+ s = (const char *) str;
+
+ memset(&mbs, 0, sizeof(mbs));
+
+ while (cptr < len) {
+ size_t n = MB_CUR_MAX;
+
+ if (n > len - cptr)
+ n = len - cptr;
+ charlen = mbrlen(s + cptr, n, &mbs);
+ switch (charlen) {
+ case 0:
+ /* FALLTHROUGH */
+ case (size_t) -1:
+ /* FALLTHROUGH */
+ case (size_t) -2:
+ ret->data.wstr[chars++] =
+ (unsigned char) s[cptr];
+ ++cptr;
+ break;
+ default:
+ n = mbrtowc(ret->data.wstr + (chars++),
+ s + cptr, charlen, &mbs);
+ if ((n == (size_t)-1) || (n == (size_t)-2))
+ /* NOTREACHED */
+ err(2, "mbrtowc error");
+ cptr += charlen;
+ }
+ }
+
+ ret->len = chars;
+ ret->data.wstr[ret->len] = L'\0';
+ }
+ }
+ return (ret);
+}
+
+/*
+ * De-allocate object memory
+ */
+void
+bwsfree(const struct bwstring *s)
+{
+
+ if (s)
+ sort_free(s);
+}
+
+/*
+ * Copy content of src binary string to dst.
+ * If the capacity of the dst string is not sufficient,
+ * then the data is truncated.
+ */
+size_t
+bwscpy(struct bwstring *dst, const struct bwstring *src)
+{
+ size_t nums = src->len;
+
+ if (nums > dst->len)
+ nums = dst->len;
+ dst->len = nums;
+
+ if (MB_CUR_MAX == 1) {
+ memcpy(dst->data.cstr, src->data.cstr, nums);
+ dst->data.cstr[dst->len] = '\0';
+ } else {
+ memcpy(dst->data.wstr, src->data.wstr,
+ SIZEOF_WCHAR_STRING(nums + 1));
+ dst->data.wstr[dst->len] = L'\0';
+ }
+
+ return (nums);
+}
+
+/*
+ * Copy content of src binary string to dst,
+ * with specified number of symbols to be copied.
+ * If the capacity of the dst string is not sufficient,
+ * then the data is truncated.
+ */
+struct bwstring *
+bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size)
+{
+ size_t nums = src->len;
+
+ if (nums > dst->len)
+ nums = dst->len;
+ if (nums > size)
+ nums = size;
+ dst->len = nums;
+
+ if (MB_CUR_MAX == 1) {
+ memcpy(dst->data.cstr, src->data.cstr, nums);
+ dst->data.cstr[dst->len] = '\0';
+ } else {
+ memcpy(dst->data.wstr, src->data.wstr,
+ SIZEOF_WCHAR_STRING(nums + 1));
+ dst->data.wstr[dst->len] = L'\0';
+ }
+
+ return (dst);
+}
+
+/*
+ * Copy content of src binary string to dst,
+ * with specified number of symbols to be copied.
+ * An offset value can be specified, from the start of src string.
+ * If the capacity of the dst string is not sufficient,
+ * then the data is truncated.
+ */
+struct bwstring *
+bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset,
+ size_t size)
+{
+
+ if (offset >= src->len) {
+ dst->data.wstr[0] = 0;
+ dst->len = 0;
+ } else {
+ size_t nums = src->len - offset;
+
+ if (nums > dst->len)
+ nums = dst->len;
+ if (nums > size)
+ nums = size;
+ dst->len = nums;
+ if (MB_CUR_MAX == 1) {
+ memcpy(dst->data.cstr, src->data.cstr + offset,
+ (nums));
+ dst->data.cstr[dst->len] = '\0';
+ } else {
+ memcpy(dst->data.wstr, src->data.wstr + offset,
+ SIZEOF_WCHAR_STRING(nums));
+ dst->data.wstr[dst->len] = L'\0';
+ }
+ }
+ return (dst);
+}
+
+/*
+ * Write binary string to the file.
+ * The output is ended either with '\n' (nl == true)
+ * or '\0' (nl == false).
+ */
+size_t
+bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended)
+{
+
+ if (MB_CUR_MAX == 1) {
+ size_t len = bws->len;
+
+ if (!zero_ended) {
+ bws->data.cstr[len] = '\n';
+
+ if (fwrite(bws->data.cstr, len + 1, 1, f) < 1)
+ err(2, NULL);
+
+ bws->data.cstr[len] = '\0';
+ } else if (fwrite(bws->data.cstr, len + 1, 1, f) < 1)
+ err(2, NULL);
+
+ return (len + 1);
+
+ } else {
+ wchar_t eols;
+ size_t printed = 0;
+
+ eols = zero_ended ? btowc('\0') : btowc('\n');
+
+ while (printed < BWSLEN(bws)) {
+ const wchar_t *s = bws->data.wstr + printed;
+
+ if (*s == L'\0') {
+ int nums;
+
+ nums = fwprintf(f, L"%lc", *s);
+
+ if (nums != 1)
+ err(2, NULL);
+ ++printed;
+ } else {
+ int nums;
+
+ nums = fwprintf(f, L"%ls", s);
+
+ if (nums < 1)
+ err(2, NULL);
+ printed += nums;
+ }
+ }
+ fwprintf(f, L"%lc", eols);
+ return (printed + 1);
+ }
+}
+
+/*
+ * Allocate and read a binary string from file.
+ * The strings are nl-ended or zero-ended, depending on the sort setting.
+ */
+struct bwstring *
+bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
+{
+ wint_t eols;
+
+ eols = zero_ended ? btowc('\0') : btowc('\n');
+
+ if (!zero_ended && (MB_CUR_MAX > 1)) {
+ wchar_t *ret;
+
+ ret = fgetwln(f, len);
+
+ if (ret == NULL) {
+ if (!feof(f))
+ err(2, NULL);
+ return (NULL);
+ }
+ if (*len > 0) {
+ if (ret[*len - 1] == (wchar_t)eols)
+ --(*len);
+ }
+ return (bwssbdup(ret, *len));
+
+ } else if (!zero_ended && (MB_CUR_MAX == 1)) {
+ char *ret;
+
+ ret = fgetln(f, len);
+
+ if (ret == NULL) {
+ if (!feof(f))
+ err(2, NULL);
+ return (NULL);
+ }
+ if (*len > 0) {
+ if (ret[*len - 1] == '\n')
+ --(*len);
+ }
+ return (bwscsbdup((unsigned char*)ret, *len));
+
+ } else {
+ *len = 0;
+
+ if (feof(f))
+ return (NULL);
+
+ if (2 >= rb->fgetwln_z_buffer_size) {
+ rb->fgetwln_z_buffer_size += 256;
+ rb->fgetwln_z_buffer = sort_realloc(rb->fgetwln_z_buffer,
+ sizeof(wchar_t) * rb->fgetwln_z_buffer_size);
+ }
+ rb->fgetwln_z_buffer[*len] = 0;
+
+ if (MB_CUR_MAX == 1)
+ while (!feof(f)) {
+ int c;
+
+ c = fgetc(f);
+
+ if (c == EOF) {
+ if (*len == 0)
+ return (NULL);
+ goto line_read_done;
+ }
+ if (c == eols)
+ goto line_read_done;
+
+ if (*len + 1 >= rb->fgetwln_z_buffer_size) {
+ rb->fgetwln_z_buffer_size += 256;
+ rb->fgetwln_z_buffer = sort_realloc(rb->fgetwln_z_buffer,
+ SIZEOF_WCHAR_STRING(rb->fgetwln_z_buffer_size));
+ }
+
+ rb->fgetwln_z_buffer[*len] = c;
+ rb->fgetwln_z_buffer[++(*len)] = 0;
+ }
+ else
+ while (!feof(f)) {
+ wint_t c = 0;
+
+ c = fgetwc(f);
+
+ if (c == WEOF) {
+ if (*len == 0)
+ return (NULL);
+ goto line_read_done;
+ }
+ if (c == eols)
+ goto line_read_done;
+
+ if (*len + 1 >= rb->fgetwln_z_buffer_size) {
+ rb->fgetwln_z_buffer_size += 256;
+ rb->fgetwln_z_buffer = sort_realloc(rb->fgetwln_z_buffer,
+ SIZEOF_WCHAR_STRING(rb->fgetwln_z_buffer_size));
+ }
+
+ rb->fgetwln_z_buffer[*len] = c;
+ rb->fgetwln_z_buffer[++(*len)] = 0;
+ }
+
+line_read_done:
+ /* we do not count the last 0 */
+ return (bwssbdup(rb->fgetwln_z_buffer, *len));
+ }
+}
+
+int
+bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2,
+ size_t offset, size_t len)
+{
+ size_t cmp_len, len1, len2;
+ int res = 0;
+
+ cmp_len = 0;
+ len1 = bws1->len;
+ len2 = bws2->len;
+
+ if (len1 <= offset) {
+ return ((len2 <= offset) ? 0 : -1);
+ } else {
+ if (len2 <= offset)
+ return (+1);
+ else {
+ len1 -= offset;
+ len2 -= offset;
+
+ cmp_len = len1;
+
+ if (len2 < cmp_len)
+ cmp_len = len2;
+
+ if (len < cmp_len)
+ cmp_len = len;
+
+ if (MB_CUR_MAX == 1) {
+ const unsigned char *s1, *s2;
+
+ s1 = bws1->data.cstr + offset;
+ s2 = bws2->data.cstr + offset;
+
+ res = memcmp(s1, s2, cmp_len);
+
+ } else {
+ const wchar_t *s1, *s2;
+
+ s1 = bws1->data.wstr + offset;
+ s2 = bws2->data.wstr + offset;
+
+ res = memcmp(s1, s2, SIZEOF_WCHAR_STRING(cmp_len));
+ }
+ }
+ }
+
+ if (res == 0) {
+ if (len1 < cmp_len && len1 < len2)
+ res = -1;
+ else if (len2 < cmp_len && len2 < len1)
+ res = +1;
+ }
+
+ return (res);
+}
+
+int
+bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset)
+{
+ size_t len1, len2, cmp_len;
+ int res;
+
+ len1 = bws1->len;
+ len2 = bws2->len;
+
+ len1 -= offset;
+ len2 -= offset;
+
+ cmp_len = len1;
+
+ if (len2 < cmp_len)
+ cmp_len = len2;
+
+ res = bwsncmp(bws1, bws2, offset, cmp_len);
+
+ if (res == 0) {
+ if( len1 < len2)
+ res = -1;
+ else if (len2 < len1)
+ res = +1;
+ }
+
+ return (res);
+}
+
+int
+bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len)
+{
+ wchar_t c1, c2;
+ size_t i = 0;
+
+ for (i = 0; i < len; ++i) {
+ c1 = bws_get_iter_value(iter1);
+ c2 = bws_get_iter_value(iter2);
+ if (c1 != c2)
+ return (c1 - c2);
+ iter1 = bws_iterator_inc(iter1, 1);
+ iter2 = bws_iterator_inc(iter2, 1);
+ }
+
+ return (0);
+}
+
+int
+bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset)
+{
+ size_t len1, len2;
+
+ len1 = bws1->len;
+ len2 = bws2->len;
+
+ if (len1 <= offset)
+ return ((len2 <= offset) ? 0 : -1);
+ else {
+ if (len2 <= offset)
+ return (+1);
+ else {
+ len1 -= offset;
+ len2 -= offset;
+
+ if (MB_CUR_MAX == 1) {
+ const unsigned char *s1, *s2;
+
+ s1 = bws1->data.cstr + offset;
+ s2 = bws2->data.cstr + offset;
+
+ if (byte_sort) {
+ int res = 0;
+
+ if (len1 > len2) {
+ res = memcmp(s1, s2, len2);
+ if (!res)
+ res = +1;
+ } else if (len1 < len2) {
+ res = memcmp(s1, s2, len1);
+ if (!res)
+ res = -1;
+ } else
+ res = memcmp(s1, s2, len1);
+
+ return (res);
+
+ } else {
+ int res = 0;
+ size_t i, maxlen;
+
+ i = 0;
+ maxlen = len1;
+
+ if (maxlen > len2)
+ maxlen = len2;
+
+ while (i < maxlen) {
+ /* goto next non-zero part: */
+ while ((i < maxlen) &&
+ !s1[i] && !s2[i])
+ ++i;
+
+ if (i >= maxlen)
+ break;
+
+ if (s1[i] == 0) {
+ if (s2[i] == 0)
+ /* NOTREACHED */
+ err(2, "bwscoll error 01");
+ else
+ return (-1);
+ } else if (s2[i] == 0)
+ return (+1);
+
+ res = strcoll((const char*)(s1 + i), (const char*)(s2 + i));
+ if (res)
+ return (res);
+
+ while ((i < maxlen) &&
+ s1[i] && s2[i])
+ ++i;
+
+ if (i >= maxlen)
+ break;
+
+ if (s1[i] == 0) {
+ if (s2[i] == 0) {
+ ++i;
+ continue;
+ } else
+ return (-1);
+ } else if (s2[i] == 0)
+ return (+1);
+ else
+ /* NOTREACHED */
+ err(2, "bwscoll error 02");
+ }
+
+ if (len1 < len2)
+ return (-1);
+ else if (len1 > len2)
+ return (+1);
+
+ return (0);
+ }
+ } else {
+ const wchar_t *s1, *s2;
+ size_t i, maxlen;
+ int res = 0;
+
+ s1 = bws1->data.wstr + offset;
+ s2 = bws2->data.wstr + offset;
+
+ i = 0;
+ maxlen = len1;
+
+ if (maxlen > len2)
+ maxlen = len2;
+
+ while (i < maxlen) {
+
+ /* goto next non-zero part: */
+ while ((i < maxlen) &&
+ !s1[i] && !s2[i])
+ ++i;
+
+ if (i >= maxlen)
+ break;
+
+ if (s1[i] == 0) {
+ if (s2[i] == 0)
+ /* NOTREACHED */
+ err(2, "bwscoll error 1");
+ else
+ return (-1);
+ } else if (s2[i] == 0)
+ return (+1);
+
+ res = wide_str_coll(s1 + i, s2 + i);
+ if (res)
+ return (res);
+
+ while ((i < maxlen) && s1[i] && s2[i])
+ ++i;
+
+ if (i >= maxlen)
+ break;
+
+ if (s1[i] == 0) {
+ if (s2[i] == 0) {
+ ++i;
+ continue;
+ } else
+ return (-1);
+ } else if (s2[i] == 0)
+ return (+1);
+ else
+ /* NOTREACHED */
+ err(2, "bwscoll error 2");
+ }
+
+ if (len1 < len2)
+ return (-1);
+ else if (len1 > len2)
+ return (+1);
+
+ return (0);
+ }
+ }
+ }
+}
+
+/*
+ * Correction of the system API
+ */
+double
+bwstod(struct bwstring *s0, bool *empty)
+{
+ double ret = 0;
+
+ if (MB_CUR_MAX == 1) {
+ unsigned char *end, *s;
+ char *ep;
+
+ s = s0->data.cstr;
+ end = s + s0->len;
+ ep = NULL;
+
+ while (isblank(*s) && s < end)
+ ++s;
+
+ if (!isprint(*s)) {
+ *empty = true;
+ return (0);
+ }
+
+ ret = strtod((char*)s, &ep);
+ if ((unsigned char*) ep == s) {
+ *empty = true;
+ return (0);
+ }
+ } else {
+ wchar_t *end, *ep, *s;
+
+ s = s0->data.wstr;
+ end = s + s0->len;
+ ep = NULL;
+
+ while (iswblank(*s) && s < end)
+ ++s;
+
+ if (!iswprint(*s)) {
+ *empty = true;
+ return (0);
+ }
+
+ ret = wcstod(s, &ep);
+ if (ep == s) {
+ *empty = true;
+ return (0);
+ }
+ }
+
+ *empty = false;
+ return (ret);
+}
+
+/*
+ * A helper function for monthcoll. If a line matches
+ * a month name, it returns (number of the month - 1),
+ * while if there is no match, it just return -1.
+ */
+
+int
+bws_month_score(const struct bwstring *s0)
+{
+
+ if (MB_CUR_MAX == 1) {
+ const unsigned char *end, *s;
+ size_t len;
+
+ s = s0->data.cstr;
+ end = s + s0->len;
+
+ while (isblank(*s) && s < end)
+ ++s;
+
+ len = strlen((const char*)s);
+
+ for (int i = 11; i >= 0; --i) {
+ if (cmonths[i] &&
+ (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i]))))
+ return (i);
+ }
+
+ } else {
+ const wchar_t *end, *s;
+ size_t len;
+
+ s = s0->data.wstr;
+ end = s + s0->len;
+
+ while (iswblank(*s) && s < end)
+ ++s;
+
+ len = wcslen(s);
+
+ for (int i = 11; i >= 0; --i) {
+ if (wmonths[i] && (s == wcsstr(s, wmonths[i])))
+ return (i);
+ }
+ }
+
+ return (-1);
+}
+
+/*
+ * Rips out leading blanks (-b).
+ */
+struct bwstring *
+ignore_leading_blanks(struct bwstring *str)
+{
+
+ if (MB_CUR_MAX == 1) {
+ unsigned char *dst, *end, *src;
+
+ src = str->data.cstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end && isblank(*src))
+ ++src;
+
+ if (src != dst) {
+ size_t newlen;
+
+ newlen = BWSLEN(str) - (src - dst);
+
+ while (src < end) {
+ *dst = *src;
+ ++dst;
+ ++src;
+ }
+ bws_setlen(str, newlen);
+ }
+ } else {
+ wchar_t *dst, *end, *src;
+
+ src = str->data.wstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end && iswblank(*src))
+ ++src;
+
+ if (src != dst) {
+
+ size_t newlen = BWSLEN(str) - (src - dst);
+
+ while (src < end) {
+ *dst = *src;
+ ++dst;
+ ++src;
+ }
+ bws_setlen(str, newlen);
+
+ }
+ }
+ return (str);
+}
+
+/*
+ * Rips out nonprinting characters (-i).
+ */
+struct bwstring *
+ignore_nonprinting(struct bwstring *str)
+{
+ size_t newlen = str->len;
+
+ if (MB_CUR_MAX == 1) {
+ unsigned char *dst, *end, *src;
+ unsigned char c;
+
+ src = str->data.cstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end) {
+ c = *src;
+ if (isprint(c)) {
+ *dst = c;
+ ++dst;
+ ++src;
+ } else {
+ ++src;
+ --newlen;
+ }
+ }
+ } else {
+ wchar_t *dst, *end, *src;
+ wchar_t c;
+
+ src = str->data.wstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end) {
+ c = *src;
+ if (iswprint(c)) {
+ *dst = c;
+ ++dst;
+ ++src;
+ } else {
+ ++src;
+ --newlen;
+ }
+ }
+ }
+ bws_setlen(str, newlen);
+
+ return (str);
+}
+
+/*
+ * Rips out any characters that are not alphanumeric characters
+ * nor blanks (-d).
+ */
+struct bwstring *
+dictionary_order(struct bwstring *str)
+{
+ size_t newlen = str->len;
+
+ if (MB_CUR_MAX == 1) {
+ unsigned char *dst, *end, *src;
+ unsigned char c;
+
+ src = str->data.cstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end) {
+ c = *src;
+ if (isalnum(c) || isblank(c)) {
+ *dst = c;
+ ++dst;
+ ++src;
+ } else {
+ ++src;
+ --newlen;
+ }
+ }
+ } else {
+ wchar_t *dst, *end, *src;
+ wchar_t c;
+
+ src = str->data.wstr;
+ dst = src;
+ end = src + str->len;
+
+ while (src < end) {
+ c = *src;
+ if (iswalnum(c) || iswblank(c)) {
+ *dst = c;
+ ++dst;
+ ++src;
+ } else {
+ ++src;
+ --newlen;
+ }
+ }
+ }
+ bws_setlen(str, newlen);
+
+ return (str);
+}
+
+/*
+ * Converts string to lower case(-f).
+ */
+struct bwstring *
+ignore_case(struct bwstring *str)
+{
+
+ if (MB_CUR_MAX == 1) {
+ unsigned char *end, *s;
+
+ s = str->data.cstr;
+ end = s + str->len;
+
+ while (s < end) {
+ *s = toupper(*s);
+ ++s;
+ }
+ } else {
+ wchar_t *end, *s;
+
+ s = str->data.wstr;
+ end = s + str->len;
+
+ while (s < end) {
+ *s = towupper(*s);
+ ++s;
+ }
+ }
+ return (str);
+}
+
+void
+bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos)
+{
+
+ if (MB_CUR_MAX == 1)
+ warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr);
+ else
+ warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr);
+}
diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h
new file mode 100644
index 0000000..7402ec6
--- /dev/null
+++ b/usr.bin/sort/bwstring.h
@@ -0,0 +1,142 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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.
+ */
+
+#if !defined(__BWSTRING_H__)
+#define __BWSTRING_H__
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sysexits.h>
+#include <wchar.h>
+
+#include "mem.h"
+
+extern bool byte_sort;
+
+/* wchar_t is of 4 bytes: */
+#define SIZEOF_WCHAR_STRING(LEN) ((LEN)*sizeof(wchar_t))
+
+/*
+ * Binary "wide" string
+ */
+struct bwstring
+{
+ size_t len;
+ union
+ {
+ wchar_t wstr[0];
+ unsigned char cstr[0];
+ } data;
+};
+
+struct reader_buffer
+{
+ wchar_t *fgetwln_z_buffer;
+ size_t fgetwln_z_buffer_size;
+};
+
+typedef void *bwstring_iterator;
+
+#define BWSLEN(s) ((s)->len)
+
+struct bwstring *bwsalloc(size_t sz);
+
+size_t bwsrawlen(const struct bwstring *bws);
+const void* bwsrawdata(const struct bwstring *bws);
+void bws_setlen(struct bwstring *bws, size_t newlen);
+size_t bws_memsize(const struct bwstring *bws);
+double bwstod(struct bwstring *s0, bool *empty);
+int bws_month_score(const struct bwstring *s0);
+
+struct bwstring *ignore_leading_blanks(struct bwstring *str);
+struct bwstring *ignore_nonprinting(struct bwstring *str);
+struct bwstring *dictionary_order(struct bwstring *str);
+struct bwstring *ignore_case(struct bwstring *str);
+
+void bwsprintf(FILE*, struct bwstring*, const char *prefix, const char *suffix);
+void bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos);
+
+struct bwstring *bwsdup(const struct bwstring *s);
+struct bwstring *bwssbdup(const wchar_t *str, size_t size);
+struct bwstring *bwscsbdup(const unsigned char *str, size_t size);
+void bwsfree(const struct bwstring *s);
+size_t bwscpy(struct bwstring *dst, const struct bwstring *src);
+struct bwstring *bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size);
+struct bwstring *bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, size_t size);
+int bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset);
+int bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset, size_t len);
+int bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset);
+size_t bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended);
+struct bwstring *bwsfgetln(FILE *file, size_t *len, bool zero_ended, struct reader_buffer *rb);
+
+static inline bwstring_iterator
+bws_begin(struct bwstring *bws)
+{
+
+ return (bwstring_iterator) (&(bws->data));
+}
+
+static inline bwstring_iterator
+bws_end(struct bwstring *bws)
+{
+
+ return ((MB_CUR_MAX == 1) ?
+ (bwstring_iterator) (bws->data.cstr + bws->len) :
+ (bwstring_iterator) (bws->data.wstr + bws->len));
+}
+
+static inline bwstring_iterator
+bws_iterator_inc(bwstring_iterator iter, size_t pos)
+{
+
+ if (MB_CUR_MAX == 1)
+ return ((unsigned char *) iter) + pos;
+ else
+ return ((wchar_t*) iter) + pos;
+}
+
+static inline wchar_t
+bws_get_iter_value(bwstring_iterator iter)
+{
+
+ if (MB_CUR_MAX == 1)
+ return *((unsigned char *) iter);
+ else
+ return *((wchar_t*) iter);
+}
+
+int
+bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len);
+
+#define BWS_GET(bws, pos) ((MB_CUR_MAX == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)])
+
+void initialise_months(void);
+
+#endif /* __BWSTRING_H__ */
diff --git a/usr.bin/sort/coll.c b/usr.bin/sort/coll.c
new file mode 100644
index 0000000..7b4ad10
--- /dev/null
+++ b/usr.bin/sort/coll.c
@@ -0,0 +1,1302 @@
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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 <errno.h>
+#include <err.h>
+#include <langinfo.h>
+#include <limits.h>
+#include <math.h>
+#include <md5.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "coll.h"
+#include "vsort.h"
+
+struct key_specs *keys;
+size_t keys_num = 0;
+
+wint_t symbol_decimal_point = L'.';
+/* there is no default thousands separator in collate rules: */
+wint_t symbol_thousands_sep = 0;
+wint_t symbol_negative_sign = L'-';
+wint_t symbol_positive_sign = L'+';
+
+static int wstrcoll(struct key_value *kv1, struct key_value *kv2, size_t offset);
+static int gnumcoll(struct key_value*, struct key_value *, size_t offset);
+static int monthcoll(struct key_value*, struct key_value *, size_t offset);
+static int numcoll(struct key_value*, struct key_value *, size_t offset);
+static int hnumcoll(struct key_value*, struct key_value *, size_t offset);
+static int randomcoll(struct key_value*, struct key_value *, size_t offset);
+static int versioncoll(struct key_value*, struct key_value *, size_t offset);
+
+/*
+ * Allocate keys array
+ */
+struct keys_array *
+keys_array_alloc(void)
+{
+ struct keys_array *ka;
+ size_t sz;
+
+ sz = keys_array_size();
+ ka = sort_malloc(sz);
+ memset(ka, 0, sz);
+
+ return (ka);
+}
+
+/*
+ * Calculate whether we need key hint space
+ */
+static size_t
+key_hint_size(void)
+{
+
+ return (need_hint ? sizeof(struct key_hint) : 0);
+}
+
+/*
+ * Calculate keys array size
+ */
+size_t
+keys_array_size(void)
+{
+
+ return (keys_num * (sizeof(struct key_value) + key_hint_size()));
+}
+
+/*
+ * Clean data of keys array
+ */
+void
+clean_keys_array(const struct bwstring *s, struct keys_array *ka)
+{
+
+ if (ka) {
+ for (size_t i = 0; i < keys_num; ++i)
+ if (ka->key[i].k && ka->key[i].k != s)
+ bwsfree(ka->key[i].k);
+ memset(ka, 0, keys_array_size());
+ }
+}
+
+/*
+ * Set value of a key in the keys set
+ */
+void
+set_key_on_keys_array(struct keys_array *ka, struct bwstring *s, size_t ind)
+{
+
+ if (ka && keys_num > ind) {
+ struct key_value *kv;
+
+ kv = &(ka->key[ind]);
+
+ if (kv->k && kv->k != s)
+ bwsfree(kv->k);
+ kv->k = s;
+ }
+}
+
+/*
+ * Initialize a sort list item
+ */
+struct sort_list_item *
+sort_list_item_alloc(void)
+{
+ struct sort_list_item *si;
+ size_t sz;
+
+ sz = sizeof(struct sort_list_item) + keys_array_size();
+ si = sort_malloc(sz);
+ memset(si, 0, sz);
+
+ return (si);
+}
+
+size_t
+sort_list_item_size(struct sort_list_item *si)
+{
+ size_t ret = 0;
+
+ if (si) {
+ ret = sizeof(struct sort_list_item) + keys_array_size();
+ if (si->str)
+ ret += bws_memsize(si->str);
+ for (size_t i = 0; i < keys_num; ++i) {
+ struct key_value *kv;
+
+ kv = &(si->ka.key[i]);
+
+ if (kv->k != si->str)
+ ret += bws_memsize(kv->k);
+ }
+ }
+ return (ret);
+}
+
+/*
+ * Calculate key for a sort list item
+ */
+static void
+sort_list_item_make_key(struct sort_list_item *si)
+{
+
+ preproc(si->str, &(si->ka));
+}
+
+/*
+ * Set value of a sort list item.
+ * Return combined string and keys memory size.
+ */
+void
+sort_list_item_set(struct sort_list_item *si, struct bwstring *str)
+{
+
+ if (si) {
+ clean_keys_array(si->str, &(si->ka));
+ if (si->str) {
+ if (si->str == str) {
+ /* we are trying to reset the same string */
+ return;
+ } else {
+ bwsfree(si->str);
+ si->str = NULL;
+ }
+ }
+ si->str = str;
+ sort_list_item_make_key(si);
+ }
+}
+
+/*
+ * De-allocate a sort list item object memory
+ */
+void
+sort_list_item_clean(struct sort_list_item *si)
+{
+
+ if (si) {
+ clean_keys_array(si->str, &(si->ka));
+ if (si->str) {
+ bwsfree(si->str);
+ si->str = NULL;
+ }
+ }
+}
+
+/*
+ * Skip columns according to specs
+ */
+static size_t
+skip_cols_to_start(const struct bwstring *s, size_t cols, size_t start,
+ bool skip_blanks, bool *empty_key)
+{
+ if (cols < 1)
+ return (BWSLEN(s) + 1);
+
+ if (skip_blanks)
+ while (start < BWSLEN(s) && iswblank(BWS_GET(s,start)))
+ ++start;
+
+ while (start < BWSLEN(s) && cols > 1) {
+ --cols;
+ ++start;
+ }
+
+ if (start >= BWSLEN(s))
+ *empty_key = true;
+
+ return (start);
+}
+
+/*
+ * Skip fields according to specs
+ */
+static size_t
+skip_fields_to_start(const struct bwstring *s, size_t fields, bool *empty_field)
+{
+
+ if (fields < 2) {
+ if (BWSLEN(s) == 0)
+ *empty_field = true;
+ return (0);
+ } else if (!(sort_opts_vals.tflag)) {
+ size_t cpos = 0;
+ bool pb = true;
+
+ while (cpos < BWSLEN(s)) {
+ bool isblank;
+
+ isblank = iswblank(BWS_GET(s, cpos));
+
+ if (isblank && !pb) {
+ --fields;
+ if (fields <= 1)
+ return (cpos);
+ }
+ pb = isblank;
+ ++cpos;
+ }
+ if (fields > 1)
+ *empty_field = true;
+ return (cpos);
+ } else {
+ size_t cpos = 0;
+
+ while (cpos < BWSLEN(s)) {
+ if (BWS_GET(s,cpos) == (wchar_t)sort_opts_vals.field_sep) {
+ --fields;
+ if (fields <= 1)
+ return (cpos + 1);
+ }
+ ++cpos;
+ }
+ if (fields > 1)
+ *empty_field = true;
+ return (cpos);
+ }
+}
+
+/*
+ * Find fields start
+ */
+static void
+find_field_start(const struct bwstring *s, struct key_specs *ks,
+ size_t *field_start, size_t *key_start, bool *empty_field, bool *empty_key)
+{
+
+ *field_start = skip_fields_to_start(s, ks->f1, empty_field);
+ if (!*empty_field)
+ *key_start = skip_cols_to_start(s, ks->c1, *field_start,
+ ks->pos1b, empty_key);
+ else
+ *empty_key = true;
+}
+
+/*
+ * Find end key position
+ */
+static size_t
+find_field_end(const struct bwstring *s, struct key_specs *ks)
+{
+ size_t f2, next_field_start, pos_end;
+ bool empty_field, empty_key;
+
+ pos_end = 0;
+ next_field_start = 0;
+ empty_field = false;
+ empty_key = false;
+ f2 = ks->f2;
+
+ if (f2 == 0)
+ return (BWSLEN(s) + 1);
+ else {
+ if (ks->c2 == 0) {
+ next_field_start = skip_fields_to_start(s, f2 + 1,
+ &empty_field);
+ if ((next_field_start > 0) && sort_opts_vals.tflag &&
+ ((wchar_t)sort_opts_vals.field_sep == BWS_GET(s,
+ next_field_start - 1)))
+ --next_field_start;
+ } else
+ next_field_start = skip_fields_to_start(s, f2,
+ &empty_field);
+ }
+
+ if (empty_field || (next_field_start >= BWSLEN(s)))
+ return (BWSLEN(s) + 1);
+
+ if (ks->c2) {
+ pos_end = skip_cols_to_start(s, ks->c2, next_field_start,
+ ks->pos2b, &empty_key);
+ if (pos_end < BWSLEN(s))
+ ++pos_end;
+ } else
+ pos_end = next_field_start;
+
+ return (pos_end);
+}
+
+/*
+ * Cut a field according to the key specs
+ */
+static struct bwstring *
+cut_field(const struct bwstring *s, struct key_specs *ks)
+{
+ struct bwstring *ret = NULL;
+
+ if (s && ks) {
+ size_t field_start, key_end, key_start, sz;
+ bool empty_field, empty_key;
+
+ field_start = 0;
+ key_start = 0;
+ empty_field = false;
+ empty_key = false;
+
+ find_field_start(s, ks, &field_start, &key_start,
+ &empty_field, &empty_key);
+
+ if (empty_key)
+ sz = 0;
+ else {
+ key_end = find_field_end(s, ks);
+ sz = (key_end < key_start) ? 0 : (key_end - key_start);
+ }
+
+ ret = bwsalloc(sz);
+ if (sz)
+ bwsnocpy(ret, s, key_start, sz);
+ } else
+ ret = bwsalloc(0);
+
+ return (ret);
+}
+
+/*
+ * Preprocesses a line applying the necessary transformations
+ * specified by command line options and returns the preprocessed
+ * string, which can be used to compare.
+ */
+int
+preproc(struct bwstring *s, struct keys_array *ka)
+{
+
+ if (sort_opts_vals.kflag)
+ for (size_t i = 0; i < keys_num; i++) {
+ struct bwstring *key;
+ struct key_specs *kspecs;
+ struct sort_mods *sm;
+
+ kspecs = &(keys[i]);
+ key = cut_field(s, kspecs);
+
+ sm = &(kspecs->sm);
+ if (sm->dflag)
+ key = dictionary_order(key);
+ else if (sm->iflag)
+ key = ignore_nonprinting(key);
+ if (sm->fflag || sm->Mflag)
+ key = ignore_case(key);
+
+ set_key_on_keys_array(ka, key, i);
+ }
+ else {
+ struct bwstring *ret = NULL;
+ struct sort_mods *sm = default_sort_mods;
+
+ if (sm->bflag) {
+ if (ret == NULL)
+ ret = bwsdup(s);
+ ret = ignore_leading_blanks(ret);
+ }
+ if (sm->dflag) {
+ if (ret == NULL)
+ ret = bwsdup(s);
+ ret = dictionary_order(ret);
+ } else if (sm->iflag) {
+ if (ret == NULL)
+ ret = bwsdup(s);
+ ret = ignore_nonprinting(ret);
+ }
+ if (sm->fflag || sm->Mflag) {
+ if (ret == NULL)
+ ret = bwsdup(s);
+ ret = ignore_case(ret);
+ }
+ if (ret == NULL)
+ set_key_on_keys_array(ka, s, 0);
+ else
+ set_key_on_keys_array(ka, ret, 0);
+ }
+
+ return 0;
+}
+
+cmpcoll_t
+get_sort_func(struct sort_mods *sm)
+{
+
+ if (sm->nflag)
+ return (numcoll);
+ else if (sm->hflag)
+ return (hnumcoll);
+ else if (sm->gflag)
+ return (gnumcoll);
+ else if (sm->Mflag)
+ return (monthcoll);
+ else if (sm->Rflag)
+ return (randomcoll);
+ else if (sm->Vflag)
+ return (versioncoll);
+ else
+ return (wstrcoll);
+}
+
+/*
+ * Compares the given strings. Returns a positive number if
+ * the first precedes the second, a negative number if the second is
+ * the preceding one, and zero if they are equal. This function calls
+ * the underlying collate functions, which done the actual comparison.
+ */
+int
+key_coll(struct keys_array *ps1, struct keys_array *ps2, size_t offset)
+{
+ struct sort_mods *sm;
+ int res = 0;
+
+ for (size_t i = 0; i < keys_num; ++i) {
+ sm = &(keys[i].sm);
+
+ if (sm->rflag)
+ res = sm->func(&(ps2->key[i]), &(ps1->key[i]), offset);
+ else
+ res = sm->func(&(ps1->key[i]), &(ps2->key[i]), offset);
+
+ if (res)
+ break;
+
+ /* offset applies to only the first key */
+ offset = 0;
+ }
+ return (res);
+}
+
+/*
+ * Compare two strings.
+ * Plain symbol-by-symbol comparison.
+ */
+int
+top_level_str_coll(const struct bwstring *s1, const struct bwstring *s2)
+{
+
+ if (default_sort_mods->rflag) {
+ const struct bwstring *tmp;
+
+ tmp = s1;
+ s1 = s2;
+ s2 = tmp;
+ }
+
+ return (bwscoll(s1, s2, 0));
+}
+
+/*
+ * Compare a string and a sort list item, according to the sort specs.
+ */
+int
+str_list_coll(struct bwstring *str1, struct sort_list_item **ss2)
+{
+ struct keys_array *ka1;
+ int ret = 0;
+
+ ka1 = keys_array_alloc();
+
+ preproc(str1, ka1);
+
+ sort_list_item_make_key(*ss2);
+
+ if (debug_sort) {
+ bwsprintf(stdout, str1, "; s1=<", ">");
+ bwsprintf(stdout, (*ss2)->str, ", s2=<", ">");
+ }
+
+ ret = key_coll(ka1, &((*ss2)->ka), 0);
+
+ if (debug_sort)
+ printf("; cmp1=%d", ret);
+
+ clean_keys_array(str1, ka1);
+ sort_free(ka1);
+
+ if ((ret == 0) && !(sort_opts_vals.sflag) && sort_opts_vals.complex_sort) {
+ ret = top_level_str_coll(str1, ((*ss2)->str));
+ if (debug_sort)
+ printf("; cmp2=%d", ret);
+ }
+
+ if (debug_sort)
+ printf("\n");
+
+ return (ret);
+}
+
+/*
+ * Compare two sort list items, according to the sort specs.
+ */
+int
+list_coll_offset(struct sort_list_item **ss1, struct sort_list_item **ss2,
+ size_t offset)
+{
+ int ret;
+
+ ret = key_coll(&((*ss1)->ka), &((*ss2)->ka), offset);
+
+ if (debug_sort) {
+ if (offset)
+ printf("; offset=%d", (int) offset);
+ bwsprintf(stdout, ((*ss1)->str), "; s1=<", ">");
+ bwsprintf(stdout, ((*ss2)->str), ", s2=<", ">");
+ printf("; cmp1=%d\n", ret);
+ }
+
+ if (ret)
+ return (ret);
+
+ if (!(sort_opts_vals.sflag) && sort_opts_vals.complex_sort) {
+ ret = top_level_str_coll(((*ss1)->str), ((*ss2)->str));
+ if (debug_sort)
+ printf("; cmp2=%d\n", ret);
+ }
+
+ return (ret);
+}
+
+/*
+ * Compare two sort list items, according to the sort specs.
+ */
+int
+list_coll(struct sort_list_item **ss1, struct sort_list_item **ss2)
+{
+
+ return (list_coll_offset(ss1, ss2, 0));
+}
+
+#define LSCDEF(N) \
+static int \
+list_coll_##N(struct sort_list_item **ss1, struct sort_list_item **ss2) \
+{ \
+ \
+ return (list_coll_offset(ss1, ss2, N)); \
+}
+
+LSCDEF(1)
+LSCDEF(2)
+LSCDEF(3)
+LSCDEF(4)
+LSCDEF(5)
+LSCDEF(6)
+LSCDEF(7)
+LSCDEF(8)
+LSCDEF(9)
+LSCDEF(10)
+LSCDEF(11)
+LSCDEF(12)
+LSCDEF(13)
+LSCDEF(14)
+LSCDEF(15)
+LSCDEF(16)
+LSCDEF(17)
+LSCDEF(18)
+LSCDEF(19)
+LSCDEF(20)
+
+listcoll_t
+get_list_call_func(size_t offset)
+{
+ static const listcoll_t lsarray[] = { list_coll, list_coll_1,
+ list_coll_2, list_coll_3, list_coll_4, list_coll_5,
+ list_coll_6, list_coll_7, list_coll_8, list_coll_9,
+ list_coll_10, list_coll_11, list_coll_12, list_coll_13,
+ list_coll_14, list_coll_15, list_coll_16, list_coll_17,
+ list_coll_18, list_coll_19, list_coll_20 };
+
+ if (offset <= 20)
+ return (lsarray[offset]);
+
+ return (list_coll);
+}
+
+/*
+ * Compare two sort list items, only by their original string.
+ */
+int
+list_coll_by_str_only(struct sort_list_item **ss1, struct sort_list_item **ss2)
+{
+
+ return (top_level_str_coll(((*ss1)->str), ((*ss2)->str)));
+}
+
+/*
+ * Maximum size of a number in the string (before or after decimal point)
+ */
+#define MAX_NUM_SIZE (128)
+
+/*
+ * Set suffix value
+ */
+static void setsuffix(wchar_t c, unsigned char *si)
+{
+ switch (c){
+ case L'k':
+ case L'K':
+ *si = 1;
+ break;
+ case L'M':
+ *si = 2;
+ break;
+ case L'G':
+ *si = 3;
+ break;
+ case L'T':
+ *si = 4;
+ break;
+ case L'P':
+ *si = 5;
+ break;
+ case L'E':
+ *si = 6;
+ break;
+ case L'Z':
+ *si = 7;
+ break;
+ case L'Y':
+ *si = 8;
+ break;
+ default:
+ *si = 0;
+ }
+}
+
+/*
+ * Read string s and parse the string into a fixed-decimal-point number.
+ * sign equals -1 if the number is negative (explicit plus is not allowed,
+ * according to GNU sort's "info sort".
+ * The number part before decimal point is in the smain, after the decimal
+ * point is in sfrac, tail is the pointer to the remainder of the string.
+ */
+static int
+read_number(struct bwstring *s0, int *sign, wchar_t *smain, size_t *main_len, wchar_t *sfrac, size_t *frac_len, unsigned char *si)
+{
+ bwstring_iterator s;
+
+ s = bws_begin(s0);
+
+ /* always end the fraction with zero, even if we have no fraction */
+ sfrac[0] = 0;
+
+ while (iswblank(bws_get_iter_value(s)))
+ s = bws_iterator_inc(s, 1);
+
+ if (bws_get_iter_value(s) == (wchar_t)symbol_negative_sign) {
+ *sign = -1;
+ s = bws_iterator_inc(s, 1);
+ }
+
+ // This is '0', not '\0', do not change this
+ while (iswdigit(bws_get_iter_value(s)) &&
+ (bws_get_iter_value(s) == L'0'))
+ s = bws_iterator_inc(s, 1);
+
+ while (bws_get_iter_value(s) && *main_len < MAX_NUM_SIZE) {
+ if (iswdigit(bws_get_iter_value(s))) {
+ smain[*main_len] = bws_get_iter_value(s);
+ s = bws_iterator_inc(s, 1);
+ *main_len += 1;
+ } else if (symbol_thousands_sep &&
+ (bws_get_iter_value(s) == (wchar_t)symbol_thousands_sep))
+ s = bws_iterator_inc(s, 1);
+ else
+ break;
+ }
+
+ smain[*main_len] = 0;
+
+ if (bws_get_iter_value(s) == (wchar_t)symbol_decimal_point) {
+ s = bws_iterator_inc(s, 1);
+ while (iswdigit(bws_get_iter_value(s)) &&
+ *frac_len < MAX_NUM_SIZE) {
+ sfrac[*frac_len] = bws_get_iter_value(s);
+ s = bws_iterator_inc(s, 1);
+ *frac_len += 1;
+ }
+ sfrac[*frac_len] = 0;
+
+ while (*frac_len > 0 && sfrac[*frac_len - 1] == L'0') {
+ --(*frac_len);
+ sfrac[*frac_len] = L'\0';
+ }
+ }
+
+ setsuffix(bws_get_iter_value(s),si);
+
+ if ((*main_len + *frac_len) == 0)
+ *sign = 0;
+
+ return (0);
+}
+
+/*
+ * Implements string sort.
+ */
+static int
+wstrcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+{
+
+ if (debug_sort) {
+ if (offset)
+ printf("; offset=%d\n", (int) offset);
+ bwsprintf(stdout, kv1->k, "; k1=<", ">");
+ printf("(%zu)", BWSLEN(kv1->k));
+ bwsprintf(stdout, kv2->k, ", k2=<", ">");
+ printf("(%zu)", BWSLEN(kv2->k));
+ }
+
+ return (bwscoll(kv1->k, kv2->k, offset));
+}
+
+/*
+ * Compare two suffixes
+ */
+static inline int
+cmpsuffix(unsigned char si1, unsigned char si2)
+{
+
+ return ((char)si1 - (char)si2);
+}
+
+/*
+ * Implements numeric sort for -n and -h.
+ */
+static int
+numcoll_impl(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused, bool use_suffix)
+{
+ struct bwstring *s1, *s2;
+ wchar_t sfrac1[MAX_NUM_SIZE + 1], sfrac2[MAX_NUM_SIZE + 1];
+ wchar_t smain1[MAX_NUM_SIZE + 1], smain2[MAX_NUM_SIZE + 1];
+ int cmp_res, sign1, sign2;
+ size_t frac1, frac2, main1, main2;
+ unsigned char SI1, SI2;
+ bool e1, e2, key1_read, key2_read;
+
+ s1 = kv1->k;
+ s2 = kv2->k;
+ sign1 = sign2 = 0;
+ main1 = main2 = 0;
+ frac1 = frac2 = 0;
+
+ cmp_res = 0;
+ key1_read = key2_read = false;
+
+ if (debug_sort) {
+ bwsprintf(stdout, s1, "; k1=<", ">");
+ bwsprintf(stdout, s2, ", k2=<", ">");
+ }
+
+ if (s1 == s2)
+ return (0);
+
+ if (kv1->hint->status == HS_UNINITIALIZED) {
+ /* read the number from the string */
+ read_number(s1, &sign1, smain1, &main1, sfrac1, &frac1, &SI1);
+ key1_read = true;
+ kv1->hint->v.nh.n1 = wcstoull(smain1, NULL, 10);
+ if(main1 < 1 && frac1 < 1)
+ kv1->hint->v.nh.empty=true;
+ kv1->hint->v.nh.si = SI1;
+ kv1->hint->status = (kv1->hint->v.nh.n1 != ULLONG_MAX) ?
+ HS_INITIALIZED : HS_ERROR;
+ kv1->hint->v.nh.neg = (sign1 < 0) ? true : false;
+ }
+
+ if (kv2->hint->status == HS_UNINITIALIZED) {
+ /* read the number from the string */
+ read_number(s2, &sign2, smain2, &main2, sfrac2, &frac2,&SI2);
+ key2_read = true;
+ kv2->hint->v.nh.n1 = wcstoull(smain2, NULL, 10);
+ if(main2 < 1 && frac2 < 1)
+ kv2->hint->v.nh.empty=true;
+ kv2->hint->v.nh.si = SI2;
+ kv2->hint->status = (kv2->hint->v.nh.n1 != ULLONG_MAX) ?
+ HS_INITIALIZED : HS_ERROR;
+ kv2->hint->v.nh.neg = (sign2 < 0) ? true : false;
+ }
+
+ if (kv1->hint->status == HS_INITIALIZED && kv2->hint->status ==
+ HS_INITIALIZED) {
+ unsigned long long n1, n2;
+ bool neg1, neg2;
+
+ e1 = kv1->hint->v.nh.empty;
+ e2 = kv2->hint->v.nh.empty;
+
+ if (e1 && e2)
+ return (0);
+
+ neg1 = kv1->hint->v.nh.neg;
+ neg2 = kv2->hint->v.nh.neg;
+
+ if (neg1 && !neg2)
+ return (-1);
+ if (neg2 && !neg1)
+ return (+1);
+
+ if (e1)
+ return (neg2 ? +1 : -1);
+ else if (e2)
+ return (neg1 ? -1 : +1);
+
+
+ if (use_suffix) {
+ cmp_res = cmpsuffix(kv1->hint->v.nh.si, kv2->hint->v.nh.si);
+ if (cmp_res)
+ return (neg1 ? -cmp_res : cmp_res);
+ }
+
+ n1 = kv1->hint->v.nh.n1;
+ n2 = kv2->hint->v.nh.n1;
+ if (n1 < n2)
+ return (neg1 ? +1 : -1);
+ else if (n1 > n2)
+ return (neg1 ? -1 : +1);
+ }
+
+ /* read the numbers from the strings */
+ if (!key1_read)
+ read_number(s1, &sign1, smain1, &main1, sfrac1, &frac1, &SI1);
+ if (!key2_read)
+ read_number(s2, &sign2, smain2, &main2, sfrac2, &frac2, &SI2);
+
+ e1 = ((main1 + frac1) == 0);
+ e2 = ((main2 + frac2) == 0);
+
+ if (e1 && e2)
+ return (0);
+
+ /* we know the result if the signs are different */
+ if (sign1 < 0 && sign2 >= 0)
+ return (-1);
+ if (sign1 >= 0 && sign2 < 0)
+ return (+1);
+
+ if (e1)
+ return ((sign2 < 0) ? +1 : -1);
+ else if (e2)
+ return ((sign1 < 0) ? -1 : +1);
+
+ if (use_suffix) {
+ cmp_res = cmpsuffix(SI1, SI2);
+ if (cmp_res)
+ return ((sign1 < 0) ? -cmp_res : cmp_res);
+ }
+
+ /* if both numbers are empty assume that the strings are equal */
+ if (main1 < 1 && main2 < 1 && frac1 < 1 && frac2 < 1)
+ return (0);
+
+ /*
+ * if the main part is of different size, we know the result
+ * (because the leading zeros are removed)
+ */
+ if (main1 < main2)
+ cmp_res = -1;
+ else if (main1 > main2)
+ cmp_res = +1;
+ /* if the sizes are equal then simple non-collate string compare gives the correct result */
+ else
+ cmp_res = wcscmp(smain1, smain2);
+
+ /* check fraction */
+ if (!cmp_res)
+ cmp_res = wcscmp(sfrac1, sfrac2);
+
+ if (!cmp_res)
+ return (0);
+
+ /* reverse result if the signs are negative */
+ if (sign1 < 0 && sign2 < 0)
+ cmp_res = -cmp_res;
+
+ return (cmp_res);
+}
+
+/*
+ * Implements numeric sort (-n).
+ */
+static int
+numcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+{
+
+ return (numcoll_impl(kv1, kv2, offset, false));
+}
+
+/*
+ * Implements 'human' numeric sort (-h).
+ */
+static int
+hnumcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+{
+
+ return (numcoll_impl(kv1, kv2, offset, true));
+}
+
+/*
+ * Implements random sort (-R).
+ */
+static int
+randomcoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
+{
+ struct bwstring *s1, *s2;
+ MD5_CTX ctx1, ctx2;
+ char *b1, *b2;
+
+ s1 = kv1->k;
+ s2 = kv2->k;
+
+ if (debug_sort) {
+ bwsprintf(stdout, s1, "; k1=<", ">");
+ bwsprintf(stdout, s2, ", k2=<", ">");
+ }
+
+ if (s1 == s2)
+ return (0);
+
+ memcpy(&ctx1,&md5_ctx,sizeof(MD5_CTX));
+ memcpy(&ctx2,&md5_ctx,sizeof(MD5_CTX));
+
+ MD5Update(&ctx1, bwsrawdata(s1), bwsrawlen(s1));
+ MD5Update(&ctx2, bwsrawdata(s2), bwsrawlen(s2));
+ b1 = MD5End(&ctx1, NULL);
+ b2 = MD5End(&ctx2, NULL);
+ if (b1 == NULL) {
+ if (b2 == NULL)
+ return (0);
+ else {
+ sort_free(b2);
+ return (-1);
+ }
+ } else if (b2 == NULL) {
+ sort_free(b1);
+ return (+1);
+ } else {
+ int cmp_res;
+
+ cmp_res = strcmp(b1,b2);
+ sort_free(b1);
+ sort_free(b2);
+
+ if (!cmp_res)
+ cmp_res = bwscoll(s1, s2, 0);
+
+ return (cmp_res);
+ }
+}
+
+/*
+ * Implements version sort (-V).
+ */
+static int
+versioncoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
+{
+ struct bwstring *s1, *s2;
+
+ s1 = kv1->k;
+ s2 = kv2->k;
+
+ if (debug_sort) {
+ bwsprintf(stdout, s1, "; k1=<", ">");
+ bwsprintf(stdout, s2, ", k2=<", ">");
+ }
+
+ if (s1 == s2)
+ return (0);
+
+ return (vcmp(s1, s2));
+}
+
+/*
+ * Check for minus infinity
+ */
+static inline bool
+huge_minus(double d, int err1)
+{
+
+ if (err1 == ERANGE)
+ if (d == -HUGE_VAL || d == -HUGE_VALF || d == -HUGE_VALL)
+ return (+1);
+
+ return (0);
+}
+
+/*
+ * Check for plus infinity
+ */
+static inline bool
+huge_plus(double d, int err1)
+{
+
+ if (err1 == ERANGE)
+ if (d == HUGE_VAL || d == HUGE_VALF || d == HUGE_VALL)
+ return (+1);
+
+ return (0);
+}
+
+/*
+ * Check whether a function is a NAN
+ */
+static bool
+is_nan(double d)
+{
+
+ return ((d == NAN) || (isnan(d)));
+}
+
+/*
+ * Compare two NANs
+ */
+static int
+cmp_nans(double d1, double d2)
+{
+
+ if (d1 < d2)
+ return (-1);
+ if (d2 > d2)
+ return (+1);
+ return (0);
+}
+
+/*
+ * Implements general numeric sort (-g).
+ */
+static int
+gnumcoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
+{
+ double d1, d2;
+ int err1, err2;
+ bool empty1, empty2, key1_read, key2_read;
+
+ d1 = d2 = 0;
+ err1 = err2 = 0;
+ key1_read = key2_read = false;
+
+ if (debug_sort) {
+ bwsprintf(stdout, kv1->k, "; k1=<", ">");
+ bwsprintf(stdout, kv2->k, "; k2=<", ">");
+ }
+
+ if (kv1->hint->status == HS_UNINITIALIZED) {
+ errno = 0;
+ d1 = bwstod(kv1->k, &empty1);
+ err1 = errno;
+
+ if (empty1)
+ kv1->hint->v.gh.notnum = true;
+ else if (err1 == 0) {
+ kv1->hint->v.gh.d = d1;
+ kv1->hint->v.gh.nan = is_nan(d1);
+ kv1->hint->status = HS_INITIALIZED;
+ } else
+ kv1->hint->status = HS_ERROR;
+
+ key1_read = true;
+ }
+
+ if (kv2->hint->status == HS_UNINITIALIZED) {
+ errno = 0;
+ d2 = bwstod(kv2->k, &empty2);
+ err2 = errno;
+
+ if (empty2)
+ kv2->hint->v.gh.notnum = true;
+ else if (err2 == 0) {
+ kv2->hint->v.gh.d = d2;
+ kv2->hint->v.gh.nan = is_nan(d2);
+ kv2->hint->status = HS_INITIALIZED;
+ } else
+ kv2->hint->status = HS_ERROR;
+
+ key2_read = true;
+ }
+
+ if (kv1->hint->status == HS_INITIALIZED &&
+ kv2->hint->status == HS_INITIALIZED) {
+ if (kv1->hint->v.gh.notnum)
+ return ((kv2->hint->v.gh.notnum) ? 0 : -1);
+ else if (kv2->hint->v.gh.notnum)
+ return (+1);
+
+ if (kv1->hint->v.gh.nan)
+ return ((kv2->hint->v.gh.nan) ?
+ cmp_nans(kv1->hint->v.gh.d, kv2->hint->v.gh.d) :
+ -1);
+ else if (kv2->hint->v.gh.nan)
+ return (+1);
+
+ d1 = kv1->hint->v.gh.d;
+ d2 = kv2->hint->v.gh.d;
+
+ if (d1 < d2)
+ return (-1);
+ else if (d1 > d2)
+ return (+1);
+ else
+ return (0);
+ }
+
+ if (!key1_read) {
+ errno = 0;
+ d1 = bwstod(kv1->k, &empty1);
+ err1 = errno;
+ }
+
+ if (!key2_read) {
+ errno = 0;
+ d2 = bwstod(kv2->k, &empty2);
+ err2 = errno;
+ }
+
+ /* Non-value case: */
+ if (empty1)
+ return (empty2 ? 0 : -1);
+ else if (empty2)
+ return (+1);
+
+ /* NAN case */
+ if (is_nan(d1))
+ return (is_nan(d2) ? cmp_nans(d1, d2) : -1);
+ else if (is_nan(d2))
+ return (+1);
+
+ /* Infinities */
+ if (err1 == ERANGE || err2 == ERANGE) {
+ /* Minus infinity case */
+ if (huge_minus(d1, err1)) {
+ if (huge_minus(d2, err2)) {
+ if (d1 < d2)
+ return (-1);
+ if (d1 > d2)
+ return (+1);
+ return (0);
+ } else
+ return (-1);
+
+ } else if (huge_minus(d2, err2)) {
+ if (huge_minus(d1, err1)) {
+ if (d1 < d2)
+ return (-1);
+ if (d1 > d2)
+ return (+1);
+ return (0);
+ } else
+ return (+1);
+ }
+
+ /* Plus infinity case */
+ if (huge_plus(d1, err1)) {
+ if (huge_plus(d2, err2)) {
+ if (d1 < d2)
+ return (-1);
+ if (d1 > d2)
+ return (+1);
+ return (0);
+ } else
+ return (+1);
+ } else if (huge_plus(d2, err2)) {
+ if (huge_plus(d1, err1)) {
+ if (d1 < d2)
+ return (-1);
+ if (d1 > d2)
+ return (+1);
+ return (0);
+ } else
+ return (-1);
+ }
+ }
+
+ if (d1 < d2)
+ return (-1);
+ if (d1 > d2)
+ return (+1);
+
+ return (0);
+}
+
+/*
+ * Implements month sort (-M).
+ */
+static int
+monthcoll(struct key_value *kv1, struct key_value *kv2, size_t offset __unused)
+{
+ int val1, val2;
+ bool key1_read, key2_read;
+
+ val1 = val2 = 0;
+ key1_read = key2_read = false;
+
+ if (debug_sort) {
+ bwsprintf(stdout, kv1->k, "; k1=<", ">");
+ bwsprintf(stdout, kv2->k, "; k2=<", ">");
+ }
+
+ if (kv1->hint->status == HS_UNINITIALIZED) {
+ kv1->hint->v.Mh.m = bws_month_score(kv1->k);
+ key1_read = true;
+ kv1->hint->status = HS_INITIALIZED;
+ }
+
+ if (kv2->hint->status == HS_UNINITIALIZED) {
+ kv2->hint->v.Mh.m = bws_month_score(kv2->k);
+ key2_read = true;
+ kv2->hint->status = HS_INITIALIZED;
+ }
+
+ if (kv1->hint->status == HS_INITIALIZED) {
+ val1 = kv1->hint->v.Mh.m;
+ key1_read = true;
+ }
+
+ if (kv2->hint->status == HS_INITIALIZED) {
+ val2 = kv2->hint->v.Mh.m;
+ key2_read = true;
+ }
+
+ if (!key1_read)
+ val1 = bws_month_score(kv1->k);
+ if (!key2_read)
+ val2 = bws_month_score(kv2->k);
+
+ if (val1 == val2) {
+ return (0);
+ }
+ if (val1 < val2)
+ return (-1);
+ return (+1);
+}
diff --git a/usr.bin/sort/coll.h b/usr.bin/sort/coll.h
new file mode 100644
index 0000000..9a70b8e
--- /dev/null
+++ b/usr.bin/sort/coll.h
@@ -0,0 +1,167 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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.
+ */
+
+#if !defined(__COLL_H__)
+#define __COLL_H__
+
+#include "bwstring.h"
+#include "sort.h"
+
+/*
+ * Sort hint data for -n
+ */
+struct n_hint
+{
+ unsigned long long n1;
+ unsigned char si;
+ bool empty;
+ bool neg;
+};
+
+/*
+ * Sort hint data for -g
+ */
+struct g_hint
+{
+ double d;
+ bool nan;
+ bool notnum;
+};
+
+/*
+ * Sort hint data for -M
+ */
+struct M_hint
+{
+ int m;
+};
+
+/*
+ * Status of a sort hint object
+ */
+typedef enum
+{
+ HS_ERROR = -1, HS_UNINITIALIZED = 0, HS_INITIALIZED = 1
+} hint_status;
+
+/*
+ * Sort hint object
+ */
+struct key_hint
+{
+ hint_status status;
+ union
+ {
+ struct n_hint nh;
+ struct g_hint gh;
+ struct M_hint Mh;
+ } v;
+};
+
+/*
+ * Key value
+ */
+struct key_value
+{
+ struct bwstring *k; /* key string */
+ struct key_hint hint[0]; /* key sort hint */
+};
+
+/*
+ * Set of keys container object.
+ */
+struct keys_array
+{
+ struct key_value key[0];
+};
+
+/*
+ * Parsed -k option data
+ */
+struct key_specs
+{
+ struct sort_mods sm;
+ size_t c1;
+ size_t c2;
+ size_t f1;
+ size_t f2;
+ bool pos1b;
+ bool pos2b;
+};
+
+/*
+ * Single entry in sort list.
+ */
+struct sort_list_item
+{
+ struct bwstring *str;
+ struct keys_array ka;
+};
+
+/*
+ * Function type, used to compare two list objects
+ */
+typedef int (*listcoll_t)(struct sort_list_item **ss1, struct sort_list_item **ss2);
+
+extern struct key_specs *keys;
+extern size_t keys_num;
+
+/*
+ * Main localised symbols. These must be wint_t as they may hold WEOF.
+ */
+extern wint_t symbol_decimal_point;
+extern wint_t symbol_thousands_sep;
+extern wint_t symbol_negative_sign;
+extern wint_t symbol_positive_sign;
+
+/* funcs */
+
+cmpcoll_t get_sort_func(struct sort_mods *sm);
+
+struct keys_array *keys_array_alloc(void);
+size_t keys_array_size(void);
+void set_key_on_keys_array(struct keys_array *ka, struct bwstring *s, size_t ind);
+void clean_keys_array(const struct bwstring *s, struct keys_array *ka);
+
+struct sort_list_item *sort_list_item_alloc(void);
+void sort_list_item_set(struct sort_list_item *si, struct bwstring *str);
+void sort_list_item_clean(struct sort_list_item *si);
+size_t sort_list_item_size(struct sort_list_item *si);
+
+int preproc(struct bwstring *s, struct keys_array *ka);
+int top_level_str_coll(const struct bwstring *, const struct bwstring *);
+int key_coll(struct keys_array *ks1, struct keys_array *ks2, size_t offset);
+int str_list_coll(struct bwstring *str1, struct sort_list_item **ss2);
+int list_coll_by_str_only(struct sort_list_item **ss1, struct sort_list_item **ss2);
+int list_coll(struct sort_list_item **ss1, struct sort_list_item **ss2);
+int list_coll_offset(struct sort_list_item **ss1, struct sort_list_item **ss2, size_t offset);
+
+listcoll_t get_list_call_func(size_t offset);
+
+#endif /* __COLL_H__ */
diff --git a/usr.bin/sort/file.c b/usr.bin/sort/file.c
new file mode 100644
index 0000000..47d59af
--- /dev/null
+++ b/usr.bin/sort/file.c
@@ -0,0 +1,1597 @@
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/queue.h>
+
+#include <err.h>
+#include <fcntl.h>
+#if defined(SORT_THREADS)
+#include <pthread.h>
+#endif
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "coll.h"
+#include "file.h"
+#include "radixsort.h"
+
+unsigned long long free_memory = 1000000;
+unsigned long long available_free_memory = 1000000;
+
+bool use_mmap;
+
+const char *tmpdir = "/var/tmp";
+const char *compress_program;
+
+size_t max_open_files = 16;
+
+/*
+ * How much space we read from file at once
+ */
+#define READ_CHUNK (4096)
+
+/*
+ * File reader structure
+ */
+struct file_reader
+{
+ struct reader_buffer rb;
+ FILE *file;
+ char *fname;
+ unsigned char *buffer;
+ unsigned char *mmapaddr;
+ unsigned char *mmapptr;
+ size_t bsz;
+ size_t cbsz;
+ size_t mmapsize;
+ size_t strbeg;
+ int fd;
+ char elsymb;
+};
+
+/*
+ * Structure to be used in file merge process.
+ */
+struct file_header
+{
+ struct file_reader *fr;
+ struct sort_list_item *si; /* current top line */
+ size_t file_pos;
+};
+
+/*
+ * List elements of "cleanable" files list.
+ */
+struct CLEANABLE_FILE
+{
+ char *fn;
+ LIST_ENTRY(CLEANABLE_FILE) files;
+};
+
+/*
+ * List header of "cleanable" files list.
+ */
+static LIST_HEAD(CLEANABLE_FILES,CLEANABLE_FILE) tmp_files;
+
+/*
+ * Semaphore to protect the tmp file list.
+ * We use semaphore here because it is signal-safe, according to POSIX.
+ * And semaphore does not require pthread library.
+ */
+static sem_t tmp_files_sem;
+
+static void mt_sort(struct sort_list *list,
+ int (*sort_func)(void *, size_t, size_t,
+ int (*)(const void *, const void *)), const char* fn);
+
+/*
+ * Init tmp files list
+ */
+void
+init_tmp_files(void)
+{
+
+ LIST_INIT(&tmp_files);
+ sem_init(&tmp_files_sem, 0, 1);
+}
+
+/*
+ * Save name of a tmp file for signal cleanup
+ */
+void
+tmp_file_atexit(const char *tmp_file)
+{
+
+ if (tmp_file) {
+ sem_wait(&tmp_files_sem);
+ struct CLEANABLE_FILE *item =
+ sort_malloc(sizeof(struct CLEANABLE_FILE));
+ item->fn = sort_strdup(tmp_file);
+ LIST_INSERT_HEAD(&tmp_files, item, files);
+ sem_post(&tmp_files_sem);
+ }
+}
+
+/*
+ * Clear tmp files
+ */
+void
+clear_tmp_files(void)
+{
+ struct CLEANABLE_FILE *item;
+
+ sem_wait(&tmp_files_sem);
+ LIST_FOREACH(item,&tmp_files,files) {
+ if ((item) && (item->fn))
+ unlink(item->fn);
+ }
+ sem_post(&tmp_files_sem);
+}
+
+/*
+ * Check whether a file is a temporary file
+ */
+static bool
+file_is_tmp(const char* fn)
+{
+ struct CLEANABLE_FILE *item;
+ bool ret = false;
+
+ if (fn) {
+ sem_wait(&tmp_files_sem);
+ LIST_FOREACH(item,&tmp_files,files) {
+ if ((item) && (item->fn))
+ if (strcmp(item->fn, fn) == 0) {
+ ret = true;
+ break;
+ }
+ }
+ sem_post(&tmp_files_sem);
+ }
+
+ return (ret);
+}
+
+/*
+ * Generate new temporary file name
+ */
+char *
+new_tmp_file_name(void)
+{
+ static size_t tfcounter = 0;
+ static const char *fn = ".bsdsort.";
+ char *ret;
+ size_t sz;
+
+ sz = strlen(tmpdir) + 1 + strlen(fn) + 32 + 1;
+ ret = sort_malloc(sz);
+
+ sprintf(ret, "%s/%s%d.%lu", tmpdir, fn, (int) getpid(), (unsigned long)(tfcounter++));
+ tmp_file_atexit(ret);
+ return (ret);
+}
+
+/*
+ * Initialize file list
+ */
+void
+file_list_init(struct file_list *fl, bool tmp)
+{
+
+ if (fl) {
+ fl->count = 0;
+ fl->sz = 0;
+ fl->fns = NULL;
+ fl->tmp = tmp;
+ }
+}
+
+/*
+ * Add a file name to the list
+ */
+void
+file_list_add(struct file_list *fl, char *fn, bool allocate)
+{
+
+ if (fl && fn) {
+ if (fl->count >= fl->sz || (fl->fns == NULL)) {
+ fl->sz = (fl->sz) * 2 + 1;
+ fl->fns = sort_realloc(fl->fns, fl->sz *
+ sizeof(char *));
+ }
+ fl->fns[fl->count] = allocate ? sort_strdup(fn) : fn;
+ fl->count += 1;
+ }
+}
+
+/*
+ * Populate file list from array of file names
+ */
+void
+file_list_populate(struct file_list *fl, int argc, char **argv, bool allocate)
+{
+
+ if (fl && argv) {
+ int i;
+
+ for (i = 0; i < argc; i++)
+ file_list_add(fl, argv[i], allocate);
+ }
+}
+
+/*
+ * Clean file list data and delete the files,
+ * if this is a list of temporary files
+ */
+void
+file_list_clean(struct file_list *fl)
+{
+
+ if (fl) {
+ if (fl->fns) {
+ size_t i;
+
+ for (i = 0; i < fl->count; i++) {
+ if (fl->fns[i]) {
+ if (fl->tmp)
+ unlink(fl->fns[i]);
+ sort_free(fl->fns[i]);
+ fl->fns[i] = 0;
+ }
+ }
+ sort_free(fl->fns);
+ fl->fns = NULL;
+ }
+ fl->sz = 0;
+ fl->count = 0;
+ fl->tmp = false;
+ }
+}
+
+/*
+ * Init sort list
+ */
+void
+sort_list_init(struct sort_list *l)
+{
+
+ if (l) {
+ l->count = 0;
+ l->size = 0;
+ l->memsize = sizeof(struct sort_list);
+ l->list = NULL;
+ }
+}
+
+/*
+ * Add string to sort list
+ */
+void
+sort_list_add(struct sort_list *l, struct bwstring *str)
+{
+
+ if (l && str) {
+ size_t indx = l->count;
+
+ if ((l->list == NULL) || (indx >= l->size)) {
+ size_t newsize = (l->size + 1) + 1024;
+
+ l->list = sort_realloc(l->list,
+ sizeof(struct sort_list_item*) * newsize);
+ l->memsize += (newsize - l->size) *
+ sizeof(struct sort_list_item*);
+ l->size = newsize;
+ }
+ l->list[indx] = sort_list_item_alloc();
+ sort_list_item_set(l->list[indx], str);
+ l->memsize += sort_list_item_size(l->list[indx]);
+ l->count += 1;
+ }
+}
+
+/*
+ * Clean sort list data
+ */
+void
+sort_list_clean(struct sort_list *l)
+{
+
+ if (l) {
+ if (l->list) {
+ size_t i;
+
+ for (i = 0; i < l->count; i++) {
+ struct sort_list_item *item;
+
+ item = l->list[i];
+
+ if (item) {
+ sort_list_item_clean(item);
+ sort_free(item);
+ l->list[i] = NULL;
+ }
+ }
+ sort_free(l->list);
+ l->list = NULL;
+ }
+ l->count = 0;
+ l->size = 0;
+ l->memsize = sizeof(struct sort_list);
+ }
+}
+
+/*
+ * Write sort list to file
+ */
+void
+sort_list_dump(struct sort_list *l, const char *fn)
+{
+
+ if (l && fn) {
+ FILE *f;
+
+ f = openfile(fn, "w");
+ if (f == NULL)
+ err(2, NULL);
+
+ if (l->list) {
+ size_t i;
+ if (!(sort_opts_vals.uflag)) {
+ for (i = 0; i < l->count; ++i)
+ bwsfwrite(l->list[i]->str, f,
+ sort_opts_vals.zflag);
+ } else {
+ struct sort_list_item *last_printed_item = NULL;
+ struct sort_list_item *item;
+ for (i = 0; i < l->count; ++i) {
+ item = l->list[i];
+ if ((last_printed_item == NULL) ||
+ list_coll(&last_printed_item, &item)) {
+ bwsfwrite(item->str, f, sort_opts_vals.zflag);
+ last_printed_item = item;
+ }
+ }
+ }
+ }
+
+ closefile(f, fn);
+ }
+}
+
+/*
+ * Checks if the given file is sorted. Stops at the first disorder,
+ * prints the disordered line and returns 1.
+ */
+int
+check(const char *fn)
+{
+ struct bwstring *s1, *s2, *s1disorder, *s2disorder;
+ struct file_reader *fr;
+ struct keys_array *ka1, *ka2;
+ int res;
+ size_t pos, posdisorder;
+
+ s1 = s2 = s1disorder = s2disorder = NULL;
+ ka1 = ka2 = NULL;
+
+ fr = file_reader_init(fn);
+
+ res = 0;
+ pos = 1;
+ posdisorder = 1;
+
+ if (fr == NULL) {
+ err(2, NULL);
+ goto end;
+ }
+
+ s1 = file_reader_readline(fr);
+ if (s1 == NULL)
+ goto end;
+
+ ka1 = keys_array_alloc();
+ preproc(s1, ka1);
+
+ s2 = file_reader_readline(fr);
+ if (s2 == NULL)
+ goto end;
+
+ ka2 = keys_array_alloc();
+ preproc(s2, ka2);
+
+ for (;;) {
+
+ if (debug_sort) {
+ bwsprintf(stdout, s2, "s1=<", ">");
+ bwsprintf(stdout, s1, "s2=<", ">");
+ }
+ int cmp = key_coll(ka2, ka1, 0);
+ if (debug_sort)
+ printf("; cmp1=%d", cmp);
+
+ if (!cmp && sort_opts_vals.complex_sort &&
+ !(sort_opts_vals.uflag) && !(sort_opts_vals.sflag)) {
+ cmp = top_level_str_coll(s2, s1);
+ if (debug_sort)
+ printf("; cmp2=%d", cmp);
+ }
+ if (debug_sort)
+ printf("\n");
+
+ if ((sort_opts_vals.uflag && (cmp <= 0)) || (cmp < 0)) {
+ if (!(sort_opts_vals.csilentflag)) {
+ s2disorder = bwsdup(s2);
+ posdisorder = pos;
+ if (debug_sort)
+ s1disorder = bwsdup(s1);
+ }
+ res = 1;
+ goto end;
+ }
+
+ pos++;
+
+ clean_keys_array(s1, ka1);
+ sort_free(ka1);
+ ka1 = ka2;
+ ka2 = NULL;
+
+ bwsfree(s1);
+ s1 = s2;
+
+ s2 = file_reader_readline(fr);
+ if (s2 == NULL)
+ goto end;
+
+ ka2 = keys_array_alloc();
+ preproc(s2, ka2);
+ }
+
+end:
+ if (ka1) {
+ clean_keys_array(s1, ka1);
+ sort_free(ka1);
+ }
+
+ if (s1)
+ bwsfree(s1);
+
+ if (ka2) {
+ clean_keys_array(s2, ka2);
+ sort_free(ka2);
+ }
+
+ if (s2)
+ bwsfree(s2);
+
+ if ((fn == NULL) || (*fn == 0) || (strcmp(fn, "-") == 0)) {
+ for (;;) {
+ s2 = file_reader_readline(fr);
+ if (s2 == NULL)
+ break;
+ bwsfree(s2);
+ }
+ }
+
+ file_reader_free(fr);
+
+ if (s2disorder) {
+ bws_disorder_warnx(s2disorder, fn, posdisorder);
+ if (s1disorder) {
+ bws_disorder_warnx(s1disorder, fn, posdisorder);
+ if (s1disorder != s2disorder)
+ bwsfree(s1disorder);
+ }
+ bwsfree(s2disorder);
+ s1disorder = NULL;
+ s2disorder = NULL;
+ }
+
+ if (res)
+ exit(res);
+
+ return (0);
+}
+
+/*
+ * Opens a file. If the given filename is "-", stdout will be
+ * opened.
+ */
+FILE *
+openfile(const char *fn, const char *mode)
+{
+ FILE *file;
+
+ if (strcmp(fn, "-") == 0) {
+ return ((mode && mode[0] == 'r') ? stdin : stdout);
+ } else {
+ mode_t orig_file_mask = 0;
+ int is_tmp = file_is_tmp(fn);
+
+ if (is_tmp && (mode[0] == 'w'))
+ orig_file_mask = umask(S_IWGRP | S_IWOTH |
+ S_IRGRP | S_IROTH);
+
+ if (is_tmp && (compress_program != NULL)) {
+ char *cmd;
+ size_t cmdsz;
+
+ cmdsz = strlen(fn) + 128;
+ cmd = sort_malloc(cmdsz);
+
+ fflush(stdout);
+
+ if (mode[0] == 'r')
+ snprintf(cmd, cmdsz - 1, "cat %s | %s -d",
+ fn, compress_program);
+ else if (mode[0] == 'w')
+ snprintf(cmd, cmdsz - 1, "%s > %s",
+ compress_program, fn);
+ else
+ err(2, "%s", getstr(7));
+
+ if ((file = popen(cmd, mode)) == NULL)
+ err(2, NULL);
+
+ sort_free(cmd);
+
+ } else
+ if ((file = fopen(fn, mode)) == NULL)
+ err(2, NULL);
+
+ if (is_tmp && (mode[0] == 'w'))
+ umask(orig_file_mask);
+ }
+
+ return (file);
+}
+
+/*
+ * Close file
+ */
+void
+closefile(FILE *f, const char *fn)
+{
+ if (f == NULL) {
+ ;
+ } else if (f == stdin) {
+ ;
+ } else if (f == stdout) {
+ fflush(f);
+ } else {
+ if (file_is_tmp(fn) && compress_program != NULL) {
+ if(pclose(f)<0)
+ err(2,NULL);
+ } else
+ fclose(f);
+ }
+}
+
+/*
+ * Reads a file into the internal buffer.
+ */
+struct file_reader *
+file_reader_init(const char *fsrc)
+{
+ struct file_reader *ret;
+
+ if (fsrc == NULL)
+ fsrc = "-";
+
+ ret = sort_malloc(sizeof(struct file_reader));
+ memset(ret, 0, sizeof(struct file_reader));
+
+ ret->elsymb = '\n';
+ if (sort_opts_vals.zflag)
+ ret->elsymb = 0;
+
+ ret->fname = sort_strdup(fsrc);
+
+ if (strcmp(fsrc, "-") && (compress_program == NULL) && use_mmap) {
+
+ do {
+ struct stat stat_buf;
+ void *addr;
+ size_t sz = 0;
+ int fd, flags;
+
+ flags = MAP_NOCORE | MAP_NOSYNC;
+ addr = MAP_FAILED;
+
+ fd = open(fsrc, O_RDONLY);
+ if (fd < 0)
+ err(2, NULL);
+
+ if (fstat(fd, &stat_buf) < 0) {
+ close(fd);
+ break;
+ }
+
+ sz = stat_buf.st_size;
+
+#if defined(MAP_PREFAULT_READ)
+ flags |= MAP_PREFAULT_READ;
+#endif
+
+ addr = mmap(NULL, sz, PROT_READ, flags, fd, 0);
+ if (addr == MAP_FAILED) {
+ close(fd);
+ break;
+ }
+
+ ret->fd = fd;
+ ret->mmapaddr = addr;
+ ret->mmapsize = sz;
+ ret->mmapptr = ret->mmapaddr;
+
+ } while (0);
+ }
+
+ if (ret->mmapaddr == NULL) {
+ ret->file = openfile(fsrc, "r");
+ if (ret->file == NULL)
+ err(2, NULL);
+
+ if (strcmp(fsrc, "-")) {
+ ret->cbsz = READ_CHUNK;
+ ret->buffer = sort_malloc(ret->cbsz);
+ ret->bsz = 0;
+ ret->strbeg = 0;
+
+ ret->bsz = fread(ret->buffer, 1, ret->cbsz, ret->file);
+ if (ret->bsz == 0) {
+ if (ferror(ret->file))
+ err(2, NULL);
+ }
+ }
+ }
+
+ return (ret);
+}
+
+struct bwstring *
+file_reader_readline(struct file_reader *fr)
+{
+ struct bwstring *ret = NULL;
+
+ if (fr->mmapaddr) {
+ unsigned char *mmapend;
+
+ mmapend = fr->mmapaddr + fr->mmapsize;
+ if (fr->mmapptr >= mmapend)
+ return (NULL);
+ else {
+ unsigned char *strend;
+ size_t sz;
+
+ sz = mmapend - fr->mmapptr;
+ strend = memchr(fr->mmapptr, fr->elsymb, sz);
+
+ if (strend == NULL) {
+ ret = bwscsbdup(fr->mmapptr, sz);
+ fr->mmapptr = mmapend;
+ } else {
+ ret = bwscsbdup(fr->mmapptr, strend -
+ fr->mmapptr);
+ fr->mmapptr = strend + 1;
+ }
+ }
+
+ } else if (fr->file != stdin) {
+ unsigned char *strend;
+ size_t bsz1, remsz, search_start;
+
+ search_start = 0;
+ remsz = 0;
+ strend = NULL;
+
+ if (fr->bsz > fr->strbeg)
+ remsz = fr->bsz - fr->strbeg;
+
+ /* line read cycle */
+ for (;;) {
+ if (remsz > search_start)
+ strend = memchr(fr->buffer + fr->strbeg +
+ search_start, fr->elsymb, remsz -
+ search_start);
+ else
+ strend = NULL;
+
+ if (strend)
+ break;
+ if (feof(fr->file))
+ break;
+
+ if (fr->bsz != fr->cbsz)
+ /* NOTREACHED */
+ err(2, "File read software error 1");
+
+ if (remsz > (READ_CHUNK >> 1)) {
+ search_start = fr->cbsz - fr->strbeg;
+ fr->cbsz += READ_CHUNK;
+ fr->buffer = sort_realloc(fr->buffer,
+ fr->cbsz);
+ bsz1 = fread(fr->buffer + fr->bsz, 1,
+ READ_CHUNK, fr->file);
+ if (bsz1 == 0) {
+ if (ferror(fr->file))
+ err(2, NULL);
+ break;
+ }
+ fr->bsz += bsz1;
+ remsz += bsz1;
+ } else {
+ if (remsz > 0 && fr->strbeg>0)
+ bcopy(fr->buffer + fr->strbeg,
+ fr->buffer, remsz);
+
+ fr->strbeg = 0;
+ search_start = remsz;
+ bsz1 = fread(fr->buffer + remsz, 1,
+ fr->cbsz - remsz, fr->file);
+ if (bsz1 == 0) {
+ if (ferror(fr->file))
+ err(2, NULL);
+ break;
+ }
+ fr->bsz = remsz + bsz1;
+ remsz = fr->bsz;
+ }
+ }
+
+ if (strend == NULL)
+ strend = fr->buffer + fr->bsz;
+
+ if ((fr->buffer + fr->strbeg <= strend) &&
+ (fr->strbeg < fr->bsz) && (remsz>0))
+ ret = bwscsbdup(fr->buffer + fr->strbeg, strend -
+ fr->buffer - fr->strbeg);
+
+ fr->strbeg = (strend - fr->buffer) + 1;
+
+ } else {
+ size_t len = 0;
+
+ ret = bwsfgetln(fr->file, &len, sort_opts_vals.zflag,
+ &(fr->rb));
+ }
+
+ return (ret);
+}
+
+static void
+file_reader_clean(struct file_reader *fr)
+{
+
+ if (fr) {
+ if (fr->mmapaddr)
+ munmap(fr->mmapaddr, fr->mmapsize);
+
+ if (fr->fd)
+ close(fr->fd);
+
+ if (fr->buffer)
+ sort_free(fr->buffer);
+
+ if (fr->file)
+ if (fr->file != stdin)
+ closefile(fr->file, fr->fname);
+
+ if(fr->fname)
+ sort_free(fr->fname);
+
+ memset(fr, 0, sizeof(struct file_reader));
+ }
+}
+
+void
+file_reader_free(struct file_reader *fr)
+{
+
+ if (fr) {
+ file_reader_clean(fr);
+ sort_free(fr);
+ }
+}
+
+int
+procfile(const char *fsrc, struct sort_list *list, struct file_list *fl)
+{
+ struct file_reader *fr;
+
+ fr = file_reader_init(fsrc);
+ if (fr == NULL)
+ err(2, NULL);
+
+ /* file browse cycle */
+ for (;;) {
+ struct bwstring *bws;
+
+ bws = file_reader_readline(fr);
+
+ if (bws == NULL)
+ break;
+
+ sort_list_add(list, bws);
+
+ if (list->memsize >= available_free_memory) {
+ char *fn;
+
+ fn = new_tmp_file_name();
+ sort_list_to_file(list, fn);
+ file_list_add(fl, fn, false);
+ sort_list_clean(list);
+ }
+ }
+
+ file_reader_free(fr);
+
+ return (0);
+}
+
+/*
+ * Compare file headers. Files with EOF always go to the end of the list.
+ */
+static int
+file_header_cmp(struct file_header *f1, struct file_header *f2)
+{
+
+ if (f1 == f2)
+ return (0);
+ else {
+ if (f1->fr == NULL) {
+ return ((f2->fr == NULL) ? 0 : +1);
+ } else if (f2->fr == NULL)
+ return (-1);
+ else {
+ int ret;
+
+ ret = list_coll(&(f1->si), &(f2->si));
+ if (!ret)
+ return ((f1->file_pos < f2->file_pos) ? -1 : +1);
+ return (ret);
+ }
+ }
+}
+
+/*
+ * Allocate and init file header structure
+ */
+static void
+file_header_init(struct file_header **fh, const char *fn, size_t file_pos)
+{
+
+ if (fh && fn) {
+ struct bwstring *line;
+
+ *fh = sort_malloc(sizeof(struct file_header));
+ (*fh)->file_pos = file_pos;
+ (*fh)->fr = file_reader_init(fn);
+ if ((*fh)->fr == NULL) {
+ perror(fn);
+ err(2, "%s", getstr(8));
+ }
+ line = file_reader_readline((*fh)->fr);
+ if (line == NULL) {
+ file_reader_free((*fh)->fr);
+ (*fh)->fr = NULL;
+ (*fh)->si = NULL;
+ } else {
+ (*fh)->si = sort_list_item_alloc();
+ sort_list_item_set((*fh)->si, line);
+ }
+ }
+}
+
+/*
+ * Close file
+ */
+static void
+file_header_close(struct file_header **fh)
+{
+
+ if (fh && *fh) {
+ if ((*fh)->fr) {
+ file_reader_free((*fh)->fr);
+ (*fh)->fr = NULL;
+ }
+ if ((*fh)->si) {
+ sort_list_item_clean((*fh)->si);
+ sort_free((*fh)->si);
+ (*fh)->si = NULL;
+ }
+ sort_free(*fh);
+ *fh = NULL;
+ }
+}
+
+/*
+ * Swap two array elements
+ */
+static void
+file_header_swap(struct file_header **fh, size_t i1, size_t i2)
+{
+ struct file_header *tmp;
+
+ tmp = fh[i1];
+ fh[i1] = fh[i2];
+ fh[i2] = tmp;
+}
+
+/* heap algorithm ==>> */
+
+/*
+ * See heap sort algorithm
+ * "Raises" last element to its right place
+ */
+static void
+file_header_heap_swim(struct file_header **fh, size_t indx)
+{
+
+ if (indx > 0) {
+ size_t parent_index;
+
+ parent_index = (indx - 1) >> 1;
+
+ if (file_header_cmp(fh[indx], fh[parent_index]) < 0) {
+ /* swap child and parent and continue */
+ file_header_swap(fh, indx, parent_index);
+ file_header_heap_swim(fh, parent_index);
+ }
+ }
+}
+
+/*
+ * Sink the top element to its correct position
+ */
+static void
+file_header_heap_sink(struct file_header **fh, size_t indx, size_t size)
+{
+ size_t left_child_index;
+ size_t right_child_index;
+
+ left_child_index = indx + indx + 1;
+ right_child_index = left_child_index + 1;
+
+ if (left_child_index < size) {
+ size_t min_child_index;
+
+ min_child_index = left_child_index;
+
+ if ((right_child_index < size) &&
+ (file_header_cmp(fh[left_child_index],
+ fh[right_child_index]) > 0))
+ min_child_index = right_child_index;
+ if (file_header_cmp(fh[indx], fh[min_child_index]) > 0) {
+ file_header_swap(fh, indx, min_child_index);
+ file_header_heap_sink(fh, min_child_index, size);
+ }
+ }
+}
+
+/* <<== heap algorithm */
+
+/*
+ * Adds element to the "left" end
+ */
+static void
+file_header_list_rearrange_from_header(struct file_header **fh, size_t size)
+{
+
+ file_header_heap_sink(fh, 0, size);
+}
+
+/*
+ * Adds element to the "right" end
+ */
+static void
+file_header_list_push(struct file_header *f, struct file_header **fh, size_t size)
+{
+
+ fh[size++] = f;
+ file_header_heap_swim(fh, size - 1);
+}
+
+struct last_printed
+{
+ struct bwstring *str;
+};
+
+/*
+ * Prints the current line of the file
+ */
+static void
+file_header_print(struct file_header *fh, FILE *f_out, struct last_printed *lp)
+{
+
+ if (fh && fh->fr && f_out && fh->si && fh->si->str) {
+ if (sort_opts_vals.uflag) {
+ if ((lp->str == NULL) || (str_list_coll(lp->str, &(fh->si)))) {
+ bwsfwrite(fh->si->str, f_out, sort_opts_vals.zflag);
+ if (lp->str)
+ bwsfree(lp->str);
+ lp->str = bwsdup(fh->si->str);
+ }
+ } else
+ bwsfwrite(fh->si->str, f_out, sort_opts_vals.zflag);
+ }
+}
+
+/*
+ * Read next line
+ */
+static void
+file_header_read_next(struct file_header *fh)
+{
+
+ if (fh && fh->fr) {
+ struct bwstring *tmp;
+
+ tmp = file_reader_readline(fh->fr);
+ if (tmp == NULL) {
+ file_reader_free(fh->fr);
+ fh->fr = NULL;
+ if (fh->si) {
+ sort_list_item_clean(fh->si);
+ sort_free(fh->si);
+ fh->si = NULL;
+ }
+ } else {
+ if (fh->si == NULL)
+ fh->si = sort_list_item_alloc();
+ sort_list_item_set(fh->si, tmp);
+ }
+ }
+}
+
+/*
+ * Merge array of "files headers"
+ */
+static void
+file_headers_merge(size_t fnum, struct file_header **fh, FILE *f_out)
+{
+ struct last_printed lp;
+ size_t i;
+
+ memset(&lp, 0, sizeof(lp));
+
+ /*
+ * construct the initial sort structure
+ */
+ for (i = 0; i < fnum; i++)
+ file_header_list_push(fh[i], fh, i);
+
+ while (fh[0]->fr) { /* unfinished files are always in front */
+ /* output the smallest line: */
+ file_header_print(fh[0], f_out, &lp);
+ /* read a new line, if possible: */
+ file_header_read_next(fh[0]);
+ /* re-arrange the list: */
+ file_header_list_rearrange_from_header(fh, fnum);
+ }
+
+ if (lp.str)
+ bwsfree(lp.str);
+}
+
+/*
+ * Merges the given files into the output file, which can be
+ * stdout.
+ */
+static void
+merge_files_array(size_t argc, char **argv, const char *fn_out)
+{
+
+ if (argv && fn_out) {
+ struct file_header **fh;
+ FILE *f_out;
+ size_t i;
+
+ f_out = openfile(fn_out, "w");
+
+ if (f_out == NULL)
+ err(2, NULL);
+
+ fh = sort_malloc((argc + 1) * sizeof(struct file_header *));
+
+ for (i = 0; i < argc; i++)
+ file_header_init(fh + i, argv[i], (size_t) i);
+
+ file_headers_merge(argc, fh, f_out);
+
+ for (i = 0; i < argc; i++)
+ file_header_close(fh + i);
+
+ sort_free(fh);
+
+ closefile(f_out, fn_out);
+ }
+}
+
+/*
+ * Shrinks the file list until its size smaller than max number of opened files
+ */
+static int
+shrink_file_list(struct file_list *fl)
+{
+
+ if ((fl == NULL) || (size_t) (fl->count) < max_open_files)
+ return (0);
+ else {
+ struct file_list new_fl;
+ size_t indx = 0;
+
+ file_list_init(&new_fl, true);
+ while (indx < fl->count) {
+ char *fnew;
+ size_t num;
+
+ num = fl->count - indx;
+ fnew = new_tmp_file_name();
+
+ if ((size_t) num >= max_open_files)
+ num = max_open_files - 1;
+ merge_files_array(num, fl->fns + indx, fnew);
+ if (fl->tmp) {
+ size_t i;
+
+ for (i = 0; i < num; i++)
+ unlink(fl->fns[indx + i]);
+ }
+ file_list_add(&new_fl, fnew, false);
+ indx += num;
+ }
+ fl->tmp = false; /* already taken care of */
+ file_list_clean(fl);
+
+ fl->count = new_fl.count;
+ fl->fns = new_fl.fns;
+ fl->sz = new_fl.sz;
+ fl->tmp = new_fl.tmp;
+
+ return (1);
+ }
+}
+
+/*
+ * Merge list of files
+ */
+void
+merge_files(struct file_list *fl, const char *fn_out)
+{
+
+ if (fl && fn_out) {
+ while (shrink_file_list(fl));
+
+ merge_files_array(fl->count, fl->fns, fn_out);
+ }
+}
+
+static const char *
+get_sort_method_name(int sm)
+{
+
+ if (sm == SORT_MERGESORT)
+ return "mergesort";
+ else if (sort_opts_vals.sort_method == SORT_RADIXSORT)
+ return "radixsort";
+ else if (sort_opts_vals.sort_method == SORT_HEAPSORT)
+ return "heapsort";
+ else
+ return "quicksort";
+}
+
+/*
+ * Wrapper for qsort
+ */
+static int sort_qsort(void *list, size_t count, size_t elem_size,
+ int (*cmp_func)(const void *, const void *))
+{
+
+ qsort(list, count, elem_size, cmp_func);
+ return (0);
+}
+
+/*
+ * Sort list of lines and writes it to the file
+ */
+void
+sort_list_to_file(struct sort_list *list, const char *outfile)
+{
+ struct sort_mods *sm = &(keys[0].sm);
+
+ if (!(sm->Mflag) && !(sm->Rflag) && !(sm->Vflag) && !(sm->Vflag) &&
+ !(sm->gflag) && !(sm->hflag) && !(sm->nflag)) {
+ if ((sort_opts_vals.sort_method == SORT_DEFAULT) && byte_sort)
+ sort_opts_vals.sort_method = SORT_RADIXSORT;
+
+ } else if (sort_opts_vals.sort_method == SORT_RADIXSORT)
+ err(2, "%s", getstr(9));
+
+ /*
+ * to handle stable sort and the unique cases in the
+ * right order, we need stable basic algorithm
+ */
+ if (sort_opts_vals.sflag) {
+ switch (sort_opts_vals.sort_method){
+ case SORT_MERGESORT:
+ break;
+ case SORT_RADIXSORT:
+ break;
+ case SORT_DEFAULT:
+ sort_opts_vals.sort_method = SORT_MERGESORT;
+ break;
+ default:
+ errx(2, "%s", getstr(10));
+ }
+ }
+
+ if (sort_opts_vals.sort_method == SORT_DEFAULT)
+ sort_opts_vals.sort_method = DEFAULT_SORT_ALGORITHM;
+
+ if (debug_sort)
+ printf("sort_method=%s\n",
+ get_sort_method_name(sort_opts_vals.sort_method));
+
+ switch (sort_opts_vals.sort_method){
+ case SORT_RADIXSORT:
+ rxsort(list->list, list->count);
+ sort_list_dump(list, outfile);
+ break;
+ case SORT_MERGESORT:
+ mt_sort(list, mergesort, outfile);
+ break;
+ case SORT_HEAPSORT:
+ mt_sort(list, heapsort, outfile);
+ break;
+ case SORT_QSORT:
+ mt_sort(list, sort_qsort, outfile);
+ break;
+ default:
+ mt_sort(list, DEFAULT_SORT_FUNC, outfile);
+ break;
+ }
+}
+
+/******************* MT SORT ************************/
+
+#if defined(SORT_THREADS)
+/* semaphore to count threads */
+static sem_t mtsem;
+
+/* current system sort function */
+static int (*g_sort_func)(void *, size_t, size_t,
+ int(*)(const void *, const void *));
+
+/*
+ * Sort cycle thread (in multi-threaded mode)
+ */
+static void*
+mt_sort_thread(void* arg)
+{
+ struct sort_list *list = arg;
+
+ g_sort_func(list->list, list->count, sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+
+ sem_post(&mtsem);
+
+ return (arg);
+}
+
+/*
+ * Compare sub-lists. Empty sub-lists always go to the end of the list.
+ */
+static int
+sub_list_cmp(struct sort_list *l1, struct sort_list *l2)
+{
+
+ if (l1 == l2)
+ return (0);
+ else {
+ if (l1->count == 0) {
+ return ((l2->count == 0) ? 0 : +1);
+ } else if (l2->count == 0) {
+ return (-1);
+ } else {
+ int ret;
+
+ ret = list_coll(&(l1->list[0]), &(l2->list[0]));
+ if (!ret)
+ return ((l1->sub_list_pos < l2->sub_list_pos) ?
+ -1 : +1);
+ return (ret);
+ }
+ }
+}
+
+/*
+ * Swap two array elements
+ */
+static void
+sub_list_swap(struct sort_list **sl, size_t i1, size_t i2)
+{
+ struct sort_list *tmp;
+
+ tmp = sl[i1];
+ sl[i1] = sl[i2];
+ sl[i2] = tmp;
+}
+
+/* heap algorithm ==>> */
+
+/*
+ * See heap sort algorithm
+ * "Raises" last element to its right place
+ */
+static void
+sub_list_swim(struct sort_list **sl, size_t indx)
+{
+
+ if (indx > 0) {
+ size_t parent_index;
+
+ parent_index = (indx - 1) >> 1;
+
+ if (sub_list_cmp(sl[indx], sl[parent_index]) < 0) {
+ /* swap child and parent and continue */
+ sub_list_swap(sl, indx, parent_index);
+ sub_list_swim(sl, parent_index);
+ }
+ }
+}
+
+/*
+ * Sink the top element to its correct position
+ */
+static void
+sub_list_sink(struct sort_list **sl, size_t indx, size_t size)
+{
+ size_t left_child_index;
+ size_t right_child_index;
+
+ left_child_index = indx + indx + 1;
+ right_child_index = left_child_index + 1;
+
+ if (left_child_index < size) {
+ size_t min_child_index;
+
+ min_child_index = left_child_index;
+
+ if ((right_child_index < size) &&
+ (sub_list_cmp(sl[left_child_index],
+ sl[right_child_index]) > 0))
+ min_child_index = right_child_index;
+ if (sub_list_cmp(sl[indx], sl[min_child_index]) > 0) {
+ sub_list_swap(sl, indx, min_child_index);
+ sub_list_sink(sl, min_child_index, size);
+ }
+ }
+}
+
+/* <<== heap algorithm */
+
+/*
+ * Adds element to the "right" end
+ */
+static void
+sub_list_push(struct sort_list *s, struct sort_list **sl, size_t size)
+{
+
+ sl[size++] = s;
+ sub_list_swim(sl, size - 1);
+}
+
+struct last_printed_item
+{
+ struct sort_list_item *item;
+};
+
+/*
+ * Prints the current line of the file
+ */
+static void
+sub_list_header_print(struct sort_list *sl, FILE *f_out,
+ struct last_printed_item *lp)
+{
+
+ if (sl && sl->count && f_out && sl->list[0]->str) {
+ if (sort_opts_vals.uflag) {
+ if ((lp->item == NULL) || (list_coll(&(lp->item),
+ &(sl->list[0])))) {
+ bwsfwrite(sl->list[0]->str, f_out,
+ sort_opts_vals.zflag);
+ lp->item = sl->list[0];
+ }
+ } else
+ bwsfwrite(sl->list[0]->str, f_out,
+ sort_opts_vals.zflag);
+ }
+}
+
+/*
+ * Read next line
+ */
+static void
+sub_list_next(struct sort_list *sl)
+{
+
+ if (sl && sl->count) {
+ sl->list += 1;
+ sl->count -= 1;
+ }
+}
+
+/*
+ * Merge sub-lists to a file
+ */
+static void
+merge_sub_lists(struct sort_list **sl, size_t n, FILE* f_out)
+{
+ struct last_printed_item lp;
+ size_t i;
+
+ memset(&lp,0,sizeof(lp));
+
+ /* construct the initial list: */
+ for (i = 0; i < n; i++)
+ sub_list_push(sl[i], sl, i);
+
+ while (sl[0]->count) { /* unfinished lists are always in front */
+ /* output the smallest line: */
+ sub_list_header_print(sl[0], f_out, &lp);
+ /* move to a new line, if possible: */
+ sub_list_next(sl[0]);
+ /* re-arrange the list: */
+ sub_list_sink(sl, 0, n);
+ }
+}
+
+/*
+ * Merge sub-lists to a file
+ */
+static void
+merge_list_parts(struct sort_list **parts, size_t n, const char *fn)
+{
+ FILE* f_out;
+
+ f_out = openfile(fn,"w");
+
+ merge_sub_lists(parts, n, f_out);
+
+ closefile(f_out, fn);
+}
+
+#endif /* defined(SORT_THREADS) */
+/*
+ * Multi-threaded sort algorithm "driver"
+ */
+static void
+mt_sort(struct sort_list *list,
+ int(*sort_func)(void *, size_t, size_t, int(*)(const void *, const void *)),
+ const char* fn)
+{
+#if defined(SORT_THREADS)
+ if (nthreads < 2 || list->count < MT_SORT_THRESHOLD) {
+ size_t nthreads_save = nthreads;
+ nthreads = 1;
+#endif
+ /* if single thread or small data, do simple sort */
+ sort_func(list->list, list->count,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+ sort_list_dump(list, fn);
+#if defined(SORT_THREADS)
+ nthreads = nthreads_save;
+ } else {
+ /* multi-threaded sort */
+ struct sort_list **parts;
+ size_t avgsize, cstart, i;
+
+ /* array of sub-lists */
+ parts = sort_malloc(sizeof(struct sort_list*) * nthreads);
+ cstart = 0;
+ avgsize = list->count / nthreads;
+
+ /* set global system sort function */
+ g_sort_func = sort_func;
+
+ /* set sublists */
+ for (i = 0; i < nthreads; ++i) {
+ size_t sz = 0;
+
+ parts[i] = sort_malloc(sizeof(struct sort_list));
+ parts[i]->list = list->list + cstart;
+ parts[i]->memsize = 0;
+ parts[i]->sub_list_pos = i;
+
+ sz = (i == nthreads - 1) ? list->count - cstart :
+ avgsize;
+
+ parts[i]->count = sz;
+
+ parts[i]->size = parts[i]->count;
+
+ cstart += sz;
+ }
+
+ /* init threads counting semaphore */
+ sem_init(&mtsem, 0, 0);
+
+ /* start threads */
+ for (i = 0; i < nthreads; ++i) {
+ pthread_t pth;
+ pthread_attr_t attr;
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_DETACHED);
+
+ for (;;) {
+ int res = pthread_create(&pth, &attr,
+ mt_sort_thread, parts[i]);
+
+ if (res >= 0)
+ break;
+ if (errno == EAGAIN) {
+ pthread_yield();
+ continue;
+ }
+ err(2, NULL);
+ }
+
+ pthread_attr_destroy(&attr);
+ }
+
+ /* wait for threads completion */
+ for (i = 0; i < nthreads; ++i) {
+ sem_wait(&mtsem);
+ }
+ /* destroy the semaphore - we do not need it anymore */
+ sem_destroy(&mtsem);
+
+ /* merge sorted sub-lists to the file */
+ merge_list_parts(parts, nthreads, fn);
+
+ /* free sub-lists data */
+ for (i = 0; i < nthreads; ++i) {
+ sort_free(parts[i]);
+ }
+ sort_free(parts);
+ }
+#endif /* defined(SORT_THREADS) */
+}
diff --git a/usr.bin/sort/file.h b/usr.bin/sort/file.h
new file mode 100644
index 0000000..e87fafd
--- /dev/null
+++ b/usr.bin/sort/file.h
@@ -0,0 +1,126 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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.
+ */
+
+#if !defined(__SORT_FILE_H__)
+#define __SORT_FILE_H__
+
+#include "coll.h"
+#include "sort.h"
+
+#define SORT_DEFAULT 0
+#define SORT_QSORT 1
+#define SORT_MERGESORT 2
+#define SORT_HEAPSORT 3
+#define SORT_RADIXSORT 4
+
+#define DEFAULT_SORT_ALGORITHM SORT_HEAPSORT
+#define DEFAULT_SORT_FUNC heapsort
+
+/*
+ * List of data to be sorted.
+ */
+struct sort_list
+{
+ struct sort_list_item **list;
+ unsigned long long memsize;
+ size_t count;
+ size_t size;
+ size_t sub_list_pos;
+};
+
+/*
+ * File reader object
+ */
+struct file_reader;
+
+/*
+ * List of files to be sorted
+ */
+struct file_list
+{
+ char **fns;
+ size_t count;
+ size_t sz;
+ bool tmp;
+};
+
+/* memory */
+
+/**/
+
+extern unsigned long long free_memory;
+extern unsigned long long available_free_memory;
+
+/* Are we using mmap ? */
+extern bool use_mmap;
+
+/* temporary file dir */
+
+extern const char *tmpdir;
+
+/*
+ * Max number of simultaneously open files (including the output file).
+ */
+extern size_t max_open_files;
+
+/*
+ * Compress program
+ */
+extern const char* compress_program;
+
+/* funcs */
+
+struct file_reader *file_reader_init(const char *fsrc);
+struct bwstring *file_reader_readline(struct file_reader *fr);
+void file_reader_free(struct file_reader *fr);
+
+void init_tmp_files(void);
+void clear_tmp_files(void);
+char *new_tmp_file_name(void);
+void tmp_file_atexit(const char *tmp_file);
+
+void file_list_init(struct file_list *fl, bool tmp);
+void file_list_add(struct file_list *fl, char *fn, bool allocate);
+void file_list_populate(struct file_list *fl, int argc, char **argv, bool allocate);
+void file_list_clean(struct file_list *fl);
+
+int check(const char *);
+void merge_files(struct file_list *fl, const char *fn_out);
+FILE *openfile(const char *, const char *);
+void closefile(FILE *, const char *);
+int procfile(const char *fn, struct sort_list *list, struct file_list *fl);
+
+void sort_list_init(struct sort_list *l);
+void sort_list_add(struct sort_list *l, struct bwstring *str);
+void sort_list_clean(struct sort_list *l);
+void sort_list_dump(struct sort_list *l, const char *fn);
+
+void sort_list_to_file(struct sort_list *list, const char *outfile);
+
+#endif /* __SORT_FILE_H__ */
diff --git a/usr.bin/sort/mem.c b/usr.bin/sort/mem.c
new file mode 100644
index 0000000..c6e9a53
--- /dev/null
+++ b/usr.bin/sort/mem.c
@@ -0,0 +1,81 @@
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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 <err.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mem.h"
+
+/*
+ * malloc() wrapper.
+ */
+void *
+sort_malloc(size_t size)
+{
+ void *ptr;
+
+ if ((ptr = malloc(size)) == NULL)
+ err(2, NULL);
+ return (ptr);
+}
+
+/*
+ * free() wrapper.
+ */
+void
+sort_free(const void *ptr)
+{
+
+ if (ptr)
+ free(__DECONST(void *, ptr));
+}
+
+/*
+ * realloc() wrapper.
+ */
+void *
+sort_realloc(void *ptr, size_t size)
+{
+
+ if ((ptr = realloc(ptr, size)) == NULL)
+ err(2, NULL);
+ return (ptr);
+}
+
+char *
+sort_strdup(const char *str)
+{
+ char *dup;
+
+ if ((dup = strdup(str)) == NULL)
+ err(2, NULL);
+ return (dup);
+}
diff --git a/usr.bin/sort/mem.h b/usr.bin/sort/mem.h
new file mode 100644
index 0000000..36671e3
--- /dev/null
+++ b/usr.bin/sort/mem.h
@@ -0,0 +1,45 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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.
+ */
+
+#if !defined(__SORT_MEM_H__)
+#define __SORT_MEM_H__
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+/*
+ * mem.c
+ */
+void *sort_malloc(size_t);
+void sort_free(const void *ptr);
+void *sort_realloc(void *, size_t);
+char *sort_strdup(const char *);
+
+#endif /* __SORT_MEM_H__ */
diff --git a/usr.bin/sort/nls/C.msg b/usr.bin/sort/nls/C.msg
new file mode 100644
index 0000000..541d1d8
--- /dev/null
+++ b/usr.bin/sort/nls/C.msg
@@ -0,0 +1,16 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "mutually exclusive flags"
+2 "extra argument not allowed with -c"
+3 "Unknown feature"
+4 "Wrong memory buffer specification"
+5 "0 field in key specs"
+6 "0 column in key specs"
+7 "Wrong file mode"
+8 "Cannot open file for reading"
+9 "Radix sort cannot be used with these sort options"
+10 "The chosen sort method cannot be used with stable and/or unique sort"
+11 "Invalid key position"
+12 "Usage: %s [-bcCdfigMmnrsuz] [-kPOS1[,POS2] ... ] [+POS1 [-POS2]] [-S memsize] [-T tmpdir] [-t separator] [-o outfile] [--batch-size size] [--files0-from file] [--heapsort] [--mergesort] [--radixsort] [--qsort] [--nthreads thread_no] [--human-numeric-sort] [--version-sort] [--random-sort [--random-source file]] [--compress-program program] [file ...]\n"
diff --git a/usr.bin/sort/nls/hu_HU.ISO8859-2.msg b/usr.bin/sort/nls/hu_HU.ISO8859-2.msg
new file mode 100644
index 0000000..054acc6
--- /dev/null
+++ b/usr.bin/sort/nls/hu_HU.ISO8859-2.msg
@@ -0,0 +1,16 @@
+$ $FreeBSD$
+$
+$set 1
+$quote "
+1 "egymást kizáró opciók"
+2 "extra argumentum a -%c opcióval"
+3 "Ismeretlen funkció\n"
+4 "Rossz memória puffer érték"
+5 "0 mezõ a kulcsspecifikációban\n"
+6 "0 oszlop a kulcsspecifikációban\n"
+7 "Helytelen fájl mód"
+8 "A fájl nem nyitható meg olvasásra"
+9 "A radix rendezés nem használható a megadott rendezési opciókkal"
+10 "A választott rendezési mód nem használható a --stable és --unique opciókkal"
+11 "Érvénytelen kulcs pozíció"
+12 "Használat: %s [-bcCdfigMmnrsuz] [-kPOS1[,POS2] ... ] [+POS1 [-POS2]] [-S memóriaméret] [-T ideiglenes_könyvtár] [-t elválasztó] [-o kimeneti_fájl] [--batch-size méret] [--files0-from fájl] [--heapsort] [--mergesort] [--radixsort] [--qsort] [--nthreads szálak_száma] [--human-numeric-sort] [--version-sort] [--random-sort [--random-source fájl]] [--compress-program program] [fájl ...]\n"
diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c
new file mode 100644
index 0000000..1fa260b
--- /dev/null
+++ b/usr.bin/sort/radixsort.c
@@ -0,0 +1,691 @@
+/*-
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * Copyright (C) 2012 Gabor Kovesdan <gabor@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 <errno.h>
+#include <err.h>
+#include <langinfo.h>
+#include <math.h>
+#if defined(SORT_THREADS)
+#include <pthread.h>
+#include <semaphore.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <unistd.h>
+
+#include "coll.h"
+#include "radixsort.h"
+
+#define DEFAULT_SORT_FUNC_RADIXSORT mergesort
+
+#define TINY_NODE(sl) ((sl)->tosort_num < 65)
+#define SMALL_NODE(sl) ((sl)->tosort_num < 5)
+
+/* are we sorting in reverse order ? */
+static bool reverse_sort;
+
+/* sort sub-levels array size */
+static const size_t slsz = 256 * sizeof(struct sort_level*);
+
+/* one sort level structure */
+struct sort_level
+{
+ struct sort_level **sublevels;
+ struct sort_list_item **leaves;
+ struct sort_list_item **sorted;
+ struct sort_list_item **tosort;
+ size_t leaves_num;
+ size_t leaves_sz;
+ size_t level;
+ size_t real_sln;
+ size_t start_position;
+ size_t sln;
+ size_t tosort_num;
+ size_t tosort_sz;
+};
+
+/* stack of sort levels ready to be sorted */
+struct level_stack {
+ struct level_stack *next;
+ struct sort_level *sl;
+};
+
+static struct level_stack *g_ls;
+
+#if defined(SORT_THREADS)
+/* stack guarding mutex */
+static pthread_mutex_t g_ls_mutex;
+
+/* counter: how many items are left */
+static size_t sort_left;
+/* guarding mutex */
+static pthread_mutex_t sort_left_mutex;
+
+/* semaphore to count threads */
+static sem_t mtsem;
+
+/*
+ * Decrement items counter
+ */
+static inline void
+sort_left_dec(size_t n)
+{
+
+ pthread_mutex_lock(&sort_left_mutex);
+ sort_left -= n;
+ pthread_mutex_unlock(&sort_left_mutex);
+}
+
+/*
+ * Do we have something to sort ?
+ */
+static inline bool
+have_sort_left(void)
+{
+ bool ret;
+
+ pthread_mutex_lock(&sort_left_mutex);
+ ret = (sort_left > 0);
+ pthread_mutex_unlock(&sort_left_mutex);
+ return (ret);
+}
+
+#else
+
+#define sort_left_dec(n)
+
+#endif /* SORT_THREADS */
+
+/*
+ * Push sort level to the stack
+ */
+static inline void
+push_ls(struct sort_level *sl)
+{
+ struct level_stack *new_ls;
+
+ new_ls = sort_malloc(sizeof(struct level_stack));
+ new_ls->sl = sl;
+
+#if defined(SORT_THREADS)
+ if (nthreads > 1)
+ pthread_mutex_lock(&g_ls_mutex);
+#endif
+
+ new_ls->next = g_ls;
+ g_ls = new_ls;
+
+#if defined(SORT_THREADS)
+ if (nthreads > 1)
+ pthread_mutex_unlock(&g_ls_mutex);
+#endif
+}
+
+/*
+ * Pop sort level from the stack (single-threaded style)
+ */
+static inline struct sort_level*
+pop_ls_st(void)
+{
+ struct sort_level *sl;
+
+ if (g_ls) {
+ struct level_stack *saved_ls;
+
+ sl = g_ls->sl;
+ saved_ls = g_ls;
+ g_ls = g_ls->next;
+ sort_free(saved_ls);
+ } else
+ sl = NULL;
+
+ return (sl);
+}
+
+#if defined(SORT_THREADS)
+
+/*
+ * Pop sort level from the stack (multi-threaded style)
+ */
+static inline struct sort_level*
+pop_ls_mt(void)
+{
+ struct level_stack *saved_ls;
+ struct sort_level *sl;
+
+ pthread_mutex_lock(&g_ls_mutex);
+
+ if (g_ls) {
+ sl = g_ls->sl;
+ saved_ls = g_ls;
+ g_ls = g_ls->next;
+ } else {
+ sl = NULL;
+ saved_ls = NULL;
+ }
+
+ pthread_mutex_unlock(&g_ls_mutex);
+
+ sort_free(saved_ls);
+
+ return (sl);
+}
+
+#endif /* defined(SORT_THREADS) */
+
+static void
+add_to_sublevel(struct sort_level *sl, struct sort_list_item *item, size_t indx)
+{
+ struct sort_level *ssl;
+
+ ssl = sl->sublevels[indx];
+
+ if (ssl == NULL) {
+ ssl = sort_malloc(sizeof(struct sort_level));
+ memset(ssl, 0, sizeof(struct sort_level));
+
+ ssl->level = sl->level + 1;
+ sl->sublevels[indx] = ssl;
+
+ ++(sl->real_sln);
+ }
+
+ if (++(ssl->tosort_num) > ssl->tosort_sz) {
+ ssl->tosort_sz = ssl->tosort_num + 128;
+ ssl->tosort = sort_realloc(ssl->tosort,
+ sizeof(struct sort_list_item*) * (ssl->tosort_sz));
+ }
+
+ ssl->tosort[ssl->tosort_num - 1] = item;
+}
+
+static inline void
+add_leaf(struct sort_level *sl, struct sort_list_item *item)
+{
+
+ if (++(sl->leaves_num) > sl->leaves_sz) {
+ sl->leaves_sz = sl->leaves_num + 128;
+ sl->leaves = sort_realloc(sl->leaves,
+ (sizeof(struct sort_list_item*) * (sl->leaves_sz)));
+ }
+ sl->leaves[sl->leaves_num - 1] = item;
+}
+
+static inline int
+get_wc_index(struct sort_list_item *sli, size_t level)
+{
+ const struct bwstring *bws;
+
+ bws = sli->ka.key[0].k;
+
+ if ((BWSLEN(bws) > level))
+ return (unsigned char) BWS_GET(bws,level);
+ return (-1);
+}
+
+static void
+place_item(struct sort_level *sl, size_t item)
+{
+ struct sort_list_item *sli;
+ int c;
+
+ sli = sl->tosort[item];
+ c = get_wc_index(sli, sl->level);
+
+ if (c == -1)
+ add_leaf(sl, sli);
+ else
+ add_to_sublevel(sl, sli, c);
+}
+
+static void
+free_sort_level(struct sort_level *sl)
+{
+
+ if (sl) {
+ if (sl->leaves)
+ sort_free(sl->leaves);
+
+ if (sl->level > 0)
+ sort_free(sl->tosort);
+
+ if (sl->sublevels) {
+ struct sort_level *slc;
+ size_t sln;
+
+ sln = sl->sln;
+
+ for (size_t i = 0; i < sln; ++i) {
+ slc = sl->sublevels[i];
+ if (slc)
+ free_sort_level(slc);
+ }
+
+ sort_free(sl->sublevels);
+ }
+
+ sort_free(sl);
+ }
+}
+
+static void
+run_sort_level_next(struct sort_level *sl)
+{
+ struct sort_level *slc;
+ size_t i, sln, tosort_num;
+
+ if (sl->sublevels) {
+ sort_free(sl->sublevels);
+ sl->sublevels = NULL;
+ }
+
+ switch (sl->tosort_num) {
+ case 0:
+ goto end;
+ case (1):
+ sl->sorted[sl->start_position] = sl->tosort[0];
+ sort_left_dec(1);
+ goto end;
+ case (2):
+ if (list_coll_offset(&(sl->tosort[0]), &(sl->tosort[1]),
+ sl->level) > 0) {
+ sl->sorted[sl->start_position++] = sl->tosort[1];
+ sl->sorted[sl->start_position] = sl->tosort[0];
+ } else {
+ sl->sorted[sl->start_position++] = sl->tosort[0];
+ sl->sorted[sl->start_position] = sl->tosort[1];
+ }
+ sort_left_dec(2);
+
+ goto end;
+ default:
+ if (TINY_NODE(sl) || (sl->level > 15)) {
+ listcoll_t func;
+
+ func = get_list_call_func(sl->level);
+
+ sl->leaves = sl->tosort;
+ sl->leaves_num = sl->tosort_num;
+ sl->leaves_sz = sl->leaves_num;
+ sl->leaves = sort_realloc(sl->leaves,
+ (sizeof(struct sort_list_item *) *
+ (sl->leaves_sz)));
+ sl->tosort = NULL;
+ sl->tosort_num = 0;
+ sl->tosort_sz = 0;
+ sl->sln = 0;
+ sl->real_sln = 0;
+ if (sort_opts_vals.sflag) {
+ if (mergesort(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) func) == -1)
+ /* NOTREACHED */
+ err(2, "Radix sort error 3");
+ } else
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) func);
+
+ memcpy(sl->sorted + sl->start_position,
+ sl->leaves, sl->leaves_num *
+ sizeof(struct sort_list_item*));
+
+ sort_left_dec(sl->leaves_num);
+
+ goto end;
+ } else {
+ sl->tosort_sz = sl->tosort_num;
+ sl->tosort = sort_realloc(sl->tosort,
+ sizeof(struct sort_list_item*) * (sl->tosort_sz));
+ }
+ }
+
+ sl->sln = 256;
+ sl->sublevels = sort_malloc(slsz);
+ memset(sl->sublevels, 0, slsz);
+
+ sl->real_sln = 0;
+
+ tosort_num = sl->tosort_num;
+ for (i = 0; i < tosort_num; ++i)
+ place_item(sl, i);
+
+ sort_free(sl->tosort);
+ sl->tosort = NULL;
+ sl->tosort_num = 0;
+ sl->tosort_sz = 0;
+
+ if (sl->leaves_num > 1) {
+ if (keys_num > 1) {
+ if (sort_opts_vals.sflag) {
+ mergesort(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+ } else {
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+ }
+ } else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) {
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll_by_str_only);
+ }
+ }
+
+ sl->leaves_sz = sl->leaves_num;
+ sl->leaves = sort_realloc(sl->leaves, (sizeof(struct sort_list_item *) *
+ (sl->leaves_sz)));
+
+ if (!reverse_sort) {
+ memcpy(sl->sorted + sl->start_position, sl->leaves,
+ sl->leaves_num * sizeof(struct sort_list_item*));
+ sl->start_position += sl->leaves_num;
+ sort_left_dec(sl->leaves_num);
+
+ sort_free(sl->leaves);
+ sl->leaves = NULL;
+ sl->leaves_num = 0;
+ sl->leaves_sz = 0;
+
+ sln = sl->sln;
+
+ for (i = 0; i < sln; ++i) {
+ slc = sl->sublevels[i];
+
+ if (slc) {
+ slc->sorted = sl->sorted;
+ slc->start_position = sl->start_position;
+ sl->start_position += slc->tosort_num;
+ if (SMALL_NODE(slc))
+ run_sort_level_next(slc);
+ else
+ push_ls(slc);
+ sl->sublevels[i] = NULL;
+ }
+ }
+
+ } else {
+ size_t n;
+
+ sln = sl->sln;
+
+ for (i = 0; i < sln; ++i) {
+ n = sln - i - 1;
+ slc = sl->sublevels[n];
+
+ if (slc) {
+ slc->sorted = sl->sorted;
+ slc->start_position = sl->start_position;
+ sl->start_position += slc->tosort_num;
+ if (SMALL_NODE(slc))
+ run_sort_level_next(slc);
+ else
+ push_ls(slc);
+ sl->sublevels[n] = NULL;
+ }
+ }
+
+ memcpy(sl->sorted + sl->start_position, sl->leaves,
+ sl->leaves_num * sizeof(struct sort_list_item*));
+ sort_left_dec(sl->leaves_num);
+ }
+
+end:
+ free_sort_level(sl);
+}
+
+/*
+ * Single-threaded sort cycle
+ */
+static void
+run_sort_cycle_st(void)
+{
+ struct sort_level *slc;
+
+ for (;;) {
+ slc = pop_ls_st();
+ if (slc == NULL) {
+ break;
+ }
+ run_sort_level_next(slc);
+ }
+}
+
+#if defined(SORT_THREADS)
+
+/*
+ * Multi-threaded sort cycle
+ */
+static void
+run_sort_cycle_mt(void)
+{
+ struct sort_level *slc;
+
+ for (;;) {
+ slc = pop_ls_mt();
+ if (slc == NULL) {
+ if (have_sort_left()) {
+ pthread_yield();
+ continue;
+ }
+ break;
+ }
+ run_sort_level_next(slc);
+ }
+}
+
+/*
+ * Sort cycle thread (in multi-threaded mode)
+ */
+static void*
+sort_thread(void* arg)
+{
+
+ run_sort_cycle_mt();
+
+ sem_post(&mtsem);
+
+ return (arg);
+}
+
+#endif /* defined(SORT_THREADS) */
+
+static void
+run_top_sort_level(struct sort_level *sl)
+{
+ struct sort_level *slc;
+
+ reverse_sort = sort_opts_vals.kflag ? keys[0].sm.rflag :
+ default_sort_mods->rflag;
+
+ sl->start_position = 0;
+ sl->sln = 256;
+ sl->sublevels = sort_malloc(slsz);
+ memset(sl->sublevels, 0, slsz);
+
+ for (size_t i = 0; i < sl->tosort_num; ++i)
+ place_item(sl, i);
+
+ if (sl->leaves_num > 1) {
+ if (keys_num > 1) {
+ if (sort_opts_vals.sflag) {
+ mergesort(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+ } else {
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll);
+ }
+ } else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) {
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
+ sizeof(struct sort_list_item *),
+ (int(*)(const void *, const void *)) list_coll_by_str_only);
+ }
+ }
+
+ if (!reverse_sort) {
+ memcpy(sl->tosort + sl->start_position, sl->leaves,
+ sl->leaves_num * sizeof(struct sort_list_item*));
+ sl->start_position += sl->leaves_num;
+ sort_left_dec(sl->leaves_num);
+
+ for (size_t i = 0; i < sl->sln; ++i) {
+ slc = sl->sublevels[i];
+
+ if (slc) {
+ slc->sorted = sl->tosort;
+ slc->start_position = sl->start_position;
+ sl->start_position += slc->tosort_num;
+ push_ls(slc);
+ sl->sublevels[i] = NULL;
+ }
+ }
+
+ } else {
+ size_t n;
+
+ for (size_t i = 0; i < sl->sln; ++i) {
+
+ n = sl->sln - i - 1;
+ slc = sl->sublevels[n];
+
+ if (slc) {
+ slc->sorted = sl->tosort;
+ slc->start_position = sl->start_position;
+ sl->start_position += slc->tosort_num;
+ push_ls(slc);
+ sl->sublevels[n] = NULL;
+ }
+ }
+
+ memcpy(sl->tosort + sl->start_position, sl->leaves,
+ sl->leaves_num * sizeof(struct sort_list_item*));
+
+ sort_left_dec(sl->leaves_num);
+ }
+
+#if defined(SORT_THREADS)
+ if (nthreads < 2) {
+#endif
+ run_sort_cycle_st();
+#if defined(SORT_THREADS)
+ } else {
+ size_t i;
+
+ for(i = 0; i < nthreads; ++i) {
+ pthread_attr_t attr;
+ pthread_t pth;
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr,
+ PTHREAD_DETACHED);
+
+ for (;;) {
+ int res = pthread_create(&pth, &attr,
+ sort_thread, NULL);
+ if (res >= 0)
+ break;
+ if (errno == EAGAIN) {
+ pthread_yield();
+ continue;
+ }
+ err(2, NULL);
+ }
+
+ pthread_attr_destroy(&attr);
+ }
+
+ for(i = 0; i < nthreads; ++i)
+ sem_wait(&mtsem);
+ }
+#endif /* defined(SORT_THREADS) */
+}
+
+static void
+run_sort(struct sort_list_item **base, size_t nmemb)
+{
+ struct sort_level *sl;
+
+#if defined(SORT_THREADS)
+ size_t nthreads_save = nthreads;
+ if (nmemb < MT_SORT_THRESHOLD)
+ nthreads = 1;
+
+ if (nthreads > 1) {
+ pthread_mutexattr_t mattr;
+
+ pthread_mutexattr_init(&mattr);
+ pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
+
+ pthread_mutex_init(&g_ls_mutex, &mattr);
+ pthread_mutex_init(&sort_left_mutex, &mattr);
+
+ pthread_mutexattr_destroy(&mattr);
+
+ sem_init(&mtsem, 0, 0);
+
+ }
+#endif
+
+ sl = sort_malloc(sizeof(struct sort_level));
+ memset(sl, 0, sizeof(struct sort_level));
+
+ sl->tosort = base;
+ sl->tosort_num = nmemb;
+ sl->tosort_sz = nmemb;
+
+#if defined(SORT_THREADS)
+ sort_left = nmemb;
+#endif
+
+ run_top_sort_level(sl);
+
+ free_sort_level(sl);
+
+#if defined(SORT_THREADS)
+ if (nthreads > 1) {
+ sem_destroy(&mtsem);
+ pthread_mutex_destroy(&g_ls_mutex);
+ pthread_mutex_destroy(&sort_left_mutex);
+ }
+ nthreads = nthreads_save;
+#endif
+}
+
+void
+rxsort(struct sort_list_item **base, size_t nmemb)
+{
+
+ run_sort(base, nmemb);
+}
diff --git a/usr.bin/sort/radixsort.h b/usr.bin/sort/radixsort.h
new file mode 100644
index 0000000..8743728
--- /dev/null
+++ b/usr.bin/sort/radixsort.h
@@ -0,0 +1,38 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * Copyright (C) 2012 Gabor Kovesdan <gabor@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.
+ */
+
+#if !defined(__SORT_RADIX_H__)
+#define __SORT_RADIX_H__
+
+#include "coll.h"
+#include "sort.h"
+
+void rxsort(struct sort_list_item **base, size_t nmemb);
+
+#endif /* __SORT_RADIX_H__ */
diff --git a/usr.bin/sort/sort.1.in b/usr.bin/sort/sort.1.in
new file mode 100644
index 0000000..e3266c1
--- /dev/null
+++ b/usr.bin/sort/sort.1.in
@@ -0,0 +1,637 @@
+.\" $OpenBSD: sort.1,v 1.45 2015/03/19 13:51:10 jmc Exp $
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)sort.1 8.1 (Berkeley) 6/6/93
+.\"
+.Dd March 19, 2015
+.Dt SORT 1
+.Os
+.Sh NAME
+.Nm sort
+.Nd sort or merge records (lines) of text and binary files
+.Sh SYNOPSIS
+.Nm
+.Bk -words
+.Op Fl bcCdfghiRMmnrsuVz
+.Sm off
+.Op Fl k\ \& Ar field1 Op , Ar field2
+.Sm on
+.Op Fl S Ar memsize
+.Ek
+.Op Fl T Ar dir
+.Op Fl t Ar char
+.Op Fl o Ar output
+.Op Ar file ...
+.Nm
+.Fl Fl help
+.Nm
+.Fl Fl version
+.Sh DESCRIPTION
+The
+.Nm
+utility sorts text and binary files by lines.
+A line is a record separated from the subsequent record by a
+newline (default) or NUL \'\\0\' character (-z option).
+A record can contain any printable or unprintable characters.
+Comparisons are based on one or more sort keys extracted from
+each line of input, and are performed lexicographically,
+according to the current locale's collating rules and the
+specified command-line options that can tune the actual
+sorting behavior.
+By default, if keys are not given,
+.Nm
+uses entire lines for comparison.
+.Pp
+The command line options are as follows:
+.Bl -tag -width Ds
+.It Fl c , Fl Fl check , Fl C , Fl Fl check=silent|quiet
+Check that the single input file is sorted.
+If the file is not sorted,
+.Nm
+produces the appropriate error messages and exits with code 1,
+otherwise returns 0.
+If
+.Fl C
+or
+.Fl Fl check=silent
+is specified,
+.Nm
+produces no output.
+This is a "silent" version of
+.Fl c .
+.It Fl m , Fl Fl merge
+Merge only.
+The input files are assumed to be pre-sorted.
+If they are not sorted the output order is undefined.
+.It Fl o Ar output , Fl Fl output Ns = Ns Ar output
+Print the output to the
+.Ar output
+file instead of the standard output.
+.It Fl S Ar size , Fl Fl buffer-size Ns = Ns Ar size
+Use
+.Ar size
+for the maximum size of the memory buffer.
+Size modifiers %,b,K,M,G,T,P,E,Z,Y can be used.
+If a memory limit is not explicitly specified,
+.Nm
+takes up to about 90% of available memory.
+If the file size is too big to fit into the memory buffer,
+the temporary disk files are used to perform the sorting.
+.It Fl T Ar dir , Fl Fl temporary-directory Ns = Ns Ar dir
+Store temporary files in the directory
+.Ar dir .
+The default path is the value of the environment variable
+.Ev TMPDIR
+or
+.Pa /var/tmp
+if
+.Ev TMPDIR
+is not defined.
+.It Fl u , Fl Fl unique
+Unique keys.
+Suppress all lines that have a key that is equal to an already
+processed one.
+This option, similarly to
+.Fl s ,
+implies a stable sort.
+If used with
+.Fl c
+or
+.Fl C ,
+.Nm
+also checks that there are no lines with duplicate keys.
+.It Fl s
+Stable sort.
+This option maintains the original record order of records that have
+and equal key.
+This is a non-standard feature, but it is widely accepted and used.
+.It Fl Fl version
+Print the version and silently exits.
+.It Fl Fl help
+Print the help text and silently exits.
+.El
+.Pp
+The following options override the default ordering rules.
+When ordering options appear independently of key field
+specifications, they apply globally to all sort keys.
+When attached to a specific key (see
+.Fl k ) ,
+the ordering options override all global ordering options for
+the key they are attached to.
+.Bl -tag -width indent
+.It Fl b , Fl Fl ignore-leading-blanks
+Ignore leading blank characters when comparing lines.
+.It Fl d , Fl Fl dictionary-order
+Consider only blank spaces and alphanumeric characters in comparisons.
+.It Fl f , Fl Fl ignore-case
+Convert all lowercase characters to their uppercase equivalent
+before comparison, that is, perform case-independent sorting.
+.It Fl g , Fl Fl general-numeric-sort , Fl Fl sort=general-numeric
+Sort by general numerical value.
+As opposed to
+.Fl n ,
+this option handles general floating points.
+It has a more
+permissive format than that allowed by
+.Fl n
+but it has a significant performance drawback.
+.It Fl h , Fl Fl human-numeric-sort , Fl Fl sort=human-numeric
+Sort by numerical value, but take into account the SI suffix,
+if present.
+Sort first by numeric sign (negative, zero, or
+positive); then by SI suffix (either empty, or `k' or `K', or one
+of `MGTPEZY', in that order); and finally by numeric value.
+The SI suffix must immediately follow the number.
+For example, '12345K' sorts before '1M', because M is "larger" than K.
+This sort option is useful for sorting the output of a single invocation
+of 'df' command with
+.Fl h
+or
+.Fl H
+options (human-readable).
+.It Fl i , Fl Fl ignore-nonprinting
+Ignore all non-printable characters.
+.It Fl M , Fl Fl month-sort , Fl Fl sort=month
+Sort by month abbreviations.
+Unknown strings are considered smaller than the month names.
+.It Fl n , Fl Fl numeric-sort , Fl Fl sort=numeric
+Sort fields numerically by arithmetic value.
+Fields are supposed to have optional blanks in the beginning, an
+optional minus sign, zero or more digits (including decimal point and
+possible thousand separators).
+.It Fl R , Fl Fl random-sort , Fl Fl sort=random
+Sort by a random order.
+This is a random permutation of the inputs except that
+the equal keys sort together.
+It is implemented by hashing the input keys and sorting
+the hash values.
+The hash function is chosen randomly.
+The hash function is randomized by
+.Cm /dev/random
+content, or by file content if it is specified by
+.Fl Fl random-source .
+Even if multiple sort fields are specified,
+the same random hash function is used for all of them.
+.It Fl r , Fl Fl reverse
+Sort in reverse order.
+.It Fl V , Fl Fl version-sort
+Sort version numbers.
+The input lines are treated as file names in form
+PREFIX VERSION SUFFIX, where SUFFIX matches the regular expression
+"(\.([A-Za-z~][A-Za-z0-9~]*)?)*".
+The files are compared by their prefixes and versions (leading
+zeros are ignored in version numbers, see example below).
+If an input string does not match the pattern, then it is compared
+using the byte compare function.
+All string comparisons are performed in C locale, the locale
+environment setting is ignored.
+.Bl -tag -width indent
+.It Example:
+.It $ ls sort* | sort -V
+.It sort-1.022.tgz
+.It sort-1.23.tgz
+.It sort-1.23.1.tgz
+.It sort-1.024.tgz
+.It sort-1.024.003.
+.It sort-1.024.003.tgz
+.It sort-1.024.07.tgz
+.It sort-1.024.009.tgz
+.El
+.El
+.Pp
+The treatment of field separators can be altered using these options:
+.Bl -tag -width indent
+.It Fl b , Fl Fl ignore-leading-blanks
+Ignore leading blank space when determining the start
+and end of a restricted sort key (see
+.Fl k ) .
+If
+.Fl b
+is specified before the first
+.Fl k
+option, it applies globally to all key specifications.
+Otherwise,
+.Fl b
+can be attached independently to each
+.Ar field
+argument of the key specifications.
+.Fl b .
+.It Xo
+.Fl k Ar field1 Ns Op , Ns Ar field2 ,
+.Fl Fl key Ns = Ns Ar field1 Ns Op , Ns Ar field2
+.Xc
+Define a restricted sort key that has the starting position
+.Ar field1 ,
+and optional ending position
+.Ar field2
+of a key field.
+The
+.Fl k
+option may be specified multiple times,
+in which case subsequent keys are compared when earlier keys compare equal.
+The
+.Fl k
+option replaces the obsolete options
+.Cm \(pl Ns Ar pos1
+and
+.Fl Ns Ar pos2 ,
+but the old notation is also supported.
+.It Fl t Ar char , Fl Fl field-separator Ns = Ns Ar char
+Use
+.Ar char
+as a field separator character.
+The initial
+.Ar char
+is not considered to be part of a field when determining key offsets.
+Each occurrence of
+.Ar char
+is significant (for example,
+.Dq Ar charchar
+delimits an empty field).
+If
+.Fl t
+is not specified, the default field separator is a sequence of
+blank space characters, and consecutive blank spaces do
+.Em not
+delimit an empty field, however, the initial blank space
+.Em is
+considered part of a field when determining key offsets.
+To use NUL as field separator, use
+.Fl t
+\'\\0\'.
+.It Fl z , Fl Fl zero-terminated
+Use NUL as record separator.
+By default, records in the files are supposed to be separated by
+the newline characters.
+With this option, NUL (\'\\0\') is used as a record separator character.
+.El
+.Pp
+Other options:
+.Bl -tag -width indent
+.It Fl Fl batch-size Ns = Ns Ar num
+Specify maximum number of files that can be opened by
+.Nm
+at once.
+This option affects behavior when having many input files or using
+temporary files.
+The default value is 16.
+.It Fl Fl compress-program Ns = Ns Ar PROGRAM
+Use PROGRAM to compress temporary files.
+PROGRAM must compress standard input to standard output, when called
+without arguments.
+When called with argument
+.Fl d
+it must decompress standard input to standard output.
+If PROGRAM fails,
+.Nm
+must exit with error.
+An example of PROGRAM that can be used here is bzip2.
+.It Fl Fl random-source Ns = Ns Ar filename
+In random sort, the file content is used as the source of the 'seed' data
+for the hash function choice.
+Two invocations of random sort with the same seed data will use
+the same hash function and will produce the same result if the input is
+also identical.
+By default, file
+.Cm /dev/random
+is used.
+.It Fl Fl debug
+Print some extra information about the sorting process to the
+standard output.
+%%THREADS%%.It Fl Fl parallel
+%%THREADS%%Set the maximum number of execution threads.
+%%THREADS%%Default number equals to the number of CPUs.
+.It Fl Fl files0-from Ns = Ns Ar filename
+Take the input file list from the file
+.Ar filename .
+The file names must be separated by NUL
+(like the output produced by the command "find ... -print0").
+.It Fl Fl radixsort
+Try to use radix sort, if the sort specifications allow.
+The radix sort can only be used for trivial locales (C and POSIX),
+and it cannot be used for numeric or month sort.
+Radix sort is very fast and stable.
+.It Fl Fl mergesort
+Use mergesort.
+This is a universal algorithm that can always be used,
+but it is not always the fastest.
+.It Fl Fl qsort
+Try to use quick sort, if the sort specifications allow.
+This sort algorithm cannot be used with
+.Fl u
+and
+.Fl s .
+.It Fl Fl heapsort
+Try to use heap sort, if the sort specifications allow.
+This sort algorithm cannot be used with
+.Fl u
+and
+.Fl s .
+.It Fl Fl mmap
+Try to use file memory mapping system call.
+It may increase speed in some cases.
+.El
+.Pp
+The following operands are available:
+.Bl -tag -width indent
+.It Ar file
+The pathname of a file to be sorted, merged, or checked.
+If no
+.Ar file
+operands are specified, or if a
+.Ar file
+operand is
+.Fl ,
+the standard input is used.
+.El
+.Pp
+A field is defined as a maximal sequence of characters other than the
+field separator and record separator (newline by default).
+Initial blank spaces are included in the field unless
+.Fl b
+has been specified;
+the first blank space of a sequence of blank spaces acts as the field
+separator and is included in the field (unless
+.Fl t
+is specified).
+For example, all blank spaces at the beginning of a line are
+considered to be part of the first field.
+.Pp
+Fields are specified by the
+.Sm off
+.Fl k\ \& Ar field1 Op , Ar field2
+.Sm on
+command-line option.
+If
+.Ar field2
+is missing, the end of the key defaults to the end of the line.
+.Pp
+The arguments
+.Ar field1
+and
+.Ar field2
+have the form
+.Em m.n
+.Em (m,n > 0)
+and can be followed by one or more of the modifiers
+.Cm b , d , f , i ,
+.Cm n , g , M
+and
+.Cm r ,
+which correspond to the options discussed above.
+When
+.Cm b
+is specified it applies only to
+.Ar field1
+or
+.Ar field2
+where it is specified while the rest of the modifiers
+apply to the whole key field regardless if they are
+specified only with
+.Ar field1
+or
+.Ar field2
+or both.
+A
+.Ar field1
+position specified by
+.Em m.n
+is interpreted as the
+.Em n Ns th
+character from the beginning of the
+.Em m Ns th
+field.
+A missing
+.Em \&.n
+in
+.Ar field1
+means
+.Ql \&.1 ,
+indicating the first character of the
+.Em m Ns th
+field; if the
+.Fl b
+option is in effect,
+.Em n
+is counted from the first non-blank character in the
+.Em m Ns th
+field;
+.Em m Ns \&.1b
+refers to the first non-blank character in the
+.Em m Ns th
+field.
+.No 1\&. Ns Em n
+refers to the
+.Em n Ns th
+character from the beginning of the line;
+if
+.Em n
+is greater than the length of the line, the field is taken to be empty.
+.Pp
+.Em n Ns th
+positions are always counted from the field beginning, even if the field
+is shorter than the number of specified positions.
+Thus, the key can really start from a position in a subsequent field.
+.Pp
+A
+.Ar field2
+position specified by
+.Em m.n
+is interpreted as the
+.Em n Ns th
+character (including separators) from the beginning of the
+.Em m Ns th
+field.
+A missing
+.Em \&.n
+indicates the last character of the
+.Em m Ns th
+field;
+.Em m
+= \&0
+designates the end of a line.
+Thus the option
+.Fl k Ar v.x,w.y
+is synonymous with the obsolete option
+.Cm \(pl Ns Ar v-\&1.x-\&1
+.Fl Ns Ar w-\&1.y ;
+when
+.Em y
+is omitted,
+.Fl k Ar v.x,w
+is synonymous with
+.Cm \(pl Ns Ar v-\&1.x-\&1
+.Fl Ns Ar w\&.0 .
+The obsolete
+.Cm \(pl Ns Ar pos1
+.Fl Ns Ar pos2
+option is still supported, except for
+.Fl Ns Ar w\&.0b ,
+which has no
+.Fl k
+equivalent.
+.Sh ENVIRONMENT
+.Bl -tag -width Fl
+.It Ev LC_COLLATE
+Locale settings to be used to determine the collation for
+sorting records.
+.It Ev LC_CTYPE
+Locale settings to be used to case conversion and classification
+of characters, that is, which characters are considered
+whitespaces, etc.
+.It Ev LC_MESSAGES
+Locale settings that determine the language of output messages
+that
+.Nm
+prints out.
+.It Ev LC_NUMERIC
+Locale settings that determine the number format used in numeric sort.
+.It Ev LC_TIME
+Locale settings that determine the month format used in month sort.
+.It Ev LC_ALL
+Locale settings that override all of the above locale settings.
+This environment variable can be used to set all these settings
+to the same value at once.
+.It Ev LANG
+Used as a last resort to determine different kinds of locale-specific
+behavior if neither the respective environment variable, nor
+.Ev LC_ALL
+are set.
+%%NLS%%.It Ev NLSPATH
+%%NLS%%Path to NLS catalogs.
+.It Ev TMPDIR
+Path to the directory in which temporary files will be stored.
+Note that
+.Ev TMPDIR
+may be overridden by the
+.Fl T
+option.
+.It Ev GNUSORT_NUMERIC_COMPATIBILITY
+If defined
+.Fl t
+will not override the locale numeric symbols, that is, thousand
+separators and decimal separators.
+By default, if we specify
+.Fl t
+with the same symbol as the thousand separator or decimal point,
+the symbol will be treated as the field separator.
+Older behavior was less definite; the symbol was treated as both field
+separator and numeric separator, simultaneously.
+This environment variable enables the old behavior.
+.El
+.Sh FILES
+.Bl -tag -width Pa -compact
+.It Pa /var/tmp/.bsdsort.PID.*
+Temporary files.
+.It Pa /dev/random
+Default seed file for the random sort.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility shall exit with one of the following values:
+.Pp
+.Bl -tag -width flag -compact
+.It 0
+Successfully sorted the input files or if used with
+.Fl c
+or
+.Fl C ,
+the input file already met the sorting criteria.
+.It 1
+On disorder (or non-uniqueness) with the
+.Fl c
+or
+.Fl C
+options.
+.It 2
+An error occurred.
+.El
+.Sh SEE ALSO
+.Xr comm 1 ,
+.Xr join 1 ,
+.Xr uniq 1
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The flags
+.Op Fl ghRMSsTVz
+are extensions to the POSIX specification.
+.Pp
+All long options are extensions to the specification, some of them are
+provided for compatibility with GNU versions and some of them are
+own extensions.
+.Pp
+The old key notations
+.Cm \(pl Ns Ar pos1
+and
+.Fl Ns Ar pos2
+come from older versions of
+.Nm
+and are still supported but their use is highly discouraged.
+.Sh HISTORY
+A
+.Nm
+command first appeared in
+.At v3 .
+.Sh AUTHORS
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org ,
+.Pp
+.An Oleg Moskalenko Aq Mt mom040267@gmail.com
+.Sh NOTES
+This implementation of
+.Nm
+has no limits on input line length (other than imposed by available
+memory) or any restrictions on bytes allowed within lines.
+.Pp
+The performance depends highly on locale settings,
+efficient choice of sort keys and key complexity.
+The fastest sort is with locale C, on whole lines,
+with option
+.Fl s .
+In general, locale C is the fastest, then single-byte
+locales follow and multi-byte locales as the slowest but
+the correct collation order is always respected.
+As for the key specification, the simpler to process the
+lines the faster the search will be.
+.Pp
+When sorting by arithmetic value, using
+.Fl n
+results in much better performance than
+.Fl g
+so its use is encouraged
+whenever possible.
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
new file mode 100644
index 0000000..17f316b
--- /dev/null
+++ b/usr.bin/sort/sort.c
@@ -0,0 +1,1321 @@
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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/stat.h>
+#include <sys/sysctl.h>
+#include <sys/types.h>
+
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <limits.h>
+#include <locale.h>
+#include <md5.h>
+#include <regex.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "coll.h"
+#include "file.h"
+#include "sort.h"
+
+#ifndef WITHOUT_NLS
+#include <nl_types.h>
+nl_catd catalog;
+#endif
+
+#define OPTIONS "bcCdfghik:Mmno:RrsS:t:T:uVz"
+
+#define DEFAULT_RANDOM_SORT_SEED_FILE ("/dev/random")
+#define MAX_DEFAULT_RANDOM_SEED_DATA_SIZE (1024)
+
+static bool need_random;
+static const char *random_source = DEFAULT_RANDOM_SORT_SEED_FILE;
+static const void *random_seed;
+static size_t random_seed_size;
+
+MD5_CTX md5_ctx;
+
+/*
+ * Default messages to use when NLS is disabled or no catalogue
+ * is found.
+ */
+const char *nlsstr[] = { "",
+/* 1*/"mutually exclusive flags",
+/* 2*/"extra argument not allowed with -c",
+/* 3*/"Unknown feature",
+/* 4*/"Wrong memory buffer specification",
+/* 5*/"0 field in key specs",
+/* 6*/"0 column in key specs",
+/* 7*/"Wrong file mode",
+/* 8*/"Cannot open file for reading",
+/* 9*/"Radix sort cannot be used with these sort options",
+/*10*/"The chosen sort method cannot be used with stable and/or unique sort",
+/*11*/"Invalid key position",
+/*12*/"Usage: %s [-bcCdfigMmnrsuz] [-kPOS1[,POS2] ... ] "
+ "[+POS1 [-POS2]] [-S memsize] [-T tmpdir] [-t separator] "
+ "[-o outfile] [--batch-size size] [--files0-from file] "
+ "[--heapsort] [--mergesort] [--radixsort] [--qsort] "
+ "[--mmap] "
+#if defined(SORT_THREADS)
+ "[--parallel thread_no] "
+#endif
+ "[--human-numeric-sort] "
+ "[--version-sort] [--random-sort [--random-source file]] "
+ "[--compress-program program] [file ...]\n" };
+
+struct sort_opts sort_opts_vals;
+
+bool debug_sort;
+bool need_hint;
+
+#if defined(SORT_THREADS)
+unsigned int ncpu = 1;
+size_t nthreads = 1;
+#endif
+
+static bool gnusort_numeric_compatibility;
+
+static struct sort_mods default_sort_mods_object;
+struct sort_mods * const default_sort_mods = &default_sort_mods_object;
+
+static bool print_symbols_on_debug;
+
+/*
+ * Arguments from file (when file0-from option is used:
+ */
+static size_t argc_from_file0 = (size_t)-1;
+static char **argv_from_file0;
+
+/*
+ * Placeholder symbols for options which have no single-character equivalent
+ */
+enum
+{
+ SORT_OPT = CHAR_MAX + 1,
+ HELP_OPT,
+ FF_OPT,
+ BS_OPT,
+ VERSION_OPT,
+ DEBUG_OPT,
+#if defined(SORT_THREADS)
+ PARALLEL_OPT,
+#endif
+ RANDOMSOURCE_OPT,
+ COMPRESSPROGRAM_OPT,
+ QSORT_OPT,
+ MERGESORT_OPT,
+ HEAPSORT_OPT,
+ RADIXSORT_OPT,
+ MMAP_OPT
+};
+
+#define NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS 6
+static const char mutually_exclusive_flags[NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS] = { 'M', 'n', 'g', 'R', 'h', 'V' };
+
+static struct option long_options[] = {
+ { "batch-size", required_argument, NULL, BS_OPT },
+ { "buffer-size", required_argument, NULL, 'S' },
+ { "check", optional_argument, NULL, 'c' },
+ { "check=silent|quiet", optional_argument, NULL, 'C' },
+ { "compress-program", required_argument, NULL, COMPRESSPROGRAM_OPT },
+ { "debug", no_argument, NULL, DEBUG_OPT },
+ { "dictionary-order", no_argument, NULL, 'd' },
+ { "field-separator", required_argument, NULL, 't' },
+ { "files0-from", required_argument, NULL, FF_OPT },
+ { "general-numeric-sort", no_argument, NULL, 'g' },
+ { "heapsort", no_argument, NULL, HEAPSORT_OPT },
+ { "help",no_argument, NULL, HELP_OPT },
+ { "human-numeric-sort", no_argument, NULL, 'h' },
+ { "ignore-leading-blanks", no_argument, NULL, 'b' },
+ { "ignore-case", no_argument, NULL, 'f' },
+ { "ignore-nonprinting", no_argument, NULL, 'i' },
+ { "key", required_argument, NULL, 'k' },
+ { "merge", no_argument, NULL, 'm' },
+ { "mergesort", no_argument, NULL, MERGESORT_OPT },
+ { "mmap", no_argument, NULL, MMAP_OPT },
+ { "month-sort", no_argument, NULL, 'M' },
+ { "numeric-sort", no_argument, NULL, 'n' },
+ { "output", required_argument, NULL, 'o' },
+#if defined(SORT_THREADS)
+ { "parallel", required_argument, NULL, PARALLEL_OPT },
+#endif
+ { "qsort", no_argument, NULL, QSORT_OPT },
+ { "radixsort", no_argument, NULL, RADIXSORT_OPT },
+ { "random-sort", no_argument, NULL, 'R' },
+ { "random-source", required_argument, NULL, RANDOMSOURCE_OPT },
+ { "reverse", no_argument, NULL, 'r' },
+ { "sort", required_argument, NULL, SORT_OPT },
+ { "stable", no_argument, NULL, 's' },
+ { "temporary-directory",required_argument, NULL, 'T' },
+ { "unique", no_argument, NULL, 'u' },
+ { "version", no_argument, NULL, VERSION_OPT },
+ { "version-sort",no_argument, NULL, 'V' },
+ { "zero-terminated", no_argument, NULL, 'z' },
+ { NULL, no_argument, NULL, 0 }
+};
+
+void fix_obsolete_keys(int *argc, char **argv);
+
+/*
+ * Check where sort modifier is present
+ */
+static bool
+sort_modifier_empty(struct sort_mods *sm)
+{
+
+ if (sm == NULL)
+ return (true);
+ return (!(sm->Mflag || sm->Vflag || sm->nflag || sm->gflag ||
+ sm->rflag || sm->Rflag || sm->hflag || sm->dflag || sm->fflag));
+}
+
+/*
+ * Print out usage text.
+ */
+static void
+usage(bool opt_err)
+{
+ struct option *o;
+ FILE *out;
+
+ out = stdout;
+ o = &(long_options[0]);
+
+ if (opt_err)
+ out = stderr;
+ fprintf(out, getstr(12), getprogname());
+ if (opt_err)
+ exit(2);
+ exit(0);
+}
+
+/*
+ * Read input file names from a file (file0-from option).
+ */
+static void
+read_fns_from_file0(const char *fn)
+{
+ FILE *f;
+ char *line = NULL;
+ size_t linesize = 0;
+ ssize_t linelen;
+
+ if (fn == NULL)
+ return;
+
+ f = fopen(fn, "r");
+ if (f == NULL)
+ err(2, "%s", fn);
+
+ while ((linelen = getdelim(&line, &linesize, '\0', f)) != -1) {
+ if (*line != '\0') {
+ if (argc_from_file0 == (size_t) - 1)
+ argc_from_file0 = 0;
+ ++argc_from_file0;
+ argv_from_file0 = sort_realloc(argv_from_file0,
+ argc_from_file0 * sizeof(char *));
+ if (argv_from_file0 == NULL)
+ err(2, NULL);
+ argv_from_file0[argc_from_file0 - 1] = line;
+ } else {
+ free(line);
+ }
+ line = NULL;
+ linesize = 0;
+ }
+ if (ferror(f))
+ err(2, "%s: getdelim", fn);
+
+ closefile(f, fn);
+}
+
+/*
+ * Check how much RAM is available for the sort.
+ */
+static void
+set_hw_params(void)
+{
+ long pages, psize;
+
+ pages = psize = 0;
+
+#if defined(SORT_THREADS)
+ ncpu = 1;
+#endif
+
+ pages = sysconf(_SC_PHYS_PAGES);
+ if (pages < 1) {
+ perror("sysconf pages");
+ psize = 1;
+ }
+ psize = sysconf(_SC_PAGESIZE);
+ if (psize < 1) {
+ perror("sysconf psize");
+ psize = 4096;
+ }
+#if defined(SORT_THREADS)
+ ncpu = (unsigned int)sysconf(_SC_NPROCESSORS_ONLN);
+ if (ncpu < 1)
+ ncpu = 1;
+ else if(ncpu > 32)
+ ncpu = 32;
+
+ nthreads = ncpu;
+#endif
+
+ free_memory = (unsigned long long) pages * (unsigned long long) psize;
+ available_free_memory = free_memory / 2;
+
+ if (available_free_memory < 1024)
+ available_free_memory = 1024;
+}
+
+/*
+ * Convert "plain" symbol to wide symbol, with default value.
+ */
+static void
+conv_mbtowc(wchar_t *wc, const char *c, const wchar_t def)
+{
+
+ if (wc && c) {
+ int res;
+
+ res = mbtowc(wc, c, MB_CUR_MAX);
+ if (res < 1)
+ *wc = def;
+ }
+}
+
+/*
+ * Set current locale symbols.
+ */
+static void
+set_locale(void)
+{
+ struct lconv *lc;
+ const char *locale;
+
+ setlocale(LC_ALL, "");
+
+ lc = localeconv();
+
+ if (lc) {
+ /* obtain LC_NUMERIC info */
+ /* Convert to wide char form */
+ conv_mbtowc(&symbol_decimal_point, lc->decimal_point,
+ symbol_decimal_point);
+ conv_mbtowc(&symbol_thousands_sep, lc->thousands_sep,
+ symbol_thousands_sep);
+ conv_mbtowc(&symbol_positive_sign, lc->positive_sign,
+ symbol_positive_sign);
+ conv_mbtowc(&symbol_negative_sign, lc->negative_sign,
+ symbol_negative_sign);
+ }
+
+ if (getenv("GNUSORT_NUMERIC_COMPATIBILITY"))
+ gnusort_numeric_compatibility = true;
+
+ locale = setlocale(LC_COLLATE, NULL);
+
+ if (locale) {
+ char *tmpl;
+ const char *cclocale;
+
+ tmpl = sort_strdup(locale);
+ cclocale = setlocale(LC_COLLATE, "C");
+ if (cclocale && !strcmp(cclocale, tmpl))
+ byte_sort = true;
+ else {
+ const char *pclocale;
+
+ pclocale = setlocale(LC_COLLATE, "POSIX");
+ if (pclocale && !strcmp(pclocale, tmpl))
+ byte_sort = true;
+ }
+ setlocale(LC_COLLATE, tmpl);
+ sort_free(tmpl);
+ }
+}
+
+/*
+ * Set directory temporary files.
+ */
+static void
+set_tmpdir(void)
+{
+ char *td;
+
+ td = getenv("TMPDIR");
+ if (td != NULL)
+ tmpdir = sort_strdup(td);
+}
+
+/*
+ * Parse -S option.
+ */
+static unsigned long long
+parse_memory_buffer_value(const char *value)
+{
+
+ if (value == NULL)
+ return (available_free_memory);
+ else {
+ char *endptr;
+ unsigned long long membuf;
+
+ endptr = NULL;
+ errno = 0;
+ membuf = strtoll(value, &endptr, 10);
+
+ if (errno != 0) {
+ warn("%s",getstr(4));
+ membuf = available_free_memory;
+ } else {
+ switch (*endptr){
+ case 'Y':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'Z':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'E':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'P':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'T':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'G':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'M':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case '\0':
+ case 'K':
+ membuf *= 1024;
+ /* FALLTHROUGH */
+ case 'b':
+ break;
+ case '%':
+ membuf = (available_free_memory * membuf) /
+ 100;
+ break;
+ default:
+ warnc(EINVAL, "%s", optarg);
+ membuf = available_free_memory;
+ }
+ }
+ return (membuf);
+ }
+}
+
+/*
+ * Signal handler that clears the temporary files.
+ */
+static void
+sig_handler(int sig __unused, siginfo_t *siginfo __unused,
+ void *context __unused)
+{
+
+ clear_tmp_files();
+ exit(-1);
+}
+
+/*
+ * Set signal handler on panic signals.
+ */
+static void
+set_signal_handler(void)
+{
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_sigaction = &sig_handler;
+ sa.sa_flags = SA_SIGINFO;
+
+ if (sigaction(SIGTERM, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGHUP, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGINT, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGQUIT, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGABRT, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGSEGV, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGUSR1, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+ if (sigaction(SIGUSR2, &sa, NULL) < 0) {
+ perror("sigaction");
+ return;
+ }
+}
+
+/*
+ * Print "unknown" message and exit with status 2.
+ */
+static void
+unknown(const char *what)
+{
+
+ errx(2, "%s: %s", getstr(3), what);
+}
+
+/*
+ * Check whether contradictory input options are used.
+ */
+static void
+check_mutually_exclusive_flags(char c, bool *mef_flags)
+{
+ int fo_index, mec;
+ bool found_others, found_this;
+
+ found_others = found_this = false;
+ fo_index = 0;
+
+ for (int i = 0; i < NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS; i++) {
+ mec = mutually_exclusive_flags[i];
+
+ if (mec != c) {
+ if (mef_flags[i]) {
+ if (found_this)
+ errx(1, "%c:%c: %s", c, mec, getstr(1));
+ found_others = true;
+ fo_index = i;
+ }
+ } else {
+ if (found_others)
+ errx(1, "%c:%c: %s", c, mutually_exclusive_flags[fo_index], getstr(1));
+ mef_flags[i] = true;
+ found_this = true;
+ }
+ }
+}
+
+/*
+ * Initialise sort opts data.
+ */
+static void
+set_sort_opts(void)
+{
+
+ memset(&default_sort_mods_object, 0,
+ sizeof(default_sort_mods_object));
+ memset(&sort_opts_vals, 0, sizeof(sort_opts_vals));
+ default_sort_mods_object.func =
+ get_sort_func(&default_sort_mods_object);
+}
+
+/*
+ * Set a sort modifier on a sort modifiers object.
+ */
+static bool
+set_sort_modifier(struct sort_mods *sm, int c)
+{
+
+ if (sm) {
+ switch (c){
+ case 'b':
+ sm->bflag = true;
+ break;
+ case 'd':
+ sm->dflag = true;
+ break;
+ case 'f':
+ sm->fflag = true;
+ break;
+ case 'g':
+ sm->gflag = true;
+ need_hint = true;
+ break;
+ case 'i':
+ sm->iflag = true;
+ break;
+ case 'R':
+ sm->Rflag = true;
+ need_random = true;
+ break;
+ case 'M':
+ initialise_months();
+ sm->Mflag = true;
+ need_hint = true;
+ break;
+ case 'n':
+ sm->nflag = true;
+ need_hint = true;
+ print_symbols_on_debug = true;
+ break;
+ case 'r':
+ sm->rflag = true;
+ break;
+ case 'V':
+ sm->Vflag = true;
+ break;
+ case 'h':
+ sm->hflag = true;
+ need_hint = true;
+ print_symbols_on_debug = true;
+ break;
+ default:
+ return false;
+ }
+ sort_opts_vals.complex_sort = true;
+ sm->func = get_sort_func(sm);
+ }
+ return (true);
+}
+
+/*
+ * Parse POS in -k option.
+ */
+static int
+parse_pos(const char *s, struct key_specs *ks, bool *mef_flags, bool second)
+{
+ regmatch_t pmatch[4];
+ regex_t re;
+ char *c, *f;
+ const char *sregexp = "^([0-9]+)(\\.[0-9]+)?([bdfirMngRhV]+)?$";
+ size_t len, nmatch;
+ int ret;
+
+ ret = -1;
+ nmatch = 4;
+ c = f = NULL;
+
+ if (regcomp(&re, sregexp, REG_EXTENDED) != 0)
+ return (-1);
+
+ if (regexec(&re, s, nmatch, pmatch, 0) != 0)
+ goto end;
+
+ if (pmatch[0].rm_eo <= pmatch[0].rm_so)
+ goto end;
+
+ if (pmatch[1].rm_eo <= pmatch[1].rm_so)
+ goto end;
+
+ len = pmatch[1].rm_eo - pmatch[1].rm_so;
+ f = sort_malloc((len + 1) * sizeof(char));
+
+ strncpy(f, s + pmatch[1].rm_so, len);
+ f[len] = '\0';
+
+ if (second) {
+ errno = 0;
+ ks->f2 = (size_t) strtoul(f, NULL, 10);
+ if (errno != 0)
+ err(2, "-k");
+ if (ks->f2 == 0) {
+ warn("%s",getstr(5));
+ goto end;
+ }
+ } else {
+ errno = 0;
+ ks->f1 = (size_t) strtoul(f, NULL, 10);
+ if (errno != 0)
+ err(2, "-k");
+ if (ks->f1 == 0) {
+ warn("%s",getstr(5));
+ goto end;
+ }
+ }
+
+ if (pmatch[2].rm_eo > pmatch[2].rm_so) {
+ len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;
+ c = sort_malloc((len + 1) * sizeof(char));
+
+ strncpy(c, s + pmatch[2].rm_so + 1, len);
+ c[len] = '\0';
+
+ if (second) {
+ errno = 0;
+ ks->c2 = (size_t) strtoul(c, NULL, 10);
+ if (errno != 0)
+ err(2, "-k");
+ } else {
+ errno = 0;
+ ks->c1 = (size_t) strtoul(c, NULL, 10);
+ if (errno != 0)
+ err(2, "-k");
+ if (ks->c1 == 0) {
+ warn("%s",getstr(6));
+ goto end;
+ }
+ }
+ } else {
+ if (second)
+ ks->c2 = 0;
+ else
+ ks->c1 = 1;
+ }
+
+ if (pmatch[3].rm_eo > pmatch[3].rm_so) {
+ regoff_t i = 0;
+
+ for (i = pmatch[3].rm_so; i < pmatch[3].rm_eo; i++) {
+ check_mutually_exclusive_flags(s[i], mef_flags);
+ if (s[i] == 'b') {
+ if (second)
+ ks->pos2b = true;
+ else
+ ks->pos1b = true;
+ } else if (!set_sort_modifier(&(ks->sm), s[i]))
+ goto end;
+ }
+ }
+
+ ret = 0;
+
+end:
+
+ if (c)
+ sort_free(c);
+ if (f)
+ sort_free(f);
+ regfree(&re);
+
+ return (ret);
+}
+
+/*
+ * Parse -k option value.
+ */
+static int
+parse_k(const char *s, struct key_specs *ks)
+{
+ int ret = -1;
+ bool mef_flags[NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS] =
+ { false, false, false, false, false, false };
+
+ if (s && *s) {
+ char *sptr;
+
+ sptr = strchr(s, ',');
+ if (sptr) {
+ size_t size1;
+ char *pos1, *pos2;
+
+ size1 = sptr - s;
+
+ if (size1 < 1)
+ return (-1);
+ pos1 = sort_malloc((size1 + 1) * sizeof(char));
+
+ strncpy(pos1, s, size1);
+ pos1[size1] = '\0';
+
+ ret = parse_pos(pos1, ks, mef_flags, false);
+
+ sort_free(pos1);
+ if (ret < 0)
+ return (ret);
+
+ pos2 = sort_strdup(sptr + 1);
+ ret = parse_pos(pos2, ks, mef_flags, true);
+ sort_free(pos2);
+ } else
+ ret = parse_pos(s, ks, mef_flags, false);
+ }
+
+ return (ret);
+}
+
+/*
+ * Parse POS in +POS -POS option.
+ */
+static int
+parse_pos_obs(const char *s, int *nf, int *nc, char* sopts)
+{
+ regex_t re;
+ regmatch_t pmatch[4];
+ char *c, *f;
+ const char *sregexp = "^([0-9]+)(\\.[0-9]+)?([A-Za-z]+)?$";
+ int ret;
+ size_t len, nmatch;
+
+ ret = -1;
+ nmatch = 4;
+ c = f = NULL;
+ *nc = *nf = 0;
+
+ if (regcomp(&re, sregexp, REG_EXTENDED) != 0)
+ return (-1);
+
+ if (regexec(&re, s, nmatch, pmatch, 0) != 0)
+ goto end;
+
+ if (pmatch[0].rm_eo <= pmatch[0].rm_so)
+ goto end;
+
+ if (pmatch[1].rm_eo <= pmatch[1].rm_so)
+ goto end;
+
+ len = pmatch[1].rm_eo - pmatch[1].rm_so;
+ f = sort_malloc((len + 1) * sizeof(char));
+
+ strncpy(f, s + pmatch[1].rm_so, len);
+ f[len] = '\0';
+
+ errno = 0;
+ *nf = (size_t) strtoul(f, NULL, 10);
+ if (errno != 0)
+ errx(2, "%s", getstr(11));
+
+ if (pmatch[2].rm_eo > pmatch[2].rm_so) {
+ len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;
+ c = sort_malloc((len + 1) * sizeof(char));
+
+ strncpy(c, s + pmatch[2].rm_so + 1, len);
+ c[len] = '\0';
+
+ errno = 0;
+ *nc = (size_t) strtoul(c, NULL, 10);
+ if (errno != 0)
+ errx(2, "%s", getstr(11));
+ }
+
+ if (pmatch[3].rm_eo > pmatch[3].rm_so) {
+
+ len = pmatch[3].rm_eo - pmatch[3].rm_so;
+
+ strncpy(sopts, s + pmatch[3].rm_so, len);
+ sopts[len] = '\0';
+ }
+
+ ret = 0;
+
+end:
+ if (c)
+ sort_free(c);
+ if (f)
+ sort_free(f);
+ regfree(&re);
+
+ return (ret);
+}
+
+/*
+ * "Translate" obsolete +POS1 -POS2 syntax into new -kPOS1,POS2 syntax
+ */
+void
+fix_obsolete_keys(int *argc, char **argv)
+{
+ char sopt[129];
+
+ for (int i = 1; i < *argc; i++) {
+ char *arg1;
+
+ arg1 = argv[i];
+
+ if (strlen(arg1) > 1 && arg1[0] == '+') {
+ int c1, f1;
+ char sopts1[128];
+
+ sopts1[0] = 0;
+ c1 = f1 = 0;
+
+ if (parse_pos_obs(arg1 + 1, &f1, &c1, sopts1) < 0)
+ continue;
+ else {
+ f1 += 1;
+ c1 += 1;
+ if (i + 1 < *argc) {
+ char *arg2 = argv[i + 1];
+
+ if (strlen(arg2) > 1 &&
+ arg2[0] == '-') {
+ int c2, f2;
+ char sopts2[128];
+
+ sopts2[0] = 0;
+ c2 = f2 = 0;
+
+ if (parse_pos_obs(arg2 + 1,
+ &f2, &c2, sopts2) >= 0) {
+ if (c2 > 0)
+ f2 += 1;
+ sprintf(sopt, "-k%d.%d%s,%d.%d%s",
+ f1, c1, sopts1, f2, c2, sopts2);
+ argv[i] = sort_strdup(sopt);
+ for (int j = i + 1; j + 1 < *argc; j++)
+ argv[j] = argv[j + 1];
+ *argc -= 1;
+ continue;
+ }
+ }
+ }
+ sprintf(sopt, "-k%d.%d%s", f1, c1, sopts1);
+ argv[i] = sort_strdup(sopt);
+ }
+ }
+ }
+}
+
+/*
+ * Set random seed
+ */
+static void
+set_random_seed(void)
+{
+ if (need_random) {
+
+ if (strcmp(random_source, DEFAULT_RANDOM_SORT_SEED_FILE) == 0) {
+ FILE* fseed;
+ MD5_CTX ctx;
+ char rsd[MAX_DEFAULT_RANDOM_SEED_DATA_SIZE];
+ size_t sz = 0;
+
+ fseed = openfile(random_source, "r");
+ while (!feof(fseed)) {
+ int cr;
+
+ cr = fgetc(fseed);
+ if (cr == EOF)
+ break;
+
+ rsd[sz++] = (char) cr;
+
+ if (sz >= MAX_DEFAULT_RANDOM_SEED_DATA_SIZE)
+ break;
+ }
+
+ closefile(fseed, random_source);
+
+ MD5Init(&ctx);
+ MD5Update(&ctx, rsd, sz);
+
+ random_seed = MD5End(&ctx, NULL);
+ random_seed_size = strlen(random_seed);
+
+ } else {
+ MD5_CTX ctx;
+ char *b;
+
+ MD5Init(&ctx);
+ b = MD5File(random_source, NULL);
+ if (b == NULL)
+ err(2, NULL);
+
+ random_seed = b;
+ random_seed_size = strlen(b);
+ }
+
+ MD5Init(&md5_ctx);
+ if(random_seed_size>0) {
+ MD5Update(&md5_ctx, random_seed, random_seed_size);
+ }
+ }
+}
+
+/*
+ * Main function.
+ */
+int
+main(int argc, char **argv)
+{
+ char *outfile, *real_outfile;
+ int c, result;
+ bool mef_flags[NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS] =
+ { false, false, false, false, false, false };
+
+ result = 0;
+ outfile = sort_strdup("-");
+ real_outfile = NULL;
+
+ struct sort_mods *sm = &default_sort_mods_object;
+
+ init_tmp_files();
+
+ set_signal_handler();
+
+ set_hw_params();
+ set_locale();
+ set_tmpdir();
+ set_sort_opts();
+
+ fix_obsolete_keys(&argc, argv);
+
+ while (((c = getopt_long(argc, argv, OPTIONS, long_options, NULL))
+ != -1)) {
+
+ check_mutually_exclusive_flags(c, mef_flags);
+
+ if (!set_sort_modifier(sm, c)) {
+
+ switch (c) {
+ case 'c':
+ sort_opts_vals.cflag = true;
+ if (optarg) {
+ if (!strcmp(optarg, "diagnose-first"))
+ ;
+ else if (!strcmp(optarg, "silent") ||
+ !strcmp(optarg, "quiet"))
+ sort_opts_vals.csilentflag = true;
+ else if (*optarg)
+ unknown(optarg);
+ }
+ break;
+ case 'C':
+ sort_opts_vals.cflag = true;
+ sort_opts_vals.csilentflag = true;
+ break;
+ case 'k':
+ {
+ sort_opts_vals.complex_sort = true;
+ sort_opts_vals.kflag = true;
+
+ keys_num++;
+ keys = sort_realloc(keys, keys_num *
+ sizeof(struct key_specs));
+ memset(&(keys[keys_num - 1]), 0,
+ sizeof(struct key_specs));
+
+ if (parse_k(optarg, &(keys[keys_num - 1]))
+ < 0) {
+ errc(2, EINVAL, "-k %s", optarg);
+ }
+
+ break;
+ }
+ case 'm':
+ sort_opts_vals.mflag = true;
+ break;
+ case 'o':
+ outfile = sort_realloc(outfile, (strlen(optarg) + 1));
+ strcpy(outfile, optarg);
+ break;
+ case 's':
+ sort_opts_vals.sflag = true;
+ break;
+ case 'S':
+ available_free_memory =
+ parse_memory_buffer_value(optarg);
+ break;
+ case 'T':
+ tmpdir = sort_strdup(optarg);
+ break;
+ case 't':
+ while (strlen(optarg) > 1) {
+ if (optarg[0] != '\\') {
+ errc(2, EINVAL, "%s", optarg);
+ }
+ optarg += 1;
+ if (*optarg == '0') {
+ *optarg = 0;
+ break;
+ }
+ }
+ sort_opts_vals.tflag = true;
+ sort_opts_vals.field_sep = btowc(optarg[0]);
+ if (sort_opts_vals.field_sep == WEOF) {
+ errno = EINVAL;
+ err(2, NULL);
+ }
+ if (!gnusort_numeric_compatibility) {
+ if (symbol_decimal_point == sort_opts_vals.field_sep)
+ symbol_decimal_point = WEOF;
+ if (symbol_thousands_sep == sort_opts_vals.field_sep)
+ symbol_thousands_sep = WEOF;
+ if (symbol_negative_sign == sort_opts_vals.field_sep)
+ symbol_negative_sign = WEOF;
+ if (symbol_positive_sign == sort_opts_vals.field_sep)
+ symbol_positive_sign = WEOF;
+ }
+ break;
+ case 'u':
+ sort_opts_vals.uflag = true;
+ /* stable sort for the correct unique val */
+ sort_opts_vals.sflag = true;
+ break;
+ case 'z':
+ sort_opts_vals.zflag = true;
+ break;
+ case SORT_OPT:
+ if (optarg) {
+ if (!strcmp(optarg, "general-numeric"))
+ set_sort_modifier(sm, 'g');
+ else if (!strcmp(optarg, "human-numeric"))
+ set_sort_modifier(sm, 'h');
+ else if (!strcmp(optarg, "numeric"))
+ set_sort_modifier(sm, 'n');
+ else if (!strcmp(optarg, "month"))
+ set_sort_modifier(sm, 'M');
+ else if (!strcmp(optarg, "random"))
+ set_sort_modifier(sm, 'R');
+ else
+ unknown(optarg);
+ }
+ break;
+#if defined(SORT_THREADS)
+ case PARALLEL_OPT:
+ nthreads = (size_t)(atoi(optarg));
+ if (nthreads < 1)
+ nthreads = 1;
+ if (nthreads > 1024)
+ nthreads = 1024;
+ break;
+#endif
+ case QSORT_OPT:
+ sort_opts_vals.sort_method = SORT_QSORT;
+ break;
+ case MERGESORT_OPT:
+ sort_opts_vals.sort_method = SORT_MERGESORT;
+ break;
+ case MMAP_OPT:
+ use_mmap = true;
+ break;
+ case HEAPSORT_OPT:
+ sort_opts_vals.sort_method = SORT_HEAPSORT;
+ break;
+ case RADIXSORT_OPT:
+ sort_opts_vals.sort_method = SORT_RADIXSORT;
+ break;
+ case RANDOMSOURCE_OPT:
+ random_source = strdup(optarg);
+ break;
+ case COMPRESSPROGRAM_OPT:
+ compress_program = strdup(optarg);
+ break;
+ case FF_OPT:
+ read_fns_from_file0(optarg);
+ break;
+ case BS_OPT:
+ {
+ errno = 0;
+ long mof = strtol(optarg, NULL, 10);
+ if (errno != 0)
+ err(2, "--batch-size");
+ if (mof >= 2)
+ max_open_files = (size_t) mof + 1;
+ }
+ break;
+ case VERSION_OPT:
+ printf("%s\n", VERSION);
+ exit(EXIT_SUCCESS);
+ /* NOTREACHED */
+ break;
+ case DEBUG_OPT:
+ debug_sort = true;
+ break;
+ case HELP_OPT:
+ usage(false);
+ /* NOTREACHED */
+ break;
+ default:
+ usage(true);
+ /* NOTREACHED */
+ }
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argv_from_file0) {
+ argc = argc_from_file0;
+ argv = argv_from_file0;
+ }
+
+#ifndef WITHOUT_NLS
+ catalog = catopen("sort", NL_CAT_LOCALE);
+#endif
+
+ if (sort_opts_vals.cflag && sort_opts_vals.mflag)
+ errx(1, "%c:%c: %s", 'm', 'c', getstr(1));
+
+#ifndef WITHOUT_NLS
+ catclose(catalog);
+#endif
+
+ if (keys_num == 0) {
+ keys_num = 1;
+ keys = sort_realloc(keys, sizeof(struct key_specs));
+ memset(&(keys[0]), 0, sizeof(struct key_specs));
+ keys[0].c1 = 1;
+ keys[0].pos1b = default_sort_mods->bflag;
+ keys[0].pos2b = default_sort_mods->bflag;
+ memcpy(&(keys[0].sm), default_sort_mods,
+ sizeof(struct sort_mods));
+ }
+
+ for (size_t i = 0; i < keys_num; i++) {
+ struct key_specs *ks;
+
+ ks = &(keys[i]);
+
+ if (sort_modifier_empty(&(ks->sm)) && !(ks->pos1b) &&
+ !(ks->pos2b)) {
+ ks->pos1b = sm->bflag;
+ ks->pos2b = sm->bflag;
+ memcpy(&(ks->sm), sm, sizeof(struct sort_mods));
+ }
+
+ ks->sm.func = get_sort_func(&(ks->sm));
+ }
+
+ if (debug_sort) {
+ printf("Memory to be used for sorting: %llu\n",available_free_memory);
+#if defined(SORT_THREADS)
+ printf("Number of CPUs: %d\n",(int)ncpu);
+ nthreads = 1;
+#endif
+ printf("Using collate rules of %s locale\n",
+ setlocale(LC_COLLATE, NULL));
+ if (byte_sort)
+ printf("Byte sort is used\n");
+ if (print_symbols_on_debug) {
+ printf("Decimal Point: <%lc>\n", symbol_decimal_point);
+ if (symbol_thousands_sep)
+ printf("Thousands separator: <%lc>\n",
+ symbol_thousands_sep);
+ printf("Positive sign: <%lc>\n", symbol_positive_sign);
+ printf("Negative sign: <%lc>\n", symbol_negative_sign);
+ }
+ }
+
+ set_random_seed();
+
+ /* Case when the outfile equals one of the input files: */
+ if (strcmp(outfile, "-")) {
+
+ for(int i = 0; i < argc; ++i) {
+ if (strcmp(argv[i], outfile) == 0) {
+ real_outfile = sort_strdup(outfile);
+ for(;;) {
+ char* tmp = sort_malloc(strlen(outfile) +
+ strlen(".tmp") + 1);
+
+ strcpy(tmp, outfile);
+ strcpy(tmp + strlen(tmp), ".tmp");
+ sort_free(outfile);
+ outfile = tmp;
+ if (access(outfile, F_OK) < 0)
+ break;
+ }
+ tmp_file_atexit(outfile);
+ }
+ }
+ }
+
+#if defined(SORT_THREADS)
+ if ((argc < 1) || (strcmp(outfile, "-") == 0) || (*outfile == 0))
+ nthreads = 1;
+#endif
+
+ if (!sort_opts_vals.cflag && !sort_opts_vals.mflag) {
+ struct file_list fl;
+ struct sort_list list;
+
+ sort_list_init(&list);
+ file_list_init(&fl, true);
+
+ if (argc < 1)
+ procfile("-", &list, &fl);
+ else {
+ while (argc > 0) {
+ procfile(*argv, &list, &fl);
+ --argc;
+ ++argv;
+ }
+ }
+
+ if (fl.count < 1)
+ sort_list_to_file(&list, outfile);
+ else {
+ if (list.count > 0) {
+ char *flast = new_tmp_file_name();
+
+ sort_list_to_file(&list, flast);
+ file_list_add(&fl, flast, false);
+ }
+ merge_files(&fl, outfile);
+ }
+
+ file_list_clean(&fl);
+
+ /*
+ * We are about to exit the program, so we can ignore
+ * the clean-up for speed
+ *
+ * sort_list_clean(&list);
+ */
+
+ } else if (sort_opts_vals.cflag) {
+ result = (argc == 0) ? (check("-")) : (check(*argv));
+ } else if (sort_opts_vals.mflag) {
+ struct file_list fl;
+
+ file_list_init(&fl, false);
+ file_list_populate(&fl, argc, argv, true);
+ merge_files(&fl, outfile);
+ file_list_clean(&fl);
+ }
+
+ if (real_outfile) {
+ unlink(real_outfile);
+ if (rename(outfile, real_outfile) < 0)
+ err(2, NULL);
+ sort_free(real_outfile);
+ }
+
+ sort_free(outfile);
+
+ return (result);
+}
diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h
new file mode 100644
index 0000000..41dd60e
--- /dev/null
+++ b/usr.bin/sort/sort.h
@@ -0,0 +1,128 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * 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.
+ */
+
+#if !defined(__BSD_SORT_H__)
+#define __BSD_SORT_H__
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <sysexits.h>
+#include <wchar.h>
+
+#include <sys/types.h>
+#include <md5.h>
+
+#define VERSION "2.3-FreeBSD"
+
+#ifdef WITHOUT_NLS
+#define getstr(n) nlsstr[n]
+#else
+#include <nl_types.h>
+
+extern nl_catd catalog;
+#define getstr(n) catgets(catalog, 1, n, nlsstr[n])
+#endif
+
+extern const char *nlsstr[];
+
+#if defined(SORT_THREADS)
+#define MT_SORT_THRESHOLD (10000)
+extern unsigned int ncpu;
+extern size_t nthreads;
+#endif
+
+/*
+ * If true, we output some debug information.
+ */
+extern bool debug_sort;
+
+/*
+ * MD5 context for random hash function
+ */
+extern MD5_CTX md5_ctx;
+
+/*
+ * sort.c
+ */
+
+/*
+ * This structure holds main sort options which are NOT affecting the sort ordering.
+ */
+struct sort_opts
+{
+ wint_t field_sep;
+ int sort_method;
+ bool cflag;
+ bool csilentflag;
+ bool kflag;
+ bool mflag;
+ bool sflag;
+ bool uflag;
+ bool zflag;
+ bool tflag;
+ bool complex_sort;
+};
+
+/*
+ * Key value structure forward declaration
+ */
+struct key_value;
+
+/*
+ * Cmp function
+ */
+typedef int (*cmpcoll_t)(struct key_value *kv1, struct key_value *kv2, size_t offset);
+
+/*
+ * This structure holds "sort modifiers" - options which are affecting the sort ordering.
+ */
+struct sort_mods
+{
+ cmpcoll_t func;
+ bool bflag;
+ bool dflag;
+ bool fflag;
+ bool gflag;
+ bool iflag;
+ bool Mflag;
+ bool nflag;
+ bool rflag;
+ bool Rflag;
+ bool Vflag;
+ bool hflag;
+};
+
+extern bool need_hint;
+
+extern struct sort_opts sort_opts_vals;
+
+extern struct sort_mods * const default_sort_mods;
+
+#endif /* __BSD_SORT_H__ */
diff --git a/usr.bin/sort/vsort.c b/usr.bin/sort/vsort.c
new file mode 100644
index 0000000..5d15f9a
--- /dev/null
+++ b/usr.bin/sort/vsort.c
@@ -0,0 +1,265 @@
+/*-
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * Copyright (C) 2012 Gabor Kovesdan <gabor@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/types.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "sort.h"
+#include "vsort.h"
+
+static inline bool
+isdigit_clocale(wchar_t c)
+{
+
+ return (c >= L'0' && c <= L'9');
+}
+
+static inline bool
+isalpha_clocale(wchar_t c)
+{
+
+ return ((c >= L'a' && c <= L'z') || (c >= L'A' && c <= L'Z'));
+}
+
+static inline bool
+isalnum_clocale(wchar_t c)
+{
+
+ return ((c >= L'a' && c <= L'z') || (c >= L'A' && c <= L'Z') ||
+ (c >= L'0' && c <= L'9'));
+}
+
+/*
+ * Find string suffix of format: (\.[A-Za-z~][A-Za-z0-9~]*)*$
+ * Set length of string before suffix.
+ */
+static void
+find_suffix(bwstring_iterator si, bwstring_iterator se, size_t *len)
+{
+ wchar_t c;
+ size_t clen;
+ bool expect_alpha, sfx;
+
+ sfx = false;
+ expect_alpha = false;
+ *len = 0;
+ clen = 0;
+
+ while ((si < se) && (c = bws_get_iter_value(si))) {
+ if (expect_alpha) {
+ expect_alpha = false;
+ if (!isalpha_clocale(c) && (c != L'~'))
+ sfx = false;
+ } else if (c == L'.') {
+ expect_alpha = true;
+ if (!sfx) {
+ sfx = true;
+ *len = clen;
+ }
+ } else if (!isalnum_clocale(c) && (c != L'~'))
+ sfx = false;
+
+ si = bws_iterator_inc(si, 1);
+ ++clen;
+ }
+
+ /* This code must be here to make the implementation compatible
+ * with WORDING of GNU sort documentation.
+ * But the GNU sort implementation is not following its own
+ * documentation. GNU sort allows empty file extensions
+ * (just dot with nothing after); but the regular expression in
+ * their documentation does not allow empty file extensions.
+ * We chose to make our implementation compatible with GNU sort
+ * implementation. If they will ever fix their bug, this code
+ * must be uncommented. Or they may choose to fix the info page,
+ * then the code stays commented.
+ *
+ if (expect_alpha)
+ sfx = false;
+ */
+
+ if (!sfx)
+ *len = clen;
+}
+
+static inline int
+cmp_chars(wchar_t c1, wchar_t c2)
+{
+
+ if (c1 == c2)
+ return (0);
+
+ if (c1 == L'~')
+ return (-1);
+ if (c2 == L'~')
+ return (+1);
+
+ if (isdigit_clocale(c1) || !c1)
+ return ((isdigit_clocale(c2) || !c2) ? 0 : -1);
+
+ if (isdigit_clocale(c2) || !c2)
+ return (+1);
+
+ if (isalpha_clocale(c1))
+ return ((isalpha_clocale(c2)) ? ((int) c1 - (int) c2) : -1);
+
+ if (isalpha_clocale(c2))
+ return (+1);
+
+ return ((int) c1 - (int) c2);
+}
+
+static int
+cmpversions(bwstring_iterator si1, bwstring_iterator se1,
+ bwstring_iterator si2, bwstring_iterator se2)
+{
+ int cmp, diff;
+
+ while ((si1 < se1) || (si2 < se2)) {
+ diff = 0;
+
+ while (((si1 < se1) &&
+ !isdigit_clocale(bws_get_iter_value(si1))) ||
+ ((si2 < se2) && !isdigit_clocale(bws_get_iter_value(si2)))) {
+ wchar_t c1, c2;
+
+ c1 = (si1 < se1) ? bws_get_iter_value(si1) : 0;
+ c2 = (si2 < se2) ? bws_get_iter_value(si2) : 0;
+
+ cmp = cmp_chars(c1, c2);
+ if (cmp)
+ return (cmp);
+
+ if (si1 < se1)
+ si1 = bws_iterator_inc(si1, 1);
+ if (si2 < se2)
+ si2 = bws_iterator_inc(si2, 1);
+ }
+
+ while (bws_get_iter_value(si1) == L'0')
+ si1 = bws_iterator_inc(si1, 1);
+
+ while (bws_get_iter_value(si2) == L'0')
+ si2 = bws_iterator_inc(si2, 1);
+
+ while (isdigit_clocale(bws_get_iter_value(si1)) &&
+ isdigit_clocale(bws_get_iter_value(si2))) {
+ if (!diff)
+ diff = ((int)bws_get_iter_value(si1) -
+ (int)bws_get_iter_value(si2));
+ si1 = bws_iterator_inc(si1, 1);
+ si2 = bws_iterator_inc(si2, 1);
+ }
+
+ if (isdigit_clocale(bws_get_iter_value(si1)))
+ return (1);
+
+ if (isdigit_clocale(bws_get_iter_value(si2)))
+ return (-1);
+
+ if (diff)
+ return (diff);
+ }
+
+ return (0);
+}
+
+/*
+ * Compare two version strings
+ */
+int
+vcmp(struct bwstring *s1, struct bwstring *s2)
+{
+ bwstring_iterator si1, si2;
+ wchar_t c1, c2;
+ size_t len1, len2, slen1, slen2;
+ int cmp_bytes, cmp_res;
+
+ if (s1 == s2)
+ return (0);
+
+ cmp_bytes = bwscmp(s1, s2, 0);
+ if (cmp_bytes == 0)
+ return (0);
+
+ len1 = slen1 = BWSLEN(s1);
+ len2 = slen2 = BWSLEN(s2);
+
+ if (slen1 < 1)
+ return (-1);
+ if (slen2 < 1)
+ return (+1);
+
+ si1 = bws_begin(s1);
+ si2 = bws_begin(s2);
+
+ c1 = bws_get_iter_value(si1);
+ c2 = bws_get_iter_value(si2);
+
+ if (c1 == L'.' && (slen1 == 1))
+ return (-1);
+
+ if (c2 == L'.' && (slen2 == 1))
+ return (+1);
+
+ if (slen1 == 2 && c1 == L'.' &&
+ bws_get_iter_value(bws_iterator_inc(si1, 1)) == L'.')
+ return (-1);
+ if (slen2 == 2 && c2 == L'.' &&
+ bws_get_iter_value(bws_iterator_inc(si2, 1)) == L'.')
+ return (+1);
+
+ if (c1 == L'.' && c2 != L'.')
+ return (-1);
+ if (c1 != L'.' && c2 == L'.')
+ return (+1);
+
+ if (c1 == L'.' && c2 == L'.') {
+ si1 = bws_iterator_inc(si1, 1);
+ si2 = bws_iterator_inc(si2, 1);
+ }
+
+ find_suffix(si1, bws_end(s1), &len1);
+ find_suffix(si2, bws_end(s2), &len2);
+
+ if ((len1 == len2) && (bws_iterator_cmp(si1, si2, len1) == 0))
+ return (cmp_bytes);
+
+ cmp_res = cmpversions(si1, bws_iterator_inc(si1, len1), si2,
+ bws_iterator_inc(si2, len2));
+
+ if (cmp_res == 0)
+ cmp_res = cmp_bytes;
+
+ return (cmp_res);
+}
diff --git a/usr.bin/sort/vsort.h b/usr.bin/sort/vsort.h
new file mode 100644
index 0000000..5f9db74
--- /dev/null
+++ b/usr.bin/sort/vsort.h
@@ -0,0 +1,37 @@
+/* $FreeBSD$ */
+
+/*-
+ * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
+ * Copyright (C) 2012 Gabor Kovesdan <gabor@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.
+ */
+
+#ifndef _VSORT_H_
+#define _VSORT_H_
+
+#include "bwstring.h"
+
+int vcmp(struct bwstring *s1, struct bwstring *s2);
+
+#endif
diff --git a/usr.bin/split/Makefile b/usr.bin/split/Makefile
new file mode 100644
index 0000000..6891f8b
--- /dev/null
+++ b/usr.bin/split/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= split
+
+LIBADD= util
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/split/Makefile.depend b/usr.bin/split/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/split/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1
new file mode 100644
index 0000000..2ba86b2
--- /dev/null
+++ b/usr.bin/split/split.1
@@ -0,0 +1,181 @@
+.\" Copyright (c) 1990, 1991, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)split.1 8.3 (Berkeley) 4/16/94
+.\" $FreeBSD$
+.\"
+.Dd May 9, 2013
+.Dt SPLIT 1
+.Os
+.Sh NAME
+.Nm split
+.Nd split a file into pieces
+.Sh SYNOPSIS
+.Nm
+.Fl d
+.Op Fl l Ar line_count
+.Op Fl a Ar suffix_length
+.Op Ar file Op Ar prefix
+.Nm
+.Fl d
+.Fl b Ar byte_count Ns
+.Oo
+.Sm off
+.Cm K | k | M | m | G | g
+.Sm on
+.Oc
+.Op Fl a Ar suffix_length
+.Op Ar file Op Ar prefix
+.Nm
+.Fl d
+.Fl n Ar chunk_count
+.Op Fl a Ar suffix_length
+.Op Ar file Op Ar prefix
+.Nm
+.Fl d
+.Fl p Ar pattern
+.Op Fl a Ar suffix_length
+.Op Ar file Op Ar prefix
+.Sh DESCRIPTION
+The
+.Nm
+utility reads the given
+.Ar file
+and breaks it up into files of 1000 lines each
+(if no options are specified), leaving the
+.Ar file
+unchanged.
+If
+.Ar file
+is a single dash
+.Pq Sq Fl
+or absent,
+.Nm
+reads from the standard input.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a Ar suffix_length
+Use
+.Ar suffix_length
+letters to form the suffix of the file name.
+.It Fl b Ar byte_count Ns Oo
+.Sm off
+.Cm K | k | M | m | G | g
+.Sm on
+.Oc
+Create split files
+.Ar byte_count
+bytes in length.
+If
+.Cm k
+or
+.Cm K
+is appended to the number, the file is split into
+.Ar byte_count
+kilobyte pieces.
+If
+.Cm m
+or
+.Cm M
+is appended to the number, the file is split into
+.Ar byte_count
+megabyte pieces.
+If
+.Cm g
+or
+.Cm G
+is appended to the number, the file is split into
+.Ar byte_count
+gigabyte pieces.
+.It Fl d
+Use a numeric suffix instead of a alphabetic suffix.
+.It Fl l Ar line_count
+Create split files
+.Ar line_count
+lines in length.
+.It Fl n Ar chunk_count
+Split file into
+.Ar chunk_count
+smaller files.
+.It Fl p Ar pattern
+The file is split whenever an input line matches
+.Ar pattern ,
+which is interpreted as an extended regular expression.
+The matching line will be the first line of the next output file.
+This option is incompatible with the
+.Fl b
+and
+.Fl l
+options.
+.El
+.Pp
+If additional arguments are specified, the first is used as the name
+of the input file which is to be split.
+If a second additional argument is specified, it is used as a prefix
+for the names of the files into which the file is split.
+In this case, each file into which the file is split is named by the
+prefix followed by a lexically ordered suffix using
+.Ar suffix_length
+characters in the range
+.Dq Li a Ns - Ns Li z .
+If
+.Fl a
+is not specified, two letters are used as the suffix.
+.Pp
+If the
+.Ar prefix
+argument is not specified, the file is split into lexically ordered
+files named with the prefix
+.Dq Li x
+and with suffixes as above.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_CTYPE
+and
+.Ev LC_COLLATE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr csplit 1 ,
+.Xr re_format 7
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v3 .
+.Sh BUGS
+The maximum line length for matching patterns is 65536.
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
new file mode 100644
index 0000000..9a0b0ec
--- /dev/null
+++ b/usr.bin/split/split.c
@@ -0,0 +1,402 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1987, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)split.c 8.2 (Berkeley) 4/16/94";
+#endif
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <libutil.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <regex.h>
+#include <sysexits.h>
+
+#define DEFLINE 1000 /* Default num lines per file. */
+
+static off_t bytecnt; /* Byte count to split on. */
+static off_t chunks = 0; /* Chunks count to split into. */
+static long numlines; /* Line count to split on. */
+static int file_open; /* If a file open. */
+static int ifd = -1, ofd = -1; /* Input/output file descriptors. */
+static char bfr[MAXBSIZE]; /* I/O buffer. */
+static char fname[MAXPATHLEN]; /* File name prefix. */
+static regex_t rgx;
+static int pflag;
+static bool dflag;
+static long sufflen = 2; /* File name suffix length. */
+
+static void newfile(void);
+static void split1(void);
+static void split2(void);
+static void split3(void);
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ int ch;
+ int error;
+ char *ep, *p;
+
+ setlocale(LC_ALL, "");
+
+ dflag = false;
+ while ((ch = getopt(argc, argv, "0123456789a:b:dl:n:p:")) != -1)
+ switch (ch) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ /*
+ * Undocumented kludge: split was originally designed
+ * to take a number after a dash.
+ */
+ if (numlines == 0) {
+ p = argv[optind - 1];
+ if (p[0] == '-' && p[1] == ch && !p[2])
+ numlines = strtol(++p, &ep, 10);
+ else
+ numlines =
+ strtol(argv[optind] + 1, &ep, 10);
+ if (numlines <= 0 || *ep)
+ errx(EX_USAGE,
+ "%s: illegal line count", optarg);
+ }
+ break;
+ case 'a': /* Suffix length */
+ if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep)
+ errx(EX_USAGE,
+ "%s: illegal suffix length", optarg);
+ break;
+ case 'b': /* Byte count. */
+ errno = 0;
+ error = expand_number(optarg, &bytecnt);
+ if (error == -1)
+ errx(EX_USAGE, "%s: offset too large", optarg);
+ break;
+ case 'd': /* Decimal suffix */
+ dflag = true;
+ break;
+ case 'l': /* Line count. */
+ if (numlines != 0)
+ usage();
+ if ((numlines = strtol(optarg, &ep, 10)) <= 0 || *ep)
+ errx(EX_USAGE,
+ "%s: illegal line count", optarg);
+ break;
+ case 'n': /* Chunks. */
+ if (!isdigit((unsigned char)optarg[0]) ||
+ (chunks = (size_t)strtoul(optarg, &ep, 10)) == 0 ||
+ *ep != '\0') {
+ errx(EX_USAGE, "%s: illegal number of chunks",
+ optarg);
+ }
+ break;
+
+ case 'p': /* pattern matching. */
+ if (regcomp(&rgx, optarg, REG_EXTENDED|REG_NOSUB) != 0)
+ errx(EX_USAGE, "%s: illegal regexp", optarg);
+ pflag = 1;
+ break;
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+ if (*argv != NULL) { /* Input file. */
+ if (strcmp(*argv, "-") == 0)
+ ifd = STDIN_FILENO;
+ else if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
+ err(EX_NOINPUT, "%s", *argv);
+ ++argv;
+ }
+ if (*argv != NULL) /* File name prefix. */
+ if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname))
+ errx(EX_USAGE, "file name prefix is too long");
+ if (*argv != NULL)
+ usage();
+
+ if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname))
+ errx(EX_USAGE, "suffix is too long");
+ if (pflag && (numlines != 0 || bytecnt != 0 || chunks != 0))
+ usage();
+
+ if (numlines == 0)
+ numlines = DEFLINE;
+ else if (bytecnt != 0 || chunks != 0)
+ usage();
+
+ if (bytecnt && chunks)
+ usage();
+
+ if (ifd == -1) /* Stdin by default. */
+ ifd = 0;
+
+ if (bytecnt) {
+ split1();
+ exit (0);
+ } else if (chunks) {
+ split3();
+ exit (0);
+ }
+ split2();
+ if (pflag)
+ regfree(&rgx);
+ exit(0);
+}
+
+/*
+ * split1 --
+ * Split the input by bytes.
+ */
+static void
+split1(void)
+{
+ off_t bcnt;
+ char *C;
+ ssize_t dist, len;
+ int nfiles;
+
+ nfiles = 0;
+
+ for (bcnt = 0;;)
+ switch ((len = read(ifd, bfr, MAXBSIZE))) {
+ case 0:
+ exit(0);
+ case -1:
+ err(EX_IOERR, "read");
+ /* NOTREACHED */
+ default:
+ if (!file_open) {
+ if (!chunks || (nfiles < chunks)) {
+ newfile();
+ nfiles++;
+ }
+ }
+ if (bcnt + len >= bytecnt) {
+ dist = bytecnt - bcnt;
+ if (write(ofd, bfr, dist) != dist)
+ err(EX_IOERR, "write");
+ len -= dist;
+ for (C = bfr + dist; len >= bytecnt;
+ len -= bytecnt, C += bytecnt) {
+ if (!chunks || (nfiles < chunks)) {
+ newfile();
+ nfiles++;
+ }
+ if (write(ofd,
+ C, bytecnt) != bytecnt)
+ err(EX_IOERR, "write");
+ }
+ if (len != 0) {
+ if (!chunks || (nfiles < chunks)) {
+ newfile();
+ nfiles++;
+ }
+ if (write(ofd, C, len) != len)
+ err(EX_IOERR, "write");
+ } else
+ file_open = 0;
+ bcnt = len;
+ } else {
+ bcnt += len;
+ if (write(ofd, bfr, len) != len)
+ err(EX_IOERR, "write");
+ }
+ }
+}
+
+/*
+ * split2 --
+ * Split the input by lines.
+ */
+static void
+split2(void)
+{
+ long lcnt = 0;
+ FILE *infp;
+
+ /* Stick a stream on top of input file descriptor */
+ if ((infp = fdopen(ifd, "r")) == NULL)
+ err(EX_NOINPUT, "fdopen");
+
+ /* Process input one line at a time */
+ while (fgets(bfr, sizeof(bfr), infp) != NULL) {
+ const int len = strlen(bfr);
+
+ /* If line is too long to deal with, just write it out */
+ if (bfr[len - 1] != '\n')
+ goto writeit;
+
+ /* Check if we need to start a new file */
+ if (pflag) {
+ regmatch_t pmatch;
+
+ pmatch.rm_so = 0;
+ pmatch.rm_eo = len - 1;
+ if (regexec(&rgx, bfr, 0, &pmatch, REG_STARTEND) == 0)
+ newfile();
+ } else if (lcnt++ == numlines) {
+ newfile();
+ lcnt = 1;
+ }
+
+writeit:
+ /* Open output file if needed */
+ if (!file_open)
+ newfile();
+
+ /* Write out line */
+ if (write(ofd, bfr, len) != len)
+ err(EX_IOERR, "write");
+ }
+
+ /* EOF or error? */
+ if (ferror(infp))
+ err(EX_IOERR, "read");
+ else
+ exit(0);
+}
+
+/*
+ * split3 --
+ * Split the input into specified number of chunks
+ */
+static void
+split3(void)
+{
+ struct stat sb;
+
+ if (fstat(ifd, &sb) == -1) {
+ err(1, "stat");
+ /* NOTREACHED */
+ }
+
+ if (chunks > sb.st_size) {
+ errx(1, "can't split into more than %d files",
+ (int)sb.st_size);
+ /* NOTREACHED */
+ }
+
+ bytecnt = sb.st_size / chunks;
+ split1();
+}
+
+
+/*
+ * newfile --
+ * Open a new output file.
+ */
+static void
+newfile(void)
+{
+ long i, maxfiles, tfnum;
+ static long fnum;
+ static char *fpnt;
+ char beg, end;
+ int pattlen;
+
+ if (ofd == -1) {
+ if (fname[0] == '\0') {
+ fname[0] = 'x';
+ fpnt = fname + 1;
+ } else {
+ fpnt = fname + strlen(fname);
+ }
+ ofd = fileno(stdout);
+ }
+
+ if (dflag) {
+ beg = '0';
+ end = '9';
+ }
+ else {
+ beg = 'a';
+ end = 'z';
+ }
+ pattlen = end - beg + 1;
+
+ /* maxfiles = pattlen^sufflen, but don't use libm. */
+ for (maxfiles = 1, i = 0; i < sufflen; i++)
+ if (LONG_MAX / pattlen < maxfiles)
+ errx(EX_USAGE, "suffix is too long (max %ld)", i);
+ else
+ maxfiles *= pattlen;
+
+ if (fnum == maxfiles)
+ errx(EX_DATAERR, "too many files");
+
+ /* Generate suffix of sufflen letters */
+ tfnum = fnum;
+ i = sufflen - 1;
+ do {
+ fpnt[i] = tfnum % pattlen + beg;
+ tfnum /= pattlen;
+ } while (i-- > 0);
+ fpnt[sufflen] = '\0';
+
+ ++fnum;
+ if (!freopen(fname, "w", stdout))
+ err(EX_IOERR, "%s", fname);
+ file_open = 1;
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+"usage: split [-l line_count] [-a suffix_length] [file [prefix]]\n"
+" split -b byte_count[K|k|M|m|G|g] [-a suffix_length] [file [prefix]]\n"
+" split -n chunk_count [-a suffix_length] [file [prefix]]\n"
+" split -p pattern [-a suffix_length] [file [prefix]]\n");
+ exit(EX_USAGE);
+}
diff --git a/usr.bin/ssh-copy-id/Makefile b/usr.bin/ssh-copy-id/Makefile
new file mode 100644
index 0000000..93f5ec4
--- /dev/null
+++ b/usr.bin/ssh-copy-id/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+SCRIPTS= ssh-copy-id.sh
+MAN= ssh-copy-id.1
+PACKAGE= ssh
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ssh-copy-id/Makefile.depend b/usr.bin/ssh-copy-id/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/ssh-copy-id/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.1 b/usr.bin/ssh-copy-id/ssh-copy-id.1
new file mode 100644
index 0000000..5974d03
--- /dev/null
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.1
@@ -0,0 +1,90 @@
+.\"-
+.\" Copyright (c) 2012 Eitan Adler
+.\" 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 February 28, 2014
+.Dt SSH-COPY-ID 1
+.Os
+.Sh NAME
+.Nm ssh-copy-id
+.Nd copy public keys to a remote host
+.Sh SYNOPSIS
+.Nm
+.Op Fl lv
+.Op Fl i Ar keyfile
+.Op Fl o Ar option
+.Op Fl p Ar port
+.Oo Ar user Ns @ Oc Ns Ar hostname
+.Sh DESCRIPTION
+The
+.Nm
+utility copies public keys to a remote host's
+.Pa ~/.ssh/authorized_keys
+file (creating the file and directory, if required).
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl i Ar file
+Copy the public key contained in
+.Ar file .
+This option can be specified multiple times and can be combined with
+the
+.Fl l
+option.
+If a private key is specified and a public key is found then the public key
+will be used.
+.It Fl l
+Copy the keys currently held by
+.Xr ssh-agent 1 .
+This is the default if the
+.Fl i
+option was not specified.
+.It Fl o Ar ssh-option
+Pass this option directly to
+.Xr ssh 1 .
+This option can be specified multiple times.
+.It Fl p Ar port
+Connect to the specified port on the remote host instead of the
+default.
+.It Fl v
+Pass -v to
+.Xr ssh 1 .
+.El
+.Pp
+The remaining arguments are a list of remote hosts to connect to,
+each one optionally qualified by a user name.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+To send a specific key to multiple hosts:
+.Dl $ ssh-copy-id -i /path/to/keyfile.pub user@host1 user@host2 user@host3
+.Sh HISTORY
+The
+.Nm
+utility was written by
+.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/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh
new file mode 100755
index 0000000..f03d5c0
--- /dev/null
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.sh
@@ -0,0 +1,117 @@
+#!/bin/sh
+#-
+# Copyright (c) 2012 Eitan Adler
+# 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 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$
+
+usage() {
+ echo "usage: ssh-copy-id [-lv] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2
+ exit 1
+}
+
+sendkey() {
+ local h="$1"
+ local k="$2"
+ printf "%s\n" "$k" | ssh $port -S none $options "$user$h" /bin/sh -c \'' \
+ set -e; \
+ umask 077; \
+ keyfile=$HOME/.ssh/authorized_keys ; \
+ mkdir -p -- "$HOME/.ssh/" ; \
+ while read alg key comment ; do \
+ [ -n "$key" ] || continue; \
+ if ! grep -sqwF "$key" "$keyfile"; then \
+ printf "$alg $key $comment\n" >> "$keyfile" ; \
+ fi ; \
+ done ; \
+ if [ -x /sbin/restorecon ]; then \
+ /sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \
+ fi \
+ '\'
+}
+
+agentKeys() {
+ keys="$(ssh-add -L | grep -v 'The agent has no identities.')$nl$keys"
+}
+
+keys=""
+host=""
+hasarg=""
+user=""
+port=""
+nl="
+"
+options=""
+
+IFS=$nl
+
+while getopts 'i:lo:p:v' arg; do
+ case $arg in
+ i)
+ hasarg="x"
+ if [ -r "${OPTARG}.pub" ]; then
+ keys="$(cat -- "${OPTARG}.pub")$nl$keys"
+ elif [ -r "$OPTARG" ]; then
+ keys="$(cat -- "$OPTARG")$nl$keys"
+ else
+ echo "File $OPTARG not found" >&2
+ exit 1
+ fi
+ ;;
+ l)
+ hasarg="x"
+ agentKeys
+ ;;
+ p)
+ port=-p$nl$OPTARG
+ ;;
+ o)
+ options=$options$nl-o$nl$OPTARG
+ ;;
+ v)
+ options="$options$nl-v"
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done >&2
+
+shift $((OPTIND-1))
+
+if [ -z "$hasarg" ]; then
+ agentKeys
+fi
+if [ -z "$keys" ] || [ "$keys" = "$nl" ]; then
+ echo "no keys found" >&2
+ exit 1
+fi
+if [ "$#" -eq 0 ]; then
+ usage
+fi
+
+for host in "$@"; do
+ sendkey "$host" "$keys"
+done
diff --git a/usr.bin/stat/Makefile b/usr.bin/stat/Makefile
new file mode 100644
index 0000000..1a54979
--- /dev/null
+++ b/usr.bin/stat/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= stat
+
+LINKS= ${BINDIR}/stat ${BINDIR}/readlink
+MLINKS= stat.1 readlink.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/stat/Makefile.depend b/usr.bin/stat/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/stat/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/stat/stat.1 b/usr.bin/stat/stat.1
new file mode 100644
index 0000000..96e1724
--- /dev/null
+++ b/usr.bin/stat/stat.1
@@ -0,0 +1,606 @@
+.\" $NetBSD: stat.1,v 1.28 2010/04/05 21:25:01 joerg Exp $
+.\"
+.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Andrew Brown and Jan Schaumann.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 April 22, 2012
+.Dt STAT 1
+.Os
+.Sh NAME
+.Nm stat ,
+.Nm readlink
+.Nd display file status
+.Sh SYNOPSIS
+.Nm
+.Op Fl FHLnq
+.Op Fl f Ar format | Fl l | r | s | x
+.Op Fl t Ar timefmt
+.Op Ar
+.Nm readlink
+.Op Fl fn
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility displays information about the file pointed to by
+.Ar file .
+Read, write, or execute permissions of the named file are not required, but
+all directories listed in the pathname leading to the file must be
+searchable.
+If no argument is given,
+.Nm
+displays information about the file descriptor for standard input.
+.Pp
+When invoked as
+.Nm readlink ,
+only the target of the symbolic link is printed.
+If the given argument is not a symbolic link and the
+.Fl f
+option is not specified,
+.Nm readlink
+will print nothing and exit with an error.
+If the
+.Fl f
+option is specified, the output is canonicalized by following every symlink
+in every component of the given path recursively.
+.Nm readlink
+will resolve both absolute and relative paths, and return the absolute pathname
+corresponding to
+.Ar file .
+In this case, the argument does not need to be a symbolic link.
+.Pp
+The information displayed is obtained by calling
+.Xr lstat 2
+with the given argument and evaluating the returned structure.
+The default format displays the
+.Fa st_dev ,
+.Fa st_ino ,
+.Fa st_mode ,
+.Fa st_nlink ,
+.Fa st_uid ,
+.Fa st_gid ,
+.Fa st_rdev ,
+.Fa st_size ,
+.Fa st_atime ,
+.Fa st_mtime ,
+.Fa st_ctime ,
+.Fa st_birthtime ,
+.Fa st_blksize ,
+.Fa st_blocks ,
+and
+.Fa st_flags
+fields, in that order.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl F
+As in
+.Xr ls 1 ,
+display a slash
+.Pq Ql /
+immediately after each pathname that is a directory,
+an asterisk
+.Pq Ql *
+after each that is executable,
+an at sign
+.Pq Ql @
+after each symbolic link,
+a percent sign
+.Pq Ql %
+after each whiteout,
+an equal sign
+.Pq Ql =
+after each socket,
+and a vertical bar
+.Pq Ql |
+after each that is a FIFO.
+The use of
+.Fl F
+implies
+.Fl l .
+.It Fl H
+Treat each argument as the hexadecimal representation of an NFS file handle,
+and use
+.Xr fhstat 2
+instead of
+.Xr lstat 2 .
+This requires root privileges.
+.It Fl L
+Use
+.Xr stat 2
+instead of
+.Xr lstat 2 .
+The information reported by
+.Nm
+will refer to the target of
+.Ar file ,
+if file is a symbolic link, and not to
+.Ar file
+itself.
+If the link is broken or the target does not exist,
+fall back on
+.Xr lstat 2
+and report information about the link.
+.It Fl n
+Do not force a newline to appear at the end of each piece of output.
+.It Fl q
+Suppress failure messages if calls to
+.Xr stat 2
+or
+.Xr lstat 2
+fail.
+When run as
+.Nm readlink ,
+error messages are automatically suppressed.
+.It Fl f Ar format
+Display information using the specified format.
+See the
+.Sx Formats
+section for a description of valid formats.
+.It Fl l
+Display output in
+.Nm ls Fl lT
+format.
+.It Fl r
+Display raw information.
+That is, for all the fields in the
+.Vt stat
+structure,
+display the raw, numerical value (for example, times in seconds since the
+epoch, etc.).
+.It Fl s
+Display information in
+.Dq shell output
+format,
+suitable for initializing variables.
+.It Fl x
+Display information in a more verbose way as known from some
+.Tn Linux
+distributions.
+.It Fl t Ar timefmt
+Display timestamps using the specified format.
+This format is
+passed directly to
+.Xr strftime 3 .
+.El
+.Ss Formats
+Format strings are similar to
+.Xr printf 3
+formats in that they start with
+.Cm % ,
+are then followed by a sequence of formatting characters, and end in
+a character that selects the field of the
+.Vt "struct stat"
+which is to be formatted.
+If the
+.Cm %
+is immediately followed by one of
+.Cm n , t , % ,
+or
+.Cm @ ,
+then a newline character, a tab character, a percent character,
+or the current file number is printed, otherwise the string is
+examined for the following:
+.Pp
+Any of the following optional flags:
+.Bl -tag -width indent
+.It Cm #
+Selects an alternate output form for octal and hexadecimal output.
+Non-zero octal output will have a leading zero, and non-zero
+hexadecimal output will have
+.Dq Li 0x
+prepended to it.
+.It Cm +
+Asserts that a sign indicating whether a number is positive or negative
+should always be printed.
+Non-negative numbers are not usually printed
+with a sign.
+.It Cm -
+Aligns string output to the left of the field, instead of to the right.
+.It Cm 0
+Sets the fill character for left padding to the
+.Ql 0
+character, instead of a space.
+.It space
+Reserves a space at the front of non-negative signed output fields.
+A
+.Sq Cm +
+overrides a space if both are used.
+.El
+.Pp
+Then the following fields:
+.Bl -tag -width indent
+.It Ar size
+An optional decimal digit string specifying the minimum field width.
+.It Ar prec
+An optional precision composed of a decimal point
+.Sq Cm \&.
+and a decimal digit string that indicates the maximum string length,
+the number of digits to appear after the decimal point in floating point
+output, or the minimum number of digits to appear in numeric output.
+.It Ar fmt
+An optional output format specifier which is one of
+.Cm D , O , U , X , F ,
+or
+.Cm S .
+These represent signed decimal output, octal output, unsigned decimal
+output, hexadecimal output, floating point output, and string output,
+respectively.
+Some output formats do not apply to all fields.
+Floating point output only applies to
+.Vt timespec
+fields (the
+.Cm a , m ,
+and
+.Cm c
+fields).
+.Pp
+The special output specifier
+.Cm S
+may be used to indicate that the output, if
+applicable, should be in string format.
+May be used in combination with:
+.Bl -tag -width indent
+.It Cm amc
+Display date in
+.Xr strftime 3
+format.
+.It Cm dr
+Display actual device name.
+.It Cm f
+Display the flags of
+.Ar file
+as in
+.Nm ls Fl lTdo .
+.It Cm gu
+Display group or user name.
+.It Cm p
+Display the mode of
+.Ar file
+as in
+.Nm ls Fl lTd .
+.It Cm N
+Displays the name of
+.Ar file .
+.It Cm T
+Displays the type of
+.Ar file .
+.It Cm Y
+Insert a
+.Dq Li " -\*[Gt] "
+into the output.
+Note that the default output format
+for
+.Cm Y
+is a string, but if specified explicitly, these four characters are
+prepended.
+.El
+.It Ar sub
+An optional sub field specifier (high, middle, low).
+Only applies to
+the
+.Cm p , d , r ,
+and
+.Cm T
+output formats.
+It can be one of the following:
+.Bl -tag -width indent
+.It Cm H
+.Dq High
+\[em]
+specifies the major number for devices from
+.Cm r
+or
+.Cm d ,
+the
+.Dq user
+bits for permissions from the string form of
+.Cm p ,
+the file
+.Dq type
+bits from the numeric forms of
+.Cm p ,
+and the long output form of
+.Cm T .
+.It Cm L
+.Dq Low
+\[em]
+specifies the minor number for devices from
+.Cm r
+or
+.Cm d ,
+the
+.Dq other
+bits for permissions from the string form of
+.Cm p ,
+the
+.Dq user ,
+.Dq group ,
+and
+.Dq other
+bits from the numeric forms of
+.Cm p ,
+and the
+.Nm ls Fl F
+style output character for file type when used with
+.Cm T
+(the use of
+.Cm L
+for this is optional).
+.It Cm M
+.Dq Middle
+\[em]
+specifies the
+.Dq group
+bits for permissions from the
+string output form of
+.Cm p ,
+or the
+.Dq suid ,
+.Dq sgid ,
+and
+.Dq sticky
+bits for the numeric forms of
+.Cm p .
+.El
+.It Ar datum
+A required field specifier, being one of the following:
+.Bl -tag -width indent
+.It Cm d
+Device upon which
+.Ar file
+resides
+.Pq Fa st_dev .
+.It Cm i
+.Ar file Ns 's
+inode number
+.Pq Fa st_ino .
+.It Cm p
+File type and permissions
+.Pq Fa st_mode .
+.It Cm l
+Number of hard links to
+.Ar file
+.Pq Fa st_nlink .
+.It Cm u , g
+User ID and group ID of
+.Ar file Ns 's
+owner
+.Pq Fa st_uid , st_gid .
+.It Cm r
+Device number for character and block device special files
+.Pq Fa st_rdev .
+.It Cm a , m , c , B
+The time
+.Ar file
+was last accessed or modified, or when the inode was last changed, or
+the birth time of the inode
+.Pq Fa st_atime , st_mtime , st_ctime , st_birthtime .
+.It Cm z
+The size of
+.Ar file
+in bytes
+.Pq Fa st_size .
+.It Cm b
+Number of blocks allocated for
+.Ar file
+.Pq Fa st_blocks .
+.It Cm k
+Optimal file system I/O operation block size
+.Pq Fa st_blksize .
+.It Cm f
+User defined flags for
+.Ar file .
+.It Cm v
+Inode generation number
+.Pq Fa st_gen .
+.El
+.Pp
+The following five field specifiers are not drawn directly from the
+data in
+.Vt "struct stat" ,
+but are:
+.Bl -tag -width indent
+.It Cm N
+The name of the file.
+.It Cm R
+The absolute pathname corresponding to the file.
+.It Cm T
+The file type, either as in
+.Nm ls Fl F
+or in a more descriptive form if the
+.Ar sub
+field specifier
+.Cm H
+is given.
+.It Cm Y
+The target of a symbolic link.
+.It Cm Z
+Expands to
+.Dq major,minor
+from the
+.Va rdev
+field for character or block
+special devices and gives size output for all others.
+.El
+.El
+.Pp
+Only the
+.Cm %
+and the field specifier are required.
+Most field specifiers default to
+.Cm U
+as an output form, with the
+exception of
+.Cm p
+which defaults to
+.Cm O ;
+.Cm a , m ,
+and
+.Cm c
+which default to
+.Cm D ;
+and
+.Cm Y , T ,
+and
+.Cm N
+which default to
+.Cm S .
+.Sh EXIT STATUS
+.Ex -std stat readlink
+.Sh EXAMPLES
+If no options are specified, the default format is
+"%d %i %Sp %l %Su %Sg %r %z \e"%Sa\e" \e"%Sm\e" \e"%Sc\e" \e"%SB\e" %k %b %#Xf %N".
+.Bd -literal -offset indent
+\*[Gt] stat /tmp/bar
+0 78852 -rw-r--r-- 1 root wheel 0 0 "Jul 8 10:26:03 2004" "Jul 8 10:26:03 2004" "Jul 8 10:28:13 2004" "Jan 1 09:00:00 1970" 16384 0 0 /tmp/bar
+.Ed
+.Pp
+Given a symbolic link
+.Dq foo
+that points from
+.Pa /tmp/foo
+to
+.Pa / ,
+you would use
+.Nm
+as follows:
+.Bd -literal -offset indent
+\*[Gt] stat -F /tmp/foo
+lrwxrwxrwx 1 jschauma cs 1 Apr 24 16:37:28 2002 /tmp/foo@ -\*[Gt] /
+
+\*[Gt] stat -LF /tmp/foo
+drwxr-xr-x 16 root wheel 512 Apr 19 10:57:54 2002 /tmp/foo/
+.Ed
+.Pp
+To initialize some shell variables, you could use the
+.Fl s
+flag as follows:
+.Bd -literal -offset indent
+\*[Gt] csh
+% eval set `stat -s .cshrc`
+% echo $st_size $st_mtimespec
+1148 1015432481
+
+\*[Gt] sh
+$ eval $(stat -s .profile)
+$ echo $st_size $st_mtimespec
+1148 1015432481
+.Ed
+.Pp
+In order to get a list of file types including files pointed to if the
+file is a symbolic link, you could use the following format:
+.Bd -literal -offset indent
+$ stat -f "%N: %HT%SY" /tmp/*
+/tmp/bar: Symbolic Link -\*[Gt] /tmp/foo
+/tmp/output25568: Regular File
+/tmp/blah: Directory
+/tmp/foo: Symbolic Link -\*[Gt] /
+.Ed
+.Pp
+In order to get a list of the devices, their types and the major and minor
+device numbers, formatted with tabs and linebreaks, you could use the
+following format:
+.Bd -literal -offset indent
+stat -f "Name: %N%n%tType: %HT%n%tMajor: %Hr%n%tMinor: %Lr%n%n" /dev/*
+[...]
+Name: /dev/wt8
+ Type: Block Device
+ Major: 3
+ Minor: 8
+
+Name: /dev/zero
+ Type: Character Device
+ Major: 2
+ Minor: 12
+.Ed
+.Pp
+In order to determine the permissions set on a file separately, you could use
+the following format:
+.Bd -literal -offset indent
+\*[Gt] stat -f "%Sp -\*[Gt] owner=%SHp group=%SMp other=%SLp" .
+drwxr-xr-x -\*[Gt] owner=rwx group=r-x other=r-x
+.Ed
+.Pp
+In order to determine the three files that have been modified most recently,
+you could use the following format:
+.Bd -literal -offset indent
+\*[Gt] stat -f "%m%t%Sm %N" /tmp/* | sort -rn | head -3 | cut -f2-
+Apr 25 11:47:00 2002 /tmp/blah
+Apr 25 10:36:34 2002 /tmp/bar
+Apr 24 16:47:35 2002 /tmp/foo
+.Ed
+.Pp
+To display a file's modification time:
+.Bd -literal -offset indent
+\*[Gt] stat -f %m /tmp/foo
+1177697733
+.Ed
+.Pp
+To display the same modification time in a readable format:
+.Bd -literal -offset indent
+\*[Gt] stat -f %Sm /tmp/foo
+Apr 27 11:15:33 2007
+.Ed
+.Pp
+To display the same modification time in a readable and sortable format:
+.Bd -literal -offset indent
+\*[Gt] stat -f %Sm -t %Y%m%d%H%M%S /tmp/foo
+20070427111533
+.Ed
+.Pp
+To display the same in UTC:
+.Bd -literal -offset indent
+\*[Gt] sh
+$ TZ= stat -f %Sm -t %Y%m%d%H%M%S /tmp/foo
+20070427181533
+.Ed
+.Sh SEE ALSO
+.Xr file 1 ,
+.Xr ls 1 ,
+.Xr lstat 2 ,
+.Xr readlink 2 ,
+.Xr stat 2 ,
+.Xr printf 3 ,
+.Xr strftime 3
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Nx 1.6
+and
+.Fx 4.10 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility was written by
+.An Andrew Brown Aq Mt atatat@NetBSD.org .
+This man page was written by
+.An Jan Schaumann Aq Mt jschauma@NetBSD.org .
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c
new file mode 100644
index 0000000..ddbb9ab
--- /dev/null
+++ b/usr.bin/stat/stat.c
@@ -0,0 +1,1098 @@
+/*
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Brown.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
+#if 0
+#ifndef lint
+__RCSID("$NetBSD: stat.c,v 1.33 2011/01/15 22:54:10 njoly Exp $"
+"$OpenBSD: stat.c,v 1.14 2009/06/24 09:44:25 sobrado Exp $");
+#endif
+#endif
+
+__FBSDID("$FreeBSD$");
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#else /* HAVE_CONFIG_H */
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#define HAVE_STRUCT_STAT_ST_GEN 1
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
+#define HAVE_DEVNAME 1
+#endif /* HAVE_CONFIG_H */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <limits.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#if HAVE_STRUCT_STAT_ST_FLAGS
+#define DEF_F "%#Xf "
+#define RAW_F "%f "
+#define SHELL_F " st_flags=%f"
+#else /* HAVE_STRUCT_STAT_ST_FLAGS */
+#define DEF_F
+#define RAW_F
+#define SHELL_F
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
+
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+#define DEF_B "\"%SB\" "
+#define RAW_B "%B "
+#define SHELL_B "st_birthtime=%B "
+#else /* HAVE_STRUCT_STAT_ST_BIRTHTIME */
+#define DEF_B
+#define RAW_B
+#define SHELL_B
+#endif /* HAVE_STRUCT_STAT_ST_BIRTHTIME */
+
+#if HAVE_STRUCT_STAT_ST_ATIM
+#define st_atimespec st_atim
+#define st_ctimespec st_ctim
+#define st_mtimespec st_mtim
+#endif /* HAVE_STRUCT_STAT_ST_ATIM */
+
+#define DEF_FORMAT \
+ "%d %i %Sp %l %Su %Sg %r %z \"%Sa\" \"%Sm\" \"%Sc\" " DEF_B \
+ "%k %b " DEF_F "%N"
+#define RAW_FORMAT "%d %i %#p %l %u %g %r %z %a %m %c " RAW_B \
+ "%k %b " RAW_F "%N"
+#define LS_FORMAT "%Sp %l %Su %Sg %Z %Sm %N%SY"
+#define LSF_FORMAT "%Sp %l %Su %Sg %Z %Sm %N%T%SY"
+#define SHELL_FORMAT \
+ "st_dev=%d st_ino=%i st_mode=%#p st_nlink=%l " \
+ "st_uid=%u st_gid=%g st_rdev=%r st_size=%z " \
+ "st_atime=%a st_mtime=%m st_ctime=%c " SHELL_B \
+ "st_blksize=%k st_blocks=%b" SHELL_F
+#define LINUX_FORMAT \
+ " File: \"%N\"%n" \
+ " Size: %-11z FileType: %HT%n" \
+ " Mode: (%OMp%03OLp/%.10Sp) Uid: (%5u/%8Su) Gid: (%5g/%8Sg)%n" \
+ "Device: %Hd,%Ld Inode: %i Links: %l%n" \
+ "Access: %Sa%n" \
+ "Modify: %Sm%n" \
+ "Change: %Sc"
+
+#define TIME_FORMAT "%b %e %T %Y"
+
+#define FLAG_POUND 0x01
+#define FLAG_SPACE 0x02
+#define FLAG_PLUS 0x04
+#define FLAG_ZERO 0x08
+#define FLAG_MINUS 0x10
+
+/*
+ * These format characters must all be unique, except the magic one.
+ */
+#define FMT_MAGIC '%'
+#define FMT_DOT '.'
+
+#define SIMPLE_NEWLINE 'n'
+#define SIMPLE_TAB 't'
+#define SIMPLE_PERCENT '%'
+#define SIMPLE_NUMBER '@'
+
+#define FMT_POUND '#'
+#define FMT_SPACE ' '
+#define FMT_PLUS '+'
+#define FMT_ZERO '0'
+#define FMT_MINUS '-'
+
+#define FMT_DECIMAL 'D'
+#define FMT_OCTAL 'O'
+#define FMT_UNSIGNED 'U'
+#define FMT_HEX 'X'
+#define FMT_FLOAT 'F'
+#define FMT_STRING 'S'
+
+#define FMTF_DECIMAL 0x01
+#define FMTF_OCTAL 0x02
+#define FMTF_UNSIGNED 0x04
+#define FMTF_HEX 0x08
+#define FMTF_FLOAT 0x10
+#define FMTF_STRING 0x20
+
+#define HIGH_PIECE 'H'
+#define MIDDLE_PIECE 'M'
+#define LOW_PIECE 'L'
+
+#define SHOW_realpath 'R'
+#define SHOW_st_dev 'd'
+#define SHOW_st_ino 'i'
+#define SHOW_st_mode 'p'
+#define SHOW_st_nlink 'l'
+#define SHOW_st_uid 'u'
+#define SHOW_st_gid 'g'
+#define SHOW_st_rdev 'r'
+#define SHOW_st_atime 'a'
+#define SHOW_st_mtime 'm'
+#define SHOW_st_ctime 'c'
+#define SHOW_st_btime 'B'
+#define SHOW_st_size 'z'
+#define SHOW_st_blocks 'b'
+#define SHOW_st_blksize 'k'
+#define SHOW_st_flags 'f'
+#define SHOW_st_gen 'v'
+#define SHOW_symlink 'Y'
+#define SHOW_filetype 'T'
+#define SHOW_filename 'N'
+#define SHOW_sizerdev 'Z'
+
+void usage(const char *);
+void output(const struct stat *, const char *,
+ const char *, int, int);
+int format1(const struct stat *, /* stat info */
+ const char *, /* the file name */
+ const char *, int, /* the format string itself */
+ 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
+
+static const char *timefmt;
+static int linkfail;
+
+#define addchar(s, c, nl) \
+ do { \
+ (void)fputc((c), (s)); \
+ (*nl) = ((c) == '\n'); \
+ } while (0/*CONSTCOND*/)
+
+int
+main(int argc, char *argv[])
+{
+ struct stat st;
+ int ch, rc, errs, am_readlink;
+ int lsF, fmtchar, usestat, nfs_handle, fn, nonl, quiet;
+ const char *statfmt, *options, *synopsis;
+ char dname[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV;
+ fhandle_t fhnd;
+ const char *file;
+
+ am_readlink = 0;
+ lsF = 0;
+ fmtchar = '\0';
+ usestat = 0;
+ nfs_handle = 0;
+ nonl = 0;
+ quiet = 0;
+ linkfail = 0;
+ statfmt = NULL;
+ timefmt = NULL;
+
+ if (strcmp(getprogname(), "readlink") == 0) {
+ am_readlink = 1;
+ options = "fn";
+ synopsis = "[-fn] [file ...]";
+ statfmt = "%Y";
+ fmtchar = 'f';
+ quiet = 1;
+ } else {
+ options = "f:FHlLnqrst:x";
+ synopsis = "[-FLnq] [-f format | -l | -r | -s | -x] "
+ "[-t timefmt] [file|handle ...]";
+ }
+
+ while ((ch = getopt(argc, argv, options)) != -1)
+ switch (ch) {
+ case 'F':
+ lsF = 1;
+ break;
+ case 'H':
+ nfs_handle = 1;
+ break;
+ case 'L':
+ usestat = 1;
+ break;
+ case 'n':
+ nonl = 1;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 'f':
+ if (am_readlink) {
+ statfmt = "%R";
+ break;
+ }
+ statfmt = optarg;
+ /* FALLTHROUGH */
+ case 'l':
+ case 'r':
+ case 's':
+ case 'x':
+ if (fmtchar != 0)
+ errx(1, "can't use format '%c' with '%c'",
+ fmtchar, ch);
+ fmtchar = ch;
+ break;
+ case 't':
+ timefmt = optarg;
+ break;
+ default:
+ usage(synopsis);
+ }
+
+ argc -= optind;
+ argv += optind;
+ fn = 1;
+
+ if (fmtchar == '\0') {
+ if (lsF)
+ fmtchar = 'l';
+ else {
+ fmtchar = 'f';
+ statfmt = DEF_FORMAT;
+ }
+ }
+
+ if (lsF && fmtchar != 'l')
+ errx(1, "can't use format '%c' with -F", fmtchar);
+
+ switch (fmtchar) {
+ case 'f':
+ /* statfmt already set */
+ break;
+ case 'l':
+ statfmt = lsF ? LSF_FORMAT : LS_FORMAT;
+ break;
+ case 'r':
+ statfmt = RAW_FORMAT;
+ break;
+ case 's':
+ statfmt = SHELL_FORMAT;
+ break;
+ case 'x':
+ statfmt = LINUX_FORMAT;
+ if (timefmt == NULL)
+ timefmt = "%c";
+ break;
+ default:
+ usage(synopsis);
+ /*NOTREACHED*/
+ }
+
+ if (timefmt == NULL)
+ timefmt = TIME_FORMAT;
+
+ errs = 0;
+ do {
+ if (argc == 0) {
+ if (fdevname_r(STDIN_FILENO, dname +
+ sizeof _PATH_DEV - 1, SPECNAMELEN) != NULL)
+ file = dname;
+ else
+ file = "(stdin)";
+ rc = fstat(STDIN_FILENO, &st);
+ } else {
+ int j;
+
+ file = argv[0];
+ if (nfs_handle) {
+ rc = 0;
+ bzero(&fhnd, sizeof(fhnd));
+ j = MIN(2 * sizeof(fhnd), strlen(file));
+ if ((j & 1) != 0) {
+ rc = -1;
+ } else {
+ while (j) {
+ rc = hex2byte(&file[j - 2]);
+ if (rc == -1)
+ break;
+ ((char*) &fhnd)[j / 2 - 1] = rc;
+ j -= 2;
+ }
+ }
+ if (rc == -1)
+ errno = EINVAL;
+ else
+ rc = fhstat(&fhnd, &st);
+
+ } else if (usestat) {
+ /*
+ * Try stat() and if it fails, fall back to
+ * lstat() just in case we're examining a
+ * broken symlink.
+ */
+ if ((rc = stat(file, &st)) == -1 &&
+ errno == ENOENT &&
+ (rc = lstat(file, &st)) == -1)
+ errno = ENOENT;
+ }
+ else
+ rc = lstat(file, &st);
+ }
+
+ if (rc == -1) {
+ errs = 1;
+ linkfail = 1;
+ if (!quiet)
+ warn("%s: stat", file);
+ }
+ else
+ output(&st, file, statfmt, fn, nonl);
+
+ argv++;
+ argc--;
+ fn++;
+ } while (argc > 0);
+
+ return (am_readlink ? linkfail : errs);
+}
+
+#if HAVE_STRUCT_STAT_ST_FLAGS
+/*
+ * fflagstostr() wrapper that leaks only once
+ */
+char *
+xfflagstostr(unsigned long fflags)
+{
+ static char *str = NULL;
+
+ if (str != NULL)
+ free(str);
+
+ str = fflagstostr(fflags);
+ if (str == NULL)
+ err(1, "fflagstostr");
+ return (str);
+}
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
+
+void
+usage(const char *synopsis)
+{
+
+ (void)fprintf(stderr, "usage: %s %s\n", getprogname(), synopsis);
+ exit(1);
+}
+
+/*
+ * Parses a format string.
+ */
+void
+output(const struct stat *st, const char *file,
+ const char *statfmt, int fn, int nonl)
+{
+ int flags, size, prec, ofmt, hilo, what;
+ char buf[PATH_MAX + 4 + 1];
+ const char *subfmt;
+ int nl, t, i;
+
+ nl = 1;
+ while (*statfmt != '\0') {
+
+ /*
+ * Non-format characters go straight out.
+ */
+ if (*statfmt != FMT_MAGIC) {
+ addchar(stdout, *statfmt, &nl);
+ statfmt++;
+ continue;
+ }
+
+ /*
+ * The current format "substring" starts here,
+ * and then we skip the magic.
+ */
+ subfmt = statfmt;
+ statfmt++;
+
+ /*
+ * Some simple one-character "formats".
+ */
+ switch (*statfmt) {
+ case SIMPLE_NEWLINE:
+ addchar(stdout, '\n', &nl);
+ statfmt++;
+ continue;
+ case SIMPLE_TAB:
+ addchar(stdout, '\t', &nl);
+ statfmt++;
+ continue;
+ case SIMPLE_PERCENT:
+ addchar(stdout, '%', &nl);
+ statfmt++;
+ continue;
+ case SIMPLE_NUMBER: {
+ char num[12], *p;
+
+ snprintf(num, sizeof(num), "%d", fn);
+ for (p = &num[0]; *p; p++)
+ addchar(stdout, *p, &nl);
+ statfmt++;
+ continue;
+ }
+ }
+
+ /*
+ * This must be an actual format string. Format strings are
+ * similar to printf(3) formats up to a point, and are of
+ * the form:
+ *
+ * % required start of format
+ * [-# +0] opt. format characters
+ * size opt. field width
+ * . opt. decimal separator, followed by
+ * prec opt. precision
+ * fmt opt. output specifier (string, numeric, etc.)
+ * sub opt. sub field specifier (high, middle, low)
+ * datum required field specifier (size, mode, etc)
+ *
+ * Only the % and the datum selector are required. All data
+ * have reasonable default output forms. The "sub" specifier
+ * only applies to certain data (mode, dev, rdev, filetype).
+ * The symlink output defaults to STRING, yet will only emit
+ * the leading " -> " if STRING is explicitly specified. The
+ * sizerdev datum will generate rdev output for character or
+ * block devices, and size output for all others.
+ */
+ flags = 0;
+ do {
+ if (*statfmt == FMT_POUND)
+ flags |= FLAG_POUND;
+ else if (*statfmt == FMT_SPACE)
+ flags |= FLAG_SPACE;
+ else if (*statfmt == FMT_PLUS)
+ flags |= FLAG_PLUS;
+ else if (*statfmt == FMT_ZERO)
+ flags |= FLAG_ZERO;
+ else if (*statfmt == FMT_MINUS)
+ flags |= FLAG_MINUS;
+ else
+ break;
+ statfmt++;
+ } while (1/*CONSTCOND*/);
+
+ size = -1;
+ if (isdigit((unsigned)*statfmt)) {
+ size = 0;
+ while (isdigit((unsigned)*statfmt)) {
+ size = (size * 10) + (*statfmt - '0');
+ statfmt++;
+ if (size < 0)
+ goto badfmt;
+ }
+ }
+
+ prec = -1;
+ if (*statfmt == FMT_DOT) {
+ statfmt++;
+
+ prec = 0;
+ while (isdigit((unsigned)*statfmt)) {
+ prec = (prec * 10) + (*statfmt - '0');
+ statfmt++;
+ if (prec < 0)
+ goto badfmt;
+ }
+ }
+
+#define fmtcase(x, y) case (y): (x) = (y); statfmt++; break
+#define fmtcasef(x, y, z) case (y): (x) = (z); statfmt++; break
+ switch (*statfmt) {
+ fmtcasef(ofmt, FMT_DECIMAL, FMTF_DECIMAL);
+ fmtcasef(ofmt, FMT_OCTAL, FMTF_OCTAL);
+ fmtcasef(ofmt, FMT_UNSIGNED, FMTF_UNSIGNED);
+ fmtcasef(ofmt, FMT_HEX, FMTF_HEX);
+ fmtcasef(ofmt, FMT_FLOAT, FMTF_FLOAT);
+ fmtcasef(ofmt, FMT_STRING, FMTF_STRING);
+ default:
+ ofmt = 0;
+ break;
+ }
+
+ switch (*statfmt) {
+ fmtcase(hilo, HIGH_PIECE);
+ fmtcase(hilo, MIDDLE_PIECE);
+ fmtcase(hilo, LOW_PIECE);
+ default:
+ hilo = 0;
+ break;
+ }
+
+ switch (*statfmt) {
+ fmtcase(what, SHOW_realpath);
+ fmtcase(what, SHOW_st_dev);
+ fmtcase(what, SHOW_st_ino);
+ fmtcase(what, SHOW_st_mode);
+ fmtcase(what, SHOW_st_nlink);
+ fmtcase(what, SHOW_st_uid);
+ fmtcase(what, SHOW_st_gid);
+ fmtcase(what, SHOW_st_rdev);
+ fmtcase(what, SHOW_st_atime);
+ fmtcase(what, SHOW_st_mtime);
+ fmtcase(what, SHOW_st_ctime);
+ fmtcase(what, SHOW_st_btime);
+ fmtcase(what, SHOW_st_size);
+ fmtcase(what, SHOW_st_blocks);
+ fmtcase(what, SHOW_st_blksize);
+ fmtcase(what, SHOW_st_flags);
+ fmtcase(what, SHOW_st_gen);
+ fmtcase(what, SHOW_symlink);
+ fmtcase(what, SHOW_filetype);
+ fmtcase(what, SHOW_filename);
+ fmtcase(what, SHOW_sizerdev);
+ default:
+ goto badfmt;
+ }
+#undef fmtcasef
+#undef fmtcase
+
+ t = format1(st,
+ file,
+ subfmt, statfmt - subfmt,
+ buf, sizeof(buf),
+ flags, size, prec, ofmt, hilo, what);
+
+ for (i = 0; i < t && i < (int)(sizeof(buf) - 1); i++)
+ addchar(stdout, buf[i], &nl);
+
+ continue;
+
+ badfmt:
+ errx(1, "%.*s: bad format",
+ (int)(statfmt - subfmt + 1), subfmt);
+ }
+
+ if (!nl && !nonl)
+ (void)fputc('\n', stdout);
+ (void)fflush(stdout);
+}
+
+/*
+ * Arranges output according to a single parsed format substring.
+ */
+int
+format1(const struct stat *st,
+ const char *file,
+ const char *fmt, int flen,
+ char *buf, size_t blen,
+ int flags, int size, int prec, int ofmt,
+ int hilo, int what)
+{
+ u_int64_t data;
+ char *stmp, lfmt[24], tmp[20];
+ const char *sdata;
+ char smode[12], sid[12], path[PATH_MAX + 4];
+ struct passwd *pw;
+ struct group *gr;
+ const struct timespec *tsp;
+ struct timespec ts;
+ struct tm *tm;
+ int l, small, formats;
+
+ tsp = NULL;
+ formats = 0;
+ small = 0;
+
+ /*
+ * First, pick out the data and tweak it based on hilo or
+ * specified output format (symlink output only).
+ */
+ switch (what) {
+ case SHOW_st_dev:
+ case SHOW_st_rdev:
+ small = (sizeof(st->st_dev) == 4);
+ data = (what == SHOW_st_dev) ? st->st_dev : st->st_rdev;
+#if HAVE_DEVNAME
+ sdata = (what == SHOW_st_dev) ?
+ devname(st->st_dev, S_IFBLK) :
+ devname(st->st_rdev,
+ S_ISCHR(st->st_mode) ? S_IFCHR :
+ S_ISBLK(st->st_mode) ? S_IFBLK :
+ 0U);
+ if (sdata == NULL)
+ sdata = "???";
+#endif /* HAVE_DEVNAME */
+ if (hilo == HIGH_PIECE) {
+ data = major(data);
+ hilo = 0;
+ }
+ else if (hilo == LOW_PIECE) {
+ data = minor((unsigned)data);
+ hilo = 0;
+ }
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+#if HAVE_DEVNAME
+ FMTF_STRING;
+#else /* HAVE_DEVNAME */
+ 0;
+#endif /* HAVE_DEVNAME */
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_ino:
+ small = (sizeof(st->st_ino) == 4);
+ data = st->st_ino;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_mode:
+ small = (sizeof(st->st_mode) == 4);
+ data = st->st_mode;
+ strmode(st->st_mode, smode);
+ stmp = smode;
+ l = strlen(stmp);
+ if (stmp[l - 1] == ' ')
+ stmp[--l] = '\0';
+ if (hilo == HIGH_PIECE) {
+ data >>= 12;
+ stmp += 1;
+ stmp[3] = '\0';
+ hilo = 0;
+ }
+ else if (hilo == MIDDLE_PIECE) {
+ data = (data >> 9) & 07;
+ stmp += 4;
+ stmp[3] = '\0';
+ hilo = 0;
+ }
+ else if (hilo == LOW_PIECE) {
+ data &= 0777;
+ stmp += 7;
+ stmp[3] = '\0';
+ hilo = 0;
+ }
+ sdata = stmp;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_OCTAL;
+ break;
+ case SHOW_st_nlink:
+ small = (sizeof(st->st_dev) == 4);
+ data = st->st_nlink;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_uid:
+ small = (sizeof(st->st_uid) == 4);
+ data = st->st_uid;
+ if ((pw = getpwuid(st->st_uid)) != NULL)
+ sdata = pw->pw_name;
+ else {
+ snprintf(sid, sizeof(sid), "(%ld)", (long)st->st_uid);
+ sdata = sid;
+ }
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_gid:
+ small = (sizeof(st->st_gid) == 4);
+ data = st->st_gid;
+ if ((gr = getgrgid(st->st_gid)) != NULL)
+ sdata = gr->gr_name;
+ else {
+ snprintf(sid, sizeof(sid), "(%ld)", (long)st->st_gid);
+ sdata = sid;
+ }
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_atime:
+ tsp = &st->st_atimespec;
+ /* FALLTHROUGH */
+ case SHOW_st_mtime:
+ if (tsp == NULL)
+ tsp = &st->st_mtimespec;
+ /* FALLTHROUGH */
+ case SHOW_st_ctime:
+ if (tsp == NULL)
+ tsp = &st->st_ctimespec;
+ /* FALLTHROUGH */
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+ case SHOW_st_btime:
+ if (tsp == NULL)
+ tsp = &st->st_birthtimespec;
+#endif /* HAVE_STRUCT_STAT_ST_BIRTHTIME */
+ ts = *tsp; /* copy so we can muck with it */
+ small = (sizeof(ts.tv_sec) == 4);
+ data = ts.tv_sec;
+ tm = localtime(&ts.tv_sec);
+ if (tm == NULL) {
+ ts.tv_sec = 0;
+ tm = localtime(&ts.tv_sec);
+ }
+ (void)strftime(path, sizeof(path), timefmt, tm);
+ sdata = path;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_FLOAT | FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_DECIMAL;
+ break;
+ case SHOW_st_size:
+ small = (sizeof(st->st_size) == 4);
+ data = st->st_size;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_blocks:
+ small = (sizeof(st->st_blocks) == 4);
+ data = st->st_blocks;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+ case SHOW_st_blksize:
+ small = (sizeof(st->st_blksize) == 4);
+ data = st->st_blksize;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+#if HAVE_STRUCT_STAT_ST_FLAGS
+ case SHOW_st_flags:
+ small = (sizeof(st->st_flags) == 4);
+ data = st->st_flags;
+ sdata = xfflagstostr(st->st_flags);
+ if (*sdata == '\0')
+ sdata = "-";
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
+#if HAVE_STRUCT_STAT_ST_GEN
+ case SHOW_st_gen:
+ small = (sizeof(st->st_gen) == 4);
+ data = st->st_gen;
+ sdata = NULL;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ if (ofmt == 0)
+ ofmt = FMTF_UNSIGNED;
+ break;
+#endif /* HAVE_STRUCT_STAT_ST_GEN */
+ case SHOW_realpath:
+ small = 0;
+ data = 0;
+ if (file == NULL) {
+ (void)strlcpy(path, "(stdin)", sizeof(path));
+ sdata = path;
+ } else {
+ snprintf(path, sizeof(path), " -> ");
+ if (realpath(file, path + 4) == NULL) {
+ linkfail = 1;
+ l = 0;
+ path[0] = '\0';
+ }
+ sdata = path + (ofmt == FMTF_STRING ? 0 : 4);
+ }
+
+ formats = FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_STRING;
+ break;
+ case SHOW_symlink:
+ small = 0;
+ data = 0;
+ if (S_ISLNK(st->st_mode)) {
+ snprintf(path, sizeof(path), " -> ");
+ l = readlink(file, path + 4, sizeof(path) - 4 - 1);
+ if (l == -1) {
+ linkfail = 1;
+ l = 0;
+ path[0] = '\0';
+ }
+ path[l + 4] = '\0';
+ sdata = path + (ofmt == FMTF_STRING ? 0 : 4);
+ }
+ else {
+ linkfail = 1;
+ sdata = "";
+ }
+ formats = FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_STRING;
+ break;
+ case SHOW_filetype:
+ small = 0;
+ data = 0;
+ sdata = "";
+ if (hilo == 0 || hilo == LOW_PIECE) {
+ switch (st->st_mode & S_IFMT) {
+ case S_IFIFO: sdata = "|"; break;
+ case S_IFDIR: sdata = "/"; break;
+ case S_IFREG:
+ if (st->st_mode &
+ (S_IXUSR | S_IXGRP | S_IXOTH))
+ sdata = "*";
+ break;
+ case S_IFLNK: sdata = "@"; break;
+ case S_IFSOCK: sdata = "="; break;
+#ifdef S_IFWHT
+ case S_IFWHT: sdata = "%"; break;
+#endif /* S_IFWHT */
+#ifdef S_IFDOOR
+ case S_IFDOOR: sdata = ">"; break;
+#endif /* S_IFDOOR */
+ }
+ hilo = 0;
+ }
+ else if (hilo == HIGH_PIECE) {
+ switch (st->st_mode & S_IFMT) {
+ case S_IFIFO: sdata = "Fifo File"; break;
+ case S_IFCHR: sdata = "Character Device"; break;
+ case S_IFDIR: sdata = "Directory"; break;
+ case S_IFBLK: sdata = "Block Device"; break;
+ case S_IFREG: sdata = "Regular File"; break;
+ case S_IFLNK: sdata = "Symbolic Link"; break;
+ case S_IFSOCK: sdata = "Socket"; break;
+#ifdef S_IFWHT
+ case S_IFWHT: sdata = "Whiteout File"; break;
+#endif /* S_IFWHT */
+#ifdef S_IFDOOR
+ case S_IFDOOR: sdata = "Door"; break;
+#endif /* S_IFDOOR */
+ default: sdata = "???"; break;
+ }
+ hilo = 0;
+ }
+ formats = FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_STRING;
+ break;
+ case SHOW_filename:
+ small = 0;
+ data = 0;
+ (void)strlcpy(path, file, sizeof(path));
+ sdata = path;
+ formats = FMTF_STRING;
+ if (ofmt == 0)
+ ofmt = FMTF_STRING;
+ break;
+ case SHOW_sizerdev:
+ if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
+ char majdev[20], mindev[20];
+ int l1, l2;
+
+ l1 = format1(st,
+ file,
+ fmt, flen,
+ majdev, sizeof(majdev),
+ flags, size, prec,
+ ofmt, HIGH_PIECE, SHOW_st_rdev);
+ l2 = format1(st,
+ file,
+ fmt, flen,
+ mindev, sizeof(mindev),
+ flags, size, prec,
+ ofmt, LOW_PIECE, SHOW_st_rdev);
+ return (snprintf(buf, blen, "%.*s,%.*s",
+ l1, majdev, l2, mindev));
+ }
+ else {
+ return (format1(st,
+ file,
+ fmt, flen,
+ buf, blen,
+ flags, size, prec,
+ ofmt, 0, SHOW_st_size));
+ }
+ /*NOTREACHED*/
+ default:
+ errx(1, "%.*s: bad format", (int)flen, fmt);
+ }
+
+ /*
+ * If a subdatum was specified but not supported, or an output
+ * format was selected that is not supported, that's an error.
+ */
+ if (hilo != 0 || (ofmt & formats) == 0)
+ errx(1, "%.*s: bad format", (int)flen, fmt);
+
+ /*
+ * Assemble the format string for passing to printf(3).
+ */
+ lfmt[0] = '\0';
+ (void)strcat(lfmt, "%");
+ if (flags & FLAG_POUND)
+ (void)strcat(lfmt, "#");
+ if (flags & FLAG_SPACE)
+ (void)strcat(lfmt, " ");
+ if (flags & FLAG_PLUS)
+ (void)strcat(lfmt, "+");
+ if (flags & FLAG_MINUS)
+ (void)strcat(lfmt, "-");
+ if (flags & FLAG_ZERO)
+ (void)strcat(lfmt, "0");
+
+ /*
+ * Only the timespecs support the FLOAT output format, and that
+ * requires work that differs from the other formats.
+ */
+ if (ofmt == FMTF_FLOAT) {
+ /*
+ * Nothing after the decimal point, so just print seconds.
+ */
+ if (prec == 0) {
+ if (size != -1) {
+ (void)snprintf(tmp, sizeof(tmp), "%d", size);
+ (void)strcat(lfmt, tmp);
+ }
+ (void)strcat(lfmt, "lld");
+ return (snprintf(buf, blen, lfmt,
+ (long long)ts.tv_sec));
+ }
+
+ /*
+ * Unspecified precision gets all the precision we have:
+ * 9 digits.
+ */
+ if (prec == -1)
+ prec = 9;
+
+ /*
+ * Adjust the size for the decimal point and the digits
+ * that will follow.
+ */
+ size -= prec + 1;
+
+ /*
+ * Any leftover size that's legitimate will be used.
+ */
+ if (size > 0) {
+ (void)snprintf(tmp, sizeof(tmp), "%d", size);
+ (void)strcat(lfmt, tmp);
+ }
+ /* Seconds: time_t cast to long long. */
+ (void)strcat(lfmt, "lld");
+
+ /*
+ * The stuff after the decimal point always needs zero
+ * filling.
+ */
+ (void)strcat(lfmt, ".%0");
+
+ /*
+ * We can "print" at most nine digits of precision. The
+ * rest we will pad on at the end.
+ *
+ * Nanoseconds: long.
+ */
+ (void)snprintf(tmp, sizeof(tmp), "%dld", MIN(prec, 9));
+ (void)strcat(lfmt, tmp);
+
+ /*
+ * For precision of less that nine digits, trim off the
+ * less significant figures.
+ */
+ for (; prec < 9; prec++)
+ ts.tv_nsec /= 10;
+
+ /*
+ * Use the format, and then tack on any zeroes that
+ * might be required to make up the requested precision.
+ */
+ l = snprintf(buf, blen, lfmt, (long long)ts.tv_sec, ts.tv_nsec);
+ for (; prec > 9 && l < (int)blen; prec--, l++)
+ (void)strcat(buf, "0");
+ return (l);
+ }
+
+ /*
+ * Add on size and precision, if specified, to the format.
+ */
+ if (size != -1) {
+ (void)snprintf(tmp, sizeof(tmp), "%d", size);
+ (void)strcat(lfmt, tmp);
+ }
+ if (prec != -1) {
+ (void)snprintf(tmp, sizeof(tmp), ".%d", prec);
+ (void)strcat(lfmt, tmp);
+ }
+
+ /*
+ * String output uses the temporary sdata.
+ */
+ if (ofmt == FMTF_STRING) {
+ if (sdata == NULL)
+ errx(1, "%.*s: bad format", (int)flen, fmt);
+ (void)strcat(lfmt, "s");
+ return (snprintf(buf, blen, lfmt, sdata));
+ }
+
+ /*
+ * Ensure that sign extension does not cause bad looking output
+ * for some forms.
+ */
+ if (small && ofmt != FMTF_DECIMAL)
+ data = (u_int32_t)data;
+
+ /*
+ * The four "numeric" output forms.
+ */
+ (void)strcat(lfmt, "ll");
+ switch (ofmt) {
+ case FMTF_DECIMAL: (void)strcat(lfmt, "d"); break;
+ case FMTF_OCTAL: (void)strcat(lfmt, "o"); break;
+ case FMTF_UNSIGNED: (void)strcat(lfmt, "u"); break;
+ case FMTF_HEX: (void)strcat(lfmt, "x"); break;
+ }
+
+ 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/stdbuf/Makefile b/usr.bin/stdbuf/Makefile
new file mode 100644
index 0000000..8842a1f
--- /dev/null
+++ b/usr.bin/stdbuf/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= stdbuf
+SRCS= stdbuf.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/stdbuf/Makefile.depend b/usr.bin/stdbuf/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/stdbuf/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/stdbuf/stdbuf.1 b/usr.bin/stdbuf/stdbuf.1
new file mode 100644
index 0000000..37e569e
--- /dev/null
+++ b/usr.bin/stdbuf/stdbuf.1
@@ -0,0 +1,116 @@
+.\" Copyright (c) 2012 Jeremie Le Hen <jlh@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 and documentation 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 April 28, 2012
+.Dt STDBUF 1
+.Os
+.Sh NAME
+.Nm stdbuf
+.Nd change standard streams initial buffering
+.Sh SYNOPSIS
+.Nm
+.Op Fl e Ar bufdef
+.Op Fl i Ar bufdef
+.Op Fl o Ar bufdef
+.Op Ar command Op ...
+.Sh DESCRIPTION
+.Nm
+is used to change the initial buffering of standard input,
+standard output and/or standard error streams for
+.Ar command .
+It relies on
+.Xr libstdbuf 3
+which is loaded and configured by
+.Nm
+through environment variables.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl e Ar bufdef
+Set initial buffering of the standard error stream for
+.Ar command
+as defined by
+.Ar bufdef
+.Pq see Sx BUFFER DEFINITION .
+.It Fl i Ar bufdef
+Set initial buffering of the standard input stream for
+.Ar command
+as defined by
+.Ar bufdef
+.Pq see Sx BUFFER DEFINITION .
+.It Fl o Ar bufdef
+Set initial buffering of the standard output stream for
+.Ar command
+as defined by
+.Ar bufdef
+.Pq see Sx BUFFER DEFINITION .
+.El
+.Sh BUFFER DEFINITION
+Buffer definition is the same as in
+.Xr libstdbuf 3 :
+.Bl -tag -width size -offset indent
+.It Qq 0
+unbuffered
+.It Qq L
+line buffered
+.It Qq B
+fully buffered with the default buffer size
+.It Ar size
+fully buffered with a buffer of
+.Ar size
+bytes (suffixes 'k', 'M' and 'G' are accepted)
+.El
+.Sh EXAMPLES
+In the following example, the stdout stream of the
+.Xr awk 1
+command
+will be fully buffered by default because it does not refer
+to a terminal.
+.Nm
+is used to force it to be line-buffered so
+.Xr vmstat 8 Ns 's
+output will not stall until the full buffer fills.
+.Bd -literal -offset indent
+# vmstat 1 | stdbuf -o L awk '$2 > 1 || $3 > 1' | cat -n
+.Ed
+.Sh SEE ALSO
+.Xr libstdbuf 3 ,
+.Xr setvbuf 3
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 8.4 .
+.Sh AUTHORS
+.An -nosplit
+The original idea of the
+.Nm
+command comes from
+.An Padraig Brady
+who implemented it in the GNU coreutils.
+.An Jeremie Le Hen
+implemented it on
+.Fx .
diff --git a/usr.bin/stdbuf/stdbuf.c b/usr.bin/stdbuf/stdbuf.c
new file mode 100644
index 0000000..4346cc8
--- /dev/null
+++ b/usr.bin/stdbuf/stdbuf.c
@@ -0,0 +1,110 @@
+/*-
+ * Copyright (c) 2012 Jeremie Le Hen <jlh@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$
+ */
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define LIBSTDBUF "/usr/lib/libstdbuf.so"
+#define LIBSTDBUF32 "/usr/lib32/libstdbuf.so"
+
+extern char *__progname;
+
+static void
+usage(int s)
+{
+
+ fprintf(stderr, "Usage: %s [-e 0|L|<sz>] [-i 0|L|<sz>] [-o 0|L|<sz>] "
+ "<cmd> [args ...]\n", __progname);
+ exit(s);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *ibuf, *obuf, *ebuf;
+ char *preload0, *preload1;
+ int i;
+
+ ibuf = obuf = ebuf = NULL;
+ while ((i = getopt(argc, argv, "e:i:o:")) != -1) {
+ switch (i) {
+ case 'e':
+ ebuf = optarg;
+ break;
+ case 'i':
+ ibuf = optarg;
+ break;
+ case 'o':
+ obuf = optarg;
+ break;
+ case '?':
+ default:
+ usage(1);
+ break;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc == 0)
+ exit(0);
+
+ if (ibuf != NULL && setenv("_STDBUF_I", ibuf, 1) == -1)
+ warn("Failed to set environment variable: %s=%s",
+ "_STDBUF_I", ibuf);
+ if (obuf != NULL && setenv("_STDBUF_O", obuf, 1) == -1)
+ warn("Failed to set environment variable: %s=%s",
+ "_STDBUF_O", obuf);
+ if (ebuf != NULL && setenv("_STDBUF_E", ebuf, 1) == -1)
+ warn("Failed to set environment variable: %s=%s",
+ "_STDBUF_E", ebuf);
+
+ preload0 = getenv("LD_PRELOAD");
+ if (preload0 == NULL)
+ i = asprintf(&preload1, "LD_PRELOAD=" LIBSTDBUF);
+ else
+ i = asprintf(&preload1, "LD_PRELOAD=%s:%s", preload0,
+ LIBSTDBUF);
+
+ if (i < 0 || putenv(preload1) == -1)
+ warn("Failed to set environment variable: LD_PRELOAD");
+
+ preload0 = getenv("LD_32_PRELOAD");
+ if (preload0 == NULL)
+ i = asprintf(&preload1, "LD_32_PRELOAD=" LIBSTDBUF32);
+ else
+ i = asprintf(&preload1, "LD_32_PRELOAD=%s:%s", preload0,
+ LIBSTDBUF32);
+
+ if (i < 0 || putenv(preload1) == -1)
+ warn("Failed to set environment variable: LD_32_PRELOAD");
+
+ execvp(argv[0], argv);
+ err(2, "%s", argv[0]);
+}
diff --git a/usr.bin/strings/Makefile b/usr.bin/strings/Makefile
new file mode 100644
index 0000000..e3c82f4
--- /dev/null
+++ b/usr.bin/strings/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
+
+.PATH: ${ELFTCDIR}/strings
+
+PROG= strings
+
+LIBADD= elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/strings/Makefile.depend b/usr.bin/strings/Makefile.depend
new file mode 100644
index 0000000..40241f3
--- /dev/null
+++ b/usr.bin/strings/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libelftc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/su/Makefile b/usr.bin/su/Makefile
new file mode 100644
index 0000000..178e670
--- /dev/null
+++ b/usr.bin/su/Makefile
@@ -0,0 +1,21 @@
+# @(#)Makefile 8.1 (Berkeley) 7/19/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= su
+
+WARNS?= 5
+
+LIBADD= util pam
+
+.if ${MK_AUDIT} != "no"
+CFLAGS+= -DUSE_BSM_AUDIT
+LIBADD+= bsm
+.endif
+
+BINOWN= root
+BINMODE=4555
+PRECIOUSPROG=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/su/Makefile.depend b/usr.bin/su/Makefile.depend
new file mode 100644
index 0000000..85813bf
--- /dev/null
+++ b/usr.bin/su/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbsm \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libpam/libpam \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/su/su.1 b/usr.bin/su/su.1
new file mode 100644
index 0000000..9eb24d3
--- /dev/null
+++ b/usr.bin/su/su.1
@@ -0,0 +1,250 @@
+.\" Copyright (c) 1988, 1990, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)su.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd August 11, 2013
+.Dt SU 1
+.Os
+.Sh NAME
+.Nm su
+.Nd substitute user identity
+.Sh SYNOPSIS
+.Nm
+.Op Fl
+.Op Fl c Ar class
+.Op Fl flms
+.Op Ar login Op Ar args
+.Sh DESCRIPTION
+The
+.Nm
+utility requests appropriate user credentials via PAM
+and switches to that user ID
+(the default user is the superuser).
+A shell is then executed.
+.Pp
+PAM is used to set the policy
+.Xr su 1
+will use.
+In particular, by default only users in the
+.Dq Li wheel
+group can switch to UID 0
+.Pq Dq Li root .
+This group requirement may be changed by modifying the
+.Dq Li pam_group
+section of
+.Pa /etc/pam.d/su .
+See
+.Xr pam_group 8
+for details on how to modify this setting.
+.Pp
+By default, the environment is unmodified with the exception of
+.Ev USER ,
+.Ev HOME ,
+and
+.Ev SHELL .
+.Ev HOME
+and
+.Ev SHELL
+are set to the target login's default values.
+.Ev USER
+is set to the target login, unless the target login has a user ID of 0,
+in which case it is unmodified.
+The invoked shell is the one belonging to the target login.
+This is the traditional behavior of
+.Nm .
+Resource limits and session priority applicable to the original user's
+login class (see
+.Xr login.conf 5 )
+are also normally retained unless the target login has a user ID of 0.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl c Ar class
+Use the settings of the specified login class.
+The login class must be defined in
+.Xr login.conf 5 .
+Only allowed for the super-user.
+.It Fl f
+If the invoked shell is
+.Xr csh 1 ,
+this option prevents it from reading the
+.Dq Pa .cshrc
+file.
+.It Fl l
+Simulate a full login.
+The environment is discarded except for
+.Ev HOME ,
+.Ev SHELL ,
+.Ev PATH ,
+.Ev TERM ,
+and
+.Ev USER .
+.Ev HOME
+and
+.Ev SHELL
+are modified as above.
+.Ev USER
+is set to the target login.
+.Ev PATH
+is set to
+.Dq Pa /bin:/usr/bin .
+.Ev TERM
+is imported from your current environment.
+Environment variables may be set or overridden from the login class
+capabilities database according to the class of the target login.
+The invoked shell is the target login's, and
+.Nm
+will change directory to the target login's home directory.
+Resource limits and session priority are modified to that for the
+target account's login class.
+.It Fl
+(no letter) The same as
+.Fl l .
+.It Fl m
+Leave the environment unmodified.
+The invoked shell is your login shell, and no directory changes are made.
+As a security precaution, if the target user's shell is a non-standard
+shell (as defined by
+.Xr getusershell 3 )
+and the caller's real uid is
+non-zero,
+.Nm
+will fail.
+.It Fl s
+Set the MAC label to the user's default label as part of the user
+credential setup.
+Setting the MAC label may fail if the MAC label of the invoking process
+is not sufficient to transition to the user's default MAC label.
+If the label cannot be set,
+.Nm
+will fail.
+.El
+.Pp
+The
+.Fl l
+(or
+.Fl )
+and
+.Fl m
+options are mutually exclusive; the last one specified
+overrides any previous ones.
+.Pp
+If the optional
+.Ar args
+are provided on the command line, they are passed to the login shell of
+the target login.
+Note that all command line arguments before the target login name are
+processed by
+.Nm
+itself, everything after the target login name gets passed to the login
+shell.
+.Pp
+By default (unless the prompt is reset by a startup file) the super-user
+prompt is set to
+.Dq Sy \&#
+to remind one of its awesome power.
+.Sh ENVIRONMENT
+Environment variables used by
+.Nm :
+.Bl -tag -width HOME
+.It Ev HOME
+Default home directory of real user ID unless modified as
+specified above.
+.It Ev PATH
+Default search path of real user ID unless modified as specified above.
+.It Ev TERM
+Provides terminal type which may be retained for the substituted
+user ID.
+.It Ev USER
+The user ID is always the effective ID (the target user ID) after an
+.Nm
+unless the user ID is 0 (root).
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/pam.d/su" -compact
+.It Pa /etc/pam.d/su
+PAM configuration for
+.Nm .
+.El
+.Sh EXAMPLES
+.Bl -tag -width 5n -compact
+.It Li "su -m man -c catman"
+Starts a shell as user
+.Li man ,
+and runs the command
+.Li catman .
+You will be asked for man's password unless your real UID is 0.
+Note that the
+.Fl m
+option is required since user
+.Dq man
+does not have a valid shell by default.
+In this example,
+.Fl c
+is passed to the shell of the user
+.Dq man ,
+and is not interpreted as an argument to
+.Nm .
+.It Li "su -m man -c 'catman /usr/share/man /usr/local/man'"
+Same as above, but the target command consists of more than a
+single word and hence is quoted for use with the
+.Fl c
+option being passed to the shell.
+(Most shells expect the argument to
+.Fl c
+to be a single word).
+.It Li "su -m -c staff man -c 'catman /usr/share/man /usr/local/man'"
+Same as above, but the target command is run with the resource limits of
+the login class
+.Dq staff .
+Note: in this example, the first
+.Fl c
+option applies to
+.Nm
+while the second is an argument to the shell being invoked.
+.It Li "su -l foo"
+Simulate a login for user foo.
+.It Li "su - foo"
+Same as above.
+.It Li "su -"
+Simulate a login for root.
+.El
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr sh 1 ,
+.Xr group 5 ,
+.Xr login.conf 5 ,
+.Xr passwd 5 ,
+.Xr environ 7 ,
+.Xr pam_group 8
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
new file mode 100644
index 0000000..e721e62
--- /dev/null
+++ b/usr.bin/su/su.c
@@ -0,0 +1,642 @@
+/*
+ * Copyright (c) 2002, 2005 Networks Associates Technologies, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * 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.
+ */
+/*-
+ * Copyright (c) 1988, 1993, 1994
+ * 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) 1988, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+
+#ifdef USE_BSM_AUDIT
+#include <bsm/libbsm.h>
+#include <bsm/audit_uevents.h>
+#endif
+
+#include <err.h>
+#include <errno.h>
+#include <grp.h>
+#include <login_cap.h>
+#include <paths.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+#include <security/pam_appl.h>
+#include <security/openpam.h>
+
+#define PAM_END() do { \
+ int local_ret; \
+ if (pamh != NULL) { \
+ local_ret = pam_setcred(pamh, PAM_DELETE_CRED); \
+ if (local_ret != PAM_SUCCESS) \
+ syslog(LOG_ERR, "pam_setcred: %s", \
+ pam_strerror(pamh, local_ret)); \
+ if (asthem) { \
+ local_ret = pam_close_session(pamh, 0); \
+ if (local_ret != PAM_SUCCESS) \
+ syslog(LOG_ERR, "pam_close_session: %s",\
+ pam_strerror(pamh, local_ret)); \
+ } \
+ local_ret = pam_end(pamh, local_ret); \
+ if (local_ret != PAM_SUCCESS) \
+ syslog(LOG_ERR, "pam_end: %s", \
+ pam_strerror(pamh, local_ret)); \
+ } \
+} while (0)
+
+
+#define PAM_SET_ITEM(what, item) do { \
+ int local_ret; \
+ local_ret = pam_set_item(pamh, what, item); \
+ if (local_ret != PAM_SUCCESS) { \
+ syslog(LOG_ERR, "pam_set_item(" #what "): %s", \
+ pam_strerror(pamh, local_ret)); \
+ errx(1, "pam_set_item(" #what "): %s", \
+ pam_strerror(pamh, local_ret)); \
+ /* NOTREACHED */ \
+ } \
+} while (0)
+
+enum tristate { UNSET, YES, NO };
+
+static pam_handle_t *pamh = NULL;
+static char **environ_pam;
+
+static char *ontty(void);
+static int chshell(const char *);
+static void usage(void) __dead2;
+static void export_pam_environment(void);
+static int ok_to_export(const char *);
+
+extern char **environ;
+
+int
+main(int argc, char *argv[])
+{
+ static char *cleanenv;
+ struct passwd *pwd = NULL;
+ struct pam_conv conv = { openpam_ttyconv, NULL };
+ enum tristate iscsh;
+ login_cap_t *lc;
+ union {
+ const char **a;
+ char * const *b;
+ } np;
+ uid_t ruid;
+ pid_t child_pid, child_pgrp, pid;
+ int asme, ch, asthem, fastlogin, prio, i, retcode,
+ statusp, setmaclabel;
+ u_int setwhat;
+ char *username, *class, shellbuf[MAXPATHLEN];
+ const char *p, *user, *shell, *mytty, **nargv;
+ const void *v;
+ struct sigaction sa, sa_int, sa_quit, sa_pipe;
+ int temp, fds[2];
+#ifdef USE_BSM_AUDIT
+ const char *aerr;
+ au_id_t auid;
+#endif
+
+ shell = class = cleanenv = NULL;
+ asme = asthem = fastlogin = statusp = 0;
+ user = "root";
+ iscsh = UNSET;
+ setmaclabel = 0;
+
+ while ((ch = getopt(argc, argv, "-flmsc:")) != -1)
+ switch ((char)ch) {
+ case 'f':
+ fastlogin = 1;
+ break;
+ case '-':
+ case 'l':
+ asme = 0;
+ asthem = 1;
+ break;
+ case 'm':
+ asme = 1;
+ asthem = 0;
+ break;
+ case 's':
+ setmaclabel = 1;
+ break;
+ case 'c':
+ class = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ if (optind < argc)
+ user = argv[optind++];
+
+ if (user == NULL)
+ usage();
+ /* NOTREACHED */
+
+ /*
+ * Try to provide more helpful debugging output if su(1) is running
+ * non-setuid, or was run from a file system not mounted setuid.
+ */
+ if (geteuid() != 0)
+ errx(1, "not running setuid");
+
+#ifdef USE_BSM_AUDIT
+ if (getauid(&auid) < 0 && errno != ENOSYS) {
+ syslog(LOG_AUTH | LOG_ERR, "getauid: %s", strerror(errno));
+ errx(1, "Permission denied");
+ }
+#endif
+ if (strlen(user) > MAXLOGNAME - 1) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid,
+ EPERM, 1, "username too long: '%s'", user))
+ errx(1, "Permission denied");
+#endif
+ errx(1, "username too long");
+ }
+
+ nargv = malloc(sizeof(char *) * (size_t)(argc + 4));
+ if (nargv == NULL)
+ errx(1, "malloc failure");
+
+ nargv[argc + 3] = NULL;
+ for (i = argc; i >= optind; i--)
+ nargv[i + 3] = argv[i];
+ np.a = &nargv[i + 3];
+
+ argv += optind;
+
+ errno = 0;
+ prio = getpriority(PRIO_PROCESS, 0);
+ if (errno)
+ prio = 0;
+
+ setpriority(PRIO_PROCESS, 0, -2);
+ openlog("su", LOG_CONS, LOG_AUTH);
+
+ /* get current login name, real uid and shell */
+ ruid = getuid();
+ username = getlogin();
+ if (username != NULL)
+ pwd = getpwnam(username);
+ if (pwd == NULL || pwd->pw_uid != ruid)
+ pwd = getpwuid(ruid);
+ if (pwd == NULL) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, EPERM, 1,
+ "unable to determine invoking subject: '%s'", username))
+ errx(1, "Permission denied");
+#endif
+ errx(1, "who are you?");
+ }
+
+ username = strdup(pwd->pw_name);
+ if (username == NULL)
+ err(1, "strdup failure");
+
+ if (asme) {
+ if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') {
+ /* must copy - pwd memory is recycled */
+ shell = strncpy(shellbuf, pwd->pw_shell,
+ sizeof(shellbuf));
+ shellbuf[sizeof(shellbuf) - 1] = '\0';
+ }
+ else {
+ shell = _PATH_BSHELL;
+ iscsh = NO;
+ }
+ }
+
+ /* Do the whole PAM startup thing */
+ retcode = pam_start("su", user, &conv, &pamh);
+ if (retcode != PAM_SUCCESS) {
+ syslog(LOG_ERR, "pam_start: %s", pam_strerror(pamh, retcode));
+ errx(1, "pam_start: %s", pam_strerror(pamh, retcode));
+ }
+
+ PAM_SET_ITEM(PAM_RUSER, username);
+
+ mytty = ttyname(STDERR_FILENO);
+ if (!mytty)
+ mytty = "tty";
+ PAM_SET_ITEM(PAM_TTY, mytty);
+
+ retcode = pam_authenticate(pamh, 0);
+ if (retcode != PAM_SUCCESS) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, EPERM, 1, "bad su %s to %s on %s",
+ username, user, mytty))
+ errx(1, "Permission denied");
+#endif
+ syslog(LOG_AUTH|LOG_WARNING, "BAD SU %s to %s on %s",
+ username, user, mytty);
+ errx(1, "Sorry");
+ }
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, 0, 0, "successful authentication"))
+ errx(1, "Permission denied");
+#endif
+ retcode = pam_get_item(pamh, PAM_USER, &v);
+ if (retcode == PAM_SUCCESS)
+ user = v;
+ else
+ syslog(LOG_ERR, "pam_get_item(PAM_USER): %s",
+ pam_strerror(pamh, retcode));
+ pwd = getpwnam(user);
+ if (pwd == NULL) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, EPERM, 1,
+ "unknown subject: %s", user))
+ errx(1, "Permission denied");
+#endif
+ errx(1, "unknown login: %s", user);
+ }
+
+ retcode = pam_acct_mgmt(pamh, 0);
+ if (retcode == PAM_NEW_AUTHTOK_REQD) {
+ retcode = pam_chauthtok(pamh,
+ PAM_CHANGE_EXPIRED_AUTHTOK);
+ if (retcode != PAM_SUCCESS) {
+#ifdef USE_BSM_AUDIT
+ aerr = pam_strerror(pamh, retcode);
+ if (aerr == NULL)
+ aerr = "Unknown PAM error";
+ if (audit_submit(AUE_su, auid, EPERM, 1,
+ "pam_chauthtok: %s", aerr))
+ errx(1, "Permission denied");
+#endif
+ syslog(LOG_ERR, "pam_chauthtok: %s",
+ pam_strerror(pamh, retcode));
+ errx(1, "Sorry");
+ }
+ }
+ if (retcode != PAM_SUCCESS) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, EPERM, 1, "pam_acct_mgmt: %s",
+ pam_strerror(pamh, retcode)))
+ errx(1, "Permission denied");
+#endif
+ syslog(LOG_ERR, "pam_acct_mgmt: %s",
+ pam_strerror(pamh, retcode));
+ errx(1, "Sorry");
+ }
+
+ /* get target login information */
+ if (class == NULL)
+ lc = login_getpwclass(pwd);
+ else {
+ if (ruid != 0) {
+#ifdef USE_BSM_AUDIT
+ if (audit_submit(AUE_su, auid, EPERM, 1,
+ "only root may use -c"))
+ errx(1, "Permission denied");
+#endif
+ errx(1, "only root may use -c");
+ }
+ lc = login_getclass(class);
+ if (lc == NULL)
+ err(1, "login_getclass");
+ if (lc->lc_class == NULL || strcmp(class, lc->lc_class) != 0)
+ errx(1, "unknown class: %s", class);
+ }
+
+ /* if asme and non-standard target shell, must be root */
+ if (asme) {
+ if (ruid != 0 && !chshell(pwd->pw_shell))
+ errx(1, "permission denied (shell)");
+ }
+ else if (pwd->pw_shell && *pwd->pw_shell) {
+ shell = pwd->pw_shell;
+ iscsh = UNSET;
+ }
+ else {
+ shell = _PATH_BSHELL;
+ iscsh = NO;
+ }
+
+ /* if we're forking a csh, we want to slightly muck the args */
+ if (iscsh == UNSET) {
+ p = strrchr(shell, '/');
+ if (p)
+ ++p;
+ else
+ p = shell;
+ iscsh = strcmp(p, "csh") ? (strcmp(p, "tcsh") ? NO : YES) : YES;
+ }
+ setpriority(PRIO_PROCESS, 0, prio);
+
+ /*
+ * PAM modules might add supplementary groups in pam_setcred(), so
+ * initialize them first.
+ */
+ if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0)
+ err(1, "setusercontext");
+
+ retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
+ if (retcode != PAM_SUCCESS) {
+ syslog(LOG_ERR, "pam_setcred: %s",
+ pam_strerror(pamh, retcode));
+ errx(1, "failed to establish credentials.");
+ }
+ if (asthem) {
+ retcode = pam_open_session(pamh, 0);
+ if (retcode != PAM_SUCCESS) {
+ syslog(LOG_ERR, "pam_open_session: %s",
+ pam_strerror(pamh, retcode));
+ errx(1, "failed to open session.");
+ }
+ }
+
+ /*
+ * We must fork() before setuid() because we need to call
+ * pam_setcred(pamh, PAM_DELETE_CRED) as root.
+ */
+ sa.sa_flags = SA_RESTART;
+ sa.sa_handler = SIG_IGN;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, &sa_int);
+ sigaction(SIGQUIT, &sa, &sa_quit);
+ sigaction(SIGPIPE, &sa, &sa_pipe);
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGTSTP, &sa, NULL);
+ statusp = 1;
+ if (pipe(fds) == -1) {
+ PAM_END();
+ err(1, "pipe");
+ }
+ child_pid = fork();
+ switch (child_pid) {
+ default:
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGTTOU, &sa, NULL);
+ close(fds[0]);
+ setpgid(child_pid, child_pid);
+ if (tcgetpgrp(STDERR_FILENO) == getpgrp())
+ tcsetpgrp(STDERR_FILENO, child_pid);
+ close(fds[1]);
+ sigaction(SIGPIPE, &sa_pipe, NULL);
+ while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
+ if (WIFSTOPPED(statusp)) {
+ child_pgrp = getpgid(child_pid);
+ if (tcgetpgrp(STDERR_FILENO) == child_pgrp)
+ tcsetpgrp(STDERR_FILENO, getpgrp());
+ kill(getpid(), SIGSTOP);
+ if (tcgetpgrp(STDERR_FILENO) == getpgrp()) {
+ child_pgrp = getpgid(child_pid);
+ tcsetpgrp(STDERR_FILENO, child_pgrp);
+ }
+ kill(child_pid, SIGCONT);
+ statusp = 1;
+ continue;
+ }
+ break;
+ }
+ tcsetpgrp(STDERR_FILENO, getpgrp());
+ if (pid == -1)
+ err(1, "waitpid");
+ PAM_END();
+ exit(WEXITSTATUS(statusp));
+ case -1:
+ PAM_END();
+ err(1, "fork");
+ case 0:
+ close(fds[1]);
+ read(fds[0], &temp, 1);
+ close(fds[0]);
+ sigaction(SIGPIPE, &sa_pipe, NULL);
+ sigaction(SIGINT, &sa_int, NULL);
+ sigaction(SIGQUIT, &sa_quit, NULL);
+
+ /*
+ * Set all user context except for: Environmental variables
+ * Umask Login records (wtmp, etc) Path
+ */
+ setwhat = LOGIN_SETALL & ~(LOGIN_SETENV | LOGIN_SETUMASK |
+ LOGIN_SETLOGIN | LOGIN_SETPATH | LOGIN_SETGROUP |
+ LOGIN_SETMAC);
+ /*
+ * If -s is present, also set the MAC label.
+ */
+ if (setmaclabel)
+ setwhat |= LOGIN_SETMAC;
+ /*
+ * Don't touch resource/priority settings if -m has been used
+ * or -l and -c hasn't, and we're not su'ing to root.
+ */
+ if ((asme || (!asthem && class == NULL)) && pwd->pw_uid)
+ setwhat &= ~(LOGIN_SETPRIORITY | LOGIN_SETRESOURCES);
+ if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0)
+ err(1, "setusercontext");
+
+ if (!asme) {
+ if (asthem) {
+ p = getenv("TERM");
+ environ = &cleanenv;
+ }
+
+ if (asthem || pwd->pw_uid)
+ setenv("USER", pwd->pw_name, 1);
+ setenv("HOME", pwd->pw_dir, 1);
+ setenv("SHELL", shell, 1);
+
+ if (asthem) {
+ /*
+ * Add any environmental variables that the
+ * PAM modules may have set.
+ */
+ environ_pam = pam_getenvlist(pamh);
+ if (environ_pam)
+ export_pam_environment();
+
+ /* set the su'd user's environment & umask */
+ setusercontext(lc, pwd, pwd->pw_uid,
+ LOGIN_SETPATH | LOGIN_SETUMASK |
+ LOGIN_SETENV);
+ if (p)
+ setenv("TERM", p, 1);
+
+ p = pam_getenv(pamh, "HOME");
+ if (chdir(p ? p : pwd->pw_dir) < 0)
+ errx(1, "no directory");
+ }
+ }
+ login_close(lc);
+
+ if (iscsh == YES) {
+ if (fastlogin)
+ *np.a-- = "-f";
+ if (asme)
+ *np.a-- = "-m";
+ }
+ /* csh strips the first character... */
+ *np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su";
+
+ if (ruid != 0)
+ syslog(LOG_NOTICE, "%s to %s%s", username, user,
+ ontty());
+
+ execv(shell, np.b);
+ err(1, "%s", shell);
+ }
+}
+
+static void
+export_pam_environment(void)
+{
+ char **pp;
+ char *p;
+
+ for (pp = environ_pam; *pp != NULL; pp++) {
+ if (ok_to_export(*pp)) {
+ p = strchr(*pp, '=');
+ *p = '\0';
+ setenv(*pp, p + 1, 1);
+ }
+ free(*pp);
+ }
+}
+
+/*
+ * Sanity checks on PAM environmental variables:
+ * - Make sure there is an '=' in the string.
+ * - Make sure the string doesn't run on too long.
+ * - Do not export certain variables. This list was taken from the
+ * Solaris pam_putenv(3) man page.
+ * Note that if the user is chrooted, PAM may have a better idea than we
+ * do of where her home directory is.
+ */
+static int
+ok_to_export(const char *s)
+{
+ static const char *noexport[] = {
+ "SHELL", /* "HOME", */ "LOGNAME", "MAIL", "CDPATH",
+ "IFS", "PATH", NULL
+ };
+ const char **pp;
+ size_t n;
+
+ if (strlen(s) > 1024 || strchr(s, '=') == NULL)
+ return 0;
+ if (strncmp(s, "LD_", 3) == 0)
+ return 0;
+ for (pp = noexport; *pp != NULL; pp++) {
+ n = strlen(*pp);
+ if (s[n] == '=' && strncmp(s, *pp, n) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: su [-] [-flms] [-c class] [login [args]]\n");
+ exit(1);
+ /* NOTREACHED */
+}
+
+static int
+chshell(const char *sh)
+{
+ int r;
+ char *cp;
+
+ r = 0;
+ setusershell();
+ while ((cp = getusershell()) != NULL && !r)
+ r = (strcmp(cp, sh) == 0);
+ endusershell();
+ return r;
+}
+
+static char *
+ontty(void)
+{
+ char *p;
+ static char buf[MAXPATHLEN + 4];
+
+ buf[0] = 0;
+ p = ttyname(STDERR_FILENO);
+ if (p)
+ snprintf(buf, sizeof(buf), " on %s", p);
+ return buf;
+}
diff --git a/usr.bin/svn/Makefile b/usr.bin/svn/Makefile
new file mode 100644
index 0000000..cafa47d
--- /dev/null
+++ b/usr.bin/svn/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+SUBDIR= lib .WAIT \
+ svn svnadmin svnbench svndumpfilter svnfsfs svnlook svnserve \
+ svnsync svnversion svnmucc svnrdump
+SUBDIR_PARALLEL=
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/svn/Makefile.inc b/usr.bin/svn/Makefile.inc
new file mode 100644
index 0000000..7404de4
--- /dev/null
+++ b/usr.bin/svn/Makefile.inc
@@ -0,0 +1,62 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+.if ${MK_SVN} == "yes"
+SVNLITE?=
+.else
+SVNLITE?= lite
+.endif
+
+PACKAGE= svn
+
+.if !defined(SVNDIR)
+
+SVNDIR= ${.CURDIR}/../../../contrib/subversion/subversion
+APRU= ${.CURDIR}/../../../contrib/apr-util
+APR= ${.CURDIR}/../../../contrib/apr
+WARNS?= 0 # definitely not warns friendly
+
+.if exists(${.CURDIR}/../../Makefile.inc)
+.include "${.CURDIR}/../../Makefile.inc"
+.endif
+
+LIBAPRDIR= ${.OBJDIR}/../lib/libapr
+LIBAPR_UTILDIR= ${.OBJDIR}/../lib/libapr_util
+LIBSERFDIR= ${.OBJDIR}/../lib/libserf
+
+LIBSVN_CLIENTDIR= ${.OBJDIR}/../lib/libsvn_client
+LIBSVN_DELTADIR= ${.OBJDIR}/../lib/libsvn_delta
+LIBSVN_DIFFDIR= ${.OBJDIR}/../lib/libsvn_diff
+LIBSVN_FSDIR= ${.OBJDIR}/../lib/libsvn_fs
+LIBSVN_FS_FSDIR= ${.OBJDIR}/../lib/libsvn_fs_fs
+LIBSVN_FS_UTILDIR= ${.OBJDIR}/../lib/libsvn_fs_util
+LIBSVN_FS_XDIR= ${.OBJDIR}/../lib/libsvn_fs_x
+LIBSVN_RADIR= ${.OBJDIR}/../lib/libsvn_ra
+LIBSVN_RA_LOCALDIR= ${.OBJDIR}/../lib/libsvn_ra_local
+LIBSVN_RA_SVNDIR= ${.OBJDIR}/../lib/libsvn_ra_svn
+LIBSVN_RA_SERFDIR= ${.OBJDIR}/../lib/libsvn_ra_serf
+LIBSVN_REPOSDIR= ${.OBJDIR}/../lib/libsvn_repos
+LIBSVN_SUBRDIR= ${.OBJDIR}/../lib/libsvn_subr
+LIBSVN_WCDIR= ${.OBJDIR}/../lib/libsvn_wc
+
+LIBAPR= ${LIBAPRDIR}/libapr.a
+LIBAPR_UTIL= ${LIBAPR_UTILDIR}/libapr-util.a
+LIBSERF= ${LIBSERFDIR}/libserf.a
+
+LIBSVN_CLIENT= ${LIBSVN_CLIENTDIR}/libsvn_client.a
+LIBSVN_DELTA= ${LIBSVN_DELTADIR}/libsvn_delta.a
+LIBSVN_DIFF= ${LIBSVN_DIFFDIR}/libsvn_diff.a
+LIBSVN_FS= ${LIBSVN_FSDIR}/libsvn_fs.a
+LIBSVN_FS_FS= ${LIBSVN_FS_FSDIR}/libsvn_fs_fs.a
+LIBSVN_FS_UTIL= ${LIBSVN_FS_UTILDIR}/libsvn_fs_util.a
+LIBSVN_FS_X= ${LIBSVN_FS_XDIR}/libsvn_fs_x.a
+LIBSVN_RA= ${LIBSVN_RADIR}/libsvn_ra.a
+LIBSVN_RA_LOCAL= ${LIBSVN_RA_LOCALDIR}/libsvn_ra_local.a
+LIBSVN_RA_SVN= ${LIBSVN_RA_SVNDIR}/libsvn_ra_svn.a
+LIBSVN_RA_SERF= ${LIBSVN_RA_SERFDIR}/libsvn_ra_serf.a
+LIBSVN_REPOS= ${LIBSVN_REPOSDIR}/libsvn_repos.a
+LIBSVN_SUBR= ${LIBSVN_SUBRDIR}/libsvn_subr.a
+LIBSVN_WC= ${LIBSVN_WCDIR}/libsvn_wc.a
+
+.endif
diff --git a/usr.bin/svn/expat.h b/usr.bin/svn/expat.h
new file mode 100644
index 0000000..a501ce3
--- /dev/null
+++ b/usr.bin/svn/expat.h
@@ -0,0 +1,4 @@
+/* $FreeBSD$ */
+
+/* Hack to avoid changing vendor code */
+#include <bsdxml.h>
diff --git a/usr.bin/svn/lib/Makefile b/usr.bin/svn/lib/Makefile
new file mode 100644
index 0000000..fd3ad85
--- /dev/null
+++ b/usr.bin/svn/lib/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+SUBDIR= libapr libapr_util libserf \
+ libsvn_client libsvn_delta libsvn_diff libsvn_fs libsvn_fs_fs \
+ libsvn_fs_util libsvn_fs_x libsvn_ra libsvn_ra_local libsvn_ra_serf \
+ libsvn_ra_svn libsvn_repos libsvn_subr libsvn_wc
+SUBDIR_PARALLEL=
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/svn/lib/Makefile.inc b/usr.bin/svn/lib/Makefile.inc
new file mode 100644
index 0000000..74a455c
--- /dev/null
+++ b/usr.bin/svn/lib/Makefile.inc
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+.if !defined(SVNDIR)
+
+SVNDIR= ${.CURDIR}/../../../../contrib/subversion/subversion
+APRU= ${.CURDIR}/../../../../contrib/apr-util
+APR= ${.CURDIR}/../../../../contrib/apr
+SQLITE= ${.CURDIR}/../../../../contrib/sqlite3
+SERF= ${.CURDIR}/../../../../contrib/serf
+
+WARNS?= 0 # definitely not ready
+
+.if exists(${.CURDIR}/../../../Makefile.inc)
+.include "${.CURDIR}/../../../Makefile.inc"
+.endif
+
+.endif
diff --git a/usr.bin/svn/lib/libapr/Makefile b/usr.bin/svn/lib/libapr/Makefile
new file mode 100644
index 0000000..7dff95c
--- /dev/null
+++ b/usr.bin/svn/lib/libapr/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+INTERNALLIB= yes
+LIB= apr
+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 \
+ epoll.c errorcodes.c fileacc.c filedup.c filepath.c \
+ filepath_util.c filestat.c flock.c fullrw.c getopt.c \
+ global_mutex.c groupinfo.c ia32.c inet_ntop.c inet_pton.c \
+ kqueue.c mktemp.c mmap.c multicast.c mutex.c open.c \
+ otherchild.c pipe.c poll.c pollcb.c pollset.c port.c \
+ ppc.c proc.c proc_mutex.c procsup.c rand.c readwrite.c \
+ s390.c seek.c select.c sendrecv.c sha2.c sha2_glue.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 z_asio.c
+
+.PATH: ${APR}/atomic/unix ${APR}/dso/unix ${APR}/file_io/unix \
+ ${APR}/locks/unix ${APR}/memory/unix ${APR}/misc/unix \
+ ${APR}/mmap/unix ${APR}/network_io/unix ${APR}/passwd \
+ ${APR}/poll/unix ${APR}/random/unix ${APR}/shmem/unix \
+ ${APR}/strings ${APR}/support/unix ${APR}/tables \
+ ${APR}/threadproc/unix ${APR}/time/unix ${APR}/user/unix \
+ ${APR}/include
+
+CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR} \
+ -I${APR}/include/arch/unix -I${APR}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libapr/Makefile.depend b/usr.bin/svn/lib/libapr/Makefile.depend
new file mode 100644
index 0000000..bbe68e0
--- /dev/null
+++ b/usr.bin/svn/lib/libapr/Makefile.depend
@@ -0,0 +1,15 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libapr/apr.h b/usr.bin/svn/lib/libapr/apr.h
new file mode 100644
index 0000000..5855147
--- /dev/null
+++ b/usr.bin/svn/lib/libapr/apr.h
@@ -0,0 +1,660 @@
+/* $FreeBSD$ */
+
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef APR_H
+#define APR_H
+
+/* GENERATED FILE WARNING! DO NOT EDIT apr.h
+ *
+ * You must modify apr.h.in instead.
+ *
+ * And please, make an effort to stub apr.hw and apr.hnw in the process.
+ */
+
+/**
+ * @file apr.h
+ * @brief APR Platform Definitions
+ * @remark This is a generated header generated from include/apr.h.in by
+ * ./configure, or copied from include/apr.hw or include/apr.hnw
+ * for Win32 or Netware by those build environments, respectively.
+ */
+
+/**
+ * @defgroup APR Apache Portability Runtime library
+ * @{
+ */
+/**
+ * @defgroup apr_platform Platform Definitions
+ * @{
+ * @warning
+ * <strong><em>The actual values of macros and typedefs on this page<br>
+ * are platform specific and should NOT be relied upon!</em></strong>
+ */
+
+/* So that we can use inline on some critical functions, and use
+ * GNUC attributes (such as to get -Wall warnings for printf-like
+ * functions). Only do this in gcc 2.7 or later ... it may work
+ * on earlier stuff, but why chance it.
+ *
+ * We've since discovered that the gcc shipped with NeXT systems
+ * as "cc" is completely broken. It claims to be __GNUC__ and so
+ * on, but it doesn't implement half of the things that __GNUC__
+ * means. In particular it's missing inline and the __attribute__
+ * stuff. So we hack around it. PR#1613. -djg
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
+ defined(NEXT)
+#ifndef __attribute__
+#define __attribute__(__x)
+#endif
+#define APR_INLINE
+#define APR_HAS_INLINE 0
+#else
+#define APR_INLINE __inline__
+#define APR_HAS_INLINE 1
+#endif
+
+#define APR_HAVE_ARPA_INET_H 1
+#define APR_HAVE_CONIO_H 0
+#define APR_HAVE_CRYPT_H 0
+#define APR_HAVE_CTYPE_H 1
+#define APR_HAVE_DIRENT_H 1
+#define APR_HAVE_ERRNO_H 1
+#define APR_HAVE_FCNTL_H 1
+#define APR_HAVE_IO_H 0
+#define APR_HAVE_LIMITS_H 1
+#define APR_HAVE_NETDB_H 1
+#define APR_HAVE_NETINET_IN_H 1
+#define APR_HAVE_NETINET_SCTP_H 1
+#define APR_HAVE_NETINET_SCTP_UIO_H 1
+#define APR_HAVE_NETINET_TCP_H 1
+#define APR_HAVE_PROCESS_H 0
+#define APR_HAVE_PTHREAD_H 1
+#define APR_HAVE_SEMAPHORE_H 1
+#define APR_HAVE_SIGNAL_H 1
+#define APR_HAVE_STDARG_H 1
+#define APR_HAVE_STDINT_H 1
+#define APR_HAVE_STDIO_H 1
+#define APR_HAVE_STDLIB_H 1
+#define APR_HAVE_STRING_H 1
+#define APR_HAVE_STRINGS_H 1
+#define APR_HAVE_SYS_IOCTL_H 1
+#define APR_HAVE_SYS_SENDFILE_H 0
+#define APR_HAVE_SYS_SIGNAL_H 1
+#define APR_HAVE_SYS_SOCKET_H 1
+#define APR_HAVE_SYS_SOCKIO_H 1
+#define APR_HAVE_SYS_SYSLIMITS_H 1
+#define APR_HAVE_SYS_TIME_H 1
+#define APR_HAVE_SYS_TYPES_H 1
+#define APR_HAVE_SYS_UIO_H 1
+#define APR_HAVE_SYS_UN_H 1
+#define APR_HAVE_SYS_WAIT_H 1
+#define APR_HAVE_TIME_H 1
+#define APR_HAVE_UNISTD_H 1
+#define APR_HAVE_WINDOWS_H 0
+#define APR_HAVE_WINSOCK2_H 0
+
+/** @} */
+/** @} */
+
+/* We don't include our conditional headers within the doxyblocks
+ * or the extern "C" namespace
+ */
+
+#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.
+ */
+#ifndef _WINDOWS_
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifndef _WIN32_WINNT
+/* Restrict the server to a subset of Windows XP header files by default
+ */
+#define _WIN32_WINNT 0x0501
+#endif
+
+#ifndef NOUSER
+#define NOUSER
+#endif
+#ifndef NOMCX
+#define NOMCX
+#endif
+#ifndef NOIME
+#define NOIME
+#endif
+
+#include <windows.h>
+/*
+ * Add a _very_few_ declarations missing from the restricted set of headers
+ * (If this list becomes extensive, re-enable the required headers above!)
+ * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
+ */
+#define SW_HIDE 0
+#ifndef _WIN32_WCE
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <mswsock.h>
+#else
+#include <winsock.h>
+#endif
+
+#endif /* ndef _WINDOWS_ */
+#endif /* APR_HAVE_WINDOWS_H */
+
+#if APR_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if APR_HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
+/* C99 7.18.4 requires that stdint.h only exposes INT64_C
+ * and UINT64_C for C++ implementations if this is defined: */
+#define __STDC_CONSTANT_MACROS
+#endif
+
+#if APR_HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#if APR_HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef OS2
+#define INCL_DOS
+#define INCL_DOSERRORS
+#include <os2.h>
+#endif
+
+/* header files for PATH_MAX, _POSIX_PATH_MAX */
+#if APR_HAVE_LIMITS_H
+#include <limits.h>
+#else
+#if APR_HAVE_SYS_SYSLIMITS_H
+#include <sys/syslimits.h>
+#endif
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup apr_platform
+ * @ingroup APR
+ * @{
+ */
+
+#define APR_HAVE_SHMEM_MMAP_TMP 1
+#define APR_HAVE_SHMEM_MMAP_SHM 1
+#define APR_HAVE_SHMEM_MMAP_ZERO 1
+#define APR_HAVE_SHMEM_SHMGET_ANON 1
+#define APR_HAVE_SHMEM_SHMGET 1
+#define APR_HAVE_SHMEM_MMAP_ANON 1
+#define APR_HAVE_SHMEM_BEOS 0
+
+#define APR_USE_SHMEM_MMAP_TMP 0
+#define APR_USE_SHMEM_MMAP_SHM 1
+#define APR_USE_SHMEM_MMAP_ZERO 0
+#define APR_USE_SHMEM_SHMGET_ANON 0
+#define APR_USE_SHMEM_SHMGET 0
+#define APR_USE_SHMEM_MMAP_ANON 1
+#define APR_USE_SHMEM_BEOS 0
+
+#define APR_USE_FLOCK_SERIALIZE 1
+#define APR_USE_SYSVSEM_SERIALIZE 0
+#define APR_USE_POSIXSEM_SERIALIZE 0
+#define APR_USE_FCNTL_SERIALIZE 0
+#define APR_USE_PROC_PTHREAD_SERIALIZE 0
+#define APR_USE_PTHREAD_SERIALIZE 1
+
+#define APR_HAS_FLOCK_SERIALIZE 1
+#define APR_HAS_SYSVSEM_SERIALIZE 1
+#define APR_HAS_POSIXSEM_SERIALIZE 1
+#define APR_HAS_FCNTL_SERIALIZE 1
+#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
+
+#define APR_PROCESS_LOCK_IS_GLOBAL 0
+
+#define APR_HAVE_CORKABLE_TCP 1
+#define APR_HAVE_GETRLIMIT 1
+#define APR_HAVE_IN_ADDR 1
+#define APR_HAVE_INET_ADDR 1
+#define APR_HAVE_INET_NETWORK 1
+#define APR_HAVE_IPV6 1
+#define APR_HAVE_MEMMOVE 1
+#define APR_HAVE_SETRLIMIT 1
+#define APR_HAVE_SIGACTION 1
+#define APR_HAVE_SIGSUSPEND 1
+#define APR_HAVE_SIGWAIT 1
+#define APR_HAVE_SA_STORAGE 1
+#define APR_HAVE_STRCASECMP 1
+#define APR_HAVE_STRDUP 1
+#define APR_HAVE_STRICMP 0
+#define APR_HAVE_STRNCASECMP 1
+#define APR_HAVE_STRNICMP 0
+#define APR_HAVE_STRSTR 1
+#define APR_HAVE_MEMCHR 1
+#define APR_HAVE_STRUCT_RLIMIT 1
+#define APR_HAVE_UNION_SEMUN 1
+#define APR_HAVE_SCTP 1
+#define APR_HAVE_IOVEC 1
+
+/* APR Feature Macros */
+#define APR_HAS_SHARED_MEMORY 1
+#define APR_HAS_THREADS 1
+#define APR_HAS_SENDFILE 1
+#define APR_HAS_MMAP 1
+#define APR_HAS_FORK 1
+#define APR_HAS_RANDOM 1
+#define APR_HAS_OTHER_CHILD 1
+#define APR_HAS_DSO 0
+#define APR_HAS_SO_ACCEPTFILTER 1
+#define APR_HAS_UNICODE_FS 0
+#define APR_HAS_PROC_INVOKED 0
+#define APR_HAS_USER 1
+#define APR_HAS_LARGE_FILES 0
+#define APR_HAS_XTHREAD_FILES 0
+#define APR_HAS_OS_UUID 1
+
+#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
+
+/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
+ * to poll on files/pipes.
+ */
+#define APR_FILES_AS_SOCKETS 1
+
+/* This macro indicates whether or not EBCDIC is the native character set.
+ */
+#define APR_CHARSET_EBCDIC 0
+
+/* If we have a TCP implementation that can be "corked", what flag
+ * do we use?
+ */
+#define APR_TCP_NOPUSH_FLAG TCP_NOPUSH
+
+/* Is the TCP_NODELAY socket option inherited from listening sockets?
+*/
+#define APR_TCP_NODELAY_INHERITED 1
+
+/* Is the O_NONBLOCK flag inherited from listening sockets?
+*/
+#define APR_O_NONBLOCK_INHERITED 1
+
+/* Typedefs that APR needs. */
+
+typedef unsigned char apr_byte_t;
+
+typedef short apr_int16_t;
+typedef unsigned short apr_uint16_t;
+
+typedef int apr_int32_t;
+typedef unsigned int apr_uint32_t;
+
+#include <sys/_types.h>
+#ifdef __LP64__
+#define APR_SIZEOF_VOIDP 8
+#else
+#define APR_SIZEOF_VOIDP 4
+#endif
+
+/*
+ * Darwin 10's default compiler (gcc42) builds for both 64 and
+ * 32 bit architectures unless specifically told not to.
+ * In those cases, we need to override types depending on how
+ * we're being built at compile time.
+ * NOTE: This is an ugly work-around for Darwin's
+ * concept of universal binaries, a single package
+ * (executable, lib, etc...) which contains both 32
+ * and 64 bit versions. The issue is that if APR is
+ * built universally, if something else is compiled
+ * against it, some bit sizes will depend on whether
+ * it is 32 or 64 bit. This is determined by the __LP64__
+ * flag. Since we need to support both, we have to
+ * handle OS X unqiuely.
+ */
+#ifdef DARWIN_10
+#undef APR_SIZEOF_VOIDP
+#undef INT64_C
+#undef UINT64_C
+#ifdef __LP64__
+ typedef long apr_int64_t;
+ typedef unsigned long apr_uint64_t;
+ #define APR_SIZEOF_VOIDP 8
+ #define INT64_C(v) (v ## L)
+ #define UINT64_C(v) (v ## UL)
+#else
+ typedef long long apr_int64_t;
+ typedef unsigned long long apr_uint64_t;
+ #define APR_SIZEOF_VOIDP 4
+ #define INT64_C(v) (v ## LL)
+ #define UINT64_C(v) (v ## ULL)
+#endif
+#else
+ typedef __int64_t apr_int64_t;
+ typedef __uint64_t apr_uint64_t;
+#endif
+
+typedef size_t apr_size_t;
+typedef ssize_t apr_ssize_t;
+typedef off_t apr_off_t;
+typedef socklen_t apr_socklen_t;
+typedef unsigned int apr_ino_t;
+
+#if APR_SIZEOF_VOIDP == 8
+typedef apr_uint64_t apr_uintptr_t;
+#else
+typedef apr_uint32_t apr_uintptr_t;
+#endif
+
+/* Are we big endian? */
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define APR_IS_BIGENDIAN 0
+#elif _BYTE_ORDER == _BIG_ENDIAN
+#define APR_IS_BIGENDIAN 1
+#else
+#error Unknown byte order.
+#endif
+
+/* Mechanisms to properly type numeric literals */
+#define APR_INT64_C(val) INT64_C(val)
+#define APR_UINT64_C(val) UINT64_C(val)
+
+#ifdef INT16_MIN
+#define APR_INT16_MIN INT16_MIN
+#else
+#define APR_INT16_MIN (-0x7fff - 1)
+#endif
+
+#ifdef INT16_MAX
+#define APR_INT16_MAX INT16_MAX
+#else
+#define APR_INT16_MAX (0x7fff)
+#endif
+
+#ifdef UINT16_MAX
+#define APR_UINT16_MAX UINT16_MAX
+#else
+#define APR_UINT16_MAX (0xffff)
+#endif
+
+#ifdef INT32_MIN
+#define APR_INT32_MIN INT32_MIN
+#else
+#define APR_INT32_MIN (-0x7fffffff - 1)
+#endif
+
+#ifdef INT32_MAX
+#define APR_INT32_MAX INT32_MAX
+#else
+#define APR_INT32_MAX 0x7fffffff
+#endif
+
+#ifdef UINT32_MAX
+#define APR_UINT32_MAX UINT32_MAX
+#else
+#define APR_UINT32_MAX (0xffffffffU)
+#endif
+
+#ifdef INT64_MIN
+#define APR_INT64_MIN INT64_MIN
+#else
+#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
+#endif
+
+#ifdef INT64_MAX
+#define APR_INT64_MAX INT64_MAX
+#else
+#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
+#endif
+
+#ifdef UINT64_MAX
+#define APR_UINT64_MAX UINT64_MAX
+#else
+#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
+#endif
+
+#define APR_SIZE_MAX (~((apr_size_t)0))
+
+
+/* Definitions that APR programs need to work properly. */
+
+/**
+ * APR public API wrap for C++ compilers.
+ */
+#ifdef __cplusplus
+#define APR_BEGIN_DECLS extern "C" {
+#define APR_END_DECLS }
+#else
+#define APR_BEGIN_DECLS
+#define APR_END_DECLS
+#endif
+
+/**
+ * Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
+ * so that they follow the platform's calling convention.
+ * <PRE>
+ *
+ * void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
+ *
+ * </PRE>
+ */
+#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
+ * variable arguments must use APR_DECLARE_NONSTD().
+ *
+ * @remark Both the declaration and implementations must use the same macro.
+ *
+ * <PRE>
+ * APR_DECLARE(rettype) apr_func(args)
+ * </PRE>
+ * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
+ * @remark Note that when APR compiles the library itself, it passes the
+ * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
+ * to export public symbols from the dynamic library build.\n
+ * The user must define the APR_DECLARE_STATIC when compiling to target
+ * the static APR library on some platforms (e.g. Win32.) The public symbols
+ * are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
+ * By default, compiling an application and including the APR public
+ * headers, without defining APR_DECLARE_STATIC, will prepare the code to be
+ * linked to the dynamic library.
+ */
+#define APR_DECLARE(type) type
+
+/**
+ * The public APR functions using variable arguments are declared with
+ * APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
+ * @see APR_DECLARE @see APR_DECLARE_DATA
+ * @remark Both the declaration and implementations must use the same macro.
+ * <PRE>
+ *
+ * APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
+ *
+ * </PRE>
+ */
+#define APR_DECLARE_NONSTD(type) type
+
+/**
+ * The public APR variables are declared with AP_MODULE_DECLARE_DATA.
+ * This assures the appropriate indirection is invoked at compile time.
+ * @see APR_DECLARE @see APR_DECLARE_NONSTD
+ * @remark Note that the declaration and implementations use different forms,
+ * but both must include the macro.
+ *
+ * <PRE>
+ *
+ * extern APR_DECLARE_DATA type apr_variable;\n
+ * APR_DECLARE_DATA type apr_variable = value;
+ *
+ * </PRE>
+ */
+#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",
+ * if ssize_t is neither we declare an error here.
+ * I looked for a better way to define this here, but couldn't find one, so
+ * to find the logic for this definition search for "ssize_t_fmt" in
+ * configure.in.
+ */
+
+#ifdef __LP64__
+#define APR_SSIZE_T_FMT "ld"
+
+/* And APR_SIZE_T_FMT */
+#define APR_SIZE_T_FMT "lu"
+
+/* And APR_OFF_T_FMT */
+#define APR_OFF_T_FMT "ld"
+
+/* And APR_PID_T_FMT */
+#define APR_PID_T_FMT "d"
+
+/* And APR_INT64_T_FMT */
+#define APR_INT64_T_FMT "ld"
+
+/* And APR_UINT64_T_FMT */
+#define APR_UINT64_T_FMT "lu"
+
+/* And APR_UINT64_T_HEX_FMT */
+#define APR_UINT64_T_HEX_FMT "lx"
+#else
+#define APR_SSIZE_T_FMT "d"
+#define APR_SIZE_T_FMT "u"
+#define APR_OFF_T_FMT APR_INT64_T_FMT
+#define APR_PID_T_FMT "d"
+#define APR_INT64_T_FMT "lld"
+#define APR_UINT64_T_FMT "llu"
+#define APR_UINT64_T_HEX_FMT "llx"
+#endif
+
+/*
+ * Ensure we work with universal binaries on Darwin
+ */
+#ifdef DARWIN_10
+
+#undef APR_HAS_LARGE_FILES
+#undef APR_SIZEOF_VOIDP
+#undef APR_INT64_T_FMT
+#undef APR_UINT64_T_FMT
+#undef APR_UINT64_T_HEX_FMT
+
+#ifdef __LP64__
+ #define APR_HAS_LARGE_FILES 0
+ #define APR_SIZEOF_VOIDP 8
+ #define APR_INT64_T_FMT "ld"
+ #define APR_UINT64_T_FMT "lu"
+ #define APR_UINT64_T_HEX_FMT "lx"
+#else
+ #define APR_HAS_LARGE_FILES 1
+ #define APR_SIZEOF_VOIDP 4
+ #define APR_INT64_T_FMT "lld"
+ #define APR_UINT64_T_FMT "llu"
+ #define APR_UINT64_T_HEX_FMT "llx"
+#endif
+
+#undef APR_IS_BIGENDIAN
+#ifdef __BIG_ENDIAN__
+ #define APR_IS_BIGENDIAN 1
+#else
+ #define APR_IS_BIGENDIAN 0
+#endif
+
+#undef APR_OFF_T_FMT
+#define APR_OFF_T_FMT "lld"
+
+#endif /* DARWIN_10 */
+
+/* Does the proc mutex lock threads too */
+#define APR_PROC_MUTEX_IS_GLOBAL 0
+
+/* Local machine definition for console and log output. */
+#define APR_EOL_STR "\n"
+
+#if APR_HAVE_SYS_WAIT_H
+#ifdef WEXITSTATUS
+#define apr_wait_t int
+#else
+#define apr_wait_t union wait
+#define WEXITSTATUS(status) (int)((status).w_retcode)
+#define WTERMSIG(status) (int)((status).w_termsig)
+#endif /* !WEXITSTATUS */
+#elif defined(__MINGW32__)
+typedef int apr_wait_t;
+#endif /* HAVE_SYS_WAIT_H */
+
+#if defined(PATH_MAX)
+#define APR_PATH_MAX PATH_MAX
+#elif defined(_POSIX_PATH_MAX)
+#define APR_PATH_MAX _POSIX_PATH_MAX
+#else
+#error no decision has been made on APR_PATH_MAX for your platform
+#endif
+
+#define APR_DSOPATH "LD_LIBRARY_PATH"
+
+/** @} */
+
+/* Definitions that only Win32 programs need to compile properly. */
+
+/* XXX These simply don't belong here, perhaps in apr_portable.h
+ * based on some APR_HAVE_PID/GID/UID?
+ */
+#ifdef __MINGW32__
+#ifndef __GNUC__
+typedef int pid_t;
+#endif
+typedef int uid_t;
+typedef int gid_t;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* APR_H */
diff --git a/usr.bin/svn/lib/libapr/apr_private.h b/usr.bin/svn/lib/libapr/apr_private.h
new file mode 100644
index 0000000..0ebe0a1
--- /dev/null
+++ b/usr.bin/svn/lib/libapr/apr_private.h
@@ -0,0 +1,1005 @@
+/* $FreeBSD$ */
+
+/* include/arch/unix/apr_private.h. Generated from apr_private.h.in by configure. */
+/* include/arch/unix/apr_private.h.in. Generated from configure.in by autoheader. */
+
+
+#ifndef APR_PRIVATE_H
+#define APR_PRIVATE_H
+
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define if apr_allocator should use mmap */
+/* #undef APR_ALLOCATOR_USES_MMAP */
+
+/* Define as function which can be used for conversion of strings to
+ apr_int64_t */
+#define APR_INT64_STRFN strtol
+
+/* Define as function used for conversion of strings to apr_off_t */
+#define APR_OFF_T_STRFN strtol
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to path of random device */
+#define DEV_RANDOM "/dev/urandom"
+
+/* Define if struct dirent has an inode member */
+#define DIRENT_INODE d_fileno
+
+/* Define if struct dirent has a d_type member */
+#define DIRENT_TYPE d_type
+
+/* Define if DSO support uses dlfcn.h */
+/* #undef DSO_USE_DLFCN */
+
+/* Define if DSO support uses dyld.h */
+/* #undef DSO_USE_DYLD */
+
+/* Define if DSO support uses shl_load */
+/* #undef DSO_USE_SHL */
+
+/* Define to list of paths to EGD sockets */
+/* #undef EGD_DEFAULT_SOCKET */
+
+/* Define if fcntl locks affect threads within the process */
+/* #undef FCNTL_IS_GLOBAL */
+
+/* Define if fcntl returns EACCES when F_SETLK is already held */
+/* #undef FCNTL_TRYACQUIRE_EACCES */
+
+/* Define if flock locks affect threads within the process */
+/* #undef FLOCK_IS_GLOBAL */
+
+/* Define if gethostbyaddr is thread safe */
+/* #undef GETHOSTBYADDR_IS_THREAD_SAFE */
+
+/* Define if gethostbyname is thread safe */
+/* #undef GETHOSTBYNAME_IS_THREAD_SAFE */
+
+/* Define if gethostbyname_r has the glibc style */
+#define GETHOSTBYNAME_R_GLIBC2 1
+
+/* Define if gethostbyname_r has the hostent_data for the third argument */
+/* #undef GETHOSTBYNAME_R_HOSTENT_DATA */
+
+/* Define if getservbyname is thread safe */
+/* #undef GETSERVBYNAME_IS_THREAD_SAFE */
+
+/* Define if getservbyname_r has the glibc style */
+#define GETSERVBYNAME_R_GLIBC2 1
+
+/* Define if getservbyname_r has the OSF/1 style */
+/* #undef GETSERVBYNAME_R_OSF1 */
+
+/* Define if getservbyname_r has the Solaris style */
+/* #undef GETSERVBYNAME_R_SOLARIS */
+
+/* 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
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define if compiler provides atomic builtins */
+#if !defined(__mips__) && !defined(__arm__)
+#define HAVE_ATOMIC_BUILTINS 1
+#endif
+
+/* Define if BONE_VERSION is defined in sys/socket.h */
+/* #undef HAVE_BONE_VERSION */
+
+/* Define to 1 if you have the <ByteOrder.h> header file. */
+/* #undef HAVE_BYTEORDER_H */
+
+/* Define to 1 if you have the `calloc' function. */
+#define HAVE_CALLOC 1
+
+/* Define to 1 if you have the <conio.h> header file. */
+/* #undef HAVE_CONIO_H */
+
+/* Define to 1 if you have the `create_area' function. */
+/* #undef HAVE_CREATE_AREA */
+
+/* Define to 1 if you have the `create_sem' function. */
+/* #undef HAVE_CREATE_SEM */
+
+/* Define to 1 if you have the <crypt.h> header file. */
+/* #undef HAVE_CRYPT_H */
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+ don't. */
+#define HAVE_DECL_SYS_SIGLIST 1
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the <dir.h> header file. */
+/* #undef HAVE_DIR_H */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <dl.h> header file. */
+/* #undef HAVE_DL_H */
+
+/* Define if dup3 function is supported */
+#define HAVE_DUP3 1
+
+/* Define if EGD is supported */
+/* #undef HAVE_EGD */
+
+/* Define if the epoll interface is supported */
+/* #undef HAVE_EPOLL */
+
+/* Define if epoll_create1 function is supported */
+/* #undef HAVE_EPOLL_CREATE1 */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fdatasync' function. */
+/* #undef HAVE_FDATASYNC */
+
+/* Define to 1 if you have the `flock' function. */
+#define HAVE_FLOCK 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define if F_SETLK is defined in fcntl.h */
+#define HAVE_F_SETLK 1
+
+/* Define if getaddrinfo accepts the AI_ADDRCONFIG flag */
+#define HAVE_GAI_ADDRCONFIG 1
+
+/* Define to 1 if you have the `gai_strerror' function. */
+#define HAVE_GAI_STRERROR 1
+
+/* Define if getaddrinfo exists and works well enough for APR */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getgrgid_r' function. */
+#define HAVE_GETGRGID_R 1
+
+/* Define to 1 if you have the `getgrnam_r' function. */
+#define HAVE_GETGRNAM_R 1
+
+/* Define to 1 if you have the `gethostbyaddr_r' function. */
+#define HAVE_GETHOSTBYADDR_R 1
+
+/* Define to 1 if you have the `gethostbyname_r' function. */
+#define HAVE_GETHOSTBYNAME_R 1
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define HAVE_GETIFADDRS 1
+
+/* Define if getnameinfo exists */
+#define HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `getpass' function. */
+#define HAVE_GETPASS 1
+
+/* Define to 1 if you have the `getpassphrase' function. */
+/* #undef HAVE_GETPASSPHRASE */
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+#define HAVE_GETPWNAM_R 1
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#define HAVE_GETPWUID_R 1
+
+/* Define to 1 if you have the `getrlimit' function. */
+#define HAVE_GETRLIMIT 1
+
+/* Define to 1 if you have the `getservbyname_r' function. */
+#define HAVE_GETSERVBYNAME_R 1
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#define HAVE_GMTIME_R 1
+
+/* Define to 1 if you have the <grp.h> header file. */
+#define HAVE_GRP_H 1
+
+/* Define if hstrerror is present */
+/* #undef HAVE_HSTRERROR */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
+
+/* Define to 1 if you have the `isinf' function. */
+#define HAVE_ISINF 1
+
+/* Define to 1 if you have the `isnan' function. */
+#define HAVE_ISNAN 1
+
+/* Define to 1 if you have the <kernel/OS.h> header file. */
+/* #undef HAVE_KERNEL_OS_H */
+
+/* Define to 1 if you have the `kqueue' function. */
+#define HAVE_KQUEUE 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define to 1 if you have the `bsd' library (-lbsd). */
+/* #undef HAVE_LIBBSD */
+
+/* Define to 1 if you have the `sendfile' library (-lsendfile). */
+/* #undef HAVE_LIBSENDFILE */
+
+/* Define to 1 if you have the `truerand' library (-ltruerand). */
+/* #undef HAVE_LIBTRUERAND */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `localtime_r' function. */
+#define HAVE_LOCALTIME_R 1
+
+/* Define if LOCK_EX is defined in sys/file.h */
+#define HAVE_LOCK_EX 1
+
+/* Define to 1 if you have the <mach-o/dyld.h> header file. */
+/* #undef HAVE_MACH_O_DYLD_H */
+
+/* Define to 1 if you have the <malloc.h> header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define if MAP_ANON is defined in sys/mman.h */
+#define HAVE_MAP_ANON 1
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the `mkstemp64' function. */
+/* #undef HAVE_MKSTEMP64 */
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `mmap64' function. */
+/* #undef HAVE_MMAP64 */
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/sctp.h> header file. */
+#define HAVE_NETINET_SCTP_H 1
+
+/* Define to 1 if you have the <netinet/sctp_uio.h> header file. */
+#define HAVE_NETINET_SCTP_UIO_H 1
+
+/* Defined if netinet/tcp.h is present */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the <net/errno.h> header file. */
+/* #undef HAVE_NET_ERRNO_H */
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+#define HAVE_NL_LANGINFO 1
+
+/* Define to 1 if you have the <os2.h> header file. */
+/* #undef HAVE_OS2_H */
+
+/* Define to 1 if you have the <osreldate.h> header file. */
+#define HAVE_OSRELDATE_H 1
+
+/* Define to 1 if you have the <OS.h> header file. */
+/* #undef HAVE_OS_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define if POLLIN is defined */
+#define HAVE_POLLIN 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <process.h> header file. */
+/* #undef HAVE_PROCESS_H */
+
+/* Define to 1 if you have the `pthread_attr_setguardsize' function. */
+#define HAVE_PTHREAD_ATTR_SETGUARDSIZE 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the `pthread_key_delete' function. */
+#define HAVE_PTHREAD_KEY_DELETE 1
+
+/* Define to 1 if you have the `pthread_mutexattr_setpshared' function. */
+#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1
+
+/* Define if recursive pthread mutexes are available */
+#define HAVE_PTHREAD_MUTEX_RECURSIVE 1
+
+/* Define if cross-process robust mutexes are available */
+/* #undef HAVE_PTHREAD_MUTEX_ROBUST */
+
+/* Define if PTHREAD_PROCESS_SHARED is defined in pthread.h */
+#define HAVE_PTHREAD_PROCESS_SHARED 1
+
+/* Define if pthread rwlocks are available */
+#define HAVE_PTHREAD_RWLOCKS 1
+
+/* Define to 1 if you have the `pthread_rwlock_init' function. */
+#define HAVE_PTHREAD_RWLOCK_INIT 1
+
+/* Define to 1 if you have the `pthread_yield' function. */
+#define HAVE_PTHREAD_YIELD 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `readdir64_r' function. */
+/* #undef HAVE_READDIR64_R */
+
+/* Define to 1 if you have the <sched.h> header file. */
+/* #undef HAVE_SCHED_H */
+
+/* Define to 1 if you have the `sched_yield' function. */
+/* #undef HAVE_SCHED_YIELD */
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#define HAVE_SEMAPHORE_H 1
+
+/* Define to 1 if you have the `semctl' function. */
+#define HAVE_SEMCTL 1
+
+/* Define to 1 if you have the `semget' function. */
+#define HAVE_SEMGET 1
+
+/* Define to 1 if you have the `sem_close' function. */
+#define HAVE_SEM_CLOSE 1
+
+/* Define to 1 if you have the `sem_post' function. */
+#define HAVE_SEM_POST 1
+
+/* Define if SEM_UNDO is defined in sys/sem.h */
+#define HAVE_SEM_UNDO 1
+
+/* Define to 1 if you have the `sem_unlink' function. */
+#define HAVE_SEM_UNLINK 1
+
+/* Define to 1 if you have the `sem_wait' function. */
+#define HAVE_SEM_WAIT 1
+
+/* Define to 1 if you have the `sendfile' function. */
+#define HAVE_SENDFILE 1
+
+/* Define to 1 if you have the `sendfile64' function. */
+/* #undef HAVE_SENDFILE64 */
+
+/* Define to 1 if you have the `sendfilev' function. */
+/* #undef HAVE_SENDFILEV */
+
+/* Define to 1 if you have the `sendfilev64' function. */
+/* #undef HAVE_SENDFILEV64 */
+
+/* Define to 1 if you have the `send_file' function. */
+/* #undef HAVE_SEND_FILE */
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setrlimit' function. */
+#define HAVE_SETRLIMIT 1
+
+/* Define to 1 if you have the `setsid' function. */
+#define HAVE_SETSID 1
+
+/* Define to 1 if you have the `set_h_errno' function. */
+/* #undef HAVE_SET_H_ERRNO */
+
+/* Define to 1 if you have the `shmat' function. */
+#define HAVE_SHMAT 1
+
+/* Define to 1 if you have the `shmctl' function. */
+#define HAVE_SHMCTL 1
+
+/* Define to 1 if you have the `shmdt' function. */
+#define HAVE_SHMDT 1
+
+/* Define to 1 if you have the `shmget' function. */
+#define HAVE_SHMGET 1
+
+/* Define to 1 if you have the `shm_open' function. */
+#define HAVE_SHM_OPEN 1
+
+/* Define to 1 if you have the `shm_unlink' function. */
+#define HAVE_SHM_UNLINK 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the `sigsuspend' function. */
+#define HAVE_SIGSUSPEND 1
+
+/* Define to 1 if you have the `sigwait' function. */
+#define HAVE_SIGWAIT 1
+
+/* Whether you have socklen_t */
+#define HAVE_SOCKLEN_T 1
+
+/* Define if the SOCK_CLOEXEC flag is supported */
+#define HAVE_SOCK_CLOEXEC 1
+
+/* Define if SO_ACCEPTFILTER is defined in sys/socket.h */
+#define HAVE_SO_ACCEPTFILTER 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#define HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strnicmp' function. */
+/* #undef HAVE_STRNICMP */
+
+/* Define to 1 if you have the `strstr' function. */
+#define HAVE_STRSTR 1
+
+/* Define if struct impreq was found */
+#define HAVE_STRUCT_IPMREQ 1
+
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */
+
+/* Define to 1 if `st_atime_n' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIME_N */
+
+/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
+
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+
+/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_CTIMENSEC */
+
+/* Define to 1 if `st_ctime_n' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_CTIME_N */
+
+/* Define to 1 if `st_ctim.tv_nsec' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC 1
+
+/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIMENSEC */
+
+/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIME_N */
+
+/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+
+/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+
+/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */
+/* #undef HAVE_STRUCT_TM___TM_GMTOFF */
+
+/* Define to 1 if you have the <sysapi.h> header file. */
+/* #undef HAVE_SYSAPI_H */
+
+/* Define to 1 if you have the <sysgtime.h> header file. */
+/* #undef HAVE_SYSGTIME_H */
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+#define HAVE_SYS_FILE_H 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/mutex.h> header file. */
+#define HAVE_SYS_MUTEX_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#define HAVE_SYS_POLL_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+#define HAVE_SYS_SEM_H 1
+
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+/* #undef HAVE_SYS_SENDFILE_H */
+
+/* Define to 1 if you have the <sys/shm.h> header file. */
+#define HAVE_SYS_SHM_H 1
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+#define HAVE_SYS_SIGNAL_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+#define HAVE_SYS_SOCKIO_H 1
+
+/* 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/syslimits.h> header file. */
+#define HAVE_SYS_SYSLIMITS_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#define HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have the <sys/uuid.h> header file. */
+/* #undef HAVE_SYS_UUID_H */
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if TCP_CORK is defined in netinet/tcp.h */
+/* #undef HAVE_TCP_CORK */
+
+/* Define if TCP_NODELAY and TCP_CORK can be enabled at the same time */
+/* #undef HAVE_TCP_NODELAY_WITH_CORK */
+
+/* Define if TCP_NOPUSH is defined in netinet/tcp.h */
+#define HAVE_TCP_NOPUSH 1
+
+/* Define to 1 if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <tpfeq.h> header file. */
+/* #undef HAVE_TPFEQ_H */
+
+/* Define to 1 if you have the <tpfio.h> header file. */
+/* #undef HAVE_TPFIO_H */
+
+/* Define if truerand is supported */
+/* #undef HAVE_TRUERAND */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <unix.h> header file. */
+/* #undef HAVE_UNIX_H */
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimes' function. */
+#define HAVE_UTIMES 1
+
+/* Define to 1 if you have the `uuid_create' function. */
+#define HAVE_UUID_CREATE 1
+
+/* Define to 1 if you have the `uuid_generate' function. */
+/* #undef HAVE_UUID_GENERATE */
+
+/* Define to 1 if you have the <uuid.h> header file. */
+#define HAVE_UUID_H 1
+
+/* Define to 1 if you have the <uuid/uuid.h> header file. */
+/* #undef HAVE_UUID_UUID_H */
+
+/* Define if C compiler supports VLA */
+#define HAVE_VLA 1
+
+/* Define to 1 if you have the `waitpid' function. */
+#define HAVE_WAITPID 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+/* #undef HAVE_WINSOCK2_H */
+
+/* Define to 1 if you have the `writev' function. */
+#define HAVE_WRITEV 1
+
+/* Define for z/OS pthread API nuances */
+/* #undef HAVE_ZOS_PTHREADS */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Define if EAI_ error codes from getaddrinfo are negative */
+/* #undef NEGATIVE_EAI */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define if POSIX semaphores affect threads within the process */
+/* #undef POSIXSEM_IS_GLOBAL */
+
+/* Define on PowerPC 405 where errata 77 applies */
+/* #undef PPC405_ERRATA */
+
+/* Define if pthread_attr_getdetachstate() has one arg */
+/* #undef PTHREAD_ATTR_GETDETACHSTATE_TAKES_ONE_ARG */
+
+/* Define if pthread_getspecific() has two args */
+/* #undef PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS */
+
+/* Define if readdir is thread safe */
+/* #undef READDIR_IS_THREAD_SAFE */
+
+/* Define to 1 if the `setpgrp' function takes no argument. */
+/* #undef SETPGRP_VOID */
+
+/* */
+/* #undef SIGWAIT_TAKES_ONE_ARG */
+
+/* The size of `char', as computed by sizeof. */
+#define SIZEOF_CHAR 1
+
+/* The size of ino_t */
+#define SIZEOF_INO_T 4
+
+/* The size of `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of off_t */
+#define SIZEOF_OFF_T 8
+
+/* The size of pid_t */
+#define SIZEOF_PID_T 4
+
+/* The size of `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* The size of size_t */
+#define SIZEOF_SIZE_T 8
+
+/* The size of ssize_t */
+#define SIZEOF_SSIZE_T 8
+
+/* The size of struct iovec */
+#define SIZEOF_STRUCT_IOVEC 16
+
+/* The size of `void*', as computed by sizeof. */
+#define SIZEOF_VOIDP 8
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if strerror returns int */
+#define STRERROR_R_RC_INT 1
+
+/* Define if SysV semaphores affect threads within the process */
+/* #undef SYSVSEM_IS_GLOBAL */
+
+/* Define if use of generic atomics is requested */
+/* #undef USE_ATOMICS_GENERIC */
+
+/* Define if BeOS Semaphores will be used */
+/* #undef USE_BEOSSEM */
+
+/* Define if SVR4-style fcntl() will be used */
+/* #undef USE_FCNTL_SERIALIZE */
+
+/* Define if 4.2BSD-style flock() will be used */
+#define USE_FLOCK_SERIALIZE 1
+
+/* Define if BeOS areas will be used */
+/* #undef USE_SHMEM_BEOS */
+
+/* Define if BeOS areas will be used */
+/* #undef USE_SHMEM_BEOS_ANON */
+
+/* Define if 4.4BSD-style mmap() via MAP_ANON will be used */
+#define USE_SHMEM_MMAP_ANON 1
+
+/* Define if mmap() via POSIX.1 shm_open() on temporary file will be used */
+#define USE_SHMEM_MMAP_SHM 1
+
+/* Define if Classical mmap() on temporary file will be used */
+/* #undef USE_SHMEM_MMAP_TMP */
+
+/* Define if SVR4-style mmap() on /dev/zero will be used */
+/* #undef USE_SHMEM_MMAP_ZERO */
+
+/* Define if OS/2 DosAllocSharedMem() will be used */
+/* #undef USE_SHMEM_OS2 */
+
+/* Define if OS/2 DosAllocSharedMem() will be used */
+/* #undef USE_SHMEM_OS2_ANON */
+
+/* Define if SysV IPC shmget() will be used */
+/* #undef USE_SHMEM_SHMGET */
+
+/* Define if SysV IPC shmget() will be used */
+/* #undef USE_SHMEM_SHMGET_ANON */
+
+/* Define if Windows shared memory will be used */
+/* #undef USE_SHMEM_WIN32 */
+
+/* Define if Windows CreateFileMapping() will be used */
+/* #undef USE_SHMEM_WIN32_ANON */
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define if SysV IPC semget() will be used */
+/* #undef USE_SYSVSEM_SERIALIZE */
+
+/* Define if apr_wait_for_io_or_timeout() uses poll(2) */
+#define WAITIO_USES_POLL 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+
+/* switch this on if we have a BeOS version below BONE */
+#if defined(BEOS) && !defined(HAVE_BONE_VERSION)
+#define BEOS_R5 1
+#else
+#define BEOS_BONE 1
+#endif
+
+/*
+ * Darwin 10's default compiler (gcc42) builds for both 64 and
+ * 32 bit architectures unless specifically told not to.
+ * In those cases, we need to override types depending on how
+ * we're being built at compile time.
+ * NOTE: This is an ugly work-around for Darwin's
+ * concept of universal binaries, a single package
+ * (executable, lib, etc...) which contains both 32
+ * and 64 bit versions. The issue is that if APR is
+ * built universally, if something else is compiled
+ * against it, some bit sizes will depend on whether
+ * it is 32 or 64 bit. This is determined by the __LP64__
+ * flag. Since we need to support both, we have to
+ * handle OS X unqiuely.
+ */
+#ifdef DARWIN_10
+
+#define APR_OFF_T_STRFN strtol
+#define APR_INT64_STRFN strtol
+#define SIZEOF_LONG 8
+#define SIZEOF_SIZE_T 8
+#define SIZEOF_SSIZE_T 8
+#define SIZEOF_VOIDP 8
+#define SIZEOF_STRUCT_IOVEC 16
+
+#ifdef __LP64__
+ #define APR_INT64_STRFN strtol
+ #define SIZEOF_LONG 8
+ #define SIZEOF_SIZE_T 8
+ #define SIZEOF_SSIZE_T 8
+ #define SIZEOF_VOIDP 8
+ #define SIZEOF_STRUCT_IOVEC 16
+#else
+ #define APR_INT64_STRFN strtol
+ #define SIZEOF_LONG 8
+ #define SIZEOF_SIZE_T 8
+ #define SIZEOF_SSIZE_T 8
+ #define SIZEOF_VOIDP 8
+ #define SIZEOF_STRUCT_IOVEC 16
+#endif
+
+#define APR_OFF_T_STRFN strtol
+#define APR_OFF_T_STRFN strtol
+
+
+/* #undef SETPGRP_VOID */
+#ifdef __DARWIN_UNIX03
+ #define SETPGRP_VOID 1
+#else
+/* #undef SETPGRP_VOID */
+#endif
+
+#endif /* DARWIN_10 */
+
+/*
+ * Include common private declarations.
+ */
+#include "../apr_private_common.h"
+#endif /* APR_PRIVATE_H */
+
diff --git a/usr.bin/svn/lib/libapr_util/Makefile b/usr.bin/svn/lib/libapr_util/Makefile
new file mode 100644
index 0000000..df2d1f9
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+INTERNALLIB= yes
+LIB= apr-util
+
+SRCS= apr_base64.c apr_brigade.c apr_buckets.c apr_buckets_alloc.c \
+ apr_buckets_eos.c apr_buckets_file.c apr_buckets_flush.c \
+ apr_buckets_heap.c apr_buckets_mmap.c apr_buckets_pipe.c \
+ apr_buckets_pool.c apr_buckets_refcount.c apr_buckets_simple.c \
+ apr_buckets_socket.c apr_crypto.c apr_date.c apr_dbd.c \
+ apr_hooks.c apr_md4.c apr_md5.c apr_memcache.c apr_passwd.c \
+ apr_queue.c apr_reslist.c apr_rmm.c apr_sha1.c apr_strmatch.c \
+ apr_thread_pool.c apr_uri.c apr_xml.c apu_dso.c apu_version.c \
+ crypt_blowfish.c getuuid.c uuid.c xlate.c
+
+.PATH: ${APRU}/buckets ${APRU}/crypto ${APRU}/dbd \
+ ${APRU}/encoding ${APRU}/hooks \
+ ${APRU}/memcache ${APRU}/misc ${APRU}/strmatch \
+ ${APRU}/uri ${APRU}/xlate ${APRU}/xml ${APRU}/include
+
+CFLAGS+= -DHAVE_CONFIG_H \
+ -I${.CURDIR} \
+ -I${APRU}/include/private \
+ -I${APRU}/include \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include
+
+.include <src.opts.mk>
+
+.if ${MK_ICONV} == "yes"
+CFLAGS+= -DHAVE_ICONV_H=1 -DAPU_HAVE_ICONV=1
+.endif
+
+.include <bsd.lib.mk>
+
diff --git a/usr.bin/svn/lib/libapr_util/Makefile.depend b/usr.bin/svn/lib/libapr_util/Makefile.depend
new file mode 100644
index 0000000..ba7abb3
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/Makefile.depend
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/libexpat \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libapr_util/apr_ldap.h b/usr.bin/svn/lib/libapr_util/apr_ldap.h
new file mode 100644
index 0000000..27a96de
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/apr_ldap.h
@@ -0,0 +1,198 @@
+/* $FreeBSD$ */
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h
+ */
+/**
+ * @file apr_ldap.h
+ * @brief APR-UTIL LDAP
+ */
+#ifndef APU_LDAP_H
+#define APU_LDAP_H
+
+/**
+ * @defgroup APR_Util_LDAP LDAP
+ * @ingroup APR_Util
+ * @{
+ */
+
+/* this will be defined if LDAP support was compiled into apr-util */
+#define APR_HAS_LDAP 0
+
+/* identify the LDAP toolkit used */
+#define APR_HAS_NETSCAPE_LDAPSDK 0
+#define APR_HAS_SOLARIS_LDAPSDK 0
+#define APR_HAS_NOVELL_LDAPSDK 0
+#define APR_HAS_MOZILLA_LDAPSDK 0
+#define APR_HAS_OPENLDAP_LDAPSDK 0
+#define APR_HAS_MICROSOFT_LDAPSDK 0
+#define APR_HAS_TIVOLI_LDAPSDK 0
+#define APR_HAS_ZOS_LDAPSDK 0
+#define APR_HAS_OTHER_LDAPSDK 0
+
+
+/*
+ * Handle the case when LDAP is enabled
+ */
+#if APR_HAS_LDAP
+
+/*
+ * The following #defines are DEPRECATED and should not be used for
+ * anything. They remain to maintain binary compatibility.
+ * The original code defined the OPENLDAP SDK as present regardless
+ * of what really was there, which was way bogus. In addition, the
+ * apr_ldap_url_parse*() functions have been rewritten specifically for
+ * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero.
+ */
+#if APR_HAS_TIVOLI_LDAPSDK
+#define APR_HAS_LDAP_SSL 0
+#else
+#define APR_HAS_LDAP_SSL 1
+#endif
+#define APR_HAS_LDAP_URL_PARSE 0
+
+#if APR_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED)
+/* Ensure that the "deprecated" interfaces are still exposed
+ * with OpenLDAP >= 2.3; these were exposed by default in earlier
+ * releases. */
+#define LDAP_DEPRECATED 1
+#endif
+
+/*
+ * Include the standard LDAP header files.
+ */
+
+
+
+
+
+
+/*
+ * Detected standard functions
+ */
+#define APR_HAS_LDAPSSL_CLIENT_INIT 0
+#define APR_HAS_LDAPSSL_CLIENT_DEINIT 0
+#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 0
+#define APR_HAS_LDAP_START_TLS_S 0
+#define APR_HAS_LDAP_SSLINIT 0
+#define APR_HAS_LDAPSSL_INIT 0
+#define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0
+
+/*
+ * Make sure the secure LDAP port is defined
+ */
+#ifndef LDAPS_PORT
+#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */
+#endif
+
+/*
+ * For ldap function calls that input a size limit on the number of returned elements
+ * Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
+ * LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
+ * or process is configured for.
+ */
+#ifdef LDAP_DEFAULT_LIMIT
+#define APR_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
+#else
+#ifdef LDAP_NO_LIMIT
+#define APR_LDAP_SIZELIMIT LDAP_NO_LIMIT
+#endif
+#endif
+
+#ifndef APR_LDAP_SIZELIMIT
+#define APR_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
+#endif
+
+/*
+ * z/OS is missing some defines
+ */
+#ifndef LDAP_VERSION_MAX
+#define LDAP_VERSION_MAX LDAP_VERSION
+#endif
+#if APR_HAS_ZOS_LDAPSDK
+#define LDAP_VENDOR_NAME "IBM z/OS"
+#endif
+
+/* Note: Macros defining const casting has been removed in APR v1.0,
+ * pending real support for LDAP v2.0 toolkits.
+ *
+ * In the mean time, please use an LDAP v3.0 toolkit.
+ */
+#if LDAP_VERSION_MAX <= 2
+#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * This structure allows the C LDAP API error codes to be returned
+ * along with plain text error messages that explain to us mere mortals
+ * what really happened.
+ */
+typedef struct apr_ldap_err_t {
+ const char *reason;
+ const char *msg;
+ int rc;
+} apr_ldap_err_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+/* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
+ * between LDAP calls. Protect with APR_HAS_MICROSOFT_LDAPSDK in case someone
+ * manually chooses another SDK on Windows
+ */
+#if APR_HAS_MICROSOFT_LDAPSDK
+#define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN \
+ || (s) == LDAP_UNAVAILABLE)
+#else
+#define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN)
+#endif
+
+/* These symbols are not actually exported in a DSO build, but mapped into
+ * a private exported function array for apr_ldap_stub to bind dynamically.
+ * Rename them appropriately to protect the global namespace.
+ */
+#ifdef APU_DSO_LDAP_BUILD
+
+#define apr_ldap_info apr__ldap_info
+#define apr_ldap_init apr__ldap_init
+#define apr_ldap_ssl_init apr__ldap_ssl_init
+#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit
+#define apr_ldap_get_option apr__ldap_get_option
+#define apr_ldap_set_option apr__ldap_set_option
+#define apr_ldap_rebind_init apr__ldap_rebind_init
+#define apr_ldap_rebind_add apr__ldap_rebind_add
+#define apr_ldap_rebind_remove apr__ldap_rebind_remove
+
+#define APU_DECLARE_LDAP(type) type
+#else
+#define APU_DECLARE_LDAP(type) APU_DECLARE(type)
+#endif
+
+#include "apr_ldap_url.h"
+#include "apr_ldap_init.h"
+#include "apr_ldap_option.h"
+#include "apr_ldap_rebind.h"
+
+#endif /* APR_HAS_LDAP */
+/** @} */
+#endif /* APU_LDAP_H */
diff --git a/usr.bin/svn/lib/libapr_util/apu.h b/usr.bin/svn/lib/libapr_util/apu.h
new file mode 100644
index 0000000..575d633
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/apu.h
@@ -0,0 +1,131 @@
+/* $FreeBSD$ */
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * apu.h is generated from apu.h.in by configure -- do not edit apu.h
+ */
+/* @file apu.h
+ * @brief APR-Utility main file
+ */
+/**
+ * @defgroup APR_Util APR Utility Functions
+ * @{
+ */
+
+
+#ifndef APU_H
+#define APU_H
+
+/**
+ * APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library,
+ * so that all public symbols are exported.
+ *
+ * APU_DECLARE_STATIC is defined when including the APR-UTIL public headers,
+ * to provide static linkage when the dynamic library may be unavailable.
+ *
+ * APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when
+ * including the APR-UTIL public headers, to import and link the symbols from
+ * the dynamic APR-UTIL library and assure appropriate indirection and calling
+ * conventions at compile time.
+ */
+
+#if defined(DOXYGEN) || !defined(WIN32)
+/**
+ * The public APR-UTIL functions are declared with APU_DECLARE(), so they may
+ * use the most appropriate calling convention. Public APR functions with
+ * variable arguments must use APU_DECLARE_NONSTD().
+ *
+ * @fn APU_DECLARE(rettype) apr_func(args);
+ */
+#define APU_DECLARE(type) type
+/**
+ * The public APR-UTIL functions using variable arguments are declared with
+ * APU_DECLARE_NONSTD(), as they must use the C language calling convention.
+ *
+ * @fn APU_DECLARE_NONSTD(rettype) apr_func(args, ...);
+ */
+#define APU_DECLARE_NONSTD(type) type
+/**
+ * The public APR-UTIL variables are declared with APU_DECLARE_DATA.
+ * This assures the appropriate indirection is invoked at compile time.
+ *
+ * @fn APU_DECLARE_DATA type apr_variable;
+ * @note APU_DECLARE_DATA extern type apr_variable; syntax is required for
+ * declarations within headers to properly import the variable.
+ */
+#define APU_DECLARE_DATA
+#elif defined(APU_DECLARE_STATIC)
+#define APU_DECLARE(type) type __stdcall
+#define APU_DECLARE_NONSTD(type) type __cdecl
+#define APU_DECLARE_DATA
+#elif defined(APU_DECLARE_EXPORT)
+#define APU_DECLARE(type) __declspec(dllexport) type __stdcall
+#define APU_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
+#define APU_DECLARE_DATA __declspec(dllexport)
+#else
+#define APU_DECLARE(type) __declspec(dllimport) type __stdcall
+#define APU_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
+#define APU_DECLARE_DATA __declspec(dllimport)
+#endif
+
+#if !defined(WIN32) || defined(APU_MODULE_DECLARE_STATIC)
+/**
+ * Declare a dso module's exported module structure as APU_MODULE_DECLARE_DATA.
+ *
+ * Unless APU_MODULE_DECLARE_STATIC is defined at compile time, symbols
+ * declared with APU_MODULE_DECLARE_DATA are always exported.
+ * @code
+ * module APU_MODULE_DECLARE_DATA mod_tag
+ * @endcode
+ */
+#define APU_MODULE_DECLARE_DATA
+#else
+#define APU_MODULE_DECLARE_DATA __declspec(dllexport)
+#endif
+
+/*
+ * we always have SDBM (it's in our codebase)
+ */
+#define APU_HAVE_SDBM 1
+#define APU_HAVE_GDBM 0
+#define APU_HAVE_NDBM 0
+#define APU_HAVE_DB 0
+
+#if APU_HAVE_DB
+#define APU_HAVE_DB_VERSION 0
+#endif
+
+#define APU_HAVE_PGSQL 0
+#define APU_HAVE_MYSQL 0
+#define APU_HAVE_SQLITE3 0
+#define APU_HAVE_SQLITE2 0
+#define APU_HAVE_ORACLE 0
+#define APU_HAVE_FREETDS 0
+#define APU_HAVE_ODBC 0
+
+#define APU_HAVE_CRYPTO 1
+#define APU_HAVE_OPENSSL 1
+#define APU_HAVE_NSS 0
+
+#define APU_HAVE_APR_ICONV 0
+#ifndef APU_HAVE_ICONV
+#define APU_HAVE_ICONV 0
+#endif
+#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV)
+
+#endif /* APU_H */
+/** @} */
diff --git a/usr.bin/svn/lib/libapr_util/apu_config.h b/usr.bin/svn/lib/libapr_util/apu_config.h
new file mode 100644
index 0000000..ac247d0
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/apu_config.h
@@ -0,0 +1,179 @@
+/* $FreeBSD$ */
+
+/* include/private/apu_config.h. Generated from apu_config.h.in by configure. */
+/* include/private/apu_config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if the system crypt() function is threadsafe */
+/* #undef APU_CRYPT_THREADSAFE */
+
+/* Define to 1 if modular components are built as DSOs */
+/* #undef APU_DSO_BUILD */
+
+/* Define to be absolute path to DSO directory */
+/* #undef APU_DSO_LIBDIR */
+
+/* Define if the inbuf parm to iconv() is const char ** */
+/* #undef APU_ICONV_INBUF_CONST */
+
+/* Define that OpenSSL uses const buffers */
+#define CRYPTO_OPENSSL_CONST_BUFFERS 1
+
+/* Define if crypt_r has uses CRYPTD */
+/* #undef CRYPT_R_CRYPTD */
+
+/* Define if crypt_r uses struct crypt_data */
+/* #undef CRYPT_R_STRUCT_CRYPT_DATA */
+
+/* Define if CODESET is defined in langinfo.h */
+#define HAVE_CODESET 1
+
+/* Define to 1 if you have the `crypt_r' function. */
+/* #undef HAVE_CRYPT_R */
+
+/* Define to 1 if you have the declaration of `EVP_PKEY_CTX_new', and to 0 if
+ you don't. */
+#define HAVE_DECL_EVP_PKEY_CTX_NEW 1
+
+/* Define if expat.h is available */
+#define HAVE_EXPAT_H 1
+
+/* Define to 1 if you have the <freetds/sybdb.h> header file. */
+/* #undef HAVE_FREETDS_SYBDB_H */
+
+/* Define to 1 if you have the <iconv.h> header file. */
+/* #undef HAVE_ICONV_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define to 1 if you have the <lber.h> header file. */
+/* #undef HAVE_LBER_H */
+
+/* Defined if ldap.h is present */
+/* #undef HAVE_LDAP_H */
+
+/* Define to 1 if you have the <ldap_ssl.h> header file. */
+/* #undef HAVE_LDAP_SSL_H */
+
+/* Define to 1 if you have the <libpq-fe.h> header file. */
+/* #undef HAVE_LIBPQ_FE_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <mysql.h> header file. */
+/* #undef HAVE_MYSQL_H */
+
+/* Define to 1 if you have the <mysql/mysql.h> header file. */
+/* #undef HAVE_MYSQL_MYSQL_H */
+
+/* Define to 1 if you have the <mysql/my_global.h> header file. */
+/* #undef HAVE_MYSQL_MY_GLOBAL_H */
+
+/* Define to 1 if you have the <mysql/my_sys.h> header file. */
+/* #undef HAVE_MYSQL_MY_SYS_H */
+
+/* Define to 1 if you have the <my_global.h> header file. */
+/* #undef HAVE_MY_GLOBAL_H */
+
+/* Define to 1 if you have the <my_sys.h> header file. */
+/* #undef HAVE_MY_SYS_H */
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+#define HAVE_NL_LANGINFO 1
+
+/* Define to 1 if you have the <nss.h> header file. */
+/* #undef HAVE_NSS_H */
+
+/* Define to 1 if you have the <nss/nss.h> header file. */
+/* #undef HAVE_NSS_NSS_H */
+
+/* Define to 1 if you have the <nss/pk11pub.h> header file. */
+/* #undef HAVE_NSS_PK11PUB_H */
+
+/* Define to 1 if you have the <oci.h> header file. */
+/* #undef HAVE_OCI_H */
+
+/* Define to 1 if you have the <odbc/sql.h> header file. */
+/* #undef HAVE_ODBC_SQL_H */
+
+/* Define to 1 if you have the <openssl/x509.h> header file. */
+#define HAVE_OPENSSL_X509_H 1
+
+/* Define to 1 if you have the <pk11pub.h> header file. */
+/* #undef HAVE_PK11PUB_H */
+
+/* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */
+/* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */
+
+/* Define to 1 if you have the <prerror.h> header file. */
+/* #undef HAVE_PRERROR_H */
+
+/* Define to 1 if you have the <sqlite3.h> header file. */
+/* #undef HAVE_SQLITE3_H */
+
+/* Define to 1 if you have the <sqlite.h> header file. */
+/* #undef HAVE_SQLITE_H */
+
+/* Define to 1 if you have the <sql.h> header file. */
+/* #undef HAVE_SQL_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sybdb.h> header file. */
+/* #undef HAVE_SYBDB_H */
+
+/* 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/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if xmlparse/xmlparse.h is available */
+/* #undef HAVE_XMLPARSE_XMLPARSE_H */
+
+/* Define if xmltok/xmlparse.h is available */
+/* #undef HAVE_XMLTOK_XMLPARSE_H */
+
+/* Define if xml/xmlparse.h is available */
+/* #undef HAVE_XML_XMLPARSE_H */
+
+/* Define if ldap_set_rebind_proc takes three arguments */
+/* #undef LDAP_SET_REBIND_PROC_THREE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
diff --git a/usr.bin/svn/lib/libapr_util/apu_select_dbm.h b/usr.bin/svn/lib/libapr_util/apu_select_dbm.h
new file mode 100644
index 0000000..cf756e9
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/apu_select_dbm.h
@@ -0,0 +1,30 @@
+/* $FreeBSD$ */
+
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APU_SELECT_DBM_H
+#define APU_SELECT_DBM_H
+
+/*
+** The following macros control what features APRUTIL will use
+*/
+#define APU_USE_SDBM 1
+#define APU_USE_NDBM 0
+#define APU_USE_GDBM 0
+#define APU_USE_DB 0
+
+#endif /* !APU_SELECT_DBM_H */
diff --git a/usr.bin/svn/lib/libapr_util/apu_want.h b/usr.bin/svn/lib/libapr_util/apu_want.h
new file mode 100644
index 0000000..7d6316c
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/apu_want.h
@@ -0,0 +1,53 @@
+/* $FreeBSD$ */
+
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apu.h" /* configuration data */
+
+/**
+ * @file apu_want.h
+ * @brief APR Standard Headers Support
+ *
+ * <PRE>
+ * Features:
+ *
+ * APU_WANT_DB: <db.h>
+ *
+ * Typical usage:
+ *
+ * #define APU_WANT_DB
+ * #include "apu_want.h"
+ *
+ * The appropriate headers will be included.
+ *
+ * Note: it is safe to use this in a header (it won't interfere with other
+ * headers' or source files' use of apu_want.h)
+ * </PRE>
+ */
+
+/* --------------------------------------------------------------------- */
+
+#ifdef APU_WANT_DB
+
+#if APU_HAVE_DB
+#include <db.h>
+#endif
+
+#undef APU_WANT_DB
+#endif
+
+/* --------------------------------------------------------------------- */
diff --git a/usr.bin/svn/lib/libapr_util/expat.h b/usr.bin/svn/lib/libapr_util/expat.h
new file mode 100644
index 0000000..6ab04ef
--- /dev/null
+++ b/usr.bin/svn/lib/libapr_util/expat.h
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+/* Hack to avoid changing vendor code */
+#include <bsdxml.h>
diff --git a/usr.bin/svn/lib/libserf/Makefile b/usr.bin/svn/lib/libserf/Makefile
new file mode 100644
index 0000000..f8d618f
--- /dev/null
+++ b/usr.bin/svn/lib/libserf/Makefile
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+INTERNALLIB= yes
+LIB= serf
+
+SRCS= aggregate_buckets.c allocator.c auth.c auth_basic.c \
+ auth_digest.c auth_spnego.c auth_spnego_gss.c barrier_buckets.c \
+ buckets.c bwtp_buckets.c chunk_buckets.c context.c \
+ dechunk_buckets.c deflate_buckets.c file_buckets.c \
+ headers_buckets.c incoming.c iovec_buckets.c limit_buckets.c \
+ mmap_buckets.c outgoing.c request_buckets.c \
+ response_body_buckets.c response_buckets.c simple_buckets.c \
+ socket_buckets.c ssl_buckets.c ssltunnel.c
+
+.PATH: ${SERF}/buckets ${SERF}/auth ${SERF}
+
+CFLAGS+= -I${.CURDIR} -I${SERF} \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libserf/Makefile.depend b/usr.bin/svn/lib/libserf/Makefile.depend
new file mode 100644
index 0000000..044c8f7
--- /dev/null
+++ b/usr.bin/svn/lib/libserf/Makefile.depend
@@ -0,0 +1,16 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_client/Makefile b/usr.bin/svn/lib/libsvn_client/Makefile
new file mode 100644
index 0000000..2eb7a23
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_client/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_client
+
+INTERNALLIB= yes
+LIB= svn_client
+
+SRCS= add.c blame.c cat.c changelist.c checkout.c cleanup.c \
+ cmdline.c commit.c commit_util.c compat_providers.c copy.c \
+ copy_foreign.c ctx.c delete.c deprecated.c diff.c \
+ diff_local.c diff_summarize.c export.c externals.c import.c \
+ info.c iprops.c list.c locking_commands.c log.c merge.c \
+ mergeinfo.c mtcc.c patch.c log.c prop_commands.c \
+ ra.c relocate.c repos_diff.c resolved.c revert.c revisions.c \
+ status.c switch.c update.c upgrade.c url.c util.c version.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_client/Makefile.depend b/usr.bin/svn/lib/libsvn_client/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_client/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_delta/Makefile b/usr.bin/svn/lib/libsvn_delta/Makefile
new file mode 100644
index 0000000..5be1644
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_delta/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_delta
+
+INTERNALLIB= yes
+LIB= svn_delta
+
+SRCS= cancel.c compat.c compose_delta.c debug_editor.c \
+ default_editor.c deprecated.c depth_filter_editor.c editor.c \
+ path_driver.c svndiff.c text_delta.c version.c xdelta.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_delta/Makefile.depend b/usr.bin/svn/lib/libsvn_delta/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_delta/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_diff/Makefile b/usr.bin/svn/lib/libsvn_diff/Makefile
new file mode 100644
index 0000000..f9d342c
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_diff/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_diff
+
+INTERNALLIB= yes
+LIB= svn_diff
+
+SRCS= binary_diff.c deprecated.c diff.c diff3.c diff4.c \
+ diff_file.c diff_memory.c diff_tree.c lcs.c parse-diff.c \
+ token.c util.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
+
diff --git a/usr.bin/svn/lib/libsvn_diff/Makefile.depend b/usr.bin/svn/lib/libsvn_diff/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_diff/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_fs/Makefile b/usr.bin/svn/lib/libsvn_fs/Makefile
new file mode 100644
index 0000000..467ac93
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_fs
+
+INTERNALLIB= yes
+LIB= svn_fs
+
+SRCS= access.c deprecated.c editor.c fs-loader.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_fs/Makefile.depend b/usr.bin/svn/lib/libsvn_fs/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_fs_fs/Makefile b/usr.bin/svn/lib/libsvn_fs_fs/Makefile
new file mode 100644
index 0000000..eabb4f2
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_fs/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_fs_fs
+
+INTERNALLIB= yes
+LIB= svn_fs_fs
+
+SRCS= cached_data.c caching.c dag.c dump-index.c fs.c fs_fs.c \
+ hotcopy.c id.c index.c load-index.c lock.c low_level.c \
+ pack.c recovery.c rep-cache.c rev_file.c revprops.c \
+ stats.c temp_serializer.c transaction.c tree.c util.c \
+ verify.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_fs_fs/Makefile.depend b/usr.bin/svn/lib/libsvn_fs_fs/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_fs/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_fs_util/Makefile b/usr.bin/svn/lib/libsvn_fs_util/Makefile
new file mode 100644
index 0000000..6652931
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_util/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_fs_util
+
+INTERNALLIB= yes
+LIB= svn_fs_util
+
+SRCS= fs-util.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_fs_util/Makefile.depend b/usr.bin/svn/lib/libsvn_fs_util/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_util/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_fs_x/Makefile b/usr.bin/svn/lib/libsvn_fs_x/Makefile
new file mode 100644
index 0000000..d4b06d2
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_x/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_fs_x
+
+INTERNALLIB= yes
+LIB= svn_fs_x
+
+SRCS= cached_data.c caching.c changes.c dag.c fs.c fs_id.c fs_x.c \
+ hotcopy.c id.c index.c lock.c low_level.c noderevs.c pack.c \
+ recovery.c rep-cache.c reps.c rev_file.c revprops.c \
+ string_table.c temp_serializer.c transaction.c tree.c \
+ util.c verify.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_fs_x/Makefile.depend b/usr.bin/svn/lib/libsvn_fs_x/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_fs_x/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_ra/Makefile b/usr.bin/svn/lib/libsvn_ra/Makefile
new file mode 100644
index 0000000..1e7a22c
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_ra
+
+INTERNALLIB= yes
+LIB= svn_ra
+
+SRCS= compat.c debug_reporter.c deprecated.c editor.c \
+ ra_loader.c util.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_ra/Makefile.depend b/usr.bin/svn/lib/libsvn_ra/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_ra_local/Makefile b/usr.bin/svn/lib/libsvn_ra_local/Makefile
new file mode 100644
index 0000000..45318f1
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_local/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_ra_local
+
+INTERNALLIB= yes
+LIB= svn_ra_local
+
+SRCS= ra_plugin.c split_url.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_ra_local/Makefile.depend b/usr.bin/svn/lib/libsvn_ra_local/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_local/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_ra_serf/Makefile b/usr.bin/svn/lib/libsvn_ra_serf/Makefile
new file mode 100644
index 0000000..74d9557
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_serf/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_ra_serf
+
+INTERNALLIB= yes
+LIB= svn_ra_serf
+
+SRCS= blame.c blncache.c commit.c eagain_bucket.c \
+ get_deleted_rev.c get_file.c get_lock.c getdate.c \
+ getlocations.c getlocationsegments.c getlocks.c \
+ inherited_props.c lock.c log.c merge.c mergeinfo.c \
+ multistatus.c options.c property.c replay.c sb_bucket.c \
+ serf.c stat.c update.c util.c util_error.c xml.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include \
+ -I${SERF}
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_ra_serf/Makefile.depend b/usr.bin/svn/lib/libsvn_ra_serf/Makefile.depend
new file mode 100644
index 0000000..ba7abb3
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_serf/Makefile.depend
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+ lib/libexpat \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_ra_svn/Makefile b/usr.bin/svn/lib/libsvn_ra_svn/Makefile
new file mode 100644
index 0000000..a3c9dbe
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_svn/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_ra_svn
+
+INTERNALLIB= yes
+LIB= svn_ra_svn
+
+SRCS= client.c cram.c cyrus_auth.c deprecated.c editorp.c \
+ internal_auth.c marshal.c streams.c version.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_ra_svn/Makefile.depend b/usr.bin/svn/lib/libsvn_ra_svn/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_ra_svn/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_repos/Makefile b/usr.bin/svn/lib/libsvn_repos/Makefile
new file mode 100644
index 0000000..474a293
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_repos/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_repos
+
+INTERNALLIB= yes
+LIB= svn_repos
+
+SRCS= authz.c authz_pool.c config_pool.c commit.c delta.c \
+ deprecated.c dump.c fs-wrap.c hooks.c load-fs-vtable.c \
+ load.c log.c node_tree.c notify.c replay.c reporter.c \
+ repos.c rev_hunt.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_repos/Makefile.depend b/usr.bin/svn/lib/libsvn_repos/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_repos/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_subr/Makefile b/usr.bin/svn/lib/libsvn_subr/Makefile
new file mode 100644
index 0000000..0ec200c
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_subr/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_subr
+
+INTERNALLIB= yes
+LIB= svn_subr
+
+SRCS= adler32.c atomic.c auth.c base64.c bit_array.c \
+ cache-inprocess.c cache-membuffer.c cache-memcache.c \
+ cache.c cache_config.c checksum.c cmdline.c compat.c \
+ compress.c config.c config_auth.c config_file.c \
+ config_win.c crypto.c ctype.c date.c debug.c \
+ deprecated.c dirent_uri.c dso.c eol.c error.c fnv1a.c \
+ gpg_agent.c hash.c io.c iter.c lock.c log.c \
+ macos_keychain.c magic.c md5.c mergeinfo.c mutex.c nls.c \
+ object_pool.c opt.c packed_data.c path.c \
+ pool.c prefix_string.c prompt.c properties.c quoprint.c \
+ root_pools.c simple_providers.c skel.c sorts.c spillbuf.c \
+ sqlite.c sqlite3wrapper.c ssl_client_cert_providers.c \
+ ssl_client_cert_pw_providers.c ssl_server_trust_providers.c \
+ stream.c string.c subst.c sysinfo.c target.c \
+ temp_serializer.c time.c token.c types.c user.c \
+ username_providers.c utf.c utf8proc.c \
+ utf_validate.c utf_width.c validate.c version.c \
+ win32_crashrpt.c win32_crypto.c win32_xlate.c \
+ x509info.c x509parse.c xml.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include \
+ -I${SQLITE}
+
+.include <bsd.lib.mk>
+
diff --git a/usr.bin/svn/lib/libsvn_subr/Makefile.depend b/usr.bin/svn/lib/libsvn_subr/Makefile.depend
new file mode 100644
index 0000000..d0ebf97
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_subr/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/libexpat \
+ lib/libmagic \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/lib/libsvn_wc/Makefile b/usr.bin/svn/lib/libsvn_wc/Makefile
new file mode 100644
index 0000000..ce3905a
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_wc/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/libsvn_wc
+
+INTERNALLIB= yes
+LIB= svn_wc
+
+SRCS= adm_crawler.c adm_files.c adm_ops.c \
+ ambient_depth_filter_editor.c cleanup.c conflicts.c \
+ context.c copy.c crop.c delete.c deprecated.c diff_editor.c \
+ diff_local.c entries.c externals.c info.c lock.c merge.c \
+ node.c old-and-busted.c props.c questions.c relocate.c \
+ revert.c revision_status.c status.c translate.c \
+ tree_conflicts.c update_editor.c upgrade.c util.c \
+ wc_db.c wc_db_pristine.c wc_db_update_move.c wc_db_util.c \
+ wc_db_wcroot.c wcroot_anchor.c workqueue.c
+
+CFLAGS+= -I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+.include <bsd.lib.mk>
diff --git a/usr.bin/svn/lib/libsvn_wc/Makefile.depend b/usr.bin/svn/lib/libsvn_wc/Makefile.depend
new file mode 100644
index 0000000..18be76b
--- /dev/null
+++ b/usr.bin/svn/lib/libsvn_wc/Makefile.depend
@@ -0,0 +1,13 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ include/xlocale \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svn/Makefile b/usr.bin/svn/svn/Makefile
new file mode 100644
index 0000000..87d9df1
--- /dev/null
+++ b/usr.bin/svn/svn/Makefile
@@ -0,0 +1,67 @@
+# $FreeBSD$
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svn
+
+PROG= svn${SVNLITE}
+
+SRCS= add-cmd.c auth-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 file-merge.c help-cmd.c import-cmd.c \
+ info-cmd.c list-cmd.c lock-cmd.c log-cmd.c merge-cmd.c \
+ mergeinfo-cmd.c mkdir-cmd.c move-cmd.c notify.c patch-cmd.c \
+ propdel-cmd.c propedit-cmd.c propget-cmd.c proplist-cmd.c \
+ props.c propset-cmd.c relocate-cmd.c resolve-cmd.c \
+ resolved-cmd.c revert-cmd.c status-cmd.c similarity.c status.c \
+ svn.c switch-cmd.c unlock-cmd.c update-cmd.c upgrade-cmd.c util.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_CLIENTDIR} -lsvn_client \
+ -L${LIBSVN_WCDIR} -lsvn_wc \
+ -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z magic crypto ssl pthread
+
+DPADD= ${LIBSVN_CLIENT} ${LIBSVN_WC} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} \
+ ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} ${LIBSVN_REPOS} \
+ ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} ${LIBSVN_DELTA} \
+ ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBSERF} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+CLEANFILES+= svnlite.1
+.if(defined(ORGANIZATION) && !empty(ORGANIZATION))
+SRCS+= freebsd-organization.h
+CLEANFILES+= freebsd-organization.h
+CFLAGS+= -I. -DHAS_ORGANIZATION_NAME
+freebsd-organization.h:
+ @echo "#define ORGANIZATION_NAME \"$$(eval echo ${ORGANIZATION})\"" \
+ > 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/Makefile.depend b/usr.bin/svn/svn/Makefile.depend
new file mode 100644
index 0000000..979ea0b
--- /dev/null
+++ b/usr.bin/svn/svn/Makefile.depend
@@ -0,0 +1,42 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libmagic \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_client \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+ usr.bin/svn/lib/libsvn_wc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svn_private_config.h b/usr.bin/svn/svn_private_config.h
new file mode 100644
index 0000000..4907e98
--- /dev/null
+++ b/usr.bin/svn/svn_private_config.h
@@ -0,0 +1,295 @@
+/* $FreeBSD$ */
+
+/* subversion/svn_private_config.h.tmp. Generated from svn_private_config.h.in by configure. */
+/* subversion/svn_private_config.h.in. Generated from configure.ac by autoheader. */
+
+/* The fs type to use by default */
+#define DEFAULT_FS_TYPE "fsfs"
+
+/* The http library to use by default */
+#define DEFAULT_HTTP_LIBRARY "serf"
+
+/* Define to 1 if Ev2 implementations should be used. */
+/* #undef ENABLE_EV2_IMPL */
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */
+/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the `getpid' function. */
+#define HAVE_GETPID 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `iconv' library (-liconv). */
+/* #undef HAVE_LIBICONV */
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <magic.h> header file. */
+/* #undef HAVE_MAGIC_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `rb_errinfo' function. */
+/* #undef HAVE_RB_ERRINFO */
+
+/* Define to 1 if you have the `readlink' function. */
+#define HAVE_READLINK 1
+
+/* Define to 1 if you have the <serf.h> header file. */
+#define HAVE_SERF_H 1
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `symlink' function. */
+#define HAVE_SYMLINK 1
+
+/* 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/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the `tcgetattr' function. */
+#define HAVE_TCGETATTR 1
+
+/* Define to 1 if you have the `tcsetattr' function. */
+#define HAVE_TCSETATTR 1
+
+/* Defined if we have a usable termios library. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if you have the `uname' function. */
+#define HAVE_UNAME 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <zlib.h> header file. */
+/* #undef HAVE_ZLIB_H */
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://subversion.apache.org/"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "subversion"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "subversion 1.9.4"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "subversion"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.9.4"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Defined to build against httpd 2.4 with broken auth */
+/* #undef SVN_ALLOW_BROKEN_HTTPD_AUTH */
+
+/* Define to the Python/C API format character suitable for apr_int64_t */
+#define SVN_APR_INT64_T_PYCFMT "l"
+
+/* Defined to be the path to the installed binaries */
+#define SVN_BINDIR "/usr/bin"
+
+/* Defined to the config.guess name of the build system */
+#define SVN_BUILD_HOST "bikeshed-rgb-freebsd"
+
+/* Defined to the config.guess name of the build target */
+#define SVN_BUILD_TARGET "bikeshed-rgb-freebsd"
+
+/* The path of a default editor for the client. */
+/* #undef SVN_CLIENT_EDITOR */
+
+/* Defined if the full version matching rules are disabled */
+/* #undef SVN_DISABLE_FULL_VERSION_MATCH */
+
+/* Defined if plaintext password/passphrase storage is disabled */
+/* #undef SVN_DISABLE_PLAINTEXT_PASSWORD_STORAGE */
+
+/* The desired major version for the Berkeley DB */
+#define SVN_FS_WANT_DB_MAJOR 4
+
+/* The desired minor version for the Berkeley DB */
+#define SVN_FS_WANT_DB_MINOR 0
+
+/* The desired patch version for the Berkeley DB */
+#define SVN_FS_WANT_DB_PATCH 14
+
+/* Define if compiler provides atomic builtins */
+/* #undef SVN_HAS_ATOMIC_BUILTINS */
+
+/* Is GNOME Keyring support enabled? */
+/* #undef SVN_HAVE_GNOME_KEYRING */
+
+/* Is GPG Agent support enabled? */
+#define SVN_HAVE_GPG_AGENT 1
+
+/* Is Mac OS KeyChain support enabled? */
+/* #undef SVN_HAVE_KEYCHAIN_SERVICES */
+
+/* Defined if KWallet support is enabled */
+/* #undef SVN_HAVE_KWALLET */
+
+/* Defined if libmagic support is enabled */
+#define SVN_HAVE_LIBMAGIC 1
+
+/* Is Mach-O low-level _dyld API available? */
+/* #undef SVN_HAVE_MACHO_ITERATE */
+
+/* Is Mac OS property list API available? */
+/* #undef SVN_HAVE_MACOS_PLIST */
+
+/* Defined if apr_memcache (standalone or in apr-util) is present */
+#define SVN_HAVE_MEMCACHE 1
+
+/* Defined if Expat 1.0 or 1.1 was found */
+/* #undef SVN_HAVE_OLD_EXPAT */
+
+/* Defined if Cyrus SASL v2 is present on the system */
+/* #undef SVN_HAVE_SASL */
+
+/* Defined if support for Serf is enabled */
+#define SVN_HAVE_SERF 1
+
+/* Defined if libsvn_client should link against libsvn_ra_local */
+#define SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL 1
+
+/* Defined if libsvn_client should link against libsvn_ra_serf */
+#define SVN_LIBSVN_CLIENT_LINKS_RA_SERF 1
+
+/* Defined if libsvn_client should link against libsvn_ra_svn */
+#define SVN_LIBSVN_CLIENT_LINKS_RA_SVN 1
+
+/* Defined if libsvn_fs should link against libsvn_fs_base */
+/* #undef SVN_LIBSVN_FS_LINKS_FS_BASE */
+
+/* Defined if libsvn_fs should link against libsvn_fs_fs */
+#define SVN_LIBSVN_FS_LINKS_FS_FS 1
+
+/* Defined if libsvn_fs should link against libsvn_fs_x */
+#define SVN_LIBSVN_FS_LINKS_FS_X 1
+
+/* Defined to be the path to the installed locale dirs */
+#define SVN_LOCALE_DIR "NONE/share/locale"
+
+/* Defined to be the null device for the system */
+#define SVN_NULL_DEVICE_NAME "/dev/null"
+
+/* Defined to be the path separator used on your local filesystem */
+#define SVN_PATH_LOCAL_SEPARATOR '/'
+
+/* Subversion library major verson */
+#define SVN_SOVERSION 0
+
+/* Defined if svn should use the amalgamated version of sqlite */
+/* #undef SVN_SQLITE_INLINE */
+
+/* Defined if svn should try to load DSOs */
+/* #undef SVN_USE_DSO */
+
+/* Defined to build with patched httpd 2.4 and working auth */
+/* #undef SVN_USE_FORCE_AUTHN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+#ifdef SVN_WANT_BDB
+#define APU_WANT_DB
+
+#endif
+
+
+
+/* Indicate to translators that string X should be translated. Do not look
+ up the translation at run time; just expand to X. This macro is suitable
+ for use where a constant string is required at compile time. */
+#define N_(x) x
+/* Indicate to translators that we have decided the string X should not be
+ translated. Expand to X. */
+#define U_(x) x
+#ifdef ENABLE_NLS
+#include <locale.h>
+#include <libintl.h>
+/* Indicate to translators that string X should be translated. At run time,
+ look up and return the translation of X. */
+#define _(x) dgettext(PACKAGE_NAME, x)
+/* Indicate to translators that strings X1 and X2 are singular and plural
+ forms of the same message, and should be translated. At run time, return
+ an appropriate translation depending on the number N. */
+#define Q_(x1, x2, n) dngettext(PACKAGE_NAME, x1, x2, n)
+#else
+#define _(x) (x)
+#define Q_(x1, x2, n) (((n) == 1) ? x1 : x2)
+#define gettext(x) (x)
+#define dgettext(domain, x) (x)
+#endif
+
+/* compiler hints */
+#if defined(__GNUC__) && (__GNUC__ >= 3)
+# define SVN__PREDICT_FALSE(x) (__builtin_expect(x, 0))
+# define SVN__PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+#else
+# define SVN__PREDICT_FALSE(x) (x)
+# define SVN__PREDICT_TRUE(x) (x)
+#endif
+
+#if defined(SVN_DEBUG)
+# define SVN__FORCE_INLINE
+# define SVN__PREVENT_INLINE
+#elif defined(__GNUC__)
+# define SVN__FORCE_INLINE APR_INLINE __attribute__ ((always_inline))
+# define SVN__PREVENT_INLINE __attribute__ ((noinline))
+#else
+# define SVN__FORCE_INLINE APR_INLINE
+# define SVN__PREVENT_INLINE
+#endif
+
+/* Macro used to specify that a variable is intentionally left unused.
+ Supresses compiler warnings about the variable being unused. */
+#define SVN_UNUSED(v) ( (void)(v) )
+
diff --git a/usr.bin/svn/svnadmin/Makefile b/usr.bin/svn/svnadmin/Makefile
new file mode 100644
index 0000000..9cda0f0
--- /dev/null
+++ b/usr.bin/svn/svnadmin/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnadmin
+
+PROG= svn${SVNLITE}admin
+
+SRCS= svnadmin.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z pthread
+
+DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnadmin/Makefile.depend b/usr.bin/svn/svnadmin/Makefile.depend
new file mode 100644
index 0000000..1f7a760
--- /dev/null
+++ b/usr.bin/svn/svnadmin/Makefile.depend
@@ -0,0 +1,31 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnbench/Makefile b/usr.bin/svn/svnbench/Makefile
new file mode 100644
index 0000000..8f54baf
--- /dev/null
+++ b/usr.bin/svn/svnbench/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnbench
+
+PROG= svn${SVNLITE}bench
+
+SRCS= help-cmd.c notify.c null-blame-cmd.c null-export-cmd.c \
+ null-info-cmd.c null-list-cmd.c null-log-cmd.c svnbench.c util.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_CLIENTDIR} -lsvn_client \
+ -L${LIBSVN_WCDIR} -lsvn_wc \
+ -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+
+LIBADD+= bsdxml sqlite3 z magic crypto ssl pthread
+
+DPADD= ${LIBSVN_CLIENT} ${LIBSVN_WC} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} \
+ ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} ${LIBSVN_REPOS} \
+ ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} ${LIBSVN_DELTA} \
+ ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBSERF} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnbench/Makefile.depend b/usr.bin/svn/svnbench/Makefile.depend
new file mode 100644
index 0000000..979ea0b
--- /dev/null
+++ b/usr.bin/svn/svnbench/Makefile.depend
@@ -0,0 +1,42 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libmagic \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_client \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+ usr.bin/svn/lib/libsvn_wc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svndumpfilter/Makefile b/usr.bin/svn/svndumpfilter/Makefile
new file mode 100644
index 0000000..09bb541
--- /dev/null
+++ b/usr.bin/svn/svndumpfilter/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svndumpfilter
+
+PROG= svn${SVNLITE}dumpfilter
+
+SRCS= svndumpfilter.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z crypt pthread
+
+DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svndumpfilter/Makefile.depend b/usr.bin/svn/svndumpfilter/Makefile.depend
new file mode 100644
index 0000000..8495fb3
--- /dev/null
+++ b/usr.bin/svn/svndumpfilter/Makefile.depend
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnfsfs/Makefile b/usr.bin/svn/svnfsfs/Makefile
new file mode 100644
index 0000000..67be638
--- /dev/null
+++ b/usr.bin/svn/svnfsfs/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnfsfs
+
+PROG= svn${SVNLITE}fsfs
+
+SRCS= dump-index-cmd.c load-index-cmd.c stats-cmd.c svnfsfs.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z pthread
+
+DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnfsfs/Makefile.depend b/usr.bin/svn/svnfsfs/Makefile.depend
new file mode 100644
index 0000000..0b846ba
--- /dev/null
+++ b/usr.bin/svn/svnfsfs/Makefile.depend
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnlook/Makefile b/usr.bin/svn/svnlook/Makefile
new file mode 100644
index 0000000..f024d50
--- /dev/null
+++ b/usr.bin/svn/svnlook/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnlook
+
+PROG= svn${SVNLITE}look
+
+SRCS= svnlook.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z pthread
+
+DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnlook/Makefile.depend b/usr.bin/svn/svnlook/Makefile.depend
new file mode 100644
index 0000000..aa8be0e
--- /dev/null
+++ b/usr.bin/svn/svnlook/Makefile.depend
@@ -0,0 +1,32 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnmucc/Makefile b/usr.bin/svn/svnmucc/Makefile
new file mode 100644
index 0000000..0815b30
--- /dev/null
+++ b/usr.bin/svn/svnmucc/Makefile
@@ -0,0 +1,45 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnmucc
+
+PROG= svn${SVNLITE}mucc
+
+SRCS= svnmucc.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_CLIENTDIR} -lsvn_client \
+ -L${LIBSVN_WCDIR} -lsvn_wc \
+ -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z crypto ssl pthread
+
+DPADD= ${LIBSVN_CLIENT} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} \
+ ${LIBSVN_RA_SERF} ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} \
+ ${LIBSVN_FS_UTIL} ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBSERF} \
+ ${LIBAPR_UTIL} ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnmucc/Makefile.depend b/usr.bin/svn/svnmucc/Makefile.depend
new file mode 100644
index 0000000..c510cb3
--- /dev/null
+++ b/usr.bin/svn/svnmucc/Makefile.depend
@@ -0,0 +1,41 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_client \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+ usr.bin/svn/lib/libsvn_wc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnrdump/Makefile b/usr.bin/svn/svnrdump/Makefile
new file mode 100644
index 0000000..a63ac62
--- /dev/null
+++ b/usr.bin/svn/svnrdump/Makefile
@@ -0,0 +1,46 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnrdump
+
+PROG= svn${SVNLITE}rdump
+
+SRCS= dump_editor.c load_editor.c svnrdump.c util.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_CLIENTDIR} -lsvn_client \
+ -L${LIBSVN_WCDIR} -lsvn_wc \
+ -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z crypto ssl pthread
+
+DPADD= ${LIBSVN_CLIENT} ${LIBSVN_WC} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} \
+ ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} ${LIBSVN_REPOS} \
+ ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} ${LIBSVN_DELTA} \
+ ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBSERF} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnrdump/Makefile.depend b/usr.bin/svn/svnrdump/Makefile.depend
new file mode 100644
index 0000000..c510cb3
--- /dev/null
+++ b/usr.bin/svn/svnrdump/Makefile.depend
@@ -0,0 +1,41 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_client \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+ usr.bin/svn/lib/libsvn_wc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnserve/Makefile b/usr.bin/svn/svnserve/Makefile
new file mode 100644
index 0000000..4b79cf4
--- /dev/null
+++ b/usr.bin/svn/svnserve/Makefile
@@ -0,0 +1,42 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnserve
+
+PROG= svn${SVNLITE}serve
+
+SRCS= cyrus_auth.c log-escape.c logger.c serve.c svnserve.c winservice.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD= bsdxml sqlite3 z pthread
+
+DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
+ ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBSERF} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnserve/Makefile.depend b/usr.bin/svn/svnserve/Makefile.depend
new file mode 100644
index 0000000..edbca2e
--- /dev/null
+++ b/usr.bin/svn/svnserve/Makefile.depend
@@ -0,0 +1,36 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnsync/Makefile b/usr.bin/svn/svnsync/Makefile
new file mode 100644
index 0000000..dddd773
--- /dev/null
+++ b/usr.bin/svn/svnsync/Makefile
@@ -0,0 +1,42 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnsync
+
+PROG= svn${SVNLITE}sync
+
+SRCS= svnsync.c sync.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_RADIR} -lsvn_ra \
+ -L${LIBSVN_RA_LOCALDIR} -lsvn_ra_local \
+ -L${LIBSVN_RA_SVNDIR} -lsvn_ra_svn \
+ -L${LIBSVN_RA_SERFDIR} -lsvn_ra_serf \
+ -L${LIBSVN_REPOSDIR} -lsvn_repos \
+ -L${LIBSVN_FSDIR} -lsvn_fs \
+ -L${LIBSVN_FS_FSDIR} -lsvn_fs_fs \
+ -L${LIBSVN_FS_XDIR} -lsvn_fs_x \
+ -L${LIBSVN_FS_UTILDIR} -lsvn_fs_util \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBSERFDIR} -lserf \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD= bsdxml sqlite3 z crypto ssl pthread
+
+DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
+ ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
+ ${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBSERF} ${LIBAPR_UTIL} \
+ ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnsync/Makefile.depend b/usr.bin/svn/svnsync/Makefile.depend
new file mode 100644
index 0000000..2e39f66
--- /dev/null
+++ b/usr.bin/svn/svnsync/Makefile.depend
@@ -0,0 +1,38 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+ secure/lib/libssl \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libserf \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_fs \
+ usr.bin/svn/lib/libsvn_fs_fs \
+ usr.bin/svn/lib/libsvn_fs_util \
+ usr.bin/svn/lib/libsvn_fs_x \
+ usr.bin/svn/lib/libsvn_ra \
+ usr.bin/svn/lib/libsvn_ra_local \
+ usr.bin/svn/lib/libsvn_ra_serf \
+ usr.bin/svn/lib/libsvn_ra_svn \
+ usr.bin/svn/lib/libsvn_repos \
+ usr.bin/svn/lib/libsvn_subr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/svn/svnversion/Makefile b/usr.bin/svn/svnversion/Makefile
new file mode 100644
index 0000000..de59168
--- /dev/null
+++ b/usr.bin/svn/svnversion/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+MAN=
+
+.include "${.CURDIR}/../Makefile.inc"
+
+.PATH: ${SVNDIR}/svnversion
+
+PROG= svn${SVNLITE}version
+
+SRCS= svnversion.c
+
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
+ -I${.CURDIR}/../lib/libapr \
+ -I${APR}/include/arch/unix \
+ -I${APR}/include \
+ -I${.CURDIR}/../lib/libapr_util \
+ -I${APRU}/include/private \
+ -I${APRU}/include
+
+LDADD= -L${LIBSVN_WCDIR} -lsvn_wc \
+ -L${LIBSVN_DELTADIR} -lsvn_delta \
+ -L${LIBSVN_DIFFDIR} -lsvn_diff \
+ -L${LIBSVN_SUBRDIR} -lsvn_subr \
+ -L${LIBAPR_UTILDIR} -lapr-util \
+ -L${LIBAPRDIR} -lapr
+LIBADD+= bsdxml sqlite3 z pthread
+
+DPADD= ${LIBSVN_WC} ${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} \
+ ${LIBSERF} ${LIBAPR_UTIL} ${LIBAPR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnversion/Makefile.depend b/usr.bin/svn/svnversion/Makefile.depend
new file mode 100644
index 0000000..65b3e9a
--- /dev/null
+++ b/usr.bin/svn/svnversion/Makefile.depend
@@ -0,0 +1,28 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libsqlite3 \
+ lib/libthr \
+ lib/libz \
+ usr.bin/svn/lib/libapr \
+ usr.bin/svn/lib/libapr_util \
+ usr.bin/svn/lib/libsvn_delta \
+ usr.bin/svn/lib/libsvn_diff \
+ usr.bin/svn/lib/libsvn_subr \
+ usr.bin/svn/lib/libsvn_wc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile
new file mode 100644
index 0000000..f0de9fb
--- /dev/null
+++ b/usr.bin/systat/Makefile
@@ -0,0 +1,21 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= systat
+SRCS= cmds.c cmdtab.c devs.c fetch.c iostat.c keyboard.c main.c \
+ netcmds.c netstat.c pigs.c swap.c icmp.c \
+ mode.c ip.c sctp.c tcp.c zarc.c \
+ vmstat.c convtbl.c ifcmds.c ifstat.c
+
+.if ${MK_INET6_SUPPORT} != "no"
+SRCS+= icmp6.c ip6.c
+CFLAGS+= -DINET6
+.endif
+
+WARNS?= 1
+
+LIBADD= ncursesw m devstat kvm
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/systat/Makefile.depend b/usr.bin/systat/Makefile.depend
new file mode 100644
index 0000000..f0f4602
--- /dev/null
+++ b/usr.bin/systat/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdevstat \
+ lib/libelf \
+ lib/libkvm \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c
new file mode 100644
index 0000000..f461f94
--- /dev/null
+++ b/usr.bin/systat/cmds.c
@@ -0,0 +1,196 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
+#endif
+
+#include <sys/param.h>
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "systat.h"
+#include "extern.h"
+
+void
+command(const char *cmd)
+{
+ struct cmdtab *p;
+ char *cp, *tmpstr, *tmpstr1;
+ double t;
+
+ tmpstr = tmpstr1 = strdup(cmd);
+ for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ if (*tmpstr1 == '\0')
+ return;
+ for (; *cp && isspace(*cp); cp++)
+ ;
+ if (strcmp(tmpstr1, "quit") == 0 || strcmp(tmpstr1, "q") == 0)
+ die(0);
+ if (strcmp(tmpstr1, "load") == 0) {
+ load();
+ goto done;
+ }
+ if (strcmp(tmpstr1, "stop") == 0) {
+ delay = 0;
+ mvaddstr(CMDLINE, 0, "Refresh disabled.");
+ clrtoeol();
+ goto done;
+ }
+ if (strcmp(tmpstr1, "help") == 0) {
+ int _col, _len;
+
+ move(CMDLINE, _col = 0);
+ for (p = cmdtab; p->c_name; p++) {
+ _len = strlen(p->c_name);
+ if (_col + _len > COLS)
+ break;
+ addstr(p->c_name); _col += _len;
+ if (_col + 1 < COLS)
+ addch(' ');
+ }
+ clrtoeol();
+ goto done;
+ }
+ t = strtod(tmpstr1, NULL) * 1000000.0;
+ if (t > 0 && t < (double)UINT_MAX)
+ delay = (unsigned int)t;
+ if ((t <= 0 || t > (double)UINT_MAX) &&
+ (strcmp(tmpstr1, "start") == 0 ||
+ strcmp(tmpstr1, "interval") == 0)) {
+ if (*cp != '\0') {
+ t = strtod(cp, NULL) * 1000000.0;
+ if (t <= 0 || t >= (double)UINT_MAX) {
+ error("%d: bad interval.", (int)t);
+ goto done;
+ }
+ }
+ }
+ if (t > 0) {
+ delay = (unsigned int)t;
+ display();
+ status();
+ goto done;
+ }
+ p = lookup(tmpstr1);
+ if (p == (struct cmdtab *)-1) {
+ error("%s: Ambiguous command.", tmpstr1);
+ goto done;
+ }
+ if (p) {
+ if (curcmd == p)
+ goto done;
+ (*curcmd->c_close)(wnd);
+ curcmd->c_flags &= ~CF_INIT;
+ wnd = (*p->c_open)();
+ if (wnd == NULL) {
+ error("Couldn't open new display");
+ wnd = (*curcmd->c_open)();
+ if (wnd == NULL) {
+ error("Couldn't change back to previous cmd");
+ exit(1);
+ }
+ p = curcmd;
+ }
+ if ((p->c_flags & CF_INIT) == 0) {
+ if ((*p->c_init)())
+ p->c_flags |= CF_INIT;
+ else
+ goto done;
+ }
+ curcmd = p;
+ labels();
+ display();
+ status();
+ goto done;
+ }
+ if (curcmd->c_cmd == NULL || !(*curcmd->c_cmd)(tmpstr1, cp))
+ error("%s: Unknown command.", tmpstr1);
+done:
+ free(tmpstr);
+}
+
+struct cmdtab *
+lookup(const char *name)
+{
+ const char *p, *q;
+ struct cmdtab *ct, *found;
+ int nmatches, longest;
+
+ longest = 0;
+ nmatches = 0;
+ found = (struct cmdtab *) 0;
+ for (ct = cmdtab; (p = ct->c_name); ct++) {
+ for (q = name; *q == *p++; q++)
+ if (*q == 0) /* exact match? */
+ return (ct);
+ if (!*q) { /* the name was a prefix */
+ if (q - name > longest) {
+ longest = q - name;
+ nmatches = 1;
+ found = ct;
+ } else if (q - name == longest)
+ nmatches++;
+ }
+ }
+ if (nmatches > 1)
+ return ((struct cmdtab *)-1);
+ return (found);
+}
+
+void
+status(void)
+{
+
+ error("Showing %s, refresh every %d seconds.",
+ curcmd->c_name, delay / 1000000);
+}
+
+int
+prefix(const char *s1, const char *s2)
+{
+
+ while (*s1 == *s2) {
+ if (*s1 == '\0')
+ return (1);
+ s1++, s2++;
+ }
+ return (*s1 == '\0');
+}
diff --git a/usr.bin/systat/cmdtab.c b/usr.bin/systat/cmdtab.c
new file mode 100644
index 0000000..cb021e0
--- /dev/null
+++ b/usr.bin/systat/cmdtab.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+struct cmdtab cmdtab[] = {
+ { "pigs", showpigs, fetchpigs, labelpigs,
+ initpigs, openpigs, closepigs, 0,
+ 0, CF_LOADAV },
+ { "swap", showswap, fetchswap, labelswap,
+ initswap, openswap, closeswap, 0,
+ 0, CF_LOADAV },
+ { "iostat", showiostat, fetchiostat, labeliostat,
+ initiostat, openiostat, closeiostat, cmdiostat,
+ 0, CF_LOADAV },
+ { "vmstat", showkre, fetchkre, labelkre,
+ initkre, openkre, closekre, cmdkre,
+ 0, 0 },
+ { "netstat", shownetstat, fetchnetstat, labelnetstat,
+ initnetstat, opennetstat, closenetstat, cmdnetstat,
+ 0, CF_LOADAV },
+ { "icmp", showicmp, fetchicmp, labelicmp,
+ initicmp, openicmp, closeicmp, cmdmode,
+ reseticmp, CF_LOADAV },
+ { "ip", showip, fetchip, labelip,
+ initip, openip, closeip, cmdmode,
+ resetip, CF_LOADAV },
+#ifdef INET6
+ { "icmp6", showicmp6, fetchicmp6, labelicmp6,
+ initicmp6, openicmp6, closeicmp6, cmdmode,
+ reseticmp6, CF_LOADAV },
+ { "ip6", showip6, fetchip6, labelip6,
+ initip6, openip6, closeip6, cmdmode,
+ resetip6, CF_LOADAV },
+#endif
+ { "sctp", showsctp, fetchsctp, labelsctp,
+ initsctp, opensctp, closesctp, cmdmode,
+ resetsctp, CF_LOADAV },
+ { "tcp", showtcp, fetchtcp, labeltcp,
+ inittcp, opentcp, closetcp, cmdmode,
+ resettcp, CF_LOADAV },
+ { "ifstat", showifstat, fetchifstat, labelifstat,
+ initifstat, openifstat, closeifstat, cmdifstat,
+ 0, CF_LOADAV },
+ { "zarc", showzarc, fetchzarc, labelzarc,
+ initzarc, openzarc, closezarc, 0,
+ resetzarc, CF_ZFSARC },
+ { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 }
+};
+struct cmdtab *curcmd = &cmdtab[0];
diff --git a/usr.bin/systat/convtbl.c b/usr.bin/systat/convtbl.c
new file mode 100644
index 0000000..bebb040
--- /dev/null
+++ b/usr.bin/systat/convtbl.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>.
+ * 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. 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 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$
+ */
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include "convtbl.h"
+
+#define BIT (8)
+#define BITS (1)
+#define KILOBIT (1000LL)
+#define MEGABIT (KILOBIT * 1000)
+#define GIGABIT (MEGABIT * 1000)
+#define TERABIT (GIGABIT * 1000)
+
+#define BYTE (1)
+#define BYTES (1)
+#define KILOBYTE (1024LL)
+#define MEGABYTE (KILOBYTE * 1024)
+#define GIGABYTE (MEGABYTE * 1024)
+#define TERABYTE (GIGABYTE * 1024)
+
+struct convtbl {
+ uintmax_t mul;
+ uintmax_t scale;
+ const char *str;
+ const char *name;
+};
+
+static struct convtbl convtbl[] = {
+ /* mul, scale, str, name */
+ [SC_BYTE] = { BYTE, BYTES, "B", "byte" },
+ [SC_KILOBYTE] = { BYTE, KILOBYTE, "KB", "kbyte" },
+ [SC_MEGABYTE] = { BYTE, MEGABYTE, "MB", "mbyte" },
+ [SC_GIGABYTE] = { BYTE, GIGABYTE, "GB", "gbyte" },
+ [SC_TERABYTE] = { BYTE, TERABYTE, "TB", "tbyte" },
+
+ [SC_BIT] = { BIT, BITS, "b", "bit" },
+ [SC_KILOBIT] = { BIT, KILOBIT, "Kb", "kbit" },
+ [SC_MEGABIT] = { BIT, MEGABIT, "Mb", "mbit" },
+ [SC_GIGABIT] = { BIT, GIGABIT, "Gb", "gbit" },
+ [SC_TERABIT] = { BIT, TERABIT, "Tb", "tbit" },
+
+ [SC_AUTO] = { 0, 0, "", "auto" }
+};
+
+static
+struct convtbl *
+get_tbl_ptr(const uintmax_t size, const int scale)
+{
+ uintmax_t tmp;
+ int idx;
+
+ /* If our index is out of range, default to auto-scaling. */
+ idx = scale < SC_AUTO ? scale : SC_AUTO;
+
+ if (idx == SC_AUTO)
+ /*
+ * Simple but elegant algorithm. Count how many times
+ * we can shift our size value right by a factor of ten,
+ * incrementing an index each time. We then use the
+ * index as the array index into the conversion table.
+ */
+ for (tmp = size, idx = SC_KILOBYTE;
+ tmp >= MEGABYTE && idx < SC_BIT - 1;
+ tmp >>= 10, idx++);
+
+ return (&convtbl[idx]);
+}
+
+double
+convert(const uintmax_t size, const int scale)
+{
+ struct convtbl *tp;
+
+ tp = get_tbl_ptr(size, scale);
+ return ((double)size * tp->mul / tp->scale);
+
+}
+
+const char *
+get_string(const uintmax_t size, const int scale)
+{
+ struct convtbl *tp;
+
+ tp = get_tbl_ptr(size, scale);
+ return (tp->str);
+}
+
+int
+get_scale(const char *name)
+{
+ int i;
+
+ for (i = 0; i <= SC_AUTO; i++)
+ if (strcmp(convtbl[i].name, name) == 0)
+ return (i);
+ return (-1);
+}
+
+const char *
+get_helplist(void)
+{
+ int i;
+ size_t len;
+ static char *buf;
+
+ if (buf == NULL) {
+ len = 0;
+ for (i = 0; i <= SC_AUTO; i++)
+ len += strlen(convtbl[i].name) + 2;
+ if ((buf = malloc(len)) != NULL) {
+ buf[0] = '\0';
+ for (i = 0; i <= SC_AUTO; i++) {
+ strcat(buf, convtbl[i].name);
+ if (i < SC_AUTO)
+ strcat(buf, ", ");
+ }
+ } else
+ return ("");
+ }
+ return (buf);
+}
diff --git a/usr.bin/systat/convtbl.h b/usr.bin/systat/convtbl.h
new file mode 100644
index 0000000..051e1cd
--- /dev/null
+++ b/usr.bin/systat/convtbl.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>.
+ * 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. 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 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 _CONVTBL_H_
+#define _CONVTBL_H_
+
+#include <sys/types.h>
+#include <stdint.h>
+
+/*
+ * Keep the order in the enum.
+ */
+enum scale {
+ SC_BYTE,
+ SC_KILOBYTE,
+ SC_MEGABYTE,
+ SC_GIGABYTE,
+ SC_TERABYTE,
+ SC_BIT,
+ SC_KILOBIT,
+ SC_MEGABIT,
+ SC_GIGABIT,
+ SC_TERABIT,
+ SC_AUTO /* KEEP THIS LAST */
+};
+
+extern double convert(const uintmax_t, const int);
+extern const char *get_helplist(void);
+extern int get_scale(const char *);
+extern const char *get_string(const uintmax_t, const int);
+
+#endif /* ! _CONVTBL_H_ */
diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c
new file mode 100644
index 0000000..3c74fb7
--- /dev/null
+++ b/usr.bin/systat/devs.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 1998 Kenneth D. Merry.
+ * 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. 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 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.
+ */
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/devicestat.h>
+#include <sys/resource.h>
+
+#include <ctype.h>
+#include <devstat.h>
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "devs.h"
+
+typedef enum {
+ DS_MATCHTYPE_NONE,
+ DS_MATCHTYPE_SPEC,
+ DS_MATCHTYPE_PATTERN
+} last_match_type;
+
+last_match_type last_type;
+struct device_selection *dev_select;
+long generation;
+int num_devices, num_selected;
+int num_selections;
+long select_generation;
+struct devstat_match *matches = NULL;
+int num_matches = 0;
+char **specified_devices;
+int num_devices_specified = 0;
+
+static int dsmatchselect(const char *args, devstat_select_mode select_mode,
+ int maxshowdevs, struct statinfo *s1);
+static int dsselect(const char *args, devstat_select_mode select_mode,
+ int maxshowdevs, struct statinfo *s1);
+
+int
+dsinit(int maxshowdevs, struct statinfo *s1, struct statinfo *s2 __unused,
+ struct statinfo *s3 __unused)
+{
+
+ /*
+ * Make sure that the userland devstat version matches the kernel
+ * devstat version. If not, exit and print a message informing
+ * the user of his mistake.
+ */
+ if (devstat_checkversion(NULL) < 0)
+ errx(1, "%s", devstat_errbuf);
+
+ generation = 0;
+ num_devices = 0;
+ num_selected = 0;
+ num_selections = 0;
+ select_generation = 0;
+ last_type = DS_MATCHTYPE_NONE;
+
+ if (devstat_getdevs(NULL, s1) == -1)
+ errx(1, "%s", devstat_errbuf);
+
+ num_devices = s1->dinfo->numdevs;
+ generation = s1->dinfo->generation;
+
+ dev_select = NULL;
+
+ /*
+ * At this point, selectdevs will almost surely indicate that the
+ * device list has changed, so we don't look for return values of 0
+ * or 1. If we get back -1, though, there is an error.
+ */
+ if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation, s1->dinfo->devices, num_devices,
+ NULL, 0, NULL, 0, DS_SELECT_ADD, maxshowdevs, 0) == -1)
+ errx(1, "%d %s", __LINE__, devstat_errbuf);
+
+ return(1);
+}
+
+int
+dscmd(const char *cmd, const char *args, int maxshowdevs, struct statinfo *s1)
+{
+ int retval;
+
+ if (prefix(cmd, "display") || prefix(cmd, "add"))
+ return(dsselect(args, DS_SELECT_ADDONLY, maxshowdevs, s1));
+ if (prefix(cmd, "ignore") || prefix(cmd, "delete"))
+ return(dsselect(args, DS_SELECT_REMOVE, maxshowdevs, s1));
+ if (prefix(cmd, "show") || prefix(cmd, "only"))
+ return(dsselect(args, DS_SELECT_ONLY, maxshowdevs, s1));
+ if (prefix(cmd, "type") || prefix(cmd, "match"))
+ return(dsmatchselect(args, DS_SELECT_ONLY, maxshowdevs, s1));
+ if (prefix(cmd, "refresh")) {
+ retval = devstat_selectdevs(&dev_select, &num_selected,
+ &num_selections, &select_generation, generation,
+ s1->dinfo->devices, num_devices,
+ (last_type ==DS_MATCHTYPE_PATTERN) ? matches : NULL,
+ (last_type ==DS_MATCHTYPE_PATTERN) ? num_matches : 0,
+ (last_type == DS_MATCHTYPE_SPEC) ?specified_devices : NULL,
+ (last_type == DS_MATCHTYPE_SPEC) ?num_devices_specified : 0,
+ (last_type == DS_MATCHTYPE_NONE) ? DS_SELECT_ADD :
+ DS_SELECT_ADDONLY, maxshowdevs, 0);
+ if (retval == -1) {
+ warnx("%s", devstat_errbuf);
+ return(0);
+ } else if (retval == 1)
+ return(2);
+ }
+ if (prefix(cmd, "drives")) {
+ int i;
+ move(CMDLINE, 0);
+ clrtoeol();
+ for (i = 0; i < num_devices; i++) {
+ printw("%s%d ", s1->dinfo->devices[i].device_name,
+ s1->dinfo->devices[i].unit_number);
+ }
+ return(1);
+ }
+ return(0);
+}
+
+static int
+dsmatchselect(const char *args, devstat_select_mode select_mode, int maxshowdevs,
+ struct statinfo *s1)
+{
+ char **tempstr, *tmpstr, *tmpstr1;
+ char *tstr[100];
+ int num_args = 0;
+ int i;
+ int retval = 0;
+
+ /*
+ * Break the (pipe delimited) input string out into separate
+ * strings.
+ */
+ tmpstr = tmpstr1 = strdup(args);
+ for (tempstr = tstr, num_args = 0;
+ (*tempstr = strsep(&tmpstr1, "|")) != NULL && (num_args < 100);
+ num_args++)
+ if (**tempstr != '\0')
+ if (++tempstr >= &tstr[100])
+ break;
+ free(tmpstr);
+
+ if (num_args > 99) {
+ warnx("dsmatchselect: too many match arguments");
+ return(0);
+ }
+
+ /*
+ * If we've gone through the matching code before, clean out
+ * previously used memory.
+ */
+ if (num_matches > 0) {
+ free(matches);
+ matches = NULL;
+ num_matches = 0;
+ }
+
+ for (i = 0; i < num_args; i++) {
+ if (devstat_buildmatch(tstr[i], &matches, &num_matches) != 0) {
+ warnx("%s", devstat_errbuf);
+ return(0);
+ }
+ }
+ if (num_args > 0) {
+
+ last_type = DS_MATCHTYPE_PATTERN;
+
+ retval = devstat_selectdevs(&dev_select, &num_selected,
+ &num_selections, &select_generation, generation,
+ s1->dinfo->devices, num_devices, matches, num_matches,
+ NULL, 0, select_mode, maxshowdevs, 0);
+ if (retval == -1)
+ err(1, "device selection error");
+ else if (retval == 1)
+ return(2);
+ }
+ return(1);
+}
+
+static int
+dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs,
+ struct statinfo *s1)
+{
+ char *cp, *tmpstr, *tmpstr1, *buffer;
+ int i;
+ int retval = 0;
+
+ /*
+ * If we've gone through this code before, free previously
+ * allocated resources.
+ */
+ if (num_devices_specified > 0) {
+ for (i = 0; i < num_devices_specified; i++)
+ free(specified_devices[i]);
+ free(specified_devices);
+ specified_devices = NULL;
+ num_devices_specified = 0;
+ }
+
+ /* do an initial malloc */
+ specified_devices = (char **)malloc(sizeof(char *));
+
+ tmpstr = tmpstr1 = strdup(args);
+ cp = strchr(tmpstr1, '\n');
+ if (cp)
+ *cp = '\0';
+ for (;;) {
+ for (cp = tmpstr1; *cp && isspace(*cp); cp++)
+ ;
+ tmpstr1 = cp;
+ for (; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ if (cp - args == 0)
+ break;
+ for (i = 0; i < num_devices; i++) {
+ asprintf(&buffer, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ if (strcmp(buffer, tmpstr1) == 0) {
+
+ num_devices_specified++;
+
+ specified_devices =(char **)realloc(
+ specified_devices,
+ sizeof(char *) *
+ num_devices_specified);
+ specified_devices[num_devices_specified -1]=
+ strdup(tmpstr1);
+ free(buffer);
+
+ break;
+ }
+ else
+ free(buffer);
+ }
+ if (i >= num_devices)
+ error("%s: unknown drive", args);
+ args = cp;
+ }
+ free(tmpstr);
+
+ if (num_devices_specified > 0) {
+ last_type = DS_MATCHTYPE_SPEC;
+
+ retval = devstat_selectdevs(&dev_select, &num_selected,
+ &num_selections, &select_generation, generation,
+ s1->dinfo->devices, num_devices, NULL, 0,
+ specified_devices, num_devices_specified,
+ select_mode, maxshowdevs, 0);
+ if (retval == -1)
+ err(1, "%s", devstat_errbuf);
+ else if (retval == 1)
+ return(2);
+ }
+ return(1);
+}
diff --git a/usr.bin/systat/devs.h b/usr.bin/systat/devs.h
new file mode 100644
index 0000000..9217008
--- /dev/null
+++ b/usr.bin/systat/devs.h
@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 1998 David E. O'Brien
+ * 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$
+ */
+
+int dsinit(int, struct statinfo *, struct statinfo *, struct statinfo *);
+int dscmd(const char *, const char *, int, struct statinfo *);
diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h
new file mode 100644
index 0000000..272eead
--- /dev/null
+++ b/usr.bin/systat/extern.h
@@ -0,0 +1,177 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+#include <fcntl.h>
+#include <kvm.h>
+
+extern struct cmdtab *curcmd;
+extern struct cmdtab cmdtab[];
+extern struct text *xtext;
+extern WINDOW *wnd;
+extern char **dr_name;
+extern char c, *namp, hostname[];
+extern double avenrun[3];
+extern float *dk_mspw;
+extern kvm_t *kd;
+extern long ntext, textp;
+extern int *dk_select;
+extern int CMDLINE;
+extern int dk_ndrive;
+extern int hz, stathz;
+extern double hertz; /* sampling frequency for cp_time and dk_time */
+extern int col;
+extern int nhosts;
+extern int nports;
+extern int protos;
+extern int verbose;
+extern unsigned int delay;
+
+struct inpcb;
+
+extern struct device_selection *dev_select;
+extern long generation;
+extern int num_devices;
+extern int num_selected;
+extern int num_selections;
+extern long select_generation;
+
+extern struct nlist namelist[];
+
+int checkhost(struct inpcb *);
+int checkport(struct inpcb *);
+void closeicmp(WINDOW *);
+void closeicmp6(WINDOW *);
+void closeifstat(WINDOW *);
+void closeiostat(WINDOW *);
+void closeip(WINDOW *);
+void closeip6(WINDOW *);
+void closekre(WINDOW *);
+void closenetstat(WINDOW *);
+void closepigs(WINDOW *);
+void closeswap(WINDOW *);
+void closetcp(WINDOW *);
+int cmdifstat(const char *, const char *);
+int cmdiostat(const char *, const char *);
+int cmdkre(const char *, const char *);
+int cmdnetstat(const char *, const char *);
+struct cmdtab *lookup(const char *);
+void command(const char *);
+void die(int);
+void display(void);
+int dkinit(void);
+int dkcmd(char *, char *);
+void error(const char *fmt, ...) __printflike(1, 2);
+void fetchicmp(void);
+void fetchicmp6(void);
+void fetchifstat(void);
+void fetchip(void);
+void fetchip6(void);
+void fetchiostat(void);
+void fetchkre(void);
+void fetchnetstat(void);
+void fetchpigs(void);
+void fetchswap(void);
+void fetchtcp(void);
+void getsysctl(const char *, void *, size_t);
+int ifcmd(const char *cmd, const char *args);
+int initicmp(void);
+int initicmp6(void);
+int initifstat(void);
+int initip(void);
+int initip6(void);
+int initiostat(void);
+int initkre(void);
+int initnetstat(void);
+int initpigs(void);
+int initswap(void);
+int inittcp(void);
+int keyboard(void);
+int kvm_ckread(void *, void *, int);
+void labelicmp(void);
+void labelicmp6(void);
+void labelifstat(void);
+void labelip(void);
+void labelip6(void);
+void labeliostat(void);
+void labelkre(void);
+void labelnetstat(void);
+void labelpigs(void);
+void labels(void);
+void labelswap(void);
+void labeltcp(void);
+void load(void);
+int netcmd(const char *, const char *);
+void nlisterr(struct nlist []);
+WINDOW *openicmp(void);
+WINDOW *openicmp6(void);
+WINDOW *openifstat(void);
+WINDOW *openip(void);
+WINDOW *openip6(void);
+WINDOW *openiostat(void);
+WINDOW *openkre(void);
+WINDOW *opennetstat(void);
+WINDOW *openpigs(void);
+WINDOW *openswap(void);
+WINDOW *opentcp(void);
+int prefix(const char *, const char *);
+void reseticmp(void);
+void reseticmp6(void);
+void resetip(void);
+void resetip6(void);
+void resettcp(void);
+void showicmp(void);
+void showicmp6(void);
+void showifstat(void);
+void showip(void);
+void showip6(void);
+void showiostat(void);
+void showkre(void);
+void shownetstat(void);
+void showpigs(void);
+void showswap(void);
+void showtcp(void);
+void status(void);
+void suspend(int);
+char *sysctl_dynread(const char *, size_t *);
+
+#define SYSTAT_CMD(name) \
+ void close ## name(WINDOW *); \
+ void fetch ## name(void); \
+ int init ## name(void); \
+ void label ## name(void); \
+ WINDOW *open ## name(void); \
+ void reset ## name(void); \
+ void show ## name(void)
+
+SYSTAT_CMD( zarc );
+SYSTAT_CMD ( sctp );
diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c
new file mode 100644
index 0000000..d159e51
--- /dev/null
+++ b/usr.bin/systat/fetch.c
@@ -0,0 +1,138 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+
+int
+kvm_ckread(void *a, void *b, int l)
+{
+ if (kvm_read(kd, (u_long)a, b, l) != l) {
+ if (verbose)
+ error("error reading kmem at %p", a);
+ return (0);
+ }
+ else
+ return (1);
+}
+
+void getsysctl(const char *name, void *ptr, size_t len)
+{
+ size_t nlen = len;
+ if (sysctlbyname(name, ptr, &nlen, NULL, 0) != 0) {
+ error("sysctl(%s...) failed: %s", name,
+ strerror(errno));
+ }
+ if (nlen != len) {
+ error("sysctl(%s...) expected %lu, got %lu", name,
+ (unsigned long)len, (unsigned long)nlen);
+ }
+}
+
+/*
+ * Read sysctl data with variable size. Try some times (with increasing
+ * buffers), fail if still too small.
+ * This is needed sysctls with possibly raplidly increasing data sizes,
+ * but imposes little overhead in the case of constant sizes.
+ * Returns NULL on error, or a pointer to freshly malloc()'ed memory that holds
+ * the requested data.
+ * If szp is not NULL, the size of the returned data will be written into *szp.
+ */
+
+/* Some defines: Number of tries. */
+#define SD_NTRIES 10
+/* Percent of over-allocation (initial) */
+#define SD_MARGIN 10
+/*
+ * Factor for over-allocation in percent (the margin is increased by this on
+ * any failed try).
+ */
+#define SD_FACTOR 50
+/* Maximum supported MIB depth */
+#define SD_MAXMIB 16
+
+char *
+sysctl_dynread(const char *n, size_t *szp)
+{
+ char *rv = NULL;
+ int mib[SD_MAXMIB];
+ size_t mibsz = SD_MAXMIB;
+ size_t mrg = SD_MARGIN;
+ size_t sz;
+ int i;
+
+ /* cache the MIB */
+ if (sysctlnametomib(n, mib, &mibsz) == -1) {
+ if (errno == ENOMEM) {
+ error("XXX: SD_MAXMIB too small, please bump!");
+ }
+ return NULL;
+ }
+ for (i = 0; i < SD_NTRIES; i++) {
+ /* get needed buffer size */
+ if (sysctl(mib, mibsz, NULL, &sz, NULL, 0) == -1)
+ break;
+ sz += sz * mrg / 100;
+ if ((rv = (char *)malloc(sz)) == NULL) {
+ error("Out of memory!");
+ return NULL;
+ }
+ if (sysctl(mib, mibsz, rv, &sz, NULL, 0) == -1) {
+ free(rv);
+ rv = NULL;
+ if (errno == ENOMEM) {
+ mrg += mrg * SD_FACTOR / 100;
+ } else
+ break;
+ } else {
+ /* success */
+ if (szp != NULL)
+ *szp = sz;
+ break;
+ }
+ }
+
+ return rv;
+}
diff --git a/usr.bin/systat/icmp.c b/usr.bin/systat/icmp.c
new file mode 100644
index 0000000..6085a90
--- /dev/null
+++ b/usr.bin/systat/icmp.c
@@ -0,0 +1,279 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/* From:
+ "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
+*/
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/icmp_var.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+static struct icmpstat icmpstat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 ICMP Input ICMP Output
+01999999999 total messages 999999999 total messages
+02999999999 with bad code 999999999 errors generated
+03999999999 with bad length 999999999 suppressed - original too short
+04999999999 with bad checksum 999999999 suppressed - original was ICMP
+05999999999 with insufficient data 999999999 responses sent
+06 999999999 suppressed - multicast echo
+07 999999999 suppressed - multicast tstamp
+08
+09 Input Histogram Output Histogram
+10999999999 echo response 999999999 echo response
+11999999999 echo request 999999999 echo request
+12999999999 destination unreachable 999999999 destination unreachable
+13999999999 redirect 999999999 redirect
+14999999999 time-to-live exceeded 999999999 time-to-line exceeded
+15999999999 parameter problem 999999999 parameter problem
+16999999999 router advertisement 999999999 router solicitation
+17
+18
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+openicmp(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeicmp(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labelicmp(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 10, str)
+#define R(row, str) mvwprintw(wnd, row, 45, str);
+ L(0, "ICMP Input"); R(0, "ICMP Output");
+ L(1, "total messages"); R(1, "total messages");
+ L(2, "with bad code"); R(2, "errors generated");
+ L(3, "with bad length"); R(3, "suppressed - original too short");
+ L(4, "with bad checksum"); R(4, "suppressed - original was ICMP");
+ L(5, "with insufficient data"); R(5, "responses sent");
+ R(6, "suppressed - multicast echo");
+ R(7, "suppressed - multicast tstamp");
+ L(9, "Input Histogram"); R(9, "Output Histogram");
+#define B(row, str) L(row, str); R(row, str)
+ B(10, "echo response");
+ B(11, "echo request");
+ B(12, "destination unreachable");
+ B(13, "redirect");
+ B(14, "time-to-live exceeded");
+ B(15, "parameter problem");
+ L(16, "router advertisement"); R(16, "router solicitation");
+#undef L
+#undef R
+#undef B
+}
+
+static void
+domode(struct icmpstat *ret)
+{
+ const struct icmpstat *sub;
+ int i, divisor = 1;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = icmpstat;
+ return;
+ }
+#define DO(stat) ret->stat = (icmpstat.stat - sub->stat) / divisor
+ DO(icps_error);
+ DO(icps_oldshort);
+ DO(icps_oldicmp);
+ for (i = 0; i <= ICMP_MAXTYPE; i++) {
+ DO(icps_outhist[i]);
+ }
+ DO(icps_badcode);
+ DO(icps_tooshort);
+ DO(icps_checksum);
+ DO(icps_badlen);
+ DO(icps_reflect);
+ for (i = 0; i <= ICMP_MAXTYPE; i++) {
+ DO(icps_inhist[i]);
+ }
+ DO(icps_bmcastecho);
+ DO(icps_bmcasttstamp);
+#undef DO
+}
+
+void
+showicmp(void)
+{
+ struct icmpstat stats;
+ u_long totalin, totalout;
+ int i;
+
+ memset(&stats, 0, sizeof stats);
+ domode(&stats);
+ for (i = totalin = totalout = 0; i <= ICMP_MAXTYPE; i++) {
+ totalin += stats.icps_inhist[i];
+ totalout += stats.icps_outhist[i];
+ }
+ totalin += stats.icps_badcode + stats.icps_badlen +
+ stats.icps_checksum + stats.icps_tooshort;
+ mvwprintw(wnd, 1, 0, "%9lu", totalin);
+ mvwprintw(wnd, 1, 35, "%9lu", totalout);
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%9lu", stats.stat)
+
+ DO(icps_badcode, 2, 0);
+ DO(icps_badlen, 3, 0);
+ DO(icps_checksum, 4, 0);
+ DO(icps_tooshort, 5, 0);
+ DO(icps_error, 2, 35);
+ DO(icps_oldshort, 3, 35);
+ DO(icps_oldicmp, 4, 35);
+ DO(icps_reflect, 5, 35);
+ DO(icps_bmcastecho, 6, 35);
+ DO(icps_bmcasttstamp, 7, 35);
+#define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \
+ row, 35)
+ DO2(ICMP_ECHOREPLY, 10);
+ DO2(ICMP_ECHO, 11);
+ DO2(ICMP_UNREACH, 12);
+ DO2(ICMP_REDIRECT, 13);
+ DO2(ICMP_TIMXCEED, 14);
+ DO2(ICMP_PARAMPROB, 15);
+ DO(icps_inhist[ICMP_ROUTERADVERT], 16, 0);
+ DO(icps_outhist[ICMP_ROUTERSOLICIT], 16, 35);
+#undef DO
+#undef DO2
+}
+
+int
+initicmp(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_ICMP;
+ name[3] = ICMPCTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting icmpstat size failed");
+ return 0;
+ }
+ if (len > sizeof icmpstat) {
+ error("icmpstat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting icmpstat size failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+reseticmp(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_ICMP;
+ name[3] = ICMPCTL_STATS;
+
+ len = sizeof initstat;
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting icmpstat size failed");
+ }
+ oldstat = initstat;
+}
+
+void
+fetchicmp(void)
+{
+ int name[4];
+ size_t len;
+
+ oldstat = icmpstat;
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_ICMP;
+ name[3] = ICMPCTL_STATS;
+ len = sizeof icmpstat;
+
+ if (sysctl(name, 4, &icmpstat, &len, 0, 0) < 0)
+ return;
+}
diff --git a/usr.bin/systat/icmp6.c b/usr.bin/systat/icmp6.c
new file mode 100644
index 0000000..2a3bbb7
--- /dev/null
+++ b/usr.bin/systat/icmp6.c
@@ -0,0 +1,278 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/* From:
+ "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
+*/
+
+#ifdef INET6
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+#include <netinet/icmp6.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+static struct icmp6stat icmp6stat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 ICMPv6 Input ICMPv6 Output
+01999999999 total messages 999999999 total messages
+02999999999 with bad code 999999999 errors generated
+03999999999 with bad length 999999999 suppressed - original too short
+04999999999 with bad checksum 999999999 suppressed - original was ICMP
+05999999999 with insufficient data 999999999 responses sent
+06
+07 Input Histogram Output Histogram
+08999999999 echo response 999999999 echo response
+09999999999 echo request 999999999 echo request
+10999999999 destination unreachable 999999999 destination unreachable
+11999999999 redirect 999999999 redirect
+12999999999 time-to-live exceeded 999999999 time-to-line exceeded
+13999999999 parameter problem 999999999 parameter problem
+14999999999 neighbor solicitation 999999999 neighbor solicitation
+15999999999 neighbor advertisement 999999999 neighbor advertisement
+16999999999 router advertisement 999999999 router solicitation
+17
+18
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+openicmp6(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeicmp6(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labelicmp6(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 10, str)
+#define R(row, str) mvwprintw(wnd, row, 45, str);
+ L(0, "ICMPv6 Input"); R(0, "ICMPv6 Output");
+ L(1, "total messages"); R(1, "total messages");
+ L(2, "with bad code"); R(2, "errors generated");
+ L(3, "with bad length"); R(3, "suppressed - original too short");
+ L(4, "with bad checksum"); R(4, "suppressed - original was ICMP");
+ L(5, "with insufficient data"); R(5, "responses sent");
+
+ L(7, "Input Histogram"); R(7, "Output Histogram");
+#define B(row, str) L(row, str); R(row, str)
+ B(8, "echo response");
+ B(9, "echo request");
+ B(10, "destination unreachable");
+ B(11, "redirect");
+ B(12, "time-to-live exceeded");
+ B(13, "parameter problem");
+ B(14, "neighbor solicitation");
+ B(15, "neighbor advertisement");
+ L(16, "router advertisement"); R(16, "router solicitation");
+#undef L
+#undef R
+#undef B
+}
+
+static void
+domode(struct icmp6stat *ret)
+{
+ const struct icmp6stat *sub;
+ int i, divisor = 1;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = icmp6stat;
+ return;
+ }
+#define DO(stat) ret->stat = (icmp6stat.stat - sub->stat) / divisor
+ DO(icp6s_error);
+ DO(icp6s_tooshort);
+ DO(icp6s_canterror);
+ for (i = 0; i <= ICMP6_MAXTYPE; i++) {
+ DO(icp6s_outhist[i]);
+ }
+ DO(icp6s_badcode);
+ DO(icp6s_tooshort);
+ DO(icp6s_checksum);
+ DO(icp6s_badlen);
+ DO(icp6s_reflect);
+ for (i = 0; i <= ICMP6_MAXTYPE; i++) {
+ DO(icp6s_inhist[i]);
+ }
+#undef DO
+}
+
+void
+showicmp6(void)
+{
+ struct icmp6stat stats;
+ u_long totalin, totalout;
+ int i;
+
+ memset(&stats, 0, sizeof stats);
+ domode(&stats);
+ for (i = totalin = totalout = 0; i <= ICMP6_MAXTYPE; i++) {
+ totalin += stats.icp6s_inhist[i];
+ totalout += stats.icp6s_outhist[i];
+ }
+ totalin += stats.icp6s_badcode + stats.icp6s_badlen +
+ stats.icp6s_checksum + stats.icp6s_tooshort;
+ mvwprintw(wnd, 1, 0, "%9lu", totalin);
+ mvwprintw(wnd, 1, 35, "%9lu", totalout);
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%9lu", stats.stat)
+
+ DO(icp6s_badcode, 2, 0);
+ DO(icp6s_badlen, 3, 0);
+ DO(icp6s_checksum, 4, 0);
+ DO(icp6s_tooshort, 5, 0);
+ DO(icp6s_error, 2, 35);
+ DO(icp6s_tooshort, 3, 35);
+ DO(icp6s_canterror, 4, 35);
+ DO(icp6s_reflect, 5, 35);
+#define DO2(type, row) DO(icp6s_inhist[type], row, 0); DO(icp6s_outhist[type], \
+ row, 35)
+ DO2(ICMP6_ECHO_REPLY, 8);
+ DO2(ICMP6_ECHO_REQUEST, 9);
+ DO2(ICMP6_DST_UNREACH, 10);
+ DO2(ND_REDIRECT, 11);
+ DO2(ICMP6_TIME_EXCEEDED, 12);
+ DO2(ICMP6_PARAM_PROB, 13);
+ DO2(ND_NEIGHBOR_SOLICIT, 14);
+ DO2(ND_NEIGHBOR_ADVERT, 15);
+ DO(icp6s_inhist[ND_ROUTER_SOLICIT], 16, 0);
+ DO(icp6s_outhist[ND_ROUTER_ADVERT], 16, 35);
+#undef DO
+#undef DO2
+}
+
+int
+initicmp6(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_ICMPV6;
+ name[3] = ICMPV6CTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting icmp6stat size failed");
+ return 0;
+ }
+ if (len > sizeof icmp6stat) {
+ error("icmp6stat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting icmp6stat size failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+reseticmp6(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_ICMPV6;
+ name[3] = ICMPV6CTL_STATS;
+
+ len = sizeof initstat;
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting icmp6stat size failed");
+ }
+ oldstat = initstat;
+}
+
+void
+fetchicmp6(void)
+{
+ int name[4];
+ size_t len;
+
+ oldstat = icmp6stat;
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_ICMPV6;
+ name[3] = ICMPV6CTL_STATS;
+ len = sizeof icmp6stat;
+
+ if (sysctl(name, 4, &icmp6stat, &len, 0, 0) < 0)
+ return;
+}
+
+#endif
diff --git a/usr.bin/systat/ifcmds.c b/usr.bin/systat/ifcmds.c
new file mode 100644
index 0000000..101c939
--- /dev/null
+++ b/usr.bin/systat/ifcmds.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>.
+ * 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. 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 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$
+ */
+
+#include <sys/types.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "convtbl.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+int curscale = SC_AUTO;
+char *matchline = NULL;
+int showpps = 0;
+int needsort = 0;
+
+int
+ifcmd(const char *cmd, const char *args)
+{
+ int scale;
+
+ if (prefix(cmd, "scale")) {
+ if ((scale = get_scale(args)) != -1)
+ curscale = scale;
+ else {
+ move(CMDLINE, 0);
+ clrtoeol();
+ addstr("what scale? ");
+ addstr(get_helplist());
+ }
+ } else if (prefix(cmd, "match")) {
+ if (args != NULL && *args != '\0' && memcmp(args, "*", 2) != 0) {
+ /* We got a valid match line */
+ if (matchline != NULL)
+ free(matchline);
+ needsort = 1;
+ matchline = strdup(args);
+ } else {
+ /* Empty or * pattern, turn filtering off */
+ if (matchline != NULL)
+ free(matchline);
+ needsort = 1;
+ matchline = NULL;
+ }
+ } else if (prefix(cmd, "pps"))
+ showpps = !showpps;
+
+ return (1);
+}
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c
new file mode 100644
index 0000000..35e5756
--- /dev/null
+++ b/usr.bin/systat/ifstat.c
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>.
+ * 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. 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 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 INTIFSTAT_ERRUPTION)
+ * 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$
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <net/if.h>
+#include <net/if_mib.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+#include <errno.h>
+#include <fnmatch.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "convtbl.h"
+
+ /* Column numbers */
+
+#define C1 0 /* 0-19 */
+#define C2 20 /* 20-39 */
+#define C3 40 /* 40-59 */
+#define C4 60 /* 60-80 */
+#define C5 80 /* Used for label positioning. */
+
+static const int col0 = 0;
+static const int col1 = C1;
+static const int col2 = C2;
+static const int col3 = C3;
+static const int col4 = C4;
+static const int col5 = C5;
+
+SLIST_HEAD(, if_stat) curlist;
+SLIST_HEAD(, if_stat_disp) displist;
+
+struct if_stat {
+ SLIST_ENTRY(if_stat) link;
+ char if_name[IF_NAMESIZE];
+ struct ifmibdata if_mib;
+ struct timeval tv;
+ struct timeval tv_lastchanged;
+ uint64_t if_in_curtraffic;
+ uint64_t if_out_curtraffic;
+ uint64_t if_in_traffic_peak;
+ uint64_t if_out_traffic_peak;
+ uint64_t if_in_curpps;
+ uint64_t if_out_curpps;
+ uint64_t if_in_pps_peak;
+ uint64_t if_out_pps_peak;
+ u_int if_row; /* Index into ifmib sysctl */
+ int if_ypos; /* -1 if not being displayed */
+ u_int display;
+ u_int match;
+};
+
+extern int curscale;
+extern char *matchline;
+extern int showpps;
+extern int needsort;
+
+static int needclear = 0;
+
+static void right_align_string(struct if_stat *);
+static void getifmibdata(const int, struct ifmibdata *);
+static void sort_interface_list(void);
+static u_int getifnum(void);
+
+#define IFSTAT_ERR(n, s) do { \
+ putchar('\014'); \
+ closeifstat(wnd); \
+ err((n), (s)); \
+} while (0)
+
+#define TOPLINE 3
+#define TOPLABEL \
+" Interface Traffic Peak Total"
+
+#define STARTING_ROW (TOPLINE + 1)
+#define ROW_SPACING (3)
+
+#define IN_col2 (showpps ? ifp->if_in_curpps : ifp->if_in_curtraffic)
+#define OUT_col2 (showpps ? ifp->if_out_curpps : ifp->if_out_curtraffic)
+#define IN_col3 (showpps ? \
+ ifp->if_in_pps_peak : ifp->if_in_traffic_peak)
+#define OUT_col3 (showpps ? \
+ ifp->if_out_pps_peak : ifp->if_out_traffic_peak)
+#define IN_col4 (showpps ? \
+ ifp->if_mib.ifmd_data.ifi_ipackets : ifp->if_mib.ifmd_data.ifi_ibytes)
+#define OUT_col4 (showpps ? \
+ ifp->if_mib.ifmd_data.ifi_opackets : ifp->if_mib.ifmd_data.ifi_obytes)
+
+#define EMPTY_COLUMN " "
+#define CLEAR_COLUMN(y, x) mvprintw((y), (x), "%20s", EMPTY_COLUMN);
+
+#define DOPUTRATE(c, r, d) do { \
+ CLEAR_COLUMN(r, c); \
+ if (showpps) { \
+ mvprintw(r, (c), "%10.3f %cp%s ", \
+ convert(d##_##c, curscale), \
+ *get_string(d##_##c, curscale), \
+ "/s"); \
+ } \
+ else { \
+ mvprintw(r, (c), "%10.3f %s%s ", \
+ convert(d##_##c, curscale), \
+ get_string(d##_##c, curscale), \
+ "/s"); \
+ } \
+} while (0)
+
+#define DOPUTTOTAL(c, r, d) do { \
+ CLEAR_COLUMN((r), (c)); \
+ if (showpps) { \
+ mvprintw((r), (c), "%12.3f %cp ", \
+ convert(d##_##c, SC_AUTO), \
+ *get_string(d##_##c, SC_AUTO)); \
+ } \
+ else { \
+ mvprintw((r), (c), "%12.3f %s ", \
+ convert(d##_##c, SC_AUTO), \
+ get_string(d##_##c, SC_AUTO)); \
+ } \
+} while (0)
+
+#define PUTRATE(c, r) do { \
+ DOPUTRATE(c, (r), IN); \
+ DOPUTRATE(c, (r)+1, OUT); \
+} while (0)
+
+#define PUTTOTAL(c, r) do { \
+ DOPUTTOTAL(c, (r), IN); \
+ DOPUTTOTAL(c, (r)+1, OUT); \
+} while (0)
+
+#define PUTNAME(p) do { \
+ mvprintw(p->if_ypos, 0, "%s", p->if_name); \
+ mvprintw(p->if_ypos, col2-3, "%s", (const char *)"in"); \
+ mvprintw(p->if_ypos+1, col2-3, "%s", (const char *)"out"); \
+} while (0)
+
+WINDOW *
+openifstat(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeifstat(WINDOW *w)
+{
+ struct if_stat *node = NULL;
+
+ while (!SLIST_EMPTY(&curlist)) {
+ node = SLIST_FIRST(&curlist);
+ SLIST_REMOVE_HEAD(&curlist, link);
+ free(node);
+ }
+
+ if (w != NULL) {
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+ }
+
+ return;
+}
+
+void
+labelifstat(void)
+{
+
+ wmove(wnd, TOPLINE, 0);
+ wclrtoeol(wnd);
+ mvprintw(TOPLINE, 0, "%s", TOPLABEL);
+
+ return;
+}
+
+void
+showifstat(void)
+{
+ struct if_stat *ifp = NULL;
+
+ SLIST_FOREACH(ifp, &curlist, link) {
+ 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;
+}
+
+int
+initifstat(void)
+{
+ struct if_stat *p = NULL;
+ u_int n = 0, i = 0;
+
+ n = getifnum();
+ if (n <= 0)
+ return (-1);
+
+ SLIST_INIT(&curlist);
+
+ for (i = 0; i < n; i++) {
+ p = (struct if_stat *)calloc(1, sizeof(struct if_stat));
+ if (p == NULL)
+ IFSTAT_ERR(1, "out of memory");
+ SLIST_INSERT_HEAD(&curlist, p, link);
+ p->if_row = i+1;
+ getifmibdata(p->if_row, &p->if_mib);
+ right_align_string(p);
+ p->match = 1;
+
+ /*
+ * Initially, we only display interfaces that have
+ * received some traffic.
+ */
+ if (p->if_mib.ifmd_data.ifi_ibytes != 0)
+ p->display = 1;
+ }
+
+ sort_interface_list();
+
+ return (1);
+}
+
+void
+fetchifstat(void)
+{
+ struct if_stat *ifp = NULL;
+ struct timeval tv, new_tv, old_tv;
+ double elapsed = 0.0;
+ uint64_t new_inb, new_outb, old_inb, old_outb = 0;
+ uint64_t new_inp, new_outp, old_inp, old_outp = 0;
+
+ SLIST_FOREACH(ifp, &curlist, link) {
+ /*
+ * Grab a copy of the old input/output values before we
+ * call getifmibdata().
+ */
+ old_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
+ old_outb = ifp->if_mib.ifmd_data.ifi_obytes;
+ old_inp = ifp->if_mib.ifmd_data.ifi_ipackets;
+ old_outp = ifp->if_mib.ifmd_data.ifi_opackets;
+ ifp->tv_lastchanged = ifp->if_mib.ifmd_data.ifi_lastchange;
+
+ (void)gettimeofday(&new_tv, NULL);
+ (void)getifmibdata(ifp->if_row, &ifp->if_mib);
+
+ new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
+ new_outb = ifp->if_mib.ifmd_data.ifi_obytes;
+ new_inp = ifp->if_mib.ifmd_data.ifi_ipackets;
+ new_outp = ifp->if_mib.ifmd_data.ifi_opackets;
+
+ /* Display interface if it's received some traffic. */
+ if (new_inb > 0 && old_inb == 0) {
+ ifp->display = 1;
+ needsort = 1;
+ }
+
+ /*
+ * The rest is pretty trivial. Calculate the new values
+ * for our current traffic rates, and while we're there,
+ * see if we have new peak rates.
+ */
+ old_tv = ifp->tv;
+ timersub(&new_tv, &old_tv, &tv);
+ elapsed = tv.tv_sec + (tv.tv_usec * 1e-6);
+
+ ifp->if_in_curtraffic = new_inb - old_inb;
+ ifp->if_out_curtraffic = new_outb - old_outb;
+
+ ifp->if_in_curpps = new_inp - old_inp;
+ ifp->if_out_curpps = new_outp - old_outp;
+
+ /*
+ * Rather than divide by the time specified on the comm-
+ * and line, we divide by ``elapsed'' as this is likely
+ * to be more accurate.
+ */
+ ifp->if_in_curtraffic /= elapsed;
+ ifp->if_out_curtraffic /= elapsed;
+ ifp->if_in_curpps /= elapsed;
+ ifp->if_out_curpps /= elapsed;
+
+ if (ifp->if_in_curtraffic > ifp->if_in_traffic_peak)
+ ifp->if_in_traffic_peak = ifp->if_in_curtraffic;
+
+ if (ifp->if_out_curtraffic > ifp->if_out_traffic_peak)
+ ifp->if_out_traffic_peak = ifp->if_out_curtraffic;
+
+ if (ifp->if_in_curpps > ifp->if_in_pps_peak)
+ ifp->if_in_pps_peak = ifp->if_in_curpps;
+
+ if (ifp->if_out_curpps > ifp->if_out_pps_peak)
+ ifp->if_out_pps_peak = ifp->if_out_curpps;
+
+ ifp->tv.tv_sec = new_tv.tv_sec;
+ ifp->tv.tv_usec = new_tv.tv_usec;
+
+ }
+
+ if (needsort)
+ sort_interface_list();
+
+ return;
+}
+
+/*
+ * We want to right justify our interface names against the first column
+ * (first sixteen or so characters), so we need to do some alignment.
+ */
+static void
+right_align_string(struct if_stat *ifp)
+{
+ int str_len = 0, pad_len = 0;
+ char *newstr = NULL, *ptr = NULL;
+
+ if (ifp == NULL || ifp->if_mib.ifmd_name == NULL)
+ return;
+ else {
+ /* string length + '\0' */
+ str_len = strlen(ifp->if_mib.ifmd_name)+1;
+ pad_len = IF_NAMESIZE-(str_len);
+
+ newstr = ifp->if_name;
+ ptr = newstr + pad_len;
+ (void)memset((void *)newstr, (int)' ', IF_NAMESIZE);
+ (void)strncpy(ptr, (const char *)&ifp->if_mib.ifmd_name,
+ str_len);
+ }
+
+ return;
+}
+
+static int
+check_match(const char *ifname)
+{
+ char *p = matchline, *c, t;
+ int match = 0, mlen;
+
+ if (matchline == NULL)
+ return (0);
+
+ /* Strip leading whitespaces */
+ while (*p == ' ')
+ p ++;
+
+ c = p;
+ while ((mlen = strcspn(c, " ;,")) != 0) {
+ p = c + mlen;
+ t = *p;
+ if (p - c > 0) {
+ *p = '\0';
+ if (fnmatch(c, ifname, FNM_CASEFOLD) == 0) {
+ *p = t;
+ return (1);
+ }
+ *p = t;
+ c = p + strspn(p, " ;,");
+ }
+ else {
+ c = p + strspn(p, " ;,");
+ }
+ }
+
+ return (match);
+}
+
+/*
+ * This function iterates through our list of interfaces, identifying
+ * those that are to be displayed (ifp->display = 1). For each interf-
+ * rface that we're displaying, we generate an appropriate position for
+ * it on the screen (ifp->if_ypos).
+ *
+ * This function is called any time a change is made to an interface's
+ * ``display'' state.
+ */
+void
+sort_interface_list(void)
+{
+ struct if_stat *ifp = NULL;
+ u_int y = 0;
+
+ y = STARTING_ROW;
+ SLIST_FOREACH(ifp, &curlist, link) {
+ if (matchline && !check_match(ifp->if_mib.ifmd_name))
+ ifp->match = 0;
+ else
+ ifp->match = 1;
+ if (ifp->display && ifp->match) {
+ ifp->if_ypos = y;
+ y += ROW_SPACING;
+ }
+ else
+ ifp->if_ypos = -1;
+ }
+
+ needsort = 0;
+ needclear = 1;
+}
+
+static
+unsigned int
+getifnum(void)
+{
+ u_int data = 0;
+ size_t datalen = 0;
+ static int name[] = { CTL_NET,
+ PF_LINK,
+ NETLINK_GENERIC,
+ IFMIB_SYSTEM,
+ IFMIB_IFCOUNT };
+
+ datalen = sizeof(data);
+ if (sysctl(name, 5, (void *)&data, (size_t *)&datalen, (void *)NULL,
+ (size_t)0) != 0)
+ IFSTAT_ERR(1, "sysctl error");
+ return (data);
+}
+
+static void
+getifmibdata(int row, struct ifmibdata *data)
+{
+ size_t datalen = 0;
+ static int name[] = { CTL_NET,
+ PF_LINK,
+ NETLINK_GENERIC,
+ IFMIB_IFDATA,
+ 0,
+ IFDATA_GENERAL };
+ datalen = sizeof(*data);
+ name[4] = row;
+
+ if ((sysctl(name, 6, (void *)data, (size_t *)&datalen, (void *)NULL,
+ (size_t)0) != 0) && (errno != ENOENT))
+ IFSTAT_ERR(2, "sysctl error getting interface data");
+}
+
+int
+cmdifstat(const char *cmd, const char *args)
+{
+ int retval = 0;
+
+ retval = ifcmd(cmd, args);
+ /* ifcmd() returns 1 on success */
+ if (retval == 1) {
+ if (needclear) {
+ showifstat();
+ refresh();
+ werase(wnd);
+ labelifstat();
+ needclear = 0;
+ }
+ }
+ return (retval);
+}
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
new file mode 100644
index 0000000..fa275eb
--- /dev/null
+++ b/usr.bin/systat/iostat.c
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 1998 Kenneth D. Merry.
+ * 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. 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 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.
+ */
+/*
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/resource.h>
+
+#include <devstat.h>
+#include <err.h>
+#include <nlist.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "devs.h"
+
+struct statinfo cur, last;
+
+static int linesperregion;
+static double etime;
+static int numbers = 0; /* default display bar graphs */
+static int kbpt = 0; /* default ms/seek shown */
+
+static int barlabels(int);
+static void histogram(long double, int, double);
+static int numlabels(int);
+static int devstats(int, int, int);
+static void stat1(int, int);
+
+WINDOW *
+openiostat(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeiostat(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+int
+initiostat(void)
+{
+ if ((num_devices = devstat_getnumdevs(NULL)) < 0)
+ return(0);
+
+ cur.dinfo = calloc(1, sizeof(struct devinfo));
+ last.dinfo = calloc(1, sizeof(struct devinfo));
+
+ /*
+ * This value for maxshowdevs (100) is bogus. I'm not sure exactly
+ * how to calculate it, though.
+ */
+ if (dsinit(100, &cur, &last, NULL) != 1)
+ return(0);
+
+ return(1);
+}
+
+void
+fetchiostat(void)
+{
+ struct devinfo *tmp_dinfo;
+ size_t len;
+
+ len = sizeof(cur.cp_time);
+ if (sysctlbyname("kern.cp_time", &cur.cp_time, &len, NULL, 0)
+ || len != sizeof(cur.cp_time)) {
+ perror("kern.cp_time");
+ exit (1);
+ }
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+
+ last.snap_time = cur.snap_time;
+
+ /*
+ * Here what we want to do is refresh our device stats.
+ * getdevs() returns 1 when the device list has changed.
+ * If the device list has changed, we want to go through
+ * the selection process again, in case a device that we
+ * were previously displaying has gone away.
+ */
+ switch (devstat_getdevs(NULL, &cur)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ cmdiostat("refresh", NULL);
+ break;
+ default:
+ break;
+ }
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+
+}
+
+#define INSET 10
+
+void
+labeliostat(void)
+{
+ int row;
+
+ row = 0;
+ wmove(wnd, row, 0); wclrtobot(wnd);
+ mvwaddstr(wnd, row++, INSET,
+ "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
+ mvwaddstr(wnd, row++, 0, "cpu user|");
+ mvwaddstr(wnd, row++, 0, " nice|");
+ mvwaddstr(wnd, row++, 0, " system|");
+ mvwaddstr(wnd, row++, 0, "interrupt|");
+ mvwaddstr(wnd, row++, 0, " idle|");
+ if (numbers)
+ row = numlabels(row + 1);
+ else
+ row = barlabels(row + 1);
+}
+
+static int
+numlabels(int row)
+{
+ int i, _col, regions, ndrives;
+ char tmpstr[10];
+
+#define COLWIDTH 17
+#define DRIVESPERLINE ((getmaxx(wnd) - 1 - INSET) / COLWIDTH)
+ for (ndrives = 0, i = 0; i < num_devices; i++)
+ if (dev_select[i].selected)
+ ndrives++;
+ regions = howmany(ndrives, DRIVESPERLINE);
+ /*
+ * Deduct -regions for blank line after each scrolling region.
+ */
+ linesperregion = (getmaxy(wnd) - 1 - row - regions) / regions;
+ /*
+ * Minimum region contains space for two
+ * label lines and one line of statistics.
+ */
+ if (linesperregion < 3)
+ linesperregion = 3;
+ _col = INSET;
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
+ if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) {
+ _col = INSET, row += linesperregion + 1;
+ if (row > getmaxy(wnd) - 1 - (linesperregion + 1))
+ break;
+ }
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvwaddstr(wnd, row, _col + 4, tmpstr);
+ mvwaddstr(wnd, row + 1, _col, " KB/t tps MB/s ");
+ _col += COLWIDTH;
+ }
+ if (_col)
+ row += linesperregion + 1;
+ return (row);
+}
+
+static int
+barlabels(int row)
+{
+ int i;
+ char tmpstr[10];
+
+ mvwaddstr(wnd, row++, INSET,
+ "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
+ linesperregion = 2 + kbpt;
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
+ if (row > getmaxy(wnd) - 1 - linesperregion)
+ break;
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvwprintw(wnd, row++, 0, "%-5.5s MB/s|",
+ tmpstr);
+ mvwaddstr(wnd, row++, 0, " tps|");
+ if (kbpt)
+ mvwaddstr(wnd, row++, 0, " KB/t|");
+ }
+ return (row);
+}
+
+void
+showiostat(void)
+{
+ long t;
+ int i, row, _col;
+
+#define X(fld) t = cur.fld[i]; cur.fld[i] -= last.fld[i]; last.fld[i] = t
+ etime = 0;
+ for(i = 0; i < CPUSTATES; i++) {
+ X(cp_time);
+ etime += cur.cp_time[i];
+ }
+ if (etime == 0.0)
+ etime = 1.0;
+ etime /= hertz;
+ row = 1;
+ for (i = 0; i < CPUSTATES; i++)
+ stat1(row++, i);
+ if (!numbers) {
+ row += 2;
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
+ if (row > getmaxy(wnd) - linesperregion)
+ break;
+ row = devstats(row, INSET, i);
+ }
+ return;
+ }
+ _col = INSET;
+ wmove(wnd, row + linesperregion, 0);
+ wdeleteln(wnd);
+ wmove(wnd, row + 3, 0);
+ winsertln(wnd);
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
+ if (_col + COLWIDTH >= getmaxx(wnd) - 1 - INSET) {
+ _col = INSET, row += linesperregion + 1;
+ if (row > getmaxy(wnd) - 1 - (linesperregion + 1))
+ break;
+ wmove(wnd, row + linesperregion, 0);
+ wdeleteln(wnd);
+ wmove(wnd, row + 3, 0);
+ winsertln(wnd);
+ }
+ (void) devstats(row + 3, _col, i);
+ _col += COLWIDTH;
+ }
+}
+
+static int
+devstats(int row, int _col, int dn)
+{
+ long double transfers_per_second;
+ long double kb_per_transfer, mb_per_second;
+ long double busy_seconds;
+ int di;
+
+ di = dev_select[dn].position;
+
+ busy_seconds = cur.snap_time - last.snap_time;
+
+ if (devstat_compute_statistics(&cur.dinfo->devices[di],
+ &last.dinfo->devices[di], busy_seconds,
+ DSM_KB_PER_TRANSFER, &kb_per_transfer,
+ DSM_TRANSFERS_PER_SECOND, &transfers_per_second,
+ DSM_MB_PER_SECOND, &mb_per_second, DSM_NONE) != 0)
+ errx(1, "%s", devstat_errbuf);
+
+ if (numbers) {
+ mvwprintw(wnd, row, _col, " %5.2Lf %3.0Lf %5.2Lf ",
+ kb_per_transfer, transfers_per_second,
+ mb_per_second);
+ return(row);
+ }
+ wmove(wnd, row++, _col);
+ histogram(mb_per_second, 50, .5);
+ wmove(wnd, row++, _col);
+ histogram(transfers_per_second, 50, .5);
+ if (kbpt) {
+ wmove(wnd, row++, _col);
+ histogram(kb_per_transfer, 50, .5);
+ }
+
+ return(row);
+
+}
+
+static void
+stat1(int row, int o)
+{
+ int i;
+ double dtime;
+
+ dtime = 0.0;
+ for (i = 0; i < CPUSTATES; i++)
+ dtime += cur.cp_time[i];
+ if (dtime == 0.0)
+ dtime = 1.0;
+ wmove(wnd, row, INSET);
+#define CPUSCALE 0.5
+ histogram(100.0 * cur.cp_time[o] / dtime, 50, CPUSCALE);
+}
+
+static void
+histogram(long double val, int colwidth, double scale)
+{
+ char buf[10];
+ int k;
+ int v = (int)(val * scale) + 0.5;
+
+ k = MIN(v, colwidth);
+ if (v > colwidth) {
+ snprintf(buf, sizeof(buf), "%5.2Lf", val);
+ k -= strlen(buf);
+ while (k--)
+ waddch(wnd, 'X');
+ waddstr(wnd, buf);
+ return;
+ }
+ while (k--)
+ waddch(wnd, 'X');
+ wclrtoeol(wnd);
+}
+
+int
+cmdiostat(const char *cmd, const char *args)
+{
+
+ if (prefix(cmd, "kbpt"))
+ kbpt = !kbpt;
+ else if (prefix(cmd, "numbers"))
+ numbers = 1;
+ else if (prefix(cmd, "bars"))
+ numbers = 0;
+ else if (!dscmd(cmd, args, 100, &cur))
+ return (0);
+ wclear(wnd);
+ labeliostat();
+ refresh();
+ return (1);
+}
diff --git a/usr.bin/systat/ip.c b/usr.bin/systat/ip.c
new file mode 100644
index 0000000..8e12a6a
--- /dev/null
+++ b/usr.bin/systat/ip.c
@@ -0,0 +1,339 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/* From:
+ "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
+*/
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+struct stat {
+ struct ipstat i;
+ struct udpstat u;
+};
+
+static struct stat curstat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 IP Input IP Output
+01999999999 total packets received 999999999 total packets sent
+02999999999 - with bad checksums 999999999 - generated locally
+03999999999 - too short for header 999999999 - output drops
+04999999999 - too short for data 999999999 output fragments generated
+05999999999 - with invalid hlen 999999999 - fragmentation failed
+06999999999 - with invalid length 999999999 destinations unreachable
+07999999999 - with invalid version 999999999 packets output via raw IP
+08999999999 - jumbograms
+09999999999 total fragments received UDP Statistics
+10999999999 - fragments dropped 999999999 total input packets
+11999999999 - fragments timed out 999999999 - too short for header
+12999999999 - packets reassembled ok 999999999 - invalid checksum
+13999999999 packets forwarded 999999999 - no checksum
+14999999999 - unreachable dests 999999999 - invalid length
+15999999999 - redirects generated 999999999 - no socket for dest port
+16999999999 option errors 999999999 - no socket for broadcast
+17999999999 unwanted multicasts 999999999 - socket buffer full
+18999999999 delivered to upper layer 999999999 total output packets
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+openip(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeip(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labelip(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 10, str)
+#define R(row, str) mvwprintw(wnd, row, 45, str);
+ L(0, "IP Input"); R(0, "IP Output");
+ L(1, "total packets received"); R(1, "total packets sent");
+ L(2, "- with bad checksums"); R(2, "- generated locally");
+ L(3, "- too short for header"); R(3, "- output drops");
+ L(4, "- too short for data"); R(4, "output fragments generated");
+ L(5, "- with invalid hlen"); R(5, "- fragmentation failed");
+ L(6, "- with invalid length"); R(6, "destinations unreachable");
+ L(7, "- with invalid version"); R(7, "packets output via raw IP");
+ L(8, "- jumbograms");
+ L(9, "total fragments received"); R(9, "UDP Statistics");
+ L(10, "- fragments dropped"); R(10, "total input packets");
+ L(11, "- fragments timed out"); R(11, "- too short for header");
+ L(12, "- packets reassembled ok"); R(12, "- invalid checksum");
+ L(13, "packets forwarded"); R(13, "- no checksum");
+ L(14, "- unreachable dests"); R(14, "- invalid length");
+ L(15, "- redirects generated"); R(15, "- no socket for dest port");
+ L(16, "option errors"); R(16, "- no socket for broadcast");
+ L(17, "unwanted multicasts"); R(17, "- socket buffer full");
+ L(18, "delivered to upper layer"); R(18, "total output packets");
+#undef L
+#undef R
+}
+
+static void
+domode(struct stat *ret)
+{
+ const struct stat *sub;
+ int divisor = 1;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = curstat;
+ return;
+ }
+#define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
+ DO(i.ips_total);
+ DO(i.ips_badsum);
+ DO(i.ips_tooshort);
+ DO(i.ips_toosmall);
+ DO(i.ips_badhlen);
+ DO(i.ips_badlen);
+ DO(i.ips_fragments);
+ DO(i.ips_fragdropped);
+ DO(i.ips_fragtimeout);
+ DO(i.ips_forward);
+ DO(i.ips_cantforward);
+ DO(i.ips_redirectsent);
+ DO(i.ips_noproto);
+ DO(i.ips_delivered);
+ DO(i.ips_localout);
+ DO(i.ips_odropped);
+ DO(i.ips_reassembled);
+ DO(i.ips_fragmented);
+ DO(i.ips_ofragments);
+ DO(i.ips_cantfrag);
+ DO(i.ips_badoptions);
+ DO(i.ips_noroute);
+ DO(i.ips_badvers);
+ DO(i.ips_rawout);
+ DO(i.ips_toolong);
+ DO(i.ips_notmember);
+ DO(u.udps_ipackets);
+ DO(u.udps_hdrops);
+ DO(u.udps_badsum);
+ DO(u.udps_nosum);
+ DO(u.udps_badlen);
+ DO(u.udps_noport);
+ DO(u.udps_noportbcast);
+ DO(u.udps_fullsock);
+ DO(u.udps_opackets);
+#undef DO
+}
+
+void
+showip(void)
+{
+ struct stat stats;
+ u_long totalout;
+
+ domode(&stats);
+ totalout = stats.i.ips_forward + stats.i.ips_localout;
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%9lu", stats.stat)
+
+ DO(i.ips_total, 1, 0);
+ mvwprintw(wnd, 1, 35, "%9lu", totalout);
+ DO(i.ips_badsum, 2, 0);
+ DO(i.ips_localout, 2, 35);
+ DO(i.ips_tooshort, 3, 0);
+ DO(i.ips_odropped, 3, 35);
+ DO(i.ips_toosmall, 4, 0);
+ DO(i.ips_ofragments, 4, 35);
+ DO(i.ips_badhlen, 5, 0);
+ DO(i.ips_cantfrag, 5, 35);
+ DO(i.ips_badlen, 6, 0);
+ DO(i.ips_noroute, 6, 35);
+ DO(i.ips_badvers, 7, 0);
+ DO(i.ips_rawout, 7, 35);
+ DO(i.ips_toolong, 8, 0);
+ DO(i.ips_fragments, 9, 0);
+ DO(i.ips_fragdropped, 10, 0);
+ DO(u.udps_ipackets, 10, 35);
+ DO(i.ips_fragtimeout, 11, 0);
+ DO(u.udps_hdrops, 11, 35);
+ DO(i.ips_reassembled, 12, 0);
+ DO(u.udps_badsum, 12, 35);
+ DO(i.ips_forward, 13, 0);
+ DO(u.udps_nosum, 13, 35);
+ DO(i.ips_cantforward, 14, 0);
+ DO(u.udps_badlen, 14, 35);
+ DO(i.ips_redirectsent, 15, 0);
+ DO(u.udps_noport, 15, 35);
+ DO(i.ips_badoptions, 16, 0);
+ DO(u.udps_noportbcast, 16, 35);
+ DO(i.ips_notmember, 17, 0);
+ DO(u.udps_fullsock, 17, 35);
+ DO(i.ips_delivered, 18, 0);
+ DO(u.udps_opackets, 18, 35);
+#undef DO
+}
+
+int
+initip(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_IP;
+ name[3] = IPCTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting ipstat size failed");
+ return 0;
+ }
+ if (len > sizeof curstat.i) {
+ error("ipstat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat.i, &len, 0, 0) < 0) {
+ error("sysctl getting ipstat failed");
+ return 0;
+ }
+ name[2] = IPPROTO_UDP;
+ name[3] = UDPCTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting udpstat size failed");
+ return 0;
+ }
+ if (len > sizeof curstat.u) {
+ error("ipstat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat.u, &len, 0, 0) < 0) {
+ error("sysctl getting udpstat failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+resetip(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_IP;
+ name[3] = IPCTL_STATS;
+
+ len = sizeof initstat.i;
+ if (sysctl(name, 4, &initstat.i, &len, 0, 0) < 0) {
+ error("sysctl getting ipstat failed");
+ }
+ name[2] = IPPROTO_UDP;
+ name[3] = UDPCTL_STATS;
+
+ len = sizeof initstat.u;
+ if (sysctl(name, 4, &initstat.u, &len, 0, 0) < 0) {
+ error("sysctl getting udpstat failed");
+ }
+ oldstat = initstat;
+}
+
+void
+fetchip(void)
+{
+ int name[4];
+ size_t len;
+
+ oldstat = curstat;
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_IP;
+ name[3] = IPCTL_STATS;
+ len = sizeof curstat.i;
+
+ if (sysctl(name, 4, &curstat.i, &len, 0, 0) < 0)
+ return;
+ name[2] = IPPROTO_UDP;
+ name[3] = UDPCTL_STATS;
+ len = sizeof curstat.u;
+
+ if (sysctl(name, 4, &curstat.u, &len, 0, 0) < 0)
+ return;
+}
diff --git a/usr.bin/systat/ip6.c b/usr.bin/systat/ip6.c
new file mode 100644
index 0000000..5d2c210
--- /dev/null
+++ b/usr.bin/systat/ip6.c
@@ -0,0 +1,300 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/* From:
+ "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
+*/
+
+#ifdef INET6
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet6/ip6_var.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+static struct ip6stat curstat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 IPv6 Input IPv6 Output
+019999999 total packets received 999999999 total packets sent
+029999999 - too short for header 999999999 - generated locally
+039999999 - too short for data 999999999 - output drops
+049999999 - with invalid version 999999999 output fragments generated
+059999999 total fragments received 999999999 - fragmentation failed
+069999999 - fragments dropped 999999999 destinations unreachable
+079999999 - fragments timed out 999999999 packets output via raw IP
+089999999 - fragments overflown
+099999999 - packets reassembled ok Input next-header histogram
+109999999 packets forwarded 999999999 - destination options
+119999999 - unreachable dests 999999999 - hop-by-hop options
+129999999 - redirects generated 999999999 - IPv4
+139999999 option errors 999999999 - TCP
+149999999 unwanted multicasts 999999999 - UDP
+159999999 delivered to upper layer 999999999 - IPv6
+169999999 bad scope packets 999999999 - routing header
+179999999 address selection failed 999999999 - fragmentation header
+18 999999999 - ICMP6
+19 999999999 - none
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+openip6(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeip6(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labelip6(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 10, str)
+#define R(row, str) mvwprintw(wnd, row, 45, str);
+ L(0, "IPv6 Input"); R(0, "IPv6 Output");
+ L(1, "total packets received"); R(1, "total packets sent");
+ L(2, "- too short for header"); R(2, "- generated locally");
+ L(3, "- too short for data"); R(3, "- output drops");
+ L(4, "- with invalid version"); R(4, "output fragments generated");
+ L(5, "total fragments received"); R(5, "- fragmentation failed");
+ L(6, "- fragments dropped"); R(6, "destinations unreachable");
+ L(7, "- fragments timed out"); R(7, "packets output via raw IP");
+ L(8, "- fragments overflown");
+ L(9, "- packets reassembled ok"); R(9, "Input next-header histogram");
+ L(10, "packets forwarded"); R(10, " - destination options");
+ L(11, "- unreachable dests"); R(11, " - hop-by-hop options");
+ L(12, "- redirects generated"); R(12, " - IPv4");
+ L(13, "option errors"); R(13, " - TCP");
+ L(14, "unwanted multicasts"); R(14, " - UDP");
+ L(15, "delivered to upper layer"); R(15, " - IPv6");
+ L(16, "bad scope packets"); R(16, " - routing header");
+ L(17, "address selection failed"); R(17, " - fragmentation header");
+ R(18, " - ICMP6");
+ R(19, " - none");
+#undef L
+#undef R
+}
+
+static void
+domode(struct ip6stat *ret)
+{
+ const struct ip6stat *sub;
+ int divisor = 1, i;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = curstat;
+ return;
+ }
+#define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
+ DO(ip6s_total);
+ DO(ip6s_tooshort);
+ DO(ip6s_toosmall);
+ DO(ip6s_fragments);
+ DO(ip6s_fragdropped);
+ DO(ip6s_fragtimeout);
+ DO(ip6s_fragoverflow);
+ DO(ip6s_forward);
+ DO(ip6s_cantforward);
+ DO(ip6s_redirectsent);
+ DO(ip6s_delivered);
+ DO(ip6s_localout);
+ DO(ip6s_odropped);
+ DO(ip6s_reassembled);
+ DO(ip6s_fragmented);
+ DO(ip6s_ofragments);
+ DO(ip6s_cantfrag);
+ DO(ip6s_badoptions);
+ DO(ip6s_noroute);
+ DO(ip6s_badvers);
+ DO(ip6s_rawout);
+ DO(ip6s_notmember);
+ for (i = 0; i < 256; i++)
+ DO(ip6s_nxthist[i]);
+ DO(ip6s_badscope);
+ DO(ip6s_sources_none);
+#undef DO
+}
+
+void
+showip6(void)
+{
+ struct ip6stat stats;
+ u_long totalout;
+
+ domode(&stats);
+ totalout = stats.ip6s_forward + stats.ip6s_localout;
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%9lu", stats.stat)
+
+ DO(ip6s_total, 1, 0);
+ mvwprintw(wnd, 1, 35, "%9lu", totalout);
+ DO(ip6s_tooshort, 2, 0);
+ DO(ip6s_localout, 2, 35);
+ DO(ip6s_toosmall, 3, 0);
+ DO(ip6s_odropped, 3, 35);
+ DO(ip6s_badvers, 4, 0);
+ DO(ip6s_ofragments, 4, 35);
+ DO(ip6s_fragments, 5, 0);
+ DO(ip6s_cantfrag, 5, 35);
+ DO(ip6s_fragdropped, 6, 0);
+ DO(ip6s_noroute, 6, 35);
+ DO(ip6s_fragtimeout, 7, 0);
+ DO(ip6s_rawout, 7, 35);
+ DO(ip6s_fragoverflow, 8, 0);
+ DO(ip6s_reassembled, 9, 0);
+ DO(ip6s_forward, 10, 0);
+ DO(ip6s_nxthist[IPPROTO_DSTOPTS], 10, 35);
+ DO(ip6s_cantforward, 11, 0);
+ DO(ip6s_nxthist[IPPROTO_HOPOPTS], 11, 35);
+ DO(ip6s_redirectsent, 12, 0);
+ DO(ip6s_nxthist[IPPROTO_IPV4], 12, 35);
+ DO(ip6s_badoptions, 13, 0);
+ DO(ip6s_nxthist[IPPROTO_TCP], 13, 35);
+ DO(ip6s_notmember, 14, 0);
+ DO(ip6s_nxthist[IPPROTO_UDP], 14, 35);
+ DO(ip6s_delivered, 15, 0);
+ DO(ip6s_nxthist[IPPROTO_IPV6], 15, 35);
+ DO(ip6s_badscope, 16, 0);
+ DO(ip6s_nxthist[IPPROTO_ROUTING], 16, 35);
+ DO(ip6s_sources_none, 17, 0);
+ DO(ip6s_nxthist[IPPROTO_FRAGMENT], 17, 35);
+ DO(ip6s_nxthist[IPPROTO_ICMPV6], 18, 35);
+ DO(ip6s_nxthist[IPPROTO_NONE], 19, 35);
+#undef DO
+}
+
+int
+initip6(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_IPV6;
+ name[3] = IPV6CTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting ip6stat size failed");
+ return 0;
+ }
+ if (len > sizeof curstat) {
+ error("ip6stat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting ip6stat failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+resetip6(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_IPV6;
+ name[3] = IPV6CTL_STATS;
+
+ len = sizeof initstat;
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting ipstat failed");
+ }
+
+ oldstat = initstat;
+}
+
+void
+fetchip6(void)
+{
+ int name[4];
+ size_t len;
+
+ oldstat = curstat;
+ name[0] = CTL_NET;
+ name[1] = PF_INET6;
+ name[2] = IPPROTO_IPV6;
+ name[3] = IPV6CTL_STATS;
+ len = sizeof curstat;
+
+ if (sysctl(name, 4, &curstat, &len, 0, 0) < 0)
+ return;
+}
+
+#endif
diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c
new file mode 100644
index 0000000..d6d793a
--- /dev/null
+++ b/usr.bin/systat/keyboard.c
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/select.h>
+#include <sys/time.h>
+
+#include <errno.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "systat.h"
+#include "extern.h"
+
+static char line[80];
+static int keyboard_dispatch(int ch);
+
+int
+keyboard(void)
+{
+ int ch, n;
+ struct timeval last, intvl, now, tm;
+ fd_set rfds;
+
+ /* Set initial timings */
+ gettimeofday(&last, NULL);
+ intvl.tv_sec = delay / 1000000;
+ intvl.tv_usec = delay % 1000000;
+ for (;;) {
+ col = 0;
+ move(CMDLINE, 0);
+ for (;;) {
+ /* Determine interval to sleep */
+ (void)gettimeofday(&now, NULL);
+ tm.tv_sec = last.tv_sec + intvl.tv_sec - now.tv_sec;
+ tm.tv_usec = last.tv_usec + intvl.tv_usec - now.tv_usec;
+ while (tm.tv_usec < 0) {
+ tm.tv_usec += 1000000;
+ tm.tv_sec--;
+ }
+ while (tm.tv_usec >= 1000000) {
+ tm.tv_usec -= 1000000;
+ tm.tv_sec++;
+ }
+ if (tm.tv_sec < 0) {
+ /* We have to update screen immediately */
+ display();
+ gettimeofday(&last, NULL);
+ continue;
+ }
+
+ /* Prepare select */
+ FD_ZERO(&rfds);
+ FD_SET(STDIN_FILENO, &rfds);
+ n = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tm);
+
+ if (n > 0) {
+ /* Read event on stdin */
+ ch = getch();
+
+ if (keyboard_dispatch(ch) == 0) {
+ refresh();
+ continue;
+ }
+
+ line[col] = '\0';
+ command(line + 1);
+ /* Refresh delay */
+ intvl.tv_sec = delay / 1000000;
+ intvl.tv_usec = delay % 1000000;
+ refresh();
+ break;
+ }
+
+ if (n < 0 && errno != EINTR)
+ exit(1);
+
+ /* Timeout or signal. Call display another time */
+ display();
+ gettimeofday(&last, NULL);
+ }
+ }
+}
+
+static int
+keyboard_dispatch(int ch)
+{
+
+ if (ch == ERR) {
+ if (errno == EINTR)
+ return 0;
+ exit(1);
+ }
+ if (ch >= 'A' && ch <= 'Z')
+ ch += 'a' - 'A';
+ if (col == 0) {
+ if (ch == CTRL('l')) {
+ wrefresh(curscr);
+ return 0;
+ }
+ if (ch == CTRL('g')) {
+ status();
+ return 0;
+ }
+ if (ch != ':')
+ return 0;
+ move(CMDLINE, 0);
+ clrtoeol();
+ }
+ if (ch == erasechar() && col > 0) {
+ if (col == 1 && line[0] == ':')
+ return 0;
+ col--;
+ goto doerase;
+ }
+ if (ch == CTRL('w') && col > 0) {
+ while (--col >= 0 && isspace(line[col]))
+ ;
+ col++;
+ while (--col >= 0 && !isspace(line[col]))
+ if (col == 0 && line[0] == ':')
+ return 1;
+ col++;
+ goto doerase;
+ }
+ if (ch == killchar() && col > 0) {
+ col = 0;
+ if (line[0] == ':')
+ col++;
+doerase:
+ move(CMDLINE, col);
+ clrtoeol();
+ return 0;
+ }
+ if (isprint(ch) || ch == ' ') {
+ line[col] = ch;
+ mvaddch(CMDLINE, col, ch);
+ col++;
+ }
+
+ if (col == 0 || (ch != '\r' && ch != '\n'))
+ return 0;
+
+ return 1;
+}
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
new file mode 100644
index 0000000..4c55ff4
--- /dev/null
+++ b/usr.bin/systat/main.c
@@ -0,0 +1,380 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/sysctl.h>
+#include <sys/queue.h>
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <nlist.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "systat.h"
+#include "extern.h"
+
+static int dellave;
+
+kvm_t *kd;
+sig_t sigtstpdfl;
+double avenrun[3];
+int col;
+unsigned int delay = 5000000; /* in microseconds */
+int verbose = 1; /* to report kvm read errs */
+struct clockinfo clkinfo;
+double hertz;
+char c;
+char *namp;
+char hostname[MAXHOSTNAMELEN];
+WINDOW *wnd;
+int CMDLINE;
+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;
+ struct cmdentry *cmd = NULL;
+
+ (void) setlocale(LC_ALL, "");
+
+ SLIST_INIT(&commands);
+ argc--, argv++;
+ if (argc > 0) {
+ if (argv[0][0] == '-') {
+ struct cmdtab *p;
+
+ p = lookup(&argv[0][1]);
+ if (p == (struct cmdtab *)-1)
+ errx(1, "%s: ambiguous request", &argv[0][1]);
+ if (p == (struct cmdtab *)0)
+ errx(1, "%s: unknown request", &argv[0][1]);
+ curcmd = p;
+ argc--, argv++;
+ }
+ parse_cmd_args (argc, argv);
+
+ }
+ kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
+ if (kd != NULL) {
+ /*
+ * Try to actually read something, we may be in a jail, and
+ * have /dev/null opened as /dev/mem.
+ */
+ if (kvm_nlist(kd, namelist) != 0 || namelist[0].n_value == 0 ||
+ kvm_read(kd, namelist[0].n_value, &dummy, sizeof(dummy)) !=
+ sizeof(dummy)) {
+ kvm_close(kd);
+ kd = NULL;
+ }
+ }
+ if (kd == NULL) {
+ /*
+ * Maybe we are lacking permissions? Retry, this time with bogus
+ * devices. We can now use sysctl only.
+ */
+ use_kvm = 0;
+ kd = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, _PATH_DEVNULL,
+ O_RDONLY, errbuf);
+ if (kd == NULL) {
+ error("%s", errbuf);
+ exit(1);
+ }
+ }
+ signal(SIGHUP, die);
+ signal(SIGINT, die);
+ signal(SIGQUIT, die);
+ signal(SIGTERM, die);
+
+ /*
+ * Initialize display. Load average appears in a one line
+ * window of its own. Current command's display appears in
+ * an overlapping sub-window of stdscr configured by the display
+ * routines to minimize update work by curses.
+ */
+ initscr();
+ CMDLINE = LINES - 1;
+ wnd = (*curcmd->c_open)();
+ if (wnd == NULL) {
+ warnx("couldn't initialize display");
+ die(0);
+ }
+ wload = newwin(1, 0, 1, 20);
+ if (wload == NULL) {
+ warnx("couldn't set up load average window");
+ die(0);
+ }
+ gethostname(hostname, sizeof (hostname));
+ size = sizeof(clkinfo);
+ if (sysctlbyname("kern.clockrate", &clkinfo, &size, NULL, 0)
+ || size != sizeof(clkinfo)) {
+ error("kern.clockrate");
+ die(0);
+ }
+ hertz = clkinfo.stathz;
+ (*curcmd->c_init)();
+ curcmd->c_flags |= CF_INIT;
+ labels();
+
+ 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();
+ keyboard();
+ /*NOTREACHED*/
+
+ return EXIT_SUCCESS;
+}
+
+void
+labels(void)
+{
+ if (curcmd->c_flags & CF_LOADAV) {
+ mvaddstr(0, 20,
+ "/0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10");
+ mvaddstr(1, 5, "Load Average");
+ }
+ if (curcmd->c_flags & CF_ZFSARC) {
+ mvaddstr(0, 20,
+ " Total MFU MRU Anon Hdr L2Hdr Other");
+ mvaddstr(1, 5, "ZFS ARC ");
+ }
+ (*curcmd->c_label)();
+#ifdef notdef
+ mvprintw(21, 25, "CPU usage on %s", hostname);
+#endif
+ refresh();
+}
+
+void
+display(void)
+{
+ int i, j;
+
+ /* Get the load average over the last minute. */
+ (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
+ (*curcmd->c_fetch)();
+ if (curcmd->c_flags & CF_LOADAV) {
+ j = 5.0*avenrun[0] + 0.5;
+ dellave -= avenrun[0];
+ if (dellave >= 0.0)
+ c = '<';
+ else {
+ c = '>';
+ dellave = -dellave;
+ }
+ if (dellave < 0.1)
+ c = '|';
+ dellave = avenrun[0];
+ wmove(wload, 0, 0); wclrtoeol(wload);
+ for (i = MIN(j, 50); i > 0; i--)
+ waddch(wload, c);
+ if (j > 50)
+ wprintw(wload, " %4.1f", avenrun[0]);
+ }
+ if (curcmd->c_flags & CF_ZFSARC) {
+ uint64_t arc[7] = {};
+ size_t size = sizeof(arc[0]);
+ if (sysctlbyname("kstat.zfs.misc.arcstats.size",
+ &arc[0], &size, NULL, 0) == 0 ) {
+ GETSYSCTL("vfs.zfs.mfu_size", arc[1]);
+ GETSYSCTL("vfs.zfs.mru_size", arc[2]);
+ GETSYSCTL("vfs.zfs.anon_size", arc[3]);
+ GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc[4]);
+ GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]);
+ GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]);
+ wmove(wload, 0, 0); wclrtoeol(wload);
+ for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) {
+ if (arc[i] > 10llu * 1024 * 1024 * 1024 ) {
+ wprintw(wload, "%7lluG", arc[i] >> 30);
+ }
+ else if (arc[i] > 10 * 1024 * 1024 ) {
+ wprintw(wload, "%7lluM", arc[i] >> 20);
+ }
+ else {
+ wprintw(wload, "%7lluK", arc[i] >> 10);
+ }
+ }
+ }
+ }
+ (*curcmd->c_refresh)();
+ if (curcmd->c_flags & (CF_LOADAV |CF_ZFSARC))
+ wrefresh(wload);
+ wrefresh(wnd);
+ move(CMDLINE, col);
+ refresh();
+}
+
+void
+load(void)
+{
+
+ (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
+ mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
+ avenrun[0], avenrun[1], avenrun[2]);
+ clrtoeol();
+}
+
+void
+die(int signo __unused)
+{
+ move(CMDLINE, 0);
+ clrtoeol();
+ refresh();
+ endwin();
+ exit(0);
+}
+
+#include <stdarg.h>
+
+void
+error(const char *fmt, ...)
+{
+ va_list ap;
+ char buf[255];
+ int oy, ox;
+
+ va_start(ap, fmt);
+ if (wnd) {
+ getyx(stdscr, oy, ox);
+ (void) vsnprintf(buf, sizeof(buf), fmt, ap);
+ clrtoeol();
+ standout();
+ mvaddstr(CMDLINE, 0, buf);
+ standend();
+ move(oy, ox);
+ refresh();
+ } else {
+ (void) vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ }
+ va_end(ap);
+}
+
+void
+nlisterr(struct nlist n_list[])
+{
+ int i, n;
+
+ n = 0;
+ clear();
+ mvprintw(2, 10, "systat: nlist: can't find following symbols:");
+ for (i = 0;
+ n_list[i].n_name != NULL && *n_list[i].n_name != '\0'; i++)
+ if (n_list[i].n_value == 0)
+ mvprintw(2 + ++n, 10, "%s", n_list[i].n_name);
+ move(CMDLINE, 0);
+ clrtoeol();
+ refresh();
+ endwin();
+ exit(1);
+}
diff --git a/usr.bin/systat/mode.c b/usr.bin/systat/mode.c
new file mode 100644
index 0000000..a3fdf46
--- /dev/null
+++ b/usr.bin/systat/mode.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright 1997 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. 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.
+ */
+
+/*
+ * mode.c - mechanisms for dealing with SGI-style modal displays.
+ *
+ * There are four generally-understood useful modes for status displays
+ * of the sort exemplified by the IRIX ``netstat -C'' and ``osview''
+ * programs. We try to follow their example, although the user interface
+ * and terminology slightly differ.
+ *
+ * RATE - the default mode - displays the precise rate of change in
+ * each statistic in units per second, regardless of the actual display
+ * update interval.
+ *
+ * DELTA - displays the change in each statistic over the entire
+ * display update interval (i.e., RATE * interval).
+ *
+ * SINCE - displays the total change in each statistic since the module
+ * was last initialized or reset.
+ *
+ * ABSOLUTE - displays the current value of each statistic.
+ *
+ * In the SGI programs, these modes are selected by the single-character
+ * commands D, W, N, and A. In systat, they are the slightly-harder-to-type
+ * ``mode delta'', etc. The initial value for SINCE mode is initialized
+ * when the module is first started and can be reset using the ``reset''
+ * command (as opposed to the SGI way where changing modes implicitly
+ * resets). A ``mode'' command with no arguments displays the current
+ * mode in the command line.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+enum mode currentmode = display_RATE;
+
+static const char *const modes[] = { "rate", "delta", "since", "absolute" };
+
+int
+cmdmode(const char *cmd, const char *args)
+{
+ if (prefix(cmd, "mode")) {
+ if (args[0] == '\0') {
+ move(CMDLINE, 0);
+ clrtoeol();
+ printw("%s", modes[currentmode]);
+ } else if (prefix(args, "rate")) {
+ currentmode = display_RATE;
+ } else if (prefix(args, "delta")) {
+ currentmode = display_DELTA;
+ } else if (prefix(args, "since")) {
+ currentmode = display_SINCE;
+ } else if (prefix(args, "absolute")) {
+ currentmode = display_ABS;
+ } else {
+ printw("unknown mode `%s'", args);
+ }
+ return 1;
+ }
+ if(prefix(cmd, "reset")) {
+ curcmd->c_reset();
+ return 1;
+ }
+ return 0;
+}
diff --git a/usr.bin/systat/mode.h b/usr.bin/systat/mode.h
new file mode 100644
index 0000000..64b5275
--- /dev/null
+++ b/usr.bin/systat/mode.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 1997 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. 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$
+ */
+
+/*
+ * mode.h - mechanisms for dealing with SGI-style modal displays.
+ */
+
+#ifndef MODE_H
+#define MODE_H 1
+
+enum mode { display_RATE, display_DELTA, display_SINCE, display_ABS };
+
+extern int cmdmode(const char *cmd, const char *args);
+extern enum mode currentmode;
+
+#endif /* MODE_H */
diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c
new file mode 100644
index 0000000..a91af38
--- /dev/null
+++ b/usr.bin/systat/netcmds.c
@@ -0,0 +1,308 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * Common network command support routines.
+ */
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/protosw.h>
+
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/in_pcb.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+
+#define streq(a,b) (strcmp(a,b)==0)
+
+static struct hitem {
+ struct in_addr addr;
+ int onoff;
+} *hosts;
+
+int nports, nhosts, protos;
+
+static void changeitems(const char *, int);
+static int selectproto(const char *);
+static void showprotos(void);
+static int selectport(long, int);
+static void showports(void);
+static int selecthost(struct in_addr *, int);
+static void showhosts(void);
+
+int
+netcmd(const char *cmd, const char *args)
+{
+
+ if (prefix(cmd, "proto")) {
+ if (*args == '\0') {
+ move(CMDLINE, 0);
+ clrtoeol();
+ addstr("which proto?");
+ } else if (!selectproto(args)) {
+ error("%s: Unknown protocol.", args);
+ }
+ return (1);
+ }
+ if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
+ changeitems(args, prefix(cmd, "display"));
+ return (1);
+ }
+ if (prefix(cmd, "reset")) {
+ selectproto(0);
+ selecthost(0, 0);
+ selectport(-1, 0);
+ return (1);
+ }
+ if (prefix(cmd, "show")) {
+ move(CMDLINE, 0); clrtoeol();
+ if (*args == '\0') {
+ showprotos();
+ showhosts();
+ showports();
+ return (1);
+ }
+ if (prefix(args, "protos"))
+ showprotos();
+ else if (prefix(args, "hosts"))
+ showhosts();
+ else if (prefix(args, "ports"))
+ showports();
+ else
+ addstr("show what?");
+ return (1);
+ }
+ return (0);
+}
+
+static void
+changeitems(const char *args, int onoff)
+{
+ char *cp, *tmpstr, *tmpstr1;
+ struct servent *sp;
+ struct hostent *hp;
+ struct in_addr in;
+
+ tmpstr = tmpstr1 = strdup(args);
+ cp = strchr(tmpstr1, '\n');
+ if (cp)
+ *cp = '\0';
+ for (;;tmpstr1 = cp) {
+ for (cp = tmpstr1; *cp && isspace(*cp); cp++)
+ ;
+ tmpstr1 = cp;
+ for (; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ if (cp - tmpstr1 == 0)
+ break;
+ sp = getservbyname(tmpstr1,
+ protos == TCP ? "tcp" : protos == UDP ? "udp" : 0);
+ if (sp) {
+ selectport(sp->s_port, onoff);
+ continue;
+ }
+ hp = gethostbyname(tmpstr1);
+ if (hp == NULL) {
+ in.s_addr = inet_addr(tmpstr1);
+ if (in.s_addr == INADDR_NONE) {
+ error("%s: unknown host or port", tmpstr1);
+ continue;
+ }
+ } else
+ in = *(struct in_addr *)hp->h_addr;
+ selecthost(&in, onoff);
+ }
+ free(tmpstr);
+}
+
+static int
+selectproto(const char *proto)
+{
+
+ if (proto == NULL || streq(proto, "all"))
+ protos = TCP | UDP;
+ else if (streq(proto, "tcp"))
+ protos = TCP;
+ else if (streq(proto, "udp"))
+ protos = UDP;
+ else
+ return (0);
+
+ return (protos);
+}
+
+static void
+showprotos(void)
+{
+
+ if ((protos&TCP) == 0)
+ addch('!');
+ addstr("tcp ");
+ if ((protos&UDP) == 0)
+ addch('!');
+ addstr("udp ");
+}
+
+static struct pitem {
+ long port;
+ int onoff;
+} *ports;
+
+static int
+selectport(long port, int onoff)
+{
+ struct pitem *p;
+
+ if (port == -1) {
+ if (ports == NULL)
+ return (0);
+ free((char *)ports), ports = 0;
+ nports = 0;
+ return (1);
+ }
+ for (p = ports; p < ports + nports; p++)
+ if (p->port == port) {
+ p->onoff = onoff;
+ return (0);
+ }
+ if (nports == 0)
+ ports = (struct pitem *)malloc(sizeof (*p));
+ else
+ ports = (struct pitem *)realloc(ports, (nports+1)*sizeof (*p));
+ p = &ports[nports++];
+ p->port = port;
+ p->onoff = onoff;
+ return (1);
+}
+
+int
+checkport(struct inpcb *inp)
+{
+ struct pitem *p;
+
+ if (ports)
+ for (p = ports; p < ports+nports; p++)
+ if (p->port == inp->inp_lport || p->port == inp->inp_fport)
+ return (p->onoff);
+ return (1);
+}
+
+static void
+showports(void)
+{
+ struct pitem *p;
+ struct servent *sp;
+
+ for (p = ports; p < ports+nports; p++) {
+ sp = getservbyport(p->port,
+ protos == (TCP|UDP) ? 0 : protos == TCP ? "tcp" : "udp");
+ if (!p->onoff)
+ addch('!');
+ if (sp)
+ printw("%s ", sp->s_name);
+ else
+ printw("%d ", p->port);
+ }
+}
+
+static int
+selecthost(struct in_addr *in, int onoff)
+{
+ struct hitem *p;
+
+ if (in == NULL) {
+ if (hosts == NULL)
+ return (0);
+ free((char *)hosts), hosts = 0;
+ nhosts = 0;
+ return (1);
+ }
+ for (p = hosts; p < hosts+nhosts; p++)
+ if (p->addr.s_addr == in->s_addr) {
+ p->onoff = onoff;
+ return (0);
+ }
+ if (nhosts == 0)
+ hosts = (struct hitem *)malloc(sizeof (*p));
+ else
+ hosts = (struct hitem *)realloc(hosts, (nhosts+1)*sizeof (*p));
+ p = &hosts[nhosts++];
+ p->addr = *in;
+ p->onoff = onoff;
+ return (1);
+}
+
+int
+checkhost(struct inpcb *inp)
+{
+ struct hitem *p;
+
+ if (hosts)
+ for (p = hosts; p < hosts+nhosts; p++)
+ if (p->addr.s_addr == inp->inp_laddr.s_addr ||
+ p->addr.s_addr == inp->inp_faddr.s_addr)
+ return (p->onoff);
+ return (1);
+}
+
+static void
+showhosts(void)
+{
+ struct hitem *p;
+ struct hostent *hp;
+
+ for (p = hosts; p < hosts+nhosts; p++) {
+ hp = gethostbyaddr((char *)&p->addr, sizeof (p->addr), AF_INET);
+ if (!p->onoff)
+ addch('!');
+ printw("%s ", hp ? hp->h_name : (char *)inet_ntoa(p->addr));
+ }
+}
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c
new file mode 100644
index 0000000..90ddd25
--- /dev/null
+++ b/usr.bin/systat/netstat.c
@@ -0,0 +1,657 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * netstat
+ */
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/protosw.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <net/route.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif
+#include <netinet/in_pcb.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/icmp_var.h>
+#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcpip.h>
+#include <netinet/tcp_seq.h>
+#define TCPSTATES
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+#include <netinet/tcp_debug.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+
+#include <netdb.h>
+#include <nlist.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+
+static struct netinfo *enter(struct inpcb *, int, const char *);
+static void enter_kvm(struct inpcb *, struct socket *, int, const char *);
+static void enter_sysctl(struct inpcb *, struct xsocket *, int, const char *);
+static void fetchnetstat_kvm(void);
+static void fetchnetstat_sysctl(void);
+static char *inetname(struct sockaddr *);
+static void inetprint(struct sockaddr *, const char *);
+
+#define streq(a,b) (strcmp(a,b)==0)
+#define YMAX(w) (getmaxy(w)-2)
+
+WINDOW *
+opennetstat(void)
+{
+ sethostent(1);
+ setnetent(1);
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+struct netinfo {
+ TAILQ_ENTRY(netinfo) chain;
+ short ni_line; /* line on screen */
+ short ni_seen; /* 0 when not present in list */
+ short ni_flags;
+#define NIF_LACHG 0x1 /* local address changed */
+#define NIF_FACHG 0x2 /* foreign address changed */
+ short ni_state; /* tcp state */
+ const char *ni_proto; /* protocol */
+ struct sockaddr_storage ni_lsa; /* local address */
+ struct sockaddr_storage ni_fsa; /* foreign address */
+ u_int ni_rcvcc; /* rcv buffer character count */
+ u_int ni_sndcc; /* snd buffer character count */
+};
+
+TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb);
+
+static int aflag = 0;
+static int nflag = 0;
+static int lastrow = 1;
+
+void
+closenetstat(WINDOW *w)
+{
+ struct netinfo *p;
+
+ endhostent();
+ endnetent();
+ TAILQ_FOREACH(p, &netcb, chain) {
+ if (p->ni_line != -1)
+ lastrow--;
+ p->ni_line = -1;
+ }
+ if (w != NULL) {
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+ }
+}
+
+static const char *miblist[] = {
+ "net.inet.tcp.pcblist",
+ "net.inet.udp.pcblist"
+};
+
+static char tcb[] = "tcb", udb[] = "udb";
+
+struct nlist namelist[] = {
+#define X_TCB 0
+ { .n_name = tcb },
+#define X_UDB 1
+ { .n_name = udb },
+ { .n_name = NULL },
+};
+
+int
+initnetstat(void)
+{
+ protos = TCP|UDP;
+ return(1);
+}
+
+void
+fetchnetstat(void)
+{
+ if (use_kvm)
+ fetchnetstat_kvm();
+ else
+ fetchnetstat_sysctl();
+}
+
+static void
+fetchnetstat_kvm(void)
+{
+ struct inpcb *next;
+ struct netinfo *p;
+ struct inpcbhead head;
+ struct inpcb inpcb;
+ struct socket sockb;
+ struct tcpcb tcpcb;
+ void *off;
+ int istcp;
+
+ if (namelist[X_TCB].n_value == 0)
+ return;
+ TAILQ_FOREACH(p, &netcb, chain)
+ p->ni_seen = 0;
+ if (protos&TCP) {
+ off = NPTR(X_TCB);
+ istcp = 1;
+ }
+ else if (protos&UDP) {
+ off = NPTR(X_UDB);
+ istcp = 0;
+ }
+ else {
+ error("No protocols to display");
+ return;
+ }
+again:
+ KREAD(off, &head, sizeof (struct inpcbhead));
+ LIST_FOREACH(next, &head, inp_list) {
+ KREAD(next, &inpcb, sizeof (inpcb));
+ next = &inpcb;
+ if (!aflag) {
+ if (inpcb.inp_vflag & INP_IPV4) {
+ if (inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)
+ continue;
+ }
+#ifdef INET6
+ else if (inpcb.inp_vflag & INP_IPV6) {
+ if (memcmp(&inpcb.in6p_laddr,
+ &in6addr_any, sizeof(in6addr_any)) == 0)
+ continue;
+ }
+#endif
+ }
+ if (nhosts && !checkhost(&inpcb))
+ continue;
+ if (nports && !checkport(&inpcb))
+ continue;
+ if (istcp) {
+ if (inpcb.inp_flags & INP_TIMEWAIT) {
+ bzero(&sockb, sizeof(sockb));
+ enter_kvm(&inpcb, &sockb, TCPS_TIME_WAIT,
+ "tcp");
+ } else {
+ KREAD(inpcb.inp_socket, &sockb,
+ sizeof (sockb));
+ KREAD(inpcb.inp_ppcb, &tcpcb, sizeof (tcpcb));
+ enter_kvm(&inpcb, &sockb, tcpcb.t_state,
+ "tcp");
+ }
+ } else
+ enter_kvm(&inpcb, &sockb, 0, "udp");
+ }
+ if (istcp && (protos&UDP)) {
+ istcp = 0;
+ off = NPTR(X_UDB);
+ goto again;
+ }
+}
+
+static void
+fetchnetstat_sysctl(void)
+{
+ struct netinfo *p;
+ int idx;
+ struct xinpgen *inpg;
+ char *cur, *end;
+ struct inpcb *inpcb;
+ struct xinpcb *xip = NULL;
+ struct xtcpcb *xtp = NULL;
+ int plen;
+ size_t lsz;
+
+ TAILQ_FOREACH(p, &netcb, chain)
+ p->ni_seen = 0;
+ if (protos&TCP) {
+ idx = 0;
+ } else if (protos&UDP) {
+ idx = 1;
+ } else {
+ error("No protocols to display");
+ return;
+ }
+
+ for (;idx < 2; idx++) {
+ if (idx == 1 && !(protos&UDP))
+ break;
+ inpg = (struct xinpgen *)sysctl_dynread(miblist[idx], &lsz);
+ if (inpg == NULL) {
+ error("sysctl(%s...) failed", miblist[idx]);
+ continue;
+ }
+ /*
+ * We currently do no require a consistent pcb list.
+ * Try to be robust in case of struct size changes
+ */
+ cur = ((char *)inpg) + inpg->xig_len;
+ /* There is also a trailing struct xinpgen */
+ end = ((char *)inpg) + lsz - inpg->xig_len;
+ if (end <= cur) {
+ free(inpg);
+ continue;
+ }
+ if (idx == 0) { /* TCP */
+ xtp = (struct xtcpcb *)cur;
+ plen = xtp->xt_len;
+ } else {
+ xip = (struct xinpcb *)cur;
+ plen = xip->xi_len;
+ }
+ while (cur + plen <= end) {
+ if (idx == 0) { /* TCP */
+ xtp = (struct xtcpcb *)cur;
+ inpcb = &xtp->xt_inp;
+ } else {
+ xip = (struct xinpcb *)cur;
+ inpcb = &xip->xi_inp;
+ }
+ cur += plen;
+
+ if (!aflag) {
+ if (inpcb->inp_vflag & INP_IPV4) {
+ if (inet_lnaof(inpcb->inp_laddr) ==
+ INADDR_ANY)
+ continue;
+ }
+#ifdef INET6
+ else if (inpcb->inp_vflag & INP_IPV6) {
+ if (memcmp(&inpcb->in6p_laddr,
+ &in6addr_any, sizeof(in6addr_any))
+ == 0)
+ continue;
+ }
+#endif
+ }
+ if (nhosts && !checkhost(inpcb))
+ continue;
+ if (nports && !checkport(inpcb))
+ continue;
+ if (idx == 0) /* TCP */
+ enter_sysctl(inpcb, &xtp->xt_socket,
+ xtp->xt_tp.t_state, "tcp");
+ else /* UDP */
+ enter_sysctl(inpcb, &xip->xi_socket, 0, "udp");
+ }
+ free(inpg);
+ }
+}
+
+static void
+enter_kvm(struct inpcb *inp, struct socket *so, int state, const char *proto)
+{
+ struct netinfo *p;
+
+ if ((p = enter(inp, state, proto)) != NULL) {
+ p->ni_rcvcc = so->so_rcv.sb_ccc;
+ p->ni_sndcc = so->so_snd.sb_ccc;
+ }
+}
+
+static void
+enter_sysctl(struct inpcb *inp, struct xsocket *so, int state, const char *proto)
+{
+ struct netinfo *p;
+
+ if ((p = enter(inp, state, proto)) != NULL) {
+ p->ni_rcvcc = so->so_rcv.sb_cc;
+ p->ni_sndcc = so->so_snd.sb_cc;
+ }
+}
+
+static struct netinfo *
+enter(struct inpcb *inp, int state, const char *proto)
+{
+ struct netinfo *p;
+ struct sockaddr_storage lsa, fsa;
+ struct sockaddr_in *sa4;
+#ifdef INET6
+ struct sockaddr_in6 *sa6;
+#endif
+
+ memset(&lsa, 0, sizeof(lsa));
+ memset(&fsa, 0, sizeof(fsa));
+ if (inp->inp_vflag & INP_IPV4) {
+ sa4 = (struct sockaddr_in *)&lsa;
+ sa4->sin_addr = inp->inp_laddr;
+ sa4->sin_port = inp->inp_lport;
+ sa4->sin_family = AF_INET;
+ sa4->sin_len = sizeof(struct sockaddr_in);
+
+ sa4 = (struct sockaddr_in *)&fsa;
+ sa4->sin_addr = inp->inp_faddr;
+ sa4->sin_port = inp->inp_fport;
+ sa4->sin_family = AF_INET;
+ sa4->sin_len = sizeof(struct sockaddr_in);
+ }
+#ifdef INET6
+ else if (inp->inp_vflag & INP_IPV6) {
+ sa6 = (struct sockaddr_in6 *)&lsa;
+ memcpy(&sa6->sin6_addr, &inp->in6p_laddr,
+ sizeof(struct in6_addr));
+ sa6->sin6_port = inp->inp_lport;
+ sa6->sin6_family = AF_INET6;
+ sa6->sin6_len = sizeof(struct sockaddr_in6);
+
+ sa6 = (struct sockaddr_in6 *)&fsa;
+ memcpy(&sa6->sin6_addr, &inp->in6p_faddr,
+ sizeof(struct in6_addr));
+ sa6->sin6_port = inp->inp_fport;
+ sa6->sin6_family = AF_INET6;
+ sa6->sin6_len = sizeof(struct sockaddr_in6);
+ }
+#endif
+ else
+ return NULL;
+
+ /*
+ * Only take exact matches, any sockets with
+ * previously unbound addresses will be deleted
+ * below in the display routine because they
+ * will appear as ``not seen'' in the kernel
+ * data structures.
+ */
+ TAILQ_FOREACH(p, &netcb, chain) {
+ if (!streq(proto, p->ni_proto))
+ continue;
+ if (p->ni_lsa.ss_family != lsa.ss_family ||
+ memcmp(&p->ni_lsa, &lsa, lsa.ss_len) != 0)
+ continue;
+ if (p->ni_fsa.ss_family == fsa.ss_family &&
+ memcmp(&p->ni_fsa, &fsa, fsa.ss_len) == 0)
+ break;
+ }
+ if (p == NULL) {
+ if ((p = malloc(sizeof(*p))) == NULL) {
+ error("Out of memory");
+ return NULL;
+ }
+ TAILQ_INSERT_HEAD(&netcb, p, chain);
+ p->ni_line = -1;
+ memcpy(&p->ni_lsa, &lsa, lsa.ss_len);
+ memcpy(&p->ni_fsa, &fsa, fsa.ss_len);
+ p->ni_proto = strdup(proto);
+ p->ni_flags = NIF_LACHG|NIF_FACHG;
+ }
+ p->ni_state = state;
+ p->ni_seen = 1;
+ return p;
+}
+
+/* column locations */
+#define LADDR 0
+#define FADDR LADDR+23
+#define PROTO FADDR+23
+#define RCVCC PROTO+6
+#define SNDCC RCVCC+7
+#define STATE SNDCC+7
+
+void
+labelnetstat(void)
+{
+ if (use_kvm && namelist[X_TCB].n_type == 0)
+ return;
+ wmove(wnd, 0, 0); wclrtobot(wnd);
+ mvwaddstr(wnd, 0, LADDR, "Local Address");
+ mvwaddstr(wnd, 0, FADDR, "Foreign Address");
+ mvwaddstr(wnd, 0, PROTO, "Proto");
+ mvwaddstr(wnd, 0, RCVCC, "Recv-Q");
+ mvwaddstr(wnd, 0, SNDCC, "Send-Q");
+ mvwaddstr(wnd, 0, STATE, "(state)");
+}
+
+void
+shownetstat(void)
+{
+ struct netinfo *p, *q;
+ char proto[6];
+ const char *family = "";
+
+ /*
+ * First, delete any connections that have gone
+ * away and adjust the position of connections
+ * below to reflect the deleted line.
+ */
+ p = TAILQ_FIRST(&netcb);
+ while (p != NULL) {
+ if (p->ni_line == -1 || p->ni_seen) {
+ p = TAILQ_NEXT(p, chain);
+ continue;
+ }
+ wmove(wnd, p->ni_line, 0); wdeleteln(wnd);
+ TAILQ_FOREACH(q, &netcb, chain)
+ if (q != p && q->ni_line > p->ni_line) {
+ q->ni_line--;
+ /* this shouldn't be necessary */
+ q->ni_flags |= NIF_LACHG|NIF_FACHG;
+ }
+ lastrow--;
+ q = TAILQ_NEXT(p, chain);
+ TAILQ_REMOVE(&netcb, p, chain);
+ free(p);
+ p = q;
+ }
+ /*
+ * Update existing connections and add new ones.
+ */
+ TAILQ_FOREACH(p, &netcb, chain) {
+ if (p->ni_line == -1) {
+ /*
+ * Add a new entry if possible.
+ */
+ if (lastrow > YMAX(wnd))
+ continue;
+ p->ni_line = lastrow++;
+ p->ni_flags |= NIF_LACHG|NIF_FACHG;
+ }
+ if (p->ni_flags & NIF_LACHG) {
+ wmove(wnd, p->ni_line, LADDR);
+ inetprint((struct sockaddr *)&p->ni_lsa, p->ni_proto);
+ p->ni_flags &= ~NIF_LACHG;
+ }
+ if (p->ni_flags & NIF_FACHG) {
+ wmove(wnd, p->ni_line, FADDR);
+ inetprint((struct sockaddr *)&p->ni_fsa, p->ni_proto);
+ p->ni_flags &= ~NIF_FACHG;
+ }
+#ifdef INET6
+ family = (p->ni_lsa.ss_family == AF_INET) ? "4" : "6";
+#endif
+ snprintf(proto, sizeof(proto), "%s%s", p->ni_proto, family);
+ mvwaddstr(wnd, p->ni_line, PROTO, proto);
+ mvwprintw(wnd, p->ni_line, RCVCC, "%6u", p->ni_rcvcc);
+ mvwprintw(wnd, p->ni_line, SNDCC, "%6u", p->ni_sndcc);
+ if (streq(p->ni_proto, "tcp")) {
+ if (p->ni_state < 0 || p->ni_state >= TCP_NSTATES)
+ mvwprintw(wnd, p->ni_line, STATE, "%d",
+ p->ni_state);
+ else
+ mvwaddstr(wnd, p->ni_line, STATE,
+ tcpstates[p->ni_state]);
+ }
+ wclrtoeol(wnd);
+ }
+ if (lastrow < YMAX(wnd)) {
+ wmove(wnd, lastrow, 0); wclrtobot(wnd);
+ wmove(wnd, YMAX(wnd), 0); wdeleteln(wnd); /* XXX */
+ }
+}
+
+/*
+ * Pretty print an Internet address (net address + port).
+ * If the nflag was specified, use numbers instead of names.
+ */
+static void
+inetprint(struct sockaddr *sa, const char *proto)
+{
+ struct servent *sp = 0;
+ char line[80], *cp;
+ int port;
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ port = ((struct sockaddr_in *)sa)->sin_port;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ port = ((struct sockaddr_in6 *)sa)->sin6_port;
+ break;
+#endif
+ default:
+ port = 0;
+ break;
+ }
+ snprintf(line, sizeof(line), "%.*s.", 16, inetname(sa));
+ cp = strchr(line, '\0');
+ if (!nflag && port)
+ sp = getservbyport(port, proto);
+ if (sp || port == 0)
+ snprintf(cp, sizeof(line) - (cp - line), "%.8s",
+ sp ? sp->s_name : "*");
+ else
+ snprintf(cp, sizeof(line) - (cp - line), "%d",
+ ntohs((u_short)port));
+ /* pad to full column to clear any garbage */
+ cp = strchr(line, '\0');
+ while (cp - line < 22)
+ *cp++ = ' ';
+ line[22] = '\0';
+ waddstr(wnd, line);
+}
+
+/*
+ * Construct an Internet address representation.
+ * If the nflag has been supplied, give
+ * numeric value, otherwise try for symbolic name.
+ */
+static char *
+inetname(struct sockaddr *sa)
+{
+ char *cp = 0;
+ static char line[NI_MAXHOST];
+ struct hostent *hp;
+ struct netent *np;
+ struct in_addr in;
+
+#ifdef INET6
+ if (sa->sa_family == AF_INET6) {
+ if (memcmp(&((struct sockaddr_in6 *)sa)->sin6_addr,
+ &in6addr_any, sizeof(in6addr_any)) == 0)
+ strcpy(line, "*");
+ else
+ getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0,
+ nflag ? NI_NUMERICHOST : 0);
+ return (line);
+ }
+#endif
+
+ in = ((struct sockaddr_in *)sa)->sin_addr;
+ if (!nflag && in.s_addr != INADDR_ANY) {
+ int net = inet_netof(in);
+ int lna = inet_lnaof(in);
+
+ if (lna == INADDR_ANY) {
+ np = getnetbyaddr(net, AF_INET);
+ if (np)
+ cp = np->n_name;
+ }
+ if (cp == NULL) {
+ hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
+ if (hp)
+ cp = hp->h_name;
+ }
+ }
+ if (in.s_addr == INADDR_ANY)
+ strcpy(line, "*");
+ else if (cp)
+ snprintf(line, sizeof(line), "%s", cp);
+ else {
+ in.s_addr = ntohl(in.s_addr);
+#define C(x) ((x) & 0xff)
+ snprintf(line, sizeof(line), "%u.%u.%u.%u", C(in.s_addr >> 24),
+ C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr));
+ }
+ return (line);
+}
+
+int
+cmdnetstat(const char *cmd, const char *args)
+{
+ if (prefix(cmd, "all")) {
+ aflag = !aflag;
+ goto fixup;
+ }
+ if (prefix(cmd, "numbers") || prefix(cmd, "names")) {
+ struct netinfo *p;
+ int new;
+
+ new = prefix(cmd, "numbers");
+ if (new == nflag)
+ return (1);
+ TAILQ_FOREACH(p, &netcb, chain) {
+ if (p->ni_line == -1)
+ continue;
+ p->ni_flags |= NIF_LACHG|NIF_FACHG;
+ }
+ nflag = new;
+ goto redisplay;
+ }
+ if (!netcmd(cmd, args))
+ return (0);
+fixup:
+ fetchnetstat();
+redisplay:
+ shownetstat();
+ refresh();
+ return (1);
+}
diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c
new file mode 100644
index 0000000..d341f7d
--- /dev/null
+++ b/usr.bin/systat/pigs.c
@@ -0,0 +1,193 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Pigs display from Bill Reeves at Lucasfilm
+ */
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/user.h>
+
+#include <curses.h>
+#include <math.h>
+#include <pwd.h>
+#include <stdlib.h>
+
+#include "systat.h"
+#include "extern.h"
+
+int compar(const void *, const void *);
+
+static int nproc;
+static struct p_times {
+ float pt_pctcpu;
+ struct kinfo_proc *pt_kp;
+} *pt;
+
+static int fscale;
+static double lccpu;
+
+WINDOW *
+openpigs(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closepigs(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+showpigs(void)
+{
+ int i, j, y, k;
+ const char *uname, *pname;
+ char pidname[30];
+
+ if (pt == NULL)
+ return;
+
+ qsort(pt, nproc, sizeof (struct p_times), compar);
+ y = 1;
+ i = nproc;
+ if (i > getmaxy(wnd)-2)
+ i = getmaxy(wnd)-2;
+ for (k = 0; i > 0 && pt[k].pt_pctcpu > 0.01; i--, y++, k++) {
+ uname = user_from_uid(pt[k].pt_kp->ki_uid, 0);
+ pname = pt[k].pt_kp->ki_comm;
+ wmove(wnd, y, 0);
+ wclrtoeol(wnd);
+ mvwaddstr(wnd, y, 0, uname);
+ snprintf(pidname, sizeof(pidname), "%10.10s", pname);
+ mvwaddstr(wnd, y, 9, pidname);
+ wmove(wnd, y, 20);
+ for (j = pt[k].pt_pctcpu * 50 + 0.5; j > 0; j--)
+ waddch(wnd, 'X');
+ }
+ wmove(wnd, y, 0); wclrtobot(wnd);
+}
+
+int
+initpigs(void)
+{
+ fixpt_t ccpu;
+ size_t len;
+ int err;
+
+ len = sizeof(ccpu);
+ err = sysctlbyname("kern.ccpu", &ccpu, &len, NULL, 0);
+ if (err || len != sizeof(ccpu)) {
+ perror("kern.ccpu");
+ return (0);
+ }
+
+ len = sizeof(fscale);
+ err = sysctlbyname("kern.fscale", &fscale, &len, NULL, 0);
+ if (err || len != sizeof(fscale)) {
+ perror("kern.fscale");
+ return (0);
+ }
+
+ lccpu = log((double) ccpu / fscale);
+
+ return(1);
+}
+
+void
+fetchpigs(void)
+{
+ int i;
+ float ftime;
+ float *pctp;
+ struct kinfo_proc *kpp;
+ static int lastnproc = 0;
+
+ if ((kpp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc)) == NULL) {
+ error("%s", kvm_geterr(kd));
+ if (pt)
+ free(pt);
+ return;
+ }
+ if (nproc > lastnproc) {
+ free(pt);
+ if ((pt =
+ malloc(nproc * sizeof(struct p_times))) == NULL) {
+ error("Out of memory");
+ die(0);
+ }
+ }
+ lastnproc = nproc;
+ /*
+ * calculate %cpu for each proc
+ */
+ for (i = 0; i < nproc; i++) {
+ pt[i].pt_kp = &kpp[i];
+ pctp = &pt[i].pt_pctcpu;
+ ftime = kpp[i].ki_swtime;
+ if (ftime == 0 || (kpp[i].ki_flag & P_INMEM) == 0)
+ *pctp = 0;
+ else
+ *pctp = ((double) kpp[i].ki_pctcpu /
+ fscale) / (1.0 - exp(ftime * lccpu));
+ }
+}
+
+void
+labelpigs(void)
+{
+ wmove(wnd, 0, 0);
+ wclrtoeol(wnd);
+ mvwaddstr(wnd, 0, 20,
+ "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
+}
+
+int
+compar(const void *a, const void *b)
+{
+ return (((const struct p_times *) a)->pt_pctcpu >
+ ((const struct p_times *) b)->pt_pctcpu)? -1: 1;
+}
diff --git a/usr.bin/systat/sctp.c b/usr.bin/systat/sctp.c
new file mode 100644
index 0000000..ea0edd8
--- /dev/null
+++ b/usr.bin/systat/sctp.c
@@ -0,0 +1,362 @@
+/*-
+ * Copyright (c) 2015
+ * The Regents of the University of California. All rights reserved.
+ * Michael Tuexen. 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/sctp.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+static struct sctpstat curstat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 SCTP Associations SCTP Packets
+01999999999999 associations initiated 999999999999 packets sent
+02999999999999 associations accepted 999999999999 packets received
+03999999999999 associations established 999999999999 - out of the blue
+04999999999999 associations restarted 999999999999 - bad vtag
+05999999999999 associations terminated 999999999999 - bad crc32c
+06999999999999 associations aborted
+07
+08 SCTP Timers SCTP Chunks
+09999999999999 init timeouts 999999999999 control chunks sent
+10999999999999 cookie timeouts 999999999999 data chunks sent
+11999999999999 data timeouts 999999999999 - ordered
+12999999999999 delayed sack timeouts 999999999999 - unordered
+13999999999999 shutdown timeouts 999999999999 control chunks received
+14999999999999 shutdown-ack timeouts 999999999999 data chunks received
+15999999999999 shutdown guard timeouts 999999999999 - ordered
+16999999999999 heartbeat timeouts 999999999999 - unordered
+17999999999999 path MTU timeouts
+18999999999999 autoclose timeouts SCTP user messages
+19999999999999 asconf timeouts 999999999999 fragmented
+20999999999999 stream reset timeouts 999999999999 reassembled
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+opensctp(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closesctp(WINDOW *w)
+{
+ if (w != NULL) {
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+ }
+}
+
+void
+labelsctp(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 13, str)
+#define R(row, str) mvwprintw(wnd, row, 51, str);
+ L(0, "SCTP Associations"); R(0, "SCTP Packets");
+ L(1, "associations initiated"); R(1, "packets sent");
+ L(2, "associations accepted"); R(2, "packets received");
+ L(3, "associations established"); R(3, "- out of the blue");
+ L(4, "associations restarted"); R(4, "- bad vtag");
+ L(5, "associations terminated"); R(5, "- bad crc32c");
+ L(6, "associations aborted");
+
+ L(8, "SCTP Timers"); R(8, "SCTP Chunks");
+ L(9, "init timeouts"); R(9, "control chunks sent");
+ L(10, "cookie timeouts"); R(10, "data chunks sent");
+ L(11, "data timeouts"); R(11, "- ordered");
+ L(12, "delayed sack timeouts"); R(12, "- unordered");
+ L(13, "shutdown timeouts"); R(13, "control chunks received");
+ L(14, "shutdown-ack timeouts"); R(14, "data chunks received");
+ L(15, "shutdown guard timeouts"); R(15, "- ordered");
+ L(16, "heartbeat timeouts"); R(16, "- unordered");
+ L(17, "path MTU timeouts");
+ L(18, "autoclose timeouts"); R(18, "SCTP User Messages");
+ L(19, "asconf timeouts"); R(19, "fragmented");
+ L(20, "stream reset timeouts"); R(20, "reassembled");
+#undef L
+#undef R
+}
+
+static void
+domode(struct sctpstat *ret)
+{
+ const struct sctpstat *sub;
+ int divisor = 1;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = curstat;
+ return;
+ }
+#define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
+ DO(sctps_currestab);
+ DO(sctps_activeestab);
+ DO(sctps_restartestab);
+ DO(sctps_collisionestab);
+ DO(sctps_passiveestab);
+ DO(sctps_aborted);
+ DO(sctps_shutdown);
+ DO(sctps_outoftheblue);
+ DO(sctps_checksumerrors);
+ DO(sctps_outcontrolchunks);
+ DO(sctps_outorderchunks);
+ DO(sctps_outunorderchunks);
+ DO(sctps_incontrolchunks);
+ DO(sctps_inorderchunks);
+ DO(sctps_inunorderchunks);
+ DO(sctps_fragusrmsgs);
+ DO(sctps_reasmusrmsgs);
+ DO(sctps_outpackets);
+ DO(sctps_inpackets);
+
+ DO(sctps_recvpackets);
+ DO(sctps_recvdatagrams);
+ DO(sctps_recvpktwithdata);
+ DO(sctps_recvsacks);
+ DO(sctps_recvdata);
+ DO(sctps_recvdupdata);
+ DO(sctps_recvheartbeat);
+ DO(sctps_recvheartbeatack);
+ DO(sctps_recvecne);
+ DO(sctps_recvauth);
+ DO(sctps_recvauthmissing);
+ DO(sctps_recvivalhmacid);
+ DO(sctps_recvivalkeyid);
+ DO(sctps_recvauthfailed);
+ DO(sctps_recvexpress);
+ DO(sctps_recvexpressm);
+ DO(sctps_recvnocrc);
+ DO(sctps_recvswcrc);
+ DO(sctps_recvhwcrc);
+
+ DO(sctps_sendpackets);
+ DO(sctps_sendsacks);
+ DO(sctps_senddata);
+ DO(sctps_sendretransdata);
+ DO(sctps_sendfastretrans);
+ DO(sctps_sendmultfastretrans);
+ DO(sctps_sendheartbeat);
+ DO(sctps_sendecne);
+ DO(sctps_sendauth);
+ DO(sctps_senderrors);
+ DO(sctps_sendnocrc);
+ DO(sctps_sendswcrc);
+ DO(sctps_sendhwcrc);
+
+ DO(sctps_pdrpfmbox);
+ DO(sctps_pdrpfehos);
+ DO(sctps_pdrpmbda);
+ DO(sctps_pdrpmbct);
+ DO(sctps_pdrpbwrpt);
+ DO(sctps_pdrpcrupt);
+ DO(sctps_pdrpnedat);
+ DO(sctps_pdrppdbrk);
+ DO(sctps_pdrptsnnf);
+ DO(sctps_pdrpdnfnd);
+ DO(sctps_pdrpdiwnp);
+ DO(sctps_pdrpdizrw);
+ DO(sctps_pdrpbadd);
+ DO(sctps_pdrpmark);
+
+ DO(sctps_timoiterator);
+ DO(sctps_timodata);
+ DO(sctps_timowindowprobe);
+ DO(sctps_timoinit);
+ DO(sctps_timosack);
+ DO(sctps_timoshutdown);
+ DO(sctps_timoheartbeat);
+ DO(sctps_timocookie);
+ DO(sctps_timosecret);
+ DO(sctps_timopathmtu);
+ DO(sctps_timoshutdownack);
+ DO(sctps_timoshutdownguard);
+ DO(sctps_timostrmrst);
+ DO(sctps_timoearlyfr);
+ DO(sctps_timoasconf);
+ DO(sctps_timodelprim);
+ DO(sctps_timoautoclose);
+ DO(sctps_timoassockill);
+ DO(sctps_timoinpkill);
+
+ DO(sctps_hdrops);
+ DO(sctps_badsum);
+ DO(sctps_noport);
+ DO(sctps_badvtag);
+ DO(sctps_badsid);
+ DO(sctps_nomem);
+ DO(sctps_fastretransinrtt);
+ DO(sctps_markedretrans);
+ DO(sctps_naglesent);
+ DO(sctps_naglequeued);
+ DO(sctps_maxburstqueued);
+ DO(sctps_ifnomemqueued);
+ DO(sctps_windowprobed);
+ DO(sctps_lowlevelerr);
+ DO(sctps_lowlevelerrusr);
+ DO(sctps_datadropchklmt);
+ DO(sctps_datadroprwnd);
+ DO(sctps_ecnereducedcwnd);
+ DO(sctps_vtagexpress);
+ DO(sctps_vtagbogus);
+ DO(sctps_primary_randry);
+ DO(sctps_cmt_randry);
+ DO(sctps_slowpath_sack);
+ DO(sctps_wu_sacks_sent);
+ DO(sctps_sends_with_flags);
+ DO(sctps_sends_with_unord);
+ DO(sctps_sends_with_eof);
+ DO(sctps_sends_with_abort);
+ DO(sctps_protocol_drain_calls);
+ DO(sctps_protocol_drains_done);
+ DO(sctps_read_peeks);
+ DO(sctps_cached_chk);
+ DO(sctps_cached_strmoq);
+ DO(sctps_left_abandon);
+ DO(sctps_send_burst_avoid);
+ DO(sctps_send_cwnd_avoid);
+ DO(sctps_fwdtsn_map_over);
+ DO(sctps_queue_upd_ecne);
+#undef DO
+}
+
+void
+showsctp(void)
+{
+ struct sctpstat stats;
+
+ memset(&stats, 0, sizeof stats);
+ domode(&stats);
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%12lu", stats.stat)
+#define L(row, stat) DO(stat, row, 0)
+#define R(row, stat) DO(stat, row, 38)
+ L(1, sctps_activeestab); R(1, sctps_outpackets);
+ L(2, sctps_passiveestab); R(2, sctps_inpackets);
+ L(3, sctps_currestab); R(3, sctps_outoftheblue);
+ L(4, sctps_restartestab); R(4, sctps_badvtag);
+ L(5, sctps_shutdown); R(5, sctps_checksumerrors);
+ L(6, sctps_aborted);
+
+
+ L(9, sctps_timoinit); R(9, sctps_outcontrolchunks);
+ L(10, sctps_timocookie); R(10, sctps_senddata);
+ L(11, sctps_timodata); R(11, sctps_outorderchunks);
+ L(12, sctps_timosack); R(12, sctps_outunorderchunks);
+ L(13, sctps_timoshutdown); R(13, sctps_incontrolchunks);
+ L(14, sctps_timoshutdownack); R(14, sctps_recvdata);
+ L(15, sctps_timoshutdownguard); R(15, sctps_inorderchunks);
+ L(16, sctps_timoheartbeat); R(16, sctps_inunorderchunks);
+ L(17, sctps_timopathmtu);
+ L(18, sctps_timoautoclose);
+ L(19, sctps_timoasconf); R(19, sctps_fragusrmsgs);
+ L(20, sctps_timostrmrst); R(20, sctps_reasmusrmsgs);
+#undef DO
+#undef L
+#undef R
+}
+
+int
+initsctp(void)
+{
+ size_t len;
+ const char *name = "net.inet.sctp.stats";
+
+ len = 0;
+ if (sysctlbyname(name, NULL, &len, NULL, 0) < 0) {
+ error("sysctl getting sctpstat size failed");
+ return 0;
+ }
+ if (len > sizeof curstat) {
+ error("sctpstat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctlbyname(name, &initstat, &len, NULL, 0) < 0) {
+ error("sysctl getting sctpstat failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+resetsctp(void)
+{
+ size_t len;
+ const char *name = "net.inet.sctp.stats";
+
+ len = sizeof initstat;
+ if (sysctlbyname(name, &initstat, &len, NULL, 0) < 0) {
+ error("sysctl getting sctpstat failed");
+ }
+ oldstat = initstat;
+}
+
+void
+fetchsctp(void)
+{
+ size_t len;
+ const char *name = "net.inet.sctp.stats";
+
+ oldstat = curstat;
+ len = sizeof curstat;
+ if (sysctlbyname(name, &curstat, &len, NULL, 0) < 0) {
+ error("sysctl getting sctpstat failed");
+ }
+ return;
+}
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
new file mode 100644
index 0000000..799dff95
--- /dev/null
+++ b/usr.bin/systat/swap.c
@@ -0,0 +1,218 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95";
+#endif
+
+/*
+ * swapinfo - based on a program of the same name by Kevin Lahey
+ */
+
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+
+#include <kvm.h>
+#include <nlist.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <err.h>
+
+#include "systat.h"
+#include "extern.h"
+
+kvm_t *kd;
+
+static char *header;
+static long blocksize;
+static int dlen, odlen;
+static int hlen;
+static int ulen, oulen;
+static int pagesize;
+
+WINDOW *
+openswap(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closeswap(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+/*
+ * The meat of all the swap stuff is stolen from pstat(8)'s
+ * swapmode(), which is based on a program called swapinfo written by
+ * Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+
+#define NSWAP 16
+
+static struct kvm_swap kvmsw[NSWAP];
+static int kvnsw, okvnsw;
+
+static void calclens(void);
+
+#define CONVERT(v) ((int)((int64_t)(v) * pagesize / blocksize))
+
+static void
+calclens(void)
+{
+ int i, n;
+ int len;
+
+ dlen = sizeof("Disk");
+ for (i = 0; i < kvnsw; ++i) {
+ len = strlen(kvmsw[i].ksw_devname);
+ if (dlen < len)
+ dlen = len;
+ }
+
+ ulen = sizeof("Used");
+ for (n = CONVERT(kvmsw[kvnsw].ksw_used), len = 2; n /= 10; ++len);
+ if (ulen < len)
+ ulen = len;
+}
+
+int
+initswap(void)
+{
+ static int once = 0;
+
+ if (once)
+ return (1);
+
+ header = getbsize(&hlen, &blocksize);
+ pagesize = getpagesize();
+
+ if ((kvnsw = kvm_getswapinfo(kd, kvmsw, NSWAP, 0)) < 0) {
+ error("systat: kvm_getswapinfo failed");
+ return (0);
+ }
+ okvnsw = kvnsw;
+
+ calclens();
+ odlen = dlen;
+ oulen = ulen;
+
+ once = 1;
+ return (1);
+}
+
+void
+fetchswap(void)
+{
+
+ okvnsw = kvnsw;
+ if ((kvnsw = kvm_getswapinfo(kd, kvmsw, NSWAP, 0)) < 0) {
+ error("systat: kvm_getswapinfo failed");
+ return;
+ }
+
+ odlen = dlen;
+ oulen = ulen;
+ calclens();
+}
+
+void
+labelswap(void)
+{
+ const char *name;
+ int i;
+
+ fetchswap();
+
+ werase(wnd);
+
+ mvwprintw(wnd, 0, 0, "%*s%*s%*s %s",
+ -dlen, "Disk", hlen, header, ulen, "Used",
+ "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
+
+ for (i = 0; i <= kvnsw; ++i) {
+ if (i == kvnsw) {
+ if (kvnsw == 1)
+ break;
+ name = "Total";
+ } else
+ name = kvmsw[i].ksw_devname;
+ mvwprintw(wnd, i + 1, 0, "%*s", -dlen, name);
+ }
+}
+
+void
+showswap(void)
+{
+ int count;
+ int i;
+
+ if (kvnsw != okvnsw || dlen != odlen || ulen != oulen)
+ labelswap();
+
+ for (i = 0; i <= kvnsw; ++i) {
+ if (i == kvnsw) {
+ if (kvnsw == 1)
+ break;
+ }
+
+ if (kvmsw[i].ksw_total == 0) {
+ mvwprintw(
+ wnd,
+ i + 1,
+ dlen + hlen + ulen + 1,
+ "(swap not configured)"
+ );
+ continue;
+ }
+
+ wmove(wnd, i + 1, dlen);
+
+ wprintw(wnd, "%*d", hlen, CONVERT(kvmsw[i].ksw_total));
+ wprintw(wnd, "%*d", ulen, CONVERT(kvmsw[i].ksw_used));
+
+ count = 50.0 * kvmsw[i].ksw_used / kvmsw[i].ksw_total + 1;
+
+ waddch(wnd, ' ');
+ while (count--)
+ waddch(wnd, 'X');
+ wclrtoeol(wnd);
+ }
+}
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
new file mode 100644
index 0000000..f66de64
--- /dev/null
+++ b/usr.bin/systat/systat.1
@@ -0,0 +1,683 @@
+.\" Copyright (c) 1985, 1990, 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.
+.\"
+.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd October 24, 2015
+.Dt SYSTAT 1
+.Os
+.Sh NAME
+.Nm systat
+.Nd display system statistics
+.Sh SYNOPSIS
+.Nm
+.Op Fl display
+.Op Ar display-commands
+.Op Ar refresh-interval
+.Sh DESCRIPTION
+The
+.Nm
+utility displays various system statistics in a screen oriented fashion
+using the curses screen display library,
+.Xr ncurses 3 .
+.Pp
+While
+.Nm
+is running the screen is usually divided into two windows (an exception
+is the vmstat display which uses the entire screen).
+The
+upper window depicts the current system load average.
+The
+information displayed in the lower window may vary, depending on
+user commands.
+The last line on the screen is reserved for user
+input and error messages.
+.Pp
+By default
+.Nm
+displays the processes getting the largest percentage of the processor
+in the lower window.
+Other displays show swap space usage, disk
+.Tn I/O
+statistics (a la
+.Xr iostat 8 ) ,
+virtual memory statistics (a la
+.Xr vmstat 8 ) ,
+.Tn TCP/IP
+statistics,
+and network connections (a la
+.Xr netstat 1 ) .
+.Pp
+Input is interpreted at two different levels.
+A ``global'' command interpreter processes all keyboard input.
+If this command interpreter fails to recognize a command, the
+input line is passed to a per-display command interpreter.
+This
+allows each display to have certain display-specific commands.
+.Pp
+Command line options:
+.Bl -tag -width "refresh_interval"
+.It Fl Ns Ar display
+The
+.Fl
+flag expects
+.Ar display
+to be one of:
+.Ic icmp ,
+.Ic icmp6 ,
+.Ic ifstat ,
+.Ic iostat ,
+.Ic ip ,
+.Ic ip6 ,
+.Ic netstat ,
+.Ic pigs ,
+.Ic sctp ,
+.Ic swap ,
+.Ic tcp ,
+.Ic vmstat ,
+or
+.Ic zarc ,
+These displays can also be requested interactively (without the
+.Dq Fl )
+and are described in
+full detail below.
+.It Ar refresh-interval
+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
+.Nm .
+These are
+.Bl -tag -width Fl
+.It Ic \&^L
+Refresh the screen.
+.It Ic \&^G
+Print the name of the current ``display'' being shown in
+the lower window and the refresh interval.
+.It Ic \&:
+Move the cursor to the command line and interpret the input
+line typed as a command.
+While entering a command the
+current character erase, word erase, and line kill characters
+may be used.
+.El
+.Pp
+The following commands are interpreted by the ``global''
+command interpreter.
+.Bl -tag -width Fl
+.It Ic help
+Print the names of the available displays on the command line.
+.It Ic load
+Print the load average over the past 1, 5, and 15 minutes
+on the command line.
+.It Ic stop
+Stop refreshing the screen.
+.It Xo
+.Op Ic start
+.Op Ar number
+.Xc
+Start (continue) refreshing the screen.
+If a second, numeric,
+argument is provided it is interpreted as a refresh interval
+(in seconds).
+Supplying only a number will set the refresh interval to this
+value.
+.It Ic quit
+Exit
+.Nm .
+(This may be abbreviated to
+.Ic q . )
+.El
+.Pp
+The available displays are:
+.Bl -tag -width Ic
+.It Ic pigs
+Display, in the lower window, those processes resident in main
+memory and getting the
+largest portion of the processor (the default display).
+When less than 100% of the
+processor is scheduled to user processes, the remaining time
+is accounted to the ``idle'' process.
+.It Ic icmp
+Display, in the lower window, statistics about messages received and
+transmitted by the Internet Control Message Protocol
+.Pq Dq Tn ICMP .
+The left half of the screen displays information about received
+packets, and the right half displays information regarding transmitted
+packets.
+.Pp
+The
+.Ic icmp
+display understands two commands:
+.Ic mode
+and
+.Ic reset .
+The
+.Ic mode
+command is used to select one of four display modes, given as its argument:
+.Bl -tag -width absoluteXX -compact
+.It Ic rate :
+show the rate of change of each value in packets (the default)
+per second
+.It Ic delta :
+show the rate of change of each value in packets per refresh interval
+.It Ic since :
+show the total change of each value since the display was last reset
+.It Ic absolute :
+show the absolute value of each statistic
+.El
+.Pp
+The
+.Ic reset
+command resets the baseline for
+.Ic since
+mode.
+The
+.Ic mode
+command with no argument will display the current mode in the command
+line.
+.It Ic icmp6
+This display is like the
+.Ic icmp
+display,
+but displays statistics for IPv6 ICMP.
+.It Ic ip
+Otherwise identical to the
+.Ic icmp
+display, except that it displays
+.Tn IP
+and
+.Tn UDP
+statistics.
+.It Ic ip6
+Like the
+.Ic ip
+display,
+except that it displays
+.Tn IPv6
+statistics.
+It does not display
+.Tn UDP statistics.
+.It Ic sctp
+Like
+.Ic icmp ,
+but with
+.Tn SCTP
+statistics.
+.It Ic tcp
+Like
+.Ic icmp ,
+but with
+.Tn TCP
+statistics.
+.It Ic iostat
+Display, in the lower window, statistics about processor use
+and disk throughput.
+Statistics on processor use appear as
+bar graphs of the amount of time executing in user mode (``user''),
+in user mode running low priority processes (``nice''), in
+system mode (``system''), in interrupt mode (``interrupt''),
+and idle (``idle'').
+Statistics
+on disk throughput show, for each drive, megabytes per second,
+average number of disk transactions per second, and
+average kilobytes of data per transaction.
+This information may be
+displayed as bar graphs or as rows of numbers which scroll downward.
+Bar
+graphs are shown by default.
+.Pp
+The following commands are specific to the
+.Ic iostat
+display; the minimum unambiguous prefix may be supplied.
+.Pp
+.Bl -tag -width Fl -compact
+.It Cm numbers
+Show the disk
+.Tn I/O
+statistics in numeric form.
+Values are
+displayed in numeric columns which scroll downward.
+.It Cm bars
+Show the disk
+.Tn I/O
+statistics in bar graph form (default).
+.It Cm kbpt
+Toggle the display of kilobytes per transaction.
+(the default is to
+not display kilobytes per transaction).
+.El
+.It Ic swap
+Show information about swap space usage on all the
+swap areas compiled into the kernel.
+The first column is the device name of the partition.
+The next column is the total space available in the partition.
+The
+.Ar Used
+column indicates the total blocks used so far;
+the graph shows the percentage of space in use on each partition.
+If there are more than one swap partition in use,
+a total line is also shown.
+Areas known to the kernel, but not in use are shown as not available.
+.It Ic vmstat
+Take over the entire display and show a (rather crowded) compendium
+of statistics related to virtual memory usage, process scheduling,
+device interrupts, system name translation caching, disk
+.Tn I/O
+etc.
+.Pp
+The upper left quadrant of the screen shows the number
+of users logged in and the load average over the last one, five,
+and fifteen minute intervals.
+Below this line are statistics on memory utilization.
+The first row of the table reports memory usage only among
+active processes, that is processes that have run in the previous
+twenty seconds.
+The second row reports on memory usage of all processes.
+The first column reports on the number of kilobytes in physical pages
+claimed by processes.
+The second column reports the number of kilobytes in physical pages that
+are devoted to read only text pages.
+The third and fourth columns report the same two figures for
+virtual pages, that is the number of kilobytes in pages that would be
+needed if all processes had all of their pages.
+Finally the last column shows the number of kilobytes in physical pages
+on the free list.
+.Pp
+Below the memory display is a list of the
+average number of processes (over the last refresh interval)
+that are runnable (`r'), in page wait (`p'),
+in disk wait other than paging (`d'),
+sleeping (`s'), and swapped out but desiring to run (`w').
+The row also shows the average number of context switches
+(`Csw'), traps (`Trp'; includes page faults), system calls (`Sys'),
+interrupts (`Int'), network software interrupts (`Sof'), and page
+faults (`Flt').
+.Pp
+Below the process queue length listing is a numerical listing and
+a bar graph showing the amount of
+system (shown as `='), interrupt (shown as `+'), user (shown as `>'),
+nice (shown as `-'), and idle time (shown as ` ').
+.Pp
+Below the process display are statistics on name translations.
+It lists the number of names translated in the previous interval,
+the number and percentage of the translations that were
+handled by the system wide name translation cache, and
+the number and percentage of the translations that were
+handled by the per process name translation cache.
+.Pp
+To the right of the name translations display are lines showing
+the number of dirty buffers in the buffer cache (`dtbuf'),
+desired maximum size of vnode cache (`desvn'),
+number of vnodes actually allocated (`numvn'),
+and
+number of allocated vnodes that are free (`frevn').
+.Pp
+At the bottom left is the disk usage display.
+It reports the number of
+kilobytes per transaction, transactions per second, megabytes
+per second and the percentage of the time the disk was busy averaged
+over the refresh period of the display (by default, five seconds).
+The system keeps statistics on most every storage device.
+In general, up
+to seven devices are displayed.
+The devices displayed by default are the
+first devices in the kernel's device list.
+See
+.Xr devstat 3
+and
+.Xr devstat 9
+for details on the devstat system.
+.Pp
+Under the date in the upper right hand quadrant are statistics
+on paging and swapping activity.
+The first two columns report the average number of pages
+brought in and out per second over the last refresh interval
+due to page faults and the paging daemon.
+The third and fourth columns report the average number of pages
+brought in and out per second over the last refresh interval
+due to swap requests initiated by the scheduler.
+The first row of the display shows the average
+number of disk transfers per second over the last refresh interval;
+the second row of the display shows the average
+number of pages transferred per second over the last refresh interval.
+.Pp
+Below the paging statistics is a column of lines regarding the virtual
+memory system.
+The first few lines describe,
+in units (except as noted below)
+of pages per second averaged over the sampling interval,
+pages copied on write (`cow'),
+pages zero filled on demand (`zfod'),
+pages optimally zero filled on demand (`ozfod'),
+the ratio of the (average) ozfod / zfod as a percentage (`%ozfod'),
+pages freed by the page daemon (`daefr'),
+pages freed by exiting processes (`prcfr'),
+total pages freed (`totfr'),
+pages reactivated from the free list (`react'),
+the average number of
+times per second that the page daemon was awakened (`pdwak'),
+pages analyzed by the page daemon (`pdpgs'),
+and
+in-transit blocking page faults (`intrn').
+Note that the units are special for `%ozfod' and `pdwak'.
+The next few lines describe,
+as amounts of memory in kilobytes,
+pages wired down (`wire'),
+active pages (`act'),
+inactive pages (`inact'),
+pages on the cache queue (`cache'),
+and
+free pages (`free').
+Note that the values displayed are the current transient ones;
+they are not averages.
+.Pp
+At the bottom of this column is a line showing the
+amount of virtual memory, in kilobytes, mapped into the buffer cache (`buf').
+This statistic is not useful.
+It exists only as a placeholder for the corresponding useful statistic
+(the amount of real memory used to cache disks).
+The most important component of the latter (the amount of real memory
+used by the vm system to cache disks) is not available,
+but can be guessed from the `inact' amount under some system loads.
+.Pp
+Running down the right hand side of the display is a breakdown
+of the interrupts being handled by the system.
+At the top of the list is the total interrupts per second
+over the time interval.
+The rest of the column breaks down the total on a device
+by device basis.
+Only devices that have interrupted at least once since boot time are shown.
+.Pp
+The following commands are specific to the
+.Ic vmstat
+display; the minimum unambiguous prefix may be supplied.
+.Pp
+.Bl -tag -width Ar -compact
+.It Cm boot
+Display cumulative statistics since the system was booted.
+.It Cm run
+Display statistics as a running total from the point this
+command is given.
+.It Cm time
+Display statistics averaged over the refresh interval (the default).
+.It Cm zero
+Reset running statistics to zero.
+.El
+.It Ic zarc
+display arc cache usage and hit/miss statistics.
+.It Ic netstat
+Display, in the lower window, network connections.
+By default,
+network servers awaiting requests are not displayed.
+Each address
+is displayed in the format ``host.port'', with each shown symbolically,
+when possible.
+It is possible to have addresses displayed numerically,
+limit the display to a set of ports, hosts, and/or protocols
+(the minimum unambiguous prefix may be supplied):
+.Pp
+.Bl -tag -width Ar -compact
+.It Cm all
+Toggle the displaying of server processes awaiting requests (this
+is the equivalent of the
+.Fl a
+flag to
+.Xr netstat 1 ) .
+.It Cm numbers
+Display network addresses numerically.
+.It Cm names
+Display network addresses symbolically.
+.It Cm proto Ar protocol
+Display only network connections using the indicated
+.Ar protocol .
+Supported protocols are ``tcp'', ``udp'', and ``all''.
+.It Cm ignore Op Ar items
+Do not display information about connections associated with
+the specified hosts or ports.
+Hosts and ports may be specified
+by name (``vangogh'', ``ftp''), or numerically.
+Host addresses
+use the Internet dot notation (``128.32.0.9'').
+Multiple items
+may be specified with a single command by separating them with
+spaces.
+.It Cm display Op Ar items
+Display information about the connections associated with the
+specified hosts or ports.
+As for
+.Ar ignore ,
+.Op Ar items
+may be names or numbers.
+.It Cm show Op Ar ports\&|hosts
+Show, on the command line, the currently selected protocols,
+hosts, and ports.
+Hosts and ports which are being ignored
+are prefixed with a `!'.
+If
+.Ar ports
+or
+.Ar hosts
+is supplied as an argument to
+.Cm show ,
+then only the requested information will be displayed.
+.It Cm reset
+Reset the port, host, and protocol matching mechanisms to the default
+(any protocol, port, or host).
+.El
+.It Ic ifstat
+Display the network traffic going through active interfaces on the
+system.
+Idle interfaces will not be displayed until they receive some
+traffic.
+.Pp
+For each interface being displayed, the current, peak and total
+statistics are displayed for incoming and outgoing traffic.
+By default,
+the
+.Ic ifstat
+display will automatically scale the units being used so that they are
+in a human-readable format.
+The scaling units used for the current and
+peak
+traffic columns can be altered by the
+.Ic scale
+command.
+.Bl -tag -width ".Cm scale Op Ar units"
+.It Cm scale Op Ar units
+Modify the scale used to display the current and peak traffic over all
+interfaces.
+The following units are recognised: kbit, kbyte, mbit,
+mbyte, gbit, gbyte and auto.
+.It Cm pps
+Show statistics in packets per second instead of bytes/bits per second.
+A subsequent call of
+.Ic pps
+switches this mode off.
+.It Cm match Op Ar patterns
+Display only interfaces that match pattern provided as an argument.
+Patterns should be in shell syntax separated by whitespaces or commas.
+If this command is called without arguments then all interfaces are displayed.
+For example:
+.Pp
+.Dl match em0, bge1
+.Pp
+This will display em0 and bge1 interfaces.
+.Pp
+.Dl match em*, bge*, lo0
+.Pp
+This will display all
+.Ic em
+interfaces, all
+.Ic bge
+interfaces and the loopback interface.
+.El
+.El
+.Pp
+Commands to switch between displays may be abbreviated to the
+minimum unambiguous prefix; for example, ``io'' for ``iostat''.
+Certain information may be discarded when the screen size is
+insufficient for display.
+For example, on a machine with 10
+drives the
+.Ic iostat
+bar graph displays only 3 drives on a 24 line terminal.
+When
+a bar graph would overflow the allotted screen space it is
+truncated and the actual value is printed ``over top'' of the bar.
+.Pp
+The following commands are common to each display which shows
+information about disk drives.
+These commands are used to
+select a set of drives to report on, should your system have
+more drives configured than can normally be displayed on the
+screen.
+.Pp
+.Bl -tag -width Ar -compact
+.It Cm ignore Op Ar drives
+Do not display information about the drives indicated.
+Multiple
+drives may be specified, separated by spaces.
+.It Cm display Op Ar drives
+Display information about the drives indicated.
+Multiple drives
+may be specified, separated by spaces.
+.It Cm only Op Ar drives
+Display only the specified drives.
+Multiple drives may be specified,
+separated by spaces.
+.It Cm drives
+Display a list of available devices.
+.It Cm match Xo
+.Ar type , Ns Ar if , Ns Ar pass
+.Op | Ar ...
+.Xc
+Display devices matching the given pattern.
+The basic matching
+expressions are the same as those used in
+.Xr iostat 8
+with one difference.
+Instead of specifying multiple
+.Fl t
+arguments which are then ORed together, the user instead specifies multiple
+matching expressions joined by the pipe
+.Pq Ql \&|
+character.
+The comma
+separated arguments within each matching expression are ANDed together, and
+then the pipe separated matching expressions are ORed together.
+Any
+device matching the combined expression will be displayed, if there is room
+to display it.
+For example:
+.Pp
+.Dl match da,scsi | cd,ide
+.Pp
+This will display all SCSI Direct Access devices and all IDE CDROM devices.
+.Pp
+.Dl match da | sa | cd,pass
+.Pp
+This will display all Direct Access devices, all Sequential Access devices,
+and all passthrough devices that provide access to CDROM drives.
+.El
+.Sh FILES
+.Bl -tag -width /boot/kernel/kernel -compact
+.It Pa /boot/kernel/kernel
+For the namelist.
+.It Pa /dev/kmem
+For information in main memory.
+.It Pa /etc/hosts
+For host names.
+.It Pa /etc/networks
+For network names.
+.It Pa /etc/services
+For port names.
+.El
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr kvm 3 ,
+.Xr icmp 4 ,
+.Xr icmp6 4 ,
+.Xr ip 4 ,
+.Xr ip6 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr gstat 8 ,
+.Xr iostat 8 ,
+.Xr vmstat 8
+.Sh HISTORY
+The
+.Nm
+program appeared in
+.Bx 4.3 .
+The
+.Ic icmp ,
+.Ic ip ,
+and
+.Ic tcp
+displays appeared in
+.Fx 3.0 ;
+the notion of having different display modes for the
+.Tn ICMP ,
+.Tn IP ,
+.Tn TCP ,
+and
+.Tn UDP
+statistics was stolen from the
+.Fl C
+option to
+.Xr netstat 1
+in Silicon Graphics'
+.Tn IRIX
+system.
+.Sh BUGS
+Certain displays presume a minimum of 80 characters per line.
+The
+.Ic vmstat
+display looks out of place because it is (it was added in as
+a separate display rather than created as a new program).
diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h
new file mode 100644
index 0000000..ebd409e
--- /dev/null
+++ b/usr.bin/systat/systat.h
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 1980, 1989, 1992, 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.
+ *
+ * From: @(#)systat.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <curses.h>
+
+struct cmdtab {
+ const char *c_name; /* command name */
+ void (*c_refresh)(void); /* display refresh */
+ void (*c_fetch)(void); /* sets up data structures */
+ void (*c_label)(void); /* label display */
+ int (*c_init)(void); /* initialize namelist, etc. */
+ WINDOW *(*c_open)(void); /* open display */
+ void (*c_close)(WINDOW *); /* close display */
+ int (*c_cmd)(const char *, const char *); /* display command interpreter */
+ void (*c_reset)(void); /* reset ``mode since'' display */
+ char c_flags; /* see below */
+};
+
+/*
+ * If we are started with privileges, use a kmem interface for netstat handling,
+ * otherwise use sysctl.
+ * In case of many open sockets, the sysctl handling might become slow.
+ */
+extern int use_kvm;
+
+#define CF_INIT 0x1 /* been initialized */
+#define CF_LOADAV 0x2 /* display w/ load average */
+#define CF_ZFSARC 0x4 /* display w/ ZFS cache usage */
+
+#define TCP 0x1
+#define UDP 0x2
+
+#define MAINWIN_ROW 3 /* top row for the main/lower window */
+
+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
+#define KREAD(addr, buf, len) kvm_ckread((addr), (buf), (len))
+#define NVAL(indx) namelist[(indx)].n_value
+#define NPTR(indx) (void *)NVAL((indx))
+#define NREAD(indx, buf, len) kvm_ckread(NPTR((indx)), (buf), (len))
diff --git a/usr.bin/systat/tcp.c b/usr.bin/systat/tcp.c
new file mode 100644
index 0000000..c9e8e9a
--- /dev/null
+++ b/usr.bin/systat/tcp.c
@@ -0,0 +1,326 @@
+/*-
+ * Copyright (c) 1980, 1992, 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.
+ */
+
+#if 0
+#ifndef lint
+/* From: */
+static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] =
+ "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_seq.h>
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+
+#include "systat.h"
+#include "extern.h"
+#include "mode.h"
+
+static struct tcpstat curstat, initstat, oldstat;
+
+/*-
+--0 1 2 3 4 5 6 7
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+00 TCP Connections TCP Packets
+01999999999999 connections initiated 999999999999 total packets sent
+02999999999999 connections accepted 999999999999 - data
+03999999999999 connections established 999999999999 - data (retransmit by dupack)
+04999999999999 connections dropped 999999999999 - data (retransmit by sack)
+05999999999999 - in embryonic state 999999999999 - ack-only
+06999999999999 - on retransmit timeout 999999999999 - window probes
+07999999999999 - by keepalive 999999999999 - window updates
+08999999999999 - from listen queue 999999999999 - urgent data only
+09 999999999999 - control
+10 999999999999 - resends by PMTU discovery
+11 TCP Timers 999999999999 total packets received
+12999999999999 potential rtt updates 999999999999 - in sequence
+13999999999999 - successful 999999999999 - completely duplicate
+14999999999999 delayed acks sent 999999999999 - with some duplicate data
+15999999999999 retransmit timeouts 999999999999 - out-of-order
+16999999999999 persist timeouts 999999999999 - duplicate acks
+17999999999999 keepalive probes 999999999999 - acks
+18999999999999 - timeouts 999999999999 - window probes
+19 999999999999 - window updates
+20 999999999999 - bad checksum
+--0123456789012345678901234567890123456789012345678901234567890123456789012345
+--0 1 2 3 4 5 6 7
+*/
+
+WINDOW *
+opentcp(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closetcp(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labeltcp(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+#define L(row, str) mvwprintw(wnd, row, 13, str)
+#define R(row, str) mvwprintw(wnd, row, 51, str);
+ L(0, "TCP Connections"); R(0, "TCP Packets");
+ L(1, "connections initiated"); R(1, "total packets sent");
+ L(2, "connections accepted"); R(2, "- data");
+ L(3, "connections established"); R(3, "- data (retransmit by dupack)");
+ L(4, "connections dropped"); R(4, "- data (retransmit by sack)");
+ L(5, "- in embryonic state"); R(5, "- ack-only");
+ L(6, "- on retransmit timeout"); R(6, "- window probes");
+ L(7, "- by keepalive"); R(7, "- window updates");
+ L(8, "- from listen queue"); R(8, "- urgent data only");
+ R(9, "- control");
+ R(10, "- resends by PMTU discovery");
+ L(11, "TCP Timers"); R(11, "total packets received");
+ L(12, "potential rtt updates"); R(12, "- in sequence");
+ L(13, "- successful"); R(13, "- completely duplicate");
+ L(14, "delayed acks sent"); R(14, "- with some duplicate data");
+ L(15, "retransmit timeouts"); R(15, "- out-of-order");
+ L(16, "persist timeouts"); R(16, "- duplicate acks");
+ L(17, "keepalive probes"); R(17, "- acks");
+ L(18, "- timeouts"); R(18, "- window probes");
+ R(19, "- window updates");
+ R(20, "- bad checksum");
+#undef L
+#undef R
+}
+
+static void
+domode(struct tcpstat *ret)
+{
+ const struct tcpstat *sub;
+ int divisor = 1;
+
+ switch(currentmode) {
+ case display_RATE:
+ sub = &oldstat;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
+ break;
+ case display_DELTA:
+ sub = &oldstat;
+ break;
+ case display_SINCE:
+ sub = &initstat;
+ break;
+ default:
+ *ret = curstat;
+ return;
+ }
+#define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
+ DO(tcps_connattempt);
+ DO(tcps_accepts);
+ DO(tcps_connects);
+ DO(tcps_drops);
+ DO(tcps_conndrops);
+ DO(tcps_closed);
+ DO(tcps_segstimed);
+ DO(tcps_rttupdated);
+ DO(tcps_delack);
+ DO(tcps_timeoutdrop);
+ DO(tcps_rexmttimeo);
+ DO(tcps_persisttimeo);
+ DO(tcps_keeptimeo);
+ DO(tcps_keepprobe);
+ DO(tcps_keepdrops);
+
+ DO(tcps_sndtotal);
+ DO(tcps_sndpack);
+ DO(tcps_sndbyte);
+ DO(tcps_sndrexmitpack);
+ DO(tcps_sack_rexmits);
+ DO(tcps_sndacks);
+ DO(tcps_sndprobe);
+ DO(tcps_sndurg);
+ DO(tcps_sndwinup);
+ DO(tcps_sndctrl);
+
+ DO(tcps_rcvtotal);
+ DO(tcps_rcvpack);
+ DO(tcps_rcvbyte);
+ DO(tcps_rcvbadsum);
+ DO(tcps_rcvbadoff);
+ DO(tcps_rcvshort);
+ DO(tcps_rcvduppack);
+ DO(tcps_rcvdupbyte);
+ DO(tcps_rcvpartduppack);
+ DO(tcps_rcvpartdupbyte);
+ DO(tcps_rcvoopack);
+ DO(tcps_rcvoobyte);
+ DO(tcps_rcvpackafterwin);
+ DO(tcps_rcvbyteafterwin);
+ DO(tcps_rcvafterclose);
+ DO(tcps_rcvwinprobe);
+ DO(tcps_rcvdupack);
+ DO(tcps_rcvacktoomuch);
+ DO(tcps_rcvackpack);
+ DO(tcps_rcvackbyte);
+ DO(tcps_rcvwinupd);
+ DO(tcps_pawsdrop);
+ DO(tcps_predack);
+ DO(tcps_preddat);
+ DO(tcps_pcbcachemiss);
+ DO(tcps_cachedrtt);
+ DO(tcps_cachedrttvar);
+ DO(tcps_cachedssthresh);
+ DO(tcps_usedrtt);
+ DO(tcps_usedrttvar);
+ DO(tcps_usedssthresh);
+ DO(tcps_persistdrop);
+ DO(tcps_badsyn);
+ DO(tcps_mturesent);
+ DO(tcps_listendrop);
+#undef DO
+}
+
+void
+showtcp(void)
+{
+ struct tcpstat stats;
+
+ memset(&stats, 0, sizeof stats);
+ domode(&stats);
+
+#define DO(stat, row, col) \
+ mvwprintw(wnd, row, col, "%12lu", stats.stat)
+#define L(row, stat) DO(stat, row, 0)
+#define R(row, stat) DO(stat, row, 38)
+ L(1, tcps_connattempt); R(1, tcps_sndtotal);
+ L(2, tcps_accepts); R(2, tcps_sndpack);
+ L(3, tcps_connects); R(3, tcps_sndrexmitpack);
+ L(4, tcps_drops); R(4, tcps_sack_rexmits);
+ L(5, tcps_conndrops); R(5, tcps_sndacks);
+ L(6, tcps_timeoutdrop); R(6, tcps_sndprobe);
+ L(7, tcps_keepdrops); R(7, tcps_sndwinup);
+ L(8, tcps_listendrop); R(8, tcps_sndurg);
+ R(9, tcps_sndctrl);
+ R(10, tcps_mturesent);
+ R(11, tcps_rcvtotal);
+ L(12, tcps_segstimed); R(12, tcps_rcvpack);
+ L(13, tcps_rttupdated); R(13, tcps_rcvduppack);
+ L(14, tcps_delack); R(14, tcps_rcvpartduppack);
+ L(15, tcps_rexmttimeo); R(15, tcps_rcvoopack);
+ L(16, tcps_persisttimeo); R(16, tcps_rcvdupack);
+ L(17, tcps_keepprobe); R(17, tcps_rcvackpack);
+ L(18, tcps_keeptimeo); R(18, tcps_rcvwinprobe);
+ R(19, tcps_rcvwinupd);
+ R(20, tcps_rcvbadsum);
+#undef DO
+#undef L
+#undef R
+}
+
+int
+inittcp(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_TCP;
+ name[3] = TCPCTL_STATS;
+
+ len = 0;
+ if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
+ error("sysctl getting tcpstat size failed");
+ return 0;
+ }
+ if (len > sizeof curstat) {
+ error("tcpstat structure has grown--recompile systat!");
+ return 0;
+ }
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting tcpstat failed");
+ return 0;
+ }
+ oldstat = initstat;
+ return 1;
+}
+
+void
+resettcp(void)
+{
+ size_t len;
+ int name[4];
+
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_TCP;
+ name[3] = TCPCTL_STATS;
+
+ len = sizeof initstat;
+ if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
+ error("sysctl getting tcpstat failed");
+ }
+ oldstat = initstat;
+}
+
+void
+fetchtcp(void)
+{
+ int name[4];
+ size_t len;
+
+ oldstat = curstat;
+ name[0] = CTL_NET;
+ name[1] = PF_INET;
+ name[2] = IPPROTO_TCP;
+ name[3] = TCPCTL_STATS;
+ len = sizeof curstat;
+
+ if (sysctl(name, 4, &curstat, &len, 0, 0) < 0)
+ return;
+}
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
new file mode 100644
index 0000000..ca8b6bc
--- /dev/null
+++ b/usr.bin/systat/vmstat.c
@@ -0,0 +1,896 @@
+/*-
+ * Copyright (c) 1983, 1989, 1992, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifdef lint
+static const char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
+#endif
+
+/*
+ * Cursed vmstat -- from Robert Elz.
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#include <vm/vm_param.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <nlist.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <devstat.h>
+#include "systat.h"
+#include "extern.h"
+#include "devs.h"
+
+static struct Info {
+ long time[CPUSTATES];
+ u_int v_swtch; /* context switches */
+ u_int v_trap; /* calls to trap */
+ u_int v_syscall; /* calls to syscall() */
+ u_int v_intr; /* device interrupts */
+ u_int v_soft; /* software interrupts */
+ /*
+ * Virtual memory activity.
+ */
+ u_int v_vm_faults; /* number of address memory faults */
+ u_int v_io_faults; /* page faults requiring I/O */
+ u_int v_cow_faults; /* number of copy-on-writes */
+ u_int v_zfod; /* pages zero filled on demand */
+ u_int v_ozfod; /* optimized zero fill pages */
+ u_int v_swapin; /* swap pager pageins */
+ u_int v_swapout; /* swap pager pageouts */
+ u_int v_swappgsin; /* swap pager pages paged in */
+ u_int v_swappgsout; /* swap pager pages paged out */
+ u_int v_vnodein; /* vnode pager pageins */
+ u_int v_vnodeout; /* vnode pager pageouts */
+ u_int v_vnodepgsin; /* vnode_pager pages paged in */
+ u_int v_vnodepgsout; /* vnode pager pages paged out */
+ u_int v_intrans; /* intransit blocking page faults */
+ u_int v_reactivated; /* number of pages reactivated from free list */
+ u_int v_pdwakeups; /* number of times daemon has awaken from sleep */
+ u_int v_pdpages; /* number of pages analyzed by daemon */
+
+ u_int v_dfree; /* pages freed by daemon */
+ u_int v_pfree; /* pages freed by exiting processes */
+ u_int v_tfree; /* total pages freed */
+ /*
+ * Distribution of page usages.
+ */
+ u_int v_page_size; /* page size in bytes */
+ u_int v_free_count; /* number of pages free */
+ u_int v_wire_count; /* number of pages wired down */
+ u_int v_active_count; /* number of pages active */
+ u_int v_inactive_count; /* number of pages inactive */
+ u_int v_cache_count; /* number of pages on buffer cache queue */
+ u_long v_kmem_map_size; /* Current kmem allocation size */
+ struct vmtotal Total;
+ struct nchstats nchstats;
+ long nchcount;
+ long *intrcnt;
+ long bufspace;
+ int desiredvnodes;
+ long numvnodes;
+ long freevnodes;
+ int numdirtybuffers;
+} s, s1, s2, z;
+static u_long kmem_size;
+static u_int v_page_count;
+
+struct statinfo cur, last, run;
+
+#define total s.Total
+#define nchtotal s.nchstats
+#define oldnchtotal s1.nchstats
+
+static enum state { BOOT, TIME, RUN } state = TIME;
+
+static void allocinfo(struct Info *);
+static void copyinfo(struct Info *, struct Info *);
+static float cputime(int);
+static void dinfo(int, int, struct statinfo *, struct statinfo *);
+static void getinfo(struct Info *);
+static void putint(int, int, int, int);
+static void putfloat(double, int, int, int, int, int);
+static void putlongdouble(long double, int, int, int, int, int);
+static int ucount(void);
+
+static int ncpu;
+static char buf[26];
+static time_t t;
+static double etime;
+static int nintr;
+static long *intrloc;
+static char **intrname;
+static int nextintsrow;
+
+WINDOW *
+openkre(void)
+{
+
+ return (stdscr);
+}
+
+void
+closekre(WINDOW *w)
+{
+
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+}
+
+/*
+ * These constants define where the major pieces are laid out
+ */
+#define STATROW 0 /* uses 1 row and 67 cols */
+#define STATCOL 0
+#define MEMROW 2 /* uses 4 rows and 45 cols */
+#define MEMCOL 0
+#define PAGEROW 2 /* uses 4 rows and 30 cols */
+#define PAGECOL 47
+#define INTSROW 6 /* uses all rows to bottom and 16 cols */
+#define INTSCOL 64
+#define PROCSROW 6 /* uses 3 rows and 19 cols */
+#define PROCSCOL 0
+#define GENSTATROW 7 /* uses 2 rows and 29 cols */
+#define GENSTATCOL 21
+#define VMSTATROW 7 /* uses 17 rows and 12-14 cols */
+#define VMSTATCOL 49 /* actually 50-51 for some fields */
+#define GRAPHROW 10 /* uses 3 rows and 49-51 cols */
+#define GRAPHCOL 0
+#define VNSTATROW 13 /* uses 4 rows and 13 columns */
+#define VNSTATCOL 35
+#define NAMEIROW 14 /* uses 3 rows and 32 cols */
+#define NAMEICOL 0
+#define DISKROW 18 /* uses 5 rows and 47 cols (for 7 drives) */
+#define DISKCOL 0
+
+#define DRIVESPACE 7 /* max # for space */
+
+#define MAXDRIVES DRIVESPACE /* max # to display */
+
+int
+initkre(void)
+{
+ char *cp, *cp1, *cp2, *intrnamebuf, *nextcp;
+ int i;
+ size_t sz;
+
+ if ((num_devices = devstat_getnumdevs(NULL)) < 0) {
+ warnx("%s", devstat_errbuf);
+ return(0);
+ }
+
+ cur.dinfo = calloc(1, sizeof(struct devinfo));
+ last.dinfo = calloc(1, sizeof(struct devinfo));
+ run.dinfo = calloc(1, sizeof(struct devinfo));
+
+ if (dsinit(MAXDRIVES, &cur, &last, &run) != 1)
+ return(0);
+
+ if (nintr == 0) {
+ if (sysctlbyname("hw.intrcnt", NULL, &sz, NULL, 0) == -1) {
+ error("sysctl(hw.intrcnt...) failed: %s",
+ strerror(errno));
+ return (0);
+ }
+ nintr = sz / sizeof(u_long);
+ intrloc = calloc(nintr, sizeof (long));
+ intrname = calloc(nintr, sizeof (char *));
+ intrnamebuf = sysctl_dynread("hw.intrnames", NULL);
+ if (intrnamebuf == NULL || intrname == NULL ||
+ intrloc == NULL) {
+ error("Out of memory");
+ if (intrnamebuf)
+ free(intrnamebuf);
+ if (intrname)
+ free(intrname);
+ if (intrloc)
+ free(intrloc);
+ nintr = 0;
+ return(0);
+ }
+ for (cp = intrnamebuf, i = 0; i < nintr; i++) {
+ nextcp = cp + strlen(cp) + 1;
+
+ /* Discard trailing spaces. */
+ for (cp1 = nextcp - 1; cp1 > cp && *(cp1 - 1) == ' '; )
+ *--cp1 = '\0';
+
+ /* Convert "irqN: name" to "name irqN". */
+ if (strncmp(cp, "irq", 3) == 0) {
+ cp1 = cp + 3;
+ while (isdigit((u_char)*cp1))
+ cp1++;
+ if (cp1 != cp && *cp1 == ':' &&
+ *(cp1 + 1) == ' ') {
+ sz = strlen(cp);
+ *cp1 = '\0';
+ cp1 = cp1 + 2;
+ cp2 = strdup(cp);
+ bcopy(cp1, cp, sz - (cp1 - cp) + 1);
+ if (sz <= 10 + 4) {
+ strcat(cp, " ");
+ strcat(cp, cp2 + 3);
+ }
+ free(cp2);
+ }
+ }
+
+ /*
+ * Convert "name irqN" to "name N" if the former is
+ * longer than the field width.
+ */
+ if ((cp1 = strstr(cp, "irq")) != NULL &&
+ strlen(cp) > 10)
+ bcopy(cp1 + 3, cp1, strlen(cp1 + 3) + 1);
+
+ intrname[i] = cp;
+ cp = nextcp;
+ }
+ nextintsrow = INTSROW + 2;
+ allocinfo(&s);
+ allocinfo(&s1);
+ allocinfo(&s2);
+ allocinfo(&z);
+ }
+ GETSYSCTL("vm.kmem_size", kmem_size);
+ GETSYSCTL("vm.stats.vm.v_page_count", v_page_count);
+ getinfo(&s2);
+ copyinfo(&s2, &s1);
+ return(1);
+}
+
+void
+fetchkre(void)
+{
+ time_t now;
+ struct tm *tp;
+ static int d_first = -1;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+
+ time(&now);
+ tp = localtime(&now);
+ (void) strftime(buf, sizeof(buf),
+ d_first ? "%e %b %R" : "%b %e %R", tp);
+ getinfo(&s);
+}
+
+void
+labelkre(void)
+{
+ int i, j;
+
+ clear();
+ mvprintw(STATROW, STATCOL + 6, "users Load");
+ mvprintw(STATROW + 1, STATCOL + 3, "Mem usage: %%Phy %%Kmem");
+ mvprintw(MEMROW, MEMCOL, "Mem: KB REAL VIRTUAL");
+ mvprintw(MEMROW + 1, MEMCOL, " Tot Share Tot Share");
+ mvprintw(MEMROW + 2, MEMCOL, "Act");
+ mvprintw(MEMROW + 3, MEMCOL, "All");
+
+ mvprintw(MEMROW + 1, MEMCOL + 41, "Free");
+
+ mvprintw(PAGEROW, PAGECOL, " VN PAGER SWAP PAGER");
+ mvprintw(PAGEROW + 1, PAGECOL, " in out in out");
+ mvprintw(PAGEROW + 2, PAGECOL, "count");
+ mvprintw(PAGEROW + 3, PAGECOL, "pages");
+
+ mvprintw(INTSROW, INTSCOL + 1, "Interrupts");
+ mvprintw(INTSROW + 1, INTSCOL + 6, "total");
+
+ mvprintw(VMSTATROW, VMSTATCOL + 9, "ioflt");
+ mvprintw(VMSTATROW + 1, VMSTATCOL + 9, "cow");
+ mvprintw(VMSTATROW + 2, VMSTATCOL + 9, "zfod");
+ mvprintw(VMSTATROW + 3, VMSTATCOL + 9, "ozfod");
+ mvprintw(VMSTATROW + 4, VMSTATCOL + 9 - 1, "%%ozfod");
+ mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "daefr");
+ mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "prcfr");
+ mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "totfr");
+ mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "react");
+ mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdwak");
+ mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "pdpgs");
+ mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "intrn");
+ mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "wire");
+ mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "act");
+ mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact");
+ mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "cache");
+ mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free");
+ if (LINES - 1 > VMSTATROW + 17)
+ mvprintw(VMSTATROW + 17, VMSTATCOL + 9, "buf");
+
+ mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt");
+
+ mvprintw(GRAPHROW, GRAPHCOL,
+ " . %%Sys . %%Intr . %%User . %%Nice . %%Idle");
+ mvprintw(PROCSROW, PROCSCOL, "Proc:");
+ mvprintw(PROCSROW + 1, PROCSCOL, " r p d s w");
+ mvprintw(GRAPHROW + 1, GRAPHCOL,
+ "| | | | | | | | | | |");
+
+ mvprintw(VNSTATROW, VNSTATCOL + 8, "dtbuf");
+ mvprintw(VNSTATROW + 1, VNSTATCOL + 8, "desvn");
+ mvprintw(VNSTATROW + 2, VNSTATCOL + 8, "numvn");
+ mvprintw(VNSTATROW + 3, VNSTATCOL + 8, "frevn");
+
+ mvprintw(NAMEIROW, NAMEICOL, "Namei Name-cache Dir-cache");
+ mvprintw(NAMEIROW + 1, NAMEICOL,
+ " Calls hits %% hits %%");
+ mvprintw(DISKROW, DISKCOL, "Disks");
+ mvprintw(DISKROW + 1, DISKCOL, "KB/t");
+ mvprintw(DISKROW + 2, DISKCOL, "tps");
+ mvprintw(DISKROW + 3, DISKCOL, "MB/s");
+ mvprintw(DISKROW + 4, DISKCOL, "%%busy");
+ /*
+ * For now, we don't support a fourth disk statistic. So there's
+ * no point in providing a label for it. If someone can think of a
+ * fourth useful disk statistic, there is room to add it.
+ */
+ /* mvprintw(DISKROW + 4, DISKCOL, " msps"); */
+ j = 0;
+ for (i = 0; i < num_devices && j < MAXDRIVES; i++)
+ if (dev_select[i].selected) {
+ char tmpstr[80];
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvprintw(DISKROW, DISKCOL + 5 + 6 * j,
+ " %5.5s", tmpstr);
+ j++;
+ }
+
+ for (i = 0; i < nintr; i++) {
+ if (intrloc[i] == 0)
+ continue;
+ mvprintw(intrloc[i], INTSCOL + 6, "%-10.10s", intrname[i]);
+ }
+}
+
+#define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;}
+#define Q(fld) {t=cur.fld[i]; cur.fld[i]-=last.fld[i]; if(state==TIME) last.fld[i]=t;}
+#define Y(fld) {t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;}
+#define Z(fld) {t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \
+ if(state == TIME) s1.nchstats.fld = t;}
+#define PUTRATE(fld, l, c, w) \
+do { \
+ Y(fld); \
+ putint((int)((float)s.fld/etime + 0.5), l, c, w); \
+} while (0)
+#define MAXFAIL 5
+
+static char cpuchar[CPUSTATES] = { '=' , '+', '>', '-', ' ' };
+static char cpuorder[CPUSTATES] = { CP_SYS, CP_INTR, CP_USER, CP_NICE,
+ CP_IDLE };
+
+void
+showkre(void)
+{
+ float f1, f2;
+ int psiz, inttotal;
+ int i, l, lc;
+ static int failcnt = 0;
+
+ etime = 0;
+ for(i = 0; i < CPUSTATES; i++) {
+ X(time);
+ Q(cp_time);
+ etime += s.time[i];
+ }
+ if (etime < 5.0) { /* < 5 ticks - ignore this trash */
+ if (failcnt++ >= MAXFAIL) {
+ clear();
+ mvprintw(2, 10, "The alternate system clock has died!");
+ mvprintw(3, 10, "Reverting to ``pigs'' display.");
+ move(CMDLINE, 0);
+ refresh();
+ failcnt = 0;
+ sleep(5);
+ command("pigs");
+ }
+ return;
+ }
+ failcnt = 0;
+ etime /= hertz;
+ etime /= ncpu;
+ inttotal = 0;
+ for (i = 0; i < nintr; i++) {
+ if (s.intrcnt[i] == 0)
+ continue;
+ X(intrcnt);
+ l = (int)((float)s.intrcnt[i]/etime + 0.5);
+ inttotal += l;
+ if (intrloc[i] == 0) {
+ if (nextintsrow == LINES)
+ continue;
+ intrloc[i] = nextintsrow++;
+ mvprintw(intrloc[i], INTSCOL + 6, "%-10.10s",
+ intrname[i]);
+ }
+ putint(l, intrloc[i], INTSCOL, 5);
+ }
+ putint(inttotal, INTSROW + 1, INTSCOL, 5);
+ Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);
+ Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes); Z(ncs_neghits);
+ s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +
+ nchtotal.ncs_miss + nchtotal.ncs_long + nchtotal.ncs_neghits;
+ if (state == TIME)
+ s1.nchcount = s.nchcount;
+
+ psiz = 0;
+ f2 = 0.0;
+ for (lc = 0; lc < CPUSTATES; lc++) {
+ i = cpuorder[lc];
+ f1 = cputime(i);
+ f2 += f1;
+ l = (int) ((f2 + 1.0) / 2.0) - psiz;
+ putfloat(f1, GRAPHROW, GRAPHCOL + 10 * lc, 4, 1, 0);
+ move(GRAPHROW + 2, psiz);
+ psiz += l;
+ while (l-- > 0)
+ addch(cpuchar[lc]);
+ }
+
+ putint(ucount(), STATROW, STATCOL, 5);
+ putfloat(avenrun[0], STATROW, STATCOL + 20, 5, 2, 0);
+ putfloat(avenrun[1], STATROW, STATCOL + 26, 5, 2, 0);
+ putfloat(avenrun[2], STATROW, STATCOL + 32, 5, 2, 0);
+ mvaddstr(STATROW, STATCOL + 55, buf);
+#define pgtokb(pg) ((pg) * (s.v_page_size / 1024))
+ putfloat(100.0 * (v_page_count - total.t_free) / v_page_count,
+ STATROW + 1, STATCOL + 15, 2, 0, 1);
+ putfloat(100.0 * s.v_kmem_map_size / kmem_size,
+ STATROW + 1, STATCOL + 22, 2, 0, 1);
+
+ putint(pgtokb(total.t_arm), MEMROW + 2, MEMCOL + 4, 7);
+ putint(pgtokb(total.t_armshr), MEMROW + 2, MEMCOL + 12, 7);
+ putint(pgtokb(total.t_avm), MEMROW + 2, MEMCOL + 20, 8);
+ putint(pgtokb(total.t_avmshr), MEMROW + 2, MEMCOL + 29, 8);
+ putint(pgtokb(total.t_rm), MEMROW + 3, MEMCOL + 4, 7);
+ putint(pgtokb(total.t_rmshr), MEMROW + 3, MEMCOL + 12, 7);
+ putint(pgtokb(total.t_vm), MEMROW + 3, MEMCOL + 20, 8);
+ putint(pgtokb(total.t_vmshr), MEMROW + 3, MEMCOL + 29, 8);
+ putint(pgtokb(total.t_free), MEMROW + 2, MEMCOL + 38, 7);
+ putint(total.t_rq - 1, PROCSROW + 2, PROCSCOL, 3);
+ putint(total.t_pw, PROCSROW + 2, PROCSCOL + 4, 3);
+ putint(total.t_dw, PROCSROW + 2, PROCSCOL + 8, 3);
+ putint(total.t_sl, PROCSROW + 2, PROCSCOL + 12, 3);
+ putint(total.t_sw, PROCSROW + 2, PROCSCOL + 16, 3);
+ PUTRATE(v_io_faults, VMSTATROW, VMSTATCOL + 2, 8 - 2);
+ PUTRATE(v_cow_faults, VMSTATROW + 1, VMSTATCOL + 2, 8 - 2);
+ PUTRATE(v_zfod, VMSTATROW + 2, VMSTATCOL + 2, 8 - 2);
+ PUTRATE(v_ozfod, VMSTATROW + 3, VMSTATCOL, 8);
+ putint(s.v_zfod != 0 ? (int)(s.v_ozfod * 100.0 / s.v_zfod) : 0,
+ VMSTATROW + 4, VMSTATCOL + 1, 8 - 1);
+ PUTRATE(v_dfree, VMSTATROW + 5, VMSTATCOL + 2, 8 - 2);
+ PUTRATE(v_pfree, VMSTATROW + 6, VMSTATCOL + 2, 8 - 2);
+ PUTRATE(v_tfree, VMSTATROW + 7, VMSTATCOL, 8);
+ PUTRATE(v_reactivated, VMSTATROW + 8, VMSTATCOL, 8);
+ PUTRATE(v_pdwakeups, VMSTATROW + 9, VMSTATCOL, 8);
+ PUTRATE(v_pdpages, VMSTATROW + 10, VMSTATCOL, 8);
+ PUTRATE(v_intrans, VMSTATROW + 11, VMSTATCOL, 8);
+ putint(pgtokb(s.v_wire_count), VMSTATROW + 12, VMSTATCOL, 8);
+ putint(pgtokb(s.v_active_count), VMSTATROW + 13, VMSTATCOL, 8);
+ putint(pgtokb(s.v_inactive_count), VMSTATROW + 14, VMSTATCOL, 8);
+ putint(pgtokb(s.v_cache_count), VMSTATROW + 15, VMSTATCOL, 8);
+ putint(pgtokb(s.v_free_count), VMSTATROW + 16, VMSTATCOL, 8);
+ if (LINES - 1 > VMSTATROW + 17)
+ putint(s.bufspace / 1024, VMSTATROW + 17, VMSTATCOL, 8);
+ PUTRATE(v_vnodein, PAGEROW + 2, PAGECOL + 6, 5);
+ PUTRATE(v_vnodeout, PAGEROW + 2, PAGECOL + 12, 5);
+ PUTRATE(v_swapin, PAGEROW + 2, PAGECOL + 19, 5);
+ PUTRATE(v_swapout, PAGEROW + 2, PAGECOL + 25, 5);
+ PUTRATE(v_vnodepgsin, PAGEROW + 3, PAGECOL + 6, 5);
+ PUTRATE(v_vnodepgsout, PAGEROW + 3, PAGECOL + 12, 5);
+ PUTRATE(v_swappgsin, PAGEROW + 3, PAGECOL + 19, 5);
+ PUTRATE(v_swappgsout, PAGEROW + 3, PAGECOL + 25, 5);
+ PUTRATE(v_swtch, GENSTATROW + 1, GENSTATCOL, 4);
+ PUTRATE(v_trap, GENSTATROW + 1, GENSTATCOL + 5, 4);
+ PUTRATE(v_syscall, GENSTATROW + 1, GENSTATCOL + 10, 4);
+ PUTRATE(v_intr, GENSTATROW + 1, GENSTATCOL + 15, 4);
+ PUTRATE(v_soft, GENSTATROW + 1, GENSTATCOL + 20, 4);
+ PUTRATE(v_vm_faults, GENSTATROW + 1, GENSTATCOL + 25, 4);
+ for (i = 0, lc = 0; i < num_devices && lc < MAXDRIVES; i++)
+ if (dev_select[i].selected) {
+ switch(state) {
+ case TIME:
+ dinfo(i, ++lc, &cur, &last);
+ break;
+ case RUN:
+ dinfo(i, ++lc, &cur, &run);
+ break;
+ case BOOT:
+ dinfo(i, ++lc, &cur, NULL);
+ break;
+ }
+ }
+ putint(s.numdirtybuffers, VNSTATROW, VNSTATCOL, 7);
+ putint(s.desiredvnodes, VNSTATROW + 1, VNSTATCOL, 7);
+ putint(s.numvnodes, VNSTATROW + 2, VNSTATCOL, 7);
+ putint(s.freevnodes, VNSTATROW + 3, VNSTATCOL, 7);
+ putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 8);
+ putint((nchtotal.ncs_goodhits + nchtotal.ncs_neghits),
+ NAMEIROW + 2, NAMEICOL + 9, 7);
+#define nz(x) ((x) ? (x) : 1)
+ putfloat((nchtotal.ncs_goodhits+nchtotal.ncs_neghits) *
+ 100.0 / nz(s.nchcount),
+ NAMEIROW + 2, NAMEICOL + 17, 3, 0, 1);
+ putint(nchtotal.ncs_pass2, NAMEIROW + 2, NAMEICOL + 21, 7);
+ putfloat(nchtotal.ncs_pass2 * 100.0 / nz(s.nchcount),
+ NAMEIROW + 2, NAMEICOL + 29, 3, 0, 1);
+#undef nz
+}
+
+int
+cmdkre(const char *cmd, const char *args)
+{
+ int retval;
+
+ if (prefix(cmd, "run")) {
+ retval = 1;
+ copyinfo(&s2, &s1);
+ switch (devstat_getdevs(NULL, &run)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = run.dinfo->numdevs;
+ generation = run.dinfo->generation;
+ retval = dscmd("refresh", NULL, MAXDRIVES, &cur);
+ if (retval == 2)
+ labelkre();
+ break;
+ default:
+ break;
+ }
+ state = RUN;
+ return (retval);
+ }
+ if (prefix(cmd, "boot")) {
+ state = BOOT;
+ copyinfo(&z, &s1);
+ return (1);
+ }
+ if (prefix(cmd, "time")) {
+ state = TIME;
+ return (1);
+ }
+ if (prefix(cmd, "zero")) {
+ retval = 1;
+ if (state == RUN) {
+ getinfo(&s1);
+ switch (devstat_getdevs(NULL, &run)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = run.dinfo->numdevs;
+ generation = run.dinfo->generation;
+ retval = dscmd("refresh",NULL, MAXDRIVES, &cur);
+ if (retval == 2)
+ labelkre();
+ break;
+ default:
+ break;
+ }
+ }
+ return (retval);
+ }
+ retval = dscmd(cmd, args, MAXDRIVES, &cur);
+
+ if (retval == 2)
+ labelkre();
+
+ return(retval);
+}
+
+/* calculate number of users on the system */
+static int
+ucount(void)
+{
+ int nusers = 0;
+ struct utmpx *ut;
+
+ setutxent();
+ while ((ut = getutxent()) != NULL)
+ if (ut->ut_type == USER_PROCESS)
+ nusers++;
+ endutxent();
+
+ return (nusers);
+}
+
+static float
+cputime(int indx)
+{
+ double lt;
+ int i;
+
+ lt = 0;
+ for (i = 0; i < CPUSTATES; i++)
+ lt += s.time[i];
+ if (lt == 0.0)
+ lt = 1.0;
+ return (s.time[indx] * 100.0 / lt);
+}
+
+static void
+putint(int n, int l, int lc, int w)
+{
+ int snr;
+ char b[128];
+
+ move(l, lc);
+#ifdef DEBUG
+ while (w-- > 0)
+ addch('*');
+ return;
+#endif
+ if (n == 0) {
+ while (w-- > 0)
+ addch(' ');
+ return;
+ }
+ snr = snprintf(b, sizeof(b), "%*d", w, n);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*dk", w - 1, n / 1000);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*dM", w - 1, n / 1000000);
+ if (snr != w) {
+ while (w-- > 0)
+ addch('*');
+ return;
+ }
+ addstr(b);
+}
+
+static void
+putfloat(double f, int l, int lc, int w, int d, int nz)
+{
+ int snr;
+ char b[128];
+
+ move(l, lc);
+#ifdef DEBUG
+ while (--w >= 0)
+ addch('*');
+ return;
+#endif
+ if (nz && f == 0.0) {
+ while (--w >= 0)
+ addch(' ');
+ return;
+ }
+ snr = snprintf(b, sizeof(b), "%*.*f", w, d, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0f", w, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0fk", w - 1, f / 1000);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0fM", w - 1, f / 1000000);
+ if (snr != w) {
+ while (--w >= 0)
+ addch('*');
+ return;
+ }
+ addstr(b);
+}
+
+static void
+putlongdouble(long double f, int l, int lc, int w, int d, int nz)
+{
+ int snr;
+ char b[128];
+
+ move(l, lc);
+#ifdef DEBUG
+ while (--w >= 0)
+ addch('*');
+ return;
+#endif
+ if (nz && f == 0.0) {
+ while (--w >= 0)
+ addch(' ');
+ return;
+ }
+ snr = snprintf(b, sizeof(b), "%*.*Lf", w, d, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0Lf", w, f);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0Lfk", w - 1, f / 1000);
+ if (snr != w)
+ snr = snprintf(b, sizeof(b), "%*.0LfM", w - 1, f / 1000000);
+ if (snr != w) {
+ while (--w >= 0)
+ addch('*');
+ return;
+ }
+ addstr(b);
+}
+
+static void
+getinfo(struct Info *ls)
+{
+ struct devinfo *tmp_dinfo;
+ size_t size;
+ int mib[2];
+
+ GETSYSCTL("kern.cp_time", ls->time);
+ GETSYSCTL("kern.cp_time", cur.cp_time);
+ GETSYSCTL("vm.stats.sys.v_swtch", ls->v_swtch);
+ GETSYSCTL("vm.stats.sys.v_trap", ls->v_trap);
+ GETSYSCTL("vm.stats.sys.v_syscall", ls->v_syscall);
+ GETSYSCTL("vm.stats.sys.v_intr", ls->v_intr);
+ GETSYSCTL("vm.stats.sys.v_soft", ls->v_soft);
+ GETSYSCTL("vm.stats.vm.v_vm_faults", ls->v_vm_faults);
+ GETSYSCTL("vm.stats.vm.v_io_faults", ls->v_io_faults);
+ GETSYSCTL("vm.stats.vm.v_cow_faults", ls->v_cow_faults);
+ GETSYSCTL("vm.stats.vm.v_zfod", ls->v_zfod);
+ GETSYSCTL("vm.stats.vm.v_ozfod", ls->v_ozfod);
+ GETSYSCTL("vm.stats.vm.v_swapin", ls->v_swapin);
+ GETSYSCTL("vm.stats.vm.v_swapout", ls->v_swapout);
+ GETSYSCTL("vm.stats.vm.v_swappgsin", ls->v_swappgsin);
+ GETSYSCTL("vm.stats.vm.v_swappgsout", ls->v_swappgsout);
+ GETSYSCTL("vm.stats.vm.v_vnodein", ls->v_vnodein);
+ GETSYSCTL("vm.stats.vm.v_vnodeout", ls->v_vnodeout);
+ GETSYSCTL("vm.stats.vm.v_vnodepgsin", ls->v_vnodepgsin);
+ GETSYSCTL("vm.stats.vm.v_vnodepgsout", ls->v_vnodepgsout);
+ GETSYSCTL("vm.stats.vm.v_intrans", ls->v_intrans);
+ GETSYSCTL("vm.stats.vm.v_reactivated", ls->v_reactivated);
+ GETSYSCTL("vm.stats.vm.v_pdwakeups", ls->v_pdwakeups);
+ GETSYSCTL("vm.stats.vm.v_pdpages", ls->v_pdpages);
+ GETSYSCTL("vm.stats.vm.v_dfree", ls->v_dfree);
+ GETSYSCTL("vm.stats.vm.v_pfree", ls->v_pfree);
+ GETSYSCTL("vm.stats.vm.v_tfree", ls->v_tfree);
+ GETSYSCTL("vm.stats.vm.v_page_size", ls->v_page_size);
+ GETSYSCTL("vm.stats.vm.v_free_count", ls->v_free_count);
+ GETSYSCTL("vm.stats.vm.v_wire_count", ls->v_wire_count);
+ GETSYSCTL("vm.stats.vm.v_active_count", ls->v_active_count);
+ GETSYSCTL("vm.stats.vm.v_inactive_count", ls->v_inactive_count);
+ GETSYSCTL("vm.stats.vm.v_cache_count", ls->v_cache_count);
+ GETSYSCTL("vfs.bufspace", ls->bufspace);
+ GETSYSCTL("kern.maxvnodes", ls->desiredvnodes);
+ GETSYSCTL("vfs.numvnodes", ls->numvnodes);
+ GETSYSCTL("vfs.freevnodes", ls->freevnodes);
+ GETSYSCTL("vfs.cache.nchstats", ls->nchstats);
+ GETSYSCTL("vfs.numdirtybuffers", ls->numdirtybuffers);
+ GETSYSCTL("vm.kmem_map_size", ls->v_kmem_map_size);
+ getsysctl("hw.intrcnt", ls->intrcnt, nintr * sizeof(u_long));
+
+ size = sizeof(ls->Total);
+ mib[0] = CTL_VM;
+ mib[1] = VM_TOTAL;
+ if (sysctl(mib, 2, &ls->Total, &size, NULL, 0) < 0) {
+ error("Can't get kernel info: %s\n", strerror(errno));
+ bzero(&ls->Total, sizeof(ls->Total));
+ }
+ size = sizeof(ncpu);
+ if (sysctlbyname("hw.ncpu", &ncpu, &size, NULL, 0) < 0 ||
+ size != sizeof(ncpu))
+ ncpu = 1;
+
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+
+ last.snap_time = cur.snap_time;
+ switch (devstat_getdevs(NULL, &cur)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+ cmdkre("refresh", NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+allocinfo(struct Info *ls)
+{
+
+ ls->intrcnt = (long *) calloc(nintr, sizeof(long));
+ if (ls->intrcnt == NULL)
+ errx(2, "out of memory");
+}
+
+static void
+copyinfo(struct Info *from, struct Info *to)
+{
+ long *intrcnt;
+
+ /*
+ * time, wds, seek, and xfer are malloc'd so we have to
+ * save the pointers before the structure copy and then
+ * copy by hand.
+ */
+ intrcnt = to->intrcnt;
+ *to = *from;
+
+ bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (int));
+}
+
+static void
+dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then)
+{
+ long double transfers_per_second;
+ long double kb_per_transfer, mb_per_second;
+ long double elapsed_time, device_busy;
+ int di;
+
+ di = dev_select[dn].position;
+
+ if (then != NULL) {
+ /* Calculate relative to previous sample */
+ elapsed_time = now->snap_time - then->snap_time;
+ } else {
+ /* Calculate relative to device creation */
+ elapsed_time = now->snap_time - devstat_compute_etime(
+ &now->dinfo->devices[di].creation_time, NULL);
+ }
+
+ if (devstat_compute_statistics(&now->dinfo->devices[di], then ?
+ &then->dinfo->devices[di] : NULL, elapsed_time,
+ DSM_KB_PER_TRANSFER, &kb_per_transfer,
+ DSM_TRANSFERS_PER_SECOND, &transfers_per_second,
+ DSM_MB_PER_SECOND, &mb_per_second,
+ DSM_BUSY_PCT, &device_busy,
+ DSM_NONE) != 0)
+ errx(1, "%s", devstat_errbuf);
+
+ lc = DISKCOL + lc * 6;
+ putlongdouble(kb_per_transfer, DISKROW + 1, lc, 5, 2, 0);
+ putlongdouble(transfers_per_second, DISKROW + 2, lc, 5, 0, 0);
+ putlongdouble(mb_per_second, DISKROW + 3, lc, 5, 2, 0);
+ putlongdouble(device_busy, DISKROW + 4, lc, 5, 0, 0);
+}
diff --git a/usr.bin/systat/zarc.c b/usr.bin/systat/zarc.c
new file mode 100644
index 0000000..2a6606f
--- /dev/null
+++ b/usr.bin/systat/zarc.c
@@ -0,0 +1,221 @@
+/*-
+ * Copyright (c) 2014
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include <string.h>
+
+#include "systat.h"
+#include "extern.h"
+
+struct zfield{
+ uint64_t arcstats;
+ uint64_t arcstats_demand_data;
+ uint64_t arcstats_demand_metadata;
+ uint64_t arcstats_prefetch_data;
+ uint64_t arcstats_prefetch_metadata;
+ uint64_t zfetchstats;
+ uint64_t arcstats_l2;
+ uint64_t vdev_cache_stats;
+};
+
+static struct zarcstats {
+ struct zfield hits;
+ struct zfield misses;
+} curstat, initstat, oldstat;
+
+static void
+getinfo(struct zarcstats *ls);
+
+WINDOW *
+openzarc(void)
+{
+ return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
+}
+
+void
+closezarc(WINDOW *w)
+{
+ if (w == NULL)
+ return;
+ wclear(w);
+ wrefresh(w);
+ delwin(w);
+}
+
+void
+labelzarc(void)
+{
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+ mvwprintw(wnd, 0, 31+1, "%4.4s %7.7s %7.7s %12.12s %12.12s",
+ "rate", "hits", "misses", "total hits", "total misses");
+#define L(row, str) mvwprintw(wnd, row, 5, str); \
+ mvwprintw(wnd, row, 31, ":"); \
+ mvwprintw(wnd, row, 31+4, "%%")
+ L(1, "arcstats");
+ L(2, "arcstats.demand_data");
+ L(3, "arcstats.demand_metadata");
+ L(4, "arcstats.prefetch_data");
+ L(5, "arcstats.prefetch_metadata");
+ L(6, "zfetchstats");
+ L(7, "arcstats.l2");
+ L(8, "vdev_cache_stats");
+#undef L
+}
+
+static int calc(uint64_t hits, uint64_t misses)
+{
+ if( hits )
+ return 100 * hits / ( hits + misses );
+ else
+ return 0;
+}
+
+static void
+domode(struct zarcstats *delta, struct zarcstats *rate)
+{
+#define DO(stat) \
+ delta->hits.stat = (curstat.hits.stat - oldstat.hits.stat); \
+ delta->misses.stat = (curstat.misses.stat - oldstat.misses.stat); \
+ rate->hits.stat = calc(delta->hits.stat, delta->misses.stat)
+ DO(arcstats);
+ DO(arcstats_demand_data);
+ DO(arcstats_demand_metadata);
+ DO(arcstats_prefetch_data);
+ DO(arcstats_prefetch_metadata);
+ DO(zfetchstats);
+ DO(arcstats_l2);
+ DO(vdev_cache_stats);
+ DO(arcstats);
+ DO(arcstats_demand_data);
+ DO(arcstats_demand_metadata);
+ DO(arcstats_prefetch_data);
+ DO(arcstats_prefetch_metadata);
+ DO(zfetchstats);
+ DO(arcstats_l2);
+ DO(vdev_cache_stats);
+#undef DO
+}
+
+void
+showzarc(void)
+{
+ struct zarcstats delta, rate;
+
+ memset(&delta, 0, sizeof delta);
+ memset(&rate, 0, sizeof rate);
+
+ domode(&delta, &rate);
+
+#define DO(stat, row, col, fmt) \
+ mvwprintw(wnd, row, col, fmt, stat)
+#define R(row, stat) DO(rate.hits.stat, row, 31+1, "%3lu")
+#define H(row, stat) DO(delta.hits.stat, row, 31+1+5, "%7lu"); \
+ DO(curstat.hits.stat, row, 31+1+5+8+8, "%12lu")
+#define M(row, stat) DO(delta.misses.stat, row, 31+1+5+8, "%7lu"); \
+ DO(curstat.misses.stat, row, 31+1+5+8+8+13, "%12lu")
+#define E(row, stat) R(row, stat); H(row, stat); M(row, stat);
+ E(1, arcstats);
+ E(2, arcstats_demand_data);
+ E(3, arcstats_demand_metadata);
+ E(4, arcstats_prefetch_data);
+ E(5, arcstats_prefetch_metadata);
+ E(6, zfetchstats);
+ E(7, arcstats_l2);
+ E(8, vdev_cache_stats);
+#undef DO
+#undef E
+#undef M
+#undef H
+#undef R
+}
+
+int
+initzarc(void)
+{
+ getinfo(&initstat);
+ curstat = oldstat = initstat;
+ return 1;
+}
+
+void
+resetzarc(void)
+{
+ initzarc();
+}
+
+static void
+getinfo(struct zarcstats *ls)
+{
+ size_t size = sizeof( ls->hits.arcstats );
+ if ( sysctlbyname("kstat.zfs.misc.arcstats.hits",
+ &ls->hits.arcstats, &size, NULL, 0 ) != 0 )
+ return;
+ GETSYSCTL("kstat.zfs.misc.arcstats.misses",
+ ls->misses.arcstats);
+ GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_hits",
+ ls->hits.arcstats_demand_data);
+ GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_misses",
+ ls->misses.arcstats_demand_data);
+ GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_hits",
+ ls->hits.arcstats_demand_metadata);
+ GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_misses",
+ ls->misses.arcstats_demand_metadata);
+ GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_hits",
+ ls->hits.arcstats_prefetch_data);
+ GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_misses",
+ ls->misses.arcstats_prefetch_data);
+ GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_hits",
+ ls->hits.arcstats_prefetch_metadata);
+ GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_misses",
+ ls->misses.arcstats_prefetch_metadata);
+ GETSYSCTL("kstat.zfs.misc.zfetchstats.hits",
+ ls->hits.zfetchstats);
+ GETSYSCTL("kstat.zfs.misc.zfetchstats.misses",
+ ls->misses.zfetchstats);
+ GETSYSCTL("kstat.zfs.misc.arcstats.l2_hits",
+ ls->hits.arcstats_l2);
+ GETSYSCTL("kstat.zfs.misc.arcstats.l2_misses",
+ ls->misses.arcstats_l2);
+ GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.hits",
+ ls->hits.vdev_cache_stats);
+ GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.misses",
+ ls->misses.vdev_cache_stats);
+}
+
+void
+fetchzarc(void)
+{
+ oldstat = curstat;
+ getinfo(&curstat);
+}
diff --git a/usr.bin/tabs/Makefile b/usr.bin/tabs/Makefile
new file mode 100644
index 0000000..f8c085b
--- /dev/null
+++ b/usr.bin/tabs/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= tabs
+
+LIBADD= ncursesw
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tabs/Makefile.depend b/usr.bin/tabs/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/tabs/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tabs/tabs.1 b/usr.bin/tabs/tabs.1
new file mode 100644
index 0000000..9075de5
--- /dev/null
+++ b/usr.bin/tabs/tabs.1
@@ -0,0 +1,160 @@
+.\" Copyright (c) 2002 Tim J. Robbins.
+.\" 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 May 20, 2002
+.Dt TABS 1
+.Os
+.Sh NAME
+.Nm tabs
+.Nd set terminal tabs
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ar n | Fl a | a2 | c | c2 | c3 | f | p | s | u
+.Op Cm +m Ns Op Ar n
+.Op Fl T Ar type
+.Nm
+.Op Fl T Ar type
+.Op Cm + Ns Op Ar n
+.Ar n1 Ns Op Ns , Ns Ar n2 , Ns ...
+.Sh DESCRIPTION
+The
+.Nm
+utility displays a series of characters that clear the hardware terminal
+tab settings then initialises tab stops at specified positions, and
+optionally adjusts the margin.
+.Pp
+In the first synopsis form, the tab stops set depend on the command line
+options used, and may be one of the predefined formats or at regular
+intervals.
+.Pp
+In the second synopsis form, tab stops are set at positions
+.Ar n1 , n2 ,
+etc.
+If a position is preceded by a
+.Ql + ,
+it is relative to the previous position set.
+No more than 20 positions may be specified.
+.Pp
+If no tab stops are specified, the
+.Dq standard
+.Ux
+tab width of 8 is used.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl Ar n
+Set a tab stop every
+.Ar n
+columns.
+If
+.Ar n
+is 0, the tab stops are cleared but no new ones are set.
+.It Fl a
+Assembler format (columns 1, 10, 16, 36, 72).
+.It Fl a2
+Assembler format (columns 1, 10, 16, 40, 72).
+.It Fl c
+.Tn COBOL
+normal format (columns 1, 8, 12, 16, 20, 55)
+.It Fl c2
+.Tn COBOL
+compact format (columns 1, 6, 10, 14, 49)
+.It Fl c3
+.Tn COBOL
+compact format (columns 1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46,
+50, 54, 58, 62, 67).
+.It Fl f
+.Tn FORTRAN
+format (columns 1, 7, 11, 15, 19, 23).
+.It Fl p
+.Tn PL/1
+format (columns 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53,
+57, 61).
+.It Fl s
+.Tn SNOBOL
+format (columns 1, 10, 55).
+.It Fl u
+Assembler format (columns 1, 12, 20, 44).
+.It Xo
+.Cm +m Ns Op Ar n ,
+.Cm + Ns Op Ar n
+.Xc
+Set an
+.Ar n
+character left margin, or 10 if
+.Ar n
+is omitted.
+.It Fl T Ar type
+Output escape sequence for the terminal type
+.Ar type .
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_CTYPE
+and
+.Ev TERM
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Pp
+The
+.Fl T
+option overrides the setting of the
+.Ev TERM
+environment variable.
+If neither
+.Ev TERM
+nor the
+.Fl T
+option are present,
+.Nm
+will fail.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr expand 1 ,
+.Xr stty 1 ,
+.Xr tput 1 ,
+.Xr unexpand 1 ,
+.Xr termcap 5
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+utility appeared in PWB UNIX.
+This implementation was introduced in
+.Fx 5.0 .
+.Sh BUGS
+The current
+.Xr termcap 5
+database does not define the
+.Ql ML
+(set left soft margin) capability for any terminals.
diff --git a/usr.bin/tabs/tabs.c b/usr.bin/tabs/tabs.c
new file mode 100644
index 0000000..d03a741
--- /dev/null
+++ b/usr.bin/tabs/tabs.c
@@ -0,0 +1,237 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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.
+ */
+
+/*
+ * tabs -- set terminal tabs
+ *
+ * This utility displays a series of characters that clears the terminal
+ * hardware tab settings, then initialises them to specified values,
+ * and optionally sets a soft margin.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/tty.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <term.h>
+#include <unistd.h>
+
+/* Maximum number of tab stops allowed in table. */
+#define NSTOPS 20
+
+#define NELEMS(a) (sizeof(a) / sizeof(a[0]))
+
+/* Predefined formats, taken from IEEE Std 1003.1-2001. */
+static const struct {
+ const char *name; /* Format name used on cmd. line */
+ long stops[NSTOPS]; /* Column positions */
+} formats[] = {
+ { "a", { 1, 10, 16, 36, 72 } },
+ { "a2", { 1, 10, 16, 40, 72 } },
+ { "c", { 1, 8, 12, 16, 20, 55 } },
+ { "c2", { 1, 6, 10, 14, 49 } },
+ { "c3", { 1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58,
+ 62, 67 } },
+ { "f", { 1, 7, 11, 15, 19, 23 } },
+ { "p", { 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57,
+ 61 } },
+ { "s", { 1, 10, 55 } },
+ { "u", { 1, 12, 20, 44 } }
+};
+
+static void gettabs(char *, long *, long *);
+static int ttywidth(void);
+static void usage(void);
+
+int
+main(int argc __unused, char *argv[])
+{
+ long cols, i, inc, j, margin, nstops, stops[NSTOPS];
+ const char *cr, *ct, *st, *ML;
+ char area[1024], *ap, *arg, *end;
+
+ setlocale(LC_ALL, "");
+
+ inc = 8;
+ margin = 0;
+ nstops = -1;
+ while ((arg = *++argv) != NULL && (*arg == '-' || *arg == '+')) {
+ if (*arg == '+') {
+ /* +m[n] or +[n] */
+ if (*++arg == 'm')
+ arg++;
+ if (*arg != '\0') {
+ errno = 0;
+ margin = strtol(arg, &end, 10);
+ if (errno != 0 || *end != '\0' || margin < 0)
+ errx(1, "%s: invalid margin width",
+ arg);
+ } else
+ margin = 10;
+ } else if (isdigit(arg[1])) {
+ /* -n */
+ errno = 0;
+ inc = strtol(arg + 1, &end, 10);
+ if (errno != 0 || *end != '\0' || inc < 0)
+ errx(1, "%s: invalid increment", arg + 1);
+ } else if (arg[1] == 'T') {
+ /* -Ttype or -T type */
+ if (arg[2] != '\0')
+ setenv("TERM", arg + 2, 1);
+ else {
+ if ((arg = *++argv) == NULL)
+ usage();
+ setenv("TERM", arg, 1);
+ }
+ } else if (arg[1] == '-') {
+ arg = *++argv;
+ break;
+ } else {
+ /* Predefined format */
+ for (i = 0; i < (int)NELEMS(formats); i++)
+ if (strcmp(formats[i].name, arg + 1) == 0)
+ break;
+ if (i == NELEMS(formats))
+ usage();
+ for (j = nstops = 0; j < NSTOPS &&
+ formats[i].stops[j] != 0; j++)
+ stops[nstops++] = formats[i].stops[j];
+ }
+ }
+
+ if (arg != NULL) {
+ if (nstops != -1)
+ usage();
+ gettabs(arg, stops, &nstops);
+ }
+
+ /* Initialise terminal, get the strings we need */
+ setupterm(NULL, 1, NULL);
+ ap = area;
+ if ((ct = tgetstr("ct", &ap)) == NULL)
+ errx(1, "terminal cannot clear tabs");
+ if ((st = tgetstr("st", &ap)) == NULL)
+ errx(1, "terminal cannot set tabs");
+ if ((cr = tgetstr("cr", &ap)) == NULL)
+ cr = "\r";
+ ML = tgetstr("ML", &ap);
+ cols = ttywidth();
+
+ /* Clear all tabs. */
+ putp(cr);
+ putp(ct);
+
+ /*
+ * Set soft margin.
+ * XXX Does this actually work?
+ */
+ if (ML != NULL) {
+ printf("%*s", (int)margin, "");
+ putp(ML);
+ } else if (margin != 0)
+ warnx("terminal cannot set left margin");
+
+ /* Optionally output new tab stops. */
+ if (nstops >= 0) {
+ printf("%*s", (int)stops[0] - 1, "");
+ putp(st);
+ for (i = 1; i < nstops; i++) {
+ printf("%*s", (int)(stops[i] - stops[i - 1]), "");
+ putp(st);
+ }
+ } else if (inc > 0) {
+ for (i = 0; i < cols / inc; i++) {
+ putp(st);
+ printf("%*s", (int)inc, "");
+ }
+ putp(st);
+ }
+ putp(cr);
+
+ exit(0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+"usage: tabs [-n|-a|-a2|-c|-c2|-c3|-f|-p|-s|-u] [+m[n]] [-T type]\n");
+ fprintf(stderr,
+" tabs [-T type] [+[n]] n1,[n2,...]\n");
+ exit(1);
+}
+
+static void
+gettabs(char *arg, long stops[], long *nstops)
+{
+ char *tok, *end;
+ long last, stop;
+
+ for (last = *nstops = 0, tok = strtok(arg, ","); tok != NULL;
+ tok = strtok(NULL, ",")) {
+ if (*nstops >= NSTOPS)
+ errx(1, "too many tab stops (limit %d)", NSTOPS);
+ errno = 0;
+ stop = strtol(tok, &end, 10);
+ if (errno != 0 || *end != '\0' || stop <= 0)
+ errx(1, "%s: invalid tab stop", tok);
+ if (*tok == '+') {
+ if (tok == arg)
+ errx(1, "%s: first tab may not be relative",
+ tok);
+ stop += last;
+ }
+ if (last > stop)
+ errx(1, "cannot go backwards");
+ last = stops[(*nstops)++] = stop;
+ }
+}
+
+static int
+ttywidth(void)
+{
+ struct winsize ws;
+ int width;
+
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1)
+ width = ws.ws_col;
+ else if ((width = tgetnum("co")) == 0) {
+ width = 80;
+ warnx("cannot find terminal width; defaulted to %d", width);
+ }
+
+ return (width);
+}
diff --git a/usr.bin/tail/Makefile b/usr.bin/tail/Makefile
new file mode 100644
index 0000000..672cbed
--- /dev/null
+++ b/usr.bin/tail/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+
+PROG= tail
+SRCS= forward.c misc.c read.c reverse.c tail.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tail/Makefile.depend b/usr.bin/tail/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tail/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tail/extern.h b/usr.bin/tail/extern.h
new file mode 100644
index 0000000..dfc63d0
--- /dev/null
+++ b/usr.bin/tail/extern.h
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ *
+ * $FreeBSD$
+ */
+
+#define WR(p, size) do { \
+ if (write(STDOUT_FILENO, p, size) != (ssize_t)size) \
+ oerr(); \
+ } while(0)
+
+#define TAILMAPLEN (4<<20)
+
+struct mapinfo {
+ off_t mapoff;
+ off_t maxoff;
+ size_t maplen;
+ char *start;
+ int fd;
+};
+
+struct file_info {
+ FILE *fp;
+ char *file_name;
+ struct stat st;
+};
+
+typedef struct file_info file_info_t;
+
+enum STYLE { NOTSET = 0, FBYTES, FLINES, RBYTES, RLINES, REVERSE };
+
+void follow(file_info_t *, enum STYLE, off_t);
+void forward(FILE *, const char *, enum STYLE, off_t, struct stat *);
+void reverse(FILE *, const char *, enum STYLE, off_t, struct stat *);
+
+int bytes(FILE *, const char *, off_t);
+int lines(FILE *, const char *, off_t);
+
+void ierr(const char *);
+void oerr(void);
+int mapprint(struct mapinfo *, off_t, off_t);
+int maparound(struct mapinfo *, off_t);
+void printfn(const char *, int);
+
+extern int Fflag, fflag, qflag, rflag, rval, no_files;
diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c
new file mode 100644
index 0000000..5eaae98
--- /dev/null
+++ b/usr.bin/tail/forward.c
@@ -0,0 +1,423 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/mman.h>
+#include <sys/event.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+static void rlines(FILE *, const char *fn, off_t, struct stat *);
+static int show(file_info_t *);
+static void set_events(file_info_t *files);
+
+/* defines for inner loop actions */
+#define USE_SLEEP 0
+#define USE_KQUEUE 1
+#define ADD_EVENTS 2
+
+static struct kevent *ev;
+static int action = USE_SLEEP;
+static int kq;
+
+static const file_info_t *last;
+
+/*
+ * forward -- display the file, from an offset, forward.
+ *
+ * There are eight separate cases for this -- regular and non-regular
+ * files, by bytes or lines and from the beginning or end of the file.
+ *
+ * FBYTES byte offset from the beginning of the file
+ * REG seek
+ * NOREG read, counting bytes
+ *
+ * FLINES line offset from the beginning of the file
+ * REG read, counting lines
+ * NOREG read, counting lines
+ *
+ * RBYTES byte offset from the end of the file
+ * REG seek
+ * NOREG cyclically read characters into a wrap-around buffer
+ *
+ * RLINES
+ * REG mmap the file and step back until reach the correct offset.
+ * NOREG cyclically read lines into a wrap-around array of buffers
+ */
+void
+forward(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp)
+{
+ int ch;
+
+ switch(style) {
+ case FBYTES:
+ if (off == 0)
+ break;
+ if (S_ISREG(sbp->st_mode)) {
+ if (sbp->st_size < off)
+ off = sbp->st_size;
+ if (fseeko(fp, off, SEEK_SET) == -1) {
+ ierr(fn);
+ return;
+ }
+ } else while (off--)
+ if ((ch = getc(fp)) == EOF) {
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+ break;
+ }
+ break;
+ case FLINES:
+ if (off == 0)
+ break;
+ for (;;) {
+ if ((ch = getc(fp)) == EOF) {
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+ break;
+ }
+ if (ch == '\n' && !--off)
+ break;
+ }
+ break;
+ case RBYTES:
+ if (S_ISREG(sbp->st_mode)) {
+ if (sbp->st_size >= off &&
+ fseeko(fp, -off, SEEK_END) == -1) {
+ ierr(fn);
+ return;
+ }
+ } else if (off == 0) {
+ while (getc(fp) != EOF);
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+ } else
+ if (bytes(fp, fn, off))
+ return;
+ break;
+ case RLINES:
+ if (S_ISREG(sbp->st_mode))
+ if (!off) {
+ if (fseeko(fp, (off_t)0, SEEK_END) == -1) {
+ ierr(fn);
+ return;
+ }
+ } else
+ rlines(fp, fn, off, sbp);
+ else if (off == 0) {
+ while (getc(fp) != EOF);
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+ } else
+ if (lines(fp, fn, off))
+ return;
+ break;
+ default:
+ break;
+ }
+
+ while ((ch = getc(fp)) != EOF)
+ if (putchar(ch) == EOF)
+ oerr();
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+ (void)fflush(stdout);
+}
+
+/*
+ * rlines -- display the last offset lines of the file.
+ */
+static void
+rlines(FILE *fp, const char *fn, off_t off, struct stat *sbp)
+{
+ struct mapinfo map;
+ off_t curoff, size;
+ int i;
+
+ if (!(size = sbp->st_size))
+ return;
+ map.start = NULL;
+ map.fd = fileno(fp);
+ map.mapoff = map.maxoff = size;
+
+ /*
+ * Last char is special, ignore whether newline or not. Note that
+ * size == 0 is dealt with above, and size == 1 sets curoff to -1.
+ */
+ curoff = size - 2;
+ while (curoff >= 0) {
+ if (curoff < map.mapoff && maparound(&map, curoff) != 0) {
+ ierr(fn);
+ return;
+ }
+ for (i = curoff - map.mapoff; i >= 0; i--)
+ if (map.start[i] == '\n' && --off == 0)
+ break;
+ /* `i' is either the map offset of a '\n', or -1. */
+ curoff = map.mapoff + i;
+ if (i >= 0)
+ break;
+ }
+ curoff++;
+ if (mapprint(&map, curoff, size - curoff) != 0) {
+ ierr(fn);
+ exit(1);
+ }
+
+ /* Set the file pointer to reflect the length displayed. */
+ if (fseeko(fp, sbp->st_size, SEEK_SET) == -1) {
+ ierr(fn);
+ return;
+ }
+ if (map.start != NULL && munmap(map.start, map.maplen)) {
+ ierr(fn);
+ return;
+ }
+}
+
+static int
+show(file_info_t *file)
+{
+ int ch;
+
+ while ((ch = getc(file->fp)) != EOF) {
+ if (last != file && no_files > 1) {
+ if (!qflag)
+ printfn(file->file_name, 1);
+ last = file;
+ }
+ if (putchar(ch) == EOF)
+ oerr();
+ }
+ (void)fflush(stdout);
+ if (ferror(file->fp)) {
+ fclose(file->fp);
+ file->fp = NULL;
+ ierr(file->file_name);
+ return 0;
+ }
+ clearerr(file->fp);
+ return 1;
+}
+
+static void
+set_events(file_info_t *files)
+{
+ int i, n = 0;
+ file_info_t *file;
+ struct timespec ts;
+ struct statfs sf;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 0;
+
+ action = USE_KQUEUE;
+ for (i = 0, file = files; i < no_files; i++, file++) {
+ if (! file->fp)
+ continue;
+
+ if (fstatfs(fileno(file->fp), &sf) == 0 &&
+ (sf.f_flags & MNT_LOCAL) == 0) {
+ action = USE_SLEEP;
+ return;
+ }
+
+ if (Fflag && fileno(file->fp) != STDIN_FILENO) {
+ EV_SET(&ev[n], fileno(file->fp), EVFILT_VNODE,
+ EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_RENAME, 0, 0);
+ n++;
+ }
+ EV_SET(&ev[n], fileno(file->fp), EVFILT_READ,
+ EV_ADD | EV_ENABLE | EV_CLEAR, 0, 0, 0);
+ n++;
+ }
+
+ if (kevent(kq, ev, n, NULL, 0, &ts) < 0) {
+ action = USE_SLEEP;
+ }
+}
+
+/*
+ * follow -- display the file, from an offset, forward.
+ *
+ */
+void
+follow(file_info_t *files, enum STYLE style, off_t off)
+{
+ int active, ev_change, i, n = -1;
+ struct stat sb2;
+ file_info_t *file;
+ struct timespec ts;
+
+ /* Position each of the files */
+
+ file = files;
+ active = 0;
+ n = 0;
+ for (i = 0; i < no_files; i++, file++) {
+ if (file->fp) {
+ active = 1;
+ n++;
+ if (no_files > 1 && !qflag)
+ printfn(file->file_name, 1);
+ forward(file->fp, file->file_name, style, off, &file->st);
+ if (Fflag && fileno(file->fp) != STDIN_FILENO)
+ n++;
+ }
+ }
+ if (!Fflag && !active)
+ return;
+
+ last = --file;
+
+ kq = kqueue();
+ if (kq < 0)
+ err(1, "kqueue");
+ ev = malloc(n * sizeof(struct kevent));
+ if (! ev)
+ err(1, "Couldn't allocate memory for kevents.");
+ set_events(files);
+
+ for (;;) {
+ ev_change = 0;
+ if (Fflag) {
+ for (i = 0, file = files; i < no_files; i++, file++) {
+ if (!file->fp) {
+ file->fp = fopen(file->file_name, "r");
+ if (file->fp != NULL &&
+ fstat(fileno(file->fp), &file->st)
+ == -1) {
+ fclose(file->fp);
+ file->fp = NULL;
+ }
+ if (file->fp != NULL)
+ ev_change++;
+ continue;
+ }
+ if (fileno(file->fp) == STDIN_FILENO)
+ continue;
+ if (stat(file->file_name, &sb2) == -1) {
+ if (errno != ENOENT)
+ ierr(file->file_name);
+ show(file);
+ if (file->fp != NULL) {
+ fclose(file->fp);
+ file->fp = NULL;
+ }
+ ev_change++;
+ continue;
+ }
+
+ if (sb2.st_ino != file->st.st_ino ||
+ sb2.st_dev != file->st.st_dev ||
+ sb2.st_nlink == 0) {
+ show(file);
+ file->fp = freopen(file->file_name, "r",
+ file->fp);
+ if (file->fp != NULL)
+ memcpy(&file->st, &sb2,
+ sizeof(struct stat));
+ else if (errno != ENOENT)
+ ierr(file->file_name);
+ ev_change++;
+ }
+ }
+ }
+
+ for (i = 0, file = files; i < no_files; i++, file++)
+ if (file->fp && !show(file))
+ ev_change++;
+
+ if (ev_change)
+ set_events(files);
+
+ switch (action) {
+ case USE_KQUEUE:
+ ts.tv_sec = 1;
+ ts.tv_nsec = 0;
+ /*
+ * In the -F case we set a timeout to ensure that
+ * we re-stat the file at least once every second.
+ */
+ n = kevent(kq, NULL, 0, ev, 1, Fflag ? &ts : NULL);
+ if (n < 0)
+ err(1, "kevent");
+ if (n == 0) {
+ /* timeout */
+ break;
+ } else if (ev->filter == EVFILT_READ && ev->data < 0) {
+ /* file shrank, reposition to end */
+ if (lseek(ev->ident, (off_t)0, SEEK_END) == -1) {
+ ierr(file->file_name);
+ continue;
+ }
+ }
+ break;
+
+ case USE_SLEEP:
+ (void) usleep(250000);
+ break;
+ }
+ }
+}
diff --git a/usr.bin/tail/misc.c b/usr.bin/tail/misc.c
new file mode 100644
index 0000000..6944325
--- /dev/null
+++ b/usr.bin/tail/misc.c
@@ -0,0 +1,129 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+void
+ierr(const char *fname)
+{
+ warn("%s", fname);
+ rval = 1;
+}
+
+void
+oerr(void)
+{
+ err(1, "stdout");
+}
+
+/*
+ * Print `len' bytes from the file associated with `mip', starting at
+ * absolute file offset `startoff'. May move map window.
+ */
+int
+mapprint(struct mapinfo *mip, off_t startoff, off_t len)
+{
+ int n;
+
+ while (len > 0) {
+ if (startoff < mip->mapoff || startoff >= mip->mapoff +
+ (off_t)mip->maplen) {
+ if (maparound(mip, startoff) != 0)
+ return (1);
+ }
+ n = (mip->mapoff + mip->maplen) - startoff;
+ if (n > len)
+ n = len;
+ WR(mip->start + (startoff - mip->mapoff), n);
+ startoff += n;
+ len -= n;
+ }
+ return (0);
+}
+
+/*
+ * Move the map window so that it contains the byte at absolute file
+ * offset `offset'. The start of the map window will be TAILMAPLEN
+ * aligned.
+ */
+int
+maparound(struct mapinfo *mip, off_t offset)
+{
+
+ if (mip->start != NULL && munmap(mip->start, mip->maplen) != 0)
+ return (1);
+
+ mip->mapoff = offset & ~((off_t)TAILMAPLEN - 1);
+ mip->maplen = TAILMAPLEN;
+ if ((off_t)mip->maplen > mip->maxoff - mip->mapoff)
+ mip->maplen = mip->maxoff - mip->mapoff;
+ if (mip->maplen <= 0)
+ abort();
+ if ((mip->start = mmap(NULL, mip->maplen, PROT_READ, MAP_SHARED,
+ mip->fd, mip->mapoff)) == MAP_FAILED)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Print the file name without stdio buffering.
+ */
+void
+printfn(const char *fn, int print_nl)
+{
+
+ if (print_nl)
+ WR("\n", 1);
+ WR("==> ", 4);
+ WR(fn, strlen(fn));
+ WR(" <==\n", 5);
+}
diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c
new file mode 100644
index 0000000..79c4fa5
--- /dev/null
+++ b/usr.bin/tail/read.c
@@ -0,0 +1,209 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+/*
+ * bytes -- read bytes to an offset from the end and display.
+ *
+ * This is the function that reads to a byte offset from the end of the input,
+ * storing the data in a wrap-around buffer which is then displayed. If the
+ * rflag is set, the data is displayed in lines in reverse order, and this
+ * routine has the usual nastiness of trying to find the newlines. Otherwise,
+ * it is displayed from the character closest to the beginning of the input to
+ * the end.
+ */
+int
+bytes(FILE *fp, const char *fn, off_t off)
+{
+ int ch, len, tlen;
+ char *ep, *p, *t;
+ int wrap;
+ char *sp;
+
+ if ((sp = p = malloc(off)) == NULL)
+ err(1, "malloc");
+
+ for (wrap = 0, ep = p + off; (ch = getc(fp)) != EOF;) {
+ *p = ch;
+ if (++p == ep) {
+ wrap = 1;
+ p = sp;
+ }
+ }
+ if (ferror(fp)) {
+ ierr(fn);
+ free(sp);
+ return 1;
+ }
+
+ if (rflag) {
+ for (t = p - 1, len = 0; t >= sp; --t, ++len)
+ if (*t == '\n' && len) {
+ WR(t + 1, len);
+ len = 0;
+ }
+ if (wrap) {
+ tlen = len;
+ for (t = ep - 1, len = 0; t >= p; --t, ++len)
+ if (*t == '\n') {
+ if (len) {
+ WR(t + 1, len);
+ len = 0;
+ }
+ if (tlen) {
+ WR(sp, tlen);
+ tlen = 0;
+ }
+ }
+ if (len)
+ WR(t + 1, len);
+ if (tlen)
+ WR(sp, tlen);
+ }
+ } else {
+ if (wrap && (len = ep - p))
+ WR(p, len);
+ len = p - sp;
+ if (len)
+ WR(sp, len);
+ }
+
+ free(sp);
+ return 0;
+}
+
+/*
+ * lines -- read lines to an offset from the end and display.
+ *
+ * This is the function that reads to a line offset from the end of the input,
+ * storing the data in an array of buffers which is then displayed. If the
+ * rflag is set, the data is displayed in lines in reverse order, and this
+ * routine has the usual nastiness of trying to find the newlines. Otherwise,
+ * it is displayed from the line closest to the beginning of the input to
+ * the end.
+ */
+int
+lines(FILE *fp, const char *fn, off_t off)
+{
+ struct {
+ int blen;
+ u_int len;
+ char *l;
+ } *llines;
+ int ch, rc;
+ char *p, *sp;
+ int blen, cnt, recno, wrap;
+
+ if ((llines = calloc(off, sizeof(*llines))) == NULL)
+ err(1, "calloc");
+ p = sp = NULL;
+ blen = cnt = recno = wrap = 0;
+ rc = 0;
+
+ while ((ch = getc(fp)) != EOF) {
+ if (++cnt > blen) {
+ if ((sp = realloc(sp, blen += 1024)) == NULL)
+ err(1, "realloc");
+ p = sp + cnt - 1;
+ }
+ *p++ = ch;
+ if (ch == '\n') {
+ if ((int)llines[recno].blen < cnt) {
+ llines[recno].blen = cnt + 256;
+ if ((llines[recno].l = realloc(llines[recno].l,
+ llines[recno].blen)) == NULL)
+ err(1, "realloc");
+ }
+ bcopy(sp, llines[recno].l, llines[recno].len = cnt);
+ cnt = 0;
+ p = sp;
+ if (++recno == off) {
+ wrap = 1;
+ recno = 0;
+ }
+ }
+ }
+ if (ferror(fp)) {
+ ierr(fn);
+ rc = 1;
+ goto done;
+ }
+ if (cnt) {
+ llines[recno].l = sp;
+ sp = NULL;
+ llines[recno].len = cnt;
+ if (++recno == off) {
+ wrap = 1;
+ recno = 0;
+ }
+ }
+
+ if (rflag) {
+ for (cnt = recno - 1; cnt >= 0; --cnt)
+ WR(llines[cnt].l, llines[cnt].len);
+ if (wrap)
+ for (cnt = off - 1; cnt >= recno; --cnt)
+ WR(llines[cnt].l, llines[cnt].len);
+ } else {
+ if (wrap)
+ for (cnt = recno; cnt < off; ++cnt)
+ WR(llines[cnt].l, llines[cnt].len);
+ for (cnt = 0; cnt < recno; ++cnt)
+ WR(llines[cnt].l, llines[cnt].len);
+ }
+done:
+ for (cnt = 0; cnt < off; cnt++)
+ free(llines[cnt].l);
+ free(sp);
+ free(llines);
+ return (rc);
+}
diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c
new file mode 100644
index 0000000..511f88c
--- /dev/null
+++ b/usr.bin/tail/reverse.c
@@ -0,0 +1,284 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+static void r_buf(FILE *, const char *);
+static void r_reg(FILE *, const char *, enum STYLE, off_t, struct stat *);
+
+/*
+ * reverse -- display input in reverse order by line.
+ *
+ * There are six separate cases for this -- regular and non-regular
+ * files by bytes, lines or the whole file.
+ *
+ * BYTES display N bytes
+ * REG mmap the file and display the lines
+ * NOREG cyclically read characters into a wrap-around buffer
+ *
+ * LINES display N lines
+ * REG mmap the file and display the lines
+ * NOREG cyclically read lines into a wrap-around array of buffers
+ *
+ * FILE display the entire file
+ * REG mmap the file and display the lines
+ * NOREG cyclically read input into a linked list of buffers
+ */
+void
+reverse(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp)
+{
+ if (style != REVERSE && off == 0)
+ return;
+
+ if (S_ISREG(sbp->st_mode))
+ r_reg(fp, fn, style, off, sbp);
+ else
+ switch(style) {
+ case FBYTES:
+ case RBYTES:
+ bytes(fp, fn, off);
+ break;
+ case FLINES:
+ case RLINES:
+ lines(fp, fn, off);
+ break;
+ case REVERSE:
+ r_buf(fp, fn);
+ break;
+ default:
+ break;
+ }
+}
+
+/*
+ * r_reg -- display a regular file in reverse order by line.
+ */
+static void
+r_reg(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp)
+{
+ struct mapinfo map;
+ off_t curoff, size, lineend;
+ int i;
+
+ if (!(size = sbp->st_size))
+ return;
+
+ map.start = NULL;
+ map.mapoff = map.maxoff = size;
+ map.fd = fileno(fp);
+
+ /*
+ * Last char is special, ignore whether newline or not. Note that
+ * size == 0 is dealt with above, and size == 1 sets curoff to -1.
+ */
+ curoff = size - 2;
+ lineend = size;
+ while (curoff >= 0) {
+ if (curoff < map.mapoff ||
+ curoff >= map.mapoff + (off_t)map.maplen) {
+ if (maparound(&map, curoff) != 0) {
+ ierr(fn);
+ return;
+ }
+ }
+ for (i = curoff - map.mapoff; i >= 0; i--) {
+ if (style == RBYTES && --off == 0)
+ break;
+ if (map.start[i] == '\n')
+ break;
+ }
+ /* `i' is either the map offset of a '\n', or -1. */
+ curoff = map.mapoff + i;
+ if (i < 0)
+ continue;
+
+ /* Print the line and update offsets. */
+ if (mapprint(&map, curoff + 1, lineend - curoff - 1) != 0) {
+ ierr(fn);
+ return;
+ }
+ lineend = curoff + 1;
+ curoff--;
+
+ if (style == RLINES)
+ off--;
+
+ if (off == 0 && style != REVERSE) {
+ /* Avoid printing anything below. */
+ curoff = 0;
+ break;
+ }
+ }
+ if (curoff < 0 && mapprint(&map, 0, lineend) != 0) {
+ ierr(fn);
+ return;
+ }
+ if (map.start != NULL && munmap(map.start, map.maplen))
+ ierr(fn);
+}
+
+typedef struct bf {
+ struct bf *next;
+ struct bf *prev;
+ int len;
+ char *l;
+} BF;
+
+/*
+ * r_buf -- display a non-regular file in reverse order by line.
+ *
+ * This is the function that saves the entire input, storing the data in a
+ * doubly linked list of buffers and then displays them in reverse order.
+ * It has the usual nastiness of trying to find the newlines, as there's no
+ * guarantee that a newline occurs anywhere in the file, let alone in any
+ * particular buffer. If we run out of memory, input is discarded (and the
+ * user warned).
+ */
+static void
+r_buf(FILE *fp, const char *fn)
+{
+ BF *mark, *tl, *tr;
+ int ch, len, llen;
+ char *p;
+ off_t enomem;
+
+ tl = NULL;
+#define BSZ (128 * 1024)
+ for (mark = NULL, enomem = 0;;) {
+ /*
+ * Allocate a new block and link it into place in a doubly
+ * linked list. If out of memory, toss the LRU block and
+ * keep going.
+ */
+ if (enomem || (tl = malloc(sizeof(BF))) == NULL ||
+ (tl->l = malloc(BSZ)) == NULL) {
+ if (!mark)
+ err(1, "malloc");
+ tl = enomem ? tl->next : mark;
+ enomem += tl->len;
+ } else if (mark) {
+ tl->next = mark;
+ tl->prev = mark->prev;
+ mark->prev->next = tl;
+ mark->prev = tl;
+ } else {
+ mark = tl;
+ mark->next = mark->prev = mark;
+ }
+
+ /* Fill the block with input data. */
+ for (p = tl->l, len = 0;
+ len < BSZ && (ch = getc(fp)) != EOF; ++len)
+ *p++ = ch;
+
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
+
+ /*
+ * If no input data for this block and we tossed some data,
+ * recover it.
+ */
+ if (!len && enomem) {
+ enomem -= tl->len;
+ tl = tl->prev;
+ break;
+ }
+
+ tl->len = len;
+ if (ch == EOF)
+ break;
+ }
+
+ if (enomem) {
+ warnx("warning: %jd bytes discarded", (intmax_t)enomem);
+ rval = 1;
+ }
+
+ /*
+ * Step through the blocks in the reverse order read. The last char
+ * is special, ignore whether newline or not.
+ */
+ for (mark = tl;;) {
+ for (p = tl->l + (len = tl->len) - 1, llen = 0; len--;
+ --p, ++llen)
+ if (*p == '\n') {
+ if (llen) {
+ WR(p + 1, llen);
+ llen = 0;
+ }
+ if (tl == mark)
+ continue;
+ for (tr = tl->next; tr->len; tr = tr->next) {
+ WR(tr->l, tr->len);
+ tr->len = 0;
+ if (tr == mark)
+ break;
+ }
+ }
+ tl->len = llen;
+ if ((tl = tl->prev) == mark)
+ break;
+ }
+ tl = tl->next;
+ if (tl->len) {
+ WR(tl->l, tl->len);
+ tl->len = 0;
+ }
+ while ((tl = tl->next)->len) {
+ WR(tl->l, tl->len);
+ tl->len = 0;
+ }
+}
diff --git a/usr.bin/tail/tail.1 b/usr.bin/tail/tail.1
new file mode 100644
index 0000000..35866f5
--- /dev/null
+++ b/usr.bin/tail/tail.1
@@ -0,0 +1,202 @@
+.\" Copyright (c) 1980, 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)tail.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd March 16, 2013
+.Dt TAIL 1
+.Os
+.Sh NAME
+.Nm tail
+.Nd display the last part of a file
+.Sh SYNOPSIS
+.Nm
+.Op Fl F | f | r
+.Op Fl q
+.Oo
+.Fl b Ar number | Fl c Ar number | Fl n Ar number
+.Oc
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the contents of
+.Ar file
+or, by default, its standard input, to the standard output.
+.Pp
+The display begins at a byte, line or 512-byte block location in the
+input.
+Numbers having a leading plus
+.Pq Ql +
+sign are relative to the beginning
+of the input, for example,
+.Dq Li "-c +2"
+starts the display at the second
+byte of the input.
+Numbers having a leading minus
+.Pq Ql -
+sign or no explicit sign are
+relative to the end of the input, for example,
+.Dq Li "-n 2"
+displays the last two lines of the input.
+The default starting location is
+.Dq Li "-n 10" ,
+or the last 10 lines of the input.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b Ar number
+The location is
+.Ar number
+512-byte blocks.
+.It Fl c Ar number
+The location is
+.Ar number
+bytes.
+.It Fl f
+The
+.Fl f
+option causes
+.Nm
+to not stop when end of file is reached, but rather to wait for additional
+data to be appended to the input.
+The
+.Fl f
+option is ignored if the standard input is a pipe, but not if it is a FIFO.
+.It Fl F
+The
+.Fl F
+option implies the
+.Fl f
+option, but
+.Nm
+will also check to see if the file being followed has been renamed or rotated.
+The file is closed and reopened when
+.Nm
+detects that the filename being read from has a new inode number.
+.Pp
+If the file being followed does not (yet) exist or if it is removed, tail
+will keep looking and will display the file from the beginning if and when
+it is created.
+.Pp
+The
+.Fl F
+option is the same as the
+.Fl f
+option if reading from standard input rather than a file.
+.It Fl n Ar number
+The location is
+.Ar number
+lines.
+.It Fl q
+Suppresses printing of headers when multiple files are being examined.
+.It Fl r
+The
+.Fl r
+option causes the input to be displayed in reverse order, by line.
+Additionally, this option changes the meaning of the
+.Fl b , c
+and
+.Fl n
+options.
+When the
+.Fl r
+option is specified, these options specify the number of bytes, lines
+or 512-byte blocks to display, instead of the bytes, lines or blocks
+from the beginning or end of the input from which to begin the display.
+The default for the
+.Fl r
+option is to display all of the input.
+.El
+.Pp
+If more than a single file is specified, each file is preceded by a
+header consisting of the string
+.Dq Li "==> " Ns Ar XXX Ns Li " <=="
+where
+.Ar XXX
+is the name of the file unless
+.Fl q
+flag is specified.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+To display the last 500 lines of the file
+.Ar foo :
+.Pp
+.Dl $ tail -n 500 foo
+.Pp
+Keep
+.Pa /var/log/messages
+open, displaying to the standard output anything appended to the file:
+.Pp
+.Dl $ tail -f /var/log/messages
+.Sh SEE ALSO
+.Xr cat 1 ,
+.Xr head 1 ,
+.Xr sed 1
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be a superset of the
+.St -p1003.2-92
+specification.
+In particular, the
+.Fl F ,
+.Fl b
+and
+.Fl r
+options are extensions to that standard.
+.Pp
+The historic command line syntax of
+.Nm
+is supported by this implementation.
+The only difference between this implementation and historic versions
+of
+.Nm ,
+once the command line syntax translation has been done, is that the
+.Fl b ,
+.Fl c
+and
+.Fl n
+options modify the
+.Fl r
+option, i.e.,
+.Dq Li "-r -c 4"
+displays the last 4 characters of the last line
+of the input, while the historic tail (using the historic syntax
+.Dq Li -4cr )
+would ignore the
+.Fl c
+option and display the last 4 lines of the input.
+.Sh HISTORY
+A
+.Nm
+command appeared in PWB UNIX.
diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c
new file mode 100644
index 0000000..e5566cb
--- /dev/null
+++ b/usr.bin/tail/tail.c
@@ -0,0 +1,336 @@
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+int Fflag, fflag, qflag, rflag, rval, no_files;
+
+static file_info_t *files;
+
+static void obsolete(char **);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ const char *fn;
+ FILE *fp;
+ off_t off;
+ enum STYLE style;
+ int i, ch, first;
+ file_info_t *file;
+ char *p;
+
+ /*
+ * Tail's options are weird. First, -n10 is the same as -n-10, not
+ * -n+10. Second, the number options are 1 based and not offsets,
+ * so -n+1 is the first line, and -c-1 is the last byte. Third, the
+ * number options for the -r option specify the number of things that
+ * get displayed, not the starting point in the file. The one major
+ * incompatibility in this version as compared to historical versions
+ * is that the 'r' option couldn't be modified by the -lbc options,
+ * i.e. it was always done in lines. This version treats -rc as a
+ * number of characters in reverse order. Finally, the default for
+ * -r is the entire file, not 10 lines.
+ */
+#define ARG(units, forward, backward) { \
+ if (style) \
+ usage(); \
+ off = strtoll(optarg, &p, 10) * (units); \
+ if (*p) \
+ errx(1, "illegal offset -- %s", optarg); \
+ switch(optarg[0]) { \
+ case '+': \
+ if (off) \
+ off -= (units); \
+ style = (forward); \
+ break; \
+ case '-': \
+ off = -off; \
+ /* FALLTHROUGH */ \
+ default: \
+ style = (backward); \
+ break; \
+ } \
+}
+
+ obsolete(argv);
+ style = NOTSET;
+ off = 0;
+ while ((ch = getopt(argc, argv, "Fb:c:fn:qr")) != -1)
+ switch(ch) {
+ case 'F': /* -F is superset of (and implies) -f */
+ Fflag = fflag = 1;
+ break;
+ case 'b':
+ ARG(512, FBYTES, RBYTES);
+ break;
+ case 'c':
+ ARG(1, FBYTES, RBYTES);
+ break;
+ case 'f':
+ fflag = 1;
+ break;
+ case 'n':
+ ARG(1, FLINES, RLINES);
+ break;
+ case 'q':
+ qflag = 1;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ no_files = argc ? argc : 1;
+
+ /*
+ * If displaying in reverse, don't permit follow option, and convert
+ * style values.
+ */
+ if (rflag) {
+ if (fflag)
+ usage();
+ if (style == FBYTES)
+ style = RBYTES;
+ else if (style == FLINES)
+ style = RLINES;
+ }
+
+ /*
+ * If style not specified, the default is the whole file for -r, and
+ * the last 10 lines if not -r.
+ */
+ if (style == NOTSET) {
+ if (rflag) {
+ off = 0;
+ style = REVERSE;
+ } else {
+ off = 10;
+ style = RLINES;
+ }
+ }
+
+ if (*argv && fflag) {
+ files = (struct file_info *) malloc(no_files *
+ sizeof(struct file_info));
+ if (!files)
+ err(1, "Couldn't malloc space for file descriptors.");
+
+ for (file = files; (fn = *argv++); file++) {
+ file->file_name = strdup(fn);
+ if (! file->file_name)
+ errx(1, "Couldn't malloc space for file name.");
+ if ((file->fp = fopen(file->file_name, "r")) == NULL ||
+ fstat(fileno(file->fp), &file->st)) {
+ if (file->fp != NULL) {
+ fclose(file->fp);
+ file->fp = NULL;
+ }
+ if (!Fflag || errno != ENOENT)
+ ierr(file->file_name);
+ }
+ }
+ follow(files, style, off);
+ for (i = 0, file = files; i < no_files; i++, file++) {
+ free(file->file_name);
+ }
+ free(files);
+ } else if (*argv) {
+ for (first = 1; (fn = *argv++);) {
+ if ((fp = fopen(fn, "r")) == NULL ||
+ fstat(fileno(fp), &sb)) {
+ ierr(fn);
+ continue;
+ }
+ if (argc > 1 && !qflag) {
+ printfn(fn, !first);
+ first = 0;
+ }
+
+ if (rflag)
+ reverse(fp, fn, style, off, &sb);
+ else
+ forward(fp, fn, style, off, &sb);
+ }
+ } else {
+ fn = "stdin";
+
+ if (fstat(fileno(stdin), &sb)) {
+ ierr(fn);
+ exit(1);
+ }
+
+ /*
+ * Determine if input is a pipe. 4.4BSD will set the SOCKET
+ * bit in the st_mode field for pipes. Fix this then.
+ */
+ if (lseek(fileno(stdin), (off_t)0, SEEK_CUR) == -1 &&
+ errno == ESPIPE) {
+ errno = 0;
+ fflag = 0; /* POSIX.2 requires this. */
+ }
+
+ if (rflag)
+ reverse(stdin, fn, style, off, &sb);
+ else
+ forward(stdin, fn, style, off, &sb);
+ }
+ exit(rval);
+}
+
+/*
+ * Convert the obsolete argument form into something that getopt can handle.
+ * This means that anything of the form [+-][0-9][0-9]*[lbc][Ffr] that isn't
+ * the option argument for a -b, -c or -n option gets converted.
+ */
+static void
+obsolete(char *argv[])
+{
+ char *ap, *p, *t;
+ size_t len;
+ char *start;
+
+ while ((ap = *++argv)) {
+ /* Return if "--" or not an option of any form. */
+ if (ap[0] != '-') {
+ if (ap[0] != '+')
+ return;
+ } else if (ap[1] == '-')
+ return;
+
+ switch(*++ap) {
+ /* Old-style option. */
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+
+ /* Malloc space for dash, new option and argument. */
+ len = strlen(*argv);
+ if ((start = p = malloc(len + 3)) == NULL)
+ err(1, "malloc");
+ *p++ = '-';
+
+ /*
+ * Go to the end of the option argument. Save off any
+ * trailing options (-3lf) and translate any trailing
+ * output style characters.
+ */
+ t = *argv + len - 1;
+ if (*t == 'F' || *t == 'f' || *t == 'r') {
+ *p++ = *t;
+ *t-- = '\0';
+ }
+ switch(*t) {
+ case 'b':
+ *p++ = 'b';
+ *t = '\0';
+ break;
+ case 'c':
+ *p++ = 'c';
+ *t = '\0';
+ break;
+ case 'l':
+ *t = '\0';
+ /* FALLTHROUGH */
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ *p++ = 'n';
+ break;
+ default:
+ errx(1, "illegal option -- %s", *argv);
+ }
+ *p++ = *argv[0];
+ (void)strcpy(p, ap);
+ *argv = start;
+ continue;
+
+ /*
+ * Options w/ arguments, skip the argument and continue
+ * with the next option.
+ */
+ case 'b':
+ case 'c':
+ case 'n':
+ if (!ap[1])
+ ++argv;
+ /* FALLTHROUGH */
+ /* Options w/o arguments, continue with the next option. */
+ case 'F':
+ case 'f':
+ case 'r':
+ continue;
+
+ /* Illegal option, return and let getopt handle it. */
+ default:
+ return;
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #]"
+ " [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/talk/Makefile b/usr.bin/talk/Makefile
new file mode 100644
index 0000000..f595be8
--- /dev/null
+++ b/usr.bin/talk/Makefile
@@ -0,0 +1,10 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= talk
+SRCS= ctl.c ctl_transact.c display.c get_addrs.c get_iface.c get_names.c \
+ init_disp.c invite.c io.c look_up.c msgs.c talk.c
+
+LIBADD= ncursesw
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/talk/Makefile.depend b/usr.bin/talk/Makefile.depend
new file mode 100644
index 0000000..618a09d
--- /dev/null
+++ b/usr.bin/talk/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/protocols \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c
new file mode 100644
index 0000000..0704b28
--- /dev/null
+++ b/usr.bin/talk/ctl.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)ctl.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * This file handles haggling with the various talk daemons to
+ * get a socket to talk to. sockt is opened and connected in
+ * the progress
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <string.h>
+
+#include "talk.h"
+#include "talk_ctl.h"
+
+struct sockaddr_in daemon_addr = { .sin_len = sizeof(daemon_addr), .sin_family = AF_INET };
+struct sockaddr_in ctl_addr = { .sin_len = sizeof(ctl_addr), .sin_family = AF_INET };
+struct sockaddr_in my_addr = { .sin_len = sizeof(my_addr), .sin_family = AF_INET };
+
+ /* inet addresses of the two machines */
+struct in_addr my_machine_addr;
+struct in_addr his_machine_addr;
+
+u_short daemon_port; /* port number of the talk daemon */
+
+int ctl_sockt;
+int sockt;
+int invitation_waiting = 0;
+
+CTL_MSG msg;
+
+void
+open_sockt(void)
+{
+ socklen_t length;
+
+ (void)memset(&my_addr, 0, sizeof(my_addr));
+ my_addr.sin_family = AF_INET;
+ my_addr.sin_len = sizeof(my_addr);
+ my_addr.sin_addr = my_machine_addr;
+ my_addr.sin_port = 0;
+ sockt = socket(AF_INET, SOCK_STREAM, 0);
+ if (sockt == -1)
+ p_error("Bad socket");
+ if (bind(sockt, (struct sockaddr *)&my_addr, sizeof(my_addr)) != 0)
+ p_error("Binding local socket");
+ length = sizeof(my_addr);
+ if (getsockname(sockt, (struct sockaddr *)&my_addr, &length) == -1)
+ p_error("Bad address for socket");
+}
+
+/* open the ctl socket */
+void
+open_ctl(void)
+{
+ socklen_t length;
+
+ (void)memset(&ctl_addr, 0, sizeof(ctl_addr));
+ ctl_addr.sin_family = AF_INET;
+ ctl_addr.sin_len = sizeof(my_addr);
+ ctl_addr.sin_port = 0;
+ ctl_addr.sin_addr = my_machine_addr;
+ ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
+ if (ctl_sockt == -1)
+ p_error("Bad socket");
+ if (bind(ctl_sockt,
+ (struct sockaddr *)&ctl_addr, sizeof(ctl_addr)) != 0)
+ p_error("Couldn't bind to control socket");
+ length = sizeof(ctl_addr);
+ if (getsockname(ctl_sockt,
+ (struct sockaddr *)&ctl_addr, &length) == -1)
+ p_error("Bad address for ctl socket");
+}
+
+/* print_addr is a debug print routine */
+void
+print_addr(struct sockaddr_in addr)
+{
+ int i;
+
+ printf("addr = %lx, port = %o, family = %o zero = ",
+ (u_long)addr.sin_addr.s_addr, addr.sin_port, addr.sin_family);
+ for (i = 0; i<8;i++)
+ printf("%o ", (int)addr.sin_zero[i]);
+ putchar('\n');
+}
diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c
new file mode 100644
index 0000000..687de1e
--- /dev/null
+++ b/usr.bin/talk/ctl_transact.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <poll.h>
+
+#include "talk.h"
+#include "talk_ctl.h"
+
+#define CTL_WAIT 2 /* time to wait for a response, in seconds */
+
+/*
+ * SOCKDGRAM is unreliable, so we must repeat messages if we have
+ * not received an acknowledgement within a reasonable amount
+ * of time
+ */
+void
+ctl_transact(struct in_addr target, CTL_MSG lmsg, int type, CTL_RESPONSE *rp)
+{
+ struct pollfd pfd[1];
+ int nready = 0, cc;
+
+ lmsg.type = type;
+ daemon_addr.sin_addr = target;
+ daemon_addr.sin_port = daemon_port;
+ pfd[0].fd = ctl_sockt;
+ pfd[0].events = POLLIN;
+
+ /*
+ * Keep sending the message until a response of
+ * the proper type is obtained.
+ */
+ do {
+ /* resend message until a response is obtained */
+ do {
+ cc = sendto(ctl_sockt, (char *)&lmsg, sizeof (lmsg), 0,
+ (struct sockaddr *)&daemon_addr,
+ sizeof (daemon_addr));
+ if (cc != sizeof (lmsg)) {
+ if (errno == EINTR)
+ continue;
+ p_error("Error on write to talk daemon");
+ }
+ nready = poll(pfd, 1, CTL_WAIT * 1000);
+ if (nready < 0) {
+ if (errno == EINTR)
+ continue;
+ p_error("Error waiting for daemon response");
+ }
+ } while (nready == 0);
+ /*
+ * Keep reading while there are queued messages
+ * (this is not necessary, it just saves extra
+ * request/acknowledgements being sent)
+ */
+ do {
+ cc = recv(ctl_sockt, (char *)rp, sizeof (*rp), 0);
+ if (cc < 0) {
+ if (errno == EINTR)
+ continue;
+ p_error("Error on read from talk daemon");
+ }
+ nready = poll(pfd, 1, 0);
+ } while (nready > 0 && (rp->vers != TALK_VERSION ||
+ rp->type != type));
+ } while (rp->vers != TALK_VERSION || rp->type != type);
+ rp->id_num = ntohl(rp->id_num);
+ rp->addr.sa_family = ntohs(rp->addr.sa_family);
+}
diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c
new file mode 100644
index 0000000..0acf1ce
--- /dev/null
+++ b/usr.bin/talk/display.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * The window 'manager', initializes curses and handles the actual
+ * displaying of text
+ */
+#include <ctype.h>
+#include <unistd.h>
+#include <wctype.h>
+#define _XOPEN_SOURCE_EXTENDED
+#include <curses.h>
+
+#include "talk.h"
+
+void display(xwin_t *, wchar_t *);
+
+xwin_t my_win;
+xwin_t his_win;
+WINDOW *line_win;
+
+int curses_initialized = 0;
+
+/*
+ * max HAS to be a function, it is called with
+ * an argument of the form --foo at least once.
+ */
+int
+max(int a, int b)
+{
+
+ return (a > b ? a : b);
+}
+
+static cchar_t *
+makecchar(wchar_t in)
+{
+ static cchar_t cc;
+ wchar_t wc[2];
+
+ wc[0] = in;
+ wc[1] = L'\0';
+
+ if (setcchar(&cc, wc, A_NORMAL, 0, NULL) != OK)
+ p_error("settchar(3) failure");
+
+ return (&cc);
+}
+
+/*
+ * Display a symbol on somebody's window, processing some control
+ * characters while we are at it.
+ */
+void
+display(xwin_t *win, wchar_t *wc)
+{
+
+ /*
+ * Alas, can't use variables in C switch statement.
+ * Workaround these 3 cases with goto.
+ */
+ if (*wc == win->kill)
+ goto kill;
+ else if (*wc == win->cerase)
+ goto cerase;
+ else if (*wc == win->werase)
+ goto werase;
+
+ switch (*wc) {
+ case L'\n':
+ case L'\r':
+ wadd_wch(win->x_win, makecchar(L'\n'));
+ getyx(win->x_win, win->x_line, win->x_col);
+ wrefresh(win->x_win);
+ return;
+
+ case 004:
+ if (win == &my_win) {
+ /* Ctrl-D clears the screen. */
+ werase(my_win.x_win);
+ getyx(my_win.x_win, my_win.x_line, my_win.x_col);
+ wrefresh(my_win.x_win);
+ werase(his_win.x_win);
+ getyx(his_win.x_win, his_win.x_line, his_win.x_col);
+ wrefresh(his_win.x_win);
+ }
+ return;
+
+ /* Erase character. */
+ case 010: /* BS */
+ case 0177: /* DEL */
+cerase:
+ wmove(win->x_win, win->x_line, max(--win->x_col, 0));
+ getyx(win->x_win, win->x_line, win->x_col);
+ waddch(win->x_win, ' ');
+ wmove(win->x_win, win->x_line, win->x_col);
+ getyx(win->x_win, win->x_line, win->x_col);
+ wrefresh(win->x_win);
+ return;
+
+ case 027: /* ^W */
+werase:
+ {
+ /*
+ * On word erase search backwards until we find
+ * the beginning of a word or the beginning of
+ * the line.
+ */
+ int endcol, xcol, c;
+
+ endcol = win->x_col;
+ xcol = endcol - 1;
+ while (xcol >= 0) {
+ c = readwin(win->x_win, win->x_line, xcol);
+ if (c != ' ')
+ break;
+ xcol--;
+ }
+ while (xcol >= 0) {
+ c = readwin(win->x_win, win->x_line, xcol);
+ if (c == ' ')
+ break;
+ xcol--;
+ }
+ wmove(win->x_win, win->x_line, xcol + 1);
+ for (int i = xcol + 1; i < endcol; i++)
+ waddch(win->x_win, ' ');
+ wmove(win->x_win, win->x_line, xcol + 1);
+ getyx(win->x_win, win->x_line, win->x_col);
+ wrefresh(win->x_win);
+ return;
+ }
+
+ case 025: /* ^U */
+kill:
+ wmove(win->x_win, win->x_line, 0);
+ wclrtoeol(win->x_win);
+ getyx(win->x_win, win->x_line, win->x_col);
+ wrefresh(win->x_win);
+ return;
+
+ case L'\f':
+ if (win == &my_win)
+ wrefresh(curscr);
+ return;
+
+ case L'\7':
+ write(STDOUT_FILENO, wc, sizeof(*wc));
+ return;
+ }
+
+
+ if (iswprint(*wc) || *wc == L'\t')
+ wadd_wch(win->x_win, makecchar(*wc));
+ else
+ beep();
+
+ getyx(win->x_win, win->x_line, win->x_col);
+ wrefresh(win->x_win);
+}
+
+/*
+ * Read the character at the indicated position in win
+ */
+int
+readwin(WINDOW *win, int line, int col)
+{
+ int oldline, oldcol;
+ int c;
+
+ getyx(win, oldline, oldcol);
+ wmove(win, line, col);
+ c = winch(win);
+ wmove(win, oldline, oldcol);
+ return (c);
+}
diff --git a/usr.bin/talk/get_addrs.c b/usr.bin/talk/get_addrs.c
new file mode 100644
index 0000000..b2af685
--- /dev/null
+++ b/usr.bin/talk/get_addrs.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <err.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "talk.h"
+#include "talk_ctl.h"
+
+void
+get_addrs(const char *my_machine_name __unused, const char *his_machine_name)
+{
+ struct hostent *hp;
+ struct servent *sp;
+
+ msg.pid = htonl(getpid());
+
+ hp = gethostbyname(his_machine_name);
+ if (hp == NULL)
+ errx(1, "%s: %s", his_machine_name, hstrerror(h_errno));
+ bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
+ if (get_iface(&his_machine_addr, &my_machine_addr) == -1)
+ err(1, "failed to find my interface address");
+ /* find the server's port */
+ sp = getservbyname("ntalk", "udp");
+ if (sp == NULL)
+ errx(1, "ntalk/udp: service is not registered");
+ daemon_port = sp->s_port;
+}
diff --git a/usr.bin/talk/get_iface.c b/usr.bin/talk/get_iface.c
new file mode 100644
index 0000000..96d3d6e
--- /dev/null
+++ b/usr.bin/talk/get_iface.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright 1994, 1995 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. 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$");
+
+/*
+ * From:
+ * Id: find_interface.c,v 1.1 1995/08/14 16:08:39 wollman Exp
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "talk.h"
+
+/*
+ * Try to find the interface address that is used to route an IP
+ * packet to a remote peer.
+ */
+
+int
+get_iface(struct in_addr *dst, struct in_addr *iface)
+{
+ static struct sockaddr_in local;
+ struct sockaddr_in remote;
+ socklen_t namelen;
+ int s, rv;
+
+ memcpy(&remote.sin_addr, dst, sizeof remote.sin_addr);
+ remote.sin_port = htons(60000);
+ remote.sin_family = AF_INET;
+ remote.sin_len = sizeof remote;
+
+ local.sin_addr.s_addr = htonl(INADDR_ANY);
+ local.sin_port = htons(60000);
+ local.sin_family = AF_INET;
+ local.sin_len = sizeof local;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ return -1;
+
+ do {
+ rv = bind(s, (struct sockaddr *)&local, sizeof local);
+ local.sin_port = htons(ntohs(local.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0) {
+ close(s);
+ return -1;
+ }
+
+ do {
+ rv = connect(s, (struct sockaddr *)&remote, sizeof remote);
+ remote.sin_port = htons(ntohs(remote.sin_port) + 1);
+ } while(rv < 0 && errno == EADDRINUSE);
+
+ if (rv < 0) {
+ close(s);
+ return -1;
+ }
+
+ namelen = sizeof local;
+ rv = getsockname(s, (struct sockaddr *)&local, &namelen);
+ close(s);
+ if (rv < 0)
+ return -1;
+
+ memcpy(iface, &local.sin_addr, sizeof local.sin_addr);
+ return 0;
+}
diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c
new file mode 100644
index 0000000..8da8e4a
--- /dev/null
+++ b/usr.bin/talk/get_names.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)get_names.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/param.h>
+
+#include <err.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "talk.h"
+
+extern CTL_MSG msg;
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: talk person [ttyname]\n");
+ exit(1);
+}
+
+/*
+ * Determine the local and remote user, tty, and machines
+ */
+void
+get_names(int argc, char *argv[])
+{
+ char hostname[MAXHOSTNAMELEN];
+ char *his_name, *my_name;
+ const char *my_machine_name, *his_machine_name;
+ const char *his_tty;
+ char *cp;
+
+ if (argc < 2 )
+ usage();
+ if (!isatty(0))
+ errx(1, "standard input must be a tty, not a pipe or a file");
+ if ((my_name = getlogin()) == NULL) {
+ struct passwd *pw;
+
+ if ((pw = getpwuid(getuid())) == NULL)
+ errx(1, "you don't exist. Go away");
+ my_name = pw->pw_name;
+ }
+ gethostname(hostname, sizeof (hostname));
+ my_machine_name = hostname;
+ /* check for, and strip out, the machine name of the target */
+ cp = argv[1] + strcspn(argv[1], "@:!");
+ if (*cp == '\0') {
+ /* this is a local to local talk */
+ his_name = argv[1];
+ my_machine_name = his_machine_name = "localhost";
+ } else {
+ if (*cp++ == '@') {
+ /* user@host */
+ his_name = argv[1];
+ his_machine_name = cp;
+ } else {
+ /* host!user or host:user */
+ his_name = cp;
+ his_machine_name = argv[1];
+ }
+ *--cp = '\0';
+ }
+ if (argc > 2)
+ his_tty = argv[2]; /* tty name is arg 2 */
+ else
+ his_tty = "";
+ get_addrs(my_machine_name, his_machine_name);
+ /*
+ * Initialize the message template.
+ */
+ msg.vers = TALK_VERSION;
+ msg.addr.sa_family = htons(AF_INET);
+ msg.ctl_addr.sa_family = htons(AF_INET);
+ msg.id_num = htonl(0);
+ strlcpy(msg.l_name, my_name, NAME_SIZE);
+ strlcpy(msg.r_name, his_name, NAME_SIZE);
+ strlcpy(msg.r_tty, his_tty, TTY_SIZE);
+}
diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c
new file mode 100644
index 0000000..47556c9
--- /dev/null
+++ b/usr.bin/talk/init_disp.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
+#endif
+
+/*
+ * Initialization code for the display package,
+ * as well as the signal handling routines.
+ */
+
+#include <sys/stat.h>
+
+#include <err.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+
+#include "talk.h"
+
+/*
+ * Make sure the callee can write to the screen
+ */
+void
+check_writeable(void)
+{
+ char *tty;
+ struct stat sb;
+
+ if ((tty = ttyname(STDERR_FILENO)) == NULL)
+ err(1, "ttyname");
+ if (stat(tty, &sb) < 0)
+ err(1, "%s", tty);
+ if (!(sb.st_mode & S_IWGRP))
+ errx(1, "The callee cannot write to this terminal, use \"mesg y\".");
+}
+
+/*
+ * Set up curses, catch the appropriate signals,
+ * and build the various windows.
+ */
+void
+init_display(void)
+{
+ struct sigaction sa;
+
+ if (initscr() == NULL)
+ errx(1, "Terminal type unset or lacking necessary features.");
+ (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
+ sigaddset(&sa.sa_mask, SIGALRM);
+ (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
+ curses_initialized = 1;
+ clear();
+ refresh();
+ noecho();
+ crmode();
+ signal(SIGINT, sig_sent);
+ signal(SIGPIPE, sig_sent);
+ signal(SIGWINCH, sig_winch);
+ /* curses takes care of ^Z */
+ my_win.x_nlines = LINES / 2;
+ my_win.x_ncols = COLS;
+ my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0);
+ idlok(my_win.x_win, TRUE);
+ scrollok(my_win.x_win, TRUE);
+ wclear(my_win.x_win);
+
+ his_win.x_nlines = LINES / 2 - 1;
+ his_win.x_ncols = COLS;
+ his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
+ my_win.x_nlines+1, 0);
+ idlok(my_win.x_win, TRUE);
+ scrollok(his_win.x_win, TRUE);
+ wclear(his_win.x_win);
+
+ line_win = newwin(1, COLS, my_win.x_nlines, 0);
+#if defined(hline) || defined(whline) || defined(NCURSES_VERSION)
+ whline(line_win, 0, COLS);
+#else
+ box(line_win, '-', '-');
+#endif
+ wrefresh(line_win);
+ /* let them know we are working on it */
+ current_state = "No connection yet";
+}
+
+/*
+ * Trade edit characters with the other talk. By agreement
+ * the first three characters each talk transmits after
+ * connection are the three edit characters.
+ */
+void
+set_edit_chars(void)
+{
+ char buf[3];
+ int cc;
+ struct termios tio;
+
+ tcgetattr(0, &tio);
+ my_win.cerase = tio.c_cc[VERASE];
+ my_win.kill = tio.c_cc[VKILL];
+ my_win.werase = tio.c_cc[VWERASE];
+ if (my_win.cerase == (char)_POSIX_VDISABLE)
+ my_win.kill = CERASE;
+ if (my_win.kill == (char)_POSIX_VDISABLE)
+ my_win.kill = CKILL;
+ if (my_win.werase == (char)_POSIX_VDISABLE)
+ my_win.werase = CWERASE;
+ buf[0] = my_win.cerase;
+ buf[1] = my_win.kill;
+ buf[2] = my_win.werase;
+ cc = write(sockt, buf, sizeof(buf));
+ if (cc != sizeof(buf) )
+ p_error("Lost the connection");
+ cc = read(sockt, buf, sizeof(buf));
+ if (cc != sizeof(buf) )
+ p_error("Lost the connection");
+ his_win.cerase = buf[0];
+ his_win.kill = buf[1];
+ his_win.werase = buf[2];
+}
+
+/* ARGSUSED */
+void
+sig_sent(int signo __unused)
+{
+
+ message("Connection closing. Exiting");
+ quit();
+}
+
+void
+sig_winch(int dummy __unused)
+{
+
+ gotwinch = 1;
+}
+
+/*
+ * All done talking...hang up the phone and reset terminal thingy's
+ */
+void
+quit(void)
+{
+
+ if (curses_initialized) {
+ wmove(his_win.x_win, his_win.x_nlines-1, 0);
+ wclrtoeol(his_win.x_win);
+ wrefresh(his_win.x_win);
+ endwin();
+ }
+ if (invitation_waiting)
+ send_delete();
+ exit(0);
+}
+
+/*
+ * If we get SIGWINCH, recompute both window sizes and refresh things.
+ */
+void
+resize_display(void)
+{
+ struct winsize ws;
+
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0 ||
+ (ws.ws_row == LINES && ws.ws_col == COLS))
+ return;
+
+ /* Update curses' internal state with new window size. */
+ resizeterm(ws.ws_row, ws.ws_col);
+
+ /*
+ * Resize each window but wait to refresh the screen until
+ * everything has been drawn so the cursor is in the right spot.
+ */
+ my_win.x_nlines = LINES / 2;
+ my_win.x_ncols = COLS;
+ wresize(my_win.x_win, my_win.x_nlines, my_win.x_ncols);
+ mvwin(my_win.x_win, 0, 0);
+ clearok(my_win.x_win, TRUE);
+
+ his_win.x_nlines = LINES / 2 - 1;
+ his_win.x_ncols = COLS;
+ wresize(his_win.x_win, his_win.x_nlines, his_win.x_ncols);
+ mvwin(his_win.x_win, my_win.x_nlines + 1, 0);
+ clearok(his_win.x_win, TRUE);
+
+ wresize(line_win, 1, COLS);
+ mvwin(line_win, my_win.x_nlines, 0);
+#if defined(NCURSES_VERSION) || defined(whline)
+ whline(line_win, '-', COLS);
+#else
+ wmove(line_win, my_win.x_nlines, 0);
+ box(line_win, '-', '-');
+#endif
+
+ /* Now redraw the screen. */
+ wrefresh(his_win.x_win);
+ wrefresh(line_win);
+ wrefresh(my_win.x_win);
+}
diff --git a/usr.bin/talk/invite.c b/usr.bin/talk/invite.c
new file mode 100644
index 0000000..e48302f
--- /dev/null
+++ b/usr.bin/talk/invite.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)invite.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <protocols/talkd.h>
+
+#include <err.h>
+#include <errno.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include "talk_ctl.h"
+#include "talk.h"
+
+/*
+ * There wasn't an invitation waiting, so send a request containing
+ * our sockt address to the remote talk daemon so it can invite
+ * him
+ */
+
+/*
+ * The msg.id's for the invitations
+ * on the local and remote machines.
+ * These are used to delete the
+ * invitations.
+ */
+static int local_id, remote_id;
+static jmp_buf invitebuf;
+
+void
+invite_remote(void)
+{
+ int new_sockt;
+ struct itimerval itimer;
+ CTL_RESPONSE response;
+
+ itimer.it_value.tv_sec = RING_WAIT;
+ itimer.it_value.tv_usec = 0;
+ itimer.it_interval = itimer.it_value;
+ if (listen(sockt, 5) != 0)
+ p_error("Error on attempt to listen for caller");
+#ifdef MSG_EOR
+ /* copy new style sockaddr to old, swap family (short in old) */
+ msg.addr = *(struct osockaddr *)&my_addr; /* XXX new to old style*/
+ msg.addr.sa_family = htons(my_addr.sin_family);
+#else
+ msg.addr = *(struct sockaddr *)&my_addr;
+#endif
+ msg.id_num = htonl(-1); /* an impossible id_num */
+ invitation_waiting = 1;
+ announce_invite();
+ /*
+ * Shut off the automatic messages for a while,
+ * so we can use the interrupt timer to resend the invitation
+ */
+ end_msgs();
+ setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+ message("Waiting for your party to respond");
+ signal(SIGALRM, re_invite);
+ (void) setjmp(invitebuf);
+ while ((new_sockt = accept(sockt, 0, 0)) < 0) {
+ if (errno == EINTR)
+ continue;
+ p_error("Unable to connect with your party");
+ }
+ close(sockt);
+ sockt = new_sockt;
+
+ /*
+ * Have the daemons delete the invitations now that we
+ * have connected.
+ */
+ current_state = "Waiting for your party to respond";
+ start_msgs();
+
+ msg.id_num = htonl(local_id);
+ ctl_transact(my_machine_addr, msg, DELETE, &response);
+ msg.id_num = htonl(remote_id);
+ ctl_transact(his_machine_addr, msg, DELETE, &response);
+ invitation_waiting = 0;
+}
+
+/*
+ * Routine called on interrupt to re-invite the callee
+ */
+/* ARGSUSED */
+void
+re_invite(int signo __unused)
+{
+
+ message("Ringing your party again");
+ waddch(my_win.x_win, '\n');
+ if (current_line < my_win.x_nlines - 1)
+ current_line++;
+ /* force a re-announce */
+ msg.id_num = htonl(remote_id + 1);
+ announce_invite();
+ longjmp(invitebuf, 1);
+}
+
+static const char *answers[] = {
+ "answer #0", /* SUCCESS */
+ "Your party is not logged on", /* NOT_HERE */
+ "Target machine is too confused to talk to us", /* FAILED */
+ "Target machine does not recognize us", /* MACHINE_UNKNOWN */
+ "Your party is refusing messages", /* PERMISSION_REFUSED */
+ "Target machine can not handle remote talk", /* UNKNOWN_REQUEST */
+ "Target machine indicates protocol mismatch", /* BADVERSION */
+ "Target machine indicates protocol botch (addr)",/* BADADDR */
+ "Target machine indicates protocol botch (ctl_addr)",/* BADCTLADDR */
+};
+#define NANSWERS (sizeof (answers) / sizeof (answers[0]))
+
+/*
+ * Transmit the invitation and process the response
+ */
+void
+announce_invite(void)
+{
+ CTL_RESPONSE response;
+
+ current_state = "Trying to connect to your party's talk daemon";
+ ctl_transact(his_machine_addr, msg, ANNOUNCE, &response);
+ remote_id = response.id_num;
+ if (response.answer != SUCCESS) {
+ if (response.answer < NANSWERS)
+ message(answers[response.answer]);
+ quit();
+ }
+ /* leave the actual invitation on my talk daemon */
+ current_state = "Trying to connect to local talk daemon";
+ ctl_transact(my_machine_addr, msg, LEAVE_INVITE, &response);
+ local_id = response.id_num;
+}
+
+/*
+ * Tell the daemon to remove your invitation
+ */
+void
+send_delete(void)
+{
+
+ msg.type = DELETE;
+ /*
+ * This is just an extra clean up, so just send it
+ * and don't wait for an answer
+ */
+ msg.id_num = htonl(remote_id);
+ daemon_addr.sin_addr = his_machine_addr;
+ if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
+ (struct sockaddr *)&daemon_addr,
+ sizeof (daemon_addr)) != sizeof(msg))
+ warn("send_delete (remote)");
+ msg.id_num = htonl(local_id);
+ daemon_addr.sin_addr = my_machine_addr;
+ if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
+ (struct sockaddr *)&daemon_addr,
+ sizeof (daemon_addr)) != sizeof (msg))
+ warn("send_delete (local)");
+}
diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
new file mode 100644
index 0000000..eb5df61
--- /dev/null
+++ b/usr.bin/talk/io.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * This file contains the I/O handling and the exchange of
+ * edit characters. This connection itself is established in
+ * ctl.c
+ */
+
+#include <sys/filio.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <netdb.h>
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#define _XOPEN_SOURCE_EXTENDED
+#include <curses.h>
+
+#include "talk.h"
+#include "talk_ctl.h"
+
+extern void display(xwin_t *, wchar_t *);
+
+volatile sig_atomic_t gotwinch = 0;
+
+/*
+ * The routine to do the actual talking
+ */
+void
+talk(void)
+{
+ struct hostent *hp, *hp2;
+ struct pollfd fds[2];
+ int nb;
+ wchar_t buf[BUFSIZ];
+ char **addr, *his_machine_name;
+ FILE *sockfp;
+
+ his_machine_name = NULL;
+ hp = gethostbyaddr((const char *)&his_machine_addr.s_addr,
+ sizeof(his_machine_addr.s_addr), AF_INET);
+ if (hp != NULL) {
+ hp2 = gethostbyname(hp->h_name);
+ if (hp2 != NULL && hp2->h_addrtype == AF_INET &&
+ hp2->h_length == sizeof(his_machine_addr))
+ for (addr = hp2->h_addr_list; *addr != NULL; addr++)
+ if (memcmp(*addr, &his_machine_addr,
+ sizeof(his_machine_addr)) == 0) {
+ his_machine_name = strdup(hp->h_name);
+ break;
+ }
+ }
+ if (his_machine_name == NULL)
+ his_machine_name = strdup(inet_ntoa(his_machine_addr));
+ snprintf((char *)buf, sizeof(buf), "Connection established with %s@%s.",
+ msg.r_name, his_machine_name);
+ free(his_machine_name);
+ message((char *)buf);
+ write(STDOUT_FILENO, "\007\007\007", 3);
+
+ current_line = 0;
+
+ if ((sockfp = fdopen(sockt, "w+")) == NULL)
+ p_error("fdopen");
+
+ setvbuf(sockfp, NULL, _IONBF, 0);
+ setvbuf(stdin, NULL, _IONBF, 0);
+
+ /*
+ * Wait on both the other process (sockt) and standard input.
+ */
+ for (;;) {
+ fds[0].fd = fileno(stdin);
+ fds[0].events = POLLIN;
+ fds[1].fd = sockt;
+ fds[1].events = POLLIN;
+ nb = poll(fds, 2, INFTIM);
+ if (gotwinch) {
+ resize_display();
+ gotwinch = 0;
+ }
+ if (nb <= 0) {
+ if (errno == EINTR)
+ continue;
+ /* Panic, we don't know what happened. */
+ p_error("Unexpected error from poll");
+ quit();
+ }
+ if (fds[1].revents & POLLIN) {
+ wint_t w;
+
+ /* There is data on sockt. */
+ w = fgetwc(sockfp);
+ if (w == WEOF) {
+ message("Connection closed. Exiting");
+ quit();
+ }
+ display(&his_win, &w);
+ }
+ if (fds[0].revents & POLLIN) {
+ wint_t w;
+
+ if ((w = getwchar()) != WEOF) {
+ display(&my_win, &w);
+ (void )fputwc(w, sockfp);
+ (void )fflush(sockfp);
+ }
+ }
+ }
+}
+
+/*
+ * p_error prints the system error message on the standard location
+ * on the screen and then exits. (i.e. a curses version of perror)
+ */
+void
+p_error(const char *string)
+{
+ wmove(my_win.x_win, current_line, 0);
+ wprintw(my_win.x_win, "[%s : %s (%d)]\n",
+ string, strerror(errno), errno);
+ wrefresh(my_win.x_win);
+ move(LINES-1, 0);
+ refresh();
+ quit();
+}
+
+/*
+ * Display string in the standard location
+ */
+void
+message(const char *string)
+{
+ wmove(my_win.x_win, current_line, 0);
+ wprintw(my_win.x_win, "[%s]\n", string);
+ if (current_line < my_win.x_nlines - 1)
+ current_line++;
+ wrefresh(my_win.x_win);
+}
diff --git a/usr.bin/talk/look_up.c b/usr.bin/talk/look_up.c
new file mode 100644
index 0000000..309f1be
--- /dev/null
+++ b/usr.bin/talk/look_up.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)look_up.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <protocols/talkd.h>
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "talk_ctl.h"
+#include "talk.h"
+
+/*
+ * See if the local daemon has an invitation for us.
+ */
+int
+check_local(void)
+{
+ CTL_RESPONSE response;
+ CTL_RESPONSE *rp = &response;
+ struct sockaddr addr;
+
+ /* the rest of msg was set up in get_names */
+#ifdef MSG_EOR
+ /* copy new style sockaddr to old, swap family (short in old) */
+ msg.ctl_addr = *(struct osockaddr *)&ctl_addr;
+ msg.ctl_addr.sa_family = htons(ctl_addr.sin_family);
+#else
+ msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
+#endif
+ /* must be initiating a talk */
+ if (!look_for_invite(rp))
+ return (0);
+ /*
+ * There was an invitation waiting for us,
+ * so connect with the other (hopefully waiting) party
+ */
+ current_state = "Waiting to connect with caller";
+ do {
+ if (rp->addr.sa_family != AF_INET)
+ p_error("Response uses invalid network address");
+ (void)memcpy(&addr, &rp->addr.sa_family, sizeof(addr));
+ addr.sa_family = rp->addr.sa_family;
+ addr.sa_len = sizeof(addr);
+ errno = 0;
+ if (connect(sockt, &addr, sizeof(addr)) != -1)
+ return (1);
+ } while (errno == EINTR);
+ if (errno == ECONNREFUSED) {
+ /*
+ * The caller gave up, but his invitation somehow
+ * was not cleared. Clear it and initiate an
+ * invitation. (We know there are no newer invitations,
+ * the talkd works LIFO.)
+ */
+ ctl_transact(his_machine_addr, msg, DELETE, rp);
+ close(sockt);
+ open_sockt();
+ return (0);
+ }
+ p_error("Unable to connect with initiator");
+ /*NOTREACHED*/
+ return (0);
+}
+
+/*
+ * Look for an invitation on 'machine'
+ */
+int
+look_for_invite(CTL_RESPONSE *rp)
+{
+ current_state = "Checking for invitation on caller's machine";
+ ctl_transact(his_machine_addr, msg, LOOK_UP, rp);
+ /* the switch is for later options, such as multiple invitations */
+ switch (rp->answer) {
+
+ case SUCCESS:
+ msg.id_num = htonl(rp->id_num);
+ return (1);
+
+ default:
+ /* there wasn't an invitation waiting for us */
+ return (0);
+ }
+}
diff --git a/usr.bin/talk/msgs.c b/usr.bin/talk/msgs.c
new file mode 100644
index 0000000..e36b37a
--- /dev/null
+++ b/usr.bin/talk/msgs.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)msgs.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * A package to display what is happening every MSG_INTERVAL seconds
+ * if we are slow connecting.
+ */
+
+#include <signal.h>
+
+#include "talk.h"
+
+#define MSG_INTERVAL 4
+
+const char *current_state;
+int current_line = 0;
+
+/* ARGSUSED */
+void
+disp_msg(int signo __unused)
+{
+ message(current_state);
+}
+
+void
+start_msgs(void)
+{
+ struct itimerval itimer;
+
+ message(current_state);
+ signal(SIGALRM, disp_msg);
+ itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
+ itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
+ setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+}
+
+void
+end_msgs(void)
+{
+ struct itimerval itimer;
+
+ timerclear(&itimer.it_value);
+ timerclear(&itimer.it_interval);
+ setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
+ signal(SIGALRM, SIG_DFL);
+}
diff --git a/usr.bin/talk/talk.1 b/usr.bin/talk/talk.1
new file mode 100644
index 0000000..abfa150
--- /dev/null
+++ b/usr.bin/talk/talk.1
@@ -0,0 +1,159 @@
+.\" Copyright (c) 1983, 1990, 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.
+.\"
+.\" @(#)talk.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2010
+.Dt TALK 1
+.Os
+.Sh NAME
+.Nm talk
+.Nd talk to another user
+.Sh SYNOPSIS
+.Nm
+.Ar person
+.Op Ar ttyname
+.Sh DESCRIPTION
+The
+.Nm
+utility is a visual communication program which copies lines from your
+terminal to that of another user.
+.Pp
+Options available:
+.Bl -tag -width ttyname
+.It Ar person
+If you wish to talk to someone on your own machine, then
+.Ar person
+is just the person's login name.
+If you wish to talk to a user on
+another host, then
+.Ar person
+is of the form
+.Ql user@host
+or
+.Ql host!user
+or
+.Ql host:user .
+.It Ar ttyname
+If you wish to talk to a user who is logged in more than once, the
+.Ar ttyname
+argument may be used to indicate the appropriate terminal
+name, where
+.Ar ttyname
+is of the form
+.Ql ttyXX .
+.El
+.Pp
+When first called,
+.Nm
+sends the message
+.Bd -literal -offset indent -compact
+Message from TalkDaemon@his_machine...
+talk: connection requested by your_name@your_machine.
+talk: respond with: talk your_name@your_machine
+.Ed
+.Pp
+to the user you wish to talk to.
+At this point, the recipient
+of the message should reply by typing
+.Pp
+.Dl talk \ your_name@your_machine
+.Pp
+It does not matter from which machine the recipient replies, as
+long as his login-name is the same.
+Once communication is established,
+the two parties may type simultaneously, with their output appearing
+in separate windows.
+Typing control-L
+.Ql ^L
+will cause the screen to
+be reprinted.
+Typing control-D
+.Ql ^D
+will clear both parts of your screen to be cleared, while
+the control-D character will be sent to the remote side
+(and just displayed by this
+.Nm
+client).
+Your erase, kill, and word kill characters will
+behave normally.
+To exit, just type your interrupt character;
+.Nm
+then moves the cursor to the bottom of the screen and restores the
+terminal to its previous state.
+.Pp
+Permission to talk may be denied or granted by use of the
+.Xr mesg 1
+command.
+At the outset talking is allowed.
+.Sh FILES
+.Bl -tag -width /var/run/utx.active -compact
+.It Pa /etc/hosts
+to find the recipient's machine
+.It Pa /var/run/utx.active
+to find the recipient's tty
+.El
+.Sh SEE ALSO
+.Xr mail 1 ,
+.Xr mesg 1 ,
+.Xr wall 1 ,
+.Xr who 1 ,
+.Xr write 1 ,
+.Xr talkd 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Pp
+In
+.Fx 5.3 ,
+the default behaviour of
+.Nm
+was changed to treat local-to-local talk requests as originating
+and terminating at
+.Em localhost .
+Before this change, it was required that the hostname (as per
+.Xr gethostname 3 )
+resolved to a valid IPv4 address (via
+.Xr gethostbyname 3 ) ,
+making
+.Nm
+unsuitable for use in configurations where
+.Xr talkd 8
+was bound to the loopback interface (normally for security reasons).
+.Sh BUGS
+The version of
+.Nm
+released with
+.Bx 4.3
+uses a protocol that
+is incompatible with the protocol used in the version released with
+.Bx 4.2 .
+.Pp
+Multibyte characters are not recognized.
diff --git a/usr.bin/talk/talk.c b/usr.bin/talk/talk.c
new file mode 100644
index 0000000..9bd049f
--- /dev/null
+++ b/usr.bin/talk/talk.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)talk.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#include <locale.h>
+#include <unistd.h>
+
+#include "talk.h"
+
+/*
+ * talk: A visual form of write. Using sockets, a two way
+ * connection is set up between the two people talking.
+ * With the aid of curses, the screen is split into two
+ * windows, and each users text is added to the window,
+ * one character at a time...
+ *
+ * Written by Kipp Hickman
+ *
+ * Modified to run under 4.1a by Clem Cole and Peter Moore
+ * Modified to run between hosts by Peter Moore, 8/19/82
+ * Modified to run under 4.1c by Peter Moore 3/17/83
+ * Fixed to not run with unwriteable terminals MRVM 28/12/94
+ */
+
+int
+main(int argc, char **argv)
+{
+ (void) setlocale(LC_CTYPE, "");
+
+ get_names(argc, argv);
+ setproctitle(" ");
+ check_writeable();
+ init_display();
+ open_ctl();
+ open_sockt();
+ start_msgs();
+ if (!check_local())
+ invite_remote();
+ end_msgs();
+ set_edit_chars();
+ talk();
+ return 0;
+}
diff --git a/usr.bin/talk/talk.h b/usr.bin/talk/talk.h
new file mode 100644
index 0000000..34ff870
--- /dev/null
+++ b/usr.bin/talk/talk.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1983, 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.
+ *
+ * @(#)talk.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <protocols/talkd.h>
+#include <curses.h>
+#include <signal.h>
+
+extern int sockt;
+extern int curses_initialized;
+extern int invitation_waiting;
+
+extern const char *current_state;
+extern int current_line;
+
+extern volatile sig_atomic_t gotwinch;
+
+typedef struct xwin {
+ WINDOW *x_win;
+ int x_nlines;
+ int x_ncols;
+ int x_line;
+ int x_col;
+ char kill;
+ char cerase;
+ char werase;
+} xwin_t;
+
+extern xwin_t my_win;
+extern xwin_t his_win;
+extern WINDOW *line_win;
+
+extern void announce_invite(void);
+extern int check_local(void);
+extern void check_writeable(void);
+extern void ctl_transact(struct in_addr,CTL_MSG,int,CTL_RESPONSE *);
+extern void disp_msg(int);
+extern void end_msgs(void);
+extern void get_addrs(const char *, const char *);
+extern int get_iface(struct in_addr *, struct in_addr *);
+extern void get_names(int, char **);
+extern void init_display(void);
+extern void invite_remote(void);
+extern int look_for_invite(CTL_RESPONSE *);
+extern int max(int, int);
+extern void message(const char *);
+extern void open_ctl(void);
+extern void open_sockt(void);
+extern void p_error(const char *);
+extern void print_addr(struct sockaddr_in);
+extern void quit(void);
+extern int readwin(WINDOW *, int, int);
+extern void re_invite(int);
+extern void send_delete(void);
+extern void set_edit_chars(void);
+extern void sig_sent(int);
+extern void sig_winch(int);
+extern void start_msgs(void);
+extern void talk(void);
+extern void resize_display(void);
diff --git a/usr.bin/talk/talk_ctl.h b/usr.bin/talk/talk_ctl.h
new file mode 100644
index 0000000..e3e750b
--- /dev/null
+++ b/usr.bin/talk/talk_ctl.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1983, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)talk_ctl.h 8.1 (Berkeley) 6/6/93
+ */
+
+extern struct sockaddr_in daemon_addr;
+extern struct sockaddr_in ctl_addr;
+extern struct sockaddr_in my_addr;
+extern struct in_addr my_machine_addr;
+extern struct in_addr his_machine_addr;
+extern u_short daemon_port;
+extern int ctl_sockt;
+extern CTL_MSG msg;
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile
new file mode 100644
index 0000000..0c9fafa
--- /dev/null
+++ b/usr.bin/tar/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+.include <src.opts.mk>
+
+_LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
+
+PROG= bsdtar
+BSDTAR_VERSION_STRING= 3.2.1
+
+.PATH: ${_LIBARCHIVEDIR}/tar
+SRCS= bsdtar.c \
+ cmdline.c \
+ creation_set.c \
+ read.c \
+ subst.c \
+ util.c \
+ write.c
+
+.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
+SRCS+= err.c \
+ line_reader.c \
+ passphrase.c
+
+LIBADD= archive
+
+.if ${MK_ICONV} != "no"
+CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
+.endif
+
+CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\"
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../../lib/libarchive/config_freebsd.h\"
+CFLAGS+= -I${_LIBARCHIVEDIR}/tar -I${_LIBARCHIVEDIR}/libarchive
+CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe
+SYMLINKS= bsdtar ${BINDIR}/tar
+MLINKS= bsdtar.1 tar.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tar/Makefile.depend b/usr.bin/tar/Makefile.depend
new file mode 100644
index 0000000..4e7906b
--- /dev/null
+++ b/usr.bin/tar/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tar/tests/Makefile b/usr.bin/tar/tests/Makefile
new file mode 100644
index 0000000..c9b6072
--- /dev/null
+++ b/usr.bin/tar/tests/Makefile
@@ -0,0 +1,116 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
+
+ATF_TESTS_SH+= functional_test
+
+BINDIR= ${TESTSDIR}
+
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\"
+CFLAGS+= -static
+CFLAGS+= -I${SRCTOP}/lib/libarchive -I${.OBJDIR}
+CFLAGS+= -I${_LIBARCHIVEDIR}/tar -I${_LIBARCHIVEDIR}/test_utils
+
+# Uncomment to link against dmalloc
+#LDADD+= -L/usr/local/lib -ldmalloc
+#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
+
+PROGS+= bsdtar_test
+
+.PATH: ${_LIBARCHIVEDIR}/tar/test
+TESTS_SRCS= \
+ test_0.c \
+ test_basic.c \
+ test_copy.c \
+ test_empty_mtree.c \
+ test_extract_tar_bz2.c \
+ test_extract_tar_grz.c \
+ test_extract_tar_gz.c \
+ test_extract_tar_lrz.c \
+ test_extract_tar_lz.c \
+ test_extract_tar_lz4.c \
+ test_extract_tar_lzma.c \
+ test_extract_tar_lzo.c \
+ test_extract_tar_xz.c \
+ test_format_newc.c \
+ test_help.c \
+ test_leading_slash.c \
+ test_missing_file.c \
+ test_option_C_upper.c \
+ test_option_H_upper.c \
+ test_option_L_upper.c \
+ test_option_O_upper.c \
+ test_option_T_upper.c \
+ test_option_U_upper.c \
+ test_option_X_upper.c \
+ test_option_a.c \
+ test_option_b.c \
+ test_option_b64encode.c \
+ test_option_exclude.c \
+ test_option_gid_gname.c \
+ test_option_grzip.c \
+ test_option_j.c \
+ test_option_k.c \
+ test_option_keep_newer_files.c \
+ test_option_lrzip.c \
+ test_option_lz4.c \
+ test_option_lzma.c \
+ test_option_lzop.c \
+ test_option_n.c \
+ test_option_newer_than.c \
+ test_option_nodump.c \
+ test_option_older_than.c \
+ test_option_passphrase.c \
+ test_option_q.c \
+ test_option_r.c \
+ test_option_s.c \
+ test_option_uid_uname.c \
+ test_option_uuencode.c \
+ test_option_xz.c \
+ test_option_z.c \
+ test_patterns.c \
+ test_print_longpath.c \
+ test_stdio.c \
+ test_strip_components.c \
+ test_symlink_dir.c \
+ test_version.c
+
+SRCS.bsdtar_test= \
+ ${TESTS_SRCS} \
+ list.h \
+ main.c
+
+.PATH: ${_LIBARCHIVEDIR}/test_utils
+SRCS.bsdtar_test+= test_utils.c
+
+LIBADD.bsdtar_test= archive
+
+list.h: ${TESTS_SRCS} Makefile
+ @(cd ${_LIBARCHIVEDIR}/tar/test && \
+ grep -h DEFINE_TEST ${.ALLSRC:N*Makefile}) > ${.TARGET}.tmp
+ @mv ${.TARGET}.tmp ${.TARGET}
+
+CLEANFILES+= list.h list.h.tmp
+
+${PACKAGE}FILES+= test_extract.tar.Z.uu
+${PACKAGE}FILES+= test_extract.tar.bz2.uu
+${PACKAGE}FILES+= test_extract.tar.grz.uu
+${PACKAGE}FILES+= test_extract.tar.gz.uu
+${PACKAGE}FILES+= test_extract.tar.lrz.uu
+${PACKAGE}FILES+= test_extract.tar.lz.uu
+${PACKAGE}FILES+= test_extract.tar.lz4.uu
+${PACKAGE}FILES+= test_extract.tar.lzma.uu
+${PACKAGE}FILES+= test_extract.tar.lzo.uu
+${PACKAGE}FILES+= test_extract.tar.xz.uu
+${PACKAGE}FILES+= test_leading_slash.tar.uu
+${PACKAGE}FILES+= test_option_keep_newer_files.tar.Z.uu
+${PACKAGE}FILES+= test_option_passphrase.zip.uu
+${PACKAGE}FILES+= test_option_s.tar.Z.uu
+${PACKAGE}FILES+= test_patterns_2.tar.uu
+${PACKAGE}FILES+= test_patterns_3.tar.uu
+${PACKAGE}FILES+= test_patterns_4.tar.uu
+${PACKAGE}FILES+= test_print_longpath.tar.Z.uu
+
+.include <bsd.test.mk>
diff --git a/usr.bin/tar/tests/Makefile.depend b/usr.bin/tar/tests/Makefile.depend
new file mode 100644
index 0000000..860d975
--- /dev/null
+++ b/usr.bin/tar/tests/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ 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/tar/tests/functional_test.sh b/usr.bin/tar/tests/functional_test.sh
new file mode 100755
index 0000000..ee9de1b
--- /dev/null
+++ b/usr.bin/tar/tests/functional_test.sh
@@ -0,0 +1,51 @@
+#
+# Copyright 2015 EMC Corp.
+# 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.
+#
+# 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$
+
+export BSDTAR=$(which tar)
+SRCDIR=$(atf_get_srcdir)
+TESTER="${SRCDIR}/bsdtar_test"
+
+check()
+{
+ local testcase=${1}; shift
+
+ atf_check -o ignore -s exit:0 ${TESTER} -d -r "${SRCDIR}" -v "${testcase}"
+}
+
+atf_init_test_cases()
+{
+ # Redirect stderr to stdout for the usage message because if you don't
+ # kyua list/kyua test will break:
+ # https://github.com/jmmv/kyua/issues/149
+ testcases=$(${TESTER} -h 2>&1 | awk 'p != 0 && $1 ~ /^[0-9]+:/ { print $NF } /Available tests:/ { p=1 }')
+ for testcase in ${testcases}; do
+ atf_test_case ${testcase}
+ eval "${testcase}_body() { check ${testcase}; }"
+ atf_add_test_case ${testcase}
+ done
+}
diff --git a/usr.bin/tcopy/Makefile b/usr.bin/tcopy/Makefile
new file mode 100644
index 0000000..1bae0b2
--- /dev/null
+++ b/usr.bin/tcopy/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= tcopy
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tcopy/Makefile.depend b/usr.bin/tcopy/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tcopy/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tcopy/tcopy.1 b/usr.bin/tcopy/tcopy.1
new file mode 100644
index 0000000..a99f2e0
--- /dev/null
+++ b/usr.bin/tcopy/tcopy.1
@@ -0,0 +1,125 @@
+.\" Copyright (c) 1985, 1990, 1991, 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.
+.\"
+.\" @(#)tcopy.1 8.2 (Berkeley) 4/17/94
+.\" $FreeBSD$
+.\"
+.Dd December 20, 2006
+.Dt TCOPY 1
+.Os
+.Sh NAME
+.Nm tcopy
+.Nd copy and/or verify mag tapes
+.Sh SYNOPSIS
+.Nm
+.Op Fl cvx
+.Op Fl s Ar maxblk
+.Oo Ar src Op Ar dest
+.Oc
+.Sh DESCRIPTION
+The
+.Nm
+utility is designed to copy magnetic tapes.
+The only assumption made
+about the tape layout is that there are two sequential EOF marks
+at the end.
+By default, the
+.Nm
+utility will print
+information about the sizes of records and files found
+on the
+.Pa /dev/sa0
+tape, or on the tape specified by the
+.Ar src
+argument.
+If a destination tape is also specified by the
+.Ar dest
+argument, a copy of the source tape will be made.
+The blocking on the
+destination tape will be identical to that used on the source tape.
+Copying
+a tape will yield the same program output as if just printing the sizes.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl s Ar maxblk"
+.It Fl c
+Copy
+.Ar src
+to
+.Ar dest
+and then verify that the two tapes are identical.
+.It Fl s Ar maxblk
+Specify a maximum block size,
+.Ar maxblk .
+.It Fl v
+Given the two tapes
+.Ar src
+and
+.Ar dest ,
+verify that they are identical.
+.It Fl x
+Output all informational messages to the standard error
+instead of the standard output.
+This option is useful when
+.Ar dest
+is given as
+.Pa /dev/stdout .
+.El
+.Sh SEE ALSO
+.Xr mt 1 ,
+.Xr mtio 4
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
+.Sh BUGS
+.Bl -item
+.It
+Writing an image of a tape to a file does not preserve much more than
+the raw data.
+Block size(s) and tape EOF marks are lost which would
+otherwise be preserved in a tape-to-tape copy.
+.It
+End of data (EOD) is determined by two sequential EOF marks
+with no data between them.
+There used to be old systems which typically wrote three EOF's between tape
+files.
+The
+.Nm
+utility will erroneously stop copying early in this case.
+.It
+When using the copy/verify option
+.Fl c ,
+.Nm
+does not rewind the tapes prior to start.
+A rewind is performed
+after writing, prior to the verification stage.
+If one does not start
+at the beginning-of-tape (BOT) then the comparison
+may not be of the intended data.
+.El
diff --git a/usr.bin/tcopy/tcopy.c b/usr.bin/tcopy/tcopy.c
new file mode 100644
index 0000000..4fa0a33
--- /dev/null
+++ b/usr.bin/tcopy/tcopy.c
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 1985, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1985, 1987, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)tcopy.c 8.2 (Berkeley) 4/17/94";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mtio.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MAXREC (64 * 1024)
+#define NOCOUNT (-2)
+
+static int filen, guesslen, maxblk = MAXREC;
+static uint64_t lastrec, record, size, tsize;
+static FILE *msg;
+
+static void *getspace(int);
+static void intr(int);
+static void usage(void) __dead2;
+static void verify(int, int, char *);
+static void writeop(int, int);
+static void rewind_tape(int);
+
+int
+main(int argc, char *argv[])
+{
+ int lastnread, nread, nw, inp, outp;
+ enum {READ, VERIFY, COPY, COPYVERIFY} op = READ;
+ sig_t oldsig;
+ int ch, needeof;
+ char *buff;
+ const char *inf;
+
+ msg = stdout;
+ guesslen = 1;
+ outp = -1;
+ while ((ch = getopt(argc, argv, "cs:vx")) != -1)
+ switch((char)ch) {
+ case 'c':
+ op = COPYVERIFY;
+ break;
+ case 's':
+ maxblk = atoi(optarg);
+ if (maxblk <= 0) {
+ warnx("illegal block size");
+ usage();
+ }
+ guesslen = 0;
+ break;
+ case 'v':
+ op = VERIFY;
+ break;
+ case 'x':
+ msg = stderr;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch(argc) {
+ case 0:
+ if (op != READ)
+ usage();
+ inf = _PATH_DEFTAPE;
+ break;
+ case 1:
+ if (op != READ)
+ usage();
+ inf = argv[0];
+ break;
+ case 2:
+ if (op == READ)
+ op = COPY;
+ inf = argv[0];
+ if ((outp = open(argv[1], op == VERIFY ? O_RDONLY :
+ op == COPY ? O_WRONLY : O_RDWR, DEFFILEMODE)) < 0)
+ err(3, "%s", argv[1]);
+ break;
+ default:
+ usage();
+ }
+
+ if ((inp = open(inf, O_RDONLY, 0)) < 0)
+ err(1, "%s", inf);
+
+ buff = getspace(maxblk);
+
+ if (op == VERIFY) {
+ verify(inp, outp, buff);
+ exit(0);
+ }
+
+ if ((oldsig = signal(SIGINT, SIG_IGN)) != SIG_IGN)
+ (void) signal(SIGINT, intr);
+
+ needeof = 0;
+ for (lastnread = NOCOUNT;;) {
+ if ((nread = read(inp, buff, maxblk)) == -1) {
+ while (errno == EINVAL && (maxblk -= 1024)) {
+ nread = read(inp, buff, maxblk);
+ if (nread >= 0)
+ goto r1;
+ }
+ err(1, "read error, file %d, record %ju", filen, (intmax_t)record);
+ } else if (nread != lastnread) {
+ if (lastnread != 0 && lastnread != NOCOUNT) {
+ if (lastrec == 0 && nread == 0)
+ fprintf(msg, "%ju records\n", (intmax_t)record);
+ else if (record - lastrec > 1)
+ fprintf(msg, "records %ju to %ju\n",
+ (intmax_t)lastrec, (intmax_t)record);
+ else
+ fprintf(msg, "record %ju\n", (intmax_t)lastrec);
+ }
+ if (nread != 0)
+ fprintf(msg, "file %d: block size %d: ",
+ filen, nread);
+ (void) fflush(stdout);
+ lastrec = record;
+ }
+r1: guesslen = 0;
+ if (nread > 0) {
+ if (op == COPY || op == COPYVERIFY) {
+ if (needeof) {
+ writeop(outp, MTWEOF);
+ needeof = 0;
+ }
+ nw = write(outp, buff, nread);
+ if (nw != nread) {
+ if (nw == -1) {
+ warn("write error, file %d, record %ju", filen,
+ (intmax_t)record);
+ } else {
+ warnx("write error, file %d, record %ju", filen,
+ (intmax_t)record);
+ warnx("write (%d) != read (%d)", nw, nread);
+ }
+ errx(5, "copy aborted");
+ }
+ }
+ size += nread;
+ record++;
+ } else {
+ if (lastnread <= 0 && lastnread != NOCOUNT) {
+ fprintf(msg, "eot\n");
+ break;
+ }
+ fprintf(msg,
+ "file %d: eof after %ju records: %ju bytes\n",
+ filen, (intmax_t)record, (intmax_t)size);
+ needeof = 1;
+ filen++;
+ tsize += size;
+ size = record = lastrec = 0;
+ lastnread = 0;
+ }
+ lastnread = nread;
+ }
+ fprintf(msg, "total length: %ju bytes\n", (intmax_t)tsize);
+ (void)signal(SIGINT, oldsig);
+ if (op == COPY || op == COPYVERIFY) {
+ writeop(outp, MTWEOF);
+ writeop(outp, MTWEOF);
+ if (op == COPYVERIFY) {
+ rewind_tape(outp);
+ rewind_tape(inp);
+ verify(inp, outp, buff);
+ }
+ }
+ exit(0);
+}
+
+static void
+verify(int inp, int outp, char *outb)
+{
+ int eot, inmaxblk, inn, outmaxblk, outn;
+ char *inb;
+
+ inb = getspace(maxblk);
+ inmaxblk = outmaxblk = maxblk;
+ for (eot = 0;; guesslen = 0) {
+ if ((inn = read(inp, inb, inmaxblk)) == -1) {
+ if (guesslen)
+ while (errno == EINVAL && (inmaxblk -= 1024)) {
+ inn = read(inp, inb, inmaxblk);
+ if (inn >= 0)
+ goto r1;
+ }
+ warn("read error");
+ break;
+ }
+r1: if ((outn = read(outp, outb, outmaxblk)) == -1) {
+ if (guesslen)
+ while (errno == EINVAL && (outmaxblk -= 1024)) {
+ outn = read(outp, outb, outmaxblk);
+ if (outn >= 0)
+ goto r2;
+ }
+ warn("read error");
+ break;
+ }
+r2: if (inn != outn) {
+ fprintf(msg,
+ "%s: tapes have different block sizes; %d != %d.\n",
+ "tcopy", inn, outn);
+ break;
+ }
+ if (!inn) {
+ if (eot++) {
+ fprintf(msg, "tcopy: tapes are identical.\n");
+ return;
+ }
+ } else {
+ if (bcmp(inb, outb, inn)) {
+ fprintf(msg,
+ "tcopy: tapes have different data.\n");
+ break;
+ }
+ eot = 0;
+ }
+ }
+ exit(1);
+}
+
+static void
+intr(int signo __unused)
+{
+ if (record) {
+ if (record - lastrec > 1)
+ fprintf(msg, "records %ju to %ju\n", (intmax_t)lastrec, (intmax_t)record);
+ else
+ fprintf(msg, "record %ju\n", (intmax_t)lastrec);
+ }
+ fprintf(msg, "interrupt at file %d: record %ju\n", filen, (intmax_t)record);
+ fprintf(msg, "total length: %ju bytes\n", (uintmax_t)(tsize + size));
+ exit(1);
+}
+
+static void *
+getspace(int blk)
+{
+ void *bp;
+
+ if ((bp = malloc((size_t)blk)) == NULL)
+ errx(11, "no memory");
+ return (bp);
+}
+
+static void
+writeop(int fd, int type)
+{
+ struct mtop op;
+
+ op.mt_op = type;
+ op.mt_count = (daddr_t)1;
+ if (ioctl(fd, MTIOCTOP, (char *)&op) < 0)
+ err(6, "tape op");
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: tcopy [-cvx] [-s maxblk] [src [dest]]\n");
+ exit(1);
+}
+
+static void
+rewind_tape(int fd)
+{
+ struct stat sp;
+
+ if(fstat(fd, &sp))
+ errx(12, "fstat in rewind");
+
+ /*
+ * don't want to do tape ioctl on regular files:
+ */
+ if( S_ISREG(sp.st_mode) ) {
+ if( lseek(fd, 0, SEEK_SET) == -1 )
+ errx(13, "lseek");
+ } else
+ /* assume its a tape */
+ writeop(fd, MTREW);
+}
diff --git a/usr.bin/tee/Makefile b/usr.bin/tee/Makefile
new file mode 100644
index 0000000..920dd66
--- /dev/null
+++ b/usr.bin/tee/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= tee
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tee/Makefile.depend b/usr.bin/tee/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tee/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tee/tee.1 b/usr.bin/tee/tee.1
new file mode 100644
index 0000000..c443e9f
--- /dev/null
+++ b/usr.bin/tee/tee.1
@@ -0,0 +1,82 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)tee.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd November 13, 2007
+.Dt TEE 1
+.Os
+.Sh NAME
+.Nm tee
+.Nd duplicate standard input
+.Sh SYNOPSIS
+.Nm
+.Op Fl ai
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility copies standard input to standard output,
+making a copy in zero or more files.
+The output is unbuffered.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+Append the output to the files rather than
+overwriting them.
+.It Fl i
+Ignore the
+.Dv SIGINT
+signal.
+.El
+.Pp
+The following operands are available:
+.Bl -tag -width indent
+.It Ar file
+A pathname of an output
+.Ar file .
+.El
+.Pp
+The
+.Nm
+utility takes the default action for all signals,
+except in the event of the
+.Fl i
+option.
+.Sh EXIT STATUS
+.Ex -std
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
diff --git a/usr.bin/tee/tee.c b/usr.bin/tee/tee.c
new file mode 100644
index 0000000..6b5c00c
--- /dev/null
+++ b/usr.bin/tee/tee.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 1988, 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) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)tee.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <err.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+typedef struct _list {
+ struct _list *next;
+ int fd;
+ const char *name;
+} LIST;
+static LIST *head;
+
+static void add(int, const char *);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ LIST *p;
+ int n, fd, rval, wval;
+ char *bp;
+ int append, ch, exitval;
+ char *buf;
+#define BSIZE (8 * 1024)
+
+ append = 0;
+ while ((ch = getopt(argc, argv, "ai")) != -1)
+ switch((char)ch) {
+ case 'a':
+ append = 1;
+ break;
+ case 'i':
+ (void)signal(SIGINT, SIG_IGN);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+ if ((buf = malloc(BSIZE)) == NULL)
+ err(1, "malloc");
+
+ add(STDOUT_FILENO, "stdout");
+
+ for (exitval = 0; *argv; ++argv)
+ if ((fd = open(*argv, append ? O_WRONLY|O_CREAT|O_APPEND :
+ O_WRONLY|O_CREAT|O_TRUNC, DEFFILEMODE)) < 0) {
+ warn("%s", *argv);
+ exitval = 1;
+ } else
+ add(fd, *argv);
+
+ while ((rval = read(STDIN_FILENO, buf, BSIZE)) > 0)
+ for (p = head; p; p = p->next) {
+ n = rval;
+ bp = buf;
+ do {
+ if ((wval = write(p->fd, bp, n)) == -1) {
+ warn("%s", p->name);
+ exitval = 1;
+ break;
+ }
+ bp += wval;
+ } while (n -= wval);
+ }
+ if (rval < 0)
+ err(1, "read");
+ exit(exitval);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: tee [-ai] [file ...]\n");
+ exit(1);
+}
+
+static void
+add(int fd, const char *name)
+{
+ LIST *p;
+
+ if ((p = malloc(sizeof(LIST))) == NULL)
+ err(1, "malloc");
+ p->fd = fd;
+ p->name = name;
+ p->next = head;
+ head = p;
+}
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile
new file mode 100644
index 0000000..a24a966
--- /dev/null
+++ b/usr.bin/telnet/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+TELNETDIR= ${.CURDIR}/../../contrib/telnet
+.PATH: ${TELNETDIR}/telnet
+
+PROG= telnet
+
+SRCS= commands.c main.c network.c ring.c sys_bsd.c \
+ telnet.c terminal.c utilities.c
+
+CFLAGS+= -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \
+ -I${TELNETDIR} -I${TELNETDIR}/libtelnet/
+
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
+
+WARNS?= 2
+
+LIBADD= telnet ncursesw
+
+.if !defined(RELEASE_CRUNCH)
+CFLAGS+= -DIPSEC
+LIBADD+= ipsec
+.else
+.PATH: ${TELNETDIR}/libtelnet
+SRCS+= genget.c getent.c misc.c
+CFLAGS+= -DHAS_CGETENT
+.endif
+
+.if ${MK_OPENSSL} != "no"
+SRCS+= authenc.c
+CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DIPSEC
+LIBADD+= mp crypto ipsec pam
+.endif
+
+.if ${MK_KERBEROS_SUPPORT} != "no"
+CFLAGS+= -DKRB5 -DFORWARD -Dnet_write=telnet_net_write
+LIBADD+= krb5 roken
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/telnet/Makefile.depend b/usr.bin/telnet/Makefile.depend
new file mode 100644
index 0000000..6578e9f
--- /dev/null
+++ b/usr.bin/telnet/Makefile.depend
@@ -0,0 +1,35 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ kerberos5/lib/libasn1 \
+ kerberos5/lib/libheimbase \
+ kerberos5/lib/libheimipcc \
+ kerberos5/lib/libhx509 \
+ kerberos5/lib/libkrb5 \
+ kerberos5/lib/libroken \
+ kerberos5/lib/libwind \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcom_err \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ lib/libipsec \
+ lib/libmp \
+ lib/libpam/libpam \
+ lib/libtelnet \
+ lib/libthr \
+ lib/ncurses/ncursesw \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tests/Makefile b/usr.bin/tests/Makefile
new file mode 100644
index 0000000..f6103aa
--- /dev/null
+++ b/usr.bin/tests/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+.PATH: ${SRCTOP}/tests
+KYUAFILE= yes
+
+${PACKAGE}FILES+= regress.m4
+
+.include <bsd.test.mk>
diff --git a/usr.bin/tests/Makefile.depend b/usr.bin/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tests/regress.m4 b/usr.bin/tests/regress.m4
new file mode 100644
index 0000000..53dfb14
--- /dev/null
+++ b/usr.bin/tests/regress.m4
@@ -0,0 +1,59 @@
+# $FreeBSD$
+
+dnl A library of routines for doing regression tests for userland utilities.
+
+dnl Start up. We initialise the exit status to 0 (no failure) and change
+dnl into the directory specified by our first argument, which is the
+dnl directory to run the tests inside.
+define(`REGRESSION_START',
+TESTDIR=$1
+if [ -z "$TESTDIR" ]; then
+ TESTDIR=.
+fi
+cd $TESTDIR
+
+STATUS=0)
+
+dnl Check $? to see if we passed or failed. The first parameter is the test
+dnl which passed or failed. It may be nil.
+define(`REGRESSION_PASSFAIL',
+if [ $? -eq 0 ]; then
+ echo "ok - $1 # Test detected no regression. (in $TESTDIR)"
+else
+ STATUS=$?
+ echo "not ok - $1 # Test failed: regression detected. See above. (in $TESTDIR)"
+fi)
+
+dnl An actual test. The first parameter is the test name. The second is the
+dnl command/commands to execute for the actual test. Their exit status is
+dnl checked. It is assumed that the test will output to stdout, and that the
+dnl output to be used to check for regression will be in regress.TESTNAME.out.
+define(`REGRESSION_TEST',
+$2 | diff -u ${SRCDIR:-.}/regress.$1.out -
+REGRESSION_PASSFAIL($1))
+
+dnl A freeform regression test. Only exit status is checked.
+define(`REGRESSION_TEST_FREEFORM',
+$2
+REGRESSION_PASSFAIL($1))
+
+dnl A regression test like REGRESSION_TEST, except only regress.out is used
+dnl for checking output differences. The first argument is the command, the
+dnl second argument (which may be empty) is the test name.
+define(`REGRESSION_TEST_ONE',
+$1 | diff -u ${SRCDIR:-.}/regress.out -
+REGRESSION_PASSFAIL($2))
+
+dnl A fatal error. This will exit with the given status (first argument) and
+dnl print the message (second argument) prefixed with the string "FATAL :" to
+dnl the error stream.
+define(`REGRESSION_FATAL',
+echo "Bail out! $2 (in $TESTDIR)" > /dev/stderr
+exit $1)
+
+dnl Cleanup. Exit with the status code of the last failure. Should probably
+dnl be the number of failed tests, but hey presto, this is what it does. This
+dnl could also clean up potential droppings, if some forms of regression tests
+dnl end up using mktemp(1) or such.
+define(`REGRESSION_END',
+exit $STATUS)
diff --git a/usr.bin/tftp/Makefile b/usr.bin/tftp/Makefile
new file mode 100644
index 0000000..0f96d23
--- /dev/null
+++ b/usr.bin/tftp/Makefile
@@ -0,0 +1,13 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../libexec/tftpd
+
+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
+
+LIBADD= edit
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tftp/Makefile.depend b/usr.bin/tftp/Makefile.depend
new file mode 100644
index 0000000..d6c8db8
--- /dev/null
+++ b/usr.bin/tftp/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
new file mode 100644
index 0000000..188ce68
--- /dev/null
+++ b/usr.bin/tftp/main.c
@@ -0,0 +1,1053 @@
+/*
+ * Copyright (c) 1983, 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) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
+
+/*
+ * TFTP User Program -- Command Interface.
+ */
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/tftp.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <histedit.h>
+#include <netdb.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tftp-utils.h"
+#include "tftp-io.h"
+#include "tftp-options.h"
+#include "tftp.h"
+
+#define MAXLINE (2 * MAXPATHLEN)
+#define TIMEOUT 5 /* secs between rexmt's */
+
+typedef struct sockaddr_storage peeraddr;
+static int connected;
+static char mode[32];
+static jmp_buf toplevel;
+volatile int txrx_error;
+static int peer;
+
+#define MAX_MARGV 20
+static int margc;
+static char *margv[MAX_MARGV];
+
+int verbose;
+static char *port = NULL;
+
+static void get(int, char **);
+static void help(int, char **);
+static void intr(int);
+static void modecmd(int, char **);
+static void put(int, char **);
+static void quit(int, char **);
+static void setascii(int, char **);
+static void setbinary(int, char **);
+static void setpeer0(char *, const char *);
+static void setpeer(int, char **);
+static void settimeoutpacket(int, char **);
+static void settimeoutnetwork(int, char **);
+static void setdebug(int, char **);
+static void setverbose(int, char **);
+static void showstatus(int, char **);
+static void setblocksize(int, char **);
+static void setblocksize2(int, char **);
+static void setoptions(int, char **);
+static void setrollover(int, char **);
+static void setpacketdrop(int, char **);
+
+static void command(void) __dead2;
+static const char *command_prompt(void);
+
+static void urihandling(char *URI);
+static void getusage(char *);
+static void makeargv(char *line);
+static void putusage(char *);
+static void settftpmode(const char *);
+
+static char *tail(char *);
+static struct cmd *getcmd(char *);
+
+#define HELPINDENT (sizeof("connect"))
+
+struct cmd {
+ const char *name;
+ void (*handler)(int, char **);
+ const char *help;
+};
+
+static struct cmd cmdtab[] = {
+ { "connect", setpeer, "connect to remote tftp" },
+ { "mode", modecmd, "set file transfer mode" },
+ { "put", put, "send file" },
+ { "get", get, "receive file" },
+ { "quit", quit, "exit tftp" },
+ { "verbose", setverbose, "toggle verbose mode" },
+ { "status", showstatus, "show current status" },
+ { "binary", setbinary, "set mode to octet" },
+ { "ascii", setascii, "set mode to netascii" },
+ { "rexmt", settimeoutpacket,
+ "set per-packet retransmission timeout[-]" },
+ { "timeout", settimeoutnetwork,
+ "set total retransmission timeout" },
+ { "trace", setdebug, "enable 'debug packet'[-]" },
+ { "debug", setdebug, "enable verbose output" },
+ { "blocksize", setblocksize, "set blocksize[*]" },
+ { "blocksize2", setblocksize2, "set blocksize as a power of 2[**]" },
+ { "rollover", setrollover, "rollover after 64K packets[**]" },
+ { "options", setoptions,
+ "enable or disable RFC2347 style options" },
+ { "help", help, "print help information" },
+ { "packetdrop", setpacketdrop, "artificial packetloss feature" },
+ { "?", help, "print help information" },
+ { NULL, NULL, NULL }
+};
+
+static struct modes {
+ const char *m_name;
+ const char *m_mode;
+} modes[] = {
+ { "ascii", "netascii" },
+ { "netascii", "netascii" },
+ { "binary", "octet" },
+ { "image", "octet" },
+ { "octet", "octet" },
+ { NULL, NULL }
+};
+
+int
+main(int argc, char *argv[])
+{
+
+ acting_as_client = 1;
+ peer = -1;
+ strcpy(mode, "netascii");
+ signal(SIGINT, intr);
+ if (argc > 1) {
+ if (setjmp(toplevel) != 0)
+ exit(txrx_error);
+
+ if (strncmp(argv[1], "tftp://", 7) == 0) {
+ urihandling(argv[1]);
+ exit(txrx_error);
+ }
+
+ setpeer(argc, argv);
+ }
+ if (setjmp(toplevel) != 0)
+ (void)putchar('\n');
+
+ init_options();
+ command();
+}
+
+/*
+ * RFC3617 handling of TFTP URIs:
+ *
+ * tftpURI = "tftp://" host "/" file [ mode ]
+ * mode = ";" "mode=" ( "netascii" / "octet" )
+ * file = *( unreserved / escaped )
+ * host = <as specified by RFC 2732>
+ * unreserved = <as specified in RFC 2396>
+ * escaped = <as specified in RFC 2396>
+ *
+ * We are cheating a little bit by allowing any mode as specified in the
+ * modes table defined earlier on in this file and mapping it on the real
+ * mode.
+ */
+static void
+urihandling(char *URI)
+{
+ char uri[ARG_MAX];
+ char *host = NULL;
+ char *path = NULL;
+ char *opts = NULL;
+ const char *tmode = "octet";
+ char *s;
+ char line[MAXLINE];
+ int i;
+
+ strlcpy(uri, URI, ARG_MAX);
+ host = uri + 7;
+
+ if ((s = strchr(host, '/')) == NULL) {
+ fprintf(stderr,
+ "Invalid URI: Couldn't find / after hostname\n");
+ exit(1);
+ }
+ *s = '\0';
+ path = s + 1;
+
+ if ((s = strchr(path, ';')) != NULL) {
+ *s = '\0';
+ opts = s + 1;
+
+ if (strncmp(opts, "mode=", 5) == 0) {
+ tmode = opts;
+ tmode += 5;
+
+ for (i = 0; modes[i].m_name != NULL; i++) {
+ if (strcmp(modes[i].m_name, tmode) == 0)
+ break;
+ }
+ if (modes[i].m_name == NULL) {
+ fprintf(stderr, "Invalid mode: '%s'\n", mode);
+ exit(1);
+ }
+ settftpmode(modes[i].m_mode);
+ }
+ } else {
+ settftpmode("octet");
+ }
+
+ setpeer0(host, NULL);
+
+ sprintf(line, "get %s", path);
+ makeargv(line);
+ get(margc, margv);
+}
+
+static char hostname[MAXHOSTNAMELEN];
+
+static void
+setpeer0(char *host, const char *lport)
+{
+ struct addrinfo hints, *res0, *res;
+ int error;
+ const char *cause = "unknown";
+
+ if (connected) {
+ close(peer);
+ peer = -1;
+ }
+ connected = 0;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = IPPROTO_UDP;
+ hints.ai_flags = AI_CANONNAME;
+ if (!lport)
+ lport = "tftp";
+ error = getaddrinfo(host, lport, &hints, &res0);
+ if (error) {
+ warnx("%s", gai_strerror(error));
+ return;
+ }
+
+ for (res = res0; res; res = res->ai_next) {
+ if (res->ai_addrlen > sizeof(peeraddr))
+ continue;
+ peer = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol);
+ if (peer < 0) {
+ cause = "socket";
+ continue;
+ }
+
+ memset(&peer_sock, 0, sizeof(peer_sock));
+ peer_sock.ss_family = res->ai_family;
+ peer_sock.ss_len = res->ai_addrlen;
+ if (bind(peer, (struct sockaddr *)&peer_sock, peer_sock.ss_len) < 0) {
+ cause = "bind";
+ close(peer);
+ peer = -1;
+ continue;
+ }
+
+ break;
+ }
+
+ if (peer < 0)
+ warn("%s", cause);
+ else {
+ /* res->ai_addr <= sizeof(peeraddr) is guaranteed */
+ memcpy(&peer_sock, res->ai_addr, res->ai_addrlen);
+ if (res->ai_canonname) {
+ (void) strlcpy(hostname, res->ai_canonname,
+ sizeof(hostname));
+ } else
+ (void) strlcpy(hostname, host, sizeof(hostname));
+ connected = 1;
+ }
+
+ freeaddrinfo(res0);
+}
+
+static void
+setpeer(int argc, char *argv[])
+{
+ char line[MAXLINE];
+
+ if (argc < 2) {
+ strcpy(line, "Connect ");
+ printf("(to) ");
+ fgets(&line[strlen(line)], sizeof line - strlen(line), stdin);
+ makeargv(line);
+ argc = margc;
+ argv = margv;
+ }
+ if ((argc < 2) || (argc > 3)) {
+ printf("usage: %s [host [port]]\n", argv[0]);
+ return;
+ }
+ if (argc == 3) {
+ port = argv[2];
+ setpeer0(argv[1], argv[2]);
+ } else
+ setpeer0(argv[1], NULL);
+}
+
+static void
+modecmd(int argc, char *argv[])
+{
+ struct modes *p;
+ const char *sep;
+
+ if (argc < 2) {
+ printf("Using %s mode to transfer files.\n", mode);
+ return;
+ }
+ if (argc == 2) {
+ for (p = modes; p->m_name; p++)
+ if (strcmp(argv[1], p->m_name) == 0)
+ break;
+ if (p->m_name) {
+ settftpmode(p->m_mode);
+ return;
+ }
+ printf("%s: unknown mode\n", argv[1]);
+ /* drop through and print usage message */
+ }
+
+ printf("usage: %s [", argv[0]);
+ sep = " ";
+ for (p = modes; p->m_name != NULL; p++) {
+ printf("%s%s", sep, p->m_name);
+ if (*sep == ' ')
+ sep = " | ";
+ }
+ printf(" ]\n");
+ return;
+}
+
+static void
+setbinary(int argc __unused, char *argv[] __unused)
+{
+
+ settftpmode("octet");
+}
+
+static void
+setascii(int argc __unused, char *argv[] __unused)
+{
+
+ settftpmode("netascii");
+}
+
+static void
+settftpmode(const char *newmode)
+{
+
+ strcpy(mode, newmode);
+ if (verbose)
+ printf("mode set to %s\n", mode);
+}
+
+
+/*
+ * Send file(s).
+ */
+static void
+put(int argc, char *argv[])
+{
+ int fd;
+ int n;
+ char *cp, *targ;
+ char line[MAXLINE];
+ struct stat sb;
+
+ if (argc < 2) {
+ strcpy(line, "send ");
+ printf("(file) ");
+ fgets(&line[strlen(line)], sizeof line - strlen(line), stdin);
+ makeargv(line);
+ argc = margc;
+ argv = margv;
+ }
+ if (argc < 2) {
+ putusage(argv[0]);
+ return;
+ }
+ targ = argv[argc - 1];
+ if (strrchr(argv[argc - 1], ':')) {
+ char *lcp;
+
+ for (n = 1; n < argc - 1; n++)
+ if (strchr(argv[n], ':')) {
+ putusage(argv[0]);
+ return;
+ }
+ lcp = argv[argc - 1];
+ targ = strrchr(lcp, ':');
+ *targ++ = 0;
+ if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') {
+ lcp[strlen(lcp) - 1] = '\0';
+ lcp++;
+ }
+ setpeer0(lcp, NULL);
+ }
+ if (!connected) {
+ printf("No target machine specified.\n");
+ return;
+ }
+ if (argc < 4) {
+ cp = argc == 2 ? tail(targ) : argv[1];
+ fd = open(cp, O_RDONLY);
+ if (fd < 0) {
+ warn("%s", cp);
+ return;
+ }
+
+ stat(cp, &sb);
+ asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size);
+
+ if (verbose)
+ printf("putting %s to %s:%s [%s]\n",
+ cp, hostname, targ, mode);
+ xmitfile(peer, port, fd, targ, mode);
+ return;
+ }
+ /* this assumes the target is a directory */
+ /* on a remote unix system. hmmmm. */
+ cp = strchr(targ, '\0');
+ *cp++ = '/';
+ for (n = 1; n < argc - 1; n++) {
+ strcpy(cp, tail(argv[n]));
+ fd = open(argv[n], O_RDONLY);
+ if (fd < 0) {
+ warn("%s", argv[n]);
+ continue;
+ }
+
+ stat(cp, &sb);
+ asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size);
+
+ if (verbose)
+ printf("putting %s to %s:%s [%s]\n",
+ argv[n], hostname, targ, mode);
+ xmitfile(peer, port, fd, targ, mode);
+ }
+}
+
+static void
+putusage(char *s)
+{
+
+ printf("usage: %s file [remotename]\n", s);
+ printf(" %s file host:remotename\n", s);
+ printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s);
+}
+
+/*
+ * Receive file(s).
+ */
+static void
+get(int argc, char *argv[])
+{
+ int fd;
+ int n;
+ char *cp;
+ char *src;
+ char line[MAXLINE];
+
+ if (argc < 2) {
+ strcpy(line, "get ");
+ printf("(files) ");
+ fgets(&line[strlen(line)], sizeof line - strlen(line), stdin);
+ makeargv(line);
+ argc = margc;
+ argv = margv;
+ }
+ if (argc < 2) {
+ getusage(argv[0]);
+ return;
+ }
+ if (!connected) {
+ for (n = 1; n < argc ; n++)
+ if (strrchr(argv[n], ':') == 0) {
+ printf("No remote host specified and "
+ "no host given for file '%s'\n", argv[n]);
+ getusage(argv[0]);
+ return;
+ }
+ }
+ for (n = 1; n < argc ; n++) {
+ src = strrchr(argv[n], ':');
+ if (src == NULL)
+ src = argv[n];
+ else {
+ char *lcp;
+
+ *src++ = 0;
+ lcp = argv[n];
+ if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') {
+ lcp[strlen(lcp) - 1] = '\0';
+ lcp++;
+ }
+ setpeer0(lcp, NULL);
+ if (!connected)
+ continue;
+ }
+ if (argc < 4) {
+ cp = argc == 3 ? argv[2] : tail(src);
+ fd = creat(cp, 0644);
+ if (fd < 0) {
+ warn("%s", cp);
+ return;
+ }
+ if (verbose)
+ printf("getting from %s:%s to %s [%s]\n",
+ hostname, src, cp, mode);
+ recvfile(peer, port, fd, src, mode);
+ break;
+ }
+ cp = tail(src); /* new .. jdg */
+ fd = creat(cp, 0644);
+ if (fd < 0) {
+ warn("%s", cp);
+ continue;
+ }
+ if (verbose)
+ printf("getting from %s:%s to %s [%s]\n",
+ hostname, src, cp, mode);
+ recvfile(peer, port, fd, src, mode);
+ }
+}
+
+static void
+getusage(char *s)
+{
+
+ printf("usage: %s file [localname]\n", s);
+ printf(" %s [host:]file [localname]\n", s);
+ printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s);
+}
+
+static void
+settimeoutpacket(int argc, char *argv[])
+{
+ int t;
+ char line[MAXLINE];
+
+ if (argc < 2) {
+ strcpy(line, "Packet timeout ");
+ printf("(value) ");
+ fgets(&line[strlen(line)], sizeof line - strlen(line), stdin);
+ makeargv(line);
+ argc = margc;
+ argv = margv;
+ }
+ if (argc != 2) {
+ printf("usage: %s value\n", argv[0]);
+ return;
+ }
+ t = atoi(argv[1]);
+ if (t < 0) {
+ printf("%s: bad value\n", argv[1]);
+ return;
+ }
+
+ settimeouts(t, timeoutnetwork, maxtimeouts);
+}
+
+static void
+settimeoutnetwork(int argc, char *argv[])
+{
+ int t;
+ char line[MAXLINE];
+
+ if (argc < 2) {
+ strcpy(line, "Network timeout ");
+ printf("(value) ");
+ fgets(&line[strlen(line)], sizeof line - strlen(line), stdin);
+ makeargv(line);
+ argc = margc;
+ argv = margv;
+ }
+ if (argc != 2) {
+ printf("usage: %s value\n", argv[0]);
+ return;
+ }
+ t = atoi(argv[1]);
+ if (t < 0) {
+ printf("%s: bad value\n", argv[1]);
+ return;
+ }
+
+ settimeouts(timeoutpacket, t, maxtimeouts);
+}
+
+static void
+showstatus(int argc __unused, char *argv[] __unused)
+{
+
+ printf("Remote host: %s\n",
+ connected ? hostname : "none specified yet");
+ printf("RFC2347 Options support: %s\n",
+ options_rfc_enabled ? "enabled" : "disabled");
+ printf("Non-RFC defined options support: %s\n",
+ options_extra_enabled ? "enabled" : "disabled");
+ printf("Mode: %s\n", mode);
+ printf("Verbose: %s\n", verbose ? "on" : "off");
+ printf("Debug: %s\n", debug_show(debug));
+ printf("Artificial packetloss: %d in 100 packets\n",
+ packetdroppercentage);
+ printf("Segment size: %d bytes\n", segsize);
+ printf("Network timeout: %d seconds\n", timeoutpacket);
+ printf("Maximum network timeout: %d seconds\n", timeoutnetwork);
+ printf("Maximum timeouts: %d \n", maxtimeouts);
+}
+
+static void
+intr(int dummy __unused)
+{
+
+ signal(SIGALRM, SIG_IGN);
+ alarm(0);
+ longjmp(toplevel, -1);
+}
+
+static char *
+tail(char *filename)
+{
+ char *s;
+
+ while (*filename) {
+ s = strrchr(filename, '/');
+ if (s == NULL)
+ break;
+ if (s[1])
+ return (s + 1);
+ *s = '\0';
+ }
+ return (filename);
+}
+
+static const char *
+command_prompt(void)
+{
+
+ return ("tftp> ");
+}
+
+/*
+ * Command parser.
+ */
+static void
+command(void)
+{
+ HistEvent he;
+ struct cmd *c;
+ static EditLine *el;
+ static History *hist;
+ const char *bp;
+ char *cp;
+ int len, num, vrbose;
+ char line[MAXLINE];
+
+ vrbose = isatty(0);
+ if (vrbose) {
+ el = el_init("tftp", stdin, stdout, stderr);
+ hist = history_init();
+ history(hist, &he, H_SETSIZE, 100);
+ el_set(el, EL_HIST, history, hist);
+ el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_PROMPT, command_prompt);
+ el_set(el, EL_SIGNAL, 1);
+ el_source(el, NULL);
+ }
+ for (;;) {
+ if (vrbose) {
+ if ((bp = el_gets(el, &num)) == NULL || num == 0)
+ exit(0);
+ len = MIN(MAXLINE, num);
+ memcpy(line, bp, len);
+ line[len] = '\0';
+ history(hist, &he, H_ENTER, bp);
+ } else {
+ line[0] = 0;
+ if (fgets(line, sizeof line , stdin) == NULL) {
+ if (feof(stdin)) {
+ exit(txrx_error);
+ } else {
+ continue;
+ }
+ }
+ }
+ if ((cp = strchr(line, '\n')))
+ *cp = '\0';
+ if (line[0] == 0)
+ continue;
+ makeargv(line);
+ if (margc == 0)
+ continue;
+ c = getcmd(margv[0]);
+ if (c == (struct cmd *)-1) {
+ printf("?Ambiguous command\n");
+ continue;
+ }
+ if (c == NULL) {
+ printf("?Invalid command\n");
+ continue;
+ }
+ (*c->handler)(margc, margv);
+ }
+}
+
+static struct cmd *
+getcmd(char *name)
+{
+ const char *p, *q;
+ struct cmd *c, *found;
+ int nmatches, longest;
+
+ longest = 0;
+ nmatches = 0;
+ found = 0;
+ for (c = cmdtab; (p = c->name) != NULL; c++) {
+ for (q = name; *q == *p++; q++)
+ if (*q == 0) /* exact match? */
+ return (c);
+ if (!*q) { /* the name was a prefix */
+ if (q - name > longest) {
+ longest = q - name;
+ nmatches = 1;
+ found = c;
+ } else if (q - name == longest)
+ nmatches++;
+ }
+ }
+ if (nmatches > 1)
+ return ((struct cmd *)-1);
+ return (found);
+}
+
+/*
+ * Slice a string up into argc/argv.
+ */
+static void
+makeargv(char *line)
+{
+ char *cp;
+ char **argp = margv;
+
+ margc = 0;
+ if ((cp = strchr(line, '\n')) != NULL)
+ *cp = '\0';
+ for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) {
+ while (isspace(*cp))
+ cp++;
+ if (*cp == '\0')
+ break;
+ *argp++ = cp;
+ margc += 1;
+ while (*cp != '\0' && !isspace(*cp))
+ cp++;
+ if (*cp == '\0')
+ break;
+ *cp++ = '\0';
+ }
+ *argp++ = 0;
+}
+
+static void
+quit(int argc __unused, char *argv[] __unused)
+{
+
+ exit(txrx_error);
+}
+
+/*
+ * Help command.
+ */
+static void
+help(int argc, char *argv[])
+{
+ struct cmd *c;
+
+ if (argc == 1) {
+ printf("Commands may be abbreviated. Commands are:\n\n");
+ for (c = cmdtab; c->name; c++)
+ printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help);
+
+ printf("\n[-] : You shouldn't use these ones anymore.\n");
+ printf("[*] : RFC2347 options support required.\n");
+ printf("[**] : Non-standard RFC2347 option.\n");
+ return;
+ }
+ while (--argc > 0) {
+ char *arg;
+ arg = *++argv;
+ c = getcmd(arg);
+ if (c == (struct cmd *)-1)
+ printf("?Ambiguous help command: %s\n", arg);
+ else if (c == (struct cmd *)0)
+ printf("?Invalid help command: %s\n", arg);
+ else
+ printf("%s\n", c->help);
+ }
+}
+
+static void
+setverbose(int argc __unused, char *argv[] __unused)
+{
+
+ verbose = !verbose;
+ printf("Verbose mode %s.\n", verbose ? "on" : "off");
+}
+
+static void
+setoptions(int argc, char *argv[])
+{
+
+ if (argc == 2) {
+ if (strcasecmp(argv[1], "enable") == 0 ||
+ strcasecmp(argv[1], "on") == 0) {
+ options_extra_enabled = 1;
+ options_rfc_enabled = 1;
+ }
+ if (strcasecmp(argv[1], "disable") == 0 ||
+ strcasecmp(argv[1], "off") == 0) {
+ options_extra_enabled = 0;
+ options_rfc_enabled = 0;
+ }
+ if (strcasecmp(argv[1], "extra") == 0)
+ options_extra_enabled = !options_extra_enabled;
+ }
+ printf("Support for RFC2347 style options are now %s.\n",
+ options_rfc_enabled ? "enabled" : "disabled");
+ printf("Support for non-RFC defined options are now %s.\n",
+ options_extra_enabled ? "enabled" : "disabled");
+
+ printf("\nThe following options are available:\n"
+ "\toptions on : enable support for RFC2347 style options\n"
+ "\toptions off : disable support for RFC2347 style options\n"
+ "\toptions extra : toggle support for non-RFC defined options\n"
+ );
+}
+
+static void
+setrollover(int argc, char *argv[])
+{
+
+ if (argc == 2) {
+ if (strcasecmp(argv[1], "never") == 0 ||
+ strcasecmp(argv[1], "none") == 0) {
+ free(options[OPT_ROLLOVER].o_request);
+ options[OPT_ROLLOVER].o_request = NULL;
+ }
+ if (strcasecmp(argv[1], "1") == 0) {
+ free(options[OPT_ROLLOVER].o_request);
+ options[OPT_ROLLOVER].o_request = strdup("1");
+ }
+ if (strcasecmp(argv[1], "0") == 0) {
+ free(options[OPT_ROLLOVER].o_request);
+ options[OPT_ROLLOVER].o_request = strdup("0");
+ }
+ }
+ printf("Support for the rollover options is %s.\n",
+ options[OPT_ROLLOVER].o_request != NULL ? "enabled" : "disabled");
+ if (options[OPT_ROLLOVER].o_request != NULL)
+ printf("Block rollover will be to block %s.\n",
+ options[OPT_ROLLOVER].o_request);
+
+
+ printf("\nThe following rollover options are available:\n"
+ "\trollover 0 : rollover to block zero (default)\n"
+ "\trollover 1 : rollover to block one\n"
+ "\trollover never : do not support the rollover option\n"
+ "\trollover none : do not support the rollover option\n"
+ );
+}
+
+static void
+setdebug(int argc, char *argv[])
+{
+ int i;
+
+ if (argc != 1) {
+ i = 1;
+ while (i < argc)
+ debug ^= debug_find(argv[i++]);
+ }
+ printf("The following debugging is enabled: %s\n", debug_show(debug));
+
+ printf("\nThe following debugs are available:\n");
+ i = 0;
+ while (debugs[i].name != NULL) {
+ printf("\t%s\t%s\n", debugs[i].name, debugs[i].desc);
+ i++;
+ }
+}
+
+static void
+setblocksize(int argc, char *argv[])
+{
+
+ if (!options_rfc_enabled)
+ printf("RFC2347 style options are not enabled "
+ "(but proceeding anyway)\n");
+
+ if (argc != 1) {
+ int size = atoi(argv[1]);
+ size_t max;
+ u_long maxdgram;
+
+ max = sizeof(maxdgram);
+ if (sysctlbyname("net.inet.udp.maxdgram",
+ &maxdgram, &max, NULL, 0) < 0) {
+ perror("sysctl: net.inet.udp.maxdgram");
+ return;
+ }
+
+ if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {
+ printf("Blocksize should be between %d and %d bytes.\n",
+ BLKSIZE_MIN, BLKSIZE_MAX);
+ return;
+ } else if (size > (int)maxdgram - 4) {
+ printf("Blocksize can't be bigger than %ld bytes due "
+ "to the net.inet.udp.maxdgram sysctl limitation.\n",
+ maxdgram - 4);
+ asprintf(&options[OPT_BLKSIZE].o_request,
+ "%ld", maxdgram - 4);
+ } else {
+ asprintf(&options[OPT_BLKSIZE].o_request, "%d", size);
+ }
+ }
+ printf("Blocksize is now %s bytes.\n", options[OPT_BLKSIZE].o_request);
+}
+
+static void
+setblocksize2(int argc, char *argv[])
+{
+
+ if (!options_rfc_enabled || !options_extra_enabled)
+ printf(
+ "RFC2347 style or non-RFC defined options are not enabled "
+ "(but proceeding anyway)\n");
+
+ if (argc != 1) {
+ int size = atoi(argv[1]);
+ int i;
+ size_t max;
+ u_long maxdgram;
+
+ int sizes[] = {
+ 8, 16, 32, 64, 128, 256, 512, 1024,
+ 2048, 4096, 8192, 16384, 32768, 0
+ };
+
+ max = sizeof(maxdgram);
+ if (sysctlbyname("net.inet.udp.maxdgram",
+ &maxdgram, &max, NULL, 0) < 0) {
+ perror("sysctl: net.inet.udp.maxdgram");
+ return;
+ }
+
+ for (i = 0; sizes[i] != 0; i++) {
+ if (sizes[i] == size) break;
+ }
+ if (sizes[i] == 0) {
+ printf("Blocksize2 should be a power of two between "
+ "8 and 32768.\n");
+ return;
+ }
+
+ if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {
+ printf("Blocksize2 should be between "
+ "%d and %d bytes.\n", BLKSIZE_MIN, BLKSIZE_MAX);
+ return;
+ } else if (size > (int)maxdgram - 4) {
+ printf("Blocksize2 can't be bigger than %ld bytes due "
+ "to the net.inet.udp.maxdgram sysctl limitation.\n",
+ maxdgram - 4);
+ for (i = 0; sizes[i+1] != 0; i++) {
+ if ((int)maxdgram < sizes[i+1]) break;
+ }
+ asprintf(&options[OPT_BLKSIZE2].o_request,
+ "%d", sizes[i]);
+ } else {
+ asprintf(&options[OPT_BLKSIZE2].o_request, "%d", size);
+ }
+ }
+ printf("Blocksize2 is now %s bytes.\n",
+ options[OPT_BLKSIZE2].o_request);
+}
+
+static void
+setpacketdrop(int argc, char *argv[])
+{
+
+ if (argc != 1)
+ packetdroppercentage = atoi(argv[1]);
+
+ printf("Randomly %d in 100 packets will be dropped\n",
+ packetdroppercentage);
+}
diff --git a/usr.bin/tftp/tftp.1 b/usr.bin/tftp/tftp.1
new file mode 100644
index 0000000..0dfcd42
--- /dev/null
+++ b/usr.bin/tftp/tftp.1
@@ -0,0 +1,272 @@
+.\" Copyright (c) 1990, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)tftp.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd June 22, 2011
+.Dt TFTP 1
+.Os
+.Sh NAME
+.Nm tftp
+.Nd trivial file transfer program
+.Sh SYNOPSIS
+.Nm
+.Op Ar host Op Ar port
+.Sh DESCRIPTION
+The
+.Nm
+utility is the user interface to the Internet
+.Tn TFTP
+(Trivial File Transfer Protocol),
+which allows users to transfer files to and from a remote machine.
+The remote
+.Ar host
+may be specified on the command line, in which case
+.Nm
+uses
+.Ar host
+as the default host for future transfers (see the
+.Cm connect
+command below).
+.Sh COMMANDS
+Once
+.Nm
+is running, it issues the prompt
+.Dq Li tftp>
+and recognizes the following commands:
+.Pp
+.Bl -tag -width verbose -compact
+.It Cm \&? Ar command-name ...
+Print help information.
+.Pp
+.It Cm ascii
+Shorthand for "mode ascii"
+.Pp
+.It Cm binary
+Shorthand for "mode binary"
+.Pp
+.It Cm blocksize Ar [size]
+Sets the TFTP blksize option in TFTP Read Request or Write Request packets
+to
+.Ar [size]
+as specified in RFC 2348. Valid values are between 8 and 65464.
+If no blocksize is specified, then by default a blocksize of 512 bytes
+will be used.
+.Pp
+.It Cm blocksize2 Ar [size]
+Sets the TFTP blksize2 option in TFTP Read Request or Write Request packets
+to
+.Ar [size] .
+Values are restricted to powers of 2 between 8 and 32768. This is a
+non-standard TFTP option.
+.Pp
+.It Cm connect Ar host Op Ar port
+Set the
+.Ar host
+(and optionally
+.Ar port )
+for transfers.
+Note that the
+.Tn TFTP
+protocol, unlike the
+.Tn FTP
+protocol,
+does not maintain connections between transfers; thus, the
+.Cm connect
+command does not actually create a connection,
+but merely remembers what host is to be used for transfers.
+You do not have to use the
+.Cm connect
+command; the remote host can be specified as part of the
+.Cm get
+or
+.Cm put
+commands.
+.Pp
+.It Cm debug Ar level
+Enable or disable debugging levels during verbose output. The value of
+.Ar level
+can be one of
+.Cm packet , simple , options ,
+or
+.Cm access .
+.Pp
+.It Cm get Oo Ar host : Oc Ns Ar file Op Ar localname
+.It Cm get Xo
+.Oo Ar host1 : Oc Ns Ar file1
+.Oo Ar host2 : Oc Ns Ar file2 ...
+.Oo Ar hostN : Oc Ns Ar fileN
+.Xc
+Get one or more files from the remote host.
+When using the
+.Ar host
+argument, the
+.Ar host
+will be used as default host for future transfers.
+If
+.Ar localname
+is specified, the file is stored locally as
+.Ar localname ,
+otherwise the original filename is used.
+Note that it is not possible to download two files at a time, only
+one, three, or more than three files, at a time.
+.Pp
+To specify an IPv6 numeric address for a host, wrap it using square
+brackets like
+.Dq Li [3ffe:2900:e00c:ffee::1234] : Ns Ar file
+to disambiguate the
+colons used in the IPv6 address from the colon separating the host and
+the filename.
+.Pp
+.It Cm mode Ar transfer-mode
+Set the mode for transfers;
+.Ar transfer-mode
+may be one of
+.Em ascii
+or
+.Em binary .
+The default is
+.Em ascii .
+.Pp
+.It Cm packetdrop [arg]
+Randomly drop
+.Ar arg
+out of 100 packets during a transfer. This is a debugging feature.
+.Pp
+.It Cm put Ar file Op Oo Ar host : Oc Ns Ar remotename
+.It Cm put Ar file1 file2 ... fileN Op Oo Ar host : Oc Ns Ar remote-directory
+Put a file or set of files to the remote host.
+When
+.Ar remotename
+is specified, the file is stored remotely as
+.Ar remotename ,
+otherwise the original filename is used.
+If the
+.Ar remote-directory
+argument is used, the remote host is assumed to be a
+.Ux
+machine.
+To specify an IPv6 numeric address for a
+.Ar host ,
+see the example under the
+.Cm get
+command.
+.Pp
+.It Cm options Ar [arg]
+Enable or disable support for TFTP options. The valid values of
+.Ar arg
+are
+.Cm on
+(enable RFC 2347 options),
+.Cm off
+(disable RFC 2347 options), and
+.Cm extra
+(toggle support for non-RFC defined options).
+.Pp
+.It Cm quit
+Exit
+.Nm .
+An end of file also exits.
+.Pp
+.It Cm rexmt Ar retransmission-timeout
+Set the per-packet retransmission timeout, in seconds.
+.Pp
+.It Cm rollover [arg]
+Specify the rollover option in TFTP Read Request or Write
+Request packets. After 65535 packets have been transmitted, set the block
+counter to
+.Ar arg .
+Valid values of
+.Ar arg
+are 0 and 1. This is a non-standard TFTP option.
+.Pp
+.It Cm status
+Show current status.
+.Pp
+.It Cm timeout Ar total-transmission-timeout
+Set the total transmission timeout, in seconds.
+.Pp
+.It Cm trace
+Toggle packet tracing.
+.Pp
+.It Cm verbose
+Toggle verbose mode.
+.El
+.Sh SEE ALSO
+.Xr tftpd 8
+.Pp
+The following RFC's are supported:
+.Rs
+.%T RFC 1350: The TFTP Protocol (Revision 2)
+.Re
+.Rs
+.%T RFC 2347: TFTP Option Extension
+.Re
+.Rs
+.%T RFC 2348: TFTP Blocksize Option
+.Re
+.Rs
+.%T RFC 2349: TFTP Timeout Interval and Transfer Size Options
+.Re
+.Rs
+.%T RFC 3617: Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP)
+.Re
+.Pp
+The non-standard
+.Cm rollover
+and
+.Cm blksize2
+TFTP options are mentioned here:
+.Rs
+.%T Extending TFTP
+.%U http://www.compuphase.com/tftp.htm
+.Re
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
+.Pp
+Edwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the
+.Xr tftpd 8
+and
+.Nm
+code to support RFC2348.
+.Sh NOTES
+Because there is no user-login or validation within
+the
+.Tn TFTP
+protocol, the remote site will probably have some
+sort of file-access restrictions in place.
+The
+exact methods are specific to each site and therefore
+difficult to document here.
+.Pp
+Files larger than 33488896 octets (65535 blocks) cannot be transferred
+without client and server supporting the TFTP blocksize option (RFC2348),
+or the non-standard TFTP rollover option.
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
new file mode 100644
index 0000000..eaf2a6f
--- /dev/null
+++ b/usr.bin/tftp/tftp.c
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
+
+/*
+ * TFTP User Program -- Protocol Machines
+ */
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+
+#include <arpa/tftp.h>
+
+#include <err.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+
+#include "tftp.h"
+#include "tftp-file.h"
+#include "tftp-utils.h"
+#include "tftp-io.h"
+#include "tftp-transfer.h"
+#include "tftp-options.h"
+
+/*
+ * Send the requested file.
+ */
+void
+xmitfile(int peer, char *port, int fd, char *name, char *mode)
+{
+ struct tftphdr *rp;
+ int n, i;
+ uint16_t block;
+ struct sockaddr_storage serv; /* valid server port number */
+ char recvbuffer[MAXPKTSIZE];
+ struct tftp_stats tftp_stats;
+
+ stats_init(&tftp_stats);
+
+ memset(&serv, 0, sizeof(serv));
+ rp = (struct tftphdr *)recvbuffer;
+
+ if (port == NULL) {
+ struct servent *se;
+ se = getservbyname("tftp", "udp");
+ ((struct sockaddr_in *)&peer_sock)->sin_port = se->s_port;
+ } else
+ ((struct sockaddr_in *)&peer_sock)->sin_port =
+ htons(atoi(port));
+
+ for (i = 0; i < 12; i++) {
+ struct sockaddr_storage from;
+
+ /* Tell the other side what we want to do */
+ if (debug&DEBUG_SIMPLE)
+ printf("Sending %s\n", name);
+
+ n = send_wrq(peer, name, mode);
+ if (n > 0) {
+ printf("Cannot send WRQ packet\n");
+ return;
+ }
+
+ /*
+ * The first packet we receive has the new destination port
+ * we have to send the next packets to.
+ */
+ n = receive_packet(peer, recvbuffer,
+ MAXPKTSIZE, &from, timeoutpacket);
+
+ /* We got some data! */
+ if (n >= 0) {
+ ((struct sockaddr_in *)&peer_sock)->sin_port =
+ ((struct sockaddr_in *)&from)->sin_port;
+ break;
+ }
+
+ /* This should be retried */
+ if (n == RP_TIMEOUT) {
+ printf("Try %d, didn't receive answer from remote.\n",
+ i + 1);
+ continue;
+ }
+
+ /* Everything else is fatal */
+ break;
+ }
+ if (i == 12) {
+ printf("Transfer timed out.\n");
+ return;
+ }
+ if (rp->th_opcode == ERROR) {
+ printf("Got ERROR, aborted\n");
+ return;
+ }
+
+ /*
+ * If the first packet is an OACK instead of an ACK packet,
+ * handle it different.
+ */
+ if (rp->th_opcode == OACK) {
+ if (!options_rfc_enabled) {
+ printf("Got OACK while options are not enabled!\n");
+ send_error(peer, EBADOP);
+ return;
+ }
+
+ parse_options(peer, rp->th_stuff, n + 2);
+ }
+
+ if (read_init(fd, NULL, mode) < 0) {
+ warn("read_init()");
+ return;
+ }
+
+ block = 1;
+ tftp_send(peer, &block, &tftp_stats);
+
+ read_close();
+ if (tftp_stats.amount > 0)
+ printstats("Sent", verbose, &tftp_stats);
+
+ txrx_error = 1;
+}
+
+/*
+ * Receive a file.
+ */
+void
+recvfile(int peer, char *port, int fd, char *name, char *mode)
+{
+ struct tftphdr *rp;
+ uint16_t block;
+ char recvbuffer[MAXPKTSIZE];
+ int n, i;
+ struct tftp_stats tftp_stats;
+
+ stats_init(&tftp_stats);
+
+ rp = (struct tftphdr *)recvbuffer;
+
+ if (port == NULL) {
+ struct servent *se;
+ se = getservbyname("tftp", "udp");
+ ((struct sockaddr_in *)&peer_sock)->sin_port = se->s_port;
+ } else
+ ((struct sockaddr_in *)&peer_sock)->sin_port =
+ htons(atoi(port));
+
+ for (i = 0; i < 12; i++) {
+ struct sockaddr_storage from;
+
+ /* Tell the other side what we want to do */
+ if (debug&DEBUG_SIMPLE)
+ printf("Requesting %s\n", name);
+
+ n = send_rrq(peer, name, mode);
+ if (n > 0) {
+ printf("Cannot send RRQ packet\n");
+ return;
+ }
+
+ /*
+ * The first packet we receive has the new destination port
+ * we have to send the next packets to.
+ */
+ n = receive_packet(peer, recvbuffer,
+ MAXPKTSIZE, &from, timeoutpacket);
+
+ /* We got something useful! */
+ if (n >= 0) {
+ ((struct sockaddr_in *)&peer_sock)->sin_port =
+ ((struct sockaddr_in *)&from)->sin_port;
+ break;
+ }
+
+ /* We should retry if this happens */
+ if (n == RP_TIMEOUT) {
+ printf("Try %d, didn't receive answer from remote.\n",
+ i + 1);
+ continue;
+ }
+
+ /* Otherwise it is a fatal error */
+ break;
+ }
+ if (i == 12) {
+ printf("Transfer timed out.\n");
+ return;
+ }
+ if (rp->th_opcode == ERROR) {
+ tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg);
+ return;
+ }
+
+ if (write_init(fd, NULL, mode) < 0) {
+ warn("write_init");
+ return;
+ }
+
+ /*
+ * If the first packet is an OACK packet instead of an DATA packet,
+ * handle it different.
+ */
+ if (rp->th_opcode == OACK) {
+ if (!options_rfc_enabled) {
+ printf("Got OACK while options are not enabled!\n");
+ send_error(peer, EBADOP);
+ return;
+ }
+
+ parse_options(peer, rp->th_stuff, n + 2);
+
+ n = send_ack(peer, 0);
+ if (n > 0) {
+ printf("Cannot send ACK on OACK.\n");
+ return;
+ }
+ block = 0;
+ tftp_receive(peer, &block, &tftp_stats, NULL, 0);
+ } else {
+ block = 1;
+ tftp_receive(peer, &block, &tftp_stats, rp, n);
+ }
+
+ write_close();
+ if (tftp_stats.amount > 0)
+ printstats("Received", verbose, &tftp_stats);
+ return;
+}
diff --git a/usr.bin/tftp/tftp.h b/usr.bin/tftp/tftp.h
new file mode 100644
index 0000000..4cdef25
--- /dev/null
+++ b/usr.bin/tftp/tftp.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+void recvfile(int peer, char *port, int fd, char *name, char *mode);
+void xmitfile(int peer, char *port, int fd, char *name, char *mode);
+
+extern int verbose;
+extern int maxtimeout;
+extern volatile int txrx_error;
diff --git a/usr.bin/time/Makefile b/usr.bin/time/Makefile
new file mode 100644
index 0000000..e462af66
--- /dev/null
+++ b/usr.bin/time/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= time
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/time/Makefile.depend b/usr.bin/time/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/time/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/time/time.1 b/usr.bin/time/time.1
new file mode 100644
index 0000000..dee3392
--- /dev/null
+++ b/usr.bin/time/time.1
@@ -0,0 +1,145 @@
+.\" Copyright (c) 1980, 1991, 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.
+.\"
+.\" @(#)time.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd May 14, 2006
+.Dt TIME 1
+.Os
+.Sh NAME
+.Nm time
+.Nd time command execution
+.Sh SYNOPSIS
+.Nm
+.Op Fl al
+.Op Fl h | Fl p
+.Op Fl o Ar file
+.Ar utility Op Ar argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility
+executes and
+times the specified
+.Ar utility .
+After the
+.Ar utility
+finishes,
+.Nm
+writes to the standard error stream,
+(in seconds):
+the total time elapsed,
+the time used to execute the
+.Ar utility
+process and the time consumed by system overhead.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+If the
+.Fl o
+flag is used, append to the specified file rather than overwriting
+it.
+Otherwise, this option has no effect.
+.It Fl h
+Print times in a human friendly format.
+Times are printed in minutes, hours,
+etc.\& as appropriate.
+.It Fl l
+The contents of the
+.Em rusage
+structure are printed as well.
+.It Fl o Ar file
+Write the output to
+.Ar file
+instead of stderr.
+If
+.Ar file
+exists and the
+.Fl a
+flag is not specified, the file will be overwritten.
+.It Fl p
+Makes
+.Nm
+output POSIX.2 compliant (each time is printed on its own line).
+.El
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+(see the status argument for
+.Xr stty 1 )
+signal, the current time the given command is running will be written to the
+standard output.
+.Sh ENVIRONMENT
+The
+.Ev PATH
+environment variable is used to locate the requested
+.Ar utility
+if the name contains no
+.Ql /
+characters.
+.Sh EXIT STATUS
+If
+.Ar utility
+could be timed successfully, its exit status is returned.
+If
+.Ar utility
+terminated abnormally, a warning message is output to stderr.
+If the
+.Ar utility
+was found but could not be run, the exit status is 126.
+If no
+.Ar utility
+could be found at all, the exit status is 127.
+If
+.Nm
+encounters any other error, the exit status is between 1 and 125
+included.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr getrusage 2 ,
+.Xr wait 2
+.Sh STANDARDS
+The
+.Nm
+utility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX'').
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v3 .
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
new file mode 100644
index 0000000..678a2af
--- /dev/null
+++ b/usr.bin/time/time.c
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 1987, 1988, 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) 1987, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/signal.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+static int getstathz(void);
+static void humantime(FILE *, long, long);
+static void showtime(FILE *, struct timeval *, struct timeval *,
+ struct rusage *);
+static void siginfo(int);
+static void usage(void);
+
+static sig_atomic_t siginfo_recvd;
+static char decimal_point;
+static struct timeval before_tv;
+static int hflag, pflag;
+
+int
+main(int argc, char **argv)
+{
+ int aflag, ch, lflag, status;
+ int exitonsig;
+ pid_t pid;
+ struct rlimit rl;
+ struct rusage ru;
+ struct timeval after;
+ char *ofn = NULL;
+ FILE *out = stderr;
+
+ (void) setlocale(LC_NUMERIC, "");
+ decimal_point = localeconv()->decimal_point[0];
+
+ aflag = hflag = lflag = pflag = 0;
+ while ((ch = getopt(argc, argv, "ahlo:p")) != -1)
+ switch((char)ch) {
+ case 'a':
+ aflag = 1;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'o':
+ ofn = optarg;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ if (!(argc -= optind))
+ exit(0);
+ argv += optind;
+
+ if (ofn) {
+ if ((out = fopen(ofn, aflag ? "ae" : "we")) == NULL)
+ err(1, "%s", ofn);
+ setvbuf(out, (char *)NULL, _IONBF, (size_t)0);
+ }
+
+ (void)gettimeofday(&before_tv, NULL);
+ switch(pid = fork()) {
+ case -1: /* error */
+ err(1, "time");
+ /* NOTREACHED */
+ case 0: /* child */
+ execvp(*argv, argv);
+ err(errno == ENOENT ? 127 : 126, "%s", *argv);
+ /* NOTREACHED */
+ }
+ /* parent */
+ (void)signal(SIGINT, SIG_IGN);
+ (void)signal(SIGQUIT, SIG_IGN);
+ siginfo_recvd = 0;
+ (void)signal(SIGINFO, siginfo);
+ (void)siginterrupt(SIGINFO, 1);
+ while (wait4(pid, &status, 0, &ru) != pid) {
+ if (siginfo_recvd) {
+ siginfo_recvd = 0;
+ (void)gettimeofday(&after, NULL);
+ getrusage(RUSAGE_CHILDREN, &ru);
+ showtime(stdout, &before_tv, &after, &ru);
+ }
+ }
+ (void)gettimeofday(&after, NULL);
+ if ( ! WIFEXITED(status))
+ warnx("command terminated abnormally");
+ exitonsig = WIFSIGNALED(status) ? WTERMSIG(status) : 0;
+ showtime(out, &before_tv, &after, &ru);
+ if (lflag) {
+ int hz = getstathz();
+ u_long ticks;
+
+ ticks = hz * (ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) +
+ hz * (ru.ru_utime.tv_usec + ru.ru_stime.tv_usec) / 1000000;
+
+ /*
+ * If our round-off on the tick calculation still puts us at 0,
+ * then always assume at least one tick.
+ */
+ if (ticks == 0)
+ ticks = 1;
+
+ fprintf(out, "%10ld %s\n",
+ ru.ru_maxrss, "maximum resident set size");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_ixrss / ticks, "average shared memory size");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_idrss / ticks, "average unshared data size");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_isrss / ticks, "average unshared stack size");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_minflt, "page reclaims");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_majflt, "page faults");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_nswap, "swaps");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_inblock, "block input operations");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_oublock, "block output operations");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_msgsnd, "messages sent");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_msgrcv, "messages received");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_nsignals, "signals received");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_nvcsw, "voluntary context switches");
+ fprintf(out, "%10ld %s\n",
+ ru.ru_nivcsw, "involuntary context switches");
+ }
+ /*
+ * If the child has exited on a signal, exit on the same
+ * signal, too, in order to reproduce the child's exit status.
+ * However, avoid actually dumping core from the current process.
+ */
+ if (exitonsig) {
+ if (signal(exitonsig, SIG_DFL) == SIG_ERR)
+ warn("signal");
+ else {
+ rl.rlim_max = rl.rlim_cur = 0;
+ if (setrlimit(RLIMIT_CORE, &rl) == -1)
+ warn("setrlimit");
+ kill(getpid(), exitonsig);
+ }
+ }
+ exit (WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: time [-al] [-h | -p] [-o file] utility [argument ...]\n");
+ exit(1);
+}
+
+/*
+ * Return the frequency of the kernel's statistics clock.
+ */
+static int
+getstathz(void)
+{
+ int mib[2];
+ size_t size;
+ struct clockinfo clockrate;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_CLOCKRATE;
+ size = sizeof clockrate;
+ if (sysctl(mib, 2, &clockrate, &size, NULL, 0) == -1)
+ err(1, "sysctl kern.clockrate");
+ return clockrate.stathz;
+}
+
+static void
+humantime(FILE *out, long sec, long usec)
+{
+ long days, hrs, mins;
+
+ days = sec / (60L * 60 * 24);
+ sec %= (60L * 60 * 24);
+ hrs = sec / (60L * 60);
+ sec %= (60L * 60);
+ mins = sec / 60;
+ sec %= 60;
+
+ fprintf(out, "\t");
+ if (days)
+ fprintf(out, "%ldd", days);
+ if (hrs)
+ fprintf(out, "%ldh", hrs);
+ if (mins)
+ fprintf(out, "%ldm", mins);
+ fprintf(out, "%ld%c%02lds", sec, decimal_point, usec);
+}
+
+static void
+showtime(FILE *out, struct timeval *before, struct timeval *after,
+ struct rusage *ru)
+{
+
+ after->tv_sec -= before->tv_sec;
+ after->tv_usec -= before->tv_usec;
+ if (after->tv_usec < 0)
+ after->tv_sec--, after->tv_usec += 1000000;
+
+ if (pflag) {
+ /* POSIX wants output that must look like
+ "real %f\nuser %f\nsys %f\n" and requires
+ at least two digits after the radix. */
+ fprintf(out, "real %jd%c%02ld\n",
+ (intmax_t)after->tv_sec, decimal_point,
+ after->tv_usec/10000);
+ fprintf(out, "user %jd%c%02ld\n",
+ (intmax_t)ru->ru_utime.tv_sec, decimal_point,
+ ru->ru_utime.tv_usec/10000);
+ fprintf(out, "sys %jd%c%02ld\n",
+ (intmax_t)ru->ru_stime.tv_sec, decimal_point,
+ ru->ru_stime.tv_usec/10000);
+ } else if (hflag) {
+ humantime(out, after->tv_sec, after->tv_usec/10000);
+ fprintf(out, " real\t");
+ humantime(out, ru->ru_utime.tv_sec, ru->ru_utime.tv_usec/10000);
+ fprintf(out, " user\t");
+ humantime(out, ru->ru_stime.tv_sec, ru->ru_stime.tv_usec/10000);
+ fprintf(out, " sys\n");
+ } else {
+ fprintf(out, "%9jd%c%02ld real ",
+ (intmax_t)after->tv_sec, decimal_point,
+ after->tv_usec/10000);
+ fprintf(out, "%9jd%c%02ld user ",
+ (intmax_t)ru->ru_utime.tv_sec, decimal_point,
+ ru->ru_utime.tv_usec/10000);
+ fprintf(out, "%9jd%c%02ld sys\n",
+ (intmax_t)ru->ru_stime.tv_sec, decimal_point,
+ ru->ru_stime.tv_usec/10000);
+ }
+}
+
+static void
+siginfo(int sig __unused)
+{
+
+ siginfo_recvd = 1;
+}
diff --git a/usr.bin/timeout/Makefile b/usr.bin/timeout/Makefile
new file mode 100644
index 0000000..c1957ae
--- /dev/null
+++ b/usr.bin/timeout/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= timeout
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/timeout/Makefile.depend b/usr.bin/timeout/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/timeout/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tests/Makefile b/usr.bin/timeout/tests/Makefile
new file mode 100644
index 0000000..bced155
--- /dev/null
+++ b/usr.bin/timeout/tests/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH= timeout
+
+.include <bsd.test.mk>
diff --git a/usr.bin/timeout/tests/Makefile.depend b/usr.bin/timeout/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/timeout/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/timeout/tests/timeout.sh b/usr.bin/timeout/tests/timeout.sh
new file mode 100644
index 0000000..6ccde32
--- /dev/null
+++ b/usr.bin/timeout/tests/timeout.sh
@@ -0,0 +1,215 @@
+# $FreeBSD$
+
+atf_test_case nominal
+nominal_head()
+{
+ atf_set "descr" "Basic tests on timeout(1) utility"
+}
+
+nominal_body()
+{
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 5 true
+}
+
+atf_test_case time_unit
+time_unit_head()
+{
+ atf_set "descr" "Test parsing the default time unit"
+}
+
+time_unit_body()
+{
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 1d true
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 1h true
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 1m true
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 1s true
+}
+
+atf_test_case no_timeout
+no_timeout_head()
+{
+ atf_set "descr" "Test disabled timeout"
+}
+
+no_timeout_body()
+{
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x timeout 0 true
+}
+
+atf_test_case exit_numbers
+exit_numbers_head()
+{
+ atf_set "descr" "Test exit numbers"
+}
+
+exit_numbers_body()
+{
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:2 \
+ -x timeout 5 sh -c \'exit 2\'
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:124 \
+ -x timeout .1 sleep 1
+
+ # With preserv status exit should be 128 + TERM aka 143
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:143 \
+ -x timeout --preserve-status .1 sleep 10
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:124 \
+ -x timeout -s1 -k1 .1 sleep 10
+
+ atf_check \
+ -o empty \
+ -e empty \
+ -s exit:0 \
+ -x sh -c 'trap "" CHLD; exec timeout 10 true'
+}
+
+atf_test_case with_a_child
+with_a_child_head()
+{
+ atf_set "descr" "When starting with a child (coreutils bug#9098)"
+}
+
+with_a_child_body()
+{
+ out=$(sleep .1 & exec timeout .5 sh -c 'sleep 2; echo foo')
+ status=$?
+ test "$out" = "" && test $status = 124 || atf_fail
+
+}
+
+atf_test_case invalid_timeout
+invalid_timeout_head()
+{
+ atf_set "descr" "Invalid timeout"
+}
+
+invalid_timeout_body()
+{
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid duration\n" \
+ -s exit:125 \
+ -x timeout invalid sleep 0
+
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid duration\n" \
+ -s exit:125 \
+ -x timeout --kill-after=invalid 1 sleep 0
+
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid duration\n" \
+ -s exit:125 \
+ -x timeout 42D sleep 0
+
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid duration\n" \
+ -s exit:125 \
+ -x timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0
+
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid duration\n" \
+ -s exit:125 \
+ -x timeout 2.34e+5d sleep 0
+}
+
+atf_test_case invalid_signal
+invalid_signal_head()
+{
+ atf_set "descr" "Invalid signal"
+}
+
+invalid_signal_body()
+{
+ atf_check \
+ -o empty \
+ -e inline:"timeout: invalid signal\n" \
+ -s exit:125 \
+ -x timeout --signal=invalid 1 sleep 0
+}
+
+atf_test_case invalid_command
+invalid_command_head()
+{
+ atf_set "descr" "Invalid command"
+}
+
+invalid_command_body()
+{
+ atf_check \
+ -o empty \
+ -e inline:"timeout: exec(.): Permission denied\n" \
+ -s exit:126 \
+ -x timeout 10 .
+}
+
+atf_test_case no_such_command
+no_such_command_head()
+{
+ atf_set "descr" "No such command"
+}
+
+no_such_command_body()
+{
+ atf_check \
+ -o empty \
+ -e inline:"timeout: exec(enoexists): No such file or directory\n" \
+ -s exit:127 \
+ -x timeout 10 enoexists
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case nominal
+ atf_add_test_case time_unit
+ atf_add_test_case no_timeout
+ atf_add_test_case exit_numbers
+ atf_add_test_case with_a_child
+ atf_add_test_case invalid_timeout
+ atf_add_test_case invalid_signal
+ atf_add_test_case invalid_command
+ atf_add_test_case no_such_command
+}
diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1
new file mode 100644
index 0000000..70a9106
--- /dev/null
+++ b/usr.bin/timeout/timeout.1
@@ -0,0 +1,129 @@
+.\" 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 Oct 28, 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.
+.Pp
+If
+.Ar command
+is an invalid command, the exit status returned is 126.
+.Pp
+If
+.Ar command
+is a non existing command, the exit status returned is 127.
+.Pp
+If an invalid parameter is passed to
+.Fl s
+or
+.Fl k ,
+the exit status return is 125.
+.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..d682541
--- /dev/null
+++ b/usr.bin/timeout/timeout.c
@@ -0,0 +1,362 @@
+/*-
+ * 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/procctl.h>
+#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(125, "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(125, "invalid duration");
+ }
+
+ if (ret < 0 || ret >= 100000000UL)
+ errx(125, "invalid duration");
+
+ return (ret);
+}
+
+static int
+parse_signal(const char *str)
+{
+ int sig, i;
+ const char *errstr;
+
+ sig = strtonum(str, 1, sys_nsig - 1, &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(125, "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 pid, cpid;
+ double first_kill;
+ double second_kill;
+ bool timedout = false;
+ bool do_second_kill = false;
+ bool child_done = false;
+ struct sigaction signals;
+ struct procctl_reaper_status info;
+ struct procctl_reaper_kill killemall;
+ int signums[] = {
+ -1,
+ SIGTERM,
+ SIGINT,
+ SIGHUP,
+ SIGCHLD,
+ SIGALRM,
+ SIGQUIT,
+ };
+
+ foreground = preserve = 0;
+ second_kill = 0;
+
+ 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) {
+ /* Acquire a reaper */
+ if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
+ err(EX_OSERR, "Fail to acquire the reaper");
+ }
+
+ 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) {
+ if (errno == ENOENT)
+ err(127, "exec(%s)", argv[0]);
+ else
+ err(126, "exec(%s)", argv[0]);
+ }
+ }
+
+ 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 = waitpid(-1, &status, WNOHANG)) != 0) {
+ if (cpid < 0) {
+ if (errno == EINTR)
+ continue;
+ else
+ break;
+ } else if (cpid == pid) {
+ pstat = status;
+ child_done = true;
+ }
+ }
+ if (child_done) {
+ if (foreground) {
+ break;
+ } else {
+ procctl(P_PID, getpid(),
+ PROC_REAP_STATUS, &info);
+ if (info.rs_children == 0)
+ break;
+ }
+ }
+ } else if (sig_alrm) {
+ sig_alrm = 0;
+
+ timedout = true;
+ if (!foreground) {
+ killemall.rk_sig = killsig;
+ killemall.rk_flags = 0;
+ procctl(P_PID, getpid(), PROC_REAP_KILL,
+ &killemall);
+ } 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) {
+ killemall.rk_sig = sig_term;
+ killemall.rk_flags = 0;
+ procctl(P_PID, getpid(), PROC_REAP_KILL,
+ &killemall);
+ } else
+ kill(pid, sig_term);
+
+ if (do_second_kill) {
+ set_interval(second_kill);
+ second_kill = 0;
+ sig_ign = killsig;
+ killsig = SIGKILL;
+ } else
+ break;
+ }
+ }
+
+ while (!child_done && wait(&pstat) == -1) {
+ if (errno != EINTR)
+ err(EX_OSERR, "waitpid()");
+ }
+
+ if (!foreground)
+ procctl(P_PID, getpid(), PROC_REAP_RELEASE, NULL);
+
+ 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/tip/Makefile b/usr.bin/tip/Makefile
new file mode 100644
index 0000000..532431d
--- /dev/null
+++ b/usr.bin/tip/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR=tip
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/tip/Makefile.inc b/usr.bin/tip/Makefile.inc
new file mode 100644
index 0000000..265f86d
--- /dev/null
+++ b/usr.bin/tip/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
diff --git a/usr.bin/tip/README b/usr.bin/tip/README
new file mode 100644
index 0000000..fb9af15
--- /dev/null
+++ b/usr.bin/tip/README
@@ -0,0 +1,63 @@
+# $FreeBSD$
+
+Tip can be configured in a number of ways:
+
+ACU's:
+-----
+
+ACU Define in makefile
+-------------------- ---------------
+BIZCOMP 1022, 1031 BIZ1022, BIZ1031
+DEC DF02-AC, DF03-AC DF02, DF03
+DEC DN-11/Able Quadracall DN11
+Ventel VENTEL
+Vadic 831 V831
+
+New ACU's may be added by editing the ACU description table
+in acutab.c and writing a ``driver''.
+
+ACU usage can be monitored by defining ACULOG in the makefile.
+If this is done and no phone numbers should appear in the
+log file, define PRISTINE in the makefile.
+
+Variables:
+---------
+
+Tip's internal workings revolve around a set of (possibly)
+user defined variables. These are statically initialized
+in vars.c, and from the remote file.
+
+Note that adding or deleting variables requires tip to be completedly
+recompiled, as indexes into the variable table are used to avoid
+expensive lookups. These defines are set in tip.h.
+
+Commands:
+--------
+
+The command dispatch table is defined in cmdtab.c. Commands
+may have attributes such as EXPerimental and PRIVileged (only
+root may execute).
+
+
+
+--------------------------------------------------------------------------
+
+Recent changes about Jan 82
+
+A new, improved version of tip is now available. The most important
+addition is the capacility to specify a phone number with tip. The
+default baud rate is 1200. To use it do:
+
+ tip phone-number
+or
+ tip -300 phone-number
+
+for 300 baud.
+
+A ~^Z command has been added to tip as well.
+
+A new cu program is available that interfaces to the tip program.
+It attempts to give the same user interface as cu but it is really
+the tip program so you have all the advantages of tip. This allows
+cu (actually tip) to search for a free ACU instead of having the
+user specify which one he wants.
diff --git a/usr.bin/tip/TODO b/usr.bin/tip/TODO
new file mode 100644
index 0000000..6aace38
--- /dev/null
+++ b/usr.bin/tip/TODO
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+1. Rethink protection glitches on REMOTE & PHONES
+ files (setuid/setgid??).
+
+2. Make clean fix for scripting being set in .tiprc
+
+3. change EOFREAD to recognize more general strings.
+
+4. add an option that returns an exit status based on
+ whether resources for the requested operation are available.
+
+5. write a program to list known systems (a quick shell script
+ should do it); people keep forgetting the names.
+
+6. change remote file descriptions so that acu attributes are
+ are attached to a device so that several different devices
+ can be used to get to the same system (perhaps hardwired
+ and phone line). got any ideas here? I'm looking at something
+ like dv=cua1,cul1,dn11;cua2,,df03.
diff --git a/usr.bin/tip/libacu/biz22.c b/usr.bin/tip/libacu/biz22.c
new file mode 100644
index 0000000..99b6fb0
--- /dev/null
+++ b/usr.bin/tip/libacu/biz22.c
@@ -0,0 +1,187 @@
+/* $OpenBSD: biz22.c,v 1.13 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: biz22.c,v 1.6 1997/02/11 09:24:11 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: biz22.c,v 1.13 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+#define DISCONNECT_CMD "\20\04" /* disconnection string */
+
+static int dialtimeout = 0;
+static jmp_buf timeoutbuf;
+
+static int biz_dialer(char *, char *);
+static void sigALRM(int);
+static int cmd(char *);
+static int detect(char *);
+
+/*
+ * Dial up on a BIZCOMP Model 1022 with either
+ * tone dialing (mod = "V")
+ * pulse dialing (mod = "W")
+ */
+static int
+biz_dialer(char *num, char *mod)
+{
+ int connected = 0;
+ char cbuf[40];
+
+ if (boolean(value(VERBOSE)))
+ printf("\nstarting call...");
+ /*
+ * Disable auto-answer and configure for tone/pulse
+ * dialing
+ */
+ if (cmd("\02K\r")) {
+ printf("can't initialize bizcomp...");
+ return (0);
+ }
+ (void)strlcpy(cbuf, "\02.\r", sizeof cbuf);
+ cbuf[1] = *mod;
+ if (cmd(cbuf)) {
+ printf("can't set dialing mode...");
+ return (0);
+ }
+ (void)snprintf(cbuf, sizeof(cbuf), "\02D%s\r", num);
+ write(FD, cbuf, strlen(cbuf));
+ if (!detect("7\r")) {
+ printf("can't get dial tone...");
+ return (0);
+ }
+ if (boolean(value(VERBOSE)))
+ printf("ringing...");
+ /*
+ * The reply from the BIZCOMP should be:
+ * 2 \r or 7 \r failure
+ * 1 \r success
+ */
+ connected = detect("1\r");
+#ifdef ACULOG
+ if (dialtimeout) {
+ char line[80];
+
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "biz1022", line);
+ }
+#endif
+ if (dialtimeout)
+ biz22_disconnect(); /* insurance */
+ return (connected);
+}
+
+int
+biz22w_dialer(char *num, char *acu)
+{
+ return (biz_dialer(num, "W"));
+}
+
+int
+biz22f_dialer(char *num, char *acu)
+{
+ return (biz_dialer(num, "V"));
+}
+
+void
+biz22_disconnect(void)
+{
+ write(FD, DISCONNECT_CMD, sizeof(DISCONNECT_CMD)-1);
+ sleep(2);
+ tcflush(FD, TCIOFLUSH);
+}
+
+void
+biz22_abort(void)
+{
+ write(FD, "\02", 1);
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ dialtimeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static int
+cmd(char *s)
+{
+ sig_t f;
+ char c;
+
+ write(FD, s, strlen(s));
+ f = signal(SIGALRM, sigALRM);
+ if (setjmp(timeoutbuf)) {
+ biz22_abort();
+ signal(SIGALRM, f);
+ return (1);
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ signal(SIGALRM, f);
+ c &= 0177;
+ return (c != '\r');
+}
+
+static int
+detect(char *s)
+{
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ dialtimeout = 0;
+ while (*s) {
+ if (setjmp(timeoutbuf)) {
+ biz22_abort();
+ break;
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ c &= 0177;
+ if (c != *s++)
+ return (0);
+ }
+ signal(SIGALRM, f);
+ return (dialtimeout == 0);
+}
diff --git a/usr.bin/tip/libacu/biz31.c b/usr.bin/tip/libacu/biz31.c
new file mode 100644
index 0000000..5bc00ae
--- /dev/null
+++ b/usr.bin/tip/libacu/biz31.c
@@ -0,0 +1,254 @@
+/* $OpenBSD: biz31.c,v 1.10 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: biz31.c,v 1.5 1997/02/11 09:24:14 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$OpenBSD: biz31.c,v 1.10 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+#define MAXRETRY 3 /* sync up retry count */
+#define DISCONNECT_CMD "\21\25\11\24" /* disconnection string */
+
+static int biz_dialer(char *, char *);
+static int bizsync(int);
+static int echo(char *);
+static void sigALRM(int);
+static int detect(char *);
+static int flush(char *);
+static int bizsync(int);
+
+static int timeout = 0;
+static jmp_buf timeoutbuf;
+
+/*
+ * Dial up on a BIZCOMP Model 1031 with either
+ * tone dialing (mod = "f")
+ * pulse dialing (mod = "w")
+ */
+static int
+biz_dialer(char *num, char *mod)
+{
+ int connected = 0;
+
+ if (!bizsync(FD)) {
+ logent(value(HOST), "", "biz", "out of sync");
+ printf("bizcomp out of sync\n");
+ delock(uucplock);
+ exit(0);
+ }
+ if (boolean(value(VERBOSE)))
+ printf("\nstarting call...");
+ echo("#\rk$\r$\n"); /* disable auto-answer */
+ echo("$>$.$ #\r"); /* tone/pulse dialing */
+ echo(mod);
+ echo("$\r$\n");
+ echo("$>$.$ #\re$ "); /* disconnection sequence */
+ echo(DISCONNECT_CMD);
+ echo("\r$\n$\r$\n");
+ echo("$>$.$ #\rr$ "); /* repeat dial */
+ echo(num);
+ echo("\r$\n");
+ if (boolean(value(VERBOSE)))
+ printf("ringing...");
+ /*
+ * The reply from the BIZCOMP should be:
+ * `^G NO CONNECTION\r\n^G\r\n' failure
+ * ` CONNECTION\r\n^G' success
+ */
+ connected = detect(" ");
+#ifdef ACULOG
+ if (timeout) {
+ char line[80];
+
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "biz", line);
+ }
+#endif
+ if (!connected)
+ flush(" NO CONNECTION\r\n\07\r\n");
+ else
+ flush("CONNECTION\r\n\07");
+ if (timeout)
+ biz31_disconnect(); /* insurance */
+ return (connected);
+}
+
+int
+biz31w_dialer(char *num, char *acu)
+{
+ return (biz_dialer(num, "w"));
+}
+
+int
+biz31f_dialer(char *num, char *acu)
+{
+ return (biz_dialer(num, "f"));
+}
+
+void
+biz31_disconnect(void)
+{
+ write(FD, DISCONNECT_CMD, sizeof(DISCONNECT_CMD)-1);
+ sleep(2);
+ tcflush(FD, TCIOFLUSH);
+}
+
+void
+biz31_abort(void)
+{
+ write(FD, "\33", 1);
+}
+
+static int
+echo(char *s)
+{
+ char c;
+
+ while (c = *s++) switch (c) {
+
+ case '$':
+ read(FD, &c, 1);
+ s++;
+ break;
+
+ case '#':
+ c = *s++;
+ write(FD, &c, 1);
+ break;
+
+ default:
+ write(FD, &c, 1);
+ read(FD, &c, 1);
+ }
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ timeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static int
+detect(char *s)
+{
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ timeout = 0;
+ while (*s) {
+ if (setjmp(timeoutbuf)) {
+ printf("\07timeout waiting for reply\n");
+ biz31_abort();
+ break;
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ if (c != *s++)
+ break;
+ }
+ signal(SIGALRM, f);
+ return (timeout == 0);
+}
+
+static int
+flush(char *s)
+{
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ while (*s++) {
+ if (setjmp(timeoutbuf))
+ break;
+ alarm(10);
+ read(FD, &c, 1);
+ alarm(0);
+ }
+ signal(SIGALRM, f);
+ timeout = 0; /* guard against disconnection */
+}
+
+/*
+ * This convoluted piece of code attempts to get
+ * the bizcomp in sync. If you don't have the capacity or nread
+ * call there are gory ways to simulate this.
+ */
+static int
+bizsync(int fd)
+{
+#ifdef FIOCAPACITY
+ struct capacity b;
+# define chars(b) ((b).cp_nbytes)
+# define IOCTL FIOCAPACITY
+#endif
+#ifdef FIONREAD
+ long b;
+# define chars(b) (b)
+# define IOCTL FIONREAD
+#endif
+ int already = 0;
+ char buf[10];
+
+retry:
+ if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0 && chars(b) > 0)
+ tcflush(FD, TCIOFLUSH);
+ write(fd, "\rp>\r", 4);
+ sleep(1);
+ if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0) {
+ if (chars(b) != 10) {
+ nono:
+ if (already > MAXRETRY)
+ return (0);
+ write(fd, DISCONNECT_CMD, 4);
+ sleep(2);
+ already++;
+ goto retry;
+ } else {
+ read(fd, buf, 10);
+ if (strncmp(buf, "p >\r\n\r\n>", 8))
+ goto nono;
+ }
+ }
+ return (1);
+}
diff --git a/usr.bin/tip/libacu/courier.c b/usr.bin/tip/libacu/courier.c
new file mode 100644
index 0000000..b23c28c
--- /dev/null
+++ b/usr.bin/tip/libacu/courier.c
@@ -0,0 +1,354 @@
+/* $OpenBSD: courier.c,v 1.15 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: courier.c,v 1.7 1997/02/11 09:24:16 mrg Exp $ */
+
+/*
+ * Copyright (c) 1986, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: courier.c,v 1.15 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for calling up on a Courier modem.
+ * Derived from Hayes driver.
+ */
+#include "tip.h"
+#include <sys/ioctl.h>
+#include <stdio.h>
+
+#define MAXRETRY 5
+
+static int dialtimeout = 0;
+static int connected = 0;
+static jmp_buf timeoutbuf;
+
+static void sigALRM(int);
+static int cour_swallow(char *);
+static int cour_connect(void);
+static int coursync(void);
+static void cour_write(int, char *, int);
+static void cour_nap(void);
+#ifdef DEBUG
+static void cour_verbose_read(void);
+#endif
+
+int
+cour_dialer(char *num, char *acu)
+{
+ char *cp;
+#ifdef ACULOG
+ char line[80];
+#endif
+ struct termios cntrl;
+
+ if (boolean(value(VERBOSE)))
+ printf("Using \"%s\"\n", acu);
+
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ /*
+ * Get in synch.
+ */
+ if (!coursync()) {
+badsynch:
+ printf("can't synchronize with courier\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "courier", "can't synch up");
+#endif
+ return (0);
+ }
+ cour_write(FD, "AT E0\r", 6); /* turn off echoing */
+ sleep(1);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ cour_verbose_read();
+#endif
+ tcflush(FD, TCIOFLUSH);
+ cour_write(FD, "AT C1 E0 H0 Q0 X6 V1\r", 21);
+ if (!cour_swallow("\r\nOK\r\n"))
+ goto badsynch;
+ fflush(stdout);
+ cour_write(FD, "AT D", 4);
+ for (cp = num; *cp; cp++)
+ if (*cp == '=')
+ *cp = ',';
+ cour_write(FD, num, strlen(num));
+ cour_write(FD, "\r", 1);
+ connected = cour_connect();
+#ifdef ACULOG
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "cour", line);
+ }
+#endif
+ if (dialtimeout)
+ cour_disconnect();
+ return (connected);
+}
+
+void
+cour_disconnect(void)
+{
+ /* first hang up the modem*/
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ coursync(); /* reset */
+ close(FD);
+}
+
+void
+cour_abort(void)
+{
+ cour_write(FD, "\r", 1); /* send anything to abort the call */
+ cour_disconnect();
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ printf("\07timeout waiting for reply\n");
+ dialtimeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static int
+cour_swallow(char *match)
+{
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ dialtimeout = 0;
+ do {
+ if (*match =='\0') {
+ signal(SIGALRM, f);
+ return (1);
+ }
+ if (setjmp(timeoutbuf)) {
+ signal(SIGALRM, f);
+ return (0);
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ c &= 0177;
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ putchar(c);
+#endif
+ } while (c == *match++);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ fflush(stdout);
+#endif
+ signal(SIGALRM, SIG_DFL);
+ return (0);
+}
+
+struct baud_msg {
+ char *msg;
+ int baud;
+} baud_msg[] = {
+ { "", B300 },
+ { " 1200", B1200 },
+ { " 2400", B2400 },
+ { " 9600", B9600 },
+ { " 9600/ARQ", B9600 },
+ { 0, 0 },
+};
+
+static int
+cour_connect(void)
+{
+ char c;
+ int nc, nl, n;
+ char dialer_buf[64];
+ struct baud_msg *bm;
+ sig_t f;
+
+ if (cour_swallow("\r\n") == 0)
+ return (0);
+ f = signal(SIGALRM, sigALRM);
+again:
+ nc = 0; nl = sizeof(dialer_buf)-1;
+ bzero(dialer_buf, sizeof(dialer_buf));
+ dialtimeout = 0;
+ for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
+ if (setjmp(timeoutbuf))
+ break;
+ alarm(number(value(DIALTIMEOUT)));
+ n = read(FD, &c, 1);
+ alarm(0);
+ if (n <= 0)
+ break;
+ c &= 0x7f;
+ if (c == '\r') {
+ if (cour_swallow("\n") == 0)
+ break;
+ if (!dialer_buf[0])
+ goto again;
+ if (strcmp(dialer_buf, "RINGING") == 0 &&
+ boolean(value(VERBOSE))) {
+#ifdef DEBUG
+ printf("%s\r\n", dialer_buf);
+#endif
+ goto again;
+ }
+ if (strncmp(dialer_buf, "CONNECT",
+ sizeof("CONNECT")-1) != 0)
+ break;
+ for (bm = baud_msg ; bm->msg ; bm++)
+ if (strcmp(bm->msg,
+ dialer_buf+sizeof("CONNECT")-1) == 0) {
+ struct termios cntrl;
+
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, bm->baud);
+ cfsetispeed(&cntrl, bm->baud);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ signal(SIGALRM, f);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ printf("%s\r\n", dialer_buf);
+#endif
+ return (1);
+ }
+ break;
+ }
+ dialer_buf[nc] = c;
+#ifdef notdef
+ if (boolean(value(VERBOSE)))
+ putchar(c);
+#endif
+ }
+ printf("%s\r\n", dialer_buf);
+ signal(SIGALRM, f);
+ return (0);
+}
+
+/*
+ * This convoluted piece of code attempts to get
+ * the courier in sync.
+ */
+static int
+coursync(void)
+{
+ int already = 0;
+ int len;
+ char buf[40];
+
+ while (already++ < MAXRETRY) {
+ tcflush(FD, TCIOFLUSH);
+ cour_write(FD, "\rAT Z\r", 6); /* reset modem */
+ bzero(buf, sizeof(buf));
+ sleep(1);
+ ioctl(FD, FIONREAD, &len);
+ if (len) {
+ len = read(FD, buf, sizeof(buf));
+#ifdef DEBUG
+ buf[len] = '\0';
+ printf("coursync: (\"%s\")\n\r", buf);
+#endif
+ if (strchr(buf, '0') ||
+ (strchr(buf, 'O') && strchr(buf, 'K')))
+ return(1);
+ }
+ /*
+ * If not strapped for DTR control,
+ * try to get command mode.
+ */
+ sleep(1);
+ cour_write(FD, "+++", 3);
+ sleep(1);
+ /*
+ * Toggle DTR to force anyone off that might have left
+ * the modem connected.
+ */
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ }
+ cour_write(FD, "\rAT Z\r", 6);
+ return (0);
+}
+
+static void
+cour_write(int fd, char *cp, int n)
+{
+#ifdef notdef
+ if (boolean(value(VERBOSE)))
+ write(1, cp, n);
+#endif
+ tcdrain(fd);
+ cour_nap();
+ for ( ; n-- ; cp++) {
+ write(fd, cp, 1);
+ tcdrain(fd);
+ cour_nap();
+ }
+}
+
+#ifdef DEBUG
+static void
+cour_verbose_read(void)
+{
+ int n = 0;
+ char buf[BUFSIZ];
+
+ if (ioctl(FD, FIONREAD, &n) < 0)
+ return;
+ if (n <= 0)
+ return;
+ if (read(FD, buf, n) != n)
+ return;
+ write(1, buf, n);
+}
+#endif
+
+/* Give the courier 50 milliseconds between characters */
+static void
+cour_nap(void)
+{
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 50 * 1000000;
+
+ nanosleep(&ts, NULL);
+}
diff --git a/usr.bin/tip/libacu/df.c b/usr.bin/tip/libacu/df.c
new file mode 100644
index 0000000..03374e1
--- /dev/null
+++ b/usr.bin/tip/libacu/df.c
@@ -0,0 +1,137 @@
+/* $OpenBSD: df.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: df.c,v 1.4 1995/10/29 00:49:51 pk Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: df.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Dial the DF02-AC or DF03-AC
+ */
+
+#include "tip.h"
+
+static jmp_buf Sjbuf;
+
+static int df_dialer(char *, char *, int);
+static void alrm_timeout(int);
+
+int
+df02_dialer(char *num, char *acu)
+{
+ return (df_dialer(num, acu, 0));
+}
+
+int
+df03_dialer(char *num, char *acu)
+{
+ return (df_dialer(num, acu, 1));
+}
+
+static int
+df_dialer(char *num, char *acu, int df03)
+{
+ int f = FD;
+ struct termios cntrl;
+ int speed = 0;
+ char c = '\0';
+
+ tcgetattr(f, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(f, TCSANOW, &cntrl);
+ if (setjmp(Sjbuf)) {
+ printf("connection timed out\r\n");
+ df_disconnect();
+ return (0);
+ }
+ if (boolean(value(VERBOSE)))
+ printf("\ndialing...");
+ fflush(stdout);
+#ifdef TIOCMSET
+ if (df03) {
+ int st = TIOCM_ST; /* secondary Transmit flag */
+
+ tcgetattr(f, &cntrl);
+ speed = cfgetospeed(&cntrl);
+ if (speed != B1200) { /* must dial at 1200 baud */
+ cfsetospeed(&cntrl, B1200);
+ cfsetispeed(&cntrl, B1200);
+ tcsetattr(f, TCSAFLUSH, &cntrl);
+ ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
+ } else
+ ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
+ }
+#endif
+ signal(SIGALRM, alrm_timeout);
+ alarm(5 * strlen(num) + 10);
+ tcflush(f, TCIOFLUSH);
+ write(f, "\001", 1);
+ sleep(1);
+ write(f, "\002", 1);
+ write(f, num, strlen(num));
+ read(f, &c, 1);
+#ifdef TIOCMSET
+ if (df03 && speed != B1200) {
+ cfsetospeed(&cntrl, speed);
+ cfsetispeed(&cntrl, speed);
+ tcsetattr(f, TCSAFLUSH, &cntrl);
+ }
+#endif
+ return (c == 'A');
+}
+
+void
+df_disconnect(void)
+{
+ write(FD, "\001", 1);
+ sleep(1);
+ tcflush(FD, TCIOFLUSH);
+}
+
+void
+df_abort(void)
+{
+ df_disconnect();
+}
+
+/*ARGSUSED*/
+static void
+alrm_timeout(int signo)
+{
+ longjmp(Sjbuf, 1);
+}
diff --git a/usr.bin/tip/libacu/dn11.c b/usr.bin/tip/libacu/dn11.c
new file mode 100644
index 0000000..a0b18ba
--- /dev/null
+++ b/usr.bin/tip/libacu/dn11.c
@@ -0,0 +1,149 @@
+/* $OpenBSD: dn11.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: dn11.c,v 1.4 1995/10/29 00:49:53 pk Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: dn11.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for dialing up on DN-11
+ */
+#include "tip.h"
+
+static jmp_buf jmpbuf;
+static pid_t child = -1, dn;
+
+static void alarmtr(int);
+
+int
+dn_dialer(char *num, char *acu)
+{
+ int lt, nw;
+ int timelim;
+ struct termios cntrl;
+
+ if (boolean(value(VERBOSE)))
+ printf("\nstarting call...");
+ if ((dn = open(acu, 1)) < 0) {
+ if (errno == EBUSY)
+ printf("line busy...");
+ else
+ printf("acu open error...");
+ return (0);
+ }
+ if (setjmp(jmpbuf)) {
+ kill(child, SIGKILL);
+ close(dn);
+ return (0);
+ }
+ signal(SIGALRM, alarmtr);
+ timelim = 5 * strlen(num);
+ alarm(timelim < 30 ? 30 : timelim);
+ if ((child = fork()) == 0) {
+ /*
+ * ignore this stuff for aborts
+ */
+ signal(SIGALRM, SIG_IGN);
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ sleep(2);
+ nw = write(dn, num, lt = strlen(num));
+ exit(nw != lt);
+ }
+ /*
+ * open line - will return on carrier
+ */
+ if ((FD = open(DV, 2)) < 0) {
+ if (errno == EIO)
+ printf("lost carrier...");
+ else
+ printf("dialup line open failed...");
+ alarm(0);
+ kill(child, SIGKILL);
+ close(dn);
+ return (0);
+ }
+ alarm(0);
+ tcgetattr(dn, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(dn, TCSANOW, &cntrl);
+ signal(SIGALRM, SIG_DFL);
+ while ((nw = wait(&lt)) != child && nw != -1)
+ ;
+ fflush(stdout);
+ close(dn);
+ if (lt != 0) {
+ close(FD);
+ return (0);
+ }
+ return (1);
+}
+
+/*ARGSUSED*/
+static void
+alarmtr(int signo)
+{
+ alarm(0);
+ longjmp(jmpbuf, 1);
+}
+
+/*
+ * Insurance, for some reason we don't seem to be
+ * hanging up...
+ */
+void
+dn_disconnect(void)
+{
+ sleep(2);
+ if (FD > 0)
+ ioctl(FD, TIOCCDTR, 0);
+ close(FD);
+}
+
+void
+dn_abort(void)
+{
+ sleep(2);
+ if (child > 0)
+ kill(child, SIGKILL);
+ if (dn > 0)
+ close(dn);
+ if (FD > 0)
+ ioctl(FD, TIOCCDTR, 0);
+ close(FD);
+}
diff --git a/usr.bin/tip/libacu/hayes.c b/usr.bin/tip/libacu/hayes.c
new file mode 100644
index 0000000..fe52274
--- /dev/null
+++ b/usr.bin/tip/libacu/hayes.c
@@ -0,0 +1,320 @@
+/* $OpenBSD: hayes.c,v 1.13 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: hayes.c,v 1.6 1997/02/11 09:24:17 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: hayes.c,v 1.13 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for calling up on a Hayes Modem
+ * (based on the old VenTel driver).
+ * The modem is expected to be strapped for "echo".
+ * Also, the switches enabling the DTR and CD lines
+ * must be set correctly.
+ * NOTICE:
+ * The easy way to hang up a modem is always simply to
+ * clear the DTR signal. However, if the +++ sequence
+ * (which switches the modem back to local mode) is sent
+ * before modem is hung up, removal of the DTR signal
+ * has no effect (except that it prevents the modem from
+ * recognizing commands).
+ * (by Helge Skrivervik, Calma Company, Sunnyvale, CA. 1984)
+ */
+/*
+ * TODO:
+ * It is probably not a good idea to switch the modem
+ * state between 'verbose' and terse (status messages).
+ * This should be kicked out and we should use verbose
+ * mode only. This would make it consistent with normal
+ * interactive use thru the command 'tip dialer'.
+ */
+#include "tip.h"
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+#define min(a,b) ((a < b) ? a : b)
+
+static int dialtimeout = 0;
+static jmp_buf timeoutbuf;
+
+#define DUMBUFLEN 40
+static char dumbuf[DUMBUFLEN];
+
+#define DIALING 1
+#define IDLE 2
+#define CONNECTED 3
+#define FAILED 4
+static int state = IDLE;
+
+static void sigALRM(int);
+static char gobble(char *);
+static void error_rep(char);
+static void goodbye(void);
+static int hay_sync(void);
+
+int
+hay_dialer(char *num, char *acu)
+{
+ char *cp;
+ int connected = 0;
+ char dummy;
+ struct termios cntrl;
+#ifdef ACULOG
+ char line[80];
+#endif
+ if (hay_sync() == 0) /* make sure we can talk to the modem */
+ return(0);
+ if (boolean(value(VERBOSE)))
+ printf("\ndialing...");
+ fflush(stdout);
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
+ tcflush(FD, TCIOFLUSH);
+ write(FD, "ATv0\r", 5); /* tell modem to use short status codes */
+ gobble("\r");
+ gobble("\r");
+ write(FD, "ATTD", 4); /* send dial command */
+ for (cp = num; *cp; cp++)
+ if (*cp == '=')
+ *cp = ',';
+ write(FD, num, strlen(num));
+ state = DIALING;
+ write(FD, "\r", 1);
+ connected = 0;
+ if (gobble("\r")) {
+ if ((dummy = gobble("01234")) != '1')
+ error_rep(dummy);
+ else
+ connected = 1;
+ }
+ if (connected)
+ state = CONNECTED;
+ else {
+ state = FAILED;
+ return (connected); /* lets get out of here.. */
+ }
+ tcflush(FD, TCIOFLUSH);
+#ifdef ACULOG
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "hayes", line);
+ }
+#endif
+ if (dialtimeout)
+ hay_disconnect(); /* insurance */
+ return (connected);
+}
+
+void
+hay_disconnect(void)
+{
+ /* first hang up the modem*/
+#ifdef DEBUG
+ printf("\rdisconnecting modem....\n\r");
+#endif
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ goodbye();
+}
+
+void
+hay_abort(void)
+{
+ write(FD, "\r", 1); /* send anything to abort the call */
+ hay_disconnect();
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ printf("\07timeout waiting for reply\n\r");
+ dialtimeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static char
+gobble(char *match)
+{
+ char c;
+ sig_t f;
+ size_t i;
+ int status = 0;
+
+ f = signal(SIGALRM, sigALRM);
+ dialtimeout = 0;
+#ifdef DEBUG
+ printf("\ngobble: waiting for %s\n", match);
+#endif
+ do {
+ if (setjmp(timeoutbuf)) {
+ signal(SIGALRM, f);
+ return (0);
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ c &= 0177;
+#ifdef DEBUG
+ printf("%c 0x%x ", c, c);
+#endif
+ for (i = 0; i < strlen(match); i++)
+ if (c == match[i])
+ status = c;
+ } while (status == 0);
+ signal(SIGALRM, SIG_DFL);
+#ifdef DEBUG
+ printf("\n");
+#endif
+ return (status);
+}
+
+static void
+error_rep(char c)
+{
+ printf("\n\r");
+ switch (c) {
+
+ case '0':
+ printf("OK");
+ break;
+
+ case '1':
+ printf("CONNECT");
+ break;
+
+ case '2':
+ printf("RING");
+ break;
+
+ case '3':
+ printf("NO CARRIER");
+ break;
+
+ case '4':
+ printf("ERROR in input");
+ break;
+
+ case '5':
+ printf("CONNECT 1200");
+ break;
+
+ default:
+ printf("Unknown Modem error: %c (0x%x)", c, c);
+ }
+ printf("\n\r");
+ return;
+}
+
+/*
+ * set modem back to normal verbose status codes.
+ */
+static void
+goodbye(void)
+{
+ int len;
+ char c;
+
+ tcflush(FD, TCIOFLUSH);
+ if (hay_sync()) {
+ sleep(1);
+#ifndef DEBUG
+ tcflush(FD, TCIOFLUSH);
+#endif
+ write(FD, "ATH0\r", 5); /* insurance */
+#ifndef DEBUG
+ c = gobble("03");
+ if (c != '0' && c != '3') {
+ printf("cannot hang up modem\n\r");
+ printf("please use 'tip dialer' to make sure the line is hung up\n\r");
+ }
+#endif
+ sleep(1);
+ ioctl(FD, FIONREAD, &len);
+#ifdef DEBUG
+ printf("goodbye1: len=%d -- ", len);
+ rlen = read(FD, dumbuf, min(len, DUMBUFLEN));
+ dumbuf[rlen] = '\0';
+ printf("read (%d): %s\r\n", rlen, dumbuf);
+#endif
+ write(FD, "ATv1\r", 5);
+ sleep(1);
+#ifdef DEBUG
+ ioctl(FD, FIONREAD, &len);
+ printf("goodbye2: len=%d -- ", len);
+ rlen = read(FD, dumbuf, min(len, DUMBUFLEN));
+ dumbuf[rlen] = '\0';
+ printf("read (%d): %s\r\n", rlen, dumbuf);
+#endif
+ }
+ tcflush(FD, TCIOFLUSH);
+ ioctl(FD, TIOCCDTR, 0); /* clear DTR (insurance) */
+ close(FD);
+}
+
+#define MAXRETRY 5
+
+static int
+hay_sync(void)
+{
+ int len, retry = 0;
+
+ while (retry++ <= MAXRETRY) {
+ write(FD, "AT\r", 3);
+ sleep(1);
+ ioctl(FD, FIONREAD, &len);
+ if (len) {
+ len = read(FD, dumbuf, min(len, DUMBUFLEN));
+ if (strchr(dumbuf, '0') ||
+ (strchr(dumbuf, 'O') && strchr(dumbuf, 'K')))
+ return(1);
+#ifdef DEBUG
+ dumbuf[len] = '\0';
+ printf("hay_sync: (\"%s\") %d\n\r", dumbuf, retry);
+#endif
+ }
+ ioctl(FD, TIOCCDTR, 0);
+ ioctl(FD, TIOCSDTR, 0);
+ }
+ printf("Cannot synchronize with hayes...\n\r");
+ return(0);
+}
diff --git a/usr.bin/tip/libacu/t3000.c b/usr.bin/tip/libacu/t3000.c
new file mode 100644
index 0000000..a640ff3
--- /dev/null
+++ b/usr.bin/tip/libacu/t3000.c
@@ -0,0 +1,372 @@
+/* $OpenBSD: t3000.c,v 1.14 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: t3000.c,v 1.5 1997/02/11 09:24:18 mrg Exp $ */
+
+/*
+ * Copyright (c) 1992, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: t3000.c,v 1.14 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for calling up on a Telebit T3000 modem.
+ * Derived from Courier driver.
+ */
+#include "tip.h"
+
+#include <sys/ioctl.h>
+#include <stdio.h>
+
+#define MAXRETRY 5
+
+static int dialtimeout = 0;
+static int connected = 0;
+static jmp_buf timeoutbuf;
+
+static void sigALRM(int);
+static int t3000_swallow(char *);
+static int t3000_connect(void);
+static int t3000_sync(void);
+static void t3000_write(int, char *, int);
+static void t3000_nap(void);
+#ifdef DEBUG
+static void t3000_verbose_read(void);
+#endif
+
+int
+t3000_dialer(char *num, char *acu)
+{
+ char *cp;
+ struct termios cntrl;
+#ifdef ACULOG
+ char line[80];
+#endif
+
+ if (boolean(value(VERBOSE)))
+ printf("Using \"%s\"\n", acu);
+
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
+ /*
+ * Get in synch.
+ */
+ if (!t3000_sync()) {
+badsynch:
+ printf("can't synchronize with t3000\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "t3000", "can't synch up");
+#endif
+ return (0);
+ }
+ t3000_write(FD, "AT E0\r", 6); /* turn off echoing */
+ sleep(1);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ t3000_verbose_read();
+#endif
+ tcflush(FD, TCIOFLUSH);
+ t3000_write(FD, "AT E0 H0 Q0 X4 V1\r", 18);
+ if (!t3000_swallow("\r\nOK\r\n"))
+ goto badsynch;
+ fflush(stdout);
+ t3000_write(FD, "AT D", 4);
+ for (cp = num; *cp; cp++)
+ if (*cp == '=')
+ *cp = ',';
+ t3000_write(FD, num, strlen(num));
+ t3000_write(FD, "\r", 1);
+ connected = t3000_connect();
+#ifdef ACULOG
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "t3000", line);
+ }
+#endif
+ if (dialtimeout)
+ t3000_disconnect();
+ return (connected);
+}
+
+void
+t3000_disconnect(void)
+{
+ /* first hang up the modem*/
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ t3000_sync(); /* reset */
+ close(FD);
+}
+
+void
+t3000_abort(void)
+{
+ t3000_write(FD, "\r", 1); /* send anything to abort the call */
+ t3000_disconnect();
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ printf("\07timeout waiting for reply\n");
+ dialtimeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static int
+t3000_swallow(char *match)
+{
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ dialtimeout = 0;
+ do {
+ if (*match =='\0') {
+ signal(SIGALRM, f);
+ return (1);
+ }
+ if (setjmp(timeoutbuf)) {
+ signal(SIGALRM, f);
+ return (0);
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, &c, 1);
+ alarm(0);
+ c &= 0177;
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ putchar(c);
+#endif
+ } while (c == *match++);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ fflush(stdout);
+#endif
+ signal(SIGALRM, SIG_DFL);
+ return (0);
+}
+
+#ifndef B19200 /* XXX */
+#define B19200 EXTA
+#define B38400 EXTB
+#endif
+
+struct tbaud_msg {
+ char *msg;
+ int baud;
+ int baud2;
+} tbaud_msg[] = {
+ { "", B300, 0 },
+ { " 1200", B1200, 0 },
+ { " 2400", B2400, 0 },
+ { " 4800", B4800, 0 },
+ { " 9600", B9600, 0 },
+ { " 14400", B19200, B9600 },
+ { " 19200", B19200, B9600 },
+ { " 38400", B38400, B9600 },
+ { " 57600", B38400, B9600 },
+ { " 7512", B9600, 0 },
+ { " 1275", B2400, 0 },
+ { " 7200", B9600, 0 },
+ { " 12000", B19200, B9600 },
+ { 0, 0, 0 },
+};
+
+static int
+t3000_connect(void)
+{
+ char c;
+ int nc, nl, n;
+ char dialer_buf[64];
+ struct tbaud_msg *bm;
+ sig_t f;
+
+ if (t3000_swallow("\r\n") == 0)
+ return (0);
+ f = signal(SIGALRM, sigALRM);
+again:
+ nc = 0; nl = sizeof(dialer_buf)-1;
+ bzero(dialer_buf, sizeof(dialer_buf));
+ dialtimeout = 0;
+ for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
+ if (setjmp(timeoutbuf))
+ break;
+ alarm(number(value(DIALTIMEOUT)));
+ n = read(FD, &c, 1);
+ alarm(0);
+ if (n <= 0)
+ break;
+ c &= 0x7f;
+ if (c == '\r') {
+ if (t3000_swallow("\n") == 0)
+ break;
+ if (!dialer_buf[0])
+ goto again;
+ if (strcmp(dialer_buf, "RINGING") == 0 &&
+ boolean(value(VERBOSE))) {
+#ifdef DEBUG
+ printf("%s\r\n", dialer_buf);
+#endif
+ goto again;
+ }
+ if (strncmp(dialer_buf, "CONNECT",
+ sizeof("CONNECT")-1) != 0)
+ break;
+ for (bm = tbaud_msg ; bm->msg ; bm++)
+ if (strcmp(bm->msg,
+ dialer_buf+sizeof("CONNECT")-1) == 0) {
+ struct termios cntrl;
+
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, bm->baud);
+ cfsetispeed(&cntrl, bm->baud);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ signal(SIGALRM, f);
+#ifdef DEBUG
+ if (boolean(value(VERBOSE)))
+ printf("%s\r\n", dialer_buf);
+#endif
+ return (1);
+ }
+ break;
+ }
+ dialer_buf[nc] = c;
+#ifdef notdef
+ if (boolean(value(VERBOSE)))
+ putchar(c);
+#endif
+ }
+ printf("%s\r\n", dialer_buf);
+ signal(SIGALRM, f);
+ return (0);
+}
+
+/*
+ * This convoluted piece of code attempts to get
+ * the t3000 in sync.
+ */
+static int
+t3000_sync(void)
+{
+ int already = 0;
+ int len;
+ char buf[40];
+
+ while (already++ < MAXRETRY) {
+ tcflush(FD, TCIOFLUSH);
+ t3000_write(FD, "\rAT Z\r", 6); /* reset modem */
+ bzero(buf, sizeof(buf));
+ sleep(2);
+ ioctl(FD, FIONREAD, &len);
+#if 1
+if (len == 0) len = 1;
+#endif
+ if (len) {
+ len = read(FD, buf, sizeof(buf));
+#ifdef DEBUG
+ buf[len] = '\0';
+ printf("t3000_sync: (\"%s\")\n\r", buf);
+#endif
+ if (strchr(buf, '0') ||
+ (strchr(buf, 'O') && strchr(buf, 'K')))
+ return(1);
+ }
+ /*
+ * If not strapped for DTR control,
+ * try to get command mode.
+ */
+ sleep(1);
+ t3000_write(FD, "+++", 3);
+ sleep(1);
+ /*
+ * Toggle DTR to force anyone off that might have left
+ * the modem connected.
+ */
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ }
+ t3000_write(FD, "\rAT Z\r", 6);
+ return (0);
+}
+
+static void
+t3000_write(int fd, char *cp, int n)
+{
+#ifdef notdef
+ if (boolean(value(VERBOSE)))
+ write(1, cp, n);
+#endif
+ tcdrain(fd);
+ t3000_nap();
+ for ( ; n-- ; cp++) {
+ write(fd, cp, 1);
+ tcdrain(fd);
+ t3000_nap();
+ }
+}
+
+#ifdef DEBUG
+static void
+t3000_verbose_read(void)
+{
+ int n = 0;
+ char buf[BUFSIZ];
+
+ if (ioctl(FD, FIONREAD, &n) < 0)
+ return;
+ if (n <= 0)
+ return;
+ if (read(FD, buf, n) != n)
+ return;
+ write(1, buf, n);
+}
+#endif
+
+/* Give the t3000 50 milliseconds between characters */
+static void
+t3000_nap(void)
+{
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 50 * 1000000;
+
+ nanosleep(&ts, NULL);
+}
diff --git a/usr.bin/tip/libacu/v3451.c b/usr.bin/tip/libacu/v3451.c
new file mode 100644
index 0000000..0de679e
--- /dev/null
+++ b/usr.bin/tip/libacu/v3451.c
@@ -0,0 +1,212 @@
+/* $OpenBSD: v3451.c,v 1.9 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: v3451.c,v 1.6 1997/02/11 09:24:20 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: v3451.c,v 1.9 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for calling up on a Vadic 3451 Modem
+ */
+#include "tip.h"
+
+static jmp_buf Sjbuf;
+
+static void vawrite(char *, int);
+static int expect(char *);
+static void alarmtr(int);
+static int notin(char *, char *);
+static int prefix(char *, char *);
+
+int
+v3451_dialer(char *num, char *acu)
+{
+ sig_t func;
+ int ok;
+ int slow = number(value(BAUDRATE)) < 1200;
+ char phone[50];
+ struct termios cntrl;
+
+ /*
+ * Get in synch
+ */
+ vawrite("I\r", 1 + slow);
+ vawrite("I\r", 1 + slow);
+ vawrite("I\r", 1 + slow);
+ vawrite("\005\r", 2 + slow);
+ if (!expect("READY")) {
+ printf("can't synchronize with vadic 3451\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "vadic", "can't synch up");
+#endif
+ return (0);
+ }
+ tcgetattr(FD, &cntrl);
+ term.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
+ sleep(1);
+ vawrite("D\r", 2 + slow);
+ if (!expect("NUMBER?")) {
+ printf("Vadic will not accept dial command\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "vadic", "will not accept dial");
+#endif
+ return (0);
+ }
+ (void)snprintf(phone, sizeof phone, "%s\r", num);
+ vawrite(phone, 1 + slow);
+ if (!expect(phone)) {
+ printf("Vadic will not accept phone number\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "vadic", "will not accept number");
+#endif
+ return (0);
+ }
+ func = signal(SIGINT,SIG_IGN);
+ /*
+ * You cannot interrupt the Vadic when its dialing;
+ * even dropping DTR does not work (definitely a
+ * brain damaged design).
+ */
+ vawrite("\r", 1 + slow);
+ vawrite("\r", 1 + slow);
+ if (!expect("DIALING:")) {
+ printf("Vadic failed to dial\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "vadic", "failed to dial");
+#endif
+ return (0);
+ }
+ if (boolean(value(VERBOSE)))
+ printf("\ndialing...");
+ ok = expect("ON LINE");
+ signal(SIGINT, func);
+ if (!ok) {
+ printf("call failed\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "vadic", "call failed");
+#endif
+ return (0);
+ }
+ tcflush(FD, TCIOFLUSH);
+ return (1);
+}
+
+void
+v3451_disconnect(void)
+{
+ close(FD);
+}
+
+void
+v3451_abort(void)
+{
+ close(FD);
+}
+
+static void
+vawrite(char *cp, int delay)
+{
+ for (; *cp; sleep(delay), cp++)
+ write(FD, cp, 1);
+}
+
+static int
+expect(char *cp)
+{
+ char buf[300];
+ char *rp = buf;
+ int timeout = 30, online = 0;
+
+ if (strcmp(cp, "\"\"") == 0)
+ return (1);
+ *rp = 0;
+ /*
+ * If we are waiting for the Vadic to complete
+ * dialing and get a connection, allow more time
+ * Unfortunately, the Vadic times out 24 seconds after
+ * the last digit is dialed
+ */
+ online = strcmp(cp, "ON LINE") == 0;
+ if (online)
+ timeout = number(value(DIALTIMEOUT));
+ signal(SIGALRM, alarmtr);
+ if (setjmp(Sjbuf))
+ return (0);
+ alarm(timeout);
+ while (notin(cp, buf) && rp < buf + sizeof (buf) - 1) {
+ if (online && notin("FAILED CALL", buf) == 0)
+ return (0);
+ if (read(FD, rp, 1) < 0) {
+ alarm(0);
+ return (0);
+ }
+ if (*rp &= 0177)
+ rp++;
+ *rp = '\0';
+ }
+ alarm(0);
+ return (1);
+}
+
+/*ARGSUSED*/
+static void
+alarmtr(int signo)
+{
+ longjmp(Sjbuf, 1);
+}
+
+static int
+notin(char *sh, char *lg)
+{
+ for (; *lg; lg++)
+ if (prefix(sh, lg))
+ return (0);
+ return (1);
+}
+
+static int
+prefix(char *s1, char *s2)
+{
+ char c;
+
+ while ((c = *s1++) == *s2++)
+ if (c == '\0')
+ return (1);
+ return (c == '\0');
+}
diff --git a/usr.bin/tip/libacu/v831.c b/usr.bin/tip/libacu/v831.c
new file mode 100644
index 0000000..7adc3c6
--- /dev/null
+++ b/usr.bin/tip/libacu/v831.c
@@ -0,0 +1,263 @@
+/* $OpenBSD: v831.c,v 1.11 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: v831.c,v 1.5 1996/12/29 10:42:01 cgd Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: v831.c,v 1.11 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for dialing up on Vadic 831
+ */
+#include "tip.h"
+#include <termios.h>
+
+static jmp_buf jmpbuf;
+static pid_t child = -1;
+
+static void alarmtr(int);
+static int dialit(char *, char *);
+static char * sanitize(char *);
+
+int
+v831_dialer(char *num, char *acu)
+{
+ int status;
+ int timelim;
+ pid_t pid;
+
+ if (boolean(value(VERBOSE)))
+ printf("\nstarting call...");
+#ifdef DEBUG
+ printf ("(acu=%s)\n", acu);
+#endif
+ if ((AC = open(acu, O_RDWR)) < 0) {
+ if (errno == EBUSY)
+ printf("line busy...");
+ else
+ printf("acu open error...");
+ return (0);
+ }
+ if (setjmp(jmpbuf)) {
+ kill(child, SIGKILL);
+ close(AC);
+ return (0);
+ }
+ signal(SIGALRM, alarmtr);
+ timelim = 5 * strlen(num);
+ alarm(timelim < 30 ? 30 : timelim);
+ if ((child = fork()) == 0) {
+ /*
+ * ignore this stuff for aborts
+ */
+ signal(SIGALRM, SIG_IGN);
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ sleep(2);
+ exit(dialit(num, acu) != 'A');
+ }
+ /*
+ * open line - will return on carrier
+ */
+ if ((FD = open(DV, O_RDWR)) < 0) {
+#ifdef DEBUG
+ printf("(after open, errno=%d)\n", errno);
+#endif
+ if (errno == EIO)
+ printf("lost carrier...");
+ else
+ printf("dialup line open failed...");
+ alarm(0);
+ kill(child, SIGKILL);
+ close(AC);
+ return (0);
+ }
+ alarm(0);
+ signal(SIGALRM, SIG_DFL);
+ while ((pid = wait(&status)) != child && pid != -1)
+ ;
+ if (status) {
+ close(AC);
+ return (0);
+ }
+ return (1);
+}
+
+/*ARGSUSED*/
+static void
+alarmtr(int signo)
+{
+ alarm(0);
+ longjmp(jmpbuf, 1);
+}
+
+/*
+ * Insurance, for some reason we don't seem to be
+ * hanging up...
+ */
+void
+v831_disconnect(void)
+{
+ struct termios cntrl;
+
+ sleep(2);
+#ifdef DEBUG
+ printf("[disconnect: FD=%d]\n", FD);
+#endif
+ if (FD > 0) {
+ ioctl(FD, TIOCCDTR, 0);
+ tcgetattr(FD, &cntrl);
+ cfsetospeed(&cntrl, 0);
+ cfsetispeed(&cntrl, 0);
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ ioctl(FD, TIOCNXCL, NULL);
+ }
+ close(FD);
+}
+
+void
+v831_abort(void)
+{
+#ifdef DEBUG
+ printf("[abort: AC=%d]\n", AC);
+#endif
+ sleep(2);
+ if (child > 0)
+ kill(child, SIGKILL);
+ if (FD > 0)
+ ioctl(FD, TIOCNXCL, NULL);
+ close(AC);
+ if (FD > 0)
+ ioctl(FD, TIOCCDTR, 0);
+ close(FD);
+}
+
+/*
+ * Sigh, this probably must be changed at each site.
+ */
+struct vaconfig {
+ char *vc_name;
+ char vc_rack;
+ char vc_modem;
+} vaconfig[] = {
+ { "/dev/cua0",'4','0' },
+ { "/dev/cua1",'4','1' },
+ { NULL, '\0', '\0' }
+};
+
+#define pc(x) (c = x, write(AC,&c,1))
+#define ABORT 01
+#define SI 017
+#define STX 02
+#define ETX 03
+
+static int
+dialit(char *phonenum, char *acu)
+{
+ struct vaconfig *vp;
+ struct termios cntrl;
+ char c;
+ int i;
+
+ phonenum = sanitize(phonenum);
+#ifdef DEBUG
+ printf ("(dial phonenum=%s)\n", phonenum);
+#endif
+ if (*phonenum == '<' && phonenum[1] == 0)
+ return ('Z');
+ for (vp = vaconfig; vp->vc_name; vp++)
+ if (strcmp(vp->vc_name, acu) == 0)
+ break;
+ if (vp->vc_name == 0) {
+ printf("Unable to locate dialer (%s)\n", acu);
+ return ('K');
+ }
+ tcgetattr(AC, &cntrl);
+ cfsetospeed(&cntrl, B2400);
+ cfsetispeed(&cntrl, B2400);
+ cntrl.c_cflag |= PARODD | PARENB;
+ cntrl.c_lflag &= ~(ISIG | ICANON);
+ tcsetattr(AC, TCSANOW, &cntrl);
+ tcflush(AC, TCIOFLUSH);
+ pc(STX);
+ pc(vp->vc_rack);
+ pc(vp->vc_modem);
+ while (*phonenum && *phonenum != '<')
+ pc(*phonenum++);
+ pc(SI);
+ pc(ETX);
+ sleep(1);
+ i = read(AC, &c, 1);
+#ifdef DEBUG
+ printf("read %d chars, char=%c, errno %d\n", i, c, errno);
+#endif
+ if (i != 1)
+ c = 'M';
+ if (c == 'B' || c == 'G') {
+ char cc, oc = c;
+
+ pc(ABORT);
+ read(AC, &cc, 1);
+#ifdef DEBUG
+ printf("abort response=%c\n", cc);
+#endif
+ c = oc;
+ v831_disconnect();
+ }
+ close(AC);
+#ifdef DEBUG
+ printf("dialit: returns %c\n", c);
+#endif
+ return (c);
+}
+
+static char *
+sanitize(char *s)
+{
+ static char buf[128];
+ char *cp;
+
+ for (cp = buf; *s; s++) {
+ if (!isdigit(*s) && *s == '<' && *s != '_')
+ continue;
+ if (*s == '_')
+ *s = '=';
+ *cp++ = *s;
+ }
+ *cp++ = 0;
+ return (buf);
+}
diff --git a/usr.bin/tip/libacu/ventel.c b/usr.bin/tip/libacu/ventel.c
new file mode 100644
index 0000000..399b5d8
--- /dev/null
+++ b/usr.bin/tip/libacu/ventel.c
@@ -0,0 +1,259 @@
+/* $OpenBSD: ventel.c,v 1.12 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: ventel.c,v 1.6 1997/02/11 09:24:21 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: ventel.c,v 1.12 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Routines for calling up on a Ventel Modem
+ * The Ventel is expected to be strapped for local echo (just like uucp)
+ */
+#include "tip.h"
+#include <termios.h>
+#include <sys/ioctl.h>
+
+#define MAXRETRY 5
+
+static int dialtimeout = 0;
+static jmp_buf timeoutbuf;
+
+static void echo(char *);
+static void sigALRM(int);
+static int gobble(char, char *);
+static int vensync(int);
+
+/*
+ * some sleep calls have been replaced by this macro
+ * because some ventel modems require two <cr>s in less than
+ * a second in order to 'wake up'... yes, it is dirty...
+ */
+#define delay(num,denom) busyloop(CPUSPEED*num/denom)
+#define CPUSPEED 1000000 /* VAX 780 is 1MIPS */
+#define DELAY(n) do { long N = (n); while (--N > 0); } while (0)
+#define busyloop(n) do { DELAY(n); } while (0)
+
+int
+ven_dialer(char *num, char *acu)
+{
+ char *cp;
+ int connected = 0;
+ char *msg, line[80];
+ struct termios cntrl;
+
+ /*
+ * Get in synch with a couple of carriage returns
+ */
+ if (!vensync(FD)) {
+ printf("can't synchronize with ventel\n");
+#ifdef ACULOG
+ logent(value(HOST), num, "ventel", "can't synch up");
+#endif
+ return (0);
+ }
+ if (boolean(value(VERBOSE)))
+ printf("\ndialing...");
+ fflush(stdout);
+ tcgetattr(FD, &cntrl);
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSANOW, &cntrl);
+ echo("#k$\r$\n$D$I$A$L$:$ ");
+ for (cp = num; *cp; cp++) {
+ delay(1, 10);
+ write(FD, cp, 1);
+ }
+ delay(1, 10);
+ write(FD, "\r", 1);
+ gobble('\n', line);
+ if (gobble('\n', line))
+ connected = gobble('!', line);
+ tcflush(FD, TCIOFLUSH);
+#ifdef ACULOG
+ if (dialtimeout) {
+ (void)snprintf(line, sizeof line, "%ld second dial timeout",
+ number(value(DIALTIMEOUT)));
+ logent(value(HOST), num, "ventel", line);
+ }
+#endif
+ if (dialtimeout)
+ ven_disconnect(); /* insurance */
+ if (connected || dialtimeout || !boolean(value(VERBOSE)))
+ return (connected);
+ /* call failed, parse response for user */
+ cp = strchr(line, '\r');
+ if (cp)
+ *cp = '\0';
+ for (cp = line; (cp = strchr(cp, ' ')) != NULL; cp++)
+ if (cp[1] == ' ')
+ break;
+ if (cp) {
+ while (*cp == ' ')
+ cp++;
+ msg = cp;
+ while (*cp) {
+ if (isupper(*cp))
+ *cp = tolower(*cp);
+ cp++;
+ }
+ printf("%s...", msg);
+ }
+ return (connected);
+}
+
+void
+ven_disconnect(void)
+{
+ close(FD);
+}
+
+void
+ven_abort(void)
+{
+ write(FD, "\03", 1);
+ close(FD);
+}
+
+static void
+echo(char *s)
+{
+ char c;
+
+ while ((c = *s++) != '\0')
+ switch (c) {
+ case '$':
+ read(FD, &c, 1);
+ s++;
+ break;
+
+ case '#':
+ c = *s++;
+ write(FD, &c, 1);
+ break;
+
+ default:
+ write(FD, &c, 1);
+ read(FD, &c, 1);
+ }
+}
+
+/*ARGSUSED*/
+static void
+sigALRM(int signo)
+{
+ printf("\07timeout waiting for reply\n");
+ dialtimeout = 1;
+ longjmp(timeoutbuf, 1);
+}
+
+static int
+gobble(char match, char response[])
+{
+ char *cp = response;
+ sig_t f;
+ char c;
+
+ f = signal(SIGALRM, sigALRM);
+ dialtimeout = 0;
+ do {
+ if (setjmp(timeoutbuf)) {
+ signal(SIGALRM, f);
+ *cp = '\0';
+ return (0);
+ }
+ alarm(number(value(DIALTIMEOUT)));
+ read(FD, cp, 1);
+ alarm(0);
+ c = (*cp++ &= 0177);
+#ifdef notdef
+ if (boolean(value(VERBOSE)))
+ putchar(c);
+#endif
+ } while (c != '\n' && c != match);
+ signal(SIGALRM, SIG_DFL);
+ *cp = '\0';
+ return (c == match);
+}
+
+#define min(a,b) ((a)>(b)?(b):(a))
+/*
+ * This convoluted piece of code attempts to get
+ * the ventel in sync. If you don't have FIONREAD
+ * there are gory ways to simulate this.
+ */
+static int
+vensync(int fd)
+{
+ int already = 0, nread;
+ char buf[60];
+
+ /*
+ * Toggle DTR to force anyone off that might have left
+ * the modem connected, and insure a consistent state
+ * to start from.
+ *
+ * If you don't have the ioctl calls to diddle directly
+ * with DTR, you can always try setting the baud rate to 0.
+ */
+ ioctl(FD, TIOCCDTR, 0);
+ sleep(1);
+ ioctl(FD, TIOCSDTR, 0);
+ while (already < MAXRETRY) {
+ /*
+ * After reseting the modem, send it two \r's to
+ * autobaud on. Make sure to delay between them
+ * so the modem can frame the incoming characters.
+ */
+ write(fd, "\r", 1);
+ delay(1,10);
+ write(fd, "\r", 1);
+ sleep(2);
+ if (ioctl(fd, FIONREAD, (caddr_t)&nread) < 0) {
+ perror("tip: ioctl");
+ continue;
+ }
+ while (nread > 0) {
+ read(fd, buf, min(nread, 60));
+ if ((buf[nread - 1] & 0177) == '$')
+ return (1);
+ nread -= min(nread, 60);
+ }
+ sleep(1);
+ already++;
+ }
+ return (0);
+}
diff --git a/usr.bin/tip/tip/Makefile b/usr.bin/tip/tip/Makefile
new file mode 100644
index 0000000..a8ed43f
--- /dev/null
+++ b/usr.bin/tip/tip/Makefile
@@ -0,0 +1,57 @@
+# $OpenBSD: Makefile,v 1.11 2006/05/25 08:41:52 jmc Exp $
+# $FreeBSD$
+#
+# Files are:
+# /etc/remote remote host description file
+# /etc/phones phone number file, owned by ${OWNER} and
+# mode 6??
+# /var/log/aculog ACU accounting file, owned by ${OWNER} and
+# mode 6?? {if ACULOG defined}
+# Presently supports:
+# BIZCOMP
+# DEC DF02-AC, DF03-AC
+# DEC DN-11/Able Quadracall
+# HAYES and Hayes emulators
+# USR COURIER (2400 baud)
+# VENTEL 212+
+# VADIC 831 RS232 adaptor
+# VADIC 3451
+# TELEBIT T3000
+#
+# Configuration defines:
+# DF02, DF03, DN11 ACU's supported
+# BIZ1031, BIZ1022, VENTEL, V831, V3451, HAYES, COURIER, T3000
+# ACULOG turn on tip logging of ACU use
+# PRISTINE no phone #'s put in ACU log file
+# CONNECT worthless command
+# DEFBR default baud rate to make connection at
+# DEFFS default frame size for FTP buffering of
+# writes on local side
+# BUFSIZ buffer sizing from stdio, must be fed
+# explicitly to remcap.c if not 1024
+# CONNECT enable ~C command (connect pgm to remote)
+
+PROG= tip
+LINKS= ${BINDIR}/tip ${BINDIR}/cu
+MAN= tip.1 cu.1
+CFLAGS+=-I${.CURDIR} -DDEFBR=9600 -DDEFFS=BUFSIZ -DACULOG -DPRISTINE \
+ -DCONNECT -DV831 -DVENTEL -DHAYES -DCOURIER -DT3000
+WARNS?= 2
+.PATH: ${.CURDIR}/../libacu
+SRCS= acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c partab.c \
+ remote.c tip.c tipout.c uucplock.c value.c vars.c \
+ biz22.c courier.c df.c dn11.c hayes.c t3000.c v3451.c v831.c ventel.c
+
+# -- acutab is configuration dependent, and so depends on the Makefile
+# -- remote.o depends on the Makefile because of DEFBR and DEFFS
+# -- log.o depends on the Makefile because of ACULOG
+acutab.o log.o remote.o: Makefile
+
+.include <bsd.prog.mk>
+
+# Dirty, rotten hack. This can be removed when we are confident that there
+# is no cu(1) with the schg-bit set.
+beforeinstall:
+.if exists(${DESTDIR}${BINDIR}/cu)
+ -chflags noschg ${DESTDIR}${BINDIR}/cu
+.endif
diff --git a/usr.bin/tip/tip/Makefile.depend b/usr.bin/tip/tip/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tip/tip/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tip/tip/acu.c b/usr.bin/tip/tip/acu.c
new file mode 100644
index 0000000..5d2cda6
--- /dev/null
+++ b/usr.bin/tip/tip/acu.c
@@ -0,0 +1,195 @@
+/* $OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */
+/* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+static acu_t *acu = NOACU;
+static int conflag;
+static void acuabort(int);
+static acu_t *acutype(char *);
+static jmp_buf jmpbuf;
+/*
+ * Establish connection for tip
+ *
+ * If DU is true, we should dial an ACU whose type is AT.
+ * The phone numbers are in PN, and the call unit is in CU.
+ *
+ * If the PN is an '@', then we consult the PHONES file for
+ * the phone numbers. This file is /etc/phones, unless overriden
+ * by an exported shell variable.
+ *
+ * The data base files must be in the format:
+ * host-name[ \t]*phone-number
+ * with the possibility of multiple phone numbers
+ * for a single host acting as a rotary (in the order
+ * found in the file).
+ */
+char *
+con(void)
+{
+ char *cp = PN;
+ char *phnum, string[256];
+ FILE *fd;
+ volatile int tried = 0;
+
+ if (!DU) { /* regular connect message */
+ if (CM != NOSTR)
+ parwrite(FD, CM, size(CM));
+ logent(value(HOST), "", DV, "call completed");
+ return (NOSTR);
+ }
+ /*
+ * @ =>'s use data base in PHONES environment variable
+ * otherwise, use /etc/phones
+ */
+ signal(SIGINT, acuabort);
+ signal(SIGQUIT, acuabort);
+ if (setjmp(jmpbuf)) {
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ printf("\ncall aborted\n");
+ logent(value(HOST), "", "", "call aborted");
+ if (acu != NOACU) {
+ setboolean(value(VERBOSE), FALSE);
+ if (conflag)
+ disconnect(NOSTR);
+ else
+ (*acu->acu_abort)();
+ }
+ return ("interrupt");
+ }
+ if ((acu = acutype(AT)) == NOACU)
+ return ("unknown ACU type");
+ if (*cp != '@') {
+ while (*cp) {
+ phnum = cp;
+ cp += strcspn(cp, ",");
+ if (*cp != '\0')
+ *cp++ = '\0';
+
+ if (strlen(phnum) == 0)
+ continue;
+
+ conflag = (*acu->acu_dialer)(phnum, CU);
+ if (conflag)
+ break;
+
+ logent(value(HOST), phnum, acu->acu_name, "call failed");
+ tried++;
+ }
+ } else {
+ if ((fd = fopen(PH, "r")) == NOFILE) {
+ printf("%s: ", PH);
+ return ("can't open phone number file");
+ }
+ while (fgets(string, sizeof(string), fd) != NOSTR) {
+ cp = &string[strcspn(string, " \t\n")];
+ if (*cp != '\0')
+ *cp++ = '\0';
+
+ if (strcmp(string, value(HOST)) != 0)
+ continue;
+
+ cp += strspn(cp, " \t\n");
+ phnum = cp;
+ *(cp + strcspn(cp, ",\n")) = '\0';
+
+ if (strlen(phnum) == 0)
+ continue;
+
+ conflag = (*acu->acu_dialer)(phnum, CU);
+ if (conflag)
+ break;
+
+ logent(value(HOST), phnum, acu->acu_name, "call failed");
+ tried++;
+ }
+ fclose(fd);
+ }
+ if (conflag) {
+ if (CM != NOSTR)
+ parwrite(FD, CM, size(CM));
+ logent(value(HOST), phnum, acu->acu_name, "call completed");
+ return (NOSTR);
+ } else if (!tried) {
+ logent(value(HOST), "", acu->acu_name, "missing phone number");
+ return ("missing phone number");
+ } else {
+ (*acu->acu_abort)();
+ return ("call failed");
+ }
+}
+
+void
+disconnect(char *reason)
+{
+ if (!conflag) {
+ logent(value(HOST), "", DV, "call terminated");
+ return;
+ }
+ if (reason == NOSTR) {
+ logent(value(HOST), "", acu->acu_name, "call terminated");
+ if (boolean(value(VERBOSE)))
+ printf("\r\ndisconnecting...");
+ } else
+ logent(value(HOST), "", acu->acu_name, reason);
+ (*acu->acu_disconnect)();
+}
+
+static void
+acuabort(int s)
+{
+ signal(s, SIG_IGN);
+ longjmp(jmpbuf, 1);
+}
+
+static acu_t *
+acutype(char *s)
+{
+ acu_t *p;
+ extern acu_t acutable[];
+
+ for (p = acutable; p->acu_name != '\0'; p++)
+ if (!strcmp(s, p->acu_name))
+ return (p);
+ return (NOACU);
+}
diff --git a/usr.bin/tip/tip/acutab.c b/usr.bin/tip/tip/acutab.c
new file mode 100644
index 0000000..5f64968
--- /dev/null
+++ b/usr.bin/tip/tip/acutab.c
@@ -0,0 +1,89 @@
+/* $OpenBSD: acutab.c,v 1.5 2006/03/17 19:17:13 moritz Exp $ */
+/* $NetBSD: acutab.c,v 1.3 1994/12/08 09:30:41 jtc Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)acutab.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: acutab.c,v 1.5 2006/03/17 19:17:13 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+acu_t acutable[] = {
+#if BIZ1031
+ { "biz31f", biz31f_dialer, biz31_disconnect, biz31_abort },
+ { "biz31w", biz31w_dialer, biz31_disconnect, biz31_abort },
+#endif
+#if BIZ1022
+ { "biz22f", biz22f_dialer, biz22_disconnect, biz22_abort },
+ { "biz22w", biz22w_dialer, biz22_disconnect, biz22_abort },
+#endif
+#if DF02
+ { "df02", df02_dialer, df_disconnect, df_abort },
+#endif
+#if DF03
+ { "df03", df03_dialer, df_disconnect, df_abort },
+#endif
+#if DN11
+ { "dn11", dn_dialer, dn_disconnect, dn_abort },
+#endif
+#ifdef VENTEL
+ { "ventel", ven_dialer, ven_disconnect, ven_abort },
+#endif
+#ifdef HAYES
+ { "hayes", hay_dialer, hay_disconnect, hay_abort },
+#endif
+#ifdef COURIER
+ { "courier", cour_dialer, cour_disconnect, cour_abort },
+#endif
+#ifdef T3000
+ { "t3000", t3000_dialer, t3000_disconnect, t3000_abort },
+#endif
+#ifdef V3451
+#ifndef V831
+ { "vadic", v3451_dialer, v3451_disconnect, v3451_abort },
+#endif
+ { "v3451", v3451_dialer, v3451_disconnect, v3451_abort },
+#endif
+#ifdef V831
+#ifndef V3451
+ { "vadic", v831_dialer, v831_disconnect, v831_abort },
+#endif
+ { "v831", v831_dialer, v831_disconnect, v831_abort },
+#endif
+ { 0, 0, 0, 0 }
+};
+
diff --git a/usr.bin/tip/tip/cmds.c b/usr.bin/tip/tip/cmds.c
new file mode 100644
index 0000000..50cedc4
--- /dev/null
+++ b/usr.bin/tip/tip/cmds.c
@@ -0,0 +1,999 @@
+/* $OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt Exp $ */
+/* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+#include "pathnames.h"
+
+#include <vis.h>
+
+/*
+ * tip
+ *
+ * miscellaneous commands
+ */
+
+int quant[] = { 60, 60, 24 };
+
+char null = '\0';
+char *sep[] = { "second", "minute", "hour" };
+static char *argv[10]; /* argument vector for take and put */
+
+static void transfer(char *, int, char *);
+static void stopsnd(int); /* SIGINT handler during file transfers */
+static void intcopy(int); /* interrupt routine for file transfers */
+static void transmit(FILE *, char *, char *);
+static void send(int);
+static void execute(char *);
+static int args(char *, char **, int);
+static void prtime(char *, time_t);
+static void tandem(char *);
+static void hardwareflow(char *);
+void linedisc(char *);
+static int anyof(char *, char *);
+
+/*
+ * FTP - remote ==> local
+ * get a file from the remote host
+ */
+void
+getfl(int c)
+{
+ char buf[256], *cp;
+
+ putchar(c);
+ /*
+ * get the UNIX receiving file's name
+ */
+ if (prompt("Local file name? ", copyname, sizeof(copyname)))
+ return;
+ cp = expand(copyname);
+ if ((sfd = creat(cp, 0666)) < 0) {
+ printf("\r\n%s: cannot creat\r\n", copyname);
+ return;
+ }
+
+ /*
+ * collect parameters
+ */
+ if (prompt("List command for remote system? ", buf, sizeof(buf))) {
+ unlink(copyname);
+ return;
+ }
+ transfer(buf, sfd, value(EOFREAD));
+}
+
+/*
+ * Cu-like take command
+ */
+void
+cu_take(int c)
+{
+ int fd, argc;
+ char line[BUFSIZ], *cp;
+
+ if (prompt("[take] ", copyname, sizeof(copyname)))
+ return;
+ if ((argc = args(copyname, argv, sizeof(argv)/sizeof(argv[0]))) < 1 ||
+ argc > 2) {
+ printf("usage: <take> from [to]\r\n");
+ return;
+ }
+ if (argc == 1)
+ argv[1] = argv[0];
+ cp = expand(argv[1]);
+ if ((fd = creat(cp, 0666)) < 0) {
+ printf("\r\n%s: cannot create\r\n", argv[1]);
+ return;
+ }
+ (void)snprintf(line, sizeof(line), "cat %s;echo ''|tr '\\012' '\\01'", argv[0]);
+ transfer(line, fd, "\01");
+}
+
+static jmp_buf intbuf;
+
+/*
+ * Bulk transfer routine --
+ * used by getfl(), cu_take(), and pipefile()
+ */
+static void
+transfer(char *buf, int fd, char *eofchars)
+{
+ int ct, eof;
+ char c, buffer[BUFSIZ];
+ char *p = buffer;
+ size_t cnt;
+ time_t start;
+ sig_t f;
+ char r;
+
+ if (number(value(FRAMESIZE)) > BUFSIZ || number(value(FRAMESIZE)) < 1) {
+ printf("framesize must be >= 1 and <= %d\r\n", BUFSIZ);
+ close(fd);
+ return;
+ }
+
+ parwrite(FD, buf, size(buf));
+ quit = 0;
+ kill(tipout_pid, SIGIOT);
+ read(repdes[0], (char *)&ccc, 1); /* Wait until read process stops */
+
+ /*
+ * finish command
+ */
+ r = '\r';
+ parwrite(FD, &r, 1);
+ do
+ read(FD, &c, 1);
+ while ((c&STRIP_PAR) != '\n');
+ tcsetattr(0, TCSAFLUSH, &defchars);
+
+ (void) setjmp(intbuf);
+ f = signal(SIGINT, intcopy);
+ start = time(0);
+ for (ct = 0; !quit;) {
+ eof = read(FD, &c, 1) <= 0;
+ c &= STRIP_PAR;
+ if (quit)
+ continue;
+ if (eof || any(c, eofchars))
+ break;
+ if (c == 0)
+ continue; /* ignore nulls */
+ if (c == '\r')
+ continue;
+ *p++ = c;
+
+ if (c == '\n' && boolean(value(VERBOSE)))
+ printf("\r%d", ++ct);
+ if ((cnt = (p-buffer)) == (size_t)number(value(FRAMESIZE))) {
+ if ((size_t)write(fd, buffer, cnt) != cnt) {
+ printf("\r\nwrite error\r\n");
+ quit = 1;
+ }
+ p = buffer;
+ }
+ }
+ if ((cnt = (p-buffer)))
+ if ((size_t)write(fd, buffer, cnt) != cnt)
+ printf("\r\nwrite error\r\n");
+
+ if (boolean(value(VERBOSE)))
+ prtime(" lines transferred in ", time(0)-start);
+ tcsetattr(0, TCSAFLUSH, &term);
+ write(fildes[1], (char *)&ccc, 1);
+ signal(SIGINT, f);
+ close(fd);
+}
+
+/*
+ * FTP - remote ==> local process
+ * send remote input to local process via pipe
+ */
+/*ARGSUSED*/
+void
+pipefile(int c)
+{
+ int pdes[2];
+ char buf[256];
+ int status, p;
+ pid_t cpid;
+
+ if (prompt("Local command? ", buf, sizeof(buf)))
+ return;
+
+ if (pipe(pdes)) {
+ printf("can't establish pipe\r\n");
+ return;
+ }
+
+ if ((cpid = fork()) < 0) {
+ printf("can't fork!\r\n");
+ return;
+ } else if (cpid) {
+ if (prompt("List command for remote system? ", buf, sizeof(buf))) {
+ close(pdes[0]), close(pdes[1]);
+ kill (cpid, SIGKILL);
+ } else {
+ close(pdes[0]);
+ signal(SIGPIPE, intcopy);
+ transfer(buf, pdes[1], value(EOFREAD));
+ signal(SIGPIPE, SIG_DFL);
+ while ((p = wait(&status)) > 0 && p != cpid)
+ ;
+ }
+ } else {
+ int f;
+
+ dup2(pdes[0], 0);
+ close(pdes[0]);
+ for (f = 3; f < 20; f++)
+ close(f);
+ execute(buf);
+ printf("can't execl!\r\n");
+ exit(0);
+ }
+}
+
+/*
+ * Interrupt service routine for FTP
+ */
+/*ARGSUSED*/
+static void
+stopsnd(int signo)
+{
+ stop = 1;
+ signal(SIGINT, SIG_IGN);
+}
+
+/*
+ * FTP - local ==> remote
+ * send local file to remote host
+ * terminate transmission with pseudo EOF sequence
+ */
+void
+sendfile(int c)
+{
+ FILE *fp;
+ char *fnamex;
+
+ putchar(c);
+ /*
+ * get file name
+ */
+ if (prompt("Local file name? ", fname, sizeof(fname)))
+ return;
+
+ /*
+ * look up file
+ */
+ fnamex = expand(fname);
+ if ((fp = fopen(fnamex, "r")) == NULL) {
+ printf("%s: cannot open\r\n", fname);
+ return;
+ }
+ transmit(fp, value(EOFWRITE), NULL);
+ if (!boolean(value(ECHOCHECK)))
+ tcdrain(FD);
+}
+
+/*
+ * Bulk transfer routine to remote host --
+ * used by sendfile() and cu_put()
+ */
+static void
+transmit(FILE *fp, char *eofchars, char *command)
+{
+ char *pc, lastc;
+ int c, ccount, lcount;
+ time_t start_t, stop_t;
+ sig_t f;
+
+ kill(tipout_pid, SIGIOT); /* put TIPOUT into a wait state */
+ stop = 0;
+ f = signal(SIGINT, stopsnd);
+ tcsetattr(0, TCSAFLUSH, &defchars);
+ read(repdes[0], (char *)&ccc, 1);
+ if (command != NULL) {
+ for (pc = command; *pc; pc++)
+ send(*pc);
+ if (boolean(value(ECHOCHECK)))
+ read(FD, (char *)&c, 1); /* trailing \n */
+ else {
+ tcdrain(FD);
+ sleep(5); /* wait for remote stty to take effect */
+ }
+ }
+ lcount = 0;
+ lastc = '\0';
+ start_t = time(0);
+ while (1) {
+ ccount = 0;
+ do {
+ c = getc(fp);
+ if (stop)
+ goto out;
+ if (c == EOF)
+ goto out;
+ if (c == 0177 && !boolean(value(RAWFTP)))
+ continue;
+ lastc = c;
+ if (c < 040) {
+ if (c == '\n') {
+ if (!boolean(value(RAWFTP)))
+ c = '\r';
+ } else if (c == '\t') {
+ if (!boolean(value(RAWFTP))) {
+ if (boolean(value(TABEXPAND))) {
+ send(' ');
+ while ((++ccount % 8) != 0)
+ send(' ');
+ continue;
+ }
+ }
+ } else
+ if (!boolean(value(RAWFTP)))
+ continue;
+ }
+ send(c);
+ } while (c != '\r' && !boolean(value(RAWFTP)));
+ if (boolean(value(VERBOSE)))
+ printf("\r%d", ++lcount);
+ if (boolean(value(ECHOCHECK))) {
+ timedout = 0;
+ alarm((unsigned int)lvalue(ETIMEOUT));
+ do { /* wait for prompt */
+ read(FD, (char *)&c, 1);
+ if (timedout || stop) {
+ if (timedout)
+ printf("\r\ntimed out at eol\r\n");
+ alarm(0);
+ goto out;
+ }
+ } while ((c&STRIP_PAR) != character(value(PROMPT)));
+ alarm(0);
+ }
+ }
+out:
+ if (lastc != '\n' && !boolean(value(RAWFTP)))
+ send('\r');
+ if (eofchars) {
+ for (pc = eofchars; *pc; pc++)
+ send(*pc);
+ }
+ stop_t = time(0);
+ fclose(fp);
+ signal(SIGINT, f);
+ if (boolean(value(VERBOSE))) {
+ if (boolean(value(RAWFTP)))
+ prtime(" chars transferred in ", stop_t-start_t);
+ else
+ prtime(" lines transferred in ", stop_t-start_t);
+ }
+ write(fildes[1], (char *)&ccc, 1);
+ tcsetattr(0, TCSAFLUSH, &term);
+}
+
+/*
+ * Cu-like put command
+ */
+/*ARGSUSED*/
+void
+cu_put(int c)
+{
+ FILE *fp;
+ char line[BUFSIZ];
+ int argc;
+ char *copynamex;
+
+ if (prompt("[put] ", copyname, sizeof(copyname)))
+ return;
+ if ((argc = args(copyname, argv, sizeof(argv)/sizeof(argv[0]))) < 1 ||
+ argc > 2) {
+ printf("usage: <put> from [to]\r\n");
+ return;
+ }
+ if (argc == 1)
+ argv[1] = argv[0];
+ copynamex = expand(argv[0]);
+ if ((fp = fopen(copynamex, "r")) == NULL) {
+ printf("%s: cannot open\r\n", copynamex);
+ return;
+ }
+ if (boolean(value(ECHOCHECK)))
+ (void)snprintf(line, sizeof(line), "cat>%s\r", argv[1]);
+ else
+ (void)snprintf(line, sizeof(line),
+ "stty -echo;cat>%s;stty echo\r", argv[1]);
+ transmit(fp, "\04", line);
+}
+
+/*
+ * FTP - send single character
+ * wait for echo & handle timeout
+ */
+static void
+send(int c)
+{
+ char cc;
+ int retry = 0;
+
+ cc = c;
+ parwrite(FD, &cc, 1);
+ if (number(value(CDELAY)) > 0 && c != '\r')
+ usleep(number(value(CDELAY)));
+ if (!boolean(value(ECHOCHECK))) {
+ if (number(value(LDELAY)) > 0 && c == '\r')
+ usleep(number(value(LDELAY)));
+ return;
+ }
+tryagain:
+ timedout = 0;
+ alarm((unsigned int)lvalue(ETIMEOUT));
+ read(FD, &cc, 1);
+ alarm(0);
+ if (timedout) {
+ printf("\r\ntimeout error (%s)\r\n", ctrl(c));
+ if (retry++ > 3)
+ return;
+ parwrite(FD, &null, 1); /* poke it */
+ goto tryagain;
+ }
+}
+
+/*ARGSUSED*/
+void
+timeout(int signo)
+{
+ signal(SIGALRM, timeout);
+ timedout = 1;
+}
+
+/*
+ * Stolen from consh() -- puts a remote file on the output of a local command.
+ * Identical to consh() except for where stdout goes.
+ */
+void
+pipeout(int c)
+{
+ char buf[256];
+ int status, p;
+ pid_t cpid;
+ time_t start = time(NULL);
+
+ putchar(c);
+ if (prompt("Local command? ", buf, sizeof(buf)))
+ return;
+ kill(tipout_pid, SIGIOT); /* put TIPOUT into a wait state */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ tcsetattr(0, TCSAFLUSH, &defchars);
+ read(repdes[0], (char *)&ccc, 1);
+ /*
+ * Set up file descriptors in the child and
+ * let it go...
+ */
+ if ((cpid = fork()) < 0)
+ printf("can't fork!\r\n");
+ else if (cpid) {
+ start = time(NULL);
+ while ((p = wait(&status)) > 0 && p != cpid)
+ ;
+ } else {
+ int i;
+
+ dup2(FD, 1);
+ for (i = 3; i < 20; i++)
+ close(i);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ execute(buf);
+ printf("can't find `%s'\r\n", buf);
+ exit(0);
+ }
+ if (boolean(value(VERBOSE)))
+ prtime("away for ", time(0)-start);
+ write(fildes[1], (char *)&ccc, 1);
+ tcsetattr(0, TCSAFLUSH, &term);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+}
+
+#ifdef CONNECT
+/*
+ * Fork a program with:
+ * 0 <-> remote tty in
+ * 1 <-> remote tty out
+ * 2 <-> local tty stderr
+ */
+void
+consh(int c)
+{
+ char buf[256];
+ int status, p;
+ pid_t cpid;
+ time_t start = time(NULL);
+
+ putchar(c);
+ if (prompt("Local command? ", buf, sizeof(buf)))
+ return;
+ kill(tipout_pid, SIGIOT); /* put TIPOUT into a wait state */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ tcsetattr(0, TCSAFLUSH, &defchars);
+ read(repdes[0], (char *)&ccc, 1);
+ /*
+ * Set up file descriptors in the child and
+ * let it go...
+ */
+ if ((cpid = fork()) < 0)
+ printf("can't fork!\r\n");
+ else if (cpid) {
+ start = time(0);
+ while ((p = wait(&status)) > 0 && p != cpid)
+ ;
+ } else {
+ int i;
+
+ dup2(FD, 0);
+ dup2(3, 1);
+ for (i = 3; i < 20; i++)
+ close(i);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ execute(buf);
+ printf("can't find `%s'\r\n", buf);
+ exit(0);
+ }
+ if (boolean(value(VERBOSE)))
+ prtime("away for ", time(0)-start);
+ write(fildes[1], (char *)&ccc, 1);
+ tcsetattr(0, TCSAFLUSH, &term);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+}
+#endif
+
+/*
+ * Escape to local shell
+ */
+/*ARGSUSED*/
+void
+shell(int c)
+{
+ int status;
+ char *cp;
+ pid_t shpid;
+
+ printf("[sh]\r\n");
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ unraw();
+ if ((shpid = fork())) {
+ while (shpid != wait(&status));
+ raw();
+ printf("\r\n!\r\n");
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ return;
+ } else {
+ signal(SIGQUIT, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+ if ((cp = strrchr(value(SHELL), '/')) == NULL)
+ cp = value(SHELL);
+ else
+ cp++;
+ shell_uid();
+ execl(value(SHELL), cp, (char *)NULL);
+ printf("\r\ncan't execl!\r\n");
+ exit(1);
+ }
+}
+
+/*
+ * TIPIN portion of scripting
+ * initiate the conversation with TIPOUT
+ */
+void
+setscript(void)
+{
+ char c;
+
+ /*
+ * enable TIPOUT side for dialogue
+ */
+ kill(tipout_pid, SIGEMT);
+ if (boolean(value(SCRIPT)))
+ write(fildes[1], value(RECORD), size(value(RECORD)));
+ write(fildes[1], "\n", 1);
+ /*
+ * wait for TIPOUT to finish
+ */
+ read(repdes[0], &c, 1);
+ if (c == 'n')
+ printf("can't create %s\r\n", value(RECORD));
+}
+
+/*
+ * Change current working directory of
+ * local portion of tip
+ */
+/*ARGSUSED*/
+void
+chdirectory(int c)
+{
+ char dirname[PATH_MAX];
+ char *cp = dirname;
+
+ if (prompt("[cd] ", dirname, sizeof(dirname))) {
+ if (stoprompt)
+ return;
+ cp = value(HOME);
+ }
+ if (chdir(cp) < 0)
+ printf("%s: bad directory\r\n", cp);
+ printf("!\r\n");
+}
+
+void
+tipabort(char *msg)
+{
+
+ signal(SIGTERM, SIG_IGN);
+ kill(tipout_pid, SIGTERM);
+ disconnect(msg);
+ if (msg != NOSTR)
+ printf("\r\n%s", msg);
+ printf("\r\n[EOT]\r\n");
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ unraw();
+ unexcl();
+ exit(0);
+}
+
+/*ARGSUSED*/
+void
+finish(int c)
+{
+ char *dismsg;
+
+ if ((dismsg = value(DISCONNECT)) != NOSTR) {
+ write(FD, dismsg, strlen(dismsg));
+ sleep(5);
+ }
+ tipabort(NOSTR);
+}
+
+/*ARGSUSED*/
+static void
+intcopy(int signo)
+{
+ raw();
+ quit = 1;
+ longjmp(intbuf, 1);
+}
+
+static void
+execute(char *s)
+{
+ char *cp;
+
+ if ((cp = strrchr(value(SHELL), '/')) == NULL)
+ cp = value(SHELL);
+ else
+ cp++;
+ shell_uid();
+ execl(value(SHELL), cp, "-c", s, (char *)NULL);
+}
+
+static int
+args(char *buf, char *a[], int num)
+{
+ char *p = buf, *start;
+ char **parg = a;
+ int n = 0;
+
+ do {
+ while (*p && (*p == ' ' || *p == '\t'))
+ p++;
+ start = p;
+ if (*p)
+ *parg = p;
+ while (*p && (*p != ' ' && *p != '\t'))
+ p++;
+ if (p != start)
+ parg++, n++;
+ if (*p)
+ *p++ = '\0';
+ } while (*p && n < num);
+
+ return(n);
+}
+
+static void
+prtime(char *s, time_t a)
+{
+ int i;
+ int nums[3];
+
+ for (i = 0; i < 3; i++) {
+ nums[i] = (int)(a % quant[i]);
+ a /= quant[i];
+ }
+ printf("%s", s);
+ while (--i >= 0)
+ if (nums[i] || (i == 0 && nums[1] == 0 && nums[2] == 0))
+ printf("%d %s%c ", nums[i], sep[i],
+ nums[i] == 1 ? '\0' : 's');
+ printf("\r\n!\r\n");
+}
+
+/*ARGSUSED*/
+void
+variable(int c)
+{
+ char buf[256];
+
+ if (prompt("[set] ", buf, sizeof(buf)))
+ return;
+ vlex(buf);
+ if (vtable[BEAUTIFY].v_access&CHANGED) {
+ vtable[BEAUTIFY].v_access &= ~CHANGED;
+ kill(tipout_pid, SIGSYS);
+ }
+ if (vtable[SCRIPT].v_access&CHANGED) {
+ vtable[SCRIPT].v_access &= ~CHANGED;
+ setscript();
+ /*
+ * So that "set record=blah script" doesn't
+ * cause two transactions to occur.
+ */
+ if (vtable[RECORD].v_access&CHANGED)
+ vtable[RECORD].v_access &= ~CHANGED;
+ }
+ if (vtable[RECORD].v_access&CHANGED) {
+ vtable[RECORD].v_access &= ~CHANGED;
+ if (boolean(value(SCRIPT)))
+ setscript();
+ }
+ if (vtable[TAND].v_access&CHANGED) {
+ vtable[TAND].v_access &= ~CHANGED;
+ if (boolean(value(TAND)))
+ tandem("on");
+ else
+ tandem("off");
+ }
+ if (vtable[LECHO].v_access&CHANGED) {
+ vtable[LECHO].v_access &= ~CHANGED;
+ HD = boolean(value(LECHO));
+ }
+ if (vtable[PARITY].v_access&CHANGED) {
+ vtable[PARITY].v_access &= ~CHANGED;
+ setparity(NOSTR);
+ }
+ if (vtable[HARDWAREFLOW].v_access&CHANGED) {
+ vtable[HARDWAREFLOW].v_access &= ~CHANGED;
+ if (boolean(value(HARDWAREFLOW)))
+ hardwareflow("on");
+ else
+ hardwareflow("off");
+ }
+ if (vtable[LINEDISC].v_access&CHANGED) {
+ vtable[LINEDISC].v_access &= ~CHANGED;
+ linedisc(NOSTR);
+ }
+}
+
+/*ARGSUSED*/
+void
+listvariables(int c)
+{
+ value_t *p;
+ char *buf;
+ char charbuf[5]; /* for vis(3), 4 chars for encoding, plus nul */
+
+ puts("v\r");
+ for (p = vtable; p->v_name; p++) {
+ fputs(p->v_name, stdout);
+ switch (p->v_type&TMASK) {
+ case STRING:
+ if (p->v_value) {
+ buf = malloc(4*strlen(p->v_value) + 1);
+ if (buf == NULL) {
+ fprintf(stderr, "Unable to malloc()\n");
+ abort();
+ }
+ strvis(buf, p->v_value, VIS_WHITE);
+ printf(" %s", buf);
+ free(buf);
+ }
+ putchar('\r');
+ putchar('\n');
+ break;
+ case NUMBER:
+ printf(" %ld\r\n", number(p->v_value));
+ break;
+ case BOOL:
+ printf(" %s\r\n",
+ !boolean(p->v_value) ? "false" : "true");
+ break;
+ case CHAR:
+ vis(charbuf, character(p->v_value), VIS_WHITE, 0);
+ printf(" %s\r\n", charbuf);
+ break;
+ }
+ }
+}
+
+/*
+ * Turn tandem mode on or off for remote tty.
+ */
+static void
+tandem(char *option)
+{
+ struct termios rmtty;
+
+ tcgetattr(FD, &rmtty);
+ if (strcmp(option, "on") == 0) {
+ rmtty.c_iflag |= IXOFF;
+ term.c_iflag |= IXOFF;
+ } else {
+ rmtty.c_iflag &= ~IXOFF;
+ term.c_iflag &= ~IXOFF;
+ }
+ tcsetattr(FD, TCSADRAIN, &rmtty);
+ tcsetattr(0, TCSADRAIN, &term);
+}
+
+/*
+ * Turn hardware flow control on or off for remote tty.
+ */
+static void
+hardwareflow(char *option)
+{
+ struct termios rmtty;
+
+ tcgetattr(FD, &rmtty);
+ if (strcmp(option, "on") == 0)
+ rmtty.c_iflag |= CRTSCTS;
+ else
+ rmtty.c_iflag &= ~CRTSCTS;
+ tcsetattr(FD, TCSADRAIN, &rmtty);
+}
+
+/*
+ * Change line discipline to the specified one.
+ */
+void
+linedisc(char *option)
+{
+ int ld = (int)(intptr_t)value(LINEDISC);
+
+ ioctl(FD, TIOCSETD, &ld);
+}
+
+/*
+ * Send a break.
+ */
+/*ARGSUSED*/
+void
+genbrk(int c)
+{
+ ioctl(FD, TIOCSBRK, NULL);
+ sleep(1);
+ ioctl(FD, TIOCCBRK, NULL);
+}
+
+/*
+ * Suspend tip
+ */
+void
+suspend(int c)
+{
+ unraw();
+ kill(c == CTRL('y') ? getpid() : 0, SIGTSTP);
+ raw();
+}
+
+/*
+ * expand a file name if it includes shell meta characters
+ */
+char *
+expand(char name[])
+{
+ static char xname[BUFSIZ];
+ char cmdbuf[BUFSIZ];
+ int l;
+ char *cp, *Shell;
+ int s, pivec[2];
+ pid_t pid;
+
+ if (!anyof(name, "~{[*?$`'\"\\"))
+ return(name);
+ /* sigint = signal(SIGINT, SIG_IGN); */
+ if (pipe(pivec) < 0) {
+ perror("pipe");
+ /* signal(SIGINT, sigint) */
+ return(name);
+ }
+ (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
+ if ((pid = vfork()) == 0) {
+ Shell = value(SHELL);
+ if (Shell == NOSTR)
+ Shell = _PATH_BSHELL;
+ close(pivec[0]);
+ close(1);
+ dup(pivec[1]);
+ close(pivec[1]);
+ close(2);
+ shell_uid();
+ execl(Shell, Shell, "-c", cmdbuf, (char *)NULL);
+ _exit(1);
+ }
+ if (pid == -1) {
+ perror("fork");
+ close(pivec[0]);
+ close(pivec[1]);
+ return(NOSTR);
+ }
+ close(pivec[1]);
+ l = read(pivec[0], xname, BUFSIZ);
+ close(pivec[0]);
+ while (wait(&s) != pid);
+ ;
+ s &= 0377;
+ if (s != 0 && s != SIGPIPE) {
+ fprintf(stderr, "\"Echo\" failed\n");
+ return(NOSTR);
+ }
+ if (l < 0) {
+ perror("read");
+ return(NOSTR);
+ }
+ if (l == 0) {
+ fprintf(stderr, "\"%s\": No match\n", name);
+ return(NOSTR);
+ }
+ if (l == BUFSIZ) {
+ fprintf(stderr, "Buffer overflow expanding \"%s\"\n", name);
+ return(NOSTR);
+ }
+ xname[l] = 0;
+ for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
+ ;
+ *++cp = '\0';
+ return(xname);
+}
+
+/*
+ * Are any of the characters in the two strings the same?
+ */
+static int
+anyof(char *s1, char *s2)
+{
+ int c;
+
+ while ((c = *s1++))
+ if (any(c, s2))
+ return(1);
+ return(0);
+}
diff --git a/usr.bin/tip/tip/cmdtab.c b/usr.bin/tip/tip/cmdtab.c
new file mode 100644
index 0000000..3666c12
--- /dev/null
+++ b/usr.bin/tip/tip/cmdtab.c
@@ -0,0 +1,66 @@
+/* $OpenBSD: cmdtab.c,v 1.7 2006/03/17 14:43:06 moritz Exp $ */
+/* $NetBSD: cmdtab.c,v 1.3 1994/12/08 09:30:46 jtc Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.7 2006/03/17 14:43:06 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+esctable_t etable[] = {
+ { '!', NORM, "shell", shell },
+ { '<', NORM, "receive file from remote host", getfl },
+ { '>', NORM, "send file to remote host", sendfile },
+ { 't', NORM, "take file from remote UNIX", cu_take },
+ { 'p', NORM, "put file to remote UNIX", cu_put },
+ { '|', NORM, "pipe remote file", pipefile },
+ { '$', NORM, "pipe local command to remote host", pipeout },
+#ifdef CONNECT
+ { 'C', NORM, "connect program to remote host",consh },
+#endif
+ { 'c', NORM, "change directory", chdirectory },
+ { '.', NORM, "exit from tip", finish },
+ {CTRL('d'),NORM,"exit from tip", finish },
+ {CTRL('y'),NORM,"suspend tip (local+remote)", suspend },
+ {CTRL('z'),NORM,"suspend tip (local only)", suspend },
+ { 's', NORM, "set variable", variable },
+ { 'v', NORM, "list variables", listvariables },
+ { '?', NORM, "get this summary", help },
+ { '#', NORM, "send break", genbrk },
+ { '\0', 0, NULL, NULL }
+};
diff --git a/usr.bin/tip/tip/cu.1 b/usr.bin/tip/tip/cu.1
new file mode 100644
index 0000000..aba5c40
--- /dev/null
+++ b/usr.bin/tip/tip/cu.1
@@ -0,0 +1,506 @@
+.\" $OpenBSD: cu.1,v 1.3 2006/06/07 06:35:59 mbalmer Exp $
+.\"
+.\" Copyright (c) 1980, 1990, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2006
+.Dt CU 1
+.Os
+.Sh NAME
+.Nm cu
+.Nd call UNIX
+.Sh SYNOPSIS
+.Nm
+.Op Fl ehot
+.Op Fl a Ar acu
+.Op Fl l Ar line
+.Op Fl s Ar speed | Fl Ar speed
+.Op Ar phone-number
+.Sh DESCRIPTION
+The
+.Nm
+utility
+establishes a full-duplex connection to another machine, giving the
+appearance of being logged in directly on the remote CPU.
+It goes without saying that you must have a login on the machine (or
+equivalent) to which you wish to connect.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a Ar acu
+Set the acu.
+.It Fl e
+Use even parity.
+If both
+.Fl e
+and
+.Fl o
+are given, then no parity is used
+(the default).
+.It Fl h
+Echo characters locally (half-duplex mode).
+.It Fl l Ar line
+Specify the line to use.
+Either of the forms like
+.Pa cuau0
+or
+.Pa /dev/cuau0
+are permitted.
+.It Fl o
+Use odd parity.
+If both
+.Fl e
+and
+.Fl o
+are given, then no parity is used
+(the default).
+.It Fl s Ar speed | Fl Ar speed
+Set the speed of the connection.
+The default is 9600.
+.It Fl t
+Connect via a hard-wired connection to a host on a dial-up line.
+.El
+.Pp
+Typed characters are normally transmitted directly to the remote
+machine (which does the echoing as well).
+A tilde
+.Pq Ql ~
+appearing as the first character of a line is an escape signal; the
+following are recognized:
+.Bl -tag -width indent
+.It Ic ~^D No or Ic ~.
+Drop the connection and exit.
+Only the connection is dropped \(en the login session is not terminated.
+.It Ic ~c Op Ar name
+Change directory to
+.Ar name
+(no argument implies change to home directory).
+.It Ic ~!
+Escape to a shell (exiting the shell will return to
+.Nm ) .
+.It Ic ~>
+Copy file from local to remote.
+The
+.Nm
+utility
+prompts for the name of a local file to transmit.
+.It Ic ~<
+Copy file from remote to local.
+The
+.Nm
+utility
+prompts first for the name of the file to be sent, then for a command
+to be executed on the remote machine.
+.It Ic ~p Ar from Op Ar to
+Send a file to a remote
+.Ux
+host.
+This command causes the remote
+.Ux
+system to run the following command string,
+sending it the
+.Ar from
+file:
+.Pp
+.Dl "stty -echo; cat > 'to'; stty echo"
+.Pp
+If the
+.Ar to
+file is not specified, the
+.Ar from
+file name is used.
+This command is actually a
+.Ux
+specific version of the
+.Ic ~>
+command.
+.It Ic ~t Ar from Op Ar to
+Take a file from a remote
+.Ux
+host.
+As in the
+.Ic ~p
+command, the
+.Ar to
+file defaults to the
+.Ar from
+file name if it is not specified.
+The remote host executes the following command string
+to send the file to
+.Nm :
+.Pp
+.Dl "cat 'from'; echo '' | tr '\e012' '\e01'"
+.It Ic ~|
+Pipe the output from a remote command to a local
+.Ux
+process.
+The command string sent to the local
+.Ux
+system is processed by the shell.
+.It Ic ~$
+Pipe the output from a local
+.Ux
+process to the remote host.
+The command string sent to the local
+.Ux
+system is processed by the shell.
+.It Ic ~C
+Fork a child process on the local system to perform special protocols
+such as
+.Tn XMODEM .
+The child program will be run with the following arrangement of
+file descriptors:
+.Bd -literal -offset indent
+0 <-> remote tty in
+1 <-> remote tty out
+2 <-> local tty stderr
+.Ed
+.It Ic ~#
+Send a
+.Dv BREAK
+to the remote system.
+For systems which do not support the necessary
+.Fn ioctl
+call, the break is simulated by a sequence of line speed changes and
+.Dv DEL
+characters.
+.It Ic ~s
+Set a variable (see the discussion below).
+.It Ic ~v
+List all variables and their values (if set).
+.It Ic ~^Z
+Stop
+.Nm
+(only available with job control).
+.It Ic ~^Y
+Stop only the
+.Dq "local side"
+of
+.Nm
+(only available with job control); the
+.Dq "remote side"
+of
+.Nm ,
+the side that displays output from the remote host, is left running.
+.It Ic ~?
+Get a summary of the tilde escapes.
+.El
+.Pp
+When
+.Nm
+prompts for an argument, for example during setup of a file transfer, the
+line typed may be edited with the standard erase and kill characters.
+A null line in response to a prompt, or an interrupt, will abort the
+dialogue and return the user to the remote machine.
+.Pp
+The
+.Nm
+utility
+guards against multiple users connecting to a remote system by opening
+modems and terminal lines with exclusive access, and by honoring the
+locking protocol used by
+.Xr uucico 8 Pq Pa ports/net/freebsd-uucp .
+.Pp
+During file transfers
+.Nm
+provides a running count of the number of lines transferred.
+When using the
+.Ic ~>
+and
+.Ic ~<
+commands, the
+.Va eofread
+and
+.Va eofwrite
+variables are used to recognize end-of-file when reading, and specify
+end-of-file when writing (see below).
+File transfers normally depend on hardwareflow or tandem mode for flow control.
+If the remote system does not support hardwareflow or tandem mode,
+.Va echocheck
+may be set to indicate that
+.Nm
+should synchronize with the remote system on the echo of each
+transmitted character.
+.Pp
+When
+.Nm
+must dial a phone number to connect to a system, it will print various
+messages indicating its actions.
+The
+.Nm
+utility
+supports a variety of auto-call units and modems with the
+.Va at
+capability in system descriptions.
+.Pp
+Support for Ventel 212+ (ventel), Hayes AT-style (hayes),
+USRobotics Courier (courier), Telebit T3000 (t3000) and
+Racal-Vadic 831 (vadic) units is enabled by default.
+.Pp
+Support for Bizcomp 1031[fw] (biz31[fw]), Bizcomp 1022[fw]
+(biz22[fw]), DEC DF0[23]-AC (df0[23]), DEC DN-11 (dn11) and
+Racal-Vadic 3451 (v3451) units can be added by recompiling
+.Nm
+with the appropriate defines.
+.Pp
+Note that if support for both the Racal-Vadic 831 and 3451 is enabled,
+they are referred to as the v831 and v3451, respectively.
+If only one of the two is supported, it is referred to as vadic.
+.Ss Variables
+The
+.Nm
+utility
+maintains a set of variables which control its operation.
+Some of these variables are read-only to normal users (root is allowed
+to change anything of interest).
+Variables may be displayed and set through the
+.Ic ~s
+escape.
+The syntax for variables is patterned after
+.Xr vi 1
+and
+.Xr Mail 1 .
+Supplying
+.Dq Li all
+as an argument to the set command displays all variables readable by
+the user.
+Alternatively, the user may request display of a particular variable
+by attaching a
+.Ql \&?
+to the end.
+For example,
+.Dq Li escape?
+displays the current escape character.
+.Pp
+Variables are numeric, string, character, or boolean values.
+Boolean variables are set merely by specifying their name; they may be
+reset by prepending a
+.Ql \&!
+to the name.
+Other variable types are set by concatenating an
+.Ql =
+and the value.
+The entire assignment must not have any blanks in it.
+A single set command may be used to interrogate as well as set a
+number of variables.
+Certain common variables have abbreviations.
+The following is a list of common variables, their abbreviations, and
+their default values:
+.Bl -tag -width indent
+.It Va baudrate
+.Pq Vt num
+The baud rate at which the connection was established;
+abbreviated
+.Va ba .
+.It Va beautify
+.Pq Vt bool
+Discard unprintable characters when a session is being
+scripted; abbreviated
+.Va be .
+.It Va dialtimeout
+.Pq Vt num
+When dialing a phone number, the time (in seconds) to wait for a
+connection to be established; abbreviated
+.Va dial .
+.It Va echocheck
+.Pq Vt bool
+Synchronize with the remote host during file transfer by
+waiting for the echo of the last character transmitted; default is
+.Cm off .
+.It Va eofread
+.Pq Vt str
+The set of characters which signify an end-of-transmission
+during a
+.Ic ~<
+file transfer command; abbreviated
+.Va eofr .
+.It Va eofwrite
+.Pq Vt str
+The string sent to indicate end-of-transmission during a
+.Ic ~>
+file transfer command; abbreviated
+.Va eofw .
+.It Va eol
+.Pq Vt str
+The set of characters which indicate an end-of-line.
+The
+.Nm
+utility
+will recognize escape characters only after an end-of-line.
+.It Va escape
+.Pq Vt char
+The command prefix (escape) character; abbreviated
+.Va es ;
+default value is
+.Ql ~ .
+.It Va exceptions
+.Pq Vt str
+The set of characters which should not be discarded due to the
+beautification switch; abbreviated
+.Va ex ;
+default value is
+.Dq Li \et\en\ef\eb .
+.It Va force
+.Pq Vt char
+The character used to force literal data transmission;
+abbreviated
+.Va fo ;
+default value is
+.Ql ^P .
+.It Va framesize
+.Pq Vt num
+The amount of data (in bytes) to buffer between file system
+writes when receiving files; abbreviated
+.Va fr .
+.It Va hardwareflow
+.Pq Vt bool
+Whether hardware flow control (CRTSCTS) is enabled for the
+connection; abbreviated
+.Va hf ;
+default value is
+.Cm off .
+.It Va host
+.Pq Vt str
+The name of the host to which you are connected; abbreviated
+.Va ho .
+.It Va linedisc
+.Pq Vt num
+The line discipline to use; abbreviated
+.Va ld .
+.It Va prompt
+.Pq Vt char
+The character which indicates an end-of-line on the remote
+host; abbreviated
+.Va pr ;
+default value is
+.Ql \en .
+This value is used to synchronize during data transfers.
+The count of lines transferred during a file transfer command is based
+on receipt of this character.
+.It Va raise
+.Pq Vt bool
+Upper case mapping mode; abbreviated
+.Va ra ;
+default value is
+.Cm off .
+When this mode is enabled, all lowercase letters will be mapped to
+uppercase by
+.Nm
+for transmission to the remote machine.
+.It Va raisechar
+.Pq Vt char
+The input character used to toggle uppercase mapping mode;
+abbreviated
+.Va rc ;
+not set by default.
+.It Va record
+.Pq Vt str
+The name of the file in which a session script is recorded;
+abbreviated
+.Va rec .
+.It Va script
+.Pq Vt bool
+Session scripting mode; abbreviated
+.Va sc ;
+default is
+.Cm off .
+When
+.Va script
+is
+.Cm true ,
+.Nm
+will record everything transmitted by the remote machine in the script
+record file specified in
+.Va record .
+If the
+.Va beautify
+switch is on, only printable
+.Tn ASCII
+characters will be included in the script file (those characters
+between 040 and 0177).
+The variable
+.Va exceptions
+is used to indicate characters which are an exception to the normal
+beautification rules.
+.It Va tabexpand
+.Pq Vt bool
+Expand tabs to spaces during file transfers; abbreviated
+.Va tab ;
+default value is
+.Cm false .
+Each tab is expanded to 8 spaces.
+.It Va tandem
+.Pq Vt bool
+Use XON/XOFF flow control to throttle data from the remote host;
+abbreviated
+.Va ta .
+The default value is
+.Cm true .
+.It Va verbose
+.Pq Vt bool
+Verbose mode; abbreviated
+.Va verb ;
+default is
+.Cm true .
+When verbose mode is enabled,
+.Nm
+prints messages while dialing, shows the current number of lines
+transferred during a file transfer operations, and more.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width indent
+.It Ev HOME
+The home directory to use for the
+.Ic ~c
+command.
+.It Ev SHELL
+The name of the shell to use for the
+.Ic ~!
+command; default value is
+.Dq Li /bin/sh .
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /var/spool/lock/LCK..*" -compact
+.It Pa /var/log/aculog
+line access log
+.It Pa /var/spool/lock/LCK..*
+lock file to avoid conflicts with
+.Xr uucp 1 Pq Pa ports/net/freebsd-uucp
+.El
+.Sh SEE ALSO
+.Xr tip 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Sh BUGS
+The full set of variables is undocumented and should, probably, be
+pared down.
diff --git a/usr.bin/tip/tip/cu.c b/usr.bin/tip/tip/cu.c
new file mode 100644
index 0000000..d8d104d
--- /dev/null
+++ b/usr.bin/tip/tip/cu.c
@@ -0,0 +1,210 @@
+/* $OpenBSD: cu.c,v 1.19 2006/05/25 08:41:52 jmc Exp $ */
+/* $NetBSD: cu.c,v 1.5 1997/02/11 09:24:05 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: cu.c,v 1.19 2006/05/25 08:41:52 jmc Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+static void cuusage(void);
+
+/*
+ * Botch the interface to look like cu's
+ */
+void
+cumain(int argc, char *argv[])
+{
+ int ch, i, parity;
+ long l;
+ char *cp;
+ static char sbuf[12];
+
+ if (argc < 2)
+ cuusage();
+ CU = DV = NOSTR;
+ BR = DEFBR;
+ parity = 0; /* none */
+
+ /*
+ * We want to accept -# as a speed. It's easiest to look through
+ * the arguments, replace -# with -s#, and let getopt() handle it.
+ */
+ for (i = 1; i < argc; i++) {
+ if (argv[i][0] == '-' &&
+ argv[i][1] >= '0' && argv[i][1] <= '9') {
+ asprintf(&cp, "-s%s", argv[i] + 1);
+ if (cp == NULL) {
+ fprintf(stderr,
+ "%s: cannot convert -# to -s#\n",
+ __progname);
+ exit(3);
+ }
+ argv[i] = cp;
+ }
+ }
+
+ while ((ch = getopt(argc, argv, "a:l:s:htoe")) != -1) {
+ switch (ch) {
+ case 'a':
+ CU = optarg;
+ break;
+ case 'l':
+ if (DV != NULL) {
+ fprintf(stderr,
+ "%s: cannot specificy multiple -l options\n",
+ __progname);
+ exit(3);
+ }
+ if (strchr(optarg, '/'))
+ DV = optarg;
+ else
+ asprintf(&DV, "/dev/%s", optarg);
+ break;
+ case 's':
+ l = strtol(optarg, &cp, 10);
+ if (*cp != '\0' || l < 0 || l >= INT_MAX) {
+ fprintf(stderr, "%s: unsupported speed %s\n",
+ __progname, optarg);
+ exit(3);
+ }
+ BR = (int)l;
+ break;
+ case 'h':
+ setboolean(value(LECHO), TRUE);
+ HD = TRUE;
+ break;
+ case 't':
+ HW = 1, DU = -1;
+ break;
+ case 'o':
+ if (parity != 0)
+ parity = 0; /* -e -o */
+ else
+ parity = 1; /* odd */
+ break;
+ case 'e':
+ if (parity != 0)
+ parity = 0; /* -o -e */
+ else
+ parity = -1; /* even */
+ break;
+ default:
+ cuusage();
+ break;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 1:
+ PN = argv[0];
+ break;
+ case 0:
+ break;
+ default:
+ cuusage();
+ break;
+ }
+
+ signal(SIGINT, cleanup);
+ signal(SIGQUIT, cleanup);
+ signal(SIGHUP, cleanup);
+ signal(SIGTERM, cleanup);
+ signal(SIGCHLD, SIG_DFL);
+
+ /*
+ * The "cu" host name is used to define the
+ * attributes of the generic dialer.
+ */
+ (void)snprintf(sbuf, sizeof(sbuf), "cu%ld", BR);
+ if ((i = hunt(sbuf)) == 0) {
+ printf("all ports busy\n");
+ exit(3);
+ }
+ if (i == -1) {
+ printf("link down\n");
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+ setbuf(stdout, NULL);
+ loginit();
+ user_uid();
+ vinit();
+ switch (parity) {
+ case -1:
+ setparity("even");
+ break;
+ case 1:
+ setparity("odd");
+ break;
+ default:
+ setparity("none");
+ break;
+ }
+ setboolean(value(VERBOSE), FALSE);
+ if (HW && ttysetup(BR)) {
+ fprintf(stderr, "%s: unsupported speed %ld\n",
+ __progname, BR);
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+ if (con()) {
+ printf("Connect failed\n");
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(1);
+ }
+ if (!HW && ttysetup(BR)) {
+ fprintf(stderr, "%s: unsupported speed %ld\n",
+ __progname, BR);
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+}
+
+static void
+cuusage(void)
+{
+ fprintf(stderr, "usage: cu [-ehot] [-a acu] [-l line] "
+ "[-s speed | -speed] [phone-number]\n");
+ exit(8);
+}
diff --git a/usr.bin/tip/tip/hunt.c b/usr.bin/tip/tip/hunt.c
new file mode 100644
index 0000000..0c104f1
--- /dev/null
+++ b/usr.bin/tip/tip/hunt.c
@@ -0,0 +1,109 @@
+/* $OpenBSD: hunt.c,v 1.13 2006/03/17 19:39:46 deraadt Exp $ */
+/* $NetBSD: hunt.c,v 1.6 1997/04/20 00:02:10 mellon Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: hunt.c,v 1.13 2006/03/17 19:39:46 deraadt Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+static jmp_buf deadline;
+static int deadfl;
+
+static void dead(int);
+
+/*ARGSUSED*/
+static void
+dead(int signo)
+{
+ deadfl = 1;
+ longjmp(deadline, 1);
+}
+
+long
+hunt(char *name)
+{
+ char *cp;
+ sig_t f;
+
+ f = signal(SIGALRM, dead);
+ while ((cp = getremote(name))) {
+ deadfl = 0;
+ uucplock = strrchr(cp, '/');
+ if (uucplock == NULL)
+ uucplock = cp;
+ else
+ uucplock++;
+
+ if (uu_lock(uucplock) < 0)
+ continue;
+ /*
+ * Straight through call units, such as the BIZCOMP,
+ * VADIC and the DF, must indicate they're hardwired in
+ * order to get an open file descriptor placed in FD.
+ * Otherwise, as for a DN-11, the open will have to
+ * be done in the "open" routine.
+ */
+ if (!HW)
+ break;
+ if (setjmp(deadline) == 0) {
+ alarm(10);
+ FD = open(cp, (O_RDWR |
+ (boolean(value(DC)) ? O_NONBLOCK : 0)));
+ }
+ alarm(0);
+ if (FD < 0) {
+ perror(cp);
+ deadfl = 1;
+ }
+ if (!deadfl) {
+ struct termios cntrl;
+
+ tcgetattr(FD, &cntrl);
+ if (!boolean(value(DC)))
+ cntrl.c_cflag |= HUPCL;
+ tcsetattr(FD, TCSAFLUSH, &cntrl);
+ ioctl(FD, TIOCEXCL, 0);
+ signal(SIGALRM, SIG_DFL);
+ return ((long)cp);
+ }
+ (void)uu_unlock(uucplock);
+ }
+ signal(SIGALRM, f);
+ return (deadfl ? -1 : (long)cp);
+}
diff --git a/usr.bin/tip/tip/log.c b/usr.bin/tip/tip/log.c
new file mode 100644
index 0000000..8123795
--- /dev/null
+++ b/usr.bin/tip/tip/log.c
@@ -0,0 +1,92 @@
+/* $OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $ */
+/* $NetBSD: log.c,v 1.4 1994/12/24 17:56:28 cgd Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+#ifdef ACULOG
+static FILE *flog = NULL;
+
+/*
+ * Log file maintenance routines
+ */
+void
+logent(char *group, char *num, char *acu, char *message)
+{
+ char *user, *timestamp;
+ struct passwd *pwd;
+ time_t t;
+
+ if (flog == NULL)
+ return;
+ if (flock(fileno(flog), LOCK_EX) < 0) {
+ perror("flock");
+ return;
+ }
+ if ((user = getlogin()) == NOSTR) {
+ if ((pwd = getpwuid(getuid())) == NOPWD)
+ user = "???";
+ else
+ user = pwd->pw_name;
+ }
+ t = time(0);
+ timestamp = ctime(&t);
+ timestamp[24] = '\0';
+ fprintf(flog, "%s (%s) <%s, %s, %s> %s\n",
+ user, timestamp, group,
+#ifdef PRISTINE
+ "",
+#else
+ num,
+#endif
+ acu, message);
+ (void) fflush(flog);
+ (void) flock(fileno(flog), LOCK_UN);
+}
+
+void
+loginit(void)
+{
+ flog = fopen(value(LOG), "a");
+ if (flog == NULL)
+ fprintf(stderr, "can't open log file %s.\r\n", value(LOG));
+}
+#endif
diff --git a/usr.bin/tip/tip/partab.c b/usr.bin/tip/tip/partab.c
new file mode 100644
index 0000000..05bb329
--- /dev/null
+++ b/usr.bin/tip/tip/partab.c
@@ -0,0 +1,63 @@
+/* $OpenBSD: partab.c,v 1.5 2003/06/03 02:56:18 millert Exp $ */
+/* $NetBSD: partab.c,v 1.4 1996/12/29 10:38:21 cgd Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)partab.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: partab.c,v 1.5 2003/06/03 02:56:18 millert Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * Even parity table for 0-0177
+ */
+const unsigned char evenpartab[] = {
+ 0000,0201,0202,0003,0204,0005,0006,0207,
+ 0210,0011,0012,0213,0014,0215,0216,0017,
+ 0220,0021,0022,0223,0024,0225,0226,0027,
+ 0030,0231,0232,0033,0234,0035,0036,0237,
+ 0240,0041,0042,0243,0044,0245,0246,0047,
+ 0050,0251,0252,0053,0254,0055,0056,0257,
+ 0060,0261,0262,0063,0264,0065,0066,0267,
+ 0270,0071,0072,0273,0074,0275,0276,0077,
+ 0300,0101,0102,0303,0104,0305,0306,0107,
+ 0110,0311,0312,0113,0314,0115,0116,0317,
+ 0120,0321,0322,0123,0324,0125,0126,0327,
+ 0330,0131,0132,0333,0134,0335,0336,0137,
+ 0140,0341,0342,0143,0344,0145,0146,0347,
+ 0350,0151,0152,0353,0154,0355,0356,0157,
+ 0360,0161,0162,0363,0164,0365,0366,0167,
+ 0170,0371,0372,0173,0374,0175,0176,0377,
+};
diff --git a/usr.bin/tip/tip/pathnames.h b/usr.bin/tip/tip/pathnames.h
new file mode 100644
index 0000000..66a453d
--- /dev/null
+++ b/usr.bin/tip/tip/pathnames.h
@@ -0,0 +1,41 @@
+/* $OpenBSD: pathnames.h,v 1.3 2003/06/03 02:56:18 millert Exp $ */
+/* $NetBSD: pathnames.h,v 1.3 1994/12/08 09:30:59 jtc Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Copyright (c) 1989, 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.
+ * 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.
+ *
+ * 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.
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ */
+
+#include <paths.h>
+
+#define _PATH_ACULOG "/var/log/aculog"
+#define _PATH_LOCKDIRNAME "/var/spool/lock/LCK..%s"
+#define _PATH_PHONES "/etc/phones"
+#define _PATH_REMOTE "/etc/remote"
diff --git a/usr.bin/tip/tip/remote.c b/usr.bin/tip/tip/remote.c
new file mode 100644
index 0000000..d9993ae
--- /dev/null
+++ b/usr.bin/tip/tip/remote.c
@@ -0,0 +1,242 @@
+/* $OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt Exp $ */
+/* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */
+
+/*
+ * Copyright (c) 1992, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1992, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt Exp $";
+#endif
+#endif /* not lint */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pathnames.h"
+#include "tip.h"
+
+/*
+ * Attributes to be gleened from remote host description
+ * data base.
+ */
+static char **caps[] = {
+ &AT, &DV, &CM, &CU, &EL, &IE, &OE, &PN, &PR, &DI,
+ &ES, &EX, &FO, &RC, &RE, &PA
+};
+
+static char *capstrings[] = {
+ "at", "dv", "cm", "cu", "el", "ie", "oe", "pn", "pr",
+ "di", "es", "ex", "fo", "rc", "re", "pa", 0
+};
+
+static char *db_array[3] = { _PATH_REMOTE, 0, 0 };
+
+#define cgetflag(f) (cgetcap(bp, f, ':') != NULL)
+
+static void getremcap(char *);
+
+static void
+getremcap(char *host)
+{
+ char **p, ***q, *bp, *rempath;
+ int stat;
+
+ rempath = getenv("REMOTE");
+ if (rempath != NULL) {
+ if (*rempath != '/')
+ /* we have an entry */
+ cgetset(rempath);
+ else { /* we have a path */
+ db_array[1] = rempath;
+ db_array[2] = _PATH_REMOTE;
+ }
+ }
+
+ if ((stat = cgetent(&bp, db_array, host)) < 0) {
+ if ((DV != NULL) ||
+ (host[0] == '/' && access(DV = host, R_OK | W_OK) == 0)) {
+ CU = DV;
+ HO = host;
+ HW = 1;
+ DU = 0;
+ if (!BR)
+ BR = DEFBR;
+ FS = DEFFS;
+ return;
+ }
+ switch (stat) {
+ case -1:
+ fprintf(stderr, "%s: unknown host %s\n", __progname,
+ host);
+ break;
+ case -2:
+ fprintf(stderr,
+ "%s: can't open host description file\n",
+ __progname);
+ break;
+ case -3:
+ fprintf(stderr,
+ "%s: possible reference loop in host description file\n", __progname);
+ break;
+ }
+ exit(3);
+ }
+
+ for (p = capstrings, q = caps; *p != NULL; p++, q++)
+ if (**q == NULL)
+ cgetstr(bp, *p, *q);
+ if (!BR && (cgetnum(bp, "br", &BR) == -1))
+ BR = DEFBR;
+ if (!LD && (cgetnum(bp, "ld", &LD) == -1))
+ LD = TTYDISC;
+ if (cgetnum(bp, "fs", &FS) == -1)
+ FS = DEFFS;
+ if (DU < 0)
+ DU = 0;
+ else
+ DU = cgetflag("du");
+ if (DV == NOSTR) {
+ fprintf(stderr, "%s: missing device spec\n", host);
+ exit(3);
+ }
+ if (DU && CU == NOSTR)
+ CU = DV;
+ if (DU && PN == NOSTR) {
+ fprintf(stderr, "%s: missing phone number\n", host);
+ exit(3);
+ }
+ if (DU && AT == NOSTR) {
+ fprintf(stderr, "%s: missing acu type\n", host);
+ exit(3);
+ }
+
+ HD = cgetflag("hd");
+
+ /*
+ * This effectively eliminates the "hw" attribute
+ * from the description file
+ */
+ if (!HW)
+ HW = (CU == NOSTR) || (DU && equal(DV, CU));
+ HO = host;
+ /*
+ * see if uppercase mode should be turned on initially
+ */
+ if (cgetflag("ra"))
+ setboolean(value(RAISE), 1);
+ if (cgetflag("ec"))
+ setboolean(value(ECHOCHECK), 1);
+ if (cgetflag("be"))
+ setboolean(value(BEAUTIFY), 1);
+ if (cgetflag("nb"))
+ setboolean(value(BEAUTIFY), 0);
+ if (cgetflag("sc"))
+ setboolean(value(SCRIPT), 1);
+ if (cgetflag("tb"))
+ setboolean(value(TABEXPAND), 1);
+ if (cgetflag("vb"))
+ setboolean(value(VERBOSE), 1);
+ if (cgetflag("nv"))
+ setboolean(value(VERBOSE), 0);
+ if (cgetflag("ta"))
+ setboolean(value(TAND), 1);
+ if (cgetflag("nt"))
+ setboolean(value(TAND), 0);
+ if (cgetflag("rw"))
+ setboolean(value(RAWFTP), 1);
+ if (cgetflag("hd"))
+ setboolean(value(HALFDUPLEX), 1);
+ if (cgetflag("dc"))
+ setboolean(value(DC), 1);
+ if (cgetflag("hf"))
+ setboolean(value(HARDWAREFLOW), 1);
+ if (RE == NOSTR)
+ RE = (char *)"tip.record";
+ if (EX == NOSTR)
+ EX = (char *)"\t\n\b\f";
+ if (ES != NOSTR)
+ vstring("es", ES);
+ if (FO != NOSTR)
+ vstring("fo", FO);
+ if (PR != NOSTR)
+ vstring("pr", PR);
+ if (RC != NOSTR)
+ vstring("rc", RC);
+ if (cgetnum(bp, "dl", &DL) == -1)
+ DL = 0;
+ if (cgetnum(bp, "cl", &CL) == -1)
+ CL = 0;
+ if (cgetnum(bp, "et", &ET) == -1)
+ ET = 10;
+}
+
+char *
+getremote(char *host)
+{
+ char *cp;
+ static char *next;
+ static int lookedup = 0;
+
+ if (!lookedup) {
+ if (host == NOSTR && (host = getenv("HOST")) == NOSTR) {
+ fprintf(stderr, "%s: no host specified\n", __progname);
+ exit(3);
+ }
+ getremcap(host);
+ next = DV;
+ lookedup++;
+ }
+ /*
+ * We return a new device each time we're called (to allow
+ * a rotary action to be simulated)
+ */
+ if (next == NOSTR)
+ return (NOSTR);
+ if ((cp = strchr(next, ',')) == NULL) {
+ DV = next;
+ next = NOSTR;
+ } else {
+ *cp++ = '\0';
+ DV = next;
+ next = cp;
+ }
+ return (DV);
+}
diff --git a/usr.bin/tip/tip/tip.1 b/usr.bin/tip/tip/tip.1
new file mode 100644
index 0000000..ee085da
--- /dev/null
+++ b/usr.bin/tip/tip/tip.1
@@ -0,0 +1,603 @@
+.\" $OpenBSD: tip.1,v 1.37 2006/06/07 06:35:59 mbalmer Exp $
+.\" $NetBSD: tip.1,v 1.7 1994/12/08 09:31:05 jtc Exp $
+.\"
+.\" Copyright (c) 1980, 1990, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd August 31, 2006
+.Dt TIP 1
+.Os
+.Sh NAME
+.Nm tip
+.Nd connect to a remote system
+.Sh SYNOPSIS
+.Nm
+.Op Fl nv
+.Op Fl Ar speed
+.Op Ar system-name
+.Sh DESCRIPTION
+The
+.Nm
+utility
+establishes a full-duplex connection to another machine, giving the
+appearance of being logged in directly on the remote CPU.
+It goes without saying that you must have a login on the machine (or
+equivalent) to which you wish to connect.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl n
+No escape (disable tilde).
+.It Fl v
+Set verbose mode.
+.El
+.Pp
+If
+.Ar speed
+is specified, it will override any baudrate specified in the system
+description being used.
+.Pp
+If neither
+.Ar speed
+nor
+.Ar system-name
+are specified,
+.Ar system-name
+will be set to the value of the
+.Ev HOST
+environment variable.
+.Pp
+If
+.Ar speed
+is specified but
+.Ar system-name
+is not,
+.Ar system-name
+will be set to a value of
+.Dq Li tip
+with
+.Ar speed
+appended.
+For example,
+.Nm Fl 1200
+will set
+.Ar system-name
+to
+.Dq Li tip1200 .
+.Pp
+Typed characters are normally transmitted directly to the remote
+machine (which does the echoing as well).
+A tilde
+.Pq Ql ~
+appearing as the first character of a line is an escape signal; the
+following are recognized:
+.Bl -tag -width indent
+.It Ic ~^D No or Ic ~.
+Drop the connection and exit.
+Only the connection is dropped \(en the login session is not terminated.
+.It Ic ~c Op Ar name
+Change directory to
+.Ar name
+(no argument implies change to home directory).
+.It Ic ~!
+Escape to a shell (exiting the shell will return to
+.Nm ) .
+.It Ic ~>
+Copy file from local to remote.
+The
+.Nm
+utility
+prompts for the name of a local file to transmit.
+.It Ic ~<
+Copy file from remote to local.
+The
+.Nm
+utility
+prompts first for the name of the file to be sent, then for a command
+to be executed on the remote machine.
+.It Ic ~p Ar from Op Ar to
+Send a file to a remote
+.Ux
+host.
+This command causes the remote
+.Ux
+system to run the following command string,
+sending it the
+.Ar from
+file:
+.Pp
+.Dl "stty -echo; cat > 'to'; stty echo"
+.Pp
+If the
+.Ar to
+file is not specified, the
+.Ar from
+file name is used.
+This command is actually a
+.Ux
+specific version of the
+.Ic ~>
+command.
+.It Ic ~t Ar from Op Ar to
+Take a file from a remote
+.Ux
+host.
+As in the
+.Ic ~p
+command, the
+.Ar to
+file defaults to the
+.Ar from
+file name if it is not specified.
+The remote host executes the following command string
+to send the file to
+.Nm :
+.Pp
+.Dl "cat 'from'; echo '' | tr '\e012' '\e01'"
+.It Ic ~|
+Pipe the output from a remote command to a local
+.Ux
+process.
+The command string sent to the local
+.Ux
+system is processed by the shell.
+.It Ic ~$
+Pipe the output from a local
+.Ux
+process to the remote host.
+The command string sent to the local
+.Ux
+system is processed by the shell.
+.It Ic ~C
+Fork a child process on the local system to perform special protocols
+such as
+.Tn XMODEM .
+The child program will be run with the following arrangement of
+file descriptors:
+.Bd -literal -offset indent
+0 <-> remote tty in
+1 <-> remote tty out
+2 <-> local tty stderr
+.Ed
+.It Ic ~#
+Send a
+.Dv BREAK
+to the remote system.
+For systems which do not support the necessary
+.Fn ioctl
+call, the break is simulated by a sequence of line speed changes and
+.Dv DEL
+characters.
+.It Ic ~s
+Set a variable (see the discussion below).
+.It Ic ~v
+List all variables and their values (if set).
+.It Ic ~^Z
+Stop
+.Nm
+(only available with job control).
+.It Ic ~^Y
+Stop only the
+.Dq "local side"
+of
+.Nm
+(only available with job control); the
+.Dq "remote side"
+of
+.Nm ,
+the side that displays output from the remote host, is left running.
+.It Ic ~?
+Get a summary of the tilde escapes.
+.El
+.Pp
+To find the system description, and thus the operating characteristics
+of
+.Ar system-name ,
+.Nm
+searches for a system description with a name identical to
+.Ar system-name .
+The search order is as follows:
+.Bl -enum -offset indent
+.It
+If the environment variable
+.Ev REMOTE
+does not start with a
+.Ql /
+it is assumed to be a system description, and is considered first.
+.It
+If the environment variable
+.Ev REMOTE
+begins with a
+.Ql /
+it is assumed to be a path to a
+.Xr remote 5
+database, and the specified database is searched.
+.It
+The default
+.Xr remote 5
+database,
+.Pa /etc/remote ,
+is searched.
+.El
+.Pp
+See
+.Xr remote 5
+for full documentation on system descriptions.
+.Pp
+The
+.Va br
+capability is used in system descriptions to specify the baud rate
+with which to establish a connection.
+If the value specified is not suitable, the baud rate to be used may
+be given on the command line, e.g.\&
+.Dq Li "tip -300 mds" .
+.Pp
+When
+.Nm
+establishes a connection, it sends out the connection message
+specified in the
+.Va cm
+capability of the system description being used.
+.Pp
+When
+.Nm
+prompts for an argument, for example during setup of a file transfer, the
+line typed may be edited with the standard erase and kill characters.
+A null line in response to a prompt, or an interrupt, will abort the
+dialogue and return the user to the remote machine.
+.Pp
+The
+.Nm
+utility
+guards against multiple users connecting to a remote system by opening
+modems and terminal lines with exclusive access, and by honoring the
+locking protocol used by
+.Xr uucico 8 Pq Pa ports/net/freebsd-uucp .
+.Pp
+During file transfers
+.Nm
+provides a running count of the number of lines transferred.
+When using the
+.Ic ~>
+and
+.Ic ~<
+commands, the
+.Va eofread
+and
+.Va eofwrite
+variables are used to recognize end-of-file when reading, and specify
+end-of-file when writing (see below).
+File transfers normally depend on hardwareflow or tandem mode for flow control.
+If the remote system does not support hardwareflow or tandem mode,
+.Va echocheck
+may be set to indicate that
+.Nm
+should synchronize with the remote system on the echo of each
+transmitted character.
+.Pp
+When
+.Nm
+must dial a phone number to connect to a system, it will print various
+messages indicating its actions.
+The
+.Nm
+utility
+supports a variety of auto-call units and modems with the
+.Va at
+capability in system descriptions.
+.Pp
+Support for Ventel 212+ (ventel), Hayes AT-style (hayes),
+USRobotics Courier (courier), Telebit T3000 (t3000) and
+Racal-Vadic 831 (vadic) units is enabled by default.
+.Pp
+Support for Bizcomp 1031[fw] (biz31[fw]), Bizcomp 1022[fw]
+(biz22[fw]), DEC DF0[23]-AC (df0[23]), DEC DN-11 (dn11) and
+Racal-Vadic 3451 (v3451) units can be added by recompiling
+.Nm
+with the appropriate defines.
+.Pp
+Note that if support for both the Racal-Vadic 831 and 3451 is enabled,
+they are referred to as the v831 and v3451, respectively.
+If only one of the two is supported, it is referred to as vadic.
+.Ss Variables
+The
+.Nm
+utility
+maintains a set of variables which control its operation.
+Some of these variables are read-only to normal users (root is allowed
+to change anything of interest).
+Variables may be displayed and set through the
+.Ic ~s
+escape.
+The syntax for variables is patterned after
+.Xr vi 1
+and
+.Xr Mail 1 .
+Supplying
+.Dq Li all
+as an argument to the set command displays all variables readable by
+the user.
+Alternatively, the user may request display of a particular variable
+by attaching a
+.Ql \&?
+to the end.
+For example,
+.Dq Li escape?
+displays the current escape character.
+.Pp
+Variables are numeric, string, character, or boolean values.
+Boolean variables are set merely by specifying their name; they may be
+reset by prepending a
+.Ql \&!
+to the name.
+Other variable types are set by concatenating an
+.Ql =
+and the value.
+The entire assignment must not have any blanks in it.
+A single set command may be used to interrogate as well as set a
+number of variables.
+Variables may be initialized at run time by placing set commands
+(without the
+.Ic ~s
+prefix) in the initialization file
+.Pa ~/.tiprc ;
+the
+.Fl v
+option additionally causes
+.Nm
+to display the sets as they are made.
+Certain common variables have abbreviations.
+The following is a list of common variables, their abbreviations, and
+their default values:
+.Bl -tag -width indent
+.It Va baudrate
+.Pq Vt num
+The baud rate at which the connection was established;
+abbreviated
+.Va ba .
+.It Va beautify
+.Pq Vt bool
+Discard unprintable characters when a session is being
+scripted; abbreviated
+.Va be .
+.It Va dialtimeout
+.Pq Vt num
+When dialing a phone number, the time (in seconds) to wait for a
+connection to be established; abbreviated
+.Va dial .
+.It Va echocheck
+.Pq Vt bool
+Synchronize with the remote host during file transfer by
+waiting for the echo of the last character transmitted; default is
+.Cm off .
+.It Va eofread
+.Pq Vt str
+The set of characters which signify an end-of-transmission
+during a
+.Ic ~<
+file transfer command; abbreviated
+.Va eofr .
+.It Va eofwrite
+.Pq Vt str
+The string sent to indicate end-of-transmission during a
+.Ic ~>
+file transfer command; abbreviated
+.Va eofw .
+.It Va eol
+.Pq Vt str
+The set of characters which indicate an end-of-line.
+The
+.Nm
+utility
+will recognize escape characters only after an end-of-line.
+.It Va escape
+.Pq Vt char
+The command prefix (escape) character; abbreviated
+.Va es ;
+default value is
+.Ql ~ .
+.It Va exceptions
+.Pq Vt str
+The set of characters which should not be discarded due to the
+beautification switch; abbreviated
+.Va ex ;
+default value is
+.Dq Li \et\en\ef\eb .
+.It Va force
+.Pq Vt char
+The character used to force literal data transmission;
+abbreviated
+.Va fo ;
+default value is
+.Ql ^P .
+.It Va framesize
+.Pq Vt num
+The amount of data (in bytes) to buffer between file system
+writes when receiving files; abbreviated
+.Va fr .
+.It Va hardwareflow
+.Pq Vt bool
+Whether hardware flow control (CRTSCTS) is enabled for the
+connection; abbreviated
+.Va hf ;
+default value is
+.Cm off .
+.It Va host
+.Pq Vt str
+The name of the host to which you are connected; abbreviated
+.Va ho .
+.It Va linedisc
+.Pq Vt num
+The line discipline to use; abbreviated
+.Va ld .
+.It Va prompt
+.Pq Vt char
+The character which indicates an end-of-line on the remote
+host; abbreviated
+.Va pr ;
+default value is
+.Ql \en .
+This value is used to synchronize during data transfers.
+The count of lines transferred during a file transfer command is based
+on receipt of this character.
+.It Va raise
+.Pq Vt bool
+Upper case mapping mode; abbreviated
+.Va ra ;
+default value is
+.Cm off .
+When this mode is enabled, all lowercase letters will be mapped to
+uppercase by
+.Nm
+for transmission to the remote machine.
+.It Va raisechar
+.Pq Vt char
+The input character used to toggle uppercase mapping mode;
+abbreviated
+.Va rc ;
+not set by default.
+.It Va record
+.Pq Vt str
+The name of the file in which a session script is recorded;
+abbreviated
+.Va rec ;
+default value is
+.Pa tip.record .
+.It Va script
+.Pq Vt bool
+Session scripting mode; abbreviated
+.Va sc ;
+default is
+.Cm off .
+When
+.Va script
+is
+.Cm true ,
+.Nm
+will record everything transmitted by the remote machine in the script
+record file specified in
+.Va record .
+If the
+.Va beautify
+switch is on, only printable
+.Tn ASCII
+characters will be included in the script file (those characters
+between 040 and 0177).
+The variable
+.Va exceptions
+is used to indicate characters which are an exception to the normal
+beautification rules.
+.It Va tabexpand
+.Pq Vt bool
+Expand tabs to spaces during file transfers; abbreviated
+.Va tab ;
+default value is
+.Cm false .
+Each tab is expanded to 8 spaces.
+.It Va tandem
+.Pq Vt bool
+Use XON/XOFF flow control to throttle data from the remote host;
+abbreviated
+.Va ta .
+The default value is
+.Cm true
+unless the
+.Va nt
+capability has been specified in
+.Pa /etc/remote ,
+in which case the default value is
+.Cm false .
+.It Va verbose
+.Pq Vt bool
+Verbose mode; abbreviated
+.Va verb ;
+default is
+.Cm true .
+When verbose mode is enabled,
+.Nm
+prints messages while dialing, shows the current number of lines
+transferred during a file transfer operations, and more.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width indent
+.It Ev HOME
+The home directory to use for the
+.Ic ~c
+command.
+.It Ev HOST
+The default value for
+.Ar system-name
+if none is specified via the command line.
+.It Ev PHONES
+A path to a
+.Xr phones 5
+database.
+.It Ev REMOTE
+A system description, or an absolute path to a
+.Xr remote 5
+system description database.
+.It Ev SHELL
+The name of the shell to use for the
+.Ic ~!
+command; default value is
+.Dq Li /bin/sh .
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /var/spool/lock/LCK..*" -compact
+.It Pa ~/.tiprc
+initialization file
+.It Pa tip.record
+record file
+.It Pa /etc/phones
+default
+.Xr phones 5
+file
+.It Pa /etc/remote
+global
+.Xr remote 5
+database
+.It Pa /var/log/aculog
+line access log
+.It Pa /var/spool/lock/LCK..*
+lock file to avoid conflicts with
+.Xr uucp 1 Pq Pa ports/net/freebsd-uucp
+.El
+.Sh SEE ALSO
+.Xr cu 1 ,
+.Xr phones 5 ,
+.Xr remote 5
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
+.Sh BUGS
+The full set of variables is undocumented and should, probably, be
+pared down.
diff --git a/usr.bin/tip/tip/tip.c b/usr.bin/tip/tip/tip.c
new file mode 100644
index 0000000..066d679
--- /dev/null
+++ b/usr.bin/tip/tip/tip.c
@@ -0,0 +1,627 @@
+/* $OpenBSD: tip.c,v 1.30 2006/08/18 03:06:18 jason Exp $ */
+/* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: tip.c,v 1.30 2006/08/18 03:06:18 jason Exp $";
+#endif
+#endif /* not lint */
+
+/*
+ * tip - UNIX link to other systems
+ * tip [-v] [-speed] system-name
+ * or
+ * cu phone-number [-s speed] [-l line] [-a acu]
+ */
+#include "tip.h"
+#include "pathnames.h"
+
+int disc = TTYDISC; /* tip normally runs this way */
+char PNbuf[256]; /* This limits the size of a number */
+
+static void intprompt(int);
+static void tipin(void);
+static int escape(void);
+
+int
+main(int argc, char *argv[])
+{
+ char *sys = NOSTR, sbuf[12], *p;
+ int i;
+
+ /* XXX preserve previous braindamaged behavior */
+ setboolean(value(DC), TRUE);
+
+ gid = getgid();
+ egid = getegid();
+ uid = getuid();
+ euid = geteuid();
+ if (equal(__progname, "cu")) {
+ cumode = 1;
+ cumain(argc, argv);
+ goto cucommon;
+ }
+
+ if (argc > 4) {
+ fprintf(stderr, "usage: tip [-v] [-speed] [system-name]\n");
+ exit(1);
+ }
+ if (!isatty(0)) {
+ fprintf(stderr, "%s: must be interactive\n", __progname);
+ exit(1);
+ }
+
+ for (; argc > 1; argv++, argc--) {
+ if (argv[1][0] != '-')
+ sys = argv[1];
+ else switch (argv[1][1]) {
+
+ case 'v':
+ vflag++;
+ break;
+
+ case 'n':
+ noesc++;
+ break;
+
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ BR = atoi(&argv[1][1]);
+ break;
+
+ default:
+ fprintf(stderr, "%s: %s, unknown option\n", __progname,
+ argv[1]);
+ break;
+ }
+ }
+
+ if (sys == NOSTR)
+ goto notnumber;
+ if (isalpha(*sys))
+ goto notnumber;
+ /*
+ * System name is really a phone number...
+ * Copy the number then stomp on the original (in case the number
+ * is private, we don't want 'ps' or 'w' to find it).
+ */
+ if (strlen(sys) > sizeof PNbuf - 1) {
+ fprintf(stderr, "%s: phone number too long (max = %d bytes)\n",
+ __progname, (int)sizeof(PNbuf) - 1);
+ exit(1);
+ }
+ strlcpy(PNbuf, sys, sizeof PNbuf - 1);
+ for (p = sys; *p; p++)
+ *p = '\0';
+ PN = PNbuf;
+ (void)snprintf(sbuf, sizeof(sbuf), "tip%ld", BR);
+ sys = sbuf;
+
+notnumber:
+ (void)signal(SIGINT, cleanup);
+ (void)signal(SIGQUIT, cleanup);
+ (void)signal(SIGHUP, cleanup);
+ (void)signal(SIGTERM, cleanup);
+ (void)signal(SIGCHLD, SIG_DFL);
+
+ if ((i = hunt(sys)) == 0) {
+ printf("all ports busy\n");
+ exit(3);
+ }
+ if (i == -1) {
+ printf("link down\n");
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+ setbuf(stdout, NULL);
+ loginit();
+
+ /*
+ * Now that we have the logfile and the ACU open
+ * return to the real uid and gid. These things will
+ * be closed on exit. Swap real and effective uid's
+ * so we can get the original permissions back
+ * for removing the uucp lock.
+ */
+ user_uid();
+
+ /*
+ * Kludge, their's no easy way to get the initialization
+ * in the right order, so force it here
+ */
+ if ((PH = getenv("PHONES")) == NOSTR)
+ PH = _PATH_PHONES;
+ vinit(); /* init variables */
+ setparity("none"); /* set the parity table */
+
+ /*
+ * Hardwired connections require the
+ * line speed set before they make any transmissions
+ * (this is particularly true of things like a DF03-AC)
+ */
+ if (HW && ttysetup(number(value(BAUDRATE)))) {
+ fprintf(stderr, "%s: bad baud rate %ld\n", __progname,
+ number(value(BAUDRATE)));
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+ if ((p = con())) {
+ printf("\07%s\n[EOT]\n", p);
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(1);
+ }
+ if (!HW && ttysetup(number(value(BAUDRATE)))) {
+ fprintf(stderr, "%s: bad baud rate %ld\n", __progname,
+ number(value(BAUDRATE)));
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ exit(3);
+ }
+cucommon:
+ /*
+ * From here down the code is shared with
+ * the "cu" version of tip.
+ */
+
+ i = fcntl(FD, F_GETFL);
+ if (i == -1) {
+ perror("fcntl");
+ cleanup(0);
+ }
+ i = fcntl(FD, F_SETFL, i & ~O_NONBLOCK);
+ if (i == -1) {
+ perror("fcntl");
+ cleanup(0);
+ }
+
+ tcgetattr(0, &defterm);
+ gotdefterm = 1;
+ term = defterm;
+ term.c_lflag &= ~(ICANON|IEXTEN|ECHO);
+ term.c_iflag &= ~(INPCK|ICRNL);
+ term.c_oflag &= ~OPOST;
+ term.c_cc[VMIN] = 1;
+ term.c_cc[VTIME] = 0;
+ defchars = term;
+ term.c_cc[VINTR] = term.c_cc[VQUIT] = term.c_cc[VSUSP] =
+ term.c_cc[VDSUSP] = term.c_cc[VDISCARD] =
+ term.c_cc[VLNEXT] = _POSIX_VDISABLE;
+ raw();
+
+ pipe(fildes); pipe(repdes);
+ (void)signal(SIGALRM, timeout);
+
+ if (value(LINEDISC) != TTYDISC) {
+ int ld = (int)(intptr_t)value(LINEDISC);
+ ioctl(FD, TIOCSETD, &ld);
+ }
+
+ /*
+ * Everything's set up now:
+ * connection established (hardwired or dialup)
+ * line conditioned (baud rate, mode, etc.)
+ * internal data structures (variables)
+ * so, fork one process for local side and one for remote.
+ */
+ printf(cumode ? "Connected\r\n" : "\07connected\r\n");
+ tipin_pid = getpid();
+ if ((tipout_pid = fork()))
+ tipin();
+ else
+ tipout();
+ /*NOTREACHED*/
+ exit(0);
+}
+
+void
+cleanup(int signo)
+{
+ daemon_uid();
+ (void)uu_unlock(uucplock);
+ if (odisc)
+ ioctl(0, TIOCSETD, &odisc);
+ unraw();
+ if (signo && tipout_pid) {
+ kill(tipout_pid, signo);
+ wait(NULL);
+ }
+ exit(0);
+}
+
+/*
+ * Muck with user ID's. We are setuid to the owner of the lock
+ * directory when we start. user_uid() reverses real and effective
+ * ID's after startup, to run with the user's permissions.
+ * daemon_uid() switches back to the privileged uid for unlocking.
+ * Finally, to avoid running a shell with the wrong real uid,
+ * shell_uid() sets real and effective uid's to the user's real ID.
+ */
+static int uidswapped;
+
+void
+user_uid(void)
+{
+ if (uidswapped == 0) {
+ seteuid(uid);
+ uidswapped = 1;
+ }
+}
+
+void
+daemon_uid(void)
+{
+
+ if (uidswapped) {
+ seteuid(euid);
+ uidswapped = 0;
+ }
+}
+
+void
+shell_uid(void)
+{
+ setegid(gid);
+ seteuid(uid);
+}
+
+/*
+ * put the controlling keyboard into raw mode
+ */
+void
+raw(void)
+{
+ tcsetattr(0, TCSADRAIN, &term);
+}
+
+
+/*
+ * return keyboard to normal mode
+ */
+void
+unraw(void)
+{
+ if (gotdefterm)
+ tcsetattr(0, TCSADRAIN, &defterm);
+}
+
+/*
+ * give up exclusive tty access
+ */
+void
+unexcl()
+{
+ ioctl(FD, TIOCNXCL, 0);
+}
+
+static jmp_buf promptbuf;
+
+/*
+ * Print string ``s'', then read a string
+ * in from the terminal. Handles signals & allows use of
+ * normal erase and kill characters.
+ */
+int
+prompt(char *s, char *p, size_t sz)
+{
+ int c;
+ char *b = p;
+ sig_t oint, oquit;
+
+ stoprompt = 0;
+ oint = signal(SIGINT, intprompt);
+ oquit = signal(SIGQUIT, SIG_IGN);
+ unraw();
+ printf("%s", s);
+ if (setjmp(promptbuf) == 0)
+ while ((c = getchar()) != EOF && (*p = c) != '\n' && --sz > 0)
+ p++;
+ *p = '\0';
+
+ raw();
+ (void)signal(SIGINT, oint);
+ (void)signal(SIGQUIT, oquit);
+ return (stoprompt || p == b);
+}
+
+/*
+ * Interrupt service routine during prompting
+ */
+/*ARGSUSED*/
+static void
+intprompt(int signo)
+{
+ (void)signal(SIGINT, SIG_IGN);
+ stoprompt = 1;
+ printf("\r\n");
+ longjmp(promptbuf, 1);
+}
+
+/*
+ * ****TIPIN TIPIN****
+ */
+static void
+tipin(void)
+{
+ int bol = 1;
+ int gch;
+ char ch;
+
+ /*
+ * Kinda klugey here...
+ * check for scripting being turned on from the .tiprc file,
+ * but be careful about just using setscript(), as we may
+ * send a SIGEMT before tipout has a chance to set up catching
+ * it; so wait a second, then setscript()
+ */
+ if (boolean(value(SCRIPT))) {
+ sleep(1);
+ setscript();
+ }
+
+ while (1) {
+ gch = getchar()&STRIP_PAR;
+ /* XXX does not check for EOF */
+ if ((gch == character(value(ESCAPE))) && bol) {
+ if (!noesc) {
+ if (!(gch = escape()))
+ continue;
+ }
+ } else if (!cumode && gch == character(value(RAISECHAR))) {
+ setboolean(value(RAISE), !boolean(value(RAISE)));
+ continue;
+ } else if (gch == '\r') {
+ bol = 1;
+ ch = gch;
+ parwrite(FD, &ch, 1);
+ if (boolean(value(HALFDUPLEX)))
+ printf("\r\n");
+ continue;
+ } else if (!cumode && gch == character(value(FORCE)))
+ gch = getchar()&STRIP_PAR;
+ bol = any(gch, value(EOL));
+ if (boolean(value(RAISE)) && islower(gch))
+ gch = toupper(gch);
+ ch = gch;
+ parwrite(FD, &ch, 1);
+ if (boolean(value(HALFDUPLEX)))
+ printf("%c", ch);
+ }
+}
+
+extern esctable_t etable[];
+
+/*
+ * Escape handler --
+ * called on recognition of ``escapec'' at the beginning of a line
+ */
+static int
+escape(void)
+{
+ int gch;
+ esctable_t *p;
+ char c = character(value(ESCAPE));
+
+ gch = (getchar()&STRIP_PAR);
+ /* XXX does not check for EOF */
+ for (p = etable; p->e_char; p++)
+ if (p->e_char == gch) {
+ if ((p->e_flags&PRIV) && uid)
+ continue;
+ printf("%s", ctrl(c));
+ (*p->e_func)(gch);
+ return (0);
+ }
+ /* ESCAPE ESCAPE forces ESCAPE */
+ if (c != gch)
+ parwrite(FD, &c, 1);
+ return (gch);
+}
+
+int
+any(int cc, char *p)
+{
+ char c = cc;
+ while (p && *p)
+ if (*p++ == c)
+ return (1);
+ return (0);
+}
+
+size_t
+size(char *s)
+{
+ size_t i = 0;
+
+ while (s && *s++)
+ i++;
+ return (i);
+}
+
+char *
+interp(char *s)
+{
+ static char buf[256];
+ char *p = buf, c, *q;
+
+ while ((c = *s++)) {
+ for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++)
+ if (*q++ == c) {
+ *p++ = '\\'; *p++ = *q;
+ goto next;
+ }
+ if (c < 040) {
+ *p++ = '^'; *p++ = c + 'A'-1;
+ } else if (c == 0177) {
+ *p++ = '^'; *p++ = '?';
+ } else
+ *p++ = c;
+ next:
+ ;
+ }
+ *p = '\0';
+ return (buf);
+}
+
+char *
+ctrl(char c)
+{
+ static char s[3];
+
+ if (c < 040 || c == 0177) {
+ s[0] = '^';
+ s[1] = c == 0177 ? '?' : c+'A'-1;
+ s[2] = '\0';
+ } else {
+ s[0] = c;
+ s[1] = '\0';
+ }
+ return (s);
+}
+
+/*
+ * Help command
+ */
+void
+help(int c)
+{
+ esctable_t *p;
+
+ printf("%c\r\n", c);
+ for (p = etable; p->e_char; p++) {
+ if ((p->e_flags&PRIV) && uid)
+ continue;
+ printf("%2s", ctrl(character(value(ESCAPE))));
+ printf("%-2s %c %s\r\n", ctrl(p->e_char),
+ p->e_flags&EXP ? '*': ' ', p->e_help);
+ }
+}
+
+/*
+ * Set up the "remote" tty's state
+ */
+int
+ttysetup(int speed)
+{
+ struct termios cntrl;
+
+ if (tcgetattr(FD, &cntrl))
+ return (-1);
+ cfsetspeed(&cntrl, speed);
+ cntrl.c_cflag &= ~(CSIZE|PARENB);
+ cntrl.c_cflag |= CS8;
+ if (boolean(value(DC)))
+ cntrl.c_cflag |= CLOCAL;
+ if (boolean(value(HARDWAREFLOW)))
+ cntrl.c_cflag |= CRTSCTS;
+ cntrl.c_iflag &= ~(ISTRIP|ICRNL);
+ cntrl.c_oflag &= ~OPOST;
+ cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);
+ cntrl.c_cc[VMIN] = 1;
+ cntrl.c_cc[VTIME] = 0;
+ if (boolean(value(TAND)))
+ cntrl.c_iflag |= IXOFF;
+ return (tcsetattr(FD, TCSAFLUSH, &cntrl));
+}
+
+static char partab[0200];
+
+/*
+ * Do a write to the remote machine with the correct parity.
+ * We are doing 8 bit wide output, so we just generate a character
+ * with the right parity and output it.
+ */
+void
+parwrite(int fd, char *buf, size_t n)
+{
+ size_t i;
+ char *bp;
+
+ bp = buf;
+ if (bits8 == 0)
+ for (i = 0; i < n; i++) {
+ *bp = partab[(*bp) & 0177];
+ bp++;
+ }
+ if (write(fd, buf, n) < 0) {
+ if (errno == EIO || errno == ENXIO)
+ tipabort("Lost carrier.");
+ /* this is questionable */
+ perror("write");
+ }
+}
+
+/*
+ * Build a parity table with appropriate high-order bit.
+ */
+void
+setparity(char *defparity)
+{
+ int i, flip, clr, set;
+ char *parity;
+ extern const unsigned char evenpartab[];
+
+ if (value(PARITY) == NOSTR)
+ value(PARITY) = defparity;
+ parity = value(PARITY);
+ if (equal(parity, "none")) {
+ bits8 = 1;
+ return;
+ }
+ bits8 = 0;
+ flip = 0;
+ clr = 0377;
+ set = 0;
+ if (equal(parity, "odd"))
+ flip = 0200; /* reverse bit 7 */
+ else if (equal(parity, "zero"))
+ clr = 0177; /* turn off bit 7 */
+ else if (equal(parity, "one"))
+ set = 0200; /* turn on bit 7 */
+ else if (!equal(parity, "even")) {
+ (void) fprintf(stderr, "%s: unknown parity value\r\n", parity);
+ (void) fflush(stderr);
+ }
+ for (i = 0; i < 0200; i++)
+ partab[i] = ((evenpartab[i] ^ flip) | set) & clr;
+}
diff --git a/usr.bin/tip/tip/tip.h b/usr.bin/tip/tip/tip.h
new file mode 100644
index 0000000..7e7faa6
--- /dev/null
+++ b/usr.bin/tip/tip/tip.h
@@ -0,0 +1,354 @@
+/* $OpenBSD: tip.h,v 1.27 2006/08/18 03:06:18 jason Exp $ */
+/* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Copyright (c) 1989, 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.
+ * 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.
+ *
+ * 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.
+ *
+ * @(#)tip.h 8.1 (Berkeley) 6/6/93
+ */
+
+/*
+ * tip - terminal interface program
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+
+#include <termios.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <setjmp.h>
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+
+/*
+ * Remote host attributes
+ */
+char *DV; /* UNIX device(s) to open */
+char *EL; /* chars marking an EOL */
+char *CM; /* initial connection message */
+char *IE; /* EOT to expect on input */
+char *OE; /* EOT to send to complete FT */
+char *CU; /* call unit if making a phone call */
+char *AT; /* acu type */
+char *PN; /* phone number(s) */
+char *DI; /* disconnect string */
+char *PA; /* parity to be generated */
+
+char *PH; /* phone number file */
+char *RM; /* remote file name */
+char *HO; /* host name */
+
+long BR; /* line speed for conversation */
+long FS; /* frame size for transfers */
+
+short DU; /* this host is dialed up */
+short HW; /* this device is hardwired, see hunt.c */
+char *ES; /* escape character */
+char *EX; /* exceptions */
+char *FO; /* force (literal next) char*/
+char *RC; /* raise character */
+char *RE; /* script record file */
+char *PR; /* remote prompt */
+long DL; /* line delay for file transfers to remote */
+long CL; /* char delay for file transfers to remote */
+long ET; /* echocheck timeout */
+long LD; /* line disc */
+short HD; /* this host is half duplex - do local echo */
+
+/*
+ * String value table
+ */
+typedef
+ struct {
+ char *v_name; /* whose name is it */
+ char v_type; /* for interpreting set's */
+ char v_access; /* protection of touchy ones */
+ char *v_abrev; /* possible abbreviation */
+ char *v_value; /* casted to a union later */
+ }
+ value_t;
+
+#define STRING 01 /* string valued */
+#define BOOL 02 /* true-false value */
+#define NUMBER 04 /* numeric value */
+#define CHAR 010 /* character value */
+
+#define WRITE 01 /* write access to variable */
+#define READ 02 /* read access */
+
+#define CHANGED 01 /* low bit is used to show modification */
+#define PUBLIC 1 /* public access rights */
+#define PRIVATE 03 /* private to definer */
+#define ROOT 05 /* root defined */
+
+#define TRUE 1
+#define FALSE 0
+
+#define ENVIRON 020 /* initialize out of the environment */
+#define IREMOTE 040 /* initialize out of remote structure */
+#define INIT 0100 /* static data space used for initialization */
+#define TMASK 017
+
+/*
+ * Definition of ACU line description
+ */
+typedef
+ struct {
+ char *acu_name;
+ int (*acu_dialer)(char *, char *);
+ void (*acu_disconnect)(void);
+ void (*acu_abort)(void);
+ }
+ acu_t;
+
+#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
+
+/*
+ * variable manipulation stuff --
+ * if we defined the value entry in value_t, then we couldn't
+ * initialize it in vars.c, so we cast it as needed to keep lint
+ * happy.
+ */
+
+#define value(v) vtable[v].v_value
+#define lvalue(v) (long)vtable[v].v_value
+
+#define number(v) ((long)(v))
+#define boolean(v) ((short)(long)(v))
+#define character(v) ((char)(long)(v))
+#define address(v) ((long *)(v))
+
+#define setnumber(v,n) do { (v) = (char *)(long)(n); } while (0)
+#define setboolean(v,n) do { (v) = (char *)(long)(n); } while (0)
+#define setcharacter(v,n) do { (v) = (char *)(long)(n); } while (0)
+#define setaddress(v,n) do { (v) = (char *)(n); } while (0)
+
+/*
+ * Escape command table definitions --
+ * lookup in this table is performed when ``escapec'' is recognized
+ * at the beginning of a line (as defined by the eolmarks variable).
+*/
+
+typedef
+ struct {
+ char e_char; /* char to match on */
+ char e_flags; /* experimental, privileged */
+ char *e_help; /* help string */
+ void (*e_func)(int); /* command */
+ }
+ esctable_t;
+
+#define NORM 00 /* normal protection, execute anyone */
+#define EXP 01 /* experimental, mark it with a `*' on help */
+#define PRIV 02 /* privileged, root execute only */
+
+extern int vflag; /* verbose during reading of .tiprc file */
+extern int noesc; /* no escape `~' char */
+extern value_t vtable[]; /* variable table */
+
+#ifndef ACULOG
+#define logent(a, b, c, d)
+#define loginit()
+#endif
+
+/*
+ * Definition of indices into variable table so
+ * value(DEFINE) turns into a static address.
+ */
+
+#define BEAUTIFY 0
+#define BAUDRATE 1
+#define DIALTIMEOUT 2
+#define EOFREAD 3
+#define EOFWRITE 4
+#define EOL 5
+#define ESCAPE 6
+#define EXCEPTIONS 7
+#define FORCE 8
+#define FRAMESIZE 9
+#define HOST 10
+#define LOG 11
+#define PHONES 12
+#define PROMPT 13
+#define RAISE 14
+#define RAISECHAR 15
+#define RECORD 16
+#define REMOTE 17
+#define SCRIPT 18
+#define TABEXPAND 19
+#define VERBOSE 20
+#define SHELL 21
+#define HOME 22
+#define ECHOCHECK 23
+#define DISCONNECT 24
+#define TAND 25
+#define LDELAY 26
+#define CDELAY 27
+#define ETIMEOUT 28
+#define RAWFTP 29
+#define HALFDUPLEX 30
+#define LECHO 31
+#define PARITY 32
+#define HARDWAREFLOW 33
+#define LINEDISC 34
+#define DC 35
+
+#define NOVAL ((value_t *)NULL)
+#define NOACU ((acu_t *)NULL)
+#define NOSTR ((char *)NULL)
+#define NOFILE ((FILE *)NULL)
+#define NOPWD ((struct passwd *)0)
+
+struct termios term; /* current mode of terminal */
+struct termios defterm; /* initial mode of terminal */
+struct termios defchars; /* current mode with initial chars */
+int gotdefterm;
+
+FILE *fscript; /* FILE for scripting */
+
+int fildes[2]; /* file transfer synchronization channel */
+int repdes[2]; /* read process sychronization channel */
+int FD; /* open file descriptor to remote host */
+int AC; /* open file descriptor to dialer (v831 only) */
+int vflag; /* print .tiprc initialization sequence */
+int noesc; /* no `~' escape char */
+int sfd; /* for ~< operation */
+pid_t tipin_pid; /* pid of tipin */
+pid_t tipout_pid; /* pid of tipout */
+uid_t uid, euid; /* real and effective user id's */
+gid_t gid, egid; /* real and effective group id's */
+int stop; /* stop transfer session flag */
+int quit; /* same; but on other end */
+int intflag; /* recognized interrupt */
+int stoprompt; /* for interrupting a prompt session */
+int timedout; /* ~> transfer timedout */
+int cumode; /* simulating the "cu" program */
+int bits8; /* terminal is 8-bit mode */
+#define STRIP_PAR (bits8 ? 0377 : 0177)
+
+char fname[PATH_MAX]; /* file name buffer for ~< */
+char copyname[PATH_MAX]; /* file name buffer for ~> */
+char ccc; /* synchronization character */
+char *uucplock; /* name of lock file for uucp's */
+
+int odisc; /* initial tty line discipline */
+extern int disc; /* current tty discpline */
+
+extern char *__progname; /* program name */
+
+char *con(void);
+char *ctrl(char);
+char *expand(char *);
+char *getremote(char *);
+char *interp(char *);
+int any(int, char *);
+int biz22w_dialer(char *, char *);
+int biz22f_dialer(char *, char *);
+int biz31w_dialer(char *, char *);
+int biz31f_dialer(char *, char *);
+int cour_dialer(char *, char *);
+int df02_dialer(char *, char *);
+int df03_dialer(char *, char *);
+int dn_dialer(char *, char *);
+int hay_dialer(char *, char *);
+int prompt(char *, char *, size_t);
+size_t size(char *);
+int t3000_dialer(char *, char *);
+int ttysetup(int);
+int uu_lock(char *);
+int uu_unlock(char *);
+int v3451_dialer(char *, char *);
+int v831_dialer(char *, char *);
+int ven_dialer(char *, char *);
+int vstring(char *, char *);
+long hunt(char *);
+void biz22_disconnect(void);
+void biz22_abort(void);
+void biz31_disconnect(void);
+void biz31_abort(void);
+void chdirectory(int);
+void cleanup(int);
+void consh(int);
+void cour_abort(void);
+void cour_disconnect(void);
+void cu_put(int);
+void cu_take(int);
+void cumain(int, char **);
+void daemon_uid(void);
+void df_abort(void);
+void df_disconnect(void);
+void disconnect(char *);
+void dn_abort(void);
+void dn_disconnect(void);
+void finish(int);
+void genbrk(int);
+void getfl(int);
+void hay_abort(void);
+void hay_disconnect(void);
+void help(int);
+void listvariables(int);
+void logent(char *, char *, char *, char *);
+void loginit(void);
+void parwrite(int, char *, size_t);
+void pipefile(int);
+void pipeout(int);
+void raw(void);
+void sendfile(int);
+void setparity(char *);
+void setscript(void);
+void shell(int);
+void shell_uid(void);
+void suspend(int);
+void t3000_disconnect(void);
+void t3000_abort(void);
+void timeout(int);
+void tipabort(char *);
+void tipout(void);
+void user_uid(void);
+void unexcl(void);
+void unraw(void);
+void v3451_abort(void);
+void v3451_disconnect(void);
+void v831_disconnect(void);
+void v831_abort(void);
+void variable(int);
+void ven_disconnect(void);
+void ven_abort(void);
+void vinit(void);
+void vlex(char *);
diff --git a/usr.bin/tip/tip/tipout.c b/usr.bin/tip/tip/tipout.c
new file mode 100644
index 0000000..db6afe4
--- /dev/null
+++ b/usr.bin/tip/tip/tipout.c
@@ -0,0 +1,188 @@
+/* $OpenBSD: tipout.c,v 1.18 2006/05/31 07:03:08 jason Exp $ */
+/* $NetBSD: tipout.c,v 1.5 1996/12/29 10:34:12 cgd Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: tipout.c,v 1.18 2006/05/31 07:03:08 jason Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+/*
+ * tip
+ *
+ * lower fork of tip -- handles passive side
+ * reading from the remote host
+ */
+
+static jmp_buf sigbuf;
+
+static void intIOT(int);
+static void intEMT(int);
+static void intTERM(int);
+static void intSYS(int);
+
+/*
+ * TIPOUT wait state routine --
+ * sent by TIPIN when it wants to posses the remote host
+ */
+/*ARGSUSED*/
+static void
+intIOT(int signo)
+{
+ write(repdes[1],&ccc,1);
+ read(fildes[0], &ccc,1);
+ longjmp(sigbuf, 1);
+}
+
+/*
+ * Scripting command interpreter --
+ * accepts script file name over the pipe and acts accordingly
+ */
+/*ARGSUSED*/
+static void
+intEMT(int signo)
+{
+ char c, line[256];
+ char *pline = line;
+ char reply;
+
+ read(fildes[0], &c, 1);
+ while (c != '\n' && (size_t)(pline - line) < sizeof(line)) {
+ *pline++ = c;
+ read(fildes[0], &c, 1);
+ }
+ *pline = '\0';
+ if (boolean(value(SCRIPT)) && fscript != NULL)
+ fclose(fscript);
+ if (pline == line) {
+ setboolean(value(SCRIPT), FALSE);
+ reply = 'y';
+ } else {
+ if ((fscript = fopen(line, "a")) == NULL)
+ reply = 'n';
+ else {
+ reply = 'y';
+ setboolean(value(SCRIPT), TRUE);
+ }
+ }
+ write(repdes[1], &reply, 1);
+ longjmp(sigbuf, 1);
+}
+
+static void
+intTERM(int signo)
+{
+ if (boolean(value(SCRIPT)) && fscript != NULL)
+ fclose(fscript);
+ if (signo && tipin_pid)
+ kill(tipin_pid, signo);
+ exit(0);
+}
+
+/*ARGSUSED*/
+static void
+intSYS(int signo)
+{
+ setboolean(value(BEAUTIFY), !boolean(value(BEAUTIFY)));
+ longjmp(sigbuf, 1);
+}
+
+/*
+ * ****TIPOUT TIPOUT****
+ */
+void
+tipout(void)
+{
+ char buf[BUFSIZ];
+ char *cp;
+ ssize_t scnt;
+ size_t cnt;
+ sigset_t mask, omask;
+
+ signal(SIGINT, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ signal(SIGEMT, intEMT); /* attention from TIPIN */
+ signal(SIGTERM, intTERM); /* time to go signal */
+ signal(SIGIOT, intIOT); /* scripting going on signal */
+ signal(SIGHUP, intTERM); /* for dial-ups */
+ signal(SIGSYS, intSYS); /* beautify toggle */
+ (void) setjmp(sigbuf);
+ sigprocmask(SIG_BLOCK, NULL, &omask);
+ for (;;) {
+ sigprocmask(SIG_SETMASK, &omask, NULL);
+ scnt = read(FD, buf, BUFSIZ);
+ if (scnt <= 0) {
+ /* lost carrier */
+ if (scnt == 0 ||
+ (scnt < 0 && (errno == EIO || errno == ENXIO))) {
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGTERM);
+ sigprocmask(SIG_BLOCK, &mask, NULL);
+ intTERM(SIGHUP);
+ /*NOTREACHED*/
+ }
+ continue;
+ }
+ cnt = scnt;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGEMT);
+ sigaddset(&mask, SIGTERM);
+ sigaddset(&mask, SIGIOT);
+ sigaddset(&mask, SIGSYS);
+ sigprocmask(SIG_BLOCK, &mask, NULL);
+ for (cp = buf; cp < buf + cnt; cp++)
+ *cp &= STRIP_PAR;
+ write(STDOUT_FILENO, buf, cnt);
+ if (boolean(value(SCRIPT)) && fscript != NULL) {
+ if (!boolean(value(BEAUTIFY))) {
+ fwrite(buf, 1, cnt, fscript);
+ } else {
+ for (cp = buf; cp < buf + cnt; cp++)
+ if ((*cp >= ' ' && *cp <= '~') ||
+ any(*cp, value(EXCEPTIONS)))
+ putc(*cp, fscript);
+ }
+ for (cp = buf; cp < buf + cnt; cp++) {
+ if (!isgraph(*cp)) {
+ fflush(fscript);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/usr.bin/tip/tip/uucplock.c b/usr.bin/tip/tip/uucplock.c
new file mode 100644
index 0000000..c82ea78
--- /dev/null
+++ b/usr.bin/tip/tip/uucplock.c
@@ -0,0 +1,131 @@
+/* $OpenBSD: uucplock.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */
+/* $NetBSD: uucplock.c,v 1.7 1997/02/11 09:24:08 mrg Exp $ */
+
+/*
+ * Copyright (c) 1988, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: uucplock.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $";
+#endif
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/dirent.h>
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include "tip.h"
+#include "pathnames.h"
+
+/*
+ * uucp style locking routines
+ * return: 0 - success
+ * -1 - failure
+ */
+
+int
+uu_lock(char *ttyname)
+{
+ int fd, len;
+ char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
+ char text_pid[81];
+ pid_t pid;
+
+ (void)snprintf(tbuf, sizeof tbuf, _PATH_LOCKDIRNAME, ttyname);
+ fd = open(tbuf, O_RDWR|O_CREAT|O_EXCL, 0660);
+ if (fd < 0) {
+ /*
+ * file is already locked
+ * check to see if the process holding the lock still exists
+ */
+ fd = open(tbuf, O_RDWR, 0);
+ if (fd < 0) {
+ perror(tbuf);
+ fprintf(stderr, "Can't open lock file.\n");
+ return(-1);
+ }
+ len = read(fd, text_pid, sizeof(text_pid)-1);
+ if (len<=0) {
+ perror(tbuf);
+ (void)close(fd);
+ fprintf(stderr, "Can't read lock file.\n");
+ return(-1);
+ }
+ text_pid[len] = 0;
+ pid = atol(text_pid);
+
+ if (kill(pid, 0) == 0 || errno != ESRCH) {
+ (void)close(fd); /* process is still running */
+ return(-1);
+ }
+ /*
+ * The process that locked the file isn't running, so
+ * we'll lock it ourselves
+ */
+ fprintf(stderr, "Stale lock on %s PID=%ld... overriding.\n",
+ ttyname, (long)pid);
+ if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
+ perror(tbuf);
+ (void)close(fd);
+ fprintf(stderr, "Can't seek lock file.\n");
+ return(-1);
+ }
+ /* fall out and finish the locking process */
+ }
+ pid = getpid();
+ (void)snprintf(text_pid, sizeof text_pid, "%10ld\n", (long)pid);
+ len = strlen(text_pid);
+ if (write(fd, text_pid, len) != len) {
+ (void)close(fd);
+ (void)unlink(tbuf);
+ perror("lock write");
+ return(-1);
+ }
+ (void)close(fd);
+ return(0);
+}
+
+int
+uu_unlock(char *ttyname)
+{
+ char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
+
+ (void)snprintf(tbuf, sizeof tbuf, _PATH_LOCKDIRNAME, ttyname);
+ unexcl();
+ return(unlink(tbuf));
+}
diff --git a/usr.bin/tip/tip/value.c b/usr.bin/tip/tip/value.c
new file mode 100644
index 0000000..b6cf5c2
--- /dev/null
+++ b/usr.bin/tip/tip/value.c
@@ -0,0 +1,349 @@
+/* $OpenBSD: value.c,v 1.14 2006/03/17 22:02:58 moritz Exp $ */
+/* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: value.c,v 1.14 2006/03/17 22:02:58 moritz Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+
+#define MIDDLE 35
+
+static value_t *vlookup(char *);
+static void vassign(value_t *, char *);
+static void vtoken(char *);
+static void vprint(value_t *);
+static int vaccess(unsigned int, unsigned int);
+static char *vinterp(char *, int);
+
+static size_t col = 0;
+
+/*
+ * Variable manipulation
+ */
+void
+vinit(void)
+{
+ char file[FILENAME_MAX], *cp;
+ value_t *p;
+ FILE *fp;
+
+ for (p = vtable; p->v_name != NULL; p++) {
+ if (p->v_type&ENVIRON)
+ if ((cp = getenv(p->v_name)))
+ p->v_value = cp;
+ if (p->v_type&IREMOTE)
+ setnumber(p->v_value, *address(p->v_value));
+ }
+ /*
+ * Read the .tiprc file in the HOME directory
+ * for sets
+ */
+ cp = value(HOME);
+ if (cp == NULL) {
+ (void)fprintf(stderr,
+ "$HOME not set. Skipping check for ~/.tiprc\n");
+ } else if (strlen(cp) + sizeof("/.tiprc") > sizeof(file)) {
+ (void)fprintf(stderr, "Home directory path too long: %s\n",
+ value(HOME));
+ } else {
+ snprintf(file, sizeof file, "%s/.tiprc", value(HOME));
+ if ((fp = fopen(file, "r")) != NULL) {
+ char *tp;
+
+ while (fgets(file, sizeof(file)-1, fp) != NULL) {
+ if (vflag)
+ printf("set %s", file);
+ if ((tp = strrchr(file, '\n')))
+ *tp = '\0';
+ vlex(file);
+ }
+ fclose(fp);
+ }
+ }
+ /*
+ * To allow definition of exception prior to fork
+ */
+ vtable[EXCEPTIONS].v_access &= ~(WRITE<<PUBLIC);
+}
+
+/*VARARGS1*/
+static void
+vassign(value_t *p, char *v)
+{
+ if (!vaccess(p->v_access, WRITE)) {
+ printf("access denied\r\n");
+ return;
+ }
+
+ switch (p->v_type&TMASK) {
+ case STRING:
+ if (p->v_value && equal(p->v_value, v))
+ return;
+ if (!(p->v_type&(ENVIRON|INIT)))
+ free(p->v_value);
+ if ((p->v_value = strdup(v)) == NOSTR) {
+ printf("out of core\r\n");
+ return;
+ }
+ p->v_type &= ~(ENVIRON|INIT);
+ break;
+ case NUMBER:
+ if (number(p->v_value) == number(v))
+ return;
+ setnumber(p->v_value, number(v));
+ break;
+ case BOOL:
+ if (boolean(p->v_value) == (*v != '!'))
+ return;
+ setboolean(p->v_value, (*v != '!'));
+ break;
+ case CHAR:
+ if (character(p->v_value) == *v)
+ return;
+ setcharacter(p->v_value, *v);
+ }
+ p->v_access |= CHANGED;
+}
+
+void
+vlex(char *s)
+{
+ value_t *p;
+ char *cp;
+
+ if (equal(s, "all")) {
+ for (p = vtable; p->v_name; p++)
+ if (vaccess(p->v_access, READ))
+ vprint(p);
+ } else {
+ do {
+ if ((cp = vinterp(s, ' ')))
+ cp++;
+ vtoken(s);
+ s = cp;
+ } while (s);
+ }
+ if (col > 0) {
+ printf("\r\n");
+ col = 0;
+ }
+}
+
+static void
+vtoken(char *s)
+{
+ value_t *p;
+ char *cp;
+
+ if ((cp = strchr(s, '='))) {
+ *cp = '\0';
+ if ((p = vlookup(s))) {
+ cp++;
+ if (p->v_type&NUMBER)
+ vassign(p, (char *)(intptr_t)atoi(cp));
+ else {
+ if (strcmp(s, "record") == 0)
+ cp = expand(cp);
+ vassign(p, cp);
+ }
+ return;
+ }
+ } else if ((cp = strchr(s, '?'))) {
+ *cp = '\0';
+ if ((p = vlookup(s)) && vaccess(p->v_access, READ)) {
+ vprint(p);
+ return;
+ }
+ } else {
+ if (*s != '!')
+ p = vlookup(s);
+ else
+ p = vlookup(s+1);
+ if (p != NOVAL) {
+ vassign(p, s);
+ return;
+ }
+ }
+ printf("%s: unknown variable\r\n", s);
+}
+
+static void
+vprint(value_t *p)
+{
+ char *cp;
+
+ if (col > 0 && col < MIDDLE)
+ while (col++ < MIDDLE)
+ putchar(' ');
+ col += size(p->v_name);
+ switch (p->v_type&TMASK) {
+
+ case BOOL:
+ if (boolean(p->v_value) == FALSE) {
+ col++;
+ putchar('!');
+ }
+ printf("%s", p->v_name);
+ break;
+
+ case STRING:
+ printf("%s=", p->v_name);
+ col++;
+ if (p->v_value) {
+ cp = interp(p->v_value);
+ col += size(cp);
+ printf("%s", cp);
+ }
+ break;
+
+ case NUMBER:
+ col += 6;
+ printf("%s=%-5ld", p->v_name, number(p->v_value));
+ break;
+
+ case CHAR:
+ printf("%s=", p->v_name);
+ col++;
+ if (p->v_value) {
+ cp = ctrl(character(p->v_value));
+ col += size(cp);
+ printf("%s", cp);
+ }
+ break;
+ }
+ if (col >= MIDDLE) {
+ col = 0;
+ printf("\r\n");
+ return;
+ }
+}
+
+static int
+vaccess(unsigned int mode, unsigned int rw)
+{
+ if (mode & (rw<<PUBLIC))
+ return (1);
+ if (mode & (rw<<PRIVATE))
+ return (1);
+ return ((mode & (rw<<ROOT)) && getuid() == 0);
+}
+
+static value_t *
+vlookup(char *s)
+{
+ value_t *p;
+
+ for (p = vtable; p->v_name; p++)
+ if (equal(p->v_name, s) || (p->v_abrev && equal(p->v_abrev, s)))
+ return (p);
+ return (NULL);
+}
+
+static char *
+vinterp(char *s, int stop)
+{
+ char *p = s, c;
+ int num;
+
+ while ((c = *s++) && c != stop) {
+ switch (c) {
+
+ case '^':
+ if (*s)
+ *p++ = *s++ - 0100;
+ else
+ *p++ = c;
+ break;
+
+ case '\\':
+ num = 0;
+ c = *s++;
+ if (c >= '0' && c <= '7')
+ num = (num<<3)+(c-'0');
+ else {
+ char *q = "n\nr\rt\tb\bf\f";
+
+ for (; *q; q++)
+ if (c == *q++) {
+ *p++ = *q;
+ goto cont;
+ }
+ *p++ = c;
+ cont:
+ break;
+ }
+ if ((c = *s++) >= '0' && c <= '7') {
+ num = (num<<3)+(c-'0');
+ if ((c = *s++) >= '0' && c <= '7')
+ num = (num<<3)+(c-'0');
+ else
+ s--;
+ } else
+ s--;
+ *p++ = num;
+ break;
+
+ default:
+ *p++ = c;
+ }
+ }
+ *p = '\0';
+ return (c == stop ? s-1 : NULL);
+}
+
+/*
+ * assign variable s with value v (for NUMBER or STRING or CHAR types)
+ */
+int
+vstring(char *s, char *v)
+{
+ value_t *p;
+
+ p = vlookup(s);
+ if (p == 0)
+ return (1);
+ if (p->v_type&NUMBER)
+ vassign(p, (char *)(intptr_t)atoi(v));
+ else {
+ if (strcmp(s, "record") == 0)
+ v = expand(v);
+ vassign(p, v);
+ }
+ return (0);
+}
diff --git a/usr.bin/tip/tip/vars.c b/usr.bin/tip/tip/vars.c
new file mode 100644
index 0000000..a991bcc
--- /dev/null
+++ b/usr.bin/tip/tip/vars.c
@@ -0,0 +1,124 @@
+/* $OpenBSD: vars.c,v 1.8 2006/08/18 03:06:18 jason Exp $ */
+/* $NetBSD: vars.c,v 1.3 1994/12/08 09:31:19 jtc Exp $ */
+
+/*
+ * Copyright (c) 1983, 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
+static const char rcsid[] = "$OpenBSD: vars.c,v 1.8 2006/08/18 03:06:18 jason Exp $";
+#endif
+#endif /* not lint */
+
+#include "tip.h"
+#include "pathnames.h"
+
+/*
+ * Definition of variables
+ */
+value_t vtable[] = {
+ { "beautify", BOOL, (READ|WRITE)<<PUBLIC,
+ "be", (char *)TRUE },
+ { "baudrate", NUMBER|IREMOTE|INIT, (READ<<PUBLIC)|(WRITE<<ROOT),
+ "ba", (char *)&BR },
+ { "dialtimeout",NUMBER, (READ<<PUBLIC)|(WRITE<<ROOT),
+ "dial", (char *)60 },
+ { "eofread", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "eofr", (char *)&IE },
+ { "eofwrite", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "eofw", (char *)&OE },
+ { "eol", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ NOSTR, (char *)&EL },
+ { "escape", CHAR, (READ|WRITE)<<PUBLIC,
+ "es", (char *)'~' },
+ { "exceptions", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
+ "ex", (char *)&EX },
+ { "force", CHAR, (READ|WRITE)<<PUBLIC,
+ "fo", (char *)CTRL('p') },
+ { "framesize", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "fr", (char *)&FS },
+ { "host", STRING|IREMOTE|INIT, READ<<PUBLIC,
+ "ho", (char *)&HO },
+ { "log", STRING|INIT, (READ|WRITE)<<ROOT,
+ NOSTR, _PATH_ACULOG },
+ { "phones", STRING|INIT|IREMOTE, READ<<PUBLIC,
+ NOSTR, (char *)&PH },
+ { "prompt", CHAR, (READ|WRITE)<<PUBLIC,
+ "pr", (char *)'\n' },
+ { "raise", BOOL, (READ|WRITE)<<PUBLIC,
+ "ra", (char *)FALSE },
+ { "raisechar", CHAR, (READ|WRITE)<<PUBLIC,
+ "rc", NOSTR },
+ { "record", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
+ "rec", (char *)&RE },
+ { "remote", STRING|INIT|IREMOTE, READ<<PUBLIC,
+ NOSTR, (char *)&RM },
+ { "script", BOOL, (READ|WRITE)<<PUBLIC,
+ "sc", (char *)FALSE },
+ { "tabexpand", BOOL, (READ|WRITE)<<PUBLIC,
+ "tab", (char *)FALSE },
+ { "verbose", BOOL, (READ|WRITE)<<PUBLIC,
+ "verb", (char *)TRUE },
+ { "SHELL", STRING|ENVIRON|INIT, (READ|WRITE)<<PUBLIC,
+ NULL, _PATH_BSHELL },
+ { "HOME", STRING|ENVIRON, (READ|WRITE)<<PUBLIC,
+ NOSTR, NOSTR },
+ { "echocheck", BOOL, (READ|WRITE)<<PUBLIC,
+ "ec", (char *)FALSE },
+ { "disconnect", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "di", (char *)&DI },
+ { "tandem", BOOL, (READ|WRITE)<<PUBLIC,
+ "ta", (char *)TRUE },
+ { "linedelay", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "ldelay", (char *)&DL },
+ { "chardelay", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "cdelay", (char *)&CL },
+ { "etimeout", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "et", (char *)&ET },
+ { "rawftp", BOOL, (READ|WRITE)<<PUBLIC,
+ "raw", (char *)FALSE },
+ { "halfduplex", BOOL, (READ|WRITE)<<PUBLIC,
+ "hdx", (char *)FALSE },
+ { "localecho", BOOL, (READ|WRITE)<<PUBLIC,
+ "le", (char *)FALSE },
+ { "parity", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
+ "par", (char *)&PA },
+ { "hardwareflow", BOOL, (READ|WRITE)<<PUBLIC,
+ "hf", (char *)FALSE },
+ { "linedisc", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "ld", (char *)&LD },
+ { "direct", BOOL, (READ<<PUBLIC)|(WRITE<<ROOT),
+ "dc", (char *)FALSE },
+ { NOSTR, 0, 0,
+ NOSTR, NOSTR }
+};
diff --git a/usr.bin/top/Makefile b/usr.bin/top/Makefile
new file mode 100644
index 0000000..9e62b4f
--- /dev/null
+++ b/usr.bin/top/Makefile
@@ -0,0 +1,49 @@
+# $FreeBSD$
+
+TOPDIR= ${.CURDIR}/../../contrib/top
+.PATH: ${TOPDIR}
+
+PROG= top
+SRCS= commands.c display.c machine.c screen.c top.c \
+ username.c utils.c version.c
+SRCS+= sigdesc.h top.local.h
+CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER
+CFLAGS+= -I${.CURDIR} -I${TOPDIR} -I.
+
+WARNS?= 0
+
+#
+# The table size should be a prime number approximately twice as
+# large as the number of lines in /etc/passwd. The default number
+# is 20011; use /etc/make.conf to override this.
+#
+.if defined(TOP_TABLE_SIZE)
+CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
+.endif
+
+LIBADD= ncursesw m kvm jail
+
+CLEANFILES= sigdesc.h
+SIGCONV_AWK= ${.CURDIR}/../../contrib/top/sigconv.awk
+STAGED_INCLUDE_DIR?= ${DESTDIR}/usr/include
+SIGNAL_H= ${STAGED_INCLUDE_DIR}/sys/signal.h
+sigdesc.h: ${SIGCONV_AWK} ${SIGNAL_H}
+ awk -f ${SIGCONV_AWK} < ${SIGNAL_H} > ${.TARGET}
+
+CLEANFILES+= top.local.h top.x
+.SUFFIXES: .xs .x .hs .h
+.xs.x .hs.h:
+ @${ECHO} Making ${.TARGET} from ${.IMPSRC}
+ @sed -e's,%LoadMax%,5.0,g' \
+ -e's,%TableSize%,20011,g' \
+ -e's,%NominalTopn%,18,g' \
+ -e's,%topn%,-1,g' \
+ -e's,%delay%,2,g' \
+ -e's,%random%,1,g' \
+ ${.IMPSRC} > ${.TARGET}
+
+CLEANFILES+= top.1
+top.1: top.x top.local.1
+ cat ${.ALLSRC} > ${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/top/Makefile.depend b/usr.bin/top/Makefile.depend
new file mode 100644
index 0000000..fafa76b
--- /dev/null
+++ b/usr.bin/top/Makefile.depend
@@ -0,0 +1,23 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libjail \
+ lib/libkvm \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
new file mode 100644
index 0000000..92cd7c5
--- /dev/null
+++ b/usr.bin/top/machine.c
@@ -0,0 +1,1602 @@
+/*
+ * top - a top users display for Unix
+ *
+ * SYNOPSIS: For FreeBSD-2.x and later
+ *
+ * DESCRIPTION:
+ * Originally written for BSD4.4 system by Christos Zoulas.
+ * Ported to FreeBSD 2.x by Steven Wallace && Wolfram Schneider
+ * Order support hacked in from top-3.5beta6/machine/m_aix41.c
+ * by Monte Mitzelfelt (for latest top see http://www.groupsys.com/topinfo/)
+ *
+ * This is the machine-dependent module for FreeBSD 2.2
+ * Works for:
+ * FreeBSD 2.2.x, 3.x, 4.x, and probably FreeBSD 2.1.x
+ *
+ * LIBS: -lkvm
+ *
+ * AUTHOR: Christos Zoulas <christos@ee.cornell.edu>
+ * Steven Wallace <swallace@freebsd.org>
+ * Wolfram Schneider <wosch@FreeBSD.org>
+ * Thomas Moestl <tmoestl@gmx.net>
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/proc.h>
+#include <sys/resource.h>
+#include <sys/rtprio.h>
+#include <sys/signal.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/user.h>
+#include <sys/vmmeter.h>
+
+#include <err.h>
+#include <kvm.h>
+#include <math.h>
+#include <nlist.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <unistd.h>
+#include <vis.h>
+
+#include "top.h"
+#include "machine.h"
+#include "screen.h"
+#include "utils.h"
+#include "layout.h"
+
+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
+#define SMPUNAMELEN 13
+#define UPUNAMELEN 15
+
+extern struct process_select ps;
+extern char* printable(char *);
+static int smpmode;
+enum displaymodes displaymode;
+#ifdef TOP_USERNAME_LEN
+static int namelength = TOP_USERNAME_LEN;
+#else
+static int namelength = 8;
+#endif
+/* TOP_JID_LEN based on max of 999999 */
+#define TOP_JID_LEN 7
+static int jidlength;
+static int cmdlengthdelta;
+
+/* Prototypes for top internals */
+void quit(int);
+
+/* get_process_info passes back a handle. This is what it looks like: */
+
+struct handle {
+ struct kinfo_proc **next_proc; /* points to next valid proc pointer */
+ int remaining; /* number of pointers remaining */
+};
+
+/* declarations for load_avg */
+#include "loadavg.h"
+
+/* define what weighted cpu is. */
+#define weighted_cpu(pct, pp) ((pp)->ki_swtime == 0 ? 0.0 : \
+ ((pct) / (1.0 - exp((pp)->ki_swtime * logcpu))))
+
+/* what we consider to be process size: */
+#define PROCSIZE(pp) ((pp)->ki_size / 1024)
+
+#define RU(pp) (&(pp)->ki_rusage)
+#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 */
+
+/*
+ * These definitions control the format of the per-process area
+ */
+
+static char io_header[] =
+ " PID%*s %-*.*s VCSW IVCSW READ WRITE FAULT TOTAL PERCENT COMMAND";
+
+#define io_Proc_format \
+ "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s"
+
+static char smp_header_thr[] =
+ " PID%*s %-*.*s THR PRI NICE SIZE RES STATE C TIME %7s COMMAND";
+static char smp_header[] =
+ " PID%*s %-*.*s " "PRI NICE SIZE RES STATE C TIME %7s COMMAND";
+
+#define smp_Proc_format \
+ "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s %2d%7s %6.2f%% %.*s"
+
+static char up_header_thr[] =
+ " PID%*s %-*.*s THR PRI NICE SIZE RES STATE TIME %7s COMMAND";
+static char up_header[] =
+ " PID%*s %-*.*s " "PRI NICE SIZE RES STATE TIME %7s COMMAND";
+
+#define up_Proc_format \
+ "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s%.0d%7s %6.2f%% %.*s"
+
+
+/* process state names for the "STATE" column of the display */
+/* the extra nulls in the string "run" are for adding a slash and
+ the processor number when needed */
+
+char *state_abbrev[] = {
+ "", "START", "RUN\0\0\0", "SLEEP", "STOP", "ZOMB", "WAIT", "LOCK"
+};
+
+
+static kvm_t *kd;
+
+/* values that we stash away in _init and use in later routines */
+
+static double logcpu;
+
+/* these are retrieved from the kernel in _init */
+
+static load_avg ccpu;
+
+/* these are used in the get_ functions */
+
+static int lastpid;
+
+/* these are for calculating cpu state percentages */
+
+static long cp_time[CPUSTATES];
+static long cp_old[CPUSTATES];
+static long cp_diff[CPUSTATES];
+
+/* these are for detailing the process states */
+
+int process_states[8];
+char *procstatenames[] = {
+ "", " starting, ", " running, ", " sleeping, ", " stopped, ",
+ " zombie, ", " waiting, ", " lock, ",
+ NULL
+};
+
+/* these are for detailing the cpu states */
+
+int cpu_states[CPUSTATES];
+char *cpustatenames[] = {
+ "user", "nice", "system", "interrupt", "idle", NULL
+};
+
+/* these are for detailing the memory statistics */
+
+int memory_stats[7];
+char *memorynames[] = {
+ "K Active, ", "K Inact, ", "K Wired, ", "K Cache, ", "K Buf, ",
+ "K Free", NULL
+};
+
+int arc_stats[7];
+char *arcnames[] = {
+ "K Total, ", "K MFU, ", "K MRU, ", "K Anon, ", "K Header, ", "K Other",
+ NULL
+};
+
+int swap_stats[7];
+char *swapnames[] = {
+ "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out",
+ NULL
+};
+
+
+/* these are for keeping track of the proc array */
+
+static int nproc;
+static int onproc = -1;
+static int pref_len;
+static struct kinfo_proc *pbase;
+static struct kinfo_proc **pref;
+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 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;
+static long total_oublock;
+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 */
+
+#define pagetok(size) ((size) << pageshift)
+
+/* useful externals */
+long percentages();
+
+#ifdef ORDER
+/*
+ * Sorting orders. The first element is the default.
+ */
+char *ordernames[] = {
+ "cpu", "size", "res", "time", "pri", "threads",
+ "total", "read", "write", "fault", "vcsw", "ivcsw",
+ "jid", "pid", NULL
+};
+#endif
+
+/* Per-cpu time states */
+static int maxcpu;
+static int maxid;
+static int ncpus;
+static u_long cpumask;
+static long *times;
+static long *pcpu_cp_time;
+static long *pcpu_cp_old;
+static long *pcpu_cp_diff;
+static int *pcpu_cpu_states;
+
+static int compare_jid(const void *a, const void *b);
+static int compare_pid(const void *a, const void *b);
+static int compare_tid(const void *a, const void *b);
+static const char *format_nice(const struct kinfo_proc *pp);
+static void getsysctl(const char *name, void *ptr, size_t len);
+static int swapmode(int *retavail, int *retfree);
+static void update_layout(void);
+
+void
+toggle_pcpustats(void)
+{
+
+ if (ncpus == 1)
+ return;
+ update_layout();
+}
+
+/* Adjust display based on ncpus and the ARC state. */
+static void
+update_layout(void)
+{
+
+ y_mem = 3;
+ y_arc = 4;
+ y_swap = 4 + arc_enabled;
+ y_idlecursor = 5 + arc_enabled;
+ y_message = 5 + arc_enabled;
+ y_header = 6 + arc_enabled;
+ y_procs = 7 + arc_enabled;
+ Header_lines = 7 + arc_enabled;
+
+ if (pcpu_stats) {
+ y_mem += ncpus - 1;
+ y_arc += ncpus - 1;
+ y_swap += ncpus - 1;
+ y_idlecursor += ncpus - 1;
+ y_message += ncpus - 1;
+ y_header += ncpus - 1;
+ y_procs += ncpus - 1;
+ Header_lines += ncpus - 1;
+ }
+}
+
+int
+machine_init(struct statics *statics, char do_unames)
+{
+ int i, j, empty, pagesize;
+ uint64_t arc_size;
+ size_t size;
+ struct passwd *pw;
+
+ size = sizeof(smpmode);
+ if ((sysctlbyname("machdep.smp_active", &smpmode, &size,
+ NULL, 0) != 0 &&
+ sysctlbyname("kern.smp.active", &smpmode, &size,
+ NULL, 0) != 0) ||
+ size != sizeof(smpmode))
+ smpmode = 0;
+
+ size = sizeof(arc_size);
+ if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size,
+ NULL, 0) == 0 && arc_size != 0)
+ arc_enabled = 1;
+
+ if (do_unames) {
+ while ((pw = getpwent()) != NULL) {
+ if (strlen(pw->pw_name) > namelength)
+ namelength = strlen(pw->pw_name);
+ }
+ }
+ if (smpmode && namelength > SMPUNAMELEN)
+ namelength = SMPUNAMELEN;
+ else if (namelength > UPUNAMELEN)
+ namelength = UPUNAMELEN;
+
+ kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
+ if (kd == NULL)
+ return (-1);
+
+ GETSYSCTL("kern.ccpu", ccpu);
+
+ /* this is used in calculating WCPU -- calculate it ahead of time */
+ logcpu = log(loaddouble(ccpu));
+
+ pbase = NULL;
+ pref = NULL;
+ pcpu = NULL;
+ nproc = 0;
+ onproc = -1;
+
+ /* get the page size and calculate pageshift from it */
+ pagesize = getpagesize();
+ pageshift = 0;
+ while (pagesize > 1) {
+ pageshift++;
+ pagesize >>= 1;
+ }
+
+ /* we only need the amount of log(2)1024 for our conversion */
+ pageshift -= LOG1024;
+
+ /* fill in the statics information */
+ statics->procstate_names = procstatenames;
+ statics->cpustate_names = cpustatenames;
+ statics->memory_names = memorynames;
+ if (arc_enabled)
+ statics->arc_names = arcnames;
+ else
+ statics->arc_names = NULL;
+ statics->swap_names = swapnames;
+#ifdef ORDER
+ statics->order_names = ordernames;
+#endif
+
+ /* Allocate state for per-CPU stats. */
+ cpumask = 0;
+ ncpus = 0;
+ GETSYSCTL("kern.smp.maxcpus", maxcpu);
+ size = sizeof(long) * maxcpu * CPUSTATES;
+ times = malloc(size);
+ if (times == NULL)
+ err(1, "malloc %zu bytes", size);
+ if (sysctlbyname("kern.cp_times", times, &size, NULL, 0) == -1)
+ err(1, "sysctlbyname kern.cp_times");
+ pcpu_cp_time = calloc(1, size);
+ maxid = (size / CPUSTATES / sizeof(long)) - 1;
+ for (i = 0; i <= maxid; i++) {
+ empty = 1;
+ for (j = 0; empty && j < CPUSTATES; j++) {
+ if (times[i * CPUSTATES + j] != 0)
+ empty = 0;
+ }
+ if (!empty) {
+ cpumask |= (1ul << i);
+ ncpus++;
+ }
+ }
+ size = sizeof(long) * ncpus * CPUSTATES;
+ pcpu_cp_old = calloc(1, size);
+ pcpu_cp_diff = calloc(1, size);
+ pcpu_cpu_states = calloc(1, size);
+ statics->ncpus = ncpus;
+
+ update_layout();
+
+ /* all done! */
+ return (0);
+}
+
+char *
+format_header(char *uname_field)
+{
+ static char Header[128];
+ const char *prehead;
+
+ if (ps.jail)
+ jidlength = TOP_JID_LEN + 1; /* +1 for extra left space. */
+ else
+ jidlength = 0;
+
+ switch (displaymode) {
+ case DISP_CPU:
+ /*
+ * The logic of picking the right header format seems reverse
+ * here because we only want to display a THR column when
+ * "thread mode" is off (and threads are not listed as
+ * separate lines).
+ */
+ prehead = smpmode ?
+ (ps.thread ? smp_header : smp_header_thr) :
+ (ps.thread ? up_header : up_header_thr);
+ snprintf(Header, sizeof(Header), prehead,
+ jidlength, ps.jail ? " JID" : "",
+ namelength, namelength, uname_field,
+ ps.wcpu ? "WCPU" : "CPU");
+ break;
+ case DISP_IO:
+ prehead = io_header;
+ snprintf(Header, sizeof(Header), prehead,
+ jidlength, ps.jail ? " JID" : "",
+ namelength, namelength, uname_field);
+ break;
+ }
+ cmdlengthdelta = strlen(Header) - 7;
+ return (Header);
+}
+
+static int swappgsin = -1;
+static int swappgsout = -1;
+extern struct timeval timeout;
+
+
+void
+get_system_info(struct system_info *si)
+{
+ long total;
+ struct loadavg sysload;
+ int mib[2];
+ struct timeval boottime;
+ uint64_t arc_stat, arc_stat2;
+ int i, j;
+ size_t size;
+
+ /* get the CPU stats */
+ size = (maxid + 1) * CPUSTATES * sizeof(long);
+ if (sysctlbyname("kern.cp_times", pcpu_cp_time, &size, NULL, 0) == -1)
+ err(1, "sysctlbyname kern.cp_times");
+ GETSYSCTL("kern.cp_time", cp_time);
+ GETSYSCTL("vm.loadavg", sysload);
+ GETSYSCTL("kern.lastpid", lastpid);
+
+ /* convert load averages to doubles */
+ for (i = 0; i < 3; i++)
+ si->load_avg[i] = (double)sysload.ldavg[i] / sysload.fscale;
+
+ /* convert cp_time counts to percentages */
+ for (i = j = 0; i <= maxid; i++) {
+ if ((cpumask & (1ul << i)) == 0)
+ continue;
+ percentages(CPUSTATES, &pcpu_cpu_states[j * CPUSTATES],
+ &pcpu_cp_time[j * CPUSTATES],
+ &pcpu_cp_old[j * CPUSTATES],
+ &pcpu_cp_diff[j * CPUSTATES]);
+ j++;
+ }
+ percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff);
+
+ /* sum memory & swap statistics */
+ {
+ static unsigned int swap_delay = 0;
+ static int swapavail = 0;
+ static int swapfree = 0;
+ static long bufspace = 0;
+ static int nspgsin, nspgsout;
+
+ GETSYSCTL("vfs.bufspace", bufspace);
+ GETSYSCTL("vm.stats.vm.v_active_count", memory_stats[0]);
+ GETSYSCTL("vm.stats.vm.v_inactive_count", memory_stats[1]);
+ GETSYSCTL("vm.stats.vm.v_wire_count", memory_stats[2]);
+ GETSYSCTL("vm.stats.vm.v_cache_count", memory_stats[3]);
+ GETSYSCTL("vm.stats.vm.v_free_count", memory_stats[5]);
+ GETSYSCTL("vm.stats.vm.v_swappgsin", nspgsin);
+ GETSYSCTL("vm.stats.vm.v_swappgsout", nspgsout);
+ /* convert memory stats to Kbytes */
+ memory_stats[0] = pagetok(memory_stats[0]);
+ memory_stats[1] = pagetok(memory_stats[1]);
+ memory_stats[2] = pagetok(memory_stats[2]);
+ memory_stats[3] = pagetok(memory_stats[3]);
+ memory_stats[4] = bufspace / 1024;
+ memory_stats[5] = pagetok(memory_stats[5]);
+ memory_stats[6] = -1;
+
+ /* first interval */
+ if (swappgsin < 0) {
+ swap_stats[4] = 0;
+ swap_stats[5] = 0;
+ }
+
+ /* compute differences between old and new swap statistic */
+ else {
+ swap_stats[4] = pagetok(((nspgsin - swappgsin)));
+ swap_stats[5] = pagetok(((nspgsout - swappgsout)));
+ }
+
+ swappgsin = nspgsin;
+ swappgsout = nspgsout;
+
+ /* call CPU heavy swapmode() only for changes */
+ if (swap_stats[4] > 0 || swap_stats[5] > 0 || swap_delay == 0) {
+ swap_stats[3] = swapmode(&swapavail, &swapfree);
+ swap_stats[0] = swapavail;
+ swap_stats[1] = swapavail - swapfree;
+ swap_stats[2] = swapfree;
+ }
+ swap_delay = 1;
+ swap_stats[6] = -1;
+ }
+
+ if (arc_enabled) {
+ GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat);
+ arc_stats[0] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.mfu_size", arc_stat);
+ arc_stats[1] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.mru_size", arc_stat);
+ arc_stats[2] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.anon_size", arc_stat);
+ arc_stats[3] = arc_stat >> 10;
+ GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc_stat);
+ GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc_stat2);
+ arc_stats[4] = arc_stat + arc_stat2 >> 10;
+ GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc_stat);
+ arc_stats[5] = arc_stat >> 10;
+ si->arc = arc_stats;
+ }
+
+ /* set arrays and strings */
+ if (pcpu_stats) {
+ si->cpustates = pcpu_cpu_states;
+ si->ncpus = ncpus;
+ } else {
+ si->cpustates = cpu_states;
+ si->ncpus = 1;
+ }
+ si->memory = memory_stats;
+ si->swap = swap_stats;
+
+
+ if (lastpid > 0) {
+ si->last_pid = lastpid;
+ } else {
+ si->last_pid = -1;
+ }
+
+ /*
+ * Print how long system has been up.
+ * (Found by looking getting "boottime" from the kernel)
+ */
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_BOOTTIME;
+ size = sizeof(boottime);
+ if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
+ boottime.tv_sec != 0) {
+ si->boottime = boottime;
+ } else {
+ si->boottime.tv_sec = -1;
+ }
+}
+
+#define NOPROC ((void *)-1)
+
+/*
+ * We need to compare data from the old process entry with the new
+ * process entry.
+ * To facilitate doing this quickly we stash a pointer in the kinfo_proc
+ * structure to cache the mapping. We also use a negative cache pointer
+ * of NOPROC to avoid duplicate lookups.
+ * XXX: this could be done when the actual processes are fetched, we do
+ * it here out of laziness.
+ */
+const struct kinfo_proc *
+get_old_proc(struct kinfo_proc *pp)
+{
+ struct kinfo_proc **oldpp, *oldp;
+
+ /*
+ * If this is the first fetch of the kinfo_procs then we don't have
+ * any previous entries.
+ */
+ if (previous_proc_count == 0)
+ return (NULL);
+ /* negative cache? */
+ if (pp->ki_udata == NOPROC)
+ return (NULL);
+ /* cached? */
+ if (pp->ki_udata != NULL)
+ return (pp->ki_udata);
+ /*
+ * Not cached,
+ * 1) look up based on pid.
+ * 2) compare process start.
+ * If we fail here, then setup a negative cache entry, otherwise
+ * cache it.
+ */
+ oldpp = bsearch(&pp, previous_pref, previous_proc_count,
+ sizeof(*previous_pref), ps.thread ? compare_tid : compare_pid);
+ if (oldpp == NULL) {
+ pp->ki_udata = NOPROC;
+ return (NULL);
+ }
+ oldp = *oldpp;
+ if (bcmp(&oldp->ki_start, &pp->ki_start, sizeof(pp->ki_start)) != 0) {
+ pp->ki_udata = NOPROC;
+ return (NULL);
+ }
+ pp->ki_udata = oldp;
+ return (oldp);
+}
+
+/*
+ * Return the total amount of IO done in blocks in/out and faults.
+ * store the values individually in the pointers passed in.
+ */
+long
+get_io_stats(struct kinfo_proc *pp, long *inp, long *oup, long *flp,
+ long *vcsw, long *ivcsw)
+{
+ const struct kinfo_proc *oldp;
+ static struct kinfo_proc dummy;
+ long ret;
+
+ oldp = get_old_proc(pp);
+ if (oldp == NULL) {
+ bzero(&dummy, sizeof(dummy));
+ oldp = &dummy;
+ }
+ *inp = RU(pp)->ru_inblock - RU(oldp)->ru_inblock;
+ *oup = RU(pp)->ru_oublock - RU(oldp)->ru_oublock;
+ *flp = RU(pp)->ru_majflt - RU(oldp)->ru_majflt;
+ *vcsw = RU(pp)->ru_nvcsw - RU(oldp)->ru_nvcsw;
+ *ivcsw = RU(pp)->ru_nivcsw - RU(oldp)->ru_nivcsw;
+ ret =
+ (RU(pp)->ru_inblock - RU(oldp)->ru_inblock) +
+ (RU(pp)->ru_oublock - RU(oldp)->ru_oublock) +
+ (RU(pp)->ru_majflt - RU(oldp)->ru_majflt);
+ return (ret);
+}
+
+/*
+ * 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
+get_io_total(struct kinfo_proc *pp)
+{
+ long dummy;
+
+ return (get_io_stats(pp, &dummy, &dummy, &dummy, &dummy, &dummy));
+}
+
+static struct handle handle;
+
+caddr_t
+get_process_info(struct system_info *si, struct process_select *sel,
+ int (*compare)(const void *, const void *))
+{
+ int i;
+ 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;
+ int show_jid;
+ int show_self;
+ int show_system;
+ int show_uid;
+ int show_command;
+ 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) {
+ free(previous_procs);
+ previous_procs = malloc(nproc * sizeof(*previous_procs));
+ free(previous_pref);
+ previous_pref = malloc(nproc * sizeof(*previous_pref));
+ if (previous_procs == NULL || previous_pref == NULL) {
+ (void) fprintf(stderr, "top: Out of memory.\n");
+ quit(23);
+ }
+ previous_proc_count_max = nproc;
+ }
+ if (nproc) {
+ for (i = 0; i < nproc; i++)
+ previous_pref[i] = &previous_procs[i];
+ bcopy(pbase, previous_procs, nproc * sizeof(*previous_procs));
+ qsort(previous_pref, nproc, sizeof(*previous_pref),
+ 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);
+ (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);
+ }
+ /* get a pointer to the states summary array */
+ si->procstates = process_states;
+
+ /* set up flags which define what we are going to select */
+ show_idle = sel->idle;
+ show_jid = sel->jid != -1;
+ show_self = sel->self == -1;
+ show_system = sel->system;
+ show_uid = sel->uid != -1;
+ show_command = sel->command != NULL;
+ show_kidle = sel->kidle;
+
+ /* count up process states and get pointers to interesting procs */
+ total_procs = 0;
+ active_procs = 0;
+ total_inblock = 0;
+ total_oublock = 0;
+ total_majflt = 0;
+ memset((char *)process_states, 0, sizeof(process_states));
+ prefp = pref;
+ for (pp = pbase, i = 0; i < nproc; pp++, i++) {
+
+ if (pp->ki_stat == 0)
+ /* not in use */
+ continue;
+
+ if (!show_self && pp->ki_pid == sel->self)
+ /* skip self */
+ continue;
+
+ if (!show_system && (pp->ki_flag & P_SYSTEM))
+ /* skip system process */
+ continue;
+
+ p_io = get_io_stats(pp, &p_inblock, &p_oublock, &p_majflt,
+ &p_vcsw, &p_ivcsw);
+ total_inblock += p_inblock;
+ total_oublock += p_oublock;
+ total_majflt += p_majflt;
+ total_procs++;
+ process_states[pp->ki_stat]++;
+
+ if (pp->ki_stat == SZOMB)
+ /* skip zombies */
+ continue;
+
+ 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 &&
+ (!proc_used_cpu(pp) ||
+ pp->ki_stat == SSTOP || pp->ki_stat == SIDL))
+ /* skip idle or non-running processes */
+ continue;
+
+ if (displaymode == DISP_IO && !show_idle && p_io == 0)
+ /* skip processes that aren't doing I/O */
+ continue;
+
+ if (show_jid && pp->ki_jid != sel->jid)
+ /* skip proc. that don't belong to the selected JID */
+ continue;
+
+ if (show_uid && pp->ki_ruid != (uid_t)sel->uid)
+ /* skip proc. that don't belong to the selected UID */
+ continue;
+
+ *prefp++ = pp;
+ active_procs++;
+ }
+
+ /* if requested, sort the "interesting" processes */
+ if (compare != NULL)
+ qsort(pref, active_procs, sizeof(*pref), compare);
+
+ /* remember active and total counts */
+ si->p_total = total_procs;
+ si->p_active = pref_len = active_procs;
+
+ /* pass back a handle */
+ handle.next_proc = pref;
+ handle.remaining = active_procs;
+ return ((caddr_t)&handle);
+}
+
+static char fmt[512]; /* static area where result is built */
+
+char *
+format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
+{
+ struct kinfo_proc *pp;
+ const struct kinfo_proc *oldp;
+ long cputime;
+ double pct;
+ struct handle *hp;
+ char status[16];
+ int cpu, state;
+ struct rusage ru, *rup;
+ long p_tot, s_tot;
+ char *proc_fmt, thr_buf[6], jid_buf[TOP_JID_LEN + 1];
+ char *cmdbuf = NULL;
+ char **args;
+ const int cmdlen = 128;
+
+ /* find and remember the next proc structure */
+ hp = (struct handle *)handle;
+ pp = *(hp->next_proc++);
+ hp->remaining--;
+
+ /* get the process's command name */
+ if ((pp->ki_flag & P_INMEM) == 0) {
+ /*
+ * Print swapped processes as <pname>
+ */
+ size_t len;
+
+ len = strlen(pp->ki_comm);
+ if (len > sizeof(pp->ki_comm) - 3)
+ len = sizeof(pp->ki_comm) - 3;
+ memmove(pp->ki_comm + 1, pp->ki_comm, len);
+ pp->ki_comm[0] = '<';
+ pp->ki_comm[len + 1] = '>';
+ pp->ki_comm[len + 2] = '\0';
+ }
+
+ /*
+ * Convert the process's runtime from microseconds to seconds. This
+ * time includes the interrupt time although that is not wanted here.
+ * ps(1) is similarly sloppy.
+ */
+ cputime = (pp->ki_runtime + 500000) / 1000000;
+
+ /* calculate the base for cpu percentages */
+ pct = PCTCPU(pp);
+
+ /* generate "STATE" field */
+ switch (state = pp->ki_stat) {
+ case SRUN:
+ if (smpmode && pp->ki_oncpu != NOCPU)
+ sprintf(status, "CPU%d", pp->ki_oncpu);
+ else
+ strcpy(status, "RUN");
+ break;
+ case SLOCK:
+ if (pp->ki_kiflag & KI_LOCKBLOCK) {
+ sprintf(status, "*%.6s", pp->ki_lockname);
+ break;
+ }
+ /* fall through */
+ case SSLEEP:
+ if (pp->ki_wmesg != NULL) {
+ sprintf(status, "%.6s", pp->ki_wmesg);
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+
+ if (state >= 0 &&
+ state < sizeof(state_abbrev) / sizeof(*state_abbrev))
+ sprintf(status, "%.6s", state_abbrev[state]);
+ else
+ sprintf(status, "?%5d", state);
+ break;
+ }
+
+ cmdbuf = (char *)malloc(cmdlen + 1);
+ if (cmdbuf == NULL) {
+ warn("malloc(%d)", cmdlen + 1);
+ return NULL;
+ }
+
+ if (!(flags & FMT_SHOWARGS)) {
+ if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+ pp->ki_tdname[0]) {
+ snprintf(cmdbuf, cmdlen, "%s{%s}", pp->ki_comm,
+ pp->ki_tdname);
+ } else {
+ snprintf(cmdbuf, cmdlen, "%s", pp->ki_comm);
+ }
+ } else {
+ if (pp->ki_flag & P_SYSTEM ||
+ pp->ki_args == NULL ||
+ (args = kvm_getargv(kd, pp, cmdlen)) == NULL ||
+ !(*args)) {
+ if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+ pp->ki_tdname[0]) {
+ snprintf(cmdbuf, cmdlen,
+ "[%s{%s}]", pp->ki_comm, pp->ki_tdname);
+ } else {
+ snprintf(cmdbuf, cmdlen,
+ "[%s]", pp->ki_comm);
+ }
+ } else {
+ char *src, *dst, *argbuf;
+ char *cmd;
+ size_t argbuflen;
+ size_t len;
+
+ argbuflen = cmdlen * 4;
+ argbuf = (char *)malloc(argbuflen + 1);
+ if (argbuf == NULL) {
+ warn("malloc(%zu)", argbuflen + 1);
+ free(cmdbuf);
+ return NULL;
+ }
+
+ dst = argbuf;
+
+ /* Extract cmd name from argv */
+ cmd = strrchr(*args, '/');
+ if (cmd == NULL)
+ cmd = *args;
+ else
+ cmd++;
+
+ for (; (src = *args++) != NULL; ) {
+ if (*src == '\0')
+ continue;
+ len = (argbuflen - (dst - argbuf) - 1) / 4;
+ strvisx(dst, src,
+ MIN(strlen(src), len),
+ VIS_NL | VIS_CSTYLE);
+ while (*dst != '\0')
+ dst++;
+ if ((argbuflen - (dst - argbuf) - 1) / 4 > 0)
+ *dst++ = ' '; /* add delimiting space */
+ }
+ if (dst != argbuf && dst[-1] == ' ')
+ dst--;
+ *dst = '\0';
+
+ if (strcmp(cmd, pp->ki_comm) != 0) {
+ if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+ pp->ki_tdname[0])
+ snprintf(cmdbuf, cmdlen,
+ "%s (%s){%s}", argbuf, pp->ki_comm,
+ pp->ki_tdname);
+ else
+ snprintf(cmdbuf, cmdlen,
+ "%s (%s)", argbuf, pp->ki_comm);
+ } else {
+ if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+ pp->ki_tdname[0])
+ snprintf(cmdbuf, cmdlen,
+ "%s{%s}", argbuf, pp->ki_tdname);
+ else
+ strlcpy(cmdbuf, argbuf, cmdlen);
+ }
+ free(argbuf);
+ }
+ }
+
+ if (ps.jail == 0)
+ jid_buf[0] = '\0';
+ else
+ snprintf(jid_buf, sizeof(jid_buf), "%*d",
+ jidlength - 1, pp->ki_jid);
+
+ if (displaymode == DISP_IO) {
+ oldp = get_old_proc(pp);
+ if (oldp != NULL) {
+ ru.ru_inblock = RU(pp)->ru_inblock -
+ RU(oldp)->ru_inblock;
+ ru.ru_oublock = RU(pp)->ru_oublock -
+ RU(oldp)->ru_oublock;
+ ru.ru_majflt = RU(pp)->ru_majflt - RU(oldp)->ru_majflt;
+ ru.ru_nvcsw = RU(pp)->ru_nvcsw - RU(oldp)->ru_nvcsw;
+ ru.ru_nivcsw = RU(pp)->ru_nivcsw - RU(oldp)->ru_nivcsw;
+ rup = &ru;
+ } else {
+ rup = RU(pp);
+ }
+ p_tot = rup->ru_inblock + rup->ru_oublock + rup->ru_majflt;
+ s_tot = total_inblock + total_oublock + total_majflt;
+
+ snprintf(fmt, sizeof(fmt), io_Proc_format,
+ pp->ki_pid,
+ jidlength, jid_buf,
+ namelength, namelength, (*get_userid)(pp->ki_ruid),
+ rup->ru_nvcsw,
+ rup->ru_nivcsw,
+ rup->ru_inblock,
+ rup->ru_oublock,
+ rup->ru_majflt,
+ p_tot,
+ s_tot == 0 ? 0.0 : (p_tot * 100.0 / s_tot),
+ screen_width > cmdlengthdelta ?
+ screen_width - cmdlengthdelta : 0,
+ printable(cmdbuf));
+
+ free(cmdbuf);
+
+ return (fmt);
+ }
+
+ /* format this entry */
+ if (smpmode) {
+ if (state == SRUN && pp->ki_oncpu != NOCPU)
+ cpu = pp->ki_oncpu;
+ else
+ cpu = pp->ki_lastcpu;
+ } else
+ cpu = 0;
+ proc_fmt = smpmode ? smp_Proc_format : up_Proc_format;
+ if (ps.thread != 0)
+ thr_buf[0] = '\0';
+ else
+ snprintf(thr_buf, sizeof(thr_buf), "%*d ",
+ (int)(sizeof(thr_buf) - 2), pp->ki_numthreads);
+
+ snprintf(fmt, sizeof(fmt), proc_fmt,
+ pp->ki_pid,
+ jidlength, jid_buf,
+ namelength, namelength, (*get_userid)(pp->ki_ruid),
+ thr_buf,
+ pp->ki_pri.pri_level - PZERO,
+ format_nice(pp),
+ format_k2(PROCSIZE(pp)),
+ format_k2(pagetok(pp->ki_rssize)),
+ status,
+ cpu,
+ format_time(cputime),
+ ps.wcpu ? 100.0 * weighted_cpu(pct, pp) : 100.0 * pct,
+ screen_width > cmdlengthdelta ? screen_width - cmdlengthdelta : 0,
+ printable(cmdbuf));
+
+ free(cmdbuf);
+
+ /* return the result */
+ return (fmt);
+}
+
+static void
+getsysctl(const char *name, void *ptr, size_t len)
+{
+ size_t nlen = len;
+
+ if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) {
+ fprintf(stderr, "top: sysctl(%s...) failed: %s\n", name,
+ strerror(errno));
+ quit(23);
+ }
+ if (nlen != len) {
+ fprintf(stderr, "top: sysctl(%s...) expected %lu, got %lu\n",
+ name, (unsigned long)len, (unsigned long)nlen);
+ quit(23);
+ }
+}
+
+static const char *
+format_nice(const struct kinfo_proc *pp)
+{
+ const char *fifo, *kproc;
+ int rtpri;
+ static char nicebuf[4 + 1];
+
+ fifo = PRI_NEED_RR(pp->ki_pri.pri_class) ? "" : "F";
+ kproc = (pp->ki_flag & P_KPROC) ? "k" : "";
+ switch (PRI_BASE(pp->ki_pri.pri_class)) {
+ case PRI_ITHD:
+ return ("-");
+ case PRI_REALTIME:
+ /*
+ * XXX: the kernel doesn't tell us the original rtprio and
+ * doesn't really know what it was, so to recover it we
+ * must be more chummy with the implementation than the
+ * implementation is with itself. pri_user gives a
+ * constant "base" priority, but is only initialized
+ * properly for user threads. pri_native gives what the
+ * kernel calls the "base" priority, but it isn't constant
+ * since it is changed by priority propagation. pri_native
+ * also isn't properly initialized for all threads, but it
+ * is properly initialized for kernel realtime and idletime
+ * threads. Thus we use pri_user for the base priority of
+ * user threads (it is always correct) and pri_native for
+ * the base priority of kernel realtime and idletime threads
+ * (there is nothing better, and it is usually correct).
+ *
+ * The field width and thus the buffer are too small for
+ * values like "kr31F", but such values shouldn't occur,
+ * and if they do then the tailing "F" is not displayed.
+ */
+ rtpri = ((pp->ki_flag & P_KPROC) ? pp->ki_pri.pri_native :
+ pp->ki_pri.pri_user) - PRI_MIN_REALTIME;
+ snprintf(nicebuf, sizeof(nicebuf), "%sr%d%s",
+ kproc, rtpri, fifo);
+ break;
+ case PRI_TIMESHARE:
+ if (pp->ki_flag & P_KPROC)
+ return ("-");
+ snprintf(nicebuf, sizeof(nicebuf), "%d", pp->ki_nice - NZERO);
+ break;
+ case PRI_IDLE:
+ /* XXX: as above. */
+ rtpri = ((pp->ki_flag & P_KPROC) ? pp->ki_pri.pri_native :
+ pp->ki_pri.pri_user) - PRI_MIN_IDLE;
+ snprintf(nicebuf, sizeof(nicebuf), "%si%d%s",
+ kproc, rtpri, fifo);
+ break;
+ default:
+ return ("?");
+ }
+ return (nicebuf);
+}
+
+/* comparison routines for qsort */
+
+static int
+compare_pid(const void *p1, const void *p2)
+{
+ const struct kinfo_proc * const *pp1 = p1;
+ const struct kinfo_proc * const *pp2 = p2;
+
+ if ((*pp2)->ki_pid < 0 || (*pp1)->ki_pid < 0)
+ abort();
+
+ return ((*pp1)->ki_pid - (*pp2)->ki_pid);
+}
+
+static int
+compare_tid(const void *p1, const void *p2)
+{
+ const struct kinfo_proc * const *pp1 = p1;
+ const struct kinfo_proc * const *pp2 = p2;
+
+ if ((*pp2)->ki_tid < 0 || (*pp1)->ki_tid < 0)
+ abort();
+
+ return ((*pp1)->ki_tid - (*pp2)->ki_tid);
+}
+
+/*
+ * proc_compare - comparison function for "qsort"
+ * Compares the resource consumption of two processes using five
+ * distinct keys. The keys (in descending order of importance) are:
+ * percent cpu, cpu ticks, state, resident set size, total virtual
+ * memory usage. The process states are ordered as follows (from least
+ * to most important): WAIT, zombie, sleep, stop, start, run. The
+ * array declaration below maps a process state index into a number
+ * that reflects this ordering.
+ */
+
+static int sorted_state[] = {
+ 0, /* not used */
+ 3, /* sleep */
+ 1, /* ABANDONED (WAIT) */
+ 6, /* run */
+ 5, /* start */
+ 2, /* zombie */
+ 4 /* stop */
+};
+
+
+#define ORDERKEY_PCTCPU(a, b) do { \
+ double diff; \
+ if (ps.wcpu) \
+ diff = weighted_cpu(PCTCPU((b)), (b)) - \
+ weighted_cpu(PCTCPU((a)), (a)); \
+ else \
+ diff = PCTCPU((b)) - PCTCPU((a)); \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_CPTICKS(a, b) do { \
+ int64_t diff = (int64_t)(b)->ki_runtime - (int64_t)(a)->ki_runtime; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_STATE(a, b) do { \
+ int diff = sorted_state[(b)->ki_stat] - sorted_state[(a)->ki_stat]; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_PRIO(a, b) do { \
+ int diff = (int)(b)->ki_pri.pri_level - (int)(a)->ki_pri.pri_level; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_THREADS(a, b) do { \
+ int diff = (int)(b)->ki_numthreads - (int)(a)->ki_numthreads; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_RSSIZE(a, b) do { \
+ long diff = (long)(b)->ki_rssize - (long)(a)->ki_rssize; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_MEM(a, b) do { \
+ long diff = (long)PROCSIZE((b)) - (long)PROCSIZE((a)); \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+#define ORDERKEY_JID(a, b) do { \
+ int diff = (int)(b)->ki_jid - (int)(a)->ki_jid; \
+ if (diff != 0) \
+ return (diff > 0 ? 1 : -1); \
+} while (0)
+
+/* compare_cpu - the comparison function for sorting by cpu percentage */
+
+int
+#ifdef ORDER
+compare_cpu(void *arg1, void *arg2)
+#else
+proc_compare(void *arg1, void *arg2)
+#endif
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+
+ return (0);
+}
+
+#ifdef ORDER
+/* "cpu" compare routines */
+int compare_size(), compare_res(), compare_time(), compare_prio(),
+ compare_threads();
+
+/*
+ * "io" compare routines. Context switches aren't i/o, but are displayed
+ * on the "io" display.
+ */
+int compare_iototal(), compare_ioread(), compare_iowrite(), compare_iofault(),
+ compare_vcsw(), compare_ivcsw();
+
+int (*compares[])() = {
+ compare_cpu,
+ compare_size,
+ compare_res,
+ compare_time,
+ compare_prio,
+ compare_threads,
+ compare_iototal,
+ compare_ioread,
+ compare_iowrite,
+ compare_iofault,
+ compare_vcsw,
+ compare_ivcsw,
+ compare_jid,
+ NULL
+};
+
+/* compare_size - the comparison function for sorting by total memory usage */
+
+int
+compare_size(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_MEM(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+
+ return (0);
+}
+
+/* compare_res - the comparison function for sorting by resident set size */
+
+int
+compare_res(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+
+ return (0);
+}
+
+/* compare_time - the comparison function for sorting by total cpu time */
+
+int
+compare_time(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+
+ return (0);
+}
+
+/* compare_prio - the comparison function for sorting by priority */
+
+int
+compare_prio(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_PRIO(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+
+ return (0);
+}
+
+/* compare_threads - the comparison function for sorting by threads */
+int
+compare_threads(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_THREADS(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+
+ return (0);
+}
+
+/* compare_jid - the comparison function for sorting by jid */
+static int
+compare_jid(const void *arg1, const void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ ORDERKEY_JID(p1, p2);
+ ORDERKEY_PCTCPU(p1, p2);
+ ORDERKEY_CPTICKS(p1, p2);
+ ORDERKEY_STATE(p1, p2);
+ ORDERKEY_PRIO(p1, p2);
+ ORDERKEY_RSSIZE(p1, p2);
+ ORDERKEY_MEM(p1, p2);
+
+ return (0);
+}
+#endif /* ORDER */
+
+/* assorted comparison functions for sorting by i/o */
+
+int
+#ifdef ORDER
+compare_iototal(void *arg1, void *arg2)
+#else
+io_compare(void *arg1, void *arg2)
+#endif
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+
+ return (get_io_total(p2) - get_io_total(p1));
+}
+
+#ifdef ORDER
+int
+compare_ioread(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+ long dummy, inp1, inp2;
+
+ (void) get_io_stats(p1, &inp1, &dummy, &dummy, &dummy, &dummy);
+ (void) get_io_stats(p2, &inp2, &dummy, &dummy, &dummy, &dummy);
+
+ return (inp2 - inp1);
+}
+
+int
+compare_iowrite(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+ long dummy, oup1, oup2;
+
+ (void) get_io_stats(p1, &dummy, &oup1, &dummy, &dummy, &dummy);
+ (void) get_io_stats(p2, &dummy, &oup2, &dummy, &dummy, &dummy);
+
+ return (oup2 - oup1);
+}
+
+int
+compare_iofault(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+ long dummy, flp1, flp2;
+
+ (void) get_io_stats(p1, &dummy, &dummy, &flp1, &dummy, &dummy);
+ (void) get_io_stats(p2, &dummy, &dummy, &flp2, &dummy, &dummy);
+
+ return (flp2 - flp1);
+}
+
+int
+compare_vcsw(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+ long dummy, flp1, flp2;
+
+ (void) get_io_stats(p1, &dummy, &dummy, &dummy, &flp1, &dummy);
+ (void) get_io_stats(p2, &dummy, &dummy, &dummy, &flp2, &dummy);
+
+ return (flp2 - flp1);
+}
+
+int
+compare_ivcsw(void *arg1, void *arg2)
+{
+ struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1;
+ struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2;
+ long dummy, flp1, flp2;
+
+ (void) get_io_stats(p1, &dummy, &dummy, &dummy, &dummy, &flp1);
+ (void) get_io_stats(p2, &dummy, &dummy, &dummy, &dummy, &flp2);
+
+ return (flp2 - flp1);
+}
+#endif /* ORDER */
+
+/*
+ * proc_owner(pid) - returns the uid that owns process "pid", or -1 if
+ * the process does not exist.
+ * It is EXTREMELY IMPORTANT that this function work correctly.
+ * If top runs setuid root (as in SVR4), then this function
+ * is the only thing that stands in the way of a serious
+ * security problem. It validates requests for the "kill"
+ * and "renice" commands.
+ */
+
+int
+proc_owner(int pid)
+{
+ int cnt;
+ struct kinfo_proc **prefp;
+ struct kinfo_proc *pp;
+
+ prefp = pref;
+ cnt = pref_len;
+ while (--cnt >= 0) {
+ pp = *prefp++;
+ if (pp->ki_pid == (pid_t)pid)
+ return ((int)pp->ki_ruid);
+ }
+ return (-1);
+}
+
+static int
+swapmode(int *retavail, int *retfree)
+{
+ int n;
+ int pagesize = getpagesize();
+ struct kvm_swap swapary[1];
+
+ *retavail = 0;
+ *retfree = 0;
+
+#define CONVERT(v) ((quad_t)(v) * pagesize / 1024)
+
+ n = kvm_getswapinfo(kd, swapary, 1, 0);
+ if (n < 0 || swapary[0].ksw_total == 0)
+ return (0);
+
+ *retavail = CONVERT(swapary[0].ksw_total);
+ *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used);
+
+ n = (int)(swapary[0].ksw_used * 100.0 / swapary[0].ksw_total);
+ return (n);
+}
diff --git a/usr.bin/top/top.local.1 b/usr.bin/top/top.local.1
new file mode 100644
index 0000000..864ab8d
--- /dev/null
+++ b/usr.bin/top/top.local.1
@@ -0,0 +1,75 @@
+.\" $FreeBSD$
+.SH "FreeBSD NOTES"
+
+.SH DESCRIPTION OF MEMORY
+Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free
+ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 232K Header, 442K Other
+Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out
+.TP
+.B K:
+Kilobyte
+.TP
+.B M:
+Megabyte
+.TP
+.B G:
+Gigabyte
+.TP
+.B %:
+1/100
+.SS Physical Memory Stats
+.TP
+.B Active:
+number of bytes active
+.TP
+.B Inact:
+number of bytes inactive
+.TP
+.B Wired:
+number of bytes wired down, including BIO-level cached file data pages
+.TP
+.B Cache:
+number of clean bytes caching data that are available for
+immediate reallocation
+.TP
+.B Buf:
+number of bytes used for BIO-level disk caching
+.TP
+.B Free:
+number of bytes free
+.SS ZFS ARC Stats
+These stats are only displayed when the ARC is in use.
+.TP
+.B Total:
+number of wired bytes used for the ZFS ARC
+.TP
+.B MRU:
+number of ARC bytes holding most recently used data
+.TP
+.B MFU:
+number of ARC bytes holding most frequently used data
+.TP
+.B Anon:
+number of ARC bytes holding in flight data
+.TP
+.B Header:
+number of ARC bytes holding headers
+.TP
+.B Other
+miscellaneous ARC bytes
+.SS Swap Stats
+.TP
+.B Total:
+total available swap usage
+.TP
+.B Free:
+total free swap usage
+.TP
+.B Inuse:
+swap usage
+.TP
+.B In:
+bytes paged in from swap devices (last interval)
+.TP
+.B Out:
+bytes paged out to swap devices (last interval)
diff --git a/usr.bin/touch/Makefile b/usr.bin/touch/Makefile
new file mode 100644
index 0000000..e44f4f2
--- /dev/null
+++ b/usr.bin/touch/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= touch
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/touch/Makefile.depend b/usr.bin/touch/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/touch/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/touch/touch.1 b/usr.bin/touch/touch.1
new file mode 100644
index 0000000..a3cc2a7
--- /dev/null
+++ b/usr.bin/touch/touch.1
@@ -0,0 +1,252 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)touch.1 8.3 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd March 8, 2015
+.Dt TOUCH 1
+.Os
+.Sh NAME
+.Nm touch
+.Nd change file access and modification times
+.Sh SYNOPSIS
+.Nm
+.Op Fl A Ar [-][[hh]mm]SS
+.Op Fl achm
+.Op Fl r Ar file
+.Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
+.Op Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][tz]
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility sets the modification and access times of files.
+If any file does not exist, it is created with default permissions.
+.Pp
+By default,
+.Nm
+changes both modification and access times. The
+.Fl a
+and
+.Fl m
+flags may be used to select the access time or the modification time
+individually.
+Selecting both is equivalent to the default.
+By default, the timestamps are set to the current time.
+The
+.Fl d
+and
+.Fl t
+flags explicitly specify a different time, and the
+.Fl r
+flag specifies to set the times those of the specified file.
+The
+.Fl A
+flag adjusts the values by a specified amount.
+.Pp
+The following options are available:
+.Bl -tag -width Ds
+.It Fl A
+Adjust the access and modification time stamps for the file by the
+specified value.
+This flag is intended for use in modifying files with incorrectly set
+time stamps.
+.Pp
+The argument is of the form
+.Dq [-][[hh]mm]SS
+where each pair of letters represents the following:
+.Pp
+.Bl -tag -width Ds -compact -offset indent
+.It Ar -
+Make the adjustment negative: the new time stamp is set to be before
+the old one.
+.It Ar hh
+The number of hours, from 00 to 99.
+.It Ar mm
+The number of minutes, from 00 to 59.
+.It Ar SS
+The number of seconds, from 00 to 59.
+.El
+.Pp
+The
+.Fl A
+flag implies the
+.Fl c
+flag: if any file specified does not exist, it will be silently ignored.
+.It Fl a
+Change the access time of the file.
+The modification time of the file is not changed unless the
+.Fl m
+flag is also specified.
+.It Fl c
+Do not create the file if it does not exist.
+The
+.Nm
+utility does not treat this as an error.
+No error messages are displayed and the exit value is not affected.
+.It Fl d
+Change the access and modification times to the specified time instead
+of the current time of day.
+The argument is of the form
+.Dq YYYY-MM-DDThh:mm:SS[.frac][tz]
+where the letters represent the following:
+.Bl -tag -width Ds -compact -offset indent
+.It Ar YYYY
+The year.
+.It Ar MM
+The month of the year, from 01 to 12.
+.It Ar DD
+The day of the month, from 01 to 31.
+.It Ar T
+The letter
+.Li T
+or a space.
+.It Ar hh
+The hour of the day, from 00 to 23.
+.It Ar mm
+The minute of the hour, from 00 to 59.
+.It Ar SS
+The second of the minute, from 00 to 61.
+.It Ar .frac
+An optional fraction,
+consisting of a period or a comma followed by one or more digits.
+The number of significant digits depends on the kernel configuration and
+the filesystem, and may be zero.
+.It Ar tz
+An optional letter
+.Li Z
+indicating the time is in
+.Tn UTC .
+Otherwise, the time is assumed to be in local time.
+.El
+.It Fl h
+If the file is a symbolic link, change the times of the link
+itself rather than the file that the link points to.
+Note that
+.Fl h
+implies
+.Fl c
+and thus will not create any new files.
+.It Fl m
+Change the modification time of the file.
+The access time of the file is not changed unless the
+.Fl a
+flag is also specified.
+.It Fl r
+Use the access and modifications times from the specified file
+instead of the current time of day.
+.It Fl t
+Change the access and modification times to the specified time instead
+of the current time of day.
+The argument is of the form
+.Dq [[CC]YY]MMDDhhmm[.SS]
+where each pair of letters represents the following:
+.Pp
+.Bl -tag -width Ds -compact -offset indent
+.It Ar CC
+The first two digits of the year (the century).
+.It Ar YY
+The second two digits of the year.
+If
+.Dq YY
+is specified, but
+.Dq CC
+is not, a value for
+.Dq YY
+between 69 and 99 results in a
+.Dq CC
+value of 19.
+Otherwise, a
+.Dq CC
+value of 20 is used.
+.It Ar MM
+The month of the year, from 01 to 12.
+.It Ar DD
+the day of the month, from 01 to 31.
+.It Ar hh
+The hour of the day, from 00 to 23.
+.It Ar mm
+The minute of the hour, from 00 to 59.
+.It Ar SS
+The second of the minute, from 00 to 61.
+.El
+.Pp
+If the
+.Dq CC
+and
+.Dq YY
+letter pairs are not specified, the values default to the current
+year.
+If the
+.Dq SS
+letter pair is not specified, the value defaults to 0.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+The obsolescent form of
+.Nm ,
+where a time format is specified as the first argument, is supported.
+When no
+.Fl r
+or
+.Fl t
+option is specified, there are at least two arguments, and the first
+argument is a string of digits either eight or ten characters in length,
+the first argument is interpreted as a time specification of the form
+.Dq MMDDhhmm[YY] .
+.Pp
+The
+.Dq MM ,
+.Dq DD ,
+.Dq hh
+and
+.Dq mm
+letter pairs are treated as their counterparts specified to the
+.Fl t
+option.
+If the
+.Dq YY
+letter pair is in the range 39 to 99, the year is set to 1939 to 1999,
+otherwise, the year is set in the 21st century.
+.Sh SEE ALSO
+.Xr utimensat 2
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be a superset of the
+.St -p1003.2
+specification.
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v7 .
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
new file mode 100644
index 0000000..804af7e
--- /dev/null
+++ b/usr.bin/touch/touch.c
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+static void stime_arg1(const char *, struct timespec *);
+static void stime_arg2(const char *, int, struct timespec *);
+static void stime_darg(const char *, struct timespec *);
+static void stime_file(const char *, struct timespec *);
+static int timeoffset(const char *);
+static void usage(const char *);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ struct timespec ts[2];
+ int atflag;
+ int Aflag, aflag, cflag, mflag, ch, fd, len, rval, timeset;
+ char *p;
+ char *myname;
+
+ myname = basename(argv[0]);
+ Aflag = aflag = cflag = mflag = timeset = 0;
+ atflag = 0;
+ ts[0].tv_sec = ts[1].tv_sec = 0;
+ ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW;
+
+ while ((ch = getopt(argc, argv, "A:acd:fhmr:t:")) != -1)
+ switch(ch) {
+ case 'A':
+ Aflag = timeoffset(optarg);
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'd':
+ timeset = 1;
+ stime_darg(optarg, ts);
+ break;
+ case 'f':
+ /* No-op for compatibility. */
+ break;
+ case 'h':
+ cflag = 1;
+ atflag = AT_SYMLINK_NOFOLLOW;
+ break;
+ case 'm':
+ mflag = 1;
+ break;
+ case 'r':
+ timeset = 1;
+ stime_file(optarg, ts);
+ break;
+ case 't':
+ timeset = 1;
+ stime_arg1(optarg, ts);
+ break;
+ default:
+ usage(myname);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (aflag == 0 && mflag == 0)
+ aflag = mflag = 1;
+
+ if (timeset) {
+ if (Aflag) {
+ /*
+ * We're setting the time to an offset from a specified
+ * time. God knows why, but it means that we can set
+ * that time once and for all here.
+ */
+ if (aflag)
+ ts[0].tv_sec += Aflag;
+ if (mflag)
+ ts[1].tv_sec += Aflag;
+ Aflag = 0; /* done our job */
+ }
+ } else {
+ /*
+ * If no -r or -t flag, at least two operands, the first of
+ * which is an 8 or 10 digit number, use the obsolete time
+ * specification, otherwise use the current time.
+ */
+ if (argc > 1) {
+ strtol(argv[0], &p, 10);
+ len = p - argv[0];
+ if (*p == '\0' && (len == 8 || len == 10)) {
+ timeset = 1;
+ stime_arg2(*argv++, len == 10, ts);
+ }
+ }
+ /* Both times default to the same. */
+ ts[1] = ts[0];
+ }
+
+ if (!aflag)
+ ts[0].tv_nsec = UTIME_OMIT;
+ if (!mflag)
+ ts[1].tv_nsec = UTIME_OMIT;
+
+ if (*argv == NULL)
+ usage(myname);
+
+ if (Aflag)
+ cflag = 1;
+
+ for (rval = 0; *argv; ++argv) {
+ /* See if the file exists. */
+ if (fstatat(AT_FDCWD, *argv, &sb, atflag) != 0) {
+ if (errno != ENOENT) {
+ rval = 1;
+ warn("%s", *argv);
+ continue;
+ }
+ if (!cflag) {
+ /* Create the file. */
+ fd = open(*argv,
+ O_WRONLY | O_CREAT, DEFFILEMODE);
+ if (fd == -1 || fstat(fd, &sb) || close(fd)) {
+ rval = 1;
+ warn("%s", *argv);
+ continue;
+ }
+
+ /* If using the current time, we're done. */
+ if (!timeset)
+ continue;
+ } else
+ continue;
+ }
+
+ /*
+ * We're adjusting the times based on the file times, not a
+ * specified time (that gets handled above).
+ */
+ if (Aflag) {
+ if (aflag) {
+ ts[0] = sb.st_atim;
+ ts[0].tv_sec += Aflag;
+ }
+ if (mflag) {
+ ts[1] = sb.st_mtim;
+ ts[1].tv_sec += Aflag;
+ }
+ }
+
+ if (!utimensat(AT_FDCWD, *argv, ts, atflag))
+ continue;
+
+ rval = 1;
+ warn("%s", *argv);
+ }
+ exit(rval);
+}
+
+#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
+
+static void
+stime_arg1(const char *arg, struct timespec *tvp)
+{
+ time_t now;
+ struct tm *t;
+ int yearset;
+ char *p;
+
+ now = time(NULL);
+ if ((t = localtime(&now)) == NULL)
+ err(1, "localtime");
+ /* [[CC]YY]MMDDhhmm[.SS] */
+ if ((p = strchr(arg, '.')) == NULL)
+ t->tm_sec = 0; /* Seconds defaults to 0. */
+ else {
+ if (strlen(p + 1) != 2)
+ goto terr;
+ *p++ = '\0';
+ t->tm_sec = ATOI2(p);
+ }
+
+ yearset = 0;
+ switch(strlen(arg)) {
+ case 12: /* CCYYMMDDhhmm */
+ t->tm_year = ATOI2(arg);
+ t->tm_year *= 100;
+ yearset = 1;
+ /* FALLTHROUGH */
+ case 10: /* YYMMDDhhmm */
+ if (yearset) {
+ yearset = ATOI2(arg);
+ t->tm_year += yearset;
+ } else {
+ yearset = ATOI2(arg);
+ if (yearset < 69)
+ t->tm_year = yearset + 2000;
+ else
+ t->tm_year = yearset + 1900;
+ }
+ t->tm_year -= 1900; /* Convert to UNIX time. */
+ /* FALLTHROUGH */
+ case 8: /* MMDDhhmm */
+ t->tm_mon = ATOI2(arg);
+ --t->tm_mon; /* Convert from 01-12 to 00-11 */
+ t->tm_mday = ATOI2(arg);
+ t->tm_hour = ATOI2(arg);
+ t->tm_min = ATOI2(arg);
+ break;
+ default:
+ goto terr;
+ }
+
+ t->tm_isdst = -1; /* Figure out DST. */
+ tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
+ if (tvp[0].tv_sec == -1)
+ goto terr;
+
+ tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
+ return;
+
+terr:
+ errx(1, "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
+}
+
+static void
+stime_arg2(const char *arg, int year, struct timespec *tvp)
+{
+ time_t now;
+ struct tm *t;
+
+ now = time(NULL);
+ if ((t = localtime(&now)) == NULL)
+ err(1, "localtime");
+
+ t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */
+ --t->tm_mon; /* Convert from 01-12 to 00-11 */
+ t->tm_mday = ATOI2(arg);
+ t->tm_hour = ATOI2(arg);
+ t->tm_min = ATOI2(arg);
+ if (year) {
+ t->tm_year = ATOI2(arg);
+ if (t->tm_year < 39) /* support 2000-2038 not 1902-1969 */
+ t->tm_year += 100;
+ }
+
+ t->tm_isdst = -1; /* Figure out DST. */
+ tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
+ if (tvp[0].tv_sec == -1)
+ errx(1,
+ "out of range or illegal time specification: MMDDhhmm[yy]");
+
+ tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
+}
+
+static void
+stime_darg(const char *arg, struct timespec *tvp)
+{
+ struct tm t = { .tm_sec = 0 };
+ const char *fmt, *colon;
+ char *p;
+ int val, isutc = 0;
+
+ tvp[0].tv_nsec = 0;
+ t.tm_isdst = -1;
+ colon = strchr(arg, ':');
+ if (colon == NULL || strchr(colon + 1, ':') == NULL)
+ goto bad;
+ fmt = strchr(arg, 'T') != NULL ? "%Y-%m-%dT%H:%M:%S" :
+ "%Y-%m-%d %H:%M:%S";
+ p = strptime(arg, fmt, &t);
+ if (p == NULL)
+ goto bad;
+ /* POSIX: must have at least one digit after dot */
+ if ((*p == '.' || *p == ',') && isdigit((unsigned char)p[1])) {
+ p++;
+ val = 100000000;
+ while (isdigit((unsigned char)*p)) {
+ tvp[0].tv_nsec += val * (*p - '0');
+ p++;
+ val /= 10;
+ }
+ }
+ if (*p == 'Z') {
+ isutc = 1;
+ p++;
+ }
+ if (*p != '\0')
+ goto bad;
+
+ tvp[0].tv_sec = isutc ? timegm(&t) : mktime(&t);
+
+ tvp[1] = tvp[0];
+ return;
+
+bad:
+ errx(1, "out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]");
+}
+
+/* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */
+int
+timeoffset(const char *arg)
+{
+ int offset;
+ int isneg;
+
+ offset = 0;
+ isneg = *arg == '-';
+ if (isneg)
+ arg++;
+ switch (strlen(arg)) {
+ default: /* invalid */
+ errx(1, "Invalid offset spec, must be [-][[HH]MM]SS");
+
+ case 6: /* HHMMSS */
+ offset = ATOI2(arg);
+ /* FALLTHROUGH */
+ case 4: /* MMSS */
+ offset = offset * 60 + ATOI2(arg);
+ /* FALLTHROUGH */
+ case 2: /* SS */
+ offset = offset * 60 + ATOI2(arg);
+ }
+ if (isneg)
+ return (-offset);
+ else
+ return (offset);
+}
+
+static void
+stime_file(const char *fname, struct timespec *tsp)
+{
+ struct stat sb;
+
+ if (stat(fname, &sb))
+ err(1, "%s", fname);
+ tsp[0] = sb.st_atim;
+ tsp[1] = sb.st_mtim;
+}
+
+static void
+usage(const char *myname)
+{
+ fprintf(stderr, "usage: %s [-A [-][[hh]mm]SS] [-achm] [-r file] "
+ "[-t [[CC]YY]MMDDhhmm[.SS]]\n"
+ " [-d YYYY-MM-DDThh:mm:SS[.frac][tz]] "
+ "file ...\n", myname);
+ exit(1);
+}
diff --git a/usr.bin/tput/Makefile b/usr.bin/tput/Makefile
new file mode 100644
index 0000000..d3171da
--- /dev/null
+++ b/usr.bin/tput/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= tput
+LIBADD= ncursesw
+SCRIPTS=clear.sh
+MLINKS= tput.1 clear.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tput/Makefile.depend b/usr.bin/tput/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/tput/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tput/clear.sh b/usr.bin/tput/clear.sh
new file mode 100644
index 0000000..4b3531c
--- /dev/null
+++ b/usr.bin/tput/clear.sh
@@ -0,0 +1,35 @@
+#!/bin/sh -
+#
+# Copyright (c) 1989, 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.
+#
+# $FreeBSD$
+#
+# @(#)clear.sh 8.1 (Berkeley) 6/6/93
+#
+
+exec tput clear
diff --git a/usr.bin/tput/tput.1 b/usr.bin/tput/tput.1
new file mode 100644
index 0000000..ba39ace
--- /dev/null
+++ b/usr.bin/tput/tput.1
@@ -0,0 +1,154 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" @(#)tput.1 8.2 (Berkeley) 3/19/94
+.\" $FreeBSD$
+.\"
+.Dd June 15, 2002
+.Dt TPUT 1
+.Os
+.Sh NAME
+.Nm tput ,
+.Nm clear
+.Nd terminal capability interface
+.Sh SYNOPSIS
+.Nm
+.Op Fl T Ar term
+.Ar attribute ...
+.Nm clear
+.Sh DESCRIPTION
+The
+.Nm
+utility makes terminal-dependent information available to users or shell
+applications.
+When invoked as the
+.Nm clear
+utility, the screen will be cleared as if
+.Dl tput clear
+had been executed.
+The options to
+.Nm
+are as follows:
+.Bl -tag -width Ds
+.It Fl T
+The terminal name as specified in the
+.Xr termcap 5
+database, for example,
+.Dq vt100
+or
+.Dq xterm .
+If not specified,
+.Nm
+retrieves the
+.Dq Ev TERM
+variable from the environment.
+.El
+.Pp
+The
+.Nm
+utility outputs a string for each
+.Ar attribute
+that is of type string; a number for each of type integer.
+Otherwise,
+.Nm
+exits 0 if the terminal has the capability and 1 if it does not,
+without further action.
+.Pp
+If an
+.Ar attribute
+is of type string, and takes arguments (e.g.\& cursor movement,
+the termcap
+.Dq cm
+sequence) the arguments are taken from the command line immediately
+following the attribute.
+.Pp
+The following special attributes are available:
+.Bl -tag -width Ar
+.It Cm clear
+Clear the screen (the
+.Xr termcap 5
+.Dq cl
+sequence).
+.It Cm init
+Initialize the terminal (the
+.Xr termcap 5
+.Dq is
+sequence).
+.It Cm longname
+Print the descriptive name of the user's terminal type.
+.It Cm reset
+Reset the terminal (the
+.Xr termcap 5
+.Dq rs
+sequence).
+.El
+.Sh EXIT STATUS
+The exit status of
+.Nm
+is as follows:
+.Bl -tag -width indent
+.It 0
+If the last attribute
+.Ar attribute
+argument is of type string or integer, its value was successfully written
+to standard output.
+If the argument is of type boolean, the terminal has this attribute.
+.It 1
+This terminal does not have the specified boolean
+.Ar attribute .
+.It 2
+Usage error.
+.It 3
+No information is available about the specified terminal type.
+.El
+.Sh SEE ALSO
+.Xr termcap 5 ,
+.Xr terminfo 5
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.4 .
+.Sh BUGS
+The
+.Nm
+utility cannot really distinguish between different types of attributes.
+.Pp
+Some termcap entries depend upon having a
+.Sq %
+in them that is just a
+.Sq %
+and nothing more.
+Right now we just warn about them if they do not
+have a valid type declaration.
+These warnings are sent to
+stderr.
diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c
new file mode 100644
index 0000000..0c66d62
--- /dev/null
+++ b/usr.bin/tput/tput.c
@@ -0,0 +1,212 @@
+/*-
+ * Copyright (c) 1980, 1988, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)tput.c 8.2 (Berkeley) 3/19/94";
+#endif
+
+#include <termios.h>
+
+#include <err.h>
+#include <termcap.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#undef putchar
+#define outc putchar
+
+static void prlongname(char *);
+static void usage(void);
+static char **process(const char *, char *, char **);
+
+int
+main(int argc, char **argv)
+{
+ int ch, exitval, n;
+ char *cptr, *term, buf[1024], tbuf[1024];
+ const char *p;
+
+ term = NULL;
+ while ((ch = getopt(argc, argv, "T:")) != -1)
+ switch(ch) {
+ case 'T':
+ term = optarg;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ usage();
+
+ if (!term && !(term = getenv("TERM")))
+errx(2, "no terminal type specified and no TERM environmental variable.");
+ if (tgetent(tbuf, term) != 1)
+ err(3, "tgetent failure");
+ for (exitval = 0; (p = *argv) != NULL; ++argv) {
+ switch (*p) {
+ case 'c':
+ if (!strcmp(p, "clear"))
+ p = "cl";
+ break;
+ case 'i':
+ if (!strcmp(p, "init"))
+ p = "is";
+ break;
+ case 'l':
+ if (!strcmp(p, "longname")) {
+ prlongname(tbuf);
+ continue;
+ }
+ break;
+ case 'r':
+ if (!strcmp(p, "reset"))
+ p = "rs";
+ break;
+ }
+ cptr = buf;
+ if (tgetstr(p, &cptr))
+ argv = process(p, buf, argv);
+ else if ((n = tgetnum(p)) != -1)
+ (void)printf("%d\n", n);
+ else
+ exitval = !tgetflag(p);
+ }
+ exit(exitval);
+}
+
+static void
+prlongname(char *buf)
+{
+ int savech;
+ char *p, *savep;
+
+ for (p = buf; *p && *p != ':'; ++p);
+ savech = *(savep = p);
+ for (*p = '\0'; p >= buf && *p != '|'; --p);
+ (void)printf("%s\n", p + 1);
+ *savep = savech;
+}
+
+static char **
+process(const char *cap, char *str, char **argv)
+{
+ static const char errfew[] =
+ "not enough arguments (%d) for capability `%s'";
+ static const char errmany[] =
+ "too many arguments (%d) for capability `%s'";
+ static const char erresc[] =
+ "unknown %% escape `%c' for capability `%s'";
+ char *cp;
+ int arg_need, arg_rows, arg_cols;
+
+ /* Count how many values we need for this capability. */
+ for (cp = str, arg_need = 0; *cp != '\0'; cp++)
+ if (*cp == '%')
+ switch (*++cp) {
+ case 'd':
+ case '2':
+ case '3':
+ case '.':
+ case '+':
+ arg_need++;
+ break;
+ case '%':
+ case '>':
+ case 'i':
+ case 'r':
+ case 'n':
+ case 'B':
+ case 'D':
+ break;
+ case 'p':
+ if (cp[1]) {
+ cp++;
+ break;
+ }
+ default:
+ /*
+ * hpux has lot's of them, but we complain
+ */
+ warnx(erresc, *cp, cap);
+ }
+
+ /* And print them. */
+ switch (arg_need) {
+ case 0:
+ (void)tputs(str, 1, outc);
+ break;
+ case 1:
+ arg_cols = 0;
+
+ if (*++argv == NULL || *argv[0] == '\0')
+ errx(2, errfew, 1, cap);
+ arg_rows = atoi(*argv);
+
+ (void)tputs(tgoto(str, arg_cols, arg_rows), 1, outc);
+ break;
+ case 2:
+ if (*++argv == NULL || *argv[0] == '\0')
+ errx(2, errfew, 2, cap);
+ arg_cols = atoi(*argv);
+
+ if (*++argv == NULL || *argv[0] == '\0')
+ errx(2, errfew, 2, cap);
+ arg_rows = atoi(*argv);
+
+ (void) tputs(tgoto(str, arg_cols, arg_rows), arg_rows, outc);
+ break;
+
+ default:
+ errx(2, errmany, arg_need, cap);
+ }
+ return (argv);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: tput [-T term] attribute ...\n");
+ exit(2);
+}
diff --git a/usr.bin/tr/Makefile b/usr.bin/tr/Makefile
new file mode 100644
index 0000000..393b446
--- /dev/null
+++ b/usr.bin/tr/Makefile
@@ -0,0 +1,13 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= tr
+SRCS= cmap.c cset.c str.c tr.c
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tr/Makefile.depend b/usr.bin/tr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tr/cmap.c b/usr.bin/tr/cmap.c
new file mode 100644
index 0000000..811040c
--- /dev/null
+++ b/usr.bin/tr/cmap.c
@@ -0,0 +1,212 @@
+/*-
+ * Copyright (c) 2004 Tim J. Robbins.
+ * 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.
+ */
+/*
+ * "Character map" ADT. Stores mappings between pairs of characters in a
+ * splay tree, with a lookup table cache to simplify looking up the first
+ * bunch of characters (which are presumably more common than others).
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <assert.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "cmap.h"
+
+static struct cmapnode *cmap_splay(struct cmapnode *, wint_t);
+
+/*
+ * cmap_alloc --
+ * Allocate a character map.
+ */
+struct cmap *
+cmap_alloc(void)
+{
+ struct cmap *cm;
+
+ cm = malloc(sizeof(*cm));
+ if (cm == NULL)
+ return (NULL);
+ cm->cm_root = NULL;
+ cm->cm_def = CM_DEF_SELF;
+ cm->cm_havecache = false;
+ cm->cm_min = cm->cm_max = 0;
+ return (cm);
+}
+
+/*
+ * cmap_add --
+ * Add a mapping from "from" to "to" to the map.
+ */
+bool
+cmap_add(struct cmap *cm, wint_t from, wint_t to)
+{
+ struct cmapnode *cmn, *ncmn;
+
+ cm->cm_havecache = false;
+
+ if (cm->cm_root == NULL) {
+ cmn = malloc(sizeof(*cmn));
+ if (cmn == NULL)
+ return (false);
+ cmn->cmn_from = from;
+ cmn->cmn_to = to;
+ cmn->cmn_left = cmn->cmn_right = NULL;
+ cm->cm_root = cmn;
+ cm->cm_min = cm->cm_max = from;
+ return (true);
+ }
+
+ cmn = cm->cm_root = cmap_splay(cm->cm_root, from);
+
+ if (cmn->cmn_from == from) {
+ cmn->cmn_to = to;
+ return (true);
+ }
+
+ ncmn = malloc(sizeof(*ncmn));
+ if (ncmn == NULL)
+ return (false);
+ ncmn->cmn_from = from;
+ ncmn->cmn_to = to;
+ if (from < cmn->cmn_from) {
+ ncmn->cmn_left = cmn->cmn_left;
+ ncmn->cmn_right = cmn;
+ cmn->cmn_left = NULL;
+ } else {
+ ncmn->cmn_right = cmn->cmn_right;
+ ncmn->cmn_left = cmn;
+ cmn->cmn_right = NULL;
+ }
+ if (from < cm->cm_min)
+ cm->cm_min = from;
+ if (from > cm->cm_max)
+ cm->cm_max = from;
+ cm->cm_root = ncmn;
+
+ return (true);
+}
+
+/*
+ * cmap_lookup_hard --
+ * Look up the mapping for a character without using the cache.
+ */
+wint_t
+cmap_lookup_hard(struct cmap *cm, wint_t ch)
+{
+
+ if (cm->cm_root != NULL) {
+ cm->cm_root = cmap_splay(cm->cm_root, ch);
+ if (cm->cm_root->cmn_from == ch)
+ return (cm->cm_root->cmn_to);
+ }
+ return (cm->cm_def == CM_DEF_SELF ? ch : cm->cm_def);
+}
+
+/*
+ * cmap_cache --
+ * Update the cache.
+ */
+void
+cmap_cache(struct cmap *cm)
+{
+ wint_t ch;
+
+ for (ch = 0; ch < CM_CACHE_SIZE; ch++)
+ cm->cm_cache[ch] = cmap_lookup_hard(cm, ch);
+
+ cm->cm_havecache = true;
+}
+
+/*
+ * cmap_default --
+ * Change the value that characters without mappings map to, and
+ * return the old value. The special character value CM_MAP_SELF
+ * means characters map to themselves.
+ */
+wint_t
+cmap_default(struct cmap *cm, wint_t def)
+{
+ wint_t old;
+
+ old = cm->cm_def;
+ cm->cm_def = def;
+ cm->cm_havecache = false;
+ return (old);
+}
+
+static struct cmapnode *
+cmap_splay(struct cmapnode *t, wint_t ch)
+{
+ struct cmapnode N, *l, *r, *y;
+
+ /*
+ * Based on public domain code from Sleator.
+ */
+
+ assert(t != NULL);
+
+ N.cmn_left = N.cmn_right = NULL;
+ l = r = &N;
+ for (;;) {
+ if (ch < t->cmn_from) {
+ if (t->cmn_left != NULL &&
+ ch < t->cmn_left->cmn_from) {
+ y = t->cmn_left;
+ t->cmn_left = y->cmn_right;
+ y->cmn_right = t;
+ t = y;
+ }
+ if (t->cmn_left == NULL)
+ break;
+ r->cmn_left = t;
+ r = t;
+ t = t->cmn_left;
+ } else if (ch > t->cmn_from) {
+ if (t->cmn_right != NULL &&
+ ch > t->cmn_right->cmn_from) {
+ y = t->cmn_right;
+ t->cmn_right = y->cmn_left;
+ y->cmn_left = t;
+ t = y;
+ }
+ if (t->cmn_right == NULL)
+ break;
+ l->cmn_right = t;
+ l = t;
+ t = t->cmn_right;
+ } else
+ break;
+ }
+ l->cmn_right = t->cmn_left;
+ r->cmn_left = t->cmn_right;
+ t->cmn_left = N.cmn_right;
+ t->cmn_right = N.cmn_left;
+ return (t);
+}
diff --git a/usr.bin/tr/cmap.h b/usr.bin/tr/cmap.h
new file mode 100644
index 0000000..9a81e13
--- /dev/null
+++ b/usr.bin/tr/cmap.h
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 2004 Tim J. Robbins.
+ * 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 CMAP_H
+#define CMAP_H
+
+#include <limits.h>
+#include <stdbool.h>
+#include <wchar.h>
+
+struct cmapnode {
+ wint_t cmn_from;
+ wint_t cmn_to;
+ struct cmapnode *cmn_left;
+ struct cmapnode *cmn_right;
+};
+
+struct cmap {
+#define CM_CACHE_SIZE 128
+ wint_t cm_cache[CM_CACHE_SIZE];
+ bool cm_havecache;
+ struct cmapnode *cm_root;
+#define CM_DEF_SELF -2
+ wint_t cm_def;
+ wint_t cm_min;
+ wint_t cm_max;
+};
+
+struct cmap * cmap_alloc(void);
+bool cmap_add(struct cmap *, wint_t, wint_t);
+wint_t cmap_lookup_hard(struct cmap *, wint_t);
+void cmap_cache(struct cmap *);
+wint_t cmap_default(struct cmap *, wint_t);
+
+static __inline wint_t
+cmap_lookup(struct cmap *cm, wint_t from)
+{
+
+ if (from < CM_CACHE_SIZE && cm->cm_havecache)
+ return (cm->cm_cache[from]);
+ return (cmap_lookup_hard(cm, from));
+}
+
+static __inline wint_t
+cmap_min(struct cmap *cm)
+{
+
+ return (cm->cm_min);
+}
+
+static __inline wint_t
+cmap_max(struct cmap *cm)
+{
+
+ return (cm->cm_max);
+}
+
+#endif
diff --git a/usr.bin/tr/cset.c b/usr.bin/tr/cset.c
new file mode 100644
index 0000000..58a927c
--- /dev/null
+++ b/usr.bin/tr/cset.c
@@ -0,0 +1,290 @@
+/*-
+ * Copyright (c) 2004 Tim J. Robbins.
+ * 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.
+ */
+/*
+ * "Set of characters" ADT implemented as a splay tree of extents, with
+ * a lookup table cache to simplify looking up the first bunch of
+ * characters (which are presumably more common than others).
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+#include "cset.h"
+
+static struct csnode * cset_delete(struct csnode *, wchar_t);
+static __inline int cset_rangecmp(struct csnode *, wchar_t);
+static struct csnode * cset_splay(struct csnode *, wchar_t);
+
+/*
+ * cset_alloc --
+ * Allocate a set of characters.
+ */
+struct cset *
+cset_alloc(void)
+{
+ struct cset *cs;
+
+ if ((cs = malloc(sizeof(*cs))) == NULL)
+ return (NULL);
+ cs->cs_root = NULL;
+ cs->cs_classes = NULL;
+ cs->cs_havecache = false;
+ cs->cs_invert = false;
+ return (cs);
+}
+
+/*
+ * cset_add --
+ * Add a character to the set.
+ */
+bool
+cset_add(struct cset *cs, wchar_t ch)
+{
+ struct csnode *csn, *ncsn;
+ wchar_t oval;
+
+ cs->cs_havecache = false;
+
+ /*
+ * Inserting into empty tree; new item becomes the root.
+ */
+ if (cs->cs_root == NULL) {
+ csn = malloc(sizeof(*cs->cs_root));
+ if (csn == NULL)
+ return (false);
+ csn->csn_left = csn->csn_right = NULL;
+ csn->csn_min = csn->csn_max = ch;
+ cs->cs_root = csn;
+ return (true);
+ }
+
+ /*
+ * Splay to check whether the item already exists, and otherwise,
+ * where we should put it.
+ */
+ csn = cs->cs_root = cset_splay(cs->cs_root, ch);
+
+ /*
+ * Avoid adding duplicate nodes.
+ */
+ if (cset_rangecmp(csn, ch) == 0)
+ return (true);
+
+ /*
+ * Allocate a new node and make it the new root.
+ */
+ ncsn = malloc(sizeof(*ncsn));
+ if (ncsn == NULL)
+ return (false);
+ ncsn->csn_min = ncsn->csn_max = ch;
+ if (cset_rangecmp(csn, ch) < 0) {
+ ncsn->csn_left = csn->csn_left;
+ ncsn->csn_right = csn;
+ csn->csn_left = NULL;
+ } else {
+ ncsn->csn_right = csn->csn_right;
+ ncsn->csn_left = csn;
+ csn->csn_right = NULL;
+ }
+ cs->cs_root = ncsn;
+
+ /*
+ * Coalesce with left and right neighbours if possible.
+ */
+ if (ncsn->csn_left != NULL) {
+ ncsn->csn_left = cset_splay(ncsn->csn_left, ncsn->csn_min - 1);
+ if (ncsn->csn_left->csn_max == ncsn->csn_min - 1) {
+ oval = ncsn->csn_left->csn_min;
+ ncsn->csn_left = cset_delete(ncsn->csn_left,
+ ncsn->csn_left->csn_min);
+ ncsn->csn_min = oval;
+ }
+ }
+ if (ncsn->csn_right != NULL) {
+ ncsn->csn_right = cset_splay(ncsn->csn_right,
+ ncsn->csn_max + 1);
+ if (ncsn->csn_right->csn_min == ncsn->csn_max + 1) {
+ oval = ncsn->csn_right->csn_max;
+ ncsn->csn_right = cset_delete(ncsn->csn_right,
+ ncsn->csn_right->csn_min);
+ ncsn->csn_max = oval;
+ }
+ }
+
+ return (true);
+}
+
+/*
+ * cset_in_hard --
+ * Determine whether a character is in the set without using
+ * the cache.
+ */
+bool
+cset_in_hard(struct cset *cs, wchar_t ch)
+{
+ struct csclass *csc;
+
+ for (csc = cs->cs_classes; csc != NULL; csc = csc->csc_next)
+ if (csc->csc_invert ^ (iswctype(ch, csc->csc_type) != 0))
+ return (cs->cs_invert ^ true);
+ if (cs->cs_root != NULL) {
+ cs->cs_root = cset_splay(cs->cs_root, ch);
+ return (cs->cs_invert ^ (cset_rangecmp(cs->cs_root, ch) == 0));
+ }
+ return (cs->cs_invert ^ false);
+}
+
+/*
+ * cset_cache --
+ * Update the cache.
+ */
+void
+cset_cache(struct cset *cs)
+{
+ wchar_t i;
+
+ for (i = 0; i < CS_CACHE_SIZE; i++)
+ cs->cs_cache[i] = cset_in_hard(cs, i);
+
+ cs->cs_havecache = true;
+}
+
+/*
+ * cset_invert --
+ * Invert the character set.
+ */
+void
+cset_invert(struct cset *cs)
+{
+
+ cs->cs_invert ^= true;
+ cs->cs_havecache = false;
+}
+
+/*
+ * cset_addclass --
+ * Add a wctype()-style character class to the set, optionally
+ * inverting it.
+ */
+bool
+cset_addclass(struct cset *cs, wctype_t type, bool invert)
+{
+ struct csclass *csc;
+
+ csc = malloc(sizeof(*csc));
+ if (csc == NULL)
+ return (false);
+ csc->csc_type = type;
+ csc->csc_invert = invert;
+ csc->csc_next = cs->cs_classes;
+ cs->cs_classes = csc;
+ cs->cs_havecache = false;
+ return (true);
+}
+
+static __inline int
+cset_rangecmp(struct csnode *t, wchar_t ch)
+{
+
+ if (ch < t->csn_min)
+ return (-1);
+ if (ch > t->csn_max)
+ return (1);
+ return (0);
+}
+
+static struct csnode *
+cset_splay(struct csnode *t, wchar_t ch)
+{
+ struct csnode N, *l, *r, *y;
+
+ /*
+ * Based on public domain code from Sleator.
+ */
+
+ assert(t != NULL);
+
+ N.csn_left = N.csn_right = NULL;
+ l = r = &N;
+ for (;;) {
+ if (cset_rangecmp(t, ch) < 0) {
+ if (t->csn_left != NULL &&
+ cset_rangecmp(t->csn_left, ch) < 0) {
+ y = t->csn_left;
+ t->csn_left = y->csn_right;
+ y->csn_right = t;
+ t = y;
+ }
+ if (t->csn_left == NULL)
+ break;
+ r->csn_left = t;
+ r = t;
+ t = t->csn_left;
+ } else if (cset_rangecmp(t, ch) > 0) {
+ if (t->csn_right != NULL &&
+ cset_rangecmp(t->csn_right, ch) > 0) {
+ y = t->csn_right;
+ t->csn_right = y->csn_left;
+ y->csn_left = t;
+ t = y;
+ }
+ if (t->csn_right == NULL)
+ break;
+ l->csn_right = t;
+ l = t;
+ t = t->csn_right;
+ } else
+ break;
+ }
+ l->csn_right = t->csn_left;
+ r->csn_left = t->csn_right;
+ t->csn_left = N.csn_right;
+ t->csn_right = N.csn_left;
+ return (t);
+}
+
+static struct csnode *
+cset_delete(struct csnode *t, wchar_t ch)
+{
+ struct csnode *x;
+
+ assert(t != NULL);
+ t = cset_splay(t, ch);
+ assert(cset_rangecmp(t, ch) == 0);
+ if (t->csn_left == NULL)
+ x = t->csn_right;
+ else {
+ x = cset_splay(t->csn_left, ch);
+ x->csn_right = t->csn_right;
+ }
+ free(t);
+ return x;
+}
diff --git a/usr.bin/tr/cset.h b/usr.bin/tr/cset.h
new file mode 100644
index 0000000..ab3eabd
--- /dev/null
+++ b/usr.bin/tr/cset.h
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2004 Tim J. Robbins.
+ * 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 CSET_H
+#define CSET_H
+
+#include <stdbool.h>
+#include <wchar.h>
+#include <wctype.h>
+
+struct csnode {
+ wchar_t csn_min;
+ wchar_t csn_max;
+ struct csnode *csn_left;
+ struct csnode *csn_right;
+};
+
+struct csclass {
+ wctype_t csc_type;
+ bool csc_invert;
+ struct csclass *csc_next;
+};
+
+struct cset {
+#define CS_CACHE_SIZE 256
+ bool cs_cache[CS_CACHE_SIZE];
+ bool cs_havecache;
+ struct csclass *cs_classes;
+ struct csnode *cs_root;
+ bool cs_invert;
+};
+
+bool cset_addclass(struct cset *, wctype_t, bool);
+struct cset * cset_alloc(void);
+bool cset_add(struct cset *, wchar_t);
+void cset_invert(struct cset *);
+bool cset_in_hard(struct cset *, wchar_t);
+void cset_cache(struct cset *);
+
+static __inline bool
+cset_in(struct cset *cs, wchar_t ch)
+{
+
+ if (ch < CS_CACHE_SIZE && cs->cs_havecache)
+ return (cs->cs_cache[ch]);
+ return (cset_in_hard(cs, ch));
+}
+
+#endif /* CSET_H */
diff --git a/usr.bin/tr/extern.h b/usr.bin/tr/extern.h
new file mode 100644
index 0000000..8b68f44
--- /dev/null
+++ b/usr.bin/tr/extern.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+#include <limits.h>
+
+#define NCHARS_SB (UCHAR_MAX + 1) /* Number of single-byte characters. */
+#define OOBCH -1 /* Out of band character value. */
+
+typedef struct {
+ enum { STRING1, STRING2 } which;
+ enum { EOS, INFINITE, NORMAL, RANGE, SEQUENCE,
+ CCLASS, CCLASS_UPPER, CCLASS_LOWER, SET } state;
+ int cnt; /* character count */
+ wint_t lastch; /* last character */
+ wctype_t cclass; /* character class from wctype() */
+ wint_t equiv[NCHARS_SB]; /* equivalence set */
+ wint_t *set; /* set of characters */
+ char *str; /* user's string */
+} STR;
+
+wint_t next(STR *);
+int charcoll(const void *, const void *);
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
new file mode 100644
index 0000000..333ca5c
--- /dev/null
+++ b/usr.bin/tr/str.c
@@ -0,0 +1,387 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
+#endif
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "extern.h"
+
+static int backslash(STR *, int *);
+static int bracket(STR *);
+static void genclass(STR *);
+static void genequiv(STR *);
+static int genrange(STR *, int);
+static void genseq(STR *);
+
+wint_t
+next(STR *s)
+{
+ int is_octal;
+ wint_t ch;
+ wchar_t wch;
+ size_t clen;
+
+ switch (s->state) {
+ case EOS:
+ return (0);
+ case INFINITE:
+ return (1);
+ case NORMAL:
+ switch (*s->str) {
+ case '\0':
+ s->state = EOS;
+ return (0);
+ case '\\':
+ s->lastch = backslash(s, &is_octal);
+ break;
+ case '[':
+ if (bracket(s))
+ return (next(s));
+ /* FALLTHROUGH */
+ default:
+ clen = mbrtowc(&wch, s->str, MB_LEN_MAX, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2 ||
+ clen == 0)
+ errc(1, EILSEQ, NULL);
+ is_octal = 0;
+ s->lastch = wch;
+ s->str += clen;
+ break;
+ }
+
+ /* We can start a range at any time. */
+ if (s->str[0] == '-' && genrange(s, is_octal))
+ return (next(s));
+ return (1);
+ case RANGE:
+ if (s->cnt-- == 0) {
+ s->state = NORMAL;
+ return (next(s));
+ }
+ ++s->lastch;
+ return (1);
+ case SEQUENCE:
+ if (s->cnt-- == 0) {
+ s->state = NORMAL;
+ return (next(s));
+ }
+ return (1);
+ case CCLASS:
+ case CCLASS_UPPER:
+ case CCLASS_LOWER:
+ s->cnt++;
+ ch = nextwctype(s->lastch, s->cclass);
+ if (ch == -1) {
+ s->state = NORMAL;
+ return (next(s));
+ }
+ s->lastch = ch;
+ return (1);
+ case SET:
+ if ((ch = s->set[s->cnt++]) == OOBCH) {
+ s->state = NORMAL;
+ return (next(s));
+ }
+ s->lastch = ch;
+ return (1);
+ default:
+ return (0);
+ }
+ /* NOTREACHED */
+}
+
+static int
+bracket(STR *s)
+{
+ char *p;
+
+ switch (s->str[1]) {
+ case ':': /* "[:class:]" */
+ if ((p = strchr(s->str + 2, ']')) == NULL)
+ return (0);
+ if (*(p - 1) != ':' || p - s->str < 4)
+ goto repeat;
+ *(p - 1) = '\0';
+ s->str += 2;
+ genclass(s);
+ s->str = p + 1;
+ return (1);
+ case '=': /* "[=equiv=]" */
+ if (s->str[2] == '\0' || (p = strchr(s->str + 3, ']')) == NULL)
+ return (0);
+ if (*(p - 1) != '=' || p - s->str < 4)
+ goto repeat;
+ s->str += 2;
+ genequiv(s);
+ return (1);
+ default: /* "[\###*n]" or "[#*n]" */
+ repeat:
+ if ((p = strpbrk(s->str + 2, "*]")) == NULL)
+ return (0);
+ if (p[0] != '*' || strchr(p, ']') == NULL)
+ return (0);
+ s->str += 1;
+ genseq(s);
+ return (1);
+ }
+ /* NOTREACHED */
+}
+
+static void
+genclass(STR *s)
+{
+
+ if ((s->cclass = wctype(s->str)) == 0)
+ errx(1, "unknown class %s", s->str);
+ s->cnt = 0;
+ s->lastch = -1; /* incremented before check in next() */
+ if (strcmp(s->str, "upper") == 0)
+ s->state = CCLASS_UPPER;
+ else if (strcmp(s->str, "lower") == 0)
+ s->state = CCLASS_LOWER;
+ else
+ s->state = CCLASS;
+}
+
+static void
+genequiv(STR *s)
+{
+ int i, p, pri;
+ char src[2], dst[3];
+ size_t clen;
+ wchar_t wc;
+
+ if (*s->str == '\\') {
+ s->equiv[0] = backslash(s, NULL);
+ if (*s->str != '=')
+ errx(1, "misplaced equivalence equals sign");
+ s->str += 2;
+ } else {
+ clen = mbrtowc(&wc, s->str, MB_LEN_MAX, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2 || clen == 0)
+ errc(1, EILSEQ, NULL);
+ s->equiv[0] = wc;
+ if (s->str[clen] != '=')
+ errx(1, "misplaced equivalence equals sign");
+ s->str += clen + 2;
+ }
+
+ /*
+ * Calculate the set of all characters in the same equivalence class
+ * as the specified character (they will have the same primary
+ * collation weights).
+ * XXX Knows too much about how strxfrm() is implemented. Assumes
+ * it fills the string with primary collation weight bytes. Only one-
+ * to-one mappings are supported.
+ * XXX Equivalence classes not supported in multibyte locales.
+ */
+ src[0] = (char)s->equiv[0];
+ src[1] = '\0';
+ if (MB_CUR_MAX == 1 && strxfrm(dst, src, sizeof(dst)) == 1) {
+ pri = (unsigned char)*dst;
+ for (p = 1, i = 1; i < NCHARS_SB; i++) {
+ *src = i;
+ if (strxfrm(dst, src, sizeof(dst)) == 1 && pri &&
+ pri == (unsigned char)*dst)
+ s->equiv[p++] = i;
+ }
+ s->equiv[p] = OOBCH;
+ }
+
+ s->cnt = 0;
+ s->state = SET;
+ s->set = s->equiv;
+}
+
+static int
+genrange(STR *s, int was_octal)
+{
+ int stopval, octal;
+ char *savestart;
+ int n, cnt, *p;
+ size_t clen;
+ wchar_t wc;
+
+ octal = 0;
+ savestart = s->str;
+ if (*++s->str == '\\')
+ stopval = backslash(s, &octal);
+ else {
+ clen = mbrtowc(&wc, s->str, MB_LEN_MAX, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2)
+ errc(1, EILSEQ, NULL);
+ stopval = wc;
+ s->str += clen;
+ }
+ /*
+ * XXX Characters are not ordered according to collating sequence in
+ * multibyte locales.
+ */
+ if (octal || was_octal || MB_CUR_MAX > 1) {
+ if (stopval < s->lastch) {
+ s->str = savestart;
+ return (0);
+ }
+ s->cnt = stopval - s->lastch + 1;
+ s->state = RANGE;
+ --s->lastch;
+ return (1);
+ }
+ if (charcoll((const void *)&stopval, (const void *)&(s->lastch)) < 0) {
+ s->str = savestart;
+ return (0);
+ }
+ if ((s->set = p = malloc((NCHARS_SB + 1) * sizeof(int))) == NULL)
+ err(1, "genrange() malloc");
+ for (cnt = 0; cnt < NCHARS_SB; cnt++)
+ if (charcoll((const void *)&cnt, (const void *)&(s->lastch)) >= 0 &&
+ charcoll((const void *)&cnt, (const void *)&stopval) <= 0)
+ *p++ = cnt;
+ *p = OOBCH;
+ n = p - s->set;
+
+ s->cnt = 0;
+ s->state = SET;
+ if (n > 1)
+ mergesort(s->set, n, sizeof(*(s->set)), charcoll);
+ return (1);
+}
+
+static void
+genseq(STR *s)
+{
+ char *ep;
+ wchar_t wc;
+ size_t clen;
+
+ if (s->which == STRING1)
+ errx(1, "sequences only valid in string2");
+
+ if (*s->str == '\\')
+ s->lastch = backslash(s, NULL);
+ else {
+ clen = mbrtowc(&wc, s->str, MB_LEN_MAX, NULL);
+ if (clen == (size_t)-1 || clen == (size_t)-2)
+ errc(1, EILSEQ, NULL);
+ s->lastch = wc;
+ s->str += clen;
+ }
+ if (*s->str != '*')
+ errx(1, "misplaced sequence asterisk");
+
+ switch (*++s->str) {
+ case '\\':
+ s->cnt = backslash(s, NULL);
+ break;
+ case ']':
+ s->cnt = 0;
+ ++s->str;
+ break;
+ default:
+ if (isdigit((u_char)*s->str)) {
+ s->cnt = strtol(s->str, &ep, 0);
+ if (*ep == ']') {
+ s->str = ep + 1;
+ break;
+ }
+ }
+ errx(1, "illegal sequence count");
+ /* NOTREACHED */
+ }
+
+ s->state = s->cnt ? SEQUENCE : INFINITE;
+}
+
+/*
+ * Translate \??? into a character. Up to 3 octal digits, if no digits either
+ * an escape code or a literal character.
+ */
+static int
+backslash(STR *s, int *is_octal)
+{
+ int ch, cnt, val;
+
+ if (is_octal != NULL)
+ *is_octal = 0;
+ for (cnt = val = 0;;) {
+ ch = (u_char)*++s->str;
+ if (!isdigit(ch) || ch > '7')
+ break;
+ val = val * 8 + ch - '0';
+ if (++cnt == 3) {
+ ++s->str;
+ break;
+ }
+ }
+ if (cnt) {
+ if (is_octal != NULL)
+ *is_octal = 1;
+ return (val);
+ }
+ if (ch != '\0')
+ ++s->str;
+ switch (ch) {
+ case 'a': /* escape characters */
+ return ('\7');
+ case 'b':
+ return ('\b');
+ case 'f':
+ return ('\f');
+ case 'n':
+ return ('\n');
+ case 'r':
+ return ('\r');
+ case 't':
+ return ('\t');
+ case 'v':
+ return ('\13');
+ case '\0': /* \" -> \ */
+ s->state = EOS;
+ return ('\\');
+ default: /* \x" -> x */
+ return (ch);
+ }
+}
diff --git a/usr.bin/tr/tests/Makefile b/usr.bin/tr/tests/Makefile
new file mode 100644
index 0000000..7decb52
--- /dev/null
+++ b/usr.bin/tr/tests/Makefile
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.00.out
+${PACKAGE}FILES+= regress.01.out
+${PACKAGE}FILES+= regress.02.out
+${PACKAGE}FILES+= regress.03.out
+${PACKAGE}FILES+= regress.04.out
+${PACKAGE}FILES+= regress.05.out
+${PACKAGE}FILES+= regress.06.out
+${PACKAGE}FILES+= regress.07.out
+${PACKAGE}FILES+= regress.08.out
+${PACKAGE}FILES+= regress.09.out
+${PACKAGE}FILES+= regress.0a.out
+${PACKAGE}FILES+= regress.0b.out
+${PACKAGE}FILES+= regress.0c.out
+${PACKAGE}FILES+= regress.0d.out
+${PACKAGE}FILES+= regress.in
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress2.in
+
+.include <bsd.test.mk>
diff --git a/usr.bin/tr/tests/Makefile.depend b/usr.bin/tr/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/tr/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tr/tests/legacy_test.sh b/usr.bin/tr/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/tr/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/tr/tests/regress.00.out b/usr.bin/tr/tests/regress.00.out
new file mode 100644
index 0000000..5a7d1c7
--- /dev/null
+++ b/usr.bin/tr/tests/regress.00.out
@@ -0,0 +1,4 @@
+qui3k 2rown
+fox jump54
+ov5r th5 l1zy
+4og
diff --git a/usr.bin/tr/tests/regress.01.out b/usr.bin/tr/tests/regress.01.out
new file mode 100644
index 0000000..5252b48
--- /dev/null
+++ b/usr.bin/tr/tests/regress.01.out
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff --git a/usr.bin/tr/tests/regress.02.out b/usr.bin/tr/tests/regress.02.out
new file mode 100644
index 0000000..67a6dea
--- /dev/null
+++ b/usr.bin/tr/tests/regress.02.out
@@ -0,0 +1,4 @@
+quik brown
+fox jumpd
+ovr th lzy
+do
diff --git a/usr.bin/tr/tests/regress.03.out b/usr.bin/tr/tests/regress.03.out
new file mode 100644
index 0000000..c18e3cf
--- /dev/null
+++ b/usr.bin/tr/tests/regress.03.out
@@ -0,0 +1,4 @@
+QUICK BROWN
+FOX JUMPED
+OVER THE LAZY
+DOG
diff --git a/usr.bin/tr/tests/regress.04.out b/usr.bin/tr/tests/regress.04.out
new file mode 100644
index 0000000..c01413c
--- /dev/null
+++ b/usr.bin/tr/tests/regress.04.out
@@ -0,0 +1,4 @@
+..... .....
+... ......
+.... ... ....
+...
diff --git a/usr.bin/tr/tests/regress.05.out b/usr.bin/tr/tests/regress.05.out
new file mode 100644
index 0000000..5252b48
--- /dev/null
+++ b/usr.bin/tr/tests/regress.05.out
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff --git a/usr.bin/tr/tests/regress.06.out b/usr.bin/tr/tests/regress.06.out
new file mode 100644
index 0000000..5ca0a4f
--- /dev/null
+++ b/usr.bin/tr/tests/regress.06.out
@@ -0,0 +1,9 @@
+??? bottles of beer on the wall, ??? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+?? bottles of beer on the wall, ?? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+...
+? bottles of beer on the wall, ? bottles of beer!!!
+Take one down and pass it around - ? bottle of beer on the wall.
+? bottle of beer on the wall, ? bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
diff --git a/usr.bin/tr/tests/regress.07.out b/usr.bin/tr/tests/regress.07.out
new file mode 100644
index 0000000..999fe47
--- /dev/null
+++ b/usr.bin/tr/tests/regress.07.out
@@ -0,0 +1,9 @@
+### ####### ## #### ## ### ####, ### ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+## ####### ## #### ## ### ####, ## ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+...
+# ####### ## #### ## ### ####, # ####### ## ####!!!
+#### ### #### ### #### ## ###### - # ###### ## #### ## ### ####.
+# ###### ## #### ## ### ####, # ###### ## ####!!!
+#### ## #### ### #### ## ###### - ## #### ####### ## #### ## ### ####!!!
diff --git a/usr.bin/tr/tests/regress.08.out b/usr.bin/tr/tests/regress.08.out
new file mode 100644
index 0000000..34abcc1
--- /dev/null
+++ b/usr.bin/tr/tests/regress.08.out
@@ -0,0 +1,9 @@
+100,100.
+-99.
+99,99.
+-98.
+...
+2,2!!!
+-1.
+1,1!!!
+-!!!
diff --git a/usr.bin/tr/tests/regress.09.out b/usr.bin/tr/tests/regress.09.out
new file mode 100644
index 0000000..2419e3a
--- /dev/null
+++ b/usr.bin/tr/tests/regress.09.out
@@ -0,0 +1 @@
+?#
diff --git a/usr.bin/tr/tests/regress.0a.out b/usr.bin/tr/tests/regress.0a.out
new file mode 100644
index 0000000..e703f63
--- /dev/null
+++ b/usr.bin/tr/tests/regress.0a.out
@@ -0,0 +1 @@
+$?$$$$$$$$
diff --git a/usr.bin/tr/tests/regress.0b.out b/usr.bin/tr/tests/regress.0b.out
new file mode 100644
index 0000000..8d26586
--- /dev/null
+++ b/usr.bin/tr/tests/regress.0b.out
@@ -0,0 +1 @@
+100befbeeea100befbeeaeedadaad99befbeeea99befbeeea99befbeeaeedadaad98befbeeea2befbeeea2befbeeaeedadaad1befbeeea1befbeeea1befbeeaedadaadEbefbeeea
diff --git a/usr.bin/tr/tests/regress.0c.out b/usr.bin/tr/tests/regress.0c.out
new file mode 100644
index 0000000..4e125ea
--- /dev/null
+++ b/usr.bin/tr/tests/regress.0c.out
@@ -0,0 +1 @@
+[[[[
diff --git a/usr.bin/tr/tests/regress.0d.out b/usr.bin/tr/tests/regress.0d.out
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/usr.bin/tr/tests/regress.0d.out
@@ -0,0 +1 @@
+
diff --git a/usr.bin/tr/tests/regress.in b/usr.bin/tr/tests/regress.in
new file mode 100644
index 0000000..5252b48
--- /dev/null
+++ b/usr.bin/tr/tests/regress.in
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff --git a/usr.bin/tr/tests/regress.sh b/usr.bin/tr/tests/regress.sh
new file mode 100644
index 0000000..682cf23
--- /dev/null
+++ b/usr.bin/tr/tests/regress.sh
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+echo 1..14
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `tr abcde 12345 <${SRCDIR}/regress.in')
+REGRESSION_TEST(`01', `tr 12345 abcde <${SRCDIR}/regress.in')
+REGRESSION_TEST(`02', `tr -d aceg <${SRCDIR}/regress.in')
+REGRESSION_TEST(`03', `tr "[[:lower:]]" "[[:upper:]]" <${SRCDIR}/regress.in')
+REGRESSION_TEST(`04', `tr "[[:alpha:]]" . <${SRCDIR}/regress.in')
+REGRESSION_TEST(`05', `tr "[[:lower:]]" "[[:upper:]]" <${SRCDIR}/regress.in | tr "[[:upper:]]" "[[:lower:]]"')
+REGRESSION_TEST(`06', `tr "[[:digit:]]" "?" <${SRCDIR}/regress2.in')
+REGRESSION_TEST(`07', `tr "[[:alnum:]]" "#" <${SRCDIR}/regress2.in')
+REGRESSION_TEST(`08', `tr "[[:upper:]]" "[[:lower:]]" <${SRCDIR}/regress2.in | tr -d "[^[:alpha:]] "')
+REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"')
+REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"')
+REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" <${SRCDIR}/regress2.in ; echo)')
+REGRESSION_TEST(`0c', `echo "[[[[]]]]" | tr -d "[=]=]"')
+REGRESSION_TEST(`0d', `echo "]=[" | tr -d "[=]"')
+
+REGRESSION_END()
diff --git a/usr.bin/tr/tests/regress2.in b/usr.bin/tr/tests/regress2.in
new file mode 100644
index 0000000..c416463
--- /dev/null
+++ b/usr.bin/tr/tests/regress2.in
@@ -0,0 +1,9 @@
+100 bottles of beer on the wall, 100 bottles of beer.
+Take one down and pass it around - 99 bottles of beer on the wall.
+99 bottles of beer on the wall, 99 bottles of beer.
+Take one down and pass it around - 98 bottles of beer on the wall.
+...
+2 bottles of beer on the wall, 2 bottles of beer!!!
+Take one down and pass it around - 1 bottle of beer on the wall.
+1 bottle of beer on the wall, 1 bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
diff --git a/usr.bin/tr/tr.1 b/usr.bin/tr/tr.1
new file mode 100644
index 0000000..37e68f3
--- /dev/null
+++ b/usr.bin/tr/tr.1
@@ -0,0 +1,421 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)tr.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd October 13, 2006
+.Dt TR 1
+.Os
+.Sh NAME
+.Nm tr
+.Nd translate characters
+.Sh SYNOPSIS
+.Nm
+.Op Fl Ccsu
+.Ar string1 string2
+.Nm
+.Op Fl Ccu
+.Fl d
+.Ar string1
+.Nm
+.Op Fl Ccu
+.Fl s
+.Ar string1
+.Nm
+.Op Fl Ccu
+.Fl ds
+.Ar string1 string2
+.Sh DESCRIPTION
+The
+.Nm
+utility copies the standard input to the standard output with substitution
+or deletion of selected characters.
+.Pp
+The following options are available:
+.Bl -tag -width Ds
+.It Fl C
+Complement the set of characters in
+.Ar string1 ,
+that is
+.Dq Fl C Li ab
+includes every character except for
+.Ql a
+and
+.Ql b .
+.It Fl c
+Same as
+.Fl C
+but complement the set of values in
+.Ar string1 .
+.It Fl d
+Delete characters in
+.Ar string1
+from the input.
+.It Fl s
+Squeeze multiple occurrences of the characters listed in the last
+operand (either
+.Ar string1
+or
+.Ar string2 )
+in the input into a single instance of the character.
+This occurs after all deletion and translation is completed.
+.It Fl u
+Guarantee that any output is unbuffered.
+.El
+.Pp
+In the first synopsis form, the characters in
+.Ar string1
+are translated into the characters in
+.Ar string2
+where the first character in
+.Ar string1
+is translated into the first character in
+.Ar string2
+and so on.
+If
+.Ar string1
+is longer than
+.Ar string2 ,
+the last character found in
+.Ar string2
+is duplicated until
+.Ar string1
+is exhausted.
+.Pp
+In the second synopsis form, the characters in
+.Ar string1
+are deleted from the input.
+.Pp
+In the third synopsis form, the characters in
+.Ar string1
+are compressed as described for the
+.Fl s
+option.
+.Pp
+In the fourth synopsis form, the characters in
+.Ar string1
+are deleted from the input, and the characters in
+.Ar string2
+are compressed as described for the
+.Fl s
+option.
+.Pp
+The following conventions can be used in
+.Ar string1
+and
+.Ar string2
+to specify sets of characters:
+.Bl -tag -width [:equiv:]
+.It character
+Any character not described by one of the following conventions
+represents itself.
+.It \eoctal
+A backslash followed by 1, 2 or 3 octal digits represents a character
+with that encoded value.
+To follow an octal sequence with a digit as a character, left zero-pad
+the octal sequence to the full 3 octal digits.
+.It \echaracter
+A backslash followed by certain special characters maps to special
+values.
+.Bl -column "\ea"
+.It "\ea <alert character>"
+.It "\eb <backspace>"
+.It "\ef <form-feed>"
+.It "\en <newline>"
+.It "\er <carriage return>"
+.It "\et <tab>"
+.It "\ev <vertical tab>"
+.El
+.Pp
+A backslash followed by any other character maps to that character.
+.It c-c
+For non-octal range endpoints
+represents the range of characters between the range endpoints, inclusive,
+in ascending order,
+as defined by the collation sequence.
+If either or both of the range endpoints are octal sequences, it
+represents the range of specific coded values between the
+range endpoints, inclusive.
+.Pp
+.Bf Em
+See the
+.Sx COMPATIBILITY
+section below for an important note regarding
+differences in the way the current
+implementation interprets range expressions differently from
+previous implementations.
+.Ef
+.It [:class:]
+Represents all characters belonging to the defined character class.
+Class names are:
+.Bl -column "phonogram"
+.It "alnum <alphanumeric characters>"
+.It "alpha <alphabetic characters>"
+.It "blank <whitespace characters>"
+.It "cntrl <control characters>"
+.It "digit <numeric characters>"
+.It "graph <graphic characters>"
+.It "ideogram <ideographic characters>"
+.It "lower <lower-case alphabetic characters>"
+.It "phonogram <phonographic characters>"
+.It "print <printable characters>"
+.It "punct <punctuation characters>"
+.It "rune <valid characters>"
+.It "space <space characters>"
+.It "special <special characters>"
+.It "upper <upper-case characters>"
+.It "xdigit <hexadecimal characters>"
+.El
+.Pp
+.\" All classes may be used in
+.\" .Ar string1 ,
+.\" and in
+.\" .Ar string2
+.\" when both the
+.\" .Fl d
+.\" and
+.\" .Fl s
+.\" options are specified.
+.\" Otherwise, only the classes ``upper'' and ``lower'' may be used in
+.\" .Ar string2
+.\" and then only when the corresponding class (``upper'' for ``lower''
+.\" and vice-versa) is specified in the same relative position in
+.\" .Ar string1 .
+.\" .Pp
+When
+.Dq Li [:lower:]
+appears in
+.Ar string1
+and
+.Dq Li [:upper:]
+appears in the same relative position in
+.Ar string2 ,
+it represents the characters pairs from the
+.Dv toupper
+mapping in the
+.Ev LC_CTYPE
+category of the current locale.
+When
+.Dq Li [:upper:]
+appears in
+.Ar string1
+and
+.Dq Li [:lower:]
+appears in the same relative position in
+.Ar string2 ,
+it represents the characters pairs from the
+.Dv tolower
+mapping in the
+.Ev LC_CTYPE
+category of the current locale.
+.Pp
+With the exception of case conversion,
+characters in the classes are in unspecified order.
+.Pp
+For specific information as to which
+.Tn ASCII
+characters are included
+in these classes, see
+.Xr ctype 3
+and related manual pages.
+.It [=equiv=]
+Represents all characters belonging to the same equivalence class as
+.Ar equiv ,
+ordered by their encoded values.
+.It [#*n]
+Represents
+.Ar n
+repeated occurrences of the character represented by
+.Ar # .
+This
+expression is only valid when it occurs in
+.Ar string2 .
+If
+.Ar n
+is omitted or is zero, it is be interpreted as large enough to extend
+.Ar string2
+sequence to the length of
+.Ar string1 .
+If
+.Ar n
+has a leading zero, it is interpreted as an octal value, otherwise,
+it is interpreted as a decimal value.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_CTYPE
+and
+.Ev LC_COLLATE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following examples are shown as given to the shell:
+.Pp
+Create a list of the words in file1, one per line, where a word is taken to
+be a maximal string of letters.
+.Pp
+.D1 Li "tr -cs \*q[:alpha:]\*q \*q\en\*q < file1"
+.Pp
+Translate the contents of file1 to upper-case.
+.Pp
+.D1 Li "tr \*q[:lower:]\*q \*q[:upper:]\*q < file1"
+.Pp
+(This should be preferred over the traditional
+.Ux
+idiom of
+.Dq Li "tr a-z A-Z" ,
+since it works correctly in all locales.)
+.Pp
+Strip out non-printable characters from file1.
+.Pp
+.D1 Li "tr -cd \*q[:print:]\*q < file1"
+.Pp
+Remove diacritical marks from all accented variants of the letter
+.Ql e :
+.Pp
+.Dl "tr \*q[=e=]\*q \*qe\*q"
+.Sh COMPATIBILITY
+Previous
+.Fx
+implementations of
+.Nm
+did not order characters in range expressions according to the current
+locale's collation order, making it possible to convert unaccented Latin
+characters (esp.\& as found in English text) from upper to lower case using
+the traditional
+.Ux
+idiom of
+.Dq Li "tr A-Z a-z" .
+Since
+.Nm
+now obeys the locale's collation order, this idiom may not produce
+correct results when there is not a 1:1 mapping between lower and
+upper case, or when the order of characters within the two cases differs.
+As noted in the
+.Sx EXAMPLES
+section above, the character class expressions
+.Dq Li [:lower:]
+and
+.Dq Li [:upper:]
+should be used instead of explicit character ranges like
+.Dq Li a-z
+and
+.Dq Li A-Z .
+.Pp
+System V has historically implemented character ranges using the syntax
+.Dq Li [c-c]
+instead of the
+.Dq Li c-c
+used by historic
+.Bx
+implementations and
+standardized by POSIX.
+System V shell scripts should work under this implementation as long as
+the range is intended to map in another range, i.e., the command
+.Dq Li "tr [a-z] [A-Z]"
+will work as it will map the
+.Ql \&[
+character in
+.Ar string1
+to the
+.Ql \&[
+character in
+.Ar string2 .
+However, if the shell script is deleting or squeezing characters as in
+the command
+.Dq Li "tr -d [a-z]" ,
+the characters
+.Ql \&[
+and
+.Ql \&]
+will be
+included in the deletion or compression list which would not have happened
+under a historic System V implementation.
+Additionally, any scripts that depended on the sequence
+.Dq Li a-z
+to
+represent the three characters
+.Ql a ,
+.Ql \-
+and
+.Ql z
+will have to be
+rewritten as
+.Dq Li a\e-z .
+.Pp
+The
+.Nm
+utility has historically not permitted the manipulation of NUL bytes in
+its input and, additionally, stripped NUL's from its input stream.
+This implementation has removed this behavior as a bug.
+.Pp
+The
+.Nm
+utility has historically been extremely forgiving of syntax errors,
+for example, the
+.Fl c
+and
+.Fl s
+options were ignored unless two strings were specified.
+This implementation will not permit illegal syntax.
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+The
+.Dq ideogram ,
+.Dq phonogram ,
+.Dq rune ,
+and
+.Dq special
+character classes are extensions.
+.Pp
+It should be noted that the feature wherein the last character of
+.Ar string2
+is duplicated if
+.Ar string2
+has less characters than
+.Ar string1
+is permitted by POSIX but is not required.
+Shell scripts attempting to be portable to other POSIX systems should use
+the
+.Dq Li [#*]
+convention instead of relying on this behavior.
+The
+.Fl u
+option is an extension to the
+.St -p1003.1-2001
+standard.
diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c
new file mode 100644
index 0000000..6eea2cb
--- /dev/null
+++ b/usr.bin/tr/tr.c
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 1988, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
+#endif
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "cmap.h"
+#include "cset.h"
+#include "extern.h"
+
+static STR s1 = { STRING1, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
+static STR s2 = { STRING2, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
+
+static struct cset *setup(char *, STR *, int, int);
+static void usage(void);
+
+int
+main(int argc, char **argv)
+{
+ static int carray[NCHARS_SB];
+ struct cmap *map;
+ struct cset *delete, *squeeze;
+ int n, *p;
+ int Cflag, cflag, dflag, sflag, isstring2;
+ wint_t ch, cnt, lastch;
+
+ (void)setlocale(LC_ALL, "");
+
+ Cflag = cflag = dflag = sflag = 0;
+ while ((ch = getopt(argc, argv, "Ccdsu")) != -1)
+ switch((char)ch) {
+ case 'C':
+ Cflag = 1;
+ cflag = 0;
+ break;
+ case 'c':
+ cflag = 1;
+ Cflag = 0;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'u':
+ setbuf(stdout, (char *)NULL);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch(argc) {
+ case 0:
+ default:
+ usage();
+ /* NOTREACHED */
+ case 1:
+ isstring2 = 0;
+ break;
+ case 2:
+ isstring2 = 1;
+ break;
+ }
+
+ /*
+ * tr -ds [-Cc] string1 string2
+ * Delete all characters (or complemented characters) in string1.
+ * Squeeze all characters in string2.
+ */
+ if (dflag && sflag) {
+ if (!isstring2)
+ usage();
+
+ delete = setup(argv[0], &s1, cflag, Cflag);
+ squeeze = setup(argv[1], &s2, 0, 0);
+
+ for (lastch = OOBCH; (ch = getwchar()) != WEOF;)
+ if (!cset_in(delete, ch) &&
+ (lastch != ch || !cset_in(squeeze, ch))) {
+ lastch = ch;
+ (void)putwchar(ch);
+ }
+ if (ferror(stdin))
+ err(1, NULL);
+ exit(0);
+ }
+
+ /*
+ * tr -d [-Cc] string1
+ * Delete all characters (or complemented characters) in string1.
+ */
+ if (dflag) {
+ if (isstring2)
+ usage();
+
+ delete = setup(argv[0], &s1, cflag, Cflag);
+
+ while ((ch = getwchar()) != WEOF)
+ if (!cset_in(delete, ch))
+ (void)putwchar(ch);
+ if (ferror(stdin))
+ err(1, NULL);
+ exit(0);
+ }
+
+ /*
+ * tr -s [-Cc] string1
+ * Squeeze all characters (or complemented characters) in string1.
+ */
+ if (sflag && !isstring2) {
+ squeeze = setup(argv[0], &s1, cflag, Cflag);
+
+ for (lastch = OOBCH; (ch = getwchar()) != WEOF;)
+ if (lastch != ch || !cset_in(squeeze, ch)) {
+ lastch = ch;
+ (void)putwchar(ch);
+ }
+ if (ferror(stdin))
+ err(1, NULL);
+ exit(0);
+ }
+
+ /*
+ * tr [-Ccs] string1 string2
+ * Replace all characters (or complemented characters) in string1 with
+ * the character in the same position in string2. If the -s option is
+ * specified, squeeze all the characters in string2.
+ */
+ if (!isstring2)
+ usage();
+
+ map = cmap_alloc();
+ if (map == NULL)
+ err(1, NULL);
+ squeeze = cset_alloc();
+ if (squeeze == NULL)
+ err(1, NULL);
+
+ s1.str = argv[0];
+
+ if (Cflag || cflag) {
+ cmap_default(map, OOBCH);
+ if ((s2.str = strdup(argv[1])) == NULL)
+ errx(1, "strdup(argv[1])");
+ } else
+ s2.str = argv[1];
+
+ if (!next(&s2))
+ errx(1, "empty string2");
+
+ /*
+ * For -s result will contain only those characters defined
+ * as the second characters in each of the toupper or tolower
+ * pairs.
+ */
+
+ /* If string2 runs out of characters, use the last one specified. */
+ while (next(&s1)) {
+ again:
+ if (s1.state == CCLASS_LOWER &&
+ s2.state == CCLASS_UPPER &&
+ s1.cnt == 1 && s2.cnt == 1) {
+ do {
+ ch = towupper(s1.lastch);
+ cmap_add(map, s1.lastch, ch);
+ if (sflag && iswupper(ch))
+ cset_add(squeeze, ch);
+ if (!next(&s1))
+ goto endloop;
+ } while (s1.state == CCLASS_LOWER && s1.cnt > 1);
+ /* skip upper set */
+ do {
+ if (!next(&s2))
+ break;
+ } while (s2.state == CCLASS_UPPER && s2.cnt > 1);
+ goto again;
+ } else if (s1.state == CCLASS_UPPER &&
+ s2.state == CCLASS_LOWER &&
+ s1.cnt == 1 && s2.cnt == 1) {
+ do {
+ ch = towlower(s1.lastch);
+ cmap_add(map, s1.lastch, ch);
+ if (sflag && iswlower(ch))
+ cset_add(squeeze, ch);
+ if (!next(&s1))
+ goto endloop;
+ } while (s1.state == CCLASS_UPPER && s1.cnt > 1);
+ /* skip lower set */
+ do {
+ if (!next(&s2))
+ break;
+ } while (s2.state == CCLASS_LOWER && s2.cnt > 1);
+ goto again;
+ } else {
+ cmap_add(map, s1.lastch, s2.lastch);
+ if (sflag)
+ cset_add(squeeze, s2.lastch);
+ }
+ (void)next(&s2);
+ }
+endloop:
+ if (cflag || (Cflag && MB_CUR_MAX > 1)) {
+ /*
+ * This is somewhat tricky: since the character set is
+ * potentially huge, we need to avoid allocating a map
+ * entry for every character. Our strategy is to set the
+ * default mapping to the last character of string #2
+ * (= the one that gets automatically repeated), then to
+ * add back identity mappings for characters that should
+ * remain unchanged. We don't waste space on identity mappings
+ * for non-characters with the -C option; those are simulated
+ * in the I/O loop.
+ */
+ s2.str = argv[1];
+ s2.state = NORMAL;
+ for (cnt = 0; cnt < WINT_MAX; cnt++) {
+ if (Cflag && !iswrune(cnt))
+ continue;
+ if (cmap_lookup(map, cnt) == OOBCH) {
+ if (next(&s2))
+ cmap_add(map, cnt, s2.lastch);
+ if (sflag)
+ cset_add(squeeze, s2.lastch);
+ } else
+ cmap_add(map, cnt, cnt);
+ if ((s2.state == EOS || s2.state == INFINITE) &&
+ cnt >= cmap_max(map))
+ break;
+ }
+ cmap_default(map, s2.lastch);
+ } else if (Cflag) {
+ for (p = carray, cnt = 0; cnt < NCHARS_SB; cnt++) {
+ if (cmap_lookup(map, cnt) == OOBCH && iswrune(cnt))
+ *p++ = cnt;
+ else
+ cmap_add(map, cnt, cnt);
+ }
+ n = p - carray;
+ if (Cflag && n > 1)
+ (void)mergesort(carray, n, sizeof(*carray), charcoll);
+
+ s2.str = argv[1];
+ s2.state = NORMAL;
+ for (cnt = 0; cnt < n; cnt++) {
+ (void)next(&s2);
+ cmap_add(map, carray[cnt], s2.lastch);
+ /*
+ * Chars taken from s2 can be different this time
+ * due to lack of complex upper/lower processing,
+ * so fill string2 again to not miss some.
+ */
+ if (sflag)
+ cset_add(squeeze, s2.lastch);
+ }
+ }
+
+ cset_cache(squeeze);
+ cmap_cache(map);
+
+ if (sflag)
+ for (lastch = OOBCH; (ch = getwchar()) != WEOF;) {
+ if (!Cflag || iswrune(ch))
+ ch = cmap_lookup(map, ch);
+ if (lastch != ch || !cset_in(squeeze, ch)) {
+ lastch = ch;
+ (void)putwchar(ch);
+ }
+ }
+ else
+ while ((ch = getwchar()) != WEOF) {
+ if (!Cflag || iswrune(ch))
+ ch = cmap_lookup(map, ch);
+ (void)putwchar(ch);
+ }
+ if (ferror(stdin))
+ err(1, NULL);
+ exit (0);
+}
+
+static struct cset *
+setup(char *arg, STR *str, int cflag, int Cflag)
+{
+ struct cset *cs;
+
+ cs = cset_alloc();
+ if (cs == NULL)
+ err(1, NULL);
+ str->str = arg;
+ while (next(str))
+ cset_add(cs, str->lastch);
+ if (Cflag)
+ cset_addclass(cs, wctype("rune"), true);
+ if (cflag || Cflag)
+ cset_invert(cs);
+ cset_cache(cs);
+ return (cs);
+}
+
+int
+charcoll(const void *a, const void *b)
+{
+ static char sa[2], sb[2];
+
+ sa[0] = *(const int *)a;
+ sb[0] = *(const int *)b;
+ return (strcoll(sa, sb));
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
+ "usage: tr [-Ccsu] string1 string2",
+ " tr [-Ccu] -d string1",
+ " tr [-Ccu] -s string1",
+ " tr [-Ccu] -ds string1 string2");
+ exit(1);
+}
diff --git a/usr.bin/true/Makefile b/usr.bin/true/Makefile
new file mode 100644
index 0000000..028a6ca
--- /dev/null
+++ b/usr.bin/true/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= true
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/true/Makefile.depend b/usr.bin/true/Makefile.depend
new file mode 100644
index 0000000..43d71f8
--- /dev/null
+++ b/usr.bin/true/Makefile.depend
@@ -0,0 +1,16 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ 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/true/true.1 b/usr.bin/true/true.1
new file mode 100644
index 0000000..a148326
--- /dev/null
+++ b/usr.bin/true/true.1
@@ -0,0 +1,63 @@
+.\" Copyright (c) 1983, 1985, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)true.1 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt TRUE 1
+.Os
+.Sh NAME
+.Nm true
+.Nd return true value
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility always returns with an exit code of zero.
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr false 1 ,
+.Xr sh 1
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
diff --git a/usr.bin/true/true.c b/usr.bin/true/true.c
new file mode 100644
index 0000000..a557f58
--- /dev/null
+++ b/usr.bin/true/true.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1988, 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)true.c 8.1 (Berkeley) 6/9/93";
+#endif /* not lint */
+
+int
+main(void)
+{
+ return 0;
+}
diff --git a/usr.bin/truncate/Makefile b/usr.bin/truncate/Makefile
new file mode 100644
index 0000000..a6de5c6
--- /dev/null
+++ b/usr.bin/truncate/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= truncate
+LIBADD= util
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/truncate/Makefile.depend b/usr.bin/truncate/Makefile.depend
new file mode 100644
index 0000000..58f9a33
--- /dev/null
+++ b/usr.bin/truncate/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/truncate/tests/Makefile b/usr.bin/truncate/tests/Makefile
new file mode 100644
index 0000000..82cd606
--- /dev/null
+++ b/usr.bin/truncate/tests/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH= truncate_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/truncate/tests/Makefile.depend b/usr.bin/truncate/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/truncate/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/truncate/tests/truncate_test.sh b/usr.bin/truncate/tests/truncate_test.sh
new file mode 100644
index 0000000..369deba
--- /dev/null
+++ b/usr.bin/truncate/tests/truncate_test.sh
@@ -0,0 +1,399 @@
+#
+# 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
+bad_truncate_head()
+{
+ atf_set "descr" "Verifies that truncate reports an error during" \
+ "truncation"
+ atf_set "require.user" "unprivileged"
+}
+bad_truncate_body()
+{
+ create_stderr_file "truncate: exists.txt: Permission denied"
+
+ # Trying to get the ftruncate() call to return -1.
+ > exists.txt
+ atf_check chmod 444 exists.txt
+
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -s1 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
new file mode 100644
index 0000000..117fe70
--- /dev/null
+++ b/usr.bin/truncate/truncate.1
@@ -0,0 +1,152 @@
+.\"
+.\" Copyright (c) 2000 Sheldon Hearn <sheldonh@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 December 19, 2006
+.Dt TRUNCATE 1
+.Os
+.Sh NAME
+.Nm truncate
+.Nd truncate or extend the length of files
+.Sh SYNOPSIS
+.Nm
+.Op Fl c
+.Bk -words
+.Fl s Xo
+.Sm off
+.Op Cm + | -
+.Ar size
+.Op Cm K | k | M | m | G | g | T | t
+.Sm on
+.Xc
+.Ek
+.Ar
+.Nm
+.Op Fl c
+.Bk -words
+.Fl r Ar rfile
+.Ek
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility adjusts the length of each regular file given on the command-line.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl c
+Do not create files if they do not exist.
+The
+.Nm
+utility does not treat this as an error.
+No error messages are displayed
+and the exit value is not affected.
+.It Fl r Ar rfile
+Truncate or extend files to the length of the file
+.Ar rfile .
+.It Fl s Xo
+.Sm off
+.Op Cm + | -
+.Ar size
+.Op Cm K | k | M | m | G | g | T | t
+.Sm on
+.Xc
+If the
+.Ar size
+argument is preceded by a plus sign
+.Pq Cm + ,
+files will be extended by this number of bytes.
+If the
+.Ar size
+argument is preceded by a dash
+.Pq Cm - ,
+file lengths will be reduced by no more than this number of bytes,
+to a minimum length of zero bytes.
+Otherwise, the
+.Ar size
+argument specifies an absolute length to which all files
+should be extended or reduced as appropriate.
+.Pp
+The
+.Ar size
+argument may be suffixed with one of
+.Cm K ,
+.Cm M ,
+.Cm G
+or
+.Cm T
+(either upper or lower case) to indicate a multiple of
+Kilobytes, Megabytes, Gigabytes or Terabytes
+respectively.
+.El
+.Pp
+Exactly one of the
+.Fl r
+and
+.Fl s
+options must be specified.
+.Pp
+If a file is made smaller, its extra data is lost.
+If a file is made larger,
+it will be extended as if by writing bytes with the value zero.
+If the file does not exist,
+it is created unless the
+.Fl c
+option is specified.
+.Pp
+Note that,
+while truncating a file causes space on disk to be freed,
+extending a file does not cause space to be allocated.
+To extend a file and actually allocate the space,
+it is necessary to explicitly write data to it,
+using (for example) the shell's
+.Ql >>
+redirection syntax, or
+.Xr dd 1 .
+.Sh EXIT STATUS
+.Ex -std
+If the operation fails for an argument,
+.Nm
+will issue a diagnostic
+and continue processing the remaining arguments.
+.Sh SEE ALSO
+.Xr dd 1 ,
+.Xr touch 1 ,
+.Xr truncate 2
+.Sh STANDARDS
+The
+.Nm
+utility conforms to no known standards.
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+The
+.Nm
+utility was written by
+.An Sheldon Hearn Aq Mt sheldonh@starjuice.net .
diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c
new file mode 100644
index 0000000..d45533e
--- /dev/null
+++ b/usr.bin/truncate/truncate.c
@@ -0,0 +1,162 @@
+/*-
+ * Copyright (c) 2000 Sheldon Hearn <sheldonh@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.
+ *
+ */
+
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif
+
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <libutil.h>
+
+static void usage(void);
+
+static int no_create;
+static int do_relative;
+static int do_refer;
+static int got_size;
+
+int
+main(int argc, char **argv)
+{
+ struct stat sb;
+ mode_t omode;
+ off_t oflow, rsize, sz, tsize;
+ uint64_t usz;
+ int ch, error, fd, oflags;
+ char *fname, *rname;
+
+ fd = -1;
+ rsize = tsize = sz = 0;
+ error = 0;
+ rname = NULL;
+ while ((ch = getopt(argc, argv, "cr:s:")) != -1)
+ switch (ch) {
+ case 'c':
+ no_create = 1;
+ break;
+ case 'r':
+ do_refer = 1;
+ rname = optarg;
+ break;
+ case 's':
+ 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);
+
+ sz = (*optarg == '-') ? -(off_t)usz : (off_t)usz;
+ got_size = 1;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ /*
+ * Exactly one of do_refer or got_size must be specified. Since
+ * do_relative implies got_size, do_relative and do_refer are
+ * also mutually exclusive. See usage() for allowed invocations.
+ */
+ if (do_refer + got_size != 1 || argc < 1)
+ usage();
+ if (do_refer) {
+ if (stat(rname, &sb) == -1)
+ err(EXIT_FAILURE, "%s", rname);
+ tsize = sb.st_size;
+ } else if (do_relative)
+ rsize = sz;
+ else
+ tsize = sz;
+
+ if (no_create)
+ oflags = O_WRONLY;
+ else
+ oflags = O_WRONLY | O_CREAT;
+ omode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+
+ while ((fname = *argv++) != NULL) {
+ if (fd != -1)
+ close(fd);
+ if ((fd = open(fname, oflags, omode)) == -1) {
+ if (errno != ENOENT) {
+ warn("%s", fname);
+ error++;
+ }
+ continue;
+ }
+ if (do_relative) {
+ if (fstat(fd, &sb) == -1) {
+ warn("%s", fname);
+ error++;
+ continue;
+ }
+ oflow = sb.st_size + rsize;
+ if (oflow < (sb.st_size + rsize)) {
+ errno = EFBIG;
+ warn("%s", fname);
+ error++;
+ continue;
+ }
+ tsize = oflow;
+ }
+ if (tsize < 0)
+ tsize = 0;
+
+ if (ftruncate(fd, tsize) == -1) {
+ warn("%s", fname);
+ error++;
+ continue;
+ }
+ }
+ if (fd != -1)
+ close(fd);
+
+ return error ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+ "usage: truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ...",
+ " truncate [-c] -r rfile file ...");
+ exit(EXIT_FAILURE);
+}
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
new file mode 100644
index 0000000..480dab0
--- /dev/null
+++ b/usr.bin/truss/Makefile
@@ -0,0 +1,42 @@
+# $FreeBSD$
+
+NO_WERROR=
+PROG= truss
+SRCS= main.c setup.c syscalls.c
+
+LIBADD= sysdecode
+
+CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys
+
+ABIS+= freebsd
+# Each ABI is expected to have an ABI.c, MACHINE_ARCH-ABI.c or
+# MACHINE_CPUARCH-ABI.c file that will be used to map the syscall arguments.
+.if ${MACHINE_ARCH} == "aarch64"
+ABIS+= cloudabi64
+.endif
+.if ${MACHINE_CPUARCH} == "i386"
+ABIS+= i386-linux
+.endif
+.if ${MACHINE_CPUARCH} == "amd64"
+ABIS+= amd64-linux
+ABIS+= amd64-linux32
+ABIS+= freebsd32
+ABIS+= cloudabi64
+.endif
+.if ${MACHINE_ARCH} == "powerpc64"
+ABIS+= freebsd32
+.endif
+
+.for abi in ${ABIS}
+# Find the right file to handle this ABI.
+abi_src=
+ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c
+.for f in ${ABI_SRCS}
+.if exists(${.CURDIR}/${f}) && empty(abi_src)
+abi_src= ${f}
+.endif
+.endfor
+SRCS:= ${SRCS} ${abi_src}
+.endfor
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/truss/Makefile.depend b/usr.bin/truss/Makefile.depend
new file mode 100644
index 0000000..3c34d02
--- /dev/null
+++ b/usr.bin/truss/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsysdecode \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/truss/aarch64-cloudabi64.c b/usr.bin/truss/aarch64-cloudabi64.c
new file mode 100644
index 0000000..27906ea
--- /dev/null
+++ b/usr.bin/truss/aarch64-cloudabi64.c
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 2015 Nuxi, https://nuxi.nl/
+ *
+ * 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/ptrace.h>
+
+#include <machine/armreg.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+aarch64_cloudabi64_fetch_args(struct trussinfo *trussinfo, unsigned int narg)
+{
+ struct current_syscall *cs;
+ struct reg regs;
+ lwpid_t tid;
+ unsigned int i;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) == -1) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ cs = &trussinfo->curthread->cs;
+ for (i = 0; i < narg && i < 8; i++)
+ cs->args[i] = regs.x[i];
+ return (0);
+}
+
+static int
+aarch64_cloudabi64_fetch_retval(struct trussinfo *trussinfo, long *retval,
+ int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) == -1) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.x[0];
+ retval[1] = regs.x[1];
+ *errorp = (regs.spsr & PSR_C) != 0;
+ return (0);
+}
+
+static struct procabi aarch64_cloudabi64 = {
+ "CloudABI ELF64",
+ SYSDECODE_ABI_CLOUDABI64,
+ aarch64_cloudabi64_fetch_args,
+ aarch64_cloudabi64_fetch_retval
+};
+
+PROCABI(aarch64_cloudabi64);
diff --git a/usr.bin/truss/aarch64-freebsd.c b/usr.bin/truss/aarch64-freebsd.c
new file mode 100644
index 0000000..534441c
--- /dev/null
+++ b/usr.bin/truss/aarch64-freebsd.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * 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$");
+
+/* FreeBSD/arm64-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/armreg.h>
+#include <machine/ucontext.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+aarch64_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ syscall_num = regs.x[8];
+ if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
+ reg = 1;
+ syscall_num = regs.x[0];
+ } else {
+ reg = 0;
+ }
+
+ for (i = 0; i < narg && reg < 8; i++, reg++)
+ cs->args[i] = regs.x[reg];
+ return (0);
+}
+
+static int
+aarch64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.x[0];
+ retval[1] = regs.x[1];
+ *errorp = !!(regs.spsr & PSR_C);
+ return (0);
+}
+
+static struct procabi aarch64_freebsd = {
+ "FreeBSD ELF64",
+ SYSDECODE_ABI_FREEBSD,
+ aarch64_fetch_args,
+ aarch64_fetch_retval
+};
+
+PROCABI(aarch64_freebsd);
diff --git a/usr.bin/truss/amd64-cloudabi64.c b/usr.bin/truss/amd64-cloudabi64.c
new file mode 100644
index 0000000..f7d7c1a
--- /dev/null
+++ b/usr.bin/truss/amd64-cloudabi64.c
@@ -0,0 +1,94 @@
+/*-
+ * Copyright (c) 2015 Nuxi, https://nuxi.nl/
+ *
+ * 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/ptrace.h>
+
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+amd64_cloudabi64_fetch_args(struct trussinfo *trussinfo, unsigned int narg)
+{
+ struct current_syscall *cs;
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) == -1) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ cs = &trussinfo->curthread->cs;
+ if (narg >= 1)
+ cs->args[0] = regs.r_rdi;
+ if (narg >= 2)
+ cs->args[1] = regs.r_rsi;
+ if (narg >= 3)
+ cs->args[2] = regs.r_rdx;
+ if (narg >= 4)
+ cs->args[3] = regs.r_rcx;
+ if (narg >= 5)
+ cs->args[4] = regs.r_r8;
+ if (narg >= 6)
+ cs->args[5] = regs.r_r9;
+ return (0);
+}
+
+static int
+amd64_cloudabi64_fetch_retval(struct trussinfo *trussinfo, long *retval,
+ int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) == -1) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_rax;
+ retval[1] = regs.r_rdx;
+ *errorp = (regs.r_rflags & PSL_C) != 0;
+ return (0);
+}
+
+static struct procabi amd64_cloudabi64 = {
+ "CloudABI ELF64",
+ SYSDECODE_ABI_CLOUDABI64,
+ amd64_cloudabi64_fetch_args,
+ amd64_cloudabi64_fetch_retval
+};
+
+PROCABI(amd64_cloudabi64);
diff --git a/usr.bin/truss/amd64-freebsd.c b/usr.bin/truss/amd64-freebsd.c
new file mode 100644
index 0000000..a2f378c
--- /dev/null
+++ b/usr.bin/truss/amd64-freebsd.c
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/amd64-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+amd64_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over %rax if it contains
+ * either of these values.
+ */
+ reg = 0;
+ switch (regs.r_rax) {
+ case SYS_syscall:
+ case SYS___syscall:
+ reg++;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < 6; i++, reg++) {
+ switch (reg) {
+ case 0: cs->args[i] = regs.r_rdi; break;
+ case 1: cs->args[i] = regs.r_rsi; break;
+ case 2: cs->args[i] = regs.r_rdx; break;
+ case 3: cs->args[i] = regs.r_rcx; break;
+ case 4: cs->args[i] = regs.r_r8; break;
+ case 5: cs->args[i] = regs.r_r9; break;
+ }
+ }
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_rsp + sizeof(register_t));
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(register_t);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+amd64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_rax;
+ retval[1] = regs.r_rdx;
+ *errorp = !!(regs.r_rflags & PSL_C);
+ return (0);
+}
+
+static struct procabi amd64_freebsd = {
+ "FreeBSD ELF64",
+ SYSDECODE_ABI_FREEBSD,
+ amd64_fetch_args,
+ amd64_fetch_retval
+};
+
+PROCABI(amd64_freebsd);
diff --git a/usr.bin/truss/amd64-freebsd32.c b/usr.bin/truss/amd64-freebsd32.c
new file mode 100644
index 0000000..cfcead2
--- /dev/null
+++ b/usr.bin/truss/amd64-freebsd32.c
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/amd64-freebsd32-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+amd64_freebsd32_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ unsigned int args32[narg];
+ unsigned long parm_offset;
+ lwpid_t tid;
+ u_int i;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+ parm_offset = regs.r_rsp + sizeof(int);
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ switch (regs.r_rax) {
+ case SYS_syscall:
+ parm_offset += sizeof(int);
+ break;
+ case SYS___syscall:
+ parm_offset += sizeof(quad_t);
+ break;
+ }
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)parm_offset;
+ iorequest.piod_addr = args32;
+ iorequest.piod_len = sizeof(args32);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0) {
+ return (-1);
+ }
+
+ for (i = 0; i < narg; i++)
+ cs->args[i] = args32[i];
+ return (0);
+}
+
+static int
+amd64_freebsd32_fetch_retval(struct trussinfo *trussinfo, long *retval,
+ int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_rax & 0xffffffff;
+ retval[1] = regs.r_rdx & 0xffffffff;
+ *errorp = !!(regs.r_rflags & PSL_C);
+ return (0);
+}
+
+static struct procabi amd64_freebsd32 = {
+ "FreeBSD ELF32",
+ SYSDECODE_ABI_FREEBSD32,
+ amd64_freebsd32_fetch_args,
+ amd64_freebsd32_fetch_retval
+};
+
+PROCABI(amd64_freebsd32);
+
+static struct procabi amd64_freebsd32_aout = {
+ "FreeBSD a.out",
+ SYSDECODE_ABI_FREEBSD32,
+ amd64_freebsd32_fetch_args,
+ amd64_freebsd32_fetch_retval
+};
+
+PROCABI(amd64_freebsd32_aout);
diff --git a/usr.bin/truss/amd64-linux.c b/usr.bin/truss/amd64-linux.c
new file mode 100644
index 0000000..4397804
--- /dev/null
+++ b/usr.bin/truss/amd64-linux.c
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* Linux/x86_64-specific system call handling. */
+
+#include <sys/ptrace.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+amd64_linux_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ switch (narg) {
+ default:
+ cs->args[5] = regs.r_r9;
+ case 5:
+ cs->args[4] = regs.r_r8;
+ case 4:
+ cs->args[3] = regs.r_rcx;
+ case 3:
+ cs->args[2] = regs.r_rdx;
+ case 2:
+ cs->args[1] = regs.r_rsi;
+ case 1:
+ cs->args[0] = regs.r_rdi;
+ }
+
+ return (0);
+}
+
+static int
+amd64_linux_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_rax;
+ retval[1] = regs.r_rdx;
+ *errorp = !!(regs.r_rflags & PSL_C);
+ return (0);
+}
+
+static struct procabi amd64_linux = {
+ "Linux ELF64",
+ SYSDECODE_ABI_LINUX,
+ amd64_linux_fetch_args,
+ amd64_linux_fetch_retval
+};
+
+PROCABI(amd64_linux);
diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c
new file mode 100644
index 0000000..279d228
--- /dev/null
+++ b/usr.bin/truss/amd64-linux32.c
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* Linux/i386-specific system call handling. */
+
+#include <sys/ptrace.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+amd64_linux32_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * Linux passes syscall arguments in registers, not
+ * on the stack. Fortunately, we've got access to the
+ * register set. Note that we don't bother checking the
+ * number of arguments. And what does linux do for syscalls
+ * that have more than five arguments?
+ */
+ switch (narg) {
+ default:
+ cs->args[5] = regs.r_rbp; /* Unconfirmed */
+ case 5:
+ cs->args[4] = regs.r_rdi;
+ case 4:
+ cs->args[3] = regs.r_rsi;
+ case 3:
+ cs->args[2] = regs.r_rdx;
+ case 2:
+ cs->args[1] = regs.r_rcx;
+ case 1:
+ cs->args[0] = regs.r_rbx;
+ }
+
+ return (0);
+}
+
+static int
+amd64_linux32_fetch_retval(struct trussinfo *trussinfo, long *retval,
+ int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_rax & 0xffffffff;
+ retval[1] = regs.r_rdx & 0xffffffff;
+ *errorp = !!(regs.r_rflags & PSL_C);
+ if (*errorp)
+ retval[0] = (int)retval[0];
+ return (0);
+}
+
+static struct procabi amd64_linux32 = {
+ "Linux ELF32",
+ SYSDECODE_ABI_LINUX32,
+ amd64_linux32_fetch_args,
+ amd64_linux32_fetch_retval
+};
+
+PROCABI(amd64_linux32);
diff --git a/usr.bin/truss/arm-freebsd.c b/usr.bin/truss/arm-freebsd.c
new file mode 100644
index 0000000..a1b2b21
--- /dev/null
+++ b/usr.bin/truss/arm-freebsd.c
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/arm-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/armreg.h>
+#include <machine/ucontext.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+arm_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+#ifdef __ARM_EABI__
+ syscall_num = regs.r[7];
+#else
+ if ((syscall_num = ptrace(PT_READ_I, tid,
+ (caddr_t)(regs.r[_REG_PC] - INSN_SIZE), 0)) == -1) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ PC --\n");
+ return (-1);
+ }
+ syscall_num = syscall_num & 0x000fffff;
+#endif
+
+ reg = 0;
+ switch (syscall_num) {
+ case SYS_syscall:
+ reg = 1;
+ break;
+ case SYS___syscall:
+ reg = 2;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < 4; i++, reg++)
+ cs->args[i] = regs.r[reg];
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_sp +
+ 4 * sizeof(uint32_t));
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(cs->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+arm_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /* XXX: Does not have the __ARMEB__ handling for __syscall(). */
+ retval[0] = regs.r[0];
+ retval[1] = regs.r[1];
+ *errorp = !!(regs.r_cpsr & PSR_C);
+ return (0);
+}
+
+static struct procabi arm_freebsd = {
+ "FreeBSD ELF32",
+ SYSDECODE_ABI_FREEBSD,
+ arm_fetch_args,
+ arm_fetch_retval
+};
+
+PROCABI(arm_freebsd);
diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h
new file mode 100644
index 0000000..5ce3d3b
--- /dev/null
+++ b/usr.bin/truss/extern.h
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+extern int print_line_prefix(struct trussinfo *);
+extern void setup_and_wait(struct trussinfo *, char **);
+extern void start_tracing(struct trussinfo *, pid_t);
+extern void restore_proc(int);
+extern void eventloop(struct trussinfo *);
+extern const char *ioctlname(unsigned long val);
+extern char *strsig(int sig);
diff --git a/usr.bin/truss/i386-freebsd.c b/usr.bin/truss/i386-freebsd.c
new file mode 100644
index 0000000..bf35af2
--- /dev/null
+++ b/usr.bin/truss/i386-freebsd.c
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/i386-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+i386_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ unsigned int parm_offset;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+ parm_offset = regs.r_esp + sizeof(int);
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ switch (regs.r_eax) {
+ case SYS_syscall:
+ parm_offset += sizeof(int);
+ break;
+ case SYS___syscall:
+ parm_offset += sizeof(quad_t);
+ break;
+ }
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)parm_offset;
+ iorequest.piod_addr = cs->args;
+ iorequest.piod_len = narg * sizeof(unsigned long);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+
+ return (0);
+}
+
+static int
+i386_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_eax;
+ retval[1] = regs.r_edx;
+ *errorp = !!(regs.r_eflags & PSL_C);
+ return (0);
+}
+
+static struct procabi i386_freebsd = {
+ "FreeBSD ELF32",
+ SYSDECODE_ABI_FREEBSD,
+ i386_fetch_args,
+ i386_fetch_retval
+};
+
+PROCABI(i386_freebsd);
+
+static struct procabi i386_freebsd_aout = {
+ "FreeBSD a.out",
+ SYSDECODE_ABI_FREEBSD,
+ i386_fetch_args,
+ i386_fetch_retval
+};
+
+PROCABI(i386_freebsd_aout);
+
diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c
new file mode 100644
index 0000000..52232b4
--- /dev/null
+++ b/usr.bin/truss/i386-linux.c
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* Linux/i386-specific system call handling. */
+
+#include <sys/ptrace.h>
+
+#include <machine/reg.h>
+#include <machine/psl.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+i386_linux_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * Linux passes syscall arguments in registers, not
+ * on the stack. Fortunately, we've got access to the
+ * register set. Note that we don't bother checking the
+ * number of arguments. And what does linux do for syscalls
+ * that have more than five arguments?
+ */
+ switch (narg) {
+ default:
+ cs->args[5] = regs.r_ebp; /* Unconfirmed */
+ case 5:
+ cs->args[4] = regs.r_edi;
+ case 4:
+ cs->args[3] = regs.r_esi;
+ case 3:
+ cs->args[2] = regs.r_edx;
+ case 2:
+ cs->args[1] = regs.r_ecx;
+ case 1:
+ cs->args[0] = regs.r_ebx;
+ }
+
+ return (0);
+}
+
+static int
+i386_linux_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_eax;
+ retval[1] = regs.r_edx;
+ *errorp = !!(regs.r_eflags & PSL_C);
+ return (0);
+}
+
+static struct procabi i386_linux = {
+ "Linux ELF",
+ SYSDECODE_ABI_LINUX,
+ i386_linux_fetch_args,
+ i386_linux_fetch_retval
+};
+
+PROCABI(i386_linux);
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
new file mode 100644
index 0000000..38626fd
--- /dev/null
+++ b/usr.bin/truss/main.c
@@ -0,0 +1,215 @@
+/*-
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * The main module for truss. Surprisingly simple, but, then, the other
+ * files handle the bulk of the work. And, of course, the kernel has to
+ * do a lot of the work :).
+ */
+
+#include <sys/ptrace.h>
+
+#include <err.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sysdecode.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "truss.h"
+#include "extern.h"
+#include "syscall.h"
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+ "usage: truss [-cfaedDS] [-o file] [-s strsize] -p pid",
+ " truss [-cfaedDS] [-o file] [-s strsize] command [args]");
+ exit(1);
+}
+
+char *
+strsig(int sig)
+{
+ static char tmp[64];
+
+ if (sig > 0 && sig < NSIG) {
+ snprintf(tmp, sizeof(tmp), "SIG%s", sys_signame[sig]);
+ return (tmp);
+ }
+ return (NULL);
+}
+
+int
+main(int ac, char **av)
+{
+ struct sigaction sa;
+ struct trussinfo *trussinfo;
+ char *fname;
+ char **command;
+ pid_t pid;
+ int c;
+
+ fname = NULL;
+
+ /* Initialize the trussinfo struct */
+ trussinfo = (struct trussinfo *)calloc(1, sizeof(struct trussinfo));
+ if (trussinfo == NULL)
+ errx(1, "calloc() failed");
+
+ pid = 0;
+ trussinfo->outfile = stderr;
+ trussinfo->strsize = 32;
+ trussinfo->curthread = NULL;
+ LIST_INIT(&trussinfo->proclist);
+ init_syscalls();
+ while ((c = getopt(ac, av, "p:o:facedDs:SH")) != -1) {
+ switch (c) {
+ case 'p': /* specified pid */
+ pid = atoi(optarg);
+ /* make sure i don't trace me */
+ if (pid == getpid()) {
+ errx(2, "attempt to grab self.");
+ }
+ break;
+ case 'f': /* Follow fork()'s */
+ trussinfo->flags |= FOLLOWFORKS;
+ break;
+ case 'a': /* Print execve() argument strings. */
+ trussinfo->flags |= EXECVEARGS;
+ break;
+ case 'c': /* Count number of system calls and time. */
+ trussinfo->flags |= (COUNTONLY | NOSIGS);
+ break;
+ case 'e': /* Print execve() environment strings. */
+ trussinfo->flags |= EXECVEENVS;
+ break;
+ case 'd': /* Absolute timestamps */
+ trussinfo->flags |= ABSOLUTETIMESTAMPS;
+ break;
+ case 'D': /* Relative timestamps */
+ trussinfo->flags |= RELATIVETIMESTAMPS;
+ break;
+ case 'o': /* Specified output file */
+ fname = optarg;
+ break;
+ case 's': /* Specified string size */
+ trussinfo->strsize = atoi(optarg);
+ break;
+ case 'S': /* Don't trace signals */
+ trussinfo->flags |= NOSIGS;
+ break;
+ case 'H':
+ trussinfo->flags |= DISPLAYTIDS;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ ac -= optind; av += optind;
+ if ((pid == 0 && ac == 0) ||
+ (pid != 0 && ac != 0))
+ usage();
+
+ if (fname != NULL) { /* Use output file */
+ /*
+ * Set close-on-exec ('e'), so that the output file is not
+ * shared with the traced process.
+ */
+ if ((trussinfo->outfile = fopen(fname, "we")) == NULL)
+ err(1, "cannot open %s", fname);
+ }
+
+ /*
+ * If truss starts the process itself, it will ignore some signals --
+ * they should be passed off to the process, which may or may not
+ * exit. If, however, we are examining an already-running process,
+ * then we restore the event mask on these same signals.
+ */
+ if (pid == 0) {
+ /* Start a command ourselves */
+ command = av;
+ setup_and_wait(trussinfo, command);
+ signal(SIGINT, SIG_IGN);
+ signal(SIGTERM, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
+ } else {
+ sa.sa_handler = restore_proc;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGQUIT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+ start_tracing(trussinfo, pid);
+ }
+
+ /*
+ * At this point, if we started the process, it is stopped waiting to
+ * be woken up, either in exit() or in execve().
+ */
+ if (LIST_FIRST(&trussinfo->proclist)->abi == NULL) {
+ /*
+ * If we are not able to handle this ABI, detach from the
+ * process and exit. If we just created a new process to
+ * run a command, kill the new process rather than letting
+ * it run untraced.
+ */
+ if (pid == 0)
+ kill(LIST_FIRST(&trussinfo->proclist)->pid, SIGKILL);
+ ptrace(PT_DETACH, LIST_FIRST(&trussinfo->proclist)->pid, NULL,
+ 0);
+ return (1);
+ }
+ ptrace(PT_SYSCALL, LIST_FIRST(&trussinfo->proclist)->pid, (caddr_t)1,
+ 0);
+
+ /*
+ * At this point, it's a simple loop, waiting for the process to
+ * stop, finding out why, printing out why, and then continuing it.
+ * All of the grunt work is done in the support routines.
+ */
+ clock_gettime(CLOCK_REALTIME, &trussinfo->start_time);
+
+ eventloop(trussinfo);
+
+ if (trussinfo->flags & COUNTONLY)
+ print_summary(trussinfo);
+
+ fflush(trussinfo->outfile);
+
+ return (0);
+}
diff --git a/usr.bin/truss/makesyscallsconf.sh b/usr.bin/truss/makesyscallsconf.sh
new file mode 100755
index 0000000..81eb78e
--- /dev/null
+++ b/usr.bin/truss/makesyscallsconf.sh
@@ -0,0 +1,21 @@
+#! /bin/sh
+# $FreeBSD$
+
+ABI="$1"
+CONF="$2"
+
+header="${ABI}_syscalls.h"
+
+cat > "${CONF}" << EOF
+sysnames="${header}.tmp"
+sysproto="/dev/null"
+sysproto_h="/dev/null"
+syshdr="/dev/null"
+sysmk="/dev/null"
+syssw="/dev/null"
+syshide="/dev/null"
+syscallprefix="SYS_"
+switchname="sysent"
+namesname="syscallnames"
+systrace="/dev/null"
+EOF
diff --git a/usr.bin/truss/mips-freebsd.c b/usr.bin/truss/mips-freebsd.c
new file mode 100644
index 0000000..3a42a59
--- /dev/null
+++ b/usr.bin/truss/mips-freebsd.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 1998 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/mips-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/frame.h>
+#include <machine/reg.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+mips_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ reg = A0;
+ switch (regs.r_regs[V0]) {
+ case SYS_syscall:
+ reg = A1;
+ break;
+ case SYS___syscall:
+#if defined(__mips_n32) || defined(__mips_n64)
+ reg = A1;
+#else
+ reg = A2;
+#endif
+ break;
+ }
+
+#if defined(__mips_n32) || defined(__mips_n64)
+#define MAXREG A7
+#else
+#define MAXREG A3
+#endif
+
+ for (i = 0; i < narg && reg <= MAXREG; i++, reg++)
+ cs->args[i] = regs.r_regs[reg];
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)((uintptr_t)regs.r_regs[SP] +
+ 4 * sizeof(cs->args[0]));
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(cs->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+mips_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /* XXX: Does not have special handling for __syscall(). */
+ retval[0] = regs.r_regs[V0];
+ retval[1] = regs.r_regs[V1];
+ *errorp = !!regs.r_regs[A3];
+ return (0);
+}
+
+
+static struct procabi mips_freebsd = {
+#ifdef __mips_n64
+ "FreeBSD ELF64",
+#else
+ "FreeBSD ELF32",
+#endif
+ SYSDECODE_ABI_FREEBSD,
+ mips_fetch_args,
+ mips_fetch_retval
+};
+
+PROCABI(mips_freebsd);
diff --git a/usr.bin/truss/powerpc-freebsd.c b/usr.bin/truss/powerpc-freebsd.c
new file mode 100644
index 0000000..ee78d03
--- /dev/null
+++ b/usr.bin/truss/powerpc-freebsd.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2006 Peter Grehan <grehan@freebsd.org>
+ * Copyright 2005 Orlando Bassotto <orlando@break.net>
+ * Copyright 1998 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.
+ *
+ * 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$");
+
+/* FreeBSD/powerpc-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/frame.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+powerpc_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ reg = 0;
+ switch (regs.fixreg[0]) {
+ case SYS_syscall:
+ reg += 1;
+ break;
+ case SYS___syscall:
+ reg += 2;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < NARGREG; i++, reg++) {
+ cs->args[i] = regs.fixreg[FIRSTARG + reg];
+ }
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.fixreg[1] + 8);
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(cs->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+powerpc_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /* XXX: Does not have fixup for __syscall(). */
+ retval[0] = regs.fixreg[3];
+ retval[1] = regs.fixreg[4];
+ *errorp = !!(regs.cr & 0x10000000);
+ return (0);
+}
+
+static struct procabi powerpc_freebsd = {
+ "FreeBSD ELF32",
+ SYSDECODE_ABI_FREEBSD,
+ powerpc_fetch_args,
+ powerpc_fetch_retval
+};
+
+PROCABI(powerpc_freebsd);
diff --git a/usr.bin/truss/powerpc64-freebsd.c b/usr.bin/truss/powerpc64-freebsd.c
new file mode 100644
index 0000000..cc64cd6
--- /dev/null
+++ b/usr.bin/truss/powerpc64-freebsd.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2006 Peter Grehan <grehan@freebsd.org>
+ * Copyright 2005 Orlando Bassotto <orlando@break.net>
+ * Copyright 1998 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.
+ *
+ * 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$");
+
+/* FreeBSD/powerpc64-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/frame.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+powerpc64_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ reg = 0;
+ switch (regs.fixreg[0]) {
+ case SYS_syscall:
+ case SYS___syscall:
+ reg += 1;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < NARGREG; i++, reg++)
+ cs->args[i] = regs.fixreg[FIRSTARG + reg];
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.fixreg[1] + 48);
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(cs->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+powerpc64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.fixreg[3];
+ retval[1] = regs.fixreg[4];
+ *errorp = !!(regs.cr & 0x10000000);
+ return (0);
+}
+
+static struct procabi powerpc64_freebsd = {
+ "FreeBSD ELF64",
+ SYSDECODE_ABI_FREEBSD,
+ powerpc64_fetch_args,
+ powerpc64_fetch_retval
+};
+
+PROCABI(powerpc64_freebsd);
diff --git a/usr.bin/truss/powerpc64-freebsd32.c b/usr.bin/truss/powerpc64-freebsd32.c
new file mode 100644
index 0000000..c6f3b10
--- /dev/null
+++ b/usr.bin/truss/powerpc64-freebsd32.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2006 Peter Grehan <grehan@freebsd.org>
+ * Copyright 2005 Orlando Bassotto <orlando@break.net>
+ * Copyright 1998 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.
+ *
+ * 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$");
+
+/* FreeBSD/powerpc64-freebsd32-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/frame.h>
+
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+powerpc64_freebsd32_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ reg = 0;
+ switch (regs.fixreg[0]) {
+ case SYS_syscall:
+ reg += 1;
+ break;
+ case SYS___syscall:
+ reg += 2;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < NARGREG; i++, reg++) {
+ cs->args[i] = regs.fixreg[FIRSTARG + reg] & 0xffffffff;
+ }
+ if (narg > i) {
+ uint32_t args32[narg - i];
+ u_int j;
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.fixreg[1] + 8);
+ iorequest.piod_addr = args32;
+ iorequest.piod_len = sizeof(args32);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ for (j = 0; j < narg - i; j++)
+ cs->args[i + j] = args32[j];
+ }
+
+ return (0);
+}
+
+static int
+powerpc64_freebsd32_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /* XXX: Does not have fixup for __syscall(). */
+ retval[0] = regs.fixreg[3] & 0xffffffff;
+ retval[1] = regs.fixreg[4] & 0xffffffff;
+ *errorp = !!(regs.cr & 0x10000000);
+ return (0);
+}
+
+static struct procabi powerpc64_freebsd32 = {
+ "FreeBSD ELF32",
+ SYSDECODE_ABI_FREEBSD32,
+ powerpc64_freebsd32_fetch_args,
+ powerpc64_freebsd32_fetch_retval
+};
+
+PROCABI(powerpc64_freebsd32);
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
new file mode 100644
index 0000000..c134405
--- /dev/null
+++ b/usr.bin/truss/setup.c
@@ -0,0 +1,688 @@
+/*-
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * Various setup functions for truss. Not the cleanest-written code,
+ * I'm afraid.
+ */
+
+#include <sys/ptrace.h>
+#include <sys/sysctl.h>
+#include <sys/wait.h>
+
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdecode.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "truss.h"
+#include "syscall.h"
+#include "extern.h"
+
+SET_DECLARE(procabi, struct procabi);
+
+static sig_atomic_t detaching;
+
+static void enter_syscall(struct trussinfo *, struct threadinfo *,
+ struct ptrace_lwpinfo *);
+static void new_proc(struct trussinfo *, pid_t, lwpid_t);
+
+/*
+ * setup_and_wait() is called to start a process. All it really does
+ * is fork(), enable tracing in the child, and then exec the given
+ * command. At that point, the child process stops, and the parent
+ * can wake up and deal with it.
+ */
+void
+setup_and_wait(struct trussinfo *info, char *command[])
+{
+ pid_t pid;
+
+ pid = vfork();
+ if (pid == -1)
+ err(1, "fork failed");
+ if (pid == 0) { /* Child */
+ ptrace(PT_TRACE_ME, 0, 0, 0);
+ execvp(command[0], command);
+ err(1, "execvp %s", command[0]);
+ }
+
+ /* Only in the parent here */
+ if (waitpid(pid, NULL, 0) < 0)
+ err(1, "unexpect stop in waitpid");
+
+ new_proc(info, pid, 0);
+}
+
+/*
+ * start_tracing is called to attach to an existing process.
+ */
+void
+start_tracing(struct trussinfo *info, pid_t pid)
+{
+ int ret, retry;
+
+ retry = 10;
+ do {
+ ret = ptrace(PT_ATTACH, pid, NULL, 0);
+ usleep(200);
+ } while (ret && retry-- > 0);
+ if (ret)
+ err(1, "can not attach to target process");
+
+ if (waitpid(pid, NULL, 0) < 0)
+ err(1, "Unexpect stop in waitpid");
+
+ new_proc(info, pid, 0);
+}
+
+/*
+ * Restore a process back to it's pre-truss state.
+ * Called for SIGINT, SIGTERM, SIGQUIT. This only
+ * applies if truss was told to monitor an already-existing
+ * process.
+ */
+void
+restore_proc(int signo __unused)
+{
+
+ detaching = 1;
+}
+
+static void
+detach_proc(pid_t pid)
+{
+
+ /* stop the child so that we can detach */
+ kill(pid, SIGSTOP);
+ if (waitpid(pid, NULL, 0) < 0)
+ err(1, "Unexpected stop in waitpid");
+
+ if (ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0)
+ err(1, "Can not detach the process");
+
+ kill(pid, SIGCONT);
+}
+
+/*
+ * Determine the ABI. This is called after every exec, and when
+ * a process is first monitored.
+ */
+static struct procabi *
+find_abi(pid_t pid)
+{
+ struct procabi **pabi;
+ size_t len;
+ int error;
+ int mib[4];
+ char progt[32];
+
+ len = sizeof(progt);
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_SV_NAME;
+ mib[3] = pid;
+ error = sysctl(mib, 4, progt, &len, NULL, 0);
+ if (error != 0)
+ err(2, "can not get sysvec name");
+
+ SET_FOREACH(pabi, procabi) {
+ if (strcmp((*pabi)->type, progt) == 0)
+ return (*pabi);
+ }
+ warnx("ABI %s for pid %ld is not supported", progt, (long)pid);
+ return (NULL);
+}
+
+static struct threadinfo *
+new_thread(struct procinfo *p, lwpid_t lwpid)
+{
+ struct threadinfo *nt;
+
+ /*
+ * If this happens it means there is a bug in truss. Unfortunately
+ * this will kill any processes truss is attached to.
+ */
+ LIST_FOREACH(nt, &p->threadlist, entries) {
+ if (nt->tid == lwpid)
+ errx(1, "Duplicate thread for LWP %ld", (long)lwpid);
+ }
+
+ nt = calloc(1, sizeof(struct threadinfo));
+ if (nt == NULL)
+ err(1, "calloc() failed");
+ nt->proc = p;
+ nt->tid = lwpid;
+ LIST_INSERT_HEAD(&p->threadlist, nt, entries);
+ return (nt);
+}
+
+static void
+free_thread(struct threadinfo *t)
+{
+
+ LIST_REMOVE(t, entries);
+ free(t);
+}
+
+static void
+add_threads(struct trussinfo *info, struct procinfo *p)
+{
+ struct ptrace_lwpinfo pl;
+ struct threadinfo *t;
+ lwpid_t *lwps;
+ int i, nlwps;
+
+ nlwps = ptrace(PT_GETNUMLWPS, p->pid, NULL, 0);
+ if (nlwps == -1)
+ err(1, "Unable to fetch number of LWPs");
+ assert(nlwps > 0);
+ lwps = calloc(nlwps, sizeof(*lwps));
+ nlwps = ptrace(PT_GETLWPLIST, p->pid, (caddr_t)lwps, nlwps);
+ if (nlwps == -1)
+ err(1, "Unable to fetch LWP list");
+ for (i = 0; i < nlwps; i++) {
+ t = new_thread(p, lwps[i]);
+ if (ptrace(PT_LWPINFO, lwps[i], (caddr_t)&pl, sizeof(pl)) == -1)
+ err(1, "ptrace(PT_LWPINFO)");
+ if (pl.pl_flags & PL_FLAG_SCE)
+ enter_syscall(info, t, &pl);
+ }
+ free(lwps);
+}
+
+static void
+new_proc(struct trussinfo *info, pid_t pid, lwpid_t lwpid)
+{
+ struct procinfo *np;
+
+ /*
+ * If this happens it means there is a bug in truss. Unfortunately
+ * this will kill any processes truss is attached to.
+ */
+ LIST_FOREACH(np, &info->proclist, entries) {
+ if (np->pid == pid)
+ errx(1, "Duplicate process for pid %ld", (long)pid);
+ }
+
+ if (info->flags & FOLLOWFORKS)
+ if (ptrace(PT_FOLLOW_FORK, pid, NULL, 1) == -1)
+ err(1, "Unable to follow forks for pid %ld", (long)pid);
+ if (ptrace(PT_LWP_EVENTS, pid, NULL, 1) == -1)
+ err(1, "Unable to enable LWP events for pid %ld", (long)pid);
+ np = calloc(1, sizeof(struct procinfo));
+ np->pid = pid;
+ np->abi = find_abi(pid);
+ LIST_INIT(&np->threadlist);
+ LIST_INSERT_HEAD(&info->proclist, np, entries);
+
+ if (lwpid != 0)
+ new_thread(np, lwpid);
+ else
+ add_threads(info, np);
+}
+
+static void
+free_proc(struct procinfo *p)
+{
+ struct threadinfo *t, *t2;
+
+ LIST_FOREACH_SAFE(t, &p->threadlist, entries, t2) {
+ free(t);
+ }
+ LIST_REMOVE(p, entries);
+ free(p);
+}
+
+static void
+detach_all_procs(struct trussinfo *info)
+{
+ struct procinfo *p, *p2;
+
+ LIST_FOREACH_SAFE(p, &info->proclist, entries, p2) {
+ detach_proc(p->pid);
+ free_proc(p);
+ }
+}
+
+static struct procinfo *
+find_proc(struct trussinfo *info, pid_t pid)
+{
+ struct procinfo *np;
+
+ LIST_FOREACH(np, &info->proclist, entries) {
+ if (np->pid == pid)
+ return (np);
+ }
+
+ return (NULL);
+}
+
+/*
+ * Change curthread member based on (pid, lwpid).
+ */
+static void
+find_thread(struct trussinfo *info, pid_t pid, lwpid_t lwpid)
+{
+ struct procinfo *np;
+ struct threadinfo *nt;
+
+ np = find_proc(info, pid);
+ assert(np != NULL);
+
+ LIST_FOREACH(nt, &np->threadlist, entries) {
+ if (nt->tid == lwpid) {
+ info->curthread = nt;
+ return;
+ }
+ }
+ errx(1, "could not find thread");
+}
+
+/*
+ * When a process exits, it should have exactly one thread left.
+ * All of the other threads should have reported thread exit events.
+ */
+static void
+find_exit_thread(struct trussinfo *info, pid_t pid)
+{
+ struct procinfo *p;
+
+ p = find_proc(info, pid);
+ assert(p != NULL);
+
+ info->curthread = LIST_FIRST(&p->threadlist);
+ assert(info->curthread != NULL);
+ assert(LIST_NEXT(info->curthread, entries) == NULL);
+}
+
+static void
+alloc_syscall(struct threadinfo *t, struct ptrace_lwpinfo *pl)
+{
+ u_int i;
+
+ assert(t->in_syscall == 0);
+ assert(t->cs.number == 0);
+ assert(t->cs.name == NULL);
+ assert(t->cs.nargs == 0);
+ for (i = 0; i < nitems(t->cs.s_args); i++)
+ assert(t->cs.s_args[i] == NULL);
+ memset(t->cs.args, 0, sizeof(t->cs.args));
+ t->cs.number = pl->pl_syscall_code;
+ t->in_syscall = 1;
+}
+
+static void
+free_syscall(struct threadinfo *t)
+{
+ u_int i;
+
+ for (i = 0; i < t->cs.nargs; i++)
+ free(t->cs.s_args[i]);
+ memset(&t->cs, 0, sizeof(t->cs));
+ t->in_syscall = 0;
+}
+
+static void
+enter_syscall(struct trussinfo *info, struct threadinfo *t,
+ struct ptrace_lwpinfo *pl)
+{
+ struct syscall *sc;
+ u_int i, narg;
+
+ alloc_syscall(t, pl);
+ narg = MIN(pl->pl_syscall_narg, nitems(t->cs.args));
+ if (narg != 0 && t->proc->abi->fetch_args(info, narg) != 0) {
+ free_syscall(t);
+ return;
+ }
+
+ t->cs.name = sysdecode_syscallname(t->proc->abi->abi, t->cs.number);
+ if (t->cs.name == NULL)
+ fprintf(info->outfile, "-- UNKNOWN %s SYSCALL %d --\n",
+ t->proc->abi->type, t->cs.number);
+
+ sc = get_syscall(t->cs.name, narg);
+ t->cs.nargs = sc->nargs;
+ assert(sc->nargs <= nitems(t->cs.s_args));
+
+ t->cs.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 (t->cs.name != NULL) {
+#if DEBUG
+ fprintf(stderr, "syscall %s(", t->cs.name);
+#endif
+ for (i = 0; i < t->cs.nargs; i++) {
+#if DEBUG
+ fprintf(stderr, "0x%lx%s", sc ?
+ t->cs.args[sc->args[i].offset] : t->cs.args[i],
+ i < (t->cs.nargs - 1) ? "," : "");
+#endif
+ if (!(sc->args[i].type & OUT)) {
+ t->cs.s_args[i] = print_arg(&sc->args[i],
+ t->cs.args, 0, info);
+ }
+ }
+#if DEBUG
+ fprintf(stderr, ")\n");
+#endif
+ }
+
+ clock_gettime(CLOCK_REALTIME, &t->before);
+}
+
+/*
+ * When a thread exits voluntarily (including when a thread calls
+ * exit() to trigger a process exit), the thread's internal state
+ * holds the arguments passed to the exit system call. When the
+ * thread's exit is reported, log that system call without a return
+ * value.
+ */
+static void
+thread_exit_syscall(struct trussinfo *info)
+{
+ struct threadinfo *t;
+
+ t = info->curthread;
+ if (!t->in_syscall)
+ return;
+
+ clock_gettime(CLOCK_REALTIME, &t->after);
+
+ print_syscall_ret(info, 0, NULL);
+ free_syscall(t);
+}
+
+static void
+exit_syscall(struct trussinfo *info, struct ptrace_lwpinfo *pl)
+{
+ struct threadinfo *t;
+ struct procinfo *p;
+ struct syscall *sc;
+ long retval[2];
+ u_int i;
+ int errorp;
+
+ t = info->curthread;
+ if (!t->in_syscall)
+ return;
+
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ p = t->proc;
+ if (p->abi->fetch_retval(info, retval, &errorp) < 0) {
+ free_syscall(t);
+ return;
+ }
+
+ sc = t->cs.sc;
+ /*
+ * Here, we only look for arguments that have OUT masked in --
+ * otherwise, they were handled in enter_syscall().
+ */
+ 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",
+ t->cs.args[sc->args[i].offset]);
+ } else {
+ temp = print_arg(&sc->args[i],
+ t->cs.args, retval, info);
+ }
+ t->cs.s_args[i] = temp;
+ }
+ }
+
+ print_syscall_ret(info, errorp, retval);
+ free_syscall(t);
+
+ /*
+ * If the process executed a new image, check the ABI. If the
+ * new ABI isn't supported, stop tracing this process.
+ */
+ if (pl->pl_flags & PL_FLAG_EXEC) {
+ assert(LIST_NEXT(LIST_FIRST(&p->threadlist), entries) == NULL);
+ p->abi = find_abi(p->pid);
+ if (p->abi == NULL) {
+ if (ptrace(PT_DETACH, p->pid, (caddr_t)1, 0) < 0)
+ err(1, "Can not detach the process");
+ free_proc(p);
+ }
+ }
+}
+
+int
+print_line_prefix(struct trussinfo *info)
+{
+ struct timespec timediff;
+ struct threadinfo *t;
+ int len;
+
+ len = 0;
+ t = info->curthread;
+ if (info->flags & (FOLLOWFORKS | DISPLAYTIDS)) {
+ if (info->flags & FOLLOWFORKS)
+ len += fprintf(info->outfile, "%5d", t->proc->pid);
+ if ((info->flags & (FOLLOWFORKS | DISPLAYTIDS)) ==
+ (FOLLOWFORKS | DISPLAYTIDS))
+ len += fprintf(info->outfile, " ");
+ if (info->flags & DISPLAYTIDS)
+ len += fprintf(info->outfile, "%6d", t->tid);
+ len += fprintf(info->outfile, ": ");
+ }
+ if (info->flags & ABSOLUTETIMESTAMPS) {
+ timespecsubt(&t->after, &info->start_time, &timediff);
+ len += fprintf(info->outfile, "%jd.%09ld ",
+ (intmax_t)timediff.tv_sec, timediff.tv_nsec);
+ }
+ if (info->flags & RELATIVETIMESTAMPS) {
+ timespecsubt(&t->after, &t->before, &timediff);
+ len += fprintf(info->outfile, "%jd.%09ld ",
+ (intmax_t)timediff.tv_sec, timediff.tv_nsec);
+ }
+ return (len);
+}
+
+static void
+report_thread_death(struct trussinfo *info)
+{
+ struct threadinfo *t;
+
+ t = info->curthread;
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ print_line_prefix(info);
+ fprintf(info->outfile, "<thread %ld exited>\n", (long)t->tid);
+}
+
+static void
+report_thread_birth(struct trussinfo *info)
+{
+ struct threadinfo *t;
+
+ t = info->curthread;
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ t->before = t->after;
+ print_line_prefix(info);
+ fprintf(info->outfile, "<new thread %ld>\n", (long)t->tid);
+}
+
+static void
+report_exit(struct trussinfo *info, siginfo_t *si)
+{
+ struct threadinfo *t;
+
+ t = info->curthread;
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ print_line_prefix(info);
+ if (si->si_code == CLD_EXITED)
+ fprintf(info->outfile, "process exit, rval = %u\n",
+ si->si_status);
+ else
+ fprintf(info->outfile, "process killed, signal = %u%s\n",
+ si->si_status, si->si_code == CLD_DUMPED ?
+ " (core dumped)" : "");
+}
+
+static void
+report_new_child(struct trussinfo *info)
+{
+ struct threadinfo *t;
+
+ t = info->curthread;
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ t->before = t->after;
+ print_line_prefix(info);
+ fprintf(info->outfile, "<new process>\n");
+}
+
+static void
+report_signal(struct trussinfo *info, siginfo_t *si)
+{
+ struct threadinfo *t;
+ char *signame;
+
+ t = info->curthread;
+ clock_gettime(CLOCK_REALTIME, &t->after);
+ print_line_prefix(info);
+ signame = strsig(si->si_status);
+ fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status,
+ signame == NULL ? "?" : signame);
+}
+
+/*
+ * Wait for events until all the processes have exited or truss has been
+ * asked to stop.
+ */
+void
+eventloop(struct trussinfo *info)
+{
+ struct ptrace_lwpinfo pl;
+ siginfo_t si;
+ int pending_signal;
+
+ while (!LIST_EMPTY(&info->proclist)) {
+ if (detaching) {
+ detach_all_procs(info);
+ return;
+ }
+
+ if (waitid(P_ALL, 0, &si, WTRAPPED | WEXITED) == -1) {
+ if (errno == EINTR)
+ continue;
+ err(1, "Unexpected error from waitid");
+ }
+
+ assert(si.si_signo == SIGCHLD);
+
+ switch (si.si_code) {
+ case CLD_EXITED:
+ case CLD_KILLED:
+ case CLD_DUMPED:
+ find_exit_thread(info, si.si_pid);
+ if ((info->flags & COUNTONLY) == 0) {
+ if (si.si_code == CLD_EXITED)
+ thread_exit_syscall(info);
+ report_exit(info, &si);
+ }
+ free_proc(info->curthread->proc);
+ info->curthread = NULL;
+ break;
+ case CLD_TRAPPED:
+ if (ptrace(PT_LWPINFO, si.si_pid, (caddr_t)&pl,
+ sizeof(pl)) == -1)
+ err(1, "ptrace(PT_LWPINFO)");
+
+ if (pl.pl_flags & PL_FLAG_CHILD) {
+ new_proc(info, si.si_pid, pl.pl_lwpid);
+ assert(LIST_FIRST(&info->proclist)->abi !=
+ NULL);
+ } else if (pl.pl_flags & PL_FLAG_BORN)
+ new_thread(find_proc(info, si.si_pid),
+ pl.pl_lwpid);
+ find_thread(info, si.si_pid, pl.pl_lwpid);
+
+ if (si.si_status == SIGTRAP &&
+ (pl.pl_flags & (PL_FLAG_BORN|PL_FLAG_EXITED|
+ PL_FLAG_SCE|PL_FLAG_SCX)) != 0) {
+ if (pl.pl_flags & PL_FLAG_BORN) {
+ if ((info->flags & COUNTONLY) == 0)
+ report_thread_birth(info);
+ } else if (pl.pl_flags & PL_FLAG_EXITED) {
+ if ((info->flags & COUNTONLY) == 0)
+ report_thread_death(info);
+ free_thread(info->curthread);
+ info->curthread = NULL;
+ } else if (pl.pl_flags & PL_FLAG_SCE)
+ enter_syscall(info, info->curthread, &pl);
+ else if (pl.pl_flags & PL_FLAG_SCX)
+ exit_syscall(info, &pl);
+ pending_signal = 0;
+ } else if (pl.pl_flags & PL_FLAG_CHILD) {
+ if ((info->flags & COUNTONLY) == 0)
+ report_new_child(info);
+ pending_signal = 0;
+ } else {
+ if ((info->flags & NOSIGS) == 0)
+ report_signal(info, &si);
+ pending_signal = si.si_status;
+ }
+ ptrace(PT_SYSCALL, si.si_pid, (caddr_t)1,
+ pending_signal);
+ break;
+ case CLD_STOPPED:
+ errx(1, "waitid reported CLD_STOPPED");
+ case CLD_CONTINUED:
+ break;
+ }
+ }
+}
diff --git a/usr.bin/truss/sparc64-freebsd.c b/usr.bin/truss/sparc64-freebsd.c
new file mode 100644
index 0000000..a8569c0
--- /dev/null
+++ b/usr.bin/truss/sparc64-freebsd.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright 1998 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/* FreeBSD/sparc64-specific system call handling. */
+
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/frame.h>
+#include <machine/reg.h>
+#include <machine/tstate.h>
+
+#include <stddef.h>
+#include <stdio.h>
+#include <sysdecode.h>
+
+#include "truss.h"
+
+static int
+sparc64_fetch_args(struct trussinfo *trussinfo, u_int narg)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct current_syscall *cs;
+ lwpid_t tid;
+ u_int i, reg;
+
+ tid = trussinfo->curthread->tid;
+ cs = &trussinfo->curthread->cs;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ /*
+ * FreeBSD has two special kinds of system call redirections --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ *
+ * The system call argument count and code from ptrace() already
+ * account for these, but we need to skip over the first argument.
+ */
+ reg = 0;
+ switch (regs.r_global[1]) {
+ case SYS_syscall:
+ case SYS___syscall:
+ reg = 1;
+ break;
+ }
+
+ for (i = 0; i < narg && reg < 6; i++, reg++)
+ cs->args[i] = regs.r_out[reg];
+ if (narg > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_out[6] + SPOFF +
+ offsetof(struct frame, fr_pad[6]));
+ iorequest.piod_addr = &cs->args[i];
+ iorequest.piod_len = (narg - i) * sizeof(cs->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+sparc64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp)
+{
+ struct reg regs;
+ lwpid_t tid;
+
+ tid = trussinfo->curthread->tid;
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval[0] = regs.r_out[0];
+ retval[1] = regs.r_out[1];
+ *errorp = !!(regs.r_tstate & TSTATE_XCC_C);
+ return (0);
+}
+
+static struct procabi sparc64_freebsd = {
+ "FreeBSD ELF64",
+ SYSDECODE_ABI_FREEBSD,
+ sparc64_fetch_args,
+ sparc64_fetch_retval
+};
+
+PROCABI(sparc64_freebsd);
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
new file mode 100644
index 0000000..906f799
--- /dev/null
+++ b/usr.bin/truss/syscall.h
@@ -0,0 +1,123 @@
+/*
+ * See i386-fbsd.c for copyright and license terms.
+ *
+ * System call arguments come in several flavours:
+ * Hex -- values that should be printed in hex (addresses)
+ * Octal -- Same as above, but octal
+ * Int -- normal integer values (file descriptors, for example)
+ * LongHex -- long value that should be printed in hex
+ * Name -- pointer to a NULL-terminated string.
+ * BinString -- pointer to an array of chars, printed via strvisx().
+ * Ptr -- pointer to some unspecified structure. Just print as hex for now.
+ * Stat -- a pointer to a stat buffer. Prints a couple fields.
+ * StatFs -- a pointer to a statfs buffer. Prints a few fields.
+ * Ioctl -- an ioctl command. Woefully limited.
+ * Quad -- a double-word value. e.g., lseek(int, offset_t, int)
+ * Signal -- a signal number. Prints the signal name (SIGxxx)
+ * Sockaddr -- a pointer to a struct sockaddr. Prints symbolic AF, and IP:Port
+ * StringArray -- a pointer to an array of string pointers.
+ * Timespec -- a pointer to a struct timespec. Prints both elements.
+ * Timeval -- a pointer to a struct timeval. Prints both elements.
+ * Timeval2 -- a pointer to two struct timevals. Prints both elements of both.
+ * Itimerval -- a pointer to a struct itimerval. Prints all elements.
+ * Pollfd -- a pointer to an array of struct pollfd. Prints .fd and .events.
+ * Fd_set -- a pointer to an array of fd_set. Prints the fds that are set.
+ * Sigaction -- a pointer to a struct sigaction. Prints all elements.
+ * Sigset -- a pointer to a sigset_t. Prints the signals that are set.
+ * Sigprocmask -- the first argument to sigprocmask(). Prints the name.
+ * Kevent -- a pointer to an array of struct kevents. Prints all elements.
+ * Pathconf -- the 2nd argument of pathconf().
+ * Utrace -- utrace(2) buffer.
+ *
+ * In addition, the pointer types (String, Ptr) may have OUT masked in --
+ * this means that the data is set on *return* from the system call -- or
+ * IN (meaning that the data is passed *into* the system call).
+ */
+/*
+ * $FreeBSD$
+ */
+
+enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl,
+ Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval,
+ Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
+ Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
+ Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
+ Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
+ LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
+ Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray,
+
+ CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
+ CloudABIFDStat, CloudABIFileStat, CloudABIFileType,
+ CloudABIFSFlags, CloudABILookup, CloudABIMFlags, CloudABIMProt,
+ CloudABIMSFlags, CloudABIOFlags, CloudABISDFlags,
+ CloudABISignal, CloudABISockStat, CloudABISSFlags,
+ CloudABITimestamp, CloudABIULFlags, CloudABIWhence };
+
+#define ARG_MASK 0xff
+#define OUT 0x100
+#define IN /*0x20*/0
+
+struct syscall_args {
+ enum Argtype type;
+ int offset;
+};
+
+struct syscall {
+ STAILQ_ENTRY(syscall) entries;
+ const char *name;
+ u_int ret_type; /* 0, 1, or 2 return values */
+ u_int nargs; /* actual number of meaningful arguments */
+ /* Hopefully, no syscalls with > 10 args */
+ struct syscall_args args[10];
+ struct timespec time; /* Time spent for this call */
+ int ncalls; /* Number of calls */
+ int nerror; /* Number of calls that returned with error */
+};
+
+struct syscall *get_syscall(const char *, int nargs);
+char *print_arg(struct syscall_args *, unsigned long*, long *, struct trussinfo *);
+
+/*
+ * Linux Socket defines
+ */
+#define LINUX_SOCKET 1
+#define LINUX_BIND 2
+#define LINUX_CONNECT 3
+#define LINUX_LISTEN 4
+#define LINUX_ACCEPT 5
+#define LINUX_GETSOCKNAME 6
+#define LINUX_GETPEERNAME 7
+#define LINUX_SOCKETPAIR 8
+#define LINUX_SEND 9
+#define LINUX_RECV 10
+#define LINUX_SENDTO 11
+#define LINUX_RECVFROM 12
+#define LINUX_SHUTDOWN 13
+#define LINUX_SETSOCKOPT 14
+#define LINUX_GETSOCKOPT 15
+#define LINUX_SENDMSG 16
+#define LINUX_RECVMSG 17
+
+#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
+ 0 : sizeof(register_t) - sizeof(t))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define PADL_(t) 0
+#define PADR_(t) PAD_(t)
+#else
+#define PADL_(t) PAD_(t)
+#define PADR_(t) 0
+#endif
+
+typedef int l_int;
+typedef uint32_t l_ulong;
+
+struct linux_socketcall_args {
+ char what_l_[PADL_(l_int)]; l_int what; char what_r_[PADR_(l_int)];
+ char args_l_[PADL_(l_ulong)]; l_ulong args; char args_r_[PADR_(l_ulong)];
+};
+
+void init_syscalls(void);
+void print_syscall(struct trussinfo *);
+void print_syscall_ret(struct trussinfo *, int, long *);
+void print_summary(struct trussinfo *trussinfo);
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
new file mode 100644
index 0000000..3bf7b9d
--- /dev/null
+++ b/usr.bin/truss/syscalls.c
@@ -0,0 +1,2114 @@
+/*
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * This file has routines used to print out system calls and their
+ * arguments.
+ */
+
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/ioccom.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/procctl.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/umtx.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <machine/sysarch.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdecode.h>
+#include <time.h>
+#include <unistd.h>
+#include <vis.h>
+
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
+#include "truss.h"
+#include "extern.h"
+#include "syscall.h"
+
+/* 64-bit alignment on 32-bit platforms. */
+#if !defined(__LP64__) && defined(__powerpc__)
+#define QUAD_ALIGN 1
+#else
+#define QUAD_ALIGN 0
+#endif
+
+/* Number of slots needed for a 64-bit argument. */
+#ifdef __LP64__
+#define QUAD_SLOTS 1
+#else
+#define QUAD_SLOTS 2
+#endif
+
+/*
+ * This should probably be in its own file, sorted alphabetically.
+ */
+static struct syscall decoded_syscalls[] = {
+ /* Native ABI */
+ { .name = "__getcwd", .ret_type = 1, .nargs = 2,
+ .args = { { Name | OUT, 0 }, { Int, 1 } } },
+ { .name = "_umtx_op", .ret_type = 1, .nargs = 5,
+ .args = { { Ptr, 0 }, { Umtxop, 1 }, { LongHex, 2 }, { Ptr, 3 },
+ { Ptr, 4 } } },
+ { .name = "accept", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
+ { .name = "access", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Accessmode, 1 } } },
+ { .name = "bind", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } },
+ { .name = "bindat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 },
+ { Int, 3 } } },
+ { .name = "break", .ret_type = 1, .nargs = 1,
+ .args = { { Ptr, 0 } } },
+ { .name = "chdir", .ret_type = 1, .nargs = 1,
+ .args = { { Name, 0 } } },
+ { .name = "chflags", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Hex, 1 } } },
+ { .name = "chmod", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
+ { .name = "chown", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } },
+ { .name = "chroot", .ret_type = 1, .nargs = 1,
+ .args = { { Name, 0 } } },
+ { .name = "clock_gettime", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Timespec | OUT, 1 } } },
+ { .name = "close", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "connect", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } },
+ { .name = "connectat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 },
+ { Int, 3 } } },
+ { .name = "eaccess", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Accessmode, 1 } } },
+ { .name = "execve", .ret_type = 1, .nargs = 3,
+ .args = { { Name | IN, 0 }, { ExecArgs | IN, 1 },
+ { ExecEnv | IN, 2 } } },
+ { .name = "exit", .ret_type = 0, .nargs = 1,
+ .args = { { Hex, 0 } } },
+ { .name = "faccessat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Accessmode, 2 },
+ { Atflags, 3 } } },
+ { .name = "fchmod", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Octal, 1 } } },
+ { .name = "fchmodat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Atflags, 3 } } },
+ { .name = "fchown", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { Int, 2 } } },
+ { .name = "fchownat", .ret_type = 1, .nargs = 5,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Int, 2 }, { Int, 3 },
+ { Atflags, 4 } } },
+ { .name = "fcntl", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Fcntl, 1 }, { Fcntlflag, 2 } } },
+ { .name = "fstat", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Stat | OUT, 1 } } },
+ { .name = "fstatat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Stat | OUT, 2 },
+ { Atflags, 3 } } },
+ { .name = "fstatfs", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { StatFs | OUT, 1 } } },
+ { .name = "ftruncate", .ret_type = 1, .nargs = 2,
+ .args = { { Int | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } },
+ { .name = "futimens", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Timespec2 | IN, 1 } } },
+ { .name = "futimes", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Timeval2 | IN, 1 } } },
+ { .name = "futimesat", .ret_type = 1, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timeval2 | IN, 2 } } },
+ { .name = "getitimer", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Itimerval | OUT, 2 } } },
+ { .name = "getpeername", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
+ { .name = "getpgid", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "getrlimit", .ret_type = 1, .nargs = 2,
+ .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } },
+ { .name = "getrusage", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Rusage | OUT, 1 } } },
+ { .name = "getsid", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "getsockname", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
+ { .name = "gettimeofday", .ret_type = 1, .nargs = 2,
+ .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } },
+ { .name = "ioctl", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Ioctl, 1 }, { Hex, 2 } } },
+ { .name = "kevent", .ret_type = 1, .nargs = 6,
+ .args = { { Int, 0 }, { Kevent, 1 }, { Int, 2 }, { Kevent | OUT, 3 },
+ { Int, 4 }, { Timespec, 5 } } },
+ { .name = "kill", .ret_type = 1, .nargs = 2,
+ .args = { { Int | IN, 0 }, { Signal | IN, 1 } } },
+ { .name = "kldfind", .ret_type = 1, .nargs = 1,
+ .args = { { Name | IN, 0 } } },
+ { .name = "kldfirstmod", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "kldload", .ret_type = 1, .nargs = 1,
+ .args = { { Name | IN, 0 } } },
+ { .name = "kldnext", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "kldstat", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Ptr, 1 } } },
+ { .name = "kldunload", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "kse_release", .ret_type = 0, .nargs = 1,
+ .args = { { Timespec, 0 } } },
+ { .name = "lchflags", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Hex, 1 } } },
+ { .name = "lchmod", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
+ { .name = "lchown", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } },
+ { .name = "link", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Name, 1 } } },
+ { .name = "linkat", .ret_type = 1, .nargs = 5,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 },
+ { Atflags, 4 } } },
+ { .name = "lseek", .ret_type = 2, .nargs = 3,
+ .args = { { Int, 0 }, { QuadHex, 1 + QUAD_ALIGN },
+ { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } },
+ { .name = "lstat", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } },
+ { .name = "lutimes", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } },
+ { .name = "mkdir", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
+ { .name = "mkdirat", .ret_type = 1, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } },
+ { .name = "mkfifo", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
+ { .name = "mkfifoat", .ret_type = 1, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } },
+ { .name = "mknod", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } },
+ { .name = "mknodat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } },
+ { .name = "mmap", .ret_type = 1, .nargs = 6,
+ .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 },
+ { Int, 4 }, { QuadHex, 5 + QUAD_ALIGN } } },
+ { .name = "modfind", .ret_type = 1, .nargs = 1,
+ .args = { { Name | IN, 0 } } },
+ { .name = "mount", .ret_type = 1, .nargs = 4,
+ .args = { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } },
+ { .name = "mprotect", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } },
+ { .name = "munmap", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Int, 1 } } },
+ { .name = "nanosleep", .ret_type = 1, .nargs = 1,
+ .args = { { Timespec, 0 } } },
+ { .name = "open", .ret_type = 1, .nargs = 3,
+ .args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } },
+ { .name = "openat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Open, 2 },
+ { Octal, 3 } } },
+ { .name = "pathconf", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Pathconf, 1 } } },
+ { .name = "pipe", .ret_type = 1, .nargs = 1,
+ .args = { { PipeFds | OUT, 0 } } },
+ { .name = "pipe2", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Open, 1 } } },
+ { .name = "poll", .ret_type = 1, .nargs = 3,
+ .args = { { Pollfd, 0 }, { Int, 1 }, { Int, 2 } } },
+ { .name = "posix_openpt", .ret_type = 1, .nargs = 1,
+ .args = { { Open, 0 } } },
+ { .name = "procctl", .ret_type = 1, .nargs = 4,
+ .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN },
+ { Procctl, 1 + QUAD_ALIGN + QUAD_SLOTS },
+ { Ptr, 2 + QUAD_ALIGN + QUAD_SLOTS } } },
+ { .name = "read", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 } } },
+ { .name = "readlink", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Int, 2 } } },
+ { .name = "readlinkat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 },
+ { Int, 3 } } },
+ { .name = "recvfrom", .ret_type = 1, .nargs = 6,
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 },
+ { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } },
+ { .name = "rename", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Name, 1 } } },
+ { .name = "renameat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
+ { .name = "rfork", .ret_type = 1, .nargs = 1,
+ .args = { { Rforkflags, 0 } } },
+ { .name = "select", .ret_type = 1, .nargs = 5,
+ .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 },
+ { Timeval, 4 } } },
+ { .name = "sendto", .ret_type = 1, .nargs = 6,
+ .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 },
+ { Sockaddr | IN, 4 }, { Ptr | IN, 5 } } },
+ { .name = "setitimer", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } },
+ { .name = "setrlimit", .ret_type = 1, .nargs = 2,
+ .args = { { Resource, 0 }, { Rlimit | IN, 1 } } },
+ { .name = "shutdown", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Shutdown, 1 } } },
+ { .name = "sigaction", .ret_type = 1, .nargs = 3,
+ .args = { { Signal, 0 }, { Sigaction | IN, 1 },
+ { Sigaction | OUT, 2 } } },
+ { .name = "sigpending", .ret_type = 1, .nargs = 1,
+ .args = { { Sigset | OUT, 0 } } },
+ { .name = "sigprocmask", .ret_type = 1, .nargs = 3,
+ .args = { { Sigprocmask, 0 }, { Sigset, 1 }, { Sigset | OUT, 2 } } },
+ { .name = "sigqueue", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Signal, 1 }, { LongHex, 2 } } },
+ { .name = "sigreturn", .ret_type = 1, .nargs = 1,
+ .args = { { Ptr, 0 } } },
+ { .name = "sigsuspend", .ret_type = 1, .nargs = 1,
+ .args = { { Sigset | IN, 0 } } },
+ { .name = "sigtimedwait", .ret_type = 1, .nargs = 3,
+ .args = { { Sigset | IN, 0 }, { Ptr, 1 }, { Timespec | IN, 2 } } },
+ { .name = "sigwait", .ret_type = 1, .nargs = 2,
+ .args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
+ { .name = "sigwaitinfo", .ret_type = 1, .nargs = 2,
+ .args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
+ { .name = "socket", .ret_type = 1, .nargs = 3,
+ .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } },
+ { .name = "stat", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } },
+ { .name = "statfs", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { StatFs | OUT, 1 } } },
+ { .name = "symlink", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Name, 1 } } },
+ { .name = "symlinkat", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Atfd, 1 }, { Name, 2 } } },
+ { .name = "sysarch", .ret_type = 1, .nargs = 2,
+ .args = { { Sysarch, 0 }, { Ptr, 1 } } },
+ { .name = "thr_kill", .ret_type = 1, .nargs = 2,
+ .args = { { Long, 0 }, { Signal, 1 } } },
+ { .name = "thr_self", .ret_type = 1, .nargs = 1,
+ .args = { { Ptr, 0 } } },
+ { .name = "truncate", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } },
+#if 0
+ /* Does not exist */
+ { .name = "umount", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Int, 2 } } },
+#endif
+ { .name = "unlink", .ret_type = 1, .nargs = 1,
+ .args = { { Name, 0 } } },
+ { .name = "unlinkat", .ret_type = 1, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Atflags, 2 } } },
+ { .name = "unmount", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Int, 1 } } },
+ { .name = "utimensat", .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timespec2 | IN, 2 },
+ { Atflags, 3 } } },
+ { .name = "utimes", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } },
+ { .name = "utrace", .ret_type = 1, .nargs = 1,
+ .args = { { Utrace, 0 } } },
+ { .name = "wait4", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { ExitStatus | OUT, 1 }, { Waitoptions, 2 },
+ { Rusage | OUT, 3 } } },
+ { .name = "wait6", .ret_type = 1, .nargs = 6,
+ .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN },
+ { ExitStatus | OUT, 1 + QUAD_ALIGN + QUAD_SLOTS },
+ { Waitoptions, 2 + QUAD_ALIGN + QUAD_SLOTS },
+ { Rusage | OUT, 3 + QUAD_ALIGN + QUAD_SLOTS },
+ { Ptr, 4 + QUAD_ALIGN + QUAD_SLOTS } } },
+ { .name = "write", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 } } },
+
+ /* Linux ABI */
+ { .name = "linux_access", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Accessmode, 1 } } },
+ { .name = "linux_execve", .ret_type = 1, .nargs = 3,
+ .args = { { Name | IN, 0 }, { ExecArgs | IN, 1 },
+ { ExecEnv | IN, 2 } } },
+ { .name = "linux_lseek", .ret_type = 2, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } },
+ { .name = "linux_mkdir", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Int, 1 } } },
+ { .name = "linux_newfstat", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Ptr | OUT, 1 } } },
+ { .name = "linux_newstat", .ret_type = 1, .nargs = 2,
+ .args = { { Name | IN, 0 }, { Ptr | OUT, 1 } } },
+ { .name = "linux_open", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } },
+ { .name = "linux_readlink", .ret_type = 1, .nargs = 3,
+ .args = { { Name, 0 }, { Name | OUT, 1 }, { Int, 2 } } },
+ { .name = "linux_socketcall", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { LinuxSockArgs, 1 } } },
+ { .name = "linux_stat64", .ret_type = 1, .nargs = 3,
+ .args = { { Name | IN, 0 }, { Ptr | OUT, 1 }, { Ptr | IN, 1 } } },
+
+ /* CloudABI system calls. */
+ { .name = "cloudabi_sys_clock_res_get", .ret_type = 1, .nargs = 1,
+ .args = { { CloudABIClockID, 0 } } },
+ { .name = "cloudabi_sys_clock_time_get", .ret_type = 1, .nargs = 2,
+ .args = { { CloudABIClockID, 0 }, { CloudABITimestamp, 1 } } },
+ { .name = "cloudabi_sys_condvar_signal", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { CloudABIMFlags, 1 }, { UInt, 2 } } },
+ { .name = "cloudabi_sys_fd_close", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "cloudabi_sys_fd_create1", .ret_type = 1, .nargs = 1,
+ .args = { { CloudABIFileType, 0 } } },
+ { .name = "cloudabi_sys_fd_create2", .ret_type = 1, .nargs = 2,
+ .args = { { CloudABIFileType, 0 }, { PipeFds | OUT, 0 } } },
+ { .name = "cloudabi_sys_fd_datasync", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "cloudabi_sys_fd_dup", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "cloudabi_sys_fd_replace", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_fd_seek", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { CloudABIWhence, 2 } } },
+ { .name = "cloudabi_sys_fd_stat_get", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CloudABIFDStat | OUT, 1 } } },
+ { .name = "cloudabi_sys_fd_stat_put", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { CloudABIFDStat | IN, 1 },
+ { ClouduABIFDSFlags, 2 } } },
+ { .name = "cloudabi_sys_fd_sync", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "cloudabi_sys_file_advise", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { Int, 1 }, { Int, 2 },
+ { CloudABIAdvice, 3 } } },
+ { .name = "cloudabi_sys_file_allocate", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { Int, 2 } } },
+ { .name = "cloudabi_sys_file_create", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { BinString | IN, 1 },
+ { CloudABIFileType, 3 } } },
+ { .name = "cloudabi_sys_file_link", .ret_type = 1, .nargs = 4,
+ .args = { { CloudABILookup, 0 }, { BinString | IN, 1 },
+ { Int, 3 }, { BinString | IN, 4 } } },
+ { .name = "cloudabi_sys_file_open", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | IN, 1 },
+ { CloudABIOFlags, 3 }, { CloudABIFDStat | IN, 4 } } },
+ { .name = "cloudabi_sys_file_readdir", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 },
+ { Int, 3 } } },
+ { .name = "cloudabi_sys_file_readlink", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | IN, 1 },
+ { BinString | OUT, 3 }, { Int, 4 } } },
+ { .name = "cloudabi_sys_file_rename", .ret_type = 1, .nargs = 4,
+ .args = { { Int, 0 }, { BinString | IN, 1 },
+ { Int, 3 }, { BinString | IN, 4 } } },
+ { .name = "cloudabi_sys_file_stat_fget", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CloudABIFileStat | OUT, 1 } } },
+ { .name = "cloudabi_sys_file_stat_fput", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { CloudABIFileStat | IN, 1 },
+ { CloudABIFSFlags, 2 } } },
+ { .name = "cloudabi_sys_file_stat_get", .ret_type = 1, .nargs = 3,
+ .args = { { CloudABILookup, 0 }, { BinString | IN, 1 },
+ { CloudABIFileStat | OUT, 3 } } },
+ { .name = "cloudabi_sys_file_stat_put", .ret_type = 1, .nargs = 4,
+ .args = { { CloudABILookup, 0 }, { BinString | IN, 1 },
+ { CloudABIFileStat | IN, 3 }, { CloudABIFSFlags, 4 } } },
+ { .name = "cloudabi_sys_file_symlink", .ret_type = 1, .nargs = 3,
+ .args = { { BinString | IN, 0 },
+ { Int, 2 }, { BinString | IN, 3 } } },
+ { .name = "cloudabi_sys_file_unlink", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { BinString | IN, 1 },
+ { CloudABIULFlags, 3 } } },
+ { .name = "cloudabi_sys_lock_unlock", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { CloudABIMFlags, 1 } } },
+ { .name = "cloudabi_sys_mem_advise", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIAdvice, 2 } } },
+ { .name = "cloudabi_sys_mem_lock", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_mem_map", .ret_type = 1, .nargs = 6,
+ .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 },
+ { CloudABIMFlags, 3 }, { Int, 4 }, { Int, 5 } } },
+ { .name = "cloudabi_sys_mem_protect", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 } } },
+ { .name = "cloudabi_sys_mem_sync", .ret_type = 1, .nargs = 3,
+ .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMSFlags, 2 } } },
+ { .name = "cloudabi_sys_mem_unlock", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_mem_unmap", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_proc_exec", .ret_type = 1, .nargs = 5,
+ .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 },
+ { IntArray, 3 }, { Int, 4 } } },
+ { .name = "cloudabi_sys_proc_exit", .ret_type = 1, .nargs = 1,
+ .args = { { Int, 0 } } },
+ { .name = "cloudabi_sys_proc_fork", .ret_type = 1, .nargs = 0 },
+ { .name = "cloudabi_sys_proc_raise", .ret_type = 1, .nargs = 1,
+ .args = { { CloudABISignal, 0 } } },
+ { .name = "cloudabi_sys_random_get", .ret_type = 1, .nargs = 2,
+ .args = { { BinString | OUT, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_sock_accept", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CloudABISockStat | OUT, 1 } } },
+ { .name = "cloudabi_sys_sock_bind", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { BinString | IN, 2 } } },
+ { .name = "cloudabi_sys_sock_connect", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { Int, 1 }, { BinString | IN, 2 } } },
+ { .name = "cloudabi_sys_sock_listen", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Int, 1 } } },
+ { .name = "cloudabi_sys_sock_shutdown", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CloudABISDFlags, 1 } } },
+ { .name = "cloudabi_sys_sock_stat_get", .ret_type = 1, .nargs = 3,
+ .args = { { Int, 0 }, { CloudABISockStat | OUT, 1 },
+ { CloudABISSFlags, 2 } } },
+ { .name = "cloudabi_sys_thread_exit", .ret_type = 1, .nargs = 2,
+ .args = { { Ptr, 0 }, { CloudABIMFlags, 1 } } },
+ { .name = "cloudabi_sys_thread_tcb_set", .ret_type = 1, .nargs = 1,
+ .args = { { Ptr, 0 } } },
+ { .name = "cloudabi_sys_thread_yield", .ret_type = 1, .nargs = 0 },
+
+ { .name = 0 },
+};
+static STAILQ_HEAD(, syscall) syscalls;
+
+/* Xlat idea taken from strace */
+struct xlat {
+ int val;
+ const char *str;
+};
+
+#define X(a) { a, #a },
+#define XEND { 0, NULL }
+
+static struct xlat kevent_filters[] = {
+ X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE)
+ X(EVFILT_PROC) X(EVFILT_SIGNAL) X(EVFILT_TIMER)
+ X(EVFILT_PROCDESC) X(EVFILT_FS) X(EVFILT_LIO) X(EVFILT_USER)
+ X(EVFILT_SENDFILE) XEND
+};
+
+static struct xlat kevent_flags[] = {
+ X(EV_ADD) X(EV_DELETE) X(EV_ENABLE) X(EV_DISABLE) X(EV_ONESHOT)
+ X(EV_CLEAR) X(EV_RECEIPT) X(EV_DISPATCH) X(EV_FORCEONESHOT)
+ X(EV_DROP) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND
+};
+
+static struct xlat kevent_user_ffctrl[] = {
+ X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY)
+ XEND
+};
+
+static struct xlat kevent_rdwr_fflags[] = {
+ X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND
+};
+
+static struct xlat kevent_vnode_fflags[] = {
+ X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB)
+ X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) XEND
+};
+
+static struct xlat kevent_proc_fflags[] = {
+ X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR)
+ X(NOTE_CHILD) XEND
+};
+
+static struct xlat kevent_timer_fflags[] = {
+ X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS)
+ XEND
+};
+
+static struct xlat poll_flags[] = {
+ X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR)
+ X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND)
+ X(POLLWRBAND) X(POLLINIGNEOF) XEND
+};
+
+static struct xlat mmap_flags[] = {
+ X(MAP_SHARED) X(MAP_PRIVATE) X(MAP_FIXED) X(MAP_RESERVED0020)
+ X(MAP_RESERVED0040) X(MAP_RESERVED0080) X(MAP_RESERVED0100)
+ X(MAP_HASSEMAPHORE) X(MAP_STACK) X(MAP_NOSYNC) X(MAP_ANON)
+ X(MAP_EXCL) X(MAP_NOCORE) X(MAP_PREFAULT_READ)
+#ifdef MAP_32BIT
+ X(MAP_32BIT)
+#endif
+ XEND
+};
+
+static struct xlat mprot_flags[] = {
+ X(PROT_NONE) X(PROT_READ) X(PROT_WRITE) X(PROT_EXEC) XEND
+};
+
+static struct xlat whence_arg[] = {
+ X(SEEK_SET) X(SEEK_CUR) X(SEEK_END) X(SEEK_DATA) X(SEEK_HOLE) XEND
+};
+
+static struct xlat sigaction_flags[] = {
+ X(SA_ONSTACK) X(SA_RESTART) X(SA_RESETHAND) X(SA_NOCLDSTOP)
+ X(SA_NODEFER) X(SA_NOCLDWAIT) X(SA_SIGINFO) XEND
+};
+
+static struct xlat fcntl_arg[] = {
+ X(F_DUPFD) X(F_GETFD) X(F_SETFD) X(F_GETFL) X(F_SETFL)
+ X(F_GETOWN) X(F_SETOWN) X(F_OGETLK) X(F_OSETLK) X(F_OSETLKW)
+ X(F_DUP2FD) X(F_GETLK) X(F_SETLK) X(F_SETLKW) X(F_SETLK_REMOTE)
+ X(F_READAHEAD) X(F_RDAHEAD) X(F_DUPFD_CLOEXEC) X(F_DUP2FD_CLOEXEC)
+ XEND
+};
+
+static struct xlat fcntlfd_arg[] = {
+ X(FD_CLOEXEC) XEND
+};
+
+static struct xlat fcntlfl_arg[] = {
+ X(O_APPEND) X(O_ASYNC) X(O_FSYNC) X(O_NONBLOCK) X(O_NOFOLLOW)
+ X(FRDAHEAD) X(O_DIRECT) XEND
+};
+
+static struct xlat sockdomain_arg[] = {
+ X(PF_UNSPEC) X(PF_LOCAL) X(PF_UNIX) X(PF_INET) X(PF_IMPLINK)
+ X(PF_PUP) X(PF_CHAOS) X(PF_NETBIOS) X(PF_ISO) X(PF_OSI)
+ X(PF_ECMA) X(PF_DATAKIT) X(PF_CCITT) X(PF_SNA) X(PF_DECnet)
+ X(PF_DLI) X(PF_LAT) X(PF_HYLINK) X(PF_APPLETALK) X(PF_ROUTE)
+ X(PF_LINK) X(PF_XTP) X(PF_COIP) X(PF_CNT) X(PF_SIP) X(PF_IPX)
+ X(PF_RTIP) X(PF_PIP) X(PF_ISDN) X(PF_KEY) X(PF_INET6)
+ X(PF_NATM) X(PF_ATM) X(PF_NETGRAPH) X(PF_SLOW) X(PF_SCLUSTER)
+ X(PF_ARP) X(PF_BLUETOOTH) X(PF_IEEE80211) X(PF_INET_SDP)
+ X(PF_INET6_SDP) XEND
+};
+
+static struct xlat socktype_arg[] = {
+ X(SOCK_STREAM) X(SOCK_DGRAM) X(SOCK_RAW) X(SOCK_RDM)
+ X(SOCK_SEQPACKET) XEND
+};
+
+static struct xlat open_flags[] = {
+ X(O_RDONLY) X(O_WRONLY) X(O_RDWR) X(O_ACCMODE) X(O_NONBLOCK)
+ X(O_APPEND) X(O_SHLOCK) X(O_EXLOCK) X(O_ASYNC) X(O_FSYNC)
+ X(O_NOFOLLOW) X(O_CREAT) X(O_TRUNC) X(O_EXCL) X(O_NOCTTY)
+ X(O_DIRECT) X(O_DIRECTORY) X(O_EXEC) X(O_TTY_INIT) X(O_CLOEXEC)
+ X(O_VERIFY) XEND
+};
+
+static struct xlat shutdown_arg[] = {
+ X(SHUT_RD) X(SHUT_WR) X(SHUT_RDWR) XEND
+};
+
+static struct xlat resource_arg[] = {
+ X(RLIMIT_CPU) X(RLIMIT_FSIZE) X(RLIMIT_DATA) X(RLIMIT_STACK)
+ X(RLIMIT_CORE) X(RLIMIT_RSS) X(RLIMIT_MEMLOCK) X(RLIMIT_NPROC)
+ X(RLIMIT_NOFILE) X(RLIMIT_SBSIZE) X(RLIMIT_VMEM) X(RLIMIT_NPTS)
+ X(RLIMIT_SWAP) X(RLIMIT_KQUEUES) XEND
+};
+
+static struct xlat pathconf_arg[] = {
+ X(_PC_LINK_MAX) X(_PC_MAX_CANON) X(_PC_MAX_INPUT)
+ X(_PC_NAME_MAX) X(_PC_PATH_MAX) X(_PC_PIPE_BUF)
+ X(_PC_CHOWN_RESTRICTED) X(_PC_NO_TRUNC) X(_PC_VDISABLE)
+ X(_PC_ASYNC_IO) X(_PC_PRIO_IO) X(_PC_SYNC_IO)
+ X(_PC_ALLOC_SIZE_MIN) X(_PC_FILESIZEBITS)
+ X(_PC_REC_INCR_XFER_SIZE) X(_PC_REC_MAX_XFER_SIZE)
+ X(_PC_REC_MIN_XFER_SIZE) X(_PC_REC_XFER_ALIGN)
+ X(_PC_SYMLINK_MAX) X(_PC_ACL_EXTENDED) X(_PC_ACL_PATH_MAX)
+ X(_PC_CAP_PRESENT) X(_PC_INF_PRESENT) X(_PC_MAC_PRESENT)
+ X(_PC_ACL_NFS4) X(_PC_MIN_HOLE_SIZE) XEND
+};
+
+static struct xlat rfork_flags[] = {
+ X(RFFDG) X(RFPROC) X(RFMEM) X(RFNOWAIT) X(RFCFDG) X(RFTHREAD)
+ X(RFSIGSHARE) X(RFLINUXTHPN) X(RFTSIGZMB) X(RFPPWAIT) XEND
+};
+
+static struct xlat wait_options[] = {
+ X(WNOHANG) X(WUNTRACED) X(WCONTINUED) X(WNOWAIT) X(WEXITED)
+ X(WTRAPPED) XEND
+};
+
+static struct xlat idtype_arg[] = {
+ X(P_PID) X(P_PPID) X(P_PGID) X(P_SID) X(P_CID) X(P_UID) X(P_GID)
+ X(P_ALL) X(P_LWPID) X(P_TASKID) X(P_PROJID) X(P_POOLID) X(P_JAILID)
+ X(P_CTID) X(P_CPUID) X(P_PSETID) XEND
+};
+
+static struct xlat procctl_arg[] = {
+ X(PROC_SPROTECT) X(PROC_REAP_ACQUIRE) X(PROC_REAP_RELEASE)
+ X(PROC_REAP_STATUS) X(PROC_REAP_GETPIDS) X(PROC_REAP_KILL)
+ X(PROC_TRACE_CTL) X(PROC_TRACE_STATUS) XEND
+};
+
+static struct xlat umtx_ops[] = {
+ X(UMTX_OP_RESERVED0) X(UMTX_OP_RESERVED1) X(UMTX_OP_WAIT)
+ X(UMTX_OP_WAKE) X(UMTX_OP_MUTEX_TRYLOCK) X(UMTX_OP_MUTEX_LOCK)
+ X(UMTX_OP_MUTEX_UNLOCK) X(UMTX_OP_SET_CEILING) X(UMTX_OP_CV_WAIT)
+ X(UMTX_OP_CV_SIGNAL) X(UMTX_OP_CV_BROADCAST) X(UMTX_OP_WAIT_UINT)
+ X(UMTX_OP_RW_RDLOCK) X(UMTX_OP_RW_WRLOCK) X(UMTX_OP_RW_UNLOCK)
+ X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE)
+ X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT)
+ X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2)
+ X(UMTX_OP_SEM2_WAIT) X(UMTX_OP_SEM2_WAKE)
+ XEND
+};
+
+static struct xlat at_flags[] = {
+ X(AT_EACCESS) X(AT_SYMLINK_NOFOLLOW) X(AT_SYMLINK_FOLLOW)
+ X(AT_REMOVEDIR) XEND
+};
+
+static struct xlat access_modes[] = {
+ X(R_OK) X(W_OK) X(X_OK) XEND
+};
+
+static struct xlat sysarch_ops[] = {
+#if defined(__i386__) || defined(__amd64__)
+ X(I386_GET_LDT) X(I386_SET_LDT) X(I386_GET_IOPERM) X(I386_SET_IOPERM)
+ X(I386_VM86) X(I386_GET_FSBASE) X(I386_SET_FSBASE) X(I386_GET_GSBASE)
+ X(I386_SET_GSBASE) X(I386_GET_XFPUSTATE) X(AMD64_GET_FSBASE)
+ X(AMD64_SET_FSBASE) X(AMD64_GET_GSBASE) X(AMD64_SET_GSBASE)
+ X(AMD64_GET_XFPUSTATE)
+#endif
+ XEND
+};
+
+static struct xlat linux_socketcall_ops[] = {
+ X(LINUX_SOCKET) X(LINUX_BIND) X(LINUX_CONNECT) X(LINUX_LISTEN)
+ X(LINUX_ACCEPT) X(LINUX_GETSOCKNAME) X(LINUX_GETPEERNAME)
+ X(LINUX_SOCKETPAIR) X(LINUX_SEND) X(LINUX_RECV) X(LINUX_SENDTO)
+ X(LINUX_RECVFROM) X(LINUX_SHUTDOWN) X(LINUX_SETSOCKOPT)
+ X(LINUX_GETSOCKOPT) X(LINUX_SENDMSG) X(LINUX_RECVMSG)
+ XEND
+};
+
+static struct xlat sigprocmask_ops[] = {
+ X(SIG_BLOCK) X(SIG_UNBLOCK) X(SIG_SETMASK)
+ XEND
+};
+
+#undef X
+#define X(a) { CLOUDABI_##a, #a },
+
+static struct xlat cloudabi_advice[] = {
+ X(ADVICE_DONTNEED) X(ADVICE_NOREUSE) X(ADVICE_NORMAL)
+ X(ADVICE_RANDOM) X(ADVICE_SEQUENTIAL) X(ADVICE_WILLNEED)
+ XEND
+};
+
+static struct xlat cloudabi_clockid[] = {
+ X(CLOCK_MONOTONIC) X(CLOCK_PROCESS_CPUTIME_ID)
+ X(CLOCK_REALTIME) X(CLOCK_THREAD_CPUTIME_ID)
+ XEND
+};
+
+static struct xlat cloudabi_errno[] = {
+ X(E2BIG) X(EACCES) X(EADDRINUSE) X(EADDRNOTAVAIL)
+ X(EAFNOSUPPORT) X(EAGAIN) X(EALREADY) X(EBADF) X(EBADMSG)
+ X(EBUSY) X(ECANCELED) X(ECHILD) X(ECONNABORTED) X(ECONNREFUSED)
+ X(ECONNRESET) X(EDEADLK) X(EDESTADDRREQ) X(EDOM) X(EDQUOT)
+ X(EEXIST) X(EFAULT) X(EFBIG) X(EHOSTUNREACH) X(EIDRM) X(EILSEQ)
+ X(EINPROGRESS) X(EINTR) X(EINVAL) X(EIO) X(EISCONN) X(EISDIR)
+ X(ELOOP) X(EMFILE) X(EMLINK) X(EMSGSIZE) X(EMULTIHOP)
+ X(ENAMETOOLONG) X(ENETDOWN) X(ENETRESET) X(ENETUNREACH)
+ X(ENFILE) X(ENOBUFS) X(ENODEV) X(ENOENT) X(ENOEXEC) X(ENOLCK)
+ X(ENOLINK) X(ENOMEM) X(ENOMSG) X(ENOPROTOOPT) X(ENOSPC)
+ X(ENOSYS) X(ENOTCONN) X(ENOTDIR) X(ENOTEMPTY) X(ENOTRECOVERABLE)
+ X(ENOTSOCK) X(ENOTSUP) X(ENOTTY) X(ENXIO) X(EOVERFLOW)
+ X(EOWNERDEAD) X(EPERM) X(EPIPE) X(EPROTO) X(EPROTONOSUPPORT)
+ X(EPROTOTYPE) X(ERANGE) X(EROFS) X(ESPIPE) X(ESRCH) X(ESTALE)
+ X(ETIMEDOUT) X(ETXTBSY) X(EXDEV) X(ENOTCAPABLE)
+ XEND
+};
+
+static struct xlat cloudabi_fdflags[] = {
+ X(FDFLAG_APPEND) X(FDFLAG_DSYNC) X(FDFLAG_NONBLOCK)
+ X(FDFLAG_RSYNC) X(FDFLAG_SYNC)
+ XEND
+};
+
+static struct xlat cloudabi_fdsflags[] = {
+ X(FDSTAT_FLAGS) X(FDSTAT_RIGHTS)
+ XEND
+};
+
+static struct xlat cloudabi_filetype[] = {
+ X(FILETYPE_UNKNOWN) X(FILETYPE_BLOCK_DEVICE)
+ X(FILETYPE_CHARACTER_DEVICE) X(FILETYPE_DIRECTORY)
+ X(FILETYPE_FIFO) X(FILETYPE_POLL) X(FILETYPE_PROCESS)
+ X(FILETYPE_REGULAR_FILE) X(FILETYPE_SHARED_MEMORY)
+ X(FILETYPE_SOCKET_DGRAM) X(FILETYPE_SOCKET_SEQPACKET)
+ X(FILETYPE_SOCKET_STREAM) X(FILETYPE_SYMBOLIC_LINK)
+ XEND
+};
+
+static struct xlat cloudabi_fsflags[] = {
+ X(FILESTAT_ATIM) X(FILESTAT_ATIM_NOW) X(FILESTAT_MTIM)
+ X(FILESTAT_MTIM_NOW) X(FILESTAT_SIZE)
+ XEND
+};
+
+static struct xlat cloudabi_mflags[] = {
+ X(MAP_ANON) X(MAP_FIXED) X(MAP_PRIVATE) X(MAP_SHARED)
+ XEND
+};
+
+static struct xlat cloudabi_mprot[] = {
+ X(PROT_EXEC) X(PROT_WRITE) X(PROT_READ)
+ XEND
+};
+
+static struct xlat cloudabi_msflags[] = {
+ X(MS_ASYNC) X(MS_INVALIDATE) X(MS_SYNC)
+ XEND
+};
+
+static struct xlat cloudabi_oflags[] = {
+ X(O_CREAT) X(O_DIRECTORY) X(O_EXCL) X(O_TRUNC)
+ XEND
+};
+
+static struct xlat cloudabi_sa_family[] = {
+ X(AF_UNSPEC) X(AF_INET) X(AF_INET6) X(AF_UNIX)
+ XEND
+};
+
+static struct xlat cloudabi_sdflags[] = {
+ X(SHUT_RD) X(SHUT_WR)
+ XEND
+};
+
+static struct xlat cloudabi_signal[] = {
+ X(SIGABRT) X(SIGALRM) X(SIGBUS) X(SIGCHLD) X(SIGCONT) X(SIGFPE)
+ X(SIGHUP) X(SIGILL) X(SIGINT) X(SIGKILL) X(SIGPIPE) X(SIGQUIT)
+ X(SIGSEGV) X(SIGSTOP) X(SIGSYS) X(SIGTERM) X(SIGTRAP) X(SIGTSTP)
+ X(SIGTTIN) X(SIGTTOU) X(SIGURG) X(SIGUSR1) X(SIGUSR2)
+ X(SIGVTALRM) X(SIGXCPU) X(SIGXFSZ)
+ XEND
+};
+
+static struct xlat cloudabi_ssflags[] = {
+ X(SOCKSTAT_CLEAR_ERROR)
+ XEND
+};
+
+static struct xlat cloudabi_ssstate[] = {
+ X(SOCKSTATE_ACCEPTCONN)
+ XEND
+};
+
+static struct xlat cloudabi_ulflags[] = {
+ X(UNLINK_REMOVEDIR)
+ XEND
+};
+
+static struct xlat cloudabi_whence[] = {
+ X(WHENCE_CUR) X(WHENCE_END) X(WHENCE_SET)
+ XEND
+};
+
+#undef X
+#undef XEND
+
+/*
+ * Searches an xlat array for a value, and returns it if found. Otherwise
+ * return a string representation.
+ */
+static const char *
+lookup(struct xlat *xlat, int val, int base)
+{
+ static char tmp[16];
+
+ for (; xlat->str != NULL; xlat++)
+ if (xlat->val == val)
+ return (xlat->str);
+ switch (base) {
+ case 8:
+ sprintf(tmp, "0%o", val);
+ break;
+ case 16:
+ sprintf(tmp, "0x%x", val);
+ break;
+ case 10:
+ sprintf(tmp, "%u", val);
+ break;
+ default:
+ errx(1,"Unknown lookup base");
+ break;
+ }
+ return (tmp);
+}
+
+static const char *
+xlookup(struct xlat *xlat, int val)
+{
+
+ return (lookup(xlat, val, 16));
+}
+
+/*
+ * Searches an xlat array containing bitfield values. Remaining bits
+ * set after removing the known ones are printed at the end:
+ * IN|0x400.
+ */
+static char *
+xlookup_bits(struct xlat *xlat, int val)
+{
+ int len, rem;
+ static char str[512];
+
+ len = 0;
+ rem = val;
+ for (; xlat->str != NULL; xlat++) {
+ if ((xlat->val & rem) == xlat->val) {
+ /*
+ * Don't print the "all-bits-zero" string unless all
+ * bits are really zero.
+ */
+ if (xlat->val == 0 && val != 0)
+ continue;
+ len += sprintf(str + len, "%s|", xlat->str);
+ rem &= ~(xlat->val);
+ }
+ }
+
+ /*
+ * If we have leftover bits or didn't match anything, print
+ * the remainder.
+ */
+ if (rem || len == 0)
+ len += sprintf(str + len, "0x%x", rem);
+ if (len && str[len - 1] == '|')
+ len--;
+ str[len] = 0;
+ return (str);
+}
+
+void
+init_syscalls(void)
+{
+ struct syscall *sc;
+
+ STAILQ_INIT(&syscalls);
+ for (sc = decoded_syscalls; sc->name != NULL; sc++)
+ STAILQ_INSERT_HEAD(&syscalls, sc, entries);
+}
+/*
+ * If/when the list gets big, it might be desirable to do it
+ * as a hash table or binary search.
+ */
+struct syscall *
+get_syscall(const char *name, int nargs)
+{
+ struct syscall *sc;
+ int i;
+
+ if (name == NULL)
+ return (NULL);
+ STAILQ_FOREACH(sc, &syscalls, entries)
+ if (strcmp(name, sc->name) == 0)
+ return (sc);
+
+ /* It is unknown. Add it into the list. */
+#if DEBUG
+ fprintf(stderr, "unknown syscall %s -- setting args to %d\n", name,
+ nargs);
+#endif
+
+ sc = calloc(1, sizeof(struct syscall));
+ sc->name = strdup(name);
+ sc->ret_type = 1;
+ sc->nargs = nargs;
+ for (i = 0; i < nargs; i++) {
+ sc->args[i].offset = i;
+ /* Treat all unknown arguments as LongHex. */
+ sc->args[i].type = LongHex;
+ }
+ STAILQ_INSERT_HEAD(&syscalls, sc, entries);
+
+ return (sc);
+}
+
+/*
+ * Copy a fixed amount of bytes from the process.
+ */
+static int
+get_struct(pid_t pid, void *offset, void *buf, int len)
+{
+ struct ptrace_io_desc iorequest;
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = offset;
+ iorequest.piod_addr = buf;
+ iorequest.piod_len = len;
+ if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0)
+ return (-1);
+ return (0);
+}
+
+#define MAXSIZE 4096
+
+/*
+ * Copy a string from the process. Note that it is
+ * expected to be a C string, but if max is set, it will
+ * only get that much.
+ */
+static char *
+get_string(pid_t pid, void *addr, int max)
+{
+ struct ptrace_io_desc iorequest;
+ char *buf, *nbuf;
+ size_t offset, size, totalsize;
+
+ offset = 0;
+ if (max)
+ size = max + 1;
+ else {
+ /* Read up to the end of the current page. */
+ size = PAGE_SIZE - ((uintptr_t)addr % PAGE_SIZE);
+ if (size > MAXSIZE)
+ size = MAXSIZE;
+ }
+ totalsize = size;
+ buf = malloc(totalsize);
+ if (buf == NULL)
+ return (NULL);
+ for (;;) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (char *)addr + offset;
+ iorequest.piod_addr = buf + offset;
+ iorequest.piod_len = size;
+ if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) {
+ free(buf);
+ return (NULL);
+ }
+ if (memchr(buf + offset, '\0', size) != NULL)
+ return (buf);
+ offset += size;
+ if (totalsize < MAXSIZE && max == 0) {
+ size = MAXSIZE - totalsize;
+ if (size > PAGE_SIZE)
+ size = PAGE_SIZE;
+ nbuf = realloc(buf, totalsize + size);
+ if (nbuf == NULL) {
+ buf[totalsize - 1] = '\0';
+ return (buf);
+ }
+ buf = nbuf;
+ totalsize += size;
+ } else {
+ buf[totalsize - 1] = '\0';
+ return (buf);
+ }
+ }
+}
+
+static char *
+strsig2(int sig)
+{
+ static char tmp[sizeof(int) * 3 + 1];
+ char *ret;
+
+ ret = strsig(sig);
+ if (ret == NULL) {
+ snprintf(tmp, sizeof(tmp), "%d", sig);
+ ret = tmp;
+ }
+ return (ret);
+}
+
+static void
+print_kevent(FILE *fp, struct kevent *ke, int input)
+{
+
+ switch (ke->filter) {
+ case EVFILT_READ:
+ case EVFILT_WRITE:
+ case EVFILT_VNODE:
+ case EVFILT_PROC:
+ case EVFILT_TIMER:
+ case EVFILT_PROCDESC:
+ fprintf(fp, "%ju", (uintmax_t)ke->ident);
+ break;
+ case EVFILT_SIGNAL:
+ fputs(strsig2(ke->ident), fp);
+ break;
+ default:
+ fprintf(fp, "%p", (void *)ke->ident);
+ }
+ fprintf(fp, ",%s,%s,", xlookup(kevent_filters, ke->filter),
+ xlookup_bits(kevent_flags, ke->flags));
+ switch (ke->filter) {
+ case EVFILT_READ:
+ case EVFILT_WRITE:
+ fputs(xlookup_bits(kevent_rdwr_fflags, ke->fflags), fp);
+ break;
+ case EVFILT_VNODE:
+ fputs(xlookup_bits(kevent_vnode_fflags, ke->fflags), fp);
+ break;
+ case EVFILT_PROC:
+ case EVFILT_PROCDESC:
+ fputs(xlookup_bits(kevent_proc_fflags, ke->fflags), fp);
+ break;
+ case EVFILT_TIMER:
+ fputs(xlookup_bits(kevent_timer_fflags, ke->fflags), fp);
+ break;
+ case EVFILT_USER: {
+ int ctrl, data;
+
+ ctrl = ke->fflags & NOTE_FFCTRLMASK;
+ data = ke->fflags & NOTE_FFLAGSMASK;
+ if (input) {
+ fputs(xlookup(kevent_user_ffctrl, ctrl), fp);
+ if (ke->fflags & NOTE_TRIGGER)
+ fputs("|NOTE_TRIGGER", fp);
+ if (data != 0)
+ fprintf(fp, "|%#x", data);
+ } else {
+ fprintf(fp, "%#x", data);
+ }
+ break;
+ }
+ default:
+ fprintf(fp, "%#x", ke->fflags);
+ }
+ fprintf(fp, ",%p,%p", (void *)ke->data, (void *)ke->udata);
+}
+
+static void
+print_utrace(FILE *fp, void *utrace_addr, size_t len)
+{
+ unsigned char *utrace_buffer;
+
+ fprintf(fp, "{ ");
+ if (sysdecode_utrace(fp, utrace_addr, len)) {
+ fprintf(fp, " }");
+ return;
+ }
+
+ utrace_buffer = utrace_addr;
+ fprintf(fp, "%zu:", len);
+ while (len--)
+ fprintf(fp, " %02x", *utrace_buffer++);
+ fprintf(fp, " }");
+}
+
+/*
+ * Converts a syscall argument into a string. Said string is
+ * allocated via malloc(), so needs to be free()'d. sc is
+ * a pointer to the syscall description (see above); args is
+ * an array of all of the system call arguments.
+ */
+char *
+print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
+ struct trussinfo *trussinfo)
+{
+ FILE *fp;
+ char *tmp;
+ size_t tmplen;
+ pid_t pid;
+
+ fp = open_memstream(&tmp, &tmplen);
+ pid = trussinfo->curthread->proc->pid;
+ switch (sc->type & ARG_MASK) {
+ case Hex:
+ fprintf(fp, "0x%x", (int)args[sc->offset]);
+ break;
+ case Octal:
+ fprintf(fp, "0%o", (int)args[sc->offset]);
+ break;
+ case Int:
+ fprintf(fp, "%d", (int)args[sc->offset]);
+ break;
+ case UInt:
+ fprintf(fp, "%u", (unsigned int)args[sc->offset]);
+ break;
+ case LongHex:
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ case Long:
+ fprintf(fp, "%ld", args[sc->offset]);
+ break;
+ case Name: {
+ /* NULL-terminated string. */
+ char *tmp2;
+
+ tmp2 = get_string(pid, (void*)args[sc->offset], 0);
+ fprintf(fp, "\"%s\"", tmp2);
+ free(tmp2);
+ break;
+ }
+ case BinString: {
+ /*
+ * Binary block of data that might have printable characters.
+ * XXX If type|OUT, assume that the length is the syscall's
+ * return value. Otherwise, assume that the length of the block
+ * is in the next syscall argument.
+ */
+ int max_string = trussinfo->strsize;
+ char tmp2[max_string + 1], *tmp3;
+ int len;
+ int truncated = 0;
+
+ if (sc->type & OUT)
+ len = retval[0];
+ else
+ len = args[sc->offset + 1];
+
+ /*
+ * Don't print more than max_string characters, to avoid word
+ * wrap. If we have to truncate put some ... after the string.
+ */
+ if (len > max_string) {
+ len = max_string;
+ truncated = 1;
+ }
+ if (len && get_struct(pid, (void*)args[sc->offset], &tmp2, len)
+ != -1) {
+ tmp3 = malloc(len * 4 + 1);
+ while (len) {
+ if (strvisx(tmp3, tmp2, len,
+ VIS_CSTYLE|VIS_TAB|VIS_NL) <= max_string)
+ break;
+ len--;
+ truncated = 1;
+ }
+ fprintf(fp, "\"%s\"%s", tmp3, truncated ?
+ "..." : "");
+ free(tmp3);
+ } else {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ }
+ break;
+ }
+ case ExecArgs:
+ case ExecEnv:
+ case StringArray: {
+ uintptr_t addr;
+ union {
+ char *strarray[0];
+ char buf[PAGE_SIZE];
+ } u;
+ char *string;
+ size_t len;
+ u_int first, i;
+
+ /*
+ * Only parse argv[] and environment arrays from exec calls
+ * if requested.
+ */
+ if (((sc->type & ARG_MASK) == ExecArgs &&
+ (trussinfo->flags & EXECVEARGS) == 0) ||
+ ((sc->type & ARG_MASK) == ExecEnv &&
+ (trussinfo->flags & EXECVEENVS) == 0)) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ /*
+ * Read a page of pointers at a time. Punt if the top-level
+ * pointer is not aligned. Note that the first read is of
+ * a partial page.
+ */
+ addr = args[sc->offset];
+ if (addr % sizeof(char *) != 0) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ len = PAGE_SIZE - (addr & PAGE_MASK);
+ if (get_struct(pid, (void *)addr, u.buf, len) == -1) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ fputc('[', fp);
+ first = 1;
+ i = 0;
+ while (u.strarray[i] != NULL) {
+ string = get_string(pid, u.strarray[i], 0);
+ fprintf(fp, "%s \"%s\"", first ? "" : ",", string);
+ free(string);
+ first = 0;
+
+ i++;
+ if (i == len / sizeof(char *)) {
+ addr += len;
+ len = PAGE_SIZE;
+ if (get_struct(pid, (void *)addr, u.buf, len) ==
+ -1) {
+ fprintf(fp, ", <inval>");
+ break;
+ }
+ i = 0;
+ }
+ }
+ fputs(" ]", fp);
+ break;
+ }
+#ifdef __LP64__
+ case Quad:
+ fprintf(fp, "%ld", args[sc->offset]);
+ break;
+ case QuadHex:
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+#else
+ case Quad:
+ case QuadHex: {
+ unsigned long long ll;
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+ ll = (unsigned long long)args[sc->offset + 1] << 32 |
+ args[sc->offset];
+#else
+ ll = (unsigned long long)args[sc->offset] << 32 |
+ args[sc->offset + 1];
+#endif
+ if ((sc->type & ARG_MASK) == Quad)
+ fprintf(fp, "%lld", ll);
+ else
+ fprintf(fp, "0x%llx", ll);
+ break;
+ }
+#endif
+ case Ptr:
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ case Readlinkres: {
+ char *tmp2;
+
+ if (retval[0] == -1)
+ break;
+ tmp2 = get_string(pid, (void*)args[sc->offset], retval[0]);
+ fprintf(fp, "\"%s\"", tmp2);
+ free(tmp2);
+ break;
+ }
+ case Ioctl: {
+ const char *temp;
+ unsigned long cmd;
+
+ cmd = args[sc->offset];
+ temp = sysdecode_ioctlname(cmd);
+ if (temp)
+ fputs(temp, fp);
+ else {
+ fprintf(fp, "0x%lx { IO%s%s 0x%lx('%c'), %lu, %lu }",
+ cmd, cmd & IOC_OUT ? "R" : "",
+ cmd & IOC_IN ? "W" : "", IOCGROUP(cmd),
+ isprint(IOCGROUP(cmd)) ? (char)IOCGROUP(cmd) : '?',
+ cmd & 0xFF, IOCPARM_LEN(cmd));
+ }
+ break;
+ }
+ case Timespec: {
+ struct timespec ts;
+
+ if (get_struct(pid, (void *)args[sc->offset], &ts,
+ sizeof(ts)) != -1)
+ fprintf(fp, "{ %jd.%09ld }", (intmax_t)ts.tv_sec,
+ ts.tv_nsec);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Timespec2: {
+ struct timespec ts[2];
+ const char *sep;
+ unsigned int i;
+
+ if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts))
+ != -1) {
+ fputs("{ ", fp);
+ sep = "";
+ for (i = 0; i < nitems(ts); i++) {
+ fputs(sep, fp);
+ sep = ", ";
+ switch (ts[i].tv_nsec) {
+ case UTIME_NOW:
+ fprintf(fp, "UTIME_NOW");
+ break;
+ case UTIME_OMIT:
+ fprintf(fp, "UTIME_OMIT");
+ break;
+ default:
+ fprintf(fp, "%jd.%09ld",
+ (intmax_t)ts[i].tv_sec,
+ ts[i].tv_nsec);
+ break;
+ }
+ }
+ fputs(" }", fp);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Timeval: {
+ struct timeval tv;
+
+ if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
+ != -1)
+ fprintf(fp, "{ %jd.%06ld }", (intmax_t)tv.tv_sec,
+ tv.tv_usec);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Timeval2: {
+ struct timeval tv[2];
+
+ if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
+ != -1)
+ fprintf(fp, "{ %jd.%06ld, %jd.%06ld }",
+ (intmax_t)tv[0].tv_sec, tv[0].tv_usec,
+ (intmax_t)tv[1].tv_sec, tv[1].tv_usec);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Itimerval: {
+ struct itimerval itv;
+
+ if (get_struct(pid, (void *)args[sc->offset], &itv,
+ sizeof(itv)) != -1)
+ fprintf(fp, "{ %jd.%06ld, %jd.%06ld }",
+ (intmax_t)itv.it_interval.tv_sec,
+ itv.it_interval.tv_usec,
+ (intmax_t)itv.it_value.tv_sec,
+ itv.it_value.tv_usec);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case LinuxSockArgs:
+ {
+ struct linux_socketcall_args largs;
+
+ if (get_struct(pid, (void *)args[sc->offset], (void *)&largs,
+ sizeof(largs)) != -1)
+ fprintf(fp, "{ %s, 0x%lx }",
+ lookup(linux_socketcall_ops, largs.what, 10),
+ (long unsigned int)largs.args);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Pollfd: {
+ /*
+ * XXX: A Pollfd argument expects the /next/ syscall argument
+ * to be the number of fds in the array. This matches the poll
+ * syscall.
+ */
+ struct pollfd *pfd;
+ int numfds = args[sc->offset + 1];
+ size_t bytes = sizeof(struct pollfd) * numfds;
+ int i;
+
+ if ((pfd = malloc(bytes)) == NULL)
+ err(1, "Cannot malloc %zu bytes for pollfd array",
+ bytes);
+ if (get_struct(pid, (void *)args[sc->offset], pfd, bytes)
+ != -1) {
+ fputs("{", fp);
+ for (i = 0; i < numfds; i++) {
+ fprintf(fp, " %d/%s", pfd[i].fd,
+ xlookup_bits(poll_flags, pfd[i].events));
+ }
+ fputs(" }", fp);
+ } else {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ }
+ free(pfd);
+ break;
+ }
+ case Fd_set: {
+ /*
+ * XXX: A Fd_set argument expects the /first/ syscall argument
+ * to be the number of fds in the array. This matches the
+ * select syscall.
+ */
+ fd_set *fds;
+ int numfds = args[0];
+ size_t bytes = _howmany(numfds, _NFDBITS) * _NFDBITS;
+ int i;
+
+ if ((fds = malloc(bytes)) == NULL)
+ err(1, "Cannot malloc %zu bytes for fd_set array",
+ bytes);
+ if (get_struct(pid, (void *)args[sc->offset], fds, bytes)
+ != -1) {
+ fputs("{", fp);
+ for (i = 0; i < numfds; i++) {
+ if (FD_ISSET(i, fds))
+ fprintf(fp, " %d", i);
+ }
+ fputs(" }", fp);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ free(fds);
+ break;
+ }
+ case Signal:
+ fputs(strsig2(args[sc->offset]), fp);
+ break;
+ case Sigset: {
+ long sig;
+ sigset_t ss;
+ int i, first;
+
+ sig = args[sc->offset];
+ if (get_struct(pid, (void *)args[sc->offset], (void *)&ss,
+ sizeof(ss)) == -1) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ fputs("{ ", fp);
+ first = 1;
+ for (i = 1; i < sys_nsig; i++) {
+ if (sigismember(&ss, i)) {
+ fprintf(fp, "%s%s", !first ? "|" : "",
+ strsig(i));
+ first = 0;
+ }
+ }
+ if (!first)
+ fputc(' ', fp);
+ fputc('}', fp);
+ break;
+ }
+ case Sigprocmask: {
+ fputs(xlookup(sigprocmask_ops, args[sc->offset]), fp);
+ break;
+ }
+ case Fcntlflag: {
+ /* XXX: Output depends on the value of the previous argument. */
+ switch (args[sc->offset - 1]) {
+ case F_SETFD:
+ fputs(xlookup_bits(fcntlfd_arg, args[sc->offset]), fp);
+ break;
+ case F_SETFL:
+ fputs(xlookup_bits(fcntlfl_arg, args[sc->offset]), fp);
+ break;
+ case F_GETFD:
+ case F_GETFL:
+ case F_GETOWN:
+ break;
+ default:
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ break;
+ }
+ case Open:
+ fputs(xlookup_bits(open_flags, args[sc->offset]), fp);
+ break;
+ case Fcntl:
+ fputs(xlookup(fcntl_arg, args[sc->offset]), fp);
+ break;
+ case Mprot:
+ fputs(xlookup_bits(mprot_flags, args[sc->offset]), fp);
+ break;
+ case Mmapflags: {
+ int align, flags;
+
+ /*
+ * MAP_ALIGNED can't be handled by xlookup_bits(), so
+ * generate that string manually and prepend it to the
+ * string from xlookup_bits(). Have to be careful to
+ * avoid outputting MAP_ALIGNED|0 if MAP_ALIGNED is
+ * the only flag.
+ */
+ flags = args[sc->offset] & ~MAP_ALIGNMENT_MASK;
+ align = args[sc->offset] & MAP_ALIGNMENT_MASK;
+ if (align != 0) {
+ if (align == MAP_ALIGNED_SUPER)
+ fputs("MAP_ALIGNED_SUPER", fp);
+ else
+ fprintf(fp, "MAP_ALIGNED(%d)",
+ align >> MAP_ALIGNMENT_SHIFT);
+ if (flags == 0)
+ break;
+ fputc('|', fp);
+ }
+ fputs(xlookup_bits(mmap_flags, flags), fp);
+ break;
+ }
+ case Whence:
+ fputs(xlookup(whence_arg, args[sc->offset]), fp);
+ break;
+ case Sockdomain:
+ fputs(xlookup(sockdomain_arg, args[sc->offset]), fp);
+ break;
+ case Socktype: {
+ int type, flags;
+
+ flags = args[sc->offset] & (SOCK_CLOEXEC | SOCK_NONBLOCK);
+ type = args[sc->offset] & ~flags;
+ fputs(xlookup(socktype_arg, type), fp);
+ if (flags & SOCK_CLOEXEC)
+ fprintf(fp, "|SOCK_CLOEXEC");
+ if (flags & SOCK_NONBLOCK)
+ fprintf(fp, "|SOCK_NONBLOCK");
+ break;
+ }
+ case Shutdown:
+ fputs(xlookup(shutdown_arg, args[sc->offset]), fp);
+ break;
+ case Resource:
+ fputs(xlookup(resource_arg, args[sc->offset]), fp);
+ break;
+ case Pathconf:
+ fputs(xlookup(pathconf_arg, args[sc->offset]), fp);
+ break;
+ case Rforkflags:
+ fputs(xlookup_bits(rfork_flags, args[sc->offset]), fp);
+ break;
+ case Sockaddr: {
+ char addr[64];
+ struct sockaddr_in *lsin;
+ struct sockaddr_in6 *lsin6;
+ struct sockaddr_un *sun;
+ struct sockaddr *sa;
+ socklen_t len;
+ u_char *q;
+
+ if (args[sc->offset] == 0) {
+ fputs("NULL", fp);
+ break;
+ }
+
+ /*
+ * Extract the address length from the next argument. If
+ * this is an output sockaddr (OUT is set), then the
+ * next argument is a pointer to a socklen_t. Otherwise
+ * the next argument contains a socklen_t by value.
+ */
+ if (sc->type & OUT) {
+ if (get_struct(pid, (void *)args[sc->offset + 1],
+ &len, sizeof(len)) == -1) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ } else
+ len = args[sc->offset + 1];
+
+ /* If the length is too small, just bail. */
+ if (len < sizeof(*sa)) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ sa = calloc(1, len);
+ if (get_struct(pid, (void *)args[sc->offset], sa, len) == -1) {
+ free(sa);
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ if (len < sizeof(*lsin))
+ goto sockaddr_short;
+ lsin = (struct sockaddr_in *)(void *)sa;
+ inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr));
+ fprintf(fp, "{ AF_INET %s:%d }", addr,
+ htons(lsin->sin_port));
+ break;
+ case AF_INET6:
+ if (len < sizeof(*lsin6))
+ goto sockaddr_short;
+ lsin6 = (struct sockaddr_in6 *)(void *)sa;
+ inet_ntop(AF_INET6, &lsin6->sin6_addr, addr,
+ sizeof(addr));
+ fprintf(fp, "{ AF_INET6 [%s]:%d }", addr,
+ htons(lsin6->sin6_port));
+ break;
+ case AF_UNIX:
+ sun = (struct sockaddr_un *)sa;
+ fprintf(fp, "{ AF_UNIX \"%.*s\" }",
+ (int)(len - offsetof(struct sockaddr_un, sun_path)),
+ sun->sun_path);
+ break;
+ default:
+ sockaddr_short:
+ fprintf(fp,
+ "{ sa_len = %d, sa_family = %d, sa_data = {",
+ (int)sa->sa_len, (int)sa->sa_family);
+ for (q = (u_char *)sa->sa_data;
+ q < (u_char *)sa + len; q++)
+ fprintf(fp, "%s 0x%02x",
+ q == (u_char *)sa->sa_data ? "" : ",",
+ *q);
+ fputs(" } }", fp);
+ }
+ free(sa);
+ break;
+ }
+ case Sigaction: {
+ struct sigaction sa;
+
+ if (get_struct(pid, (void *)args[sc->offset], &sa, sizeof(sa))
+ != -1) {
+ fputs("{ ", fp);
+ if (sa.sa_handler == SIG_DFL)
+ fputs("SIG_DFL", fp);
+ else if (sa.sa_handler == SIG_IGN)
+ fputs("SIG_IGN", fp);
+ else
+ fprintf(fp, "%p", sa.sa_handler);
+ fprintf(fp, " %s ss_t }",
+ xlookup_bits(sigaction_flags, sa.sa_flags));
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Kevent: {
+ /*
+ * XXX XXX: The size of the array is determined by either the
+ * next syscall argument, or by the syscall return value,
+ * depending on which argument number we are. This matches the
+ * kevent syscall, but luckily that's the only syscall that uses
+ * them.
+ */
+ struct kevent *ke;
+ int numevents = -1;
+ size_t bytes;
+ int i;
+
+ if (sc->offset == 1)
+ numevents = args[sc->offset+1];
+ else if (sc->offset == 3 && retval[0] != -1)
+ numevents = retval[0];
+
+ if (numevents >= 0) {
+ bytes = sizeof(struct kevent) * numevents;
+ if ((ke = malloc(bytes)) == NULL)
+ err(1,
+ "Cannot malloc %zu bytes for kevent array",
+ bytes);
+ } else
+ ke = NULL;
+ if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset],
+ ke, bytes) != -1) {
+ fputc('{', fp);
+ for (i = 0; i < numevents; i++) {
+ fputc(' ', fp);
+ print_kevent(fp, &ke[i], sc->offset == 1);
+ }
+ fputs(" }", fp);
+ } else {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ }
+ free(ke);
+ break;
+ }
+ case Stat: {
+ struct stat st;
+
+ if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st))
+ != -1) {
+ char mode[12];
+
+ strmode(st.st_mode, mode);
+ fprintf(fp,
+ "{ mode=%s,inode=%ju,size=%jd,blksize=%ld }", mode,
+ (uintmax_t)st.st_ino, (intmax_t)st.st_size,
+ (long)st.st_blksize);
+ } else {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ }
+ break;
+ }
+ case StatFs: {
+ unsigned int i;
+ struct statfs buf;
+
+ if (get_struct(pid, (void *)args[sc->offset], &buf,
+ sizeof(buf)) != -1) {
+ char fsid[17];
+
+ bzero(fsid, sizeof(fsid));
+ if (buf.f_fsid.val[0] != 0 || buf.f_fsid.val[1] != 0) {
+ for (i = 0; i < sizeof(buf.f_fsid); i++)
+ snprintf(&fsid[i*2],
+ sizeof(fsid) - (i*2), "%02x",
+ ((u_char *)&buf.f_fsid)[i]);
+ }
+ fprintf(fp,
+ "{ fstypename=%s,mntonname=%s,mntfromname=%s,"
+ "fsid=%s }", buf.f_fstypename, buf.f_mntonname,
+ buf.f_mntfromname, fsid);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ case Rusage: {
+ struct rusage ru;
+
+ if (get_struct(pid, (void *)args[sc->offset], &ru, sizeof(ru))
+ != -1) {
+ fprintf(fp,
+ "{ u=%jd.%06ld,s=%jd.%06ld,in=%ld,out=%ld }",
+ (intmax_t)ru.ru_utime.tv_sec, ru.ru_utime.tv_usec,
+ (intmax_t)ru.ru_stime.tv_sec, ru.ru_stime.tv_usec,
+ ru.ru_inblock, ru.ru_oublock);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Rlimit: {
+ struct rlimit rl;
+
+ if (get_struct(pid, (void *)args[sc->offset], &rl, sizeof(rl))
+ != -1) {
+ fprintf(fp, "{ cur=%ju,max=%ju }",
+ rl.rlim_cur, rl.rlim_max);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case ExitStatus: {
+ int status;
+
+ if (get_struct(pid, (void *)args[sc->offset], &status,
+ sizeof(status)) != -1) {
+ fputs("{ ", fp);
+ if (WIFCONTINUED(status))
+ fputs("CONTINUED", fp);
+ else if (WIFEXITED(status))
+ fprintf(fp, "EXITED,val=%d",
+ WEXITSTATUS(status));
+ else if (WIFSIGNALED(status))
+ fprintf(fp, "SIGNALED,sig=%s%s",
+ strsig2(WTERMSIG(status)),
+ WCOREDUMP(status) ? ",cored" : "");
+ else
+ fprintf(fp, "STOPPED,sig=%s",
+ strsig2(WTERMSIG(status)));
+ fputs(" }", fp);
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case Waitoptions:
+ fputs(xlookup_bits(wait_options, args[sc->offset]), fp);
+ break;
+ case Idtype:
+ fputs(xlookup(idtype_arg, args[sc->offset]), fp);
+ break;
+ case Procctl:
+ fputs(xlookup(procctl_arg, args[sc->offset]), fp);
+ break;
+ case Umtxop:
+ fputs(xlookup(umtx_ops, args[sc->offset]), fp);
+ break;
+ case Atfd:
+ if ((int)args[sc->offset] == AT_FDCWD)
+ fputs("AT_FDCWD", fp);
+ else
+ fprintf(fp, "%d", (int)args[sc->offset]);
+ break;
+ case Atflags:
+ fputs(xlookup_bits(at_flags, args[sc->offset]), fp);
+ break;
+ case Accessmode:
+ if (args[sc->offset] == F_OK)
+ fputs("F_OK", fp);
+ else
+ fputs(xlookup_bits(access_modes, args[sc->offset]), fp);
+ break;
+ case Sysarch:
+ fputs(xlookup(sysarch_ops, args[sc->offset]), fp);
+ break;
+ case PipeFds:
+ /*
+ * The pipe() system call in the kernel returns its
+ * two file descriptors via return values. However,
+ * the interface exposed by libc is that pipe()
+ * accepts a pointer to an array of descriptors.
+ * Format the output to match the libc API by printing
+ * the returned file descriptors as a fake argument.
+ *
+ * Overwrite the first retval to signal a successful
+ * return as well.
+ */
+ fprintf(fp, "{ %ld, %ld }", retval[0], retval[1]);
+ retval[0] = 0;
+ break;
+ case Utrace: {
+ size_t len;
+ void *utrace_addr;
+
+ len = args[sc->offset + 1];
+ utrace_addr = calloc(1, len);
+ if (get_struct(pid, (void *)args[sc->offset],
+ (void *)utrace_addr, len) != -1)
+ print_utrace(fp, utrace_addr, len);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ free(utrace_addr);
+ break;
+ }
+ case IntArray: {
+ int descriptors[16];
+ unsigned long i, ndescriptors;
+ bool truncated;
+
+ ndescriptors = args[sc->offset + 1];
+ truncated = false;
+ if (ndescriptors > nitems(descriptors)) {
+ ndescriptors = nitems(descriptors);
+ truncated = true;
+ }
+ if (get_struct(pid, (void *)args[sc->offset],
+ descriptors, ndescriptors * sizeof(descriptors[0])) != -1) {
+ fprintf(fp, "{");
+ for (i = 0; i < ndescriptors; i++)
+ fprintf(fp, i == 0 ? " %d" : ", %d",
+ descriptors[i]);
+ fprintf(fp, truncated ? ", ... }" : " }");
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+
+ case CloudABIAdvice:
+ fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);
+ break;
+ case CloudABIClockID:
+ fputs(xlookup(cloudabi_clockid, args[sc->offset]), fp);
+ break;
+ case ClouduABIFDSFlags:
+ fputs(xlookup_bits(cloudabi_fdsflags, args[sc->offset]), fp);
+ break;
+ case CloudABIFDStat: {
+ cloudabi_fdstat_t fds;
+ if (get_struct(pid, (void *)args[sc->offset], &fds, sizeof(fds))
+ != -1) {
+ fprintf(fp, "{ %s, ",
+ xlookup(cloudabi_filetype, fds.fs_filetype));
+ fprintf(fp, "%s, ... }",
+ xlookup_bits(cloudabi_fdflags, fds.fs_flags));
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case CloudABIFileStat: {
+ cloudabi_filestat_t fsb;
+ if (get_struct(pid, (void *)args[sc->offset], &fsb, sizeof(fsb))
+ != -1)
+ fprintf(fp, "{ %s, %lu }",
+ xlookup(cloudabi_filetype, fsb.st_filetype),
+ fsb.st_size);
+ else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case CloudABIFileType:
+ fputs(xlookup(cloudabi_filetype, args[sc->offset]), fp);
+ break;
+ case CloudABIFSFlags:
+ fputs(xlookup_bits(cloudabi_fsflags, args[sc->offset]), fp);
+ break;
+ case CloudABILookup:
+ if ((args[sc->offset] & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0)
+ fprintf(fp, "%d|LOOKUP_SYMLINK_FOLLOW",
+ (int)args[sc->offset]);
+ else
+ fprintf(fp, "%d", (int)args[sc->offset]);
+ break;
+ case CloudABIMFlags:
+ fputs(xlookup_bits(cloudabi_mflags, args[sc->offset]), fp);
+ break;
+ case CloudABIMProt:
+ fputs(xlookup_bits(cloudabi_mprot, args[sc->offset]), fp);
+ break;
+ case CloudABIMSFlags:
+ fputs(xlookup_bits(cloudabi_msflags, args[sc->offset]), fp);
+ break;
+ case CloudABIOFlags:
+ fputs(xlookup_bits(cloudabi_oflags, args[sc->offset]), fp);
+ break;
+ case CloudABISDFlags:
+ fputs(xlookup_bits(cloudabi_sdflags, args[sc->offset]), fp);
+ break;
+ case CloudABISignal:
+ fputs(xlookup(cloudabi_signal, args[sc->offset]), fp);
+ break;
+ case CloudABISockStat: {
+ cloudabi_sockstat_t ss;
+ if (get_struct(pid, (void *)args[sc->offset], &ss, sizeof(ss))
+ != -1) {
+ fprintf(fp, "{ %s, ", xlookup(
+ cloudabi_sa_family, ss.ss_sockname.sa_family));
+ fprintf(fp, "%s, ", xlookup(
+ cloudabi_sa_family, ss.ss_peername.sa_family));
+ fprintf(fp, "%s, ", xlookup(
+ cloudabi_errno, ss.ss_error));
+ fprintf(fp, "%s }", xlookup_bits(
+ cloudabi_ssstate, ss.ss_state));
+ } else
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ case CloudABISSFlags:
+ fputs(xlookup_bits(cloudabi_ssflags, args[sc->offset]), fp);
+ break;
+ case CloudABITimestamp:
+ fprintf(fp, "%lu.%09lus", args[sc->offset] / 1000000000,
+ args[sc->offset] % 1000000000);
+ break;
+ case CloudABIULFlags:
+ fputs(xlookup_bits(cloudabi_ulflags, args[sc->offset]), fp);
+ break;
+ case CloudABIWhence:
+ fputs(xlookup(cloudabi_whence, args[sc->offset]), fp);
+ break;
+
+ default:
+ errx(1, "Invalid argument type %d\n", sc->type & ARG_MASK);
+ }
+ fclose(fp);
+ return (tmp);
+}
+
+/*
+ * Print (to outfile) the system call and its arguments.
+ */
+void
+print_syscall(struct trussinfo *trussinfo)
+{
+ struct threadinfo *t;
+ const char *name;
+ char **s_args;
+ int i, len, nargs;
+
+ t = trussinfo->curthread;
+
+ name = t->cs.name;
+ nargs = t->cs.nargs;
+ s_args = t->cs.s_args;
+
+ len = print_line_prefix(trussinfo);
+ len += fprintf(trussinfo->outfile, "%s(", name);
+
+ for (i = 0; i < nargs; i++) {
+ if (s_args[i] != NULL)
+ len += fprintf(trussinfo->outfile, "%s", s_args[i]);
+ else
+ len += fprintf(trussinfo->outfile,
+ "<missing argument>");
+ len += fprintf(trussinfo->outfile, "%s", i < (nargs - 1) ?
+ "," : "");
+ }
+ len += fprintf(trussinfo->outfile, ")");
+ for (i = 0; i < 6 - (len / 8); i++)
+ fprintf(trussinfo->outfile, "\t");
+}
+
+void
+print_syscall_ret(struct trussinfo *trussinfo, int errorp, long *retval)
+{
+ struct timespec timediff;
+ struct threadinfo *t;
+ struct syscall *sc;
+ int error;
+
+ t = trussinfo->curthread;
+ sc = t->cs.sc;
+ if (trussinfo->flags & COUNTONLY) {
+ timespecsubt(&t->after, &t->before, &timediff);
+ timespecadd(&sc->time, &timediff, &sc->time);
+ sc->ncalls++;
+ if (errorp)
+ sc->nerror++;
+ return;
+ }
+
+ print_syscall(trussinfo);
+ fflush(trussinfo->outfile);
+
+ if (retval == NULL) {
+ /*
+ * This system call resulted in the current thread's exit,
+ * so there is no return value or error to display.
+ */
+ fprintf(trussinfo->outfile, "\n");
+ return;
+ }
+
+ if (errorp) {
+ error = sysdecode_abi_to_freebsd_errno(t->proc->abi->abi,
+ retval[0]);
+ fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval[0],
+ error == INT_MAX ? "Unknown error" : strerror(error));
+ }
+#ifndef __LP64__
+ else if (sc->ret_type == 2) {
+ off_t off;
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+ off = (off_t)retval[1] << 32 | retval[0];
+#else
+ off = (off_t)retval[0] << 32 | retval[1];
+#endif
+ fprintf(trussinfo->outfile, " = %jd (0x%jx)\n", (intmax_t)off,
+ (intmax_t)off);
+ }
+#endif
+ else
+ fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval[0],
+ retval[0]);
+}
+
+void
+print_summary(struct trussinfo *trussinfo)
+{
+ struct timespec total = {0, 0};
+ struct syscall *sc;
+ int ncall, nerror;
+
+ fprintf(trussinfo->outfile, "%-20s%15s%8s%8s\n",
+ "syscall", "seconds", "calls", "errors");
+ ncall = nerror = 0;
+ STAILQ_FOREACH(sc, &syscalls, entries)
+ if (sc->ncalls) {
+ fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
+ sc->name, (intmax_t)sc->time.tv_sec,
+ sc->time.tv_nsec, sc->ncalls, sc->nerror);
+ timespecadd(&total, &sc->time, &total);
+ ncall += sc->ncalls;
+ nerror += sc->nerror;
+ }
+ fprintf(trussinfo->outfile, "%20s%15s%8s%8s\n",
+ "", "-------------", "-------", "-------");
+ fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
+ "", (intmax_t)total.tv_sec, total.tv_nsec, ncall, nerror);
+}
diff --git a/usr.bin/truss/truss.1 b/usr.bin/truss/truss.1
new file mode 100644
index 0000000..0246fa9
--- /dev/null
+++ b/usr.bin/truss/truss.1
@@ -0,0 +1,114 @@
+.\" $FreeBSD$
+.\"
+.Dd February 23, 2016
+.Dt TRUSS 1
+.Os
+.Sh NAME
+.Nm truss
+.Nd trace system calls
+.Sh SYNOPSIS
+.Nm
+.Op Fl facedDHS
+.Op Fl o Ar file
+.Op Fl s Ar strsize
+.Fl p Ar pid
+.Nm
+.Op Fl facedDHS
+.Op Fl o Ar file
+.Op Fl s Ar strsize
+.Ar command Op Ar args
+.Sh DESCRIPTION
+The
+.Nm
+utility traces the system calls called by the specified process or program.
+Output is to the specified output file, or standard error by default.
+It does this by stopping and restarting the process being monitored via
+.Xr ptrace 2 .
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl f
+Trace descendants of the original traced process created by
+.Xr fork 2 ,
+.Xr vfork 2 ,
+etc.
+To distinguish events between processes,
+the process ID
+.Pq PID
+of the process is included in the output of each event.
+.It Fl a
+Show the argument strings that are passed in each
+.Xr execve 2
+system call.
+.It Fl c
+Do not display individual system calls or signals.
+Instead, before exiting, print a summary containing for each system call:
+the total system time used,
+the number of times the call was invoked,
+and the number of times the call returned with an error.
+.It Fl e
+Show the environment strings that are passed in each
+.Xr execve 2
+system call.
+.It Fl d
+Include timestamps in the output showing the time elapsed
+since the trace was started.
+.It Fl D
+Include timestamps in the output showing the time elapsed
+since the last recorded event.
+.It Fl H
+Include the thread ID of in the output of each event.
+.It Fl S
+Do not display information about signals received by the process.
+(Normally,
+.Nm
+displays signal as well as system call events.)
+.It Fl o Ar file
+Print the output to the specified
+.Ar file
+instead of standard error.
+.It Fl s Ar strsize
+Display strings using at most
+.Ar strsize
+characters.
+If the buffer is larger,
+.Dq Li ...
+will be displayed at the end of the string.
+The default
+.Ar strsize
+is 32.
+.It Fl p Ar pid
+Follow the process specified by
+.Ar pid
+instead of a new command.
+.It Ar command Op Ar args
+Execute
+.Ar command
+and trace the system calls of it.
+(The
+.Fl p
+and
+.Ar command
+options are mutually exclusive.)
+.El
+.Sh EXAMPLES
+# Follow the system calls used in echoing "hello"
+.Dl $ truss /bin/echo hello
+# Do the same, but put the output into a file
+.Dl $ truss -o /tmp/truss.out /bin/echo hello
+# Follow an already-running process
+.Dl $ truss -p 34
+.Sh SEE ALSO
+.Xr kdump 1 ,
+.Xr ktrace 1 ,
+.Xr ptrace 2 ,
+.Xr utrace 2
+.Sh HISTORY
+The
+.Nm
+command was written by
+.An Sean Eric Fagan
+for
+.Fx .
+It was modeled after
+similar commands available for System V Release 4 and SunOS.
diff --git a/usr.bin/truss/truss.h b/usr.bin/truss/truss.h
new file mode 100644
index 0000000..dee2155
--- /dev/null
+++ b/usr.bin/truss/truss.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2001 Jamey Wood
+ *
+ * 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$
+ */
+
+#include <sys/linker_set.h>
+#include <sys/queue.h>
+
+#define FOLLOWFORKS 0x00000001
+#define RELATIVETIMESTAMPS 0x00000002
+#define ABSOLUTETIMESTAMPS 0x00000004
+#define NOSIGS 0x00000008
+#define EXECVEARGS 0x00000010
+#define EXECVEENVS 0x00000020
+#define COUNTONLY 0x00000040
+#define DISPLAYTIDS 0x00000080
+
+struct procinfo;
+struct trussinfo;
+
+struct procabi {
+ const char *type;
+ enum sysdecode_abi abi;
+ int (*fetch_args)(struct trussinfo *, u_int);
+ int (*fetch_retval)(struct trussinfo *, long *, int *);
+};
+
+#define PROCABI(abi) DATA_SET(procabi, abi)
+
+/*
+ * This is confusingly named. It holds per-thread state about the
+ * currently executing system call. syscall.h defines a struct
+ * syscall that holds metadata used to format system call arguments.
+ *
+ * NB: args[] stores the raw argument values (e.g. from registers)
+ * passed to the system call. s_args[] stores a string representation
+ * of a system call's arguments. These do not necessarily map one to
+ * one. A system call description may omit individual arguments
+ * (padding) or combine adjacent arguments (e.g. when passing an off_t
+ * argument on a 32-bit system). The nargs member contains the count
+ * of valid pointers in s_args[], not args[].
+ */
+struct current_syscall {
+ struct syscall *sc;
+ const char *name;
+ int number;
+ unsigned long args[10];
+ unsigned int nargs;
+ char *s_args[10]; /* the printable arguments */
+};
+
+struct threadinfo
+{
+ LIST_ENTRY(threadinfo) entries;
+ struct procinfo *proc;
+ lwpid_t tid;
+ int in_syscall;
+ struct current_syscall cs;
+ struct timespec before;
+ struct timespec after;
+};
+
+struct procinfo {
+ LIST_ENTRY(procinfo) entries;
+ pid_t pid;
+ struct procabi *abi;
+
+ LIST_HEAD(, threadinfo) threadlist;
+};
+
+struct trussinfo
+{
+ int flags;
+ int strsize;
+ FILE *outfile;
+
+ struct timespec start_time;
+
+ struct threadinfo *curthread;
+
+ LIST_HEAD(, procinfo) proclist;
+};
+
+#define timespecsubt(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
+ (vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec; \
+ if ((vvp)->tv_nsec < 0) { \
+ (vvp)->tv_sec--; \
+ (vvp)->tv_nsec += 1000000000; \
+ } \
+ } while (0)
+
+#define timespecadd(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
+ (vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec; \
+ if ((vvp)->tv_nsec > 1000000000) { \
+ (vvp)->tv_sec++; \
+ (vvp)->tv_nsec -= 1000000000; \
+ } \
+ } while (0)
diff --git a/usr.bin/tset/Makefile b/usr.bin/tset/Makefile
new file mode 100644
index 0000000..acf8334
--- /dev/null
+++ b/usr.bin/tset/Makefile
@@ -0,0 +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
+
+LIBADD= ncursesw
+LINKS= ${BINDIR}/tset ${BINDIR}/reset
+MLINKS= tset.1 reset.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tset/Makefile.depend b/usr.bin/tset/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/tset/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/tset/extern.h b/usr.bin/tset/extern.h
new file mode 100644
index 0000000..f4a6514
--- /dev/null
+++ b/usr.bin/tset/extern.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 1991, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/9/93
+ * $FreeBSD$
+ */
+
+#include <termios.h>
+
+extern struct termios mode, oldmode;
+extern int Columns, isreset, Lines;
+extern int erasech, intrchar, killch;
+extern speed_t Ospeed;
+
+void add_mapping(const char *, char *);
+void cat(char *);
+const char *get_termcap_entry(char *, char **);
+const char *mapped(const char *);
+int outc(int);
+void reset_mode(void);
+void set_control_chars(void);
+void set_conversions(int);
+void set_init(void);
+void wrtermcap(char *);
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
new file mode 100644
index 0000000..715f514
--- /dev/null
+++ b/usr.bin/tset/map.c
@@ -0,0 +1,251 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <sys/types.h>
+
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+
+#include "extern.h"
+
+static speed_t tset_baudrate(char *);
+
+/* Baud rate conditionals for mapping. */
+#define GT 0x01
+#define EQ 0x02
+#define LT 0x04
+#define NOT 0x08
+#define GE (GT | EQ)
+#define LE (LT | EQ)
+
+typedef struct map {
+ struct map *next; /* Linked list of maps. */
+ char *porttype; /* Port type, or "" for any. */
+ char *type; /* Terminal type to select. */
+ int conditional; /* Baud rate conditionals bitmask. */
+ speed_t speed; /* Baud rate to compare against. */
+} MAP;
+
+static MAP *cur, *maplist;
+
+/*
+ * Syntax for -m:
+ * [port-type][test baudrate]:terminal-type
+ * The baud rate tests are: >, <, @, =, !
+ */
+void
+add_mapping(const char *port, char *arg)
+{
+ MAP *mapp;
+ char *copy, *p, *termp;
+
+ copy = strdup(arg);
+ mapp = malloc(sizeof(MAP));
+ if (copy == NULL || mapp == NULL)
+ errx(1, "malloc");
+ mapp->next = NULL;
+ if (maplist == NULL)
+ cur = maplist = mapp;
+ else {
+ cur->next = mapp;
+ cur = mapp;
+ }
+
+ mapp->porttype = arg;
+ mapp->conditional = 0;
+
+ arg = strpbrk(arg, "><@=!:");
+
+ if (arg == NULL) { /* [?]term */
+ mapp->type = mapp->porttype;
+ mapp->porttype = NULL;
+ goto done;
+ }
+
+ if (arg == mapp->porttype) /* [><@=! baud]:term */
+ termp = mapp->porttype = NULL;
+ else
+ termp = arg;
+
+ for (;; ++arg) /* Optional conditionals. */
+ switch(*arg) {
+ case '<':
+ if (mapp->conditional & GT)
+ goto badmopt;
+ mapp->conditional |= LT;
+ break;
+ case '>':
+ if (mapp->conditional & LT)
+ goto badmopt;
+ mapp->conditional |= GT;
+ break;
+ case '@':
+ case '=': /* Not documented. */
+ mapp->conditional |= EQ;
+ break;
+ case '!':
+ mapp->conditional |= NOT;
+ break;
+ default:
+ goto next;
+ }
+
+next: if (*arg == ':') {
+ if (mapp->conditional)
+ goto badmopt;
+ ++arg;
+ } else { /* Optional baudrate. */
+ arg = strchr(p = arg, ':');
+ if (arg == NULL)
+ goto badmopt;
+ *arg++ = '\0';
+ mapp->speed = tset_baudrate(p);
+ }
+
+ if (*arg == '\0') /* Non-optional type. */
+ goto badmopt;
+
+ mapp->type = arg;
+
+ /* Terminate porttype, if specified. */
+ if (termp != NULL)
+ *termp = '\0';
+
+ /* If a NOT conditional, reverse the test. */
+ if (mapp->conditional & NOT)
+ mapp->conditional = ~mapp->conditional & (EQ | GT | LT);
+
+ /* If user specified a port with an option flag, set it. */
+done: if (port) {
+ if (mapp->porttype)
+badmopt: errx(1, "illegal -m option format: %s", copy);
+ mapp->porttype = strdup(port);
+ }
+
+#ifdef MAPDEBUG
+ (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY");
+ (void)printf("type: %s\n", mapp->type);
+ (void)printf("conditional: ");
+ p = "";
+ if (mapp->conditional & GT) {
+ (void)printf("GT");
+ p = "/";
+ }
+ if (mapp->conditional & EQ) {
+ (void)printf("%sEQ", p);
+ p = "/";
+ }
+ if (mapp->conditional & LT)
+ (void)printf("%sLT", p);
+ (void)printf("\nspeed: %d\n", mapp->speed);
+#endif
+}
+
+/*
+ * Return the type of terminal to use for a port of type 'type', as specified
+ * by the first applicable mapping in 'map'. If no mappings apply, return
+ * 'type'.
+ */
+const char *
+mapped(const char *type)
+{
+ MAP *mapp;
+ int match;
+
+ match = 0;
+ for (mapp = maplist; mapp; mapp = mapp->next)
+ if (mapp->porttype == NULL || !strcmp(mapp->porttype, type)) {
+ switch (mapp->conditional) {
+ case 0: /* No test specified. */
+ match = 1;
+ break;
+ case EQ:
+ match = (Ospeed == mapp->speed);
+ break;
+ case GE:
+ match = (Ospeed >= mapp->speed);
+ break;
+ case GT:
+ match = (Ospeed > mapp->speed);
+ break;
+ case LE:
+ match = (Ospeed <= mapp->speed);
+ break;
+ case LT:
+ match = (Ospeed < mapp->speed);
+ break;
+ }
+ if (match)
+ return (mapp->type);
+ }
+ /* No match found; return given type. */
+ return (type);
+}
+
+typedef struct speeds {
+ const char *string;
+ speed_t speed;
+} SPEEDS;
+
+static SPEEDS speeds[] = {
+ { "0", B0 },
+ { "134.5", B134 },
+ { "exta", B19200 },
+ { "extb", B38400 },
+ { NULL, 0 }
+};
+
+static speed_t
+tset_baudrate(char *rate)
+{
+ SPEEDS *sp;
+ speed_t speed;
+
+ /* The baudrate number can be preceded by a 'B', which is ignored. */
+ if (*rate == 'B')
+ ++rate;
+
+ for (sp = speeds; sp->string; ++sp)
+ if (!strcasecmp(rate, sp->string))
+ return (sp->speed);
+ speed = atol(rate);
+ if (speed == 0)
+ errx(1, "unknown baud rate %s", rate);
+ return speed;
+}
diff --git a/usr.bin/tset/misc.c b/usr.bin/tset/misc.c
new file mode 100644
index 0000000..52298e5
--- /dev/null
+++ b/usr.bin/tset/misc.c
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+void
+cat(char *file)
+{
+ register int fd, nr, nw;
+ char buf[1024];
+
+ if ((fd = open(file, O_RDONLY, 0)) < 0)
+ err(1, "%s", file);
+
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ if ((nw = write(STDERR_FILENO, buf, nr)) == -1)
+ err(1, "write to stderr");
+ if (nr != 0)
+ err(1, "%s", file);
+ (void)close(fd);
+}
+
+int
+outc(int c)
+{
+ return putc(c, stderr);
+}
diff --git a/usr.bin/tset/set.c b/usr.bin/tset/set.c
new file mode 100644
index 0000000..c48a6e7
--- /dev/null
+++ b/usr.bin/tset/set.c
@@ -0,0 +1,322 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)set.c 8.2 (Berkeley) 2/28/94";
+#endif
+
+#include <stdio.h>
+#include <termcap.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#define CHK(val, dft) (val <= 0 ? dft : val)
+
+int set_tabs(void);
+
+/*
+ * Reset the terminal mode bits to a sensible state. Very useful after
+ * a child program dies in raw mode.
+ */
+void
+reset_mode(void)
+{
+ tcgetattr(STDERR_FILENO, &mode);
+
+#if defined(VDISCARD) && defined(CDISCARD)
+ mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD);
+#endif
+ mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF);
+ mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE);
+#if defined(VFLUSH) && defined(CFLUSH)
+ mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH);
+#endif
+ mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR);
+ mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL);
+#if defined(VLNEXT) && defined(CLNEXT)
+ mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT);
+#endif
+ mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT);
+#if defined(VREPRINT) && defined(CRPRNT)
+ mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT);
+#endif
+ mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART);
+ mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP);
+ mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP);
+#if defined(VWERASE) && defined(CWERASE)
+ mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE);
+#endif
+
+ mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR
+#ifdef IUCLC
+ | IUCLC
+#endif
+#ifdef IXANY
+ | IXANY
+#endif
+ | IXOFF);
+
+ mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON
+#ifdef IMAXBEL
+ | IMAXBEL
+#endif
+ );
+
+ mode.c_oflag &= ~(0
+#ifdef OLCUC
+ | OLCUC
+#endif
+#ifdef OCRNL
+ | OCRNL
+#endif
+#ifdef ONOCR
+ | ONOCR
+#endif
+#ifdef ONLRET
+ | ONLRET
+#endif
+#ifdef OFILL
+ | OFILL
+#endif
+#ifdef OFDEL
+ | OFDEL
+#endif
+#ifdef NLDLY
+ | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY
+#endif
+ );
+
+ mode.c_oflag |= (OPOST
+#ifdef ONLCR
+ | ONLCR
+#endif
+ );
+
+ mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL);
+ mode.c_cflag |= (CS8 | CREAD);
+ mode.c_lflag &= ~(ECHONL | NOFLSH | TOSTOP
+#ifdef ECHOPTR
+ | ECHOPRT
+#endif
+#ifdef XCASE
+ | XCASE
+#endif
+ );
+
+ mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK
+#ifdef ECHOCTL
+ | ECHOCTL
+#endif
+#ifdef ECHOKE
+ | ECHOKE
+#endif
+ );
+
+ tcsetattr(STDERR_FILENO, TCSADRAIN, &mode);
+}
+
+/*
+ * Determine the erase, interrupt, and kill characters from the termcap
+ * entry and command line and update their values in 'mode'.
+ */
+void
+set_control_chars(void)
+{
+ char *bp, *p, bs_char, buf[1024];
+
+ bp = buf;
+ p = tgetstr("kb", &bp);
+ if (p == NULL || p[1] != '\0')
+ p = tgetstr("bc", &bp);
+ if (p != NULL && p[1] == '\0')
+ bs_char = p[0];
+ else if (tgetflag("bs"))
+ bs_char = CTRL('h');
+ else
+ bs_char = 0;
+
+ if (erasech == 0 && bs_char != 0 && !tgetflag("os"))
+ erasech = -1;
+ if (erasech < 0)
+ erasech = (bs_char != 0) ? bs_char : CTRL('h');
+
+ if (mode.c_cc[VERASE] == 0 || erasech != 0)
+ mode.c_cc[VERASE] = erasech ? erasech : CERASE;
+
+ if (mode.c_cc[VINTR] == 0 || intrchar != 0)
+ mode.c_cc[VINTR] = intrchar ? intrchar : CINTR;
+
+ if (mode.c_cc[VKILL] == 0 || killch != 0)
+ mode.c_cc[VKILL] = killch ? killch : CKILL;
+}
+
+/*
+ * Set up various conversions in 'mode', including parity, tabs, returns,
+ * echo, and case, according to the termcap entry. If the program we're
+ * running was named with a leading upper-case character, map external
+ * uppercase to internal lowercase.
+ */
+void
+set_conversions(int usingupper)
+{
+ if (tgetflag("UC") || usingupper) {
+#ifdef IUCLC
+ mode.c_iflag |= IUCLC;
+ mode.c_oflag |= OLCUC;
+#endif
+ } else if (tgetflag("LC")) {
+#ifdef IUCLC
+ mode.c_iflag &= ~IUCLC;
+ mode.c_oflag &= ~OLCUC;
+#endif
+ }
+ mode.c_iflag &= ~(PARMRK | INPCK);
+ mode.c_lflag |= ICANON;
+ if (tgetflag("EP")) {
+ mode.c_cflag |= PARENB;
+ mode.c_cflag &= ~PARODD;
+ }
+ if (tgetflag("OP")) {
+ mode.c_cflag |= PARENB;
+ mode.c_cflag |= PARODD;
+ }
+
+#ifdef ONLCR
+ mode.c_oflag |= ONLCR;
+#endif
+ mode.c_iflag |= ICRNL;
+ mode.c_lflag |= ECHO;
+ mode.c_oflag |= OXTABS;
+ if (tgetflag("NL")) { /* Newline, not linefeed. */
+#ifdef ONLCR
+ mode.c_oflag &= ~ONLCR;
+#endif
+ mode.c_iflag &= ~ICRNL;
+ }
+ if (tgetflag("HD")) /* Half duplex. */
+ mode.c_lflag &= ~ECHO;
+ if (tgetflag("pt")) /* Print tabs. */
+ mode.c_oflag &= ~OXTABS;
+ mode.c_lflag |= (ECHOE | ECHOK);
+}
+
+/* Output startup string. */
+void
+set_init(void)
+{
+ char *bp, buf[1024];
+ int settle;
+
+ bp = buf;
+ if (tgetstr("pc", &bp) != 0) /* Get/set pad character. */
+ PC = buf[0];
+
+#ifdef TAB3
+ if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) {
+ oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET);
+ tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode);
+ }
+#endif
+ settle = set_tabs();
+
+ if (isreset) {
+ bp = buf;
+ if (tgetstr("rs", &bp) != 0 || tgetstr("is", &bp) != 0) {
+ tputs(buf, 0, outc);
+ settle = 1;
+ }
+ bp = buf;
+ if (tgetstr("rf", &bp) != 0 || tgetstr("if", &bp) != 0) {
+ cat(buf);
+ settle = 1;
+ }
+ }
+
+ if (settle) {
+ (void)putc('\r', stderr);
+ (void)fflush(stderr);
+ (void)sleep(1); /* Settle the terminal. */
+ }
+}
+
+/*
+ * Set the hardware tabs on the terminal, using the ct (clear all tabs),
+ * st (set one tab) and ch (horizontal cursor addressing) capabilities.
+ * This is done before if and is, so they can patch in case we blow this.
+ * Return nonzero if we set any tab stops, zero if not.
+ */
+int
+set_tabs(void)
+{
+ int c;
+ char *capsp, *clear_tabs;
+ char *set_column, *set_pos, *Set_tab;
+ char caps[1024];
+ const char *tg_out;
+
+ capsp = caps;
+ Set_tab = tgetstr("st", &capsp);
+
+ if (Set_tab && (clear_tabs = tgetstr("ct", &capsp))) {
+ (void)putc('\r', stderr); /* Force to left margin. */
+ tputs(clear_tabs, 0, outc);
+ }
+
+ set_column = tgetstr("ch", &capsp);
+ set_pos = set_column ? NULL : tgetstr("cm", &capsp);
+
+ if (Set_tab) {
+ for (c = 8; c < Columns; c += 8) {
+ /*
+ * Get to the right column. "OOPS" is returned by
+ * tgoto() if it can't do the job. (*snarl*)
+ */
+ tg_out = "OOPS";
+ if (set_column)
+ tg_out = tgoto(set_column, 0, c);
+ if (*tg_out == 'O' && set_pos)
+ tg_out = tgoto(set_pos, c, Lines - 1);
+ if (*tg_out != 'O')
+ tputs(tg_out, 1, outc);
+ else
+ (void)fprintf(stderr, "%s", " ");
+ /* Set the tab. */
+ tputs(Set_tab, 0, outc);
+ }
+ putc('\r', stderr);
+ return (1);
+ }
+ return (0);
+}
diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c
new file mode 100644
index 0000000..106c98f
--- /dev/null
+++ b/usr.bin/tset/term.c
@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termcap.h>
+#include <unistd.h>
+#include <ttyent.h>
+#include "extern.h"
+
+static char tbuf[1024]; /* Termcap entry. */
+
+const char *askuser(const char *);
+char *ttys(char *);
+
+/*
+ * Figure out what kind of terminal we're dealing with, and then read in
+ * its termcap entry.
+ */
+const char *
+get_termcap_entry(char *userarg, char **tcapbufp)
+{
+ struct ttyent *t;
+ int rval;
+ char *p, *ttypath;
+ const char *ttype;
+
+ if (userarg) {
+ ttype = userarg;
+ goto found;
+ }
+
+ /* Try the environment. */
+ if ((ttype = getenv("TERM")))
+ goto map;
+
+ /* Try ttyname(3); check for dialup or other mapping. */
+ if ((ttypath = ttyname(STDERR_FILENO))) {
+ if ((p = strrchr(ttypath, '/')))
+ ++p;
+ else
+ p = ttypath;
+ if ((t = getttynam(p))) {
+ ttype = t->ty_type;
+ goto map;
+ }
+ }
+
+ /* If still undefined, use "unknown". */
+ ttype = "unknown";
+
+map: ttype = mapped(ttype);
+
+ /*
+ * If not a path, remove TERMCAP from the environment so we get a
+ * real entry from /etc/termcap. This prevents us from being fooled
+ * by out of date stuff in the environment.
+ */
+found: if ((p = getenv("TERMCAP")) != NULL && *p != '/')
+ unsetenv("TERMCAP");
+
+ /*
+ * ttype now contains a pointer to the type of the terminal.
+ * If the first character is '?', ask the user.
+ */
+ if (ttype[0] == '?') {
+ if (ttype[1] != '\0')
+ ttype = askuser(ttype + 1);
+ else
+ ttype = askuser(NULL);
+ }
+
+ /* Find the termcap entry. If it doesn't exist, ask the user. */
+ while ((rval = tgetent(tbuf, ttype)) == 0) {
+ warnx("terminal type %s is unknown", ttype);
+ ttype = askuser(NULL);
+ }
+ if (rval == -1)
+ errx(1, "termcap: %s", strerror(errno ? errno : ENOENT));
+ *tcapbufp = tbuf;
+ return (ttype);
+}
+
+/* Prompt the user for a terminal type. */
+const char *
+askuser(const char *dflt)
+{
+ static char answer[256];
+ char *p;
+
+ /* We can get recalled; if so, don't continue uselessly. */
+ if (feof(stdin) || ferror(stdin)) {
+ (void)fprintf(stderr, "\n");
+ exit(1);
+ }
+ for (;;) {
+ if (dflt)
+ (void)fprintf(stderr, "Terminal type? [%s] ", dflt);
+ else
+ (void)fprintf(stderr, "Terminal type? ");
+ (void)fflush(stderr);
+
+ if (fgets(answer, sizeof(answer), stdin) == NULL) {
+ if (dflt == NULL) {
+ (void)fprintf(stderr, "\n");
+ exit(1);
+ }
+ return (dflt);
+ }
+
+ if ((p = strchr(answer, '\n')))
+ *p = '\0';
+ if (answer[0])
+ return (answer);
+ if (dflt != NULL)
+ return (dflt);
+ }
+}
diff --git a/usr.bin/tset/tset.1 b/usr.bin/tset/tset.1
new file mode 100644
index 0000000..5f2641f
--- /dev/null
+++ b/usr.bin/tset/tset.1
@@ -0,0 +1,421 @@
+.\" Copyright (c) 1985, 1990, 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.
+.\"
+.\" @(#)tset.1 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 2015
+.Dt TSET 1
+.Os
+.Sh NAME
+.Nm tset ,
+.Nm reset
+.Nd terminal initialization
+.Sh SYNOPSIS
+.Nm
+.Op Fl IQrSs
+.Op Fl
+.Op Fl e Ar ch
+.Op Fl i Ar ch
+.Op Fl k Ar ch
+.Op Fl m Ar mapping
+.Op Ar terminal
+.Nm reset
+.Op Fl IQrSs
+.Op Fl
+.Op Fl e Ar ch
+.Op Fl i Ar ch
+.Op Fl k Ar ch
+.Op Fl m Ar mapping
+.Op Ar terminal
+.Sh DESCRIPTION
+The
+.Nm
+utility initializes terminals.
+It first determines the type of terminal that you are using.
+This determination is done as follows, using the first terminal type found.
+.Pp
+.Bl -bullet -compact -offset indent
+.It
+The
+.Ar terminal
+argument specified on the command line.
+.It
+The value of the
+.Ev TERM
+environment variable.
+.It
+The terminal type associated with the standard error output device in the
+.Pa /etc/ttys
+file.
+.It
+The default terminal type, ``unknown''.
+.El
+.Pp
+If the terminal type was not specified on the command-line, the
+.Fl m
+option mappings are then applied (see below for more information).
+Then, if the terminal type begins with a question mark (``?''), the user is
+prompted for confirmation of the terminal type.
+An empty response confirms the type, or, another type can be entered to
+specify a new type.
+Once the terminal type has been determined, the termcap entry for the terminal
+is retrieved.
+If no termcap entry is found for the type, the user is prompted for another
+terminal type.
+.Pp
+Once the termcap entry is retrieved, the window size, backspace, interrupt
+and line kill characters (among many other things) are set and the terminal
+and tab initialization strings are sent to the standard error output.
+Finally, if the erase, interrupt and line kill characters have changed,
+or are not set to their default values, their values are displayed to the
+standard error output.
+.Pp
+When invoked as
+.Nm reset ,
+.Nm
+sets cooked and echo modes, turns off cbreak and raw modes, turns on
+newline translation and resets any unset special characters to their
+default values before doing the terminal initialization described above.
+This is useful after a program dies leaving a terminal in an abnormal state.
+Note, you may have to type
+.Dq Li <LF>reset<LF>
+(the line-feed character is normally control-J) to get the terminal
+to work, as carriage-return may no longer work in the abnormal state.
+Also, the terminal will often not echo the command.
+.Pp
+The options are as follows:
+.Bl -tag -width flag
+.It Fl
+The terminal type is displayed to the standard output, and the terminal is
+not initialized in any way.
+.It Fl e
+Set the erase character to
+.Ar ch .
+.It Fl I
+Do not send the terminal or tab initialization strings to the terminal.
+.It Fl i
+Set the interrupt character to
+.Ar ch .
+.It Fl k
+Set the line kill character to
+.Ar ch .
+.It Fl m
+Specify a mapping from a port type to a terminal.
+See below for more information.
+.It Fl Q
+Do not display any values for the erase, interrupt and line kill characters.
+.It Fl r
+Print the terminal type to the standard error output.
+.It Fl S
+Print the terminal type and the termcap entry to the standard output.
+See the section below on setting the environment for details.
+.It Fl s
+Print the sequence of shell commands to initialize the environment variables
+.Ev TERM
+and
+.Ev TERMCAP
+to the standard output.
+See the section below on setting the environment for details.
+.El
+.Pp
+The arguments for the
+.Fl e ,
+.Fl i
+and
+.Fl k
+options may either be entered as actual characters or by using the
+.Dq hat
+notation, i.e., control-h may be specified as
+.Dq Li ^H
+or
+.Dq Li ^h .
+.Sh SETTING THE ENVIRONMENT
+It is often desirable to enter the terminal type and information about
+the terminal's capabilities into the shell's environment.
+This is done using the
+.Fl S
+and
+.Fl s
+options.
+.Pp
+When the
+.Fl S
+option is specified, the terminal type and the termcap entry are written
+to the standard output, separated by a space and without a terminating
+newline.
+This can be assigned to an array by
+.Nm csh
+and
+.Nm ksh
+users and then used like any other shell array.
+.Pp
+When the
+.Fl s
+option is specified, the commands to enter the information into the
+shell's environment are written to the standard output.
+If the
+.Ev SHELL
+environment variable ends in ``csh'', the commands are for the
+.Nm csh ,
+otherwise, they are for
+.Xr sh 1 .
+Note, the
+.Nm csh
+commands set and unset the shell variable
+.Dq noglob ,
+leaving it unset.
+The following line in the
+.Pa .login
+or
+.Pa .profile
+files will initialize the environment correctly:
+.Bd -literal -offset indent
+eval \`tset -s options ... \`
+.Ed
+.Pp
+To demonstrate a simple use of the
+.Fl S
+option, the following lines in the
+.Pa .login
+file have an equivalent effect:
+.Bd -literal -offset indent
+set noglob
+set term=(`tset -S options ...`)
+setenv TERM $term[1]
+setenv TERMCAP "$term[2]"
+unset term
+unset noglob
+.Ed
+.Sh TERMINAL TYPE MAPPING
+When the terminal is not hardwired into the system (or the current system
+information is incorrect) the terminal type derived from the
+.Pa /etc/ttys
+file or the
+.Ev TERM
+environment variable is often something generic like
+.Dq network ,
+.Dq dialup ,
+or
+.Dq unknown .
+When
+.Nm
+is used in a startup script
+.Pf ( Pa .profile
+for
+.Xr sh 1
+users or
+.Pa .login
+for
+.Xr csh 1
+users) it is often desirable to provide information about the type of
+terminal used on such ports.
+The purpose of the
+.Fl m
+option is to
+.Dq map
+from some set of conditions to a terminal type, that is, to
+tell
+.Nm
+``If I'm on this port at a particular speed, guess that I'm on that
+kind of terminal''.
+.Pp
+The argument to the
+.Fl m
+option consists of an optional port type, an optional operator, an optional
+baud rate specification, an optional colon (``:'') character and a terminal
+type.
+The port type is a string (delimited by either the operator or the colon
+character).
+The operator may be any combination of:
+.Dq Li \&> ,
+.Dq Li \&< ,
+.Dq Li \&@ ,
+and
+.Dq Li \&! ;
+.Dq Li \&>
+means greater than,
+.Dq Li \&<
+means less than,
+.Dq Li \&@
+means equal to
+and
+.Dq Li !\&
+inverts the sense of the test.
+The baud rate is specified as a number and is compared with the speed
+of the standard error output (which should be the control terminal).
+The terminal type is a string.
+.Pp
+If the terminal type is not specified on the command line, the
+.Fl m
+mappings are applied to the terminal type.
+If the port type and baud rate match the mapping, the terminal type specified
+in the mapping replaces the current type.
+If more than one mapping is specified, the first applicable mapping is used.
+.Pp
+For example, consider the following mapping:
+.Dq Li dialup>9600:vt100 .
+The port type is
+.Dq Li dialup ,
+the operator is
+.Dq Li > ,
+the baud rate specification is
+.Dq Li 9600 ,
+and the terminal type is
+.Dq Li vt100 .
+The result of this mapping is to specify that if the terminal type is
+.Dq Li dialup ,
+and the baud rate is greater than 9600 baud, a terminal type of
+.Dq Li vt100
+will be used.
+.Pp
+If no port type is specified, the terminal type will match any port type,
+for example,
+.Dq Li -m dialup:vt100 -m :?xterm
+will cause any dialup port, regardless of baud rate, to match the terminal
+type
+.Dq Li vt100 ,
+and any non-dialup port type to match the terminal type
+.Dq Li ?xterm .
+Note, because of the leading question mark, the user will be
+queried on a default port as to whether they are actually using an
+.Ar xterm
+terminal.
+.Pp
+No whitespace characters are permitted in the
+.Fl m
+option argument.
+Also, to avoid problems with metacharacters, it is suggested that the entire
+.Fl m
+option argument be placed within single quote characters, and that
+.Nm csh
+users insert a backslash character (``\e'') before any exclamation
+marks (``!'').
+.Sh ENVIRONMENT
+The
+.Nm
+command utilizes the
+.Ev SHELL
+and
+.Ev TERM
+environment variables.
+.Sh FILES
+.Bl -tag -width /usr/share/misc/termcap -compact
+.It Pa /etc/ttys
+system port name to terminal type mapping database
+.It Pa /usr/share/misc/termcap
+terminal capability database
+.El
+.Sh COMPATIBILITY
+The
+.Fl A ,
+.Fl E ,
+.Fl h ,
+.Fl u
+and
+.Fl v
+options have been deleted from the
+.Nm
+utility.
+None of them were documented in
+.Bx 4.3
+and all are of limited utility at
+best.
+The
+.Fl a ,
+.Fl d
+and
+.Fl p
+options are similarly not documented or useful, but were retained as they
+appear to be in widespread use.
+It is strongly recommended that any usage of these three options be
+changed to use the
+.Fl m
+option instead.
+The
+.Fl n
+option remains, but has no effect.
+It is still permissible to specify the
+.Fl e ,
+.Fl i
+and
+.Fl k
+options without arguments, although it is strongly recommended that such
+usage be fixed to explicitly specify the character.
+.Pp
+Executing
+.Nm
+as
+.Nm reset
+no longer implies the
+.Fl Q
+option.
+Also, the interaction between the
+.Fl
+option and the
+.Ar terminal
+argument in some historic implementations of
+.Nm
+has been removed.
+.Pp
+Finally, the
+.Nm
+implementation has been completely redone (as part of the addition to the
+system of a
+.St -p1003.1-88
+compliant terminal interface) and will no longer compile on systems with
+older terminal interfaces.
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr sh 1 ,
+.Xr stty 1 ,
+.Xr tty 4 ,
+.Xr termcap 5 ,
+.Xr ttys 5 ,
+.Xr environ 7
+.Sh HISTORY
+The
+.Nm
+and
+.Nm reset
+utilities first appeared in
+.Bx 1 .
+.Sh AUTHORS
+.An -nosplit
+The original version of
+.Nm tset
+was written by
+.An Eric P. Allman
+in October 1977, and
+.Nm reset
+was originally written by
+.An Kurt Shoens .
+The current version also contains code by
+.An Zeyd M. Ben-Halim ,
+.An Eric S. Raymond ,
+and
+.An Thomas E. Dickey .
diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c
new file mode 100644
index 0000000..0196a2d
--- /dev/null
+++ b/usr.bin/tset/tset.c
@@ -0,0 +1,297 @@
+/*-
+ * Copyright (c) 1980, 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)tset.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termcap.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+void obsolete(char *[]);
+void report(const char *, int, u_int);
+void usage(void);
+
+struct termios mode, oldmode;
+
+int erasech; /* new erase character */
+int intrchar; /* new interrupt character */
+int isreset; /* invoked as reset */
+int killch; /* new kill character */
+int Lines, Columns; /* window size */
+speed_t Ospeed;
+
+int
+main(int argc, char *argv[])
+{
+#ifdef TIOCGWINSZ
+ struct winsize win;
+#endif
+ int ch, noinit, noset, quiet, Sflag, sflag, showterm, usingupper;
+ char *p, *tcapbuf;
+ const char *ttype;
+
+ if (tcgetattr(STDERR_FILENO, &mode) < 0)
+ err(1, "standard error");
+
+ oldmode = mode;
+ Ospeed = cfgetospeed(&mode);
+
+ if ((p = strrchr(*argv, '/')))
+ ++p;
+ else
+ p = *argv;
+ usingupper = isupper(*p);
+ if (!strcasecmp(p, "reset")) {
+ isreset = 1;
+ reset_mode();
+ }
+
+ obsolete(argv);
+ noinit = noset = quiet = Sflag = sflag = showterm = 0;
+ while ((ch = getopt(argc, argv, "-a:d:e:Ii:k:m:np:QSrs")) != -1) {
+ switch (ch) {
+ case '-': /* display term only */
+ noset = 1;
+ break;
+ case 'a': /* OBSOLETE: map identifier to type */
+ add_mapping("arpanet", optarg);
+ break;
+ case 'd': /* OBSOLETE: map identifier to type */
+ add_mapping("dialup", optarg);
+ break;
+ case 'e': /* erase character */
+ erasech = optarg[0] == '^' && optarg[1] != '\0' ?
+ optarg[1] == '?' ? '\177' : CTRL(optarg[1]) :
+ optarg[0];
+ break;
+ case 'I': /* no initialization strings */
+ noinit = 1;
+ break;
+ case 'i': /* interrupt character */
+ intrchar = optarg[0] == '^' && optarg[1] != '\0' ?
+ optarg[1] == '?' ? '\177' : CTRL(optarg[1]) :
+ optarg[0];
+ break;
+ case 'k': /* kill character */
+ killch = optarg[0] == '^' && optarg[1] != '\0' ?
+ optarg[1] == '?' ? '\177' : CTRL(optarg[1]) :
+ optarg[0];
+ break;
+ case 'm': /* map identifier to type */
+ add_mapping(NULL, optarg);
+ break;
+ case 'n': /* OBSOLETE: set new tty driver */
+ break;
+ case 'p': /* OBSOLETE: map identifier to type */
+ add_mapping("plugboard", optarg);
+ break;
+ case 'Q': /* don't output control key settings */
+ quiet = 1;
+ break;
+ case 'S': /* output TERM/TERMCAP strings */
+ Sflag = 1;
+ break;
+ case 'r': /* display term on stderr */
+ showterm = 1;
+ break;
+ case 's': /* output TERM/TERMCAP strings */
+ sflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 1)
+ usage();
+
+ ttype = get_termcap_entry(*argv, &tcapbuf);
+
+ if (!noset) {
+ Columns = tgetnum("co");
+ Lines = tgetnum("li");
+
+#ifdef TIOCGWINSZ
+ /* Set window size */
+ (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win);
+ if (win.ws_row == 0 && win.ws_col == 0 &&
+ Lines > 0 && Columns > 0) {
+ win.ws_row = Lines;
+ win.ws_col = Columns;
+ (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win);
+ }
+#endif
+ set_control_chars();
+ set_conversions(usingupper);
+
+ if (!noinit)
+ set_init();
+
+ /* Set the modes if they've changed. */
+ if (memcmp(&mode, &oldmode, sizeof(mode)))
+ tcsetattr(STDERR_FILENO, TCSADRAIN, &mode);
+ }
+
+ if (noset)
+ (void)printf("%s\n", ttype);
+ else {
+ if (showterm)
+ (void)fprintf(stderr, "Terminal type is %s.\n", ttype);
+ /*
+ * If erase, kill and interrupt characters could have been
+ * modified and not -Q, display the changes.
+ */
+ if (!quiet) {
+ report("Erase", VERASE, CERASE);
+ report("Kill", VKILL, CKILL);
+ report("Interrupt", VINTR, CINTR);
+ }
+ }
+
+ if (Sflag) {
+ (void)printf("%s ", ttype);
+ if (strlen(tcapbuf) > 0)
+ wrtermcap(tcapbuf);
+ }
+
+ if (sflag) {
+ /*
+ * Figure out what shell we're using. A hack, we look for an
+ * environmental variable SHELL ending in "csh".
+ */
+ if ((p = getenv("SHELL")) &&
+ !strcmp(p + strlen(p) - 3, "csh")) {
+ printf("set noglob;\nsetenv TERM %s;\n", ttype);
+ if (strlen(tcapbuf) > 0) {
+ printf("setenv TERMCAP '");
+ wrtermcap(tcapbuf);
+ printf("';\n");
+ }
+ printf("unset noglob;\n");
+ } else {
+ printf("TERM=%s;\n", ttype);
+ if (strlen(tcapbuf) > 0) {
+ printf("TERMCAP='");
+ wrtermcap(tcapbuf);
+ printf("';\nexport TERMCAP;\n");
+ }
+ printf("export TERM;\n");
+ }
+ }
+
+ exit(0);
+}
+
+/*
+ * Tell the user if a control key has been changed from the default value.
+ */
+void
+report(const char *name, int which, u_int def)
+{
+ u_int old, new;
+
+ new = mode.c_cc[which];
+ old = oldmode.c_cc[which];
+
+ if (old == new && old == def)
+ return;
+
+ (void)fprintf(stderr, "%s %s ", name, old == new ? "is" : "set to");
+
+ if (new == 010)
+ (void)fprintf(stderr, "backspace.\n");
+ else if (new == 0177)
+ (void)fprintf(stderr, "delete.\n");
+ else if (new < 040) {
+ new ^= 0100;
+ (void)fprintf(stderr, "control-%c (^%c).\n", new, new);
+ } else
+ (void)fprintf(stderr, "%c.\n", new);
+}
+
+/*
+ * Convert the obsolete argument form into something that getopt can handle.
+ * This means that -e, -i and -k get default arguments supplied for them.
+ */
+void
+obsolete(char *argv[])
+{
+ for (; *argv; ++argv) {
+ if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') ||
+ (argv[0][1] != 'e' && argv[0][1] != 'i' && argv[0][1] != 'k') ||
+ argv[0][2] != '\0')
+ continue;
+ switch(argv[0][1]) {
+ case 'e':
+ argv[0] = strdup("-e^H");
+ break;
+ case 'i':
+ argv[0] = strdup("-i^C");
+ break;
+ case 'k':
+ argv[0] = strdup("-k^U");
+ break;
+ }
+ }
+}
+
+void
+usage(void)
+{
+ (void)fprintf(stderr, "%s\n%s\n",
+"usage: tset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]",
+" reset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]");
+ exit(1);
+}
+
diff --git a/usr.bin/tset/wrterm.c b/usr.bin/tset/wrterm.c
new file mode 100644
index 0000000..77751fa
--- /dev/null
+++ b/usr.bin/tset/wrterm.c
@@ -0,0 +1,114 @@
+/*-
+ * Copyright (c) 1991, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "extern.h"
+
+/*
+ * Output termcap entry to stdout, quoting characters that would give the
+ * shell problems and omitting empty fields.
+ */
+void
+wrtermcap(char *bp)
+{
+ register int ch;
+ register char *p;
+ char *t, *sep;
+
+ /* Find the end of the terminal names. */
+ if ((t = strchr(bp, ':')) == NULL)
+ errx(1, "termcap names not colon terminated");
+ *t++ = '\0';
+
+ /* Output terminal names that don't have whitespace. */
+ sep = strdup("");
+ while ((p = strsep(&bp, "|")) != NULL)
+ if (*p != '\0' && strpbrk(p, " \t") == NULL) {
+ (void)printf("%s%s", sep, p);
+ sep = strdup("|");
+ }
+ (void)putchar(':');
+
+ /*
+ * Output fields, transforming any dangerous characters. Skip
+ * empty fields or fields containing only whitespace.
+ */
+ while ((p = strsep(&t, ":")) != NULL) {
+ while ((ch = *p) != '\0' && isspace(ch))
+ ++p;
+ if (ch == '\0')
+ continue;
+ while ((ch = *p++) != '\0')
+ switch(ch) {
+ case '\033':
+ (void)printf("\\E");
+ case ' ': /* No spaces. */
+ (void)printf("\\040");
+ break;
+ case '!': /* No csh history chars. */
+ (void)printf("\\041");
+ break;
+ case ',': /* No csh history chars. */
+ (void)printf("\\054");
+ break;
+ case '"': /* No quotes. */
+ (void)printf("\\042");
+ break;
+ case '\'': /* No quotes. */
+ (void)printf("\\047");
+ break;
+ case '`': /* No quotes. */
+ (void)printf("\\140");
+ break;
+ case '\\': /* Anything following is OK. */
+ case '^':
+ (void)putchar(ch);
+ if ((ch = *p++) == '\0')
+ break;
+ /* FALLTHROUGH */
+ default:
+ (void)putchar(ch);
+ }
+ (void)putchar(':');
+ }
+}
diff --git a/usr.bin/tsort/Makefile b/usr.bin/tsort/Makefile
new file mode 100644
index 0000000..b0d353e
--- /dev/null
+++ b/usr.bin/tsort/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= tsort
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tsort/Makefile.depend b/usr.bin/tsort/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/tsort/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/tsort/tsort.1 b/usr.bin/tsort/tsort.1
new file mode 100644
index 0000000..8a73d0c
--- /dev/null
+++ b/usr.bin/tsort/tsort.1
@@ -0,0 +1,93 @@
+.\" Copyright (c) 1990, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This manual is derived from one contributed to Berkeley by
+.\" Michael Rendell of Memorial University of Newfoundland.
+.\"
+.\" 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.
+.\"
+.\" @(#)tsort.1 8.3 (Berkeley) 4/1/94
+.\" $FreeBSD$
+.\"
+.Dd December 27, 2006
+.Dt TSORT 1
+.Os
+.Sh NAME
+.Nm tsort
+.Nd topological sort of a directed graph
+.Sh SYNOPSIS
+.Nm
+.Op Fl dlq
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility takes a list of pairs of node names representing directed arcs in
+a graph and prints the nodes in topological order on standard output.
+Input is taken from the named
+.Ar file ,
+or from standard input if no file
+is given.
+.Pp
+There must be an even number of nodes in the input.
+Node names specified on the same line should be white space separated.
+.Pp
+Presence of a node in a graph can be represented by an arc from the node
+to itself.
+This is useful when a node is not connected to any other nodes.
+.Pp
+If the graph contains a cycle (and therefore cannot be properly sorted),
+one of the arcs in the cycle is ignored and the sort continues.
+Cycles are reported on standard error.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d
+Turn on debugging.
+.It Fl l
+Search for and display the longest cycle.
+Can take a very long time.
+.It Fl q
+Do not display informational messages about cycles.
+This is primarily
+intended for building libraries, where optimal ordering is not critical,
+and cycles occur often.
+.El
+.Sh SEE ALSO
+.Xr ar 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.At v7 .
+This
+.Nm
+command and manual page are derived from sources contributed to Berkeley by
+.An Michael Rendell
+of Memorial University of Newfoundland.
+.Sh BUGS
+The
+.Nm
+utility does not recognize multibyte characters.
diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c
new file mode 100644
index 0000000..1511b36
--- /dev/null
+++ b/usr.bin/tsort/tsort.c
@@ -0,0 +1,428 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Michael Rendell of Memorial University of Newfoundland.
+ *
+ * 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) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static const char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95";
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <db.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * Topological sort. Input is a list of pairs of strings separated by
+ * white space (spaces, tabs, and/or newlines); strings are written to
+ * standard output in sorted order, one per line.
+ *
+ * usage:
+ * tsort [-dlq] [inputfile]
+ * If no input file is specified, standard input is read.
+ *
+ * Should be compatible with AT&T tsort HOWEVER the output is not identical
+ * (i.e. for most graphs there is more than one sorted order, and this tsort
+ * usually generates a different one then the AT&T tsort). Also, cycle
+ * reporting seems to be more accurate in this version (the AT&T tsort
+ * sometimes says a node is in a cycle when it isn't).
+ *
+ * Michael Rendell, michael@stretch.cs.mun.ca - Feb 26, '90
+ */
+
+#define NF_MARK 0x1 /* marker for cycle detection */
+#define NF_ACYCLIC 0x2 /* this node is cycle free */
+#define NF_NODEST 0x4 /* Unreachable */
+
+
+typedef struct node_str NODE;
+
+struct node_str {
+ NODE **n_prevp; /* pointer to previous node's n_next */
+ NODE *n_next; /* next node in graph */
+ NODE **n_arcs; /* array of arcs to other nodes */
+ int n_narcs; /* number of arcs in n_arcs[] */
+ int n_arcsize; /* size of n_arcs[] array */
+ int n_refcnt; /* # of arcs pointing to this node */
+ int n_flags; /* NF_* */
+ char n_name[1]; /* name of this node */
+};
+
+typedef struct _buf {
+ char *b_buf;
+ int b_bsize;
+} BUF;
+
+static DB *db;
+static NODE *graph, **cycle_buf, **longest_cycle;
+static int debug, longest, quiet;
+
+static void add_arc(char *, char *);
+static int find_cycle(NODE *, NODE *, int, int);
+static NODE *get_node(char *);
+static void *grow_buf(void *, size_t);
+static void remove_node(NODE *);
+static void clear_cycle(void);
+static void tsort(void);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ BUF *b;
+ int c, n;
+ FILE *fp;
+ int bsize, ch, nused;
+ BUF bufs[2];
+
+ fp = NULL;
+ while ((ch = getopt(argc, argv, "dlq")) != -1)
+ switch (ch) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'l':
+ longest = 1;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (argc) {
+ case 0:
+ fp = stdin;
+ break;
+ case 1:
+ if ((fp = fopen(*argv, "r")) == NULL)
+ err(1, "%s", *argv);
+ break;
+ default:
+ usage();
+ }
+
+ for (b = bufs, n = 2; --n >= 0; b++)
+ b->b_buf = grow_buf(NULL, b->b_bsize = 1024);
+
+ /* parse input and build the graph */
+ for (n = 0, c = getc(fp);;) {
+ while (c != EOF && isspace(c))
+ c = getc(fp);
+ if (c == EOF)
+ break;
+
+ nused = 0;
+ b = &bufs[n];
+ bsize = b->b_bsize;
+ do {
+ b->b_buf[nused++] = c;
+ if (nused == bsize)
+ b->b_buf = grow_buf(b->b_buf, bsize *= 2);
+ c = getc(fp);
+ } while (c != EOF && !isspace(c));
+
+ b->b_buf[nused] = '\0';
+ b->b_bsize = bsize;
+ if (n)
+ add_arc(bufs[0].b_buf, bufs[1].b_buf);
+ n = !n;
+ }
+ (void)fclose(fp);
+ if (n)
+ errx(1, "odd data count");
+
+ /* do the sort */
+ tsort();
+ exit(0);
+}
+
+/* double the size of oldbuf and return a pointer to the new buffer. */
+static void *
+grow_buf(void *bp, size_t size)
+{
+ if ((bp = realloc(bp, size)) == NULL)
+ err(1, NULL);
+ return (bp);
+}
+
+/*
+ * add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in
+ * the graph, then add them.
+ */
+static void
+add_arc(char *s1, char *s2)
+{
+ NODE *n1;
+ NODE *n2;
+ int bsize, i;
+
+ n1 = get_node(s1);
+
+ if (!strcmp(s1, s2))
+ return;
+
+ n2 = get_node(s2);
+
+ /*
+ * Check if this arc is already here.
+ */
+ for (i = 0; i < n1->n_narcs; i++)
+ if (n1->n_arcs[i] == n2)
+ return;
+ /*
+ * Add it.
+ */
+ if (n1->n_narcs == n1->n_arcsize) {
+ if (!n1->n_arcsize)
+ n1->n_arcsize = 10;
+ bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2;
+ n1->n_arcs = grow_buf(n1->n_arcs, bsize);
+ n1->n_arcsize = bsize / sizeof(*n1->n_arcs);
+ }
+ n1->n_arcs[n1->n_narcs++] = n2;
+ ++n2->n_refcnt;
+}
+
+/* Find a node in the graph (insert if not found) and return a pointer to it. */
+static NODE *
+get_node(char *name)
+{
+ DBT data, key;
+ NODE *n;
+
+ if (db == NULL &&
+ (db = dbopen(NULL, O_RDWR, 0, DB_HASH, NULL)) == NULL)
+ err(1, "db: %s", name);
+
+ key.data = name;
+ key.size = strlen(name) + 1;
+
+ switch ((*db->get)(db, &key, &data, 0)) {
+ case 0:
+ bcopy(data.data, &n, sizeof(n));
+ return (n);
+ case 1:
+ break;
+ default:
+ case -1:
+ err(1, "db: %s", name);
+ }
+
+ if ((n = malloc(sizeof(NODE) + key.size)) == NULL)
+ err(1, NULL);
+
+ n->n_narcs = 0;
+ n->n_arcsize = 0;
+ n->n_arcs = NULL;
+ n->n_refcnt = 0;
+ n->n_flags = 0;
+ bcopy(name, n->n_name, key.size);
+
+ /* Add to linked list. */
+ if ((n->n_next = graph) != NULL)
+ graph->n_prevp = &n->n_next;
+ n->n_prevp = &graph;
+ graph = n;
+
+ /* Add to hash table. */
+ data.data = &n;
+ data.size = sizeof(n);
+ if ((*db->put)(db, &key, &data, 0))
+ err(1, "db: %s", name);
+ return (n);
+}
+
+
+/*
+ * Clear the NODEST flag from all nodes.
+ */
+static void
+clear_cycle(void)
+{
+ NODE *n;
+
+ for (n = graph; n != NULL; n = n->n_next)
+ n->n_flags &= ~NF_NODEST;
+}
+
+/* do topological sort on graph */
+static void
+tsort(void)
+{
+ NODE *n, *next;
+ int cnt, i;
+
+ while (graph != NULL) {
+ /*
+ * Keep getting rid of simple cases until there are none left,
+ * if there are any nodes still in the graph, then there is
+ * a cycle in it.
+ */
+ do {
+ for (cnt = 0, n = graph; n != NULL; n = next) {
+ next = n->n_next;
+ if (n->n_refcnt == 0) {
+ remove_node(n);
+ ++cnt;
+ }
+ }
+ } while (graph != NULL && cnt);
+
+ if (graph == NULL)
+ break;
+
+ if (!cycle_buf) {
+ /*
+ * Allocate space for two cycle logs - one to be used
+ * as scratch space, the other to save the longest
+ * cycle.
+ */
+ for (cnt = 0, n = graph; n != NULL; n = n->n_next)
+ ++cnt;
+ cycle_buf = malloc(sizeof(NODE *) * cnt);
+ longest_cycle = malloc(sizeof(NODE *) * cnt);
+ if (cycle_buf == NULL || longest_cycle == NULL)
+ err(1, NULL);
+ }
+ for (n = graph; n != NULL; n = n->n_next)
+ if (!(n->n_flags & NF_ACYCLIC)) {
+ if ((cnt = find_cycle(n, n, 0, 0))) {
+ if (!quiet) {
+ warnx("cycle in data");
+ for (i = 0; i < cnt; i++)
+ warnx("%s",
+ longest_cycle[i]->n_name);
+ }
+ remove_node(n);
+ clear_cycle();
+ break;
+ } else {
+ /* to avoid further checks */
+ n->n_flags |= NF_ACYCLIC;
+ clear_cycle();
+ }
+ }
+
+ if (n == NULL)
+ errx(1, "internal error -- could not find cycle");
+ }
+}
+
+/* print node and remove from graph (does not actually free node) */
+static void
+remove_node(NODE *n)
+{
+ NODE **np;
+ int i;
+
+ (void)printf("%s\n", n->n_name);
+ for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
+ --(*np)->n_refcnt;
+ n->n_narcs = 0;
+ *n->n_prevp = n->n_next;
+ if (n->n_next)
+ n->n_next->n_prevp = n->n_prevp;
+}
+
+
+/* look for the longest? cycle from node from to node to. */
+static int
+find_cycle(NODE *from, NODE *to, int longest_len, int depth)
+{
+ NODE **np;
+ int i, len;
+
+ /*
+ * avoid infinite loops and ignore portions of the graph known
+ * to be acyclic
+ */
+ if (from->n_flags & (NF_NODEST|NF_MARK|NF_ACYCLIC))
+ return (0);
+ from->n_flags |= NF_MARK;
+
+ for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) {
+ cycle_buf[depth] = *np;
+ if (*np == to) {
+ if (depth + 1 > longest_len) {
+ longest_len = depth + 1;
+ (void)memcpy((char *)longest_cycle,
+ (char *)cycle_buf,
+ longest_len * sizeof(NODE *));
+ }
+ } else {
+ if ((*np)->n_flags & (NF_MARK|NF_ACYCLIC|NF_NODEST))
+ continue;
+ len = find_cycle(*np, to, longest_len, depth + 1);
+
+ if (debug)
+ (void)printf("%*s %s->%s %d\n", depth, "",
+ from->n_name, to->n_name, len);
+
+ if (len == 0)
+ (*np)->n_flags |= NF_NODEST;
+
+ if (len > longest_len)
+ longest_len = len;
+
+ if (len > 0 && !longest)
+ break;
+ }
+ }
+ from->n_flags &= ~NF_MARK;
+ return (longest_len);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: tsort [-dlq] [file]\n");
+ exit(1);
+}
diff --git a/usr.bin/tty/Makefile b/usr.bin/tty/Makefile
new file mode 100644
index 0000000..4dcab33
--- /dev/null
+++ b/usr.bin/tty/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= tty
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/tty/Makefile.depend b/usr.bin/tty/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/tty/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/tty/tty.1 b/usr.bin/tty/tty.1
new file mode 100644
index 0000000..177171a
--- /dev/null
+++ b/usr.bin/tty/tty.1
@@ -0,0 +1,83 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)tty.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt TTY 1
+.Os
+.Sh NAME
+.Nm tty
+.Nd return user's terminal name
+.Sh SYNOPSIS
+.Nm
+.Op Fl s
+.Sh DESCRIPTION
+The
+.Nm
+utility writes the name of the terminal attached to standard input
+to standard output.
+The name that is written is the string returned by
+.Xr ttyname 3 .
+If the standard input is not a terminal, the message
+.Dq Li "not a tty"
+is written.
+The options are as follows:
+.Bl -tag -width indent
+.It Fl s
+Do not write the terminal name; only the exit status is affected
+when this option is specified.
+The
+.Fl s
+option is deprecated in favor of the
+.Dq Li "test -t 0"
+command.
+.El
+.Sh EXIT STATUS
+The
+.Nm
+utility
+exits 0 if the standard input is a terminal, 1 if the standard input is
+not a terminal, and >1 if an error occurs.
+.Sh SEE ALSO
+.Xr test 1 ,
+.Xr ttyname 3
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compatible.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/tty/tty.c b/usr.bin/tty/tty.c
new file mode 100644
index 0000000..450722a
--- /dev/null
+++ b/usr.bin/tty/tty.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1988, 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) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif /* not lint */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ int ch, sflag;
+ char *t;
+
+ sflag = 0;
+ while ((ch = getopt(argc, argv, "s")) != -1)
+ switch (ch) {
+ case 's':
+ sflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ t = ttyname(0);
+ if (!sflag)
+ puts(t ? t : "not a tty");
+ exit(t ? 0 : 1);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: tty [-s]\n");
+ exit(2);
+}
diff --git a/usr.bin/ul/Makefile b/usr.bin/ul/Makefile
new file mode 100644
index 0000000..817f07b
--- /dev/null
+++ b/usr.bin/ul/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= ul
+
+LIBADD= ncursesw
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ul/Makefile.depend b/usr.bin/ul/Makefile.depend
new file mode 100644
index 0000000..59bc828
--- /dev/null
+++ b/usr.bin/ul/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/ul/ul.1 b/usr.bin/ul/ul.1
new file mode 100644
index 0000000..a9f67ab
--- /dev/null
+++ b/usr.bin/ul/ul.1
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1980, 1991, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" @(#)ul.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2004
+.Dt UL 1
+.Os
+.Sh NAME
+.Nm ul
+.Nd do underlining
+.Sh SYNOPSIS
+.Nm
+.Op Fl i
+.Op Fl t Ar terminal
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility reads the named files (or standard input if none are given)
+and translates occurrences of underscores to the sequence
+which indicates underlining for the terminal in use, as specified
+by the environment variable
+.Ev TERM .
+The file
+.Pa /etc/termcap
+is read to determine the appropriate sequences for underlining.
+If the terminal is incapable of underlining, but is capable of
+a standout mode then that is used instead.
+If the terminal can overstrike,
+or handles underlining automatically,
+.Nm
+degenerates to
+.Xr cat 1 .
+If the terminal cannot underline, underlining is ignored.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl i
+Underlining is indicated by a separate line containing appropriate
+dashes
+.Ql \- ;
+this is useful when you want to look at the underlining
+which is present in an
+.Xr nroff 1
+output stream on a CRT-terminal.
+.It Fl t Ar terminal
+Overrides the terminal type specified in the environment with
+.Ar terminal .
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL , LC_CTYPE
+and
+.Ev TERM
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr colcrt 1 ,
+.Xr man 1 ,
+.Xr nroff 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Sh BUGS
+The
+.Xr nroff 1
+command usually outputs a series of backspaces and underlines intermixed
+with the text to indicate underlining.
+No attempt is made to optimize
+the backward motion.
diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c
new file mode 100644
index 0000000..4816b7d
--- /dev/null
+++ b/usr.bin/ul/ul.c
@@ -0,0 +1,561 @@
+/*
+ * Copyright (c) 1980, 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.
+ * 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.
+ *
+ * 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)ul.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <err.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termcap.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define IESC '\033'
+#define SO '\016'
+#define SI '\017'
+#define HFWD '9'
+#define HREV '8'
+#define FREV '7'
+#define MAXBUF 512
+
+#define NORMAL 000
+#define ALTSET 001 /* Reverse */
+#define SUPERSC 002 /* Dim */
+#define SUBSC 004 /* Dim | Ul */
+#define UNDERL 010 /* Ul */
+#define BOLD 020 /* Bold */
+
+static int must_use_uc, must_overstrike;
+static const char
+ *CURS_UP, *CURS_RIGHT, *CURS_LEFT,
+ *ENTER_STANDOUT, *EXIT_STANDOUT, *ENTER_UNDERLINE, *EXIT_UNDERLINE,
+ *ENTER_DIM, *ENTER_BOLD, *ENTER_REVERSE, *UNDER_CHAR, *EXIT_ATTRIBUTES;
+
+struct CHAR {
+ char c_mode;
+ wchar_t c_char;
+ int c_width; /* width or -1 if multi-column char. filler */
+} ;
+
+static struct CHAR obuf[MAXBUF];
+static int col, maxcol;
+static int mode;
+static int halfpos;
+static int upln;
+static int iflag;
+
+static void usage(void);
+static void setnewmode(int);
+static void initcap(void);
+static void reverse(void);
+static int outchar(int);
+static void fwd(void);
+static void initbuf(void);
+static void iattr(void);
+static void overstrike(void);
+static void flushln(void);
+static void filter(FILE *);
+static void outc(wint_t, int);
+
+#define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar)
+
+int
+main(int argc, char **argv)
+{
+ int c;
+ const char *termtype;
+ FILE *f;
+ char termcap[1024];
+
+ setlocale(LC_ALL, "");
+
+ termtype = getenv("TERM");
+ if (termtype == NULL || (argv[0][0] == 'c' && !isatty(1)))
+ termtype = "lpr";
+ while ((c = getopt(argc, argv, "it:T:")) != -1)
+ switch (c) {
+ case 't':
+ case 'T': /* for nroff compatibility */
+ termtype = optarg;
+ break;
+ case 'i':
+ iflag = 1;
+ break;
+ default:
+ usage();
+ }
+
+ switch (tgetent(termcap, termtype)) {
+ case 1:
+ break;
+ default:
+ warnx("trouble reading termcap");
+ /* FALLTHROUGH */
+ case 0:
+ /* No such terminal type - assume dumb */
+ (void)strcpy(termcap, "dumb:os:col#80:cr=^M:sf=^J:am:");
+ break;
+ }
+ initcap();
+ if ((tgetflag("os") && ENTER_BOLD == NULL ) ||
+ (tgetflag("ul") && ENTER_UNDERLINE == NULL && UNDER_CHAR == NULL))
+ must_overstrike = 1;
+ initbuf();
+ if (optind == argc)
+ filter(stdin);
+ else for (; optind<argc; optind++) {
+ f = fopen(argv[optind],"r");
+ if (f == NULL)
+ err(1, "%s", argv[optind]);
+ else
+ filter(f);
+ }
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: ul [-i] [-t terminal] [file ...]\n");
+ exit(1);
+}
+
+static void
+filter(FILE *f)
+{
+ wint_t c;
+ int i, w;
+
+ while ((c = getwc(f)) != WEOF && col < MAXBUF) switch(c) {
+
+ case '\b':
+ if (col > 0)
+ col--;
+ continue;
+
+ case '\t':
+ col = (col+8) & ~07;
+ if (col > maxcol)
+ maxcol = col;
+ continue;
+
+ case '\r':
+ col = 0;
+ continue;
+
+ case SO:
+ mode |= ALTSET;
+ continue;
+
+ case SI:
+ mode &= ~ALTSET;
+ continue;
+
+ case IESC:
+ switch (c = getwc(f)) {
+
+ case HREV:
+ if (halfpos == 0) {
+ mode |= SUPERSC;
+ halfpos--;
+ } else if (halfpos > 0) {
+ mode &= ~SUBSC;
+ halfpos--;
+ } else {
+ halfpos = 0;
+ reverse();
+ }
+ continue;
+
+ case HFWD:
+ if (halfpos == 0) {
+ mode |= SUBSC;
+ halfpos++;
+ } else if (halfpos < 0) {
+ mode &= ~SUPERSC;
+ halfpos++;
+ } else {
+ halfpos = 0;
+ fwd();
+ }
+ continue;
+
+ case FREV:
+ reverse();
+ continue;
+
+ default:
+ errx(1, "unknown escape sequence in input: %o, %o", IESC, c);
+ }
+ continue;
+
+ case '_':
+ if (obuf[col].c_char || obuf[col].c_width < 0) {
+ while (col > 0 && obuf[col].c_width < 0)
+ col--;
+ w = obuf[col].c_width;
+ for (i = 0; i < w; i++)
+ obuf[col++].c_mode |= UNDERL | mode;
+ if (col > maxcol)
+ maxcol = col;
+ continue;
+ }
+ obuf[col].c_char = '_';
+ obuf[col].c_width = 1;
+ /* FALLTHROUGH */
+ case ' ':
+ col++;
+ if (col > maxcol)
+ maxcol = col;
+ continue;
+
+ case '\n':
+ flushln();
+ continue;
+
+ case '\f':
+ flushln();
+ putwchar('\f');
+ continue;
+
+ default:
+ if ((w = wcwidth(c)) <= 0) /* non printing */
+ continue;
+ if (obuf[col].c_char == '\0') {
+ obuf[col].c_char = c;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode = mode;
+ obuf[col].c_width = w;
+ for (i = 1; i < w; i++)
+ obuf[col + i].c_width = -1;
+ } else if (obuf[col].c_char == '_') {
+ obuf[col].c_char = c;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode |= UNDERL|mode;
+ obuf[col].c_width = w;
+ for (i = 1; i < w; i++)
+ obuf[col + i].c_width = -1;
+ } else if ((wint_t)obuf[col].c_char == c) {
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode |= BOLD|mode;
+ } else {
+ w = obuf[col].c_width;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode = mode;
+ }
+ col += w;
+ if (col > maxcol)
+ maxcol = col;
+ continue;
+ }
+ if (ferror(f))
+ err(1, NULL);
+ if (maxcol)
+ flushln();
+}
+
+static void
+flushln(void)
+{
+ int lastmode;
+ int i;
+ int hadmodes = 0;
+
+ lastmode = NORMAL;
+ for (i = 0; i < maxcol; i++) {
+ if (obuf[i].c_mode != lastmode) {
+ hadmodes++;
+ setnewmode(obuf[i].c_mode);
+ lastmode = obuf[i].c_mode;
+ }
+ if (obuf[i].c_char == '\0') {
+ if (upln)
+ PRINT(CURS_RIGHT);
+ else
+ outc(' ', 1);
+ } else
+ outc(obuf[i].c_char, obuf[i].c_width);
+ if (obuf[i].c_width > 1)
+ i += obuf[i].c_width - 1;
+ }
+ if (lastmode != NORMAL) {
+ setnewmode(0);
+ }
+ if (must_overstrike && hadmodes)
+ overstrike();
+ putwchar('\n');
+ if (iflag && hadmodes)
+ iattr();
+ (void)fflush(stdout);
+ if (upln)
+ upln--;
+ initbuf();
+}
+
+/*
+ * For terminals that can overstrike, overstrike underlines and bolds.
+ * We don't do anything with halfline ups and downs, or Greek.
+ */
+static void
+overstrike(void)
+{
+ int i;
+ wchar_t lbuf[256];
+ wchar_t *cp = lbuf;
+ int hadbold=0;
+
+ /* Set up overstrike buffer */
+ for (i=0; i<maxcol; i++)
+ switch (obuf[i].c_mode) {
+ case NORMAL:
+ default:
+ *cp++ = ' ';
+ break;
+ case UNDERL:
+ *cp++ = '_';
+ break;
+ case BOLD:
+ *cp++ = obuf[i].c_char;
+ if (obuf[i].c_width > 1)
+ i += obuf[i].c_width - 1;
+ hadbold=1;
+ break;
+ }
+ putwchar('\r');
+ for (*cp=' '; *cp==' '; cp--)
+ *cp = 0;
+ for (cp=lbuf; *cp; cp++)
+ putwchar(*cp);
+ if (hadbold) {
+ putwchar('\r');
+ for (cp=lbuf; *cp; cp++)
+ putwchar(*cp=='_' ? ' ' : *cp);
+ putwchar('\r');
+ for (cp=lbuf; *cp; cp++)
+ putwchar(*cp=='_' ? ' ' : *cp);
+ }
+}
+
+static void
+iattr(void)
+{
+ int i;
+ wchar_t lbuf[256];
+ wchar_t *cp = lbuf;
+
+ for (i=0; i<maxcol; i++)
+ switch (obuf[i].c_mode) {
+ case NORMAL: *cp++ = ' '; break;
+ case ALTSET: *cp++ = 'g'; break;
+ case SUPERSC: *cp++ = '^'; break;
+ case SUBSC: *cp++ = 'v'; break;
+ case UNDERL: *cp++ = '_'; break;
+ case BOLD: *cp++ = '!'; break;
+ default: *cp++ = 'X'; break;
+ }
+ for (*cp=' '; *cp==' '; cp--)
+ *cp = 0;
+ for (cp=lbuf; *cp; cp++)
+ putwchar(*cp);
+ putwchar('\n');
+}
+
+static void
+initbuf(void)
+{
+
+ bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */
+ col = 0;
+ maxcol = 0;
+ mode &= ALTSET;
+}
+
+static void
+fwd(void)
+{
+ int oldcol, oldmax;
+
+ oldcol = col;
+ oldmax = maxcol;
+ flushln();
+ col = oldcol;
+ maxcol = oldmax;
+}
+
+static void
+reverse(void)
+{
+ upln++;
+ fwd();
+ PRINT(CURS_UP);
+ PRINT(CURS_UP);
+ upln++;
+}
+
+static void
+initcap(void)
+{
+ static char tcapbuf[512];
+ char *bp = tcapbuf;
+
+ /* This nonsense attempts to work with both old and new termcap */
+ CURS_UP = tgetstr("up", &bp);
+ CURS_RIGHT = tgetstr("ri", &bp);
+ if (CURS_RIGHT == NULL)
+ CURS_RIGHT = tgetstr("nd", &bp);
+ CURS_LEFT = tgetstr("le", &bp);
+ if (CURS_LEFT == NULL)
+ CURS_LEFT = tgetstr("bc", &bp);
+ if (CURS_LEFT == NULL && tgetflag("bs"))
+ CURS_LEFT = "\b";
+
+ ENTER_STANDOUT = tgetstr("so", &bp);
+ EXIT_STANDOUT = tgetstr("se", &bp);
+ ENTER_UNDERLINE = tgetstr("us", &bp);
+ EXIT_UNDERLINE = tgetstr("ue", &bp);
+ ENTER_DIM = tgetstr("mh", &bp);
+ ENTER_BOLD = tgetstr("md", &bp);
+ ENTER_REVERSE = tgetstr("mr", &bp);
+ EXIT_ATTRIBUTES = tgetstr("me", &bp);
+
+ if (!ENTER_BOLD && ENTER_REVERSE)
+ ENTER_BOLD = ENTER_REVERSE;
+ if (!ENTER_BOLD && ENTER_STANDOUT)
+ ENTER_BOLD = ENTER_STANDOUT;
+ if (!ENTER_UNDERLINE && ENTER_STANDOUT) {
+ ENTER_UNDERLINE = ENTER_STANDOUT;
+ EXIT_UNDERLINE = EXIT_STANDOUT;
+ }
+ if (!ENTER_DIM && ENTER_STANDOUT)
+ ENTER_DIM = ENTER_STANDOUT;
+ if (!ENTER_REVERSE && ENTER_STANDOUT)
+ ENTER_REVERSE = ENTER_STANDOUT;
+ if (!EXIT_ATTRIBUTES && EXIT_STANDOUT)
+ EXIT_ATTRIBUTES = EXIT_STANDOUT;
+
+ /*
+ * Note that we use REVERSE for the alternate character set,
+ * not the as/ae capabilities. This is because we are modelling
+ * the model 37 teletype (since that's what nroff outputs) and
+ * the typical as/ae is more of a graphics set, not the greek
+ * letters the 37 has.
+ */
+
+ UNDER_CHAR = tgetstr("uc", &bp);
+ must_use_uc = (UNDER_CHAR && !ENTER_UNDERLINE);
+}
+
+static int
+outchar(int c)
+{
+ return (putwchar(c) != WEOF ? c : EOF);
+}
+
+static int curmode = 0;
+
+static void
+outc(wint_t c, int width)
+{
+ int i;
+
+ putwchar(c);
+ if (must_use_uc && (curmode&UNDERL)) {
+ for (i = 0; i < width; i++)
+ PRINT(CURS_LEFT);
+ for (i = 0; i < width; i++)
+ PRINT(UNDER_CHAR);
+ }
+}
+
+static void
+setnewmode(int newmode)
+{
+ if (!iflag) {
+ if (curmode != NORMAL && newmode != NORMAL)
+ setnewmode(NORMAL);
+ switch (newmode) {
+ case NORMAL:
+ switch(curmode) {
+ case NORMAL:
+ break;
+ case UNDERL:
+ PRINT(EXIT_UNDERLINE);
+ break;
+ default:
+ /* This includes standout */
+ PRINT(EXIT_ATTRIBUTES);
+ break;
+ }
+ break;
+ case ALTSET:
+ PRINT(ENTER_REVERSE);
+ break;
+ case SUPERSC:
+ /*
+ * This only works on a few terminals.
+ * It should be fixed.
+ */
+ PRINT(ENTER_UNDERLINE);
+ PRINT(ENTER_DIM);
+ break;
+ case SUBSC:
+ PRINT(ENTER_DIM);
+ break;
+ case UNDERL:
+ PRINT(ENTER_UNDERLINE);
+ break;
+ case BOLD:
+ PRINT(ENTER_BOLD);
+ break;
+ default:
+ /*
+ * We should have some provision here for multiple modes
+ * on at once. This will have to come later.
+ */
+ PRINT(ENTER_STANDOUT);
+ break;
+ }
+ }
+ curmode = newmode;
+}
diff --git a/usr.bin/uname/Makefile b/usr.bin/uname/Makefile
new file mode 100644
index 0000000..ae634ca
--- /dev/null
+++ b/usr.bin/uname/Makefile
@@ -0,0 +1,5 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+
+PROG= uname
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/uname/Makefile.depend b/usr.bin/uname/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/uname/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/uname/uname.1 b/usr.bin/uname/uname.1
new file mode 100644
index 0000000..28cb071
--- /dev/null
+++ b/usr.bin/uname/uname.1
@@ -0,0 +1,131 @@
+.\" Copyright (c) 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.
+.\"
+.\" @(#)uname.1 8.3 (Berkeley) 4/8/94
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2013
+.Dt UNAME 1
+.Os
+.Sh NAME
+.Nm uname
+.Nd display information about the system
+.Sh SYNOPSIS
+.Nm
+.Op Fl aiKmnoprsUv
+.Sh DESCRIPTION
+The
+.Nm
+command writes the name of the operating system implementation to
+standard output.
+When options are specified, strings representing one or more system
+characteristics are written to standard output.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+Behave as though the options
+.Fl m , n , r , s ,
+and
+.Fl v
+were specified.
+.It Fl i
+Write the kernel ident to standard output.
+.It Fl K
+Write the
+.Fx
+version of the kernel.
+.It Fl m
+Write the type of the current hardware platform to standard output.
+.It Fl n
+Write the name of the system to standard output.
+.It Fl o
+This is a synonym for the
+.Fl s
+option, for compatibility with other systems.
+.It Fl p
+Write the type of the machine processor architecture to standard output.
+.It Fl r
+Write the current release level of the operating system
+to standard output.
+.It Fl s
+Write the name of the operating system implementation to standard output.
+.It Fl U
+Write the
+.Fx
+version of the user environment.
+.It Fl v
+Write the version level of this release of the operating system
+to standard output.
+.El
+.Pp
+If the
+.Fl a
+flag is specified, or multiple flags are specified, all
+output is written on a single line, separated by spaces.
+.Pp
+The
+.Fl K
+and
+.Fl U
+flags are intended to be used for fine grain differentiation of incremental
+.Fx
+development and user visible changes.
+.Sh ENVIRONMENT
+An environment variable composed of the string
+.Ev UNAME_
+followed by any flag to the
+.Nm
+utility (except for
+.Fl a )
+will allow the corresponding data to be set to the contents
+of the environment variable.
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr feature_present 3 ,
+.Xr getosreldate 3 ,
+.Xr sysctl 3 ,
+.Xr uname 3 ,
+.Xr sysctl 8
+.Sh STANDARDS
+The
+.Nm
+command is expected to conform to the
+.St -p1003.2
+specification.
+.Sh HISTORY
+The
+.Nm
+command appeared in PWB UNIX.
+.Pp
+The
+.Fl K
+and
+.Fl U
+extension flags appeared in
+.Fx 10.0 .
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c
new file mode 100644
index 0000000..cf61622
--- /dev/null
+++ b/usr.bin/uname/uname.c
@@ -0,0 +1,285 @@
+/*-
+ * Copyright (c) 2002 Juli Mallett.
+ * Copyright (c) 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.
+ * 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
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)uname.c 8.2 (Berkeley) 5/4/95";
+#endif
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <osreldate.h>
+
+#define MFLAG 0x01
+#define NFLAG 0x02
+#define PFLAG 0x04
+#define RFLAG 0x08
+#define SFLAG 0x10
+#define VFLAG 0x20
+#define IFLAG 0x40
+#define UFLAG 0x80
+#define KFLAG 0x100
+
+typedef void (*get_t)(void);
+static get_t get_ident, get_platform, get_hostname, get_arch,
+ get_release, get_sysname, get_kernvers, get_uservers, get_version;
+
+static void native_ident(void);
+static void native_platform(void);
+static void native_hostname(void);
+static void native_arch(void);
+static void native_release(void);
+static void native_sysname(void);
+static void native_version(void);
+static void native_kernvers(void);
+static void native_uservers(void);
+static void print_uname(u_int);
+static void setup_get(void);
+static void usage(void);
+
+static char *ident, *platform, *hostname, *arch, *release, *sysname, *version, *kernvers, *uservers;
+static int space;
+
+int
+main(int argc, char *argv[])
+{
+ u_int flags;
+ int ch;
+
+ setup_get();
+ flags = 0;
+
+ while ((ch = getopt(argc, argv, "aiKmnoprsUv")) != -1)
+ switch(ch) {
+ case 'a':
+ flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
+ break;
+ case 'i':
+ flags |= IFLAG;
+ break;
+ case 'K':
+ flags |= KFLAG;
+ break;
+ case 'm':
+ flags |= MFLAG;
+ break;
+ case 'n':
+ flags |= NFLAG;
+ break;
+ case 'p':
+ flags |= PFLAG;
+ break;
+ case 'r':
+ flags |= RFLAG;
+ break;
+ case 's':
+ case 'o':
+ flags |= SFLAG;
+ break;
+ case 'U':
+ flags |= UFLAG;
+ break;
+ case 'v':
+ flags |= VFLAG;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc)
+ usage();
+
+ if (!flags)
+ flags |= SFLAG;
+
+ print_uname(flags);
+ exit(0);
+}
+
+#define CHECK_ENV(opt,var) \
+do { \
+ if ((var = getenv("UNAME_" opt)) == NULL) { \
+ get_##var = native_##var; \
+ } else { \
+ get_##var = (get_t)NULL; \
+ } \
+} while (0)
+
+static void
+setup_get(void)
+{
+ CHECK_ENV("s", sysname);
+ CHECK_ENV("n", hostname);
+ CHECK_ENV("r", release);
+ CHECK_ENV("v", version);
+ CHECK_ENV("m", platform);
+ CHECK_ENV("p", arch);
+ CHECK_ENV("i", ident);
+ CHECK_ENV("K", kernvers);
+ CHECK_ENV("U", uservers);
+}
+
+#define PRINT_FLAG(flags,flag,var) \
+ if ((flags & flag) == flag) { \
+ if (space) \
+ printf(" "); \
+ else \
+ space++; \
+ if (get_##var != NULL) \
+ (*get_##var)(); \
+ printf("%s", var); \
+ }
+
+static void
+print_uname(u_int flags)
+{
+ PRINT_FLAG(flags, SFLAG, sysname);
+ PRINT_FLAG(flags, NFLAG, hostname);
+ PRINT_FLAG(flags, RFLAG, release);
+ PRINT_FLAG(flags, VFLAG, version);
+ PRINT_FLAG(flags, MFLAG, platform);
+ PRINT_FLAG(flags, PFLAG, arch);
+ PRINT_FLAG(flags, IFLAG, ident);
+ PRINT_FLAG(flags, KFLAG, kernvers);
+ PRINT_FLAG(flags, UFLAG, uservers);
+ printf("\n");
+}
+
+#define NATIVE_SYSCTL2_GET(var,mib0,mib1) \
+static void \
+native_##var(void) \
+{ \
+ int mib[] = { (mib0), (mib1) }; \
+ size_t len; \
+ static char buf[1024]; \
+ char **varp = &(var); \
+ \
+ len = sizeof buf; \
+ if (sysctl(mib, sizeof mib / sizeof mib[0], \
+ &buf, &len, NULL, 0) == -1) \
+ err(1, "sysctl");
+
+#define NATIVE_SYSCTLNAME_GET(var,name) \
+static void \
+native_##var(void) \
+{ \
+ size_t len; \
+ static char buf[1024]; \
+ char **varp = &(var); \
+ \
+ len = sizeof buf; \
+ if (sysctlbyname(name, &buf, &len, NULL,\
+ 0) == -1) \
+ err(1, "sysctlbyname");
+
+#define NATIVE_SET \
+ *varp = buf; \
+ return; \
+} struct __hack
+
+#define NATIVE_BUFFER (buf)
+#define NATIVE_LENGTH (len)
+
+NATIVE_SYSCTL2_GET(sysname, CTL_KERN, KERN_OSTYPE) {
+} NATIVE_SET;
+
+NATIVE_SYSCTL2_GET(hostname, CTL_KERN, KERN_HOSTNAME) {
+} NATIVE_SET;
+
+NATIVE_SYSCTL2_GET(release, CTL_KERN, KERN_OSRELEASE) {
+} NATIVE_SET;
+
+NATIVE_SYSCTL2_GET(version, CTL_KERN, KERN_VERSION) {
+ size_t n;
+ char *p;
+
+ p = NATIVE_BUFFER;
+ n = NATIVE_LENGTH;
+ for (; n--; ++p)
+ if (*p == '\n' || *p == '\t')
+ *p = ' ';
+} NATIVE_SET;
+
+NATIVE_SYSCTL2_GET(platform, CTL_HW, HW_MACHINE) {
+} NATIVE_SET;
+
+NATIVE_SYSCTL2_GET(arch, CTL_HW, HW_MACHINE_ARCH) {
+} NATIVE_SET;
+
+NATIVE_SYSCTLNAME_GET(ident, "kern.ident") {
+} NATIVE_SET;
+
+static void
+native_uservers(void)
+{
+ static char buf[128];
+
+ snprintf(buf, sizeof(buf), "%d", __FreeBSD_version);
+ uservers = buf;
+}
+
+static void
+native_kernvers(void)
+{
+ static char buf[128];
+
+ snprintf(buf, sizeof(buf), "%d", getosreldate());
+ kernvers = buf;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: uname [-aiKmnoprsUv]\n");
+ exit(1);
+}
diff --git a/usr.bin/unexpand/Makefile b/usr.bin/unexpand/Makefile
new file mode 100644
index 0000000..f53af5a
--- /dev/null
+++ b/usr.bin/unexpand/Makefile
@@ -0,0 +1,7 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= unexpand
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/unexpand/Makefile.depend b/usr.bin/unexpand/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/unexpand/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/unexpand/unexpand.c b/usr.bin/unexpand/unexpand.c
new file mode 100644
index 0000000..1ef5db1
--- /dev/null
+++ b/usr.bin/unexpand/unexpand.c
@@ -0,0 +1,227 @@
+/*-
+ * Copyright (c) 1980, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)unexpand.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+/*
+ * unexpand - put tabs into a file replacing blanks
+ */
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+static int all;
+static int nstops;
+static int tabstops[100];
+
+static void getstops(const char *);
+static void usage(void);
+static int tabify(const char *);
+
+int
+main(int argc, char *argv[])
+{
+ int ch, failed;
+ char *filename;
+
+ setlocale(LC_CTYPE, "");
+
+ nstops = 1;
+ tabstops[0] = 8;
+ while ((ch = getopt(argc, argv, "at:")) != -1) {
+ switch (ch) {
+ case 'a': /* Un-expand all spaces, not just leading. */
+ all = 1;
+ break;
+ case 't': /* Specify tab list, implies -a. */
+ getstops(optarg);
+ all = 1;
+ break;
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ failed = 0;
+ if (argc == 0)
+ failed |= tabify("stdin");
+ else {
+ while ((filename = *argv++) != NULL) {
+ if (freopen(filename, "r", stdin) == NULL) {
+ warn("%s", filename);
+ failed = 1;
+ } else
+ failed |= tabify(filename);
+ }
+ }
+ exit(failed != 0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: unexpand [-a | -t tablist] [file ...]\n");
+ exit(1);
+}
+
+static int
+tabify(const char *curfile)
+{
+ int dcol, doneline, limit, n, ocol, width;
+ wint_t ch;
+
+ limit = nstops == 1 ? INT_MAX : tabstops[nstops - 1] - 1;
+
+ doneline = ocol = dcol = 0;
+ while ((ch = getwchar()) != WEOF) {
+ if (ch == ' ' && !doneline) {
+ if (++dcol >= limit)
+ doneline = 1;
+ continue;
+ } else if (ch == '\t') {
+ if (nstops == 1) {
+ dcol = (1 + dcol / tabstops[0]) *
+ tabstops[0];
+ continue;
+ } else {
+ for (n = 0; tabstops[n] - 1 < dcol &&
+ n < nstops; n++)
+ ;
+ if (n < nstops - 1 && tabstops[n] - 1 < limit) {
+ dcol = tabstops[n];
+ continue;
+ }
+ doneline = 1;
+ }
+ }
+
+ /* Output maximal number of tabs. */
+ if (nstops == 1) {
+ while (((ocol + tabstops[0]) / tabstops[0])
+ <= (dcol / tabstops[0])) {
+ if (dcol - ocol < 2)
+ break;
+ putwchar('\t');
+ ocol = (1 + ocol / tabstops[0]) *
+ tabstops[0];
+ }
+ } else {
+ for (n = 0; tabstops[n] - 1 < ocol && n < nstops; n++)
+ ;
+ while (ocol < dcol && n < nstops && ocol < limit) {
+ putwchar('\t');
+ ocol = tabstops[n++];
+ }
+ }
+
+ /* Then spaces. */
+ while (ocol < dcol && ocol < limit) {
+ putwchar(' ');
+ ocol++;
+ }
+
+ if (ch == '\b') {
+ putwchar('\b');
+ if (ocol > 0)
+ ocol--, dcol--;
+ } else if (ch == '\n') {
+ putwchar('\n');
+ doneline = ocol = dcol = 0;
+ continue;
+ } else if (ch != ' ' || dcol > limit) {
+ putwchar(ch);
+ if ((width = wcwidth(ch)) > 0)
+ ocol += width, dcol += width;
+ }
+
+ /*
+ * Only processing leading blanks or we've gone past the
+ * last tab stop. Emit remainder of this line unchanged.
+ */
+ if (!all || dcol >= limit) {
+ while ((ch = getwchar()) != '\n' && ch != WEOF)
+ putwchar(ch);
+ if (ch == '\n')
+ putwchar('\n');
+ doneline = ocol = dcol = 0;
+ }
+ }
+ if (ferror(stdin)) {
+ warn("%s", curfile);
+ return (1);
+ }
+ return (0);
+}
+
+static void
+getstops(const char *cp)
+{
+ int i;
+
+ nstops = 0;
+ for (;;) {
+ i = 0;
+ while (*cp >= '0' && *cp <= '9')
+ i = i * 10 + *cp++ - '0';
+ if (i <= 0)
+ errx(1, "bad tab stop spec");
+ if (nstops > 0 && i <= tabstops[nstops-1])
+ errx(1, "bad tab stop spec");
+ if (nstops == sizeof(tabstops) / sizeof(*tabstops))
+ errx(1, "too many tab stops");
+ tabstops[nstops++] = i;
+ if (*cp == 0)
+ break;
+ if (*cp != ',' && !isblank((unsigned char)*cp))
+ errx(1, "bad tab stop spec");
+ cp++;
+ }
+}
diff --git a/usr.bin/unifdef/Makefile b/usr.bin/unifdef/Makefile
new file mode 100644
index 0000000..dcd358f
--- /dev/null
+++ b/usr.bin/unifdef/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= unifdef
+SCRIPTS=unifdefall.sh
+MLINKS= unifdef.1 unifdefall.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/unifdef/Makefile.depend b/usr.bin/unifdef/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/unifdef/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/unifdef/unifdef.1 b/usr.bin/unifdef/unifdef.1
new file mode 100644
index 0000000..430f743
--- /dev/null
+++ b/usr.bin/unifdef/unifdef.1
@@ -0,0 +1,517 @@
+.\" Copyright (c) 1985, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\" Copyright (c) 2002 - 2015 Tony Finch <dot@dotat.at>. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Dave Yost. It was rewritten to support ANSI C by Tony Finch.
+.\"
+.\" 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. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2015
+.Dt UNIFDEF 1 PRM
+.Os " "
+.Sh NAME
+.Nm unifdef , unifdefall
+.Nd remove preprocessor conditionals from code
+.Sh SYNOPSIS
+.Nm
+.Op Fl bBcdehKkmnsStV
+.Op Fl I Ns Ar path
+.Op Fl [i]D Ns Ar sym Ns Op = Ns Ar val
+.Op Fl [i]U Ns Ar sym
+.Ar ...
+.Op Fl f Ar defile
+.Op Fl x Bro Ar 012 Brc
+.Op Fl M Ar backext
+.Op Fl o Ar outfile
+.Op Ar infile ...
+.Nm unifdefall
+.Op Fl I Ns Ar path
+.Ar ...
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility selectively processes conditional
+.Xr cpp 1
+directives.
+It removes from a file
+both the directives
+and any additional text that they specify should be removed,
+while otherwise leaving the file alone.
+.Pp
+The
+.Nm
+utility acts on
+.Ic #if , #ifdef , #ifndef ,
+.Ic #elif , #else ,
+and
+.Ic #endif
+lines,
+using macros specified in
+.Fl D
+and
+.Fl U
+command line options or in
+.Fl f
+definitions files.
+A directive is processed
+if the macro specifications are sufficient to provide
+a definite value for its control expression.
+If the result is false,
+the directive and the following lines under its control are removed.
+If the result is true,
+only the directive is removed.
+An
+.Ic #ifdef
+or
+.Ic #ifndef
+directive is passed through unchanged
+if its controlling macro is not specified.
+Any
+.Ic #if
+or
+.Ic #elif
+control expression that has an unknown value or that
+.Nm
+cannot parse is passed through unchanged.
+By default,
+.Nm
+ignores
+.Ic #if
+and
+.Ic #elif
+lines with constant expressions;
+it can be told to process them by specifying the
+.Fl k
+flag on the command line.
+.Pp
+It understands a commonly-used subset
+of the expression syntax for
+.Ic #if
+and
+.Ic #elif
+lines:
+integer constants,
+integer values of macros defined on the command line,
+the
+.Fn defined
+operator,
+the operators
+.Ic \&! , ~ , -
+(unary),
+.Ic * , / , % , + , - ,
+.Ic < , <= , > , >= , == , != , & , ^ , \&| ,
+.Ic && , || ,
+and parenthesized expressions.
+Division by zero is treated as an unknown value.
+A kind of
+.Dq "short circuit"
+evaluation is used for the
+.Ic &&
+operator:
+if either operand is definitely false then the result is false,
+even if the value of the other operand is unknown.
+Similarly,
+if either operand of
+.Ic ||
+is definitely true then the result is true.
+.Pp
+When evaluating an expression,
+.Nm
+does not expand macros first.
+The value of a macro must be a simple number,
+not an expression.
+A limited form of indirection is allowed,
+where one macro's value is the name of another.
+.Pp
+In most cases,
+.Nm
+does not distinguish between object-like macros
+(without arguments) and function-like macros (with arguments).
+A function-like macro invocation can appear in
+.Ic #if
+and
+.Ic #elif
+control expressions.
+If the macro is not explicitly defined,
+or is defined with the
+.Fl D
+flag on the command-line,
+or with
+.Ic #define
+in a
+.Fl f
+definitions file,
+its arguments are ignored.
+If a macro is explicitly undefined on the command line with the
+.Fl U
+flag,
+or with
+.Ic #undef
+in a
+.Fl f
+definitions file,
+it may not have any arguments since this leads to a syntax error.
+.Pp
+The
+.Nm
+utility understands just enough about C
+to know when one of the directives is inactive
+because it is inside
+a comment,
+or affected by a backslash-continued line.
+It spots unusually-formatted preprocessor directives
+and knows when the layout is too odd for it to handle.
+.Pp
+A script called
+.Nm unifdefall
+can be used to remove all conditional
+.Xr cpp 1
+directives from a file.
+It uses
+.Nm Fl s
+and
+.Nm cpp Fl dM
+to get lists of all the controlling macros
+and their definitions (or lack thereof),
+then invokes
+.Nm
+with appropriate arguments to process the file.
+.Sh OPTIONS
+.Bl -tag -width indent -compact
+.It Fl D Ns Ar sym Ns = Ns Ar val
+Specify that a macro is defined to a given value.
+.Pp
+.It Fl D Ns Ar sym
+Specify that a macro is defined to the value 1.
+.Pp
+.It Fl U Ns Ar sym
+Specify that a macro is undefined.
+.Pp
+If the same macro appears in more than one argument,
+the last occurrence dominates.
+.Pp
+.It Fl iD Ns Ar sym Ns Op = Ns Ar val
+.It Fl iU Ns Ar sym
+C strings, comments,
+and line continuations
+are ignored within
+.Ic #ifdef
+and
+.Ic #ifndef
+blocks
+controlled by macros
+specified with these options.
+.Pp
+.It Fl f Ar defile
+The file
+.Ar defile
+contains
+.Ic #define
+and
+.Ic #undef
+preprocessor directives,
+which have the same effect as the corresponding
+.Fl D
+and
+.Fl U
+command-line arguments.
+You can have multiple
+.Fl f
+arguments and mix them with
+.Fl D
+and
+.Fl U
+arguments;
+later options override earlier ones.
+.Pp
+Each directive must be on a single line.
+Object-like macro definitions (without arguments)
+are set to the given value.
+Function-like macro definitions (with arguments)
+are treated as if they are set to 1.
+.Pp
+.Em Warning:
+string literals and character constants are not parsed correctly in
+.Fl f
+files.
+.Pp
+.It Fl b
+Replace removed lines with blank lines
+instead of deleting them.
+Mutually exclusive with the
+.Fl B
+option.
+.Pp
+.It Fl B
+Compress blank lines around a deleted section.
+Mutually exclusive with the
+.Fl b
+option.
+.Pp
+.It Fl c
+Complement,
+i.e., lines that would have been removed or blanked
+are retained and vice versa.
+.Pp
+.It Fl d
+Turn on printing of debugging messages.
+.Pp
+.It Fl e
+By default,
+.Nm
+will report an error if it needs to remove
+a preprocessor directive that spans more than one line,
+for example, if it has a multi-line
+comment hanging off its right hand end.
+The
+.Fl e
+flag makes it ignore the line instead.
+.Pp
+.It Fl h
+Print help.
+.Pp
+.It Fl I Ns Ar path
+Specifies to
+.Nm unifdefall
+an additional place to look for
+.Ic #include
+files.
+This option is ignored by
+.Nm
+for compatibility with
+.Xr cpp 1
+and to simplify the implementation of
+.Nm unifdefall .
+.Pp
+.It Fl K
+Always treat the result of
+.Ic &&
+and
+.Ic ||
+operators as unknown if either operand is unknown,
+instead of short-circuiting when unknown operands can't affect the result.
+This option is for compatibility with older versions of
+.Nm .
+.Pp
+.It Fl k
+Process
+.Ic #if
+and
+.Ic #elif
+lines with constant expressions.
+By default, sections controlled by such lines are passed through unchanged
+because they typically start
+.Dq Li "#if 0"
+and are used as a kind of comment to sketch out future or past development.
+It would be rude to strip them out, just as it would be for normal comments.
+.Pp
+.It Fl m
+Modify one or more input files in place.
+If an input file is not modified,
+the original is preserved instead of being overwritten with an identical copy.
+.Pp
+.It Fl M Ar backext
+Modify input files in place, and keep backups of the original files by
+appending the
+.Ar backext
+to the input filenames.
+A zero length
+.Ar backext
+behaves the same as the
+.Fl m
+option.
+.Pp
+.It Fl n
+Add
+.Li #line
+directives to the output following any deleted lines,
+so that errors produced when compiling the output file correspond to
+line numbers in the input file.
+.Pp
+.It Fl o Ar outfile
+Write output to the file
+.Ar outfile
+instead of the standard output when processing a single file.
+.Pp
+.It Fl s
+Instead of processing an input file as usual,
+this option causes
+.Nm
+to produce a list of macros that are used in
+preprocessor directive controlling expressions.
+.Pp
+.It Fl S
+Like the
+.Fl s
+option, but the nesting depth of each macro is also printed.
+This is useful for working out the number of possible combinations
+of interdependent defined/undefined macros.
+.Pp
+.It Fl t
+Disables parsing for C strings, comments,
+and line continuations,
+which is useful
+for plain text.
+This is a blanket version of the
+.Fl iD
+and
+.Fl iU
+flags.
+.Pp
+.It Fl V
+Print version details.
+.Pp
+.It Fl x Bro Ar 012 Brc
+Set exit status mode to zero, one, or two.
+See the
+.Sx EXIT STATUS
+section below for details.
+.El
+.Pp
+The
+.Nm
+utility takes its input from
+.Em stdin
+if there are no
+.Ar file
+arguments.
+You must use the
+.Fl m
+or
+.Fl M
+options if there are multiple input files.
+You can specify inut from stdin or output to stdout with
+.Ql - .
+.Pp
+The
+.Nm
+utility works nicely with the
+.Fl D Ns Ar sym
+option of
+.Xr diff 1 .
+.Sh EXIT STATUS
+In normal usage the
+.Nm
+utility's exit status depends on the mode set using the
+.Fl x
+option.
+.Pp
+If the exit mode is zero (the default) then
+.Nm
+exits with status 0 if the output is an exact copy of the input,
+or with status 1 if the output differs.
+.Pp
+If the exit mode is one,
+.Nm
+exits with status 1 if the output is unmodified
+or 0 if it differs.
+.Pp
+If the exit mode is two,
+.Nm
+exits with status zero in both cases.
+.Pp
+In all exit modes,
+.Nm
+exits with status 2 if there is an error.
+.Pp
+The exit status is 0 if the
+.Fl h
+or
+.Fl V
+command line options are given.
+.Sh DIAGNOSTICS
+.Bl -item
+.It
+.Tn EOF
+in comment
+.It
+Inappropriate
+.Ic #elif ,
+.Ic #else
+or
+.Ic #endif
+.It
+Missing macro name in #define or #undef
+.It
+Obfuscated preprocessor control line
+.It
+Premature
+.Tn EOF
+(with the line number of the most recent unterminated
+.Ic #if )
+.It
+Too many levels of nesting
+.It
+Unrecognized preprocessor directive
+.It
+Unterminated char or string literal
+.El
+.Sh SEE ALSO
+.Xr cpp 1 ,
+.Xr diff 1
+.Pp
+The unifdef home page is
+.Pa http://dotat.at/prog/unifdef
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 2.9 .
+.Tn ANSI\~C
+support was added in
+.Fx 4.7 .
+.Sh AUTHORS
+.An -nosplit
+The original implementation was written by
+.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
+Expression evaluation is very limited.
+.Pp
+Character constants are not evaluated.
+String literals and character constants in
+.Fl f
+definition files are ignored rather than parsed as
+part of a macro's replacement tokens.
+.Pp
+Handling one line at a time means
+preprocessor directives split across more than one physical line
+(because of comments or backslash-newline)
+cannot be handled in every situation.
+.Pp
+Trigraphs are not recognized.
+.Pp
+There is no support for macros with different definitions at
+different points in the source file.
+.Pp
+The text-mode and ignore functionality does not correspond to modern
+.Xr cpp 1
+behaviour.
diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c
new file mode 100644
index 0000000..4a28ed4
--- /dev/null
+++ b/usr.bin/unifdef/unifdef.c
@@ -0,0 +1,1662 @@
+/*
+ * Copyright (c) 2002 - 2015 Tony Finch <dot@dotat.at>
+ *
+ * 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.
+ */
+
+/*
+ * unifdef - remove ifdef'ed lines
+ *
+ * This code was derived from software contributed to Berkeley by Dave Yost.
+ * It was rewritten to support ANSI C by Tony Finch. The original version
+ * of unifdef carried the 4-clause BSD copyright licence. None of its code
+ * remains in this version (though some of the names remain) so it now
+ * carries a more liberal licence.
+ *
+ * Wishlist:
+ * provide an option which will append the name of the
+ * appropriate symbol after #else's and #endif's
+ * provide an option which will check symbols after
+ * #else's and #endif's to see that they match their
+ * corresponding #ifdef or #ifndef
+ *
+ * These require better buffer handling, which would also make
+ * it possible to handle all "dodgy" directives correctly.
+ */
+
+#include "unifdef.h"
+
+static const char copyright[] =
+ "@(#) $Version: unifdef-2.11 $\n"
+ "@(#) $FreeBSD$\n"
+ "@(#) $Author: Tony Finch (dot@dotat.at) $\n"
+ "@(#) $URL: http://dotat.at/prog/unifdef $\n"
+;
+
+/* types of input lines: */
+typedef enum {
+ LT_TRUEI, /* a true #if with ignore flag */
+ LT_FALSEI, /* a false #if with ignore flag */
+ LT_IF, /* an unknown #if */
+ LT_TRUE, /* a true #if */
+ LT_FALSE, /* a false #if */
+ LT_ELIF, /* an unknown #elif */
+ LT_ELTRUE, /* a true #elif */
+ LT_ELFALSE, /* a false #elif */
+ LT_ELSE, /* #else */
+ LT_ENDIF, /* #endif */
+ LT_DODGY, /* flag: directive is not on one line */
+ LT_DODGY_LAST = LT_DODGY + LT_ENDIF,
+ LT_PLAIN, /* ordinary line */
+ LT_EOF, /* end of file */
+ LT_ERROR, /* unevaluable #if */
+ LT_COUNT
+} Linetype;
+
+static char const * const linetype_name[] = {
+ "TRUEI", "FALSEI", "IF", "TRUE", "FALSE",
+ "ELIF", "ELTRUE", "ELFALSE", "ELSE", "ENDIF",
+ "DODGY TRUEI", "DODGY FALSEI",
+ "DODGY IF", "DODGY TRUE", "DODGY FALSE",
+ "DODGY ELIF", "DODGY ELTRUE", "DODGY ELFALSE",
+ "DODGY ELSE", "DODGY ENDIF",
+ "PLAIN", "EOF", "ERROR"
+};
+
+#define linetype_if2elif(lt) ((Linetype)(lt - LT_IF + LT_ELIF))
+#define linetype_2dodgy(lt) ((Linetype)(lt + LT_DODGY))
+
+/* state of #if processing */
+typedef enum {
+ IS_OUTSIDE,
+ IS_FALSE_PREFIX, /* false #if followed by false #elifs */
+ IS_TRUE_PREFIX, /* first non-false #(el)if is true */
+ IS_PASS_MIDDLE, /* first non-false #(el)if is unknown */
+ IS_FALSE_MIDDLE, /* a false #elif after a pass state */
+ IS_TRUE_MIDDLE, /* a true #elif after a pass state */
+ IS_PASS_ELSE, /* an else after a pass state */
+ IS_FALSE_ELSE, /* an else after a true state */
+ IS_TRUE_ELSE, /* an else after only false states */
+ IS_FALSE_TRAILER, /* #elifs after a true are false */
+ IS_COUNT
+} Ifstate;
+
+static char const * const ifstate_name[] = {
+ "OUTSIDE", "FALSE_PREFIX", "TRUE_PREFIX",
+ "PASS_MIDDLE", "FALSE_MIDDLE", "TRUE_MIDDLE",
+ "PASS_ELSE", "FALSE_ELSE", "TRUE_ELSE",
+ "FALSE_TRAILER"
+};
+
+/* state of comment parser */
+typedef enum {
+ NO_COMMENT = false, /* outside a comment */
+ C_COMMENT, /* in a comment like this one */
+ CXX_COMMENT, /* between // and end of line */
+ STARTING_COMMENT, /* just after slash-backslash-newline */
+ FINISHING_COMMENT, /* star-backslash-newline in a C comment */
+ CHAR_LITERAL, /* inside '' */
+ STRING_LITERAL /* inside "" */
+} Comment_state;
+
+static char const * const comment_name[] = {
+ "NO", "C", "CXX", "STARTING", "FINISHING", "CHAR", "STRING"
+};
+
+/* state of preprocessor line parser */
+typedef enum {
+ LS_START, /* only space and comments on this line */
+ LS_HASH, /* only space, comments, and a hash */
+ LS_DIRTY /* this line can't be a preprocessor line */
+} Line_state;
+
+static char const * const linestate_name[] = {
+ "START", "HASH", "DIRTY"
+};
+
+/*
+ * Minimum translation limits from ISO/IEC 9899:1999 5.2.4.1
+ */
+#define MAXDEPTH 64 /* maximum #if nesting */
+#define MAXLINE 4096 /* maximum length of line */
+#define MAXSYMS 16384 /* maximum number of symbols */
+
+/*
+ * Sometimes when editing a keyword the replacement text is longer, so
+ * we leave some space at the end of the tline buffer to accommodate this.
+ */
+#define EDITSLOP 10
+
+/*
+ * Globals.
+ */
+
+static bool compblank; /* -B: compress blank lines */
+static bool lnblank; /* -b: blank deleted lines */
+static bool complement; /* -c: do the complement */
+static bool debugging; /* -d: debugging reports */
+static bool inplace; /* -m: modify in place */
+static bool iocccok; /* -e: fewer IOCCC errors */
+static bool strictlogic; /* -K: keep ambiguous #ifs */
+static bool killconsts; /* -k: eval constant #ifs */
+static bool lnnum; /* -n: add #line directives */
+static bool symlist; /* -s: output symbol list */
+static bool symdepth; /* -S: output symbol depth */
+static bool text; /* -t: this is a text file */
+
+static const char *symname[MAXSYMS]; /* symbol name */
+static const char *value[MAXSYMS]; /* -Dsym=value */
+static bool ignore[MAXSYMS]; /* -iDsym or -iUsym */
+static int nsyms; /* number of symbols */
+
+static FILE *input; /* input file pointer */
+static const char *filename; /* input file name */
+static int linenum; /* current line number */
+static const char *linefile; /* file name for #line */
+static FILE *output; /* output file pointer */
+static const char *ofilename; /* output file name */
+static const char *backext; /* backup extension */
+static char *tempname; /* avoid splatting input */
+
+static char tline[MAXLINE+EDITSLOP];/* input buffer plus space */
+static char *keyword; /* used for editing #elif's */
+
+/*
+ * When processing a file, the output's newline style will match the
+ * input's, and unifdef correctly handles CRLF or LF endings whatever
+ * the platform's native style. The stdio streams are opened in binary
+ * mode to accommodate platforms whose native newline style is CRLF.
+ * When the output isn't a processed input file (when it is error /
+ * debug / diagnostic messages) then unifdef uses native line endings.
+ */
+
+static const char *newline; /* input file format */
+static const char newline_unix[] = "\n";
+static const char newline_crlf[] = "\r\n";
+
+static Comment_state incomment; /* comment parser state */
+static Line_state linestate; /* #if line parser state */
+static Ifstate ifstate[MAXDEPTH]; /* #if processor state */
+static bool ignoring[MAXDEPTH]; /* ignore comments state */
+static int stifline[MAXDEPTH]; /* start of current #if */
+static int depth; /* current #if nesting */
+static int delcount; /* count of deleted lines */
+static unsigned blankcount; /* count of blank lines */
+static unsigned blankmax; /* maximum recent blankcount */
+static bool constexpr; /* constant #if expression */
+static bool zerosyms; /* to format symdepth output */
+static bool firstsym; /* ditto */
+
+static int exitmode; /* exit status mode */
+static int exitstat; /* program exit status */
+static bool altered; /* was this file modified? */
+
+static void addsym1(bool, bool, char *);
+static void addsym2(bool, const char *, const char *);
+static char *astrcat(const char *, const char *);
+static void cleantemp(void);
+static void closeio(void);
+static void debug(const char *, ...);
+static void debugsym(const char *, int);
+static bool defundef(void);
+static void defundefile(const char *);
+static void done(void);
+static void error(const char *);
+static int findsym(const char **);
+static void flushline(bool);
+static void hashline(void);
+static void help(void);
+static Linetype ifeval(const char **);
+static void ignoreoff(void);
+static void ignoreon(void);
+static void indirectsym(void);
+static void keywordedit(const char *);
+static const char *matchsym(const char *, const char *);
+static void nest(void);
+static Linetype parseline(void);
+static void process(void);
+static void processinout(const char *, const char *);
+static const char *skipargs(const char *);
+static const char *skipcomment(const char *);
+static const char *skiphash(void);
+static const char *skipline(const char *);
+static const char *skipsym(const char *);
+static void state(Ifstate);
+static void unnest(void);
+static void usage(void);
+static void version(void);
+static const char *xstrdup(const char *, const char *);
+
+#define endsym(c) (!isalnum((unsigned char)c) && c != '_')
+
+/*
+ * The main program.
+ */
+int
+main(int argc, char *argv[])
+{
+ int opt;
+
+ while ((opt = getopt(argc, argv, "i:D:U:f:I:M:o:x:bBcdehKklmnsStV")) != -1)
+ switch (opt) {
+ case 'i': /* treat stuff controlled by these symbols as text */
+ /*
+ * For strict backwards-compatibility the U or D
+ * should be immediately after the -i but it doesn't
+ * matter much if we relax that requirement.
+ */
+ opt = *optarg++;
+ if (opt == 'D')
+ addsym1(true, true, optarg);
+ else if (opt == 'U')
+ addsym1(true, false, optarg);
+ else
+ usage();
+ break;
+ case 'D': /* define a symbol */
+ addsym1(false, true, optarg);
+ break;
+ case 'U': /* undef a symbol */
+ addsym1(false, false, optarg);
+ break;
+ case 'I': /* no-op for compatibility with cpp */
+ break;
+ case 'b': /* blank deleted lines instead of omitting them */
+ case 'l': /* backwards compatibility */
+ lnblank = true;
+ break;
+ case 'B': /* compress blank lines around removed section */
+ compblank = true;
+ break;
+ case 'c': /* treat -D as -U and vice versa */
+ complement = true;
+ break;
+ case 'd':
+ debugging = true;
+ break;
+ case 'e': /* fewer errors from dodgy lines */
+ iocccok = true;
+ break;
+ case 'f': /* definitions file */
+ defundefile(optarg);
+ break;
+ case 'h':
+ help();
+ break;
+ case 'K': /* keep ambiguous #ifs */
+ strictlogic = true;
+ break;
+ case 'k': /* process constant #ifs */
+ killconsts = true;
+ break;
+ case 'm': /* modify in place */
+ inplace = true;
+ break;
+ case 'M': /* modify in place and keep backup */
+ inplace = true;
+ if (strlen(optarg) > 0)
+ backext = optarg;
+ break;
+ case 'n': /* add #line directive after deleted lines */
+ lnnum = true;
+ break;
+ case 'o': /* output to a file */
+ ofilename = optarg;
+ break;
+ case 's': /* only output list of symbols that control #ifs */
+ symlist = true;
+ break;
+ case 'S': /* list symbols with their nesting depth */
+ symlist = symdepth = true;
+ break;
+ case 't': /* don't parse C comments */
+ text = true;
+ break;
+ case 'V':
+ version();
+ break;
+ case 'x':
+ exitmode = atoi(optarg);
+ if(exitmode < 0 || exitmode > 2)
+ usage();
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+ if (compblank && lnblank)
+ errx(2, "-B and -b are mutually exclusive");
+ if (symlist && (ofilename != NULL || inplace || argc > 1))
+ errx(2, "-s only works with one input file");
+ if (argc > 1 && ofilename != NULL)
+ errx(2, "-o cannot be used with multiple input files");
+ if (argc > 1 && !inplace)
+ errx(2, "multiple input files require -m or -M");
+ if (argc == 0 && inplace)
+ errx(2, "-m requires an input file");
+ if (argc == 0)
+ argc = 1;
+ if (argc == 1 && !inplace && ofilename == NULL)
+ ofilename = "-";
+ indirectsym();
+
+ atexit(cleantemp);
+ if (ofilename != NULL)
+ processinout(*argv, ofilename);
+ else while (argc-- > 0) {
+ processinout(*argv, *argv);
+ argv++;
+ }
+ switch(exitmode) {
+ case(0): exit(exitstat);
+ case(1): exit(!exitstat);
+ case(2): exit(0);
+ default: abort(); /* bug */
+ }
+}
+
+/*
+ * File logistics.
+ */
+static void
+processinout(const char *ifn, const char *ofn)
+{
+ struct stat st;
+
+ if (ifn == NULL || strcmp(ifn, "-") == 0) {
+ filename = "[stdin]";
+ linefile = NULL;
+ input = fbinmode(stdin);
+ } else {
+ filename = ifn;
+ linefile = ifn;
+ input = fopen(ifn, "rb");
+ if (input == NULL)
+ err(2, "can't open %s", ifn);
+ }
+ if (strcmp(ofn, "-") == 0) {
+ output = fbinmode(stdout);
+ process();
+ return;
+ }
+ if (stat(ofn, &st) < 0) {
+ output = fopen(ofn, "wb");
+ if (output == NULL)
+ err(2, "can't create %s", ofn);
+ process();
+ return;
+ }
+
+ tempname = astrcat(ofn, ".XXXXXX");
+ output = mktempmode(tempname, st.st_mode);
+ if (output == NULL)
+ err(2, "can't create %s", tempname);
+
+ process();
+
+ if (backext != NULL) {
+ char *backname = astrcat(ofn, backext);
+ if (rename(ofn, backname) < 0)
+ err(2, "can't rename \"%s\" to \"%s\"", ofn, backname);
+ free(backname);
+ }
+ /* leave file unmodified if unifdef made no changes */
+ if (!altered && backext == NULL) {
+ if (remove(tempname) < 0)
+ warn("can't remove \"%s\"", tempname);
+ } else if (replace(tempname, ofn) < 0)
+ err(2, "can't rename \"%s\" to \"%s\"", tempname, ofn);
+ free(tempname);
+ tempname = NULL;
+}
+
+/*
+ * For cleaning up if there is an error.
+ */
+static void
+cleantemp(void)
+{
+ if (tempname != NULL)
+ remove(tempname);
+}
+
+/*
+ * Self-identification functions.
+ */
+
+static void
+version(void)
+{
+ const char *c = copyright;
+ for (;;) {
+ while (*++c != '$')
+ if (*c == '\0')
+ exit(0);
+ while (*++c != '$')
+ putc(*c, stderr);
+ putc('\n', stderr);
+ }
+}
+
+static void
+synopsis(FILE *fp)
+{
+ fprintf(fp,
+ "usage: unifdef [-bBcdehKkmnsStV] [-x{012}] [-Mext] [-opath] \\\n"
+ " [-[i]Dsym[=val]] [-[i]Usym] [-fpath] ... [file] ...\n");
+}
+
+static void
+usage(void)
+{
+ synopsis(stderr);
+ exit(2);
+}
+
+static void
+help(void)
+{
+ synopsis(stdout);
+ printf(
+ " -Dsym=val define preprocessor symbol with given value\n"
+ " -Dsym define preprocessor symbol with value 1\n"
+ " -Usym preprocessor symbol is undefined\n"
+ " -iDsym=val \\ ignore C strings and comments\n"
+ " -iDsym ) in sections controlled by these\n"
+ " -iUsym / preprocessor symbols\n"
+ " -fpath file containing #define and #undef directives\n"
+ " -b blank lines instead of deleting them\n"
+ " -B compress blank lines around deleted section\n"
+ " -c complement (invert) keep vs. delete\n"
+ " -d debugging mode\n"
+ " -e ignore multiline preprocessor directives\n"
+ " -h print help\n"
+ " -Ipath extra include file path (ignored)\n"
+ " -K disable && and || short-circuiting\n"
+ " -k process constant #if expressions\n"
+ " -Mext modify in place and keep backups\n"
+ " -m modify input files in place\n"
+ " -n add #line directives to output\n"
+ " -opath output file name\n"
+ " -S list #if control symbols with nesting\n"
+ " -s list #if control symbols\n"
+ " -t ignore C strings and comments\n"
+ " -V print version\n"
+ " -x{012} exit status mode\n"
+ );
+ exit(0);
+}
+
+/*
+ * A state transition function alters the global #if processing state
+ * in a particular way. The table below is indexed by the current
+ * processing state and the type of the current line.
+ *
+ * Nesting is handled by keeping a stack of states; some transition
+ * functions increase or decrease the depth. They also maintain the
+ * ignore state on a stack. In some complicated cases they have to
+ * alter the preprocessor directive, as follows.
+ *
+ * When we have processed a group that starts off with a known-false
+ * #if/#elif sequence (which has therefore been deleted) followed by a
+ * #elif that we don't understand and therefore must keep, we edit the
+ * latter into a #if to keep the nesting correct. We use memcpy() to
+ * overwrite the 4 byte token "elif" with "if " without a '\0' byte.
+ *
+ * When we find a true #elif in a group, the following block will
+ * always be kept and the rest of the sequence after the next #elif or
+ * #else will be discarded. We edit the #elif into a #else and the
+ * following directive to #endif since this has the desired behaviour.
+ *
+ * "Dodgy" directives are split across multiple lines, the most common
+ * example being a multi-line comment hanging off the right of the
+ * directive. We can handle them correctly only if there is no change
+ * from printing to dropping (or vice versa) caused by that directive.
+ * If the directive is the first of a group we have a choice between
+ * failing with an error, or passing it through unchanged instead of
+ * evaluating it. The latter is not the default to avoid questions from
+ * users about unifdef unexpectedly leaving behind preprocessor directives.
+ */
+typedef void state_fn(void);
+
+/* report an error */
+static void Eelif (void) { error("Inappropriate #elif"); }
+static void Eelse (void) { error("Inappropriate #else"); }
+static void Eendif(void) { error("Inappropriate #endif"); }
+static void Eeof (void) { error("Premature EOF"); }
+static void Eioccc(void) { error("Obfuscated preprocessor control line"); }
+/* plain line handling */
+static void print (void) { flushline(true); }
+static void drop (void) { flushline(false); }
+/* output lacks group's start line */
+static void Strue (void) { drop(); ignoreoff(); state(IS_TRUE_PREFIX); }
+static void Sfalse(void) { drop(); ignoreoff(); state(IS_FALSE_PREFIX); }
+static void Selse (void) { drop(); state(IS_TRUE_ELSE); }
+/* print/pass this block */
+static void Pelif (void) { print(); ignoreoff(); state(IS_PASS_MIDDLE); }
+static void Pelse (void) { print(); state(IS_PASS_ELSE); }
+static void Pendif(void) { print(); unnest(); }
+/* discard this block */
+static void Dfalse(void) { drop(); ignoreoff(); state(IS_FALSE_TRAILER); }
+static void Delif (void) { drop(); ignoreoff(); state(IS_FALSE_MIDDLE); }
+static void Delse (void) { drop(); state(IS_FALSE_ELSE); }
+static void Dendif(void) { drop(); unnest(); }
+/* first line of group */
+static void Fdrop (void) { nest(); Dfalse(); }
+static void Fpass (void) { nest(); Pelif(); }
+static void Ftrue (void) { nest(); Strue(); }
+static void Ffalse(void) { nest(); Sfalse(); }
+/* variable pedantry for obfuscated lines */
+static void Oiffy (void) { if (!iocccok) Eioccc(); Fpass(); ignoreon(); }
+static void Oif (void) { if (!iocccok) Eioccc(); Fpass(); }
+static void Oelif (void) { if (!iocccok) Eioccc(); Pelif(); }
+/* ignore comments in this block */
+static void Idrop (void) { Fdrop(); ignoreon(); }
+static void Itrue (void) { Ftrue(); ignoreon(); }
+static void Ifalse(void) { Ffalse(); ignoreon(); }
+/* modify this line */
+static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); }
+static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); }
+static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); }
+static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); }
+
+static state_fn * const trans_table[IS_COUNT][LT_COUNT] = {
+/* IS_OUTSIDE */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Eendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eendif,
+ print, done, abort },
+/* IS_FALSE_PREFIX */
+{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Strue, Sfalse,Selse, Dendif,
+ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Eioccc,Eioccc,Eioccc,Eioccc,
+ drop, Eeof, abort },
+/* IS_TRUE_PREFIX */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Dfalse,Dfalse,Dfalse,Delse, Dendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc,
+ print, Eeof, abort },
+/* IS_PASS_MIDDLE */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Pelif, Mtrue, Delif, Pelse, Pendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Pelif, Oelif, Oelif, Pelse, Pendif,
+ print, Eeof, abort },
+/* IS_FALSE_MIDDLE */
+{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Pelif, Mtrue, Delif, Pelse, Pendif,
+ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc,
+ drop, Eeof, abort },
+/* IS_TRUE_MIDDLE */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Melif, Melif, Melif, Melse, Pendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Pendif,
+ print, Eeof, abort },
+/* IS_PASS_ELSE */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Pendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Pendif,
+ print, Eeof, abort },
+/* IS_FALSE_ELSE */
+{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Dendif,
+ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Eioccc,
+ drop, Eeof, abort },
+/* IS_TRUE_ELSE */
+{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Dendif,
+ Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eioccc,
+ print, Eeof, abort },
+/* IS_FALSE_TRAILER */
+{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Dendif,
+ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Eioccc,
+ drop, Eeof, abort }
+/*TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF
+ TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF (DODGY)
+ PLAIN EOF ERROR */
+};
+
+/*
+ * State machine utility functions
+ */
+static void
+ignoreoff(void)
+{
+ if (depth == 0)
+ abort(); /* bug */
+ ignoring[depth] = ignoring[depth-1];
+}
+static void
+ignoreon(void)
+{
+ ignoring[depth] = true;
+}
+static void
+keywordedit(const char *replacement)
+{
+ snprintf(keyword, tline + sizeof(tline) - keyword,
+ "%s%s", replacement, newline);
+ altered = true;
+ print();
+}
+static void
+nest(void)
+{
+ if (depth > MAXDEPTH-1)
+ abort(); /* bug */
+ if (depth == MAXDEPTH-1)
+ error("Too many levels of nesting");
+ depth += 1;
+ stifline[depth] = linenum;
+}
+static void
+unnest(void)
+{
+ if (depth == 0)
+ abort(); /* bug */
+ depth -= 1;
+}
+static void
+state(Ifstate is)
+{
+ ifstate[depth] = is;
+}
+
+/*
+ * The last state transition function. When this is called,
+ * lineval == LT_EOF, so the process() loop will terminate.
+ */
+static void
+done(void)
+{
+ if (incomment)
+ error("EOF in comment");
+ closeio();
+}
+
+/*
+ * Write a line to the output or not, according to command line options.
+ * If writing fails, closeio() will print the error and exit.
+ */
+static void
+flushline(bool keep)
+{
+ if (symlist)
+ return;
+ if (keep ^ complement) {
+ bool blankline = tline[strspn(tline, " \t\r\n")] == '\0';
+ if (blankline && compblank && blankcount != blankmax) {
+ delcount += 1;
+ blankcount += 1;
+ } else {
+ if (lnnum && delcount > 0)
+ hashline();
+ if (fputs(tline, output) == EOF)
+ closeio();
+ delcount = 0;
+ blankmax = blankcount = blankline ? blankcount + 1 : 0;
+ }
+ } else {
+ if (lnblank && fputs(newline, output) == EOF)
+ closeio();
+ altered = true;
+ delcount += 1;
+ blankcount = 0;
+ }
+ if (debugging && fflush(output) == EOF)
+ closeio();
+}
+
+/*
+ * Format of #line directives depends on whether we know the input filename.
+ */
+static void
+hashline(void)
+{
+ int e;
+
+ if (linefile == NULL)
+ e = fprintf(output, "#line %d%s", linenum, newline);
+ else
+ e = fprintf(output, "#line %d \"%s\"%s",
+ linenum, linefile, newline);
+ if (e < 0)
+ closeio();
+}
+
+/*
+ * Flush the output and handle errors.
+ */
+static void
+closeio(void)
+{
+ /* Tidy up after findsym(). */
+ if (symdepth && !zerosyms)
+ printf("\n");
+ if (output != NULL && (ferror(output) || fclose(output) == EOF))
+ err(2, "%s: can't write to output", filename);
+ fclose(input);
+}
+
+/*
+ * The driver for the state machine.
+ */
+static void
+process(void)
+{
+ Linetype lineval = LT_PLAIN;
+ /* When compressing blank lines, act as if the file
+ is preceded by a large number of blank lines. */
+ blankmax = blankcount = 1000;
+ zerosyms = true;
+ newline = NULL;
+ linenum = 0;
+ altered = false;
+ while (lineval != LT_EOF) {
+ lineval = parseline();
+ trans_table[ifstate[depth]][lineval]();
+ debug("process line %d %s -> %s depth %d",
+ linenum, linetype_name[lineval],
+ ifstate_name[ifstate[depth]], depth);
+ }
+ exitstat |= altered;
+}
+
+/*
+ * Parse a line and determine its type. We keep the preprocessor line
+ * parser state between calls in the global variable linestate, with
+ * help from skipcomment().
+ */
+static Linetype
+parseline(void)
+{
+ const char *cp;
+ int cursym;
+ Linetype retval;
+ Comment_state wascomment;
+
+ wascomment = incomment;
+ cp = skiphash();
+ if (cp == NULL)
+ return (LT_EOF);
+ if (newline == NULL) {
+ if (strrchr(tline, '\n') == strrchr(tline, '\r') + 1)
+ newline = newline_crlf;
+ else
+ newline = newline_unix;
+ }
+ if (*cp == '\0') {
+ retval = LT_PLAIN;
+ goto done;
+ }
+ keyword = tline + (cp - tline);
+ if ((cp = matchsym("ifdef", keyword)) != NULL ||
+ (cp = matchsym("ifndef", keyword)) != NULL) {
+ cp = skipcomment(cp);
+ if ((cursym = findsym(&cp)) < 0)
+ retval = LT_IF;
+ else {
+ retval = (keyword[2] == 'n')
+ ? LT_FALSE : LT_TRUE;
+ if (value[cursym] == NULL)
+ retval = (retval == LT_TRUE)
+ ? LT_FALSE : LT_TRUE;
+ if (ignore[cursym])
+ retval = (retval == LT_TRUE)
+ ? LT_TRUEI : LT_FALSEI;
+ }
+ } else if ((cp = matchsym("if", keyword)) != NULL)
+ retval = ifeval(&cp);
+ else if ((cp = matchsym("elif", keyword)) != NULL)
+ retval = linetype_if2elif(ifeval(&cp));
+ else if ((cp = matchsym("else", keyword)) != NULL)
+ retval = LT_ELSE;
+ else if ((cp = matchsym("endif", keyword)) != NULL)
+ retval = LT_ENDIF;
+ else {
+ cp = skipsym(keyword);
+ /* no way can we deal with a continuation inside a keyword */
+ if (strncmp(cp, "\\\r\n", 3) == 0 ||
+ strncmp(cp, "\\\n", 2) == 0)
+ Eioccc();
+ cp = skipline(cp);
+ retval = LT_PLAIN;
+ goto done;
+ }
+ cp = skipcomment(cp);
+ if (*cp != '\0') {
+ cp = skipline(cp);
+ if (retval == LT_TRUE || retval == LT_FALSE ||
+ retval == LT_TRUEI || retval == LT_FALSEI)
+ retval = LT_IF;
+ if (retval == LT_ELTRUE || retval == LT_ELFALSE)
+ retval = LT_ELIF;
+ }
+ /* the following can happen if the last line of the file lacks a
+ newline or if there is too much whitespace in a directive */
+ if (linestate == LS_HASH) {
+ long len = cp - tline;
+ if (fgets(tline + len, MAXLINE - len, input) == NULL) {
+ if (ferror(input))
+ err(2, "can't read %s", filename);
+ /* append the missing newline at eof */
+ strcpy(tline + len, newline);
+ cp += strlen(newline);
+ linestate = LS_START;
+ } else {
+ linestate = LS_DIRTY;
+ }
+ }
+ if (retval != LT_PLAIN && (wascomment || linestate != LS_START)) {
+ retval = linetype_2dodgy(retval);
+ linestate = LS_DIRTY;
+ }
+done:
+ debug("parser line %d state %s comment %s line", linenum,
+ comment_name[incomment], linestate_name[linestate]);
+ return (retval);
+}
+
+/*
+ * These are the binary operators that are supported by the expression
+ * evaluator.
+ */
+static Linetype op_strict(long *p, long v, Linetype at, Linetype bt) {
+ if(at == LT_IF || bt == LT_IF) return (LT_IF);
+ return (*p = v, v ? LT_TRUE : LT_FALSE);
+}
+static Linetype op_lt(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a < b, at, bt);
+}
+static Linetype op_gt(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a > b, at, bt);
+}
+static Linetype op_le(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a <= b, at, bt);
+}
+static Linetype op_ge(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a >= b, at, bt);
+}
+static Linetype op_eq(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a == b, at, bt);
+}
+static Linetype op_ne(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a != b, at, bt);
+}
+static Linetype op_or(long *p, Linetype at, long a, Linetype bt, long b) {
+ if (!strictlogic && (at == LT_TRUE || bt == LT_TRUE))
+ return (*p = 1, LT_TRUE);
+ return op_strict(p, a || b, at, bt);
+}
+static Linetype op_and(long *p, Linetype at, long a, Linetype bt, long b) {
+ if (!strictlogic && (at == LT_FALSE || bt == LT_FALSE))
+ return (*p = 0, LT_FALSE);
+ return op_strict(p, a && b, at, bt);
+}
+static Linetype op_blsh(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a << b, at, bt);
+}
+static Linetype op_brsh(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a >> b, at, bt);
+}
+static Linetype op_add(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a + b, at, bt);
+}
+static Linetype op_sub(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a - b, at, bt);
+}
+static Linetype op_mul(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a * b, at, bt);
+}
+static Linetype op_div(long *p, Linetype at, long a, Linetype bt, long b) {
+ if (bt != LT_TRUE) {
+ debug("eval division by zero");
+ return (LT_ERROR);
+ }
+ return op_strict(p, a / b, at, bt);
+}
+static Linetype op_mod(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a % b, at, bt);
+}
+static Linetype op_bor(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a | b, at, bt);
+}
+static Linetype op_bxor(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a ^ b, at, bt);
+}
+static Linetype op_band(long *p, Linetype at, long a, Linetype bt, long b) {
+ return op_strict(p, a & b, at, bt);
+}
+
+/*
+ * An evaluation function takes three arguments, as follows: (1) a pointer to
+ * an element of the precedence table which lists the operators at the current
+ * level of precedence; (2) a pointer to an integer which will receive the
+ * value of the expression; and (3) a pointer to a char* that points to the
+ * expression to be evaluated and that is updated to the end of the expression
+ * when evaluation is complete. The function returns LT_FALSE if the value of
+ * the expression is zero, LT_TRUE if it is non-zero, LT_IF if the expression
+ * depends on an unknown symbol, or LT_ERROR if there is a parse failure.
+ */
+struct ops;
+
+typedef Linetype eval_fn(const struct ops *, long *, const char **);
+
+static eval_fn eval_table, eval_unary;
+
+/*
+ * The precedence table. Expressions involving binary operators are evaluated
+ * in a table-driven way by eval_table. When it evaluates a subexpression it
+ * calls the inner function with its first argument pointing to the next
+ * element of the table. Innermost expressions have special non-table-driven
+ * handling.
+ *
+ * The stop characters help with lexical analysis: an operator is not
+ * recognized if it is followed by one of the stop characters because
+ * that would make it a different operator.
+ */
+struct op {
+ const char *str;
+ Linetype (*fn)(long *, Linetype, long, Linetype, long);
+ const char *stop;
+};
+struct ops {
+ eval_fn *inner;
+ struct op op[5];
+};
+static const struct ops eval_ops[] = {
+ { eval_table, { { "||", op_or, NULL } } },
+ { eval_table, { { "&&", op_and, NULL } } },
+ { eval_table, { { "|", op_bor, "|" } } },
+ { eval_table, { { "^", op_bxor, NULL } } },
+ { eval_table, { { "&", op_band, "&" } } },
+ { eval_table, { { "==", op_eq, NULL },
+ { "!=", op_ne, NULL } } },
+ { eval_table, { { "<=", op_le, NULL },
+ { ">=", op_ge, NULL },
+ { "<", op_lt, "<=" },
+ { ">", op_gt, ">=" } } },
+ { eval_table, { { "<<", op_blsh, NULL },
+ { ">>", op_brsh, NULL } } },
+ { eval_table, { { "+", op_add, NULL },
+ { "-", op_sub, NULL } } },
+ { eval_unary, { { "*", op_mul, NULL },
+ { "/", op_div, NULL },
+ { "%", op_mod, NULL } } },
+};
+
+/* Current operator precedence level */
+static long prec(const struct ops *ops)
+{
+ return (ops - eval_ops);
+}
+
+/*
+ * Function for evaluating the innermost parts of expressions,
+ * viz. !expr (expr) number defined(symbol) symbol
+ * We reset the constexpr flag in the last two cases.
+ */
+static Linetype
+eval_unary(const struct ops *ops, long *valp, const char **cpp)
+{
+ const char *cp;
+ char *ep;
+ int sym;
+ bool defparen;
+ Linetype lt;
+
+ cp = skipcomment(*cpp);
+ if (*cp == '!') {
+ debug("eval%d !", prec(ops));
+ cp++;
+ lt = eval_unary(ops, valp, &cp);
+ if (lt == LT_ERROR)
+ return (LT_ERROR);
+ if (lt != LT_IF) {
+ *valp = !*valp;
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ }
+ } else if (*cp == '~') {
+ debug("eval%d ~", prec(ops));
+ cp++;
+ lt = eval_unary(ops, valp, &cp);
+ if (lt == LT_ERROR)
+ return (LT_ERROR);
+ if (lt != LT_IF) {
+ *valp = ~(*valp);
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ }
+ } else if (*cp == '-') {
+ debug("eval%d -", prec(ops));
+ cp++;
+ lt = eval_unary(ops, valp, &cp);
+ if (lt == LT_ERROR)
+ return (LT_ERROR);
+ if (lt != LT_IF) {
+ *valp = -(*valp);
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ }
+ } else if (*cp == '(') {
+ cp++;
+ debug("eval%d (", prec(ops));
+ lt = eval_table(eval_ops, valp, &cp);
+ if (lt == LT_ERROR)
+ return (LT_ERROR);
+ cp = skipcomment(cp);
+ if (*cp++ != ')')
+ return (LT_ERROR);
+ } else if (isdigit((unsigned char)*cp)) {
+ debug("eval%d number", prec(ops));
+ *valp = strtol(cp, &ep, 0);
+ if (ep == cp)
+ return (LT_ERROR);
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ cp = ep;
+ } else if (matchsym("defined", cp) != NULL) {
+ cp = skipcomment(cp+7);
+ if (*cp == '(') {
+ cp = skipcomment(cp+1);
+ defparen = true;
+ } else {
+ defparen = false;
+ }
+ sym = findsym(&cp);
+ cp = skipcomment(cp);
+ if (defparen && *cp++ != ')') {
+ debug("eval%d defined missing ')'", prec(ops));
+ return (LT_ERROR);
+ }
+ if (sym < 0) {
+ debug("eval%d defined unknown", prec(ops));
+ lt = LT_IF;
+ } else {
+ debug("eval%d defined %s", prec(ops), symname[sym]);
+ *valp = (value[sym] != NULL);
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ }
+ constexpr = false;
+ } else if (!endsym(*cp)) {
+ debug("eval%d symbol", prec(ops));
+ sym = findsym(&cp);
+ if (sym < 0) {
+ lt = LT_IF;
+ cp = skipargs(cp);
+ } else if (value[sym] == NULL) {
+ *valp = 0;
+ lt = LT_FALSE;
+ } else {
+ *valp = strtol(value[sym], &ep, 0);
+ if (*ep != '\0' || ep == value[sym])
+ return (LT_ERROR);
+ lt = *valp ? LT_TRUE : LT_FALSE;
+ cp = skipargs(cp);
+ }
+ constexpr = false;
+ } else {
+ debug("eval%d bad expr", prec(ops));
+ return (LT_ERROR);
+ }
+
+ *cpp = cp;
+ debug("eval%d = %d", prec(ops), *valp);
+ return (lt);
+}
+
+/*
+ * Table-driven evaluation of binary operators.
+ */
+static Linetype
+eval_table(const struct ops *ops, long *valp, const char **cpp)
+{
+ const struct op *op;
+ const char *cp;
+ long val = 0;
+ Linetype lt, rt;
+
+ debug("eval%d", prec(ops));
+ cp = *cpp;
+ lt = ops->inner(ops+1, valp, &cp);
+ if (lt == LT_ERROR)
+ return (LT_ERROR);
+ for (;;) {
+ cp = skipcomment(cp);
+ for (op = ops->op; op->str != NULL; op++) {
+ if (strncmp(cp, op->str, strlen(op->str)) == 0) {
+ /* assume only one-char operators have stop chars */
+ if (op->stop != NULL && cp[1] != '\0' &&
+ strchr(op->stop, cp[1]) != NULL)
+ continue;
+ else
+ break;
+ }
+ }
+ if (op->str == NULL)
+ break;
+ cp += strlen(op->str);
+ debug("eval%d %s", prec(ops), op->str);
+ rt = ops->inner(ops+1, &val, &cp);
+ if (rt == LT_ERROR)
+ return (LT_ERROR);
+ lt = op->fn(valp, lt, *valp, rt, val);
+ }
+
+ *cpp = cp;
+ debug("eval%d = %d", prec(ops), *valp);
+ debug("eval%d lt = %s", prec(ops), linetype_name[lt]);
+ return (lt);
+}
+
+/*
+ * Evaluate the expression on a #if or #elif line. If we can work out
+ * the result we return LT_TRUE or LT_FALSE accordingly, otherwise we
+ * return just a generic LT_IF.
+ */
+static Linetype
+ifeval(const char **cpp)
+{
+ Linetype ret;
+ long val = 0;
+
+ debug("eval %s", *cpp);
+ constexpr = killconsts ? false : true;
+ ret = eval_table(eval_ops, &val, cpp);
+ debug("eval = %d", val);
+ return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
+}
+
+/*
+ * Read a line and examine its initial part to determine if it is a
+ * preprocessor directive. Returns NULL on EOF, or a pointer to a
+ * preprocessor directive name, or a pointer to the zero byte at the
+ * end of the line.
+ */
+static const char *
+skiphash(void)
+{
+ const char *cp;
+
+ linenum++;
+ if (fgets(tline, MAXLINE, input) == NULL) {
+ if (ferror(input))
+ err(2, "can't read %s", filename);
+ else
+ return (NULL);
+ }
+ cp = skipcomment(tline);
+ if (linestate == LS_START && *cp == '#') {
+ linestate = LS_HASH;
+ return (skipcomment(cp + 1));
+ } else if (*cp == '\0') {
+ return (cp);
+ } else {
+ return (skipline(cp));
+ }
+}
+
+/*
+ * Mark a line dirty and consume the rest of it, keeping track of the
+ * lexical state.
+ */
+static const char *
+skipline(const char *cp)
+{
+ const char *pcp;
+ if (*cp != '\0')
+ linestate = LS_DIRTY;
+ while (*cp != '\0') {
+ cp = skipcomment(pcp = cp);
+ if (pcp == cp)
+ cp++;
+ }
+ return (cp);
+}
+
+/*
+ * Skip over comments, strings, and character literals and stop at the
+ * next character position that is not whitespace. Between calls we keep
+ * the comment state in the global variable incomment, and we also adjust
+ * the global variable linestate when we see a newline.
+ * XXX: doesn't cope with the buffer splitting inside a state transition.
+ */
+static const char *
+skipcomment(const char *cp)
+{
+ if (text || ignoring[depth]) {
+ for (; isspace((unsigned char)*cp); cp++)
+ if (*cp == '\n')
+ linestate = LS_START;
+ return (cp);
+ }
+ while (*cp != '\0')
+ /* don't reset to LS_START after a line continuation */
+ if (strncmp(cp, "\\\r\n", 3) == 0)
+ cp += 3;
+ else if (strncmp(cp, "\\\n", 2) == 0)
+ cp += 2;
+ else switch (incomment) {
+ case NO_COMMENT:
+ if (strncmp(cp, "/\\\r\n", 4) == 0) {
+ incomment = STARTING_COMMENT;
+ cp += 4;
+ } else if (strncmp(cp, "/\\\n", 3) == 0) {
+ incomment = STARTING_COMMENT;
+ cp += 3;
+ } else if (strncmp(cp, "/*", 2) == 0) {
+ incomment = C_COMMENT;
+ cp += 2;
+ } else if (strncmp(cp, "//", 2) == 0) {
+ incomment = CXX_COMMENT;
+ cp += 2;
+ } else if (strncmp(cp, "\'", 1) == 0) {
+ incomment = CHAR_LITERAL;
+ linestate = LS_DIRTY;
+ cp += 1;
+ } else if (strncmp(cp, "\"", 1) == 0) {
+ incomment = STRING_LITERAL;
+ linestate = LS_DIRTY;
+ cp += 1;
+ } else if (strncmp(cp, "\n", 1) == 0) {
+ linestate = LS_START;
+ cp += 1;
+ } else if (strchr(" \r\t", *cp) != NULL) {
+ cp += 1;
+ } else
+ return (cp);
+ continue;
+ case CXX_COMMENT:
+ if (strncmp(cp, "\n", 1) == 0) {
+ incomment = NO_COMMENT;
+ linestate = LS_START;
+ }
+ cp += 1;
+ continue;
+ case CHAR_LITERAL:
+ case STRING_LITERAL:
+ if ((incomment == CHAR_LITERAL && cp[0] == '\'') ||
+ (incomment == STRING_LITERAL && cp[0] == '\"')) {
+ incomment = NO_COMMENT;
+ cp += 1;
+ } else if (cp[0] == '\\') {
+ if (cp[1] == '\0')
+ cp += 1;
+ else
+ cp += 2;
+ } else if (strncmp(cp, "\n", 1) == 0) {
+ if (incomment == CHAR_LITERAL)
+ error("Unterminated char literal");
+ else
+ error("Unterminated string literal");
+ } else
+ cp += 1;
+ continue;
+ case C_COMMENT:
+ if (strncmp(cp, "*\\\r\n", 4) == 0) {
+ incomment = FINISHING_COMMENT;
+ cp += 4;
+ } else if (strncmp(cp, "*\\\n", 3) == 0) {
+ incomment = FINISHING_COMMENT;
+ cp += 3;
+ } else if (strncmp(cp, "*/", 2) == 0) {
+ incomment = NO_COMMENT;
+ cp += 2;
+ } else
+ cp += 1;
+ continue;
+ case STARTING_COMMENT:
+ if (*cp == '*') {
+ incomment = C_COMMENT;
+ cp += 1;
+ } else if (*cp == '/') {
+ incomment = CXX_COMMENT;
+ cp += 1;
+ } else {
+ incomment = NO_COMMENT;
+ linestate = LS_DIRTY;
+ }
+ continue;
+ case FINISHING_COMMENT:
+ if (*cp == '/') {
+ incomment = NO_COMMENT;
+ cp += 1;
+ } else
+ incomment = C_COMMENT;
+ continue;
+ default:
+ abort(); /* bug */
+ }
+ return (cp);
+}
+
+/*
+ * Skip macro arguments.
+ */
+static const char *
+skipargs(const char *cp)
+{
+ const char *ocp = cp;
+ int level = 0;
+ cp = skipcomment(cp);
+ if (*cp != '(')
+ return (cp);
+ do {
+ if (*cp == '(')
+ level++;
+ if (*cp == ')')
+ level--;
+ cp = skipcomment(cp+1);
+ } while (level != 0 && *cp != '\0');
+ if (level == 0)
+ return (cp);
+ else
+ /* Rewind and re-detect the syntax error later. */
+ return (ocp);
+}
+
+/*
+ * Skip over an identifier.
+ */
+static const char *
+skipsym(const char *cp)
+{
+ while (!endsym(*cp))
+ ++cp;
+ return (cp);
+}
+
+/*
+ * Skip whitespace and take a copy of any following identifier.
+ */
+static const char *
+getsym(const char **cpp)
+{
+ const char *cp = *cpp, *sym;
+
+ cp = skipcomment(cp);
+ cp = skipsym(sym = cp);
+ if (cp == sym)
+ return NULL;
+ *cpp = cp;
+ return (xstrdup(sym, cp));
+}
+
+/*
+ * Check that s (a symbol) matches the start of t, and that the
+ * following character in t is not a symbol character. Returns a
+ * pointer to the following character in t if there is a match,
+ * otherwise NULL.
+ */
+static const char *
+matchsym(const char *s, const char *t)
+{
+ while (*s != '\0' && *t != '\0')
+ if (*s != *t)
+ return (NULL);
+ else
+ ++s, ++t;
+ if (*s == '\0' && endsym(*t))
+ return(t);
+ else
+ return(NULL);
+}
+
+/*
+ * Look for the symbol in the symbol table. If it is found, we return
+ * the symbol table index, else we return -1.
+ */
+static int
+findsym(const char **strp)
+{
+ const char *str;
+ int symind;
+
+ str = *strp;
+ *strp = skipsym(str);
+ if (symlist) {
+ if (*strp == str)
+ return (-1);
+ if (symdepth && firstsym)
+ printf("%s%3d", zerosyms ? "" : "\n", depth);
+ firstsym = zerosyms = false;
+ printf("%s%.*s%s",
+ symdepth ? " " : "",
+ (int)(*strp-str), str,
+ symdepth ? "" : "\n");
+ /* we don't care about the value of the symbol */
+ return (0);
+ }
+ for (symind = 0; symind < nsyms; ++symind) {
+ if (matchsym(symname[symind], str) != NULL) {
+ debugsym("findsym", symind);
+ return (symind);
+ }
+ }
+ return (-1);
+}
+
+/*
+ * Resolve indirect symbol values to their final definitions.
+ */
+static void
+indirectsym(void)
+{
+ const char *cp;
+ int changed, sym, ind;
+
+ do {
+ changed = 0;
+ for (sym = 0; sym < nsyms; ++sym) {
+ if (value[sym] == NULL)
+ continue;
+ cp = value[sym];
+ ind = findsym(&cp);
+ if (ind == -1 || ind == sym ||
+ *cp != '\0' ||
+ value[ind] == NULL ||
+ value[ind] == value[sym])
+ continue;
+ debugsym("indir...", sym);
+ value[sym] = value[ind];
+ debugsym("...ectsym", sym);
+ changed++;
+ }
+ } while (changed);
+}
+
+/*
+ * Add a symbol to the symbol table, specified with the format sym=val
+ */
+static void
+addsym1(bool ignorethis, bool definethis, char *symval)
+{
+ const char *sym, *val;
+
+ sym = symval;
+ val = skipsym(sym);
+ if (definethis && *val == '=') {
+ symval[val - sym] = '\0';
+ val = val + 1;
+ } else if (*val == '\0') {
+ val = definethis ? "1" : NULL;
+ } else {
+ usage();
+ }
+ addsym2(ignorethis, sym, val);
+}
+
+/*
+ * Add a symbol to the symbol table.
+ */
+static void
+addsym2(bool ignorethis, const char *sym, const char *val)
+{
+ const char *cp = sym;
+ int symind;
+
+ symind = findsym(&cp);
+ if (symind < 0) {
+ if (nsyms >= MAXSYMS)
+ errx(2, "too many symbols");
+ symind = nsyms++;
+ }
+ ignore[symind] = ignorethis;
+ symname[symind] = sym;
+ value[symind] = val;
+ debugsym("addsym", symind);
+}
+
+static void
+debugsym(const char *why, int symind)
+{
+ debug("%s %s%c%s", why, symname[symind],
+ value[symind] ? '=' : ' ',
+ value[symind] ? value[symind] : "undef");
+}
+
+/*
+ * Add symbols to the symbol table from a file containing
+ * #define and #undef preprocessor directives.
+ */
+static void
+defundefile(const char *fn)
+{
+ filename = fn;
+ input = fopen(fn, "rb");
+ if (input == NULL)
+ err(2, "can't open %s", fn);
+ linenum = 0;
+ while (defundef())
+ ;
+ if (ferror(input))
+ err(2, "can't read %s", filename);
+ else
+ fclose(input);
+ if (incomment)
+ error("EOF in comment");
+}
+
+/*
+ * Read and process one #define or #undef directive
+ */
+static bool
+defundef(void)
+{
+ const char *cp, *kw, *sym, *val, *end;
+
+ cp = skiphash();
+ if (cp == NULL)
+ return (false);
+ if (*cp == '\0')
+ goto done;
+ /* strip trailing whitespace, and do a fairly rough check to
+ avoid unsupported multi-line preprocessor directives */
+ end = cp + strlen(cp);
+ while (end > tline && strchr(" \t\n\r", end[-1]) != NULL)
+ --end;
+ if (end > tline && end[-1] == '\\')
+ Eioccc();
+
+ kw = cp;
+ if ((cp = matchsym("define", kw)) != NULL) {
+ sym = getsym(&cp);
+ if (sym == NULL)
+ error("Missing macro name in #define");
+ if (*cp == '(') {
+ val = "1";
+ } else {
+ cp = skipcomment(cp);
+ val = (cp < end) ? xstrdup(cp, end) : "";
+ }
+ debug("#define");
+ addsym2(false, sym, val);
+ } else if ((cp = matchsym("undef", kw)) != NULL) {
+ sym = getsym(&cp);
+ if (sym == NULL)
+ error("Missing macro name in #undef");
+ cp = skipcomment(cp);
+ debug("#undef");
+ addsym2(false, sym, NULL);
+ } else {
+ error("Unrecognized preprocessor directive");
+ }
+ skipline(cp);
+done:
+ debug("parser line %d state %s comment %s line", linenum,
+ comment_name[incomment], linestate_name[linestate]);
+ return (true);
+}
+
+/*
+ * Concatenate two strings into new memory, checking for failure.
+ */
+static char *
+astrcat(const char *s1, const char *s2)
+{
+ char *s;
+ int len;
+ size_t size;
+
+ len = snprintf(NULL, 0, "%s%s", s1, s2);
+ if (len < 0)
+ err(2, "snprintf");
+ size = (size_t)len + 1;
+ s = (char *)malloc(size);
+ if (s == NULL)
+ err(2, "malloc");
+ snprintf(s, size, "%s%s", s1, s2);
+ return (s);
+}
+
+/*
+ * Duplicate a segment of a string, checking for failure.
+ */
+static const char *
+xstrdup(const char *start, const char *end)
+{
+ size_t n;
+ char *s;
+
+ if (end < start) abort(); /* bug */
+ n = (size_t)(end - start) + 1;
+ s = malloc(n);
+ if (s == NULL)
+ err(2, "malloc");
+ snprintf(s, n, "%s", start);
+ return (s);
+}
+
+/*
+ * Diagnostics.
+ */
+static void
+debug(const char *msg, ...)
+{
+ va_list ap;
+
+ if (debugging) {
+ va_start(ap, msg);
+ vwarnx(msg, ap);
+ va_end(ap);
+ }
+}
+
+static void
+error(const char *msg)
+{
+ if (depth == 0)
+ warnx("%s: %d: %s", filename, linenum, msg);
+ else
+ warnx("%s: %d: %s (#if line %d depth %d)",
+ filename, linenum, msg, stifline[depth], depth);
+ closeio();
+ errx(2, "Output may be truncated");
+}
diff --git a/usr.bin/unifdef/unifdef.h b/usr.bin/unifdef/unifdef.h
new file mode 100644
index 0000000..6e58e4f
--- /dev/null
+++ b/usr.bin/unifdef/unifdef.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012 - 2013 Tony Finch <dot@dotat.at>
+ *
+ * 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$
+ */
+
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* portability stubs */
+
+#define fbinmode(fp) (fp)
+
+#define replace(old,new) rename(old,new)
+
+static FILE *
+mktempmode(char *tmp, int mode)
+{
+ int fd = mkstemp(tmp);
+ if (fd < 0) return (NULL);
+ fchmod(fd, mode & (S_IRWXU|S_IRWXG|S_IRWXO));
+ return (fdopen(fd, "wb"));
+}
diff --git a/usr.bin/unifdef/unifdefall.sh b/usr.bin/unifdef/unifdefall.sh
new file mode 100644
index 0000000..6abf60b
--- /dev/null
+++ b/usr.bin/unifdef/unifdefall.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# unifdefall: remove all the #if's from a source file
+#
+# Copyright (c) 2002 - 2013 Tony Finch <dot@dotat.at>
+# Copyright (c) 2009 - 2010 Jonathan Nieder <jrnieder@gmail.com>
+#
+# 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 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 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$
+
+set -e
+
+unifdef="$(dirname "$0")/unifdef"
+if [ ! -e "$unifdef" ]
+then
+ unifdef=unifdef
+fi
+
+case "$@" in
+"-d "*) echo DEBUGGING 1>&2
+ debug=-d
+ shift
+esac
+
+tmp=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXXXXXX") || exit 2
+trap 'rm -r "$tmp" || exit 2' EXIT
+
+export LC_ALL=C
+
+# list of all controlling macros; assume these are undefined
+"$unifdef" $debug -s "$@" | sort -u | sed 's/^/#undef /' >"$tmp/undefs"
+# list of all macro definitions
+cc -E -dM "$@" | sort >"$tmp/defs"
+
+case $debug in
+-d) cat "$tmp/undefs" "$tmp/defs" 1>&2
+esac
+
+# order of -f arguments means definitions override undefs
+"$unifdef" $debug -k -f "$tmp/undefs" -f "$tmp/defs" "$@"
diff --git a/usr.bin/uniq/Makefile b/usr.bin/uniq/Makefile
new file mode 100644
index 0000000..2bcf18e
--- /dev/null
+++ b/usr.bin/uniq/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= uniq
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/uniq/Makefile.depend b/usr.bin/uniq/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/uniq/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/uniq/uniq.1 b/usr.bin/uniq/uniq.1
new file mode 100644
index 0000000..63b9105
--- /dev/null
+++ b/usr.bin/uniq/uniq.1
@@ -0,0 +1,151 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" From: @(#)uniq.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2009
+.Dt UNIQ 1
+.Os
+.Sh NAME
+.Nm uniq
+.Nd report or filter out repeated lines in a file
+.Sh SYNOPSIS
+.Nm
+.Op Fl c | Fl d | Fl u
+.Op Fl i
+.Op Fl f Ar num
+.Op Fl s Ar chars
+.Oo
+.Ar input_file
+.Op Ar output_file
+.Oc
+.Sh DESCRIPTION
+The
+.Nm
+utility reads the specified
+.Ar input_file
+comparing adjacent lines, and writes a copy of each unique input line to
+the
+.Ar output_file .
+If
+.Ar input_file
+is a single dash
+.Pq Sq Fl
+or absent, the standard input is read.
+If
+.Ar output_file
+is absent, standard output is used for output.
+The second and succeeding copies of identical adjacent input lines are
+not written.
+Repeated lines in the input will not be detected if they are not adjacent,
+so it may be necessary to sort the files first.
+.Pp
+The following options are available:
+.Bl -tag -width Ds
+.It Fl c
+Precede each output line with the count of the number of times the line
+occurred in the input, followed by a single space.
+.It Fl d
+Only output lines that are repeated in the input.
+.It Fl f Ar num
+Ignore the first
+.Ar num
+fields in each input line when doing comparisons.
+A field is a string of non-blank characters separated from adjacent fields
+by blanks.
+Field numbers are one based, i.e., the first field is field one.
+.It Fl s Ar chars
+Ignore the first
+.Ar chars
+characters in each input line when doing comparisons.
+If specified in conjunction with the
+.Fl f
+option, the first
+.Ar chars
+characters after the first
+.Ar num
+fields will be ignored.
+Character numbers are one based, i.e., the first character is character one.
+.It Fl u
+Only output lines that are not repeated in the input.
+.It Fl i
+Case insensitive comparison of lines.
+.\".It Fl Ns Ar n
+.\"(Deprecated; replaced by
+.\".Fl f ) .
+.\"Ignore the first n
+.\"fields on each input line when doing comparisons,
+.\"where n is a number.
+.\"A field is a string of non-blank
+.\"characters separated from adjacent fields
+.\"by blanks.
+.\".It Cm \&\(pl Ns Ar n
+.\"(Deprecated; replaced by
+.\".Fl s ) .
+.\"Ignore the first
+.\".Ar m
+.\"characters when doing comparisons, where
+.\".Ar m
+.\"is a
+.\"number.
+.El
+.Sh ENVIRONMENT
+The
+.Ev LANG ,
+.Ev LC_ALL ,
+.Ev LC_COLLATE
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+The historic
+.Cm \&\(pl Ns Ar number
+and
+.Fl Ns Ar number
+options have been deprecated but are still supported in this implementation.
+.Sh SEE ALSO
+.Xr sort 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001
+as amended by Cor.\& 1-2002.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v3 .
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
new file mode 100644
index 0000000..7c1b0e3
--- /dev/null
+++ b/usr.bin/uniq/uniq.c
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Case Larsen.
+ *
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)uniq.c 8.3 (Berkeley) 5/4/95";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <sys/capsicum.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <stdint.h>
+#define _WITH_GETLINE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+static int cflag, dflag, uflag, iflag;
+static int numchars, numfields, repeats;
+
+static FILE *file(const char *, const char *);
+static wchar_t *convert(const char *);
+static int inlcmp(const char *, const char *);
+static void show(FILE *, const char *);
+static wchar_t *skip(wchar_t *);
+static void obsolete(char *[]);
+static void usage(void);
+
+static void
+strerror_init(void)
+{
+
+ /*
+ * Cache NLS data before entering capability mode.
+ * XXXPJD: There should be strerror_init() and strsignal_init() in libc.
+ */
+ (void)catopen("libc", NL_CAT_LOCALE);
+}
+
+int
+main (int argc, char *argv[])
+{
+ wchar_t *tprev, *tthis;
+ FILE *ifp, *ofp;
+ int ch, comp;
+ size_t prevbuflen, thisbuflen, b1;
+ char *prevline, *thisline, *p;
+ const char *ifn;
+ cap_rights_t rights;
+
+ (void) setlocale(LC_ALL, "");
+
+ obsolete(argv);
+ while ((ch = getopt(argc, argv, "cdif:s:u")) != -1)
+ switch (ch) {
+ case 'c':
+ cflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'i':
+ iflag = 1;
+ break;
+ case 'f':
+ numfields = strtol(optarg, &p, 10);
+ if (numfields < 0 || *p)
+ errx(1, "illegal field skip value: %s", optarg);
+ break;
+ case 's':
+ numchars = strtol(optarg, &p, 10);
+ if (numchars < 0 || *p)
+ errx(1, "illegal character skip value: %s", optarg);
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ /* If no flags are set, default is -d -u. */
+ if (cflag) {
+ if (dflag || uflag)
+ usage();
+ } else if (!dflag && !uflag)
+ dflag = uflag = 1;
+
+ if (argc > 2)
+ usage();
+
+ ifp = stdin;
+ ifn = "stdin";
+ ofp = stdout;
+ if (argc > 0 && strcmp(argv[0], "-") != 0)
+ ifp = file(ifn = argv[0], "r");
+ cap_rights_init(&rights, CAP_FSTAT, CAP_READ);
+ if (cap_rights_limit(fileno(ifp), &rights) < 0 && errno != ENOSYS)
+ err(1, "unable to limit rights for %s", ifn);
+ cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE);
+ if (argc > 1)
+ ofp = file(argv[1], "w");
+ else
+ cap_rights_set(&rights, CAP_IOCTL);
+ if (cap_rights_limit(fileno(ofp), &rights) < 0 && errno != ENOSYS) {
+ err(1, "unable to limit rights for %s",
+ argc > 1 ? argv[1] : "stdout");
+ }
+ if (cap_rights_is_set(&rights, CAP_IOCTL)) {
+ unsigned long cmd;
+
+ cmd = TIOCGETA; /* required by isatty(3) in printf(3) */
+
+ if (cap_ioctls_limit(fileno(ofp), &cmd, 1) < 0 &&
+ errno != ENOSYS) {
+ err(1, "unable to limit ioctls for %s",
+ argc > 1 ? argv[1] : "stdout");
+ }
+ }
+
+ strerror_init();
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
+ prevbuflen = thisbuflen = 0;
+ prevline = thisline = NULL;
+
+ if (getline(&prevline, &prevbuflen, ifp) < 0) {
+ if (ferror(ifp))
+ err(1, "%s", ifn);
+ exit(0);
+ }
+ tprev = convert(prevline);
+
+ if (!cflag && uflag && dflag)
+ show(ofp, prevline);
+
+ tthis = NULL;
+ while (getline(&thisline, &thisbuflen, ifp) >= 0) {
+ if (tthis != NULL)
+ free(tthis);
+ tthis = convert(thisline);
+
+ if (tthis == NULL && tprev == NULL)
+ comp = inlcmp(thisline, prevline);
+ else if (tthis == NULL || tprev == NULL)
+ comp = 1;
+ else
+ comp = wcscoll(tthis, tprev);
+
+ if (comp) {
+ /* If different, print; set previous to new value. */
+ if (cflag || !dflag || !uflag)
+ show(ofp, prevline);
+ p = prevline;
+ b1 = prevbuflen;
+ prevline = thisline;
+ prevbuflen = thisbuflen;
+ if (tprev != NULL)
+ free(tprev);
+ tprev = tthis;
+ if (!cflag && uflag && dflag)
+ show(ofp, prevline);
+ thisline = p;
+ thisbuflen = b1;
+ tthis = NULL;
+ repeats = 0;
+ } else
+ ++repeats;
+ }
+ if (ferror(ifp))
+ err(1, "%s", ifn);
+ if (cflag || !dflag || !uflag)
+ show(ofp, prevline);
+ exit(0);
+}
+
+static wchar_t *
+convert(const char *str)
+{
+ size_t n;
+ wchar_t *buf, *ret, *p;
+
+ if ((n = mbstowcs(NULL, str, 0)) == (size_t)-1)
+ return (NULL);
+ if (SIZE_MAX / sizeof(*buf) < n + 1)
+ errx(1, "conversion buffer length overflow");
+ if ((buf = malloc((n + 1) * sizeof(*buf))) == NULL)
+ err(1, "malloc");
+ if (mbstowcs(buf, str, n + 1) != n)
+ errx(1, "internal mbstowcs() error");
+ /* The last line may not end with \n. */
+ if (n > 0 && buf[n - 1] == L'\n')
+ buf[n - 1] = L'\0';
+
+ /* If requested get the chosen fields + character offsets. */
+ if (numfields || numchars) {
+ if ((ret = wcsdup(skip(buf))) == NULL)
+ err(1, "wcsdup");
+ free(buf);
+ } else
+ ret = buf;
+
+ if (iflag) {
+ for (p = ret; *p != L'\0'; p++)
+ *p = towlower(*p);
+ }
+
+ return (ret);
+}
+
+static int
+inlcmp(const char *s1, const char *s2)
+{
+ int c1, c2;
+
+ while (*s1 == *s2++)
+ if (*s1++ == '\0')
+ return (0);
+ c1 = (unsigned char)*s1;
+ c2 = (unsigned char)*(s2 - 1);
+ /* The last line may not end with \n. */
+ if (c1 == '\n')
+ c1 = '\0';
+ if (c2 == '\n')
+ c2 = '\0';
+ return (c1 - c2);
+}
+
+/*
+ * show --
+ * Output a line depending on the flags and number of repetitions
+ * of the line.
+ */
+static void
+show(FILE *ofp, const char *str)
+{
+
+ if (cflag)
+ (void)fprintf(ofp, "%4d %s", repeats + 1, str);
+ if ((dflag && repeats) || (uflag && !repeats))
+ (void)fprintf(ofp, "%s", str);
+}
+
+static wchar_t *
+skip(wchar_t *str)
+{
+ int nchars, nfields;
+
+ for (nfields = 0; *str != L'\0' && nfields++ != numfields; ) {
+ while (iswblank(*str))
+ str++;
+ while (*str != L'\0' && !iswblank(*str))
+ str++;
+ }
+ for (nchars = numchars; nchars-- && *str != L'\0'; ++str)
+ ;
+ return(str);
+}
+
+static FILE *
+file(const char *name, const char *mode)
+{
+ FILE *fp;
+
+ if ((fp = fopen(name, mode)) == NULL)
+ err(1, "%s", name);
+ return(fp);
+}
+
+static void
+obsolete(char *argv[])
+{
+ int len;
+ char *ap, *p, *start;
+
+ while ((ap = *++argv)) {
+ /* Return if "--" or not an option of any form. */
+ if (ap[0] != '-') {
+ if (ap[0] != '+')
+ return;
+ } else if (ap[1] == '-')
+ return;
+ if (!isdigit((unsigned char)ap[1]))
+ continue;
+ /*
+ * Digit signifies an old-style option. Malloc space for dash,
+ * new option and argument.
+ */
+ len = strlen(ap);
+ if ((start = p = malloc(len + 3)) == NULL)
+ err(1, "malloc");
+ *p++ = '-';
+ *p++ = ap[0] == '+' ? 's' : 'f';
+ (void)strcpy(p, ap + 1);
+ *argv = start;
+ }
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
+ exit(1);
+}
diff --git a/usr.bin/units/Makefile b/usr.bin/units/Makefile
new file mode 100644
index 0000000..278d372
--- /dev/null
+++ b/usr.bin/units/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= units
+FILES= definitions.units
+FILESDIR= ${SHAREDIR}/misc
+
+LIBADD= edit
+
+.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
new file mode 100644
index 0000000..3d92039
--- /dev/null
+++ b/usr.bin/units/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/units/README b/usr.bin/units/README
new file mode 100644
index 0000000..974cbe9
--- /dev/null
+++ b/usr.bin/units/README
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+This is a program which I wrote as a clone of the UNIX 'units'
+command. I threw it together in a couple days, but it seems to work,
+with some restrictions. I have tested it under DOS with Borland C and
+Ultrix 4.2, and SunOS 4.1.
+
+This program differs from the unix units program in the following
+ways:
+ it can gracefully handle exponents larger than 9 in output
+ it uses 'e' to denote exponentiation in numbers
+ prefixes are listed in the units file
+ it tries both -s and -es plurals
+ it allows use of * for multiply and ^ for exponentiation in the input
+ the output format is somewhat different
+
+Adrian Mariano (adrian@cam.cornell.edu or mariano@geom.umn.edu)
+
diff --git a/usr.bin/units/definitions.units b/usr.bin/units/definitions.units
new file mode 100644
index 0000000..2ebcf4f
--- /dev/null
+++ b/usr.bin/units/definitions.units
@@ -0,0 +1,908 @@
+# $FreeBSD$
+
+# primitive units
+
+m !a!
+kg !b!
+sec !c!
+coul !d!
+candela !e!
+usdollar !f!
+euro !g!
+bit !h!
+erlang !i!
+K !j!
+
+# prefixes
+
+yotta- 1e24
+zetta- 1e21
+exa- 1e18
+peta- 1e15
+tera- 1e12
+giga- 1e9
+mega- 1e6
+myria- 1e4
+kilo- 1e3
+hecto- 1e2
+deka- 1e1
+deca- deka
+deci- 1e-1
+centi- 1e-2
+milli- 1e-3
+micro- 1e-6
+nano- 1e-9
+pico- 1e-12
+femto- 1e-15
+atto- 1e-18
+zopto- 1e-21
+zepto- zopto
+yocto- 1e-24
+
+quarter- 1|4
+semi- .5
+demi- .5
+hemi- .5
+half- .5
+double- 2
+triple- 3
+
+Y- yotta
+Z- zetta
+E- exa
+P- peta
+T- tera
+G- giga
+M- mega
+k- kilo
+h- hecto
+da- deka
+d- deci
+c- centi
+m- milli
+u- micro
+n- nano
+p- pico
+f- femto
+a- atto
+z- zopto
+y- yocto
+
+# binary prefixes introduced in 1999
+exbi- 1152921504606846976
+pebi- 1125899906842624
+tebi- 1099511627776
+gibi- 1073741824
+mebi- 1048576
+kibi- 1024
+
+Ei- exbi
+Pi- pebi
+Ti- tebi
+Gi- gibi
+Mi- mebi
+Ki- kibi
+
+# constants
+
+fuzz 1
+pi 3.14159265358979323846
+c 2.99792458e+8 m/sec
+g0 9.80665 m/sec2
+g g0
+bigG 6.67428e-11 m3/kg/s2
+AU 1.49597870691e+11 m fuzz
+au AU
+mole 6.0221417930e+23 fuzz
+e 1.6021917e-19 coul fuzz
+energy c2
+force g
+mercury 1.3332239e+5 kg/m2-sec2
+hg mercury
+mmHg 0.001 m hg
+#mu 4.e-7 pi-N/A2
+epsilon 1.0 /mu/c2
+alpha 0.5 mu-c-e2/planck
+planck 6.6260755e-34 joule-sec
+hbar 0.5 planck/pi
+electronmass 9.1093821545-31 kg
+protonmass 1.6726217129-27 kg
+neutronmass 1.6749272928-27 kg
+
+# dimensionless
+
+radian .5 / pi
+degree 1|180 pi-radian
+circle 2 pi-radian
+turn 2 pi-radian
+revolution turn
+rev turn
+grade .9 degree
+arcdeg 1 degree
+arcmin 1|60 arcdeg
+ccs 1|36 erlang
+arcsec 1|60 arcmin
+
+steradian radian2
+sphere 4 pi-steradian
+sr steradian
+
+# Time
+
+second sec
+s sec
+minute 60 sec
+min minute
+hour 60 min
+hr hour
+day 24 hr
+da day
+week 7 day
+year 365.24219879 day fuzz
+yr year
+month 1|12 year
+us microsec
+
+# Mass
+
+gram millikg
+gm gram
+metricton kilokg
+
+# Avoirdupois
+
+lb .45359237 kg
+pound lb
+lbf lb g
+ounce 1|16 lb
+oz ounce
+dram 1|16 oz
+dr dram
+grain 1|7000 lb
+gr grain
+shortton 2000 lb
+ton shortton
+longton 2240 lb
+
+# Apothecary
+
+scruple 20 grain
+apdram 60 grain
+apounce 480 grain
+appound 5760 grain
+troypound appound
+
+# Mining
+
+troyounce apounce
+troz apounce
+pennyweight 1|20 troz
+pwt pennyweight
+dwt pennyweight
+
+# Length
+
+meter m
+micron micrometer
+angstrom decinanometer
+ao 0.25 alpha/pi/rydbergconst
+
+inch 2.54 cm
+in inch
+foot 12 in
+feet foot
+ft foot
+yard 3 ft
+yd yard
+rod 5.5 yd
+rd rod
+mile 5280 ft
+mi mile
+
+british 1200|3937 m/ft
+nmile 1852 m
+
+acre 4840 yd2
+
+cc cm3
+liter kilocc
+ml milliliter
+
+# US Liquid
+
+gallon 231 in3
+imperial 1.20095
+gal gallon
+quart 1|4 gal
+qt quart
+pint 1|2 qt
+pt pint
+
+floz 1|16 pt
+fldr 1|8 floz
+shot 3|2 floz
+
+# US Dry
+
+dry 268.8025 in3/gallon fuzz
+peck 8 dry-quart
+pk peck
+bushel 4 peck
+bu bushel
+chaldron 36 bushel
+
+# British
+
+brgallon 277.420 in3 fuzz
+brquart 1|4 brgallon
+brpint 1|2 brquart
+brfloz 1|20 brpint
+brpeck 554.84 in3 fuzz
+brbushel 4 brpeck
+brhundredweight 112 lb
+
+# Bottles
+
+bottle 750 milliliter
+#bottle fifth
+
+miniature 100 milliliter
+split 1|4 bottle
+half 1|2 bottle
+magnum 2 bottle
+jeroboam 4 bottle
+rehoboam 6 bottle
+methuselah 8 bottle
+salmanazar 12 bottle
+balthazar 16 bottle
+nebuchadnezzar 20 bottle
+sovereign 34 bottle
+
+# Bottles - alternate names and spellings
+
+pony split
+fillette half
+tappit-hen 3 imperial
+rheoboam rehoboam
+shalmaneser salmanazar
+
+# Russian
+berkovets 10 pood
+pood 40 funt
+funt 0.40951 kg
+lot 1|32 funt
+zolotnik 1|3 lot
+dolya 1|96 zolotnik
+rumile 7 verst
+mezhevayaverst 2 verst
+verst 1066.8 m
+sazhen 1|500 verst
+kosayasazhen 1|430.2 verst
+arshin 1|1500 verst
+# is not exactly defined
+ruell 16.54 in
+liniya 1|10 in
+vershok 1.75 in
+pyad 7 in
+vedro 12.3 liter
+shtoff 1|10 vedro
+vinebottle 1|16 vedro
+vodkabottle 1|20 vedro
+charka 1|100 vedro
+shkalik 1|200 vedro
+desyatina_state 109.3 are
+desyatina_farmery 0.75 desyatina_state
+sqverst 104.2 desyatina_state
+sqarshin 1|21600 desyatina_state
+sqfoot 1|117600 desyatina_state
+
+# Energy Work
+
+newton kg-m/sec2
+nt newton
+N newton
+joule nt-m
+J joule
+cal 4.1868 joule
+ergon erg
+
+# Electrical
+
+coulomb coul
+C coul
+ampere coul/sec
+A ampere
+amp ampere
+watt joule/sec
+W watt
+volt watt/amp
+ohm volt/amp
+mho /ohm
+farad coul/volt
+F farad
+henry sec2/farad
+H henry
+weber volt-sec
+Wb weber
+
+# 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.
+austriaschilling 1|13.7603 euro
+belgiumfranc 1|40.3399 euro
+finlandmarkka 1|5.94573 euro
+francefranc 1|6.55957 euro
+germanymark 1|1.95583 euro
+greecedrachma 1|340.750 euro
+irelandpunt 1|0.787564 euro
+italylira 1|1936.27 euro
+luxembourgfranc 1|40.3399 euro
+netherlandsguilder 1|2.20371 euro
+portugalescudo 1|200.482 euro
+spainpeseta 1|166.386 euro
+sloveniantolar 1|239.640 euro
+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.
+bosniaherzegovinamark 1|1.95583 euro
+bulgarianlev 1|1.95583 euro
+capeverdeanescudo 1|110.265 euro
+centralafricancfafranc 1|655.957 euro
+comorosfranc 1|491.96775 euro
+danishkrone 1|7.46038 euro
+estoniakroon 1|15.6466 euro
+lithuanianlitas 1|3.45280 euro
+pacificfrancexchange 1|0.00838 euro
+westafricancfafranc 1|655.957 euro
+
+# ISO Currency Codes
+
+AED uaedirham
+AFN afghanafghani
+ALL albanialek
+AMD armeniadram
+AOA angolakwanza
+ARS argentinapeso
+AUD australiadollar
+AWG arubaflorin
+AZN azerbaijanmanat
+BAM bosniaconvertiblemark
+BBD barbadosdollar
+BDT bangladeshtaka
+BGN bulgarialev
+BHD bahraindinar
+BIF burundifranc
+BMD bermudadollar
+BND bruneidollar
+BOB boliviaboliviano
+BRL brazilreal
+BSD bahamasdollar
+BTN bhutanngultrum
+BWP botswanapula
+BYR belarusruble
+BZD belizedollar
+CAD canadadollar
+CDF drcfranccongolais
+CHF swissfranc
+CLP chilepeso
+CMG sintmaartencaribbeanguilder
+CNY chinayuan
+COP colombiapeso
+CRC costaricacolon
+CUP cubapeso
+CVE capeverdeescudo
+CZK czechkoruna
+DJF djiboutifranc
+DKK denmarkkrona
+DOP dominicanrepublicpeso
+DZD algeriadinar
+EGP egyptpound
+ERN eritreanakfa
+ETB ethiopianbirr
+EUR euro
+FJD fijidollar
+FKP falklandislandspound
+GBP ukpound
+GEL georgialari
+GGP guernseypound
+GHS ghanacedi
+GIP gibraltarpound
+GMD gambiadalasi
+GNF guineafranc
+GTQ guatemalaquetzal
+GYD guyanadollar
+HKD hongkongdollar
+HNL honduraslempira
+HRK croatiakuna
+HTG haitigourde
+HUF hungariaforint
+IDR indonesiarupiah
+ILS israelnewshekel
+IMP manxpound
+INR indiarupee
+IQD iraqdinar
+IRR iranrial
+ISK icelandkrona
+JEP jerseypound
+JMD jamaicadollar
+JOD jordandinar
+JPY japanyen
+KES kenyaschilling
+KGS kyrgyzstansom
+KHR cambodiariel
+KMF comorosfranc
+KPW northkoreawon
+KRW southkoreawon
+KWD kuwaitdinar
+KYD caymanislandsdollar
+KZT kazakhstantenge
+LAK laokip
+LBP lebanonpound
+LKR srilankanrupee
+LRD liberiadollar
+LTL lithuanialita
+LVL latvialat
+LYD libyadinar
+MAD moroccodirham
+MDL moldovaleu
+MGA madagascarariary
+MKD macedoniadenar
+MMK myanmarkyat
+MNT mongoliatugrik
+MOP macaupataca
+MRO mauritaniaouguiya
+MUR mauritiusrupee
+MVR maldiverufiyaa
+MWK malawikwacha
+MXN mexicopeso
+MYR malaysiaringgit
+MZN mozambicanmetical
+NAD namibiadollar
+NGN nigerianaira
+NIO nicaraguacordobaoro
+NOK norwaykrone
+NPR nepalrupee
+NZD newzealanddollar
+OMR omanrial
+PAB panamabalboa
+PEN perunuevosol
+PGK papuanewguineakina
+PHP philippinepeso
+PKR pakistanrupee
+PLN polandzloty
+PYG paraguayguarani
+QAR qatarrial
+RON romanianewlei
+RSD serbiadinar
+RUB russiarouble
+RWF rwandafranc
+SAR saudiarabiariyal
+SBD solomonislandsdollar
+SCR seychellesrupee
+SDG sudanpound
+SEK swedenkrona
+SGD singaporedollar
+SHP sainthelenapound
+SLL sierraleoneleone
+SOS somaliaschilling
+SRD surinamedollar
+STD saotome&principedobra
+SVC elsalvadorcolon
+SYP syriapound
+SZL swazilandlilangeni
+THB thailandbaht
+TJS tajikistansomoni
+TMT turkmenistanmanat
+TND tunisiadinar
+TOP tongapa'anga
+TRY turkeylira
+TTD trinidadandtobagodollar
+TVD tuvaludollar
+TWD taiwandollar
+TZS tanzaniashilling
+UAH ukrainehryvnia
+UGX ugandaschilling
+USD usdollar
+UYU uruguaypeso
+UZS uzbekistansum
+VEF venezuelabolivar
+VND vietnamdong
+VUV vanuatuvatu
+WST samoatala
+XAF centralafricancfafranc
+XCD eastcaribbeandollar
+XDR specialdrawingrights
+XOF westafricanfranc
+XPF cfpfranc
+YER yemenrial
+ZAR southafricarand
+ZMW zambiakwacha
+ZWL zimbabwedollar
+
+# 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
+bahrainidinar 1|0.376 usdollar
+barbadiandollar 1|2 usdollar
+belizedollar 1|2 usdollar
+belarusianruble 1|2135 usdollar
+bermudiandollar 1|1 usdollar
+caymanislandsdollar 1.2 usdollar
+cubanconvertiblepeso 1.08 usdollar
+djiboutianfranc 1|177.721 usdollar
+eastcaribbeandollar 1|2.7 usdollar
+eritreannakfa 1|15 usdollar
+hongkongdollar 1|7.80 usdollar
+macanesepatacas 1|1.03 hongkongdollar
+jordaniandinar 1|0.709 usdollar
+lebanesepound 1|1507.5 usdollar
+maldivianrufiyaa 1|12.8 usdollar
+netherlandsantilleanguilder 1|1.79 usdollar
+omanirial 2.6008 usdollar
+qataririyal 1|3.64 usdollar
+saudiriyal 1|3.75 usdollar
+unitedarabemiratesdirham 1|3.6725 usdollar
+
+bosniamark bosniaherzegovinamark
+cfafranc centralafricancfafranc
+cfpfranc pacificfrancexchange
+drachma greecedrachma
+escudo portugalescudo
+franc francefranc
+guilder netherlandsguilder
+herzegovinamark bosniaherzegovinamark
+hollandguilder netherlandsguilder
+lira italylira
+mark germanymark
+markka finlandmarkka
+peseta spainpeseta
+rand southafricarand
+
+# computer
+
+baud bit/sec
+nibble 4 bit
+nybble nibble
+byte 8 bit
+word 2 byte
+block 512 byte
+kbyte 1024 byte
+megabyte 1024 kbyte
+gigabyte 1024 megabyte
+terabyte 1024 gigabyte
+petabyte 1024 terabyte
+exabyte 1024 petabyte
+zettabyte 1024 exabyte
+yottabyte 1024 zettabyte
+kilobyte kbyte
+meg megabyte
+
+
+# Trivia
+
+% 1|100
+abampere 10 ampere
+admiraltyknot 6080 ft/hr
+apostilb cd/pi-m2
+are 1e+2 m2
+asb apostilb
+arpentcan 27.52 mi
+arpentlin 191.835 ft
+astronomicalunit au
+atmosphere 1.01325e+5 nt/m2
+atm atmosphere
+atomicmassunit 1.66053878283e-27 kg fuzz
+# year 3.15569259747e7 sec fuzz
+amu atomicmassunit
+bag 94 lb
+bakersdozen 13
+bar 1e+5 nt/m2
+barie 1e-1 nt/m2
+barleycorn 1|3 in
+beardsecond 5 nm
+barn 1e-28 m2
+oilbarrel 42 gal
+barrel oilbarrel
+barye 1e-1 nt/m2
+baryl microbar
+bev 1e+9 e-volt
+biot 10 amp
+blondel cd/pi-m2
+boardfoot 144 in3
+bolt 40 yd
+bottommeasure 1|40 in
+britishthermalunit 1.05506e+3 joule fuzz
+btu britishthermalunit
+refrigeration 12000 btu/ton-hour
+buck usdollar
+cable 720 ft
+caliber 1e-2 in
+calorie cal
+carat 205 milligram
+caratgold 1|24
+cent centidollar
+cental 100 lb
+centesimalminute 1e-2 grade
+centesimalsecond 1e-4 grade
+century 100 year
+cfs ft3/sec
+chain 66 ft
+circularinch 1|4 pi-in2
+circularmil 1e-6|4 pi-in2
+clusec 1e-8 mm-hg m3/s
+coomb 4 bu
+cord 128 ft3
+cordfoot cord
+crith 9.06e-2 gm
+cubit 18 in
+cup 1|2 pt
+curie 3.7e+10 /sec
+dalton amu
+decade 10 yr
+dioptre /m
+displacementton 35 ft3
+doppelzentner 100 kg
+dozen 12
+drop .03 cm3
+dyne cm-gm/sec2
+electronvolt e-volt
+ell 45 in
+engineerschain 100 ft
+engineerslink 100|100 ft
+equivalentfootcandle lumen/pi-ft2
+equivalentlux lumen/pi-m2
+equivalentphot cd/pi-cm2
+erg cm2-gm/sec2
+ev e-volt
+faraday 9.6485309e+4 coul
+fathom 6 ft
+fermi 1e-15 m
+fifth 4|5 qt
+fin 5 usdollar
+finger 7|8 in
+firkin 9 gal
+footcandle lumen/ft2
+footlambert cd/pi-ft2
+fortnight 14 da
+franklin 3.33564e-10 coul
+frigorie kilocal
+furlong 220 yd
+galileo 1e-2 m/sec2
+gamma 1e-9 weber/m2
+gauss 1e-4 weber/m2
+G gauss
+geodeticfoot british-ft
+geographicalmile 1852 m
+gilbert 2.5 amp/pi
+gill 1|4 pt
+gross 144
+gunterschain 22 yd
+hand 4 in
+hartree 2 rydberg
+head water
+hectare 1e+4 m2
+hefnercandle .92 cd
+hertz /sec
+Hz hertz
+hogshead 63 gallon
+hd hogshead
+homestead 1|4 mi2
+horsepower 735.50 watt
+donkeypower 250 watt
+hp horsepower
+hubble 1e9 ly
+hyl gm force sec2/m
+hz /sec
+imaginarycubicfoot 1.4 ft3
+jansky 1e-26 W/m2-Hz
+Jy jansky
+karat 1|24
+kayser /cm
+key kg
+kilderkin 18 gal
+knot nmile/hr
+kn knot
+lambert cd/pi-cm2
+Lb lambert
+langley cal/cm2
+last 80 bu
+league 3 mi
+lightyear c-yr
+ly lightyear
+line 1|12 in
+link 66|100 ft
+longhundredweight 112 lb
+longquarter 28 lb
+lusec 1e-6 mm-hg m3/s
+m_earth 5.97223e24 kg
+m_moon 7.34e22 kg
+m_sun 1.98843e30 kg
+mach 331.46 m/sec
+marineleague 3 nmile
+maxwell 1e-8 weber
+Mx maxwell
+metriccarat 200 milligram
+mgd megagal/day
+mh millihenry
+mil 1e-3 in
+millennium 1000 year
+minersinch 1.5 ft3/min
+minim 1|60 fldr
+mo month
+mpg mile/gal
+mph mile/hr
+nail 1|16 yd
+nauticalmile nmile
+nit cd/m2
+noggin 1|8 qt
+nox 1e-3 lux
+oersted 2.5e+2 amp/m/pi
+Oe oersted
+pace 36 in
+pair 2
+palm 3 in
+parasang 3.5 mi
+parsec AU-radian/arcsec
+pascal nt/m2
+Pa pascal
+pc parsec
+percent %
+perch rd
+phot lumen/cm2
+pica 1|6 in
+pieze 1e+3 nt/m2
+pipe 4 barrel
+point 1|72 in
+poise gm/cm-sec
+P poise
+pole rd
+pond 9.80665e-3 nt
+potrzebie 2.263348517438173216473 mm
+poundal ft-lb/sec2
+pdl poundal
+proof 1|200
+psi lb-g/in2
+quarter 9 in
+quartersection 1|4 mi2
+quintal 100 kg
+quire 25
+r_earth 6.378e8 cm
+r_moon 1.738e7 cm
+r_sun 6.9599e10 cm
+rackunit 1.75 in
+rad 100 erg/gm
+ream 500
+registerton 100 ft3
+rem 0.01 J/kg
+rhe 10 m2/nt-sec
+rontgen 2.58e-4 curie/kg
+roentgen rontgen
+rood 1.21e+3 yd
+rope 20 ft
+RU rackunit
+rutherford 1e+6 /sec
+rydbergconst 0.5 elctronmass-c-alpha2/planck
+rydberg rydbergconst-planck-c
+sabin 1 ft2
+sack 3 bu
+score 20
+seam 8 bu
+section mi2
+shed 1e-24 barn
+shippington 40 ft3
+shorthundredweight 100 lb
+shortquarter 25 lb
+siemens /ohm
+sigma microsec
+skein 120 yd
+skot 1e-3 apostilb
+slug lb-g-sec2/ft
+smoot 67 in
+span 9 in
+spat 4 pi sr
+spindle 14400 yd
+square 100 ft2
+stere m3
+sthene 1e+3 nt
+stilb cd/cm2
+sb stilb
+stoke 1e-4 m2/sec
+stone 14 lb
+strike 2 bu
+surveyfoot british-ft
+surveyyard 3 surveyfoot
+surveyorschain 66 ft
+surveyorslink 66|100 ft
+tablespoon 4 fldr
+tbl tablespoon
+tbsp tablespoon
+teaspoon 4|3 fldr
+tesla weber/m2
+T tesla
+therm 1e+5 btu
+thermie 1e+6 cal
+timberfoot ft3
+tnt 4.6e+6 m2/sec2
+tonne 1e+6 gm
+torr mm hg
+township 36 mi2
+tsp teaspoon
+tun 8 barrel
+water gram g / cc
+wey 40 bu
+weymass 252 lb
+Xunit 1.00206e-13 m
+k 1.38047e-16 erg/degC
+
+
+degC 1&+273.15 K
+kelvin K
+brewster 1e-12 m2/newton
+degF 5|9&255.37222222222222222222 K
+degreesrankine 5|9 K
+degrankine degreesrankine
+degreerankine degreesrankine
+degreaumur 10|8&+273.15 K
+gasmark 25|1&250 degF
+Stufe 25|1&125 degC
+drachm 60 grain
+poncelet 100 kg m g / sec
+denier .05|450 gram / m
+tex .001 gram / m
+englishell 45 inch
+scottishell 37.2 inch
+flemishell 27 inch
+V volt
+eV e V
+bohrradius hbar2-C2/8.988e9 N m2-e2-electronmass
+becquerel 1|3.7e10 curie
+fresnel 1e12 hertz
+statcoul 1|2.99792458e9 coul
+statamp 1|2.99792458e9 amp
+statvolt 2.99792458e2 volt
+statcoulomb statcoul
+statampere statamp
+debye 3.33564e-30 coul-m
+pulsatance 2 pi/sec
+rpm rev/minute
+rps rev/sec
+kilohm kiloohm
+megohm megaohm
+siderealyear 365.256360417 day
+siderealday 23.934469444 hour
+siderealhour 1|24 sidereal day
+lunarmonth 29.5305555 day
+synodicmonth lunarmonth
+siderealmonth 27.32152777 day
+tropicalyear year
+solaryear year
+lunaryear 12 lunarmonth
+cran 37.5 brgallon
+kip 1000 lbf
+frenchfoot 16|15 ft
+frenchfeet frenchfoot
+toise 6 frenchfeet
+sievert 8.4 rontgen
+candle 1.02 candela
+militarypace 2.5 feet
+metre meter
+litre liter
+gramme gram
+iudiptheria 62.8 microgram
+iupenicillin .6 microgram
+iuinsulin 41.67 microgram
+cottonyarncount 2520 ft/pound
+linenyarncount 900 ft/pound
+worstedyarncount 1680 ft/pound
+metricyarncount meter/gram
+jewlerspoint 2 milligram
diff --git a/usr.bin/units/tests/Makefile b/usr.bin/units/tests/Makefile
new file mode 100644
index 0000000..5b135f7
--- /dev/null
+++ b/usr.bin/units/tests/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TAP_TESTS_SH= basics_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/units/tests/Makefile.depend b/usr.bin/units/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/units/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
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
new file mode 100644
index 0000000..f76e462
--- /dev/null
+++ b/usr.bin/units/units.1
@@ -0,0 +1,205 @@
+.\" $FreeBSD$
+.Dd July 4, 2014
+.Dt UNITS 1
+.Os
+.Sh NAME
+.Nm units
+.Nd conversion program
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar filename
+.Op Fl H Ar filename
+.Op Fl qvUV
+.Op Ar from-unit to-unit
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width indent
+.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 H Ar filename No , Fl -historyfile Ar filename
+Ignored, for compatibility with GNU units.
+.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 No , Fl -unitsfile
+If the default unit file exists prints its location.
+If not, print
+.Qo
+Units data file not found
+.Qc
+.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
+line.
+The program will not print prompts.
+It will print out the
+result of the single specified conversion.
+.El
+.Sh DESCRIPTION
+The
+.Nm
+program converts quantities expressed in various scales to
+their equivalents in other scales.
+The
+.Nm
+program can only
+handle multiplicative or affine scale changes.
+It works interactively by prompting
+the user for input:
+.Bd -literal
+ You have: meters
+ You want: feet
+ * 3.2808399
+ / 0.3048
+
+ You have: cm^3
+ You want: gallons
+ * 0.00026417205
+ / 3785.4118
+
+ You have: meters/s
+ You want: furlongs/fortnight
+ * 6012.8848
+ / 0.00016630952
+
+ You have: 1|2 inch
+ You want: cm
+ * 1.27
+ / 0.78740157
+
+ You have: 85 degF
+ You want: degC
+ 29.444444
+.Ed
+.Pp
+Powers of units can be specified using the '^' character as shown in
+the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
+Multiplication of units can be specified by using spaces, a dash or
+an asterisk.
+Division of units is indicated by the slash ('/').
+Note that multiplication has a higher precedence than division,
+so 'm/s/s' is the same as 'm/s^2' or 'm/s s'.
+Division of numbers
+must be indicated using the vertical bar ('|').
+To convert half a
+meter, you would write '1|2 meter'.
+If you write '1/2 meter' then the
+units program would interpret that as equivalent to '0.5/meter'.
+If you enter incompatible unit types, the units program will
+print a message indicating that the units are not conformable and
+it will display the reduced form for each unit:
+.Bd -literal
+ You have: ergs/hour
+ You want: fathoms kg^2 / day
+ conformability error
+ 2.7777778e-11 kg m^2 / sec^3
+ 2.1166667e-05 kg^2 m / sec
+.Ed
+.Pp
+The conversion information is read from a units data file.
+The default
+file includes definitions for most familiar units, abbreviations and
+metric prefixes.
+Some constants of nature included are:
+.Pp
+.Bl -column -offset indent -compact "mercury"
+.It "pi ratio of circumference to diameter"
+.It "c speed of light"
+.It "e charge on an electron"
+.It "g acceleration of gravity"
+.It "force same as g"
+.It "mole Avogadro's number"
+.It "water pressure per unit height of water"
+.It "mercury pressure per unit height of mercury"
+.It "au astronomical unit"
+.El
+.Pp
+The unit 'pound' is a unit of mass.
+Compound names are run together
+so 'pound force' is a unit of force.
+The unit 'ounce' is also a unit
+of mass.
+The fluid ounce is 'floz'.
+British units that differ from
+their US counterparts are prefixed with 'br', and currency is prefixed
+with its country name: 'belgiumfranc', 'britainpound'.
+When searching
+for a unit, if the specified string does not appear exactly as a unit
+name, then
+.Nm
+will try to remove a trailing 's' or a
+trailing 'es' and check again for a match.
+.Pp
+To find out what units are available read the standard units file.
+If you want to add your own units you can supply your own file.
+A unit is specified on a single line by
+giving its name and an equivalence.
+Be careful to define
+new units in terms of old ones so that a reduction leads to the
+primitive units which are marked with '!' characters.
+The
+.Nm
+program will not detect infinite loops that could be caused
+by careless unit definitions.
+Comments in the unit definition file
+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.
+If a unit is not found
+even after removing trailing 's' or 'es', then it will be checked
+against the list of prefixes.
+Prefixes will be removed until a legal
+base unit is identified.
+.Pp
+Here is an example of a short units file that defines some basic
+units.
+.Pp
+.Bl -column -offset indent -compact "minute"
+.It "m !a!"
+.It "sec !b!"
+.It "micro- 1e-6"
+.It "minute 60 sec"
+.It "hour 60 min"
+.It "inch 0.0254 m"
+.It "ft 12 inches"
+.It "mile 5280 ft"
+.El
+.Sh FILES
+.Bl -tag -width /usr/share/misc/definitions.units -compact
+.It Pa /usr/share/misc/definitions.units
+the standard units library
+.El
+.Sh AUTHORS
+.An Adrian Mariano Aq Mt adrian@cam.cornell.edu
+.Sh BUGS
+The effect of including a '/' in a prefix is surprising.
+.Pp
+Exponents entered by the user can be only one digit.
+You can work around this by multiplying several terms.
+.Pp
+The user must use | to indicate division of numbers and / to
+indicate division of symbols.
+This distinction should not
+be necessary.
+.Pp
+The program contains various arbitrary limits on the length
+of the units converted and on the length of the data file.
+.Pp
+The program should use a hash table to store units so that
+it does not take so long to load the units list and check
+for duplication.
diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c
new file mode 100644
index 0000000..b40b653
--- /dev/null
+++ b/usr.bin/units/units.c
@@ -0,0 +1,886 @@
+/*
+ * units.c Copyright (c) 1993 by Adrian Mariano (adrian@cam.cornell.edu)
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * Disclaimer: This software is provided by the author "as is". The author
+ * shall not be liable for any damages caused in any way by this software.
+ *
+ * I would appreciate (though I do not require) receiving a copy of any
+ * improvements you might make to this program.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <histedit.h>
+#include <getopt.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/capsicum.h>
+
+#ifndef UNITSFILE
+#define UNITSFILE "/usr/share/misc/definitions.units"
+#endif
+
+#define MAXUNITS 1000
+#define MAXPREFIXES 100
+
+#define MAXSUBUNITS 500
+
+#define PRIMITIVECHAR '!'
+
+static const char *powerstring = "^";
+static const char *numfmt = "%.8g";
+
+static struct {
+ char *uname;
+ char *uval;
+} unittable[MAXUNITS];
+
+struct unittype {
+ char *numerator[MAXSUBUNITS];
+ char *denominator[MAXSUBUNITS];
+ double factor;
+ double offset;
+ int quantity;
+};
+
+static struct {
+ char *prefixname;
+ char *prefixval;
+} prefixtable[MAXPREFIXES];
+
+
+static char NULLUNIT[] = "";
+
+#define SEPARATOR ":"
+
+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);
+static int compare(const void *item1, const void *item2);
+static int compareproducts(char **one, char **two);
+static int compareunits(struct unittype * first, struct unittype * second);
+static int completereduce(struct unittype * unit);
+static char *dupstr(const char *str);
+static void initializeunit(struct unittype * theunit);
+static char *lookupunit(const char *unit);
+static void readunits(const char *userfile);
+static int reduceproduct(struct unittype * theunit, int flip);
+static int reduceunit(struct unittype * theunit);
+static void showanswer(struct unittype * have, struct unittype * want);
+static void showunit(struct unittype * theunit);
+static void sortunit(struct unittype * theunit);
+static void usage(void);
+static void zeroerror(void);
+
+static const char* promptstr = "";
+
+static const char * prompt(EditLine *e __unused) {
+ return promptstr;
+}
+
+static char *
+dupstr(const char *str)
+{
+ char *ret;
+
+ ret = strdup(str);
+ if (!ret)
+ err(3, "dupstr");
+ return (ret);
+}
+
+
+static void
+readunits(const char *userfile)
+{
+ FILE *unitfile;
+ char line[512], *lineptr;
+ int len, linenum, i;
+ cap_rights_t unitfilerights;
+
+ unitcount = 0;
+ linenum = 0;
+
+ if (userfile) {
+ unitfile = fopen(userfile, "r");
+ if (!unitfile)
+ errx(1, "unable to open units file '%s'", userfile);
+ }
+ else {
+ unitfile = fopen(UNITSFILE, "r");
+ if (!unitfile) {
+ char *direc, *env;
+ char filename[1000];
+
+ env = getenv("PATH");
+ if (env) {
+ direc = strtok(env, SEPARATOR);
+ while (direc) {
+ snprintf(filename, sizeof(filename),
+ "%s/%s", direc, UNITSFILE);
+ unitfile = fopen(filename, "rt");
+ if (unitfile)
+ break;
+ direc = strtok(NULL, SEPARATOR);
+ }
+ }
+ if (!unitfile)
+ errx(1, "can't find units file '%s'", UNITSFILE);
+ }
+ }
+ cap_rights_init(&unitfilerights, CAP_READ, CAP_FSTAT);
+ if (cap_rights_limit(fileno(unitfile), &unitfilerights) < 0
+ && errno != ENOSYS)
+ err(1, "cap_rights_limit() failed");
+ while (!feof(unitfile)) {
+ if (!fgets(line, sizeof(line), unitfile))
+ break;
+ linenum++;
+ lineptr = line;
+ if (*lineptr == '/' || *lineptr == '#')
+ continue;
+ lineptr += strspn(lineptr, " \n\t");
+ len = strcspn(lineptr, " \n\t");
+ lineptr[len] = 0;
+ if (!strlen(lineptr))
+ continue;
+ if (lineptr[strlen(lineptr) - 1] == '-') { /* it's a prefix */
+ if (prefixcount == MAXPREFIXES) {
+ warnx("memory for prefixes exceeded in line %d", linenum);
+ continue;
+ }
+ lineptr[strlen(lineptr) - 1] = 0;
+ prefixtable[prefixcount].prefixname = dupstr(lineptr);
+ for (i = 0; i < prefixcount; i++)
+ if (!strcmp(prefixtable[i].prefixname, lineptr)) {
+ warnx("redefinition of prefix '%s' on line %d ignored",
+ lineptr, linenum);
+ continue;
+ }
+ lineptr += len + 1;
+ lineptr += strspn(lineptr, " \n\t");
+ len = strcspn(lineptr, "\n\t");
+ if (len == 0) {
+ warnx("unexpected end of prefix on line %d",
+ linenum);
+ continue;
+ }
+ lineptr[len] = 0;
+ prefixtable[prefixcount++].prefixval = dupstr(lineptr);
+ }
+ else { /* it's not a prefix */
+ if (unitcount == MAXUNITS) {
+ warnx("memory for units exceeded in line %d", linenum);
+ continue;
+ }
+ unittable[unitcount].uname = dupstr(lineptr);
+ for (i = 0; i < unitcount; i++)
+ if (!strcmp(unittable[i].uname, lineptr)) {
+ warnx("redefinition of unit '%s' on line %d ignored",
+ lineptr, linenum);
+ continue;
+ }
+ lineptr += len + 1;
+ lineptr += strspn(lineptr, " \n\t");
+ if (!strlen(lineptr)) {
+ warnx("unexpected end of unit on line %d",
+ linenum);
+ continue;
+ }
+ len = strcspn(lineptr, "\n\t");
+ lineptr[len] = 0;
+ unittable[unitcount++].uval = dupstr(lineptr);
+ }
+ }
+ fclose(unitfile);
+}
+
+static void
+initializeunit(struct unittype * theunit)
+{
+ theunit->numerator[0] = theunit->denominator[0] = NULL;
+ theunit->factor = 1.0;
+ theunit->offset = 0.0;
+ theunit->quantity = 0;
+}
+
+
+static int
+addsubunit(char *product[], char *toadd)
+{
+ char **ptr;
+
+ for (ptr = product; *ptr && *ptr != NULLUNIT; ptr++);
+ if (ptr >= product + MAXSUBUNITS) {
+ warnx("memory overflow in unit reduction");
+ return 1;
+ }
+ if (!*ptr)
+ *(ptr + 1) = NULL;
+ *ptr = dupstr(toadd);
+ return 0;
+}
+
+
+static void
+showunit(struct unittype * theunit)
+{
+ char **ptr;
+ int printedslash;
+ int counter = 1;
+
+ printf(numfmt, theunit->factor);
+ if (theunit->offset)
+ printf("&%.8g", theunit->offset);
+ for (ptr = theunit->numerator; *ptr; ptr++) {
+ if (ptr > theunit->numerator && **ptr &&
+ !strcmp(*ptr, *(ptr - 1)))
+ counter++;
+ else {
+ if (counter > 1)
+ printf("%s%d", powerstring, counter);
+ if (**ptr)
+ printf(" %s", *ptr);
+ counter = 1;
+ }
+ }
+ if (counter > 1)
+ printf("%s%d", powerstring, counter);
+ counter = 1;
+ printedslash = 0;
+ for (ptr = theunit->denominator; *ptr; ptr++) {
+ if (ptr > theunit->denominator && **ptr &&
+ !strcmp(*ptr, *(ptr - 1)))
+ counter++;
+ else {
+ if (counter > 1)
+ printf("%s%d", powerstring, counter);
+ if (**ptr) {
+ if (!printedslash)
+ printf(" /");
+ printedslash = 1;
+ printf(" %s", *ptr);
+ }
+ counter = 1;
+ }
+ }
+ if (counter > 1)
+ printf("%s%d", powerstring, counter);
+ printf("\n");
+}
+
+
+void
+zeroerror(void)
+{
+ warnx("unit reduces to zero");
+}
+
+/*
+ Adds the specified string to the unit.
+ Flip is 0 for adding normally, 1 for adding reciprocal.
+ Quantity is 1 if this is a quantity to be converted rather than a pure unit.
+
+ Returns 0 for successful addition, nonzero on error.
+*/
+
+static int
+addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
+{
+ char *scratch, *savescr;
+ char *item;
+ char *divider, *slash, *offset;
+ int doingtop;
+
+ if (!strlen(toadd))
+ return 1;
+
+ savescr = scratch = dupstr(toadd);
+ for (slash = scratch + 1; *slash; slash++)
+ if (*slash == '-' &&
+ (tolower(*(slash - 1)) != 'e' ||
+ !strchr(".0123456789", *(slash + 1))))
+ *slash = ' ';
+ slash = strchr(scratch, '/');
+ if (slash)
+ *slash = 0;
+ doingtop = 1;
+ do {
+ item = strtok(scratch, " *\t\n/");
+ while (item) {
+ if (strchr("0123456789.", *item)) { /* item is a number */
+ double num, offsetnum;
+
+ if (quantity)
+ theunit->quantity = 1;
+
+ offset = strchr(item, '&');
+ if (offset) {
+ *offset = 0;
+ offsetnum = atof(offset+1);
+ } else
+ offsetnum = 0.0;
+
+ divider = strchr(item, '|');
+ if (divider) {
+ *divider = 0;
+ num = atof(item);
+ if (!num) {
+ zeroerror();
+ return 1;
+ }
+ if (doingtop ^ flip) {
+ theunit->factor *= num;
+ theunit->offset *= num;
+ } else {
+ theunit->factor /= num;
+ theunit->offset /= num;
+ }
+ num = atof(divider + 1);
+ if (!num) {
+ zeroerror();
+ return 1;
+ }
+ if (doingtop ^ flip) {
+ theunit->factor /= num;
+ theunit->offset /= num;
+ } else {
+ theunit->factor *= num;
+ theunit->offset *= num;
+ }
+ }
+ else {
+ num = atof(item);
+ if (!num) {
+ zeroerror();
+ return 1;
+ }
+ if (doingtop ^ flip) {
+ theunit->factor *= num;
+ theunit->offset *= num;
+ } else {
+ theunit->factor /= num;
+ theunit->offset /= num;
+ }
+ }
+ if (doingtop ^ flip)
+ theunit->offset += offsetnum;
+ }
+ else { /* item is not a number */
+ int repeat = 1;
+
+ if (strchr("23456789",
+ item[strlen(item) - 1])) {
+ repeat = item[strlen(item) - 1] - '0';
+ item[strlen(item) - 1] = 0;
+ }
+ for (; repeat; repeat--)
+ if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item))
+ return 1;
+ }
+ item = strtok(NULL, " *\t/\n");
+ }
+ doingtop--;
+ if (slash) {
+ scratch = slash + 1;
+ }
+ else
+ doingtop--;
+ } while (doingtop >= 0);
+ free(savescr);
+ return 0;
+}
+
+
+static int
+compare(const void *item1, const void *item2)
+{
+ return strcmp(*(const char * const *)item1, *(const char * const *)item2);
+}
+
+
+static void
+sortunit(struct unittype * theunit)
+{
+ char **ptr;
+ unsigned int count;
+
+ for (count = 0, ptr = theunit->numerator; *ptr; ptr++, count++);
+ qsort(theunit->numerator, count, sizeof(char *), compare);
+ for (count = 0, ptr = theunit->denominator; *ptr; ptr++, count++);
+ qsort(theunit->denominator, count, sizeof(char *), compare);
+}
+
+
+void
+cancelunit(struct unittype * theunit)
+{
+ char **den, **num;
+ int comp;
+
+ den = theunit->denominator;
+ num = theunit->numerator;
+
+ while (*num && *den) {
+ comp = strcmp(*den, *num);
+ if (!comp) {
+/* if (*den!=NULLUNIT) free(*den);
+ if (*num!=NULLUNIT) free(*num);*/
+ *den++ = NULLUNIT;
+ *num++ = NULLUNIT;
+ }
+ else if (comp < 0)
+ den++;
+ else
+ num++;
+ }
+}
+
+
+
+
+/*
+ Looks up the definition for the specified unit.
+ Returns a pointer to the definition or a null pointer
+ if the specified unit does not appear in the units table.
+*/
+
+static char buffer[100]; /* buffer for lookupunit answers with
+ prefixes */
+
+char *
+lookupunit(const char *unit)
+{
+ int i;
+ char *copy;
+
+ for (i = 0; i < unitcount; i++) {
+ if (!strcmp(unittable[i].uname, unit))
+ return unittable[i].uval;
+ }
+
+ if (unit[strlen(unit) - 1] == '^') {
+ copy = dupstr(unit);
+ copy[strlen(copy) - 1] = 0;
+ for (i = 0; i < unitcount; i++) {
+ if (!strcmp(unittable[i].uname, copy)) {
+ strlcpy(buffer, copy, sizeof(buffer));
+ free(copy);
+ return buffer;
+ }
+ }
+ free(copy);
+ }
+ if (unit[strlen(unit) - 1] == 's') {
+ copy = dupstr(unit);
+ copy[strlen(copy) - 1] = 0;
+ for (i = 0; i < unitcount; i++) {
+ if (!strcmp(unittable[i].uname, copy)) {
+ strlcpy(buffer, copy, sizeof(buffer));
+ free(copy);
+ return buffer;
+ }
+ }
+ if (copy[strlen(copy) - 1] == 'e') {
+ copy[strlen(copy) - 1] = 0;
+ for (i = 0; i < unitcount; i++) {
+ if (!strcmp(unittable[i].uname, copy)) {
+ strlcpy(buffer, copy, sizeof(buffer));
+ free(copy);
+ return buffer;
+ }
+ }
+ }
+ free(copy);
+ }
+ for (i = 0; i < prefixcount; i++) {
+ size_t len = strlen(prefixtable[i].prefixname);
+ if (!strncmp(prefixtable[i].prefixname, unit, len)) {
+ if (!strlen(unit + len) || lookupunit(unit + len)) {
+ snprintf(buffer, sizeof(buffer), "%s %s",
+ prefixtable[i].prefixval, unit + len);
+ return buffer;
+ }
+ }
+ }
+ return 0;
+}
+
+
+
+/*
+ reduces a product of symbolic units to primitive units.
+ The three low bits are used to return flags:
+
+ bit 0 (1) set on if reductions were performed without error.
+ bit 1 (2) set on if no reductions are performed.
+ bit 2 (4) set on if an unknown unit is discovered.
+*/
+
+
+#define ERROR 4
+
+static int
+reduceproduct(struct unittype * theunit, int flip)
+{
+
+ char *toadd;
+ char **product;
+ int didsomething = 2;
+
+ if (flip)
+ product = theunit->denominator;
+ else
+ product = theunit->numerator;
+
+ for (; *product; product++) {
+
+ for (;;) {
+ if (!strlen(*product))
+ break;
+ toadd = lookupunit(*product);
+ if (!toadd) {
+ printf("unknown unit '%s'\n", *product);
+ return ERROR;
+ }
+ if (strchr(toadd, PRIMITIVECHAR))
+ break;
+ didsomething = 1;
+ if (*product != NULLUNIT) {
+ free(*product);
+ *product = NULLUNIT;
+ }
+ if (addunit(theunit, toadd, flip, 0))
+ return ERROR;
+ }
+ }
+ return didsomething;
+}
+
+
+/*
+ Reduces numerator and denominator of the specified unit.
+ Returns 0 on success, or 1 on unknown unit error.
+*/
+
+static int
+reduceunit(struct unittype * theunit)
+{
+ int ret;
+
+ ret = 1;
+ while (ret & 1) {
+ ret = reduceproduct(theunit, 0) | reduceproduct(theunit, 1);
+ if (ret & 4)
+ return 1;
+ }
+ return 0;
+}
+
+
+static int
+compareproducts(char **one, char **two)
+{
+ while (*one || *two) {
+ if (!*one && *two != NULLUNIT)
+ return 1;
+ if (!*two && *one != NULLUNIT)
+ return 1;
+ if (*one == NULLUNIT)
+ one++;
+ else if (*two == NULLUNIT)
+ two++;
+ else if (strcmp(*one, *two))
+ return 1;
+ else
+ one++, two++;
+ }
+ return 0;
+}
+
+
+/* Return zero if units are compatible, nonzero otherwise */
+
+static int
+compareunits(struct unittype * first, struct unittype * second)
+{
+ return
+ compareproducts(first->numerator, second->numerator) ||
+ compareproducts(first->denominator, second->denominator);
+}
+
+
+static int
+completereduce(struct unittype * unit)
+{
+ if (reduceunit(unit))
+ return 1;
+ sortunit(unit);
+ cancelunit(unit);
+ return 0;
+}
+
+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 if (!terse)
+ printf("\t");
+ showunit(have);
+ 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) {
+ asprintf(&oformat, "\t%s\n", outputformat);
+ printf(oformat,
+ (have->factor + have->offset-want->offset)/want->factor);
+ free(oformat);
+ }
+ else {
+ 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,
+ (want->offset - have->offset)/have->factor);
+ }
+ }
+ else {
+ ans = have->factor / want->factor;
+
+ 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");
+ }
+ }
+}
+
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: units [-f unitsfile] [-H historyfile] [-UVq] [from-unit to-unit]\n");
+ exit(3);
+}
+
+static struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"exponential", no_argument, NULL, 'e'},
+ {"file", required_argument, NULL, 'f'},
+ {"history", required_argument, NULL, 'H'},
+ {"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)
+{
+
+ struct unittype have, want;
+ int optchar;
+ bool quiet;
+ bool readfile;
+ bool quit;
+ History *inhistory;
+ EditLine *el;
+ HistEvent ev;
+ int inputsz;
+ char const * history_file;
+
+ quiet = false;
+ readfile = false;
+ history_file = NULL;
+ outputformat = numfmt;
+ quit = false;
+ while ((optchar = getopt_long(argc, argv, "+ehf:oqtvHUV", longopts, NULL)) != -1) {
+ switch (optchar) {
+ case 'e':
+ outputformat = "%6e";
+ break;
+ case 'f':
+ readfile = true;
+ if (strlen(optarg) == 0)
+ readunits(NULL);
+ else
+ readunits(optarg);
+ break;
+ case 'H':
+ history_file = optarg;
+ break;
+ 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);
+ else
+ printf("Units data file not found");
+ exit(0);
+ break;
+ case 'h':
+ /* FALLTHROUGH */
+
+ default:
+ usage();
+ }
+ }
+
+ if (!readfile)
+ readunits(NULL);
+
+ if (optind == argc - 2) {
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
+ havestr = argv[optind];
+ wantstr = argv[optind + 1];
+ initializeunit(&have);
+ addunit(&have, havestr, 0, 1);
+ completereduce(&have);
+ initializeunit(&want);
+ addunit(&want, wantstr, 0, 1);
+ completereduce(&want);
+ showanswer(&have, &want);
+ } else {
+ inhistory = history_init();
+ el = el_init(argv[0], stdin, stdout, stderr);
+ el_set(el, EL_PROMPT, &prompt);
+ el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_SIGNAL, 1);
+ el_set(el, EL_HIST, history, inhistory);
+ el_source(el, NULL);
+ history(inhistory, &ev, H_SETSIZE, 800);
+ if (inhistory == 0)
+ err(1, "Could not initialize history");
+
+ if (cap_enter() < 0 && errno != ENOSYS)
+ err(1, "unable to enter capability mode");
+
+ if (!quiet)
+ printf("%d units, %d prefixes\n", unitcount,
+ prefixcount);
+ while (!quit) {
+ do {
+ initializeunit(&have);
+ if (!quiet)
+ promptstr = "You have: ";
+ havestr = el_gets(el, &inputsz);
+ if (havestr == NULL) {
+ quit = true;
+ break;
+ }
+ if (inputsz > 0)
+ history(inhistory, &ev, H_ENTER,
+ havestr);
+ } while (addunit(&have, havestr, 0, 1) ||
+ completereduce(&have));
+ if (quit) {
+ break;
+ }
+ do {
+ initializeunit(&want);
+ if (!quiet)
+ promptstr = "You want: ";
+ wantstr = el_gets(el, &inputsz);
+ if (wantstr == NULL) {
+ quit = true;
+ break;
+ }
+ if (inputsz > 0)
+ history(inhistory, &ev, H_ENTER,
+ wantstr);
+ } while (addunit(&want, wantstr, 0, 1) ||
+ completereduce(&want));
+ if (quit) {
+ break;
+ }
+ showanswer(&have, &want);
+ }
+
+ history_end(inhistory);
+ el_end(el);
+ }
+
+ return (0);
+}
diff --git a/usr.bin/unvis/Makefile b/usr.bin/unvis/Makefile
new file mode 100644
index 0000000..59528ef
--- /dev/null
+++ b/usr.bin/unvis/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= unvis
+
+.PATH: ${.CURDIR}/../../contrib/unvis
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/unvis/Makefile.depend b/usr.bin/unvis/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/unvis/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/unzip/Makefile b/usr.bin/unzip/Makefile
new file mode 100644
index 0000000..9ed1a95
--- /dev/null
+++ b/usr.bin/unzip/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG = unzip
+CSTD = c99
+LIBADD= archive
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/unzip/Makefile.depend b/usr.bin/unzip/Makefile.depend
new file mode 100644
index 0000000..4e7906b
--- /dev/null
+++ b/usr.bin/unzip/Makefile.depend
@@ -0,0 +1,25 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libarchive \
+ lib/libbz2 \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/liblzma \
+ lib/libthr \
+ lib/libz \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1
new file mode 100644
index 0000000..780321c
--- /dev/null
+++ b/usr.bin/unzip/unzip.1
@@ -0,0 +1,191 @@
+.\"-
+.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
+.\" 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 December 12, 2015
+.Dt UNZIP 1
+.Os
+.Sh NAME
+.Nm unzip
+.Nd extract files from a ZIP archive
+.Sh SYNOPSIS
+.Nm
+.Op Fl aCcfjLlnopqtuvy
+.Op Fl d Ar dir
+.Ar zipfile
+.Sh DESCRIPTION
+.\" ...
+The following options are available:
+.Bl -tag -width Fl
+.It Fl a
+When extracting a text file, convert DOS-style line endings to
+Unix-style line endings.
+.It Fl C
+Match file names case-insensitively.
+.It Fl c
+Extract to stdout/screen.
+When extracting files from the zipfile, they are written to stdout.
+This is similar to
+.Fl p ,
+but does not suppress normal output.
+.It Fl d Ar dir
+Extract files into the specified directory rather than the current
+directory.
+.It Fl f
+Update existing.
+Extract only files from the zipfile if a file with the same name
+already exists on disk and is older than the former.
+Otherwise, the file is silently skipped.
+.It Fl j
+Ignore directories stored in the zipfile; instead, extract all files
+directly into the extraction directory.
+.It Fl L
+Convert the names of the extracted files and directories to lowercase.
+.It Fl l
+List, rather than extract, the contents of the zipfile.
+.It Fl n
+No overwrite.
+When extracting a file from the zipfile, if a file with the same name
+already exists on disk, the file is silently skipped.
+.It Fl o
+Overwrite.
+When extracting a file from the zipfile, if a file with the same name
+already exists on disk, the existing file is replaced with the file
+from the zipfile.
+.It Fl p
+Extract to stdout.
+When extracting files from the zipfile, they are written to stdout.
+The normal output is suppressed as if
+.Fl q
+was specified.
+.It Fl q
+Quiet: print less information while extracting.
+.It Fl t
+Test: do not extract anything, but verify the checksum of every file
+in the archive.
+.It Fl u
+Update.
+When extracting a file from the zipfile, if a file with the same name
+already exists on disk, the existing file is replaced with the file
+from the zipfile if and only if the latter is newer than the former.
+Otherwise, the file is silently skipped.
+.It Fl v
+List verbosely, rather than extract, the contents of the zipfile.
+This differs from
+.Fl l
+by using the long listing.
+Note that most of the data is currently fake and does not reflect the
+content of the archive.
+.It Fl x Ar pattern
+Exclude files matching the pattern
+.Ar pattern .
+.It Fl y
+Print four digit years in listings instead of two.
+.It Fl Z Ar mode
+Emulate
+.Xr zipinfo 1L
+mode.
+Enabling
+.Xr zipinfo 1L
+mode changes the way in which additional arguments are parsed.
+Currently only
+.Xr zipinfo 1L
+mode 1 is supported, which lists the file names one per line.
+.El
+.Pp
+Note that only one of
+.Fl n ,
+.Fl o ,
+and
+.Fl u
+may be specified.
+If specified filename is
+.Qq - ,
+then data is read from
+.Va stdin .
+.Sh ENVIRONMENT
+If the
+.Ev UNZIP_DEBUG
+environment variable is defined, the
+.Fl q
+command-line option has no effect, and additional debugging
+information will be printed to
+.Va stderr .
+.Sh COMPATIBILITY
+The
+.Nm
+utility aims to be sufficiently compatible with other implementations
+to serve as a drop-in replacement in the context of the
+.Xr ports 7
+system.
+No attempt has been made to replicate functionality which is not
+required for that purpose.
+.Pp
+For compatibility reasons, command-line options will be recognized if
+they are listed not only before but also after the name of the
+zipfile.
+.Pp
+Normally, the
+.Fl a
+option should only affect files which are marked as text files in the
+zipfile's central directory.
+Since the
+.Xr archive 3
+library does not provide access to that information, it is not available
+to the
+.Nm
+utility.
+Instead, the
+.Nm
+utility will assume that a file is a text file if no non-ASCII
+characters are present within the first block of data decompressed for
+that file.
+If non-ASCII characters appear in subsequent blocks of data, a warning
+will be issued.
+.Pp
+The
+.Nm
+utility is only able to process ZIP archives handled by
+.Xr libarchive 3 .
+Depending on the installed version of
+.Xr libarchive ,
+this may or may not include self-extracting archives.
+.Sh SEE ALSO
+.Xr libarchive 3
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+The
+.Nm
+utility and this manual page were written by
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
+It uses the
+.Xr archive 3
+library developed by
+.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c
new file mode 100644
index 0000000..fb123db
--- /dev/null
+++ b/usr.bin/unzip/unzip.c
@@ -0,0 +1,1064 @@
+/*-
+ * Copyright (c) 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
+ * Copyright (c) 2007-2008 Dag-Erling Smørgrav
+ * 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 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$
+ *
+ * This file would be much shorter if we didn't care about command-line
+ * compatibility with Info-ZIP's UnZip, which requires us to duplicate
+ * parts of libarchive in order to gain more detailed control of its
+ * behaviour for the purpose of implementing the -n, -o, -L and -a
+ * options.
+ */
+
+#include <sys/queue.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+
+/* command-line options */
+static int a_opt; /* convert EOL */
+static int C_opt; /* match case-insensitively */
+static int c_opt; /* extract to stdout */
+static const char *d_arg; /* directory */
+static int f_opt; /* update existing files only */
+static int j_opt; /* junk directories */
+static int L_opt; /* lowercase names */
+static int n_opt; /* never overwrite */
+static int o_opt; /* always overwrite */
+static int p_opt; /* extract to stdout, quiet */
+static int q_opt; /* quiet */
+static int t_opt; /* test */
+static int u_opt; /* update */
+static int v_opt; /* verbose/list */
+static const char *y_str = ""; /* 4 digit year */
+static int Z1_opt; /* zipinfo mode list files only */
+
+/* debug flag */
+static int unzip_debug;
+
+/* zipinfo mode */
+static int zipinfo_mode;
+
+/* running on tty? */
+static int tty;
+
+/* convenience macro */
+/* XXX should differentiate between ARCHIVE_{WARN,FAIL,RETRY} */
+#define ac(call) \
+ do { \
+ int acret = (call); \
+ if (acret != ARCHIVE_OK) \
+ errorx("%s", archive_error_string(a)); \
+ } while (0)
+
+/*
+ * Indicates that last info() did not end with EOL. This helps error() et
+ * al. avoid printing an error message on the same line as an incomplete
+ * informational message.
+ */
+static int noeol;
+
+/* fatal error message + errno */
+static void
+error(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (noeol)
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ fprintf(stderr, "unzip: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, ": %s\n", strerror(errno));
+ exit(1);
+}
+
+/* fatal error message, no errno */
+static void
+errorx(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (noeol)
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ fprintf(stderr, "unzip: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+ exit(1);
+}
+
+/* non-fatal error message + errno */
+static void
+warning(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (noeol)
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ fprintf(stderr, "unzip: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, ": %s\n", strerror(errno));
+}
+
+/* non-fatal error message, no errno */
+static void
+warningx(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (noeol)
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ fprintf(stderr, "unzip: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+}
+
+/* informational message (if not -q) */
+static void
+info(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (q_opt && !unzip_debug)
+ return;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+ fflush(stdout);
+
+ if (*fmt == '\0')
+ noeol = 1;
+ else
+ noeol = fmt[strlen(fmt) - 1] != '\n';
+}
+
+/* debug message (if unzip_debug) */
+static void
+debug(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!unzip_debug)
+ return;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fflush(stderr);
+
+ if (*fmt == '\0')
+ noeol = 1;
+ else
+ noeol = fmt[strlen(fmt) - 1] != '\n';
+}
+
+/* duplicate a path name, possibly converting to lower case */
+static char *
+pathdup(const char *path)
+{
+ char *str;
+ size_t i, len;
+
+ len = strlen(path);
+ while (len && path[len - 1] == '/')
+ len--;
+ if ((str = malloc(len + 1)) == NULL) {
+ errno = ENOMEM;
+ error("malloc()");
+ }
+ if (L_opt) {
+ for (i = 0; i < len; ++i)
+ str[i] = tolower((unsigned char)path[i]);
+ } else {
+ memcpy(str, path, len);
+ }
+ str[len] = '\0';
+
+ return (str);
+}
+
+/* concatenate two path names */
+static char *
+pathcat(const char *prefix, const char *path)
+{
+ char *str;
+ size_t prelen, len;
+
+ prelen = prefix ? strlen(prefix) + 1 : 0;
+ len = strlen(path) + 1;
+ if ((str = malloc(prelen + len)) == NULL) {
+ errno = ENOMEM;
+ error("malloc()");
+ }
+ if (prefix) {
+ memcpy(str, prefix, prelen); /* includes zero */
+ str[prelen - 1] = '/'; /* splat zero */
+ }
+ memcpy(str + prelen, path, len); /* includes zero */
+
+ return (str);
+}
+
+/*
+ * Pattern lists for include / exclude processing
+ */
+struct pattern {
+ STAILQ_ENTRY(pattern) link;
+ char pattern[];
+};
+
+STAILQ_HEAD(pattern_list, pattern);
+static struct pattern_list include = STAILQ_HEAD_INITIALIZER(include);
+static struct pattern_list exclude = STAILQ_HEAD_INITIALIZER(exclude);
+
+/*
+ * Add an entry to a pattern list
+ */
+static void
+add_pattern(struct pattern_list *list, const char *pattern)
+{
+ struct pattern *entry;
+ size_t len;
+
+ debug("adding pattern '%s'\n", pattern);
+ len = strlen(pattern);
+ if ((entry = malloc(sizeof *entry + len + 1)) == NULL) {
+ errno = ENOMEM;
+ error("malloc()");
+ }
+ memcpy(entry->pattern, pattern, len + 1);
+ STAILQ_INSERT_TAIL(list, entry, link);
+}
+
+/*
+ * Match a string against a list of patterns
+ */
+static int
+match_pattern(struct pattern_list *list, const char *str)
+{
+ struct pattern *entry;
+
+ STAILQ_FOREACH(entry, list, link) {
+ if (fnmatch(entry->pattern, str, C_opt ? FNM_CASEFOLD : 0) == 0)
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * Verify that a given pathname is in the include list and not in the
+ * exclude list.
+ */
+static int
+accept_pathname(const char *pathname)
+{
+
+ if (!STAILQ_EMPTY(&include) && !match_pattern(&include, pathname))
+ return (0);
+ if (!STAILQ_EMPTY(&exclude) && match_pattern(&exclude, pathname))
+ return (0);
+ return (1);
+}
+
+/*
+ * Create the specified directory with the specified mode, taking certain
+ * precautions on they way.
+ */
+static void
+make_dir(const char *path, int mode)
+{
+ struct stat sb;
+
+ if (lstat(path, &sb) == 0) {
+ if (S_ISDIR(sb.st_mode))
+ return;
+ /*
+ * Normally, we should either ask the user about removing
+ * the non-directory of the same name as a directory we
+ * wish to create, or respect the -n or -o command-line
+ * options. However, this may lead to a later failure or
+ * even compromise (if this non-directory happens to be a
+ * symlink to somewhere unsafe), so we don't.
+ */
+
+ /*
+ * Don't check unlink() result; failure will cause mkdir()
+ * to fail later, which we will catch.
+ */
+ (void)unlink(path);
+ }
+ if (mkdir(path, mode) != 0 && errno != EEXIST)
+ error("mkdir('%s')", path);
+}
+
+/*
+ * Ensure that all directories leading up to (but not including) the
+ * specified path exist.
+ *
+ * XXX inefficient + modifies the file in-place
+ */
+static void
+make_parent(char *path)
+{
+ struct stat sb;
+ char *sep;
+
+ sep = strrchr(path, '/');
+ if (sep == NULL || sep == path)
+ return;
+ *sep = '\0';
+ if (lstat(path, &sb) == 0) {
+ if (S_ISDIR(sb.st_mode)) {
+ *sep = '/';
+ return;
+ }
+ unlink(path);
+ }
+ make_parent(path);
+ mkdir(path, 0755);
+ *sep = '/';
+
+#if 0
+ for (sep = path; (sep = strchr(sep, '/')) != NULL; sep++) {
+ /* root in case of absolute d_arg */
+ if (sep == path)
+ continue;
+ *sep = '\0';
+ make_dir(path, 0755);
+ *sep = '/';
+ }
+#endif
+}
+
+/*
+ * Extract a directory.
+ */
+static void
+extract_dir(struct archive *a, struct archive_entry *e, const char *path)
+{
+ int mode;
+
+ mode = archive_entry_mode(e) & 0777;
+ if (mode == 0)
+ mode = 0755;
+
+ /*
+ * Some zipfiles contain directories with weird permissions such
+ * as 0644 or 0444. This can cause strange issues such as being
+ * unable to extract files into the directory we just created, or
+ * the user being unable to remove the directory later without
+ * first manually changing its permissions. Therefore, we whack
+ * the permissions into shape, assuming that the user wants full
+ * access and that anyone who gets read access also gets execute
+ * access.
+ */
+ mode |= 0700;
+ if (mode & 0040)
+ mode |= 0010;
+ if (mode & 0004)
+ mode |= 0001;
+
+ info(" creating: %s/\n", path);
+ make_dir(path, mode);
+ ac(archive_read_data_skip(a));
+}
+
+static unsigned char buffer[8192];
+static char spinner[] = { '|', '/', '-', '\\' };
+
+static int
+handle_existing_file(char **path)
+{
+ size_t alen;
+ ssize_t len;
+ char buf[4];
+
+ for (;;) {
+ fprintf(stderr,
+ "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ",
+ *path);
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ clearerr(stdin);
+ printf("NULL\n(EOF or read error, "
+ "treating as \"[N]one\"...)\n");
+ n_opt = 1;
+ return -1;
+ }
+ switch (*buf) {
+ case 'A':
+ o_opt = 1;
+ /* FALLTHROUGH */
+ case 'y':
+ case 'Y':
+ (void)unlink(*path);
+ return 1;
+ case 'N':
+ n_opt = 1;
+ /* FALLTHROUGH */
+ case 'n':
+ return -1;
+ case 'r':
+ case 'R':
+ printf("New name: ");
+ fflush(stdout);
+ free(*path);
+ *path = NULL;
+ alen = 0;
+ len = getdelim(path, &alen, '\n', stdin);
+ if ((*path)[len - 1] == '\n')
+ (*path)[len - 1] = '\0';
+ return 0;
+ default:
+ break;
+ }
+ }
+}
+
+/*
+ * Detect binary files by a combination of character white list and
+ * black list. NUL bytes and other control codes without use in text files
+ * result directly in switching the file to binary mode. Otherwise, at least
+ * one white-listed byte has to be found.
+ *
+ * Black-listed: 0..6, 14..25, 28..31
+ * 0xf3ffc07f = 11110011111111111100000001111111b
+ * White-listed: 9..10, 13, >= 32
+ * 0x00002600 = 00000000000000000010011000000000b
+ *
+ * See the proginfo/txtvsbin.txt in the zip sources for a detailed discussion.
+ */
+#define BYTE_IS_BINARY(x) ((x) < 32 && (0xf3ffc07fU & (1U << (x))))
+#define BYTE_IS_TEXT(x) ((x) >= 32 || (0x00002600U & (1U << (x))))
+
+static int
+check_binary(const unsigned char *buf, size_t len)
+{
+ int rv;
+ for (rv = 1; len--; ++buf) {
+ if (BYTE_IS_BINARY(*buf))
+ return 1;
+ if (BYTE_IS_TEXT(*buf))
+ rv = 0;
+ }
+
+ return rv;
+}
+
+/*
+ * Extract to a file descriptor
+ */
+static int
+extract2fd(struct archive *a, char *pathname, int fd)
+{
+ int cr, text, warn;
+ ssize_t len;
+ unsigned char *p, *q, *end;
+
+ text = a_opt;
+ warn = 0;
+ cr = 0;
+
+ /* loop over file contents and write to fd */
+ for (int n = 0; ; n++) {
+ if (fd != STDOUT_FILENO)
+ if (tty && (n % 4) == 0)
+ info(" %c\b\b", spinner[(n / 4) % sizeof spinner]);
+
+ len = archive_read_data(a, buffer, sizeof buffer);
+
+ if (len < 0)
+ ac(len);
+
+ /* left over CR from previous buffer */
+ if (a_opt && cr) {
+ if (len == 0 || buffer[0] != '\n')
+ if (write(fd, "\r", 1) != 1)
+ error("write('%s')", pathname);
+ cr = 0;
+ }
+
+ /* EOF */
+ if (len == 0)
+ break;
+ end = buffer + len;
+
+ /*
+ * Detect whether this is a text file. The correct way to
+ * do this is to check the least significant bit of the
+ * "internal file attributes" field of the corresponding
+ * file header in the central directory, but libarchive
+ * does not provide access to this field, so we have to
+ * guess by looking for non-ASCII characters in the
+ * buffer. Hopefully we won't guess wrong. If we do
+ * guess wrong, we print a warning message later.
+ */
+ if (a_opt && n == 0) {
+ if (check_binary(buffer, len))
+ text = 0;
+ }
+
+ /* simple case */
+ if (!a_opt || !text) {
+ if (write(fd, buffer, len) != len)
+ error("write('%s')", pathname);
+ continue;
+ }
+
+ /* hard case: convert \r\n to \n (sigh...) */
+ for (p = buffer; p < end; p = q + 1) {
+ for (q = p; q < end; q++) {
+ if (!warn && BYTE_IS_BINARY(*q)) {
+ warningx("%s may be corrupted due"
+ " to weak text file detection"
+ " heuristic", pathname);
+ warn = 1;
+ }
+ if (q[0] != '\r')
+ continue;
+ if (&q[1] == end) {
+ cr = 1;
+ break;
+ }
+ if (q[1] == '\n')
+ break;
+ }
+ if (write(fd, p, q - p) != q - p)
+ error("write('%s')", pathname);
+ }
+ }
+
+ return text;
+}
+
+/*
+ * Extract a regular file.
+ */
+static void
+extract_file(struct archive *a, struct archive_entry *e, char **path)
+{
+ int mode;
+ struct timespec mtime;
+ struct stat sb;
+ struct timespec ts[2];
+ int fd, check, text;
+ const char *linkname;
+
+ mode = archive_entry_mode(e) & 0777;
+ if (mode == 0)
+ mode = 0644;
+ mtime.tv_sec = archive_entry_mtime(e);
+ mtime.tv_nsec = archive_entry_mtime_nsec(e);
+
+ /* look for existing file of same name */
+recheck:
+ if (lstat(*path, &sb) == 0) {
+ if (u_opt || f_opt) {
+ /* check if up-to-date */
+ if ((S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) &&
+ (sb.st_mtim.tv_sec > mtime.tv_sec ||
+ (sb.st_mtim.tv_sec == mtime.tv_sec &&
+ sb.st_mtim.tv_nsec >= mtime.tv_nsec)))
+ return;
+ (void)unlink(*path);
+ } else if (o_opt) {
+ /* overwrite */
+ (void)unlink(*path);
+ } else if (n_opt) {
+ /* do not overwrite */
+ return;
+ } else {
+ check = handle_existing_file(path);
+ if (check == 0)
+ goto recheck;
+ if (check == -1)
+ return; /* do not overwrite */
+ }
+ } else {
+ if (f_opt)
+ return;
+ }
+
+ ts[0].tv_sec = 0;
+ ts[0].tv_nsec = UTIME_NOW;
+ ts[1] = mtime;
+
+ /* process symlinks */
+ linkname = archive_entry_symlink(e);
+ if (linkname != NULL) {
+ if (symlink(linkname, *path) != 0)
+ error("symlink('%s')", *path);
+ info(" extracting: %s -> %s\n", *path, linkname);
+ if (lchmod(*path, mode) != 0)
+ warning("Cannot set mode for '%s'", *path);
+ /* set access and modification time */
+ if (utimensat(AT_FDCWD, *path, ts, AT_SYMLINK_NOFOLLOW) != 0)
+ warning("utimensat('%s')", *path);
+ return;
+ }
+
+ if ((fd = open(*path, O_RDWR|O_CREAT|O_TRUNC, mode)) < 0)
+ error("open('%s')", *path);
+
+ info(" extracting: %s", *path);
+
+ text = extract2fd(a, *path, fd);
+
+ if (tty)
+ info(" \b\b");
+ if (text)
+ info(" (text)");
+ info("\n");
+
+ /* set access and modification time */
+ if (futimens(fd, ts) != 0)
+ error("futimens('%s')", *path);
+ if (close(fd) != 0)
+ error("close('%s')", *path);
+}
+
+/*
+ * Extract a zipfile entry: first perform some sanity checks to ensure
+ * that it is either a directory or a regular file and that the path is
+ * not absolute and does not try to break out of the current directory;
+ * then call either extract_dir() or extract_file() as appropriate.
+ *
+ * This is complicated a bit by the various ways in which we need to
+ * manipulate the path name. Case conversion (if requested by the -L
+ * option) happens first, but the include / exclude patterns are applied
+ * to the full converted path name, before the directory part of the path
+ * is removed in accordance with the -j option. Sanity checks are
+ * intentionally done earlier than they need to be, so the user will get a
+ * warning about insecure paths even for files or directories which
+ * wouldn't be extracted anyway.
+ */
+static void
+extract(struct archive *a, struct archive_entry *e)
+{
+ char *pathname, *realpathname;
+ mode_t filetype;
+ char *p, *q;
+
+ pathname = pathdup(archive_entry_pathname(e));
+ filetype = archive_entry_filetype(e);
+
+ /* sanity checks */
+ if (pathname[0] == '/' ||
+ strncmp(pathname, "../", 3) == 0 ||
+ strstr(pathname, "/../") != NULL) {
+ warningx("skipping insecure entry '%s'", pathname);
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* I don't think this can happen in a zipfile.. */
+ if (!S_ISDIR(filetype) && !S_ISREG(filetype) && !S_ISLNK(filetype)) {
+ warningx("skipping non-regular entry '%s'", pathname);
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* skip directories in -j case */
+ if (S_ISDIR(filetype) && j_opt) {
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* apply include / exclude patterns */
+ if (!accept_pathname(pathname)) {
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* apply -j and -d */
+ if (j_opt) {
+ for (p = q = pathname; *p; ++p)
+ if (*p == '/')
+ q = p + 1;
+ realpathname = pathcat(d_arg, q);
+ } else {
+ realpathname = pathcat(d_arg, pathname);
+ }
+
+ /* ensure that parent directory exists */
+ make_parent(realpathname);
+
+ if (S_ISDIR(filetype))
+ extract_dir(a, e, realpathname);
+ else
+ extract_file(a, e, &realpathname);
+
+ free(realpathname);
+ free(pathname);
+}
+
+static void
+extract_stdout(struct archive *a, struct archive_entry *e)
+{
+ char *pathname;
+ mode_t filetype;
+
+ pathname = pathdup(archive_entry_pathname(e));
+ filetype = archive_entry_filetype(e);
+
+ /* I don't think this can happen in a zipfile.. */
+ if (!S_ISDIR(filetype) && !S_ISREG(filetype) && !S_ISLNK(filetype)) {
+ warningx("skipping non-regular entry '%s'", pathname);
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* skip directories in -j case */
+ if (S_ISDIR(filetype)) {
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ /* apply include / exclude patterns */
+ if (!accept_pathname(pathname)) {
+ ac(archive_read_data_skip(a));
+ free(pathname);
+ return;
+ }
+
+ if (c_opt)
+ info("x %s\n", pathname);
+
+ (void)extract2fd(a, pathname, STDOUT_FILENO);
+
+ free(pathname);
+}
+
+/*
+ * Print the name of an entry to stdout.
+ */
+static void
+list(struct archive *a, struct archive_entry *e)
+{
+ char buf[20];
+ time_t mtime;
+ struct tm *tm;
+
+ mtime = archive_entry_mtime(e);
+ tm = localtime(&mtime);
+ if (*y_str)
+ strftime(buf, sizeof(buf), "%m-%d-%G %R", tm);
+ else
+ strftime(buf, sizeof(buf), "%m-%d-%g %R", tm);
+
+ if (!zipinfo_mode) {
+ if (v_opt == 1) {
+ printf(" %8ju %s %s\n",
+ (uintmax_t)archive_entry_size(e),
+ buf, archive_entry_pathname(e));
+ } else if (v_opt == 2) {
+ printf("%8ju Stored %7ju 0%% %s %08x %s\n",
+ (uintmax_t)archive_entry_size(e),
+ (uintmax_t)archive_entry_size(e),
+ buf,
+ 0U,
+ archive_entry_pathname(e));
+ }
+ } else {
+ if (Z1_opt)
+ printf("%s\n",archive_entry_pathname(e));
+ }
+ ac(archive_read_data_skip(a));
+}
+
+/*
+ * Extract to memory to check CRC
+ */
+static int
+test(struct archive *a, struct archive_entry *e)
+{
+ ssize_t len;
+ int error_count;
+
+ error_count = 0;
+ if (S_ISDIR(archive_entry_filetype(e)))
+ return 0;
+
+ info(" testing: %s\t", archive_entry_pathname(e));
+ while ((len = archive_read_data(a, buffer, sizeof buffer)) > 0)
+ /* nothing */;
+ if (len < 0) {
+ info(" %s\n", archive_error_string(a));
+ ++error_count;
+ } else {
+ info(" OK\n");
+ }
+
+ /* shouldn't be necessary, but it doesn't hurt */
+ ac(archive_read_data_skip(a));
+
+ return error_count;
+}
+
+/*
+ * Main loop: open the zipfile, iterate over its contents and decide what
+ * to do with each entry.
+ */
+static void
+unzip(const char *fn)
+{
+ struct archive *a;
+ struct archive_entry *e;
+ int ret;
+ uintmax_t total_size, file_count, error_count;
+
+ if ((a = archive_read_new()) == NULL)
+ error("archive_read_new failed");
+
+ ac(archive_read_support_format_zip(a));
+ ac(archive_read_open_filename(a, fn, 8192));
+
+ if (!zipinfo_mode) {
+ if (!p_opt && !q_opt)
+ printf("Archive: %s\n", fn);
+ if (v_opt == 1) {
+ printf(" Length %sDate Time Name\n", y_str);
+ printf(" -------- %s---- ---- ----\n", y_str);
+ } else if (v_opt == 2) {
+ printf(" Length Method Size Ratio %sDate Time CRC-32 Name\n", y_str);
+ printf("-------- ------ ------- ----- %s---- ---- ------ ----\n", y_str);
+ }
+ }
+
+ total_size = 0;
+ file_count = 0;
+ error_count = 0;
+ for (;;) {
+ ret = archive_read_next_header(a, &e);
+ if (ret == ARCHIVE_EOF)
+ break;
+ ac(ret);
+ if (!zipinfo_mode) {
+ if (t_opt)
+ error_count += test(a, e);
+ else if (v_opt)
+ list(a, e);
+ else if (p_opt || c_opt)
+ extract_stdout(a, e);
+ else
+ extract(a, e);
+ } else {
+ if (Z1_opt)
+ list(a, e);
+ }
+
+ total_size += archive_entry_size(e);
+ ++file_count;
+ }
+
+ if (zipinfo_mode) {
+ if (v_opt == 1) {
+ printf(" -------- %s-------\n", y_str);
+ printf(" %8ju %s%ju file%s\n",
+ total_size, y_str, file_count, file_count != 1 ? "s" : "");
+ } else if (v_opt == 2) {
+ printf("-------- ------- --- %s-------\n", y_str);
+ printf("%8ju %7ju 0%% %s%ju file%s\n",
+ total_size, total_size, y_str, file_count,
+ file_count != 1 ? "s" : "");
+ }
+ }
+
+ ac(archive_read_close(a));
+ (void)archive_read_free(a);
+
+ if (t_opt) {
+ if (error_count > 0) {
+ errorx("%ju checksum error(s) found.", error_count);
+ }
+ else {
+ printf("No errors detected in compressed data of %s.\n",
+ fn);
+ }
+ }
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] "
+ "zipfile\n");
+ exit(1);
+}
+
+static int
+getopts(int argc, char *argv[])
+{
+ int opt;
+
+ optreset = optind = 1;
+ while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:yZ1")) != -1)
+ switch (opt) {
+ case '1':
+ Z1_opt = 1;
+ break;
+ case 'a':
+ a_opt = 1;
+ break;
+ case 'C':
+ C_opt = 1;
+ break;
+ case 'c':
+ c_opt = 1;
+ break;
+ case 'd':
+ d_arg = optarg;
+ break;
+ case 'f':
+ f_opt = 1;
+ break;
+ case 'j':
+ j_opt = 1;
+ break;
+ case 'L':
+ L_opt = 1;
+ break;
+ case 'l':
+ if (v_opt == 0)
+ v_opt = 1;
+ break;
+ case 'n':
+ n_opt = 1;
+ break;
+ case 'o':
+ o_opt = 1;
+ q_opt = 1;
+ break;
+ case 'p':
+ p_opt = 1;
+ break;
+ case 'q':
+ q_opt = 1;
+ break;
+ case 't':
+ t_opt = 1;
+ break;
+ case 'u':
+ u_opt = 1;
+ break;
+ case 'v':
+ v_opt = 2;
+ break;
+ case 'x':
+ add_pattern(&exclude, optarg);
+ break;
+ case 'y':
+ y_str = " ";
+ break;
+ case 'Z':
+ zipinfo_mode = 1;
+ break;
+ default:
+ usage();
+ }
+
+ return (optind);
+}
+
+int
+main(int argc, char *argv[])
+{
+ const char *zipfile;
+ int nopts;
+
+ if (isatty(STDOUT_FILENO))
+ tty = 1;
+
+ if (getenv("UNZIP_DEBUG") != NULL)
+ unzip_debug = 1;
+ for (int i = 0; i < argc; ++i)
+ debug("%s%c", argv[i], (i < argc - 1) ? ' ' : '\n');
+
+ /*
+ * Info-ZIP's unzip(1) expects certain options to come before the
+ * zipfile name, and others to come after - though it does not
+ * enforce this. For simplicity, we accept *all* options both
+ * before and after the zipfile name.
+ */
+ nopts = getopts(argc, argv);
+
+ /*
+ * When more of the zipinfo mode options are implemented, this
+ * will need to change.
+ */
+ if (zipinfo_mode && !Z1_opt) {
+ printf("Zipinfo mode needs additional options\n");
+ exit(1);
+ }
+
+ if (argc <= nopts)
+ usage();
+ zipfile = argv[nopts++];
+
+ if (strcmp(zipfile, "-") == 0)
+ zipfile = NULL; /* STDIN */
+
+ while (nopts < argc && *argv[nopts] != '-')
+ add_pattern(&include, argv[nopts++]);
+
+ nopts--; /* fake argv[0] */
+ nopts += getopts(argc - nopts, argv + nopts);
+
+ if (n_opt + o_opt + u_opt > 1)
+ errorx("-n, -o and -u are contradictory");
+
+ unzip(zipfile);
+
+ exit(0);
+}
diff --git a/usr.bin/usbhidaction/Makefile b/usr.bin/usbhidaction/Makefile
new file mode 100644
index 0000000..7aadd6c
--- /dev/null
+++ b/usr.bin/usbhidaction/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+# $NetBSD: Makefile,v 1.4 2002/02/02 16:54:26 veego Exp $
+
+PROG= usbhidaction
+
+LIBADD= usbhid
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/usbhidaction/Makefile.depend b/usr.bin/usbhidaction/Makefile.depend
new file mode 100644
index 0000000..3a42599
--- /dev/null
+++ b/usr.bin/usbhidaction/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libusbhid \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/usbhidaction/usbhidaction.1 b/usr.bin/usbhidaction/usbhidaction.1
new file mode 100644
index 0000000..633272e
--- /dev/null
+++ b/usr.bin/usbhidaction/usbhidaction.1
@@ -0,0 +1,174 @@
+.\" $FreeBSD$
+.\" $NetBSD: usbhidaction.1,v 1.8 2003/02/25 10:35:59 wiz Exp $
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson (lennart@augustsson.net).
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd April 9, 2003
+.Dt USBHIDACTION 1
+.Os
+.Sh NAME
+.Nm usbhidaction
+.Nd perform actions according to USB HID controls
+.Sh SYNOPSIS
+.Nm
+.Op Fl diev
+.Fl c Ar config-file
+.Fl f Ar device
+.Op Fl p Ar pidfile
+.Op Fl t Ar tablefile
+.Ar arg ...
+.Sh DESCRIPTION
+The
+.Nm
+utility
+can be used to execute commands when certain values appear on HID controls.
+The normal operation for this program is to read the configuration file
+and then become a daemon and execute commands as the HID items specify.
+If a read from the HID device fails, the program dies; this will make it
+die when the USB device is unplugged.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d
+Toggle the daemon flag.
+.It Fl e
+Instruct
+.Nm
+to die early.
+Useful when specified with multiple verbose options to see how files are parsed.
+.It Fl i
+Ignore HID items in the configuration file that do not exist in the device.
+.It Fl v
+Be verbose, and do not become a daemon.
+.It Fl c Ar config-file
+Specify a path name for the configuration file.
+.It Fl t Ar tablefile
+Specify a path name for the HID usage table file.
+.It Fl f Ar device
+Specify a path name for the device to operate on.
+If
+.Ar device
+is numeric, it is taken to be the USB HID device number.
+If it is a relative
+path, it is taken to be the name of the device under
+.Pa /dev .
+An absolute path is taken to be the literal device pathname.
+.It Fl p Ar pidfile
+Specify an alternate file in which to store the process ID.
+.El
+.Pp
+The configuration file will be re-read if the process gets a
+.Dv SIGHUP
+signal.
+.Sh CONFIGURATION
+The configuration file has a very simple format.
+Each line describes an
+action; if a line begins with a whitespace, it is considered a continuation
+of the previous line.
+Lines beginning with
+.Ql #
+are considered as comments.
+.Pp
+Each line has four parts: a name of a USB HID item, a value for that item,
+a debounce value, and an action.
+There must be whitespace between the parts.
+.Pp
+The item names are similar to those used by
+.Xr usbhidctl 1 .
+.Pp
+The value is simply a numeric value.
+When the item reports this value,
+the action will be performed.
+If the value is
+.Ql * ,
+it will match any value.
+.Pp
+The debounce value is an integer not less than 0.
+The value of 0 indicates that no debouncing should occur.
+A value of 1 will only execute the action when the state changes.
+Values greater than one specify that an action should be performed
+only when the value changes by that amount.
+.Pp
+The action is a normal command that is executed with
+.Xr system 3 .
+Before it is executed some substitution will occur:
+.Ql $n
+will be replaced by the
+.Ar n Ns th
+argument on the command line,
+.Ql $V
+will be replaced by the numeric value of the HID item,
+.Ql $N
+will be replaced by the name of the control, and
+.Ql $H
+will be replaced by the name of the HID device.
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/misc/usb_hid_usages"
+.It Pa /usr/share/misc/usb_hid_usages
+The HID usage table.
+.It Pa /var/run/usbaction.pid
+The default location of the PID file.
+.El
+.Sh EXAMPLES
+The following configuration file can be used to control a pair
+of Philips USB speakers with the HID controls on the speakers.
+.Bd -literal -offset indent
+# Configuration for various Philips USB speakers
+Consumer:Volume_Up 1 0 mixer -f $1 vol +1
+Consumer:Volume_Down 1 0 mixer -f $1 vol -1
+# mute not supported
+#Consumer:Mute 1 0 mixer -f $1 mute
+Consumer:Channel_Top.Microsoft:Base_Up 1 0 mixer -f $1 bass +1
+Consumer:Channel_Top.Microsoft:Base_Down 1 0 mixer -f $1 bass -1
+.Ed
+.Pp
+A sample invocation using this configuration would be
+.Pp
+.Dl "usbhidaction -f /dev/uhid1 -c conf /dev/mixer1"
+.Pp
+The following example controls the mixer volume using a Logitech Wingman.
+Notice the debounce of 1 for buttons and 5 for the slider.
+.Bd -literal -offset indent
+Button:Button_1 1 1 mixer vol +10
+Button:Button_2 1 1 mixer vol -10
+Generic_Desktop:Z * 5 mixer vol `echo $V | awk '{print int($$1/255*100)}'`
+.Ed
+.Sh SEE ALSO
+.Xr usbhidctl 1 ,
+.Xr usbhid 3 ,
+.Xr uhid 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Nx 1.6 .
+The
+.Nm
+command appeared in
+.Fx 5.1 .
diff --git a/usr.bin/usbhidaction/usbhidaction.c b/usr.bin/usbhidaction/usbhidaction.c
new file mode 100644
index 0000000..49cf0af
--- /dev/null
+++ b/usr.bin/usbhidaction/usbhidaction.c
@@ -0,0 +1,518 @@
+/* $NetBSD: usbhidaction.c,v 1.8 2002/06/11 06:06:21 itojun Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson <lennart@augustsson.net>.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <dev/usb/usbhid.h>
+#include <usbhid.h>
+#include <syslog.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+static int verbose = 0;
+static int isdemon = 0;
+static int reparse = 1;
+static const char * pidfile = "/var/run/usbaction.pid";
+
+struct command {
+ struct command *next;
+ int line;
+
+ struct hid_item item;
+ int value;
+ int lastseen;
+ int lastused;
+ int debounce;
+ char anyvalue;
+ char *name;
+ char *action;
+};
+static struct command *commands;
+
+#define SIZE 4000
+
+void usage(void);
+struct command *parse_conf(const char *, report_desc_t, int, int);
+void docmd(struct command *, int, const char *, int, char **);
+void freecommands(struct command *);
+
+static void
+sighup(int sig __unused)
+{
+ reparse = 1;
+}
+
+int
+main(int argc, char **argv)
+{
+ const char *conf = NULL;
+ const char *dev = NULL;
+ const char *table = NULL;
+ int fd, fp, ch, n, val, i;
+ size_t sz, sz1;
+ int demon, ignore, dieearly;
+ report_desc_t repd;
+ char buf[100];
+ char devnamebuf[PATH_MAX];
+ struct command *cmd;
+ int reportid = -1;
+
+ demon = 1;
+ ignore = 0;
+ dieearly = 0;
+ while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) {
+ switch(ch) {
+ case 'c':
+ conf = optarg;
+ break;
+ case 'd':
+ demon ^= 1;
+ break;
+ case 'e':
+ dieearly = 1;
+ break;
+ case 'i':
+ ignore++;
+ break;
+ case 'f':
+ dev = optarg;
+ break;
+ case 'p':
+ pidfile = optarg;
+ break;
+ case 'r':
+ reportid = atoi(optarg);
+ break;
+ case 't':
+ table = optarg;
+ break;
+ case 'v':
+ demon = 0;
+ verbose++;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (conf == NULL || dev == NULL)
+ usage();
+
+ hid_init(table);
+
+ if (dev[0] != '/') {
+ snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s",
+ isdigit(dev[0]) ? "uhid" : "", dev);
+ dev = devnamebuf;
+ }
+
+ fd = open(dev, O_RDWR);
+ if (fd < 0)
+ err(1, "%s", dev);
+ repd = hid_get_report_desc(fd);
+ if (repd == NULL)
+ err(1, "hid_get_report_desc() failed");
+
+ commands = parse_conf(conf, repd, reportid, ignore);
+
+ sz = (size_t)hid_report_size(repd, hid_input, -1);
+
+ if (verbose)
+ printf("report size %zu\n", sz);
+ if (sz > sizeof buf)
+ errx(1, "report too large");
+
+ (void)signal(SIGHUP, sighup);
+
+ if (demon) {
+ fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH);
+ if (fp < 0)
+ err(1, "%s", pidfile);
+ if (daemon(0, 0) < 0)
+ err(1, "daemon()");
+ snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
+ sz1 = strlen(buf);
+ if (write(fp, buf, sz1) < 0)
+ err(1, "%s", pidfile);
+ close(fp);
+ isdemon = 1;
+ }
+
+ for(;;) {
+ n = read(fd, buf, sz);
+ if (verbose > 2) {
+ printf("read %d bytes:", n);
+ for (i = 0; i < n; i++)
+ printf(" %02x", buf[i]);
+ printf("\n");
+ }
+ if (n < 0) {
+ if (verbose)
+ err(1, "read");
+ else
+ exit(1);
+ }
+#if 0
+ if (n != sz) {
+ err(2, "read size");
+ }
+#endif
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ if (cmd->item.report_ID != 0 &&
+ buf[0] != cmd->item.report_ID)
+ continue;
+ if (cmd->item.flags & HIO_VARIABLE)
+ val = hid_get_data(buf, &cmd->item);
+ else {
+ uint32_t pos = cmd->item.pos;
+ for (i = 0; i < cmd->item.report_count; i++) {
+ val = hid_get_data(buf, &cmd->item);
+ if (val == cmd->value)
+ break;
+ cmd->item.pos += cmd->item.report_size;
+ }
+ cmd->item.pos = pos;
+ val = (i < cmd->item.report_count) ?
+ cmd->value : -1;
+ }
+ if (cmd->value != val && cmd->anyvalue == 0)
+ goto next;
+ if ((cmd->debounce == 0) ||
+ ((cmd->debounce == 1) && ((cmd->lastseen == -1) ||
+ (cmd->lastseen != val)))) {
+ docmd(cmd, val, dev, argc, argv);
+ goto next;
+ }
+ if ((cmd->debounce > 1) &&
+ ((cmd->lastused == -1) ||
+ (abs(cmd->lastused - val) >= cmd->debounce))) {
+ docmd(cmd, val, dev, argc, argv);
+ cmd->lastused = val;
+ goto next;
+ }
+next:
+ cmd->lastseen = val;
+ }
+
+ if (dieearly)
+ exit(0);
+
+ if (reparse) {
+ struct command *cmds =
+ parse_conf(conf, repd, reportid, ignore);
+ if (cmds) {
+ freecommands(commands);
+ commands = cmds;
+ }
+ reparse = 0;
+ }
+ }
+
+ exit(0);
+}
+
+void
+usage(void)
+{
+
+ fprintf(stderr, "Usage: %s [-deiv] -c config_file -f hid_dev "
+ "[-p pidfile] [-t tablefile]\n", getprogname());
+ exit(1);
+}
+
+static int
+peek(FILE *f)
+{
+ int c;
+
+ c = getc(f);
+ if (c != EOF)
+ ungetc(c, f);
+ return c;
+}
+
+struct command *
+parse_conf(const char *conf, report_desc_t repd, int reportid, int ignore)
+{
+ FILE *f;
+ char *p;
+ int line;
+ char buf[SIZE], name[SIZE], value[SIZE], debounce[SIZE], action[SIZE];
+ char usbuf[SIZE], coll[SIZE], *tmp;
+ struct command *cmd, *cmds;
+ struct hid_data *d;
+ struct hid_item h;
+ int inst, cinst, u, lo, hi, range, t;
+
+ f = fopen(conf, "r");
+ if (f == NULL)
+ err(1, "%s", conf);
+
+ cmds = NULL;
+ for (line = 1; ; line++) {
+ if (fgets(buf, sizeof buf, f) == NULL)
+ break;
+ if (buf[0] == '#' || buf[0] == '\n')
+ continue;
+ p = strchr(buf, '\n');
+ while (p && isspace(peek(f))) {
+ if (fgets(p, sizeof buf - strlen(buf), f) == NULL)
+ break;
+ p = strchr(buf, '\n');
+ }
+ if (p)
+ *p = 0;
+ if (sscanf(buf, "%s %s %s %[^\n]",
+ name, value, debounce, action) != 4) {
+ if (isdemon) {
+ syslog(LOG_WARNING, "config file `%s', line %d"
+ ", syntax error: %s", conf, line, buf);
+ freecommands(cmds);
+ return (NULL);
+ } else {
+ errx(1, "config file `%s', line %d,"
+ ", syntax error: %s", conf, line, buf);
+ }
+ }
+ tmp = strchr(name, '#');
+ if (tmp != NULL) {
+ *tmp = 0;
+ inst = atoi(tmp + 1);
+ } else
+ inst = 0;
+
+ cmd = malloc(sizeof *cmd);
+ if (cmd == NULL)
+ err(1, "malloc failed");
+ cmd->next = cmds;
+ cmds = cmd;
+ cmd->line = line;
+
+ if (strcmp(value, "*") == 0) {
+ cmd->anyvalue = 1;
+ } else {
+ cmd->anyvalue = 0;
+ if (sscanf(value, "%d", &cmd->value) != 1) {
+ if (isdemon) {
+ syslog(LOG_WARNING,
+ "config file `%s', line %d, "
+ "bad value: %s (should be * or a number)\n",
+ conf, line, value);
+ freecommands(cmds);
+ return (NULL);
+ } else {
+ errx(1, "config file `%s', line %d, "
+ "bad value: %s (should be * or a number)\n",
+ conf, line, value);
+ }
+ }
+ }
+
+ if (sscanf(debounce, "%d", &cmd->debounce) != 1) {
+ if (isdemon) {
+ syslog(LOG_WARNING,
+ "config file `%s', line %d, "
+ "bad value: %s (should be a number >= 0)\n",
+ conf, line, debounce);
+ freecommands(cmds);
+ return (NULL);
+ } else {
+ errx(1, "config file `%s', line %d, "
+ "bad value: %s (should be a number >= 0)\n",
+ conf, line, debounce);
+ }
+ }
+
+ coll[0] = 0;
+ cinst = 0;
+ for (d = hid_start_parse(repd, 1 << hid_input, reportid);
+ hid_get_item(d, &h); ) {
+ if (verbose > 2)
+ printf("kind=%d usage=%x\n", h.kind, h.usage);
+ if (h.flags & HIO_CONST)
+ continue;
+ switch (h.kind) {
+ case hid_input:
+ if (h.usage_minimum != 0 ||
+ h.usage_maximum != 0) {
+ lo = h.usage_minimum;
+ hi = h.usage_maximum;
+ range = 1;
+ } else {
+ lo = h.usage;
+ hi = h.usage;
+ range = 0;
+ }
+ for (u = lo; u <= hi; u++) {
+ if (coll[0]) {
+ snprintf(usbuf, sizeof usbuf,
+ "%s.%s:%s", coll+1,
+ hid_usage_page(HID_PAGE(u)),
+ hid_usage_in_page(u));
+ } else {
+ snprintf(usbuf, sizeof usbuf,
+ "%s:%s",
+ hid_usage_page(HID_PAGE(u)),
+ hid_usage_in_page(u));
+ }
+ if (verbose > 2)
+ printf("usage %s\n", usbuf);
+ t = strlen(usbuf) - strlen(name);
+ if (t > 0) {
+ if (strcmp(usbuf + t, name))
+ continue;
+ if (usbuf[t - 1] != '.')
+ continue;
+ } else if (strcmp(usbuf, name))
+ continue;
+ if (inst == cinst++)
+ goto foundhid;
+ }
+ break;
+ case hid_collection:
+ snprintf(coll + strlen(coll),
+ sizeof coll - strlen(coll), ".%s:%s",
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ break;
+ case hid_endcollection:
+ if (coll[0])
+ *strrchr(coll, '.') = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ if (ignore) {
+ if (verbose)
+ warnx("ignore item '%s'", name);
+ continue;
+ }
+ if (isdemon) {
+ syslog(LOG_WARNING, "config file `%s', line %d, HID "
+ "item not found: `%s'\n", conf, line, name);
+ freecommands(cmds);
+ return (NULL);
+ } else {
+ errx(1, "config file `%s', line %d, HID item "
+ "not found: `%s'\n", conf, line, name);
+ }
+
+ foundhid:
+ hid_end_parse(d);
+ cmd->lastseen = -1;
+ cmd->lastused = -1;
+ cmd->item = h;
+ cmd->name = strdup(name);
+ cmd->action = strdup(action);
+ if (range) {
+ if (cmd->value == 1)
+ cmd->value = u - lo;
+ else
+ cmd->value = -1;
+ }
+
+ if (verbose)
+ printf("PARSE:%d %s, %d, '%s'\n", cmd->line, name,
+ cmd->value, cmd->action);
+ }
+ fclose(f);
+ return (cmds);
+}
+
+void
+docmd(struct command *cmd, int value, const char *hid, int argc, char **argv)
+{
+ char cmdbuf[SIZE], *p, *q;
+ size_t len;
+ int n, r;
+
+ for (p = cmd->action, q = cmdbuf; *p && q < &cmdbuf[SIZE-1]; ) {
+ if (*p == '$') {
+ p++;
+ len = &cmdbuf[SIZE-1] - q;
+ if (isdigit(*p)) {
+ n = strtol(p, &p, 10) - 1;
+ if (n >= 0 && n < argc) {
+ strncpy(q, argv[n], len);
+ q += strlen(q);
+ }
+ } else if (*p == 'V') {
+ p++;
+ snprintf(q, len, "%d", value);
+ q += strlen(q);
+ } else if (*p == 'N') {
+ p++;
+ strncpy(q, cmd->name, len);
+ q += strlen(q);
+ } else if (*p == 'H') {
+ p++;
+ strncpy(q, hid, len);
+ q += strlen(q);
+ } else if (*p) {
+ *q++ = *p++;
+ }
+ } else {
+ *q++ = *p++;
+ }
+ }
+ *q = 0;
+
+ if (verbose)
+ printf("system '%s'\n", cmdbuf);
+ r = system(cmdbuf);
+ if (verbose > 1 && r)
+ printf("return code = 0x%x\n", r);
+}
+
+void
+freecommands(struct command *cmd)
+{
+ struct command *next;
+
+ while (cmd) {
+ next = cmd->next;
+ free(cmd);
+ cmd = next;
+ }
+}
diff --git a/usr.bin/usbhidctl/Makefile b/usr.bin/usbhidctl/Makefile
new file mode 100644
index 0000000..f0b5758
--- /dev/null
+++ b/usr.bin/usbhidctl/Makefile
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.4 1999/05/11 21:02:25 augustss Exp $
+# $FreeBSD$
+
+PROG= usbhidctl
+SRCS= usbhid.c
+
+LIBADD= usbhid
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/usbhidctl/Makefile.depend b/usr.bin/usbhidctl/Makefile.depend
new file mode 100644
index 0000000..3a42599
--- /dev/null
+++ b/usr.bin/usbhidctl/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libusbhid \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c
new file mode 100644
index 0000000..06a79c8
--- /dev/null
+++ b/usr.bin/usbhidctl/usbhid.c
@@ -0,0 +1,531 @@
+/* $NetBSD: usbhid.c,v 1.14 2000/07/03 02:51:37 matt Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (augustss@netbsd.org).
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <err.h>
+#include <ctype.h>
+#include <errno.h>
+#include <usbhid.h>
+#include <dev/usb/usbhid.h>
+
+static struct variable {
+ char *name;
+ int instance;
+ int val;
+ struct hid_item h;
+ struct variable *next;
+} *vars;
+
+static int verbose = 0;
+static int noname = 0;
+static int hexdump = 0;
+static int wflag = 0;
+static int zflag = 0;
+
+static void usage(void);
+static void dumpitem(const char *label, struct hid_item *h);
+static void dumpitems(report_desc_t r);
+static void prdata(u_char *buf, struct hid_item *h);
+static void dumpdata(int f, report_desc_t r, int loop);
+static void writedata(int f, report_desc_t r);
+
+static void
+parceargs(report_desc_t r, int all, int nnames, char **names)
+{
+ struct hid_data *d;
+ struct hid_item h;
+ char colls[1000];
+ char hname[1000], *tmp1, *tmp2;
+ struct variable *var, **pnext;
+ int i, instance, cp, t;
+
+ pnext = &vars;
+ if (all) {
+ if (wflag)
+ errx(1, "Must not specify -w to read variables");
+ cp = 0;
+ for (d = hid_start_parse(r,
+ 1<<hid_input | 1<<hid_output | 1<<hid_feature, -1);
+ hid_get_item(d, &h); ) {
+ if (h.kind == hid_collection) {
+ cp += sprintf(&colls[cp], "%s%s:%s",
+ cp != 0 ? "." : "",
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ } else if (h.kind == hid_endcollection) {
+ tmp1 = strrchr(colls, '.');
+ if (tmp1 != NULL) {
+ cp -= strlen(tmp1);
+ tmp1[0] = 0;
+ } else {
+ cp = 0;
+ colls[0] = 0;
+ }
+ }
+ if ((h.kind != hid_input && h.kind != hid_output &&
+ h.kind != hid_feature) || (h.flags & HIO_CONST))
+ continue;
+ var = malloc(sizeof(*var));
+ memset(var, 0, sizeof(*var));
+ asprintf(&var->name, "%s%s%s:%s",
+ colls, colls[0] != 0 ? "." : "",
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ var->h = h;
+ *pnext = var;
+ pnext = &var->next;
+ }
+ hid_end_parse(d);
+ return;
+ }
+ for (i = 0; i < nnames; i++) {
+ var = malloc(sizeof(*var));
+ memset(var, 0, sizeof(*var));
+ tmp1 = tmp2 = strdup(names[i]);
+ strsep(&tmp2, "=");
+ var->name = strsep(&tmp1, "#");
+ if (tmp1 != NULL)
+ var->instance = atoi(tmp1);
+ if (tmp2 != NULL) {
+ if (!wflag)
+ errx(1, "Must specify -w to write variables");
+ var->val = atoi(tmp2);
+ } else
+ if (wflag)
+ errx(1, "Must not specify -w to read variables");
+ *pnext = var;
+ pnext = &var->next;
+
+ instance = 0;
+ cp = 0;
+ for (d = hid_start_parse(r,
+ 1<<hid_input | 1<<hid_output | 1<<hid_feature, -1);
+ hid_get_item(d, &h); ) {
+ if (h.kind == hid_collection) {
+ cp += sprintf(&colls[cp], "%s%s:%s",
+ cp != 0 ? "." : "",
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ } else if (h.kind == hid_endcollection) {
+ tmp1 = strrchr(colls, '.');
+ if (tmp1 != NULL) {
+ cp -= strlen(tmp1);
+ tmp1[0] = 0;
+ } else {
+ cp = 0;
+ colls[0] = 0;
+ }
+ }
+ if ((h.kind != hid_input && h.kind != hid_output &&
+ h.kind != hid_feature) || (h.flags & HIO_CONST))
+ continue;
+ snprintf(hname, sizeof(hname), "%s%s%s:%s",
+ colls, colls[0] != 0 ? "." : "",
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ t = strlen(hname) - strlen(var->name);
+ if (t > 0) {
+ if (strcmp(hname + t, var->name) != 0)
+ continue;
+ if (hname[t - 1] != '.')
+ continue;
+ } else if (strcmp(hname, var->name) != 0)
+ continue;
+ if (var->instance != instance++)
+ continue;
+ var->h = h;
+ break;
+ }
+ hid_end_parse(d);
+ if (var->h.usage == 0)
+ errx(1, "Unknown item '%s'", var->name);
+ }
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: %s -f device "
+ "[-l] [-n] [-r] [-t tablefile] [-v] [-x] [-z] name ...\n",
+ getprogname());
+ fprintf(stderr,
+ " %s -f device "
+ "[-l] [-n] [-r] [-t tablefile] [-v] [-x] [-z] -a\n",
+ getprogname());
+ fprintf(stderr,
+ " %s -f device "
+ "[-t tablefile] [-v] [-z] -w name=value\n",
+ getprogname());
+ exit(1);
+}
+
+static void
+dumpitem(const char *label, struct hid_item *h)
+{
+ if ((h->flags & HIO_CONST) && !verbose)
+ return;
+ printf("%s rid=%d size=%d count=%d page=%s usage=%s%s%s", label,
+ h->report_ID, h->report_size, h->report_count,
+ hid_usage_page(HID_PAGE(h->usage)),
+ hid_usage_in_page(h->usage),
+ h->flags & HIO_CONST ? " Const" : "",
+ h->flags & HIO_VARIABLE ? "" : " Array");
+ printf(", logical range %d..%d",
+ h->logical_minimum, h->logical_maximum);
+ if (h->physical_minimum != h->physical_maximum)
+ printf(", physical range %d..%d",
+ h->physical_minimum, h->physical_maximum);
+ if (h->unit)
+ printf(", unit=0x%02x exp=%d", h->unit, h->unit_exponent);
+ printf("\n");
+}
+
+static const char *
+hid_collection_type(int32_t type)
+{
+ static char num[8];
+
+ switch (type) {
+ case 0: return ("Physical");
+ case 1: return ("Application");
+ case 2: return ("Logical");
+ case 3: return ("Report");
+ case 4: return ("Named_Array");
+ case 5: return ("Usage_Switch");
+ case 6: return ("Usage_Modifier");
+ }
+ snprintf(num, sizeof(num), "0x%02x", type);
+ return (num);
+}
+
+static void
+dumpitems(report_desc_t r)
+{
+ struct hid_data *d;
+ struct hid_item h;
+ int size;
+
+ for (d = hid_start_parse(r, ~0, -1); hid_get_item(d, &h); ) {
+ switch (h.kind) {
+ case hid_collection:
+ printf("Collection type=%s page=%s usage=%s\n",
+ hid_collection_type(h.collection),
+ hid_usage_page(HID_PAGE(h.usage)),
+ hid_usage_in_page(h.usage));
+ break;
+ case hid_endcollection:
+ printf("End collection\n");
+ break;
+ case hid_input:
+ dumpitem("Input ", &h);
+ break;
+ case hid_output:
+ dumpitem("Output ", &h);
+ break;
+ case hid_feature:
+ dumpitem("Feature", &h);
+ break;
+ }
+ }
+ hid_end_parse(d);
+ size = hid_report_size(r, hid_input, -1);
+ printf("Total input size %d bytes\n", size);
+
+ size = hid_report_size(r, hid_output, -1);
+ printf("Total output size %d bytes\n", size);
+
+ size = hid_report_size(r, hid_feature, -1);
+ printf("Total feature size %d bytes\n", size);
+}
+
+static void
+prdata(u_char *buf, struct hid_item *h)
+{
+ u_int data;
+ int i, pos;
+
+ pos = h->pos;
+ for (i = 0; i < h->report_count; i++) {
+ data = hid_get_data(buf, h);
+ if (i > 0)
+ printf(" ");
+ if (h->logical_minimum < 0)
+ printf("%d", (int)data);
+ else
+ printf("%u", data);
+ if (hexdump)
+ printf(" [0x%x]", data);
+ h->pos += h->report_size;
+ }
+ h->pos = pos;
+}
+
+static void
+dumpdata(int f, report_desc_t rd, int loop)
+{
+ struct variable *var;
+ int dlen, havedata, i, match, r, rid, use_rid;
+ u_char *dbuf;
+ enum hid_kind kind;
+
+ kind = zflag ? 3 : 0;
+ rid = -1;
+ use_rid = !!hid_get_report_id(f);
+ do {
+ if (kind < 3) {
+ if (++rid >= 256) {
+ rid = 0;
+ kind++;
+ }
+ if (kind >= 3)
+ rid = -1;
+ for (var = vars; var; var = var->next) {
+ if (rid == var->h.report_ID &&
+ kind == var->h.kind)
+ break;
+ }
+ if (var == NULL)
+ continue;
+ }
+ dlen = hid_report_size(rd, kind < 3 ? kind : hid_input, rid);
+ if (dlen <= 0)
+ continue;
+ dbuf = malloc(dlen);
+ memset(dbuf, 0, dlen);
+ if (kind < 3) {
+ dbuf[0] = rid;
+ r = hid_get_report(f, kind, dbuf, dlen);
+ if (r < 0)
+ warn("hid_get_report(rid %d)", rid);
+ havedata = !r && (rid == 0 || dbuf[0] == rid);
+ if (rid != 0)
+ dbuf[0] = rid;
+ } else {
+ r = read(f, dbuf, dlen);
+ if (r < 1)
+ err(1, "read error");
+ havedata = 1;
+ }
+ if (verbose) {
+ printf("Got %s report %d (%d bytes):",
+ kind == hid_output ? "output" :
+ kind == hid_feature ? "feature" : "input",
+ use_rid ? dbuf[0] : 0, dlen);
+ if (havedata) {
+ for (i = 0; i < dlen; i++)
+ printf(" %02x", dbuf[i]);
+ }
+ printf("\n");
+ }
+ match = 0;
+ for (var = vars; var; var = var->next) {
+ if ((kind < 3 ? kind : hid_input) != var->h.kind)
+ continue;
+ if (var->h.report_ID != 0 &&
+ dbuf[0] != var->h.report_ID)
+ continue;
+ match = 1;
+ if (!noname)
+ printf("%s=", var->name);
+ if (havedata)
+ prdata(dbuf, &var->h);
+ printf("\n");
+ }
+ if (match)
+ printf("\n");
+ free(dbuf);
+ } while (loop || kind < 3);
+}
+
+static void
+writedata(int f, report_desc_t rd)
+{
+ struct variable *var;
+ int dlen, i, r, rid;
+ u_char *dbuf;
+ enum hid_kind kind;
+
+ kind = 0;
+ rid = 0;
+ for (kind = 0; kind < 3; kind ++) {
+ for (rid = 0; rid < 256; rid ++) {
+ for (var = vars; var; var = var->next) {
+ if (rid == var->h.report_ID && kind == var->h.kind)
+ break;
+ }
+ if (var == NULL)
+ continue;
+ dlen = hid_report_size(rd, kind, rid);
+ if (dlen <= 0)
+ continue;
+ dbuf = malloc(dlen);
+ memset(dbuf, 0, dlen);
+ dbuf[0] = rid;
+ if (!zflag && hid_get_report(f, kind, dbuf, dlen) == 0) {
+ if (verbose) {
+ printf("Got %s report %d (%d bytes):",
+ kind == hid_input ? "input" :
+ kind == hid_output ? "output" : "feature",
+ rid, dlen);
+ for (i = 0; i < dlen; i++)
+ printf(" %02x", dbuf[i]);
+ printf("\n");
+ }
+ } else if (!zflag) {
+ warn("hid_get_report(rid %d)", rid);
+ if (verbose) {
+ printf("Can't get %s report %d (%d bytes). "
+ "Will be initialized with zeros.\n",
+ kind == hid_input ? "input" :
+ kind == hid_output ? "output" : "feature",
+ rid, dlen);
+ }
+ }
+ for (var = vars; var; var = var->next) {
+ if (rid != var->h.report_ID || kind != var->h.kind)
+ continue;
+ hid_set_data(dbuf, &var->h, var->val);
+ }
+ if (verbose) {
+ printf("Setting %s report %d (%d bytes):",
+ kind == hid_output ? "output" :
+ kind == hid_feature ? "feature" : "input",
+ rid, dlen);
+ for (i = 0; i < dlen; i++)
+ printf(" %02x", dbuf[i]);
+ printf("\n");
+ }
+ r = hid_set_report(f, kind, dbuf, dlen);
+ if (r != 0)
+ warn("hid_set_report(rid %d)", rid);
+ free(dbuf);
+ }
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ report_desc_t r;
+ char *table = 0;
+ char devnam[100], *dev = NULL;
+ int f;
+ int all = 0;
+ int ch;
+ int repdump = 0;
+ int loop = 0;
+
+ while ((ch = getopt(argc, argv, "af:lnrt:vwxz")) != -1) {
+ switch(ch) {
+ case 'a':
+ all++;
+ break;
+ case 'f':
+ dev = optarg;
+ break;
+ case 'l':
+ loop ^= 1;
+ break;
+ case 'n':
+ noname++;
+ break;
+ case 'r':
+ repdump++;
+ break;
+ case 't':
+ table = optarg;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'w':
+ wflag = 1;
+ break;
+ case 'x':
+ hexdump = 1;
+ break;
+ case 'z':
+ zflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (dev == NULL)
+ usage();
+
+ if (argc == 0 && !all && !repdump)
+ usage();
+
+ if (dev[0] != '/') {
+ if (isdigit(dev[0]))
+ snprintf(devnam, sizeof(devnam), "/dev/uhid%s", dev);
+ else
+ snprintf(devnam, sizeof(devnam), "/dev/%s", dev);
+ dev = devnam;
+ }
+
+ hid_init(table);
+
+ f = open(dev, O_RDWR);
+ if (f < 0)
+ err(1, "%s", dev);
+
+ r = hid_get_report_desc(f);
+ if (r == 0)
+ errx(1, "USB_GET_REPORT_DESC");
+
+ if (repdump) {
+ printf("Report descriptor:\n");
+ dumpitems(r);
+ }
+ if (argc != 0 || all) {
+ parceargs(r, all, argc, argv);
+ if (wflag)
+ writedata(f, r);
+ else
+ dumpdata(f, r, loop);
+ }
+
+ hid_dispose_report_desc(r);
+ exit(0);
+}
diff --git a/usr.bin/usbhidctl/usbhidctl.1 b/usr.bin/usbhidctl/usbhidctl.1
new file mode 100644
index 0000000..6ee9785
--- /dev/null
+++ b/usr.bin/usbhidctl/usbhidctl.1
@@ -0,0 +1,151 @@
+.\" $NetBSD: usbhidctl.1,v 1.8 1999/05/11 21:03:58 augustss Exp $
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd August 1, 2011
+.Dt USBHIDCTL 1
+.Os
+.Sh NAME
+.Nm usbhidctl
+.Nd manipulate USB HID devices
+.Sh SYNOPSIS
+.Nm
+.Fl f Ar device
+.Op Fl t Ar table
+.Op Fl v
+.Op Fl x
+.Fl r
+.Nm
+.Fl f Ar device
+.Op Fl t Ar table
+.Op Fl l
+.Op Fl v
+.Op Fl x
+.Op Fl z
+.Fl a
+.Nm
+.Fl f Ar device
+.Op Fl t Ar table
+.Op Fl l
+.Op Fl n
+.Op Fl v
+.Op Fl x
+.Op Fl z
+.Ar item ...
+.Nm
+.Fl f Ar device
+.Op Fl t Ar table
+.Op Fl v
+.Op Fl z
+.Fl w
+.Ar item=value ...
+.Sh DESCRIPTION
+The
+.Nm
+utility can be used to dump and modify the state of a USB HID (Human
+Interface Device).
+Each named
+.Ar item
+is printed.
+If the
+.Fl w
+flag is specified
+.Nm
+attempts to set the specified items to the given values.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Show all items and their current values if device returns.
+.It Fl f Ar device
+Specify a path name for the device to operate on.
+.It Fl l
+Loop and dump the device data every time it changes.
+.It Fl n
+Suppress printing of the item name.
+.It Fl r
+Dump the report descriptor.
+.It Fl t Ar table
+Specify a path name for the HID usage table file.
+.It Fl v
+Be verbose.
+.It Fl w
+Change item values.
+Only 'output' and 'feature' kinds can be set with this option.
+.It Fl x
+Dump data in hexadecimal as well as decimal.
+.It Fl z
+Reset reports to zero before processing other arguments.
+If not specified, current values will be requested from device.
+.El
+.Sh SYNTAX
+.Nm
+compares the names of items specified on the command line against the human
+interface items reported by the USB device.
+Each human interface item is mapped from its native form to a human readable
+name, using the HID usage table file.
+Command line items are compared with the generated item names,
+and the USB HID device is operated on when a match is found.
+.Pp
+Each human interface item is named by the
+.Qq page
+it appears in, the
+.Qq usage
+within that page, and the list of
+.Qq collections
+containing the item.
+Each collection in turn is also identified by page, and
+the usage within that page.
+.Pp
+On the
+.Nm
+command line the page name is separated from the usage name with the character
+.Sq Cm \&: .
+The collections are separated by the character
+.Sq Cm \&. .
+.Pp
+Some devices give the same name to more than one item.
+.Nm
+supports isolating each item by appending a
+.Sq Cm \&# .
+character and a decimal item instance number, starting at zero.
+.Sh FILES
+.Bl -tag -width 30n
+.It Pa /usr/share/misc/usb_hid_usages
+The default HID usage table.
+.El
+.Sh SEE ALSO
+.Xr usbhid 3 ,
+.Xr uhid 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Nx 1.4 .
diff --git a/usr.bin/users/Makefile b/usr.bin/users/Makefile
new file mode 100644
index 0000000..dd04a11
--- /dev/null
+++ b/usr.bin/users/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+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
new file mode 100644
index 0000000..b602708
--- /dev/null
+++ b/usr.bin/users/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libcxxrt \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/users/users.1 b/usr.bin/users/users.1
new file mode 100644
index 0000000..53252e5
--- /dev/null
+++ b/usr.bin/users/users.1
@@ -0,0 +1,57 @@
+.\" Copyright (c) 1980, 1990, 1991, 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.
+.\"
+.\" @(#)users.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2010
+.Dt USERS 1
+.Os
+.Sh NAME
+.Nm users
+.Nd list current users
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility lists the login names of the users currently on the system,
+in sorted order, space separated, on a single line.
+.Sh FILES
+.Bl -tag -width /var/run/utx.active
+.It Pa /var/run/utx.active
+.El
+.Sh SEE ALSO
+.Xr finger 1 ,
+.Xr last 1 ,
+.Xr who 1 ,
+.Xr getutxent 3
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/users/users.cc b/usr.bin/users/users.cc
new file mode 100644
index 0000000..914888d
--- /dev/null
+++ b/usr.bin/users/users.cc
@@ -0,0 +1,65 @@
+/*-
+ * 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
+ * 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.
+ */
+
+#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();
+
+ 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/uudecode/Makefile b/usr.bin/uudecode/Makefile
new file mode 100644
index 0000000..7063d6f
--- /dev/null
+++ b/usr.bin/uudecode/Makefile
@@ -0,0 +1,14 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= uudecode
+LINKS= ${BINDIR}/uudecode ${BINDIR}/b64decode
+MAN=
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/uudecode/Makefile.depend b/usr.bin/uudecode/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/uudecode/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/uudecode/tests/Makefile b/usr.bin/uudecode/tests/Makefile
new file mode 100644
index 0000000..6c23c81
--- /dev/null
+++ b/usr.bin/uudecode/tests/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.base64.in
+${PACKAGE}FILES+= regress.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.traditional.in
+
+.include <bsd.test.mk>
diff --git a/usr.bin/uudecode/tests/Makefile.depend b/usr.bin/uudecode/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/uudecode/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/uudecode/tests/legacy_test.sh b/usr.bin/uudecode/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/uudecode/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/uudecode/tests/regress.base64.in b/usr.bin/uudecode/tests/regress.base64.in
new file mode 100644
index 0000000..3a8bfc2
--- /dev/null
+++ b/usr.bin/uudecode/tests/regress.base64.in
@@ -0,0 +1,88 @@
+begin-base64 644 regress.out
+dB745nc7bs6q4W24dCU/WprFX3UkvTwO6wlHiV+L4U+QEH1p/P9WjgFZ0MSGI2lE
+TCIH+3j4oqf3JJA/uvQ2WnWzCjFXG17cZpBq8UQGMh/e8QLyahMOTrrHP9Cf2ZE9
+WtybokTG8E2Ft0QrfiTsIpcUPMd7VDRvCQGLD+t6bqJkPJKaGmXXCwLwLz2WpAOX
+RW+d4UhnCnB0aBs7IByd6beMYwQxIcM4XvyAnG1z3XK9gCwvIwzI6wYYzXCIAo/K
+pP90oNA6ijFYYNK3s/uttytzC5QfKn6gaVerwYcb1QQHqyrxoryOrjwgwgazSfwL
+hDK1fLejnpTXL1Uh2j9E+pM0WSftA0wX1tdyKxy7kUarWzEACH8htTSd3NDamR/2
+T66xNHPYZhW31cjeNTX0czIfpRWBbBQI3rc5yhWZlGA0j8X8zQR4puaGpQ6QNnbB
+QkSU4Ak+pveRT8JuFbJVQI6WHemB7H9LV5CSYVCoZ2iOFA/Z8PSM473XXjqBk/M1
+Zz4irDw8V1tBp519qNgXFt52fdrkbzJCa+71pfAuP2LsytpAd2LUJwhgiV7uj6cx
+4DjEfdd/QYdcJGDm435wfsniPoPnrghEJdqfgWIvaFNpuoQ9ByrznWacs50AQFxy
+ZpfAaLJnGNiPehTOosTT6dPOKp8x2ms6mdkr2neZ0I0leoNHxCBKvgUxC0uFieo6
+GLpussFEB8QeCsy1mjnXDI1qsC2Sp34PZTvR5apH29FB1eIeAPFZMkFxO2TTs0Y4
+q3yKDcPGHaAdPy8J64UpyBlO3rbcLyqEbKcuSHHd69iT/5mD4arbyYHMY6S7S7QP
+DHpH1x8Woo5xMo0MVkmBGbKc5Sy4J37T8xjj4h0pcKvEdCSanJ2A1E2jHzpfbe8u
+/NSxpB49+JGYGJ2nsgpsKzwTXabgKDZPydqcAIpNXnAdsQBNskmzBYb8959xCzws
+ybQ7+0g4a0DYyLDcnW2NH/OCYHvkOgyM72FQJAXGg61GnZZiAjSlrqsPX2NVUtXi
+vRrueFSG5rYnYJvO2OfhwgEfxTY8b7x8AFQntBvaKqG5rWC+a2d+4Xj0B2ODy+/M
+5Hppj0dNwpLPKHa8UH6IDd+m0Aql5u5oCbh+WIDovGtN2BpkyCq00M/kKErTbTT+
+qfuWSDow0ZjLeFdSErUtdi1tKhDh5oy5Ev+ShLywKPm4/NfJ3CLhbZSvhOWWxwzf
+KEgMCnHNd8uc3JIDNM7c3Dm5w0QrD0AObOUSBF8iouNBjMvdUviIBVFPeVkZ3xYs
+TciSRJm/fB5QNhrcYRMbZJ5iOVHuuOxFw+zPoEIjVBPO1wXZgsSwgFED20bKLcOv
+SnWGM3IyNZVKqdo3a4oh4H4Lv/y6rMrtSTr7kQJlwEvU6WiyvtQob/fMdHWIbc/W
+RPR47l6JDz4V3AUqPcF3Jy6RaNUKRvFi+7cOWYBKbNFRmE/jA6dyUuVkCYIMDuhu
+I7iQL0u4l//xbdGb9RWtf8WHs/N5nmWi1TLTPbaDz8GBPOMOecpeIfqDVoPqaheq
+GT4fJj3sVBhq6zayVfNpueaEdHb/XTGm9NHS4xsgpbfL/sJw6IVJj3/dgb0RfX90
+ZUgfDvwURsTNvxAVzKuuuH6wrE8AGOpBLgomMZ5UZcgWkeRNjTqcelCsl3JhBIuU
+mJMbYI2SMv/CK+nkIYcIE7zHRaCyF8ngNYosop/chz1o1gTP2Di6NTq4a/SX0h1z
+7fykkKt2pLJvSOA8nccRIUrix5/GTQwhJxMaoR5WQUDVUPHx0c8xRNTTI24bGeik
+G4qKq74bpmZvbZrnsSjQJyLiQiPtraGR8YiI2JwGZmHbama9DPjOKV3bBWT6LgR2
+LEEI0G7BZiSGP4lniTkpOR/FUgp8WmblvhOeZY+KDTamifrq0NhjYIUYWGbZEOUi
+6ImSbiVH/gm4tk+kyAT1uSuK4lTUCWK7XO5I6WLCY2g4v7nYTDNUv/nbJLzai1GQ
+PLz3p0biVq3QwkIf+rZSsTirEIHMTeAxjdfWICDIcPSsxRZgvurgnIAodzIR9RkA
+nsoe4cLvh9SxDNrmlyWDsczkUsc9eG9rr5HH73KOr6wx2CUFug/naqnDBSzEI3H+
+cz12m9X8ATzpH0BT8cFvDE/KKiou+qWWtgLWTwnRoRBmBZVgOHCmQghz5bVgzUyg
+xxQFnYCTD9D5S3d2ndwuHJL3IesR/a+Oq5M4ORktsLMaOGJ7x3obRM6gEtuwpJ1E
+wxfGr/cYrc/QsBFoQfL9LgrcvHLgmE6mazXdF9NfBWiPZhTjFurcB0wD3PqlCrhc
+vsVP9cugGxA1pQ96MywYL2G0yyM1GrRIbiWG4y7y82+0mQSL9xG6G0StzkfWp5rr
+L8psGo/CFPr/8CXz+6tP/pNUp40NqcMVlOicMozUEHalgUe+581gu0GUI+IritwO
+SPM2hc+woGvFQ6WvY3S77fT7gkpnVuRjiSBlvSkV+2Iujs6++ErDKcIjD9j88StJ
+8xySXDZr9vIDLkT+YZIxg+v/CcP4C0tSbwAQNjoS9kpbMQK4YucSAuXIzIZngJHz
+38iU+2I+mzhPKChNi5/MxP0TjK63RqjKsIuJC9OD3c84n7TGXnvC1QqDF4TKYR2z
+Es7UjlyQVOD3HrtixAJP8ubmUQOrbIY2imR9xqUf2SWl8sCYaM6b9E00Wnnj0x2x
+pfZKE+IvarSRiTRgNBp2S7K1u9NTtj+9A67xWPwpBCPcIsyDP4CItCzMoybyqbn3
+rM3RSiygpIj901FlNab/mUi+borZDvXZgcOlhZjUJnhUjiEhuMfpOxYG//hkj/dW
+d3Dg9gaLVriLVZOfl5wUZT1d8W6rN3RQ+jT42pm2hLhE4picD5GEOYOcTf4rolSx
+2IlgK4w4fb77Iqk35/7kC203b9OFzgzIN2MMfY1C50MRJQT5B7qmKva33MjEaPzb
+IxipHCd2wAMzTJHMCShK1qiQ60aki8suOO6RWDiDAdnpzzjnDFhMyL+if5pBgZct
+nfvKvvsxAEWlyOZHcwXBu/v+2Gg5cWFr8e5GtvxmQzK0CamIba1xl5UTiZDeb6bM
+0uKZewkY1okt5lYGVYDL/vdhH2FePzSHB42RbcetO/3J113wvGjPVWz0F5hgoO+H
+T0Rq31vpZ47oK83UvOdDzRTyudiMKyf3VCVEzhqunT/QfyPp5Q7UgSOu0fcY/iap
+wxwUtqeBLUfiDo4vHSeswfAb3b8dcPPpYdjLKU80trpChkV37UyXY0wVFSiAiVOe
+WgWSGa0ABkxF/pNr/OztK1Ms2omJxBulK/FhXHtrog6xFW/QcPcGM0TXILUHJ8Gp
+XTckydbsTCW7Itv59MrY5G/3ps62AOJmcojjQ3kNsJ2UA64/u06RtK8GaP8q3X1z
+eFmikqD+jEIQlpnx1oy/aSOc0P7U9DtWe5MrloS2hHovHkad/se3GiZkgmfFRfqr
+cC+6giz4cjwTj/yEjpto3VOXnXcPycmuXFPjUlDkLBI6RaegecWd+OaQhCe0iut+
+g64p+e6j2wNaDXa64XgU6HEaXwTgaHENJCQ3GNDl79k1umU0efn5PeFJiNDdg1UB
+foaob/WFuE+FT2Ns6rmLocAG9XeXNX8U2l3eIleCQHzkhfXluFFgLQnqFpPGay3W
+liEQrZ1/J2o5yx2YE/OJMi3bvnP3JB1mdMPbgd5ulrwcbCOCe0t/qjTxLQzunP5A
++S7uaweW4iBuDjGiSGPIDH7CPpYQRl+JAj1TYdP1rQ6LpG57cr+NsbyODFEN+DSu
+yOPiu0z5BmMqb1SQcZ3v2MWyYg+n3Lqai+CX96c0lpL8U2SG7ARnkbmMrQVzD5dw
+KxnZuk4yvkrSAX0y4kN7mpWuuMDKw/h5NbCXUM1OsgjZ3NW8gsj2FYt3f7RSgOeX
+/lpLuakHMlYgYDyzXnWL8VuwG7gEN/nJLoym7w2OhTFF/l7xilkflZJ3rcGvxbi9
+gJOsuCKz2oI1ujxJHR5fIX0HSkv7R4464jiK+GUNnbe7QmbBWLoo8Y524u70j5QJ
+sd9ZLcTkwAJdW/u/qUXOjbThd8TLsuwDSTMeQj210Lmq3eYy5Np8GRjxQkOXpp0J
+fkEHrkHb5+s1I9v2AhAxQ6RUOuvORLuEoid4RkpFM1kwTV1vQplg7VmLvPjpE1JZ
+3AbAvKdeqsPsJJVwU+q7Jbw3dVa8M0ZtqS4FCGk1C/4jlobxsakncIxP/haAz7oc
+0IeEFyMzNqu6xjHKqCh9WaqHQpXf1JgJrrV6e+j7Ygh3CsqlSzW6jbSDyxFeKlUx
+pMYHebEJSebLKOKE0mfubsGqizJFOKRPkYr1bQ1/u5P6FNEr0sGQ7lS7BEGRhchJ
+g17bXD9moD2CeJZ2QJYj+YMqjYHk/W6ufHVVHc0pF5jV6/lVMsIYeQ8l3YhI/1hB
++1An/yFOvVgNonYJVd8MohaVPCD+dZUV3M+S76YRiGVniidGQWl5Y6PYzlEqEuM5
+FWftt9dSLVYhXhbABzcfN7mzoCZjyZEv+ZgUv9ipeaSUW0SZ+6iFv/abw7FkZSl4
+5B88ETP2LqClT21/yd69ZyGfdp3FR9daqKrjVjvCFu98zyHTsdR+OF8bsaI280iz
+3WKdXum+iiuadf66GIsjtIyqUQqog74Ji+VKP/xIgOBAFB4ktVULAypA+NsRNwYA
+IBDEa7EMiDduUPQ/9uavMN/F9Jf1POW4MljbH7C66NisM+/3YJ4l4Um2iXQPq9yp
+G6c0AJjzgL6/XtWhFnki1jJYvEJ9IkWvlL650zgXzEvEEOWI6TaQSwrrSh2UTD6a
+fJPCRsymB1rBEWb1FRVsidkr+/rFFL7D3QsDr+EWFesj5ItbABOPNt5w0obx0mKg
+WoKuZaklnqJvJT7JUdVRZQ6ei4JksMnIs+muEl7ouM1OM/e2VM5JRI+2MO4/1Sy9
+brEj3xY0pRYfXJxzNZsIepyKB8T2NoWfvOomcCXlYNz3rIRRVPWgxsV6kqTJuFo+
+Ypu+A7Q8P2AWDfssP2vaHvphJmk5OwUAq4LljFbo6KlC932c6cljUhTRukRsFfz5
+JoYf1dcdgcPg5YGX4qpUuqCGiT99dSIQ/WhCL6n4gLV/IXb5BuMbrmHvx1xVVbiT
+h8S4MjNNqv6zpLumJr8qI7sFfPLDYhm7erthjGYmVnG3n7eEeAu/QU2CJl4kHMoS
+FoRanXJ+o4tprVlrRQ0whlADoNK8swogk2vGtYqqCfYAHuh/aGtETA/vqZI71/j9
+4nDd8YH1hVyf5GI/QvkuqZiLeZKUIrNj03jHio8oHWrim1mBlRhWo/947ac6xHOq
+FqBufMZIC1f2zvHvav1Cu7Y6kAoKsn4h4gTjKw25SImYWL4Lx8GUsVWKl+pm8rEJ
+3NTh6I2Q6vt1EmfP2Oot56oUci+u8WtQ8wvEaoYWWWqKghPp9piEsfHTETmievN5
+8OKlLHwxWbE7xE7teDcAZw==
+====
diff --git a/usr.bin/uudecode/tests/regress.out b/usr.bin/uudecode/tests/regress.out
new file mode 100644
index 0000000..fa0dd08
--- /dev/null
+++ b/usr.bin/uudecode/tests/regress.out
Binary files differ
diff --git a/usr.bin/uudecode/tests/regress.sh b/usr.bin/uudecode/tests/regress.sh
new file mode 100644
index 0000000..3aeb04d
--- /dev/null
+++ b/usr.bin/uudecode/tests/regress.sh
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+echo 1..2
+
+REGRESSION_START($1)
+
+REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.traditional.in', `traditional')
+REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.base64.in', `base64')
+
+REGRESSION_END()
diff --git a/usr.bin/uudecode/tests/regress.traditional.in b/usr.bin/uudecode/tests/regress.traditional.in
new file mode 100644
index 0000000..da81415
--- /dev/null
+++ b/usr.bin/uudecode/tests/regress.traditional.in
@@ -0,0 +1,95 @@
+begin 644 regress.out
+M=![XYG<[;LZJX6VX="4_6IK%7W4DO3P.ZPE'B5^+X4^0$'UI_/]6C@%9T,2&
+M(VE$3"('^WCXHJ?W))`_NO0V6G6S"C%7&U[<9I!J\40&,A_>\0+R:A,.3KK'
+M/]"?V9$]6MR;HD3&\$V%MT0K?B3L(I<4/,=[5#1O"0&+#^MZ;J)D/)*:&F77
+M"P+P+SV6I`.716^=X4AG"G!T:!L[(!R=Z;>,8P0Q(<,X7OR`G&USW7*]@"PO
+M(PS(ZP88S7"(`H_*I/]TH-`ZBC%88-*WL_NMMRMS"Y0?*GZ@:5>KP8<;U00'
+MJRKQHKR.KCP@P@:S2?P+A#*U?+>CGI37+U4AVC]$^I,T62?M`TP7UM=R*QR[
+MD4:K6S$`"'\AM32=W-#:F1_V3ZZQ-'/89A6WU<C>-37T<S(?I16!;!0(WK<Y
+MRA69E&`TC\7\S01XIN:&I0Z0-G;!0D24X`D^IO>13\)N%;)50(Z6'>F![']+
+M5Y"285"H9VB.%`_9\/2,X[W77CJ!D_,U9SXBK#P\5UM!IYU]J-@7%MYV?=KD
+M;S)":^[UI?`N/V+LRMI`=V+4)PA@B5[NCZ<QX#C$?==_08=<)&#FXWYP?LGB
+M/H/GK@A$)=J?@6(O:%-INH0]!RKSG6:<LYT`0%QR9I?`:+)G&-B/>A3.HL33
+MZ=/.*I\QVFLZF=DKVG>9T(TE>H-'Q"!*O@4Q"TN%B>HZ&+INLL%$!\0>"LRU
+MFCG7#(UJL"V2IWX/93O1Y:I'V]%!U>(>`/%9,D%Q.V33LT8XJWR*#</&':`=
+M/R\)ZX4IR!E.WK;<+RJ$;*<N2''=Z]B3_YF#X:K;R8',8Z2[2[0/#'I'UQ\6
+MHHYQ,HT,5DF!&;*<Y2RX)W[3\QCCXATI<*O$="2:G)V`U$VC'SI?;>\N_-2Q
+MI!X]^)&8&)VGL@IL*SP37:;@*#9/R=J<`(I-7G`=L0!-LDFS!8;\]Y]Q"SPL
+MR;0[^T@X:T#8R+#<G6V-'_."8'OD.@R,[V%0)`7&@ZU&G99B`C2EKJL/7V-5
+M4M7BO1KN>%2&YK8G8)O.V.?AP@$?Q38\;[Q\`%0GM!O:*J&YK6"^:V=^X7CT
+M!V.#R^_,Y'IICT=-PI+/*':\4'Z(#=^FT`JEYNYH";A^6(#HO&M-V!IDR"JT
+MT,_D*$K3;33^J?N62#HPT9C+>%=2$K4M=BUM*A#AYHRY$O^2A+RP*/FX_-?)
+MW"+A;92OA.66QPS?*$@,"G'-=\N<W)(#-,[<W#FYPT0K#T`.;.42!%\BHN-!
+MC,O=4OB(!5%/>5D9WQ8L3<B21)F_?!Y0-AK<81,;9)YB.5'NN.Q%P^S/H$(C
+M5!/.UP79@L2P@%$#VT;*+<.O2G6&,W(R-95*J=HW:XHAX'X+O_RZK,KM23K[
+MD0)EP$O4Z6BROM0H;_?,='6(;<_61/1X[EZ)#SX5W`4J/<%W)RZ1:-4*1O%B
+M^[<.68!*;-%1F$_C`Z=R4N5D"8(,#NAN([B0+TNXE__Q;=&;]16M?\6'L_-Y
+MGF6BU3+3/;:#S\&!/.,.><I>(?J#5H/J:A>J&3X?)CWL5!AJZS:R5?-IN>:$
+M=';_73&F]-'2XQL@I;?+_L)PZ(5)CW_=@;T1?7]T94@?#OP41L3-OQ`5S*NN
+MN'ZPK$\`&.I!+@HF,9Y49<@6D>1-C3J<>E"LEW)A!(N4F),;8(V2,O_"*^GD
+M(8<($[S'1:"R%\G@-8HLHI_<ASUHU@3/V#BZ-3JX:_27TAUS[?RDD*MVI+)O
+M2.`\G<<1(4KBQY_&30PA)Q,:H1Y604#54/'QT<\Q1-33(VX;&>BD&XJ*J[X;
+MIF9O;9KGL2C0)R+B0B/MK:&1\8B(V)P&9F';:F:]#/C.*5W;!63Z+@1V+$$(
+MT&[!9B2&/XEGB3DI.1_%4@I\6F;EOA.>98^*#3:FB?KJT-AC8(486&;9$.4B
+MZ(F2;B5'_@FXMD^DR`3UN2N*XE34"6*[7.Y(Z6+"8V@XO[G83#-4O_G;)+S:
+MBU&0/+SWIT;B5JW0PD(?^K92L3BK$(',3>`QC=?6("#(</2LQ19@ONK@G(`H
+M=S(1]1D`GLH>X<+OA]2Q#-KFER6#L<SD4L<]>&]KKY''[W*.KZPQV"4%N@_G
+M:JG#!2S$(W'^<SUVF]7\`3SI'T!3\<%O#$_**BHN^J66M@+63PG1H1!F!95@
+M.'"F0@ASY;5@S4R@QQ0%G8"3#]#Y2W=VG=PN')+W(>L1_:^.JY,X.1DML+,:
+M.&)[QWH;1,Z@$MNPI)U$PQ?&K_<8K<_0L!%H0?+]+@K<O'+@F$ZF:S7=%]-?
+M!6B/9A3C%NK<!TP#W/JE"KA<OL5/]<N@&Q`UI0]Z,RP8+V&TRR,U&K1(;B6&
+MXR[R\V^TF02+]Q&Z&T2MSD?6IYKK+\IL&H_"%/K_\"7S^ZM/_I-4IXT-J<,5
+ME.B<,HS4$':E@4>^Y\U@NT&4(^(KBMP.2/,VA<^PH&O%0Z6O8W2[[?3[@DIG
+M5N1CB2!EO2D5^V(NCLZ^^$K#*<(C#]C\\2M)\QR27#9K]O(#+D3^89(Q@^O_
+M"</X"TM2;P`0-CH2]DI;,0*X8N<2`N7(S(9G@)'SW\B4^V(^FSA/*"A-BY_,
+MQ/T3C*ZW1JC*L(N)"].#W<\XG[3&7GO"U0J#%X3*81VS$L[4CER05.#W'KMB
+MQ`)/\N;F40.K;(8VBF1]QJ4?V26E\L"8:,Z;]$TT6GGCTQVQI?9*$^(O:K21
+MB31@-!IV2[*UN]-3MC^]`Z[Q6/PI!"/<(LR#/X"(M"S,HR;RJ;GWK,W12BR@
+MI(C]TU%E-:;_F4B^;HK9#O79@<.EA9C4)GA4CB$AN,?I.Q8&__ADC_=6=W#@
+M]@:+5KB+59.?EYP493U=\6ZK-W10^C3XVIFVA+A$XIB<#Y&$.8.<3?XKHE2Q
+MV(E@*XPX?;[[(JDWY_[D"VTW;].%S@S(-V,,?8U"YT,1)03Y![JF*O:WW,C$
+M:/S;(QBI'"=VP`,S3)',"2A*UJB0ZT:DB\LN..Z16#B#`=GISSCG#%A,R+^B
+M?YI!@9<MG?O*OOLQ`$6ER.9'<P7!N_O^V&@Y<6%K\>Y&MOQF0S*T":F(;:UQ
+MEY43B9#>;Z;,TN*9>PD8UHDMYE8&58#+_O=A'V%>/S2'!XV1;<>M._W)UUWP
+MO&C/56ST%YA@H.^'3T1JWUOI9X[H*\W4O.=#S13RN=B,*R?W5"5$SAJNG3_0
+M?R/IY0[4@2.NT?<8_B:IPQP4MJ>!+4?B#HXO'2>LP?`;W;\=<//I8=C+*4\T
+MMKI"AD5W[4R78TP5%2B`B5.>6@62&:T`!DQ%_I-K_.SM*U,LVHF)Q!NE*_%A
+M7'MKH@ZQ%6_0</<&,T37(+4')\&I73<DR=;L3"6[(MOY],K8Y&_WILZV`.)F
+M<HCC0WD-L)V4`ZX_NTZ1M*\&:/\JW7US>%FBDJ#^C$(0EIGQUHR_:2.<T/[4
+M]#M6>Y,KEH2VA'HO'D:=_L>W&B9D@F?%1?JK<"^Z@BSX<CP3C_R$CIMHW5.7
+MG7</R<FN7%/C4E#D+!(Z1:>@><6=^.:0A">TBNM^@ZXI^>ZCVP-:#7:ZX7@4
+MZ'$:7P3@:'$-)"0W&-#E[]DUNF4T>?GY/>%)B-#=@U4!?H:H;_6%N$^%3V-L
+MZKF+H<`&]7>7-7\4VEW>(E>"0'SDA?7EN%%@+0GJ%I/&:RW6EB$0K9U_)VHY
+MRQV8$_.),BW;OG/W)!UF=,/;@=YNEKP<;".">TM_JC3Q+0SNG/Y`^2[N:P>6
+MXB!N#C&B2&/(#'["/I801E^)`CU38=/UK0Z+I&Y[<K^-L;R.#%$-^#2NR./B
+MNTSY!F,J;U20<9WOV,6R8@^GW+J:B^"7]Z<TEI+\4V2&[`1GD;F,K05S#Y=P
+M*QG9NDXRODK2`7TRXD-[FI6NN,#*P_AY-;"74,U.L@C9W-6\@LCV%8MW?[12
+M@.>7_EI+N:D',E8@8#RS7G6+\5NP&[@$-_G)+HRF[PV.A3%%_E[QBED?E9)W
+MK<&OQ;B]@).LN"*SVH(UNCQ)'1Y?(7T'2DO[1XXZXCB*^&4-G;>[0F;!6+HH
+M\8YVXN[TCY0)L=]9+<3DP`)=6_N_J47.C;3A=\3+LNP#23,>0CVUT+FJW>8R
+MY-I\&1CQ0D.7IIT)?D$'KD';Y^LU(]OV`A`Q0Z14.NO.1+N$HB=X1DI%,UDP
+M35UO0IE@[5F+O/CI$U)9W`;`O*=>JL/L))5P4^J[);PW=5:\,T9MJ2X%"&DU
+M"_XCEH;QL:DG<(Q/_A:`S[H<T(>$%R,S-JNZQC'*J"A]6:J'0I7?U)@)KK5Z
+M>^C[8@AW"LJE2S6ZC;2#RQ%>*E4QI,8'>;$)2>;+*.*$TF?N;L&JBS)%.*1/
+MD8KU;0U_NY/Z%-$KTL&0[E2[!$&1A<A)@U[;7#]FH#V">)9V0)8C^8,JC8'D
+M_6ZN?'55'<TI%YC5Z_E5,L(8>0\EW8A(_UA!^U`G_R%.O5@-HG8)5=\,HA:5
+M/"#^=945W,^2[Z81B&5GBB=&06EY8Z/8SE$J$N,Y%6?MM]=2+58A7A;`!S<?
+M-[FSH"9CR9$O^9@4O]BI>:246T29^ZB%O_:;P[%D92EXY!\\$3/V+J"E3VU_
+MR=Z]9R&?=IW%1]=:J*KC5CO"%N]\SR'3L=1^.%\;L:(V\TBSW6*=7NF^BBN:
+M=?ZZ&(LCM(RJ40JH@[X)B^5*/_Q(@.!`%!XDM54+`RI`^-L1-P8`(!#$:[$,
+MB#=N4/0_]N:O,-_%])?U/.6X,EC;'["ZZ-BL,^_W8)XEX4FVB70/J]RI&Z<T
+M`)CS@+Z_7M6A%GDBUC)8O$)](D6OE+ZYTS@7S$O$$.6(Z3:02PKK2AV43#Z:
+M?)/"1LRF!UK!$6;U%15LB=DK^_K%%+[#W0L#K^$6%>LCY(M;`!./-MYPTH;Q
+MTF*@6H*N9:DEGJ)O)3[)4=5190Z>BX)DL,G(L^FN$E[HN,U.,_>V5,Y)1(^V
+M,.X_U2R];K$CWQ8TI18?7)QS-9L(>IR*!\3V-H6?O.HF<"7E8-SWK(115/6@
+MQL5ZDJ3)N%H^8IN^`[0\/V`6#?LL/VO:'OIA)FDY.P4`JX+EC%;HZ*E"]WV<
+MZ<EC4A31ND1L%?SY)H8?U=<=@</@Y8&7XJI4NJ"&B3]]=2(0_6A"+ZGX@+5_
+M(7;Y!N,;KF'OQUQ55;B3A\2X,C--JOZSI+NF)K\J([L%?/+#8AF[>KMAC&8F
+M5G&WG[>$>`N_04V")EXD',H2%H1:G7)^HXMIK5EK10TPAE`#H-*\LPH@DVO&
+MM8JJ"?8`'NA_:&M$3`_OJ9([U_C]XG#=\8'UA5R?Y&(_0ODNJ9B+>9*4(K-C
+MTWC'BH\H'6KBFUF!E1A6H_]X[:<ZQ'.J%J!N?,9("U?VSO'O:OU"N[8ZD`H*
+MLGXAX@3C*PVY2(F86+X+Q\&4L56*E^IF\K$)W-3AZ(V0ZOMU$F?/V.HMYZH4
+M<B^N\6M0\PO$:H8666J*@A/I]IB$L?'3$3FB>O-Y\.*E+'PQ6;$[Q$[M>#<`
+!9P``
+`
+end
diff --git a/usr.bin/uudecode/uudecode.c b/usr.bin/uudecode/uudecode.c
new file mode 100644
index 0000000..2be5078
--- /dev/null
+++ b/usr.bin/uudecode/uudecode.c
@@ -0,0 +1,466 @@
+/*-
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)uudecode.c 8.2 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * uudecode [file ...]
+ *
+ * create the specified file, decoding as you go.
+ * used with uuencode.
+ */
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <pwd.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static const char *infile, *outfile;
+static FILE *infp, *outfp;
+static int base64, cflag, iflag, oflag, pflag, rflag, sflag;
+
+static void usage(void);
+static int decode(void);
+static int decode2(void);
+static int uu_decode(void);
+static int base64_decode(void);
+
+int
+main(int argc, char *argv[])
+{
+ int rval, ch;
+
+ if (strcmp(basename(argv[0]), "b64decode") == 0)
+ base64 = 1;
+
+ while ((ch = getopt(argc, argv, "cimo:prs")) != -1) {
+ switch (ch) {
+ case 'c':
+ if (oflag || rflag)
+ usage();
+ cflag = 1; /* multiple uudecode'd files */
+ break;
+ case 'i':
+ iflag = 1; /* ask before override files */
+ break;
+ case 'm':
+ base64 = 1;
+ break;
+ case 'o':
+ if (cflag || pflag || rflag || sflag)
+ usage();
+ oflag = 1; /* output to the specified file */
+ sflag = 1; /* do not strip pathnames for output */
+ outfile = optarg; /* set the output filename */
+ break;
+ case 'p':
+ if (oflag)
+ usage();
+ pflag = 1; /* print output to stdout */
+ break;
+ case 'r':
+ if (cflag || oflag)
+ usage();
+ rflag = 1; /* decode raw data */
+ break;
+ case 's':
+ if (oflag)
+ usage();
+ sflag = 1; /* do not strip pathnames for output */
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (*argv != NULL) {
+ rval = 0;
+ do {
+ infp = fopen(infile = *argv, "r");
+ if (infp == NULL) {
+ warn("%s", *argv);
+ rval = 1;
+ continue;
+ }
+ rval |= decode();
+ fclose(infp);
+ } while (*++argv);
+ } else {
+ infile = "stdin";
+ infp = stdin;
+ rval = decode();
+ }
+ exit(rval);
+}
+
+static int
+decode(void)
+{
+ int r, v;
+
+ if (rflag) {
+ /* relaxed alternative to decode2() */
+ outfile = "/dev/stdout";
+ outfp = stdout;
+ if (base64)
+ return (base64_decode());
+ else
+ return (uu_decode());
+ }
+ v = decode2();
+ if (v == EOF) {
+ warnx("%s: missing or bad \"begin\" line", infile);
+ return (1);
+ }
+ for (r = v; cflag; r |= v) {
+ v = decode2();
+ if (v == EOF)
+ break;
+ }
+ return (r);
+}
+
+static int
+decode2(void)
+{
+ int flags, fd, mode;
+ size_t n, m;
+ char *p, *q;
+ void *handle;
+ struct passwd *pw;
+ struct stat st;
+ char buf[MAXPATHLEN + 1];
+
+ base64 = 0;
+ /* search for header line */
+ for (;;) {
+ if (fgets(buf, sizeof(buf), infp) == NULL)
+ return (EOF);
+ p = buf;
+ if (strncmp(p, "begin-base64 ", 13) == 0) {
+ base64 = 1;
+ p += 13;
+ } else if (strncmp(p, "begin ", 6) == 0)
+ p += 6;
+ else
+ continue;
+ /* p points to mode */
+ q = strchr(p, ' ');
+ if (q == NULL)
+ continue;
+ *q++ = '\0';
+ /* q points to filename */
+ n = strlen(q);
+ while (n > 0 && (q[n-1] == '\n' || q[n-1] == '\r'))
+ q[--n] = '\0';
+ /* found valid header? */
+ if (n > 0)
+ break;
+ }
+
+ handle = setmode(p);
+ if (handle == NULL) {
+ warnx("%s: unable to parse file mode", infile);
+ return (1);
+ }
+ mode = getmode(handle, 0) & 0666;
+ free(handle);
+
+ if (sflag) {
+ /* don't strip, so try ~user/file expansion */
+ p = NULL;
+ pw = NULL;
+ if (*q == '~')
+ p = strchr(q, '/');
+ if (p != NULL) {
+ *p = '\0';
+ pw = getpwnam(q + 1);
+ *p = '/';
+ }
+ if (pw != NULL) {
+ n = strlen(pw->pw_dir);
+ if (buf + n > p) {
+ /* make room */
+ m = strlen(p);
+ if (sizeof(buf) < n + m) {
+ warnx("%s: bad output filename",
+ infile);
+ return (1);
+ }
+ p = memmove(buf + n, p, m);
+ }
+ q = memcpy(p - n, pw->pw_dir, n);
+ }
+ } else {
+ /* strip down to leaf name */
+ p = strrchr(q, '/');
+ if (p != NULL)
+ q = p + 1;
+ }
+ if (!oflag)
+ outfile = q;
+
+ /* POSIX says "/dev/stdout" is a 'magic cookie' not a special file. */
+ if (pflag || strcmp(outfile, "/dev/stdout") == 0)
+ outfp = stdout;
+ else {
+ flags = O_WRONLY | O_CREAT | O_EXCL;
+ if (lstat(outfile, &st) == 0) {
+ if (iflag) {
+ warnc(EEXIST, "%s: %s", infile, outfile);
+ return (0);
+ }
+ switch (st.st_mode & S_IFMT) {
+ case S_IFREG:
+ case S_IFLNK:
+ /* avoid symlink attacks */
+ if (unlink(outfile) == 0 || errno == ENOENT)
+ break;
+ warn("%s: unlink %s", infile, outfile);
+ return (1);
+ case S_IFDIR:
+ warnc(EISDIR, "%s: %s", infile, outfile);
+ return (1);
+ default:
+ if (oflag) {
+ /* trust command-line names */
+ flags &= ~O_EXCL;
+ break;
+ }
+ warnc(EEXIST, "%s: %s", infile, outfile);
+ return (1);
+ }
+ } else if (errno != ENOENT) {
+ warn("%s: %s", infile, outfile);
+ return (1);
+ }
+ if ((fd = open(outfile, flags, mode)) < 0 ||
+ (outfp = fdopen(fd, "w")) == NULL) {
+ warn("%s: %s", infile, outfile);
+ return (1);
+ }
+ }
+
+ if (base64)
+ return (base64_decode());
+ else
+ return (uu_decode());
+}
+
+static int
+get_line(char *buf, size_t size)
+{
+
+ if (fgets(buf, size, infp) != NULL)
+ return (2);
+ if (rflag)
+ return (0);
+ warnx("%s: %s: short file", infile, outfile);
+ return (1);
+}
+
+static int
+checkend(const char *ptr, const char *end, const char *msg)
+{
+ size_t n;
+
+ n = strlen(end);
+ if (strncmp(ptr, end, n) != 0 ||
+ strspn(ptr + n, " \t\r\n") != strlen(ptr + n)) {
+ warnx("%s: %s: %s", infile, outfile, msg);
+ return (1);
+ }
+ if (fclose(outfp) != 0) {
+ warn("%s: %s", infile, outfile);
+ return (1);
+ }
+ return (0);
+}
+
+static int
+uu_decode(void)
+{
+ int i, ch;
+ char *p;
+ char buf[MAXPATHLEN+1];
+
+ /* for each input line */
+ for (;;) {
+ switch (get_line(buf, sizeof(buf))) {
+ case 0:
+ return (0);
+ case 1:
+ return (1);
+ }
+
+#define DEC(c) (((c) - ' ') & 077) /* single character decode */
+#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
+
+#define OUT_OF_RANGE do { \
+ warnx("%s: %s: character out of range: [%d-%d]", \
+ infile, outfile, 1 + ' ', 077 + ' ' + 1); \
+ return (1); \
+} while (0)
+
+ /*
+ * `i' is used to avoid writing out all the characters
+ * at the end of the file.
+ */
+ p = buf;
+ if ((i = DEC(*p)) <= 0)
+ break;
+ for (++p; i > 0; p += 4, i -= 3)
+ if (i >= 3) {
+ if (!(IS_DEC(*p) && IS_DEC(*(p + 1)) &&
+ IS_DEC(*(p + 2)) && IS_DEC(*(p + 3))))
+ OUT_OF_RANGE;
+
+ ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4;
+ putc(ch, outfp);
+ ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
+ putc(ch, outfp);
+ ch = DEC(p[2]) << 6 | DEC(p[3]);
+ putc(ch, outfp);
+ } else {
+ if (i >= 1) {
+ if (!(IS_DEC(*p) && IS_DEC(*(p + 1))))
+ OUT_OF_RANGE;
+ ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4;
+ putc(ch, outfp);
+ }
+ if (i >= 2) {
+ if (!(IS_DEC(*(p + 1)) &&
+ IS_DEC(*(p + 2))))
+ OUT_OF_RANGE;
+
+ ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
+ putc(ch, outfp);
+ }
+ if (i >= 3) {
+ if (!(IS_DEC(*(p + 2)) &&
+ IS_DEC(*(p + 3))))
+ OUT_OF_RANGE;
+ ch = DEC(p[2]) << 6 | DEC(p[3]);
+ putc(ch, outfp);
+ }
+ }
+ }
+ switch (get_line(buf, sizeof(buf))) {
+ case 0:
+ return (0);
+ case 1:
+ return (1);
+ default:
+ return (checkend(buf, "end", "no \"end\" line"));
+ }
+}
+
+static int
+base64_decode(void)
+{
+ int n, count, count4;
+ char inbuf[MAXPATHLEN + 1], *p;
+ unsigned char outbuf[MAXPATHLEN * 4];
+ char leftover[MAXPATHLEN + 1];
+
+ leftover[0] = '\0';
+ for (;;) {
+ strcpy(inbuf, leftover);
+ switch (get_line(inbuf + strlen(inbuf),
+ sizeof(inbuf) - strlen(inbuf))) {
+ case 0:
+ return (0);
+ case 1:
+ return (1);
+ }
+
+ count = 0;
+ count4 = -1;
+ p = inbuf;
+ while (*p != '\0') {
+ /*
+ * Base64 encoded strings have the following
+ * characters in them: A-Z, a-z, 0-9 and +, / and =
+ */
+ if (isalnum(*p) || *p == '+' || *p == '/' || *p == '=')
+ count++;
+ if (count % 4 == 0)
+ count4 = p - inbuf;
+ p++;
+ }
+
+ strcpy(leftover, inbuf + count4 + 1);
+ inbuf[count4 + 1] = 0;
+
+ n = b64_pton(inbuf, outbuf, sizeof(outbuf));
+
+ if (n < 0)
+ break;
+ fwrite(outbuf, 1, n, outfp);
+ }
+ return (checkend(inbuf, "====", "error decoding base64 input stream"));
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: uudecode [-cimprs] [file ...]\n"
+ " uudecode [-i] -o output_file [file]\n"
+ " b64decode [-cimprs] [file ...]\n"
+ " b64decode [-i] -o output_file [file]\n");
+ exit(1);
+}
diff --git a/usr.bin/uuencode/Makefile b/usr.bin/uuencode/Makefile
new file mode 100644
index 0000000..eb2152f
--- /dev/null
+++ b/usr.bin/uuencode/Makefile
@@ -0,0 +1,18 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= uuencode
+MAN= uuencode.1 uuencode.format.5
+LINKS= ${BINDIR}/uuencode ${BINDIR}/b64encode
+MLINKS= uuencode.1 uudecode.1 \
+ uuencode.format.5 uuencode.5 \
+ uuencode.1 b64encode.1 \
+ b64encode.1 b64decode.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/uuencode/Makefile.depend b/usr.bin/uuencode/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/uuencode/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/uuencode/tests/Makefile b/usr.bin/uuencode/tests/Makefile
new file mode 100644
index 0000000..2c7f18c
--- /dev/null
+++ b/usr.bin/uuencode/tests/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.base64.out
+${PACKAGE}FILES+= regress.in
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.traditional.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/uuencode/tests/Makefile.depend b/usr.bin/uuencode/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/uuencode/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/uuencode/tests/legacy_test.sh b/usr.bin/uuencode/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/uuencode/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/uuencode/tests/regress.base64.out b/usr.bin/uuencode/tests/regress.base64.out
new file mode 100644
index 0000000..046f6c5
--- /dev/null
+++ b/usr.bin/uuencode/tests/regress.base64.out
@@ -0,0 +1,74 @@
+begin-base64 644 regress.in
+dB745nc7bs6q4W24dCU/WprFX3UkvTwO6wlHiV+L4U+QEH1p/P9WjgFZ0MSGI2lETCIH+3j4oqf3
+JJA/uvQ2WnWzCjFXG17cZpBq8UQGMh/e8QLyahMOTrrHP9Cf2ZE9WtybokTG8E2Ft0QrfiTsIpcU
+PMd7VDRvCQGLD+t6bqJkPJKaGmXXCwLwLz2WpAOXRW+d4UhnCnB0aBs7IByd6beMYwQxIcM4XvyA
+nG1z3XK9gCwvIwzI6wYYzXCIAo/KpP90oNA6ijFYYNK3s/uttytzC5QfKn6gaVerwYcb1QQHqyrx
+oryOrjwgwgazSfwLhDK1fLejnpTXL1Uh2j9E+pM0WSftA0wX1tdyKxy7kUarWzEACH8htTSd3NDa
+mR/2T66xNHPYZhW31cjeNTX0czIfpRWBbBQI3rc5yhWZlGA0j8X8zQR4puaGpQ6QNnbBQkSU4Ak+
+pveRT8JuFbJVQI6WHemB7H9LV5CSYVCoZ2iOFA/Z8PSM473XXjqBk/M1Zz4irDw8V1tBp519qNgX
+Ft52fdrkbzJCa+71pfAuP2LsytpAd2LUJwhgiV7uj6cx4DjEfdd/QYdcJGDm435wfsniPoPnrghE
+JdqfgWIvaFNpuoQ9ByrznWacs50AQFxyZpfAaLJnGNiPehTOosTT6dPOKp8x2ms6mdkr2neZ0I0l
+eoNHxCBKvgUxC0uFieo6GLpussFEB8QeCsy1mjnXDI1qsC2Sp34PZTvR5apH29FB1eIeAPFZMkFx
+O2TTs0Y4q3yKDcPGHaAdPy8J64UpyBlO3rbcLyqEbKcuSHHd69iT/5mD4arbyYHMY6S7S7QPDHpH
+1x8Woo5xMo0MVkmBGbKc5Sy4J37T8xjj4h0pcKvEdCSanJ2A1E2jHzpfbe8u/NSxpB49+JGYGJ2n
+sgpsKzwTXabgKDZPydqcAIpNXnAdsQBNskmzBYb8959xCzwsybQ7+0g4a0DYyLDcnW2NH/OCYHvk
+OgyM72FQJAXGg61GnZZiAjSlrqsPX2NVUtXivRrueFSG5rYnYJvO2OfhwgEfxTY8b7x8AFQntBva
+KqG5rWC+a2d+4Xj0B2ODy+/M5Hppj0dNwpLPKHa8UH6IDd+m0Aql5u5oCbh+WIDovGtN2BpkyCq0
+0M/kKErTbTT+qfuWSDow0ZjLeFdSErUtdi1tKhDh5oy5Ev+ShLywKPm4/NfJ3CLhbZSvhOWWxwzf
+KEgMCnHNd8uc3JIDNM7c3Dm5w0QrD0AObOUSBF8iouNBjMvdUviIBVFPeVkZ3xYsTciSRJm/fB5Q
+NhrcYRMbZJ5iOVHuuOxFw+zPoEIjVBPO1wXZgsSwgFED20bKLcOvSnWGM3IyNZVKqdo3a4oh4H4L
+v/y6rMrtSTr7kQJlwEvU6WiyvtQob/fMdHWIbc/WRPR47l6JDz4V3AUqPcF3Jy6RaNUKRvFi+7cO
+WYBKbNFRmE/jA6dyUuVkCYIMDuhuI7iQL0u4l//xbdGb9RWtf8WHs/N5nmWi1TLTPbaDz8GBPOMO
+ecpeIfqDVoPqaheqGT4fJj3sVBhq6zayVfNpueaEdHb/XTGm9NHS4xsgpbfL/sJw6IVJj3/dgb0R
+fX90ZUgfDvwURsTNvxAVzKuuuH6wrE8AGOpBLgomMZ5UZcgWkeRNjTqcelCsl3JhBIuUmJMbYI2S
+Mv/CK+nkIYcIE7zHRaCyF8ngNYosop/chz1o1gTP2Di6NTq4a/SX0h1z7fykkKt2pLJvSOA8nccR
+IUrix5/GTQwhJxMaoR5WQUDVUPHx0c8xRNTTI24bGeikG4qKq74bpmZvbZrnsSjQJyLiQiPtraGR
+8YiI2JwGZmHbama9DPjOKV3bBWT6LgR2LEEI0G7BZiSGP4lniTkpOR/FUgp8WmblvhOeZY+KDTam
+ifrq0NhjYIUYWGbZEOUi6ImSbiVH/gm4tk+kyAT1uSuK4lTUCWK7XO5I6WLCY2g4v7nYTDNUv/nb
+JLzai1GQPLz3p0biVq3QwkIf+rZSsTirEIHMTeAxjdfWICDIcPSsxRZgvurgnIAodzIR9RkAnsoe
+4cLvh9SxDNrmlyWDsczkUsc9eG9rr5HH73KOr6wx2CUFug/naqnDBSzEI3H+cz12m9X8ATzpH0BT
+8cFvDE/KKiou+qWWtgLWTwnRoRBmBZVgOHCmQghz5bVgzUygxxQFnYCTD9D5S3d2ndwuHJL3IesR
+/a+Oq5M4ORktsLMaOGJ7x3obRM6gEtuwpJ1EwxfGr/cYrc/QsBFoQfL9LgrcvHLgmE6mazXdF9Nf
+BWiPZhTjFurcB0wD3PqlCrhcvsVP9cugGxA1pQ96MywYL2G0yyM1GrRIbiWG4y7y82+0mQSL9xG6
+G0StzkfWp5rrL8psGo/CFPr/8CXz+6tP/pNUp40NqcMVlOicMozUEHalgUe+581gu0GUI+IritwO
+SPM2hc+woGvFQ6WvY3S77fT7gkpnVuRjiSBlvSkV+2Iujs6++ErDKcIjD9j88StJ8xySXDZr9vID
+LkT+YZIxg+v/CcP4C0tSbwAQNjoS9kpbMQK4YucSAuXIzIZngJHz38iU+2I+mzhPKChNi5/MxP0T
+jK63RqjKsIuJC9OD3c84n7TGXnvC1QqDF4TKYR2zEs7UjlyQVOD3HrtixAJP8ubmUQOrbIY2imR9
+xqUf2SWl8sCYaM6b9E00Wnnj0x2xpfZKE+IvarSRiTRgNBp2S7K1u9NTtj+9A67xWPwpBCPcIsyD
+P4CItCzMoybyqbn3rM3RSiygpIj901FlNab/mUi+borZDvXZgcOlhZjUJnhUjiEhuMfpOxYG//hk
+j/dWd3Dg9gaLVriLVZOfl5wUZT1d8W6rN3RQ+jT42pm2hLhE4picD5GEOYOcTf4rolSx2IlgK4w4
+fb77Iqk35/7kC203b9OFzgzIN2MMfY1C50MRJQT5B7qmKva33MjEaPzbIxipHCd2wAMzTJHMCShK
+1qiQ60aki8suOO6RWDiDAdnpzzjnDFhMyL+if5pBgZctnfvKvvsxAEWlyOZHcwXBu/v+2Gg5cWFr
+8e5GtvxmQzK0CamIba1xl5UTiZDeb6bM0uKZewkY1okt5lYGVYDL/vdhH2FePzSHB42RbcetO/3J
+113wvGjPVWz0F5hgoO+HT0Rq31vpZ47oK83UvOdDzRTyudiMKyf3VCVEzhqunT/QfyPp5Q7UgSOu
+0fcY/iapwxwUtqeBLUfiDo4vHSeswfAb3b8dcPPpYdjLKU80trpChkV37UyXY0wVFSiAiVOeWgWS
+Ga0ABkxF/pNr/OztK1Ms2omJxBulK/FhXHtrog6xFW/QcPcGM0TXILUHJ8GpXTckydbsTCW7Itv5
+9MrY5G/3ps62AOJmcojjQ3kNsJ2UA64/u06RtK8GaP8q3X1zeFmikqD+jEIQlpnx1oy/aSOc0P7U
+9DtWe5MrloS2hHovHkad/se3GiZkgmfFRfqrcC+6giz4cjwTj/yEjpto3VOXnXcPycmuXFPjUlDk
+LBI6RaegecWd+OaQhCe0iut+g64p+e6j2wNaDXa64XgU6HEaXwTgaHENJCQ3GNDl79k1umU0efn5
+PeFJiNDdg1UBfoaob/WFuE+FT2Ns6rmLocAG9XeXNX8U2l3eIleCQHzkhfXluFFgLQnqFpPGay3W
+liEQrZ1/J2o5yx2YE/OJMi3bvnP3JB1mdMPbgd5ulrwcbCOCe0t/qjTxLQzunP5A+S7uaweW4iBu
+DjGiSGPIDH7CPpYQRl+JAj1TYdP1rQ6LpG57cr+NsbyODFEN+DSuyOPiu0z5BmMqb1SQcZ3v2MWy
+Yg+n3Lqai+CX96c0lpL8U2SG7ARnkbmMrQVzD5dwKxnZuk4yvkrSAX0y4kN7mpWuuMDKw/h5NbCX
+UM1OsgjZ3NW8gsj2FYt3f7RSgOeX/lpLuakHMlYgYDyzXnWL8VuwG7gEN/nJLoym7w2OhTFF/l7x
+ilkflZJ3rcGvxbi9gJOsuCKz2oI1ujxJHR5fIX0HSkv7R4464jiK+GUNnbe7QmbBWLoo8Y524u70
+j5QJsd9ZLcTkwAJdW/u/qUXOjbThd8TLsuwDSTMeQj210Lmq3eYy5Np8GRjxQkOXpp0JfkEHrkHb
+5+s1I9v2AhAxQ6RUOuvORLuEoid4RkpFM1kwTV1vQplg7VmLvPjpE1JZ3AbAvKdeqsPsJJVwU+q7
+Jbw3dVa8M0ZtqS4FCGk1C/4jlobxsakncIxP/haAz7oc0IeEFyMzNqu6xjHKqCh9WaqHQpXf1JgJ
+rrV6e+j7Ygh3CsqlSzW6jbSDyxFeKlUxpMYHebEJSebLKOKE0mfubsGqizJFOKRPkYr1bQ1/u5P6
+FNEr0sGQ7lS7BEGRhchJg17bXD9moD2CeJZ2QJYj+YMqjYHk/W6ufHVVHc0pF5jV6/lVMsIYeQ8l
+3YhI/1hB+1An/yFOvVgNonYJVd8MohaVPCD+dZUV3M+S76YRiGVniidGQWl5Y6PYzlEqEuM5FWft
+t9dSLVYhXhbABzcfN7mzoCZjyZEv+ZgUv9ipeaSUW0SZ+6iFv/abw7FkZSl45B88ETP2LqClT21/
+yd69ZyGfdp3FR9daqKrjVjvCFu98zyHTsdR+OF8bsaI280iz3WKdXum+iiuadf66GIsjtIyqUQqo
+g74Ji+VKP/xIgOBAFB4ktVULAypA+NsRNwYAIBDEa7EMiDduUPQ/9uavMN/F9Jf1POW4MljbH7C6
+6NisM+/3YJ4l4Um2iXQPq9ypG6c0AJjzgL6/XtWhFnki1jJYvEJ9IkWvlL650zgXzEvEEOWI6TaQ
+SwrrSh2UTD6afJPCRsymB1rBEWb1FRVsidkr+/rFFL7D3QsDr+EWFesj5ItbABOPNt5w0obx0mKg
+WoKuZaklnqJvJT7JUdVRZQ6ei4JksMnIs+muEl7ouM1OM/e2VM5JRI+2MO4/1Sy9brEj3xY0pRYf
+XJxzNZsIepyKB8T2NoWfvOomcCXlYNz3rIRRVPWgxsV6kqTJuFo+Ypu+A7Q8P2AWDfssP2vaHvph
+Jmk5OwUAq4LljFbo6KlC932c6cljUhTRukRsFfz5JoYf1dcdgcPg5YGX4qpUuqCGiT99dSIQ/WhC
+L6n4gLV/IXb5BuMbrmHvx1xVVbiTh8S4MjNNqv6zpLumJr8qI7sFfPLDYhm7erthjGYmVnG3n7eE
+eAu/QU2CJl4kHMoSFoRanXJ+o4tprVlrRQ0whlADoNK8swogk2vGtYqqCfYAHuh/aGtETA/vqZI7
+1/j94nDd8YH1hVyf5GI/QvkuqZiLeZKUIrNj03jHio8oHWrim1mBlRhWo/947ac6xHOqFqBufMZI
+C1f2zvHvav1Cu7Y6kAoKsn4h4gTjKw25SImYWL4Lx8GUsVWKl+pm8rEJ3NTh6I2Q6vt1EmfP2Oot
+56oUci+u8WtQ8wvEaoYWWWqKghPp9piEsfHTETmievN58OKlLHwxWbE7xE7teDcAZw==
+====
diff --git a/usr.bin/uuencode/tests/regress.in b/usr.bin/uuencode/tests/regress.in
new file mode 100644
index 0000000..fa0dd08
--- /dev/null
+++ b/usr.bin/uuencode/tests/regress.in
Binary files differ
diff --git a/usr.bin/uuencode/tests/regress.sh b/usr.bin/uuencode/tests/regress.sh
new file mode 100644
index 0000000..6be0ef3
--- /dev/null
+++ b/usr.bin/uuencode/tests/regress.sh
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+echo 1..2
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`traditional', `uuencode regress.in <${SRCDIR}/regress.in')
+REGRESSION_TEST(`base64', `uuencode -m regress.in <${SRCDIR}/regress.in')
+
+REGRESSION_END()
diff --git a/usr.bin/uuencode/tests/regress.traditional.out b/usr.bin/uuencode/tests/regress.traditional.out
new file mode 100644
index 0000000..ee1352f
--- /dev/null
+++ b/usr.bin/uuencode/tests/regress.traditional.out
@@ -0,0 +1,95 @@
+begin 644 regress.in
+M=![XYG<[;LZJX6VX="4_6IK%7W4DO3P.ZPE'B5^+X4^0$'UI_/]6C@%9T,2&
+M(VE$3"('^WCXHJ?W))`_NO0V6G6S"C%7&U[<9I!J\40&,A_>\0+R:A,.3KK'
+M/]"?V9$]6MR;HD3&\$V%MT0K?B3L(I<4/,=[5#1O"0&+#^MZ;J)D/)*:&F77
+M"P+P+SV6I`.716^=X4AG"G!T:!L[(!R=Z;>,8P0Q(<,X7OR`G&USW7*]@"PO
+M(PS(ZP88S7"(`H_*I/]TH-`ZBC%88-*WL_NMMRMS"Y0?*GZ@:5>KP8<;U00'
+MJRKQHKR.KCP@P@:S2?P+A#*U?+>CGI37+U4AVC]$^I,T62?M`TP7UM=R*QR[
+MD4:K6S$`"'\AM32=W-#:F1_V3ZZQ-'/89A6WU<C>-37T<S(?I16!;!0(WK<Y
+MRA69E&`TC\7\S01XIN:&I0Z0-G;!0D24X`D^IO>13\)N%;)50(Z6'>F![']+
+M5Y"285"H9VB.%`_9\/2,X[W77CJ!D_,U9SXBK#P\5UM!IYU]J-@7%MYV?=KD
+M;S)":^[UI?`N/V+LRMI`=V+4)PA@B5[NCZ<QX#C$?==_08=<)&#FXWYP?LGB
+M/H/GK@A$)=J?@6(O:%-INH0]!RKSG6:<LYT`0%QR9I?`:+)G&-B/>A3.HL33
+MZ=/.*I\QVFLZF=DKVG>9T(TE>H-'Q"!*O@4Q"TN%B>HZ&+INLL%$!\0>"LRU
+MFCG7#(UJL"V2IWX/93O1Y:I'V]%!U>(>`/%9,D%Q.V33LT8XJWR*#</&':`=
+M/R\)ZX4IR!E.WK;<+RJ$;*<N2''=Z]B3_YF#X:K;R8',8Z2[2[0/#'I'UQ\6
+MHHYQ,HT,5DF!&;*<Y2RX)W[3\QCCXATI<*O$="2:G)V`U$VC'SI?;>\N_-2Q
+MI!X]^)&8&)VGL@IL*SP37:;@*#9/R=J<`(I-7G`=L0!-LDFS!8;\]Y]Q"SPL
+MR;0[^T@X:T#8R+#<G6V-'_."8'OD.@R,[V%0)`7&@ZU&G99B`C2EKJL/7V-5
+M4M7BO1KN>%2&YK8G8)O.V.?AP@$?Q38\;[Q\`%0GM!O:*J&YK6"^:V=^X7CT
+M!V.#R^_,Y'IICT=-PI+/*':\4'Z(#=^FT`JEYNYH";A^6(#HO&M-V!IDR"JT
+MT,_D*$K3;33^J?N62#HPT9C+>%=2$K4M=BUM*A#AYHRY$O^2A+RP*/FX_-?)
+MW"+A;92OA.66QPS?*$@,"G'-=\N<W)(#-,[<W#FYPT0K#T`.;.42!%\BHN-!
+MC,O=4OB(!5%/>5D9WQ8L3<B21)F_?!Y0-AK<81,;9)YB.5'NN.Q%P^S/H$(C
+M5!/.UP79@L2P@%$#VT;*+<.O2G6&,W(R-95*J=HW:XHAX'X+O_RZK,KM23K[
+MD0)EP$O4Z6BROM0H;_?,='6(;<_61/1X[EZ)#SX5W`4J/<%W)RZ1:-4*1O%B
+M^[<.68!*;-%1F$_C`Z=R4N5D"8(,#NAN([B0+TNXE__Q;=&;]16M?\6'L_-Y
+MGF6BU3+3/;:#S\&!/.,.><I>(?J#5H/J:A>J&3X?)CWL5!AJZS:R5?-IN>:$
+M=';_73&F]-'2XQL@I;?+_L)PZ(5)CW_=@;T1?7]T94@?#OP41L3-OQ`5S*NN
+MN'ZPK$\`&.I!+@HF,9Y49<@6D>1-C3J<>E"LEW)A!(N4F),;8(V2,O_"*^GD
+M(8<($[S'1:"R%\G@-8HLHI_<ASUHU@3/V#BZ-3JX:_27TAUS[?RDD*MVI+)O
+M2.`\G<<1(4KBQY_&30PA)Q,:H1Y604#54/'QT<\Q1-33(VX;&>BD&XJ*J[X;
+MIF9O;9KGL2C0)R+B0B/MK:&1\8B(V)P&9F';:F:]#/C.*5W;!63Z+@1V+$$(
+MT&[!9B2&/XEGB3DI.1_%4@I\6F;EOA.>98^*#3:FB?KJT-AC8(486&;9$.4B
+MZ(F2;B5'_@FXMD^DR`3UN2N*XE34"6*[7.Y(Z6+"8V@XO[G83#-4O_G;)+S:
+MBU&0/+SWIT;B5JW0PD(?^K92L3BK$(',3>`QC=?6("#(</2LQ19@ONK@G(`H
+M=S(1]1D`GLH>X<+OA]2Q#-KFER6#L<SD4L<]>&]KKY''[W*.KZPQV"4%N@_G
+M:JG#!2S$(W'^<SUVF]7\`3SI'T!3\<%O#$_**BHN^J66M@+63PG1H1!F!95@
+M.'"F0@ASY;5@S4R@QQ0%G8"3#]#Y2W=VG=PN')+W(>L1_:^.JY,X.1DML+,:
+M.&)[QWH;1,Z@$MNPI)U$PQ?&K_<8K<_0L!%H0?+]+@K<O'+@F$ZF:S7=%]-?
+M!6B/9A3C%NK<!TP#W/JE"KA<OL5/]<N@&Q`UI0]Z,RP8+V&TRR,U&K1(;B6&
+MXR[R\V^TF02+]Q&Z&T2MSD?6IYKK+\IL&H_"%/K_\"7S^ZM/_I-4IXT-J<,5
+ME.B<,HS4$':E@4>^Y\U@NT&4(^(KBMP.2/,VA<^PH&O%0Z6O8W2[[?3[@DIG
+M5N1CB2!EO2D5^V(NCLZ^^$K#*<(C#]C\\2M)\QR27#9K]O(#+D3^89(Q@^O_
+M"</X"TM2;P`0-CH2]DI;,0*X8N<2`N7(S(9G@)'SW\B4^V(^FSA/*"A-BY_,
+MQ/T3C*ZW1JC*L(N)"].#W<\XG[3&7GO"U0J#%X3*81VS$L[4CER05.#W'KMB
+MQ`)/\N;F40.K;(8VBF1]QJ4?V26E\L"8:,Z;]$TT6GGCTQVQI?9*$^(O:K21
+MB31@-!IV2[*UN]-3MC^]`Z[Q6/PI!"/<(LR#/X"(M"S,HR;RJ;GWK,W12BR@
+MI(C]TU%E-:;_F4B^;HK9#O79@<.EA9C4)GA4CB$AN,?I.Q8&__ADC_=6=W#@
+M]@:+5KB+59.?EYP493U=\6ZK-W10^C3XVIFVA+A$XIB<#Y&$.8.<3?XKHE2Q
+MV(E@*XPX?;[[(JDWY_[D"VTW;].%S@S(-V,,?8U"YT,1)03Y![JF*O:WW,C$
+M:/S;(QBI'"=VP`,S3)',"2A*UJB0ZT:DB\LN..Z16#B#`=GISSCG#%A,R+^B
+M?YI!@9<MG?O*OOLQ`$6ER.9'<P7!N_O^V&@Y<6%K\>Y&MOQF0S*T":F(;:UQ
+MEY43B9#>;Z;,TN*9>PD8UHDMYE8&58#+_O=A'V%>/S2'!XV1;<>M._W)UUWP
+MO&C/56ST%YA@H.^'3T1JWUOI9X[H*\W4O.=#S13RN=B,*R?W5"5$SAJNG3_0
+M?R/IY0[4@2.NT?<8_B:IPQP4MJ>!+4?B#HXO'2>LP?`;W;\=<//I8=C+*4\T
+MMKI"AD5W[4R78TP5%2B`B5.>6@62&:T`!DQ%_I-K_.SM*U,LVHF)Q!NE*_%A
+M7'MKH@ZQ%6_0</<&,T37(+4')\&I73<DR=;L3"6[(MOY],K8Y&_WILZV`.)F
+M<HCC0WD-L)V4`ZX_NTZ1M*\&:/\JW7US>%FBDJ#^C$(0EIGQUHR_:2.<T/[4
+M]#M6>Y,KEH2VA'HO'D:=_L>W&B9D@F?%1?JK<"^Z@BSX<CP3C_R$CIMHW5.7
+MG7</R<FN7%/C4E#D+!(Z1:>@><6=^.:0A">TBNM^@ZXI^>ZCVP-:#7:ZX7@4
+MZ'$:7P3@:'$-)"0W&-#E[]DUNF4T>?GY/>%)B-#=@U4!?H:H;_6%N$^%3V-L
+MZKF+H<`&]7>7-7\4VEW>(E>"0'SDA?7EN%%@+0GJ%I/&:RW6EB$0K9U_)VHY
+MRQV8$_.),BW;OG/W)!UF=,/;@=YNEKP<;".">TM_JC3Q+0SNG/Y`^2[N:P>6
+MXB!N#C&B2&/(#'["/I801E^)`CU38=/UK0Z+I&Y[<K^-L;R.#%$-^#2NR./B
+MNTSY!F,J;U20<9WOV,6R8@^GW+J:B^"7]Z<TEI+\4V2&[`1GD;F,K05S#Y=P
+M*QG9NDXRODK2`7TRXD-[FI6NN,#*P_AY-;"74,U.L@C9W-6\@LCV%8MW?[12
+M@.>7_EI+N:D',E8@8#RS7G6+\5NP&[@$-_G)+HRF[PV.A3%%_E[QBED?E9)W
+MK<&OQ;B]@).LN"*SVH(UNCQ)'1Y?(7T'2DO[1XXZXCB*^&4-G;>[0F;!6+HH
+M\8YVXN[TCY0)L=]9+<3DP`)=6_N_J47.C;3A=\3+LNP#23,>0CVUT+FJW>8R
+MY-I\&1CQ0D.7IIT)?D$'KD';Y^LU(]OV`A`Q0Z14.NO.1+N$HB=X1DI%,UDP
+M35UO0IE@[5F+O/CI$U)9W`;`O*=>JL/L))5P4^J[);PW=5:\,T9MJ2X%"&DU
+M"_XCEH;QL:DG<(Q/_A:`S[H<T(>$%R,S-JNZQC'*J"A]6:J'0I7?U)@)KK5Z
+M>^C[8@AW"LJE2S6ZC;2#RQ%>*E4QI,8'>;$)2>;+*.*$TF?N;L&JBS)%.*1/
+MD8KU;0U_NY/Z%-$KTL&0[E2[!$&1A<A)@U[;7#]FH#V">)9V0)8C^8,JC8'D
+M_6ZN?'55'<TI%YC5Z_E5,L(8>0\EW8A(_UA!^U`G_R%.O5@-HG8)5=\,HA:5
+M/"#^=945W,^2[Z81B&5GBB=&06EY8Z/8SE$J$N,Y%6?MM]=2+58A7A;`!S<?
+M-[FSH"9CR9$O^9@4O]BI>:246T29^ZB%O_:;P[%D92EXY!\\$3/V+J"E3VU_
+MR=Z]9R&?=IW%1]=:J*KC5CO"%N]\SR'3L=1^.%\;L:(V\TBSW6*=7NF^BBN:
+M=?ZZ&(LCM(RJ40JH@[X)B^5*/_Q(@.!`%!XDM54+`RI`^-L1-P8`(!#$:[$,
+MB#=N4/0_]N:O,-_%])?U/.6X,EC;'["ZZ-BL,^_W8)XEX4FVB70/J]RI&Z<T
+M`)CS@+Z_7M6A%GDBUC)8O$)](D6OE+ZYTS@7S$O$$.6(Z3:02PKK2AV43#Z:
+M?)/"1LRF!UK!$6;U%15LB=DK^_K%%+[#W0L#K^$6%>LCY(M;`!./-MYPTH;Q
+MTF*@6H*N9:DEGJ)O)3[)4=5190Z>BX)DL,G(L^FN$E[HN,U.,_>V5,Y)1(^V
+M,.X_U2R];K$CWQ8TI18?7)QS-9L(>IR*!\3V-H6?O.HF<"7E8-SWK(115/6@
+MQL5ZDJ3)N%H^8IN^`[0\/V`6#?LL/VO:'OIA)FDY.P4`JX+EC%;HZ*E"]WV<
+MZ<EC4A31ND1L%?SY)H8?U=<=@</@Y8&7XJI4NJ"&B3]]=2(0_6A"+ZGX@+5_
+M(7;Y!N,;KF'OQUQ55;B3A\2X,C--JOZSI+NF)K\J([L%?/+#8AF[>KMAC&8F
+M5G&WG[>$>`N_04V")EXD',H2%H1:G7)^HXMIK5EK10TPAE`#H-*\LPH@DVO&
+MM8JJ"?8`'NA_:&M$3`_OJ9([U_C]XG#=\8'UA5R?Y&(_0ODNJ9B+>9*4(K-C
+MTWC'BH\H'6KBFUF!E1A6H_]X[:<ZQ'.J%J!N?,9("U?VSO'O:OU"N[8ZD`H*
+MLGXAX@3C*PVY2(F86+X+Q\&4L56*E^IF\K$)W-3AZ(V0ZOMU$F?/V.HMYZH4
+M<B^N\6M0\PO$:H8666J*@A/I]IB$L?'3$3FB>O-Y\.*E+'PQ6;$[Q$[M>#<`
+!9P``
+`
+end
diff --git a/usr.bin/uuencode/uuencode.1 b/usr.bin/uuencode/uuencode.1
new file mode 100644
index 0000000..9ce7e05
--- /dev/null
+++ b/usr.bin/uuencode/uuencode.1
@@ -0,0 +1,221 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)uuencode.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd January 27, 2002
+.Dt UUENCODE 1
+.Os
+.Sh NAME
+.Nm uuencode ,
+.Nm uudecode ,
+.Nm b64encode ,
+.Nm b64decode
+.Nd encode/decode a binary file
+.Sh SYNOPSIS
+.Nm
+.Op Fl m
+.Op Fl r
+.Op Fl o Ar output_file
+.Op Ar file
+.Ar name
+.Nm uudecode
+.Op Fl cimprs
+.Op Ar
+.Nm uudecode
+.Op Fl i
+.Fl o Ar output_file
+.Nm b64encode
+.Op Fl r
+.Op Fl o Ar output_file
+.Op Ar file
+.Ar name
+.Nm b64decode
+.Op Fl cimprs
+.Op Ar
+.Nm b64decode
+.Op Fl i
+.Fl o Ar output_file
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+and
+.Nm uudecode
+utilities are used to transmit binary files over transmission mediums
+that do not support other than simple
+.Tn ASCII
+data.
+The
+.Nm b64encode
+utility is synonymous with
+.Nm
+with the
+.Fl m
+flag specified.
+The
+.Nm b64decode
+utility is synonymous with
+.Nm uudecode
+with the
+.Fl m
+flag specified.
+.Pp
+The
+.Nm
+utility reads
+.Ar file
+(or by default the standard input) and writes an encoded version
+to the standard output, or
+.Ar output_file
+if one has been specified.
+The encoding uses only printing
+.Tn ASCII
+characters and includes the
+mode of the file and the operand
+.Ar name
+for use by
+.Nm uudecode .
+.Pp
+The
+.Nm uudecode
+utility transforms
+.Em uuencoded
+files (or by default, the standard input) into the original form.
+The resulting file is named either
+.Ar name
+or (depending on options passed to
+.Nm uudecode )
+.Ar output_file
+and will have the mode of the original file except that setuid
+and execute bits are not retained.
+The
+.Nm uudecode
+utility ignores any leading and trailing lines.
+.Pp
+The following options are available for
+.Nm :
+.Bl -tag -width ident
+.It Fl m
+Use the Base64 method of encoding, rather than the traditional
+.Nm
+algorithm.
+.It Fl r
+Produce raw output by excluding the initial and final framing lines.
+.It Fl o Ar output_file
+Output to
+.Ar output_file
+instead of standard output.
+.El
+.Pp
+The following options are available for
+.Nm uudecode :
+.Bl -tag -width ident
+.It Fl c
+Decode more than one uuencoded file from
+.Ar file
+if possible.
+.It Fl i
+Do not overwrite files.
+.It Fl m
+When used with the
+.Fl r
+flag, decode Base64 input instead of traditional
+.Nm
+input.
+Without
+.Fl r
+it has no effect.
+.It Fl o Ar output_file
+Output to
+.Ar output_file
+instead of any pathname contained in the input data.
+.It Fl p
+Decode
+.Ar file
+and write output to standard output.
+.It Fl r
+Decode raw (or broken) input, which is missing the initial and
+possibly the final framing lines.
+The input is assumed to be in the traditional
+.Nm
+encoding, but if the
+.Fl m
+flag is used, or if the utility is invoked as
+.Nm b64decode ,
+then the input is assumed to be in Base64 format.
+.It Fl s
+Do not strip output pathname to base filename.
+By default
+.Nm uudecode
+deletes any prefix ending with the last slash '/' for security
+reasons.
+.El
+.Sh EXAMPLES
+The following example packages up a source tree, compresses it,
+uuencodes it and mails it to a user on another system.
+When
+.Nm uudecode
+is run on the target system, the file ``src_tree.tar.Z'' will be
+created which may then be uncompressed and extracted into the original
+tree.
+.Pp
+.Bd -literal -offset indent -compact
+tar cf \- src_tree \&| compress \&|
+uuencode src_tree.tar.Z \&| mail user@example.com
+.Ed
+.Pp
+The following example unpacks all uuencoded
+files from your mailbox into your current working directory.
+.Pp
+.Bd -literal -offset indent -compact
+uudecode -c < $MAIL
+.Ed
+.Pp
+The following example extracts a compressed tar
+archive from your mailbox
+.Pp
+.Bd -literal -offset indent -compact
+uudecode -o /dev/stdout < $MAIL | zcat | tar xfv -
+.Ed
+.Sh SEE ALSO
+.Xr basename 1 ,
+.Xr compress 1 ,
+.Xr mail 1 ,
+.Xr uucp 1 Pq Pa ports/net/freebsd-uucp ,
+.Xr uuencode 5
+.Sh HISTORY
+The
+.Nm uudecode
+and
+.Nm
+utilities appeared in
+.Bx 4.0 .
+.Sh BUGS
+Files encoded using the traditional algorithm are expanded by 35% (3
+bytes become 4 plus control information).
diff --git a/usr.bin/uuencode/uuencode.c b/usr.bin/uuencode/uuencode.c
new file mode 100644
index 0000000..500dcd3
--- /dev/null
+++ b/usr.bin/uuencode/uuencode.c
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 1983, 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.
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)uuencode.c 8.2 (Berkeley) 4/2/94";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * uuencode [input] output
+ *
+ * Encode a file so it can be mailed to a remote system.
+ */
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+
+#include <err.h>
+#include <libgen.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void encode(void);
+static void base64_encode(void);
+static void usage(void);
+
+static FILE *output;
+static int mode;
+static char raw = 0;
+static char **av;
+
+int
+main(int argc, char *argv[])
+{
+ struct stat sb;
+ int base64;
+ int ch;
+ char *outfile;
+
+ base64 = 0;
+ outfile = NULL;
+
+ if (strcmp(basename(argv[0]), "b64encode") == 0)
+ base64 = 1;
+
+ while ((ch = getopt(argc, argv, "mo:r")) != -1) {
+ switch (ch) {
+ case 'm':
+ base64 = 1;
+ break;
+ case 'o':
+ outfile = optarg;
+ break;
+ case 'r':
+ raw = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argv += optind;
+ argc -= optind;
+
+ switch(argc) {
+ case 2: /* optional first argument is input file */
+ if (!freopen(*argv, "r", stdin) || fstat(fileno(stdin), &sb))
+ err(1, "%s", *argv);
+#define RWX (S_IRWXU|S_IRWXG|S_IRWXO)
+ mode = sb.st_mode & RWX;
+ ++argv;
+ break;
+ case 1:
+#define RW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+ mode = RW & ~umask(RW);
+ break;
+ case 0:
+ default:
+ usage();
+ }
+
+ av = argv;
+
+ if (outfile != NULL) {
+ output = fopen(outfile, "w+");
+ if (output == NULL)
+ err(1, "unable to open %s for output", outfile);
+ } else
+ output = stdout;
+ if (base64)
+ base64_encode();
+ else
+ encode();
+ if (ferror(output))
+ errx(1, "write error");
+ exit(0);
+}
+
+/* ENC is the basic 1 character encoding function to make a char printing */
+#define ENC(c) ((c) ? ((c) & 077) + ' ': '`')
+
+/*
+ * Copy from in to out, encoding in base64 as you go along.
+ */
+static void
+base64_encode(void)
+{
+ /*
+ * Output must fit into 80 columns, chunks come in 4, leave 1.
+ */
+#define GROUPS ((80 / 4) - 1)
+ unsigned char buf[3];
+ char buf2[sizeof(buf) * 2 + 1];
+ size_t n;
+ int rv, sequence;
+
+ sequence = 0;
+
+ if (!raw)
+ fprintf(output, "begin-base64 %o %s\n", mode, *av);
+ while ((n = fread(buf, 1, sizeof(buf), stdin))) {
+ ++sequence;
+ rv = b64_ntop(buf, n, buf2, (sizeof(buf2) / sizeof(buf2[0])));
+ if (rv == -1)
+ errx(1, "b64_ntop: error encoding base64");
+ fprintf(output, "%s%s", buf2, (sequence % GROUPS) ? "" : "\n");
+ }
+ if (sequence % GROUPS)
+ fprintf(output, "\n");
+ if (!raw)
+ fprintf(output, "====\n");
+}
+
+/*
+ * Copy from in to out, encoding as you go along.
+ */
+static void
+encode(void)
+{
+ register int ch, n;
+ register char *p;
+ char buf[80];
+
+ if (!raw)
+ (void)fprintf(output, "begin %o %s\n", mode, *av);
+ while ((n = fread(buf, 1, 45, stdin))) {
+ ch = ENC(n);
+ if (fputc(ch, output) == EOF)
+ break;
+ for (p = buf; n > 0; n -= 3, p += 3) {
+ /* Pad with nulls if not a multiple of 3. */
+ if (n < 3) {
+ p[2] = '\0';
+ if (n < 2)
+ p[1] = '\0';
+ }
+ ch = *p >> 2;
+ ch = ENC(ch);
+ if (fputc(ch, output) == EOF)
+ break;
+ ch = ((*p << 4) & 060) | ((p[1] >> 4) & 017);
+ ch = ENC(ch);
+ if (fputc(ch, output) == EOF)
+ break;
+ ch = ((p[1] << 2) & 074) | ((p[2] >> 6) & 03);
+ ch = ENC(ch);
+ if (fputc(ch, output) == EOF)
+ break;
+ ch = p[2] & 077;
+ ch = ENC(ch);
+ if (fputc(ch, output) == EOF)
+ break;
+ }
+ if (fputc('\n', output) == EOF)
+ break;
+ }
+ if (ferror(stdin))
+ errx(1, "read error");
+ if (!raw)
+ (void)fprintf(output, "%c\nend\n", ENC('\0'));
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+"usage: uuencode [-m] [-o outfile] [infile] remotefile\n"
+" b64encode [-o outfile] [infile] remotefile\n");
+ exit(1);
+}
diff --git a/usr.bin/uuencode/uuencode.format.5 b/usr.bin/uuencode/uuencode.format.5
new file mode 100644
index 0000000..31c5d64
--- /dev/null
+++ b/usr.bin/uuencode/uuencode.format.5
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1989, 1991, 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.
+.\"
+.\" @(#)uuencode.format.5 8.2 (Berkeley) 1/12/94
+.\" $FreeBSD$
+.\"
+.Dd January 12, 1994
+.Dt UUENCODE 5
+.Os
+.Sh NAME
+.Nm uuencode
+.Nd format of an encoded uuencode file
+.Sh DESCRIPTION
+Files output by
+.Xr uuencode 1
+consist of a header line,
+followed by a number of body lines,
+and a trailer line.
+The
+.Xr uudecode 1
+command
+will ignore any lines preceding the header or
+following the trailer.
+Lines preceding a header must not, of course,
+look like a header.
+.Pp
+The header line is distinguished by having the first
+6 characters
+.Dq begin\ \&
+(note the trailing space).
+The word
+.Em begin
+is followed by a mode (in octal),
+and a string which names the remote file.
+A space separates the three items in the header line.
+.Pp
+The body consists of a number of lines, each at most 62 characters
+long (including the trailing newline).
+These consist of a character count,
+followed by encoded characters,
+followed by a newline.
+The character count is a single printing character,
+and represents an integer, the number of bytes
+the rest of the line represents.
+Such integers are always in the range from 1 to 45 or 64 and can
+be determined by subtracting the character space (octal 40)
+from the character.
+Character 64 represents a count of zero.
+.Pp
+Groups of 3 bytes are stored in 4 characters, 6 bits per character.
+All characters are always in range from 1 to 64 and are offset by a
+space (octal 40) to make the characters printing.
+Character
+64 represents a count of zero.
+The last line may be shorter than the normal 45 bytes.
+If the size is not a multiple of 3, this fact can be determined
+by the value of the count on the last line.
+Extra null characters will be included to make the character count a multiple
+of 4.
+The body is terminated by a line with a count of zero.
+This line consists of one
+.Tn ASCII
+backquote (octal 140) character.
+.Pp
+The trailer line consists of
+.Dq end
+on a line by itself.
+.Sh SEE ALSO
+.Xr mail 1 ,
+.Xr uucp 1 ,
+.Xr uudecode 1 ,
+.Xr uuencode 1
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.0 .
+.\" It was named uuencode.5 prior to 4.3
diff --git a/usr.bin/vacation/Makefile b/usr.bin/vacation/Makefile
new file mode 100644
index 0000000..aa8e9bd
--- /dev/null
+++ b/usr.bin/vacation/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
+.PATH: ${SENDMAIL_DIR}/vacation
+
+PROG= vacation
+SRCS= vacation.c
+CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I.
+CFLAGS+=-DNEWDB -DNOT_SENDMAIL
+CFLAGS+=-D_FFR_LISTDB -D_FFR_DEBUG
+
+WARNS?= 2
+
+LIBADD= smdb smutil sm
+
+SRCS+= sm_os.h
+CLEANFILES+=sm_os.h
+
+# User customizations to the sendmail build environment
+CFLAGS+=${SENDMAIL_CFLAGS}
+DPADD+=${SENDMAIL_DPADD}
+LDADD+=${SENDMAIL_LDADD}
+LDFLAGS+=${SENDMAIL_LDFLAGS}
+
+sm_os.h: ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h .NOMETA
+ ln -sf ${.ALLSRC} ${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vacation/Makefile.depend b/usr.bin/vacation/Makefile.depend
new file mode 100644
index 0000000..b0af42f
--- /dev/null
+++ b/usr.bin/vacation/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libsm \
+ lib/libsmdb \
+ lib/libsmutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vgrind/Makefile b/usr.bin/vgrind/Makefile
new file mode 100644
index 0000000..a7dc9a1
--- /dev/null
+++ b/usr.bin/vgrind/Makefile
@@ -0,0 +1,33 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
+
+PROG= vfontedpr
+SRCS= regexp.c vfontedpr.c
+SCRIPTS=vgrind.sh
+FILES= vgrindefs.src vgrindefs.src.db tmac.vgrind
+FILESNAME_vgrindefs.src= vgrindefs
+FILESNAME_vgrindefs.src.db= vgrindefs.db
+FILESDIR= ${SHAREDIR}/misc
+FILESDIR_tmac.vgrind= ${SHAREDIR}/tmac
+MAN= vgrind.1 vgrindefs.5
+
+WARNS?= 3
+
+BINDIR= ${LIBEXECDIR}
+SCRIPTSDIR=/usr/bin
+
+CLEANFILES= vgrindefs.src.db
+
+.include <bsd.endian.mk>
+.if ${TARGET_ENDIANNESS} == "1234"
+CAP_MKDB_ENDIAN= -l
+.elif ${TARGET_ENDIANNESS} == "4321"
+CAP_MKDB_ENDIAN= -b
+.else
+CAP_MKDB_ENDIAN=
+.endif
+
+vgrindefs.src.db: vgrindefs.src
+ cap_mkdb ${CAP_MKDB_ENDIAN} -f vgrindefs.src ${.ALLSRC}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vgrind/Makefile.depend b/usr.bin/vgrind/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/vgrind/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/vgrind/extern.h b/usr.bin/vgrind/extern.h
new file mode 100644
index 0000000..812592f
--- /dev/null
+++ b/usr.bin/vgrind/extern.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1980, 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+extern bool _escaped; /* if last character was an escape */
+extern char *s_start; /* start of the current string */
+extern char *l_acmbeg; /* string introducing a comment */
+extern char *l_acmend; /* string ending a comment */
+extern char *l_blkbeg; /* string beginning of a block */
+extern char *l_blkend; /* string ending a block */
+extern char *l_chrbeg; /* delimiter for character constant */
+extern char *l_chrend; /* delimiter for character constant */
+extern char *l_combeg; /* string introducing a comment */
+extern char *l_comend; /* string ending a comment */
+extern char l_escape; /* character used to escape characters */
+extern char *l_keywds[]; /* keyword table address */
+extern bool l_onecase; /* upper and lower case are equivalent */
+extern char *l_prcbeg; /* regular expr for procedure begin */
+extern char *l_strbeg; /* delimiter for string constant */
+extern char *l_strend; /* delimiter for string constant */
+extern bool l_toplex; /* procedures only defined at top lex level */
+extern const char *language; /* the language indicator */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+extern int STRNCMP(char *, char *, int);
+extern char *convexp(char *);
+extern char *expmatch(char *, char *, char *);
+__END_DECLS
+
diff --git a/usr.bin/vgrind/pathnames.h b/usr.bin/vgrind/pathnames.h
new file mode 100644
index 0000000..825a06a
--- /dev/null
+++ b/usr.bin/vgrind/pathnames.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ */
+
+#define _PATH_VGRINDEFS "/usr/share/misc/vgrindefs"
diff --git a/usr.bin/vgrind/regexp.c b/usr.bin/vgrind/regexp.c
new file mode 100644
index 0000000..994cd2b
--- /dev/null
+++ b/usr.bin/vgrind/regexp.c
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 1980, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)regexp.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "extern.h"
+
+static void expconv(void);
+
+bool _escaped; /* true if we are currently x_escaped */
+char *s_start; /* start of string */
+bool l_onecase; /* true if upper and lower equivalent */
+
+#define makelower(c) (isupper((c)) ? tolower((c)) : (c))
+
+/* STRNCMP - like strncmp except that we convert the
+ * first string to lower case before comparing
+ * if l_onecase is set.
+ */
+
+int
+STRNCMP(register char *s1, register char *s2, register int len)
+{
+ if (l_onecase) {
+ do
+ if (*s2 - makelower(*s1))
+ return (*s2 - makelower(*s1));
+ else {
+ s2++;
+ s1++;
+ }
+ while (--len);
+ } else {
+ do
+ if (*s2 - *s1)
+ return (*s2 - *s1);
+ else {
+ s2++;
+ s1++;
+ }
+ while (--len);
+ }
+ return(0);
+}
+
+/* The following routine converts an irregular expression to
+ * internal format.
+ *
+ * Either meta symbols (\a \d or \p) or character strings or
+ * operations ( alternation or parenthesizing ) can be
+ * specified. Each starts with a descriptor byte. The descriptor
+ * byte has STR set for strings, META set for meta symbols
+ * and OPER set for operations.
+ * The descriptor byte can also have the OPT bit set if the object
+ * defined is optional. Also ALT can be set to indicate an alternation.
+ *
+ * For metasymbols the byte following the descriptor byte identities
+ * the meta symbol (containing an ascii 'a', 'd', 'p', '|', or '('). For
+ * strings the byte after the descriptor is a character count for
+ * the string:
+ *
+ * meta symbols := descriptor
+ * symbol
+ *
+ * strings := descriptor
+ * character count
+ * the string
+ *
+ * operations := descriptor
+ * symbol
+ * character count
+ */
+
+/*
+ * handy macros for accessing parts of match blocks
+ */
+#define MSYM(A) (*(A+1)) /* symbol in a meta symbol block */
+#define MNEXT(A) (A+2) /* character following a metasymbol block */
+
+#define OSYM(A) (*(A+1)) /* symbol in an operation block */
+#define OCNT(A) (*(A+2)) /* character count */
+#define ONEXT(A) (A+3) /* next character after the operation */
+#define OPTR(A) (A+*(A+2)) /* place pointed to by the operator */
+
+#define SCNT(A) (*(A+1)) /* byte count of a string */
+#define SSTR(A) (A+2) /* address of the string */
+#define SNEXT(A) (A+2+*(A+1)) /* character following the string */
+
+/*
+ * bit flags in the descriptor
+ */
+#define OPT 1
+#define STR 2
+#define META 4
+#define ALT 8
+#define OPER 16
+
+static char *ccre; /* pointer to current position in converted exp*/
+static char *ure; /* pointer current position in unconverted exp */
+
+/* re: unconverted irregular expression */
+char *
+convexp(char *re)
+{
+ register char *cre; /* pointer to converted regular expression */
+
+ /* allocate room for the converted expression */
+ if (re == NULL)
+ return (NULL);
+ if (*re == '\0')
+ return (NULL);
+ cre = malloc(4 * strlen(re) + 3);
+ ccre = cre;
+ ure = re;
+
+ /* start the conversion with a \a */
+ *cre = META | OPT;
+ MSYM(cre) = 'a';
+ ccre = MNEXT(cre);
+
+ /* start the conversion (its recursive) */
+ expconv ();
+ *ccre = 0;
+ return (cre);
+}
+
+static void
+expconv()
+{
+ register char *cs; /* pointer to current symbol in converted exp */
+ register char c; /* character being processed */
+ register char *acs; /* pinter to last alternate */
+ register int temp;
+
+ /* let the conversion begin */
+ acs = NULL;
+ cs = NULL;
+ while (*ure) {
+ switch (c = *ure++) {
+
+ case '\\':
+ switch (c = *ure++) {
+
+ /* escaped characters are just characters */
+ default:
+ if (cs == NULL || (*cs & STR) == 0) {
+ cs = ccre;
+ *cs = STR;
+ SCNT(cs) = 1;
+ ccre += 2;
+ } else
+ SCNT(cs)++;
+ *ccre++ = c;
+ break;
+
+ /* normal(?) metacharacters */
+ case 'a':
+ case 'd':
+ case 'e':
+ case 'p':
+ if (acs != NULL && acs != cs) {
+ do {
+ temp = OCNT(acs);
+ OCNT(acs) = ccre - acs;
+ acs -= temp;
+ } while (temp != 0);
+ acs = NULL;
+ }
+ cs = ccre;
+ *cs = META;
+ MSYM(cs) = c;
+ ccre = MNEXT(cs);
+ break;
+ }
+ break;
+
+ /* just put the symbol in */
+ case '^':
+ case '$':
+ if (acs != NULL && acs != cs) {
+ do {
+ temp = OCNT(acs);
+ OCNT(acs) = ccre - acs;
+ acs -= temp;
+ } while (temp != 0);
+ acs = NULL;
+ }
+ cs = ccre;
+ *cs = META;
+ MSYM(cs) = c;
+ ccre = MNEXT(cs);
+ break;
+
+ /* mark the last match sequence as optional */
+ case '?':
+ if (cs)
+ *cs = *cs | OPT;
+ break;
+
+ /* recurse and define a subexpression */
+ case '(':
+ if (acs != NULL && acs != cs) {
+ do {
+ temp = OCNT(acs);
+ OCNT(acs) = ccre - acs;
+ acs -= temp;
+ } while (temp != 0);
+ acs = NULL;
+ }
+ cs = ccre;
+ *cs = OPER;
+ OSYM(cs) = '(';
+ ccre = ONEXT(cs);
+ expconv();
+ OCNT(cs) = ccre - cs; /* offset to next symbol */
+ break;
+
+ /* return from a recursion */
+ case ')':
+ if (acs != NULL) {
+ do {
+ temp = OCNT(acs);
+ OCNT(acs) = ccre - acs;
+ acs -= temp;
+ } while (temp != 0);
+ acs = NULL;
+ }
+ cs = ccre;
+ *cs = META;
+ MSYM(cs) = c;
+ ccre = MNEXT(cs);
+ return;
+
+ /* mark the last match sequence as having an alternate */
+ /* the third byte will contain an offset to jump over the */
+ /* alternate match in case the first did not fail */
+ case '|':
+ if (acs != NULL && acs != cs)
+ OCNT(ccre) = ccre - acs; /* make a back pointer */
+ else
+ OCNT(ccre) = 0;
+ *cs |= ALT;
+ cs = ccre;
+ *cs = OPER;
+ OSYM(cs) = '|';
+ ccre = ONEXT(cs);
+ acs = cs; /* remember that the pointer is to be filles */
+ break;
+
+ /* if its not a metasymbol just build a scharacter string */
+ default:
+ if (cs == NULL || (*cs & STR) == 0) {
+ cs = ccre;
+ *cs = STR;
+ SCNT(cs) = 1;
+ ccre = SSTR(cs);
+ } else
+ SCNT(cs)++;
+ *ccre++ = c;
+ break;
+ }
+ }
+ if (acs != NULL) {
+ do {
+ temp = OCNT(acs);
+ OCNT(acs) = ccre - acs;
+ acs -= temp;
+ } while (temp != 0);
+ acs = NULL;
+ }
+ return;
+}
+/* end of convertre */
+
+
+/*
+ * The following routine recognises an irregular expression
+ * with the following special characters:
+ *
+ * \? - means last match was optional
+ * \a - matches any number of characters
+ * \d - matches any number of spaces and tabs
+ * \p - matches any number of alphanumeric
+ * characters. The
+ * characters matched will be copied into
+ * the area pointed to by 'name'.
+ * \| - alternation
+ * \( \) - grouping used mostly for alternation and
+ * optionality
+ *
+ * The irregular expression must be translated to internal form
+ * prior to calling this routine
+ *
+ * The value returned is the pointer to the first non \a
+ * character matched.
+ */
+
+/*
+ * s: string to check for a match in
+ * re: a converted irregular expression
+ * mstring: where to put whatever matches a \p
+ */
+char *
+expmatch (register char *s, register char *re, register char *mstring)
+{
+ register char *cs; /* the current symbol */
+ register char *ptr,*s1; /* temporary pointer */
+ bool matched; /* a temporary bool */
+
+ /* initial conditions */
+ if (re == NULL)
+ return (NULL);
+ cs = re;
+ matched = false;
+
+ /* loop till expression string is exhausted (or at least pretty tired) */
+ while (*cs) {
+ switch (*cs & (OPER | STR | META)) {
+
+ /* try to match a string */
+ case STR:
+ matched = !STRNCMP (s, SSTR(cs), SCNT(cs));
+ if (matched) {
+
+ /* hoorah it matches */
+ s += SCNT(cs);
+ cs = SNEXT(cs);
+ } else if (*cs & ALT) {
+
+ /* alternation, skip to next expression */
+ cs = SNEXT(cs);
+ } else if (*cs & OPT) {
+
+ /* the match is optional */
+ cs = SNEXT(cs);
+ matched = 1; /* indicate a successful match */
+ } else {
+
+ /* no match, error return */
+ return (NULL);
+ }
+ break;
+
+ /* an operator, do something fancy */
+ case OPER:
+ switch (OSYM(cs)) {
+
+ /* this is an alternation */
+ case '|':
+ if (matched)
+
+ /* last thing in the alternation was a match, skip ahead */
+ cs = OPTR(cs);
+ else
+
+ /* no match, keep trying */
+ cs = ONEXT(cs);
+ break;
+
+ /* this is a grouping, recurse */
+ case '(':
+ ptr = expmatch(s, ONEXT(cs), mstring);
+ if (ptr != NULL) {
+
+ /* the subexpression matched */
+ matched = 1;
+ s = ptr;
+ } else if (*cs & ALT) {
+
+ /* alternation, skip to next expression */
+ matched = 0;
+ } else if (*cs & OPT) {
+
+ /* the match is optional */
+ matched = 1; /* indicate a successful match */
+ } else {
+
+ /* no match, error return */
+ return (NULL);
+ }
+ cs = OPTR(cs);
+ break;
+ }
+ break;
+
+ /* try to match a metasymbol */
+ case META:
+ switch (MSYM(cs)) {
+
+ /* try to match anything and remember what was matched */
+ case 'p':
+ /*
+ * This is really the same as trying the match the
+ * remaining parts of the expression to any subset
+ * of the string.
+ */
+ s1 = s;
+ do {
+ ptr = expmatch(s1, MNEXT(cs), mstring);
+ if (ptr != NULL && s1 != s) {
+
+ /* we have a match, remember the match */
+ strncpy (mstring, s, s1 - s);
+ mstring[s1 - s] = '\0';
+ return (ptr);
+ } else if (ptr != NULL && (*cs & OPT)) {
+
+ /* it was aoptional so no match is ok */
+ return (ptr);
+ } else if (ptr != NULL) {
+
+ /* not optional and we still matched */
+ return (NULL);
+ }
+ if (!(isalnum(*s1) || *s1 == '_' ||
+ /* C++ destructor */
+ *s1 == '~' ||
+ /* C++ scope operator */
+ (strlen(s1) > 1 && *s1 == ':' && s1[1] == ':' &&
+ (s1++, true))))
+ return (NULL);
+ if (*s1 == '\\')
+ _escaped = _escaped ? false : true;
+ else
+ _escaped = false;
+ } while (*s1++);
+ return (NULL);
+
+ /* try to match anything */
+ case 'a':
+ /*
+ * This is really the same as trying the match the
+ * remaining parts of the expression to any subset
+ * of the string.
+ */
+ s1 = s;
+ do {
+ ptr = expmatch(s1, MNEXT(cs), mstring);
+ if (ptr != NULL && s1 != s) {
+
+ /* we have a match */
+ return (ptr);
+ } else if (ptr != NULL && (*cs & OPT)) {
+
+ /* it was aoptional so no match is ok */
+ return (ptr);
+ } else if (ptr != NULL) {
+
+ /* not optional and we still matched */
+ return (NULL);
+ }
+ if (*s1 == '\\')
+ _escaped = _escaped ? false : true;
+ else
+ _escaped = false;
+ } while (*s1++);
+ return (NULL);
+
+ /* fail if we are currently _escaped */
+ case 'e':
+ if (_escaped)
+ return(NULL);
+ cs = MNEXT(cs);
+ break;
+
+ /* match any number of tabs and spaces */
+ case 'd':
+ ptr = s;
+ while (*s == ' ' || *s == '\t')
+ s++;
+ if (s != ptr || s == s_start) {
+
+ /* match, be happy */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else if (*s == '\n' || *s == '\0') {
+
+ /* match, be happy */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else if (*cs & ALT) {
+
+ /* try the next part */
+ matched = 0;
+ cs = MNEXT(cs);
+ } else if (*cs & OPT) {
+
+ /* doesn't matter */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else
+
+ /* no match, error return */
+ return (NULL);
+ break;
+
+ /* check for end of line */
+ case '$':
+ if (*s == '\0' || *s == '\n') {
+
+ /* match, be happy */
+ s++;
+ matched = 1;
+ cs = MNEXT(cs);
+ } else if (*cs & ALT) {
+
+ /* try the next part */
+ matched = 0;
+ cs = MNEXT(cs);
+ } else if (*cs & OPT) {
+
+ /* doesn't matter */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else
+
+ /* no match, error return */
+ return (NULL);
+ break;
+
+ /* check for start of line */
+ case '^':
+ if (s == s_start) {
+
+ /* match, be happy */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else if (*cs & ALT) {
+
+ /* try the next part */
+ matched = 0;
+ cs = MNEXT(cs);
+ } else if (*cs & OPT) {
+
+ /* doesn't matter */
+ matched = 1;
+ cs = MNEXT(cs);
+ } else
+
+ /* no match, error return */
+ return (NULL);
+ break;
+
+ /* end of a subexpression, return success */
+ case ')':
+ return (s);
+ }
+ break;
+ }
+ }
+ return (s);
+}
diff --git a/usr.bin/vgrind/tmac.vgrind b/usr.bin/vgrind/tmac.vgrind
new file mode 100644
index 0000000..4b906ea
--- /dev/null
+++ b/usr.bin/vgrind/tmac.vgrind
@@ -0,0 +1,72 @@
+.\" $FreeBSD$
+.am vS
+..
+.am vE
+..
+'ss 23
+'ds _ \d\(mi\u
+'ps 9z
+'vs 10p
+'ds - \(mi
+'ds / \\h'\\w' 'u-\\w'/'u'/
+'ds /* \\h'\\w' 'u-\\w'/'u'/*
+'bd B 3
+'bd S B 3
+'nr cm 0
+'nf
+'de vH
+'ev 2
+'ft 1
+'sp .35i
+'tl '\s14\f3\\*(=F\fP\s0'\\*(=H'\f3\s14\\*(=F\fP\s0'
+'sp .25i
+'ft 1
+\f2\s12\h'\\n(.lu-\w'\\*(=f'u'\\*(=f\fP\s0\h'|0u'
+.sp .05i
+'ev
+'ds =G \\*(=F
+..
+'de vF
+'ev 2
+'sp .35i
+'ie o 'tl '\f2\\*(=M''Page % of \\*(=G\fP'
+'el 'tl '\f2Page % of \\*(=G''\\*(=M\fP'
+'bp
+'ev
+'ft 1
+'if \\n(cm=1 'ft 2
+..
+'de ()
+'pn 1
+..
+'de +C
+'nr cm 1
+'ft 2
+'ds +K
+'ds -K
+..
+'de -C
+'nr cm 0
+'ft 1
+'ds +K \f3
+'ds -K \fP
+..
+'+C
+'-C
+'am +C
+'ne 3
+..
+'de FN
+\f2\s14\h'\\n(.lu-\w'\\$1'u'\\$1\fP\s0\h'|0u'\c
+.if r x .if \\nx .if d =F .tm \\$1 \\*(=F \\n%
+'ds =f \&...\\$1
+..
+'de FC
+.if r x .if \\nx .if d =F .tm \\$1 \\*(=F \\n%
+'ds =f \&...\\$1
+..
+'de -F
+'rm =f
+..
+'ft 1
+'lg 0
diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c
new file mode 100644
index 0000000..ec0b4e0
--- /dev/null
+++ b/usr.bin/vgrind/vfontedpr.c
@@ -0,0 +1,716 @@
+/*
+ * Copyright (c) 1980, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <time.h>
+#include "pathnames.h"
+#include "extern.h"
+
+#define STANDARD 0
+#define ALTERNATE 1
+
+/*
+ * Vfontedpr.
+ *
+ * Dave Presotto 1/12/81 (adapted from an earlier version by Bill Joy)
+ *
+ */
+
+#define STRLEN 10 /* length of strings introducing things */
+#define PNAMELEN 40 /* length of a function/procedure name */
+#define PSMAX 20 /* size of procedure name stacking */
+
+static int iskw(char *);
+static bool isproc(char *);
+static void putKcp(char *, char *, bool);
+static void putScp(char *);
+static void putcp(int);
+static int tabs(char *, char *);
+static int width(char *, char *);
+
+/*
+ * The state variables
+ */
+
+static bool filter = false; /* act as a filter (like eqn) */
+static bool inchr; /* in a string constant */
+static bool incomm; /* in a comment of the primary type */
+static bool idx = false; /* form an index */
+static bool instr; /* in a string constant */
+static bool nokeyw = false; /* no keywords being flagged */
+static bool pass = false; /*
+ * when acting as a filter, pass indicates
+ * whether we are currently processing
+ * input.
+ */
+
+static int blklevel; /* current nesting level */
+static int comtype; /* type of comment */
+static char * defsfile[2] = { _PATH_VGRINDEFS, 0 };
+ /* name of language definitions file */
+static int margin;
+static int plstack[PSMAX]; /* the procedure nesting level stack */
+static char pname[BUFSIZ+1];
+static bool prccont; /* continue last procedure */
+static int psptr; /* the stack index of the current procedure */
+static char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */
+
+/*
+ * The language specific globals
+ */
+
+char *l_acmbeg; /* string introducing a comment */
+char *l_acmend; /* string ending a comment */
+char *l_blkbeg; /* string beginning of a block */
+char *l_blkend; /* string ending a block */
+char *l_chrbeg; /* delimiter for character constant */
+char *l_chrend; /* delimiter for character constant */
+char *l_combeg; /* string introducing a comment */
+char *l_comend; /* string ending a comment */
+char l_escape; /* character used to escape characters */
+char *l_keywds[BUFSIZ/2]; /* keyword table address */
+char *l_nocom; /* regexp for non-comments */
+char *l_prcbeg; /* regular expr for procedure begin */
+char *l_strbeg; /* delimiter for string constant */
+char *l_strend; /* delimiter for string constant */
+bool l_toplex; /* procedures only defined at top lex level */
+const char *language = "c"; /* the language indicator */
+
+#define ps(x) printf("%s", x)
+static char minus[] = "-";
+static char minusn[] = "-n";
+
+int
+main(int argc, char **argv)
+{
+ const char *fname = "";
+ struct stat stbuf;
+ char buf[BUFSIZ];
+ char *defs;
+ int needbp = 0;
+
+ argc--, argv++;
+ do {
+ char *cp;
+ int i;
+
+ if (argc > 0) {
+ if (!strcmp(argv[0], "-h")) {
+ if (argc == 1) {
+ printf("'ds =H\n");
+ argc = 0;
+ goto rest;
+ }
+ printf("'ds =H %s\n", argv[1]);
+ argc--, argv++;
+ argc--, argv++;
+ if (argc > 0)
+ continue;
+ goto rest;
+ }
+
+ /* act as a filter like eqn */
+ if (!strcmp(argv[0], "-f")) {
+ filter = true;
+ argv[0] = argv[argc-1];
+ argv[argc-1] = minus;
+ continue;
+ }
+
+ /* take input from the standard place */
+ if (!strcmp(argv[0], "-")) {
+ argc = 0;
+ goto rest;
+ }
+
+ /* build an index */
+ if (!strcmp(argv[0], "-x")) {
+ idx = true;
+ argv[0] = minusn;
+ }
+
+ /* indicate no keywords */
+ if (!strcmp(argv[0], "-n")) {
+ nokeyw = true;
+ argc--, argv++;
+ continue;
+ }
+
+ /* specify the font size */
+ if (!strncmp(argv[0], "-s", 2)) {
+ i = 0;
+ cp = argv[0] + 2;
+ while (*cp)
+ i = i * 10 + (*cp++ - '0');
+ printf("'ps %d\n'vs %d\n", i, i+1);
+ argc--, argv++;
+ continue;
+ }
+
+ /* specify the language */
+ if (!strncmp(argv[0], "-l", 2)) {
+ language = argv[0]+2;
+ argc--, argv++;
+ continue;
+ }
+
+ /* specify the language description file */
+ if (!strncmp(argv[0], "-d", 2)) {
+ defsfile[0] = argv[1];
+ argc--, argv++;
+ argc--, argv++;
+ continue;
+ }
+
+ /* open the file for input */
+ if (freopen(argv[0], "r", stdin) == NULL)
+ err(1, "%s", argv[0]);
+ if (idx)
+ printf("'ta 4i 4.25i 5.5iR\n'in .5i\n");
+ fname = argv[0];
+ argc--, argv++;
+ }
+ rest:
+
+ /*
+ * get the language definition from the defs file
+ */
+ i = cgetent(&defs, defsfile, language);
+ if (i == -1) {
+ fprintf (stderr, "no entry for language %s\n", language);
+ exit(0);
+ } else if (i == -2) { fprintf(stderr,
+ "cannot find vgrindefs file %s\n", defsfile[0]);
+ exit(0);
+ } else if (i == -3) { fprintf(stderr,
+ "potential reference loop detected in vgrindefs file %s\n",
+ defsfile[0]);
+ exit(0);
+ }
+ if (cgetustr(defs, "kw", &cp) == -1)
+ nokeyw = true;
+ else {
+ char **cpp;
+
+ cpp = l_keywds;
+ while (*cp) {
+ while (*cp == ' ' || *cp =='\t')
+ *cp++ = '\0';
+ if (*cp)
+ *cpp++ = cp;
+ while (*cp != ' ' && *cp != '\t' && *cp)
+ cp++;
+ }
+ *cpp = NULL;
+ }
+ cgetustr(defs, "pb", &cp);
+ l_prcbeg = convexp(cp);
+ cgetustr(defs, "cb", &cp);
+ l_combeg = convexp(cp);
+ cgetustr(defs, "ce", &cp);
+ l_comend = convexp(cp);
+ cgetustr(defs, "ab", &cp);
+ l_acmbeg = convexp(cp);
+ cgetustr(defs, "ae", &cp);
+ l_acmend = convexp(cp);
+ cgetustr(defs, "sb", &cp);
+ l_strbeg = convexp(cp);
+ cgetustr(defs, "se", &cp);
+ l_strend = convexp(cp);
+ cgetustr(defs, "bb", &cp);
+ l_blkbeg = convexp(cp);
+ cgetustr(defs, "be", &cp);
+ l_blkend = convexp(cp);
+ cgetustr(defs, "lb", &cp);
+ l_chrbeg = convexp(cp);
+ cgetustr(defs, "le", &cp);
+ l_chrend = convexp(cp);
+ if (cgetustr(defs, "nc", &cp) >= 0)
+ l_nocom = convexp(cp);
+ l_escape = '\\';
+ l_onecase = (cgetcap(defs, "oc", ':') != NULL);
+ l_toplex = (cgetcap(defs, "tl", ':') != NULL);
+
+ /* initialize the program */
+
+ incomm = false;
+ instr = false;
+ inchr = false;
+ _escaped = false;
+ blklevel = 0;
+ for (psptr=0; psptr<PSMAX; psptr++) {
+ pstack[psptr][0] = '\0';
+ plstack[psptr] = 0;
+ }
+ psptr = -1;
+ ps("'-F\n");
+ if (!filter) {
+ printf(".ds =F %s\n", fname);
+ ps("'wh 0 vH\n");
+ ps("'wh -1i vF\n");
+ }
+ if (needbp) {
+ needbp = 0;
+ printf(".()\n");
+ printf(".bp\n");
+ }
+ if (!filter) {
+ fstat(fileno(stdin), &stbuf);
+ cp = ctime(&stbuf.st_mtime);
+ cp[16] = '\0';
+ cp[24] = '\0';
+ printf(".ds =M %s %s\n", cp+4, cp+20);
+ }
+
+ /*
+ * MAIN LOOP!!!
+ */
+ while (fgets(buf, sizeof buf, stdin) != NULL) {
+ if (buf[0] == '\f') {
+ printf(".bp\n");
+ }
+ if (buf[0] == '.') {
+ printf("%s", buf);
+ if (!strncmp (buf+1, "vS", 2))
+ pass = true;
+ if (!strncmp (buf+1, "vE", 2))
+ pass = false;
+ continue;
+ }
+ prccont = false;
+ if (!filter || pass)
+ putScp(buf);
+ else
+ printf("%s", buf);
+ if (prccont && (psptr >= 0)) {
+ ps("'FC ");
+ ps(pstack[psptr]);
+ ps("\n");
+ }
+#ifdef DEBUG
+ printf ("com %o str %o chr %o ptr %d\n", incomm, instr, inchr, psptr);
+#endif
+ margin = 0;
+ }
+ needbp = 1;
+ } while (argc > 0);
+ exit(0);
+}
+
+#define isidchr(c) (isalnum(c) || (c) == '_')
+
+static void
+putScp(char *os)
+{
+ register char *s = os; /* pointer to unmatched string */
+ char dummy[BUFSIZ]; /* dummy to be used by expmatch */
+ char *comptr; /* end of a comment delimiter */
+ char *acmptr; /* end of a comment delimiter */
+ char *strptr; /* end of a string delimiter */
+ char *chrptr; /* end of a character const delimiter */
+ char *blksptr; /* end of a lexical block start */
+ char *blkeptr; /* end of a lexical block end */
+ char *nocomptr; /* end of a non-comment delimiter */
+
+ s_start = os; /* remember the start for expmatch */
+ _escaped = false;
+ if (nokeyw || incomm || instr)
+ goto skip;
+ if (isproc(s)) {
+ ps("'FN ");
+ ps(pname);
+ ps("\n");
+ if (psptr < PSMAX) {
+ ++psptr;
+ strncpy (pstack[psptr], pname, PNAMELEN);
+ pstack[psptr][PNAMELEN] = '\0';
+ plstack[psptr] = blklevel;
+ }
+ }
+skip:
+ do {
+ /* check for string, comment, blockstart, etc */
+ if (!incomm && !instr && !inchr) {
+
+ blkeptr = expmatch(s, l_blkend, dummy);
+ blksptr = expmatch(s, l_blkbeg, dummy);
+ comptr = expmatch(s, l_combeg, dummy);
+ acmptr = expmatch(s, l_acmbeg, dummy);
+ strptr = expmatch(s, l_strbeg, dummy);
+ chrptr = expmatch(s, l_chrbeg, dummy);
+ nocomptr = expmatch (s, l_nocom, dummy);
+
+ /* start of non-comment? */
+ if (nocomptr != NULL)
+ if ((nocomptr <= comptr || comptr == NULL)
+ && (nocomptr <= acmptr || acmptr == NULL)) {
+ /* continue after non-comment */
+ putKcp (s, nocomptr-1, false);
+ s = nocomptr;
+ continue;
+ }
+
+ /* start of a comment? */
+ if (comptr != NULL)
+ if ((comptr < strptr || strptr == NULL)
+ && (comptr < acmptr || acmptr == NULL)
+ && (comptr < chrptr || chrptr == NULL)
+ && (comptr < blksptr || blksptr == NULL)
+ && (comptr < blkeptr || blkeptr == NULL)) {
+ putKcp(s, comptr-1, false);
+ s = comptr;
+ incomm = true;
+ comtype = STANDARD;
+ if (s != os)
+ ps("\\c");
+ ps("\\c\n'+C\n");
+ continue;
+ }
+
+ /* start of a comment? */
+ if (acmptr != NULL)
+ if ((acmptr < strptr || strptr == NULL)
+ && (acmptr < chrptr || chrptr == NULL)
+ && (acmptr < blksptr || blksptr == NULL)
+ && (acmptr < blkeptr || blkeptr == NULL)) {
+ putKcp(s, acmptr-1, false);
+ s = acmptr;
+ incomm = true;
+ comtype = ALTERNATE;
+ if (s != os)
+ ps("\\c");
+ ps("\\c\n'+C\n");
+ continue;
+ }
+
+ /* start of a string? */
+ if (strptr != NULL)
+ if ((strptr < chrptr || chrptr == NULL)
+ && (strptr < blksptr || blksptr == NULL)
+ && (strptr < blkeptr || blkeptr == NULL)) {
+ putKcp(s, strptr-1, false);
+ s = strptr;
+ instr = true;
+ continue;
+ }
+
+ /* start of a character string? */
+ if (chrptr != NULL)
+ if ((chrptr < blksptr || blksptr == NULL)
+ && (chrptr < blkeptr || blkeptr == NULL)) {
+ putKcp(s, chrptr-1, false);
+ s = chrptr;
+ inchr = true;
+ continue;
+ }
+
+ /* end of a lexical block */
+ if (blkeptr != NULL) {
+ if (blkeptr < blksptr || blksptr == NULL) {
+ putKcp(s, blkeptr - 1, false);
+ s = blkeptr;
+ if (blklevel > 0 /* sanity */)
+ blklevel--;
+ if (psptr >= 0 && plstack[psptr] >= blklevel) {
+
+ /* end of current procedure */
+ if (s != os)
+ ps("\\c");
+ ps("\\c\n'-F\n");
+ blklevel = plstack[psptr];
+
+ /* see if we should print the last proc name */
+ if (--psptr >= 0)
+ prccont = true;
+ else
+ psptr = -1;
+ }
+ continue;
+ }
+ }
+
+ /* start of a lexical block */
+ if (blksptr != NULL) {
+ putKcp(s, blksptr - 1, false);
+ s = blksptr;
+ blklevel++;
+ continue;
+ }
+
+ /* check for end of comment */
+ } else if (incomm) {
+ comptr = expmatch(s, l_comend, dummy);
+ acmptr = expmatch(s, l_acmend, dummy);
+ if (((comtype == STANDARD) && (comptr != NULL)) ||
+ ((comtype == ALTERNATE) && (acmptr != NULL))) {
+ if (comtype == STANDARD) {
+ putKcp(s, comptr-1, true);
+ s = comptr;
+ } else {
+ putKcp(s, acmptr-1, true);
+ s = acmptr;
+ }
+ incomm = false;
+ ps("\\c\n'-C\n");
+ continue;
+ } else {
+ putKcp(s, s + strlen(s) -1, true);
+ s = s + strlen(s);
+ continue;
+ }
+
+ /* check for end of string */
+ } else if (instr) {
+ if ((strptr = expmatch(s, l_strend, dummy)) != NULL) {
+ putKcp(s, strptr-1, true);
+ s = strptr;
+ instr = false;
+ continue;
+ } else {
+ putKcp(s, s+strlen(s)-1, true);
+ s = s + strlen(s);
+ continue;
+ }
+
+ /* check for end of character string */
+ } else if (inchr) {
+ if ((chrptr = expmatch(s, l_chrend, dummy)) != NULL) {
+ putKcp(s, chrptr-1, true);
+ s = chrptr;
+ inchr = false;
+ continue;
+ } else {
+ putKcp(s, s+strlen(s)-1, true);
+ s = s + strlen(s);
+ continue;
+ }
+ }
+
+ /* print out the line */
+ putKcp(s, s + strlen(s) -1, false);
+ s = s + strlen(s);
+ } while (*s);
+}
+
+/*
+ * start: start of string to write
+ * end: end of string to write
+ * force: true if we should force nokeyw
+ */
+static void
+putKcp(char *start, char *end, bool force)
+{
+ int i;
+ int xfld = 0;
+
+ while (start <= end) {
+ if (idx) {
+ if (*start == ' ' || *start == '\t') {
+ if (xfld == 0)
+ printf("\001");
+ printf("\t");
+ xfld = 1;
+ while (*start == ' ' || *start == '\t')
+ start++;
+ continue;
+ }
+ }
+
+ /* take care of nice tab stops */
+ if (*start == '\t') {
+ while (*start == '\t')
+ start++;
+ i = tabs(s_start, start) - margin / 8;
+ printf("\\h'|%dn'", i * 10 + 1 - margin % 8);
+ continue;
+ }
+
+ if (!nokeyw && !force)
+ if ((*start == '#' || isidchr(*start))
+ && (start == s_start || !isidchr(start[-1]))) {
+ i = iskw(start);
+ if (i > 0) {
+ ps("\\*(+K");
+ do
+ putcp((unsigned char)*start++);
+ while (--i > 0);
+ ps("\\*(-K");
+ continue;
+ }
+ }
+
+ putcp((unsigned char)*start++);
+ }
+}
+
+
+static int
+tabs(char *s, char *os)
+{
+
+ return (width(s, os) / 8);
+}
+
+static int
+width(register char *s, register char *os)
+{
+ register int i = 0;
+
+ while (s < os) {
+ if (*s == '\t') {
+ i = (i + 8) &~ 7;
+ s++;
+ continue;
+ }
+ if (*s < ' ')
+ i += 2;
+ else
+ i++;
+ s++;
+ }
+ return (i);
+}
+
+static void
+putcp(register int c)
+{
+
+ switch(c) {
+
+ case 0:
+ break;
+
+ case '\f':
+ break;
+
+ case '\r':
+ break;
+
+ case '{':
+ ps("\\*(+K{\\*(-K");
+ break;
+
+ case '}':
+ ps("\\*(+K}\\*(-K");
+ break;
+
+ case '\\':
+ ps("\\e");
+ break;
+
+ case '_':
+ ps("\\*_");
+ break;
+
+ case '-':
+ ps("\\*-");
+ break;
+
+ case '`':
+ ps("\\`");
+ break;
+
+ case '\'':
+ ps("\\'");
+ break;
+
+ case '.':
+ ps("\\&.");
+ break;
+
+ case '*':
+ ps("\\fI*\\fP");
+ break;
+
+ case '/':
+ ps("\\fI\\h'\\w' 'u-\\w'/'u'/\\fP");
+ break;
+
+ default:
+ if (c < 040)
+ putchar('^'), c |= '@';
+ case '\t':
+ case '\n':
+ putchar(c);
+ }
+}
+
+/*
+ * look for a process beginning on this line
+ */
+static bool
+isproc(char *s)
+{
+ pname[0] = '\0';
+ if (!l_toplex || blklevel == 0)
+ if (expmatch(s, l_prcbeg, pname) != NULL) {
+ return (true);
+ }
+ return (false);
+}
+
+
+/* iskw - check to see if the next word is a keyword
+ */
+
+static int
+iskw(register char *s)
+{
+ register char **ss = l_keywds;
+ register int i = 1;
+ register char *cp = s;
+
+ while (++cp, isidchr(*cp))
+ i++;
+ while ((cp = *ss++))
+ if (!STRNCMP(s,cp,i) && !isidchr(cp[i]))
+ return (i);
+ return (0);
+}
diff --git a/usr.bin/vgrind/vgrind.1 b/usr.bin/vgrind/vgrind.1
new file mode 100644
index 0000000..8b4459f
--- /dev/null
+++ b/usr.bin/vgrind/vgrind.1
@@ -0,0 +1,242 @@
+.\" Copyright (c) 1980, 1990, 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.
+.\"
+.\" @(#)vgrind.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd August 29, 2006
+.Dt VGRIND 1
+.Os
+.Sh NAME
+.Nm vgrind
+.Nd grind nice listings of programs
+.Sh SYNOPSIS
+.Nm
+.Op Fl
+.Op Fl W
+.Op Fl d Ar file
+.Op Fl f
+.Op Fl h Ar header
+.Op Fl l Ns Ar language
+.Op Fl n
+.Op Fl p Ar postproc
+.Op Fl s Ar pointsize
+.Op Fl t
+.Op Fl x
+.Ar name Ar ...
+.Sh DESCRIPTION
+The
+.Nm
+utility formats the program sources specified as arguments
+on the command line in a nice style using
+.Xr troff 1 .
+Comments are placed in italics, keywords in bold face,
+and the name of the current function is listed down the margin of each
+page as it is encountered.
+.Pp
+The
+.Nm
+utility runs in two basic modes, filter mode (see the
+.Fl f
+option) or regular mode.
+In filter mode
+.Nm
+acts as a filter in a manner similar to
+.Xr tbl 1 .
+The standard input is passed directly to the standard output except
+for lines bracketed by the
+.Em troff-like
+macros:
+.Bl -tag -width Ds
+.It \&.vS
+starts processing
+.It \&.vE
+ends processing
+.El
+.Pp
+These lines are formatted as described above.
+The output from this
+filter can be passed to
+.Xr troff 1
+for output.
+There need be no particular ordering with
+.Xr eqn 1
+or
+.Xr tbl 1 .
+.Pp
+In regular mode
+.Nm
+accepts input files, processes them, and passes them to the postprocessor
+for output,
+.Xr psroff 1
+by default.
+.Pp
+In both modes
+.Nm
+passes any lines beginning with a decimal point without conversion.
+.Pp
+The options are:
+.Bl -tag -width Ar
+.It Fl
+forces input to be taken from standard input (default if
+.Fl f
+is specified)
+.It Fl W
+forces output to the (wide) Versatec printer rather than the (narrow)
+Varian
+.It Fl d Ar file
+specifies an alternate language definitions
+file (default is
+.Pa /usr/share/misc/vgrindefs )
+.It Fl f
+forces filter mode
+.It Fl h Ar header
+specifies a particular header to put on every output page (default is
+the file name)
+.It Fl l
+specifies the language to use.
+Currently known are
+.Tn PASCAL
+.Pq Fl l Ns Ar p ,
+.Tn MODEL
+.Pq Fl l Ns Ar m ,
+C
+.Pf ( Fl l Ns Ar c
+or the default),
+.Tn C++
+.Pq Fl l Ns Ar c++ ,
+.Tn CSH
+.Pq Fl l Ns Ar csh ,
+.Tn SHELL
+.Pq Fl l Ns Ar sh ,
+.Tn RATFOR
+.Pq Fl l Ns Ar r ,
+.Tn MODULA2
+.Pq Fl l Ns Ar mod2 ,
+.Tn YACC
+.Pq Fl l Ns Ar yacc ,
+.Tn LISP
+.Pq Fl l Ns Ar isp ,
+.Tn ICON
+.Pq Fl l Ns Ar I ,
+and
+.Tn PERL
+.Pq Fl l Ns Ar perl .
+.It Fl n
+forces no keyword bolding
+.It Fl p Ar postproc
+use
+.Ar postproc
+to post-process the output,
+.Xr psroff 1
+by default.
+.It Fl s Ar pointsize
+specifies a point size to use on output (exactly the same as the argument
+of a .ps)
+.It Fl t
+similar to the same option in
+.Xr troff 1
+causing formatted text to go to the standard output
+.It Fl x
+outputs the index file in a ``pretty'' format.
+The index file itself is produced whenever
+.Nm
+is run with a file called
+.Pa index
+in the current directory.
+The index of function
+definitions can then be run off by giving
+.Nm
+the
+.Fl x
+option and the file
+.Pa index
+as argument.
+.El
+.Sh FILES
+.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
+.It Pa index
+file where source for index is created
+.It Pa /usr/share/tmac/tmac.vgrind
+macro package
+.It Pa /usr/libexec/vfontedpr
+preprocessor
+.It Pa /usr/share/misc/vgrindefs
+language descriptions
+.El
+.Sh SEE ALSO
+.Xr getcap 3 ,
+.Xr vgrindefs 5
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Sh BUGS
+The vfontedpr preprocessor assumes that a certain programming style is
+followed:
+.Pp
+For
+.Tn C
+\- function names can be preceded on a line only by spaces, tabs, or an
+asterisk.
+The parenthesized arguments must also be on the same line.
+.Pp
+For
+.Tn PASCAL
+\- function names need to appear on the same line as the keywords
+.Em function
+or
+.Em procedure .
+.Pp
+For
+.Tn MODEL
+\- function names need to appear on the same line as the keywords
+.Em is beginproc .
+.Pp
+If these conventions are not followed, the indexing and marginal function
+name comment mechanisms will fail.
+.Pp
+More generally, arbitrary formatting styles for programs mostly look bad.
+The use of spaces to align source code fails miserably; if you plan to
+.Nm
+your program you should use tabs.
+This is somewhat inevitable since the
+font used by
+.Nm
+is variable width.
+.Pp
+The mechanism of
+.Xr ctags 1
+in recognizing functions should be used here.
+.Pp
+Filter mode does not work in documents using the
+.Fl me
+or
+.Fl ms
+macros.
+(So what use is it anyway?)
diff --git a/usr.bin/vgrind/vgrind.sh b/usr.bin/vgrind/vgrind.sh
new file mode 100644
index 0000000..c01f24d
--- /dev/null
+++ b/usr.bin/vgrind/vgrind.sh
@@ -0,0 +1,131 @@
+#!/bin/sh
+#
+# Copyright (c) 1980, 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.
+#
+# @(#)vgrind.sh 8.1 (Berkeley) 6/6/93
+#
+# $FreeBSD$
+#
+
+voptions=""
+options=""
+files=""
+f=""
+head=""
+vf="/usr/libexec/vfontedpr"
+tm="/usr/share/tmac"
+postproc="psroff"
+
+# Parse args
+while test $# -gt 0; do
+ case $1 in
+ -f)
+ f="filter"
+ options="$options -f"
+ ;;
+ -t)
+ voptions="$voptions -t"
+ ;;
+ -o*)
+ voptions="$voptions $1"
+ ;;
+ -W)
+ voptions="$voptions -W"
+ ;;
+ -d)
+ if test $# -lt 2; then
+ echo "$0: option $1 must have argument" >&2
+ exit 1
+ fi
+ options="$options $1 $2"
+ shift
+ ;;
+ -h)
+ if test $# -lt 2; then
+ echo "$0: option $1 must have argument" >&2
+ exit 1
+ fi
+ head="$2"
+ shift
+ ;;
+ -p)
+ if test $# -lt 2; then
+ echo "$0: option $1 must have argument" >&2
+ exit 1
+ fi
+ postproc="$2"
+ shift
+ ;;
+ -*)
+ options="$options $1"
+ ;;
+ *)
+ files="$files $1"
+ ;;
+ esac
+ shift
+done
+
+if test -r index; then
+ echo > nindex
+ for i in $files; do
+ # make up a sed delete command for filenames
+ # being careful about slashes.
+ echo "? $i ?d" | sed -e "s:/:\\/:g" -e "s:?:/:g" >> nindex
+ done
+ sed -f nindex index > xindex
+ if test "x$f" = xfilter; then
+ if test "x$head" != x; then
+ $vf $options -h "$head" $files
+ else
+ $vf $options $files
+ fi | cat $tm/tmac.vgrind -
+ else
+ if test "x$head" != x; then
+ $vf $options -h "$head" $files
+ else
+ $vf $options $files
+ fi | sh -c "$postproc -rx1 $voptions -i -mvgrind 2>> xindex"
+ fi
+ sort -df -k 1,2 xindex > index
+ rm nindex xindex
+else
+ if test "x$f" = xfilter; then
+ if test "x$head" != x; then
+ $vf $options -h "$head" $files
+ else
+ $vf $options $files
+ fi | cat $tm/tmac.vgrind -
+ else
+ if test "x$head" != x; then
+ $vf $options -h "$head" $files
+ else
+ $vf $options $files
+ fi | $postproc -i $voptions -mvgrind
+ fi
+fi
diff --git a/usr.bin/vgrind/vgrindefs.5 b/usr.bin/vgrind/vgrindefs.5
new file mode 100644
index 0000000..105223e
--- /dev/null
+++ b/usr.bin/vgrind/vgrindefs.5
@@ -0,0 +1,170 @@
+.\" Copyright (c) 1989, 1991, 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.
+.\"
+.\" @(#)vgrindefs.5 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1993
+.Dt VGRINDEFS 5
+.Os
+.Sh NAME
+.Nm vgrindefs
+.Nd language definition data base for
+.Xr vgrind 1
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+file
+contains all language definitions for
+.Xr vgrind 1 .
+The data base is
+very similar to
+.Xr termcap 5 .
+.Sh FIELDS
+The following table names and describes each field.
+.Bl -column Namexxx Tpexxx
+.It Sy "Name Type Description"
+.It "ab str regular expression for the start of an alternate comment"
+.It "ae str regular expression for the end of an alternate comment"
+.It "pb str regular expression for start of a procedure"
+.It "bb str regular expression for start of a lexical block"
+.It "be str regular expression for the end of a lexical block"
+.It "cb str regular expression for the start of a comment"
+.It "ce str regular expression for the end of a comment"
+.It "sb str regular expression for the start of a string"
+.It "se str regular expression for the end of a string"
+.It "lb str regular expression for the start of a character constant"
+.It "le str regular expression for the end of a character constant"
+.It "nc str regular expression for a non-comment (see below)"
+.It "tl bool present means procedures are only defined at the top lexical level"
+.It "oc bool present means upper and lower case are equivalent"
+.It "kw str a list of keywords separated by spaces"
+.El
+.Pp
+Non-comments are required to describe a certain context where a
+sequence that would normally start a comment loses its special
+meaning.
+A typical example for this can be found in Perl, where
+comments are normally starting with
+.Ql # ,
+while the string
+.Ql $#
+is an operator on an array.
+.Sh REGULAR EXPRESSIONS
+.Nm Vgrindefs
+uses regular expression which are very similar to those of
+.Xr ex 1
+and
+.Xr lex 1 .
+The characters `^', `$', `:' and `\e'
+are reserved characters and must be
+"quoted" with a preceding
+.Ql \e
+if they
+are to be included as normal characters.
+The metasymbols and their meanings are:
+.Bl -tag -width indent
+.It $
+the end of a line
+.It \&^
+the beginning of a line
+.It \ed
+a delimiter (space, tab, newline, start of line)
+.It \ea
+matches any string of symbols (like .* in lex)
+.It \ep
+matches any alphanumeric name.
+In a procedure definition (pb) the string
+that matches this symbol is used as the procedure name.
+.It ()
+grouping
+.It \&|
+alternation
+.It ?
+last item is optional
+.It \ee
+preceding any string means that the string will not match an
+input string if the input string is preceded by an escape character (\e).
+This is typically used for languages (like C) which can include the
+string delimiter in a string by escaping it.
+.El
+.Pp
+Unlike other regular expressions in the system, these match words
+and not characters.
+Hence something like "(tramp|steamer)flies?"
+would match "tramp", "steamer", "trampflies", or "steamerflies".
+.Sh KEYWORD LIST
+The keyword list is just a list of keywords in the language separated
+by spaces.
+If the "oc" boolean is specified, indicating that upper
+and lower case are equivalent, then all the keywords should be
+specified in lower case.
+.Sh FILES
+.Bl -tag -width /usr/share/misc/vgrindefs -compact
+.It Pa /usr/share/misc/vgrindefs
+File containing terminal descriptions.
+.El
+.Sh EXAMPLES
+The following entry, which describes the C language, is
+typical of a language entry.
+.Bd -literal
+C|c:\
+:pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e
+:lb=':le=\ee':tl:\e
+:kw=asm auto break case char continue default do double else enum\e
+extern float for fortran goto if int long register return short\e
+sizeof static struct switch typedef union unsigned while #define\e
+#else #endif #if #ifdef #ifndef #include #undef # define else endif\e
+if ifdef ifndef include undef:
+.Ed
+.Pp
+Note that the first field is just the language name (and any variants
+of it).
+Thus the C language could be specified to
+.Xr vgrind 1
+as "c" or "C".
+.Pp
+Entries may continue onto multiple lines by giving a \e as the last
+character of a line.
+Capabilities in
+.Nm
+are of two types:
+Boolean capabilities which indicate that the language has
+some particular feature
+and string
+capabilities which give a regular expression or
+keyword list.
+.Sh SEE ALSO
+.Xr troff 1 ,
+.Xr vgrind 1
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
diff --git a/usr.bin/vgrind/vgrindefs.src b/usr.bin/vgrind/vgrindefs.src
new file mode 100644
index 0000000..d59bad84
--- /dev/null
+++ b/usr.bin/vgrind/vgrindefs.src
@@ -0,0 +1,157 @@
+# Copyright (c) 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.
+#
+# $FreeBSD$
+#
+# @(#)vgrindefs.src 8.1 (Berkeley) 6/6/93
+#
+
+C|c:\
+ :pb=^\a?\d?*?\d?\p\d?\(\a?\)(\d|{):\
+ :bb={:be=}:cb=/*:ce=*/:sb=":se=\e":lb=':\
+ :le=\e':tl:\
+ :kw=asm auto break case char continue default do double else enum\
+ extern float for fortran goto if int long register return short\
+ sizeof static struct switch typedef union unsigned void while #define\
+ #else #endif #if #ifdef #ifndef #include #undef # define else endif\
+ if ifdef ifndef include undef:
+model|mod|m:\
+ :pb=^\d(space\d\p\drep)|(\p\dis|inline|public\dbeginproc):\
+ :bb=\dbeginproc|space|case\d:be=\dendproc|end\d|;:\
+ :cb=\$:ce=\$|$:sb=":se=":lb=':le=\a|$:\
+ :kw=abs and array beginproc boolean by case cdnl char copied dispose\
+ div do dynamic else elsif end endproc entry external FALSE false\
+ fi file for formal fortran global if iff ift\
+ in integer include inline is lbnd\
+ max min mod new NIL nil noresult not notin od of or procedure public\
+ read readln readonly record recursive rem rep repeat res\
+ result return set\
+ space string subscript such then TRUE true type ubnd union until\
+ varies while width:
+pascal|pasc|p:\
+ :pb=(^\d?procedure|function|program\d\p\d|\(|;|\:)|(=\d?record\d):\
+ :bb=\dcase|begin\d:be=\dend|forward\d|;:\
+ :cb={:ce=}:\
+ :ab=\(*:ae=*\):\
+ :sb=':se=':\
+ :kw=and array assert begin case const div do downto else end file for\
+ forward function goto if in label mod nil not of or packed procedure\
+ program record repeat set then to type until var while with oct hex\
+ external:
+ISP|isp|i:\
+ :cb=!:ce=!|$:oc:\
+ :kw=and begin decode define end eql eqv geq gtr if leave leq lss mod\
+ neq next not or otherwise repeat restart resume sr0 sr1 srd srr sl0 sl1\
+ sld slr tst xor:
+SH|sh:\
+ :bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':\
+ :le=\e':tl:\
+ :kw=break case cd continue do done \
+ elif else esac eval exec exit export \
+ fi for if in then while until \
+ read readonly set shift test trap umask wait:
+CSH|csh:\
+ :bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':\
+ :le=\e':tl:\
+ :kw=alias alloc break breaksw case cd chdir continue default\
+ echo else end endif endsw exec exit foreach \
+ glob goto history if logout nice nohup onintr repeat set\
+ setenv shift source switch then time \
+ while umask unalias unset wait while @ env \
+ argv child home ignoreeof noclobber noglob \
+ nomatch path prompt shell status verbose :
+ldl|LDL:\
+ :pb=^\p\::bb=\::be=;:cb=/*:ce=*/:sb=":se=\e":\
+ :kw=constant functions grammar reswords tokens add1 addste\
+ car cdr check colno cond cons copy defun divide empty enter\
+ eq equal findattr firstchild ge getattr getfield gt hash label\
+ lambda lastchild le leftsibling lookone lookup lt minus name ne\
+ newnode nextcom nil null parent plus precnl prevcom prog progn\
+ quote reglob return rightsibling self set setattr setfield setq\
+ stjoin sub1 t times tnull tokno ttype:
+Icon|icon|I:\
+ :pb=^\d?procedure\d\p\d?\(\a?\):\
+ :bb=(^\d?procedure\d\p\d?\(\a?\))|{:be=}|(^\d?end\d?$):\
+ :cb=#:ce=$:\
+ :sb=":se=\e":lb=':le=\e':tl:\
+ :kw=break by case create default do dynamic else end every external\
+ fail global if initial local next not of procedure record\
+ repeat return static suspend then to until using while\
+ &ascii &clock &cset &date &dateline &errout &fail &host &input\
+ &lcase &level &main &null &output &pos &random &source &subject\
+ &time &trace &ucase &version:
+ratfor|rat|r:\
+ :pb=(subroutine|function)\d\p\d?\(\a?\):\
+ :bb=(subroutine|function)\d\p\d?\(\a?\):be=^\d?end:\
+ :cb=#:ce=$:\
+ :sb=":se=\e":lb=':le=\e':oc:\
+ :kw=DRETURN DRIVER arith break case character default define do\
+ else elsedef enddef filedes for function goto if ifdef ifelse\
+ ifnotdef include incr integer linepointer next opeq pointer\
+ real repeat return select string subroutine substr until:
+modula2|mod2|m2:\
+ :pb=(^\d?(procedure|function|module)\d\p\d|\(|;|\:):\
+ :bb=\d(begin|case|for|if|loop|record|repeat|while|with)\d:\
+ :be=\dend|;:\
+ :cb={:ce=}:\
+ :ab=\(*:ae=*\):\
+ :sb=":se=":\
+ :oc:\
+ :kw=and array begin by case const\
+ definition div do else elsif end exit export\
+ for from if implementation import in\
+ loop mod module not of or pointer procedure qualified\
+ record repeat return set then to type\
+ until var while with:
+yacc|Yacc|y:\
+ :cb=/*:ce=*/:sb=":se=\e":lb=':le=\e':tl:\
+ :kw=%{ %} %% %union %token %type\
+ #else #endif #if #ifdef #ifndef #include #undef # define else endif\
+ if ifdef ifndef include undef:
+C++|c++:\
+ :pb=^\a?\d?*?\d?\p\d?\(\a?\)(\d|{):\
+ :bb={:be=}:cb=/*:ce=*/:ab=//:\
+ :ae=$:sb=":se=\e":lb=':\
+ :le=\e':tl:\
+ :kw=asm auto break case char continue default do double else enum\
+ extern float for fortran goto if int long register return short\
+ sizeof static struct switch typedef union unsigned while void #define\
+ #else #endif #if #ifdef #ifndef #include #undef # define endif\
+ ifdef ifndef include undef defined\
+ class const delete friend inline new operator overload private\
+ protected public virtual:
+#
+# Hack alert: defining function calls as `alternate comments' (ab/ae) seems
+# to be the only way to avoid major confusion inside vfontedpr for calls like:
+# &packagename'function;
+#
+Perl|perl|pl:\
+ :pb=sub\d\p\d:bb={:be=}:cb=#:ce=$:nc=\$#:tl:\
+ :ab=&:ae=(;|\d|,):\
+ :sb=":se=(\e"|$):lb=':le=(\e'|$):\
+ :kw=do if unless while until else elsif for foreach continue\
+ next redo sub last goto return die exit require:
diff --git a/usr.bin/vi/Makefile b/usr.bin/vi/Makefile
new file mode 100644
index 0000000..ae9814d
--- /dev/null
+++ b/usr.bin/vi/Makefile
@@ -0,0 +1,77 @@
+#
+# $FreeBSD$
+#
+
+.include <src.opts.mk>
+
+PACKAGE= vi
+SRCDIR= ${.CURDIR}/../../contrib/nvi
+SUBDIR+= catalog
+
+WARNS?= 0 # some warn issues on 32 bit machines
+
+VI= nvi
+EX= nex
+VIEW= nview
+
+PROG= nvi
+
+CFLAGS+= -D__REGEX_PRIVATE
+
+LINKS= ${BINDIR}/${VI} ${BINDIR}/${EX} ${BINDIR}/${VI} ${BINDIR}/${VIEW}
+LINKS+= ${BINDIR}/${VI} ${BINDIR}/vi ${BINDIR}/${EX} ${BINDIR}/ex
+LINKS+= ${BINDIR}/${VI} ${BINDIR}/view
+
+MAN= ${SRCDIR}/docs/man/vi.1
+MLINKS+=vi.1 ex.1 vi.1 view.1
+MLINKS+=vi.1 nex.1 vi.1 nview.1 vi.1 nvi.1
+
+.PATH: ${SRCDIR}/common
+.PATH: ${SRCDIR}/ex
+.PATH: ${SRCDIR}/cl
+.PATH: ${SRCDIR}/vi
+.PATH: ${SRCDIR}/regex
+
+CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/regex
+
+LIBADD= util ncursesw
+CFLAGS+= -DUSE_WIDECHAR
+
+.if ${MK_ICONV} == "yes" && !defined(RESCUE) && !defined(RELEASE_CRUNCH)
+CFLAGS+= -DUSE_ICONV
+.endif
+
+CLEANFILES+=${EX}
+
+# Vi curses sources
+SRCS+= cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c
+
+# General sources.
+SRCS+= conv.c cut.c delete.c encoding.c exf.c key.c line.c log.c main.c mark.c msg.c options.c \
+ options_f.c put.c recover.c screen.c search.c seq.c util.c
+
+# Ex source.
+SRCS+= ex.c ex_abbrev.c ex_append.c ex_args.c ex_argv.c ex_at.c ex_bang.c \
+ ex_cd.c ex_cmd.c ex_cscope.c ex_delete.c ex_display.c \
+ ex_edit.c ex_equal.c ex_file.c ex_filter.c ex_global.c \
+ ex_init.c ex_join.c ex_map.c ex_mark.c ex_mkexrc.c ex_move.c \
+ ex_open.c ex_preserve.c ex_print.c ex_put.c ex_quit.c \
+ ex_read.c ex_screen.c ex_script.c ex_set.c ex_shell.c \
+ ex_shift.c ex_source.c ex_stop.c ex_subst.c ex_tag.c \
+ ex_txt.c ex_undo.c ex_usage.c ex_util.c ex_version.c ex_visual.c \
+ ex_write.c ex_yank.c ex_z.c
+
+# Vi source.
+SRCS+= getc.c v_at.c v_ch.c v_cmd.c v_delete.c v_ex.c v_increment.c v_init.c \
+ v_itxt.c v_left.c v_mark.c v_match.c v_paragraph.c v_put.c v_redraw.c \
+ v_replace.c v_right.c v_screen.c v_scroll.c v_search.c v_section.c \
+ v_sentence.c v_status.c v_txt.c v_ulcase.c v_undo.c \
+ v_util.c v_word.c v_xchar.c v_yank.c v_z.c v_zexit.c vi.c
+
+# Vi screen source.
+SRCS+= vs_line.c vs_msg.c vs_refresh.c vs_relative.c vs_smap.c vs_split.c
+
+# Wide char regex
+SRCS+= regcomp.c regerror.c regexec.c regfree.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vi/Makefile.depend b/usr.bin/vi/Makefile.depend
new file mode 100644
index 0000000..57c7034
--- /dev/null
+++ b/usr.bin/vi/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vi/catalog/Makefile b/usr.bin/vi/catalog/Makefile
new file mode 100644
index 0000000..a045dbc
--- /dev/null
+++ b/usr.bin/vi/catalog/Makefile
@@ -0,0 +1,166 @@
+# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+PACKAGE=vi
+V= ${.CURDIR}/../../../contrib/nvi
+
+FILESGROUPS+=VICAT
+CAT= dutch english french german polish ru_RU.KOI8-R spanish swedish \
+ uk_UA.KOI8-U zh_CN.GB2312
+VICAT= ${CAT}
+VICATDIR= ${FILESDIR}
+VICATPACKAGE= ${PACKAGE}
+
+SCAN= ${V}/cl/*.c ${V}/common/*.c ${V}/ex/*.c ${V}/vi/*.c
+
+.PATH: ${V}/catalog
+
+all: dump
+
+build-tools: dump
+
+# Helper since iconv is non trivial to make a build tool
+utf8convert:
+.for c in dutch french german spanish swedish
+ iconv -f ISO8859-1 -t UTF-8 $V/catalog/$c.base > $c.UTF-8.base
+.endfor
+ iconv -f ISO8859-2 -t UTF-8 $V/catalog/polish.base > polish.UTF-8.base
+ iconv -f GB2312 -t UTF-8 $V/catalog/zh_CN.GB2312.base > zh_CN.UTF-8.base
+ iconv -f KOI8-R -t UTF-8 $V/catalog/ru_RU.KOI8-R.base > ru_RU.UTF-8.base
+ iconv -f KOI8-U -t UTF-8 $V/catalog/uk_UA.KOI8-U.base > uk_UA.UTF-8.base
+
+.for c in dutch french german polish spanish swedish zh_CN ru_RU uk_UA
+CAT+= $c.UTF-8
+.endfor
+
+.for c in ${CAT}
+${c}: ${c}.base
+ echo "... $c"; \
+ rm -f $c; \
+ env LANG=C sort -u ${.ALLSRC} | \
+ awk '{ \
+ if ($$1 == 1) { \
+ print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \
+ exit 1; \
+ } \
+ if (++nline > $$1) { \
+ print "DUPLICATE MESSAGE NUMBER " $$1; \
+ exit 1; \
+ } \
+ print $$0; \
+ }' | \
+ sed -e '1s/^/$$set 1~$$quote "~/; 1y/~/\n/' | \
+ gencat $c /dev/stdin; \
+ chmod 444 $c; \
+ if grep DUPLICATE $c > /dev/null; then \
+ grep DUPLICATE $@; \
+ fi; \
+ if grep 'NOT LEGAL' $c > /dev/null; then \
+ grep 'NOT LEGAL' $@; \
+ fi
+.endfor
+
+CHK= dutch.check english.check french.check german.check \
+ polish.check ru_RU.KOI8-R.check spanish.check swedish.check \
+ uk_UA.KOI8-U.check zh_CN.GB2312.check
+check: ${CHK}
+.for c in ${CAT}
+${c}.check: ${c}.base
+ @echo "... $c"; \
+ f=${.ALLSRC:S;.base$;;}; \
+ (echo "Unused message id's (this is okay):"; \
+ awk '{ \
+ while (++nline < $$1) \
+ printf "%03d\n", nline; \
+ }' < $$f.base; \
+ echo =========================; \
+ echo "MISSING ERROR MESSAGES (Please add!):"; \
+ awk '{print $$1}' < $$f.base | sort -u > __ck1; \
+ awk '{print $$1}' < english.base | sort -u > __ck2; \
+ comm -13 __ck1 __ck2; \
+ echo =========================; \
+ echo "Extra error messages (just delete them):"; \
+ comm -23 __ck1 __ck2; \
+ echo =========================; \
+ echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):"; \
+ for j in \
+ `sed '/^$$/d' < $$f.base | LANG=C sort -u | \
+ awk '{print $$1}' | uniq -d`; do \
+ egrep $$j $$f.base; \
+ done; \
+ echo =========================; \
+ echo "Duplicate messages, both id and message (this is okay):"; \
+ sed '/^$$/d' < $$f.base | LANG=C sort | uniq -c | \
+ awk '$$1 != 1 { print $$0 }' | sort -n; \
+ echo =========================) > $c
+.endfor
+
+english.base: dump ${SCAN} #Makefile
+ ${BTOOLSPATH:U.}/dump ${SCAN} |\
+ sed -e '/|/!d' \
+ -e 's/|/ "/' \
+ -e 's/^"//' |\
+ sort -nu > $@
+
+
+dump: dump.c ${BUILD_TOOLS_META}
+ ${CC} -o ${.TARGET} ${.ALLSRC}
+
+CLEANFILES+= dump ${CAT} english.base *.check __ck1 __ck2
+
+CATALOGS= ${CAT}
+NLLINKS= nl_NL
+ENLINKS= en_AU en_CA en_GB en_NZ en_US
+FRLINKS= fr_BE fr_CA fr_CH fr_FR
+DELINKS= de_AT de_CH de_DE
+ESLINKS= es_ES
+SVLINKS= sv_SE
+PLLINKS= pl_PL
+
+FILES= ${CATALOGS}
+FILESDIR= ${SHAREDIR}/vi/catalog
+SYMLINKS=
+.for l in ${NLLINKS}
+SYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= dutch.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+.for l in ${ENLINKS}
+SYMLINKS+= english ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= english ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= english ${FILESDIR}/$l.US-ASCII
+SYMLINKS+= english ${FILESDIR}/$l.UTF-8
+.endfor
+SYMLINKS+= english ${FILESDIR}/POSIX
+SYMLINKS+= english ${FILESDIR}/C
+.for l in ${FRLINKS}
+SYMLINKS+= french ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= french ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= french.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+.for l in ${DELINKS}
+SYMLINKS+= german ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= german ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= german.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+.for l in ${ESLINKS}
+SYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= spanish.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+.for l in ${SVLINKS}
+SYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-1
+SYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-15
+SYMLINKS+= swedish.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+.for l in ${PLLINKS}
+SYMLINKS+= polish ${FILESDIR}/$l.ISO8859-2
+SYMLINKS+= polish.UTF-8 ${FILESDIR}/$l.UTF-8
+.endfor
+SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GB18030
+SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GBK
+SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.eucCN
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vi/catalog/Makefile.depend b/usr.bin/vi/catalog/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/vi/catalog/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vi/catalog/dutch.UTF-8.base b/usr.bin/vi/catalog/dutch.UTF-8.base
new file mode 100644
index 0000000..eca193c
--- /dev/null
+++ b/usr.bin/vi/catalog/dutch.UTF-8.base
@@ -0,0 +1,306 @@
+002 "regel te lang"
+003 "kan regel %lu niet verwijderen"
+004 "kan niet toevoegen aan regel %lu"
+005 "kan niet invoegen vooraan regel %lu"
+006 "kan regel %lu niet opslaan"
+007 "kan laatste regel niet lezen"
+008 "Fout: kan regel %lu niet vinden"
+009 "log bestand"
+010 "Er vindt geen logging plaats, kan wijzigingen niet ongedaan maken"
+011 "geen wijzigingen om ongedaan te maken"
+012 "Er vindt geen logging plaats, kan wijzigingen niet ongedaan maken"
+013 "Er vindt geen logging plaats, herhaling niet mogelijk"
+014 "geen wijzigingen om te herhalen"
+015 "%s/%d: schrijven naar log mislukt"
+016 "Vi's standaard invoer en uitvoer moeten aan een terminal gekoppeld zijn"
+017 "Merk %s: niet gezet"
+018 "Merk %s: de regel is verwijderd"
+019 "Merk %s: de cursor positie bestaat niet meer"
+020 "Fout: "
+021 "nieuw bestand"
+022 "naam veranderd"
+023 "gewijzigd"
+024 "ongewijzigd"
+025 "NIET BEVEILIGD"
+026 "niet schrijfbaar"
+027 "regel %lu uit %lu [%ld%%]"
+028 "leeg bestand"
+029 "regel %lu"
+030 "Het bestand %s is geen message catalog"
+031 "Niet in staat om de standaard %s optie in te stellen"
+032 "Gebruik: %s"
+033 "set: optie %s onbekend: 'set all' laat alle opties zien"
+034 "set: [no]%s optie kan geen waarde hebben"
+035 "set: %s optie moet een waarde hebben"
+036 "set: %s optie: %s"
+037 "set: %s optie: %s: getal is te groot"
+038 "set: %s optie: %s is een ongeldige waarde"
+039 "set: %s optie moet een waarde hebben"
+040 "Te weinig kolommen op het scherm, minder dan %d"
+041 "Aantal kolommen te groot, meer dan %d"
+042 "Te weinig regels op het scherm, minder dan %d"
+043 "Aantal regels te groot, meer dan %d"
+044 "De lisp optie is niet ondersteund"
+045 "messages niet uitgeschakeld: %s"
+046 "messages niet geactiveerd: %s"
+047 "De %s optie moet karakter paren bevatten"
+053 "De standaard buffer is leeg"
+054 "Buffer %s is leeg"
+055 "Bestanden met newlines in de naam kunnen niet hersteld worden"
+056 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt"
+057 "Bestand wordt gecopieerd voor herstel..."
+058 "Herstel mechanisme werkt niet: %s"
+059 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt"
+060 "Kon bestand niet veilig stellen: %s"
+061 "Bestand wordt gecopieerd voor herstel..."
+062 "Informatie met betrekking tot gebruiker nummer %u niet gevonden"
+063 "Kan herstel bestand niet beveiligen"
+064 "herstel buffer overgelopen"
+065 "herstel bestand"
+066 "%s: verminkt herstel bestand"
+067 "%s: verminkt herstel bestand"
+068 "U heeft geen bestand genaamd %s te herstellen"
+069 "U kan eerdere versies van dit bestand herstellen"
+070 "U kan nog meer bestanden herstellen"
+071 "kan geen email versturen: %s"
+072 "Bestand leeg; niets om te doorzoeken"
+073 "Einde van het bestand bereikt zonder dat het patroon gevonden is"
+074 "Geen vorig zoek patroon"
+075 "Patroon niet gevonden"
+076 "Begin van het bestand bereikt zonder dat het patroon gevonden is"
+077 "Zoek-operatie omgeslagen"
+078 "Bezig met zoeken..."
+079 "Geen niet-printbaar karakter gevonden"
+080 "Onbekend commando"
+082 "Commando niet beschikbaar in ex mode"
+083 "Aantal mag niet nul zijn"
+084 "%s: ongeldige regel aanduiding"
+085 "Interne fout in syntax tabel (%s: %s)"
+086 "Gebruik: %s"
+087 "%s: tijdelijke buffer niet vrijgegeven"
+088 "Vlag offset voor regel 1"
+089 "Vlag offset voorbij bestands einde"
+090 "bestand/scherm veranderd tijdens uitvoeren van @ in een blok"
+091 "bestand/scherm veranderd tijdens uitvoeren van globaal/v commando"
+092 "Ex commando mislukt: rest van commando(s) genegeerd"
+093 "Ex commando mislukt: gemappede toetsen genegeerd"
+094 "Het tweede adres is kleiner dan het eerste"
+095 "Geen merk naam opgegeven"
+096 "\\ niet gevolgd door / of ?"
+097 "Referentie aan een regel nummer kleiner dan 0"
+098 "Het %s commando is onbekend"
+099 "Adres waarde te groot"
+100 "Adres waarde te klein"
+101 "Ongeldige adres combinatie"
+102 "Ongeldig adres: slechts %lu regels in het bestand aanwezig"
+103 "Ongeldig adres: het bestand is leeg"
+104 "Het %s commando staat het adres 0 niet toe"
+105 "Geen afkortingen om weer te geven"
+106 "Afkortingen moeten eindigen met een \"woord\" letter"
+107 "Afkortingen mogen geen tabulaties of spaties bevatten"
+108 "Afkortingen mogen geen woord/niet-woord karakters mengen, behalve aan het einde"
+109 "\"%s\" is geen afkorting"
+110 "Vi commando mislukt: gemappede toetsen genegeerd"
+111 "Dit is het laatste bestand"
+112 "Dit is het eerste bestand"
+113 "Dit is het eerste bestand"
+114 "lijst met bestanden is leeg"
+115 "Geen voorgaand commando om \"!\" te vervangen"
+116 "Geen bestandsnaam voor %%"
+117 "Geen bestandsnaam voor #"
+118 "Fout: execl: %s"
+119 "I/O fout: %s"
+120 "Bestand gewijzigd sinds laatste schrijfactie; schrijf het weg of gebruik ! om het te forceren"
+121 "Kan uw home directory niet vinden"
+122 "Nieuwe huidige directory: %s"
+123 "Geen cut buffers aanwezig"
+124 "Het %s commando kan niet gebruikt worden in een globaal of v commando"
+125 "%s/%s: niet gelezen: noch U noch root is de eigenaar"
+126 "%s/%s: niet gelezen: U bent niet de eigenaar"
+127 "%s/%s: niet gelezen: kan gewijzigd worden door andere gebruikers"
+128 "%s: niet gelezen: noch U noch root is de eigenaar"
+129 "%s: niet gelezen: U bent niet de eigenaar"
+130 "%s: niet gelezen: kan gewijzigd worden door andere gebruikers"
+131 "Geen volgende regel om samen te voegen"
+132 "Geen input map entries"
+133 "Geen command map entries"
+134 "Het %s karakter kan niet ge-remapped worden"
+135 "\"%s\" is niet gemapped"
+136 "Merk naam moet een enkel karakter zijn"
+137 "%s bestaat al, niet weggeschreven; gebruik ! om het te forceren"
+138 "Nieuw .exrc bestand: %s. "
+139 "doel regel ligt in het blok"
+140 "Het open commando vereist dat de open optie actief is"
+141 "Het open commando is nog niet ondersteund"
+142 "Kan dit bestand niet veilig stellen"
+143 "Bestand veilig gesteld"
+144 "%s resulteert in te veel bestandsnamen"
+145 "Alleen echte bestanden en named pipes kunnen gelezen worden"
+146 "%s: lees beveiliging niet beschikbaar"
+147 "Bezig met lezen..."
+148 "%s: %lu regels, %lu karakters"
+149 "Geen achtergrond schermen aanwezig"
+150 "Het script commando is alleen beschikbaar in vi mode"
+151 "Geen comando om uit te voeren"
+152 "shiftwidth optie op 0 gezet"
+153 "Count te groot"
+154 "Count te klein"
+155 "Reguliere expressie opgegeven; r vlag heeft geen betekenis"
+156 "De #, l en p vlaggen kunnen niet gecombineerd worden met de c vlag in vi mode"
+157 "Geen match gevonden"
+158 "Geen voorafgaande tag aanwezig"
+159 "Minder dan %s elementen op de tags stapel; gebruik :display t[ags]"
+160 "Geen bestand genaamd %s op de tags stapel; gebruik :display t[ags]"
+161 "Kies Enter om door te gaan: "
+162 "%s: tag niet gevonden"
+163 "%s: verminkte tag in %s"
+164 "%s: Het regel nummer van deze tag is voorbij het einde van het bestand"
+165 "De tags stapel is leeg"
+166 "%s: zoek patroon niet gevonden"
+167 "%d andere bestanden te wijzigen"
+168 "Buffer %s is leeg"
+169 "Bevestig wijziging? [n]"
+170 "Onderbroken"
+171 "Geen voorafgaande buffer om uit te voeren"
+172 "Geen vorige reguliere expressie"
+173 "Het %s commando vereist dat er een bestand geladen is"
+174 "Gebruik: %s"
+175 "Het visual commando vereist dat de open optie actief is"
+177 "Leeg bestand"
+178 "Geen voorafgaand F, f, T of t zoek commando"
+179 "%s niet gevonden"
+180 "Geen voorafgaand bestand te bewerken"
+181 "Cursor niet op een getal"
+182 "Getal wordt te groot"
+183 "Getal wordt te klein"
+184 "Geen overeenkomstig karakter op deze regel"
+185 "Overeenkomstig karakter niet gevonden"
+186 "Geen karakters te vervangen"
+187 "Geen ander scherm aanwezig"
+188 "Karakters achter het zoek patroon, de regel offset, en/of het z commando"
+189 "Geen voorafgaand zoek patroon"
+190 "Zoekopdracht na omslag teruggekeerd op originele positie"
+191 "Afkorting overschrijdt expansie limiet: karakters genegeerd"
+192 "Ongeldig karakter; quote to enter"
+193 "Reeds aan het begin van de invoer"
+194 "Niet meer karakters te verwijderen"
+195 "Verplaatsing voorbij het einde van het bestand"
+196 "Verplaatsing voorbij het einde van de regel"
+197 "Cursor niet verplaatst"
+198 "Reeds aan het begin van het bestand"
+199 "Verplaatsing voorbij het begin van het bestand"
+200 "Reeds in de eerste kolom"
+201 "Buffers moeten voor het commando opgegeven worden"
+202 "Reeds bij het einde van het bestand"
+203 "Reeds bij het einde van de regel"
+204 "%s is geen vi commando"
+205 "Gebruik: %s"
+206 "Geen karakters te verwijderen"
+207 "Het Q commando vereist de ex terminal interface"
+208 "Geen commando om te herhalen"
+209 "Het bestand is leeg"
+210 "%s mag niet gebruikt worden als een verplaatsings commando"
+211 "Al in commando mode"
+212 "Cursor niet in een woord"
+214 "Windows optie waarde is te groot, maximum is %u"
+215 "Toevoegen"
+216 "Veranderen"
+217 "Commando"
+218 "Invoegen"
+219 "Vervangen"
+220 "Verplaatsing voorbij het eind van het scherm"
+221 "Verplaatsing voorbij het begin van het scherm"
+222 "Scherm moet meer dan %d regels hebben om het te kunnen splitsen"
+223 "Er zijn geen achtergrond schermen"
+224 "Er is geen achtergrond scherm waarin U bestand %s aan het bewerken bent"
+225 "U kan uw enige scherm niet in de achtergrond zetten"
+226 "Het scherm kan slechts verkleind worden tot %d regels"
+227 "Het scherm kan niet kleiner"
+228 "Het scherm kan niet groter"
+230 "Dit scherm kan niet gesuspend worden"
+231 "Onderbroken: gemappede toetsen genegeerd"
+232 "vi: tijdelijke buffer niet vrijgegeven"
+233 "Deze terminal heeft geen %s toets"
+234 "Er kan slechts een buffer opgegeven worden"
+235 "Getal groter dan %lu"
+236 "Onderbroken"
+237 "Aanmaken van tijdelijk bestand is mislukt"
+238 "Waarschuwing: %s is geen regulier bestand"
+239 "%s is al geopend, bestand is in deze sessie niet schrijfbaar"
+240 "%s: verwijdering mislukt"
+241 "%s: sluiting mislukt"
+242 "%s: verwijdering mislukt"
+243 "%s: verwijdering mislukt"
+244 "Bestand niet schrijfbaar, niet weggeschreven; gebruik ! om het te forceren"
+245 "Bestand niet schrijfbaar, niet weggeschreven"
+246 "%s bestaat al, niet weggeschreven; gebruik ! om het te forceren"
+247 "%s bestaat al, niet weggeschreven"
+248 "Gebruik ! om een incompleet bestand weg te schrijven"
+249 "Bestand incompleet, niet weggeschreven"
+250 "%s: bestand op disk nieuwer dan deze versie; gebruik ! om het te forceren"
+251 "%s: bestand op disk nieuwer dan deze versie"
+252 "%s: schrijf beveiliging niet beschikbaar"
+253 "Bezig met schrijven..."
+254 "%s: WAARSCHUWING: BESTAND INCOMPLEET"
+255 "Reeds op de eerste tag van deze groep"
+256 "%s: nieuw bestand: %lu regels, %lu karakters"
+257 "%s: %lu regels, %lu karakters"
+258 "%s resulteert in te veel bestandsnamen"
+259 "%s: geen normaal bestand"
+260 "%s: U bent niet de eigenaar"
+261 "%s: kan gewijzigd worden door andere gebruikers"
+262 "Bestand gewijzigd sinds laatste schrijfactie; schrijf het weg of gebruik ! om het te forceren"
+263 "Bestand gewijzigd sinds laatste schrijfactie; schrijf het weg of gebruik :edit! om het te forceren"
+264 "Bestand gewijzigd sinds laatste schrijfactie; schrijf het weg of gebruik ! om het te forceren"
+265 "Tijdelijk bestand; exit negeert wijzigingen"
+266 "Bestand niet schrijfbaar, wijzigingen niet automatisch weggeschreven"
+267 "log opnieuw gestart"
+268 "Bevestig? [ynq]"
+269 "Druk op een toets om door te gaan: "
+270 "Druk op een toets om door te gaan [: voor meer ex commandos]: "
+271 "Druk op een toets om door te gaan [q om te stoppen]: "
+272 "Deze vorm van %s vereist de ex terminal interface"
+273 "Entering ex input mode."
+274 "Commando mislukt, nog geen bestand geladen."
+275 " doorgaan?"
+276 "Onverwacht character event"
+277 "Onverwacht end-of-file event"
+278 "Geen match gevonden voor dit patroon"
+279 "Onverwacht interrupt event"
+280 "Onverwacht quit event"
+281 "Onverwacht repaint event"
+282 "Reeds op de laatste tag van deze groep"
+283 "Het %s command vereist de ex terminal interface"
+284 "Deze vorm van %s is niet ondersteund als de secure edit optie actief is"
+285 "Onverwacht string event"
+286 "Onverwacht timeout event"
+287 "Onverwacht write event"
+289 "Shell expansies zijn niet ondersteund als de secure edit optie actief is"
+290 "Het %s commando is niet ondersteund als de secure edit optie actief is"
+291 "set: %s mag niet uitgezet worden"
+292 "Scherm te klein."
+293 "toegevoegd"
+294 "gewijzigd"
+295 "verwijderd"
+296 "samengevoegd"
+297 "verplaatst"
+298 "verschoven"
+299 "gebufferd"
+300 "regel"
+301 "regels"
+302 "Vi was niet geladen met een Tcl interpreter"
+303 "Bestand gewijzigd sinds het de laatste keer weg is geschreven."
+304 "Shell expansie mislukt"
+305 "Geen %s edit optie opgegeven"
+306 "Vi was niet geladen met een Perl interpreter"
+307 "Geen ex commando om uit te voeren"
+308 "Kies <CR> om commando uit te voeren, :q om te stoppen"
+309 "Gebruik \"cscope help\" voor uitleg"
+310 "Nog geen cscope connectie aanwezig"
+311 "%s: onbekend zoek type: gebruik een van %s"
+312 "%d: onbekende cscope sessie"
+313 "set: de %s optie mag nooit aangezet worden"
+314 "set: de %s optie mag nooit op 0 gezet worden"
+315 "%s: toegevoegd: %lu regels, %lu karakters"
+316 "Onverwacht resize event"
+317 "%d bestanden te wijzigen"
diff --git a/usr.bin/vi/catalog/french.UTF-8.base b/usr.bin/vi/catalog/french.UTF-8.base
new file mode 100644
index 0000000..eb6aad0
--- /dev/null
+++ b/usr.bin/vi/catalog/french.UTF-8.base
@@ -0,0 +1,306 @@
+002 "Dépassement de longueur de ligne"
+003 "impossible de supprimer la ligne %lu"
+004 "impossible d'ajouter à la ligne %lu"
+005 "impossible d'insérer devant la ligne %lu"
+006 "impossible de stocker la ligne %lu"
+007 "impossible d'obtenir la dernière ligne"
+008 "Erreur : impossible de récupérer la ligne %lu"
+009 "Fichier journal"
+010 "Aucune journalisation n'étant effectuée, impossible d'annuler"
+011 "Aucune action à annuler"
+012 "Aucune journalisation n'étant effectuée, impossible d'annuler"
+013 "Aucune journalisation n'étant effectuée, reprise actualisée impossible"
+014 "Aucune action à refaire"
+015 "%s/%d : Erreur d'écriture de journal"
+016 "L'entrée et la sortie Vi standards doivent être un terminal"
+017 "Marque %s : non définie"
+018 "Marque %s : la ligne a été supprimée"
+019 "Marque %s : la position du curseur n'existe plus"
+020 "Erreur : "
+021 "nouveau fichier"
+022 "le nom a changé"
+023 "modifié"
+024 "non modifié"
+025 "DÉVERROUILLÉ"
+026 "lecture seule"
+027 "ligne %lu de %lu [%ld%%]"
+028 "fichier vide"
+029 "ligne %lu"
+030 "Ce fichier %s n'est pas un catalogue de messages"
+031 "Impossible de configurer option %s par défaut"
+032 "Utilisation : %s"
+033 "Définition : pas d'option %s : 'set all' donne toutes les valeurs optionnelles"
+034 "Définition : option [no]%s ne prend pas de valeur"
+035 "Définition : l'option %s n'est pas booléenne"
+036 "Définition : option %s : %s"
+037 "Définition : option %s : %s : Dépassement de valeur"
+038 "Définition : option %s : %s n'est pas un nombre valide"
+039 "Définition : l'option %s n'est pas booléenne"
+040 "Les colonnes de l'écran sont trop petites, inférieures à %d"
+041 "Les colonnes de l'écran sont trop grandes, supérieures à %d"
+042 "Les lignes de l'écran sont trop courtes, inférieures à %d"
+043 "Les lignes de l'écran sont trop longues, supérieures à %d"
+044 "L'option lisp n'est pas implémentée"
+045 "Les messages ne sont pas désactivés : %s"
+046 "Les messages ne sont pas activés : %s"
+047 "L'option de %s doit être en groupe de deux caractères"
+053 "Le tampon par défaut est vide"
+054 "Le tampon %s est vide"
+055 "Les fichiers dont le nom contient des caractères de saut de ligne sont irrécupérables"
+056 "Impossible de récupérer les modifications si la session échoue"
+057 "Copie en cours du fichier pour récupération..."
+058 "La préservation a échoué : %s"
+059 "Impossible de récupérer les modifications si la session échoue"
+060 "La sauvegarde du fichier a échoué : %s"
+061 "Copie en cours du fichier pour récupération..."
+062 "Les renseignements sur l'identité %u de l'utilisateur sont introuvables"
+063 "Impossible de verrouiller le fichier de récupération"
+064 "Débordement de tampon du fichier de récupération"
+065 "Fichier de récupération"
+066 "%s : Fichier de récupération malformé"
+067 "%s : Fichier de récupération malformé"
+068 "Aucun fichier nommé %s à récupérer, que vous puissiez lire"
+069 "Il existe des versions récupérables antérieures à ce fichier"
+070 "Vous avez d'autres fichiers à récupérer"
+071 "pas d'envoi d'email : %s"
+072 "Fichier vide, rien à rechercher"
+073 "Fin de fichier atteinte sans trouver le motif"
+074 "Pas de motif de recherche précédent"
+075 "Motif introuvable"
+076 "Début du fichier atteint sans trouver le motif"
+077 "La recherche est revenue à son point de départ"
+078 "Recherche en cours..."
+079 "Caractère non-imprimable introuvable"
+080 "Nom de commande inconnu"
+082 "%s : Commande non disponible en ex mode"
+083 "Le compteur ne peut être zéro"
+084 "%s : mauvaise spécification de ligne"
+085 "Erreur de tableau de syntaxe interne (%s: %s)"
+086 "Utilisation : %s"
+087 "%s : tampon temporaire non libéré"
+088 "Décalage de drapeau hors de la ligne 1"
+089 "Décalage de drapeau hors de la fin du fichier"
+090 "@ avec plage, en cours d'exécution quand le fichier/l'écran a changé"
+091 "Commande Global/v en cours d'exécution quand le fichier/l'écran a changé"
+092 "La commande ex a échoué : commandes en attente abandonnées"
+093 "La commande ex a échoué : les touches affectées sont abandonnées"
+094 "La deuxième adresse est plus petite que la première"
+095 "Aucun nom de marque fourni"
+096 "\\ non suivi par / ou ?"
+097 "Référence à un numéro de ligne inférieure à 0"
+098 "La commande %s est inconnue"
+099 "Dépassement de la valeur adresse"
+100 "Dépassement négatif de la valeur adresse"
+101 "Combinaison d'adresse non valide"
+102 "Adresse non valide : il n'y a que %lu lignes dans ce fichier"
+103 "Adresse non valide : le fichier est vide"
+104 "La commande %s ne permet pas une adresse de 0"
+105 "Pas d'abréviations à afficher"
+106 "Les abréviations doivent finir par un caractère \"mot\""
+107 "Les abréviations ne peuvent pas contenir de tabulations ni d'espaces"
+108 "Les abréviations ne peuvent pas contenir un mélange de caractères mot/non-mot, sauf à la fin"
+109 "\"%s\" n'est pas une abréviation"
+110 "La commande Vi a échoué : Les touches affectées ont été abandonnées"
+111 "Plus de fichiers à éditer"
+112 "Pas de fichiers précédents à éditer"
+113 "Pas de fichiers précédents à rembobiner"
+114 "Pas de liste de fichiers à afficher"
+115 "Pas de commande précédente à remplacer \"!\""
+116 "Pas de nom de fichier à substituer à %%"
+117 "Pas de nom de fichier à substituer à #"
+118 "Erreur : execl : %s"
+119 "Erreur E/S : %s"
+120 "Fichier modifié depuis la dernière écriture complète ; écrire ou utiliser ! pour outrepasser"
+121 "Impossible de trouver l'emplacement du répertoire d'origine"
+122 "Nouveau répertoire en cours : %s"
+123 "Pas de tampon de coupure à afficher"
+124 "La commande %s ne peut pas être utilisée à l'intérieur d'une commande globale ou commande v"
+125 "%s/%s : échec de source : ni vous ni le super-utilisateur n'êtes les propriétaires "
+126 "%s/%s : échec de source : vous n'êtes pas le propriétaire"
+127 "%s/%s : échec de source : peut être écrit par un utilisateur autre que le propriétaire"
+128 "%s : échec de source : ni vous ni le super-utilisateur n'êtes les propriétaires"
+129 "%s : échec de source : vous n'êtes pas le propriétaire"
+130 "%s : échec de source : peut être écrit par un utilisateur autre que le propriétaire"
+131 "Pas de lignes suivantes à joindre"
+132 "Pas d'entrées de mappage d'entrée"
+133 "Pas d'entrées de mappage de commandes"
+134 "Le caractère %s ne peut pas être remappé"
+135 "\"%s\" n'est pas actuellement mappé"
+136 "Les noms de marque ne doivent avoir qu'un caractère"
+137 "%s existe, non enregistré; utiliser ! pour outrepasser"
+138 "Nouveau fichier exrc : %s"
+139 "La ligne de destination est à l'intérieur de la plage à déplacer"
+140 "La commande ouverte nécessite que l'option ouverte soit définie"
+141 "La commande ouverte n'est pas encore implémentée"
+142 "La préservation de ce fichier est impossible"
+143 "Fichier préservé"
+144 "%s: étendu dans trop de noms de fichiers"
+145 "Vous ne pouvez lire que les fichiers standards et les canaux de transmission nommés"
+146 "%s: Interdiction de lecture non disponible"
+147 "Lecture en cours..."
+148 "%s: %lu lignes, %lu caractères"
+149 "Pas d'écrans d'arrière-plan à afficher"
+150 "La commande script n'est disponible qu'en mode vi"
+151 "Pas de commande à exécuter"
+152 "Option de largeur de décalage définie sur 0"
+153 "Compter dépassement"
+154 "Compter dépassement négatif"
+155 "Expression standard spécifiée; drapeau r superflu"
+156 "Vous ne pouvez pas en mode vi, combiner les drapeaux #, l et p avec le drapeau c"
+157 "Aucune correspondance trouvée"
+158 "Aucune marque précédente entrée"
+159 "Moins de %s entrées dans la pile de marques ; utilisez t[ags]"
+160 "Pas de fichier %s vers lequel retourner dans la pile de marques ; utiliser : affichage t[ags]"
+161 "Appuyez sur Entrée pour continuer :"
+162 "%s : marque introuvable"
+163 "%s : marque corrompue en %s"
+164 "%s : le numéro de ligne de la marque dépasse la fin du fichier"
+165 "La pile de marques est vide"
+166 "%s : motif de recherche introuvable"
+167 "%d fichiers supplémentaires à éditer"
+168 "Le tampon %s est vide
+169 "Confirmer les changements ? [n]"
+170 "Interrompu"
+171 "Pas de tampon précédent à exécuter"
+172 "Pas d'expression standard précédente"
+173 "La commande %s nécessite qu'un fichier ait déjà été lu en mémoire"
+174 "Utilisation : %s"
+175 "La commande visual nécessite que l'option open soit définie"
+177 "Fichier vide"
+178 "Pas de recherche précédente F, f, T ou t"
+179 "%s introuvable"
+180 "Pas de fichier précédent à éditer"
+181 "Le curseur n'est pas dans un nombre"
+182 "Le nombre obtenu est trop grand"
+183 "Le nombre obtenu est trop petit"
+184 "Pas de correspondance de caractère sur cette ligne"
+185 "Caractère correspondant introuvable"
+186 "Pas de caractères à remplacer"
+187 "Pas d'autre écran vers lequel basculer"
+188 "Caractères après la chaîne de recherche, décalage de ligne et/ou commande z"
+189 "Pas de motif de recherche précédent"
+190 "La recherche est revenue à son point de départ"
+191 "L'abréviation a dépassé la limite de l'expansion : caractères abandonnés"
+192 "Caractère non valide ; guillemet pour saisir"
+193 "Déjà au début de l'insertion"
+194 "Plus de caractères à effacer"
+195 "Déplacement hors de fin de fichier"
+196 "Déplacement hors de fin de ligne"
+197 "Aucun mouvement de curseur n'a été effectué"
+198 "Déjà au début du fichier"
+199 "Déplacement hors du début du fichier"
+200 "Déjà dans la première colonne"
+201 "Les tampons doivent être spécifiés avant la commande"
+202 "Déjà à la fin du fichier"
+203 "Déjà à la fin de la ligne"
+204 "%s n'est pas une commande vi"
+205 "Utilisation : %s"
+206 "Pas de caractères à supprimer"
+207 "La commande Q nécessite une interface terminal ex"
+208 "Pas de commande à répéter"
+209 "Le fichier est vide"
+210 "Vous ne pouvez pas utiliser %s comme commande de déplacement"
+211 "Déjà en mode commande"
+212 "Le curseur n'est pas dans un mot"
+214 "Valeur optionnelle de fenêtre trop grande, maximum est %u"
+215 "Ajouter"
+216 "Changer"
+217 "Commande"
+218 "Insérer"
+219 "Remplacer"
+220 "Déplacement hors de la fin d'écran"
+221 "Déplacement hors du début d'écran"
+222 "L'écran doit être supérieur à %d lignes pour se fractionner"
+223 "Il n'y a pas d'écran d'arrière-plan"
+224 "Il n'y a pas d'écran d'arrière-plan qui édite un fichier nommé %s"
+225 "Vous ne pouvez pas mettre à l'arrière-plan votre seul écran affiché"
+226 "L'écran ne peut être réduit qu'à %d rangs"
+227 "L'écran n'est pas auto-réductible"
+228 "L'écran n'est pas auto-extensible"
+230 "Vous ne pouvez pas mettre cet écran en attente"
+231 "Interrompu : les touches affectées ont été abandonnées"
+232 "vi : le tampon temporaire n' a pas été libéré"
+233 "Ce terminal n'a pas de touche %s"
+234 "Vous ne pouvez spécifier qu'un seul tampon"
+235 "Nombre supérieur à %lu"
+236 "Interrompu"
+237 "Impossible de créer un fichier temporaire"
+238 "Avertissement : %s n'est pas un fichier standard"
+239 "%s déjà verrouillé, session en lecture seule"
+240 "%s: supprimer"
+241 "%s: fermer"
+242 "%s: supprimer"
+243 "%s: supprimer"
+244 "Fichier en lecture seule, non écrit, utiliser ! pour outrepasser"
+245 "Fichier en lecture seule, non écrit"
+246 "%s existe, non écrit; utiliser ! pour outrepasser"
+247 "%s existe, non écrit"
+248 "Fichier partiel, non écrit; utiliser ! pour outrepasser"
+249 "Fichier partiel, non écrit"
+250 "%s: fichier modifié plus récemment que cet exemplaire; utiliser ! pour outrepasser"
+251 "%s: fichier modifié plus récemment que cet exemplaire"
+252 "%s: interdiction d'écriture non disponible"
+253 "Ecriture en cours..."
+254 "%s: AVERTISSEMENT : FICHIER TRONQUÉ"
+255 "Première marque de ce groupe déjà atteinte"
+256 "%s: nouveau fichier : %lu lignes, %lu caractères"
+257 "%s: %lu lignes, %lu caractères"
+258 "%s étendue à trop de noms de fichiers"
+259 "%s: pas un fichier standard"
+260 "%s: ne vous appartient pas"
+261 "%s: accessible par un utilisateur autre que son propriétaire"
+262 "Fichier modifé depuis la dernière écriture complète ; écrire ou utiliser ! pour outrepasser "
+263 "Fichier modifé depuis la dernière écriture complète ; écrire ou utiliser :edit! pour outrepasser"
+264 "Fichier modifé depuis la dernière écriture complète ; écrire ou utiliser ! pour outrepasser"
+265 "Fichier temporaire ; quitter annulera les modifications"
+266 "Fichier en lecture seule ; les modifications ne sont pas écrites automatiquement"
+267 "Journal redémarré"
+268 "confirmer ? [ynq]"
+269 "Appuyez sur n'importe quelle touche pour continuer : "
+270 "Appuyez sur n'importe quelle touche pour continuer [: pour entrer plus de commandes ex] : "
+271 "Appuyez sur n'importe quelle touche pour continuer [q pour Quitter]: "
+272 "Cette forme de %s nécessite l'interface de terminal ex"
+273 "Entrée de mode entrée ex."
+274 "La commande a échoué, aucun fichier n'a encore été lu."
+275 "cont?"
+276 "Evénement imprévu de caractère"
+277 "Evénement imprévu de fin-de-fichier"
+278 "Pas de correspondances pour cette requête"
+279 "Evénement imprévu d'interruption"
+280 "Evénement quitter imprévu"
+281 "Evénement imprévu de rafraîchissement"
+282 "La dernière marque de ce groupe a déjà été atteinte"
+283 "La commande %s nécessite l'interface de terminal ex"
+284 "Cette forme de %s n'est pas reconnue quand l'option d'édition protégée est activée"
+285 "Evénement imprévu de chaîne"
+286 "Evénement imprévu de délai imparti"
+287 "Evénement d'écriture imprévu"
+289 "Les expansions du shell ne sont pas reconnues quand l'option d'édition protégée est activée"
+290 "La commande %s n'est pas reconnue quand l'option d'édition protégée est activée"
+291 "Définition : l'option %s ne peut pas être désactivée"
+292 "Affichage trop petit."
+293 "ajouté"
+294 "changé"
+295 "supprimé"
+296 "joint"
+297 "déplacé"
+298 "décalé"
+299 "coupé"
+300 "ligne"
+301 "lignes"
+302 "Vi n'a pas été chargé avec un interprétateur Tcl"
+303 "Ficher modifié depuis le dernier enregistrement."
+304 "L'expansion du shell a échoué"
+305 "Pas d'option d'édition %s spécifiée"
+306 "Vi n'a pas été chargé avec un interprétateur Perl"
+307 "Pas de commande ex à exécuter"
+308 "Entrez <CR> pour exécuter une commande, :q pour quitter"
+309 "Utiliser \"cscope help\" pour obtenir de l'aide"
+310 "Aucune connexion cscope n'est lancée"
+311 "%s : type de recherche inconnu : utiliser un des %s"
+312 "%d : Il n'existe pas de telle session cscope"
+313 "Définition : l'option %s ne peut jamais être activée"
+314 "Définition : l'option %s ne peut jamais être définie sur 0"
+315 "%s: joints : %lu lignes, %lu caractères"
+316 "événement imprévu de redimensionnement"
+317 "%d fichiers à éditer"
diff --git a/usr.bin/vi/catalog/german.UTF-8.base b/usr.bin/vi/catalog/german.UTF-8.base
new file mode 100644
index 0000000..956fd82
--- /dev/null
+++ b/usr.bin/vi/catalog/german.UTF-8.base
@@ -0,0 +1,306 @@
+002 "Zeilenlängen-Überlauf"
+003 "kann Zeile %lu nicht löschen"
+004 "kann an Zeile %lu nicht anfügen"
+005 "kann in Zeile %lu nicht einfügen"
+006 "kann Zeile %lu nicht speichern"
+007 "kann letzte Zeile nicht lesen"
+008 "Fehler: kann Zeile %lu nicht wiederherstellen"
+009 "Protokolldatei"
+010 "Keine Protokollierung aktiv, Rückgängigmachen nicht möglich"
+011 "Keine Änderungen rückgängig zu machen"
+012 "Keine Protokollierung aktiv, Rückgängigmachen nicht möglich"
+013 "Keine Protokollierung aktiv, Wiederholung von Änderungen nicht möglich"
+014 "Keine Änderungen zu wiederholen"
+015 "%s/%d: Protokollschreibfehler"
+016 "Vi's Standardein- und -ausgabe muß ein Terminal sein"
+017 "Marke %s: nicht gesetzt"
+018 "Marke %s: die Zeile wurde gelöscht"
+019 "Marke %s: Cursorposition existiert nicht mehr"
+020 "Fehler: "
+021 "neue Datei"
+022 "Name geändert"
+023 "geändert"
+024 "nicht geändert"
+025 "NICHT GELOCKT"
+026 "nur zum Lesen"
+027 "Zeile %lu von %lu [%ld%%]"
+028 "leere Datei"
+029 "Zeile %lu"
+030 "Die Datei %s ist kein Meldungskatalog"
+031 "Setzen der Voreinstellung für %s Option nicht möglich"
+032 "Benutzung: %s"
+033 "set: keine %s Option: 'set all' zeigt alle Optionen mit Werten an"
+034 "set: der [no]%s Option kann kein Wert zugewiesen werden"
+035 "set: %s ist keine Boolsche Option"
+036 "set: %s Option: %s"
+037 "set: %s Option: %s: Werte-Ãœberlauf"
+038 "set: %s Option: %s ist eine ungültige Zahl"
+039 "set: %s ist keine Boolsche Option"
+040 "Bildschirm hat zu wenig Spalten, weniger als %d"
+041 "Bildschirm hat zu viele Spalten, mehr als %d"
+042 "Bildschirm hat zu wenig Zeilen, weniger als %d"
+043 "Bildschirm hat zu viele Zeilen, mehr als %d"
+044 "Die lisp-Option ist nicht implementiert"
+045 "Meldungen nicht abgeschaltet: %s"
+046 "Meldungen nicht eingeschaltet: %s"
+047 "Die %s-Option muß Gruppen zu zwei Zeichen enthalten"
+053 "Der Standardpuffer ist leer"
+054 "Puffer %s ist leer"
+055 "Dateien mit newlines im Namen sind nicht wiederherstellbar"
+056 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht"
+057 "kopiere Datei für Wiederherstellung ..."
+058 "Rettungsmechanismus funktioniert nicht: %s"
+059 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht"
+060 "Sicherung der Datei gescheitert: %s"
+061 "kopiere Datei für Wiederherstellung ..."
+062 "Informationen über den Benutzer mit id %u nicht gefunden"
+063 "Wiederherstellungsdatei kann nicht gelockt werden"
+064 "Puffer der Wiederherstellungsdatei übergelaufen"
+065 "Wiederherstellungsdatei"
+066 "%s: Wiederherstellungsdatei hat falsches Format"
+067 "%s: Wiederherstellungsdatei hat falsches Format"
+068 "Keine von Ihnen lesbaren Dateien mit Namen %s zum Wiederherstellen"
+069 "Es gibt ältere Versionen dieser Datei von Ihnen zum Wiederherstellen"
+070 "Sie haben noch andere Dateien zum Wiederherstellen"
+071 "schicke keine email: %s"
+072 "Datei leer; nichts zu suchen"
+073 "Dateiende erreicht, ohne das Suchmuster zu finden"
+074 "Kein altes Suchmuster"
+075 "Suchmuster nicht gefunden"
+076 "Dateianfang erreicht, ohne das Suchmuster zu finden"
+077 "Suche beginnt von vorn"
+078 "suche ..."
+079 "Keine nichtdruckbaren Zeichen gefunden"
+080 "Unbekannter Kommandoname"
+082 "%s: Kommando im ex-Modus nicht verfügbar"
+083 "Anzahl darf nicht Null sein"
+084 "%s: falsche Zeilenangabe"
+085 "Interner Syntaxtabellenfehler (%s: %s)"
+086 "Benutzung: %s"
+087 "%s: temporärer Puffer nicht freigegeben"
+088 "Flagoffset vor Zeile 1"
+089 "Flagoffset hinter dem Dateiende"
+090 "@ mit Bereich lief, als Datei/Anzeige geändert wurde"
+091 "globales oder v-Kommando lief, als Datei/Anzeige geändert wurde"
+092 "Ex-Kommando mißlungen: restliche Kommandoeingabe ignoriert"
+093 "Ex-Kommando mißlungen: umdefinierte Tasten ungültig"
+094 "Die zweite Adresse ist kleiner als die erste"
+095 "Kein Markenname angegeben"
+096 "\\ ohne folgenden / oder ?"
+097 "Referenz auf eine negative Zeilennummer"
+098 "Das Kommando %s ist unbekannt"
+099 "Adreßwert zu groß"
+100 "Adreßwert zu klein"
+101 "Ungültige Adreßkombination"
+102 "Ungültige Adresse: nur %lu Zeilen in der Datei"
+103 "Ungültige Adresse: die Datei ist leer"
+104 "Das Kommando %s erlaubt keine Adresse 0"
+105 "Keine Abkürzungen zum Anzeigen"
+106 "Abkürzungen müssen mit einem \"Wort\"-Zeichen enden"
+107 "Abkürzungen dürfen keine Tabulator- oder Leerzeichen enthalten"
+108 "In Abkürzungen dürfen außer am Ende Wort- und Nicht-Wort-Zeichen nicht gemischt werden"
+109 "\"%s\" ist keine Abkürzung"
+110 "Vi Kommando mißlungen: umdefinierte Tasten ungültig"
+111 "Keine weiteren Dateien zu editieren"
+112 "Keine vorhergehenden Dateien zu editieren"
+113 "Keine vorhergehenden Dateien für rewind"
+114 "Keine Dateiliste zum Anzeigen"
+115 "Kein vorhergehendes Kommando, um \"!\" zu ersetzen"
+116 "Kein Dateiname für %%"
+117 "Kein Dateiname für #"
+118 "Fehler: execl: %s"
+119 "E/A-Fehler: %s"
+120 "Datei wurde seit dem letzten vollständigen Schreiben geändert; schreibe oder verwende ! zum ignorieren"
+121 "Kann Homedirectory nicht bestimmen"
+122 "Neues aktuelles Directory: %s"
+123 "Keine Puffer anzuzeigen"
+124 "Das Kommando %s kann nicht als Teil eines global oder v Kommandos verwendet werden"
+125 "%s/%s: nicht gelesen: gehört weder Ihnen noch root"
+126 "%s/%s: nicht gelesen: gehört nicht Ihnen"
+127 "%s/%s: nicht gelesen: anderer Benutzer als Eigentümer hat Schreibrecht"
+128 "%s: nicht gelesen: gehört weder Ihnen noch root"
+129 "%s: nicht gelesen: gehört nicht Ihnen"
+130 "%s: nicht gelesen: anderer Benutzer als Eigentümer hat Schreibrecht"
+131 "Keine folgenden Zeilen zum Verbinden"
+132 "Kein input-Map Eintrag"
+133 "Kein command-Map Eintrag"
+134 "Das %s Zeichen kann nicht umgemappt werden"
+135 "\"%s\" ist momentan nicht gemappt"
+136 "Markennamen müssen einzelne Buchstaben sein"
+137 "%s existiert, nicht geschrieben; verwende ! zum Ãœberschreiben"
+138 "Neue .exrc Datei: %s. "
+139 "Zielzeile ist innerhalb des Verschiebebereichs"
+140 "Das open Kommando verlangt, daß die open Option gesetzt ist"
+141 "Das open Kommando ist nocht nicht implementiert"
+142 "Rettung dieser Datei nicht möglich"
+143 "Datei gerettet"
+144 "%s wurde in zu viele Dateinamen expandiert"
+145 "Nur reguläre Dateien und named pipes können gelesen werden"
+146 "%s: Locken zum Lesen war nicht möglich"
+147 "lese ..."
+148 "%s: %lu Zeilen, %lu Zeichen"
+149 "Keine Hintergrundanzeigen vorhanden"
+150 "Das script Kommando ist nur im vi Modus verfügbar"
+151 "Kein Kommando auszuführen"
+152 "shiftwidth Option auf 0 gesetzt"
+153 "Anzahl-Ãœberlauf"
+154 "Anzahl-Unterlauf"
+155 "Regulärer Ausdruck angegeben; r Flag bedeutungslos"
+156 "Die #, l und p Flags können im vi Modus nicht mit dem c Flag kombiniert werden"
+157 "Keine Ãœbereinstimmung gefunden"
+158 "Kein vorhergehender 'tag' angegeben"
+159 "Weniger als %s Einträge auf dem 'tag'-Stack; verwende :display t[ags]"
+160 "Keine Datei namens %s auf dem 'tag'-Stack; verwende :display t[ags]"
+161 "Drücke Enter um fortzufahren: "
+162 "%s: 'tag' nicht gefunden"
+163 "%s: kaputter 'tag' in %s"
+164 "%s: die Zeilennummer des 'tag' ist hinter dem Dateiende"
+165 "Der 'tag' Stack ist leer"
+166 "%s: Suchmuster nicht gefunden"
+167 "%d weitere Dateien zu editieren"
+168 "Puffer %s ist leer"
+169 "Bestätige Änderung [n]"
+170 "Unterbrochen."
+171 "Kein vorhergehender Puffer zum Ausführen"
+172 "Kein vorhergehender regulärer Ausdruck"
+173 "Das Kommando %s verlangt, daß bereits eine Datei eingelesen wurde"
+174 "Benutzung: %s"
+175 "Das visual Kommando verlangt daß die open Option gesetzt ist"
+177 "Leere Datei"
+178 "Keine vorhergehende F, f, T oder t Suche"
+179 "%s nicht gefunden"
+180 "Keine vorhergehende Datei zu editieren"
+181 "Cursor nicht auf einer Zahl"
+182 "Sich ergebende Zahl ist zu groß"
+183 "Sich ergebende Zahl ist zu klein"
+184 "Kein korrespondierendes Zeichen in dieser Zeile"
+185 "Korrespondierendes Zeichen nicht gefunden"
+186 "Keine Zeichen zu ersetzen"
+187 "Keine andere Anzeige zum Hinschalten"
+188 "Zeichen nach Suchmuster, Zeilenoffset und/oder z Kommando"
+189 "Kein altes Suchmuster"
+190 "Suche zur ursprünglichen Position zurückgekehrt"
+191 "Abkürzung überschreitet Expansionsgrenze: Zeichen weggelassen"
+192 "Nicht erlaubtes Zeichen; maskiere zum Eingeben"
+193 "Bereits am Anfang der Eingabe"
+194 "Keine weiteren Zeichen zu löschen"
+195 "Bewegung hinter das Dateiende"
+196 "Bewegung hinter das Zeilenende"
+197 "Keine Cursorbewegung gemacht"
+198 "Bereits am Dateianfang"
+199 "Bewegung vor den Dateianfang"
+200 "Bereits in der ersten Spalte"
+201 "Puffer sollen vor dem Kommando angegeben werden"
+202 "Bereits am Dateiende"
+203 "Bereits am Zeilenende"
+204 "%s ist kein vi Kommando"
+205 "Benutzung: %s"
+206 "Keine Zeichen zu löschen"
+207 "Das Q Kommando benötigt das ex Terminal Interface"
+208 "Kein Kommando zu wiederholen"
+209 "Die Datei ist leer"
+210 "%s kann nicht als Bewegungskommando verwendet werden"
+211 "Bereits im Kommando-Modus"
+212 " Cursor nicht auf einem Wort"
+214 "Wert der Window Option ist zu groß, max ist %u"
+215 "Anhängen"
+216 "Ändern"
+217 "Kommando"
+218 "Einfügen"
+219 "Ersetzen"
+220 "Bewegung hinter das Anzeigenende"
+221 "Bewegung vor den Anzeigenanfang"
+222 "Anzeige muß für Bildschirmteilung größer als %d sein"
+223 "Keine Hintergrundanzeigen vorhanden"
+224 "Es gibt keine Hintergrundanzeige, die eine Datei namens %s editiert"
+225 "Die einzige dargestellte Anzeige kann nicht in den Hintergrund gebracht werden"
+226 "Die Anzeige kann nur auf %d Zeilen verkleinert werden"
+227 "Die Anzeige kann nicht verkleinert werden"
+228 "Die Anzeige kann nicht vergrößert werden"
+230 "Diese Anzeige kann nicht gestopt werden"
+231 "Unterbrochen: umdefinierte Tasten ungültig"
+232 "vi: temporärer Puffer nicht freigegeben"
+233 "Dieses Terminal hat keine %s Taste"
+234 "es kann nur ein Puffer angegeben werden"
+235 "Zahl größer als %lu"
+236 "Unterbrochen"
+237 "Nicht möglich, temporäre Datei anzulegen"
+238 "Warnung: %s ist keine reguläre Datei"
+239 "%s ist bereits gelockt, Editorsitzung schreibgeschützt"
+240 "%s: löschen"
+241 "%s: schließen"
+242 "%s: löschen"
+243 "%s: löschen"
+244 "Datei nicht schreibbar, nicht geschrieben; verwende ! zum Ãœberschreiben"
+245 "Datei nicht schreibbar, nicht geschrieben"
+246 "%s existiert, nicht geschrieben; verwende ! zum Ãœberschreiben"
+247 "%s existiert, nicht geschrieben"
+248 "Teil der Datei, nicht geschrieben; verwende ! zum Ãœberschreiben"
+249 "Teil der Datei, nicht geschrieben"
+250 "%s: Datei wurde später als diese Kopie verändert; verwende ! zum Überschreiben"
+251 "%s: Datei wurde später als diese Kopie verändert"
+252 "%s: Locken zum Schreiben war nicht möglich"
+253 "schreibe ..."
+254 "%s: WARNUNG: DATEI ABGESCHNITTEN"
+255 "Bereits am ersten 'tag' dieser Gruppe"
+256 "%s: neue Datei: %lu Zeilen, %lu Zeichen"
+257 "%s: %lu Zeilen, %lu Zeichen"
+258 "%s wurde in zu viele Dateinamen expandiert"
+259 "%s: keine reguläre Datei"
+260 "%s: gehört nicht Ihnen"
+261 "%s: anderer Benutzer als Eigentümer hat Zugriff"
+262 "Datei wurde seit dem letzten vollständigen Schreiben geändert; schreibe oder verwende ! zum ignorieren"
+263 "Datei wurde seit dem letzten vollständigen Schreiben geändert; schreibe oder verwende :edit! zum ignorieren"
+264 "Datei wurde seit dem letzten vollständigen Schreiben geändert; schreibe oder verwende ! zum ignorieren"
+265 "Datei ist temporär; beim Verlassen gehen die Änderungen verloren"
+266 "Datei ist schreibgeschützt, Änderungen werden nicht automatisch geschrieben"
+267 "Portokollierung neu begonnen"
+268 "bestätigen [ynq]"
+269 "Drücke beliebige Taste um fortzufahren"
+270 "Drücke beliebige Taste um fortzufahren [: um weitere Kommandos einzugeben]: "
+271 "Drücke beliebige Taste um fortzufahren [q zum Verlassen]: "
+272 "Diese Form von %s benötigt das ex Terminal-Interface"
+273 "Gehe in ex Eingabe-Modus.\n"
+274 "Kommando schiefgelaufen, noch keine Datei eingelesen"
+275 " weiter?"
+276 "unerwartetes Zeichen - Ereignis"
+277 "unerwartetes Dateiende - Ereignis"
+278 "Keine Position zum Anspringen gefunden"
+279 "unerwartetes Unterbrechungs - Ereignis"
+280 "unerwartetes Verlassen - Ereignis"
+281 "unerwartetes Wiederherstellungs - Ereignis"
+282 "Bereits am letzten 'tag' dieser Gruppe"
+283 "Das %s Kommando benötigt das ex Terminal-Interface"
+284 "Diese Form von %s wird nicht unterstützt wenn die 'secure edit' - Option gesetzt ist"
+285 "unerwartetes Zeichenketten - Ereignis"
+286 "unerwartetes timeout - Ereignis"
+287 "unerwartetes Schreibe - Ereignis"
+289 "Shell Expandierungen nicht unterstützt wenn die 'secure edit' - Option gesetzt ist"
+290 "Das %s Kommando wird nicht unterstützt wenn die 'secure edit' - Option gesetzt ist"
+291 "set: %s kann nicht ausgeschaltet werden"
+292 "Anzeige zu klein."
+293 "angefügt"
+294 "geändert"
+295 "gelöscht"
+296 "verbunden"
+297 "verschoben"
+298 "geschoben"
+299 "in Puffer geschrieben"
+300 "Zeile"
+301 "Zeilen"
+302 "Vi wurde nicht mit dem Tcl Interpreter gelinkt"
+303 "Datei wurde seit dem letzten Schreiben verändert."
+304 "Shell Expansion hat nicht geklappt"
+305 "Es ist keine %s Editieroption angegeben"
+306 "Vi wurde nicht mit einem Perl Interpreter geladen"
+307 "Kein ex Kommando auszuführen"
+308 "Drücke <CR> um ein Kommando auszuführen, :q zum verlassen"
+309 "Verwende \"cscope help\" für Hilestellung"
+310 "Keine cscope Verbindung aktiv"
+311 "%s: unbekannter Suchtyp: verwende einen aus %s"
+312 "%d: keine solche cscope Verbindung"
+313 "set: die %s Option kann nicht eingeschaltet werden"
+314 "set: die %s Option kann nicht auf 0 gesetzt werden"
+315 "%s: angefügt: %lu Zeilen, %lu Zeichen"
+316 "unerwartetes Größenveränderungs - Ereignis"
+317 "%d Dateien zu edieren"
diff --git a/usr.bin/vi/catalog/polish.UTF-8.base b/usr.bin/vi/catalog/polish.UTF-8.base
new file mode 100644
index 0000000..9648e78
--- /dev/null
+++ b/usr.bin/vi/catalog/polish.UTF-8.base
@@ -0,0 +1,306 @@
+002 "Zbyt długa linia"
+003 "nie można usunąć linii %lu"
+004 "nie można dodać do linii %lu"
+005 "nie można wstawić w linii %lu"
+006 "nie można zachować linii %lu"
+007 "nie można pobrać ostatniej linii"
+008 "Błąd: nie można pobrać linii %lu"
+009 "Plik logu"
+010 "Brak logowania, anulowanie (undo) niemożliwe"
+011 "Brak zmian do anulowania"
+012 "Brak logowania, anulowanie (undo) niemożliwe"
+013 "Brak logowania, nie można przeglądać do przodu"
+014 "Brak zmian do powtórzenia"
+015 "%s/%d: błąd zapisu do logu"
+016 "Standardowe wejście i wyjście vi musi być terminalem"
+017 "Znacznik %s: nie ustawiony"
+018 "Znacznik %s: linia została usunięta"
+019 "Znacznik %s: pozycja kursora już nie istnieje"
+020 "BÅ‚Ä…d: "
+021 "nowy plik"
+022 "nazwa została zmieniona"
+023 "zmieniony"
+024 "nie zmieniony"
+025 "ODBLOKOWANY"
+026 "tylko do odczytu"
+027 "linia %lu z %lu [%ld%%]"
+028 "pusty plik"
+029 "linia %lu"
+030 "Plik %s nie jest katalogiem komunikatów"
+031 "Nie można ustawić domyślnej opcji %s"
+032 "Sposób użycia: %s"
+033 "set: brak opcji %s: 'set all' wyświetla wartości opcji"
+034 "set: opcja no]%s nie pobiera wartości"
+035 "set: opcja %s nie jest zmiennÄ… boolowskÄ…"
+036 "set: opcja %s: %s"
+037 "set: opcja %s: %s: przepełnienie"
+038 "set: opcja %s: %s nie jest poprawnÄ… liczbÄ…"
+039 "set: opcja %s nie jest zmiennÄ… boolowskÄ…"
+040 "Zbyt mała liczba kolumn ekranu, mniejsza niż %d"
+041 "Zbyt duża liczba kolumn, większa niż %d"
+042 "Zbyt mała liczba wierszy ekranu, mniejsza niż %d"
+043 "Zbyt duża liczba wierszy ekranu, większa niż %d"
+044 "Opcja lisp nie jest zaimplementowana"
+045 "komunikaty nie wyłączone: %s"
+046 "komunikaty nie włączone: %s"
+047 "Opcja %s musi składać się z dwóch grup symboli"
+053 "Domyślny bufor jest pusty"
+054 "Bufor %s jest pusty"
+055 "Pliki z symbolem nowego wiersza w nazwie nie mogą być odtworzone"
+056 "Zmiany nie do odtworzenia, jeśli sesja zostanie przerwana"
+057 "Tworzenie kopii zapasowej..."
+058 "BÅ‚Ä…d podczas zachowywania: %s"
+059 "Zmiany nie do odtworzenia, jeśli sesja zostanie przerwana"
+060 "BÅ‚Ä…d podczas tworzenia kopii zapasowej: %s"
+061 "Tworzenie kopii zapasowej..."
+062 "Nie znaleziono informacji o użytkowniku numer %u"
+063 "Nie można zablokować kopii zapasowej"
+064 "Przepełnienie bufora kopii zapasowej"
+065 "Kopia zapasowa"
+066 "%s: błędna kopia zapasowa"
+067 "%s: błędna kopia zapasowa"
+068 "Brak plików o nazwie %s, które mógłbyś odczytać, do odzyskania"
+069 "Istnieją starsze wersje tego pliku, które można odzyskać"
+070 "Istnieją inne pliki, które można odzyskać"
+071 "nie wysyłam poczty: %s"
+072 "Pusty plik; nie ma czego szukać"
+073 "Dotarto do końca pliku bez znalezienia szukanego wzorca"
+074 "Brak poprzedniego wzorca poszukiwań"
+075 "Nie znaleziono wzorca"
+076 "Dotarto do poczÄ…tku pliku bez znalezienia szukanego wzorca"
+077 "Poszukiwanie od poczÄ…tku"
+078 "Szukam..."
+079 "Nie znaleziono niedrukowalnych znaków"
+080 "Nieznana nazwa polecenia"
+082 "%s: polecenie niedostępne w trybie edytora ex"
+083 "Liczba nie może być zerem"
+084 "%s: błędny numer linii"
+085 "Wewnętrzny błąd tablicy składni (%s: %s)"
+086 "Sposób użycia: %s"
+087 "%s: tymczasowy bufor nie został zwolniony"
+088 "Przesunięcie przed linię 1"
+089 "Przesunięcie poza koniec pliku"
+090 "@ with range running when the file/screen changed"
+091 "Wykonywano polecenie globalne/wizualne podczas zmiany pliku/ekranu"
+092 "Błąd polecenie ex: pozostałe polecenia anulowane"
+093 "BÅ‚Ä…d polecenia ex: mapowanie klawiszy anulowane"
+094 "Drugi adres jest mniejszy od pierwszego"
+095 "Nie podano nazwy znacznika"
+096 "\\ bez / lub ?"
+097 "Odniesienie do linii o numerze mniejszym od 0"
+098 "Nieznane polecenie %s"
+099 "Przepełnienie wartości adresu"
+100 "Niedomiar wartości adresu"
+101 "Niedozwolona kombinacja adresu"
+102 "Niedozwolony adres: jest tylko %lu linii w pliku"
+103 "Niedozwolony adres: plik jest pusty"
+104 "Polecenie %s nie zezwala na użycie adresu 0"
+105 "Brak skrótów do wyświetlenia"
+106 "Skróty muszą się kończyć symbolem \"słowo\""
+107 "Skróty nie mogą zawierać spacji lub tabulacji"
+108 "Skróty nie mogą przeplatać symboli słowo/nie-słowo, z wyjątkiem na końcu linii"
+109 "\"%s\" nie jest skrótem"
+110 "BÅ‚Ä…d polecenia vi: mapowanie klawiszy odrzucone"
+111 "Nie ma więcej plików do edycji"
+112 "Nie ma poprzednich plików do edycji"
+113 "Nie ma poprzednich plików do przewinięcia wstecz"
+114 "Nie ma listy plików do wyświetlenia"
+115 "Nie ma poprzedniego polecenia do zastÄ…pienia \"!\""
+116 "Nie ma nazwy pliku do zastÄ…pienia %%"
+117 "Nie ma nazwy pliku do zastÄ…pienia #"
+118 "BÅ‚Ä…d: execl: %s"
+119 "BÅ‚Ä…d I/O: %s"
+120 "Plik zmodyfikowany od ostatniego zapisu; zapisz lub użyj ! żeby wymusić"
+121 "Nie mozna znaleźć katalogu domowego (home)"
+122 "Nowy katalog bieżący: %s"
+123 "Nie ma buforów edycji do wyświetlenia"
+124 "Polecenie %s nie może być użyte jako część polecenia globalnego lub wizualnego"
+125 "%s/%s: nie wczytany: nie należy do ciebie ani do roota"
+126 "%s/%s: nie wczytany: nie należy do ciebie"
+127 "%s/%s: nie wczytany: inny użytkownik niż właściciel ma prawo do zapisu"
+128 "%s: nie wczytany: nie należy do ciebie ani do roota"
+129 "%s: nie wczytany: nie należy do ciebie"
+130 "%s: nie wczytany: inny uzytkownik niż właściciel ma prawo do zapisu"
+131 "Brak kolejnych linii do połączenia"
+132 "Brak pozycji map wejściowych"
+133 "Brak pozycji map poleceń"
+134 "Znak %s nie może być przemapowany"
+135 "\"%s\" obecnie nie jest mapowany"
+136 "Nazwa znacznika musi być pojedyńczą literą"
+137 "%s istnieje, nie zapisany; użyj ! żeby wymusić"
+138 "Nowy plik exrc: %s"
+139 "Linia docelowa jest wewnÄ…trz przenoszonego obszaru"
+140 "Polecenie open wymaga ustawienia opcji open"
+141 "Polecenie open jest niezaimplementowane"
+142 "Niemożliwe jest zachowanie tego pliku"
+143 "Plik zachowany"
+144 "%s: rozwija się na zbyt wiele nazw plików"
+145 "Tylko zwykłe pliki i nazwane łącza (named pipes) można czytać"
+146 "%s: nie można założyć blokady do odczytu"
+147 "Czytanie..."
+148 "%s: %lu linii, %lu znaków"
+149 "Brak ekranów w tle do wyświetlenia"
+150 "Polecenie script dostępne jest tylko w trybie vi"
+151 "Brak polecenia do wykonania"
+152 "Opcja shiftwidth ustawiona na 0"
+153 "Przepełnienie licznika"
+154 "Niedomiar licznika"
+155 "Podano wyrażenie regularne; flaga r nie ma znaczenia"
+156 "Flagi #, l oraz p nie mogą być łączone z flagą c w trybie vi"
+157 "Nie znaleziono wzorca"
+158 "Brak poprzedniego znacznika"
+159 "Mniej niż %s na stosie znaczników; użyj :display t[ags]"
+160 "Brak pliku %s na stosie znaczników do powrotu; użyj :display t[ags]"
+161 "Naciśnij Enter: "
+162 "%s: znacznik nie znaleziony"
+163 "%s: błędny znacznik w %s"
+164 "%s: numer linii znacznika wykracza poza koniec pliku"
+165 "Stos znaczników jest pusty"
+166 "%s: nie znaleziono szukanego wzorca"
+167 "%d plików jeszcze do edycji"
+168 "Bufor %s jest pusty"
+169 "Potwierdzasz zmianÄ™? [n]"
+170 "Przerwany"
+171 "Brak poprzedniego bufora do wykonania"
+172 "Brak poprzedniego wyrażenia regularnego"
+173 "Polecenie %s wymaga uprzedniego wczytania pliku"
+174 "Sposób użycia: %s"
+175 "Polecenie wizualne wymaga ustawienia opcji open"
+177 "Pusty plik"
+178 "Brak poprzedniego szukania F, f, T lub t"
+179 "%s nie znaleziono"
+180 "Brak poprzedniego pliku do edycji"
+181 "Kursor nie na liczbie"
+182 "Liczba wynikowa zbyt duża"
+183 "Liczba wynikowa zbyt mała"
+184 "Brak pasujących znaków w tej linii"
+185 "Nie znaleziono pasujących znaków"
+186 "Brak znaków do zamiany"
+187 "Brak innego ekranu do przełączenia"
+188 "Znaki poza napisem do szukania, przesunięciem linii i/lub poleceniem z"
+189 "Brak poprzedniego wzorca szukania"
+190 "Szukanie wróciło do pierwotnej pozycji"
+191 "Skrót przekroczył limit rozwinięcia: część znaków odrzucono"
+192 "Niedozwolony znak; zacytuj, żeby wprowadzić"
+193 "Już na początku wstawiania"
+194 "Brak kolejnych znaków do usunięcia"
+195 "Przesunięcie poza koniec pliku"
+196 "Przesunięcie poza koniec linii"
+197 "Nie wykonano przesunięcia kursora"
+198 "Już na początku pliku"
+199 "Przesunięcie przed początek pliku"
+200 "Już w pierwszej kolumnie"
+201 "Należy podać bufory przed poleceniem"
+202 "Już na końcu pliku"
+203 "Już na końcu linii"
+204 "%s nie jest poleceniem vi"
+205 "Sposób użycia: %s"
+206 "Brak znaków do usunięcia"
+207 "Polecenie Q wymaga interfejsu terminala ex"
+208 "Brak polecenia do powtórzenia"
+209 "Plik jest pusty"
+210 "%s nie może być użyte jako polecenie przesunięcia"
+211 "Już w trybie poleceń"
+212 "Kursor nie na słowie"
+214 "Wartości opcji okna zbyt duże, max to %u"
+215 "Dołącz"
+216 "Zmień"
+217 "Polecenie"
+218 "Wstaw"
+219 "Zamień"
+220 "Przesunięcie poza koniec ekranu"
+221 "Przesunięcie przed początek ekranu"
+222 "Ekran musi mieć więcej niż %d linii, żeby go podzielić"
+223 "Brak ekranów w tle"
+224 "Nie ma ekranu w tle z edycjÄ… pliku o nazwie %s"
+225 "Nie można schować w tle jedynego ekranu edycyjnego"
+226 "Można zmniejszyć ekran tylko do %d wierszy"
+227 "Ekran nie może być zmniejszony"
+228 "Ekran nie może być zwiększony"
+230 "Ekran nie może być zawieszony"
+231 "Przerwano: odrzucono mapowane klawisze"
+232 "vi: nie zwolniono bufora tymczasowego"
+233 "Ten terminal nie posiada klawisza %s"
+234 "Można podać tylko jeden bufor"
+235 "Liczba większa niż %lu"
+236 "Przerwano"
+237 "Nie można utworzyć pliku tymczasowego"
+238 "Uwaga: %s nie jest zwykłym plikiem"
+239 "%s już zablokowany, sesja tylko do odczytu"
+240 "%s: usuń"
+241 "%s: zamknij"
+242 "%s: usuń"
+243 "%s: usuń"
+244 "Plik tylko do odczytu, nie zapisany; użyj ! żeby wymusić"
+245 "Plik tylko do odczytu, nie zapisany"
+246 "%s istnieje, nie zapisany; użyj ! żeby wymusić"
+247 "%s istnieje, nie zapisany"
+248 "Plik częściowy, nie zapisany; użyj ! żeby wymusić"
+249 "Plik częściowy, nie zapisany"
+250 "%s: plik zmodyfikowany później, niż ta kopia; użyj ! żeby wymusić"
+251 "%s: plik zmodyfikowany później, niż ta kopia"
+252 "%s: nie można zablokować do pisania"
+253 "Zapisywanie..."
+254 "%s: OSTRZEŻENIE: PLIK ZOSTAŠOBCIĘTY"
+255 "Już przy pierwszym znaczniku z tej grupy"
+256 "%s: nowy plik: %lu linii, %lu znaków"
+257 "%s: %lu linii, %lu znaków"
+258 "%s rozwija się na zbyt wiele nazw plików"
+259 "%s: nie jest zwykłym plikiem"
+260 "%s: nie jesteś właścicielem"
+261 "%s: dostępny dla użytkownika innego niż właściciel"
+262 "Plik zmodyfikowany od ostatniego zapisu; zapisz lub użyj ! żeby wymusić"
+263 "Plik zmodyfikowany od ostatniego zapisu; zapisz lub użyj :edit! żeby wymusić"
+264 "Plik zmodyfikowany od ostatniego zapisu; zapisz lub użyj ! żeby wymusić"
+265 "To jest plik tymczasowy; wyjście anuluje zmiany"
+266 "Plik tylko do odczytu, nie ma autozapisu zmian"
+267 "Ponownie rozpoczęto logowanie"
+268 "potwierdzasz? [ynq]"
+269 "Naciśnij dowolny klawisz: "
+270 "Naciśnij dowolny klawisz [: żeby podać następne polecenia ex]: "
+271 "Naciśnij dowolny klawisz [q żeby zakończyć]: "
+272 "Ta forma %s wymaga interfejsu terminala ex"
+273 "WchodzÄ™ w tryb wprowadzania ex."
+274 "BÅ‚Ä…d polecenia, jeszcze nie wczytano pliku."
+275 " dalej?"
+276 "Nieoczekiwany symbol"
+277 "Nieoczekiwany koniec pliku"
+278 "Brak wzorców pasujących do zapytania"
+279 "Nieoczekiwane przerwanie"
+280 "Nieoczekiwane polecenie koniec"
+281 "Nieoczekiwane polecenie odświeżenia"
+282 "Już przy ostatnim znaczniku z tej grupy"
+283 "Polecenie %s wymaga interfejsu terminala ex"
+284 "Ta forma %s jest niedostępna, kiedy ustawiona jest opcja bezpiecznej edycji"
+285 "Nieoczekiwany ciąg znaków"
+286 "Nieoczekiwany timeout"
+287 "Nieoczekiwane polecenie zapisu"
+289 "Rozwinięcia shella niedostępne w trybie bezpiecznej edycji"
+290 "Polecenie %s jest niedostępne w trybie bezpiecznej edycji"
+291 "set: opcji %s nie można wyłączyć"
+292 "Ekran zbyt mały."
+293 "dodano"
+294 "zmieniono"
+295 "usunięto"
+296 "połączono"
+297 "przeniesiono"
+298 "przesunięto"
+299 "wczytano"
+300 "linia"
+301 "linii"
+302 "Vi nie został uruchomiony z interpreterem Tcl"
+303 "Plik zmodyfikowany od ostatniego zapisu"
+304 "Błąd rozwinięcia shella"
+305 "Brak opcji %s edycji"
+306 "Vi nie został uruchomiony z interpreterem Perl"
+307 "Brak polecenia ex do wykonania"
+308 "Naciśnij <CR> żeby wykonac polecenie, :q żeby wyjść"
+309 "Użyj \"cscope help\" w celu uzyskania pomocy"
+310 "Brak aktywnych połączeń cscope"
+311 "%s: nieznany typ poszukiwań: użyj jednego z %s"
+312 "%d: brak takiej sesji cscope"
+313 "set: nie można nigdy włączyć opcji %s"
+314 "set: opcja %s nie może nigdy mieć wartości 0"
+315 "%s: dodano: %lu linii, %lu znaków"
+316 "Nieoczekiwane polecenie zmiany rozmiaru"
+317 "%d plików do edycji"
diff --git a/usr.bin/vi/catalog/ru_RU.UTF-8.base b/usr.bin/vi/catalog/ru_RU.UTF-8.base
new file mode 100644
index 0000000..b358015
--- /dev/null
+++ b/usr.bin/vi/catalog/ru_RU.UTF-8.base
@@ -0,0 +1,311 @@
+002 "Переполнение Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð´Ð»Ð¸Ð½Ñ‹ Ñтроки"
+003 "невозможно удалить Ñтроку %lu"
+004 "невозможно добавить к Ñтроке %lu"
+005 "невозможно вÑтавить в Ñтроку %lu"
+006 "невозможно Ñохранить Ñтроку %lu"
+007 "невозможно доÑтать поÑледнюю Ñтроку"
+008 "Ошибка: не удалоÑÑŒ получить Ñтроку %lu"
+009 "Файл запиÑей"
+010 "ЗапиÑи не велиÑÑŒ, невозможно отменить поÑледнюю команду"
+011 "Ðет изменений Ð´Ð»Ñ Ð¾Ñ‚Ð¼ÐµÐ½Ñ‹"
+012 "ЗапиÑи не велиÑÑŒ, невозможно отменить поÑледнюю команду"
+013 "ЗапиÑи не велиÑÑŒ, невозможно проÑмотреть вперед"
+014 "Ðет изменений Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ´ÐµÐ»ÐºÐ¸"
+015 "%s/%d: ошибка при запиÑи протокола"
+016 "Стандартный ввод/вывод Ð´Ð»Ñ VI должен быть терминал"
+017 "Отметка %s: не уÑтановлена"
+018 "Отметка %s: Ñтрока была удалена"
+019 "Отметка %s: позиции курÑора больше не ÑущеÑтвует"
+020 "Ошибка: "
+021 "новый файл"
+022 "Ð¸Ð¼Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¾"
+023 "модифицировано"
+024 "не модифицировано"
+025 "РÐЗБЛОКИРОВÐÐО"
+026 "только чтение"
+027 "Ñтрока %lu из %lu [%ld%%]"
+028 "пуÑтой файл"
+029 "Ñтрока %lu"
+030 "Файл %s не ÑвлÑетÑÑ ÐºÐ°Ñ‚Ð°Ð»Ð¾Ð³Ð¾Ð¼ Ñообщений"
+031 "Ðевозможно уÑтановить опцию %s по умолчанию"
+032 "ИÑпользование: %s"
+033 "Опции %s нет: 'set all' показывает вÑе возможные опции"
+034 "set: [no]%s не принимает такого значениÑ"
+035 "set: %s Ð¾Ð¿Ñ†Ð¸Ñ Ð½Ðµ ÑвлÑетÑÑ Ð»Ð¾Ð³Ð¸Ñ‡ÐµÑкой"
+036 "set: %s опциÑ: %s"
+037 "set: %s опциÑ: %s: значение переполнениÑ"
+038 "set: неправильное значение %s"
+039 "set: %s Ð¾Ð¿Ñ†Ð¸Ñ Ð½Ðµ ÑвлÑетÑÑ Ð»Ð¾Ð³Ð¸Ñ‡ÐµÑкой"
+040 "КоличеÑтво колонок Ñкрана Ñлишком мало, меньше чем %d"
+041 "КоличеÑтво колонок Ñкрана Ñлишком велико, больше чем %d"
+042 "КоличеÑтво Ñтрок Ñкрана Ñлишком мало, меньше чем %d"
+043 "КоличеÑтво Ñтрок Ñкрана Ñлишком велико, больше чем %d"
+044 "ÐžÐ¿Ñ†Ð¸Ñ lisp отÑутÑтвует"
+045 "Ð¡Ð¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð½Ðµ выключены: %s"
+046 "Ð¡Ð¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ Ð½Ðµ включены: %s"
+047 "ÐžÐ¿Ñ†Ð¸Ñ %s должна ÑоÑтоÑÑ‚ÑŒ из групп Ñ Ð´Ð²ÑƒÐ¼Ñ Ñимволами"
+053 "Стартовый буфер пуÑÑ‚"
+054 "Буфер %s пуÑÑ‚"
+055 "Файлы Ñ Ñимволами перевода Ñтроки в имени не могут быть воÑÑтановлены"
+056 "Ð˜Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð½Ðµ Ñохранены при крахе ÑеÑÑии"
+057 "Копирование файла Ð´Ð»Ñ Ð²Ð¾ÑÑтановлениÑ..."
+058 "Сохранение не удалоÑÑŒ: %s"
+059 "Ð˜Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð½Ðµ ÑохранÑÑŽÑ‚ÑÑ Ð¿Ñ€Ð¸ обрыве ÑеÑÑии"
+060 "Сохранение копии файла не удалоÑÑŒ: %s"
+061 "Копирование файла Ð´Ð»Ñ Ð²Ð¾ÑÑтановлениÑ..."
+062 "Информации на Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ %u не найдено"
+063 "Ðевозможно защитить ÑпаÑенный файл"
+064 "Буфер воÑÑтановленного файла переполнен"
+065 "ВоÑÑтановленный файл"
+066 "%s: не до конца воÑÑтановленный файл"
+067 "%s: не до конца воÑÑтановленный файл"
+068 "Файлов Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ %s, которые Ð’Ñ‹ можете читать, не ÑущеÑтвует"
+069 "ЕÑÑ‚ÑŒ Ñтарые верÑии файла, которые можно воÑÑтановить"
+070 "СущеÑтвуют другие файлы, которые можно воÑÑтановить"
+071 "е-mail не поÑлан: %s"
+072 "Файл пуÑÑ‚ - иÑкать нечего"
+073 "ДоÑтигнут конец файла без Ð½Ð°Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð±Ñ€Ð°Ð·Ñ†Ð° поиÑка"
+074 "Ðе задан образец поиÑка"
+075 "Образец поиÑка не найден"
+076 "ДоÑтупно начало файла без Ð½Ð°Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð±Ñ€Ð°Ð·Ñ†Ð° поиÑка"
+077 "ПоиÑк зациклен"
+078 "ПоиÑк..."
+079 "Ðепечатных Ñимволов не найдено"
+080 "ÐеизвеÑÑ‚Ð½Ð°Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð°"
+082 "%s: команда не доÑтупна в режиме ex"
+083 "Счетчик не может быть нулем"
+084 "%s: неправильное указание Ñтроки"
+085 "ВнутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° в ÑинтакÑиÑе (%s: %s)"
+086 "ИÑпользование: %s"
+087 "%s: временный буфер не иÑпользован"
+088 "Метка поÑтавлена перед Ñтрокой 1"
+089 "Метка поÑтавлена поÑле конца файла"
+090 "@ Ñ Ð´Ð¸Ð°Ð¿Ð°Ð·Ð¾Ð½Ð¾Ð¼ выполнÑетÑÑ ÐºÐ¾Ð³Ð´Ð° файл/Ñкран изменены"
+091 "ГлобальнаÑ/v команда выполнÑетÑÑ ÐºÐ¾Ð³Ð´Ð° файл/Ñкран изменены"
+092 "Команда ex не удалаÑÑŒ: поÑледующие команды забыты"
+093 "Команда ex не удалаÑÑŒ: назначенные клавиши забыты"
+094 "Второй Ð°Ð´Ñ€ÐµÑ Ð¼ÐµÐ½ÑŒÑˆÐµ чем первый"
+095 "Ðе указано название отметки"
+096 "\\ не завершаетÑÑ / или ?"
+097 "СÑылка к Ñтроке Ñ Ð½Ð¾Ð¼ÐµÑ€Ð¾Ð¼ меньше 0"
+098 "Команда %s неизвеÑтна"
+099 "Переполнение Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð°Ð´Ñ€ÐµÑа"
+100 "Ðедобор Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð°Ð´Ñ€ÐµÑа"
+101 "ÐедопуÑÑ‚Ð¸Ð¼Ð°Ñ ÐºÐ¾Ð¼Ð±Ð¸Ð½Ð°Ñ†Ð¸Ñ Ð² адреÑе"
+102 "Ðеправильный адреÑ: вÑего %lu Ñтрок в файле"
+103 "Ðеправильный адреÑ: файл пуÑÑ‚"
+104 "Команда %s не может иÑпользовать Ð°Ð´Ñ€ÐµÑ 0"
+105 "Ðббревиатуры отÑутÑтвуют"
+106 "Ðббревиатуры должны заканчиватьÑÑ Ñимволом \"Ñлов\""
+107 "Ðббревиатуры не могут Ñодержать Ñимволы табулÑции или пробелы"
+108 "Ðббревиатуры не могут ÑочетатьÑÑ Ñ Ñимволами Ñлов/не-Ñлов, за иÑключением конца Ñтроки"
+109 "\"%s\" не ÑвлÑетÑÑ Ð°Ð±Ð±Ñ€ÐµÐ²Ð¸Ð°Ñ‚ÑƒÑ€Ð¾Ð¹"
+110 "Vi команда не удалаÑÑŒ: назначенные клавиши забыты"
+111 "Файлов Ð´Ð»Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ð±Ð¾Ð»ÑŒÑˆÐµ нет"
+112 "ОтÑутÑтвие предыдущего файла Ð´Ð»Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ"
+113 "ОтÑутÑтвие предыдущего файла Ð´Ð»Ñ Ð¿Ñ€Ð¾Ñмотра назад"
+114 "Ðет файлов"
+115 "ОтÑутÑтвие предыдущей команды Ð´Ð»Ñ Ð·Ð°Ð¼ÐµÐ½Ñ‹ \"!\""
+116 "ОтÑутÑтвие замены Ð´Ð»Ñ %%"
+117 "ОтÑутÑтвие замены Ð´Ð»Ñ #"
+118 "Ошибка: execl: %s"
+119 "Ошибка ввода/вывода: %s"
+120 "Файл изменен Ñ Ð¼Ð¾Ð¼ÐµÐ½Ñ‚Ð° поÑледней полной запиÑи: иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+121 "Ðевозможно найти домашний каталог"
+122 "Ðовый каталог: %s"
+123 "Ðет вырезанных буферов"
+124 "Команда %s не может быть иÑпользована внутри глобальной или v команды"
+125 "%s/%s: не открыт: не принадлежит Вам или root-у"
+126 "%s/%s: не открыт: не принадлежит Вам"
+127 "%s/%s: не открыт: возможноÑÑ‚ÑŒ запиÑи у пользователÑ, не ÑвлÑющегоÑÑ Ð²Ð»Ð°Ð´ÐµÐ»ÑŒÑ†ÐµÐ¼"
+128 "%s: не Ñчитан: не принадлежит Вам или root-у"
+129 "%s: не Ñчитан: не принадлежит Вам"
+130 "%s: не Ñчитан: возможноÑÑ‚ÑŒ запиÑи у пользователÑ, не ÑвлÑющегоÑÑ Ð²Ð»Ð°Ð´ÐµÐ»ÑŒÑ†ÐµÐ¼"
+131 "ПоÑледующие Ñтроки отÑутÑтвуют"
+132 "ОтÑутÑтвие параметров ввода"
+133 "ОтÑутÑтвие параметров команды"
+134 "Символ %s не может быть переназначен"
+135 "\"%s\" на данный момент не назначен"
+136 "Ð˜Ð¼Ñ Ð¼ÐµÑ‚ÐºÐ¸ должно быть одним Ñимволом"
+137 "%s ÑущеÑтвует, не запиÑан; иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+138 "Ðовый файл exrc: %s"
+139 "Строка переноÑа находитÑÑ Ð²Ð½ÑƒÑ‚Ñ€Ð¸ параметров переноÑа"
+140 "Команда open подразумевает уÑтановку опции open"
+141 "Команда open не реализована"
+142 "Защита файла невозможна"
+143 "Файл защищен"
+144 "%s раÑширилÑÑ Ð² Ñлишком большое количеÑтво имен файлов"
+145 "Только обычные файлы или именованные каналы могут быть прочитаны"
+146 "%s: защита на чтение была недоÑтупна"
+147 "Чтение..."
+148 "%s: %lu Ñтрок, %lu Ñимволов"
+149 "Ðет теневых окон"
+150 "Команда script иÑпользуетÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ в режиме vi"
+151 "Ðет команды Ð´Ð»Ñ Ð¸ÑполнениÑ"
+152 "ÐžÐ¿Ñ†Ð¸Ñ shiftwidth уÑтановлена на 0"
+153 "Переполнение Ñчетчика"
+154 "Цикл выполнен не до конца"
+155 "Указано регулÑрное выражение: флаг r не нужен"
+156 "Флаги #, l и p не могут быть объединены Ñ Ñ„Ð»Ð°Ð³Ð¾Ð¼ c в режиме vi"
+157 "Совпадений нет"
+158 "Метка отÑутÑтвует"
+159 "Ð’ Ñтеке меток запиÑей меньше, чем %s, иÑпользуйте :display t[ags]"
+160 "Файла Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ %s в Ñтеке меток нет; иÑпользуйте :display t[ags]"
+161 "Ðажмите Enter чтобы продолжить: "
+162 "%s: метка не найдена"
+163 "%s: Ð¿Ð»Ð¾Ñ…Ð°Ñ Ð¼ÐµÑ‚ÐºÐ° в %s"
+164 "%s: номер Ñтроки метки вышел за конец файла"
+165 "Стек меток пуÑÑ‚"
+166 "%s: образец поиÑка не найден"
+167 "еще %d файлов Ð´Ð»Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ"
+168 "Буфер %s пуÑÑ‚"
+169 "Подтвердить изменениÑ? [n]"
+170 "Прервано"
+171 "ОтÑутÑтвие буфера Ð´Ð»Ñ Ð¸ÑпользованиÑ"
+172 "Ðет предыдущего регулÑрного выражениÑ"
+173 "Команда %s подразумевает наличие прочтенного файла"
+174 "ИÑпользование: %s"
+175 "Команда visual подразумевает обÑзательную уÑтановку опции open"
+177 "ПуÑтой файл"
+178 "Ðет предыдущего поиÑка F, f, T, или t"
+179 "%s не найдено"
+180 "Ðет предыдущего файла Ð´Ð»Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ"
+181 "КурÑор Ñтоит не на цифре"
+182 "Полученное чиÑло Ñлишком велико"
+183 "Полученное чиÑло Ñлишком мало"
+184 "ПодходÑщего Ñимвола нет на Ñтой Ñтроке"
+185 "ПодходÑщий Ñимвол не найден"
+186 "Ðет Ñимволов Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ"
+187 "Другого Ñкрана не ÑущеÑтвует"
+188 "Символы поÑле Ñтроки Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка, ÑÐ¼ÐµÑ‰ÐµÐ½Ð¸Ñ Ñтроки и/или команды z"
+189 "Прошлый образец поиÑка отÑутÑтвует"
+190 "ПоиÑк завершилÑÑ Ð½Ð° начальной позиции"
+191 "Ðббревиатура превыÑила лимит раÑширениÑ: Ñимволы забыты"
+192 "Символ неправилен; квотируйте Ð´Ð»Ñ Ð²Ð²Ð¾Ð´Ð°"
+193 "Уже на начале вÑтавки"
+194 "Ðет Ñимволов Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ"
+195 "Передвижение за конец файла"
+196 "Передвижение за конец Ñтроки"
+197 "Движение Ñтроки не Ñделано"
+198 "Уже на начале файла"
+199 "Движение курÑора за начало файла"
+200 "Уже в первой колонке"
+201 "Буферы должны быть указаны до Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ‹"
+202 "Уже на конце файла"
+203 "Уже на конце Ñтроки"
+204 "%s не ÑвлÑетÑÑ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð¾Ð¹ VI"
+205 "ИÑпользование: %s"
+206 "Ðет Ñимволов Ð´Ð»Ñ ÑƒÐ´Ð°Ð»ÐµÐ½Ð¸Ñ"
+207 "Команда Q требует ex Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ñ‚ÐµÑ€Ð¼Ð¸Ð½Ð°Ð»Ð°"
+208 "Ðет команды Ð´Ð»Ñ Ð¿Ð¾Ð²Ñ‚Ð¾Ñ€Ð°"
+209 "Файл пуÑÑ‚"
+210 "Команда %s не может быть иÑпользована как команда перемещениÑ"
+211 "Уже в командном режиме"
+212 "КурÑор находитÑÑ Ð½Ðµ на Ñлове"
+214 "Значение опции windows Ñлишком велико, макÑимальное значение = %u"
+215 "Добавить"
+216 "Изменить"
+217 "Команда"
+218 "Ð’Ñтавить"
+219 "Заменить"
+220 "Движение курÑора за конец Ñкрана"
+221 "Движение курÑора за начало Ñкрана"
+222 "Ð”Ð»Ñ Ñ€Ð°Ð·Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ñкран должен быть больше чем Ñтроки %d"
+223 "Теневых окон нет"
+224 "Ðе ÑущеÑтвует теневого окна Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸ÐµÐ¼ файла %s"
+225 "Ð’Ñ‹ не можете Ñделать единÑтвенное окно теневым"
+226 "Экран может быть Ñжат"
+227 "Экран не может быть Ñжат только до %d Ñтрок"
+228 "Экран не может быть раÑширен"
+230 "Этот Ñкран не может быть приоÑтановлен"
+231 "Прервано: назначенные клавиши забыты"
+232 "vi: временный буфер не оÑвобожден"
+233 "Данный тип терминала не имеет клавиши %s"
+234 "Может быть указан только один буфер"
+235 "ЧиÑло больше чем %lu"
+236 "Прервано"
+237 "Ðевозможно Ñоздать временный файл"
+238 "Внимание: %s Ñпециальный файл"
+239 "%s уже заблокирован, доÑтупен только на чтение"
+240 "%s: удален"
+241 "%s: закрыт"
+242 "%s: удален"
+243 "%s: удален"
+244 "Файл только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ, не запиÑан: ИÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+245 "Файл только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ, не запиÑан"
+246 "%s ÑущеÑтвует, не запиÑан; иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+247 "%s ÑущеÑтвует, не запиÑан"
+248 "ИÑпользуйте ! Ð´Ð»Ñ Ñ‡Ð°Ñтичной запиÑи файла"
+249 "ЧаÑÑ‚ÑŒ файла, файл не запиÑан"
+250 "%s: Файл изменÑлÑÑ Ð¿Ð¾Ð·Ð´Ð½ÐµÐµ, чем Ð´Ð°Ð½Ð½Ð°Ñ ÐºÐ¾Ð¿Ð¸Ñ: иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+251 "%s: Файл изменÑлÑÑ Ð¿Ð¾Ð·Ð´Ð½ÐµÐµ, чем Ð´Ð°Ð½Ð½Ð°Ñ ÐºÐ¾Ð¿Ð¸Ñ"
+252 "%s: защита на запиÑÑŒ была недоÑтупна"
+253 "ЗапиÑÑŒ..."
+254 "%s: Ð’ÐИМÐÐИЕ: ФÐЙЛ УСЕЧЕÐ"
+255 "Уже приÑутÑтвует в первой метке данной группы"
+256 "%s: новый файл: %lu Ñтрок, %lu Ñимволов"
+257 "%s: %lu Ñтрок, %lu Ñимволов"
+258 "%s раÑширилÑÑ Ð² Ñлишком большое количеÑтво имен файлов"
+259 "%s: Ñпециальный файл"
+260 "%s: не принадлежит Вам"
+261 "%s: доÑтупен не только Вам"
+262 "Файл изменен Ñо времени поÑледней запиÑи: Ñохраните или иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+263 "Файл изменен Ñо времени поÑледней запиÑи: Ñохраните или иÑпользуйте :edit Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+264 "Файл изменен Ñо времени поÑледней запиÑи: Ñохраните или иÑпользуйте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð°"
+265 "Файл временный: выход Ñотрет любые изменениÑ"
+266 "Файл только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ, автозапиÑÑŒ не Ñработала"
+267 "ЗапиÑи начаты заново"
+268 "подтвердить? [ynq]"
+269 "Ðажмите любую клавишу чтобы продолжить: "
+270 "Ðажмите любую клавишу чтобы продолжить [: чтобы ввеÑти еще ex команды]: "
+271 "Ðажмите любую клавишу чтобы продолжить [q чтобы выйти]: "
+272 "Эта форма %s требует ex Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ñ‚ÐµÑ€Ð¼Ð¸Ð½Ð°Ð»Ð°"
+273 "Вход в режим ввода ex."
+274 "Команда не удалаÑÑŒ, файл еще не прочтен."
+275 " прод?"
+276 "Ðеожиданное Ñимвольное Ñобытие"
+277 "Ðеожиданное Ñобытие 'конец файла'"
+278 "По запроÑу Ñовпадений нет"
+279 "Ðеожиданное Ñобытие прерываниÑ"
+280 "Ðеожиданное Ñобытие выхода"
+281 "Ðеожиданное Ñобытие перериÑовки"
+282 "Уже приÑутÑтвует в поÑледней метке данной группы"
+283 "Команда %s требует ex Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ñ‚ÐµÑ€Ð¼Ð¸Ð½Ð°Ð»Ð°"
+284 "Эта форма %s не поддерживаетÑÑ Ð¿Ð¾ÐºÐ° уÑтановлена Ð¾Ð¿Ñ†Ð¸Ñ Ð±ÐµÐ·Ð¾Ð¿Ð°Ñного редактированиÑ"
+285 "Ðеожиданное Ñтроковое Ñобытие"
+286 "Ðеожиданное Ñобытие таймаута"
+287 "Ðеожиданное Ñобытие запиÑи"
+288 "Ð”Ð»Ñ Ñ€Ð°Ð·Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ñкран должен быть больше чем Ñтолбцы %d"
+289 "Shell раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ Ð½Ðµ поддерживаютÑÑ Ð¿Ð¾ÐºÐ° уÑтановлена Ð¾Ð¿Ñ†Ð¸Ñ Ð±ÐµÐ·Ð¾Ð¿Ð°Ñного редактированиÑ"
+290 "Команда %s не поддерживаетÑÑ Ð¿Ð¾ÐºÐ° уÑтановлена Ð¾Ð¿Ñ†Ð¸Ñ Ð±ÐµÐ·Ð¾Ð¿Ð°Ñного редактированиÑ"
+291 "set: Ð¾Ð¿Ñ†Ð¸Ñ %s не может быть выключена"
+292 "Экран Ñлишком мал"
+293 "добавлено"
+294 "изменено"
+295 "удалено"
+296 "приÑоединено"
+297 "перемещено"
+298 "Ñмещено"
+299 "Ñкопировано"
+300 "Ñтрока"
+301 "Ñтроки"
+303 "Файл изменен Ñ Ð¼Ð¾Ð¼ÐµÐ½Ñ‚Ð° поÑледней запиÑи."
+304 "Shell раÑширение не удалоÑÑŒ"
+305 "Ðет указанной %s опции редактированиÑ"
+307 "Ðет ex команды Ð´Ð»Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ"
+308 "Введите <CR> Ð´Ð»Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ‹, :q чтобы выйти"
+309 "ИÑпользуйте \"cscope help\" Ð´Ð»Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰Ð¸"
+310 "Ðет запущенного cscope ÑоединениÑ"
+311 "%s: неизвеÑтный тип поиÑка: иÑпользуйте один из %s"
+312 "%d: нет такого cscope ÑеанÑа"
+313 "set: %s Ð¾Ð¿Ñ†Ð¸Ñ Ð½Ð¸ÐºÐ¾Ð³Ð´Ð° не может быть включена"
+314 "set: %s Ð¾Ð¿Ñ†Ð¸Ñ Ð½Ð¸ÐºÐ¾Ð³Ð´Ð° не может быть уÑтановлена в 0"
+315 "%s: добавлено: %lu Ñтрок, %lu Ñимволов"
+316 "Ðеожиданное Ñобытие Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ñ€Ð°Ð·Ð¼ÐµÑ€Ð°"
+317 "%d файлов Ð´Ð»Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ"
+319 "%d Ñкранов в фоновом режиме; иÑпользуйте :display чтобы перечиÑлить их"
+320 "ÐеизвеÑÑ‚Ð½Ð°Ñ Ð¿Ð¾Ð·Ð¸Ñ†Ð¸Ñ ÐºÑƒÑ€Ñора"
+321 "Преобразование кодировки файлов не поддерживаетÑÑ"
+322 "Преобразование кодировки ввода не поддерживаетÑÑ"
+323 "Ðеверный ввод. УÑечено."
+324 "Ошибка Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð² Ñтроке %d"
diff --git a/usr.bin/vi/catalog/spanish.UTF-8.base b/usr.bin/vi/catalog/spanish.UTF-8.base
new file mode 100644
index 0000000..4a3059a
--- /dev/null
+++ b/usr.bin/vi/catalog/spanish.UTF-8.base
@@ -0,0 +1,306 @@
+002 "Desbordamiento de longitud de línea"
+003 "no se puede borrar la línea %lu"
+004 "no se puede añadir la línea %lu"
+005 "no se puede insertar en la línea %lu"
+006 "no se puede guardar la línea %lu"
+007 "no se puede obtener la última línea"
+008 "Error: no se puede recuperar la línea %lu"
+009 "Archivo de log"
+010 "No se realiza log, no se puede deshacer"
+011 "No hay cambios para deshacer"
+012 "No se realiza log, no se puede deshacer"
+013 "No se realiza log, no se puede remontar hacia adelante"
+014 "No hay cambios para rehacer"
+015 "%s/%d: error de log"
+016 "La entrada y salida estándar de Vi debe ser una terminal"
+017 "Marcar %s: no determinado"
+018 "Marcar %s: se borró la línea"
+019 "Marcar %s: la posición del cursor ya no existe"
+020 "Error: "
+021 "nuevo archivo"
+022 "nombre cambiado"
+023 "modificado"
+024 "no modificado"
+025 "DESTRABADO"
+026 "lectura solamente"
+027 "línea %lu de %lu [%ld%%]"
+028 "archivo vacío"
+029 "línea %lu"
+030 "El archivo %s no es un catálogo de mensajes"
+031 "No se puede determinar la opción por omisión %s"
+032 "Uso: %s"
+033 "determinar: no hay opción %s: 'determinar todo' establece todos los valores de opción"
+034 "determinar: [no] hay opción %s no tiene valor"
+035 "determinar: opción %s no es booleano"
+036 "determinar: opción %s: %s"
+037 "determinar: opción %s: %s: desbordamiento de valores"
+038 "determinar: opción %s: %s es un número ilegal"
+039 "determinar: opción %s no es booleano"
+040 "Las columnas en pantalla son demasiado pequeñas, menos de %d"
+041 "Las columnas en pantalla son demasiado grandes, más de %d"
+042 "Las líneas en pantalla son demasiado pequeñas, menos de %d"
+043 "Las líneas en pantalla son demasiado grandes, más de %d"
+044 "La opción lisp no está implementada"
+045 "mensajes no desconectados: %s"
+046 "mensajes no conectados: %s"
+047 "La opción de %s debe estar en dos grupos de caracteres"
+053 "El buffer por omisión está vacío"
+054 "El buffer %s está vacío"
+055 "Los archivos con nuevas líneas en el nombre son irrecuperables"
+056 "Las modificaciones no pueden recuperarse si la sesión falla"
+057 "Copiando archivo para recuperación..."
+058 "Preservación fracasada: %s"
+059 "Las modificaciones no pueden recuperarse si la sesión falla"
+060 "Archivo de respaldo fracasado: %s"
+061 "Copiando archivo para recuperación..."
+062 "Información sobre identificación del usuario %u no encontrada"
+063 "No se puede trabar archivo de recuperación"
+064 "Desbordamiento de buffer de archivo de recuperación"
+065 "Archivo de recuperación"
+066 "%s: archivo de recuperación defectuoso"
+067 "%s: archivo de recuperación defectuoso"
+068 "No hay archivos denominados %s, que usted pueda leer, para recuperar"
+069 "Existen versiones más antiguas de este archivo que usted puede recuperar"
+070 "Existen otros archivos que usted puede recuperar"
+071 "no envía email: %s"
+072 "Archivo vacío; no hay nada para buscar"
+073 "Se alcanzó el final del archivo sin encontrar el patrón"
+074 "No hay patrón anterior de búsqueda"
+075 "No se encontró el patrón"
+076 " Se alcanzó el principio del archivo sin encontrar el patrón"
+077 "Búsqueda reiniciada"
+078 "Buscando..."
+079 "No se encontró ningún carácter no imprimible"
+080 "Nombre de comando desconocido"
+082 "%s: comando no disponible en modalidad ex"
+083 "La cuenta no puede ser cero"
+084 "%s: mala especificación de línea"
+085 "Error interno de tabla de sintaxis (%s: %s)"
+086 "Uso: %s"
+087 "%s: buffer temporario no liberado"
+088 "Desplazamiento de marcador a antes de la línea 1"
+089 "Desplazamiento de marcador más allá del final del archivo"
+090 "@ con rango que corre cuando se cambia el archivo/la pantalla"
+091 "Comando global/v que corre cuando se cambia el archivo/la pantalla"
+092 "Comando Ex fracasado: comandos pendientes descartados"
+093 "Comando Ex fracasado: teclas mapeadas descartadas"
+094 "La segunda dirección es más pequeña que la primera"
+095 "No se suministra nombre de marca"
+096 "\\ no es seguido por / o ?"
+097 "Referencia a un número de línea menor que 0"
+098 "El comando %s es desconocido"
+099 "Desbordamiento de valor de dirección"
+100 "Subdesbordamiento de valor de dirección"
+101 "Combinación de dirección ilegal"
+102 "Dirección ilegal: sólo %lu líneas en el archivo"
+103 "Dirección ilegal: el archivo está vacío"
+104 "El comando %s no permite una dirección de 0"
+105 "No hay abreviaturas para visualizar"
+106 "Las abreviaturas deben terminar con un carácter de \"palabra\" "
+107 "Las abreviaturas no pueden contener tabs o espacios"
+108 "Las abreviaturas no pueden mezclar caracteres palabra/no-palabra, salvo al final"
+109 "\"%s\" no es una abreviatura"
+110 "Comando Vi fracasado: teclas mapeadas descartadas"
+111 "No hay más archivos para editar"
+112 "No hay archivos anteriores para editar"
+113 "No hay archivos anteriores para rebobinar"
+114 "No hay lista de archivos para visualizar"
+115 "No hay un comando anterior para reemplazar a \"!\""
+116 "No hay nombre de archivo para sustituir por %%"
+117 "No hay nombre de archivo para sustituir por #"
+118 "Error: execl: %s"
+119 "Error de E/S: %s"
+120 "Archivo modificado desde la última escritura completa; escribir o usar ! para alterar"
+121 "No se puede encontrar la ubicación del directorio inicial"
+122 "Nuevo directorio actual: %s"
+123 "No hay buffers sueltos para visualizar"
+124 "El comando %s no puede usarse como parte de un comando global o v"
+125 "%s/%s: sin fuente: no le pertenece a usted o a raíz"
+126 "%s/%s: sin fuente: no le pertenece a usted"
+127 "%s/%s: sin fuente: puede ser escrito por un usuario que no sea el propietario"
+128 "%s: sin fuente: no le pertenece a usted o a raíz"
+129 "%s: sin fuente: no le pertenece a usted"
+130 "%s: sin fuente: puede ser escrito por un usuario que no sea el propietario"
+131 "No hay líneas siguientes para unir"
+132 "No hay anotaciones de mapa de entrada"
+133 "No hay anotaciones de mapa de comando"
+134 "El carácter %s no puede remapearse"
+135 "\"%s\" no está mapeado actualmente"
+136 "Marca de nombres debe ser un sólo carácter"
+137 "%s existe, no está escrito; usar ! para alterar"
+138 "Nuevo archivo exrc: %s"
+139 "La línea de destino se encuentra dentro del rango de movimiento"
+140 "El comando abierto requiere que se determine la opción abierta"
+141 "El comando abierto no se ha implementado aún"
+142 "No es posible preservar este archivo"
+143 "Archivo preservado"
+144 "%s: expandido a demasiados nombres de archivo"
+145 "Sólo pueden leerse los archivos regulares y los conductos nombrados"
+146 "%s: traba de lectura no disponible"
+147 "Leyendo..."
+148 "%s: %lu líneas, %lu caracteres"
+149 "No hay pantallas de fondo para mostrar"
+150 "El comando de script sólo está disponible en modalidad vi"
+151 "No hay comando para ejecutar"
+152 "opción de ancho de desplazamiento en 0"
+153 "Desbordamiento de cuenta"
+154 "Subdesbordamiento de cuenta"
+155 "Expresión regular especificada; marcador r no tiene significado"
+156 "Los marcadores #, l y p no pueden combinarse con el marcador c en la modalidad vi"
+157 "No se encontró coincidencia"
+158 "No se ingresó un identificador anterior"
+159 "Se encontraron menos de %s anotaciones en la pila de identificadores; usar :visualizar i[dentificadores]"
+160 "No hay archivo %s en la pila de identificadores al que se pueda volver; usar :visualizar i[dentificadores]"
+161 "Presionar Intro para continuar: "
+162 "%s: no se encontró el identificador"
+163 "%s: identificador corrompido en %s"
+164 "%s: el número de línea del identificador es posterior al final del archivo"
+165 "La pila de identificadores está vacía"
+166 "%s: patrón de búsqueda no encontrado"
+167 "%d archivos más para editar"
+168 "El buffer %s está vacío"
+169 "¿Confirmar cambio? [n]"
+170 "Interrumpido"
+171 "No hay buffer anterior para ejecutar"
+172 "No hay expresión regular anterior"
+173 "El comando %s requiere que se haya leído un archivo"
+174 "Uso: %s"
+175 "El comando visual requiere que se determine la opción abierta"
+177 "Archivo vacío"
+178 "No hay búsqueda F, f, T o t anterior"
+179 "%s no se encontró"
+180 "No hay archivo anterior para editar"
+181 "El cursor no está en un número"
+182 "El número resultante es demasiado grande"
+183 " El número resultante es demasiado pequeño"
+184 "No hay carácter coincidente en esta línea"
+185 "No se encontró un carácter coincidente"
+186 "No hay caracteres para reemplazar"
+187 "No hay otra pantalla a la que se pueda pasar"
+188 "Caracteres tras de cadena de búsqueda, desplazamiento de línea y/o comando z"
+189 "No hay patrón anterior de búsqueda"
+190 "Búsqueda vuelve a la posición inicial"
+191 "Se superó el límite de expansión de abreviatura: se descartaron caracteres"
+192 "Carácter ilegal; mencionar para entrar"
+193 "Ya se encuentra al principio de la inserción"
+194 "No hay más caracteres para borrar"
+195 "Movimiento más allá del final del archivo"
+196 "Movimiento más allá del final de la línea"
+197 "No hay movimiento del cursor"
+198 "Ya se encuentra al principio del archivo"
+199 "Movimiento más allá del principio del archivo"
+200 "Ya se encuentra en la primera columna"
+201 "Los buffers deben especificarse antes del comando"
+202 "Ya se encuentra al final del archivo"
+203 "Ya se encuentra al final de la línea"
+204 "%s no es un comando vi"
+205 "Uso: %s"
+206 "No hay caracteres para borrar"
+207 "El comando Q requiere la interfase de terminal ex"
+208 "No hay comando para repetir"
+209 "El archivo está vacío"
+210 "%s no puede usarse como comando de movimiento"
+211 "Ya se encuentra en modalidad de comando"
+212 "El cursor no se encuentra en una palabra"
+214 "El valor de opción de Windows es demasiado grande, el máx. es %u"
+215 "Añadir"
+216 "Cambiar"
+217 "Comando"
+218 "Insertar"
+219 "Reemplazar"
+220 "El movimiento va más allá del final de la pantalla"
+221 "El movimiento va más allá del principio de la pantalla"
+222 "La pantalla debe tener más de %d líneas para dividirse"
+223 "No hay pantallas de fondo"
+224 "No hay pantalla de fondo editando un archivo denominado %s"
+225 "No se puede poner fondo a la única pantalla que se visualiza"
+226 "La pantalla sólo puede reducirse a %d hileras"
+227 "La pantalla no puede reducirse"
+228 "La pantalla no puede aumentarse"
+230 "Esta pantalla no puede suspenderse"
+231 "Interrumpido: teclas mapeadas descartadas"
+232 "vi: buffer temporario no liberado"
+233 "Esta terminal no tiene tecla %s"
+234 "Sólo un buffer puede especificarse"
+235 "Número mayor que %lu"
+236 "Interrumpido"
+237 "No se puede crear archivo temporario"
+238 "Advertencia: %s no es un archivo regular"
+239 "%s ya se encuentra trabado, la sesión es de lectura solamente"
+240 "%s: eliminar"
+241 "%s: cerrar"
+242 "%s: eliminar"
+243 "%s: eliminar"
+244 "Archivo de lectura solamente, no escrito; usar ! para alterar"
+245 " Archivo de lectura solamente, no escrito"
+246 "%s existe, no escrito; usar ! para alterar"
+247 "%s existe, no escrito"
+248 "Archivo parcial, no escrito; usar ! para alterar"
+249 "Archivo parcial, no escrito"
+250 "%s: archivo modificado más recientemente que esta copia; usar ! para alterar"
+251 "%s: archivo modificado más recientemente que esta copia"
+252 "%s: la traba de escritura no estaba disponible"
+253 "Escribiendo..."
+254 "%s: ADVERTENCIA: ARCHIVO TRUNCADO"
+255 "Ya se encuentra en el primer identificador de este grupo"
+256 "%s: nuevo archivo: %lu líneas, %lu caracteres"
+257 "%s: %lu líneas, %lu caracteres"
+258 "%s expandido a demasiados nombres de archivos"
+259 "%s: no es un archivo regular"
+260 "%s: no le pertenece"
+261 "%s: accesible por un usuario que no sea el propietario"
+262 "Archivo modificado desde la última escritura completa; escribir o usar ! para alterar"
+263 "Archivo modificado desde la última escritura completa; escribir o usar :editar! para alterar"
+264 "Archivo modificado desde la última escritura completa; escribir o usar ! para alterar"
+265 "El archivo es temporario; al salir se descartarán las modificaciones"
+266 "Archivo de lectura solamente, las modificaciones no se autoescriben"
+267 "Se reinició el log"
+268 "confirmar? [snq]"
+269 "Presionar cualquier tecla para continuar: "
+270 "Presionar cualquier tecla para continuar [: para ingresar más comandos ex]: "
+271 "Presionar cualquier tecla para continuar [q para salir]: "
+272 "Esta forma de %s requiere la interfase terminal ex"
+273 "Ingresando en la modalidad de entrada ex."
+274 "Comando fracasado, no hay archivo leído aun."
+275 " cont?"
+276 "Evento inesperado de carácter"
+277 "Evento inesperado de final de archivo"
+278 "No hay coincidencias para consulta"
+279 "Evento inesperado de interrupción"
+280 "Evento inesperado de salida"
+281 "Evento inesperado de repintura"
+282 "Ya se encuentra en el último identificador de este grupo"
+283 "El comando %s requiere la interfase terminal ex"
+284 "Esta forma de %s no se encuentra soportada cuando se determina la opción de edición segura"
+285 "Evento inesperado de cadena"
+286 "Evento inesperado de tiempo excedido"
+287 "Evento inesperado de escritura"
+289 "Las expansiones de shell no se encuentran soportadas cuando se determina la opción de edición segura"
+290 "El comando %s no se encuentra soportado cuando se determina la opción de edición segura"
+291 "determinar: la opción %s puede no estar desconectada"
+292 "El monitor es demasiado pequeño."
+293 "agregado"
+294 "cambiado"
+295 "borrado"
+296 "unido"
+297 "movido"
+298 "desplazado"
+299 "arrancado"
+300 "línea"
+301 "líneas"
+302 "Vi no se cargó con un intérprete Tcl"
+303 "Archivo modificado desde la última escritura."
+304 "Expansión de shell fracasada"
+305 "No hay opción de edición %s especificada"
+306 "Vi no se cargó con un intérprete Perl"
+307 "No hay comando ex para ejecutar"
+308 "Ingresar <CR> para ejecutar un comando, :q para salir"
+309 "Usar \"cscope ayuda\" para obtener ayuda"
+310 "No hay conexiones cscope corriendo"
+311 "%s: tipo de búsqueda desconocido: usar uno de %s"
+312 "%d: no existe esta sesión cscope"
+313 "determinar: la opción %s no puede conectarse nunca"
+314 "determinar: la opción %s no puede determinarse nunca en 0"
+315 "%s: añadido: %lu líneas, %lu caracteres"
+316 "Evento inesperado de modificación de tamaño"
+317 "%d archivos para editar"
diff --git a/usr.bin/vi/catalog/swedish.UTF-8.base b/usr.bin/vi/catalog/swedish.UTF-8.base
new file mode 100644
index 0000000..fc08dfc
--- /dev/null
+++ b/usr.bin/vi/catalog/swedish.UTF-8.base
@@ -0,0 +1,306 @@
+002 "För långa rader"
+003 "kan inte ta bort rad %lu"
+004 "kan inte lägga till på rad %lu"
+005 "kan inte sätta in på rad %lu"
+006 "kan inte lagra rad %lu"
+007 "kan inte hämta sista raden"
+008 "Fel: kan inte hämta rad %lu"
+009 "Loggningsfil"
+010 "Loggning utförs inte, ångra är inte möjligt"
+011 "Inga ändringar att ångra"
+012 "Loggning utförs inte, ångra är inte möjligt"
+013 "Loggning utförs inte, ångra ångra är inte möjligt"
+014 "Inga ändringar att återgöra"
+015 "%s/%d: fel vid loggning"
+016 "Vi:s standard in och ut måste gå till en terminal"
+017 "Markering %s: inte satt"
+018 "Markering %s: raden har tagits bort"
+019 "Markering %s: markörpositionen finns inte längre"
+020 "Fel: "
+021 "ny fil"
+022 "namnet ändrades"
+023 "ändrad"
+024 "oförändrad"
+025 "OLÃ…ST"
+026 "inte skrivbar"
+027 "rad %lu av %lu [%ld%%]"
+028 "tom fil"
+029 "rad %lu"
+030 "Filen %s är ingen meddelandekatalog"
+031 "Kan inte sätta standardvärde för %s flaggan"
+032 "Användning: %s"
+033 "set: %s är en okänd flagga: \"set all\" visar alla flaggor"
+034 "set: [no]%s flaggan kan inte ges ett värde"
+035 "set: %s flaggan är inte boleansk"
+036 "set: %s flaggan: %s"
+037 "set: %s flaggan: %s: för stort värde"
+038 "set: %s flaggan: %s är ett otillåtet tal"
+039 "set: %s flaggan är inte boleansk"
+040 "Fönsterkolumnerna är för få, mindre än %d"
+041 "Fönsterkolumnerna är för många, fler än %d"
+042 "Fönsterraderna är för få, mindre än %d"
+043 "Fönsterraderna är för många, fler än %d"
+044 "Lisp flaggan är inte implementerad"
+045 "meddelanden är inte avslagna: %s"
+046 "meddelanden är inte påslagna: %s"
+047 "%s flaggan måste ges i teckengrupper om två"
+053 "Standardbufferten är tom"
+054 "Buffer %s är tom"
+055 "Filer med radmatning i namnet kan inte återskapas"
+056 "Ändringar kan inte återskapas om programmet kraschar"
+057 "Kopierar filen för återskapning..."
+058 "Säkerhetskopiering misslyckades: %s"
+059 "Ändringar kan inte återskapas om programmet kraschar"
+060 "Misslyckades att säkerhetskopiera filen: %s"
+061 "Kopierar filen för återskapning..."
+062 "Kan inte hitta information om användaridentitet %u"
+063 "Kan inte låsa återskapningsfilen"
+064 "Återskapningsfilens buffer överskriven"
+065 "Ã…terskapningsfil"
+066 "%s: Återskapningsfilen är korrupt"
+067 "%s: Återskapningsfilen är korrupt"
+068 "Det finns ingen fil %s, läsbar av dig, att återskapa"
+069 "Det finns äldre versioner av denna fil som du kan återskapa"
+070 "Det finns andra filer du kan återskapa"
+071 "skickar inte email: %s"
+072 "Filen är tom; inget att söka i"
+073 "Kom till slutet på filen utan att hitta söksträngen"
+074 "Ingen tidigare söksträng"
+075 "Hittar inte söksträngen"
+076 "Kom till början av filen utan att hitta söksträngen"
+077 "Sökningen slog runt"
+078 "Söker..."
+079 "Inga icke skrivbara tecken funna"
+080 "Okänt kommandonamn"
+082 "%s: kommandot är inte tillgängligt i \"ex\" läge"
+083 "Talet får inte vara noll"
+084 "%s: Ogiltig radspecifikation"
+085 "Fel i intern syntaxtabell (%s: %s)"
+086 "Användning: %s"
+087 "%s: temporärbuffert inte frisläppt"
+088 "Offset är före rad 1"
+089 "Offset är efter slutet på filen"
+090 "@ med intervall exekverades när filen/fönstret ändrades"
+091 "Global/v kommando exekverades när filen/fönstret ändrades"
+092 "Ex kommando misslyckades: efterföljande kommandon ignorerade"
+093 "Ex kommando misslyckades: omdefinierade tangenter ignorerade"
+094 "Den andra adressen är mindre än den första"
+095 "Inget namn på markering givet"
+096 "\\ följs inte av / eller ?"
+097 "Referens till ett radnummer mindre än 0"
+098 "%s kommandot är inte känt"
+099 "Värdet på adressen är för stort"
+100 "Värdet på adressen är för litet"
+101 "Otillåten adresskombination"
+102 "Otillåten adress: bara %lu rader finns i filen"
+103 "Otillåten adress: filen är tom"
+104 "%s kommandot tillåter inte en adress som är 0"
+105 "Inga förkortningar att visa"
+106 "Förkortningar måste sluta med ett \"ord\" tecken"
+107 "Förkortningar kan inte innehålla mellanslag eller tab"
+108 "Förkortningar kan inte blanda \"ord\"/\"icke ord\" tecken, utom i slutet"
+109 "\"%s\" är ingen förkortning"
+110 "Vi kommando misslyckades: omdefinierade tangenter ignorerade"
+111 "Inga fler filer att editera"
+112 "Inga tidigare filer att editera"
+113 "Inga tidigare filer att spela tillbaka"
+114 "Ingen fillista att visa"
+115 "Inget tidigare kommando att ersätta \"!\" med"
+116 "Inget filnamn att ersätta %% med"
+117 "Inget filnamn att ersätta # med"
+118 "Fel: execl: %s"
+119 "I/O fel: %s"
+120 "Filen ändrad efter sista skrivning; spara eller använd !"
+121 "Kan inte hitta hemkatalog"
+122 "Ny nuvarande katalog: %s"
+123 "Inga \"cut buffers\" att visa"
+124 "%s kommandot kan inte används som del i ett \"global\" eller v kommando"
+125 "%s/%s: inte läst: varken du eller root är ägare"
+126 "%s/%s: inte läst: du är inte ägare"
+127 "%s/%s: inte läst: skrivbar av annan än ägaren"
+128 "%s: inte läst: varken du eller root är ägare"
+129 "%s: inte läst: du är inte ägare"
+130 "%s: inte läst: skrivbar av annan än ägaren"
+131 "Ingen nästa rad att sätta ihop med"
+132 "Det finns inget i inmatningsmappningen"
+133 "Det finns inget i kommandomappningen"
+134 "%s tecknet kan inte mappas om"
+135 "\"%s\" är inte ommappat just nu"
+136 "Namn på markeringar måste vara ett tecken långa"
+137 "%s finns, inget sparat; använd ! för att spara"
+138 "Ny exrc fil: %s"
+139 "Målraden ligger inne i området som ska flyttas"
+140 "Open kommandot kräver att open flaggan är satt"
+141 "Open kommandot är inte implementerat ännu"
+142 "Säkerhetskopiering av filen är inte möjligt"
+143 "Filen säkerhetskopierad"
+144 "%s expanderade till för många filnamn"
+145 "Endast vanliga filer och namngivna rör kan läsas"
+146 "%s: läslåset är otillgängligt"
+147 "Läser..."
+148 "%s: %lu rader, %lu tecken"
+149 "Inga bakgrundsfönster att visa"
+150 "Script kommandot finns bara i \"vi\" läge"
+151 "Inget kommando att exekvera"
+152 "shiftwidth flaggan satt till 0"
+153 "Talet har för stort värde"
+154 "Talet har för litet värde"
+155 "Reguljärt uttryck är givet; r flaggan är meningslös"
+156 "#, l och p flaggorna kan inte kombineras med c flaggan i \"vi\" läge"
+157 "Ingen matchande text funnen"
+158 "Inget tidigare märke har givits"
+159 "Det är färre än %s märken i stacken; använd :display t[ags]"
+160 "Det finns ingen fil %s i märkesstacken; använd :display t[ags]"
+161 "Tryck Enter för att fortsätta: "
+162 "%s: märke inte funnet"
+163 "%s: korrupt märke i %s"
+164 "%s: märkets radnummer är bortom filslutet"
+165 "Märkesstacken är tom"
+166 "%s: söksträngen inte funnen"
+167 "%d filer till att editera"
+168 "Buffert %s är tom"
+169 "Bekräfta ändring? [n]"
+170 "Avbruten"
+171 "Ingen tidigare buffert att exekvera"
+172 "Inget tidigare reguljärt uttryck"
+173 "%s kommandot kräver att en fil redan lästs in"
+174 "Användning: %s"
+175 "Visual kommandot kräver att open flaggan är satt"
+177 "Tom fil"
+178 "Ingen tidigare F, f, T eller t sökning"
+179 "%s inte funnen"
+180 "Ingen tidigare fil att editera"
+181 "Markören är inte i ett tal"
+182 "Det resulterande talet är för stort"
+183 "Det resulterande talet är för litet"
+184 "Inget matchande tecken på denna rad"
+185 "Matchande tecken inte funnet"
+186 "Det finns inga tecken att ersätta"
+187 "Det finns inget fönster att byta till"
+188 "Tecken efter söksträng, radoffset och/eller z kommandot"
+189 "Ingen tidigare söksträng"
+190 "Sökningen slog runt till ursprungliga positionen"
+191 "Förkortning överskred expanderingsgränsen: tecken har tagits bort"
+192 "Ogiltigt tecken; använd \"quote\" för att sätta in"
+193 "Redan i början på insättningen"
+194 "Inga fler tecken att ta bort"
+195 "Försök att gå bortom slutet på filen"
+196 "Försök att gå bortom slutet på raden"
+197 "Ingen förflyttning gjord"
+198 "Redan i början på filen"
+199 "Försök att gå före början på filen"
+200 "Redan i första kolumnen"
+201 "Buffertar måste anges före kommandot"
+202 "Redan i slutet av filen"
+203 "Redan på slutet av raden"
+204 "%s är inte ett \"vi\" kommando"
+205 "Användning: %s"
+206 "Inga tecken att ta bort"
+207 "Q kommandot kräver \"ex\" i terminalläge"
+208 "Inget kommando att repetera"
+209 "Filen är tom"
+210 "%s kan inte användas som ett förflyttningskommando"
+211 "Redan i kommando läge"
+212 "Markören är inte i ett ord"
+214 "Windows flaggans värde är för stor, största värde är %u"
+215 "Lägg till"
+216 "Ändra"
+217 "Kommando"
+218 "Sätt in"
+219 "Ersätt"
+220 "Förflyttning bortom fönsterslut"
+221 "Förflyttning till före fönstrets början"
+222 "Fönstret måste vara större än %d rader för delning"
+223 "Det finns inga fönster i bakgrunden"
+224 "Det finns inget fönster i bakgrunden som editerar filen %s"
+225 "Du får inte sätta ditt enda synliga fönster i bakgrunden"
+226 "Fönstret kan bara krympa till %d rader"
+227 "Fönstret kan inte krympa"
+228 "Fönstret kan inte växa"
+230 "Detta fönster kan inte pausas"
+231 "Avbrutet: omdefinierade tangenter ignorerade"
+232 "vi: temporärbuffertar inte frisläppta"
+233 "Denna terminal har ingen %s tangent"
+234 "Endast en buffert kan anges"
+235 "Talet är större än %lu"
+236 "Avbrutet"
+237 "Kan inte skapa temporär fil"
+238 "Warning: %s är inte en normal fil"
+239 "%s är redan låst, detta blir en icke skrivbar session"
+240 "%s: ta bort"
+241 "%s: stäng"
+242 "%s: ta bort"
+243 "%s: ta bort"
+244 "Ej skrivbar fil, filen inte sparad; använd ! för att skriva över"
+245 "Ej skrivbar fil, filen inte sparad"
+246 "%s finns, ej sparad; använd ! för att utföra operationen"
+247 "%s finns, filen inte sparad"
+248 "Ofullständig fil, filen inte sparad, använd ! för att skriva över"
+249 "Ofullständig fil, filen inte sparad"
+250 "%s: filen ändrad efter denna kopia togs; använd ! för att utföra operationen"
+251 "%s: filen ändrad efter denna kopia togs"
+252 "%s: skrivlåset är otillgängligt"
+253 "Skriver..."
+254 "%s: VARNING: FILEN TRUNKERAD"
+255 "Redan vid första märket i denna grupp"
+256 "%s: ny fil: %lu rader, %lu tecken"
+257 "%s: %lu rader, %lu tecken"
+258 "%s expanderade till för många filnamn"
+259 "%s är inte en normal fil"
+260 "%s ägs inte av dig"
+261 "%s är åtkomstbar av andra än ägaren"
+262 "Filen har ändrats efter den sparats; spara eller använd !"
+263 "Filen har ändrats efter den sparats; spara eller använd :edit!"
+264 "Filen har ändrats efter den sparats; spara eller använd !"
+265 "Filen är temporär; exit kastar bort ändringarna"
+266 "Ej skrivbar fil, ändringar har inte automatsparats"
+267 "Loggningen startar om"
+268 "bekräfta? [ynq]"
+269 "Tryck på en tangent för att fortsätta: "
+270 "Tryck på en tangent för att fortsätta [: för att ge fler kommandon]: "
+271 "Tryck på en tangent för att fortsätta [q för att avsluta]: "
+272 "Den formen av %s kräver \"ex\" i terminalläge"
+273 "Går till \"ex\" inmatningsläge."
+274 "Kommandot misslyckades, ingen fil inläst ännu."
+275 " forts?"
+276 "Oväntad teckenhändelse"
+277 "Oväntad filslutshändelse"
+278 "Sökningen hittade ingenting"
+279 "Oväntad avbrottshändelse"
+280 "Oväntad avslutningshändelse"
+281 "Oväntad omritningshändelse"
+282 "Redan vid sista märket i denna grupp"
+283 "%s kommandot kräver \"ex\" i terminalläge"
+284 "Den formen av %s är inte tillgänglig när secure edit flaggan är satt"
+285 "Oväntad stränghändelse"
+286 "Oväntad tidshändelse"
+287 "Oväntad skrivhändelse"
+289 "Skalexpansion är inte tillgänglig när secure edit flaggan är satt"
+290 "%s kommandot är inte tillgänglig när secure edit flaggan är satt"
+291 "set: %s kan inte slås av"
+292 "Fönstret för litet."
+293 "tillagda"
+294 "ändrade"
+295 "borttagna"
+296 "ihopsatta"
+297 "flyttade"
+298 "flyttade"
+299 "inklistrade"
+300 "rad"
+301 "rader"
+302 "Vi har inte länkats med en Tcl tolk"
+303 "Filen har ändrats efter den sparats."
+304 "Skalexpansion misslyckades"
+305 "Ingen %s edit flagga given"
+306 "Vi har inte länkats med en Perl tolk"
+307 "Inga \"ex\" kommandon att exekvera"
+308 "Tryck <CR> för att exekvera kommando, :q för att avsluta"
+309 "Gör \"cscope help\" för hjälp"
+310 "Inga cscope kopplingar körs"
+311 "%s: okänd söktyp: använd en av %s"
+312 "%d: ingen sådan cscope session"
+313 "set: %s flaggan får aldrig slås på"
+314 "set: %s flaggan får aldrig sättas till 0"
+315 "%s: tillagt: %lu rader, %lu tecken"
+316 "Oväntad storleksändring"
+317 "%d filer att editera"
diff --git a/usr.bin/vi/catalog/uk_UA.UTF-8.base b/usr.bin/vi/catalog/uk_UA.UTF-8.base
new file mode 100644
index 0000000..b4d6887
--- /dev/null
+++ b/usr.bin/vi/catalog/uk_UA.UTF-8.base
@@ -0,0 +1,306 @@
+002 "ÐŸÐµÑ€ÐµÐ¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð´Ð¾Ð²Ð¶Ð¸Ð½Ð¸ Ñ€Ñдку"
+003 "неможливо Ñтерти Ñ€Ñдок %lu"
+004 "неможливо додати до Ñ€Ñдку %lu"
+005 "неможливо вÑтавити в Ñ€Ñдок %lu"
+006 "неможливо розміÑтити Ñ€Ñдок %lu"
+007 "неможливо діÑтати оÑтанній Ñ€Ñдок"
+008 "Помилка: неможливо отримати Ñ€Ñдок %lu"
+009 "Файл запиÑів"
+010 "ЗапиÑи не велиÑÑ, неможливо відмінити оÑтанню команду"
+011 "Ðема чого відмінÑти"
+012 "ЗапиÑи не велиÑÑ, неможливо відмінити оÑтанню команду"
+013 "ЗапиÑи не велиÑÑ, неможливо продивитиÑÑ Ð²Ð¿ÐµÑ€ÐµÐ´"
+014 "Ðема чого повторювати"
+015 "%s/%d: помилка запиÑу протоколу"
+016 "Стандартним введеннÑм/виведеннÑм Ð´Ð»Ñ vi має бути термінал"
+017 "Мітка %s: не вÑтановлено"
+018 "Мітка %s: Ñ€Ñдок Ñтерто"
+019 "Мітка %s: позиції курÑору більше не Ñ–Ñнує"
+020 "Помилка: "
+021 "Ðовий файл"
+022 "Iм'Ñ Ð·Ð¼Ñ–Ð½Ð¸Ð»Ð¾ÑÑŒ"
+023 "змінений"
+024 "не змінений"
+025 "РO3БЛOКOÐ’ÐÐO"
+026 "тільки Ð´Ð»Ñ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ"
+027 "Ñ€Ñдок %lu з %lu [%ld%%]"
+028 "пуÑтий файл"
+029 "Ñ€Ñдок %lu"
+030 "Файл %s не є файлом повідомленнь"
+031 "Ðеможливо вÑтановити опцію %s за змовчаннÑм"
+032 "ВикориÑтаннÑ: %s"
+033 "Опції %s немає: 'set all' показує вÑÑ– можливі опції"
+034 "set: [no]%s не набуває такого значеннÑ"
+035 "set: %s Ð¾Ð¿Ñ†Ñ–Ñ Ð½Ðµ Ñ” логічною"
+036 "set: Ð¾Ð¿Ñ†Ñ–Ñ %s: %s"
+037 "set: Ð¾Ð¿Ñ†Ñ–Ñ %s: %s: переповненнÑ"
+038 "set: неправильне Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ %s"
+039 "set: %s Ð¾Ð¿Ñ†Ñ–Ñ Ð½Ðµ Ñ” логічною"
+040 "КількіÑÑ‚ÑŒ колонок на Ñкрані надто мала, менше ніж %d"
+041 "КількіÑÑ‚ÑŒ колонок на Ñкрані надто велика, більше ніж %d"
+042 "КількіÑÑ‚ÑŒ Ñ€Ñдків на Ñкрані надто мала, менше ніж %d"
+043 "КількіÑÑ‚ÑŒ Ñ€Ñдків на Ñкрані надто велика, більше ніж %d"
+044 "ÐžÐ¿Ñ†Ñ–Ñ lisp відÑутнÑ"
+045 "ÐŸÐ¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ Ð½Ðµ вимкнені: %s"
+046 "ÐŸÐ¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ Ð½Ðµ ввімкнені: %s"
+047 "ÐžÐ¿Ñ†Ñ–Ñ %s повинна міÑтити групи з двох Ñимволів"
+053 "Стартовий буфер порожній"
+054 "Буфер %s порожній"
+055 "Ðеможливо відновити файл, що міÑтить в імені Ñимволи Ð¿ÐµÑ€ÐµÐ²ÐµÐ´ÐµÐ½Ð½Ñ ÐºÐ°Ñ€ÐµÑ‚ÐºÐ¸"
+056 "Зміни не можна буде відновити піÑÐ»Ñ ÐºÑ€Ð°Ñ…Ñƒ ÑеÑÑ–Ñ—"
+057 "ÐšÐ¾Ð¿Ñ–ÑŽÐ²Ð°Ð½Ð½Ñ Ñ„Ð°Ð¹Ð»Ñƒ Ð´Ð»Ñ Ð²Ñ–Ð´Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ..."
+058 "Ð—Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ðµ вдалоÑÑŒ: %s"
+059 "Зміни не можна буде відновити піÑÐ»Ñ ÐºÑ€Ð°Ñ…Ñƒ ÑеÑÑ–Ñ—"
+060 "Ð—Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ ÐºÐ¾Ð¿Ñ–Ñ— файлу не вдалоÑÑŒ: %s"
+061 "ÐšÐ¾Ð¿Ñ–ÑŽÐ²Ð°Ð½Ð½Ñ Ñ„Ð°Ð¹Ð»Ñƒ Ð´Ð»Ñ Ð²Ñ–Ð´Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ..."
+062 "Iнформацію про кориÑтувача %u не знайдено"
+063 "Заблокувати відновленний файл неможливо"
+064 "Буфер відновленого файлу переповнено"
+065 "Відновленний файл"
+066 "%s: файл відновленний не до кінцÑ"
+067 "%s: файл відновленний не до кінцÑ"
+068 "Ðе Ñ–Ñнуює файлів з іменем %s, Ñкі Ви можете прочитати"
+069 "IÑнують Ñтарі верÑÑ–Ñ— файлу, Ñкі можна відновити"
+070 "IÑнують інші файли, Ñкі можна відновити"
+071 "e-mail не відіÑлано: %s"
+072 "Файл пуÑтий - нема чого шукати"
+073 "ДоÑÑнуто ÐºÑ–Ð½Ñ†Ñ Ñ„Ð°Ð¹Ð»Ñƒ без Ð·Ð½Ð°Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð½Ñ Ð·Ñ€Ð°Ð·ÐºÑƒ пошуку"
+074 "Ðе задано зразок пошуку"
+075 "Зразок пошуку не знайдено"
+076 "ДоÑÑнуто початку файлу без Ð·Ð½Ð°Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð½Ñ Ð·Ñ€Ð°Ð·ÐºÑƒ пошуку"
+077 "Пошук зациклено"
+078 "Пошук..."
+079 "Ðепечатних Ñимволів не знайдено"
+080 "Ðевідома команда"
+082 "%s: команда не доÑтупна в режимі ex"
+083 "Лічильник не може бути нулем"
+084 "%s: неправильне Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ñ€Ñдку"
+085 "Ð’Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ° в ÑинтакÑиÑÑ– (%s: %s)"
+086 "ВикориÑтаннÑ: %s"
+087 "%s: тимчаÑовий буфер не викориÑтано"
+088 "Мітку поÑтавлено перед першим Ñ€Ñдком"
+089 "Мітку поÑтавлено піÑÐ»Ñ ÐºÑ–Ð½Ñ†Ñ Ñ„Ð°Ð¹Ð»Ñƒ"
+090 "@ з діапазоном працює коли змінено файл/вікно"
+091 "Команда Global/v працює коли змінено файл/вікно"
+092 "Команда ex не вдалаÑÑŒ: наÑтупні команди з'ігноровано"
+093 "Команда ex не вдалаÑÑŒ: відображені клавіші з'ігноровано"
+094 "Друга адреÑа менше ніж перша"
+095 "Ðе вказано ім'Ñ Ð¼Ñ–Ñ‚ÐºÐ¸"
+096 "\\ не закінчуєтьÑÑ / чи ?"
+097 "ПоÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½Ð° Ñ€Ñдок з номером, меншим ніж 0"
+098 "Команда %s невідома"
+099 "ÐŸÐµÑ€ÐµÐ¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ð»Ñ–Ñ‡Ð¸Ð»ÑŒÐ½Ð¸ÐºÐ° адреÑ"
+100 "Ðедобір лічильника адреÑ"
+101 "ÐедопуÑтима ÐºÐ¾Ð¼Ð±Ñ–Ð½Ð°Ñ†Ñ–Ñ Ð² адреÑÑ–"
+102 "Ðеправильна адреÑа: вÑього %lu Ñ€Ñдків у файлі"
+103 "Ðеправильна адреÑа: файл пуÑтий"
+104 "Команда %s не може викориÑтовувати адреÑу 0"
+105 "Ðемає абревіатур"
+106 "Ðбревіатури повинні закінчуватиÑÑ Ñимволом \"Ñлів\""
+107 "Ð’ абревіатурі не можна викориÑтовувати Ñимволи табулÑції та пробіли"
+108 "Ðбревіатури не можуть змішувати Ñимволи Ñлів/не-Ñлів, хіба що в кінці Ñ€Ñдку"
+109 "\"%s\" не абревіатура"
+110 "Команда Vi не вдалаÑÑŒ: відображені клавіші з'ігноровано"
+111 "Файлів Ð´Ð»Ñ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ Ð±Ñ–Ð»ÑŒÑˆÐµ немає"
+112 "Попереднього файлу Ð´Ð»Ñ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ Ð½ÐµÐ¼Ð°Ñ”"
+113 "Попереднього файлу Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ³Ð»Ñду немає"
+114 "Ðемає файлів"
+115 "Ðемає попередньої команди Ð´Ð»Ñ Ð·Ð°Ð¼Ñ–Ð½Ð¸ \"!\""
+116 "ВідÑутнє ім'Ñ Ñ„Ð°Ð¹Ð»Ñƒ Ð´Ð»Ñ Ð¿Ñ–Ð´Ð¼Ñ–Ð½Ð¸ %%"
+117 "ВідÑутнє ім'Ñ Ñ„Ð°Ð¹Ð»Ñƒ Ð´Ð»Ñ Ð¿Ñ–Ð´Ð¼Ñ–Ð½Ð¸ #"
+118 "Помилка: execl: %s"
+119 "Помилка введеннÑ/виведеннÑ: %s"
+120 "Файл модифіковано піÑÐ»Ñ Ð¾Ñтанньої команди повного запиÑу: збережіть чи викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+121 "Ðеможливо знайти домашній каталог"
+122 "Ðовий каталог: %s"
+123 "Ðемає наповнених буферів"
+124 "Команда %s не викориÑтовуєтьÑÑ Ñк чаÑтина команди global чи v"
+125 "%s/%s: не відкрито: не належить Вам чи адмініÑтратору"
+126 "%s/%s: не відкрито: не належить Вам"
+127 "%s/%s: не відкрито: можливіÑÑ‚ÑŒ запиÑу кориÑтувачем, Ñкий не Ñ” влаÑником"
+128 "%s: не відкрито: не належить Вам чи адмініÑтратору"
+129 "%s: не відкрито: не належить Вам"
+130 "%s: не відкрито: можливіÑÑ‚ÑŒ запиÑу кориÑтувачем, Ñкий не Ñ” влаÑником"
+131 "Ðемає більше Ñ€Ñдків Ð´Ð»Ñ Ð¾Ð±'єднаннÑ"
+132 "Ðемає параметрів введеннÑ"
+133 "Ðемає параметрів команди"
+134 "Символ %s не можна переназначити"
+135 "\"%s\" зараз не переназначено"
+136 "Iм'Ñ Ð¼Ñ–Ñ‚ÐºÐ¸ -- один Ñимвол"
+137 "%s Ñ–Ñнує, не запиÑано; викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+138 "Ðовий файл exrÑ: %s"
+139 "РÑдок Ð¿Ñ€Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¾ вÑередині діапазону переміщеннÑ"
+140 "Команда open вимагає вÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð¾Ð¿Ñ†Ñ–Ñ— open"
+141 "Команду open ще не реалізовано"
+142 "ЗахиÑÑ‚ файлу неможливий"
+143 "Файл захищено"
+144 "%s розширивÑÑ Ð² надто велику кількіÑÑ‚ÑŒ імен файлів"
+145 "Прочитати можна тільки проÑтий файл чи іменований канал(pipe)"
+146 "%s: Ð±Ð»Ð¾ÐºÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ñ–Ð´ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ Ð½ÐµÐ¼Ð¾Ð¶Ð»Ð¸Ð²Ðµ"
+147 "Зчитую..."
+148 "%s: %lu Ñ€Ñдків, %lu Ñимволів"
+149 "Ðемає тіньових вікон"
+150 "Команда script доÑтупна лише в режимі vi"
+151 "Ðема команди Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ"
+152 "Опцію shiftwidth вÑтановлено в 0"
+153 "ÐŸÐµÑ€ÐµÐ¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ð»Ñ–Ñ‡Ð¸Ð»ÑŒÐ½Ð¸ÐºÐ°"
+154 "Цикл виконано не до кінцÑ"
+155 "Вказано регулÑрний вираз; параметр 'r' не має ÑенÑу"
+156 "Параметри #, l та p не можна комбінувати з параметром 'c' в режимі vi"
+157 "Співпадань немає"
+158 "Tег відÑутній"
+159 "Менше ніж %s запиÑів у Ñтеку тегів; викориÑтайте :display t[ags]"
+160 "Ðемає файлу %s в Ñтеку тегів Ð´Ð»Ñ Ð¿Ð¾Ð²ÐµÑ€Ð½ÐµÐ½Ð½Ñ; викориÑтайте :display t[ags]"
+161 "ÐатиÑніть ENTER Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð¾Ð²Ð¶ÐµÐ½Ð½Ñ: "
+162 "%s: тег не знайдено"
+163 "%s: зіпÑований тег в %s"
+164 "%s: номер Ñ€Ñдку тега знаходитьÑÑ Ð·Ð° кінцем файлу"
+165 "Стек тегів порожній"
+166 "%s: зразок пошуку не знайдено"
+167 "ЗалишилоÑÑŒ %d файлів Ð´Ð»Ñ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ"
+168 "Буфер %s порожній"
+169 "Змінити? [n]"
+170 "Перервано"
+171 "Ðемає буферу Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ñ€Ð¸ÑтаннÑ"
+172 "Ðемає попереднього регулÑрного виразу"
+173 "Команда %s вимагає вже прочитаний файл"
+174 "ВикориÑтаннÑ: %s"
+175 "Команда visual вимагає вÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð¾Ð¿Ñ†Ñ–Ñ— open"
+177 "ПуÑтий файл"
+178 "Ðемає попереднього пошуку F, f, T, чи t"
+179 "%s не знайдено"
+180 "Ðемає попереднього файлу Ð´Ð»Ñ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ"
+181 "КурÑор Ñтоїть не на цифрі"
+182 "Oтримане чиÑло надто велике"
+183 "Oтримане чиÑло надто мале"
+184 "Ðемає відповідного Ñимволу в цьому Ñ€Ñдку"
+185 "Відповідний Ñимвол не знайдено"
+186 "Ðемає Ñимволів Ð´Ð»Ñ Ð·Ð°Ð¼Ñ–Ð½Ð¸"
+187 "Ðемає іншого вікна"
+188 "Символи піÑÐ»Ñ Ñ€Ñдку Ð´Ð»Ñ Ð¿Ð¾ÑˆÑƒÐºÑƒ, Ð·Ð¼Ñ–Ñ‰ÐµÐ½Ð½Ñ Ñ€Ñдку та/чи команди z"
+189 "Ðемає попереднього зразку пошуку"
+190 "Пошук закінчивÑÑ Ð½Ð° початковій позиції"
+191 "Ðбревіатура перевищила ліміт розширеннÑ: Ñимволи з'ігноровано"
+192 "Ðедозволений Ñимвол: задайте в дужках"
+193 "Вже на початку вÑтавки"
+194 "Ðемає Ñимволів Ð´Ð»Ñ Ð²Ð¸Ð´Ð°Ð»ÐµÐ½Ð½Ñ"
+195 "Рух за кінець файлу"
+196 "Рух за кінець Ñ€Ñдку"
+197 "КурÑор не переміщувавÑÑ"
+198 "Вже на початку файлу"
+199 "Рух курÑору за початок файлу"
+200 "Вже в першій колонці"
+201 "Буфер треба вказувати перед командою"
+202 "Вже на кінці файлу"
+203 "Вже на кінці Ñ€Ñдку"
+204 "%s не команда Vi"
+205 "ВикориÑтаннÑ: %s"
+206 "Ðемає Ñимволів Ð´Ð»Ñ Ð²Ð¸Ð´Ð°Ð»ÐµÐ½Ð½Ñ"
+207 "Команда Q вимагає інтерфейÑу ex"
+208 "Ðемає команди Ð´Ð»Ñ Ð¿Ð¾Ð²Ñ‚Ð¾Ñ€ÐµÐ½Ð½Ñ"
+209 "Файл пуÑтий"
+210 "Команду %s не можна викориÑтати Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ¼Ñ–Ñ‰ÐµÐ½Ð½Ñ"
+211 "Вже в командному режимі"
+212 "КурÑор Ñтоїть не на Ñлові"
+214 "Ð—Ð½Ð°Ñ‡Ð½ÐµÐ½Ð½Ñ Ð¾Ð¿Ñ†Ñ–Ñ— Windows надто велике, макÑимум = %u"
+215 "ДопиÑати"
+216 "Змінити"
+217 "Команда"
+218 "Ð’Ñтавити"
+219 "Замінити"
+220 "Рух курÑору за кінець Ñкрану"
+221 "Рух курÑору за початок Ñкрану"
+222 "Ð”Ð»Ñ Ñ€Ð¾Ð·Ð±Ð¸Ñ‚Ñ‚Ñ Ð²Ñ–ÐºÐ½Ð¾ має міÑтити більше ніж %d Ñ€Ñдків"
+223 "Тіньових вікон немає"
+224 "Ðемає тіньового вікна з редагуваннÑм файлу %s"
+225 "Ðе можна зробити тіньовим єдине вікно"
+226 "Вікно можна ÑтиÑнути лише до %d Ñ€Ñдків"
+227 "Вікно не можна ÑтиÑнути"
+228 "Вікно не можна розширити"
+230 "Це вікно не можна призупинити"
+231 "Перервано: відображені клавіші з'ігноровано"
+232 "vi: тимчаÑовий буфур не вивільнено"
+233 "Цей тип терміналу немає клавіші %s"
+234 "Можна вказати лише один буфер"
+235 "ЧиÑло більше, ніж %lu"
+236 "Перервано"
+237 "Ðеможлу Ñтворити тимчаÑовий файл"
+238 "УВÐГÐ: %s Ñпеціальний файл"
+239 "%s вже заблоковано, доÑтупний тільки Ð´Ð»Ñ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ"
+240 "%s: Ñтерто"
+241 "%s: закрито"
+242 "%s: Ñтерто"
+243 "%s: Ñтерто"
+244 "Файл тільки Ð´Ð»Ñ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ, не запиÑано: ВикориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+245 "Файл тільки Ð´Ð»Ñ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ, не запиÑано"
+246 "%s Ñ–Ñнує, не запиÑано; викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+247 "%s Ñ–Ñнує, не запиÑано"
+248 "ВикориÑтайте ! Ð´Ð»Ñ Ñ‡Ð°Ñткового запиÑу файлу"
+249 "ЧаÑтина файлу, файл не запиÑано"
+250 "%s: Файл змінювавÑÑ Ð¿Ñ–Ð·Ð½Ñ–ÑˆÐµ, ніж Ñ†Ñ ÐºÐ¾Ð¿Ñ–Ñ: викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+251 "%s: Файл змінювавÑÑ Ð¿Ñ–Ð·Ð½Ñ–ÑˆÐµ, ніж Ñ†Ñ ÐºÐ¾Ð¿Ñ–Ñ"
+252 "%s: захиÑÑ‚ від запиÑу недоÑтупний"
+253 "ЗапиÑ..."
+254 "%s: УВÐГÐ: файл обрізано"
+255 "Вже на першому тегу в цій групі"
+256 "%s: новий файл: %lu Ñ€Ñдків, %lu Ñимволів"
+257 "%s: %lu Ñ€Ñдків, %lu Ñимволів"
+258 "%s розширивÑÑ Ð² надто велику кількіÑÑ‚ÑŒ імен файлів"
+259 "%s: Ñпеціальний файл"
+260 "%s: не належить Вам"
+261 "%s: доÑтупний не лише Вам
+262 "Файл модифіковано піÑÐ»Ñ Ð¾Ñтанньої команди запиÑу: збережіть чи викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+263 "Файл модифіковано піÑÐ»Ñ Ð¾Ñтанньої команди запиÑу: збережіть чи викориÑтайте :edit Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+264 "Файл модифіковано піÑÐ»Ñ Ð¾Ñтанньої команди запиÑу: збережіть чи викориÑтайте ! Ð´Ð»Ñ Ð¾Ð±Ñ…Ð¾Ð´Ñƒ"
+265 "ТимчаÑовий файл: вихід зітре зміни"
+266 "Файл тільки Ð´Ð»Ñ Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ, зміни не запишутьÑÑ Ð°Ð²Ñ‚Ð¾Ð¼Ð°Ñ‚Ð¸Ñ‡Ð½Ð¾"
+267 "ЗапиÑи початі заново"
+268 "Підтверджуєте? [ynq]"
+269 "ÐатиÑніть ENTER Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð¾Ð²Ð¶ÐµÐ½Ð½Ñ: "
+270 "ÐатиÑніть ENTER Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð¾Ð²Ð¶ÐµÐ½Ð½Ñ [: Ð´Ð»Ñ Ñ–Ð½ÑˆÐ¸Ñ… команд] "
+271 "ÐатиÑніть ENTER Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð¾Ð²Ð¶ÐµÐ½Ð½Ñ [q Ð´Ð»Ñ Ð²Ð¸Ñ…Ð¾Ð´Ñƒ]: "
+272 "Tака форма %s вимагає інтерфейÑу ex"
+273 "Входим в режим Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ ex"
+274 "Збій команди, файл не прочитано"
+275 "Продовжити?"
+276 "Ðеочікувана Ñимвольна подіÑ"
+277 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ ÐºÑ–Ð½Ñ†Ñ Ñ„Ð°Ð¹Ð»Ñƒ"
+278 "Ðемає Ñпівпадань за запитом"
+279 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ð¿ÐµÑ€ÐµÑ€Ð¸Ð²Ð°Ð½Ð½Ñ"
+280 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ð²Ð¸Ñ…Ð¾Ð´Ñƒ"
+281 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ð¿ÐµÑ€ÐµÑ€Ð¸Ñовки"
+282 "Вже на оÑтанньму Тегу в цій групі"
+283 "Команда %s вимагає інтерфейÑу ex"
+284 "Tака форма %s не дозволÑєтьÑÑ Ð¿Ñ€Ð¸ вÑтановленій опції secure edit"
+285 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ñ€Ñдку"
+286 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ñ‚Ð°Ð¹Ð¼-ауту"
+287 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ð·Ð°Ð¿Ð¸Ñу"
+289 "Shell'івÑке Ð´Ð¾Ð¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ Ð½Ðµ дозволÑєтьÑÑ Ð¿Ñ€Ð¸ вÑтановленій опції secure edit"
+290 "Команда %s не дозволÑєтьÑÑ Ð¿Ñ€Ð¸ вÑтановленій опції secure edit"
+291 "set: опцію %s неможна виÑтавити вимкненою"
+292 "Екран надто малий."
+293 "додано"
+294 "змінено"
+295 "Ñтерто"
+296 "об'єднано"
+297 "переміщено"
+298 "здвинуто"
+299 "вÑтавлено"
+300 "Ñ€Ñдок"
+301 "Ñ€Ñдків"
+302 "Vi завантажено без інтерпретатора Tcl"
+303 "Файл модифіковано піÑÐ»Ñ Ð¾Ñтанньої команди запиÑу."
+304 "Ðевдача shell'івÑького доповненнÑ"
+305 "Oпції Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ %s не вказано"
+306 "Vi завантажено без інтерпретатора Perl"
+307 "Ðемає команди ex Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ"
+308 "ÐатиÑніть ENTER щоб виконати команду, q щоб вийти"
+309 "Введіть 'cscope help' Ð´Ð»Ñ Ñ–Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ—"
+310 "Ðемає cscope з'єднаннь"
+311 "%s: невідомий тип пошуку: викориÑтовуйте один з %s"
+312 "%d: немає такої ÑеÑÑ–Ñ— cscope"
+313 "set: опцію %s неможна виÑтавити увімкненою"
+314 "set: опцію %s неможна виÑтавити в 0"
+315 "%s: додано: %lu Ñ€Ñдків, %lu Ñимволів"
+316 "Ðеочікувана Ð¿Ð¾Ð´Ñ–Ñ Ð·Ð¼Ñ–Ð½Ð¸ розміру"
+317 "%d файлів Ð´Ð»Ñ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ð½Ð½Ñ"
diff --git a/usr.bin/vi/catalog/zh_CN.UTF-8.base b/usr.bin/vi/catalog/zh_CN.UTF-8.base
new file mode 100644
index 0000000..c51a7c3
--- /dev/null
+++ b/usr.bin/vi/catalog/zh_CN.UTF-8.base
@@ -0,0 +1,311 @@
+002 "行长度溢出"
+003 "无法删除第 %lu 行"
+004 "无法å‘第 %lu 行追加"
+005 "无法å‘第 %lu è¡Œæ’å…¥"
+006 "无法存储第 %lu 行"
+007 "无法获得最åŽä¸€è¡Œ"
+008 "错误:无法获å–第 %lu è¡Œ"
+009 "日志文件"
+010 "日志未记录,无法撤销"
+011 "未åšä¿®æ”¹ï¼Œæ— æ³•æ’¤é”€"
+012 "日志未记录,无法撤销"
+013 "日志未记录,无法回滚"
+014 "未åšä¿®æ”¹ï¼Œæ— æ³•é‡åš"
+015 "%s/%d: 日志错误"
+016 "Vi 的标准输入和输出必须是终端"
+017 "标记 %s: 未设置"
+018 "标记 %s: 该行被删除"
+019 "标记 %s: 光标ä½ç½®ä¸å­˜åœ¨"
+020 "错误:"
+021 "新文件"
+022 "文件åå˜æ›´"
+023 "已修改"
+024 "未修改"
+025 "已解é”"
+026 "åªè¯»"
+027 "第 %lu è¡Œï¼å…± %lu è¡Œ [%ld%%]"
+028 "空文件"
+029 "第 %lu 行"
+030 "文件 %s ä¸æ˜¯æ¶ˆæ¯ç›®å½•"
+031 "无法设置选项 %s 的默认值"
+032 "用法 %s"
+033 "set: ä¸å­˜åœ¨é€‰é¡¹ %s;用 'set all' 查看所有选项的值"
+034 "set: 选项 [no]%s ä¸æŽ¥å—赋值"
+035 "set: 选项 %s ä¸æ˜¯å¼€å…³"
+036 "set: 选项 %s: %s"
+037 "set: 选项 %s: %s: 值溢出"
+038 "set: 选项 %s: %s 是一个éžæ³•æ•°å­—"
+039 "set: 选项 %s ä¸æ˜¯å¼€å…³"
+040 "å±å¹•å¤ªçª„,列宽å°äºŽ %d"
+041 "å±å¹•å¤ªå®½ï¼Œåˆ—宽大于 %d"
+042 "å±å¹•å¤ªçŸ®ï¼Œè¡Œé«˜å°äºŽ %d"
+043 "å±å¹•å¤ªé«˜ï¼Œè¡Œé«˜å¤§äºŽ %d"
+044 "lisp 选项未实现"
+045 "消æ¯æœªå…³é—­ï¼š%s"
+046 "消æ¯æœªæ‰“开:%s"
+047 "%s 选项必须æ¯ä¸¤ä¸ªå­—符一组"
+053 "默认缓冲区为空"
+054 "缓冲区 %s 为空"
+055 "文件å中有æ¢è¡Œçš„文件是无法æ¢å¤çš„"
+056 "一旦会è¯å¤±è´¥ï¼Œä¿®æ”¹æ— æ³•æ¢å¤"
+057 "正在备份文件……"
+058 "ä¿å­˜å¤±è´¥ï¼š%s"
+059 "一旦会è¯å¤±è´¥ï¼Œä¿®æ”¹æ— æ³•æ¢å¤"
+060 "文件备份失败:%s"
+061 "正在备份文件……"
+062 "ID 为 %u 的用户未找到"
+063 "无法给æ¢å¤æ–‡ä»¶åŠ é”"
+064 "æ¢å¤æ–‡ä»¶ç¼“冲区溢出"
+065 "æ¢å¤æ–‡ä»¶"
+066 "%s: æ¢å¤æ–‡ä»¶æ ¼å¼å¼‚常"
+067 "%s: æ¢å¤æ–‡ä»¶æ ¼å¼å¼‚常"
+068 "ä¸å­˜åœ¨å为 %s 的,å¯è¯»å¹¶éœ€è¦æ¢å¤çš„文件"
+069 "存在此文件的旧版本需è¦æ‚¨æ¢å¤"
+070 "存在其它需è¦æ‚¨æ¢å¤çš„文件"
+071 "邮件未å‘出:%s"
+072 "文件为空,无法æœç´¢"
+073 "到达文件尾,未找到模å¼"
+074 "没有上一个æœç´¢æ¨¡å¼"
+075 "模å¼æœªæ‰¾åˆ°"
+076 "到达文件头,未找到模å¼"
+077 "æœç´¢å›žè½¬"
+078 "正在æœç´¢â€¦â€¦"
+079 "未找到ä¸å¯æ‰“å°å­—符"
+080 "命令åä¸æ˜Ž"
+082 "%s: 命令在 ex 模å¼ä¸‹ä¸å¯ç”¨"
+083 "命令计数ä¸å¯ä¸º 0"
+084 "%s: 错误的行æè¿°"
+085 "内部语法表错误 (%s: %s)"
+086 "用法:%s"
+087 "%s: 临时缓冲区未释放"
+088 "修饰符å移é‡åœ¨ç¬¬ä¸€è¡Œä¹‹å‰"
+089 "修饰符å移é‡è¶…过最åŽä¸€è¡Œ"
+090 "文件ï¼å±å¹•æ”¹å˜æ—¶æœ‰å¸¦èŒƒå›´çš„ @ 命令正在è¿è¡Œ"
+091 "文件ï¼å±å¹•æ”¹å˜æ—¶æœ‰å…¨å±€å‘½ä»¤ï¼v 命令正在è¿è¡Œ"
+092 "Ex 命令失败:等待中的命令已丢弃"
+093 "Ex 命令失败:键映射已丢弃"
+094 "第二地å€å°äºŽç¬¬ä¸€åœ°å€"
+095 "未æ供标记å"
+096 "\\ 没有跟在 / 或 ? åŽé¢"
+097 "引用了å°äºŽ 0 çš„è¡Œå·"
+098 "%s 命令ä¸æ˜Ž"
+099 "地å€å€¼æº¢å‡º"
+100 "地å€å€¼ä¸‹æº¢"
+101 "éžæ³•çš„地å€ç»„åˆ"
+102 "éžæ³•åœ°å€ï¼šæ–‡ä»¶åªæœ‰ %lu è¡Œ"
+103 "éžæ³•åœ°å€ï¼šæ–‡ä»¶ä¸ºç©º"
+104 "命令 %s ä¸å…许地å€ä¸º 0"
+105 "没有å¯æ˜¾ç¤ºçš„缩写"
+106 "缩写必须以「å•è¯ã€å­—符结æŸ"
+107 "缩写ä¸èƒ½åŒ…å«åˆ¶è¡¨ç¬¦æˆ–空格"
+108 "缩写ä¸èƒ½åœ¨ç»“尾之外的地方混用å•è¯ï¼éžå•è¯å­—符"
+109 "\"%s\" ä¸æ˜¯ç¼©å†™"
+110 "Vi 命令失败:键映射已丢弃"
+111 "没有剩余的待编辑文件"
+112 "没有上一个待编辑文件"
+113 "没有上一个需é‡æ–°ç¼–辑的文件"
+114 "没有å¯æ˜¾ç¤ºçš„文件列表"
+115 "ç¼ºå°‘ç”¨äºŽæ›¿æ¢ \"!\" 的上一æ¡å‘½ä»¤"
+116 "ç¼ºå°‘ç”¨äºŽæ›¿æ¢ %% 的文件å"
+117 "ç¼ºå°‘ç”¨äºŽæ›¿æ¢ # 的文件å"
+118 "错误:execl: %s"
+119 "输入ï¼è¾“出错误:%s"
+120 "文件在上一次完整写入åŽè¢«ä¿®æ”¹ï¼›å†™å…¥æ–‡ä»¶ï¼Œæˆ–使用 ! 强制切æ¢ç›®å½•"
+121 "无法找到用户起始目录"
+122 "新的当å‰ç›®å½•ï¼š%s"
+123 "没有å¯æ˜¾ç¤ºçš„剪切缓冲区"
+124 "%s 命令ä¸èƒ½è¢«ç”¨ä½œå…¨å±€å‘½ä»¤æˆ– v 命令的一部分"
+125 "%s/%s: 未引入:ä¸å±žäºŽæ‚¨æˆ–根用户"
+126 "%s/%s: 未引入:ä¸å±žäºŽæ‚¨"
+127 "%s/%s: 未引入:å¯ä»¥è¢«æ–‡ä»¶å±žä¸»ä»¥å¤–的用户写入"
+128 "%s: 未引入:ä¸å±žäºŽæ‚¨æˆ–根用户"
+129 "%s: 未引入:ä¸å±žäºŽæ‚¨"
+130 "%s: 未引入:å¯ä»¥è¢«æ–‡ä»¶å±žä¸»ä»¥å¤–的用户写入"
+131 "缺少å¯ä»¥åˆå¹¶çš„è¡Œ"
+132 "缺少输入映射"
+133 "缺少命令映射"
+134 "%s 字符ä¸èƒ½è¢«é‡æ–°æ˜ å°„"
+135 "\"%s\" ç›®å‰æœªè¢«æ˜ å°„"
+136 "标记å必须是å•ä¸ªå­—符"
+137 "%s 已存在,未写入;用 ! 覆盖文件"
+138 "新建 exrc 文件:%s"
+139 "目标行在移动范围之内"
+140 "open è¦æ±‚å¼€å¯ open 选项"
+141 "open 命令未实现"
+142 "无法ä¿æŒæ­¤æ–‡ä»¶"
+143 "文件已ä¿æŒ"
+144 "%s: 展开的文件å过多"
+145 "åªèƒ½è¯»å–常规文件和具å管é“"
+146 "%s: 读é”ä¸å¯ç”¨"
+147 "正在读å–……"
+148 "%s: %lu 行,%lu 个字符"
+149 "没有å¯æ˜¾ç¤ºçš„åŽå°å±å¹•"
+150 "script 命令仅在 vi 模å¼ä¸‹å¯ç”¨"
+151 "没有è¦æ‰§è¡Œçš„命令"
+152 "shiftwidth 选项被设为 0"
+153 "命令计数溢出"
+154 "命令计数下溢"
+155 "正则表达å¼å·²æŒ‡å®šï¼›r 修饰符无效"
+156 "#, l å’Œ p 修饰符在 vi 模å¼ä¸‹ä¸èƒ½ä¸Ž c 修饰符组åˆ"
+157 "未找到匹é…"
+158 "没有上一次进入的 tag"
+159 "tags 栈上的记录少于 %s æ¡ï¼›ç”¨ :display t[ags] 显示它们"
+160 "tags 栈上ä¸å­˜åœ¨æ–‡ä»¶ %s,无法返回;用 :display t[ags] 查看"
+161 "按回车键继续:"
+162 "%s: tag 未找到"
+163 "%s: æŸåçš„ tag 在 %s 中"
+164 "%s: tag çš„è¡Œå·è¶…过了文件尾"
+165 "tags 栈为空"
+166 "%s: æœç´¢æ¨¡å¼æœªæ‰¾åˆ°"
+167 "还有 %d 个待编辑文件"
+168 "缓冲区 %s 为空"
+169 "确认修改?[n]"
+170 "已中断"
+171 "没有上一个å¯ä¾›æ‰§è¡Œçš„缓冲区"
+172 "没有上一æ¡æ­£åˆ™è¡¨è¾¾å¼"
+173 "%s è¦æ±‚存在一个已读入的文件"
+174 "用法:%s"
+175 "visual 命令è¦æ±‚å¼€å¯ open 选项"
+177 "空文件"
+178 "没有上一次 F, f, T 或 t æœç´¢"
+179 "%s 未找到"
+180 "没有上一个待编辑文件"
+181 "光标ä¸åœ¨æ•°å­—上"
+182 "结果数字过大"
+183 "结果数字过å°"
+184 "这一行上没有匹é…的字符"
+185 "匹é…字符未找到"
+186 "没有å¯æ›¿æ¢çš„字符"
+187 "没有其它å±å¹•å¯ä»¥åˆ‡æ¢"
+188 "在æœç´¢å­—符串ã€è¡Œå移é‡æˆ– z 命令之åŽæœ‰å¤šä½™å­—符"
+189 "没有上一个æœç´¢æ¨¡å¼"
+190 "æœç´¢å›žè½¬åˆ°äº†åˆå§‹ä½ç½®"
+191 "缩写展开超过é™åˆ¶ï¼šå­—符已丢弃"
+192 "éžæ³•å­—符;用引å·æ‹¬èµ·æ¥å†è¾“å…¥"
+193 "已到æ’入点的开始"
+194 "没有å¯æ“¦é™¤çš„剩余字符"
+195 "移动超过文件尾"
+196 "移动超过行末"
+197 "光标未移动"
+198 "已到文件头"
+199 "移动超过文件头"
+200 "å·²ä½äºŽç¬¬ä¸€åˆ—"
+201 "缓冲区应在命令å‰æŒ‡å®š"
+202 "已到文件尾"
+203 "已到行末"
+204 "%s ä¸æ˜¯ vi 命令"
+205 "用法 %s"
+206 "没有å¯åˆ é™¤çš„字符"
+207 "Q å‘½ä»¤éœ€è¦ ex 终端界é¢"
+208 "没有å¯é‡å¤çš„命令"
+209 "文件为空"
+210 "%s ä¸èƒ½è¢«ç”¨ä½œç§»åŠ¨å‘½ä»¤"
+211 "已处于命令模å¼"
+212 "光标ä¸åœ¨å•è¯ä¸Š"
+214 "窗å£é€‰é¡¹çš„值过大,最大值 %u"
+215 "追加"
+216 "修改"
+217 "命令"
+218 "æ’å…¥"
+219 "替æ¢"
+220 "移动超过å±å¹•ç»ˆç‚¹"
+221 "移动超过å±å¹•èµ·ç‚¹"
+222 "分å±éœ€è¦å¤šäºŽ %d è¡Œ"
+223 "没有åŽå°å±å¹•"
+224 "ä¸å­˜åœ¨æ­£åœ¨ç¼–辑文件 %s çš„åŽå°å±å¹•"
+225 "ä¸èƒ½æŠŠæ‚¨å”¯ä¸€çš„å±å¹•ç½®äºŽåŽå°"
+226 "å±å¹•åªèƒ½æ”¶ç¼©åˆ° %d è¡Œ"
+227 "å±å¹•ä¸èƒ½æ”¶ç¼©"
+228 "å±å¹•ä¸èƒ½å¢žé«˜"
+230 "ä¸èƒ½æŒ‚èµ·æ­¤å±å¹•"
+231 "已中断:键映射已丢弃"
+232 "vi: 临时缓冲区未释放"
+233 "此终端没有 %s 键"
+234 "åªèƒ½æŒ‡å®šä¸€ä¸ªç¼“冲区"
+235 "数字大于 %lu"
+236 "已中断"
+237 "无法创建临时文件"
+238 "警告:%s ä¸æ˜¯å¸¸è§„文件"
+239 "%s 已加é”,会è¯ä¸ºåªè¯»"
+240 "%s: 移除"
+241 "%s: 关闭"
+242 "%s: 移除"
+243 "%s: 移除"
+244 "åªè¯»æ–‡ä»¶ï¼Œæœªå†™å…¥ï¼›ç”¨ ! 强制写入"
+245 "åªè¯»æ–‡ä»¶ï¼Œæœªå†™å…¥"
+246 "%s 已存在,未写入;用 ! 覆盖文件"
+247 "%s 已存在,未写入"
+248 "是已存在文件的一部分,未写入;用 ! 强制写入"
+249 "是已存在文件的一部分,未写入"
+250 "%s: 文件被修改,新于当å‰æ‹·è´ï¼›ç”¨ ! 强制写入"
+251 "%s: 文件被修改,新于当å‰æ‹·è´"
+252 "%s: 写é”ä¸å¯ç”¨"
+253 "正在写入……"
+254 "%s: 警告:文件被截断"
+255 "å·²ä½äºŽè¿™ç»„ tags 中的第一个"
+256 "%s: 新文件:%lu 行,%lu 个字符"
+257 "%s: %lu 行,%lu 个字符"
+258 "%s: 展开的文件å过多"
+259 "%s: ä¸æ˜¯å¸¸è§„文件"
+260 "%s: ä¸å±žäºŽæ‚¨"
+261 "%s: å¯è¢«æ–‡ä»¶å±žä¸»ä»¥å¤–的用户访问"
+262 "文件在上一次完整写入åŽè¢«ä¿®æ”¹ï¼›å†™å…¥æ–‡ä»¶ï¼Œæˆ–使用 ! 强制载入"
+263 "文件在上一次完整写入åŽè¢«ä¿®æ”¹ï¼›å†™å…¥æ–‡ä»¶ï¼Œæˆ–使用 :edit! 强制编辑"
+264 "文件在上一次完整写入åŽè¢«ä¿®æ”¹ï¼›å†™å…¥æ–‡ä»¶ï¼Œæˆ–使用 ! 强制执行"
+265 "临时文件,退出将丢弃全部修改"
+266 "文件åªè¯»ï¼Œä¿®æ”¹æœªè¢«è‡ªåŠ¨å†™å…¥"
+267 "日志é‡å¯"
+268 "确认?[ynq]"
+269 "按任æ„键继续:"
+270 "按任æ„键继续[按 : 键输入 ex 命令]:"
+271 "按任æ„键继续[按 q 键推出]:"
+272 "该形å¼çš„ %s å‘½ä»¤éœ€è¦ ex 终端界é¢"
+273 "进入 ex 输入模å¼"
+274 "命令失败,尚未读入文件"
+275 " 继续?"
+276 "æ„外的字符事件"
+277 "以外的文件尾事件"
+278 "查询未找到匹é…"
+279 "æ„外的中断事件"
+280 "æ„外的退出事件"
+281 "æ„外的é‡ç»˜äº‹ä»¶"
+282 "å·²ä½äºŽè¿™ç»„ tags 中的最åŽä¸€ä¸ª"
+283 "%s å‘½ä»¤éœ€è¦ ex 终端界é¢"
+284 "secure 编辑选项开å¯æ—¶ä¸æ”¯æŒè¯¥å½¢å¼çš„ %s 命令"
+285 "æ„外的字符串事件"
+286 "æ„外的超时事件"
+287 "æ„外的写入事件"
+288 "分å±éœ€è¦å¤šäºŽ %d 列"
+289 "secure 编辑选项开å¯æ—¶ä¸æ”¯æŒ shell 展开"
+290 "secure 编辑选项开å¯æ—¶ä¸æ”¯æŒ %s 命令"
+291 "set: 选项 %s ä¸èƒ½å…³é—­"
+292 "显示空间太å°"
+293 "已添加"
+294 "已修改"
+295 "已删除"
+296 "å·²åˆå¹¶"
+297 "已移动"
+298 "å·²å移"
+299 "å·²å¤åˆ¶"
+300 "行"
+301 "行"
+303 "文件在上一次写入åŽè¢«ä¿®æ”¹"
+304 "Shell 展开失败"
+305 "未指定 %s 编辑选项"
+307 "没有è¦æ‰§è¡Œçš„ ex 命令"
+308 "键入回车执行一æ¡å‘½ä»¤ï¼Œ:q 退出"
+309 "使用 \"cscope help\" 查看帮助"
+310 "没有正在è¿è¡Œçš„ cscope 连接"
+311 "%s: æœç´¢ç±»åž‹ä¸æ˜Žï¼šä½¿ç”¨ %s 中的一个"
+312 "%d: æ— æ­¤ cscope 会è¯"
+313 "set: 选项 %s ç»å¯¹ä¸èƒ½å¼€å¯"
+314 "set: 选项 %s ç»å¯¹ä¸èƒ½è¢«è®¾ä¸º 0"
+315 "%s: 已追加:%lu 行,%lu 个字符"
+316 "æ„外的大å°è°ƒæ•´äº‹ä»¶"
+317 "%d 个待编辑的文件"
+319 "%d 个åŽå°å±å¹•ï¼›ç”¨ :display 列出它们"
+320 "光标ä½ç½®ä¸æ˜Ž"
+321 "ä¸æ”¯æŒæ–‡ä»¶ç¼–ç è½¬æ¢"
+322 "ä¸æ”¯æŒè¾“入编ç è½¬æ¢"
+323 "无效输入,已截断"
+324 "第 %d 行上有转æ¢é”™è¯¯"
diff --git a/usr.bin/vi/config.h b/usr.bin/vi/config.h
new file mode 100644
index 0000000..94e7808
--- /dev/null
+++ b/usr.bin/vi/config.h
@@ -0,0 +1,23 @@
+/* $Id: config.h.in,v 9.5 2013/03/11 01:20:53 zy Exp $ */
+/* $FreeBSD$ */
+
+/* Define if you want a debugging version. */
+/* #undef DEBUG */
+
+/* Define when using wide characters */
+/* #define USE_WIDECHAR set by Makefile */
+
+/* Define when iconv can be used */
+/* #define USE_ICONV set by Makefile */
+
+/* Define when the 2nd argument of iconv(3) is not const */
+/* #undef ICONV_TRADITIONAL */
+
+/* Define if you have <libutil.h> */
+#define HAVE_LIBUTIL_H
+
+/* Define if you have <ncurses.h> */
+#define HAVE_NCURSES_H
+
+/* Define if you have <term.h> */
+#define HAVE_TERM_H
diff --git a/usr.bin/vi/pathnames.h b/usr.bin/vi/pathnames.h
new file mode 100644
index 0000000..49d58fe
--- /dev/null
+++ b/usr.bin/vi/pathnames.h
@@ -0,0 +1,29 @@
+/* $Id: pathnames.h.in,v 8.7 2012/04/23 08:34:52 zy Exp $ */
+/* $FreeBSD$ */
+
+/* Read standard system paths first. */
+#include <paths.h>
+
+#ifndef _PATH_EXRC
+#define _PATH_EXRC ".exrc"
+#endif
+
+#ifndef _PATH_MSGCAT
+#define _PATH_MSGCAT "/usr/share/vi/catalog/"
+#endif
+
+#ifndef _PATH_NEXRC
+#define _PATH_NEXRC ".nexrc"
+#endif
+
+#ifndef _PATH_PRESERVE
+#define _PATH_PRESERVE "/var/tmp/vi.recover/"
+#endif
+
+#ifndef _PATH_SYSEXRC
+#define _PATH_SYSEXRC "/etc/vi.exrc"
+#endif
+
+#ifndef _PATH_TAGS
+#define _PATH_TAGS "tags"
+#endif
diff --git a/usr.bin/vis/Makefile b/usr.bin/vis/Makefile
new file mode 100644
index 0000000..5d860de
--- /dev/null
+++ b/usr.bin/vis/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= vis
+SRCS= vis.c foldit.c
+
+.PATH: ${.CURDIR}/../../contrib/vis
+CFLAGS+= -I${.CURDIR}/../../contrib/vis
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vis/Makefile.depend b/usr.bin/vis/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/vis/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/vmstat/Makefile b/usr.bin/vmstat/Makefile
new file mode 100644
index 0000000..13c8125
--- /dev/null
+++ b/usr.bin/vmstat/Makefile
@@ -0,0 +1,10 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= vmstat
+MAN= vmstat.8
+LIBADD= devstat kvm memstat xo util
+
+WARNS?= 1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vmstat/Makefile.depend b/usr.bin/vmstat/Makefile.depend
new file mode 100644
index 0000000..742f642
--- /dev/null
+++ b/usr.bin/vmstat/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdevstat \
+ lib/libelf \
+ lib/libkvm \
+ lib/libmemstat \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vmstat/vmstat.8 b/usr.bin/vmstat/vmstat.8
new file mode 100644
index 0000000..36ebcbb
--- /dev/null
+++ b/usr.bin/vmstat/vmstat.8
@@ -0,0 +1,388 @@
+.\" Copyright (c) 1986, 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.
+.\"
+.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd November 19, 2015
+.Dt VMSTAT 8
+.Os
+.Sh NAME
+.Nm vmstat
+.Nd report virtual memory statistics
+.Sh SYNOPSIS
+.Nm
+.\" .Op Fl fimst
+.Op Fl -libxo
+.Op Fl afHhimoPsz
+.Op Fl M Ar core Op Fl N Ar system
+.Op Fl c Ar count
+.Op Fl n Ar devs
+.Oo
+.Fl p
+.Sm off
+.Ar type , if , pass
+.Sm on
+.Oc
+.Op Fl w Ar wait
+.Op Ar disks ...
+.Op wait Op count
+.Sh DESCRIPTION
+The
+.Nm
+utility reports certain kernel statistics kept about process, virtual memory,
+disk, trap and cpu activity.
+.Pp
+If the
+.Fl M
+option is not specified, information is obtained from
+the currently running kernel via the
+.Xr sysctl 3
+interface.
+Otherwise, information is read from the specified core file,
+using the name list from the specified kernel image (or from
+the default image).
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.It Fl a
+When used with
+.Fl i ,
+include statistics about interrupts that have never been generated.
+.It Fl c
+Repeat the display
+.Ar count
+times.
+The first display is for the time since a reboot and each subsequent
+report is for the time period since the last display.
+If no repeat
+.Ar count
+is specified, and
+.Fl w
+is specified, the default is infinity, otherwise the default is one.
+.It Fl f
+Report on the number
+.Xr fork 2 ,
+.Xr vfork 2
+and
+.Xr rfork 2
+system calls since system startup, and the number of pages of virtual memory
+involved in each.
+.It Fl h
+Changes memory columns into more easily human readable form.
+The default if
+standard output is a terminal device.
+.It Fl H
+Changes memory columns into straight numbers.
+The default if standard output
+is not a terminal device (such as a script).
+.It Fl i
+Report on the number of interrupts taken by each device since system
+startup.
+.It Fl M
+Extract values associated with the name list from the specified
+.Ar core .
+.It Fl N
+If
+.Fl M
+is also specified,
+extract the name list from the specified
+.Ar system
+instead of the default,
+which is the kernel image the system has booted from.
+.It Fl m
+Report on the usage of kernel dynamic memory allocated using
+.Xr malloc 9
+by type.
+.It Fl n
+Change the maximum number of disks to display from the default of 2.
+.It Fl o
+Display a list of virtual memory objects in the system and the resident
+memory used by each object.
+.It Fl P
+Report per-cpu system/user/idle cpu statistics.
+.It Fl p
+Specify which types of devices to display.
+There are three different
+categories of devices:
+.Pp
+.Bl -tag -width indent -compact
+.It device type:
+.Bl -tag -width 9n -compact
+.It da
+Direct Access devices
+.It sa
+Sequential Access devices
+.It printer
+Printers
+.It proc
+Processor devices
+.It worm
+Write Once Read Multiple devices
+.It cd
+CD devices
+.It scanner
+Scanner devices
+.It optical
+Optical Memory devices
+.It changer
+Medium Changer devices
+.It comm
+Communication devices
+.It array
+Storage Array devices
+.It enclosure
+Enclosure Services devices
+.It floppy
+Floppy devices
+.El
+.Pp
+.It interface:
+.Bl -tag -width 9n -compact
+.It IDE
+Integrated Drive Electronics devices
+.It SCSI
+Small Computer System Interface devices
+.It other
+Any other device interface
+.El
+.Pp
+.It passthrough:
+.Bl -tag -width 9n -compact
+.It pass
+Passthrough devices
+.El
+.El
+.Pp
+The user must specify at least one device type, and may specify at most
+one device type from each category.
+Multiple device types in a single
+device type statement must be separated by commas.
+.Pp
+Any number of
+.Fl p
+arguments may be specified on the command line.
+All
+.Fl p
+arguments are ORed together to form a matching expression against which
+all devices in the system are compared.
+Any device that fully matches
+any
+.Fl p
+argument will be included in the
+.Nm
+output, up to two devices, or the maximum number of devices specified
+by the user.
+.It Fl s
+Display the contents of the
+.Em sum
+structure, giving the total number of several kinds of paging related
+events which have occurred since system startup.
+.\" .It Fl t
+.\" Report on the number of page in and page reclaims since system startup,
+.\" and the amount of time required by each.
+.It Fl w
+Pause
+.Ar wait
+seconds between each display.
+If no repeat
+.Ar wait
+interval is specified, the default is 1 second.
+The
+.Nm
+command will accept and honor a non-integer number of seconds.
+.It Fl z
+Report on memory used by the kernel zone allocator,
+.Xr uma 9 ,
+by zone.
+.El
+.Pp
+The
+.Ar wait
+and
+.Ar count
+arguments may be given after their respective flags at any point
+on the command line before the
+.Ar disks
+argument(s), or without their flags, as the final argument(s).
+The latter form is accepted for backwards compatibility, but it is
+preferred to use the forms with
+.Fl w
+and
+.Fl c
+to avoid ambiguity.
+.Pp
+By default,
+.Nm
+displays the following information:
+.Bl -tag -width indent
+.It procs
+Information about the numbers of processes in various states.
+.Pp
+.Bl -tag -width indent -compact
+.It r
+in run queue
+.It b
+blocked for resources (i/o, paging, etc.)
+.It w
+runnable or short sleeper (< 20 secs) but swapped
+.El
+.It memory
+Information about the usage of virtual and real memory.
+Virtual pages (reported in units of 1024 bytes) are considered active if
+they belong to processes which are running or have run in the last 20
+seconds.
+.Pp
+.Bl -tag -width indent -compact
+.It avm
+active virtual pages
+.It fre
+size of the free list
+.El
+.It page
+Information about page faults and paging activity.
+These are averaged each five seconds, and given in units per second.
+.Pp
+.Bl -tag -width indent -compact
+.It flt
+total number of page faults
+.It re
+page reclaims (simulating reference bits)
+.\" .It at
+.\" pages attached (found in free list)
+.It pi
+pages paged in
+.It po
+pages paged out
+.It fr
+pages freed per second
+.\" .It de
+.\" anticipated short term memory shortfall
+.It sr
+pages scanned by clock algorithm, per-second
+.El
+.It disks
+Disk operations per second (this field is system dependent).
+Typically paging will be split across the available drives.
+The header of the field is the first two characters of the disk name and
+the unit number.
+If more than two disk drives are configured in the system,
+.Nm
+displays only the first two drives, unless the user specifies the
+.Fl n
+argument to increase the number of drives displayed.
+This will probably
+cause the display to exceed 80 columns, however.
+To force
+.Nm
+to display specific drives, their names may be supplied on the command line.
+The
+.Nm
+utility
+defaults to show disks first, and then various other random devices in the
+system to add up to two devices, if there are that many devices in the
+system.
+If devices are specified on the command line, or if a device type
+matching pattern is specified (see above),
+.Nm
+will only display the given devices or the devices matching the pattern,
+and will not randomly select other devices in the system.
+.It faults
+Trap/interrupt rate averages per second over last 5 seconds.
+.Pp
+.Bl -tag -width indent -compact
+.It in
+device interrupts per interval (including clock interrupts)
+.It sy
+system calls per interval
+.It cs
+cpu context switch rate (switches/interval)
+.El
+.It cpu
+Breakdown of percentage usage of CPU time.
+.Pp
+.Bl -tag -width indent -compact
+.It us
+user time for normal and low priority processes
+.It sy
+system time
+.It id
+cpu idle
+.El
+.El
+.Sh FILES
+.Bl -tag -width /boot/kernel/kernel -compact
+.It Pa /boot/kernel/kernel
+default kernel namelist
+.It Pa /dev/kmem
+default memory file
+.El
+.Sh EXAMPLES
+The command:
+.Dl vmstat -w 5
+will print what the system is doing every five
+seconds; this is a good choice of printing interval since this is how often
+some of the statistics are sampled in the system.
+Others vary every second and running the output for a while will make it
+apparent which are recomputed every second.
+.Pp
+The command:
+.Dl vmstat -p da -p cd -w 1
+will tell vmstat to select the first two direct access or CDROM devices
+and display statistics on those devices, as well as other systems
+statistics every second.
+.Sh SEE ALSO
+.Xr fstat 1 ,
+.Xr netstat 1 ,
+.Xr nfsstat 1 ,
+.Xr ps 1 ,
+.Xr systat 1 ,
+.Xr libmemstat 3 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3 ,
+.Xr gstat 8 ,
+.Xr iostat 8 ,
+.Xr pstat 8 ,
+.Xr sysctl 8 ,
+.Xr malloc 9 ,
+.Xr uma 9
+.Pp
+The sections starting with ``Interpreting system activity'' in
+.%T "Installing and Operating 4.3BSD" .
+.Sh BUGS
+The
+.Fl c
+and
+.Fl w
+options are only available with the default output.
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
new file mode 100644
index 0000000..0dbd2d1
--- /dev/null
+++ b/usr.bin/vmstat/vmstat.c
@@ -0,0 +1,1729 @@
+/*
+ * Copyright (c) 1980, 1986, 1991, 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, 1986, 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/user.h>
+#include <sys/vmmeter.h>
+#include <sys/pcpu.h>
+
+#include <vm/vm_param.h>
+
+#include <ctype.h>
+#include <devstat.h>
+#include <err.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <kvm.h>
+#include <limits.h>
+#include <memstat.h>
+#include <nlist.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <time.h>
+#include <unistd.h>
+#include <libutil.h>
+#include <libxo/xo.h>
+
+#define VMSTAT_XO_VERSION "1"
+
+static char da[] = "da";
+
+static struct nlist namelist[] = {
+#define X_SUM 0
+ { "_vm_cnt" },
+#define X_HZ 1
+ { "_hz" },
+#define X_STATHZ 2
+ { "_stathz" },
+#define X_NCHSTATS 3
+ { "_nchstats" },
+#define X_INTRNAMES 4
+ { "_intrnames" },
+#define X_SINTRNAMES 5
+ { "_sintrnames" },
+#define X_INTRCNT 6
+ { "_intrcnt" },
+#define X_SINTRCNT 7
+ { "_sintrcnt" },
+#ifdef notyet
+#define X_DEFICIT XXX
+ { "_deficit" },
+#define X_REC XXX
+ { "_rectime" },
+#define X_PGIN XXX
+ { "_pgintime" },
+#define X_XSTATS XXX
+ { "_xstats" },
+#define X_END XXX
+#else
+#define X_END 8
+#endif
+ { "" },
+};
+
+static struct statinfo cur, last;
+static int num_devices, maxshowdevs;
+static long generation;
+static struct device_selection *dev_select;
+static int num_selected;
+static struct devstat_match *matches;
+static int num_matches = 0;
+static int num_devices_specified, num_selections;
+static long select_generation;
+static char **specified_devices;
+static devstat_select_mode select_mode;
+
+static struct vmmeter sum, osum;
+
+#define VMSTAT_DEFAULT_LINES 20 /* Default number of `winlines'. */
+volatile sig_atomic_t wresized; /* Tty resized, when non-zero. */
+static int winlines = VMSTAT_DEFAULT_LINES; /* Current number of tty rows. */
+
+static int aflag;
+static int nflag;
+static int Pflag;
+static int hflag;
+
+static kvm_t *kd;
+
+#define FORKSTAT 0x01
+#define INTRSTAT 0x02
+#define MEMSTAT 0x04
+#define SUMSTAT 0x08
+#define TIMESTAT 0x10
+#define VMSTAT 0x20
+#define ZMEMSTAT 0x40
+#define OBJSTAT 0x80
+
+static void cpustats(void);
+static void pcpustats(int, u_long, int);
+static void devstats(void);
+static void doforkst(void);
+static void dointr(unsigned int, int);
+static void doobjstat(void);
+static void dosum(void);
+static void dovmstat(unsigned int, int);
+static void domemstat_malloc(void);
+static void domemstat_zone(void);
+static void kread(int, void *, size_t);
+static void kreado(int, void *, size_t, size_t);
+static char *kgetstr(const char *);
+static void needhdr(int);
+static void needresize(int);
+static void doresize(void);
+static void printhdr(int, u_long);
+static void usage(void);
+
+static long pct(long, long);
+static long long getuptime(void);
+
+static char **getdrivedata(char **);
+
+int
+main(int argc, char *argv[])
+{
+ int c, todo;
+ unsigned int interval;
+ float f;
+ int reps;
+ char *memf, *nlistf;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ memf = nlistf = NULL;
+ interval = reps = todo = 0;
+ maxshowdevs = 2;
+ hflag = isatty(1);
+
+ argc = xo_parse_args(argc, argv);
+ if (argc < 0)
+ return argc;
+
+ while ((c = getopt(argc, argv, "ac:fhHiM:mN:n:oPp:stw:z")) != -1) {
+ switch (c) {
+ case 'a':
+ aflag++;
+ break;
+ case 'c':
+ reps = atoi(optarg);
+ break;
+ case 'P':
+ Pflag++;
+ break;
+ case 'f':
+ todo |= FORKSTAT;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'H':
+ hflag = 0;
+ break;
+ case 'i':
+ todo |= INTRSTAT;
+ break;
+ case 'M':
+ memf = optarg;
+ break;
+ case 'm':
+ todo |= MEMSTAT;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'n':
+ nflag = 1;
+ maxshowdevs = atoi(optarg);
+ if (maxshowdevs < 0)
+ xo_errx(1, "number of devices %d is < 0",
+ maxshowdevs);
+ break;
+ case 'o':
+ todo |= OBJSTAT;
+ break;
+ case 'p':
+ if (devstat_buildmatch(optarg, &matches, &num_matches) != 0)
+ xo_errx(1, "%s", devstat_errbuf);
+ break;
+ case 's':
+ todo |= SUMSTAT;
+ break;
+ case 't':
+#ifdef notyet
+ todo |= TIMESTAT;
+#else
+ xo_errx(EX_USAGE, "sorry, -t is not (re)implemented yet");
+#endif
+ break;
+ case 'w':
+ /* Convert to milliseconds. */
+ f = atof(optarg);
+ interval = f * 1000;
+ break;
+ case 'z':
+ todo |= ZMEMSTAT;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ xo_set_version(VMSTAT_XO_VERSION);
+ if (todo == 0)
+ todo = VMSTAT;
+
+ if (memf != NULL) {
+ kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
+ if (kd == NULL)
+ xo_errx(1, "kvm_openfiles: %s", errbuf);
+ }
+
+retry_nlist:
+ if (kd != NULL && (c = kvm_nlist(kd, namelist)) != 0) {
+ if (c > 0) {
+ int bufsize = 0, len = 0;
+ char *buf, *bp;
+ /*
+ * '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;
+ }
+ for (c = 0;
+ c < (int)(sizeof(namelist)/sizeof(namelist[0]));
+ c++)
+ if (namelist[c].n_type == 0)
+ bufsize += strlen(namelist[c].n_name) + 1;
+ bufsize += len + 1;
+ buf = bp = alloca(bufsize);
+
+ for (c = 0;
+ c < (int)(sizeof(namelist)/sizeof(namelist[0]));
+ c++)
+ if (namelist[c].n_type == 0) {
+ xo_error(" %s",
+ namelist[c].n_name);
+ len = strlen(namelist[c].n_name);
+ *bp++ = ' ';
+ memcpy(bp, namelist[c].n_name, len);
+ bp += len;
+ }
+ *bp = '\0';
+ xo_error("undefined symbols:\n", buf);
+ } else
+ xo_warnx("kvm_nlist: %s", kvm_geterr(kd));
+ xo_finish();
+ exit(1);
+ }
+ if (kd && Pflag)
+ xo_errx(1, "Cannot use -P with crash dumps");
+
+ if (todo & VMSTAT) {
+ /*
+ * Make sure that the userland devstat version matches the
+ * kernel devstat version. If not, exit and print a
+ * message informing the user of his mistake.
+ */
+ if (devstat_checkversion(NULL) < 0)
+ xo_errx(1, "%s", devstat_errbuf);
+
+
+ argv = getdrivedata(argv);
+ }
+
+ if (*argv) {
+ f = atof(*argv);
+ interval = f * 1000;
+ if (*++argv)
+ reps = atoi(*argv);
+ }
+
+ if (interval) {
+ if (!reps)
+ reps = -1;
+ } else if (reps)
+ interval = 1 * 1000;
+
+ if (todo & FORKSTAT)
+ doforkst();
+ if (todo & MEMSTAT)
+ domemstat_malloc();
+ if (todo & ZMEMSTAT)
+ domemstat_zone();
+ if (todo & SUMSTAT)
+ dosum();
+ if (todo & OBJSTAT)
+ doobjstat();
+#ifdef notyet
+ if (todo & TIMESTAT)
+ dotimes();
+#endif
+ if (todo & INTRSTAT)
+ dointr(interval, reps);
+ if (todo & VMSTAT)
+ dovmstat(interval, reps);
+ xo_finish();
+ exit(0);
+}
+
+static int
+mysysctl(const char *name, void *oldp, size_t *oldlenp,
+ void *newp, size_t newlen)
+{
+ int error;
+
+ error = sysctlbyname(name, oldp, oldlenp, newp, newlen);
+ if (error != 0 && errno != ENOMEM)
+ xo_err(1, "sysctl(%s)", name);
+ return (error);
+}
+
+static char **
+getdrivedata(char **argv)
+{
+ if ((num_devices = devstat_getnumdevs(NULL)) < 0)
+ xo_errx(1, "%s", devstat_errbuf);
+
+ cur.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo));
+ last.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo));
+
+ if (devstat_getdevs(NULL, &cur) == -1)
+ xo_errx(1, "%s", devstat_errbuf);
+
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+
+ specified_devices = (char **)malloc(sizeof(char *));
+ for (num_devices_specified = 0; *argv; ++argv) {
+ if (isdigit(**argv))
+ break;
+ num_devices_specified++;
+ specified_devices = (char **)realloc(specified_devices,
+ sizeof(char *) *
+ num_devices_specified);
+ specified_devices[num_devices_specified - 1] = *argv;
+ }
+ dev_select = NULL;
+
+ if (nflag == 0 && maxshowdevs < num_devices_specified)
+ maxshowdevs = num_devices_specified;
+
+ /*
+ * People are generally only interested in disk statistics when
+ * they're running vmstat. So, that's what we're going to give
+ * them if they don't specify anything by default. We'll also give
+ * them any other random devices in the system so that we get to
+ * maxshowdevs devices, if that many devices exist. If the user
+ * specifies devices on the command line, either through a pattern
+ * match or by naming them explicitly, we will give the user only
+ * those devices.
+ */
+ if ((num_devices_specified == 0) && (num_matches == 0)) {
+ if (devstat_buildmatch(da, &matches, &num_matches) != 0)
+ xo_errx(1, "%s", devstat_errbuf);
+
+ select_mode = DS_SELECT_ADD;
+ } else
+ select_mode = DS_SELECT_ONLY;
+
+ /*
+ * At this point, selectdevs will almost surely indicate that the
+ * device list has changed, so we don't look for return values of 0
+ * or 1. If we get back -1, though, there is an error.
+ */
+ if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation, cur.dinfo->devices,
+ num_devices, matches, num_matches, specified_devices,
+ num_devices_specified, select_mode,
+ maxshowdevs, 0) == -1)
+ xo_errx(1, "%s", devstat_errbuf);
+
+ return(argv);
+}
+
+/* Return system uptime in nanoseconds */
+static long long
+getuptime(void)
+{
+ struct timespec sp;
+
+ (void)clock_gettime(CLOCK_UPTIME, &sp);
+
+ return((long long)sp.tv_sec * 1000000000LL + sp.tv_nsec);
+}
+
+static void
+fill_pcpu(struct pcpu ***pcpup, int* maxcpup)
+{
+ struct pcpu **pcpu;
+
+ int maxcpu, i;
+
+ *pcpup = NULL;
+
+ if (kd == NULL)
+ return;
+
+ maxcpu = kvm_getmaxcpu(kd);
+ if (maxcpu < 0)
+ xo_errx(1, "kvm_getmaxcpu: %s", kvm_geterr(kd));
+
+ pcpu = calloc(maxcpu, sizeof(struct pcpu *));
+ if (pcpu == NULL)
+ xo_err(1, "calloc");
+
+ for (i = 0; i < maxcpu; i++) {
+ pcpu[i] = kvm_getpcpu(kd, i);
+ if (pcpu[i] == (struct pcpu *)-1)
+ xo_errx(1, "kvm_getpcpu: %s", kvm_geterr(kd));
+ }
+
+ *maxcpup = maxcpu;
+ *pcpup = pcpu;
+}
+
+static void
+free_pcpu(struct pcpu **pcpu, int maxcpu)
+{
+ int i;
+
+ for (i = 0; i < maxcpu; i++)
+ free(pcpu[i]);
+ free(pcpu);
+}
+
+static void
+fill_vmmeter(struct vmmeter *vmmp)
+{
+ struct pcpu **pcpu;
+ int maxcpu, i;
+
+ if (kd != NULL) {
+ kread(X_SUM, vmmp, sizeof(*vmmp));
+ fill_pcpu(&pcpu, &maxcpu);
+ for (i = 0; i < maxcpu; i++) {
+ if (pcpu[i] == NULL)
+ continue;
+#define ADD_FROM_PCPU(i, name) \
+ vmmp->name += pcpu[i]->pc_cnt.name
+ ADD_FROM_PCPU(i, v_swtch);
+ ADD_FROM_PCPU(i, v_trap);
+ ADD_FROM_PCPU(i, v_syscall);
+ ADD_FROM_PCPU(i, v_intr);
+ ADD_FROM_PCPU(i, v_soft);
+ ADD_FROM_PCPU(i, v_vm_faults);
+ ADD_FROM_PCPU(i, v_io_faults);
+ ADD_FROM_PCPU(i, v_cow_faults);
+ ADD_FROM_PCPU(i, v_cow_optim);
+ ADD_FROM_PCPU(i, v_zfod);
+ ADD_FROM_PCPU(i, v_ozfod);
+ ADD_FROM_PCPU(i, v_swapin);
+ ADD_FROM_PCPU(i, v_swapout);
+ ADD_FROM_PCPU(i, v_swappgsin);
+ ADD_FROM_PCPU(i, v_swappgsout);
+ ADD_FROM_PCPU(i, v_vnodein);
+ ADD_FROM_PCPU(i, v_vnodeout);
+ ADD_FROM_PCPU(i, v_vnodepgsin);
+ ADD_FROM_PCPU(i, v_vnodepgsout);
+ ADD_FROM_PCPU(i, v_intrans);
+ ADD_FROM_PCPU(i, v_tfree);
+ ADD_FROM_PCPU(i, v_forks);
+ ADD_FROM_PCPU(i, v_vforks);
+ ADD_FROM_PCPU(i, v_rforks);
+ ADD_FROM_PCPU(i, v_kthreads);
+ ADD_FROM_PCPU(i, v_forkpages);
+ ADD_FROM_PCPU(i, v_vforkpages);
+ ADD_FROM_PCPU(i, v_rforkpages);
+ ADD_FROM_PCPU(i, v_kthreadpages);
+#undef ADD_FROM_PCPU
+ }
+ free_pcpu(pcpu, maxcpu);
+ } else {
+ size_t size = sizeof(unsigned int);
+#define GET_VM_STATS(cat, name) \
+ mysysctl("vm.stats." #cat "." #name, &vmmp->name, &size, NULL, 0)
+ /* sys */
+ GET_VM_STATS(sys, v_swtch);
+ GET_VM_STATS(sys, v_trap);
+ GET_VM_STATS(sys, v_syscall);
+ GET_VM_STATS(sys, v_intr);
+ GET_VM_STATS(sys, v_soft);
+
+ /* vm */
+ GET_VM_STATS(vm, v_vm_faults);
+ GET_VM_STATS(vm, v_io_faults);
+ GET_VM_STATS(vm, v_cow_faults);
+ GET_VM_STATS(vm, v_cow_optim);
+ GET_VM_STATS(vm, v_zfod);
+ GET_VM_STATS(vm, v_ozfod);
+ GET_VM_STATS(vm, v_swapin);
+ GET_VM_STATS(vm, v_swapout);
+ GET_VM_STATS(vm, v_swappgsin);
+ GET_VM_STATS(vm, v_swappgsout);
+ GET_VM_STATS(vm, v_vnodein);
+ GET_VM_STATS(vm, v_vnodeout);
+ GET_VM_STATS(vm, v_vnodepgsin);
+ GET_VM_STATS(vm, v_vnodepgsout);
+ GET_VM_STATS(vm, v_intrans);
+ GET_VM_STATS(vm, v_reactivated);
+ GET_VM_STATS(vm, v_pdwakeups);
+ GET_VM_STATS(vm, v_pdpages);
+ GET_VM_STATS(vm, v_tcached);
+ GET_VM_STATS(vm, v_dfree);
+ GET_VM_STATS(vm, v_pfree);
+ GET_VM_STATS(vm, v_tfree);
+ GET_VM_STATS(vm, v_page_size);
+ GET_VM_STATS(vm, v_page_count);
+ GET_VM_STATS(vm, v_free_reserved);
+ GET_VM_STATS(vm, v_free_target);
+ GET_VM_STATS(vm, v_free_min);
+ GET_VM_STATS(vm, v_free_count);
+ GET_VM_STATS(vm, v_wire_count);
+ GET_VM_STATS(vm, v_active_count);
+ GET_VM_STATS(vm, v_inactive_target);
+ GET_VM_STATS(vm, v_inactive_count);
+ GET_VM_STATS(vm, v_cache_count);
+ GET_VM_STATS(vm, v_pageout_free_min);
+ GET_VM_STATS(vm, v_interrupt_free_min);
+ /*GET_VM_STATS(vm, v_free_severe);*/
+ GET_VM_STATS(vm, v_forks);
+ GET_VM_STATS(vm, v_vforks);
+ GET_VM_STATS(vm, v_rforks);
+ GET_VM_STATS(vm, v_kthreads);
+ GET_VM_STATS(vm, v_forkpages);
+ GET_VM_STATS(vm, v_vforkpages);
+ GET_VM_STATS(vm, v_rforkpages);
+ GET_VM_STATS(vm, v_kthreadpages);
+#undef GET_VM_STATS
+ }
+}
+
+static void
+fill_vmtotal(struct vmtotal *vmtp)
+{
+ if (kd != NULL) {
+ /* XXX fill vmtp */
+ xo_errx(1, "not implemented");
+ } else {
+ size_t size = sizeof(*vmtp);
+ mysysctl("vm.vmtotal", vmtp, &size, NULL, 0);
+ if (size != sizeof(*vmtp))
+ xo_errx(1, "vm.total size mismatch");
+ }
+}
+
+/* Determine how many cpu columns, and what index they are in kern.cp_times */
+static int
+getcpuinfo(u_long *maskp, int *maxidp)
+{
+ int maxcpu;
+ int maxid;
+ int ncpus;
+ int i, j;
+ int empty;
+ size_t size;
+ long *times;
+ u_long mask;
+
+ if (kd != NULL)
+ xo_errx(1, "not implemented");
+ mask = 0;
+ ncpus = 0;
+ size = sizeof(maxcpu);
+ mysysctl("kern.smp.maxcpus", &maxcpu, &size, NULL, 0);
+ if (size != sizeof(maxcpu))
+ xo_errx(1, "sysctl kern.smp.maxcpus");
+ size = sizeof(long) * maxcpu * CPUSTATES;
+ times = malloc(size);
+ if (times == NULL)
+ xo_err(1, "malloc %zd bytes", size);
+ mysysctl("kern.cp_times", times, &size, NULL, 0);
+ maxid = (size / CPUSTATES / sizeof(long)) - 1;
+ for (i = 0; i <= maxid; i++) {
+ empty = 1;
+ for (j = 0; empty && j < CPUSTATES; j++) {
+ if (times[i * CPUSTATES + j] != 0)
+ empty = 0;
+ }
+ if (!empty) {
+ mask |= (1ul << i);
+ ncpus++;
+ }
+ }
+ if (maskp)
+ *maskp = mask;
+ if (maxidp)
+ *maxidp = maxid;
+ return (ncpus);
+}
+
+
+static void
+prthuman(const char *name, u_int64_t val, int size)
+{
+ char buf[10];
+ int flags;
+ char fmt[128];
+
+ snprintf(fmt, sizeof(fmt), "{:%s/%%*s}", name);
+
+ if (size < 5 || size > 9)
+ xo_errx(1, "doofus");
+ flags = HN_B | HN_NOSPACE | HN_DECIMAL;
+ humanize_number(buf, size, val, "", HN_AUTOSCALE, flags);
+ xo_attr("value", "%ju", (uintmax_t) val);
+ xo_emit(fmt, size, buf);
+}
+
+static int hz, hdrcnt;
+
+static long *cur_cp_times;
+static long *last_cp_times;
+static size_t size_cp_times;
+
+static void
+dovmstat(unsigned int interval, int reps)
+{
+ struct vmtotal total;
+ time_t uptime, halfuptime;
+ struct devinfo *tmp_dinfo;
+ size_t size;
+ int ncpus, maxid;
+ u_long cpumask;
+ int rate_adj;
+
+ uptime = getuptime() / 1000000000LL;
+ halfuptime = uptime / 2;
+ rate_adj = 1;
+ ncpus = 1;
+ maxid = 0;
+
+ /*
+ * If the user stops the program (control-Z) and then resumes it,
+ * print out the header again.
+ */
+ (void)signal(SIGCONT, needhdr);
+
+ /*
+ * If our standard output is a tty, then install a SIGWINCH handler
+ * and set wresized so that our first iteration through the main
+ * vmstat loop will peek at the terminal's current rows to find out
+ * how many lines can fit in a screenful of output.
+ */
+ if (isatty(fileno(stdout)) != 0) {
+ wresized = 1;
+ (void)signal(SIGWINCH, needresize);
+ } else {
+ wresized = 0;
+ winlines = VMSTAT_DEFAULT_LINES;
+ }
+
+ if (kd != NULL) {
+ if (namelist[X_STATHZ].n_type != 0 &&
+ namelist[X_STATHZ].n_value != 0)
+ kread(X_STATHZ, &hz, sizeof(hz));
+ if (!hz)
+ kread(X_HZ, &hz, sizeof(hz));
+ } else {
+ struct clockinfo clockrate;
+
+ size = sizeof(clockrate);
+ mysysctl("kern.clockrate", &clockrate, &size, NULL, 0);
+ if (size != sizeof(clockrate))
+ xo_errx(1, "clockrate size mismatch");
+ hz = clockrate.hz;
+ }
+
+ if (Pflag) {
+ ncpus = getcpuinfo(&cpumask, &maxid);
+ size_cp_times = sizeof(long) * (maxid + 1) * CPUSTATES;
+ cur_cp_times = calloc(1, size_cp_times);
+ last_cp_times = calloc(1, size_cp_times);
+ }
+ for (hdrcnt = 1;;) {
+ if (!--hdrcnt)
+ printhdr(maxid, cpumask);
+ if (kd != NULL) {
+ if (kvm_getcptime(kd, cur.cp_time) < 0)
+ xo_errx(1, "kvm_getcptime: %s", kvm_geterr(kd));
+ } else {
+ size = sizeof(cur.cp_time);
+ mysysctl("kern.cp_time", &cur.cp_time, &size, NULL, 0);
+ if (size != sizeof(cur.cp_time))
+ xo_errx(1, "cp_time size mismatch");
+ }
+ if (Pflag) {
+ size = size_cp_times;
+ mysysctl("kern.cp_times", cur_cp_times, &size, NULL, 0);
+ if (size != size_cp_times)
+ xo_errx(1, "cp_times mismatch");
+ }
+
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+ last.snap_time = cur.snap_time;
+
+ /*
+ * Here what we want to do is refresh our device stats.
+ * getdevs() returns 1 when the device list has changed.
+ * If the device list has changed, we want to go through
+ * the selection process again, in case a device that we
+ * were previously displaying has gone away.
+ */
+ switch (devstat_getdevs(NULL, &cur)) {
+ case -1:
+ xo_errx(1, "%s", devstat_errbuf);
+ break;
+ case 1: {
+ int retval;
+
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+
+ retval = devstat_selectdevs(&dev_select, &num_selected,
+ &num_selections, &select_generation,
+ generation, cur.dinfo->devices,
+ num_devices, matches, num_matches,
+ specified_devices,
+ num_devices_specified, select_mode,
+ maxshowdevs, 0);
+ switch (retval) {
+ case -1:
+ xo_errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ printhdr(maxid, cpumask);
+ break;
+ default:
+ break;
+ }
+ }
+ default:
+ break;
+ }
+
+ fill_vmmeter(&sum);
+ fill_vmtotal(&total);
+ xo_open_container("processes");
+ xo_emit("{:runnable/%1d} {:waiting/%ld} "
+ "{:swapped-out/%ld}",
+ total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
+ xo_close_container("processes");
+ xo_open_container("memory");
+#define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10))
+#define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */
+ if (hflag) {
+ xo_emit("");
+ prthuman("available-memory",
+ total.t_avm * (u_int64_t)sum.v_page_size, 5);
+ xo_emit(" ");
+ prthuman("free-memory",
+ total.t_free * (u_int64_t)sum.v_page_size, 5);
+ xo_emit(" ");
+ } else {
+ xo_emit(" ");
+ xo_emit("{:available-memory/%7d}",
+ vmstat_pgtok(total.t_avm));
+ xo_emit(" ");
+ xo_emit("{:free-memory/%7d}",
+ vmstat_pgtok(total.t_free));
+ }
+ xo_emit("{:total-page-faults/%5lu} ",
+ (unsigned long)rate(sum.v_vm_faults -
+ osum.v_vm_faults));
+ xo_close_container("memory");
+
+ xo_open_container("paging-rates");
+ xo_emit("{:page-reactivated/%3lu} ",
+ (unsigned long)rate(sum.v_reactivated - osum.v_reactivated));
+ xo_emit("{:paged-in/%3lu} ",
+ (unsigned long)rate(sum.v_swapin + sum.v_vnodein -
+ (osum.v_swapin + osum.v_vnodein)));
+ xo_emit("{:paged-out/%3lu} ",
+ (unsigned long)rate(sum.v_swapout + sum.v_vnodeout -
+ (osum.v_swapout + osum.v_vnodeout)));
+ xo_emit("{:freed/%5lu} ",
+ (unsigned long)rate(sum.v_tfree - osum.v_tfree));
+ xo_emit("{:scanned/%4lu} ",
+ (unsigned long)rate(sum.v_pdpages - osum.v_pdpages));
+ xo_close_container("paging-rates");
+
+ devstats();
+ xo_open_container("fault-rates");
+ xo_emit("{:interrupts/%4lu} {:system-calls/%5lu} "
+ "{:context-switches/%5u}",
+ (unsigned long)rate(sum.v_intr - osum.v_intr),
+ (unsigned long)rate(sum.v_syscall - osum.v_syscall),
+ (unsigned long)rate(sum.v_swtch - osum.v_swtch));
+ xo_close_container("fault-rates");
+ if (Pflag)
+ pcpustats(ncpus, cpumask, maxid);
+ else
+ cpustats();
+ xo_emit("\n");
+ xo_flush();
+ if (reps >= 0 && --reps <= 0)
+ break;
+ osum = sum;
+ uptime = interval;
+ rate_adj = 1000;
+ /*
+ * We round upward to avoid losing low-frequency events
+ * (i.e., >= 1 per interval but < 1 per millisecond).
+ */
+ if (interval != 1)
+ halfuptime = (uptime + 1) / 2;
+ else
+ halfuptime = 0;
+ (void)usleep(interval * 1000);
+ }
+}
+
+static void
+printhdr(int maxid, u_long cpumask)
+{
+ int i, num_shown;
+
+ num_shown = MIN(num_selected, maxshowdevs);
+ if (hflag) {
+ xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, "");
+ } else {
+ xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, "");
+ }
+ if (num_shown > 1)
+ xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, "");
+ else if (num_shown == 1)
+ xo_emit(" {T:disks}");
+ xo_emit(" {T:faults} ");
+ if (Pflag) {
+ for (i = 0; i <= maxid; i++) {
+ if (cpumask & (1ul << i))
+ xo_emit(" {T:/cpu%d} ", i);
+ }
+ xo_emit("\n");
+ } else
+ xo_emit(" {T:cpu}\n");
+ if (hflag) {
+ xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re} {T:pi} {T:po} {T:fr} {T:sr} ");
+ } else {
+ xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re} {T:pi} {T:po} {T:fr} {T:sr} ");
+ }
+ for (i = 0; i < num_devices; i++)
+ if ((dev_select[i].selected)
+ && (dev_select[i].selected <= maxshowdevs))
+ xo_emit("{T:/%c%c%d} ", dev_select[i].device_name[0],
+ dev_select[i].device_name[1],
+ dev_select[i].unit_number);
+ xo_emit(" {T:in} {T:sy} {T:cs}");
+ if (Pflag) {
+ for (i = 0; i <= maxid; i++) {
+ if (cpumask & (1ul << i))
+ xo_emit(" {T:us} {T:sy} {T:id}");
+ }
+ xo_emit("\n");
+ } else
+ xo_emit(" {T:us} {T:sy} {T:id}\n");
+ if (wresized != 0)
+ doresize();
+ hdrcnt = winlines;
+}
+
+/*
+ * Force a header to be prepended to the next output.
+ */
+static void
+needhdr(int dummy __unused)
+{
+
+ hdrcnt = 1;
+}
+
+/*
+ * When the terminal is resized, force an update of the maximum number of rows
+ * printed between each header repetition. Then force a new header to be
+ * prepended to the next output.
+ */
+void
+needresize(int signo)
+{
+
+ wresized = 1;
+ hdrcnt = 1;
+}
+
+/*
+ * Update the global `winlines' count of terminal rows.
+ */
+void
+doresize(void)
+{
+ int status;
+ struct winsize w;
+
+ for (;;) {
+ status = ioctl(fileno(stdout), TIOCGWINSZ, &w);
+ if (status == -1 && errno == EINTR)
+ continue;
+ else if (status == -1)
+ xo_err(1, "ioctl");
+ if (w.ws_row > 3)
+ winlines = w.ws_row - 3;
+ else
+ winlines = VMSTAT_DEFAULT_LINES;
+ break;
+ }
+
+ /*
+ * Inhibit doresize() calls until we are rescheduled by SIGWINCH.
+ */
+ wresized = 0;
+}
+
+#ifdef notyet
+static void
+dotimes(void)
+{
+ unsigned int pgintime, rectime;
+
+ kread(X_REC, &rectime, sizeof(rectime));
+ kread(X_PGIN, &pgintime, sizeof(pgintime));
+ kread(X_SUM, &sum, sizeof(sum));
+ xo_emit("{:page-reclaims/%u} {N:reclaims}, "
+ "{:reclaim-time/%u} {N:total time (usec)}\n",
+ sum.v_pgrec, rectime);
+ xo_emit("{L:average}: {:reclaim-average/%u} {N:usec \\/ reclaim}\n",
+ rectime / sum.v_pgrec);
+ xo_emit("\n");
+ xo_emit("{:page-ins/%u} {N:page ins}, "
+ "{:page-in-time/%u} {N:total time (msec)}\n",
+ sum.v_pgin, pgintime / 10);
+ xo_emit("{L:average}: {:average/%8.1f} {N:msec \\/ page in}\n",
+ pgintime / (sum.v_pgin * 10.0));
+}
+#endif
+
+static long
+pct(long top, long bot)
+{
+ long ans;
+
+ if (bot == 0)
+ return(0);
+ ans = (quad_t)top * 100 / bot;
+ return (ans);
+}
+
+#define PCT(top, bot) pct((long)(top), (long)(bot))
+
+static void
+dosum(void)
+{
+ struct nchstats lnchstats;
+ long nchtotal;
+
+ fill_vmmeter(&sum);
+ xo_open_container("summary-statistics");
+ xo_emit("{:context-switches/%9u} {N:cpu context switches}\n",
+ sum.v_swtch);
+ xo_emit("{:interrupts/%9u} {N:device interrupts}\n",
+ sum.v_intr);
+ xo_emit("{:software-interrupts/%9u} {N:software interrupts}\n",
+ sum.v_soft);
+ xo_emit("{:traps/%9u} {N:traps}\n", sum.v_trap);
+ xo_emit("{:system-calls/%9u} {N:system calls}\n",
+ sum.v_syscall);
+ xo_emit("{:kernel-threads/%9u} {N:kernel threads created}\n",
+ sum.v_kthreads);
+ xo_emit("{:forks/%9u} {N: fork() calls}\n", sum.v_forks);
+ xo_emit("{:vforks/%9u} {N:vfork() calls}\n",
+ sum.v_vforks);
+ xo_emit("{:rforks/%9u} {N:rfork() calls}\n",
+ sum.v_rforks);
+ xo_emit("{:swap-ins/%9u} {N:swap pager pageins}\n",
+ sum.v_swapin);
+ xo_emit("{:swap-in-pages/%9u} {N:swap pager pages paged in}\n",
+ sum.v_swappgsin);
+ xo_emit("{:swap-outs/%9u} {N:swap pager pageouts}\n",
+ sum.v_swapout);
+ xo_emit("{:swap-out-pages/%9u} {N:swap pager pages paged out}\n",
+ sum.v_swappgsout);
+ xo_emit("{:vnode-page-ins/%9u} {N:vnode pager pageins}\n",
+ sum.v_vnodein);
+ xo_emit("{:vnode-page-in-pages/%9u} {N:vnode pager pages paged in}\n",
+ sum.v_vnodepgsin);
+ xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pageouts}\n",
+ sum.v_vnodeout);
+ xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pages paged out}\n",
+ sum.v_vnodepgsout);
+ xo_emit("{:page-daemon-wakeups/%9u} {N:page daemon wakeups}\n",
+ sum.v_pdwakeups);
+ xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page daemon}\n",
+ sum.v_pdpages);
+ xo_emit("{:reactivated/%9u} {N:pages reactivated}\n",
+ sum.v_reactivated);
+ xo_emit("{:copy-on-write-faults/%9u} {N:copy-on-write faults}\n",
+ sum.v_cow_faults);
+ xo_emit("{:copy-on-write-optimized-faults/%9u} {N:copy-on-write optimized faults}\n",
+ sum.v_cow_optim);
+ xo_emit("{:zero-fill-pages/%9u} {N:zero fill pages zeroed}\n",
+ sum.v_zfod);
+ xo_emit("{:zero-fill-prezeroed/%9u} {N:zero fill pages prezeroed}\n",
+ sum.v_ozfod);
+ xo_emit("{:intransit-blocking/%9u} {N:intransit blocking page faults}\n",
+ sum.v_intrans);
+ xo_emit("{:total-faults/%9u} {N:total VM faults taken}\n",
+ sum.v_vm_faults);
+ xo_emit("{:faults-requiring-io/%9u} {N:page faults requiring I\\/O}\n",
+ sum.v_io_faults);
+ xo_emit("{:faults-from-thread-creation/%9u} {N:pages affected by kernel thread creation}\n",
+ sum.v_kthreadpages);
+ xo_emit("{:faults-from-fork/%9u} {N:pages affected by fork}()\n",
+ sum.v_forkpages);
+ xo_emit("{:faults-from-vfork/%9u} {N:pages affected by vfork}()\n",
+ sum.v_vforkpages);
+ xo_emit("{:pages-rfork/%9u} {N:pages affected by rfork}()\n",
+ sum.v_rforkpages);
+ xo_emit("{:pages-total-cached/%9u} {N:pages cached}\n",
+ sum.v_tcached);
+ xo_emit("{:pages-freed/%9u} {N:pages freed}\n",
+ sum.v_tfree);
+ xo_emit("{:pages-freed-by-daemon/%9u} {N:pages freed by daemon}\n",
+ sum.v_dfree);
+ xo_emit("{:pages-freed-on-exit/%9u} {N:pages freed by exiting processes}\n",
+ sum.v_pfree);
+ xo_emit("{:active-pages/%9u} {N:pages active}\n",
+ sum.v_active_count);
+ xo_emit("{:inactive-pages/%9u} {N:pages inactive}\n",
+ sum.v_inactive_count);
+ xo_emit("{:vm-cache/%9u} {N:pages in VM cache}\n",
+ sum.v_cache_count);
+ xo_emit("{:wired-pages/%9u} {N:pages wired down}\n",
+ sum.v_wire_count);
+ xo_emit("{:free-pages/%9u} {N:pages free}\n",
+ sum.v_free_count);
+ xo_emit("{:bytes-per-page/%9u} {N:bytes per page}\n", sum.v_page_size);
+ if (kd != NULL) {
+ kread(X_NCHSTATS, &lnchstats, sizeof(lnchstats));
+ } else {
+ size_t size = sizeof(lnchstats);
+ mysysctl("vfs.cache.nchstats", &lnchstats, &size, NULL, 0);
+ if (size != sizeof(lnchstats))
+ xo_errx(1, "vfs.cache.nchstats size mismatch");
+ }
+ nchtotal = lnchstats.ncs_goodhits + lnchstats.ncs_neghits +
+ lnchstats.ncs_badhits + lnchstats.ncs_falsehits +
+ lnchstats.ncs_miss + lnchstats.ncs_long;
+ xo_emit("{:total-name-lookups/%9ld} {N:total name lookups}\n",
+ nchtotal);
+ xo_emit("{P:/%9s} {N:cache hits} "
+ "({:positive-cache-hits/%ld}% pos + "
+ "{:negative-cache-hits/%ld}% {N:neg}) "
+ "system {:cache-hit-percent/%ld}% per-directory\n",
+ "", PCT(lnchstats.ncs_goodhits, nchtotal),
+ PCT(lnchstats.ncs_neghits, nchtotal),
+ PCT(lnchstats.ncs_pass2, nchtotal));
+ xo_emit("{P:/%9s} {L:deletions} {:deletions/%ld}%, "
+ "{L:falsehits} {:false-hits/%ld}%, "
+ "{L:toolong} {:too-long/%ld}%\n", "",
+ PCT(lnchstats.ncs_badhits, nchtotal),
+ PCT(lnchstats.ncs_falsehits, nchtotal),
+ PCT(lnchstats.ncs_long, nchtotal));
+ xo_close_container("summary-statistics");
+}
+
+static void
+doforkst(void)
+{
+ fill_vmmeter(&sum);
+ xo_open_container("fork-statistics");
+ xo_emit("{:fork/%u} {N:forks}, {:fork-pages/%u} {N:pages}, "
+ "{L:average} {:fork-average/%.2f}\n",
+ sum.v_forks, sum.v_forkpages,
+ sum.v_forks == 0 ? 0.0 :
+ (double)sum.v_forkpages / sum.v_forks);
+ xo_emit("{:vfork/%u} {N:vforks}, {:vfork-pages/%u} {N:pages}, "
+ "{L:average} {:vfork-average/%.2f}\n",
+ sum.v_vforks, sum.v_vforkpages,
+ sum.v_vforks == 0 ? 0.0 :
+ (double)sum.v_vforkpages / sum.v_vforks);
+ xo_emit("{:rfork/%u} {N:rforks}, {:rfork-pages/%u} {N:pages}, "
+ "{L:average} {:rfork-average/%.2f}\n",
+ sum.v_rforks, sum.v_rforkpages,
+ sum.v_rforks == 0 ? 0.0 :
+ (double)sum.v_rforkpages / sum.v_rforks);
+ xo_close_container("fork-statistics");
+}
+
+static void
+devstats(void)
+{
+ int dn, state;
+ long double transfers_per_second;
+ long double busy_seconds;
+ long tmp;
+
+ for (state = 0; state < CPUSTATES; ++state) {
+ tmp = cur.cp_time[state];
+ cur.cp_time[state] -= last.cp_time[state];
+ last.cp_time[state] = tmp;
+ }
+
+ busy_seconds = cur.snap_time - last.snap_time;
+
+ xo_open_list("device");
+ for (dn = 0; dn < num_devices; dn++) {
+ int di;
+
+ if ((dev_select[dn].selected == 0)
+ || (dev_select[dn].selected > maxshowdevs))
+ continue;
+
+ di = dev_select[dn].position;
+
+ if (devstat_compute_statistics(&cur.dinfo->devices[di],
+ &last.dinfo->devices[di], busy_seconds,
+ DSM_TRANSFERS_PER_SECOND, &transfers_per_second,
+ DSM_NONE) != 0)
+ xo_errx(1, "%s", devstat_errbuf);
+
+ xo_open_instance("device");
+ xo_emit("{ekq:name/%c%c%d}{:transfers/%3.0Lf} ",
+ dev_select[dn].device_name[0],
+ dev_select[dn].device_name[1],
+ dev_select[dn].unit_number,
+ transfers_per_second);
+ xo_close_instance("device");
+ }
+ xo_close_list("device");
+}
+
+static void
+percent(const char *name, double pct, int *over)
+{
+ char buf[10];
+ char fmt[128];
+ int l;
+
+ snprintf(fmt, sizeof(fmt), " {:%s/%%*s}", name);
+ l = snprintf(buf, sizeof(buf), "%.0f", pct);
+ if (l == 1 && *over) {
+ xo_emit(fmt, 1, buf);
+ (*over)--;
+ } else
+ xo_emit(fmt, 2, buf);
+ if (l > 2)
+ (*over)++;
+}
+
+static void
+cpustats(void)
+{
+ int state, over;
+ double lpct, total;
+
+ total = 0;
+ for (state = 0; state < CPUSTATES; ++state)
+ total += cur.cp_time[state];
+ if (total)
+ lpct = 100.0 / total;
+ else
+ lpct = 0.0;
+ over = 0;
+ xo_open_container("cpu-statistics");
+ percent("user", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * lpct, &over);
+ percent("system", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * lpct, &over);
+ percent("idle", cur.cp_time[CP_IDLE] * lpct, &over);
+ xo_close_container("cpu-statistics");
+}
+
+static void
+pcpustats(int ncpus, u_long cpumask, int maxid)
+{
+ int state, i;
+ double lpct, total;
+ long tmp;
+ int over;
+
+ /* devstats does this for cp_time */
+ for (i = 0; i <= maxid; i++) {
+ if ((cpumask & (1ul << i)) == 0)
+ continue;
+ for (state = 0; state < CPUSTATES; ++state) {
+ tmp = cur_cp_times[i * CPUSTATES + state];
+ cur_cp_times[i * CPUSTATES + state] -= last_cp_times[i *
+ CPUSTATES + state];
+ last_cp_times[i * CPUSTATES + state] = tmp;
+ }
+ }
+
+ over = 0;
+ xo_open_list("cpu");
+ for (i = 0; i <= maxid; i++) {
+ if ((cpumask & (1ul << i)) == 0)
+ continue;
+ xo_open_instance("cpu");
+ xo_emit("{ke:name/%d}", i);
+ total = 0;
+ for (state = 0; state < CPUSTATES; ++state)
+ total += cur_cp_times[i * CPUSTATES + state];
+ if (total)
+ lpct = 100.0 / total;
+ else
+ lpct = 0.0;
+ percent("user", (cur_cp_times[i * CPUSTATES + CP_USER] +
+ cur_cp_times[i * CPUSTATES + CP_NICE]) * lpct, &over);
+ percent("system", (cur_cp_times[i * CPUSTATES + CP_SYS] +
+ cur_cp_times[i * CPUSTATES + CP_INTR]) * lpct, &over);
+ percent("idle", cur_cp_times[i * CPUSTATES + CP_IDLE] * lpct,
+ &over);
+ xo_close_instance("cpu");
+ }
+ xo_close_list("cpu");
+}
+
+static unsigned int
+read_intrcnts(unsigned long **intrcnts)
+{
+ size_t intrcntlen;
+
+ if (kd != NULL) {
+ kread(X_SINTRCNT, &intrcntlen, sizeof(intrcntlen));
+ if ((*intrcnts = malloc(intrcntlen)) == NULL)
+ err(1, "malloc()");
+ kread(X_INTRCNT, *intrcnts, intrcntlen);
+ } else {
+ for (*intrcnts = NULL, intrcntlen = 1024; ; intrcntlen *= 2) {
+ *intrcnts = reallocf(*intrcnts, intrcntlen);
+ if (*intrcnts == NULL)
+ err(1, "reallocf()");
+ if (mysysctl("hw.intrcnt",
+ *intrcnts, &intrcntlen, NULL, 0) == 0)
+ break;
+ }
+ }
+
+ return (intrcntlen / sizeof(unsigned long));
+}
+
+static void
+print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts,
+ char *intrnames, unsigned int nintr,
+ size_t istrnamlen, long long period_ms)
+{
+ unsigned long *intrcnt, *old_intrcnt;
+ uint64_t inttotal, old_inttotal, total_count, total_rate;
+ char* intrname;
+ unsigned int i;
+
+ inttotal = 0;
+ old_inttotal = 0;
+ intrname = intrnames;
+ xo_open_list("interrupt");
+ for (i = 0, intrcnt=intrcnts, old_intrcnt=old_intrcnts; i < nintr; i++) {
+ if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) {
+ unsigned long count, rate;
+
+ count = *intrcnt - *old_intrcnt;
+ rate = (count * 1000 + period_ms / 2) / period_ms;
+ xo_open_instance("interrupt");
+ xo_emit("{d:name/%-*s}{ket:name/%s} "
+ "{:total/%20lu} {:rate/%10lu}\n",
+ (int)istrnamlen, intrname,
+ intrname, count, rate);
+ xo_close_instance("interrupt");
+ }
+ intrname += strlen(intrname) + 1;
+ inttotal += *intrcnt++;
+ old_inttotal += *old_intrcnt++;
+ }
+ total_count = inttotal - old_inttotal;
+ total_rate = (total_count * 1000 + period_ms / 2) / period_ms;
+ xo_close_list("interrupt");
+ xo_emit("{L:/%-*s} {:total-interrupts/%20" PRIu64 "} "
+ "{:total-rate/%10" PRIu64 "}\n", (int)istrnamlen,
+ "Total", total_count, total_rate);
+}
+
+static void
+dointr(unsigned int interval, int reps)
+{
+ unsigned long *intrcnts;
+ long long uptime, period_ms;
+ unsigned long *old_intrcnts = NULL;
+ size_t clen, inamlen, istrnamlen;
+ char *intrnames, *intrname;
+
+ uptime = getuptime();
+
+ /* Get the names of each interrupt source */
+ if (kd != NULL) {
+ kread(X_SINTRNAMES, &inamlen, sizeof(inamlen));
+ if ((intrnames = malloc(inamlen)) == NULL)
+ xo_err(1, "malloc()");
+ kread(X_INTRNAMES, intrnames, inamlen);
+ } else {
+ for (intrnames = NULL, inamlen = 1024; ; inamlen *= 2) {
+ if ((intrnames = reallocf(intrnames, inamlen)) == NULL)
+ xo_err(1, "reallocf()");
+ if (mysysctl("hw.intrnames",
+ intrnames, &inamlen, NULL, 0) == 0)
+ break;
+ }
+ }
+
+ /* Determine the length of the longest interrupt name */
+ intrname = intrnames;
+ istrnamlen = strlen("interrupt");
+ while(*intrname != '\0') {
+ clen = strlen(intrname);
+ if (clen > istrnamlen)
+ istrnamlen = clen;
+ intrname += strlen(intrname) + 1;
+ }
+ xo_emit("{T:/%-*s} {T:/%20s} {T:/%10s}\n",
+ (int)istrnamlen, "interrupt", "total", "rate");
+
+ /*
+ * Loop reps times printing differential interrupt counts. If reps is
+ * zero, then run just once, printing total counts
+ */
+ xo_open_container("interrupt-statistics");
+
+ period_ms = uptime / 1000000;
+ while(1) {
+ unsigned int nintr;
+ long long old_uptime;
+
+ nintr = read_intrcnts(&intrcnts);
+ /*
+ * Initialize old_intrcnts to 0 for the first pass, so
+ * print_intrcnts will print total interrupts since boot
+ */
+ if (old_intrcnts == NULL) {
+ old_intrcnts = calloc(nintr, sizeof(unsigned long));
+ if (old_intrcnts == NULL)
+ xo_err(1, "calloc()");
+ }
+
+ print_intrcnts(intrcnts, old_intrcnts, intrnames, nintr,
+ istrnamlen, period_ms);
+ xo_flush();
+
+ free(old_intrcnts);
+ old_intrcnts = intrcnts;
+ if (reps >= 0 && --reps <= 0)
+ break;
+ usleep(interval * 1000);
+ old_uptime = uptime;
+ uptime = getuptime();
+ period_ms = (uptime - old_uptime) / 1000000;
+ }
+
+ xo_close_container("interrupt-statistics");
+}
+
+static void
+domemstat_malloc(void)
+{
+ struct memory_type_list *mtlp;
+ struct memory_type *mtp;
+ int error, first, i;
+
+ mtlp = memstat_mtl_alloc();
+ if (mtlp == NULL) {
+ xo_warn("memstat_mtl_alloc");
+ return;
+ }
+ if (kd == NULL) {
+ if (memstat_sysctl_malloc(mtlp, 0) < 0) {
+ xo_warnx("memstat_sysctl_malloc: %s",
+ memstat_strerror(memstat_mtl_geterror(mtlp)));
+ return;
+ }
+ } else {
+ if (memstat_kvm_malloc(mtlp, kd) < 0) {
+ error = memstat_mtl_geterror(mtlp);
+ if (error == MEMSTAT_ERROR_KVM)
+ xo_warnx("memstat_kvm_malloc: %s",
+ kvm_geterr(kd));
+ else
+ xo_warnx("memstat_kvm_malloc: %s",
+ memstat_strerror(error));
+ }
+ }
+ xo_open_container("malloc-statistics");
+ xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n",
+ "Type", "InUse", "MemUse", "HighUse", "Requests");
+ xo_open_list("memory");
+ for (mtp = memstat_mtl_first(mtlp); mtp != NULL;
+ mtp = memstat_mtl_next(mtp)) {
+ if (memstat_get_numallocs(mtp) == 0 &&
+ memstat_get_count(mtp) == 0)
+ continue;
+ xo_open_instance("memory");
+ xo_emit("{k:type/%13s/%s} {:in-use/%5" PRIu64 "} "
+ "{:memory-use/%5" PRIu64 "}{U:K} {:high-use/%7s} "
+ "{:requests/%8" PRIu64 "} ",
+ memstat_get_name(mtp), memstat_get_count(mtp),
+ (memstat_get_bytes(mtp) + 1023) / 1024, "-",
+ memstat_get_numallocs(mtp));
+ first = 1;
+ xo_open_list("size");
+ for (i = 0; i < 32; i++) {
+ if (memstat_get_sizemask(mtp) & (1 << i)) {
+ if (!first)
+ xo_emit(",");
+ xo_emit("{l:size/%d}", 1 << (i + 4));
+ first = 0;
+ }
+ }
+ xo_close_list("size");
+ xo_close_instance("memory");
+ xo_emit("\n");
+ }
+ xo_close_list("memory");
+ xo_close_container("malloc-statistics");
+ memstat_mtl_free(mtlp);
+}
+
+static void
+domemstat_zone(void)
+{
+ struct memory_type_list *mtlp;
+ struct memory_type *mtp;
+ char name[MEMTYPE_MAXNAME + 1];
+ int error;
+
+ mtlp = memstat_mtl_alloc();
+ if (mtlp == NULL) {
+ xo_warn("memstat_mtl_alloc");
+ return;
+ }
+ if (kd == NULL) {
+ if (memstat_sysctl_uma(mtlp, 0) < 0) {
+ xo_warnx("memstat_sysctl_uma: %s",
+ memstat_strerror(memstat_mtl_geterror(mtlp)));
+ return;
+ }
+ } else {
+ if (memstat_kvm_uma(mtlp, kd) < 0) {
+ error = memstat_mtl_geterror(mtlp);
+ if (error == MEMSTAT_ERROR_KVM)
+ xo_warnx("memstat_kvm_uma: %s",
+ kvm_geterr(kd));
+ else
+ xo_warnx("memstat_kvm_uma: %s",
+ memstat_strerror(error));
+ }
+ }
+ xo_open_container("memory-zone-statistics");
+ xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} "
+ "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE",
+ "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP");
+ xo_open_list("zone");
+ for (mtp = memstat_mtl_first(mtlp); mtp != NULL;
+ mtp = memstat_mtl_next(mtp)) {
+ strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME);
+ strcat(name, ":");
+ xo_open_instance("zone");
+ xo_emit("{d:name/%-20s}{ke:name/%s} {:size/%6" PRIu64 "}, "
+ "{:limit/%6" PRIu64 "},{:used/%8" PRIu64 "},"
+ "{:free/%8" PRIu64 "},{:requests/%8" PRIu64 "},"
+ "{:fail/%4" PRIu64 "},{:sleep/%4" PRIu64 "}\n", name,
+ memstat_get_name(mtp),
+ memstat_get_size(mtp), memstat_get_countlimit(mtp),
+ memstat_get_count(mtp), memstat_get_free(mtp),
+ memstat_get_numallocs(mtp), memstat_get_failures(mtp),
+ memstat_get_sleeps(mtp));
+ xo_close_instance("zone");
+ }
+ memstat_mtl_free(mtlp);
+ xo_close_list("zone");
+ xo_close_container("memory-zone-statistics");
+ xo_emit("\n");
+}
+
+static void
+display_object(struct kinfo_vmobject *kvo)
+{
+ const char *str;
+
+ xo_open_instance("object");
+ xo_emit("{:resident/%5jd} ", (uintmax_t)kvo->kvo_resident);
+ xo_emit("{:active/%5jd} ", (uintmax_t)kvo->kvo_active);
+ xo_emit("{:inactive/%5jd} ", (uintmax_t)kvo->kvo_inactive);
+ xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count);
+ xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count);
+ switch (kvo->kvo_memattr) {
+#ifdef VM_MEMATTR_UNCACHEABLE
+ case VM_MEMATTR_UNCACHEABLE:
+ str = "UC";
+ break;
+#endif
+#ifdef VM_MEMATTR_WRITE_COMBINING
+ case VM_MEMATTR_WRITE_COMBINING:
+ str = "WC";
+ break;
+#endif
+#ifdef VM_MEMATTR_WRITE_THROUGH
+ case VM_MEMATTR_WRITE_THROUGH:
+ str = "WT";
+ break;
+#endif
+#ifdef VM_MEMATTR_WRITE_PROTECTED
+ case VM_MEMATTR_WRITE_PROTECTED:
+ str = "WP";
+ break;
+#endif
+#ifdef VM_MEMATTR_WRITE_BACK
+ case VM_MEMATTR_WRITE_BACK:
+ str = "WB";
+ break;
+#endif
+#ifdef VM_MEMATTR_WEAK_UNCACHEABLE
+ case VM_MEMATTR_WEAK_UNCACHEABLE:
+ str = "UC-";
+ break;
+#endif
+#ifdef VM_MEMATTR_WB_WA
+ case VM_MEMATTR_WB_WA:
+ str = "WB";
+ break;
+#endif
+#ifdef VM_MEMATTR_NOCACHE
+ case VM_MEMATTR_NOCACHE:
+ str = "NC";
+ break;
+#endif
+#ifdef VM_MEMATTR_DEVICE
+ case VM_MEMATTR_DEVICE:
+ str = "DEV";
+ break;
+#endif
+#ifdef VM_MEMATTR_CACHEABLE
+ case VM_MEMATTR_CACHEABLE:
+ str = "C";
+ break;
+#endif
+#ifdef VM_MEMATTR_PREFETCHABLE
+ case VM_MEMATTR_PREFETCHABLE:
+ str = "PRE";
+ break;
+#endif
+ default:
+ str = "??";
+ break;
+ }
+ xo_emit("{:attribute/%-3s} ", str);
+ switch (kvo->kvo_type) {
+ case KVME_TYPE_NONE:
+ str = "--";
+ break;
+ case KVME_TYPE_DEFAULT:
+ str = "df";
+ break;
+ case KVME_TYPE_VNODE:
+ str = "vn";
+ break;
+ case KVME_TYPE_SWAP:
+ str = "sw";
+ break;
+ case KVME_TYPE_DEVICE:
+ str = "dv";
+ break;
+ case KVME_TYPE_PHYS:
+ str = "ph";
+ break;
+ case KVME_TYPE_DEAD:
+ str = "dd";
+ break;
+ case KVME_TYPE_SG:
+ str = "sg";
+ break;
+ case KVME_TYPE_UNKNOWN:
+ default:
+ str = "??";
+ break;
+ }
+ xo_emit("{:type/%-2s} ", str);
+ xo_emit("{:path/%-s}\n", kvo->kvo_path);
+ xo_close_instance("object");
+}
+
+static void
+doobjstat(void)
+{
+ struct kinfo_vmobject *kvo;
+ int cnt, i;
+
+ kvo = kinfo_getvmobject(&cnt);
+ if (kvo == NULL) {
+ xo_warn("Failed to fetch VM object list");
+ return;
+ }
+ xo_emit("{T:RES/%5s} {T:ACT/%5s} {T:INACT/%5s} {T:REF/%3s} {T:SHD/%3s} "
+ "{T:CM/%3s} {T:TP/%2s} {T:PATH/%s}\n");
+ xo_open_list("object");
+ for (i = 0; i < cnt; i++)
+ display_object(&kvo[i]);
+ free(kvo);
+ xo_close_list("object");
+}
+
+/*
+ * kread reads something from the kernel, given its nlist index.
+ */
+static void
+kreado(int nlx, void *addr, size_t size, size_t offset)
+{
+ const char *sym;
+
+ if (namelist[nlx].n_type == 0 || namelist[nlx].n_value == 0) {
+ sym = namelist[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ xo_errx(1, "symbol %s not defined", sym);
+ }
+ if ((size_t)kvm_read(kd, namelist[nlx].n_value + offset, addr,
+ size) != size) {
+ sym = namelist[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ xo_errx(1, "%s: %s", sym, kvm_geterr(kd));
+ }
+}
+
+static void
+kread(int nlx, void *addr, size_t size)
+{
+ kreado(nlx, addr, size, 0);
+}
+
+static char *
+kgetstr(const char *strp)
+{
+ int n = 0, size = 1;
+ char *ret = NULL;
+
+ do {
+ if (size == n + 1) {
+ ret = realloc(ret, size);
+ if (ret == NULL)
+ xo_err(1, "%s: realloc", __func__);
+ size *= 2;
+ }
+ if (kvm_read(kd, (u_long)strp + n, &ret[n], 1) != 1)
+ xo_errx(1, "%s: %s", __func__, kvm_geterr(kd));
+ } while (ret[n++] != '\0');
+ return (ret);
+}
+
+static void
+usage(void)
+{
+ xo_error("%s%s",
+ "usage: vmstat [-afHhimoPsz] [-M core [-N system]] [-c count] [-n devs]\n",
+ " [-p type,if,pass] [-w wait] [disks] [wait [count]]\n");
+ xo_finish();
+ exit(1);
+}
diff --git a/usr.bin/vtfontcvt/Makefile b/usr.bin/vtfontcvt/Makefile
new file mode 100644
index 0000000..cfb271b
--- /dev/null
+++ b/usr.bin/vtfontcvt/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+PROG= vtfontcvt
+MAN8= vtfontcvt.8
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vtfontcvt/Makefile.depend b/usr.bin/vtfontcvt/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/vtfontcvt/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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..ffe43b5
--- /dev/null
+++ b/usr.bin/vtfontcvt/vtfontcvt.c
@@ -0,0 +1,594 @@
+/*-
+ * 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 void *
+xmalloc(size_t size)
+{
+ void *m;
+
+ if ((m = malloc(size)) == NULL)
+ errx(1, "memory allocation failure");
+ return (m);
+}
+
+static int
+add_mapping(struct glyph *gl, unsigned int c, unsigned int map_idx)
+{
+ struct mapping *mp;
+ struct mapping_list *ml;
+
+ mapping_total++;
+
+ mp = xmalloc(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 = xmalloc(sizeof *gl);
+ gl->g_data = xmalloc(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 = NULL, *bytes_r = NULL;
+ unsigned curchar = 0, i, line, chars_per_row, dwidth;
+ int rv = 0;
+
+ while ((ln = fgetln(fp, &length)) != NULL) {
+ ln[length - 1] = '\0';
+
+ if (strncmp(ln, "# Height: ", 10) == 0) {
+ if (bytes != NULL)
+ errx(1, "malformed input: Height tag after font data");
+ height = atoi(ln + 10);
+ } else if (strncmp(ln, "# Width: ", 9) == 0) {
+ if (bytes != NULL)
+ errx(1, "malformed input: Width tag after font data");
+ set_width(atoi(ln + 9));
+ } else if (sscanf(ln, "%6x:", &curchar)) {
+ if (bytes == NULL) {
+ bytes = xmalloc(wbytes * height);
+ bytes_r = xmalloc(wbytes * height);
+ }
+ /* ln is guaranteed to have a colon here. */
+ p = strchr(ln, ':') + 1;
+ 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) {
+ rv = 1;
+ goto out;
+ }
+ }
+
+ if (add_char(curchar, map_idx, bytes,
+ dwidth == width * 2 ? bytes_r : NULL) != 0) {
+ rv = 1;
+ goto out;
+ }
+ }
+ }
+out:
+ free(bytes);
+ free(bytes_r);
+ return (rv);
+}
+
+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: %6u\n"
+"- glyph_normal: %6u\n"
+"- glyph_normal_right: %6u\n"
+"- glyph_bold: %6u\n"
+"- glyph_bold_right: %6u\n"
+"- glyph_unique: %6u\n"
+"- glyph_dupe: %6u\n"
+"- mapping_total: %6u\n"
+"- mapping_normal: %6u\n"
+"- mapping_normal_folded: %6u\n"
+"- mapping_normal_right: %6u\n"
+"- mapping_normal_right_folded: %6u\n"
+"- mapping_bold: %6u\n"
+"- mapping_bold_folded: %6u\n"
+"- mapping_bold_right: %6u\n"
+"- mapping_bold_right_folded: %6u\n"
+"- mapping_unique: %6u\n"
+"- mapping_dupe: %6u\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/w/Makefile b/usr.bin/w/Makefile
new file mode 100644
index 0000000..c14f84a
--- /dev/null
+++ b/usr.bin/w/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= w
+SRCS= fmt.c pr_time.c proc_compare.c w.c
+MAN= w.1 uptime.1
+LIBADD= kvm sbuf xo util
+LINKS= ${BINDIR}/w ${BINDIR}/uptime
+
+.PATH: ${.CURDIR}/../../bin/ps
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/w/Makefile.depend b/usr.bin/w/Makefile.depend
new file mode 100644
index 0000000..fd7546e
--- /dev/null
+++ b/usr.bin/w/Makefile.depend
@@ -0,0 +1,24 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libelf \
+ lib/libkvm \
+ lib/libsbuf \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/w/extern.h b/usr.bin/w/extern.h
new file mode 100644
index 0000000..facc3e8
--- /dev/null
+++ b/usr.bin/w/extern.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 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.
+ *
+ * @(#)extern.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
+ */
+
+extern int use_ampm;
+
+struct kinfo_proc;
+int pr_attime(time_t *, time_t *);
+int pr_idle(time_t);
+int proc_compare(struct kinfo_proc *, struct kinfo_proc *);
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c
new file mode 100644
index 0000000..123f6c4
--- /dev/null
+++ b/usr.bin/w/pr_time.c
@@ -0,0 +1,130 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94";
+#endif
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <libxo/xo.h>
+
+#include "extern.h"
+
+/*
+ * pr_attime --
+ * Print the time since the user logged in.
+ */
+int
+pr_attime(time_t *started, time_t *now)
+{
+ static wchar_t buf[256];
+ struct tm tp, tm;
+ time_t diff;
+ const wchar_t *fmt;
+ int len, width, offset = 0;
+
+ tp = *localtime(started);
+ tm = *localtime(now);
+ diff = *now - *started;
+
+ /* If more than a week, use day-month-year. */
+ if (diff > 86400 * 7)
+ fmt = L"%d%b%y";
+
+ /* If not today, use day-hour-am/pm. */
+ else if (tm.tm_mday != tp.tm_mday ||
+ tm.tm_mon != tp.tm_mon ||
+ tm.tm_year != tp.tm_year) {
+ /* The line below does not take DST into consideration */
+ /* else if (*now / 86400 != *started / 86400) { */
+ fmt = use_ampm ? L"%a%I%p" : L"%a%H";
+ }
+
+ /* Default is hh:mm{am,pm}. */
+ else {
+ fmt = use_ampm ? L"%l:%M%p" : L"%k:%M";
+ }
+
+ (void)wcsftime(buf, sizeof(buf), fmt, &tp);
+ len = wcslen(buf);
+ width = wcswidth(buf, len);
+ xo_attr("since", "%lu", (unsigned long) *started);
+ xo_attr("delta", "%lu", (unsigned long) diff);
+ if (len == width)
+ xo_emit("{:login-time/%-7.7ls/%ls}", buf);
+ else if (width < 7)
+ xo_emit("{:login-time/%ls}%.*s", buf, 7 - width, " ");
+ else {
+ xo_emit("{:login-time/%ls}", buf);
+ offset = width - 7;
+ }
+ return (offset);
+}
+
+/*
+ * pr_idle --
+ * Display the idle time.
+ * Returns number of excess characters that were used for long idle time.
+ */
+int
+pr_idle(time_t idle)
+{
+ /* If idle more than 36 hours, print as a number of days. */
+ if (idle >= 36 * 3600) {
+ int days = idle / 86400;
+ xo_emit(" {:idle/%dday%s} ", days, days > 1 ? "s" : " " );
+ if (days >= 100)
+ return (2);
+ if (days >= 10)
+ return (1);
+ }
+
+ /* If idle more than an hour, print as HH:MM. */
+ else if (idle >= 3600)
+ xo_emit(" {:idle/%2d:%02d/} ",
+ (int)(idle / 3600), (int)((idle % 3600) / 60));
+
+ else if (idle / 60 == 0)
+ xo_emit(" - ");
+
+ /* Else print the minutes idle. */
+ else
+ xo_emit(" {:idle/%2d} ", (int)(idle / 60));
+
+ return (0); /* not idle longer than 9 days */
+}
diff --git a/usr.bin/w/proc_compare.c b/usr.bin/w/proc_compare.c
new file mode 100644
index 0000000..0e73ba4
--- /dev/null
+++ b/usr.bin/w/proc_compare.c
@@ -0,0 +1,121 @@
+/*-
+ * Copyright (c) 1990, 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.
+ */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)proc_compare.c 8.2 (Berkeley) 9/23/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/time.h>
+#include <sys/user.h>
+
+#include "extern.h"
+
+/*
+ * Returns 1 if p2 is "better" than p1
+ *
+ * The algorithm for picking the "interesting" process is thus:
+ *
+ * 1) Only foreground processes are eligible - implied.
+ * 2) Runnable processes are favored over anything else. The runner
+ * with the highest cpu utilization is picked (p_estcpu). Ties are
+ * broken by picking the highest pid.
+ * 3) The sleeper with the shortest sleep time is next. With ties,
+ * we pick out just "short-term" sleepers (TDF_SINTR == 0).
+ * 4) Further ties are broken by picking the highest pid.
+ *
+ * If you change this, be sure to consider making the change in the kernel
+ * too (^T in kern/tty.c).
+ *
+ * TODO - consider whether pctcpu should be used.
+ */
+
+#define ISRUN(p) (((p)->ki_stat == SRUN) || ((p)->ki_stat == SIDL))
+#define TESTAB(a, b) ((a)<<1 | (b))
+#define ONLYA 2
+#define ONLYB 1
+#define BOTH 3
+
+int
+proc_compare(struct kinfo_proc *p1, struct kinfo_proc *p2)
+{
+
+ if (p1 == NULL)
+ return (1);
+ /*
+ * see if at least one of them is runnable
+ */
+ switch (TESTAB(ISRUN(p1), ISRUN(p2))) {
+ case ONLYA:
+ return (0);
+ case ONLYB:
+ return (1);
+ case BOTH:
+ /*
+ * tie - favor one with highest recent cpu utilization
+ */
+ if (p2->ki_estcpu > p1->ki_estcpu)
+ return (1);
+ if (p1->ki_estcpu > p2->ki_estcpu)
+ return (0);
+ return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */
+ }
+ /*
+ * weed out zombies
+ */
+ switch (TESTAB(p1->ki_stat == SZOMB, p2->ki_stat == SZOMB)) {
+ case ONLYA:
+ return (1);
+ case ONLYB:
+ return (0);
+ case BOTH:
+ return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */
+ }
+ /*
+ * pick the one with the smallest sleep time
+ */
+ if (p2->ki_slptime > p1->ki_slptime)
+ return (0);
+ if (p1->ki_slptime > p2->ki_slptime)
+ return (1);
+ /*
+ * favor one sleeping in a non-interruptible sleep
+ */
+ if (p1->ki_tdflags & TDF_SINTR && (p2->ki_tdflags & TDF_SINTR) == 0)
+ return (1);
+ if (p2->ki_tdflags & TDF_SINTR && (p1->ki_tdflags & TDF_SINTR) == 0)
+ return (0);
+ return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */
+}
diff --git a/usr.bin/w/uptime.1 b/usr.bin/w/uptime.1
new file mode 100644
index 0000000..693416d
--- /dev/null
+++ b/usr.bin/w/uptime.1
@@ -0,0 +1,57 @@
+.\" Copyright (c) 1980, 1990, 1993, 1994
+.\" 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.
+.\"
+.\" @(#)uptime.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD$
+.\"
+.Dd April 18, 1994
+.Dt UPTIME 1
+.Os
+.Sh NAME
+.Nm uptime
+.Nd show how long system has been running
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the current time,
+the length of time the system has been up,
+the number of users, and the load average of the system over the last
+1, 5, and 15 minutes.
+.Sh FILES
+.Bl -tag -width /boot/kernel/kernel
+.It Pa /boot/kernel/kernel
+system name list
+.El
+.Sh SEE ALSO
+.Xr w 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/w/w.1 b/usr.bin/w/w.1
new file mode 100644
index 0000000..a8c30be
--- /dev/null
+++ b/usr.bin/w/w.1
@@ -0,0 +1,154 @@
+.\" Copyright (c) 1980, 1990, 1991, 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.
+.\"
+.\" @(#)w.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2015
+.Dt W 1
+.Os
+.Sh NAME
+.Nm w
+.Nd "display who is logged in and what they are doing"
+.Sh SYNOPSIS
+.Nm
+.Op Fl -libxo
+.Op Fl dhin
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Ar user ...
+.Sh DESCRIPTION
+The
+.Nm
+utility prints a summary of the current activity on the system,
+including what each user is doing.
+The first line displays the current time of day, how long the system has
+been running, the number of users logged into the system, and the load
+averages.
+The load average numbers give the number of jobs in the run queue averaged
+over 1, 5 and 15 minutes.
+.Pp
+The fields output are the user's login name, the name of the terminal the
+user is on, the host from which the user is logged in, the time the user
+logged on, the time since the user last typed anything,
+and the name and arguments of the current process.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.It Fl d
+dumps out the entire process list on a per controlling
+tty basis, instead of just the top level process.
+.It Fl h
+Suppress the heading.
+.It Fl i
+Output is sorted by idle time.
+.It Fl M
+Extract values associated with the name list from the specified
+core instead of the default
+.Pa /dev/kmem .
+.It Fl N
+Extract the name list from the specified system instead of the
+default
+.Pa /boot/kernel/kernel .
+.It Fl n
+Do not attempt to resolve network addresses (normally
+.Nm
+interprets addresses and attempts to display them as names).
+.El
+.Pp
+If one or more
+.Ar user
+names are specified, the output is restricted to those users.
+.Sh FILES
+.Bl -tag -width ".Pa /var/run/utx.active" -compact
+.It Pa /var/run/utx.active
+list of users on the system
+.El
+.Sh COMPATIBILITY
+The
+.Fl f ,
+.Fl l ,
+.Fl s ,
+and
+.Fl w
+flags are no longer supported.
+.Sh SEE ALSO
+.Xr finger 1 ,
+.Xr ps 1 ,
+.Xr uptime 1 ,
+.Xr who 1 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Sh BUGS
+The notion of the
+.Dq current process
+is muddy.
+The current algorithm is
+.Do
+the highest numbered process on the terminal
+that is not ignoring interrupts, or, if there is none, the highest numbered
+process on the terminal
+.Dc .
+This fails, for example, in critical sections of programs like the shell
+and editor, or when faulty programs running in the background fork and fail
+to ignore interrupts.
+(In cases where no process can be found,
+.Nm
+prints
+.Ql \- . )
+.Pp
+The
+.Tn CPU
+time is only an estimate, in particular, if someone leaves a background
+process running after logging out, the person currently on that terminal is
+.Dq charged
+with the time.
+.Pp
+Background processes are not shown, even though they account for
+much of the load on the system.
+.Pp
+Sometimes processes, typically those in the background, are printed with
+null or garbaged arguments.
+In these cases, the name of the command is printed in parentheses.
+.Pp
+The
+.Nm
+utility does not know about the new conventions for detection of background
+jobs.
+It will sometimes find a background job instead of the right one.
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
new file mode 100644
index 0000000..0c955ac
--- /dev/null
+++ b/usr.bin/w/w.c
@@ -0,0 +1,559 @@
+/*-
+ * Copyright (c) 1980, 1991, 1993, 1994
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
+#endif
+
+/*
+ * w - print system status (who and what)
+ *
+ * This program is similar to the systat command on Tenex/Tops 10/20
+ *
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/ioctl.h>
+#include <sys/sbuf.h>
+#include <sys/socket.h>
+#include <sys/tty.h>
+#include <sys/types.h>
+
+#include <machine/cpu.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <kvm.h>
+#include <langinfo.h>
+#include <libgen.h>
+#include <libutil.h>
+#include <limits.h>
+#include <locale.h>
+#include <netdb.h>
+#include <nlist.h>
+#include <paths.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <timeconv.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <vis.h>
+#include <libxo/xo.h>
+
+#include "extern.h"
+
+static struct utmpx *utmp;
+static struct winsize ws;
+static kvm_t *kd;
+static time_t now; /* the current time of day */
+static int ttywidth; /* width of tty */
+static int argwidth; /* width of tty */
+static int header = 1; /* true if -h flag: don't print heading */
+static int nflag; /* true if -n flag: don't convert addrs */
+static int dflag; /* true if -d flag: output debug info */
+static int sortidle; /* sort by idle time */
+int use_ampm; /* use AM/PM time */
+static int use_comma; /* use comma as floats separator */
+static char **sel_users; /* login array of particular users selected */
+
+/*
+ * One of these per active utmp entry.
+ */
+static struct entry {
+ struct entry *next;
+ struct utmpx utmp;
+ dev_t tdev; /* dev_t of terminal */
+ time_t idle; /* idle time of terminal in seconds */
+ struct kinfo_proc *kp; /* `most interesting' proc */
+ char *args; /* arg list of interesting process */
+ struct kinfo_proc *dkp; /* debug option proc list */
+} *ep, *ehead = NULL, **nextp = &ehead;
+
+#define debugproc(p) *(&((struct kinfo_proc *)p)->ki_udata)
+
+#define W_DISPUSERSIZE 10
+#define W_DISPLINESIZE 8
+#define W_DISPHOSTSIZE 40
+
+static void pr_header(time_t *, int);
+static struct stat *ttystat(char *);
+static void usage(int);
+
+char *fmt_argv(char **, char *, char *, size_t); /* ../../bin/ps/fmt.c */
+
+int
+main(int argc, char *argv[])
+{
+ struct kinfo_proc *kp;
+ struct kinfo_proc *dkp;
+ struct stat *stp;
+ time_t touched;
+ int ch, i, nentries, nusers, wcmd, longidle, longattime;
+ const char *memf, *nlistf, *p, *save_p;
+ char *x_suffix;
+ char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX];
+ char fn[MAXHOSTNAMELEN];
+ char *dot;
+
+ (void)setlocale(LC_ALL, "");
+ use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
+ use_comma = (*nl_langinfo(RADIXCHAR) != ',');
+
+ argc = xo_parse_args(argc, argv);
+ if (argc < 0)
+ exit(1);
+
+ /* Are we w(1) or uptime(1)? */
+ if (strcmp(basename(argv[0]), "uptime") == 0) {
+ wcmd = 0;
+ p = "";
+ } else {
+ wcmd = 1;
+ p = "dhiflM:N:nsuw";
+ }
+
+ memf = _PATH_DEVNULL;
+ nlistf = NULL;
+ while ((ch = getopt(argc, argv, p)) != -1)
+ switch (ch) {
+ case 'd':
+ dflag = 1;
+ break;
+ case 'h':
+ header = 0;
+ break;
+ case 'i':
+ sortidle = 1;
+ break;
+ case 'M':
+ header = 0;
+ memf = optarg;
+ break;
+ case 'N':
+ nlistf = optarg;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ case 'f': case 'l': case 's': case 'u': case 'w':
+ warnx("[-flsuw] no longer supported");
+ /* FALLTHROUGH */
+ case '?':
+ default:
+ usage(wcmd);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!(_res.options & RES_INIT))
+ res_init();
+ _res.retrans = 2; /* resolver timeout to 2 seconds per try */
+ _res.retry = 1; /* only try once.. */
+
+ if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL)
+ errx(1, "%s", errbuf);
+
+ (void)time(&now);
+
+ if (*argv)
+ sel_users = argv;
+
+ setutxent();
+ for (nusers = 0; (utmp = getutxent()) != NULL;) {
+ if (utmp->ut_type != USER_PROCESS)
+ continue;
+ if (!(stp = ttystat(utmp->ut_line)))
+ continue; /* corrupted record */
+ ++nusers;
+ if (wcmd == 0)
+ continue;
+ if (sel_users) {
+ int usermatch;
+ char **user;
+
+ usermatch = 0;
+ for (user = sel_users; !usermatch && *user; user++)
+ if (!strcmp(utmp->ut_user, *user))
+ usermatch = 1;
+ if (!usermatch)
+ continue;
+ }
+ if ((ep = calloc(1, sizeof(struct entry))) == NULL)
+ errx(1, "calloc");
+ *nextp = ep;
+ nextp = &ep->next;
+ memmove(&ep->utmp, utmp, sizeof *utmp);
+ ep->tdev = stp->st_rdev;
+ /*
+ * If this is the console device, attempt to ascertain
+ * the true console device dev_t.
+ */
+ if (ep->tdev == 0) {
+ size_t size;
+
+ size = sizeof(dev_t);
+ (void)sysctlbyname("machdep.consdev", &ep->tdev, &size, NULL, 0);
+ }
+ touched = stp->st_atime;
+ if (touched < ep->utmp.ut_tv.tv_sec) {
+ /* tty untouched since before login */
+ touched = ep->utmp.ut_tv.tv_sec;
+ }
+ if ((ep->idle = now - touched) < 0)
+ ep->idle = 0;
+ }
+ endutxent();
+
+ xo_open_container("uptime-information");
+
+ if (header || wcmd == 0) {
+ pr_header(&now, nusers);
+ if (wcmd == 0) {
+ xo_close_container("uptime-information");
+ xo_finish();
+
+ (void)kvm_close(kd);
+ exit(0);
+ }
+
+#define HEADER_USER "USER"
+#define HEADER_TTY "TTY"
+#define HEADER_FROM "FROM"
+#define HEADER_LOGIN_IDLE "LOGIN@ IDLE "
+#define HEADER_WHAT "WHAT\n"
+#define WUSED (W_DISPUSERSIZE + W_DISPLINESIZE + W_DISPHOSTSIZE + \
+ sizeof(HEADER_LOGIN_IDLE) + 3) /* header width incl. spaces */
+ xo_emit("{T:/%-*.*s} {T:/%-*.*s} {T:/%-*.*s} {T:/%s}",
+ W_DISPUSERSIZE, W_DISPUSERSIZE, HEADER_USER,
+ W_DISPLINESIZE, W_DISPLINESIZE, HEADER_TTY,
+ W_DISPHOSTSIZE, W_DISPHOSTSIZE, HEADER_FROM,
+ HEADER_LOGIN_IDLE HEADER_WHAT);
+ }
+
+ if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
+ err(1, "%s", kvm_geterr(kd));
+ for (i = 0; i < nentries; i++, kp++) {
+ if (kp->ki_stat == SIDL || kp->ki_stat == SZOMB ||
+ kp->ki_tdev == NODEV)
+ continue;
+ for (ep = ehead; ep != NULL; ep = ep->next) {
+ if (ep->tdev == kp->ki_tdev) {
+ /*
+ * proc is associated with this terminal
+ */
+ if (ep->kp == NULL && kp->ki_pgid == kp->ki_tpgid) {
+ /*
+ * Proc is 'most interesting'
+ */
+ if (proc_compare(ep->kp, kp))
+ ep->kp = kp;
+ }
+ /*
+ * Proc debug option info; add to debug
+ * list using kinfo_proc ki_spare[0]
+ * as next pointer; ptr to ptr avoids the
+ * ptr = long assumption.
+ */
+ dkp = ep->dkp;
+ ep->dkp = kp;
+ debugproc(kp) = dkp;
+ }
+ }
+ }
+ if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 &&
+ ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1 &&
+ ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) || ws.ws_col == 0)
+ ttywidth = 79;
+ else
+ ttywidth = ws.ws_col - 1;
+ argwidth = ttywidth - WUSED;
+ if (argwidth < 4)
+ argwidth = 8;
+ for (ep = ehead; ep != NULL; ep = ep->next) {
+ if (ep->kp == NULL) {
+ ep->args = strdup("-");
+ continue;
+ }
+ ep->args = fmt_argv(kvm_getargv(kd, ep->kp, argwidth),
+ ep->kp->ki_comm, NULL, MAXCOMLEN);
+ if (ep->args == NULL)
+ err(1, NULL);
+ }
+ /* sort by idle time */
+ if (sortidle && ehead != NULL) {
+ struct entry *from, *save;
+
+ from = ehead;
+ ehead = NULL;
+ while (from != NULL) {
+ for (nextp = &ehead;
+ (*nextp) && from->idle >= (*nextp)->idle;
+ nextp = &(*nextp)->next)
+ continue;
+ save = from;
+ from = from->next;
+ save->next = *nextp;
+ *nextp = save;
+ }
+ }
+
+ xo_open_container("user-table");
+ xo_open_list("user-entry");
+
+ for (ep = ehead; ep != NULL; ep = ep->next) {
+ struct addrinfo hints, *res;
+ struct sockaddr_storage ss;
+ struct sockaddr *sa = (struct sockaddr *)&ss;
+ struct sockaddr_in *lsin = (struct sockaddr_in *)&ss;
+ struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)&ss;
+ time_t t;
+ int isaddr;
+
+ xo_open_instance("user-entry");
+
+ save_p = p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-";
+ if ((x_suffix = strrchr(p, ':')) != NULL) {
+ if ((dot = strchr(x_suffix, '.')) != NULL &&
+ strchr(dot+1, '.') == NULL)
+ *x_suffix++ = '\0';
+ else
+ x_suffix = NULL;
+ }
+
+ isaddr = 0;
+ memset(&ss, '\0', sizeof(ss));
+ if (inet_pton(AF_INET6, p, &lsin6->sin6_addr) == 1) {
+ lsin6->sin6_len = sizeof(*lsin6);
+ lsin6->sin6_family = AF_INET6;
+ isaddr = 1;
+ } else if (inet_pton(AF_INET, p, &lsin->sin_addr) == 1) {
+ lsin->sin_len = sizeof(*lsin);
+ lsin->sin_family = AF_INET;
+ isaddr = 1;
+ }
+ if (!nflag) {
+ /* Attempt to change an IP address into a name */
+ if (isaddr && realhostname_sa(fn, sizeof(fn), sa,
+ sa->sa_len) == HOSTNAME_FOUND)
+ p = fn;
+ } else if (!isaddr) {
+ /*
+ * If a host has only one A/AAAA RR, change a
+ * name into an IP address
+ */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_PASSIVE;
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ if (getaddrinfo(p, NULL, &hints, &res) == 0) {
+ if (res->ai_next == NULL &&
+ getnameinfo(res->ai_addr, res->ai_addrlen,
+ fn, sizeof(fn), NULL, 0,
+ NI_NUMERICHOST) == 0)
+ p = fn;
+ freeaddrinfo(res);
+ }
+ }
+
+ if (x_suffix) {
+ (void)snprintf(buf, sizeof(buf), "%s:%s", p, x_suffix);
+ p = buf;
+ }
+ if (dflag) {
+ xo_open_container("process-table");
+ xo_open_list("process-entry");
+
+ for (dkp = ep->dkp; dkp != NULL; dkp = debugproc(dkp)) {
+ const char *ptr;
+
+ ptr = fmt_argv(kvm_getargv(kd, dkp, argwidth),
+ dkp->ki_comm, NULL, MAXCOMLEN);
+ if (ptr == NULL)
+ ptr = "-";
+ xo_open_instance("process-entry");
+ xo_emit("\t\t{:process-id/%-9d/%d} {:command/%s}\n",
+ dkp->ki_pid, ptr);
+ xo_close_instance("process-entry");
+ }
+ xo_close_list("process-entry");
+ xo_close_container("process-table");
+ }
+ xo_emit("{:user/%-*.*s/%@**@s} {:tty/%-*.*s/%@**@s} ",
+ W_DISPUSERSIZE, W_DISPUSERSIZE, ep->utmp.ut_user,
+ W_DISPLINESIZE, W_DISPLINESIZE,
+ *ep->utmp.ut_line ?
+ (strncmp(ep->utmp.ut_line, "tty", 3) &&
+ strncmp(ep->utmp.ut_line, "cua", 3) ?
+ ep->utmp.ut_line : ep->utmp.ut_line + 3) : "-");
+
+ if (save_p && save_p != p)
+ xo_attr("address", "%s", save_p);
+ xo_emit("{:from/%-*.*s/%@**@s} ",
+ W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-");
+ t = ep->utmp.ut_tv.tv_sec;
+ longattime = pr_attime(&t, &now);
+ longidle = pr_idle(ep->idle);
+ xo_emit("{:command/%.*s/%@*@s}\n",
+ argwidth - longidle - longattime,
+ ep->args);
+
+ xo_close_instance("user-entry");
+ }
+
+ xo_close_list("user-entry");
+ xo_close_container("user-table");
+ xo_close_container("uptime-information");
+ xo_finish();
+
+ (void)kvm_close(kd);
+ exit(0);
+}
+
+static void
+pr_header(time_t *nowp, int nusers)
+{
+ double avenrun[3];
+ time_t uptime;
+ struct timespec tp;
+ int days, hrs, i, mins, secs;
+ char buf[256];
+ struct sbuf *upbuf;
+
+ upbuf = sbuf_new_auto();
+ /*
+ * Print time of day.
+ */
+ if (strftime(buf, sizeof(buf),
+ use_ampm ? "%l:%M%p" : "%k:%M", localtime(nowp)) != 0)
+ xo_emit("{:time-of-day/%s} ", buf);
+ /*
+ * Print how long system has been up.
+ */
+ if (clock_gettime(CLOCK_UPTIME, &tp) != -1) {
+ uptime = tp.tv_sec;
+ if (uptime > 60)
+ uptime += 30;
+ days = uptime / 86400;
+ uptime %= 86400;
+ hrs = uptime / 3600;
+ uptime %= 3600;
+ mins = uptime / 60;
+ secs = uptime % 60;
+ xo_emit(" up");
+ xo_emit("{e:uptime/%lu}", (unsigned long) tp.tv_sec);
+ xo_emit("{e:days/%d}{e:hours/%d}{e:minutes/%d}{e:seconds/%d}", days, hrs, mins, secs);
+
+ if (days > 0)
+ sbuf_printf(upbuf, " %d day%s,",
+ days, days > 1 ? "s" : "");
+ if (hrs > 0 && mins > 0)
+ sbuf_printf(upbuf, " %2d:%02d,", hrs, mins);
+ else if (hrs > 0)
+ sbuf_printf(upbuf, " %d hr%s,",
+ hrs, hrs > 1 ? "s" : "");
+ else if (mins > 0)
+ sbuf_printf(upbuf, " %d min%s,",
+ mins, mins > 1 ? "s" : "");
+ else
+ sbuf_printf(upbuf, " %d sec%s,",
+ secs, secs > 1 ? "s" : "");
+ if (sbuf_finish(upbuf) != 0)
+ xo_err(1, "Could not generate output");
+ xo_emit("{:uptime-human/%s}", sbuf_data(upbuf));
+ sbuf_delete(upbuf);
+ }
+
+ /* Print number of users logged in to system */
+ xo_emit(" {:users/%d} {N:user%s}", nusers, nusers == 1 ? "" : "s");
+
+ /*
+ * Print 1, 5, and 15 minute load averages.
+ */
+ if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) == -1)
+ xo_emit(", no load average information available\n");
+ else {
+ static const char *format[] = {
+ " {:load-average-1/%.2f}",
+ " {:load-average-5/%.2f}",
+ " {:load-average-15/%.2f}",
+ };
+ xo_emit(", load averages:");
+ for (i = 0; i < (int)(sizeof(avenrun) / sizeof(avenrun[0])); i++) {
+ if (use_comma && i > 0)
+ xo_emit(",");
+ xo_emit(format[i], avenrun[i]);
+ }
+ xo_emit("\n");
+ }
+}
+
+static struct stat *
+ttystat(char *line)
+{
+ static struct stat sb;
+ char ttybuf[MAXPATHLEN];
+
+ (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line);
+ if (stat(ttybuf, &sb) == 0 && S_ISCHR(sb.st_mode)) {
+ return (&sb);
+ } else
+ return (NULL);
+}
+
+static void
+usage(int wcmd)
+{
+ if (wcmd)
+ xo_error("usage: w [-dhin] [-M core] [-N system] [user ...]\n");
+ else
+ xo_error("usage: uptime\n");
+ xo_finish();
+ exit(1);
+}
diff --git a/usr.bin/wall/Makefile b/usr.bin/wall/Makefile
new file mode 100644
index 0000000..c5deb3b
--- /dev/null
+++ b/usr.bin/wall/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= wall
+SRCS= ttymsg.c wall.c
+BINGRP= tty
+BINMODE=2555
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/wall/Makefile.depend b/usr.bin/wall/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/wall/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/wall/ttymsg.c b/usr.bin/wall/ttymsg.c
new file mode 100644
index 0000000..1317a4b
--- /dev/null
+++ b/usr.bin/wall/ttymsg.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 1989, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char sccsid[] = "@(#)ttymsg.c 8.2 (Berkeley) 11/16/93";
+#endif
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ttymsg.h"
+
+/*
+ * Display the contents of a uio structure on a terminal. Used by wall(1),
+ * syslogd(8), and talkd(8). Forks and finishes in child if write would block,
+ * waiting up to tmout seconds. Returns pointer to error string on unexpected
+ * error; string is not newline-terminated. Various "normal" errors are
+ * ignored (exclusive-use, lack of permission, etc.).
+ */
+const char *
+ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
+{
+ struct iovec localiov[7];
+ ssize_t left, wret;
+ int cnt, fd;
+ char device[MAXNAMLEN] = _PATH_DEV;
+ static char errbuf[1024];
+ char *p;
+ int forked;
+
+ forked = 0;
+ if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0])))
+ return ("too many iov's (change code in wall/ttymsg.c)");
+
+ strlcat(device, line, sizeof(device));
+ p = device + sizeof(_PATH_DEV) - 1;
+ if (strncmp(p, "pts/", 4) == 0)
+ p += 4;
+ if (strchr(p, '/') != NULL) {
+ /* A slash is an attempt to break security... */
+ (void) snprintf(errbuf, sizeof(errbuf),
+ "Too many '/' in \"%s\"", device);
+ return (errbuf);
+ }
+
+ /*
+ * open will fail on slip lines or exclusive-use lines
+ * if not running as root; not an error.
+ */
+ if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {
+ if (errno == EBUSY || errno == EACCES)
+ return (NULL);
+ (void) snprintf(errbuf, sizeof(errbuf), "%s: %s", device,
+ strerror(errno));
+ return (errbuf);
+ }
+
+ for (cnt = 0, left = 0; cnt < iovcnt; ++cnt)
+ left += iov[cnt].iov_len;
+
+ for (;;) {
+ wret = writev(fd, iov, iovcnt);
+ if (wret >= left)
+ break;
+ if (wret >= 0) {
+ left -= wret;
+ if (iov != localiov) {
+ bcopy(iov, localiov,
+ iovcnt * sizeof(struct iovec));
+ iov = localiov;
+ }
+ for (cnt = 0; (size_t)wret >= iov->iov_len; ++cnt) {
+ wret -= iov->iov_len;
+ ++iov;
+ --iovcnt;
+ }
+ if (wret) {
+ iov->iov_base = (char *)iov->iov_base + wret;
+ iov->iov_len -= wret;
+ }
+ continue;
+ }
+ if (errno == EWOULDBLOCK) {
+ int cpid;
+
+ if (forked) {
+ (void) close(fd);
+ _exit(1);
+ }
+ cpid = fork();
+ if (cpid < 0) {
+ (void) snprintf(errbuf, sizeof(errbuf),
+ "fork: %s", strerror(errno));
+ (void) close(fd);
+ return (errbuf);
+ }
+ if (cpid) { /* parent */
+ (void) close(fd);
+ return (NULL);
+ }
+ forked++;
+ /* wait at most tmout seconds */
+ (void) signal(SIGALRM, SIG_DFL);
+ (void) signal(SIGTERM, SIG_DFL); /* XXX */
+ (void) sigsetmask(0);
+ (void) alarm((u_int)tmout);
+ (void) fcntl(fd, F_SETFL, 0); /* clear O_NONBLOCK */
+ continue;
+ }
+ /*
+ * We get ENODEV on a slip line if we're running as root,
+ * and EIO if the line just went away.
+ */
+ if (errno == ENODEV || errno == EIO)
+ break;
+ (void) close(fd);
+ if (forked)
+ _exit(1);
+ (void) snprintf(errbuf, sizeof(errbuf),
+ "%s: %s", device, strerror(errno));
+ return (errbuf);
+ }
+
+ (void) close(fd);
+ if (forked)
+ _exit(0);
+ return (NULL);
+}
diff --git a/usr.bin/wall/ttymsg.h b/usr.bin/wall/ttymsg.h
new file mode 100644
index 0000000..31312aa
--- /dev/null
+++ b/usr.bin/wall/ttymsg.h
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+
+const char *ttymsg(struct iovec *, int, const char *, int);
diff --git a/usr.bin/wall/wall.1 b/usr.bin/wall/wall.1
new file mode 100644
index 0000000..4fa82dd
--- /dev/null
+++ b/usr.bin/wall/wall.1
@@ -0,0 +1,75 @@
+.\" Copyright (c) 1989, 1990, 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.
+.\"
+.\" @(#)wall.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 24, 2012
+.Dt WALL 1
+.Os
+.Sh NAME
+.Nm wall
+.Nd write a message to users
+.Sh SYNOPSIS
+.Nm
+.Op Fl g Ar group
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the contents of
+.Ar file
+or, by default, its standard input, on the terminals of all
+currently logged in users.
+.Pp
+Only the super-user can write on the
+terminals of users who have chosen
+to deny messages or are using a program which
+automatically denies messages.
+.Bl -tag -width indent
+.It Fl g
+Send messages to users in this group.
+This option may be specified
+multiple times, and any user in any of the specified groups will
+receive the message.
+.El
+.Sh SEE ALSO
+.Xr mesg 1 ,
+.Xr talk 1 ,
+.Xr write 1 ,
+.Xr shutdown 8
+.Sh HISTORY
+A
+.Nm
+command appeared in PWB UNIX.
+.Sh BUGS
+The sender's
+.Ev LC_CTYPE
+setting is used to determine which characters are safe to write to a
+terminal, not the receiver's (which
+.Nm
+has no way of knowing).
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
new file mode 100644
index 0000000..b3a63dc
--- /dev/null
+++ b/usr.bin/wall/wall.c
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 1988, 1990, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1988, 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)wall.c 8.2 (Berkeley) 11/16/93";
+#endif
+
+/*
+ * This program is not related to David Wall, whose Stanford Ph.D. thesis
+ * is entitled "Mechanisms for Broadcast and Selective Broadcast".
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <grp.h>
+#include <locale.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "ttymsg.h"
+
+static void makemsg(char *);
+static void usage(void);
+
+static struct wallgroup {
+ struct wallgroup *next;
+ char *name;
+ gid_t gid;
+} *grouplist;
+static int nobanner;
+static int mbufsize;
+static char *mbuf;
+
+static int
+ttystat(char *line)
+{
+ struct stat sb;
+ char ttybuf[MAXPATHLEN];
+
+ (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line);
+ if (stat(ttybuf, &sb) == 0) {
+ return (0);
+ } else
+ return (-1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct iovec iov;
+ struct utmpx *utmp;
+ int ch;
+ int ingroup;
+ struct wallgroup *g;
+ struct group *grp;
+ char **np;
+ const char *p;
+ struct passwd *pw;
+
+ (void)setlocale(LC_CTYPE, "");
+
+ while ((ch = getopt(argc, argv, "g:n")) != -1)
+ switch (ch) {
+ case 'n':
+ /* undoc option for shutdown: suppress banner */
+ if (geteuid() == 0)
+ nobanner = 1;
+ break;
+ case 'g':
+ g = (struct wallgroup *)malloc(sizeof *g);
+ g->next = grouplist;
+ g->name = optarg;
+ g->gid = -1;
+ grouplist = g;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc > 1)
+ usage();
+
+ for (g = grouplist; g; g = g->next) {
+ grp = getgrnam(g->name);
+ if (grp != NULL)
+ g->gid = grp->gr_gid;
+ else
+ warnx("%s: no such group", g->name);
+ }
+
+ makemsg(*argv);
+
+ iov.iov_base = mbuf;
+ iov.iov_len = mbufsize;
+ /* NOSTRICT */
+ while ((utmp = getutxent()) != NULL) {
+ if (utmp->ut_type != USER_PROCESS)
+ continue;
+ if (ttystat(utmp->ut_line) != 0)
+ continue;
+ if (grouplist) {
+ ingroup = 0;
+ pw = getpwnam(utmp->ut_user);
+ if (!pw)
+ continue;
+ for (g = grouplist; g && ingroup == 0; g = g->next) {
+ if (g->gid == (gid_t)-1)
+ continue;
+ if (g->gid == pw->pw_gid)
+ ingroup = 1;
+ else if ((grp = getgrgid(g->gid)) != NULL) {
+ for (np = grp->gr_mem; *np; np++) {
+ if (strcmp(*np, utmp->ut_user) == 0) {
+ ingroup = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (ingroup == 0)
+ continue;
+ }
+ if ((p = ttymsg(&iov, 1, utmp->ut_line, 60*5)) != NULL)
+ warnx("%s", p);
+ }
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: wall [-g group] [file]\n");
+ exit(1);
+}
+
+void
+makemsg(char *fname)
+{
+ int cnt;
+ wchar_t ch;
+ struct tm *lt;
+ struct passwd *pw;
+ struct stat sbuf;
+ time_t now;
+ FILE *fp;
+ int fd;
+ char hostname[MAXHOSTNAMELEN], tmpname[64];
+ wchar_t *p, *tmp, lbuf[256], codebuf[13];
+ const char *tty;
+ const char *whom;
+ gid_t egid;
+
+ (void)snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);
+ if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
+ err(1, "can't open temporary file");
+ (void)unlink(tmpname);
+
+ if (!nobanner) {
+ tty = ttyname(STDERR_FILENO);
+ if (tty == NULL)
+ tty = "no tty";
+
+ if (!(whom = getlogin()))
+ whom = (pw = getpwuid(getuid())) ? pw->pw_name : "???";
+ (void)gethostname(hostname, sizeof(hostname));
+ (void)time(&now);
+ lt = localtime(&now);
+
+ /*
+ * all this stuff is to blank out a square for the message;
+ * we wrap message lines at column 79, not 80, because some
+ * terminals wrap after 79, some do not, and we can't tell.
+ * Which means that we may leave a non-blank character
+ * in column 80, but that can't be helped.
+ */
+ (void)fwprintf(fp, L"\r%79s\r\n", " ");
+ (void)swprintf(lbuf, sizeof(lbuf)/sizeof(wchar_t),
+ L"Broadcast Message from %s@%s",
+ whom, hostname);
+ (void)fwprintf(fp, L"%-79.79S\007\007\r\n", lbuf);
+ (void)swprintf(lbuf, sizeof(lbuf)/sizeof(wchar_t),
+ L" (%s) at %d:%02d %s...", tty,
+ lt->tm_hour, lt->tm_min, lt->tm_zone);
+ (void)fwprintf(fp, L"%-79.79S\r\n", lbuf);
+ }
+ (void)fwprintf(fp, L"%79s\r\n", " ");
+
+ if (fname) {
+ egid = getegid();
+ setegid(getgid());
+ if (freopen(fname, "r", stdin) == NULL)
+ err(1, "can't read %s", fname);
+ if (setegid(egid) != 0)
+ err(1, "setegid failed");
+ }
+ cnt = 0;
+ while (fgetws(lbuf, sizeof(lbuf)/sizeof(wchar_t), stdin)) {
+ for (p = lbuf; (ch = *p) != L'\0'; ++p, ++cnt) {
+ if (ch == L'\r') {
+ putwc(L'\r', fp);
+ cnt = 0;
+ continue;
+ } else if (ch == L'\n') {
+ for (; cnt < 79; ++cnt)
+ putwc(L' ', fp);
+ putwc(L'\r', fp);
+ putwc(L'\n', fp);
+ break;
+ }
+ if (cnt == 79) {
+ putwc(L'\r', fp);
+ putwc(L'\n', fp);
+ cnt = 0;
+ }
+ if (iswprint(ch) || iswspace(ch) || ch == L'\a' || ch == L'\b') {
+ putwc(ch, fp);
+ } else {
+ (void)swprintf(codebuf, sizeof(codebuf)/sizeof(wchar_t), L"<0x%X>", ch);
+ for (tmp = codebuf; *tmp != L'\0'; ++tmp) {
+ putwc(*tmp, fp);
+ if (++cnt == 79) {
+ putwc(L'\r', fp);
+ putwc(L'\n', fp);
+ cnt = 0;
+ }
+ }
+ --cnt;
+ }
+ }
+ }
+ (void)fwprintf(fp, L"%79s\r\n", " ");
+ rewind(fp);
+
+ if (fstat(fd, &sbuf))
+ err(1, "can't stat temporary file");
+ mbufsize = sbuf.st_size;
+ if (!(mbuf = malloc((u_int)mbufsize)))
+ err(1, "out of memory");
+ if ((int)fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize)
+ err(1, "can't read temporary file");
+ (void)close(fd);
+}
diff --git a/usr.bin/wc/Makefile b/usr.bin/wc/Makefile
new file mode 100644
index 0000000..540e33d
--- /dev/null
+++ b/usr.bin/wc/Makefile
@@ -0,0 +1,7 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= wc
+LIBADD= xo
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/wc/Makefile.depend b/usr.bin/wc/Makefile.depend
new file mode 100644
index 0000000..137678c
--- /dev/null
+++ b/usr.bin/wc/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/wc/wc.1 b/usr.bin/wc/wc.1
new file mode 100644
index 0000000..8f78fad
--- /dev/null
+++ b/usr.bin/wc/wc.1
@@ -0,0 +1,197 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)wc.1 8.2 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2015
+.Dt WC 1
+.Os
+.Sh NAME
+.Nm wc
+.Nd word, line, character, and byte count
+.Sh SYNOPSIS
+.Nm
+.Op Fl -libxo
+.Op Fl Lclmw
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility displays the number of lines, words, and bytes contained in each
+input
+.Ar file ,
+or standard input (if no file is specified) to the standard output.
+A line is defined as a string of characters delimited by a
+.Aq newline
+character.
+Characters beyond the final
+.Aq newline
+character will not be included
+in the line count.
+.Pp
+A word is defined as a string of characters delimited by white space
+characters.
+White space characters are the set of characters for which the
+.Xr iswspace 3
+function returns true.
+If more than one input file is specified, a line of cumulative counts
+for all the files is displayed on a separate line after the output for
+the last file.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl -libxo
+Generate output via
+.Xr libxo 3
+in a selection of different human and machine readable formats.
+See
+.Xr xo_parse_args 3
+for details on command line arguments.
+.It Fl L
+The number of characters in the longest input line
+is written to the standard output.
+When more than one
+.Ar file
+argument is specified, the longest input line of
+.Em all
+files is reported as the value of the final
+.Dq total .
+.It Fl c
+The number of bytes in each input file
+is written to the standard output.
+This will cancel out any prior usage of the
+.Fl m
+option.
+.It Fl l
+The number of lines in each input file
+is written to the standard output.
+.It Fl m
+The number of characters in each input file is written to the standard output.
+If the current locale does not support multibyte characters, this
+is equivalent to the
+.Fl c
+option.
+This will cancel out any prior usage of the
+.Fl c
+option.
+.It Fl w
+The number of words in each input file
+is written to the standard output.
+.El
+.Pp
+When an option is specified,
+.Nm
+only reports the information requested by that option.
+The order of output always takes the form of line, word,
+byte, and file name.
+The default action is equivalent to specifying the
+.Fl c , l
+and
+.Fl w
+options.
+.Pp
+If no files are specified, the standard input is used and no
+file name is displayed.
+The prompt will accept input until receiving EOF, or
+.Bq ^D
+in most environments.
+.Sh ENVIRONMENT
+The
+.Ev LANG , LC_ALL
+and
+.Ev LC_CTYPE
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Count the number of characters, words and lines in each of the files
+.Pa report1
+and
+.Pa report2
+as well as the totals for both:
+.Pp
+.Dl "wc -mlw report1 report2"
+.Pp
+Find the longest line in a list of files:
+.Pp
+.Dl "wc -L file1 file2 file3 | fgrep total"
+.Sh COMPATIBILITY
+Historically, the
+.Nm
+utility was documented to define a word as a
+.Do
+maximal string of
+characters delimited by <space>, <tab> or <newline> characters
+.Dc .
+The implementation, however, did not handle non-printing characters
+correctly so that
+.Dq Li "\ \ ^D^E\ \ "
+counted as 6 spaces, while
+.Dq Li foo^D^Ebar
+counted as 8 characters.
+.Bx 4
+systems after
+.Bx 4.3
+modified the implementation to be consistent
+with the documentation.
+This implementation defines a
+.Dq word
+in terms of the
+.Xr iswspace 3
+function, as required by
+.St -p1003.2 .
+.Pp
+The
+.Fl L
+option is a non-standard
+.Fx
+extension, compatible with the
+.Fl L
+option of the GNU
+.Nm
+utility.
+.Sh SEE ALSO
+.Xr iswspace 3 ,
+.Xr libxo 3 ,
+.Xr xo_parse_args 3
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
new file mode 100644
index 0000000..a6ca137
--- /dev/null
+++ b/usr.bin/wc/wc.c
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 1980, 1987, 1991, 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, 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <libxo/xo.h>
+
+static uintmax_t tlinect, twordct, tcharct, tlongline;
+static int doline, doword, dochar, domulti, dolongline;
+static volatile sig_atomic_t siginfo;
+static xo_handle_t *stderr_handle;
+
+static void show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
+ uintmax_t charct, uintmax_t llct);
+static int cnt(const char *);
+static void usage(void);
+
+static void
+siginfo_handler(int sig __unused)
+{
+
+ siginfo = 1;
+}
+
+static void
+reset_siginfo(void)
+{
+
+ signal(SIGINFO, SIG_DFL);
+ siginfo = 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch, errors, total;
+
+ (void) setlocale(LC_CTYPE, "");
+
+ argc = xo_parse_args(argc, argv);
+ if (argc < 0)
+ return (argc);
+
+ while ((ch = getopt(argc, argv, "clmwL")) != -1)
+ switch((char)ch) {
+ case 'l':
+ doline = 1;
+ break;
+ case 'w':
+ doword = 1;
+ break;
+ case 'c':
+ dochar = 1;
+ domulti = 0;
+ break;
+ case 'L':
+ dolongline = 1;
+ break;
+ case 'm':
+ domulti = 1;
+ dochar = 0;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argv += optind;
+ argc -= optind;
+
+ (void)signal(SIGINFO, siginfo_handler);
+
+ /* Wc's flags are on by default. */
+ if (doline + doword + dochar + domulti + dolongline == 0)
+ doline = doword = dochar = 1;
+
+ stderr_handle = xo_create_to_file(stderr, XO_STYLE_TEXT, 0);
+ xo_open_container("wc");
+ xo_open_list("file");
+
+ errors = 0;
+ total = 0;
+ if (!*argv) {
+ xo_open_instance("file");
+ if (cnt((char *)NULL) != 0)
+ ++errors;
+ xo_close_instance("file");
+ } else {
+ do {
+ xo_open_instance("file");
+ if (cnt(*argv) != 0)
+ ++errors;
+ xo_close_instance("file");
+ ++total;
+ } while(*++argv);
+ }
+
+ xo_close_list("file");
+
+ if (total > 1) {
+ xo_open_container("total");
+ show_cnt("total", tlinect, twordct, tcharct, tlongline);
+ xo_close_container("total");
+ }
+
+ xo_close_container("wc");
+ xo_finish();
+ exit(errors == 0 ? 0 : 1);
+}
+
+static void
+show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
+ uintmax_t charct, uintmax_t llct)
+{
+ xo_handle_t *xop;
+
+ if (!siginfo)
+ xop = NULL;
+ else {
+ xop = stderr_handle;
+ siginfo = 0;
+ }
+
+ if (doline)
+ xo_emit_h(xop, " {:lines/%7ju/%ju}", linect);
+ if (doword)
+ xo_emit_h(xop, " {:words/%7ju/%ju}", wordct);
+ if (dochar || domulti)
+ xo_emit_h(xop, " {:characters/%7ju/%ju}", charct);
+ if (dolongline)
+ xo_emit_h(xop, " {:long-lines/%7ju/%ju}", llct);
+ if (file != NULL)
+ xo_emit_h(xop, " {:filename/%s}\n", file);
+ else
+ xo_emit_h(xop, "\n");
+}
+
+static int
+cnt(const char *file)
+{
+ struct stat sb;
+ uintmax_t linect, wordct, charct, llct, tmpll;
+ int fd, len, warned;
+ size_t clen;
+ short gotsp;
+ u_char *p;
+ u_char buf[MAXBSIZE];
+ wchar_t wch;
+ mbstate_t mbs;
+
+ linect = wordct = charct = llct = tmpll = 0;
+ if (file == NULL)
+ fd = STDIN_FILENO;
+ else {
+ if ((fd = open(file, O_RDONLY, 0)) < 0) {
+ xo_warn("%s: open", file);
+ return (1);
+ }
+ if (doword || (domulti && MB_CUR_MAX != 1))
+ goto word;
+ /*
+ * Line counting is split out because it's a lot faster to get
+ * lines than to get words, since the word count requires some
+ * logic.
+ */
+ if (doline) {
+ while ((len = read(fd, buf, MAXBSIZE))) {
+ if (len == -1) {
+ xo_warn("%s: read", file);
+ (void)close(fd);
+ return (1);
+ }
+ if (siginfo) {
+ show_cnt(file, linect, wordct, charct,
+ llct);
+ }
+ charct += len;
+ for (p = buf; len--; ++p)
+ if (*p == '\n') {
+ if (tmpll > llct)
+ llct = tmpll;
+ tmpll = 0;
+ ++linect;
+ } else
+ tmpll++;
+ }
+ reset_siginfo();
+ tlinect += linect;
+ if (dochar)
+ tcharct += charct;
+ if (dolongline) {
+ if (llct > tlongline)
+ tlongline = llct;
+ }
+ show_cnt(file, linect, wordct, charct, llct);
+ (void)close(fd);
+ return (0);
+ }
+ /*
+ * If all we need is the number of characters and it's a
+ * regular file, just stat the puppy.
+ */
+ if (dochar || domulti) {
+ if (fstat(fd, &sb)) {
+ xo_warn("%s: fstat", file);
+ (void)close(fd);
+ return (1);
+ }
+ if (S_ISREG(sb.st_mode)) {
+ reset_siginfo();
+ charct = sb.st_size;
+ show_cnt(file, linect, wordct, charct, llct);
+ tcharct += charct;
+ (void)close(fd);
+ return (0);
+ }
+ }
+ }
+
+ /* Do it the hard way... */
+word: gotsp = 1;
+ warned = 0;
+ memset(&mbs, 0, sizeof(mbs));
+ while ((len = read(fd, buf, MAXBSIZE)) != 0) {
+ if (len == -1) {
+ xo_warn("%s: read", file != NULL ? file : "stdin");
+ (void)close(fd);
+ return (1);
+ }
+ p = buf;
+ while (len > 0) {
+ if (siginfo)
+ show_cnt(file, linect, wordct, charct, llct);
+ if (!domulti || MB_CUR_MAX == 1) {
+ clen = 1;
+ wch = (unsigned char)*p;
+ } else if ((clen = mbrtowc(&wch, p, len, &mbs)) ==
+ (size_t)-1) {
+ if (!warned) {
+ errno = EILSEQ;
+ xo_warn("%s",
+ file != NULL ? file : "stdin");
+ warned = 1;
+ }
+ memset(&mbs, 0, sizeof(mbs));
+ clen = 1;
+ wch = (unsigned char)*p;
+ } else if (clen == (size_t)-2)
+ break;
+ else if (clen == 0)
+ clen = 1;
+ charct++;
+ if (wch != L'\n')
+ tmpll++;
+ len -= clen;
+ p += clen;
+ if (wch == L'\n') {
+ if (tmpll > llct)
+ llct = tmpll;
+ tmpll = 0;
+ ++linect;
+ }
+ if (iswspace(wch))
+ gotsp = 1;
+ else if (gotsp) {
+ gotsp = 0;
+ ++wordct;
+ }
+ }
+ }
+ reset_siginfo();
+ if (domulti && MB_CUR_MAX > 1)
+ if (mbrtowc(NULL, NULL, 0, &mbs) == (size_t)-1 && !warned)
+ xo_warn("%s", file != NULL ? file : "stdin");
+ if (doline)
+ tlinect += linect;
+ if (doword)
+ twordct += wordct;
+ if (dochar || domulti)
+ tcharct += charct;
+ if (dolongline) {
+ if (llct > tlongline)
+ tlongline = llct;
+ }
+ show_cnt(file, linect, wordct, charct, llct);
+ (void)close(fd);
+ return (0);
+}
+
+static void
+usage(void)
+{
+ xo_error("usage: wc [-Lclmw] [file ...]\n");
+ exit(1);
+}
diff --git a/usr.bin/what/Makefile b/usr.bin/what/Makefile
new file mode 100644
index 0000000..8114290
--- /dev/null
+++ b/usr.bin/what/Makefile
@@ -0,0 +1,6 @@
+# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= what
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/what/Makefile.depend b/usr.bin/what/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/what/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/what/what.1 b/usr.bin/what/what.1
new file mode 100644
index 0000000..e5c3c11
--- /dev/null
+++ b/usr.bin/what/what.1
@@ -0,0 +1,89 @@
+.\" Copyright (c) 1980, 1991, 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.
+.\"
+.\" @(#)what.1 8.1 (Berkeley) 6/6/93
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2006
+.Dt WHAT 1
+.Os
+.Sh NAME
+.Nm what
+.Nd "show what versions of object modules were used to construct a file"
+.Sh SYNOPSIS
+.Nm
+.Op Fl qs
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility searches each specified
+.Ar file
+for sequences of the form
+.Dq Li @(#)
+as inserted by the
+.Tn SCCS
+source code control system.
+It prints the remainder
+of the string following this marker, up to a NUL character, newline, double
+quote,
+.Ql \&>
+character, or backslash.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl q
+Only output the match text, rather than formatting it.
+.It Fl s
+Stop searching each file after the first match.
+.El
+.Sh EXIT STATUS
+Exit status is 0 if any matches were found, otherwise 1.
+.Sh SEE ALSO
+.Xr ident 1 ,
+.Xr strings 1
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+The
+.Fl q
+option is a non-standard
+.Fx
+extension which may not be available on other operating systems.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.0 .
+.Sh BUGS
+This is a rewrite of the
+.Tn SCCS
+command of the same name,
+and behavior may not be identical.
diff --git a/usr.bin/what/what.c b/usr.bin/what/what.c
new file mode 100644
index 0000000..c72e3fa
--- /dev/null
+++ b/usr.bin/what/what.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 1980, 1988, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)what.c 8.1 (Berkeley) 6/6/93";
+#endif
+
+#include <err.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void usage(void);
+static bool search(bool, bool, FILE *);
+
+int
+main(int argc, char *argv[])
+{
+ const char *file;
+ FILE *in;
+ bool found, qflag, sflag;
+ int c;
+
+ qflag = sflag = false;
+
+ while ((c = getopt(argc, argv, "qs")) != -1) {
+ switch (c) {
+ case 'q':
+ qflag = true;
+ break;
+ case 's':
+ sflag = true;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ found = false;
+
+ if (argc == 0) {
+ if (search(sflag, qflag, stdin))
+ found = true;
+ } else {
+ while (argc--) {
+ file = *argv++;
+ in = fopen(file, "r");
+ if (in == NULL) {
+ if (!qflag)
+ warn("%s", file);
+ continue;
+ }
+ if (!qflag)
+ printf("%s:\n", file);
+ if (search(sflag, qflag, in))
+ found = true;
+ fclose(in);
+ }
+ }
+ exit(found ? 0 : 1);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: what [-qs] [file ...]\n");
+ exit(1);
+}
+
+bool
+search(bool one, bool quiet, FILE *in)
+{
+ bool found;
+ int c;
+
+ found = false;
+
+ while ((c = getc(in)) != EOF) {
+loop: if (c != '@')
+ continue;
+ if ((c = getc(in)) != '(')
+ goto loop;
+ if ((c = getc(in)) != '#')
+ goto loop;
+ if ((c = getc(in)) != ')')
+ goto loop;
+ if (!quiet)
+ putchar('\t');
+ while ((c = getc(in)) != EOF && c && c != '"' &&
+ c != '>' && c != '\\' && c != '\n')
+ putchar(c);
+ putchar('\n');
+ found = true;
+ if (one)
+ break;
+ }
+ return (found);
+}
diff --git a/usr.bin/whereis/Makefile b/usr.bin/whereis/Makefile
new file mode 100644
index 0000000..47e2c3d
--- /dev/null
+++ b/usr.bin/whereis/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= whereis
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/whereis/Makefile.depend b/usr.bin/whereis/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/whereis/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/whereis/pathnames.h b/usr.bin/whereis/pathnames.h
new file mode 100644
index 0000000..f5d27d1
--- /dev/null
+++ b/usr.bin/whereis/pathnames.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2002, Jörg Wunsch
+ *
+ * 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(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.
+ *
+ * $FreeBSD$
+ */
+
+/* Where to look for libexec */
+#define PATH_LIBEXEC "/usr/libexec"
+
+/* Where to look for sources. */
+#define PATH_SOURCES \
+"/usr/src/bin:/usr/src/usr.bin:/usr/src/sbin:" \
+"/usr/src/usr.sbin:/usr/src/libexec:" \
+"/usr/src/gnu/bin:/usr/src/gnu/usr.bin:" \
+"/usr/src/gnu/sbin:/usr/src/gnu/usr.sbin:" \
+"/usr/src/gnu/libexec:/usr/src/contrib:" \
+"/usr/src/secure/bin:/usr/src/secure/usr.bin:" \
+"/usr/src/secure/sbin:/usr/src/secure/usr.sbin:" \
+"/usr/src/secure/libexec:/usr/src/crypto:" \
+"/usr/src/games"
+
+/* Each subdirectory of PATH_PORTS will be appended to PATH_SOURCES. */
+#define PATH_PORTS "/usr/ports"
+
+/* How to query the current manpath. */
+#define MANPATHCMD "manpath -q"
+
+/* How to obtain the location of manpages, and how to match this result. */
+#define MANWHEREISCMD "man -S1:8:6 -w %s 2>/dev/null"
+#define MANWHEREISALLCMD "man -a -w %s 2>/dev/null"
+#define MANWHEREISMATCH "^.* [(]source: (.*)[)]$"
+
+/* Command used to locate sources that have not been found yet. */
+#define LOCATECMD "locate '*'/%s 2>/dev/null"
diff --git a/usr.bin/whereis/whereis.1 b/usr.bin/whereis/whereis.1
new file mode 100644
index 0000000..e72911c
--- /dev/null
+++ b/usr.bin/whereis/whereis.1
@@ -0,0 +1,185 @@
+.\" Copyright (c) 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Copyright 2002 Joerg Wunsch
+.\"
+.\" 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. 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.
+.\"
+.\" @(#)whereis.1 8.2 (Berkeley) 12/30/93
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 22, 2002
+.Dt WHEREIS 1
+.Os
+.Sh NAME
+.Nm whereis
+.Nd locate programs
+.Sh SYNOPSIS
+.Nm
+.Op Fl abmqsux
+.Op Fl BMS Ar dir ... Fl f
+.Ar program ...
+.Sh DESCRIPTION
+The
+.Nm
+utility checks the standard binary, manual page, and source
+directories for the specified programs, printing out the paths of any
+it finds.
+The supplied program names are first stripped of leading
+path name components, any single trailing extension added by
+.Xr gzip 1 ,
+.Xr compress 1 ,
+or
+.Xr bzip2 1 ,
+and the leading
+.Ql s.\&
+or trailing
+.Ql ,v
+from a source code control system.
+.Pp
+The default path searched is the string returned by the
+.Xr sysctl 8
+utility for the
+.Dq user.cs_path
+string, with
+.Pa /usr/libexec
+and the current user's
+.Ev $PATH
+appended.
+Manual pages are searched by default along the
+.Ev $MANPATH .
+Program sources are located in a list of known standard places,
+including all the subdirectories of
+.Pa /usr/src
+and
+.Pa /usr/ports .
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl B
+Specify directories to search for binaries.
+Requires the
+.Fl f
+option.
+.It Fl M
+Specify directories to search for manual pages.
+Requires the
+.Fl f
+option.
+.It Fl S
+Specify directories to search for program sources.
+Requires the
+.Fl f
+option.
+.It Fl a
+Report all matches instead of only the first of each requested type.
+.It Fl b
+Search for binaries.
+.It Fl f
+Delimits the list of directories after the
+.Fl B ,
+.Fl M ,
+or
+.Fl S
+options, and indicates the beginning of the
+.Ar program
+list.
+.It Fl m
+Search for manual pages.
+.It Fl q
+.Pq Dq quiet .
+Suppress the output of the utility name in front of the normal
+output line.
+This can become handy for use in a backquote substitution of a
+shell command line, see
+.Sx EXAMPLES .
+.It Fl s
+Search for source directories.
+.It Fl u
+Search for
+.Dq unusual
+entries.
+A file is said to be unusual if it does not have at least
+one entry of each requested type.
+Only the name of the unusual entry is printed.
+.It Fl x
+Do not use
+.Dq expensive
+tools when searching for source directories.
+Normally, after unsuccessfully searching all the first-level
+subdirectories of the source directory list,
+.Nm
+will ask
+.Xr locate 1
+to find the entry on its behalf.
+Since this can take much longer, it can be turned off with
+.Fl x .
+.El
+.Sh EXAMPLES
+The following finds all utilities under
+.Pa /usr/bin
+that do not have documentation:
+.Pp
+.Dl whereis -m -u /usr/bin/*
+.Pp
+Change to the source code directory of
+.Xr ls 1 :
+.Pp
+.Dl cd `whereis -sq ls`
+.Sh SEE ALSO
+.Xr find 1 ,
+.Xr locate 1 ,
+.Xr man 1 ,
+.Xr which 1 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 3.0 .
+This version re-implements the historical
+functionality that was lost in
+.Bx 4.4 .
+.Sh AUTHORS
+This implementation of the
+.Nm
+command was written by
+.An J\(:org Wunsch .
+.Sh BUGS
+This re-implementation of the
+.Nm
+utility is not bug-for-bug compatible with historical versions.
+It is believed to be compatible with the version that was shipping with
+.Fx 2.2
+through
+.Fx 4.5
+though.
+.Pp
+The
+.Nm
+utility can report some unrelated source entries when the
+.Fl a
+option is specified.
diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c
new file mode 100644
index 0000000..3d85711
--- /dev/null
+++ b/usr.bin/whereis/whereis.c
@@ -0,0 +1,691 @@
+/*
+ * Copyright © 2002, Jörg Wunsch
+ *
+ * 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(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.
+ */
+
+/*
+ * 4.3BSD UI-compatible whereis(1) utility. Rewritten from scratch
+ * since the original 4.3BSD version suffers legal problems that
+ * prevent it from being redistributed, and since the 4.4BSD version
+ * was pretty inferior in functionality.
+ */
+
+#include <sys/types.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+
+#define NO_BIN_FOUND 1
+#define NO_MAN_FOUND 2
+#define NO_SRC_FOUND 4
+
+typedef const char *ccharp;
+
+static int opt_a, opt_b, opt_m, opt_q, opt_s, opt_u, opt_x;
+static ccharp *bindirs, *mandirs, *sourcedirs;
+static char **query;
+
+static const char *sourcepath = PATH_SOURCES;
+
+static char *colonify(ccharp *);
+static int contains(ccharp *, const char *);
+static void decolonify(char *, ccharp **, int *);
+static void defaults(void);
+static void scanopts(int, char **);
+static void usage(void);
+
+/*
+ * Throughout this program, a number of strings are dynamically
+ * allocated but never freed. Their memory is written to when
+ * splitting the strings into string lists which will later be
+ * processed. Since it's important that those string lists remain
+ * valid even after the functions allocating the memory returned,
+ * those functions cannot free them. They could be freed only at end
+ * of main(), which is pretty pointless anyway.
+ *
+ * The overall amount of memory to be allocated for processing the
+ * strings is not expected to exceed a few kilobytes. For that
+ * reason, allocation can usually always be assumed to succeed (within
+ * a virtual memory environment), thus we simply bail out using
+ * abort(3) in case of an allocation failure.
+ */
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: whereis [-abmqsux] [-BMS dir ... -f] program ...\n");
+ exit(EX_USAGE);
+}
+
+/*
+ * Scan options passed to program.
+ *
+ * Note that the -B/-M/-S options expect a list of directory
+ * names that must be terminated with -f.
+ */
+static void
+scanopts(int argc, char **argv)
+{
+ int c, i;
+ ccharp **dirlist;
+
+ while ((c = getopt(argc, argv, "BMSabfmqsux")) != -1)
+ switch (c) {
+ case 'B':
+ dirlist = &bindirs;
+ goto dolist;
+
+ case 'M':
+ dirlist = &mandirs;
+ goto dolist;
+
+ case 'S':
+ dirlist = &sourcedirs;
+ dolist:
+ i = 0;
+ *dirlist = realloc(*dirlist, (i + 1) * sizeof(char *));
+ (*dirlist)[i] = NULL;
+ while (optind < argc &&
+ strcmp(argv[optind], "-f") != 0 &&
+ strcmp(argv[optind], "-B") != 0 &&
+ strcmp(argv[optind], "-M") != 0 &&
+ strcmp(argv[optind], "-S") != 0) {
+ decolonify(argv[optind], dirlist, &i);
+ optind++;
+ }
+ break;
+
+ case 'a':
+ opt_a = 1;
+ break;
+
+ case 'b':
+ opt_b = 1;
+ break;
+
+ case 'f':
+ goto breakout;
+
+ case 'm':
+ opt_m = 1;
+ break;
+
+ case 'q':
+ opt_q = 1;
+ break;
+
+ case 's':
+ opt_s = 1;
+ break;
+
+ case 'u':
+ opt_u = 1;
+ break;
+
+ case 'x':
+ opt_x = 1;
+ break;
+
+ default:
+ usage();
+ }
+ breakout:
+ if (optind == argc)
+ usage();
+ query = argv + optind;
+}
+
+/*
+ * Find out whether string `s' is contained in list `cpp'.
+ */
+static int
+contains(ccharp *cpp, const char *s)
+{
+ ccharp cp;
+
+ if (cpp == NULL)
+ return (0);
+
+ while ((cp = *cpp) != NULL) {
+ if (strcmp(cp, s) == 0)
+ return (1);
+ cpp++;
+ }
+ return (0);
+}
+
+/*
+ * Split string `s' at colons, and pass it to the string list pointed
+ * to by `cppp' (which has `*ip' elements). Note that the original
+ * string is modified by replacing the colon with a NUL byte. The
+ * partial string is only added if it has a length greater than 0, and
+ * if it's not already contained in the string list.
+ */
+static void
+decolonify(char *s, ccharp **cppp, int *ip)
+{
+ char *cp;
+
+ while ((cp = strchr(s, ':')), *s != '\0') {
+ if (cp)
+ *cp = '\0';
+ if (strlen(s) && !contains(*cppp, s)) {
+ *cppp = realloc(*cppp, (*ip + 2) * sizeof(char *));
+ if (*cppp == NULL)
+ abort();
+ (*cppp)[*ip] = s;
+ (*cppp)[*ip + 1] = NULL;
+ (*ip)++;
+ }
+ if (cp)
+ s = cp + 1;
+ else
+ break;
+ }
+}
+
+/*
+ * Join string list `cpp' into a colon-separated string.
+ */
+static char *
+colonify(ccharp *cpp)
+{
+ size_t s;
+ char *cp;
+ int i;
+
+ if (cpp == NULL)
+ return (0);
+
+ for (s = 0, i = 0; cpp[i] != NULL; i++)
+ s += strlen(cpp[i]) + 1;
+ if ((cp = malloc(s + 1)) == NULL)
+ abort();
+ for (i = 0, *cp = '\0'; cpp[i] != NULL; i++) {
+ strcat(cp, cpp[i]);
+ strcat(cp, ":");
+ }
+ cp[s - 1] = '\0'; /* eliminate last colon */
+
+ return (cp);
+}
+
+/*
+ * Provide defaults for all options and directory lists.
+ */
+static void
+defaults(void)
+{
+ size_t s;
+ char *b, buf[BUFSIZ], *cp;
+ int nele;
+ FILE *p;
+ DIR *dir;
+ struct stat sb;
+ struct dirent *dirp;
+
+ /* default to -bms if none has been specified */
+ if (!opt_b && !opt_m && !opt_s)
+ opt_b = opt_m = opt_s = 1;
+
+ /* -b defaults to default path + /usr/libexec +
+ * user's path */
+ if (!bindirs) {
+ if (sysctlbyname("user.cs_path", (void *)NULL, &s,
+ (void *)NULL, 0) == -1)
+ err(EX_OSERR, "sysctlbyname(\"user.cs_path\")");
+ if ((b = malloc(s + 1)) == NULL)
+ abort();
+ if (sysctlbyname("user.cs_path", b, &s, (void *)NULL, 0) == -1)
+ err(EX_OSERR, "sysctlbyname(\"user.cs_path\")");
+ nele = 0;
+ decolonify(b, &bindirs, &nele);
+ bindirs = realloc(bindirs, (nele + 2) * sizeof(char *));
+ if (bindirs == NULL)
+ abort();
+ bindirs[nele++] = PATH_LIBEXEC;
+ bindirs[nele] = NULL;
+ if ((cp = getenv("PATH")) != NULL) {
+ /* don't destroy the original environment... */
+ if ((b = malloc(strlen(cp) + 1)) == NULL)
+ abort();
+ strcpy(b, cp);
+ decolonify(b, &bindirs, &nele);
+ }
+ }
+
+ /* -m defaults to $(manpath) */
+ if (!mandirs) {
+ if ((p = popen(MANPATHCMD, "r")) == NULL)
+ err(EX_OSERR, "cannot execute manpath command");
+ if (fgets(buf, BUFSIZ - 1, p) == NULL ||
+ pclose(p))
+ err(EX_OSERR, "error processing manpath results");
+ if ((b = strchr(buf, '\n')) != NULL)
+ *b = '\0';
+ if ((b = malloc(strlen(buf) + 1)) == NULL)
+ abort();
+ strcpy(b, buf);
+ nele = 0;
+ decolonify(b, &mandirs, &nele);
+ }
+
+ /* -s defaults to precompiled list, plus subdirs of /usr/ports */
+ if (!sourcedirs) {
+ if ((b = malloc(strlen(sourcepath) + 1)) == NULL)
+ abort();
+ strcpy(b, sourcepath);
+ nele = 0;
+ decolonify(b, &sourcedirs, &nele);
+
+ if (stat(PATH_PORTS, &sb) == -1) {
+ if (errno == ENOENT)
+ /* no /usr/ports, we are done */
+ return;
+ err(EX_OSERR, "stat(" PATH_PORTS ")");
+ }
+ if ((sb.st_mode & S_IFMT) != S_IFDIR)
+ /* /usr/ports is not a directory, ignore */
+ return;
+ if (access(PATH_PORTS, R_OK | X_OK) != 0)
+ return;
+ if ((dir = opendir(PATH_PORTS)) == NULL)
+ err(EX_OSERR, "opendir" PATH_PORTS ")");
+ while ((dirp = readdir(dir)) != NULL) {
+ /*
+ * Not everything below PATH_PORTS is of
+ * interest. First, all dot files and
+ * directories (e. g. .snap) can be ignored.
+ * Also, all subdirectories starting with a
+ * capital letter are not going to be
+ * examined, as they are used for internal
+ * purposes (Mk, Tools, ...). This also
+ * matches a possible CVS subdirectory.
+ * Finally, the distfiles subdirectory is also
+ * special, and should not be considered to
+ * avoid false matches.
+ */
+ if (dirp->d_name[0] == '.' ||
+ /*
+ * isupper() not used on purpose: the
+ * check is supposed to default to the C
+ * locale instead of the current user's
+ * locale.
+ */
+ (dirp->d_name[0] >= 'A' && dirp->d_name[0] <= 'Z') ||
+ strcmp(dirp->d_name, "distfiles") == 0)
+ continue;
+ if ((b = malloc(sizeof PATH_PORTS + 1 + dirp->d_namlen))
+ == NULL)
+ abort();
+ strcpy(b, PATH_PORTS);
+ strcat(b, "/");
+ strcat(b, dirp->d_name);
+ if (stat(b, &sb) == -1 ||
+ (sb.st_mode & S_IFMT) != S_IFDIR ||
+ access(b, R_OK | X_OK) != 0) {
+ free(b);
+ continue;
+ }
+ sourcedirs = realloc(sourcedirs,
+ (nele + 2) * sizeof(char *));
+ if (sourcedirs == NULL)
+ abort();
+ sourcedirs[nele++] = b;
+ sourcedirs[nele] = NULL;
+ }
+ closedir(dir);
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ int unusual, i, printed;
+ char *bin, buf[BUFSIZ], *cp, *cp2, *man, *name, *src;
+ ccharp *dp;
+ size_t nlen, olen, s;
+ struct stat sb;
+ regex_t re, re2;
+ regmatch_t matches[2];
+ regoff_t rlen;
+ FILE *p;
+
+ setlocale(LC_ALL, "");
+
+ scanopts(argc, argv);
+ defaults();
+
+ if (mandirs == NULL)
+ opt_m = 0;
+ if (bindirs == NULL)
+ opt_b = 0;
+ if (sourcedirs == NULL)
+ opt_s = 0;
+ if (opt_m + opt_b + opt_s == 0)
+ errx(EX_DATAERR, "no directories to search");
+
+ if (opt_m) {
+ setenv("MANPATH", colonify(mandirs), 1);
+ if ((i = regcomp(&re, MANWHEREISMATCH, REG_EXTENDED)) != 0) {
+ regerror(i, &re, buf, BUFSIZ - 1);
+ errx(EX_UNAVAILABLE, "regcomp(%s) failed: %s",
+ MANWHEREISMATCH, buf);
+ }
+ }
+
+ for (; (name = *query) != NULL; query++) {
+ /* strip leading path name component */
+ if ((cp = strrchr(name, '/')) != NULL)
+ name = cp + 1;
+ /* strip SCCS or RCS suffix/prefix */
+ if (strlen(name) > 2 && strncmp(name, "s.", 2) == 0)
+ name += 2;
+ if ((s = strlen(name)) > 2 && strcmp(name + s - 2, ",v") == 0)
+ name[s - 2] = '\0';
+ /* compression suffix */
+ s = strlen(name);
+ if (s > 2 &&
+ (strcmp(name + s - 2, ".z") == 0 ||
+ strcmp(name + s - 2, ".Z") == 0))
+ name[s - 2] = '\0';
+ else if (s > 3 &&
+ strcmp(name + s - 3, ".gz") == 0)
+ name[s - 3] = '\0';
+ else if (s > 4 &&
+ strcmp(name + s - 4, ".bz2") == 0)
+ name[s - 4] = '\0';
+
+ unusual = 0;
+ bin = man = src = NULL;
+ s = strlen(name);
+
+ if (opt_b) {
+ /*
+ * Binaries have to match exactly, and must be regular
+ * executable files.
+ */
+ unusual = unusual | NO_BIN_FOUND;
+ for (dp = bindirs; *dp != NULL; dp++) {
+ cp = malloc(strlen(*dp) + 1 + s + 1);
+ if (cp == NULL)
+ abort();
+ strcpy(cp, *dp);
+ strcat(cp, "/");
+ strcat(cp, name);
+ if (stat(cp, &sb) == 0 &&
+ (sb.st_mode & S_IFMT) == S_IFREG &&
+ (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
+ != 0) {
+ unusual = unusual & ~NO_BIN_FOUND;
+ if (bin == NULL) {
+ bin = strdup(cp);
+ } else {
+ olen = strlen(bin);
+ nlen = strlen(cp);
+ bin = realloc(bin,
+ olen + nlen + 2);
+ if (bin == NULL)
+ abort();
+ strcat(bin, " ");
+ strcat(bin, cp);
+ }
+ if (!opt_a) {
+ free(cp);
+ break;
+ }
+ }
+ free(cp);
+ }
+ }
+
+ if (opt_m) {
+ /*
+ * Ask the man command to perform the search for us.
+ */
+ unusual = unusual | NO_MAN_FOUND;
+ if (opt_a)
+ cp = malloc(sizeof MANWHEREISALLCMD - 2 + s);
+ else
+ cp = malloc(sizeof MANWHEREISCMD - 2 + s);
+
+ if (cp == NULL)
+ abort();
+
+ if (opt_a)
+ sprintf(cp, MANWHEREISALLCMD, name);
+ else
+ sprintf(cp, MANWHEREISCMD, name);
+
+ if ((p = popen(cp, "r")) != NULL) {
+
+ while (fgets(buf, BUFSIZ - 1, p) != NULL) {
+ unusual = unusual & ~NO_MAN_FOUND;
+
+ if ((cp2 = strchr(buf, '\n')) != NULL)
+ *cp2 = '\0';
+ if (regexec(&re, buf, 2,
+ matches, 0) == 0 &&
+ (rlen = matches[1].rm_eo -
+ matches[1].rm_so) > 0) {
+ /*
+ * man -w found formatted
+ * page, need to pick up
+ * source page name.
+ */
+ cp2 = malloc(rlen + 1);
+ if (cp2 == NULL)
+ abort();
+ memcpy(cp2,
+ buf + matches[1].rm_so,
+ rlen);
+ cp2[rlen] = '\0';
+ } else {
+ /*
+ * man -w found plain source
+ * page, use it.
+ */
+ s = strlen(buf);
+ cp2 = malloc(s + 1);
+ if (cp2 == NULL)
+ abort();
+ strcpy(cp2, buf);
+ }
+
+ if (man == NULL) {
+ man = strdup(cp2);
+ } else {
+ olen = strlen(man);
+ nlen = strlen(cp2);
+ man = realloc(man,
+ olen + nlen + 2);
+ if (man == NULL)
+ abort();
+ strcat(man, " ");
+ strcat(man, cp2);
+ }
+
+ free(cp2);
+
+ if (!opt_a)
+ break;
+ }
+ pclose(p);
+ free(cp);
+ }
+ }
+
+ if (opt_s) {
+ /*
+ * Sources match if a subdir with the exact
+ * name is found.
+ */
+ unusual = unusual | NO_SRC_FOUND;
+ for (dp = sourcedirs; *dp != NULL; dp++) {
+ cp = malloc(strlen(*dp) + 1 + s + 1);
+ if (cp == NULL)
+ abort();
+ strcpy(cp, *dp);
+ strcat(cp, "/");
+ strcat(cp, name);
+ if (stat(cp, &sb) == 0 &&
+ (sb.st_mode & S_IFMT) == S_IFDIR) {
+ unusual = unusual & ~NO_SRC_FOUND;
+ if (src == NULL) {
+ src = strdup(cp);
+ } else {
+ olen = strlen(src);
+ nlen = strlen(cp);
+ src = realloc(src,
+ olen + nlen + 2);
+ if (src == NULL)
+ abort();
+ strcat(src, " ");
+ strcat(src, cp);
+ }
+ if (!opt_a) {
+ free(cp);
+ break;
+ }
+ }
+ free(cp);
+ }
+ /*
+ * If still not found, ask locate to search it
+ * for us. This will find sources for things
+ * like lpr that are well hidden in the
+ * /usr/src tree, but takes a lot longer.
+ * Thus, option -x (`expensive') prevents this
+ * search.
+ *
+ * Do only match locate output that starts
+ * with one of our source directories, and at
+ * least one further level of subdirectories.
+ */
+ if (opt_x || (src && !opt_a))
+ goto done_sources;
+
+ cp = malloc(sizeof LOCATECMD - 2 + s);
+ if (cp == NULL)
+ abort();
+ sprintf(cp, LOCATECMD, name);
+ if ((p = popen(cp, "r")) == NULL)
+ goto done_sources;
+ while ((src == NULL || opt_a) &&
+ (fgets(buf, BUFSIZ - 1, p)) != NULL) {
+ if ((cp2 = strchr(buf, '\n')) != NULL)
+ *cp2 = '\0';
+ for (dp = sourcedirs;
+ (src == NULL || opt_a) && *dp != NULL;
+ dp++) {
+ cp2 = malloc(strlen(*dp) + 9);
+ if (cp2 == NULL)
+ abort();
+ strcpy(cp2, "^");
+ strcat(cp2, *dp);
+ strcat(cp2, "/[^/]+/");
+ if ((i = regcomp(&re2, cp2,
+ REG_EXTENDED|REG_NOSUB))
+ != 0) {
+ regerror(i, &re, buf,
+ BUFSIZ - 1);
+ errx(EX_UNAVAILABLE,
+ "regcomp(%s) failed: %s",
+ cp2, buf);
+ }
+ free(cp2);
+ if (regexec(&re2, buf, 0,
+ (regmatch_t *)NULL, 0)
+ == 0) {
+ unusual = unusual &
+ ~NO_SRC_FOUND;
+ if (src == NULL) {
+ src = strdup(buf);
+ } else {
+ olen = strlen(src);
+ nlen = strlen(buf);
+ src = realloc(src,
+ olen +
+ nlen + 2);
+ if (src == NULL)
+ abort();
+ strcat(src, " ");
+ strcat(src, buf);
+ }
+ }
+ regfree(&re2);
+ }
+ }
+ pclose(p);
+ free(cp);
+ }
+ done_sources:
+
+ if (opt_u && !unusual)
+ continue;
+
+ printed = 0;
+ if (!opt_q) {
+ printf("%s:", name);
+ printed++;
+ }
+ if (bin) {
+ if (printed++)
+ putchar(' ');
+ fputs(bin, stdout);
+ }
+ if (man) {
+ if (printed++)
+ putchar(' ');
+ fputs(man, stdout);
+ }
+ if (src) {
+ if (printed++)
+ putchar(' ');
+ fputs(src, stdout);
+ }
+ if (printed)
+ putchar('\n');
+ }
+
+ if (opt_m)
+ regfree(&re);
+
+ return (0);
+}
diff --git a/usr.bin/which/Makefile b/usr.bin/which/Makefile
new file mode 100644
index 0000000..fdc121b
--- /dev/null
+++ b/usr.bin/which/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= which
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/which/Makefile.depend b/usr.bin/which/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/which/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/which/which.1 b/usr.bin/which/which.1
new file mode 100644
index 0000000..0c0dce82
--- /dev/null
+++ b/usr.bin/which/which.1
@@ -0,0 +1,85 @@
+.\" Manpage Copyright (c) 1995, Jordan Hubbard <jkh@FreeBSD.org>
+.\"
+.\" 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 the FreeBSD Project
+.\" its contributors.
+.\" 4. Neither the name of the FreeBSD Project 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 CONTRIBUTOR ``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 CONTRIBUTOR 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 December 13, 2006
+.Dt WHICH 1
+.Os
+.Sh NAME
+.Nm which
+.Nd "locate a program file in the user's path"
+.Sh SYNOPSIS
+.Nm
+.Op Fl as
+.Ar program ...
+.Sh DESCRIPTION
+The
+.Nm
+utility
+takes a list of command names and searches the path for each executable
+file that would be run had these commands actually been invoked.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+List all instances of executables found (instead of just the first one
+of each).
+.It Fl s
+No output, just return 0 if all of the executables are found, or 1 if
+some were not found.
+.El
+.Pp
+Some shells may provide a builtin
+.Nm
+command which is similar or identical to this utility.
+Consult the
+.Xr builtin 1
+manual page.
+.Sh SEE ALSO
+.Xr builtin 1 ,
+.Xr csh 1 ,
+.Xr find 1 ,
+.Xr locate 1 ,
+.Xr whereis 1
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 2.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+utility was originally written in Perl and was contributed by
+.An Wolfram Schneider Aq Mt wosch@FreeBSD.org .
+The current version of
+.Nm
+was rewritten in C by
+.An Daniel Papasian Aq Mt dpapasia@andrew.cmu.edu .
diff --git a/usr.bin/which/which.c b/usr.bin/which/which.c
new file mode 100644
index 0000000..2c11b80
--- /dev/null
+++ b/usr.bin/which/which.c
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2000 Dan Papasian. 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. 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+#include <sys/param.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void usage(void);
+static int print_matches(char *, char *);
+
+static int silent;
+static int allpaths;
+
+int
+main(int argc, char **argv)
+{
+ char *p, *path;
+ ssize_t pathlen;
+ int opt, status;
+
+ status = EXIT_SUCCESS;
+
+ while ((opt = getopt(argc, argv, "as")) != -1) {
+ switch (opt) {
+ case 'a':
+ allpaths = 1;
+ break;
+ case 's':
+ silent = 1;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argv += optind;
+ argc -= optind;
+
+ if (argc == 0)
+ usage();
+
+ if ((p = getenv("PATH")) == NULL)
+ exit(EXIT_FAILURE);
+ pathlen = strlen(p) + 1;
+ path = malloc(pathlen);
+ if (path == NULL)
+ err(EXIT_FAILURE, NULL);
+
+ while (argc > 0) {
+ memcpy(path, p, pathlen);
+
+ if (strlen(*argv) >= FILENAME_MAX ||
+ print_matches(path, *argv) == -1)
+ status = EXIT_FAILURE;
+
+ argv++;
+ argc--;
+ }
+
+ exit(status);
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr, "usage: which [-as] program ...\n");
+ exit(EXIT_FAILURE);
+}
+
+static int
+is_there(char *candidate)
+{
+ struct stat fin;
+
+ /* XXX work around access(2) false positives for superuser */
+ if (access(candidate, X_OK) == 0 &&
+ stat(candidate, &fin) == 0 &&
+ S_ISREG(fin.st_mode) &&
+ (getuid() != 0 ||
+ (fin.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0)) {
+ if (!silent)
+ printf("%s\n", candidate);
+ return (1);
+ }
+ return (0);
+}
+
+static int
+print_matches(char *path, char *filename)
+{
+ char candidate[PATH_MAX];
+ const char *d;
+ int found;
+
+ if (strchr(filename, '/') != NULL)
+ return (is_there(filename) ? 0 : -1);
+ found = 0;
+ while ((d = strsep(&path, ":")) != NULL) {
+ if (*d == '\0')
+ d = ".";
+ if (snprintf(candidate, sizeof(candidate), "%s/%s", d,
+ filename) >= (int)sizeof(candidate))
+ continue;
+ if (is_there(candidate)) {
+ found = 1;
+ if (!allpaths)
+ break;
+ }
+ }
+ return (found ? 0 : -1);
+}
+
diff --git a/usr.bin/who/Makefile b/usr.bin/who/Makefile
new file mode 100644
index 0000000..0478d73
--- /dev/null
+++ b/usr.bin/who/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= who
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/who/Makefile.depend b/usr.bin/who/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/who/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/who/who.1 b/usr.bin/who/who.1
new file mode 100644
index 0000000..d23ef8e
--- /dev/null
+++ b/usr.bin/who/who.1
@@ -0,0 +1,157 @@
+.\" Copyright (c) 1986, 1991, 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.
+.\"
+.\" @(#)who.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd February 11, 2012
+.Dt WHO 1
+.Os
+.Sh NAME
+.Nm who
+.Nd display who is on the system
+.Sh SYNOPSIS
+.Nm
+.Op Fl abHmqsTu
+.Op Cm am I
+.Op Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility displays information about currently logged in users.
+By default, this includes the login name, tty name, date and time of login and
+remote hostname if not local.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+Equivalent to
+.Fl bTu ,
+with the exception that output is not restricted to the time and date of
+the last system reboot.
+.It Fl b
+Write the time and date of the last system reboot.
+.It Fl H
+Write column headings above the output.
+.It Fl m
+Show information about the terminal attached to standard input only.
+.It Fl q
+.Dq "Quick mode" :
+List the names and number of logged in users in columns.
+All other command line options are ignored.
+.It Fl s
+Show the name, line and time fields only.
+This is the default.
+.It Fl T
+Indicate whether each user is accepting messages.
+One of the following characters is written:
+.Pp
+.Bl -tag -width 1n -compact
+.It Li +
+User is accepting messages.
+.It Li \&-
+User is not accepting messages.
+.It Li \&?
+An error occurred.
+.El
+.It Fl u
+Show idle time for each user in hours and minutes as
+.Ar hh Ns : Ns Ar mm ,
+.Ql \&.
+if the user has been idle less than a minute, and
+.Dq Li old
+if the user has been idle more than 24 hours.
+.It Cm am I
+Equivalent to
+.Fl m .
+.El
+.Pp
+By default,
+.Nm
+gathers information from the file
+.Pa /var/run/utx.active .
+An alternate
+.Ar file
+may be specified which is usually
+.Pa /var/log/utx.log
+(or
+.Pa /var/log/utx.log.[0-6]
+depending on site policy as
+.Pa utx.log
+can grow quite large and daily versions may or may not
+be kept around after compression by
+.Xr ac 8 ) .
+The
+.Pa utx.log
+file contains a record of every login, logout,
+crash, shutdown and date change
+since
+.Pa utx.log
+was last truncated or
+created.
+.Pp
+If
+.Pa /var/log/utx.log
+is being used as the file, the user name may be empty
+or one of the special characters '|', '}' and '~'.
+Logouts produce
+an output line without any user name.
+For more information on the
+special characters, see
+.Xr getutxent 3 .
+.Sh ENVIRONMENT
+The
+.Ev COLUMNS , LANG , LC_ALL
+and
+.Ev LC_TIME
+environment variables affect the execution of
+.Nm
+as described in
+.Xr environ 7 .
+.Sh FILES
+.Bl -tag -width /var/log/utx.log.[0-6] -compact
+.It Pa /var/run/utx.active
+.It Pa /var/log/utx.log
+.It Pa /var/log/utx.log.[0-6]
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr last 1 ,
+.Xr users 1 ,
+.Xr w 1 ,
+.Xr getutxent 3
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
new file mode 100644
index 0000000..75493b1
--- /dev/null
+++ b/usr.bin/who/who.c
@@ -0,0 +1,313 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins.
+ * 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/types.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+
+#include <err.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <limits.h>
+#include <locale.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <timeconv.h>
+#include <unistd.h>
+#include <utmpx.h>
+
+static void heading(void);
+static void process_utmp(void);
+static void quick(void);
+static void row(const struct utmpx *);
+static int ttywidth(void);
+static void usage(void);
+static void whoami(void);
+
+static int Hflag; /* Write column headings */
+static int aflag; /* Print all entries */
+static int bflag; /* Show date of the last reboot */
+static int mflag; /* Show info about current terminal */
+static int qflag; /* "Quick" mode */
+static int sflag; /* Show name, line, time */
+static int Tflag; /* Show terminal state */
+static int uflag; /* Show idle time */
+
+int
+main(int argc, char *argv[])
+{
+ int ch;
+
+ setlocale(LC_TIME, "");
+
+ while ((ch = getopt(argc, argv, "HTabmqsu")) != -1) {
+ switch (ch) {
+ case 'H': /* Write column headings */
+ Hflag = 1;
+ break;
+ case 'T': /* Show terminal state */
+ Tflag = 1;
+ break;
+ case 'a': /* Same as -bdlprtTu */
+ aflag = bflag = Tflag = uflag = 1;
+ break;
+ case 'b': /* Show date of the last reboot */
+ bflag = 1;
+ break;
+ case 'm': /* Show info about current terminal */
+ mflag = 1;
+ break;
+ case 'q': /* "Quick" mode */
+ qflag = 1;
+ break;
+ case 's': /* Show name, line, time */
+ sflag = 1;
+ break;
+ case 'u': /* Show idle time */
+ uflag = 1;
+ break;
+ default:
+ usage();
+ /*NOTREACHED*/
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc >= 2 && strcmp(argv[0], "am") == 0 &&
+ (strcmp(argv[1], "i") == 0 || strcmp(argv[1], "I") == 0)) {
+ /* "who am i" or "who am I", equivalent to -m */
+ mflag = 1;
+ argc -= 2;
+ argv += 2;
+ }
+ if (argc > 1)
+ usage();
+
+ if (*argv != NULL) {
+ if (setutxdb(UTXDB_ACTIVE, *argv) != 0)
+ err(1, "%s", *argv);
+ }
+
+ if (qflag)
+ quick();
+ else {
+ if (sflag)
+ Tflag = uflag = 0;
+ if (Hflag)
+ heading();
+ if (mflag)
+ whoami();
+ else
+ process_utmp();
+ }
+
+ endutxent();
+
+ exit(0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: who [-abHmqsTu] [am I] [file]\n");
+ exit(1);
+}
+
+static void
+heading(void)
+{
+
+ printf("%-16s ", "NAME");
+ if (Tflag)
+ printf("S ");
+ printf("%-12s %-12s ", "LINE", "TIME");
+ if (uflag)
+ printf("IDLE ");
+ printf("%-16s\n", "FROM");
+}
+
+static void
+row(const struct utmpx *ut)
+{
+ char buf[80], tty[PATH_MAX];
+ struct stat sb;
+ time_t idle, t;
+ static int d_first = -1;
+ struct tm *tm;
+ char state;
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+
+ state = '?';
+ idle = 0;
+ if (Tflag || uflag) {
+ snprintf(tty, sizeof(tty), "%s%s", _PATH_DEV, ut->ut_line);
+ if (stat(tty, &sb) == 0) {
+ state = sb.st_mode & (S_IWOTH|S_IWGRP) ?
+ '+' : '-';
+ idle = time(NULL) - sb.st_mtime;
+ }
+ }
+
+ printf("%-16s ", ut->ut_user);
+ if (Tflag)
+ printf("%c ", state);
+ if (ut->ut_type == BOOT_TIME)
+ printf("%-12s ", "system boot");
+ else
+ printf("%-12s ", ut->ut_line);
+ t = ut->ut_tv.tv_sec;
+ tm = localtime(&t);
+ strftime(buf, sizeof(buf), d_first ? "%e %b %R" : "%b %e %R", tm);
+ printf("%-*s ", 12, buf);
+ if (uflag) {
+ if (idle < 60)
+ printf(" . ");
+ else if (idle < 24 * 60 * 60)
+ printf("%02d:%02d ", (int)(idle / 60 / 60),
+ (int)(idle / 60 % 60));
+ else
+ printf(" old ");
+ }
+ if (*ut->ut_host != '\0')
+ printf("(%s)", ut->ut_host);
+ putchar('\n');
+}
+
+static int
+ttystat(char *line)
+{
+ struct stat sb;
+ char ttybuf[MAXPATHLEN];
+
+ (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line);
+ if (stat(ttybuf, &sb) == 0) {
+ return (0);
+ } else
+ return (-1);
+}
+
+static void
+process_utmp(void)
+{
+ struct utmpx *utx;
+
+ while ((utx = getutxent()) != NULL) {
+ if (((aflag || !bflag) && utx->ut_type == USER_PROCESS) ||
+ (bflag && utx->ut_type == BOOT_TIME))
+ if (ttystat(utx->ut_line) == 0)
+ row(utx);
+ }
+}
+
+static void
+quick(void)
+{
+ struct utmpx *utx;
+ int col, ncols, num;
+
+ ncols = ttywidth();
+ col = num = 0;
+ while ((utx = getutxent()) != NULL) {
+ if (utx->ut_type != USER_PROCESS)
+ continue;
+ printf("%-16s", utx->ut_user);
+ if (++col < ncols / (16 + 1))
+ putchar(' ');
+ else {
+ col = 0;
+ putchar('\n');
+ }
+ num++;
+ }
+ if (col != 0)
+ putchar('\n');
+
+ printf("# users = %d\n", num);
+}
+
+static void
+whoami(void)
+{
+ struct utmpx ut, *utx;
+ struct passwd *pwd;
+ const char *name, *tty;
+
+ if ((tty = ttyname(STDIN_FILENO)) == NULL)
+ tty = "tty??";
+ else if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
+ tty += sizeof _PATH_DEV - 1;
+ strlcpy(ut.ut_line, tty, sizeof ut.ut_line);
+
+ /* Search utmp for our tty, dump first matching record. */
+ if ((utx = getutxline(&ut)) != NULL && utx->ut_type == USER_PROCESS) {
+ row(utx);
+ return;
+ }
+
+ /* Not found; fill the utmp structure with the information we have. */
+ memset(&ut, 0, sizeof(ut));
+ if ((pwd = getpwuid(getuid())) != NULL)
+ name = pwd->pw_name;
+ else
+ name = "?";
+ strlcpy(ut.ut_user, name, sizeof ut.ut_user);
+ gettimeofday(&ut.ut_tv, NULL);
+ row(&ut);
+}
+
+static int
+ttywidth(void)
+{
+ struct winsize ws;
+ long width;
+ char *cols, *ep;
+
+ if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') {
+ errno = 0;
+ width = strtol(cols, &ep, 10);
+ if (errno || width <= 0 || width > INT_MAX || ep == cols ||
+ *ep != '\0')
+ warnx("invalid COLUMNS environment variable ignored");
+ else
+ return (width);
+ }
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1)
+ return (ws.ws_col);
+
+ return (80);
+}
diff --git a/usr.bin/whois/Makefile b/usr.bin/whois/Makefile
new file mode 100644
index 0000000..e6f82fd
--- /dev/null
+++ b/usr.bin/whois/Makefile
@@ -0,0 +1,13 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= whois
+
+.if defined(SOCKS)
+CFLAGS+=-DSOCKS
+CFLAGS+=-Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dlisten=Rlisten \
+ -Daccept=Raccept -Drcmd=Rrcmd -Dbind=Rbind -Dselect=Rselect
+LDADD+= -lsocks
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/whois/Makefile.depend b/usr.bin/whois/Makefile.depend
new file mode 100644
index 0000000..54c1f6f
--- /dev/null
+++ b/usr.bin/whois/Makefile.depend
@@ -0,0 +1,19 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ 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/whois/whois.1 b/usr.bin/whois/whois.1
new file mode 100644
index 0000000..0fe70a1
--- /dev/null
+++ b/usr.bin/whois/whois.1
@@ -0,0 +1,287 @@
+.\" Copyright (c) 1985, 1990, 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.
+.\"
+.\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd April 25, 2016
+.Dt WHOIS 1
+.Os
+.Sh NAME
+.Nm whois
+.Nd "Internet domain name and network number directory service"
+.Sh SYNOPSIS
+.Nm
+.Op Fl aAbfgiIklmPQrRS
+.Op Fl c Ar TLD | Fl h Ar host
+.Op Fl p Ar port
+.Op Fl -
+.Ar name ...
+.Sh DESCRIPTION
+The
+.Nm
+utility looks up records in the databases maintained by several
+Network Information Centers
+.Pq Tn NICs .
+.Pp
+By default
+.Nm
+starts by querying the Internet Assigned Numbers Authority (IANA) whois server,
+and follows referrals to whois servers
+that have more specific details about the query
+.Ar name .
+The IANA whois server knows about
+IP address and AS numbers
+as well as domain names.
+.Pp
+There are a few special cases where referrals do not work, so
+.Nm
+goes directly to the appropriate server.
+These include point-of-contact handles for ARIN,
+.Pa nic.at ,
+NORID, and RIPE,
+and domain names under
+.Pa ac.uk .
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+Use the American Registry for Internet Numbers
+.Pq Tn ARIN
+database.
+It contains network numbers used in those parts of the world covered neither by
+.Tn APNIC , AfriNIC , LACNIC ,
+nor by
+.Tn RIPE .
+The query syntax is documented at
+.Pa https://www.arin.net/resources/whoisrws/whois_api.html#nicname
+.It Fl A
+Use the Asia/Pacific Network Information Center
+.Pq Tn APNIC
+database.
+It contains network numbers used in East Asia, Australia,
+New Zealand, and the Pacific islands.
+Get query syntax documentation using
+.Ic whois -A help
+.It Fl b
+Use the Network Abuse Clearinghouse database.
+It contains addresses to which network abuse should be reported,
+indexed by domain name.
+.It Fl c Ar TLD
+This is the equivalent of using the
+.Fl h
+option with an argument of
+.Qq Ar TLD Ns Li .whois-servers.net .
+This can be helpful for locating country-class TLD whois servers.
+.It Fl f
+Use the African Network Information Centre
+.Pq Tn AfriNIC
+database.
+It contains network numbers used in Africa and the islands of the
+western Indian Ocean.
+Get query syntax documentation using
+.Ic whois -f help
+.It Fl g
+Use the US non-military federal government database, which contains points of
+contact for subdomains of
+.Pa .GOV .
+.It Fl h Ar host
+Use the specified host instead of the default.
+Either a host name or an IP address may be specified.
+.It Fl i
+Use the traditional Network Information Center (InterNIC)
+.Pq Pa whois.internic.net
+database.
+This now contains only registrations for domain names under
+.Pa .COM ,
+.Pa .NET ,
+.Pa .EDU .
+You can specify the type of object to search for like
+.Ic whois -i ' Ns Ar type Ar name Ns Ic '
+where
+.Ar type
+can be
+.Nm domain , nameserver , registrar .
+The
+.Ar name
+can contain
+.Li *
+wildcards.
+.It Fl I
+Use the Internet Assigned Numbers Authority
+.Pq Tn IANA
+database.
+.It Fl k
+Use the National Internet Development Agency of Korea's
+.Pq Tn KRNIC
+database.
+It contains network numbers and domain contact information
+for Korea.
+.It Fl l
+Use the Latin American and Caribbean IP address Regional Registry
+.Pq Tn LACNIC
+database.
+It contains network numbers used in much of Latin America and the
+Caribbean.
+.It Fl m
+Use the Route Arbiter Database
+.Pq Tn RADB
+database.
+It contains route policy specifications for a large
+number of operators' networks.
+.It Fl p Ar port
+Connect to the whois server on
+.Ar port .
+If this option is not specified,
+.Nm
+defaults to port 43.
+.It Fl P
+Use the PeeringDB database of AS numbers.
+It contains details about presence at internet peering points
+for many network operators.
+.It Fl Q
+Do a quick lookup;
+.Nm
+will not attempt to follow referrals to other whois servers.
+This is the default if a server is explicitly specified
+using one of the other options or in an environment variable.
+See also the
+.Fl R
+option.
+.It Fl r
+Use the R\(aaeseaux IP Europ\(aaeens
+.Pq Tn RIPE
+database.
+It contains network numbers and domain contact information
+for Europe.
+Get query syntax documentation using
+.Ic whois -r help
+.It Fl R
+Do a recursive lookup;
+.Nm
+will attempt to follow referrals to other whois servers.
+This is the default if no server is explicitly specified.
+See also the
+.Fl Q
+option.
+.It Fl S
+By default
+.Nm
+adjusts simple queries (without spaces) to produce more useful output
+from certain whois servers,
+and it suppresses some uninformative output.
+With the
+.Fl S
+option,
+.Nm
+sends the query and prints the output verbatim.
+.El
+.Pp
+The operands specified to
+.Nm
+are treated independently and may be used
+as queries on different whois servers.
+.Sh ENVIRONMENT
+.Bl -tag
+.It Ev WHOIS_SERVER
+The primary default whois server.
+If this is unset,
+.Nm
+uses the
+.Ev RA_SERVER
+environment variable.
+.It Ev RA_SERVER
+The secondary default whois server.
+If this is unset,
+.Nm
+will use
+.Pa whois.iana.org .
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+To obtain contact information about an
+administrator located in the Russian
+.Tn TLD
+domain
+.Qq Li RU ,
+use the
+.Fl c
+option as shown in the following example, where
+.Ar CONTACT-ID
+is substituted with the actual contact identifier.
+.Pp
+.Dl Ic whois -c RU CONTACT-ID
+.Pp
+(Note: This example is specific to the
+.Tn TLD
+.Qq Li RU ,
+but other
+.Tn TLDs
+can be queried by using a similar syntax.)
+.Pp
+The following example demonstrates how to query
+a whois server using a non-standard port, where
+.Dq Li query-data
+is the query to be sent to
+.Dq Li whois.example.com
+on port
+.Dq Li rwhois
+(written numerically as 4321).
+.Pp
+.Dl Ic whois -h whois.example.com -p rwhois query-data
+.Pp
+Some whois servers support complex queries
+with dash-letter options.
+You can use the
+.Fl -
+option to separate
+.Nm
+command options from whois server query options.
+A query containing spaces must be quoted as one
+argument to the
+.Nm
+command.
+The following example asks the RIPE whois server
+to return a brief description of its
+.Dq Li domain
+object type:
+.Pp
+.Dl Ic whois -r -- '-t domain'
+.Sh SEE ALSO
+.Rs
+.%A Ken Harrenstien
+.%A Vic White
+.%T NICNAME/WHOIS
+.%D 1 March 1982
+.%O RFC 812
+.Re
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
new file mode 100644
index 0000000..4f4062b
--- /dev/null
+++ b/usr.bin/whois/whois.c
@@ -0,0 +1,527 @@
+/*-
+ * Copyright (c) 1980, 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, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ctype.h>
+#include <err.h>
+#include <netdb.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define ABUSEHOST "whois.abuse.net"
+#define ANICHOST "whois.arin.net"
+#define DENICHOST "whois.denic.de"
+#define DKNICHOST "whois.dk-hostmaster.dk"
+#define FNICHOST "whois.afrinic.net"
+#define GNICHOST "whois.nic.gov"
+#define IANAHOST "whois.iana.org"
+#define INICHOST "whois.internic.net"
+#define KNICHOST "whois.krnic.net"
+#define LNICHOST "whois.lacnic.net"
+#define MNICHOST "whois.ra.net"
+#define PDBHOST "whois.peeringdb.com"
+#define PNICHOST "whois.apnic.net"
+#define QNICHOST_TAIL ".whois-servers.net"
+#define RNICHOST "whois.ripe.net"
+#define VNICHOST "whois.verisign-grs.com"
+
+#define DEFAULT_PORT "whois"
+
+#define WHOIS_RECURSE 0x01
+#define WHOIS_QUICK 0x02
+#define WHOIS_SPAM_ME 0x04
+
+#define CHOPSPAM ">>> Last update of WHOIS database:"
+
+#define ishost(h) (isalnum((unsigned char)h) || h == '.' || h == '-')
+
+#define SCAN(p, end, check) \
+ while ((p) < (end)) \
+ if (check) ++(p); \
+ else break
+
+static struct {
+ const char *suffix, *server;
+} whoiswhere[] = {
+ /* Various handles */
+ { "-ARIN", ANICHOST },
+ { "-NICAT", "at" QNICHOST_TAIL },
+ { "-NORID", "no" QNICHOST_TAIL },
+ { "-RIPE", RNICHOST },
+ /* Nominet's whois server doesn't return referrals to JANET */
+ { ".ac.uk", "ac.uk" QNICHOST_TAIL },
+ { ".gov.uk", "ac.uk" QNICHOST_TAIL },
+ { "", IANAHOST }, /* default */
+ { NULL, NULL } /* safety belt */
+};
+
+#define WHOIS_REFERRAL(s) { s, sizeof(s) - 1 }
+static struct {
+ const char *prefix;
+ size_t len;
+} whois_referral[] = {
+ WHOIS_REFERRAL("whois:"), /* IANA */
+ WHOIS_REFERRAL("Whois Server:"),
+ WHOIS_REFERRAL("Registrar WHOIS Server:"), /* corporatedomains.com */
+ WHOIS_REFERRAL("ReferralServer: whois://"), /* ARIN */
+ WHOIS_REFERRAL("descr: region. Please query"), /* AfriNIC */
+ { NULL, 0 }
+};
+
+static const char *actually_arin[] = {
+ "netname: ERX-NETBLOCK\n", /* APNIC */
+ "netname: NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK\n",
+ NULL
+};
+
+static const char *port = DEFAULT_PORT;
+
+static const char *choose_server(char *);
+static struct addrinfo *gethostinfo(char const *host, int exitnoname);
+static void s_asprintf(char **ret, const char *format, ...) __printflike(2, 3);
+static void usage(void);
+static void whois(const char *, const char *, int);
+
+int
+main(int argc, char *argv[])
+{
+ const char *country, *host;
+ int ch, flags;
+
+#ifdef SOCKS
+ SOCKSinit(argv[0]);
+#endif
+
+ country = host = NULL;
+ flags = 0;
+ while ((ch = getopt(argc, argv, "aAbc:fgh:iIklmp:PQrRS")) != -1) {
+ switch (ch) {
+ case 'a':
+ host = ANICHOST;
+ break;
+ case 'A':
+ host = PNICHOST;
+ break;
+ case 'b':
+ host = ABUSEHOST;
+ break;
+ case 'c':
+ country = optarg;
+ break;
+ case 'f':
+ host = FNICHOST;
+ break;
+ case 'g':
+ host = GNICHOST;
+ break;
+ case 'h':
+ host = optarg;
+ break;
+ case 'i':
+ host = INICHOST;
+ break;
+ case 'I':
+ host = IANAHOST;
+ break;
+ case 'k':
+ host = KNICHOST;
+ break;
+ case 'l':
+ host = LNICHOST;
+ break;
+ case 'm':
+ host = MNICHOST;
+ break;
+ case 'p':
+ port = optarg;
+ break;
+ case 'P':
+ host = PDBHOST;
+ break;
+ case 'Q':
+ flags |= WHOIS_QUICK;
+ break;
+ case 'r':
+ host = RNICHOST;
+ break;
+ case 'R':
+ flags |= WHOIS_RECURSE;
+ break;
+ case 'S':
+ flags |= WHOIS_SPAM_ME;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!argc || (country != NULL && host != NULL))
+ usage();
+
+ /*
+ * If no host or country is specified, rely on referrals from IANA.
+ */
+ if (host == NULL && country == NULL) {
+ if ((host = getenv("WHOIS_SERVER")) == NULL &&
+ (host = getenv("RA_SERVER")) == NULL) {
+ if (!(flags & WHOIS_QUICK))
+ flags |= WHOIS_RECURSE;
+ }
+ }
+ while (argc-- > 0) {
+ if (country != NULL) {
+ char *qnichost;
+ s_asprintf(&qnichost, "%s%s", country, QNICHOST_TAIL);
+ whois(*argv, qnichost, flags);
+ free(qnichost);
+ } else
+ whois(*argv, host != NULL ? host :
+ choose_server(*argv), flags);
+ argv++;
+ }
+ exit(0);
+}
+
+static const char *
+choose_server(char *domain)
+{
+ size_t len = strlen(domain);
+ int i;
+
+ for (i = 0; whoiswhere[i].suffix != NULL; i++) {
+ size_t suffix_len = strlen(whoiswhere[i].suffix);
+ if (len > suffix_len &&
+ strcasecmp(domain + len - suffix_len,
+ whoiswhere[i].suffix) == 0)
+ return (whoiswhere[i].server);
+ }
+ errx(EX_SOFTWARE, "no default whois server");
+}
+
+static struct addrinfo *
+gethostinfo(char const *host, int exit_on_noname)
+{
+ struct addrinfo hints, *res;
+ int error;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ res = NULL;
+ error = getaddrinfo(host, port, &hints, &res);
+ if (error && (exit_on_noname || error != EAI_NONAME))
+ err(EX_NOHOST, "%s: %s", host, gai_strerror(error));
+ return (res);
+}
+
+/*
+ * Wrapper for asprintf(3) that exits on error.
+ */
+static void
+s_asprintf(char **ret, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (vasprintf(ret, format, ap) == -1) {
+ va_end(ap);
+ err(EX_OSERR, "vasprintf()");
+ }
+ va_end(ap);
+}
+
+static int
+connect_to_any_host(struct addrinfo *hostres)
+{
+ struct addrinfo *res;
+ nfds_t i, j;
+ size_t count;
+ struct pollfd *fds;
+ int timeout = 180, s = -1;
+
+ for (res = hostres, count = 0; res; res = res->ai_next)
+ count++;
+ fds = calloc(count, sizeof(*fds));
+ if (fds == NULL)
+ err(EX_OSERR, "calloc()");
+
+ /*
+ * Traverse the result list elements and make non-block
+ * connection attempts.
+ */
+ count = i = 0;
+ for (res = hostres; res != NULL; res = res->ai_next) {
+ s = socket(res->ai_family, res->ai_socktype | SOCK_NONBLOCK,
+ res->ai_protocol);
+ if (s < 0)
+ continue;
+ if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+ if (errno == EINPROGRESS) {
+ /* Add the socket to poll list */
+ fds[i].fd = s;
+ fds[i].events = POLLERR | POLLHUP |
+ POLLIN | POLLOUT;
+ /*
+ * From here until a socket connects, the
+ * socket fd is owned by the fds[] poll array.
+ */
+ s = -1;
+ count++;
+ i++;
+ } else {
+ close(s);
+ s = -1;
+
+ /*
+ * Poll only if we have something to poll,
+ * otherwise just go ahead and try next
+ * address
+ */
+ if (count == 0)
+ continue;
+ }
+ } else
+ goto done;
+
+ /*
+ * If we are at the last address, poll until a connection is
+ * established or we failed all connection attempts.
+ */
+ if (res->ai_next == NULL)
+ timeout = INFTIM;
+
+ /*
+ * Poll the watched descriptors for successful connections:
+ * if we still have more untried resolved addresses, poll only
+ * once; otherwise, poll until all descriptors have errors,
+ * which will be considered as ETIMEDOUT later.
+ */
+ do {
+ int n;
+
+ n = poll(fds, i, timeout);
+ if (n == 0) {
+ /*
+ * No event reported in time. Try with a
+ * smaller timeout (but cap at 2-3ms)
+ * after a new host have been added.
+ */
+ if (timeout >= 3)
+ timeout >>= 1;
+
+ break;
+ } else if (n < 0) {
+ /*
+ * errno here can only be EINTR which we would
+ * want to clean up and bail out.
+ */
+ s = -1;
+ goto done;
+ }
+
+ /*
+ * Check for the event(s) we have seen.
+ */
+ for (j = 0; j < i; j++) {
+ if (fds[j].fd == -1 || fds[j].events == 0 ||
+ fds[j].revents == 0)
+ continue;
+ if (fds[j].revents & ~(POLLIN | POLLOUT)) {
+ close(fds[j].fd);
+ fds[j].fd = -1;
+ fds[j].events = 0;
+ count--;
+ continue;
+ } else if (fds[j].revents & (POLLIN | POLLOUT)) {
+ /* Connect succeeded. */
+ s = fds[j].fd;
+ fds[j].fd = -1;
+
+ goto done;
+ }
+
+ }
+ } while (timeout == INFTIM && count != 0);
+ }
+
+ /* All attempts were failed */
+ s = -1;
+ if (count == 0)
+ errno = ETIMEDOUT;
+
+done:
+ /* Close all watched fds except the succeeded one */
+ for (j = 0; j < i; j++)
+ if (fds[j].fd != -1)
+ close(fds[j].fd);
+ free(fds);
+ return (s);
+}
+
+static void
+whois(const char *query, const char *hostname, int flags)
+{
+ FILE *fp;
+ struct addrinfo *hostres;
+ char *buf, *host, *nhost, *p;
+ int s, f;
+ size_t len, i;
+
+ hostres = gethostinfo(hostname, 1);
+ s = connect_to_any_host(hostres);
+ if (s == -1)
+ err(EX_OSERR, "connect()");
+
+ /* Restore default blocking behavior. */
+ if ((f = fcntl(s, F_GETFL)) == -1)
+ err(EX_OSERR, "fcntl()");
+ f &= ~O_NONBLOCK;
+ if (fcntl(s, F_SETFL, f) == -1)
+ err(EX_OSERR, "fcntl()");
+
+ fp = fdopen(s, "r+");
+ if (fp == NULL)
+ err(EX_OSERR, "fdopen()");
+
+ if (!(flags & WHOIS_SPAM_ME) &&
+ (strcasecmp(hostname, DENICHOST) == 0 ||
+ strcasecmp(hostname, "de" QNICHOST_TAIL) == 0)) {
+ const char *q;
+ int idn = 0;
+ for (q = query; *q != '\0'; q++)
+ if (!isascii(*q))
+ idn = 1;
+ fprintf(fp, "-T dn%s %s\r\n", idn ? "" : ",ace", query);
+ } else if (!(flags & WHOIS_SPAM_ME) &&
+ (strcasecmp(hostname, DKNICHOST) == 0 ||
+ strcasecmp(hostname, "dk" QNICHOST_TAIL) == 0))
+ fprintf(fp, "--show-handles %s\r\n", query);
+ else if ((flags & WHOIS_SPAM_ME) ||
+ strchr(query, ' ') != NULL)
+ fprintf(fp, "%s\r\n", query);
+ else if (strcasecmp(hostname, ANICHOST) == 0) {
+ if (strncasecmp(query, "AS", 2) == 0 &&
+ strspn(query+2, "0123456789") == strlen(query+2))
+ fprintf(fp, "+ a %s\r\n", query+2);
+ else
+ fprintf(fp, "+ %s\r\n", query);
+ } else if (strcasecmp(hostres->ai_canonname, VNICHOST) == 0)
+ fprintf(fp, "domain %s\r\n", query);
+ else
+ fprintf(fp, "%s\r\n", query);
+ fflush(fp);
+
+ nhost = NULL;
+ while ((buf = fgetln(fp, &len)) != NULL) {
+ /* Nominet */
+ if (!(flags & WHOIS_SPAM_ME) &&
+ len == 5 && strncmp(buf, "-- \r\n", 5) == 0)
+ break;
+
+ printf("%.*s", (int)len, buf);
+
+ if ((flags & WHOIS_RECURSE) && nhost == NULL) {
+ for (i = 0; whois_referral[i].prefix != NULL; i++) {
+ p = buf;
+ SCAN(p, buf+len, *p == ' ');
+ if (strncasecmp(p, whois_referral[i].prefix,
+ whois_referral[i].len) != 0)
+ continue;
+ p += whois_referral[i].len;
+ SCAN(p, buf+len, *p == ' ');
+ host = p;
+ SCAN(p, buf+len, ishost(*p));
+ /* avoid loops */
+ if (strncmp(hostname, host, p - host) != 0)
+ s_asprintf(&nhost, "%.*s",
+ (int)(p - host), host);
+ break;
+ }
+ for (i = 0; actually_arin[i] != NULL; i++) {
+ if (strncmp(buf, actually_arin[i], len) == 0) {
+ s_asprintf(&nhost, "%s", ANICHOST);
+ break;
+ }
+ }
+ }
+ /* Verisign etc. */
+ if (!(flags & WHOIS_SPAM_ME) &&
+ len >= sizeof(CHOPSPAM)-1 &&
+ (strncasecmp(buf, CHOPSPAM, sizeof(CHOPSPAM)-1) == 0 ||
+ strncasecmp(buf, CHOPSPAM+4, sizeof(CHOPSPAM)-5) == 0)) {
+ printf("\n");
+ break;
+ }
+ }
+ fclose(fp);
+ freeaddrinfo(hostres);
+ if (nhost != NULL) {
+ whois(query, nhost, flags);
+ free(nhost);
+ }
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: whois [-aAbfgiIklmPQrRS] [-c country-code | -h hostname] "
+ "[-p port] name ...\n");
+ exit(EX_USAGE);
+}
diff --git a/usr.bin/write/Makefile b/usr.bin/write/Makefile
new file mode 100644
index 0000000..94345c4
--- /dev/null
+++ b/usr.bin/write/Makefile
@@ -0,0 +1,8 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= write
+BINMODE=2555
+BINGRP= tty
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/write/Makefile.depend b/usr.bin/write/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/write/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/write/write.1 b/usr.bin/write/write.1
new file mode 100644
index 0000000..4aa92c0
--- /dev/null
+++ b/usr.bin/write/write.1
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1989, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory.
+.\"
+.\" 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.
+.\"
+.\" @(#)write.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2012
+.Dt WRITE 1
+.Os
+.Sh NAME
+.Nm write
+.Nd send a message to another user
+.Sh SYNOPSIS
+.Nm
+.Ar user
+.Op Ar tty
+.Sh DESCRIPTION
+The
+.Nm
+utility allows you to communicate with other users, by copying lines from
+your terminal to theirs.
+.Pp
+When you run the
+.Nm
+command, the user you are writing to gets a message of the form:
+.Pp
+.Dl Message from yourname@yourhost on yourtty at hh:mm ...
+.Pp
+Any further lines you enter will be copied to the specified user's
+terminal.
+If the other user wants to reply, they must run
+.Nm
+as well.
+.Pp
+When you are done, type an end-of-file or interrupt character.
+The other user will see the message
+.Ql EOF
+indicating that the
+conversation is over.
+.Pp
+You can prevent people (other than the super-user) from writing to you
+with the
+.Xr mesg 1
+command.
+.Pp
+If the user you want to write to is logged in on more than one terminal,
+you can specify which terminal to write to by specifying the terminal
+name as the second operand to the
+.Nm
+command.
+Alternatively, you can let
+.Nm
+select one of the terminals \- it will pick the one with the shortest
+idle time.
+This is so that if the user is logged in at work and also dialed up from
+home, the message will go to the right place.
+.Pp
+The traditional protocol for writing to someone is that the string
+.Ql \-o ,
+either at the end of a line or on a line by itself, means that it is the
+other person's turn to talk.
+The string
+.Ql oo
+means that the person believes the conversation to be
+over.
+.Sh SEE ALSO
+.Xr mesg 1 ,
+.Xr talk 1 ,
+.Xr wall 1 ,
+.Xr who 1
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At v1 .
+.Sh BUGS
+The sender's
+.Ev LC_CTYPE
+setting is used to determine which characters are safe to write to a
+terminal, not the receiver's (which
+.Nm
+has no way of knowing).
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
new file mode 100644
index 0000000..2008fd2
--- /dev/null
+++ b/usr.bin/write/write.c
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory.
+ *
+ * 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) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93";
+#endif
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <ctype.h>
+#include <err.h>
+#include <locale.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+#include <wchar.h>
+#include <wctype.h>
+
+void done(int);
+void do_write(char *, char *, uid_t);
+static void usage(void);
+int term_chk(char *, int *, time_t *, int);
+void wr_fputs(wchar_t *s);
+void search_utmp(char *, char *, char *, uid_t);
+int utmp_chk(char *, char *);
+
+int
+main(int argc, char **argv)
+{
+ time_t atime;
+ uid_t myuid;
+ int msgsok, myttyfd;
+ char tty[MAXPATHLEN], *mytty;
+
+ (void)setlocale(LC_CTYPE, "");
+
+ while (getopt(argc, argv, "") != -1)
+ usage();
+ argc -= optind;
+ argv += optind;
+
+ /* check that sender has write enabled */
+ if (isatty(fileno(stdin)))
+ myttyfd = fileno(stdin);
+ else if (isatty(fileno(stdout)))
+ myttyfd = fileno(stdout);
+ else if (isatty(fileno(stderr)))
+ myttyfd = fileno(stderr);
+ else
+ errx(1, "can't find your tty");
+ if (!(mytty = ttyname(myttyfd)))
+ errx(1, "can't find your tty's name");
+ if (!strncmp(mytty, _PATH_DEV, strlen(_PATH_DEV)))
+ mytty += strlen(_PATH_DEV);
+ if (term_chk(mytty, &msgsok, &atime, 1))
+ exit(1);
+ if (!msgsok)
+ errx(1, "you have write permission turned off");
+
+ myuid = getuid();
+
+ /* check args */
+ switch (argc) {
+ case 1:
+ search_utmp(argv[0], tty, mytty, myuid);
+ do_write(tty, mytty, myuid);
+ break;
+ case 2:
+ if (!strncmp(argv[1], _PATH_DEV, strlen(_PATH_DEV)))
+ argv[1] += strlen(_PATH_DEV);
+ if (utmp_chk(argv[0], argv[1]))
+ errx(1, "%s is not logged in on %s", argv[0], argv[1]);
+ if (term_chk(argv[1], &msgsok, &atime, 1))
+ exit(1);
+ if (myuid && !msgsok)
+ errx(1, "%s has messages disabled on %s", argv[0], argv[1]);
+ do_write(argv[1], mytty, myuid);
+ break;
+ default:
+ usage();
+ }
+ done(0);
+ return (0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr, "usage: write user [tty]\n");
+ exit(1);
+}
+
+/*
+ * utmp_chk - checks that the given user is actually logged in on
+ * the given tty
+ */
+int
+utmp_chk(char *user, char *tty)
+{
+ struct utmpx lu, *u;
+
+ strncpy(lu.ut_line, tty, sizeof lu.ut_line);
+ setutxent();
+ while ((u = getutxline(&lu)) != NULL)
+ if (u->ut_type == USER_PROCESS &&
+ strcmp(user, u->ut_user) == 0) {
+ endutxent();
+ return(0);
+ }
+ endutxent();
+ return(1);
+}
+
+/*
+ * search_utmp - search utmp for the "best" terminal to write to
+ *
+ * Ignores terminals with messages disabled, and of the rest, returns
+ * the one with the most recent access time. Returns as value the number
+ * of the user's terminals with messages enabled, or -1 if the user is
+ * not logged in at all.
+ *
+ * Special case for writing to yourself - ignore the terminal you're
+ * writing from, unless that's the only terminal with messages enabled.
+ */
+void
+search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
+{
+ struct utmpx *u;
+ time_t bestatime, atime;
+ int nloggedttys, nttys, msgsok, user_is_me;
+
+ nloggedttys = nttys = 0;
+ bestatime = 0;
+ user_is_me = 0;
+
+ setutxent();
+ while ((u = getutxent()) != NULL)
+ if (u->ut_type == USER_PROCESS &&
+ strcmp(user, u->ut_user) == 0) {
+ ++nloggedttys;
+ if (term_chk(u->ut_line, &msgsok, &atime, 0))
+ continue; /* bad term? skip */
+ if (myuid && !msgsok)
+ continue; /* skip ttys with msgs off */
+ if (strcmp(u->ut_line, mytty) == 0) {
+ user_is_me = 1;
+ continue; /* don't write to yourself */
+ }
+ ++nttys;
+ if (atime > bestatime) {
+ bestatime = atime;
+ (void)strlcpy(tty, u->ut_line, MAXPATHLEN);
+ }
+ }
+ endutxent();
+
+ if (nloggedttys == 0)
+ errx(1, "%s is not logged in", user);
+ if (nttys == 0) {
+ if (user_is_me) { /* ok, so write to yourself! */
+ (void)strlcpy(tty, mytty, MAXPATHLEN);
+ return;
+ }
+ errx(1, "%s has messages disabled", user);
+ } else if (nttys > 1) {
+ warnx("%s is logged in more than once; writing to %s", user, tty);
+ }
+}
+
+/*
+ * term_chk - check that a terminal exists, and get the message bit
+ * and the access time
+ */
+int
+term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
+{
+ struct stat s;
+ char path[MAXPATHLEN];
+
+ (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
+ if (stat(path, &s) < 0) {
+ if (showerror)
+ warn("%s", path);
+ return(1);
+ }
+ *msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0; /* group write bit */
+ *atimeP = s.st_atime;
+ return(0);
+}
+
+/*
+ * do_write - actually make the connection
+ */
+void
+do_write(char *tty, char *mytty, uid_t myuid)
+{
+ const char *login;
+ char *nows;
+ struct passwd *pwd;
+ time_t now;
+ char path[MAXPATHLEN], host[MAXHOSTNAMELEN];
+ wchar_t line[512];
+
+ /* Determine our login name before we reopen() stdout */
+ if ((login = getlogin()) == NULL) {
+ if ((pwd = getpwuid(myuid)))
+ login = pwd->pw_name;
+ else
+ login = "???";
+ }
+
+ (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
+ if ((freopen(path, "w", stdout)) == NULL)
+ err(1, "%s", path);
+
+ (void)signal(SIGINT, done);
+ (void)signal(SIGHUP, done);
+
+ /* print greeting */
+ if (gethostname(host, sizeof(host)) < 0)
+ (void)strcpy(host, "???");
+ now = time((time_t *)NULL);
+ nows = ctime(&now);
+ nows[16] = '\0';
+ (void)printf("\r\n\007\007\007Message from %s@%s on %s at %s ...\r\n",
+ login, host, mytty, nows + 11);
+
+ while (fgetws(line, sizeof(line)/sizeof(wchar_t), stdin) != NULL)
+ wr_fputs(line);
+}
+
+/*
+ * done - cleanup and exit
+ */
+void
+done(int n __unused)
+{
+ (void)printf("EOF\r\n");
+ exit(0);
+}
+
+/*
+ * wr_fputs - like fputs(), but makes control characters visible and
+ * turns \n into \r\n
+ */
+void
+wr_fputs(wchar_t *s)
+{
+
+#define PUTC(c) if (putwchar(c) == WEOF) err(1, NULL);
+
+ for (; *s != L'\0'; ++s) {
+ if (*s == L'\n') {
+ PUTC(L'\r');
+ PUTC(L'\n');
+ } else if (iswprint(*s) || iswspace(*s)) {
+ PUTC(*s);
+ } else {
+ wprintf(L"<0x%X>", *s);
+ }
+ }
+ return;
+#undef PUTC
+}
diff --git a/usr.bin/xargs/Makefile b/usr.bin/xargs/Makefile
new file mode 100644
index 0000000..034a0a6
--- /dev/null
+++ b/usr.bin/xargs/Makefile
@@ -0,0 +1,13 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= xargs
+SRCS= xargs.c strnsubst.c
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xargs/Makefile.depend b/usr.bin/xargs/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/xargs/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/xargs/pathnames.h b/usr.bin/xargs/pathnames.h
new file mode 100644
index 0000000..25c6043
--- /dev/null
+++ b/usr.bin/xargs/pathnames.h
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 1990, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
+ */
+
+#define _PATH_ECHO "/bin/echo"
diff --git a/usr.bin/xargs/strnsubst.c b/usr.bin/xargs/strnsubst.c
new file mode 100644
index 0000000..304e47b
--- /dev/null
+++ b/usr.bin/xargs/strnsubst.c
@@ -0,0 +1,109 @@
+/* $xMach: strnsubst.c,v 1.3 2002/02/23 02:10:24 jmallett Exp $ */
+
+/*
+ * Copyright (c) 2002 J. Mallett. All rights reserved.
+ * You may do whatever you want with this file as long as
+ * the above copyright and this notice remain intact, along
+ * with the following statement:
+ * For the man who taught me vi, and who got too old, too young.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+void strnsubst(char **, const char *, const char *, size_t);
+
+/*
+ * Replaces str with a string consisting of str with match replaced with
+ * replstr as many times as can be done before the constructed string is
+ * maxsize bytes large. It does not free the string pointed to by str, it
+ * is up to the calling program to be sure that the original contents of
+ * str as well as the new contents are handled in an appropriate manner.
+ * If replstr is NULL, then that internally is changed to a nil-string, so
+ * that we can still pretend to do somewhat meaningful substitution.
+ * No value is returned.
+ */
+void
+strnsubst(char **str, const char *match, const char *replstr, size_t maxsize)
+{
+ char *s1, *s2, *this;
+
+ s1 = *str;
+ if (s1 == NULL)
+ return;
+ /*
+ * If maxsize is 0 then set it to to the length of s1, because we have
+ * to duplicate s1. XXX we maybe should double-check whether the match
+ * appears in s1. If it doesn't, then we also have to set the length
+ * to the length of s1, to avoid modifying the argument. It may make
+ * sense to check if maxsize is <= strlen(s1), because in that case we
+ * want to return the unmodified string, too.
+ */
+ if (maxsize == 0) {
+ match = NULL;
+ maxsize = strlen(s1) + 1;
+ }
+ s2 = calloc(1, maxsize);
+ if (s2 == NULL)
+ err(1, "calloc");
+
+ if (replstr == NULL)
+ replstr = "";
+
+ if (match == NULL || replstr == NULL || maxsize == strlen(s1)) {
+ strlcpy(s2, s1, maxsize);
+ goto done;
+ }
+
+ for (;;) {
+ this = strstr(s1, match);
+ if (this == NULL)
+ break;
+ if ((strlen(s2) + strlen(s1) + strlen(replstr) -
+ strlen(match) + 1) > maxsize) {
+ strlcat(s2, s1, maxsize);
+ goto done;
+ }
+ strncat(s2, s1, (uintptr_t)this - (uintptr_t)s1);
+ strcat(s2, replstr);
+ s1 = this + strlen(match);
+ }
+ strcat(s2, s1);
+done:
+ *str = s2;
+ return;
+}
+
+#ifdef TEST
+#include <stdio.h>
+
+int
+main(void)
+{
+ char *x, *y, *z, *za;
+
+ x = "{}%$";
+ strnsubst(&x, "%$", "{} enpury!", 255);
+ y = x;
+ strnsubst(&y, "}{}", "ybir", 255);
+ z = y;
+ strnsubst(&z, "{", "v ", 255);
+ za = z;
+ strnsubst(&z, NULL, za, 255);
+ if (strcmp(z, "v ybir enpury!") == 0)
+ printf("strnsubst() seems to work!\n");
+ else
+ printf("strnsubst() is broken.\n");
+ printf("%s\n", z);
+ free(x);
+ free(y);
+ free(z);
+ free(za);
+ return 0;
+}
+#endif
diff --git a/usr.bin/xargs/tests/Makefile b/usr.bin/xargs/tests/Makefile
new file mode 100644
index 0000000..228c1d5
--- /dev/null
+++ b/usr.bin/xargs/tests/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.0.in
+${PACKAGE}FILES+= regress.0.out
+${PACKAGE}FILES+= regress.0I.out
+${PACKAGE}FILES+= regress.0J.out
+${PACKAGE}FILES+= regress.0L.out
+${PACKAGE}FILES+= regress.0P1.out
+${PACKAGE}FILES+= regress.I.out
+${PACKAGE}FILES+= regress.J.out
+${PACKAGE}FILES+= regress.L.out
+${PACKAGE}FILES+= regress.P1.out
+${PACKAGE}FILES+= regress.R.out
+${PACKAGE}FILES+= regress.in
+${PACKAGE}FILES+= regress.n1.out
+${PACKAGE}FILES+= regress.n2.out
+${PACKAGE}FILES+= regress.n2P0.out
+${PACKAGE}FILES+= regress.n3.out
+${PACKAGE}FILES+= regress.normal.out
+${PACKAGE}FILES+= regress.quotes.in
+${PACKAGE}FILES+= regress.quotes.out
+${PACKAGE}FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/xargs/tests/Makefile.depend b/usr.bin/xargs/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/xargs/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xargs/tests/legacy_test.sh b/usr.bin/xargs/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/xargs/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/xargs/tests/regress.0.in b/usr.bin/xargs/tests/regress.0.in
new file mode 100644
index 0000000..448ba53
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0.in
Binary files differ
diff --git a/usr.bin/xargs/tests/regress.0.out b/usr.bin/xargs/tests/regress.0.out
new file mode 100644
index 0000000..2bc9725
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0.out
@@ -0,0 +1,8 @@
+quick ' brown
+fox jumped
+over "the lazy
+dog
+quick brown fox
+jumped over the
+lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.0I.out b/usr.bin/xargs/tests/regress.0I.out
new file mode 100644
index 0000000..16009c0
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0I.out
@@ -0,0 +1,18 @@
+The quick ' brown quick ' brownquick ' brown quick ' brown
+The fox jumped
+over "the lazy fox jumped
+over "the lazyfox jumped
+over "the lazy fox jumped
+over "the lazy
+The
+The dog
+quick brown fox dog
+quick brown foxdog
+quick brown fox dog
+quick brown fox
+The jumped over the jumped over thejumped over the jumped over the
+The lazy dog
+ lazy dog
+lazy dog
+ lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.0J.out b/usr.bin/xargs/tests/regress.0J.out
new file mode 100644
index 0000000..69c87f9
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0J.out
@@ -0,0 +1,4 @@
+The quick ' brown fox jumped
+over "the lazy dog
+quick brown fox jumped over the lazy dog
+ again.
diff --git a/usr.bin/xargs/tests/regress.0L.out b/usr.bin/xargs/tests/regress.0L.out
new file mode 100644
index 0000000..2d13fcc
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0L.out
@@ -0,0 +1,6 @@
+quick ' brown fox jumped
+over "the lazy
+dog
+quick brown fox
+jumped over the lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.0P1.out b/usr.bin/xargs/tests/regress.0P1.out
new file mode 100644
index 0000000..a95e9a2
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0P1.out
@@ -0,0 +1,4 @@
+quick ' brown fox jumped
+over "the lazy dog
+quick brown fox jumped over the lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.I.out b/usr.bin/xargs/tests/regress.I.out
new file mode 100644
index 0000000..f2a6a1e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.I.out
@@ -0,0 +1,4 @@
+The quick brown quick brown quick brown quick brownquick brown quick brown %
+The fox jumped fox jumped fox jumped fox jumpedfox jumped fox jumped %
+The over the lazy over the lazy over the lazy over the lazyover the lazy over the lazy %
+The dog dog dog dogdog dog %
diff --git a/usr.bin/xargs/tests/regress.J.out b/usr.bin/xargs/tests/regress.J.out
new file mode 100644
index 0000000..b88a41e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.J.out
@@ -0,0 +1 @@
+The quick brown fox jumped over the lazy dog again.
diff --git a/usr.bin/xargs/tests/regress.L.out b/usr.bin/xargs/tests/regress.L.out
new file mode 100644
index 0000000..7359dee
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.L.out
@@ -0,0 +1,2 @@
+quick brown fox jumped over the lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.P1.out b/usr.bin/xargs/tests/regress.P1.out
new file mode 100644
index 0000000..cc32a92
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.P1.out
@@ -0,0 +1 @@
+quick brown fox jumped over the lazy dog
diff --git a/usr.bin/xargs/tests/regress.R.out b/usr.bin/xargs/tests/regress.R.out
new file mode 100644
index 0000000..6fe947f
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.R.out
@@ -0,0 +1,4 @@
+The quick brown % % %% % %
+The fox jumped % % %% % %
+The over the lazy % % %% % %
+The dog % % %% % %
diff --git a/usr.bin/xargs/tests/regress.in b/usr.bin/xargs/tests/regress.in
new file mode 100644
index 0000000..5252b48
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.in
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.n1.out b/usr.bin/xargs/tests/regress.n1.out
new file mode 100644
index 0000000..77ef6c5
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n1.out
@@ -0,0 +1,8 @@
+quick
+brown
+fox
+jumped
+over
+the
+lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.n2.out b/usr.bin/xargs/tests/regress.n2.out
new file mode 100644
index 0000000..4fa3f55
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n2.out
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the
+lazy dog
diff --git a/usr.bin/xargs/tests/regress.n2P0.out b/usr.bin/xargs/tests/regress.n2P0.out
new file mode 100644
index 0000000..de062b2
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n2P0.out
@@ -0,0 +1,4 @@
+fox jumped
+lazy dog
+over the
+quick brown
diff --git a/usr.bin/xargs/tests/regress.n3.out b/usr.bin/xargs/tests/regress.n3.out
new file mode 100644
index 0000000..21b2c1e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n3.out
@@ -0,0 +1,3 @@
+quick brown fox
+jumped over the
+lazy dog
diff --git a/usr.bin/xargs/tests/regress.normal.out b/usr.bin/xargs/tests/regress.normal.out
new file mode 100644
index 0000000..458d9cb
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.normal.out
@@ -0,0 +1 @@
+The quick brown fox jumped over the lazy dog
diff --git a/usr.bin/xargs/tests/regress.quotes.in b/usr.bin/xargs/tests/regress.quotes.in
new file mode 100644
index 0000000..11388a0
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.quotes.in
@@ -0,0 +1,4 @@
+a 'b "c' \'d
+e\ f "g ' h"
+i\
+j
diff --git a/usr.bin/xargs/tests/regress.quotes.out b/usr.bin/xargs/tests/regress.quotes.out
new file mode 100644
index 0000000..f79ad41
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.quotes.out
@@ -0,0 +1,7 @@
+a
+b "c
+'d
+e f
+g ' h
+i
+j
diff --git a/usr.bin/xargs/tests/regress.sh b/usr.bin/xargs/tests/regress.sh
new file mode 100644
index 0000000..72458a4
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.sh
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+echo 1..16
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`normal', `xargs echo The <${SRCDIR}/regress.in')
+REGRESSION_TEST(`I', `xargs -I% echo The % % % %% % % <${SRCDIR}/regress.in')
+REGRESSION_TEST(`J', `xargs -J% echo The % again. <${SRCDIR}/regress.in')
+REGRESSION_TEST(`L', `xargs -L3 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`P1', `xargs -P1 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`R', `xargs -I% -R1 echo The % % % %% % % <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n1', `xargs -n1 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n2', `xargs -n2 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n2P0',`xargs -n2 -P0 echo <${SRCDIR}/regress.in | sort')
+REGRESSION_TEST(`n3', `xargs -n3 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`0', `xargs -0 -n1 echo <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0I', `xargs -0 -I% echo The % %% % <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0J', `xargs -0 -J% echo The % again. <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0L', `xargs -0 -L2 echo <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0P1', `xargs -0 -P1 echo <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`quotes', `xargs -n1 echo <${SRCDIR}/regress.quotes.in')
+
+REGRESSION_END()
diff --git a/usr.bin/xargs/xargs.1 b/usr.bin/xargs/xargs.1
new file mode 100644
index 0000000..607b966
--- /dev/null
+++ b/usr.bin/xargs/xargs.1
@@ -0,0 +1,365 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" John B. Roll Jr. and the Institute of Electrical and Electronics
+.\" Engineers, Inc.
+.\"
+.\" 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.
+.\"
+.\" @(#)xargs.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $
+.\"
+.Dd August 4, 2015
+.Dt XARGS 1
+.Os
+.Sh NAME
+.Nm xargs
+.Nd "construct argument list(s) and execute utility"
+.Sh SYNOPSIS
+.Nm
+.Op Fl 0oprt
+.Op Fl E Ar eofstr
+.Oo
+.Fl I Ar replstr
+.Op Fl R Ar replacements
+.Op Fl S Ar replsize
+.Oc
+.Op Fl J Ar replstr
+.Op Fl L Ar number
+.Oo
+.Fl n Ar number
+.Op Fl x
+.Oc
+.Op Fl P Ar maxprocs
+.Op Fl s Ar size
+.Op Ar utility Op Ar argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility reads space, tab, newline and end-of-file delimited strings
+from the standard input and executes
+.Ar utility
+with the strings as
+arguments.
+.Pp
+Any arguments specified on the command line are given to
+.Ar utility
+upon each invocation, followed by some number of the arguments read
+from the standard input of
+.Nm .
+This is repeated until standard input is exhausted.
+.Pp
+Spaces, tabs and newlines may be embedded in arguments using single
+(``\ '\ '')
+or double (``"'') quotes or backslashes (``\e'').
+Single quotes escape all non-single quote characters, excluding newlines,
+up to the matching single quote.
+Double quotes escape all non-double quote characters, excluding newlines,
+up to the matching double quote.
+Any single character, including newlines, may be escaped by a backslash.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl 0
+Change
+.Nm
+to expect NUL
+(``\\0'')
+characters as separators, instead of spaces and newlines.
+This is expected to be used in concert with the
+.Fl print0
+function in
+.Xr find 1 .
+.It Fl E Ar eofstr
+Use
+.Ar eofstr
+as a logical EOF marker.
+.It Fl I Ar replstr
+Execute
+.Ar utility
+for each input line, replacing one or more occurrences of
+.Ar replstr
+in up to
+.Ar replacements
+(or 5 if no
+.Fl R
+flag is specified) arguments to
+.Ar utility
+with the entire line of input.
+The resulting arguments, after replacement is done, will not be allowed to grow
+beyond
+.Ar replsize
+(or 255 if no
+.Fl S
+flag is specified)
+bytes; this is implemented by concatenating as much of the argument
+containing
+.Ar replstr
+as possible, to the constructed arguments to
+.Ar utility ,
+up to
+.Ar replsize
+bytes.
+The size limit does not apply to arguments to
+.Ar utility
+which do not contain
+.Ar replstr ,
+and furthermore, no replacement will be done on
+.Ar utility
+itself.
+Implies
+.Fl x .
+.It Fl J Ar replstr
+If this option is specified,
+.Nm
+will use the data read from standard input to replace the first occurrence of
+.Ar replstr
+instead of appending that data after all other arguments.
+This option will not affect how many arguments will be read from input
+.Pq Fl n ,
+or the size of the command(s)
+.Nm
+will generate
+.Pq Fl s .
+The option just moves where those arguments will be placed in the command(s)
+that are executed.
+The
+.Ar replstr
+must show up as a distinct
+.Ar argument
+to
+.Nm .
+It will not be recognized if, for instance, it is in the middle of a
+quoted string.
+Furthermore, only the first occurrence of the
+.Ar replstr
+will be replaced.
+For example, the following command will copy the list of files and
+directories which start with an uppercase letter in the current
+directory to
+.Pa destdir :
+.Pp
+.Dl /bin/ls -1d [A-Z]* | xargs -J % cp -Rp % destdir
+.It Fl L Ar number
+Call
+.Ar utility
+for every
+.Ar number
+lines read.
+If EOF is reached and fewer lines have been read than
+.Ar number
+then
+.Ar utility
+will be called with the available lines.
+.It Fl n Ar number
+Set the maximum number of arguments taken from standard input for each
+invocation of
+.Ar utility .
+An invocation of
+.Ar utility
+will use less than
+.Ar number
+standard input arguments if the number of bytes accumulated (see the
+.Fl s
+option) exceeds the specified
+.Ar size
+or there are fewer than
+.Ar number
+arguments remaining for the last invocation of
+.Ar utility .
+The current default value for
+.Ar number
+is 5000.
+.It Fl o
+Reopen stdin as
+.Pa /dev/tty
+in the child process before executing the command.
+This is useful if you want
+.Nm
+to run an interactive application.
+.It Fl P Ar maxprocs
+Parallel mode: run at most
+.Ar maxprocs
+invocations of
+.Ar utility
+at once.
+If
+.Ar maxprocs
+is set to 0,
+.Nm
+will run as many processes as possible.
+.It Fl p
+Echo each command to be executed and ask the user whether it should be
+executed.
+An affirmative response,
+.Ql y
+in the POSIX locale,
+causes the command to be executed, any other response causes it to be
+skipped.
+No commands are executed if the process is not attached to a terminal.
+.It Fl r
+Compatibility with GNU
+.Nm .
+The GNU version of
+.Nm
+runs the
+.Ar utility
+argument at least once, even if
+.Nm
+input is empty, and it supports a
+.Fl r
+option to inhibit this behavior.
+The
+.Fx
+version of
+.Nm
+does not run the
+.Ar utility
+argument on empty input, but it supports the
+.Fl r
+option for command-line compatibility with GNU
+.Nm ,
+but the
+.Fl r
+option does nothing in the
+.Fx
+version of
+.Nm .
+.It Fl R Ar replacements
+Specify the maximum number of arguments that
+.Fl I
+will do replacement in.
+If
+.Ar replacements
+is negative, the number of arguments in which to replace is unbounded.
+.It Fl S Ar replsize
+Specify the amount of space (in bytes) that
+.Fl I
+can use for replacements.
+The default for
+.Ar replsize
+is 255.
+.It Fl s Ar size
+Set the maximum number of bytes for the command line length provided to
+.Ar utility .
+The sum of the length of the utility name, the arguments passed to
+.Ar utility
+(including
+.Dv NULL
+terminators) and the current environment will be less than or equal to
+this number.
+The current default value for
+.Ar size
+is
+.Dv ARG_MAX
+- 4096.
+.It Fl t
+Echo the command to be executed to standard error immediately before it
+is executed.
+.It Fl x
+Force
+.Nm
+to terminate immediately if a command line containing
+.Ar number
+arguments will not fit in the specified (or default) command line length.
+.El
+.Pp
+If
+.Ar utility
+is omitted,
+.Xr echo 1
+is used.
+.Pp
+Undefined behavior may occur if
+.Ar utility
+reads from the standard input.
+.Pp
+If a command line cannot be assembled, or
+cannot be invoked, or if an invocation of
+.Ar utility
+is terminated by a signal,
+or an invocation of
+.Ar utility
+exits with a value of 255, the
+.Nm
+utility stops processing input and exits after all invocations of
+.Ar utility
+finish processing.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with a value of 0 if no error occurs.
+If
+.Ar utility
+cannot be found,
+.Nm
+exits with a value of 127, otherwise if
+.Ar utility
+cannot be executed,
+.Nm
+exits with a value of 126.
+If any other error occurs,
+.Nm
+exits with a value of 1.
+.Sh SEE ALSO
+.Xr echo 1 ,
+.Xr find 1 ,
+.Xr execvp 3
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be
+.St -p1003.2
+compliant.
+The
+.Fl J , o , P, R
+and
+.Fl S
+options are non-standard
+.Fx
+extensions which may not be available on other operating systems.
+.Sh HISTORY
+The
+.Nm
+utility appeared in PWB UNIX.
+.Sh BUGS
+If
+.Ar utility
+attempts to invoke another command such that the number of arguments or the
+size of the environment is increased, it risks
+.Xr execvp 3
+failing with
+.Er E2BIG .
+.Pp
+The
+.Nm
+utility does not take multibyte characters into account when performing
+string comparisons for the
+.Fl I
+and
+.Fl J
+options, which may lead to incorrect results in some locales.
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
new file mode 100644
index 0000000..955711c
--- /dev/null
+++ b/usr.bin/xargs/xargs.c
@@ -0,0 +1,786 @@
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * John B. Roll Jr.
+ *
+ * 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.
+ *
+ * $xMach: xargs.c,v 1.6 2002/02/23 05:27:47 tim Exp $
+ */
+
+#if 0
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)xargs.c 8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/limits.h>
+#include <sys/resource.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <paths.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+
+static void parse_input(int, char *[]);
+static void prerun(int, char *[]);
+static int prompt(void);
+static void run(char **);
+static void usage(void);
+void strnsubst(char **, const char *, const char *, size_t);
+static pid_t xwait(int block, int *status);
+static void xexit(const char *, const int);
+static void waitchildren(const char *, int);
+static void pids_init(void);
+static int pids_empty(void);
+static int pids_full(void);
+static void pids_add(pid_t pid);
+static int pids_remove(pid_t pid);
+static int findslot(pid_t pid);
+static int findfreeslot(void);
+static void clearslot(int slot);
+
+static char echo[] = _PATH_ECHO;
+static char **av, **bxp, **ep, **endxp, **xp;
+static char *argp, *bbp, *ebp, *inpline, *p, *replstr;
+static const char *eofstr;
+static int count, insingle, indouble, oflag, pflag, tflag, Rflag, rval, zflag;
+static int cnt, Iflag, jfound, Lflag, Sflag, wasquoted, xflag;
+static int curprocs, maxprocs;
+static pid_t *childpids;
+
+static volatile int childerr;
+
+extern char **environ;
+
+int
+main(int argc, char *argv[])
+{
+ long arg_max;
+ int ch, Jflag, nargs, nflag, nline;
+ size_t linelen;
+ struct rlimit rl;
+ char *endptr;
+ const char *errstr;
+
+ inpline = replstr = NULL;
+ ep = environ;
+ eofstr = "";
+ Jflag = nflag = 0;
+
+ (void)setlocale(LC_ALL, "");
+
+ /*
+ * POSIX.2 limits the exec line length to ARG_MAX - 2K. Running that
+ * caused some E2BIG errors, so it was changed to ARG_MAX - 4K. Given
+ * that the smallest argument is 2 bytes in length, this means that
+ * the number of arguments is limited to:
+ *
+ * (ARG_MAX - 4K - LENGTH(utility + arguments)) / 2.
+ *
+ * We arbitrarily limit the number of arguments to 5000. This is
+ * allowed by POSIX.2 as long as the resulting minimum exec line is
+ * at least LINE_MAX. Realloc'ing as necessary is possible, but
+ * probably not worthwhile.
+ */
+ nargs = 5000;
+ if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
+ errx(1, "sysconf(_SC_ARG_MAX) failed");
+ nline = arg_max - 4 * 1024;
+ while (*ep != NULL) {
+ /* 1 byte for each '\0' */
+ nline -= strlen(*ep++) + 1 + sizeof(*ep);
+ }
+ maxprocs = 1;
+ while ((ch = getopt(argc, argv, "0E:I:J:L:n:oP:pR:S:s:rtx")) != -1)
+ switch (ch) {
+ case 'E':
+ eofstr = optarg;
+ break;
+ case 'I':
+ Jflag = 0;
+ Iflag = 1;
+ Lflag = 1;
+ replstr = optarg;
+ break;
+ case 'J':
+ Iflag = 0;
+ Jflag = 1;
+ replstr = optarg;
+ break;
+ case 'L':
+ Lflag = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-L %s: %s", optarg, errstr);
+ break;
+ case 'n':
+ nflag = 1;
+ nargs = strtonum(optarg, 1, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-n %s: %s", optarg, errstr);
+ break;
+ case 'o':
+ oflag = 1;
+ break;
+ case 'P':
+ maxprocs = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-P %s: %s", optarg, errstr);
+ if (getrlimit(RLIMIT_NPROC, &rl) != 0)
+ errx(1, "getrlimit failed");
+ if (maxprocs == 0 || maxprocs > rl.rlim_cur)
+ maxprocs = rl.rlim_cur;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case 'R':
+ Rflag = strtol(optarg, &endptr, 10);
+ if (*endptr != '\0')
+ errx(1, "replacements must be a number");
+ break;
+ case 'r':
+ /* GNU compatibility */
+ break;
+ case 'S':
+ Sflag = strtoul(optarg, &endptr, 10);
+ if (*endptr != '\0')
+ errx(1, "replsize must be a number");
+ break;
+ case 's':
+ nline = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "-s %s: %s", optarg, errstr);
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case '0':
+ zflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!Iflag && Rflag)
+ usage();
+ if (!Iflag && Sflag)
+ usage();
+ if (Iflag && !Rflag)
+ Rflag = 5;
+ if (Iflag && !Sflag)
+ Sflag = 255;
+ if (xflag && !nflag)
+ usage();
+ if (Iflag || Lflag)
+ xflag = 1;
+ if (replstr != NULL && *replstr == '\0')
+ errx(1, "replstr may not be empty");
+
+ pids_init();
+
+ /*
+ * Allocate pointers for the utility name, the utility arguments,
+ * the maximum arguments to be read from stdin and the trailing
+ * NULL.
+ */
+ linelen = 1 + argc + nargs + 1;
+ if ((av = bxp = malloc(linelen * sizeof(char *))) == NULL)
+ errx(1, "malloc failed");
+
+ /*
+ * Use the user's name for the utility as argv[0], just like the
+ * shell. Echo is the default. Set up pointers for the user's
+ * arguments.
+ */
+ if (*argv == NULL)
+ cnt = strlen(*bxp++ = echo);
+ else {
+ do {
+ if (Jflag && strcmp(*argv, replstr) == 0) {
+ char **avj;
+ jfound = 1;
+ argv++;
+ for (avj = argv; *avj; avj++)
+ cnt += strlen(*avj) + 1;
+ break;
+ }
+ cnt += strlen(*bxp++ = *argv) + 1;
+ } while (*++argv != NULL);
+ }
+
+ /*
+ * Set up begin/end/traversing pointers into the array. The -n
+ * count doesn't include the trailing NULL pointer, so the malloc
+ * added in an extra slot.
+ */
+ endxp = (xp = bxp) + nargs;
+
+ /*
+ * Allocate buffer space for the arguments read from stdin and the
+ * trailing NULL. Buffer space is defined as the default or specified
+ * space, minus the length of the utility name and arguments. Set up
+ * begin/end/traversing pointers into the array. The -s count does
+ * include the trailing NULL, so the malloc didn't add in an extra
+ * slot.
+ */
+ nline -= cnt;
+ if (nline <= 0)
+ errx(1, "insufficient space for command");
+
+ if ((bbp = malloc((size_t)(nline + 1))) == NULL)
+ errx(1, "malloc failed");
+ ebp = (argp = p = bbp) + nline - 1;
+ for (;;)
+ parse_input(argc, argv);
+}
+
+static void
+parse_input(int argc, char *argv[])
+{
+ int ch, foundeof;
+ char **avj;
+
+ foundeof = 0;
+
+ switch (ch = getchar()) {
+ case EOF:
+ /* No arguments since last exec. */
+ if (p == bbp)
+ xexit(*av, rval);
+ goto arg1;
+ case ' ':
+ case '\t':
+ /* Quotes escape tabs and spaces. */
+ if (insingle || indouble || zflag)
+ goto addch;
+ goto arg2;
+ case '\0':
+ if (zflag) {
+ /*
+ * Increment 'count', so that nulls will be treated
+ * as end-of-line, as well as end-of-argument. This
+ * is needed so -0 works properly with -I and -L.
+ */
+ count++;
+ goto arg2;
+ }
+ goto addch;
+ case '\n':
+ if (zflag)
+ goto addch;
+ count++; /* Indicate end-of-line (used by -L) */
+
+ /* Quotes do not escape newlines. */
+arg1: if (insingle || indouble) {
+ warnx("unterminated quote");
+ xexit(*av, 1);
+ }
+arg2:
+ foundeof = *eofstr != '\0' &&
+ strncmp(argp, eofstr, p - argp) == 0;
+
+ /* Do not make empty args unless they are quoted */
+ if ((argp != p || wasquoted) && !foundeof) {
+ *p++ = '\0';
+ *xp++ = argp;
+ if (Iflag) {
+ size_t curlen;
+
+ if (inpline == NULL)
+ curlen = 0;
+ else {
+ /*
+ * If this string is not zero
+ * length, append a space for
+ * separation before the next
+ * argument.
+ */
+ if ((curlen = strlen(inpline)))
+ strcat(inpline, " ");
+ }
+ curlen++;
+ /*
+ * Allocate enough to hold what we will
+ * be holding in a second, and to append
+ * a space next time through, if we have
+ * to.
+ */
+ inpline = realloc(inpline, curlen + 2 +
+ strlen(argp));
+ if (inpline == NULL) {
+ warnx("realloc failed");
+ xexit(*av, 1);
+ }
+ if (curlen == 1)
+ strcpy(inpline, argp);
+ else
+ strcat(inpline, argp);
+ }
+ }
+
+ /*
+ * If max'd out on args or buffer, or reached EOF,
+ * run the command. If xflag and max'd out on buffer
+ * but not on args, object. Having reached the limit
+ * of input lines, as specified by -L is the same as
+ * maxing out on arguments.
+ */
+ if (xp == endxp || p > ebp || ch == EOF ||
+ (Lflag <= count && xflag) || foundeof) {
+ if (xflag && xp != endxp && p > ebp) {
+ warnx("insufficient space for arguments");
+ xexit(*av, 1);
+ }
+ if (jfound) {
+ for (avj = argv; *avj; avj++)
+ *xp++ = *avj;
+ }
+ prerun(argc, av);
+ if (ch == EOF || foundeof)
+ xexit(*av, rval);
+ p = bbp;
+ xp = bxp;
+ count = 0;
+ }
+ argp = p;
+ wasquoted = 0;
+ break;
+ case '\'':
+ if (indouble || zflag)
+ goto addch;
+ insingle = !insingle;
+ wasquoted = 1;
+ break;
+ case '"':
+ if (insingle || zflag)
+ goto addch;
+ indouble = !indouble;
+ wasquoted = 1;
+ break;
+ case '\\':
+ if (zflag)
+ goto addch;
+ /* Backslash escapes anything, is escaped by quotes. */
+ if (!insingle && !indouble && (ch = getchar()) == EOF) {
+ warnx("backslash at EOF");
+ xexit(*av, 1);
+ }
+ /* FALLTHROUGH */
+ default:
+addch: if (p < ebp) {
+ *p++ = ch;
+ break;
+ }
+
+ /* If only one argument, not enough buffer space. */
+ if (bxp == xp) {
+ warnx("insufficient space for argument");
+ xexit(*av, 1);
+ }
+ /* Didn't hit argument limit, so if xflag object. */
+ if (xflag) {
+ warnx("insufficient space for arguments");
+ xexit(*av, 1);
+ }
+
+ if (jfound) {
+ for (avj = argv; *avj; avj++)
+ *xp++ = *avj;
+ }
+ prerun(argc, av);
+ xp = bxp;
+ cnt = ebp - argp;
+ memcpy(bbp, argp, (size_t)cnt);
+ p = (argp = bbp) + cnt;
+ *p++ = ch;
+ break;
+ }
+}
+
+/*
+ * Do things necessary before run()'ing, such as -I substitution,
+ * and then call run().
+ */
+static void
+prerun(int argc, char *argv[])
+{
+ char **tmp, **tmp2, **avj;
+ int repls;
+
+ repls = Rflag;
+
+ if (argc == 0 || repls == 0) {
+ *xp = NULL;
+ run(argv);
+ return;
+ }
+
+ avj = argv;
+
+ /*
+ * Allocate memory to hold the argument list, and
+ * a NULL at the tail.
+ */
+ tmp = malloc((argc + 1) * sizeof(char *));
+ if (tmp == NULL) {
+ warnx("malloc failed");
+ xexit(*argv, 1);
+ }
+ tmp2 = tmp;
+
+ /*
+ * Save the first argument and iterate over it, we
+ * cannot do strnsubst() to it.
+ */
+ if ((*tmp++ = strdup(*avj++)) == NULL) {
+ warnx("strdup failed");
+ xexit(*argv, 1);
+ }
+
+ /*
+ * For each argument to utility, if we have not used up
+ * the number of replacements we are allowed to do, and
+ * if the argument contains at least one occurrence of
+ * replstr, call strnsubst(), else just save the string.
+ * Iterations over elements of avj and tmp are done
+ * where appropriate.
+ */
+ while (--argc) {
+ *tmp = *avj++;
+ if (repls && strstr(*tmp, replstr) != NULL) {
+ strnsubst(tmp++, replstr, inpline, (size_t)Sflag);
+ if (repls > 0)
+ repls--;
+ } else {
+ if ((*tmp = strdup(*tmp)) == NULL) {
+ warnx("strdup failed");
+ xexit(*argv, 1);
+ }
+ tmp++;
+ }
+ }
+
+ /*
+ * Run it.
+ */
+ *tmp = NULL;
+ run(tmp2);
+
+ /*
+ * Walk from the tail to the head, free along the way.
+ */
+ for (; tmp2 != tmp; tmp--)
+ free(*tmp);
+ /*
+ * Now free the list itself.
+ */
+ free(tmp2);
+
+ /*
+ * Free the input line buffer, if we have one.
+ */
+ if (inpline != NULL) {
+ free(inpline);
+ inpline = NULL;
+ }
+}
+
+static void
+run(char **argv)
+{
+ pid_t pid;
+ int fd;
+ char **avec;
+
+ /*
+ * If the user wants to be notified of each command before it is
+ * executed, notify them. If they want the notification to be
+ * followed by a prompt, then prompt them.
+ */
+ if (tflag || pflag) {
+ (void)fprintf(stderr, "%s", *argv);
+ for (avec = argv + 1; *avec != NULL; ++avec)
+ (void)fprintf(stderr, " %s", *avec);
+ /*
+ * If the user has asked to be prompted, do so.
+ */
+ if (pflag)
+ /*
+ * If they asked not to exec, return without execution
+ * but if they asked to, go to the execution. If we
+ * could not open their tty, break the switch and drop
+ * back to -t behaviour.
+ */
+ switch (prompt()) {
+ case 0:
+ return;
+ case 1:
+ goto exec;
+ case 2:
+ break;
+ }
+ (void)fprintf(stderr, "\n");
+ (void)fflush(stderr);
+ }
+exec:
+ childerr = 0;
+ switch (pid = vfork()) {
+ case -1:
+ warn("vfork");
+ xexit(*argv, 1);
+ case 0:
+ if (oflag) {
+ if ((fd = open(_PATH_TTY, O_RDONLY)) == -1)
+ err(1, "can't open /dev/tty");
+ } else {
+ fd = open(_PATH_DEVNULL, O_RDONLY);
+ }
+ if (fd > STDIN_FILENO) {
+ if (dup2(fd, STDIN_FILENO) != 0)
+ err(1, "can't dup2 to stdin");
+ close(fd);
+ }
+ execvp(argv[0], argv);
+ childerr = errno;
+ _exit(1);
+ }
+ pids_add(pid);
+ waitchildren(*argv, 0);
+}
+
+/*
+ * Wait for a tracked child to exit and return its pid and exit status.
+ *
+ * Ignores (discards) all untracked child processes.
+ * Returns -1 and sets errno to ECHILD if no tracked children exist.
+ * If block is set, waits indefinitely for a child process to exit.
+ * If block is not set and no children have exited, returns 0 immediately.
+ */
+static pid_t
+xwait(int block, int *status) {
+ pid_t pid;
+
+ if (pids_empty()) {
+ errno = ECHILD;
+ return (-1);
+ }
+
+ while ((pid = waitpid(-1, status, block ? 0 : WNOHANG)) > 0)
+ if (pids_remove(pid))
+ break;
+
+ return (pid);
+}
+
+static void
+xexit(const char *name, const int exit_code) {
+ waitchildren(name, 1);
+ exit(exit_code);
+}
+
+static void
+waitchildren(const char *name, int waitall)
+{
+ pid_t pid;
+ int status;
+ int cause_exit = 0;
+
+ while ((pid = xwait(waitall || pids_full(), &status)) > 0) {
+ /*
+ * If we couldn't invoke the utility or if utility exited
+ * because of a signal or with a value of 255, warn (per
+ * POSIX), and then wait until all other children have
+ * exited before exiting 1-125. POSIX requires us to stop
+ * reading if child exits because of a signal or with 255,
+ * but it does not require us to exit immediately; waiting
+ * is preferable to orphaning.
+ */
+ if (childerr != 0 && cause_exit == 0) {
+ errno = childerr;
+ waitall = 1;
+ cause_exit = ENOENT ? 127 : 126;
+ warn("%s", name);
+ } else if (WIFSIGNALED(status)) {
+ waitall = cause_exit = 1;
+ warnx("%s: terminated with signal %d; aborting",
+ name, WTERMSIG(status));
+ } else if (WEXITSTATUS(status) == 255) {
+ waitall = cause_exit = 1;
+ warnx("%s: exited with status 255; aborting", name);
+ } else if (WEXITSTATUS(status))
+ rval = 1;
+ }
+
+ if (cause_exit)
+ exit(cause_exit);
+ if (pid == -1 && errno != ECHILD)
+ err(1, "waitpid");
+}
+
+#define NOPID (0)
+
+static void
+pids_init(void)
+{
+ int i;
+
+ if ((childpids = malloc(maxprocs * sizeof(*childpids))) == NULL)
+ errx(1, "malloc failed");
+
+ for (i = 0; i < maxprocs; i++)
+ clearslot(i);
+}
+
+static int
+pids_empty(void)
+{
+
+ return (curprocs == 0);
+}
+
+static int
+pids_full(void)
+{
+
+ return (curprocs >= maxprocs);
+}
+
+static void
+pids_add(pid_t pid)
+{
+ int slot;
+
+ slot = findfreeslot();
+ childpids[slot] = pid;
+ curprocs++;
+}
+
+static int
+pids_remove(pid_t pid)
+{
+ int slot;
+
+ if ((slot = findslot(pid)) < 0)
+ return (0);
+
+ clearslot(slot);
+ curprocs--;
+ return (1);
+}
+
+static int
+findfreeslot(void)
+{
+ int slot;
+
+ if ((slot = findslot(NOPID)) < 0)
+ errx(1, "internal error: no free pid slot");
+ return (slot);
+}
+
+static int
+findslot(pid_t pid)
+{
+ int slot;
+
+ for (slot = 0; slot < maxprocs; slot++)
+ if (childpids[slot] == pid)
+ return (slot);
+ return (-1);
+}
+
+static void
+clearslot(int slot)
+{
+
+ childpids[slot] = NOPID;
+}
+
+/*
+ * Prompt the user about running a command.
+ */
+static int
+prompt(void)
+{
+ regex_t cre;
+ size_t rsize;
+ int match;
+ char *response;
+ FILE *ttyfp;
+
+ if ((ttyfp = fopen(_PATH_TTY, "r")) == NULL)
+ return (2); /* Indicate that the TTY failed to open. */
+ (void)fprintf(stderr, "?...");
+ (void)fflush(stderr);
+ if ((response = fgetln(ttyfp, &rsize)) == NULL ||
+ regcomp(&cre, nl_langinfo(YESEXPR), REG_BASIC) != 0) {
+ (void)fclose(ttyfp);
+ return (0);
+ }
+ response[rsize - 1] = '\0';
+ match = regexec(&cre, response, 0, NULL, 0);
+ (void)fclose(ttyfp);
+ regfree(&cre);
+ return (match == 0);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+"usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements] [-S replsize]]\n"
+" [-J replstr] [-L number] [-n number [-x]] [-P maxprocs]\n"
+" [-s size] [utility [argument ...]]\n");
+ exit(1);
+}
diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile
new file mode 100644
index 0000000..dcb486b
--- /dev/null
+++ b/usr.bin/xinstall/Makefile
@@ -0,0 +1,21 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= xinstall
+PROGNAME= install
+SRCS= xinstall.c getid.c
+MAN= install.1
+
+.PATH: ${.CURDIR}/../../contrib/mtree
+CFLAGS+= -I${.CURDIR}/../../contrib/mtree
+CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd
+
+LIBADD= md
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xinstall/Makefile.depend b/usr.bin/xinstall/Makefile.depend
new file mode 100644
index 0000000..b4491b50
--- /dev/null
+++ b/usr.bin/xinstall/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1
new file mode 100644
index 0000000..a0afebe
--- /dev/null
+++ b/usr.bin/xinstall/install.1
@@ -0,0 +1,380 @@
+.\" Copyright (c) 1987, 1990, 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.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" From: @(#)install.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd January 18, 2013
+.Dt INSTALL 1
+.Os
+.Sh NAME
+.Nm install
+.Nd install binaries
+.Sh SYNOPSIS
+.Nm
+.Op Fl bCcpSsUv
+.Op Fl B Ar suffix
+.Op Fl D Ar destdir
+.Op Fl f Ar flags
+.Op Fl g Ar group
+.Op Fl h Ar hash
+.Op Fl l Ar linkflags
+.Op Fl M Ar metalog
+.Op Fl m Ar mode
+.Op Fl N Ar dbdir
+.Op Fl o Ar owner
+.Op Fl T Ar tags
+.Ar file1 file2
+.Nm
+.Op Fl bCcpSsUv
+.Op Fl B Ar suffix
+.Op Fl D Ar destdir
+.Op Fl f Ar flags
+.Op Fl g Ar group
+.Op Fl h Ar hash
+.Op Fl l Ar linkflags
+.Op Fl M Ar metalog
+.Op Fl m Ar mode
+.Op Fl N Ar dbdir
+.Op Fl o Ar owner
+.Op Fl T Ar tags
+.Ar file1 ... fileN directory
+.Nm
+.Fl d
+.Op Fl Uv
+.Op Fl D Ar destdir
+.Op Fl g Ar group
+.Op Fl h Ar hash
+.Op Fl M Ar metalog
+.Op Fl m Ar mode
+.Op Fl N Ar dbdir
+.Op Fl o Ar owner
+.Op Fl T Ar tags
+.Ar directory ...
+.Sh DESCRIPTION
+The file(s) are copied
+(or linked if the
+.Fl l
+option is specified) to the target file or directory.
+If the destination is a directory, then the
+.Ar file
+is copied into
+.Ar directory
+with its original filename.
+If the target file already exists, it is
+either renamed to
+.Ar file Ns Pa .old
+if the
+.Fl b
+option is given
+or overwritten
+if permissions allow.
+An alternate backup suffix may be specified via the
+.Fl B
+option's argument.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl b
+Back up any existing files before overwriting them by renaming
+them to
+.Ar file Ns Pa .old .
+See
+.Fl B
+for specifying a different backup suffix.
+.It Fl B Ar suffix
+Use
+.Ar suffix
+as the backup suffix if
+.Fl b
+is given.
+.It Fl C
+Copy the file.
+If the target file already exists and the files are the same,
+then do not change the modification time of the target.
+If the target's file flags and mode need not to be changed,
+the target's inode change time is also unchanged.
+.It Fl c
+Copy the file.
+This is actually the default.
+The
+.Fl c
+option is only included for backwards compatibility.
+.It Fl D Ar destdir
+Specify the
+.Ev DESTDIR
+(top of the file hierarchy) that the items are installed in to.
+If
+.Fl M Ar metalog
+is in use, a leading string of
+.Dq Ar destdir
+will be removed from the file names logged to the
+.Ar metalog .
+This option does not affect where the actual files are installed.
+.It Fl d
+Create directories.
+Missing parent directories are created as required.
+.It Fl f
+Specify the target's file flags; see
+.Xr chflags 1
+for a list of possible flags and their meanings.
+.It Fl g
+Specify a group.
+A numeric GID is allowed.
+.It Fl h Ar hash
+When copying, calculate the digest of the files with
+.Ar hash
+to store in the
+.Fl M Ar metalog .
+When
+.Fl d
+is given no hash is emitted.
+Supported digests:
+.Bl -tag -width rmd160 -offset indent
+.It Sy none
+No hash.
+This is the default.
+.It Sy md5
+The MD5 cryptographic message digest.
+.It Sy rmd160
+The RMD-160 cryptographic message digest.
+.It Sy sha1
+The SHA-1 cryptographic message digest.
+.It Sy sha256
+The 256-bits
+.Tn SHA-2
+cryptographic message digest of the file.
+.It Sy sha512
+The 512-bits
+.Tn SHA-2
+cryptographic message digest of the file.
+.El
+.It Fl l Ar linkflags
+Instead of copying the file make a link to the source.
+The type of the link is determined by the
+.Ar linkflags
+argument.
+Valid
+.Ar linkflags
+are:
+.Ar a
+(absolute),
+.Ar r
+(relative),
+.Ar h
+(hard),
+.Ar s
+(symbolic),
+.Ar m
+(mixed).
+Absolute and relative have effect only for symbolic links.
+Mixed links
+are hard links for files on the same filesystem, symbolic otherwise.
+.It Fl M Ar metalog
+Write the metadata associated with each item installed to
+.Ar metalog
+in an
+.Xr mtree 8
+.Dq full path
+specification line.
+The metadata includes: the file name and file type, and depending upon
+other options, the owner, group, file flags, modification time, and tags.
+.It Fl m
+Specify an alternate mode.
+The default mode is set to rwxr-xr-x (0755).
+The specified mode may be either an octal or symbolic value; see
+.Xr chmod 1
+for a description of possible mode values.
+.It Fl N
+Use the user database text file
+.Pa master.passwd
+and group database text file
+.Pa group
+from
+.Ar dbdir ,
+rather than using the results from the system's
+.Xr getpwnam 3
+and
+.Xr getgrnam 3
+(and related) library calls.
+.It Fl o
+Specify an owner.
+A numeric UID is allowed.
+.It Fl p
+Preserve the access and modification times.
+Copy the file, as if the
+.Fl C
+(compare and copy) option is specified,
+except if the target file does not already exist or is different,
+then preserve the access and modification times of the source file.
+.It Fl S
+Safe copy.
+Normally,
+.Nm
+unlinks an existing target before installing the new file.
+With the
+.Fl S
+flag a temporary file is used and then renamed to be
+the target.
+The reason this is safer is that if the copy or
+rename fails, the existing target is left untouched.
+.It Fl s
+.Nm
+exec's the command
+.Xr strip 1
+to strip binaries so that
+.Nm
+can be portable over a large
+number of systems and binary types.
+See below for how
+.Nm
+can be instructed to use another program to strip binaries.
+.It Fl T Ar tags
+Specify the
+.Xr mtree 8
+tags to write out for the file when using
+.Fl M Ar metalog .
+.It Fl U
+Indicate that install is running unprivileged, and that it should not
+try to change the owner, the group, or the file flags of the destination.
+The information that would have been updated can be stored in a log
+file with
+.Fl M Ar metalog .
+.It Fl v
+Cause
+.Nm
+to be verbose,
+showing files as they are installed or backed up.
+.El
+.Pp
+By default,
+.Nm
+preserves all file flags, with the exception of the
+.Dq nodump
+flag.
+.Pp
+The
+.Nm
+utility attempts to prevent moving a file onto itself.
+.Pp
+Installing
+.Pa /dev/null
+creates an empty file.
+.Sh ENVIRONMENT
+The
+.Nm
+utility checks for the presence of the
+.Ev STRIPBIN
+environment variable and if present,
+uses the assigned value as the program to run if and when the
+.Fl s
+option has been specified.
+.Pp
+If the
+.Ev DONTSTRIP
+environment variable is present,
+.Nm
+will ignore any specification of the
+.Fl s
+option.
+This is mainly for use in debugging the
+.Fx
+Ports Collection.
+.Sh FILES
+.Bl -tag -width ".Pa INS@XXXX" -compact
+.It Pa INS@XXXX
+If either
+.Fl S
+option is specified, or the
+.Fl C
+or
+.Fl p
+option is used in conjunction with the
+.Fl s
+option, temporary files named
+.Pa INS@XXXX ,
+where
+.Pa XXXX
+is decided by
+.Xr mkstemp 3 ,
+are created in the target directory.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh COMPATIBILITY
+Historically
+.Nm
+moved files by default.
+The default was changed to copy in
+.Fx 4.4 .
+.Sh SEE ALSO
+.Xr chflags 1 ,
+.Xr chgrp 1 ,
+.Xr chmod 1 ,
+.Xr cp 1 ,
+.Xr mv 1 ,
+.Xr strip 1 ,
+.Xr mmap 2 ,
+.Xr getgrnam 3 ,
+.Xr getpwnam 3 ,
+.Xr chown 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.2 .
+.Sh BUGS
+The meaning of the
+.Fl M
+option has changed as of
+.Fx 9.2
+and it now takes an argument.
+Command lines that used the old
+.Fl M
+will get an error or in rare cases will append logs to the first of
+multiple source files rather than installing it.
+.Pp
+Temporary files may be left in the target directory if
+.Nm
+exits abnormally.
+.Pp
+File flags cannot be set by
+.Xr fchflags 2
+over a NFS file system.
+Other file systems do not have a concept of flags.
+The
+.Nm
+utility will only warn when flags could not be set on a file system
+that does not support them.
+.Pp
+The
+.Nm
+utility with
+.Fl v
+falsely says a file is copied when
+.Fl C
+snaps hard links.
diff --git a/usr.bin/xinstall/tests/Makefile b/usr.bin/xinstall/tests/Makefile
new file mode 100644
index 0000000..55c189e
--- /dev/null
+++ b/usr.bin/xinstall/tests/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+ATF_TESTS_SH+= install_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/xinstall/tests/install_test.sh b/usr.bin/xinstall/tests/install_test.sh
new file mode 100755
index 0000000..9a9c69f
--- /dev/null
+++ b/usr.bin/xinstall/tests/install_test.sh
@@ -0,0 +1,345 @@
+#
+# Copyright (c) 2016 Jilles Tjoelker
+# 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$
+#
+
+copy_to_nonexistent_with_opts() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install "$@" testf copyf
+ cmp testf copyf || atf_fail "bad copy"
+ [ ! testf -nt copyf ] || atf_fail "bad timestamp"
+ [ ! -e copyf.bak ] || atf_fail "no backup expected"
+}
+
+atf_test_case copy_to_nonexistent
+copy_to_nonexistent_body() {
+ copy_to_nonexistent_with_opts
+}
+
+atf_test_case copy_to_nonexistent_safe
+copy_to_nonexistent_safe_body() {
+ copy_to_nonexistent_with_opts -S
+}
+
+atf_test_case copy_to_nonexistent_comparing
+copy_to_nonexistent_comparing_body() {
+ copy_to_nonexistent_with_opts -C
+}
+
+atf_test_case copy_to_nonexistent_safe_comparing
+copy_to_nonexistent_safe_comparing_body() {
+ copy_to_nonexistent_with_opts -S -C
+}
+
+atf_test_case copy_to_nonexistent_backup
+copy_to_nonexistent_backup_body() {
+ copy_to_nonexistent_with_opts -b -B.bak
+}
+
+atf_test_case copy_to_nonexistent_backup_safe
+copy_to_nonexistent_backup_safe_body() {
+ copy_to_nonexistent_with_opts -b -B.bak -S
+}
+
+atf_test_case copy_to_nonexistent_preserving
+copy_to_nonexistent_preserving_body() {
+ copy_to_nonexistent_with_opts -p
+ [ ! testf -ot copyf ] || atf_fail "bad timestamp 2"
+}
+
+copy_self_with_opts() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0z' >testf2
+ atf_check -s not-exit:0 -o empty -e match:. install "$@" testf testf
+ cmp testf testf2 || atf_fail "file changed after self-copy attempt"
+}
+
+atf_test_case copy_self
+copy_self_body() {
+ copy_self_with_opts
+}
+
+atf_test_case copy_self_safe
+copy_self_safe_body() {
+ copy_self_with_opts -S
+}
+
+atf_test_case copy_self_comparing
+copy_self_comparing_body() {
+ copy_self_with_opts -C
+}
+
+atf_test_case copy_self_safe_comparing
+copy_self_safe_comparing_body() {
+ copy_self_with_opts -S -C
+}
+
+overwrite_with_opts() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0w' >otherf
+ atf_check install "$@" testf otherf
+ cmp testf otherf || atf_fail "bad overwrite"
+ [ ! testf -nt otherf ] || atf_fail "bad timestamp"
+}
+
+atf_test_case overwrite
+overwrite_body() {
+ overwrite_with_opts
+}
+
+atf_test_case overwrite_safe
+overwrite_safe_body() {
+ overwrite_with_opts -S
+}
+
+atf_test_case overwrite_comparing
+overwrite_comparing_body() {
+ overwrite_with_opts -C
+}
+
+atf_test_case overwrite_safe_comparing
+overwrite_safe_comparing_body() {
+ overwrite_with_opts -S -C
+}
+
+overwrite_eq_with_opts() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0z' >otherf
+ atf_check install "$@" testf otherf
+ cmp testf otherf || atf_fail "bad overwrite"
+ [ ! testf -nt otherf ] || atf_fail "bad timestamp"
+}
+
+atf_test_case overwrite_eq
+overwrite_eq_body() {
+ overwrite_eq_with_opts
+}
+
+atf_test_case overwrite_eq_safe
+overwrite_eq_safe_body() {
+ overwrite_eq_with_opts -S
+}
+
+atf_test_case overwrite_eq_comparing
+overwrite_eq_comparing_body() {
+ overwrite_eq_with_opts -C
+}
+
+atf_test_case overwrite_eq_safe_comparing
+overwrite_eq_safe_comparing_body() {
+ overwrite_eq_with_opts -S -C
+}
+
+overwrite_backup_with_opts() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0w' >otherf
+ printf 'test\n123\r456\r\n789\0w' >otherf2
+ atf_check install -b -B.bak "$@" testf otherf
+ cmp testf otherf || atf_fail "bad overwrite"
+ [ ! testf -nt otherf ] || atf_fail "bad timestamp"
+ cmp otherf.bak otherf2 || atf_fail "bad backup"
+}
+
+atf_test_case overwrite_backup
+overwrite_backup_body() {
+ overwrite_backup_with_opts
+}
+
+atf_test_case overwrite_backup_safe
+overwrite_backup_safe_body() {
+ overwrite_backup_with_opts -S
+}
+
+atf_test_case overwrite_backup_comparing
+overwrite_backup_comparing_body() {
+ overwrite_backup_with_opts -C
+}
+
+atf_test_case overwrite_backup_safe_comparing
+overwrite_backup_safe_comparing_body() {
+ overwrite_backup_with_opts -S -C
+}
+
+setup_stripbin() {
+ cat <<\STRIPBIN >stripbin
+#!/bin/sh
+tr z @ <"$1" >"$1.new" && mv -- "$1.new" "$1"
+STRIPBIN
+ chmod 755 stripbin
+ export STRIPBIN="$PWD/stripbin"
+}
+
+strip_changing_with_opts() {
+ setup_stripbin
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -s "$@" testf copyf
+ [ ! testf -nt copyf ] || atf_fail "bad timestamp"
+ printf 'test\n123\r456\r\n789\0@' >otherf
+ cmp otherf copyf || atf_fail "bad stripped copy"
+}
+
+atf_test_case strip_changing
+strip_changing_body() {
+ strip_changing_with_opts
+}
+
+atf_test_case strip_changing_comparing
+strip_changing_comparing_body() {
+ strip_changing_with_opts -C
+}
+
+strip_changing_overwrite_with_opts() {
+ setup_stripbin
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0w' >copyf
+ atf_check install -s "$@" testf copyf
+ [ ! testf -nt copyf ] || atf_fail "bad timestamp"
+ printf 'test\n123\r456\r\n789\0@' >otherf
+ cmp otherf copyf || atf_fail "bad stripped copy"
+}
+
+atf_test_case strip_changing_overwrite
+strip_changing_overwrite_body() {
+ strip_changing_overwrite_with_opts
+}
+
+atf_test_case strip_changing_overwrite_comparing
+strip_changing_overwrite_comparing_body() {
+ strip_changing_overwrite_with_opts -C
+}
+
+strip_changing_overwrite_eq_with_opts() {
+ setup_stripbin
+ printf 'test\n123\r456\r\n789\0z' >testf
+ printf 'test\n123\r456\r\n789\0@' >copyf
+ atf_check install -s "$@" testf copyf
+ [ ! testf -nt copyf ] || atf_fail "bad timestamp"
+ printf 'test\n123\r456\r\n789\0@' >otherf
+ cmp otherf copyf || atf_fail "bad stripped copy"
+}
+
+atf_test_case strip_changing_overwrite_eq
+strip_changing_overwrite_eq_body() {
+ strip_changing_overwrite_eq_with_opts
+}
+
+atf_test_case strip_changing_overwrite_eq_comparing
+strip_changing_overwrite_eq_comparing_body() {
+ strip_changing_overwrite_eq_with_opts -C
+}
+
+atf_test_case strip_noop
+strip_noop_body() {
+ export STRIPBIN=true
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -s testf copyf
+ [ ! testf -nt copyf ] || atf_fail "bad timestamp"
+ printf 'test\n123\r456\r\n789\0z' >otherf
+ cmp otherf copyf || atf_fail "bad stripped copy"
+}
+
+atf_test_case hard_link
+hard_link_body() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -l h testf copyf
+ [ testf -ef copyf ] || atf_fail "not same file"
+ [ ! -L copyf ] || atf_fail "copy is symlink"
+}
+
+atf_test_case symbolic_link
+symbolic_link_body() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -l s testf copyf
+ [ testf -ef copyf ] || atf_fail "not same file"
+ [ -L copyf ] || atf_fail "copy is not symlink"
+}
+
+atf_test_case symbolic_link_absolute
+symbolic_link_absolute_body() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -l sa testf copyf
+ [ testf -ef copyf ] || atf_fail "not same file"
+ [ -L copyf ] || atf_fail "copy is not symlink"
+ [ "$(readlink copyf)" = "$(pwd -P)/testf" ] || atf_fail "unexpected symlink contents"
+}
+
+atf_test_case symbolic_link_relative
+symbolic_link_relative_body() {
+ printf 'test\n123\r456\r\n789\0z' >testf
+ atf_check install -l sr testf copyf
+ [ testf -ef copyf ] || atf_fail "not same file"
+ [ -L copyf ] || atf_fail "copy is not symlink"
+ [ "$(readlink copyf)" = "testf" ] || atf_fail "unexpected symlink contents"
+}
+
+atf_test_case mkdir_simple
+mkdir_simple_body() {
+ atf_check install -d dir1/dir2
+ [ -d dir1 ] || atf_fail "dir1 missing"
+ [ -d dir1/dir2 ] || atf_fail "dir2 missing"
+ atf_check install -d dir1/dir2/dir3
+ [ -d dir1/dir2/dir3 ] || atf_fail "dir3 missing"
+ atf_check install -d dir1
+ atf_check install -d dir1/dir2/dir3
+}
+
+atf_init_test_cases() {
+ atf_add_test_case copy_to_nonexistent
+ atf_add_test_case copy_to_nonexistent_safe
+ atf_add_test_case copy_to_nonexistent_comparing
+ atf_add_test_case copy_to_nonexistent_safe_comparing
+ atf_add_test_case copy_to_nonexistent_backup
+ atf_add_test_case copy_to_nonexistent_backup_safe
+ atf_add_test_case copy_to_nonexistent_preserving
+ atf_add_test_case copy_self
+ atf_add_test_case copy_self_safe
+ atf_add_test_case copy_self_comparing
+ atf_add_test_case copy_self_safe_comparing
+ atf_add_test_case overwrite
+ atf_add_test_case overwrite_safe
+ atf_add_test_case overwrite_comparing
+ atf_add_test_case overwrite_safe_comparing
+ atf_add_test_case overwrite_eq
+ atf_add_test_case overwrite_eq_safe
+ atf_add_test_case overwrite_eq_comparing
+ atf_add_test_case overwrite_eq_safe_comparing
+ atf_add_test_case overwrite_backup
+ atf_add_test_case overwrite_backup_safe
+ atf_add_test_case overwrite_backup_comparing
+ atf_add_test_case overwrite_backup_safe_comparing
+ atf_add_test_case strip_changing
+ atf_add_test_case strip_changing_comparing
+ atf_add_test_case strip_changing_overwrite
+ atf_add_test_case strip_changing_overwrite_comparing
+ atf_add_test_case strip_changing_overwrite_eq
+ atf_add_test_case strip_changing_overwrite_eq_comparing
+ atf_add_test_case strip_noop
+ atf_add_test_case hard_link
+ atf_add_test_case symbolic_link
+ atf_add_test_case symbolic_link_absolute
+ atf_add_test_case symbolic_link_relative
+ atf_add_test_case mkdir_simple
+}
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
new file mode 100644
index 0000000..5e05ba8
--- /dev/null
+++ b/usr.bin/xinstall/xinstall.c
@@ -0,0 +1,1418 @@
+/*
+ * Copyright (c) 2012, 2013 SRI International
+ * Copyright (c) 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.
+ * 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.
+ *
+ * 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) 1987, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <libgen.h>
+#include <md5.h>
+#include <paths.h>
+#include <pwd.h>
+#include <ripemd.h>
+#include <sha.h>
+#include <sha256.h>
+#include <sha512.h>
+#include <spawn.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <vis.h>
+
+#include "mtree.h"
+
+#define MAX_CMP_SIZE (16 * 1024 * 1024)
+
+#define LN_ABSOLUTE 0x01
+#define LN_RELATIVE 0x02
+#define LN_HARD 0x04
+#define LN_SYMBOLIC 0x08
+#define LN_MIXED 0x10
+
+#define DIRECTORY 0x01 /* Tell install it's a directory. */
+#define SETFLAGS 0x02 /* Tell install to set flags. */
+#define NOCHANGEBITS (UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_APPEND)
+#define BACKUP_SUFFIX ".old"
+
+typedef union {
+ MD5_CTX MD5;
+ RIPEMD160_CTX RIPEMD160;
+ SHA1_CTX SHA1;
+ SHA256_CTX SHA256;
+ SHA512_CTX SHA512;
+} DIGEST_CTX;
+
+static enum {
+ DIGEST_NONE = 0,
+ DIGEST_MD5,
+ DIGEST_RIPEMD160,
+ DIGEST_SHA1,
+ DIGEST_SHA256,
+ DIGEST_SHA512,
+} digesttype = DIGEST_NONE;
+
+extern char **environ;
+
+static gid_t gid;
+static uid_t uid;
+static int dobackup, docompare, dodir, dolink, dopreserve, dostrip, dounpriv,
+ safecopy, verbose;
+static int haveopt_f, haveopt_g, haveopt_m, haveopt_o;
+static mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+static FILE *metafp;
+static const char *group, *owner;
+static const char *suffix = BACKUP_SUFFIX;
+static char *destdir, *digest, *fflags, *metafile, *tags;
+
+static int compare(int, const char *, size_t, int, const char *, size_t,
+ char **);
+static char *copy(int, const char *, int, const char *, off_t);
+static int create_newfile(const char *, int, struct stat *);
+static int create_tempfile(const char *, char *, size_t);
+static char *quiet_mktemp(char *template);
+static char *digest_file(const char *);
+static void digest_init(DIGEST_CTX *);
+static void digest_update(DIGEST_CTX *, const char *, size_t);
+static char *digest_end(DIGEST_CTX *, char *);
+static int do_link(const char *, const char *, const struct stat *);
+static void do_symlink(const char *, const char *, const struct stat *);
+static void makelink(const char *, const char *, const struct stat *);
+static void install(const char *, const char *, u_long, u_int);
+static void install_dir(char *);
+static void metadata_log(const char *, const char *, struct timespec *,
+ const char *, const char *, off_t);
+static int parseid(const char *, id_t *);
+static void strip(const char *);
+static int trymmap(int);
+static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct stat from_sb, to_sb;
+ mode_t *set;
+ u_long fset;
+ int ch, no_target;
+ u_int iflags;
+ char *p;
+ const char *to_name;
+
+ iflags = 0;
+ group = owner = NULL;
+ while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
+ -1)
+ switch((char)ch) {
+ case 'B':
+ suffix = optarg;
+ /* FALLTHROUGH */
+ case 'b':
+ dobackup = 1;
+ break;
+ case 'C':
+ docompare = 1;
+ break;
+ case 'c':
+ /* For backwards compatibility. */
+ break;
+ case 'D':
+ destdir = optarg;
+ break;
+ case 'd':
+ dodir = 1;
+ break;
+ case 'f':
+ haveopt_f = 1;
+ fflags = optarg;
+ break;
+ case 'g':
+ haveopt_g = 1;
+ group = optarg;
+ break;
+ case 'h':
+ digest = optarg;
+ break;
+ case 'l':
+ for (p = optarg; *p != '\0'; p++)
+ switch (*p) {
+ case 's':
+ dolink &= ~(LN_HARD|LN_MIXED);
+ dolink |= LN_SYMBOLIC;
+ break;
+ case 'h':
+ dolink &= ~(LN_SYMBOLIC|LN_MIXED);
+ dolink |= LN_HARD;
+ break;
+ case 'm':
+ dolink &= ~(LN_SYMBOLIC|LN_HARD);
+ dolink |= LN_MIXED;
+ break;
+ case 'a':
+ dolink &= ~LN_RELATIVE;
+ dolink |= LN_ABSOLUTE;
+ break;
+ case 'r':
+ dolink &= ~LN_ABSOLUTE;
+ dolink |= LN_RELATIVE;
+ break;
+ default:
+ errx(1, "%c: invalid link type", *p);
+ /* NOTREACHED */
+ }
+ break;
+ case 'M':
+ metafile = optarg;
+ break;
+ case 'm':
+ haveopt_m = 1;
+ if (!(set = setmode(optarg)))
+ errx(EX_USAGE, "invalid file mode: %s",
+ optarg);
+ mode = getmode(set, 0);
+ free(set);
+ break;
+ case 'N':
+ if (!setup_getid(optarg))
+ err(EX_OSERR, "Unable to use user and group "
+ "databases in `%s'", optarg);
+ break;
+ case 'o':
+ haveopt_o = 1;
+ owner = optarg;
+ break;
+ case 'p':
+ docompare = dopreserve = 1;
+ break;
+ case 'S':
+ safecopy = 1;
+ break;
+ case 's':
+ dostrip = 1;
+ break;
+ case 'T':
+ tags = optarg;
+ break;
+ case 'U':
+ dounpriv = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* some options make no sense when creating directories */
+ if (dostrip && dodir) {
+ warnx("-d and -s may not be specified together");
+ usage();
+ }
+
+ if (getenv("DONTSTRIP") != NULL) {
+ warnx("DONTSTRIP set - will not strip installed binaries");
+ dostrip = 0;
+ }
+
+ /* must have at least two arguments, except when creating directories */
+ if (argc == 0 || (argc == 1 && !dodir))
+ usage();
+
+ if (digest != NULL) {
+ if (strcmp(digest, "none") == 0) {
+ digesttype = DIGEST_NONE;
+ } else if (strcmp(digest, "md5") == 0) {
+ digesttype = DIGEST_MD5;
+ } else if (strcmp(digest, "rmd160") == 0) {
+ digesttype = DIGEST_RIPEMD160;
+ } else if (strcmp(digest, "sha1") == 0) {
+ digesttype = DIGEST_SHA1;
+ } else if (strcmp(digest, "sha256") == 0) {
+ digesttype = DIGEST_SHA256;
+ } else if (strcmp(digest, "sha512") == 0) {
+ digesttype = DIGEST_SHA512;
+ } else {
+ warnx("unknown digest `%s'", digest);
+ usage();
+ }
+ }
+
+ /* need to make a temp copy so we can compare stripped version */
+ if (docompare && dostrip)
+ safecopy = 1;
+
+ /* get group and owner id's */
+ if (group != NULL && !dounpriv) {
+ if (gid_from_group(group, &gid) == -1) {
+ id_t id;
+ if (!parseid(group, &id))
+ errx(1, "unknown group %s", group);
+ gid = id;
+ }
+ } else
+ gid = (gid_t)-1;
+
+ if (owner != NULL && !dounpriv) {
+ if (uid_from_user(owner, &uid) == -1) {
+ id_t id;
+ if (!parseid(owner, &id))
+ errx(1, "unknown user %s", owner);
+ uid = id;
+ }
+ } else
+ uid = (uid_t)-1;
+
+ if (fflags != NULL && !dounpriv) {
+ if (strtofflags(&fflags, &fset, NULL))
+ errx(EX_USAGE, "%s: invalid flag", fflags);
+ iflags |= SETFLAGS;
+ }
+
+ if (metafile != NULL) {
+ if ((metafp = fopen(metafile, "a")) == NULL)
+ warn("open %s", metafile);
+ } else
+ digesttype = DIGEST_NONE;
+
+ if (dodir) {
+ for (; *argv != NULL; ++argv)
+ install_dir(*argv);
+ exit(EX_OK);
+ /* NOTREACHED */
+ }
+
+ to_name = argv[argc - 1];
+ no_target = stat(to_name, &to_sb);
+ if (!no_target && S_ISDIR(to_sb.st_mode)) {
+ if (dolink & LN_SYMBOLIC) {
+ if (lstat(to_name, &to_sb) != 0)
+ err(EX_OSERR, "%s vanished", to_name);
+ if (S_ISLNK(to_sb.st_mode)) {
+ if (argc != 2) {
+ errno = ENOTDIR;
+ err(EX_USAGE, "%s", to_name);
+ }
+ install(*argv, to_name, fset, iflags);
+ exit(EX_OK);
+ }
+ }
+ for (; *argv != to_name; ++argv)
+ install(*argv, to_name, fset, iflags | DIRECTORY);
+ exit(EX_OK);
+ /* NOTREACHED */
+ }
+
+ /* can't do file1 file2 directory/file */
+ if (argc != 2) {
+ if (no_target)
+ warnx("target directory `%s' does not exist",
+ argv[argc - 1]);
+ else
+ warnx("target `%s' is not a directory",
+ argv[argc - 1]);
+ usage();
+ }
+
+ if (!no_target && !dolink) {
+ if (stat(*argv, &from_sb))
+ err(EX_OSERR, "%s", *argv);
+ if (!S_ISREG(to_sb.st_mode)) {
+ errno = EFTYPE;
+ err(EX_OSERR, "%s", to_name);
+ }
+ if (to_sb.st_dev == from_sb.st_dev &&
+ to_sb.st_ino == from_sb.st_ino)
+ errx(EX_USAGE,
+ "%s and %s are the same file", *argv, to_name);
+ }
+ install(*argv, to_name, fset, iflags);
+ exit(EX_OK);
+ /* NOTREACHED */
+}
+
+static char *
+digest_file(const char *name)
+{
+
+ switch (digesttype) {
+ case DIGEST_MD5:
+ return (MD5File(name, NULL));
+ case DIGEST_RIPEMD160:
+ return (RIPEMD160_File(name, NULL));
+ case DIGEST_SHA1:
+ return (SHA1_File(name, NULL));
+ case DIGEST_SHA256:
+ return (SHA256_File(name, NULL));
+ case DIGEST_SHA512:
+ return (SHA512_File(name, NULL));
+ default:
+ return (NULL);
+ }
+}
+
+static void
+digest_init(DIGEST_CTX *c)
+{
+
+ switch (digesttype) {
+ case DIGEST_NONE:
+ break;
+ case DIGEST_MD5:
+ MD5Init(&(c->MD5));
+ break;
+ case DIGEST_RIPEMD160:
+ RIPEMD160_Init(&(c->RIPEMD160));
+ break;
+ case DIGEST_SHA1:
+ SHA1_Init(&(c->SHA1));
+ break;
+ case DIGEST_SHA256:
+ SHA256_Init(&(c->SHA256));
+ break;
+ case DIGEST_SHA512:
+ SHA512_Init(&(c->SHA512));
+ break;
+ }
+}
+
+static void
+digest_update(DIGEST_CTX *c, const char *data, size_t len)
+{
+
+ switch (digesttype) {
+ case DIGEST_NONE:
+ break;
+ case DIGEST_MD5:
+ MD5Update(&(c->MD5), data, len);
+ break;
+ case DIGEST_RIPEMD160:
+ RIPEMD160_Update(&(c->RIPEMD160), data, len);
+ break;
+ case DIGEST_SHA1:
+ SHA1_Update(&(c->SHA1), data, len);
+ break;
+ case DIGEST_SHA256:
+ SHA256_Update(&(c->SHA256), data, len);
+ break;
+ case DIGEST_SHA512:
+ SHA512_Update(&(c->SHA512), data, len);
+ break;
+ }
+}
+
+static char *
+digest_end(DIGEST_CTX *c, char *buf)
+{
+
+ switch (digesttype) {
+ case DIGEST_MD5:
+ return (MD5End(&(c->MD5), buf));
+ case DIGEST_RIPEMD160:
+ return (RIPEMD160_End(&(c->RIPEMD160), buf));
+ case DIGEST_SHA1:
+ return (SHA1_End(&(c->SHA1), buf));
+ case DIGEST_SHA256:
+ return (SHA256_End(&(c->SHA256), buf));
+ case DIGEST_SHA512:
+ return (SHA512_End(&(c->SHA512), buf));
+ default:
+ return (NULL);
+ }
+}
+
+/*
+ * parseid --
+ * parse uid or gid from arg into id, returning non-zero if successful
+ */
+static int
+parseid(const char *name, id_t *id)
+{
+ char *ep;
+ errno = 0;
+ *id = (id_t)strtoul(name, &ep, 10);
+ if (errno || *ep != '\0')
+ return (0);
+ return (1);
+}
+
+/*
+ * quiet_mktemp --
+ * mktemp implementation used mkstemp to avoid mktemp warnings. We
+ * really do need mktemp semantics here as we will be creating a link.
+ */
+static char *
+quiet_mktemp(char *template)
+{
+ int fd;
+
+ if ((fd = mkstemp(template)) == -1)
+ return (NULL);
+ close (fd);
+ if (unlink(template) == -1)
+ err(EX_OSERR, "unlink %s", template);
+ return (template);
+}
+
+/*
+ * do_link --
+ * make a hard link, obeying dorename if set
+ * return -1 on failure
+ */
+static int
+do_link(const char *from_name, const char *to_name,
+ const struct stat *target_sb)
+{
+ char tmpl[MAXPATHLEN];
+ int ret;
+
+ if (safecopy && target_sb != NULL) {
+ (void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name);
+ /* This usage is safe. */
+ if (quiet_mktemp(tmpl) == NULL)
+ err(EX_OSERR, "%s: mktemp", tmpl);
+ ret = link(from_name, tmpl);
+ if (ret == 0) {
+ if (target_sb->st_mode & S_IFDIR && rmdir(to_name) ==
+ -1) {
+ unlink(tmpl);
+ err(EX_OSERR, "%s", to_name);
+ }
+ if (target_sb->st_flags & NOCHANGEBITS)
+ (void)chflags(to_name, target_sb->st_flags &
+ ~NOCHANGEBITS);
+ unlink(to_name);
+ ret = rename(tmpl, to_name);
+ /*
+ * If rename has posix semantics, then the temporary
+ * file may still exist when from_name and to_name point
+ * to the same file, so unlink it unconditionally.
+ */
+ (void)unlink(tmpl);
+ }
+ return (ret);
+ } else
+ return (link(from_name, to_name));
+}
+
+/*
+ * do_symlink --
+ * Make a symbolic link, obeying dorename if set. Exit on failure.
+ */
+static void
+do_symlink(const char *from_name, const char *to_name,
+ const struct stat *target_sb)
+{
+ char tmpl[MAXPATHLEN];
+
+ if (safecopy && target_sb != NULL) {
+ (void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name);
+ /* This usage is safe. */
+ if (quiet_mktemp(tmpl) == NULL)
+ err(EX_OSERR, "%s: mktemp", tmpl);
+
+ if (symlink(from_name, tmpl) == -1)
+ err(EX_OSERR, "symlink %s -> %s", from_name, tmpl);
+
+ if (target_sb->st_mode & S_IFDIR && rmdir(to_name) == -1) {
+ (void)unlink(tmpl);
+ err(EX_OSERR, "%s", to_name);
+ }
+ if (target_sb->st_flags & NOCHANGEBITS)
+ (void)chflags(to_name, target_sb->st_flags &
+ ~NOCHANGEBITS);
+ unlink(to_name);
+
+ if (rename(tmpl, to_name) == -1) {
+ /* Remove temporary link before exiting. */
+ (void)unlink(tmpl);
+ err(EX_OSERR, "%s: rename", to_name);
+ }
+ } else {
+ if (symlink(from_name, to_name) == -1)
+ err(EX_OSERR, "symlink %s -> %s", from_name, to_name);
+ }
+}
+
+/*
+ * makelink --
+ * make a link from source to destination
+ */
+static void
+makelink(const char *from_name, const char *to_name,
+ const struct stat *target_sb)
+{
+ char src[MAXPATHLEN], dst[MAXPATHLEN], lnk[MAXPATHLEN];
+ struct stat to_sb;
+
+ /* Try hard links first. */
+ if (dolink & (LN_HARD|LN_MIXED)) {
+ if (do_link(from_name, to_name, target_sb) == -1) {
+ if ((dolink & LN_HARD) || errno != EXDEV)
+ err(EX_OSERR, "link %s -> %s", from_name, to_name);
+ } else {
+ if (stat(to_name, &to_sb))
+ err(EX_OSERR, "%s: stat", to_name);
+ if (S_ISREG(to_sb.st_mode)) {
+ /*
+ * XXX: hard links to anything other than
+ * plain files are not metalogged
+ */
+ int omode;
+ const char *oowner, *ogroup;
+ char *offlags;
+ char *dres;
+
+ /*
+ * XXX: use underlying perms, unless
+ * overridden on command line.
+ */
+ omode = mode;
+ if (!haveopt_m)
+ mode = (to_sb.st_mode & 0777);
+ oowner = owner;
+ if (!haveopt_o)
+ owner = NULL;
+ ogroup = group;
+ if (!haveopt_g)
+ group = NULL;
+ offlags = fflags;
+ if (!haveopt_f)
+ fflags = NULL;
+ dres = digest_file(from_name);
+ metadata_log(to_name, "file", NULL, NULL,
+ dres, to_sb.st_size);
+ free(dres);
+ mode = omode;
+ owner = oowner;
+ group = ogroup;
+ fflags = offlags;
+ }
+ return;
+ }
+ }
+
+ /* Symbolic links. */
+ if (dolink & LN_ABSOLUTE) {
+ /* Convert source path to absolute. */
+ if (realpath(from_name, src) == NULL)
+ err(EX_OSERR, "%s: realpath", from_name);
+ do_symlink(src, to_name, target_sb);
+ /* XXX: src may point outside of destdir */
+ metadata_log(to_name, "link", NULL, src, NULL, 0);
+ return;
+ }
+
+ if (dolink & LN_RELATIVE) {
+ char *cp, *d, *s;
+
+ if (*from_name != '/') {
+ /* this is already a relative link */
+ do_symlink(from_name, to_name, target_sb);
+ /* XXX: from_name may point outside of destdir. */
+ metadata_log(to_name, "link", NULL, from_name, NULL, 0);
+ return;
+ }
+
+ /* Resolve pathnames. */
+ if (realpath(from_name, src) == NULL)
+ err(EX_OSERR, "%s: realpath", from_name);
+
+ /*
+ * The last component of to_name may be a symlink,
+ * so use realpath to resolve only the directory.
+ */
+ cp = dirname(to_name);
+ if (realpath(cp, dst) == NULL)
+ err(EX_OSERR, "%s: realpath", cp);
+ /* .. and add the last component. */
+ if (strcmp(dst, "/") != 0) {
+ if (strlcat(dst, "/", sizeof(dst)) > sizeof(dst))
+ errx(1, "resolved pathname too long");
+ }
+ cp = basename(to_name);
+ if (strlcat(dst, cp, sizeof(dst)) > sizeof(dst))
+ errx(1, "resolved pathname too long");
+
+ /* Trim common path components. */
+ for (s = src, d = dst; *s == *d; s++, d++)
+ continue;
+ while (*s != '/')
+ s--, d--;
+
+ /* Count the number of directories we need to backtrack. */
+ for (++d, lnk[0] = '\0'; *d; d++)
+ if (*d == '/')
+ (void)strlcat(lnk, "../", sizeof(lnk));
+
+ (void)strlcat(lnk, ++s, sizeof(lnk));
+
+ do_symlink(lnk, to_name, target_sb);
+ /* XXX: Link may point outside of destdir. */
+ metadata_log(to_name, "link", NULL, lnk, NULL, 0);
+ return;
+ }
+
+ /*
+ * If absolute or relative was not specified, try the names the
+ * user provided.
+ */
+ do_symlink(from_name, to_name, target_sb);
+ /* XXX: from_name may point outside of destdir. */
+ metadata_log(to_name, "link", NULL, from_name, NULL, 0);
+}
+
+/*
+ * install --
+ * build a path name and install the file
+ */
+static void
+install(const char *from_name, const char *to_name, u_long fset, u_int flags)
+{
+ struct stat from_sb, temp_sb, to_sb;
+ struct timespec tsb[2];
+ int devnull, files_match, from_fd, serrno, target;
+ int tempcopy, temp_fd, to_fd;
+ char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
+ char *digestresult;
+
+ files_match = 0;
+ from_fd = -1;
+ to_fd = -1;
+
+ /* If try to install NULL file to a directory, fails. */
+ if (flags & DIRECTORY || strcmp(from_name, _PATH_DEVNULL)) {
+ if (!dolink) {
+ if (stat(from_name, &from_sb))
+ err(EX_OSERR, "%s", from_name);
+ if (!S_ISREG(from_sb.st_mode)) {
+ errno = EFTYPE;
+ err(EX_OSERR, "%s", from_name);
+ }
+ }
+ /* Build the target path. */
+ if (flags & DIRECTORY) {
+ (void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
+ to_name,
+ (p = strrchr(from_name, '/')) ? ++p : from_name);
+ to_name = pathbuf;
+ }
+ devnull = 0;
+ } else {
+ devnull = 1;
+ }
+
+ target = (lstat(to_name, &to_sb) == 0);
+
+ if (dolink) {
+ if (target && !safecopy) {
+ if (to_sb.st_mode & S_IFDIR && rmdir(to_name) == -1)
+ err(EX_OSERR, "%s", to_name);
+ if (to_sb.st_flags & NOCHANGEBITS)
+ (void)chflags(to_name,
+ to_sb.st_flags & ~NOCHANGEBITS);
+ unlink(to_name);
+ }
+ makelink(from_name, to_name, target ? &to_sb : NULL);
+ return;
+ }
+
+ if (target && !S_ISREG(to_sb.st_mode) && !S_ISLNK(to_sb.st_mode)) {
+ errno = EFTYPE;
+ warn("%s", to_name);
+ return;
+ }
+
+ /* Only copy safe if the target exists. */
+ tempcopy = safecopy && target;
+
+ if (!devnull && (from_fd = open(from_name, O_RDONLY, 0)) < 0)
+ err(EX_OSERR, "%s", from_name);
+
+ /* If we don't strip, we can compare first. */
+ if (docompare && !dostrip && target && S_ISREG(to_sb.st_mode)) {
+ if ((to_fd = open(to_name, O_RDONLY, 0)) < 0)
+ err(EX_OSERR, "%s", to_name);
+ if (devnull)
+ files_match = to_sb.st_size == 0;
+ else
+ files_match = !(compare(from_fd, from_name,
+ (size_t)from_sb.st_size, to_fd,
+ to_name, (size_t)to_sb.st_size, &digestresult));
+
+ /* Close "to" file unless we match. */
+ if (!files_match)
+ (void)close(to_fd);
+ }
+
+ if (!files_match) {
+ if (tempcopy) {
+ to_fd = create_tempfile(to_name, tempfile,
+ sizeof(tempfile));
+ if (to_fd < 0)
+ err(EX_OSERR, "%s", tempfile);
+ } else {
+ if ((to_fd = create_newfile(to_name, target,
+ &to_sb)) < 0)
+ err(EX_OSERR, "%s", to_name);
+ if (verbose)
+ (void)printf("install: %s -> %s\n",
+ from_name, to_name);
+ }
+ if (!devnull)
+ digestresult = copy(from_fd, from_name, to_fd,
+ tempcopy ? tempfile : to_name, from_sb.st_size);
+ else
+ digestresult = NULL;
+ }
+
+ if (dostrip) {
+ strip(tempcopy ? tempfile : to_name);
+
+ /*
+ * Re-open our fd on the target, in case we used a strip
+ * that does not work in-place -- like GNU binutils strip.
+ */
+ close(to_fd);
+ to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY, 0);
+ if (to_fd < 0)
+ err(EX_OSERR, "stripping %s", to_name);
+ }
+
+ /*
+ * Compare the stripped temp file with the target.
+ */
+ if (docompare && dostrip && target && S_ISREG(to_sb.st_mode)) {
+ temp_fd = to_fd;
+
+ /* Re-open to_fd using the real target name. */
+ if ((to_fd = open(to_name, O_RDONLY, 0)) < 0)
+ err(EX_OSERR, "%s", to_name);
+
+ if (fstat(temp_fd, &temp_sb)) {
+ serrno = errno;
+ (void)unlink(tempfile);
+ errno = serrno;
+ err(EX_OSERR, "%s", tempfile);
+ }
+
+ if (compare(temp_fd, tempfile, (size_t)temp_sb.st_size, to_fd,
+ to_name, (size_t)to_sb.st_size, &digestresult)
+ == 0) {
+ /*
+ * If target has more than one link we need to
+ * replace it in order to snap the extra links.
+ * Need to preserve target file times, though.
+ */
+ if (to_sb.st_nlink != 1) {
+ tsb[0] = to_sb.st_atim;
+ tsb[1] = to_sb.st_mtim;
+ (void)utimensat(AT_FDCWD, tempfile, tsb, 0);
+ } else {
+ files_match = 1;
+ (void)unlink(tempfile);
+ }
+ (void) close(temp_fd);
+ }
+ } else if (dostrip)
+ digestresult = digest_file(tempfile);
+
+ /*
+ * Move the new file into place if doing a safe copy
+ * and the files are different (or just not compared).
+ */
+ if (tempcopy && !files_match) {
+ /* Try to turn off the immutable bits. */
+ if (to_sb.st_flags & NOCHANGEBITS)
+ (void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS);
+ if (dobackup) {
+ if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s", to_name,
+ suffix) != strlen(to_name) + strlen(suffix)) {
+ unlink(tempfile);
+ errx(EX_OSERR, "%s: backup filename too long",
+ to_name);
+ }
+ if (verbose)
+ (void)printf("install: %s -> %s\n", to_name, backup);
+ if (rename(to_name, backup) < 0) {
+ serrno = errno;
+ unlink(tempfile);
+ errno = serrno;
+ err(EX_OSERR, "rename: %s to %s", to_name,
+ backup);
+ }
+ }
+ if (verbose)
+ (void)printf("install: %s -> %s\n", from_name, to_name);
+ if (rename(tempfile, to_name) < 0) {
+ serrno = errno;
+ unlink(tempfile);
+ errno = serrno;
+ err(EX_OSERR, "rename: %s to %s",
+ tempfile, to_name);
+ }
+
+ /* Re-open to_fd so we aren't hosed by the rename(2). */
+ (void) close(to_fd);
+ if ((to_fd = open(to_name, O_RDONLY, 0)) < 0)
+ err(EX_OSERR, "%s", to_name);
+ }
+
+ /*
+ * Preserve the timestamp of the source file if necessary.
+ */
+ if (dopreserve && !files_match && !devnull) {
+ tsb[0] = from_sb.st_atim;
+ tsb[1] = from_sb.st_mtim;
+ (void)utimensat(AT_FDCWD, to_name, tsb, 0);
+ }
+
+ if (fstat(to_fd, &to_sb) == -1) {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
+
+ /*
+ * Set owner, group, mode for target; do the chown first,
+ * chown may lose the setuid bits.
+ */
+ if (!dounpriv && ((gid != (gid_t)-1 && gid != to_sb.st_gid) ||
+ (uid != (uid_t)-1 && uid != to_sb.st_uid) ||
+ (mode != (to_sb.st_mode & ALLPERMS)))) {
+ /* Try to turn off the immutable bits. */
+ if (to_sb.st_flags & NOCHANGEBITS)
+ (void)fchflags(to_fd, to_sb.st_flags & ~NOCHANGEBITS);
+ }
+
+ if (!dounpriv &
+ (gid != (gid_t)-1 && gid != to_sb.st_gid) ||
+ (uid != (uid_t)-1 && uid != to_sb.st_uid))
+ if (fchown(to_fd, uid, gid) == -1) {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR,"%s: chown/chgrp", to_name);
+ }
+
+ if (mode != (to_sb.st_mode & ALLPERMS)) {
+ if (fchmod(to_fd,
+ dounpriv ? mode & (S_IRWXU|S_IRWXG|S_IRWXO) : mode)) {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR, "%s: chmod", to_name);
+ }
+ }
+
+ /*
+ * If provided a set of flags, set them, otherwise, preserve the
+ * flags, except for the dump flag.
+ * NFS does not support flags. Ignore EOPNOTSUPP flags if we're just
+ * trying to turn off UF_NODUMP. If we're trying to set real flags,
+ * then warn if the fs doesn't support it, otherwise fail.
+ */
+ if (!dounpriv & !devnull && (flags & SETFLAGS ||
+ (from_sb.st_flags & ~UF_NODUMP) != to_sb.st_flags) &&
+ fchflags(to_fd,
+ flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) {
+ if (flags & SETFLAGS) {
+ if (errno == EOPNOTSUPP)
+ warn("%s: chflags", to_name);
+ else {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR, "%s: chflags", to_name);
+ }
+ }
+ }
+
+ (void)close(to_fd);
+ if (!devnull)
+ (void)close(from_fd);
+
+ metadata_log(to_name, "file", tsb, NULL, digestresult, to_sb.st_size);
+ free(digestresult);
+}
+
+/*
+ * compare --
+ * compare two files; non-zero means files differ
+ */
+static int
+compare(int from_fd, const char *from_name __unused, size_t from_len,
+ int to_fd, const char *to_name __unused, size_t to_len,
+ char **dresp)
+{
+ char *p, *q;
+ int rv;
+ int done_compare;
+ DIGEST_CTX ctx;
+
+ rv = 0;
+ if (from_len != to_len)
+ return 1;
+
+ if (from_len <= MAX_CMP_SIZE) {
+ if (dresp != NULL)
+ digest_init(&ctx);
+ done_compare = 0;
+ if (trymmap(from_fd) && trymmap(to_fd)) {
+ p = mmap(NULL, from_len, PROT_READ, MAP_SHARED,
+ from_fd, (off_t)0);
+ if (p == MAP_FAILED)
+ goto out;
+ q = mmap(NULL, from_len, PROT_READ, MAP_SHARED,
+ to_fd, (off_t)0);
+ if (q == MAP_FAILED) {
+ munmap(p, from_len);
+ goto out;
+ }
+
+ rv = memcmp(p, q, from_len);
+ if (dresp != NULL)
+ digest_update(&ctx, p, from_len);
+ munmap(p, from_len);
+ munmap(q, from_len);
+ done_compare = 1;
+ }
+ out:
+ if (!done_compare) {
+ char buf1[MAXBSIZE];
+ char buf2[MAXBSIZE];
+ int n1, n2;
+
+ rv = 0;
+ lseek(from_fd, 0, SEEK_SET);
+ lseek(to_fd, 0, SEEK_SET);
+ while (rv == 0) {
+ n1 = read(from_fd, buf1, sizeof(buf1));
+ if (n1 == 0)
+ break; /* EOF */
+ else if (n1 > 0) {
+ n2 = read(to_fd, buf2, n1);
+ if (n2 == n1)
+ rv = memcmp(buf1, buf2, n1);
+ else
+ rv = 1; /* out of sync */
+ } else
+ rv = 1; /* read failure */
+ digest_update(&ctx, buf1, n1);
+ }
+ lseek(from_fd, 0, SEEK_SET);
+ lseek(to_fd, 0, SEEK_SET);
+ }
+ } else
+ rv = 1; /* don't bother in this case */
+
+ if (dresp != NULL) {
+ if (rv == 0)
+ *dresp = digest_end(&ctx, NULL);
+ else
+ (void)digest_end(&ctx, NULL);
+ }
+
+ return rv;
+}
+
+/*
+ * create_tempfile --
+ * create a temporary file based on path and open it
+ */
+static int
+create_tempfile(const char *path, char *temp, size_t tsize)
+{
+ char *p;
+
+ (void)strncpy(temp, path, tsize);
+ temp[tsize - 1] = '\0';
+ if ((p = strrchr(temp, '/')) != NULL)
+ p++;
+ else
+ p = temp;
+ (void)strncpy(p, "INS@XXXX", &temp[tsize - 1] - p);
+ temp[tsize - 1] = '\0';
+ return (mkstemp(temp));
+}
+
+/*
+ * create_newfile --
+ * create a new file, overwriting an existing one if necessary
+ */
+static int
+create_newfile(const char *path, int target, struct stat *sbp)
+{
+ char backup[MAXPATHLEN];
+ int saved_errno = 0;
+ int newfd;
+
+ if (target) {
+ /*
+ * Unlink now... avoid ETXTBSY errors later. Try to turn
+ * off the append/immutable bits -- if we fail, go ahead,
+ * it might work.
+ */
+ if (sbp->st_flags & NOCHANGEBITS)
+ (void)chflags(path, sbp->st_flags & ~NOCHANGEBITS);
+
+ if (dobackup) {
+ if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s",
+ path, suffix) != strlen(path) + strlen(suffix))
+ errx(EX_OSERR, "%s: backup filename too long",
+ path);
+ (void)snprintf(backup, MAXPATHLEN, "%s%s",
+ path, suffix);
+ if (verbose)
+ (void)printf("install: %s -> %s\n",
+ path, backup);
+ if (rename(path, backup) < 0)
+ err(EX_OSERR, "rename: %s to %s", path, backup);
+ } else
+ if (unlink(path) < 0)
+ saved_errno = errno;
+ }
+
+ newfd = open(path, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR);
+ if (newfd < 0 && saved_errno != 0)
+ errno = saved_errno;
+ return newfd;
+}
+
+/*
+ * copy --
+ * copy from one file to another
+ */
+static char *
+copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
+ off_t size)
+{
+ int nr, nw;
+ int serrno;
+ char *p;
+ char buf[MAXBSIZE];
+ int done_copy;
+ DIGEST_CTX ctx;
+
+ /* Rewind file descriptors. */
+ if (lseek(from_fd, (off_t)0, SEEK_SET) == (off_t)-1)
+ err(EX_OSERR, "lseek: %s", from_name);
+ if (lseek(to_fd, (off_t)0, SEEK_SET) == (off_t)-1)
+ err(EX_OSERR, "lseek: %s", to_name);
+
+ digest_init(&ctx);
+
+ /*
+ * Mmap and write if less than 8M (the limit is so we don't totally
+ * trash memory on big files. This is really a minor hack, but it
+ * wins some CPU back.
+ */
+ done_copy = 0;
+ if (size <= 8 * 1048576 && trymmap(from_fd) &&
+ (p = mmap(NULL, (size_t)size, PROT_READ, MAP_SHARED,
+ from_fd, (off_t)0)) != MAP_FAILED) {
+ nw = write(to_fd, p, size);
+ if (nw != size) {
+ serrno = errno;
+ (void)unlink(to_name);
+ if (nw >= 0) {
+ errx(EX_OSERR,
+ "short write to %s: %jd bytes written, %jd bytes asked to write",
+ to_name, (uintmax_t)nw, (uintmax_t)size);
+ } else {
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
+ }
+ digest_update(&ctx, p, size);
+ (void)munmap(p, size);
+ done_copy = 1;
+ }
+ if (!done_copy) {
+ while ((nr = read(from_fd, buf, sizeof(buf))) > 0) {
+ if ((nw = write(to_fd, buf, nr)) != nr) {
+ serrno = errno;
+ (void)unlink(to_name);
+ if (nw >= 0) {
+ errx(EX_OSERR,
+ "short write to %s: %jd bytes written, %jd bytes asked to write",
+ to_name, (uintmax_t)nw,
+ (uintmax_t)size);
+ } else {
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
+ }
+ digest_update(&ctx, buf, nr);
+ }
+ if (nr != 0) {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR, "%s", from_name);
+ }
+ }
+ return (digest_end(&ctx, NULL));
+}
+
+/*
+ * strip --
+ * use strip(1) to strip the target file
+ */
+static void
+strip(const char *to_name)
+{
+ const char *stripbin;
+ const char *args[3];
+ pid_t pid;
+ int error, status;
+
+ stripbin = getenv("STRIPBIN");
+ if (stripbin == NULL)
+ stripbin = "strip";
+ args[0] = stripbin;
+ args[1] = to_name;
+ args[2] = NULL;
+ error = posix_spawnp(&pid, stripbin, NULL, NULL,
+ __DECONST(char **, args), environ);
+ if (error != 0) {
+ (void)unlink(to_name);
+ errc(error == EAGAIN || error == EPROCLIM || error == ENOMEM ?
+ EX_TEMPFAIL : EX_OSERR, error, "spawn %s", stripbin);
+ }
+ if (waitpid(pid, &status, 0) == -1) {
+ error = errno;
+ (void)unlink(to_name);
+ errc(EX_SOFTWARE, error, "wait");
+ /* NOTREACHED */
+ }
+ if (status != 0) {
+ (void)unlink(to_name);
+ errx(EX_SOFTWARE, "strip command %s failed on %s",
+ stripbin, to_name);
+ }
+}
+
+/*
+ * install_dir --
+ * build directory hierarchy
+ */
+static void
+install_dir(char *path)
+{
+ char *p;
+ struct stat sb;
+ int ch;
+
+ for (p = path;; ++p)
+ if (!*p || (p != path && *p == '/')) {
+ ch = *p;
+ *p = '\0';
+again:
+ if (stat(path, &sb) < 0) {
+ if (errno != ENOENT)
+ err(EX_OSERR, "stat %s", path);
+ if (mkdir(path, 0755) < 0) {
+ if (errno == EEXIST)
+ goto again;
+ err(EX_OSERR, "mkdir %s", path);
+ }
+ if (verbose)
+ (void)printf("install: mkdir %s\n",
+ path);
+ } else if (!S_ISDIR(sb.st_mode))
+ errx(EX_OSERR, "%s exists but is not a directory", path);
+ if (!(*p = ch))
+ break;
+ }
+
+ if (!dounpriv) {
+ if ((gid != (gid_t)-1 || uid != (uid_t)-1) &&
+ chown(path, uid, gid))
+ warn("chown %u:%u %s", uid, gid, path);
+ /* XXXBED: should we do the chmod in the dounpriv case? */
+ if (chmod(path, mode))
+ warn("chmod %o %s", mode, path);
+ }
+ metadata_log(path, "dir", NULL, NULL, NULL, 0);
+}
+
+/*
+ * metadata_log --
+ * if metafp is not NULL, output mtree(8) full path name and settings to
+ * metafp, to allow permissions to be set correctly by other tools,
+ * or to allow integrity checks to be performed.
+ */
+static void
+metadata_log(const char *path, const char *type, struct timespec *ts,
+ const char *slink, const char *digestresult, off_t size)
+{
+ static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' };
+ const char *p;
+ char *buf;
+ size_t destlen;
+ struct flock metalog_lock;
+
+ if (!metafp)
+ return;
+ /* Buffer for strsvis(3). */
+ buf = (char *)malloc(4 * strlen(path) + 1);
+ if (buf == NULL) {
+ warnx("%s", strerror(ENOMEM));
+ return;
+ }
+
+ /* Lock log file. */
+ metalog_lock.l_start = 0;
+ metalog_lock.l_len = 0;
+ metalog_lock.l_whence = SEEK_SET;
+ metalog_lock.l_type = F_WRLCK;
+ if (fcntl(fileno(metafp), F_SETLKW, &metalog_lock) == -1) {
+ warn("can't lock %s", metafile);
+ free(buf);
+ return;
+ }
+
+ /* Remove destdir. */
+ p = path;
+ if (destdir) {
+ destlen = strlen(destdir);
+ if (strncmp(p, destdir, destlen) == 0 &&
+ (p[destlen] == '/' || p[destlen] == '\0'))
+ p += destlen;
+ }
+ while (*p && *p == '/')
+ p++;
+ strsvis(buf, p, VIS_OCTAL, extra);
+ p = buf;
+ /* Print details. */
+ fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type);
+ if (owner)
+ fprintf(metafp, " uname=%s", owner);
+ if (group)
+ fprintf(metafp, " gname=%s", group);
+ fprintf(metafp, " mode=%#o", mode);
+ if (slink) {
+ strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */
+ fprintf(metafp, " link=%s", buf);
+ }
+ if (*type == 'f') /* type=file */
+ fprintf(metafp, " size=%lld", (long long)size);
+ if (ts != NULL && dopreserve)
+ fprintf(metafp, " time=%lld.%09ld",
+ (long long)ts[1].tv_sec, ts[1].tv_nsec);
+ if (digestresult && digest)
+ fprintf(metafp, " %s=%s", digest, digestresult);
+ if (fflags)
+ fprintf(metafp, " flags=%s", fflags);
+ if (tags)
+ fprintf(metafp, " tags=%s", tags);
+ fputc('\n', metafp);
+ /* Flush line. */
+ fflush(metafp);
+
+ /* Unlock log file. */
+ metalog_lock.l_type = F_UNLCK;
+ if (fcntl(fileno(metafp), F_SETLKW, &metalog_lock) == -1)
+ warn("can't unlock %s", metafile);
+ free(buf);
+}
+
+/*
+ * usage --
+ * print a usage message and die
+ */
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+"usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
+" [-M log] [-D dest] [-h hash] [-T tags]\n"
+" [-B suffix] [-l linkflags] [-N dbdir]\n"
+" file1 file2\n"
+" install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
+" [-M log] [-D dest] [-h hash] [-T tags]\n"
+" [-B suffix] [-l linkflags] [-N dbdir]\n"
+" file1 ... fileN directory\n"
+" install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]\n"
+" [-M log] [-D dest] [-h hash] [-T tags]\n"
+" directory ...\n");
+ exit(EX_USAGE);
+ /* NOTREACHED */
+}
+
+/*
+ * trymmap --
+ * return true (1) if mmap should be tried, false (0) if not.
+ */
+static int
+trymmap(int fd)
+{
+/*
+ * The ifdef is for bootstrapping - f_fstypename doesn't exist in
+ * pre-Lite2-merge systems.
+ */
+#ifdef MFSNAMELEN
+ struct statfs stfs;
+
+ if (fstatfs(fd, &stfs) != 0)
+ return (0);
+ if (strcmp(stfs.f_fstypename, "ufs") == 0 ||
+ strcmp(stfs.f_fstypename, "cd9660") == 0)
+ return (1);
+#endif
+ return (0);
+}
diff --git a/usr.bin/xlint/Makefile b/usr.bin/xlint/Makefile
new file mode 100644
index 0000000..68264f4
--- /dev/null
+++ b/usr.bin/xlint/Makefile
@@ -0,0 +1,12 @@
+# $NetBSD: Makefile,v 1.2 1995/07/03 21:23:45 cgd Exp $
+# $FreeBSD$
+
+.if ${LINT} == "lint"
+_llib= llib
+.else
+_llib=
+.endif
+
+SUBDIR= lint1 lint2 xlint ${_llib}
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/xlint/Makefile.inc b/usr.bin/xlint/Makefile.inc
new file mode 100644
index 0000000..2bd511c
--- /dev/null
+++ b/usr.bin/xlint/Makefile.inc
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile.inc,v 1.8 2002/02/04 00:18:32 thorpej Exp $
+# $FreeBSD$
+
+WARNS?= 0
+
+.PATH: ${.CURDIR}/../common
+
+.if exists(${.CURDIR}/../arch/${MACHINE_ARCH})
+CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_ARCH}
+.else
+CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_CPUARCH}
+.endif
+CFLAGS+= -I${.CURDIR}/../common
+
+OBJECT_FMT= ELF
diff --git a/usr.bin/xlint/arch/aarch64/targparam.h b/usr.bin/xlint/arch/aarch64/targparam.h
new file mode 100644
index 0000000..fa03450
--- /dev/null
+++ b/usr.bin/xlint/arch/aarch64/targparam.h
@@ -0,0 +1,50 @@
+/* $NetBSD: targparam.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * 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/arch/amd64/targparam.h b/usr.bin/xlint/arch/amd64/targparam.h
new file mode 100644
index 0000000..8d57fbd
--- /dev/null
+++ b/usr.bin/xlint/arch/amd64/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 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/arch/arm/targparam.h b/usr.bin/xlint/arch/arm/targparam.h
new file mode 100644
index 0000000..d1d6f94
--- /dev/null
+++ b/usr.bin/xlint/arch/arm/targparam.h
@@ -0,0 +1,63 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 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 "ilp32.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!
+ */
+
+#if defined(TARGET_OBJFMT_ELF)
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#else
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#endif
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#if defined(TARGET_OBJFMT_ELF)
+/* XXX ARM ELF ABI says packed enums -- variable size! */
+#define ENUM_SIZE (4 * CHAR_BIT)
+#else
+#define ENUM_SIZE (4 * CHAR_BIT)
+#endif
diff --git a/usr.bin/xlint/arch/i386/targparam.h b/usr.bin/xlint/arch/i386/targparam.h
new file mode 100644
index 0000000..86dfb19
--- /dev/null
+++ b/usr.bin/xlint/arch/i386/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (12 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/m68000/targparam.h b/usr.bin/xlint/arch/m68000/targparam.h
new file mode 100644
index 0000000..f79777d
--- /dev/null
+++ b/usr.bin/xlint/arch/m68000/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD$ */
+
+/*
+ * 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/m68k/targparam.h b/usr.bin/xlint/arch/m68k/targparam.h
new file mode 100644
index 0000000..86dfb19
--- /dev/null
+++ b/usr.bin/xlint/arch/m68k/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (12 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/mips/targparam.h b/usr.bin/xlint/arch/mips/targparam.h
new file mode 100644
index 0000000..7b6e056
--- /dev/null
+++ b/usr.bin/xlint/arch/mips/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/ns32k/targparam.h b/usr.bin/xlint/arch/ns32k/targparam.h
new file mode 100644
index 0000000..f6b3308
--- /dev/null
+++ b/usr.bin/xlint/arch/ns32k/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (12 * CHAR_BIT) /* XXX double-check */
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/powerpc/targparam.h b/usr.bin/xlint/arch/powerpc/targparam.h
new file mode 100644
index 0000000..554f9b3
--- /dev/null
+++ b/usr.bin/xlint/arch/powerpc/targparam.h
@@ -0,0 +1,55 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Machine-dependent target parameters for lint1.
+ */
+
+#include "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/powerpc64/targparam.h b/usr.bin/xlint/arch/powerpc64/targparam.h
new file mode 100644
index 0000000..09bfd3e
--- /dev/null
+++ b/usr.bin/xlint/arch/powerpc64/targparam.h
@@ -0,0 +1,55 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * 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 (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/riscv/targparam.h b/usr.bin/xlint/arch/riscv/targparam.h
new file mode 100644
index 0000000..8d57fbd
--- /dev/null
+++ b/usr.bin/xlint/arch/riscv/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 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/arch/sh3/targparam.h b/usr.bin/xlint/arch/sh3/targparam.h
new file mode 100644
index 0000000..d49eb76
--- /dev/null
+++ b/usr.bin/xlint/arch/sh3/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/sparc/targparam.h b/usr.bin/xlint/arch/sparc/targparam.h
new file mode 100644
index 0000000..c0eabbd
--- /dev/null
+++ b/usr.bin/xlint/arch/sparc/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:21 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 "ilp32.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 (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/sparc64/targparam.h b/usr.bin/xlint/arch/sparc64/targparam.h
new file mode 100644
index 0000000..df151f2
--- /dev/null
+++ b/usr.bin/xlint/arch/sparc64/targparam.h
@@ -0,0 +1,55 @@
+/* $NetBSD: targparam.h,v 1.3 2002/01/31 23:31:34 he 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * 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/arch/vax/targparam.h b/usr.bin/xlint/arch/vax/targparam.h
new file mode 100644
index 0000000..261369d
--- /dev/null
+++ b/usr.bin/xlint/arch/vax/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:22 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 "ilp32.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 0
+#define SIZEOF_IS_ULONG 0
+
+#define FLOAT_SIZE (4 * CHAR_BIT)
+#define DOUBLE_SIZE (8 * CHAR_BIT)
+#define LDOUBLE_SIZE (8 * CHAR_BIT)
+
+#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/arch/x86_64/targparam.h b/usr.bin/xlint/arch/x86_64/targparam.h
new file mode 100644
index 0000000..6cfedcb
--- /dev/null
+++ b/usr.bin/xlint/arch/x86_64/targparam.h
@@ -0,0 +1,53 @@
+/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:22 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/common/emit.c b/usr.bin/xlint/common/emit.c
new file mode 100644
index 0000000..9413433
--- /dev/null
+++ b/usr.bin/xlint/common/emit.c
@@ -0,0 +1,234 @@
+/* $NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "lint.h"
+
+/* name and handle of output file */
+static const char *loname;
+static FILE *lout;
+
+/* output buffer data */
+ob_t ob;
+
+static void outxbuf(void);
+
+
+/*
+ * initialize output
+ */
+void
+outopen(const char *name)
+{
+
+ loname = name;
+
+ /* Open output file */
+ if ((lout = fopen(name, "w")) == NULL)
+ err(1, "cannot open '%s'", name);
+
+ /* Create output buffer */
+ ob.o_len = 1024;
+ ob.o_end = (ob.o_buf = ob.o_nxt = xmalloc(ob.o_len)) + ob.o_len;
+}
+
+/*
+ * flush output buffer and close file
+ */
+void
+outclose(void)
+{
+
+ outclr();
+ if (fclose(lout) == EOF)
+ err(1, "cannot close '%s'", loname);
+}
+
+/*
+ * resize output buffer
+ */
+static void
+outxbuf(void)
+{
+ ptrdiff_t coffs;
+
+ coffs = ob.o_nxt - ob.o_buf;
+ ob.o_len *= 2;
+ ob.o_end = (ob.o_buf = xrealloc(ob.o_buf, ob.o_len)) + ob.o_len;
+ ob.o_nxt = ob.o_buf + coffs;
+}
+
+/*
+ * reset output buffer
+ * if it is not empty, it is flushed
+ */
+void
+outclr(void)
+{
+ size_t sz;
+
+ if (ob.o_buf != ob.o_nxt) {
+ outchar('\n');
+ sz = ob.o_nxt - ob.o_buf;
+ if (sz > ob.o_len)
+ errx(1, "internal error: outclr() 1");
+ if (fwrite(ob.o_buf, sz, 1, lout) != 1)
+ err(1, "cannot write to %s", loname);
+ ob.o_nxt = ob.o_buf;
+ }
+}
+
+/*
+ * write a character to the output buffer
+ */
+void
+outchar(int c)
+{
+
+ if (ob.o_nxt == ob.o_end)
+ outxbuf();
+ *ob.o_nxt++ = (char)c;
+}
+
+/*
+ * write a character to the output buffer, qouted if necessary
+ */
+void
+outqchar(int c)
+{
+
+ if (isprint(c) && c != '\\' && c != '"' && c != '\'') {
+ outchar(c);
+ } else {
+ outchar('\\');
+ switch (c) {
+ case '\\':
+ outchar('\\');
+ break;
+ case '"':
+ outchar('"');
+ break;
+ case '\'':
+ outchar('\'');
+ break;
+ case '\b':
+ outchar('b');
+ break;
+ case '\t':
+ outchar('t');
+ break;
+ case '\n':
+ outchar('n');
+ break;
+ case '\f':
+ outchar('f');
+ break;
+ case '\r':
+ outchar('r');
+ break;
+ case '\v':
+ outchar('v');
+ break;
+ case '\a':
+ outchar('a');
+ break;
+ default:
+ outchar((((u_int)c >> 6) & 07) + '0');
+ outchar((((u_int)c >> 3) & 07) + '0');
+ outchar((c & 07) + '0');
+ break;
+ }
+ }
+}
+
+/*
+ * write a strint to the output buffer
+ * the string must not contain any characters which
+ * should be quoted
+ */
+void
+outstrg(const char *s)
+{
+
+ while (*s != '\0') {
+ if (ob.o_nxt == ob.o_end)
+ outxbuf();
+ *ob.o_nxt++ = *s++;
+ }
+}
+
+/*
+ * write an integer value to toe output buffer
+ */
+void
+outint(int i)
+{
+
+ if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int))
+ outxbuf();
+ ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
+}
+
+/*
+ * write the name of a symbol to the output buffer
+ * the name is preceded by its length
+ */
+void
+outname(const char *name)
+{
+
+ if (name == NULL)
+ errx(1, "internal error: outname() 1");
+ outint((int)strlen(name));
+ outstrg(name);
+}
+
+/*
+ * write the name of the .c source
+ */
+void
+outsrc(const char *name)
+{
+
+ outclr();
+ outchar('S');
+ outstrg(name);
+}
diff --git a/usr.bin/xlint/common/externs.h b/usr.bin/xlint/common/externs.h
new file mode 100644
index 0000000..8c454b4
--- /dev/null
+++ b/usr.bin/xlint/common/externs.h
@@ -0,0 +1,66 @@
+/* $NetBSD: externs.h,v 1.1 2002/01/18 20:39:23 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.
+ */
+
+/*
+ * main[12].c
+ */
+extern int pflag;
+
+/*
+ * inittyp.c
+ */
+extern void inittyp(void);
+
+/*
+ * mem.c
+ */
+extern void *xmalloc(size_t);
+extern void *xcalloc(size_t, size_t);
+extern void *xrealloc(void *, size_t);
+extern char *xstrdup(const char *);
+extern void nomem(void);
+
+/*
+ * emit.c
+ */
+extern ob_t ob;
+
+extern void outopen(const char *);
+extern void outclose(void);
+extern void outclr(void);
+extern void outchar(int);
+extern void outqchar(int);
+extern void outstrg(const char *);
+extern void outint(int);
+extern void outname(const char *);
+extern void outsrc(const char *);
diff --git a/usr.bin/xlint/common/ilp32.h b/usr.bin/xlint/common/ilp32.h
new file mode 100644
index 0000000..5eb5f03
--- /dev/null
+++ b/usr.bin/xlint/common/ilp32.h
@@ -0,0 +1,59 @@
+/* $NetBSD: ilp32.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * Type sizes for IPL32 platforms (int, long, pointer: 32-bit)
+ */
+
+#define CHAR_SIZE (CHAR_BIT)
+#define SHORT_SIZE (2 * CHAR_BIT)
+#define INT_SIZE (4 * CHAR_BIT)
+#define LONG_SIZE (4 * CHAR_BIT)
+#define QUAD_SIZE (8 * CHAR_BIT)
+#define PTR_SIZE (4 * CHAR_BIT)
+
+#define TARG_INT_MAX ((int32_t) (((uint32_t) -1) >> 1))
+#define TARG_INT_MIN ((-TARG_INT_MAX) - 1)
+#define TARG_UINT_MAX ((uint32_t) -1)
+
+#define TARG_LONG_MAX TARG_INT_MAX
+#define TARG_LONG_MIN TARG_INT_MIN
+#define TARG_ULONG_MAX TARG_UINT_MAX
+
+#define TARG_QUAD_MAX ((int64_t) (((uint64_t) -1) >> 1))
+#define TARG_QUAD_MIN ((-TARG_QUAD_MAX) - 1)
+#define TARG_UQUAD_MAX ((uint64_t) -1)
diff --git a/usr.bin/xlint/common/inittyp.c b/usr.bin/xlint/common/inittyp.c
new file mode 100644
index 0000000..b0958bf
--- /dev/null
+++ b/usr.bin/xlint/common/inittyp.c
@@ -0,0 +1,133 @@
+/* $NetBSD: inittyp.c,v 1.3 2002/01/30 06:55:02 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: inittyp.c,v 1.3 2002/01/30 06:55:02 thorpej Exp $");
+#endif
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "lint.h"
+
+/* various type information */
+ttab_t ttab[NTSPEC];
+
+void
+inittyp(void)
+{
+ int i;
+ static const struct {
+ tspec_t it_tspec;
+ ttab_t it_ttab;
+ } ittab[NTSPEC] = {
+ { SIGNED, { 0, 0,
+ SIGNED, UNSIGN,
+ 0, 0, 0, 0, 0, "signed" } },
+ { UNSIGN, { 0, 0,
+ SIGNED, UNSIGN,
+ 0, 0, 0, 0, 0, "unsigned" } },
+ { CHAR, { CHAR_SIZE, CHAR_BIT,
+ SCHAR, UCHAR,
+ 1, 0, 0, 1, 1, "char" } },
+ { SCHAR, { CHAR_SIZE, CHAR_BIT,
+ SCHAR, UCHAR,
+ 1, 0, 0, 1, 1, "signed char" } },
+ { UCHAR, { CHAR_SIZE, CHAR_BIT,
+ SCHAR, UCHAR,
+ 1, 1, 0, 1, 1, "unsigned char" } },
+ { SHORT, { SHORT_SIZE, 2 * CHAR_BIT,
+ SHORT, USHORT,
+ 1, 0, 0, 1, 1, "short" } },
+ { USHORT, { SHORT_SIZE, 2 * CHAR_BIT,
+ SHORT, USHORT,
+ 1, 1, 0, 1, 1, "unsigned short" } },
+ { INT, { INT_SIZE, 3 * CHAR_BIT,
+ INT, UINT,
+ 1, 0, 0, 1, 1, "int" } },
+ { UINT, { INT_SIZE, 3 * CHAR_BIT,
+ INT, UINT,
+ 1, 1, 0, 1, 1, "unsigned int" } },
+ { LONG, { LONG_SIZE, 4 * CHAR_BIT,
+ LONG, ULONG,
+ 1, 0, 0, 1, 1, "long" } },
+ { ULONG, { LONG_SIZE, 4 * CHAR_BIT,
+ LONG, ULONG,
+ 1, 1, 0, 1, 1, "unsigned long" } },
+ { QUAD, { QUAD_SIZE, 8 * CHAR_BIT,
+ QUAD, UQUAD,
+ 1, 0, 0, 1, 1, "long long" } },
+ { UQUAD, { QUAD_SIZE, 8 * CHAR_BIT,
+ QUAD, UQUAD,
+ 1, 1, 0, 1, 1, "unsigned long long" } },
+ { FLOAT, { FLOAT_SIZE, 4 * CHAR_BIT,
+ FLOAT, FLOAT,
+ 0, 0, 1, 1, 1, "float" } },
+ { DOUBLE, { DOUBLE_SIZE, 8 * CHAR_BIT,
+ DOUBLE, DOUBLE,
+ 0, 0, 1, 1, 1, "double" } },
+ { LDOUBLE, { LDOUBLE_SIZE, 10 * CHAR_BIT,
+ LDOUBLE, LDOUBLE,
+ 0, 0, 1, 1, 1, "long double" } },
+ { VOID, { -1, -1,
+ VOID, VOID,
+ 0, 0, 0, 0, 0, "void" } },
+ { STRUCT, { -1, -1,
+ STRUCT, STRUCT,
+ 0, 0, 0, 0, 0, "struct" } },
+ { UNION, { -1, -1,
+ UNION, UNION,
+ 0, 0, 0, 0, 0, "union" } },
+ { ENUM, { ENUM_SIZE, 3 * CHAR_BIT,
+ ENUM, ENUM,
+ 1, 0, 0, 1, 1, "enum" } },
+ { PTR, { PTR_SIZE, 4 * CHAR_BIT,
+ PTR, PTR,
+ 0, 1, 0, 0, 1, "pointer" } },
+ { ARRAY, { -1, -1,
+ ARRAY, ARRAY,
+ 0, 0, 0, 0, 0, "array" } },
+ { FUNC, { -1, -1,
+ FUNC, FUNC,
+ 0, 0, 0, 0, 0, "function" } },
+ };
+
+ for (i = 0; i < sizeof (ittab) / sizeof (ittab[0]); i++)
+ STRUCT_ASSIGN(ttab[ittab[i].it_tspec], ittab[i].it_ttab);
+ if (!pflag) {
+ for (i = 0; i < NTSPEC; i++)
+ ttab[i].tt_psz = ttab[i].tt_sz;
+ }
+}
diff --git a/usr.bin/xlint/common/lint.h b/usr.bin/xlint/common/lint.h
new file mode 100644
index 0000000..231d2d6
--- /dev/null
+++ b/usr.bin/xlint/common/lint.h
@@ -0,0 +1,128 @@
+/* $NetBSD: lint.h,v 1.7 2003/10/27 00:12:44 lukem 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.
+ *
+ * $FreeBSD$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#else
+#define HAVE_DECL_SYS_SIGNAME 1
+#endif
+
+#include <sys/types.h>
+#include <stddef.h>
+#include <err.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#include "param.h"
+
+/*
+ * Type specifiers, used in type structures (type_t) and otherwere.
+ */
+typedef enum {
+ NOTSPEC = 0,
+ SIGNED, /* keyword "signed", only used in the parser */
+ UNSIGN, /* keyword "unsigned", only used in the parser */
+ CHAR, /* char */
+ SCHAR, /* signed char */
+ UCHAR, /* unsigned char */
+ SHORT, /* (signed) short */
+ USHORT, /* unsigned short */
+ INT, /* (signed) int */
+ UINT, /* unsigned int */
+ LONG, /* (signed) long */
+ ULONG, /* unsigned long */
+ QUAD, /* (signed) long long */
+ UQUAD, /* unsigned long long */
+ FLOAT, /* float */
+ DOUBLE, /* double or, with tflag, long float */
+ LDOUBLE, /* long double */
+ VOID, /* void */
+ STRUCT, /* structure tag */
+ UNION, /* union tag */
+ ENUM, /* enum tag */
+ PTR, /* pointer */
+ ARRAY, /* array */
+ FUNC, /* function */
+ NTSPEC
+} tspec_t;
+
+/*
+ * size of types, name and classification
+ */
+typedef struct {
+ int tt_sz; /* size in bits */
+ int tt_psz; /* size, different from tt_sz
+ if pflag is set */
+ tspec_t tt_styp; /* signed counterpart */
+ tspec_t tt_utyp; /* unsigned counterpart */
+ u_int tt_isityp : 1; /* 1 if integer type */
+ u_int tt_isutyp : 1; /* 1 if unsigned integer type */
+ u_int tt_isftyp : 1; /* 1 if floating point type */
+ u_int tt_isatyp : 1; /* 1 if arithmetic type */
+ u_int tt_issclt : 1; /* 1 if scalar type */
+ const char *tt_name; /* Bezeichnung des Typs */
+} ttab_t;
+
+#define size(t) (ttab[t].tt_sz)
+#define psize(t) (ttab[t].tt_psz)
+#define styp(t) (ttab[t].tt_styp)
+#define utyp(t) (ttab[t].tt_utyp)
+#define isityp(t) (ttab[t].tt_isityp)
+#define isutyp(t) (ttab[t].tt_isutyp)
+#define isftyp(t) (ttab[t].tt_isftyp)
+#define isatyp(t) (ttab[t].tt_isatyp)
+#define issclt(t) (ttab[t].tt_issclt)
+
+extern ttab_t ttab[];
+
+
+typedef enum {
+ NODECL, /* until now not declared */
+ DECL, /* declared */
+ TDEF, /* tentative defined */
+ DEF /* defined */
+} def_t;
+
+/*
+ * Following structure contains some data used for the output buffer.
+ */
+typedef struct ob {
+ char *o_buf; /* buffer */
+ char *o_end; /* first byte after buffer */
+ size_t o_len; /* length of buffer */
+ char *o_nxt; /* next free byte in buffer */
+} ob_t;
+
+#include "externs.h"
diff --git a/usr.bin/xlint/common/lp64.h b/usr.bin/xlint/common/lp64.h
new file mode 100644
index 0000000..cd88700
--- /dev/null
+++ b/usr.bin/xlint/common/lp64.h
@@ -0,0 +1,59 @@
+/* $NetBSD: lp64.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * Type sizes for LP64 platforms (long, pointer: 64-bit)
+ */
+
+#define CHAR_SIZE (CHAR_BIT)
+#define SHORT_SIZE (2 * CHAR_BIT)
+#define INT_SIZE (4 * CHAR_BIT)
+#define LONG_SIZE (8 * CHAR_BIT)
+#define QUAD_SIZE (8 * CHAR_BIT)
+#define PTR_SIZE (8 * CHAR_BIT)
+
+#define TARG_INT_MAX ((int32_t) (((uint32_t) -1) >> 1))
+#define TARG_INT_MIN ((-TARG_INT_MAX) - 1)
+#define TARG_UINT_MAX ((uint32_t) -1)
+
+#define TARG_QUAD_MAX ((int64_t) (((uint64_t) -1) >> 1))
+#define TARG_QUAD_MIN ((-TARG_QUAD_MAX) - 1)
+#define TARG_UQUAD_MAX ((uint64_t) -1)
+
+#define TARG_LONG_MAX TARG_QUAD_MAX
+#define TARG_LONG_MIN TARG_QUAD_MIN
+#define TARG_ULONG_MAX TARG_UQUAD_MAX
diff --git a/usr.bin/xlint/common/mem.c b/usr.bin/xlint/common/mem.c
new file mode 100644
index 0000000..8802da1
--- /dev/null
+++ b/usr.bin/xlint/common/mem.c
@@ -0,0 +1,93 @@
+/* $NetBSD: mem.c,v 1.4 2003/10/16 06:35:26 itojun 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: mem.c,v 1.4 2003/10/16 06:35:26 itojun Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint.h"
+
+void *
+xmalloc(size_t s)
+{
+ void *p;
+
+ if ((p = malloc(s)) == NULL)
+ nomem();
+ return (p);
+}
+
+void *
+xcalloc(size_t n, size_t s)
+{
+ void *p;
+
+ if ((p = calloc(n, s)) == NULL)
+ nomem();
+ return (p);
+}
+
+void *
+xrealloc(void *p, size_t s)
+{
+ void *n;
+
+ if ((n = realloc(p, s)) == NULL) {
+ free(p);
+ nomem();
+ }
+ p = n;
+ return (p);
+}
+
+char *
+xstrdup(const char *s)
+{
+ char *s2;
+
+ if ((s2 = strdup(s)) == NULL)
+ nomem();
+ return (s2);
+}
+
+void
+nomem(void)
+{
+
+ errx(1, "virtual memory exhausted");
+}
diff --git a/usr.bin/xlint/common/param.h b/usr.bin/xlint/common/param.h
new file mode 100644
index 0000000..5a28ce4
--- /dev/null
+++ b/usr.bin/xlint/common/param.h
@@ -0,0 +1,81 @@
+/* $NetBSD: param.h,v 1.2 2002/02/05 03:04:26 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.
+ */
+
+/*
+ * Minimun size of string buffer. If this is not enough, the buffer
+ * is enlarged in steps of STRBLEN bytes.
+ */
+#define STRBLEN 256
+
+/*
+ * This defines the size of memory blocks which are used to allocate
+ * memory in larger chunks.
+ */
+#define MBLKSIZ ((size_t)0x4000)
+
+/*
+ * Sizes of hash tables
+ * Should be a prime. Possible primes are
+ * 307, 401, 503, 601, 701, 809, 907, 1009, 1103, 1201, 1301, 1409, 1511.
+ *
+ * HSHSIZ1 symbol table 1st pass
+ * HSHSIZ2 symbol table 2nd pass
+ * THSHSIZ2 type table 2nd pass
+ */
+#define HSHSIZ1 503
+#define HSHSIZ2 1009
+#define THSHSIZ2 1009
+
+/*
+ * Pull in target-specific parameters.
+ */
+#include "targparam.h"
+
+/*
+ * Make sure this matches wchar_t.
+ */
+#define WCHAR INT
+
+/*
+ * And the sparc64 long double code generation is broken.
+ */
+#if !defined(__sparc64__)
+typedef long double ldbl_t;
+#else
+typedef double ldbl_t;
+#endif
+
+/*
+ * Some traditional compilers are not able to assign structures.
+ */
+#define STRUCT_ASSIGN(dest, src) (dest) = (src)
diff --git a/usr.bin/xlint/lint1/Makefile b/usr.bin/xlint/lint1/Makefile
new file mode 100644
index 0000000..6792ba0
--- /dev/null
+++ b/usr.bin/xlint/lint1/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.3 1995/07/04 01:53:05 cgd Exp $
+# $FreeBSD$
+
+PROG= lint1
+SRCS= cgram.y scan.l mem1.c mem.c err.c main1.c decl.c tree.c func.c \
+ init.c emit.c emit1.c inittyp.c
+MAN= lint.7
+CLEANFILES= lint.7
+
+LIBADD= l m
+CFLAGS+= -I. -I${.CURDIR}
+LINTFLAGS=-aehpz
+
+BINDIR= ${LIBEXECDIR}
+
+.PATH: ${.CURDIR}/../common
+
+lint.7: makeman
+ sh ${.CURDIR}/makeman ${DESTDIR}${BINDIR}/${PROG} -m >${.TARGET}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xlint/lint1/Makefile.depend b/usr.bin/xlint/lint1/Makefile.depend
new file mode 100644
index 0000000..dab7995
--- /dev/null
+++ b/usr.bin/xlint/lint1/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/msun \
+ usr.bin/lex/lib \
+ usr.bin/yacc.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y
new file mode 100644
index 0000000..71d38f4
--- /dev/null
+++ b/usr.bin/xlint/lint1/cgram.y
@@ -0,0 +1,1893 @@
+%{
+/* $NetBSD: cgram.y,v 1.40 2008/04/25 17:18:24 christos Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: cgram.y,v 1.40 2008/04/25 17:18:24 christos Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "lint1.h"
+
+/*
+ * Contains the level of current declaration. 0 is extern.
+ * Used for symbol table entries.
+ */
+int blklev;
+
+/*
+ * level for memory allocation. Normaly the same as blklev.
+ * An exeption is the declaration of arguments in prototypes. Memory
+ * for these can't be freed after the declaration, but symbols must
+ * be removed from the symbol table after the declaration.
+ */
+int mblklev;
+
+/*
+ * Save the no-warns state and restore it to avoid the problem where
+ * if (expr) { stmt } / * NOLINT * / stmt;
+ */
+static int onowarn = -1;
+
+static int toicon(tnode_t *, int);
+static void idecl(sym_t *, int, sbuf_t *);
+static void ignuptorp(void);
+
+#ifdef DEBUG
+static inline void CLRWFLGS(void);
+static inline void CLRWFLGS(void)
+{
+ printf("%s, %d: clear flags %s %d\n", curr_pos.p_file,
+ curr_pos.p_line, __FILE__, __LINE__);
+ clrwflgs();
+ onowarn = -1;
+}
+
+static inline void SAVE(void);
+static inline void SAVE(void)
+{
+ if (onowarn != -1)
+ abort();
+ printf("%s, %d: save flags %s %d = %d\n", curr_pos.p_file,
+ curr_pos.p_line, __FILE__, __LINE__, nowarn);
+ onowarn = nowarn;
+}
+
+static inline void RESTORE(void);
+static inline void RESTORE(void)
+{
+ if (onowarn != -1) {
+ nowarn = onowarn;
+ printf("%s, %d: restore flags %s %d = %d\n", curr_pos.p_file,
+ curr_pos.p_line, __FILE__, __LINE__, nowarn);
+ onowarn = -1;
+ } else
+ CLRWFLGS();
+}
+#else
+#define CLRWFLGS() clrwflgs(), onowarn = -1
+#define SAVE() onowarn = nowarn
+#define RESTORE() (void)(onowarn == -1 ? (clrwflgs(), 0) : (nowarn = onowarn))
+#endif
+%}
+
+%expect 1
+
+%union {
+ int y_int;
+ val_t *y_val;
+ sbuf_t *y_sb;
+ sym_t *y_sym;
+ op_t y_op;
+ scl_t y_scl;
+ tspec_t y_tspec;
+ tqual_t y_tqual;
+ type_t *y_type;
+ tnode_t *y_tnode;
+ range_t y_range;
+ strg_t *y_strg;
+ pqinf_t *y_pqinf;
+};
+
+%token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPARN T_RPARN
+%token <y_op> T_STROP
+%token <y_op> T_UNOP
+%token <y_op> T_INCDEC
+%token T_SIZEOF
+%token <y_op> T_MULT
+%token <y_op> T_DIVOP
+%token <y_op> T_ADDOP
+%token <y_op> T_SHFTOP
+%token <y_op> T_RELOP
+%token <y_op> T_EQOP
+%token <y_op> T_AND
+%token <y_op> T_XOR
+%token <y_op> T_OR
+%token <y_op> T_LOGAND
+%token <y_op> T_LOGOR
+%token T_QUEST
+%token T_COLON
+%token <y_op> T_ASSIGN
+%token <y_op> T_OPASS
+%token T_COMMA
+%token T_SEMI
+%token T_ELLIPSE
+
+/* storage classes (extern, static, auto, register and typedef) */
+%token <y_scl> T_SCLASS
+
+/* types (char, int, short, long, unsigned, signed, float, double, void) */
+%token <y_tspec> T_TYPE
+
+/* qualifiers (const, volatile) */
+%token <y_tqual> T_QUAL
+
+/* struct or union */
+%token <y_tspec> T_SOU
+
+/* enum */
+%token T_ENUM
+
+/* remaining keywords */
+%token T_CASE
+%token T_DEFAULT
+%token T_IF
+%token T_ELSE
+%token T_SWITCH
+%token T_DO
+%token T_WHILE
+%token T_FOR
+%token T_GOTO
+%token T_CONTINUE
+%token T_BREAK
+%token T_RETURN
+%token T_ASM
+%token T_SYMBOLRENAME
+
+%left T_COMMA
+%right T_ASSIGN T_OPASS
+%right T_QUEST T_COLON
+%left T_LOGOR
+%left T_LOGAND
+%left T_OR
+%left T_XOR
+%left T_AND
+%left T_EQOP
+%left T_RELOP
+%left T_SHFTOP
+%left T_ADDOP
+%left T_MULT T_DIVOP
+%right T_UNOP T_INCDEC T_SIZEOF
+%left T_LPARN T_LBRACK T_STROP
+
+%token <y_sb> T_NAME
+%token <y_sb> T_TYPENAME
+%token <y_val> T_CON
+%token <y_strg> T_STRING
+
+%type <y_sym> func_decl
+%type <y_sym> notype_decl
+%type <y_sym> type_decl
+%type <y_type> typespec
+%type <y_type> clrtyp_typespec
+%type <y_type> notype_typespec
+%type <y_type> struct_spec
+%type <y_type> enum_spec
+%type <y_sym> struct_tag
+%type <y_sym> enum_tag
+%type <y_tspec> struct
+%type <y_sym> struct_declaration
+%type <y_sb> identifier
+%type <y_sym> member_declaration_list_with_rbrace
+%type <y_sym> member_declaration_list
+%type <y_sym> member_declaration
+%type <y_sym> notype_member_decls
+%type <y_sym> type_member_decls
+%type <y_sym> notype_member_decl
+%type <y_sym> type_member_decl
+%type <y_tnode> constant
+%type <y_sym> enum_declaration
+%type <y_sym> enums_with_opt_comma
+%type <y_sym> enums
+%type <y_sym> enumerator
+%type <y_sym> ename
+%type <y_sym> notype_direct_decl
+%type <y_sym> type_direct_decl
+%type <y_pqinf> pointer
+%type <y_pqinf> asterisk
+%type <y_sym> param_decl
+%type <y_sym> param_list
+%type <y_sym> abs_decl_param_list
+%type <y_sym> direct_param_decl
+%type <y_sym> notype_param_decl
+%type <y_sym> direct_notype_param_decl
+%type <y_pqinf> type_qualifier_list
+%type <y_pqinf> type_qualifier
+%type <y_sym> identifier_list
+%type <y_sym> abs_decl
+%type <y_sym> direct_abs_decl
+%type <y_sym> vararg_parameter_type_list
+%type <y_sym> parameter_type_list
+%type <y_sym> parameter_declaration
+%type <y_tnode> expr
+%type <y_tnode> expr_stmnt_val
+%type <y_tnode> expr_stmnt_list
+%type <y_tnode> term
+%type <y_tnode> func_arg_list
+%type <y_op> point_or_arrow
+%type <y_type> type_name
+%type <y_sym> abstract_declaration
+%type <y_tnode> do_while_expr
+%type <y_tnode> opt_expr
+%type <y_strg> string
+%type <y_strg> string2
+%type <y_sb> opt_asm_or_symbolrename
+%type <y_range> range
+%type <y_range> lorange
+
+
+%%
+
+program:
+ /* empty */ {
+ if (sflag) {
+ /* empty translation unit */
+ error(272);
+ } else if (!tflag) {
+ /* empty translation unit */
+ warning(272);
+ }
+ }
+ | translation_unit
+ ;
+
+translation_unit:
+ ext_decl
+ | translation_unit ext_decl
+ ;
+
+ext_decl:
+ asm_stmnt
+ | func_def {
+ glclup(0);
+ CLRWFLGS();
+ }
+ | data_def {
+ glclup(0);
+ CLRWFLGS();
+ }
+ ;
+
+data_def:
+ T_SEMI {
+ if (sflag) {
+ /* syntax error: empty declaration */
+ error(0);
+ } else if (!tflag) {
+ /* syntax error: empty declaration */
+ warning(0);
+ }
+ }
+ | clrtyp deftyp notype_init_decls T_SEMI {
+ if (sflag) {
+ /* old style declaration; add "int" */
+ error(1);
+ } else if (!tflag) {
+ /* old style declaration; add "int" */
+ warning(1);
+ }
+ }
+ | declmods deftyp T_SEMI {
+ if (dcs->d_scl == TYPEDEF) {
+ /* typedef declares no type name */
+ warning(72);
+ } else {
+ /* empty declaration */
+ warning(2);
+ }
+ }
+ | declmods deftyp notype_init_decls T_SEMI
+ | declspecs deftyp T_SEMI {
+ if (dcs->d_scl == TYPEDEF) {
+ /* typedef declares no type name */
+ warning(72);
+ } else if (!dcs->d_nedecl) {
+ /* empty declaration */
+ warning(2);
+ }
+ }
+ | declspecs deftyp type_init_decls T_SEMI
+ | error T_SEMI {
+ globclup();
+ }
+ | error T_RBRACE {
+ globclup();
+ }
+ ;
+
+func_def:
+ func_decl {
+ if ($1->s_type->t_tspec != FUNC) {
+ /* syntax error */
+ error(249);
+ YYERROR;
+ }
+ if ($1->s_type->t_typedef) {
+ /* ()-less function definition */
+ error(64);
+ YYERROR;
+ }
+ funcdef($1);
+ blklev++;
+ pushdecl(ARG);
+ } opt_arg_declaration_list {
+ popdecl();
+ blklev--;
+ cluparg();
+ pushctrl(0);
+ } comp_stmnt {
+ funcend();
+ popctrl(0);
+ }
+ ;
+
+func_decl:
+ clrtyp deftyp notype_decl {
+ $$ = $3;
+ }
+ | declmods deftyp notype_decl {
+ $$ = $3;
+ }
+ | declspecs deftyp type_decl {
+ $$ = $3;
+ }
+ ;
+
+opt_arg_declaration_list:
+ /* empty */
+ | arg_declaration_list
+ ;
+
+arg_declaration_list:
+ arg_declaration
+ | arg_declaration_list arg_declaration
+ /* XXX or better "arg_declaration error" ? */
+ | error
+ ;
+
+/*
+ * "arg_declaration" is separated from "declaration" because it
+ * needs other error handling.
+ */
+
+arg_declaration:
+ declmods deftyp T_SEMI {
+ /* empty declaration */
+ warning(2);
+ }
+ | declmods deftyp notype_init_decls T_SEMI
+ | declspecs deftyp T_SEMI {
+ if (!dcs->d_nedecl) {
+ /* empty declaration */
+ warning(2);
+ } else {
+ tspec_t ts = dcs->d_type->t_tspec;
+ /* %s declared in argument declaration list */
+ warning(3, ts == STRUCT ? "struct" :
+ (ts == UNION ? "union" : "enum"));
+ }
+ }
+ | declspecs deftyp type_init_decls T_SEMI {
+ if (dcs->d_nedecl) {
+ tspec_t ts = dcs->d_type->t_tspec;
+ /* %s declared in argument declaration list */
+ warning(3, ts == STRUCT ? "struct" :
+ (ts == UNION ? "union" : "enum"));
+ }
+ }
+ | declmods error
+ | declspecs error
+ ;
+
+declaration:
+ declmods deftyp T_SEMI {
+ if (dcs->d_scl == TYPEDEF) {
+ /* typedef declares no type name */
+ warning(72);
+ } else {
+ /* empty declaration */
+ warning(2);
+ }
+ }
+ | declmods deftyp notype_init_decls T_SEMI
+ | declspecs deftyp T_SEMI {
+ if (dcs->d_scl == TYPEDEF) {
+ /* typedef declares no type name */
+ warning(72);
+ } else if (!dcs->d_nedecl) {
+ /* empty declaration */
+ warning(2);
+ }
+ }
+ | declspecs deftyp type_init_decls T_SEMI
+ | error T_SEMI
+ ;
+
+clrtyp:
+ {
+ clrtyp();
+ }
+ ;
+
+deftyp:
+ /* empty */ {
+ deftyp();
+ }
+ ;
+
+declspecs:
+ clrtyp_typespec {
+ addtype($1);
+ }
+ | declmods typespec {
+ addtype($2);
+ }
+ | declspecs declmod
+ | declspecs notype_typespec {
+ addtype($2);
+ }
+ ;
+
+declmods:
+ clrtyp T_QUAL {
+ addqual($2);
+ }
+ | clrtyp T_SCLASS {
+ addscl($2);
+ }
+ | declmods declmod
+ ;
+
+declmod:
+ T_QUAL {
+ addqual($1);
+ }
+ | T_SCLASS {
+ addscl($1);
+ }
+ ;
+
+clrtyp_typespec:
+ clrtyp notype_typespec {
+ $$ = $2;
+ }
+ | T_TYPENAME clrtyp {
+ $$ = getsym($1)->s_type;
+ }
+ ;
+
+typespec:
+ notype_typespec {
+ $$ = $1;
+ }
+ | T_TYPENAME {
+ $$ = getsym($1)->s_type;
+ }
+ ;
+
+notype_typespec:
+ T_TYPE {
+ $$ = gettyp($1);
+ }
+ | struct_spec {
+ popdecl();
+ $$ = $1;
+ }
+ | enum_spec {
+ popdecl();
+ $$ = $1;
+ }
+ ;
+
+struct_spec:
+ struct struct_tag {
+ /*
+ * STDC requires that "struct a;" always introduces
+ * a new tag if "a" is not declared at current level
+ *
+ * yychar is valid because otherwise the parser would
+ * not been able to deceide if he must shift or reduce
+ */
+ $$ = mktag($2, $1, 0, yychar == T_SEMI);
+ }
+ | struct struct_tag {
+ dcs->d_tagtyp = mktag($2, $1, 1, 0);
+ } struct_declaration {
+ $$ = compltag(dcs->d_tagtyp, $4);
+ }
+ | struct {
+ dcs->d_tagtyp = mktag(NULL, $1, 1, 0);
+ } struct_declaration {
+ $$ = compltag(dcs->d_tagtyp, $3);
+ }
+ | struct error {
+ symtyp = FVFT;
+ $$ = gettyp(INT);
+ }
+ ;
+
+struct:
+ T_SOU {
+ symtyp = FTAG;
+ pushdecl($1 == STRUCT ? MOS : MOU);
+ dcs->d_offset = 0;
+ dcs->d_stralign = CHAR_BIT;
+ $$ = $1;
+ }
+ ;
+
+struct_tag:
+ identifier {
+ $$ = getsym($1);
+ }
+ ;
+
+struct_declaration:
+ struct_decl_lbrace member_declaration_list_with_rbrace {
+ $$ = $2;
+ }
+ ;
+
+struct_decl_lbrace:
+ T_LBRACE {
+ symtyp = FVFT;
+ }
+ ;
+
+member_declaration_list_with_rbrace:
+ member_declaration_list T_SEMI T_RBRACE {
+ $$ = $1;
+ }
+ | member_declaration_list T_RBRACE {
+ if (sflag) {
+ /* syntax req. ";" after last struct/union member */
+ error(66);
+ } else {
+ /* syntax req. ";" after last struct/union member */
+ warning(66);
+ }
+ $$ = $1;
+ }
+ | T_RBRACE {
+ $$ = NULL;
+ }
+ ;
+
+member_declaration_list:
+ member_declaration {
+ $$ = $1;
+ }
+ | member_declaration_list T_SEMI member_declaration {
+ $$ = lnklst($1, $3);
+ }
+ ;
+
+member_declaration:
+ noclass_declmods deftyp {
+ /* too late, i know, but getsym() compensates it */
+ symtyp = FMOS;
+ } notype_member_decls {
+ symtyp = FVFT;
+ $$ = $4;
+ }
+ | noclass_declspecs deftyp {
+ symtyp = FMOS;
+ } type_member_decls {
+ symtyp = FVFT;
+ $$ = $4;
+ }
+ | noclass_declmods deftyp {
+ /* struct or union member must be named */
+ warning(49);
+ $$ = NULL;
+ }
+ | noclass_declspecs deftyp {
+ /* struct or union member must be named */
+ warning(49);
+ $$ = NULL;
+ }
+ | error {
+ symtyp = FVFT;
+ $$ = NULL;
+ }
+ ;
+
+noclass_declspecs:
+ clrtyp_typespec {
+ addtype($1);
+ }
+ | noclass_declmods typespec {
+ addtype($2);
+ }
+ | noclass_declspecs T_QUAL {
+ addqual($2);
+ }
+ | noclass_declspecs notype_typespec {
+ addtype($2);
+ }
+ ;
+
+noclass_declmods:
+ clrtyp T_QUAL {
+ addqual($2);
+ }
+ | noclass_declmods T_QUAL {
+ addqual($2);
+ }
+ ;
+
+notype_member_decls:
+ notype_member_decl {
+ $$ = decl1str($1);
+ }
+ | notype_member_decls {
+ symtyp = FMOS;
+ } T_COMMA type_member_decl {
+ $$ = lnklst($1, decl1str($4));
+ }
+ ;
+
+type_member_decls:
+ type_member_decl {
+ $$ = decl1str($1);
+ }
+ | type_member_decls {
+ symtyp = FMOS;
+ } T_COMMA type_member_decl {
+ $$ = lnklst($1, decl1str($4));
+ }
+ ;
+
+notype_member_decl:
+ notype_decl {
+ $$ = $1;
+ }
+ | notype_decl T_COLON constant {
+ $$ = bitfield($1, toicon($3, 1));
+ }
+ | {
+ symtyp = FVFT;
+ } T_COLON constant {
+ $$ = bitfield(NULL, toicon($3, 1));
+ }
+ ;
+
+type_member_decl:
+ type_decl {
+ $$ = $1;
+ }
+ | type_decl T_COLON constant {
+ $$ = bitfield($1, toicon($3, 1));
+ }
+ | {
+ symtyp = FVFT;
+ } T_COLON constant {
+ $$ = bitfield(NULL, toicon($3, 1));
+ }
+ ;
+
+enum_spec:
+ enum enum_tag {
+ $$ = mktag($2, ENUM, 0, 0);
+ }
+ | enum enum_tag {
+ dcs->d_tagtyp = mktag($2, ENUM, 1, 0);
+ } enum_declaration {
+ $$ = compltag(dcs->d_tagtyp, $4);
+ }
+ | enum {
+ dcs->d_tagtyp = mktag(NULL, ENUM, 1, 0);
+ } enum_declaration {
+ $$ = compltag(dcs->d_tagtyp, $3);
+ }
+ | enum error {
+ symtyp = FVFT;
+ $$ = gettyp(INT);
+ }
+ ;
+
+enum:
+ T_ENUM {
+ symtyp = FTAG;
+ pushdecl(ENUMCON);
+ }
+ ;
+
+enum_tag:
+ identifier {
+ $$ = getsym($1);
+ }
+ ;
+
+enum_declaration:
+ enum_decl_lbrace enums_with_opt_comma T_RBRACE {
+ $$ = $2;
+ }
+ ;
+
+enum_decl_lbrace:
+ T_LBRACE {
+ symtyp = FVFT;
+ enumval = 0;
+ }
+ ;
+
+enums_with_opt_comma:
+ enums {
+ $$ = $1;
+ }
+ | enums T_COMMA {
+ if (sflag) {
+ /* trailing "," prohibited in enum declaration */
+ error(54);
+ } else {
+ /* trailing "," prohibited in enum declaration */
+ (void)gnuism(54);
+ }
+ $$ = $1;
+ }
+ ;
+
+enums:
+ enumerator {
+ $$ = $1;
+ }
+ | enums T_COMMA enumerator {
+ $$ = lnklst($1, $3);
+ }
+ | error {
+ $$ = NULL;
+ }
+ ;
+
+enumerator:
+ ename {
+ $$ = ename($1, enumval, 1);
+ }
+ | ename T_ASSIGN constant {
+ $$ = ename($1, toicon($3, 1), 0);
+ }
+ ;
+
+ename:
+ identifier {
+ $$ = getsym($1);
+ }
+ ;
+
+
+notype_init_decls:
+ notype_init_decl
+ | notype_init_decls T_COMMA type_init_decl
+ ;
+
+type_init_decls:
+ type_init_decl
+ | type_init_decls T_COMMA type_init_decl
+ ;
+
+notype_init_decl:
+ notype_decl opt_asm_or_symbolrename {
+ idecl($1, 0, $2);
+ chksz($1);
+ }
+ | notype_decl opt_asm_or_symbolrename {
+ idecl($1, 1, $2);
+ } T_ASSIGN initializer {
+ chksz($1);
+ }
+ ;
+
+type_init_decl:
+ type_decl opt_asm_or_symbolrename {
+ idecl($1, 0, $2);
+ chksz($1);
+ }
+ | type_decl opt_asm_or_symbolrename {
+ idecl($1, 1, $2);
+ } T_ASSIGN initializer {
+ chksz($1);
+ }
+ ;
+
+notype_decl:
+ notype_direct_decl {
+ $$ = $1;
+ }
+ | pointer notype_direct_decl {
+ $$ = addptr($2, $1);
+ }
+ ;
+
+notype_direct_decl:
+ T_NAME {
+ $$ = dname(getsym($1));
+ }
+ | T_LPARN type_decl T_RPARN {
+ $$ = $2;
+ }
+ | notype_direct_decl T_LBRACK T_RBRACK {
+ $$ = addarray($1, 0, 0);
+ }
+ | notype_direct_decl T_LBRACK constant T_RBRACK {
+ $$ = addarray($1, 1, toicon($3, 0));
+ }
+ | notype_direct_decl param_list {
+ $$ = addfunc($1, $2);
+ popdecl();
+ blklev--;
+ }
+ ;
+
+type_decl:
+ type_direct_decl {
+ $$ = $1;
+ }
+ | pointer type_direct_decl {
+ $$ = addptr($2, $1);
+ }
+ ;
+
+type_direct_decl:
+ identifier {
+ $$ = dname(getsym($1));
+ }
+ | T_LPARN type_decl T_RPARN {
+ $$ = $2;
+ }
+ | type_direct_decl T_LBRACK T_RBRACK {
+ $$ = addarray($1, 0, 0);
+ }
+ | type_direct_decl T_LBRACK constant T_RBRACK {
+ $$ = addarray($1, 1, toicon($3, 0));
+ }
+ | type_direct_decl param_list {
+ $$ = addfunc($1, $2);
+ popdecl();
+ blklev--;
+ }
+ ;
+
+/*
+ * param_decl and notype_param_decl exist to avoid a conflict in
+ * argument lists. A typename enclosed in parens should always be
+ * treated as a typename, not an argument.
+ * "typedef int a; f(int (a));" is "typedef int a; f(int foo(a));"
+ * not "typedef int a; f(int a);"
+ */
+param_decl:
+ direct_param_decl {
+ $$ = $1;
+ }
+ | pointer direct_param_decl {
+ $$ = addptr($2, $1);
+ }
+ ;
+
+direct_param_decl:
+ identifier {
+ $$ = dname(getsym($1));
+ }
+ | T_LPARN notype_param_decl T_RPARN {
+ $$ = $2;
+ }
+ | direct_param_decl T_LBRACK T_RBRACK {
+ $$ = addarray($1, 0, 0);
+ }
+ | direct_param_decl T_LBRACK constant T_RBRACK {
+ $$ = addarray($1, 1, toicon($3, 0));
+ }
+ | direct_param_decl param_list {
+ $$ = addfunc($1, $2);
+ popdecl();
+ blklev--;
+ }
+ ;
+
+notype_param_decl:
+ direct_notype_param_decl {
+ $$ = $1;
+ }
+ | pointer direct_notype_param_decl {
+ $$ = addptr($2, $1);
+ }
+ ;
+
+direct_notype_param_decl:
+ T_NAME {
+ $$ = dname(getsym($1));
+ }
+ | T_LPARN notype_param_decl T_RPARN {
+ $$ = $2;
+ }
+ | direct_notype_param_decl T_LBRACK T_RBRACK {
+ $$ = addarray($1, 0, 0);
+ }
+ | direct_notype_param_decl T_LBRACK constant T_RBRACK {
+ $$ = addarray($1, 1, toicon($3, 0));
+ }
+ | direct_notype_param_decl param_list {
+ $$ = addfunc($1, $2);
+ popdecl();
+ blklev--;
+ }
+ ;
+
+pointer:
+ asterisk {
+ $$ = $1;
+ }
+ | asterisk type_qualifier_list {
+ $$ = mergepq($1, $2);
+ }
+ | asterisk pointer {
+ $$ = mergepq($1, $2);
+ }
+ | asterisk type_qualifier_list pointer {
+ $$ = mergepq(mergepq($1, $2), $3);
+ }
+ ;
+
+asterisk:
+ T_MULT {
+ $$ = xcalloc(1, sizeof (pqinf_t));
+ $$->p_pcnt = 1;
+ }
+ ;
+
+type_qualifier_list:
+ type_qualifier {
+ $$ = $1;
+ }
+ | type_qualifier_list type_qualifier {
+ $$ = mergepq($1, $2);
+ }
+ ;
+
+type_qualifier:
+ T_QUAL {
+ $$ = xcalloc(1, sizeof (pqinf_t));
+ if ($1 == CONST) {
+ $$->p_const = 1;
+ } else {
+ $$->p_volatile = 1;
+ }
+ }
+ ;
+
+param_list:
+ id_list_lparn identifier_list T_RPARN {
+ $$ = $2;
+ }
+ | abs_decl_param_list {
+ $$ = $1;
+ }
+ ;
+
+id_list_lparn:
+ T_LPARN {
+ blklev++;
+ pushdecl(PARG);
+ }
+ ;
+
+identifier_list:
+ T_NAME {
+ $$ = iname(getsym($1));
+ }
+ | identifier_list T_COMMA T_NAME {
+ $$ = lnklst($1, iname(getsym($3)));
+ }
+ | identifier_list error {
+ $$ = $1;
+ }
+ ;
+
+abs_decl_param_list:
+ abs_decl_lparn T_RPARN {
+ $$ = NULL;
+ }
+ | abs_decl_lparn vararg_parameter_type_list T_RPARN {
+ dcs->d_proto = 1;
+ $$ = $2;
+ }
+ | abs_decl_lparn error T_RPARN {
+ $$ = NULL;
+ }
+ ;
+
+abs_decl_lparn:
+ T_LPARN {
+ blklev++;
+ pushdecl(PARG);
+ }
+ ;
+
+vararg_parameter_type_list:
+ parameter_type_list {
+ $$ = $1;
+ }
+ | parameter_type_list T_COMMA T_ELLIPSE {
+ dcs->d_vararg = 1;
+ $$ = $1;
+ }
+ | T_ELLIPSE {
+ if (sflag) {
+ /* ANSI C requires formal parameter before "..." */
+ error(84);
+ } else if (!tflag) {
+ /* ANSI C requires formal parameter before "..." */
+ warning(84);
+ }
+ dcs->d_vararg = 1;
+ $$ = NULL;
+ }
+ ;
+
+parameter_type_list:
+ parameter_declaration {
+ $$ = $1;
+ }
+ | parameter_type_list T_COMMA parameter_declaration {
+ $$ = lnklst($1, $3);
+ }
+ ;
+
+parameter_declaration:
+ declmods deftyp {
+ $$ = decl1arg(aname(), 0);
+ }
+ | declspecs deftyp {
+ $$ = decl1arg(aname(), 0);
+ }
+ | declmods deftyp notype_param_decl {
+ $$ = decl1arg($3, 0);
+ }
+ /*
+ * param_decl is needed because of following conflict:
+ * "typedef int a; f(int (a));" could be parsed as
+ * "function with argument a of type int", or
+ * "function with an abstract argument of type function".
+ * This grammar realizes the second case.
+ */
+ | declspecs deftyp param_decl {
+ $$ = decl1arg($3, 0);
+ }
+ | declmods deftyp abs_decl {
+ $$ = decl1arg($3, 0);
+ }
+ | declspecs deftyp abs_decl {
+ $$ = decl1arg($3, 0);
+ }
+ ;
+
+opt_asm_or_symbolrename: /* expect only one */
+ /* empty */ {
+ $$ = NULL;
+ }
+ | T_ASM T_LPARN T_STRING T_RPARN {
+ freeyyv(&$3, T_STRING);
+ $$ = NULL;
+ }
+ | T_SYMBOLRENAME T_LPARN T_NAME T_RPARN {
+ $$ = $3;
+ }
+ ;
+
+initializer:
+ init_expr
+ ;
+
+init_expr:
+ expr %prec T_COMMA {
+ mkinit($1);
+ }
+ | init_by_name init_expr %prec T_COMMA
+ | init_lbrace init_expr_list init_rbrace
+ | init_lbrace init_expr_list T_COMMA init_rbrace
+ | error
+ ;
+
+init_expr_list:
+ init_expr %prec T_COMMA
+ | init_expr_list T_COMMA init_expr
+ ;
+
+lorange:
+ constant T_ELLIPSE {
+ $$.lo = toicon($1, 1);
+ }
+ ;
+range:
+ constant {
+ $$.lo = toicon($1, 1);
+ $$.hi = $$.lo + 1;
+ }
+ | lorange constant {
+ $$.lo = $1.lo;
+ $$.hi = toicon($2, 1);
+ }
+ ;
+
+init_by_name:
+ T_LBRACK range T_RBRACK T_ASSIGN {
+ if (!Sflag)
+ warning(321);
+ }
+ | point identifier T_ASSIGN {
+ if (!Sflag)
+ warning(313);
+ memberpush($2);
+ }
+ | identifier T_COLON {
+ gnuism(315);
+ memberpush($1);
+ }
+ ;
+
+init_lbrace:
+ T_LBRACE {
+ initlbr();
+ }
+ ;
+
+init_rbrace:
+ T_RBRACE {
+ initrbr();
+ }
+ ;
+
+type_name:
+ {
+ pushdecl(ABSTRACT);
+ } abstract_declaration {
+ popdecl();
+ $$ = $2->s_type;
+ }
+ ;
+
+abstract_declaration:
+ noclass_declmods deftyp {
+ $$ = decl1abs(aname());
+ }
+ | noclass_declspecs deftyp {
+ $$ = decl1abs(aname());
+ }
+ | noclass_declmods deftyp abs_decl {
+ $$ = decl1abs($3);
+ }
+ | noclass_declspecs deftyp abs_decl {
+ $$ = decl1abs($3);
+ }
+ ;
+
+abs_decl:
+ pointer {
+ $$ = addptr(aname(), $1);
+ }
+ | direct_abs_decl {
+ $$ = $1;
+ }
+ | pointer direct_abs_decl {
+ $$ = addptr($2, $1);
+ }
+ ;
+
+direct_abs_decl:
+ T_LPARN abs_decl T_RPARN {
+ $$ = $2;
+ }
+ | T_LBRACK T_RBRACK {
+ $$ = addarray(aname(), 0, 0);
+ }
+ | T_LBRACK constant T_RBRACK {
+ $$ = addarray(aname(), 1, toicon($2, 0));
+ }
+ | direct_abs_decl T_LBRACK T_RBRACK {
+ $$ = addarray($1, 0, 0);
+ }
+ | direct_abs_decl T_LBRACK constant T_RBRACK {
+ $$ = addarray($1, 1, toicon($3, 0));
+ }
+ | abs_decl_param_list {
+ $$ = addfunc(aname(), $1);
+ popdecl();
+ blklev--;
+ }
+ | direct_abs_decl abs_decl_param_list {
+ $$ = addfunc($1, $2);
+ popdecl();
+ blklev--;
+ }
+ ;
+
+non_expr_stmnt:
+ labeled_stmnt
+ | comp_stmnt
+ | selection_stmnt
+ | iteration_stmnt
+ | jump_stmnt {
+ ftflg = 0;
+ }
+ | asm_stmnt
+
+stmnt:
+ expr_stmnt
+ | non_expr_stmnt
+ ;
+
+labeled_stmnt:
+ label stmnt
+ ;
+
+label:
+ identifier T_COLON {
+ symtyp = FLAB;
+ label(T_NAME, getsym($1), NULL);
+ }
+ | T_CASE constant T_COLON {
+ label(T_CASE, NULL, $2);
+ ftflg = 1;
+ }
+ | T_CASE constant T_ELLIPSE constant T_COLON {
+ /* XXX: We don't fill all cases */
+ label(T_CASE, NULL, $2);
+ ftflg = 1;
+ }
+ | T_DEFAULT T_COLON {
+ label(T_DEFAULT, NULL, NULL);
+ ftflg = 1;
+ }
+ ;
+
+comp_stmnt:
+ comp_stmnt_lbrace declaration_list opt_stmnt_list comp_stmnt_rbrace
+ | comp_stmnt_lbrace opt_stmnt_list comp_stmnt_rbrace
+ ;
+
+comp_stmnt_lbrace:
+ T_LBRACE {
+ blklev++;
+ mblklev++;
+ pushdecl(AUTO);
+ }
+ ;
+
+comp_stmnt_rbrace:
+ T_RBRACE {
+ popdecl();
+ freeblk();
+ mblklev--;
+ blklev--;
+ ftflg = 0;
+ }
+ ;
+
+opt_stmnt_list:
+ /* empty */
+ | stmnt_list
+ ;
+
+stmnt_list:
+ stmnt
+ | stmnt_list stmnt {
+ RESTORE();
+ }
+ | stmnt_list error T_SEMI
+ ;
+
+expr_stmnt:
+ expr T_SEMI {
+ expr($1, 0, 0, 1);
+ ftflg = 0;
+ }
+ | T_SEMI {
+ ftflg = 0;
+ }
+ ;
+
+/*
+ * The following two productions are used to implement
+ * ({ [[decl-list] stmt-list] }).
+ * XXX: This is not well tested.
+ */
+expr_stmnt_val:
+ expr T_SEMI {
+ /* XXX: We should really do that only on the last name */
+ if ($1->tn_op == NAME)
+ $1->tn_sym->s_used = 1;
+ $$ = $1;
+ expr($1, 0, 0, 0);
+ ftflg = 0;
+ }
+ | non_expr_stmnt {
+ $$ = getnode();
+ $$->tn_type = gettyp(VOID);
+ }
+ ;
+
+expr_stmnt_list:
+ expr_stmnt_val
+ | expr_stmnt_list expr_stmnt_val {
+ $$ = $2;
+ }
+ | expr_stmnt_list expr_stmnt_val
+ ;
+
+selection_stmnt:
+ if_without_else {
+ SAVE();
+ if2();
+ if3(0);
+ }
+ | if_without_else T_ELSE {
+ SAVE();
+ if2();
+ } stmnt {
+ CLRWFLGS();
+ if3(1);
+ }
+ | if_without_else T_ELSE error {
+ CLRWFLGS();
+ if3(0);
+ }
+ | switch_expr stmnt {
+ CLRWFLGS();
+ switch2();
+ }
+ | switch_expr error {
+ CLRWFLGS();
+ switch2();
+ }
+ ;
+
+if_without_else:
+ if_expr stmnt
+ | if_expr error
+ ;
+
+if_expr:
+ T_IF T_LPARN expr T_RPARN {
+ if1($3);
+ CLRWFLGS();
+ }
+ ;
+
+switch_expr:
+ T_SWITCH T_LPARN expr T_RPARN {
+ switch1($3);
+ CLRWFLGS();
+ }
+ ;
+
+do_stmnt:
+ do stmnt {
+ CLRWFLGS();
+ }
+ ;
+
+iteration_stmnt:
+ while_expr stmnt {
+ CLRWFLGS();
+ while2();
+ }
+ | while_expr error {
+ CLRWFLGS();
+ while2();
+ }
+ | do_stmnt do_while_expr {
+ do2($2);
+ ftflg = 0;
+ }
+ | do error {
+ CLRWFLGS();
+ do2(NULL);
+ }
+ | for_exprs stmnt {
+ CLRWFLGS();
+ for2();
+ }
+ | for_exprs error {
+ CLRWFLGS();
+ for2();
+ }
+ ;
+
+while_expr:
+ T_WHILE T_LPARN expr T_RPARN {
+ while1($3);
+ CLRWFLGS();
+ }
+ ;
+
+do:
+ T_DO {
+ do1();
+ }
+ ;
+
+do_while_expr:
+ T_WHILE T_LPARN expr T_RPARN T_SEMI {
+ $$ = $3;
+ }
+ ;
+
+for_exprs:
+ T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN {
+ for1($3, $5, $7);
+ CLRWFLGS();
+ }
+ ;
+
+opt_expr:
+ /* empty */ {
+ $$ = NULL;
+ }
+ | expr {
+ $$ = $1;
+ }
+ ;
+
+jump_stmnt:
+ goto identifier T_SEMI {
+ dogoto(getsym($2));
+ }
+ | goto error T_SEMI {
+ symtyp = FVFT;
+ }
+ | T_CONTINUE T_SEMI {
+ docont();
+ }
+ | T_BREAK T_SEMI {
+ dobreak();
+ }
+ | T_RETURN T_SEMI {
+ doreturn(NULL);
+ }
+ | T_RETURN expr T_SEMI {
+ doreturn($2);
+ }
+ ;
+
+goto:
+ T_GOTO {
+ symtyp = FLAB;
+ }
+ ;
+
+asm_stmnt:
+ T_ASM T_LPARN read_until_rparn T_SEMI {
+ setasm();
+ }
+ | T_ASM T_QUAL T_LPARN read_until_rparn T_SEMI {
+ setasm();
+ }
+ | T_ASM error
+ ;
+
+read_until_rparn:
+ /* empty */ {
+ ignuptorp();
+ }
+ ;
+
+declaration_list:
+ declaration {
+ CLRWFLGS();
+ }
+ | declaration_list declaration {
+ CLRWFLGS();
+ }
+ ;
+
+constant:
+ expr %prec T_COMMA {
+ $$ = $1;
+ }
+ ;
+
+expr:
+ expr T_MULT expr {
+ $$ = build(MULT, $1, $3);
+ }
+ | expr T_DIVOP expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_ADDOP expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_SHFTOP expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_RELOP expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_EQOP expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_AND expr {
+ $$ = build(AND, $1, $3);
+ }
+ | expr T_XOR expr {
+ $$ = build(XOR, $1, $3);
+ }
+ | expr T_OR expr {
+ $$ = build(OR, $1, $3);
+ }
+ | expr T_LOGAND expr {
+ $$ = build(LOGAND, $1, $3);
+ }
+ | expr T_LOGOR expr {
+ $$ = build(LOGOR, $1, $3);
+ }
+ | expr T_QUEST expr T_COLON expr {
+ $$ = build(QUEST, $1, build(COLON, $3, $5));
+ }
+ | expr T_ASSIGN expr {
+ $$ = build(ASSIGN, $1, $3);
+ }
+ | expr T_OPASS expr {
+ $$ = build($2, $1, $3);
+ }
+ | expr T_COMMA expr {
+ $$ = build(COMMA, $1, $3);
+ }
+ | term {
+ $$ = $1;
+ }
+ ;
+
+term:
+ T_NAME {
+ /* XXX really necessary? */
+ if (yychar < 0)
+ yychar = yylex();
+ $$ = getnnode(getsym($1), yychar);
+ }
+ | string {
+ $$ = getsnode($1);
+ }
+ | T_CON {
+ $$ = getcnode(gettyp($1->v_tspec), $1);
+ }
+ | T_LPARN expr T_RPARN {
+ if ($2 != NULL)
+ $2->tn_parn = 1;
+ $$ = $2;
+ }
+ | T_LPARN comp_stmnt_lbrace declaration_list expr_stmnt_list {
+ blklev--;
+ mblklev--;
+ initsym = mktempsym(duptyp($4->tn_type));
+ mblklev++;
+ blklev++;
+ gnuism(320);
+ } comp_stmnt_rbrace T_RPARN {
+ $$ = getnnode(initsym, 0);
+ }
+ | T_LPARN comp_stmnt_lbrace expr_stmnt_list {
+ blklev--;
+ mblklev--;
+ initsym = mktempsym($3->tn_type);
+ mblklev++;
+ blklev++;
+ gnuism(320);
+ } comp_stmnt_rbrace T_RPARN {
+ $$ = getnnode(initsym, 0);
+ }
+ | term T_INCDEC {
+ $$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);
+ }
+ | T_INCDEC term {
+ $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
+ }
+ | T_MULT term {
+ $$ = build(STAR, $2, NULL);
+ }
+ | T_AND term {
+ $$ = build(AMPER, $2, NULL);
+ }
+ | T_UNOP term {
+ $$ = build($1, $2, NULL);
+ }
+ | T_ADDOP term {
+ if (tflag && $1 == PLUS) {
+ /* unary + is illegal in traditional C */
+ warning(100);
+ }
+ $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL);
+ }
+ | term T_LBRACK expr T_RBRACK {
+ $$ = build(STAR, build(PLUS, $1, $3), NULL);
+ }
+ | term T_LPARN T_RPARN {
+ $$ = funccall($1, NULL);
+ }
+ | term T_LPARN func_arg_list T_RPARN {
+ $$ = funccall($1, $3);
+ }
+ | term point_or_arrow T_NAME {
+ if ($1 != NULL) {
+ sym_t *msym;
+ /* XXX strmemb should be integrated in build() */
+ if ($2 == ARROW) {
+ /* must to this before strmemb is called */
+ $1 = cconv($1);
+ }
+ msym = strmemb($1, $2, getsym($3));
+ $$ = build($2, $1, getnnode(msym, 0));
+ } else {
+ $$ = NULL;
+ }
+ }
+ | T_SIZEOF term %prec T_SIZEOF {
+ if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
+ chkmisc($2, 0, 0, 0, 0, 0, 1);
+ }
+ | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF {
+ $$ = bldszof($3);
+ }
+ | T_LPARN type_name T_RPARN term %prec T_UNOP {
+ $$ = cast($4, $2);
+ }
+ | T_LPARN type_name T_RPARN %prec T_UNOP {
+ sym_t *tmp = mktempsym($2);
+ idecl(tmp, 1, NULL);
+ } init_lbrace init_expr_list init_rbrace {
+ if (!Sflag)
+ gnuism(319);
+ $$ = getnnode(initsym, 0);
+ }
+ ;
+
+string:
+ T_STRING {
+ $$ = $1;
+ }
+ | T_STRING string2 {
+ $$ = catstrg($1, $2);
+ }
+ ;
+
+string2:
+ T_STRING {
+ if (tflag) {
+ /* concatenated strings are illegal in traditional C */
+ warning(219);
+ }
+ $$ = $1;
+ }
+ | string2 T_STRING {
+ $$ = catstrg($1, $2);
+ }
+ ;
+
+func_arg_list:
+ expr %prec T_COMMA {
+ $$ = funcarg(NULL, $1);
+ }
+ | func_arg_list T_COMMA expr {
+ $$ = funcarg($1, $3);
+ }
+ ;
+
+point_or_arrow:
+ T_STROP {
+ symtyp = FMOS;
+ $$ = $1;
+ }
+ ;
+
+point:
+ T_STROP {
+ if ($1 != POINT)
+ error(249);
+ }
+ ;
+
+identifier:
+ T_NAME {
+ $$ = $1;
+ }
+ | T_TYPENAME {
+ $$ = $1;
+ }
+ ;
+
+%%
+
+/* ARGSUSED */
+int
+yyerror(char *msg)
+{
+ error(249);
+ if (++sytxerr >= 5)
+ norecover();
+ return (0);
+}
+
+static __inline int uq_gt(uint64_t, uint64_t);
+static __inline int
+uq_gt(uint64_t a, uint64_t b)
+{
+
+ return (a > b);
+}
+
+static __inline int q_gt(int64_t, int64_t);
+static __inline int
+q_gt(int64_t a, int64_t b)
+{
+
+ return (a > b);
+}
+
+#define q_lt(a, b) q_gt(b, a)
+
+/*
+ * Gets a node for a constant and returns the value of this constant
+ * as integer.
+ * Is the node not constant or too large for int or of type float,
+ * a warning will be printed.
+ *
+ * toicon() should be used only inside declarations. If it is used in
+ * expressions, it frees the memory used for the expression.
+ */
+static int
+toicon(tnode_t *tn, int required)
+{
+ int i;
+ tspec_t t;
+ val_t *v;
+
+ v = constant(tn, required);
+
+ /*
+ * Abstract declarations are used inside expression. To free
+ * the memory would be a fatal error.
+ */
+ if (dcs->d_ctx != ABSTRACT)
+ tfreeblk();
+
+ if ((t = v->v_tspec) == FLOAT || t == DOUBLE || t == LDOUBLE) {
+ i = (int)v->v_ldbl;
+ /* integral constant expression expected */
+ error(55);
+ } else {
+ i = (int)v->v_quad;
+ if (isutyp(t)) {
+ if (uq_gt((uint64_t)v->v_quad,
+ (uint64_t)INT_MAX)) {
+ /* integral constant too large */
+ warning(56);
+ }
+ } else {
+ if (q_gt(v->v_quad, (int64_t)INT_MAX) ||
+ q_lt(v->v_quad, (int64_t)INT_MIN)) {
+ /* integral constant too large */
+ warning(56);
+ }
+ }
+ }
+ free(v);
+ return (i);
+}
+
+static void
+idecl(sym_t *decl, int initflg, sbuf_t *rename)
+{
+ char *s;
+
+ initerr = 0;
+ initsym = decl;
+
+ switch (dcs->d_ctx) {
+ case EXTERN:
+ if (rename != NULL) {
+ if (decl->s_rename != NULL)
+ LERROR("idecl()");
+
+ s = getlblk(1, rename->sb_len + 1);
+ (void)memcpy(s, rename->sb_name, rename->sb_len + 1);
+ decl->s_rename = s;
+ freeyyv(&rename, T_NAME);
+ }
+ decl1ext(decl, initflg);
+ break;
+ case ARG:
+ if (rename != NULL) {
+ /* symbol renaming can't be used on function arguments */
+ error(310);
+ freeyyv(&rename, T_NAME);
+ break;
+ }
+ (void)decl1arg(decl, initflg);
+ break;
+ case AUTO:
+ if (rename != NULL) {
+ /* symbol renaming can't be used on automatic variables */
+ error(311);
+ freeyyv(&rename, T_NAME);
+ break;
+ }
+ decl1loc(decl, initflg);
+ break;
+ default:
+ LERROR("idecl()");
+ }
+
+ if (initflg && !initerr)
+ prepinit();
+}
+
+/*
+ * Discard all input tokens up to and including the next
+ * unmatched right paren
+ */
+static void
+ignuptorp(void)
+{
+ int level;
+
+ if (yychar < 0)
+ yychar = yylex();
+ freeyyv(&yylval, yychar);
+
+ level = 1;
+ while (yychar != T_RPARN || --level > 0) {
+ if (yychar == T_LPARN) {
+ level++;
+ } else if (yychar <= 0) {
+ break;
+ }
+ freeyyv(&yylval, yychar = yylex());
+ }
+
+ yyclearin;
+}
diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c
new file mode 100644
index 0000000..829e0e9
--- /dev/null
+++ b/usr.bin/xlint/lint1/decl.c
@@ -0,0 +1,3052 @@
+/* $NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: decl.c,v 1.33 2004/06/20 22:20:16 jmc Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint1.h"
+
+const char *unnamed = "<unnamed>";
+
+/* shared type structures for arithmtic types and void */
+static type_t *typetab;
+
+/* value of next enumerator during declaration of enum types */
+int enumval;
+
+/*
+ * pointer to top element of a stack which contains informations local
+ * to nested declarations
+ */
+dinfo_t *dcs;
+
+static type_t *tdeferr(type_t *, tspec_t);
+static void settdsym(type_t *, sym_t *);
+static tspec_t mrgtspec(tspec_t, tspec_t);
+static void align(int, int);
+static sym_t *newtag(sym_t *, scl_t, int, int);
+static int eqargs(type_t *, type_t *, int *);
+static int mnoarg(type_t *, int *);
+static int chkosdef(sym_t *, sym_t *);
+static int chkptdecl(sym_t *, sym_t *);
+static sym_t *nsfunc(sym_t *, sym_t *);
+static void osfunc(sym_t *, sym_t *);
+static void ledecl(sym_t *);
+static int chkinit(sym_t *);
+static void chkausg(int, sym_t *);
+static void chkvusg(int, sym_t *);
+static void chklusg(sym_t *);
+static void chktusg(sym_t *);
+static void chkglvar(sym_t *);
+static void glchksz(sym_t *);
+
+/*
+ * initializes all global vars used in declarations
+ */
+void
+initdecl(void)
+{
+ int i;
+
+ /* declaration stack */
+ if ((dcs = calloc(1, sizeof (dinfo_t))) == NULL)
+ nomem();
+ dcs->d_ctx = EXTERN;
+ dcs->d_ldlsym = &dcs->d_dlsyms;
+
+ /* type information and classification */
+ inittyp();
+
+ /* shared type structures */
+ if ((typetab = calloc(NTSPEC, sizeof (type_t))) == NULL)
+ nomem();
+ for (i = 0; i < NTSPEC; i++)
+ typetab[i].t_tspec = NOTSPEC;
+ typetab[CHAR].t_tspec = CHAR;
+ typetab[SCHAR].t_tspec = SCHAR;
+ typetab[UCHAR].t_tspec = UCHAR;
+ typetab[SHORT].t_tspec = SHORT;
+ typetab[USHORT].t_tspec = USHORT;
+ typetab[INT].t_tspec = INT;
+ typetab[UINT].t_tspec = UINT;
+ typetab[LONG].t_tspec = LONG;
+ typetab[ULONG].t_tspec = ULONG;
+ typetab[QUAD].t_tspec = QUAD;
+ typetab[UQUAD].t_tspec = UQUAD;
+ typetab[FLOAT].t_tspec = FLOAT;
+ typetab[DOUBLE].t_tspec = DOUBLE;
+ typetab[LDOUBLE].t_tspec = LDOUBLE;
+ typetab[VOID].t_tspec = VOID;
+ /*
+ * Next two are not real types. They are only used by the parser
+ * to return keywords "signed" and "unsigned"
+ */
+ typetab[SIGNED].t_tspec = SIGNED;
+ typetab[UNSIGN].t_tspec = UNSIGN;
+}
+
+/*
+ * Returns a shared type structure vor arithmetic types and void.
+ *
+ * It's important to duplicate this structure (using duptyp() or tdupdyp())
+ * if it is to be modified (adding qualifiers or anything else).
+ */
+type_t *
+gettyp(tspec_t t)
+{
+
+ return (&typetab[t]);
+}
+
+type_t *
+duptyp(const type_t *tp)
+{
+ type_t *ntp;
+
+ ntp = getblk(sizeof (type_t));
+ STRUCT_ASSIGN(*ntp, *tp);
+ return (ntp);
+}
+
+/*
+ * Use tduptyp() instead of duptyp() inside expressions (if the
+ * allocated memory should be freed after the expr).
+ */
+type_t *
+tduptyp(const type_t *tp)
+{
+ type_t *ntp;
+
+ ntp = tgetblk(sizeof (type_t));
+ STRUCT_ASSIGN(*ntp, *tp);
+ return (ntp);
+}
+
+/*
+ * Returns 1 if the argument is void or an incomplete array,
+ * struct, union or enum type.
+ */
+int
+incompl(type_t *tp)
+{
+ tspec_t t;
+
+ if ((t = tp->t_tspec) == VOID) {
+ return (1);
+ } else if (t == ARRAY) {
+ return (tp->t_aincompl);
+ } else if (t == STRUCT || t == UNION) {
+ return (tp->t_str->sincompl);
+ } else if (t == ENUM) {
+ return (tp->t_enum->eincompl);
+ }
+ return (0);
+}
+
+/*
+ * Set the flag for (in)complete array, struct, union or enum
+ * types.
+ */
+void
+setcompl(type_t *tp, int ic)
+{
+ tspec_t t;
+
+ if ((t = tp->t_tspec) == ARRAY) {
+ tp->t_aincompl = ic;
+ } else if (t == STRUCT || t == UNION) {
+ tp->t_str->sincompl = ic;
+ } else {
+ if (t != ENUM)
+ LERROR("setcompl()");
+ tp->t_enum->eincompl = ic;
+ }
+}
+
+/*
+ * Remember the storage class of the current declaration in dcs->d_scl
+ * (the top element of the declaration stack) and detect multiple
+ * storage classes.
+ */
+void
+addscl(scl_t sc)
+{
+
+ if (sc == INLINE) {
+ if (dcs->d_inline)
+ /* duplicate '%s' */
+ warning(10, "inline");
+ dcs->d_inline = 1;
+ return;
+ }
+ if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
+ dcs->d_smod != NOTSPEC || dcs->d_lmod != NOTSPEC) {
+ /* storage class after type is obsolescent */
+ warning(83);
+ }
+ if (dcs->d_scl == NOSCL) {
+ dcs->d_scl = sc;
+ } else {
+ /*
+ * multiple storage classes. An error will be reported in
+ * deftyp().
+ */
+ dcs->d_mscl = 1;
+ }
+}
+
+/*
+ * Remember the type, modifier or typedef name returned by the parser
+ * in *dcs (top element of decl stack). This information is used in
+ * deftyp() to build the type used for all declarators in this
+ * declaration.
+ *
+ * Is tp->t_typedef 1, the type comes from a previously defined typename.
+ * Otherwise it comes from a type specifier (int, long, ...) or a
+ * struct/union/enum tag.
+ */
+void
+addtype(type_t *tp)
+{
+ tspec_t t;
+
+ if (tp->t_typedef) {
+ if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
+ dcs->d_lmod != NOTSPEC || dcs->d_smod != NOTSPEC) {
+ /*
+ * something like "typedef int a; int a b;"
+ * This should not happen with current grammar.
+ */
+ LERROR("addtype()");
+ }
+ dcs->d_type = tp;
+ return;
+ }
+
+ t = tp->t_tspec;
+
+ if (t == STRUCT || t == UNION || t == ENUM) {
+ /*
+ * something like "int struct a ..."
+ * struct/union/enum with anything else is not allowed
+ */
+ if (dcs->d_type != NULL || dcs->d_atyp != NOTSPEC ||
+ dcs->d_lmod != NOTSPEC || dcs->d_smod != NOTSPEC) {
+ /*
+ * remember that an error must be reported in
+ * deftyp().
+ */
+ dcs->d_terr = 1;
+ dcs->d_atyp = dcs->d_lmod = dcs->d_smod = NOTSPEC;
+ }
+ dcs->d_type = tp;
+ return;
+ }
+
+ if (dcs->d_type != NULL && !dcs->d_type->t_typedef) {
+ /*
+ * something like "struct a int"
+ * struct/union/enum with anything else is not allowed
+ */
+ dcs->d_terr = 1;
+ return;
+ }
+
+ if (t == LONG && dcs->d_lmod == LONG) {
+ /* "long long" or "long ... long" */
+ t = QUAD;
+ dcs->d_lmod = NOTSPEC;
+ if (!quadflg)
+ /* %s C does not support 'long long' */
+ (void)c99ism(265, tflag ? "traditional" : "c89");
+ }
+
+ if (dcs->d_type != NULL && dcs->d_type->t_typedef) {
+ /* something like "typedef int a; a long ..." */
+ dcs->d_type = tdeferr(dcs->d_type, t);
+ return;
+ }
+
+ /* now it can be only a combination of arithmetic types and void */
+ if (t == SIGNED || t == UNSIGN) {
+ /* remember specifiers "signed" and "unsigned" in dcs->d_smod */
+ if (dcs->d_smod != NOTSPEC)
+ /*
+ * more than one "signed" and/or "unsigned"; print
+ * an error in deftyp()
+ */
+ dcs->d_terr = 1;
+ dcs->d_smod = t;
+ } else if (t == SHORT || t == LONG || t == QUAD) {
+ /*
+ * remember specifiers "short", "long" and "long long" in
+ * dcs->d_lmod
+ */
+ if (dcs->d_lmod != NOTSPEC)
+ /* more than one, print error in deftyp() */
+ dcs->d_terr = 1;
+ dcs->d_lmod = t;
+ } else {
+ /*
+ * remember specifiers "void", "char", "int", "float" or
+ * "double" int dcs->d_atyp
+ */
+ if (dcs->d_atyp != NOTSPEC)
+ /* more than one, print error in deftyp() */
+ dcs->d_terr = 1;
+ dcs->d_atyp = t;
+ }
+}
+
+/*
+ * called if a list of declaration specifiers contains a typedef name
+ * and other specifiers (except struct, union, enum, typedef name)
+ */
+static type_t *
+tdeferr(type_t *td, tspec_t t)
+{
+ tspec_t t2;
+
+ t2 = td->t_tspec;
+
+ switch (t) {
+ case SIGNED:
+ case UNSIGN:
+ if (t2 == CHAR || t2 == SHORT || t2 == INT || t2 == LONG ||
+ t2 == QUAD) {
+ if (!tflag)
+ /* modifying typedef with ... */
+ warning(5, ttab[t].tt_name);
+ td = duptyp(gettyp(mrgtspec(t2, t)));
+ td->t_typedef = 1;
+ return (td);
+ }
+ break;
+ case SHORT:
+ if (t2 == INT || t2 == UINT) {
+ /* modifying typedef with ... */
+ warning(5, "short");
+ td = duptyp(gettyp(t2 == INT ? SHORT : USHORT));
+ td->t_typedef = 1;
+ return (td);
+ }
+ break;
+ case LONG:
+ if (t2 == INT || t2 == UINT || t2 == LONG || t2 == ULONG ||
+ t2 == FLOAT || t2 == DOUBLE) {
+ /* modifying typedef with ... */
+ warning(5, "long");
+ if (t2 == INT) {
+ td = gettyp(LONG);
+ } else if (t2 == UINT) {
+ td = gettyp(ULONG);
+ } else if (t2 == LONG) {
+ td = gettyp(QUAD);
+ } else if (t2 == ULONG) {
+ td = gettyp(UQUAD);
+ } else if (t2 == FLOAT) {
+ td = gettyp(DOUBLE);
+ } else if (t2 == DOUBLE) {
+ td = gettyp(LDOUBLE);
+ }
+ td = duptyp(td);
+ td->t_typedef = 1;
+ return (td);
+ }
+ break;
+ /* LINTED (enumeration values not handled in switch) */
+ case NOTSPEC:
+ case USHORT:
+ case UCHAR:
+ case SCHAR:
+ case CHAR:
+ case FUNC:
+ case ARRAY:
+ case PTR:
+ case ENUM:
+ case UNION:
+ case STRUCT:
+ case VOID:
+ case LDOUBLE:
+ case DOUBLE:
+ case FLOAT:
+ case UQUAD:
+ case QUAD:
+ case ULONG:
+ case UINT:
+ case INT:
+ break;
+ }
+
+ /* Anything other is not accepted. */
+
+ dcs->d_terr = 1;
+ return (td);
+}
+
+/*
+ * Remember the symbol of a typedef name (2nd arg) in a struct, union
+ * or enum tag if the typedef name is the first defined for this tag.
+ *
+ * If the tag is unnamed, the typdef name is used for identification
+ * of this tag in lint2. Although its possible that more than one typedef
+ * name is defined for one tag, the first name defined should be unique
+ * if the tag is unnamed.
+ */
+static void
+settdsym(type_t *tp, sym_t *sym)
+{
+ tspec_t t;
+
+ if ((t = tp->t_tspec) == STRUCT || t == UNION) {
+ if (tp->t_str->stdef == NULL)
+ tp->t_str->stdef = sym;
+ } else if (t == ENUM) {
+ if (tp->t_enum->etdef == NULL)
+ tp->t_enum->etdef = sym;
+ }
+}
+
+/*
+ * Remember a qualifier which is part of the declaration specifiers
+ * (and not the declarator) in the top element of the declaration stack.
+ * Also detect multiple qualifiers of the same kind.
+
+ * The remembered qualifier is used by deftyp() to construct the type
+ * for all declarators.
+ */
+void
+addqual(tqual_t q)
+{
+
+ if (q == CONST) {
+ if (dcs->d_const) {
+ /* duplicate "%s" */
+ warning(10, "const");
+ }
+ dcs->d_const = 1;
+ } else {
+ if (q != VOLATILE)
+ LERROR("addqual()");
+ if (dcs->d_volatile) {
+ /* duplicate "%s" */
+ warning(10, "volatile");
+ }
+ dcs->d_volatile = 1;
+ }
+}
+
+/*
+ * Go to the next declaration level (structs, nested structs, blocks,
+ * argument declaration lists ...)
+ */
+void
+pushdecl(scl_t sc)
+{
+ dinfo_t *di;
+
+ if (dflag)
+ (void)printf("pushdecl(%d)\n", (int)sc);
+
+ /* put a new element on the declaration stack */
+ if ((di = calloc(1, sizeof (dinfo_t))) == NULL)
+ nomem();
+ di->d_nxt = dcs;
+ dcs = di;
+ di->d_ctx = sc;
+ di->d_ldlsym = &di->d_dlsyms;
+}
+
+/*
+ * Go back to previous declaration level
+ */
+void
+popdecl(void)
+{
+ dinfo_t *di;
+
+ if (dflag)
+ (void)printf("popdecl(%d)\n", (int)dcs->d_ctx);
+
+ if (dcs->d_nxt == NULL)
+ LERROR("popdecl()");
+ di = dcs;
+ dcs = di->d_nxt;
+ switch (di->d_ctx) {
+ case EXTERN:
+ /* there is nothing after external declarations */
+ LERROR("popdecl()");
+ /* NOTREACHED */
+ case MOS:
+ case MOU:
+ case ENUMCON:
+ /*
+ * Symbols declared in (nested) structs or enums are
+ * part of the next level (they are removed from the
+ * symbol table if the symbols of the outher level are
+ * removed)
+ */
+ if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
+ dcs->d_ldlsym = di->d_ldlsym;
+ break;
+ case ARG:
+ /*
+ * All symbols in dcs->d_dlsyms are introduced in old style
+ * argument declarations (it's not clean, but possible).
+ * They are appended to the list of symbols declared in
+ * an old style argument identifier list or a new style
+ * parameter type list.
+ */
+ if (di->d_dlsyms != NULL) {
+ *di->d_ldlsym = dcs->d_fpsyms;
+ dcs->d_fpsyms = di->d_dlsyms;
+ }
+ break;
+ case ABSTRACT:
+ /*
+ * casts and sizeof
+ * Append all symbols declared in the abstract declaration
+ * to the list of symbols declared in the surrounding decl.
+ * or block.
+ * XXX I'm not sure whether they should be removed from the
+ * symbol table now or later.
+ */
+ if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
+ dcs->d_ldlsym = di->d_ldlsym;
+ break;
+ case AUTO:
+ /* check usage of local vars */
+ chkusage(di);
+ /* FALLTHROUGH */
+ case PARG:
+ /* usage of arguments will be checked by funcend() */
+ rmsyms(di->d_dlsyms);
+ break;
+ default:
+ LERROR("popdecl()");
+ }
+ free(di);
+}
+
+/*
+ * Set flag d_asm in all declaration stack elements up to the
+ * outermost one.
+ *
+ * This is used to mark compound statements which have, possibly in
+ * nested compound statements, asm statements. For these compound
+ * statements no warnings about unused or unitialized variables are
+ * printed.
+ *
+ * There is no need to clear d_asm in dinfo structs with context AUTO,
+ * because these structs are freed at the end of the compound statement.
+ * But it must be cleard in the outermost dinfo struct, which has
+ * context EXTERN. This could be done in clrtyp() and would work for
+ * C, but not for C++ (due to mixed statements and declarations). Thus
+ * we clear it in glclup(), which is used to do some cleanup after
+ * global declarations/definitions.
+ */
+void
+setasm(void)
+{
+ dinfo_t *di;
+
+ for (di = dcs; di != NULL; di = di->d_nxt)
+ di->d_asm = 1;
+}
+
+/*
+ * Clean all elements of the top element of declaration stack which
+ * will be used by the next declaration
+ */
+void
+clrtyp(void)
+{
+
+ dcs->d_atyp = dcs->d_smod = dcs->d_lmod = NOTSPEC;
+ dcs->d_scl = NOSCL;
+ dcs->d_type = NULL;
+ dcs->d_const = dcs->d_volatile = 0;
+ dcs->d_inline = 0;
+ dcs->d_mscl = dcs->d_terr = 0;
+ dcs->d_nedecl = 0;
+ dcs->d_notyp = 0;
+}
+
+/*
+ * Create a type structure from the informations gathered in
+ * the declaration stack.
+ * Complain about storage classes which are not possible in current
+ * context.
+ */
+void
+deftyp(void)
+{
+ tspec_t t, s, l;
+ type_t *tp;
+ scl_t scl;
+
+ t = dcs->d_atyp; /* CHAR, INT, FLOAT, DOUBLE, VOID */
+ s = dcs->d_smod; /* SIGNED, UNSIGNED */
+ l = dcs->d_lmod; /* SHORT, LONG, QUAD */
+ tp = dcs->d_type;
+ scl = dcs->d_scl;
+
+ if (t == NOTSPEC && s == NOTSPEC && l == NOTSPEC && tp == NULL)
+ dcs->d_notyp = 1;
+
+ if (tp != NULL && (t != NOTSPEC || s != NOTSPEC || l != NOTSPEC)) {
+ /* should never happen */
+ LERROR("deftyp()");
+ }
+
+ if (tp == NULL) {
+ switch (t) {
+ case NOTSPEC:
+ t = INT;
+ /* FALLTHROUGH */
+ case INT:
+ if (s == NOTSPEC)
+ s = SIGNED;
+ break;
+ case CHAR:
+ if (l != NOTSPEC) {
+ dcs->d_terr = 1;
+ l = NOTSPEC;
+ }
+ break;
+ case FLOAT:
+ if (l == LONG) {
+ l = NOTSPEC;
+ t = DOUBLE;
+ if (!tflag)
+ /* use 'double' instead of ... */
+ warning(6);
+ }
+ break;
+ case DOUBLE:
+ if (l == LONG) {
+ l = NOTSPEC;
+ t = LDOUBLE;
+ if (tflag)
+ /* 'long double' is illegal in ... */
+ warning(266);
+ }
+ break;
+ case VOID:
+ break;
+ default:
+ LERROR("deftyp()");
+ }
+ if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
+ dcs->d_terr = 1;
+ l = s = NOTSPEC;
+ }
+ if (l != NOTSPEC)
+ t = l;
+ dcs->d_type = gettyp(mrgtspec(t, s));
+ }
+
+ if (dcs->d_mscl) {
+ /* only one storage class allowed */
+ error(7);
+ }
+ if (dcs->d_terr) {
+ /* illegal type combination */
+ error(4);
+ }
+
+ if (dcs->d_ctx == EXTERN) {
+ if (scl == REG || scl == AUTO) {
+ /* illegal storage class */
+ error(8);
+ scl = NOSCL;
+ }
+ } else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) {
+ if (scl != NOSCL && scl != REG) {
+ /* only "register" valid ... */
+ error(9);
+ scl = NOSCL;
+ }
+ }
+
+ dcs->d_scl = scl;
+
+ if (dcs->d_const && dcs->d_type->t_const) {
+ if (!dcs->d_type->t_typedef)
+ LERROR("deftyp()");
+ /* typedef already qualified with "%s" */
+ warning(68, "const");
+ }
+ if (dcs->d_volatile && dcs->d_type->t_volatile) {
+ if (!dcs->d_type->t_typedef)
+ LERROR("deftyp()");
+ /* typedef already qualified with "%s" */
+ warning(68, "volatile");
+ }
+
+ if (dcs->d_const || dcs->d_volatile) {
+ dcs->d_type = duptyp(dcs->d_type);
+ dcs->d_type->t_const |= dcs->d_const;
+ dcs->d_type->t_volatile |= dcs->d_volatile;
+ }
+}
+
+/*
+ * Merge type specifiers (char, ..., long long, signed, unsigned).
+ */
+static tspec_t
+mrgtspec(tspec_t t, tspec_t s)
+{
+
+ if (s == SIGNED || s == UNSIGN) {
+ if (t == CHAR) {
+ t = s == SIGNED ? SCHAR : UCHAR;
+ } else if (t == SHORT) {
+ t = s == SIGNED ? SHORT : USHORT;
+ } else if (t == INT) {
+ t = s == SIGNED ? INT : UINT;
+ } else if (t == LONG) {
+ t = s == SIGNED ? LONG : ULONG;
+ } else if (t == QUAD) {
+ t = s == SIGNED ? QUAD : UQUAD;
+ }
+ }
+
+ return (t);
+}
+
+/*
+ * Return the length of a type in bit.
+ *
+ * Printing a message if the outhermost dimension of an array is 0 must
+ * be done by the caller. All other problems are reported by length()
+ * if name is not NULL.
+ */
+int
+length(type_t *tp, const char *name)
+{
+ int elem, elsz;
+
+ elem = 1;
+ while (tp && tp->t_tspec == ARRAY) {
+ elem *= tp->t_dim;
+ tp = tp->t_subt;
+ }
+ if (tp == NULL)
+ return -1;
+
+ switch (tp->t_tspec) {
+ case FUNC:
+ /* compiler takes size of function */
+ LERROR("%s", msgs[12]);
+ /* NOTREACHED */
+ case STRUCT:
+ case UNION:
+ if (incompl(tp) && name != NULL) {
+ /* incomplete structure or union %s: %s */
+ error(31, tp->t_str->stag->s_name, name);
+ }
+ elsz = tp->t_str->size;
+ break;
+ case ENUM:
+ if (incompl(tp) && name != NULL) {
+ /* incomplete enum type: %s */
+ warning(13, name);
+ }
+ /* FALLTHROUGH */
+ default:
+ elsz = size(tp->t_tspec);
+ if (elsz <= 0)
+ LERROR("length()");
+ break;
+ }
+ return (elem * elsz);
+}
+
+/*
+ * Get the alignment of the given type in bits.
+ */
+int
+getbound(type_t *tp)
+{
+ int a;
+ tspec_t t;
+
+ while (tp && tp->t_tspec == ARRAY)
+ tp = tp->t_subt;
+
+ if (tp == NULL)
+ return -1;
+
+ if ((t = tp->t_tspec) == STRUCT || t == UNION) {
+ a = tp->t_str->align;
+ } else if (t == FUNC) {
+ /* compiler takes alignment of function */
+ error(14);
+ a = LINT_ALIGN(1) * CHAR_BIT;
+ } else {
+ if ((a = size(t)) == 0) {
+ a = CHAR_BIT;
+ } else if (a > LINT_ALIGN(1) * CHAR_BIT) {
+ a = LINT_ALIGN(1) * CHAR_BIT;
+ }
+ }
+ if (a < CHAR_BIT || a > LINT_ALIGN(1) * CHAR_BIT)
+ LERROR("getbound()");
+ return (a);
+}
+
+/*
+ * Concatenate two lists of symbols by s_nxt. Used by declarations of
+ * struct/union/enum elements and parameters.
+ */
+sym_t *
+lnklst(sym_t *l1, sym_t *l2)
+{
+ sym_t *l;
+
+ if ((l = l1) == NULL)
+ return (l2);
+ while (l1->s_nxt != NULL)
+ l1 = l1->s_nxt;
+ l1->s_nxt = l2;
+ return (l);
+}
+
+/*
+ * Check if the type of the given symbol is valid and print an error
+ * message if it is not.
+ *
+ * Invalid types are:
+ * - arrays of incomlete types or functions
+ * - functions returning arrays or functions
+ * - void types other than type of function or pointer
+ */
+void
+chktyp(sym_t *sym)
+{
+ tspec_t to, t;
+ type_t **tpp, *tp;
+
+ tpp = &sym->s_type;
+ to = NOTSPEC;
+ while ((tp = *tpp) != NULL) {
+ t = tp->t_tspec;
+ /*
+ * If this is the type of an old style function definition,
+ * a better warning is printed in funcdef().
+ */
+ if (t == FUNC && !tp->t_proto &&
+ !(to == NOTSPEC && sym->s_osdef)) {
+ if (sflag && hflag)
+ /* function declaration is not a prototype */
+ warning(287);
+ }
+ if (to == FUNC) {
+ if (t == FUNC || t == ARRAY) {
+ /* function returns illegal type */
+ error(15);
+ if (t == FUNC) {
+ *tpp = incref(*tpp, PTR);
+ } else {
+ *tpp = incref((*tpp)->t_subt, PTR);
+ }
+ return;
+ } else if (tp->t_const || tp->t_volatile) {
+ if (sflag) { /* XXX oder better !tflag ? */
+ /* function cannot return const... */
+ warning(228);
+ }
+ }
+ } if (to == ARRAY) {
+ if (t == FUNC) {
+ /* array of function is illegal */
+ error(16);
+ *tpp = gettyp(INT);
+ return;
+ } else if (t == ARRAY && tp->t_dim == 0) {
+ /* null dimension */
+ error(17);
+ return;
+ } else if (t == VOID) {
+ /* illegal use of void */
+ error(18);
+ *tpp = gettyp(INT);
+#if 0 /* errors are produced by length() */
+ } else if (incompl(tp)) {
+ /* array of incomplete type */
+ if (sflag) {
+ error(301);
+ } else {
+ warning(301);
+ }
+#endif
+ }
+ } else if (to == NOTSPEC && t == VOID) {
+ if (dcs->d_ctx == PARG) {
+ if (sym->s_scl != ABSTRACT) {
+ if (sym->s_name == unnamed)
+ LERROR("chktyp()");
+ /* void param cannot have name: %s */
+ error(61, sym->s_name);
+ *tpp = gettyp(INT);
+ }
+ } else if (dcs->d_ctx == ABSTRACT) {
+ /* ok */
+ } else if (sym->s_scl != TYPEDEF) {
+ /* void type for %s */
+ error(19, sym->s_name);
+ *tpp = gettyp(INT);
+ }
+ }
+ if (t == VOID && to != PTR) {
+ if (tp->t_const || tp->t_volatile) {
+ /* inappropriate qualifiers with "void" */
+ warning(69);
+ tp->t_const = tp->t_volatile = 0;
+ }
+ }
+ tpp = &tp->t_subt;
+ to = t;
+ }
+}
+
+/*
+ * Process the declarator of a struct/union element.
+ */
+sym_t *
+decl1str(sym_t *dsym)
+{
+ type_t *tp;
+ tspec_t t;
+ int sz, len;
+ int o = 0; /* Appease gcc */
+ scl_t sc;
+
+ if ((sc = dsym->s_scl) != MOS && sc != MOU)
+ LERROR("decl1str()");
+
+ if (dcs->d_rdcsym != NULL) {
+ if ((sc = dcs->d_rdcsym->s_scl) != MOS && sc != MOU)
+ /* should be ensured by storesym() */
+ LERROR("decl1str()");
+ if (dsym->s_styp == dcs->d_rdcsym->s_styp) {
+ /* duplicate member name: %s */
+ error(33, dsym->s_name);
+ rmsym(dcs->d_rdcsym);
+ }
+ }
+
+ chktyp(dsym);
+
+ t = (tp = dsym->s_type)->t_tspec;
+
+ if (dsym->s_field) {
+ /*
+ * bit field
+ *
+ * only unsigned and signed int are portable bit-field types
+ * (at least in ANSI C, in traditional C only unsigned int)
+ */
+ if (t == CHAR || t == UCHAR || t == SCHAR ||
+ t == SHORT || t == USHORT || t == ENUM) {
+ if (bitfieldtype_ok == 0) {
+ if (sflag) {
+ char buf[64];
+ /*
+ * bit-field type '%s' invalid in
+ * ANSI C
+ */
+ warning(273,
+ tyname(buf, sizeof(buf), tp));
+ } else if (pflag) {
+ /* nonportable bit-field type */
+ warning(34);
+ }
+ }
+ } else if (t == INT && dcs->d_smod == NOTSPEC) {
+ if (pflag && bitfieldtype_ok == 0) {
+ /* nonportable bit-field type */
+ warning(34);
+ }
+ } else if (t != INT && t != UINT) {
+ /*
+ * Non-integer types are always illegal for
+ * bitfields, regardless of BITFIELDTYPE.
+ * Integer types not dealt with above are
+ * okay only if BITFIELDTYPE is in effect.
+ */
+ if (bitfieldtype_ok == 0 || isityp(t) == 0) {
+ /* illegal bit-field type */
+ error(35);
+ sz = tp->t_flen;
+ dsym->s_type = tp = duptyp(gettyp(t = INT));
+ if ((tp->t_flen = sz) > size(t))
+ tp->t_flen = size(t);
+ }
+ }
+ if ((len = tp->t_flen) < 0 || len > size(t)) {
+ /* illegal bit-field size */
+ error(36);
+ tp->t_flen = size(t);
+ } else if (len == 0 && dsym->s_name != unnamed) {
+ /* zero size bit-field */
+ error(37);
+ tp->t_flen = size(t);
+ }
+ if (dsym->s_scl == MOU) {
+ /* illegal use of bit-field */
+ error(41);
+ dsym->s_type->t_isfield = 0;
+ dsym->s_field = 0;
+ }
+ } else if (t == FUNC) {
+ /* function illegal in structure or union */
+ error(38);
+ dsym->s_type = tp = incref(tp, t = PTR);
+ }
+
+ /*
+ * bit-fields of length 0 are not warned about because length()
+ * does not return the length of the bit-field but the length
+ * of the type the bit-field is packed in (its ok)
+ */
+ if ((sz = length(dsym->s_type, dsym->s_name)) == 0) {
+ if (t == ARRAY && dsym->s_type->t_dim == 0) {
+ /* illegal zero sized structure member: %s */
+ c99ism(39, dsym->s_name);
+ }
+ }
+
+ if (dcs->d_ctx == MOU) {
+ o = dcs->d_offset;
+ dcs->d_offset = 0;
+ }
+ if (dsym->s_field) {
+ align(getbound(tp), tp->t_flen);
+ dsym->s_value.v_quad = (dcs->d_offset / size(t)) * size(t);
+ tp->t_foffs = dcs->d_offset - (int)dsym->s_value.v_quad;
+ dcs->d_offset += tp->t_flen;
+ } else {
+ align(getbound(tp), 0);
+ dsym->s_value.v_quad = dcs->d_offset;
+ dcs->d_offset += sz;
+ }
+ if (dcs->d_ctx == MOU) {
+ if (o > dcs->d_offset)
+ dcs->d_offset = o;
+ }
+
+ chkfdef(dsym, 0);
+
+ /*
+ * Clear the BITFIELDTYPE indicator after processing each
+ * structure element.
+ */
+ bitfieldtype_ok = 0;
+
+ return (dsym);
+}
+
+/*
+ * Aligns next structure element as required.
+ *
+ * al contains the required alignment, len the length of a bit-field.
+ */
+static void
+align(int al, int len)
+{
+ int no;
+
+ /*
+ * The alignment of the current element becomes the alignment of
+ * the struct/union if it is larger than the current alignment
+ * of the struct/union.
+ */
+ if (al > dcs->d_stralign)
+ dcs->d_stralign = al;
+
+ no = roundup2(dcs->d_offset, al);
+ if (len == 0 || dcs->d_offset + len > no)
+ dcs->d_offset = no;
+}
+
+/*
+ * Remember the width of the field in its type structure.
+ */
+sym_t *
+bitfield(sym_t *dsym, int len)
+{
+
+ if (dsym == NULL) {
+ dsym = getblk(sizeof (sym_t));
+ dsym->s_name = unnamed;
+ dsym->s_kind = FMOS;
+ dsym->s_scl = MOS;
+ dsym->s_type = gettyp(UINT);
+ dsym->s_blklev = -1;
+ }
+ dsym->s_type = duptyp(dsym->s_type);
+ dsym->s_type->t_isfield = 1;
+ dsym->s_type->t_flen = len;
+ dsym->s_field = 1;
+ return (dsym);
+}
+
+/*
+ * Collect informations about a sequence of asterisks and qualifiers
+ * in a list of type pqinf_t.
+ * Qualifiers refer always to the left asterisk. The rightmost asterisk
+ * will be at the top of the list.
+ */
+pqinf_t *
+mergepq(pqinf_t *p1, pqinf_t *p2)
+{
+ pqinf_t *p;
+
+ if (p2->p_pcnt != 0) {
+ /* left '*' at the end of the list */
+ for (p = p2; p->p_nxt != NULL; p = p->p_nxt)
+ continue;
+ p->p_nxt = p1;
+ return (p2);
+ } else {
+ if (p2->p_const) {
+ if (p1->p_const) {
+ /* duplicate %s */
+ warning(10, "const");
+ }
+ p1->p_const = 1;
+ }
+ if (p2->p_volatile) {
+ if (p1->p_volatile) {
+ /* duplicate %s */
+ warning(10, "volatile");
+ }
+ p1->p_volatile = 1;
+ }
+ free(p2);
+ return (p1);
+ }
+}
+
+/*
+ * Followint 3 functions extend the type of a declarator with
+ * pointer, function and array types.
+ *
+ * The current type is the type built by deftyp() (dcs->d_type) and
+ * pointer, function and array types already added for this
+ * declarator. The new type extension is inserted between both.
+ */
+sym_t *
+addptr(sym_t *decl, pqinf_t *pi)
+{
+ type_t **tpp, *tp;
+ pqinf_t *npi;
+
+ tpp = &decl->s_type;
+ while (*tpp && *tpp != dcs->d_type)
+ tpp = &(*tpp)->t_subt;
+ if (*tpp == NULL)
+ return decl;
+
+ while (pi != NULL) {
+ *tpp = tp = getblk(sizeof (type_t));
+ tp->t_tspec = PTR;
+ tp->t_const = pi->p_const;
+ tp->t_volatile = pi->p_volatile;
+ *(tpp = &tp->t_subt) = dcs->d_type;
+ npi = pi->p_nxt;
+ free(pi);
+ pi = npi;
+ }
+ return (decl);
+}
+
+/*
+ * If a dimension was specified, dim is 1, otherwise 0
+ * n is the specified dimension
+ */
+sym_t *
+addarray(sym_t *decl, int dim, int n)
+{
+ type_t **tpp, *tp;
+
+ tpp = &decl->s_type;
+ while (*tpp && *tpp != dcs->d_type)
+ tpp = &(*tpp)->t_subt;
+ if (*tpp == NULL)
+ return decl;
+
+ *tpp = tp = getblk(sizeof (type_t));
+ tp->t_tspec = ARRAY;
+ tp->t_subt = dcs->d_type;
+ tp->t_dim = n;
+
+ if (n < 0) {
+ /* negative array dimension */
+ error(20, n);
+ n = 0;
+ } else if (n == 0 && dim) {
+ /* zero array dimension */
+ c99ism(322, dim);
+ } else if (n == 0 && !dim) {
+ /* is incomplete type */
+ setcompl(tp, 1);
+ }
+
+ return (decl);
+}
+
+sym_t *
+addfunc(sym_t *decl, sym_t *args)
+{
+ type_t **tpp, *tp;
+
+ if (dcs->d_proto) {
+ if (tflag)
+ /* function prototypes are illegal in traditional C */
+ warning(270);
+ args = nsfunc(decl, args);
+ } else {
+ osfunc(decl, args);
+ }
+
+ /*
+ * The symbols are removed from the symbol table by popdecl() after
+ * addfunc(). To be able to restore them if this is a function
+ * definition, a pointer to the list of all symbols is stored in
+ * dcs->d_nxt->d_fpsyms. Also a list of the arguments (concatenated
+ * by s_nxt) is stored in dcs->d_nxt->d_fargs.
+ * (dcs->d_nxt must be used because *dcs is the declaration stack
+ * element created for the list of params and is removed after
+ * addfunc())
+ */
+ if (dcs->d_nxt->d_ctx == EXTERN &&
+ decl->s_type == dcs->d_nxt->d_type) {
+ dcs->d_nxt->d_fpsyms = dcs->d_dlsyms;
+ dcs->d_nxt->d_fargs = args;
+ }
+
+ tpp = &decl->s_type;
+ while (*tpp && *tpp != dcs->d_nxt->d_type)
+ tpp = &(*tpp)->t_subt;
+ if (*tpp == NULL)
+ return decl;
+
+ *tpp = tp = getblk(sizeof (type_t));
+ tp->t_tspec = FUNC;
+ tp->t_subt = dcs->d_nxt->d_type;
+ if ((tp->t_proto = dcs->d_proto) != 0)
+ tp->t_args = args;
+ tp->t_vararg = dcs->d_vararg;
+
+ return (decl);
+}
+
+/*
+ * Called for new style function declarations.
+ */
+/* ARGSUSED */
+static sym_t *
+nsfunc(sym_t *decl, sym_t *args)
+{
+ sym_t *arg, *sym;
+ scl_t sc;
+ int n;
+
+ /*
+ * Declarations of structs/unions/enums in param lists are legal,
+ * but senseless.
+ */
+ for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+ sc = sym->s_scl;
+ if (sc == STRTAG || sc == UNIONTAG || sc == ENUMTAG) {
+ /* dubious tag declaration: %s %s */
+ warning(85, scltoa(sc), sym->s_name);
+ }
+ }
+
+ n = 1;
+ for (arg = args; arg != NULL; arg = arg->s_nxt) {
+ if (arg->s_type->t_tspec == VOID) {
+ if (n > 1 || arg->s_nxt != NULL) {
+ /* "void" must be sole parameter */
+ error(60);
+ arg->s_type = gettyp(INT);
+ }
+ }
+ n++;
+ }
+
+ /* return NULL if first param is VOID */
+ return (args != NULL && args->s_type->t_tspec != VOID ? args : NULL);
+}
+
+/*
+ * Called for old style function declarations.
+ */
+static void
+osfunc(sym_t *decl, sym_t *args)
+{
+
+ /*
+ * Remember list of params only if this is really seams to be
+ * a function definition.
+ */
+ if (dcs->d_nxt->d_ctx == EXTERN &&
+ decl->s_type == dcs->d_nxt->d_type) {
+ /*
+ * We assume that this becomes a function definition. If
+ * we are wrong, its corrected in chkfdef().
+ */
+ if (args != NULL) {
+ decl->s_osdef = 1;
+ decl->s_args = args;
+ }
+ } else {
+ if (args != NULL)
+ /* function prototype parameters must have types */
+ warning(62);
+ }
+}
+
+/*
+ * Lists of Identifiers in functions declarations are allowed only if
+ * its also a function definition. If this is not the case, print a
+ * error message.
+ */
+void
+chkfdef(sym_t *sym, int msg)
+{
+
+ if (sym->s_osdef) {
+ if (msg) {
+ /* incomplete or misplaced function definition */
+ error(22);
+ }
+ sym->s_osdef = 0;
+ sym->s_args = NULL;
+ }
+}
+
+/*
+ * Process the name in a declarator.
+ * If the symbol does already exists, a new one is created.
+ * The symbol becomes one of the storage classes EXTERN, STATIC, AUTO or
+ * TYPEDEF.
+ * s_def and s_reg are valid after dname().
+ */
+sym_t *
+dname(sym_t *sym)
+{
+ scl_t sc = NOSCL;
+
+ if (sym->s_scl == NOSCL) {
+ dcs->d_rdcsym = NULL;
+ } else if (sym->s_defarg) {
+ sym->s_defarg = 0;
+ dcs->d_rdcsym = NULL;
+ } else {
+ dcs->d_rdcsym = sym;
+ sym = pushdown(sym);
+ }
+
+ switch (dcs->d_ctx) {
+ case MOS:
+ case MOU:
+ /* Parent setzen */
+ sym->s_styp = dcs->d_tagtyp->t_str;
+ sym->s_def = DEF;
+ sym->s_value.v_tspec = INT;
+ sc = dcs->d_ctx;
+ break;
+ case EXTERN:
+ /*
+ * static and external symbols without "extern" are
+ * considered to be tentative defined, external
+ * symbols with "extern" are declared, and typedef names
+ * are defined. Tentative defined and declared symbols
+ * may become defined if an initializer is present or
+ * this is a function definition.
+ */
+ if ((sc = dcs->d_scl) == NOSCL) {
+ sc = EXTERN;
+ sym->s_def = TDEF;
+ } else if (sc == STATIC) {
+ sym->s_def = TDEF;
+ } else if (sc == TYPEDEF) {
+ sym->s_def = DEF;
+ } else if (sc == EXTERN) {
+ sym->s_def = DECL;
+ } else {
+ LERROR("dname()");
+ }
+ break;
+ case PARG:
+ sym->s_arg = 1;
+ /* FALLTHROUGH */
+ case ARG:
+ if ((sc = dcs->d_scl) == NOSCL) {
+ sc = AUTO;
+ } else if (sc == REG) {
+ sym->s_reg = 1;
+ sc = AUTO;
+ } else {
+ LERROR("dname()");
+ }
+ sym->s_def = DEF;
+ break;
+ case AUTO:
+ if ((sc = dcs->d_scl) == NOSCL) {
+ /*
+ * XXX somewhat ugly because we dont know whether
+ * this is AUTO or EXTERN (functions). If we are
+ * wrong it must be corrected in decl1loc(), where
+ * we have the necessary type information.
+ */
+ sc = AUTO;
+ sym->s_def = DEF;
+ } else if (sc == AUTO || sc == STATIC || sc == TYPEDEF) {
+ sym->s_def = DEF;
+ } else if (sc == REG) {
+ sym->s_reg = 1;
+ sc = AUTO;
+ sym->s_def = DEF;
+ } else if (sc == EXTERN) {
+ sym->s_def = DECL;
+ } else {
+ LERROR("dname()");
+ }
+ break;
+ default:
+ LERROR("dname()");
+ }
+ sym->s_scl = sc;
+
+ sym->s_type = dcs->d_type;
+
+ dcs->d_fpsyms = NULL;
+
+ return (sym);
+}
+
+/*
+ * Process a name in the list of formal params in an old style function
+ * definition.
+ */
+sym_t *
+iname(sym_t *sym)
+{
+
+ if (sym->s_scl != NOSCL) {
+ if (blklev == sym->s_blklev) {
+ /* redeclaration of formal parameter %s */
+ error(21, sym->s_name);
+ if (!sym->s_defarg)
+ LERROR("iname()");
+ }
+ sym = pushdown(sym);
+ }
+ sym->s_type = gettyp(INT);
+ sym->s_scl = AUTO;
+ sym->s_def = DEF;
+ sym->s_defarg = sym->s_arg = 1;
+ return (sym);
+}
+
+/*
+ * Create the type of a tag.
+ *
+ * tag points to the symbol table entry of the tag
+ * kind is the kind of the tag (STRUCT/UNION/ENUM)
+ * decl is 1 if the type of the tag will be completed in this declaration
+ * (the following token is T_LBRACE)
+ * semi is 1 if the following token is T_SEMI
+ */
+type_t *
+mktag(sym_t *tag, tspec_t kind, int decl, int semi)
+{
+ scl_t scl = NOSCL;
+ type_t *tp;
+
+ if (kind == STRUCT) {
+ scl = STRTAG;
+ } else if (kind == UNION) {
+ scl = UNIONTAG;
+ } else if (kind == ENUM) {
+ scl = ENUMTAG;
+ } else {
+ LERROR("mktag()");
+ }
+
+ if (tag != NULL) {
+ if (tag->s_scl != NOSCL) {
+ tag = newtag(tag, scl, decl, semi);
+ } else {
+ /* a new tag, no empty declaration */
+ dcs->d_nxt->d_nedecl = 1;
+ if (scl == ENUMTAG && !decl) {
+ if (!tflag && (sflag || pflag))
+ /* forward reference to enum type */
+ warning(42);
+ }
+ }
+ if (tag->s_scl == NOSCL) {
+ tag->s_scl = scl;
+ tag->s_type = tp = getblk(sizeof (type_t));
+ } else {
+ tp = tag->s_type;
+ }
+ } else {
+ tag = getblk(sizeof (sym_t));
+ tag->s_name = unnamed;
+ UNIQUE_CURR_POS(tag->s_dpos);
+ tag->s_kind = FTAG;
+ tag->s_scl = scl;
+ tag->s_blklev = -1;
+ tag->s_type = tp = getblk(sizeof (type_t));
+ dcs->d_nxt->d_nedecl = 1;
+ }
+
+ if (tp->t_tspec == NOTSPEC) {
+ tp->t_tspec = kind;
+ if (kind != ENUM) {
+ tp->t_str = getblk(sizeof (str_t));
+ tp->t_str->align = CHAR_BIT;
+ tp->t_str->stag = tag;
+ } else {
+ tp->t_isenum = 1;
+ tp->t_enum = getblk(sizeof (enum_t));
+ tp->t_enum->etag = tag;
+ }
+ /* is incomplete type */
+ setcompl(tp, 1);
+ }
+
+ return (tp);
+}
+
+/*
+ * Checks all possible cases of tag redeclarations.
+ * decl is 1 if T_LBRACE follows
+ * semi is 1 if T_SEMI follows
+ */
+static sym_t *
+newtag(sym_t *tag, scl_t scl, int decl, int semi)
+{
+
+ if (tag->s_blklev < blklev) {
+ if (semi) {
+ /* "struct a;" */
+ if (!tflag) {
+ if (!sflag)
+ /* decl. introduces new type ... */
+ warning(44, scltoa(scl), tag->s_name);
+ tag = pushdown(tag);
+ } else if (tag->s_scl != scl) {
+ /* base type is really "%s %s" */
+ warning(45, scltoa(tag->s_scl), tag->s_name);
+ }
+ dcs->d_nxt->d_nedecl = 1;
+ } else if (decl) {
+ /* "struct a { ... } " */
+ if (hflag)
+ /* redefinition hides earlier one: %s */
+ warning(43, tag->s_name);
+ tag = pushdown(tag);
+ dcs->d_nxt->d_nedecl = 1;
+ } else if (tag->s_scl != scl) {
+ /* base type is really "%s %s" */
+ warning(45, scltoa(tag->s_scl), tag->s_name);
+ /* declaration introduces new type in ANSI C: %s %s */
+ if (!sflag)
+ warning(44, scltoa(scl), tag->s_name);
+ tag = pushdown(tag);
+ dcs->d_nxt->d_nedecl = 1;
+ }
+ } else {
+ if (tag->s_scl != scl) {
+ /* (%s) tag redeclared */
+ error(46, scltoa(tag->s_scl));
+ prevdecl(-1, tag);
+ tag = pushdown(tag);
+ dcs->d_nxt->d_nedecl = 1;
+ } else if (decl && !incompl(tag->s_type)) {
+ /* (%s) tag redeclared */
+ error(46, scltoa(tag->s_scl));
+ prevdecl(-1, tag);
+ tag = pushdown(tag);
+ dcs->d_nxt->d_nedecl = 1;
+ } else if (semi || decl) {
+ dcs->d_nxt->d_nedecl = 1;
+ }
+ }
+ return (tag);
+}
+
+const char *
+scltoa(scl_t sc)
+{
+ const char *s;
+
+ switch (sc) {
+ case EXTERN: s = "extern"; break;
+ case STATIC: s = "static"; break;
+ case AUTO: s = "auto"; break;
+ case REG: s = "register"; break;
+ case TYPEDEF: s = "typedef"; break;
+ case STRTAG: s = "struct"; break;
+ case UNIONTAG: s = "union"; break;
+ case ENUMTAG: s = "enum"; break;
+ default: LERROR("tagttoa()");
+ }
+ return (s);
+}
+
+/*
+ * Completes the type of a tag in a struct/union/enum declaration.
+ * tp points to the type of the, tag, fmem to the list of members/enums.
+ */
+type_t *
+compltag(type_t *tp, sym_t *fmem)
+{
+ tspec_t t;
+ str_t *sp;
+ int n;
+ sym_t *mem;
+
+ /* from now a complete type */
+ setcompl(tp, 0);
+
+ if ((t = tp->t_tspec) != ENUM) {
+ align(dcs->d_stralign, 0);
+ sp = tp->t_str;
+ sp->align = dcs->d_stralign;
+ sp->size = dcs->d_offset;
+ sp->memb = fmem;
+ if (sp->size == 0) {
+ /* zero sized %s */
+ (void)c99ism(47, ttab[t].tt_name);
+ } else {
+ n = 0;
+ for (mem = fmem; mem != NULL; mem = mem->s_nxt) {
+ if (mem->s_name != unnamed)
+ n++;
+ }
+ if (n == 0) {
+ /* %s has no named members */
+ warning(65,
+ t == STRUCT ? "structure" : "union");
+ }
+ }
+ } else {
+ tp->t_enum->elem = fmem;
+ }
+ return (tp);
+}
+
+/*
+ * Processes the name of an enumerator in en enum declaration.
+ *
+ * sym points to the enumerator
+ * val is the value of the enumerator
+ * impl is 1 if the value of the enumerator was not explicit specified.
+ */
+sym_t *
+ename(sym_t *sym, int val, int impl)
+{
+
+ if (sym->s_scl) {
+ if (sym->s_blklev == blklev) {
+ /* no hflag, because this is illegal!!! */
+ if (sym->s_arg) {
+ /* enumeration constant hides parameter: %s */
+ warning(57, sym->s_name);
+ } else {
+ /* redeclaration of %s */
+ error(27, sym->s_name);
+ /*
+ * inside blocks it should not too complicated
+ * to find the position of the previous
+ * declaration
+ */
+ if (blklev == 0)
+ prevdecl(-1, sym);
+ }
+ } else {
+ if (hflag)
+ /* redefinition hides earlier one: %s */
+ warning(43, sym->s_name);
+ }
+ sym = pushdown(sym);
+ }
+ sym->s_scl = ENUMCON;
+ sym->s_type = dcs->d_tagtyp;
+ sym->s_value.v_tspec = INT;
+ sym->s_value.v_quad = val;
+ if (impl && val - 1 == INT_MAX) {
+ /* overflow in enumeration values: %s */
+ warning(48, sym->s_name);
+ }
+ enumval = val + 1;
+ return (sym);
+}
+
+/*
+ * Process a single external declarator.
+ */
+void
+decl1ext(sym_t *dsym, int initflg)
+{
+ int warn, rval, redec;
+ sym_t *rdsym;
+
+ chkfdef(dsym, 1);
+
+ chktyp(dsym);
+
+ if (initflg && !(initerr = chkinit(dsym)))
+ dsym->s_def = DEF;
+
+ /*
+ * Declarations of functions are marked as "tentative" in dname().
+ * This is wrong because there are no tentative function
+ * definitions.
+ */
+ if (dsym->s_type->t_tspec == FUNC && dsym->s_def == TDEF)
+ dsym->s_def = DECL;
+
+ if (dcs->d_inline) {
+ if (dsym->s_type->t_tspec == FUNC) {
+ dsym->s_inline = 1;
+ } else {
+ /* variable declared inline: %s */
+ warning(268, dsym->s_name);
+ }
+ }
+
+ /* Write the declaration into the output file */
+ if (plibflg && llibflg &&
+ dsym->s_type->t_tspec == FUNC && dsym->s_type->t_proto) {
+ /*
+ * With both LINTLIBRARY and PROTOLIB the prototype is
+ * written as a function definition to the output file.
+ */
+ rval = dsym->s_type->t_subt->t_tspec != VOID;
+ outfdef(dsym, &dsym->s_dpos, rval, 0, NULL);
+ } else {
+ outsym(dsym, dsym->s_scl, dsym->s_def);
+ }
+
+ if ((rdsym = dcs->d_rdcsym) != NULL) {
+
+ /*
+ * If the old symbol stems from an old style function definition
+ * we have remembered the params in rdsmy->s_args and compare
+ * them with the params of the prototype.
+ */
+ if (rdsym->s_osdef && dsym->s_type->t_proto) {
+ redec = chkosdef(rdsym, dsym);
+ } else {
+ redec = 0;
+ }
+
+ if (!redec && !isredec(dsym, (warn = 0, &warn))) {
+
+ if (warn) {
+ /* redeclaration of %s */
+ (*(sflag ? error : warning))(27, dsym->s_name);
+ prevdecl(-1, rdsym);
+ }
+
+ /*
+ * Overtake the remembered params if the new symbol
+ * is not a prototype.
+ */
+ if (rdsym->s_osdef && !dsym->s_type->t_proto) {
+ dsym->s_osdef = rdsym->s_osdef;
+ dsym->s_args = rdsym->s_args;
+ STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+ }
+
+ /*
+ * Remember the position of the declaration if the
+ * old symbol was a prototype and the new is not.
+ * Also remember the position if the old symbol
+ * was defined and the new is not.
+ */
+ if (rdsym->s_type->t_proto && !dsym->s_type->t_proto) {
+ STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+ } else if (rdsym->s_def == DEF && dsym->s_def != DEF) {
+ STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+ }
+
+ /*
+ * Copy informations about usage of the name into
+ * the new symbol.
+ */
+ cpuinfo(dsym, rdsym);
+
+ /* Once a name is defined, it remains defined. */
+ if (rdsym->s_def == DEF)
+ dsym->s_def = DEF;
+
+ /* once a function is inline, it remains inline */
+ if (rdsym->s_inline)
+ dsym->s_inline = 1;
+
+ compltyp(dsym, rdsym);
+
+ }
+
+ rmsym(rdsym);
+ }
+
+ if (dsym->s_scl == TYPEDEF) {
+ dsym->s_type = duptyp(dsym->s_type);
+ dsym->s_type->t_typedef = 1;
+ settdsym(dsym->s_type, dsym);
+ }
+
+}
+
+/*
+ * Copies informations about usage into a new symbol table entry of
+ * the same symbol.
+ */
+void
+cpuinfo(sym_t *sym, sym_t *rdsym)
+{
+
+ sym->s_spos = rdsym->s_spos;
+ sym->s_upos = rdsym->s_upos;
+ sym->s_set = rdsym->s_set;
+ sym->s_used = rdsym->s_used;
+}
+
+/*
+ * Prints an error and returns 1 if a symbol is redeclared/redefined.
+ * Otherwise returns 0 and, in some cases of minor problems, prints
+ * a warning.
+ */
+int
+isredec(sym_t *dsym, int *warn)
+{
+ sym_t *rsym;
+
+ if ((rsym = dcs->d_rdcsym)->s_scl == ENUMCON) {
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ prevdecl(-1, rsym);
+ return (1);
+ }
+ if (rsym->s_scl == TYPEDEF) {
+ /* typedef redeclared: %s */
+ error(89, dsym->s_name);
+ prevdecl(-1, rsym);
+ return (1);
+ }
+ if (dsym->s_scl == TYPEDEF) {
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ prevdecl(-1, rsym);
+ return (1);
+ }
+ if (rsym->s_def == DEF && dsym->s_def == DEF) {
+ /* redefinition of %s */
+ error(28, dsym->s_name);
+ prevdecl(-1, rsym);
+ return(1);
+ }
+ if (!eqtype(rsym->s_type, dsym->s_type, 0, 0, warn)) {
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ prevdecl(-1, rsym);
+ return(1);
+ }
+ if (rsym->s_scl == EXTERN && dsym->s_scl == EXTERN)
+ return(0);
+ if (rsym->s_scl == STATIC && dsym->s_scl == STATIC)
+ return(0);
+ if (rsym->s_scl == STATIC && dsym->s_def == DECL)
+ return(0);
+ if (rsym->s_scl == EXTERN && rsym->s_def == DEF) {
+ /*
+ * All cases except "int a = 1; static int a;" are caught
+ * above with or without a warning
+ */
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ prevdecl(-1, rsym);
+ return(1);
+ }
+ if (rsym->s_scl == EXTERN) {
+ /* previously declared extern, becomes static: %s */
+ warning(29, dsym->s_name);
+ prevdecl(-1, rsym);
+ return(0);
+ }
+ /*
+ * Now its on of:
+ * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;"
+ */
+ /* redeclaration of %s; ANSI C requires "static" */
+ if (sflag) {
+ warning(30, dsym->s_name);
+ prevdecl(-1, rsym);
+ }
+ dsym->s_scl = STATIC;
+ return (0);
+}
+
+/*
+ * Checks if two types are compatible. Returns 0 if not, otherwise 1.
+ *
+ * ignqual ignore qualifiers of type; used for function params
+ * promot promote left type; used for comparison of params of
+ * old style function definitions with params of prototypes.
+ * *warn set to 1 if an old style function declaration is not
+ * compatible with a prototype
+ */
+int
+eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int *warn)
+{
+ tspec_t t;
+
+ while (tp1 != NULL && tp2 != NULL) {
+
+ t = tp1->t_tspec;
+ if (promot) {
+ if (t == FLOAT) {
+ t = DOUBLE;
+ } else if (t == CHAR || t == SCHAR) {
+ t = INT;
+ } else if (t == UCHAR) {
+ t = tflag ? UINT : INT;
+ } else if (t == SHORT) {
+ t = INT;
+ } else if (t == USHORT) {
+ /* CONSTCOND */
+ t = INT_MAX < USHRT_MAX || tflag ? UINT : INT;
+ }
+ }
+
+ if (t != tp2->t_tspec)
+ return (0);
+
+ if (tp1->t_const != tp2->t_const && !ignqual && !tflag)
+ return (0);
+
+ if (tp1->t_volatile != tp2->t_volatile && !ignqual && !tflag)
+ return (0);
+
+ if (t == STRUCT || t == UNION)
+ return (tp1->t_str == tp2->t_str);
+
+ if (t == ARRAY && tp1->t_dim != tp2->t_dim) {
+ if (tp1->t_dim != 0 && tp2->t_dim != 0)
+ return (0);
+ }
+
+ /* dont check prototypes for traditional */
+ if (t == FUNC && !tflag) {
+ if (tp1->t_proto && tp2->t_proto) {
+ if (!eqargs(tp1, tp2, warn))
+ return (0);
+ } else if (tp1->t_proto) {
+ if (!mnoarg(tp1, warn))
+ return (0);
+ } else if (tp2->t_proto) {
+ if (!mnoarg(tp2, warn))
+ return (0);
+ }
+ }
+
+ tp1 = tp1->t_subt;
+ tp2 = tp2->t_subt;
+ ignqual = promot = 0;
+
+ }
+
+ return (tp1 == tp2);
+}
+
+/*
+ * Compares the parameter types of two prototypes.
+ */
+static int
+eqargs(type_t *tp1, type_t *tp2, int *warn)
+{
+ sym_t *a1, *a2;
+
+ if (tp1->t_vararg != tp2->t_vararg)
+ return (0);
+
+ a1 = tp1->t_args;
+ a2 = tp2->t_args;
+
+ while (a1 != NULL && a2 != NULL) {
+
+ if (eqtype(a1->s_type, a2->s_type, 1, 0, warn) == 0)
+ return (0);
+
+ a1 = a1->s_nxt;
+ a2 = a2->s_nxt;
+
+ }
+
+ return (a1 == a2);
+}
+
+/*
+ * mnoarg() (matches functions with no argument type information)
+ * returns 1 if all parameters of a prototype are compatible with
+ * and old style function declaration.
+ * This is the case if following conditions are met:
+ * 1. the prototype must have a fixed number of parameters
+ * 2. no parameter is of type float
+ * 3. no parameter is converted to another type if integer promotion
+ * is applied on it
+ */
+static int
+mnoarg(type_t *tp, int *warn)
+{
+ sym_t *arg;
+ tspec_t t;
+
+ if (tp->t_vararg) {
+ if (warn != NULL)
+ *warn = 1;
+ }
+ for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt) {
+ if ((t = arg->s_type->t_tspec) == FLOAT ||
+ t == CHAR || t == SCHAR || t == UCHAR ||
+ t == SHORT || t == USHORT) {
+ if (warn != NULL)
+ *warn = 1;
+ }
+ }
+ return (1);
+}
+
+/*
+ * Compares a prototype declaration with the remembered arguments of
+ * a previous old style function definition.
+ */
+static int
+chkosdef(sym_t *rdsym, sym_t *dsym)
+{
+ sym_t *args, *pargs, *arg, *parg;
+ int narg, nparg, n;
+ int warn, msg;
+
+ args = rdsym->s_args;
+ pargs = dsym->s_type->t_args;
+
+ msg = 0;
+
+ narg = nparg = 0;
+ for (arg = args; arg != NULL; arg = arg->s_nxt)
+ narg++;
+ for (parg = pargs; parg != NULL; parg = parg->s_nxt)
+ nparg++;
+ if (narg != nparg) {
+ /* prototype does not match old-style definition */
+ error(63);
+ msg = 1;
+ goto end;
+ }
+
+ arg = args;
+ parg = pargs;
+ n = 1;
+ while (narg--) {
+ warn = 0;
+ /*
+ * If it does not match due to promotion and sflag is
+ * not set we print only a warning.
+ */
+ if (!eqtype(arg->s_type, parg->s_type, 1, 1, &warn) || warn) {
+ /* prototype does not match old-style def., arg #%d */
+ error(299, n);
+ msg = 1;
+ }
+ arg = arg->s_nxt;
+ parg = parg->s_nxt;
+ n++;
+ }
+
+ end:
+ if (msg)
+ /* old style definition */
+ prevdecl(300, rdsym);
+
+ return (msg);
+}
+
+/*
+ * Completes a type by copying the dimension and prototype information
+ * from a second compatible type.
+ *
+ * Following lines are legal:
+ * "typedef a[]; a b; a b[10]; a c; a c[20];"
+ * "typedef ft(); ft f; f(int); ft g; g(long);"
+ * This means that, if a type is completed, the type structure must
+ * be duplicated.
+ */
+void
+compltyp(sym_t *dsym, sym_t *ssym)
+{
+ type_t **dstp, *src;
+ type_t *dst;
+
+ dstp = &dsym->s_type;
+ src = ssym->s_type;
+
+ while ((dst = *dstp) != NULL) {
+ if (src == NULL || dst->t_tspec != src->t_tspec)
+ LERROR("compltyp()");
+ if (dst->t_tspec == ARRAY) {
+ if (dst->t_dim == 0 && src->t_dim != 0) {
+ *dstp = dst = duptyp(dst);
+ dst->t_dim = src->t_dim;
+ /* now a complete type */
+ setcompl(dst, 0);
+ }
+ } else if (dst->t_tspec == FUNC) {
+ if (!dst->t_proto && src->t_proto) {
+ *dstp = dst = duptyp(dst);
+ dst->t_proto = 1;
+ dst->t_args = src->t_args;
+ }
+ }
+ dstp = &dst->t_subt;
+ src = src->t_subt;
+ }
+}
+
+/*
+ * Completes the declaration of a single argument.
+ */
+sym_t *
+decl1arg(sym_t *sym, int initflg)
+{
+ tspec_t t;
+
+ chkfdef(sym, 1);
+
+ chktyp(sym);
+
+ if (dcs->d_rdcsym != NULL && dcs->d_rdcsym->s_blklev == blklev) {
+ /* redeclaration of formal parameter %s */
+ error(237, sym->s_name);
+ rmsym(dcs->d_rdcsym);
+ sym->s_arg = 1;
+ }
+
+ if (!sym->s_arg) {
+ /* declared argument %s is missing */
+ error(53, sym->s_name);
+ sym->s_arg = 1;
+ }
+
+ if (initflg) {
+ /* cannot initialize parameter: %s */
+ error(52, sym->s_name);
+ initerr = 1;
+ }
+
+ if ((t = sym->s_type->t_tspec) == ARRAY) {
+ sym->s_type = incref(sym->s_type->t_subt, PTR);
+ } else if (t == FUNC) {
+ if (tflag)
+ /* a function is declared as an argument: %s */
+ warning(50, sym->s_name);
+ sym->s_type = incref(sym->s_type, PTR);
+ } else if (t == FLOAT) {
+ if (tflag)
+ sym->s_type = gettyp(DOUBLE);
+ }
+
+ if (dcs->d_inline)
+ /* argument declared inline: %s */
+ warning(269, sym->s_name);
+
+ /*
+ * Arguments must have complete types. lengths() prints the needed
+ * error messages (null dimension is impossible because arrays are
+ * converted to pointers).
+ */
+ if (sym->s_type->t_tspec != VOID)
+ (void)length(sym->s_type, sym->s_name);
+
+ setsflg(sym);
+
+ return (sym);
+}
+
+/*
+ * Does some checks for lint directives which apply to functions.
+ * Processes arguments in old style function definitions which default
+ * to int.
+ * Checks compatibility of old style function definition with previous
+ * prototype.
+ */
+void
+cluparg(void)
+{
+ sym_t *args, *arg, *pargs, *parg;
+ int narg, nparg, n, msg;
+ tspec_t t;
+
+ args = funcsym->s_args;
+ pargs = funcsym->s_type->t_args;
+
+ /* check for illegal combinations of lint directives */
+ if (prflstrg != -1 && scflstrg != -1) {
+ /* can't be used together: ** PRINTFLIKE ** ** SCANFLIKE ** */
+ warning(289);
+ prflstrg = scflstrg = -1;
+ }
+ if (nvararg != -1 && (prflstrg != -1 || scflstrg != -1)) {
+ /* dubious use of ** VARARGS ** with ** %s ** */
+ warning(288, prflstrg != -1 ? "PRINTFLIKE" : "SCANFLIKE");
+ nvararg = -1;
+ }
+
+ /*
+ * check if the argument of a lint directive is compatible with the
+ * number of arguments.
+ */
+ narg = 0;
+ for (arg = dcs->d_fargs; arg != NULL; arg = arg->s_nxt)
+ narg++;
+ if (nargusg > narg) {
+ /* argument number mismatch with directive: ** %s ** */
+ warning(283, "ARGSUSED");
+ nargusg = 0;
+ }
+ if (nvararg > narg) {
+ /* argument number mismatch with directive: ** %s ** */
+ warning(283, "VARARGS");
+ nvararg = 0;
+ }
+ if (prflstrg > narg) {
+ /* argument number mismatch with directive: ** %s ** */
+ warning(283, "PRINTFLIKE");
+ prflstrg = -1;
+ } else if (prflstrg == 0) {
+ prflstrg = -1;
+ }
+ if (scflstrg > narg) {
+ /* argument number mismatch with directive: ** %s ** */
+ warning(283, "SCANFLIKE");
+ scflstrg = -1;
+ } else if (scflstrg == 0) {
+ scflstrg = -1;
+ }
+ if (prflstrg != -1 || scflstrg != -1) {
+ narg = prflstrg != -1 ? prflstrg : scflstrg;
+ arg = dcs->d_fargs;
+ for (n = 1; n < narg; n++)
+ arg = arg->s_nxt;
+ if (arg->s_type->t_tspec != PTR ||
+ ((t = arg->s_type->t_subt->t_tspec) != CHAR &&
+ t != UCHAR && t != SCHAR)) {
+ /* arg. %d must be 'char *' for PRINTFLIKE/SCANFLIKE */
+ warning(293, narg);
+ prflstrg = scflstrg = -1;
+ }
+ }
+
+ /*
+ * print a warning for each argument of an old style function
+ * definition which defaults to int
+ */
+ for (arg = args; arg != NULL; arg = arg->s_nxt) {
+ if (arg->s_defarg) {
+ /* argument type defaults to int: %s */
+ warning(32, arg->s_name);
+ arg->s_defarg = 0;
+ setsflg(arg);
+ }
+ }
+
+ /*
+ * If this is an old style function definition and a prototyp
+ * exists, compare the types of arguments.
+ */
+ if (funcsym->s_osdef && funcsym->s_type->t_proto) {
+ /*
+ * If the number of arguments does not macht, we need not
+ * continue.
+ */
+ narg = nparg = 0;
+ msg = 0;
+ for (parg = pargs; parg != NULL; parg = parg->s_nxt)
+ nparg++;
+ for (arg = args; arg != NULL; arg = arg->s_nxt)
+ narg++;
+ if (narg != nparg) {
+ /* parameter mismatch: %d declared, %d defined */
+ error(51, nparg, narg);
+ msg = 1;
+ } else {
+ parg = pargs;
+ arg = args;
+ while (narg--) {
+ msg |= chkptdecl(arg, parg);
+ parg = parg->s_nxt;
+ arg = arg->s_nxt;
+ }
+ }
+ if (msg)
+ /* prototype declaration */
+ prevdecl(285, dcs->d_rdcsym);
+
+ /* from now the prototype is valid */
+ funcsym->s_osdef = 0;
+ funcsym->s_args = NULL;
+
+ }
+
+}
+
+/*
+ * Checks compatibility of an old style function definition with a previous
+ * prototype declaration.
+ * Returns 1 if the position of the previous declaration should be reported.
+ */
+static int
+chkptdecl(sym_t *arg, sym_t *parg)
+{
+ type_t *tp, *ptp;
+ int warn, msg;
+
+ tp = arg->s_type;
+ ptp = parg->s_type;
+
+ msg = 0;
+ warn = 0;
+
+ if (!eqtype(tp, ptp, 1, 1, &warn)) {
+ if (eqtype(tp, ptp, 1, 0, &warn)) {
+ /* type does not match prototype: %s */
+ msg = gnuism(58, arg->s_name);
+ } else {
+ /* type does not match prototype: %s */
+ error(58, arg->s_name);
+ msg = 1;
+ }
+ } else if (warn) {
+ /* type does not match prototype: %s */
+ (*(sflag ? error : warning))(58, arg->s_name);
+ msg = 1;
+ }
+
+ return (msg);
+}
+
+/*
+ * Completes a single local declaration/definition.
+ */
+void
+decl1loc(sym_t *dsym, int initflg)
+{
+
+ /* Correct a mistake done in dname(). */
+ if (dsym->s_type->t_tspec == FUNC) {
+ dsym->s_def = DECL;
+ if (dcs->d_scl == NOSCL)
+ dsym->s_scl = EXTERN;
+ }
+
+ if (dsym->s_type->t_tspec == FUNC) {
+ if (dsym->s_scl == STATIC) {
+ /* dubious static function at block level: %s */
+ warning(93, dsym->s_name);
+ dsym->s_scl = EXTERN;
+ } else if (dsym->s_scl != EXTERN && dsym->s_scl != TYPEDEF) {
+ /* function has illegal storage class: %s */
+ error(94, dsym->s_name);
+ dsym->s_scl = EXTERN;
+ }
+ }
+
+ /*
+ * functions may be declared inline at local scope, although
+ * this has no effect for a later definition of the same
+ * function.
+ * XXX it should have an effect if tflag is set. this would
+ * also be the way gcc behaves.
+ */
+ if (dcs->d_inline) {
+ if (dsym->s_type->t_tspec == FUNC) {
+ dsym->s_inline = 1;
+ } else {
+ /* variable declared inline: %s */
+ warning(268, dsym->s_name);
+ }
+ }
+
+ chkfdef(dsym, 1);
+
+ chktyp(dsym);
+
+ if (dcs->d_rdcsym != NULL && dsym->s_scl == EXTERN)
+ ledecl(dsym);
+
+ if (dsym->s_scl == EXTERN) {
+ /*
+ * XXX wenn die statische Variable auf Ebene 0 erst
+ * spaeter definiert wird, haben wir die Brille auf.
+ */
+ if (dsym->s_xsym == NULL) {
+ outsym(dsym, EXTERN, dsym->s_def);
+ } else {
+ outsym(dsym, dsym->s_xsym->s_scl, dsym->s_def);
+ }
+ }
+
+ if (dcs->d_rdcsym != NULL) {
+
+ if (dcs->d_rdcsym->s_blklev == 0) {
+
+ switch (dsym->s_scl) {
+ case AUTO:
+ /* automatic hides external declaration: %s */
+ if (hflag)
+ warning(86, dsym->s_name);
+ break;
+ case STATIC:
+ /* static hides external declaration: %s */
+ if (hflag)
+ warning(87, dsym->s_name);
+ break;
+ case TYPEDEF:
+ /* typedef hides external declaration: %s */
+ if (hflag)
+ warning(88, dsym->s_name);
+ break;
+ case EXTERN:
+ /*
+ * Warnings and errors are printed in ledecl()
+ */
+ break;
+ default:
+ LERROR("decl1loc()");
+ }
+
+ } else if (dcs->d_rdcsym->s_blklev == blklev) {
+
+ /* no hflag, because its illegal! */
+ if (dcs->d_rdcsym->s_arg) {
+ /*
+ * if !tflag, a "redeclaration of %s" error
+ * is produced below
+ */
+ if (tflag) {
+ if (hflag)
+ /* decl. hides parameter: %s */
+ warning(91, dsym->s_name);
+ rmsym(dcs->d_rdcsym);
+ }
+ }
+
+ } else if (dcs->d_rdcsym->s_blklev < blklev) {
+
+ if (hflag)
+ /* declaration hides earlier one: %s */
+ warning(95, dsym->s_name);
+
+ }
+
+ if (dcs->d_rdcsym->s_blklev == blklev) {
+
+ /* redeclaration of %s */
+ error(27, dsym->s_name);
+ rmsym(dcs->d_rdcsym);
+
+ }
+
+ }
+
+ if (initflg && !(initerr = chkinit(dsym))) {
+ dsym->s_def = DEF;
+ setsflg(dsym);
+ }
+
+ if (dsym->s_scl == TYPEDEF) {
+ dsym->s_type = duptyp(dsym->s_type);
+ dsym->s_type->t_typedef = 1;
+ settdsym(dsym->s_type, dsym);
+ }
+
+ /*
+ * Before we can check the size we must wait for an initialisation
+ * which may follow.
+ */
+}
+
+/*
+ * Processes (re)declarations of external Symbols inside blocks.
+ */
+static void
+ledecl(sym_t *dsym)
+{
+ int eqt, warn;
+ sym_t *esym;
+
+ /* look for a symbol with the same name */
+ esym = dcs->d_rdcsym;
+ while (esym != NULL && esym->s_blklev != 0) {
+ while ((esym = esym->s_link) != NULL) {
+ if (esym->s_kind != FVFT)
+ continue;
+ if (strcmp(dsym->s_name, esym->s_name) == 0)
+ break;
+ }
+ }
+ if (esym == NULL)
+ return;
+ if (esym->s_scl != EXTERN && esym->s_scl != STATIC) {
+ /* gcc accepts this without a warning, pcc prints an error. */
+ /* redeclaration of %s */
+ warning(27, dsym->s_name);
+ prevdecl(-1, esym);
+ return;
+ }
+
+ warn = 0;
+ eqt = eqtype(esym->s_type, dsym->s_type, 0, 0, &warn);
+
+ if (!eqt || warn) {
+ if (esym->s_scl == EXTERN) {
+ /* inconsistent redeclaration of extern: %s */
+ warning(90, dsym->s_name);
+ prevdecl(-1, esym);
+ } else {
+ /* inconsistent redeclaration of static: %s */
+ warning(92, dsym->s_name);
+ prevdecl(-1, esym);
+ }
+ }
+
+ if (eqt) {
+ /*
+ * Remember the external symbol so we can update usage
+ * information at the end of the block.
+ */
+ dsym->s_xsym = esym;
+ }
+}
+
+/*
+ * Print an error or a warning if the symbol can't be initialized due
+ * to type/storage class. Return value is 1 if an error has been
+ * detected.
+ */
+static int
+chkinit(sym_t *sym)
+{
+ int err;
+
+ err = 0;
+
+ if (sym->s_type->t_tspec == FUNC) {
+ /* cannot initialize function: %s */
+ error(24, sym->s_name);
+ err = 1;
+ } else if (sym->s_scl == TYPEDEF) {
+ /* cannot initialize typedef: %s */
+ error(25, sym->s_name);
+ err = 1;
+ } else if (sym->s_scl == EXTERN && sym->s_def == DECL) {
+ /* cannot initialize "extern" declaration: %s */
+ if (dcs->d_ctx == EXTERN) {
+ warning(26, sym->s_name);
+ } else {
+ error(26, sym->s_name);
+ err = 1;
+ }
+ }
+
+ return (err);
+}
+
+/*
+ * Create a symbol for an abstract declaration.
+ */
+sym_t *
+aname(void)
+{
+ sym_t *sym;
+
+ if (dcs->d_ctx != ABSTRACT && dcs->d_ctx != PARG)
+ LERROR("aname()");
+
+ sym = getblk(sizeof (sym_t));
+
+ sym->s_name = unnamed;
+ sym->s_def = DEF;
+ sym->s_scl = ABSTRACT;
+ sym->s_blklev = -1;
+
+ if (dcs->d_ctx == PARG)
+ sym->s_arg = 1;
+
+ sym->s_type = dcs->d_type;
+ dcs->d_rdcsym = NULL;
+ dcs->d_vararg = 0;
+
+ return (sym);
+}
+
+/*
+ * Removes anything which has nothing to do on global level.
+ */
+void
+globclup(void)
+{
+
+ while (dcs->d_nxt != NULL)
+ popdecl();
+
+ cleanup();
+ blklev = 0;
+ mblklev = 0;
+
+ /*
+ * remove all information about pending lint directives without
+ * warnings.
+ */
+ glclup(1);
+}
+
+/*
+ * Process an abstract type declaration
+ */
+sym_t *
+decl1abs(sym_t *sym)
+{
+
+ chkfdef(sym, 1);
+ chktyp(sym);
+ return (sym);
+}
+
+/*
+ * Checks size after declarations of variables and their initialisation.
+ */
+void
+chksz(sym_t *dsym)
+{
+
+ /*
+ * check size only for symbols which are defined and no function and
+ * not typedef name
+ */
+ if (dsym->s_def != DEF)
+ return;
+ if (dsym->s_scl == TYPEDEF)
+ return;
+ if (dsym->s_type->t_tspec == FUNC)
+ return;
+
+ if (length(dsym->s_type, dsym->s_name) == 0 &&
+ dsym->s_type->t_tspec == ARRAY && dsym->s_type->t_dim == 0) {
+ /* empty array declaration: %s */
+ if (tflag) {
+ warning(190, dsym->s_name);
+ } else {
+ error(190, dsym->s_name);
+ }
+ }
+}
+
+/*
+ * Mark an object as set if it is not already
+ */
+void
+setsflg(sym_t *sym)
+{
+
+ if (!sym->s_set) {
+ sym->s_set = 1;
+ UNIQUE_CURR_POS(sym->s_spos);
+ }
+}
+
+/*
+ * Mark an object as used if it is not already
+ */
+void
+setuflg(sym_t *sym, int fcall, int szof)
+{
+
+ if (!sym->s_used) {
+ sym->s_used = 1;
+ UNIQUE_CURR_POS(sym->s_upos);
+ }
+ /*
+ * for function calls another record is written
+ *
+ * XXX Should symbols used in sizeof() treated as used or not?
+ * Probably not, because there is no sense to declare an
+ * external variable only to get their size.
+ */
+ if (!fcall && !szof && sym->s_kind == FVFT && sym->s_scl == EXTERN)
+ outusg(sym);
+}
+
+/*
+ * Prints warnings for a list of variables and labels (concatenated
+ * with s_dlnxt) if these are not used or only set.
+ */
+void
+chkusage(dinfo_t *di)
+{
+ sym_t *sym;
+ int mknowarn;
+
+ /* for this warnings LINTED has no effect */
+ mknowarn = nowarn;
+ nowarn = 0;
+
+ for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_dlnxt)
+ chkusg1(di->d_asm, sym);
+
+ nowarn = mknowarn;
+}
+
+/*
+ * Prints a warning for a single variable or label if it is not used or
+ * only set.
+ */
+void
+chkusg1(int novar, sym_t *sym)
+{
+ pos_t cpos;
+
+ if (sym->s_blklev == -1)
+ return;
+
+ STRUCT_ASSIGN(cpos, curr_pos);
+
+ if (sym->s_kind == FVFT) {
+ if (sym->s_arg) {
+ chkausg(novar, sym);
+ } else {
+ chkvusg(novar, sym);
+ }
+ } else if (sym->s_kind == FLAB) {
+ chklusg(sym);
+ } else if (sym->s_kind == FTAG) {
+ chktusg(sym);
+ }
+
+ STRUCT_ASSIGN(curr_pos, cpos);
+}
+
+static void
+chkausg(int novar, sym_t *arg)
+{
+
+ if (!arg->s_set)
+ LERROR("chkausg()");
+
+ if (novar)
+ return;
+
+ if (!arg->s_used && vflag) {
+ STRUCT_ASSIGN(curr_pos, arg->s_dpos);
+ /* argument %s unused in function %s */
+ warning(231, arg->s_name, funcsym->s_name);
+ }
+}
+
+static void
+chkvusg(int novar, sym_t *sym)
+{
+ scl_t sc;
+ sym_t *xsym;
+
+ if (blklev == 0 || sym->s_blklev == 0)
+ LERROR("chkvusg()");
+
+ /* errors in expressions easily cause lots of these warnings */
+ if (nerr != 0)
+ return;
+
+ /*
+ * XXX Only variables are checkd, although types should
+ * probably also be checked
+ */
+ if ((sc = sym->s_scl) != EXTERN && sc != STATIC &&
+ sc != AUTO && sc != REG) {
+ return;
+ }
+
+ if (novar)
+ return;
+
+ if (sc == EXTERN) {
+ if (!sym->s_used && !sym->s_set) {
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ /* %s unused in function %s */
+ warning(192, sym->s_name, funcsym->s_name);
+ }
+ } else {
+ if (sym->s_set && !sym->s_used) {
+ STRUCT_ASSIGN(curr_pos, sym->s_spos);
+ /* %s set but not used in function %s */
+ warning(191, sym->s_name, funcsym->s_name);
+ } else if (!sym->s_used) {
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ /* %s unused in function %s */
+ warning(192, sym->s_name, funcsym->s_name);
+ }
+ }
+
+ if (sc == EXTERN) {
+ /*
+ * information about usage is taken over into the symbol
+ * tabel entry at level 0 if the symbol was locally declared
+ * as an external symbol.
+ *
+ * XXX This is wrong for symbols declared static at level 0
+ * if the usage information stems from sizeof(). This is
+ * because symbols at level 0 only used in sizeof() are
+ * considered to not be used.
+ */
+ if ((xsym = sym->s_xsym) != NULL) {
+ if (sym->s_used && !xsym->s_used) {
+ xsym->s_used = 1;
+ STRUCT_ASSIGN(xsym->s_upos, sym->s_upos);
+ }
+ if (sym->s_set && !xsym->s_set) {
+ xsym->s_set = 1;
+ STRUCT_ASSIGN(xsym->s_spos, sym->s_spos);
+ }
+ }
+ }
+}
+
+static void
+chklusg(sym_t *lab)
+{
+
+ if (blklev != 1 || lab->s_blklev != 1)
+ LERROR("chklusg()");
+
+ if (lab->s_set && !lab->s_used) {
+ STRUCT_ASSIGN(curr_pos, lab->s_spos);
+ /* label %s unused in function %s */
+ warning(192, lab->s_name, funcsym->s_name);
+ } else if (!lab->s_set) {
+ STRUCT_ASSIGN(curr_pos, lab->s_upos);
+ /* undefined label %s */
+ warning(23, lab->s_name);
+ }
+}
+
+static void
+chktusg(sym_t *sym)
+{
+
+ if (!incompl(sym->s_type))
+ return;
+
+ /* complain always about incomplete tags declared inside blocks */
+ if (!zflag || dcs->d_ctx != EXTERN)
+ return;
+
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ switch (sym->s_type->t_tspec) {
+ case STRUCT:
+ /* struct %s never defined */
+ warning(233, sym->s_name);
+ break;
+ case UNION:
+ /* union %s never defined */
+ warning(234, sym->s_name);
+ break;
+ case ENUM:
+ /* enum %s never defined */
+ warning(235, sym->s_name);
+ break;
+ default:
+ LERROR("chktusg()");
+ }
+}
+
+/*
+ * Called after the entire translation unit has been parsed.
+ * Changes tentative definitions in definitions.
+ * Performs some tests on global Symbols. Detected Problems are:
+ * - defined variables of incomplete type
+ * - constant variables which are not initialized
+ * - static symbols which are never used
+ */
+void
+chkglsyms(void)
+{
+ sym_t *sym;
+ pos_t cpos;
+
+ if (blklev != 0 || dcs->d_nxt != NULL)
+ norecover();
+
+ STRUCT_ASSIGN(cpos, curr_pos);
+
+ for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+ if (sym->s_blklev == -1)
+ continue;
+ if (sym->s_kind == FVFT) {
+ chkglvar(sym);
+ } else if (sym->s_kind == FTAG) {
+ chktusg(sym);
+ } else {
+ if (sym->s_kind != FMOS)
+ LERROR("chkglsyms()");
+ }
+ }
+
+ STRUCT_ASSIGN(curr_pos, cpos);
+}
+
+static void
+chkglvar(sym_t *sym)
+{
+
+ if (sym->s_scl == TYPEDEF || sym->s_scl == ENUMCON)
+ return;
+
+ if (sym->s_scl != EXTERN && sym->s_scl != STATIC)
+ LERROR("chkglvar()");
+
+ glchksz(sym);
+
+ if (sym->s_scl == STATIC) {
+ if (sym->s_type->t_tspec == FUNC) {
+ if (sym->s_used && sym->s_def != DEF) {
+ STRUCT_ASSIGN(curr_pos, sym->s_upos);
+ /* static func. called but not def.. */
+ error(225, sym->s_name);
+ }
+ }
+ if (!sym->s_used) {
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ if (sym->s_type->t_tspec == FUNC) {
+ if (sym->s_def == DEF) {
+ if (!sym->s_inline)
+ /* static function %s unused */
+ warning(236, sym->s_name);
+ } else {
+ /* static function %s decl. but ... */
+ warning(290, sym->s_name);
+ }
+ } else if (!sym->s_set) {
+ /* static variable %s unused */
+ warning(226, sym->s_name);
+ } else {
+ /* static variable %s set but not used */
+ warning(307, sym->s_name);
+ }
+ }
+ if (!tflag && sym->s_def == TDEF && sym->s_type->t_const) {
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ /* const object %s should have initializer */
+ warning(227, sym->s_name);
+ }
+ }
+}
+
+static void
+glchksz(sym_t *sym)
+{
+
+ if (sym->s_def == TDEF) {
+ if (sym->s_type->t_tspec == FUNC)
+ /*
+ * this can happen if a syntax error occurred
+ * after a function declaration
+ */
+ return;
+ STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+ if (length(sym->s_type, sym->s_name) == 0 &&
+ sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
+ /* empty array declaration: %s */
+ if (tflag || (sym->s_scl == EXTERN && !sflag)) {
+ warning(190, sym->s_name);
+ } else {
+ error(190, sym->s_name);
+ }
+ }
+ }
+}
+
+/*
+ * Prints information about location of previous definition/declaration.
+ */
+void
+prevdecl(int msg, sym_t *psym)
+{
+ pos_t cpos;
+
+ if (!rflag)
+ return;
+
+ STRUCT_ASSIGN(cpos, curr_pos);
+ STRUCT_ASSIGN(curr_pos, psym->s_dpos);
+ if (msg != -1) {
+ message(msg, psym->s_name);
+ } else if (psym->s_def == DEF || psym->s_def == TDEF) {
+ /* previous definition of %s */
+ message(261, psym->s_name);
+ } else {
+ /* previous declaration of %s */
+ message(260, psym->s_name);
+ }
+ STRUCT_ASSIGN(curr_pos, cpos);
+}
diff --git a/usr.bin/xlint/lint1/emit.c b/usr.bin/xlint/lint1/emit.c
new file mode 100644
index 0000000..a770e5a
--- /dev/null
+++ b/usr.bin/xlint/lint1/emit.c
@@ -0,0 +1,243 @@
+/* $NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef lint
+static char rcsid[] = "$NetBSD: emit.c,v 1.2 1995/07/03 21:24:00 cgd Exp $";
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <err.h>
+
+#include "lint.h"
+
+/* name and handle of output file */
+static const char *loname;
+static FILE *lout;
+
+/* output buffer data */
+ob_t ob;
+
+static void outxbuf(void);
+
+
+/*
+ * initialize output
+ */
+void
+outopen(name)
+ const char *name;
+{
+ loname = name;
+
+ /* Ausgabedatei oeffnen */
+ if ((lout = fopen(name, "w")) == NULL)
+ err(1, "cannot open '%s'", name);
+
+ /* Ausgabepuffer anlegen */
+ ob.o_len = 1024;
+ ob.o_end = (ob.o_buf = ob.o_nxt = xmalloc(ob.o_len)) + ob.o_len;
+}
+
+/*
+ * flush output buffer and close file
+ */
+void
+outclose()
+{
+ outclr();
+ if (fclose(lout) == EOF)
+ err(1, "cannot close '%s'", loname);
+}
+
+/*
+ * resize output buffer
+ */
+static void
+outxbuf()
+{
+ ptrdiff_t coffs;
+
+ coffs = ob.o_nxt - ob.o_buf;
+ ob.o_len *= 2;
+ ob.o_end = (ob.o_buf = xrealloc(ob.o_buf, ob.o_len)) + ob.o_len;
+ ob.o_nxt = ob.o_buf + coffs;
+}
+
+/*
+ * reset output buffer
+ * if it is not empty, it is flushed
+ */
+void
+outclr()
+{
+ size_t sz;
+
+ if (ob.o_buf != ob.o_nxt) {
+ outchar('\n');
+ sz = ob.o_nxt - ob.o_buf;
+ if (sz > ob.o_len)
+ errx(1, "internal error: outclr() 1");
+ if (fwrite(ob.o_buf, sz, 1, lout) != 1)
+ err(1, "cannot write to %s", loname);
+ ob.o_nxt = ob.o_buf;
+ }
+}
+
+/*
+ * write a character to the output buffer
+ */
+void
+outchar(c)
+ int c;
+{
+ if (ob.o_nxt == ob.o_end)
+ outxbuf();
+ *ob.o_nxt++ = (char)c;
+}
+
+/*
+ * write a character to the output buffer, qouted if necessary
+ */
+void
+outqchar(c)
+ int c;
+{
+ if (isprint(c) && c != '\\' && c != '"' && c != '\'') {
+ outchar(c);
+ } else {
+ outchar('\\');
+ switch (c) {
+ case '\\':
+ outchar('\\');
+ break;
+ case '"':
+ outchar('"');
+ break;
+ case '\'':
+ outchar('\'');
+ break;
+ case '\b':
+ outchar('b');
+ break;
+ case '\t':
+ outchar('t');
+ break;
+ case '\n':
+ outchar('n');
+ break;
+ case '\f':
+ outchar('f');
+ break;
+ case '\r':
+ outchar('r');
+ break;
+#ifdef __STDC__
+ case '\v':
+#else
+ case '\013':
+#endif
+ outchar('v');
+ break;
+#ifdef __STDC__
+ case '\a':
+#else
+ case '\007':
+#endif
+ outchar('a');
+ break;
+ default:
+ outchar((((u_int)c >> 6) & 07) + '0');
+ outchar((((u_int)c >> 3) & 07) + '0');
+ outchar((c & 07) + '0');
+ break;
+ }
+ }
+}
+
+/*
+ * write a strint to the output buffer
+ * the string must not contain any characters which
+ * should be quoted
+ */
+void
+outstrg(s)
+ const char *s;
+{
+ while (*s != '\0') {
+ if (ob.o_nxt == ob.o_end)
+ outxbuf();
+ *ob.o_nxt++ = *s++;
+ }
+}
+
+/*
+ * write an integer value to toe output buffer
+ */
+void
+outint(i)
+ int i;
+{
+ if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int))
+ outxbuf();
+ ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
+}
+
+/*
+ * write the name of a symbol to the output buffer
+ * the name is preceded by its length
+ */
+void
+outname(name)
+ const char *name;
+{
+ if (name == NULL)
+ errx(1, "internal error: outname() 1");
+ outint((int)strlen(name));
+ outstrg(name);
+}
+
+/*
+ * write the name of the .c source
+ */
+void
+outsrc(name)
+ const char *name;
+{
+ outclr();
+ outchar('S');
+ outstrg(name);
+}
diff --git a/usr.bin/xlint/lint1/emit1.c b/usr.bin/xlint/lint1/emit1.c
new file mode 100644
index 0000000..4d198d6
--- /dev/null
+++ b/usr.bin/xlint/lint1/emit1.c
@@ -0,0 +1,601 @@
+/* $NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: emit1.c,v 1.14 2004/06/20 22:20:16 jmc Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+
+#include "lint1.h"
+
+static void outtt(sym_t *, sym_t *);
+static void outfstrg(strg_t *);
+
+/*
+ * Write type into the output buffer.
+ * The type is written as a sequence of substrings, each of which describes a
+ * node of type type_t
+ * a node is coded as follows:
+ * char C
+ * signed char s C
+ * unsigned char u C
+ * short S
+ * unsigned short u S
+ * int I
+ * unsigned int u I
+ * long L
+ * unsigned long u L
+ * long long Q
+ * unsigned long long u Q
+ * float s D
+ * double D
+ * long double l D
+ * void V
+ * * P
+ * [n] A n
+ * () F
+ * (void) F 0
+ * (n arguments) F n arg1 arg2 ... argn
+ * (n arguments, ...) F n arg1 arg2 ... argn-1 E
+ * (a, b, c, ...) f n arg1 arg2 ...
+ * enum tag e T tag_or_typename
+ * struct tag s T tag_or_typename
+ * union tag u T tag_or_typename
+ *
+ * tag_or_typename 0 no tag or type name
+ * 1 n tag Tag
+ * 2 n typename only type name
+ *
+ * spaces are only for better readability
+ * additionally it is possible to prepend the characters 'c' (for const)
+ * and 'v' (for volatile)
+ */
+void
+outtype(type_t *tp)
+{
+ int t, s, na;
+ sym_t *arg;
+ tspec_t ts;
+
+ while (tp != NULL) {
+ if ((ts = tp->t_tspec) == INT && tp->t_isenum)
+ ts = ENUM;
+ switch (ts) {
+ case CHAR: t = 'C'; s = '\0'; break;
+ case SCHAR: t = 'C'; s = 's'; break;
+ case UCHAR: t = 'C'; s = 'u'; break;
+ case SHORT: t = 'S'; s = '\0'; break;
+ case USHORT: t = 'S'; s = 'u'; break;
+ case INT: t = 'I'; s = '\0'; break;
+ case UINT: t = 'I'; s = 'u'; break;
+ case LONG: t = 'L'; s = '\0'; break;
+ case ULONG: t = 'L'; s = 'u'; break;
+ case QUAD: t = 'Q'; s = '\0'; break;
+ case UQUAD: t = 'Q'; s = 'u'; break;
+ case FLOAT: t = 'D'; s = 's'; break;
+ case DOUBLE: t = 'D'; s = '\0'; break;
+ case LDOUBLE: t = 'D'; s = 'l'; break;
+ case VOID: t = 'V'; s = '\0'; break;
+ case PTR: t = 'P'; s = '\0'; break;
+ case ARRAY: t = 'A'; s = '\0'; break;
+ case FUNC: t = 'F'; s = '\0'; break;
+ case ENUM: t = 'T'; s = 'e'; break;
+ case STRUCT: t = 'T'; s = 's'; break;
+ case UNION: t = 'T'; s = 'u'; break;
+ default:
+ LERROR("outtyp()");
+ }
+ if (tp->t_const)
+ outchar('c');
+ if (tp->t_volatile)
+ outchar('v');
+ if (s != '\0')
+ outchar(s);
+ outchar(t);
+ if (ts == ARRAY) {
+ outint(tp->t_dim);
+ } else if (ts == ENUM) {
+ outtt(tp->t_enum->etag, tp->t_enum->etdef);
+ } else if (ts == STRUCT || ts == UNION) {
+ outtt(tp->t_str->stag, tp->t_str->stdef);
+ } else if (ts == FUNC && tp->t_proto) {
+ na = 0;
+ for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt)
+ na++;
+ if (tp->t_vararg)
+ na++;
+ outint(na);
+ for (arg = tp->t_args; arg != NULL; arg = arg->s_nxt)
+ outtype(arg->s_type);
+ if (tp->t_vararg)
+ outchar('E');
+ }
+ tp = tp->t_subt;
+ }
+}
+
+/*
+ * type to string
+ * used for debugging output
+ *
+ * it uses its own output buffer for conversion
+ */
+const char *
+ttos(type_t *tp)
+{
+ static ob_t tob;
+ ob_t tmp;
+
+ if (tob.o_buf == NULL) {
+ tob.o_len = 64;
+ tob.o_buf = tob.o_nxt = xmalloc(tob.o_len);
+ tob.o_end = tob.o_buf + tob.o_len;
+ }
+
+ tmp = ob;
+ ob = tob;
+ ob.o_nxt = ob.o_buf;
+ outtype(tp);
+ outchar('\0');
+ tob = ob;
+ ob = tmp;
+
+ return (tob.o_buf);
+}
+
+/*
+ * write the name of a tag or typename
+ *
+ * if the tag is named, the name of the
+ * tag is written, otherwise, if a typename exists which
+ * refers to this tag, this typename is written
+ */
+static void
+outtt(sym_t *tag, sym_t *tdef)
+{
+
+ /*
+ * 0 is no longer used.
+ */
+ if (tag->s_name != unnamed) {
+ outint(1);
+ outname(tag->s_name);
+ } else if (tdef != NULL) {
+ outint(2);
+ outname(tdef->s_name);
+ } else {
+ outint(3);
+ outint(tag->s_dpos.p_line);
+ outchar('.');
+ outint(getfnid(tag->s_dpos.p_file));
+ outchar('.');
+ outint(tag->s_dpos.p_uniq);
+ }
+}
+
+/*
+ * write information about a global declared/defined symbol
+ * with storage class extern
+ *
+ * informations about function definitions are written in outfdef(),
+ * not here
+ */
+void
+outsym(sym_t *sym, scl_t sc, def_t def)
+{
+
+ /*
+ * Static function declarations must also be written to the output
+ * file. Compatibility of function declarations (for both static
+ * and extern functions) must be checked in lint2. Lint1 can't do
+ * this, especially not, if functions are declared at block level
+ * before their first declaration at level 0.
+ */
+ if (sc != EXTERN && !(sc == STATIC && sym->s_type->t_tspec == FUNC))
+ return;
+
+ /* reset buffer */
+ outclr();
+
+ /*
+ * line number of .c source, 'd' for declaration, Id of current
+ * source (.c or .h), and line in current source.
+ */
+ outint(csrc_pos.p_line);
+ outchar('d');
+ outint(getfnid(sym->s_dpos.p_file));
+ outchar('.');
+ outint(sym->s_dpos.p_line);
+
+ /* flags */
+
+ switch (def) {
+ case DEF:
+ /* defined */
+ outchar('d');
+ break;
+ case TDEF:
+ /* tentative defined */
+ outchar('t');
+ break;
+ case DECL:
+ /* declared */
+ outchar('e');
+ break;
+ default:
+ LERROR("outsym()");
+ }
+ if (llibflg && def != DECL) {
+ /*
+ * mark it as used so we get no warnings from lint2 about
+ * unused symbols in libraries.
+ */
+ outchar('u');
+ }
+
+ if (sc == STATIC)
+ outchar('s');
+
+ /* name of the symbol */
+ outname(sym->s_name);
+
+ /* renamed name of symbol, if necessary */
+ if (sym->s_rename) {
+ outchar('r');
+ outname(sym->s_rename);
+ }
+
+ /* type of the symbol */
+ outtype(sym->s_type);
+}
+
+/*
+ * write information about function definition
+ *
+ * this is also done for static functions so we are able to check if
+ * they are called with proper argument types
+ */
+void
+outfdef(sym_t *fsym, pos_t *posp, int rval, int osdef, sym_t *args)
+{
+ int narg;
+ sym_t *arg;
+
+ /* reset the buffer */
+ outclr();
+
+ /*
+ * line number of .c source, 'd' for declaration, Id of current
+ * source (.c or .h), and line in current source
+ *
+ * we are already at the end of the function. If we are in the
+ * .c source, posp->p_line is correct, otherwise csrc_pos.p_line
+ * (for functions defined in header files).
+ */
+ if (posp->p_file == csrc_pos.p_file) {
+ outint(posp->p_line);
+ } else {
+ outint(csrc_pos.p_line);
+ }
+ outchar('d');
+ outint(getfnid(posp->p_file));
+ outchar('.');
+ outint(posp->p_line);
+
+ /* flags */
+
+ /* both SCANFLIKE and PRINTFLIKE imply VARARGS */
+ if (prflstrg != -1) {
+ nvararg = prflstrg;
+ } else if (scflstrg != -1) {
+ nvararg = scflstrg;
+ }
+
+ if (nvararg != -1) {
+ outchar('v');
+ outint(nvararg);
+ }
+ if (scflstrg != -1) {
+ outchar('S');
+ outint(scflstrg);
+ }
+ if (prflstrg != -1) {
+ outchar('P');
+ outint(prflstrg);
+ }
+ nvararg = prflstrg = scflstrg = -1;
+
+ outchar('d');
+
+ if (rval)
+ /* has return value */
+ outchar('r');
+
+ if (llibflg)
+ /*
+ * mark it as used so lint2 does not complain about
+ * unused symbols in libraries
+ */
+ outchar('u');
+
+ if (osdef)
+ /* old style function definition */
+ outchar('o');
+
+ if (fsym->s_scl == STATIC)
+ outchar('s');
+
+ /* name of function */
+ outname(fsym->s_name);
+
+ /* renamed name of function, if necessary */
+ if (fsym->s_rename) {
+ outchar('r');
+ outname(fsym->s_rename);
+ }
+
+ /* argument types and return value */
+ if (osdef) {
+ narg = 0;
+ for (arg = args; arg != NULL; arg = arg->s_nxt)
+ narg++;
+ outchar('f');
+ outint(narg);
+ for (arg = args; arg != NULL; arg = arg->s_nxt)
+ outtype(arg->s_type);
+ outtype(fsym->s_type->t_subt);
+ } else {
+ outtype(fsym->s_type);
+ }
+}
+
+/*
+ * write out all information necessary for lint2 to check function
+ * calls
+ *
+ * rvused is set if the return value is used (asigned to a variable)
+ * rvdisc is set if the return value is not used and not ignored
+ * (casted to void)
+ */
+void
+outcall(tnode_t *tn, int rvused, int rvdisc)
+{
+ tnode_t *args, *arg;
+ int narg, n, i;
+ int64_t q;
+ tspec_t t;
+
+ /* reset buffer */
+ outclr();
+
+ /*
+ * line number of .c source, 'c' for function call, Id of current
+ * source (.c or .h), and line in current source
+ */
+ outint(csrc_pos.p_line);
+ outchar('c');
+ outint(getfnid(curr_pos.p_file));
+ outchar('.');
+ outint(curr_pos.p_line);
+
+ /*
+ * flags; 'u' and 'i' must be last to make sure a letter
+ * is between the numeric argument of a flag and the name of
+ * the function
+ */
+ narg = 0;
+ args = tn->tn_right;
+ for (arg = args; arg != NULL; arg = arg->tn_right)
+ narg++;
+ /* informations about arguments */
+ for (n = 1; n <= narg; n++) {
+ /* the last argument is the top one in the tree */
+ for (i = narg, arg = args; i > n; i--, arg = arg->tn_right)
+ continue;
+ arg = arg->tn_left;
+ if (arg->tn_op == CON) {
+ if (isityp(t = arg->tn_type->t_tspec)) {
+ /*
+ * XXX it would probably be better to
+ * explizitly test the sign
+ */
+ if ((q = arg->tn_val->v_quad) == 0) {
+ /* zero constant */
+ outchar('z');
+ } else if (msb(q, t, 0) == 0) {
+ /* positive if casted to signed */
+ outchar('p');
+ } else {
+ /* negative if casted to signed */
+ outchar('n');
+ }
+ outint(n);
+ }
+ } else if (arg->tn_op == AMPER &&
+ arg->tn_left->tn_op == STRING &&
+ arg->tn_left->tn_strg->st_tspec == CHAR) {
+ /* constant string, write all format specifiers */
+ outchar('s');
+ outint(n);
+ outfstrg(arg->tn_left->tn_strg);
+ }
+
+ }
+ /* return value discarded/used/ignored */
+ outchar(rvdisc ? 'd' : (rvused ? 'u' : 'i'));
+
+ /* name of the called function */
+ outname(tn->tn_left->tn_left->tn_sym->s_name);
+
+ /* types of arguments */
+ outchar('f');
+ outint(narg);
+ for (n = 1; n <= narg; n++) {
+ /* the last argument is the top one in the tree */
+ for (i = narg, arg = args; i > n; i--, arg = arg->tn_right)
+ continue;
+ outtype(arg->tn_left->tn_type);
+ }
+ /* expected type of return value */
+ outtype(tn->tn_type);
+}
+
+/*
+ * extracts potential format specifiers for printf() and scanf() and
+ * writes them, enclosed in "" and qouted if necessary, to the output buffer
+ */
+static void
+outfstrg(strg_t *strg)
+{
+ int c, oc, first;
+ u_char *cp;
+
+ if (strg->st_tspec != CHAR)
+ LERROR("outfstrg()");
+
+ cp = strg->st_cp;
+
+ outchar('"');
+
+ c = *cp++;
+
+ while (c != '\0') {
+
+ if (c != '%') {
+ c = *cp++;
+ continue;
+ }
+
+ outqchar('%');
+ c = *cp++;
+
+ /* flags for printf and scanf and *-fieldwidth for printf */
+ while (c != '\0' && (c == '-' || c == '+' || c == ' ' ||
+ c == '#' || c == '0' || c == '*')) {
+ outqchar(c);
+ c = *cp++;
+ }
+
+ /* numeric field width */
+ while (c != '\0' && isdigit(c)) {
+ outqchar(c);
+ c = *cp++;
+ }
+
+ /* precision for printf */
+ if (c == '.') {
+ outqchar(c);
+ if ((c = *cp++) == '*') {
+ outqchar(c);
+ c = *cp++;
+ } else {
+ while (c != '\0' && isdigit(c)) {
+ outqchar(c);
+ c = *cp++;
+ }
+ }
+ }
+
+ /* h, l, L and q flags fpr printf and scanf */
+ if (c == 'h' || c == 'l' || c == 'L' || c == 'q') {
+ outqchar(c);
+ c = *cp++;
+ }
+
+ /*
+ * The last character. It is always written so we can detect
+ * invalid format specifiers.
+ */
+ if (c != '\0') {
+ outqchar(c);
+ oc = c;
+ c = *cp++;
+ /*
+ * handle [ for scanf. [-] means that a minus sign
+ * was found at an undefined position.
+ */
+ if (oc == '[') {
+ if (c == '^')
+ c = *cp++;
+ if (c == ']')
+ c = *cp++;
+ first = 1;
+ while (c != '\0' && c != ']') {
+ if (c == '-') {
+ if (!first && *cp != ']')
+ outqchar(c);
+ }
+ first = 0;
+ c = *cp++;
+ }
+ if (c == ']') {
+ outqchar(c);
+ c = *cp++;
+ }
+ }
+ }
+
+ }
+
+ outchar('"');
+}
+
+/*
+ * writes a record if sym was used
+ */
+void
+outusg(sym_t *sym)
+{
+ /* reset buffer */
+ outclr();
+
+ /*
+ * line number of .c source, 'u' for used, Id of current
+ * source (.c or .h), and line in current source
+ */
+ outint(csrc_pos.p_line);
+ outchar('u');
+ outint(getfnid(curr_pos.p_file));
+ outchar('.');
+ outint(curr_pos.p_line);
+
+ /* necessary to delimit both numbers */
+ outchar('x');
+
+ /* Den Namen des Symbols ausgeben */
+ outname(sym->s_name);
+}
diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c
new file mode 100644
index 0000000..e05305e
--- /dev/null
+++ b/usr.bin/xlint/lint1/err.c
@@ -0,0 +1,552 @@
+/* $NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "lint1.h"
+
+/* number of errors found */
+int nerr;
+
+/* number of syntax errors */
+int sytxerr;
+
+
+static const char *lbasename(const char *);
+static void verror(int, va_list);
+static void vwarning(int, va_list);
+
+
+const char *msgs[] = {
+ "syntax error: empty declaration", /* 0 */
+ "old style declaration; add int", /* 1 */
+ "empty declaration", /* 2 */
+ "%s declared in argument declaration list", /* 3 */
+ "illegal type combination", /* 4 */
+ "modifying typedef with '%s'; only qualifiers allowed", /* 5 */
+ "use 'double' instead of 'long float'", /* 6 */
+ "only one storage class allowed", /* 7 */
+ "illegal storage class", /* 8 */
+ "only register valid as formal parameter storage class", /* 9 */
+ "duplicate '%s'", /* 10 */
+ "bit-field initializer out of range", /* 11 */
+ "compiler takes size of function", /* 12 */
+ "incomplete enum type: %s", /* 13 */
+ "compiler takes alignment of function", /* 14 */
+ "function returns illegal type", /* 15 */
+ "array of function is illegal", /* 16 */
+ "null dimension", /* 17 */
+ "illegal use of 'void'", /* 18 */
+ "void type for %s", /* 19 */
+ "negative array dimension (%d)", /* 20 */
+ "redeclaration of formal parameter %s", /* 21 */
+ "incomplete or misplaced function definition", /* 22 */
+ "undefined label %s", /* 23 */
+ "cannot initialize function: %s", /* 24 */
+ "cannot initialize typedef: %s", /* 25 */
+ "cannot initialize extern declaration: %s", /* 26 */
+ "redeclaration of %s", /* 27 */
+ "redefinition of %s", /* 28 */
+ "previously declared extern, becomes static: %s", /* 29 */
+ "redeclaration of %s; ANSI C requires static", /* 30 */
+ "incomplete structure or union %s: %s", /* 31 */
+ "argument type defaults to 'int': %s", /* 32 */
+ "duplicate member name: %s", /* 33 */
+ "nonportable bit-field type", /* 34 */
+ "illegal bit-field type", /* 35 */
+ "illegal bit-field size", /* 36 */
+ "zero size bit-field", /* 37 */
+ "function illegal in structure or union", /* 38 */
+ "zero sized array in struct is a C99 extension: %s", /* 39 */
+ "unknown size: %s", /* 40 */
+ "illegal use of bit-field", /* 41 */
+ "forward reference to enum type", /* 42 */
+ "redefinition hides earlier one: %s", /* 43 */
+ "declaration introduces new type in ANSI C: %s %s", /* 44 */
+ "base type is really '%s %s'", /* 45 */
+ "(%s) tag redeclared", /* 46 */
+ "zero sized %s is a C9X feature", /* 47 */
+ "overflow in enumeration values: %s", /* 48 */
+ "struct or union member must be named", /* 49 */
+ "a function is declared as an argument: %s", /* 50 */
+ "parameter mismatch: %d declared, %d defined", /* 51 */
+ "cannot initialize parameter: %s", /* 52 */
+ "declared argument %s is missing", /* 53 */
+ "trailing ',' prohibited in enum declaration", /* 54 */
+ "integral constant expression expected", /* 55 */
+ "integral constant too large", /* 56 */
+ "enumeration constant hides parameter: %s", /* 57 */
+ "type does not match prototype: %s", /* 58 */
+ "formal parameter lacks name: param #%d", /* 59 */
+ "void must be sole parameter", /* 60 */
+ "void parameter cannot have name: %s", /* 61 */
+ "function prototype parameters must have types", /* 62 */
+ "prototype does not match old-style definition", /* 63 */
+ "()-less function definition", /* 64 */
+ "%s has no named members", /* 65 */
+ "syntax requires ';' after last struct/union member", /* 66 */
+ "cannot return incomplete type", /* 67 */
+ "typedef already qualified with '%s'", /* 68 */
+ "inappropriate qualifiers with 'void'", /* 69 */
+ "%soperand of '%s' is unsigned in ANSI C", /* 70 */
+ "too many characters in character constant", /* 71 */
+ "typedef declares no type name", /* 72 */
+ "empty character constant", /* 73 */
+ "no hex digits follow \\x", /* 74 */
+ "overflow in hex escape", /* 75 */
+ "character escape does not fit in character", /* 76 */
+ "bad octal digit %c", /* 77 */
+ "nonportable character escape", /* 78 */
+ "dubious escape \\%c", /* 79 */
+ "dubious escape \\%o", /* 80 */
+ "\\a undefined in traditional C", /* 81 */
+ "\\x undefined in traditional C", /* 82 */
+ "storage class after type is obsolescent", /* 83 */
+ "ANSI C requires formal parameter before '...'", /* 84 */
+ "dubious tag declaration: %s %s", /* 85 */
+ "automatic hides external declaration: %s", /* 86 */
+ "static hides external declaration: %s", /* 87 */
+ "typedef hides external declaration: %s", /* 88 */
+ "typedef redeclared: %s", /* 89 */
+ "inconsistent redeclaration of extern: %s", /* 90 */
+ "declaration hides parameter: %s", /* 91 */
+ "inconsistent redeclaration of static: %s", /* 92 */
+ "dubious static function at block level: %s", /* 93 */
+ "function has illegal storage class: %s", /* 94 */
+ "declaration hides earlier one: %s", /* 95 */
+ "cannot dereference non-pointer type", /* 96 */
+ "suffix U is illegal in traditional C", /* 97 */
+ "suffixes F and L are illegal in traditional C", /* 98 */
+ "%s undefined", /* 99 */
+ "unary + is illegal in traditional C", /* 100 */
+ "undefined struct/union member: %s", /* 101 */
+ "illegal member use: %s", /* 102 */
+ "left operand of '.' must be struct/union object", /* 103 */
+ "left operand of '->' must be pointer to struct/union", /* 104 */
+ "non-unique member requires struct/union %s", /* 105 */
+ "left operand of '->' must be pointer", /* 106 */
+ "operands of '%s' have incompatible types", /* 107 */
+ "operand of '%s' has incompatible type", /* 108 */
+ "void type illegal in expression", /* 109 */
+ "pointer to function is not allowed here", /* 110 */
+ "unacceptable operand of '%s'", /* 111 */
+ "cannot take address of bit-field", /* 112 */
+ "cannot take address of register %s", /* 113 */
+ "%soperand of '%s' must be lvalue", /* 114 */
+ "%soperand of '%s' must be modifiable lvalue", /* 115 */
+ "illegal pointer subtraction", /* 116 */
+ "bitwise operation on signed value possibly nonportable", /* 117 */
+ "semantics of '%s' change in ANSI C; use explicit cast", /* 118 */
+ "conversion of '%s' to '%s' is out of range", /* 119 */
+ "bitwise operation on signed value nonportable", /* 120 */
+ "negative shift", /* 121 */
+ "shift greater than size of object", /* 122 */
+ "illegal combination of pointer and integer, op %s", /* 123 */
+ "illegal pointer combination, op %s", /* 124 */
+ "ANSI C forbids ordered comparisons of pointers to functions",/* 125 */
+ "incompatible types in conditional", /* 126 */
+ "'&' before array or function: ignored", /* 127 */
+ "operands have incompatible pointer types, op %s", /* 128 */
+ "expression has null effect", /* 129 */
+ "enum type mismatch, op %s", /* 130 */
+ "conversion to '%s' may sign-extend incorrectly", /* 131 */
+ "conversion from '%s' to '%s' may lose accuracy", /* 132 */
+ "conversion of pointer to '%s' loses bits", /* 133 */
+ "conversion of pointer to '%s' may lose bits", /* 134 */
+ "possible pointer alignment problem", /* 135 */
+ "cannot do pointer arithmetic on operand of unknown size", /* 136 */
+ "use of incomplete enum type, op %s", /* 137 */
+ "unknown operand size, op %s", /* 138 */
+ "division by 0", /* 139 */
+ "modulus by 0", /* 140 */
+ "integer overflow detected, op %s", /* 141 */
+ "floating point overflow detected, op %s", /* 142 */
+ "cannot take size of incomplete type", /* 143 */
+ "cannot take size of function", /* 144 */
+ "cannot take size of bit-field", /* 145 */
+ "cannot take size of void", /* 146 */
+ "invalid cast expression", /* 147 */
+ "improper cast of void expression", /* 148 */
+ "illegal function", /* 149 */
+ "argument mismatch: %d arg%s passed, %d expected", /* 150 */
+ "void expressions may not be arguments, arg #%d", /* 151 */
+ "argument cannot have unknown size, arg #%d", /* 152 */
+ "argument has incompatible pointer type, arg #%d", /* 153 */
+ "illegal combination of pointer and integer, arg #%d", /* 154 */
+ "argument is incompatible with prototype, arg #%d", /* 155 */
+ "enum type mismatch, arg #%d", /* 156 */
+ "ANSI C treats constant as unsigned", /* 157 */
+ "%s may be used before set", /* 158 */
+ "assignment in conditional context", /* 159 */
+ "operator '==' found where '=' was expected", /* 160 */
+ "constant in conditional context", /* 161 */
+ "comparison of %s with %s, op %s", /* 162 */
+ "a cast does not yield an lvalue", /* 163 */
+ "assignment of negative constant to unsigned type", /* 164 */
+ "constant truncated by assignment", /* 165 */
+ "precision lost in bit-field assignment", /* 166 */
+ "array subscript cannot be negative: %ld", /* 167 */
+ "array subscript cannot be > %d: %ld", /* 168 */
+ "precedence confusion possible: parenthesize!", /* 169 */
+ "first operand must have scalar type, op ? :", /* 170 */
+ "assignment type mismatch", /* 171 */
+ "too many struct/union initializers", /* 172 */
+ "too many array initializers", /* 173 */
+ "too many initializers", /* 174 */
+ "initialisation of an incomplete type", /* 175 */
+ "invalid initializer type %s", /* 176 */
+ "non-constant initializer", /* 177 */
+ "initializer does not fit", /* 178 */
+ "cannot initialize struct/union with no named member", /* 179 */
+ "bit-field initializer does not fit", /* 180 */
+ "{}-enclosed initializer required", /* 181 */
+ "incompatible pointer types", /* 182 */
+ "illegal combination of pointer and integer", /* 183 */
+ "illegal pointer combination", /* 184 */
+ "initialisation type mismatch", /* 185 */
+ "bit-field initialisation is illegal in traditional C", /* 186 */
+ "non-null byte ignored in string initializer", /* 187 */
+ "no automatic aggregate initialization in traditional C", /* 188 */
+ "assignment of struct/union illegal in traditional C", /* 189 */
+ "empty array declaration: %s", /* 190 */
+ "%s set but not used in function %s", /* 191 */
+ "%s unused in function %s", /* 192 */
+ "statement not reached", /* 193 */
+ "label %s redefined", /* 194 */
+ "case not in switch", /* 195 */
+ "case label affected by conversion", /* 196 */
+ "non-constant case expression", /* 197 */
+ "non-integral case expression", /* 198 */
+ "duplicate case in switch: %ld", /* 199 */
+ "duplicate case in switch: %lu", /* 200 */
+ "default outside switch", /* 201 */
+ "duplicate default in switch", /* 202 */
+ "case label must be of type `int' in traditional C", /* 203 */
+ "controlling expressions must have scalar type", /* 204 */
+ "switch expression must have integral type", /* 205 */
+ "enumeration value(s) not handled in switch", /* 206 */
+ "loop not entered at top", /* 207 */
+ "break outside loop or switch", /* 208 */
+ "continue outside loop", /* 209 */
+ "enum type mismatch in initialisation", /* 210 */
+ "return value type mismatch", /* 211 */
+ "cannot return incomplete type", /* 212 */
+ "void function %s cannot return value", /* 213 */
+ "function %s expects to return value", /* 214 */
+ "function implicitly declared to return int", /* 215 */
+ "function %s has return (e); and return;", /* 216 */
+ "function %s falls off bottom without returning value", /* 217 */
+ "ANSI C treats constant as unsigned, op %s", /* 218 */
+ "concatenated strings are illegal in traditional C", /* 219 */
+ "fallthrough on case statement", /* 220 */
+ "initialisation of unsigned with negative constant", /* 221 */
+ "conversion of negative constant to unsigned type", /* 222 */
+ "end-of-loop code not reached", /* 223 */
+ "cannot recover from previous errors", /* 224 */
+ "static function called but not defined: %s()", /* 225 */
+ "static variable %s unused", /* 226 */
+ "const object %s should have initializer", /* 227 */
+ "function cannot return const or volatile object", /* 228 */
+ "questionable conversion of function pointer", /* 229 */
+ "nonportable character comparison, op %s", /* 230 */
+ "argument %s unused in function %s", /* 231 */
+ "label %s unused in function %s", /* 232 */
+ "struct %s never defined", /* 233 */
+ "union %s never defined", /* 234 */
+ "enum %s never defined", /* 235 */
+ "static function %s unused", /* 236 */
+ "redeclaration of formal parameter %s", /* 237 */
+ "initialisation of union is illegal in traditional C", /* 238 */
+ "constant argument to NOT", /* 239 */
+ "assignment of different structures", /* 240 */
+ "dubious operation on enum, op %s", /* 241 */
+ "combination of '%s' and '%s', op %s", /* 242 */
+ "dubious comparison of enums, op %s", /* 243 */
+ "illegal structure pointer combination", /* 244 */
+ "illegal structure pointer combination, op %s", /* 245 */
+ "dubious conversion of enum to '%s'", /* 246 */
+ "pointer casts may be troublesome", /* 247 */
+ "floating-point constant out of range", /* 248 */
+ "syntax error", /* 249 */
+ "unknown character \\%o", /* 250 */
+ "malformed integer constant", /* 251 */
+ "integer constant out of range", /* 252 */
+ "unterminated character constant", /* 253 */
+ "newline in string or char constant", /* 254 */
+ "undefined or invalid # directive", /* 255 */
+ "unterminated comment", /* 256 */
+ "extra characters in lint comment", /* 257 */
+ "unterminated string constant", /* 258 */
+ "conversion to '%s' due to prototype, arg #%d", /* 259 */
+ "previous declaration of %s", /* 260 */
+ "previous definition of %s", /* 261 */
+ "\\\" inside character constants undefined in traditional C", /* 262 */
+ "\\? undefined in traditional C", /* 263 */
+ "\\v undefined in traditional C", /* 264 */
+ "%s C does not support 'long long'", /* 265 */
+ "'long double' is illegal in traditional C", /* 266 */
+ "shift equal to size of object", /* 267 */
+ "variable declared inline: %s", /* 268 */
+ "argument declared inline: %s", /* 269 */
+ "function prototypes are illegal in traditional C", /* 270 */
+ "switch expression must be of type `int' in traditional C", /* 271 */
+ "empty translation unit", /* 272 */
+ "bit-field type '%s' invalid in ANSI C", /* 273 */
+ "ANSI C forbids comparison of %s with %s", /* 274 */
+ "cast discards 'const' from pointer target type", /* 275 */
+ "", /* 276 */
+ "initialisation of '%s' with '%s'", /* 277 */
+ "combination of '%s' and '%s', arg #%d", /* 278 */
+ "combination of '%s' and '%s' in return", /* 279 */
+ "must be outside function: /* %s */", /* 280 */
+ "duplicate use of /* %s */", /* 281 */
+ "must precede function definition: /* %s */", /* 282 */
+ "argument number mismatch with directive: /* %s */", /* 283 */
+ "fallthrough on default statement", /* 284 */
+ "prototype declaration", /* 285 */
+ "function definition is not a prototype", /* 286 */
+ "function declaration is not a prototype", /* 287 */
+ "dubious use of /* VARARGS */ with /* %s */", /* 288 */
+ "can't be used together: /* PRINTFLIKE */ /* SCANFLIKE */", /* 289 */
+ "static function %s declared but not defined", /* 290 */
+ "invalid multibyte character", /* 291 */
+ "cannot concatenate wide and regular string literals", /* 292 */
+ "argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE", /* 293 */
+ "multi-character character constant", /* 294 */
+ "conversion of '%s' to '%s' is out of range, arg #%d", /* 295 */
+ "conversion of negative constant to unsigned type, arg #%d", /* 296 */
+ "conversion to '%s' may sign-extend incorrectly, arg #%d", /* 297 */
+ "conversion from '%s' to '%s' may lose accuracy, arg #%d", /* 298 */
+ "prototype does not match old style definition, arg #%d", /* 299 */
+ "old style definition", /* 300 */
+ "array of incomplete type", /* 301 */
+ "%s returns pointer to automatic object", /* 302 */
+ "ANSI C forbids conversion of %s to %s", /* 303 */
+ "ANSI C forbids conversion of %s to %s, arg #%d", /* 304 */
+ "ANSI C forbids conversion of %s to %s, op %s", /* 305 */
+ "constant truncated by conversion, op %s", /* 306 */
+ "static variable %s set but not used", /* 307 */
+ "", /* 308 */
+ "extra bits set to 0 in conversion of '%s' to '%s', op %s", /* 309 */
+ "symbol renaming can't be used on function arguments", /* 310 */
+ "symbol renaming can't be used on automatic variables", /* 311 */
+ "%s C does not support // comments", /* 312 */
+ "struct or union member name in initializer is a C9X feature",/* 313 */
+ "%s is not a structure or a union", /* 314 */
+ "GCC style struct or union member name in initializer", /* 315 */
+ "__FUNCTION__ is a GCC extension", /* 316 */
+ "__func__ is a C9X feature", /* 317 */
+ "variable array dimension is a C99/GCC extension", /* 318 */
+ "compound literals are a C9X/GCC extension", /* 319 */
+ "({ }) is a GCC extension", /* 320 */
+ "array initializer with designators is a C9X feature", /* 321 */
+ "zero sized array is a C99 extension", /* 322 */
+};
+
+/*
+ * print a list of the messages with their ids
+ */
+void
+msglist(void)
+{
+ size_t i;
+
+ for (i = 0; i < sizeof(msgs) / sizeof(msgs[0]); i++)
+ printf("%zu\t%s\n", i, msgs[i]);
+}
+
+/*
+ * If Fflag is not set lbasename() returns a pointer to the last
+ * component of the path, otherwise it returns the argument.
+ */
+static const char *
+lbasename(const char *path)
+{
+ const char *cp, *cp1, *cp2;
+
+ if (Fflag)
+ return (path);
+
+ cp = cp1 = cp2 = path;
+ while (*cp != '\0') {
+ if (*cp++ == '/') {
+ cp2 = cp1;
+ cp1 = cp;
+ }
+ }
+ return (*cp1 == '\0' ? cp2 : cp1);
+}
+
+static void
+verror( int n, va_list ap)
+{
+ const char *fn;
+
+ if (ERR_ISSET(n, &msgset))
+ return;
+
+ fn = lbasename(curr_pos.p_file);
+ (void)printf("%s(%d): ", fn, curr_pos.p_line);
+ (void)vprintf(msgs[n], ap);
+ (void)printf(" [%d]\n", n);
+ nerr++;
+}
+
+static void
+vwarning( int n, va_list ap)
+{
+ const char *fn;
+
+ if (ERR_ISSET(n, &msgset))
+ return;
+
+ if (nowarn)
+ /* this warning is suppressed by a LINTED comment */
+ return;
+
+ fn = lbasename(curr_pos.p_file);
+ (void)printf("%s(%d): warning: ", fn, curr_pos.p_line);
+ (void)vprintf(msgs[n], ap);
+ (void)printf(" [%d]\n", n);
+ if (wflag)
+ nerr++;
+}
+
+void
+error(int n, ...)
+{
+ va_list ap;
+
+ va_start(ap, n);
+ verror(n, ap);
+ va_end(ap);
+}
+
+void
+lerror(const char *file, int line, const char *msg, ...)
+{
+ va_list ap;
+ const char *fn;
+
+ va_start(ap, msg);
+ fn = lbasename(curr_pos.p_file);
+ (void)fprintf(stderr, "%s(%d): lint error: %s, %d", fn, curr_pos.p_line,
+ file, line);
+ (void)vfprintf(stderr, msg, ap);
+ (void)fprintf(stderr, "\n");
+ va_end(ap);
+ exit(1);
+}
+
+void
+warning(int n, ...)
+{
+ va_list ap;
+
+ va_start(ap, n);
+ vwarning(n, ap);
+ va_end(ap);
+}
+
+void
+message(int n, ...)
+{
+ va_list ap;
+ const char *fn;
+
+ if (ERR_ISSET(n, &msgset))
+ return;
+
+ va_start(ap, n);
+ fn = lbasename(curr_pos.p_file);
+ (void)printf("%s(%d): ", fn, curr_pos.p_line);
+ (void)vprintf(msgs[n], ap);
+ (void)printf(" [%d]\n", n);
+ va_end(ap);
+}
+
+/*
+ * XXX I think the logic is possibly somewhat screwed up here. The
+ * question is, how do we want to interpret the -s and -S flags going
+ * forward? We need to answer that and then we can fix this to be
+ * "right"... [perry, 2 Nov 2002]
+*/
+int
+c99ism(int n, ...)
+{
+ va_list ap;
+ int msg;
+
+ va_start(ap, n);
+ if (sflag && !(Sflag || gflag)) {
+ verror(n, ap);
+ msg = 1;
+ } else if (!sflag && (Sflag || gflag)) {
+ msg = 0;
+ } else {
+ vwarning(n, ap);
+ msg = 1;
+ }
+ va_end(ap);
+
+ return (msg);
+}
+
+int
+gnuism(int n, ...)
+{
+ va_list ap;
+ int msg;
+
+ va_start(ap, n);
+ if (sflag && !gflag) {
+ verror(n, ap);
+ msg = 1;
+ } else if (!sflag && gflag) {
+ msg = 0;
+ } else {
+ vwarning(n, ap);
+ msg = 1;
+ }
+ va_end(ap);
+
+ return (msg);
+}
diff --git a/usr.bin/xlint/lint1/externs1.h b/usr.bin/xlint/lint1/externs1.h
new file mode 100644
index 0000000..cf40a5d
--- /dev/null
+++ b/usr.bin/xlint/lint1/externs1.h
@@ -0,0 +1,292 @@
+/* $NetBSD: externs1.h,v 1.20 2002/11/02 20:09:27 perry 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * main.c
+ */
+extern int aflag;
+extern int bflag;
+extern int cflag;
+extern int dflag;
+extern int eflag;
+extern int Fflag;
+extern int gflag;
+extern int hflag;
+extern int rflag;
+extern int sflag;
+extern int tflag;
+extern int uflag;
+extern int vflag;
+extern int yflag;
+extern int wflag;
+extern int zflag;
+extern int Sflag;
+
+extern void norecover(void);
+
+/*
+ * cgram.y
+ */
+extern int blklev;
+extern int mblklev;
+extern int yydebug;
+
+extern int yyerror(char *);
+extern int yyparse(void);
+
+/*
+ * scan.l
+ */
+extern pos_t curr_pos;
+extern pos_t csrc_pos;
+extern symt_t symtyp;
+extern FILE *yyin;
+extern uint64_t qbmasks[], qlmasks[], qumasks[];
+
+extern void initscan(void);
+extern int sign(int64_t, tspec_t, int);
+extern int msb(int64_t, tspec_t, int);
+extern int64_t xsign(int64_t, tspec_t, int);
+extern void clrwflgs(void);
+extern sym_t *getsym(sbuf_t *);
+extern void cleanup(void);
+extern sym_t *pushdown(sym_t *);
+extern sym_t *mktempsym(type_t *);
+extern void rmsym(sym_t *);
+extern void rmsyms(sym_t *);
+extern void inssym(int, sym_t *);
+extern void freeyyv(void *, int);
+extern int yylex(void);
+
+/*
+ * mem1.c
+ */
+extern const char *fnalloc(const char *);
+extern const char *fnnalloc(const char *, size_t);
+extern int getfnid(const char *);
+
+extern void initmem(void);
+
+extern void *getblk(size_t);
+extern void *getlblk(int, size_t);
+extern void freeblk(void);
+extern void freelblk(int);
+
+extern void *tgetblk(size_t);
+extern tnode_t *getnode(void);
+extern void tfreeblk(void);
+extern struct mbl *tsave(void);
+extern void trestor(struct mbl *);
+
+/*
+ * err.c
+ */
+extern int nerr;
+extern int sytxerr;
+extern const char *msgs[];
+
+extern void msglist(void);
+extern void error(int, ...);
+extern void warning(int, ...);
+extern void message(int, ...);
+extern int gnuism(int, ...);
+extern int c99ism(int, ...);
+extern void lerror(const char *, int, const char *, ...)
+ __attribute__((__noreturn__,__format__(__printf__, 3, 4)));
+
+/*
+ * decl.c
+ */
+extern dinfo_t *dcs;
+extern const char *unnamed;
+extern int enumval;
+
+extern void initdecl(void);
+extern type_t *gettyp(tspec_t);
+extern type_t *duptyp(const type_t *);
+extern type_t *tduptyp(const type_t *);
+extern int incompl(type_t *);
+extern void setcompl(type_t *, int);
+extern void addscl(scl_t);
+extern void addtype(type_t *);
+extern void addqual(tqual_t);
+extern void pushdecl(scl_t);
+extern void popdecl(void);
+extern void setasm(void);
+extern void clrtyp(void);
+extern void deftyp(void);
+extern int length(type_t *, const char *);
+extern int getbound(type_t *);
+extern sym_t *lnklst(sym_t *, sym_t *);
+extern void chktyp(sym_t *);
+extern sym_t *decl1str(sym_t *);
+extern sym_t *bitfield(sym_t *, int);
+extern pqinf_t *mergepq(pqinf_t *, pqinf_t *);
+extern sym_t *addptr(sym_t *, pqinf_t *);
+extern sym_t *addarray(sym_t *, int, int);
+extern sym_t *addfunc(sym_t *, sym_t *);
+extern void chkfdef(sym_t *, int);
+extern sym_t *dname(sym_t *);
+extern sym_t *iname(sym_t *);
+extern type_t *mktag(sym_t *, tspec_t, int, int);
+extern const char *scltoa(scl_t);
+extern type_t *compltag(type_t *, sym_t *);
+extern sym_t *ename(sym_t *, int, int);
+extern void decl1ext(sym_t *, int);
+extern void cpuinfo(sym_t *, sym_t *);
+extern int isredec(sym_t *, int *);
+extern int eqtype(type_t *, type_t *, int, int, int *);
+extern void compltyp(sym_t *, sym_t *);
+extern sym_t *decl1arg(sym_t *, int);
+extern void cluparg(void);
+extern void decl1loc(sym_t *, int);
+extern sym_t *aname(void);
+extern void globclup(void);
+extern sym_t *decl1abs(sym_t *);
+extern void chksz(sym_t *);
+extern void setsflg(sym_t *);
+extern void setuflg(sym_t *, int, int);
+extern void chkusage(dinfo_t *);
+extern void chkusg1(int, sym_t *);
+extern void chkglsyms(void);
+extern void prevdecl(int, sym_t *);
+
+/*
+ * tree.c
+ */
+extern void initmtab(void);
+extern type_t *incref(type_t *, tspec_t);
+extern type_t *tincref(type_t *, tspec_t);
+extern tnode_t *getcnode(type_t *, val_t *);
+extern tnode_t *getnnode(sym_t *, int);
+extern tnode_t *getsnode(strg_t *);
+extern sym_t *strmemb(tnode_t *, op_t, sym_t *);
+extern tnode_t *build(op_t, tnode_t *, tnode_t *);
+extern tnode_t *cconv(tnode_t *);
+extern int typeok(op_t, int, tnode_t *, tnode_t *);
+extern tnode_t *promote(op_t, int, tnode_t *);
+extern tnode_t *convert(op_t, int, type_t *, tnode_t *);
+extern void cvtcon(op_t, int, type_t *, val_t *, val_t *);
+extern const char *tyname(char *, size_t, type_t *);
+extern const char *basictyname(tspec_t);
+extern tnode_t *bldszof(type_t *);
+extern tnode_t *cast(tnode_t *, type_t *);
+extern tnode_t *funcarg(tnode_t *, tnode_t *);
+extern tnode_t *funccall(tnode_t *, tnode_t *);
+extern val_t *constant(tnode_t *, int);
+extern void expr(tnode_t *, int, int, int);
+extern void chkmisc(tnode_t *, int, int, int, int, int, int);
+extern int conaddr(tnode_t *, sym_t **, ptrdiff_t *);
+extern strg_t *catstrg(strg_t *, strg_t *);
+
+/*
+ * func.c
+ */
+extern sym_t *funcsym;
+extern int reached;
+extern int rchflg;
+extern int ftflg;
+extern int nargusg;
+extern pos_t aupos;
+extern int nvararg;
+extern pos_t vapos;
+extern int prflstrg;
+extern pos_t prflpos;
+extern int scflstrg;
+extern pos_t scflpos;
+extern int ccflg;
+extern int llibflg;
+extern int nowarn;
+extern int bitfieldtype_ok;
+extern int plibflg;
+extern int quadflg;
+
+extern void pushctrl(int);
+extern void popctrl(int);
+extern void chkreach(void);
+extern void funcdef(sym_t *);
+extern void funcend(void);
+extern void label(int, sym_t *, tnode_t *);
+extern void if1(tnode_t *);
+extern void if2(void);
+extern void if3(int);
+extern void switch1(tnode_t *);
+extern void switch2(void);
+extern void while1(tnode_t *);
+extern void while2(void);
+extern void do1(void);
+extern void do2(tnode_t *);
+extern void for1(tnode_t *, tnode_t *, tnode_t *);
+extern void for2(void);
+extern void dogoto(sym_t *);
+extern void docont(void);
+extern void dobreak(void);
+extern void doreturn(tnode_t *);
+extern void glclup(int);
+extern void argsused(int);
+extern void constcond(int);
+extern void fallthru(int);
+extern void notreach(int);
+extern void lintlib(int);
+extern void linted(int);
+extern void varargs(int);
+extern void printflike(int);
+extern void scanflike(int);
+extern void protolib(int);
+extern void longlong(int);
+extern void bitfieldtype(int);
+
+/*
+ * init.c
+ */
+extern int initerr;
+extern sym_t *initsym;
+extern int startinit;
+
+extern void prepinit(void);
+extern void initrbr(void);
+extern void initlbr(void);
+extern void mkinit(tnode_t *);
+extern void memberpush(sbuf_t *);
+
+/*
+ * emit.c
+ */
+extern void outtype(type_t *);
+extern const char *ttos(type_t *);
+extern void outsym(sym_t *, scl_t, def_t);
+extern void outfdef(sym_t *, pos_t *, int, int, sym_t *);
+extern void outcall(tnode_t *, int, int);
+extern void outusg(sym_t *);
diff --git a/usr.bin/xlint/lint1/func.c b/usr.bin/xlint/lint1/func.c
new file mode 100644
index 0000000..e5a0490
--- /dev/null
+++ b/usr.bin/xlint/lint1/func.c
@@ -0,0 +1,1288 @@
+/* $NetBSD: func.c,v 1.22 2005/09/24 15:30:35 perry 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: func.c,v 1.16 2002/01/03 04:25:15 thorpej Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint1.h"
+#include "cgram.h"
+
+/*
+ * Contains a pointer to the symbol table entry of the current function
+ * definition.
+ */
+sym_t *funcsym;
+
+/* Is set as long as a statement can be reached. Must be set at level 0. */
+int reached = 1;
+
+/*
+ * Is set as long as NOTREACHED is in effect.
+ * Is reset everywhere where reached can become 0.
+ */
+int rchflg;
+
+/*
+ * In conjunction with reached controls printing of "fallthrough on ..."
+ * warnings.
+ * Reset by each statement and set by FALLTHROUGH, switch (switch1())
+ * and case (label()).
+ *
+ * Control statements if, for, while and switch do not reset ftflg because
+ * this must be done by the controlled statement. At least for if this is
+ * important because ** FALLTHROUGH ** after "if (expr) stmnt" is evaluated
+ * before the following token, which causes reduction of above, is read.
+ * This means that ** FALLTHROUGH ** after "if ..." would always be ignored.
+ */
+int ftflg;
+
+/* Top element of stack for control statements */
+cstk_t *cstk;
+
+/*
+ * Number of arguments which will be checked for usage in following
+ * function definition. -1 stands for all arguments.
+ *
+ * The position of the last ARGSUSED comment is stored in aupos.
+ */
+int nargusg = -1;
+pos_t aupos;
+
+/*
+ * Number of arguments of the following function definition whose types
+ * shall be checked by lint2. -1 stands for all arguments.
+ *
+ * The position of the last VARARGS comment is stored in vapos.
+ */
+int nvararg = -1;
+pos_t vapos;
+
+/*
+ * Both prflstr and scflstrg contain the number of the argument which
+ * shall be used to check the types of remaining arguments (for PRINTFLIKE
+ * and SCANFLIKE).
+ *
+ * prflpos and scflpos are the positions of the last PRINTFLIKE or
+ * SCANFLIKE comment.
+ */
+int prflstrg = -1;
+int scflstrg = -1;
+pos_t prflpos;
+pos_t scflpos;
+
+/*
+ * Are both plibflg and llibflg set, prototypes are written as function
+ * definitions to the output file.
+ */
+int plibflg;
+
+/*
+ * Nonzero means that no warnings about constants in conditional
+ * context are printed.
+ */
+int ccflg;
+
+/*
+ * llibflg is set if a lint library shall be created. The effect of
+ * llibflg is that all defined symbols are treated as used.
+ * (The LINTLIBRARY comment also resets vflag.)
+ */
+int llibflg;
+
+/*
+ * Nonzero if warnings are suppressed by a LINTED directive
+ */
+int nowarn;
+
+/*
+ * Nonzero if bitfield type errors are suppressed by a BITFIELDTYPE
+ * directive.
+ */
+int bitfieldtype_ok;
+
+/*
+ * Nonzero if complaints about use of "long long" are suppressed in
+ * the next statement or declaration.
+ */
+int quadflg;
+
+/*
+ * Puts a new element at the top of the stack used for control statements.
+ */
+void
+pushctrl(int env)
+{
+ cstk_t *ci;
+
+ if ((ci = calloc(1, sizeof (cstk_t))) == NULL)
+ nomem();
+ ci->c_env = env;
+ ci->c_nxt = cstk;
+ cstk = ci;
+}
+
+/*
+ * Removes the top element of the stack used for control statements.
+ */
+void
+popctrl(int env)
+{
+ cstk_t *ci;
+ clst_t *cl;
+
+ if (cstk == NULL || cstk->c_env != env)
+ LERROR("popctrl()");
+
+ cstk = (ci = cstk)->c_nxt;
+
+ while ((cl = ci->c_clst) != NULL) {
+ ci->c_clst = cl->cl_nxt;
+ free(cl);
+ }
+
+ if (ci->c_swtype != NULL)
+ free(ci->c_swtype);
+
+ free(ci);
+}
+
+/*
+ * Prints a warning if a statement cannot be reached.
+ */
+void
+chkreach(void)
+{
+ if (!reached && !rchflg) {
+ /* statement not reached */
+ warning(193);
+ reached = 1;
+ }
+}
+
+/*
+ * Called after a function declaration which introduces a function definition
+ * and before an (optional) old style argument declaration list.
+ *
+ * Puts all symbols declared in the Prototype or in an old style argument
+ * list back to the symbol table.
+ *
+ * Does the usual checking of storage class, type (return value),
+ * redeclaration etc..
+ */
+void
+funcdef(sym_t *fsym)
+{
+ int n, warn;
+ sym_t *arg, *sym, *rdsym;
+
+ funcsym = fsym;
+
+ /*
+ * Put all symbols declared in the argument list back to the
+ * symbol table.
+ */
+ for (sym = dcs->d_fpsyms; sym != NULL; sym = sym->s_dlnxt) {
+ if (sym->s_blklev != -1) {
+ if (sym->s_blklev != 1)
+ LERROR("funcdef()");
+ inssym(1, sym);
+ }
+ }
+
+ /*
+ * In osfunc() we did not know whether it is an old style function
+ * definition or only an old style declaration, if there are no
+ * arguments inside the argument list ("f()").
+ */
+ if (!fsym->s_type->t_proto && fsym->s_args == NULL)
+ fsym->s_osdef = 1;
+
+ chktyp(fsym);
+
+ /*
+ * chktyp() checks for almost all possible errors, but not for
+ * incomplete return values (these are allowed in declarations)
+ */
+ if (fsym->s_type->t_subt->t_tspec != VOID &&
+ incompl(fsym->s_type->t_subt)) {
+ /* cannot return incomplete type */
+ error(67);
+ }
+
+ fsym->s_def = DEF;
+
+ if (fsym->s_scl == TYPEDEF) {
+ fsym->s_scl = EXTERN;
+ /* illegal storage class */
+ error(8);
+ }
+
+ if (dcs->d_inline)
+ fsym->s_inline = 1;
+
+ /*
+ * Arguments in new style function declarations need a name.
+ * (void is already removed from the list of arguments)
+ */
+ n = 1;
+ for (arg = fsym->s_type->t_args; arg != NULL; arg = arg->s_nxt) {
+ if (arg->s_scl == ABSTRACT) {
+ if (arg->s_name != unnamed)
+ LERROR("funcdef()");
+ /* formal parameter lacks name: param #%d */
+ error(59, n);
+ } else {
+ if (arg->s_name == unnamed)
+ LERROR("funcdef()");
+ }
+ n++;
+ }
+
+ /*
+ * We must also remember the position. s_dpos is overwritten
+ * if this is an old style definition and we had already a
+ * prototype.
+ */
+ STRUCT_ASSIGN(dcs->d_fdpos, fsym->s_dpos);
+
+ if ((rdsym = dcs->d_rdcsym) != NULL) {
+
+ if (!isredec(fsym, (warn = 0, &warn))) {
+
+ /*
+ * Print nothing if the newly defined function
+ * is defined in old style. A better warning will
+ * be printed in cluparg().
+ */
+ if (warn && !fsym->s_osdef) {
+ /* redeclaration of %s */
+ (*(sflag ? error : warning))(27, fsym->s_name);
+ prevdecl(-1, rdsym);
+ }
+
+ /* copy usage information */
+ cpuinfo(fsym, rdsym);
+
+ /*
+ * If the old symbol was a prototype and the new
+ * one is none, overtake the position of the
+ * declaration of the prototype.
+ */
+ if (fsym->s_osdef && rdsym->s_type->t_proto)
+ STRUCT_ASSIGN(fsym->s_dpos, rdsym->s_dpos);
+
+ /* complete the type */
+ compltyp(fsym, rdsym);
+
+ /* once a function is inline it remains inline */
+ if (rdsym->s_inline)
+ fsym->s_inline = 1;
+
+ }
+
+ /* remove the old symbol from the symbol table */
+ rmsym(rdsym);
+
+ }
+
+ if (fsym->s_osdef && !fsym->s_type->t_proto) {
+ if (sflag && hflag && strcmp(fsym->s_name, "main") != 0)
+ /* function definition is not a prototype */
+ warning(286);
+ }
+
+ if (dcs->d_notyp)
+ /* return value is implicitly declared to be int */
+ fsym->s_rimpl = 1;
+
+ reached = 1;
+}
+
+/*
+ * Called at the end of a function definition.
+ */
+void
+funcend(void)
+{
+ sym_t *arg;
+ int n;
+
+ if (reached) {
+ cstk->c_noretval = 1;
+ if (funcsym->s_type->t_subt->t_tspec != VOID &&
+ !funcsym->s_rimpl) {
+ /* func. %s falls off bottom without returning value */
+ warning(217, funcsym->s_name);
+ }
+ }
+
+ /*
+ * This warning is printed only if the return value was implicitly
+ * declared to be int. Otherwise the wrong return statement
+ * has already printed a warning.
+ */
+ if (cstk->c_noretval && cstk->c_retval && funcsym->s_rimpl)
+ /* function %s has return (e); and return; */
+ warning(216, funcsym->s_name);
+
+ /* Print warnings for unused arguments */
+ arg = dcs->d_fargs;
+ n = 0;
+ while (arg != NULL && (nargusg == -1 || n < nargusg)) {
+ chkusg1(dcs->d_asm, arg);
+ arg = arg->s_nxt;
+ n++;
+ }
+ nargusg = -1;
+
+ /*
+ * write the information about the function definition to the
+ * output file
+ * inline functions explicitly declared extern are written as
+ * declarations only.
+ */
+ if (dcs->d_scl == EXTERN && funcsym->s_inline) {
+ outsym(funcsym, funcsym->s_scl, DECL);
+ } else {
+ outfdef(funcsym, &dcs->d_fdpos, cstk->c_retval,
+ funcsym->s_osdef, dcs->d_fargs);
+ }
+
+ /*
+ * remove all symbols declared during argument declaration from
+ * the symbol table
+ */
+ if (dcs->d_nxt != NULL || dcs->d_ctx != EXTERN)
+ LERROR("funcend()");
+ rmsyms(dcs->d_fpsyms);
+
+ /* must be set on level 0 */
+ reached = 1;
+}
+
+/*
+ * Process a label.
+ *
+ * typ type of the label (T_NAME, T_DEFAULT or T_CASE).
+ * sym symbol table entry of label if typ == T_NAME
+ * tn expression if typ == T_CASE
+ */
+void
+label(int typ, sym_t *sym, tnode_t *tn)
+{
+ cstk_t *ci;
+ clst_t *cl;
+ val_t *v;
+ val_t nv;
+ tspec_t t;
+
+ switch (typ) {
+
+ case T_NAME:
+ if (sym->s_set) {
+ /* label %s redefined */
+ error(194, sym->s_name);
+ } else {
+ setsflg(sym);
+ }
+ break;
+
+ case T_CASE:
+
+ /* find the stack entry for the innermost switch statement */
+ for (ci = cstk; ci != NULL && !ci->c_switch; ci = ci->c_nxt)
+ continue;
+
+ if (ci == NULL) {
+ /* case not in switch */
+ error(195);
+ tn = NULL;
+ } else if (tn != NULL && tn->tn_op != CON) {
+ /* non-constant case expression */
+ error(197);
+ tn = NULL;
+ } else if (tn != NULL && !isityp(tn->tn_type->t_tspec)) {
+ /* non-integral case expression */
+ error(198);
+ tn = NULL;
+ }
+
+ if (tn != NULL) {
+
+ if (ci->c_swtype == NULL)
+ LERROR("label()");
+
+ if (reached && !ftflg) {
+ if (hflag)
+ /* fallthrough on case statement */
+ warning(220);
+ }
+
+ t = tn->tn_type->t_tspec;
+ if (t == LONG || t == ULONG ||
+ t == QUAD || t == UQUAD) {
+ if (tflag)
+ /* case label must be of type ... */
+ warning(203);
+ }
+
+ /*
+ * get the value of the expression and convert it
+ * to the type of the switch expression
+ */
+ v = constant(tn, 1);
+ (void) memset(&nv, 0, sizeof nv);
+ cvtcon(CASE, 0, ci->c_swtype, &nv, v);
+ free(v);
+
+ /* look if we had this value already */
+ for (cl = ci->c_clst; cl != NULL; cl = cl->cl_nxt) {
+ if (cl->cl_val.v_quad == nv.v_quad)
+ break;
+ }
+ if (cl != NULL && isutyp(nv.v_tspec)) {
+ /* duplicate case in switch, %lu */
+ error(200, (u_long)nv.v_quad);
+ } else if (cl != NULL) {
+ /* duplicate case in switch, %ld */
+ error(199, (long)nv.v_quad);
+ } else {
+ /*
+ * append the value to the list of
+ * case values
+ */
+ cl = xcalloc(1, sizeof (clst_t));
+ STRUCT_ASSIGN(cl->cl_val, nv);
+ cl->cl_nxt = ci->c_clst;
+ ci->c_clst = cl;
+ }
+ }
+ tfreeblk();
+ break;
+
+ case T_DEFAULT:
+
+ /* find the stack entry for the innermost switch statement */
+ for (ci = cstk; ci != NULL && !ci->c_switch; ci = ci->c_nxt)
+ continue;
+
+ if (ci == NULL) {
+ /* default outside switch */
+ error(201);
+ } else if (ci->c_default) {
+ /* duplicate default in switch */
+ error(202);
+ } else {
+ if (reached && !ftflg) {
+ if (hflag)
+ /* fallthrough on default statement */
+ warning(284);
+ }
+ ci->c_default = 1;
+ }
+ break;
+ }
+ reached = 1;
+}
+
+/*
+ * T_IF T_LPARN expr T_RPARN
+ */
+void
+if1(tnode_t *tn)
+{
+
+ if (tn != NULL)
+ tn = cconv(tn);
+ if (tn != NULL)
+ tn = promote(NOOP, 0, tn);
+ expr(tn, 0, 1, 1);
+ pushctrl(T_IF);
+}
+
+/*
+ * if_without_else
+ * if_without_else T_ELSE
+ */
+void
+if2(void)
+{
+
+ cstk->c_rchif = reached ? 1 : 0;
+ reached = 1;
+}
+
+/*
+ * if_without_else
+ * if_without_else T_ELSE stmnt
+ */
+void
+if3(int els)
+{
+
+ if (els) {
+ reached |= cstk->c_rchif;
+ } else {
+ reached = 1;
+ }
+ popctrl(T_IF);
+}
+
+/*
+ * T_SWITCH T_LPARN expr T_RPARN
+ */
+void
+switch1(tnode_t *tn)
+{
+ tspec_t t;
+ type_t *tp;
+
+ if (tn != NULL)
+ tn = cconv(tn);
+ if (tn != NULL)
+ tn = promote(NOOP, 0, tn);
+ if (tn != NULL && !isityp(tn->tn_type->t_tspec)) {
+ /* switch expression must have integral type */
+ error(205);
+ tn = NULL;
+ }
+ if (tn != NULL && tflag) {
+ t = tn->tn_type->t_tspec;
+ if (t == LONG || t == ULONG || t == QUAD || t == UQUAD) {
+ /* switch expr. must be of type `int' in trad. C */
+ warning(271);
+ }
+ }
+
+ /*
+ * Remember the type of the expression. Because its possible
+ * that (*tp) is allocated on tree memory the type must be
+ * duplicated. This is not too complicated because it is
+ * only an integer type.
+ */
+ if ((tp = calloc(1, sizeof (type_t))) == NULL)
+ nomem();
+ if (tn != NULL) {
+ tp->t_tspec = tn->tn_type->t_tspec;
+ if ((tp->t_isenum = tn->tn_type->t_isenum) != 0)
+ tp->t_enum = tn->tn_type->t_enum;
+ } else {
+ tp->t_tspec = INT;
+ }
+
+ expr(tn, 1, 0, 1);
+
+ pushctrl(T_SWITCH);
+ cstk->c_switch = 1;
+ cstk->c_swtype = tp;
+
+ reached = rchflg = 0;
+ ftflg = 1;
+}
+
+/*
+ * switch_expr stmnt
+ */
+void
+switch2(void)
+{
+ int nenum = 0, nclab = 0;
+ sym_t *esym;
+ clst_t *cl;
+
+ if (cstk->c_swtype == NULL)
+ LERROR("switch2()");
+
+ /*
+ * If the switch expression was of type enumeration, count the case
+ * labels and the number of enumerators. If both counts are not
+ * equal print a warning.
+ */
+ if (cstk->c_swtype->t_isenum) {
+ nenum = nclab = 0;
+ if (cstk->c_swtype->t_enum == NULL)
+ LERROR("switch2()");
+ for (esym = cstk->c_swtype->t_enum->elem;
+ esym != NULL; esym = esym->s_nxt) {
+ nenum++;
+ }
+ for (cl = cstk->c_clst; cl != NULL; cl = cl->cl_nxt)
+ nclab++;
+ if (hflag && eflag && nenum != nclab && !cstk->c_default) {
+ /* enumeration value(s) not handled in switch */
+ warning(206);
+ }
+ }
+
+ if (cstk->c_break) {
+ /*
+ * end of switch always reached (c_break is only set if the
+ * break statement can be reached).
+ */
+ reached = 1;
+ } else if (!cstk->c_default &&
+ (!hflag || !cstk->c_swtype->t_isenum || nenum != nclab)) {
+ /*
+ * there are possible values which are not handled in
+ * switch
+ */
+ reached = 1;
+ } /*
+ * otherwise the end of the switch expression is reached
+ * if the end of the last statement inside it is reached.
+ */
+
+ popctrl(T_SWITCH);
+}
+
+/*
+ * T_WHILE T_LPARN expr T_RPARN
+ */
+void
+while1(tnode_t *tn)
+{
+
+ if (!reached) {
+ /* loop not entered at top */
+ warning(207);
+ reached = 1;
+ }
+
+ if (tn != NULL)
+ tn = cconv(tn);
+ if (tn != NULL)
+ tn = promote(NOOP, 0, tn);
+ if (tn != NULL && !issclt(tn->tn_type->t_tspec)) {
+ /* controlling expressions must have scalar type */
+ error(204);
+ tn = NULL;
+ }
+
+ pushctrl(T_WHILE);
+ cstk->c_loop = 1;
+ if (tn != NULL && tn->tn_op == CON) {
+ if (isityp(tn->tn_type->t_tspec)) {
+ cstk->c_infinite = tn->tn_val->v_quad != 0;
+ } else {
+ cstk->c_infinite = tn->tn_val->v_ldbl != 0.0;
+ }
+ }
+
+ expr(tn, 0, 1, 1);
+}
+
+/*
+ * while_expr stmnt
+ * while_expr error
+ */
+void
+while2(void)
+{
+
+ /*
+ * The end of the loop can be reached if it is no endless loop
+ * or there was a break statement which was reached.
+ */
+ reached = !cstk->c_infinite || cstk->c_break;
+ rchflg = 0;
+
+ popctrl(T_WHILE);
+}
+
+/*
+ * T_DO
+ */
+void
+do1(void)
+{
+
+ if (!reached) {
+ /* loop not entered at top */
+ warning(207);
+ reached = 1;
+ }
+
+ pushctrl(T_DO);
+ cstk->c_loop = 1;
+}
+
+/*
+ * do stmnt do_while_expr
+ * do error
+ */
+void
+do2(tnode_t *tn)
+{
+
+ /*
+ * If there was a continue statement the expression controlling the
+ * loop is reached.
+ */
+ if (cstk->c_cont)
+ reached = 1;
+
+ if (tn != NULL)
+ tn = cconv(tn);
+ if (tn != NULL)
+ tn = promote(NOOP, 0, tn);
+ if (tn != NULL && !issclt(tn->tn_type->t_tspec)) {
+ /* controlling expressions must have scalar type */
+ error(204);
+ tn = NULL;
+ }
+
+ if (tn != NULL && tn->tn_op == CON) {
+ if (isityp(tn->tn_type->t_tspec)) {
+ cstk->c_infinite = tn->tn_val->v_quad != 0;
+ } else {
+ cstk->c_infinite = tn->tn_val->v_ldbl != 0.0;
+ }
+ }
+
+ expr(tn, 0, 1, 1);
+
+ /*
+ * The end of the loop is only reached if it is no endless loop
+ * or there was a break statement which could be reached.
+ */
+ reached = !cstk->c_infinite || cstk->c_break;
+ rchflg = 0;
+
+ popctrl(T_DO);
+}
+
+/*
+ * T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN
+ */
+void
+for1(tnode_t *tn1, tnode_t *tn2, tnode_t *tn3)
+{
+
+ /*
+ * If there is no initialisation expression it is possible that
+ * it is intended not to enter the loop at top.
+ */
+ if (tn1 != NULL && !reached) {
+ /* loop not entered at top */
+ warning(207);
+ reached = 1;
+ }
+
+ pushctrl(T_FOR);
+ cstk->c_loop = 1;
+
+ /*
+ * Store the tree memory for the reinitialisation expression.
+ * Also remember this expression itself. We must check it at
+ * the end of the loop to get "used but not set" warnings correct.
+ */
+ cstk->c_fexprm = tsave();
+ cstk->c_f3expr = tn3;
+ STRUCT_ASSIGN(cstk->c_fpos, curr_pos);
+ STRUCT_ASSIGN(cstk->c_cfpos, csrc_pos);
+
+ if (tn1 != NULL)
+ expr(tn1, 0, 0, 1);
+
+ if (tn2 != NULL)
+ tn2 = cconv(tn2);
+ if (tn2 != NULL)
+ tn2 = promote(NOOP, 0, tn2);
+ if (tn2 != NULL && !issclt(tn2->tn_type->t_tspec)) {
+ /* controlling expressions must have scalar type */
+ error(204);
+ tn2 = NULL;
+ }
+ if (tn2 != NULL)
+ expr(tn2, 0, 1, 1);
+
+ if (tn2 == NULL) {
+ cstk->c_infinite = 1;
+ } else if (tn2->tn_op == CON) {
+ if (isityp(tn2->tn_type->t_tspec)) {
+ cstk->c_infinite = tn2->tn_val->v_quad != 0;
+ } else {
+ cstk->c_infinite = tn2->tn_val->v_ldbl != 0.0;
+ }
+ }
+
+ /* Checking the reinitialisation expression is done in for2() */
+
+ reached = 1;
+}
+
+/*
+ * for_exprs stmnt
+ * for_exprs error
+ */
+void
+for2(void)
+{
+ pos_t cpos, cspos;
+ tnode_t *tn3;
+
+ if (cstk->c_cont)
+ reached = 1;
+
+ STRUCT_ASSIGN(cpos, curr_pos);
+ STRUCT_ASSIGN(cspos, csrc_pos);
+
+ /* Restore the tree memory for the reinitialisation expression */
+ trestor(cstk->c_fexprm);
+ tn3 = cstk->c_f3expr;
+ STRUCT_ASSIGN(curr_pos, cstk->c_fpos);
+ STRUCT_ASSIGN(csrc_pos, cstk->c_cfpos);
+
+ /* simply "statement not reached" would be confusing */
+ if (!reached && !rchflg) {
+ /* end-of-loop code not reached */
+ warning(223);
+ reached = 1;
+ }
+
+ if (tn3 != NULL) {
+ expr(tn3, 0, 0, 1);
+ } else {
+ tfreeblk();
+ }
+
+ STRUCT_ASSIGN(curr_pos, cpos);
+ STRUCT_ASSIGN(csrc_pos, cspos);
+
+ /* An endless loop without break will never terminate */
+ reached = cstk->c_break || !cstk->c_infinite;
+ rchflg = 0;
+
+ popctrl(T_FOR);
+}
+
+/*
+ * T_GOTO identifier T_SEMI
+ * T_GOTO error T_SEMI
+ */
+void
+dogoto(sym_t *lab)
+{
+
+ setuflg(lab, 0, 0);
+
+ chkreach();
+
+ reached = rchflg = 0;
+}
+
+/*
+ * T_BREAK T_SEMI
+ */
+void
+dobreak(void)
+{
+ cstk_t *ci;
+
+ ci = cstk;
+ while (ci != NULL && !ci->c_loop && !ci->c_switch)
+ ci = ci->c_nxt;
+
+ if (ci == NULL) {
+ /* break outside loop or switch */
+ error(208);
+ } else {
+ if (reached)
+ ci->c_break = 1;
+ }
+
+ if (bflag)
+ chkreach();
+
+ reached = rchflg = 0;
+}
+
+/*
+ * T_CONTINUE T_SEMI
+ */
+void
+docont(void)
+{
+ cstk_t *ci;
+
+ for (ci = cstk; ci != NULL && !ci->c_loop; ci = ci->c_nxt)
+ continue;
+
+ if (ci == NULL) {
+ /* continue outside loop */
+ error(209);
+ } else {
+ ci->c_cont = 1;
+ }
+
+ chkreach();
+
+ reached = rchflg = 0;
+}
+
+/*
+ * T_RETURN T_SEMI
+ * T_RETURN expr T_SEMI
+ */
+void
+doreturn(tnode_t *tn)
+{
+ tnode_t *ln, *rn;
+ cstk_t *ci;
+ op_t op;
+
+ for (ci = cstk; ci->c_nxt != NULL; ci = ci->c_nxt)
+ continue;
+
+ if (tn != NULL) {
+ ci->c_retval = 1;
+ } else {
+ ci->c_noretval = 1;
+ }
+
+ if (tn != NULL && funcsym->s_type->t_subt->t_tspec == VOID) {
+ /* void function %s cannot return value */
+ error(213, funcsym->s_name);
+ tfreeblk();
+ tn = NULL;
+ } else if (tn == NULL && funcsym->s_type->t_subt->t_tspec != VOID) {
+ /*
+ * Assume that the function has a return value only if it
+ * is explicitly declared.
+ */
+ if (!funcsym->s_rimpl)
+ /* function %s expects to return value */
+ warning(214, funcsym->s_name);
+ }
+
+ if (tn != NULL) {
+
+ /* Create a temporary node for the left side */
+ ln = tgetblk(sizeof (tnode_t));
+ ln->tn_op = NAME;
+ ln->tn_type = tduptyp(funcsym->s_type->t_subt);
+ ln->tn_type->t_const = 0;
+ ln->tn_lvalue = 1;
+ ln->tn_sym = funcsym; /* better than nothing */
+
+ tn = build(RETURN, ln, tn);
+
+ if (tn != NULL) {
+ rn = tn->tn_right;
+ while ((op = rn->tn_op) == CVT || op == PLUS)
+ rn = rn->tn_left;
+ if (rn->tn_op == AMPER && rn->tn_left->tn_op == NAME &&
+ rn->tn_left->tn_sym->s_scl == AUTO) {
+ /* %s returns pointer to automatic object */
+ warning(302, funcsym->s_name);
+ }
+ }
+
+ expr(tn, 1, 0, 1);
+
+ } else {
+
+ chkreach();
+
+ }
+
+ reached = rchflg = 0;
+}
+
+/*
+ * Do some cleanup after a global declaration or definition.
+ * Especially remove informations about unused lint comments.
+ */
+void
+glclup(int silent)
+{
+ pos_t cpos;
+
+ STRUCT_ASSIGN(cpos, curr_pos);
+
+ if (nargusg != -1) {
+ if (!silent) {
+ STRUCT_ASSIGN(curr_pos, aupos);
+ /* must precede function definition: %s */
+ warning(282, "ARGSUSED");
+ }
+ nargusg = -1;
+ }
+ if (nvararg != -1) {
+ if (!silent) {
+ STRUCT_ASSIGN(curr_pos, vapos);
+ /* must precede function definition: %s */
+ warning(282, "VARARGS");
+ }
+ nvararg = -1;
+ }
+ if (prflstrg != -1) {
+ if (!silent) {
+ STRUCT_ASSIGN(curr_pos, prflpos);
+ /* must precede function definition: %s */
+ warning(282, "PRINTFLIKE");
+ }
+ prflstrg = -1;
+ }
+ if (scflstrg != -1) {
+ if (!silent) {
+ STRUCT_ASSIGN(curr_pos, scflpos);
+ /* must precede function definition: %s */
+ warning(282, "SCANFLIKE");
+ }
+ scflstrg = -1;
+ }
+
+ STRUCT_ASSIGN(curr_pos, cpos);
+
+ dcs->d_asm = 0;
+}
+
+/*
+ * ARGSUSED comment
+ *
+ * Only the first n arguments of the following function are checked
+ * for usage. A missing argument is taken to be 0.
+ */
+void
+argsused(int n)
+{
+
+ if (n == -1)
+ n = 0;
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "ARGSUSED");
+ return;
+ }
+ if (nargusg != -1) {
+ /* duplicate use of ** %s ** */
+ warning(281, "ARGSUSED");
+ }
+ nargusg = n;
+ STRUCT_ASSIGN(aupos, curr_pos);
+}
+
+/*
+ * VARARGS comment
+ *
+ * Makes that lint2 checks only the first n arguments for compatibility
+ * to the function definition. A missing argument is taken to be 0.
+ */
+void
+varargs(int n)
+{
+
+ if (n == -1)
+ n = 0;
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "VARARGS");
+ return;
+ }
+ if (nvararg != -1) {
+ /* duplicate use of ** %s ** */
+ warning(281, "VARARGS");
+ }
+ nvararg = n;
+ STRUCT_ASSIGN(vapos, curr_pos);
+}
+
+/*
+ * PRINTFLIKE comment
+ *
+ * Check all arguments until the (n-1)-th as usual. The n-th argument is
+ * used the check the types of remaining arguments.
+ */
+void
+printflike(int n)
+{
+
+ if (n == -1)
+ n = 0;
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "PRINTFLIKE");
+ return;
+ }
+ if (prflstrg != -1) {
+ /* duplicate use of ** %s ** */
+ warning(281, "PRINTFLIKE");
+ }
+ prflstrg = n;
+ STRUCT_ASSIGN(prflpos, curr_pos);
+}
+
+/*
+ * SCANFLIKE comment
+ *
+ * Check all arguments until the (n-1)-th as usual. The n-th argument is
+ * used the check the types of remaining arguments.
+ */
+void
+scanflike(int n)
+{
+
+ if (n == -1)
+ n = 0;
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "SCANFLIKE");
+ return;
+ }
+ if (scflstrg != -1) {
+ /* duplicate use of ** %s ** */
+ warning(281, "SCANFLIKE");
+ }
+ scflstrg = n;
+ STRUCT_ASSIGN(scflpos, curr_pos);
+}
+
+/*
+ * Set the linenumber for a CONSTCOND comment. At this and the following
+ * line no warnings about constants in conditional contexts are printed.
+ */
+/* ARGSUSED */
+void
+constcond(int n)
+{
+
+ ccflg = 1;
+}
+
+/*
+ * Suppress printing of "fallthrough on ..." warnings until next
+ * statement.
+ */
+/* ARGSUSED */
+void
+fallthru(int n)
+{
+
+ ftflg = 1;
+}
+
+/*
+ * Stop warnings about statements which cannot be reached. Also tells lint
+ * that the following statements cannot be reached (e.g. after exit()).
+ */
+/* ARGSUSED */
+void
+notreach(int n)
+{
+
+ reached = 0;
+ rchflg = 1;
+}
+
+/* ARGSUSED */
+void
+lintlib(int n)
+{
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "LINTLIBRARY");
+ return;
+ }
+ llibflg = 1;
+ vflag = 0;
+}
+
+/*
+ * Suppress most warnings at the current and the following line.
+ */
+/* ARGSUSED */
+void
+linted(int n)
+{
+
+#ifdef DEBUG
+ printf("%s, %d: nowarn = 1\n", curr_pos.p_file, curr_pos.p_line);
+#endif
+ nowarn = 1;
+}
+
+/*
+ * Suppress bitfield type errors on the current line.
+ */
+/* ARGSUSED */
+void
+bitfieldtype(int n)
+{
+
+#ifdef DEBUG
+ printf("%s, %d: bitfieldtype_ok = 1\n", curr_pos.p_file,
+ curr_pos.p_line);
+#endif
+ bitfieldtype_ok = 1;
+}
+
+/*
+ * PROTOTLIB in conjunction with LINTLIBRARY can be used to handle
+ * prototypes like function definitions. This is done if the argument
+ * to PROTOLIB is nonzero. Otherwise prototypes are handled normaly.
+ */
+void
+protolib(int n)
+{
+
+ if (dcs->d_ctx != EXTERN) {
+ /* must be outside function: ** %s ** */
+ warning(280, "PROTOLIB");
+ return;
+ }
+ plibflg = n == 0 ? 0 : 1;
+}
+
+/*
+ * Set quadflg to nonzero which means that the next statement/declaration
+ * may use "long long" without an error or warning.
+ */
+/* ARGSUSED */
+void
+longlong(int n)
+{
+
+ quadflg = 1;
+}
diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c
new file mode 100644
index 0000000..9ac7a32
--- /dev/null
+++ b/usr.bin/xlint/lint1/init.c
@@ -0,0 +1,656 @@
+/* $NetBSD: init.c,v 1.10 2002/01/31 19:36:54 tv 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: init.c,v 1.10 2002/01/31 19:36:54 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint1.h"
+
+/*
+ * initerr is set as soon as a fatal error occurred in an initialisation.
+ * The effect is that the rest of the initialisation is ignored (parsed
+ * by yacc, expression trees built, but no initialisation takes place).
+ */
+int initerr;
+
+/* Pointer to the symbol which is to be initialized. */
+sym_t *initsym;
+
+/* Points to the top element of the initialisation stack. */
+istk_t *initstk;
+
+typedef struct namlist {
+ const char *n_name;
+ struct namlist *n_prev;
+ struct namlist *n_next;
+} namlist_t;
+
+/* Points to a c9x named member; */
+namlist_t *namedmem = NULL;
+
+
+static void popi2(void);
+static void popinit(int);
+static void pushinit(void);
+static void testinit(void);
+static void nextinit(int);
+static int strginit(tnode_t *);
+static void memberpop(void);
+
+#ifndef DEBUG
+#define DPRINTF(a)
+#else
+#define DPRINTF(a) printf a
+#endif
+
+void
+memberpush(sb)
+ sbuf_t *sb;
+{
+ namlist_t *nam = xcalloc(1, sizeof (namlist_t));
+ nam->n_name = sb->sb_name;
+ DPRINTF(("memberpush = %s\n", nam->n_name));
+ if (namedmem == NULL) {
+ nam->n_prev = nam->n_next = nam;
+ namedmem = nam;
+ } else {
+ namedmem->n_prev->n_next = nam;
+ nam->n_prev = namedmem->n_prev;
+ nam->n_next = namedmem;
+ namedmem->n_prev = nam;
+ }
+#if 0
+ nam->n_next = namedmem;
+ namedmem = nam;
+#endif
+}
+
+static void
+memberpop()
+{
+ DPRINTF(("memberpop = %s\n", namedmem->n_name));
+ if (namedmem->n_next == namedmem) {
+ free(namedmem);
+ namedmem = NULL;
+ } else {
+ namlist_t *nam = namedmem;
+ namedmem = namedmem->n_next;
+ free(nam);
+ }
+#if 0
+ namedmem = namedmem->n_next;
+ free(nam);
+#endif
+}
+
+
+/*
+ * Initialize the initialisation stack by putting an entry for the variable
+ * which is to be initialized on it.
+ */
+void
+prepinit(void)
+{
+ istk_t *istk;
+
+ if (initerr)
+ return;
+
+ /* free memory used in last initialisation */
+ while ((istk = initstk) != NULL) {
+ initstk = istk->i_nxt;
+ free(istk);
+ }
+
+ /*
+ * If the type which is to be initialized is an incomplete type,
+ * it must be duplicated.
+ */
+ if (initsym->s_type->t_tspec == ARRAY && incompl(initsym->s_type))
+ initsym->s_type = duptyp(initsym->s_type);
+
+ istk = initstk = xcalloc(1, sizeof (istk_t));
+ istk->i_subt = initsym->s_type;
+ istk->i_cnt = 1;
+
+}
+
+static void
+popi2(void)
+{
+#ifdef DEBUG
+ char buf[64];
+#endif
+ istk_t *istk;
+ sym_t *m;
+
+ initstk = (istk = initstk)->i_nxt;
+ if (initstk == NULL)
+ LERROR("popi2()");
+ free(istk);
+
+ istk = initstk;
+
+ istk->i_cnt--;
+ if (istk->i_cnt < 0)
+ LERROR("popi2()");
+
+ DPRINTF(("popi2(): %d %s\n", istk->i_cnt,
+ namedmem ? namedmem->n_name : "*null*"));
+ if (istk->i_cnt >= 0 && namedmem != NULL) {
+ DPRINTF(("popi2(): %d %s %s\n", istk->i_cnt,
+ tyname(buf, sizeof(buf), istk->i_type), namedmem->n_name));
+ for (m = istk->i_type->t_str->memb; m != NULL; m = m->s_nxt) {
+ if (m->s_field && m->s_name == unnamed)
+ continue;
+ if (strcmp(m->s_name, namedmem->n_name) == 0) {
+ istk->i_subt = m->s_type;
+ istk->i_cnt++;
+ memberpop();
+ return;
+ }
+ }
+ error(101, namedmem->n_name);
+ memberpop();
+ istk->i_namedmem = 1;
+ return;
+ }
+ /*
+ * If the removed element was a structure member, we must go
+ * to the next structure member.
+ */
+ if (istk->i_cnt > 0 && istk->i_type->t_tspec == STRUCT &&
+ !istk->i_namedmem) {
+ do {
+ m = istk->i_mem = istk->i_mem->s_nxt;
+ if (m == NULL)
+ LERROR("popi2()");
+ } while (m->s_field && m->s_name == unnamed);
+ istk->i_subt = m->s_type;
+ }
+}
+
+static void
+popinit(int brace)
+{
+ DPRINTF(("popinit(%d)\n", brace));
+
+ if (brace) {
+ /*
+ * Take all entries, including the first which requires
+ * a closing brace, from the stack.
+ */
+ do {
+ brace = initstk->i_brace;
+ popi2();
+ } while (!brace);
+ } else {
+ /*
+ * Take all entries which cannot be used for further
+ * initializers from the stack, but do this only if
+ * they do not require a closing brace.
+ */
+ while (!initstk->i_brace &&
+ initstk->i_cnt == 0 && !initstk->i_nolimit) {
+ popi2();
+ }
+ }
+}
+
+static void
+pushinit(void)
+{
+#ifdef DEBUG
+ char buf[64];
+#endif
+ istk_t *istk;
+ int cnt;
+ sym_t *m;
+
+ istk = initstk;
+
+ /* Extend an incomplete array type by one element */
+ if (istk->i_cnt == 0) {
+ DPRINTF(("pushinit(extend) %s\n", tyname(buf, sizeof(buf),
+ istk->i_type)));
+ /*
+ * Inside of other aggregate types must not be an incomplete
+ * type.
+ */
+ if (istk->i_nxt->i_nxt != NULL)
+ LERROR("pushinit()");
+ istk->i_cnt = 1;
+ if (istk->i_type->t_tspec != ARRAY)
+ LERROR("pushinit()");
+ istk->i_type->t_dim++;
+ /* from now its a complete type */
+ setcompl(istk->i_type, 0);
+ }
+
+ if (istk->i_cnt <= 0)
+ LERROR("pushinit()");
+ if (istk->i_type != NULL && issclt(istk->i_type->t_tspec))
+ LERROR("pushinit() 4");
+
+ initstk = xcalloc(1, sizeof (istk_t));
+ initstk->i_nxt = istk;
+ initstk->i_type = istk->i_subt;
+ if (initstk->i_type->t_tspec == FUNC)
+ LERROR("pushinit()");
+
+again:
+ istk = initstk;
+
+ DPRINTF(("pushinit(%s)\n", tyname(buf, sizeof(buf), istk->i_type)));
+ switch (istk->i_type->t_tspec) {
+ case ARRAY:
+ if (namedmem) {
+ DPRINTF(("pushinit ARRAY %s\n", namedmem->n_name));
+ free(istk);
+ initstk = initstk->i_nxt;
+ goto again;
+ }
+ if (incompl(istk->i_type) && istk->i_nxt->i_nxt != NULL) {
+ /* initialisation of an incomplete type */
+ error(175);
+ initerr = 1;
+ return;
+ }
+ istk->i_subt = istk->i_type->t_subt;
+ istk->i_nolimit = incompl(istk->i_type);
+ istk->i_cnt = istk->i_type->t_dim;
+ DPRINTF(("elements array %s[%d] %s\n",
+ tyname(buf, sizeof(buf), istk->i_subt), istk->i_cnt,
+ namedmem ? namedmem->n_name : "*none*"));
+ break;
+ case UNION:
+ if (tflag)
+ /* initialisation of union is illegal in trad. C */
+ warning(238);
+ /* FALLTHROUGH */
+ case STRUCT:
+ if (incompl(istk->i_type)) {
+ /* initialisation of an incomplete type */
+ error(175);
+ initerr = 1;
+ return;
+ }
+ cnt = 0;
+ DPRINTF(("2. member lookup %s %s\n",
+ tyname(buf, sizeof(buf), istk->i_type),
+ namedmem ? namedmem->n_name : "*none*"));
+ for (m = istk->i_type->t_str->memb; m != NULL; m = m->s_nxt) {
+ if (m->s_field && m->s_name == unnamed)
+ continue;
+ if (namedmem != NULL) {
+ DPRINTF(("pushinit():[member:%s, looking:%s]\n",
+ m->s_name, namedmem->n_name));
+ if (strcmp(m->s_name, namedmem->n_name) == 0) {
+ cnt++;
+ break;
+ } else
+ continue;
+ }
+ if (++cnt == 1) {
+ istk->i_mem = m;
+ istk->i_subt = m->s_type;
+ }
+ }
+ if (namedmem != NULL) {
+ istk->i_namedmem = 1;
+ if (m == NULL) {
+ error(101, namedmem->n_name);
+ initerr = 1;
+ } else {
+ istk->i_mem = m;
+ istk->i_subt = m->s_type;
+ }
+ memberpop();
+ cnt = istk->i_type->t_tspec == STRUCT ? 2 : 1;
+ }
+ if (cnt == 0) {
+ /* cannot init. struct/union with no named member */
+ error(179);
+ initerr = 1;
+ return;
+ }
+ istk->i_cnt = istk->i_type->t_tspec == STRUCT ? cnt : 1;
+ break;
+ default:
+ if (namedmem) {
+ DPRINTF(("pushinit(): pop\n"));
+ free(istk);
+ initstk = initstk->i_nxt;
+ goto again;
+ }
+ istk->i_cnt = 1;
+ break;
+ }
+}
+
+static void
+testinit(void)
+{
+ istk_t *istk;
+
+ istk = initstk;
+
+ /*
+ * If a closing brace is expected we have at least one initializer
+ * too much.
+ */
+ if (istk->i_cnt == 0 && !istk->i_nolimit && !istk->i_namedmem) {
+ switch (istk->i_type->t_tspec) {
+ case ARRAY:
+ /* too many array initializers */
+ error(173);
+ break;
+ case STRUCT:
+ case UNION:
+ /* too many struct/union initializers */
+ error(172);
+ break;
+ default:
+ /* too many initializers */
+ error(174);
+ break;
+ }
+ initerr = 1;
+ }
+}
+
+static void
+nextinit(int brace)
+{
+ char buf[64];
+
+ DPRINTF(("nextinit(%d)\n", brace));
+ if (!brace) {
+ if (initstk->i_type == NULL &&
+ !issclt(initstk->i_subt->t_tspec)) {
+ /* {}-enclosed initializer required */
+ error(181);
+ }
+ /*
+ * Make sure an entry with a scalar type is at the top
+ * of the stack.
+ */
+ if (!initerr)
+ testinit();
+ while (!initerr && (initstk->i_type == NULL ||
+ !issclt(initstk->i_type->t_tspec))) {
+ if (!initerr)
+ pushinit();
+ }
+ } else {
+ if (initstk->i_type != NULL &&
+ issclt(initstk->i_type->t_tspec)) {
+ /* invalid initializer */
+ error(176);
+ initerr = 1;
+ }
+ if (!initerr)
+ testinit();
+ if (!initerr)
+ pushinit();
+ if (!initerr)
+ initstk->i_brace = 1;
+ }
+}
+
+void
+initlbr(void)
+{
+
+ if (initerr)
+ return;
+
+ if ((initsym->s_scl == AUTO || initsym->s_scl == REG) &&
+ initstk->i_nxt == NULL) {
+ if (tflag && !issclt(initstk->i_subt->t_tspec))
+ /* no automatic aggregate initialization in trad. C*/
+ warning(188);
+ }
+
+ /*
+ * Remove all entries which cannot be used for further initializers
+ * and do not expect a closing brace.
+ */
+ popinit(0);
+
+ nextinit(1);
+}
+
+void
+initrbr(void)
+{
+
+ if (initerr)
+ return;
+
+ popinit(1);
+}
+
+void
+mkinit(tnode_t *tn)
+{
+ ptrdiff_t offs;
+ sym_t *sym;
+ tspec_t lt, rt;
+ tnode_t *ln;
+ struct mbl *tmem;
+ scl_t sc;
+#ifdef DEBUG
+ char buf[64];
+#endif
+
+ DPRINTF(("mkinit(%s)\n", tyname(buf, sizeof(buf), tn->tn_type)));
+ if (initerr || tn == NULL)
+ goto end;
+
+ sc = initsym->s_scl;
+
+ /*
+ * Do not test for automatic aggregate initialisation. If the
+ * initializer starts with a brace we have the warning already.
+ * If not, an error will be printed that the initializer must
+ * be enclosed by braces.
+ */
+
+ /*
+ * Local initialisation of non-array-types with only one expression
+ * without braces is done by ASSIGN
+ */
+ if ((sc == AUTO || sc == REG) &&
+ initsym->s_type->t_tspec != ARRAY && initstk->i_nxt == NULL) {
+ ln = getnnode(initsym, 0);
+ ln->tn_type = tduptyp(ln->tn_type);
+ ln->tn_type->t_const = 0;
+ tn = build(ASSIGN, ln, tn);
+ expr(tn, 0, 0, 1);
+ goto end;
+ }
+
+ /*
+ * Remove all entries which cannot be used for further initializers
+ * and do not require a closing brace.
+ */
+ popinit(0);
+
+ /* Initialisations by strings are done in strginit(). */
+ if (strginit(tn))
+ goto end;
+
+ nextinit(0);
+ if (initerr || tn == NULL)
+ goto end;
+
+ initstk->i_cnt--;
+ DPRINTF(("mkinit() cnt=%d tn=%p\n", initstk->i_cnt, tn));
+ /* Create a temporary node for the left side. */
+ ln = tgetblk(sizeof (tnode_t));
+ ln->tn_op = NAME;
+ ln->tn_type = tduptyp(initstk->i_type);
+ ln->tn_type->t_const = 0;
+ ln->tn_lvalue = 1;
+ ln->tn_sym = initsym; /* better than nothing */
+
+ tn = cconv(tn);
+
+ lt = ln->tn_type->t_tspec;
+ rt = tn->tn_type->t_tspec;
+
+ if (!issclt(lt))
+ LERROR("mkinit()");
+
+ if (!typeok(INIT, 0, ln, tn))
+ goto end;
+
+ /*
+ * Store the tree memory. This is necessary because otherwise
+ * expr() would free it.
+ */
+ tmem = tsave();
+ expr(tn, 1, 0, 1);
+ trestor(tmem);
+
+ if (isityp(lt) && ln->tn_type->t_isfield && !isityp(rt)) {
+ /*
+ * Bit-fields can be initialized in trad. C only by integer
+ * constants.
+ */
+ if (tflag)
+ /* bit-field initialisation is illegal in trad. C */
+ warning(186);
+ }
+
+ if (lt != rt || (initstk->i_type->t_isfield && tn->tn_op == CON))
+ tn = convert(INIT, 0, initstk->i_type, tn);
+
+ if (tn != NULL && tn->tn_op != CON) {
+ sym = NULL;
+ offs = 0;
+ if (conaddr(tn, &sym, &offs) == -1) {
+ if (sc == AUTO || sc == REG) {
+ /* non-constant initializer */
+ (void)gnuism(177);
+ } else {
+ /* non-constant initializer */
+ error(177);
+ }
+ }
+ }
+
+ end:
+ /*
+ * We only free the block, if we are not a compound declaration
+ * We know that the only symbols that start with a digit are the
+ * ones we allocate with mktempsym() for compound declarations
+ */
+ if (!isdigit((unsigned char)initsym->s_name[0]))
+ tfreeblk();
+}
+
+
+static int
+strginit(tnode_t *tn)
+{
+ tspec_t t;
+ istk_t *istk;
+ int len;
+ strg_t *strg;
+
+ if (tn->tn_op != STRING)
+ return (0);
+
+ istk = initstk;
+ strg = tn->tn_strg;
+
+ /*
+ * Check if we have an array type which can be initialized by
+ * the string.
+ */
+ if (istk->i_subt != NULL && istk->i_subt->t_tspec == ARRAY) {
+ t = istk->i_subt->t_subt->t_tspec;
+ if (!((strg->st_tspec == CHAR &&
+ (t == CHAR || t == UCHAR || t == SCHAR)) ||
+ (strg->st_tspec == WCHAR && t == WCHAR))) {
+ return (0);
+ }
+ /* Put the array at top of stack */
+ pushinit();
+ istk = initstk;
+ } else if (istk->i_type != NULL && istk->i_type->t_tspec == ARRAY) {
+ t = istk->i_type->t_subt->t_tspec;
+ if (!((strg->st_tspec == CHAR &&
+ (t == CHAR || t == UCHAR || t == SCHAR)) ||
+ (strg->st_tspec == WCHAR && t == WCHAR))) {
+ return (0);
+ }
+ /*
+ * If the array is already partly initialized, we are
+ * wrong here.
+ */
+ if (istk->i_cnt != istk->i_type->t_dim)
+ return (0);
+ } else {
+ return (0);
+ }
+
+ /* Get length without trailing NUL character. */
+ len = strg->st_len;
+
+ if (istk->i_nolimit) {
+ istk->i_nolimit = 0;
+ istk->i_type->t_dim = len + 1;
+ /* from now complete type */
+ setcompl(istk->i_type, 0);
+ } else {
+ if (istk->i_type->t_dim < len) {
+ /* non-null byte ignored in string initializer */
+ warning(187);
+ }
+ }
+
+ /* In every case the array is initialized completely. */
+ istk->i_cnt = 0;
+
+ return (1);
+}
diff --git a/usr.bin/xlint/lint1/lint.h b/usr.bin/xlint/lint1/lint.h
new file mode 100644
index 0000000..7888b4c
--- /dev/null
+++ b/usr.bin/xlint/lint1/lint.h
@@ -0,0 +1,120 @@
+/* $NetBSD: lint.h,v 1.2 1995/07/03 21:24:18 cgd 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#include "param.h"
+
+/*
+ * Type specifiers, used in type structures (type_t) and otherwere.
+ */
+typedef enum {
+ NOTSPEC,
+ SIGNED, /* keyword "signed", only used in the parser */
+ UNSIGN, /* keyword "unsigned", only used in the parser */
+ CHAR, /* char */
+ SCHAR, /* signed char */
+ UCHAR, /* unsigned char */
+ SHORT, /* (signed) short */
+ USHORT, /* unsigned short */
+ INT, /* (signed) int */
+ UINT, /* unsigned int */
+ LONG, /* (signed) long */
+ ULONG, /* unsigned long */
+ QUAD, /* (signed) long long */
+ UQUAD, /* unsigned long long */
+ FLOAT, /* float */
+ DOUBLE, /* double or, with tflag, long float */
+ LDOUBLE, /* long double */
+ VOID, /* void */
+ STRUCT, /* structure tag */
+ UNION, /* union tag */
+ ENUM, /* enum tag */
+ PTR, /* pointer */
+ ARRAY, /* array */
+ FUNC /* function */
+#define NTSPEC ((int)FUNC + 1)
+} tspec_t;
+
+/*
+ * size of types, name and classification
+ */
+typedef struct {
+ int tt_sz; /* size in bits */
+ int tt_psz; /* size, different from tt_sz
+ if pflag is set */
+ tspec_t tt_styp; /* signed counterpart */
+ tspec_t tt_utyp; /* unsigned counterpart */
+ u_int tt_isityp : 1; /* 1 if integer type */
+ u_int tt_isutyp : 1; /* 1 if unsigned integer type */
+ u_int tt_isftyp : 1; /* 1 if floating point type */
+ u_int tt_isatyp : 1; /* 1 if arithmetic type */
+ u_int tt_issclt : 1; /* 1 if scalar type */
+ char *tt_name; /* type name */
+} ttab_t;
+
+#define size(t) (ttab[t].tt_sz)
+#define psize(t) (ttab[t].tt_psz)
+#define styp(t) (ttab[t].tt_styp)
+#define utyp(t) (ttab[t].tt_utyp)
+#define isityp(t) (ttab[t].tt_isityp)
+#define isutyp(t) (ttab[t].tt_isutyp)
+#define isftyp(t) (ttab[t].tt_isftyp)
+#define isatyp(t) (ttab[t].tt_isatyp)
+#define issclt(t) (ttab[t].tt_issclt)
+
+extern ttab_t ttab[];
+
+
+typedef enum {
+ NODECL, /* until now not declared */
+ DECL, /* declared */
+ TDEF, /* tentative defined */
+ DEF /* defined */
+} def_t;
+
+/*
+ * Following structure contains some data used for the output buffer.
+ */
+typedef struct ob {
+ char *o_buf; /* buffer */
+ char *o_end; /* first byte after buffer */
+ size_t o_len; /* length of buffer */
+ char *o_nxt; /* next free byte in buffer */
+} ob_t;
+
+#include "externs.h"
diff --git a/usr.bin/xlint/lint1/lint1.h b/usr.bin/xlint/lint1/lint1.h
new file mode 100644
index 0000000..da40d3a
--- /dev/null
+++ b/usr.bin/xlint/lint1/lint1.h
@@ -0,0 +1,424 @@
+/* $NetBSD: lint1.h,v 1.16 2002/10/21 22:44:08 christos Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "lint.h"
+#include "op.h"
+
+/* XXX - works for most systems, but the whole ALIGN thing needs to go away */
+#ifndef LINT_ALIGN
+#define LINT_ALIGN(x) (((x) + 15) & ~15)
+#endif
+
+/*
+ * Describes the position of a declaration or anything else.
+ */
+typedef struct {
+ int p_line;
+ const char *p_file;
+ int p_uniq; /* uniquifier */
+} pos_t;
+
+/* Copies curr_pos, keeping things unique. */
+#define UNIQUE_CURR_POS(pos) \
+ do { \
+ STRUCT_ASSIGN((pos), curr_pos); \
+ curr_pos.p_uniq++; \
+ if (curr_pos.p_file == csrc_pos.p_file) \
+ csrc_pos.p_uniq++; \
+ } while (0)
+
+/*
+ * Strings cannot be referenced to simply by a pointer to its first
+ * char. This is because strings can contain NUL characters other than the
+ * trailing NUL.
+ *
+ * Strings are stored with a trailing NUL.
+ */
+typedef struct strg {
+ tspec_t st_tspec; /* CHAR or WCHAR */
+ size_t st_len; /* length without trailing NUL */
+ union {
+ u_char *_st_cp;
+ wchar_t *_st_wcp;
+ } st_u;
+} strg_t;
+
+#define st_cp st_u._st_cp
+#define st_wcp st_u._st_wcp
+
+/*
+ * qualifiers (only for lex/yacc interface)
+ */
+typedef enum {
+ CONST, VOLATILE
+} tqual_t;
+
+/*
+ * Integer and floating point values are stored in this structure
+ */
+typedef struct {
+ tspec_t v_tspec;
+ int v_ansiu; /* set if an integer constant is
+ unsigned in ANSI C */
+ union {
+ int64_t _v_quad; /* integers */
+ ldbl_t _v_ldbl; /* floats */
+ } v_u;
+} val_t;
+
+#define v_quad v_u._v_quad
+#define v_ldbl v_u._v_ldbl
+
+/*
+ * Structures of type str_t uniqely identify structures. This can't
+ * be done in structures of type type_t, because these are copied
+ * if they must be modified. So it would not be possible to check
+ * if two structures are identical by comparing the pointers to
+ * the type structures.
+ *
+ * The typename is used if the structure is unnamed to identify
+ * the structure type in pass 2.
+ */
+typedef struct {
+ u_int size; /* size in bit */
+ u_int align : 15; /* alignment in bit */
+ u_int sincompl : 1; /* set if incomplete type */
+ struct sym *memb; /* list of members */
+ struct sym *stag; /* symbol table entry of tag */
+ struct sym *stdef; /* symbol table entry of first typename */
+} str_t;
+
+/*
+ * same as above for enums
+ */
+typedef struct {
+ u_int eincompl : 1; /* incomplete enum type */
+ struct sym *elem; /* list of enumerators */
+ struct sym *etag; /* symbol table entry of tag */
+ struct sym *etdef; /* symbol table entry of first typename */
+} enum_t;
+
+/*
+ * Types are represented by concatenation of structures of type type_t
+ * via t_subt.
+ */
+typedef struct type {
+ tspec_t t_tspec; /* type specifier */
+ u_int t_aincompl : 1; /* incomplete array type */
+ u_int t_const : 1; /* const modifier */
+ u_int t_volatile : 1; /* volatile modifier */
+ u_int t_proto : 1; /* function prototype (t_args valid) */
+ u_int t_vararg : 1; /* prototype with ... */
+ u_int t_typedef : 1; /* type defined with typedef */
+ u_int t_isfield : 1; /* type is bitfield */
+ u_int t_isenum : 1; /* type is (or was) enum (t_enum valid) */
+ union {
+ int _t_dim; /* dimension */
+ str_t *_t_str; /* struct/union tag */
+ enum_t *_t_enum; /* enum tag */
+ struct sym *_t_args; /* arguments (if t_proto) */
+ } t_u;
+ struct {
+ u_int _t_flen : 8; /* length of bit-field */
+ u_int _t_foffs : 24; /* offset of bit-field */
+ } t_b;
+ struct type *t_subt; /* element type (arrays), return value
+ (functions), or type pointer points to */
+} type_t;
+
+#define t_dim t_u._t_dim
+#define t_str t_u._t_str
+#define t_field t_u._t_field
+#define t_enum t_u._t_enum
+#define t_args t_u._t_args
+#define t_flen t_b._t_flen
+#define t_foffs t_b._t_foffs
+
+/*
+ * types of symbols
+ */
+typedef enum {
+ FVFT, /* variables, functions, type names, enums */
+ FMOS, /* members of structs or unions */
+ FTAG, /* tags */
+ FLAB /* labels */
+} symt_t;
+
+/*
+ * storage classes
+ */
+typedef enum {
+ NOSCL,
+ EXTERN, /* external symbols (indep. of decl_t) */
+ STATIC, /* static symbols (local and global) */
+ AUTO, /* automatic symbols (except register) */
+ REG, /* register */
+ TYPEDEF, /* typedef */
+ STRTAG,
+ UNIONTAG,
+ ENUMTAG,
+ MOS, /* member of struct */
+ MOU, /* member of union */
+ ENUMCON, /* enumerator */
+ ABSTRACT, /* abstract symbol (sizeof, casts, unnamed argument) */
+ ARG, /* argument */
+ PARG, /* used in declaration stack during prototype
+ declaration */
+ INLINE /* only used by the parser */
+} scl_t;
+
+/*
+ * symbol table entry
+ */
+typedef struct sym {
+ const char *s_name; /* name */
+ const char *s_rename; /* renamed symbol's given name */
+ pos_t s_dpos; /* position of last (prototype)definition,
+ prototypedeclaration, no-prototype-def.,
+ tentative definition or declaration,
+ in this order */
+ pos_t s_spos; /* position of first initialisation */
+ pos_t s_upos; /* position of first use */
+ symt_t s_kind; /* type of symbol */
+ u_int s_keyw : 1; /* keyword */
+ u_int s_field : 1; /* bit-field */
+ u_int s_set : 1; /* variable set, label defined */
+ u_int s_used : 1; /* variable/label used */
+ u_int s_arg : 1; /* symbol is function argument */
+ u_int s_reg : 1; /* symbol is register variable */
+ u_int s_defarg : 1; /* undefined symbol in old style function
+ definition */
+ u_int s_rimpl : 1; /* return value of function implicit decl. */
+ u_int s_osdef : 1; /* symbol stems from old style function def. */
+ u_int s_inline : 1; /* true if this is an inline function */
+ struct sym *s_xsym; /* for local declared external symbols pointer
+ to external symbol with same name */
+ def_t s_def; /* declared, tentative defined, defined */
+ scl_t s_scl; /* storage class */
+ int s_blklev; /* level of declaration, -1 if not in symbol
+ table */
+ type_t *s_type; /* type */
+ val_t s_value; /* value (if enumcon) */
+ union {
+ str_t *_s_st; /* tag, if it is a struct/union member */
+ enum_t *_s_et; /* tag, if it is an enumerator */
+ tspec_t _s_tsp; /* type (only for keywords) */
+ tqual_t _s_tqu; /* qualifier (only for keywords) */
+ struct sym *_s_args; /* arguments in old style function
+ definitions */
+ } u;
+ struct sym *s_link; /* next symbol with same hash value */
+ struct sym **s_rlink; /* pointer to s_link of prev. symbol */
+ struct sym *s_nxt; /* next struct/union member, enumerator,
+ argument */
+ struct sym *s_dlnxt; /* next symbol declared on same level */
+} sym_t;
+
+#define s_styp u._s_st
+#define s_etyp u._s_et
+#define s_tspec u._s_tsp
+#define s_tqual u._s_tqu
+#define s_args u._s_args
+
+/*
+ * Used to keep some informations about symbols before they are entered
+ * into the symbol table.
+ */
+typedef struct sbuf {
+ const char *sb_name; /* name of symbol */
+ size_t sb_len; /* length (without '\0') */
+ int sb_hash; /* hash value */
+ sym_t *sb_sym; /* symbol table entry */
+ struct sbuf *sb_nxt; /* for freelist */
+} sbuf_t;
+
+
+/*
+ * tree node
+ */
+typedef struct tnode {
+ op_t tn_op; /* operator */
+ type_t *tn_type; /* type */
+ u_int tn_lvalue : 1; /* node is lvalue */
+ u_int tn_cast : 1; /* if tn_op == CVT its an explicit cast */
+ u_int tn_parn : 1; /* node parenthesized */
+ union {
+ struct {
+ struct tnode *_tn_left; /* (left) operand */
+ struct tnode *_tn_right; /* right operand */
+ } tn_s;
+ sym_t *_tn_sym; /* symbol if op == NAME */
+ val_t *_tn_val; /* value if op == CON */
+ strg_t *_tn_strg; /* string if op == STRING */
+ } tn_u;
+} tnode_t;
+
+#define tn_left tn_u.tn_s._tn_left
+#define tn_right tn_u.tn_s._tn_right
+#define tn_sym tn_u._tn_sym
+#define tn_val tn_u._tn_val
+#define tn_strg tn_u._tn_strg
+
+/*
+ * For nested declarations a stack exists, which holds all information
+ * needed for the current level. dcs points to the top element of this
+ * stack.
+ *
+ * ctx describes the context of the current declaration. Its value is
+ * one of
+ * EXTERN global declarations
+ * MOS oder MOU declarations of struct or union members
+ * ENUMCON declarations of enums
+ * ARG declaration of arguments in old style function definitions
+ * PARG declaration of arguments in function prototypes
+ * AUTO declaration of local symbols
+ * ABSTRACT abstract declarations (sizeof, casts)
+ *
+ */
+typedef struct dinfo {
+ tspec_t d_atyp; /* VOID, CHAR, INT, FLOAT or DOUBLE */
+ tspec_t d_smod; /* SIGNED or UNSIGN */
+ tspec_t d_lmod; /* SHORT, LONG or QUAD */
+ scl_t d_scl; /* storage class */
+ type_t *d_type; /* after deftyp() pointer to the type used
+ for all declarators */
+ sym_t *d_rdcsym; /* redeclared symbol */
+ int d_offset; /* offset of next structure member */
+ int d_stralign; /* alignment required for current structure */
+ scl_t d_ctx; /* context of declaration */
+ u_int d_const : 1; /* const in declaration specifiers */
+ u_int d_volatile : 1; /* volatile in declaration specifiers */
+ u_int d_inline : 1; /* inline in declaration specifiers */
+ u_int d_mscl : 1; /* multiple storage classes */
+ u_int d_terr : 1; /* invalid type combination */
+ u_int d_nedecl : 1; /* 1 if at least a tag is declared */
+ u_int d_vararg : 1; /* ... in current function decl. */
+ u_int d_proto : 1; /* current funct. decl. is prototype */
+ u_int d_notyp : 1; /* set if no type specifier was present */
+ u_int d_asm : 1; /* set if d_ctx == AUTO and asm() present */
+ type_t *d_tagtyp; /* tag during member declaration */
+ sym_t *d_fargs; /* list of arguments during function def. */
+ pos_t d_fdpos; /* position of function definition */
+ sym_t *d_dlsyms; /* first symbol declared at this level */
+ sym_t **d_ldlsym; /* points to s_dlnxt in last symbol decl.
+ at this level */
+ sym_t *d_fpsyms; /* symbols defined in prototype */
+ struct dinfo *d_nxt; /* next level */
+} dinfo_t;
+
+/*
+ * Type of stack which is used for initialisation of aggregate types.
+ */
+typedef struct istk {
+ type_t *i_type; /* type of initialisation */
+ type_t *i_subt; /* type of next level */
+ u_int i_brace : 1; /* need } for pop */
+ u_int i_nolimit : 1; /* incomplete array type */
+ u_int i_namedmem : 1; /* has c9x named members */
+ sym_t *i_mem; /* next structure member */
+ int i_cnt; /* # of remaining elements */
+ struct istk *i_nxt; /* previous level */
+} istk_t;
+
+/*
+ * Used to collect information about pointers and qualifiers in
+ * declarators.
+ */
+typedef struct pqinf {
+ int p_pcnt; /* number of asterisks */
+ u_int p_const : 1;
+ u_int p_volatile : 1;
+ struct pqinf *p_nxt;
+} pqinf_t;
+
+/*
+ * Case values are stored in a list of type clst_t.
+ */
+typedef struct clst {
+ val_t cl_val;
+ struct clst *cl_nxt;
+} clst_t;
+
+/*
+ * Used to keep informations about nested control statements.
+ */
+typedef struct cstk {
+ int c_env; /* type of statement (T_IF, ...) */
+ u_int c_loop : 1; /* continue && break are valid */
+ u_int c_switch : 1; /* case && break are valid */
+ u_int c_break : 1; /* loop/switch has break */
+ u_int c_cont : 1; /* loop has continue */
+ u_int c_default : 1; /* switch has default */
+ u_int c_infinite : 1; /* break condition always false
+ (for (;;), while (1)) */
+ u_int c_rchif : 1; /* end of if-branch reached */
+ u_int c_noretval : 1; /* had "return;" */
+ u_int c_retval : 1; /* had "return (e);" */
+ type_t *c_swtype; /* type of switch expression */
+ clst_t *c_clst; /* list of case values */
+ struct mbl *c_fexprm; /* saved memory for end of loop
+ expression in for() */
+ tnode_t *c_f3expr; /* end of loop expr in for() */
+ pos_t c_fpos; /* position of end of loop expr */
+ pos_t c_cfpos; /* same for csrc_pos */
+ struct cstk *c_nxt; /* outer control statement */
+} cstk_t;
+
+typedef struct {
+ size_t lo;
+ size_t hi;
+} range_t;
+
+#include "externs1.h"
+
+#define ERR_SETSIZE 1024
+#define __NERRBITS (sizeof(unsigned int))
+
+typedef struct err_set {
+ unsigned int errs_bits[(ERR_SETSIZE + __NERRBITS-1) / __NERRBITS];
+} err_set;
+
+#define ERR_SET(n, p) \
+ ((p)->errs_bits[(n)/__NERRBITS] |= (1 << ((n) % __NERRBITS)))
+#define ERR_CLR(n, p) \
+ ((p)->errs_bits[(n)/__NERRBITS] &= ~(1 << ((n) % __NERRBITS)))
+#define ERR_ISSET(n, p) \
+ ((p)->errs_bits[(n)/__NERRBITS] & (1 << ((n) % __NERRBITS)))
+#define ERR_ZERO(p) (void)memset((p), 0, sizeof(*(p)))
+
+#define LERROR(fmt, args...) lerror(__FILE__, __LINE__, fmt, ##args)
+
+extern err_set msgset;
diff --git a/usr.bin/xlint/lint1/main1.c b/usr.bin/xlint/lint1/main1.c
new file mode 100644
index 0000000..59f6c7f
--- /dev/null
+++ b/usr.bin/xlint/lint1/main1.c
@@ -0,0 +1,230 @@
+/* $NetBSD: main1.c,v 1.17 2006/11/08 18:31:15 christos 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: main1.c,v 1.17 2006/11/08 18:31:15 christos Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <err.h>
+#include <errno.h>
+#include <limits.h>
+
+#include "lint1.h"
+
+/* set yydebug to 1*/
+int yflag;
+
+/*
+ * Print warnings if an assignment of an integertype to another integertype
+ * causes an implicit narrowing conversion. If aflag is 1, these warnings
+ * are printed only if the source type is at least as wide as long. If aflag
+ * is greater than 1, they are always printed.
+ */
+int aflag;
+
+/* Print a warning if a break statement cannot be reached. */
+int bflag;
+
+/* Print warnings for pointer casts. */
+int cflag;
+
+/* Print various debug information. */
+int dflag;
+
+/* Perform stricter checking of enum types and operations on enum types. */
+int eflag;
+
+/* Print complete pathnames, not only the basename. */
+int Fflag;
+
+/* Enable some extensions of gcc */
+int gflag;
+
+/* Treat warnings as errors */
+int wflag;
+
+/*
+ * Apply a number of heuristic tests to attempt to intuit bugs, improve
+ * style, and reduce waste.
+ */
+int hflag;
+
+/* Attempt to check portability to other dialects of C. */
+int pflag;
+
+/*
+ * In case of redeclarations/redefinitions print the location of the
+ * previous declaration/definition.
+ */
+int rflag;
+
+/* Strict ANSI C mode. */
+int sflag;
+
+/* Traditional C mode. */
+int tflag;
+
+/* Enable C9X extensions */
+int Sflag;
+/*
+ * Complain about functions and external variables used and not defined,
+ * or defined and not used.
+ */
+int uflag = 1;
+
+/* Complain about unused function arguments. */
+int vflag = 1;
+
+/* Complain about structures which are never defined. */
+int zflag = 1;
+
+err_set msgset;
+
+static void usage(void);
+
+int main(int, char *[]);
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ char *ptr;
+
+ ERR_ZERO(&msgset);
+ while ((c = getopt(argc, argv, "abcdeghmprstuvwyzFSX:")) != -1) {
+ switch (c) {
+ case 'a': aflag++; break;
+ case 'b': bflag = 1; break;
+ case 'c': cflag = 1; break;
+ case 'd': dflag = 1; break;
+ case 'e': eflag = 1; break;
+ case 'F': Fflag = 1; break;
+ case 'g': gflag = 1; break;
+ case 'h': hflag = 1; break;
+ case 'p': pflag = 1; break;
+ case 'r': rflag = 1; break;
+ case 's': sflag = 1; break;
+ case 'S': Sflag = 1; break;
+ case 't': tflag = 1; break;
+ case 'u': uflag = 0; break;
+ case 'w': wflag = 1; break;
+ case 'v': vflag = 0; break;
+ case 'y': yflag = 1; break;
+ case 'z': zflag = 0; break;
+
+ case 'm':
+ msglist();
+ return(0);
+
+ case 'X':
+ for (ptr = strtok(optarg, ","); ptr;
+ ptr = strtok(NULL, ",")) {
+ char *eptr;
+ long msg;
+
+ errno = 0;
+ msg = strtol(ptr, &eptr, 0);
+ if ((msg == LONG_MIN || msg == LONG_MAX) &&
+ errno == ERANGE)
+ err(1, "invalid error message id '%s'",
+ ptr);
+ if (*eptr || ptr == eptr || msg < 0 ||
+ msg >= ERR_SETSIZE)
+ errx(1, "invalid error message id '%s'",
+ ptr);
+ ERR_SET(msg, &msgset);
+ }
+ break;
+ case '?':
+ default:
+ usage();
+ break;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ /* open the input file */
+ if ((yyin = fopen(argv[0], "r")) == NULL)
+ err(1, "cannot open '%s'", argv[0]);
+
+ /* initialize output */
+ outopen(argv[1]);
+
+ if (yflag)
+ yydebug = 1;
+
+ initmem();
+ initdecl();
+ initscan();
+ initmtab();
+
+ yyparse();
+
+ /* Following warnings cannot be suppressed by LINTED */
+ nowarn = 0;
+#ifdef DEBUG
+ printf("%s, %d: nowarn = 0\n", curr_pos.p_file, curr_pos.p_line);
+#endif
+ chkglsyms();
+
+ outclose();
+
+ return (nerr != 0);
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: lint1 [-abcdeghmprstuvwyzFS] [-X <id>[,<id>]... src dest\n");
+ exit(1);
+}
+
+void
+norecover(void)
+{
+ /* cannot recover from previous errors */
+ error(224);
+ exit(1);
+}
diff --git a/usr.bin/xlint/lint1/makeman b/usr.bin/xlint/lint1/makeman
new file mode 100644
index 0000000..922fe5a
--- /dev/null
+++ b/usr.bin/xlint/lint1/makeman
@@ -0,0 +1,80 @@
+#!/bin/sh
+# $NetBSD$
+#
+# Copyright (c) 2000 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Christos Zoulas.
+#
+# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+
+
+cat << \__EOF
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Christos Zoulas.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 5, 2000
+.Dt LINT 7
+.Os
+.Sh NAME
+.Nm lint
+.Nd Lint error message list
+.Sh DESCRIPTION
+The following is a list of message IDs and messages produced by
+.Xr lint 1 .
+It is intended to be used with
+.Fl X
+flag of
+.Xr lint 1 .
+.Bl -column -offset indent "XXXX"
+__EOF
+"$@" | sed -e 's/\\/\\e/g' -e "s/'/\\'/"
+echo ".El"
diff --git a/usr.bin/xlint/lint1/mem1.c b/usr.bin/xlint/lint1/mem1.c
new file mode 100644
index 0000000..3edc6db
--- /dev/null
+++ b/usr.bin/xlint/lint1/mem1.c
@@ -0,0 +1,365 @@
+/* $NetBSD: mem1.c,v 1.7 2002/01/31 19:36:54 tv 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: mem1.c,v 1.7 2002/01/31 19:36:54 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "lint1.h"
+
+/*
+ * Filenames allocated by fnalloc() and fnnalloc() are shared.
+ */
+typedef struct fn {
+ char *fn_name;
+ size_t fn_len;
+ int fn_id;
+ struct fn *fn_nxt;
+} fn_t;
+
+static fn_t *fnames;
+
+static fn_t *srchfn(const char *, size_t);
+
+/*
+ * Look for a Filename of length l.
+ */
+static fn_t *
+srchfn(const char *s, size_t len)
+{
+ fn_t *fn;
+
+ for (fn = fnames; fn != NULL; fn = fn->fn_nxt) {
+ if (fn->fn_len == len && memcmp(fn->fn_name, s, len) == 0)
+ break;
+ }
+ return (fn);
+}
+
+/*
+ * Return a shared string for filename s.
+ */
+const char *
+fnalloc(const char *s)
+{
+
+ return (s != NULL ? fnnalloc(s, strlen(s)) : NULL);
+}
+
+const char *
+fnnalloc(const char *s, size_t len)
+{
+ fn_t *fn;
+
+ static int nxt_id = 0;
+
+ if (s == NULL)
+ return (NULL);
+
+ if ((fn = srchfn(s, len)) == NULL) {
+ if ((fn = malloc(sizeof (fn_t))) == NULL)
+ nomem();
+ /* Do not used strdup() because string is not NUL-terminated.*/
+ if ((fn->fn_name = malloc(len + 1)) == NULL)
+ nomem();
+ (void)memcpy(fn->fn_name, s, len);
+ fn->fn_name[len] = '\0';
+ fn->fn_len = len;
+ fn->fn_id = nxt_id++;
+ fn->fn_nxt = fnames;
+ fnames = fn;
+ /* Write id of this filename to the output file. */
+ outclr();
+ outint(fn->fn_id);
+ outchar('s');
+ outstrg(fn->fn_name);
+ }
+ return (fn->fn_name);
+}
+
+/*
+ * Get id of a filename.
+ */
+int
+getfnid(const char *s)
+{
+ fn_t *fn;
+
+ if (s == NULL || (fn = srchfn(s, strlen(s))) == NULL)
+ return (-1);
+ return (fn->fn_id);
+}
+
+/*
+ * Memory for declarations and other things which must be available
+ * until the end of a block (or the end of the translation unit)
+ * are associated with the level (mblklev) of the block (or with 0).
+ * Because these memory is allocated in large blocks associated with
+ * a given level it can be freed easily at the end of a block.
+ */
+#define ML_INC ((size_t)32) /* Increment for length of *mblks */
+
+typedef struct mbl {
+ void *blk; /* beginning of memory block */
+ void *ffree; /* first free byte */
+ size_t nfree; /* # of free bytes */
+ size_t size; /* total size of memory block */
+ struct mbl *nxt; /* next block */
+} mbl_t;
+
+/*
+ * Array of pointers to lists of memory blocks. mblklev is used as
+ * index into this array.
+ */
+static mbl_t **mblks;
+
+/* number of elements in *mblks */
+static size_t nmblks;
+
+/* free list for memory blocks */
+static mbl_t *frmblks;
+
+/* length of new allocated memory blocks */
+static size_t mblklen;
+
+static void *xgetblk(mbl_t **, size_t);
+static void xfreeblk(mbl_t **);
+static mbl_t *xnewblk(void);
+
+static mbl_t *
+xnewblk(void)
+{
+ mbl_t *mb;
+ int prot, flags;
+
+ if ((mb = malloc(sizeof (mbl_t))) == NULL)
+ nomem();
+
+ /* use mmap instead of malloc to avoid malloc's size overhead */
+
+ prot = PROT_READ | PROT_WRITE;
+ flags = MAP_ANON | MAP_PRIVATE;
+ mb->blk = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
+ if (mb->blk == (void *)MAP_FAILED)
+ err(1, "can't map memory");
+
+ mb->size = mblklen;
+
+ return (mb);
+}
+
+/*
+ * Allocate new memory. If the first block of the list has not enough
+ * free space, or there is no first block, get a new block. The new
+ * block is taken from the free list or, if there is no block on the
+ * free list, is allocated using xnewblk(). If a new block is allocated
+ * it is initialized with zero. Blocks taken from the free list are
+ * zero'd in xfreeblk().
+ */
+static void *
+xgetblk(mbl_t **mbp, size_t s)
+{
+ mbl_t *mb;
+ void *p;
+ size_t t = 0;
+
+ s = LINT_ALIGN(s);
+ if ((mb = *mbp) == NULL || mb->nfree < s) {
+ if ((mb = frmblks) == NULL) {
+ if (s > mblklen) {
+ t = mblklen;
+ mblklen = s;
+ }
+ mb = xnewblk();
+ if (t)
+ mblklen = t;
+ (void)memset(mb->blk, 0, mb->size);
+ } else {
+ frmblks = mb->nxt;
+ }
+ mb->ffree = mb->blk;
+ mb->nfree = mb->size;
+ mb->nxt = *mbp;
+ *mbp = mb;
+ }
+ p = mb->ffree;
+ mb->ffree = (char *)mb->ffree + s;
+ mb->nfree -= s;
+ return (p);
+}
+
+/*
+ * Move all blocks from list *fmbp to free list. For each block, set all
+ * used memory to zero.
+ */
+static void
+xfreeblk(mbl_t **fmbp)
+{
+ mbl_t *mb;
+
+ while ((mb = *fmbp) != NULL) {
+ *fmbp = mb->nxt;
+ mb->nxt = frmblks;
+ frmblks = mb;
+ (void)memset(mb->blk, 0, mb->size - mb->nfree);
+ }
+}
+
+void
+initmem(void)
+{
+ int pgsz;
+
+ pgsz = getpagesize();
+ mblklen = ((MBLKSIZ + pgsz - 1) / pgsz) * pgsz;
+
+ if ((mblks = calloc(nmblks = ML_INC, sizeof (mbl_t *))) == NULL)
+ nomem();
+}
+
+
+/*
+ * Allocate memory associated with level l.
+ */
+void *
+getlblk(int l, size_t s)
+{
+
+ while (l >= nmblks) {
+ if ((mblks = realloc(mblks, (nmblks + ML_INC) *
+ sizeof (mbl_t *))) == NULL)
+ nomem();
+ (void)memset(&mblks[nmblks], 0, ML_INC * sizeof (mbl_t *));
+ nmblks += ML_INC;
+ }
+ return (xgetblk(&mblks[l], s));
+}
+
+void *
+getblk(size_t s)
+{
+
+ return (getlblk(mblklev, s));
+}
+
+/*
+ * Free all memory associated with level l.
+ */
+void
+freelblk(int l)
+{
+
+ xfreeblk(&mblks[l]);
+}
+
+void
+freeblk(void)
+{
+
+ freelblk(mblklev);
+}
+
+/*
+ * tgetblk() returns memory which is associated with the current
+ * expression.
+ */
+static mbl_t *tmblk;
+
+void *
+tgetblk(size_t s)
+{
+
+ return (xgetblk(&tmblk, s));
+}
+
+/*
+ * Get memory for a new tree node.
+ */
+tnode_t *
+getnode(void)
+{
+
+ return (tgetblk(sizeof (tnode_t)));
+}
+
+/*
+ * Free all memory which is allocated by the current expression.
+ */
+void
+tfreeblk(void)
+{
+
+ xfreeblk(&tmblk);
+}
+
+/*
+ * Save the memory which is used by the current expression. This memory
+ * is not freed by the next tfreeblk() call. The pointer returned can be
+ * used to restore the memory.
+ */
+mbl_t *
+tsave(void)
+{
+ mbl_t *tmem;
+
+ tmem = tmblk;
+ tmblk = NULL;
+ return (tmem);
+}
+
+/*
+ * Free all memory used for the current expression and the memory used
+ * be a previous expression and saved by tsave(). The next call to
+ * tfreeblk() frees the restored memory.
+ */
+void
+trestor(mbl_t *tmem)
+{
+
+ tfreeblk();
+ if (tmblk != NULL) {
+ free(tmblk->blk);
+ free(tmblk);
+ }
+ tmblk = tmem;
+}
diff --git a/usr.bin/xlint/lint1/op.h b/usr.bin/xlint/lint1/op.h
new file mode 100644
index 0000000..042195a
--- /dev/null
+++ b/usr.bin/xlint/lint1/op.h
@@ -0,0 +1,120 @@
+/* $NetBSD: op.h,v 1.2 1995/07/03 21:24:27 cgd 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.
+ */
+
+/*
+ * Various information about operators
+ */
+typedef struct {
+ u_int m_binary : 1; /* binary op. */
+ u_int m_logop : 1; /* logical op., result is int */
+ u_int m_rqint : 1; /* operands must have integer type */
+ u_int m_rqsclt : 1; /* operands must have scalar type */
+ u_int m_rqatyp : 1; /* operands must have arithmetic type */
+ u_int m_fold : 1; /* operands should be folded */
+ u_int m_vctx : 1; /* value context for left operand */
+ u_int m_tctx : 1; /* test context for left operand */
+ u_int m_balance : 1; /* op. requires balancing */
+ u_int m_sideeff : 1; /* op. has side effect */
+ u_int m_tlansiu : 1; /* warning if left op. is unsign. in ANSI C */
+ u_int m_transiu : 1; /* warning if right op. is unsign. in ANSI C */
+ u_int m_tpconf : 1; /* test possible precedence confusion */
+ u_int m_comp : 1; /* op. performs comparison */
+ u_int m_enumop : 1; /* valid operation on enums */
+ u_int m_badeop : 1; /* dubious operation on enums */
+ u_int m_eqwarn : 1; /* warning if on operand stems from == */
+ const char *m_name; /* name of op. */
+} mod_t;
+
+typedef enum {
+ NOOP = 0,
+ ARROW,
+ POINT,
+ NOT,
+ COMPL,
+ INC,
+ DEC,
+ INCBEF,
+ DECBEF,
+ INCAFT,
+ DECAFT,
+ UPLUS,
+ UMINUS,
+ STAR,
+ AMPER,
+ MULT,
+ DIV,
+ MOD,
+ PLUS,
+ MINUS,
+ SHL,
+ SHR,
+ LT,
+ LE,
+ GT,
+ GE,
+ EQ,
+ NE,
+ AND,
+ XOR,
+ OR,
+ LOGAND,
+ LOGOR,
+ QUEST,
+ COLON,
+ ASSIGN,
+ MULASS,
+ DIVASS,
+ MODASS,
+ ADDASS,
+ SUBASS,
+ SHLASS,
+ SHRASS,
+ ANDASS,
+ XORASS,
+ ORASS,
+ NAME,
+ CON,
+ STRING,
+ FSEL,
+ CALL,
+ COMMA,
+ CVT,
+ ICALL,
+ LOAD,
+ PUSH,
+ RETURN,
+ INIT, /* pseudo op, not used in trees */
+ CASE, /* pseudo op, not used in trees */
+ FARG /* pseudo op, not used in trees */
+#define NOPS ((int)FARG + 1)
+} op_t;
diff --git a/usr.bin/xlint/lint1/param.h b/usr.bin/xlint/lint1/param.h
new file mode 100644
index 0000000..1e15fbd
--- /dev/null
+++ b/usr.bin/xlint/lint1/param.h
@@ -0,0 +1,143 @@
+/* $NetBSD: param.h,v 1.4 1995/07/23 18:14:41 ragge 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Minimun size of string buffer. If this is not enough, the buffer
+ * is enlarged in steps of STRBLEN bytes.
+ */
+#define STRBLEN 256
+
+/*
+ * This defines the size of memory blocks which are used to allocate
+ * memory in larger chunks.
+ */
+#define MBLKSIZ ((size_t)0x4000)
+
+/*
+ * Sizes of hash tables
+ * Should be a prime. Possible primes are
+ * 307, 401, 503, 601, 701, 809, 907, 1009, 1103, 1201, 1301, 1409, 1511.
+ *
+ * HSHSIZ1 symbol table 1st pass
+ * HSHSIZ2 symbol table 2nd pass
+ * THSHSIZ2 type table 2nd pass
+ */
+#define HSHSIZ1 503
+#define HSHSIZ2 1009
+#define THSHSIZ2 1009
+
+/*
+ * 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.
+ */
+#if __amd64__
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#elif __alpha__
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#elif __i386__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __m68k__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __ns32k__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __powerpc__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __riscv__
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#elif __sparc__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __sparc64__
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#elif __vax__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __arm__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __mips__
+#define PTRDIFF_IS_LONG 0
+#define SIZEOF_IS_ULONG 0
+#elif __aarch64__
+#define PTRDIFF_IS_LONG 1
+#define SIZEOF_IS_ULONG 1
+#else
+#error unknown machine type
+#endif
+
+/*
+ * Make sure this matches wchar_t.
+ */
+#define WCHAR SHORT
+
+#ifndef __GNUC__
+#ifndef lint
+#ifndef QUAD_MAX /* necessary for mkdep */
+#define QUAD_MAX LONG_MAX
+#define QUAD_MIN LONG_MIN
+#define UQUAD_MAX ULONG_MAX
+#endif
+typedef long quad_t;
+typedef u_long u_quad_t;
+#endif
+#endif
+
+
+/*
+ * long double only in ANSI C.
+ */
+#ifdef __STDC__
+typedef long double ldbl_t;
+#else
+typedef double ldbl_t;
+#endif
+
+/*
+ * Some traditional compilers are not able to assign structures.
+ */
+#ifdef __STDC__
+#define STRUCT_ASSIGN(dest, src) (dest) = (src)
+#else
+#define STRUCT_ASSIGN(dest, src) (void)memcpy(&(dest), &(src), \
+ sizeof (dest));
+#endif
diff --git a/usr.bin/xlint/lint1/scan.l b/usr.bin/xlint/lint1/scan.l
new file mode 100644
index 0000000..004cfa6
--- /dev/null
+++ b/usr.bin/xlint/lint1/scan.l
@@ -0,0 +1,1531 @@
+%{
+/* $NetBSD: scan.l,v 1.37 2007/02/06 00:08:31 he Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: scan.l,v 1.37 2007/02/06 00:08:31 he Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <float.h>
+#include <ctype.h>
+#include <errno.h>
+#include <err.h>
+#include <math.h>
+
+#include "lint1.h"
+#include "cgram.h"
+
+#define CHAR_MASK (~(~0 << CHAR_BIT))
+
+/* Current position (its also updated when an included file is parsed) */
+pos_t curr_pos = { 1, "", 0 };
+
+/*
+ * Current position in C source (not updated when an included file is
+ * parsed).
+ */
+pos_t csrc_pos = { 1, "", 0 };
+
+static void incline(void);
+static void badchar(int);
+static sbuf_t *allocsb(void);
+static void freesb(sbuf_t *);
+static int inpc(void);
+static int hash(const char *);
+static sym_t *search(sbuf_t *);
+static int name(void);
+static int keyw(sym_t *);
+static int icon(int);
+static int fcon(void);
+static int operator(int, op_t);
+static int ccon(void);
+static int wccon(void);
+static int getescc(int);
+static void directive(void);
+static void comment(void);
+static void slashslashcomment(void);
+static int string(void);
+static int wcstrg(void);
+
+%}
+
+%option nounput
+
+L [_A-Za-z]
+D [0-9]
+NZD [1-9]
+OD [0-7]
+HD [0-9A-Fa-f]
+EX ([eE][+-]?[0-9]+)
+
+%%
+
+{L}({L}|{D})* return (name());
+0{OD}*[lLuU]* return (icon(8));
+{NZD}{D}*[lLuU]* return (icon(10));
+0[xX]{HD}+[lLuU]* return (icon(16));
+{D}+\.{D}*{EX}?[fFlL]? |
+{D}+{EX}[fFlL]? |
+0[xX]{HD}+p{HD}+[fFlL]? |
+\.{D}+{EX}?[fFlL]? return (fcon());
+"=" return (operator(T_ASSIGN, ASSIGN));
+"*=" return (operator(T_OPASS, MULASS));
+"/=" return (operator(T_OPASS, DIVASS));
+"%=" return (operator(T_OPASS, MODASS));
+"+=" return (operator(T_OPASS, ADDASS));
+"-=" return (operator(T_OPASS, SUBASS));
+"<<=" return (operator(T_OPASS, SHLASS));
+">>=" return (operator(T_OPASS, SHRASS));
+"&=" return (operator(T_OPASS, ANDASS));
+"^=" return (operator(T_OPASS, XORASS));
+"|=" return (operator(T_OPASS, ORASS));
+"||" return (operator(T_LOGOR, LOGOR));
+"&&" return (operator(T_LOGAND, LOGAND));
+"|" return (operator(T_OR, OR));
+"&" return (operator(T_AND, AND));
+"^" return (operator(T_XOR, XOR));
+"==" return (operator(T_EQOP, EQ));
+"!=" return (operator(T_EQOP, NE));
+"<" return (operator(T_RELOP, LT));
+">" return (operator(T_RELOP, GT));
+"<=" return (operator(T_RELOP, LE));
+">=" return (operator(T_RELOP, GE));
+"<<" return (operator(T_SHFTOP, SHL));
+">>" return (operator(T_SHFTOP, SHR));
+"++" return (operator(T_INCDEC, INC));
+"--" return (operator(T_INCDEC, DEC));
+"->" return (operator(T_STROP, ARROW));
+"." return (operator(T_STROP, POINT));
+"+" return (operator(T_ADDOP, PLUS));
+"-" return (operator(T_ADDOP, MINUS));
+"*" return (operator(T_MULT, MULT));
+"/" return (operator(T_DIVOP, DIV));
+"%" return (operator(T_DIVOP, MOD));
+"!" return (operator(T_UNOP, NOT));
+"~" return (operator(T_UNOP, COMPL));
+"\"" return (string());
+"L\"" return (wcstrg());
+";" return (T_SEMI);
+"{" return (T_LBRACE);
+"}" return (T_RBRACE);
+"," return (T_COMMA);
+":" return (T_COLON);
+"?" return (T_QUEST);
+"[" return (T_LBRACK);
+"]" return (T_RBRACK);
+"(" return (T_LPARN);
+")" return (T_RPARN);
+"..." return (T_ELLIPSE);
+"'" return (ccon());
+"L'" return (wccon());
+^#.*$ directive();
+\n incline();
+\t|" "|\f|\v ;
+"/*" comment();
+"//" slashslashcomment();
+. badchar(yytext[0]);
+
+%%
+
+static void
+incline(void)
+{
+ curr_pos.p_line++;
+ curr_pos.p_uniq = 0;
+ if (curr_pos.p_file == csrc_pos.p_file) {
+ csrc_pos.p_line++;
+ csrc_pos.p_uniq = 0;
+ }
+}
+
+static void
+badchar(int c)
+{
+
+ /* unknown character \%o */
+ error(250, c);
+}
+
+/*
+ * Keywords.
+ * During initialisation they are written to the symbol table.
+ */
+static struct kwtab {
+ const char *kw_name; /* keyword */
+ int kw_token; /* token returned by yylex() */
+ scl_t kw_scl; /* storage class if kw_token T_SCLASS */
+ tspec_t kw_tspec; /* type spec. if kw_token T_TYPE or T_SOU */
+ tqual_t kw_tqual; /* type qual. fi kw_token T_QUAL */
+ u_int kw_c89; /* c89 keyword */
+ u_int kw_c99; /* c99 keyword */
+ u_int kw_gcc; /* GCC keyword */
+} kwtab[] = {
+ { "asm", T_ASM, 0, 0, 0, 0, 0, 1 },
+ { "__asm", T_ASM, 0, 0, 0, 0, 0, 0 },
+ { "__asm__", T_ASM, 0, 0, 0, 0, 0, 0 },
+ { "auto", T_SCLASS, AUTO, 0, 0, 0, 0, 0 },
+ { "break", T_BREAK, 0, 0, 0, 0, 0, 0 },
+ { "case", T_CASE, 0, 0, 0, 0, 0, 0 },
+ { "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 },
+ { "const", T_QUAL, 0, 0, CONST, 1, 0, 0 },
+ { "__const__", T_QUAL, 0, 0, CONST, 0, 0, 0 },
+ { "__const", T_QUAL, 0, 0, CONST, 0, 0, 0 },
+ { "continue", T_CONTINUE, 0, 0, 0, 0, 0, 0 },
+ { "default", T_DEFAULT, 0, 0, 0, 0, 0, 0 },
+ { "do", T_DO, 0, 0, 0, 0, 0, 0 },
+ { "double", T_TYPE, 0, DOUBLE, 0, 0, 0, 0 },
+ { "else", T_ELSE, 0, 0, 0, 0, 0, 0 },
+ { "enum", T_ENUM, 0, 0, 0, 0, 0, 0 },
+ { "extern", T_SCLASS, EXTERN, 0, 0, 0, 0, 0 },
+ { "float", T_TYPE, 0, FLOAT, 0, 0, 0, 0 },
+ { "for", T_FOR, 0, 0, 0, 0, 0, 0 },
+ { "goto", T_GOTO, 0, 0, 0, 0, 0, 0 },
+ { "if", T_IF, 0, 0, 0, 0, 0, 0 },
+ { "inline", T_SCLASS, INLINE, 0, 0, 0, 1, 0 },
+ { "__inline__", T_SCLASS, INLINE, 0, 0, 0, 0, 0 },
+ { "__inline", T_SCLASS, INLINE, 0, 0, 0, 0, 0 },
+ { "int", T_TYPE, 0, INT, 0, 0, 0, 0 },
+ { "__symbolrename", T_SYMBOLRENAME, 0, 0, 0, 0, 0, 0 },
+ { "long", T_TYPE, 0, LONG, 0, 0, 0, 0 },
+ { "register", T_SCLASS, REG, 0, 0, 0, 0, 0 },
+ { "return", T_RETURN, 0, 0, 0, 0, 0, 0 },
+ { "short", T_TYPE, 0, SHORT, 0, 0, 0, 0 },
+ { "signed", T_TYPE, 0, SIGNED, 0, 1, 0, 0 },
+ { "__signed__", T_TYPE, 0, SIGNED, 0, 0, 0, 0 },
+ { "__signed", T_TYPE, 0, SIGNED, 0, 0, 0, 0 },
+ { "sizeof", T_SIZEOF, 0, 0, 0, 0, 0, 0 },
+ { "static", T_SCLASS, STATIC, 0, 0, 0, 0, 0 },
+ { "struct", T_SOU, 0, STRUCT, 0, 0, 0, 0 },
+ { "switch", T_SWITCH, 0, 0, 0, 0, 0, 0 },
+ { "typedef", T_SCLASS, TYPEDEF, 0, 0, 0, 0, 0 },
+ { "union", T_SOU, 0, UNION, 0, 0, 0, 0 },
+ { "unsigned", T_TYPE, 0, UNSIGN, 0, 0, 0, 0 },
+ { "void", T_TYPE, 0, VOID, 0, 0, 0, 0 },
+ { "volatile", T_QUAL, 0, 0, VOLATILE, 1, 0, 0 },
+ { "__volatile__", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 },
+ { "__volatile", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 },
+ { "while", T_WHILE, 0, 0, 0, 0, 0, 0 },
+ { NULL, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+/* Symbol table */
+static sym_t *symtab[HSHSIZ1];
+
+/* bit i of the entry with index i is set */
+uint64_t qbmasks[sizeof(uint64_t) * CHAR_BIT];
+
+/* least significant i bits are set in the entry with index i */
+uint64_t qlmasks[sizeof(uint64_t) * CHAR_BIT + 1];
+
+/* least significant i bits are not set in the entry with index i */
+uint64_t qumasks[sizeof(uint64_t) * CHAR_BIT + 1];
+
+/* free list for sbuf structures */
+static sbuf_t *sbfrlst;
+
+/* type of next expected symbol */
+symt_t symtyp;
+
+
+/*
+ * All keywords are written to the symbol table. This saves us looking
+ * in an extra table for each name we found.
+ */
+void
+initscan(void)
+{
+ struct kwtab *kw;
+ sym_t *sym;
+ int h, i;
+ uint64_t uq;
+
+ for (kw = kwtab; kw->kw_name != NULL; kw++) {
+ if ((kw->kw_c89 || kw->kw_c99) && tflag)
+ continue;
+ if (kw->kw_c99 && !(Sflag || gflag))
+ continue;
+ if (kw->kw_gcc && !gflag)
+ continue;
+ sym = getblk(sizeof (sym_t));
+ sym->s_name = kw->kw_name;
+ sym->s_keyw = 1;
+ sym->s_value.v_quad = kw->kw_token;
+ if (kw->kw_token == T_TYPE || kw->kw_token == T_SOU) {
+ sym->s_tspec = kw->kw_tspec;
+ } else if (kw->kw_token == T_SCLASS) {
+ sym->s_scl = kw->kw_scl;
+ } else if (kw->kw_token == T_QUAL) {
+ sym->s_tqual = kw->kw_tqual;
+ }
+ h = hash(sym->s_name);
+ if ((sym->s_link = symtab[h]) != NULL)
+ symtab[h]->s_rlink = &sym->s_link;
+ (symtab[h] = sym)->s_rlink = &symtab[h];
+ }
+
+ /* initialize bit-masks for quads */
+ for (i = 0; i < sizeof (uint64_t) * CHAR_BIT; i++) {
+ qbmasks[i] = (uint64_t)1 << i;
+ uq = ~(uint64_t)0 << i;
+ qumasks[i] = uq;
+ qlmasks[i] = ~uq;
+ }
+ qumasks[i] = 0;
+ qlmasks[i] = ~(uint64_t)0;
+}
+
+/*
+ * Get a free sbuf structure, if possible from the free list
+ */
+static sbuf_t *
+allocsb(void)
+{
+ sbuf_t *sb;
+
+ if ((sb = sbfrlst) != NULL) {
+ sbfrlst = sb->sb_nxt;
+ } else {
+ if ((sb = malloc(sizeof (sbuf_t))) == NULL)
+ nomem();
+ }
+ (void)memset(sb, 0, sizeof (*sb));
+ return (sb);
+}
+
+/*
+ * Put a sbuf structure to the free list
+ */
+static void
+freesb(sbuf_t *sb)
+{
+
+ sb->sb_nxt = sbfrlst;
+ sbfrlst = sb;
+}
+
+/*
+ * Read a character and ensure that it is positive (except EOF).
+ * Increment line count(s) if necessary.
+ */
+static int
+inpc(void)
+{
+ int c;
+
+ if ((c = input()) != EOF && (c &= CHAR_MASK) == '\n')
+ incline();
+ return (c);
+}
+
+static int
+hash(const char *s)
+{
+ u_int v;
+ const u_char *us;
+
+ v = 0;
+ for (us = (const u_char *)s; *us != '\0'; us++) {
+ v = (v << sizeof (v)) + *us;
+ v ^= v >> (sizeof (v) * CHAR_BIT - sizeof (v));
+ }
+ return (v % HSHSIZ1);
+}
+
+/*
+ * Lex has found a letter followed by zero or more letters or digits.
+ * It looks for a symbol in the symbol table with the same name. This
+ * symbol must either be a keyword or a symbol of the type required by
+ * symtyp (label, member, tag, ...).
+ *
+ * If it is a keyword, the token is returned. In some cases it is described
+ * more deeply by data written to yylval.
+ *
+ * If it is a symbol, T_NAME is returned and the pointer to a sbuf struct
+ * is stored in yylval. This struct contains the name of the symbol, it's
+ * length and hash value. If there is already a symbol of the same name
+ * and type in the symbol table, the sbuf struct also contains a pointer
+ * to the symbol table entry.
+ */
+static int
+name(void)
+{
+ char *s;
+ sbuf_t *sb;
+ sym_t *sym;
+ int tok;
+
+ sb = allocsb();
+ sb->sb_name = yytext;
+ sb->sb_len = yyleng;
+ sb->sb_hash = hash(yytext);
+
+ if ((sym = search(sb)) != NULL && sym->s_keyw) {
+ freesb(sb);
+ return (keyw(sym));
+ }
+
+ sb->sb_sym = sym;
+
+ if (sym != NULL) {
+ if (blklev < sym->s_blklev)
+ LERROR("name()");
+ sb->sb_name = sym->s_name;
+ sb->sb_len = strlen(sym->s_name);
+ tok = sym->s_scl == TYPEDEF ? T_TYPENAME : T_NAME;
+ } else {
+ s = getblk(yyleng + 1);
+ (void)memcpy(s, yytext, yyleng + 1);
+ sb->sb_name = s;
+ sb->sb_len = yyleng;
+ tok = T_NAME;
+ }
+
+ yylval.y_sb = sb;
+ return (tok);
+}
+
+static sym_t *
+search(sbuf_t *sb)
+{
+ sym_t *sym;
+
+ for (sym = symtab[sb->sb_hash]; sym != NULL; sym = sym->s_link) {
+ if (strcmp(sym->s_name, sb->sb_name) == 0) {
+ if (sym->s_keyw || sym->s_kind == symtyp)
+ return (sym);
+ }
+ }
+
+ return (NULL);
+}
+
+static int
+keyw(sym_t *sym)
+{
+ int t;
+
+ if ((t = (int)sym->s_value.v_quad) == T_SCLASS) {
+ yylval.y_scl = sym->s_scl;
+ } else if (t == T_TYPE || t == T_SOU) {
+ yylval.y_tspec = sym->s_tspec;
+ } else if (t == T_QUAL) {
+ yylval.y_tqual = sym->s_tqual;
+ }
+ return (t);
+}
+
+/*
+ * Convert a string representing an integer into internal representation.
+ * The value is returned in yylval. icon() (and yylex()) returns T_CON.
+ */
+static int
+icon(int base)
+{
+ int l_suffix, u_suffix;
+ int len;
+ const char *cp;
+ char c, *eptr;
+ tspec_t typ;
+ u_long ul = 0;
+ uint64_t uq = 0;
+ int ansiu;
+ static tspec_t contypes[2][3] = {
+ { INT, LONG, QUAD },
+ { UINT, ULONG, UQUAD }
+ };
+
+ cp = yytext;
+ len = yyleng;
+
+ /* skip 0x */
+ if (base == 16) {
+ cp += 2;
+ len -= 2;
+ }
+
+ /* read suffixes */
+ l_suffix = u_suffix = 0;
+ for ( ; ; ) {
+ if ((c = cp[len - 1]) == 'l' || c == 'L') {
+ l_suffix++;
+ } else if (c == 'u' || c == 'U') {
+ u_suffix++;
+ } else {
+ break;
+ }
+ len--;
+ }
+ if (l_suffix > 2 || u_suffix > 1) {
+ /* malformed integer constant */
+ warning(251);
+ if (l_suffix > 2)
+ l_suffix = 2;
+ if (u_suffix > 1)
+ u_suffix = 1;
+ }
+ if (tflag && u_suffix != 0) {
+ /* suffix U is illegal in traditional C */
+ warning(97);
+ }
+ typ = contypes[u_suffix][l_suffix];
+
+ errno = 0;
+ if (l_suffix < 2) {
+ ul = strtoul(cp, &eptr, base);
+ } else {
+ uq = strtouq(cp, &eptr, base);
+ }
+ if (eptr != cp + len)
+ LERROR("icon()");
+ if (errno != 0)
+ /* integer constant out of range */
+ warning(252);
+
+ /*
+ * If the value is too big for the current type, we must choose
+ * another type.
+ */
+ ansiu = 0;
+ switch (typ) {
+ case INT:
+ if (ul <= INT_MAX) {
+ /* ok */
+ } else if (ul <= (unsigned)UINT_MAX && base != 10) {
+ typ = UINT;
+#if INT_MAX != LONG_MAX
+ } else if (ul <= LONG_MAX) {
+ typ = LONG;
+#endif
+ } else {
+ typ = ULONG;
+ }
+ if (typ == UINT || typ == ULONG) {
+ if (tflag) {
+ typ = LONG;
+ } else if (!sflag) {
+ /*
+ * Remember that the constant is unsigned
+ * only in ANSI C
+ */
+ ansiu = 1;
+ }
+ }
+ break;
+ case UINT:
+ if (ul > (u_int)UINT_MAX)
+ typ = ULONG;
+ break;
+ case LONG:
+ if (ul > LONG_MAX && !tflag) {
+ typ = ULONG;
+ if (!sflag)
+ ansiu = 1;
+ }
+ break;
+ case QUAD:
+ if (uq > QUAD_MAX && !tflag) {
+ typ = UQUAD;
+ if (!sflag)
+ ansiu = 1;
+ }
+ break;
+ /* LINTED (enumeration values not handled in switch) */
+ case STRUCT:
+ case VOID:
+ case LDOUBLE:
+ case FUNC:
+ case ARRAY:
+ case PTR:
+ case ENUM:
+ case UNION:
+ case SIGNED:
+ case NOTSPEC:
+ case DOUBLE:
+ case FLOAT:
+ case UQUAD:
+ case ULONG:
+ case USHORT:
+ case SHORT:
+ case UCHAR:
+ case SCHAR:
+ case CHAR:
+ case UNSIGN:
+ break;
+ }
+
+ if (typ != QUAD && typ != UQUAD) {
+ if (isutyp(typ)) {
+ uq = ul;
+ } else {
+ uq = (int64_t)(long)ul;
+ }
+ }
+
+ uq = (uint64_t)xsign((int64_t)uq, typ, -1);
+
+ if ((yylval.y_val = calloc(1, sizeof(val_t))) == NULL)
+ nomem();
+ yylval.y_val->v_tspec = typ;
+ yylval.y_val->v_ansiu = ansiu;
+ yylval.y_val->v_quad = (int64_t)uq;
+
+ return (T_CON);
+}
+
+/*
+ * Returns 1 if t is a signed type and the value is negative.
+ *
+ * len is the number of significant bits. If len is -1, len is set
+ * to the width of type t.
+ */
+int
+sign(int64_t q, tspec_t t, int len)
+{
+
+ if (t == PTR || isutyp(t))
+ return (0);
+ return (msb(q, t, len));
+}
+
+int
+msb(int64_t q, tspec_t t, int len)
+{
+
+ if (len <= 0)
+ len = size(t);
+ return ((q & qbmasks[len - 1]) != 0);
+}
+
+/*
+ * Extends the sign of q.
+ */
+int64_t
+xsign(int64_t q, tspec_t t, int len)
+{
+
+ if (len <= 0)
+ len = size(t);
+
+ if (t == PTR || isutyp(t) || !sign(q, t, len)) {
+ q &= qlmasks[len];
+ } else {
+ q |= qumasks[len];
+ }
+ return (q);
+}
+
+/*
+ * Convert a string representing a floating point value into its interal
+ * representation. Type and value are returned in yylval. fcon()
+ * (and yylex()) returns T_CON.
+ * XXX Currently it is not possible to convert constants of type
+ * long double which are greater than DBL_MAX.
+ */
+static int
+fcon(void)
+{
+ const char *cp;
+ int len;
+ tspec_t typ;
+ char c, *eptr;
+ double d;
+ float f = 0;
+
+ cp = yytext;
+ len = yyleng;
+
+ if ((c = cp[len - 1]) == 'f' || c == 'F') {
+ typ = FLOAT;
+ len--;
+ } else if (c == 'l' || c == 'L') {
+ typ = LDOUBLE;
+ len--;
+ } else {
+ typ = DOUBLE;
+ }
+
+ if (tflag && typ != DOUBLE) {
+ /* suffixes F and L are illegal in traditional C */
+ warning(98);
+ }
+
+ errno = 0;
+ d = strtod(cp, &eptr);
+ if (eptr != cp + len) {
+ switch (*eptr) {
+ /*
+ * XXX: non-native non-current strtod() may not handle hex
+ * floats, ignore the rest if we find traces of hex float
+ * syntax...
+ */
+ case 'p':
+ case 'P':
+ case 'x':
+ case 'X':
+ d = 0;
+ errno = 0;
+ break;
+ default:
+ LERROR("fcon()");
+ }
+ }
+ if (errno != 0)
+ /* floating-point constant out of range */
+ warning(248);
+
+ if (typ == FLOAT) {
+ f = (float)d;
+ if (!finite(f)) {
+ /* floating-point constant out of range */
+ warning(248);
+ f = f > 0 ? FLT_MAX : -FLT_MAX;
+ }
+ }
+
+ if ((yylval.y_val = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+ yylval.y_val->v_tspec = typ;
+ if (typ == FLOAT) {
+ yylval.y_val->v_ldbl = f;
+ } else {
+ yylval.y_val->v_ldbl = d;
+ }
+
+ return (T_CON);
+}
+
+static int
+operator(int t, op_t o)
+{
+
+ yylval.y_op = o;
+ return (t);
+}
+
+/*
+ * Called if lex found a leading \'.
+ */
+static int
+ccon(void)
+{
+ int n, val, c;
+ char cv;
+
+ n = 0;
+ val = 0;
+ while ((c = getescc('\'')) >= 0) {
+ val = (val << CHAR_BIT) + c;
+ n++;
+ }
+ if (c == -2) {
+ /* unterminated character constant */
+ error(253);
+ } else {
+ if (n > sizeof (int) || (n > 1 && (pflag || hflag))) {
+ /* too many characters in character constant */
+ error(71);
+ } else if (n > 1) {
+ /* multi-character character constant */
+ warning(294);
+ } else if (n == 0) {
+ /* empty character constant */
+ error(73);
+ }
+ }
+ if (n == 1) {
+ cv = (char)val;
+ val = cv;
+ }
+
+ yylval.y_val = xcalloc(1, sizeof (val_t));
+ yylval.y_val->v_tspec = INT;
+ yylval.y_val->v_quad = val;
+
+ return (T_CON);
+}
+
+/*
+ * Called if lex found a leading L\'
+ */
+static int
+wccon(void)
+{
+ static char buf[MB_LEN_MAX + 1];
+ int i, c;
+ wchar_t wc;
+
+ i = 0;
+ while ((c = getescc('\'')) >= 0) {
+ if (i < MB_CUR_MAX)
+ buf[i] = (char)c;
+ i++;
+ }
+
+ wc = 0;
+
+ if (c == -2) {
+ /* unterminated character constant */
+ error(253);
+ } else if (c == 0) {
+ /* empty character constant */
+ error(73);
+ } else {
+ if (i > MB_CUR_MAX) {
+ i = MB_CUR_MAX;
+ /* too many characters in character constant */
+ error(71);
+ } else {
+ buf[i] = '\0';
+ (void)mbtowc(NULL, NULL, 0);
+ if (mbtowc(&wc, buf, MB_CUR_MAX) < 0)
+ /* invalid multibyte character */
+ error(291);
+ }
+ }
+
+ if ((yylval.y_val = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+ yylval.y_val->v_tspec = WCHAR;
+ yylval.y_val->v_quad = wc;
+
+ return (T_CON);
+}
+
+/*
+ * Read a character which is part of a character constant or of a string
+ * and handle escapes.
+ *
+ * The Argument is the character which delimits the character constant or
+ * string.
+ *
+ * Returns -1 if the end of the character constant or string is reached,
+ * -2 if the EOF is reached, and the character otherwise.
+ */
+static int
+getescc(int d)
+{
+ static int pbc = -1;
+ int n, c, v;
+
+ if (pbc == -1) {
+ c = inpc();
+ } else {
+ c = pbc;
+ pbc = -1;
+ }
+ if (c == d)
+ return (-1);
+ switch (c) {
+ case '\n':
+ if (tflag) {
+ /* newline in string or char constant */
+ error(254);
+ return (-2);
+ }
+ return (c);
+ case EOF:
+ return (-2);
+ case '\\':
+ switch (c = inpc()) {
+ case '"':
+ if (tflag && d == '\'')
+ /* \" inside character constant undef. ... */
+ warning(262);
+ return ('"');
+ case '\'':
+ return ('\'');
+ case '?':
+ if (tflag)
+ /* \? undefined in traditional C */
+ warning(263);
+ return ('?');
+ case '\\':
+ return ('\\');
+ case 'a':
+ if (tflag)
+ /* \a undefined in traditional C */
+ warning(81);
+ return ('\a');
+ case 'b':
+ return ('\b');
+ case 'f':
+ return ('\f');
+ case 'n':
+ return ('\n');
+ case 'r':
+ return ('\r');
+ case 't':
+ return ('\t');
+ case 'v':
+ if (tflag)
+ /* \v undefined in traditional C */
+ warning(264);
+ return ('\v');
+ case '8': case '9':
+ /* bad octal digit %c */
+ warning(77, c);
+ /* FALLTHROUGH */
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ n = 3;
+ v = 0;
+ do {
+ v = (v << 3) + (c - '0');
+ c = inpc();
+ } while (--n && isdigit(c) && (tflag || c <= '7'));
+ if (tflag && n > 0 && isdigit(c))
+ /* bad octal digit %c */
+ warning(77, c);
+ pbc = c;
+ if (v > UCHAR_MAX) {
+ /* character escape does not fit in char. */
+ warning(76);
+ v &= CHAR_MASK;
+ }
+ return (v);
+ case 'x':
+ if (tflag)
+ /* \x undefined in traditional C */
+ warning(82);
+ v = 0;
+ n = 0;
+ while ((c = inpc()) >= 0 && isxdigit(c)) {
+ c = isdigit(c) ?
+ c - '0' : toupper(c) - 'A' + 10;
+ v = (v << 4) + c;
+ if (n >= 0) {
+ if ((v & ~CHAR_MASK) != 0) {
+ /* overflow in hex escape */
+ warning(75);
+ n = -1;
+ } else {
+ n++;
+ }
+ }
+ }
+ pbc = c;
+ if (n == 0) {
+ /* no hex digits follow \x */
+ error(74);
+ } if (n == -1) {
+ v &= CHAR_MASK;
+ }
+ return (v);
+ case '\n':
+ return (getescc(d));
+ case EOF:
+ return (-2);
+ default:
+ if (isprint(c)) {
+ /* dubious escape \%c */
+ warning(79, c);
+ } else {
+ /* dubious escape \%o */
+ warning(80, c);
+ }
+ }
+ }
+ return (c);
+}
+
+/*
+ * Called for preprocessor directives. Currently implemented are:
+ * # lineno
+ * # lineno "filename"
+ */
+static void
+directive(void)
+{
+ const char *cp, *fn;
+ char c, *eptr;
+ size_t fnl;
+ long ln;
+ static int first = 1;
+
+ /* Go to first non-whitespace after # */
+ for (cp = yytext + 1; (c = *cp) == ' ' || c == '\t'; cp++)
+ continue;
+
+ if (!isdigit((unsigned char)c)) {
+ error:
+ /* undefined or invalid # directive */
+ warning(255);
+ return;
+ }
+ ln = strtol(--cp, &eptr, 10);
+ if (cp == eptr)
+ goto error;
+ if ((c = *(cp = eptr)) != ' ' && c != '\t' && c != '\0')
+ goto error;
+ while ((c = *cp++) == ' ' || c == '\t')
+ continue;
+ if (c != '\0') {
+ if (c != '"')
+ goto error;
+ fn = cp;
+ while ((c = *cp) != '"' && c != '\0')
+ cp++;
+ if (c != '"')
+ goto error;
+ if ((fnl = cp++ - fn) > PATH_MAX)
+ goto error;
+ while ((c = *cp++) == ' ' || c == '\t')
+ continue;
+#if 0
+ if (c != '\0')
+ warning("extra character(s) after directive");
+#endif
+
+ /* empty string means stdin */
+ if (fnl == 0) {
+ fn = "{standard input}";
+ fnl = 16; /* strlen (fn) */
+ }
+ curr_pos.p_file = fnnalloc(fn, fnl);
+ /*
+ * If this is the first directive, the name is the name
+ * of the C source file as specified at the command line.
+ * It is written to the output file.
+ */
+ if (first) {
+ csrc_pos.p_file = curr_pos.p_file;
+ outsrc(curr_pos.p_file);
+ first = 0;
+ }
+ }
+ curr_pos.p_line = (int)ln - 1;
+ curr_pos.p_uniq = 0;
+ if (curr_pos.p_file == csrc_pos.p_file) {
+ csrc_pos.p_line = (int)ln - 1;
+ csrc_pos.p_uniq = 0;
+ }
+}
+
+/*
+ * Handle lint comments. Following comments are currently understood:
+ * ARGSUSEDn
+ * BITFIELDTYPE
+ * CONSTCOND CONSTANTCOND CONSTANTCONDITION
+ * FALLTHRU FALLTHROUGH
+ * LINTLIBRARY
+ * LINTED NOSTRICT
+ * LONGLONG
+ * NOTREACHED
+ * PRINTFLIKEn
+ * PROTOLIB
+ * SCANFLIKEn
+ * VARARGSn
+ * If one of this comments is recognized, the arguments, if any, are
+ * parsed and a function which handles this comment is called.
+ */
+static void
+comment(void)
+{
+ int c, lc;
+ static struct {
+ const char *keywd;
+ int arg;
+ void (*func)(int);
+ } keywtab[] = {
+ { "ARGSUSED", 1, argsused },
+ { "BITFIELDTYPE", 0, bitfieldtype },
+ { "CONSTCOND", 0, constcond },
+ { "CONSTANTCOND", 0, constcond },
+ { "CONSTANTCONDITION", 0, constcond },
+ { "FALLTHRU", 0, fallthru },
+ { "FALLTHROUGH", 0, fallthru },
+ { "LINTLIBRARY", 0, lintlib },
+ { "LINTED", 0, linted },
+ { "LONGLONG", 0, longlong },
+ { "NOSTRICT", 0, linted },
+ { "NOTREACHED", 0, notreach },
+ { "PRINTFLIKE", 1, printflike },
+ { "PROTOLIB", 1, protolib },
+ { "SCANFLIKE", 1, scanflike },
+ { "VARARGS", 1, varargs },
+ };
+ char keywd[32];
+ char arg[32];
+ int l, i, a;
+ int eoc;
+
+ eoc = 0;
+
+ /* Skip white spaces after the start of the comment */
+ while ((c = inpc()) != EOF && isspace(c))
+ continue;
+
+ /* Read the potential keyword to keywd */
+ l = 0;
+ while (c != EOF && isupper(c) && l < sizeof (keywd) - 1) {
+ keywd[l++] = (char)c;
+ c = inpc();
+ }
+ keywd[l] = '\0';
+
+ /* look for the keyword */
+ for (i = 0; i < sizeof (keywtab) / sizeof (keywtab[0]); i++) {
+ if (strcmp(keywtab[i].keywd, keywd) == 0)
+ break;
+ }
+ if (i == sizeof (keywtab) / sizeof (keywtab[0]))
+ goto skip_rest;
+
+ /* skip white spaces after the keyword */
+ while (c != EOF && isspace(c))
+ c = inpc();
+
+ /* read the argument, if the keyword accepts one and there is one */
+ l = 0;
+ if (keywtab[i].arg) {
+ while (c != EOF && isdigit(c) && l < sizeof (arg) - 1) {
+ arg[l++] = (char)c;
+ c = inpc();
+ }
+ }
+ arg[l] = '\0';
+ a = l != 0 ? atoi(arg) : -1;
+
+ /* skip white spaces after the argument */
+ while (c != EOF && isspace(c))
+ c = inpc();
+
+ if (c != '*' || (c = inpc()) != '/') {
+ if (keywtab[i].func != linted)
+ /* extra characters in lint comment */
+ warning(257);
+ } else {
+ /*
+ * remember that we have already found the end of the
+ * comment
+ */
+ eoc = 1;
+ }
+
+ if (keywtab[i].func != NULL)
+ (*keywtab[i].func)(a);
+
+ skip_rest:
+ while (!eoc) {
+ lc = c;
+ if ((c = inpc()) == EOF) {
+ /* unterminated comment */
+ error(256);
+ break;
+ }
+ if (lc == '*' && c == '/')
+ eoc = 1;
+ }
+}
+
+/*
+ * Handle // style comments
+ */
+static void
+slashslashcomment(void)
+{
+ int c;
+
+ if (!Sflag && !gflag)
+ /* // comments only supported in C99 */
+ (void)gnuism(312, tflag ? "traditional" : "ANSI");
+
+ while ((c = inpc()) != EOF && c != '\n')
+ continue;
+}
+
+/*
+ * Clear flags for lint comments LINTED, LONGLONG and CONSTCOND.
+ * clrwflgs() is called after function definitions and global and
+ * local declarations and definitions. It is also called between
+ * the controlling expression and the body of control statements
+ * (if, switch, for, while).
+ */
+void
+clrwflgs(void)
+{
+
+ nowarn = 0;
+ quadflg = 0;
+ ccflg = 0;
+}
+
+/*
+ * Strings are stored in a dynamically alloceted buffer and passed
+ * in yylval.y_xstrg to the parser. The parser or the routines called
+ * by the parser are responsible for freeing this buffer.
+ */
+static int
+string(void)
+{
+ u_char *s;
+ int c;
+ size_t len, max;
+ strg_t *strg;
+
+ if ((s = malloc(max = 64)) == NULL)
+ nomem();
+
+ len = 0;
+ while ((c = getescc('"')) >= 0) {
+ /* +1 to reserve space for a trailing NUL character */
+ if (len + 1 == max)
+ if ((s = realloc(s, max *= 2)) == NULL)
+ nomem();
+ s[len++] = (char)c;
+ }
+ s[len] = '\0';
+ if (c == -2)
+ /* unterminated string constant */
+ error(258);
+
+ if ((strg = calloc(1, sizeof (strg_t))) == NULL)
+ nomem();
+ strg->st_tspec = CHAR;
+ strg->st_len = len;
+ strg->st_cp = s;
+
+ yylval.y_strg = strg;
+ return (T_STRING);
+}
+
+static int
+wcstrg(void)
+{
+ char *s;
+ int c, i, n, wi;
+ size_t len, max, wlen;
+ wchar_t *ws;
+ strg_t *strg;
+
+ if ((s = malloc(max = 64)) == NULL)
+ nomem();
+ len = 0;
+ while ((c = getescc('"')) >= 0) {
+ /* +1 to save space for a trailing NUL character */
+ if (len + 1 >= max)
+ if ((s = realloc(s, max *= 2)) == NULL)
+ nomem();
+ s[len++] = (char)c;
+ }
+ s[len] = '\0';
+ if (c == -2)
+ /* unterminated string constant */
+ error(258);
+
+ /* get length of wide character string */
+ (void)mblen(NULL, 0);
+ for (i = 0, wlen = 0; i < len; i += n, wlen++) {
+ if ((n = mblen(&s[i], MB_CUR_MAX)) == -1) {
+ /* invalid multibyte character */
+ error(291);
+ break;
+ }
+ if (n == 0)
+ n = 1;
+ }
+
+ if ((ws = malloc((wlen + 1) * sizeof (wchar_t))) == NULL)
+ nomem();
+
+ /* convert from multibyte to wide char */
+ (void)mbtowc(NULL, NULL, 0);
+ for (i = 0, wi = 0; i < len; i += n, wi++) {
+ if ((n = mbtowc(&ws[wi], &s[i], MB_CUR_MAX)) == -1)
+ break;
+ if (n == 0)
+ n = 1;
+ }
+ ws[wi] = 0;
+ free(s);
+
+ if ((strg = calloc(1, sizeof (strg_t))) == NULL)
+ nomem();
+ strg->st_tspec = WCHAR;
+ strg->st_len = wlen;
+ strg->st_wcp = ws;
+
+ yylval.y_strg = strg;
+ return (T_STRING);
+}
+
+/*
+ * As noted above the scanner does not create new symbol table entries
+ * for symbols it cannot find in the symbol table. This is to avoid
+ * putting undeclared symbols into the symbol table if a syntax error
+ * occurs.
+ *
+ * getsym() is called as soon as it is probably ok to put the symbol to
+ * the symbol table. This does not mean that it is not possible that
+ * symbols are put to the symbol table which are than not completely
+ * declared due to syntax errors. To avoid too many problems in this
+ * case symbols get type int in getsym().
+ *
+ * XXX calls to getsym() should be delayed until decl1*() is called
+ */
+sym_t *
+getsym(sbuf_t *sb)
+{
+ dinfo_t *di;
+ char *s;
+ sym_t *sym;
+
+ sym = sb->sb_sym;
+
+ /*
+ * During member declaration it is possible that name() looked
+ * for symbols of type FVFT, although it should have looked for
+ * symbols of type FTAG. Same can happen for labels. Both cases
+ * are compensated here.
+ */
+ if (symtyp == FMOS || symtyp == FLAB) {
+ if (sym == NULL || sym->s_kind == FVFT)
+ sym = search(sb);
+ }
+
+ if (sym != NULL) {
+ if (sym->s_kind != symtyp)
+ LERROR("storesym()");
+ symtyp = FVFT;
+ freesb(sb);
+ return (sym);
+ }
+
+ /* create a new symbol table entry */
+
+ /* labels must always be allocated at level 1 (outhermost block) */
+ if (symtyp == FLAB) {
+ sym = getlblk(1, sizeof (sym_t));
+ s = getlblk(1, sb->sb_len + 1);
+ (void)memcpy(s, sb->sb_name, sb->sb_len + 1);
+ sym->s_name = s;
+ sym->s_blklev = 1;
+ di = dcs;
+ while (di->d_nxt != NULL && di->d_nxt->d_nxt != NULL)
+ di = di->d_nxt;
+ if (di->d_ctx != AUTO)
+ LERROR("storesym()");
+ } else {
+ sym = getblk(sizeof (sym_t));
+ sym->s_name = sb->sb_name;
+ sym->s_blklev = blklev;
+ di = dcs;
+ }
+
+ UNIQUE_CURR_POS(sym->s_dpos);
+ if ((sym->s_kind = symtyp) != FLAB)
+ sym->s_type = gettyp(INT);
+
+ symtyp = FVFT;
+
+ if ((sym->s_link = symtab[sb->sb_hash]) != NULL)
+ symtab[sb->sb_hash]->s_rlink = &sym->s_link;
+ (symtab[sb->sb_hash] = sym)->s_rlink = &symtab[sb->sb_hash];
+
+ *di->d_ldlsym = sym;
+ di->d_ldlsym = &sym->s_dlnxt;
+
+ freesb(sb);
+ return (sym);
+}
+
+/*
+ * Construct a temporary symbol. The symbol starts with a digit, so that
+ * it is illegal.
+ */
+sym_t *
+mktempsym(type_t *t)
+{
+ static int n = 0;
+ int h;
+ char *s = getlblk(blklev, 64);
+ sym_t *sym = getblk(sizeof (sym_t));
+
+ (void)snprintf(s, 64, "%.8d_tmp", n++);
+ h = hash(s);
+
+ sym->s_name = s;
+ sym->s_type = t;
+ sym->s_blklev = blklev;
+ sym->s_scl = AUTO;
+ sym->s_kind = FVFT;
+ sym->s_used = 1;
+ sym->s_set = 1;
+
+ if ((sym->s_link = symtab[h]) != NULL)
+ symtab[h]->s_rlink = &sym->s_link;
+ (symtab[h] = sym)->s_rlink = &symtab[h];
+
+ *dcs->d_ldlsym = sym;
+ dcs->d_ldlsym = &sym->s_dlnxt;
+
+ return sym;
+}
+
+/*
+ * Remove a symbol forever from the symbol table. s_blklev
+ * is set to -1 to avoid that the symbol will later be put
+ * back to the symbol table.
+ */
+void
+rmsym(sym_t *sym)
+{
+
+ if ((*sym->s_rlink = sym->s_link) != NULL)
+ sym->s_link->s_rlink = sym->s_rlink;
+ sym->s_blklev = -1;
+ sym->s_link = NULL;
+}
+
+/*
+ * Remove a list of symbols declared at one level from the symbol
+ * table.
+ */
+void
+rmsyms(sym_t *syms)
+{
+ sym_t *sym;
+
+ for (sym = syms; sym != NULL; sym = sym->s_dlnxt) {
+ if (sym->s_blklev != -1) {
+ if ((*sym->s_rlink = sym->s_link) != NULL)
+ sym->s_link->s_rlink = sym->s_rlink;
+ sym->s_link = NULL;
+ sym->s_rlink = NULL;
+ }
+ }
+}
+
+/*
+ * Put a symbol into the symbol table
+ */
+void
+inssym(int bl, sym_t *sym)
+{
+ int h;
+
+ h = hash(sym->s_name);
+ if ((sym->s_link = symtab[h]) != NULL)
+ symtab[h]->s_rlink = &sym->s_link;
+ (symtab[h] = sym)->s_rlink = &symtab[h];
+ sym->s_blklev = bl;
+ if (sym->s_link != NULL && sym->s_blklev < sym->s_link->s_blklev)
+ LERROR("inssym()");
+}
+
+/*
+ * Called at level 0 after syntax errors
+ * Removes all symbols which are not declared at level 0 from the
+ * symbol table. Also frees all memory which is not associated with
+ * level 0.
+ */
+void
+cleanup(void)
+{
+ sym_t *sym, *nsym;
+ int i;
+
+ for (i = 0; i < HSHSIZ1; i++) {
+ for (sym = symtab[i]; sym != NULL; sym = nsym) {
+ nsym = sym->s_link;
+ if (sym->s_blklev >= 1) {
+ if ((*sym->s_rlink = nsym) != NULL)
+ nsym->s_rlink = sym->s_rlink;
+ }
+ }
+ }
+
+ for (i = mblklev; i > 0; i--)
+ freelblk(i);
+}
+
+/*
+ * Create a new symbol with the name of an existing symbol.
+ */
+sym_t *
+pushdown(sym_t *sym)
+{
+ int h;
+ sym_t *nsym;
+
+ h = hash(sym->s_name);
+ nsym = getblk(sizeof (sym_t));
+ if (sym->s_blklev > blklev)
+ LERROR("pushdown()");
+ nsym->s_name = sym->s_name;
+ UNIQUE_CURR_POS(nsym->s_dpos);
+ nsym->s_kind = sym->s_kind;
+ nsym->s_blklev = blklev;
+
+ if ((nsym->s_link = symtab[h]) != NULL)
+ symtab[h]->s_rlink = &nsym->s_link;
+ (symtab[h] = nsym)->s_rlink = &symtab[h];
+
+ *dcs->d_ldlsym = nsym;
+ dcs->d_ldlsym = &nsym->s_dlnxt;
+
+ return (nsym);
+}
+
+/*
+ * Free any dynamically allocated memory referenced by
+ * the value stack or yylval.
+ * The type of information in yylval is described by tok.
+ */
+void
+freeyyv(void *sp, int tok)
+{
+ if (tok == T_NAME || tok == T_TYPENAME) {
+ sbuf_t *sb = *(sbuf_t **)sp;
+ freesb(sb);
+ } else if (tok == T_CON) {
+ val_t *val = *(val_t **)sp;
+ free(val);
+ } else if (tok == T_STRING) {
+ strg_t *strg = *(strg_t **)sp;
+ if (strg->st_tspec == CHAR) {
+ free(strg->st_cp);
+ } else if (strg->st_tspec == WCHAR) {
+ free(strg->st_wcp);
+ } else {
+ LERROR("fryylv()");
+ }
+ free(strg);
+ }
+}
diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c
new file mode 100644
index 0000000..931c77e
--- /dev/null
+++ b/usr.bin/xlint/lint1/tree.c
@@ -0,0 +1,4040 @@
+/* $NetBSD: tree.c,v 1.45 2008/03/04 02:41:46 christos 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: tree.c,v 1.45 2008/03/04 02:41:46 christos Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+
+#include "lint1.h"
+#include "cgram.h"
+
+/* Various flags for each operator. */
+static mod_t modtab[NOPS];
+
+static tnode_t *getinode(tspec_t, int64_t);
+static void ptrcmpok(op_t, tnode_t *, tnode_t *);
+static int asgntypok(op_t, int, tnode_t *, tnode_t *);
+static void chkbeop(op_t, tnode_t *, tnode_t *);
+static void chkeop2(op_t, int, tnode_t *, tnode_t *);
+static void chkeop1(op_t, int, tnode_t *, tnode_t *);
+static tnode_t *mktnode(op_t, type_t *, tnode_t *, tnode_t *);
+static void balance(op_t, tnode_t **, tnode_t **);
+static void incompat(op_t, tspec_t, tspec_t);
+static void illptrc(mod_t *, type_t *, type_t *);
+static void mrgqual(type_t **, type_t *, type_t *);
+static int conmemb(type_t *);
+static void ptconv(int, tspec_t, tspec_t, type_t *, tnode_t *);
+static void iiconv(op_t, int, tspec_t, tspec_t, type_t *, tnode_t *);
+static void piconv(op_t, tspec_t, type_t *, tnode_t *);
+static void ppconv(op_t, tnode_t *, type_t *);
+static tnode_t *bldstr(op_t, tnode_t *, tnode_t *);
+static tnode_t *bldincdec(op_t, tnode_t *);
+static tnode_t *bldamper(tnode_t *, int);
+static tnode_t *bldplmi(op_t, tnode_t *, tnode_t *);
+static tnode_t *bldshft(op_t, tnode_t *, tnode_t *);
+static tnode_t *bldcol(tnode_t *, tnode_t *);
+static tnode_t *bldasgn(op_t, tnode_t *, tnode_t *);
+static tnode_t *plength(type_t *);
+static tnode_t *fold(tnode_t *);
+static tnode_t *foldtst(tnode_t *);
+static tnode_t *foldflt(tnode_t *);
+static tnode_t *chkfarg(type_t *, tnode_t *);
+static tnode_t *parg(int, type_t *, tnode_t *);
+static void nulleff(tnode_t *);
+static void displexpr(tnode_t *, int);
+static void chkaidx(tnode_t *, int);
+static void chkcomp(op_t, tnode_t *, tnode_t *);
+static void precconf(tnode_t *);
+
+/*
+ * Initialize mods of operators.
+ */
+void
+initmtab(void)
+{
+ static struct {
+ op_t op;
+ mod_t m;
+ } imods[] = {
+ { ARROW, { 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+ "->" } },
+ { POINT, { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "." } },
+ { NOT, { 0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,
+ "!" } },
+ { COMPL, { 0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1,
+ "~" } },
+ { INCBEF, { 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "prefix++" } },
+ { DECBEF, { 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "prefix--" } },
+ { INCAFT, { 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "postfix++" } },
+ { DECAFT, { 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "postfix--" } },
+ { UPLUS, { 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,
+ "unary +" } },
+ { UMINUS, { 0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,1,
+ "unary -" } },
+ { STAR, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+ "unary *" } },
+ { AMPER, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "unary &" } },
+ { MULT, { 1,0,0,0,1,1,1,0,1,0,0,1,0,0,0,1,1,
+ "*" } },
+ { DIV, { 1,0,0,0,1,1,1,0,1,0,1,1,0,0,0,1,1,
+ "/" } },
+ { MOD, { 1,0,1,0,0,1,1,0,1,0,1,1,0,0,0,1,1,
+ "%" } },
+ { PLUS, { 1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,
+ "+" } },
+ { MINUS, { 1,0,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,
+ "-" } },
+ { SHL, { 1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,1,
+ "<<" } },
+ { SHR, { 1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,1,1,
+ ">>" } },
+ { LT, { 1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,
+ "<" } },
+ { LE, { 1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,
+ "<=" } },
+ { GT, { 1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,
+ ">" } },
+ { GE, { 1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,
+ ">=" } },
+ { EQ, { 1,1,0,1,0,1,1,0,1,0,0,0,0,1,1,0,1,
+ "==" } },
+ { NE, { 1,1,0,1,0,1,1,0,1,0,0,0,0,1,1,0,1,
+ "!=" } },
+ { AND, { 1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,
+ "&" } },
+ { XOR, { 1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,
+ "^" } },
+ { OR, { 1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,
+ "|" } },
+ { LOGAND, { 1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,
+ "&&" } },
+ { LOGOR, { 1,1,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,
+ "||" } },
+ { QUEST, { 1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,
+ "?" } },
+ { COLON, { 1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,
+ ":" } },
+ { ASSIGN, { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,
+ "=" } },
+ { MULASS, { 1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,
+ "*=" } },
+ { DIVASS, { 1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,
+ "/=" } },
+ { MODASS, { 1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,
+ "%=" } },
+ { ADDASS, { 1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "+=" } },
+ { SUBASS, { 1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "-=" } },
+ { SHLASS, { 1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "<<=" } },
+ { SHRASS, { 1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ ">>=" } },
+ { ANDASS, { 1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "&=" } },
+ { XORASS, { 1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "^=" } },
+ { ORASS, { 1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
+ "|=" } },
+ { NAME, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "NAME" } },
+ { CON, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "CON" } },
+ { STRING, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "STRING" } },
+ { FSEL, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "FSEL" } },
+ { CALL, { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+ "CALL" } },
+ { COMMA, { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
+ "," } },
+ { CVT, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+ "CVT" } },
+ { ICALL, { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+ "ICALL" } },
+ { LOAD, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ "LOAD" } },
+ { PUSH, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+ "PUSH" } },
+ { RETURN, { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,
+ "RETURN" } },
+ { INIT, { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+ "INIT" } },
+ { FARG, { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+ "FARG" } },
+ { NOOP }
+ };
+ int i;
+
+ for (i = 0; imods[i].op != NOOP; i++)
+ STRUCT_ASSIGN(modtab[imods[i].op], imods[i].m);
+}
+
+/*
+ * Increase degree of reference.
+ * This is most often used to change type "T" in type "pointer to T".
+ */
+type_t *
+incref(type_t *tp, tspec_t t)
+{
+ type_t *tp2;
+
+ tp2 = getblk(sizeof (type_t));
+ tp2->t_tspec = t;
+ tp2->t_subt = tp;
+ return (tp2);
+}
+
+/*
+ * same for use in expressions
+ */
+type_t *
+tincref(type_t *tp, tspec_t t)
+{
+ type_t *tp2;
+
+ tp2 = tgetblk(sizeof (type_t));
+ tp2->t_tspec = t;
+ tp2->t_subt = tp;
+ return (tp2);
+}
+
+/*
+ * Create a node for a constant.
+ */
+tnode_t *
+getcnode(type_t *tp, val_t *v)
+{
+ tnode_t *n;
+
+ n = getnode();
+ n->tn_op = CON;
+ n->tn_type = tp;
+ n->tn_val = tgetblk(sizeof (val_t));
+ n->tn_val->v_tspec = tp->t_tspec;
+ n->tn_val->v_ansiu = v->v_ansiu;
+ n->tn_val->v_u = v->v_u;
+ free(v);
+ return (n);
+}
+
+/*
+ * Create a node for an integer constant.
+ */
+static tnode_t *
+getinode(tspec_t t, int64_t q)
+{
+ tnode_t *n;
+
+ n = getnode();
+ n->tn_op = CON;
+ n->tn_type = gettyp(t);
+ n->tn_val = tgetblk(sizeof (val_t));
+ n->tn_val->v_tspec = t;
+ n->tn_val->v_quad = q;
+ return (n);
+}
+
+/*
+ * Create a node for a name (symbol table entry).
+ * ntok is the token which follows the name.
+ */
+tnode_t *
+getnnode(sym_t *sym, int ntok)
+{
+ tnode_t *n;
+
+ if (sym->s_scl == NOSCL) {
+ sym->s_scl = EXTERN;
+ sym->s_def = DECL;
+ if (ntok == T_LPARN) {
+ if (sflag) {
+ /* function implicitly declared to ... */
+ warning(215);
+ }
+ /*
+ * XXX if tflag is set the symbol should be
+ * exported to level 0
+ */
+ sym->s_type = incref(sym->s_type, FUNC);
+ } else {
+ if (!blklev) {
+ /* %s undefined */
+ error(99, sym->s_name);
+ } else {
+ int fixtype;
+ if (strcmp(sym->s_name, "__FUNCTION__") == 0) {
+ gnuism(316);
+ fixtype = 1;
+ } else if (strcmp(sym->s_name, "__func__") == 0) {
+ if (!Sflag)
+ warning(317);
+ fixtype = 1;
+ } else {
+ error(99, sym->s_name);
+ fixtype = 0;
+ }
+ if (fixtype) {
+ sym->s_type = incref(gettyp(CHAR), PTR);
+ sym->s_type->t_const = 1;
+ }
+ }
+ }
+ }
+
+ if (sym->s_kind != FVFT && sym->s_kind != FMOS)
+ LERROR("getnnode()");
+
+ n = getnode();
+ n->tn_type = sym->s_type;
+ if (sym->s_scl != ENUMCON) {
+ n->tn_op = NAME;
+ n->tn_sym = sym;
+ if (sym->s_kind == FVFT && sym->s_type->t_tspec != FUNC)
+ n->tn_lvalue = 1;
+ } else {
+ n->tn_op = CON;
+ n->tn_val = tgetblk(sizeof (val_t));
+ *n->tn_val = sym->s_value;
+ }
+
+ return (n);
+}
+
+/*
+ * Create a node for a string.
+ */
+tnode_t *
+getsnode(strg_t *strg)
+{
+ size_t len;
+ tnode_t *n;
+
+ len = strg->st_len;
+
+ n = getnode();
+
+ n->tn_op = STRING;
+ n->tn_type = tincref(gettyp(strg->st_tspec), ARRAY);
+ n->tn_type->t_dim = len + 1;
+ n->tn_lvalue = 1;
+
+ n->tn_strg = tgetblk(sizeof (strg_t));
+ n->tn_strg->st_tspec = strg->st_tspec;
+ n->tn_strg->st_len = len;
+
+ if (strg->st_tspec == CHAR) {
+ n->tn_strg->st_cp = tgetblk(len + 1);
+ (void)memcpy(n->tn_strg->st_cp, strg->st_cp, len + 1);
+ free(strg->st_cp);
+ } else {
+ n->tn_strg->st_wcp = tgetblk((len + 1) * sizeof (wchar_t));
+ (void)memcpy(n->tn_strg->st_wcp, strg->st_wcp,
+ (len + 1) * sizeof (wchar_t));
+ free(strg->st_wcp);
+ }
+ free(strg);
+
+ return (n);
+}
+
+/*
+ * Returns a symbol which has the same name as the msym argument and is a
+ * member of the struct or union specified by the tn argument.
+ */
+sym_t *
+strmemb(tnode_t *tn, op_t op, sym_t *msym)
+{
+ str_t *str;
+ type_t *tp;
+ sym_t *sym, *csym;
+ int eq;
+ tspec_t t;
+
+ /*
+ * Remove the member if it was unknown until now (Which means
+ * that no defined struct or union has a member with the same name).
+ */
+ if (msym->s_scl == NOSCL) {
+ /* undefined struct/union member: %s */
+ fprintf(stderr, "3. %s\n", msym->s_name);
+ error(101, msym->s_name);
+ rmsym(msym);
+ msym->s_kind = FMOS;
+ msym->s_scl = MOS;
+ msym->s_styp = tgetblk(sizeof (str_t));
+ msym->s_styp->stag = tgetblk(sizeof (sym_t));
+ msym->s_styp->stag->s_name = unnamed;
+ msym->s_value.v_tspec = INT;
+ return (msym);
+ }
+
+ /* Set str to the tag of which msym is expected to be a member. */
+ str = NULL;
+ t = (tp = tn->tn_type)->t_tspec;
+ if (op == POINT) {
+ if (t == STRUCT || t == UNION)
+ str = tp->t_str;
+ } else if (op == ARROW && t == PTR) {
+ t = (tp = tp->t_subt)->t_tspec;
+ if (t == STRUCT || t == UNION)
+ str = tp->t_str;
+ }
+
+ /*
+ * If this struct/union has a member with the name of msym, return
+ * return this it.
+ */
+ if (str != NULL) {
+ for (sym = msym; sym != NULL; sym = sym->s_link) {
+ if (sym->s_scl != MOS && sym->s_scl != MOU)
+ continue;
+ if (sym->s_styp != str)
+ continue;
+ if (strcmp(sym->s_name, msym->s_name) != 0)
+ continue;
+ return (sym);
+ }
+ }
+
+ /*
+ * Set eq to 0 if there are struct/union members with the same name
+ * and different types and/or offsets.
+ */
+ eq = 1;
+ for (csym = msym; csym != NULL; csym = csym->s_link) {
+ if (csym->s_scl != MOS && csym->s_scl != MOU)
+ continue;
+ if (strcmp(msym->s_name, csym->s_name) != 0)
+ continue;
+ for (sym = csym->s_link ; sym != NULL; sym = sym->s_link) {
+ int w;
+
+ if (sym->s_scl != MOS && sym->s_scl != MOU)
+ continue;
+ if (strcmp(csym->s_name, sym->s_name) != 0)
+ continue;
+ if (csym->s_value.v_quad != sym->s_value.v_quad) {
+ eq = 0;
+ break;
+ }
+ w = 0;
+ eq = eqtype(csym->s_type, sym->s_type, 0, 0, &w) && !w;
+ if (!eq)
+ break;
+ if (csym->s_field != sym->s_field) {
+ eq = 0;
+ break;
+ }
+ if (csym->s_field) {
+ type_t *tp1, *tp2;
+
+ tp1 = csym->s_type;
+ tp2 = sym->s_type;
+ if (tp1->t_flen != tp2->t_flen) {
+ eq = 0;
+ break;
+ }
+ if (tp1->t_foffs != tp2->t_foffs) {
+ eq = 0;
+ break;
+ }
+ }
+ }
+ if (!eq)
+ break;
+ }
+
+ /*
+ * Now handle the case in which the left operand refers really
+ * to a struct/union, but the right operand is not member of it.
+ */
+ if (str != NULL) {
+ /* illegal member use: %s */
+ if (eq && tflag) {
+ warning(102, msym->s_name);
+ } else {
+ error(102, msym->s_name);
+ }
+ return (msym);
+ }
+
+ /*
+ * Now the left operand of ARROW does not point to a struct/union
+ * or the left operand of POINT is no struct/union.
+ */
+ if (eq) {
+ if (op == POINT) {
+ /* left operand of "." must be struct/union object */
+ if (tflag) {
+ warning(103);
+ } else {
+ error(103);
+ }
+ } else {
+ /* left operand of "->" must be pointer to ... */
+ if (tflag && tn->tn_type->t_tspec == PTR) {
+ warning(104);
+ } else {
+ error(104);
+ }
+ }
+ } else {
+ if (tflag) {
+ /* non-unique member requires struct/union %s */
+ error(105, op == POINT ? "object" : "pointer");
+ } else {
+ /* unacceptable operand of %s */
+ error(111, modtab[op].m_name);
+ }
+ }
+
+ return (msym);
+}
+
+/*
+ * Create a tree node. Called for most operands except function calls,
+ * sizeof and casts.
+ *
+ * op operator
+ * ln left operand
+ * rn if not NULL, right operand
+ */
+tnode_t *
+build(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ mod_t *mp;
+ tnode_t *ntn;
+ type_t *rtp;
+
+ mp = &modtab[op];
+
+ /* If there was an error in one of the operands, return. */
+ if (ln == NULL || (mp->m_binary && rn == NULL))
+ return (NULL);
+
+ /*
+ * Apply class conversions to the left operand, but only if its
+ * value is needed or it is compared with null.
+ */
+ if (mp->m_vctx || mp->m_tctx)
+ ln = cconv(ln);
+ /*
+ * The right operand is almost always in a test or value context,
+ * except if it is a struct or union member.
+ */
+ if (mp->m_binary && op != ARROW && op != POINT)
+ rn = cconv(rn);
+
+ /*
+ * Print some warnings for comparisons of unsigned values with
+ * constants lower than or equal to null. This must be done
+ * before promote() because otherwise unsigned char and unsigned
+ * short would be promoted to int. Also types are tested to be
+ * CHAR, which would also become int.
+ */
+ if (mp->m_comp)
+ chkcomp(op, ln, rn);
+
+ /*
+ * Promote the left operand if it is in a test or value context
+ */
+ if (mp->m_vctx || mp->m_tctx)
+ ln = promote(op, 0, ln);
+ /*
+ * Promote the right operand, but only if it is no struct or
+ * union member, or if it is not to be assigned to the left operand
+ */
+ if (mp->m_binary && op != ARROW && op != POINT &&
+ op != ASSIGN && op != RETURN) {
+ rn = promote(op, 0, rn);
+ }
+
+ /*
+ * If the result of the operation is different for signed or
+ * unsigned operands and one of the operands is signed only in
+ * ANSI C, print a warning.
+ */
+ if (mp->m_tlansiu && ln->tn_op == CON && ln->tn_val->v_ansiu) {
+ /* ANSI C treats constant as unsigned, op %s */
+ warning(218, mp->m_name);
+ ln->tn_val->v_ansiu = 0;
+ }
+ if (mp->m_transiu && rn->tn_op == CON && rn->tn_val->v_ansiu) {
+ /* ANSI C treats constant as unsigned, op %s */
+ warning(218, mp->m_name);
+ rn->tn_val->v_ansiu = 0;
+ }
+
+ /* Make sure both operands are of the same type */
+ if (mp->m_balance || (tflag && (op == SHL || op == SHR)))
+ balance(op, &ln, &rn);
+
+ /*
+ * Check types for compatibility with the operation and mutual
+ * compatibility. Return if there are serious problems.
+ */
+ if (!typeok(op, 0, ln, rn))
+ return (NULL);
+
+ /* And now create the node. */
+ switch (op) {
+ case POINT:
+ case ARROW:
+ ntn = bldstr(op, ln, rn);
+ break;
+ case INCAFT:
+ case DECAFT:
+ case INCBEF:
+ case DECBEF:
+ ntn = bldincdec(op, ln);
+ break;
+ case AMPER:
+ ntn = bldamper(ln, 0);
+ break;
+ case STAR:
+ ntn = mktnode(STAR, ln->tn_type->t_subt, ln, NULL);
+ break;
+ case PLUS:
+ case MINUS:
+ ntn = bldplmi(op, ln, rn);
+ break;
+ case SHL:
+ case SHR:
+ ntn = bldshft(op, ln, rn);
+ break;
+ case COLON:
+ ntn = bldcol(ln, rn);
+ break;
+ case ASSIGN:
+ case MULASS:
+ case DIVASS:
+ case MODASS:
+ case ADDASS:
+ case SUBASS:
+ case SHLASS:
+ case SHRASS:
+ case ANDASS:
+ case XORASS:
+ case ORASS:
+ case RETURN:
+ ntn = bldasgn(op, ln, rn);
+ break;
+ case COMMA:
+ case QUEST:
+ ntn = mktnode(op, rn->tn_type, ln, rn);
+ break;
+ default:
+ rtp = mp->m_logop ? gettyp(INT) : ln->tn_type;
+ if (!mp->m_binary && rn != NULL)
+ LERROR("build()");
+ ntn = mktnode(op, rtp, ln, rn);
+ break;
+ }
+
+ /* Return if an error occurred. */
+ if (ntn == NULL)
+ return (NULL);
+
+ /* Print a warning if precedence confusion is possible */
+ if (mp->m_tpconf)
+ precconf(ntn);
+
+ /*
+ * Print a warning if one of the operands is in a context where
+ * it is compared with null and if this operand is a constant.
+ */
+ if (mp->m_tctx) {
+ if (ln->tn_op == CON ||
+ ((mp->m_binary && op != QUEST) && rn->tn_op == CON)) {
+ if (hflag && !ccflg)
+ /* constant in conditional context */
+ warning(161);
+ }
+ }
+
+ /* Fold if the operator requires it */
+ if (mp->m_fold) {
+ if (ln->tn_op == CON && (!mp->m_binary || rn->tn_op == CON)) {
+ if (mp->m_tctx) {
+ ntn = foldtst(ntn);
+ } else if (isftyp(ntn->tn_type->t_tspec)) {
+ ntn = foldflt(ntn);
+ } else {
+ ntn = fold(ntn);
+ }
+ } else if (op == QUEST && ln->tn_op == CON) {
+ ntn = ln->tn_val->v_quad ? rn->tn_left : rn->tn_right;
+ }
+ }
+
+ return (ntn);
+}
+
+/*
+ * Perform class conversions.
+ *
+ * Arrays of type T are converted into pointers to type T.
+ * Functions are converted to pointers to functions.
+ * Lvalues are converted to rvalues.
+ */
+tnode_t *
+cconv(tnode_t *tn)
+{
+ type_t *tp;
+
+ /*
+ * Array-lvalue (array of type T) is converted into rvalue
+ * (pointer to type T)
+ */
+ if (tn->tn_type->t_tspec == ARRAY) {
+ if (!tn->tn_lvalue) {
+ /* operand of '%s' must be lvalue */
+ /* XXX print correct operator */
+ (void)gnuism(114, "", modtab[AMPER].m_name);
+ }
+ tn = mktnode(AMPER, tincref(tn->tn_type->t_subt, PTR),
+ tn, NULL);
+ }
+
+ /*
+ * Expression of type function (function with return value of type T)
+ * in rvalue-expression (pointer to function with return value
+ * of type T)
+ */
+ if (tn->tn_type->t_tspec == FUNC)
+ tn = bldamper(tn, 1);
+
+ /* lvalue to rvalue */
+ if (tn->tn_lvalue) {
+ tp = tduptyp(tn->tn_type);
+ tp->t_const = tp->t_volatile = 0;
+ tn = mktnode(LOAD, tp, tn, NULL);
+ }
+
+ return (tn);
+}
+
+/*
+ * Perform most type checks. First the types are checked using
+ * information from modtab[]. After that it is done by hand for
+ * more complicated operators and type combinations.
+ *
+ * If the types are ok, typeok() returns 1, otherwise 0.
+ */
+int
+typeok(op_t op, int arg, tnode_t *ln, tnode_t *rn)
+{
+ mod_t *mp;
+ tspec_t lt, rt = NOTSPEC, lst = NOTSPEC, rst = NOTSPEC, olt = NOTSPEC,
+ ort = NOTSPEC;
+ type_t *ltp, *rtp = NULL, *lstp = NULL, *rstp = NULL;
+ tnode_t *tn;
+
+ mp = &modtab[op];
+
+ if ((ltp = ln->tn_type) == NULL)
+ LERROR("typeok()");
+
+ if ((lt = ltp->t_tspec) == PTR)
+ lst = (lstp = ltp->t_subt)->t_tspec;
+ if (mp->m_binary) {
+ if ((rtp = rn->tn_type) == NULL)
+ LERROR("typeok()");
+ if ((rt = rtp->t_tspec) == PTR)
+ rst = (rstp = rtp->t_subt)->t_tspec;
+ }
+
+ if (mp->m_rqint) {
+ /* integer types required */
+ if (!isityp(lt) || (mp->m_binary && !isityp(rt))) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ } else if (mp->m_rqsclt) {
+ /* scalar types required */
+ if (!issclt(lt) || (mp->m_binary && !issclt(rt))) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ } else if (mp->m_rqatyp) {
+ /* arithmetic types required */
+ if (!isatyp(lt) || (mp->m_binary && !isatyp(rt))) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ }
+
+ if (op == SHL || op == SHR || op == SHLASS || op == SHRASS) {
+ /*
+ * For these operations we need the types before promotion
+ * and balancing.
+ */
+ for (tn=ln; tn->tn_op==CVT && !tn->tn_cast; tn=tn->tn_left)
+ continue;
+ olt = tn->tn_type->t_tspec;
+ for (tn=rn; tn->tn_op==CVT && !tn->tn_cast; tn=tn->tn_left)
+ continue;
+ ort = tn->tn_type->t_tspec;
+ }
+
+ switch (op) {
+ case POINT:
+ /*
+ * Most errors required by ANSI C are reported in strmemb().
+ * Here we only must check for totally wrong things.
+ */
+ if (lt == FUNC || lt == VOID || ltp->t_isfield ||
+ ((lt != STRUCT && lt != UNION) && !ln->tn_lvalue)) {
+ /* Without tflag we already got an error */
+ if (tflag)
+ /* unacceptable operand of %s */
+ error(111, mp->m_name);
+ return (0);
+ }
+ /* Now we have an object we can create a pointer to */
+ break;
+ case ARROW:
+ if (lt != PTR && !(tflag && isityp(lt))) {
+ /* Without tflag we got already an error */
+ if (tflag)
+ /* unacceptable operand of %s */
+ error(111, mp->m_name);
+ return (0);
+ }
+ break;
+ case INCAFT:
+ case DECAFT:
+ case INCBEF:
+ case DECBEF:
+ /* operands have scalar types (checked above) */
+ if (!ln->tn_lvalue) {
+ if (ln->tn_op == CVT && ln->tn_cast &&
+ ln->tn_left->tn_op == LOAD) {
+ /* a cast does not yield an lvalue */
+ error(163);
+ }
+ /* operand of %s must be lvalue */
+ error(114, "", mp->m_name);
+ return (0);
+ } else if (ltp->t_const) {
+ /* operand of %s must be modifiable lvalue */
+ if (!tflag)
+ warning(115, "", mp->m_name);
+ }
+ break;
+ case AMPER:
+ if (lt == ARRAY || lt == FUNC) {
+ /* ok, a warning comes later (in bldamper()) */
+ } else if (!ln->tn_lvalue) {
+ if (ln->tn_op == CVT && ln->tn_cast &&
+ ln->tn_left->tn_op == LOAD) {
+ /* a cast does not yield an lvalue */
+ error(163);
+ }
+ /* %soperand of %s must be lvalue */
+ error(114, "", mp->m_name);
+ return (0);
+ } else if (issclt(lt)) {
+ if (ltp->t_isfield) {
+ /* cannot take address of bit-field */
+ error(112);
+ return (0);
+ }
+ } else if (lt != STRUCT && lt != UNION) {
+ /* unacceptable operand of %s */
+ error(111, mp->m_name);
+ return (0);
+ }
+ if (ln->tn_op == NAME && ln->tn_sym->s_reg) {
+ /* cannot take address of register %s */
+ error(113, ln->tn_sym->s_name);
+ return (0);
+ }
+ break;
+ case STAR:
+ /* until now there were no type checks for this operator */
+ if (lt != PTR) {
+ /* cannot dereference non-pointer type */
+ error(96);
+ return (0);
+ }
+ break;
+ case PLUS:
+ /* operands have scalar types (checked above) */
+ if ((lt == PTR && !isityp(rt)) || (rt == PTR && !isityp(lt))) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ break;
+ case MINUS:
+ /* operands have scalar types (checked above) */
+ if (lt == PTR && (!isityp(rt) && rt != PTR)) {
+ incompat(op, lt, rt);
+ return (0);
+ } else if (rt == PTR && lt != PTR) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ if (lt == PTR && rt == PTR) {
+ if (!eqtype(lstp, rstp, 1, 0, NULL)) {
+ /* illegal pointer subtraction */
+ error(116);
+ }
+ }
+ break;
+ case SHR:
+ /* operands have integer types (checked above) */
+ if (pflag && !isutyp(lt)) {
+ /*
+ * The left operand is signed. This means that
+ * the operation is (possibly) nonportable.
+ */
+ /* bitwise operation on signed value nonportable */
+ if (ln->tn_op != CON) {
+ /* possibly nonportable */
+ warning(117);
+ } else if (ln->tn_val->v_quad < 0) {
+ warning(120);
+ }
+ } else if (!tflag && !sflag && !isutyp(olt) && isutyp(ort)) {
+ /*
+ * The left operand would become unsigned in
+ * traditional C.
+ */
+ if (hflag &&
+ (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+ /* semantics of %s change in ANSI C; use ... */
+ warning(118, mp->m_name);
+ }
+ } else if (!tflag && !sflag && !isutyp(olt) && !isutyp(ort) &&
+ psize(lt) < psize(rt)) {
+ /*
+ * In traditional C the left operand would be extended,
+ * possibly with 1, and then shifted.
+ */
+ if (hflag &&
+ (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+ /* semantics of %s change in ANSI C; use ... */
+ warning(118, mp->m_name);
+ }
+ }
+ goto shift;
+ case SHL:
+ /*
+ * ANSI C does not perform balancing for shift operations,
+ * but traditional C does. If the width of the right operand
+ * is greather than the width of the left operand, than in
+ * traditional C the left operand would be extendet to the
+ * width of the right operand. For SHL this may result in
+ * different results.
+ */
+ if (psize(lt) < psize(rt)) {
+ /*
+ * XXX If both operands are constant make sure
+ * that there is really a differencs between
+ * ANSI C and traditional C.
+ */
+ if (hflag)
+ /* semantics of %s change in ANSI C; use ... */
+ warning(118, mp->m_name);
+ }
+ shift:
+ if (rn->tn_op == CON) {
+ if (!isutyp(rt) && rn->tn_val->v_quad < 0) {
+ /* negative shift */
+ warning(121);
+ } else if ((uint64_t)rn->tn_val->v_quad == size(lt)) {
+ /* shift equal to size fo object */
+ warning(267);
+ } else if ((uint64_t)rn->tn_val->v_quad > size(lt)) {
+ /* shift greater than size of object */
+ warning(122);
+ }
+ }
+ break;
+ case EQ:
+ case NE:
+ /*
+ * Accept some things which are allowed with EQ and NE,
+ * but not with ordered comparisons.
+ */
+ if (lt == PTR && ((rt == PTR && rst == VOID) || isityp(rt))) {
+ if (rn->tn_op == CON && rn->tn_val->v_quad == 0)
+ break;
+ }
+ if (rt == PTR && ((lt == PTR && lst == VOID) || isityp(lt))) {
+ if (ln->tn_op == CON && ln->tn_val->v_quad == 0)
+ break;
+ }
+ /* FALLTHROUGH */
+ case LT:
+ case GT:
+ case LE:
+ case GE:
+ if ((lt == PTR || rt == PTR) && lt != rt) {
+ if (isityp(lt) || isityp(rt)) {
+ /* illegal comb. of pointer and int., op %s */
+ warning(123, mp->m_name);
+ } else {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ } else if (lt == PTR && rt == PTR) {
+ ptrcmpok(op, ln, rn);
+ }
+ break;
+ case QUEST:
+ if (!issclt(lt)) {
+ /* first operand must have scalar type, op ? : */
+ error(170);
+ return (0);
+ }
+ while (rn->tn_op == CVT)
+ rn = rn->tn_left;
+ if (rn->tn_op != COLON)
+ LERROR("typeok()");
+ break;
+ case COLON:
+
+ if (isatyp(lt) && isatyp(rt))
+ break;
+
+ if (lt == STRUCT && rt == STRUCT && ltp->t_str == rtp->t_str)
+ break;
+ if (lt == UNION && rt == UNION && ltp->t_str == rtp->t_str)
+ break;
+
+ /* combination of any pointer and 0, 0L or (void *)0 is ok */
+ if (lt == PTR && ((rt == PTR && rst == VOID) || isityp(rt))) {
+ if (rn->tn_op == CON && rn->tn_val->v_quad == 0)
+ break;
+ }
+ if (rt == PTR && ((lt == PTR && lst == VOID) || isityp(lt))) {
+ if (ln->tn_op == CON && ln->tn_val->v_quad == 0)
+ break;
+ }
+
+ if ((lt == PTR && isityp(rt)) || (isityp(lt) && rt == PTR)) {
+ /* illegal comb. of ptr. and int., op %s */
+ warning(123, mp->m_name);
+ break;
+ }
+
+ if (lt == VOID || rt == VOID) {
+ if (lt != VOID || rt != VOID)
+ /* incompatible types in conditional */
+ warning(126);
+ break;
+ }
+
+ if (lt == PTR && rt == PTR && ((lst == VOID && rst == FUNC) ||
+ (lst == FUNC && rst == VOID))) {
+ /* (void *)0 handled above */
+ if (sflag)
+ /* ANSI C forbids conv. of %s to %s, op %s */
+ warning(305, "function pointer", "'void *'",
+ mp->m_name);
+ break;
+ }
+
+ if (rt == PTR && lt == PTR) {
+ if (!eqtype(lstp, rstp, 1, 0, NULL))
+ illptrc(mp, ltp, rtp);
+ break;
+ }
+
+ /* incompatible types in conditional */
+ error(126);
+ return (0);
+
+ case ASSIGN:
+ case INIT:
+ case FARG:
+ case RETURN:
+ if (!asgntypok(op, arg, ln, rn))
+ return (0);
+ goto assign;
+ case MULASS:
+ case DIVASS:
+ case MODASS:
+ goto assign;
+ case ADDASS:
+ case SUBASS:
+ /* operands have scalar types (checked above) */
+ if ((lt == PTR && !isityp(rt)) || rt == PTR) {
+ incompat(op, lt, rt);
+ return (0);
+ }
+ goto assign;
+ case SHLASS:
+ goto assign;
+ case SHRASS:
+ if (pflag && !isutyp(lt) && !(tflag && isutyp(rt))) {
+ /* bitwise operation on s.v. possibly nonportabel */
+ warning(117);
+ }
+ goto assign;
+ case ANDASS:
+ case XORASS:
+ case ORASS:
+ goto assign;
+ assign:
+ if (!ln->tn_lvalue) {
+ if (ln->tn_op == CVT && ln->tn_cast &&
+ ln->tn_left->tn_op == LOAD) {
+ /* a cast does not yield an lvalue */
+ error(163);
+ }
+ /* %soperand of %s must be lvalue */
+ error(114, "left ", mp->m_name);
+ return (0);
+ } else if (ltp->t_const || ((lt == STRUCT || lt == UNION) &&
+ conmemb(ltp))) {
+ /* %soperand of %s must be modifiable lvalue */
+ if (!tflag)
+ warning(115, "left ", mp->m_name);
+ }
+ break;
+ case COMMA:
+ if (!modtab[ln->tn_op].m_sideeff)
+ nulleff(ln);
+ break;
+ /* LINTED (enumeration values not handled in switch) */
+ case CON:
+ case CASE:
+ case PUSH:
+ case LOAD:
+ case ICALL:
+ case CVT:
+ case CALL:
+ case FSEL:
+ case STRING:
+ case NAME:
+ case LOGOR:
+ case LOGAND:
+ case OR:
+ case XOR:
+ case AND:
+ case MOD:
+ case DIV:
+ case MULT:
+ case UMINUS:
+ case UPLUS:
+ case DEC:
+ case INC:
+ case COMPL:
+ case NOT:
+ case NOOP:
+ break;
+ }
+
+ if (mp->m_badeop &&
+ (ltp->t_isenum || (mp->m_binary && rtp->t_isenum))) {
+ chkbeop(op, ln, rn);
+ } else if (mp->m_enumop && (ltp->t_isenum && rtp && rtp->t_isenum)) {
+ chkeop2(op, arg, ln, rn);
+ } else if (mp->m_enumop && (ltp->t_isenum || (rtp &&rtp->t_isenum))) {
+ chkeop1(op, arg, ln, rn);
+ }
+
+ return (1);
+}
+
+static void
+ptrcmpok(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ type_t *ltp, *rtp;
+ tspec_t lt, rt;
+ const char *lts, *rts;
+
+ lt = (ltp = ln->tn_type)->t_subt->t_tspec;
+ rt = (rtp = rn->tn_type)->t_subt->t_tspec;
+
+ if (lt == VOID || rt == VOID) {
+ if (sflag && (lt == FUNC || rt == FUNC)) {
+ /* (void *)0 already handled in typeok() */
+ *(lt == FUNC ? &lts : &rts) = "function pointer";
+ *(lt == VOID ? &lts : &rts) = "'void *'";
+ /* ANSI C forbids comparison of %s with %s */
+ warning(274, lts, rts);
+ }
+ return;
+ }
+
+ if (!eqtype(ltp->t_subt, rtp->t_subt, 1, 0, NULL)) {
+ illptrc(&modtab[op], ltp, rtp);
+ return;
+ }
+
+ if (lt == FUNC && rt == FUNC) {
+ if (sflag && op != EQ && op != NE)
+ /* ANSI C forbids ordered comp. of func ptr */
+ warning(125);
+ }
+}
+
+/*
+ * Checks type compatibility for ASSIGN, INIT, FARG and RETURN
+ * and prints warnings/errors if necessary.
+ * If the types are (almost) compatible, 1 is returned, otherwise 0.
+ */
+static int
+asgntypok(op_t op, int arg, tnode_t *ln, tnode_t *rn)
+{
+ tspec_t lt, rt, lst = NOTSPEC, rst = NOTSPEC;
+ type_t *ltp, *rtp, *lstp = NULL, *rstp = NULL;
+ mod_t *mp;
+ const char *lts, *rts;
+
+ if ((lt = (ltp = ln->tn_type)->t_tspec) == PTR)
+ lst = (lstp = ltp->t_subt)->t_tspec;
+ if ((rt = (rtp = rn->tn_type)->t_tspec) == PTR)
+ rst = (rstp = rtp->t_subt)->t_tspec;
+ mp = &modtab[op];
+
+ if (isatyp(lt) && isatyp(rt))
+ return (1);
+
+ if ((lt == STRUCT || lt == UNION) && (rt == STRUCT || rt == UNION))
+ /* both are struct or union */
+ return (ltp->t_str == rtp->t_str);
+
+ /* 0, 0L and (void *)0 may be assigned to any pointer */
+ if (lt == PTR && ((rt == PTR && rst == VOID) || isityp(rt))) {
+ if (rn->tn_op == CON && rn->tn_val->v_quad == 0)
+ return (1);
+ }
+
+ if (lt == PTR && rt == PTR && (lst == VOID || rst == VOID)) {
+ /* two pointers, at least one pointer to void */
+ if (sflag && (lst == FUNC || rst == FUNC)) {
+ /* comb. of ptr to func and ptr to void */
+ *(lst == FUNC ? &lts : &rts) = "function pointer";
+ *(lst == VOID ? &lts : &rts) = "'void *'";
+ switch (op) {
+ case INIT:
+ case RETURN:
+ /* ANSI C forbids conversion of %s to %s */
+ warning(303, rts, lts);
+ break;
+ case FARG:
+ /* ANSI C forbids conv. of %s to %s, arg #%d */
+ warning(304, rts, lts, arg);
+ break;
+ default:
+ /* ANSI C forbids conv. of %s to %s, op %s */
+ warning(305, rts, lts, mp->m_name);
+ break;
+ }
+ }
+ }
+
+ if (lt == PTR && rt == PTR && (lst == VOID || rst == VOID ||
+ eqtype(lstp, rstp, 1, 0, NULL))) {
+ /* compatible pointer types (qualifiers ignored) */
+ if (!tflag &&
+ ((!lstp->t_const && rstp->t_const) ||
+ (!lstp->t_volatile && rstp->t_volatile))) {
+ /* left side has not all qualifiers of right */
+ switch (op) {
+ case INIT:
+ case RETURN:
+ /* incompatible pointer types */
+ warning(182);
+ break;
+ case FARG:
+ /* argument has incompat. ptr. type, arg #%d */
+ warning(153, arg);
+ break;
+ default:
+ /* operands have incompat. ptr. types, op %s */
+ warning(128, mp->m_name);
+ break;
+ }
+ }
+ return (1);
+ }
+
+ if ((lt == PTR && isityp(rt)) || (isityp(lt) && rt == PTR)) {
+ switch (op) {
+ case INIT:
+ case RETURN:
+ /* illegal combination of pointer and integer */
+ warning(183);
+ break;
+ case FARG:
+ /* illegal comb. of ptr. and int., arg #%d */
+ warning(154, arg);
+ break;
+ default:
+ /* illegal comb. of ptr. and int., op %s */
+ warning(123, mp->m_name);
+ break;
+ }
+ return (1);
+ }
+
+ if (lt == PTR && rt == PTR) {
+ switch (op) {
+ case INIT:
+ case RETURN:
+ illptrc(NULL, ltp, rtp);
+ break;
+ case FARG:
+ /* argument has incompatible pointer type, arg #%d */
+ warning(153, arg);
+ break;
+ default:
+ illptrc(mp, ltp, rtp);
+ break;
+ }
+ return (1);
+ }
+
+ switch (op) {
+ case INIT:
+ /* initialisation type mismatch */
+ error(185);
+ break;
+ case RETURN:
+ /* return value type mismatch */
+ error(211);
+ break;
+ case FARG:
+ /* argument is incompatible with prototype, arg #%d */
+ warning(155, arg);
+ break;
+ default:
+ incompat(op, lt, rt);
+ break;
+ }
+
+ return (0);
+}
+
+/*
+ * Prints a warning if an operator, which should be senseless for an
+ * enum type, is applied to an enum type.
+ */
+static void
+chkbeop(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ mod_t *mp;
+
+ if (!eflag)
+ return;
+
+ mp = &modtab[op];
+
+ if (!(ln->tn_type->t_isenum ||
+ (mp->m_binary && rn->tn_type->t_isenum))) {
+ return;
+ }
+
+ /*
+ * Enum as offset to a pointer is an exception (otherwise enums
+ * could not be used as array indizes).
+ */
+ if (op == PLUS &&
+ ((ln->tn_type->t_isenum && rn->tn_type->t_tspec == PTR) ||
+ (rn->tn_type->t_isenum && ln->tn_type->t_tspec == PTR))) {
+ return;
+ }
+
+ /* dubious operation on enum, op %s */
+ warning(241, mp->m_name);
+
+}
+
+/*
+ * Prints a warning if an operator is applied to two different enum types.
+ */
+static void
+chkeop2(op_t op, int arg, tnode_t *ln, tnode_t *rn)
+{
+ mod_t *mp;
+
+ mp = &modtab[op];
+
+ if (ln->tn_type->t_enum != rn->tn_type->t_enum) {
+ switch (op) {
+ case INIT:
+ /* enum type mismatch in initialisation */
+ warning(210);
+ break;
+ case FARG:
+ /* enum type mismatch, arg #%d */
+ warning(156, arg);
+ break;
+ case RETURN:
+ /* return value type mismatch */
+ warning(211);
+ break;
+ default:
+ /* enum type mismatch, op %s */
+ warning(130, mp->m_name);
+ break;
+ }
+#if 0
+ } else if (mp->m_comp && op != EQ && op != NE) {
+ if (eflag)
+ /* dubious comparisons of enums */
+ warning(243, mp->m_name);
+#endif
+ }
+}
+
+/*
+ * Prints a warning if an operator has both enum end other integer
+ * types.
+ */
+static void
+chkeop1(op_t op, int arg, tnode_t *ln, tnode_t *rn)
+{
+ char lbuf[64], rbuf[64];
+
+ if (!eflag)
+ return;
+
+ switch (op) {
+ case INIT:
+ /*
+ * Initializations with 0 should be allowed. Otherwise,
+ * we should complain about all uninitialized enums,
+ * consequently.
+ */
+ if (!rn->tn_type->t_isenum && rn->tn_op == CON &&
+ isityp(rn->tn_type->t_tspec) && rn->tn_val->v_quad == 0) {
+ return;
+ }
+ /* initialisation of '%s' with '%s' */
+ warning(277, tyname(lbuf, sizeof(lbuf), ln->tn_type),
+ tyname(rbuf, sizeof(rbuf), rn->tn_type));
+ break;
+ case FARG:
+ /* combination of '%s' and '%s', arg #%d */
+ warning(278, tyname(lbuf, sizeof(lbuf), ln->tn_type),
+ tyname(rbuf, sizeof(rbuf), rn->tn_type), arg);
+ break;
+ case RETURN:
+ /* combination of '%s' and '%s' in return */
+ warning(279, tyname(lbuf, sizeof(lbuf), ln->tn_type),
+ tyname(rbuf, sizeof(rbuf), rn->tn_type));
+ break;
+ default:
+ /* combination of '%s' and %s, op %s */
+ warning(242, tyname(lbuf, sizeof(lbuf), ln->tn_type),
+ tyname(rbuf, sizeof(rbuf), rn->tn_type),
+ modtab[op].m_name);
+ break;
+ }
+}
+
+/*
+ * Build and initialize a new node.
+ */
+static tnode_t *
+mktnode(op_t op, type_t *type, tnode_t *ln, tnode_t *rn)
+{
+ tnode_t *ntn;
+ tspec_t t;
+
+ ntn = getnode();
+
+ ntn->tn_op = op;
+ ntn->tn_type = type;
+ ntn->tn_left = ln;
+ ntn->tn_right = rn;
+
+ if (op == STAR || op == FSEL) {
+ if (ln->tn_type->t_tspec == PTR) {
+ t = ln->tn_type->t_subt->t_tspec;
+ if (t != FUNC && t != VOID)
+ ntn->tn_lvalue = 1;
+ } else {
+ LERROR("mktnode()");
+ }
+ }
+
+ return (ntn);
+}
+
+/*
+ * Performs usual conversion of operands to (unsigned) int.
+ *
+ * If tflag is set or the operand is a function argument with no
+ * type information (no prototype or variable # of args), convert
+ * float to double.
+ */
+tnode_t *
+promote(op_t op, int farg, tnode_t *tn)
+{
+ tspec_t t;
+ type_t *ntp;
+ int len;
+
+ t = tn->tn_type->t_tspec;
+
+ if (!isatyp(t))
+ return (tn);
+
+ if (!tflag) {
+ /*
+ * ANSI C requires that the result is always of type INT
+ * if INT can represent all possible values of the previous
+ * type.
+ */
+ if (tn->tn_type->t_isfield) {
+ len = tn->tn_type->t_flen;
+ if (size(INT) > len) {
+ t = INT;
+ } else {
+ if (size(INT) != len)
+ LERROR("promote()");
+ if (isutyp(t)) {
+ t = UINT;
+ } else {
+ t = INT;
+ }
+ }
+ } else if (t == CHAR || t == UCHAR || t == SCHAR) {
+ t = (size(CHAR) < size(INT) || t != UCHAR) ?
+ INT : UINT;
+ } else if (t == SHORT || t == USHORT) {
+ t = (size(SHORT) < size(INT) || t == SHORT) ?
+ INT : UINT;
+ } else if (t == ENUM) {
+ t = INT;
+ } else if (farg && t == FLOAT) {
+ t = DOUBLE;
+ }
+ } else {
+ /*
+ * In traditional C, keep unsigned and promote FLOAT
+ * to DOUBLE.
+ */
+ if (t == UCHAR || t == USHORT) {
+ t = UINT;
+ } else if (t == CHAR || t == SCHAR || t == SHORT) {
+ t = INT;
+ } else if (t == FLOAT) {
+ t = DOUBLE;
+ } else if (t == ENUM) {
+ t = INT;
+ }
+ }
+
+ if (t != tn->tn_type->t_tspec) {
+ ntp = tduptyp(tn->tn_type);
+ ntp->t_tspec = t;
+ /*
+ * Keep t_isenum so we are later able to check compatibility
+ * of enum types.
+ */
+ tn = convert(op, 0, ntp, tn);
+ }
+
+ return (tn);
+}
+
+/*
+ * Insert conversions which are necessary to give both operands the same
+ * type. This is done in different ways for traditional C and ANSI C.
+ */
+static void
+balance(op_t op, tnode_t **lnp, tnode_t **rnp)
+{
+ tspec_t lt, rt, t;
+ int i, u;
+ type_t *ntp;
+ static tspec_t tl[] = {
+ LDOUBLE, DOUBLE, FLOAT, UQUAD, QUAD, ULONG, LONG, UINT, INT,
+ };
+
+ lt = (*lnp)->tn_type->t_tspec;
+ rt = (*rnp)->tn_type->t_tspec;
+
+ if (!isatyp(lt) || !isatyp(rt))
+ return;
+
+ if (!tflag) {
+ if (lt == rt) {
+ t = lt;
+ } else if (lt == LDOUBLE || rt == LDOUBLE) {
+ t = LDOUBLE;
+ } else if (lt == DOUBLE || rt == DOUBLE) {
+ t = DOUBLE;
+ } else if (lt == FLOAT || rt == FLOAT) {
+ t = FLOAT;
+ } else {
+ /*
+ * If type A has more bits than type B it should
+ * be able to hold all possible values of type B.
+ */
+ if (size(lt) > size(rt)) {
+ t = lt;
+ } else if (size(lt) < size(rt)) {
+ t = rt;
+ } else {
+ for (i = 3; tl[i] != INT; i++) {
+ if (tl[i] == lt || tl[i] == rt)
+ break;
+ }
+ if ((isutyp(lt) || isutyp(rt)) &&
+ !isutyp(tl[i])) {
+ i--;
+ }
+ t = tl[i];
+ }
+ }
+ } else {
+ /* Keep unsigned in traditional C */
+ u = isutyp(lt) || isutyp(rt);
+ for (i = 0; tl[i] != INT; i++) {
+ if (lt == tl[i] || rt == tl[i])
+ break;
+ }
+ t = tl[i];
+ if (u && isityp(t) && !isutyp(t))
+ t = utyp(t);
+ }
+
+ if (t != lt) {
+ ntp = tduptyp((*lnp)->tn_type);
+ ntp->t_tspec = t;
+ *lnp = convert(op, 0, ntp, *lnp);
+ }
+ if (t != rt) {
+ ntp = tduptyp((*rnp)->tn_type);
+ ntp->t_tspec = t;
+ *rnp = convert(op, 0, ntp, *rnp);
+ }
+}
+
+/*
+ * Insert a conversion operator, which converts the type of the node
+ * to another given type.
+ * If op is FARG, arg is the number of the argument (used for warnings).
+ */
+tnode_t *
+convert(op_t op, int arg, type_t *tp, tnode_t *tn)
+{
+ tnode_t *ntn;
+ tspec_t nt, ot, ost = NOTSPEC;
+
+ if (tn->tn_lvalue)
+ LERROR("convert()");
+
+ nt = tp->t_tspec;
+ if ((ot = tn->tn_type->t_tspec) == PTR)
+ ost = tn->tn_type->t_subt->t_tspec;
+
+ if (!tflag && !sflag && op == FARG)
+ ptconv(arg, nt, ot, tp, tn);
+ if (isityp(nt) && isityp(ot)) {
+ iiconv(op, arg, nt, ot, tp, tn);
+ } else if (nt == PTR && ((ot == PTR && ost == VOID) || isityp(ot)) &&
+ tn->tn_op == CON && tn->tn_val->v_quad == 0) {
+ /* 0, 0L and (void *)0 may be assigned to any pointer. */
+ } else if (isityp(nt) && ot == PTR) {
+ piconv(op, nt, tp, tn);
+ } else if (nt == PTR && ot == PTR) {
+ ppconv(op, tn, tp);
+ }
+
+ ntn = getnode();
+ ntn->tn_op = CVT;
+ ntn->tn_type = tp;
+ ntn->tn_cast = op == CVT;
+ if (tn->tn_op != CON || nt == VOID) {
+ ntn->tn_left = tn;
+ } else {
+ ntn->tn_op = CON;
+ ntn->tn_val = tgetblk(sizeof (val_t));
+ cvtcon(op, arg, ntn->tn_type, ntn->tn_val, tn->tn_val);
+ }
+
+ return (ntn);
+}
+
+/*
+ * Print a warning if a prototype causes a type conversion that is
+ * different from what would happen to the same argument in the
+ * absence of a prototype.
+ *
+ * Errors/Warnings about illegal type combinations are already printed
+ * in asgntypok().
+ */
+static void
+ptconv(int arg, tspec_t nt, tspec_t ot, type_t *tp, tnode_t *tn)
+{
+ tnode_t *ptn;
+ char buf[64];
+
+ if (!isatyp(nt) || !isatyp(ot))
+ return;
+
+ /*
+ * If the type of the formal parameter is char/short, a warning
+ * would be useless, because functions declared the old style
+ * can't expect char/short arguments.
+ */
+ if (nt == CHAR || nt == UCHAR || nt == SHORT || nt == USHORT)
+ return;
+
+ /* get default promotion */
+ ptn = promote(NOOP, 1, tn);
+ ot = ptn->tn_type->t_tspec;
+
+ /* return if types are the same with and without prototype */
+ if (nt == ot || (nt == ENUM && ot == INT))
+ return;
+
+ if (isftyp(nt) != isftyp(ot) || psize(nt) != psize(ot)) {
+ /* representation and/or width change */
+ if (!isityp(ot) || psize(ot) > psize(INT)) {
+ /* conversion to '%s' due to prototype, arg #%d */
+ warning(259, tyname(buf, sizeof(buf), tp), arg);
+ }
+ } else if (hflag) {
+ /*
+ * they differ in sign or base type (char, short, int,
+ * long, long long, float, double, long double)
+ *
+ * if they differ only in sign and the argument is a constant
+ * and the msb of the argument is not set, print no warning
+ */
+ if (ptn->tn_op == CON && isityp(nt) && styp(nt) == styp(ot) &&
+ msb(ptn->tn_val->v_quad, ot, -1) == 0) {
+ /* ok */
+ } else {
+ /* conversion to '%s' due to prototype, arg #%d */
+ warning(259, tyname(buf, sizeof(buf), tp), arg);
+ }
+ }
+}
+
+/*
+ * Print warnings for conversions of integer types which may cause
+ * problems.
+ */
+/* ARGSUSED */
+static void
+iiconv(op_t op, int arg, tspec_t nt, tspec_t ot, type_t *tp, tnode_t *tn)
+{
+ char lbuf[64], rbuf[64];
+ if (tn->tn_op == CON)
+ return;
+
+ if (op == CVT)
+ return;
+
+#if 0
+ if (psize(nt) > psize(ot) && isutyp(nt) != isutyp(ot)) {
+ /* conversion to %s may sign-extend incorrectly (, arg #%d) */
+ if (aflag && pflag) {
+ if (op == FARG) {
+ warning(297, tyname(lbuf, sizeof(lbuf), tp),
+ arg);
+ } else {
+ warning(131, tyname(lbuf, sizeof(lbuf), tp));
+ }
+ }
+ }
+#endif
+
+ if (psize(nt) < psize(ot) &&
+ (ot == LONG || ot == ULONG || ot == QUAD || ot == UQUAD ||
+ aflag > 1)) {
+ /* conversion from '%s' may lose accuracy */
+ if (aflag) {
+ if (op == FARG) {
+ warning(298,
+ tyname(rbuf, sizeof(rbuf), tn->tn_type),
+ tyname(lbuf, sizeof(lbuf), tp),
+ arg);
+ } else {
+ warning(132,
+ tyname(rbuf, sizeof(rbuf), tn->tn_type),
+ tyname(lbuf, sizeof(lbuf), tp));
+ }
+ }
+ }
+}
+
+/*
+ * Print warnings for dubious conversions of pointer to integer.
+ */
+static void
+piconv(op_t op, tspec_t nt, type_t *tp, tnode_t *tn)
+{
+ char buf[64];
+
+ if (tn->tn_op == CON)
+ return;
+
+ if (op != CVT) {
+ /* We already got an error. */
+ return;
+ }
+
+ if (psize(nt) < psize(PTR)) {
+ if (pflag && size(nt) >= size(PTR)) {
+ /* conv. of pointer to %s may lose bits */
+ warning(134, tyname(buf, sizeof(buf), tp));
+ } else {
+ /* conv. of pointer to %s loses bits */
+ warning(133, tyname(buf, sizeof(buf), tp));
+ }
+ }
+}
+
+/*
+ * Print warnings for questionable pointer conversions.
+ */
+static void
+ppconv(op_t op, tnode_t *tn, type_t *tp)
+{
+ tspec_t nt, ot;
+ const char *nts, *ots;
+
+ /*
+ * We already got an error (pointers of different types
+ * without a cast) or we will not get a warning.
+ */
+ if (op != CVT)
+ return;
+
+ nt = tp->t_subt->t_tspec;
+ ot = tn->tn_type->t_subt->t_tspec;
+
+ if (nt == VOID || ot == VOID) {
+ if (sflag && (nt == FUNC || ot == FUNC)) {
+ /* (void *)0 already handled in convert() */
+ *(nt == FUNC ? &nts : &ots) = "function pointer";
+ *(nt == VOID ? &nts : &ots) = "'void *'";
+ /* ANSI C forbids conversion of %s to %s */
+ warning(303, ots, nts);
+ }
+ return;
+ } else if (nt == FUNC && ot == FUNC) {
+ return;
+ } else if (nt == FUNC || ot == FUNC) {
+ /* questionable conversion of function pointer */
+ warning(229);
+ return;
+ }
+
+ if (getbound(tp->t_subt) > getbound(tn->tn_type->t_subt)) {
+ if (hflag)
+ /* possible pointer alignment problem */
+ warning(135);
+ }
+ if (((nt == STRUCT || nt == UNION) &&
+ tp->t_subt->t_str != tn->tn_type->t_subt->t_str) ||
+ psize(nt) != psize(ot)) {
+ if (cflag) {
+ /* pointer casts may be troublesome */
+ warning(247);
+ }
+ }
+}
+
+/*
+ * Converts a typed constant in a constant of another type.
+ *
+ * op operator which requires conversion
+ * arg if op is FARG, # of argument
+ * tp type to which convert the constant
+ * nv new constant
+ * v old constant
+ */
+void
+cvtcon(op_t op, int arg, type_t *tp, val_t *nv, val_t *v)
+{
+ char lbuf[64], rbuf[64];
+ tspec_t ot, nt;
+ ldbl_t max = 0.0, min = 0.0;
+ int sz, rchk;
+ int64_t xmask, xmsk1;
+ int osz, nsz;
+
+ ot = v->v_tspec;
+ nt = nv->v_tspec = tp->t_tspec;
+ rchk = 0;
+
+ if (ot == FLOAT || ot == DOUBLE || ot == LDOUBLE) {
+ switch (nt) {
+ case CHAR:
+ max = CHAR_MAX; min = CHAR_MIN; break;
+ case UCHAR:
+ max = UCHAR_MAX; min = 0; break;
+ case SCHAR:
+ max = SCHAR_MAX; min = SCHAR_MIN; break;
+ case SHORT:
+ max = SHRT_MAX; min = SHRT_MIN; break;
+ case USHORT:
+ max = USHRT_MAX; min = 0; break;
+ case ENUM:
+ case INT:
+ max = INT_MAX; min = INT_MIN; break;
+ case UINT:
+ max = (u_int)UINT_MAX; min = 0; break;
+ case LONG:
+ max = LONG_MAX; min = LONG_MIN; break;
+ case ULONG:
+ max = (u_long)ULONG_MAX; min = 0; break;
+ case QUAD:
+ max = QUAD_MAX; min = QUAD_MIN; break;
+ case UQUAD:
+ max = (uint64_t)UQUAD_MAX; min = 0; break;
+ case FLOAT:
+ max = FLT_MAX; min = -FLT_MAX; break;
+ case DOUBLE:
+ max = DBL_MAX; min = -DBL_MAX; break;
+ case PTR:
+ /* Already got an error because of float --> ptr */
+ case LDOUBLE:
+ max = LDBL_MAX; min = -LDBL_MAX; break;
+ default:
+ LERROR("cvtcon()");
+ }
+ if (v->v_ldbl > max || v->v_ldbl < min) {
+ if (nt == LDOUBLE)
+ LERROR("cvtcon()");
+ if (op == FARG) {
+ /* conv. of %s to %s is out of rng., arg #%d */
+ warning(295, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)), tyname(rbuf, sizeof(rbuf), tp),
+ arg);
+ } else {
+ /* conversion of %s to %s is out of range */
+ warning(119, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)),
+ tyname(rbuf, sizeof(rbuf), tp));
+ }
+ v->v_ldbl = v->v_ldbl > 0 ? max : min;
+ }
+ if (nt == FLOAT) {
+ nv->v_ldbl = (float)v->v_ldbl;
+ } else if (nt == DOUBLE) {
+ nv->v_ldbl = (double)v->v_ldbl;
+ } else if (nt == LDOUBLE) {
+ nv->v_ldbl = v->v_ldbl;
+ } else {
+ nv->v_quad = (nt == PTR || isutyp(nt)) ?
+ (uint64_t)v->v_ldbl : (int64_t)v->v_ldbl;
+ }
+ } else {
+ if (nt == FLOAT) {
+ nv->v_ldbl = (ot == PTR || isutyp(ot)) ?
+ (float)(uint64_t)v->v_quad : (float)v->v_quad;
+ } else if (nt == DOUBLE) {
+ nv->v_ldbl = (ot == PTR || isutyp(ot)) ?
+ (double)(uint64_t)v->v_quad : (double)v->v_quad;
+ } else if (nt == LDOUBLE) {
+ nv->v_ldbl = (ot == PTR || isutyp(ot)) ?
+ (ldbl_t)(uint64_t)v->v_quad : (ldbl_t)v->v_quad;
+ } else {
+ rchk = 1; /* Check for lost precision. */
+ nv->v_quad = v->v_quad;
+ }
+ }
+
+ if (v->v_ansiu && isftyp(nt)) {
+ /* ANSI C treats constant as unsigned */
+ warning(157);
+ v->v_ansiu = 0;
+ } else if (v->v_ansiu && (isityp(nt) && !isutyp(nt) &&
+ psize(nt) > psize(ot))) {
+ /* ANSI C treats constant as unsigned */
+ warning(157);
+ v->v_ansiu = 0;
+ }
+
+ if (nt != FLOAT && nt != DOUBLE && nt != LDOUBLE) {
+ sz = tp->t_isfield ? tp->t_flen : size(nt);
+ nv->v_quad = xsign(nv->v_quad, nt, sz);
+ }
+
+ if (rchk && op != CVT) {
+ osz = size(ot);
+ nsz = tp->t_isfield ? tp->t_flen : size(nt);
+ xmask = qlmasks[nsz] ^ qlmasks[osz];
+ xmsk1 = qlmasks[nsz] ^ qlmasks[osz - 1];
+ /*
+ * For bitwise operations we are not interested in the
+ * value, but in the bits itself.
+ */
+ if (op == ORASS || op == OR || op == XOR) {
+ /*
+ * Print a warning if bits which were set are
+ * lost due to the conversion.
+ * This can happen with operator ORASS only.
+ */
+ if (nsz < osz && (v->v_quad & xmask) != 0) {
+ /* constant truncated by conv., op %s */
+ warning(306, modtab[op].m_name);
+ }
+ } else if (op == ANDASS || op == AND) {
+ /*
+ * Print a warning if additional bits are not all 1
+ * and the most significant bit of the old value is 1,
+ * or if at least one (but not all) removed bit was 0.
+ */
+ if (nsz > osz &&
+ (nv->v_quad & qbmasks[osz - 1]) != 0 &&
+ (nv->v_quad & xmask) != xmask) {
+ /*
+ * extra bits set to 0 in conversion
+ * of '%s' to '%s', op %s
+ */
+ warning(309, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)), tyname(rbuf, sizeof(rbuf), tp),
+ modtab[op].m_name);
+ } else if (nsz < osz &&
+ (v->v_quad & xmask) != xmask &&
+ (v->v_quad & xmask) != 0) {
+ /* const. truncated by conv., op %s */
+ warning(306, modtab[op].m_name);
+ }
+ } else if ((nt != PTR && isutyp(nt)) &&
+ (ot != PTR && !isutyp(ot)) && v->v_quad < 0) {
+ if (op == ASSIGN) {
+ /* assignment of negative constant to ... */
+ warning(164);
+ } else if (op == INIT) {
+ /* initialisation of unsigned with neg. ... */
+ warning(221);
+ } else if (op == FARG) {
+ /* conversion of neg. const. to ..., arg #%d */
+ warning(296, arg);
+ } else if (modtab[op].m_comp) {
+ /* we get this warning already in chkcomp() */
+ } else {
+ /* conversion of negative constant to ... */
+ warning(222);
+ }
+ } else if (nv->v_quad != v->v_quad && nsz <= osz &&
+ (v->v_quad & xmask) != 0 &&
+ (isutyp(ot) || (v->v_quad & xmsk1) != xmsk1)) {
+ /*
+ * Loss of significant bit(s). All truncated bits
+ * of unsigned types or all truncated bits plus the
+ * msb of the target for signed types are considered
+ * to be significant bits. Loss of significant bits
+ * means that at least on of the bits was set in an
+ * unsigned type or that at least one, but not all of
+ * the bits was set in a signed type.
+ * Loss of significant bits means that it is not
+ * possible, also not with necessary casts, to convert
+ * back to the original type. An example for a
+ * necessary cast is:
+ * char c; int i; c = 128;
+ * i = c; ** yields -128 **
+ * i = (unsigned char)c; ** yields 128 **
+ */
+ if (op == ASSIGN && tp->t_isfield) {
+ /* precision lost in bit-field assignment */
+ warning(166);
+ } else if (op == ASSIGN) {
+ /* constant truncated by assignment */
+ warning(165);
+ } else if (op == INIT && tp->t_isfield) {
+ /* bit-field initializer does not fit */
+ warning(180);
+ } else if (op == INIT) {
+ /* initializer does not fit */
+ warning(178);
+ } else if (op == CASE) {
+ /* case label affected by conversion */
+ warning(196);
+ } else if (op == FARG) {
+ /* conv. of %s to %s is out of rng., arg #%d */
+ warning(295, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)), tyname(rbuf, sizeof(rbuf), tp),
+ arg);
+ } else {
+ /* conversion of %s to %s is out of range */
+ warning(119, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)),
+ tyname(rbuf, sizeof(rbuf), tp));
+ }
+ } else if (nv->v_quad != v->v_quad) {
+ if (op == ASSIGN && tp->t_isfield) {
+ /* precision lost in bit-field assignment */
+ warning(166);
+ } else if (op == INIT && tp->t_isfield) {
+ /* bit-field initializer out of range */
+ warning(11);
+ } else if (op == CASE) {
+ /* case label affected by conversion */
+ warning(196);
+ } else if (op == FARG) {
+ /* conv. of %s to %s is out of rng., arg #%d */
+ warning(295, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)), tyname(rbuf, sizeof(rbuf), tp),
+ arg);
+ } else {
+ /* conversion of %s to %s is out of range */
+ warning(119, tyname(lbuf, sizeof(lbuf),
+ gettyp(ot)),
+ tyname(rbuf, sizeof(rbuf), tp));
+ }
+ }
+ }
+}
+
+/*
+ * Called if incompatible types were detected.
+ * Prints an appropriate warning.
+ */
+static void
+incompat(op_t op, tspec_t lt, tspec_t rt)
+{
+ mod_t *mp;
+
+ mp = &modtab[op];
+
+ if (lt == VOID || (mp->m_binary && rt == VOID)) {
+ /* void type illegal in expression */
+ error(109);
+ } else if (op == ASSIGN) {
+ if ((lt == STRUCT || lt == UNION) &&
+ (rt == STRUCT || rt == UNION)) {
+ /* assignment of different structures */
+ error(240);
+ } else {
+ /* assignment type mismatch */
+ error(171);
+ }
+ } else if (mp->m_binary) {
+ /* operands of %s have incompatible types */
+ error(107, mp->m_name);
+ } else {
+ /* operand of %s has incompatible type */
+ error(108, mp->m_name);
+ }
+}
+
+/*
+ * Called if incompatible pointer types are detected.
+ * Print an appropriate warning.
+ */
+static void
+illptrc(mod_t *mp, type_t *ltp, type_t *rtp)
+{
+ tspec_t lt, rt;
+
+ if (ltp->t_tspec != PTR || rtp->t_tspec != PTR)
+ LERROR("illptrc()");
+
+ lt = ltp->t_subt->t_tspec;
+ rt = rtp->t_subt->t_tspec;
+
+ if ((lt == STRUCT || lt == UNION) && (rt == STRUCT || rt == UNION)) {
+ if (mp == NULL) {
+ /* illegal structure pointer combination */
+ warning(244);
+ } else {
+ /* illegal structure pointer combination, op %s */
+ warning(245, mp->m_name);
+ }
+ } else {
+ if (mp == NULL) {
+ /* illegal pointer combination */
+ warning(184);
+ } else {
+ /* illegal pointer combination, op %s */
+ warning(124, mp->m_name);
+ }
+ }
+}
+
+/*
+ * Make sure type (*tpp)->t_subt has at least the qualifiers
+ * of tp1->t_subt and tp2->t_subt.
+ */
+static void
+mrgqual(type_t **tpp, type_t *tp1, type_t *tp2)
+{
+
+ if ((*tpp)->t_tspec != PTR ||
+ tp1->t_tspec != PTR || tp2->t_tspec != PTR) {
+ LERROR("mrgqual()");
+ }
+
+ if ((*tpp)->t_subt->t_const ==
+ (tp1->t_subt->t_const | tp2->t_subt->t_const) &&
+ (*tpp)->t_subt->t_volatile ==
+ (tp1->t_subt->t_volatile | tp2->t_subt->t_volatile)) {
+ return;
+ }
+
+ *tpp = tduptyp(*tpp);
+ (*tpp)->t_subt = tduptyp((*tpp)->t_subt);
+ (*tpp)->t_subt->t_const =
+ tp1->t_subt->t_const | tp2->t_subt->t_const;
+ (*tpp)->t_subt->t_volatile =
+ tp1->t_subt->t_volatile | tp2->t_subt->t_volatile;
+}
+
+/*
+ * Returns 1 if the given structure or union has a constant member
+ * (maybe recursively).
+ */
+static int
+conmemb(type_t *tp)
+{
+ sym_t *m;
+ tspec_t t;
+
+ if ((t = tp->t_tspec) != STRUCT && t != UNION)
+ LERROR("conmemb()");
+ for (m = tp->t_str->memb; m != NULL; m = m->s_nxt) {
+ tp = m->s_type;
+ if (tp->t_const)
+ return (1);
+ if ((t = tp->t_tspec) == STRUCT || t == UNION) {
+ if (conmemb(m->s_type))
+ return (1);
+ }
+ }
+ return (0);
+}
+
+const char *
+basictyname(tspec_t t)
+{
+ switch (t) {
+ case CHAR: return "char";
+ case UCHAR: return "unsigned char";
+ case SCHAR: return "signed char";
+ case SHORT: return "short";
+ case USHORT: return "unsigned short";
+ case INT: return "int";
+ case UINT: return "unsigned int";
+ case LONG: return "long";
+ case ULONG: return "unsigned long";
+ case QUAD: return "long long";
+ case UQUAD: return "unsigned long long";
+ case FLOAT: return "float";
+ case DOUBLE: return "double";
+ case LDOUBLE: return "long double";
+ case PTR: return "pointer";
+ case ENUM: return "enum";
+ case STRUCT: return "struct";
+ case UNION: return "union";
+ case FUNC: return "function";
+ case ARRAY: return "array";
+ default:
+ LERROR("basictyname()");
+ return NULL;
+ }
+}
+
+const char *
+tyname(char *buf, size_t bufsiz, type_t *tp)
+{
+ tspec_t t;
+ const char *s;
+ char lbuf[64];
+
+ if ((t = tp->t_tspec) == INT && tp->t_isenum)
+ t = ENUM;
+
+ s = basictyname(t);
+
+
+ switch (t) {
+ case CHAR:
+ case UCHAR:
+ case SCHAR:
+ case SHORT:
+ case USHORT:
+ case INT:
+ case UINT:
+ case LONG:
+ case ULONG:
+ case QUAD:
+ case UQUAD:
+ case FLOAT:
+ case DOUBLE:
+ case LDOUBLE:
+ case FUNC:
+ (void)snprintf(buf, bufsiz, "%s", s);
+ break;
+ case PTR:
+ (void)snprintf(buf, bufsiz, "%s to %s", s,
+ tyname(lbuf, sizeof(lbuf), tp->t_subt));
+ break;
+ case ENUM:
+ (void)snprintf(buf, bufsiz, "%s %s", s,
+ tp->t_enum->etag->s_name);
+ break;
+ case STRUCT:
+ case UNION:
+ (void)snprintf(buf, bufsiz, "%s %s", s,
+ tp->t_str->stag->s_name);
+ break;
+ case ARRAY:
+ (void)snprintf(buf, bufsiz, "%s of %s[%d]", s,
+ tyname(lbuf, sizeof(lbuf), tp->t_subt), tp->t_dim);
+ break;
+ default:
+ LERROR("tyname()");
+ }
+ return (buf);
+}
+
+/*
+ * Create a new node for one of the operators POINT and ARROW.
+ */
+static tnode_t *
+bldstr(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ tnode_t *ntn, *ctn;
+ int nolval;
+
+ if (rn->tn_op != NAME)
+ LERROR("bldstr()");
+ if (rn->tn_sym->s_value.v_tspec != INT)
+ LERROR("bldstr()");
+ if (rn->tn_sym->s_scl != MOS && rn->tn_sym->s_scl != MOU)
+ LERROR("bldstr()");
+
+ /*
+ * Remember if the left operand is an lvalue (structure members
+ * are lvalues if and only if the structure itself is an lvalue).
+ */
+ nolval = op == POINT && !ln->tn_lvalue;
+
+ if (op == POINT) {
+ ln = bldamper(ln, 1);
+ } else if (ln->tn_type->t_tspec != PTR) {
+ if (!tflag || !isityp(ln->tn_type->t_tspec))
+ LERROR("bldstr()");
+ ln = convert(NOOP, 0, tincref(gettyp(VOID), PTR), ln);
+ }
+
+#if PTRDIFF_IS_LONG
+ ctn = getinode(LONG, rn->tn_sym->s_value.v_quad / CHAR_BIT);
+#else
+ ctn = getinode(INT, rn->tn_sym->s_value.v_quad / CHAR_BIT);
+#endif
+
+ ntn = mktnode(PLUS, tincref(rn->tn_type, PTR), ln, ctn);
+ if (ln->tn_op == CON)
+ ntn = fold(ntn);
+
+ if (rn->tn_type->t_isfield) {
+ ntn = mktnode(FSEL, ntn->tn_type->t_subt, ntn, NULL);
+ } else {
+ ntn = mktnode(STAR, ntn->tn_type->t_subt, ntn, NULL);
+ }
+
+ if (nolval)
+ ntn->tn_lvalue = 0;
+
+ return (ntn);
+}
+
+/*
+ * Create a node for INCAFT, INCBEF, DECAFT and DECBEF.
+ */
+static tnode_t *
+bldincdec(op_t op, tnode_t *ln)
+{
+ tnode_t *cn, *ntn;
+
+ if (ln == NULL)
+ LERROR("bldincdec()");
+
+ if (ln->tn_type->t_tspec == PTR) {
+ cn = plength(ln->tn_type);
+ } else {
+ cn = getinode(INT, (int64_t)1);
+ }
+ ntn = mktnode(op, ln->tn_type, ln, cn);
+
+ return (ntn);
+}
+
+/*
+ * Create a tree node for the & operator
+ */
+static tnode_t *
+bldamper(tnode_t *tn, int noign)
+{
+ tnode_t *ntn;
+ tspec_t t;
+
+ if (!noign && ((t = tn->tn_type->t_tspec) == ARRAY || t == FUNC)) {
+ /* & before array or function: ignored */
+ if (tflag)
+ warning(127);
+ return (tn);
+ }
+
+ /* eliminate &* */
+ if (tn->tn_op == STAR &&
+ tn->tn_left->tn_type->t_tspec == PTR &&
+ tn->tn_left->tn_type->t_subt == tn->tn_type) {
+ return (tn->tn_left);
+ }
+
+ ntn = mktnode(AMPER, tincref(tn->tn_type, PTR), tn, NULL);
+
+ return (ntn);
+}
+
+/*
+ * Create a node for operators PLUS and MINUS.
+ */
+static tnode_t *
+bldplmi(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ tnode_t *ntn, *ctn;
+ type_t *tp;
+
+ /* If pointer and integer, then pointer to the lhs. */
+ if (rn->tn_type->t_tspec == PTR && isityp(ln->tn_type->t_tspec)) {
+ ntn = ln;
+ ln = rn;
+ rn = ntn;
+ }
+
+ if (ln->tn_type->t_tspec == PTR && rn->tn_type->t_tspec != PTR) {
+
+ if (!isityp(rn->tn_type->t_tspec))
+ LERROR("bldplmi()");
+
+ ctn = plength(ln->tn_type);
+ if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec)
+ rn = convert(NOOP, 0, ctn->tn_type, rn);
+ rn = mktnode(MULT, rn->tn_type, rn, ctn);
+ if (rn->tn_left->tn_op == CON)
+ rn = fold(rn);
+ ntn = mktnode(op, ln->tn_type, ln, rn);
+
+ } else if (rn->tn_type->t_tspec == PTR) {
+
+ if (ln->tn_type->t_tspec != PTR || op != MINUS)
+ LERROR("bldplmi()");
+#if PTRDIFF_IS_LONG
+ tp = gettyp(LONG);
+#else
+ tp = gettyp(INT);
+#endif
+ ntn = mktnode(op, tp, ln, rn);
+ if (ln->tn_op == CON && rn->tn_op == CON)
+ ntn = fold(ntn);
+ ctn = plength(ln->tn_type);
+ balance(NOOP, &ntn, &ctn);
+ ntn = mktnode(DIV, tp, ntn, ctn);
+
+ } else {
+
+ ntn = mktnode(op, ln->tn_type, ln, rn);
+
+ }
+ return (ntn);
+}
+
+/*
+ * Create a node for operators SHL and SHR.
+ */
+static tnode_t *
+bldshft(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ tspec_t t;
+ tnode_t *ntn;
+
+ if ((t = rn->tn_type->t_tspec) != INT && t != UINT)
+ rn = convert(CVT, 0, gettyp(INT), rn);
+ ntn = mktnode(op, ln->tn_type, ln, rn);
+ return (ntn);
+}
+
+/*
+ * Create a node for COLON.
+ */
+static tnode_t *
+bldcol(tnode_t *ln, tnode_t *rn)
+{
+ tspec_t lt, rt, pdt;
+ type_t *rtp;
+ tnode_t *ntn;
+
+ lt = ln->tn_type->t_tspec;
+ rt = rn->tn_type->t_tspec;
+#if PTRDIFF_IS_LONG
+ pdt = LONG;
+#else
+ pdt = INT;
+#endif
+
+ /*
+ * Arithmetic types are balanced, all other type combinations
+ * still need to be handled.
+ */
+ if (isatyp(lt) && isatyp(rt)) {
+ rtp = ln->tn_type;
+ } else if (lt == VOID || rt == VOID) {
+ rtp = gettyp(VOID);
+ } else if (lt == STRUCT || lt == UNION) {
+ /* Both types must be identical. */
+ if (rt != STRUCT && rt != UNION)
+ LERROR("bldcol()");
+ if (ln->tn_type->t_str != rn->tn_type->t_str)
+ LERROR("bldcol()");
+ if (incompl(ln->tn_type)) {
+ /* unknown operand size, op %s */
+ error(138, modtab[COLON].m_name);
+ return (NULL);
+ }
+ rtp = ln->tn_type;
+ } else if (lt == PTR && isityp(rt)) {
+ if (rt != pdt) {
+ rn = convert(NOOP, 0, gettyp(pdt), rn);
+ rt = pdt;
+ }
+ rtp = ln->tn_type;
+ } else if (rt == PTR && isityp(lt)) {
+ if (lt != pdt) {
+ ln = convert(NOOP, 0, gettyp(pdt), ln);
+ lt = pdt;
+ }
+ rtp = rn->tn_type;
+ } else if (lt == PTR && ln->tn_type->t_subt->t_tspec == VOID) {
+ if (rt != PTR)
+ LERROR("bldcol()");
+ rtp = ln->tn_type;
+ mrgqual(&rtp, ln->tn_type, rn->tn_type);
+ } else if (rt == PTR && rn->tn_type->t_subt->t_tspec == VOID) {
+ if (lt != PTR)
+ LERROR("bldcol()");
+ rtp = rn->tn_type;
+ mrgqual(&rtp, ln->tn_type, rn->tn_type);
+ } else {
+ if (lt != PTR || rt != PTR)
+ LERROR("bldcol()");
+ /*
+ * XXX For now we simply take the left type. This is
+ * probably wrong, if one type contains a function prototype
+ * and the other one, at the same place, only an old style
+ * declaration.
+ */
+ rtp = ln->tn_type;
+ mrgqual(&rtp, ln->tn_type, rn->tn_type);
+ }
+
+ ntn = mktnode(COLON, rtp, ln, rn);
+
+ return (ntn);
+}
+
+/*
+ * Create a node for an assignment operator (both = and op= ).
+ */
+static tnode_t *
+bldasgn(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ tspec_t lt, rt;
+ tnode_t *ntn, *ctn;
+
+ if (ln == NULL || rn == NULL)
+ LERROR("bldasgn()");
+
+ lt = ln->tn_type->t_tspec;
+ rt = rn->tn_type->t_tspec;
+
+ if ((op == ADDASS || op == SUBASS) && lt == PTR) {
+ if (!isityp(rt))
+ LERROR("bldasgn()");
+ ctn = plength(ln->tn_type);
+ if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec)
+ rn = convert(NOOP, 0, ctn->tn_type, rn);
+ rn = mktnode(MULT, rn->tn_type, rn, ctn);
+ if (rn->tn_left->tn_op == CON)
+ rn = fold(rn);
+ }
+
+ if ((op == ASSIGN || op == RETURN) && (lt == STRUCT || rt == STRUCT)) {
+ if (rt != lt || ln->tn_type->t_str != rn->tn_type->t_str)
+ LERROR("bldasgn()");
+ if (incompl(ln->tn_type)) {
+ if (op == RETURN) {
+ /* cannot return incomplete type */
+ error(212);
+ } else {
+ /* unknown operand size, op %s */
+ error(138, modtab[op].m_name);
+ }
+ return (NULL);
+ }
+ }
+
+ if (op == SHLASS) {
+ if (psize(lt) < psize(rt)) {
+ if (hflag)
+ /* semantics of %s change in ANSI C; use ... */
+ warning(118, "<<=");
+ }
+ } else if (op != SHRASS) {
+ if (op == ASSIGN || lt != PTR) {
+ if (lt != rt ||
+ (ln->tn_type->t_isfield && rn->tn_op == CON)) {
+ rn = convert(op, 0, ln->tn_type, rn);
+ rt = lt;
+ }
+ }
+ }
+
+ ntn = mktnode(op, ln->tn_type, ln, rn);
+
+ return (ntn);
+}
+
+/*
+ * Get length of type tp->t_subt.
+ */
+static tnode_t *
+plength(type_t *tp)
+{
+ int elem, elsz;
+ tspec_t st;
+
+ if (tp->t_tspec != PTR)
+ LERROR("plength()");
+ tp = tp->t_subt;
+
+ elem = 1;
+ elsz = 0;
+
+ while (tp->t_tspec == ARRAY) {
+ elem *= tp->t_dim;
+ tp = tp->t_subt;
+ }
+
+ switch (tp->t_tspec) {
+ case FUNC:
+ /* pointer to function is not allowed here */
+ error(110);
+ break;
+ case VOID:
+ /* cannot do pointer arithmetic on operand of ... */
+ (void)gnuism(136);
+ break;
+ case STRUCT:
+ case UNION:
+ if ((elsz = tp->t_str->size) == 0)
+ /* cannot do pointer arithmetic on operand of ... */
+ error(136);
+ break;
+ case ENUM:
+ if (incompl(tp)) {
+ /* cannot do pointer arithmetic on operand of ... */
+ warning(136);
+ }
+ /* FALLTHROUGH */
+ default:
+ if ((elsz = size(tp->t_tspec)) == 0) {
+ /* cannot do pointer arithmetic on operand of ... */
+ error(136);
+ } else if (elsz == -1) {
+ LERROR("plength()");
+ }
+ break;
+ }
+
+ if (elem == 0 && elsz != 0) {
+ /* cannot do pointer arithmetic on operand of ... */
+ error(136);
+ }
+
+ if (elsz == 0)
+ elsz = CHAR_BIT;
+
+#if PTRDIFF_IS_LONG
+ st = LONG;
+#else
+ st = INT;
+#endif
+
+ return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT)));
+}
+
+/*
+ * XXX
+ * Note: There appear to be a number of bugs in detecting overflow in
+ * this function. An audit and a set of proper regression tests are needed.
+ * --Perry Metzger, Nov. 16, 2001
+ */
+/*
+ * Do only as much as necessary to compute constant expressions.
+ * Called only if the operator allows folding and (both) operands
+ * are constants.
+ */
+static tnode_t *
+fold(tnode_t *tn)
+{
+ val_t *v;
+ tspec_t t;
+ int utyp, ovfl;
+ int64_t sl, sr = 0, q = 0, mask;
+ uint64_t ul, ur = 0;
+ tnode_t *cn;
+
+ if ((v = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+ v->v_tspec = t = tn->tn_type->t_tspec;
+
+ utyp = t == PTR || isutyp(t);
+ ul = sl = tn->tn_left->tn_val->v_quad;
+ if (modtab[tn->tn_op].m_binary)
+ ur = sr = tn->tn_right->tn_val->v_quad;
+
+ mask = qlmasks[size(t)];
+ ovfl = 0;
+
+ switch (tn->tn_op) {
+ case UPLUS:
+ q = sl;
+ break;
+ case UMINUS:
+ q = -sl;
+ if (msb(q, t, -1) == msb(sl, t, -1))
+ ovfl = 1;
+ break;
+ case COMPL:
+ q = ~sl;
+ break;
+ case MULT:
+ if (utyp) {
+ q = ul * ur;
+ if (q != (q & mask))
+ ovfl = 1;
+ else if ((ul != 0) && ((q / ul) != ur))
+ ovfl = 1;
+ } else {
+ q = sl * sr;
+ if (msb(q, t, -1) != (msb(sl, t, -1) ^ msb(sr, t, -1)))
+ ovfl = 1;
+ }
+ break;
+ case DIV:
+ if (sr == 0) {
+ /* division by 0 */
+ error(139);
+ q = utyp ? UQUAD_MAX : QUAD_MAX;
+ } else {
+ q = utyp ? ul / ur : sl / sr;
+ }
+ break;
+ case MOD:
+ if (sr == 0) {
+ /* modulus by 0 */
+ error(140);
+ q = 0;
+ } else {
+ q = utyp ? ul % ur : sl % sr;
+ }
+ break;
+ case PLUS:
+ q = utyp ? ul + ur : sl + sr;
+ if (msb(sl, t, -1) != 0 && msb(sr, t, -1) != 0) {
+ if (msb(q, t, -1) == 0)
+ ovfl = 1;
+ } else if (msb(sl, t, -1) == 0 && msb(sr, t, -1) == 0) {
+ if (msb(q, t, -1) != 0)
+ ovfl = 1;
+ }
+ break;
+ case MINUS:
+ q = utyp ? ul - ur : sl - sr;
+ if (msb(sl, t, -1) != 0 && msb(sr, t, -1) == 0) {
+ if (msb(q, t, -1) == 0)
+ ovfl = 1;
+ } else if (msb(sl, t, -1) == 0 && msb(sr, t, -1) != 0) {
+ if (msb(q, t, -1) != 0)
+ ovfl = 1;
+ }
+ break;
+ case SHL:
+ q = utyp ? ul << sr : sl << sr;
+ break;
+ case SHR:
+ /*
+ * The sign must be explicitly extended because
+ * shifts of signed values are implementation dependent.
+ */
+ q = ul >> sr;
+ q = xsign(q, t, size(t) - (int)sr);
+ break;
+ case LT:
+ q = utyp ? ul < ur : sl < sr;
+ break;
+ case LE:
+ q = utyp ? ul <= ur : sl <= sr;
+ break;
+ case GE:
+ q = utyp ? ul >= ur : sl >= sr;
+ break;
+ case GT:
+ q = utyp ? ul > ur : sl > sr;
+ break;
+ case EQ:
+ q = utyp ? ul == ur : sl == sr;
+ break;
+ case NE:
+ q = utyp ? ul != ur : sl != sr;
+ break;
+ case AND:
+ q = utyp ? ul & ur : sl & sr;
+ break;
+ case XOR:
+ q = utyp ? ul ^ ur : sl ^ sr;
+ break;
+ case OR:
+ q = utyp ? ul | ur : sl | sr;
+ break;
+ default:
+ LERROR("fold()");
+ }
+
+ /* XXX does not work for quads. */
+ if (ovfl || ((q | mask) != ~(uint64_t)0 && (q & ~mask) != 0)) {
+ if (hflag)
+ /* integer overflow detected, op %s */
+ warning(141, modtab[tn->tn_op].m_name);
+ }
+
+ v->v_quad = xsign(q, t, -1);
+
+ cn = getcnode(tn->tn_type, v);
+
+ return (cn);
+}
+
+/*
+ * Same for operators whose operands are compared with 0 (test context).
+ */
+static tnode_t *
+foldtst(tnode_t *tn)
+{
+ int l, r = 0;
+ val_t *v;
+
+ if ((v = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+ v->v_tspec = tn->tn_type->t_tspec;
+ if (tn->tn_type->t_tspec != INT)
+ LERROR("foldtst()");
+
+ if (isftyp(tn->tn_left->tn_type->t_tspec)) {
+ l = tn->tn_left->tn_val->v_ldbl != 0.0;
+ } else {
+ l = tn->tn_left->tn_val->v_quad != 0;
+ }
+
+ if (modtab[tn->tn_op].m_binary) {
+ if (isftyp(tn->tn_right->tn_type->t_tspec)) {
+ r = tn->tn_right->tn_val->v_ldbl != 0.0;
+ } else {
+ r = tn->tn_right->tn_val->v_quad != 0;
+ }
+ }
+
+ switch (tn->tn_op) {
+ case NOT:
+ if (hflag)
+ /* constant argument to NOT */
+ warning(239);
+ v->v_quad = !l;
+ break;
+ case LOGAND:
+ v->v_quad = l && r;
+ break;
+ case LOGOR:
+ v->v_quad = l || r;
+ break;
+ default:
+ LERROR("foldtst()");
+ }
+
+ return (getcnode(tn->tn_type, v));
+}
+
+/*
+ * Same for operands with floating point type.
+ */
+static tnode_t *
+foldflt(tnode_t *tn)
+{
+ val_t *v;
+ tspec_t t;
+ ldbl_t l, r = 0;
+
+ if ((v = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+ v->v_tspec = t = tn->tn_type->t_tspec;
+
+ if (!isftyp(t))
+ LERROR("foldflt()");
+
+ if (t != tn->tn_left->tn_type->t_tspec)
+ LERROR("foldflt()");
+ if (modtab[tn->tn_op].m_binary && t != tn->tn_right->tn_type->t_tspec)
+ LERROR("foldflt()");
+
+ l = tn->tn_left->tn_val->v_ldbl;
+ if (modtab[tn->tn_op].m_binary)
+ r = tn->tn_right->tn_val->v_ldbl;
+
+ switch (tn->tn_op) {
+ case UPLUS:
+ v->v_ldbl = l;
+ break;
+ case UMINUS:
+ v->v_ldbl = -l;
+ break;
+ case MULT:
+ v->v_ldbl = l * r;
+ break;
+ case DIV:
+ if (r == 0.0) {
+ /* division by 0 */
+ error(139);
+ if (t == FLOAT) {
+ v->v_ldbl = l < 0 ? -FLT_MAX : FLT_MAX;
+ } else if (t == DOUBLE) {
+ v->v_ldbl = l < 0 ? -DBL_MAX : DBL_MAX;
+ } else {
+ v->v_ldbl = l < 0 ? -LDBL_MAX : LDBL_MAX;
+ }
+ } else {
+ v->v_ldbl = l / r;
+ }
+ break;
+ case PLUS:
+ v->v_ldbl = l + r;
+ break;
+ case MINUS:
+ v->v_ldbl = l - r;
+ break;
+ case LT:
+ v->v_quad = l < r;
+ break;
+ case LE:
+ v->v_quad = l <= r;
+ break;
+ case GE:
+ v->v_quad = l >= r;
+ break;
+ case GT:
+ v->v_quad = l > r;
+ break;
+ case EQ:
+ v->v_quad = l == r;
+ break;
+ case NE:
+ v->v_quad = l != r;
+ break;
+ default:
+ LERROR("foldflt()");
+ }
+
+ if (isnan((double)v->v_ldbl))
+ LERROR("foldflt()");
+ if (!finite((double)v->v_ldbl) ||
+ (t == FLOAT &&
+ (v->v_ldbl > FLT_MAX || v->v_ldbl < -FLT_MAX)) ||
+ (t == DOUBLE &&
+ (v->v_ldbl > DBL_MAX || v->v_ldbl < -DBL_MAX))) {
+ /* floating point overflow detected, op %s */
+ warning(142, modtab[tn->tn_op].m_name);
+ if (t == FLOAT) {
+ v->v_ldbl = v->v_ldbl < 0 ? -FLT_MAX : FLT_MAX;
+ } else if (t == DOUBLE) {
+ v->v_ldbl = v->v_ldbl < 0 ? -DBL_MAX : DBL_MAX;
+ } else {
+ v->v_ldbl = v->v_ldbl < 0 ? -LDBL_MAX: LDBL_MAX;
+ }
+ }
+
+ return (getcnode(tn->tn_type, v));
+}
+
+/*
+ * Create a constant node for sizeof.
+ */
+tnode_t *
+bldszof(type_t *tp)
+{
+ int elem, elsz;
+ tspec_t st;
+
+ elem = 1;
+ while (tp->t_tspec == ARRAY) {
+ elem *= tp->t_dim;
+ tp = tp->t_subt;
+ }
+ if (elem == 0) {
+ /* cannot take size of incomplete type */
+ error(143);
+ elem = 1;
+ }
+ switch (tp->t_tspec) {
+ case FUNC:
+ /* cannot take size of function */
+ error(144);
+ elsz = 1;
+ break;
+ case STRUCT:
+ case UNION:
+ if (incompl(tp)) {
+ /* cannot take size of incomplete type */
+ error(143);
+ elsz = 1;
+ } else {
+ elsz = tp->t_str->size;
+ }
+ break;
+ case ENUM:
+ if (incompl(tp)) {
+ /* cannot take size of incomplete type */
+ warning(143);
+ }
+ /* FALLTHROUGH */
+ default:
+ if (tp->t_isfield) {
+ /* cannot take size of bit-field */
+ error(145);
+ }
+ if (tp->t_tspec == VOID) {
+ /* cannot take size of void */
+ error(146);
+ elsz = 1;
+ } else {
+ elsz = size(tp->t_tspec);
+ if (elsz <= 0)
+ LERROR("bldszof()");
+ }
+ break;
+ }
+
+#if SIZEOF_IS_ULONG
+ st = ULONG;
+#else
+ st = UINT;
+#endif
+
+ return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT)));
+}
+
+/*
+ * Type casts.
+ */
+tnode_t *
+cast(tnode_t *tn, type_t *tp)
+{
+ tspec_t nt, ot;
+
+ if (tn == NULL)
+ return (NULL);
+
+ tn = cconv(tn);
+
+ nt = tp->t_tspec;
+ ot = tn->tn_type->t_tspec;
+
+ if (nt == VOID) {
+ /*
+ * XXX ANSI C requires scalar types or void (Plauger&Brodie).
+ * But this seams really questionable.
+ */
+ } else if (nt == STRUCT || nt == UNION || nt == ARRAY || nt == FUNC) {
+ /* invalid cast expression */
+ error(147);
+ return (NULL);
+ } else if (ot == STRUCT || ot == UNION) {
+ /* invalid cast expression */
+ error(147);
+ return (NULL);
+ } else if (ot == VOID) {
+ /* improper cast of void expression */
+ error(148);
+ return (NULL);
+ } else if (isityp(nt) && issclt(ot)) {
+ /* ok */
+ } else if (isftyp(nt) && isatyp(ot)) {
+ /* ok */
+ } else if (nt == PTR && isityp(ot)) {
+ /* ok */
+ } else if (nt == PTR && ot == PTR) {
+ if (!tp->t_subt->t_const && tn->tn_type->t_subt->t_const) {
+ if (hflag)
+ /* cast discards 'const' from ... */
+ warning(275);
+ }
+ } else {
+ /* invalid cast expression */
+ error(147);
+ return (NULL);
+ }
+
+ tn = convert(CVT, 0, tp, tn);
+ tn->tn_cast = 1;
+
+ return (tn);
+}
+
+/*
+ * Create the node for a function argument.
+ * All necessary conversions and type checks are done in funccall(), because
+ * in funcarg() we have no information about expected argument types.
+ */
+tnode_t *
+funcarg(tnode_t *args, tnode_t *arg)
+{
+ tnode_t *ntn;
+
+ /*
+ * If there was a serious error in the expression for the argument,
+ * create a dummy argument so the positions of the remaining arguments
+ * will not change.
+ */
+ if (arg == NULL)
+ arg = getinode(INT, (int64_t)0);
+
+ ntn = mktnode(PUSH, arg->tn_type, arg, args);
+
+ return (ntn);
+}
+
+/*
+ * Create the node for a function call. Also check types of
+ * function arguments and insert conversions, if necessary.
+ */
+tnode_t *
+funccall(tnode_t *func, tnode_t *args)
+{
+ tnode_t *ntn;
+ op_t fcop;
+
+ if (func == NULL)
+ return (NULL);
+
+ if (func->tn_op == NAME && func->tn_type->t_tspec == FUNC) {
+ fcop = CALL;
+ } else {
+ fcop = ICALL;
+ }
+
+ /*
+ * after cconv() func will always be a pointer to a function
+ * if it is a valid function designator.
+ */
+ func = cconv(func);
+
+ if (func->tn_type->t_tspec != PTR ||
+ func->tn_type->t_subt->t_tspec != FUNC) {
+ /* illegal function */
+ error(149);
+ return (NULL);
+ }
+
+ args = chkfarg(func->tn_type->t_subt, args);
+
+ ntn = mktnode(fcop, func->tn_type->t_subt->t_subt, func, args);
+
+ return (ntn);
+}
+
+/*
+ * Check types of all function arguments and insert conversions,
+ * if necessary.
+ */
+static tnode_t *
+chkfarg(type_t *ftp, tnode_t *args)
+{
+ tnode_t *arg;
+ sym_t *asym;
+ tspec_t at;
+ int narg, npar, n, i;
+
+ /* get # of args in the prototype */
+ npar = 0;
+ for (asym = ftp->t_args; asym != NULL; asym = asym->s_nxt)
+ npar++;
+
+ /* get # of args in function call */
+ narg = 0;
+ for (arg = args; arg != NULL; arg = arg->tn_right)
+ narg++;
+
+ asym = ftp->t_args;
+ if (ftp->t_proto && npar != narg && !(ftp->t_vararg && npar < narg)) {
+ /* argument mismatch: %d arg%s passed, %d expected */
+ error(150, narg, narg > 1 ? "s" : "", npar);
+ asym = NULL;
+ }
+
+ for (n = 1; n <= narg; n++) {
+
+ /*
+ * The rightmost argument is at the top of the argument
+ * subtree.
+ */
+ for (i = narg, arg = args; i > n; i--, arg = arg->tn_right)
+ continue;
+
+ /* some things which are always not allowd */
+ if ((at = arg->tn_left->tn_type->t_tspec) == VOID) {
+ /* void expressions may not be arguments, arg #%d */
+ error(151, n);
+ return (NULL);
+ } else if ((at == STRUCT || at == UNION) &&
+ incompl(arg->tn_left->tn_type)) {
+ /* argument cannot have unknown size, arg #%d */
+ error(152, n);
+ return (NULL);
+ } else if (isityp(at) && arg->tn_left->tn_type->t_isenum &&
+ incompl(arg->tn_left->tn_type)) {
+ /* argument cannot have unknown size, arg #%d */
+ warning(152, n);
+ }
+
+ /* class conversions (arg in value context) */
+ arg->tn_left = cconv(arg->tn_left);
+
+ if (asym != NULL) {
+ arg->tn_left = parg(n, asym->s_type, arg->tn_left);
+ } else {
+ arg->tn_left = promote(NOOP, 1, arg->tn_left);
+ }
+ arg->tn_type = arg->tn_left->tn_type;
+
+ if (asym != NULL)
+ asym = asym->s_nxt;
+ }
+
+ return (args);
+}
+
+/*
+ * Compare the type of an argument with the corresponding type of a
+ * prototype parameter. If it is a valid combination, but both types
+ * are not the same, insert a conversion to convert the argument into
+ * the type of the parameter.
+ */
+static tnode_t *
+parg( int n, /* pos of arg */
+ type_t *tp, /* expected type (from prototype) */
+ tnode_t *tn) /* argument */
+{
+ tnode_t *ln;
+ int warn;
+
+ if ((ln = calloc(1, sizeof (tnode_t))) == NULL)
+ nomem();
+ ln->tn_type = tduptyp(tp);
+ ln->tn_type->t_const = 0;
+ ln->tn_lvalue = 1;
+ if (typeok(FARG, n, ln, tn)) {
+ if (!eqtype(tp, tn->tn_type, 1, 0, (warn = 0, &warn)) || warn)
+ tn = convert(FARG, n, tp, tn);
+ }
+ free(ln);
+ return (tn);
+}
+
+/*
+ * Return the value of an integral constant expression.
+ * If the expression is not constant or its type is not an integer
+ * type, an error message is printed.
+ */
+val_t *
+constant(tnode_t *tn, int required)
+{
+ val_t *v;
+
+ if (tn != NULL)
+ tn = cconv(tn);
+ if (tn != NULL)
+ tn = promote(NOOP, 0, tn);
+
+ if ((v = calloc(1, sizeof (val_t))) == NULL)
+ nomem();
+
+ if (tn == NULL) {
+ if (nerr == 0)
+ LERROR("constant()");
+ v->v_tspec = INT;
+ v->v_quad = 1;
+ return (v);
+ }
+
+ v->v_tspec = tn->tn_type->t_tspec;
+
+ if (tn->tn_op == CON) {
+ if (tn->tn_type->t_tspec != tn->tn_val->v_tspec)
+ LERROR("constant()");
+ if (isityp(tn->tn_val->v_tspec)) {
+ v->v_ansiu = tn->tn_val->v_ansiu;
+ v->v_quad = tn->tn_val->v_quad;
+ return (v);
+ }
+ v->v_quad = tn->tn_val->v_ldbl;
+ } else {
+ v->v_quad = 1;
+ }
+
+ /* integral constant expression expected */
+ if (required)
+ error(55);
+ else
+ c99ism(318);
+
+ if (!isityp(v->v_tspec))
+ v->v_tspec = INT;
+
+ return (v);
+}
+
+/*
+ * Perform some tests on expressions which can't be done in build() and
+ * functions called by build(). These tests must be done here because
+ * we need some information about the context in which the operations
+ * are performed.
+ * After all tests are performed, expr() frees the memory which is used
+ * for the expression.
+ */
+void
+expr(tnode_t *tn, int vctx, int tctx, int freeblk)
+{
+
+ if (tn == NULL && nerr == 0)
+ LERROR("expr()");
+
+ if (tn == NULL) {
+ tfreeblk();
+ return;
+ }
+
+ /* expr() is also called in global initialisations */
+ if (dcs->d_ctx != EXTERN)
+ chkreach();
+
+ chkmisc(tn, vctx, tctx, !tctx, 0, 0, 0);
+ if (tn->tn_op == ASSIGN) {
+ if (hflag && tctx)
+ /* assignment in conditional context */
+ warning(159);
+ } else if (tn->tn_op == CON) {
+ if (hflag && tctx && !ccflg)
+ /* constant in conditional context */
+ warning(161);
+ }
+ if (!modtab[tn->tn_op].m_sideeff) {
+ /*
+ * for left operands of COMMA this warning is already
+ * printed
+ */
+ if (tn->tn_op != COMMA && !vctx && !tctx)
+ nulleff(tn);
+ }
+ if (dflag)
+ displexpr(tn, 0);
+
+ /* free the tree memory */
+ if (freeblk)
+ tfreeblk();
+}
+
+static void
+nulleff(tnode_t *tn)
+{
+
+ if (!hflag)
+ return;
+
+ while (!modtab[tn->tn_op].m_sideeff) {
+ if (tn->tn_op == CVT && tn->tn_type->t_tspec == VOID) {
+ tn = tn->tn_left;
+ } else if (tn->tn_op == LOGAND || tn->tn_op == LOGOR) {
+ /*
+ * && and || have a side effect if the right operand
+ * has a side effect.
+ */
+ tn = tn->tn_right;
+ } else if (tn->tn_op == QUEST) {
+ /*
+ * ? has a side effect if at least one of its right
+ * operands has a side effect
+ */
+ tn = tn->tn_right;
+ } else if (tn->tn_op == COLON || tn->tn_op == COMMA) {
+ /*
+ * : has a side effect if at least one of its operands
+ * has a side effect
+ */
+ if (modtab[tn->tn_left->tn_op].m_sideeff) {
+ tn = tn->tn_left;
+ } else if (modtab[tn->tn_right->tn_op].m_sideeff) {
+ tn = tn->tn_right;
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ if (!modtab[tn->tn_op].m_sideeff)
+ /* expression has null effect */
+ warning(129);
+}
+
+/*
+ * Dump an expression to stdout
+ * only used for debugging
+ */
+static void
+displexpr(tnode_t *tn, int offs)
+{
+ uint64_t uq;
+
+ if (tn == NULL) {
+ (void)printf("%*s%s\n", offs, "", "NULL");
+ return;
+ }
+ (void)printf("%*sop %s ", offs, "", modtab[tn->tn_op].m_name);
+
+ if (tn->tn_op == NAME) {
+ (void)printf("%s: %s ",
+ tn->tn_sym->s_name, scltoa(tn->tn_sym->s_scl));
+ } else if (tn->tn_op == CON && isftyp(tn->tn_type->t_tspec)) {
+ (void)printf("%#g ", (double)tn->tn_val->v_ldbl);
+ } else if (tn->tn_op == CON && isityp(tn->tn_type->t_tspec)) {
+ uq = tn->tn_val->v_quad;
+ (void)printf("0x %08lx %08lx ", (long)(uq >> 32) & 0xffffffffl,
+ (long)uq & 0xffffffffl);
+ } else if (tn->tn_op == CON) {
+ if (tn->tn_type->t_tspec != PTR)
+ LERROR("displexpr()");
+ (void)printf("0x%0*lx ", (int)(sizeof (void *) * CHAR_BIT / 4),
+ (u_long)tn->tn_val->v_quad);
+ } else if (tn->tn_op == STRING) {
+ if (tn->tn_strg->st_tspec == CHAR) {
+ (void)printf("\"%s\"", tn->tn_strg->st_cp);
+ } else {
+ char *s;
+ size_t n;
+ n = MB_CUR_MAX * (tn->tn_strg->st_len + 1);
+ if ((s = malloc(n)) == NULL)
+ nomem();
+ (void)wcstombs(s, tn->tn_strg->st_wcp, n);
+ (void)printf("L\"%s\"", s);
+ free(s);
+ }
+ (void)printf(" ");
+ } else if (tn->tn_op == FSEL) {
+ (void)printf("o=%d, l=%d ", tn->tn_type->t_foffs,
+ tn->tn_type->t_flen);
+ }
+ (void)printf("%s\n", ttos(tn->tn_type));
+ if (tn->tn_op == NAME || tn->tn_op == CON || tn->tn_op == STRING)
+ return;
+ displexpr(tn->tn_left, offs + 2);
+ if (modtab[tn->tn_op].m_binary ||
+ (tn->tn_op == PUSH && tn->tn_right != NULL)) {
+ displexpr(tn->tn_right, offs + 2);
+ }
+}
+
+/*
+ * Called by expr() to recursively perform some tests.
+ */
+/* ARGSUSED */
+void
+chkmisc(tnode_t *tn, int vctx, int tctx, int eqwarn, int fcall, int rvdisc,
+ int szof)
+{
+ tnode_t *ln, *rn;
+ mod_t *mp;
+ int nrvdisc, cvctx, ctctx;
+ op_t op;
+ scl_t sc;
+ dinfo_t *di;
+
+ if (tn == NULL)
+ return;
+
+ ln = tn->tn_left;
+ rn = tn->tn_right;
+ mp = &modtab[op = tn->tn_op];
+
+ switch (op) {
+ case AMPER:
+ if (ln->tn_op == NAME && (reached || rchflg)) {
+ if (!szof)
+ setsflg(ln->tn_sym);
+ setuflg(ln->tn_sym, fcall, szof);
+ }
+ if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+ /* check the range of array indices */
+ chkaidx(ln->tn_left, 1);
+ break;
+ case LOAD:
+ if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+ /* check the range of array indices */
+ chkaidx(ln->tn_left, 0);
+ /* FALLTHROUGH */
+ case PUSH:
+ case INCBEF:
+ case DECBEF:
+ case INCAFT:
+ case DECAFT:
+ case ADDASS:
+ case SUBASS:
+ case MULASS:
+ case DIVASS:
+ case MODASS:
+ case ANDASS:
+ case ORASS:
+ case XORASS:
+ case SHLASS:
+ case SHRASS:
+ if (ln->tn_op == NAME && (reached || rchflg)) {
+ sc = ln->tn_sym->s_scl;
+ /*
+ * Look if there was an asm statement in one of the
+ * compound statements we are in. If not, we don't
+ * print a warning.
+ */
+ for (di = dcs; di != NULL; di = di->d_nxt) {
+ if (di->d_asm)
+ break;
+ }
+ if (sc != EXTERN && sc != STATIC &&
+ !ln->tn_sym->s_set && !szof && di == NULL) {
+ /* %s may be used before set */
+ warning(158, ln->tn_sym->s_name);
+ setsflg(ln->tn_sym);
+ }
+ setuflg(ln->tn_sym, 0, 0);
+ }
+ break;
+ case ASSIGN:
+ if (ln->tn_op == NAME && !szof && (reached || rchflg)) {
+ setsflg(ln->tn_sym);
+ if (ln->tn_sym->s_scl == EXTERN)
+ outusg(ln->tn_sym);
+ }
+ if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+ /* check the range of array indices */
+ chkaidx(ln->tn_left, 0);
+ break;
+ case CALL:
+ if (ln->tn_op != AMPER || ln->tn_left->tn_op != NAME)
+ LERROR("chkmisc()");
+ if (!szof)
+ outcall(tn, vctx || tctx, rvdisc);
+ break;
+ case EQ:
+ /* equality operator "==" found where "=" was exp. */
+ if (hflag && eqwarn)
+ warning(160);
+ break;
+ case CON:
+ case NAME:
+ case STRING:
+ return;
+ /* LINTED (enumeration values not handled in switch) */
+ case OR:
+ case XOR:
+ case NE:
+ case GE:
+ case GT:
+ case LE:
+ case LT:
+ case SHR:
+ case SHL:
+ case MINUS:
+ case PLUS:
+ case MOD:
+ case DIV:
+ case MULT:
+ case STAR:
+ case UMINUS:
+ case UPLUS:
+ case DEC:
+ case INC:
+ case COMPL:
+ case NOT:
+ case POINT:
+ case ARROW:
+ case NOOP:
+ case AND:
+ case FARG:
+ case CASE:
+ case INIT:
+ case RETURN:
+ case ICALL:
+ case CVT:
+ case COMMA:
+ case FSEL:
+ case COLON:
+ case QUEST:
+ case LOGOR:
+ case LOGAND:
+ break;
+ }
+
+ cvctx = mp->m_vctx;
+ ctctx = mp->m_tctx;
+ /*
+ * values of operands of ':' are not used if the type of at least
+ * one of the operands (for gcc compatibility) is void
+ * XXX test/value context of QUEST should probably be used as
+ * context for both operands of COLON
+ */
+ if (op == COLON && tn->tn_type->t_tspec == VOID)
+ cvctx = ctctx = 0;
+ nrvdisc = op == CVT && tn->tn_type->t_tspec == VOID;
+ chkmisc(ln, cvctx, ctctx, mp->m_eqwarn, op == CALL, nrvdisc, szof);
+
+ switch (op) {
+ case PUSH:
+ if (rn != NULL)
+ chkmisc(rn, 0, 0, mp->m_eqwarn, 0, 0, szof);
+ break;
+ case LOGAND:
+ case LOGOR:
+ chkmisc(rn, 0, 1, mp->m_eqwarn, 0, 0, szof);
+ break;
+ case COLON:
+ chkmisc(rn, cvctx, ctctx, mp->m_eqwarn, 0, 0, szof);
+ break;
+ case COMMA:
+ chkmisc(rn, vctx, tctx, mp->m_eqwarn, 0, 0, szof);
+ break;
+ default:
+ if (mp->m_binary)
+ chkmisc(rn, 1, 0, mp->m_eqwarn, 0, 0, szof);
+ break;
+ }
+
+}
+
+/*
+ * Checks the range of array indices, if possible.
+ * amper is set if only the address of the element is used. This
+ * means that the index is allowed to refer to the first element
+ * after the array.
+ */
+static void
+chkaidx(tnode_t *tn, int amper)
+{
+ int dim;
+ tnode_t *ln, *rn;
+ int elsz;
+ int64_t con;
+
+ ln = tn->tn_left;
+ rn = tn->tn_right;
+
+ /* We can only check constant indices. */
+ if (rn->tn_op != CON)
+ return;
+
+ /* Return if the left node does not stem from an array. */
+ if (ln->tn_op != AMPER)
+ return;
+ if (ln->tn_left->tn_op != STRING && ln->tn_left->tn_op != NAME)
+ return;
+ if (ln->tn_left->tn_type->t_tspec != ARRAY)
+ return;
+
+ /*
+ * For incomplete array types, we can print a warning only if
+ * the index is negative.
+ */
+ if (incompl(ln->tn_left->tn_type) && rn->tn_val->v_quad >= 0)
+ return;
+
+ /* Get the size of one array element */
+ if ((elsz = length(ln->tn_type->t_subt, NULL)) == 0)
+ return;
+ elsz /= CHAR_BIT;
+
+ /* Change the unit of the index from bytes to element size. */
+ if (isutyp(rn->tn_type->t_tspec)) {
+ con = (uint64_t)rn->tn_val->v_quad / elsz;
+ } else {
+ con = rn->tn_val->v_quad / elsz;
+ }
+
+ dim = ln->tn_left->tn_type->t_dim + (amper ? 1 : 0);
+
+ if (!isutyp(rn->tn_type->t_tspec) && con < 0) {
+ /* array subscript cannot be negative: %ld */
+ warning(167, (long)con);
+ } else if (dim > 0 && (uint64_t)con >= dim) {
+ /* array subscript cannot be > %d: %ld */
+ warning(168, dim - 1, (long)con);
+ }
+}
+
+/*
+ * Check for ordered comparisons of unsigned values with 0.
+ */
+static void
+chkcomp(op_t op, tnode_t *ln, tnode_t *rn)
+{
+ char buf[64];
+ tspec_t lt, rt;
+ mod_t *mp;
+
+ lt = ln->tn_type->t_tspec;
+ rt = rn->tn_type->t_tspec;
+ mp = &modtab[op];
+
+ if (ln->tn_op != CON && rn->tn_op != CON)
+ return;
+
+ if (!isityp(lt) || !isityp(rt))
+ return;
+
+ if ((hflag || pflag) && lt == CHAR && rn->tn_op == CON &&
+ (rn->tn_val->v_quad < 0 ||
+ rn->tn_val->v_quad > ~(~0 << (CHAR_BIT - 1)))) {
+ /* nonportable character comparison, op %s */
+ warning(230, mp->m_name);
+ return;
+ }
+ if ((hflag || pflag) && rt == CHAR && ln->tn_op == CON &&
+ (ln->tn_val->v_quad < 0 ||
+ ln->tn_val->v_quad > ~(~0 << (CHAR_BIT - 1)))) {
+ /* nonportable character comparison, op %s */
+ warning(230, mp->m_name);
+ return;
+ }
+ if (isutyp(lt) && !isutyp(rt) &&
+ rn->tn_op == CON && rn->tn_val->v_quad <= 0) {
+ if (rn->tn_val->v_quad < 0) {
+ /* comparison of %s with %s, op %s */
+ warning(162, tyname(buf, sizeof(buf), ln->tn_type),
+ "negative constant", mp->m_name);
+ } else if (op == LT || op == GE || (hflag && op == LE)) {
+ /* comparison of %s with %s, op %s */
+ warning(162, tyname(buf, sizeof(buf), ln->tn_type),
+ "0", mp->m_name);
+ }
+ return;
+ }
+ if (isutyp(rt) && !isutyp(lt) &&
+ ln->tn_op == CON && ln->tn_val->v_quad <= 0) {
+ if (ln->tn_val->v_quad < 0) {
+ /* comparison of %s with %s, op %s */
+ warning(162, "negative constant",
+ tyname(buf, sizeof(buf), rn->tn_type), mp->m_name);
+ } else if (op == GT || op == LE || (hflag && op == GE)) {
+ /* comparison of %s with %s, op %s */
+ warning(162, "0", tyname(buf, sizeof(buf), rn->tn_type),
+ mp->m_name);
+ }
+ return;
+ }
+}
+
+/*
+ * Takes an expression and returns 0 if this expression can be used
+ * for static initialisation, otherwise -1.
+ *
+ * Constant initialisation expressions must be constant or an address
+ * of a static object with an optional offset. In the first case,
+ * the result is returned in *offsp. In the second case, the static
+ * object is returned in *symp and the offset in *offsp.
+ *
+ * The expression can consist of PLUS, MINUS, AMPER, NAME, STRING and
+ * CON. Type conversions are allowed if they do not change binary
+ * representation (including width).
+ */
+int
+conaddr(tnode_t *tn, sym_t **symp, ptrdiff_t *offsp)
+{
+ sym_t *sym;
+ ptrdiff_t offs1, offs2;
+ tspec_t t, ot;
+
+ switch (tn->tn_op) {
+ case MINUS:
+ if (tn->tn_right->tn_op == CVT)
+ return conaddr(tn->tn_right, symp, offsp);
+ else if (tn->tn_right->tn_op != CON)
+ return (-1);
+ /* FALLTHROUGH */
+ case PLUS:
+ offs1 = offs2 = 0;
+ if (tn->tn_left->tn_op == CON) {
+ offs1 = (ptrdiff_t)tn->tn_left->tn_val->v_quad;
+ if (conaddr(tn->tn_right, &sym, &offs2) == -1)
+ return (-1);
+ } else if (tn->tn_right->tn_op == CON) {
+ offs2 = (ptrdiff_t)tn->tn_right->tn_val->v_quad;
+ if (tn->tn_op == MINUS)
+ offs2 = -offs2;
+ if (conaddr(tn->tn_left, &sym, &offs1) == -1)
+ return (-1);
+ } else {
+ return (-1);
+ }
+ *symp = sym;
+ *offsp = offs1 + offs2;
+ break;
+ case AMPER:
+ if (tn->tn_left->tn_op == NAME) {
+ *symp = tn->tn_left->tn_sym;
+ *offsp = 0;
+ } else if (tn->tn_left->tn_op == STRING) {
+ /*
+ * If this would be the front end of a compiler we
+ * would return a label instead of 0.
+ */
+ *offsp = 0;
+ }
+ break;
+ case CVT:
+ t = tn->tn_type->t_tspec;
+ ot = tn->tn_left->tn_type->t_tspec;
+ if ((!isityp(t) && t != PTR) || (!isityp(ot) && ot != PTR))
+ return (-1);
+ else if (psize(t) != psize(ot)) {
+ return (-1);
+ }
+ if (conaddr(tn->tn_left, symp, offsp) == -1)
+ return (-1);
+ break;
+ default:
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * Concatenate two string constants.
+ */
+strg_t *
+catstrg(strg_t *strg1, strg_t *strg2)
+{
+ size_t len1, len2, len;
+
+ if (strg1->st_tspec != strg2->st_tspec) {
+ /* cannot concatenate wide and regular string literals */
+ error(292);
+ return (strg1);
+ }
+
+ len = (len1 = strg1->st_len) + (len2 = strg2->st_len);
+
+ if (strg1->st_tspec == CHAR) {
+ if ((strg1->st_cp = realloc(strg1->st_cp, len + 1)) == NULL)
+ nomem();
+ (void)memcpy(strg1->st_cp + len1, strg2->st_cp, len2 + 1);
+ free(strg2->st_cp);
+ } else {
+ if ((strg1->st_wcp = realloc(strg1->st_wcp, (len + 1) *
+ sizeof (wchar_t))) == NULL)
+ nomem();
+ (void)memcpy(strg1->st_wcp + len1, strg2->st_wcp,
+ (len2 + 1) * sizeof (wchar_t));
+ free(strg2->st_wcp);
+ }
+ strg1->st_len = len;
+ free(strg2);
+
+ return (strg1);
+}
+
+/*
+ * Print a warning if the given node has operands which should be
+ * parenthesized.
+ *
+ * XXX Does not work if an operand is a constant expression. Constant
+ * expressions are already folded.
+ */
+static void
+precconf(tnode_t *tn)
+{
+ tnode_t *ln, *rn;
+ op_t lop, rop = NOOP;
+ int lparn, rparn = 0;
+ mod_t *mp;
+ int warn;
+
+ if (!hflag)
+ return;
+
+ mp = &modtab[tn->tn_op];
+
+ lparn = 0;
+ for (ln = tn->tn_left; ln->tn_op == CVT; ln = ln->tn_left)
+ lparn |= ln->tn_parn;
+ lparn |= ln->tn_parn;
+ lop = ln->tn_op;
+
+ if (mp->m_binary) {
+ rparn = 0;
+ for (rn = tn->tn_right; tn->tn_op == CVT; rn = rn->tn_left)
+ rparn |= rn->tn_parn;
+ rparn |= rn->tn_parn;
+ rop = rn->tn_op;
+ }
+
+ warn = 0;
+
+ switch (tn->tn_op) {
+ case SHL:
+ case SHR:
+ if (!lparn && (lop == PLUS || lop == MINUS)) {
+ warn = 1;
+ } else if (!rparn && (rop == PLUS || rop == MINUS)) {
+ warn = 1;
+ }
+ break;
+ case LOGOR:
+ if (!lparn && lop == LOGAND) {
+ warn = 1;
+ } else if (!rparn && rop == LOGAND) {
+ warn = 1;
+ }
+ break;
+ case AND:
+ case XOR:
+ case OR:
+ if (!lparn && lop != tn->tn_op) {
+ if (lop == PLUS || lop == MINUS) {
+ warn = 1;
+ } else if (lop == AND || lop == XOR) {
+ warn = 1;
+ }
+ }
+ if (!warn && !rparn && rop != tn->tn_op) {
+ if (rop == PLUS || rop == MINUS) {
+ warn = 1;
+ } else if (rop == AND || rop == XOR) {
+ warn = 1;
+ }
+ }
+ break;
+ /* LINTED (enumeration values not handled in switch) */
+ case DECAFT:
+ case XORASS:
+ case SHLASS:
+ case NOOP:
+ case ARROW:
+ case ORASS:
+ case POINT:
+ case NAME:
+ case NOT:
+ case COMPL:
+ case CON:
+ case INC:
+ case STRING:
+ case DEC:
+ case INCBEF:
+ case DECBEF:
+ case INCAFT:
+ case FSEL:
+ case CALL:
+ case COMMA:
+ case CVT:
+ case ICALL:
+ case LOAD:
+ case PUSH:
+ case RETURN:
+ case INIT:
+ case CASE:
+ case FARG:
+ case SUBASS:
+ case ADDASS:
+ case MODASS:
+ case DIVASS:
+ case MULASS:
+ case ASSIGN:
+ case COLON:
+ case QUEST:
+ case LOGAND:
+ case NE:
+ case EQ:
+ case GE:
+ case GT:
+ case LE:
+ case LT:
+ case MINUS:
+ case PLUS:
+ case MOD:
+ case DIV:
+ case MULT:
+ case AMPER:
+ case STAR:
+ case UMINUS:
+ case SHRASS:
+ case UPLUS:
+ case ANDASS:
+ break;
+ }
+
+ if (warn) {
+ /* precedence confusion possible: parenthesize! */
+ warning(169);
+ }
+
+}
diff --git a/usr.bin/xlint/lint2/Makefile b/usr.bin/xlint/lint2/Makefile
new file mode 100644
index 0000000..ad14d2a
--- /dev/null
+++ b/usr.bin/xlint/lint2/Makefile
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.2 1995/07/03 21:24:39 cgd Exp $
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../lint1
+
+PROG= lint2
+SRCS= main2.c hash.c read.c mem.c mem2.c chk.c msg.c emit.c emit2.c inittyp.c
+MAN=
+CFLAGS+=-I${.CURDIR}/../lint1
+LINTFLAGS=-abehrz
+
+BINDIR= ${LIBEXECDIR}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xlint/lint2/Makefile.depend b/usr.bin/xlint/lint2/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/xlint/lint2/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/xlint/lint2/chk.c b/usr.bin/xlint/lint2/chk.c
new file mode 100644
index 0000000..4bdd5b7
--- /dev/null
+++ b/usr.bin/xlint/lint2/chk.c
@@ -0,0 +1,1350 @@
+/* $NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "lint2.h"
+
+static void chkund(hte_t *);
+static void chkdnu(hte_t *);
+static void chkdnud(hte_t *);
+static void chkmd(hte_t *);
+static void chkvtui(hte_t *, sym_t *, sym_t *);
+static void chkvtdi(hte_t *, sym_t *, sym_t *);
+static void chkfaui(hte_t *, sym_t *, sym_t *);
+static void chkau(hte_t *, int, sym_t *, sym_t *, pos_t *,
+ fcall_t *, fcall_t *, type_t *, type_t *);
+static void chkrvu(hte_t *, sym_t *);
+static void chkadecl(hte_t *, sym_t *, sym_t *);
+static void printflike(hte_t *,fcall_t *, int, const char *, type_t **);
+static void scanflike(hte_t *, fcall_t *, int, const char *, type_t **);
+static void badfmt(hte_t *, fcall_t *);
+static void inconarg(hte_t *, fcall_t *, int);
+static void tofewarg(hte_t *, fcall_t *);
+static void tomanyarg(hte_t *, fcall_t *);
+static int eqtype(type_t *, type_t *, int, int, int, int *);
+static int eqargs(type_t *, type_t *, int *);
+static int mnoarg(type_t *, int *);
+
+
+/*
+ * If there is a symbol named "main", mark it as used.
+ */
+void
+mainused(void)
+{
+ hte_t *hte;
+
+ if ((hte = hsearch("main", 0)) != NULL)
+ hte->h_used = 1;
+}
+
+/*
+ * Performs all tests for a single name
+ */
+void
+chkname(hte_t *hte)
+{
+ sym_t *sym, *def, *pdecl, *decl;
+
+ if (uflag) {
+ chkund(hte);
+ chkdnu(hte);
+ if (xflag)
+ chkdnud(hte);
+ }
+ chkmd(hte);
+
+ /* Get definition, prototype declaration and declaration */
+ def = pdecl = decl = NULL;
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (def == NULL && (sym->s_def == DEF || sym->s_def == TDEF))
+ def = sym;
+ if (pdecl == NULL && sym->s_def == DECL &&
+ TP(sym->s_type)->t_tspec == FUNC &&
+ TP(sym->s_type)->t_proto) {
+ pdecl = sym;
+ }
+ if (decl == NULL && sym->s_def == DECL)
+ decl = sym;
+ }
+
+ /* A prototype is better than an old style declaration. */
+ if (pdecl != NULL)
+ decl = pdecl;
+
+ chkvtui(hte, def, decl);
+
+ chkvtdi(hte, def, decl);
+
+ chkfaui(hte, def, decl);
+
+ chkrvu(hte, def);
+
+ chkadecl(hte, def, decl);
+}
+
+/*
+ * Print a warning if the name has been used, but not defined.
+ */
+static void
+chkund(hte_t *hte)
+{
+ fcall_t *fcall;
+ usym_t *usym;
+
+ if (!hte->h_used || hte->h_def)
+ return;
+
+ if ((fcall = hte->h_calls) != NULL) {
+ /* %s used( %s ), but not defined */
+ msg(0, hte->h_name, mkpos(&fcall->f_pos));
+ } else if ((usym = hte->h_usyms) != NULL) {
+ /* %s used( %s ), but not defined */
+ msg(0, hte->h_name, mkpos(&usym->u_pos));
+ }
+}
+
+/*
+ * Print a warning if the name has been defined, but never used.
+ */
+static void
+chkdnu(hte_t *hte)
+{
+ sym_t *sym;
+
+ if (!hte->h_def || hte->h_used)
+ return;
+
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (sym->s_def == DEF || sym->s_def == TDEF) {
+ /* %s defined( %s ), but never used */
+ msg(1, hte->h_name, mkpos(&sym->s_pos));
+ break;
+ }
+ }
+}
+
+/*
+ * Print a warning if the variable has been declared, but is not used
+ * or defined.
+ */
+static void
+chkdnud(hte_t *hte)
+{
+ sym_t *sym;
+
+ if (hte->h_syms == NULL || hte->h_used || hte->h_def)
+ return;
+
+ sym = hte->h_syms;
+ if (TP(sym->s_type)->t_tspec == FUNC)
+ return;
+
+ if (sym->s_def != DECL)
+ errx(1, "internal error: chkdnud() 1");
+ /* %s declared( %s ), but never used or defined */
+ msg(2, hte->h_name, mkpos(&sym->s_pos));
+}
+
+/*
+ * Print a warning if there is more than one definition for
+ * this name.
+ */
+static void
+chkmd(hte_t *hte)
+{
+ sym_t *sym, *def1;
+ char *pos1;
+
+ if (!hte->h_def)
+ return;
+
+ def1 = NULL;
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ /*
+ * ANSI C allows tentative definitions of the same name in
+ * only one compilation unit.
+ */
+ if (sym->s_def != DEF && (!sflag || sym->s_def != TDEF))
+ continue;
+ if (def1 == NULL) {
+ def1 = sym;
+ continue;
+ }
+ pos1 = xstrdup(mkpos(&def1->s_pos));
+ /* %s multiply defined\t%s :: %s */
+ msg(3, hte->h_name, pos1, mkpos(&sym->s_pos));
+ free(pos1);
+ }
+}
+
+/*
+ * Print a warning if the return value assumed for a function call
+ * differs from the return value of the function definition or
+ * function declaration.
+ *
+ * If no definition/declaration can be found, the assumed return values
+ * are always int. So there is no need to compare with another function
+ * call as it's done for function arguments.
+ */
+static void
+chkvtui(hte_t *hte, sym_t *def, sym_t *decl)
+{
+ fcall_t *call;
+ char *pos1;
+ type_t *tp1, *tp2;
+ /* LINTED (automatic hides external declaration: warn) */
+ int warn, eq;
+ tspec_t t1;
+
+ if (hte->h_calls == NULL)
+ return;
+
+ if (def == NULL)
+ def = decl;
+ if (def == NULL)
+ return;
+
+ t1 = (tp1 = TP(def->s_type)->t_subt)->t_tspec;
+ for (call = hte->h_calls; call != NULL; call = call->f_nxt) {
+ tp2 = TP(call->f_type)->t_subt;
+ eq = eqtype(tp1, tp2, 1, 0, 0, (warn = 0, &warn));
+ if (!call->f_rused) {
+ /* no return value used */
+ if ((t1 == STRUCT || t1 == UNION) && !eq) {
+ /*
+ * If a function returns a struct or union it
+ * must be declared to return a struct or
+ * union, also if the return value is ignored.
+ * This is necessary because the caller must
+ * allocate stack space for the return value.
+ * If it does not, the return value would over-
+ * write other data.
+ * XXX Following massage may be confusing
+ * because it appears also if the return value
+ * was declared inconsistently. But this
+ * behaviour matches pcc based lint, so it is
+ * accepted for now.
+ */
+ pos1 = xstrdup(mkpos(&def->s_pos));
+ /* %s value must be decl. before use %s :: %s */
+ msg(17, hte->h_name,
+ pos1, mkpos(&call->f_pos));
+ free(pos1);
+ }
+ continue;
+ }
+ if (!eq || (sflag && warn)) {
+ pos1 = xstrdup(mkpos(&def->s_pos));
+ /* %s value used inconsistenty\t%s :: %s */
+ msg(4, hte->h_name, pos1, mkpos(&call->f_pos));
+ free(pos1);
+ }
+ }
+}
+
+/*
+ * Print a warning if a definition/declaration does not match another
+ * definition/declaration of the same name. For functions, only the
+ * types of return values are tested.
+ */
+static void
+chkvtdi(hte_t *hte, sym_t *def, sym_t *decl)
+{
+ sym_t *sym;
+ type_t *tp1, *tp2;
+ /* LINTED (automatic hides external declaration: warn) */
+ int eq, warn;
+ char *pos1;
+
+ if (def == NULL)
+ def = decl;
+ if (def == NULL)
+ return;
+
+ tp1 = TP(def->s_type);
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (sym == def)
+ continue;
+ tp2 = TP(sym->s_type);
+ warn = 0;
+ if (tp1->t_tspec == FUNC && tp2->t_tspec == FUNC) {
+ eq = eqtype(tp1->t_subt, tp2->t_subt, 1, 0, 0, &warn);
+ } else {
+ eq = eqtype(tp1, tp2, 0, 0, 0, &warn);
+ }
+ if (!eq || (sflag && warn)) {
+ pos1 = xstrdup(mkpos(&def->s_pos));
+ /* %s value declared inconsistently\t%s :: %s */
+ msg(5, hte->h_name, pos1, mkpos(&sym->s_pos));
+ free(pos1);
+ }
+ }
+}
+
+/*
+ * Print a warning if a function is called with arguments which does
+ * not match the function definition, declaration or another call
+ * of the same function.
+ */
+static void
+chkfaui(hte_t *hte, sym_t *def, sym_t *decl)
+{
+ type_t *tp1, *tp2, **ap1, **ap2;
+ pos_t *pos1p = NULL;
+ fcall_t *calls, *call, *call1;
+ int n, as;
+ char *pos1;
+ arginf_t *ai;
+
+ if ((calls = hte->h_calls) == NULL)
+ return;
+
+ /*
+ * If we find a function definition, we use this for comparison,
+ * otherwise the first prototype we can find. If there is no
+ * definition or prototype declaration, the first function call
+ * is used.
+ */
+ tp1 = NULL;
+ call1 = NULL;
+ if (def != NULL) {
+ if ((tp1 = TP(def->s_type))->t_tspec != FUNC)
+ return;
+ pos1p = &def->s_pos;
+ } else if (decl != NULL && TP(decl->s_type)->t_proto) {
+ if ((tp1 = TP(decl->s_type))->t_tspec != FUNC)
+ return;
+ pos1p = &decl->s_pos;
+ }
+ if (tp1 == NULL) {
+ call1 = calls;
+ calls = calls->f_nxt;
+ if ((tp1 = TP(call1->f_type))->t_tspec != FUNC)
+ return;
+ pos1p = &call1->f_pos;
+ }
+
+ n = 1;
+ for (call = calls; call != NULL; call = call->f_nxt) {
+ if ((tp2 = TP(call->f_type))->t_tspec != FUNC)
+ continue;
+ ap1 = tp1->t_args;
+ ap2 = tp2->t_args;
+ n = 0;
+ while (*ap1 != NULL && *ap2 != NULL) {
+ if (def != NULL && def->s_va && n >= def->s_nva)
+ break;
+ n++;
+ chkau(hte, n, def, decl, pos1p, call1, call,
+ *ap1, *ap2);
+ ap1++;
+ ap2++;
+ }
+ if (*ap1 == *ap2) {
+ /* equal # of arguments */
+ } else if (def != NULL && def->s_va && n >= def->s_nva) {
+ /*
+ * function definition with VARARGS; The # of
+ * arguments of the call must be at least as large
+ * as the parameter of VARARGS.
+ */
+ } else if (*ap2 != NULL && tp1->t_proto && tp1->t_vararg) {
+ /*
+ * prototype with ... and function call with
+ * at least the same # of arguments as declared
+ * in the prototype.
+ */
+ } else {
+ pos1 = xstrdup(mkpos(pos1p));
+ /* %s: variable # of args\t%s :: %s */
+ msg(7, hte->h_name, pos1, mkpos(&call->f_pos));
+ free(pos1);
+ continue;
+ }
+
+ /* perform SCANFLIKE/PRINTFLIKE tests */
+ if (def == NULL || (!def->s_prfl && !def->s_scfl))
+ continue;
+ as = def->s_prfl ? def->s_nprfl : def->s_nscfl;
+ for (ai = call->f_args; ai != NULL; ai = ai->a_nxt) {
+ if (ai->a_num == as)
+ break;
+ }
+ if (ai == NULL || !ai->a_fmt)
+ continue;
+ if (def->s_prfl) {
+ printflike(hte, call, n, ai->a_fstrg, ap2);
+ } else {
+ scanflike(hte, call, n, ai->a_fstrg, ap2);
+ }
+ }
+}
+
+/*
+ * Check a single argument in a function call.
+ *
+ * hte a pointer to the hash table entry of the function
+ * n the number of the argument (1..)
+ * def the function definition or NULL
+ * decl prototype declaration, old style declaration or NULL
+ * pos1p position of definition, declaration of first call
+ * call1 first call, if both def and decl are old style def/decl
+ * call checked call
+ * arg1 currently checked argument of def/decl/call1
+ * arg2 currently checked argument of call
+ *
+ */
+static void
+chkau(hte_t *hte, int n, sym_t *def, sym_t *decl, pos_t *pos1p,
+ fcall_t *call1, fcall_t *call, type_t *arg1, type_t *arg2)
+{
+ /* LINTED (automatic hides external declaration: warn) */
+ int promote, asgn, warn;
+ tspec_t t1, t2;
+ arginf_t *ai, *ai1;
+ char *pos1;
+
+ /*
+ * If a function definition is available (def != NULL), we compare the
+ * function call (call) with the definition. Otherwise, if a function
+ * definition is available and it is not an old style definition
+ * (decl != NULL && TP(decl->s_type)->t_proto), we compare the call
+ * with this declaration. Otherwise we compare it with the first
+ * call we have found (call1).
+ */
+
+ /* arg1 must be promoted if it stems from an old style definition */
+ promote = def != NULL && def->s_osdef;
+
+ /*
+ * If we compare with a definition or declaration, we must perform
+ * the same checks for qualifiers in indirected types as in
+ * assignments.
+ */
+ asgn = def != NULL || (decl != NULL && TP(decl->s_type)->t_proto);
+
+ warn = 0;
+ if (eqtype(arg1, arg2, 1, promote, asgn, &warn) && (!sflag || !warn))
+ return;
+
+ /*
+ * Other lint implementations print warnings as soon as the type
+ * of an argument does not match exactly the expected type. The
+ * result are lots of warnings which are really not necessary.
+ * We print a warning only if
+ * (0) at least one type is not an integer type and types differ
+ * (1) hflag is set and types differ
+ * (2) types differ, except in signedness
+ * If the argument is an integer constant whose msb is not set,
+ * signedness is ignored (e.g. 0 matches both signed and unsigned
+ * int). This is with and without hflag.
+ * If the argument is an integer constant with value 0 and the
+ * expected argument is of type pointer and the width of the
+ * integer constant is the same as the width of the pointer,
+ * no warning is printed.
+ */
+ t1 = arg1->t_tspec;
+ t2 = arg2->t_tspec;
+ if (isityp(t1) && isityp(t2) && !arg1->t_isenum && !arg2->t_isenum) {
+ if (promote) {
+ /*
+ * XXX Here is a problem: Although it is possible to
+ * pass an int where a char/short it expected, there
+ * may be loss in significant digits. We should first
+ * check for const arguments if they can be converted
+ * into the original parameter type.
+ */
+ if (t1 == FLOAT) {
+ t1 = DOUBLE;
+ } else if (t1 == CHAR || t1 == SCHAR) {
+ t1 = INT;
+ } else if (t1 == UCHAR) {
+ t1 = tflag ? UINT : INT;
+ } else if (t1 == SHORT) {
+ t1 = INT;
+ } else if (t1 == USHORT) {
+ /* CONSTCOND */
+ t1 = INT_MAX < USHRT_MAX || tflag ? UINT : INT;
+ }
+ }
+
+ if (styp(t1) == styp(t2)) {
+
+ /*
+ * types differ only in signedness; get information
+ * about arguments
+ */
+
+ /*
+ * treat a definition like a call with variable
+ * arguments
+ */
+ ai1 = call1 != NULL ? call1->f_args : NULL;
+
+ /*
+ * if two calls are compared, ai1 is set to the
+ * information for the n-th argument, if this was
+ * a constant, otherwise to NULL
+ */
+ for ( ; ai1 != NULL; ai1 = ai1->a_nxt) {
+ if (ai1->a_num == n)
+ break;
+ }
+ /*
+ * ai is set to the information of the n-th arg
+ * of the (second) call, if this was a constant,
+ * otherwise to NULL
+ */
+ for (ai = call->f_args; ai != NULL; ai = ai->a_nxt) {
+ if (ai->a_num == n)
+ break;
+ }
+
+ if (ai1 == NULL && ai == NULL) {
+ /* no constant at all */
+ if (!hflag)
+ return;
+ } else if (ai1 == NULL || ai == NULL) {
+ /* one constant */
+ if (ai == NULL)
+ ai = ai1;
+ if (ai->a_zero || ai->a_pcon)
+ /* same value in signed and unsigned */
+ return;
+ /* value (not representation) differently */
+ } else {
+ /*
+ * two constants, one signed, one unsigned;
+ * if the msb of one of the constants is set,
+ * the argument is used inconsistently.
+ */
+ if (!ai1->a_ncon && !ai->a_ncon)
+ return;
+ }
+ }
+
+ } else if (t1 == PTR && isityp(t2)) {
+ for (ai = call->f_args; ai != NULL; ai = ai->a_nxt) {
+ if (ai->a_num == n)
+ break;
+ }
+ /*
+ * Vendor implementations of lint (e.g. HP-UX, Digital UNIX)
+ * don't care about the size of the integer argument,
+ * only whether or not it is zero. We do the same.
+ */
+ if (ai != NULL && ai->a_zero)
+ return;
+ }
+
+ pos1 = xstrdup(mkpos(pos1p));
+ /* %s, arg %d used inconsistently\t%s :: %s */
+ msg(6, hte->h_name, n, pos1, mkpos(&call->f_pos));
+ free(pos1);
+}
+
+/*
+ * Compare the types in the NULL-terminated array ap with the format
+ * string fmt.
+ */
+static void
+printflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap)
+{
+ const char *fp;
+ int fc;
+ int fwidth, prec, left, sign, space, alt, zero;
+ tspec_t sz, t1, t2 = NOTSPEC;
+ type_t *tp;
+
+ fp = fmt;
+ fc = *fp++;
+
+ for ( ; ; ) {
+ if (fc == '\0') {
+ if (*ap != NULL)
+ tomanyarg(hte, call);
+ break;
+ }
+ if (fc != '%') {
+ badfmt(hte, call);
+ break;
+ }
+ fc = *fp++;
+ fwidth = prec = left = sign = space = alt = zero = 0;
+ sz = NOTSPEC;
+
+ /* Flags */
+ for ( ; ; ) {
+ if (fc == '-') {
+ if (left)
+ break;
+ left = 1;
+ } else if (fc == '+') {
+ if (sign)
+ break;
+ sign = 1;
+ } else if (fc == ' ') {
+ if (space)
+ break;
+ space = 1;
+ } else if (fc == '#') {
+ if (alt)
+ break;
+ alt = 1;
+ } else if (fc == '0') {
+ if (zero)
+ break;
+ zero = 1;
+ } else {
+ break;
+ }
+ fc = *fp++;
+ }
+
+ /* field width */
+ if (isdigit(fc)) {
+ fwidth = 1;
+ do { fc = *fp++; } while (isdigit(fc)) ;
+ } else if (fc == '*') {
+ fwidth = 1;
+ fc = *fp++;
+ if ((tp = *ap++) == NULL) {
+ tofewarg(hte, call);
+ break;
+ }
+ n++;
+ if ((t1 = tp->t_tspec) != INT && (hflag || t1 != UINT))
+ inconarg(hte, call, n);
+ }
+
+ /* precision */
+ if (fc == '.') {
+ fc = *fp++;
+ prec = 1;
+ if (isdigit(fc)) {
+ do { fc = *fp++; } while (isdigit(fc));
+ } else if (fc == '*') {
+ fc = *fp++;
+ if ((tp = *ap++) == NULL) {
+ tofewarg(hte, call);
+ break;
+ }
+ n++;
+ if (tp->t_tspec != INT)
+ inconarg(hte, call, n);
+ } else {
+ badfmt(hte, call);
+ break;
+ }
+ }
+
+ if (fc == 'h') {
+ sz = SHORT;
+ } else if (fc == 'l') {
+ sz = LONG;
+ } else if (fc == 'q') {
+ sz = QUAD;
+ } else if (fc == 'L') {
+ sz = LDOUBLE;
+ }
+ if (sz != NOTSPEC)
+ fc = *fp++;
+
+ if (fc == '%') {
+ if (sz != NOTSPEC || left || sign || space ||
+ alt || zero || prec || fwidth) {
+ badfmt(hte, call);
+ }
+ fc = *fp++;
+ continue;
+ }
+
+ if (fc == '\0') {
+ badfmt(hte, call);
+ break;
+ }
+
+ if ((tp = *ap++) == NULL) {
+ tofewarg(hte, call);
+ break;
+ }
+ n++;
+ if ((t1 = tp->t_tspec) == PTR)
+ t2 = tp->t_subt->t_tspec;
+
+ if (fc == 'd' || fc == 'i') {
+ if (alt || sz == LDOUBLE) {
+ badfmt(hte, call);
+ break;
+ }
+ int_conv:
+ if (sz == LONG) {
+ if (t1 != LONG && (hflag || t1 != ULONG))
+ inconarg(hte, call, n);
+ } else if (sz == QUAD) {
+ if (t1 != QUAD && (hflag || t1 != UQUAD))
+ inconarg(hte, call, n);
+ } else {
+ /*
+ * SHORT is always promoted to INT, USHORT
+ * to INT or UINT.
+ */
+ if (t1 != INT && (hflag || t1 != UINT))
+ inconarg(hte, call, n);
+ }
+ } else if (fc == 'o' || fc == 'u' || fc == 'x' || fc == 'X') {
+ if ((alt && fc == 'u') || sz == LDOUBLE)
+ badfmt(hte, call);
+ uint_conv:
+ if (sz == LONG) {
+ if (t1 != ULONG && (hflag || t1 != LONG))
+ inconarg(hte, call, n);
+ } else if (sz == QUAD) {
+ if (t1 != UQUAD && (hflag || t1 != QUAD))
+ inconarg(hte, call, n);
+ } else if (sz == SHORT) {
+ /* USHORT was promoted to INT or UINT */
+ if (t1 != UINT && t1 != INT)
+ inconarg(hte, call, n);
+ } else {
+ if (t1 != UINT && (hflag || t1 != INT))
+ inconarg(hte, call, n);
+ }
+ } else if (fc == 'D' || fc == 'O' || fc == 'U') {
+ if ((alt && fc != 'O') || sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = LONG;
+ if (fc == 'D') {
+ goto int_conv;
+ } else {
+ goto uint_conv;
+ }
+ } else if (fc == 'f' || fc == 'e' || fc == 'E' ||
+ fc == 'g' || fc == 'G') {
+ if (sz == NOTSPEC)
+ sz = DOUBLE;
+ if (sz != DOUBLE && sz != LDOUBLE)
+ badfmt(hte, call);
+ if (t1 != sz)
+ inconarg(hte, call, n);
+ } else if (fc == 'c') {
+ if (sz != NOTSPEC || alt || zero)
+ badfmt(hte, call);
+ if (t1 != INT)
+ inconarg(hte, call, n);
+ } else if (fc == 's') {
+ if (sz != NOTSPEC || alt || zero)
+ badfmt(hte, call);
+ if (t1 != PTR ||
+ (t2 != CHAR && t2 != UCHAR && t2 != SCHAR)) {
+ inconarg(hte, call, n);
+ }
+ } else if (fc == 'p') {
+ if (fwidth || prec || sz != NOTSPEC || alt || zero)
+ badfmt(hte, call);
+ if (t1 != PTR || (hflag && t2 != VOID))
+ inconarg(hte, call, n);
+ } else if (fc == 'n') {
+ if (fwidth || prec || alt || zero || sz == LDOUBLE)
+ badfmt(hte, call);
+ if (t1 != PTR) {
+ inconarg(hte, call, n);
+ } else if (sz == LONG) {
+ if (t2 != LONG && t2 != ULONG)
+ inconarg(hte, call, n);
+ } else if (sz == SHORT) {
+ if (t2 != SHORT && t2 != USHORT)
+ inconarg(hte, call, n);
+ } else {
+ if (t2 != INT && t2 != UINT)
+ inconarg(hte, call, n);
+ }
+ } else {
+ badfmt(hte, call);
+ break;
+ }
+
+ fc = *fp++;
+ }
+}
+
+/*
+ * Compare the types in the NULL-terminated array ap with the format
+ * string fmt.
+ */
+static void
+scanflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap)
+{
+ const char *fp;
+ int fc;
+ int noasgn, fwidth;
+ tspec_t sz, t1 = NOTSPEC, t2 = NOTSPEC;
+ type_t *tp = NULL;
+
+ fp = fmt;
+ fc = *fp++;
+
+ for ( ; ; ) {
+ if (fc == '\0') {
+ if (*ap != NULL)
+ tomanyarg(hte, call);
+ break;
+ }
+ if (fc != '%') {
+ badfmt(hte, call);
+ break;
+ }
+ fc = *fp++;
+
+ noasgn = fwidth = 0;
+ sz = NOTSPEC;
+
+ if (fc == '*') {
+ noasgn = 1;
+ fc = *fp++;
+ }
+
+ if (isdigit(fc)) {
+ fwidth = 1;
+ do { fc = *fp++; } while (isdigit(fc));
+ }
+
+ if (fc == 'h') {
+ sz = SHORT;
+ } else if (fc == 'l') {
+ sz = LONG;
+ } else if (fc == 'q') {
+ sz = QUAD;
+ } else if (fc == 'L') {
+ sz = LDOUBLE;
+ }
+ if (sz != NOTSPEC)
+ fc = *fp++;
+
+ if (fc == '%') {
+ if (sz != NOTSPEC || noasgn || fwidth)
+ badfmt(hte, call);
+ fc = *fp++;
+ continue;
+ }
+
+ if (!noasgn) {
+ if ((tp = *ap++) == NULL) {
+ tofewarg(hte, call);
+ break;
+ }
+ n++;
+ if ((t1 = tp->t_tspec) == PTR)
+ t2 = tp->t_subt->t_tspec;
+ }
+
+ if (fc == 'd' || fc == 'i' || fc == 'n') {
+ if (sz == LDOUBLE)
+ badfmt(hte, call);
+ if (sz != SHORT && sz != LONG && sz != QUAD)
+ sz = INT;
+ conv:
+ if (!noasgn) {
+ if (t1 != PTR) {
+ inconarg(hte, call, n);
+ } else if (t2 != styp(sz)) {
+ inconarg(hte, call, n);
+ } else if (hflag && t2 != sz) {
+ inconarg(hte, call, n);
+ } else if (tp->t_subt->t_const) {
+ inconarg(hte, call, n);
+ }
+ }
+ } else if (fc == 'o' || fc == 'u' || fc == 'x') {
+ if (sz == LDOUBLE)
+ badfmt(hte, call);
+ if (sz == SHORT) {
+ sz = USHORT;
+ } else if (sz == LONG) {
+ sz = ULONG;
+ } else if (sz == QUAD) {
+ sz = UQUAD;
+ } else {
+ sz = UINT;
+ }
+ goto conv;
+ } else if (fc == 'D') {
+ if (sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = LONG;
+ goto conv;
+ } else if (fc == 'O') {
+ if (sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = ULONG;
+ goto conv;
+ } else if (fc == 'X') {
+ /*
+ * XXX valid in ANSI C, but in NetBSD's libc imple-
+ * mented as "lx". Thats why it should be avoided.
+ */
+ if (sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = ULONG;
+ goto conv;
+ } else if (fc == 'E') {
+ /*
+ * XXX valid in ANSI C, but in NetBSD's libc imple-
+ * mented as "lf". Thats why it should be avoided.
+ */
+ if (sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = DOUBLE;
+ goto conv;
+ } else if (fc == 'F') {
+ /* XXX only for backward compatibility */
+ if (sz != NOTSPEC || !tflag)
+ badfmt(hte, call);
+ sz = DOUBLE;
+ goto conv;
+ } else if (fc == 'G') {
+ /*
+ * XXX valid in ANSI C, but in NetBSD's libc not
+ * implemented
+ */
+ if (sz != NOTSPEC && sz != LONG && sz != LDOUBLE)
+ badfmt(hte, call);
+ goto fconv;
+ } else if (fc == 'e' || fc == 'f' || fc == 'g') {
+ fconv:
+ if (sz == NOTSPEC) {
+ sz = FLOAT;
+ } else if (sz == LONG) {
+ sz = DOUBLE;
+ } else if (sz != LDOUBLE) {
+ badfmt(hte, call);
+ sz = FLOAT;
+ }
+ goto conv;
+ } else if (fc == 's' || fc == '[' || fc == 'c') {
+ if (sz != NOTSPEC)
+ badfmt(hte, call);
+ if (fc == '[') {
+ if ((fc = *fp++) == '-') {
+ badfmt(hte, call);
+ fc = *fp++;
+ }
+ if (fc != ']') {
+ badfmt(hte, call);
+ if (fc == '\0')
+ break;
+ }
+ }
+ if (!noasgn) {
+ if (t1 != PTR) {
+ inconarg(hte, call, n);
+ } else if (t2 != CHAR && t2 != UCHAR &&
+ t2 != SCHAR) {
+ inconarg(hte, call, n);
+ }
+ }
+ } else if (fc == 'p') {
+ if (sz != NOTSPEC)
+ badfmt(hte, call);
+ if (!noasgn) {
+ if (t1 != PTR || t2 != PTR) {
+ inconarg(hte, call, n);
+ } else if (tp->t_subt->t_subt->t_tspec!=VOID) {
+ if (hflag)
+ inconarg(hte, call, n);
+ }
+ }
+ } else {
+ badfmt(hte, call);
+ break;
+ }
+
+ fc = *fp++;
+ }
+}
+
+static void
+badfmt(hte_t *hte, fcall_t *call)
+{
+
+ /* %s: malformed format string\t%s */
+ msg(13, hte->h_name, mkpos(&call->f_pos));
+}
+
+static void
+inconarg(hte_t *hte, fcall_t *call, int n)
+{
+
+ /* %s, arg %d inconsistent with format\t%s(%d) */
+ msg(14, hte->h_name, n, mkpos(&call->f_pos));
+}
+
+static void
+tofewarg(hte_t *hte, fcall_t *call)
+{
+
+ /* %s: too few args for format \t%s */
+ msg(15, hte->h_name, mkpos(&call->f_pos));
+}
+
+static void
+tomanyarg(hte_t *hte, fcall_t *call)
+{
+
+ /* %s: too many args for format \t%s */
+ msg(16, hte->h_name, mkpos(&call->f_pos));
+}
+
+
+/*
+ * Print warnings for return values which are used, but not returned,
+ * or return values which are always or sometimes ignored.
+ */
+static void
+chkrvu(hte_t *hte, sym_t *def)
+{
+ fcall_t *call;
+ int used, ignored;
+
+ if (def == NULL)
+ /* don't know wheter or not the functions returns a value */
+ return;
+
+ if (hte->h_calls == NULL)
+ return;
+
+ if (def->s_rval) {
+ /* function has return value */
+ used = ignored = 0;
+ for (call = hte->h_calls; call != NULL; call = call->f_nxt) {
+ used |= call->f_rused || call->f_rdisc;
+ ignored |= !call->f_rused && !call->f_rdisc;
+ }
+ /*
+ * XXX as soon as we are able to disable single warnings
+ * the following dependencies from hflag should be removed.
+ * but for now I do'nt want to be botherd by this warnings
+ * which are almost always useless.
+ */
+ if (!used && ignored) {
+ if (hflag)
+ /* %s returns value which is always ignored */
+ msg(8, hte->h_name);
+ } else if (used && ignored) {
+ if (hflag)
+ /* %s returns value which is sometimes ign. */
+ msg(9, hte->h_name);
+ }
+ } else {
+ /* function has no return value */
+ for (call = hte->h_calls; call != NULL; call = call->f_nxt) {
+ if (call->f_rused)
+ /* %s value is used( %s ), but none ret. */
+ msg(10, hte->h_name, mkpos(&call->f_pos));
+ }
+ }
+}
+
+/*
+ * Print warnings for inconsistent argument declarations.
+ */
+static void
+chkadecl(hte_t *hte, sym_t *def, sym_t *decl)
+{
+ /* LINTED (automatic hides external declaration: warn) */
+ int osdef, eq, warn, n;
+ sym_t *sym1, *sym;
+ type_t **ap1, **ap2, *tp1, *tp2;
+ char *pos1;
+ const char *pos2;
+
+ osdef = 0;
+ if (def != NULL) {
+ osdef = def->s_osdef;
+ sym1 = def;
+ } else if (decl != NULL && TP(decl->s_type)->t_proto) {
+ sym1 = decl;
+ } else {
+ return;
+ }
+ if (TP(sym1->s_type)->t_tspec != FUNC)
+ return;
+
+ /*
+ * XXX Prototypes should also be compared with old style function
+ * declarations.
+ */
+
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (sym == sym1 || !TP(sym->s_type)->t_proto)
+ continue;
+ ap1 = TP(sym1->s_type)->t_args;
+ ap2 = TP(sym->s_type)->t_args;
+ n = 0;
+ while (*ap1 != NULL && *ap2 != NULL) {
+ warn = 0;
+ eq = eqtype(*ap1, *ap2, 1, osdef, 0, &warn);
+ if (!eq || warn) {
+ pos1 = xstrdup(mkpos(&sym1->s_pos));
+ pos2 = mkpos(&sym->s_pos);
+ /* %s, arg %d declared inconsistently ... */
+ msg(11, hte->h_name, n + 1, pos1, pos2);
+ free(pos1);
+ }
+ n++;
+ ap1++;
+ ap2++;
+ }
+ if (*ap1 == *ap2) {
+ tp1 = TP(sym1->s_type);
+ tp2 = TP(sym->s_type);
+ if (tp1->t_vararg == tp2->t_vararg)
+ continue;
+ if (tp2->t_vararg &&
+ sym1->s_va && sym1->s_nva == n && !sflag) {
+ continue;
+ }
+ }
+ /* %s: variable # of args declared\t%s :: %s */
+ pos1 = xstrdup(mkpos(&sym1->s_pos));
+ msg(12, hte->h_name, pos1, mkpos(&sym->s_pos));
+ free(pos1);
+ }
+}
+
+
+/*
+ * Check compatibility of two types. Returns 1 if types are compatible,
+ * otherwise 0.
+ *
+ * ignqual if set, ignore qualifiers of outhermost type; used for
+ * function arguments
+ * promote if set, promote left type before comparison; used for
+ * comparisons of arguments with parameters of old style
+ * definitions
+ * asgn left indirected type must have at least the same qualifiers
+ * like right indirected type (for assignments and function
+ * arguments)
+ * *warn set to 1 if an old style declaration was compared with
+ * an incompatible prototype declaration
+ */
+static int
+eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int asgn, int *warn)
+{
+ tspec_t t, to;
+ int indir;
+
+ to = NOTSPEC;
+ indir = 0;
+
+ while (tp1 != NULL && tp2 != NULL) {
+
+ t = tp1->t_tspec;
+ if (promot) {
+ if (t == FLOAT) {
+ t = DOUBLE;
+ } else if (t == CHAR || t == SCHAR) {
+ t = INT;
+ } else if (t == UCHAR) {
+ t = tflag ? UINT : INT;
+ } else if (t == SHORT) {
+ t = INT;
+ } else if (t == USHORT) {
+ /* CONSTCOND */
+ t = INT_MAX < USHRT_MAX || tflag ? UINT : INT;
+ }
+ }
+
+ if (asgn && to == PTR) {
+ if (indir == 1 && (t == VOID || tp2->t_tspec == VOID))
+ return (1);
+ }
+
+ if (t != tp2->t_tspec) {
+ /*
+ * Give pointer to types which differ only in
+ * signedness a chance if not sflag and not hflag.
+ */
+ if (sflag || hflag || to != PTR)
+ return (0);
+ if (styp(t) != styp(tp2->t_tspec))
+ return (0);
+ }
+
+ if (tp1->t_isenum && tp2->t_isenum) {
+ if (tp1->t_istag && tp2->t_istag) {
+ return (tp1->t_tag == tp2->t_tag);
+ } else if (tp1->t_istynam && tp2->t_istynam) {
+ return (tp1->t_tynam == tp2->t_tynam);
+ } else if (tp1->t_isuniqpos && tp2->t_isuniqpos) {
+ return (tp1->t_uniqpos.p_line ==
+ tp2->t_uniqpos.p_line &&
+ tp1->t_uniqpos.p_file ==
+ tp2->t_uniqpos.p_file &&
+ tp1->t_uniqpos.p_uniq ==
+ tp2->t_uniqpos.p_uniq);
+ } else {
+ return (0);
+ }
+ }
+
+ /*
+ * XXX Handle combinations of enum and int if eflag is set.
+ * But note: enum and 0 should be allowed.
+ */
+
+ if (asgn && indir == 1) {
+ if (!tp1->t_const && tp2->t_const)
+ return (0);
+ if (!tp1->t_volatile && tp2->t_volatile)
+ return (0);
+ } else if (!ignqual && !tflag) {
+ if (tp1->t_const != tp2->t_const)
+ return (0);
+ if (tp1->t_const != tp2->t_const)
+ return (0);
+ }
+
+ if (t == STRUCT || t == UNION) {
+ if (tp1->t_istag && tp2->t_istag) {
+ return (tp1->t_tag == tp2->t_tag);
+ } else if (tp1->t_istynam && tp2->t_istynam) {
+ return (tp1->t_tynam == tp2->t_tynam);
+ } else if (tp1->t_isuniqpos && tp2->t_isuniqpos) {
+ return (tp1->t_uniqpos.p_line ==
+ tp2->t_uniqpos.p_line &&
+ tp1->t_uniqpos.p_file ==
+ tp2->t_uniqpos.p_file &&
+ tp1->t_uniqpos.p_uniq ==
+ tp2->t_uniqpos.p_uniq);
+ } else {
+ return (0);
+ }
+ }
+
+ if (t == ARRAY && tp1->t_dim != tp2->t_dim) {
+ if (tp1->t_dim != 0 && tp2->t_dim != 0)
+ return (0);
+ }
+
+ if (t == FUNC) {
+ if (tp1->t_proto && tp2->t_proto) {
+ if (!eqargs(tp1, tp2, warn))
+ return (0);
+ } else if (tp1->t_proto) {
+ if (!mnoarg(tp1, warn))
+ return (0);
+ } else if (tp2->t_proto) {
+ if (!mnoarg(tp2, warn))
+ return (0);
+ }
+ }
+
+ tp1 = tp1->t_subt;
+ tp2 = tp2->t_subt;
+ ignqual = promot = 0;
+ to = t;
+ indir++;
+
+ }
+
+ return (tp1 == tp2);
+}
+
+/*
+ * Compares arguments of two prototypes
+ */
+static int
+eqargs(type_t *tp1, type_t *tp2, int *warn)
+{
+ type_t **a1, **a2;
+
+ if (tp1->t_vararg != tp2->t_vararg)
+ return (0);
+
+ a1 = tp1->t_args;
+ a2 = tp2->t_args;
+
+ while (*a1 != NULL && *a2 != NULL) {
+
+ if (eqtype(*a1, *a2, 1, 0, 0, warn) == 0)
+ return (0);
+
+ a1++;
+ a2++;
+
+ }
+
+ return (*a1 == *a2);
+}
+
+/*
+ * mnoarg() (matches functions with no argument type information)
+ * returns 1 if all parameters of a prototype are compatible with
+ * and old style function declaration.
+ * This is the case if following conditions are met:
+ * 1. the prototype must have a fixed number of parameters
+ * 2. no parameter is of type float
+ * 3. no parameter is converted to another type if integer promotion
+ * is applied on it
+ */
+static int
+mnoarg(type_t *tp, int *warn)
+{
+ type_t **arg;
+ tspec_t t;
+
+ if (tp->t_vararg && warn != NULL)
+ *warn = 1;
+ for (arg = tp->t_args; *arg != NULL; arg++) {
+ if ((t = (*arg)->t_tspec) == FLOAT)
+ return (0);
+ if (t == CHAR || t == SCHAR || t == UCHAR)
+ return (0);
+ if (t == SHORT || t == USHORT)
+ return (0);
+ }
+ return (1);
+}
diff --git a/usr.bin/xlint/lint2/emit2.c b/usr.bin/xlint/lint2/emit2.c
new file mode 100644
index 0000000..16c9632
--- /dev/null
+++ b/usr.bin/xlint/lint2/emit2.c
@@ -0,0 +1,300 @@
+/* $NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+
+#include "lint2.h"
+
+static void outtype(type_t *);
+static void outdef(hte_t *, sym_t *);
+static void dumpname(hte_t *);
+static void outfiles(void);
+
+/*
+ * Write type into the output buffer.
+ */
+static void
+outtype(type_t *tp)
+{
+ int t, s, na;
+ tspec_t ts;
+ type_t **ap;
+
+ while (tp != NULL) {
+ if ((ts = tp->t_tspec) == INT && tp->t_isenum)
+ ts = ENUM;
+ switch (ts) {
+ case CHAR: t = 'C'; s = '\0'; break;
+ case SCHAR: t = 'C'; s = 's'; break;
+ case UCHAR: t = 'C'; s = 'u'; break;
+ case SHORT: t = 'S'; s = '\0'; break;
+ case USHORT: t = 'S'; s = 'u'; break;
+ case INT: t = 'I'; s = '\0'; break;
+ case UINT: t = 'I'; s = 'u'; break;
+ case LONG: t = 'L'; s = '\0'; break;
+ case ULONG: t = 'L'; s = 'u'; break;
+ case QUAD: t = 'Q'; s = '\0'; break;
+ case UQUAD: t = 'Q'; s = 'u'; break;
+ case FLOAT: t = 'D'; s = 's'; break;
+ case DOUBLE: t = 'D'; s = '\0'; break;
+ case LDOUBLE: t = 'D'; s = 'l'; break;
+ case VOID: t = 'V'; s = '\0'; break;
+ case PTR: t = 'P'; s = '\0'; break;
+ case ARRAY: t = 'A'; s = '\0'; break;
+ case ENUM: t = 'T'; s = 'e'; break;
+ case STRUCT: t = 'T'; s = 's'; break;
+ case UNION: t = 'T'; s = 'u'; break;
+ case FUNC:
+ if (tp->t_args != NULL && !tp->t_proto) {
+ t = 'f';
+ } else {
+ t = 'F';
+ }
+ s = '\0';
+ break;
+ default:
+ errx(1, "internal error: outtype() 1");
+ }
+ if (tp->t_const)
+ outchar('c');
+ if (tp->t_volatile)
+ outchar('v');
+ if (s != '\0')
+ outchar(s);
+ outchar(t);
+ if (ts == ARRAY) {
+ outint(tp->t_dim);
+ } else if (ts == ENUM || ts == STRUCT || ts == UNION) {
+ if (tp->t_istag) {
+ outint(1);
+ outname(tp->t_tag->h_name);
+ } else if (tp->t_istynam) {
+ outint(2);
+ outname(tp->t_tynam->h_name);
+ } else if (tp->t_isuniqpos) {
+ outint(3);
+ outint(tp->t_uniqpos.p_line);
+ outchar('.');
+ outint(tp->t_uniqpos.p_file);
+ outchar('.');
+ outint(tp->t_uniqpos.p_uniq);
+ } else
+ errx(1, "internal error: outtype() 2");
+ } else if (ts == FUNC && tp->t_args != NULL) {
+ na = 0;
+ for (ap = tp->t_args; *ap != NULL; ap++)
+ na++;
+ if (tp->t_vararg)
+ na++;
+ outint(na);
+ for (ap = tp->t_args; *ap != NULL; ap++)
+ outtype(*ap);
+ if (tp->t_vararg)
+ outchar('E');
+ }
+ tp = tp->t_subt;
+ }
+}
+
+/*
+ * Write a definition.
+ */
+static void
+outdef(hte_t *hte, sym_t *sym)
+{
+
+ /* reset output buffer */
+ outclr();
+
+ /* line number in C source file */
+ outint(0);
+
+ /* this is a definition */
+ outchar('d');
+
+ /* index of file where symbol was defined and line number of def. */
+ outint(0);
+ outchar('.');
+ outint(0);
+
+ /* flags */
+ if (sym->s_va) {
+ outchar('v'); /* varargs */
+ outint(sym->s_nva);
+ }
+ if (sym->s_scfl) {
+ outchar('S'); /* scanflike */
+ outint(sym->s_nscfl);
+ }
+ if (sym->s_prfl) {
+ outchar('P'); /* printflike */
+ outint(sym->s_nprfl);
+ }
+ /* definition or tentative definition */
+ outchar(sym->s_def == DEF ? 'd' : 't');
+ if (TP(sym->s_type)->t_tspec == FUNC) {
+ if (sym->s_rval)
+ outchar('r'); /* fkt. has return value */
+ if (sym->s_osdef)
+ outchar('o'); /* old style definition */
+ }
+ outchar('u'); /* used (no warning if not used) */
+
+ /* name */
+ outname(hte->h_name);
+
+ /* type */
+ outtype(TP(sym->s_type));
+}
+
+/*
+ * Write the first definition of a name into the lint library.
+ */
+static void
+dumpname(hte_t *hte)
+{
+ sym_t *sym, *def;
+
+ /* static and undefined symbols are not written */
+ if (hte->h_static || !hte->h_def)
+ return;
+
+ /*
+ * If there is a definition, write it. Otherwise write a tentative
+ * definition. This is necessary because more than one tentative
+ * definition is allowed (except with sflag).
+ */
+ def = NULL;
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (sym->s_def == DEF) {
+ def = sym;
+ break;
+ }
+ if (sym->s_def == TDEF && def == NULL)
+ def = sym;
+ }
+ if (def == NULL)
+ errx(1, "internal error: dumpname() %s", hte->h_name);
+
+ outdef(hte, def);
+}
+
+/*
+ * Write a new lint library.
+ */
+void
+outlib(const char *name)
+{
+ /* Open of output file and initialisation of the output buffer */
+ outopen(name);
+
+ /* write name of lint library */
+ outsrc(name);
+
+ /* name of lint lib has index 0 */
+ outclr();
+ outint(0);
+ outchar('s');
+ outstrg(name);
+
+ /*
+ * print the names of all files references by unnamed
+ * struct/union/enum declarations.
+ */
+ outfiles();
+
+ /* write all definitions with external linkage */
+ forall(dumpname);
+
+ /* close the output */
+ outclose();
+}
+
+/*
+ * Write out the name of a file referenced by a type.
+ */
+struct outflist {
+ short ofl_num;
+ struct outflist *ofl_next;
+};
+static struct outflist *outflist;
+
+int
+addoutfile(short num)
+{
+ struct outflist *ofl, **pofl;
+ int i;
+
+ ofl = outflist;
+ pofl = &outflist;
+ i = 1; /* library is 0 */
+
+ while (ofl != NULL) {
+ if (ofl->ofl_num == num)
+ break;
+
+ pofl = &ofl->ofl_next;
+ ofl = ofl->ofl_next;
+ i++;
+ }
+
+ if (ofl == NULL) {
+ ofl = *pofl = xmalloc(sizeof (struct outflist));
+ ofl->ofl_num = num;
+ ofl->ofl_next = NULL;
+ }
+ return (i);
+}
+
+static void
+outfiles(void)
+{
+ struct outflist *ofl;
+ int i;
+
+ for (ofl = outflist, i = 1; ofl != NULL; ofl = ofl->ofl_next, i++) {
+ /* reset output buffer */
+ outclr();
+
+ outint(i);
+ outchar('s');
+ outstrg(fnames[ofl->ofl_num]);
+ }
+}
diff --git a/usr.bin/xlint/lint2/externs2.h b/usr.bin/xlint/lint2/externs2.h
new file mode 100644
index 0000000..3b6f03a
--- /dev/null
+++ b/usr.bin/xlint/lint2/externs2.h
@@ -0,0 +1,93 @@
+/* $NetBSD: externs2.h,v 1.7 2001/05/28 12:40:38 lukem Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+/*
+ * main.c
+ */
+extern int xflag;
+extern int uflag;
+extern int Cflag;
+extern const char *libname;
+extern int sflag;
+extern int tflag;
+extern int Hflag;
+extern int hflag;
+extern int Fflag;
+
+
+/*
+ * hash.c
+ */
+extern void _inithash(hte_t ***);
+extern hte_t *_hsearch(hte_t **, const char *, int);
+extern void _forall(hte_t **, void (*)(hte_t *));
+extern void _destroyhash(hte_t **);
+
+#define inithash() _inithash(NULL);
+#define hsearch(a, b) _hsearch(NULL, (a), (b))
+#define forall(a) _forall(NULL, (a))
+
+/*
+ * read.c
+ */
+extern const char **fnames;
+extern type_t **tlst;
+
+extern void readfile(const char *);
+extern void mkstatic(hte_t *);
+
+/*
+ * mem2.c
+ */
+extern void initmem(void);
+extern void *xalloc(size_t);
+
+/*
+ * chk.c
+ */
+extern void inittyp(void);
+extern void mainused(void);
+extern void chkname(hte_t *);
+
+/*
+ * msg.c
+ */
+extern void msg(int, ...);
+extern const char *mkpos(pos_t *);
+
+/*
+ * emit2.c
+ */
+extern void outlib(const char *);
+extern int addoutfile(short);
diff --git a/usr.bin/xlint/lint2/hash.c b/usr.bin/xlint/lint2/hash.c
new file mode 100644
index 0000000..a215aba
--- /dev/null
+++ b/usr.bin/xlint/lint2/hash.c
@@ -0,0 +1,166 @@
+/* $NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+/*
+ * XXX Really need a generalized hash table package
+ */
+
+#include <err.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint2.h"
+
+/* pointer to hash table, initialized in inithash() */
+static hte_t **htab;
+
+static int hash(const char *);
+
+/*
+ * Initialize hash table.
+ */
+void
+_inithash(hte_t ***tablep)
+{
+
+ if (tablep == NULL)
+ tablep = &htab;
+
+ *tablep = xcalloc(HSHSIZ2, sizeof (hte_t *));
+}
+
+/*
+ * Compute hash value from a string.
+ */
+static int
+hash(const char *s)
+{
+ u_int v;
+ const u_char *us;
+
+ v = 0;
+ for (us = (const u_char *)s; *us != '\0'; us++) {
+ v = (v << sizeof (v)) + *us;
+ v ^= v >> (sizeof (v) * CHAR_BIT - sizeof (v));
+ }
+ return (v % HSHSIZ2);
+}
+
+/*
+ * Look for a hash table entry. If no hash table entry for the
+ * given name exists and mknew is set, create a new one.
+ */
+hte_t *
+_hsearch(hte_t **table, const char *s, int mknew)
+{
+ int h;
+ hte_t *hte;
+
+ if (table == NULL)
+ table = htab;
+
+ h = hash(s);
+ for (hte = table[h]; hte != NULL; hte = hte->h_link) {
+ if (strcmp(hte->h_name, s) == 0)
+ break;
+ }
+
+ if (hte != NULL || !mknew)
+ return (hte);
+
+ /* create a new hte */
+ hte = xmalloc(sizeof (hte_t));
+ hte->h_name = xstrdup(s);
+ hte->h_used = 0;
+ hte->h_def = 0;
+ hte->h_static = 0;
+ hte->h_syms = NULL;
+ hte->h_lsym = &hte->h_syms;
+ hte->h_calls = NULL;
+ hte->h_lcall = &hte->h_calls;
+ hte->h_usyms = NULL;
+ hte->h_lusym = &hte->h_usyms;
+ hte->h_link = table[h];
+ hte->h_hte = NULL;
+ table[h] = hte;
+
+ return (hte);
+}
+
+/*
+ * Call function f for each name in the hash table.
+ */
+void
+_forall(hte_t **table, void (*f)(hte_t *))
+{
+ int i;
+ hte_t *hte;
+
+ if (table == NULL)
+ table = htab;
+
+ for (i = 0; i < HSHSIZ2; i++) {
+ for (hte = table[i]; hte != NULL; hte = hte->h_link)
+ (*f)(hte);
+ }
+}
+
+/*
+ * Free all contents of the hash table that this module allocated.
+ */
+void
+_destroyhash(hte_t **table)
+{
+ int i;
+ hte_t *hte, *nexthte;
+
+ if (table == NULL)
+ err(1, "_destroyhash called on main hash table");
+
+ for (i = 0; i < HSHSIZ2; i++) {
+ for (hte = table[i]; hte != NULL; hte = nexthte) {
+ free((void *)hte->h_name);
+ nexthte = hte->h_link;
+ free(hte);
+ }
+ }
+ free(table);
+}
diff --git a/usr.bin/xlint/lint2/lint2.h b/usr.bin/xlint/lint2/lint2.h
new file mode 100644
index 0000000..75f9dc9
--- /dev/null
+++ b/usr.bin/xlint/lint2/lint2.h
@@ -0,0 +1,188 @@
+/* $NetBSD: lint2.h,v 1.5 2000/06/14 06:49:23 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include "lint.h"
+
+/*
+ * Types are described by structures of type type_t.
+ */
+typedef struct type {
+ tspec_t t_tspec; /* type specifier */
+ u_int t_const : 1; /* constant */
+ u_int t_volatile : 1; /* volatile */
+ u_int t_vararg : 1; /* function has variable number of arguments */
+ u_int t_isenum : 1; /* enum type */
+ u_int t_proto : 1; /* this is a prototype */
+ u_int t_istag : 1; /* tag with _t_tag valid */
+ u_int t_istynam : 1; /* tag with _t_tynam valid */
+ u_int t_isuniqpos : 1; /* tag with _t_uniqpos valid */
+ union {
+ int _t_dim; /* if the type is an ARRAY than this
+ is the dimension of the array. */
+ struct hte *_t_tag; /* hash table entry of tag if
+ t_isenum, STRUCT or UNION */
+ struct hte *_t_tynam; /* hash table entry of typename if
+ t_isenum, STRUCT or UNION */
+ struct {
+ int p_line;
+ short p_file;
+ int p_uniq;
+ } _t_uniqpos; /* unique position, for untagged
+ untyped STRUCTs, UNIONS, and ENUMs,
+ if t_isuniqpos */
+ struct type **_t_args; /* list of argument types if this
+ is a prototype */
+ } t_u;
+ struct type *t_subt; /* indirected type (array element, pointed to
+ type, type of return value) */
+} type_t;
+
+#define t_dim t_u._t_dim
+#define t_tag t_u._t_tag
+#define t_tynam t_u._t_tynam
+#define t_uniqpos t_u._t_uniqpos
+#define t_args t_u._t_args
+
+/*
+ * argument information
+ *
+ * Such a structure is created for each argument of a function call
+ * which is an integer constant or a constant string.
+ */
+typedef struct arginf {
+ int a_num; /* # of argument (1..) */
+ u_int a_zero : 1; /* argument is 0 */
+ u_int a_pcon : 1; /* msb of argument is not set */
+ u_int a_ncon : 1; /* msb of argument is set */
+ u_int a_fmt : 1; /* a_fstrg points to format string */
+ char *a_fstrg; /* format string */
+ struct arginf *a_nxt; /* information for next const. argument */
+} arginf_t;
+
+/*
+ * Keeps information about position in source file.
+ */
+typedef struct {
+ u_short p_src; /* index of name of translation unit
+ (the name which was specified at the
+ command line) */
+ u_short p_line; /* line number in p_src */
+ u_short p_isrc; /* index of (included) file */
+ u_short p_iline; /* line number in p_iline */
+} pos_t;
+
+/*
+ * Used for definitions and declarations
+ *
+ * To save memory, variable sized structures are used. If
+ * all s_va, s_prfl and s_scfl are not set, the memory allocated
+ * for a symbol is only large enough to keep the first member of
+ * struct sym, s_s.
+ */
+typedef struct sym {
+ struct {
+ pos_t s_pos; /* pos of def./decl. */
+#ifndef lint
+ u_int s_def : 3; /* DECL, TDEF or DEF */
+#else
+ def_t s_def;
+#endif
+ u_int s_rval : 1; /* function has return value */
+ u_int s_osdef : 1; /* old style function definition */
+ u_int s_static : 1; /* symbol is static */
+ u_int s_va : 1; /* check only first s_nva arguments */
+ u_int s_prfl : 1; /* printflike */
+ u_int s_scfl : 1; /* scanflike */
+ u_short s_type; /* type */
+ struct sym *s_nxt; /* next symbol with same name */
+ } s_s;
+ short s_nva;
+ short s_nprfl;
+ short s_nscfl;
+} sym_t;
+
+#define s_pos s_s.s_pos
+#define s_rval s_s.s_rval
+#define s_osdef s_s.s_osdef
+#define s_static s_s.s_static
+#define s_def s_s.s_def
+#define s_va s_s.s_va
+#define s_prfl s_s.s_prfl
+#define s_scfl s_s.s_scfl
+#define s_type s_s.s_type
+#define s_nxt s_s.s_nxt
+
+/*
+ * Used to store informations about function calls.
+ */
+typedef struct fcall {
+ pos_t f_pos; /* position of call */
+ u_int f_rused : 1; /* return value used */
+ u_int f_rdisc : 1; /* return value discarded (casted to void) */
+ u_short f_type; /* types of expected return value and args */
+ arginf_t *f_args; /* information about constant arguments */
+ struct fcall *f_nxt; /* next call of same function */
+} fcall_t;
+
+/*
+ * Used to store information about usage of symbols other
+ * than for function calls.
+ */
+typedef struct usym {
+ pos_t u_pos; /* position */
+ struct usym *u_nxt; /* next usage */
+} usym_t;
+
+/*
+ * hash table entry
+ */
+typedef struct hte {
+ const char *h_name; /* name */
+ u_int h_used : 1; /* symbol is used */
+ u_int h_def : 1; /* symbol is defined */
+ u_int h_static : 1; /* static symbol */
+ sym_t *h_syms; /* declarations and definitions */
+ sym_t **h_lsym; /* points to s_nxt of last decl./def. */
+ fcall_t *h_calls; /* function calls */
+ fcall_t **h_lcall; /* points to f_nxt of last call */
+ usym_t *h_usyms; /* usage info */
+ usym_t **h_lusym; /* points to u_nxt of last usage info */
+ struct hte *h_link; /* next hte with same hash function */
+ struct hte *h_hte; /* pointer to other htes (for renames */
+} hte_t;
+
+/* maps type indices into pointers to type structs */
+#define TP(idx) (tlst[idx])
+
+#include "externs2.h"
diff --git a/usr.bin/xlint/lint2/main2.c b/usr.bin/xlint/lint2/main2.c
new file mode 100644
index 0000000..a05ddf4
--- /dev/null
+++ b/usr.bin/xlint/lint2/main2.c
@@ -0,0 +1,191 @@
+/* $NetBSD: main2.c,v 1.5 2001/11/21 19:14:26 wiz 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: main2.c,v 1.5 2001/11/21 19:14:26 wiz Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "lint2.h"
+
+/* warnings for symbols which are declared but not defined or used */
+int xflag;
+
+/*
+ * warnings for symbols which are used and not defined or defined
+ * and not used
+ */
+int uflag = 1;
+
+/* Create a lint library in the current directory with name libname. */
+int Cflag;
+const char *libname;
+
+int pflag;
+
+/*
+ * warnings for (tentative) definitions of the same name in more than
+ * one translation unit
+ */
+int sflag;
+
+int tflag;
+
+/*
+ * If a complaint stems from an included file, print the name of the included
+ * file instead of the name spezified at the command line followed by '?'
+ */
+int Hflag;
+
+int hflag;
+
+/* Print full path names, not only the last component */
+int Fflag;
+
+/*
+ * List of libraries (from -l flag). These libraries are read after all
+ * other input files has been read and, for Cflag, after the new lint library
+ * has been written.
+ */
+const char **libs;
+
+static void usage(void);
+
+int main(int, char *[]);
+
+int
+main(int argc, char *argv[])
+{
+ int c, i;
+ size_t len;
+ char *lname;
+
+ libs = xcalloc(1, sizeof (char *));
+
+ opterr = 0;
+ while ((c = getopt(argc, argv, "hpstxuC:HFl:")) != -1) {
+ switch (c) {
+ case 's':
+ sflag = 1;
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'u':
+ uflag = 0;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case 'C':
+ len = strlen(optarg);
+ lname = xmalloc(len + 10);
+ (void)sprintf(lname, "llib-l%s.ln", optarg);
+ libname = lname;
+ Cflag = 1;
+ uflag = 0;
+ break;
+ case 'H':
+ Hflag = 1;
+ break;
+ case 'h':
+ hflag = 1;
+ break;
+ case 'F':
+ Fflag = 1;
+ break;
+ case 'l':
+ for (i = 0; libs[i] != NULL; i++)
+ continue;
+ libs = xrealloc(libs, (i + 2) * sizeof (char *));
+ libs[i] = xstrdup(optarg);
+ libs[i + 1] = NULL;
+ break;
+ case '?':
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ usage();
+
+ initmem();
+
+ /* initialize hash table */
+ inithash();
+
+ inittyp();
+
+ for (i = 0; i < argc; i++)
+ readfile(argv[i]);
+
+ /* write the lint library */
+ if (Cflag) {
+ forall(mkstatic);
+ outlib(libname);
+ }
+
+ /* read additional libraries */
+ for (i = 0; libs[i] != NULL; i++)
+ readfile(libs[i]);
+
+ forall(mkstatic);
+
+ mainused();
+
+ /* perform all tests */
+ forall(chkname);
+
+ exit(0);
+ /* NOTREACHED */
+}
+
+static void
+usage(void)
+{
+ (void)fprintf(stderr,
+ "usage: lint2 -hpstxuHF -Clib -l lib ... src1 ...\n");
+ exit(1);
+}
diff --git a/usr.bin/xlint/lint2/mem2.c b/usr.bin/xlint/lint2/mem2.c
new file mode 100644
index 0000000..48e759e
--- /dev/null
+++ b/usr.bin/xlint/lint2/mem2.c
@@ -0,0 +1,97 @@
+/* $NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <err.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "lint2.h"
+
+/* length of new allocated memory blocks */
+static size_t mblklen;
+
+/* offset of next free byte in mbuf */
+static size_t nxtfree;
+
+/* current buffer to server memory requests from */
+static void *mbuf;
+
+void
+initmem(void)
+{
+ int pgsz;
+
+ pgsz = getpagesize();
+ mblklen = ((MBLKSIZ + pgsz - 1) / pgsz) * pgsz;
+
+ nxtfree = mblklen;
+}
+
+/*
+ * Allocate memory in large chunks to avoid space and time overhead of
+ * malloc(). This is possible because memory allocated by xalloc()
+ * need never to be freed.
+ */
+void *
+xalloc(size_t sz)
+{
+ void *ptr;
+ int prot, flags;
+
+ /* Align to at least 8 bytes. */
+ sz = (sz + 7) & ~7L;
+ if (nxtfree + sz > mblklen) {
+ /* use mmap() instead of malloc() to avoid malloc overhead. */
+ prot = PROT_READ | PROT_WRITE;
+ flags = MAP_ANON | MAP_PRIVATE;
+ mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
+ if (mbuf == (void *)MAP_FAILED)
+ err(1, "can't map memory");
+ (void)memset(mbuf, 0, mblklen);
+ nxtfree = 0;
+ }
+
+ ptr = (char *)mbuf + nxtfree;
+ nxtfree += sz;
+
+ return (ptr);
+}
diff --git a/usr.bin/xlint/lint2/msg.c b/usr.bin/xlint/lint2/msg.c
new file mode 100644
index 0000000..b7855ad
--- /dev/null
+++ b/usr.bin/xlint/lint2/msg.c
@@ -0,0 +1,138 @@
+/* $NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "lint2.h"
+
+static const char *msgs[] = {
+ "%s used( %s ), but not defined", /* 0 */
+ "%s defined( %s ), but never used", /* 1 */
+ "%s declared( %s ), but never used or defined", /* 2 */
+ "%s multiply defined \t%s :: %s", /* 3 */
+ "%s value used inconsistently \t%s :: %s", /* 4 */
+ "%s value declared inconsistently \t%s :: %s", /* 5 */
+ "%s, arg %d used inconsistently \t%s :: %s", /* 6 */
+ "%s: variable # of args \t%s :: %s", /* 7 */
+ "%s returns value which is always ignored", /* 8 */
+ "%s returns value which is sometimes ignored", /* 9 */
+ "%s value is used( %s ), but none returned", /* 10 */
+ "%s, arg %d declared inconsistently \t%s :: %s", /* 11 */
+ "%s: variable # of args declared \t%s :: %s", /* 12 */
+ "%s: malformed format string \t%s", /* 13 */
+ "%s, arg %d inconsistent with format \t%s", /* 14 */
+ "%s: too few args for format \t%s", /* 15 */
+ "%s: too many args for format \t%s", /* 16 */
+ "%s function value must be declared before use \t%s :: %s",/* 17 */
+ "%s renamed multiple times \t%s :: %s", /* 18 */
+};
+
+static const char *lbasename(const char *);
+
+void
+msg(int n, ...)
+{
+ va_list ap;
+
+ va_start(ap, n);
+
+ (void)vprintf(msgs[n], ap);
+ (void)printf("\n");
+
+ va_end(ap);
+}
+
+/*
+ * Return a pointer to the last component of a path.
+ */
+static const char *
+lbasename(const char *path)
+{
+ const char *cp, *cp1, *cp2;
+
+ if (Fflag)
+ return (path);
+
+ cp = cp1 = cp2 = path;
+ while (*cp != '\0') {
+ if (*cp++ == '/') {
+ cp2 = cp1;
+ cp1 = cp;
+ }
+ }
+ return (*cp1 == '\0' ? cp2 : cp1);
+}
+
+/*
+ * Create a string which describes a position in a source file.
+ */
+const char *
+mkpos(pos_t *posp)
+{
+ size_t len;
+ const char *fn;
+ static char *buf;
+ static size_t blen = 0;
+ int qm, src, line;
+
+ if (Hflag && posp->p_src != posp->p_isrc) {
+ src = posp->p_isrc;
+ line = posp->p_iline;
+ } else {
+ src = posp->p_src;
+ line = posp->p_line;
+ }
+ qm = !Hflag && posp->p_src != posp->p_isrc;
+
+ len = strlen(fn = lbasename(fnames[src]));
+ len += 3 * sizeof (u_short) + 4;
+
+ if (len > blen)
+ buf = xrealloc(buf, blen = len);
+ if (line != 0) {
+ (void)sprintf(buf, "%s%s(%d)",
+ fn, qm ? "?" : "", line);
+ } else {
+ (void)sprintf(buf, "%s", fn);
+ }
+
+ return (buf);
+}
diff --git a/usr.bin/xlint/lint2/read.c b/usr.bin/xlint/lint2/read.c
new file mode 100644
index 0000000..8ff156e
--- /dev/null
+++ b/usr.bin/xlint/lint2/read.c
@@ -0,0 +1,1245 @@
+/* $NetBSD: read.c,v 1.19 2007/09/28 21:53:50 uwe Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: read.c,v 1.19 2007/09/28 21:53:50 uwe Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <ctype.h>
+#include <err.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lint2.h"
+
+
+/* index of current (included) source file */
+static int srcfile;
+
+/*
+ * The array pointed to by inpfns maps the file name indices of input files
+ * to the file name indices used in lint2
+ */
+static short *inpfns;
+static size_t ninpfns;
+
+/*
+ * The array pointed to by *fnames maps file name indizes to file names.
+ * Indices of type short are used instead of pointers to save memory.
+ */
+const char **fnames;
+static size_t nfnames;
+
+/*
+ * Types are shared (to save memory for the types itself) and accessed
+ * via indices (to save memory for references to types (indices are short)).
+ * To share types, an equal type must be located fast. This is done by a
+ * hash table. Access by indices is done via an array of pointers to the
+ * types.
+ */
+typedef struct thtab {
+ const char *th_name;
+ u_short th_idx;
+ struct thtab *th_nxt;
+} thtab_t;
+static thtab_t **thtab; /* hash table */
+type_t **tlst; /* array for indexed access */
+static size_t tlstlen; /* length of tlst */
+
+static hte_t **renametab;
+
+/* index of current C source file (as spezified at the command line) */
+static int csrcfile;
+
+
+#define inperr() inperror(__FILE__, __LINE__)
+static void inperror(const char *, size_t);
+static void setsrc(const char *);
+static void setfnid(int, const char *);
+static void funccall(pos_t *, const char *);
+static void decldef(pos_t *, const char *);
+static void usedsym(pos_t *, const char *);
+static u_short inptype(const char *, const char **);
+static int gettlen(const char *, const char **);
+static u_short findtype(const char *, size_t, int);
+static u_short storetyp(type_t *, const char *, size_t, int);
+static int thash(const char *, size_t);
+static char *inpqstrg(const char *, const char **);
+static const char *inpname(const char *, const char **);
+static int getfnidx(const char *);
+
+void
+readfile(const char *name)
+{
+ FILE *inp;
+ size_t len;
+ const char *cp;
+ char *line, *eptr, rt = '\0';
+ int cline, isrc, iline;
+ pos_t pos;
+
+ if (inpfns == NULL)
+ if ((inpfns = calloc(ninpfns = 128, sizeof (short))) == NULL)
+ nomem();
+ if (fnames == NULL)
+ if ((fnames = calloc(nfnames = 256, sizeof (char *))) == NULL)
+ nomem();
+ if (tlstlen == 0)
+ if ((tlst = calloc(tlstlen = 256, sizeof (type_t *))) == NULL)
+ nomem();
+ if (thtab == NULL)
+ if ((thtab = calloc(THSHSIZ2, sizeof (thtab_t))) == NULL)
+ nomem();
+
+ _inithash(&renametab);
+
+ srcfile = getfnidx(name);
+
+ if ((inp = fopen(name, "r")) == NULL)
+ err(1, "cannot open %s", name);
+
+ while ((line = fgetln(inp, &len)) != NULL) {
+
+ if (len == 0 || line[len - 1] != '\n')
+ inperr();
+ line[len - 1] = '\0';
+ cp = line;
+
+ /* line number in csrcfile */
+ cline = (int)strtol(cp, &eptr, 10);
+ if (cp == eptr) {
+ cline = -1;
+ } else {
+ cp = eptr;
+ }
+
+ /* record type */
+ if (*cp != '\0') {
+ rt = *cp++;
+ } else {
+ inperr();
+ }
+
+ if (rt == 'S') {
+ setsrc(cp);
+ continue;
+ } else if (rt == 's') {
+ setfnid(cline, cp);
+ continue;
+ }
+
+ /*
+ * Index of (included) source file. If this index is
+ * different from csrcfile, it refers to an included
+ * file.
+ */
+ isrc = (int)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ isrc = inpfns[isrc];
+
+ /* line number in isrc */
+ if (*cp++ != '.')
+ inperr();
+ iline = (int)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+
+ pos.p_src = (u_short)csrcfile;
+ pos.p_line = (u_short)cline;
+ pos.p_isrc = (u_short)isrc;
+ pos.p_iline = (u_short)iline;
+
+ /* process rest of this record */
+ switch (rt) {
+ case 'c':
+ funccall(&pos, cp);
+ break;
+ case 'd':
+ decldef(&pos, cp);
+ break;
+ case 'u':
+ usedsym(&pos, cp);
+ break;
+ default:
+ inperr();
+ }
+
+ }
+
+ _destroyhash(renametab);
+
+ if (ferror(inp))
+ err(1, "read error on %s", name);
+
+ (void)fclose(inp);
+}
+
+
+static void
+inperror(const char *file, size_t line)
+{
+
+ errx(1, "%s,%zd: input file error: %s", file, line, fnames[srcfile]);
+}
+
+/*
+ * Set the name of the C source file of the .ln file which is
+ * currently read.
+ */
+static void
+setsrc(const char *cp)
+{
+
+ csrcfile = getfnidx(cp);
+}
+
+/*
+ * setfnid() gets as input an index as used in an input file and the
+ * associated file name. If necessary, it creates a new lint2 file
+ * name index for this file name and creates the mapping of the index
+ * as used in the input file to the index used in lint2.
+ */
+static void
+setfnid(int fid, const char *cp)
+{
+
+ if (fid == -1)
+ inperr();
+
+ if (fid >= ninpfns) {
+ if ((inpfns = realloc(inpfns, (ninpfns * 2) * sizeof (short)))
+ == NULL)
+ nomem();
+ (void)memset(inpfns + ninpfns, 0, ninpfns * sizeof (short));
+ ninpfns *= 2;
+ }
+ /*
+ * Should always be true because indices written in the output
+ * file by lint1 are always the previous index + 1.
+ */
+ if (fid >= ninpfns)
+ errx(1, "internal error: setfnid()");
+ inpfns[fid] = (u_short)getfnidx(cp);
+}
+
+/*
+ * Process a function call record (c-record).
+ */
+static void
+funccall(pos_t *posp, const char *cp)
+{
+ arginf_t *ai, **lai;
+ char c, *eptr;
+ int rused, rdisc;
+ hte_t *hte;
+ fcall_t *fcall;
+ const char *name;
+
+ fcall = xalloc(sizeof (fcall_t));
+ STRUCT_ASSIGN(fcall->f_pos, *posp);
+
+ /* read flags */
+ rused = rdisc = 0;
+ lai = &fcall->f_args;
+ while ((c = *cp) == 'u' || c == 'i' || c == 'd' ||
+ c == 'z' || c == 'p' || c == 'n' || c == 's') {
+ cp++;
+ switch (c) {
+ case 'u':
+ if (rused || rdisc)
+ inperr();
+ rused = 1;
+ break;
+ case 'i':
+ if (rused || rdisc)
+ inperr();
+ break;
+ case 'd':
+ if (rused || rdisc)
+ inperr();
+ rdisc = 1;
+ break;
+ case 'z':
+ case 'p':
+ case 'n':
+ case 's':
+ ai = xalloc(sizeof (arginf_t));
+ ai->a_num = (int)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ if (c == 'z') {
+ ai->a_pcon = ai->a_zero = 1;
+ } else if (c == 'p') {
+ ai->a_pcon = 1;
+ } else if (c == 'n') {
+ ai->a_ncon = 1;
+ } else {
+ ai->a_fmt = 1;
+ ai->a_fstrg = inpqstrg(cp, &cp);
+ }
+ *lai = ai;
+ lai = &ai->a_nxt;
+ break;
+ }
+ }
+ fcall->f_rused = rused;
+ fcall->f_rdisc = rdisc;
+
+ /* read name of function */
+ name = inpname(cp, &cp);
+
+ /* first look it up in the renaming table, then in the normal table */
+ hte = _hsearch(renametab, name, 0);
+ if (hte != NULL)
+ hte = hte->h_hte;
+ else
+ hte = hsearch(name, 1);
+ hte->h_used = 1;
+
+ fcall->f_type = inptype(cp, &cp);
+
+ *hte->h_lcall = fcall;
+ hte->h_lcall = &fcall->f_nxt;
+
+ if (*cp != '\0')
+ inperr();
+}
+
+/*
+ * Process a declaration or definition (d-record).
+ */
+static void
+decldef(pos_t *posp, const char *cp)
+{
+ sym_t *symp, sym;
+ char c, *ep, *pos1;
+ int used, renamed;
+ hte_t *hte, *renamehte = NULL;
+ const char *name, *rename;
+
+ (void)memset(&sym, 0, sizeof (sym));
+ STRUCT_ASSIGN(sym.s_pos, *posp);
+ sym.s_def = NODECL;
+
+ used = 0;
+
+ while (strchr("tdeurosvPS", (c = *cp)) != NULL) {
+ cp++;
+ switch (c) {
+ case 't':
+ if (sym.s_def != NODECL)
+ inperr();
+ sym.s_def = TDEF;
+ break;
+ case 'd':
+ if (sym.s_def != NODECL)
+ inperr();
+ sym.s_def = DEF;
+ break;
+ case 'e':
+ if (sym.s_def != NODECL)
+ inperr();
+ sym.s_def = DECL;
+ break;
+ case 'u':
+ if (used)
+ inperr();
+ used = 1;
+ break;
+ case 'r':
+ if (sym.s_rval)
+ inperr();
+ sym.s_rval = 1;
+ break;
+ case 'o':
+ if (sym.s_osdef)
+ inperr();
+ sym.s_osdef = 1;
+ break;
+ case 's':
+ if (sym.s_static)
+ inperr();
+ sym.s_static = 1;
+ break;
+ case 'v':
+ if (sym.s_va)
+ inperr();
+ sym.s_va = 1;
+ sym.s_nva = (short)strtol(cp, &ep, 10);
+ if (cp == ep)
+ inperr();
+ cp = ep;
+ break;
+ case 'P':
+ if (sym.s_prfl)
+ inperr();
+ sym.s_prfl = 1;
+ sym.s_nprfl = (short)strtol(cp, &ep, 10);
+ if (cp == ep)
+ inperr();
+ cp = ep;
+ break;
+ case 'S':
+ if (sym.s_scfl)
+ inperr();
+ sym.s_scfl = 1;
+ sym.s_nscfl = (short)strtol(cp, &ep, 10);
+ if (cp == ep)
+ inperr();
+ cp = ep;
+ break;
+ }
+ }
+
+ /* read symbol name, doing renaming if necessary */
+ name = inpname(cp, &cp);
+ renamed = 0;
+ if (*cp == 'r') {
+ cp++;
+ name = xstrdup(name);
+ rename = inpname(cp, &cp);
+
+ /* enter it and see if it's already been renamed */
+ renamehte = _hsearch(renametab, name, 1);
+ if (renamehte->h_hte == NULL) {
+ hte = hsearch(rename, 1);
+ renamehte->h_hte = hte;
+ renamed = 1;
+ } else if (strcmp((hte = renamehte->h_hte)->h_name, rename)) {
+ pos1 = xstrdup(mkpos(&renamehte->h_syms->s_pos));
+ /* %s renamed multiple times\t%s :: %s */
+ msg(18, name, pos1, mkpos(&sym.s_pos));
+ free(pos1);
+ }
+ free((char *)name);
+ } else {
+ /* it might be a previously-done rename */
+ hte = _hsearch(renametab, name, 0);
+ if (hte != NULL)
+ hte = hte->h_hte;
+ else
+ hte = hsearch(name, 1);
+ }
+ hte->h_used |= used;
+ if (sym.s_def == DEF || sym.s_def == TDEF)
+ hte->h_def = 1;
+
+ sym.s_type = inptype(cp, &cp);
+
+ /*
+ * Allocate memory for this symbol only if it was not already
+ * declared or tentatively defined at the same location with
+ * the same type. Works only for symbols with external linkage,
+ * because static symbols, tentatively defined at the same location
+ * but in different translation units are really different symbols.
+ */
+ for (symp = hte->h_syms; symp != NULL; symp = symp->s_nxt) {
+ if (symp->s_pos.p_isrc == sym.s_pos.p_isrc &&
+ symp->s_pos.p_iline == sym.s_pos.p_iline &&
+ symp->s_type == sym.s_type &&
+ ((symp->s_def == DECL && sym.s_def == DECL) ||
+ (!sflag && symp->s_def == TDEF && sym.s_def == TDEF)) &&
+ !symp->s_static && !sym.s_static) {
+ break;
+ }
+ }
+
+ if (symp == NULL) {
+ /* allocsym reserviert keinen Platz fuer s_nva */
+ if (sym.s_va || sym.s_prfl || sym.s_scfl) {
+ symp = xalloc(sizeof (sym_t));
+ STRUCT_ASSIGN(*symp, sym);
+ } else {
+ symp = xalloc(sizeof (symp->s_s));
+ STRUCT_ASSIGN(symp->s_s, sym.s_s);
+ }
+ *hte->h_lsym = symp;
+ hte->h_lsym = &symp->s_nxt;
+
+ /* XXX hack so we can remember where a symbol was renamed */
+ if (renamed)
+ renamehte->h_syms = symp;
+ }
+
+ if (*cp != '\0')
+ inperr();
+}
+
+/*
+ * Read an u-record (emitted by lint1 if a symbol was used).
+ */
+static void
+usedsym(pos_t *posp, const char *cp)
+{
+ usym_t *usym;
+ hte_t *hte;
+ const char *name;
+
+ usym = xalloc(sizeof (usym_t));
+ STRUCT_ASSIGN(usym->u_pos, *posp);
+
+ /* needed as delimiter between two numbers */
+ if (*cp++ != 'x')
+ inperr();
+
+ name = inpname(cp, &cp);
+ hte = _hsearch(renametab, name, 0);
+ if (hte != NULL)
+ hte = hte->h_hte;
+ else
+ hte = hsearch(name, 1);
+ hte->h_used = 1;
+
+ *hte->h_lusym = usym;
+ hte->h_lusym = &usym->u_nxt;
+}
+
+/*
+ * Read a type and return the index of this type.
+ */
+static u_short
+inptype(const char *cp, const char **epp)
+{
+ char c, s, *eptr;
+ const char *ep;
+ type_t *tp;
+ int narg, i, osdef = 0;
+ size_t tlen;
+ u_short tidx, sidx;
+ int h;
+
+ /* If we have this type already, return it's index. */
+ tlen = gettlen(cp, &ep);
+ h = thash(cp, tlen);
+ if ((tidx = findtype(cp, tlen, h)) != 0) {
+ *epp = ep;
+ return (tidx);
+ }
+
+ /* No, we must create a new type. */
+ tp = xalloc(sizeof (type_t));
+
+ tidx = storetyp(tp, cp, tlen, h);
+
+ c = *cp++;
+
+ while (c == 'c' || c == 'v') {
+ if (c == 'c') {
+ tp->t_const = 1;
+ } else {
+ tp->t_volatile = 1;
+ }
+ c = *cp++;
+ }
+
+ if (c == 's' || c == 'u' || c == 'l' || c == 'e') {
+ s = c;
+ c = *cp++;
+ } else {
+ s = '\0';
+ }
+
+ switch (c) {
+ case 'C':
+ tp->t_tspec = s == 's' ? SCHAR : (s == 'u' ? UCHAR : CHAR);
+ break;
+ case 'S':
+ tp->t_tspec = s == 'u' ? USHORT : SHORT;
+ break;
+ case 'I':
+ tp->t_tspec = s == 'u' ? UINT : INT;
+ break;
+ case 'L':
+ tp->t_tspec = s == 'u' ? ULONG : LONG;
+ break;
+ case 'Q':
+ tp->t_tspec = s == 'u' ? UQUAD : QUAD;
+ break;
+ case 'D':
+ tp->t_tspec = s == 's' ? FLOAT : (s == 'l' ? LDOUBLE : DOUBLE);
+ break;
+ case 'V':
+ tp->t_tspec = VOID;
+ break;
+ case 'P':
+ tp->t_tspec = PTR;
+ break;
+ case 'A':
+ tp->t_tspec = ARRAY;
+ break;
+ case 'F':
+ case 'f':
+ osdef = c == 'f';
+ tp->t_tspec = FUNC;
+ break;
+ case 'T':
+ tp->t_tspec = s == 'e' ? ENUM : (s == 's' ? STRUCT : UNION);
+ break;
+ }
+
+ switch (tp->t_tspec) {
+ case ARRAY:
+ tp->t_dim = (int)strtol(cp, &eptr, 10);
+ cp = eptr;
+ sidx = inptype(cp, &cp); /* force seq. point! (ditto below) */
+ tp->t_subt = TP(sidx);
+ break;
+ case PTR:
+ sidx = inptype(cp, &cp);
+ tp->t_subt = TP(sidx);
+ break;
+ case FUNC:
+ c = *cp;
+ if (isdigit((u_char)c)) {
+ if (!osdef)
+ tp->t_proto = 1;
+ narg = (int)strtol(cp, &eptr, 10);
+ cp = eptr;
+ if ((tp->t_args = calloc((size_t)(narg + 1),
+ sizeof (type_t *))) == NULL)
+ nomem();
+ for (i = 0; i < narg; i++) {
+ if (i == narg - 1 && *cp == 'E') {
+ tp->t_vararg = 1;
+ cp++;
+ } else {
+ sidx = inptype(cp, &cp);
+ tp->t_args[i] = TP(sidx);
+ }
+ }
+ }
+ sidx = inptype(cp, &cp);
+ tp->t_subt = TP(sidx);
+ break;
+ case ENUM:
+ tp->t_tspec = INT;
+ tp->t_isenum = 1;
+ /* FALLTHROUGH */
+ case STRUCT:
+ case UNION:
+ switch (*cp++) {
+ case '1':
+ tp->t_istag = 1;
+ tp->t_tag = hsearch(inpname(cp, &cp), 1);
+ break;
+ case '2':
+ tp->t_istynam = 1;
+ tp->t_tynam = hsearch(inpname(cp, &cp), 1);
+ break;
+ case '3':
+ tp->t_isuniqpos = 1;
+ tp->t_uniqpos.p_line = strtol(cp, &eptr, 10);
+ cp = eptr;
+ cp++;
+ /* xlate to 'global' file name. */
+ tp->t_uniqpos.p_file =
+ addoutfile(inpfns[strtol(cp, &eptr, 10)]);
+ cp = eptr;
+ cp++;
+ tp->t_uniqpos.p_uniq = strtol(cp, &eptr, 10);
+ cp = eptr;
+ break;
+ }
+ break;
+ case LONG:
+ case VOID:
+ case LDOUBLE:
+ case DOUBLE:
+ case FLOAT:
+ case UQUAD:
+ case QUAD:
+ case ULONG:
+ case UINT:
+ case INT:
+ case USHORT:
+ case SHORT:
+ case UCHAR:
+ case SCHAR:
+ case CHAR:
+ case UNSIGN:
+ case SIGNED:
+ case NOTSPEC:
+ break;
+ }
+
+ *epp = cp;
+ return (tidx);
+}
+
+/*
+ * Get the length of a type string.
+ */
+static int
+gettlen(const char *cp, const char **epp)
+{
+ const char *cp1;
+ char c, s, *eptr;
+ tspec_t t;
+ int narg, i, cm, vm;
+
+ cp1 = cp;
+
+ c = *cp++;
+
+ cm = vm = 0;
+
+ while (c == 'c' || c == 'v') {
+ if (c == 'c') {
+ if (cm)
+ inperr();
+ cm = 1;
+ } else {
+ if (vm)
+ inperr();
+ vm = 1;
+ }
+ c = *cp++;
+ }
+
+ if (c == 's' || c == 'u' || c == 'l' || c == 'e') {
+ s = c;
+ c = *cp++;
+ } else {
+ s = '\0';
+ }
+
+ t = NOTSPEC;
+
+ switch (c) {
+ case 'C':
+ if (s == 's') {
+ t = SCHAR;
+ } else if (s == 'u') {
+ t = UCHAR;
+ } else if (s == '\0') {
+ t = CHAR;
+ }
+ break;
+ case 'S':
+ if (s == 'u') {
+ t = USHORT;
+ } else if (s == '\0') {
+ t = SHORT;
+ }
+ break;
+ case 'I':
+ if (s == 'u') {
+ t = UINT;
+ } else if (s == '\0') {
+ t = INT;
+ }
+ break;
+ case 'L':
+ if (s == 'u') {
+ t = ULONG;
+ } else if (s == '\0') {
+ t = LONG;
+ }
+ break;
+ case 'Q':
+ if (s == 'u') {
+ t = UQUAD;
+ } else if (s == '\0') {
+ t = QUAD;
+ }
+ break;
+ case 'D':
+ if (s == 's') {
+ t = FLOAT;
+ } else if (s == 'l') {
+ t = LDOUBLE;
+ } else if (s == '\0') {
+ t = DOUBLE;
+ }
+ break;
+ case 'V':
+ if (s == '\0')
+ t = VOID;
+ break;
+ case 'P':
+ if (s == '\0')
+ t = PTR;
+ break;
+ case 'A':
+ if (s == '\0')
+ t = ARRAY;
+ break;
+ case 'F':
+ case 'f':
+ if (s == '\0')
+ t = FUNC;
+ break;
+ case 'T':
+ if (s == 'e') {
+ t = ENUM;
+ } else if (s == 's') {
+ t = STRUCT;
+ } else if (s == 'u') {
+ t = UNION;
+ }
+ break;
+ default:
+ inperr();
+ }
+
+ if (t == NOTSPEC)
+ inperr();
+
+ switch (t) {
+ case ARRAY:
+ (void)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ (void)gettlen(cp, &cp);
+ break;
+ case PTR:
+ (void)gettlen(cp, &cp);
+ break;
+ case FUNC:
+ c = *cp;
+ if (isdigit((u_char)c)) {
+ narg = (int)strtol(cp, &eptr, 10);
+ cp = eptr;
+ for (i = 0; i < narg; i++) {
+ if (i == narg - 1 && *cp == 'E') {
+ cp++;
+ } else {
+ (void)gettlen(cp, &cp);
+ }
+ }
+ }
+ (void)gettlen(cp, &cp);
+ break;
+ case ENUM:
+ case STRUCT:
+ case UNION:
+ switch (*cp++) {
+ case '1':
+ (void)inpname(cp, &cp);
+ break;
+ case '2':
+ (void)inpname(cp, &cp);
+ break;
+ case '3':
+ /* unique position: line.file.uniquifier */
+ (void)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ if (*cp++ != '.')
+ inperr();
+ (void)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ if (*cp++ != '.')
+ inperr();
+ (void)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ break;
+ default:
+ inperr();
+ }
+ break;
+ case FLOAT:
+ case USHORT:
+ case SHORT:
+ case UCHAR:
+ case SCHAR:
+ case CHAR:
+ case UNSIGN:
+ case SIGNED:
+ case NOTSPEC:
+ case INT:
+ case UINT:
+ case DOUBLE:
+ case LDOUBLE:
+ case VOID:
+ case ULONG:
+ case QUAD:
+ case UQUAD:
+ case LONG:
+ break;
+ }
+
+ *epp = cp;
+ return (cp - cp1);
+}
+
+/*
+ * Search a type by it's type string.
+ */
+static u_short
+findtype(const char *cp, size_t len, int h)
+{
+ thtab_t *thte;
+
+ for (thte = thtab[h]; thte != NULL; thte = thte->th_nxt) {
+ if (strncmp(thte->th_name, cp, len) != 0)
+ continue;
+ if (thte->th_name[len] == '\0')
+ return (thte->th_idx);
+ }
+
+ return (0);
+}
+
+/*
+ * Store a type and it's type string so we can later share this type
+ * if we read the same type string from the input file.
+ */
+static u_short
+storetyp(type_t *tp, const char *cp, size_t len, int h)
+{
+ static u_int tidx = 1; /* 0 is reserved */
+ thtab_t *thte;
+ char *name;
+
+ if (tidx >= USHRT_MAX)
+ errx(1, "sorry, too many types");
+
+ if (tidx == tlstlen - 1) {
+ if ((tlst = realloc(tlst, (tlstlen * 2) * sizeof (type_t *)))
+ == NULL)
+ nomem();
+ (void)memset(tlst + tlstlen, 0, tlstlen * sizeof (type_t *));
+ tlstlen *= 2;
+ }
+
+ tlst[tidx] = tp;
+
+ /* create a hash table entry */
+ name = xalloc(len + 1);
+ (void)memcpy(name, cp, len);
+ name[len] = '\0';
+
+ thte = xalloc(sizeof (thtab_t));
+ thte->th_name = name;
+ thte->th_idx = tidx;
+ thte->th_nxt = thtab[h];
+ thtab[h] = thte;
+
+ return ((u_short)tidx++);
+}
+
+/*
+ * Hash function for types
+ */
+static int
+thash(const char *s, size_t len)
+{
+ u_int v;
+
+ v = 0;
+ while (len-- != 0) {
+ v = (v << sizeof (v)) + (u_char)*s++;
+ v ^= v >> (sizeof (v) * CHAR_BIT - sizeof (v));
+ }
+ return (v % THSHSIZ2);
+}
+
+/*
+ * Read a string enclosed by "". This string may contain quoted chars.
+ */
+static char *
+inpqstrg(const char *src, const char **epp)
+{
+ char *strg, *dst;
+ size_t slen;
+ int c;
+ int v;
+
+ if ((dst = strg = malloc(slen = 32)) == NULL)
+ nomem();
+
+ if ((c = *src++) != '"')
+ inperr();
+ if ((c = *src++) == '\0')
+ inperr();
+
+ while (c != '"') {
+ if (c == '\\') {
+ if ((c = *src++) == '\0')
+ inperr();
+ switch (c) {
+ case 'n':
+ c = '\n';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'a':
+ c = '\a';
+ break;
+ case '\\':
+ c = '\\';
+ break;
+ case '"':
+ c = '"';
+ break;
+ case '\'':
+ c = '\'';
+ break;
+ case '0': case '1': case '2': case '3':
+ v = (c - '0') << 6;
+ if ((c = *src++) < '0' || c > '7')
+ inperr();
+ v |= (c - '0') << 3;
+ if ((c = *src++) < '0' || c > '7')
+ inperr();
+ v |= c - '0';
+ c = (u_char)v;
+ break;
+ default:
+ inperr();
+ }
+ }
+ /* keep space for trailing '\0' */
+ if (dst - strg == slen - 1) {
+ if ((strg = realloc(strg, slen * 2)) == NULL)
+ nomem();
+ dst = strg + (slen - 1);
+ slen *= 2;
+ }
+ *dst++ = (char)c;
+ if ((c = *src++) == '\0')
+ inperr();
+ }
+ *dst = '\0';
+
+ *epp = src;
+ return (strg);
+}
+
+/*
+ * Read the name of a symbol in static memory.
+ */
+static const char *
+inpname(const char *cp, const char **epp)
+{
+ static char *buf;
+ static size_t blen = 0;
+ size_t len, i;
+ char *eptr, c;
+
+ len = (int)strtol(cp, &eptr, 10);
+ if (cp == eptr)
+ inperr();
+ cp = eptr;
+ if (len + 1 > blen)
+ if ((buf = realloc(buf, blen = len + 1)) == NULL)
+ nomem();
+ for (i = 0; i < len; i++) {
+ c = *cp++;
+ if (!isalnum((unsigned char)c) && c != '_')
+ inperr();
+ buf[i] = c;
+ }
+ buf[i] = '\0';
+
+ *epp = cp;
+ return (buf);
+}
+
+/*
+ * Return the index of a file name. If the name cannot be found, create
+ * a new entry and return the index of the newly created entry.
+ */
+static int
+getfnidx(const char *fn)
+{
+ int i;
+
+ /* 0 ist reserved */
+ for (i = 1; fnames[i] != NULL; i++) {
+ if (strcmp(fnames[i], fn) == 0)
+ break;
+ }
+ if (fnames[i] != NULL)
+ return (i);
+
+ if (i == nfnames - 1) {
+ if ((fnames = realloc(fnames, (nfnames * 2) * sizeof (char *)))
+ == NULL)
+ nomem();
+ (void)memset(fnames + nfnames, 0, nfnames * sizeof (char *));
+ nfnames *= 2;
+ }
+
+ if ((fnames[i] = strdup(fn)) == NULL)
+ nomem();
+ return (i);
+}
+
+/*
+ * Separate symbols with static and external linkage.
+ */
+void
+mkstatic(hte_t *hte)
+{
+ sym_t *sym1, **symp, *sym;
+ fcall_t **callp, *call;
+ usym_t **usymp, *usym;
+ hte_t *nhte;
+ int ofnd;
+
+ /* Look for first static definition */
+ for (sym1 = hte->h_syms; sym1 != NULL; sym1 = sym1->s_nxt) {
+ if (sym1->s_static)
+ break;
+ }
+ if (sym1 == NULL)
+ return;
+
+ /* Do nothing if this name is used only in one translation unit. */
+ ofnd = 0;
+ for (sym = hte->h_syms; sym != NULL && !ofnd; sym = sym->s_nxt) {
+ if (sym->s_pos.p_src != sym1->s_pos.p_src)
+ ofnd = 1;
+ }
+ for (call = hte->h_calls; call != NULL && !ofnd; call = call->f_nxt) {
+ if (call->f_pos.p_src != sym1->s_pos.p_src)
+ ofnd = 1;
+ }
+ for (usym = hte->h_usyms; usym != NULL && !ofnd; usym = usym->u_nxt) {
+ if (usym->u_pos.p_src != sym1->s_pos.p_src)
+ ofnd = 1;
+ }
+ if (!ofnd) {
+ hte->h_used = 1;
+ /* errors about undef. static symbols are printed in lint1 */
+ hte->h_def = 1;
+ hte->h_static = 1;
+ return;
+ }
+
+ /*
+ * Create a new hash table entry
+ *
+ * XXX this entry should be put at the beginning of the list to
+ * avoid to process the same symbol twice.
+ */
+ for (nhte = hte; nhte->h_link != NULL; nhte = nhte->h_link)
+ continue;
+ nhte->h_link = xmalloc(sizeof (hte_t));
+ nhte = nhte->h_link;
+ nhte->h_name = hte->h_name;
+ nhte->h_used = 1;
+ nhte->h_def = 1; /* error in lint1 */
+ nhte->h_static = 1;
+ nhte->h_syms = NULL;
+ nhte->h_lsym = &nhte->h_syms;
+ nhte->h_calls = NULL;
+ nhte->h_lcall = &nhte->h_calls;
+ nhte->h_usyms = NULL;
+ nhte->h_lusym = &nhte->h_usyms;
+ nhte->h_link = NULL;
+ nhte->h_hte = NULL;
+
+ /*
+ * move all symbols used in this translation unit into the new
+ * hash table entry.
+ */
+ for (symp = &hte->h_syms; (sym = *symp) != NULL; ) {
+ if (sym->s_pos.p_src == sym1->s_pos.p_src) {
+ sym->s_static = 1;
+ (*symp) = sym->s_nxt;
+ if (hte->h_lsym == &sym->s_nxt)
+ hte->h_lsym = symp;
+ sym->s_nxt = NULL;
+ *nhte->h_lsym = sym;
+ nhte->h_lsym = &sym->s_nxt;
+ } else {
+ symp = &sym->s_nxt;
+ }
+ }
+ for (callp = &hte->h_calls; (call = *callp) != NULL; ) {
+ if (call->f_pos.p_src == sym1->s_pos.p_src) {
+ (*callp) = call->f_nxt;
+ if (hte->h_lcall == &call->f_nxt)
+ hte->h_lcall = callp;
+ call->f_nxt = NULL;
+ *nhte->h_lcall = call;
+ nhte->h_lcall = &call->f_nxt;
+ } else {
+ callp = &call->f_nxt;
+ }
+ }
+ for (usymp = &hte->h_usyms; (usym = *usymp) != NULL; ) {
+ if (usym->u_pos.p_src == sym1->s_pos.p_src) {
+ (*usymp) = usym->u_nxt;
+ if (hte->h_lusym == &usym->u_nxt)
+ hte->h_lusym = usymp;
+ usym->u_nxt = NULL;
+ *nhte->h_lusym = usym;
+ nhte->h_lusym = &usym->u_nxt;
+ } else {
+ usymp = &usym->u_nxt;
+ }
+ }
+
+ /* h_def must be recalculated for old hte */
+ hte->h_def = nhte->h_def = 0;
+ for (sym = hte->h_syms; sym != NULL; sym = sym->s_nxt) {
+ if (sym->s_def == DEF || sym->s_def == TDEF) {
+ hte->h_def = 1;
+ break;
+ }
+ }
+
+ mkstatic(hte);
+}
diff --git a/usr.bin/xlint/llib/Makefile b/usr.bin/xlint/llib/Makefile
new file mode 100644
index 0000000..df79a75
--- /dev/null
+++ b/usr.bin/xlint/llib/Makefile
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile,v 1.7 2000/06/14 20:22:19 matt Exp $
+# $FreeBSD$
+
+LIBS= llib-lposix.ln llib-lstdc.ln
+
+FILES= ${LIBS}
+FILESDIR= ${LINTLIBDIR}
+
+CLEANFILES+= ${LIBS}
+
+llib-lposix.ln: llib-lposix
+ ${LINT} ${LINTFLAGS} -Cposix ${.ALLSRC}
+
+llib-lstdc.ln: llib-lstdc
+ ${LINT} ${LINTFLAGS} -Cstdc ${.ALLSRC}
+
+.include <bsd.prog.mk>
+
+.if !empty(STAGE_INCLUDEDIR)
+LINTFLAGS+= -I${STAGE_INCLUDEDIR}
+.else
+.if ${CFLAGS:M--sysroot=*} != ""
+_sysroot?= ${CFLAGS:M--sysroot=*:[1]:C,^--sysroot=,,}
+.elif ${CC:M--sysroot=*} != ""
+_sysroot?= ${CC:M--sysroot=*:[1]:C,^--sysroot=,,}
+.endif
+.if !empty(_sysroot)
+LINTFLAGS+= -I${_sysroot}/usr/include
+.endif
+.endif
diff --git a/usr.bin/xlint/llib/Makefile.depend b/usr.bin/xlint/llib/Makefile.depend
new file mode 100644
index 0000000..19a3979
--- /dev/null
+++ b/usr.bin/xlint/llib/Makefile.depend
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ include \
+ lib/msun \
+ usr.bin/xlint/xlint.host \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xlint/llib/llib-lposix b/usr.bin/xlint/llib/llib-lposix
new file mode 100644
index 0000000..b3f9ca9
--- /dev/null
+++ b/usr.bin/xlint/llib/llib-lposix
@@ -0,0 +1,314 @@
+/* $NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * 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.
+ */
+
+/* LINTLIBRARY */
+
+#define _POSIX_SOURCE
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <sys/times.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include <time.h>
+#include <assert.h>
+#include <termios.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <signal.h>
+#include <locale.h>
+#include <setjmp.h>
+#include <string.h>
+#include <utime.h>
+
+
+/* PROTOLIB1 */
+
+
+void (abort)(void);
+int (abs)(int j);
+int (access)(const char *path, int amode);
+double (acos)(double x);
+unsigned (alarm)(unsigned seconds);
+char *(asctime)(const struct tm *timeptr);
+double (asin)(double x);
+void (__assert)(const char *expression, const char *func, int line,
+ const char *file);
+double (atan)(double x);
+double (atan2)(double y, double x);
+int (atexit)(void (*func)(void));
+double (atof)(const char *nptr);
+int (atoi)(const char *nptr);
+long (atol)(const char *nptr);
+void *(bsearch)(const void *key, const void *base, size_t nmemb,
+ size_t size, int (*compar)(const void *, const void *));
+void *(calloc)(size_t nmemb, size_t size);
+double (ceil)(double x);
+speed_t (cfgetispeed)(const struct termios *p);
+speed_t (cfgetospeed)(const struct termios *p);
+int (cfsetispeed)(struct termios *p, speed_t speed);
+int (cfsetospeed)(struct termios *p, speed_t speed);
+int (chdir)(const char *path);
+int (chmod)(const char *path, mode_t mode);
+int (chown)(const char *path, uid_t owner, gid_t group);
+void (clearerr)(FILE *stream);
+clock_t (clock)(void);
+int (close)(int fildes);
+int (closedir)(DIR *dirp);
+double (cos)(double x);
+double (cosh)(double x);
+int (creat)(const char *path, mode_t mode);
+char *(ctermid)(char *s);
+char *(ctime)(const time_t *timer);
+char *(cuserid)(char *s);
+double (difftime)(time_t time1, time_t time0);
+div_t (div)(int numer, int denom);
+int (dup)(int fildes);
+int (dup2)(int fildes, int fildes2);
+int (errno);
+int (execl)(const char *path, const char *arg, ...);
+int (execle)(const char *path, const char *arg, ...);
+int (execlp)(const char *file, const char *arg, ...);
+int (execv)(const char *path, char *const argv[]);
+int (execve)(const char *path, char *const argv[], char *const *envp);
+int (execvp)(const char *file, char *const argv[]);
+void (exit)(int status);
+void (_exit)(int status);
+double (exp)(double x);
+double (fabs)(double x);
+int (fclose)(FILE *stream);
+int (fcntl)(int fildes, int cmd, ...);
+FILE *(fdopen)(int fildes, const char *type);
+int (feof)(FILE *stream);
+int (ferror)(FILE *stream);
+int (fflush)(FILE *stream);
+int (fgetc)(FILE *stream);
+int (fgetpos)(FILE *stream, fpos_t *pos);
+char *(fgets)(char *s, int n, FILE *stream);
+int (fileno)(FILE *stream);
+double (floor)(double x);
+double (fmod)(double x, double y);
+FILE *(fopen)(const char *filename, const char *mode);
+pid_t (fork)(void);
+long (fpathconf)(int fildes, int name);
+/* PRINTFLIKE2 */
+int (fprintf)(FILE *stream, const char *format, ...);
+int (fputc)(int c, FILE *stream);
+int (fputs)(const char *s, FILE *stream);
+size_t (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
+void (free)(void *ptr);
+FILE *(freopen)(const char *filename, const char *mode, FILE *stream);
+double (frepx)(double value, int *exp);
+/* SCANFLIKE2 */
+int (fscanf)(FILE *stream, const char *format, ...);
+int (fseek)(FILE *stream, long int offset, int whence);
+int (fsetpos)(FILE *stream, const fpos_t *pos);
+int (fstat)(int fildes, struct stat *buf);
+long (ftell)(FILE *stream);
+size_t (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
+int (getc)(FILE *stream);
+int (getchar)(void);
+char *(getcwd)(char *buf, size_t size);
+gid_t (getegid)(void);
+char *(getenv)(const char *name);
+uid_t (geteuid)(void);
+gid_t (getgid)(void);
+struct group *(getgrgid)(gid_t gid);
+struct group *(getgrnam)(const char *name);
+int (getgroups)(int gidsetsize, gid_t grouplist[]);
+char *(getlogin)(void);
+pid_t (getpgrp)(void);
+pid_t (getpid)(void);
+pid_t (getppid)(void);
+struct passwd *(getpwnam)(const char *name);
+struct passwd *(getpwuid)(uid_t uid);
+char *(gets)(char *s);
+uid_t (getuid)(void);
+struct tm *(gmtime)(const time_t *timer);
+int (isalnum)(int c);
+int (isalpha)(int c);
+int (isatty)(int fildes);
+int (iscntrl)(int c);
+int (isdigit)(int c);
+int (isgraph)(int c);
+int (islower)(int c);
+int (isprint)(int c);
+int (ispunct)(int c);
+int (isspace)(int c);
+int (isupper)(int c);
+int (isxdigit)(int c);
+int (kill)(pid_t pid, int sig);
+long (labs)(long j);
+double (ldexp)(double x, int exp);
+ldiv_t (ldiv)(long numer, long denom);
+int (link)(const char *existing, const char *new);
+struct lconv *(localeconv)(void);
+struct tm *(localtime)(const time_t *timer);
+double (log)(double x);
+double (log10)(double x);
+void (longjmp)(jmp_buf env, int val);
+off_t (lseek)(int fildes, off_t offset, int whence);
+void *(malloc)(size_t size);
+int (mblen)(const char *s, size_t n);
+size_t (mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
+int (mbtowc)(wchar_t *pwc, const char *s, size_t n);
+void *(memchr)(const void *s, int c, size_t n);
+int (memcmp)(const void *s1, const void *s2, size_t n);
+void *(memcpy)(void *s1, const void *s2, size_t n);
+void *(memmove)(void *s1, const void *s2, size_t n);
+void *(memset)(void *s, int c, size_t n);
+int (mkdir)(const char *path, mode_t mode);
+int (mkfifo)(const char *path, mode_t mode);
+time_t (mktime)(struct tm *timeptr);
+double (modf)(double value, double *iptr);
+int (open)(const char *path, int oflag, ...);
+DIR *(opendir)(const char *dirname);
+long (pathconf)(const char *path, int name);
+int (pause)(void);
+void (perror)(const char *s);
+int (pipe)(int fildes[2]);
+double (pow)(double x, double y);
+/* PRINTFLIKE1 */
+int (printf)(const char *format, ...);
+int (putc)(int c, FILE *stream);
+int (putchar)(int c);
+int (puts)(const char *s);
+void (qsort)(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+int (raise)(int sig);
+int (rand)(void);
+ssize_t (read)(int fildes, void *buf, size_t nbyte);
+struct dirent *(readdir)(DIR *dirp);
+void *(realloc)(void *ptr, size_t size);
+int (remove)(const char *filename);
+int (rename)(const char *old, const char *new);
+void (rewind)(FILE *stream);
+void (rewinddir)(DIR *dirp);
+int (rmdir)(const char *path);
+/* SCANFLIKE1 */
+int (scanf)(const char *format, ...);
+void (setbuf)(FILE *stream, char *buf);
+int (setgid)(gid_t gid);
+int (setjmp)(jmp_buf env);
+char *(setlocale)(int category, const char *locale);
+int (setpgid)(pid_t pid, pid_t pgid);
+pid_t (setsid)(void);
+int (setuid)(uid_t uid);
+int (setvbuf)(FILE *stream, char *buf, int mode, size_t size);
+int (sigaction)(int sig, const struct sigaction *act,
+ struct sigaction *oact);
+int (sigaddset)(sigset_t *set, int signo);
+int (sigdelset)(sigset_t *set, int signo);
+int (sigemptyset)(sigset_t *set);
+int (sigfillset)(sigset_t *set);
+int (sigismember)(const sigset_t *set, int signo);
+void (siglongjmp)(sigjmp_buf env, int val);
+void (*(signal)(int sig, void (*func)(int)))(int);
+int (sigpending)(sigset_t *set);
+int (sigprocmask)(int how, const sigset_t *set, sigset_t *oset);
+int (sigsetjmp)(sigjmp_buf env, int savemask);
+int (sigsuspend)(const sigset_t *sigmask);
+double (sin)(double x);
+double (sinh)(double x);
+unsigned (sleep)(unsigned seconds);
+/* PRINTFLIKE2 */
+int (sprintf)(char *s, const char *format, ...);
+double (sqrt)(double x);
+void (srand)(unsigned seed);
+/* SCANFLIKE2 */
+int (sscanf)(const char *s, const char *format, ...);
+int (stat)(const char *path, struct stat *buf);
+char *(strcat)(char *s1, const char *s2);
+char *(strchr)(const char *s, int c);
+int (strcmp)(const char *s1, const char *s2);
+int (strcoll)(const char *s1, const char *s2);
+char *(strcpy)(char *s1, const char *s2);
+size_t (strcspn)(const char *s1, const char *s2);
+char *(strerror)(int errnum);
+size_t (strftime)(char *s, size_t maxsize, const char *format,
+ const struct tm *timeptr);
+size_t (strlen)(const char *s);
+char *(strncat)(char *s1, const char *s2, size_t n);
+int (strncmp)(const char *s1, const char *s2, size_t n);
+char *(strncpy)(char *s1, const char *s2, size_t n);
+char *(strpbrk)(const char *s1, const char *s2);
+char *(strrchr)(const char *s, int c);
+size_t (strspn)(const char *s1, const char *s2);
+char *(strstr)(const char *s1, const char *s2);
+double (strtod)(const char *nptr, char **endptr);
+char *(strtok)(char *s1, const char *s2);
+long (strtol)(const char *nptr, char **endptr, int base);
+unsigned long (strtoul)(const char *nptr, char **endptr, int base);
+size_t (strxfrm)(char *s1, const char *s2, size_t n);
+long (sysconf)(int name);
+int (system)(const char *string);
+double (tan)(double x);
+double (tanh)(double x);
+int (tcdrain)(int fildes);
+int (tcflow)(int fildes, int action);
+int (tcflush)(int fildes, int queue_selector);
+int (tcgetattr)(int fildes, struct termios *tp);
+pid_t (tcgetpgrp)(int fildes);
+int (tcsendbreak)(int fildes, int duration);
+int (tcsetattr)(int fildes, int options, const struct termios *tp);
+int (tcsetpgrp)(int fildes, pid_t pgrpid);
+time_t (time)(time_t *timer);
+clock_t (times)(struct tms *buffer);
+FILE *(tmpfile)(void);
+char *(tmpnam)(char *s);
+int (tolower)(int c);
+int (toupper)(int c);
+char *(ttyname)(int filedes);
+void (tzset)(void);
+mode_t (umask)(mode_t cmask);
+int (uname)(struct utsname *name);
+int (ungetc)(int c, FILE *stream);
+int (unlink)(const char *path);
+int (utime)(const char *path, const struct utimbuf *times);
+int (vfprintf)(FILE *stream, const char *format, va_list arg);
+int (vprintf)(const char *format, va_list arg);
+int (vsprintf)(char *s, const char *format, va_list arg);
+pid_t (wait)(int *statloc);
+pid_t (waitpid)(pid_t pid, int *stat_loc, int options);
+size_t (wcstombs)(char *s, const wchar_t *pwcs, size_t n);
+int (wctomb)(char *s, wchar_t wchar);
+ssize_t (write)(int fildes, const void *buf, size_t nbyte);
diff --git a/usr.bin/xlint/llib/llib-lstdc b/usr.bin/xlint/llib/llib-lstdc
new file mode 100644
index 0000000..83b44f2
--- /dev/null
+++ b/usr.bin/xlint/llib/llib-lstdc
@@ -0,0 +1,254 @@
+/* $NetBSD: llib-lstdc,v 1.2 1995/07/03 21:25:11 cgd 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.
+ *
+ * $FreeBSD$
+ */
+
+/* LINTLIBRARY */
+
+#define _ANSI_SOURCE
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* PROTOLIB1 */
+
+/*
+ * assert.h
+ */
+#ifdef __NetBSD__
+void (__assert)(const char *expression, int line, const char *file);
+#else
+void (assert)(int expression);
+#endif
+
+/*
+ * ctype.h
+ */
+int (isalnum)(int c);
+int (isalpha)(int c);
+int (iscntrl)(int c);
+int (isdigit)(int c);
+int (isgraph)(int c);
+int (islower)(int c);
+int (isprint)(int c);
+int (ispunct)(int c);
+int (isspace)(int c);
+int (isupper)(int c);
+int (isxdigit)(int c);
+int (tolower)(int c);
+int (toupper)(int c);
+
+/*
+ * errno.h
+ */
+int (errno);
+
+/*
+ * locale.h
+ */
+char *(setlocale)(int category, const char *locale);
+struct lconv *(localeconv)(void);
+
+/*
+ * math.h
+ */
+double (acos)(double x);
+double (asin)(double x);
+double (atan)(double x);
+double (atan2)(double y, double x);
+double (cos)(double x);
+double (sin)(double x);
+double (tan)(double x);
+double (cosh)(double x);
+double (sinh)(double x);
+double (tanh)(double x);
+double (exp)(double x);
+double (frexp)(double value, int *exp);
+double (ldexp)(double x, int exp);
+double (log)(double x);
+double (log10)(double x);
+double (modf)(double value, double *iptr);
+double (pow)(double x, double y);
+double (sqrt)(double x);
+double (ceil)(double x);
+double (fabs)(double x);
+double (floor)(double x);
+double (fmod)(double x, double y);
+
+/*
+ * setjmp.h
+ */
+int (setjmp)(jmp_buf env);
+void (longjmp)(jmp_buf env, int val);
+
+/*
+ * signal.h
+ */
+void (*(signal)(int sig, void (*func)(int)))(int);
+int (raise)(int sig);
+
+/*
+ * stdio.h
+ */
+int (remove)(const char *filename);
+int (rename)(const char *old, const char *new);
+FILE *(tmpfile)(void);
+char *(tmpnam)(char *s);
+int (fclose)(FILE *stream);
+int (fflush)(FILE *stream);
+FILE *(fopen)(const char *filename, const char *mode);
+FILE *(freopen)(const char *filename, const char *mode, FILE *stream);
+void (setbuf)(FILE *stream, char *buf);
+int (setvbuf)(FILE *stream, char *buf, int mode, size_t size);
+/* PRINTFLIKE2 */
+int (fprintf)(FILE *stream, const char *format, ...);
+/* SCANFLIKE2 */
+int (fscanf)(FILE *stream, const char *format, ...);
+/* PRINTFLIKE1 */
+int (printf)(const char *format, ...);
+/* SCANFLIKE1 */
+int (scanf)(const char *format, ...);
+/* PRINTFLIKE2 */
+int (sprintf)(char *s, const char *format, ...);
+/* SCANFLIKE2 */
+int (sscanf)(const char *s, const char *format, ...);
+int (vfprintf)(FILE *stream, const char *format, va_list arg);
+int (vprintf)(const char *format, va_list arg);
+int (vsprintf)(char *s, const char *format, va_list arg);
+int (fgetc)(FILE *stream);
+char *(fgets)(char *s, int n, FILE *stream);
+int (fputc)(int c, FILE *stream);
+int (fputs)(const char *s, FILE *stream);
+int (getc)(FILE *stream);
+int (getchar)(void);
+char *(gets)(char *s);
+int (putc)(int c, FILE *stream);
+int (putchar)(int c);
+int (puts)(const char *s);
+int (ungetc)(int c, FILE *stream);
+size_t (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
+size_t (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
+int (fgetpos)(FILE *stream, fpos_t *pos);
+int (fseek)(FILE *stream, long offset, int whence);
+int (fsetpos)(FILE *stream, const fpos_t *pos);
+long (ftell)(FILE *stream);
+void (rewind)(FILE *stream);
+void (clearerr)(FILE *stream);
+int (feof)(FILE *stream);
+int (ferror)(FILE *stream);
+void (perror)(const char *s);
+
+/*
+ * stdlib.h
+ */
+double (atof)(const char *nptr);
+int (atoi)(const char *nptr);
+long (atol)(const char *nptr);
+double (strtod)(const char *nptr, char **endptr);
+long (strtol)(const char *nptr, char **endptr, int base);
+unsigned long (strtoul)(const char *nptr, char **endptr, int base);
+int (rand)(void);
+void (srand)(unsigned seed);
+void *(calloc)(size_t nmemb, size_t size);
+void (free)(void *ptr);
+void *(malloc)(size_t size);
+void *(realloc)(void *ptr, size_t size);
+void (abort)(void);
+int (atexit)(void (*func)(void));
+void (exit)(int status);
+char *(getenv)(const char *name);
+int (system)(const char *string);
+void *(bsearch)(const void *key, const void *base, size_t nmemb,
+ size_t size, int (*compar)(const void *, const void *));
+void (qsort)(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+int (abs)(int j);
+div_t (div)(int numer, int denom);
+long (labs)(long j);
+ldiv_t (ldiv)(long numer, long denom);
+int (mblen)(const char *s, size_t n);
+int (mbtowc)(wchar_t *PWC, const char *s, size_t n);
+int (wctomb)(char *s, wchar_t wchar);
+size_t (mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
+size_t (wcstombs)(char *s, const wchar_t *pwcs, size_t n);
+
+/*
+ * string.h
+ */
+void *(memcpy)(void *s1, const void *s2, size_t n);
+void *(memmove)(void *s1, const void *s2, size_t n);
+char *(strcpy)(char *s1, const char *s2);
+char *(strncpy)(char *s1, const char *s2, size_t n);
+char *(strcat)(char *s1, const char *s2);
+char *(strncat)(char *s1, const char *s2, size_t n);
+int (memcmp)(const void *s1, const void *s2, size_t n);
+int (strcmp)(const char *s1, const char *s2);
+int (strcoll)(const char *s1, const char *s2);
+int (strncmp)(const char *s1, const char *s2, size_t n);
+size_t (strxfrm)(char *s1, const char *s2, size_t n);
+void *(memchr)(const void *s, int c, size_t n);
+char *(strchr)(const char *s, int c);
+size_t (strcspn)(const char *s1, const char *s2);
+char *(strpbrk)(const char *s1, const char *s2);
+char *(strrchr)(const char *s1, int c);
+size_t (strspn)(const char *s1, const char *s2);
+char *(strstr)(const char *s1, const char *s2);
+char *(strtok)(char *s1, const char *s2);
+void *(memset)(void *s, int c, size_t n);
+char *(strerror)(int errnom);
+size_t (strlen)(const char *s);
+
+/*
+ * time.h
+ */
+clock_t (clock)(void);
+double (difftime)(time_t time1, time_t time2);
+time_t (mktime)(struct tm *timeptr);
+time_t (time)(time_t *timer);
+char *(asctime)(const struct tm *timeptr);
+char *(ctime)(const time_t *timer);
+struct tm *(gmtime)(const time_t *timer);
+struct tm *(localtime)(const time_t *timer);
+size_t (strftime)(char *s, size_t maxsize, const char *format,
+ const struct tm *timeptr);
diff --git a/usr.bin/xlint/xlint/Makefile b/usr.bin/xlint/xlint/Makefile
new file mode 100644
index 0000000..5dfdfb3
--- /dev/null
+++ b/usr.bin/xlint/xlint/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.2 1995/07/03 21:25:14 cgd Exp $
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../lint1
+
+PROG= xlint
+PROGNAME= lint
+SRCS= xlint.c mem.c
+MAN= lint.1
+
+CFLAGS+=-I${.CURDIR}/../lint1
+CFLAGS+= -DPREFIX=\"${TOOLS_PREFIX}\"
+
+.include "${.CURDIR}/../../Makefile.inc"
+.include <bsd.prog.mk>
diff --git a/usr.bin/xlint/xlint/Makefile.depend b/usr.bin/xlint/xlint/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/xlint/xlint/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/xlint/xlint/lint.1 b/usr.bin/xlint/xlint/lint.1
new file mode 100644
index 0000000..30731d2
--- /dev/null
+++ b/usr.bin/xlint/xlint/lint.1
@@ -0,0 +1,627 @@
+.\" $NetBSD: lint.1,v 1.29 2004/01/26 21:59:42 wiz Exp $
+.\"
+.\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd Mar 23, 2015
+.Dt LINT 1
+.Os
+.Sh NAME
+.Nm lint
+.Nd a C program verifier
+.Sh SYNOPSIS
+.Bk -words
+.Nm
+.Op Fl abceghprvwxzHFV
+.Op Fl s | t
+.Op Fl i | nu
+.Op Fl D Ar name Ns Op = Ns Ar def
+.Op Fl U Ar name
+.Op Fl I Ar directory
+.Op Fl d Ar directory
+.Op Fl L Ar directory
+.Op Fl MD
+.Op Fl l Ar library
+.Op Fl o Ar outputfile
+.Op Fl B Ar directory
+.Op Fl X Ar id Ns Op , Ns Ar id ...
+.Ar
+.Nm
+.Op Fl abceghprvwzHFV
+.Op Fl s | t
+.Fl C Ar library
+.Op Fl D Ar name Ns Op = Ns Ar def
+.Op Fl U Ar name
+.Op Fl I Ar directory
+.Op Fl d Ar directory
+.Op Fl B Ar directory
+.Op Fl X Ar id Ns Op , Ns Ar id ...
+.Ar
+.Ek
+.Sh DESCRIPTION
+The
+.Nm
+utility attempts to detect features of the named C program files
+that are likely to be bugs, to be non-portable, or to be
+wasteful.
+It also performs stricter type checking than does
+the C compiler.
+The
+.Nm
+utility runs the C preprocessor as its first phase, with the
+preprocessor symbol
+.Dq Dv lint
+defined to allow certain questionable code to be altered
+or skipped by
+.Nm .
+Therefore, this symbol should be thought of as a reserved
+word for all code that is to be checked by
+.Nm .
+.Pp
+Among the possible problems that are currently noted are
+unreachable statements, loops not entered at the top,
+variables declared and not used, and logical expressions
+with constant values.
+Function calls are checked for
+inconsistencies, such as calls to functions that return
+values in some places and not in others, functions called
+with varying numbers of arguments, function calls that
+pass arguments of a type other than the type the function
+expects to receive, functions whose values are not used,
+and calls to functions not returning values that use
+the non-existent return value of the function.
+.Pp
+Filename arguments ending with
+.Pa .c
+are taken to be C source files.
+Filename arguments with
+names ending with
+.Pa .ln
+are taken to be the result of an earlier invocation of
+.Nm ,
+with either the
+.Fl i , o ,
+or
+.Fl C
+option in effect.
+The
+.Pa .ln
+files are analogous to the
+.Pa .o
+(object) files produced by
+.Xr cc 1
+from
+.Pa .c
+files.
+The
+.Nm
+utility also accepts special libraries specified with the
+.Fl l
+option, which contain definitions of library routines and
+variables.
+.Pp
+The
+.Nm
+utility takes all the
+.Pa .c , .ln ,
+and
+.Pa llib-l Ns Ar library Ns Pa .ln
+(lint library) files and processes them in command-line order.
+By default,
+.Nm
+appends the standard C lint library
+.Pq Pa llib-lc.ln
+to the end of the list of files.
+When the
+.Fl i
+option is used, the
+.Pa .ln
+files are ignored.
+Also, when the
+.Fl o
+or
+.Fl i
+options are used, the
+.Pa llib-l Ns Ar library Ns Pa .ln
+files are ignored.
+When the
+.Fl i
+option is
+.Em omitted
+the second pass of
+.Nm
+checks this list of files for mutual compatibility.
+At this point,
+if a complaint stems not from a given source file, but from one of
+its included files, the source filename will be printed followed by
+a question mark.
+.Pp
+The special input file name
+.Dq Pa -
+causes
+.Nm
+to take input from standard input (until end of file) and process
+it as if it were a
+.Pa .c
+file.
+If the
+.Fl i
+flag is given and
+.Dq Pa -
+is named as one of the input files, the
+.Fl o
+flag must also be specified to provide an output file name.
+The options are as follows:
+.Bl -tag -width indent
+.It Fl a
+Report assignments of
+.Vt long
+values to variables that are not
+.Vt long .
+.It Fl aa
+Additional to
+.Fl a ,
+report
+.Em all
+assignments of integer values to other integer values which
+cause implicit narrowing conversion.
+.It Fl b
+Report
+.Ic break
+statements that cannot be reached.
+This is not the default
+because, unfortunately, most
+.Xr lex 1
+and many
+.Xr yacc 1
+outputs produce many such complaints.
+.It Fl c
+Complain about casts which have questionable portability.
+.It Fl e
+Complain about unusual operations on
+.Vt enum Ns -Types
+and combinations of
+.Vt enum Ns -
+and
+.Sy integer Ns -Types .
+.It Fl g
+Do not print warnings for some extensions of
+.Xr gcc 1
+to the C language.
+Currently these are nonconstant initializers in
+automatic aggregate initializations, arithmetic on pointer to void,
+trailing commas in
+.Vt enum
+declarations, C++ -style
+.Dq Li //
+comments,
+zero sized structures, subscripting of non-lvalue arrays, prototypes
+overriding old style function declarations and long long
+integer types.
+The
+.Fl g
+flag also turns on the keywords
+.Ic asm
+and
+.Ic inline
+(alternative keywords with leading underscores for both
+.Ic asm
+and
+.Ic inline
+are always available).
+.It Fl h
+Apply a number of heuristic tests to attempt to intuit
+bugs, improve style, and reduce waste.
+.It Fl i
+Produce a
+.Pa .ln
+file for every
+.Pa .c
+file on the command line.
+These
+.Pa .ln
+files are the product of
+.Nm Ns 's
+first pass only, and are not checked for compatibility
+between functions.
+.It Fl n
+Do not check compatibility against the standard library.
+.It Fl p
+Attempt to check portability of code to other dialects of C.
+.It Fl r
+In case of redeclarations report the position of the
+previous declaration.
+.It Fl s
+Strict ANSI C mode.
+Issue warnings and errors required by ANSI C.
+Also do not produce warnings for constructs which behave
+differently in traditional C and ANSI C.
+With the
+.Fl s
+flag,
+.Dv __STRICT_ANSI__
+is a predefined preprocessor macro.
+.It Fl S
+C9X mode. Currently not fully implemented.
+.It Fl t
+Traditional C mode.
+.Dv __STDC__
+is not predefined in this mode.
+Warnings are printed for constructs
+not allowed in traditional C.
+Warnings for constructs which behave
+differently in traditional C and ANSI C are suppressed.
+Preprocessor
+macros describing the machine type (e.g.,
+.Dv sun3 )
+and machine architecture (e.g.,
+.Dv m68k )
+are defined without leading and trailing underscores.
+The keywords
+.Ic const , volatile
+and
+.Ic signed
+are not available in traditional C mode (although the alternative
+keywords with leading underscores still are).
+.It Fl u
+Do not complain about functions and external variables used
+and not defined, or defined and not used (this is suitable
+for running
+.Nm
+on a subset of files comprising part of a larger program).
+.It Fl v
+Suppress complaints about unused arguments in functions.
+.It Fl x
+Report variables referred to by
+.Ic extern
+declarations, but never used.
+.It Fl z
+Do not complain about structures that are never defined
+(for example, using a structure pointer without knowing
+its contents).
+.It Fl B Ar path
+Path to use when looking for the
+.Pa lint1
+and
+.Pa lint2
+binaries.
+Defaults to
+.Pa /usr/libexec .
+.It Fl C Ar library
+Create a
+.Nm
+library with the name
+.Pa llib-l Ns Ar library Ns Pa .ln .
+This library is built from all
+.Pa .c
+and
+.Pa .ln
+input files.
+After all global definitions of functions and
+variables in these files are written to the newly created library,
+.Nm
+checks all input files, including libraries specified with the
+.Fl l
+option, for mutual compatibility.
+.It Fl D Ar name Ns Op = Ns Ar def
+Define
+.Ar name
+for
+.Xr cpp 1 ,
+as if by a
+.Ic #define
+directive.
+If no definition is given,
+.Ar name
+is defined as 1.
+.It Fl I Ar directory
+Add
+.Ar directory
+to the list of directories in which to search for include files.
+.It Fl d Ar directory
+Use
+.Ar directory
+instead of
+.Pa /usr/include
+as the default place to find include files.
+.It Fl l Ar library
+Include the lint library
+.Pa llib-l Ns Ar library Ns Pa .ln .
+.It Fl L Ar directory
+Search for lint libraries in
+.Ar directory
+and
+.Ar directory Ns Pa /lint
+before searching the standard place.
+.It Fl F
+Print pathnames of files.
+The
+.Nm
+utility normally prints the filename without the path.
+.It Fl H
+If a complaint stems from an included file
+.Nm
+prints the name of the included file instead of the source file name
+followed by a question mark.
+.It Fl MD
+Pass
+.Fl MD
+to
+.Xr cpp 1
+causing cpp to create files containing dependency information for
+each source file.
+.It Fl o Ar outputfile
+Name the output file
+.Ar outputfile .
+The output file produced is the input that is given to
+.Nm Ns 's
+second pass.
+The
+.Fl o
+option simply saves this file in the named output file.
+If the
+.Fl i
+option is also used the files are not checked for compatibility.
+To produce a
+.Pa llib-l Ns Ar library Ns Pa .ln
+without extraneous messages, use of the
+.Fl u
+option is suggested.
+The
+.Fl v
+option is useful if the source file(s) for the lint library
+are just external interfaces.
+.It Fl U Ar name
+Remove any initial definition of
+.Ar name
+for the preprocessor.
+.It Fl V
+Print the command lines constructed by the controller program to
+run the C preprocessor and
+.Nm Ns 's
+first and second pass.
+.It Fl w
+Treat warnings as errors.
+.It Fl X Ar id Ns Op , Ns Ar id ...
+Suppress error messages identified by the list of ids.
+A list of messages
+and ids can be found in
+.Xr lint 7 .
+.El
+.Ss Input Grammar
+.Nm Ns 's
+first pass reads standard C source files.
+The
+.Nm
+utility recognizes the following C comments as commands.
+.Bl -tag -width indent
+.It Li /* ARGSUSED Ns Ar n Li */
+Makes
+.Nm
+check only the first
+.Ar n
+arguments for usage; a missing
+.Ar n
+is taken to be 0 (this option acts like the
+.Fl v
+option for the next function).
+.It Li /* BITFIELDTYPE */
+Suppress error messages about illegal bitfield types if the type
+is an integer type, and suppress non-portable bitfield type warnings.
+.It Xo
+.Li /* CONSTCOND */
+or
+.Li /* CONSTANTCOND */
+or
+.Li /* CONSTANTCONDITION */
+.Xc
+suppress complaints about constant operands for the next expression.
+.It Xo
+.Li /* FALLTHRU */
+or
+.Li /* FALLTHROUGH */
+.Xc
+suppress complaints about fall through to a
+.Ic case
+or
+.Ic default
+labelled statement.
+This directive should be placed immediately
+preceding the label.
+.It Li /* LINTLIBRARY */
+At the beginning of a file, mark all functions and variables defined
+in this file as
+.Em used .
+Also shut off complaints about unused function arguments.
+.It Xo
+.Li /* LINTED Oo Ar comment Oc Li */
+or
+.Li /* NOSTRICT Oo Ar comment Oc Li */
+.Xc
+Suppresses any intra-file warning except those dealing with
+unused variables or functions.
+This directive should be placed
+on the line immediately preceding where the
+.Nm
+warning occurred.
+.It Li /* LONGLONG */
+Suppress complaints about use of long long integer types.
+.It Li /* NOTREACHED */
+At appropriate points, inhibit complaints about unreachable code.
+(This comment is typically placed just after calls to functions
+like
+.Xr exit 3 ) .
+.It Li /* PRINTFLIKE Ns Ar n Li */
+makes
+.Nm
+check the first
+.Pq Ar n Ns -1
+arguments as usual.
+The
+.Ar n Ns -th
+argument is interpreted as a
+.Xr printf 3
+format string that is used to check the remaining arguments.
+.It Li /* PROTOLIB Ns Ar n Li */
+causes
+.Nm
+to treat function declaration prototypes as function definitions
+if
+.Ar n
+is non-zero.
+This directive can only be used in conjunction with
+the
+.Li /* LINTLIBRARY */
+directive.
+If
+.Ar n
+is zero, function prototypes will be treated normally.
+.It Li /* SCANFLIKE Ns Ar n Li */
+makes
+.Nm
+check the first
+.Pq Ar n Ns -1
+arguments as usual.
+The
+.Ar n Ns -th
+argument is interpreted as a
+.Xr scanf 3
+format string that is used to check the remaining arguments.
+.It Li /* VARARGS Ns Ar n Li */
+Suppress the usual checking for variable numbers of arguments in
+the following function declaration.
+The data types of the first
+.Ar n
+arguments are checked; a missing
+.Ar n
+is taken to be 0.
+.El
+.Pp
+The behavior of the
+.Fl i
+and the
+.Fl o
+options allows for incremental use of
+.Nm
+on a set of C source files.
+Generally, one invokes
+.Nm
+once for each source file with the
+.Fl i
+option.
+Each of these invocations produces a
+.Pa .ln
+file that corresponds to the
+.Pa .c
+file, and prints all messages that are about just that
+source file.
+After all the source files have been separately
+run through
+.Nm ,
+it is invoked once more (without the
+.Fl i
+option), listing all the
+.Pa .ln
+files with the needed
+.Fl l Ar library
+options.
+This will print all the inter-file inconsistencies.
+This
+scheme works well with
+.Xr make 1 ;
+it allows
+.Xr make 1
+to be used to
+.Nm
+only the source files that have been modified since the last
+time the set of source files were
+.Nm Ns ed .
+.Sh ENVIRONMENT
+.Bl -tag -width LIBDIR
+.It Ev LIBDIR
+the directory where the lint libraries specified by the
+.Bk -words
+.Fl l Ar library
+.Ek
+option must exist.
+If this environment variable is undefined,
+then the default path
+.Pa /usr/libdata/lint
+will be used to search for the libraries.
+.It Ev TMPDIR
+usually the path for temporary files can be redefined by setting
+this environment variable.
+.It Ev CC
+Location of the C compiler program.
+Defaults to
+.Pa /usr/bin/cc .
+.El
+.Sh FILES
+.Bl -tag -width /usr/libdata/lint/llib-lc.ln -compact
+.It Pa /usr/libexec/lint Ns Bq Pa 12
+programs
+.It Pa /usr/libdata/lint/llib-l*.ln
+various prebuilt lint libraries
+.It Pa /tmp/lint*
+temporaries
+.El
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr cpp 1 ,
+.Xr make 1
+.Sh AUTHORS
+.An Jochen Pohl
+.Sh BUGS
+.Bl -item
+.It
+The routines
+.Xr exit 3 ,
+.Xr longjmp 3
+and other functions that do not return are not understood; this
+causes various incorrect diagnostics.
+.It
+Static functions which are used only before their first
+extern declaration are reported as unused.
+.It
+Libraries created by the
+.Fl o
+option will, when used in later
+.Nm
+runs, cause certain errors that were reported when the libraries
+were created to be reported again, and cause line numbers and file
+names from the original source used to create those libraries
+to be reported in error messages.
+For these reasons, it is recommended
+to use the
+.Fl C
+option to create lint libraries.
+.El
diff --git a/usr.bin/xlint/xlint/pathnames.h b/usr.bin/xlint/xlint/pathnames.h
new file mode 100644
index 0000000..3f7d210
--- /dev/null
+++ b/usr.bin/xlint/xlint/pathnames.h
@@ -0,0 +1,45 @@
+/* $NetBSD: pathnames.h,v 1.3 1999/04/22 04:40:58 mrg 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.
+ *
+ * $FreeBSD$
+ */
+
+/* directory where lint1 and lint2 reside */
+#ifndef PATH_LIBEXEC
+#define PATH_LIBEXEC PREFIX"/usr/libexec"
+#endif
+
+/* directory where cc(1) resides */
+#define PATH_USRBIN PREFIX"/usr/bin"
+
+/* default library search path */
+#define PATH_LINTLIB PREFIX"/usr/libdata/lint"
diff --git a/usr.bin/xlint/xlint/xlint.c b/usr.bin/xlint/xlint/xlint.c
new file mode 100644
index 0000000..7c9994d
--- /dev/null
+++ b/usr.bin/xlint/xlint/xlint.c
@@ -0,0 +1,883 @@
+/* $NetBSD: xlint.c,v 1.36 2005/02/09 21:24:48 dsl Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: xlint.c,v 1.36 2005/02/09 21:24:48 dsl Exp $");
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "lint.h"
+#include "pathnames.h"
+
+#define DEFAULT_PATH _PATH_DEFPATH
+
+int main(int, char *[]);
+
+/* directory for temporary files */
+static const char *tmpdir;
+
+/* path name for cpp output */
+static char *cppout;
+
+/* file descriptor for cpp output */
+static int cppoutfd = -1;
+
+/* files created by 1st pass */
+static char **p1out;
+
+/* input files for 2nd pass (without libraries) */
+static char **p2in;
+
+/* library which will be created by 2nd pass */
+static char *p2out;
+
+/* flags always passed to cc(1) */
+static char **cflags;
+
+/* flags for cc(1), controlled by sflag/tflag */
+static char **lcflags;
+
+/* flags for lint1 */
+static char **l1flags;
+
+/* flags for lint2 */
+static char **l2flags;
+
+/* libraries for lint2 */
+static char **l2libs;
+
+/* default libraries */
+static char **deflibs;
+
+/* additional libraries */
+static char **libs;
+
+/* search path for libraries */
+static char **libsrchpath;
+
+static char *libexec_path;
+
+/* flags */
+static int iflag, oflag, Cflag, sflag, tflag, Fflag, dflag, Bflag, Sflag;
+
+/* print the commands executed to run the stages of compilation */
+static int Vflag;
+
+/* filename for oflag */
+static char *outputfn;
+
+/* reset after first .c source has been processed */
+static int first = 1;
+
+/*
+ * name of a file which is currently written by a child and should
+ * be removed after abnormal termination of the child
+ */
+static const char *currfn;
+
+#if !defined(TARGET_PREFIX)
+#define TARGET_PREFIX ""
+#endif
+static const char target_prefix[] = TARGET_PREFIX;
+
+static void appstrg(char ***, char *);
+static void appcstrg(char ***, const char *);
+static void applst(char ***, char *const *);
+static void freelst(char ***);
+static char *concat2(const char *, const char *);
+static char *concat3(const char *, const char *, const char *);
+static void terminate(int) __attribute__((__noreturn__));
+static const char *lbasename(const char *, int);
+static void appdef(char ***, const char *);
+static void usage(void) __dead2;
+static void fname(const char *);
+static void runchild(const char *, char *const *, const char *, int);
+static void findlibs(char *const *);
+static int rdok(const char *);
+static void lint2(void);
+static void cat(char *const *, const char *);
+
+/*
+ * Some functions to deal with lists of strings.
+ * Take care that we get no surprises in case of asynchronous signals.
+ */
+static void
+appstrg(char ***lstp, char *s)
+{
+ char **lst, **olst;
+ int i;
+
+ olst = *lstp;
+ for (i = 0; olst[i] != NULL; i++)
+ continue;
+ lst = xrealloc(olst, (i + 2) * sizeof (char *));
+ lst[i] = s;
+ lst[i + 1] = NULL;
+ *lstp = lst;
+}
+
+static void
+appcstrg(char ***lstp, const char *s)
+{
+
+ appstrg(lstp, xstrdup(s));
+}
+
+static void
+applst(char ***destp, char *const *src)
+{
+ int i, k;
+ char **dest, **odest;
+
+ odest = *destp;
+ for (i = 0; odest[i] != NULL; i++)
+ continue;
+ for (k = 0; src[k] != NULL; k++)
+ continue;
+ dest = xrealloc(odest, (i + k + 1) * sizeof (char *));
+ for (k = 0; src[k] != NULL; k++)
+ dest[i + k] = xstrdup(src[k]);
+ dest[i + k] = NULL;
+ *destp = dest;
+}
+
+static void
+freelst(char ***lstp)
+{
+ char *s;
+ int i;
+
+ for (i = 0; (*lstp)[i] != NULL; i++)
+ continue;
+ while (i-- > 0) {
+ s = (*lstp)[i];
+ (*lstp)[i] = NULL;
+ free(s);
+ }
+}
+
+static char *
+concat2(const char *s1, const char *s2)
+{
+ char *s;
+
+ s = xmalloc(strlen(s1) + strlen(s2) + 1);
+ (void)strcpy(s, s1);
+ (void)strcat(s, s2);
+
+ return (s);
+}
+
+static char *
+concat3(const char *s1, const char *s2, const char *s3)
+{
+ char *s;
+
+ s = xmalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1);
+ (void)strcpy(s, s1);
+ (void)strcat(s, s2);
+ (void)strcat(s, s3);
+
+ return (s);
+}
+
+/*
+ * Clean up after a signal.
+ */
+static void
+terminate(int signo)
+{
+ int i;
+
+ if (cppoutfd != -1)
+ (void)close(cppoutfd);
+ if (cppout != NULL)
+ (void)remove(cppout);
+
+ if (p1out != NULL) {
+ for (i = 0; p1out[i] != NULL; i++)
+ (void)remove(p1out[i]);
+ }
+
+ if (p2out != NULL)
+ (void)remove(p2out);
+
+ if (currfn != NULL)
+ (void)remove(currfn);
+
+ exit(signo != 0 ? 1 : 0);
+}
+
+/*
+ * Returns a pointer to the last component of strg after delim.
+ * Returns strg if the string does not contain delim.
+ */
+static const char *
+lbasename(const char *strg, int delim)
+{
+ const char *cp, *cp1, *cp2;
+
+ cp = cp1 = cp2 = strg;
+ while (*cp != '\0') {
+ if (*cp++ == delim) {
+ cp2 = cp1;
+ cp1 = cp;
+ }
+ }
+ return (*cp1 == '\0' ? cp2 : cp1);
+}
+
+static void
+appdef(char ***lstp, const char *def)
+{
+
+ appstrg(lstp, concat2("-D__", def));
+ appstrg(lstp, concat3("-D__", def, "__"));
+}
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+ "usage: lint [-abceghprvwxzHFS] [-s|-t] [-i|-nu] [-Dname[=def]]"
+ " [-Uname] [-X <id>[,<id>]...\n");
+ (void)fprintf(stderr,
+ "\t[-Idirectory] [-Ldirectory] [-llibrary] [-ooutputfile]"
+ " file...\n");
+ (void)fprintf(stderr,
+ " lint [-abceghprvwzHFS] [-s|-t] -Clibrary [-Dname[=def]]\n"
+ " [-X <id>[,<id>]...\n");
+ (void)fprintf(stderr, "\t[-Idirectory] [-Uname] [-Bpath] file"
+ " ...\n");
+ terminate(-1);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ char flgbuf[3], *s;
+ const char *tmp;
+ size_t len;
+
+ if ((tmp = getenv("TMPDIR")) == NULL || (len = strlen(tmp)) == 0) {
+ tmpdir = _PATH_TMP;
+ } else {
+ s = xmalloc(len + 2);
+ (void)sprintf(s, "%s%s", tmp, tmp[len - 1] == '/' ? "" : "/");
+ tmpdir = s;
+ }
+
+ cppout = xmalloc(strlen(tmpdir) + sizeof ("lint0.XXXXXX"));
+ (void)sprintf(cppout, "%slint0.XXXXXX", tmpdir);
+ cppoutfd = mkstemp(cppout);
+ if (cppoutfd == -1) {
+ warn("can't make temp");
+ terminate(-1);
+ }
+
+ p1out = xcalloc(1, sizeof (char *));
+ p2in = xcalloc(1, sizeof (char *));
+ cflags = xcalloc(1, sizeof (char *));
+ lcflags = xcalloc(1, sizeof (char *));
+ l1flags = xcalloc(1, sizeof (char *));
+ l2flags = xcalloc(1, sizeof (char *));
+ l2libs = xcalloc(1, sizeof (char *));
+ deflibs = xcalloc(1, sizeof (char *));
+ libs = xcalloc(1, sizeof (char *));
+ libsrchpath = xcalloc(1, sizeof (char *));
+
+ appcstrg(&cflags, "-E");
+ appcstrg(&cflags, "-x");
+ appcstrg(&cflags, "c");
+#if 0
+ appcstrg(&cflags, "-D__attribute__(x)=");
+ appcstrg(&cflags, "-D__extension__(x)=/*NOSTRICT*/0");
+#else
+ appcstrg(&cflags, "-U__GNUC__");
+ appcstrg(&cflags, "-undef");
+#endif
+#if 0
+ appcstrg(&cflags, "-Wp,-$");
+#endif
+ appcstrg(&cflags, "-Wp,-C");
+ appcstrg(&cflags, "-Wcomment");
+ appcstrg(&cflags, "-D__LINT__");
+ appcstrg(&cflags, "-Dlint"); /* XXX don't def. with -s */
+
+ appdef(&cflags, "lint");
+
+ appcstrg(&deflibs, "c");
+
+ if (signal(SIGHUP, terminate) == SIG_IGN)
+ (void)signal(SIGHUP, SIG_IGN);
+ (void)signal(SIGINT, terminate);
+ (void)signal(SIGQUIT, terminate);
+ (void)signal(SIGTERM, terminate);
+ while ((c = getopt(argc, argv, "abcd:eghil:no:prstuvwxzB:C:D:FHI:L:M:SU:VX:")) != -1) {
+ switch (c) {
+
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'e':
+ case 'g':
+ case 'r':
+ case 'v':
+ case 'w':
+ case 'z':
+ (void)sprintf(flgbuf, "-%c", c);
+ appcstrg(&l1flags, flgbuf);
+ break;
+
+ case 'F':
+ Fflag = 1;
+ /* FALLTHROUGH */
+ case 'u':
+ case 'h':
+ (void)sprintf(flgbuf, "-%c", c);
+ appcstrg(&l1flags, flgbuf);
+ appcstrg(&l2flags, flgbuf);
+ break;
+
+ case 'X':
+ (void)sprintf(flgbuf, "-%c", c);
+ appcstrg(&l1flags, flgbuf);
+ appcstrg(&l1flags, optarg);
+ break;
+
+ case 'i':
+ if (Cflag)
+ usage();
+ iflag = 1;
+ break;
+
+ case 'n':
+ freelst(&deflibs);
+ break;
+
+ case 'p':
+ appcstrg(&lcflags, "-Wtraditional");
+ appcstrg(&lcflags, "-Wno-system-headers");
+ appcstrg(&l1flags, "-p");
+ appcstrg(&l2flags, "-p");
+ if (*deflibs != NULL) {
+ freelst(&deflibs);
+ appcstrg(&deflibs, "c");
+ }
+ break;
+
+ case 's':
+ if (tflag)
+ usage();
+ freelst(&lcflags);
+ appcstrg(&lcflags, "-trigraphs");
+ appcstrg(&lcflags, "-Wtrigraphs");
+ appcstrg(&lcflags, "-pedantic");
+ appcstrg(&lcflags, "-D__STRICT_ANSI__");
+ appcstrg(&l1flags, "-s");
+ appcstrg(&l2flags, "-s");
+ sflag = 1;
+ break;
+
+ case 'S':
+ if (tflag)
+ usage();
+ appcstrg(&l1flags, "-S");
+ Sflag = 1;
+ break;
+
+#if !HAVE_CONFIG_H
+ case 't':
+ if (sflag)
+ usage();
+ freelst(&lcflags);
+ appcstrg(&lcflags, "-traditional");
+ appstrg(&lcflags, concat2("-D", MACHINE));
+ appstrg(&lcflags, concat2("-D", MACHINE_ARCH));
+ appcstrg(&l1flags, "-t");
+ appcstrg(&l2flags, "-t");
+ tflag = 1;
+ break;
+#endif
+
+ case 'x':
+ appcstrg(&l2flags, "-x");
+ break;
+
+ case 'C':
+ if (Cflag || oflag || iflag)
+ usage();
+ Cflag = 1;
+ appstrg(&l2flags, concat2("-C", optarg));
+ p2out = xmalloc(sizeof ("llib-l.ln") + strlen(optarg));
+ (void)sprintf(p2out, "llib-l%s.ln", optarg);
+ freelst(&deflibs);
+ break;
+
+ case 'd':
+ if (dflag)
+ usage();
+ dflag = 1;
+ appcstrg(&cflags, "-nostdinc");
+ appcstrg(&cflags, "-idirafter");
+ appcstrg(&cflags, optarg);
+ break;
+
+ case 'D':
+ case 'I':
+ case 'M':
+ case 'U':
+ (void)sprintf(flgbuf, "-%c", c);
+ appstrg(&cflags, concat2(flgbuf, optarg));
+ break;
+
+ case 'l':
+ appcstrg(&libs, optarg);
+ break;
+
+ case 'o':
+ if (Cflag || oflag)
+ usage();
+ oflag = 1;
+ outputfn = xstrdup(optarg);
+ break;
+
+ case 'L':
+ appcstrg(&libsrchpath, optarg);
+ break;
+
+ case 'H':
+ appcstrg(&l2flags, "-H");
+ break;
+
+ case 'B':
+ Bflag = 1;
+ libexec_path = xstrdup(optarg);
+ break;
+
+ case 'V':
+ Vflag = 1;
+ break;
+
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ /*
+ * To avoid modifying getopt(3)'s state engine midstream, we
+ * explicitly accept just a few options after the first source file.
+ *
+ * In particular, only -l<lib> and -L<libdir> (and these with a space
+ * after -l or -L) are allowed.
+ */
+ while (argc > 0) {
+ const char *arg = argv[0];
+
+ if (arg[0] == '-') {
+ char ***list;
+
+ /* option */
+ switch (arg[1]) {
+ case 'l':
+ list = &libs;
+ break;
+
+ case 'L':
+ list = &libsrchpath;
+ break;
+
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ if (arg[2])
+ appcstrg(list, arg + 2);
+ else if (argc > 1) {
+ argc--;
+ appcstrg(list, *++argv);
+ } else
+ usage();
+ } else {
+ /* filename */
+ fname(arg);
+ first = 0;
+ }
+ argc--;
+ argv++;
+ }
+
+ if (first)
+ usage();
+
+ if (iflag)
+ terminate(0);
+
+ if (!oflag) {
+ if ((tmp = getenv("LIBDIR")) == NULL || strlen(tmp) == 0)
+ tmp = PATH_LINTLIB;
+ appcstrg(&libsrchpath, tmp);
+ findlibs(libs);
+ findlibs(deflibs);
+ }
+
+ (void)printf("Lint pass2:\n");
+ lint2();
+
+ if (oflag)
+ cat(p2in, outputfn);
+
+ if (Cflag)
+ p2out = NULL;
+
+ terminate(0);
+ /* NOTREACHED */
+}
+
+/*
+ * Read a file name from the command line
+ * and pass it through lint1 if it is a C source.
+ */
+static void
+fname(const char *name)
+{
+ const char *bn, *suff;
+ char **args, *ofn, *p, *pathname;
+ size_t len;
+ int is_stdin;
+ int fd;
+
+ is_stdin = (strcmp(name, "-") == 0);
+ bn = lbasename(name, '/');
+ suff = lbasename(bn, '.');
+
+ if (strcmp(suff, "ln") == 0) {
+ /* only for lint2 */
+ if (!iflag)
+ appcstrg(&p2in, name);
+ return;
+ }
+
+ if (!is_stdin && strcmp(suff, "c") != 0 &&
+ (strncmp(bn, "llib-l", 6) != 0 || bn != suff)) {
+ warnx("unknown file type: %s\n", name);
+ return;
+ }
+
+ if (!iflag || !first)
+ (void)printf("%s:\n",
+ is_stdin ? "{standard input}" : Fflag ? name : bn);
+
+ /* build the name of the output file of lint1 */
+ if (oflag) {
+ ofn = outputfn;
+ outputfn = NULL;
+ oflag = 0;
+ } else if (iflag) {
+ if (is_stdin) {
+ warnx("-i not supported without -o for standard input");
+ return;
+ }
+ ofn = xmalloc(strlen(bn) + (bn == suff ? 4 : 2));
+ len = bn == suff ? strlen(bn) : (size_t)((suff - 1) - bn);
+ (void)sprintf(ofn, "%.*s", (int)len, bn);
+ (void)strcat(ofn, ".ln");
+ } else {
+ ofn = xmalloc(strlen(tmpdir) + sizeof ("lint1.XXXXXX"));
+ (void)sprintf(ofn, "%slint1.XXXXXX", tmpdir);
+ fd = mkstemp(ofn);
+ if (fd == -1) {
+ warn("can't make temp");
+ terminate(-1);
+ }
+ close(fd);
+ }
+ if (!iflag)
+ appcstrg(&p1out, ofn);
+
+ args = xcalloc(1, sizeof (char *));
+
+ /* run cc */
+
+ if (getenv("CC") == NULL) {
+ pathname = xmalloc(strlen(PATH_USRBIN) + sizeof ("/cc"));
+ (void)sprintf(pathname, "%s/cc", PATH_USRBIN);
+ appcstrg(&args, pathname);
+ } else {
+ pathname = strdup(getenv("CC"));
+ for (p = strtok(pathname, " \t"); p; p = strtok(NULL, " \t"))
+ appcstrg(&args, p);
+ }
+
+ applst(&args, cflags);
+ applst(&args, lcflags);
+ appcstrg(&args, name);
+
+ /* we reuse the same tmp file for cpp output, so rewind and truncate */
+ if (lseek(cppoutfd, (off_t)0, SEEK_SET) != 0) {
+ warn("lseek");
+ terminate(-1);
+ }
+ if (ftruncate(cppoutfd, (off_t)0) != 0) {
+ warn("ftruncate");
+ terminate(-1);
+ }
+
+ runchild(pathname, args, cppout, cppoutfd);
+ free(pathname);
+ freelst(&args);
+
+ /* run lint1 */
+
+ if (!Bflag) {
+ pathname = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint1") +
+ strlen(target_prefix));
+ (void)sprintf(pathname, "%s/%slint1", PATH_LIBEXEC,
+ target_prefix);
+ } else {
+ /*
+ * XXX Unclear whether we should be using target_prefix
+ * XXX here. --thorpej@wasabisystems.com
+ */
+ pathname = xmalloc(strlen(libexec_path) + sizeof ("/lint1"));
+ (void)sprintf(pathname, "%s/lint1", libexec_path);
+ }
+
+ appcstrg(&args, pathname);
+ applst(&args, l1flags);
+ appcstrg(&args, cppout);
+ appcstrg(&args, ofn);
+
+ runchild(pathname, args, ofn, -1);
+ free(pathname);
+ freelst(&args);
+
+ appcstrg(&p2in, ofn);
+ free(ofn);
+
+ free(args);
+}
+
+static void
+runchild(const char *path, char *const *args, const char *crfn, int fdout)
+{
+ int status, rv, signo, i;
+
+ if (Vflag) {
+ for (i = 0; args[i] != NULL; i++)
+ (void)printf("%s ", args[i]);
+ (void)printf("\n");
+ }
+
+ currfn = crfn;
+
+ (void)fflush(stdout);
+
+ switch (vfork()) {
+ case -1:
+ warn("cannot fork");
+ terminate(-1);
+ /* NOTREACHED */
+ default:
+ /* parent */
+ break;
+ case 0:
+ /* child */
+
+ /* setup the standard output if necessary */
+ if (fdout != -1) {
+ dup2(fdout, STDOUT_FILENO);
+ close(fdout);
+ }
+ (void)execvp(path, args);
+ warn("cannot exec %s", path);
+ _exit(1);
+ /* NOTREACHED */
+ }
+
+ while ((rv = wait(&status)) == -1 && errno == EINTR) ;
+ if (rv == -1) {
+ warn("wait");
+ terminate(-1);
+ }
+ if (WIFSIGNALED(status)) {
+ signo = WTERMSIG(status);
+#if HAVE_DECL_SYS_SIGNAME
+ warnx("%s got SIG%s", path, sys_signame[signo]);
+#else
+ warnx("%s got signal %d", path, signo);
+#endif
+ terminate(-1);
+ }
+ if (WEXITSTATUS(status) != 0)
+ terminate(-1);
+ currfn = NULL;
+}
+
+static void
+findlibs(char *const *liblst)
+{
+ int i, k;
+ const char *lib, *path;
+ char *lfn;
+ size_t len;
+
+ lfn = NULL;
+
+ for (i = 0; (lib = liblst[i]) != NULL; i++) {
+ for (k = 0; (path = libsrchpath[k]) != NULL; k++) {
+ len = strlen(path) + strlen(lib);
+ lfn = xrealloc(lfn, len + sizeof ("/llib-l.ln"));
+ (void)sprintf(lfn, "%s/llib-l%s.ln", path, lib);
+ if (rdok(lfn))
+ break;
+ lfn = xrealloc(lfn, len + sizeof ("/lint/llib-l.ln"));
+ (void)sprintf(lfn, "%s/lint/llib-l%s.ln", path, lib);
+ if (rdok(lfn))
+ break;
+ }
+ if (path != NULL) {
+ appstrg(&l2libs, concat2("-l", lfn));
+ } else {
+ warnx("cannot find llib-l%s.ln", lib);
+ }
+ }
+
+ free(lfn);
+}
+
+static int
+rdok(const char *path)
+{
+ struct stat sbuf;
+
+ if (stat(path, &sbuf) == -1)
+ return (0);
+ if (!S_ISREG(sbuf.st_mode))
+ return (0);
+ if (access(path, R_OK) == -1)
+ return (0);
+ return (1);
+}
+
+static void
+lint2(void)
+{
+ char *path, **args;
+
+ args = xcalloc(1, sizeof (char *));
+
+ if (!Bflag) {
+ path = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint2") +
+ strlen(target_prefix));
+ (void)sprintf(path, "%s/%slint2", PATH_LIBEXEC,
+ target_prefix);
+ } else {
+ /*
+ * XXX Unclear whether we should be using target_prefix
+ * XXX here. --thorpej@wasabisystems.com
+ */
+ path = xmalloc(strlen(libexec_path) + sizeof ("/lint2"));
+ (void)sprintf(path, "%s/lint2", libexec_path);
+ }
+
+ appcstrg(&args, path);
+ applst(&args, l2flags);
+ applst(&args, l2libs);
+ applst(&args, p2in);
+
+ runchild(path, args, p2out, -1);
+ free(path);
+ freelst(&args);
+ free(args);
+}
+
+static void
+cat(char *const *srcs, const char *dest)
+{
+ int ifd, ofd, i;
+ char *src, *buf;
+ ssize_t rlen;
+
+ if ((ofd = open(dest, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
+ warn("cannot open %s", dest);
+ terminate(-1);
+ }
+
+ buf = xmalloc(MBLKSIZ);
+
+ for (i = 0; (src = srcs[i]) != NULL; i++) {
+ if ((ifd = open(src, O_RDONLY)) == -1) {
+ free(buf);
+ warn("cannot open %s", src);
+ terminate(-1);
+ }
+ do {
+ if ((rlen = read(ifd, buf, MBLKSIZ)) == -1) {
+ free(buf);
+ warn("read error on %s", src);
+ terminate(-1);
+ }
+ if (write(ofd, buf, (size_t)rlen) == -1) {
+ free(buf);
+ warn("write error on %s", dest);
+ terminate(-1);
+ }
+ } while (rlen == MBLKSIZ);
+ (void)close(ifd);
+ }
+ (void)close(ofd);
+ free(buf);
+}
diff --git a/usr.bin/xo/Makefile b/usr.bin/xo/Makefile
new file mode 100644
index 0000000..6159169
--- /dev/null
+++ b/usr.bin/xo/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+LIBXOSRC= ${SRCTOP}/contrib/libxo
+
+.PATH: ${LIBXOSRC}/xo
+
+PROG= xo
+MAN= xo.1
+
+# XXX For xoversion.h
+CFLAGS+=-I${LIBXOSRC}/libxo
+
+# XXX For xo_config.h
+CFLAGS+=-I${SRCTOP}/lib/libxo
+
+LIBADD= xo util
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xo/Makefile.depend b/usr.bin/xo/Makefile.depend
new file mode 100644
index 0000000..137678c
--- /dev/null
+++ b/usr.bin/xo/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+ lib/libxo \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xo/tests/Makefile b/usr.bin/xo/tests/Makefile
new file mode 100644
index 0000000..182e834
--- /dev/null
+++ b/usr.bin/xo/tests/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+.include <bsd.own.mk>
+
+LIBXOSRC= ${SRCTOP}/contrib/libxo
+
+.PATH: ${LIBXOSRC}/tests/xo ${LIBXOSRC}/tests/xo/saved
+
+.c.out .o.out:
+
+BINDIR= ${TESTSDIR}
+
+ATF_TESTS_SH+= functional_test
+
+${PACKAGE}FILES+= xo_01.H.err
+${PACKAGE}FILES+= xo_01.H.out
+${PACKAGE}FILES+= xo_01.HIPx.err
+${PACKAGE}FILES+= xo_01.HIPx.out
+${PACKAGE}FILES+= xo_01.HP.err
+${PACKAGE}FILES+= xo_01.HP.out
+${PACKAGE}FILES+= xo_01.J.err
+${PACKAGE}FILES+= xo_01.J.out
+${PACKAGE}FILES+= xo_01.JP.err
+${PACKAGE}FILES+= xo_01.JP.out
+${PACKAGE}FILES+= xo_01.T.err
+${PACKAGE}FILES+= xo_01.T.out
+${PACKAGE}FILES+= xo_01.X.err
+${PACKAGE}FILES+= xo_01.X.out
+${PACKAGE}FILES+= xo_01.XP.err
+${PACKAGE}FILES+= xo_01.XP.out
+
+SCRIPTS+= xo_01
+CLEANFILES+= xo_01
+
+LIBADD+= xo
+
+.include <bsd.test.mk>
+
+.SUFFIXES: .sh
diff --git a/usr.bin/xo/tests/Makefile.depend b/usr.bin/xo/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/xo/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xo/tests/functional_test.sh b/usr.bin/xo/tests/functional_test.sh
new file mode 100755
index 0000000..2a26faa
--- /dev/null
+++ b/usr.bin/xo/tests/functional_test.sh
@@ -0,0 +1,72 @@
+#
+# Copyright 2015 EMC Corp.
+# 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.
+#
+# 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$
+
+SRCDIR=$(atf_get_srcdir)
+
+check()
+{
+ local tc=${1}; shift
+ local xo_fmt=${1}; shift
+
+ XO=$(atf_config_get usr.bin.xo.test_xo /usr/bin/xo)
+
+ local err_file="${SRCDIR}/${tc}${xo_fmt:+.${xo_fmt}}.err"
+ [ -s "${err_file}" ] && err_flag="-e file:${err_file}"
+ local out_file="${SRCDIR}/${tc}${xo_fmt:+.${xo_fmt}}.out"
+ [ -s "${out_file}" ] && out_flag="-o file:${out_file}"
+
+ atf_check -s exit:0 -e file:${err_file} -o file:${out_file} \
+ env LC_ALL=en_US.UTF-8 \
+ LIBXO_OPTIONS=":W${xo_fmt}" TZ="EST" "${SRCDIR}/${tc}" \
+ ${XO}
+}
+
+add_testcase()
+{
+ local tc=${1}
+ local tc_escaped
+
+ oldIFS=$IFS
+ IFS='.'
+ set -- $tc
+ tc_script=${1}
+ [ $# -eq 3 ] && xo_fmt=${2} # Don't set xo_fmt to `out'
+ IFS=$oldIFS
+ tc_escaped="${tc_script}${xo_fmt:+__${xo_fmt}}"
+
+ atf_test_case ${tc_escaped}
+ eval "${tc_escaped}_body() { check ${tc_script} ${xo_fmt}; }"
+ atf_add_test_case ${tc_escaped}
+}
+
+atf_init_test_cases()
+{
+ for path in $(find -Es "${SRCDIR}" -name '*.out'); do
+ add_testcase ${path##*/}
+ done
+}
diff --git a/usr.bin/xstr/Makefile b/usr.bin/xstr/Makefile
new file mode 100644
index 0000000..620a3ba
--- /dev/null
+++ b/usr.bin/xstr/Makefile
@@ -0,0 +1,5 @@
+# @(#)Makefile 8.1 (Berkeley) 6/9/93
+
+PROG= xstr
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xstr/Makefile.depend b/usr.bin/xstr/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/xstr/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/xstr/pathnames.h b/usr.bin/xstr/pathnames.h
new file mode 100644
index 0000000..63f633e
--- /dev/null
+++ b/usr.bin/xstr/pathnames.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1989, 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.
+ *
+ * $FreeBSD$
+ *
+ * @(#)pathnames.h 8.1 (Berkeley) 6/9/93
+ */
+
+#define _PATH_TMP "/tmp/xstrXXXXXX"
diff --git a/usr.bin/xstr/xstr.1 b/usr.bin/xstr/xstr.1
new file mode 100644
index 0000000..d21f7fb
--- /dev/null
+++ b/usr.bin/xstr/xstr.1
@@ -0,0 +1,163 @@
+.\" Copyright (c) 1980, 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.
+.\"
+.\" @(#)xstr.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd December 30, 1993
+.Dt XSTR 1
+.Os
+.Sh NAME
+.Nm xstr
+.Nd "extract strings from C programs to implement shared strings"
+.Sh SYNOPSIS
+.Nm
+.Op Fl cv
+.Op Fl
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility maintains a file
+.Pa strings
+into which strings in component parts of a large program are hashed.
+These strings are replaced with references to this common area.
+This serves to implement shared constant strings, most useful if they
+are also read-only.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl
+Read from the standard input.
+.It Fl c
+Extract the strings from the C source
+.Ar file
+or the standard input
+.Pq Fl ,
+replacing
+string references by expressions of the form
+.Li (&xstr[number])
+for some
+.Ar number .
+An appropriate declaration of
+.Va xstr
+is prepended to the file.
+The resulting C text is placed in the file
+.Pa x.c ,
+to then be compiled.
+The strings from this file are placed in the
+.Pa strings
+data base if they are not there already.
+Repeated strings and strings which are suffixes of existing strings
+do not cause changes to the data base.
+.It Fl v
+Verbose mode.
+.El
+.Pp
+After all components of a large program have been compiled a file
+.Pa xs.c
+declaring the common
+.Va xstr
+space can be created by a command of the form
+.Pp
+.Dl xstr
+.Pp
+The file
+.Pa xs.c
+should then be compiled and loaded with the rest
+of the program.
+If possible, the array can be made read-only (shared) saving
+space and swap overhead.
+.Pp
+The
+.Nm
+utility can also be used on a single file.
+A command
+.Bd -literal -offset indent
+xstr name
+.Ed
+.Pp
+creates files
+.Pa x.c
+and
+.Pa xs.c
+as before, without using or affecting any
+.Pa strings
+file in the same directory.
+.Pp
+It may be useful to run
+.Nm
+after the C preprocessor if any macro definitions yield strings
+or if there is conditional code which contains strings
+which may not, in fact, be needed.
+An appropriate command sequence for running
+.Nm
+after the C preprocessor is:
+.Pp
+.Bd -literal -offset indent -compact
+cc -E name.c | xstr -c -
+cc -c x.c
+mv x.o name.o
+.Ed
+.Pp
+The
+.Nm
+utility does not touch the file
+.Pa strings
+unless new items are added, thus
+.Xr make 1
+can avoid remaking
+.Pa xs.o
+unless truly necessary.
+.Sh FILES
+.Bl -tag -width ".Pa /tmp/xs*" -compact
+.It Pa strings
+data base of strings
+.It Pa x.c
+massaged C source
+.It Pa xs.c
+C source for definition of array
+.Va xstr
+.It Pa /tmp/xs*
+temporary file when
+.Dq Li "xstr name"
+does not touch
+.Pa strings
+.El
+.Sh SEE ALSO
+.Xr mkstr 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
+.Sh BUGS
+If a string is a suffix of another string in the data base,
+but the shorter string is seen first by
+.Nm
+both strings will be placed in the data base, when just
+placing the longer one there will do.
diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c
new file mode 100644
index 0000000..4aad8e6
--- /dev/null
+++ b/usr.bin/xstr/xstr.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright (c) 1980, 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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#ifndef lint
+static const char sccsid[] = "@(#)xstr.c 8.1 (Berkeley) 6/9/93";
+#endif
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+
+/*
+ * xstr - extract and hash strings in a C program
+ *
+ * Bill Joy UCB
+ * November, 1978
+ */
+
+#define ignore(a) ((void) a)
+
+static off_t tellpt;
+
+static off_t mesgpt;
+static char cstrings[] = "strings";
+static char *strings = cstrings;
+
+static int cflg;
+static int vflg;
+static int readstd;
+
+static char lastchr(char *);
+
+static int fgetNUL(char *, int, FILE *);
+static int istail(char *, char *);
+static int octdigit(char);
+static int xgetc(FILE *);
+
+static off_t hashit(char *, int);
+static off_t yankstr(char **);
+
+static void usage(void);
+
+static void flushsh(void);
+static void found(int, off_t, char *);
+static void inithash(void);
+static void onintr(int);
+static void process(const char *);
+static void prstr(char *);
+static void xsdotc(void);
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ int fdesc;
+
+ while ((c = getopt(argc, argv, "-cv")) != -1)
+ switch (c) {
+ case '-':
+ readstd++;
+ break;
+ case 'c':
+ cflg++;
+ break;
+ case 'v':
+ vflg++;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (signal(SIGINT, SIG_IGN) == SIG_DFL)
+ signal(SIGINT, onintr);
+ if (cflg || (argc == 0 && !readstd))
+ inithash();
+ else {
+ strings = strdup(_PATH_TMP);
+ if (strings == NULL)
+ err(1, "strdup() failed");
+ fdesc = mkstemp(strings);
+ if (fdesc == -1)
+ err(1, "Unable to create temporary file");
+ close(fdesc);
+ }
+
+ while (readstd || argc > 0) {
+ if (freopen("x.c", "w", stdout) == NULL)
+ err(1, "x.c");
+ if (!readstd && freopen(argv[0], "r", stdin) == NULL)
+ err(2, "%s", argv[0]);
+ process("x.c");
+ if (readstd == 0)
+ argc--, argv++;
+ else
+ readstd = 0;
+ }
+ flushsh();
+ if (cflg == 0)
+ xsdotc();
+ if (strings[0] == '/')
+ ignore(unlink(strings));
+ exit(0);
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: xstr [-cv] [-] [file ...]\n");
+ exit (1);
+}
+
+static char linebuf[BUFSIZ];
+
+static void
+process(const char *name)
+{
+ char *cp;
+ int c;
+ int incomm = 0;
+ int ret;
+
+ printf("extern char\txstr[];\n");
+ for (;;) {
+ if (fgets(linebuf, sizeof linebuf, stdin) == NULL) {
+ if (ferror(stdin))
+ err(3, "%s", name);
+ break;
+ }
+ if (linebuf[0] == '#') {
+ if (linebuf[1] == ' ' && isdigit(linebuf[2]))
+ printf("#line%s", &linebuf[1]);
+ else
+ printf("%s", linebuf);
+ continue;
+ }
+ for (cp = linebuf; (c = *cp++);) switch (c) {
+
+ case '"':
+ if (incomm)
+ goto def;
+ if ((ret = (int) yankstr(&cp)) == -1)
+ goto out;
+ printf("(&xstr[%d])", ret);
+ break;
+
+ case '\'':
+ if (incomm)
+ goto def;
+ putchar(c);
+ if (*cp)
+ putchar(*cp++);
+ break;
+
+ case '/':
+ if (incomm || *cp != '*')
+ goto def;
+ incomm = 1;
+ cp++;
+ printf("/*");
+ continue;
+
+ case '*':
+ if (incomm && *cp == '/') {
+ incomm = 0;
+ cp++;
+ printf("*/");
+ continue;
+ }
+ goto def;
+
+def:
+ default:
+ putchar(c);
+ break;
+ }
+ }
+out:
+ if (ferror(stdout))
+ warn("x.c"), onintr(0);
+}
+
+static off_t
+yankstr(char **cpp)
+{
+ char *cp = *cpp;
+ int c, ch;
+ char dbuf[BUFSIZ];
+ char *dp = dbuf;
+ char *tp;
+ static char tmp[] = "b\bt\tr\rn\nf\f\\\\\"\"";
+
+ while ((c = *cp++)) {
+ if (dp == dbuf + sizeof(dbuf) - 3)
+ errx(1, "message too long");
+ switch (c) {
+
+ case '"':
+ cp++;
+ goto out;
+
+ case '\\':
+ c = *cp++;
+ if (c == 0)
+ break;
+ if (c == '\n') {
+ if (fgets(linebuf, sizeof linebuf, stdin)
+ == NULL) {
+ if (ferror(stdin))
+ err(3, "x.c");
+ return(-1);
+ }
+ cp = linebuf;
+ continue;
+ }
+ for (tp = tmp; (ch = *tp++); tp++)
+ if (c == ch) {
+ c = *tp;
+ goto gotc;
+ }
+ if (!octdigit(c)) {
+ *dp++ = '\\';
+ break;
+ }
+ c -= '0';
+ if (!octdigit(*cp))
+ break;
+ c <<= 3, c += *cp++ - '0';
+ if (!octdigit(*cp))
+ break;
+ c <<= 3, c += *cp++ - '0';
+ break;
+ }
+gotc:
+ *dp++ = c;
+ }
+out:
+ *cpp = --cp;
+ *dp = 0;
+ return (hashit(dbuf, 1));
+}
+
+static int
+octdigit(char c)
+{
+ return (isdigit(c) && c != '8' && c != '9');
+}
+
+static void
+inithash(void)
+{
+ char buf[BUFSIZ];
+ FILE *mesgread = fopen(strings, "r");
+
+ if (mesgread == NULL)
+ return;
+ for (;;) {
+ mesgpt = tellpt;
+ if (fgetNUL(buf, sizeof buf, mesgread) == 0)
+ break;
+ ignore(hashit(buf, 0));
+ }
+ ignore(fclose(mesgread));
+}
+
+static int
+fgetNUL(char *obuf, int rmdr, FILE *file)
+{
+ int c;
+ char *buf = obuf;
+
+ while (--rmdr > 0 && (c = xgetc(file)) != 0 && c != EOF)
+ *buf++ = c;
+ *buf++ = 0;
+ return ((feof(file) || ferror(file)) ? 0 : 1);
+}
+
+static int
+xgetc(FILE *file)
+{
+
+ tellpt++;
+ return (getc(file));
+}
+
+#define BUCKETS 128
+
+static struct hash {
+ off_t hpt;
+ char *hstr;
+ struct hash *hnext;
+ short hnew;
+} bucket[BUCKETS];
+
+static off_t
+hashit(char *str, int new)
+{
+ int i;
+ struct hash *hp, *hp0;
+
+ hp = hp0 = &bucket[lastchr(str) & 0177];
+ while (hp->hnext) {
+ hp = hp->hnext;
+ i = istail(str, hp->hstr);
+ if (i >= 0)
+ return (hp->hpt + i);
+ }
+ if ((hp = (struct hash *) calloc(1, sizeof (*hp))) == NULL)
+ errx(8, "calloc");
+ hp->hpt = mesgpt;
+ if (!(hp->hstr = strdup(str)))
+ err(1, NULL);
+ mesgpt += strlen(hp->hstr) + 1;
+ hp->hnext = hp0->hnext;
+ hp->hnew = new;
+ hp0->hnext = hp;
+ return (hp->hpt);
+}
+
+static void
+flushsh(void)
+{
+ int i;
+ struct hash *hp;
+ FILE *mesgwrit;
+ int old = 0, new = 0;
+
+ for (i = 0; i < BUCKETS; i++)
+ for (hp = bucket[i].hnext; hp != NULL; hp = hp->hnext)
+ if (hp->hnew)
+ new++;
+ else
+ old++;
+ if (new == 0 && old != 0)
+ return;
+ mesgwrit = fopen(strings, old ? "r+" : "w");
+ if (mesgwrit == NULL)
+ err(4, "%s", strings);
+ for (i = 0; i < BUCKETS; i++)
+ for (hp = bucket[i].hnext; hp != NULL; hp = hp->hnext) {
+ found(hp->hnew, hp->hpt, hp->hstr);
+ if (hp->hnew) {
+ fseek(mesgwrit, hp->hpt, 0);
+ ignore(fwrite(hp->hstr, strlen(hp->hstr) + 1, 1, mesgwrit));
+ if (ferror(mesgwrit))
+ err(4, "%s", strings);
+ }
+ }
+ if (fclose(mesgwrit) == EOF)
+ err(4, "%s", strings);
+}
+
+static void
+found(int new, off_t off, char *str)
+{
+ if (vflg == 0)
+ return;
+ if (!new)
+ fprintf(stderr, "found at %d:", (int) off);
+ else
+ fprintf(stderr, "new at %d:", (int) off);
+ prstr(str);
+ fprintf(stderr, "\n");
+}
+
+static void
+prstr(char *cp)
+{
+ int c;
+
+ while ((c = (*cp++ & 0377)))
+ if (c < ' ')
+ fprintf(stderr, "^%c", c + '`');
+ else if (c == 0177)
+ fprintf(stderr, "^?");
+ else if (c > 0200)
+ fprintf(stderr, "\\%03o", c);
+ else
+ fprintf(stderr, "%c", c);
+}
+
+static void
+xsdotc(void)
+{
+ FILE *strf = fopen(strings, "r");
+ FILE *xdotcf;
+
+ if (strf == NULL)
+ err(5, "%s", strings);
+ xdotcf = fopen("xs.c", "w");
+ if (xdotcf == NULL)
+ err(6, "xs.c");
+ fprintf(xdotcf, "char\txstr[] = {\n");
+ for (;;) {
+ int i, c;
+
+ for (i = 0; i < 8; i++) {
+ c = getc(strf);
+ if (ferror(strf)) {
+ warn("%s", strings);
+ onintr(0);
+ }
+ if (feof(strf)) {
+ fprintf(xdotcf, "\n");
+ goto out;
+ }
+ fprintf(xdotcf, "0x%02x,", c);
+ }
+ fprintf(xdotcf, "\n");
+ }
+out:
+ fprintf(xdotcf, "};\n");
+ ignore(fclose(xdotcf));
+ ignore(fclose(strf));
+}
+
+static char
+lastchr(char *cp)
+{
+
+ while (cp[0] && cp[1])
+ cp++;
+ return (*cp);
+}
+
+static int
+istail(char *str, char *of)
+{
+ int d = strlen(of) - strlen(str);
+
+ if (d < 0 || strcmp(&of[d], str) != 0)
+ return (-1);
+ return (d);
+}
+
+static void
+onintr(int dummy __unused)
+{
+
+ ignore(signal(SIGINT, SIG_IGN));
+ if (strings[0] == '/')
+ ignore(unlink(strings));
+ ignore(unlink("x.c"));
+ ignore(unlink("xs.c"));
+ exit(7);
+}
diff --git a/usr.bin/xz/Makefile b/usr.bin/xz/Makefile
new file mode 100644
index 0000000..7894174
--- /dev/null
+++ b/usr.bin/xz/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+PROG= xz
+
+LINKS= ${BINDIR}/xz ${BINDIR}/unxz
+LINKS+= ${BINDIR}/xz ${BINDIR}/lzma
+LINKS+= ${BINDIR}/xz ${BINDIR}/unlzma
+LINKS+= ${BINDIR}/xz ${BINDIR}/xzcat
+LINKS+= ${BINDIR}/xz ${BINDIR}/lzcat
+
+MLINKS= xz.1 unxz.1 xz.1 lzma.1 xz.1 unlzma.1 xz.1 xzcat.1 xz.1 lzcat.1
+
+XZDIR= ${.CURDIR}/../../contrib/xz/src
+LZMALIBDIR= ${.CURDIR}/../../lib/liblzma
+
+.PATH: ${XZDIR}/xz
+
+SRCS= args.c \
+ coder.c \
+ file_io.c \
+ hardware.c \
+ list.c \
+ main.c \
+ message.c \
+ mytime.c \
+ options.c \
+ signals.c \
+ suffix.c \
+ util.c
+
+.PATH: ${XZDIR}/common
+
+SRCS+= tuklib_open_stdxxx.c \
+ tuklib_progname.c \
+ tuklib_exit.c \
+ tuklib_cpucores.c \
+ tuklib_mbstr_width.c \
+ tuklib_mbstr_fw.c
+
+WARNS?= 3
+
+CFLAGS+= -DHAVE_CONFIG_H \
+ -I${LZMALIBDIR} \
+ -I${XZDIR}/common
+
+LIBADD= lzma
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xz/Makefile.depend b/usr.bin/xz/Makefile.depend
new file mode 100644
index 0000000..987c487
--- /dev/null
+++ b/usr.bin/xz/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libthr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/xzdec/Makefile b/usr.bin/xzdec/Makefile
new file mode 100644
index 0000000..f78a16c
--- /dev/null
+++ b/usr.bin/xzdec/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+PROG= xzdec
+
+LINKS= ${BINDIR}/xzdec ${BINDIR}/lzdec
+
+MLINKS= xzdec.1 lzmadec.1
+
+XZDIR= ${.CURDIR}/../../contrib/xz/src
+LZMALIBDIR= ${.CURDIR}/../../lib/liblzma
+
+.PATH: ${XZDIR}/xzdec
+
+SRCS= xzdec.c
+
+.PATH: ${XZDIR}/common
+
+SRCS+= tuklib_progname.c \
+ tuklib_exit.c
+
+CFLAGS+= -DHAVE_CONFIG_H \
+ -I${LZMALIBDIR} \
+ -I${XZDIR}/common
+
+LIBADD= lzma
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/xzdec/Makefile.depend b/usr.bin/xzdec/Makefile.depend
new file mode 100644
index 0000000..987c487
--- /dev/null
+++ b/usr.bin/xzdec/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/liblzma \
+ lib/libthr \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/yacc/Makefile b/usr.bin/yacc/Makefile
new file mode 100644
index 0000000..c110f3f
--- /dev/null
+++ b/usr.bin/yacc/Makefile
@@ -0,0 +1,28 @@
+# @(#)Makefile 5.3 (Berkeley) 5/12/90
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+BYACC_SRC= ${.CURDIR}/../../contrib/byacc
+.PATH: ${BYACC_SRC}
+
+PROG= yacc
+SRCS= closure.c error.c graph.c lalr.c lr0.c main.c mkpar.c mstring.c output.c \
+ reader.c yaccpar.c symtab.c verbose.c warshall.c
+
+CFLAGS+= -DHAVE_FCNTL_H=1 \
+ -DHAVE_MKSTEMP=1 \
+ -DMAXTABLE=INT_MAX \
+ -DMIXEDCASE_FILENAMES=1
+
+YYPATCH!= cat ${BYACC_SRC}/VERSION
+CFLAGS+= -DYYPATCH=${YYPATCH}
+
+LINKS= ${BINDIR}/yacc ${BINDIR}/byacc
+MLINKS= yacc.1 byacc.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/yacc/Makefile.depend b/usr.bin/yacc/Makefile.depend
new file mode 100644
index 0000000..3646e2e
--- /dev/null
+++ b/usr.bin/yacc/Makefile.depend
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+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/yacc/tests/Makefile b/usr.bin/yacc/tests/Makefile
new file mode 100644
index 0000000..52e2a27
--- /dev/null
+++ b/usr.bin/yacc/tests/Makefile
@@ -0,0 +1,334 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TEST_DIR= ${SRCTOP}/contrib/byacc/test
+
+.PATH: ${TEST_DIR} ${TEST_DIR}/yacc
+
+PLAIN_TESTS_SH= yacc_tests
+# NOTE: due to caveats with how permissions are handled on FreeBSD
+# with root, this must be run as a non-privileged user; otherwise
+# the testcases will fail unexpectedly.
+TEST_METADATA.yacc_tests+= required_user="unprivileged"
+
+SCRIPTS= run_test
+SCRIPTSDIR= ${TESTSDIR}
+
+CLEANFILES= run_test
+
+FILESGROUPS+= FILEStest FILEStest_yacc
+FILEStestPACKAGE=${PACKAGE}
+FILEStest_yaccPACKAGE=${PACKAGE}
+
+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
+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
+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
+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/Makefile.depend b/usr.bin/yacc/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/yacc/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/yacc/tests/yacc_tests.sh b/usr.bin/yacc/tests/yacc_tests.sh
new file mode 100755
index 0000000..6ad6916
--- /dev/null
+++ b/usr.bin/yacc/tests/yacc_tests.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# $FreeBSD$
+
+set -e
+
+# Setup the environment for run_test
+# - run_test looks for `#define YYBTYACC` in ../config.h
+# - run_test assumes a yacc binary exists in ../yacc instead of running "yacc"
+# - run_test spams the test dir with files (polluting subsequent test runs),
+# so it's better to copy all the files to a temporary directory created by
+# kyua
+echo > "./config.h"
+mkdir "test"
+cp -Rf "$(dirname "$0")"/* "test"
+cp -p /usr/bin/yacc ./yacc
+
+cd "test" && ./run_test
diff --git a/usr.bin/yes/Makefile b/usr.bin/yes/Makefile
new file mode 100644
index 0000000..e3e98da
--- /dev/null
+++ b/usr.bin/yes/Makefile
@@ -0,0 +1,6 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= yes
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/yes/Makefile.depend b/usr.bin/yes/Makefile.depend
new file mode 100644
index 0000000..9cb890b
--- /dev/null
+++ b/usr.bin/yes/Makefile.depend
@@ -0,0 +1,17 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ 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/yes/yes.1 b/usr.bin/yes/yes.1
new file mode 100644
index 0000000..07795b2
--- /dev/null
+++ b/usr.bin/yes/yes.1
@@ -0,0 +1,55 @@
+.\" Copyright (c) 1980, 1991, 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.
+.\"
+.\" @(#)yes.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.Dd June 4, 2014
+.Dt YES 1
+.Os
+.Sh NAME
+.Nm yes
+.Nd be repetitively affirmative
+.Sh SYNOPSIS
+.Nm
+.Op Ar expletive
+.Sh DESCRIPTION
+The
+.Nm
+utility outputs
+.Ar expletive ,
+or, by default,
+.Dq y ,
+forever.
+.Sh SEE ALSO
+.Xr jot 1 ,
+.Xr seq 1
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.At v7 .
diff --git a/usr.bin/yes/yes.c b/usr.bin/yes/yes.c
new file mode 100644
index 0000000..ef98b4d
--- /dev/null
+++ b/usr.bin/yes/yes.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 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) 1987, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)yes.c 8.1 (Berkeley) 6/6/93";
+#else
+static const char rcsid[] = "$FreeBSD$";
+#endif
+#endif /* not lint */
+
+#include <err.h>
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+ if (argc > 1)
+ while (puts(argv[1]) != EOF)
+ ;
+ else
+ while (puts("y") != EOF)
+ ;
+ err(1, "stdout");
+ /*NOTREACHED*/
+}
diff --git a/usr.bin/ypcat/Makefile b/usr.bin/ypcat/Makefile
new file mode 100644
index 0000000..782fdcc
--- /dev/null
+++ b/usr.bin/ypcat/Makefile
@@ -0,0 +1,8 @@
+# from: @(#)Makefile 5.8 (Berkeley) 7/28/90
+# $FreeBSD$
+
+PROG= ypcat
+
+WARNS?= 3
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ypcat/Makefile.depend b/usr.bin/ypcat/Makefile.depend
new file mode 100644
index 0000000..ddd5dbd
--- /dev/null
+++ b/usr.bin/ypcat/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ 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/ypcat/ypcat.1 b/usr.bin/ypcat/ypcat.1
new file mode 100644
index 0000000..4b156a3
--- /dev/null
+++ b/usr.bin/ypcat/ypcat.1
@@ -0,0 +1,74 @@
+.\" Copyright (c) 1993 Winning Strategies, 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Winning Strategies, Inc.
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 3, 2015
+.Dt YPCAT 1
+.Os
+.Sh NAME
+.Nm ypcat
+.Nd print the values of all keys in a NIS database
+.Sh SYNOPSIS
+.Nm
+.Op Fl kt
+.Op Fl d Ar domainname
+.Ar mapname
+.Nm
+.Fl x
+.Sh DESCRIPTION
+The
+.Nm
+utility prints out the values of all keys from the
+.Tn NIS
+database specified by
+.Ar mapname ,
+which may be a map name or a map nickname.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar domainname
+Specify a domain other than the default domain.
+.It Fl k
+Display map keys.
+This option is useful with maps in which the values are null or the key
+is not part of the value.
+.It Fl t
+Inhibit translation of map nicknames
+to their corresponding map names.
+.It Fl x
+Display the map nickname table.
+.El
+.Sh SEE ALSO
+.Xr domainname 1 ,
+.Xr ypmatch 1 ,
+.Xr yp 8 ,
+.Xr ypbind 8 ,
+.Xr ypset 8
+.Sh AUTHORS
+.An Theo De Raadt Aq Mt deraadt@theos.com .
diff --git a/usr.bin/ypcat/ypcat.c b/usr.bin/ypcat/ypcat.c
new file mode 100644
index 0000000..b729e36
--- /dev/null
+++ b/usr.bin/ypcat/ypcat.c
@@ -0,0 +1,142 @@
+/* $OpenBSD: ypcat.c,v 1.16 2015/02/08 23:40:35 deraadt Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com>
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <rpc/rpc.h>
+#include <rpc/xdr.h>
+#include <rpcsvc/yp.h>
+#include <rpcsvc/ypclnt.h>
+
+static const struct ypalias {
+ char *alias, *name;
+} ypaliases[] = {
+ { "passwd", "passwd.byname" },
+ { "master.passwd", "master.passwd.byname" },
+ { "shadow", "shadow.byname" },
+ { "group", "group.byname" },
+ { "networks", "networks.byaddr" },
+ { "hosts", "hosts.byaddr" },
+ { "protocols", "protocols.bynumber" },
+ { "services", "services.byname" },
+ { "aliases", "mail.aliases" },
+ { "ethers", "ethers.byname" },
+};
+
+static int key;
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+ "usage: ypcat [-kt] [-d domainname] mapname",
+ " ypcat -x");
+ exit(1);
+}
+
+static int
+printit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen,
+ void *indata)
+{
+ if (instatus != YP_TRUE)
+ return (instatus);
+ if (key)
+ printf("%*.*s ", inkeylen, inkeylen, inkey);
+ printf("%*.*s\n", invallen, invallen, inval);
+ return (0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *domain = NULL, *inmap;
+ struct ypall_callback ypcb;
+ int c, notrans, r;
+ u_int i;
+
+ notrans = key = 0;
+ while ((c = getopt(argc, argv, "xd:kt")) != -1)
+ switch (c) {
+ case 'x':
+ for (i = 0; i < nitems(ypaliases); i++)
+ printf("Use \"%s\" for \"%s\"\n",
+ ypaliases[i].alias, ypaliases[i].name);
+ exit(0);
+ case 'd':
+ domain = optarg;
+ break;
+ case 't':
+ notrans = 1;
+ break;
+ case 'k':
+ key = 1;
+ break;
+ default:
+ usage();
+ }
+
+ if (optind + 1 != argc)
+ usage();
+
+ if (domain == NULL)
+ yp_get_default_domain(&domain);
+
+ inmap = argv[optind];
+ if (notrans == 0) {
+ for (i = 0; i < nitems(ypaliases); i++)
+ if (strcmp(inmap, ypaliases[i].alias) == 0)
+ inmap = ypaliases[i].name;
+ }
+ ypcb.foreach = printit;
+ ypcb.data = NULL;
+
+ r = yp_all(domain, inmap, &ypcb);
+ switch (r) {
+ case 0:
+ break;
+ case YPERR_YPBIND:
+ errx(1, "not running ypbind");
+ default:
+ errx(1, "no such map %s. Reason: %s",
+ inmap, yperr_string(r));
+ }
+ exit(0);
+}
diff --git a/usr.bin/ypmatch/Makefile b/usr.bin/ypmatch/Makefile
new file mode 100644
index 0000000..d4a5b95
--- /dev/null
+++ b/usr.bin/ypmatch/Makefile
@@ -0,0 +1,8 @@
+# from: @(#)Makefile 5.8 (Berkeley) 7/28/90
+# $FreeBSD$
+
+PROG= ypmatch
+
+WARNS?= 3
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ypmatch/Makefile.depend b/usr.bin/ypmatch/Makefile.depend
new file mode 100644
index 0000000..ddd5dbd
--- /dev/null
+++ b/usr.bin/ypmatch/Makefile.depend
@@ -0,0 +1,20 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ 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/ypmatch/ypmatch.1 b/usr.bin/ypmatch/ypmatch.1
new file mode 100644
index 0000000..0a0b6e0
--- /dev/null
+++ b/usr.bin/ypmatch/ypmatch.1
@@ -0,0 +1,75 @@
+.\" Copyright (c) 1993 Winning Strategies, 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Winning Strategies, Inc.
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 3, 2015
+.Dt YPMATCH 1
+.Os
+.Sh NAME
+.Nm ypmatch
+.Nd print the values of one or more keys in a NIS database
+.Sh SYNOPSIS
+.Nm
+.Op Fl kt
+.Op Fl d Ar domainname
+.Ar key ...
+.Ar mapname
+.Nm
+.Fl x
+.Sh DESCRIPTION
+The
+.Nm
+utility prints out the values of one or more keys from the
+.Tn NIS
+database specified by
+.Ar mapname ,
+which may be a map name or a map nickname.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar domainname
+Specify a domain other than the default domain.
+.It Fl k
+Display map keys.
+This option is useful with maps in which the values are null or the key
+is not part of the value.
+.It Fl t
+Inhibit translation of map nicknames
+to their corresponding map names.
+.It Fl x
+Display the map nickname table.
+.El
+.Sh SEE ALSO
+.Xr domainname 1 ,
+.Xr ypcat 1 ,
+.Xr yp 8 ,
+.Xr ypbind 8 ,
+.Xr ypset 8
+.Sh AUTHORS
+.An Theo De Raadt Aq Mt deraadt@theos.com .
diff --git a/usr.bin/ypmatch/ypmatch.c b/usr.bin/ypmatch/ypmatch.c
new file mode 100644
index 0000000..e1e209b
--- /dev/null
+++ b/usr.bin/ypmatch/ypmatch.c
@@ -0,0 +1,140 @@
+/* $OpenBSD: ypmatch.c,v 1.16 2015/02/08 23:40:35 deraadt Exp $ */
+/* $NetBSD: ypmatch.c,v 1.8 1996/05/07 01:24:52 jtc Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com>
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <rpc/rpc.h>
+#include <rpc/xdr.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+
+static const struct ypalias {
+ char *alias, *name;
+} ypaliases[] = {
+ { "passwd", "passwd.byname" },
+ { "master.passwd", "master.passwd.byname" },
+ { "shadow", "shadow.byname" },
+ { "group", "group.byname" },
+ { "networks", "networks.byaddr" },
+ { "hosts", "hosts.byname" },
+ { "protocols", "protocols.bynumber" },
+ { "services", "services.byname" },
+ { "aliases", "mail.aliases" },
+ { "ethers", "ethers.byname" },
+};
+
+static void
+usage(void)
+{
+ fprintf(stderr, "%s\n%s\n",
+ "usage: ypmatch [-kt] [-d domainname] key ... mapname",
+ " ypmatch -x");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *domainname, *inkey, *inmap, *outbuf;
+ int outbuflen, key, notrans, rval;
+ int c, r;
+ u_int i;
+
+ domainname = NULL;
+ notrans = key = 0;
+ while ((c = getopt(argc, argv, "xd:kt")) != -1)
+ switch (c) {
+ case 'x':
+ for (i = 0; i < nitems(ypaliases); i++)
+ printf("Use \"%s\" for \"%s\"\n",
+ ypaliases[i].alias,
+ ypaliases[i].name);
+ exit(0);
+ case 'd':
+ domainname = optarg;
+ break;
+ case 't':
+ notrans = 1;
+ break;
+ case 'k':
+ key = 1;
+ break;
+ default:
+ usage();
+ }
+
+ if (argc - optind < 2)
+ usage();
+
+ if (domainname == NULL)
+ yp_get_default_domain(&domainname);
+
+ inmap = argv[argc-1];
+ if (notrans == 0) {
+ for (i = 0; i < nitems(ypaliases); i++)
+ if (strcmp(inmap, ypaliases[i].alias) == 0)
+ inmap = ypaliases[i].name;
+ }
+
+ rval = 0;
+ for (; optind < argc - 1; optind++) {
+ inkey = argv[optind];
+
+ r = yp_match(domainname, inmap, inkey,
+ strlen(inkey), &outbuf, &outbuflen);
+ switch (r) {
+ case 0:
+ if (key)
+ printf("%s: ", inkey);
+ printf("%*.*s\n", outbuflen, outbuflen, outbuf);
+ break;
+ case YPERR_YPBIND:
+ errx(1, "not running ypbind");
+ default:
+ errx(1, "can't match key %s in map %s. reason: %s",
+ inkey, inmap, yperr_string(r));
+ rval = 1;
+ break;
+ }
+ }
+ exit(rval);
+}
diff --git a/usr.bin/ypwhich/Makefile b/usr.bin/ypwhich/Makefile
new file mode 100644
index 0000000..15dc9f8
--- /dev/null
+++ b/usr.bin/ypwhich/Makefile
@@ -0,0 +1,14 @@
+# from: @(#)Makefile 5.8 (Berkeley) 7/28/90
+# $FreeBSD$
+
+YPSERV=${.CURDIR}/../../usr.sbin/ypserv/common
+.PATH: ${YPSERV}
+
+PROG= ypwhich
+SRCS= yplib_host.c ypwhich.c
+
+CFLAGS+= -I${YPSERV} -I.
+
+WARNS?= 2
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ypwhich/Makefile.depend b/usr.bin/ypwhich/Makefile.depend
new file mode 100644
index 0000000..c0b7a14
--- /dev/null
+++ b/usr.bin/ypwhich/Makefile.depend
@@ -0,0 +1,21 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ include/rpcsvc \
+ 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/ypwhich/ypwhich.1 b/usr.bin/ypwhich/ypwhich.1
new file mode 100644
index 0000000..009430d
--- /dev/null
+++ b/usr.bin/ypwhich/ypwhich.1
@@ -0,0 +1,103 @@
+.\" $NetBSD: ypwhich.1,v 1.3 1996/05/13 02:43:46 thorpej Exp $
+.\"
+.\" Copyright (c) 1994 Christopher G. Demetriou
+.\" 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 Christopher G. Demetriou.
+.\" 3. 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 3, 2015
+.Dt YPWHICH 1
+.Os
+.Sh NAME
+.Nm ypwhich
+.Nd return hostname of NIS server of map master
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar domain
+.Oo
+.Op Fl t
+.Fl m Oo Ar mname Oc | Ar host
+.Oc
+.Nm
+.Fl x
+.Sh DESCRIPTION
+The
+.Nm
+utility tells which
+.Tn NIS
+server supplies
+.Tn NIS
+services to a client, or which is the master for a map.
+If invoked without arguments, it gives the
+.Tn NIS
+server for the local machine.
+If
+.Ar host
+is specified, that machine is queried to find out
+which
+.Tn NIS
+server it is using.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar domain
+Specify a domain other than the default domain.
+.It Fl t
+Inhibit translation of map nicknames
+to their corresponding map names.
+.It Fl m Op Ar mname
+Find the master
+.Tn NIS
+server for the named map.
+No
+.Ar host
+may be specified with the
+.Fl m
+option.
+The
+.Ar mname
+argument
+can be a map name or nickname.
+If
+.Ar mname
+is omitted,
+.Nm
+will produce a list of available maps.
+.It Fl x
+Display the map nickname table.
+.El
+.Sh SEE ALSO
+.Xr domainname 1 ,
+.Xr ypcat 1 ,
+.Xr ypmatch 1 ,
+.Xr yp 8 ,
+.Xr ypbind 8 ,
+.Xr yppoll 8 ,
+.Xr ypset 8
+.Sh AUTHORS
+.An Theo De Raadt
diff --git a/usr.bin/ypwhich/ypwhich.c b/usr.bin/ypwhich/ypwhich.c
new file mode 100644
index 0000000..55e1b13
--- /dev/null
+++ b/usr.bin/ypwhich/ypwhich.c
@@ -0,0 +1,277 @@
+/* $OpenBSD: ypwhich.c,v 1.23 2015/02/08 23:40:35 deraadt Exp $ */
+/* $NetBSD: ypwhich.c,v 1.6 1996/05/13 02:43:48 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
+ * 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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <rpc/rpc.h>
+#include <rpc/xdr.h>
+#include <rpcsvc/yp.h>
+#include <rpcsvc/ypclnt.h>
+
+#include "yplib_host.h"
+
+static const struct ypalias {
+ char *alias, *name;
+} ypaliases[] = {
+ { "passwd", "passwd.byname" },
+ { "master.passwd", "master.passwd.byname" },
+ { "shadow", "shadow.byname" },
+ { "group", "group.byname" },
+ { "networks", "networks.byaddr" },
+ { "hosts", "hosts.byaddr" },
+ { "protocols", "protocols.bynumber" },
+ { "services", "services.byname" },
+ { "aliases", "mail.aliases" },
+ { "ethers", "ethers.byname" },
+};
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: ypwhich [-t] [-d domain] [[-h] host]\n"
+ " ypwhich [-t] [-d domain] [-h host] -m [mname]\n"
+ " ypwhich -x\n");
+ exit(1);
+}
+
+
+/*
+ * Like yp_bind except can query a specific host
+ */
+static int
+bind_host(char *dom, struct sockaddr_in *sin)
+{
+ struct hostent *hent = NULL;
+ struct ypbind_resp ypbr;
+ struct in_addr ss_addr;
+ struct timeval tv;
+ CLIENT *client;
+ int sock, r;
+
+ sock = RPC_ANYSOCK;
+ tv.tv_sec = 15;
+ tv.tv_usec = 0;
+ client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock);
+
+ if (client == NULL) {
+ warnx("host is not bound to a ypmaster");
+ return (YPERR_YPBIND);
+ }
+
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+
+ r = clnt_call(client, YPBINDPROC_DOMAIN,
+ (xdrproc_t)xdr_domainname, &dom,
+ (xdrproc_t)xdr_ypbind_resp, &ypbr, tv);
+ if (r != RPC_SUCCESS) {
+ warnx("can't clnt_call: %s", yperr_string(YPERR_YPBIND));
+ clnt_destroy(client);
+ return (YPERR_YPBIND);
+ } else {
+ if (ypbr.ypbind_status != YPBIND_SUCC_VAL) {
+ warnx("can't yp_bind: reason: %s",
+ yperr_string(ypbr.ypbind_status));
+ clnt_destroy(client);
+ return (r);
+ }
+ }
+ clnt_destroy(client);
+
+ memmove(&ss_addr.s_addr, &ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
+ sizeof (ss_addr));
+
+ hent = gethostbyaddr((char *)&ss_addr.s_addr, sizeof(ss_addr.s_addr),
+ AF_INET);
+ if (hent != NULL)
+ printf("%s\n", hent->h_name);
+ else
+ printf("%s\n", inet_ntoa(ss_addr));
+
+ return (0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *domain, *master, *map = NULL, *host = NULL;
+ int notrans = 0, mode = 0, c, r, i;
+ struct ypmaplist *ypml, *y;
+ struct sockaddr_in sin;
+ struct hostent *hent;
+ CLIENT *client = NULL;
+
+ yp_get_default_domain(&domain);
+ if (domain == NULL)
+ errx(1, "YP domain name not set");
+
+ while ((c = getopt(argc, argv, "xd:h:mt")) != -1)
+ switch (c) {
+ case 'x':
+ for (i = 0; i < nitems(ypaliases); i++)
+ printf("\"%s\" is an alias for \"%s\"\n",
+ ypaliases[i].alias,
+ ypaliases[i].name);
+ exit(0);
+ case 'h':
+ host = optarg;
+ break;
+ case 'd':
+ domain = optarg;
+ break;
+ case 't':
+ notrans = 1;
+ break;
+ case 'm':
+ mode = 1;
+ break;
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (mode == 0) {
+ switch (argc) {
+ case 0:
+ memset(&sin, 0, sizeof sin);
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+ if (bind_host(domain, &sin))
+ exit(1);
+ break;
+ case 1:
+ bzero(&sin, sizeof sin);
+ sin.sin_family = AF_INET;
+ if (inet_aton(argv[0], &sin.sin_addr) == 0) {
+ hent = gethostbyname(argv[0]);
+ if (!hent) {
+ errx(1, "host %s unknown",
+ argv[0]);
+ }
+ }
+ if (bind_host(domain, &sin))
+ exit(1);
+ break;
+ default:
+ usage();
+ }
+ exit(0);
+ }
+
+ if (argc > 1)
+ usage();
+
+ if (host != NULL)
+ client = yp_bind_host(host, YPPROG, YPVERS, 0, 1);
+
+ if (argv[0]) {
+ map = argv[0];
+ if (notrans == 0) {
+ for (i = 0; i < nitems(ypaliases); i++)
+ if (strcmp(map, ypaliases[i].alias) == 0)
+ map = ypaliases[i].name;
+ }
+
+ if (host != NULL)
+ r = yp_master_host(client, domain, map, &master);
+ else
+ r = yp_master(domain, map, &master);
+
+ switch (r) {
+ case 0:
+ printf("%s\n", master);
+ free(master);
+ break;
+ case YPERR_YPBIND:
+ errx(1, "not running ypbind");
+ default:
+ errx(1, "can't find master for map %s: reason: %s",
+ map, yperr_string(r));
+ }
+ exit(0);
+ }
+
+ ypml = NULL;
+ if (host != NULL)
+ r = yp_maplist_host(client, domain, &ypml);
+ else
+ r = yp_maplist(domain, &ypml);
+
+ r = 0;
+ switch (r) {
+ case 0:
+ for (y = ypml; y; ) {
+ ypml = y;
+ if (host != NULL) {
+ r = yp_master_host(client,
+ domain, ypml->map, &master);
+ } else {
+ r = yp_master(domain, ypml->map, &master);
+ }
+ switch (r) {
+ case 0:
+ printf("%s %s\n", ypml->map, master);
+ free(master);
+ break;
+ default:
+ warnx("can't find the master of %s: reason: %s",
+ ypml->map, yperr_string(r));
+ break;
+ }
+ y = ypml->next;
+ free(ypml);
+ }
+ break;
+ case YPERR_YPBIND:
+ errx(1, "not running ypbind");
+ default:
+ errx(1, "can't get map list for domain %s: reason: %s",
+ domain, yperr_string(r));
+ }
+ exit(0);
+}
OpenPOWER on IntegriCloud